From 1fc48ce120a376c288daeeed98daccecf1b60d7b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 30 Sep 2015 17:21:14 +0200 Subject: move mess into mame (nw) --- makefile | 2 - scripts/genie.lua | 1 + scripts/src/devices.lua | 3 +- scripts/src/tools.lua | 78 +- scripts/target/mame/dummy.lua | 6 +- scripts/target/mame/mess.lua | 1917 ++++--- src/build/makedep.py | 5 +- src/devices/bus/ieee488/softbox.c | 2 +- src/mame/audio/alesis.c | 157 + src/mame/audio/arcadia.c | 177 + src/mame/audio/arcadia.h | 44 + src/mame/audio/channelf.c | 143 + src/mame/audio/channelf.h | 42 + src/mame/audio/dai_snd.c | 141 + src/mame/audio/dai_snd.h | 46 + src/mame/audio/dave.c | 622 +++ src/mame/audio/dave.h | 156 + src/mame/audio/gamate.c | 253 + src/mame/audio/gb.c | 795 +++ src/mame/audio/gb.h | 105 + src/mame/audio/lynx.c | 540 ++ src/mame/audio/lynx.h | 90 + src/mame/audio/mac.c | 174 + src/mame/audio/mea8000.c | 585 ++ src/mame/audio/mea8000.h | 140 + src/mame/audio/socrates.c | 127 + src/mame/audio/socrates.h | 44 + src/mame/audio/specimx_snd.c | 101 + src/mame/audio/specimx_snd.h | 39 + src/mame/audio/svis_snd.c | 269 + src/mame/audio/svis_snd.h | 142 + src/mame/audio/tvc_snd.c | 142 + src/mame/audio/tvc_snd.h | 59 + src/mame/audio/upd1771.c | 554 ++ src/mame/audio/upd1771.h | 85 + src/mame/audio/vboy.c | 491 ++ src/mame/audio/vboy.h | 108 + src/mame/audio/vc4000snd.c | 74 + src/mame/audio/vc4000snd.h | 47 + src/mame/audio/wswan_snd.c | 374 ++ src/mame/audio/wswan_snd.h | 91 + src/mame/drivers/4004clk.c | 193 + src/mame/drivers/68ksbc.c | 98 + src/mame/drivers/a2600.c | 552 ++ src/mame/drivers/a310.c | 453 ++ src/mame/drivers/a5105.c | 624 +++ src/mame/drivers/a51xx.c | 177 + src/mame/drivers/a6809.c | 277 + src/mame/drivers/a7150.c | 83 + src/mame/drivers/a7800.c | 1464 +++++ src/mame/drivers/abc1600.c | 967 ++++ src/mame/drivers/abc80.c | 630 +++ src/mame/drivers/abc80x.c | 1641 ++++++ src/mame/drivers/ac1.c | 218 + src/mame/drivers/acrnsys1.c | 282 + src/mame/drivers/adam.c | 1147 ++++ src/mame/drivers/advision.c | 113 + src/mame/drivers/aim65.c | 288 + src/mame/drivers/aim65_40.c | 145 + src/mame/drivers/alesis.c | 485 ++ src/mame/drivers/alphasma.c | 479 ++ src/mame/drivers/alphatro.c | 517 ++ src/mame/drivers/altair.c | 132 + src/mame/drivers/alto2.c | 303 + src/mame/drivers/altos5.c | 457 ++ src/mame/drivers/amico2k.c | 241 + src/mame/drivers/amiga.c | 2144 ++++++++ src/mame/drivers/ampro.c | 202 + src/mame/drivers/amstr_pc.c | 659 +++ src/mame/drivers/amstrad.c | 1287 +++++ src/mame/drivers/amust.c | 467 ++ src/mame/drivers/apc.c | 1000 ++++ src/mame/drivers/apexc.c | 911 ++++ src/mame/drivers/apf.c | 605 ++ src/mame/drivers/apogee.c | 280 + src/mame/drivers/apollo.c | 1276 +++++ src/mame/drivers/apple1.c | 331 ++ src/mame/drivers/apple2.c | 1614 ++++++ src/mame/drivers/apple2e.c | 3582 ++++++++++++ src/mame/drivers/apple2gs.c | 597 ++ src/mame/drivers/apple3.c | 349 ++ src/mame/drivers/applix.c | 1104 ++++ src/mame/drivers/apricot.c | 509 ++ src/mame/drivers/apricotf.c | 435 ++ src/mame/drivers/apricotp.c | 690 +++ src/mame/drivers/aquarius.c | 420 ++ src/mame/drivers/arcadia.c | 842 +++ src/mame/drivers/argo.c | 382 ++ src/mame/drivers/asst128.c | 145 + src/mame/drivers/astrohome.c | 272 + src/mame/drivers/at.c | 1708 ++++++ src/mame/drivers/atari400.c | 2480 +++++++++ src/mame/drivers/atarist.c | 3224 +++++++++++ src/mame/drivers/atm.c | 248 + src/mame/drivers/atom.c | 893 +++ src/mame/drivers/attache.c | 1010 ++++ src/mame/drivers/aussiebyte.c | 574 ++ src/mame/drivers/avigo.c | 1017 ++++ src/mame/drivers/ax20.c | 158 + src/mame/drivers/b16.c | 312 ++ src/mame/drivers/b2m.c | 273 + src/mame/drivers/babbage.c | 278 + src/mame/drivers/banctec.c | 133 + src/mame/drivers/basic52.c | 158 + src/mame/drivers/bbc.c | 1998 +++++++ src/mame/drivers/bbcbc.c | 164 + src/mame/drivers/bcs3.c | 492 ++ src/mame/drivers/bebox.c | 261 + src/mame/drivers/beehive.c | 322 ++ src/mame/drivers/besta.c | 164 + src/mame/drivers/beta.c | 378 ++ src/mame/drivers/bigbord2.c | 621 +++ src/mame/drivers/binbug.c | 590 ++ src/mame/drivers/bitgraph.c | 622 +++ src/mame/drivers/bk.c | 235 + src/mame/drivers/bmjr.c | 385 ++ src/mame/drivers/bml3.c | 1114 ++++ src/mame/drivers/bob85.c | 226 + src/mame/drivers/br8641.c | 200 + src/mame/drivers/bullet.c | 1297 +++++ src/mame/drivers/busicom.c | 249 + src/mame/drivers/bw12.c | 670 +++ src/mame/drivers/bw2.c | 678 +++ src/mame/drivers/c10.c | 191 + src/mame/drivers/c128.c | 1977 +++++++ src/mame/drivers/c64.c | 1847 +++++++ src/mame/drivers/c64dtv.c | 68 + src/mame/drivers/c65.c | 669 +++ src/mame/drivers/c65_old.c | 648 +++ src/mame/drivers/c80.c | 293 + src/mame/drivers/c900.c | 135 + src/mame/drivers/camplynx.c | 633 +++ src/mame/drivers/canon_s80.c | 54 + src/mame/drivers/casloopy.c | 566 ++ src/mame/drivers/cat.c | 1843 +++++++ src/mame/drivers/cbm2.c | 2767 ++++++++++ src/mame/drivers/cc40.c | 641 +++ src/mame/drivers/ccs2810.c | 382 ++ src/mame/drivers/ccs300.c | 142 + src/mame/drivers/cd2650.c | 323 ++ src/mame/drivers/cdc721.c | 144 + src/mame/drivers/cfx9850.c | 293 + src/mame/drivers/cgc7900.c | 448 ++ src/mame/drivers/cgenie.c | 522 ++ src/mame/drivers/channelf.c | 349 ++ src/mame/drivers/chaos.c | 164 + src/mame/drivers/chessmst.c | 286 + src/mame/drivers/chesstrv.c | 256 + src/mame/drivers/clcd.c | 847 +++ src/mame/drivers/cm1800.c | 121 + src/mame/drivers/coco12.c | 447 ++ src/mame/drivers/coco3.c | 375 ++ src/mame/drivers/codata.c | 113 + src/mame/drivers/coleco.c | 499 ++ src/mame/drivers/compis.c | 792 +++ src/mame/drivers/compucolor.c | 506 ++ src/mame/drivers/comquest.c | 310 ++ src/mame/drivers/comx35.c | 723 +++ src/mame/drivers/concept.c | 320 ++ src/mame/drivers/cortex.c | 107 + src/mame/drivers/cosmicos.c | 563 ++ src/mame/drivers/cp1.c | 334 ++ src/mame/drivers/craft.c | 269 + src/mame/drivers/crvision.c | 903 +++ src/mame/drivers/csc.c | 346 ++ src/mame/drivers/ct486.c | 198 + src/mame/drivers/cvicny.c | 149 + src/mame/drivers/cxhumax.c | 1085 ++++ src/mame/drivers/cybiko.c | 461 ++ src/mame/drivers/czk80.c | 230 + src/mame/drivers/d6800.c | 435 ++ src/mame/drivers/d6809.c | 167 + src/mame/drivers/dai.c | 259 + src/mame/drivers/daruma.c | 169 + src/mame/drivers/dccons.c | 760 +++ src/mame/drivers/dct11em.c | 83 + src/mame/drivers/dectalk.c | 1010 ++++ src/mame/drivers/decwritr.c | 386 ++ src/mame/drivers/dgn_beta.c | 413 ++ src/mame/drivers/digel804.c | 726 +++ src/mame/drivers/dim68k.c | 398 ++ src/mame/drivers/dm7000.c | 352 ++ src/mame/drivers/dms5000.c | 86 + src/mame/drivers/dms86.c | 131 + src/mame/drivers/dmv.c | 850 +++ src/mame/drivers/dolphunk.c | 266 + src/mame/drivers/dps1.c | 41 + src/mame/drivers/dragon.c | 334 ++ src/mame/drivers/dsb46.c | 122 + src/mame/drivers/dual68.c | 115 + src/mame/drivers/dvk_kcgd.c | 384 ++ src/mame/drivers/dvk_ksm.c | 418 ++ src/mame/drivers/eacc.c | 280 + src/mame/drivers/ec184x.c | 387 ++ src/mame/drivers/ec65.c | 250 + src/mame/drivers/einstein.c | 833 +++ src/mame/drivers/elecbowl.c | 222 + src/mame/drivers/electron.c | 208 + src/mame/drivers/elekscmp.c | 165 + src/mame/drivers/elf.c | 288 + src/mame/drivers/elwro800.c | 626 +++ src/mame/drivers/enmirage.c | 286 + src/mame/drivers/ep64.c | 600 ++ src/mame/drivers/esq1.c | 698 +++ src/mame/drivers/esq5505.c | 955 ++++ src/mame/drivers/esqasr.c | 167 + src/mame/drivers/esqkt.c | 272 + src/mame/drivers/esqmr.c | 319 ++ src/mame/drivers/et3400.c | 123 + src/mame/drivers/eti660.c | 244 + src/mame/drivers/europc.c | 508 ++ src/mame/drivers/evmbug.c | 117 + src/mame/drivers/excali64.c | 647 +++ src/mame/drivers/exelv.c | 606 ++ src/mame/drivers/exp85.c | 234 + src/mame/drivers/fanucs15.c | 423 ++ src/mame/drivers/fanucspmg.c | 1011 ++++ src/mame/drivers/fb01.c | 228 + src/mame/drivers/fc100.c | 578 ++ src/mame/drivers/fidelz80.c | 1426 +++++ src/mame/drivers/fk1.c | 477 ++ src/mame/drivers/fm7.c | 2539 +++++++++ src/mame/drivers/fmtowns.c | 2982 ++++++++++ src/mame/drivers/force68k.c | 606 ++ src/mame/drivers/fp1100.c | 705 +++ src/mame/drivers/fp200.c | 626 +++ src/mame/drivers/fp6000.c | 330 ++ src/mame/drivers/ft68m.c | 128 + src/mame/drivers/galaxy.c | 274 + src/mame/drivers/galeb.c | 171 + src/mame/drivers/gamate.c | 408 ++ src/mame/drivers/gamecom.c | 299 + src/mame/drivers/gameking.c | 195 + src/mame/drivers/gamepock.c | 83 + src/mame/drivers/gb.c | 984 ++++ src/mame/drivers/gba.c | 2318 ++++++++ src/mame/drivers/geneve.c | 766 +++ src/mame/drivers/geniusiq.c | 900 +++ src/mame/drivers/genpc.c | 280 + src/mame/drivers/gimix.c | 686 +++ src/mame/drivers/gizmondo.c | 249 + src/mame/drivers/glasgow.c | 509 ++ src/mame/drivers/gmaster.c | 315 ++ src/mame/drivers/gp2x.c | 393 ++ src/mame/drivers/gp32.c | 1726 ++++++ src/mame/drivers/grfd2301.c | 139 + src/mame/drivers/h19.c | 452 ++ src/mame/drivers/h8.c | 368 ++ src/mame/drivers/h89.c | 151 + src/mame/drivers/harriet.c | 225 + src/mame/drivers/hec2hrp.c | 731 +++ src/mame/drivers/hh_cop400.c | 841 +++ src/mame/drivers/hh_hmcs40.c | 4178 ++++++++++++++ src/mame/drivers/hh_melps4.c | 473 ++ src/mame/drivers/hh_pic16.c | 302 + src/mame/drivers/hh_sm510.c | 402 ++ src/mame/drivers/hh_tms1k.c | 4636 ++++++++++++++++ src/mame/drivers/hh_ucom4.c | 2552 +++++++++ src/mame/drivers/hk68v10.c | 389 ++ src/mame/drivers/homelab.c | 911 ++++ src/mame/drivers/homez80.c | 315 ++ src/mame/drivers/horizon.c | 221 + src/mame/drivers/hp16500.c | 507 ++ src/mame/drivers/hp48.c | 1373 +++++ src/mame/drivers/hp49gp.c | 337 ++ src/mame/drivers/hp64k.c | 1424 +++++ src/mame/drivers/hp9845.c | 172 + src/mame/drivers/hp9k.c | 432 ++ src/mame/drivers/hp9k_3xx.c | 475 ++ src/mame/drivers/hp_ipc.c | 358 ++ src/mame/drivers/hprot1.c | 381 ++ src/mame/drivers/hpz80unk.c | 159 + src/mame/drivers/ht68k.c | 160 + src/mame/drivers/huebler.c | 398 ++ src/mame/drivers/hunter2.c | 442 ++ src/mame/drivers/hx20.c | 922 ++++ src/mame/drivers/hyperscan.c | 647 +++ src/mame/drivers/i7000.c | 401 ++ src/mame/drivers/ibm6580.c | 104 + src/mame/drivers/ibmpc.c | 577 ++ src/mame/drivers/ibmpcjr.c | 705 +++ src/mame/drivers/icatel.c | 269 + src/mame/drivers/ie15.c | 663 +++ src/mame/drivers/if800.c | 117 + src/mame/drivers/imds.c | 116 + src/mame/drivers/imds2.c | 876 +++ src/mame/drivers/imsai.c | 142 + src/mame/drivers/indiana.c | 122 + src/mame/drivers/instruct.c | 438 ++ src/mame/drivers/interact.c | 299 + src/mame/drivers/intv.c | 752 +++ src/mame/drivers/ip20.c | 632 +++ src/mame/drivers/ip22.c | 1675 ++++++ src/mame/drivers/ipc.c | 140 + src/mame/drivers/ipds.c | 168 + src/mame/drivers/iq151.c | 476 ++ src/mame/drivers/irisha.c | 441 ++ src/mame/drivers/isbc.c | 367 ++ src/mame/drivers/iskr103x.c | 146 + src/mame/drivers/itt3030.c | 819 +++ src/mame/drivers/jade.c | 111 + src/mame/drivers/jonos.c | 158 + src/mame/drivers/jr100.c | 425 ++ src/mame/drivers/jr200.c | 601 ++ src/mame/drivers/jtc.c | 851 +++ src/mame/drivers/juicebox.c | 362 ++ src/mame/drivers/junior.c | 259 + src/mame/drivers/jupace.c | 835 +++ src/mame/drivers/jupiter.c | 365 ++ src/mame/drivers/k1003.c | 197 + src/mame/drivers/k8915.c | 187 + src/mame/drivers/kaypro.c | 461 ++ src/mame/drivers/kc.c | 320 ++ src/mame/drivers/kim1.c | 359 ++ src/mame/drivers/konin.c | 115 + src/mame/drivers/korgm1.c | 209 + src/mame/drivers/kramermc.c | 151 + src/mame/drivers/kyocera.c | 1640 ++++++ src/mame/drivers/laser3k.c | 1037 ++++ src/mame/drivers/lc80.c | 441 ++ src/mame/drivers/lcmate2.c | 268 + src/mame/drivers/leapster.c | 340 ++ src/mame/drivers/lft.c | 117 + src/mame/drivers/lg-dvd.c | 41 + src/mame/drivers/lisa.c | 486 ++ src/mame/drivers/llc.c | 311 ++ src/mame/drivers/lola8a.c | 295 + src/mame/drivers/lviv.c | 491 ++ src/mame/drivers/lynx.c | 199 + src/mame/drivers/m20.c | 860 +++ src/mame/drivers/m24.c | 312 ++ src/mame/drivers/m5.c | 726 +++ src/mame/drivers/m6805evs.c | 80 + src/mame/drivers/m79152pc.c | 145 + src/mame/drivers/mac.c | 2482 +++++++++ src/mame/drivers/macpci.c | 166 + src/mame/drivers/mbc200.c | 267 + src/mame/drivers/mbc55x.c | 316 ++ src/mame/drivers/mbdtower.c | 285 + src/mame/drivers/mbee.c | 1164 ++++ src/mame/drivers/mc10.c | 608 +++ src/mame/drivers/mc1000.c | 502 ++ src/mame/drivers/mc1502.c | 410 ++ src/mame/drivers/mc80.c | 304 ++ src/mame/drivers/mcb216.c | 161 + src/mame/drivers/mccpm.c | 152 + src/mame/drivers/megadriv.c | 939 ++++ src/mame/drivers/mekd2.c | 426 ++ src/mame/drivers/mephisto.c | 470 ++ src/mame/drivers/mes.c | 141 + src/mame/drivers/mice.c | 121 + src/mame/drivers/microdec.c | 142 + src/mame/drivers/microkit.c | 46 + src/mame/drivers/micronic.c | 399 ++ src/mame/drivers/microtan.c | 288 + src/mame/drivers/microvsn.c | 707 +++ src/mame/drivers/mikro80.c | 239 + src/mame/drivers/mikromik.c | 578 ++ src/mame/drivers/mikrosha.c | 281 + src/mame/drivers/mini2440.c | 275 + src/mame/drivers/minicom.c | 254 + src/mame/drivers/mits680b.c | 117 + src/mame/drivers/mk1.c | 209 + src/mame/drivers/mk14.c | 163 + src/mame/drivers/mk2.c | 225 + src/mame/drivers/mk85.c | 92 + src/mame/drivers/mk90.c | 102 + src/mame/drivers/mkit09.c | 212 + src/mame/drivers/mmd1.c | 531 ++ src/mame/drivers/mmodular.c | 1911 +++++++ src/mame/drivers/mod8.c | 171 + src/mame/drivers/modellot.c | 189 + src/mame/drivers/molecular.c | 356 ++ src/mame/drivers/monty.c | 288 + src/mame/drivers/mpf1.c | 483 ++ src/mame/drivers/mps1230.c | 154 + src/mame/drivers/mpz80.c | 807 +++ src/mame/drivers/ms0515.c | 258 + src/mame/drivers/ms9540.c | 106 + src/mame/drivers/msbc1.c | 113 + src/mame/drivers/mstation.c | 560 ++ src/mame/drivers/msx.c | 8494 +++++++++++++++++++++++++++++ src/mame/drivers/mt735.c | 71 + src/mame/drivers/mtx.c | 444 ++ src/mame/drivers/multi16.c | 167 + src/mame/drivers/multi8.c | 681 +++ src/mame/drivers/mvme350.c | 257 + src/mame/drivers/mx2178.c | 204 + src/mame/drivers/myb3k.c | 286 + src/mame/drivers/mycom.c | 585 ++ src/mame/drivers/myvision.c | 250 + src/mame/drivers/mz2000.c | 908 +++ src/mame/drivers/mz2500.c | 2201 ++++++++ src/mame/drivers/mz3500.c | 873 +++ src/mame/drivers/mz6500.c | 180 + src/mame/drivers/mz700.c | 456 ++ src/mame/drivers/mz80.c | 380 ++ src/mame/drivers/mzr8105.c | 369 ++ src/mame/drivers/n64.c | 499 ++ src/mame/drivers/nakajies.c | 835 +++ src/mame/drivers/nanos.c | 544 ++ src/mame/drivers/nascom1.c | 776 +++ src/mame/drivers/nc.c | 1556 ++++++ src/mame/drivers/nes.c | 347 ++ src/mame/drivers/newbrain.c | 1493 +++++ src/mame/drivers/next.c | 1225 +++++ src/mame/drivers/ng_aes.c | 1641 ++++++ src/mame/drivers/ngen.c | 1179 ++++ src/mame/drivers/ngp.c | 895 +++ src/mame/drivers/ob68k1a.c | 292 + src/mame/drivers/octopus.c | 198 + src/mame/drivers/odyssey2.c | 833 +++ src/mame/drivers/okean240.c | 538 ++ src/mame/drivers/ondra.c | 183 + src/mame/drivers/onyx.c | 169 + src/mame/drivers/orao.c | 215 + src/mame/drivers/oric.c | 951 ++++ src/mame/drivers/orion.c | 372 ++ src/mame/drivers/osbexec.c | 581 ++ src/mame/drivers/osborne1.c | 262 + src/mame/drivers/osi.c | 908 +++ src/mame/drivers/p112.c | 128 + src/mame/drivers/p2000t.c | 291 + src/mame/drivers/p8k.c | 595 ++ src/mame/drivers/palm.c | 504 ++ src/mame/drivers/palm_dbg.inc | 1194 ++++ src/mame/drivers/palmz22.c | 338 ++ src/mame/drivers/partner.c | 242 + src/mame/drivers/paso1600.c | 350 ++ src/mame/drivers/pasogo.c | 576 ++ src/mame/drivers/pasopia.c | 359 ++ src/mame/drivers/pasopia7.c | 1066 ++++ src/mame/drivers/pb1000.c | 571 ++ src/mame/drivers/pc.c | 475 ++ src/mame/drivers/pc100.c | 520 ++ src/mame/drivers/pc1500.c | 298 + src/mame/drivers/pc1512.c | 1514 +++++ src/mame/drivers/pc2000.c | 1031 ++++ src/mame/drivers/pc4.c | 250 + src/mame/drivers/pc6001.c | 2476 +++++++++ src/mame/drivers/pc8001.c | 601 ++ src/mame/drivers/pc8401a.c | 677 +++ src/mame/drivers/pc8801.c | 2971 ++++++++++ src/mame/drivers/pc88va.c | 1919 +++++++ src/mame/drivers/pc9801.c | 3886 +++++++++++++ src/mame/drivers/pcd.c | 603 ++ src/mame/drivers/pce.c | 429 ++ src/mame/drivers/pce220.c | 1049 ++++ src/mame/drivers/pcfx.c | 531 ++ src/mame/drivers/pcm.c | 330 ++ src/mame/drivers/pcw.c | 1403 +++++ src/mame/drivers/pcw16.c | 1094 ++++ src/mame/drivers/pda600.c | 238 + src/mame/drivers/pdp1.c | 1979 +++++++ src/mame/drivers/pdp11.c | 470 ++ src/mame/drivers/pecom.c | 217 + src/mame/drivers/pegasus.c | 581 ++ src/mame/drivers/pencil2.c | 348 ++ src/mame/drivers/pentagon.c | 354 ++ src/mame/drivers/peoplepc.c | 302 + src/mame/drivers/pes.c | 285 + src/mame/drivers/pet.c | 2620 +++++++++ src/mame/drivers/phc25.c | 384 ++ src/mame/drivers/phunsy.c | 398 ++ src/mame/drivers/pimps.c | 114 + src/mame/drivers/pipbug.c | 182 + src/mame/drivers/pitagjr.c | 232 + src/mame/drivers/pk8000.c | 413 ++ src/mame/drivers/pk8020.c | 292 + src/mame/drivers/plan80.c | 265 + src/mame/drivers/plus4.c | 1129 ++++ src/mame/drivers/pm68k.c | 104 + src/mame/drivers/pmd85.c | 813 +++ src/mame/drivers/pmi80.c | 175 + src/mame/drivers/pocketc.c | 988 ++++ src/mame/drivers/pockstat.c | 1017 ++++ src/mame/drivers/poisk1.c | 314 ++ src/mame/drivers/pokemini.c | 1798 ++++++ src/mame/drivers/poly.c | 229 + src/mame/drivers/poly88.c | 230 + src/mame/drivers/poly880.c | 288 + src/mame/drivers/portfoli.c | 929 ++++ src/mame/drivers/pp01.c | 276 + src/mame/drivers/prestige.c | 893 +++ src/mame/drivers/primo.c | 382 ++ src/mame/drivers/pro80.c | 171 + src/mame/drivers/prof180x.c | 329 ++ src/mame/drivers/prof80.c | 566 ++ src/mame/drivers/psion.c | 796 +++ src/mame/drivers/psx.c | 307 ++ src/mame/drivers/pt68k4.c | 491 ++ src/mame/drivers/ptcsol.c | 796 +++ src/mame/drivers/pulsar.c | 263 + src/mame/drivers/pv1000.c | 482 ++ src/mame/drivers/pv2000.c | 428 ++ src/mame/drivers/pv9234.c | 170 + src/mame/drivers/pve500.c | 441 ++ src/mame/drivers/px4.c | 1590 ++++++ src/mame/drivers/px8.c | 838 +++ src/mame/drivers/pyl601.c | 622 +++ src/mame/drivers/ql.c | 1152 ++++ src/mame/drivers/qtsbc.c | 101 + src/mame/drivers/qx10.c | 787 +++ src/mame/drivers/radio86.c | 561 ++ src/mame/drivers/rainbow.c | 2465 +++++++++ src/mame/drivers/rambo.c | 227 + src/mame/drivers/ravens.c | 388 ++ src/mame/drivers/rc759.c | 617 +++ src/mame/drivers/rd110.c | 278 + src/mame/drivers/replicator.c | 751 +++ src/mame/drivers/rex6000.c | 722 +++ src/mame/drivers/riscpc.c | 954 ++++ src/mame/drivers/rm380z.c | 179 + src/mame/drivers/rmnimbus.c | 225 + src/mame/drivers/rmt32.c | 438 ++ src/mame/drivers/rsc55.c | 83 + src/mame/drivers/rt1715.c | 377 ++ src/mame/drivers/rvoice.c | 405 ++ src/mame/drivers/rx78.c | 513 ++ src/mame/drivers/sacstate.c | 158 + src/mame/drivers/sage2.c | 569 ++ src/mame/drivers/samcoupe.c | 620 +++ src/mame/drivers/sapi1.c | 671 +++ src/mame/drivers/saturn.c | 904 +++ src/mame/drivers/savia84.c | 201 + src/mame/drivers/sbc6510.c | 326 ++ src/mame/drivers/sbrain.c | 376 ++ src/mame/drivers/sc1.c | 200 + src/mame/drivers/sc2.c | 238 + src/mame/drivers/scorpion.c | 377 ++ src/mame/drivers/scv.c | 719 +++ src/mame/drivers/sdk80.c | 205 + src/mame/drivers/sdk85.c | 145 + src/mame/drivers/sdk86.c | 212 + src/mame/drivers/seattlecmp.c | 127 + src/mame/drivers/segapico.c | 626 +++ src/mame/drivers/segapm.c | 80 + src/mame/drivers/selz80.c | 202 + src/mame/drivers/sg1000.c | 915 ++++ src/mame/drivers/sgi_ip2.c | 517 ++ src/mame/drivers/sgi_ip6.c | 269 + src/mame/drivers/sh4robot.c | 93 + src/mame/drivers/sitcom.c | 135 + src/mame/drivers/slc1.c | 285 + src/mame/drivers/slicer.c | 143 + src/mame/drivers/sm1800.c | 201 + src/mame/drivers/smc777.c | 1027 ++++ src/mame/drivers/sms.c | 1017 ++++ src/mame/drivers/snes.c | 1396 +++++ src/mame/drivers/socrates.c | 1587 ++++++ src/mame/drivers/softbox.c | 450 ++ src/mame/drivers/sorcerer.c | 510 ++ src/mame/drivers/spc1000.c | 522 ++ src/mame/drivers/spec128.c | 364 ++ src/mame/drivers/special.c | 599 ++ src/mame/drivers/specpls3.c | 461 ++ src/mame/drivers/spectrum.c | 995 ++++ src/mame/drivers/squale.c | 99 + src/mame/drivers/ssem.c | 655 +++ src/mame/drivers/ssystem3.c | 337 ++ src/mame/drivers/stratos.c | 370 ++ src/mame/drivers/studio2.c | 759 +++ src/mame/drivers/sun1.c | 170 + src/mame/drivers/sun2.c | 136 + src/mame/drivers/sun3.c | 977 ++++ src/mame/drivers/sun4.c | 595 ++ src/mame/drivers/super6.c | 573 ++ src/mame/drivers/super80.c | 970 ++++ src/mame/drivers/supercon.c | 811 +++ src/mame/drivers/superslave.c | 411 ++ src/mame/drivers/supracan.c | 1927 +++++++ src/mame/drivers/sv8000.c | 417 ++ src/mame/drivers/svi318.c | 540 ++ src/mame/drivers/svision.c | 606 ++ src/mame/drivers/svmu.c | 358 ++ src/mame/drivers/swtpc.c | 135 + src/mame/drivers/swtpc09.c | 265 + src/mame/drivers/sym1.c | 372 ++ src/mame/drivers/sys2900.c | 146 + src/mame/drivers/systec.c | 123 + src/mame/drivers/tamag1.c | 170 + src/mame/drivers/tandy1t.c | 819 +++ src/mame/drivers/tandy2k.c | 908 +++ src/mame/drivers/tavernie.c | 401 ++ src/mame/drivers/tb303.c | 312 ++ src/mame/drivers/tdv2324.c | 349 ++ src/mame/drivers/tec1.c | 463 ++ src/mame/drivers/tecnbras.c | 133 + src/mame/drivers/tek405x.c | 1252 +++++ src/mame/drivers/tek410x.c | 148 + src/mame/drivers/terak.c | 120 + src/mame/drivers/test_t400.c | 53 + src/mame/drivers/thomson.c | 2451 +++++++++ src/mame/drivers/ti630.c | 212 + src/mame/drivers/ti74.c | 605 ++ src/mame/drivers/ti85.c | 931 ++++ src/mame/drivers/ti89.c | 675 +++ src/mame/drivers/ti990_10.c | 389 ++ src/mame/drivers/ti990_4.c | 367 ++ src/mame/drivers/ti99_2.c | 416 ++ src/mame/drivers/ti99_4p.c | 914 ++++ src/mame/drivers/ti99_4x.c | 1179 ++++ src/mame/drivers/ti99_8.c | 1124 ++++ src/mame/drivers/ticalc1x.c | 1316 +++++ src/mame/drivers/tiki100.c | 745 +++ src/mame/drivers/tim011.c | 165 + src/mame/drivers/tim100.c | 168 + src/mame/drivers/timex.c | 781 +++ src/mame/drivers/tispeak.c | 1339 +++++ src/mame/drivers/tk2000.c | 608 +++ src/mame/drivers/tk80.c | 344 ++ src/mame/drivers/tk80bs.c | 225 + src/mame/drivers/tm990189.c | 1051 ++++ src/mame/drivers/tmc1800.c | 884 +++ src/mame/drivers/tmc2000e.c | 328 ++ src/mame/drivers/tmc600.c | 314 ++ src/mame/drivers/tricep.c | 94 + src/mame/drivers/trs80.c | 927 ++++ src/mame/drivers/trs80m2.c | 953 ++++ src/mame/drivers/ts802.c | 242 + src/mame/drivers/ts803.c | 68 + src/mame/drivers/ts816.c | 109 + src/mame/drivers/tsispch.c | 548 ++ src/mame/drivers/tutor.c | 796 +++ src/mame/drivers/tv950.c | 70 + src/mame/drivers/tvc.c | 876 +++ src/mame/drivers/tvgame.c | 133 + src/mame/drivers/tx0.c | 1625 ++++++ src/mame/drivers/uknc.c | 93 + src/mame/drivers/unior.c | 463 ++ src/mame/drivers/unistar.c | 125 + src/mame/drivers/univac.c | 214 + src/mame/drivers/unixpc.c | 235 + src/mame/drivers/ut88.c | 264 + src/mame/drivers/uzebox.c | 310 ++ src/mame/drivers/v1050.c | 1148 ++++ src/mame/drivers/v6809.c | 382 ++ src/mame/drivers/vax11.c | 174 + src/mame/drivers/vboy.c | 1397 +++++ src/mame/drivers/vc4000.c | 715 +++ src/mame/drivers/vcs80.c | 257 + src/mame/drivers/vector06.c | 233 + src/mame/drivers/vector4.c | 120 + src/mame/drivers/vg5k.c | 421 ++ src/mame/drivers/vic10.c | 678 +++ src/mame/drivers/vic20.c | 859 +++ src/mame/drivers/victor9k.c | 601 ++ src/mame/drivers/vidbrain.c | 601 ++ src/mame/drivers/vii.c | 1234 +++++ src/mame/drivers/vip.c | 810 +++ src/mame/drivers/vixen.c | 877 +++ src/mame/drivers/vk100.c | 1265 +++++ src/mame/drivers/votrpss.c | 334 ++ src/mame/drivers/votrtnt.c | 151 + src/mame/drivers/vt100.c | 862 +++ src/mame/drivers/vt220.c | 113 + src/mame/drivers/vt240.c | 331 ++ src/mame/drivers/vt320.c | 125 + src/mame/drivers/vt520.c | 111 + src/mame/drivers/vta2000.c | 195 + src/mame/drivers/vtech1.c | 558 ++ src/mame/drivers/vtech2.c | 506 ++ src/mame/drivers/wangpc.c | 1194 ++++ src/mame/drivers/wicat.c | 989 ++++ src/mame/drivers/wildfire.c | 343 ++ src/mame/drivers/wswan.c | 185 + src/mame/drivers/x07.c | 1568 ++++++ src/mame/drivers/x1.c | 2649 +++++++++ src/mame/drivers/x1twin.c | 540 ++ src/mame/drivers/x68k.c | 1854 +++++++ src/mame/drivers/xavix.c | 179 + src/mame/drivers/xbox.c | 254 + src/mame/drivers/xerox820.c | 833 +++ src/mame/drivers/xor100.c | 599 ++ src/mame/drivers/ymmu100.c | 499 ++ src/mame/drivers/ymmu100.ppm | Bin 0 -> 578415 bytes src/mame/drivers/z100.c | 731 +++ src/mame/drivers/z1013.c | 468 ++ src/mame/drivers/z80dev.c | 127 + src/mame/drivers/z80ne.c | 601 ++ src/mame/drivers/z88.c | 758 +++ src/mame/drivers/z9001.c | 317 ++ src/mame/drivers/zapcomputer.c | 156 + src/mame/drivers/zaurus.c | 1815 ++++++ src/mame/drivers/zexall.c | 171 + src/mame/drivers/zorba.c | 432 ++ src/mame/drivers/zrt80.c | 323 ++ src/mame/drivers/zsbc3.c | 127 + src/mame/drivers/zx.c | 544 ++ src/mame/includes/abc1600.h | 158 + src/mame/includes/abc80.h | 184 + src/mame/includes/abc80x.h | 356 ++ src/mame/includes/ac1.h | 48 + src/mame/includes/adam.h | 118 + src/mame/includes/advision.h | 87 + src/mame/includes/aim65.h | 99 + src/mame/includes/alesis.h | 115 + src/mame/includes/amstrad.h | 325 ++ src/mame/includes/apollo.h | 602 ++ src/mame/includes/apple1.h | 92 + src/mame/includes/apple2.h | 382 ++ src/mame/includes/apple2gs.h | 267 + src/mame/includes/apple3.h | 173 + src/mame/includes/aquarius.h | 89 + src/mame/includes/arcadia.h | 128 + src/mame/includes/at.h | 200 + src/mame/includes/atarist.h | 469 ++ src/mame/includes/atom.h | 169 + src/mame/includes/aussiebyte.h | 126 + src/mame/includes/avigo.h | 116 + src/mame/includes/b2m.h | 81 + src/mame/includes/banctec.h | 38 + src/mame/includes/bbc.h | 439 ++ src/mame/includes/bebox.h | 136 + src/mame/includes/bk.h | 50 + src/mame/includes/bullet.h | 184 + src/mame/includes/busicom.h | 45 + src/mame/includes/bw12.h | 127 + src/mame/includes/bw2.h | 118 + src/mame/includes/c128.h | 253 + src/mame/includes/c64.h | 216 + src/mame/includes/c65.h | 2 + src/mame/includes/c80.h | 57 + src/mame/includes/cbm2.h | 329 ++ src/mame/includes/cgc7900.h | 104 + src/mame/includes/channelf.h | 54 + src/mame/includes/coco.h | 269 + src/mame/includes/coco12.h | 67 + src/mame/includes/coco3.h | 67 + src/mame/includes/coleco.h | 99 + src/mame/includes/compis.h | 135 + src/mame/includes/comquest.h | 34 + src/mame/includes/comx35.h | 106 + src/mame/includes/concept.h | 71 + src/mame/includes/cosmicos.h | 147 + src/mame/includes/crvision.h | 114 + src/mame/includes/cxhumax.h | 281 + src/mame/includes/cybiko.h | 106 + src/mame/includes/dai.h | 81 + src/mame/includes/dccons.h | 48 + src/mame/includes/dgn_beta.h | 226 + src/mame/includes/dgnalpha.h | 97 + src/mame/includes/dm7000.h | 94 + src/mame/includes/dragon.h | 72 + src/mame/includes/ec184x.h | 43 + src/mame/includes/einstein.h | 221 + src/mame/includes/electron.h | 117 + src/mame/includes/elf.h | 70 + src/mame/includes/ep64.h | 98 + src/mame/includes/eti660.h | 75 + src/mame/includes/exp85.h | 48 + src/mame/includes/fidelz80.h | 79 + src/mame/includes/fm7.h | 390 ++ src/mame/includes/fmtowns.h | 384 ++ src/mame/includes/galaxy.h | 58 + src/mame/includes/galeb.h | 36 + src/mame/includes/gamate.h | 100 + src/mame/includes/gamecom.h | 290 + src/mame/includes/gamepock.h | 47 + src/mame/includes/gb.h | 171 + src/mame/includes/gba.h | 279 + src/mame/includes/genpc.h | 202 + src/mame/includes/gp32.h | 250 + src/mame/includes/hec2hrp.h | 199 + src/mame/includes/hh_tms1k.h | 86 + src/mame/includes/hh_ucom4.h | 66 + src/mame/includes/hp48.h | 219 + src/mame/includes/huebler.h | 104 + src/mame/includes/hx20.h | 139 + src/mame/includes/imds2.h | 145 + src/mame/includes/intv.h | 155 + src/mame/includes/jupiter.h | 59 + src/mame/includes/kaypro.h | 113 + src/mame/includes/kc.h | 189 + src/mame/includes/kramermc.h | 41 + src/mame/includes/kyocera.h | 291 + src/mame/includes/lc80.h | 68 + src/mame/includes/lisa.h | 237 + src/mame/includes/llc.h | 64 + src/mame/includes/lviv.h | 70 + src/mame/includes/lynx.h | 295 + src/mame/includes/m5.h | 87 + src/mame/includes/mac.h | 562 ++ src/mame/includes/macpci.h | 169 + src/mame/includes/mbc55x.h | 221 + src/mame/includes/mbee.h | 171 + src/mame/includes/mboard.h | 122 + src/mame/includes/mc1000.h | 120 + src/mame/includes/mc1502.h | 84 + src/mame/includes/mc80.h | 57 + src/mame/includes/md_cons.h | 49 + src/mame/includes/micronic.h | 98 + src/mame/includes/microtan.h | 103 + src/mame/includes/mikro80.h | 80 + src/mame/includes/mikromik.h | 138 + src/mame/includes/mpf1.h | 78 + src/mame/includes/mpz80.h | 99 + src/mame/includes/msbc1.h | 28 + src/mame/includes/msx.h | 265 + src/mame/includes/mtx.h | 99 + src/mame/includes/mz700.h | 119 + src/mame/includes/mz80.h | 70 + src/mame/includes/nc.h | 155 + src/mame/includes/nes.h | 120 + src/mame/includes/newbrain.h | 274 + src/mame/includes/next.h | 190 + src/mame/includes/ob68k1a.h | 62 + src/mame/includes/ondra.h | 76 + src/mame/includes/orao.h | 46 + src/mame/includes/orion.h | 125 + src/mame/includes/osborne1.h | 147 + src/mame/includes/osi.h | 167 + src/mame/includes/p2000t.h | 57 + src/mame/includes/partner.h | 45 + src/mame/includes/pasopia.h | 137 + src/mame/includes/pc1251.h | 62 + src/mame/includes/pc1350.h | 60 + src/mame/includes/pc1401.h | 60 + src/mame/includes/pc1403.h | 65 + src/mame/includes/pc1512.h | 258 + src/mame/includes/pc4.h | 76 + src/mame/includes/pc8001.h | 96 + src/mame/includes/pc8401a.h | 115 + src/mame/includes/pce.h | 82 + src/mame/includes/pcw.h | 140 + src/mame/includes/pcw16.h | 160 + src/mame/includes/pdp1.h | 336 ++ src/mame/includes/pecom.h | 76 + src/mame/includes/pes.h | 55 + src/mame/includes/pet.h | 284 + src/mame/includes/phc25.h | 59 + src/mame/includes/pk8020.h | 108 + src/mame/includes/plus4.h | 176 + src/mame/includes/pmd85.h | 155 + src/mame/includes/pocketc.h | 26 + src/mame/includes/poisk1.h | 101 + src/mame/includes/poly88.h | 85 + src/mame/includes/poly880.h | 59 + src/mame/includes/portfoli.h | 123 + src/mame/includes/pp01.h | 66 + src/mame/includes/primo.h | 70 + src/mame/includes/prof180x.h | 48 + src/mame/includes/prof80.h | 98 + src/mame/includes/psion.h | 104 + src/mame/includes/px8.h | 87 + src/mame/includes/ql.h | 143 + src/mame/includes/radio86.h | 129 + src/mame/includes/rm380z.h | 138 + src/mame/includes/rmnimbus.h | 222 + src/mame/includes/sage2.h | 99 + src/mame/includes/samcoupe.h | 203 + src/mame/includes/sg1000.h | 149 + src/mame/includes/sms.h | 250 + src/mame/includes/softbox.h | 68 + src/mame/includes/sorcerer.h | 110 + src/mame/includes/special.h | 153 + src/mame/includes/spectrum.h | 262 + src/mame/includes/ssystem3.h | 84 + src/mame/includes/super6.h | 89 + src/mame/includes/super80.h | 123 + src/mame/includes/superslave.h | 75 + src/mame/includes/svi318.h | 159 + src/mame/includes/svision.h | 92 + src/mame/includes/swtpc09.h | 150 + src/mame/includes/tandy2k.h | 229 + src/mame/includes/tdv2324.h | 87 + src/mame/includes/tek405x.h | 162 + src/mame/includes/thomson.h | 713 +++ src/mame/includes/ti85.h | 229 + src/mame/includes/ti89.h | 89 + src/mame/includes/tiki100.h | 146 + src/mame/includes/tmc1800.h | 209 + src/mame/includes/tmc2000e.h | 87 + src/mame/includes/tmc600.h | 101 + src/mame/includes/trs80.h | 206 + src/mame/includes/trs80m2.h | 168 + src/mame/includes/tsispch.h | 58 + src/mame/includes/tx0.h | 329 ++ src/mame/includes/ut88.h | 100 + src/mame/includes/v1050.h | 235 + src/mame/includes/vc4000.h | 157 + src/mame/includes/vcs80.h | 52 + src/mame/includes/vector06.h | 102 + src/mame/includes/vic10.h | 118 + src/mame/includes/vic20.h | 162 + src/mame/includes/victor9k.h | 156 + src/mame/includes/vidbrain.h | 126 + src/mame/includes/vip.h | 129 + src/mame/includes/vixen.h | 133 + src/mame/includes/vtech2.h | 96 + src/mame/includes/wangpc.h | 205 + src/mame/includes/wswan.h | 104 + src/mame/includes/x07.h | 285 + src/mame/includes/x1.h | 303 + src/mame/includes/x68k.h | 362 ++ src/mame/includes/xerox820.h | 166 + src/mame/includes/xor100.h | 107 + src/mame/includes/z80ne.h | 192 + src/mame/includes/z88.h | 95 + src/mame/includes/zapcomputer.h | 30 + src/mame/includes/zx.h | 112 + src/mame/layout/4004clk.lay | 47 + src/mame/layout/abc1600.lay | 14 + src/mame/layout/acrnsys1.lay | 58 + src/mame/layout/aim65.lay | 135 + src/mame/layout/aim65_40.lay | 146 + src/mame/layout/amaztron.lay | 33 + src/mame/layout/amico2k.lay | 30 + src/mame/layout/amiga.lay | 32 + src/mame/layout/apollo.lay | 114 + src/mame/layout/apollo_15i.lay | 119 + src/mame/layout/apollo_dsp.lay | 74 + src/mame/layout/apricotp.lay | 32 + src/mame/layout/astro.lay | 64 + src/mame/layout/avigo.lay | 61 + src/mame/layout/babbage.lay | 68 + src/mame/layout/bankshot.lay | 251 + src/mame/layout/bbc.lay | 84 + src/mame/layout/beta.lay | 49 + src/mame/layout/bigtrak.lay | 79 + src/mame/layout/bitgrpha.lay | 9 + src/mame/layout/bitgrphb.lay | 9 + src/mame/layout/bob85.lay | 39 + src/mame/layout/borisdpl.lay | 35 + src/mame/layout/bridgec3.lay | 114 + src/mame/layout/c80.lay | 39 + src/mame/layout/cc40.lay | 228 + src/mame/layout/chessmst.lay | 351 ++ src/mame/layout/chesstrv.lay | 23 + src/mame/layout/cnsector.lay | 143 + src/mame/layout/coco3.lay | 14 + src/mame/layout/comp4.lay | 133 + src/mame/layout/cosmicos.lay | 139 + src/mame/layout/cp1.lay | 40 + src/mame/layout/cvicny.lay | 52 + src/mame/layout/dataman.lay | 78 + src/mame/layout/digel804.lay | 217 + src/mame/layout/dmv.lay | 184 + src/mame/layout/dolphunk.lay | 42 + src/mame/layout/eacc.lay | 134 + src/mame/layout/ebaskb2.lay | 145 + src/mame/layout/ebball.lay | 199 + src/mame/layout/ebball2.lay | 215 + src/mame/layout/ebball3.lay | 271 + src/mame/layout/efball.lay | 279 + src/mame/layout/efootb4.lay | 166 + src/mame/layout/einvader.lay | 85 + src/mame/layout/einvaderc.lay | 85 + src/mame/layout/elecbowl.lay | 59 + src/mame/layout/elecdet.lay | 45 + src/mame/layout/elekscmp.lay | 45 + src/mame/layout/elf2.lay | 37 + src/mame/layout/esq1by22.lay | 95 + src/mame/layout/esq2by40.lay | 269 + src/mame/layout/et3400.lay | 39 + src/mame/layout/fb01.lay | 180 + src/mame/layout/fccpu1.lay | 17 + src/mame/layout/fidelz80.lay | 62 + src/mame/layout/funjacks.lay | 33 + src/mame/layout/funrlgl.lay | 44 + src/mame/layout/gamecom.lay | 413 ++ src/mame/layout/gjackpot.lay | 175 + src/mame/layout/gl3000s.lay | 126 + src/mame/layout/glasgow.lay | 44 + src/mame/layout/gpoker.lay | 156 + src/mame/layout/h2hbaseb.lay | 201 + src/mame/layout/h2hfootb.lay | 236 + src/mame/layout/h8.lay | 95 + src/mame/layout/hh_hmcs40_test.lay | 684 +++ src/mame/layout/hh_melps4_test.lay | 556 ++ src/mame/layout/hh_sm510_test.lay | 301 + src/mame/layout/hh_tms1k_test.lay | 556 ++ src/mame/layout/hh_ucom4_test.lay | 556 ++ src/mame/layout/ie15.lay | 124 + src/mame/layout/instruct.lay | 86 + src/mame/layout/junior.lay | 44 + src/mame/layout/k1003.lay | 72 + src/mame/layout/kim1.lay | 44 + src/mame/layout/lantutor.lay | 48 + src/mame/layout/lc80.lay | 58 + src/mame/layout/lightfgt.lay | 235 + src/mame/layout/llc1.lay | 94 + src/mame/layout/lynx.lay | 20 + src/mame/layout/mac.lay | 13 + src/mame/layout/maniac.lay | 27 + src/mame/layout/mathmagi.lay | 90 + src/mame/layout/mbdtower.lay | 115 + src/mame/layout/megacd.lay | 31 + src/mame/layout/mekd2.lay | 39 + src/mame/layout/mephisto.lay | 62 + src/mame/layout/merlin.lay | 404 ++ src/mame/layout/minicom.lay | 113 + src/mame/layout/mirage.lay | 35 + src/mame/layout/mk1.lay | 42 + src/mame/layout/mk14.lay | 45 + src/mame/layout/mk2.lay | 64 + src/mame/layout/mkit09.lay | 39 + src/mame/layout/mmd1.lay | 123 + src/mame/layout/mmd2.lay | 204 + src/mame/layout/mmerlin.lay | 414 ++ src/mame/layout/mpf1.lay | 74 + src/mame/layout/mpf1b.lay | 74 + src/mame/layout/mpf1p.lay | 96 + src/mame/layout/mvbfree.lay | 178 + src/mame/layout/newbrain.lay | 65 + src/mame/layout/pairmtch.lay | 201 + src/mame/layout/pc1500.lay | 132 + src/mame/layout/pc8500.lay | 13 + src/mame/layout/pcw.lay | 23 + src/mame/layout/pmi80.lay | 62 + src/mame/layout/poly880.lay | 36 + src/mame/layout/pro80.lay | 40 + src/mame/layout/pve500.lay | 131 + src/mame/layout/px4.lay | 33 + src/mame/layout/px8.lay | 30 + src/mame/layout/rainbow.lay | 229 + src/mame/layout/ravens.lay | 86 + src/mame/layout/savia84.lay | 74 + src/mame/layout/sc1.lay | 62 + src/mame/layout/sc2.lay | 62 + src/mame/layout/sdk85.lay | 39 + src/mame/layout/sdk86.lay | 61 + src/mame/layout/selz80.lay | 45 + src/mame/layout/simon.lay | 180 + src/mame/layout/sitcom.lay | 63 + src/mame/layout/slc1.lay | 53 + src/mame/layout/sms1.lay | 62 + src/mame/layout/snmath.lay | 68 + src/mame/layout/snspell.lay | 65 + src/mame/layout/splitsec.lay | 93 + src/mame/layout/sr16.lay | 335 ++ src/mame/layout/ssimon.lay | 149 + src/mame/layout/starwbc.lay | 127 + src/mame/layout/stopthie.lay | 32 + src/mame/layout/super80.lay | 36 + src/mame/layout/svision.lay | 18 + src/mame/layout/svmu.lay | 55 + src/mame/layout/sym1.lay | 49 + src/mame/layout/tactix.lay | 150 + src/mame/layout/tama.lay | 72 + src/mame/layout/tandy12.lay | 430 ++ src/mame/layout/tavernie.lay | 13 + src/mame/layout/tb303.lay | 45 + src/mame/layout/tbreakup.lay | 131 + src/mame/layout/tc4.lay | 144 + src/mame/layout/tec1.lay | 39 + src/mame/layout/tecnbras.lay | 313 ++ src/mame/layout/ti1270.lay | 39 + src/mame/layout/ti30.lay | 42 + src/mame/layout/ti74.lay | 223 + src/mame/layout/ti95.lay | 325 ++ src/mame/layout/tisr16.lay | 51 + src/mame/layout/tk80.lay | 52 + src/mame/layout/tm990189.lay | 78 + src/mame/layout/tm990189v.lay | 146 + src/mame/layout/tntell.lay | 101 + src/mame/layout/unixpc.lay | 49 + src/mame/layout/ut88mini.lay | 39 + src/mame/layout/vboy.lay | 29 + src/mame/layout/vcs80.lay | 39 + src/mame/layout/vidbrain.lay | 8 + src/mame/layout/vk100.lay | 110 + src/mame/layout/votrpss.lay | 16 + src/mame/layout/votrtnt.lay | 16 + src/mame/layout/vsc.lay | 262 + src/mame/layout/vt100.lay | 110 + src/mame/layout/wicat.lay | 35 + src/mame/layout/wildfire.lay | 150 + src/mame/layout/wizatron.lay | 78 + src/mame/layout/wswan.lay | 14 + src/mame/layout/x68000.lay | 95 + src/mame/layout/z80dev.lay | 40 + src/mame/layout/z80ne.lay | 650 +++ src/mame/layout/z80net.lay | 669 +++ src/mame/layout/z80netb.lay | 59 + src/mame/layout/z80netf.lay | 709 +++ src/mame/layout/zapcomputer.lay | 44 + src/mame/machine/6883sam.c | 557 ++ src/mame/machine/6883sam.h | 266 + src/mame/machine/abc1600mac.c | 686 +++ src/mame/machine/abc1600mac.h | 136 + src/mame/machine/abc80kb.c | 205 + src/mame/machine/abc80kb.h | 74 + src/mame/machine/ac1.c | 108 + src/mame/machine/advision.c | 193 + src/mame/machine/aim65.c | 424 ++ src/mame/machine/amigakbd.c | 574 ++ src/mame/machine/amigakbd.h | 144 + src/mame/machine/amstrad.c | 3332 +++++++++++ src/mame/machine/apollo.c | 1042 ++++ src/mame/machine/apollo_dbg.c | 1182 ++++ src/mame/machine/apollo_kbd.c | 986 ++++ src/mame/machine/apollo_kbd.h | 163 + src/mame/machine/appldriv.c | 336 ++ src/mame/machine/appldriv.h | 88 + src/mame/machine/apple1.c | 404 ++ src/mame/machine/apple2.c | 2632 +++++++++ src/mame/machine/apple2gs.c | 2236 ++++++++ src/mame/machine/apple3.c | 1301 +++++ src/mame/machine/applefdc.c | 586 ++ src/mame/machine/applefdc.h | 163 + src/mame/machine/apricotkb.c | 404 ++ src/mame/machine/apricotkb.h | 97 + src/mame/machine/apricotkb_hle.c | 286 + src/mame/machine/apricotkb_hle.h | 73 + src/mame/machine/at.c | 313 ++ src/mame/machine/atarifdc.c | 796 +++ src/mame/machine/atarifdc.h | 69 + src/mame/machine/b2m.c | 304 ++ src/mame/machine/bbc.c | 1861 +++++++ src/mame/machine/bebox.c | 814 +++ src/mame/machine/beta.c | 292 + src/mame/machine/beta.h | 69 + src/mame/machine/bk.c | 168 + src/mame/machine/c65_old.c | 1339 +++++ src/mame/machine/cbm_snqk.c | 100 + src/mame/machine/cbm_snqk.h | 21 + src/mame/machine/coco.c | 1387 +++++ src/mame/machine/coco12.c | 119 + src/mame/machine/coco3.c | 167 + src/mame/machine/coco_vhd.c | 281 + src/mame/machine/coco_vhd.h | 73 + src/mame/machine/coleco.c | 177 + src/mame/machine/coleco.h | 10 + src/mame/machine/compiskb.c | 378 ++ src/mame/machine/compiskb.h | 90 + src/mame/machine/concept.c | 401 ++ src/mame/machine/cuda.c | 567 ++ src/mame/machine/cuda.h | 141 + src/mame/machine/cx4data.inc | 200 + src/mame/machine/cx4fn.inc | 331 ++ src/mame/machine/cx4oam.inc | 308 ++ src/mame/machine/cx4ops.inc | 278 + src/mame/machine/cybiko.c | 492 ++ src/mame/machine/dai.c | 216 + src/mame/machine/dccons.c | 196 + src/mame/machine/dec_lk201.c | 760 +++ src/mame/machine/dec_lk201.h | 117 + src/mame/machine/dgn_beta.c | 1144 ++++ src/mame/machine/dgnalpha.c | 377 ++ src/mame/machine/dmv_keyb.c | 313 ++ src/mame/machine/dmv_keyb.h | 71 + src/mame/machine/docg3.c | 842 +++ src/mame/machine/docg3.h | 103 + src/mame/machine/dragon.c | 153 + src/mame/machine/egret.c | 489 ++ src/mame/machine/egret.h | 140 + src/mame/machine/einstein.c | 208 + src/mame/machine/electron.c | 417 ++ src/mame/machine/esqpanel.c | 253 + src/mame/machine/esqpanel.h | 140 + src/mame/machine/esqvfd.c | 405 ++ src/mame/machine/esqvfd.h | 99 + src/mame/machine/fm_scsi.c | 427 ++ src/mame/machine/fm_scsi.h | 103 + src/mame/machine/galaxy.c | 211 + src/mame/machine/gamecom.c | 629 +++ src/mame/machine/gamepock.c | 224 + src/mame/machine/gb.c | 757 +++ src/mame/machine/genpc.c | 954 ++++ src/mame/machine/hec2hrp.c | 822 +++ src/mame/machine/hecdisk2.c | 148 + src/mame/machine/hp48.c | 1176 ++++ src/mame/machine/ie15_kbd.c | 325 ++ src/mame/machine/ie15_kbd.h | 80 + src/mame/machine/intv.c | 532 ++ src/mame/machine/isbc_215g.c | 433 ++ src/mame/machine/isbc_215g.h | 77 + src/mame/machine/k7659kb.c | 311 ++ src/mame/machine/k7659kb.h | 75 + src/mame/machine/kay_kbd.c | 517 ++ src/mame/machine/kaypro.c | 292 + src/mame/machine/kb_7007_3.h | 122 + src/mame/machine/kb_poisk1.h | 252 + src/mame/machine/kc.c | 788 +++ src/mame/machine/kc_keyb.c | 614 +++ src/mame/machine/kc_keyb.h | 65 + src/mame/machine/kramermc.c | 42 + src/mame/machine/lisa.c | 1927 +++++++ src/mame/machine/llc.c | 180 + src/mame/machine/lviv.c | 321 ++ src/mame/machine/lynx.c | 2144 ++++++++ src/mame/machine/m20_8086.c | 119 + src/mame/machine/m20_8086.h | 40 + src/mame/machine/m20_kbd.c | 225 + src/mame/machine/m20_kbd.h | 26 + src/mame/machine/m24_kbd.c | 292 + src/mame/machine/m24_kbd.h | 47 + src/mame/machine/m24_z8000.c | 229 + src/mame/machine/m24_z8000.h | 56 + src/mame/machine/mac.c | 3294 +++++++++++ src/mame/machine/macadb.c | 1430 +++++ src/mame/machine/mackbd.c | 329 ++ src/mame/machine/mackbd.h | 79 + src/mame/machine/macpci.c | 228 + src/mame/machine/macrtc.c | 365 ++ src/mame/machine/macrtc.h | 101 + src/mame/machine/mbc55x.c | 414 ++ src/mame/machine/mbee.c | 745 +++ src/mame/machine/mboard.c | 568 ++ src/mame/machine/mc80.c | 134 + src/mame/machine/mega32x.c | 1957 +++++++ src/mame/machine/mega32x.h | 235 + src/mame/machine/megacd.c | 1914 +++++++ src/mame/machine/megacd.h | 254 + src/mame/machine/megacdcd.c | 1331 +++++ src/mame/machine/megacdcd.h | 317 ++ src/mame/machine/microdrv.c | 197 + src/mame/machine/microdrv.h | 104 + src/mame/machine/micropolis.c | 344 ++ src/mame/machine/micropolis.h | 111 + src/mame/machine/microtan.c | 855 +++ src/mame/machine/mikro80.c | 105 + src/mame/machine/mm1kb.c | 298 + src/mame/machine/mm1kb.h | 86 + src/mame/machine/ms7004.c | 500 ++ src/mame/machine/ms7004.h | 85 + src/mame/machine/msx.c | 531 ++ src/mame/machine/msx_matsushita.c | 168 + src/mame/machine/msx_matsushita.h | 48 + src/mame/machine/msx_s1985.c | 65 + src/mame/machine/msx_s1985.h | 33 + src/mame/machine/msx_switched.c | 22 + src/mame/machine/msx_switched.h | 21 + src/mame/machine/msx_systemflags.c | 40 + src/mame/machine/msx_systemflags.h | 39 + src/mame/machine/mtx.c | 414 ++ src/mame/machine/mz700.c | 616 +++ src/mame/machine/mz80.c | 84 + src/mame/machine/nc.c | 87 + src/mame/machine/nes.c | 208 + src/mame/machine/nextkbd.c | 456 ++ src/mame/machine/nextkbd.h | 121 + src/mame/machine/nextmo.c | 198 + src/mame/machine/nextmo.h | 61 + src/mame/machine/ngen_kb.c | 231 + src/mame/machine/ngen_kb.h | 33 + src/mame/machine/ondra.c | 101 + src/mame/machine/orao.c | 80 + src/mame/machine/orion.c | 594 ++ src/mame/machine/osborne1.c | 513 ++ src/mame/machine/p2000t.c | 157 + src/mame/machine/partner.c | 362 ++ src/mame/machine/pc1251.c | 128 + src/mame/machine/pc1350.c | 135 + src/mame/machine/pc1401.c | 240 + src/mame/machine/pc1403.c | 173 + src/mame/machine/pc1512kb.c | 506 ++ src/mame/machine/pc1512kb.h | 118 + src/mame/machine/pc9801_118.c | 228 + src/mame/machine/pc9801_118.h | 70 + src/mame/machine/pc9801_26.c | 194 + src/mame/machine/pc9801_26.h | 67 + src/mame/machine/pc9801_86.c | 227 + src/mame/machine/pc9801_86.h | 69 + src/mame/machine/pc9801_cbus.c | 80 + src/mame/machine/pc9801_cbus.h | 77 + src/mame/machine/pc9801_kbd.c | 313 ++ src/mame/machine/pc9801_kbd.h | 72 + src/mame/machine/pcd_kbd.c | 264 + src/mame/machine/pcd_kbd.h | 40 + src/mame/machine/pce.c | 250 + src/mame/machine/pce220_ser.c | 307 ++ src/mame/machine/pce220_ser.h | 95 + src/mame/machine/pce_cd.c | 1519 ++++++ src/mame/machine/pce_cd.h | 188 + src/mame/machine/pecom.c | 179 + src/mame/machine/pk8020.c | 908 +++ src/mame/machine/pmd85.c | 838 +++ src/mame/machine/poly88.c | 332 ++ src/mame/machine/pp01.c | 199 + src/mame/machine/primo.c | 358 ++ src/mame/machine/prof80mmu.c | 127 + src/mame/machine/prof80mmu.h | 68 + src/mame/machine/psion_pack.c | 323 ++ src/mame/machine/psion_pack.h | 79 + src/mame/machine/psxcd.c | 1234 +++++ src/mame/machine/psxcd.h | 161 + src/mame/machine/qimi.c | 181 + src/mame/machine/qimi.h | 78 + src/mame/machine/qx10kbd.c | 301 + src/mame/machine/qx10kbd.h | 35 + src/mame/machine/radio86.c | 234 + src/mame/machine/rm380z.c | 278 + src/mame/machine/rmnimbus.c | 1718 ++++++ src/mame/machine/rmnkbd.c | 209 + src/mame/machine/rmnkbd.h | 28 + src/mame/machine/rx01.c | 260 + src/mame/machine/rx01.h | 85 + src/mame/machine/samcoupe.c | 336 ++ src/mame/machine/sgi.c | 562 ++ src/mame/machine/sgi.h | 80 + src/mame/machine/smartmed.c | 791 +++ src/mame/machine/smartmed.h | 239 + src/mame/machine/sms.c | 1521 ++++++ src/mame/machine/snescx4.c | 257 + src/mame/machine/snescx4.h | 29 + src/mame/machine/sonydriv.c | 572 ++ src/mame/machine/sonydriv.h | 71 + src/mame/machine/sorcerer.c | 492 ++ src/mame/machine/spec_snqk.c | 2565 +++++++++ src/mame/machine/spec_snqk.h | 181 + src/mame/machine/special.c | 397 ++ src/mame/machine/super80.c | 240 + src/mame/machine/svi318.c | 767 +++ src/mame/machine/swim.c | 222 + src/mame/machine/swim.h | 63 + src/mame/machine/swtpc09.c | 859 +++ src/mame/machine/tandy2kb.c | 432 ++ src/mame/machine/tandy2kb.h | 110 + src/mame/machine/teleprinter.c | 237 + src/mame/machine/teleprinter.h | 42 + src/mame/machine/thomflop.c | 1914 +++++++ src/mame/machine/thomflop.h | 36 + src/mame/machine/thomson.c | 4794 ++++++++++++++++ src/mame/machine/ti85.c | 1192 ++++ src/mame/machine/trs80.c | 933 ++++ src/mame/machine/trs80m2kb.c | 392 ++ src/mame/machine/trs80m2kb.h | 106 + src/mame/machine/upd65031.c | 621 +++ src/mame/machine/upd65031.h | 121 + src/mame/machine/ut88.c | 178 + src/mame/machine/v1050kb.c | 425 ++ src/mame/machine/v1050kb.h | 86 + src/mame/machine/vector06.c | 181 + src/mame/machine/victor9k_fdc.c | 1351 +++++ src/mame/machine/victor9k_fdc.h | 241 + src/mame/machine/victor9kb.c | 712 +++ src/mame/machine/victor9kb.h | 97 + src/mame/machine/vtech2.c | 489 ++ src/mame/machine/wangpckb.c | 583 ++ src/mame/machine/wangpckb.h | 107 + src/mame/machine/wswan.c | 662 +++ src/mame/machine/x1.c | 69 + src/mame/machine/x68k_hdc.c | 431 ++ src/mame/machine/x68k_hdc.h | 130 + src/mame/machine/x68k_kbd.c | 452 ++ src/mame/machine/x68k_kbd.h | 41 + src/mame/machine/x820kb.c | 387 ++ src/mame/machine/x820kb.h | 87 + src/mame/machine/z80bin.c | 77 + src/mame/machine/z80bin.h | 18 + src/mame/machine/z80ne.c | 770 +++ src/mame/machine/zx.c | 390 ++ src/mame/machine/zx8302.c | 606 ++ src/mame/machine/zx8302.h | 263 + src/mame/mame.mak | 10 - src/mame/tools/castool/main.c | 217 + src/mame/tools/floptool/main.c | 275 + src/mame/tools/imgtool/charconv.c | 162 + src/mame/tools/imgtool/charconv.h | 31 + src/mame/tools/imgtool/filtbas.c | 3115 +++++++++++ src/mame/tools/imgtool/filteoln.c | 127 + src/mame/tools/imgtool/filter.c | 82 + src/mame/tools/imgtool/filter.h | 66 + src/mame/tools/imgtool/formats/coco_dsk.c | 1194 ++++ src/mame/tools/imgtool/formats/coco_dsk.h | 24 + src/mame/tools/imgtool/formats/vt_dsk.c | 57 + src/mame/tools/imgtool/formats/vt_dsk.h | 18 + src/mame/tools/imgtool/iflopimg.c | 363 ++ src/mame/tools/imgtool/iflopimg.h | 41 + src/mame/tools/imgtool/imghd.c | 273 + src/mame/tools/imgtool/imghd.h | 42 + src/mame/tools/imgtool/imgterrs.c | 55 + src/mame/tools/imgtool/imgterrs.h | 70 + src/mame/tools/imgtool/imgtool.c | 2814 ++++++++++ src/mame/tools/imgtool/imgtool.h | 169 + src/mame/tools/imgtool/library.c | 282 + src/mame/tools/imgtool/library.h | 408 ++ src/mame/tools/imgtool/main.c | 972 ++++ src/mame/tools/imgtool/main.h | 20 + src/mame/tools/imgtool/modules.c | 119 + src/mame/tools/imgtool/modules.h | 18 + src/mame/tools/imgtool/modules/amiga.c | 2411 ++++++++ src/mame/tools/imgtool/modules/bml3.c | 928 ++++ src/mame/tools/imgtool/modules/concept.c | 492 ++ src/mame/tools/imgtool/modules/cybiko.c | 578 ++ src/mame/tools/imgtool/modules/cybikoxt.c | 539 ++ src/mame/tools/imgtool/modules/fat.c | 2111 +++++++ src/mame/tools/imgtool/modules/fat.h | 3 + src/mame/tools/imgtool/modules/hp48.c | 739 +++ src/mame/tools/imgtool/modules/mac.c | 6418 ++++++++++++++++++++++ src/mame/tools/imgtool/modules/macbin.c | 377 ++ src/mame/tools/imgtool/modules/macutil.c | 89 + src/mame/tools/imgtool/modules/macutil.h | 42 + src/mame/tools/imgtool/modules/os9.c | 1244 +++++ src/mame/tools/imgtool/modules/pc_flop.c | 173 + src/mame/tools/imgtool/modules/pc_hard.c | 470 ++ src/mame/tools/imgtool/modules/prodos.c | 2282 ++++++++ src/mame/tools/imgtool/modules/psion.c | 683 +++ src/mame/tools/imgtool/modules/rsdos.c | 623 +++ src/mame/tools/imgtool/modules/thomson.c | 1681 ++++++ src/mame/tools/imgtool/modules/ti99.c | 5360 ++++++++++++++++++ src/mame/tools/imgtool/modules/ti990hd.c | 1818 ++++++ src/mame/tools/imgtool/modules/vzdos.c | 960 ++++ src/mame/tools/imgtool/stream.c | 536 ++ src/mame/tools/imgtool/stream.h | 48 + src/mame/video/733_asr.c | 815 +++ src/mame/video/733_asr.h | 88 + src/mame/video/911_chr.h | 3516 ++++++++++++ src/mame/video/911_key.h | 4028 ++++++++++++++ src/mame/video/911_vdt.c | 844 +++ src/mame/video/911_vdt.h | 118 + src/mame/video/abc1600.c | 1259 +++++ src/mame/video/abc1600.h | 151 + src/mame/video/abc80.c | 205 + src/mame/video/abc800.c | 311 ++ src/mame/video/abc802.c | 220 + src/mame/video/abc806.c | 507 ++ src/mame/video/ac1.c | 61 + src/mame/video/advision.c | 110 + src/mame/video/alesis.c | 167 + src/mame/video/apollo.c | 1978 +++++++ src/mame/video/apple1.c | 392 ++ src/mame/video/apple2.c | 1540 ++++++ src/mame/video/apple2.h | 61 + src/mame/video/apple2gs.c | 168 + src/mame/video/apple3.c | 518 ++ src/mame/video/aquarius.c | 80 + src/mame/video/arcadia.c | 676 +++ src/mame/video/atarist.c | 1131 ++++ src/mame/video/atarist.h | 41 + src/mame/video/aussiebyte.c | 196 + src/mame/video/avigo.c | 118 + src/mame/video/b2m.c | 60 + src/mame/video/bbc.c | 306 ++ src/mame/video/bk.c | 40 + src/mame/video/busicom.c | 1860 +++++++ src/mame/video/cgc7900.c | 237 + src/mame/video/channelf.c | 71 + src/mame/video/comquest.c | 24 + src/mame/video/comx35.c | 126 + src/mame/video/crt.c | 184 + src/mame/video/crt.h | 93 + src/mame/video/dai.c | 764 +++ src/mame/video/dgn_beta.c | 286 + src/mame/video/electron.c | 273 + src/mame/video/fm7.c | 1493 +++++ src/mame/video/fmtowns.c | 1729 ++++++ src/mame/video/galaxy.c | 134 + src/mame/video/galeb.c | 45 + src/mame/video/gamecom.c | 71 + src/mame/video/gb_lcd.c | 2852 ++++++++++ src/mame/video/gb_lcd.h | 215 + src/mame/video/gba.c | 1901 +++++++ src/mame/video/gime.c | 2077 +++++++ src/mame/video/gime.h | 311 ++ src/mame/video/hec2video.c | 141 + src/mame/video/hp48.c | 203 + src/mame/video/intv.c | 137 + src/mame/video/k1ge.c | 918 ++++ src/mame/video/k1ge.h | 92 + src/mame/video/kaypro.c | 312 ++ src/mame/video/kc.c | 240 + src/mame/video/kramermc.c | 46 + src/mame/video/kyocera.c | 89 + src/mame/video/llc.c | 96 + src/mame/video/lviv.c | 91 + src/mame/video/mac.c | 1257 +++++ src/mame/video/maria.c | 484 ++ src/mame/video/maria.h | 72 + src/mame/video/mbc55x.c | 186 + src/mame/video/mbee.c | 495 ++ src/mame/video/mc80.c | 173 + src/mame/video/microtan.c | 57 + src/mame/video/mikro80.c | 40 + src/mame/video/mikromik.c | 126 + src/mame/video/mz700.c | 128 + src/mame/video/mz80.c | 143 + src/mame/video/nc.c | 120 + src/mame/video/nes.c | 62 + src/mame/video/newbrain.c | 130 + src/mame/video/newport.c | 1667 ++++++ src/mame/video/newport.h | 163 + src/mame/video/nick.c | 1055 ++++ src/mame/video/nick.h | 178 + src/mame/video/ondra.c | 47 + src/mame/video/orao.c | 38 + src/mame/video/orion.c | 114 + src/mame/video/osi.c | 180 + src/mame/video/p2000m.c | 60 + src/mame/video/pc1251.c | 163 + src/mame/video/pc1350.c | 165 + src/mame/video/pc1401.c | 213 + src/mame/video/pc1403.c | 246 + src/mame/video/pc1512.c | 606 ++ src/mame/video/pc4.c | 196 + src/mame/video/pc8401a.c | 102 + src/mame/video/pc_t1t.c | 1033 ++++ src/mame/video/pc_t1t.h | 147 + src/mame/video/pcd.c | 396 ++ src/mame/video/pcd.h | 98 + src/mame/video/pcw.c | 187 + src/mame/video/pcw16.c | 268 + src/mame/video/pdp1.c | 591 ++ src/mame/video/pecom.c | 109 + src/mame/video/pk8020.c | 59 + src/mame/video/pocketc.c | 70 + src/mame/video/poisk1.c | 322 ++ src/mame/video/poisk1.h | 10 + src/mame/video/poly88.c | 102 + src/mame/video/pp01.c | 56 + src/mame/video/primo.c | 47 + src/mame/video/rm380z.c | 406 ++ src/mame/video/rmnimbus.c | 514 ++ src/mame/video/samcoupe.c | 171 + src/mame/video/special.c | 153 + src/mame/video/spectrum.c | 298 + src/mame/video/ssystem3.c | 236 + src/mame/video/stic.c | 974 ++++ src/mame/video/stic.h | 559 ++ src/mame/video/super80.c | 426 ++ src/mame/video/thomson.c | 1387 +++++ src/mame/video/ti85.c | 194 + src/mame/video/timex.c | 270 + src/mame/video/tmc1800.c | 70 + src/mame/video/tmc600.c | 141 + src/mame/video/trs80.c | 588 ++ src/mame/video/tx0.c | 469 ++ src/mame/video/ut88.c | 44 + src/mame/video/uv201.c | 589 ++ src/mame/video/uv201.h | 159 + src/mame/video/v1050.c | 124 + src/mame/video/vc4000.c | 650 +++ src/mame/video/vector06.c | 61 + src/mame/video/vtech2.c | 312 ++ src/mame/video/vtvideo.c | 956 ++++ src/mame/video/vtvideo.h | 113 + src/mame/video/wswan_video.c | 1216 +++++ src/mame/video/wswan_video.h | 149 + src/mame/video/x68k.c | 1267 +++++ src/mame/video/z88.c | 175 + src/mame/video/zx.c | 223 + src/mame/video/zx8301.c | 334 ++ src/mame/video/zx8301.h | 123 + src/mess/audio/alesis.c | 157 - src/mess/audio/arcadia.c | 177 - src/mess/audio/arcadia.h | 44 - src/mess/audio/channelf.c | 143 - src/mess/audio/channelf.h | 42 - src/mess/audio/dai_snd.c | 141 - src/mess/audio/dai_snd.h | 46 - src/mess/audio/dave.c | 622 --- src/mess/audio/dave.h | 156 - src/mess/audio/gamate.c | 253 - src/mess/audio/gb.c | 795 --- src/mess/audio/gb.h | 105 - src/mess/audio/lynx.c | 540 -- src/mess/audio/lynx.h | 90 - src/mess/audio/mac.c | 174 - src/mess/audio/mea8000.c | 585 -- src/mess/audio/mea8000.h | 140 - src/mess/audio/socrates.c | 127 - src/mess/audio/socrates.h | 44 - src/mess/audio/specimx_snd.c | 101 - src/mess/audio/specimx_snd.h | 39 - src/mess/audio/svis_snd.c | 269 - src/mess/audio/svis_snd.h | 142 - src/mess/audio/tvc_snd.c | 142 - src/mess/audio/tvc_snd.h | 59 - src/mess/audio/upd1771.c | 554 -- src/mess/audio/upd1771.h | 85 - src/mess/audio/vboy.c | 491 -- src/mess/audio/vboy.h | 108 - src/mess/audio/vc4000snd.c | 74 - src/mess/audio/vc4000snd.h | 47 - src/mess/audio/wswan_snd.c | 374 -- src/mess/audio/wswan_snd.h | 91 - src/mess/drivers/4004clk.c | 193 - src/mess/drivers/68ksbc.c | 98 - src/mess/drivers/a2600.c | 552 -- src/mess/drivers/a310.c | 453 -- src/mess/drivers/a5105.c | 624 --- src/mess/drivers/a51xx.c | 177 - src/mess/drivers/a6809.c | 277 - src/mess/drivers/a7150.c | 83 - src/mess/drivers/a7800.c | 1464 ----- src/mess/drivers/abc1600.c | 967 ---- src/mess/drivers/abc80.c | 630 --- src/mess/drivers/abc80x.c | 1641 ------ src/mess/drivers/ac1.c | 218 - src/mess/drivers/acrnsys1.c | 282 - src/mess/drivers/adam.c | 1147 ---- src/mess/drivers/advision.c | 113 - src/mess/drivers/aim65.c | 288 - src/mess/drivers/aim65_40.c | 145 - src/mess/drivers/alesis.c | 485 -- src/mess/drivers/alphasma.c | 479 -- src/mess/drivers/alphatro.c | 517 -- src/mess/drivers/altair.c | 132 - src/mess/drivers/alto2.c | 303 - src/mess/drivers/altos5.c | 457 -- src/mess/drivers/amico2k.c | 241 - src/mess/drivers/amiga.c | 2144 -------- src/mess/drivers/ampro.c | 202 - src/mess/drivers/amstr_pc.c | 659 --- src/mess/drivers/amstrad.c | 1287 ----- src/mess/drivers/amust.c | 467 -- src/mess/drivers/apc.c | 1000 ---- src/mess/drivers/apexc.c | 911 ---- src/mess/drivers/apf.c | 605 -- src/mess/drivers/apogee.c | 280 - src/mess/drivers/apollo.c | 1276 ----- src/mess/drivers/apple1.c | 331 -- src/mess/drivers/apple2.c | 1614 ------ src/mess/drivers/apple2e.c | 3582 ------------ src/mess/drivers/apple2gs.c | 597 -- src/mess/drivers/apple3.c | 349 -- src/mess/drivers/applix.c | 1104 ---- src/mess/drivers/apricot.c | 509 -- src/mess/drivers/apricotf.c | 435 -- src/mess/drivers/apricotp.c | 690 --- src/mess/drivers/aquarius.c | 420 -- src/mess/drivers/arcadia.c | 842 --- src/mess/drivers/argo.c | 382 -- src/mess/drivers/asst128.c | 145 - src/mess/drivers/astrohome.c | 272 - src/mess/drivers/at.c | 1708 ------ src/mess/drivers/atari400.c | 2480 --------- src/mess/drivers/atarist.c | 3224 ----------- src/mess/drivers/atm.c | 248 - src/mess/drivers/atom.c | 893 --- src/mess/drivers/attache.c | 1010 ---- src/mess/drivers/aussiebyte.c | 574 -- src/mess/drivers/avigo.c | 1017 ---- src/mess/drivers/ax20.c | 158 - src/mess/drivers/b16.c | 312 -- src/mess/drivers/b2m.c | 273 - src/mess/drivers/babbage.c | 278 - src/mess/drivers/banctec.c | 133 - src/mess/drivers/basic52.c | 158 - src/mess/drivers/bbc.c | 1998 ------- src/mess/drivers/bbcbc.c | 164 - src/mess/drivers/bcs3.c | 492 -- src/mess/drivers/bebox.c | 261 - src/mess/drivers/beehive.c | 322 -- src/mess/drivers/besta.c | 164 - src/mess/drivers/beta.c | 378 -- src/mess/drivers/bigbord2.c | 621 --- src/mess/drivers/binbug.c | 590 -- src/mess/drivers/bitgraph.c | 622 --- src/mess/drivers/bk.c | 235 - src/mess/drivers/bmjr.c | 385 -- src/mess/drivers/bml3.c | 1114 ---- src/mess/drivers/bob85.c | 226 - src/mess/drivers/br8641.c | 200 - src/mess/drivers/bullet.c | 1297 ----- src/mess/drivers/busicom.c | 249 - src/mess/drivers/bw12.c | 670 --- src/mess/drivers/bw2.c | 678 --- src/mess/drivers/c10.c | 191 - src/mess/drivers/c128.c | 1977 ------- src/mess/drivers/c64.c | 1847 ------- src/mess/drivers/c64dtv.c | 68 - src/mess/drivers/c65.c | 669 --- src/mess/drivers/c65_old.c | 648 --- src/mess/drivers/c80.c | 293 - src/mess/drivers/c900.c | 135 - src/mess/drivers/camplynx.c | 633 --- src/mess/drivers/canon_s80.c | 54 - src/mess/drivers/casloopy.c | 566 -- src/mess/drivers/cat.c | 1843 ------- src/mess/drivers/cbm2.c | 2767 ---------- src/mess/drivers/cc40.c | 641 --- src/mess/drivers/ccs2810.c | 382 -- src/mess/drivers/ccs300.c | 142 - src/mess/drivers/cd2650.c | 323 -- src/mess/drivers/cdc721.c | 144 - src/mess/drivers/cfx9850.c | 293 - src/mess/drivers/cgc7900.c | 448 -- src/mess/drivers/cgenie.c | 522 -- src/mess/drivers/channelf.c | 349 -- src/mess/drivers/chaos.c | 164 - src/mess/drivers/chessmst.c | 286 - src/mess/drivers/chesstrv.c | 256 - src/mess/drivers/clcd.c | 847 --- src/mess/drivers/cm1800.c | 121 - src/mess/drivers/coco12.c | 447 -- src/mess/drivers/coco3.c | 375 -- src/mess/drivers/codata.c | 113 - src/mess/drivers/coleco.c | 499 -- src/mess/drivers/compis.c | 792 --- src/mess/drivers/compucolor.c | 506 -- src/mess/drivers/comquest.c | 310 -- src/mess/drivers/comx35.c | 723 --- src/mess/drivers/concept.c | 320 -- src/mess/drivers/cortex.c | 107 - src/mess/drivers/cosmicos.c | 563 -- src/mess/drivers/cp1.c | 334 -- src/mess/drivers/craft.c | 269 - src/mess/drivers/crvision.c | 903 --- src/mess/drivers/csc.c | 346 -- src/mess/drivers/ct486.c | 198 - src/mess/drivers/cvicny.c | 149 - src/mess/drivers/cxhumax.c | 1085 ---- src/mess/drivers/cybiko.c | 461 -- src/mess/drivers/czk80.c | 230 - src/mess/drivers/d6800.c | 435 -- src/mess/drivers/d6809.c | 167 - src/mess/drivers/dai.c | 259 - src/mess/drivers/daruma.c | 169 - src/mess/drivers/dccons.c | 760 --- src/mess/drivers/dct11em.c | 83 - src/mess/drivers/dectalk.c | 1010 ---- src/mess/drivers/decwritr.c | 386 -- src/mess/drivers/dgn_beta.c | 413 -- src/mess/drivers/digel804.c | 726 --- src/mess/drivers/dim68k.c | 398 -- src/mess/drivers/dm7000.c | 352 -- src/mess/drivers/dms5000.c | 86 - src/mess/drivers/dms86.c | 131 - src/mess/drivers/dmv.c | 850 --- src/mess/drivers/dolphunk.c | 266 - src/mess/drivers/dps1.c | 41 - src/mess/drivers/dragon.c | 334 -- src/mess/drivers/dsb46.c | 122 - src/mess/drivers/dual68.c | 115 - src/mess/drivers/dvk_kcgd.c | 384 -- src/mess/drivers/dvk_ksm.c | 418 -- src/mess/drivers/eacc.c | 280 - src/mess/drivers/ec184x.c | 387 -- src/mess/drivers/ec65.c | 250 - src/mess/drivers/einstein.c | 833 --- src/mess/drivers/elecbowl.c | 222 - src/mess/drivers/electron.c | 208 - src/mess/drivers/elekscmp.c | 165 - src/mess/drivers/elf.c | 288 - src/mess/drivers/elwro800.c | 626 --- src/mess/drivers/enmirage.c | 286 - src/mess/drivers/ep64.c | 600 -- src/mess/drivers/esq1.c | 698 --- src/mess/drivers/esq5505.c | 955 ---- src/mess/drivers/esqasr.c | 167 - src/mess/drivers/esqkt.c | 272 - src/mess/drivers/esqmr.c | 319 -- src/mess/drivers/et3400.c | 123 - src/mess/drivers/eti660.c | 244 - src/mess/drivers/europc.c | 508 -- src/mess/drivers/evmbug.c | 117 - src/mess/drivers/excali64.c | 647 --- src/mess/drivers/exelv.c | 606 -- src/mess/drivers/exp85.c | 234 - src/mess/drivers/fanucs15.c | 423 -- src/mess/drivers/fanucspmg.c | 1011 ---- src/mess/drivers/fb01.c | 228 - src/mess/drivers/fc100.c | 578 -- src/mess/drivers/fidelz80.c | 1426 ----- src/mess/drivers/fk1.c | 477 -- src/mess/drivers/fm7.c | 2539 --------- src/mess/drivers/fmtowns.c | 2982 ---------- src/mess/drivers/force68k.c | 606 -- src/mess/drivers/fp1100.c | 705 --- src/mess/drivers/fp200.c | 626 --- src/mess/drivers/fp6000.c | 330 -- src/mess/drivers/ft68m.c | 128 - src/mess/drivers/galaxy.c | 274 - src/mess/drivers/galeb.c | 171 - src/mess/drivers/gamate.c | 408 -- src/mess/drivers/gamecom.c | 299 - src/mess/drivers/gameking.c | 195 - src/mess/drivers/gamepock.c | 83 - src/mess/drivers/gb.c | 984 ---- src/mess/drivers/gba.c | 2318 -------- src/mess/drivers/geneve.c | 766 --- src/mess/drivers/geniusiq.c | 900 --- src/mess/drivers/genpc.c | 280 - src/mess/drivers/gimix.c | 686 --- src/mess/drivers/gizmondo.c | 249 - src/mess/drivers/glasgow.c | 509 -- src/mess/drivers/gmaster.c | 315 -- src/mess/drivers/gp2x.c | 393 -- src/mess/drivers/gp32.c | 1726 ------ src/mess/drivers/grfd2301.c | 139 - src/mess/drivers/h19.c | 452 -- src/mess/drivers/h8.c | 368 -- src/mess/drivers/h89.c | 151 - src/mess/drivers/harriet.c | 225 - src/mess/drivers/hec2hrp.c | 731 --- src/mess/drivers/hh_cop400.c | 841 --- src/mess/drivers/hh_hmcs40.c | 4178 -------------- src/mess/drivers/hh_melps4.c | 473 -- src/mess/drivers/hh_pic16.c | 302 - src/mess/drivers/hh_sm510.c | 402 -- src/mess/drivers/hh_tms1k.c | 4636 ---------------- src/mess/drivers/hh_ucom4.c | 2552 --------- src/mess/drivers/hk68v10.c | 389 -- src/mess/drivers/homelab.c | 911 ---- src/mess/drivers/homez80.c | 315 -- src/mess/drivers/horizon.c | 221 - src/mess/drivers/hp16500.c | 507 -- src/mess/drivers/hp48.c | 1373 ----- src/mess/drivers/hp49gp.c | 337 -- src/mess/drivers/hp64k.c | 1424 ----- src/mess/drivers/hp9845.c | 172 - src/mess/drivers/hp9k.c | 432 -- src/mess/drivers/hp9k_3xx.c | 475 -- src/mess/drivers/hp_ipc.c | 358 -- src/mess/drivers/hprot1.c | 381 -- src/mess/drivers/hpz80unk.c | 159 - src/mess/drivers/ht68k.c | 160 - src/mess/drivers/huebler.c | 398 -- src/mess/drivers/hunter2.c | 442 -- src/mess/drivers/hx20.c | 922 ---- src/mess/drivers/hyperscan.c | 647 --- src/mess/drivers/i7000.c | 401 -- src/mess/drivers/ibm6580.c | 104 - src/mess/drivers/ibmpc.c | 577 -- src/mess/drivers/ibmpcjr.c | 705 --- src/mess/drivers/icatel.c | 269 - src/mess/drivers/ie15.c | 663 --- src/mess/drivers/if800.c | 117 - src/mess/drivers/imds.c | 116 - src/mess/drivers/imds2.c | 876 --- src/mess/drivers/imsai.c | 142 - src/mess/drivers/indiana.c | 122 - src/mess/drivers/instruct.c | 438 -- src/mess/drivers/interact.c | 299 - src/mess/drivers/intv.c | 752 --- src/mess/drivers/ip20.c | 632 --- src/mess/drivers/ip22.c | 1675 ------ src/mess/drivers/ipc.c | 140 - src/mess/drivers/ipds.c | 168 - src/mess/drivers/iq151.c | 476 -- src/mess/drivers/irisha.c | 441 -- src/mess/drivers/isbc.c | 367 -- src/mess/drivers/iskr103x.c | 146 - src/mess/drivers/itt3030.c | 819 --- src/mess/drivers/jade.c | 111 - src/mess/drivers/jonos.c | 158 - src/mess/drivers/jr100.c | 425 -- src/mess/drivers/jr200.c | 601 -- src/mess/drivers/jtc.c | 851 --- src/mess/drivers/juicebox.c | 362 -- src/mess/drivers/junior.c | 259 - src/mess/drivers/jupace.c | 835 --- src/mess/drivers/jupiter.c | 365 -- src/mess/drivers/k1003.c | 197 - src/mess/drivers/k8915.c | 187 - src/mess/drivers/kaypro.c | 461 -- src/mess/drivers/kc.c | 320 -- src/mess/drivers/kim1.c | 359 -- src/mess/drivers/konin.c | 115 - src/mess/drivers/korgm1.c | 209 - src/mess/drivers/kramermc.c | 151 - src/mess/drivers/kyocera.c | 1640 ------ src/mess/drivers/laser3k.c | 1037 ---- src/mess/drivers/lc80.c | 441 -- src/mess/drivers/lcmate2.c | 268 - src/mess/drivers/leapster.c | 340 -- src/mess/drivers/lft.c | 117 - src/mess/drivers/lg-dvd.c | 41 - src/mess/drivers/lisa.c | 486 -- src/mess/drivers/llc.c | 311 -- src/mess/drivers/lola8a.c | 295 - src/mess/drivers/lviv.c | 491 -- src/mess/drivers/lynx.c | 199 - src/mess/drivers/m20.c | 860 --- src/mess/drivers/m24.c | 312 -- src/mess/drivers/m5.c | 726 --- src/mess/drivers/m6805evs.c | 80 - src/mess/drivers/m79152pc.c | 145 - src/mess/drivers/mac.c | 2482 --------- src/mess/drivers/macpci.c | 166 - src/mess/drivers/mbc200.c | 267 - src/mess/drivers/mbc55x.c | 316 -- src/mess/drivers/mbdtower.c | 285 - src/mess/drivers/mbee.c | 1164 ---- src/mess/drivers/mc10.c | 608 --- src/mess/drivers/mc1000.c | 502 -- src/mess/drivers/mc1502.c | 410 -- src/mess/drivers/mc80.c | 304 -- src/mess/drivers/mcb216.c | 161 - src/mess/drivers/mccpm.c | 152 - src/mess/drivers/megadriv.c | 939 ---- src/mess/drivers/mekd2.c | 426 -- src/mess/drivers/mephisto.c | 470 -- src/mess/drivers/mes.c | 141 - src/mess/drivers/mice.c | 121 - src/mess/drivers/microdec.c | 142 - src/mess/drivers/microkit.c | 46 - src/mess/drivers/micronic.c | 399 -- src/mess/drivers/microtan.c | 288 - src/mess/drivers/microvsn.c | 707 --- src/mess/drivers/mikro80.c | 239 - src/mess/drivers/mikromik.c | 578 -- src/mess/drivers/mikrosha.c | 281 - src/mess/drivers/mini2440.c | 275 - src/mess/drivers/minicom.c | 254 - src/mess/drivers/mits680b.c | 117 - src/mess/drivers/mk1.c | 209 - src/mess/drivers/mk14.c | 163 - src/mess/drivers/mk2.c | 225 - src/mess/drivers/mk85.c | 92 - src/mess/drivers/mk90.c | 102 - src/mess/drivers/mkit09.c | 212 - src/mess/drivers/mmd1.c | 531 -- src/mess/drivers/mmodular.c | 1911 ------- src/mess/drivers/mod8.c | 171 - src/mess/drivers/modellot.c | 189 - src/mess/drivers/molecular.c | 356 -- src/mess/drivers/monty.c | 288 - src/mess/drivers/mpf1.c | 483 -- src/mess/drivers/mps1230.c | 154 - src/mess/drivers/mpz80.c | 807 --- src/mess/drivers/ms0515.c | 258 - src/mess/drivers/ms9540.c | 106 - src/mess/drivers/msbc1.c | 113 - src/mess/drivers/mstation.c | 560 -- src/mess/drivers/msx.c | 8494 ----------------------------- src/mess/drivers/mt735.c | 71 - src/mess/drivers/mtx.c | 444 -- src/mess/drivers/multi16.c | 167 - src/mess/drivers/multi8.c | 681 --- src/mess/drivers/mvme350.c | 257 - src/mess/drivers/mx2178.c | 204 - src/mess/drivers/myb3k.c | 286 - src/mess/drivers/mycom.c | 585 -- src/mess/drivers/myvision.c | 250 - src/mess/drivers/mz2000.c | 908 --- src/mess/drivers/mz2500.c | 2201 -------- src/mess/drivers/mz3500.c | 873 --- src/mess/drivers/mz6500.c | 180 - src/mess/drivers/mz700.c | 456 -- src/mess/drivers/mz80.c | 380 -- src/mess/drivers/mzr8105.c | 369 -- src/mess/drivers/n64.c | 499 -- src/mess/drivers/nakajies.c | 835 --- src/mess/drivers/nanos.c | 544 -- src/mess/drivers/nascom1.c | 776 --- src/mess/drivers/nc.c | 1556 ------ src/mess/drivers/nes.c | 347 -- src/mess/drivers/newbrain.c | 1493 ----- src/mess/drivers/next.c | 1225 ----- src/mess/drivers/ng_aes.c | 1641 ------ src/mess/drivers/ngen.c | 1179 ---- src/mess/drivers/ngp.c | 895 --- src/mess/drivers/ob68k1a.c | 292 - src/mess/drivers/octopus.c | 198 - src/mess/drivers/odyssey2.c | 833 --- src/mess/drivers/okean240.c | 538 -- src/mess/drivers/ondra.c | 183 - src/mess/drivers/onyx.c | 169 - src/mess/drivers/orao.c | 215 - src/mess/drivers/oric.c | 951 ---- src/mess/drivers/orion.c | 372 -- src/mess/drivers/osbexec.c | 581 -- src/mess/drivers/osborne1.c | 262 - src/mess/drivers/osi.c | 908 --- src/mess/drivers/p112.c | 128 - src/mess/drivers/p2000t.c | 291 - src/mess/drivers/p8k.c | 595 -- src/mess/drivers/palm.c | 504 -- src/mess/drivers/palm_dbg.inc | 1194 ---- src/mess/drivers/palmz22.c | 338 -- src/mess/drivers/partner.c | 242 - src/mess/drivers/paso1600.c | 350 -- src/mess/drivers/pasogo.c | 576 -- src/mess/drivers/pasopia.c | 359 -- src/mess/drivers/pasopia7.c | 1066 ---- src/mess/drivers/pb1000.c | 571 -- src/mess/drivers/pc.c | 475 -- src/mess/drivers/pc100.c | 520 -- src/mess/drivers/pc1500.c | 298 - src/mess/drivers/pc1512.c | 1514 ----- src/mess/drivers/pc2000.c | 1031 ---- src/mess/drivers/pc4.c | 250 - src/mess/drivers/pc6001.c | 2476 --------- src/mess/drivers/pc8001.c | 601 -- src/mess/drivers/pc8401a.c | 677 --- src/mess/drivers/pc8801.c | 2971 ---------- src/mess/drivers/pc88va.c | 1919 ------- src/mess/drivers/pc9801.c | 3886 ------------- src/mess/drivers/pcd.c | 603 -- src/mess/drivers/pce.c | 429 -- src/mess/drivers/pce220.c | 1049 ---- src/mess/drivers/pcfx.c | 531 -- src/mess/drivers/pcm.c | 330 -- src/mess/drivers/pcw.c | 1403 ----- src/mess/drivers/pcw16.c | 1094 ---- src/mess/drivers/pda600.c | 238 - src/mess/drivers/pdp1.c | 1979 ------- src/mess/drivers/pdp11.c | 470 -- src/mess/drivers/pecom.c | 217 - src/mess/drivers/pegasus.c | 581 -- src/mess/drivers/pencil2.c | 348 -- src/mess/drivers/pentagon.c | 354 -- src/mess/drivers/peoplepc.c | 302 - src/mess/drivers/pes.c | 285 - src/mess/drivers/pet.c | 2620 --------- src/mess/drivers/phc25.c | 384 -- src/mess/drivers/phunsy.c | 398 -- src/mess/drivers/pimps.c | 114 - src/mess/drivers/pipbug.c | 182 - src/mess/drivers/pitagjr.c | 232 - src/mess/drivers/pk8000.c | 413 -- src/mess/drivers/pk8020.c | 292 - src/mess/drivers/plan80.c | 265 - src/mess/drivers/plus4.c | 1129 ---- src/mess/drivers/pm68k.c | 104 - src/mess/drivers/pmd85.c | 813 --- src/mess/drivers/pmi80.c | 175 - src/mess/drivers/pocketc.c | 988 ---- src/mess/drivers/pockstat.c | 1017 ---- src/mess/drivers/poisk1.c | 314 -- src/mess/drivers/pokemini.c | 1798 ------ src/mess/drivers/poly.c | 229 - src/mess/drivers/poly88.c | 230 - src/mess/drivers/poly880.c | 288 - src/mess/drivers/portfoli.c | 929 ---- src/mess/drivers/pp01.c | 276 - src/mess/drivers/prestige.c | 893 --- src/mess/drivers/primo.c | 382 -- src/mess/drivers/pro80.c | 171 - src/mess/drivers/prof180x.c | 329 -- src/mess/drivers/prof80.c | 566 -- src/mess/drivers/psion.c | 796 --- src/mess/drivers/psx.c | 307 -- src/mess/drivers/pt68k4.c | 491 -- src/mess/drivers/ptcsol.c | 796 --- src/mess/drivers/pulsar.c | 263 - src/mess/drivers/pv1000.c | 482 -- src/mess/drivers/pv2000.c | 428 -- src/mess/drivers/pv9234.c | 170 - src/mess/drivers/pve500.c | 441 -- src/mess/drivers/px4.c | 1590 ------ src/mess/drivers/px8.c | 838 --- src/mess/drivers/pyl601.c | 622 --- src/mess/drivers/ql.c | 1152 ---- src/mess/drivers/qtsbc.c | 101 - src/mess/drivers/qx10.c | 787 --- src/mess/drivers/radio86.c | 561 -- src/mess/drivers/rainbow.c | 2465 --------- src/mess/drivers/rambo.c | 227 - src/mess/drivers/ravens.c | 388 -- src/mess/drivers/rc759.c | 617 --- src/mess/drivers/rd110.c | 278 - src/mess/drivers/replicator.c | 751 --- src/mess/drivers/rex6000.c | 722 --- src/mess/drivers/riscpc.c | 954 ---- src/mess/drivers/rm380z.c | 179 - src/mess/drivers/rmnimbus.c | 225 - src/mess/drivers/rmt32.c | 438 -- src/mess/drivers/rsc55.c | 83 - src/mess/drivers/rt1715.c | 377 -- src/mess/drivers/rvoice.c | 405 -- src/mess/drivers/rx78.c | 513 -- src/mess/drivers/sacstate.c | 158 - src/mess/drivers/sage2.c | 569 -- src/mess/drivers/samcoupe.c | 620 --- src/mess/drivers/sapi1.c | 671 --- src/mess/drivers/saturn.c | 904 --- src/mess/drivers/savia84.c | 201 - src/mess/drivers/sbc6510.c | 326 -- src/mess/drivers/sbrain.c | 376 -- src/mess/drivers/sc1.c | 200 - src/mess/drivers/sc2.c | 238 - src/mess/drivers/scorpion.c | 377 -- src/mess/drivers/scv.c | 719 --- src/mess/drivers/sdk80.c | 205 - src/mess/drivers/sdk85.c | 145 - src/mess/drivers/sdk86.c | 212 - src/mess/drivers/seattlecmp.c | 127 - src/mess/drivers/segapico.c | 626 --- src/mess/drivers/segapm.c | 80 - src/mess/drivers/selz80.c | 202 - src/mess/drivers/sg1000.c | 915 ---- src/mess/drivers/sgi_ip2.c | 517 -- src/mess/drivers/sgi_ip6.c | 269 - src/mess/drivers/sh4robot.c | 93 - src/mess/drivers/sitcom.c | 135 - src/mess/drivers/slc1.c | 285 - src/mess/drivers/slicer.c | 143 - src/mess/drivers/sm1800.c | 201 - src/mess/drivers/smc777.c | 1027 ---- src/mess/drivers/sms.c | 1017 ---- src/mess/drivers/snes.c | 1396 ----- src/mess/drivers/socrates.c | 1587 ------ src/mess/drivers/softbox.c | 450 -- src/mess/drivers/sorcerer.c | 510 -- src/mess/drivers/spc1000.c | 522 -- src/mess/drivers/spec128.c | 364 -- src/mess/drivers/special.c | 599 -- src/mess/drivers/specpls3.c | 461 -- src/mess/drivers/spectrum.c | 995 ---- src/mess/drivers/squale.c | 99 - src/mess/drivers/ssem.c | 655 --- src/mess/drivers/ssystem3.c | 337 -- src/mess/drivers/stratos.c | 370 -- src/mess/drivers/studio2.c | 759 --- src/mess/drivers/sun1.c | 170 - src/mess/drivers/sun2.c | 136 - src/mess/drivers/sun3.c | 977 ---- src/mess/drivers/sun4.c | 595 -- src/mess/drivers/super6.c | 573 -- src/mess/drivers/super80.c | 970 ---- src/mess/drivers/supercon.c | 811 --- src/mess/drivers/superslave.c | 411 -- src/mess/drivers/supracan.c | 1927 ------- src/mess/drivers/sv8000.c | 417 -- src/mess/drivers/svi318.c | 540 -- src/mess/drivers/svision.c | 606 -- src/mess/drivers/svmu.c | 358 -- src/mess/drivers/swtpc.c | 135 - src/mess/drivers/swtpc09.c | 265 - src/mess/drivers/sym1.c | 372 -- src/mess/drivers/sys2900.c | 146 - src/mess/drivers/systec.c | 123 - src/mess/drivers/tamag1.c | 170 - src/mess/drivers/tandy1t.c | 819 --- src/mess/drivers/tandy2k.c | 908 --- src/mess/drivers/tavernie.c | 401 -- src/mess/drivers/tb303.c | 312 -- src/mess/drivers/tdv2324.c | 349 -- src/mess/drivers/tec1.c | 463 -- src/mess/drivers/tecnbras.c | 133 - src/mess/drivers/tek405x.c | 1252 ----- src/mess/drivers/tek410x.c | 148 - src/mess/drivers/terak.c | 120 - src/mess/drivers/test_t400.c | 53 - src/mess/drivers/thomson.c | 2451 --------- src/mess/drivers/ti630.c | 212 - src/mess/drivers/ti74.c | 605 -- src/mess/drivers/ti85.c | 931 ---- src/mess/drivers/ti89.c | 675 --- src/mess/drivers/ti990_10.c | 389 -- src/mess/drivers/ti990_4.c | 367 -- src/mess/drivers/ti99_2.c | 416 -- src/mess/drivers/ti99_4p.c | 914 ---- src/mess/drivers/ti99_4x.c | 1179 ---- src/mess/drivers/ti99_8.c | 1124 ---- src/mess/drivers/ticalc1x.c | 1316 ----- src/mess/drivers/tiki100.c | 745 --- src/mess/drivers/tim011.c | 165 - src/mess/drivers/tim100.c | 168 - src/mess/drivers/timex.c | 781 --- src/mess/drivers/tispeak.c | 1339 ----- src/mess/drivers/tk2000.c | 608 --- src/mess/drivers/tk80.c | 344 -- src/mess/drivers/tk80bs.c | 225 - src/mess/drivers/tm990189.c | 1051 ---- src/mess/drivers/tmc1800.c | 884 --- src/mess/drivers/tmc2000e.c | 328 -- src/mess/drivers/tmc600.c | 314 -- src/mess/drivers/tricep.c | 94 - src/mess/drivers/trs80.c | 927 ---- src/mess/drivers/trs80m2.c | 953 ---- src/mess/drivers/ts802.c | 242 - src/mess/drivers/ts803.c | 68 - src/mess/drivers/ts816.c | 109 - src/mess/drivers/tsispch.c | 548 -- src/mess/drivers/tutor.c | 796 --- src/mess/drivers/tv950.c | 70 - src/mess/drivers/tvc.c | 876 --- src/mess/drivers/tvgame.c | 133 - src/mess/drivers/tx0.c | 1625 ------ src/mess/drivers/uknc.c | 93 - src/mess/drivers/unior.c | 463 -- src/mess/drivers/unistar.c | 125 - src/mess/drivers/univac.c | 214 - src/mess/drivers/unixpc.c | 235 - src/mess/drivers/ut88.c | 264 - src/mess/drivers/uzebox.c | 310 -- src/mess/drivers/v1050.c | 1148 ---- src/mess/drivers/v6809.c | 382 -- src/mess/drivers/vax11.c | 174 - src/mess/drivers/vboy.c | 1397 ----- src/mess/drivers/vc4000.c | 715 --- src/mess/drivers/vcs80.c | 257 - src/mess/drivers/vector06.c | 233 - src/mess/drivers/vector4.c | 120 - src/mess/drivers/vg5k.c | 421 -- src/mess/drivers/vic10.c | 678 --- src/mess/drivers/vic20.c | 859 --- src/mess/drivers/victor9k.c | 601 -- src/mess/drivers/vidbrain.c | 601 -- src/mess/drivers/vii.c | 1234 ----- src/mess/drivers/vip.c | 810 --- src/mess/drivers/vixen.c | 877 --- src/mess/drivers/vk100.c | 1265 ----- src/mess/drivers/votrpss.c | 334 -- src/mess/drivers/votrtnt.c | 151 - src/mess/drivers/vt100.c | 862 --- src/mess/drivers/vt220.c | 113 - src/mess/drivers/vt240.c | 331 -- src/mess/drivers/vt320.c | 125 - src/mess/drivers/vt520.c | 111 - src/mess/drivers/vta2000.c | 195 - src/mess/drivers/vtech1.c | 558 -- src/mess/drivers/vtech2.c | 506 -- src/mess/drivers/wangpc.c | 1194 ---- src/mess/drivers/wicat.c | 989 ---- src/mess/drivers/wildfire.c | 343 -- src/mess/drivers/wswan.c | 185 - src/mess/drivers/x07.c | 1568 ------ src/mess/drivers/x1.c | 2649 --------- src/mess/drivers/x1twin.c | 540 -- src/mess/drivers/x68k.c | 1854 ------- src/mess/drivers/xavix.c | 179 - src/mess/drivers/xbox.c | 254 - src/mess/drivers/xerox820.c | 833 --- src/mess/drivers/xor100.c | 599 -- src/mess/drivers/ymmu100.c | 499 -- src/mess/drivers/ymmu100.ppm | Bin 578415 -> 0 bytes src/mess/drivers/z100.c | 731 --- src/mess/drivers/z1013.c | 468 -- src/mess/drivers/z80dev.c | 127 - src/mess/drivers/z80ne.c | 601 -- src/mess/drivers/z88.c | 758 --- src/mess/drivers/z9001.c | 317 -- src/mess/drivers/zapcomputer.c | 156 - src/mess/drivers/zaurus.c | 1815 ------ src/mess/drivers/zexall.c | 171 - src/mess/drivers/zorba.c | 432 -- src/mess/drivers/zrt80.c | 323 -- src/mess/drivers/zsbc3.c | 127 - src/mess/drivers/zx.c | 544 -- src/mess/includes/abc1600.h | 158 - src/mess/includes/abc80.h | 184 - src/mess/includes/abc80x.h | 356 -- src/mess/includes/ac1.h | 48 - src/mess/includes/adam.h | 118 - src/mess/includes/advision.h | 87 - src/mess/includes/aim65.h | 99 - src/mess/includes/alesis.h | 115 - src/mess/includes/amstrad.h | 325 -- src/mess/includes/apollo.h | 602 -- src/mess/includes/apple1.h | 92 - src/mess/includes/apple2.h | 382 -- src/mess/includes/apple2gs.h | 267 - src/mess/includes/apple3.h | 173 - src/mess/includes/aquarius.h | 89 - src/mess/includes/arcadia.h | 128 - src/mess/includes/at.h | 200 - src/mess/includes/atarist.h | 469 -- src/mess/includes/atom.h | 169 - src/mess/includes/aussiebyte.h | 126 - src/mess/includes/avigo.h | 116 - src/mess/includes/b2m.h | 81 - src/mess/includes/banctec.h | 38 - src/mess/includes/bbc.h | 439 -- src/mess/includes/bebox.h | 136 - src/mess/includes/bk.h | 50 - src/mess/includes/bullet.h | 184 - src/mess/includes/busicom.h | 45 - src/mess/includes/bw12.h | 127 - src/mess/includes/bw2.h | 118 - src/mess/includes/c128.h | 253 - src/mess/includes/c64.h | 216 - src/mess/includes/c65.h | 2 - src/mess/includes/c80.h | 57 - src/mess/includes/cbm2.h | 329 -- src/mess/includes/cgc7900.h | 104 - src/mess/includes/channelf.h | 54 - src/mess/includes/coco.h | 269 - src/mess/includes/coco12.h | 67 - src/mess/includes/coco3.h | 67 - src/mess/includes/coleco.h | 99 - src/mess/includes/compis.h | 135 - src/mess/includes/comquest.h | 34 - src/mess/includes/comx35.h | 106 - src/mess/includes/concept.h | 71 - src/mess/includes/cosmicos.h | 147 - src/mess/includes/crvision.h | 114 - src/mess/includes/cxhumax.h | 281 - src/mess/includes/cybiko.h | 106 - src/mess/includes/dai.h | 81 - src/mess/includes/dccons.h | 48 - src/mess/includes/dgn_beta.h | 226 - src/mess/includes/dgnalpha.h | 97 - src/mess/includes/dm7000.h | 94 - src/mess/includes/dragon.h | 72 - src/mess/includes/ec184x.h | 43 - src/mess/includes/einstein.h | 221 - src/mess/includes/electron.h | 117 - src/mess/includes/elf.h | 70 - src/mess/includes/ep64.h | 98 - src/mess/includes/eti660.h | 75 - src/mess/includes/exp85.h | 48 - src/mess/includes/fidelz80.h | 79 - src/mess/includes/fm7.h | 390 -- src/mess/includes/fmtowns.h | 384 -- src/mess/includes/galaxy.h | 58 - src/mess/includes/galeb.h | 36 - src/mess/includes/gamate.h | 100 - src/mess/includes/gamecom.h | 290 - src/mess/includes/gamepock.h | 47 - src/mess/includes/gb.h | 171 - src/mess/includes/gba.h | 279 - src/mess/includes/genpc.h | 202 - src/mess/includes/gp32.h | 250 - src/mess/includes/hec2hrp.h | 199 - src/mess/includes/hh_tms1k.h | 86 - src/mess/includes/hh_ucom4.h | 66 - src/mess/includes/hp48.h | 219 - src/mess/includes/huebler.h | 104 - src/mess/includes/hx20.h | 139 - src/mess/includes/imds2.h | 145 - src/mess/includes/intv.h | 155 - src/mess/includes/jupiter.h | 59 - src/mess/includes/kaypro.h | 113 - src/mess/includes/kc.h | 189 - src/mess/includes/kramermc.h | 41 - src/mess/includes/kyocera.h | 291 - src/mess/includes/lc80.h | 68 - src/mess/includes/lisa.h | 237 - src/mess/includes/llc.h | 64 - src/mess/includes/lviv.h | 70 - src/mess/includes/lynx.h | 295 - src/mess/includes/m5.h | 87 - src/mess/includes/mac.h | 562 -- src/mess/includes/macpci.h | 169 - src/mess/includes/mbc55x.h | 221 - src/mess/includes/mbee.h | 171 - src/mess/includes/mboard.h | 122 - src/mess/includes/mc1000.h | 120 - src/mess/includes/mc1502.h | 84 - src/mess/includes/mc80.h | 57 - src/mess/includes/md_cons.h | 49 - src/mess/includes/micronic.h | 98 - src/mess/includes/microtan.h | 103 - src/mess/includes/mikro80.h | 80 - src/mess/includes/mikromik.h | 138 - src/mess/includes/mpf1.h | 78 - src/mess/includes/mpz80.h | 99 - src/mess/includes/msbc1.h | 28 - src/mess/includes/msx.h | 265 - src/mess/includes/mtx.h | 99 - src/mess/includes/mz700.h | 119 - src/mess/includes/mz80.h | 70 - src/mess/includes/nc.h | 155 - src/mess/includes/nes.h | 120 - src/mess/includes/newbrain.h | 274 - src/mess/includes/next.h | 190 - src/mess/includes/ob68k1a.h | 62 - src/mess/includes/ondra.h | 76 - src/mess/includes/orao.h | 46 - src/mess/includes/orion.h | 125 - src/mess/includes/osborne1.h | 147 - src/mess/includes/osi.h | 167 - src/mess/includes/p2000t.h | 57 - src/mess/includes/partner.h | 45 - src/mess/includes/pasopia.h | 137 - src/mess/includes/pc1251.h | 62 - src/mess/includes/pc1350.h | 60 - src/mess/includes/pc1401.h | 60 - src/mess/includes/pc1403.h | 65 - src/mess/includes/pc1512.h | 258 - src/mess/includes/pc4.h | 76 - src/mess/includes/pc8001.h | 96 - src/mess/includes/pc8401a.h | 115 - src/mess/includes/pce.h | 82 - src/mess/includes/pcw.h | 140 - src/mess/includes/pcw16.h | 160 - src/mess/includes/pdp1.h | 336 -- src/mess/includes/pecom.h | 76 - src/mess/includes/pes.h | 55 - src/mess/includes/pet.h | 284 - src/mess/includes/phc25.h | 59 - src/mess/includes/pk8020.h | 108 - src/mess/includes/plus4.h | 176 - src/mess/includes/pmd85.h | 155 - src/mess/includes/pocketc.h | 26 - src/mess/includes/poisk1.h | 101 - src/mess/includes/poly88.h | 85 - src/mess/includes/poly880.h | 59 - src/mess/includes/portfoli.h | 123 - src/mess/includes/pp01.h | 66 - src/mess/includes/primo.h | 70 - src/mess/includes/prof180x.h | 48 - src/mess/includes/prof80.h | 98 - src/mess/includes/psion.h | 104 - src/mess/includes/px8.h | 87 - src/mess/includes/ql.h | 143 - src/mess/includes/radio86.h | 129 - src/mess/includes/rm380z.h | 138 - src/mess/includes/rmnimbus.h | 222 - src/mess/includes/sage2.h | 99 - src/mess/includes/samcoupe.h | 203 - src/mess/includes/sg1000.h | 149 - src/mess/includes/sms.h | 250 - src/mess/includes/softbox.h | 68 - src/mess/includes/sorcerer.h | 110 - src/mess/includes/special.h | 153 - src/mess/includes/spectrum.h | 262 - src/mess/includes/ssystem3.h | 84 - src/mess/includes/super6.h | 89 - src/mess/includes/super80.h | 123 - src/mess/includes/superslave.h | 75 - src/mess/includes/svi318.h | 159 - src/mess/includes/svision.h | 92 - src/mess/includes/swtpc09.h | 150 - src/mess/includes/tandy2k.h | 229 - src/mess/includes/tdv2324.h | 87 - src/mess/includes/tek405x.h | 162 - src/mess/includes/thomson.h | 713 --- src/mess/includes/ti85.h | 229 - src/mess/includes/ti89.h | 89 - src/mess/includes/tiki100.h | 146 - src/mess/includes/tmc1800.h | 209 - src/mess/includes/tmc2000e.h | 87 - src/mess/includes/tmc600.h | 101 - src/mess/includes/trs80.h | 206 - src/mess/includes/trs80m2.h | 168 - src/mess/includes/tsispch.h | 58 - src/mess/includes/tx0.h | 329 -- src/mess/includes/ut88.h | 100 - src/mess/includes/v1050.h | 235 - src/mess/includes/vc4000.h | 157 - src/mess/includes/vcs80.h | 52 - src/mess/includes/vector06.h | 102 - src/mess/includes/vic10.h | 118 - src/mess/includes/vic20.h | 162 - src/mess/includes/victor9k.h | 156 - src/mess/includes/vidbrain.h | 126 - src/mess/includes/vip.h | 129 - src/mess/includes/vixen.h | 133 - src/mess/includes/vtech2.h | 96 - src/mess/includes/wangpc.h | 205 - src/mess/includes/wswan.h | 104 - src/mess/includes/x07.h | 285 - src/mess/includes/x1.h | 303 - src/mess/includes/x68k.h | 362 -- src/mess/includes/xerox820.h | 166 - src/mess/includes/xor100.h | 107 - src/mess/includes/z80ne.h | 192 - src/mess/includes/z88.h | 95 - src/mess/includes/zapcomputer.h | 30 - src/mess/includes/zx.h | 112 - src/mess/layout/4004clk.lay | 47 - src/mess/layout/abc1600.lay | 14 - src/mess/layout/acrnsys1.lay | 58 - src/mess/layout/aim65.lay | 135 - src/mess/layout/aim65_40.lay | 146 - src/mess/layout/amaztron.lay | 33 - src/mess/layout/amico2k.lay | 30 - src/mess/layout/amiga.lay | 32 - src/mess/layout/apollo.lay | 114 - src/mess/layout/apollo_15i.lay | 119 - src/mess/layout/apollo_dsp.lay | 74 - src/mess/layout/apricotp.lay | 32 - src/mess/layout/astro.lay | 64 - src/mess/layout/avigo.lay | 61 - src/mess/layout/babbage.lay | 68 - src/mess/layout/bankshot.lay | 251 - src/mess/layout/bbc.lay | 84 - src/mess/layout/beta.lay | 49 - src/mess/layout/bigtrak.lay | 79 - src/mess/layout/bitgrpha.lay | 9 - src/mess/layout/bitgrphb.lay | 9 - src/mess/layout/bob85.lay | 39 - src/mess/layout/borisdpl.lay | 35 - src/mess/layout/bridgec3.lay | 114 - src/mess/layout/c80.lay | 39 - src/mess/layout/cc40.lay | 228 - src/mess/layout/chessmst.lay | 351 -- src/mess/layout/chesstrv.lay | 23 - src/mess/layout/cnsector.lay | 143 - src/mess/layout/coco3.lay | 14 - src/mess/layout/comp4.lay | 133 - src/mess/layout/cosmicos.lay | 139 - src/mess/layout/cp1.lay | 40 - src/mess/layout/cvicny.lay | 52 - src/mess/layout/dataman.lay | 78 - src/mess/layout/digel804.lay | 217 - src/mess/layout/dmv.lay | 184 - src/mess/layout/dolphunk.lay | 42 - src/mess/layout/eacc.lay | 134 - src/mess/layout/ebaskb2.lay | 145 - src/mess/layout/ebball.lay | 199 - src/mess/layout/ebball2.lay | 215 - src/mess/layout/ebball3.lay | 271 - src/mess/layout/efball.lay | 279 - src/mess/layout/efootb4.lay | 166 - src/mess/layout/einvader.lay | 85 - src/mess/layout/einvaderc.lay | 85 - src/mess/layout/elecbowl.lay | 59 - src/mess/layout/elecdet.lay | 45 - src/mess/layout/elekscmp.lay | 45 - src/mess/layout/elf2.lay | 37 - src/mess/layout/esq1by22.lay | 95 - src/mess/layout/esq2by40.lay | 269 - src/mess/layout/et3400.lay | 39 - src/mess/layout/fb01.lay | 180 - src/mess/layout/fccpu1.lay | 17 - src/mess/layout/fidelz80.lay | 62 - src/mess/layout/funjacks.lay | 33 - src/mess/layout/funrlgl.lay | 44 - src/mess/layout/gamecom.lay | 413 -- src/mess/layout/gjackpot.lay | 175 - src/mess/layout/gl3000s.lay | 126 - src/mess/layout/glasgow.lay | 44 - src/mess/layout/gpoker.lay | 156 - src/mess/layout/h2hbaseb.lay | 201 - src/mess/layout/h2hfootb.lay | 236 - src/mess/layout/h8.lay | 95 - src/mess/layout/hh_hmcs40_test.lay | 684 --- src/mess/layout/hh_melps4_test.lay | 556 -- src/mess/layout/hh_sm510_test.lay | 301 - src/mess/layout/hh_tms1k_test.lay | 556 -- src/mess/layout/hh_ucom4_test.lay | 556 -- src/mess/layout/ie15.lay | 124 - src/mess/layout/instruct.lay | 86 - src/mess/layout/junior.lay | 44 - src/mess/layout/k1003.lay | 72 - src/mess/layout/kim1.lay | 44 - src/mess/layout/lantutor.lay | 48 - src/mess/layout/lc80.lay | 58 - src/mess/layout/lightfgt.lay | 235 - src/mess/layout/llc1.lay | 94 - src/mess/layout/lynx.lay | 20 - src/mess/layout/mac.lay | 13 - src/mess/layout/maniac.lay | 27 - src/mess/layout/mathmagi.lay | 90 - src/mess/layout/mbdtower.lay | 115 - src/mess/layout/megacd.lay | 31 - src/mess/layout/mekd2.lay | 39 - src/mess/layout/mephisto.lay | 62 - src/mess/layout/merlin.lay | 404 -- src/mess/layout/minicom.lay | 113 - src/mess/layout/mirage.lay | 35 - src/mess/layout/mk1.lay | 42 - src/mess/layout/mk14.lay | 45 - src/mess/layout/mk2.lay | 64 - src/mess/layout/mkit09.lay | 39 - src/mess/layout/mmd1.lay | 123 - src/mess/layout/mmd2.lay | 204 - src/mess/layout/mmerlin.lay | 414 -- src/mess/layout/mpf1.lay | 74 - src/mess/layout/mpf1b.lay | 74 - src/mess/layout/mpf1p.lay | 96 - src/mess/layout/mvbfree.lay | 178 - src/mess/layout/newbrain.lay | 65 - src/mess/layout/pairmtch.lay | 201 - src/mess/layout/pc1500.lay | 132 - src/mess/layout/pc8500.lay | 13 - src/mess/layout/pcw.lay | 23 - src/mess/layout/pmi80.lay | 62 - src/mess/layout/poly880.lay | 36 - src/mess/layout/pro80.lay | 40 - src/mess/layout/pve500.lay | 131 - src/mess/layout/px4.lay | 33 - src/mess/layout/px8.lay | 30 - src/mess/layout/rainbow.lay | 229 - src/mess/layout/ravens.lay | 86 - src/mess/layout/savia84.lay | 74 - src/mess/layout/sc1.lay | 62 - src/mess/layout/sc2.lay | 62 - src/mess/layout/sdk85.lay | 39 - src/mess/layout/sdk86.lay | 61 - src/mess/layout/selz80.lay | 45 - src/mess/layout/simon.lay | 180 - src/mess/layout/sitcom.lay | 63 - src/mess/layout/slc1.lay | 53 - src/mess/layout/sms1.lay | 62 - src/mess/layout/snmath.lay | 68 - src/mess/layout/snspell.lay | 65 - src/mess/layout/splitsec.lay | 93 - src/mess/layout/sr16.lay | 335 -- src/mess/layout/ssimon.lay | 149 - src/mess/layout/starwbc.lay | 127 - src/mess/layout/stopthie.lay | 32 - src/mess/layout/super80.lay | 36 - src/mess/layout/svision.lay | 18 - src/mess/layout/svmu.lay | 55 - src/mess/layout/sym1.lay | 49 - src/mess/layout/tactix.lay | 150 - src/mess/layout/tama.lay | 72 - src/mess/layout/tandy12.lay | 430 -- src/mess/layout/tavernie.lay | 13 - src/mess/layout/tb303.lay | 45 - src/mess/layout/tbreakup.lay | 131 - src/mess/layout/tc4.lay | 144 - src/mess/layout/tec1.lay | 39 - src/mess/layout/tecnbras.lay | 313 -- src/mess/layout/ti1270.lay | 39 - src/mess/layout/ti30.lay | 42 - src/mess/layout/ti74.lay | 223 - src/mess/layout/ti95.lay | 325 -- src/mess/layout/tisr16.lay | 51 - src/mess/layout/tk80.lay | 52 - src/mess/layout/tm990189.lay | 78 - src/mess/layout/tm990189v.lay | 146 - src/mess/layout/tntell.lay | 101 - src/mess/layout/unixpc.lay | 49 - src/mess/layout/ut88mini.lay | 39 - src/mess/layout/vboy.lay | 29 - src/mess/layout/vcs80.lay | 39 - src/mess/layout/vidbrain.lay | 8 - src/mess/layout/vk100.lay | 110 - src/mess/layout/votrpss.lay | 16 - src/mess/layout/votrtnt.lay | 16 - src/mess/layout/vsc.lay | 262 - src/mess/layout/vt100.lay | 110 - src/mess/layout/wicat.lay | 35 - src/mess/layout/wildfire.lay | 150 - src/mess/layout/wizatron.lay | 78 - src/mess/layout/wswan.lay | 14 - src/mess/layout/x68000.lay | 95 - src/mess/layout/z80dev.lay | 40 - src/mess/layout/z80ne.lay | 650 --- src/mess/layout/z80net.lay | 669 --- src/mess/layout/z80netb.lay | 59 - src/mess/layout/z80netf.lay | 709 --- src/mess/layout/zapcomputer.lay | 44 - src/mess/machine/6883sam.c | 557 -- src/mess/machine/6883sam.h | 266 - src/mess/machine/abc1600mac.c | 686 --- src/mess/machine/abc1600mac.h | 136 - src/mess/machine/abc80kb.c | 205 - src/mess/machine/abc80kb.h | 74 - src/mess/machine/ac1.c | 108 - src/mess/machine/advision.c | 193 - src/mess/machine/aim65.c | 424 -- src/mess/machine/amigakbd.c | 574 -- src/mess/machine/amigakbd.h | 144 - src/mess/machine/amstrad.c | 3332 ----------- src/mess/machine/apollo.c | 1042 ---- src/mess/machine/apollo_dbg.c | 1182 ---- src/mess/machine/apollo_kbd.c | 986 ---- src/mess/machine/apollo_kbd.h | 163 - src/mess/machine/appldriv.c | 336 -- src/mess/machine/appldriv.h | 88 - src/mess/machine/apple1.c | 404 -- src/mess/machine/apple2.c | 2632 --------- src/mess/machine/apple2gs.c | 2236 -------- src/mess/machine/apple3.c | 1301 ----- src/mess/machine/applefdc.c | 586 -- src/mess/machine/applefdc.h | 163 - src/mess/machine/apricotkb.c | 404 -- src/mess/machine/apricotkb.h | 97 - src/mess/machine/apricotkb_hle.c | 286 - src/mess/machine/apricotkb_hle.h | 73 - src/mess/machine/at.c | 313 -- src/mess/machine/atarifdc.c | 796 --- src/mess/machine/atarifdc.h | 69 - src/mess/machine/b2m.c | 304 -- src/mess/machine/bbc.c | 1861 ------- src/mess/machine/bebox.c | 814 --- src/mess/machine/beta.c | 292 - src/mess/machine/beta.h | 69 - src/mess/machine/bk.c | 168 - src/mess/machine/c65_old.c | 1339 ----- src/mess/machine/cbm_snqk.c | 100 - src/mess/machine/cbm_snqk.h | 21 - src/mess/machine/coco.c | 1387 ----- src/mess/machine/coco12.c | 119 - src/mess/machine/coco3.c | 167 - src/mess/machine/coco_vhd.c | 281 - src/mess/machine/coco_vhd.h | 73 - src/mess/machine/coleco.c | 177 - src/mess/machine/coleco.h | 10 - src/mess/machine/compiskb.c | 378 -- src/mess/machine/compiskb.h | 90 - src/mess/machine/concept.c | 401 -- src/mess/machine/cuda.c | 567 -- src/mess/machine/cuda.h | 141 - src/mess/machine/cx4data.inc | 200 - src/mess/machine/cx4fn.inc | 331 -- src/mess/machine/cx4oam.inc | 308 -- src/mess/machine/cx4ops.inc | 278 - src/mess/machine/cybiko.c | 492 -- src/mess/machine/dai.c | 216 - src/mess/machine/dccons.c | 196 - src/mess/machine/dec_lk201.c | 760 --- src/mess/machine/dec_lk201.h | 117 - src/mess/machine/dgn_beta.c | 1144 ---- src/mess/machine/dgnalpha.c | 377 -- src/mess/machine/dmv_keyb.c | 313 -- src/mess/machine/dmv_keyb.h | 71 - src/mess/machine/docg3.c | 842 --- src/mess/machine/docg3.h | 103 - src/mess/machine/dragon.c | 153 - src/mess/machine/egret.c | 489 -- src/mess/machine/egret.h | 140 - src/mess/machine/einstein.c | 208 - src/mess/machine/electron.c | 417 -- src/mess/machine/esqpanel.c | 253 - src/mess/machine/esqpanel.h | 140 - src/mess/machine/esqvfd.c | 405 -- src/mess/machine/esqvfd.h | 99 - src/mess/machine/fm_scsi.c | 427 -- src/mess/machine/fm_scsi.h | 103 - src/mess/machine/galaxy.c | 211 - src/mess/machine/gamecom.c | 629 --- src/mess/machine/gamepock.c | 224 - src/mess/machine/gb.c | 757 --- src/mess/machine/genpc.c | 954 ---- src/mess/machine/hec2hrp.c | 822 --- src/mess/machine/hecdisk2.c | 148 - src/mess/machine/hp48.c | 1176 ---- src/mess/machine/ie15_kbd.c | 325 -- src/mess/machine/ie15_kbd.h | 80 - src/mess/machine/intv.c | 532 -- src/mess/machine/isbc_215g.c | 433 -- src/mess/machine/isbc_215g.h | 77 - src/mess/machine/k7659kb.c | 311 -- src/mess/machine/k7659kb.h | 75 - src/mess/machine/kay_kbd.c | 517 -- src/mess/machine/kaypro.c | 292 - src/mess/machine/kb_7007_3.h | 122 - src/mess/machine/kb_poisk1.h | 252 - src/mess/machine/kc.c | 788 --- src/mess/machine/kc_keyb.c | 614 --- src/mess/machine/kc_keyb.h | 65 - src/mess/machine/kramermc.c | 42 - src/mess/machine/lisa.c | 1927 ------- src/mess/machine/llc.c | 180 - src/mess/machine/lviv.c | 321 -- src/mess/machine/lynx.c | 2144 -------- src/mess/machine/m20_8086.c | 119 - src/mess/machine/m20_8086.h | 40 - src/mess/machine/m20_kbd.c | 225 - src/mess/machine/m20_kbd.h | 26 - src/mess/machine/m24_kbd.c | 292 - src/mess/machine/m24_kbd.h | 47 - src/mess/machine/m24_z8000.c | 229 - src/mess/machine/m24_z8000.h | 56 - src/mess/machine/mac.c | 3294 ----------- src/mess/machine/macadb.c | 1430 ----- src/mess/machine/mackbd.c | 329 -- src/mess/machine/mackbd.h | 79 - src/mess/machine/macpci.c | 228 - src/mess/machine/macrtc.c | 365 -- src/mess/machine/macrtc.h | 101 - src/mess/machine/mbc55x.c | 414 -- src/mess/machine/mbee.c | 745 --- src/mess/machine/mboard.c | 568 -- src/mess/machine/mc80.c | 134 - src/mess/machine/mega32x.c | 1957 ------- src/mess/machine/mega32x.h | 235 - src/mess/machine/megacd.c | 1914 ------- src/mess/machine/megacd.h | 254 - src/mess/machine/megacdcd.c | 1331 ----- src/mess/machine/megacdcd.h | 317 -- src/mess/machine/microdrv.c | 197 - src/mess/machine/microdrv.h | 104 - src/mess/machine/micropolis.c | 344 -- src/mess/machine/micropolis.h | 111 - src/mess/machine/microtan.c | 855 --- src/mess/machine/mikro80.c | 105 - src/mess/machine/mm1kb.c | 298 - src/mess/machine/mm1kb.h | 86 - src/mess/machine/ms7004.c | 500 -- src/mess/machine/ms7004.h | 85 - src/mess/machine/msx.c | 531 -- src/mess/machine/msx_matsushita.c | 168 - src/mess/machine/msx_matsushita.h | 48 - src/mess/machine/msx_s1985.c | 65 - src/mess/machine/msx_s1985.h | 33 - src/mess/machine/msx_switched.c | 22 - src/mess/machine/msx_switched.h | 21 - src/mess/machine/msx_systemflags.c | 40 - src/mess/machine/msx_systemflags.h | 39 - src/mess/machine/mtx.c | 414 -- src/mess/machine/mz700.c | 616 --- src/mess/machine/mz80.c | 84 - src/mess/machine/nc.c | 87 - src/mess/machine/nes.c | 208 - src/mess/machine/nextkbd.c | 456 -- src/mess/machine/nextkbd.h | 121 - src/mess/machine/nextmo.c | 198 - src/mess/machine/nextmo.h | 61 - src/mess/machine/ngen_kb.c | 231 - src/mess/machine/ngen_kb.h | 33 - src/mess/machine/ondra.c | 101 - src/mess/machine/orao.c | 80 - src/mess/machine/orion.c | 594 -- src/mess/machine/osborne1.c | 513 -- src/mess/machine/p2000t.c | 157 - src/mess/machine/partner.c | 362 -- src/mess/machine/pc1251.c | 128 - src/mess/machine/pc1350.c | 135 - src/mess/machine/pc1401.c | 240 - src/mess/machine/pc1403.c | 173 - src/mess/machine/pc1512kb.c | 506 -- src/mess/machine/pc1512kb.h | 118 - src/mess/machine/pc9801_118.c | 228 - src/mess/machine/pc9801_118.h | 70 - src/mess/machine/pc9801_26.c | 194 - src/mess/machine/pc9801_26.h | 67 - src/mess/machine/pc9801_86.c | 227 - src/mess/machine/pc9801_86.h | 69 - src/mess/machine/pc9801_cbus.c | 80 - src/mess/machine/pc9801_cbus.h | 77 - src/mess/machine/pc9801_kbd.c | 313 -- src/mess/machine/pc9801_kbd.h | 72 - src/mess/machine/pcd_kbd.c | 264 - src/mess/machine/pcd_kbd.h | 40 - src/mess/machine/pce.c | 250 - src/mess/machine/pce220_ser.c | 307 -- src/mess/machine/pce220_ser.h | 95 - src/mess/machine/pce_cd.c | 1519 ------ src/mess/machine/pce_cd.h | 188 - src/mess/machine/pecom.c | 179 - src/mess/machine/pk8020.c | 908 --- src/mess/machine/pmd85.c | 838 --- src/mess/machine/poly88.c | 332 -- src/mess/machine/pp01.c | 199 - src/mess/machine/primo.c | 358 -- src/mess/machine/prof80mmu.c | 127 - src/mess/machine/prof80mmu.h | 68 - src/mess/machine/psion_pack.c | 323 -- src/mess/machine/psion_pack.h | 79 - src/mess/machine/psxcd.c | 1234 ----- src/mess/machine/psxcd.h | 161 - src/mess/machine/qimi.c | 181 - src/mess/machine/qimi.h | 78 - src/mess/machine/qx10kbd.c | 301 - src/mess/machine/qx10kbd.h | 35 - src/mess/machine/radio86.c | 234 - src/mess/machine/rm380z.c | 278 - src/mess/machine/rmnimbus.c | 1718 ------ src/mess/machine/rmnkbd.c | 209 - src/mess/machine/rmnkbd.h | 28 - src/mess/machine/rx01.c | 260 - src/mess/machine/rx01.h | 85 - src/mess/machine/samcoupe.c | 336 -- src/mess/machine/sgi.c | 562 -- src/mess/machine/sgi.h | 80 - src/mess/machine/smartmed.c | 791 --- src/mess/machine/smartmed.h | 239 - src/mess/machine/sms.c | 1521 ------ src/mess/machine/snescx4.c | 257 - src/mess/machine/snescx4.h | 29 - src/mess/machine/sonydriv.c | 572 -- src/mess/machine/sonydriv.h | 71 - src/mess/machine/sorcerer.c | 492 -- src/mess/machine/spec_snqk.c | 2565 --------- src/mess/machine/spec_snqk.h | 181 - src/mess/machine/special.c | 397 -- src/mess/machine/super80.c | 240 - src/mess/machine/svi318.c | 767 --- src/mess/machine/swim.c | 222 - src/mess/machine/swim.h | 63 - src/mess/machine/swtpc09.c | 859 --- src/mess/machine/tandy2kb.c | 432 -- src/mess/machine/tandy2kb.h | 110 - src/mess/machine/teleprinter.c | 237 - src/mess/machine/teleprinter.h | 42 - src/mess/machine/thomflop.c | 1914 ------- src/mess/machine/thomflop.h | 36 - src/mess/machine/thomson.c | 4794 ---------------- src/mess/machine/ti85.c | 1192 ---- src/mess/machine/trs80.c | 933 ---- src/mess/machine/trs80m2kb.c | 392 -- src/mess/machine/trs80m2kb.h | 106 - src/mess/machine/upd65031.c | 621 --- src/mess/machine/upd65031.h | 121 - src/mess/machine/ut88.c | 178 - src/mess/machine/v1050kb.c | 425 -- src/mess/machine/v1050kb.h | 86 - src/mess/machine/vector06.c | 181 - src/mess/machine/victor9k_fdc.c | 1351 ----- src/mess/machine/victor9k_fdc.h | 241 - src/mess/machine/victor9kb.c | 712 --- src/mess/machine/victor9kb.h | 97 - src/mess/machine/vtech2.c | 489 -- src/mess/machine/wangpckb.c | 583 -- src/mess/machine/wangpckb.h | 107 - src/mess/machine/wswan.c | 662 --- src/mess/machine/x1.c | 69 - src/mess/machine/x68k_hdc.c | 431 -- src/mess/machine/x68k_hdc.h | 130 - src/mess/machine/x68k_kbd.c | 452 -- src/mess/machine/x68k_kbd.h | 41 - src/mess/machine/x820kb.c | 387 -- src/mess/machine/x820kb.h | 87 - src/mess/machine/z80bin.c | 77 - src/mess/machine/z80bin.h | 18 - src/mess/machine/z80ne.c | 770 --- src/mess/machine/zx.c | 390 -- src/mess/machine/zx8302.c | 606 -- src/mess/machine/zx8302.h | 263 - src/mess/tools/castool/main.c | 217 - src/mess/tools/floptool/main.c | 275 - src/mess/tools/imgtool/charconv.c | 162 - src/mess/tools/imgtool/charconv.h | 31 - src/mess/tools/imgtool/filtbas.c | 3115 ----------- src/mess/tools/imgtool/filteoln.c | 127 - src/mess/tools/imgtool/filter.c | 82 - src/mess/tools/imgtool/filter.h | 66 - src/mess/tools/imgtool/formats/coco_dsk.c | 1194 ---- src/mess/tools/imgtool/formats/coco_dsk.h | 24 - src/mess/tools/imgtool/formats/vt_dsk.c | 57 - src/mess/tools/imgtool/formats/vt_dsk.h | 18 - src/mess/tools/imgtool/iflopimg.c | 363 -- src/mess/tools/imgtool/iflopimg.h | 41 - src/mess/tools/imgtool/imghd.c | 273 - src/mess/tools/imgtool/imghd.h | 42 - src/mess/tools/imgtool/imgterrs.c | 55 - src/mess/tools/imgtool/imgterrs.h | 70 - src/mess/tools/imgtool/imgtool.c | 2814 ---------- src/mess/tools/imgtool/imgtool.h | 169 - src/mess/tools/imgtool/library.c | 282 - src/mess/tools/imgtool/library.h | 408 -- src/mess/tools/imgtool/main.c | 972 ---- src/mess/tools/imgtool/main.h | 20 - src/mess/tools/imgtool/modules.c | 119 - src/mess/tools/imgtool/modules.h | 18 - src/mess/tools/imgtool/modules/amiga.c | 2411 -------- src/mess/tools/imgtool/modules/bml3.c | 928 ---- src/mess/tools/imgtool/modules/concept.c | 492 -- src/mess/tools/imgtool/modules/cybiko.c | 578 -- src/mess/tools/imgtool/modules/cybikoxt.c | 539 -- src/mess/tools/imgtool/modules/fat.c | 2111 ------- src/mess/tools/imgtool/modules/fat.h | 3 - src/mess/tools/imgtool/modules/hp48.c | 739 --- src/mess/tools/imgtool/modules/mac.c | 6418 ---------------------- src/mess/tools/imgtool/modules/macbin.c | 377 -- src/mess/tools/imgtool/modules/macutil.c | 89 - src/mess/tools/imgtool/modules/macutil.h | 42 - src/mess/tools/imgtool/modules/os9.c | 1244 ----- src/mess/tools/imgtool/modules/pc_flop.c | 173 - src/mess/tools/imgtool/modules/pc_hard.c | 470 -- src/mess/tools/imgtool/modules/prodos.c | 2282 -------- src/mess/tools/imgtool/modules/psion.c | 683 --- src/mess/tools/imgtool/modules/rsdos.c | 623 --- src/mess/tools/imgtool/modules/thomson.c | 1681 ------ src/mess/tools/imgtool/modules/ti99.c | 5360 ------------------ src/mess/tools/imgtool/modules/ti990hd.c | 1818 ------ src/mess/tools/imgtool/modules/vzdos.c | 960 ---- src/mess/tools/imgtool/stream.c | 536 -- src/mess/tools/imgtool/stream.h | 48 - src/mess/video/733_asr.c | 815 --- src/mess/video/733_asr.h | 88 - src/mess/video/911_chr.h | 3516 ------------ src/mess/video/911_key.h | 4028 -------------- src/mess/video/911_vdt.c | 844 --- src/mess/video/911_vdt.h | 118 - src/mess/video/abc1600.c | 1259 ----- src/mess/video/abc1600.h | 151 - src/mess/video/abc80.c | 205 - src/mess/video/abc800.c | 311 -- src/mess/video/abc802.c | 220 - src/mess/video/abc806.c | 507 -- src/mess/video/ac1.c | 61 - src/mess/video/advision.c | 110 - src/mess/video/alesis.c | 167 - src/mess/video/apollo.c | 1978 ------- src/mess/video/apple1.c | 392 -- src/mess/video/apple2.c | 1540 ------ src/mess/video/apple2.h | 61 - src/mess/video/apple2gs.c | 168 - src/mess/video/apple3.c | 518 -- src/mess/video/aquarius.c | 80 - src/mess/video/arcadia.c | 676 --- src/mess/video/atarist.c | 1131 ---- src/mess/video/atarist.h | 41 - src/mess/video/aussiebyte.c | 196 - src/mess/video/avigo.c | 118 - src/mess/video/b2m.c | 60 - src/mess/video/bbc.c | 306 -- src/mess/video/bk.c | 40 - src/mess/video/busicom.c | 1860 ------- src/mess/video/cgc7900.c | 237 - src/mess/video/channelf.c | 71 - src/mess/video/comquest.c | 24 - src/mess/video/comx35.c | 126 - src/mess/video/crt.c | 184 - src/mess/video/crt.h | 93 - src/mess/video/dai.c | 764 --- src/mess/video/dgn_beta.c | 286 - src/mess/video/electron.c | 273 - src/mess/video/fm7.c | 1493 ----- src/mess/video/fmtowns.c | 1729 ------ src/mess/video/galaxy.c | 134 - src/mess/video/galeb.c | 45 - src/mess/video/gamecom.c | 71 - src/mess/video/gb_lcd.c | 2852 ---------- src/mess/video/gb_lcd.h | 215 - src/mess/video/gba.c | 1901 ------- src/mess/video/gime.c | 2077 ------- src/mess/video/gime.h | 311 -- src/mess/video/hec2video.c | 141 - src/mess/video/hp48.c | 203 - src/mess/video/intv.c | 137 - src/mess/video/k1ge.c | 918 ---- src/mess/video/k1ge.h | 92 - src/mess/video/kaypro.c | 312 -- src/mess/video/kc.c | 240 - src/mess/video/kramermc.c | 46 - src/mess/video/kyocera.c | 89 - src/mess/video/llc.c | 96 - src/mess/video/lviv.c | 91 - src/mess/video/mac.c | 1257 ----- src/mess/video/maria.c | 484 -- src/mess/video/maria.h | 72 - src/mess/video/mbc55x.c | 186 - src/mess/video/mbee.c | 495 -- src/mess/video/mc80.c | 173 - src/mess/video/microtan.c | 57 - src/mess/video/mikro80.c | 40 - src/mess/video/mikromik.c | 126 - src/mess/video/mz700.c | 128 - src/mess/video/mz80.c | 143 - src/mess/video/nc.c | 120 - src/mess/video/nes.c | 62 - src/mess/video/newbrain.c | 130 - src/mess/video/newport.c | 1667 ------ src/mess/video/newport.h | 163 - src/mess/video/nick.c | 1055 ---- src/mess/video/nick.h | 178 - src/mess/video/ondra.c | 47 - src/mess/video/orao.c | 38 - src/mess/video/orion.c | 114 - src/mess/video/osi.c | 180 - src/mess/video/p2000m.c | 60 - src/mess/video/pc1251.c | 163 - src/mess/video/pc1350.c | 165 - src/mess/video/pc1401.c | 213 - src/mess/video/pc1403.c | 246 - src/mess/video/pc1512.c | 606 -- src/mess/video/pc4.c | 196 - src/mess/video/pc8401a.c | 102 - src/mess/video/pc_t1t.c | 1033 ---- src/mess/video/pc_t1t.h | 147 - src/mess/video/pcd.c | 396 -- src/mess/video/pcd.h | 98 - src/mess/video/pcw.c | 187 - src/mess/video/pcw16.c | 268 - src/mess/video/pdp1.c | 591 -- src/mess/video/pecom.c | 109 - src/mess/video/pk8020.c | 59 - src/mess/video/pocketc.c | 70 - src/mess/video/poisk1.c | 322 -- src/mess/video/poisk1.h | 10 - src/mess/video/poly88.c | 102 - src/mess/video/pp01.c | 56 - src/mess/video/primo.c | 47 - src/mess/video/rm380z.c | 406 -- src/mess/video/rmnimbus.c | 514 -- src/mess/video/samcoupe.c | 171 - src/mess/video/special.c | 153 - src/mess/video/spectrum.c | 298 - src/mess/video/ssystem3.c | 236 - src/mess/video/stic.c | 974 ---- src/mess/video/stic.h | 559 -- src/mess/video/super80.c | 426 -- src/mess/video/thomson.c | 1387 ----- src/mess/video/ti85.c | 194 - src/mess/video/timex.c | 270 - src/mess/video/tmc1800.c | 70 - src/mess/video/tmc600.c | 141 - src/mess/video/trs80.c | 588 -- src/mess/video/tx0.c | 469 -- src/mess/video/ut88.c | 44 - src/mess/video/uv201.c | 589 -- src/mess/video/uv201.h | 159 - src/mess/video/v1050.c | 124 - src/mess/video/vc4000.c | 650 --- src/mess/video/vector06.c | 61 - src/mess/video/vtech2.c | 312 -- src/mess/video/vtvideo.c | 956 ---- src/mess/video/vtvideo.h | 113 - src/mess/video/wswan_video.c | 1216 ----- src/mess/video/wswan_video.h | 149 - src/mess/video/x68k.c | 1267 ----- src/mess/video/z88.c | 175 - src/mess/video/zx.c | 223 - src/mess/video/zx8301.c | 334 -- src/mess/video/zx8301.h | 123 - 3061 files changed, 665381 insertions(+), 665395 deletions(-) create mode 100644 src/mame/audio/alesis.c create mode 100644 src/mame/audio/arcadia.c create mode 100644 src/mame/audio/arcadia.h create mode 100644 src/mame/audio/channelf.c create mode 100644 src/mame/audio/channelf.h create mode 100644 src/mame/audio/dai_snd.c create mode 100644 src/mame/audio/dai_snd.h create mode 100644 src/mame/audio/dave.c create mode 100644 src/mame/audio/dave.h create mode 100644 src/mame/audio/gamate.c create mode 100644 src/mame/audio/gb.c create mode 100644 src/mame/audio/gb.h create mode 100644 src/mame/audio/lynx.c create mode 100644 src/mame/audio/lynx.h create mode 100644 src/mame/audio/mac.c create mode 100644 src/mame/audio/mea8000.c create mode 100644 src/mame/audio/mea8000.h create mode 100644 src/mame/audio/socrates.c create mode 100644 src/mame/audio/socrates.h create mode 100644 src/mame/audio/specimx_snd.c create mode 100644 src/mame/audio/specimx_snd.h create mode 100644 src/mame/audio/svis_snd.c create mode 100644 src/mame/audio/svis_snd.h create mode 100644 src/mame/audio/tvc_snd.c create mode 100644 src/mame/audio/tvc_snd.h create mode 100644 src/mame/audio/upd1771.c create mode 100644 src/mame/audio/upd1771.h create mode 100644 src/mame/audio/vboy.c create mode 100644 src/mame/audio/vboy.h create mode 100644 src/mame/audio/vc4000snd.c create mode 100644 src/mame/audio/vc4000snd.h create mode 100644 src/mame/audio/wswan_snd.c create mode 100644 src/mame/audio/wswan_snd.h create mode 100644 src/mame/drivers/4004clk.c create mode 100644 src/mame/drivers/68ksbc.c create mode 100644 src/mame/drivers/a2600.c create mode 100644 src/mame/drivers/a310.c create mode 100644 src/mame/drivers/a5105.c create mode 100644 src/mame/drivers/a51xx.c create mode 100644 src/mame/drivers/a6809.c create mode 100644 src/mame/drivers/a7150.c create mode 100644 src/mame/drivers/a7800.c create mode 100644 src/mame/drivers/abc1600.c create mode 100644 src/mame/drivers/abc80.c create mode 100644 src/mame/drivers/abc80x.c create mode 100644 src/mame/drivers/ac1.c create mode 100644 src/mame/drivers/acrnsys1.c create mode 100644 src/mame/drivers/adam.c create mode 100644 src/mame/drivers/advision.c create mode 100644 src/mame/drivers/aim65.c create mode 100644 src/mame/drivers/aim65_40.c create mode 100644 src/mame/drivers/alesis.c create mode 100644 src/mame/drivers/alphasma.c create mode 100644 src/mame/drivers/alphatro.c create mode 100644 src/mame/drivers/altair.c create mode 100644 src/mame/drivers/alto2.c create mode 100644 src/mame/drivers/altos5.c create mode 100644 src/mame/drivers/amico2k.c create mode 100644 src/mame/drivers/amiga.c create mode 100644 src/mame/drivers/ampro.c create mode 100644 src/mame/drivers/amstr_pc.c create mode 100644 src/mame/drivers/amstrad.c create mode 100644 src/mame/drivers/amust.c create mode 100644 src/mame/drivers/apc.c create mode 100644 src/mame/drivers/apexc.c create mode 100644 src/mame/drivers/apf.c create mode 100644 src/mame/drivers/apogee.c create mode 100644 src/mame/drivers/apollo.c create mode 100644 src/mame/drivers/apple1.c create mode 100644 src/mame/drivers/apple2.c create mode 100644 src/mame/drivers/apple2e.c create mode 100644 src/mame/drivers/apple2gs.c create mode 100644 src/mame/drivers/apple3.c create mode 100644 src/mame/drivers/applix.c create mode 100644 src/mame/drivers/apricot.c create mode 100644 src/mame/drivers/apricotf.c create mode 100644 src/mame/drivers/apricotp.c create mode 100644 src/mame/drivers/aquarius.c create mode 100644 src/mame/drivers/arcadia.c create mode 100644 src/mame/drivers/argo.c create mode 100644 src/mame/drivers/asst128.c create mode 100644 src/mame/drivers/astrohome.c create mode 100644 src/mame/drivers/at.c create mode 100644 src/mame/drivers/atari400.c create mode 100644 src/mame/drivers/atarist.c create mode 100644 src/mame/drivers/atm.c create mode 100644 src/mame/drivers/atom.c create mode 100644 src/mame/drivers/attache.c create mode 100644 src/mame/drivers/aussiebyte.c create mode 100644 src/mame/drivers/avigo.c create mode 100644 src/mame/drivers/ax20.c create mode 100644 src/mame/drivers/b16.c create mode 100644 src/mame/drivers/b2m.c create mode 100644 src/mame/drivers/babbage.c create mode 100644 src/mame/drivers/banctec.c create mode 100644 src/mame/drivers/basic52.c create mode 100644 src/mame/drivers/bbc.c create mode 100644 src/mame/drivers/bbcbc.c create mode 100644 src/mame/drivers/bcs3.c create mode 100644 src/mame/drivers/bebox.c create mode 100644 src/mame/drivers/beehive.c create mode 100644 src/mame/drivers/besta.c create mode 100644 src/mame/drivers/beta.c create mode 100644 src/mame/drivers/bigbord2.c create mode 100644 src/mame/drivers/binbug.c create mode 100644 src/mame/drivers/bitgraph.c create mode 100644 src/mame/drivers/bk.c create mode 100644 src/mame/drivers/bmjr.c create mode 100644 src/mame/drivers/bml3.c create mode 100644 src/mame/drivers/bob85.c create mode 100644 src/mame/drivers/br8641.c create mode 100644 src/mame/drivers/bullet.c create mode 100644 src/mame/drivers/busicom.c create mode 100644 src/mame/drivers/bw12.c create mode 100644 src/mame/drivers/bw2.c create mode 100644 src/mame/drivers/c10.c create mode 100644 src/mame/drivers/c128.c create mode 100644 src/mame/drivers/c64.c create mode 100644 src/mame/drivers/c64dtv.c create mode 100644 src/mame/drivers/c65.c create mode 100644 src/mame/drivers/c65_old.c create mode 100644 src/mame/drivers/c80.c create mode 100644 src/mame/drivers/c900.c create mode 100644 src/mame/drivers/camplynx.c create mode 100644 src/mame/drivers/canon_s80.c create mode 100644 src/mame/drivers/casloopy.c create mode 100644 src/mame/drivers/cat.c create mode 100644 src/mame/drivers/cbm2.c create mode 100644 src/mame/drivers/cc40.c create mode 100644 src/mame/drivers/ccs2810.c create mode 100644 src/mame/drivers/ccs300.c create mode 100644 src/mame/drivers/cd2650.c create mode 100644 src/mame/drivers/cdc721.c create mode 100644 src/mame/drivers/cfx9850.c create mode 100644 src/mame/drivers/cgc7900.c create mode 100644 src/mame/drivers/cgenie.c create mode 100644 src/mame/drivers/channelf.c create mode 100644 src/mame/drivers/chaos.c create mode 100644 src/mame/drivers/chessmst.c create mode 100644 src/mame/drivers/chesstrv.c create mode 100644 src/mame/drivers/clcd.c create mode 100644 src/mame/drivers/cm1800.c create mode 100644 src/mame/drivers/coco12.c create mode 100644 src/mame/drivers/coco3.c create mode 100644 src/mame/drivers/codata.c create mode 100644 src/mame/drivers/coleco.c create mode 100644 src/mame/drivers/compis.c create mode 100644 src/mame/drivers/compucolor.c create mode 100644 src/mame/drivers/comquest.c create mode 100644 src/mame/drivers/comx35.c create mode 100644 src/mame/drivers/concept.c create mode 100644 src/mame/drivers/cortex.c create mode 100644 src/mame/drivers/cosmicos.c create mode 100644 src/mame/drivers/cp1.c create mode 100644 src/mame/drivers/craft.c create mode 100644 src/mame/drivers/crvision.c create mode 100644 src/mame/drivers/csc.c create mode 100644 src/mame/drivers/ct486.c create mode 100644 src/mame/drivers/cvicny.c create mode 100644 src/mame/drivers/cxhumax.c create mode 100644 src/mame/drivers/cybiko.c create mode 100644 src/mame/drivers/czk80.c create mode 100644 src/mame/drivers/d6800.c create mode 100644 src/mame/drivers/d6809.c create mode 100644 src/mame/drivers/dai.c create mode 100644 src/mame/drivers/daruma.c create mode 100644 src/mame/drivers/dccons.c create mode 100644 src/mame/drivers/dct11em.c create mode 100644 src/mame/drivers/dectalk.c create mode 100644 src/mame/drivers/decwritr.c create mode 100644 src/mame/drivers/dgn_beta.c create mode 100644 src/mame/drivers/digel804.c create mode 100644 src/mame/drivers/dim68k.c create mode 100644 src/mame/drivers/dm7000.c create mode 100644 src/mame/drivers/dms5000.c create mode 100644 src/mame/drivers/dms86.c create mode 100644 src/mame/drivers/dmv.c create mode 100644 src/mame/drivers/dolphunk.c create mode 100644 src/mame/drivers/dps1.c create mode 100644 src/mame/drivers/dragon.c create mode 100644 src/mame/drivers/dsb46.c create mode 100644 src/mame/drivers/dual68.c create mode 100644 src/mame/drivers/dvk_kcgd.c create mode 100644 src/mame/drivers/dvk_ksm.c create mode 100644 src/mame/drivers/eacc.c create mode 100644 src/mame/drivers/ec184x.c create mode 100644 src/mame/drivers/ec65.c create mode 100644 src/mame/drivers/einstein.c create mode 100644 src/mame/drivers/elecbowl.c create mode 100644 src/mame/drivers/electron.c create mode 100644 src/mame/drivers/elekscmp.c create mode 100644 src/mame/drivers/elf.c create mode 100644 src/mame/drivers/elwro800.c create mode 100644 src/mame/drivers/enmirage.c create mode 100644 src/mame/drivers/ep64.c create mode 100644 src/mame/drivers/esq1.c create mode 100644 src/mame/drivers/esq5505.c create mode 100644 src/mame/drivers/esqasr.c create mode 100644 src/mame/drivers/esqkt.c create mode 100644 src/mame/drivers/esqmr.c create mode 100644 src/mame/drivers/et3400.c create mode 100644 src/mame/drivers/eti660.c create mode 100644 src/mame/drivers/europc.c create mode 100644 src/mame/drivers/evmbug.c create mode 100644 src/mame/drivers/excali64.c create mode 100644 src/mame/drivers/exelv.c create mode 100644 src/mame/drivers/exp85.c create mode 100644 src/mame/drivers/fanucs15.c create mode 100644 src/mame/drivers/fanucspmg.c create mode 100644 src/mame/drivers/fb01.c create mode 100644 src/mame/drivers/fc100.c create mode 100644 src/mame/drivers/fidelz80.c create mode 100644 src/mame/drivers/fk1.c create mode 100644 src/mame/drivers/fm7.c create mode 100644 src/mame/drivers/fmtowns.c create mode 100644 src/mame/drivers/force68k.c create mode 100644 src/mame/drivers/fp1100.c create mode 100644 src/mame/drivers/fp200.c create mode 100644 src/mame/drivers/fp6000.c create mode 100644 src/mame/drivers/ft68m.c create mode 100644 src/mame/drivers/galaxy.c create mode 100644 src/mame/drivers/galeb.c create mode 100644 src/mame/drivers/gamate.c create mode 100644 src/mame/drivers/gamecom.c create mode 100644 src/mame/drivers/gameking.c create mode 100644 src/mame/drivers/gamepock.c create mode 100644 src/mame/drivers/gb.c create mode 100644 src/mame/drivers/gba.c create mode 100644 src/mame/drivers/geneve.c create mode 100644 src/mame/drivers/geniusiq.c create mode 100644 src/mame/drivers/genpc.c create mode 100644 src/mame/drivers/gimix.c create mode 100644 src/mame/drivers/gizmondo.c create mode 100644 src/mame/drivers/glasgow.c create mode 100644 src/mame/drivers/gmaster.c create mode 100644 src/mame/drivers/gp2x.c create mode 100644 src/mame/drivers/gp32.c create mode 100644 src/mame/drivers/grfd2301.c create mode 100644 src/mame/drivers/h19.c create mode 100644 src/mame/drivers/h8.c create mode 100644 src/mame/drivers/h89.c create mode 100644 src/mame/drivers/harriet.c create mode 100644 src/mame/drivers/hec2hrp.c create mode 100644 src/mame/drivers/hh_cop400.c create mode 100644 src/mame/drivers/hh_hmcs40.c create mode 100644 src/mame/drivers/hh_melps4.c create mode 100644 src/mame/drivers/hh_pic16.c create mode 100644 src/mame/drivers/hh_sm510.c create mode 100644 src/mame/drivers/hh_tms1k.c create mode 100644 src/mame/drivers/hh_ucom4.c create mode 100644 src/mame/drivers/hk68v10.c create mode 100644 src/mame/drivers/homelab.c create mode 100644 src/mame/drivers/homez80.c create mode 100644 src/mame/drivers/horizon.c create mode 100644 src/mame/drivers/hp16500.c create mode 100644 src/mame/drivers/hp48.c create mode 100644 src/mame/drivers/hp49gp.c create mode 100644 src/mame/drivers/hp64k.c create mode 100644 src/mame/drivers/hp9845.c create mode 100644 src/mame/drivers/hp9k.c create mode 100644 src/mame/drivers/hp9k_3xx.c create mode 100644 src/mame/drivers/hp_ipc.c create mode 100644 src/mame/drivers/hprot1.c create mode 100644 src/mame/drivers/hpz80unk.c create mode 100644 src/mame/drivers/ht68k.c create mode 100644 src/mame/drivers/huebler.c create mode 100644 src/mame/drivers/hunter2.c create mode 100644 src/mame/drivers/hx20.c create mode 100644 src/mame/drivers/hyperscan.c create mode 100644 src/mame/drivers/i7000.c create mode 100644 src/mame/drivers/ibm6580.c create mode 100644 src/mame/drivers/ibmpc.c create mode 100644 src/mame/drivers/ibmpcjr.c create mode 100644 src/mame/drivers/icatel.c create mode 100644 src/mame/drivers/ie15.c create mode 100644 src/mame/drivers/if800.c create mode 100644 src/mame/drivers/imds.c create mode 100644 src/mame/drivers/imds2.c create mode 100644 src/mame/drivers/imsai.c create mode 100644 src/mame/drivers/indiana.c create mode 100644 src/mame/drivers/instruct.c create mode 100644 src/mame/drivers/interact.c create mode 100644 src/mame/drivers/intv.c create mode 100644 src/mame/drivers/ip20.c create mode 100644 src/mame/drivers/ip22.c create mode 100644 src/mame/drivers/ipc.c create mode 100644 src/mame/drivers/ipds.c create mode 100644 src/mame/drivers/iq151.c create mode 100644 src/mame/drivers/irisha.c create mode 100644 src/mame/drivers/isbc.c create mode 100644 src/mame/drivers/iskr103x.c create mode 100644 src/mame/drivers/itt3030.c create mode 100644 src/mame/drivers/jade.c create mode 100644 src/mame/drivers/jonos.c create mode 100644 src/mame/drivers/jr100.c create mode 100644 src/mame/drivers/jr200.c create mode 100644 src/mame/drivers/jtc.c create mode 100644 src/mame/drivers/juicebox.c create mode 100644 src/mame/drivers/junior.c create mode 100644 src/mame/drivers/jupace.c create mode 100644 src/mame/drivers/jupiter.c create mode 100644 src/mame/drivers/k1003.c create mode 100644 src/mame/drivers/k8915.c create mode 100644 src/mame/drivers/kaypro.c create mode 100644 src/mame/drivers/kc.c create mode 100644 src/mame/drivers/kim1.c create mode 100644 src/mame/drivers/konin.c create mode 100644 src/mame/drivers/korgm1.c create mode 100644 src/mame/drivers/kramermc.c create mode 100644 src/mame/drivers/kyocera.c create mode 100644 src/mame/drivers/laser3k.c create mode 100644 src/mame/drivers/lc80.c create mode 100644 src/mame/drivers/lcmate2.c create mode 100644 src/mame/drivers/leapster.c create mode 100644 src/mame/drivers/lft.c create mode 100644 src/mame/drivers/lg-dvd.c create mode 100644 src/mame/drivers/lisa.c create mode 100644 src/mame/drivers/llc.c create mode 100644 src/mame/drivers/lola8a.c create mode 100644 src/mame/drivers/lviv.c create mode 100644 src/mame/drivers/lynx.c create mode 100644 src/mame/drivers/m20.c create mode 100644 src/mame/drivers/m24.c create mode 100644 src/mame/drivers/m5.c create mode 100644 src/mame/drivers/m6805evs.c create mode 100644 src/mame/drivers/m79152pc.c create mode 100644 src/mame/drivers/mac.c create mode 100644 src/mame/drivers/macpci.c create mode 100644 src/mame/drivers/mbc200.c create mode 100644 src/mame/drivers/mbc55x.c create mode 100644 src/mame/drivers/mbdtower.c create mode 100644 src/mame/drivers/mbee.c create mode 100644 src/mame/drivers/mc10.c create mode 100644 src/mame/drivers/mc1000.c create mode 100644 src/mame/drivers/mc1502.c create mode 100644 src/mame/drivers/mc80.c create mode 100644 src/mame/drivers/mcb216.c create mode 100644 src/mame/drivers/mccpm.c create mode 100644 src/mame/drivers/megadriv.c create mode 100644 src/mame/drivers/mekd2.c create mode 100644 src/mame/drivers/mephisto.c create mode 100644 src/mame/drivers/mes.c create mode 100644 src/mame/drivers/mice.c create mode 100644 src/mame/drivers/microdec.c create mode 100644 src/mame/drivers/microkit.c create mode 100644 src/mame/drivers/micronic.c create mode 100644 src/mame/drivers/microtan.c create mode 100644 src/mame/drivers/microvsn.c create mode 100644 src/mame/drivers/mikro80.c create mode 100644 src/mame/drivers/mikromik.c create mode 100644 src/mame/drivers/mikrosha.c create mode 100644 src/mame/drivers/mini2440.c create mode 100644 src/mame/drivers/minicom.c create mode 100644 src/mame/drivers/mits680b.c create mode 100644 src/mame/drivers/mk1.c create mode 100644 src/mame/drivers/mk14.c create mode 100644 src/mame/drivers/mk2.c create mode 100644 src/mame/drivers/mk85.c create mode 100644 src/mame/drivers/mk90.c create mode 100644 src/mame/drivers/mkit09.c create mode 100644 src/mame/drivers/mmd1.c create mode 100644 src/mame/drivers/mmodular.c create mode 100644 src/mame/drivers/mod8.c create mode 100644 src/mame/drivers/modellot.c create mode 100644 src/mame/drivers/molecular.c create mode 100644 src/mame/drivers/monty.c create mode 100644 src/mame/drivers/mpf1.c create mode 100644 src/mame/drivers/mps1230.c create mode 100644 src/mame/drivers/mpz80.c create mode 100644 src/mame/drivers/ms0515.c create mode 100644 src/mame/drivers/ms9540.c create mode 100644 src/mame/drivers/msbc1.c create mode 100644 src/mame/drivers/mstation.c create mode 100644 src/mame/drivers/msx.c create mode 100644 src/mame/drivers/mt735.c create mode 100644 src/mame/drivers/mtx.c create mode 100644 src/mame/drivers/multi16.c create mode 100644 src/mame/drivers/multi8.c create mode 100644 src/mame/drivers/mvme350.c create mode 100644 src/mame/drivers/mx2178.c create mode 100644 src/mame/drivers/myb3k.c create mode 100644 src/mame/drivers/mycom.c create mode 100644 src/mame/drivers/myvision.c create mode 100644 src/mame/drivers/mz2000.c create mode 100644 src/mame/drivers/mz2500.c create mode 100644 src/mame/drivers/mz3500.c create mode 100644 src/mame/drivers/mz6500.c create mode 100644 src/mame/drivers/mz700.c create mode 100644 src/mame/drivers/mz80.c create mode 100644 src/mame/drivers/mzr8105.c create mode 100644 src/mame/drivers/n64.c create mode 100644 src/mame/drivers/nakajies.c create mode 100644 src/mame/drivers/nanos.c create mode 100644 src/mame/drivers/nascom1.c create mode 100644 src/mame/drivers/nc.c create mode 100644 src/mame/drivers/nes.c create mode 100644 src/mame/drivers/newbrain.c create mode 100644 src/mame/drivers/next.c create mode 100644 src/mame/drivers/ng_aes.c create mode 100644 src/mame/drivers/ngen.c create mode 100644 src/mame/drivers/ngp.c create mode 100644 src/mame/drivers/ob68k1a.c create mode 100644 src/mame/drivers/octopus.c create mode 100644 src/mame/drivers/odyssey2.c create mode 100644 src/mame/drivers/okean240.c create mode 100644 src/mame/drivers/ondra.c create mode 100644 src/mame/drivers/onyx.c create mode 100644 src/mame/drivers/orao.c create mode 100644 src/mame/drivers/oric.c create mode 100644 src/mame/drivers/orion.c create mode 100644 src/mame/drivers/osbexec.c create mode 100644 src/mame/drivers/osborne1.c create mode 100644 src/mame/drivers/osi.c create mode 100644 src/mame/drivers/p112.c create mode 100644 src/mame/drivers/p2000t.c create mode 100644 src/mame/drivers/p8k.c create mode 100644 src/mame/drivers/palm.c create mode 100644 src/mame/drivers/palm_dbg.inc create mode 100644 src/mame/drivers/palmz22.c create mode 100644 src/mame/drivers/partner.c create mode 100644 src/mame/drivers/paso1600.c create mode 100644 src/mame/drivers/pasogo.c create mode 100644 src/mame/drivers/pasopia.c create mode 100644 src/mame/drivers/pasopia7.c create mode 100644 src/mame/drivers/pb1000.c create mode 100644 src/mame/drivers/pc.c create mode 100644 src/mame/drivers/pc100.c create mode 100644 src/mame/drivers/pc1500.c create mode 100644 src/mame/drivers/pc1512.c create mode 100644 src/mame/drivers/pc2000.c create mode 100644 src/mame/drivers/pc4.c create mode 100644 src/mame/drivers/pc6001.c create mode 100644 src/mame/drivers/pc8001.c create mode 100644 src/mame/drivers/pc8401a.c create mode 100644 src/mame/drivers/pc8801.c create mode 100644 src/mame/drivers/pc88va.c create mode 100644 src/mame/drivers/pc9801.c create mode 100644 src/mame/drivers/pcd.c create mode 100644 src/mame/drivers/pce.c create mode 100644 src/mame/drivers/pce220.c create mode 100644 src/mame/drivers/pcfx.c create mode 100644 src/mame/drivers/pcm.c create mode 100644 src/mame/drivers/pcw.c create mode 100644 src/mame/drivers/pcw16.c create mode 100644 src/mame/drivers/pda600.c create mode 100644 src/mame/drivers/pdp1.c create mode 100644 src/mame/drivers/pdp11.c create mode 100644 src/mame/drivers/pecom.c create mode 100644 src/mame/drivers/pegasus.c create mode 100644 src/mame/drivers/pencil2.c create mode 100644 src/mame/drivers/pentagon.c create mode 100644 src/mame/drivers/peoplepc.c create mode 100644 src/mame/drivers/pes.c create mode 100644 src/mame/drivers/pet.c create mode 100644 src/mame/drivers/phc25.c create mode 100644 src/mame/drivers/phunsy.c create mode 100644 src/mame/drivers/pimps.c create mode 100644 src/mame/drivers/pipbug.c create mode 100644 src/mame/drivers/pitagjr.c create mode 100644 src/mame/drivers/pk8000.c create mode 100644 src/mame/drivers/pk8020.c create mode 100644 src/mame/drivers/plan80.c create mode 100644 src/mame/drivers/plus4.c create mode 100644 src/mame/drivers/pm68k.c create mode 100644 src/mame/drivers/pmd85.c create mode 100644 src/mame/drivers/pmi80.c create mode 100644 src/mame/drivers/pocketc.c create mode 100644 src/mame/drivers/pockstat.c create mode 100644 src/mame/drivers/poisk1.c create mode 100644 src/mame/drivers/pokemini.c create mode 100644 src/mame/drivers/poly.c create mode 100644 src/mame/drivers/poly88.c create mode 100644 src/mame/drivers/poly880.c create mode 100644 src/mame/drivers/portfoli.c create mode 100644 src/mame/drivers/pp01.c create mode 100644 src/mame/drivers/prestige.c create mode 100644 src/mame/drivers/primo.c create mode 100644 src/mame/drivers/pro80.c create mode 100644 src/mame/drivers/prof180x.c create mode 100644 src/mame/drivers/prof80.c create mode 100644 src/mame/drivers/psion.c create mode 100644 src/mame/drivers/psx.c create mode 100644 src/mame/drivers/pt68k4.c create mode 100644 src/mame/drivers/ptcsol.c create mode 100644 src/mame/drivers/pulsar.c create mode 100644 src/mame/drivers/pv1000.c create mode 100644 src/mame/drivers/pv2000.c create mode 100644 src/mame/drivers/pv9234.c create mode 100644 src/mame/drivers/pve500.c create mode 100644 src/mame/drivers/px4.c create mode 100644 src/mame/drivers/px8.c create mode 100644 src/mame/drivers/pyl601.c create mode 100644 src/mame/drivers/ql.c create mode 100644 src/mame/drivers/qtsbc.c create mode 100644 src/mame/drivers/qx10.c create mode 100644 src/mame/drivers/radio86.c create mode 100644 src/mame/drivers/rainbow.c create mode 100644 src/mame/drivers/rambo.c create mode 100644 src/mame/drivers/ravens.c create mode 100644 src/mame/drivers/rc759.c create mode 100644 src/mame/drivers/rd110.c create mode 100644 src/mame/drivers/replicator.c create mode 100644 src/mame/drivers/rex6000.c create mode 100644 src/mame/drivers/riscpc.c create mode 100644 src/mame/drivers/rm380z.c create mode 100644 src/mame/drivers/rmnimbus.c create mode 100644 src/mame/drivers/rmt32.c create mode 100644 src/mame/drivers/rsc55.c create mode 100644 src/mame/drivers/rt1715.c create mode 100644 src/mame/drivers/rvoice.c create mode 100644 src/mame/drivers/rx78.c create mode 100644 src/mame/drivers/sacstate.c create mode 100644 src/mame/drivers/sage2.c create mode 100644 src/mame/drivers/samcoupe.c create mode 100644 src/mame/drivers/sapi1.c create mode 100644 src/mame/drivers/saturn.c create mode 100644 src/mame/drivers/savia84.c create mode 100644 src/mame/drivers/sbc6510.c create mode 100644 src/mame/drivers/sbrain.c create mode 100644 src/mame/drivers/sc1.c create mode 100644 src/mame/drivers/sc2.c create mode 100644 src/mame/drivers/scorpion.c create mode 100644 src/mame/drivers/scv.c create mode 100644 src/mame/drivers/sdk80.c create mode 100644 src/mame/drivers/sdk85.c create mode 100644 src/mame/drivers/sdk86.c create mode 100644 src/mame/drivers/seattlecmp.c create mode 100644 src/mame/drivers/segapico.c create mode 100644 src/mame/drivers/segapm.c create mode 100644 src/mame/drivers/selz80.c create mode 100644 src/mame/drivers/sg1000.c create mode 100644 src/mame/drivers/sgi_ip2.c create mode 100644 src/mame/drivers/sgi_ip6.c create mode 100644 src/mame/drivers/sh4robot.c create mode 100644 src/mame/drivers/sitcom.c create mode 100644 src/mame/drivers/slc1.c create mode 100644 src/mame/drivers/slicer.c create mode 100644 src/mame/drivers/sm1800.c create mode 100644 src/mame/drivers/smc777.c create mode 100644 src/mame/drivers/sms.c create mode 100644 src/mame/drivers/snes.c create mode 100644 src/mame/drivers/socrates.c create mode 100644 src/mame/drivers/softbox.c create mode 100644 src/mame/drivers/sorcerer.c create mode 100644 src/mame/drivers/spc1000.c create mode 100644 src/mame/drivers/spec128.c create mode 100644 src/mame/drivers/special.c create mode 100644 src/mame/drivers/specpls3.c create mode 100644 src/mame/drivers/spectrum.c create mode 100644 src/mame/drivers/squale.c create mode 100644 src/mame/drivers/ssem.c create mode 100644 src/mame/drivers/ssystem3.c create mode 100644 src/mame/drivers/stratos.c create mode 100644 src/mame/drivers/studio2.c create mode 100644 src/mame/drivers/sun1.c create mode 100644 src/mame/drivers/sun2.c create mode 100644 src/mame/drivers/sun3.c create mode 100644 src/mame/drivers/sun4.c create mode 100644 src/mame/drivers/super6.c create mode 100644 src/mame/drivers/super80.c create mode 100644 src/mame/drivers/supercon.c create mode 100644 src/mame/drivers/superslave.c create mode 100644 src/mame/drivers/supracan.c create mode 100644 src/mame/drivers/sv8000.c create mode 100644 src/mame/drivers/svi318.c create mode 100644 src/mame/drivers/svision.c create mode 100644 src/mame/drivers/svmu.c create mode 100644 src/mame/drivers/swtpc.c create mode 100644 src/mame/drivers/swtpc09.c create mode 100644 src/mame/drivers/sym1.c create mode 100644 src/mame/drivers/sys2900.c create mode 100644 src/mame/drivers/systec.c create mode 100644 src/mame/drivers/tamag1.c create mode 100644 src/mame/drivers/tandy1t.c create mode 100644 src/mame/drivers/tandy2k.c create mode 100644 src/mame/drivers/tavernie.c create mode 100644 src/mame/drivers/tb303.c create mode 100644 src/mame/drivers/tdv2324.c create mode 100644 src/mame/drivers/tec1.c create mode 100644 src/mame/drivers/tecnbras.c create mode 100644 src/mame/drivers/tek405x.c create mode 100644 src/mame/drivers/tek410x.c create mode 100644 src/mame/drivers/terak.c create mode 100644 src/mame/drivers/test_t400.c create mode 100644 src/mame/drivers/thomson.c create mode 100644 src/mame/drivers/ti630.c create mode 100644 src/mame/drivers/ti74.c create mode 100644 src/mame/drivers/ti85.c create mode 100644 src/mame/drivers/ti89.c create mode 100644 src/mame/drivers/ti990_10.c create mode 100644 src/mame/drivers/ti990_4.c create mode 100644 src/mame/drivers/ti99_2.c create mode 100644 src/mame/drivers/ti99_4p.c create mode 100644 src/mame/drivers/ti99_4x.c create mode 100644 src/mame/drivers/ti99_8.c create mode 100644 src/mame/drivers/ticalc1x.c create mode 100644 src/mame/drivers/tiki100.c create mode 100644 src/mame/drivers/tim011.c create mode 100644 src/mame/drivers/tim100.c create mode 100644 src/mame/drivers/timex.c create mode 100644 src/mame/drivers/tispeak.c create mode 100644 src/mame/drivers/tk2000.c create mode 100644 src/mame/drivers/tk80.c create mode 100644 src/mame/drivers/tk80bs.c create mode 100644 src/mame/drivers/tm990189.c create mode 100644 src/mame/drivers/tmc1800.c create mode 100644 src/mame/drivers/tmc2000e.c create mode 100644 src/mame/drivers/tmc600.c create mode 100644 src/mame/drivers/tricep.c create mode 100644 src/mame/drivers/trs80.c create mode 100644 src/mame/drivers/trs80m2.c create mode 100644 src/mame/drivers/ts802.c create mode 100644 src/mame/drivers/ts803.c create mode 100644 src/mame/drivers/ts816.c create mode 100644 src/mame/drivers/tsispch.c create mode 100644 src/mame/drivers/tutor.c create mode 100644 src/mame/drivers/tv950.c create mode 100644 src/mame/drivers/tvc.c create mode 100644 src/mame/drivers/tvgame.c create mode 100644 src/mame/drivers/tx0.c create mode 100644 src/mame/drivers/uknc.c create mode 100644 src/mame/drivers/unior.c create mode 100644 src/mame/drivers/unistar.c create mode 100644 src/mame/drivers/univac.c create mode 100644 src/mame/drivers/unixpc.c create mode 100644 src/mame/drivers/ut88.c create mode 100644 src/mame/drivers/uzebox.c create mode 100644 src/mame/drivers/v1050.c create mode 100644 src/mame/drivers/v6809.c create mode 100644 src/mame/drivers/vax11.c create mode 100644 src/mame/drivers/vboy.c create mode 100644 src/mame/drivers/vc4000.c create mode 100644 src/mame/drivers/vcs80.c create mode 100644 src/mame/drivers/vector06.c create mode 100644 src/mame/drivers/vector4.c create mode 100644 src/mame/drivers/vg5k.c create mode 100644 src/mame/drivers/vic10.c create mode 100644 src/mame/drivers/vic20.c create mode 100644 src/mame/drivers/victor9k.c create mode 100644 src/mame/drivers/vidbrain.c create mode 100644 src/mame/drivers/vii.c create mode 100644 src/mame/drivers/vip.c create mode 100644 src/mame/drivers/vixen.c create mode 100644 src/mame/drivers/vk100.c create mode 100644 src/mame/drivers/votrpss.c create mode 100644 src/mame/drivers/votrtnt.c create mode 100644 src/mame/drivers/vt100.c create mode 100644 src/mame/drivers/vt220.c create mode 100644 src/mame/drivers/vt240.c create mode 100644 src/mame/drivers/vt320.c create mode 100644 src/mame/drivers/vt520.c create mode 100644 src/mame/drivers/vta2000.c create mode 100644 src/mame/drivers/vtech1.c create mode 100644 src/mame/drivers/vtech2.c create mode 100644 src/mame/drivers/wangpc.c create mode 100644 src/mame/drivers/wicat.c create mode 100644 src/mame/drivers/wildfire.c create mode 100644 src/mame/drivers/wswan.c create mode 100644 src/mame/drivers/x07.c create mode 100644 src/mame/drivers/x1.c create mode 100644 src/mame/drivers/x1twin.c create mode 100644 src/mame/drivers/x68k.c create mode 100644 src/mame/drivers/xavix.c create mode 100644 src/mame/drivers/xbox.c create mode 100644 src/mame/drivers/xerox820.c create mode 100644 src/mame/drivers/xor100.c create mode 100644 src/mame/drivers/ymmu100.c create mode 100644 src/mame/drivers/ymmu100.ppm create mode 100644 src/mame/drivers/z100.c create mode 100644 src/mame/drivers/z1013.c create mode 100644 src/mame/drivers/z80dev.c create mode 100644 src/mame/drivers/z80ne.c create mode 100644 src/mame/drivers/z88.c create mode 100644 src/mame/drivers/z9001.c create mode 100644 src/mame/drivers/zapcomputer.c create mode 100644 src/mame/drivers/zaurus.c create mode 100644 src/mame/drivers/zexall.c create mode 100644 src/mame/drivers/zorba.c create mode 100644 src/mame/drivers/zrt80.c create mode 100644 src/mame/drivers/zsbc3.c create mode 100644 src/mame/drivers/zx.c create mode 100644 src/mame/includes/abc1600.h create mode 100644 src/mame/includes/abc80.h create mode 100644 src/mame/includes/abc80x.h create mode 100644 src/mame/includes/ac1.h create mode 100644 src/mame/includes/adam.h create mode 100644 src/mame/includes/advision.h create mode 100644 src/mame/includes/aim65.h create mode 100644 src/mame/includes/alesis.h create mode 100644 src/mame/includes/amstrad.h create mode 100644 src/mame/includes/apollo.h create mode 100644 src/mame/includes/apple1.h create mode 100644 src/mame/includes/apple2.h create mode 100644 src/mame/includes/apple2gs.h create mode 100644 src/mame/includes/apple3.h create mode 100644 src/mame/includes/aquarius.h create mode 100644 src/mame/includes/arcadia.h create mode 100644 src/mame/includes/at.h create mode 100644 src/mame/includes/atarist.h create mode 100644 src/mame/includes/atom.h create mode 100644 src/mame/includes/aussiebyte.h create mode 100644 src/mame/includes/avigo.h create mode 100644 src/mame/includes/b2m.h create mode 100644 src/mame/includes/banctec.h create mode 100644 src/mame/includes/bbc.h create mode 100644 src/mame/includes/bebox.h create mode 100644 src/mame/includes/bk.h create mode 100644 src/mame/includes/bullet.h create mode 100644 src/mame/includes/busicom.h create mode 100644 src/mame/includes/bw12.h create mode 100644 src/mame/includes/bw2.h create mode 100644 src/mame/includes/c128.h create mode 100644 src/mame/includes/c64.h create mode 100644 src/mame/includes/c65.h create mode 100644 src/mame/includes/c80.h create mode 100644 src/mame/includes/cbm2.h create mode 100644 src/mame/includes/cgc7900.h create mode 100644 src/mame/includes/channelf.h create mode 100644 src/mame/includes/coco.h create mode 100644 src/mame/includes/coco12.h create mode 100644 src/mame/includes/coco3.h create mode 100644 src/mame/includes/coleco.h create mode 100644 src/mame/includes/compis.h create mode 100644 src/mame/includes/comquest.h create mode 100644 src/mame/includes/comx35.h create mode 100644 src/mame/includes/concept.h create mode 100644 src/mame/includes/cosmicos.h create mode 100644 src/mame/includes/crvision.h create mode 100644 src/mame/includes/cxhumax.h create mode 100644 src/mame/includes/cybiko.h create mode 100644 src/mame/includes/dai.h create mode 100644 src/mame/includes/dccons.h create mode 100644 src/mame/includes/dgn_beta.h create mode 100644 src/mame/includes/dgnalpha.h create mode 100644 src/mame/includes/dm7000.h create mode 100644 src/mame/includes/dragon.h create mode 100644 src/mame/includes/ec184x.h create mode 100644 src/mame/includes/einstein.h create mode 100644 src/mame/includes/electron.h create mode 100644 src/mame/includes/elf.h create mode 100644 src/mame/includes/ep64.h create mode 100644 src/mame/includes/eti660.h create mode 100644 src/mame/includes/exp85.h create mode 100644 src/mame/includes/fidelz80.h create mode 100644 src/mame/includes/fm7.h create mode 100644 src/mame/includes/fmtowns.h create mode 100644 src/mame/includes/galaxy.h create mode 100644 src/mame/includes/galeb.h create mode 100644 src/mame/includes/gamate.h create mode 100644 src/mame/includes/gamecom.h create mode 100644 src/mame/includes/gamepock.h create mode 100644 src/mame/includes/gb.h create mode 100644 src/mame/includes/gba.h create mode 100644 src/mame/includes/genpc.h create mode 100644 src/mame/includes/gp32.h create mode 100644 src/mame/includes/hec2hrp.h create mode 100644 src/mame/includes/hh_tms1k.h create mode 100644 src/mame/includes/hh_ucom4.h create mode 100644 src/mame/includes/hp48.h create mode 100644 src/mame/includes/huebler.h create mode 100644 src/mame/includes/hx20.h create mode 100644 src/mame/includes/imds2.h create mode 100644 src/mame/includes/intv.h create mode 100644 src/mame/includes/jupiter.h create mode 100644 src/mame/includes/kaypro.h create mode 100644 src/mame/includes/kc.h create mode 100644 src/mame/includes/kramermc.h create mode 100644 src/mame/includes/kyocera.h create mode 100644 src/mame/includes/lc80.h create mode 100644 src/mame/includes/lisa.h create mode 100644 src/mame/includes/llc.h create mode 100644 src/mame/includes/lviv.h create mode 100644 src/mame/includes/lynx.h create mode 100644 src/mame/includes/m5.h create mode 100644 src/mame/includes/mac.h create mode 100644 src/mame/includes/macpci.h create mode 100644 src/mame/includes/mbc55x.h create mode 100644 src/mame/includes/mbee.h create mode 100644 src/mame/includes/mboard.h create mode 100644 src/mame/includes/mc1000.h create mode 100644 src/mame/includes/mc1502.h create mode 100644 src/mame/includes/mc80.h create mode 100644 src/mame/includes/md_cons.h create mode 100644 src/mame/includes/micronic.h create mode 100644 src/mame/includes/microtan.h create mode 100644 src/mame/includes/mikro80.h create mode 100644 src/mame/includes/mikromik.h create mode 100644 src/mame/includes/mpf1.h create mode 100644 src/mame/includes/mpz80.h create mode 100644 src/mame/includes/msbc1.h create mode 100644 src/mame/includes/msx.h create mode 100644 src/mame/includes/mtx.h create mode 100644 src/mame/includes/mz700.h create mode 100644 src/mame/includes/mz80.h create mode 100644 src/mame/includes/nc.h create mode 100644 src/mame/includes/nes.h create mode 100644 src/mame/includes/newbrain.h create mode 100644 src/mame/includes/next.h create mode 100644 src/mame/includes/ob68k1a.h create mode 100644 src/mame/includes/ondra.h create mode 100644 src/mame/includes/orao.h create mode 100644 src/mame/includes/orion.h create mode 100644 src/mame/includes/osborne1.h create mode 100644 src/mame/includes/osi.h create mode 100644 src/mame/includes/p2000t.h create mode 100644 src/mame/includes/partner.h create mode 100644 src/mame/includes/pasopia.h create mode 100644 src/mame/includes/pc1251.h create mode 100644 src/mame/includes/pc1350.h create mode 100644 src/mame/includes/pc1401.h create mode 100644 src/mame/includes/pc1403.h create mode 100644 src/mame/includes/pc1512.h create mode 100644 src/mame/includes/pc4.h create mode 100644 src/mame/includes/pc8001.h create mode 100644 src/mame/includes/pc8401a.h create mode 100644 src/mame/includes/pce.h create mode 100644 src/mame/includes/pcw.h create mode 100644 src/mame/includes/pcw16.h create mode 100644 src/mame/includes/pdp1.h create mode 100644 src/mame/includes/pecom.h create mode 100644 src/mame/includes/pes.h create mode 100644 src/mame/includes/pet.h create mode 100644 src/mame/includes/phc25.h create mode 100644 src/mame/includes/pk8020.h create mode 100644 src/mame/includes/plus4.h create mode 100644 src/mame/includes/pmd85.h create mode 100644 src/mame/includes/pocketc.h create mode 100644 src/mame/includes/poisk1.h create mode 100644 src/mame/includes/poly88.h create mode 100644 src/mame/includes/poly880.h create mode 100644 src/mame/includes/portfoli.h create mode 100644 src/mame/includes/pp01.h create mode 100644 src/mame/includes/primo.h create mode 100644 src/mame/includes/prof180x.h create mode 100644 src/mame/includes/prof80.h create mode 100644 src/mame/includes/psion.h create mode 100644 src/mame/includes/px8.h create mode 100644 src/mame/includes/ql.h create mode 100644 src/mame/includes/radio86.h create mode 100644 src/mame/includes/rm380z.h create mode 100644 src/mame/includes/rmnimbus.h create mode 100644 src/mame/includes/sage2.h create mode 100644 src/mame/includes/samcoupe.h create mode 100644 src/mame/includes/sg1000.h create mode 100644 src/mame/includes/sms.h create mode 100644 src/mame/includes/softbox.h create mode 100644 src/mame/includes/sorcerer.h create mode 100644 src/mame/includes/special.h create mode 100644 src/mame/includes/spectrum.h create mode 100644 src/mame/includes/ssystem3.h create mode 100644 src/mame/includes/super6.h create mode 100644 src/mame/includes/super80.h create mode 100644 src/mame/includes/superslave.h create mode 100644 src/mame/includes/svi318.h create mode 100644 src/mame/includes/svision.h create mode 100644 src/mame/includes/swtpc09.h create mode 100644 src/mame/includes/tandy2k.h create mode 100644 src/mame/includes/tdv2324.h create mode 100644 src/mame/includes/tek405x.h create mode 100644 src/mame/includes/thomson.h create mode 100644 src/mame/includes/ti85.h create mode 100644 src/mame/includes/ti89.h create mode 100644 src/mame/includes/tiki100.h create mode 100644 src/mame/includes/tmc1800.h create mode 100644 src/mame/includes/tmc2000e.h create mode 100644 src/mame/includes/tmc600.h create mode 100644 src/mame/includes/trs80.h create mode 100644 src/mame/includes/trs80m2.h create mode 100644 src/mame/includes/tsispch.h create mode 100644 src/mame/includes/tx0.h create mode 100644 src/mame/includes/ut88.h create mode 100644 src/mame/includes/v1050.h create mode 100644 src/mame/includes/vc4000.h create mode 100644 src/mame/includes/vcs80.h create mode 100644 src/mame/includes/vector06.h create mode 100644 src/mame/includes/vic10.h create mode 100644 src/mame/includes/vic20.h create mode 100644 src/mame/includes/victor9k.h create mode 100644 src/mame/includes/vidbrain.h create mode 100644 src/mame/includes/vip.h create mode 100644 src/mame/includes/vixen.h create mode 100644 src/mame/includes/vtech2.h create mode 100644 src/mame/includes/wangpc.h create mode 100644 src/mame/includes/wswan.h create mode 100644 src/mame/includes/x07.h create mode 100644 src/mame/includes/x1.h create mode 100644 src/mame/includes/x68k.h create mode 100644 src/mame/includes/xerox820.h create mode 100644 src/mame/includes/xor100.h create mode 100644 src/mame/includes/z80ne.h create mode 100644 src/mame/includes/z88.h create mode 100644 src/mame/includes/zapcomputer.h create mode 100644 src/mame/includes/zx.h create mode 100644 src/mame/layout/4004clk.lay create mode 100644 src/mame/layout/abc1600.lay create mode 100644 src/mame/layout/acrnsys1.lay create mode 100644 src/mame/layout/aim65.lay create mode 100644 src/mame/layout/aim65_40.lay create mode 100644 src/mame/layout/amaztron.lay create mode 100644 src/mame/layout/amico2k.lay create mode 100644 src/mame/layout/amiga.lay create mode 100644 src/mame/layout/apollo.lay create mode 100644 src/mame/layout/apollo_15i.lay create mode 100644 src/mame/layout/apollo_dsp.lay create mode 100644 src/mame/layout/apricotp.lay create mode 100644 src/mame/layout/astro.lay create mode 100644 src/mame/layout/avigo.lay create mode 100644 src/mame/layout/babbage.lay create mode 100644 src/mame/layout/bankshot.lay create mode 100644 src/mame/layout/bbc.lay create mode 100644 src/mame/layout/beta.lay create mode 100644 src/mame/layout/bigtrak.lay create mode 100644 src/mame/layout/bitgrpha.lay create mode 100644 src/mame/layout/bitgrphb.lay create mode 100644 src/mame/layout/bob85.lay create mode 100644 src/mame/layout/borisdpl.lay create mode 100644 src/mame/layout/bridgec3.lay create mode 100644 src/mame/layout/c80.lay create mode 100644 src/mame/layout/cc40.lay create mode 100644 src/mame/layout/chessmst.lay create mode 100644 src/mame/layout/chesstrv.lay create mode 100644 src/mame/layout/cnsector.lay create mode 100644 src/mame/layout/coco3.lay create mode 100644 src/mame/layout/comp4.lay create mode 100644 src/mame/layout/cosmicos.lay create mode 100644 src/mame/layout/cp1.lay create mode 100644 src/mame/layout/cvicny.lay create mode 100644 src/mame/layout/dataman.lay create mode 100644 src/mame/layout/digel804.lay create mode 100644 src/mame/layout/dmv.lay create mode 100644 src/mame/layout/dolphunk.lay create mode 100644 src/mame/layout/eacc.lay create mode 100644 src/mame/layout/ebaskb2.lay create mode 100644 src/mame/layout/ebball.lay create mode 100644 src/mame/layout/ebball2.lay create mode 100644 src/mame/layout/ebball3.lay create mode 100644 src/mame/layout/efball.lay create mode 100644 src/mame/layout/efootb4.lay create mode 100644 src/mame/layout/einvader.lay create mode 100644 src/mame/layout/einvaderc.lay create mode 100644 src/mame/layout/elecbowl.lay create mode 100644 src/mame/layout/elecdet.lay create mode 100644 src/mame/layout/elekscmp.lay create mode 100644 src/mame/layout/elf2.lay create mode 100644 src/mame/layout/esq1by22.lay create mode 100644 src/mame/layout/esq2by40.lay create mode 100644 src/mame/layout/et3400.lay create mode 100644 src/mame/layout/fb01.lay create mode 100644 src/mame/layout/fccpu1.lay create mode 100644 src/mame/layout/fidelz80.lay create mode 100644 src/mame/layout/funjacks.lay create mode 100644 src/mame/layout/funrlgl.lay create mode 100644 src/mame/layout/gamecom.lay create mode 100644 src/mame/layout/gjackpot.lay create mode 100644 src/mame/layout/gl3000s.lay create mode 100644 src/mame/layout/glasgow.lay create mode 100644 src/mame/layout/gpoker.lay create mode 100644 src/mame/layout/h2hbaseb.lay create mode 100644 src/mame/layout/h2hfootb.lay create mode 100644 src/mame/layout/h8.lay create mode 100644 src/mame/layout/hh_hmcs40_test.lay create mode 100644 src/mame/layout/hh_melps4_test.lay create mode 100644 src/mame/layout/hh_sm510_test.lay create mode 100644 src/mame/layout/hh_tms1k_test.lay create mode 100644 src/mame/layout/hh_ucom4_test.lay create mode 100644 src/mame/layout/ie15.lay create mode 100644 src/mame/layout/instruct.lay create mode 100644 src/mame/layout/junior.lay create mode 100644 src/mame/layout/k1003.lay create mode 100644 src/mame/layout/kim1.lay create mode 100644 src/mame/layout/lantutor.lay create mode 100644 src/mame/layout/lc80.lay create mode 100644 src/mame/layout/lightfgt.lay create mode 100644 src/mame/layout/llc1.lay create mode 100644 src/mame/layout/lynx.lay create mode 100644 src/mame/layout/mac.lay create mode 100644 src/mame/layout/maniac.lay create mode 100644 src/mame/layout/mathmagi.lay create mode 100644 src/mame/layout/mbdtower.lay create mode 100644 src/mame/layout/megacd.lay create mode 100644 src/mame/layout/mekd2.lay create mode 100644 src/mame/layout/mephisto.lay create mode 100644 src/mame/layout/merlin.lay create mode 100644 src/mame/layout/minicom.lay create mode 100644 src/mame/layout/mirage.lay create mode 100644 src/mame/layout/mk1.lay create mode 100644 src/mame/layout/mk14.lay create mode 100644 src/mame/layout/mk2.lay create mode 100644 src/mame/layout/mkit09.lay create mode 100644 src/mame/layout/mmd1.lay create mode 100644 src/mame/layout/mmd2.lay create mode 100644 src/mame/layout/mmerlin.lay create mode 100644 src/mame/layout/mpf1.lay create mode 100644 src/mame/layout/mpf1b.lay create mode 100644 src/mame/layout/mpf1p.lay create mode 100644 src/mame/layout/mvbfree.lay create mode 100644 src/mame/layout/newbrain.lay create mode 100644 src/mame/layout/pairmtch.lay create mode 100644 src/mame/layout/pc1500.lay create mode 100644 src/mame/layout/pc8500.lay create mode 100644 src/mame/layout/pcw.lay create mode 100644 src/mame/layout/pmi80.lay create mode 100644 src/mame/layout/poly880.lay create mode 100644 src/mame/layout/pro80.lay create mode 100644 src/mame/layout/pve500.lay create mode 100644 src/mame/layout/px4.lay create mode 100644 src/mame/layout/px8.lay create mode 100644 src/mame/layout/rainbow.lay create mode 100644 src/mame/layout/ravens.lay create mode 100644 src/mame/layout/savia84.lay create mode 100644 src/mame/layout/sc1.lay create mode 100644 src/mame/layout/sc2.lay create mode 100644 src/mame/layout/sdk85.lay create mode 100644 src/mame/layout/sdk86.lay create mode 100644 src/mame/layout/selz80.lay create mode 100644 src/mame/layout/simon.lay create mode 100644 src/mame/layout/sitcom.lay create mode 100644 src/mame/layout/slc1.lay create mode 100644 src/mame/layout/sms1.lay create mode 100644 src/mame/layout/snmath.lay create mode 100644 src/mame/layout/snspell.lay create mode 100644 src/mame/layout/splitsec.lay create mode 100644 src/mame/layout/sr16.lay create mode 100644 src/mame/layout/ssimon.lay create mode 100644 src/mame/layout/starwbc.lay create mode 100644 src/mame/layout/stopthie.lay create mode 100644 src/mame/layout/super80.lay create mode 100644 src/mame/layout/svision.lay create mode 100644 src/mame/layout/svmu.lay create mode 100644 src/mame/layout/sym1.lay create mode 100644 src/mame/layout/tactix.lay create mode 100644 src/mame/layout/tama.lay create mode 100644 src/mame/layout/tandy12.lay create mode 100644 src/mame/layout/tavernie.lay create mode 100644 src/mame/layout/tb303.lay create mode 100644 src/mame/layout/tbreakup.lay create mode 100644 src/mame/layout/tc4.lay create mode 100644 src/mame/layout/tec1.lay create mode 100644 src/mame/layout/tecnbras.lay create mode 100644 src/mame/layout/ti1270.lay create mode 100644 src/mame/layout/ti30.lay create mode 100644 src/mame/layout/ti74.lay create mode 100644 src/mame/layout/ti95.lay create mode 100644 src/mame/layout/tisr16.lay create mode 100644 src/mame/layout/tk80.lay create mode 100644 src/mame/layout/tm990189.lay create mode 100644 src/mame/layout/tm990189v.lay create mode 100644 src/mame/layout/tntell.lay create mode 100644 src/mame/layout/unixpc.lay create mode 100644 src/mame/layout/ut88mini.lay create mode 100644 src/mame/layout/vboy.lay create mode 100644 src/mame/layout/vcs80.lay create mode 100644 src/mame/layout/vidbrain.lay create mode 100644 src/mame/layout/vk100.lay create mode 100644 src/mame/layout/votrpss.lay create mode 100644 src/mame/layout/votrtnt.lay create mode 100644 src/mame/layout/vsc.lay create mode 100644 src/mame/layout/vt100.lay create mode 100644 src/mame/layout/wicat.lay create mode 100644 src/mame/layout/wildfire.lay create mode 100644 src/mame/layout/wizatron.lay create mode 100644 src/mame/layout/wswan.lay create mode 100644 src/mame/layout/x68000.lay create mode 100644 src/mame/layout/z80dev.lay create mode 100644 src/mame/layout/z80ne.lay create mode 100644 src/mame/layout/z80net.lay create mode 100644 src/mame/layout/z80netb.lay create mode 100644 src/mame/layout/z80netf.lay create mode 100644 src/mame/layout/zapcomputer.lay create mode 100644 src/mame/machine/6883sam.c create mode 100644 src/mame/machine/6883sam.h create mode 100644 src/mame/machine/abc1600mac.c create mode 100644 src/mame/machine/abc1600mac.h create mode 100644 src/mame/machine/abc80kb.c create mode 100644 src/mame/machine/abc80kb.h create mode 100644 src/mame/machine/ac1.c create mode 100644 src/mame/machine/advision.c create mode 100644 src/mame/machine/aim65.c create mode 100644 src/mame/machine/amigakbd.c create mode 100644 src/mame/machine/amigakbd.h create mode 100644 src/mame/machine/amstrad.c create mode 100644 src/mame/machine/apollo.c create mode 100644 src/mame/machine/apollo_dbg.c create mode 100644 src/mame/machine/apollo_kbd.c create mode 100644 src/mame/machine/apollo_kbd.h create mode 100644 src/mame/machine/appldriv.c create mode 100644 src/mame/machine/appldriv.h create mode 100644 src/mame/machine/apple1.c create mode 100644 src/mame/machine/apple2.c create mode 100644 src/mame/machine/apple2gs.c create mode 100644 src/mame/machine/apple3.c create mode 100644 src/mame/machine/applefdc.c create mode 100644 src/mame/machine/applefdc.h create mode 100644 src/mame/machine/apricotkb.c create mode 100644 src/mame/machine/apricotkb.h create mode 100644 src/mame/machine/apricotkb_hle.c create mode 100644 src/mame/machine/apricotkb_hle.h create mode 100644 src/mame/machine/at.c create mode 100644 src/mame/machine/atarifdc.c create mode 100644 src/mame/machine/atarifdc.h create mode 100644 src/mame/machine/b2m.c create mode 100644 src/mame/machine/bbc.c create mode 100644 src/mame/machine/bebox.c create mode 100644 src/mame/machine/beta.c create mode 100644 src/mame/machine/beta.h create mode 100644 src/mame/machine/bk.c create mode 100644 src/mame/machine/c65_old.c create mode 100644 src/mame/machine/cbm_snqk.c create mode 100644 src/mame/machine/cbm_snqk.h create mode 100644 src/mame/machine/coco.c create mode 100644 src/mame/machine/coco12.c create mode 100644 src/mame/machine/coco3.c create mode 100644 src/mame/machine/coco_vhd.c create mode 100644 src/mame/machine/coco_vhd.h create mode 100644 src/mame/machine/coleco.c create mode 100644 src/mame/machine/coleco.h create mode 100644 src/mame/machine/compiskb.c create mode 100644 src/mame/machine/compiskb.h create mode 100644 src/mame/machine/concept.c create mode 100644 src/mame/machine/cuda.c create mode 100644 src/mame/machine/cuda.h create mode 100644 src/mame/machine/cx4data.inc create mode 100644 src/mame/machine/cx4fn.inc create mode 100644 src/mame/machine/cx4oam.inc create mode 100644 src/mame/machine/cx4ops.inc create mode 100644 src/mame/machine/cybiko.c create mode 100644 src/mame/machine/dai.c create mode 100644 src/mame/machine/dccons.c create mode 100644 src/mame/machine/dec_lk201.c create mode 100644 src/mame/machine/dec_lk201.h create mode 100644 src/mame/machine/dgn_beta.c create mode 100644 src/mame/machine/dgnalpha.c create mode 100644 src/mame/machine/dmv_keyb.c create mode 100644 src/mame/machine/dmv_keyb.h create mode 100644 src/mame/machine/docg3.c create mode 100644 src/mame/machine/docg3.h create mode 100644 src/mame/machine/dragon.c create mode 100644 src/mame/machine/egret.c create mode 100644 src/mame/machine/egret.h create mode 100644 src/mame/machine/einstein.c create mode 100644 src/mame/machine/electron.c create mode 100644 src/mame/machine/esqpanel.c create mode 100644 src/mame/machine/esqpanel.h create mode 100644 src/mame/machine/esqvfd.c create mode 100644 src/mame/machine/esqvfd.h create mode 100644 src/mame/machine/fm_scsi.c create mode 100644 src/mame/machine/fm_scsi.h create mode 100644 src/mame/machine/galaxy.c create mode 100644 src/mame/machine/gamecom.c create mode 100644 src/mame/machine/gamepock.c create mode 100644 src/mame/machine/gb.c create mode 100644 src/mame/machine/genpc.c create mode 100644 src/mame/machine/hec2hrp.c create mode 100644 src/mame/machine/hecdisk2.c create mode 100644 src/mame/machine/hp48.c create mode 100644 src/mame/machine/ie15_kbd.c create mode 100644 src/mame/machine/ie15_kbd.h create mode 100644 src/mame/machine/intv.c create mode 100644 src/mame/machine/isbc_215g.c create mode 100644 src/mame/machine/isbc_215g.h create mode 100644 src/mame/machine/k7659kb.c create mode 100644 src/mame/machine/k7659kb.h create mode 100644 src/mame/machine/kay_kbd.c create mode 100644 src/mame/machine/kaypro.c create mode 100644 src/mame/machine/kb_7007_3.h create mode 100644 src/mame/machine/kb_poisk1.h create mode 100644 src/mame/machine/kc.c create mode 100644 src/mame/machine/kc_keyb.c create mode 100644 src/mame/machine/kc_keyb.h create mode 100644 src/mame/machine/kramermc.c create mode 100644 src/mame/machine/lisa.c create mode 100644 src/mame/machine/llc.c create mode 100644 src/mame/machine/lviv.c create mode 100644 src/mame/machine/lynx.c create mode 100644 src/mame/machine/m20_8086.c create mode 100644 src/mame/machine/m20_8086.h create mode 100644 src/mame/machine/m20_kbd.c create mode 100644 src/mame/machine/m20_kbd.h create mode 100644 src/mame/machine/m24_kbd.c create mode 100644 src/mame/machine/m24_kbd.h create mode 100644 src/mame/machine/m24_z8000.c create mode 100644 src/mame/machine/m24_z8000.h create mode 100644 src/mame/machine/mac.c create mode 100644 src/mame/machine/macadb.c create mode 100644 src/mame/machine/mackbd.c create mode 100644 src/mame/machine/mackbd.h create mode 100644 src/mame/machine/macpci.c create mode 100644 src/mame/machine/macrtc.c create mode 100644 src/mame/machine/macrtc.h create mode 100644 src/mame/machine/mbc55x.c create mode 100644 src/mame/machine/mbee.c create mode 100644 src/mame/machine/mboard.c create mode 100644 src/mame/machine/mc80.c create mode 100644 src/mame/machine/mega32x.c create mode 100644 src/mame/machine/mega32x.h create mode 100644 src/mame/machine/megacd.c create mode 100644 src/mame/machine/megacd.h create mode 100644 src/mame/machine/megacdcd.c create mode 100644 src/mame/machine/megacdcd.h create mode 100644 src/mame/machine/microdrv.c create mode 100644 src/mame/machine/microdrv.h create mode 100644 src/mame/machine/micropolis.c create mode 100644 src/mame/machine/micropolis.h create mode 100644 src/mame/machine/microtan.c create mode 100644 src/mame/machine/mikro80.c create mode 100644 src/mame/machine/mm1kb.c create mode 100644 src/mame/machine/mm1kb.h create mode 100644 src/mame/machine/ms7004.c create mode 100644 src/mame/machine/ms7004.h create mode 100644 src/mame/machine/msx.c create mode 100644 src/mame/machine/msx_matsushita.c create mode 100644 src/mame/machine/msx_matsushita.h create mode 100644 src/mame/machine/msx_s1985.c create mode 100644 src/mame/machine/msx_s1985.h create mode 100644 src/mame/machine/msx_switched.c create mode 100644 src/mame/machine/msx_switched.h create mode 100644 src/mame/machine/msx_systemflags.c create mode 100644 src/mame/machine/msx_systemflags.h create mode 100644 src/mame/machine/mtx.c create mode 100644 src/mame/machine/mz700.c create mode 100644 src/mame/machine/mz80.c create mode 100644 src/mame/machine/nc.c create mode 100644 src/mame/machine/nes.c create mode 100644 src/mame/machine/nextkbd.c create mode 100644 src/mame/machine/nextkbd.h create mode 100644 src/mame/machine/nextmo.c create mode 100644 src/mame/machine/nextmo.h create mode 100644 src/mame/machine/ngen_kb.c create mode 100644 src/mame/machine/ngen_kb.h create mode 100644 src/mame/machine/ondra.c create mode 100644 src/mame/machine/orao.c create mode 100644 src/mame/machine/orion.c create mode 100644 src/mame/machine/osborne1.c create mode 100644 src/mame/machine/p2000t.c create mode 100644 src/mame/machine/partner.c create mode 100644 src/mame/machine/pc1251.c create mode 100644 src/mame/machine/pc1350.c create mode 100644 src/mame/machine/pc1401.c create mode 100644 src/mame/machine/pc1403.c create mode 100644 src/mame/machine/pc1512kb.c create mode 100644 src/mame/machine/pc1512kb.h create mode 100644 src/mame/machine/pc9801_118.c create mode 100644 src/mame/machine/pc9801_118.h create mode 100644 src/mame/machine/pc9801_26.c create mode 100644 src/mame/machine/pc9801_26.h create mode 100644 src/mame/machine/pc9801_86.c create mode 100644 src/mame/machine/pc9801_86.h create mode 100644 src/mame/machine/pc9801_cbus.c create mode 100644 src/mame/machine/pc9801_cbus.h create mode 100644 src/mame/machine/pc9801_kbd.c create mode 100644 src/mame/machine/pc9801_kbd.h create mode 100644 src/mame/machine/pcd_kbd.c create mode 100644 src/mame/machine/pcd_kbd.h create mode 100644 src/mame/machine/pce.c create mode 100644 src/mame/machine/pce220_ser.c create mode 100644 src/mame/machine/pce220_ser.h create mode 100644 src/mame/machine/pce_cd.c create mode 100644 src/mame/machine/pce_cd.h create mode 100644 src/mame/machine/pecom.c create mode 100644 src/mame/machine/pk8020.c create mode 100644 src/mame/machine/pmd85.c create mode 100644 src/mame/machine/poly88.c create mode 100644 src/mame/machine/pp01.c create mode 100644 src/mame/machine/primo.c create mode 100644 src/mame/machine/prof80mmu.c create mode 100644 src/mame/machine/prof80mmu.h create mode 100644 src/mame/machine/psion_pack.c create mode 100644 src/mame/machine/psion_pack.h create mode 100644 src/mame/machine/psxcd.c create mode 100644 src/mame/machine/psxcd.h create mode 100644 src/mame/machine/qimi.c create mode 100644 src/mame/machine/qimi.h create mode 100644 src/mame/machine/qx10kbd.c create mode 100644 src/mame/machine/qx10kbd.h create mode 100644 src/mame/machine/radio86.c create mode 100644 src/mame/machine/rm380z.c create mode 100644 src/mame/machine/rmnimbus.c create mode 100644 src/mame/machine/rmnkbd.c create mode 100644 src/mame/machine/rmnkbd.h create mode 100644 src/mame/machine/rx01.c create mode 100644 src/mame/machine/rx01.h create mode 100644 src/mame/machine/samcoupe.c create mode 100644 src/mame/machine/sgi.c create mode 100644 src/mame/machine/sgi.h create mode 100644 src/mame/machine/smartmed.c create mode 100644 src/mame/machine/smartmed.h create mode 100644 src/mame/machine/sms.c create mode 100644 src/mame/machine/snescx4.c create mode 100644 src/mame/machine/snescx4.h create mode 100644 src/mame/machine/sonydriv.c create mode 100644 src/mame/machine/sonydriv.h create mode 100644 src/mame/machine/sorcerer.c create mode 100644 src/mame/machine/spec_snqk.c create mode 100644 src/mame/machine/spec_snqk.h create mode 100644 src/mame/machine/special.c create mode 100644 src/mame/machine/super80.c create mode 100644 src/mame/machine/svi318.c create mode 100644 src/mame/machine/swim.c create mode 100644 src/mame/machine/swim.h create mode 100644 src/mame/machine/swtpc09.c create mode 100644 src/mame/machine/tandy2kb.c create mode 100644 src/mame/machine/tandy2kb.h create mode 100644 src/mame/machine/teleprinter.c create mode 100644 src/mame/machine/teleprinter.h create mode 100644 src/mame/machine/thomflop.c create mode 100644 src/mame/machine/thomflop.h create mode 100644 src/mame/machine/thomson.c create mode 100644 src/mame/machine/ti85.c create mode 100644 src/mame/machine/trs80.c create mode 100644 src/mame/machine/trs80m2kb.c create mode 100644 src/mame/machine/trs80m2kb.h create mode 100644 src/mame/machine/upd65031.c create mode 100644 src/mame/machine/upd65031.h create mode 100644 src/mame/machine/ut88.c create mode 100644 src/mame/machine/v1050kb.c create mode 100644 src/mame/machine/v1050kb.h create mode 100644 src/mame/machine/vector06.c create mode 100644 src/mame/machine/victor9k_fdc.c create mode 100644 src/mame/machine/victor9k_fdc.h create mode 100644 src/mame/machine/victor9kb.c create mode 100644 src/mame/machine/victor9kb.h create mode 100644 src/mame/machine/vtech2.c create mode 100644 src/mame/machine/wangpckb.c create mode 100644 src/mame/machine/wangpckb.h create mode 100644 src/mame/machine/wswan.c create mode 100644 src/mame/machine/x1.c create mode 100644 src/mame/machine/x68k_hdc.c create mode 100644 src/mame/machine/x68k_hdc.h create mode 100644 src/mame/machine/x68k_kbd.c create mode 100644 src/mame/machine/x68k_kbd.h create mode 100644 src/mame/machine/x820kb.c create mode 100644 src/mame/machine/x820kb.h create mode 100644 src/mame/machine/z80bin.c create mode 100644 src/mame/machine/z80bin.h create mode 100644 src/mame/machine/z80ne.c create mode 100644 src/mame/machine/zx.c create mode 100644 src/mame/machine/zx8302.c create mode 100644 src/mame/machine/zx8302.h delete mode 100644 src/mame/mame.mak create mode 100644 src/mame/tools/castool/main.c create mode 100644 src/mame/tools/floptool/main.c create mode 100644 src/mame/tools/imgtool/charconv.c create mode 100644 src/mame/tools/imgtool/charconv.h create mode 100644 src/mame/tools/imgtool/filtbas.c create mode 100644 src/mame/tools/imgtool/filteoln.c create mode 100644 src/mame/tools/imgtool/filter.c create mode 100644 src/mame/tools/imgtool/filter.h create mode 100644 src/mame/tools/imgtool/formats/coco_dsk.c create mode 100644 src/mame/tools/imgtool/formats/coco_dsk.h create mode 100644 src/mame/tools/imgtool/formats/vt_dsk.c create mode 100644 src/mame/tools/imgtool/formats/vt_dsk.h create mode 100644 src/mame/tools/imgtool/iflopimg.c create mode 100644 src/mame/tools/imgtool/iflopimg.h create mode 100644 src/mame/tools/imgtool/imghd.c create mode 100644 src/mame/tools/imgtool/imghd.h create mode 100644 src/mame/tools/imgtool/imgterrs.c create mode 100644 src/mame/tools/imgtool/imgterrs.h create mode 100644 src/mame/tools/imgtool/imgtool.c create mode 100644 src/mame/tools/imgtool/imgtool.h create mode 100644 src/mame/tools/imgtool/library.c create mode 100644 src/mame/tools/imgtool/library.h create mode 100644 src/mame/tools/imgtool/main.c create mode 100644 src/mame/tools/imgtool/main.h create mode 100644 src/mame/tools/imgtool/modules.c create mode 100644 src/mame/tools/imgtool/modules.h create mode 100644 src/mame/tools/imgtool/modules/amiga.c create mode 100644 src/mame/tools/imgtool/modules/bml3.c create mode 100644 src/mame/tools/imgtool/modules/concept.c create mode 100644 src/mame/tools/imgtool/modules/cybiko.c create mode 100644 src/mame/tools/imgtool/modules/cybikoxt.c create mode 100644 src/mame/tools/imgtool/modules/fat.c create mode 100644 src/mame/tools/imgtool/modules/fat.h create mode 100644 src/mame/tools/imgtool/modules/hp48.c create mode 100644 src/mame/tools/imgtool/modules/mac.c create mode 100644 src/mame/tools/imgtool/modules/macbin.c create mode 100644 src/mame/tools/imgtool/modules/macutil.c create mode 100644 src/mame/tools/imgtool/modules/macutil.h create mode 100644 src/mame/tools/imgtool/modules/os9.c create mode 100644 src/mame/tools/imgtool/modules/pc_flop.c create mode 100644 src/mame/tools/imgtool/modules/pc_hard.c create mode 100644 src/mame/tools/imgtool/modules/prodos.c create mode 100644 src/mame/tools/imgtool/modules/psion.c create mode 100644 src/mame/tools/imgtool/modules/rsdos.c create mode 100644 src/mame/tools/imgtool/modules/thomson.c create mode 100644 src/mame/tools/imgtool/modules/ti99.c create mode 100644 src/mame/tools/imgtool/modules/ti990hd.c create mode 100644 src/mame/tools/imgtool/modules/vzdos.c create mode 100644 src/mame/tools/imgtool/stream.c create mode 100644 src/mame/tools/imgtool/stream.h create mode 100644 src/mame/video/733_asr.c create mode 100644 src/mame/video/733_asr.h create mode 100644 src/mame/video/911_chr.h create mode 100644 src/mame/video/911_key.h create mode 100644 src/mame/video/911_vdt.c create mode 100644 src/mame/video/911_vdt.h create mode 100644 src/mame/video/abc1600.c create mode 100644 src/mame/video/abc1600.h create mode 100644 src/mame/video/abc80.c create mode 100644 src/mame/video/abc800.c create mode 100644 src/mame/video/abc802.c create mode 100644 src/mame/video/abc806.c create mode 100644 src/mame/video/ac1.c create mode 100644 src/mame/video/advision.c create mode 100644 src/mame/video/alesis.c create mode 100644 src/mame/video/apollo.c create mode 100644 src/mame/video/apple1.c create mode 100644 src/mame/video/apple2.c create mode 100644 src/mame/video/apple2.h create mode 100644 src/mame/video/apple2gs.c create mode 100644 src/mame/video/apple3.c create mode 100644 src/mame/video/aquarius.c create mode 100644 src/mame/video/arcadia.c create mode 100644 src/mame/video/atarist.c create mode 100644 src/mame/video/atarist.h create mode 100644 src/mame/video/aussiebyte.c create mode 100644 src/mame/video/avigo.c create mode 100644 src/mame/video/b2m.c create mode 100644 src/mame/video/bbc.c create mode 100644 src/mame/video/bk.c create mode 100644 src/mame/video/busicom.c create mode 100644 src/mame/video/cgc7900.c create mode 100644 src/mame/video/channelf.c create mode 100644 src/mame/video/comquest.c create mode 100644 src/mame/video/comx35.c create mode 100644 src/mame/video/crt.c create mode 100644 src/mame/video/crt.h create mode 100644 src/mame/video/dai.c create mode 100644 src/mame/video/dgn_beta.c create mode 100644 src/mame/video/electron.c create mode 100644 src/mame/video/fm7.c create mode 100644 src/mame/video/fmtowns.c create mode 100644 src/mame/video/galaxy.c create mode 100644 src/mame/video/galeb.c create mode 100644 src/mame/video/gamecom.c create mode 100644 src/mame/video/gb_lcd.c create mode 100644 src/mame/video/gb_lcd.h create mode 100644 src/mame/video/gba.c create mode 100644 src/mame/video/gime.c create mode 100644 src/mame/video/gime.h create mode 100644 src/mame/video/hec2video.c create mode 100644 src/mame/video/hp48.c create mode 100644 src/mame/video/intv.c create mode 100644 src/mame/video/k1ge.c create mode 100644 src/mame/video/k1ge.h create mode 100644 src/mame/video/kaypro.c create mode 100644 src/mame/video/kc.c create mode 100644 src/mame/video/kramermc.c create mode 100644 src/mame/video/kyocera.c create mode 100644 src/mame/video/llc.c create mode 100644 src/mame/video/lviv.c create mode 100644 src/mame/video/mac.c create mode 100644 src/mame/video/maria.c create mode 100644 src/mame/video/maria.h create mode 100644 src/mame/video/mbc55x.c create mode 100644 src/mame/video/mbee.c create mode 100644 src/mame/video/mc80.c create mode 100644 src/mame/video/microtan.c create mode 100644 src/mame/video/mikro80.c create mode 100644 src/mame/video/mikromik.c create mode 100644 src/mame/video/mz700.c create mode 100644 src/mame/video/mz80.c create mode 100644 src/mame/video/nc.c create mode 100644 src/mame/video/nes.c create mode 100644 src/mame/video/newbrain.c create mode 100644 src/mame/video/newport.c create mode 100644 src/mame/video/newport.h create mode 100644 src/mame/video/nick.c create mode 100644 src/mame/video/nick.h create mode 100644 src/mame/video/ondra.c create mode 100644 src/mame/video/orao.c create mode 100644 src/mame/video/orion.c create mode 100644 src/mame/video/osi.c create mode 100644 src/mame/video/p2000m.c create mode 100644 src/mame/video/pc1251.c create mode 100644 src/mame/video/pc1350.c create mode 100644 src/mame/video/pc1401.c create mode 100644 src/mame/video/pc1403.c create mode 100644 src/mame/video/pc1512.c create mode 100644 src/mame/video/pc4.c create mode 100644 src/mame/video/pc8401a.c create mode 100644 src/mame/video/pc_t1t.c create mode 100644 src/mame/video/pc_t1t.h create mode 100644 src/mame/video/pcd.c create mode 100644 src/mame/video/pcd.h create mode 100644 src/mame/video/pcw.c create mode 100644 src/mame/video/pcw16.c create mode 100644 src/mame/video/pdp1.c create mode 100644 src/mame/video/pecom.c create mode 100644 src/mame/video/pk8020.c create mode 100644 src/mame/video/pocketc.c create mode 100644 src/mame/video/poisk1.c create mode 100644 src/mame/video/poisk1.h create mode 100644 src/mame/video/poly88.c create mode 100644 src/mame/video/pp01.c create mode 100644 src/mame/video/primo.c create mode 100644 src/mame/video/rm380z.c create mode 100644 src/mame/video/rmnimbus.c create mode 100644 src/mame/video/samcoupe.c create mode 100644 src/mame/video/special.c create mode 100644 src/mame/video/spectrum.c create mode 100644 src/mame/video/ssystem3.c create mode 100644 src/mame/video/stic.c create mode 100644 src/mame/video/stic.h create mode 100644 src/mame/video/super80.c create mode 100644 src/mame/video/thomson.c create mode 100644 src/mame/video/ti85.c create mode 100644 src/mame/video/timex.c create mode 100644 src/mame/video/tmc1800.c create mode 100644 src/mame/video/tmc600.c create mode 100644 src/mame/video/trs80.c create mode 100644 src/mame/video/tx0.c create mode 100644 src/mame/video/ut88.c create mode 100644 src/mame/video/uv201.c create mode 100644 src/mame/video/uv201.h create mode 100644 src/mame/video/v1050.c create mode 100644 src/mame/video/vc4000.c create mode 100644 src/mame/video/vector06.c create mode 100644 src/mame/video/vtech2.c create mode 100644 src/mame/video/vtvideo.c create mode 100644 src/mame/video/vtvideo.h create mode 100644 src/mame/video/wswan_video.c create mode 100644 src/mame/video/wswan_video.h create mode 100644 src/mame/video/x68k.c create mode 100644 src/mame/video/z88.c create mode 100644 src/mame/video/zx.c create mode 100644 src/mame/video/zx8301.c create mode 100644 src/mame/video/zx8301.h delete mode 100644 src/mess/audio/alesis.c delete mode 100644 src/mess/audio/arcadia.c delete mode 100644 src/mess/audio/arcadia.h delete mode 100644 src/mess/audio/channelf.c delete mode 100644 src/mess/audio/channelf.h delete mode 100644 src/mess/audio/dai_snd.c delete mode 100644 src/mess/audio/dai_snd.h delete mode 100644 src/mess/audio/dave.c delete mode 100644 src/mess/audio/dave.h delete mode 100644 src/mess/audio/gamate.c delete mode 100644 src/mess/audio/gb.c delete mode 100644 src/mess/audio/gb.h delete mode 100644 src/mess/audio/lynx.c delete mode 100644 src/mess/audio/lynx.h delete mode 100644 src/mess/audio/mac.c delete mode 100644 src/mess/audio/mea8000.c delete mode 100644 src/mess/audio/mea8000.h delete mode 100644 src/mess/audio/socrates.c delete mode 100644 src/mess/audio/socrates.h delete mode 100644 src/mess/audio/specimx_snd.c delete mode 100644 src/mess/audio/specimx_snd.h delete mode 100644 src/mess/audio/svis_snd.c delete mode 100644 src/mess/audio/svis_snd.h delete mode 100644 src/mess/audio/tvc_snd.c delete mode 100644 src/mess/audio/tvc_snd.h delete mode 100644 src/mess/audio/upd1771.c delete mode 100644 src/mess/audio/upd1771.h delete mode 100644 src/mess/audio/vboy.c delete mode 100644 src/mess/audio/vboy.h delete mode 100644 src/mess/audio/vc4000snd.c delete mode 100644 src/mess/audio/vc4000snd.h delete mode 100644 src/mess/audio/wswan_snd.c delete mode 100644 src/mess/audio/wswan_snd.h delete mode 100644 src/mess/drivers/4004clk.c delete mode 100644 src/mess/drivers/68ksbc.c delete mode 100644 src/mess/drivers/a2600.c delete mode 100644 src/mess/drivers/a310.c delete mode 100644 src/mess/drivers/a5105.c delete mode 100644 src/mess/drivers/a51xx.c delete mode 100644 src/mess/drivers/a6809.c delete mode 100644 src/mess/drivers/a7150.c delete mode 100644 src/mess/drivers/a7800.c delete mode 100644 src/mess/drivers/abc1600.c delete mode 100644 src/mess/drivers/abc80.c delete mode 100644 src/mess/drivers/abc80x.c delete mode 100644 src/mess/drivers/ac1.c delete mode 100644 src/mess/drivers/acrnsys1.c delete mode 100644 src/mess/drivers/adam.c delete mode 100644 src/mess/drivers/advision.c delete mode 100644 src/mess/drivers/aim65.c delete mode 100644 src/mess/drivers/aim65_40.c delete mode 100644 src/mess/drivers/alesis.c delete mode 100644 src/mess/drivers/alphasma.c delete mode 100644 src/mess/drivers/alphatro.c delete mode 100644 src/mess/drivers/altair.c delete mode 100644 src/mess/drivers/alto2.c delete mode 100644 src/mess/drivers/altos5.c delete mode 100644 src/mess/drivers/amico2k.c delete mode 100644 src/mess/drivers/amiga.c delete mode 100644 src/mess/drivers/ampro.c delete mode 100644 src/mess/drivers/amstr_pc.c delete mode 100644 src/mess/drivers/amstrad.c delete mode 100644 src/mess/drivers/amust.c delete mode 100644 src/mess/drivers/apc.c delete mode 100644 src/mess/drivers/apexc.c delete mode 100644 src/mess/drivers/apf.c delete mode 100644 src/mess/drivers/apogee.c delete mode 100644 src/mess/drivers/apollo.c delete mode 100644 src/mess/drivers/apple1.c delete mode 100644 src/mess/drivers/apple2.c delete mode 100644 src/mess/drivers/apple2e.c delete mode 100644 src/mess/drivers/apple2gs.c delete mode 100644 src/mess/drivers/apple3.c delete mode 100644 src/mess/drivers/applix.c delete mode 100644 src/mess/drivers/apricot.c delete mode 100644 src/mess/drivers/apricotf.c delete mode 100644 src/mess/drivers/apricotp.c delete mode 100644 src/mess/drivers/aquarius.c delete mode 100644 src/mess/drivers/arcadia.c delete mode 100644 src/mess/drivers/argo.c delete mode 100644 src/mess/drivers/asst128.c delete mode 100644 src/mess/drivers/astrohome.c delete mode 100644 src/mess/drivers/at.c delete mode 100644 src/mess/drivers/atari400.c delete mode 100644 src/mess/drivers/atarist.c delete mode 100644 src/mess/drivers/atm.c delete mode 100644 src/mess/drivers/atom.c delete mode 100644 src/mess/drivers/attache.c delete mode 100644 src/mess/drivers/aussiebyte.c delete mode 100644 src/mess/drivers/avigo.c delete mode 100644 src/mess/drivers/ax20.c delete mode 100644 src/mess/drivers/b16.c delete mode 100644 src/mess/drivers/b2m.c delete mode 100644 src/mess/drivers/babbage.c delete mode 100644 src/mess/drivers/banctec.c delete mode 100644 src/mess/drivers/basic52.c delete mode 100644 src/mess/drivers/bbc.c delete mode 100644 src/mess/drivers/bbcbc.c delete mode 100644 src/mess/drivers/bcs3.c delete mode 100644 src/mess/drivers/bebox.c delete mode 100644 src/mess/drivers/beehive.c delete mode 100644 src/mess/drivers/besta.c delete mode 100644 src/mess/drivers/beta.c delete mode 100644 src/mess/drivers/bigbord2.c delete mode 100644 src/mess/drivers/binbug.c delete mode 100644 src/mess/drivers/bitgraph.c delete mode 100644 src/mess/drivers/bk.c delete mode 100644 src/mess/drivers/bmjr.c delete mode 100644 src/mess/drivers/bml3.c delete mode 100644 src/mess/drivers/bob85.c delete mode 100644 src/mess/drivers/br8641.c delete mode 100644 src/mess/drivers/bullet.c delete mode 100644 src/mess/drivers/busicom.c delete mode 100644 src/mess/drivers/bw12.c delete mode 100644 src/mess/drivers/bw2.c delete mode 100644 src/mess/drivers/c10.c delete mode 100644 src/mess/drivers/c128.c delete mode 100644 src/mess/drivers/c64.c delete mode 100644 src/mess/drivers/c64dtv.c delete mode 100644 src/mess/drivers/c65.c delete mode 100644 src/mess/drivers/c65_old.c delete mode 100644 src/mess/drivers/c80.c delete mode 100644 src/mess/drivers/c900.c delete mode 100644 src/mess/drivers/camplynx.c delete mode 100644 src/mess/drivers/canon_s80.c delete mode 100644 src/mess/drivers/casloopy.c delete mode 100644 src/mess/drivers/cat.c delete mode 100644 src/mess/drivers/cbm2.c delete mode 100644 src/mess/drivers/cc40.c delete mode 100644 src/mess/drivers/ccs2810.c delete mode 100644 src/mess/drivers/ccs300.c delete mode 100644 src/mess/drivers/cd2650.c delete mode 100644 src/mess/drivers/cdc721.c delete mode 100644 src/mess/drivers/cfx9850.c delete mode 100644 src/mess/drivers/cgc7900.c delete mode 100644 src/mess/drivers/cgenie.c delete mode 100644 src/mess/drivers/channelf.c delete mode 100644 src/mess/drivers/chaos.c delete mode 100644 src/mess/drivers/chessmst.c delete mode 100644 src/mess/drivers/chesstrv.c delete mode 100644 src/mess/drivers/clcd.c delete mode 100644 src/mess/drivers/cm1800.c delete mode 100644 src/mess/drivers/coco12.c delete mode 100644 src/mess/drivers/coco3.c delete mode 100644 src/mess/drivers/codata.c delete mode 100644 src/mess/drivers/coleco.c delete mode 100644 src/mess/drivers/compis.c delete mode 100644 src/mess/drivers/compucolor.c delete mode 100644 src/mess/drivers/comquest.c delete mode 100644 src/mess/drivers/comx35.c delete mode 100644 src/mess/drivers/concept.c delete mode 100644 src/mess/drivers/cortex.c delete mode 100644 src/mess/drivers/cosmicos.c delete mode 100644 src/mess/drivers/cp1.c delete mode 100644 src/mess/drivers/craft.c delete mode 100644 src/mess/drivers/crvision.c delete mode 100644 src/mess/drivers/csc.c delete mode 100644 src/mess/drivers/ct486.c delete mode 100644 src/mess/drivers/cvicny.c delete mode 100644 src/mess/drivers/cxhumax.c delete mode 100644 src/mess/drivers/cybiko.c delete mode 100644 src/mess/drivers/czk80.c delete mode 100644 src/mess/drivers/d6800.c delete mode 100644 src/mess/drivers/d6809.c delete mode 100644 src/mess/drivers/dai.c delete mode 100644 src/mess/drivers/daruma.c delete mode 100644 src/mess/drivers/dccons.c delete mode 100644 src/mess/drivers/dct11em.c delete mode 100644 src/mess/drivers/dectalk.c delete mode 100644 src/mess/drivers/decwritr.c delete mode 100644 src/mess/drivers/dgn_beta.c delete mode 100644 src/mess/drivers/digel804.c delete mode 100644 src/mess/drivers/dim68k.c delete mode 100644 src/mess/drivers/dm7000.c delete mode 100644 src/mess/drivers/dms5000.c delete mode 100644 src/mess/drivers/dms86.c delete mode 100644 src/mess/drivers/dmv.c delete mode 100644 src/mess/drivers/dolphunk.c delete mode 100644 src/mess/drivers/dps1.c delete mode 100644 src/mess/drivers/dragon.c delete mode 100644 src/mess/drivers/dsb46.c delete mode 100644 src/mess/drivers/dual68.c delete mode 100644 src/mess/drivers/dvk_kcgd.c delete mode 100644 src/mess/drivers/dvk_ksm.c delete mode 100644 src/mess/drivers/eacc.c delete mode 100644 src/mess/drivers/ec184x.c delete mode 100644 src/mess/drivers/ec65.c delete mode 100644 src/mess/drivers/einstein.c delete mode 100644 src/mess/drivers/elecbowl.c delete mode 100644 src/mess/drivers/electron.c delete mode 100644 src/mess/drivers/elekscmp.c delete mode 100644 src/mess/drivers/elf.c delete mode 100644 src/mess/drivers/elwro800.c delete mode 100644 src/mess/drivers/enmirage.c delete mode 100644 src/mess/drivers/ep64.c delete mode 100644 src/mess/drivers/esq1.c delete mode 100644 src/mess/drivers/esq5505.c delete mode 100644 src/mess/drivers/esqasr.c delete mode 100644 src/mess/drivers/esqkt.c delete mode 100644 src/mess/drivers/esqmr.c delete mode 100644 src/mess/drivers/et3400.c delete mode 100644 src/mess/drivers/eti660.c delete mode 100644 src/mess/drivers/europc.c delete mode 100644 src/mess/drivers/evmbug.c delete mode 100644 src/mess/drivers/excali64.c delete mode 100644 src/mess/drivers/exelv.c delete mode 100644 src/mess/drivers/exp85.c delete mode 100644 src/mess/drivers/fanucs15.c delete mode 100644 src/mess/drivers/fanucspmg.c delete mode 100644 src/mess/drivers/fb01.c delete mode 100644 src/mess/drivers/fc100.c delete mode 100644 src/mess/drivers/fidelz80.c delete mode 100644 src/mess/drivers/fk1.c delete mode 100644 src/mess/drivers/fm7.c delete mode 100644 src/mess/drivers/fmtowns.c delete mode 100644 src/mess/drivers/force68k.c delete mode 100644 src/mess/drivers/fp1100.c delete mode 100644 src/mess/drivers/fp200.c delete mode 100644 src/mess/drivers/fp6000.c delete mode 100644 src/mess/drivers/ft68m.c delete mode 100644 src/mess/drivers/galaxy.c delete mode 100644 src/mess/drivers/galeb.c delete mode 100644 src/mess/drivers/gamate.c delete mode 100644 src/mess/drivers/gamecom.c delete mode 100644 src/mess/drivers/gameking.c delete mode 100644 src/mess/drivers/gamepock.c delete mode 100644 src/mess/drivers/gb.c delete mode 100644 src/mess/drivers/gba.c delete mode 100644 src/mess/drivers/geneve.c delete mode 100644 src/mess/drivers/geniusiq.c delete mode 100644 src/mess/drivers/genpc.c delete mode 100644 src/mess/drivers/gimix.c delete mode 100644 src/mess/drivers/gizmondo.c delete mode 100644 src/mess/drivers/glasgow.c delete mode 100644 src/mess/drivers/gmaster.c delete mode 100644 src/mess/drivers/gp2x.c delete mode 100644 src/mess/drivers/gp32.c delete mode 100644 src/mess/drivers/grfd2301.c delete mode 100644 src/mess/drivers/h19.c delete mode 100644 src/mess/drivers/h8.c delete mode 100644 src/mess/drivers/h89.c delete mode 100644 src/mess/drivers/harriet.c delete mode 100644 src/mess/drivers/hec2hrp.c delete mode 100644 src/mess/drivers/hh_cop400.c delete mode 100644 src/mess/drivers/hh_hmcs40.c delete mode 100644 src/mess/drivers/hh_melps4.c delete mode 100644 src/mess/drivers/hh_pic16.c delete mode 100644 src/mess/drivers/hh_sm510.c delete mode 100644 src/mess/drivers/hh_tms1k.c delete mode 100644 src/mess/drivers/hh_ucom4.c delete mode 100644 src/mess/drivers/hk68v10.c delete mode 100644 src/mess/drivers/homelab.c delete mode 100644 src/mess/drivers/homez80.c delete mode 100644 src/mess/drivers/horizon.c delete mode 100644 src/mess/drivers/hp16500.c delete mode 100644 src/mess/drivers/hp48.c delete mode 100644 src/mess/drivers/hp49gp.c delete mode 100644 src/mess/drivers/hp64k.c delete mode 100644 src/mess/drivers/hp9845.c delete mode 100644 src/mess/drivers/hp9k.c delete mode 100644 src/mess/drivers/hp9k_3xx.c delete mode 100644 src/mess/drivers/hp_ipc.c delete mode 100644 src/mess/drivers/hprot1.c delete mode 100644 src/mess/drivers/hpz80unk.c delete mode 100644 src/mess/drivers/ht68k.c delete mode 100644 src/mess/drivers/huebler.c delete mode 100644 src/mess/drivers/hunter2.c delete mode 100644 src/mess/drivers/hx20.c delete mode 100644 src/mess/drivers/hyperscan.c delete mode 100644 src/mess/drivers/i7000.c delete mode 100644 src/mess/drivers/ibm6580.c delete mode 100644 src/mess/drivers/ibmpc.c delete mode 100644 src/mess/drivers/ibmpcjr.c delete mode 100644 src/mess/drivers/icatel.c delete mode 100644 src/mess/drivers/ie15.c delete mode 100644 src/mess/drivers/if800.c delete mode 100644 src/mess/drivers/imds.c delete mode 100644 src/mess/drivers/imds2.c delete mode 100644 src/mess/drivers/imsai.c delete mode 100644 src/mess/drivers/indiana.c delete mode 100644 src/mess/drivers/instruct.c delete mode 100644 src/mess/drivers/interact.c delete mode 100644 src/mess/drivers/intv.c delete mode 100644 src/mess/drivers/ip20.c delete mode 100644 src/mess/drivers/ip22.c delete mode 100644 src/mess/drivers/ipc.c delete mode 100644 src/mess/drivers/ipds.c delete mode 100644 src/mess/drivers/iq151.c delete mode 100644 src/mess/drivers/irisha.c delete mode 100644 src/mess/drivers/isbc.c delete mode 100644 src/mess/drivers/iskr103x.c delete mode 100644 src/mess/drivers/itt3030.c delete mode 100644 src/mess/drivers/jade.c delete mode 100644 src/mess/drivers/jonos.c delete mode 100644 src/mess/drivers/jr100.c delete mode 100644 src/mess/drivers/jr200.c delete mode 100644 src/mess/drivers/jtc.c delete mode 100644 src/mess/drivers/juicebox.c delete mode 100644 src/mess/drivers/junior.c delete mode 100644 src/mess/drivers/jupace.c delete mode 100644 src/mess/drivers/jupiter.c delete mode 100644 src/mess/drivers/k1003.c delete mode 100644 src/mess/drivers/k8915.c delete mode 100644 src/mess/drivers/kaypro.c delete mode 100644 src/mess/drivers/kc.c delete mode 100644 src/mess/drivers/kim1.c delete mode 100644 src/mess/drivers/konin.c delete mode 100644 src/mess/drivers/korgm1.c delete mode 100644 src/mess/drivers/kramermc.c delete mode 100644 src/mess/drivers/kyocera.c delete mode 100644 src/mess/drivers/laser3k.c delete mode 100644 src/mess/drivers/lc80.c delete mode 100644 src/mess/drivers/lcmate2.c delete mode 100644 src/mess/drivers/leapster.c delete mode 100644 src/mess/drivers/lft.c delete mode 100644 src/mess/drivers/lg-dvd.c delete mode 100644 src/mess/drivers/lisa.c delete mode 100644 src/mess/drivers/llc.c delete mode 100644 src/mess/drivers/lola8a.c delete mode 100644 src/mess/drivers/lviv.c delete mode 100644 src/mess/drivers/lynx.c delete mode 100644 src/mess/drivers/m20.c delete mode 100644 src/mess/drivers/m24.c delete mode 100644 src/mess/drivers/m5.c delete mode 100644 src/mess/drivers/m6805evs.c delete mode 100644 src/mess/drivers/m79152pc.c delete mode 100644 src/mess/drivers/mac.c delete mode 100644 src/mess/drivers/macpci.c delete mode 100644 src/mess/drivers/mbc200.c delete mode 100644 src/mess/drivers/mbc55x.c delete mode 100644 src/mess/drivers/mbdtower.c delete mode 100644 src/mess/drivers/mbee.c delete mode 100644 src/mess/drivers/mc10.c delete mode 100644 src/mess/drivers/mc1000.c delete mode 100644 src/mess/drivers/mc1502.c delete mode 100644 src/mess/drivers/mc80.c delete mode 100644 src/mess/drivers/mcb216.c delete mode 100644 src/mess/drivers/mccpm.c delete mode 100644 src/mess/drivers/megadriv.c delete mode 100644 src/mess/drivers/mekd2.c delete mode 100644 src/mess/drivers/mephisto.c delete mode 100644 src/mess/drivers/mes.c delete mode 100644 src/mess/drivers/mice.c delete mode 100644 src/mess/drivers/microdec.c delete mode 100644 src/mess/drivers/microkit.c delete mode 100644 src/mess/drivers/micronic.c delete mode 100644 src/mess/drivers/microtan.c delete mode 100644 src/mess/drivers/microvsn.c delete mode 100644 src/mess/drivers/mikro80.c delete mode 100644 src/mess/drivers/mikromik.c delete mode 100644 src/mess/drivers/mikrosha.c delete mode 100644 src/mess/drivers/mini2440.c delete mode 100644 src/mess/drivers/minicom.c delete mode 100644 src/mess/drivers/mits680b.c delete mode 100644 src/mess/drivers/mk1.c delete mode 100644 src/mess/drivers/mk14.c delete mode 100644 src/mess/drivers/mk2.c delete mode 100644 src/mess/drivers/mk85.c delete mode 100644 src/mess/drivers/mk90.c delete mode 100644 src/mess/drivers/mkit09.c delete mode 100644 src/mess/drivers/mmd1.c delete mode 100644 src/mess/drivers/mmodular.c delete mode 100644 src/mess/drivers/mod8.c delete mode 100644 src/mess/drivers/modellot.c delete mode 100644 src/mess/drivers/molecular.c delete mode 100644 src/mess/drivers/monty.c delete mode 100644 src/mess/drivers/mpf1.c delete mode 100644 src/mess/drivers/mps1230.c delete mode 100644 src/mess/drivers/mpz80.c delete mode 100644 src/mess/drivers/ms0515.c delete mode 100644 src/mess/drivers/ms9540.c delete mode 100644 src/mess/drivers/msbc1.c delete mode 100644 src/mess/drivers/mstation.c delete mode 100644 src/mess/drivers/msx.c delete mode 100644 src/mess/drivers/mt735.c delete mode 100644 src/mess/drivers/mtx.c delete mode 100644 src/mess/drivers/multi16.c delete mode 100644 src/mess/drivers/multi8.c delete mode 100644 src/mess/drivers/mvme350.c delete mode 100644 src/mess/drivers/mx2178.c delete mode 100644 src/mess/drivers/myb3k.c delete mode 100644 src/mess/drivers/mycom.c delete mode 100644 src/mess/drivers/myvision.c delete mode 100644 src/mess/drivers/mz2000.c delete mode 100644 src/mess/drivers/mz2500.c delete mode 100644 src/mess/drivers/mz3500.c delete mode 100644 src/mess/drivers/mz6500.c delete mode 100644 src/mess/drivers/mz700.c delete mode 100644 src/mess/drivers/mz80.c delete mode 100644 src/mess/drivers/mzr8105.c delete mode 100644 src/mess/drivers/n64.c delete mode 100644 src/mess/drivers/nakajies.c delete mode 100644 src/mess/drivers/nanos.c delete mode 100644 src/mess/drivers/nascom1.c delete mode 100644 src/mess/drivers/nc.c delete mode 100644 src/mess/drivers/nes.c delete mode 100644 src/mess/drivers/newbrain.c delete mode 100644 src/mess/drivers/next.c delete mode 100644 src/mess/drivers/ng_aes.c delete mode 100644 src/mess/drivers/ngen.c delete mode 100644 src/mess/drivers/ngp.c delete mode 100644 src/mess/drivers/ob68k1a.c delete mode 100644 src/mess/drivers/octopus.c delete mode 100644 src/mess/drivers/odyssey2.c delete mode 100644 src/mess/drivers/okean240.c delete mode 100644 src/mess/drivers/ondra.c delete mode 100644 src/mess/drivers/onyx.c delete mode 100644 src/mess/drivers/orao.c delete mode 100644 src/mess/drivers/oric.c delete mode 100644 src/mess/drivers/orion.c delete mode 100644 src/mess/drivers/osbexec.c delete mode 100644 src/mess/drivers/osborne1.c delete mode 100644 src/mess/drivers/osi.c delete mode 100644 src/mess/drivers/p112.c delete mode 100644 src/mess/drivers/p2000t.c delete mode 100644 src/mess/drivers/p8k.c delete mode 100644 src/mess/drivers/palm.c delete mode 100644 src/mess/drivers/palm_dbg.inc delete mode 100644 src/mess/drivers/palmz22.c delete mode 100644 src/mess/drivers/partner.c delete mode 100644 src/mess/drivers/paso1600.c delete mode 100644 src/mess/drivers/pasogo.c delete mode 100644 src/mess/drivers/pasopia.c delete mode 100644 src/mess/drivers/pasopia7.c delete mode 100644 src/mess/drivers/pb1000.c delete mode 100644 src/mess/drivers/pc.c delete mode 100644 src/mess/drivers/pc100.c delete mode 100644 src/mess/drivers/pc1500.c delete mode 100644 src/mess/drivers/pc1512.c delete mode 100644 src/mess/drivers/pc2000.c delete mode 100644 src/mess/drivers/pc4.c delete mode 100644 src/mess/drivers/pc6001.c delete mode 100644 src/mess/drivers/pc8001.c delete mode 100644 src/mess/drivers/pc8401a.c delete mode 100644 src/mess/drivers/pc8801.c delete mode 100644 src/mess/drivers/pc88va.c delete mode 100644 src/mess/drivers/pc9801.c delete mode 100644 src/mess/drivers/pcd.c delete mode 100644 src/mess/drivers/pce.c delete mode 100644 src/mess/drivers/pce220.c delete mode 100644 src/mess/drivers/pcfx.c delete mode 100644 src/mess/drivers/pcm.c delete mode 100644 src/mess/drivers/pcw.c delete mode 100644 src/mess/drivers/pcw16.c delete mode 100644 src/mess/drivers/pda600.c delete mode 100644 src/mess/drivers/pdp1.c delete mode 100644 src/mess/drivers/pdp11.c delete mode 100644 src/mess/drivers/pecom.c delete mode 100644 src/mess/drivers/pegasus.c delete mode 100644 src/mess/drivers/pencil2.c delete mode 100644 src/mess/drivers/pentagon.c delete mode 100644 src/mess/drivers/peoplepc.c delete mode 100644 src/mess/drivers/pes.c delete mode 100644 src/mess/drivers/pet.c delete mode 100644 src/mess/drivers/phc25.c delete mode 100644 src/mess/drivers/phunsy.c delete mode 100644 src/mess/drivers/pimps.c delete mode 100644 src/mess/drivers/pipbug.c delete mode 100644 src/mess/drivers/pitagjr.c delete mode 100644 src/mess/drivers/pk8000.c delete mode 100644 src/mess/drivers/pk8020.c delete mode 100644 src/mess/drivers/plan80.c delete mode 100644 src/mess/drivers/plus4.c delete mode 100644 src/mess/drivers/pm68k.c delete mode 100644 src/mess/drivers/pmd85.c delete mode 100644 src/mess/drivers/pmi80.c delete mode 100644 src/mess/drivers/pocketc.c delete mode 100644 src/mess/drivers/pockstat.c delete mode 100644 src/mess/drivers/poisk1.c delete mode 100644 src/mess/drivers/pokemini.c delete mode 100644 src/mess/drivers/poly.c delete mode 100644 src/mess/drivers/poly88.c delete mode 100644 src/mess/drivers/poly880.c delete mode 100644 src/mess/drivers/portfoli.c delete mode 100644 src/mess/drivers/pp01.c delete mode 100644 src/mess/drivers/prestige.c delete mode 100644 src/mess/drivers/primo.c delete mode 100644 src/mess/drivers/pro80.c delete mode 100644 src/mess/drivers/prof180x.c delete mode 100644 src/mess/drivers/prof80.c delete mode 100644 src/mess/drivers/psion.c delete mode 100644 src/mess/drivers/psx.c delete mode 100644 src/mess/drivers/pt68k4.c delete mode 100644 src/mess/drivers/ptcsol.c delete mode 100644 src/mess/drivers/pulsar.c delete mode 100644 src/mess/drivers/pv1000.c delete mode 100644 src/mess/drivers/pv2000.c delete mode 100644 src/mess/drivers/pv9234.c delete mode 100644 src/mess/drivers/pve500.c delete mode 100644 src/mess/drivers/px4.c delete mode 100644 src/mess/drivers/px8.c delete mode 100644 src/mess/drivers/pyl601.c delete mode 100644 src/mess/drivers/ql.c delete mode 100644 src/mess/drivers/qtsbc.c delete mode 100644 src/mess/drivers/qx10.c delete mode 100644 src/mess/drivers/radio86.c delete mode 100644 src/mess/drivers/rainbow.c delete mode 100644 src/mess/drivers/rambo.c delete mode 100644 src/mess/drivers/ravens.c delete mode 100644 src/mess/drivers/rc759.c delete mode 100644 src/mess/drivers/rd110.c delete mode 100644 src/mess/drivers/replicator.c delete mode 100644 src/mess/drivers/rex6000.c delete mode 100644 src/mess/drivers/riscpc.c delete mode 100644 src/mess/drivers/rm380z.c delete mode 100644 src/mess/drivers/rmnimbus.c delete mode 100644 src/mess/drivers/rmt32.c delete mode 100644 src/mess/drivers/rsc55.c delete mode 100644 src/mess/drivers/rt1715.c delete mode 100644 src/mess/drivers/rvoice.c delete mode 100644 src/mess/drivers/rx78.c delete mode 100644 src/mess/drivers/sacstate.c delete mode 100644 src/mess/drivers/sage2.c delete mode 100644 src/mess/drivers/samcoupe.c delete mode 100644 src/mess/drivers/sapi1.c delete mode 100644 src/mess/drivers/saturn.c delete mode 100644 src/mess/drivers/savia84.c delete mode 100644 src/mess/drivers/sbc6510.c delete mode 100644 src/mess/drivers/sbrain.c delete mode 100644 src/mess/drivers/sc1.c delete mode 100644 src/mess/drivers/sc2.c delete mode 100644 src/mess/drivers/scorpion.c delete mode 100644 src/mess/drivers/scv.c delete mode 100644 src/mess/drivers/sdk80.c delete mode 100644 src/mess/drivers/sdk85.c delete mode 100644 src/mess/drivers/sdk86.c delete mode 100644 src/mess/drivers/seattlecmp.c delete mode 100644 src/mess/drivers/segapico.c delete mode 100644 src/mess/drivers/segapm.c delete mode 100644 src/mess/drivers/selz80.c delete mode 100644 src/mess/drivers/sg1000.c delete mode 100644 src/mess/drivers/sgi_ip2.c delete mode 100644 src/mess/drivers/sgi_ip6.c delete mode 100644 src/mess/drivers/sh4robot.c delete mode 100644 src/mess/drivers/sitcom.c delete mode 100644 src/mess/drivers/slc1.c delete mode 100644 src/mess/drivers/slicer.c delete mode 100644 src/mess/drivers/sm1800.c delete mode 100644 src/mess/drivers/smc777.c delete mode 100644 src/mess/drivers/sms.c delete mode 100644 src/mess/drivers/snes.c delete mode 100644 src/mess/drivers/socrates.c delete mode 100644 src/mess/drivers/softbox.c delete mode 100644 src/mess/drivers/sorcerer.c delete mode 100644 src/mess/drivers/spc1000.c delete mode 100644 src/mess/drivers/spec128.c delete mode 100644 src/mess/drivers/special.c delete mode 100644 src/mess/drivers/specpls3.c delete mode 100644 src/mess/drivers/spectrum.c delete mode 100644 src/mess/drivers/squale.c delete mode 100644 src/mess/drivers/ssem.c delete mode 100644 src/mess/drivers/ssystem3.c delete mode 100644 src/mess/drivers/stratos.c delete mode 100644 src/mess/drivers/studio2.c delete mode 100644 src/mess/drivers/sun1.c delete mode 100644 src/mess/drivers/sun2.c delete mode 100644 src/mess/drivers/sun3.c delete mode 100644 src/mess/drivers/sun4.c delete mode 100644 src/mess/drivers/super6.c delete mode 100644 src/mess/drivers/super80.c delete mode 100644 src/mess/drivers/supercon.c delete mode 100644 src/mess/drivers/superslave.c delete mode 100644 src/mess/drivers/supracan.c delete mode 100644 src/mess/drivers/sv8000.c delete mode 100644 src/mess/drivers/svi318.c delete mode 100644 src/mess/drivers/svision.c delete mode 100644 src/mess/drivers/svmu.c delete mode 100644 src/mess/drivers/swtpc.c delete mode 100644 src/mess/drivers/swtpc09.c delete mode 100644 src/mess/drivers/sym1.c delete mode 100644 src/mess/drivers/sys2900.c delete mode 100644 src/mess/drivers/systec.c delete mode 100644 src/mess/drivers/tamag1.c delete mode 100644 src/mess/drivers/tandy1t.c delete mode 100644 src/mess/drivers/tandy2k.c delete mode 100644 src/mess/drivers/tavernie.c delete mode 100644 src/mess/drivers/tb303.c delete mode 100644 src/mess/drivers/tdv2324.c delete mode 100644 src/mess/drivers/tec1.c delete mode 100644 src/mess/drivers/tecnbras.c delete mode 100644 src/mess/drivers/tek405x.c delete mode 100644 src/mess/drivers/tek410x.c delete mode 100644 src/mess/drivers/terak.c delete mode 100644 src/mess/drivers/test_t400.c delete mode 100644 src/mess/drivers/thomson.c delete mode 100644 src/mess/drivers/ti630.c delete mode 100644 src/mess/drivers/ti74.c delete mode 100644 src/mess/drivers/ti85.c delete mode 100644 src/mess/drivers/ti89.c delete mode 100644 src/mess/drivers/ti990_10.c delete mode 100644 src/mess/drivers/ti990_4.c delete mode 100644 src/mess/drivers/ti99_2.c delete mode 100644 src/mess/drivers/ti99_4p.c delete mode 100644 src/mess/drivers/ti99_4x.c delete mode 100644 src/mess/drivers/ti99_8.c delete mode 100644 src/mess/drivers/ticalc1x.c delete mode 100644 src/mess/drivers/tiki100.c delete mode 100644 src/mess/drivers/tim011.c delete mode 100644 src/mess/drivers/tim100.c delete mode 100644 src/mess/drivers/timex.c delete mode 100644 src/mess/drivers/tispeak.c delete mode 100644 src/mess/drivers/tk2000.c delete mode 100644 src/mess/drivers/tk80.c delete mode 100644 src/mess/drivers/tk80bs.c delete mode 100644 src/mess/drivers/tm990189.c delete mode 100644 src/mess/drivers/tmc1800.c delete mode 100644 src/mess/drivers/tmc2000e.c delete mode 100644 src/mess/drivers/tmc600.c delete mode 100644 src/mess/drivers/tricep.c delete mode 100644 src/mess/drivers/trs80.c delete mode 100644 src/mess/drivers/trs80m2.c delete mode 100644 src/mess/drivers/ts802.c delete mode 100644 src/mess/drivers/ts803.c delete mode 100644 src/mess/drivers/ts816.c delete mode 100644 src/mess/drivers/tsispch.c delete mode 100644 src/mess/drivers/tutor.c delete mode 100644 src/mess/drivers/tv950.c delete mode 100644 src/mess/drivers/tvc.c delete mode 100644 src/mess/drivers/tvgame.c delete mode 100644 src/mess/drivers/tx0.c delete mode 100644 src/mess/drivers/uknc.c delete mode 100644 src/mess/drivers/unior.c delete mode 100644 src/mess/drivers/unistar.c delete mode 100644 src/mess/drivers/univac.c delete mode 100644 src/mess/drivers/unixpc.c delete mode 100644 src/mess/drivers/ut88.c delete mode 100644 src/mess/drivers/uzebox.c delete mode 100644 src/mess/drivers/v1050.c delete mode 100644 src/mess/drivers/v6809.c delete mode 100644 src/mess/drivers/vax11.c delete mode 100644 src/mess/drivers/vboy.c delete mode 100644 src/mess/drivers/vc4000.c delete mode 100644 src/mess/drivers/vcs80.c delete mode 100644 src/mess/drivers/vector06.c delete mode 100644 src/mess/drivers/vector4.c delete mode 100644 src/mess/drivers/vg5k.c delete mode 100644 src/mess/drivers/vic10.c delete mode 100644 src/mess/drivers/vic20.c delete mode 100644 src/mess/drivers/victor9k.c delete mode 100644 src/mess/drivers/vidbrain.c delete mode 100644 src/mess/drivers/vii.c delete mode 100644 src/mess/drivers/vip.c delete mode 100644 src/mess/drivers/vixen.c delete mode 100644 src/mess/drivers/vk100.c delete mode 100644 src/mess/drivers/votrpss.c delete mode 100644 src/mess/drivers/votrtnt.c delete mode 100644 src/mess/drivers/vt100.c delete mode 100644 src/mess/drivers/vt220.c delete mode 100644 src/mess/drivers/vt240.c delete mode 100644 src/mess/drivers/vt320.c delete mode 100644 src/mess/drivers/vt520.c delete mode 100644 src/mess/drivers/vta2000.c delete mode 100644 src/mess/drivers/vtech1.c delete mode 100644 src/mess/drivers/vtech2.c delete mode 100644 src/mess/drivers/wangpc.c delete mode 100644 src/mess/drivers/wicat.c delete mode 100644 src/mess/drivers/wildfire.c delete mode 100644 src/mess/drivers/wswan.c delete mode 100644 src/mess/drivers/x07.c delete mode 100644 src/mess/drivers/x1.c delete mode 100644 src/mess/drivers/x1twin.c delete mode 100644 src/mess/drivers/x68k.c delete mode 100644 src/mess/drivers/xavix.c delete mode 100644 src/mess/drivers/xbox.c delete mode 100644 src/mess/drivers/xerox820.c delete mode 100644 src/mess/drivers/xor100.c delete mode 100644 src/mess/drivers/ymmu100.c delete mode 100644 src/mess/drivers/ymmu100.ppm delete mode 100644 src/mess/drivers/z100.c delete mode 100644 src/mess/drivers/z1013.c delete mode 100644 src/mess/drivers/z80dev.c delete mode 100644 src/mess/drivers/z80ne.c delete mode 100644 src/mess/drivers/z88.c delete mode 100644 src/mess/drivers/z9001.c delete mode 100644 src/mess/drivers/zapcomputer.c delete mode 100644 src/mess/drivers/zaurus.c delete mode 100644 src/mess/drivers/zexall.c delete mode 100644 src/mess/drivers/zorba.c delete mode 100644 src/mess/drivers/zrt80.c delete mode 100644 src/mess/drivers/zsbc3.c delete mode 100644 src/mess/drivers/zx.c delete mode 100644 src/mess/includes/abc1600.h delete mode 100644 src/mess/includes/abc80.h delete mode 100644 src/mess/includes/abc80x.h delete mode 100644 src/mess/includes/ac1.h delete mode 100644 src/mess/includes/adam.h delete mode 100644 src/mess/includes/advision.h delete mode 100644 src/mess/includes/aim65.h delete mode 100644 src/mess/includes/alesis.h delete mode 100644 src/mess/includes/amstrad.h delete mode 100644 src/mess/includes/apollo.h delete mode 100644 src/mess/includes/apple1.h delete mode 100644 src/mess/includes/apple2.h delete mode 100644 src/mess/includes/apple2gs.h delete mode 100644 src/mess/includes/apple3.h delete mode 100644 src/mess/includes/aquarius.h delete mode 100644 src/mess/includes/arcadia.h delete mode 100644 src/mess/includes/at.h delete mode 100644 src/mess/includes/atarist.h delete mode 100644 src/mess/includes/atom.h delete mode 100644 src/mess/includes/aussiebyte.h delete mode 100644 src/mess/includes/avigo.h delete mode 100644 src/mess/includes/b2m.h delete mode 100644 src/mess/includes/banctec.h delete mode 100644 src/mess/includes/bbc.h delete mode 100644 src/mess/includes/bebox.h delete mode 100644 src/mess/includes/bk.h delete mode 100644 src/mess/includes/bullet.h delete mode 100644 src/mess/includes/busicom.h delete mode 100644 src/mess/includes/bw12.h delete mode 100644 src/mess/includes/bw2.h delete mode 100644 src/mess/includes/c128.h delete mode 100644 src/mess/includes/c64.h delete mode 100644 src/mess/includes/c65.h delete mode 100644 src/mess/includes/c80.h delete mode 100644 src/mess/includes/cbm2.h delete mode 100644 src/mess/includes/cgc7900.h delete mode 100644 src/mess/includes/channelf.h delete mode 100644 src/mess/includes/coco.h delete mode 100644 src/mess/includes/coco12.h delete mode 100644 src/mess/includes/coco3.h delete mode 100644 src/mess/includes/coleco.h delete mode 100644 src/mess/includes/compis.h delete mode 100644 src/mess/includes/comquest.h delete mode 100644 src/mess/includes/comx35.h delete mode 100644 src/mess/includes/concept.h delete mode 100644 src/mess/includes/cosmicos.h delete mode 100644 src/mess/includes/crvision.h delete mode 100644 src/mess/includes/cxhumax.h delete mode 100644 src/mess/includes/cybiko.h delete mode 100644 src/mess/includes/dai.h delete mode 100644 src/mess/includes/dccons.h delete mode 100644 src/mess/includes/dgn_beta.h delete mode 100644 src/mess/includes/dgnalpha.h delete mode 100644 src/mess/includes/dm7000.h delete mode 100644 src/mess/includes/dragon.h delete mode 100644 src/mess/includes/ec184x.h delete mode 100644 src/mess/includes/einstein.h delete mode 100644 src/mess/includes/electron.h delete mode 100644 src/mess/includes/elf.h delete mode 100644 src/mess/includes/ep64.h delete mode 100644 src/mess/includes/eti660.h delete mode 100644 src/mess/includes/exp85.h delete mode 100644 src/mess/includes/fidelz80.h delete mode 100644 src/mess/includes/fm7.h delete mode 100644 src/mess/includes/fmtowns.h delete mode 100644 src/mess/includes/galaxy.h delete mode 100644 src/mess/includes/galeb.h delete mode 100644 src/mess/includes/gamate.h delete mode 100644 src/mess/includes/gamecom.h delete mode 100644 src/mess/includes/gamepock.h delete mode 100644 src/mess/includes/gb.h delete mode 100644 src/mess/includes/gba.h delete mode 100644 src/mess/includes/genpc.h delete mode 100644 src/mess/includes/gp32.h delete mode 100644 src/mess/includes/hec2hrp.h delete mode 100644 src/mess/includes/hh_tms1k.h delete mode 100644 src/mess/includes/hh_ucom4.h delete mode 100644 src/mess/includes/hp48.h delete mode 100644 src/mess/includes/huebler.h delete mode 100644 src/mess/includes/hx20.h delete mode 100644 src/mess/includes/imds2.h delete mode 100644 src/mess/includes/intv.h delete mode 100644 src/mess/includes/jupiter.h delete mode 100644 src/mess/includes/kaypro.h delete mode 100644 src/mess/includes/kc.h delete mode 100644 src/mess/includes/kramermc.h delete mode 100644 src/mess/includes/kyocera.h delete mode 100644 src/mess/includes/lc80.h delete mode 100644 src/mess/includes/lisa.h delete mode 100644 src/mess/includes/llc.h delete mode 100644 src/mess/includes/lviv.h delete mode 100644 src/mess/includes/lynx.h delete mode 100644 src/mess/includes/m5.h delete mode 100644 src/mess/includes/mac.h delete mode 100644 src/mess/includes/macpci.h delete mode 100644 src/mess/includes/mbc55x.h delete mode 100644 src/mess/includes/mbee.h delete mode 100644 src/mess/includes/mboard.h delete mode 100644 src/mess/includes/mc1000.h delete mode 100644 src/mess/includes/mc1502.h delete mode 100644 src/mess/includes/mc80.h delete mode 100644 src/mess/includes/md_cons.h delete mode 100644 src/mess/includes/micronic.h delete mode 100644 src/mess/includes/microtan.h delete mode 100644 src/mess/includes/mikro80.h delete mode 100644 src/mess/includes/mikromik.h delete mode 100644 src/mess/includes/mpf1.h delete mode 100644 src/mess/includes/mpz80.h delete mode 100644 src/mess/includes/msbc1.h delete mode 100644 src/mess/includes/msx.h delete mode 100644 src/mess/includes/mtx.h delete mode 100644 src/mess/includes/mz700.h delete mode 100644 src/mess/includes/mz80.h delete mode 100644 src/mess/includes/nc.h delete mode 100644 src/mess/includes/nes.h delete mode 100644 src/mess/includes/newbrain.h delete mode 100644 src/mess/includes/next.h delete mode 100644 src/mess/includes/ob68k1a.h delete mode 100644 src/mess/includes/ondra.h delete mode 100644 src/mess/includes/orao.h delete mode 100644 src/mess/includes/orion.h delete mode 100644 src/mess/includes/osborne1.h delete mode 100644 src/mess/includes/osi.h delete mode 100644 src/mess/includes/p2000t.h delete mode 100644 src/mess/includes/partner.h delete mode 100644 src/mess/includes/pasopia.h delete mode 100644 src/mess/includes/pc1251.h delete mode 100644 src/mess/includes/pc1350.h delete mode 100644 src/mess/includes/pc1401.h delete mode 100644 src/mess/includes/pc1403.h delete mode 100644 src/mess/includes/pc1512.h delete mode 100644 src/mess/includes/pc4.h delete mode 100644 src/mess/includes/pc8001.h delete mode 100644 src/mess/includes/pc8401a.h delete mode 100644 src/mess/includes/pce.h delete mode 100644 src/mess/includes/pcw.h delete mode 100644 src/mess/includes/pcw16.h delete mode 100644 src/mess/includes/pdp1.h delete mode 100644 src/mess/includes/pecom.h delete mode 100644 src/mess/includes/pes.h delete mode 100644 src/mess/includes/pet.h delete mode 100644 src/mess/includes/phc25.h delete mode 100644 src/mess/includes/pk8020.h delete mode 100644 src/mess/includes/plus4.h delete mode 100644 src/mess/includes/pmd85.h delete mode 100644 src/mess/includes/pocketc.h delete mode 100644 src/mess/includes/poisk1.h delete mode 100644 src/mess/includes/poly88.h delete mode 100644 src/mess/includes/poly880.h delete mode 100644 src/mess/includes/portfoli.h delete mode 100644 src/mess/includes/pp01.h delete mode 100644 src/mess/includes/primo.h delete mode 100644 src/mess/includes/prof180x.h delete mode 100644 src/mess/includes/prof80.h delete mode 100644 src/mess/includes/psion.h delete mode 100644 src/mess/includes/px8.h delete mode 100644 src/mess/includes/ql.h delete mode 100644 src/mess/includes/radio86.h delete mode 100644 src/mess/includes/rm380z.h delete mode 100644 src/mess/includes/rmnimbus.h delete mode 100644 src/mess/includes/sage2.h delete mode 100644 src/mess/includes/samcoupe.h delete mode 100644 src/mess/includes/sg1000.h delete mode 100644 src/mess/includes/sms.h delete mode 100644 src/mess/includes/softbox.h delete mode 100644 src/mess/includes/sorcerer.h delete mode 100644 src/mess/includes/special.h delete mode 100644 src/mess/includes/spectrum.h delete mode 100644 src/mess/includes/ssystem3.h delete mode 100644 src/mess/includes/super6.h delete mode 100644 src/mess/includes/super80.h delete mode 100644 src/mess/includes/superslave.h delete mode 100644 src/mess/includes/svi318.h delete mode 100644 src/mess/includes/svision.h delete mode 100644 src/mess/includes/swtpc09.h delete mode 100644 src/mess/includes/tandy2k.h delete mode 100644 src/mess/includes/tdv2324.h delete mode 100644 src/mess/includes/tek405x.h delete mode 100644 src/mess/includes/thomson.h delete mode 100644 src/mess/includes/ti85.h delete mode 100644 src/mess/includes/ti89.h delete mode 100644 src/mess/includes/tiki100.h delete mode 100644 src/mess/includes/tmc1800.h delete mode 100644 src/mess/includes/tmc2000e.h delete mode 100644 src/mess/includes/tmc600.h delete mode 100644 src/mess/includes/trs80.h delete mode 100644 src/mess/includes/trs80m2.h delete mode 100644 src/mess/includes/tsispch.h delete mode 100644 src/mess/includes/tx0.h delete mode 100644 src/mess/includes/ut88.h delete mode 100644 src/mess/includes/v1050.h delete mode 100644 src/mess/includes/vc4000.h delete mode 100644 src/mess/includes/vcs80.h delete mode 100644 src/mess/includes/vector06.h delete mode 100644 src/mess/includes/vic10.h delete mode 100644 src/mess/includes/vic20.h delete mode 100644 src/mess/includes/victor9k.h delete mode 100644 src/mess/includes/vidbrain.h delete mode 100644 src/mess/includes/vip.h delete mode 100644 src/mess/includes/vixen.h delete mode 100644 src/mess/includes/vtech2.h delete mode 100644 src/mess/includes/wangpc.h delete mode 100644 src/mess/includes/wswan.h delete mode 100644 src/mess/includes/x07.h delete mode 100644 src/mess/includes/x1.h delete mode 100644 src/mess/includes/x68k.h delete mode 100644 src/mess/includes/xerox820.h delete mode 100644 src/mess/includes/xor100.h delete mode 100644 src/mess/includes/z80ne.h delete mode 100644 src/mess/includes/z88.h delete mode 100644 src/mess/includes/zapcomputer.h delete mode 100644 src/mess/includes/zx.h delete mode 100644 src/mess/layout/4004clk.lay delete mode 100644 src/mess/layout/abc1600.lay delete mode 100644 src/mess/layout/acrnsys1.lay delete mode 100644 src/mess/layout/aim65.lay delete mode 100644 src/mess/layout/aim65_40.lay delete mode 100644 src/mess/layout/amaztron.lay delete mode 100644 src/mess/layout/amico2k.lay delete mode 100644 src/mess/layout/amiga.lay delete mode 100644 src/mess/layout/apollo.lay delete mode 100644 src/mess/layout/apollo_15i.lay delete mode 100644 src/mess/layout/apollo_dsp.lay delete mode 100644 src/mess/layout/apricotp.lay delete mode 100644 src/mess/layout/astro.lay delete mode 100644 src/mess/layout/avigo.lay delete mode 100644 src/mess/layout/babbage.lay delete mode 100644 src/mess/layout/bankshot.lay delete mode 100644 src/mess/layout/bbc.lay delete mode 100644 src/mess/layout/beta.lay delete mode 100644 src/mess/layout/bigtrak.lay delete mode 100644 src/mess/layout/bitgrpha.lay delete mode 100644 src/mess/layout/bitgrphb.lay delete mode 100644 src/mess/layout/bob85.lay delete mode 100644 src/mess/layout/borisdpl.lay delete mode 100644 src/mess/layout/bridgec3.lay delete mode 100644 src/mess/layout/c80.lay delete mode 100644 src/mess/layout/cc40.lay delete mode 100644 src/mess/layout/chessmst.lay delete mode 100644 src/mess/layout/chesstrv.lay delete mode 100644 src/mess/layout/cnsector.lay delete mode 100644 src/mess/layout/coco3.lay delete mode 100644 src/mess/layout/comp4.lay delete mode 100644 src/mess/layout/cosmicos.lay delete mode 100644 src/mess/layout/cp1.lay delete mode 100644 src/mess/layout/cvicny.lay delete mode 100644 src/mess/layout/dataman.lay delete mode 100644 src/mess/layout/digel804.lay delete mode 100644 src/mess/layout/dmv.lay delete mode 100644 src/mess/layout/dolphunk.lay delete mode 100644 src/mess/layout/eacc.lay delete mode 100644 src/mess/layout/ebaskb2.lay delete mode 100644 src/mess/layout/ebball.lay delete mode 100644 src/mess/layout/ebball2.lay delete mode 100644 src/mess/layout/ebball3.lay delete mode 100644 src/mess/layout/efball.lay delete mode 100644 src/mess/layout/efootb4.lay delete mode 100644 src/mess/layout/einvader.lay delete mode 100644 src/mess/layout/einvaderc.lay delete mode 100644 src/mess/layout/elecbowl.lay delete mode 100644 src/mess/layout/elecdet.lay delete mode 100644 src/mess/layout/elekscmp.lay delete mode 100644 src/mess/layout/elf2.lay delete mode 100644 src/mess/layout/esq1by22.lay delete mode 100644 src/mess/layout/esq2by40.lay delete mode 100644 src/mess/layout/et3400.lay delete mode 100644 src/mess/layout/fb01.lay delete mode 100644 src/mess/layout/fccpu1.lay delete mode 100644 src/mess/layout/fidelz80.lay delete mode 100644 src/mess/layout/funjacks.lay delete mode 100644 src/mess/layout/funrlgl.lay delete mode 100644 src/mess/layout/gamecom.lay delete mode 100644 src/mess/layout/gjackpot.lay delete mode 100644 src/mess/layout/gl3000s.lay delete mode 100644 src/mess/layout/glasgow.lay delete mode 100644 src/mess/layout/gpoker.lay delete mode 100644 src/mess/layout/h2hbaseb.lay delete mode 100644 src/mess/layout/h2hfootb.lay delete mode 100644 src/mess/layout/h8.lay delete mode 100644 src/mess/layout/hh_hmcs40_test.lay delete mode 100644 src/mess/layout/hh_melps4_test.lay delete mode 100644 src/mess/layout/hh_sm510_test.lay delete mode 100644 src/mess/layout/hh_tms1k_test.lay delete mode 100644 src/mess/layout/hh_ucom4_test.lay delete mode 100644 src/mess/layout/ie15.lay delete mode 100644 src/mess/layout/instruct.lay delete mode 100644 src/mess/layout/junior.lay delete mode 100644 src/mess/layout/k1003.lay delete mode 100644 src/mess/layout/kim1.lay delete mode 100644 src/mess/layout/lantutor.lay delete mode 100644 src/mess/layout/lc80.lay delete mode 100644 src/mess/layout/lightfgt.lay delete mode 100644 src/mess/layout/llc1.lay delete mode 100644 src/mess/layout/lynx.lay delete mode 100644 src/mess/layout/mac.lay delete mode 100644 src/mess/layout/maniac.lay delete mode 100644 src/mess/layout/mathmagi.lay delete mode 100644 src/mess/layout/mbdtower.lay delete mode 100644 src/mess/layout/megacd.lay delete mode 100644 src/mess/layout/mekd2.lay delete mode 100644 src/mess/layout/mephisto.lay delete mode 100644 src/mess/layout/merlin.lay delete mode 100644 src/mess/layout/minicom.lay delete mode 100644 src/mess/layout/mirage.lay delete mode 100644 src/mess/layout/mk1.lay delete mode 100644 src/mess/layout/mk14.lay delete mode 100644 src/mess/layout/mk2.lay delete mode 100644 src/mess/layout/mkit09.lay delete mode 100644 src/mess/layout/mmd1.lay delete mode 100644 src/mess/layout/mmd2.lay delete mode 100644 src/mess/layout/mmerlin.lay delete mode 100644 src/mess/layout/mpf1.lay delete mode 100644 src/mess/layout/mpf1b.lay delete mode 100644 src/mess/layout/mpf1p.lay delete mode 100644 src/mess/layout/mvbfree.lay delete mode 100644 src/mess/layout/newbrain.lay delete mode 100644 src/mess/layout/pairmtch.lay delete mode 100644 src/mess/layout/pc1500.lay delete mode 100644 src/mess/layout/pc8500.lay delete mode 100644 src/mess/layout/pcw.lay delete mode 100644 src/mess/layout/pmi80.lay delete mode 100644 src/mess/layout/poly880.lay delete mode 100644 src/mess/layout/pro80.lay delete mode 100644 src/mess/layout/pve500.lay delete mode 100644 src/mess/layout/px4.lay delete mode 100644 src/mess/layout/px8.lay delete mode 100644 src/mess/layout/rainbow.lay delete mode 100644 src/mess/layout/ravens.lay delete mode 100644 src/mess/layout/savia84.lay delete mode 100644 src/mess/layout/sc1.lay delete mode 100644 src/mess/layout/sc2.lay delete mode 100644 src/mess/layout/sdk85.lay delete mode 100644 src/mess/layout/sdk86.lay delete mode 100644 src/mess/layout/selz80.lay delete mode 100644 src/mess/layout/simon.lay delete mode 100644 src/mess/layout/sitcom.lay delete mode 100644 src/mess/layout/slc1.lay delete mode 100644 src/mess/layout/sms1.lay delete mode 100644 src/mess/layout/snmath.lay delete mode 100644 src/mess/layout/snspell.lay delete mode 100644 src/mess/layout/splitsec.lay delete mode 100644 src/mess/layout/sr16.lay delete mode 100644 src/mess/layout/ssimon.lay delete mode 100644 src/mess/layout/starwbc.lay delete mode 100644 src/mess/layout/stopthie.lay delete mode 100644 src/mess/layout/super80.lay delete mode 100644 src/mess/layout/svision.lay delete mode 100644 src/mess/layout/svmu.lay delete mode 100644 src/mess/layout/sym1.lay delete mode 100644 src/mess/layout/tactix.lay delete mode 100644 src/mess/layout/tama.lay delete mode 100644 src/mess/layout/tandy12.lay delete mode 100644 src/mess/layout/tavernie.lay delete mode 100644 src/mess/layout/tb303.lay delete mode 100644 src/mess/layout/tbreakup.lay delete mode 100644 src/mess/layout/tc4.lay delete mode 100644 src/mess/layout/tec1.lay delete mode 100644 src/mess/layout/tecnbras.lay delete mode 100644 src/mess/layout/ti1270.lay delete mode 100644 src/mess/layout/ti30.lay delete mode 100644 src/mess/layout/ti74.lay delete mode 100644 src/mess/layout/ti95.lay delete mode 100644 src/mess/layout/tisr16.lay delete mode 100644 src/mess/layout/tk80.lay delete mode 100644 src/mess/layout/tm990189.lay delete mode 100644 src/mess/layout/tm990189v.lay delete mode 100644 src/mess/layout/tntell.lay delete mode 100644 src/mess/layout/unixpc.lay delete mode 100644 src/mess/layout/ut88mini.lay delete mode 100644 src/mess/layout/vboy.lay delete mode 100644 src/mess/layout/vcs80.lay delete mode 100644 src/mess/layout/vidbrain.lay delete mode 100644 src/mess/layout/vk100.lay delete mode 100644 src/mess/layout/votrpss.lay delete mode 100644 src/mess/layout/votrtnt.lay delete mode 100644 src/mess/layout/vsc.lay delete mode 100644 src/mess/layout/vt100.lay delete mode 100644 src/mess/layout/wicat.lay delete mode 100644 src/mess/layout/wildfire.lay delete mode 100644 src/mess/layout/wizatron.lay delete mode 100644 src/mess/layout/wswan.lay delete mode 100644 src/mess/layout/x68000.lay delete mode 100644 src/mess/layout/z80dev.lay delete mode 100644 src/mess/layout/z80ne.lay delete mode 100644 src/mess/layout/z80net.lay delete mode 100644 src/mess/layout/z80netb.lay delete mode 100644 src/mess/layout/z80netf.lay delete mode 100644 src/mess/layout/zapcomputer.lay delete mode 100644 src/mess/machine/6883sam.c delete mode 100644 src/mess/machine/6883sam.h delete mode 100644 src/mess/machine/abc1600mac.c delete mode 100644 src/mess/machine/abc1600mac.h delete mode 100644 src/mess/machine/abc80kb.c delete mode 100644 src/mess/machine/abc80kb.h delete mode 100644 src/mess/machine/ac1.c delete mode 100644 src/mess/machine/advision.c delete mode 100644 src/mess/machine/aim65.c delete mode 100644 src/mess/machine/amigakbd.c delete mode 100644 src/mess/machine/amigakbd.h delete mode 100644 src/mess/machine/amstrad.c delete mode 100644 src/mess/machine/apollo.c delete mode 100644 src/mess/machine/apollo_dbg.c delete mode 100644 src/mess/machine/apollo_kbd.c delete mode 100644 src/mess/machine/apollo_kbd.h delete mode 100644 src/mess/machine/appldriv.c delete mode 100644 src/mess/machine/appldriv.h delete mode 100644 src/mess/machine/apple1.c delete mode 100644 src/mess/machine/apple2.c delete mode 100644 src/mess/machine/apple2gs.c delete mode 100644 src/mess/machine/apple3.c delete mode 100644 src/mess/machine/applefdc.c delete mode 100644 src/mess/machine/applefdc.h delete mode 100644 src/mess/machine/apricotkb.c delete mode 100644 src/mess/machine/apricotkb.h delete mode 100644 src/mess/machine/apricotkb_hle.c delete mode 100644 src/mess/machine/apricotkb_hle.h delete mode 100644 src/mess/machine/at.c delete mode 100644 src/mess/machine/atarifdc.c delete mode 100644 src/mess/machine/atarifdc.h delete mode 100644 src/mess/machine/b2m.c delete mode 100644 src/mess/machine/bbc.c delete mode 100644 src/mess/machine/bebox.c delete mode 100644 src/mess/machine/beta.c delete mode 100644 src/mess/machine/beta.h delete mode 100644 src/mess/machine/bk.c delete mode 100644 src/mess/machine/c65_old.c delete mode 100644 src/mess/machine/cbm_snqk.c delete mode 100644 src/mess/machine/cbm_snqk.h delete mode 100644 src/mess/machine/coco.c delete mode 100644 src/mess/machine/coco12.c delete mode 100644 src/mess/machine/coco3.c delete mode 100644 src/mess/machine/coco_vhd.c delete mode 100644 src/mess/machine/coco_vhd.h delete mode 100644 src/mess/machine/coleco.c delete mode 100644 src/mess/machine/coleco.h delete mode 100644 src/mess/machine/compiskb.c delete mode 100644 src/mess/machine/compiskb.h delete mode 100644 src/mess/machine/concept.c delete mode 100644 src/mess/machine/cuda.c delete mode 100644 src/mess/machine/cuda.h delete mode 100644 src/mess/machine/cx4data.inc delete mode 100644 src/mess/machine/cx4fn.inc delete mode 100644 src/mess/machine/cx4oam.inc delete mode 100644 src/mess/machine/cx4ops.inc delete mode 100644 src/mess/machine/cybiko.c delete mode 100644 src/mess/machine/dai.c delete mode 100644 src/mess/machine/dccons.c delete mode 100644 src/mess/machine/dec_lk201.c delete mode 100644 src/mess/machine/dec_lk201.h delete mode 100644 src/mess/machine/dgn_beta.c delete mode 100644 src/mess/machine/dgnalpha.c delete mode 100644 src/mess/machine/dmv_keyb.c delete mode 100644 src/mess/machine/dmv_keyb.h delete mode 100644 src/mess/machine/docg3.c delete mode 100644 src/mess/machine/docg3.h delete mode 100644 src/mess/machine/dragon.c delete mode 100644 src/mess/machine/egret.c delete mode 100644 src/mess/machine/egret.h delete mode 100644 src/mess/machine/einstein.c delete mode 100644 src/mess/machine/electron.c delete mode 100644 src/mess/machine/esqpanel.c delete mode 100644 src/mess/machine/esqpanel.h delete mode 100644 src/mess/machine/esqvfd.c delete mode 100644 src/mess/machine/esqvfd.h delete mode 100644 src/mess/machine/fm_scsi.c delete mode 100644 src/mess/machine/fm_scsi.h delete mode 100644 src/mess/machine/galaxy.c delete mode 100644 src/mess/machine/gamecom.c delete mode 100644 src/mess/machine/gamepock.c delete mode 100644 src/mess/machine/gb.c delete mode 100644 src/mess/machine/genpc.c delete mode 100644 src/mess/machine/hec2hrp.c delete mode 100644 src/mess/machine/hecdisk2.c delete mode 100644 src/mess/machine/hp48.c delete mode 100644 src/mess/machine/ie15_kbd.c delete mode 100644 src/mess/machine/ie15_kbd.h delete mode 100644 src/mess/machine/intv.c delete mode 100644 src/mess/machine/isbc_215g.c delete mode 100644 src/mess/machine/isbc_215g.h delete mode 100644 src/mess/machine/k7659kb.c delete mode 100644 src/mess/machine/k7659kb.h delete mode 100644 src/mess/machine/kay_kbd.c delete mode 100644 src/mess/machine/kaypro.c delete mode 100644 src/mess/machine/kb_7007_3.h delete mode 100644 src/mess/machine/kb_poisk1.h delete mode 100644 src/mess/machine/kc.c delete mode 100644 src/mess/machine/kc_keyb.c delete mode 100644 src/mess/machine/kc_keyb.h delete mode 100644 src/mess/machine/kramermc.c delete mode 100644 src/mess/machine/lisa.c delete mode 100644 src/mess/machine/llc.c delete mode 100644 src/mess/machine/lviv.c delete mode 100644 src/mess/machine/lynx.c delete mode 100644 src/mess/machine/m20_8086.c delete mode 100644 src/mess/machine/m20_8086.h delete mode 100644 src/mess/machine/m20_kbd.c delete mode 100644 src/mess/machine/m20_kbd.h delete mode 100644 src/mess/machine/m24_kbd.c delete mode 100644 src/mess/machine/m24_kbd.h delete mode 100644 src/mess/machine/m24_z8000.c delete mode 100644 src/mess/machine/m24_z8000.h delete mode 100644 src/mess/machine/mac.c delete mode 100644 src/mess/machine/macadb.c delete mode 100644 src/mess/machine/mackbd.c delete mode 100644 src/mess/machine/mackbd.h delete mode 100644 src/mess/machine/macpci.c delete mode 100644 src/mess/machine/macrtc.c delete mode 100644 src/mess/machine/macrtc.h delete mode 100644 src/mess/machine/mbc55x.c delete mode 100644 src/mess/machine/mbee.c delete mode 100644 src/mess/machine/mboard.c delete mode 100644 src/mess/machine/mc80.c delete mode 100644 src/mess/machine/mega32x.c delete mode 100644 src/mess/machine/mega32x.h delete mode 100644 src/mess/machine/megacd.c delete mode 100644 src/mess/machine/megacd.h delete mode 100644 src/mess/machine/megacdcd.c delete mode 100644 src/mess/machine/megacdcd.h delete mode 100644 src/mess/machine/microdrv.c delete mode 100644 src/mess/machine/microdrv.h delete mode 100644 src/mess/machine/micropolis.c delete mode 100644 src/mess/machine/micropolis.h delete mode 100644 src/mess/machine/microtan.c delete mode 100644 src/mess/machine/mikro80.c delete mode 100644 src/mess/machine/mm1kb.c delete mode 100644 src/mess/machine/mm1kb.h delete mode 100644 src/mess/machine/ms7004.c delete mode 100644 src/mess/machine/ms7004.h delete mode 100644 src/mess/machine/msx.c delete mode 100644 src/mess/machine/msx_matsushita.c delete mode 100644 src/mess/machine/msx_matsushita.h delete mode 100644 src/mess/machine/msx_s1985.c delete mode 100644 src/mess/machine/msx_s1985.h delete mode 100644 src/mess/machine/msx_switched.c delete mode 100644 src/mess/machine/msx_switched.h delete mode 100644 src/mess/machine/msx_systemflags.c delete mode 100644 src/mess/machine/msx_systemflags.h delete mode 100644 src/mess/machine/mtx.c delete mode 100644 src/mess/machine/mz700.c delete mode 100644 src/mess/machine/mz80.c delete mode 100644 src/mess/machine/nc.c delete mode 100644 src/mess/machine/nes.c delete mode 100644 src/mess/machine/nextkbd.c delete mode 100644 src/mess/machine/nextkbd.h delete mode 100644 src/mess/machine/nextmo.c delete mode 100644 src/mess/machine/nextmo.h delete mode 100644 src/mess/machine/ngen_kb.c delete mode 100644 src/mess/machine/ngen_kb.h delete mode 100644 src/mess/machine/ondra.c delete mode 100644 src/mess/machine/orao.c delete mode 100644 src/mess/machine/orion.c delete mode 100644 src/mess/machine/osborne1.c delete mode 100644 src/mess/machine/p2000t.c delete mode 100644 src/mess/machine/partner.c delete mode 100644 src/mess/machine/pc1251.c delete mode 100644 src/mess/machine/pc1350.c delete mode 100644 src/mess/machine/pc1401.c delete mode 100644 src/mess/machine/pc1403.c delete mode 100644 src/mess/machine/pc1512kb.c delete mode 100644 src/mess/machine/pc1512kb.h delete mode 100644 src/mess/machine/pc9801_118.c delete mode 100644 src/mess/machine/pc9801_118.h delete mode 100644 src/mess/machine/pc9801_26.c delete mode 100644 src/mess/machine/pc9801_26.h delete mode 100644 src/mess/machine/pc9801_86.c delete mode 100644 src/mess/machine/pc9801_86.h delete mode 100644 src/mess/machine/pc9801_cbus.c delete mode 100644 src/mess/machine/pc9801_cbus.h delete mode 100644 src/mess/machine/pc9801_kbd.c delete mode 100644 src/mess/machine/pc9801_kbd.h delete mode 100644 src/mess/machine/pcd_kbd.c delete mode 100644 src/mess/machine/pcd_kbd.h delete mode 100644 src/mess/machine/pce.c delete mode 100644 src/mess/machine/pce220_ser.c delete mode 100644 src/mess/machine/pce220_ser.h delete mode 100644 src/mess/machine/pce_cd.c delete mode 100644 src/mess/machine/pce_cd.h delete mode 100644 src/mess/machine/pecom.c delete mode 100644 src/mess/machine/pk8020.c delete mode 100644 src/mess/machine/pmd85.c delete mode 100644 src/mess/machine/poly88.c delete mode 100644 src/mess/machine/pp01.c delete mode 100644 src/mess/machine/primo.c delete mode 100644 src/mess/machine/prof80mmu.c delete mode 100644 src/mess/machine/prof80mmu.h delete mode 100644 src/mess/machine/psion_pack.c delete mode 100644 src/mess/machine/psion_pack.h delete mode 100644 src/mess/machine/psxcd.c delete mode 100644 src/mess/machine/psxcd.h delete mode 100644 src/mess/machine/qimi.c delete mode 100644 src/mess/machine/qimi.h delete mode 100644 src/mess/machine/qx10kbd.c delete mode 100644 src/mess/machine/qx10kbd.h delete mode 100644 src/mess/machine/radio86.c delete mode 100644 src/mess/machine/rm380z.c delete mode 100644 src/mess/machine/rmnimbus.c delete mode 100644 src/mess/machine/rmnkbd.c delete mode 100644 src/mess/machine/rmnkbd.h delete mode 100644 src/mess/machine/rx01.c delete mode 100644 src/mess/machine/rx01.h delete mode 100644 src/mess/machine/samcoupe.c delete mode 100644 src/mess/machine/sgi.c delete mode 100644 src/mess/machine/sgi.h delete mode 100644 src/mess/machine/smartmed.c delete mode 100644 src/mess/machine/smartmed.h delete mode 100644 src/mess/machine/sms.c delete mode 100644 src/mess/machine/snescx4.c delete mode 100644 src/mess/machine/snescx4.h delete mode 100644 src/mess/machine/sonydriv.c delete mode 100644 src/mess/machine/sonydriv.h delete mode 100644 src/mess/machine/sorcerer.c delete mode 100644 src/mess/machine/spec_snqk.c delete mode 100644 src/mess/machine/spec_snqk.h delete mode 100644 src/mess/machine/special.c delete mode 100644 src/mess/machine/super80.c delete mode 100644 src/mess/machine/svi318.c delete mode 100644 src/mess/machine/swim.c delete mode 100644 src/mess/machine/swim.h delete mode 100644 src/mess/machine/swtpc09.c delete mode 100644 src/mess/machine/tandy2kb.c delete mode 100644 src/mess/machine/tandy2kb.h delete mode 100644 src/mess/machine/teleprinter.c delete mode 100644 src/mess/machine/teleprinter.h delete mode 100644 src/mess/machine/thomflop.c delete mode 100644 src/mess/machine/thomflop.h delete mode 100644 src/mess/machine/thomson.c delete mode 100644 src/mess/machine/ti85.c delete mode 100644 src/mess/machine/trs80.c delete mode 100644 src/mess/machine/trs80m2kb.c delete mode 100644 src/mess/machine/trs80m2kb.h delete mode 100644 src/mess/machine/upd65031.c delete mode 100644 src/mess/machine/upd65031.h delete mode 100644 src/mess/machine/ut88.c delete mode 100644 src/mess/machine/v1050kb.c delete mode 100644 src/mess/machine/v1050kb.h delete mode 100644 src/mess/machine/vector06.c delete mode 100644 src/mess/machine/victor9k_fdc.c delete mode 100644 src/mess/machine/victor9k_fdc.h delete mode 100644 src/mess/machine/victor9kb.c delete mode 100644 src/mess/machine/victor9kb.h delete mode 100644 src/mess/machine/vtech2.c delete mode 100644 src/mess/machine/wangpckb.c delete mode 100644 src/mess/machine/wangpckb.h delete mode 100644 src/mess/machine/wswan.c delete mode 100644 src/mess/machine/x1.c delete mode 100644 src/mess/machine/x68k_hdc.c delete mode 100644 src/mess/machine/x68k_hdc.h delete mode 100644 src/mess/machine/x68k_kbd.c delete mode 100644 src/mess/machine/x68k_kbd.h delete mode 100644 src/mess/machine/x820kb.c delete mode 100644 src/mess/machine/x820kb.h delete mode 100644 src/mess/machine/z80bin.c delete mode 100644 src/mess/machine/z80bin.h delete mode 100644 src/mess/machine/z80ne.c delete mode 100644 src/mess/machine/zx.c delete mode 100644 src/mess/machine/zx8302.c delete mode 100644 src/mess/machine/zx8302.h delete mode 100644 src/mess/tools/castool/main.c delete mode 100644 src/mess/tools/floptool/main.c delete mode 100644 src/mess/tools/imgtool/charconv.c delete mode 100644 src/mess/tools/imgtool/charconv.h delete mode 100644 src/mess/tools/imgtool/filtbas.c delete mode 100644 src/mess/tools/imgtool/filteoln.c delete mode 100644 src/mess/tools/imgtool/filter.c delete mode 100644 src/mess/tools/imgtool/filter.h delete mode 100644 src/mess/tools/imgtool/formats/coco_dsk.c delete mode 100644 src/mess/tools/imgtool/formats/coco_dsk.h delete mode 100644 src/mess/tools/imgtool/formats/vt_dsk.c delete mode 100644 src/mess/tools/imgtool/formats/vt_dsk.h delete mode 100644 src/mess/tools/imgtool/iflopimg.c delete mode 100644 src/mess/tools/imgtool/iflopimg.h delete mode 100644 src/mess/tools/imgtool/imghd.c delete mode 100644 src/mess/tools/imgtool/imghd.h delete mode 100644 src/mess/tools/imgtool/imgterrs.c delete mode 100644 src/mess/tools/imgtool/imgterrs.h delete mode 100644 src/mess/tools/imgtool/imgtool.c delete mode 100644 src/mess/tools/imgtool/imgtool.h delete mode 100644 src/mess/tools/imgtool/library.c delete mode 100644 src/mess/tools/imgtool/library.h delete mode 100644 src/mess/tools/imgtool/main.c delete mode 100644 src/mess/tools/imgtool/main.h delete mode 100644 src/mess/tools/imgtool/modules.c delete mode 100644 src/mess/tools/imgtool/modules.h delete mode 100644 src/mess/tools/imgtool/modules/amiga.c delete mode 100644 src/mess/tools/imgtool/modules/bml3.c delete mode 100644 src/mess/tools/imgtool/modules/concept.c delete mode 100644 src/mess/tools/imgtool/modules/cybiko.c delete mode 100644 src/mess/tools/imgtool/modules/cybikoxt.c delete mode 100644 src/mess/tools/imgtool/modules/fat.c delete mode 100644 src/mess/tools/imgtool/modules/fat.h delete mode 100644 src/mess/tools/imgtool/modules/hp48.c delete mode 100644 src/mess/tools/imgtool/modules/mac.c delete mode 100644 src/mess/tools/imgtool/modules/macbin.c delete mode 100644 src/mess/tools/imgtool/modules/macutil.c delete mode 100644 src/mess/tools/imgtool/modules/macutil.h delete mode 100644 src/mess/tools/imgtool/modules/os9.c delete mode 100644 src/mess/tools/imgtool/modules/pc_flop.c delete mode 100644 src/mess/tools/imgtool/modules/pc_hard.c delete mode 100644 src/mess/tools/imgtool/modules/prodos.c delete mode 100644 src/mess/tools/imgtool/modules/psion.c delete mode 100644 src/mess/tools/imgtool/modules/rsdos.c delete mode 100644 src/mess/tools/imgtool/modules/thomson.c delete mode 100644 src/mess/tools/imgtool/modules/ti99.c delete mode 100644 src/mess/tools/imgtool/modules/ti990hd.c delete mode 100644 src/mess/tools/imgtool/modules/vzdos.c delete mode 100644 src/mess/tools/imgtool/stream.c delete mode 100644 src/mess/tools/imgtool/stream.h delete mode 100644 src/mess/video/733_asr.c delete mode 100644 src/mess/video/733_asr.h delete mode 100644 src/mess/video/911_chr.h delete mode 100644 src/mess/video/911_key.h delete mode 100644 src/mess/video/911_vdt.c delete mode 100644 src/mess/video/911_vdt.h delete mode 100644 src/mess/video/abc1600.c delete mode 100644 src/mess/video/abc1600.h delete mode 100644 src/mess/video/abc80.c delete mode 100644 src/mess/video/abc800.c delete mode 100644 src/mess/video/abc802.c delete mode 100644 src/mess/video/abc806.c delete mode 100644 src/mess/video/ac1.c delete mode 100644 src/mess/video/advision.c delete mode 100644 src/mess/video/alesis.c delete mode 100644 src/mess/video/apollo.c delete mode 100644 src/mess/video/apple1.c delete mode 100644 src/mess/video/apple2.c delete mode 100644 src/mess/video/apple2.h delete mode 100644 src/mess/video/apple2gs.c delete mode 100644 src/mess/video/apple3.c delete mode 100644 src/mess/video/aquarius.c delete mode 100644 src/mess/video/arcadia.c delete mode 100644 src/mess/video/atarist.c delete mode 100644 src/mess/video/atarist.h delete mode 100644 src/mess/video/aussiebyte.c delete mode 100644 src/mess/video/avigo.c delete mode 100644 src/mess/video/b2m.c delete mode 100644 src/mess/video/bbc.c delete mode 100644 src/mess/video/bk.c delete mode 100644 src/mess/video/busicom.c delete mode 100644 src/mess/video/cgc7900.c delete mode 100644 src/mess/video/channelf.c delete mode 100644 src/mess/video/comquest.c delete mode 100644 src/mess/video/comx35.c delete mode 100644 src/mess/video/crt.c delete mode 100644 src/mess/video/crt.h delete mode 100644 src/mess/video/dai.c delete mode 100644 src/mess/video/dgn_beta.c delete mode 100644 src/mess/video/electron.c delete mode 100644 src/mess/video/fm7.c delete mode 100644 src/mess/video/fmtowns.c delete mode 100644 src/mess/video/galaxy.c delete mode 100644 src/mess/video/galeb.c delete mode 100644 src/mess/video/gamecom.c delete mode 100644 src/mess/video/gb_lcd.c delete mode 100644 src/mess/video/gb_lcd.h delete mode 100644 src/mess/video/gba.c delete mode 100644 src/mess/video/gime.c delete mode 100644 src/mess/video/gime.h delete mode 100644 src/mess/video/hec2video.c delete mode 100644 src/mess/video/hp48.c delete mode 100644 src/mess/video/intv.c delete mode 100644 src/mess/video/k1ge.c delete mode 100644 src/mess/video/k1ge.h delete mode 100644 src/mess/video/kaypro.c delete mode 100644 src/mess/video/kc.c delete mode 100644 src/mess/video/kramermc.c delete mode 100644 src/mess/video/kyocera.c delete mode 100644 src/mess/video/llc.c delete mode 100644 src/mess/video/lviv.c delete mode 100644 src/mess/video/mac.c delete mode 100644 src/mess/video/maria.c delete mode 100644 src/mess/video/maria.h delete mode 100644 src/mess/video/mbc55x.c delete mode 100644 src/mess/video/mbee.c delete mode 100644 src/mess/video/mc80.c delete mode 100644 src/mess/video/microtan.c delete mode 100644 src/mess/video/mikro80.c delete mode 100644 src/mess/video/mikromik.c delete mode 100644 src/mess/video/mz700.c delete mode 100644 src/mess/video/mz80.c delete mode 100644 src/mess/video/nc.c delete mode 100644 src/mess/video/nes.c delete mode 100644 src/mess/video/newbrain.c delete mode 100644 src/mess/video/newport.c delete mode 100644 src/mess/video/newport.h delete mode 100644 src/mess/video/nick.c delete mode 100644 src/mess/video/nick.h delete mode 100644 src/mess/video/ondra.c delete mode 100644 src/mess/video/orao.c delete mode 100644 src/mess/video/orion.c delete mode 100644 src/mess/video/osi.c delete mode 100644 src/mess/video/p2000m.c delete mode 100644 src/mess/video/pc1251.c delete mode 100644 src/mess/video/pc1350.c delete mode 100644 src/mess/video/pc1401.c delete mode 100644 src/mess/video/pc1403.c delete mode 100644 src/mess/video/pc1512.c delete mode 100644 src/mess/video/pc4.c delete mode 100644 src/mess/video/pc8401a.c delete mode 100644 src/mess/video/pc_t1t.c delete mode 100644 src/mess/video/pc_t1t.h delete mode 100644 src/mess/video/pcd.c delete mode 100644 src/mess/video/pcd.h delete mode 100644 src/mess/video/pcw.c delete mode 100644 src/mess/video/pcw16.c delete mode 100644 src/mess/video/pdp1.c delete mode 100644 src/mess/video/pecom.c delete mode 100644 src/mess/video/pk8020.c delete mode 100644 src/mess/video/pocketc.c delete mode 100644 src/mess/video/poisk1.c delete mode 100644 src/mess/video/poisk1.h delete mode 100644 src/mess/video/poly88.c delete mode 100644 src/mess/video/pp01.c delete mode 100644 src/mess/video/primo.c delete mode 100644 src/mess/video/rm380z.c delete mode 100644 src/mess/video/rmnimbus.c delete mode 100644 src/mess/video/samcoupe.c delete mode 100644 src/mess/video/special.c delete mode 100644 src/mess/video/spectrum.c delete mode 100644 src/mess/video/ssystem3.c delete mode 100644 src/mess/video/stic.c delete mode 100644 src/mess/video/stic.h delete mode 100644 src/mess/video/super80.c delete mode 100644 src/mess/video/thomson.c delete mode 100644 src/mess/video/ti85.c delete mode 100644 src/mess/video/timex.c delete mode 100644 src/mess/video/tmc1800.c delete mode 100644 src/mess/video/tmc600.c delete mode 100644 src/mess/video/trs80.c delete mode 100644 src/mess/video/tx0.c delete mode 100644 src/mess/video/ut88.c delete mode 100644 src/mess/video/uv201.c delete mode 100644 src/mess/video/uv201.h delete mode 100644 src/mess/video/v1050.c delete mode 100644 src/mess/video/vc4000.c delete mode 100644 src/mess/video/vector06.c delete mode 100644 src/mess/video/vtech2.c delete mode 100644 src/mess/video/vtvideo.c delete mode 100644 src/mess/video/vtvideo.h delete mode 100644 src/mess/video/wswan_video.c delete mode 100644 src/mess/video/wswan_video.h delete mode 100644 src/mess/video/x68k.c delete mode 100644 src/mess/video/z88.c delete mode 100644 src/mess/video/zx.c delete mode 100644 src/mess/video/zx8301.c delete mode 100644 src/mess/video/zx8301.h diff --git a/makefile b/makefile index 219df903ec8..5f5ba2a0ac8 100644 --- a/makefile +++ b/makefile @@ -1159,7 +1159,6 @@ CPPCHECK_PARAMS += -Isrc/emu CPPCHECK_PARAMS += -Isrc/lib CPPCHECK_PARAMS += -Isrc/lib/util CPPCHECK_PARAMS += -Isrc/mame -CPPCHECK_PARAMS += -Isrc/mess CPPCHECK_PARAMS += -Isrc/osd/modules/render CPPCHECK_PARAMS += -Isrc/osd/windows CPPCHECK_PARAMS += -Isrc/emu/cpu/m68000 @@ -1174,7 +1173,6 @@ CPPCHECK_PARAMS += -I3rdparty/bgfx/include CPPCHECK_PARAMS += -I3rdparty/bx/include CPPCHECK_PARAMS += -Ibuild/generated/emu CPPCHECK_PARAMS += -Ibuild/generated/emu/layout -CPPCHECK_PARAMS += -Ibuild/generated/mess/layout CPPCHECK_PARAMS += -Ibuild/generated/mame/layout CPPCHECK_PARAMS += -DX64_WINDOWS_ABI CPPCHECK_PARAMS += -DPTR64=1 diff --git a/scripts/genie.lua b/scripts/genie.lua index debf9b19e4d..2cc90f3465e 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1268,6 +1268,7 @@ configuration { "vs2015" } "/wd4463", -- warning C4463: overflow; assigning 1 to bit-field that can only hold values from -1 to 0 "/wd4297", -- warning C4297: 'xxx::~xxx': function assumed not to throw an exception but does "/wd4319", -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size + "/wd4373", -- warning C4373: 'xxx': virtual function overrides 'xxx', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers } configuration { "vs2010" } buildoptions { diff --git a/scripts/src/devices.lua b/scripts/src/devices.lua index a7dc3c69367..6ec60b29826 100644 --- a/scripts/src/devices.lua +++ b/scripts/src/devices.lua @@ -65,8 +65,7 @@ if (_OPTIONS["DRIVERS"] == nil) then MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "src/mess", -- some mess bus devices need this - MAME_DIR .. "src/mame", -- used for nes bus devices + MAME_DIR .. "src/mame", -- used for nes bus devices,some mess bus devices need this GEN_DIR .. "emu", GEN_DIR .. "emu/layout", } diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index 86473380a33..ec3d78c791b 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -709,7 +709,7 @@ includedirs { } files { - MAME_DIR .. "src/mess/tools/castool/main.c", + MAME_DIR .. "src/mame/tools/castool/main.c", } -------------------------------------------------- @@ -768,7 +768,7 @@ includedirs { } files { - MAME_DIR .. "src/mess/tools/floptool/main.c", + MAME_DIR .. "src/mame/tools/floptool/main.c", } -------------------------------------------------- @@ -825,44 +825,44 @@ includedirs { MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty/zlib", - MAME_DIR .. "src/mess/tools/imgtool", + MAME_DIR .. "src/mame/tools/imgtool", } files { - MAME_DIR .. "src/mess/tools/imgtool/main.c", - MAME_DIR .. "src/mess/tools/imgtool/stream.c", - MAME_DIR .. "src/mess/tools/imgtool/library.c", - MAME_DIR .. "src/mess/tools/imgtool/modules.c", - MAME_DIR .. "src/mess/tools/imgtool/iflopimg.c", - MAME_DIR .. "src/mess/tools/imgtool/filter.c", - MAME_DIR .. "src/mess/tools/imgtool/filteoln.c", - MAME_DIR .. "src/mess/tools/imgtool/filtbas.c", - MAME_DIR .. "src/mess/tools/imgtool/imgtool.c", - MAME_DIR .. "src/mess/tools/imgtool/imgterrs.c", - MAME_DIR .. "src/mess/tools/imgtool/imghd.c", - MAME_DIR .. "src/mess/tools/imgtool/charconv.c", - MAME_DIR .. "src/mess/tools/imgtool/formats/vt_dsk.c", - MAME_DIR .. "src/mess/tools/imgtool/formats/vt_dsk.h", - MAME_DIR .. "src/mess/tools/imgtool/formats/coco_dsk.c", - MAME_DIR .. "src/mess/tools/imgtool/formats/coco_dsk.h", - MAME_DIR .. "src/mess/tools/imgtool/modules/amiga.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/macbin.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/rsdos.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/os9.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/mac.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/ti99.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/ti990hd.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/concept.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/fat.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/pc_flop.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/pc_hard.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/prodos.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/vzdos.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/thomson.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/macutil.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/cybiko.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/cybikoxt.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/psion.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/bml3.c", - MAME_DIR .. "src/mess/tools/imgtool/modules/hp48.c", + MAME_DIR .. "src/mame/tools/imgtool/main.c", + MAME_DIR .. "src/mame/tools/imgtool/stream.c", + MAME_DIR .. "src/mame/tools/imgtool/library.c", + MAME_DIR .. "src/mame/tools/imgtool/modules.c", + MAME_DIR .. "src/mame/tools/imgtool/iflopimg.c", + MAME_DIR .. "src/mame/tools/imgtool/filter.c", + MAME_DIR .. "src/mame/tools/imgtool/filteoln.c", + MAME_DIR .. "src/mame/tools/imgtool/filtbas.c", + MAME_DIR .. "src/mame/tools/imgtool/imgtool.c", + MAME_DIR .. "src/mame/tools/imgtool/imgterrs.c", + MAME_DIR .. "src/mame/tools/imgtool/imghd.c", + MAME_DIR .. "src/mame/tools/imgtool/charconv.c", + MAME_DIR .. "src/mame/tools/imgtool/formats/vt_dsk.c", + MAME_DIR .. "src/mame/tools/imgtool/formats/vt_dsk.h", + MAME_DIR .. "src/mame/tools/imgtool/formats/coco_dsk.c", + MAME_DIR .. "src/mame/tools/imgtool/formats/coco_dsk.h", + MAME_DIR .. "src/mame/tools/imgtool/modules/amiga.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/macbin.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/rsdos.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/os9.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/mac.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/ti99.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/ti990hd.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/concept.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/fat.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/pc_flop.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/pc_hard.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/prodos.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/vzdos.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/thomson.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/macutil.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/cybiko.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/cybikoxt.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/psion.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/bml3.c", + MAME_DIR .. "src/mame/tools/imgtool/modules/hp48.c", } diff --git a/scripts/target/mame/dummy.lua b/scripts/target/mame/dummy.lua index 9021b774859..be09e5f97cd 100644 --- a/scripts/target/mame/dummy.lua +++ b/scripts/target/mame/dummy.lua @@ -26,7 +26,7 @@ function createProjects_mame_dummy(_target, _subtarget) MAME_DIR .. "src/osd", MAME_DIR .. "src/emu", MAME_DIR .. "src/devices", - MAME_DIR .. "src/mess", + MAME_DIR .. "src/mame", MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", @@ -34,8 +34,8 @@ function createProjects_mame_dummy(_target, _subtarget) } files{ - MAME_DIR .. "src/mess/drivers/coleco.c", - MAME_DIR .. "src/mess/machine/coleco.c", + MAME_DIR .. "src/mame/drivers/coleco.c", + MAME_DIR .. "src/mame/machine/coleco.c", } end diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index e9719710161..4dbe1733ffd 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -887,7 +887,6 @@ function createMESSProjects(_target, _subtarget, _name) MAME_DIR .. "src/osd", MAME_DIR .. "src/emu", MAME_DIR .. "src/devices", - MAME_DIR .. "src/mess", MAME_DIR .. "src/mame", MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", @@ -999,14 +998,14 @@ end -------------------------------------------------- createMESSProjects(_target, _subtarget, "messshared") files { - MAME_DIR .. "src/mess/audio/mea8000.c", - MAME_DIR .. "src/mess/machine/appldriv.c", - MAME_DIR .. "src/mess/machine/applefdc.c", - MAME_DIR .. "src/mess/machine/microdrv.c", - MAME_DIR .. "src/mess/machine/smartmed.c", - MAME_DIR .. "src/mess/machine/sonydriv.c", - MAME_DIR .. "src/mess/machine/teleprinter.c", - MAME_DIR .. "src/mess/machine/z80bin.c", + MAME_DIR .. "src/mame/audio/mea8000.c", + MAME_DIR .. "src/mame/machine/appldriv.c", + MAME_DIR .. "src/mame/machine/applefdc.c", + MAME_DIR .. "src/mame/machine/microdrv.c", + MAME_DIR .. "src/mame/machine/smartmed.c", + MAME_DIR .. "src/mame/machine/sonydriv.c", + MAME_DIR .. "src/mame/machine/teleprinter.c", + MAME_DIR .. "src/mame/machine/z80bin.c", } -------------------------------------------------- -- manufacturer-specific groupings for drivers @@ -1014,1732 +1013,1732 @@ files { createMESSProjects(_target, _subtarget, "acorn") files { - MAME_DIR .. "src/mess/drivers/a310.c", - MAME_DIR .. "src/mess/drivers/a6809.c", - MAME_DIR .. "src/mess/drivers/acrnsys1.c", - MAME_DIR .. "src/mess/drivers/atom.c", - MAME_DIR .. "src/mess/drivers/bbc.c", - MAME_DIR .. "src/mess/machine/bbc.c", - MAME_DIR .. "src/mess/video/bbc.c", - MAME_DIR .. "src/mess/drivers/bbcbc.c", - MAME_DIR .. "src/mess/drivers/electron.c", - MAME_DIR .. "src/mess/machine/electron.c", - MAME_DIR .. "src/mess/video/electron.c", - MAME_DIR .. "src/mess/drivers/riscpc.c", - MAME_DIR .. "src/mess/drivers/z88.c", - MAME_DIR .. "src/mess/machine/upd65031.c", - MAME_DIR .. "src/mess/video/z88.c", + MAME_DIR .. "src/mame/drivers/a310.c", + MAME_DIR .. "src/mame/drivers/a6809.c", + MAME_DIR .. "src/mame/drivers/acrnsys1.c", + MAME_DIR .. "src/mame/drivers/atom.c", + MAME_DIR .. "src/mame/drivers/bbc.c", + MAME_DIR .. "src/mame/machine/bbc.c", + MAME_DIR .. "src/mame/video/bbc.c", + MAME_DIR .. "src/mame/drivers/bbcbc.c", + MAME_DIR .. "src/mame/drivers/electron.c", + MAME_DIR .. "src/mame/machine/electron.c", + MAME_DIR .. "src/mame/video/electron.c", + MAME_DIR .. "src/mame/drivers/riscpc.c", + MAME_DIR .. "src/mame/drivers/z88.c", + MAME_DIR .. "src/mame/machine/upd65031.c", + MAME_DIR .. "src/mame/video/z88.c", } createMESSProjects(_target, _subtarget, "act") files { - MAME_DIR .. "src/mess/drivers/apricot.c", - MAME_DIR .. "src/mess/drivers/apricotf.c", - MAME_DIR .. "src/mess/drivers/apricotp.c", - MAME_DIR .. "src/mess/machine/apricotkb.c", - MAME_DIR .. "src/mess/machine/apricotkb_hle.c", - MAME_DIR .. "src/mess/drivers/victor9k.c", - MAME_DIR .. "src/mess/machine/victor9kb.c", - MAME_DIR .. "src/mess/machine/victor9k_fdc.c", + MAME_DIR .. "src/mame/drivers/apricot.c", + MAME_DIR .. "src/mame/drivers/apricotf.c", + MAME_DIR .. "src/mame/drivers/apricotp.c", + MAME_DIR .. "src/mame/machine/apricotkb.c", + MAME_DIR .. "src/mame/machine/apricotkb_hle.c", + MAME_DIR .. "src/mame/drivers/victor9k.c", + MAME_DIR .. "src/mame/machine/victor9kb.c", + MAME_DIR .. "src/mame/machine/victor9k_fdc.c", } createMESSProjects(_target, _subtarget, "adc") files { - MAME_DIR .. "src/mess/drivers/super6.c", - MAME_DIR .. "src/mess/drivers/superslave.c", + MAME_DIR .. "src/mame/drivers/super6.c", + MAME_DIR .. "src/mame/drivers/superslave.c", } createMESSProjects(_target, _subtarget, "alesis") files { - MAME_DIR .. "src/mess/drivers/alesis.c", - MAME_DIR .. "src/mess/audio/alesis.c", - MAME_DIR .. "src/mess/video/alesis.c", + MAME_DIR .. "src/mame/drivers/alesis.c", + MAME_DIR .. "src/mame/audio/alesis.c", + MAME_DIR .. "src/mame/video/alesis.c", } createMESSProjects(_target, _subtarget, "altos") files { - MAME_DIR .. "src/mess/drivers/altos5.c", + MAME_DIR .. "src/mame/drivers/altos5.c", } createMESSProjects(_target, _subtarget, "amiga") files { - MAME_DIR .. "src/mess/drivers/amiga.c", - MAME_DIR .. "src/mess/machine/amigakbd.c", + MAME_DIR .. "src/mame/drivers/amiga.c", + MAME_DIR .. "src/mame/machine/amigakbd.c", } createMESSProjects(_target, _subtarget, "amstrad") files { - MAME_DIR .. "src/mess/drivers/amstrad.c", - MAME_DIR .. "src/mess/machine/amstrad.c", - MAME_DIR .. "src/mess/drivers/amstr_pc.c", - MAME_DIR .. "src/mess/drivers/nc.c", - MAME_DIR .. "src/mess/machine/nc.c", - MAME_DIR .. "src/mess/video/nc.c", - MAME_DIR .. "src/mess/drivers/pc1512.c", - MAME_DIR .. "src/mess/machine/pc1512kb.c", - MAME_DIR .. "src/mess/video/pc1512.c", - MAME_DIR .. "src/mess/drivers/pcw.c", - MAME_DIR .. "src/mess/video/pcw.c", - MAME_DIR .. "src/mess/drivers/pcw16.c", - MAME_DIR .. "src/mess/video/pcw16.c", - MAME_DIR .. "src/mess/drivers/pda600.c", + MAME_DIR .. "src/mame/drivers/amstrad.c", + MAME_DIR .. "src/mame/machine/amstrad.c", + MAME_DIR .. "src/mame/drivers/amstr_pc.c", + MAME_DIR .. "src/mame/drivers/nc.c", + MAME_DIR .. "src/mame/machine/nc.c", + MAME_DIR .. "src/mame/video/nc.c", + MAME_DIR .. "src/mame/drivers/pc1512.c", + MAME_DIR .. "src/mame/machine/pc1512kb.c", + MAME_DIR .. "src/mame/video/pc1512.c", + MAME_DIR .. "src/mame/drivers/pcw.c", + MAME_DIR .. "src/mame/video/pcw.c", + MAME_DIR .. "src/mame/drivers/pcw16.c", + MAME_DIR .. "src/mame/video/pcw16.c", + MAME_DIR .. "src/mame/drivers/pda600.c", } createMESSProjects(_target, _subtarget, "apf") files { - MAME_DIR .. "src/mess/drivers/apf.c", + MAME_DIR .. "src/mame/drivers/apf.c", } createMESSProjects(_target, _subtarget, "apollo") files { - MAME_DIR .. "src/mess/drivers/apollo.c", - MAME_DIR .. "src/mess/machine/apollo.c", - MAME_DIR .. "src/mess/machine/apollo_dbg.c", - MAME_DIR .. "src/mess/machine/apollo_kbd.c", - MAME_DIR .. "src/mess/video/apollo.c", + MAME_DIR .. "src/mame/drivers/apollo.c", + MAME_DIR .. "src/mame/machine/apollo.c", + MAME_DIR .. "src/mame/machine/apollo_dbg.c", + MAME_DIR .. "src/mame/machine/apollo_kbd.c", + MAME_DIR .. "src/mame/video/apollo.c", } createMESSProjects(_target, _subtarget, "apple") files { - MAME_DIR .. "src/mess/drivers/apple1.c", - MAME_DIR .. "src/mess/machine/apple1.c", - MAME_DIR .. "src/mess/video/apple1.c", - MAME_DIR .. "src/mess/drivers/apple2.c", - MAME_DIR .. "src/mess/drivers/apple2e.c", - MAME_DIR .. "src/mess/machine/apple2.c", - MAME_DIR .. "src/mess/video/apple2.c", - MAME_DIR .. "src/mess/drivers/tk2000.c", - MAME_DIR .. "src/mess/drivers/apple2gs.c", - MAME_DIR .. "src/mess/machine/apple2gs.c", - MAME_DIR .. "src/mess/video/apple2gs.c", - MAME_DIR .. "src/mess/drivers/apple3.c", - MAME_DIR .. "src/mess/machine/apple3.c", - MAME_DIR .. "src/mess/video/apple3.c", - MAME_DIR .. "src/mess/drivers/lisa.c", - MAME_DIR .. "src/mess/machine/lisa.c", - MAME_DIR .. "src/mess/drivers/mac.c", - MAME_DIR .. "src/mess/audio/mac.c", - MAME_DIR .. "src/mess/machine/egret.c", - MAME_DIR .. "src/mess/machine/mac.c", - MAME_DIR .. "src/mess/machine/macadb.c", - MAME_DIR .. "src/mess/machine/macrtc.c", - MAME_DIR .. "src/mess/machine/mackbd.c", - MAME_DIR .. "src/mess/machine/swim.c", - MAME_DIR .. "src/mess/video/mac.c", - MAME_DIR .. "src/mess/drivers/macpci.c", - MAME_DIR .. "src/mess/machine/macpci.c", - MAME_DIR .. "src/mess/machine/cuda.c", + MAME_DIR .. "src/mame/drivers/apple1.c", + MAME_DIR .. "src/mame/machine/apple1.c", + MAME_DIR .. "src/mame/video/apple1.c", + MAME_DIR .. "src/mame/drivers/apple2.c", + MAME_DIR .. "src/mame/drivers/apple2e.c", + MAME_DIR .. "src/mame/machine/apple2.c", + MAME_DIR .. "src/mame/video/apple2.c", + MAME_DIR .. "src/mame/drivers/tk2000.c", + MAME_DIR .. "src/mame/drivers/apple2gs.c", + MAME_DIR .. "src/mame/machine/apple2gs.c", + MAME_DIR .. "src/mame/video/apple2gs.c", + MAME_DIR .. "src/mame/drivers/apple3.c", + MAME_DIR .. "src/mame/machine/apple3.c", + MAME_DIR .. "src/mame/video/apple3.c", + MAME_DIR .. "src/mame/drivers/lisa.c", + MAME_DIR .. "src/mame/machine/lisa.c", + MAME_DIR .. "src/mame/drivers/mac.c", + MAME_DIR .. "src/mame/audio/mac.c", + MAME_DIR .. "src/mame/machine/egret.c", + MAME_DIR .. "src/mame/machine/mac.c", + MAME_DIR .. "src/mame/machine/macadb.c", + MAME_DIR .. "src/mame/machine/macrtc.c", + MAME_DIR .. "src/mame/machine/mackbd.c", + MAME_DIR .. "src/mame/machine/swim.c", + MAME_DIR .. "src/mame/video/mac.c", + MAME_DIR .. "src/mame/drivers/macpci.c", + MAME_DIR .. "src/mame/machine/macpci.c", + MAME_DIR .. "src/mame/machine/cuda.c", } createMESSProjects(_target, _subtarget, "applied") files { - MAME_DIR .. "src/mess/drivers/mbee.c", - MAME_DIR .. "src/mess/machine/mbee.c", - MAME_DIR .. "src/mess/video/mbee.c", + MAME_DIR .. "src/mame/drivers/mbee.c", + MAME_DIR .. "src/mame/machine/mbee.c", + MAME_DIR .. "src/mame/video/mbee.c", } createMESSProjects(_target, _subtarget, "arcadia") files { - MAME_DIR .. "src/mess/drivers/arcadia.c", - MAME_DIR .. "src/mess/audio/arcadia.c", - MAME_DIR .. "src/mess/video/arcadia.c", + MAME_DIR .. "src/mame/drivers/arcadia.c", + MAME_DIR .. "src/mame/audio/arcadia.c", + MAME_DIR .. "src/mame/video/arcadia.c", } createMESSProjects(_target, _subtarget, "ascii") files { - MAME_DIR .. "src/mess/drivers/msx.c", - MAME_DIR .. "src/mess/machine/msx.c", - MAME_DIR .. "src/mess/machine/msx_matsushita.c", - MAME_DIR .. "src/mess/machine/msx_s1985.c", - MAME_DIR .. "src/mess/machine/msx_switched.c", - MAME_DIR .. "src/mess/machine/msx_systemflags.c", + MAME_DIR .. "src/mame/drivers/msx.c", + MAME_DIR .. "src/mame/machine/msx.c", + MAME_DIR .. "src/mame/machine/msx_matsushita.c", + MAME_DIR .. "src/mame/machine/msx_s1985.c", + MAME_DIR .. "src/mame/machine/msx_switched.c", + MAME_DIR .. "src/mame/machine/msx_systemflags.c", } createMESSProjects(_target, _subtarget, "at") files { - MAME_DIR .. "src/mess/drivers/at.c", - MAME_DIR .. "src/mess/machine/at.c", - MAME_DIR .. "src/mess/drivers/ct486.c", + MAME_DIR .. "src/mame/drivers/at.c", + MAME_DIR .. "src/mame/machine/at.c", + MAME_DIR .. "src/mame/drivers/ct486.c", } createMESSProjects(_target, _subtarget, "atari") files { - MAME_DIR .. "src/mess/drivers/a2600.c", - MAME_DIR .. "src/mess/drivers/a7800.c", - MAME_DIR .. "src/mess/video/maria.c", - MAME_DIR .. "src/mess/drivers/atari400.c", - MAME_DIR .. "src/mess/machine/atarifdc.c", - MAME_DIR .. "src/mess/drivers/atarist.c", - MAME_DIR .. "src/mess/video/atarist.c", - MAME_DIR .. "src/mess/drivers/lynx.c", - MAME_DIR .. "src/mess/audio/lynx.c", - MAME_DIR .. "src/mess/machine/lynx.c", - MAME_DIR .. "src/mess/drivers/portfoli.c", + MAME_DIR .. "src/mame/drivers/a2600.c", + MAME_DIR .. "src/mame/drivers/a7800.c", + MAME_DIR .. "src/mame/video/maria.c", + MAME_DIR .. "src/mame/drivers/atari400.c", + MAME_DIR .. "src/mame/machine/atarifdc.c", + MAME_DIR .. "src/mame/drivers/atarist.c", + MAME_DIR .. "src/mame/video/atarist.c", + MAME_DIR .. "src/mame/drivers/lynx.c", + MAME_DIR .. "src/mame/audio/lynx.c", + MAME_DIR .. "src/mame/machine/lynx.c", + MAME_DIR .. "src/mame/drivers/portfoli.c", } createMESSProjects(_target, _subtarget, "att") files { - MAME_DIR .. "src/mess/drivers/unixpc.c", + MAME_DIR .. "src/mame/drivers/unixpc.c", } createMESSProjects(_target, _subtarget, "bally") files { - MAME_DIR .. "src/mess/drivers/astrohome.c", + MAME_DIR .. "src/mame/drivers/astrohome.c", } createMESSProjects(_target, _subtarget, "banctec") files { - MAME_DIR .. "src/mess/drivers/banctec.c", + MAME_DIR .. "src/mame/drivers/banctec.c", } createMESSProjects(_target, _subtarget, "bandai") files { - MAME_DIR .. "src/mess/drivers/sv8000.c", - MAME_DIR .. "src/mess/drivers/rx78.c", - MAME_DIR .. "src/mess/drivers/tamag1.c", - MAME_DIR .. "src/mess/drivers/wswan.c", - MAME_DIR .. "src/mess/audio/wswan_snd.c", - MAME_DIR .. "src/mess/machine/wswan.c", - MAME_DIR .. "src/mess/video/wswan_video.c", + MAME_DIR .. "src/mame/drivers/sv8000.c", + MAME_DIR .. "src/mame/drivers/rx78.c", + MAME_DIR .. "src/mame/drivers/tamag1.c", + MAME_DIR .. "src/mame/drivers/wswan.c", + MAME_DIR .. "src/mame/audio/wswan_snd.c", + MAME_DIR .. "src/mame/machine/wswan.c", + MAME_DIR .. "src/mame/video/wswan_video.c", } createMESSProjects(_target, _subtarget, "be") files { - MAME_DIR .. "src/mess/drivers/bebox.c", - MAME_DIR .. "src/mess/machine/bebox.c", + MAME_DIR .. "src/mame/drivers/bebox.c", + MAME_DIR .. "src/mame/machine/bebox.c", } createMESSProjects(_target, _subtarget, "bnpo") files { - MAME_DIR .. "src/mess/drivers/b2m.c", - MAME_DIR .. "src/mess/machine/b2m.c", - MAME_DIR .. "src/mess/video/b2m.c", + MAME_DIR .. "src/mame/drivers/b2m.c", + MAME_DIR .. "src/mame/machine/b2m.c", + MAME_DIR .. "src/mame/video/b2m.c", } createMESSProjects(_target, _subtarget, "bondwell") files { - MAME_DIR .. "src/mess/drivers/bw12.c", - MAME_DIR .. "src/mess/drivers/bw2.c", + MAME_DIR .. "src/mame/drivers/bw12.c", + MAME_DIR .. "src/mame/drivers/bw2.c", } createMESSProjects(_target, _subtarget, "booth") files { - MAME_DIR .. "src/mess/drivers/apexc.c", + MAME_DIR .. "src/mame/drivers/apexc.c", } createMESSProjects(_target, _subtarget, "byte") files { - MAME_DIR .. "src/mess/drivers/zapcomputer.c", + MAME_DIR .. "src/mame/drivers/zapcomputer.c", } createMESSProjects(_target, _subtarget, "camputers") files { - MAME_DIR .. "src/mess/drivers/camplynx.c", + MAME_DIR .. "src/mame/drivers/camplynx.c", } createMESSProjects(_target, _subtarget, "canon") files { - MAME_DIR .. "src/mess/drivers/cat.c", - MAME_DIR .. "src/mess/drivers/x07.c", - MAME_DIR .. "src/mess/drivers/canon_s80.c", + MAME_DIR .. "src/mame/drivers/cat.c", + MAME_DIR .. "src/mame/drivers/x07.c", + MAME_DIR .. "src/mame/drivers/canon_s80.c", } createMESSProjects(_target, _subtarget, "cantab") files { - MAME_DIR .. "src/mess/drivers/jupace.c", + MAME_DIR .. "src/mame/drivers/jupace.c", } createMESSProjects(_target, _subtarget, "casio") files { - MAME_DIR .. "src/mess/drivers/casloopy.c", - MAME_DIR .. "src/mess/drivers/cfx9850.c", - MAME_DIR .. "src/mess/drivers/fp200.c", - MAME_DIR .. "src/mess/drivers/fp1100.c", - MAME_DIR .. "src/mess/drivers/fp6000.c", - MAME_DIR .. "src/mess/drivers/pb1000.c", - MAME_DIR .. "src/mess/drivers/pv1000.c", - MAME_DIR .. "src/mess/drivers/pv2000.c", + MAME_DIR .. "src/mame/drivers/casloopy.c", + MAME_DIR .. "src/mame/drivers/cfx9850.c", + MAME_DIR .. "src/mame/drivers/fp200.c", + MAME_DIR .. "src/mame/drivers/fp1100.c", + MAME_DIR .. "src/mame/drivers/fp6000.c", + MAME_DIR .. "src/mame/drivers/pb1000.c", + MAME_DIR .. "src/mame/drivers/pv1000.c", + MAME_DIR .. "src/mame/drivers/pv2000.c", } createMESSProjects(_target, _subtarget, "cbm") files { - MAME_DIR .. "src/mess/drivers/c128.c", - MAME_DIR .. "src/mess/drivers/c64.c", - MAME_DIR .. "src/mess/drivers/c64dtv.c", - MAME_DIR .. "src/mess/drivers/c65.c", - MAME_DIR .. "src/mess/drivers/c900.c", - MAME_DIR .. "src/mess/drivers/cbm2.c", - MAME_DIR .. "src/mess/drivers/clcd.c", - MAME_DIR .. "src/mess/drivers/pet.c", - MAME_DIR .. "src/mess/drivers/plus4.c", - MAME_DIR .. "src/mess/drivers/vic10.c", - MAME_DIR .. "src/mess/drivers/vic20.c", - MAME_DIR .. "src/mess/machine/cbm_snqk.c", - MAME_DIR .. "src/mess/drivers/mps1230.c", + MAME_DIR .. "src/mame/drivers/c128.c", + MAME_DIR .. "src/mame/drivers/c64.c", + MAME_DIR .. "src/mame/drivers/c64dtv.c", + MAME_DIR .. "src/mame/drivers/c65.c", + MAME_DIR .. "src/mame/drivers/c900.c", + MAME_DIR .. "src/mame/drivers/cbm2.c", + MAME_DIR .. "src/mame/drivers/clcd.c", + MAME_DIR .. "src/mame/drivers/pet.c", + MAME_DIR .. "src/mame/drivers/plus4.c", + MAME_DIR .. "src/mame/drivers/vic10.c", + MAME_DIR .. "src/mame/drivers/vic20.c", + MAME_DIR .. "src/mame/machine/cbm_snqk.c", + MAME_DIR .. "src/mame/drivers/mps1230.c", } createMESSProjects(_target, _subtarget, "cccp") files { - MAME_DIR .. "src/mess/drivers/argo.c", - MAME_DIR .. "src/mess/drivers/cm1800.c", - MAME_DIR .. "src/mess/drivers/lviv.c", - MAME_DIR .. "src/mess/machine/lviv.c", - MAME_DIR .. "src/mess/video/lviv.c", - MAME_DIR .. "src/mess/drivers/mikro80.c", - MAME_DIR .. "src/mess/machine/mikro80.c", - MAME_DIR .. "src/mess/video/mikro80.c", - MAME_DIR .. "src/mess/drivers/pk8000.c", - MAME_DIR .. "src/mess/drivers/pk8020.c", - MAME_DIR .. "src/mess/machine/pk8020.c", - MAME_DIR .. "src/mess/video/pk8020.c", - MAME_DIR .. "src/mess/drivers/pyl601.c", - MAME_DIR .. "src/mess/drivers/sm1800.c", - MAME_DIR .. "src/mess/drivers/uknc.c", - MAME_DIR .. "src/mess/drivers/unior.c", - MAME_DIR .. "src/mess/drivers/ut88.c", - MAME_DIR .. "src/mess/machine/ut88.c", - MAME_DIR .. "src/mess/video/ut88.c", - MAME_DIR .. "src/mess/drivers/vector06.c", - MAME_DIR .. "src/mess/machine/vector06.c", - MAME_DIR .. "src/mess/video/vector06.c", - MAME_DIR .. "src/mess/drivers/vta2000.c", + MAME_DIR .. "src/mame/drivers/argo.c", + MAME_DIR .. "src/mame/drivers/cm1800.c", + MAME_DIR .. "src/mame/drivers/lviv.c", + MAME_DIR .. "src/mame/machine/lviv.c", + MAME_DIR .. "src/mame/video/lviv.c", + MAME_DIR .. "src/mame/drivers/mikro80.c", + MAME_DIR .. "src/mame/machine/mikro80.c", + MAME_DIR .. "src/mame/video/mikro80.c", + MAME_DIR .. "src/mame/drivers/pk8000.c", + MAME_DIR .. "src/mame/drivers/pk8020.c", + MAME_DIR .. "src/mame/machine/pk8020.c", + MAME_DIR .. "src/mame/video/pk8020.c", + MAME_DIR .. "src/mame/drivers/pyl601.c", + MAME_DIR .. "src/mame/drivers/sm1800.c", + MAME_DIR .. "src/mame/drivers/uknc.c", + MAME_DIR .. "src/mame/drivers/unior.c", + MAME_DIR .. "src/mame/drivers/ut88.c", + MAME_DIR .. "src/mame/machine/ut88.c", + MAME_DIR .. "src/mame/video/ut88.c", + MAME_DIR .. "src/mame/drivers/vector06.c", + MAME_DIR .. "src/mame/machine/vector06.c", + MAME_DIR .. "src/mame/video/vector06.c", + MAME_DIR .. "src/mame/drivers/vta2000.c", } createMESSProjects(_target, _subtarget, "cce") files { - MAME_DIR .. "src/mess/drivers/mc1000.c", + MAME_DIR .. "src/mame/drivers/mc1000.c", } createMESSProjects(_target, _subtarget, "ccs") files { - MAME_DIR .. "src/mess/drivers/ccs2810.c", - MAME_DIR .. "src/mess/drivers/ccs300.c", + MAME_DIR .. "src/mame/drivers/ccs2810.c", + MAME_DIR .. "src/mame/drivers/ccs300.c", } createMESSProjects(_target, _subtarget, "chromatics") files { - MAME_DIR .. "src/mess/drivers/cgc7900.c", - MAME_DIR .. "src/mess/video/cgc7900.c", + MAME_DIR .. "src/mame/drivers/cgc7900.c", + MAME_DIR .. "src/mame/video/cgc7900.c", } createMESSProjects(_target, _subtarget, "coleco") files { - MAME_DIR .. "src/mess/drivers/adam.c", - MAME_DIR .. "src/mess/drivers/coleco.c", - MAME_DIR .. "src/mess/machine/coleco.c", + MAME_DIR .. "src/mame/drivers/adam.c", + MAME_DIR .. "src/mame/drivers/coleco.c", + MAME_DIR .. "src/mame/machine/coleco.c", } createMESSProjects(_target, _subtarget, "cromemco") files { - MAME_DIR .. "src/mess/drivers/c10.c", - MAME_DIR .. "src/mess/drivers/mcb216.c", + MAME_DIR .. "src/mame/drivers/c10.c", + MAME_DIR .. "src/mame/drivers/mcb216.c", } createMESSProjects(_target, _subtarget, "comx") files { - MAME_DIR .. "src/mess/drivers/comx35.c", - MAME_DIR .. "src/mess/video/comx35.c", + MAME_DIR .. "src/mame/drivers/comx35.c", + MAME_DIR .. "src/mame/video/comx35.c", } createMESSProjects(_target, _subtarget, "concept") files { - MAME_DIR .. "src/mess/drivers/concept.c", - MAME_DIR .. "src/mess/machine/concept.c", + MAME_DIR .. "src/mame/drivers/concept.c", + MAME_DIR .. "src/mame/machine/concept.c", } createMESSProjects(_target, _subtarget, "conitec") files { - MAME_DIR .. "src/mess/drivers/prof180x.c", - MAME_DIR .. "src/mess/drivers/prof80.c", - MAME_DIR .. "src/mess/machine/prof80mmu.c", + MAME_DIR .. "src/mame/drivers/prof180x.c", + MAME_DIR .. "src/mame/drivers/prof80.c", + MAME_DIR .. "src/mame/machine/prof80mmu.c", } createMESSProjects(_target, _subtarget, "cybiko") files { - MAME_DIR .. "src/mess/drivers/cybiko.c", - MAME_DIR .. "src/mess/machine/cybiko.c", + MAME_DIR .. "src/mame/drivers/cybiko.c", + MAME_DIR .. "src/mame/machine/cybiko.c", } createMESSProjects(_target, _subtarget, "dai") files { - MAME_DIR .. "src/mess/drivers/dai.c", - MAME_DIR .. "src/mess/audio/dai_snd.c", - MAME_DIR .. "src/mess/machine/dai.c", - MAME_DIR .. "src/mess/video/dai.c", + MAME_DIR .. "src/mame/drivers/dai.c", + MAME_DIR .. "src/mame/audio/dai_snd.c", + MAME_DIR .. "src/mame/machine/dai.c", + MAME_DIR .. "src/mame/video/dai.c", } createMESSProjects(_target, _subtarget, "ddr") files { - MAME_DIR .. "src/mess/drivers/ac1.c", - MAME_DIR .. "src/mess/machine/ac1.c", - MAME_DIR .. "src/mess/video/ac1.c", - MAME_DIR .. "src/mess/drivers/bcs3.c", - MAME_DIR .. "src/mess/drivers/c80.c", - MAME_DIR .. "src/mess/drivers/huebler.c", - MAME_DIR .. "src/mess/drivers/jtc.c", - MAME_DIR .. "src/mess/drivers/kramermc.c", - MAME_DIR .. "src/mess/machine/kramermc.c", - MAME_DIR .. "src/mess/video/kramermc.c", - MAME_DIR .. "src/mess/drivers/llc.c", - MAME_DIR .. "src/mess/machine/llc.c", - MAME_DIR .. "src/mess/video/llc.c", - MAME_DIR .. "src/mess/drivers/nanos.c", - MAME_DIR .. "src/mess/drivers/pcm.c", - MAME_DIR .. "src/mess/drivers/vcs80.c", - MAME_DIR .. "src/mess/machine/k7659kb.c", + MAME_DIR .. "src/mame/drivers/ac1.c", + MAME_DIR .. "src/mame/machine/ac1.c", + MAME_DIR .. "src/mame/video/ac1.c", + MAME_DIR .. "src/mame/drivers/bcs3.c", + MAME_DIR .. "src/mame/drivers/c80.c", + MAME_DIR .. "src/mame/drivers/huebler.c", + MAME_DIR .. "src/mame/drivers/jtc.c", + MAME_DIR .. "src/mame/drivers/kramermc.c", + MAME_DIR .. "src/mame/machine/kramermc.c", + MAME_DIR .. "src/mame/video/kramermc.c", + MAME_DIR .. "src/mame/drivers/llc.c", + MAME_DIR .. "src/mame/machine/llc.c", + MAME_DIR .. "src/mame/video/llc.c", + MAME_DIR .. "src/mame/drivers/nanos.c", + MAME_DIR .. "src/mame/drivers/pcm.c", + MAME_DIR .. "src/mame/drivers/vcs80.c", + MAME_DIR .. "src/mame/machine/k7659kb.c", } createMESSProjects(_target, _subtarget, "dec") files { - MAME_DIR .. "src/mess/drivers/dct11em.c", - MAME_DIR .. "src/mess/drivers/dectalk.c", - MAME_DIR .. "src/mess/drivers/decwritr.c", - MAME_DIR .. "src/mess/drivers/pdp11.c", - MAME_DIR .. "src/mess/drivers/vax11.c", - MAME_DIR .. "src/mess/drivers/rainbow.c", - MAME_DIR .. "src/mess/drivers/vk100.c", - MAME_DIR .. "src/mess/drivers/vt100.c", - MAME_DIR .. "src/mess/drivers/vt220.c", - MAME_DIR .. "src/mess/drivers/vt240.c", - MAME_DIR .. "src/mess/drivers/vt320.c", - MAME_DIR .. "src/mess/drivers/vt520.c", - MAME_DIR .. "src/mess/machine/dec_lk201.c", - MAME_DIR .. "src/mess/machine/rx01.c", - MAME_DIR .. "src/mess/video/vtvideo.c", + MAME_DIR .. "src/mame/drivers/dct11em.c", + MAME_DIR .. "src/mame/drivers/dectalk.c", + MAME_DIR .. "src/mame/drivers/decwritr.c", + MAME_DIR .. "src/mame/drivers/pdp11.c", + MAME_DIR .. "src/mame/drivers/vax11.c", + MAME_DIR .. "src/mame/drivers/rainbow.c", + MAME_DIR .. "src/mame/drivers/vk100.c", + MAME_DIR .. "src/mame/drivers/vt100.c", + MAME_DIR .. "src/mame/drivers/vt220.c", + MAME_DIR .. "src/mame/drivers/vt240.c", + MAME_DIR .. "src/mame/drivers/vt320.c", + MAME_DIR .. "src/mame/drivers/vt520.c", + MAME_DIR .. "src/mame/machine/dec_lk201.c", + MAME_DIR .. "src/mame/machine/rx01.c", + MAME_DIR .. "src/mame/video/vtvideo.c", } createMESSProjects(_target, _subtarget, "dicksmth") files { - MAME_DIR .. "src/mess/drivers/super80.c", - MAME_DIR .. "src/mess/machine/super80.c", - MAME_DIR .. "src/mess/video/super80.c", + MAME_DIR .. "src/mame/drivers/super80.c", + MAME_DIR .. "src/mame/machine/super80.c", + MAME_DIR .. "src/mame/video/super80.c", } createMESSProjects(_target, _subtarget, "dms") files { - MAME_DIR .. "src/mess/drivers/dms5000.c", - MAME_DIR .. "src/mess/drivers/dms86.c", - MAME_DIR .. "src/mess/drivers/zsbc3.c", + MAME_DIR .. "src/mame/drivers/dms5000.c", + MAME_DIR .. "src/mame/drivers/dms86.c", + MAME_DIR .. "src/mame/drivers/zsbc3.c", } createMESSProjects(_target, _subtarget, "dragon") files { - MAME_DIR .. "src/mess/drivers/dgn_beta.c", - MAME_DIR .. "src/mess/machine/dgn_beta.c", - MAME_DIR .. "src/mess/video/dgn_beta.c", + MAME_DIR .. "src/mame/drivers/dgn_beta.c", + MAME_DIR .. "src/mame/machine/dgn_beta.c", + MAME_DIR .. "src/mame/video/dgn_beta.c", } createMESSProjects(_target, _subtarget, "drc") files { - MAME_DIR .. "src/mess/drivers/zrt80.c", + MAME_DIR .. "src/mame/drivers/zrt80.c", } createMESSProjects(_target, _subtarget, "eaca") files { - MAME_DIR .. "src/mess/drivers/cgenie.c", + MAME_DIR .. "src/mame/drivers/cgenie.c", } createMESSProjects(_target, _subtarget, "einis") files { - MAME_DIR .. "src/mess/drivers/pecom.c", - MAME_DIR .. "src/mess/machine/pecom.c", - MAME_DIR .. "src/mess/video/pecom.c", + MAME_DIR .. "src/mame/drivers/pecom.c", + MAME_DIR .. "src/mame/machine/pecom.c", + MAME_DIR .. "src/mame/video/pecom.c", } createMESSProjects(_target, _subtarget, "elektrka") files { - MAME_DIR .. "src/mess/drivers/bk.c", - MAME_DIR .. "src/mess/machine/bk.c", - MAME_DIR .. "src/mess/video/bk.c", - MAME_DIR .. "src/mess/drivers/dvk_kcgd.c", - MAME_DIR .. "src/mess/drivers/dvk_ksm.c", - MAME_DIR .. "src/mess/machine/ms7004.c", - MAME_DIR .. "src/mess/drivers/mk85.c", - MAME_DIR .. "src/mess/drivers/mk90.c", + MAME_DIR .. "src/mame/drivers/bk.c", + MAME_DIR .. "src/mame/machine/bk.c", + MAME_DIR .. "src/mame/video/bk.c", + MAME_DIR .. "src/mame/drivers/dvk_kcgd.c", + MAME_DIR .. "src/mame/drivers/dvk_ksm.c", + MAME_DIR .. "src/mame/machine/ms7004.c", + MAME_DIR .. "src/mame/drivers/mk85.c", + MAME_DIR .. "src/mame/drivers/mk90.c", } createMESSProjects(_target, _subtarget, "elektor") files { - MAME_DIR .. "src/mess/drivers/ec65.c", - MAME_DIR .. "src/mess/drivers/elekscmp.c", - MAME_DIR .. "src/mess/drivers/junior.c", + MAME_DIR .. "src/mame/drivers/ec65.c", + MAME_DIR .. "src/mame/drivers/elekscmp.c", + MAME_DIR .. "src/mame/drivers/junior.c", } createMESSProjects(_target, _subtarget, "ensoniq") files { - MAME_DIR .. "src/mess/drivers/esq1.c", - MAME_DIR .. "src/mess/drivers/esq5505.c", - MAME_DIR .. "src/mess/drivers/esqasr.c", - MAME_DIR .. "src/mess/drivers/esqkt.c", - MAME_DIR .. "src/mess/drivers/esqmr.c", - MAME_DIR .. "src/mess/drivers/enmirage.c", - MAME_DIR .. "src/mess/machine/esqpanel.c", - MAME_DIR .. "src/mess/machine/esqvfd.c", + MAME_DIR .. "src/mame/drivers/esq1.c", + MAME_DIR .. "src/mame/drivers/esq5505.c", + MAME_DIR .. "src/mame/drivers/esqasr.c", + MAME_DIR .. "src/mame/drivers/esqkt.c", + MAME_DIR .. "src/mame/drivers/esqmr.c", + MAME_DIR .. "src/mame/drivers/enmirage.c", + MAME_DIR .. "src/mame/machine/esqpanel.c", + MAME_DIR .. "src/mame/machine/esqvfd.c", } createMESSProjects(_target, _subtarget, "enterprise") files { - MAME_DIR .. "src/mess/drivers/ep64.c", - MAME_DIR .. "src/mess/audio/dave.c", - MAME_DIR .. "src/mess/video/nick.c", + MAME_DIR .. "src/mame/drivers/ep64.c", + MAME_DIR .. "src/mame/audio/dave.c", + MAME_DIR .. "src/mame/video/nick.c", } createMESSProjects(_target, _subtarget, "entex") files { - MAME_DIR .. "src/mess/drivers/advision.c", - MAME_DIR .. "src/mess/machine/advision.c", - MAME_DIR .. "src/mess/video/advision.c", + MAME_DIR .. "src/mame/drivers/advision.c", + MAME_DIR .. "src/mame/machine/advision.c", + MAME_DIR .. "src/mame/video/advision.c", } createMESSProjects(_target, _subtarget, "epoch") files { - MAME_DIR .. "src/mess/drivers/gamepock.c", - MAME_DIR .. "src/mess/machine/gamepock.c", - MAME_DIR .. "src/mess/drivers/scv.c", - MAME_DIR .. "src/mess/audio/upd1771.c", + MAME_DIR .. "src/mame/drivers/gamepock.c", + MAME_DIR .. "src/mame/machine/gamepock.c", + MAME_DIR .. "src/mame/drivers/scv.c", + MAME_DIR .. "src/mame/audio/upd1771.c", } createMESSProjects(_target, _subtarget, "epson") files { - MAME_DIR .. "src/mess/drivers/hx20.c", - MAME_DIR .. "src/mess/drivers/px4.c", - MAME_DIR .. "src/mess/drivers/px8.c", - MAME_DIR .. "src/mess/drivers/qx10.c", - MAME_DIR .. "src/mess/machine/qx10kbd.c", + MAME_DIR .. "src/mame/drivers/hx20.c", + MAME_DIR .. "src/mame/drivers/px4.c", + MAME_DIR .. "src/mame/drivers/px8.c", + MAME_DIR .. "src/mame/drivers/qx10.c", + MAME_DIR .. "src/mame/machine/qx10kbd.c", } createMESSProjects(_target, _subtarget, "exidy") files { - MAME_DIR .. "src/mess/machine/sorcerer.c", - MAME_DIR .. "src/mess/drivers/sorcerer.c", - MAME_DIR .. "src/mess/machine/micropolis.c", + MAME_DIR .. "src/mame/machine/sorcerer.c", + MAME_DIR .. "src/mame/drivers/sorcerer.c", + MAME_DIR .. "src/mame/machine/micropolis.c", } createMESSProjects(_target, _subtarget, "fairch") files { - MAME_DIR .. "src/mess/drivers/channelf.c", - MAME_DIR .. "src/mess/audio/channelf.c", - MAME_DIR .. "src/mess/video/channelf.c", + MAME_DIR .. "src/mame/drivers/channelf.c", + MAME_DIR .. "src/mame/audio/channelf.c", + MAME_DIR .. "src/mame/video/channelf.c", } createMESSProjects(_target, _subtarget, "fidelity") files { - MAME_DIR .. "src/mess/drivers/csc.c", - MAME_DIR .. "src/mess/drivers/fidelz80.c", + MAME_DIR .. "src/mame/drivers/csc.c", + MAME_DIR .. "src/mame/drivers/fidelz80.c", } createMESSProjects(_target, _subtarget, "force") files { - MAME_DIR .. "src/mess/drivers/force68k.c", + MAME_DIR .. "src/mame/drivers/force68k.c", } createMESSProjects(_target, _subtarget, "fujitsu") files { - MAME_DIR .. "src/mess/drivers/fmtowns.c", - MAME_DIR .. "src/mess/video/fmtowns.c", - MAME_DIR .. "src/mess/machine/fm_scsi.c", - MAME_DIR .. "src/mess/drivers/fm7.c", - MAME_DIR .. "src/mess/video/fm7.c", + MAME_DIR .. "src/mame/drivers/fmtowns.c", + MAME_DIR .. "src/mame/video/fmtowns.c", + MAME_DIR .. "src/mame/machine/fm_scsi.c", + MAME_DIR .. "src/mame/drivers/fm7.c", + MAME_DIR .. "src/mame/video/fm7.c", } createMESSProjects(_target, _subtarget, "funtech") files { - MAME_DIR .. "src/mess/drivers/supracan.c", + MAME_DIR .. "src/mame/drivers/supracan.c", } createMESSProjects(_target, _subtarget, "galaxy") files { - MAME_DIR .. "src/mess/drivers/galaxy.c", - MAME_DIR .. "src/mess/machine/galaxy.c", - MAME_DIR .. "src/mess/video/galaxy.c", + MAME_DIR .. "src/mame/drivers/galaxy.c", + MAME_DIR .. "src/mame/machine/galaxy.c", + MAME_DIR .. "src/mame/video/galaxy.c", } createMESSProjects(_target, _subtarget, "gamepark") files { - MAME_DIR .. "src/mess/drivers/gp2x.c", - MAME_DIR .. "src/mess/drivers/gp32.c", + MAME_DIR .. "src/mame/drivers/gp2x.c", + MAME_DIR .. "src/mame/drivers/gp32.c", } createMESSProjects(_target, _subtarget, "gi") files { - MAME_DIR .. "src/mess/drivers/hh_pic16.c", + MAME_DIR .. "src/mame/drivers/hh_pic16.c", } createMESSProjects(_target, _subtarget, "grundy") files { - MAME_DIR .. "src/mess/drivers/newbrain.c", - MAME_DIR .. "src/mess/video/newbrain.c", + MAME_DIR .. "src/mame/drivers/newbrain.c", + MAME_DIR .. "src/mame/video/newbrain.c", } createMESSProjects(_target, _subtarget, "hartung") files { - MAME_DIR .. "src/mess/drivers/gmaster.c", + MAME_DIR .. "src/mame/drivers/gmaster.c", } createMESSProjects(_target, _subtarget, "heathkit") files { - MAME_DIR .. "src/mess/drivers/et3400.c", - MAME_DIR .. "src/mess/drivers/h8.c", - MAME_DIR .. "src/mess/drivers/h19.c", - MAME_DIR .. "src/mess/drivers/h89.c", + MAME_DIR .. "src/mame/drivers/et3400.c", + MAME_DIR .. "src/mame/drivers/h8.c", + MAME_DIR .. "src/mame/drivers/h19.c", + MAME_DIR .. "src/mame/drivers/h89.c", } createMESSProjects(_target, _subtarget, "hegener") files { - MAME_DIR .. "src/mess/drivers/glasgow.c", - MAME_DIR .. "src/mess/drivers/mephisto.c", - MAME_DIR .. "src/mess/drivers/mmodular.c", - MAME_DIR .. "src/mess/drivers/stratos.c", - MAME_DIR .. "src/mess/machine/mboard.c", + MAME_DIR .. "src/mame/drivers/glasgow.c", + MAME_DIR .. "src/mame/drivers/mephisto.c", + MAME_DIR .. "src/mame/drivers/mmodular.c", + MAME_DIR .. "src/mame/drivers/stratos.c", + MAME_DIR .. "src/mame/machine/mboard.c", } createMESSProjects(_target, _subtarget, "hitachi") files { - MAME_DIR .. "src/mess/drivers/b16.c", - MAME_DIR .. "src/mess/drivers/bmjr.c", - MAME_DIR .. "src/mess/drivers/bml3.c", - MAME_DIR .. "src/mess/drivers/hh_hmcs40.c", + MAME_DIR .. "src/mame/drivers/b16.c", + MAME_DIR .. "src/mame/drivers/bmjr.c", + MAME_DIR .. "src/mame/drivers/bml3.c", + MAME_DIR .. "src/mame/drivers/hh_hmcs40.c", } createMESSProjects(_target, _subtarget, "homebrew") files { - MAME_DIR .. "src/mess/drivers/4004clk.c", - MAME_DIR .. "src/mess/drivers/68ksbc.c", - MAME_DIR .. "src/mess/drivers/craft.c", - MAME_DIR .. "src/mess/drivers/homez80.c", - MAME_DIR .. "src/mess/drivers/p112.c", - MAME_DIR .. "src/mess/drivers/phunsy.c", - MAME_DIR .. "src/mess/drivers/pimps.c", - MAME_DIR .. "src/mess/drivers/ravens.c", - MAME_DIR .. "src/mess/drivers/sbc6510.c", - MAME_DIR .. "src/mess/drivers/sitcom.c", - MAME_DIR .. "src/mess/drivers/slc1.c", - MAME_DIR .. "src/mess/drivers/uzebox.c", - MAME_DIR .. "src/mess/drivers/z80dev.c", + MAME_DIR .. "src/mame/drivers/4004clk.c", + MAME_DIR .. "src/mame/drivers/68ksbc.c", + MAME_DIR .. "src/mame/drivers/craft.c", + MAME_DIR .. "src/mame/drivers/homez80.c", + MAME_DIR .. "src/mame/drivers/p112.c", + MAME_DIR .. "src/mame/drivers/phunsy.c", + MAME_DIR .. "src/mame/drivers/pimps.c", + MAME_DIR .. "src/mame/drivers/ravens.c", + MAME_DIR .. "src/mame/drivers/sbc6510.c", + MAME_DIR .. "src/mame/drivers/sitcom.c", + MAME_DIR .. "src/mame/drivers/slc1.c", + MAME_DIR .. "src/mame/drivers/uzebox.c", + MAME_DIR .. "src/mame/drivers/z80dev.c", } createMESSProjects(_target, _subtarget, "homelab") files { - MAME_DIR .. "src/mess/drivers/homelab.c", + MAME_DIR .. "src/mame/drivers/homelab.c", } createMESSProjects(_target, _subtarget, "hp") files { - MAME_DIR .. "src/mess/drivers/hp16500.c", - MAME_DIR .. "src/mess/drivers/hp48.c", - MAME_DIR .. "src/mess/machine/hp48.c", - MAME_DIR .. "src/mess/video/hp48.c", - MAME_DIR .. "src/mess/drivers/hp49gp.c", - MAME_DIR .. "src/mess/drivers/hp9845.c", - MAME_DIR .. "src/mess/drivers/hp9k.c", - MAME_DIR .. "src/mess/drivers/hp9k_3xx.c", - MAME_DIR .. "src/mess/drivers/hp64k.c", - MAME_DIR .. "src/mess/drivers/hp_ipc.c", + MAME_DIR .. "src/mame/drivers/hp16500.c", + MAME_DIR .. "src/mame/drivers/hp48.c", + MAME_DIR .. "src/mame/machine/hp48.c", + MAME_DIR .. "src/mame/video/hp48.c", + MAME_DIR .. "src/mame/drivers/hp49gp.c", + MAME_DIR .. "src/mame/drivers/hp9845.c", + MAME_DIR .. "src/mame/drivers/hp9k.c", + MAME_DIR .. "src/mame/drivers/hp9k_3xx.c", + MAME_DIR .. "src/mame/drivers/hp64k.c", + MAME_DIR .. "src/mame/drivers/hp_ipc.c", } createMESSProjects(_target, _subtarget, "hec2hrp") files { - MAME_DIR .. "src/mess/drivers/hec2hrp.c", - MAME_DIR .. "src/mess/machine/hec2hrp.c", - MAME_DIR .. "src/mess/machine/hecdisk2.c", - MAME_DIR .. "src/mess/video/hec2video.c", - MAME_DIR .. "src/mess/drivers/interact.c", + MAME_DIR .. "src/mame/drivers/hec2hrp.c", + MAME_DIR .. "src/mame/machine/hec2hrp.c", + MAME_DIR .. "src/mame/machine/hecdisk2.c", + MAME_DIR .. "src/mame/video/hec2video.c", + MAME_DIR .. "src/mame/drivers/interact.c", } createMESSProjects(_target, _subtarget, "heurikon") files { - MAME_DIR .. "src/mess/drivers/hk68v10.c", + MAME_DIR .. "src/mame/drivers/hk68v10.c", } createMESSProjects(_target, _subtarget, "intel") files { - MAME_DIR .. "src/mess/drivers/basic52.c", - MAME_DIR .. "src/mess/drivers/imds.c", - MAME_DIR .. "src/mess/drivers/ipc.c", - MAME_DIR .. "src/mess/drivers/ipds.c", - MAME_DIR .. "src/mess/drivers/isbc.c", - MAME_DIR .. "src/mess/machine/isbc_215g.c", - MAME_DIR .. "src/mess/drivers/rex6000.c", - MAME_DIR .. "src/mess/drivers/sdk80.c", - MAME_DIR .. "src/mess/drivers/sdk85.c", - MAME_DIR .. "src/mess/drivers/sdk86.c", - MAME_DIR .. "src/mess/drivers/imds2.c", + MAME_DIR .. "src/mame/drivers/basic52.c", + MAME_DIR .. "src/mame/drivers/imds.c", + MAME_DIR .. "src/mame/drivers/ipc.c", + MAME_DIR .. "src/mame/drivers/ipds.c", + MAME_DIR .. "src/mame/drivers/isbc.c", + MAME_DIR .. "src/mame/machine/isbc_215g.c", + MAME_DIR .. "src/mame/drivers/rex6000.c", + MAME_DIR .. "src/mame/drivers/sdk80.c", + MAME_DIR .. "src/mame/drivers/sdk85.c", + MAME_DIR .. "src/mame/drivers/sdk86.c", + MAME_DIR .. "src/mame/drivers/imds2.c", } createMESSProjects(_target, _subtarget, "imp") files { - MAME_DIR .. "src/mess/drivers/tim011.c", - MAME_DIR .. "src/mess/drivers/tim100.c", + MAME_DIR .. "src/mame/drivers/tim011.c", + MAME_DIR .. "src/mame/drivers/tim100.c", } createMESSProjects(_target, _subtarget, "interton") files { - MAME_DIR .. "src/mess/drivers/vc4000.c", - MAME_DIR .. "src/mess/audio/vc4000snd.c", - MAME_DIR .. "src/mess/video/vc4000.c", + MAME_DIR .. "src/mame/drivers/vc4000.c", + MAME_DIR .. "src/mame/audio/vc4000snd.c", + MAME_DIR .. "src/mame/video/vc4000.c", } createMESSProjects(_target, _subtarget, "intv") files { - MAME_DIR .. "src/mess/drivers/intv.c", - MAME_DIR .. "src/mess/machine/intv.c", - MAME_DIR .. "src/mess/video/intv.c", - MAME_DIR .. "src/mess/video/stic.c", + MAME_DIR .. "src/mame/drivers/intv.c", + MAME_DIR .. "src/mame/machine/intv.c", + MAME_DIR .. "src/mame/video/intv.c", + MAME_DIR .. "src/mame/video/stic.c", } createMESSProjects(_target, _subtarget, "isc") files { - MAME_DIR .. "src/mess/drivers/compucolor.c", + MAME_DIR .. "src/mame/drivers/compucolor.c", } createMESSProjects(_target, _subtarget, "kaypro") files { - MAME_DIR .. "src/mess/drivers/kaypro.c", - MAME_DIR .. "src/mess/machine/kaypro.c", - MAME_DIR .. "src/mess/machine/kay_kbd.c", - MAME_DIR .. "src/mess/video/kaypro.c", + MAME_DIR .. "src/mame/drivers/kaypro.c", + MAME_DIR .. "src/mame/machine/kaypro.c", + MAME_DIR .. "src/mame/machine/kay_kbd.c", + MAME_DIR .. "src/mame/video/kaypro.c", } createMESSProjects(_target, _subtarget, "koei") files { - MAME_DIR .. "src/mess/drivers/pasogo.c", + MAME_DIR .. "src/mame/drivers/pasogo.c", } createMESSProjects(_target, _subtarget, "kyocera") files { - MAME_DIR .. "src/mess/drivers/kyocera.c", - MAME_DIR .. "src/mess/video/kyocera.c", + MAME_DIR .. "src/mame/drivers/kyocera.c", + MAME_DIR .. "src/mame/video/kyocera.c", } createMESSProjects(_target, _subtarget, "luxor") files { - MAME_DIR .. "src/mess/drivers/abc80.c", - MAME_DIR .. "src/mess/machine/abc80kb.c", - MAME_DIR .. "src/mess/video/abc80.c", - MAME_DIR .. "src/mess/drivers/abc80x.c", - MAME_DIR .. "src/mess/video/abc800.c", - MAME_DIR .. "src/mess/video/abc802.c", - MAME_DIR .. "src/mess/video/abc806.c", - MAME_DIR .. "src/mess/drivers/abc1600.c", - MAME_DIR .. "src/mess/machine/abc1600mac.c", - MAME_DIR .. "src/mess/video/abc1600.c", + MAME_DIR .. "src/mame/drivers/abc80.c", + MAME_DIR .. "src/mame/machine/abc80kb.c", + MAME_DIR .. "src/mame/video/abc80.c", + MAME_DIR .. "src/mame/drivers/abc80x.c", + MAME_DIR .. "src/mame/video/abc800.c", + MAME_DIR .. "src/mame/video/abc802.c", + MAME_DIR .. "src/mame/video/abc806.c", + MAME_DIR .. "src/mame/drivers/abc1600.c", + MAME_DIR .. "src/mame/machine/abc1600mac.c", + MAME_DIR .. "src/mame/video/abc1600.c", } createMESSProjects(_target, _subtarget, "magnavox") files { - MAME_DIR .. "src/mess/drivers/odyssey2.c", + MAME_DIR .. "src/mame/drivers/odyssey2.c", } createMESSProjects(_target, _subtarget, "makerbot") files { - MAME_DIR .. "src/mess/drivers/replicator.c", + MAME_DIR .. "src/mame/drivers/replicator.c", } createMESSProjects(_target, _subtarget, "marx") files { - MAME_DIR .. "src/mess/drivers/elecbowl.c", + MAME_DIR .. "src/mame/drivers/elecbowl.c", } createMESSProjects(_target, _subtarget, "mattel") files { - MAME_DIR .. "src/mess/drivers/aquarius.c", - MAME_DIR .. "src/mess/video/aquarius.c", - MAME_DIR .. "src/mess/drivers/juicebox.c", - MAME_DIR .. "src/mess/drivers/hyperscan.c", + MAME_DIR .. "src/mame/drivers/aquarius.c", + MAME_DIR .. "src/mame/video/aquarius.c", + MAME_DIR .. "src/mame/drivers/juicebox.c", + MAME_DIR .. "src/mame/drivers/hyperscan.c", } createMESSProjects(_target, _subtarget, "matsushi") files { - MAME_DIR .. "src/mess/drivers/jr100.c", - MAME_DIR .. "src/mess/drivers/jr200.c", - MAME_DIR .. "src/mess/drivers/myb3k.c", + MAME_DIR .. "src/mame/drivers/jr100.c", + MAME_DIR .. "src/mame/drivers/jr200.c", + MAME_DIR .. "src/mame/drivers/myb3k.c", } createMESSProjects(_target, _subtarget, "mb") files { - MAME_DIR .. "src/mess/drivers/mbdtower.c", - MAME_DIR .. "src/mess/drivers/microvsn.c", + MAME_DIR .. "src/mame/drivers/mbdtower.c", + MAME_DIR .. "src/mame/drivers/microvsn.c", } createMESSProjects(_target, _subtarget, "mchester") files { - MAME_DIR .. "src/mess/drivers/ssem.c", + MAME_DIR .. "src/mame/drivers/ssem.c", } createMESSProjects(_target, _subtarget, "memotech") files { - MAME_DIR .. "src/mess/drivers/mtx.c", - MAME_DIR .. "src/mess/machine/mtx.c", + MAME_DIR .. "src/mame/drivers/mtx.c", + MAME_DIR .. "src/mame/machine/mtx.c", } createMESSProjects(_target, _subtarget, "mgu") files { - MAME_DIR .. "src/mess/drivers/irisha.c", + MAME_DIR .. "src/mame/drivers/irisha.c", } createMESSProjects(_target, _subtarget, "microkey") files { - MAME_DIR .. "src/mess/drivers/primo.c", - MAME_DIR .. "src/mess/machine/primo.c", - MAME_DIR .. "src/mess/video/primo.c", + MAME_DIR .. "src/mame/drivers/primo.c", + MAME_DIR .. "src/mame/machine/primo.c", + MAME_DIR .. "src/mame/video/primo.c", } createMESSProjects(_target, _subtarget, "microsoft") files { - MAME_DIR .. "src/mess/drivers/xbox.c", + MAME_DIR .. "src/mame/drivers/xbox.c", } createMESSProjects(_target, _subtarget, "mit") files { - MAME_DIR .. "src/mess/drivers/tx0.c", - MAME_DIR .. "src/mess/video/crt.c", - MAME_DIR .. "src/mess/video/tx0.c", + MAME_DIR .. "src/mame/drivers/tx0.c", + MAME_DIR .. "src/mame/video/crt.c", + MAME_DIR .. "src/mame/video/tx0.c", } createMESSProjects(_target, _subtarget, "mits") files { - MAME_DIR .. "src/mess/drivers/altair.c", - MAME_DIR .. "src/mess/drivers/mits680b.c", + MAME_DIR .. "src/mame/drivers/altair.c", + MAME_DIR .. "src/mame/drivers/mits680b.c", } createMESSProjects(_target, _subtarget, "mitsubishi") files { - MAME_DIR .. "src/mess/drivers/hh_melps4.c", - MAME_DIR .. "src/mess/drivers/multi8.c", - MAME_DIR .. "src/mess/drivers/multi16.c", + MAME_DIR .. "src/mame/drivers/hh_melps4.c", + MAME_DIR .. "src/mame/drivers/multi8.c", + MAME_DIR .. "src/mame/drivers/multi16.c", } createMESSProjects(_target, _subtarget, "mizar") files { - MAME_DIR .. "src/mess/drivers/mzr8105.c", + MAME_DIR .. "src/mame/drivers/mzr8105.c", } createMESSProjects(_target, _subtarget, "morrow") files { - MAME_DIR .. "src/mess/drivers/microdec.c", - MAME_DIR .. "src/mess/drivers/mpz80.c", - MAME_DIR .. "src/mess/drivers/tricep.c", + MAME_DIR .. "src/mame/drivers/microdec.c", + MAME_DIR .. "src/mame/drivers/mpz80.c", + MAME_DIR .. "src/mame/drivers/tricep.c", } createMESSProjects(_target, _subtarget, "mos") files { - MAME_DIR .. "src/mess/drivers/kim1.c", + MAME_DIR .. "src/mame/drivers/kim1.c", } createMESSProjects(_target, _subtarget, "motorola") files { - MAME_DIR .. "src/mess/drivers/m6805evs.c", - MAME_DIR .. "src/mess/drivers/mekd2.c", + MAME_DIR .. "src/mame/drivers/m6805evs.c", + MAME_DIR .. "src/mame/drivers/mekd2.c", } createMESSProjects(_target, _subtarget, "multitch") files { - MAME_DIR .. "src/mess/drivers/mkit09.c", - MAME_DIR .. "src/mess/drivers/mpf1.c", + MAME_DIR .. "src/mame/drivers/mkit09.c", + MAME_DIR .. "src/mame/drivers/mpf1.c", } createMESSProjects(_target, _subtarget, "nakajima") files { - MAME_DIR .. "src/mess/drivers/nakajies.c", + MAME_DIR .. "src/mame/drivers/nakajies.c", } createMESSProjects(_target, _subtarget, "nascom") files { - MAME_DIR .. "src/mess/drivers/nascom1.c", + MAME_DIR .. "src/mame/drivers/nascom1.c", } createMESSProjects(_target, _subtarget, "ne") files { - MAME_DIR .. "src/mess/drivers/z80ne.c", - MAME_DIR .. "src/mess/machine/z80ne.c", + MAME_DIR .. "src/mame/drivers/z80ne.c", + MAME_DIR .. "src/mame/machine/z80ne.c", } createMESSProjects(_target, _subtarget, "nec") files { - MAME_DIR .. "src/mess/drivers/apc.c", - MAME_DIR .. "src/mess/drivers/pce.c", - MAME_DIR .. "src/mess/machine/pce.c", - MAME_DIR .. "src/mess/machine/pce_cd.c", - MAME_DIR .. "src/mess/drivers/pcfx.c", - MAME_DIR .. "src/mess/drivers/pc6001.c", - MAME_DIR .. "src/mess/drivers/pc8401a.c", - MAME_DIR .. "src/mess/video/pc8401a.c", - MAME_DIR .. "src/mess/drivers/pc8001.c", - MAME_DIR .. "src/mess/drivers/pc8801.c", - MAME_DIR .. "src/mess/drivers/pc88va.c", - MAME_DIR .. "src/mess/drivers/pc100.c", - MAME_DIR .. "src/mess/drivers/pc9801.c", - MAME_DIR .. "src/mess/machine/pc9801_26.c", - MAME_DIR .. "src/mess/machine/pc9801_86.c", - MAME_DIR .. "src/mess/machine/pc9801_118.c", - MAME_DIR .. "src/mess/machine/pc9801_cbus.c", - MAME_DIR .. "src/mess/machine/pc9801_kbd.c", - MAME_DIR .. "src/mess/drivers/tk80bs.c", - MAME_DIR .. "src/mess/drivers/hh_ucom4.c", + MAME_DIR .. "src/mame/drivers/apc.c", + MAME_DIR .. "src/mame/drivers/pce.c", + MAME_DIR .. "src/mame/machine/pce.c", + MAME_DIR .. "src/mame/machine/pce_cd.c", + MAME_DIR .. "src/mame/drivers/pcfx.c", + MAME_DIR .. "src/mame/drivers/pc6001.c", + MAME_DIR .. "src/mame/drivers/pc8401a.c", + MAME_DIR .. "src/mame/video/pc8401a.c", + MAME_DIR .. "src/mame/drivers/pc8001.c", + MAME_DIR .. "src/mame/drivers/pc8801.c", + MAME_DIR .. "src/mame/drivers/pc88va.c", + MAME_DIR .. "src/mame/drivers/pc100.c", + MAME_DIR .. "src/mame/drivers/pc9801.c", + MAME_DIR .. "src/mame/machine/pc9801_26.c", + MAME_DIR .. "src/mame/machine/pc9801_86.c", + MAME_DIR .. "src/mame/machine/pc9801_118.c", + MAME_DIR .. "src/mame/machine/pc9801_cbus.c", + MAME_DIR .. "src/mame/machine/pc9801_kbd.c", + MAME_DIR .. "src/mame/drivers/tk80bs.c", + MAME_DIR .. "src/mame/drivers/hh_ucom4.c", } createMESSProjects(_target, _subtarget, "netronic") files { - MAME_DIR .. "src/mess/drivers/elf.c", - MAME_DIR .. "src/mess/drivers/exp85.c", + MAME_DIR .. "src/mame/drivers/elf.c", + MAME_DIR .. "src/mame/drivers/exp85.c", } createMESSProjects(_target, _subtarget, "next") files { - MAME_DIR .. "src/mess/drivers/next.c", - MAME_DIR .. "src/mess/machine/nextkbd.c", - MAME_DIR .. "src/mess/machine/nextmo.c", + MAME_DIR .. "src/mame/drivers/next.c", + MAME_DIR .. "src/mame/machine/nextkbd.c", + MAME_DIR .. "src/mame/machine/nextmo.c", } createMESSProjects(_target, _subtarget, "nintendo") files { - MAME_DIR .. "src/mess/drivers/gb.c", - MAME_DIR .. "src/mess/audio/gb.c", - MAME_DIR .. "src/mess/machine/gb.c", - MAME_DIR .. "src/mess/video/gb_lcd.c", - MAME_DIR .. "src/mess/drivers/gba.c", - MAME_DIR .. "src/mess/video/gba.c", - MAME_DIR .. "src/mess/drivers/n64.c", - MAME_DIR .. "src/mess/drivers/nes.c", - MAME_DIR .. "src/mess/machine/nes.c", - MAME_DIR .. "src/mess/video/nes.c", - MAME_DIR .. "src/mess/drivers/pokemini.c", - MAME_DIR .. "src/mess/drivers/snes.c", - MAME_DIR .. "src/mess/machine/snescx4.c", - MAME_DIR .. "src/mess/drivers/vboy.c", - MAME_DIR .. "src/mess/audio/vboy.c", + MAME_DIR .. "src/mame/drivers/gb.c", + MAME_DIR .. "src/mame/audio/gb.c", + MAME_DIR .. "src/mame/machine/gb.c", + MAME_DIR .. "src/mame/video/gb_lcd.c", + MAME_DIR .. "src/mame/drivers/gba.c", + MAME_DIR .. "src/mame/video/gba.c", + MAME_DIR .. "src/mame/drivers/n64.c", + MAME_DIR .. "src/mame/drivers/nes.c", + MAME_DIR .. "src/mame/machine/nes.c", + MAME_DIR .. "src/mame/video/nes.c", + MAME_DIR .. "src/mame/drivers/pokemini.c", + MAME_DIR .. "src/mame/drivers/snes.c", + MAME_DIR .. "src/mame/machine/snescx4.c", + MAME_DIR .. "src/mame/drivers/vboy.c", + MAME_DIR .. "src/mame/audio/vboy.c", } createMESSProjects(_target, _subtarget, "nokia") files { - MAME_DIR .. "src/mess/drivers/mikromik.c", - MAME_DIR .. "src/mess/machine/mm1kb.c", - MAME_DIR .. "src/mess/video/mikromik.c", + MAME_DIR .. "src/mame/drivers/mikromik.c", + MAME_DIR .. "src/mame/machine/mm1kb.c", + MAME_DIR .. "src/mame/video/mikromik.c", } createMESSProjects(_target, _subtarget, "northstar") files { - MAME_DIR .. "src/mess/drivers/horizon.c", + MAME_DIR .. "src/mame/drivers/horizon.c", } createMESSProjects(_target, _subtarget, "novag") files { - MAME_DIR .. "src/mess/drivers/mk1.c", - MAME_DIR .. "src/mess/drivers/mk2.c", - MAME_DIR .. "src/mess/drivers/ssystem3.c", - MAME_DIR .. "src/mess/video/ssystem3.c", - MAME_DIR .. "src/mess/drivers/supercon.c", + MAME_DIR .. "src/mame/drivers/mk1.c", + MAME_DIR .. "src/mame/drivers/mk2.c", + MAME_DIR .. "src/mame/drivers/ssystem3.c", + MAME_DIR .. "src/mame/video/ssystem3.c", + MAME_DIR .. "src/mame/drivers/supercon.c", } createMESSProjects(_target, _subtarget, "olivetti") files { - MAME_DIR .. "src/mess/drivers/m20.c", - MAME_DIR .. "src/mess/machine/m20_kbd.c", - MAME_DIR .. "src/mess/machine/m20_8086.c", - MAME_DIR .. "src/mess/drivers/m24.c", - MAME_DIR .. "src/mess/machine/m24_kbd.c", - MAME_DIR .. "src/mess/machine/m24_z8000.c" + MAME_DIR .. "src/mame/drivers/m20.c", + MAME_DIR .. "src/mame/machine/m20_kbd.c", + MAME_DIR .. "src/mame/machine/m20_8086.c", + MAME_DIR .. "src/mame/drivers/m24.c", + MAME_DIR .. "src/mame/machine/m24_kbd.c", + MAME_DIR .. "src/mame/machine/m24_z8000.c" } createMESSProjects(_target, _subtarget, "olympia") files { - MAME_DIR .. "src/mess/drivers/peoplepc.c" + MAME_DIR .. "src/mame/drivers/peoplepc.c" } createMESSProjects(_target, _subtarget, "ns") files { - MAME_DIR .. "src/mess/drivers/hh_cop400.c", + MAME_DIR .. "src/mame/drivers/hh_cop400.c", } createMESSProjects(_target, _subtarget, "omnibyte") files { - MAME_DIR .. "src/mess/drivers/msbc1.c", - MAME_DIR .. "src/mess/drivers/ob68k1a.c", + MAME_DIR .. "src/mame/drivers/msbc1.c", + MAME_DIR .. "src/mame/drivers/ob68k1a.c", } createMESSProjects(_target, _subtarget, "orion") files { - MAME_DIR .. "src/mess/drivers/orion.c", - MAME_DIR .. "src/mess/machine/orion.c", - MAME_DIR .. "src/mess/video/orion.c", + MAME_DIR .. "src/mame/drivers/orion.c", + MAME_DIR .. "src/mame/machine/orion.c", + MAME_DIR .. "src/mame/video/orion.c", } createMESSProjects(_target, _subtarget, "osborne") files { - MAME_DIR .. "src/mess/drivers/osborne1.c", - MAME_DIR .. "src/mess/machine/osborne1.c", - MAME_DIR .. "src/mess/drivers/osbexec.c", - MAME_DIR .. "src/mess/drivers/vixen.c", + MAME_DIR .. "src/mame/drivers/osborne1.c", + MAME_DIR .. "src/mame/machine/osborne1.c", + MAME_DIR .. "src/mame/drivers/osbexec.c", + MAME_DIR .. "src/mame/drivers/vixen.c", } createMESSProjects(_target, _subtarget, "osi") files { - MAME_DIR .. "src/mess/drivers/osi.c", - MAME_DIR .. "src/mess/video/osi.c", + MAME_DIR .. "src/mame/drivers/osi.c", + MAME_DIR .. "src/mame/video/osi.c", } createMESSProjects(_target, _subtarget, "palm") files { - MAME_DIR .. "src/mess/drivers/palm.c", - MAME_DIR .. "src/mess/drivers/palmz22.c", + MAME_DIR .. "src/mame/drivers/palm.c", + MAME_DIR .. "src/mame/drivers/palmz22.c", } createMESSProjects(_target, _subtarget, "parker") files { - MAME_DIR .. "src/mess/drivers/wildfire.c", + MAME_DIR .. "src/mame/drivers/wildfire.c", } createMESSProjects(_target, _subtarget, "pitronic") files { - MAME_DIR .. "src/mess/drivers/beta.c", + MAME_DIR .. "src/mame/drivers/beta.c", } createMESSProjects(_target, _subtarget, "pc") files { - MAME_DIR .. "src/mess/drivers/asst128.c", - MAME_DIR .. "src/mess/drivers/europc.c", - MAME_DIR .. "src/mess/drivers/genpc.c", - MAME_DIR .. "src/mess/machine/genpc.c", - MAME_DIR .. "src/mess/drivers/ibmpc.c", - MAME_DIR .. "src/mess/drivers/ibmpcjr.c", - MAME_DIR .. "src/mess/drivers/pc.c", - MAME_DIR .. "src/mess/drivers/tandy1t.c", - MAME_DIR .. "src/mess/video/pc_t1t.c", + MAME_DIR .. "src/mame/drivers/asst128.c", + MAME_DIR .. "src/mame/drivers/europc.c", + MAME_DIR .. "src/mame/drivers/genpc.c", + MAME_DIR .. "src/mame/machine/genpc.c", + MAME_DIR .. "src/mame/drivers/ibmpc.c", + MAME_DIR .. "src/mame/drivers/ibmpcjr.c", + MAME_DIR .. "src/mame/drivers/pc.c", + MAME_DIR .. "src/mame/drivers/tandy1t.c", + MAME_DIR .. "src/mame/video/pc_t1t.c", } createMESSProjects(_target, _subtarget, "pdp1") files { - MAME_DIR .. "src/mess/drivers/pdp1.c", - MAME_DIR .. "src/mess/video/pdp1.c", + MAME_DIR .. "src/mame/drivers/pdp1.c", + MAME_DIR .. "src/mame/video/pdp1.c", } createMESSProjects(_target, _subtarget, "pel") files { - MAME_DIR .. "src/mess/drivers/galeb.c", - MAME_DIR .. "src/mess/video/galeb.c", - MAME_DIR .. "src/mess/drivers/orao.c", - MAME_DIR .. "src/mess/machine/orao.c", - MAME_DIR .. "src/mess/video/orao.c", + MAME_DIR .. "src/mame/drivers/galeb.c", + MAME_DIR .. "src/mame/video/galeb.c", + MAME_DIR .. "src/mame/drivers/orao.c", + MAME_DIR .. "src/mame/machine/orao.c", + MAME_DIR .. "src/mame/video/orao.c", } createMESSProjects(_target, _subtarget, "philips") files { - MAME_DIR .. "src/mess/drivers/p2000t.c", - MAME_DIR .. "src/mess/machine/p2000t.c", - MAME_DIR .. "src/mess/video/p2000m.c", - MAME_DIR .. "src/mess/drivers/vg5k.c", + MAME_DIR .. "src/mame/drivers/p2000t.c", + MAME_DIR .. "src/mame/machine/p2000t.c", + MAME_DIR .. "src/mame/video/p2000m.c", + MAME_DIR .. "src/mame/drivers/vg5k.c", } createMESSProjects(_target, _subtarget, "poly88") files { - MAME_DIR .. "src/mess/drivers/poly88.c", - MAME_DIR .. "src/mess/machine/poly88.c", - MAME_DIR .. "src/mess/video/poly88.c", + MAME_DIR .. "src/mame/drivers/poly88.c", + MAME_DIR .. "src/mame/machine/poly88.c", + MAME_DIR .. "src/mame/video/poly88.c", } createMESSProjects(_target, _subtarget, "psion") files { - MAME_DIR .. "src/mess/drivers/psion.c", - MAME_DIR .. "src/mess/machine/psion_pack.c", + MAME_DIR .. "src/mame/drivers/psion.c", + MAME_DIR .. "src/mame/machine/psion_pack.c", } createMESSProjects(_target, _subtarget, "radio") files { - MAME_DIR .. "src/mess/drivers/apogee.c", - MAME_DIR .. "src/mess/drivers/mikrosha.c", - MAME_DIR .. "src/mess/drivers/partner.c", - MAME_DIR .. "src/mess/machine/partner.c", - MAME_DIR .. "src/mess/drivers/radio86.c", - MAME_DIR .. "src/mess/machine/radio86.c", + MAME_DIR .. "src/mame/drivers/apogee.c", + MAME_DIR .. "src/mame/drivers/mikrosha.c", + MAME_DIR .. "src/mame/drivers/partner.c", + MAME_DIR .. "src/mame/machine/partner.c", + MAME_DIR .. "src/mame/drivers/radio86.c", + MAME_DIR .. "src/mame/machine/radio86.c", } createMESSProjects(_target, _subtarget, "rca") files { - MAME_DIR .. "src/mess/drivers/microkit.c", - MAME_DIR .. "src/mess/drivers/studio2.c", - MAME_DIR .. "src/mess/drivers/vip.c", + MAME_DIR .. "src/mame/drivers/microkit.c", + MAME_DIR .. "src/mame/drivers/studio2.c", + MAME_DIR .. "src/mame/drivers/vip.c", } createMESSProjects(_target, _subtarget, "regnecentralen") files { - MAME_DIR .. "src/mess/drivers/rc759.c", + MAME_DIR .. "src/mame/drivers/rc759.c", } createMESSProjects(_target, _subtarget, "ritam") files { - MAME_DIR .. "src/mess/drivers/monty.c", + MAME_DIR .. "src/mame/drivers/monty.c", } createMESSProjects(_target, _subtarget, "rm") files { - MAME_DIR .. "src/mess/drivers/rm380z.c", - MAME_DIR .. "src/mess/machine/rm380z.c", - MAME_DIR .. "src/mess/video/rm380z.c", - MAME_DIR .. "src/mess/drivers/rmnimbus.c", - MAME_DIR .. "src/mess/machine/rmnimbus.c", - MAME_DIR .. "src/mess/video/rmnimbus.c", - MAME_DIR .. "src/mess/machine/rmnkbd.c", + MAME_DIR .. "src/mame/drivers/rm380z.c", + MAME_DIR .. "src/mame/machine/rm380z.c", + MAME_DIR .. "src/mame/video/rm380z.c", + MAME_DIR .. "src/mame/drivers/rmnimbus.c", + MAME_DIR .. "src/mame/machine/rmnimbus.c", + MAME_DIR .. "src/mame/video/rmnimbus.c", + MAME_DIR .. "src/mame/machine/rmnkbd.c", } createMESSProjects(_target, _subtarget, "robotron") files { - MAME_DIR .. "src/mess/drivers/a5105.c", - MAME_DIR .. "src/mess/drivers/a51xx.c", - MAME_DIR .. "src/mess/drivers/a7150.c", - MAME_DIR .. "src/mess/drivers/k1003.c", - MAME_DIR .. "src/mess/drivers/k8915.c", - MAME_DIR .. "src/mess/drivers/rt1715.c", - MAME_DIR .. "src/mess/drivers/z1013.c", - MAME_DIR .. "src/mess/drivers/z9001.c", + MAME_DIR .. "src/mame/drivers/a5105.c", + MAME_DIR .. "src/mame/drivers/a51xx.c", + MAME_DIR .. "src/mame/drivers/a7150.c", + MAME_DIR .. "src/mame/drivers/k1003.c", + MAME_DIR .. "src/mame/drivers/k8915.c", + MAME_DIR .. "src/mame/drivers/rt1715.c", + MAME_DIR .. "src/mame/drivers/z1013.c", + MAME_DIR .. "src/mame/drivers/z9001.c", } createMESSProjects(_target, _subtarget, "roland") files { - MAME_DIR .. "src/mess/drivers/rmt32.c", - MAME_DIR .. "src/mess/drivers/rd110.c", - MAME_DIR .. "src/mess/drivers/rsc55.c", - MAME_DIR .. "src/mess/drivers/tb303.c", + MAME_DIR .. "src/mame/drivers/rmt32.c", + MAME_DIR .. "src/mame/drivers/rd110.c", + MAME_DIR .. "src/mame/drivers/rsc55.c", + MAME_DIR .. "src/mame/drivers/tb303.c", } createMESSProjects(_target, _subtarget, "rockwell") files { - MAME_DIR .. "src/mess/drivers/aim65.c", - MAME_DIR .. "src/mess/machine/aim65.c", - MAME_DIR .. "src/mess/drivers/aim65_40.c", + MAME_DIR .. "src/mame/drivers/aim65.c", + MAME_DIR .. "src/mame/machine/aim65.c", + MAME_DIR .. "src/mame/drivers/aim65_40.c", } createMESSProjects(_target, _subtarget, "sage") files { - MAME_DIR .. "src/mess/drivers/sage2.c", + MAME_DIR .. "src/mame/drivers/sage2.c", } createMESSProjects(_target, _subtarget, "samcoupe") files { - MAME_DIR .. "src/mess/drivers/samcoupe.c", - MAME_DIR .. "src/mess/machine/samcoupe.c", - MAME_DIR .. "src/mess/video/samcoupe.c", + MAME_DIR .. "src/mame/drivers/samcoupe.c", + MAME_DIR .. "src/mame/machine/samcoupe.c", + MAME_DIR .. "src/mame/video/samcoupe.c", } createMESSProjects(_target, _subtarget, "samsung") files { - MAME_DIR .. "src/mess/drivers/spc1000.c", + MAME_DIR .. "src/mame/drivers/spc1000.c", } createMESSProjects(_target, _subtarget, "sanyo") files { - MAME_DIR .. "src/mess/drivers/mbc200.c", - MAME_DIR .. "src/mess/drivers/mbc55x.c", - MAME_DIR .. "src/mess/machine/mbc55x.c", - MAME_DIR .. "src/mess/video/mbc55x.c", - MAME_DIR .. "src/mess/drivers/phc25.c", + MAME_DIR .. "src/mame/drivers/mbc200.c", + MAME_DIR .. "src/mame/drivers/mbc55x.c", + MAME_DIR .. "src/mame/machine/mbc55x.c", + MAME_DIR .. "src/mame/video/mbc55x.c", + MAME_DIR .. "src/mame/drivers/phc25.c", } createMESSProjects(_target, _subtarget, "sega") files { - MAME_DIR .. "src/mess/drivers/dccons.c", - MAME_DIR .. "src/mess/machine/dccons.c", - MAME_DIR .. "src/mess/drivers/megadriv.c", - MAME_DIR .. "src/mess/drivers/saturn.c", - MAME_DIR .. "src/mess/drivers/segapico.c", - MAME_DIR .. "src/mess/drivers/segapm.c", - MAME_DIR .. "src/mess/drivers/sg1000.c", - MAME_DIR .. "src/mess/drivers/sms.c", - MAME_DIR .. "src/mess/machine/sms.c", - MAME_DIR .. "src/mess/drivers/svmu.c", - MAME_DIR .. "src/mess/machine/mega32x.c", - MAME_DIR .. "src/mess/machine/megacd.c", - MAME_DIR .. "src/mess/machine/megacdcd.c", + MAME_DIR .. "src/mame/drivers/dccons.c", + MAME_DIR .. "src/mame/machine/dccons.c", + MAME_DIR .. "src/mame/drivers/megadriv.c", + MAME_DIR .. "src/mame/drivers/saturn.c", + MAME_DIR .. "src/mame/drivers/segapico.c", + MAME_DIR .. "src/mame/drivers/segapm.c", + MAME_DIR .. "src/mame/drivers/sg1000.c", + MAME_DIR .. "src/mame/drivers/sms.c", + MAME_DIR .. "src/mame/machine/sms.c", + MAME_DIR .. "src/mame/drivers/svmu.c", + MAME_DIR .. "src/mame/machine/mega32x.c", + MAME_DIR .. "src/mame/machine/megacd.c", + MAME_DIR .. "src/mame/machine/megacdcd.c", } createMESSProjects(_target, _subtarget, "sgi") files { - MAME_DIR .. "src/mess/machine/sgi.c", - MAME_DIR .. "src/mess/drivers/sgi_ip2.c", - MAME_DIR .. "src/mess/drivers/sgi_ip6.c", - MAME_DIR .. "src/mess/drivers/ip20.c", - MAME_DIR .. "src/mess/drivers/ip22.c", - MAME_DIR .. "src/mess/video/newport.c", + MAME_DIR .. "src/mame/machine/sgi.c", + MAME_DIR .. "src/mame/drivers/sgi_ip2.c", + MAME_DIR .. "src/mame/drivers/sgi_ip6.c", + MAME_DIR .. "src/mame/drivers/ip20.c", + MAME_DIR .. "src/mame/drivers/ip22.c", + MAME_DIR .. "src/mame/video/newport.c", } createMESSProjects(_target, _subtarget, "sharp") files { - MAME_DIR .. "src/mess/drivers/hh_sm510.c", - MAME_DIR .. "src/mess/video/mz700.c", - MAME_DIR .. "src/mess/drivers/mz700.c", - MAME_DIR .. "src/mess/drivers/pc1500.c", - MAME_DIR .. "src/mess/drivers/pocketc.c", - MAME_DIR .. "src/mess/video/pc1401.c", - MAME_DIR .. "src/mess/machine/pc1401.c", - MAME_DIR .. "src/mess/video/pc1403.c", - MAME_DIR .. "src/mess/machine/pc1403.c", - MAME_DIR .. "src/mess/video/pc1350.c", - MAME_DIR .. "src/mess/machine/pc1350.c", - MAME_DIR .. "src/mess/video/pc1251.c", - MAME_DIR .. "src/mess/machine/pc1251.c", - MAME_DIR .. "src/mess/video/pocketc.c", - MAME_DIR .. "src/mess/machine/mz700.c", - MAME_DIR .. "src/mess/drivers/x68k.c", - MAME_DIR .. "src/mess/video/x68k.c", - MAME_DIR .. "src/mess/machine/x68k_hdc.c", - MAME_DIR .. "src/mess/machine/x68k_kbd.c", - MAME_DIR .. "src/mess/drivers/mz80.c", - MAME_DIR .. "src/mess/video/mz80.c", - MAME_DIR .. "src/mess/machine/mz80.c", - MAME_DIR .. "src/mess/drivers/mz2000.c", - MAME_DIR .. "src/mess/drivers/x1.c", - MAME_DIR .. "src/mess/machine/x1.c", - MAME_DIR .. "src/mess/drivers/x1twin.c", - MAME_DIR .. "src/mess/drivers/mz2500.c", - MAME_DIR .. "src/mess/drivers/mz3500.c", - MAME_DIR .. "src/mess/drivers/pce220.c", - MAME_DIR .. "src/mess/machine/pce220_ser.c", - MAME_DIR .. "src/mess/drivers/mz6500.c", - MAME_DIR .. "src/mess/drivers/zaurus.c", + MAME_DIR .. "src/mame/drivers/hh_sm510.c", + MAME_DIR .. "src/mame/video/mz700.c", + MAME_DIR .. "src/mame/drivers/mz700.c", + MAME_DIR .. "src/mame/drivers/pc1500.c", + MAME_DIR .. "src/mame/drivers/pocketc.c", + MAME_DIR .. "src/mame/video/pc1401.c", + MAME_DIR .. "src/mame/machine/pc1401.c", + MAME_DIR .. "src/mame/video/pc1403.c", + MAME_DIR .. "src/mame/machine/pc1403.c", + MAME_DIR .. "src/mame/video/pc1350.c", + MAME_DIR .. "src/mame/machine/pc1350.c", + MAME_DIR .. "src/mame/video/pc1251.c", + MAME_DIR .. "src/mame/machine/pc1251.c", + MAME_DIR .. "src/mame/video/pocketc.c", + MAME_DIR .. "src/mame/machine/mz700.c", + MAME_DIR .. "src/mame/drivers/x68k.c", + MAME_DIR .. "src/mame/video/x68k.c", + MAME_DIR .. "src/mame/machine/x68k_hdc.c", + MAME_DIR .. "src/mame/machine/x68k_kbd.c", + MAME_DIR .. "src/mame/drivers/mz80.c", + MAME_DIR .. "src/mame/video/mz80.c", + MAME_DIR .. "src/mame/machine/mz80.c", + MAME_DIR .. "src/mame/drivers/mz2000.c", + MAME_DIR .. "src/mame/drivers/x1.c", + MAME_DIR .. "src/mame/machine/x1.c", + MAME_DIR .. "src/mame/drivers/x1twin.c", + MAME_DIR .. "src/mame/drivers/mz2500.c", + MAME_DIR .. "src/mame/drivers/mz3500.c", + MAME_DIR .. "src/mame/drivers/pce220.c", + MAME_DIR .. "src/mame/machine/pce220_ser.c", + MAME_DIR .. "src/mame/drivers/mz6500.c", + MAME_DIR .. "src/mame/drivers/zaurus.c", } createMESSProjects(_target, _subtarget, "sinclair") files { - MAME_DIR .. "src/mess/video/spectrum.c", - MAME_DIR .. "src/mess/video/timex.c", - MAME_DIR .. "src/mess/video/zx.c", - MAME_DIR .. "src/mess/drivers/zx.c", - MAME_DIR .. "src/mess/machine/zx.c", - MAME_DIR .. "src/mess/drivers/spectrum.c", - MAME_DIR .. "src/mess/drivers/spec128.c", - MAME_DIR .. "src/mess/drivers/timex.c", - MAME_DIR .. "src/mess/drivers/specpls3.c", - MAME_DIR .. "src/mess/drivers/scorpion.c", - MAME_DIR .. "src/mess/drivers/atm.c", - MAME_DIR .. "src/mess/drivers/pentagon.c", - MAME_DIR .. "src/mess/machine/beta.c", - MAME_DIR .. "src/mess/machine/spec_snqk.c", - MAME_DIR .. "src/mess/drivers/ql.c", - MAME_DIR .. "src/mess/machine/qimi.c", - MAME_DIR .. "src/mess/video/zx8301.c", - MAME_DIR .. "src/mess/machine/zx8302.c", + MAME_DIR .. "src/mame/video/spectrum.c", + MAME_DIR .. "src/mame/video/timex.c", + MAME_DIR .. "src/mame/video/zx.c", + MAME_DIR .. "src/mame/drivers/zx.c", + MAME_DIR .. "src/mame/machine/zx.c", + MAME_DIR .. "src/mame/drivers/spectrum.c", + MAME_DIR .. "src/mame/drivers/spec128.c", + MAME_DIR .. "src/mame/drivers/timex.c", + MAME_DIR .. "src/mame/drivers/specpls3.c", + MAME_DIR .. "src/mame/drivers/scorpion.c", + MAME_DIR .. "src/mame/drivers/atm.c", + MAME_DIR .. "src/mame/drivers/pentagon.c", + MAME_DIR .. "src/mame/machine/beta.c", + MAME_DIR .. "src/mame/machine/spec_snqk.c", + MAME_DIR .. "src/mame/drivers/ql.c", + MAME_DIR .. "src/mame/machine/qimi.c", + MAME_DIR .. "src/mame/video/zx8301.c", + MAME_DIR .. "src/mame/machine/zx8302.c", } createMESSProjects(_target, _subtarget, "siemens") files { - MAME_DIR .. "src/mess/drivers/pcd.c", - MAME_DIR .. "src/mess/machine/pcd_kbd.c", - MAME_DIR .. "src/mess/video/pcd.c", + MAME_DIR .. "src/mame/drivers/pcd.c", + MAME_DIR .. "src/mame/machine/pcd_kbd.c", + MAME_DIR .. "src/mame/video/pcd.c", } createMESSProjects(_target, _subtarget, "slicer") files { - MAME_DIR .. "src/mess/drivers/slicer.c", + MAME_DIR .. "src/mame/drivers/slicer.c", } createMESSProjects(_target, _subtarget, "snk") files { - MAME_DIR .. "src/mess/drivers/ng_aes.c", - MAME_DIR .. "src/mess/drivers/ngp.c", - MAME_DIR .. "src/mess/video/k1ge.c", + MAME_DIR .. "src/mame/drivers/ng_aes.c", + MAME_DIR .. "src/mame/drivers/ngp.c", + MAME_DIR .. "src/mame/video/k1ge.c", } createMESSProjects(_target, _subtarget, "sony") files { - MAME_DIR .. "src/mess/drivers/pockstat.c", - MAME_DIR .. "src/mess/drivers/psx.c", - MAME_DIR .. "src/mess/machine/psxcd.c", - MAME_DIR .. "src/mess/drivers/pve500.c", - MAME_DIR .. "src/mess/drivers/smc777.c", + MAME_DIR .. "src/mame/drivers/pockstat.c", + MAME_DIR .. "src/mame/drivers/psx.c", + MAME_DIR .. "src/mame/machine/psxcd.c", + MAME_DIR .. "src/mame/drivers/pve500.c", + MAME_DIR .. "src/mame/drivers/smc777.c", } createMESSProjects(_target, _subtarget, "sord") files { - MAME_DIR .. "src/mess/drivers/m5.c", + MAME_DIR .. "src/mame/drivers/m5.c", } createMESSProjects(_target, _subtarget, "special") files { - MAME_DIR .. "src/mess/drivers/special.c", - MAME_DIR .. "src/mess/audio/specimx_snd.c", - MAME_DIR .. "src/mess/machine/special.c", - MAME_DIR .. "src/mess/video/special.c", + MAME_DIR .. "src/mame/drivers/special.c", + MAME_DIR .. "src/mame/audio/specimx_snd.c", + MAME_DIR .. "src/mame/machine/special.c", + MAME_DIR .. "src/mame/video/special.c", } createMESSProjects(_target, _subtarget, "sun") files { - MAME_DIR .. "src/mess/drivers/sun1.c", - MAME_DIR .. "src/mess/drivers/sun2.c", - MAME_DIR .. "src/mess/drivers/sun3.c", - MAME_DIR .. "src/mess/drivers/sun4.c", + MAME_DIR .. "src/mame/drivers/sun1.c", + MAME_DIR .. "src/mame/drivers/sun2.c", + MAME_DIR .. "src/mame/drivers/sun3.c", + MAME_DIR .. "src/mame/drivers/sun4.c", } createMESSProjects(_target, _subtarget, "svi") files { - MAME_DIR .. "src/mess/drivers/svi318.c", - MAME_DIR .. "src/mess/machine/svi318.c", + MAME_DIR .. "src/mame/drivers/svi318.c", + MAME_DIR .. "src/mame/machine/svi318.c", } createMESSProjects(_target, _subtarget, "svision") files { - MAME_DIR .. "src/mess/drivers/svision.c", - MAME_DIR .. "src/mess/audio/svis_snd.c", + MAME_DIR .. "src/mame/drivers/svision.c", + MAME_DIR .. "src/mame/audio/svis_snd.c", } createMESSProjects(_target, _subtarget, "swtpc09") files { - MAME_DIR .. "src/mess/drivers/swtpc09.c", - MAME_DIR .. "src/mess/machine/swtpc09.c", + MAME_DIR .. "src/mame/drivers/swtpc09.c", + MAME_DIR .. "src/mame/machine/swtpc09.c", } createMESSProjects(_target, _subtarget, "synertec") files { - MAME_DIR .. "src/mess/drivers/sym1.c", + MAME_DIR .. "src/mame/drivers/sym1.c", } createMESSProjects(_target, _subtarget, "ta") files { - MAME_DIR .. "src/mess/drivers/alphatro.c", + MAME_DIR .. "src/mame/drivers/alphatro.c", } createMESSProjects(_target, _subtarget, "tandberg") files { - MAME_DIR .. "src/mess/drivers/tdv2324.c", + MAME_DIR .. "src/mame/drivers/tdv2324.c", } createMESSProjects(_target, _subtarget, "tangerin") files { - MAME_DIR .. "src/mess/drivers/microtan.c", - MAME_DIR .. "src/mess/machine/microtan.c", - MAME_DIR .. "src/mess/video/microtan.c", - MAME_DIR .. "src/mess/drivers/oric.c", + MAME_DIR .. "src/mame/drivers/microtan.c", + MAME_DIR .. "src/mame/machine/microtan.c", + MAME_DIR .. "src/mame/video/microtan.c", + MAME_DIR .. "src/mame/drivers/oric.c", } createMESSProjects(_target, _subtarget, "tatung") files { - MAME_DIR .. "src/mess/drivers/einstein.c", - MAME_DIR .. "src/mess/machine/einstein.c", + MAME_DIR .. "src/mame/drivers/einstein.c", + MAME_DIR .. "src/mame/machine/einstein.c", } createMESSProjects(_target, _subtarget, "teamconc") files { - MAME_DIR .. "src/mess/drivers/comquest.c", - MAME_DIR .. "src/mess/video/comquest.c", + MAME_DIR .. "src/mame/drivers/comquest.c", + MAME_DIR .. "src/mame/video/comquest.c", } createMESSProjects(_target, _subtarget, "tektroni") files { - MAME_DIR .. "src/mess/drivers/tek405x.c", - MAME_DIR .. "src/mess/drivers/tek410x.c", + MAME_DIR .. "src/mame/drivers/tek405x.c", + MAME_DIR .. "src/mame/drivers/tek410x.c", } createMESSProjects(_target, _subtarget, "telenova") files { - MAME_DIR .. "src/mess/drivers/compis.c", - MAME_DIR .. "src/mess/machine/compiskb.c", + MAME_DIR .. "src/mame/drivers/compis.c", + MAME_DIR .. "src/mame/machine/compiskb.c", } createMESSProjects(_target, _subtarget, "telercas") files { - MAME_DIR .. "src/mess/drivers/tmc1800.c", - MAME_DIR .. "src/mess/video/tmc1800.c", - MAME_DIR .. "src/mess/drivers/tmc600.c", - MAME_DIR .. "src/mess/video/tmc600.c", - MAME_DIR .. "src/mess/drivers/tmc2000e.c", + MAME_DIR .. "src/mame/drivers/tmc1800.c", + MAME_DIR .. "src/mame/video/tmc1800.c", + MAME_DIR .. "src/mame/drivers/tmc600.c", + MAME_DIR .. "src/mame/video/tmc600.c", + MAME_DIR .. "src/mame/drivers/tmc2000e.c", } createMESSProjects(_target, _subtarget, "televideo") files { - MAME_DIR .. "src/mess/drivers/ts802.c", - MAME_DIR .. "src/mess/drivers/ts803.c", - MAME_DIR .. "src/mess/drivers/ts816.c", - MAME_DIR .. "src/mess/drivers/tv950.c", + MAME_DIR .. "src/mame/drivers/ts802.c", + MAME_DIR .. "src/mame/drivers/ts803.c", + MAME_DIR .. "src/mame/drivers/ts816.c", + MAME_DIR .. "src/mame/drivers/tv950.c", } createMESSProjects(_target, _subtarget, "tem") files { - MAME_DIR .. "src/mess/drivers/tec1.c", + MAME_DIR .. "src/mame/drivers/tec1.c", } createMESSProjects(_target, _subtarget, "tesla") files { - MAME_DIR .. "src/mess/drivers/ondra.c", - MAME_DIR .. "src/mess/machine/ondra.c", - MAME_DIR .. "src/mess/video/ondra.c", - MAME_DIR .. "src/mess/drivers/pmd85.c", - MAME_DIR .. "src/mess/machine/pmd85.c", - MAME_DIR .. "src/mess/drivers/pmi80.c", - MAME_DIR .. "src/mess/drivers/sapi1.c", + MAME_DIR .. "src/mame/drivers/ondra.c", + MAME_DIR .. "src/mame/machine/ondra.c", + MAME_DIR .. "src/mame/video/ondra.c", + MAME_DIR .. "src/mame/drivers/pmd85.c", + MAME_DIR .. "src/mame/machine/pmd85.c", + MAME_DIR .. "src/mame/drivers/pmi80.c", + MAME_DIR .. "src/mame/drivers/sapi1.c", } createMESSProjects(_target, _subtarget, "test") files { - MAME_DIR .. "src/mess/drivers/test_t400.c", - MAME_DIR .. "src/mess/drivers/zexall.c", + MAME_DIR .. "src/mame/drivers/test_t400.c", + MAME_DIR .. "src/mame/drivers/zexall.c", } createMESSProjects(_target, _subtarget, "thomson") files { - MAME_DIR .. "src/mess/drivers/thomson.c", - MAME_DIR .. "src/mess/machine/thomson.c", - MAME_DIR .. "src/mess/machine/thomflop.c", - MAME_DIR .. "src/mess/video/thomson.c", + MAME_DIR .. "src/mame/drivers/thomson.c", + MAME_DIR .. "src/mame/machine/thomson.c", + MAME_DIR .. "src/mame/machine/thomflop.c", + MAME_DIR .. "src/mame/video/thomson.c", } createMESSProjects(_target, _subtarget, "ti") files { - MAME_DIR .. "src/mess/drivers/avigo.c", - MAME_DIR .. "src/mess/video/avigo.c", - MAME_DIR .. "src/mess/drivers/cc40.c", - MAME_DIR .. "src/mess/drivers/evmbug.c", - MAME_DIR .. "src/mess/drivers/exelv.c", - MAME_DIR .. "src/mess/drivers/geneve.c", - MAME_DIR .. "src/mess/drivers/ticalc1x.c", - MAME_DIR .. "src/mess/drivers/tispeak.c", - MAME_DIR .. "src/mess/drivers/ti74.c", - MAME_DIR .. "src/mess/drivers/ti85.c", - MAME_DIR .. "src/mess/machine/ti85.c", - MAME_DIR .. "src/mess/video/ti85.c", - MAME_DIR .. "src/mess/drivers/ti89.c", - MAME_DIR .. "src/mess/drivers/ti99_2.c", - MAME_DIR .. "src/mess/drivers/ti99_4x.c", - MAME_DIR .. "src/mess/drivers/ti99_4p.c", - MAME_DIR .. "src/mess/drivers/ti99_8.c", - MAME_DIR .. "src/mess/drivers/ti990_4.c", - MAME_DIR .. "src/mess/drivers/ti990_10.c", - MAME_DIR .. "src/mess/drivers/tm990189.c", - MAME_DIR .. "src/mess/video/733_asr.c", - MAME_DIR .. "src/mess/video/911_vdt.c", - MAME_DIR .. "src/mess/drivers/hh_tms1k.c", + MAME_DIR .. "src/mame/drivers/avigo.c", + MAME_DIR .. "src/mame/video/avigo.c", + MAME_DIR .. "src/mame/drivers/cc40.c", + MAME_DIR .. "src/mame/drivers/evmbug.c", + MAME_DIR .. "src/mame/drivers/exelv.c", + MAME_DIR .. "src/mame/drivers/geneve.c", + MAME_DIR .. "src/mame/drivers/ticalc1x.c", + MAME_DIR .. "src/mame/drivers/tispeak.c", + MAME_DIR .. "src/mame/drivers/ti74.c", + MAME_DIR .. "src/mame/drivers/ti85.c", + MAME_DIR .. "src/mame/machine/ti85.c", + MAME_DIR .. "src/mame/video/ti85.c", + MAME_DIR .. "src/mame/drivers/ti89.c", + MAME_DIR .. "src/mame/drivers/ti99_2.c", + MAME_DIR .. "src/mame/drivers/ti99_4x.c", + MAME_DIR .. "src/mame/drivers/ti99_4p.c", + MAME_DIR .. "src/mame/drivers/ti99_8.c", + MAME_DIR .. "src/mame/drivers/ti990_4.c", + MAME_DIR .. "src/mame/drivers/ti990_10.c", + MAME_DIR .. "src/mame/drivers/tm990189.c", + MAME_DIR .. "src/mame/video/733_asr.c", + MAME_DIR .. "src/mame/video/911_vdt.c", + MAME_DIR .. "src/mame/drivers/hh_tms1k.c", } createMESSProjects(_target, _subtarget, "tiger") files { - MAME_DIR .. "src/mess/drivers/gamecom.c", - MAME_DIR .. "src/mess/machine/gamecom.c", - MAME_DIR .. "src/mess/video/gamecom.c", + MAME_DIR .. "src/mame/drivers/gamecom.c", + MAME_DIR .. "src/mame/machine/gamecom.c", + MAME_DIR .. "src/mame/video/gamecom.c", } createMESSProjects(_target, _subtarget, "tigertel") files { - MAME_DIR .. "src/mess/drivers/gizmondo.c", - MAME_DIR .. "src/mess/machine/docg3.c", + MAME_DIR .. "src/mame/drivers/gizmondo.c", + MAME_DIR .. "src/mame/machine/docg3.c", } createMESSProjects(_target, _subtarget, "tiki") files { - MAME_DIR .. "src/mess/drivers/tiki100.c", + MAME_DIR .. "src/mame/drivers/tiki100.c", } createMESSProjects(_target, _subtarget, "tomy") files { - MAME_DIR .. "src/mess/drivers/tutor.c", + MAME_DIR .. "src/mame/drivers/tutor.c", } createMESSProjects(_target, _subtarget, "toshiba") files { - MAME_DIR .. "src/mess/drivers/pasopia.c", - MAME_DIR .. "src/mess/drivers/pasopia7.c", - MAME_DIR .. "src/mess/drivers/paso1600.c", + MAME_DIR .. "src/mame/drivers/pasopia.c", + MAME_DIR .. "src/mame/drivers/pasopia7.c", + MAME_DIR .. "src/mame/drivers/paso1600.c", } createMESSProjects(_target, _subtarget, "trainer") files { - MAME_DIR .. "src/mess/drivers/amico2k.c", - MAME_DIR .. "src/mess/drivers/babbage.c", - MAME_DIR .. "src/mess/drivers/bob85.c", - MAME_DIR .. "src/mess/drivers/cvicny.c", - MAME_DIR .. "src/mess/drivers/dolphunk.c", - MAME_DIR .. "src/mess/drivers/instruct.c", - MAME_DIR .. "src/mess/drivers/mk14.c", - MAME_DIR .. "src/mess/drivers/pro80.c", - MAME_DIR .. "src/mess/drivers/savia84.c", - MAME_DIR .. "src/mess/drivers/selz80.c", - MAME_DIR .. "src/mess/drivers/tk80.c", + MAME_DIR .. "src/mame/drivers/amico2k.c", + MAME_DIR .. "src/mame/drivers/babbage.c", + MAME_DIR .. "src/mame/drivers/bob85.c", + MAME_DIR .. "src/mame/drivers/cvicny.c", + MAME_DIR .. "src/mame/drivers/dolphunk.c", + MAME_DIR .. "src/mame/drivers/instruct.c", + MAME_DIR .. "src/mame/drivers/mk14.c", + MAME_DIR .. "src/mame/drivers/pro80.c", + MAME_DIR .. "src/mame/drivers/savia84.c", + MAME_DIR .. "src/mame/drivers/selz80.c", + MAME_DIR .. "src/mame/drivers/tk80.c", } createMESSProjects(_target, _subtarget, "trs") files { - MAME_DIR .. "src/mess/drivers/coco12.c", - MAME_DIR .. "src/mess/drivers/coco3.c", - MAME_DIR .. "src/mess/drivers/dragon.c", - MAME_DIR .. "src/mess/drivers/mc10.c", - MAME_DIR .. "src/mess/machine/6883sam.c", - MAME_DIR .. "src/mess/machine/coco.c", - MAME_DIR .. "src/mess/machine/coco12.c", - MAME_DIR .. "src/mess/machine/coco3.c", - MAME_DIR .. "src/mess/machine/coco_vhd.c", - MAME_DIR .. "src/mess/machine/dragon.c", - MAME_DIR .. "src/mess/machine/dgnalpha.c", - MAME_DIR .. "src/mess/video/gime.c", - MAME_DIR .. "src/mess/drivers/trs80.c", - MAME_DIR .. "src/mess/machine/trs80.c", - MAME_DIR .. "src/mess/video/trs80.c", - MAME_DIR .. "src/mess/drivers/trs80m2.c", - MAME_DIR .. "src/mess/machine/trs80m2kb.c", - MAME_DIR .. "src/mess/drivers/tandy2k.c", - MAME_DIR .. "src/mess/machine/tandy2kb.c", + MAME_DIR .. "src/mame/drivers/coco12.c", + MAME_DIR .. "src/mame/drivers/coco3.c", + MAME_DIR .. "src/mame/drivers/dragon.c", + MAME_DIR .. "src/mame/drivers/mc10.c", + MAME_DIR .. "src/mame/machine/6883sam.c", + MAME_DIR .. "src/mame/machine/coco.c", + MAME_DIR .. "src/mame/machine/coco12.c", + MAME_DIR .. "src/mame/machine/coco3.c", + MAME_DIR .. "src/mame/machine/coco_vhd.c", + MAME_DIR .. "src/mame/machine/dragon.c", + MAME_DIR .. "src/mame/machine/dgnalpha.c", + MAME_DIR .. "src/mame/video/gime.c", + MAME_DIR .. "src/mame/drivers/trs80.c", + MAME_DIR .. "src/mame/machine/trs80.c", + MAME_DIR .. "src/mame/video/trs80.c", + MAME_DIR .. "src/mame/drivers/trs80m2.c", + MAME_DIR .. "src/mame/machine/trs80m2kb.c", + MAME_DIR .. "src/mame/drivers/tandy2k.c", + MAME_DIR .. "src/mame/machine/tandy2kb.c", } createMESSProjects(_target, _subtarget, "ultimachine") files { - MAME_DIR .. "src/mess/drivers/rambo.c", + MAME_DIR .. "src/mame/drivers/rambo.c", } createMESSProjects(_target, _subtarget, "ultratec") files { - MAME_DIR .. "src/mess/drivers/minicom.c", + MAME_DIR .. "src/mame/drivers/minicom.c", } createMESSProjects(_target, _subtarget, "unisys") files { - MAME_DIR .. "src/mess/drivers/univac.c", + MAME_DIR .. "src/mame/drivers/univac.c", } createMESSProjects(_target, _subtarget, "veb") files { - MAME_DIR .. "src/mess/drivers/chessmst.c", - MAME_DIR .. "src/mess/drivers/kc.c", - MAME_DIR .. "src/mess/machine/kc.c", - MAME_DIR .. "src/mess/machine/kc_keyb.c", - MAME_DIR .. "src/mess/video/kc.c", - MAME_DIR .. "src/mess/drivers/lc80.c", - MAME_DIR .. "src/mess/drivers/mc80.c", - MAME_DIR .. "src/mess/machine/mc80.c", - MAME_DIR .. "src/mess/video/mc80.c", - MAME_DIR .. "src/mess/drivers/poly880.c", - MAME_DIR .. "src/mess/drivers/sc1.c", - MAME_DIR .. "src/mess/drivers/sc2.c", + MAME_DIR .. "src/mame/drivers/chessmst.c", + MAME_DIR .. "src/mame/drivers/kc.c", + MAME_DIR .. "src/mame/machine/kc.c", + MAME_DIR .. "src/mame/machine/kc_keyb.c", + MAME_DIR .. "src/mame/video/kc.c", + MAME_DIR .. "src/mame/drivers/lc80.c", + MAME_DIR .. "src/mame/drivers/mc80.c", + MAME_DIR .. "src/mame/machine/mc80.c", + MAME_DIR .. "src/mame/video/mc80.c", + MAME_DIR .. "src/mame/drivers/poly880.c", + MAME_DIR .. "src/mame/drivers/sc1.c", + MAME_DIR .. "src/mame/drivers/sc2.c", } createMESSProjects(_target, _subtarget, "vidbrain") files { - MAME_DIR .. "src/mess/drivers/vidbrain.c", - MAME_DIR .. "src/mess/video/uv201.c", + MAME_DIR .. "src/mame/drivers/vidbrain.c", + MAME_DIR .. "src/mame/video/uv201.c", } createMESSProjects(_target, _subtarget, "videoton") files { - MAME_DIR .. "src/mess/drivers/tvc.c", - MAME_DIR .. "src/mess/audio/tvc_snd.c", + MAME_DIR .. "src/mame/drivers/tvc.c", + MAME_DIR .. "src/mame/audio/tvc_snd.c", } createMESSProjects(_target, _subtarget, "visual") files { - MAME_DIR .. "src/mess/drivers/v1050.c", - MAME_DIR .. "src/mess/machine/v1050kb.c", - MAME_DIR .. "src/mess/video/v1050.c", + MAME_DIR .. "src/mame/drivers/v1050.c", + MAME_DIR .. "src/mame/machine/v1050kb.c", + MAME_DIR .. "src/mame/video/v1050.c", } createMESSProjects(_target, _subtarget, "votrax") files { - MAME_DIR .. "src/mess/drivers/votrpss.c", - MAME_DIR .. "src/mess/drivers/votrtnt.c", + MAME_DIR .. "src/mame/drivers/votrpss.c", + MAME_DIR .. "src/mame/drivers/votrtnt.c", } createMESSProjects(_target, _subtarget, "vtech") files { - MAME_DIR .. "src/mess/drivers/crvision.c", - MAME_DIR .. "src/mess/drivers/geniusiq.c", - MAME_DIR .. "src/mess/drivers/laser3k.c", - MAME_DIR .. "src/mess/drivers/lcmate2.c", - MAME_DIR .. "src/mess/drivers/pc4.c", - MAME_DIR .. "src/mess/video/pc4.c", - MAME_DIR .. "src/mess/drivers/pc2000.c", - MAME_DIR .. "src/mess/drivers/pitagjr.c", - MAME_DIR .. "src/mess/drivers/prestige.c", - MAME_DIR .. "src/mess/drivers/vtech1.c", - MAME_DIR .. "src/mess/drivers/vtech2.c", - MAME_DIR .. "src/mess/machine/vtech2.c", - MAME_DIR .. "src/mess/video/vtech2.c", - MAME_DIR .. "src/mess/drivers/socrates.c", - MAME_DIR .. "src/mess/audio/socrates.c", + MAME_DIR .. "src/mame/drivers/crvision.c", + MAME_DIR .. "src/mame/drivers/geniusiq.c", + MAME_DIR .. "src/mame/drivers/laser3k.c", + MAME_DIR .. "src/mame/drivers/lcmate2.c", + MAME_DIR .. "src/mame/drivers/pc4.c", + MAME_DIR .. "src/mame/video/pc4.c", + MAME_DIR .. "src/mame/drivers/pc2000.c", + MAME_DIR .. "src/mame/drivers/pitagjr.c", + MAME_DIR .. "src/mame/drivers/prestige.c", + MAME_DIR .. "src/mame/drivers/vtech1.c", + MAME_DIR .. "src/mame/drivers/vtech2.c", + MAME_DIR .. "src/mame/machine/vtech2.c", + MAME_DIR .. "src/mame/video/vtech2.c", + MAME_DIR .. "src/mame/drivers/socrates.c", + MAME_DIR .. "src/mame/audio/socrates.c", } createMESSProjects(_target, _subtarget, "wang") files { - MAME_DIR .. "src/mess/drivers/wangpc.c", - MAME_DIR .. "src/mess/machine/wangpckb.c", + MAME_DIR .. "src/mame/drivers/wangpc.c", + MAME_DIR .. "src/mame/machine/wangpckb.c", } createMESSProjects(_target, _subtarget, "wavemate") files { - MAME_DIR .. "src/mess/drivers/bullet.c", - MAME_DIR .. "src/mess/drivers/jupiter.c", + MAME_DIR .. "src/mame/drivers/bullet.c", + MAME_DIR .. "src/mame/drivers/jupiter.c", } createMESSProjects(_target, _subtarget, "xerox") files { - MAME_DIR .. "src/mess/drivers/xerox820.c", - MAME_DIR .. "src/mess/machine/x820kb.c", - MAME_DIR .. "src/mess/drivers/bigbord2.c", - MAME_DIR .. "src/mess/drivers/alto2.c", + MAME_DIR .. "src/mame/drivers/xerox820.c", + MAME_DIR .. "src/mame/machine/x820kb.c", + MAME_DIR .. "src/mame/drivers/bigbord2.c", + MAME_DIR .. "src/mame/drivers/alto2.c", } createMESSProjects(_target, _subtarget, "xussrpc") files { - MAME_DIR .. "src/mess/drivers/ec184x.c", - MAME_DIR .. "src/mess/drivers/iskr103x.c", - MAME_DIR .. "src/mess/drivers/mc1502.c", - MAME_DIR .. "src/mess/drivers/poisk1.c", - MAME_DIR .. "src/mess/video/poisk1.c", + MAME_DIR .. "src/mame/drivers/ec184x.c", + MAME_DIR .. "src/mame/drivers/iskr103x.c", + MAME_DIR .. "src/mame/drivers/mc1502.c", + MAME_DIR .. "src/mame/drivers/poisk1.c", + MAME_DIR .. "src/mame/video/poisk1.c", } createMESSProjects(_target, _subtarget, "yamaha") files { - MAME_DIR .. "src/mess/drivers/ymmu100.c", - MAME_DIR .. "src/mess/drivers/fb01.c", + MAME_DIR .. "src/mame/drivers/ymmu100.c", + MAME_DIR .. "src/mame/drivers/fb01.c", } dependency { - { MAME_DIR .. "src/mess/drivers/ymmu100.c", GEN_DIR .. "mess/drivers/ymmu100.inc" }, + { MAME_DIR .. "src/mame/drivers/ymmu100.c", GEN_DIR .. "mess/drivers/ymmu100.inc" }, } custombuildtask { - { MAME_DIR .. "src/mess/drivers/ymmu100.ppm", GEN_DIR .. "mess/drivers/ymmu100.inc", { MAME_DIR .. "src/build/file2str.py" }, {"@echo Converting src/drivers/ymmu100.ppm...", PYTHON .. " $(1) $(<) $(@) ymmu100_bkg UINT8" }}, + { MAME_DIR .. "src/mame/drivers/ymmu100.ppm", GEN_DIR .. "mess/drivers/ymmu100.inc", { MAME_DIR .. "src/build/file2str.py" }, {"@echo Converting src/drivers/ymmu100.ppm...", PYTHON .. " $(1) $(<) $(@) ymmu100_bkg UINT8" }}, } createMESSProjects(_target, _subtarget, "zenith") files { - MAME_DIR .. "src/mess/drivers/z100.c", + MAME_DIR .. "src/mame/drivers/z100.c", } createMESSProjects(_target, _subtarget, "zpa") files { - MAME_DIR .. "src/mess/drivers/iq151.c", + MAME_DIR .. "src/mame/drivers/iq151.c", } createMESSProjects(_target, _subtarget, "zvt") files { - MAME_DIR .. "src/mess/drivers/pp01.c", - MAME_DIR .. "src/mess/machine/pp01.c", - MAME_DIR .. "src/mess/video/pp01.c", + MAME_DIR .. "src/mame/drivers/pp01.c", + MAME_DIR .. "src/mame/machine/pp01.c", + MAME_DIR .. "src/mame/video/pp01.c", } createMESSProjects(_target, _subtarget, "skeleton") files { - MAME_DIR .. "src/mess/drivers/alphasma.c", - MAME_DIR .. "src/mess/drivers/ampro.c", - MAME_DIR .. "src/mess/drivers/amust.c", - MAME_DIR .. "src/mess/drivers/applix.c", - MAME_DIR .. "src/mess/drivers/attache.c", - MAME_DIR .. "src/mess/drivers/aussiebyte.c", - MAME_DIR .. "src/mess/video/aussiebyte.c", - MAME_DIR .. "src/mess/drivers/ax20.c", - MAME_DIR .. "src/mess/drivers/beehive.c", - MAME_DIR .. "src/mess/drivers/binbug.c", - MAME_DIR .. "src/mess/drivers/besta.c", - MAME_DIR .. "src/mess/drivers/bitgraph.c", - MAME_DIR .. "src/mess/drivers/br8641.c", - MAME_DIR .. "src/mess/drivers/busicom.c", - MAME_DIR .. "src/mess/video/busicom.c", - MAME_DIR .. "src/mess/drivers/chaos.c", - MAME_DIR .. "src/mess/drivers/chesstrv.c", - MAME_DIR .. "src/mess/drivers/cd2650.c", - MAME_DIR .. "src/mess/drivers/cdc721.c", - MAME_DIR .. "src/mess/drivers/codata.c", - MAME_DIR .. "src/mess/drivers/cortex.c", - MAME_DIR .. "src/mess/drivers/cosmicos.c", - MAME_DIR .. "src/mess/drivers/cp1.c", - MAME_DIR .. "src/mess/drivers/cxhumax.c", - MAME_DIR .. "src/mess/drivers/czk80.c", - MAME_DIR .. "src/mess/drivers/d6800.c", - MAME_DIR .. "src/mess/drivers/d6809.c", - MAME_DIR .. "src/mess/drivers/daruma.c", - MAME_DIR .. "src/mess/drivers/digel804.c", - MAME_DIR .. "src/mess/drivers/dim68k.c", - MAME_DIR .. "src/mess/drivers/dm7000.c", - MAME_DIR .. "src/mess/drivers/dmv.c", - MAME_DIR .. "src/mess/machine/dmv_keyb.c", - MAME_DIR .. "src/mess/drivers/dps1.c", - MAME_DIR .. "src/mess/drivers/dsb46.c", - MAME_DIR .. "src/mess/drivers/dual68.c", - MAME_DIR .. "src/mess/drivers/eacc.c", - MAME_DIR .. "src/mess/drivers/elwro800.c", - MAME_DIR .. "src/mess/drivers/eti660.c", - MAME_DIR .. "src/mess/drivers/excali64.c", - MAME_DIR .. "src/mess/drivers/fanucs15.c", - MAME_DIR .. "src/mess/drivers/fanucspmg.c", - MAME_DIR .. "src/mess/drivers/fc100.c", - MAME_DIR .. "src/mess/drivers/fk1.c", - MAME_DIR .. "src/mess/drivers/ft68m.c", - MAME_DIR .. "src/mess/drivers/gamate.c", - MAME_DIR .. "src/mess/audio/gamate.c", - MAME_DIR .. "src/mess/drivers/gameking.c", - MAME_DIR .. "src/mess/drivers/gimix.c", - MAME_DIR .. "src/mess/drivers/grfd2301.c", - MAME_DIR .. "src/mess/drivers/harriet.c", - MAME_DIR .. "src/mess/drivers/hprot1.c", - MAME_DIR .. "src/mess/drivers/hpz80unk.c", - MAME_DIR .. "src/mess/drivers/ht68k.c", - MAME_DIR .. "src/mess/drivers/hunter2.c", - MAME_DIR .. "src/mess/drivers/i7000.c", - MAME_DIR .. "src/mess/drivers/ibm6580.c", - MAME_DIR .. "src/mess/drivers/icatel.c", - MAME_DIR .. "src/mess/drivers/ie15.c", - MAME_DIR .. "src/mess/machine/ie15_kbd.c", - MAME_DIR .. "src/mess/drivers/if800.c", - MAME_DIR .. "src/mess/drivers/imsai.c", - MAME_DIR .. "src/mess/drivers/indiana.c", - MAME_DIR .. "src/mess/drivers/itt3030.c", - MAME_DIR .. "src/mess/drivers/jade.c", - MAME_DIR .. "src/mess/drivers/jonos.c", - MAME_DIR .. "src/mess/drivers/konin.c", - MAME_DIR .. "src/mess/drivers/leapster.c", - MAME_DIR .. "src/mess/drivers/lft.c", - MAME_DIR .. "src/mess/drivers/lg-dvd.c", - MAME_DIR .. "src/mess/drivers/lola8a.c", - MAME_DIR .. "src/mess/drivers/m79152pc.c", - MAME_DIR .. "src/mess/drivers/mccpm.c", - MAME_DIR .. "src/mess/drivers/mes.c", - MAME_DIR .. "src/mess/drivers/mice.c", - MAME_DIR .. "src/mess/drivers/micronic.c", - MAME_DIR .. "src/mess/drivers/mini2440.c", - MAME_DIR .. "src/mess/drivers/mmd1.c", - MAME_DIR .. "src/mess/drivers/mod8.c", - MAME_DIR .. "src/mess/drivers/modellot.c", - MAME_DIR .. "src/mess/drivers/molecular.c", - MAME_DIR .. "src/mess/drivers/ms0515.c", - MAME_DIR .. "src/mess/drivers/ms9540.c", - MAME_DIR .. "src/mess/drivers/mstation.c", - MAME_DIR .. "src/mess/drivers/mt735.c", - MAME_DIR .. "src/mess/drivers/mx2178.c", - MAME_DIR .. "src/mess/drivers/mycom.c", - MAME_DIR .. "src/mess/drivers/myvision.c", - MAME_DIR .. "src/mess/drivers/ngen.c", - MAME_DIR .. "src/mess/machine/ngen_kb.c", - MAME_DIR .. "src/mess/drivers/octopus.c", - MAME_DIR .. "src/mess/drivers/onyx.c", - MAME_DIR .. "src/mess/drivers/okean240.c", - MAME_DIR .. "src/mess/drivers/p8k.c", - MAME_DIR .. "src/mess/drivers/pegasus.c", - MAME_DIR .. "src/mess/drivers/pencil2.c", - MAME_DIR .. "src/mess/drivers/pes.c", - MAME_DIR .. "src/mess/drivers/pipbug.c", - MAME_DIR .. "src/mess/drivers/plan80.c", - MAME_DIR .. "src/mess/drivers/pm68k.c", - MAME_DIR .. "src/mess/drivers/poly.c", - MAME_DIR .. "src/mess/drivers/pt68k4.c", - MAME_DIR .. "src/mess/drivers/ptcsol.c", - MAME_DIR .. "src/mess/drivers/pulsar.c", - MAME_DIR .. "src/mess/drivers/pv9234.c", - MAME_DIR .. "src/mess/drivers/qtsbc.c", - MAME_DIR .. "src/mess/drivers/rvoice.c", - MAME_DIR .. "src/mess/drivers/sacstate.c", - MAME_DIR .. "src/mess/drivers/sbrain.c", - MAME_DIR .. "src/mess/drivers/seattlecmp.c", - MAME_DIR .. "src/mess/drivers/sh4robot.c", - MAME_DIR .. "src/mess/drivers/softbox.c", - MAME_DIR .. "src/mess/drivers/swtpc.c", - MAME_DIR .. "src/mess/drivers/sys2900.c", - MAME_DIR .. "src/mess/drivers/systec.c", - MAME_DIR .. "src/mess/drivers/tavernie.c", - MAME_DIR .. "src/mess/drivers/tecnbras.c", - MAME_DIR .. "src/mess/drivers/terak.c", - MAME_DIR .. "src/mess/drivers/ti630.c", - MAME_DIR .. "src/mess/drivers/tsispch.c", - MAME_DIR .. "src/mess/drivers/tvgame.c", - MAME_DIR .. "src/mess/drivers/unistar.c", - MAME_DIR .. "src/mess/drivers/v6809.c", - MAME_DIR .. "src/mess/drivers/vector4.c", - MAME_DIR .. "src/mess/drivers/vii.c", - MAME_DIR .. "src/mess/drivers/wicat.c", - MAME_DIR .. "src/mess/drivers/xor100.c", - MAME_DIR .. "src/mess/drivers/xavix.c", - MAME_DIR .. "src/mess/drivers/zorba.c", - MAME_DIR .. "src/mess/drivers/squale.c", + MAME_DIR .. "src/mame/drivers/alphasma.c", + MAME_DIR .. "src/mame/drivers/ampro.c", + MAME_DIR .. "src/mame/drivers/amust.c", + MAME_DIR .. "src/mame/drivers/applix.c", + MAME_DIR .. "src/mame/drivers/attache.c", + MAME_DIR .. "src/mame/drivers/aussiebyte.c", + MAME_DIR .. "src/mame/video/aussiebyte.c", + MAME_DIR .. "src/mame/drivers/ax20.c", + MAME_DIR .. "src/mame/drivers/beehive.c", + MAME_DIR .. "src/mame/drivers/binbug.c", + MAME_DIR .. "src/mame/drivers/besta.c", + MAME_DIR .. "src/mame/drivers/bitgraph.c", + MAME_DIR .. "src/mame/drivers/br8641.c", + MAME_DIR .. "src/mame/drivers/busicom.c", + MAME_DIR .. "src/mame/video/busicom.c", + MAME_DIR .. "src/mame/drivers/chaos.c", + MAME_DIR .. "src/mame/drivers/chesstrv.c", + MAME_DIR .. "src/mame/drivers/cd2650.c", + MAME_DIR .. "src/mame/drivers/cdc721.c", + MAME_DIR .. "src/mame/drivers/codata.c", + MAME_DIR .. "src/mame/drivers/cortex.c", + MAME_DIR .. "src/mame/drivers/cosmicos.c", + MAME_DIR .. "src/mame/drivers/cp1.c", + MAME_DIR .. "src/mame/drivers/cxhumax.c", + MAME_DIR .. "src/mame/drivers/czk80.c", + MAME_DIR .. "src/mame/drivers/d6800.c", + MAME_DIR .. "src/mame/drivers/d6809.c", + MAME_DIR .. "src/mame/drivers/daruma.c", + MAME_DIR .. "src/mame/drivers/digel804.c", + MAME_DIR .. "src/mame/drivers/dim68k.c", + MAME_DIR .. "src/mame/drivers/dm7000.c", + MAME_DIR .. "src/mame/drivers/dmv.c", + MAME_DIR .. "src/mame/machine/dmv_keyb.c", + MAME_DIR .. "src/mame/drivers/dps1.c", + MAME_DIR .. "src/mame/drivers/dsb46.c", + MAME_DIR .. "src/mame/drivers/dual68.c", + MAME_DIR .. "src/mame/drivers/eacc.c", + MAME_DIR .. "src/mame/drivers/elwro800.c", + MAME_DIR .. "src/mame/drivers/eti660.c", + MAME_DIR .. "src/mame/drivers/excali64.c", + MAME_DIR .. "src/mame/drivers/fanucs15.c", + MAME_DIR .. "src/mame/drivers/fanucspmg.c", + MAME_DIR .. "src/mame/drivers/fc100.c", + MAME_DIR .. "src/mame/drivers/fk1.c", + MAME_DIR .. "src/mame/drivers/ft68m.c", + MAME_DIR .. "src/mame/drivers/gamate.c", + MAME_DIR .. "src/mame/audio/gamate.c", + MAME_DIR .. "src/mame/drivers/gameking.c", + MAME_DIR .. "src/mame/drivers/gimix.c", + MAME_DIR .. "src/mame/drivers/grfd2301.c", + MAME_DIR .. "src/mame/drivers/harriet.c", + MAME_DIR .. "src/mame/drivers/hprot1.c", + MAME_DIR .. "src/mame/drivers/hpz80unk.c", + MAME_DIR .. "src/mame/drivers/ht68k.c", + MAME_DIR .. "src/mame/drivers/hunter2.c", + MAME_DIR .. "src/mame/drivers/i7000.c", + MAME_DIR .. "src/mame/drivers/ibm6580.c", + MAME_DIR .. "src/mame/drivers/icatel.c", + MAME_DIR .. "src/mame/drivers/ie15.c", + MAME_DIR .. "src/mame/machine/ie15_kbd.c", + MAME_DIR .. "src/mame/drivers/if800.c", + MAME_DIR .. "src/mame/drivers/imsai.c", + MAME_DIR .. "src/mame/drivers/indiana.c", + MAME_DIR .. "src/mame/drivers/itt3030.c", + MAME_DIR .. "src/mame/drivers/jade.c", + MAME_DIR .. "src/mame/drivers/jonos.c", + MAME_DIR .. "src/mame/drivers/konin.c", + MAME_DIR .. "src/mame/drivers/leapster.c", + MAME_DIR .. "src/mame/drivers/lft.c", + MAME_DIR .. "src/mame/drivers/lg-dvd.c", + MAME_DIR .. "src/mame/drivers/lola8a.c", + MAME_DIR .. "src/mame/drivers/m79152pc.c", + MAME_DIR .. "src/mame/drivers/mccpm.c", + MAME_DIR .. "src/mame/drivers/mes.c", + MAME_DIR .. "src/mame/drivers/mice.c", + MAME_DIR .. "src/mame/drivers/micronic.c", + MAME_DIR .. "src/mame/drivers/mini2440.c", + MAME_DIR .. "src/mame/drivers/mmd1.c", + MAME_DIR .. "src/mame/drivers/mod8.c", + MAME_DIR .. "src/mame/drivers/modellot.c", + MAME_DIR .. "src/mame/drivers/molecular.c", + MAME_DIR .. "src/mame/drivers/ms0515.c", + MAME_DIR .. "src/mame/drivers/ms9540.c", + MAME_DIR .. "src/mame/drivers/mstation.c", + MAME_DIR .. "src/mame/drivers/mt735.c", + MAME_DIR .. "src/mame/drivers/mx2178.c", + MAME_DIR .. "src/mame/drivers/mycom.c", + MAME_DIR .. "src/mame/drivers/myvision.c", + MAME_DIR .. "src/mame/drivers/ngen.c", + MAME_DIR .. "src/mame/machine/ngen_kb.c", + MAME_DIR .. "src/mame/drivers/octopus.c", + MAME_DIR .. "src/mame/drivers/onyx.c", + MAME_DIR .. "src/mame/drivers/okean240.c", + MAME_DIR .. "src/mame/drivers/p8k.c", + MAME_DIR .. "src/mame/drivers/pegasus.c", + MAME_DIR .. "src/mame/drivers/pencil2.c", + MAME_DIR .. "src/mame/drivers/pes.c", + MAME_DIR .. "src/mame/drivers/pipbug.c", + MAME_DIR .. "src/mame/drivers/plan80.c", + MAME_DIR .. "src/mame/drivers/pm68k.c", + MAME_DIR .. "src/mame/drivers/poly.c", + MAME_DIR .. "src/mame/drivers/pt68k4.c", + MAME_DIR .. "src/mame/drivers/ptcsol.c", + MAME_DIR .. "src/mame/drivers/pulsar.c", + MAME_DIR .. "src/mame/drivers/pv9234.c", + MAME_DIR .. "src/mame/drivers/qtsbc.c", + MAME_DIR .. "src/mame/drivers/rvoice.c", + MAME_DIR .. "src/mame/drivers/sacstate.c", + MAME_DIR .. "src/mame/drivers/sbrain.c", + MAME_DIR .. "src/mame/drivers/seattlecmp.c", + MAME_DIR .. "src/mame/drivers/sh4robot.c", + MAME_DIR .. "src/mame/drivers/softbox.c", + MAME_DIR .. "src/mame/drivers/swtpc.c", + MAME_DIR .. "src/mame/drivers/sys2900.c", + MAME_DIR .. "src/mame/drivers/systec.c", + MAME_DIR .. "src/mame/drivers/tavernie.c", + MAME_DIR .. "src/mame/drivers/tecnbras.c", + MAME_DIR .. "src/mame/drivers/terak.c", + MAME_DIR .. "src/mame/drivers/ti630.c", + MAME_DIR .. "src/mame/drivers/tsispch.c", + MAME_DIR .. "src/mame/drivers/tvgame.c", + MAME_DIR .. "src/mame/drivers/unistar.c", + MAME_DIR .. "src/mame/drivers/v6809.c", + MAME_DIR .. "src/mame/drivers/vector4.c", + MAME_DIR .. "src/mame/drivers/vii.c", + MAME_DIR .. "src/mame/drivers/wicat.c", + MAME_DIR .. "src/mame/drivers/xor100.c", + MAME_DIR .. "src/mame/drivers/xavix.c", + MAME_DIR .. "src/mame/drivers/zorba.c", + MAME_DIR .. "src/mame/drivers/squale.c", } end diff --git a/src/build/makedep.py b/src/build/makedep.py index 41997d4b1bf..ac5506e28eb 100644 --- a/src/build/makedep.py +++ b/src/build/makedep.py @@ -10,13 +10,13 @@ import sys files_included = ['src/emu/emu.h'] -include_dirs = ['src/emu/', 'src/devices/', 'src/mame/', 'src/mess/'] +include_dirs = ['src/emu/', 'src/devices/', 'src/mame/'] mappings = dict() deps_files_included = [ ] -deps_include_dirs = ['src/mame/', 'src/mess/'] +deps_include_dirs = ['src/mame/'] components = [ ] @@ -289,7 +289,6 @@ if sys.argv[3]=='target': sys.stdout.write(' MAME_DIR .. "src/emu",\n') sys.stdout.write(' MAME_DIR .. "src/devices",\n') sys.stdout.write(' MAME_DIR .. "src/mame",\n') - sys.stdout.write(' MAME_DIR .. "src/mess",\n') sys.stdout.write(' MAME_DIR .. "src/lib",\n') sys.stdout.write(' MAME_DIR .. "src/lib/util",\n') sys.stdout.write(' MAME_DIR .. "3rdparty",\n') diff --git a/src/devices/bus/ieee488/softbox.c b/src/devices/bus/ieee488/softbox.c index 7f1dfe64b9d..a42de1e5011 100644 --- a/src/devices/bus/ieee488/softbox.c +++ b/src/devices/bus/ieee488/softbox.c @@ -10,7 +10,7 @@ This is an emulation of the SoftBox as a PET/CBM peripheral, where the PET is used as a terminal over IEEE-488. For the standalone mode where an RS-232 terminal is used, and also information on - how to set up the Corvus drive, see: src/mess/drivers/softbox.c. + how to set up the Corvus drive, see: src/mame/drivers/softbox.c. */ diff --git a/src/mame/audio/alesis.c b/src/mame/audio/alesis.c new file mode 100644 index 00000000000..7a253db43a2 --- /dev/null +++ b/src/mame/audio/alesis.c @@ -0,0 +1,157 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Alesis HR-16 sound (DM3AG + PCM54) emulation + + TODO: + - volume + - panning + - output 2 + +****************************************************************************/ + +#include "emu.h" +#include "includes/alesis.h" + +#define LOG 1 + +// device type definition +const device_type ALESIS_DM3AG = &device_creator; + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +static MACHINE_CONFIG_FRAGMENT( alesis_dm3ag ) + MCFG_SPEAKER_STANDARD_STEREO("out1_left", "out1_right") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "out1_left", 1.0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "out1_right", 1.0) +MACHINE_CONFIG_END + +//------------------------------------------------- +// alesis_dm3ag_device - constructor +//------------------------------------------------- + +alesis_dm3ag_device::alesis_dm3ag_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ALESIS_DM3AG, "Alesis DM3AG", tag, owner, clock, "alesis_dm3ag", __FILE__), + m_dac(*this, "dac"), + m_samples(*this, DEVICE_SELF) +{ +} + +//------------------------------------------------- +// device_mconfig_additions +//------------------------------------------------- + +machine_config_constructor alesis_dm3ag_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( alesis_dm3ag ); +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void alesis_dm3ag_device::device_start() +{ + m_dac_update_timer = timer_alloc(TIMER_DAC_UPDATE); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void alesis_dm3ag_device::device_reset() +{ + m_dac_update_timer->adjust(attotime::from_hz(48000), 0, attotime::from_hz(48000)); + + m_output_active = false; + m_count = 0; + m_cur_sample = 0; + m_shift = 0; + memset(m_cmd, 0, sizeof(m_cmd)); +} + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- +void alesis_dm3ag_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (m_output_active) + { + INT16 sample = m_samples[m_cur_sample++]; + int count = 0; + + while (sample == -128) + { + count++; + + if (count == 1 && m_shift) + { + /* + The HR-16 seems to use a simple scheme to generate 16-bit samples from its 8-bit sample ROMs. + When the sound starts the 8-bit sample is sent to the most significant bits of the DAC and every + time a -1 sample is found the data is shifted one position to right. + */ + m_shift--; + + if (LOG) logerror("DM3AG '%s' shift: %02x\n", tag(), m_shift); + } + + // every block ends with three or more -1 samples + if (m_cur_sample == 0xfffff || count >= 3) + { + m_output_active = false; + sample = 0; + + if (LOG) logerror("DM3AG '%s' stop: %d, len: %d\n", tag(), m_cur_sample, m_cur_sample-((m_cmd[0]<<12) | (m_cmd[1]<<4) | ((m_cmd[2]>>4) & 0x0f))); + + break; + } + + sample = m_samples[m_cur_sample++]; + } + + m_dac->write_signed16((sample << m_shift) + 0x8000); + } +} + +WRITE8_MEMBER(alesis_dm3ag_device::write) +{ + if (LOG) logerror("DM3AG '%s' write: %02x\n", tag(), data); + + m_cmd[m_count++] = data; + + if (m_count == 5) + { + /* + commands are sent in block of 5 bytes (40 bits) + + bit 00-19 sample position in the roms + bit 20-23 ??? + bit 24-31 volume + bit 32-34 panning + bit 35 output selector: 0 = out2, 1 = out1 + bit 36-39 ??? + */ + + m_cur_sample = (m_cmd[0]<<12) | (m_cmd[1]<<4) | ((m_cmd[2]>>4) & 0x0f); + + if (m_cur_sample > 0) + { + m_output_active = true; + m_shift = 8; + + if (LOG) + { + bool good_pos = (m_cur_sample<2 || m_samples[m_cur_sample-2] == -128); + + logerror("DM3AG '%s' start: %d (%s), vol: %02x out: %d pan: %d\n", tag(), m_cur_sample, good_pos ? "ok": "no", m_cmd[3], m_cmd[4] & 0x10 ? 1 : 2, (m_cmd[4]>>5)&7); + } + } + + m_count = 0; + } +} diff --git a/src/mame/audio/arcadia.c b/src/mame/audio/arcadia.c new file mode 100644 index 00000000000..306932a0b44 --- /dev/null +++ b/src/mame/audio/arcadia.c @@ -0,0 +1,177 @@ +// license:GPL-2.0+ +// copyright-holders:David Viens, Peter Trauner +/*************************************************************************** + + PeT mess@utanet.at + main part in video/ + + Refined with recording/analysis on MPT-03 (PAL UVI chip) by plgDavid + + NTSC UVI sound clock: 15734Hz (arcadia) + PAL UVI sound clock: 15625Hz (Soundic MPT-03 - owned by plgDavid) +***************************************************************************/ + + +#include "includes/arcadia.h" + +//known UVI audio clocks +#define UVI_NTSC 15734 +#define UVI_PAL 15625 + +/* we need to create pulse transitions that sound 'decent' + with the current mess/mame interp scheme + + this is not needed anymore with the new trick in streams.c +*/ + +#define OSAMP 1 + +//lfsr is 9 bits long (and same as Atari TIA pure noise) +#define LFSR_MASK (1<<8) + +//makes alien invaders samples noise sync. +#define LFSR_INIT 0x00f0 + +//lfsr states at resynch borders +//0x01c1 +//0x01e0 +//0x00f0 //good synch +//0x0178 +//0x01bc + + +// device type definition +const device_type ARCADIA_SOUND = &device_creator; + +//------------------------------------------------- +// arcadia_sound_device - constructor +//------------------------------------------------- + +arcadia_sound_device::arcadia_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ARCADIA_SOUND, "Arcadia Audio Custom", tag, owner, clock, "arcadia_sound", __FILE__), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- +void arcadia_sound_device::device_start() +{ + m_channel = machine().sound().stream_alloc(*this, 0, 1, UVI_PAL*OSAMP); + m_lfsr = LFSR_INIT; + m_tval = 1; + logerror("arcadia_sound start\n"); +} + +//------------------------------------------------- +// device_start - device-specific reset +//------------------------------------------------- +void arcadia_sound_device::device_reset() +{ + memset(m_reg, 0, sizeof(m_reg)); + m_omode = 0; + m_pos = 0; +} + +//------------------------------------------------- +// sound_stream_update - handle update requests for +// our sound stream +//------------------------------------------------- + +void arcadia_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + int i; + stream_sample_t *buffer = outputs[0]; + + for (i = 0; i < samples; i++, buffer++) + { + *buffer = 0; + + //if minimal pitch ? + if (m_reg[1]){ + switch (m_mode){ + //dont play anything + case 0:break; + + //tone only + case 1: + *buffer = m_volume * m_tval; + break; + + //noise only + case 2: + *buffer = m_volume * m_nval; + break; + + //tone AND noise (bitwise and) + case 3: + *buffer = m_volume * (m_tval & m_nval); + break; + } + + //counter + m_pos++; + + if (m_pos >= m_size){ + //calculate new noise bit ( taps: 0000T000T) + unsigned char newBit = m_lfsr & 1; //first tap + newBit = (newBit ^ ((m_lfsr & 0x10)?1:0) );//xor with second tap + + m_nval = m_lfsr & 1; //taking new output from LSB + m_lfsr = m_lfsr >> 1;//shifting + + //insert new bit at end position (size-1) (only if non null) + if (newBit) + m_lfsr |= LFSR_MASK; + + //invert tone + m_tval = !m_tval; + + m_pos = 0; + } + } + } +} + + + +//------------------------------------------------- +// soundport_w +//------------------------------------------------- + +WRITE8_MEMBER(arcadia_sound_device::write) +{ + m_channel->update(); + m_reg[offset] = data; + + //logerror("arcadia_sound write:%x=%x\n",offset,data); + + switch (offset) + { + case 1: + //as per Gobbler samples: + //the freq counter is only applied on the next change in the flip flop + m_size = (data & 0x7f)*OSAMP; + //logerror("arcadia_sound write: frq:%d\n",data); + + //reset LFSR + if(!m_size) + m_lfsr = LFSR_INIT; + break; + + case 2: + m_volume = (data & 0x07) * 0x800; + m_mode = (data & 0x18) >> 3; + + //logerror("arcadia_sound write: vol:%d mode:%d\n",m_volume,m_mode ); + + if (m_mode != m_omode){ + //not 100% sure about this, maybe we should not reset anything + //m_pos = 0; + m_tval = 0; + } + m_omode = m_mode; + break; + } +} diff --git a/src/mame/audio/arcadia.h b/src/mame/audio/arcadia.h new file mode 100644 index 00000000000..fa54ba1c0a1 --- /dev/null +++ b/src/mame/audio/arcadia.h @@ -0,0 +1,44 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#ifndef ARCADIA_SOUND_H_ +#define ARCADIA_SOUND_H_ + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_ARCADIA_SOUND_ADD(_tag) \ + MCFG_SOUND_ADD(_tag, ARCADIA_SOUND, 0) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> arcadia_sound_device + +class arcadia_sound_device : public device_t, + public device_sound_interface +{ +public: + // construction/destruction + arcadia_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE8_MEMBER(write); +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + + sound_stream *m_channel; + UINT8 m_reg[3]; + int m_size, m_pos,m_tval,m_nval; + unsigned m_mode, m_omode; + unsigned m_volume; + unsigned m_lfsr; +}; + +// device type definition +extern const device_type ARCADIA_SOUND; + +#endif /* ARCADIA_SOUND_H_ */ diff --git a/src/mame/audio/channelf.c b/src/mame/audio/channelf.c new file mode 100644 index 00000000000..c9e07cbd43c --- /dev/null +++ b/src/mame/audio/channelf.c @@ -0,0 +1,143 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle +#include "emu.h" +#include "audio/channelf.h" + + +#define MAX_AMPLITUDE 0x7fff + +const device_type CHANNELF_SOUND = &device_creator; + +channelf_sound_device::channelf_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CHANNELF_SOUND, "Channel F Sound", tag, owner, clock, "channelf_sound", __FILE__), + device_sound_interface(mconfig, *this), + m_channel(NULL), + m_sound_mode(0), + m_incr(0), + m_decay_mult(0), + m_envelope(0), + m_sample_counter(0), + m_forced_ontime(0), + m_min_ontime(0) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void channelf_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void channelf_sound_device::device_start() +{ + int rate; + + m_channel = stream_alloc(0, 1, machine().sample_rate()); + rate = machine().sample_rate(); + + /* + * 2V = 1000Hz ~= 3579535/224/16 + * Note 2V on the schematic is not the 2V scanline counter - + * it is the 2V vertical pixel counter + * 1 pixel = 4 scanlines high + * + * + * This is a convenient way to generate the relevant frequencies, + * using a DDS (Direct Digital Synthesizer) + * + * Essentially, you want a counter to overflow some bit position + * at a fixed rate. So, you figure out a number which you can add + * to the counter at every sample, so that you will achieve this + * + * In this case, we want to overflow bit 16 and the 2V rate, 1000Hz. + * This means we also get bit 17 = 4V, bit 18 = 8V, etc. + */ + + /* This is the proper value to add per sample */ + m_incr = 65536.0/(rate/1000.0/2.0); + + // added for improved sound + /* This is the minimum forced ontime, in samples */ + m_min_ontime = rate/1000*2; /* approx 2ms - estimated, not verified on HW */ + + /* This was measured, decay envelope with half life of ~9ms */ + /* (this is decay multiplier per sample) */ + m_decay_mult = exp((-0.693/9e-3)/rate); + + /* initial conditions */ + m_envelope = 0; +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void channelf_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + UINT32 mask = 0, target = 0; + stream_sample_t *buffer = outputs[0]; + stream_sample_t *sample = buffer; + + switch( m_sound_mode ) + { + case 0: /* sound off */ + memset(buffer,0,sizeof(*buffer)*samples); + return; + + case 1: /* high tone (2V) - 1000Hz */ + mask = 0x00010000; + target = 0x00010000; + break; + case 2: /* medium tone (4V) - 500Hz */ + mask = 0x00020000; + target = 0x00020000; + break; + case 3: /* low (weird) tone (32V & 8V) */ + mask = 0x00140000; + target = 0x00140000; + break; + } + + while (samples-- > 0) + { + if ((m_forced_ontime > 0) || ((m_sample_counter & mask) == target)) // change made for improved sound + *sample++ = m_envelope; + else + *sample++ = 0; + m_sample_counter += m_incr; + m_envelope *= m_decay_mult; + if (m_forced_ontime > 0) // added for improved sound + m_forced_ontime -= 1; // added for improved sound + } +} + +void channelf_sound_device::sound_w(int mode) +{ + if (mode == m_sound_mode) + return; + + m_channel->update(); + m_sound_mode = mode; + + switch(mode) + { + case 0: + m_envelope = 0; + m_forced_ontime = 0; // added for improved sound + break; + case 1: + case 2: + case 3: + m_envelope = MAX_AMPLITUDE; + m_forced_ontime = m_min_ontime; // added for improved sound + break; + } +} diff --git a/src/mame/audio/channelf.h b/src/mame/audio/channelf.h new file mode 100644 index 00000000000..f227eb67c07 --- /dev/null +++ b/src/mame/audio/channelf.h @@ -0,0 +1,42 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle +/***************************************************************************** + * + * audio/channelf.h + * + ****************************************************************************/ + +#ifndef CHANNELF_SOUND_H_ +#define CHANNELF_SOUND_H_ + +class channelf_sound_device : public device_t, + public device_sound_interface +{ +public: + channelf_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + void sound_w(int mode); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + sound_stream *m_channel; + int m_sound_mode; + int m_incr; + float m_decay_mult; + int m_envelope; + UINT32 m_sample_counter; + int m_forced_ontime; // added for improved sound + int m_min_ontime; // added for improved sound + +}; + +extern const device_type CHANNELF_SOUND; + + +#endif /* CHANNELF_SOUND_H_ */ diff --git a/src/mame/audio/dai_snd.c b/src/mame/audio/dai_snd.c new file mode 100644 index 00000000000..ae0bf3c79c3 --- /dev/null +++ b/src/mame/audio/dai_snd.c @@ -0,0 +1,141 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/*************************************************************************** + + audio/dai_snd.c + + Functions to emulate sound hardware of DAI Personal Computer + + Krzysztof Strzecha + +****************************************************************************/ + +#include "emu.h" +#include "dai_snd.h" + +// device type definition +const device_type DAI_SOUND = &device_creator; + + +//------------------------------------------------- +// dai_sound_device - constructor +//------------------------------------------------- + +dai_sound_device::dai_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DAI_SOUND, "DAI Audio Custom", tag, owner, clock, "dai_sound", __FILE__), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dai_sound_device::device_start() +{ + m_mixer_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dai_sound_device::device_reset() +{ + memset(m_dai_input, 0, sizeof(m_dai_input)); + memset(m_osc_volume, 0, sizeof(m_osc_volume)); + m_noise_volume = 0; +} + + +//------------------------------------------------- +// channels 0/1/2 volume table +//------------------------------------------------- + +const UINT16 dai_sound_device::s_osc_volume_table[] = { + 0, 500, 1000, 1500, + 2000, 2500, 3000, 3500, + 4000, 4500, 5000, 5500, + 6000, 6500, 7000, 7500 +}; + +//------------------------------------------------- +// noise volume table +//------------------------------------------------- + +const UINT16 dai_sound_device::s_noise_volume_table[] = { + 0, 0, 0, 0, + 0, 0, 0, 0, + 500, 1000, 1500, 2000, + 2500, 3000, 3500, 4000 +}; + + +//------------------------------------------------- +// set_volume +//------------------------------------------------- + +WRITE8_MEMBER(dai_sound_device::set_volume) +{ + m_mixer_channel->update(); + + switch (offset & 1) + { + case 0x00: + m_osc_volume[0] = data&0x0f; + m_osc_volume[1] = (data&0xf0)>>4; + break; + + case 0x01: + m_osc_volume[2] = data&0x0f; + m_noise_volume = (data&0xf0)>>4; + } +} + +//------------------------------------------------- +// PIT callbacks +//------------------------------------------------- + +WRITE_LINE_MEMBER(dai_sound_device::set_input_ch0) +{ + m_mixer_channel->update(); + m_dai_input[0] = state; +} + +WRITE_LINE_MEMBER(dai_sound_device::set_input_ch1) +{ + m_mixer_channel->update(); + m_dai_input[1] = state; +} + +WRITE_LINE_MEMBER(dai_sound_device::set_input_ch2) +{ + m_mixer_channel->update(); + m_dai_input[2] = state; +} + +//------------------------------------------------- +// sound_stream_update - handle update requests for +// our sound stream +//------------------------------------------------- + +void dai_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *sample_left = outputs[0]; + stream_sample_t *sample_right = outputs[1]; + + INT16 channel_0_signal = m_dai_input[0] ? s_osc_volume_table[m_osc_volume[0]] : -s_osc_volume_table[m_osc_volume[0]]; + INT16 channel_1_signal = m_dai_input[1] ? s_osc_volume_table[m_osc_volume[1]] : -s_osc_volume_table[m_osc_volume[1]]; + INT16 channel_2_signal = m_dai_input[2] ? s_osc_volume_table[m_osc_volume[2]] : -s_osc_volume_table[m_osc_volume[2]]; + + while (samples--) + { + INT16 noise = machine().rand()&0x01 ? s_noise_volume_table[m_noise_volume] : -s_noise_volume_table[m_noise_volume]; + + /* channel 0 + channel 1 + noise */ + *sample_left++ = channel_0_signal + channel_1_signal + noise; + + /* channel 1 + channel 2 + noise */ + *sample_right++ = channel_1_signal + channel_2_signal + noise; + } +} diff --git a/src/mame/audio/dai_snd.h b/src/mame/audio/dai_snd.h new file mode 100644 index 00000000000..c1e5ae598e7 --- /dev/null +++ b/src/mame/audio/dai_snd.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/***************************************************************************** + * + * dai_snd.h + * + ****************************************************************************/ + +#ifndef DAI_SND_H_ +#define DAI_SND_H_ + +#include "emu.h" + +// ======================> dai_sound_device + +class dai_sound_device : public device_t, + public device_sound_interface +{ +public: + // construction/destruction + dai_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE_LINE_MEMBER(set_input_ch0); + DECLARE_WRITE_LINE_MEMBER(set_input_ch1); + DECLARE_WRITE_LINE_MEMBER(set_input_ch2); + DECLARE_WRITE8_MEMBER(set_volume); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + sound_stream * m_mixer_channel; + int m_dai_input[3]; + UINT8 m_osc_volume[3]; + UINT8 m_noise_volume; + + static const UINT16 s_osc_volume_table[]; + static const UINT16 s_noise_volume_table[]; +}; + +extern const device_type DAI_SOUND; + +#endif /* DAI_H_ */ diff --git a/src/mame/audio/dave.c b/src/mame/audio/dave.c new file mode 100644 index 00000000000..4adae892e16 --- /dev/null +++ b/src/mame/audio/dave.c @@ -0,0 +1,622 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Intelligent Designs DAVE emulation + +**********************************************************************/ + +#include "dave.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + +#define STEP 0x08000 + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type DAVE = &device_creator; + + +DEVICE_ADDRESS_MAP_START( z80_program_map, 8, dave_device ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(program_r, program_w) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START( z80_io_map, 8, dave_device ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(io_r, io_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, dave_device ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( io_map, AS_IO, 8, dave_device ) +ADDRESS_MAP_END + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// dave_device - constructor +//------------------------------------------------- + +dave_device::dave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DAVE, "DAVE", tag, owner, clock, "dave", __FILE__), + device_memory_interface(mconfig, *this), + device_sound_interface(mconfig, *this), + m_program_space_config("program", ENDIANNESS_LITTLE, 8, 22, 0, *ADDRESS_MAP_NAME(program_map)), + m_io_space_config("i/o", ENDIANNESS_LITTLE, 8, 16, 0, *ADDRESS_MAP_NAME(io_map)), + m_write_irq(*this), + m_write_lh(*this), + m_write_rh(*this), + m_irq_status(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dave_device::device_start() +{ + // resolve callbacks + m_write_irq.resolve_safe(); + m_write_lh.resolve_safe(); + m_write_rh.resolve_safe(); + + // allocate timers + m_timer_1hz = timer_alloc(TIMER_1HZ); + m_timer_1hz->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); + + m_timer_50hz = timer_alloc(TIMER_50HZ); + m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000)); + + // state saving + save_item(NAME(m_segment)); + save_item(NAME(m_irq_status)); + save_item(NAME(m_irq_enable)); + save_item(NAME(m_period)); + save_item(NAME(m_count)); + save_item(NAME(m_level)); + save_item(NAME(m_level_or)); + save_item(NAME(m_level_and)); + save_item(NAME(m_mame_volumes)); + + for (int i = 0; i < ARRAY_LENGTH(m_period); i++) + m_period[i] = (STEP * machine().sample_rate()) / 125000; + + for (int i = 0; i < ARRAY_LENGTH(m_count); i++) + m_count[i] = (STEP * machine().sample_rate()) / 125000; + + for (int i = 0; i < ARRAY_LENGTH(m_level); i++) + m_level[i] = 0; + + for (int i = 0; i < ARRAY_LENGTH(m_level_or); i++) + m_level_or[i] = 0; + + for (int i = 0; i < ARRAY_LENGTH(m_level_and); i++) + m_level_and[i] = 0; + + for (int i = 0; i < ARRAY_LENGTH(m_mame_volumes); i++) + m_mame_volumes[i] = 0; + + /* dave has 3 tone channels and 1 noise channel. + the volumes are mixed internally and output as left and right volume */ + + /* 3 tone channels + 1 noise channel */ + m_sound_stream_var = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dave_device::device_reset() +{ + m_write_irq(CLEAR_LINE); + + for (int i = 0; i < 4; i++) + m_segment[i] = 0; + + m_irq_status = 0; + m_irq_enable = 0; + + for (int i = 0; i < 32; i++) + m_regs[i] = 0; +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void dave_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_1HZ: + m_irq_status ^= IRQ_1HZ_DIVIDER; + + if (m_irq_status & IRQ_1HZ_DIVIDER) + m_irq_status |= IRQ_1HZ_LATCH; + break; + + case TIMER_50HZ: + m_irq_status ^= IRQ_50HZ_DIVIDER; + + if (m_irq_status & IRQ_50HZ_DIVIDER) + m_irq_status |= IRQ_50HZ_LATCH; + break; + } + + update_interrupt(); +} + + +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *dave_device::memory_space_config(address_spacenum spacenum) const +{ + switch (spacenum) + { + case AS_PROGRAM: return &m_program_space_config; + case AS_IO: return &m_io_space_config; + default: return NULL; + } +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void dave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *buffer1, *buffer2; + /* 0 = channel 0 left volume, 1 = channel 0 right volume, + 2 = channel 1 left volume, 3 = channel 1 right volume, + 4 = channel 2 left volume, 5 = channel 2 right volume + 6 = noise channel left volume, 7 = noise channel right volume */ + int output_volumes[8]; + int left_volume; + int right_volume; + + //logerror("sound update!\n"); + + buffer1 = outputs[0]; + buffer2 = outputs[1]; + + while (samples) + { + int vol[4]; + + /* vol[] keeps track of how long each square wave stays */ + /* in the 1 position during the sample period. */ + vol[0] = vol[1] = vol[2] = vol[3] = 0; + + for (int i = 0; i < 3; i++) + { + if ((m_regs[7] & (1 << i))==0) + { + if (m_level[i]) vol[i] += m_count[i]; + m_count[i] -= STEP; + /* Period[i] is the half period of the square wave. Here, in each */ + /* loop I add Period[i] twice, so that at the end of the loop the */ + /* square wave is in the same status (0 or 1) it was at the start. */ + /* vol[i] is also incremented by Period[i], since the wave has been 1 */ + /* exactly half of the time, regardless of the initial position. */ + /* If we exit the loop in the middle, Output[i] has to be inverted */ + /* and vol[i] incremented only if the exit status of the square */ + /* wave is 1. */ + while (m_count[i] <= 0) + { + m_count[i] += m_period[i]; + if (m_count[i] > 0) + { + m_level[i] ^= 0x0ffffffff; + if (m_level[i]) vol[i] += m_period[i]; + break; + } + m_count[i] += m_period[i]; + vol[i] += m_period[i]; + } + if (m_level[i]) + vol[i] -= m_count[i]; + } + } + + /* update volume outputs */ + + /* setup output volumes for each channel */ + /* channel 0 */ + output_volumes[0] = ((m_level[0] & m_level_and[0]) | m_level_or[0]) & m_mame_volumes[0]; + output_volumes[1] = ((m_level[0] & m_level_and[1]) | m_level_or[1]) & m_mame_volumes[4]; + /* channel 1 */ + output_volumes[2] = ((m_level[1] & m_level_and[2]) | m_level_or[2]) & m_mame_volumes[1]; + output_volumes[3] = ((m_level[1] & m_level_and[3]) | m_level_or[3]) & m_mame_volumes[5]; + /* channel 2 */ + output_volumes[4] = ((m_level[2] & m_level_and[4]) | m_level_or[4]) & m_mame_volumes[2]; + output_volumes[5] = ((m_level[2] & m_level_and[5]) | m_level_or[5]) & m_mame_volumes[6]; + /* channel 3 */ + output_volumes[6] = ((m_level[3] & m_level_and[6]) | m_level_or[6]) & m_mame_volumes[3]; + output_volumes[7] = ((m_level[3] & m_level_and[7]) | m_level_or[7]) & m_mame_volumes[7]; + + left_volume = (output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6])>>2; + right_volume = (output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7])>>2; + + *(buffer1++) = left_volume; + *(buffer2++) = right_volume; + + samples--; + } +} + + +//------------------------------------------------- +// int1_w - interrupt 1 write +//------------------------------------------------- + +WRITE_LINE_MEMBER( dave_device::int1_w ) +{ + if (!(m_irq_status & IRQ_INT1) && state) + m_irq_status |= IRQ_INT1_LATCH; + + if (state) + m_irq_status |= IRQ_INT1; + else + m_irq_status &= ~IRQ_INT1; + + update_interrupt(); +} + + +//------------------------------------------------- +// int2_w - interrupt 2 write +//------------------------------------------------- + +WRITE_LINE_MEMBER( dave_device::int2_w ) +{ + if (!(m_irq_status & IRQ_INT2) && state) + m_irq_status |= IRQ_INT2_LATCH; + + if (state) + m_irq_status |= IRQ_INT2; + else + m_irq_status &= ~IRQ_INT2; + + update_interrupt(); +} + + +//------------------------------------------------- +// program_r - program space read +//------------------------------------------------- + +READ8_MEMBER( dave_device::program_r ) +{ + UINT8 segment = m_segment[offset >> 14]; + offset = (segment << 14) | (offset & 0x3fff); + + return this->space(AS_PROGRAM).read_byte(offset); +} + + +//------------------------------------------------- +// program_w - program space write +//------------------------------------------------- + +WRITE8_MEMBER( dave_device::program_w ) +{ + UINT8 segment = m_segment[offset >> 14]; + offset = (segment << 14) | (offset & 0x3fff); + + this->space(AS_PROGRAM).write_byte(offset, data); +} + + +//------------------------------------------------- +// io_r - I/O space read +//------------------------------------------------- + +READ8_MEMBER( dave_device::io_r ) +{ + UINT8 data = 0; + + switch (offset & 0xff) + { + case 0xa0: + case 0xa1: + case 0xa2: + case 0xa3: + case 0xa4: + case 0xa5: + case 0xa6: + case 0xa7: + case 0xa8: + case 0xa9: + case 0xaa: + case 0xab: + case 0xac: + case 0xad: + case 0xae: + case 0xaf: + case 0xb8: + case 0xb9: + case 0xba: + case 0xbb: + case 0xbc: + case 0xbd: + case 0xbe: + case 0xbf: + data = 0xff; + break; + + case 0xb0: case 0xb1: case 0xb2: case 0xb3: + data = m_segment[offset & 0x03]; + break; + + case 0xb4: + data = m_irq_status; + break; + + default: + data = this->space(AS_IO).read_byte(offset); + } + + return data; +} + + +//------------------------------------------------- +// io_w - I/O space write +//------------------------------------------------- + +WRITE8_MEMBER( dave_device::io_w ) +{ + switch (offset & 0xff) + { + /* channel 0 down-counter */ + case 0xa0: + case 0xa1: + /* channel 1 down-counter */ + case 0xa2: + case 0xa3: + /* channel 2 down-counter */ + case 0xa4: + case 0xa5: + { + int count = 0; + int channel_index = (offset>>1)&3; + + /* Fout = 125,000 / (n+1) Hz */ + + /* sample rate/clock */ + + + /* get down-count */ + switch (offset & 0x01) + { + case 0: + { + count = (data & 0x0ff) | ((m_regs[(offset & 0x1f) + 1] & 0x0f)<<8); + } + break; + + case 1: + { + count = (m_regs[(offset & 0x1f) - 1] & 0x0ff) | ((data & 0x0f)<<8); + + } + break; + } + + count++; + + + m_period[channel_index] = ((STEP * machine().sample_rate())/125000) * count; + + m_regs[offset & 0x1f] = data; + } + break; + + /* channel 0 left volume */ + case 0xa8: + /* channel 1 left volume */ + case 0xa9: + /* channel 2 left volume */ + case 0xaa: + /* noise channel left volume */ + case 0xab: + /* channel 0 right volume */ + case 0xac: + /* channel 1 right volume */ + case 0xad: + /* channel 2 right volume */ + case 0xae: + /* noise channel right volume */ + case 0xaf: + { + /* update mame version of volume from data written */ + /* 0x03f->0x07e00. Max is 0x07fff */ + /* I believe the volume is linear - to be checked! */ + m_mame_volumes[(offset & 0x1f) - 8] = (data & 0x03f) << 9; + + m_regs[offset & 0x1f] = data; + } + break; + + case 0xa6: + break; + + case 0xa7: + { + /* force => the value of this register is forced regardless of the wave + state, + remove => this value is force to zero so that it has no influence over + the final volume calculation, regardless of wave state + use => the volume value is dependant on the wave state and is included + in the final volume calculation */ + + //logerror("selectable int "); + switch ((data>>5) & 0x03) + { + case 0: + { + //logerror("1kHz\n"); + m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000)); + } + break; + + case 1: + { + //logerror("50Hz\n"); + m_timer_50hz->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); + } + break; + + case 2: + { + //logerror("tone channel 0\n"); + } + break; + + case 3: + { + //logerror("tone channel 1\n"); + } + break; + } + + + + /* turn L.H audio output into D/A, outputting value in R8 */ + if (data & (1<<3)) + { + /* force r8 value */ + m_level_or[0] = 0x0ffff; + m_level_and[0] = 0x00; + + /* remove r9 value */ + m_level_or[2] = 0x000; + m_level_and[2] = 0x00; + + /* remove r10 value */ + m_level_or[4] = 0x000; + m_level_and[4] = 0x00; + + /* remove r11 value */ + m_level_or[6] = 0x000; + m_level_and[6] = 0x00; + } + else + { + /* use r8 value */ + m_level_or[0] = 0x000; + m_level_and[0] = 0xffff; + + /* use r9 value */ + m_level_or[2] = 0x000; + m_level_and[2] = 0xffff; + + /* use r10 value */ + m_level_or[4] = 0x000; + m_level_and[4] = 0xffff; + + /* use r11 value */ + m_level_or[6] = 0x000; + m_level_and[6] = 0xffff; + } + + /* turn L.H audio output into D/A, outputting value in R12 */ + if (data & (1<<4)) + { + /* force r12 value */ + m_level_or[1] = 0x0ffff; + m_level_and[1] = 0x00; + + /* remove r13 value */ + m_level_or[3] = 0x000; + m_level_and[3] = 0x00; + + /* remove r14 value */ + m_level_or[5] = 0x000; + m_level_and[5] = 0x00; + + /* remove r15 value */ + m_level_or[7] = 0x000; + m_level_and[7] = 0x00; + } + else + { + /* use r12 value */ + m_level_or[1] = 0x000; + m_level_and[1] = 0xffff; + + /* use r13 value */ + m_level_or[3] = 0x000; + m_level_and[3] = 0xffff; + + /* use r14 value */ + m_level_or[5] = 0x000; + m_level_and[5] = 0xffff; + + /* use r15 value */ + m_level_or[7] = 0x000; + m_level_and[7] = 0xffff; + } + + m_regs[offset & 0x1f] = data; + } + break; + + case 0xb0: case 0xb1: case 0xb2: case 0xb3: + m_segment[offset & 0x03] = data; + + m_regs[offset & 0x1f] = data; + break; + + case 0xb4: + m_irq_enable = data; + m_irq_status &= ~(m_irq_enable & IRQ_LATCH); + update_interrupt(); + + m_regs[offset & 0x1f] = data; + break; + + case 0xbf: + m_regs[offset & 0x1f] = data; + break; + + default: + this->space(AS_IO).write_byte(offset, data); + } +} + + +//------------------------------------------------- +// update_interrupt - +//------------------------------------------------- + +void dave_device::update_interrupt() +{ + int state = ((m_irq_status & (m_irq_enable << 1)) & IRQ_LATCH) ? ASSERT_LINE : CLEAR_LINE; + + m_write_irq(state); +} diff --git a/src/mame/audio/dave.h b/src/mame/audio/dave.h new file mode 100644 index 00000000000..9bab709bd62 --- /dev/null +++ b/src/mame/audio/dave.h @@ -0,0 +1,156 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Intelligent Designs DAVE emulation + +**********************************************************************/ + +#pragma once + +#ifndef __DAVE__ +#define __DAVE__ + +#include "emu.h" + + + +///************************************************************************* +// MACROS / CONSTANTS +///************************************************************************* + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_DAVE_ADD(_tag, _clock, _program_map, _io_map) \ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") \ + MCFG_SOUND_ADD(_tag, DAVE, _clock) \ + MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) \ + MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) \ + MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _program_map) \ + MCFG_DEVICE_ADDRESS_MAP(AS_IO, _io_map) + + +#define MCFG_DAVE_IRQ_CALLBACK(_write) \ + devcb = &dave_device::set_irq_wr_callback(*device, DEVCB_##_write); + +#define MCFG_DAVE_LH_CALLBACK(_write) \ + devcb = &dave_device::set_lh_wr_callback(*device, DEVCB_##_write); + +#define MCFG_DAVE_RH_CALLBACK(_write) \ + devcb = &dave_device::set_rh_wr_callback(*device, DEVCB_##_write); + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> dave_device + +class dave_device : public device_t, + public device_memory_interface, + public device_sound_interface +{ +public: + dave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_irq.set_callback(object); } + template static devcb_base &set_lh_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_lh.set_callback(object); } + template static devcb_base &set_rh_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_rh.set_callback(object); } + + virtual DECLARE_ADDRESS_MAP(z80_program_map, 8); + virtual DECLARE_ADDRESS_MAP(z80_io_map, 8); + + DECLARE_WRITE_LINE_MEMBER( int1_w ); + DECLARE_WRITE_LINE_MEMBER( int2_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + + DECLARE_READ8_MEMBER( program_r ); + DECLARE_WRITE8_MEMBER( program_w ); + + DECLARE_READ8_MEMBER( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + +private: + enum + { + TIMER_1HZ, + TIMER_50HZ + }; + + enum + { + IRQ_50HZ_DIVIDER = 0x01, + IRQ_50HZ_LATCH = 0x02, + IRQ_1HZ_DIVIDER = 0x04, + IRQ_1HZ_LATCH = 0x08, + IRQ_INT1 = 0x10, + IRQ_INT1_LATCH = 0x20, + IRQ_INT2 = 0x40, + IRQ_INT2_LATCH = 0x80, + IRQ_LATCH = IRQ_INT2_LATCH | IRQ_INT1_LATCH | IRQ_1HZ_LATCH | IRQ_50HZ_LATCH + }; + + void update_interrupt(); + + const address_space_config m_program_space_config; + const address_space_config m_io_space_config; + + devcb_write_line m_write_irq; + devcb_write8 m_write_lh; + devcb_write8 m_write_rh; + + UINT8 m_segment[4]; + + UINT8 m_irq_status; + UINT8 m_irq_enable; + + emu_timer *m_timer_1hz; + emu_timer *m_timer_50hz; + + /* SOUND SYNTHESIS */ + UINT8 m_regs[32]; + int m_period[4]; + int m_count[4]; + int m_level[4]; + + /* these are used to force channels on/off */ + /* if one of the or values is 0x0ff, this means + the volume will be forced on,else it is dependant on + the state of the wave */ + int m_level_or[8]; + /* if one of the values is 0x00, this means the + volume is forced off, else it is dependant on the wave */ + int m_level_and[8]; + + /* these are the current channel volumes in MAME form */ + int m_mame_volumes[8]; + + /* update step */ + //int m_update_step; + + sound_stream *m_sound_stream_var; +}; + + +// device type definition +extern const device_type DAVE; + + + +#endif diff --git a/src/mame/audio/gamate.c b/src/mame/audio/gamate.c new file mode 100644 index 00000000000..19555dd7c44 --- /dev/null +++ b/src/mame/audio/gamate.c @@ -0,0 +1,253 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/*************************************************************************** + gamate sound hardware + + PeT mess@utanet.at 2015 +***************************************************************************/ + +#include "emu.h" +#include "includes/gamate.h" +#include "ui/ui.h" + + +enum { ClockDelay=32 }; + +// device type definition +const device_type GAMATE_SND = &device_creator; + +const int gamate_sound_device::DAConverter[]={ 0, 3, 7, 13, 23, 41, 75, 137, 249, 453, 825, 1499, 2726, 4956, 9011, 16383 }; // (*.55) on the real below index 8 bareless measureable +const UINT8 Mask[]={ 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0x1f, 0x3f, 0x1f, 0x1f, 0x1f, 0xff, 0xff, 0xf }; +const int EnvelopeVolumes[]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// gamate_sound_device - constructor +//------------------------------------------------- + +gamate_sound_device::gamate_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GAMATE_SND, "Gamate Audio Custom", tag, owner, clock, "gamate_sound", __FILE__) + , device_sound_interface(mconfig, *this) + , m_mixer_channel(NULL) + {} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gamate_sound_device::device_start() +{ + // bind callbacks +// m_irq_cb.bind_relative_to(*owner()); + + memset(m_channels, 0, sizeof(m_channels)); + memset(reg, 0, sizeof(reg)); + + m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void gamate_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *left=outputs[0], *right=outputs[1]; + int i, j; + Tone *channel; + + for (i = 0; i < samples; i++, left++, right++) + { + noise.pos += noise.step; + while (noise.pos >= 1.0) + { + // guess (white noise register taken from supervision) + noise.level = noise.state & 0x40 ? 1 : 0; + bool b1 = (noise.state & 0x40) != 0, b2 = (noise.state & 0x20) != 0; + noise.state=(noise.state<<1)+(b1!=b2?1:0); + noise.pos -= 1; + } + + envelope.pos += envelope.step; + while (envelope.pos >= 1.0) { + envelope.pos -= 1; + envelope.index++; + switch (envelope.control) + { + case 0: case 1: case 2: case 3: + case 4: case 5: case 6: case 7: + case 8: case 9: case 0xb: + case 0xd: case 0xf: + if (envelope.index>=ARRAY_LENGTH(EnvelopeVolumes)/2) + { + envelope.index=0; + envelope.first=false; + } + break; + default: + if (envelope.index>=ARRAY_LENGTH(EnvelopeVolumes)) + { + envelope.index=0; + envelope.first=false; + } + break; + } + } + + *left = 0; + *right = 0; + for (channel=m_channels, j=0; jsize != 0) + { + channel->level= channel->pos <= channel->size / 2; + bool l= channel->full_cycle? true: channel->level; + if (!channel->tone) + l= l && noise.level; + int volume=0; + if (l) + { + if (channel->envelope_on) + { + switch (envelope.control) + { + case 0: case 1: case 2: case 3: + case 0x9: // one time falling, low + if (envelope.first && channel->level) + volume=0xf-EnvelopeVolumes[envelope.index]; + break; + case 4: case 5: case 6: case 7: + case 0xf: // one time rising, low + if (envelope.first && channel->level) + volume=EnvelopeVolumes[envelope.index]; + break; + case 8: // falling + if (channel->level) + volume=0xf-EnvelopeVolumes[envelope.index]; + break; + case 0xa: // rising, falling + if (channel->level) + volume=0xf-EnvelopeVolumes[envelope.index]; // cube up + break; + case 0xb: // one time falling, high + if (channel->level) + volume=envelope.first ? 0xf-EnvelopeVolumes[envelope.index] : 0xf; + break; + case 0xc: // rising, low + if (channel->level) + volume=envelope.indexlevel) + volume=envelope.first ? EnvelopeVolumes[envelope.index] : 0xf; + break; + case 0xe: // falling, rising + if (channel->level) + volume=0xf-EnvelopeVolumes[envelope.index]; + break; + } + } + else + { + volume=channel->volume; + } + } + if (j == Right) + *right += Value2Volume(volume); + else + if (j==Left) + *left += Value2Volume(volume); + else + { + *right += Value2Volume(volume); + *left += Value2Volume(volume); + } + channel->pos++; + if (channel->pos >= channel->size) + channel->pos = 0; + } + } + } +} + +WRITE8_MEMBER( gamate_sound_device::device_w ) +{ + UINT16 size; + + m_mixer_channel->update(); + reg[offset] = data; + int chan=-1; + + switch (offset&0xf) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + chan=offset/2; + size = reg[chan*2] | ((reg[chan*2+1] & 0xf) << 8); + if (size) + { + m_channels[chan].size= (int) (machine().sample_rate() * size*ClockDelay / m_clock); + } + else + { + m_channels[chan].size = 0; + } + m_channels[chan].pos = 0; + break; + case 6: + size=data&0x1f; + if (size==0) + size=1; + noise.step= m_clock / (1.0*ClockDelay*machine().sample_rate()*size); + break; + case 7: + m_channels[Right].full_cycle=data&1; + m_channels[Right].tone=data&8; + m_channels[Left].full_cycle=data&2; + m_channels[Left].tone=data&0x10; + m_channels[Both].full_cycle=data&4; + m_channels[Both].tone=data&0x20; + noise.state=1; + noise.pos=0.0; + noise.level=false; + break; + case 8: + case 9: + case 0xa: + chan=offset-8; + m_channels[chan].envelope_on = data & 0x10; // buggy aussetzer cube up + m_channels[chan].volume = data & 0xf; + break; + case 0xb: case 0xc: + size = reg[0xb] | ((reg[0xc]) << 8); + if (size==0) + size=1; + envelope.step= m_clock / (1.0*ClockDelay*machine().sample_rate()*size); + break; + case 0xd: + envelope.control=data&0xf; + envelope.pos=0; + envelope.index=0; + envelope.first=true; + break; + + } + envelope.pos=0; // guess + envelope.index=0; + envelope.first=true; +} + +READ8_MEMBER( gamate_sound_device::device_r ) +{ + UINT8 data=0; + if ((offset&0xf); + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// gameboy_sound_device - constructor +//------------------------------------------------- + +gameboy_sound_device::gameboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GAMEBOY, "LR35902 Sound", tag, owner, clock, "gameboy_sound", __FILE__), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void gameboy_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gameboy_sound_device::device_start() +{ + m_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); + m_rate = machine().sample_rate(); + + save_item(NAME(m_snd_regs)); + // sound control + save_item(NAME(m_snd_control.on)); + save_item(NAME(m_snd_control.vol_left)); + save_item(NAME(m_snd_control.vol_right)); + save_item(NAME(m_snd_control.mode1_left)); + save_item(NAME(m_snd_control.mode1_right)); + save_item(NAME(m_snd_control.mode2_left)); + save_item(NAME(m_snd_control.mode2_right)); + save_item(NAME(m_snd_control.mode3_left)); + save_item(NAME(m_snd_control.mode3_right)); + save_item(NAME(m_snd_control.mode4_left)); + save_item(NAME(m_snd_control.mode4_right)); + // sound 1 + save_item(NAME(m_snd_1.on)); + save_item(NAME(m_snd_1.channel)); + save_item(NAME(m_snd_1.length)); + save_item(NAME(m_snd_1.pos)); + save_item(NAME(m_snd_1.period)); + save_item(NAME(m_snd_1.count)); + save_item(NAME(m_snd_1.mode)); + save_item(NAME(m_snd_1.duty)); + save_item(NAME(m_snd_1.env_value)); + save_item(NAME(m_snd_1.env_direction)); + save_item(NAME(m_snd_1.env_length)); + save_item(NAME(m_snd_1.env_count)); + save_item(NAME(m_snd_1.signal)); + save_item(NAME(m_snd_1.frequency)); + save_item(NAME(m_snd_1.swp_shift)); + save_item(NAME(m_snd_1.swp_direction)); + save_item(NAME(m_snd_1.swp_time)); + save_item(NAME(m_snd_1.swp_count)); + save_item(NAME(m_snd_1.level)); + save_item(NAME(m_snd_1.offset)); + save_item(NAME(m_snd_1.dutycount)); + save_item(NAME(m_snd_1.ply_step)); + save_item(NAME(m_snd_1.ply_value)); + // sound 2 + save_item(NAME(m_snd_2.on)); + save_item(NAME(m_snd_2.channel)); + save_item(NAME(m_snd_2.length)); + save_item(NAME(m_snd_2.pos)); + save_item(NAME(m_snd_2.period)); + save_item(NAME(m_snd_2.count)); + save_item(NAME(m_snd_2.mode)); + save_item(NAME(m_snd_2.duty)); + save_item(NAME(m_snd_2.env_value)); + save_item(NAME(m_snd_2.env_direction)); + save_item(NAME(m_snd_2.env_length)); + save_item(NAME(m_snd_2.env_count)); + save_item(NAME(m_snd_2.signal)); + save_item(NAME(m_snd_2.frequency)); + save_item(NAME(m_snd_2.swp_shift)); + save_item(NAME(m_snd_2.swp_direction)); + save_item(NAME(m_snd_2.swp_time)); + save_item(NAME(m_snd_2.swp_count)); + save_item(NAME(m_snd_2.level)); + save_item(NAME(m_snd_2.offset)); + save_item(NAME(m_snd_2.dutycount)); + save_item(NAME(m_snd_2.ply_step)); + save_item(NAME(m_snd_2.ply_value)); + // sound 3 + save_item(NAME(m_snd_3.on)); + save_item(NAME(m_snd_3.channel)); + save_item(NAME(m_snd_3.length)); + save_item(NAME(m_snd_3.pos)); + save_item(NAME(m_snd_3.period)); + save_item(NAME(m_snd_3.count)); + save_item(NAME(m_snd_3.mode)); + save_item(NAME(m_snd_3.duty)); + save_item(NAME(m_snd_3.env_value)); + save_item(NAME(m_snd_3.env_direction)); + save_item(NAME(m_snd_3.env_length)); + save_item(NAME(m_snd_3.env_count)); + save_item(NAME(m_snd_3.signal)); + save_item(NAME(m_snd_3.frequency)); + save_item(NAME(m_snd_3.swp_shift)); + save_item(NAME(m_snd_3.swp_direction)); + save_item(NAME(m_snd_3.swp_time)); + save_item(NAME(m_snd_3.swp_count)); + save_item(NAME(m_snd_3.level)); + save_item(NAME(m_snd_3.offset)); + save_item(NAME(m_snd_3.dutycount)); + save_item(NAME(m_snd_3.ply_step)); + save_item(NAME(m_snd_3.ply_value)); + // sound 4 + save_item(NAME(m_snd_4.on)); + save_item(NAME(m_snd_4.channel)); + save_item(NAME(m_snd_4.length)); + save_item(NAME(m_snd_4.pos)); + save_item(NAME(m_snd_4.period)); + save_item(NAME(m_snd_4.count)); + save_item(NAME(m_snd_4.mode)); + save_item(NAME(m_snd_4.duty)); + save_item(NAME(m_snd_4.env_value)); + save_item(NAME(m_snd_4.env_direction)); + save_item(NAME(m_snd_4.env_length)); + save_item(NAME(m_snd_4.env_count)); + save_item(NAME(m_snd_4.signal)); + save_item(NAME(m_snd_4.frequency)); + save_item(NAME(m_snd_4.swp_shift)); + save_item(NAME(m_snd_4.swp_direction)); + save_item(NAME(m_snd_4.swp_time)); + save_item(NAME(m_snd_4.swp_count)); + save_item(NAME(m_snd_4.level)); + save_item(NAME(m_snd_4.offset)); + save_item(NAME(m_snd_4.dutycount)); + save_item(NAME(m_snd_4.ply_step)); + save_item(NAME(m_snd_4.ply_value)); +} + +//------------------------------------------------- +// device_reset +//------------------------------------------------- + +void gameboy_sound_device::device_reset() +{ + memset(&m_snd_1, 0, sizeof(m_snd_1)); + memset(&m_snd_2, 0, sizeof(m_snd_2)); + memset(&m_snd_3, 0, sizeof(m_snd_3)); + memset(&m_snd_4, 0, sizeof(m_snd_4)); + + /* Calculate the envelope and sweep tables */ + for (int i = 0; i < 8; i++) + { + m_env_length_table[i] = (i * ((1 << FIXED_POINT) / 64) * m_rate) >> FIXED_POINT; + m_swp_time_table[i] = (((i << FIXED_POINT) / 128) * m_rate) >> (FIXED_POINT - 1); + } + + /* Calculate the period tables */ + for (int i = 0; i < MAX_FREQUENCIES; i++) + { + m_period_table[i] = ((1 << FIXED_POINT) / (131072 / (2048 - i))) * m_rate; + m_period_mode3_table[i] = ((1 << FIXED_POINT) / (65536 / (2048 - i))) * m_rate; + } + /* Calculate the period table for mode 4 */ + for (int i = 0; i < 8; i++) + { + for (int j = 0; j < 16; j++) + { + // i is the dividing ratio of frequencies + // j is the shift clock frequency + m_period_mode4_table[i][j] = ((1 << FIXED_POINT) / (524288 / ((i == 0) ? 0.5 : i) / (1 << (j + 1)))) * m_rate; + } + } + + /* Calculate the length table */ + for (int i = 0; i < 64; i++) + m_length_table[i] = ((64 - i) * ((1 << FIXED_POINT)/256) * m_rate) >> FIXED_POINT; + + /* Calculate the length table for mode 3 */ + for (int i = 0; i < 256; i++) + m_length_mode3_table[i] = ((256 - i) * ((1 << FIXED_POINT)/256) * m_rate) >> FIXED_POINT; + + sound_w_internal(NR52, 0x00); + m_snd_regs[AUD3W0] = 0xac; + m_snd_regs[AUD3W1] = 0xdd; + m_snd_regs[AUD3W2] = 0xda; + m_snd_regs[AUD3W3] = 0x48; + m_snd_regs[AUD3W4] = 0x36; + m_snd_regs[AUD3W5] = 0x02; + m_snd_regs[AUD3W6] = 0xcf; + m_snd_regs[AUD3W7] = 0x16; + m_snd_regs[AUD3W8] = 0x2c; + m_snd_regs[AUD3W9] = 0x04; + m_snd_regs[AUD3WA] = 0xe5; + m_snd_regs[AUD3WB] = 0x2c; + m_snd_regs[AUD3WC] = 0xac; + m_snd_regs[AUD3WD] = 0xdd; + m_snd_regs[AUD3WE] = 0xda; + m_snd_regs[AUD3WF] = 0x48; +} + + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +READ8_MEMBER( gameboy_sound_device::wave_r ) +{ + /* TODO: properly emulate scrambling of wave ram area when playback is active */ + return m_snd_regs[AUD3W0 + offset] | m_snd_3.on; +} + +READ8_MEMBER( gameboy_sound_device::sound_r ) +{ + switch (offset) + { + case 0x05: + case 0x0f: + return 0xff; + case NR52: + return 0x70 | m_snd_regs[offset]; + default: + return m_snd_regs[offset]; + } +} + +WRITE8_MEMBER( gameboy_sound_device::wave_w ) +{ + m_snd_regs[AUD3W0 + offset] = data; +} + +WRITE8_MEMBER( gameboy_sound_device::sound_w ) +{ + /* change in registers so update first */ + m_channel->update(); + + /* Only register NR52 is accessible if the sound controller is disabled */ + if (!m_snd_control.on && offset != NR52) + return; + + sound_w_internal(offset, data); +} + + +void gameboy_sound_device::sound_w_internal( int offset, UINT8 data ) +{ + /* Store the value */ + m_snd_regs[offset] = data; + + switch (offset) + { + /*MODE 1 */ + case NR10: /* Sweep (R/W) */ + m_snd_1.swp_shift = data & 0x7; + m_snd_1.swp_direction = (data & 0x8) >> 3; + m_snd_1.swp_direction |= m_snd_1.swp_direction - 1; + m_snd_1.swp_time = m_swp_time_table[ (data & 0x70) >> 4 ]; + break; + case NR11: /* Sound length/Wave pattern duty (R/W) */ + m_snd_1.duty = (data & 0xc0) >> 6; + m_snd_1.length = m_length_table[data & 0x3f]; + break; + case NR12: /* Envelope (R/W) */ + m_snd_1.env_value = data >> 4; + m_snd_1.env_direction = (data & 0x8) >> 3; + m_snd_1.env_direction |= m_snd_1.env_direction - 1; + m_snd_1.env_length = m_env_length_table[data & 0x7]; + break; + case NR13: /* Frequency lo (R/W) */ + m_snd_1.frequency = ((m_snd_regs[NR14] & 0x7) << 8) | m_snd_regs[NR13]; + m_snd_1.period = m_period_table[m_snd_1.frequency]; + break; + case NR14: /* Frequency hi / Initialize (R/W) */ + m_snd_1.mode = (data & 0x40) >> 6; + m_snd_1.frequency = ((m_snd_regs[NR14] & 0x7) << 8) | m_snd_regs[NR13]; + m_snd_1.period = m_period_table[m_snd_1.frequency]; + if (data & 0x80) + { + if (!m_snd_1.on) + m_snd_1.pos = 0; + m_snd_1.on = 1; + m_snd_1.count = 0; + m_snd_1.env_value = m_snd_regs[NR12] >> 4; + m_snd_1.env_count = 0; + m_snd_1.swp_count = 0; + m_snd_1.signal = 0x1; + m_snd_regs[NR52] |= 0x1; + } + break; + + /*MODE 2 */ + case NR21: /* Sound length/Wave pattern duty (R/W) */ + m_snd_2.duty = (data & 0xc0) >> 6; + m_snd_2.length = m_length_table[data & 0x3f]; + break; + case NR22: /* Envelope (R/W) */ + m_snd_2.env_value = data >> 4; + m_snd_2.env_direction = (data & 0x8) >> 3; + m_snd_2.env_direction |= m_snd_2.env_direction - 1; + m_snd_2.env_length = m_env_length_table[data & 0x7]; + break; + case NR23: /* Frequency lo (R/W) */ + m_snd_2.period = m_period_table[((m_snd_regs[NR24] & 0x7) << 8) | m_snd_regs[NR23]]; + break; + case NR24: /* Frequency hi / Initialize (R/W) */ + m_snd_2.mode = (data & 0x40) >> 6; + m_snd_2.period = m_period_table[((m_snd_regs[NR24] & 0x7) << 8) | m_snd_regs[NR23]]; + if (data & 0x80) + { + if (!m_snd_2.on) + m_snd_2.pos = 0; + m_snd_2.on = 1; + m_snd_2.count = 0; + m_snd_2.env_value = m_snd_regs[NR22] >> 4; + m_snd_2.env_count = 0; + m_snd_2.signal = 0x1; + m_snd_regs[NR52] |= 0x2; + } + break; + + /*MODE 3 */ + case NR30: /* Sound On/Off (R/W) */ + m_snd_3.on = (data & 0x80) >> 7; + break; + case NR31: /* Sound Length (R/W) */ + m_snd_3.length = m_length_mode3_table[data]; + break; + case NR32: /* Select Output Level */ + m_snd_3.level = (data & 0x60) >> 5; + break; + case NR33: /* Frequency lo (W) */ + m_snd_3.period = m_period_mode3_table[((m_snd_regs[NR34] & 0x7) << 8) + m_snd_regs[NR33]]; + break; + case NR34: /* Frequency hi / Initialize (W) */ + m_snd_3.mode = (data & 0x40) >> 6; + m_snd_3.period = m_period_mode3_table[((m_snd_regs[NR34] & 0x7) << 8) + m_snd_regs[NR33]]; + if (data & 0x80) + { + if (!m_snd_3.on) + { + m_snd_3.pos = 0; + m_snd_3.offset = 0; + m_snd_3.duty = 0; + } + m_snd_3.on = 1; + m_snd_3.count = 0; + m_snd_3.duty = 1; + m_snd_3.dutycount = 0; + m_snd_regs[NR52] |= 0x4; + } + break; + + /*MODE 4 */ + case NR41: /* Sound Length (R/W) */ + m_snd_4.length = m_length_table[data & 0x3f]; + break; + case NR42: /* Envelope (R/W) */ + m_snd_4.env_value = data >> 4; + m_snd_4.env_direction = (data & 0x8) >> 3; + m_snd_4.env_direction |= m_snd_4.env_direction - 1; + m_snd_4.env_length = m_env_length_table[data & 0x7]; + break; + case NR43: /* Polynomial Counter/Frequency */ + m_snd_4.period = m_period_mode4_table[data & 0x7][(data & 0xF0) >> 4]; + m_snd_4.ply_step = (data & 0x8) >> 3; + break; + case NR44: /* Counter/Consecutive / Initialize (R/W) */ + m_snd_4.mode = (data & 0x40) >> 6; + if (data & 0x80) + { + if (!m_snd_4.on) + m_snd_4.pos = 0; + m_snd_4.on = 1; + m_snd_4.count = 0; + m_snd_4.env_value = m_snd_regs[NR42] >> 4; + m_snd_4.env_count = 0; + m_snd_4.signal = machine().rand(); + m_snd_4.ply_value = 0x7fff; + m_snd_regs[NR52] |= 0x8; + } + break; + + /* CONTROL */ + case NR50: /* Channel Control / On/Off / Volume (R/W) */ + m_snd_control.vol_left = data & 0x7; + m_snd_control.vol_right = (data & 0x70) >> 4; + break; + case NR51: /* Selection of Sound Output Terminal */ + m_snd_control.mode1_right = data & 0x1; + m_snd_control.mode1_left = (data & 0x10) >> 4; + m_snd_control.mode2_right = (data & 0x2) >> 1; + m_snd_control.mode2_left = (data & 0x20) >> 5; + m_snd_control.mode3_right = (data & 0x4) >> 2; + m_snd_control.mode3_left = (data & 0x40) >> 6; + m_snd_control.mode4_right = (data & 0x8) >> 3; + m_snd_control.mode4_left = (data & 0x80) >> 7; + break; + case NR52: /* Sound On/Off (R/W) */ + /* Only bit 7 is writable, writing to bits 0-3 does NOT enable or + disable sound. They are read-only */ + m_snd_control.on = (data & 0x80) >> 7; + if (!m_snd_control.on) + { + sound_w_internal(NR10, 0x80); + sound_w_internal(NR11, 0xBF); + sound_w_internal(NR12, 0xF3); + sound_w_internal(NR13, 0xFF); + sound_w_internal(NR14, 0xBF); + //sound_w_internal(NR20, 0xFF); + sound_w_internal(NR21, 0x3F); + sound_w_internal(NR22, 0x00); + sound_w_internal(NR23, 0xFF); + sound_w_internal(NR24, 0xBF); + sound_w_internal(NR30, 0x7F); + sound_w_internal(NR31, 0xFF); + sound_w_internal(NR32, 0x9F); + sound_w_internal(NR33, 0xFF); + sound_w_internal(NR34, 0xBF); + //sound_w_internal(NR40, 0xFF); + sound_w_internal(NR41, 0xFF); + sound_w_internal(NR42, 0x00); + sound_w_internal(NR43, 0x00); + sound_w_internal(NR44, 0xBF); + sound_w_internal(NR50, 0x77); + sound_w_internal(NR51, 0xF3); + m_snd_1.on = 0; + m_snd_2.on = 0; + m_snd_3.on = 0; + m_snd_4.on = 0; + m_snd_regs[offset] = 0; + } + break; + } +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void gameboy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t sample, left, right, mode4_mask; + + while (samples-- > 0) + { + left = right = 0; + + /* Mode 1 - Wave with Envelope and Sweep */ + if (m_snd_1.on) + { + sample = m_snd_1.signal * m_snd_1.env_value; + m_snd_1.pos++; + if (m_snd_1.pos == (UINT32)(m_snd_1.period / wave_duty_table[m_snd_1.duty]) >> FIXED_POINT) + { + m_snd_1.signal = -m_snd_1.signal; + } + else if (m_snd_1.pos > (m_snd_1.period >> FIXED_POINT)) + { + m_snd_1.pos = 0; + m_snd_1.signal = -m_snd_1.signal; + } + + if (m_snd_1.length && m_snd_1.mode) + { + m_snd_1.count++; + if (m_snd_1.count >= m_snd_1.length) + { + m_snd_1.on = 0; + m_snd_regs[NR52] &= 0xFE; + } + } + + if (m_snd_1.env_length) + { + m_snd_1.env_count++; + if (m_snd_1.env_count >= m_snd_1.env_length) + { + m_snd_1.env_count = 0; + m_snd_1.env_value += m_snd_1.env_direction; + if (m_snd_1.env_value < 0) + m_snd_1.env_value = 0; + if (m_snd_1.env_value > 15) + m_snd_1.env_value = 15; + } + } + + if (m_snd_1.swp_time) + { + m_snd_1.swp_count++; + if (m_snd_1.swp_count >= m_snd_1.swp_time) + { + m_snd_1.swp_count = 0; + if (m_snd_1.swp_direction > 0) + { + m_snd_1.frequency -= m_snd_1.frequency / (1 << m_snd_1.swp_shift); + if (m_snd_1.frequency <= 0) + { + m_snd_1.on = 0; + m_snd_regs[NR52] &= 0xFE; + } + } + else + { + m_snd_1.frequency += m_snd_1.frequency / (1 << m_snd_1.swp_shift); + if (m_snd_1.frequency >= MAX_FREQUENCIES) + { + m_snd_1.frequency = MAX_FREQUENCIES - 1; + } + } + + m_snd_1.period = m_period_table[m_snd_1.frequency]; + } + } + + if (m_snd_control.mode1_left) + left += sample; + if (m_snd_control.mode1_right) + right += sample; + } + + /* Mode 2 - Wave with Envelope */ + if (m_snd_2.on) + { + sample = m_snd_2.signal * m_snd_2.env_value; + m_snd_2.pos++; + if( m_snd_2.pos == (UINT32)(m_snd_2.period / wave_duty_table[m_snd_2.duty]) >> FIXED_POINT) + { + m_snd_2.signal = -m_snd_2.signal; + } + else if (m_snd_2.pos > (m_snd_2.period >> FIXED_POINT)) + { + m_snd_2.pos = 0; + m_snd_2.signal = -m_snd_2.signal; + } + + if (m_snd_2.length && m_snd_2.mode) + { + m_snd_2.count++; + if (m_snd_2.count >= m_snd_2.length) + { + m_snd_2.on = 0; + m_snd_regs[NR52] &= 0xFD; + } + } + + if (m_snd_2.env_length) + { + m_snd_2.env_count++; + if (m_snd_2.env_count >= m_snd_2.env_length) + { + m_snd_2.env_count = 0; + m_snd_2.env_value += m_snd_2.env_direction; + if (m_snd_2.env_value < 0) + m_snd_2.env_value = 0; + if (m_snd_2.env_value > 15) + m_snd_2.env_value = 15; + } + } + + if (m_snd_control.mode2_left) + left += sample; + if (m_snd_control.mode2_right) + right += sample; + } + + /* Mode 3 - Wave patterns from WaveRAM */ + if (m_snd_3.on) + { + /* NOTE: This is extremely close, but not quite right. + The problem is for GB frequencies above 2000 the frequency gets + clipped. This is caused because m_snd_3.pos is never 0 at the test.*/ + sample = m_snd_regs[AUD3W0 + (m_snd_3.offset/2)]; + if (!(m_snd_3.offset % 2)) + { + sample >>= 4; + } + sample = (sample & 0xF) - 8; + + if (m_snd_3.level) + sample >>= (m_snd_3.level - 1); + else + sample = 0; + + m_snd_3.pos++; + if (m_snd_3.pos >= ((UINT32)(((m_snd_3.period) >> 21)) + m_snd_3.duty)) + { + m_snd_3.pos = 0; + if (m_snd_3.dutycount == ((UINT32)(((m_snd_3.period) >> FIXED_POINT)) % 32)) + { + m_snd_3.duty--; + } + m_snd_3.dutycount++; + m_snd_3.offset++; + if (m_snd_3.offset > 31) + { + m_snd_3.offset = 0; + m_snd_3.duty = 1; + m_snd_3.dutycount = 0; + } + } + + if (m_snd_3.length && m_snd_3.mode) + { + m_snd_3.count++; + if (m_snd_3.count >= m_snd_3.length) + { + m_snd_3.on = 0; + m_snd_regs[NR52] &= 0xFB; + } + } + + if (m_snd_control.mode3_left) + left += sample; + if (m_snd_control.mode3_right) + right += sample; + } + + /* Mode 4 - Noise with Envelope */ + if (m_snd_4.on) + { + /* Similar problem to Mode 3, we seem to miss some notes */ + sample = m_snd_4.signal & m_snd_4.env_value; + m_snd_4.pos++; + if (m_snd_4.pos == (m_snd_4.period >> (FIXED_POINT + 1))) + { + /* Using a Polynomial Counter (aka Linear Feedback Shift Register) + Mode 4 has a 7 bit and 15 bit counter so we need to shift the + bits around accordingly */ + mode4_mask = (((m_snd_4.ply_value & 0x2) >> 1) ^ (m_snd_4.ply_value & 0x1)) << (m_snd_4.ply_step ? 6 : 14); + m_snd_4.ply_value >>= 1; + m_snd_4.ply_value |= mode4_mask; + m_snd_4.ply_value &= (m_snd_4.ply_step ? 0x7f : 0x7fff); + m_snd_4.signal = (INT8)m_snd_4.ply_value; + } + else if (m_snd_4.pos > (m_snd_4.period >> FIXED_POINT)) + { + m_snd_4.pos = 0; + mode4_mask = (((m_snd_4.ply_value & 0x2) >> 1) ^ (m_snd_4.ply_value & 0x1)) << (m_snd_4.ply_step ? 6 : 14); + m_snd_4.ply_value >>= 1; + m_snd_4.ply_value |= mode4_mask; + m_snd_4.ply_value &= (m_snd_4.ply_step ? 0x7f : 0x7fff); + m_snd_4.signal = (INT8)m_snd_4.ply_value; + } + + if (m_snd_4.length && m_snd_4.mode) + { + m_snd_4.count++; + if (m_snd_4.count >= m_snd_4.length) + { + m_snd_4.on = 0; + m_snd_regs[NR52] &= 0xF7; + } + } + + if (m_snd_4.env_length) + { + m_snd_4.env_count++; + if (m_snd_4.env_count >= m_snd_4.env_length) + { + m_snd_4.env_count = 0; + m_snd_4.env_value += m_snd_4.env_direction; + if (m_snd_4.env_value < 0) + m_snd_4.env_value = 0; + if (m_snd_4.env_value > 15) + m_snd_4.env_value = 15; + } + } + + if (m_snd_control.mode4_left) + left += sample; + if (m_snd_control.mode4_right) + right += sample; + } + + /* Adjust for master volume */ + left *= m_snd_control.vol_left; + right *= m_snd_control.vol_right; + + /* pump up the volume */ + left <<= 6; + right <<= 6; + + /* Update the buffers */ + *(outputs[0]++) = left; + *(outputs[1]++) = right; + } + + m_snd_regs[NR52] = (m_snd_regs[NR52]&0xf0) | m_snd_1.on | (m_snd_2.on << 1) | (m_snd_3.on << 2) | (m_snd_4.on << 3); + +} diff --git a/src/mame/audio/gb.h b/src/mame/audio/gb.h new file mode 100644 index 00000000000..c86cad02b76 --- /dev/null +++ b/src/mame/audio/gb.h @@ -0,0 +1,105 @@ +// license:BSD-3-Clause +// copyright-holders:Anthony Kruize +#ifndef __GBSOUND_H__ +#define __GBSOUND_H__ + + +#define MAX_FREQUENCIES 2048 + + +struct SOUND +{ + /* Common */ + UINT8 on; + UINT8 channel; + INT32 length; + INT32 pos; + UINT32 period; + INT32 count; + INT8 mode; + /* Mode 1, 2, 3 */ + INT8 duty; + /* Mode 1, 2, 4 */ + INT32 env_value; + INT8 env_direction; + INT32 env_length; + INT32 env_count; + INT8 signal; + /* Mode 1 */ + UINT32 frequency; + INT32 swp_shift; + INT32 swp_direction; + INT32 swp_time; + INT32 swp_count; + /* Mode 3 */ + INT8 level; + UINT8 offset; + UINT32 dutycount; + /* Mode 4 */ + INT32 ply_step; + INT16 ply_value; +}; + +struct SOUNDC +{ + UINT8 on; + UINT8 vol_left; + UINT8 vol_right; + UINT8 mode1_left; + UINT8 mode1_right; + UINT8 mode2_left; + UINT8 mode2_right; + UINT8 mode3_left; + UINT8 mode3_right; + UINT8 mode4_left; + UINT8 mode4_right; +}; + + +class gameboy_sound_device : public device_t, + public device_sound_interface +{ +public: + gameboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER(sound_r); + DECLARE_READ8_MEMBER(wave_r); + DECLARE_WRITE8_MEMBER(sound_w); + DECLARE_WRITE8_MEMBER(wave_w); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + void sound_w_internal(int offset, UINT8 data); + + sound_stream *m_channel; + int m_rate; + + INT32 m_env_length_table[8]; + INT32 m_swp_time_table[8]; + UINT32 m_period_table[MAX_FREQUENCIES]; + UINT32 m_period_mode3_table[MAX_FREQUENCIES]; + UINT32 m_period_mode4_table[8][16]; + UINT32 m_length_table[64]; + UINT32 m_length_mode3_table[256]; + + struct SOUND m_snd_1; + struct SOUND m_snd_2; + struct SOUND m_snd_3; + struct SOUND m_snd_4; + struct SOUNDC m_snd_control; + + UINT8 m_snd_regs[0x30]; +}; + +extern const device_type GAMEBOY; + +#endif diff --git a/src/mame/audio/lynx.c b/src/mame/audio/lynx.c new file mode 100644 index 00000000000..2e17abde91f --- /dev/null +++ b/src/mame/audio/lynx.c @@ -0,0 +1,540 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + PeT mess@utanet.at 2000,2001 +******************************************************************************/ + +#include "emu.h" +#include "audio/lynx.h" + + +/* accordingly to atari's reference manual + there were no stereo lynx produced (the manual knows only production until mid 1991) + the howard/developement board might have stereo support + the revised lynx 2 hardware might have stereo support at least at the stereo jacks + + some games support stereo +*/ + + +/* +AUDIO_A EQU $FD20 +AUDIO_B EQU $FD28 +AUDIO_C EQU $FD30 +AUDIO_D EQU $FD38 + +VOLUME_CNTRL EQU 0 +FEEDBACK_ENABLE EQU 1 ; enables 11/10/5..0 +OUTPUT_VALUE EQU 2 +SHIFTER_L EQU 3 +AUD_BAKUP EQU 4 +AUD_CNTRL1 EQU 5 +AUD_COUNT EQU 6 +AUD_CNTRL2 EQU 7 + +; AUD_CNTRL1 +FEEDBACK_7 EQU %10000000 +AUD_RESETDONE EQU %01000000 +AUD_INTEGRATE EQU %00100000 +AUD_RELOAD EQU %00010000 +AUD_CNTEN EQU %00001000 +AUD_LINK EQU %00000111 +; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1 +AUD_64us EQU %00000110 +AUD_32us EQU %00000101 +AUD_16us EQU %00000100 +AUD_8us EQU %00000011 +AUD_4us EQU %00000010 +AUD_2us EQU %00000001 +AUD_1us EQU %00000000 + +; AUD_CNTRL2 (read only) +; B7..B4 ; shifter bits 11..8 +; B3 ; who knows +; B2 ; last clock state (0->1 causes count) +; B1 ; borrow in (1 causes count) +; B0 ; borrow out (count EQU 0 and borrow in) + +ATTEN_A EQU $FD40 +ATTEN_B EQU $FD41 +ATTEN_C EQU $FD42 +ATTEN_D EQU $FD43 +; B7..B4 attenuation left ear (0 silent ..15/16 volume) +; B3..B0 " right ear + +MPAN EQU $FD44 +; B7..B4 left ear +; B3..B0 right ear +; B7/B3 EQU Audio D +; a 1 enables attenuation for channel and side + + +MSTEREO EQU $FD50 ; a 1 disables audio connection +AUD_D_LEFT EQU %10000000 +AUD_C_LEFT EQU %01000000 +AUD_B_LEFT EQU %00100000 +AUD_A_LEFT EQU %00010000 +AUD_D_RIGHT EQU %00001000 +AUD_C_RIGHT EQU %00000100 +AUD_B_RIGHT EQU %00000010 +AUD_A_RIGHT EQU %00000001 + + */ + +#define LYNX_AUDIO_CHANNELS 4 + + +// device type definition +const device_type LYNX_SND = &device_creator; +const device_type LYNX2_SND = &device_creator; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// lynx_sound_device - constructor +//------------------------------------------------- + +lynx_sound_device::lynx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, LYNX_SND, "Mikey", tag, owner, clock, "lynx_sound", __FILE__), + device_sound_interface(mconfig, *this) +{ + m_timer_delegate = lynx_sound_timer_delegate(); +} + +lynx_sound_device::lynx_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_sound_interface(mconfig, *this) +{ +} + + +lynx2_sound_device::lynx2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : lynx_sound_device(mconfig, LYNX2_SND, "Mikey (Lynx II)", tag, owner, clock, "lynx2_sound", __FILE__) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void lynx_sound_device::set_timer_delegate(device_t &device, lynx_sound_timer_delegate cb) +{ + lynx_sound_device &dev = downcast(device); + dev.m_timer_delegate = cb; +} + +void lynx_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void lynx_sound_device::register_save() +{ + save_item(NAME(m_attenuation_enable)); + save_item(NAME(m_master_enable)); + for (int chan = 0; chan < LYNX_AUDIO_CHANNELS; chan++) + { + save_item(NAME(m_audio[chan].reg.volume), chan); + save_item(NAME(m_audio[chan].reg.feedback), chan); + save_item(NAME(m_audio[chan].reg.output), chan); + save_item(NAME(m_audio[chan].reg.shifter), chan); + save_item(NAME(m_audio[chan].reg.bakup), chan); + save_item(NAME(m_audio[chan].reg.control1), chan); + save_item(NAME(m_audio[chan].reg.counter), chan); + save_item(NAME(m_audio[chan].reg.control2), chan); + save_item(NAME(m_audio[chan].attenuation), chan); + save_item(NAME(m_audio[chan].mask), chan); + save_item(NAME(m_audio[chan].shifter), chan); + save_item(NAME(m_audio[chan].ticks), chan); + save_item(NAME(m_audio[chan].count), chan); + } +} + +void lynx_sound_device::init() +{ + m_shift_mask = auto_alloc_array_clear(machine(), int, 512); + m_shift_xor = auto_alloc_array_clear(machine(), int, 4096); + + for (int i = 0; i < 512; i++) + { + m_shift_mask[i] = 0; + if (i & 1) m_shift_mask[i] |= 1; + if (i & 2) m_shift_mask[i] |= 2; + if (i & 4) m_shift_mask[i] |= 4; + if (i & 8) m_shift_mask[i] |= 8; + if (i & 0x10) m_shift_mask[i] |= 0x10; + if (i & 0x20) m_shift_mask[i] |= 0x20; + if (i & 0x40) m_shift_mask[i] |= 0x400; + if (i & 0x80) m_shift_mask[i] |= 0x800; + if (i & 0x100) m_shift_mask[i] |= 0x80; + } + + for (int i = 0; i < 4096; i++) + { + m_shift_xor[i] = 1; + for (int j = 4096/2; j > 0; j >>= 1) + { + if (i & j) + m_shift_xor[i] ^= 1; + } + } +} + +void lynx_sound_device::device_start() +{ + m_mixer_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate()); + m_usec_per_sample = 1000000 / machine().sample_rate(); + m_timer_delegate.bind_relative_to(*owner()); + init(); + register_save(); +} + + +void lynx2_sound_device::device_start() +{ + m_mixer_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); + m_usec_per_sample = 1000000 / machine().sample_rate(); + m_timer_delegate.bind_relative_to(*owner()); + init(); + register_save(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void lynx_sound_device::device_reset() +{ + for (int i = 0; i < LYNX_AUDIO_CHANNELS; i++) + { + reset_channel(&m_audio[i]); + } +} + + +void lynx_sound_device::reset_channel(LYNX_AUDIO *channel) +{ + channel->reg.volume = 0; + channel->reg.feedback = 0; + channel->reg.output = 0; + channel->reg.shifter = 0; + channel->reg.bakup = 0; + channel->reg.control1 = 0; + channel->reg.counter = 0; + channel->reg.control2 = 0; + + channel->attenuation = 0; + channel->mask = 0; + channel->shifter = 0; + channel->ticks = 0; + channel->count = 0; +} + +void lynx_sound_device::count_down(int nr) +{ + LYNX_AUDIO *channel = &m_audio[nr]; + if (channel->reg.control1 & 8 && (channel->reg.control1 & 7) != 7) + return; + if (nr == 0) + m_mixer_channel->update(); + //if ((channel->reg.control1 & 0x0f) == 0x0f) //count down if linking enabled and count enabled + channel->count--; +} + +void lynx_sound_device::shift(int chan_nr) +{ + INT16 out_temp; + LYNX_AUDIO *channel; + + assert(chan_nr < 4); + + channel = &m_audio[chan_nr]; + //channel->shifter = ((channel->shifter<<1)&0xffe) | (m_shift_xor[ channel->shifter & channel->mask ]&1); + + // alternative method (functionally the same as above) + UINT8 xor_out = 0; + for (int bit = 0; bit < 12; bit++) + { + if ((channel->mask >> bit) & 1) + xor_out ^= (channel->shifter >> bit) & 1; + } + channel->shifter = ((channel->shifter << 1) & 0xffe) | (xor_out ^ 1); // output of xor is inverted + + + if (channel->reg.control1 & 0x20) // integrate mode enabled + { + if (channel->shifter & 1) + out_temp = channel->reg.output + channel->reg.volume; + else + out_temp = channel->reg.output - channel->reg.volume; + + // clipping + if (out_temp > 127) out_temp = 127; + if (out_temp < -128) out_temp = -128; + channel->reg.output = (INT16)out_temp; + } + + switch (chan_nr) + { + case 0: count_down(1); break; + case 1: count_down(2); break; + case 2: count_down(3); break; + case 3: + if (!m_timer_delegate.isnull()) + m_timer_delegate(); + break; + } +} + +void lynx_sound_device::execute(int chan_nr) +{ + LYNX_AUDIO *channel; + + assert(chan_nr < 4); + + channel = &m_audio[chan_nr]; + + if (channel->reg.control1 & 8) // count enable + { + channel->ticks += m_usec_per_sample; + if ((channel->reg.control1 & 7) == 7) // link + { + if (channel->count < 0) // counter finished + { + //channel->count+=channel->reg.counter; // reload (wrong?) + if (channel->reg.control1 & 0x10) + channel->count = channel->reg.bakup; + shift(chan_nr); + } + } + else + { + int t = 1 << (channel->reg.control1 & 7); // microseconds per count + for (;;) + { + for (; (channel->ticks >= t) && (channel->count >= 0); channel->ticks -= t) // at least one sampled worth of time left, timer not expired + channel->count--; + + if (channel->ticks < t) + break; + + if (channel->count < 0) + { + shift(chan_nr); + if (channel->reg.control1 & 0x10) + channel->count = channel->reg.bakup; + else + break; + } + } + } + + if (!(channel->reg.control1 & 0x20)) // normal mode + { + channel->reg.output = (channel->shifter & 1) ? channel->reg.volume : -channel->reg.volume; + } + } + else + { + channel->ticks = 0; + channel->count = 0; + } +} + +READ8_MEMBER(lynx_sound_device::read) +{ + UINT8 value = 0; + LYNX_AUDIO *channel = &m_audio[(offset >> 3) & 3]; + + m_mixer_channel->update(); + + if (offset < 0x40) + { + switch (offset & 7) + { + case 0: + value = channel->reg.volume; + break; + case 1: + value = channel->reg.feedback; + break; + case 2: + value = channel->reg.output; + break; + case 3: + // current shifter state (lower 8 bits) + value = channel->shifter & 0xff; + break; + case 4: + value = channel->reg.bakup; + break; + case 5: + value = channel->reg.control1; + break; + case 6: + //current timer value + if (channel->count >=0) + value = channel->count; + else + value = 0; + break; + case 7: + // current shifter state (upper 4 bits), status bits + value = (channel->shifter >> 4) & 0xf0; + value |= channel->reg.control2 & 0x0f; + break; + } + } + else + { + switch (offset) // Lynx II stereo control registers + { + case 0x40: case 0x41: case 0x42: case 0x43: + value = m_audio[offset & 3].attenuation; + break; + case 0x44: + value = m_attenuation_enable; + break; + case 0x50: + value = m_master_enable; + break; + } + + } + return value; +} + +WRITE8_MEMBER(lynx_sound_device::write) +{ + //logerror("audio write %.2x %.2x\n", offset, data); + LYNX_AUDIO *channel = &m_audio[(offset >> 3) & 3]; + + m_mixer_channel->update(); + + if (offset < 0x40) + { + switch (offset & 0x07) + { + // Volume control (signed) + case 0: + channel->reg.volume = data; + //logerror("write to volume %d\n", data); + break; + // Shift register feedback enable bits 0-5, 11,10 + case 1: + channel->reg.feedback = data; + channel->mask &= 0x80; + channel->mask |= (data & 0x3f) | ((data & 0xc0)<<4); + break; + // Output value + case 2: + channel->reg.output = data; + //logerror("write to output %d\n", data); + break; + // Lower 8 bits of shift register + case 3: + channel->shifter &= 0xf00; + channel->shifter |= data; + break; + // Audio timer backup value + case 4: + channel->reg.bakup = data; + break; + // Audio control bits + case 5: + channel->mask &= ~0x80; + channel->mask |= (data&0x80); + channel->reg.control1 = data; + break; + // Current count + case 6: + channel->count=data; + break; + // Upper 4 bits of shift register and audio status bits + case 7: + channel->shifter&=0xff; + channel->shifter|=(data&0xf0)<<4; + channel->reg.control2 = data; + break; + } + } + else + { + switch (offset) // Stereo Registers + { + case 0x40: case 0x41: case 0x42: case 0x43: + m_audio[offset&3].attenuation = data; + break; + case 0x44: + m_attenuation_enable = data; + break; + case 0x50: + m_master_enable = data; + break; + } + } +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void lynx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + int v; + stream_sample_t *buffer = outputs[0]; + + for (int i = 0; i < samples; i++, buffer++) + { + *buffer = 0; + for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++) + { + execute(channel); + v = m_audio[channel].reg.output; + *buffer += v * 15; // where does the *15 come from? + } + } +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void lynx2_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *left=outputs[0], *right=outputs[1]; + int v; + + for (int i = 0; i < samples; i++, left++, right++) + { + *left = 0; + *right= 0; + for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++) + { + execute(channel); + v = m_audio[channel].reg.output; + if (!(m_master_enable & (0x10 << channel))) + { + if (m_attenuation_enable & (0x10 << channel)) + *left += v * (m_audio[channel].attenuation >> 4); + else + *left += v * 15; + } + if (!(m_master_enable & (1 << channel))) + { + if (m_attenuation_enable & (1 << channel)) + *right += v * (m_audio[channel].attenuation & 0xf); + else + *right += v * 15; + } + } + } +} diff --git a/src/mame/audio/lynx.h b/src/mame/audio/lynx.h new file mode 100644 index 00000000000..b99d2b04873 --- /dev/null +++ b/src/mame/audio/lynx.h @@ -0,0 +1,90 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner + +#ifndef __LYNXSOUND_H__ +#define __LYNXSOUND_H__ + +struct LYNX_AUDIO { + struct { + INT8 volume; + UINT8 feedback; + INT8 output; + UINT8 shifter; + UINT8 bakup; + UINT8 control1; + UINT8 counter; + UINT8 control2; + } reg; + UINT8 attenuation; + UINT16 mask; // 12-bit + UINT16 shifter; // 12-bit + float ticks; + int count; +}; + +typedef device_delegate lynx_sound_timer_delegate; + + +class lynx_sound_device : public device_t, + public device_sound_interface +{ +public: + lynx_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + lynx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER(read); + DECLARE_WRITE8_MEMBER(write); + void count_down(int nr); + static void set_timer_delegate(device_t &device, lynx_sound_timer_delegate cb); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + + void reset_channel(LYNX_AUDIO *channel); + void shift(int chan_nr); + void execute(int chan_nr); + void init(); + void register_save(); + + sound_stream *m_mixer_channel; + lynx_sound_timer_delegate m_timer_delegate; // this calls lynx_timer_count_down from the driver state + + float m_usec_per_sample; + int *m_shift_mask; + int *m_shift_xor; + UINT8 m_attenuation_enable; + UINT8 m_master_enable; + LYNX_AUDIO m_audio[4]; +}; + + +class lynx2_sound_device : public lynx_sound_device +{ +public: + lynx2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + + +extern const device_type LYNX_SND; +extern const device_type LYNX2_SND; + + +#define MCFG_LYNX_SND_SET_TIMER( _class, _method) \ + lynx_sound_device::set_timer_delegate(*device, lynx_sound_timer_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); + + +#endif diff --git a/src/mame/audio/mac.c b/src/mame/audio/mac.c new file mode 100644 index 00000000000..7a0b7a93a62 --- /dev/null +++ b/src/mame/audio/mac.c @@ -0,0 +1,174 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/*************************************************************************** + + mac.c + + Sound handler + +****************************************************************************/ + + +#include "emu.h" +#include "sound/asc.h" +#include "includes/mac.h" +#include "machine/ram.h" + +/*************************************************************************** + MACROS / CONSTANTS +***************************************************************************/ + +#define MAC_MAIN_SND_BUF_OFFSET 0x0300 +#define MAC_ALT_SND_BUF_OFFSET 0x5F00 +#define MAC_SND_BUF_SIZE 370 /* total number of scan lines */ +#define MAC_SAMPLE_RATE ( MAC_SND_BUF_SIZE * 60 /*22255*/ ) /* scan line rate, should be 22254.5 Hz */ + + +/* intermediate buffer */ +#define SND_CACHE_SIZE 128 + + + + +const device_type MAC_SOUND = &device_creator; + +mac_sound_device::mac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MAC_SOUND, "Mac Audio Custom", tag, owner, clock, "mac_sound", __FILE__), + device_sound_interface(mconfig, *this), + m_sample_enable(0), + m_mac_snd_buf_ptr(NULL), + m_snd_cache_len(0), + m_snd_cache_head(0), + m_snd_cache_tail(0), + m_indexx(0) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mac_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mac_sound_device::device_start() +{ + mac_state *mac = machine().driver_data(); + + m_snd_cache = auto_alloc_array_clear(machine(), UINT8, SND_CACHE_SIZE); + m_mac_stream = machine().sound().stream_alloc(*this, 0, 1, MAC_SAMPLE_RATE); + + m_ram = machine().device(RAM_TAG); + m_mac_model = mac->m_model; + + save_pointer(NAME(m_snd_cache), SND_CACHE_SIZE); + save_item(NAME(m_sample_enable)); + save_item(NAME(m_snd_cache_len)); + save_item(NAME(m_snd_cache_head)); + save_item(NAME(m_snd_cache_tail)); + save_item(NAME(m_indexx)); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void mac_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + INT16 last_val = 0; + stream_sample_t *buffer = outputs[0]; + + if ((m_mac_model == MODEL_MAC_PORTABLE) || (m_mac_model == MODEL_MAC_PB100)) + { + memset(buffer, 0, samples * sizeof(*buffer)); + return; + } + + /* if we're not enabled, just fill with 0 */ + if (machine().sample_rate() == 0) + { + memset(buffer, 0, samples * sizeof(*buffer)); + return; + } + + /* fill in the sample */ + while (samples && m_snd_cache_len) + { + *buffer++ = last_val = ((m_snd_cache[m_snd_cache_head] << 8) ^ 0x8000) & 0xff00; + m_snd_cache_head++; + m_snd_cache_head %= SND_CACHE_SIZE; + m_snd_cache_len--; + samples--; + } + + while (samples--) + { + /* should never happen */ + *buffer++ = last_val; + } +} + + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + + +// Set the sound enable flag (VIA port line) +void mac_sound_device::enable_sound(int on) +{ + m_sample_enable = on; +} + + +// Set the current sound buffer (one VIA port line) +void mac_sound_device::set_sound_buffer(int buffer) +{ + if (buffer) + m_mac_snd_buf_ptr = (UINT16 *) (m_ram->pointer() + m_ram->size() - MAC_MAIN_SND_BUF_OFFSET); + else + m_mac_snd_buf_ptr = (UINT16 *) (m_ram->pointer() + m_ram->size() - MAC_ALT_SND_BUF_OFFSET); +} + + + +// Set the current sound volume (3 VIA port line) +void mac_sound_device::set_volume(int volume) +{ + m_mac_stream->update(); + volume = (100 / 7) * volume; + m_mac_stream->set_output_gain(0, volume / 100.0); +} + + + +// Fetch one byte from sound buffer and put it to sound output (called every scanline) +void mac_sound_device::sh_updatebuffer() +{ + UINT16 *base = m_mac_snd_buf_ptr; + + m_indexx++; + m_indexx %= 370; + + if (m_snd_cache_len >= SND_CACHE_SIZE) + { + /* clear buffer */ + m_mac_stream->update(); + } + + if (m_snd_cache_len >= SND_CACHE_SIZE) + /* should never happen */ + return; + + m_snd_cache[m_snd_cache_tail] = m_sample_enable ? (base[m_indexx] >> 8) & 0xff : 0; + m_snd_cache_tail++; + m_snd_cache_tail %= SND_CACHE_SIZE; + m_snd_cache_len++; +} diff --git a/src/mame/audio/mea8000.c b/src/mame/audio/mea8000.c new file mode 100644 index 00000000000..6936205b79f --- /dev/null +++ b/src/mame/audio/mea8000.c @@ -0,0 +1,585 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Philips / Signetics MEA 8000 emulation. + + The MEA 8000 is a speech synthesis chip. + The French company TMPI (Techni-musique & parole informatique) provided + speech extensions for several 8-bit computers (Thomson, Amstrad, Oric). + It was quite popular in France because of its ability to spell 'u' + (unlike the more widespread SPO 296 chip). + + The synthesis is based on a 4-formant model. + First, an initial sawtooth noise signal is generated. + The signal passes through a cascade of 4 filters of increasing frequency. + Each filter is a second order digital filter with a programmable + frequency and bandwidth. + All parameters, including filter parameters, are smoothly interpolated + for the duration of a frame (8ms, 16ms, 32ms, or 64 ms). + + TODO: + - REQ output pin + - optimize mea8000_compute_sample + - should we accept new frames in slow-stop mode ? + +**********************************************************************/ + +#include + +#include "emu.h" +#include "mea8000.h" + + +#define VERBOSE 0 + +/* define to use double instead of int (slow but useful for debugging) */ +#undef FLOAT_MODE + + +/******************* utilitiy function and macros ********************/ + + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +/* digital filters work at 8 kHz */ +#define F0 8096 + +/* filtered output is supersampled x 8 */ +#define SUPERSAMPLING 8 + +/* actual output pediod */ +#define SAMPLING attotime::from_hz((SUPERSAMPLING*F0)) + + + +/************************* quantization tables ***********************/ + + + +/* frequency, in Hz */ + +static const int fm1_table[32] = +{ + 150, 162, 174, 188, 202, 217, 233, 250, + 267, 286, 305, 325, 346, 368, 391, 415, + 440, 466, 494, 523, 554, 587, 622, 659, + 698, 740, 784, 830, 880, 932, 988, 1047 +}; + +static const int fm2_table[32] = +{ + 440, 466, 494, 523, 554, 587, 622, 659, + 698, 740, 784, 830, 880, 932, 988, 1047, + 1100, 1179, 1254, 1337, 1428, 1528, 1639, 1761, + 1897, 2047, 2214, 2400, 2609, 2842, 3105, 3400 +}; + +static const int fm3_table[8] = +{ + 1179, 1337, 1528, 1761, 2047, 2400, 2842, 3400 +}; + +static const int fm4_table[1] = { 3500 }; + + + +/* bandwidth, in Hz */ +static const int bw_table[4] = { 726, 309, 125, 50 }; + + + +/* amplitude * 1000 */ +static const int ampl_table[16] = +{ + 0, 8, 11, 16, 22, 31, 44, 62, + 88, 125, 177, 250, 354, 500, 707, 1000 +}; + + + +/* pitch increment, in Hz / 8 ms */ +static const int pi_table[32] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 0 /* noise */, -15, -14, -13, -12, -11, -10, -9, + -8, -7, -6, -5, -4, -3, -2, -1 +}; + + + +const device_type MEA8000 = &device_creator; + + +mea8000_device::mea8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, MEA8000, "Philips / Signetics MEA 8000 speech synthesizer", tag, owner, clock, "mea8000", __FILE__), + m_write_req(*this), + m_dac(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mea8000_device::device_start() +{ + m_write_req.resolve_safe(); + + init_tables(); + + m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mea8000_device::timer_expire),this)); + + save_item(NAME(m_state)); + save_item(NAME(m_buf)); + save_item(NAME(m_bufpos)); + save_item(NAME(m_cont)); + save_item(NAME(m_roe)); + save_item(NAME(m_framelength)); + save_item(NAME(m_framepos)); + save_item(NAME(m_framelog)); + save_item(NAME(m_lastsample)); + save_item(NAME(m_sample)); + save_item(NAME(m_phi)); + for (int i = 0; i < 4; i++) + { + save_item(NAME(m_f[i].fm), i); + save_item(NAME(m_f[i].last_fm), i); + save_item(NAME(m_f[i].bw), i); + save_item(NAME(m_f[i].last_bw), i); + save_item(NAME(m_f[i].output), i); + save_item(NAME(m_f[i].last_output), i); + } + save_item(NAME(m_last_ampl)); + save_item(NAME(m_ampl)); + save_item(NAME(m_last_pitch)); + save_item(NAME(m_pitch)); + save_item(NAME(m_noise)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mea8000_device::device_reset() +{ + LOG(("mea8000_reset\n")); + m_timer->reset(); + m_phi = 0; + m_cont = 0; + m_roe = 0; + m_state = MEA8000_STOPPED; + update_req(); + for (int i = 0; i < 4; i++) + { + m_f[i].last_output = 0; + m_f[i].output = 0; + } +} + + + +/***************************** REQ **********************************/ + + +int mea8000_device::accept_byte() +{ + return m_state == MEA8000_STOPPED || m_state == MEA8000_WAIT_FIRST || (m_state == MEA8000_STARTED && m_bufpos < 4); +} + +void mea8000_device::update_req() +{ + // actually, req pulses less than 3us for each new byte, + // it goes back up if there space left in the buffer, or stays low if the + // buffer contains a complete frame and the CPU nees to wait for the next + // frame end to compose a new frame. + m_write_req(accept_byte()); +} + + + +/*********************** sound generation ***************************/ + + +/* precompute tables */ +void mea8000_device::init_tables() +{ + for (int i = 0; i < TABLE_LEN; i++) + { + double f = (double)i / F0; + m_cos_table[i] = 2. * cos(2. * M_PI * f) * QUANT; + m_exp_table[i] = exp(-M_PI * f) * QUANT; + m_exp2_table[i] = exp(-2 * M_PI * f) * QUANT; + } + for (int i = 0; i < NOISE_LEN; i++) + m_noise_table[i] = (machine().rand() % (2 * QUANT)) - QUANT; +} + + +#ifndef FLOAT_MODE /* UINT16 version */ + + + +/* linear interpolation */ +int mea8000_device::interp( UINT16 org, UINT16 dst ) +{ + return org + (((dst - org) * m_framepos) >> m_framelog); +} + + +/* apply second order digital filter, sampling at F0 */ +int mea8000_device::filter_step( int i, int input ) +{ + /* frequency */ + int fm = interp(m_f[i].last_fm, m_f[i].fm); + /* bandwidth */ + int bw = interp(m_f[i].last_bw, m_f[i].bw); + /* filter coefficients */ + int b = (m_cos_table[fm] * m_exp_table[bw]) / QUANT; + int c = m_exp2_table[bw]; + /* transfer function */ + int next_output = input + (b * m_f[i].output - c * m_f[i].last_output) / QUANT; + m_f[i].last_output = m_f[i].output; + m_f[i].output = next_output; + return next_output; +} + + +/* random waveform, in [-QUANT,QUANT] */ +int mea8000_device::noise_gen() +{ + m_phi = (m_phi + 1) % NOISE_LEN; + return m_noise_table[m_phi]; +} + + +/* sawtooth waveform at F0, in [-QUANT,QUANT] */ +int mea8000_device::freq_gen() +{ + int pitch = interp(m_last_pitch, m_pitch); + m_phi = (m_phi + pitch) % F0; + return ((m_phi % F0) * QUANT * 2) / F0 - QUANT; +} + + +/* sample in [-32768,32767], at F0 */ +int mea8000_device::compute_sample() +{ + int out; + int ampl = interp(m_last_ampl, m_ampl); + + if (m_noise) + out = noise_gen(); + else + out = freq_gen(); + + out *= ampl / 32; + + for (int i = 0; i < 4; i++) + out = filter_step(i, out); + + if (out > 32767) + out = 32767; + if (out < -32767) + out = -32767; + return out; +} + + + +#else /* float version */ + + + +/* linear interpolation */ +double mea8000_device::interp(double org, double dst) +{ + return org + ((dst - org) * m_framepos) / m_framelength; +} + + +/* apply second order digital filter, sampling at F0 */ +double mea8000_device::filter_step(int i, double input) +{ + double fm = interp(m_f[i].last_fm, m_f[i].fm); + double bw = interp(m_f[i].last_bw, m_f[i].bw); + double b = 2. * cos(2. * M_PI * fm / F0); + double c = -exp(-M_PI * bw / F0); + double next_output = input - c * (b * m_f[i].output + c * m_f[i].last_output); + m_f[i].last_output = m_f[i].output; + m_f[i].output = next_output; + return next_output; +} + + +/* noise, in [-1,1] */ +double mea8000_device::noise_gen() +{ + m_phi++; + return (double) m_noise_table[m_phi % NOISE_LEN] / QUANT; +} + + + +/* sawtooth waveform at F0, in [-1,1] */ +double mea8000_device::freq_gen() +{ + int pitch = interp(m_last_pitch, m_pitch); + m_phi += pitch; + return (double) (m_phi % F0) / (F0 / 2.) - 1.; +} + + +/* sample in [-32767,32767], at F0 */ +int mea8000_device::compute_sample() +{ + double out; + double ampl = interp(8. * m_last_ampl, 8. * m_ampl); + + if (m_noise) + out = noise_gen(); + else + out = freq_gen(); + + out *= ampl; + + for (int i = 0; i < 4; i++) + { + out = filter_step(i, out); + } + + if (out > 32767) + out = 32767; + if (out < -32767) + out = -32767; + return out; +} + + +#endif + + +/*********************** frame management ***************************/ + + + +/* shift frame parameters from current to last */ +void mea8000_device::shift_frame() +{ + m_last_pitch = m_pitch; + for (int i = 0; i < 4; i++) + { + m_f[i].last_bw = m_f[i].bw; + m_f[i].last_fm = m_f[i].fm; + } + m_last_ampl = m_ampl; +} + + + +/* decode fields from buffer to current frame */ +void mea8000_device::decode_frame() +{ + int fd = (m_buf[3] >> 5) & 3; /* 0=8ms, 1=16ms, 2=32ms, 3=64ms */ + int pi = pi_table[m_buf[3] & 0x1f] << fd; + m_noise = (m_buf[3] & 0x1f) == 16; + m_pitch = m_last_pitch + pi; + m_f[0].bw = bw_table[m_buf[0] >> 6]; + m_f[1].bw = bw_table[(m_buf[0] >> 4) & 3]; + m_f[2].bw = bw_table[(m_buf[0] >> 2) & 3]; + m_f[3].bw = bw_table[m_buf[0] & 3]; + m_f[3].fm = fm4_table[0]; + m_f[2].fm = fm3_table[m_buf[1] >> 5]; + m_f[1].fm = fm2_table[m_buf[1] & 0x1f]; + m_f[0].fm = fm1_table[m_buf[2] >> 3]; + m_ampl = ampl_table[((m_buf[2] & 7) << 1) | (m_buf[3] >> 7)]; + m_framelog = fd + 6 /* 64 samples / ms */ + 3; + m_framelength = 1 << m_framelog; + m_bufpos = 0; +#ifdef FLOAT_MODE + LOG(("mea800_decode_frame: pitch=%i noise=%i fm1=%gHz bw1=%gHz fm2=%gHz bw2=%gHz fm3=%gHz bw3=%gHz fm4=%gHz bw4=%gHz ampl=%g fd=%ims\n", + m_pitch, m_noise, + m_f[0].fm, m_f[0].bw, m_f[1].fm, m_f[1].bw, + m_f[2].fm, m_f[2].bw, m_f[3].fm, m_f[3].bw, + m_ampl/1000., 8 << fd)); +#else + LOG(("mea800_decode_frame: pitch=%i noise=%i fm1=%iHz bw1=%iHz fm2=%iHz bw2=%iHz fm3=%iHz bw3=%iHz fm4=%iHz bw4=%iHz ampl=%g fd=%ims\n", + m_pitch, m_noise, + m_f[0].fm, m_f[0].bw, m_f[1].fm, m_f[1].bw, + m_f[2].fm, m_f[2].bw, m_f[3].fm, m_f[3].bw, + m_ampl/1000., 8 << fd)); +#endif +} + + + +void mea8000_device::start_frame() +{ + /* enter or stay in active mode */ + m_timer->reset(SAMPLING); + m_framepos = 0; +} + + + +void mea8000_device::stop_frame() +{ + /* enter stop mode */ + m_timer->reset(); + m_state = MEA8000_STOPPED; + m_dac->write_signed16(0x8000); +} + + + +/* next sample in frame, sampling at 64 kHz */ +TIMER_CALLBACK_MEMBER( mea8000_device::timer_expire ) +{ + int pos = m_framepos % SUPERSAMPLING; + + if (!pos) + { + /* sample is really computed only every 8-th time */ + m_lastsample = m_sample; + m_sample = compute_sample(); + m_dac->write_signed16(0x8000 + m_lastsample); + } + else + { + /* other samples are simply interpolated */ + int sample = m_lastsample + ((pos * (m_sample-m_lastsample)) / SUPERSAMPLING); + m_dac->write_signed16(0x8000 + sample); + } + + m_framepos++; + if (m_framepos >= m_framelength) + { + shift_frame(); + /* end of frame */ + if (m_bufpos == 4) + { + /* we have a successor */ + LOG(("%f mea8000_timer_expire: new frame\n", machine().time().as_double())); + decode_frame(); + start_frame(); + } + else if (m_cont) + { + /* repeat mode */ + LOG(("%f mea8000_timer_expire: repeat frame\n", machine().time().as_double())); + start_frame(); + } + /* slow stop */ + else if (m_state == MEA8000_STARTED) + { + m_ampl = 0; + LOG(("%f mea8000_timer_expire: fade frame\n", machine().time().as_double())); + start_frame(); + m_state = MEA8000_SLOWING; + } + else if (m_state == MEA8000_SLOWING) + { + LOG(("%f mea8000_timer_expire: stop frame\n", machine().time().as_double())); + stop_frame(); + } + update_req(); + } + else + { + /* continue frame */ + m_timer->reset(SAMPLING); + } +} + + +/************************** CPU interface ****************************/ + + +READ8_MEMBER( mea8000_device::read ) +{ + switch (offset) + { + case 0: /* status register */ + case 1: + /* ready to accept next frame */ +#if 0 + LOG(("%s %f: mea8000_r ready=%i\n", machine().describe_context(), machine().time().as_double(), accept_byte())); +#endif + return accept_byte() << 7; + + default: + logerror("%s mea8000_r invalid read offset %i\n", machine().describe_context(), offset); + } + return 0; +} + +WRITE8_MEMBER( mea8000_device::write ) +{ + switch (offset) + { + case 0: /* data register */ + if (m_state == MEA8000_STOPPED) + { + /* got pitch byte before first frame */ + m_pitch = 2 * data; + LOG(("%s %f: mea8000_w pitch %i\n", machine().describe_context(), machine().time().as_double(), m_pitch)); + m_state = MEA8000_WAIT_FIRST; + m_bufpos = 0; + } + else if (m_bufpos == 4) + { + /* overflow */ + LOG(("%s %f: mea8000_w data overflow %02X\n", machine().describe_context(), machine().time().as_double(), data)); + } + else + { + /* enqueue frame byte */ + LOG(("%s %f: mea8000_w data %02X in frame pos %i\n", machine().describe_context(), machine().time().as_double(), + data, m_bufpos)); + m_buf[m_bufpos] = data; + m_bufpos++; + if (m_bufpos == 4 && m_state == MEA8000_WAIT_FIRST) + { + /* fade-in first frame */ + int old_pitch = m_pitch; + m_last_pitch = old_pitch; + decode_frame(); + shift_frame(); + m_last_pitch = old_pitch; + m_ampl = 0; + start_frame(); + m_state = MEA8000_STARTED; + } + } + update_req(); + break; + + case 1: /* command register */ + { + int stop = BIT(data, 4); + + if (data & 8) + m_cont = BIT(data, 2); + + if (data & 2) + m_roe = BIT(data, 0); + + if (stop) + stop_frame(); + + LOG(( "%s %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n", + machine().describe_context(), machine().time().as_double(), data, + stop, m_cont, m_roe)); + + update_req(); + break; + } + + default: + logerror( "%s mea8000_w invalid write offset %i\n", machine().describe_context(), offset); + } +} diff --git a/src/mame/audio/mea8000.h b/src/mame/audio/mea8000.h new file mode 100644 index 00000000000..5d09ee938c9 --- /dev/null +++ b/src/mame/audio/mea8000.h @@ -0,0 +1,140 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Philips MEA 8000 emulation. + +**********************************************************************/ + +#ifndef __MEA8000_H__ +#define __MEA8000_H__ + +#include "sound/dac.h" + +#define MCFG_MEA8000_DAC(_tag) \ + mea8000_device::static_set_dac_tag(*device, "^" _tag); + +#define MCFG_MEA8000_REQ_CALLBACK(_write) \ + devcb = &mea8000_device::set_reqwr_callback(*device, DEVCB_##_write); + +/* table amplitude [-QUANT,QUANT] */ +#define QUANT 512 + +/* filter coefficients from frequencies */ +#define TABLE_LEN 3600 + +/* noise generator table */ +#define NOISE_LEN 8192 + + +/* finite machine state controling frames */ +enum mea8000_state +{ + MEA8000_STOPPED, /* nothing to do, timer disabled */ + MEA8000_WAIT_FIRST, /* received pitch, wait for first full trame, timer disabled */ + MEA8000_STARTED, /* playing a frame, timer on */ + MEA8000_SLOWING /* repeating last frame with decreasing amplitude, timer on */ +}; + +ALLOW_SAVE_TYPE( mea8000_state ); + + +struct filter_t +{ +#ifdef FLOAT_MODE + double fm, last_fm; /* frequency, in Hz */ + double bw, last_bw; /* band-width, in Hz */ + double output, last_output; /* filter state */ +#else + UINT16 fm, last_fm; + UINT16 bw, last_bw; + INT32 output, last_output; +#endif +}; + +class mea8000_device : public device_t +{ +public: + mea8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mea8000_device() {} + + static void static_set_dac_tag(device_t &device, const char *tag) { downcast(device).m_dac.set_tag(tag); } + template static devcb_base &set_req_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_req.set_callback(object); } + + DECLARE_READ8_MEMBER(read); + DECLARE_WRITE8_MEMBER(write); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + // internal state + + int accept_byte(); + void update_req(); + void init_tables(); +#ifndef FLOAT_MODE /* UINT16 version */ + int interp(UINT16 org, UINT16 dst); + int filter_step(int i, int input); + int noise_gen(); + int freq_gen(); + int compute_sample(); +#else /* float version */ + double interp(double org, double dst); + double filter_step(int i, double input); + double noise_gen(); + double freq_gen(); + double compute_sample(); +#endif + + void shift_frame(); + void decode_frame(); + void start_frame(); + void stop_frame(); + + TIMER_CALLBACK_MEMBER(timer_expire); + + devcb_write8 m_write_req; + + required_device m_dac; + + /* state */ + mea8000_state m_state; /* current state */ + + UINT8 m_buf[4]; /* store 4 consecutive data to form a frame info */ + UINT8 m_bufpos; /* new byte to write in frame info buffer */ + + UINT8 m_cont; /* if no data 0=stop 1=repeat last frame */ + UINT8 m_roe; /* enable req output, now unimplemented */ + + UINT16 m_framelength; /* in samples */ + UINT16 m_framepos; /* in samples */ + UINT16 m_framelog; /* log2 of framelength */ + + INT16 m_lastsample, m_sample; /* output samples are interpolated */ + + UINT32 m_phi; /* absolute phase for frequency / noise generator */ + + filter_t m_f[4]; /* filters */ + + UINT16 m_last_ampl, m_ampl; /* amplitude * 1000 */ + UINT16 m_last_pitch, m_pitch; /* pitch of sawtooth signal, in Hz */ + UINT8 m_noise; + + emu_timer *m_timer; + + int m_cos_table[TABLE_LEN]; /* fm => cos coefficient */ + int m_exp_table[TABLE_LEN]; /* bw => exp coefficient */ + int m_exp2_table[TABLE_LEN]; /* bw => 2*exp coefficient */ + int m_noise_table[NOISE_LEN]; + +}; + +extern const device_type MEA8000; + + +#endif diff --git a/src/mame/audio/socrates.c b/src/mame/audio/socrates.c new file mode 100644 index 00000000000..c35896e5c25 --- /dev/null +++ b/src/mame/audio/socrates.c @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/*************************************************************************** + + audio/socrates.c + Copyright (C) 2010-2011 Jonathan Gevaryahu AKA Lord Nightmare + + This handles the two squarewaves (plus the one weird wave) channels + on the V-tech Socrates system 27-0769 ASIC. + + +****************************************************************************/ + +#include "emu.h" +#include "socrates.h" + + +// device type definition +const device_type SOCRATES_SOUND = &device_creator; + + +//------------------------------------------------- +// socrates_snd_device - constructor +//------------------------------------------------- + +socrates_snd_device::socrates_snd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SOCRATES_SOUND, "Socrates Sound", tag, owner, clock, "socrates_snd", __FILE__), + device_sound_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void socrates_snd_device::device_start() +{ + m_freq[0] = m_freq[1] = 0xff; /* channel 1,2 frequency */ + m_vol[0] = m_vol[1] = 0x07; /* channel 1,2 volume */ + m_enable[0] = m_enable[1] = 0x01; /* channel 1,2 enable */ + m_channel3 = 0x00; /* channel 3 weird register */ + m_DAC_output = 0x00; /* output */ + m_state[0] = m_state[1] = m_state[2] = 0; + m_accum[0] = m_accum[1] = m_accum[2] = 0xFF; + m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() ? clock() : machine().sample_rate()); +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void socrates_snd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + for (int i = 0; i < samples; i++) + { + snd_clock(); + outputs[0][i] = ((int)m_DAC_output<<4); + } +} + + +const UINT8 socrates_snd_device::s_volumeLUT[16] = +{ +0, 61, 100, 132, 158, 183, 201, 218, +233, 242, 253, 255, 250, 240, 224, 211 +}; // this table is actually quite weird on the real console. +// 0, 0.033, 0.055, 0.07175, 0.086, 0.1, 0.11, 0.119, 0.127, 0.132, 0.138, 0.139, 0.136, 0.131, 0.122, 0.115 are the voltage amplitudes for the steps on channel 2. the last four are particularly bizarre, probably caused by some sort of internal clipping. + +void socrates_snd_device::snd_clock() /* called once per clock */ +{ + for (int channel = 0; channel < 2; channel++) + { + if ((m_accum[channel] == 0) && m_enable[channel]) + { + m_state[channel] = (m_state[channel]^0x1); + m_accum[channel] = m_freq[channel]; + } + else if (m_enable[channel]) + { + m_accum[channel]--; + } + else + { + m_accum[channel] = 0; // channel is disabled + m_state[channel] = 0; + } + } + // handle channel 3 here + m_DAC_output = (m_state[0]?(s_volumeLUT[m_vol[0]]*9.4):0); // channel 1 is ~2.4 times as loud as channel 2 + m_DAC_output += (m_state[1]?(s_volumeLUT[m_vol[1]]<<2):0); + // add channel 3 to dac output here +} + + +void socrates_snd_device::reg0_w(int data) +{ + m_stream->update(); + m_freq[0] = data; +} + +void socrates_snd_device::reg1_w(int data) +{ + m_stream->update(); + m_freq[1] = data; +} + +void socrates_snd_device::reg2_w(int data) +{ + m_stream->update(); + m_vol[0] = data&0xF; + m_enable[0] = (data&0x10)>>4; +} + +void socrates_snd_device::reg3_w(int data) +{ + m_stream->update(); + m_vol[1] = data&0xF; + m_enable[1] = (data&0x10)>>4; +} + +void socrates_snd_device::reg4_w(int data) +{ + m_stream->update(); + m_channel3 = data; +} diff --git a/src/mame/audio/socrates.h b/src/mame/audio/socrates.h new file mode 100644 index 00000000000..f1d2b1dd002 --- /dev/null +++ b/src/mame/audio/socrates.h @@ -0,0 +1,44 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +#pragma once + +#ifndef __SOCR_SND_H__ +#define __SOCR_SND_H__ + +class socrates_snd_device : public device_t, + public device_sound_interface +{ +public: + socrates_snd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + void reg0_w(int data); + void reg1_w(int data); + void reg2_w(int data); + void reg3_w(int data); + void reg4_w(int data); + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + void snd_clock(); + static const UINT8 s_volumeLUT[]; + + // internal state + sound_stream * m_stream; + UINT8 m_freq[2]; // channel 1,2 frequencies + UINT8 m_vol[2]; // channel 1,2 volume + UINT8 m_enable[2]; // channel 1,2 enable + UINT8 m_channel3; // channel 3 weird register + UINT8 m_state[3]; // output states for channels 1,2,3 + UINT8 m_accum[3]; // accumulators for channels 1,2,3 + UINT16 m_DAC_output; // output +}; + +extern const device_type SOCRATES_SOUND; + + +#endif /* __SOCR_SND_H__ */ diff --git a/src/mame/audio/specimx_snd.c b/src/mame/audio/specimx_snd.c new file mode 100644 index 00000000000..2b56c6b25f8 --- /dev/null +++ b/src/mame/audio/specimx_snd.c @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + audio/special.c + + Functions to emulate sound hardware of Specialist MX + ( based on code of DAI interface ) + +****************************************************************************/ + +#include "specimx_snd.h" + + +// device type definition +const device_type SPECIMX_SND = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// specimx_sound_device - constructor +//------------------------------------------------- + +specimx_sound_device::specimx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SPECIMX_SND, "Specialist MX Audio Custom", tag, owner, clock, "specimx_sound", __FILE__), + device_sound_interface(mconfig, *this), + m_mixer_channel(NULL) +{ + memset(m_specimx_input, 0, sizeof(int)*3); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void specimx_sound_device::device_start() +{ + m_specimx_input[0] = m_specimx_input[1] = m_specimx_input[2] = 0; + m_mixer_channel = stream_alloc(0, 1, machine().sample_rate()); +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void specimx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + INT16 channel_0_signal; + INT16 channel_1_signal; + INT16 channel_2_signal; + + stream_sample_t *sample_left = outputs[0]; + + channel_0_signal = m_specimx_input[0] ? 3000 : -3000; + channel_1_signal = m_specimx_input[1] ? 3000 : -3000; + channel_2_signal = m_specimx_input[2] ? 3000 : -3000; + + while (samples--) + { + *sample_left = 0; + + /* music channel 0 */ + *sample_left += channel_0_signal; + + /* music channel 1 */ + *sample_left += channel_1_signal; + + /* music channel 2 */ + *sample_left += channel_2_signal; + + sample_left++; + } +} + + +//------------------------------------------------- +// PIT callbacks +//------------------------------------------------- + +WRITE_LINE_MEMBER(specimx_sound_device::set_input_ch0) +{ + m_mixer_channel->update(); + m_specimx_input[0] = state; +} + +WRITE_LINE_MEMBER(specimx_sound_device::set_input_ch1) +{ + m_mixer_channel->update(); + m_specimx_input[1] = state; +} + +WRITE_LINE_MEMBER(specimx_sound_device::set_input_ch2) +{ + m_mixer_channel->update(); + m_specimx_input[2] = state; +} diff --git a/src/mame/audio/specimx_snd.h b/src/mame/audio/specimx_snd.h new file mode 100644 index 00000000000..0e07b27dc4b --- /dev/null +++ b/src/mame/audio/specimx_snd.h @@ -0,0 +1,39 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * specimx_snd.h + * + ****************************************************************************/ + +#ifndef SPECIAL_SND_H_ +#define SPECIAL_SND_H_ + +#include "emu.h" + +class specimx_sound_device : public device_t, + public device_sound_interface +{ +public: + specimx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~specimx_sound_device() { } + + DECLARE_WRITE_LINE_MEMBER(set_input_ch0); + DECLARE_WRITE_LINE_MEMBER(set_input_ch1); + DECLARE_WRITE_LINE_MEMBER(set_input_ch2); + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + sound_stream *m_mixer_channel; + int m_specimx_input[3]; +}; + +extern const device_type SPECIMX_SND; + +#endif /* SPECIAL_SND_H_ */ diff --git a/src/mame/audio/svis_snd.c b/src/mame/audio/svis_snd.c new file mode 100644 index 00000000000..86408d26820 --- /dev/null +++ b/src/mame/audio/svis_snd.c @@ -0,0 +1,269 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/*************************************************************************** + supervision sound hardware + + PeT mess@utanet.at +***************************************************************************/ + +#include "emu.h" +#include "svis_snd.h" + + +// device type definition +const device_type SVISION_SND = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// svision_sound_device - constructor +//------------------------------------------------- + +svision_sound_device::svision_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SVISION_SND, "Super Vision Audio Custom", tag, owner, clock, "svision_sound", __FILE__), + device_sound_interface(mconfig, *this), + m_mixer_channel(NULL) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void svision_sound_device::device_start() +{ + // bind callbacks + m_irq_cb.bind_relative_to(*owner()); + + memset(&m_dma, 0, sizeof(m_dma)); + memset(&m_noise, 0, sizeof(m_noise)); + memset(m_channel, 0, sizeof(m_channel)); + + m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void svision_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *left=outputs[0], *right=outputs[1]; + int i, j; + SVISION_CHANNEL *channel; + + for (i = 0; i < samples; i++, left++, right++) + { + *left = 0; + *right = 0; + for (channel=m_channel, j=0; jsize != 0) + { + if (channel->on||channel->count) + { + int on = FALSE; + switch (channel->waveform) + { + case 0: + on = channel->pos <= (28 * channel->size) >> 5; + break; + case 1: + on = channel->pos <= (24 * channel->size) >> 5; + break; + default: + case 2: + on = channel->pos <= channel->size / 2; + break; + case 3: + on = channel->pos <= (9 * channel->size) >> 5; + break; + } + { + INT16 s = on ? channel->volume << 8 : 0; + if (j == 0) + *right += s; + else + *left += s; + } + } + channel->pos++; + if (channel->pos >= channel->size) + channel->pos = 0; + } + } + if (m_noise.on && (m_noise.play || m_noise.count)) + { + INT16 s = (m_noise.value ? 1 << 8: 0) * m_noise.volume; + int b1, b2; + if (m_noise.left) + *left += s; + if (m_noise.right) + *right += s; + m_noise.pos += m_noise.step; + if (m_noise.pos >= 1.0) + { + switch (m_noise.type) + { + case SVISION_NOISE_Type7Bit: + m_noise.value = m_noise.state & 0x40 ? 1 : 0; + b1 = (m_noise.state & 0x40) != 0; + b2 = (m_noise.state & 0x20) != 0; + m_noise.state=(m_noise.state<<1)+(b1!=b2?1:0); + break; + case SVISION_NOISE_Type14Bit: + default: + m_noise.value = m_noise.state & 0x2000 ? 1 : 0; + b1 = (m_noise.state & 0x2000) != 0; + b2 = (m_noise.state & 0x1000) != 0; + m_noise.state = (m_noise.state << 1) + (b1 != b2 ? 1 : 0); + } + m_noise.pos -= 1; + } + } + if (m_dma.on) + { + UINT8 sample; + INT16 s; + UINT16 addr = m_dma.start + (unsigned) m_dma.pos / 2; + if (addr >= 0x8000 && addr < 0xc000) + { + sample = machine().root_device().memregion("user1")->base()[(addr & 0x3fff) | m_dma.ca14to16]; + } + else + { + sample = machine().device("maincpu")->memory().space(AS_PROGRAM).read_byte(addr); + } + if (((unsigned)m_dma.pos) & 1) + s = (sample & 0xf); + else + s = (sample & 0xf0) >> 4; + s <<= 8; + if (m_dma.left) + *left += s; + if (m_dma.right) + *right += s; + m_dma.pos += m_dma.step; + if (m_dma.pos >= m_dma.size) + { + m_dma.finished = TRUE; + m_dma.on = FALSE; + m_irq_cb(); + } + } + } +} + + +WRITE8_MEMBER( svision_sound_device::sounddma_w ) +{ + logerror("%.6f svision snddma write %04x %02x\n", space.machine().time().as_double(),offset+0x18,data); + m_dma.reg[offset] = data; + switch (offset) + { + case 0: + case 1: + m_dma.start = (m_dma.reg[0] | (m_dma.reg[1] << 8)); + break; + case 2: + m_dma.size = (data ? data : 0x100) * 32; + break; + case 3: + m_dma.step = space.machine().device("maincpu")->unscaled_clock() / (256.0 * space.machine().sample_rate() * (1 + (data & 3))); + m_dma.right = data & 4; + m_dma.left = data & 8; + m_dma.ca14to16 = ((data & 0x70) >> 4) << 14; + break; + case 4: + m_dma.on = data & 0x80; + if (m_dma.on) + { + m_dma.pos = 0.0; + } + break; + } +} + + +WRITE8_MEMBER( svision_sound_device::noise_w ) +{ + // logerror("%.6f svision noise write %04x %02x\n",machine.time(),offset+0x28,data); + m_noise.reg[offset]=data; + switch (offset) + { + case 0: + m_noise.volume=data&0xf; + m_noise.step= space.machine().device("maincpu")->unscaled_clock() / (256.0*space.machine().sample_rate()*(1+(data>>4))); + break; + case 1: + m_noise.count = data + 1; + break; + case 2: + m_noise.type = (SVISION_NOISE_Type) (data & 1); + m_noise.play = data & 2; + m_noise.right = data & 4; + m_noise.left = data & 8; + m_noise.on = data & 0x10; /* honey bee start */ + m_noise.state = 1; + break; + } + m_noise.pos=0.0; +} + + +int *svision_sound_device::dma_finished() +{ + return &m_dma.finished; +} + + +void svision_sound_device::sound_decrement() +{ + if (m_channel[0].count > 0) + m_channel[0].count--; + if (m_channel[1].count > 0) + m_channel[1].count--; + if (m_noise.count > 0) + m_noise.count--; +} + + +void svision_sound_device::soundport_w(int which, int offset, int data) +{ + SVISION_CHANNEL *channel = &m_channel[which]; + UINT16 size; + + m_mixer_channel->update(); + channel->reg[offset] = data; + + switch (offset) + { + case 0: + case 1: + size = channel->reg[0] | ((channel->reg[1] & 7) << 8); + if (size) + { + // channel->size=(int)(device->machine().sample_rate()*(size<<5)/4e6); + channel->size= (int) (machine().sample_rate() * (size << 5) / machine().device("maincpu")->unscaled_clock()); + } + else + { + channel->size = 0; + } + channel->pos = 0; + break; + case 2: + channel->on = data & 0x40; + channel->waveform = (data & 0x30) >> 4; + channel->volume = data & 0xf; + break; + case 3: + channel->count = data + 1; + break; + } +} diff --git a/src/mame/audio/svis_snd.h b/src/mame/audio/svis_snd.h new file mode 100644 index 00000000000..7d21bc4fdfb --- /dev/null +++ b/src/mame/audio/svis_snd.h @@ -0,0 +1,142 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * svis_snd.h + * + ****************************************************************************/ + +#ifndef SVIS_SND_H_ +#define SVIS_SND_H_ + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +enum SVISION_NOISE_Type +{ + SVISION_NOISE_Type7Bit, + SVISION_NOISE_Type14Bit +}; + +struct SVISION_NOISE +{ + SVISION_NOISE() : + on(0), + right(0), + left(0), + play(0), + type(SVISION_NOISE_Type7Bit), + state(0), + volume(0), + count(0), + step(0.0), + pos(0.0), + value(0) + { + memset(reg, 0, sizeof(UINT8)*3); + } + + UINT8 reg[3]; + int on, right, left, play; + SVISION_NOISE_Type type; + int state; + int volume; + int count; + double step, pos; + int value; // currently simple random function +}; + +struct SVISION_DMA +{ + SVISION_DMA() : + on(0), + right(0), + left(0), + ca14to16(0), + start(0), + size(0), + pos(0.0), + step(0.0), + finished(0) + { + memset(reg, 0, sizeof(UINT8)*5); + } + + UINT8 reg[5]; + int on, right, left; + int ca14to16; + int start,size; + double pos, step; + int finished; +}; + +struct SVISION_CHANNEL +{ + SVISION_CHANNEL() : + on(0), + waveform(0), + volume(0), + pos(0), + size(0), + count(0) + { + memset(reg, 0, sizeof(UINT8)*4); + } + + UINT8 reg[4]; + int on; + int waveform, volume; + int pos; + int size; + int count; +}; + +typedef device_delegate svision_snd_irq_delegate; +#define SVISION_SND_IRQ_MEMBER(_name) void _name(void) + +#define SVISION_SND_IRQ_CB(_class, _method) \ + svision_sound_device::set_irq_callback(*device, svision_snd_irq_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + +// ======================> svision_sound_device + +class svision_sound_device : public device_t, + public device_sound_interface +{ +public: + svision_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~svision_sound_device() { } + + // static configuration + static void set_irq_callback(device_t &device, svision_snd_irq_delegate callback) { downcast(device).m_irq_cb = callback; } + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +public: + DECLARE_WRITE8_MEMBER( sounddma_w ); + DECLARE_WRITE8_MEMBER( noise_w ); + +public: + int *dma_finished(); + void sound_decrement(); + void soundport_w(int which, int offset, int data); + +private: + svision_snd_irq_delegate m_irq_cb; + + sound_stream *m_mixer_channel; + SVISION_DMA m_dma; + SVISION_NOISE m_noise; + SVISION_CHANNEL m_channel[2]; +}; + +extern const device_type SVISION_SND; + + +#endif /* SVIS_SND_H_ */ diff --git a/src/mame/audio/tvc_snd.c b/src/mame/audio/tvc_snd.c new file mode 100644 index 00000000000..29d61b5dc7c --- /dev/null +++ b/src/mame/audio/tvc_snd.c @@ -0,0 +1,142 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Videotone TVC 32/64 sound emulation + +***************************************************************************/ + +#include "emu.h" +#include "tvc_snd.h" + +// device type definition +const device_type TVC_SOUND = &device_creator; + +//------------------------------------------------- +// tvc_sound_device - constructor +//------------------------------------------------- + +tvc_sound_device::tvc_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, TVC_SOUND, "TVC 64 Audio Custom", tag, owner, clock, "tvc_sound", __FILE__), + device_sound_interface(mconfig, *this), + m_write_sndint(*this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- +void tvc_sound_device::device_start() +{ + // resolve callbacks + m_write_sndint.resolve_safe(); + + m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate()); + m_sndint_timer = timer_alloc(TIMER_SNDINT); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- +void tvc_sound_device::device_reset() +{ + m_enabled = 0; + m_freq = 0; + m_incr = 0; + m_signal = 1; + m_sndint_timer->reset(); +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void tvc_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_write_sndint(1); +} + +//------------------------------------------------- +// sound_stream_update - handle update requests for +// our sound stream +//------------------------------------------------- + +void tvc_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + int rate = machine().sample_rate() / 2; + + if (m_enabled && m_freq) + { + while( samples-- > 0 ) + { + *outputs[0]++ = m_signal * (m_volume * 0x0800); + m_incr -= m_freq; + while(m_incr < 0) + { + m_incr += rate; + m_signal = -m_signal; + } + } + } + else + { + // fill output with 0 if the sound is disabled + memset(outputs[0], 0, samples * sizeof(stream_sample_t)); + } +} + + + +//------------------------------------------------- +// ports write +//------------------------------------------------- + +WRITE8_MEMBER(tvc_sound_device::write) +{ + m_stream->update(); + + m_ports[offset] = data; + + switch(offset) + { + case 1: + m_enabled = BIT(data, 4); + // fall through + + case 0: + { + UINT16 pitch = (m_ports[0] | (m_ports[1]<<8)) & 0x0fff; + m_freq = (pitch == 0x0fff) ? 0 : (int)(195312.5 / (4096 - pitch)); + + if ((m_ports[1] & 0x20) && m_freq != 0) + m_sndint_timer->adjust(attotime::from_hz(m_freq), 0, attotime::from_hz(m_freq)); + else + m_sndint_timer->reset(); + + break; + } + + case 2: + m_volume = (data>>2) & 0x0f; + break; + } +} + + +//------------------------------------------------- +// tvc_sound_device::reset_divider +//------------------------------------------------- + +void tvc_sound_device::reset_divider() +{ + m_stream->update(); + + m_incr = 0; + m_signal = 1; + + if (m_ports[1] & 0x20 && m_freq != 0) + m_sndint_timer->adjust(attotime::from_hz(m_freq), 0, attotime::from_hz(m_freq)); + else + m_sndint_timer->reset(); +} diff --git a/src/mame/audio/tvc_snd.h b/src/mame/audio/tvc_snd.h new file mode 100644 index 00000000000..b8b955d3c45 --- /dev/null +++ b/src/mame/audio/tvc_snd.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/***************************************************************************** + * + * includes/tvc.h + * + ****************************************************************************/ + +#pragma once + +#ifndef _TVC_SND_H_ +#define _TVC_SND_H_ + +#define MCFG_TVC_SOUND_SNDINT_CALLBACK(_write) \ + devcb = &tvc_sound_device::set_sndint_wr_callback(*device, DEVCB_##_write); + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> tvc_sound_device + +class tvc_sound_device : public device_t, + public device_sound_interface +{ +public: + // construction/destruction + tvc_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_sndint_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_sndint.set_callback(object); } + + DECLARE_WRITE8_MEMBER(write); + void reset_divider(); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + static const device_timer_id TIMER_SNDINT = 0; + + sound_stream * m_stream; + int m_freq; + int m_enabled; + int m_volume; + int m_incr; + int m_signal; + UINT8 m_ports[3]; + emu_timer * m_sndint_timer; + devcb_write_line m_write_sndint; +}; + +// device type definition +extern const device_type TVC_SOUND; + +#endif diff --git a/src/mame/audio/upd1771.c b/src/mame/audio/upd1771.c new file mode 100644 index 00000000000..96b3b2bb062 --- /dev/null +++ b/src/mame/audio/upd1771.c @@ -0,0 +1,554 @@ +// license:BSD-3-Clause +// copyright-holders:David Viens +/********************************************************************** + + NEC uPD1771-017 as used in the Epoch Super Cassette Vision (SCV) + + Made using recording/analysis on a Yeno (PAL Super Cassete Vision) + by plgDavid + + Full markings on my 2 specimens are + "NEC JAPAN 8431K9 D1771C 017" (31st week of 1984, mask rom #017) + + I've since (October 2012) got a Grandstand Firefox F-7 Handheld game + (AKA Epoch GalagaX6/Epoch Astro Thunder 7/Tandy Astro Thunder), + (http://www.handheldmuseum.com/Grandstand/Firefox.htm) + which includes a + "NEC JAPAN 8319K9 D1771C 011" (19th week of 1983, mask rom #011) + Thanks to user 'Blanka' from Dragonslairfans for the nice catch! + (http://www.dragonslairfans.com/smfor/index.php?topic=3061.0) + + Since the chip generates tones using ROM wavetables, + it is perfectly possible to generate other sounds with different rom code and data. + + Most upd17XXX devices are typically 4bit NEC MCUs, however based on information + in "Electronic Speech Synthesis" by Geoff Bristow (ISBN 0-07-007912-9, pages 148-152) + the upd1770/1771 is not one of these 4-bit ones. + + The uPD1770/uPD1771 SSM is a 16-bit-wide rom/ram mcu with 8kb (4kw) of rom code, + 64 bytes of ram (16x16bit words addressable as 16 or 2x8 bits each, the + remaining 32 bytes acting as an 8-level stack), 182 instructions, a complex + noise and tone internal interrupt system, external interrupts, + and two 8-bit ports with multiple modes allowing for chips to operate as master + or slave devices. + SSM stands for "Sound Synthesis Microcomputer". + + People who I *THINK* worked on the uPD1771 and what part I think they worked on: + Toshio Oura - Project Lead(?), VSRSSS/TSRSSS speech synthesis engine (on upd1776C), master/slave i/o controls, author of bristow article and primary author of the IEEE article + Hatsuhide Igarashi - Clock oscillator and pad layout, coauthor on the IEEE article, other IEEE stuff + Tomoaki Isozaki - ? (senior NEC engineer?), coauthor on the IEEE article + Sachiyuki Toufuku - ?, coauthor on the IEEE article + Tojiro Mukawa - IGFETs and the DAC + M. Sakai ? - digital filtering for VSRSSS? (IEEE 4131979, 1169295) + M. Endo ? - digital design system or speech synthesis? (IEEE 4069656, another? person: IEEE 150330, 225838) + H. Aoyama ? - logic design system used to assemble/lay out the chip? (IEEE 1585393) + I. Fujitaka ? (no IEEE) + Eiji Sugimoto - cpu design? 1156033 1155824 + F. Tsukuda ? (no IEEE) + N. Miyake ? switched capacitor stuff? (IEEE nnnnnn) + + + The uPD1771 internal workings are described to some extent by the Bristow book + and the IEEE article "A Single-Chip Sound Synthesis Microcomputer" which complements the book + and are covered by at least four US patents: + 4184152 - on IGFET-based DAC stuff + 4488061 - on the IGFET-based drive circuit part of the DAC. + 4408094 - covers the 3 pin DAC with the volume control/vref pin. Not all that interesting, + except it might describe to some extent how the (9->5bit?) PWM works in the text. + 4470113 - covers the multiplexed PB0/1/2/3 pins and their use as /CS /WR /RD and ALE + note as I have marked the pins below I assume the final pins connected + to /CS /WR /RD and /ALE are PB7,6,5,4 but this is just a guess of mine: + The actual order may well match the patent. + 4577343 - covers the VSRSSS implementation as discussed in the Bristow book. + This patent has an internal diagram of the workings of the chips and + a limited description of how many registers etc it has. + 4805508 - on the operation of the tone divider register and correction for accurate period when + the tone interrupt frequency is not perfectly divisible from the clock. + These next two may not be specific to the 1771 or even related at all! + 4321562 - on a self-adjusting circuit for internal coupling to the clock crystal inputs. + This may be a generic NEC invention and probably isn't limited to the upd1771. + 4656491 - on a new method of distributing resistors and transistors on anti-ESD pin buffers + This may be a generic NEC invention and probably isn't limited to the upd1771. + + + Based on the 4577343 patent mostly, plus the bristow and IEEE article: + * these are the registers: + 8bits: + AH, AL (forming the 16-bit A' accumulator), + B, C (a pair of general purpose registers), + 4bits (may be technically part of ALU): + H -> points to one of the 16 words of ram + 1bit: + L -> selector of left or right half of the ram word + ?bits: + D (having to do with the DAC) + N (3 bits? having to do with the pseudorandom noise interrupt, namely setting the clock divider ratio for the PRNG clock vs cpu clock) + MODE (5 or more bits? enabling/disabling/acking the noise interrupt, and the tone interrupts (there are four!)) + SP (the stack pointer, probably 5 bits, points to the stack ram; may encompass H and L as above!) + FLO: unsure. quite possibly 'flag overflow' used for branching. there likely exists other flags as well... + ODF: 'output data flag?', selects which half of a selected ram word is output to the dac not really sure of this? + + + Mask roms known: + uPD1776C: mentioned in the bristow book, implements VSRSSS speech concatenation + (see US Patent 4577343 which is a patent on this VSRSSS implementation) + uPD1771C-006: used in NEC APC for sound as the "MPU" + -011: used on Firefox F-4/Astro Thunder handheld + -015: unknown, known to exist from part scalper sites only. + -017: used on Epoch Super Cassete Vision for sound; This audio driver HLEs that part only. + + Used pinout in the SCV: + + NC 1 28 NC + NC 2 27 NC + NC 3 26 ACK + !WR 4 25 D7 + !CS 5 24 D6 + RESET 6 23 D5 + NC 7 22 D4 + VCC 8 21 D3 + 6Mhz XIN 9 20 D2 + 6Mhz XOUT 10 19 D1 + AUDOUT 11 18 D0 + NC(recheck!)12 17 GND + AUDOUT(inv) 13 16 VCC + GND 14 15 ? tied to pin 16 (VCC) through a resistor (pullup?) + + Pinout based on guesses and information in "Electronic Speech Synthesis" by Geoff Bristow + (ISBN 0-07-007912-9, pages 148-152), and the data on page 233 of the Nec APC technical manual at + http://bitsavers.trailing-edge.com/pdf/nec/APC/819-000100-1003_APC_System_Reference_Guide_Apr83.pdf + I/O pin purpose based on testing by kevtris. + [x] is unsure: + PB3 <> 1 28 <> PB2 + PB4(/ALE) <> 2 27 <> PB1 + PB5(/RD) <> 3 26 <> PB0 + PB6(/WR) <> 4 25 <> D7(PA7) + PB7(/CS) <> 5 24 <> D6(PA6) + /RESET -> 6 23 <> D5(PA5) + [/TSTOUT?] <- 7 22 <> D4(PA4) + VCC -- 8 21 <> D3(PA3) + XI(CLK) -> 9 20 <> D2(PA2) + XO <- 10 19 <> D1(PA1) + D/A OUT + <- 11 18 <> D0(PA0) + D/A POWER -- 12 17 <- CH2 + D/A OUT - <- 13 16 <> /EXTINT and [/TSTOUT2?] (test out is related to pin 15 state) + GND -- 14 15 <- CH1 tied to pin 16 (VCC) through a resistor, on APC to VCC thru a 12k resistor and thru a 10uf cap to gnd + + CH1 and CH2 are mode selects, purpose based on testing by kevtris: + CH1 CH2 + H L - 'master' mode, pb4-pb7 are i/o? /EXTINT is an input + L L - 'slave' mode where pb4-pb7 are /ale /rd /wr /cs? /EXTINT may be an output in this mode? + X H - test mode: the 512 byte 16-bit wide ROM is output sequentially on pins pa7-pa0 and pb7-pb0 for the high and low bytes of each word respectively + D/A POWER is the FET source for the D/A OUT+ and D/A OUT- push-pull dac drains; it should be tied to VCC or thereabouts + + In the SCV (info from plgDavid): + pin 5 is tied to the !SCPU pin on the Epoch TV chip pin 29 (0x3600 writes) + pin 6 is tied to the PC3 pin of the upD7801 CPU + pin 26 is tied to the INT1 pin of the upD7801 (CPU pin 12), + + 1,2,3,28,27 don't generate any digital signals + 6 seems to be lowered 2.5 ms before an audio write + 7 is always low. + 12 is always high + + (NOTE: the photomicrograph in the bristow book makes it fairly clear due to + pad thicknessess that the real VCC is pin 8 and the real GND is pin 14. + The function of pin 7 is unknown. + + Pins 11 and 13 go to a special circuit, which according to kevtris's analysis + of my schematics, consist of a balanced output (not unlike XLR cables), + which are then combined together then sent to the RF box. + (The bristow book explains that there are two DAC pins and one DAC + VREF/volume pin. The dac+ and dac- are pins 11 and 13, and based on the + photomicrograph it looks like dac vref is probably pin 12) + + HLE: + All writes are made through address 0x3600 on the upD7801 + Instead of using register=value, this chip require sending multiple + bytes for each command, one after the other. + +**********************************************************************/ + +#include "emu.h" +#include "audio/upd1771.h" + + +#define LOG 0 + +/* + Each of the 8 waveforms have been extracted from the uPD1771c-017 internal + ROM, from offset 0x1fd (start of first waveform) to offset 0x2fc (end of + last waveform). + (note: given test mode dumping offset non-clarity it may be 0x200-0x2ff) + The waveforms are stored in an 8-bit sign-magnitude format, so if in ROM the + upper bit is 0x80, invert the lower 7 bits to get the 2's complement result + seen here. + Note that only the last 4 waveforms appear to have been intended for use as + waveforms; the first four look as if they're playing back a piece of code as + wave data. +*/ +const char WAVEFORMS[8][32]={ +{ 0, 0,-123,-123, -61, -23, 125, 107, 94, 83,-128,-128,-128, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,-128,-128,-128, 0, 0, 0, 0, 0, 0}, +{ 37, 16, 32, -21, 32, 52, 4, 4, 33, 18, 60, 56, 0, 8, 5, 16, 65, 19, 69, 16, -2, 19, 37, 16, 97, 19, 0, 87, 127, -3, 1, 2}, +{ 0, 8, 1, 52, 4, 0, 0, 77, 81,-109, 47, 97, -83,-109, 38, 97, 0, 52, 4, 0, 1, 4, 1, 22, 2, -46, 33, 97, 0, 8, -85, -99}, +{ 47, 97, 40, 97, -3, 25, 64, 17, 0, 52, 12, 5, 12, 5, 12, 5, 12, 5, 12, 5, 8, 4,-114, 19, 0, 52,-122, 21, 2, 5, 0, 8}, +{ -52, -96,-118,-128,-111, -74, -37, -5, 31, 62, 89, 112, 127, 125, 115, 93, 57, 23, 0, -16, -8, 15, 37, 54, 65, 70, 62, 54, 43, 31, 19, 0}, +{ -81,-128, -61, 13, 65, 93, 127, 47, 41, 44, 52, 55, 56, 58, 58, 34, 0, 68, 76, 72, 61, 108, 55, 29, 32, 39, 43, 49, 50, 51, 51, 0}, +{ -21, -45, -67, -88,-105,-114,-122,-128,-123,-116,-103, -87, -70, -53, -28, -9, 22, 46, 67, 86, 102, 114, 123, 125, 127, 117, 104, 91, 72, 51, 28, 0}, +{ -78,-118,-128,-102, -54, -3, 40, 65, 84, 88, 84, 80, 82, 88, 94, 103, 110, 119, 122, 125, 122, 122, 121, 123, 125, 126, 127, 127, 125, 118, 82, 0} +}; + + +#define NOISE_SIZE 255 + + +static unsigned char noise_tbl[]= +{ + 0x1c,0x86,0x8a,0x8f,0x98,0xa1,0xad,0xbe,0xd9,0x8a,0x66,0x4d,0x40,0x33,0x2b,0x23, + 0x1e,0x8a,0x90,0x97,0xa4,0xae,0xb8,0xd6,0xec,0xe9,0x69,0x4a,0x3e,0x34,0x2d,0x27, + 0x24,0x24,0x89,0x8e,0x93,0x9c,0xa5,0xb0,0xc1,0xdd,0x40,0x36,0x30,0x29,0x27,0x24, + 0x8b,0x90,0x96,0x9e,0xa7,0xb3,0xc4,0xe1,0x25,0x21,0x8a,0x8f,0x93,0x9d,0xa5,0xb2, + 0xc2,0xdd,0xdd,0x98,0xa2,0xaf,0xbf,0xd8,0xfd,0x65,0x4a,0x3c,0x31,0x2b,0x24,0x22, + 0x1e,0x87,0x8c,0x91,0x9a,0xa3,0xaf,0xc0,0xdb,0xbe,0xd9,0x8c,0x66,0x4d,0x40,0x34, + 0x2c,0x24,0x1f,0x88,0x90,0x9a,0xa4,0xb2,0xc2,0xda,0xff,0x67,0x4d,0x3d,0x34,0x2d, + 0x26,0x24,0x20,0x89,0x8e,0x93,0x9c,0xa5,0xb1,0xc2,0xde,0xc1,0xda,0xff,0x67,0x4d, + 0x3d,0x33,0x2d,0x26,0x24,0x20,0x89,0x8e,0x93,0x9c,0xa5,0xb1,0xc2,0xdd,0xa3,0xb0, + 0xc0,0xd9,0xfe,0x66,0x4b,0x3c,0x32,0x2b,0x24,0x23,0x1e,0x88,0x8d,0x92,0x9b,0xa4, + 0xb0,0xc1,0xdc,0xad,0xbe,0xda,0x22,0x20,0x1c,0x85,0x8a,0x8f,0x98,0xa1,0xad,0xbe, + 0xda,0x20,0x1b,0x85,0x8d,0x97,0xa1,0xaf,0xbf,0xd8,0xfd,0x64,0x49,0x3a,0x30,0x2a, + 0x23,0x21,0x1d,0x86,0x8b,0x91,0x9a,0xa2,0xae,0xc0,0xdb,0x33,0x2b,0x24,0x1f,0x88, + 0x90,0x9a,0xa4,0xb2,0xc2,0xda,0xff,0x67,0x4c,0x3e,0x33,0x2d,0x25,0x24,0x1f,0x89, + 0x8e,0x93,0x9c,0xa5,0xb1,0xc2,0xde,0x85,0x8e,0x98,0xa2,0xb0,0xc0,0xd9,0xfe,0x64, + 0x4b,0x3b,0x31,0x2a,0x23,0x22,0x1e,0x88,0x8c,0x91,0x9b,0xa3,0xaf,0xc1,0xdc,0xdc +}; + + + +#define STATE_SILENCE 0 +#define STATE_NOISE 1 +#define STATE_TONE 2 +#define STATE_ADPCM 3 + + +const device_type UPD1771C = &device_creator; + + +upd1771c_device::upd1771c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD1771C, "NEC uPD1771C 017", tag, owner, clock, "upd1771c", __FILE__), + device_sound_interface(mconfig, *this), + m_ack_handler(*this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd1771c_device::device_start() +{ + /* resolve callbacks */ + m_ack_handler.resolve_safe(); + + m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd1771c_device::ack_callback),this)); + + m_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 4); + + save_item(NAME(m_packet)); + save_item(NAME(m_index)); + save_item(NAME(m_expected_bytes)); + save_item(NAME(m_state)); + save_item(NAME(m_pc3)); + save_item(NAME(m_t_timbre)); + save_item(NAME(m_t_offset)); + save_item(NAME(m_t_period)); + save_item(NAME(m_t_volume)); + save_item(NAME(m_t_tpos)); + save_item(NAME(m_t_ppos)); + save_item(NAME(m_nw_timbre)); + save_item(NAME(m_nw_volume)); + save_item(NAME(m_nw_period)); + save_item(NAME(m_nw_tpos)); + save_item(NAME(m_nw_ppos)); + save_item(NAME(m_n_value)); + save_item(NAME(m_n_volume)); + save_item(NAME(m_n_period)); + save_item(NAME(m_n_ppos)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd1771c_device::device_reset() +{ + m_index = 0; + m_expected_bytes = 0; + m_pc3 = 0; + m_t_tpos = 0; + m_t_ppos = 0; + m_state = 0; + m_nw_tpos = 0; + memset(m_n_value, 0x00, sizeof(m_n_value)); + memset(m_n_ppos, 0x00, sizeof(m_n_ppos)); +} + + + +READ8_MEMBER( upd1771c_device::read ) +{ + return 0x80; // TODO +} + +/* +*************TONE***************** +Tone consists of a wavetable playback mechanism. +Each wavetable is a looping period of 32 samples but can be played with an offset from any point in the table +effectively shrinking the sample loop, thus allowing different pitch "macros ranges" to be played. +This method is rather crude because the spectrum of the sound get heavily altered... +unless that was the intent. + +Tone Write (4 bytes): + +Byte0: 0x02 + +Byte1: 0bTTTOOOOO + MSB 3 bits of Timbre (8 wavetables) + LSB 5 bits offset in the table. + +Byte2: 0bPPPPPPPP + 8bits of clock divider/period + Anything under <= 0x20 give the same value + +Byte3: 0b???VVVVV + MSB 3 bits unknown + LSB 5 bits of "Volume" + + Note: volume is not a volume in a normal sense but some kind + of bit cropping/rounding. +*/ + + +/* +*************NOISE***************** +Noise consists on 4 different components +A weird Wavetable LFSR (for lack of a better term), +and three independent (but equal) low frequency +50/50 pulse wavs. + +The 4 components are mixed in a mysterious way, +a weird ORing with volume having a huge effect. + +Byte0: 0x01 + +Byte1: 0bTTTOOOOO + MSB 3 bits of LFSR Timbre (8 wavetables) + LSB 5 bits ????????? + +Byte2: 0bPPPPPPPP + 8bits of clock divider/period + +Byte3: 0b???VVVVV + MSB 3 bits unknown + LSB 5 bits of "Volume" + + +Byte4: 0bPPPPPPPP Low Freq0 period(if not 0 this periodically resets the Wavetable LFSR) +Byte5: 0bPPPPPPPP Low Freq1 period(if not 0 this periodically resets the Wavetable LFSR) +Byte6: 0bPPPPPPPP Low Freq2 period(if not 0 this periodically resets the Wavetable LFSR) + +Byte7: 0b???VVVVV Low Freq0 volume +Byte8: 0b???VVVVV Low Freq1 volume +Byte9: 0b???VVVVV Low Freq2 volume +*/ + +WRITE8_MEMBER( upd1771c_device::write ) +{ + //if (LOG) + // logerror( "upd1771_w: received byte 0x%02x\n", data ); + + m_ack_handler(0); + + if (m_index < MAX_PACKET_SIZE) + m_packet[m_index++] = data; + else + { + logerror("upd1771_w: received byte 0x%02x overload!\n", data); + return; + } + + switch (m_packet[0]) + { + case 0: + m_state = STATE_SILENCE; + m_index = 0; + //logerror( "upd1771_w: ----------------silence state reset\n"); + break; + + case 1: + if (m_index == 10) + { + m_state = STATE_NOISE; + m_index = 0; + + m_nw_timbre = (m_packet[1] & 0xe0) >> 5; + m_nw_period = ((UINT32)m_packet[2] + 1) << 7; + m_nw_volume = m_packet[3] & 0x1f; + + //very long clocked periods.. used for engine drones + m_n_period[0] = (((UINT32)m_packet[4]) + 1) << 7; + m_n_period[1] = (((UINT32)m_packet[5]) + 1) << 7; + m_n_period[2] = (((UINT32)m_packet[6]) + 1) << 7; + + m_n_volume[0] = m_packet[7] & 0x1f; + m_n_volume[1] = m_packet[8] & 0x1f; + m_n_volume[2] = m_packet[9] & 0x1f; + + //logerror( "upd1771_w: ----------------noise state reset\n"); + } + else + m_timer->adjust(attotime::from_ticks(512, clock())); + break; + + case 2: + if (m_index == 4) + { + //logerror( "upd1771_w: ----------------tone state reset\n"); + m_t_timbre = (m_packet[1] & 0xe0) >> 5; + m_t_offset = (m_packet[1] & 0x1f); + m_t_period = m_packet[2]; + //smaller periods don't all equal to 0x20 + if (m_t_period < 0x20) + m_t_period = 0x20; + + m_t_volume = m_packet[3] & 0x1f; + m_state = STATE_TONE; + m_index = 0; + } + else + m_timer->adjust(attotime::from_ticks(512, clock())); + break; + + case 0x1f: + //6Khz(ish) DIGI playback + + //end capture + if (m_index >= 2 && m_packet[m_index - 2] == 0xfe && m_packet[m_index - 1] == 0x00) + { + //TODO play capture! + m_index = 0; + m_packet[0] = 0; + m_state = STATE_ADPCM; + } + else + m_timer->adjust(attotime::from_ticks(512, clock())); + break; + + //garbage: wipe stack + default: + m_state = STATE_SILENCE; + m_index = 0; + break; + } +} + + +WRITE_LINE_MEMBER( upd1771c_device::pcm_write ) +{ + //RESET upon HIGH + if (state != m_pc3) + { + logerror("upd1771_pc3 change!: state = %d\n", state); + m_index = 0; + m_packet[0] = 0; + } + + m_pc3 = state; +} + + +TIMER_CALLBACK_MEMBER( upd1771c_device::ack_callback ) +{ + m_ack_handler(1); +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void upd1771c_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *buffer = outputs[0]; + + switch (m_state) + { + case STATE_TONE: + //logerror( "upd1771_STATE_TONE samps:%d %d %d %d %d %d\n",(int)samples, + // (int)m_t_timbre,(int)m_t_offset,(int)m_t_volume,(int)m_t_period,(int)m_t_tpos); + + while (--samples >= 0) + { + *buffer++ = (WAVEFORMS[m_t_timbre][m_t_tpos]) * m_t_volume * 2; + + m_t_ppos++; + if (m_t_ppos >= m_t_period) + { + m_t_tpos++; + if (m_t_tpos == 32) + m_t_tpos = m_t_offset; + + m_t_ppos = 0; + } + } + break; + + case STATE_NOISE: + while (--samples >= 0) + { + *buffer = 0; + + //"wavetable-LFSR" component + int wlfsr_val = ((int)noise_tbl[m_nw_tpos]) - 127;//data too wide + + m_nw_ppos++; + if (m_nw_ppos >= m_nw_period) + { + m_nw_tpos++; + if (m_nw_tpos == NOISE_SIZE) + m_nw_tpos = 0; + m_nw_ppos = 0; + } + + //mix in each of the noise's 3 pulse components + char res[3]; + for (int i = 0; i < 3; ++i) + { + res[i] = m_n_value[i] * 127; + m_n_ppos[i]++; + if (m_n_ppos[i] >= m_n_period[i]) + { + m_n_ppos[i] = 0; + m_n_value[i] = !m_n_value[i]; + } + } + //not quite, but close. + *buffer+= ( + (wlfsr_val * m_nw_volume) | + (res[0] * m_n_volume[0]) | + (res[1] * m_n_volume[1]) | + (res[2] * m_n_volume[2]) + ) ; + + buffer++; + } + break; + + default: + //fill buffer with silence + while (--samples >= 0) + { + *buffer++ = 0; + } + break; + } +} diff --git a/src/mame/audio/upd1771.h b/src/mame/audio/upd1771.h new file mode 100644 index 00000000000..e0757757e9c --- /dev/null +++ b/src/mame/audio/upd1771.h @@ -0,0 +1,85 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/********************************************************************** + + NEC uPD1771 + +**********************************************************************/ + +#ifndef __UPD1771_H__ +#define __UPD1771_H__ + +#include "emu.h" + +#define MAX_PACKET_SIZE 0x8000 + +#define MCFG_UPD1771_ACK_HANDLER(_devcb) \ + devcb = &upd1771c_device::set_ack_handler(*device, DEVCB_##_devcb); + + +/*************************************************************************** + MACROS / CONSTANTS +***************************************************************************/ + +class upd1771c_device : public device_t, + public device_sound_interface +{ +public: + upd1771c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~upd1771c_device() {} + + template static devcb_base &set_ack_handler(device_t &device, _Object object) { return downcast(device).m_ack_handler.set_callback(object); } + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + WRITE_LINE_MEMBER( pcm_write ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + // internal state + sound_stream *m_channel; + devcb_write_line m_ack_handler; + emu_timer *m_timer; + + TIMER_CALLBACK_MEMBER(ack_callback); + + UINT8 m_packet[MAX_PACKET_SIZE]; + UINT32 m_index; + UINT8 m_expected_bytes; + + UINT8 m_state;//0:silence, 1 noise, 2 tone + UINT8 m_pc3; + + //tone + UINT8 m_t_timbre; //[0; 7] + UINT8 m_t_offset; //[0; 32] + UINT16 m_t_period; //[0;255] + UINT8 m_t_volume; //[0; 31] + UINT8 m_t_tpos;//timbre pos + UINT16 m_t_ppos;//period pos + + //noise wavetable LFSR + UINT8 m_nw_timbre; //[0; 7] + UINT8 m_nw_volume; //[0; 31] + UINT32 m_nw_period; + UINT32 m_nw_tpos; //timbre pos + UINT32 m_nw_ppos; //period pos + + //noise pulse components + UINT8 m_n_value[3]; //[0;1] + UINT16 m_n_volume[3]; //[0; 31] + UINT32 m_n_period[3]; + UINT32 m_n_ppos[3]; //period pos +}; + +extern const device_type UPD1771C; + + +#endif /* __UPD1771_H__ */ diff --git a/src/mame/audio/vboy.c b/src/mame/audio/vboy.c new file mode 100644 index 00000000000..b808ee8a333 --- /dev/null +++ b/src/mame/audio/vboy.c @@ -0,0 +1,491 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/* + vboy.c - Virtual Boy audio emulation + + By Richard Bannister and Gil Pedersen. + MESS device adaptation by R. Belmont +*/ + +#include "emu.h" +#include "vboy.h" + +// device type definition +const device_type VBOYSND = &device_creator; + +//#define LAME_COMPILER_BUG + +#define SxINT 0x00 +#define SxLRV 0x04 +#define SxFQL 0x08 +#define SxFQH 0x0c +#define SxEV0 0x10 +#define SxEV1 0x14 +#define SxRAM 0x18 + +#define SxINTb 0x400+SxINT +#define SxLRVb 0x400+SxLRV +#define SxFQLb 0x400+SxFQL +#define SxFQHb 0x400+SxFQH +#define SxEV0b 0x400+SxEV0 +#define SxEV1b 0x400+SxEV1 +#define SxRAMb 0x400+SxRAM + +#define S5SWP 0x51c +#define SST0P 0x580 + +static const UINT16 outTbl[64][32] = { + { 0x0000, 0xffe0, 0xffc0, 0xffa0, 0xff80, 0xff60, 0xff40, 0xff20, 0xff00, 0xfee0, 0xfec0, 0xfea0, 0xfe80, 0xfe60, 0xfe40, 0xfe20, + 0xfe00, 0xfde0, 0xfdc0, 0xfda0, 0xfd80, 0xfd60, 0xfd40, 0xfd20, 0xfd00, 0xfce0, 0xfcc0, 0xfca0, 0xfc80, 0xfc60, 0xfc40, 0xfc20}, + { 0x0000, 0xffe1, 0xffc2, 0xffa3, 0xff84, 0xff65, 0xff46, 0xff27, 0xff08, 0xfee9, 0xfeca, 0xfeab, 0xfe8c, 0xfe6d, 0xfe4e, 0xfe2f, + 0xfe10, 0xfdf1, 0xfdd2, 0xfdb3, 0xfd94, 0xfd75, 0xfd56, 0xfd37, 0xfd18, 0xfcf9, 0xfcda, 0xfcbb, 0xfc9c, 0xfc7d, 0xfc5e, 0xfc3f}, + { 0x0000, 0xffe2, 0xffc4, 0xffa6, 0xff88, 0xff6a, 0xff4c, 0xff2e, 0xff10, 0xfef2, 0xfed4, 0xfeb6, 0xfe98, 0xfe7a, 0xfe5c, 0xfe3e, + 0xfe20, 0xfe02, 0xfde4, 0xfdc6, 0xfda8, 0xfd8a, 0xfd6c, 0xfd4e, 0xfd30, 0xfd12, 0xfcf4, 0xfcd6, 0xfcb8, 0xfc9a, 0xfc7c, 0xfc5e}, + { 0x0000, 0xffe3, 0xffc6, 0xffa9, 0xff8c, 0xff6f, 0xff52, 0xff35, 0xff18, 0xfefb, 0xfede, 0xfec1, 0xfea4, 0xfe87, 0xfe6a, 0xfe4d, + 0xfe30, 0xfe13, 0xfdf6, 0xfdd9, 0xfdbc, 0xfd9f, 0xfd82, 0xfd65, 0xfd48, 0xfd2b, 0xfd0e, 0xfcf1, 0xfcd4, 0xfcb7, 0xfc9a, 0xfc7d}, + { 0x0000, 0xffe4, 0xffc8, 0xffac, 0xff90, 0xff74, 0xff58, 0xff3c, 0xff20, 0xff04, 0xfee8, 0xfecc, 0xfeb0, 0xfe94, 0xfe78, 0xfe5c, + 0xfe40, 0xfe24, 0xfe08, 0xfdec, 0xfdd0, 0xfdb4, 0xfd98, 0xfd7c, 0xfd60, 0xfd44, 0xfd28, 0xfd0c, 0xfcf0, 0xfcd4, 0xfcb8, 0xfc9c}, + { 0x0000, 0xffe5, 0xffca, 0xffaf, 0xff94, 0xff79, 0xff5e, 0xff43, 0xff28, 0xff0d, 0xfef2, 0xfed7, 0xfebc, 0xfea1, 0xfe86, 0xfe6b, + 0xfe50, 0xfe35, 0xfe1a, 0xfdff, 0xfde4, 0xfdc9, 0xfdae, 0xfd93, 0xfd78, 0xfd5d, 0xfd42, 0xfd27, 0xfd0c, 0xfcf1, 0xfcd6, 0xfcbb}, + { 0x0000, 0xffe6, 0xffcc, 0xffb2, 0xff98, 0xff7e, 0xff64, 0xff4a, 0xff30, 0xff16, 0xfefc, 0xfee2, 0xfec8, 0xfeae, 0xfe94, 0xfe7a, + 0xfe60, 0xfe46, 0xfe2c, 0xfe12, 0xfdf8, 0xfdde, 0xfdc4, 0xfdaa, 0xfd90, 0xfd76, 0xfd5c, 0xfd42, 0xfd28, 0xfd0e, 0xfcf4, 0xfcda}, + { 0x0000, 0xffe7, 0xffce, 0xffb5, 0xff9c, 0xff83, 0xff6a, 0xff51, 0xff38, 0xff1f, 0xff06, 0xfeed, 0xfed4, 0xfebb, 0xfea2, 0xfe89, + 0xfe70, 0xfe57, 0xfe3e, 0xfe25, 0xfe0c, 0xfdf3, 0xfdda, 0xfdc1, 0xfda8, 0xfd8f, 0xfd76, 0xfd5d, 0xfd44, 0xfd2b, 0xfd12, 0xfcf9}, + { 0x0000, 0xffe8, 0xffd0, 0xffb8, 0xffa0, 0xff88, 0xff70, 0xff58, 0xff40, 0xff28, 0xff10, 0xfef8, 0xfee0, 0xfec8, 0xfeb0, 0xfe98, + 0xfe80, 0xfe68, 0xfe50, 0xfe38, 0xfe20, 0xfe08, 0xfdf0, 0xfdd8, 0xfdc0, 0xfda8, 0xfd90, 0xfd78, 0xfd60, 0xfd48, 0xfd30, 0xfd18}, + { 0x0000, 0xffe9, 0xffd2, 0xffbb, 0xffa4, 0xff8d, 0xff76, 0xff5f, 0xff48, 0xff31, 0xff1a, 0xff03, 0xfeec, 0xfed5, 0xfebe, 0xfea7, + 0xfe90, 0xfe79, 0xfe62, 0xfe4b, 0xfe34, 0xfe1d, 0xfe06, 0xfdef, 0xfdd8, 0xfdc1, 0xfdaa, 0xfd93, 0xfd7c, 0xfd65, 0xfd4e, 0xfd37}, + { 0x0000, 0xffea, 0xffd4, 0xffbe, 0xffa8, 0xff92, 0xff7c, 0xff66, 0xff50, 0xff3a, 0xff24, 0xff0e, 0xfef8, 0xfee2, 0xfecc, 0xfeb6, + 0xfea0, 0xfe8a, 0xfe74, 0xfe5e, 0xfe48, 0xfe32, 0xfe1c, 0xfe06, 0xfdf0, 0xfdda, 0xfdc4, 0xfdae, 0xfd98, 0xfd82, 0xfd6c, 0xfd56}, + { 0x0000, 0xffeb, 0xffd6, 0xffc1, 0xffac, 0xff97, 0xff82, 0xff6d, 0xff58, 0xff43, 0xff2e, 0xff19, 0xff04, 0xfeef, 0xfeda, 0xfec5, + 0xfeb0, 0xfe9b, 0xfe86, 0xfe71, 0xfe5c, 0xfe47, 0xfe32, 0xfe1d, 0xfe08, 0xfdf3, 0xfdde, 0xfdc9, 0xfdb4, 0xfd9f, 0xfd8a, 0xfd75}, + { 0x0000, 0xffec, 0xffd8, 0xffc4, 0xffb0, 0xff9c, 0xff88, 0xff74, 0xff60, 0xff4c, 0xff38, 0xff24, 0xff10, 0xfefc, 0xfee8, 0xfed4, + 0xfec0, 0xfeac, 0xfe98, 0xfe84, 0xfe70, 0xfe5c, 0xfe48, 0xfe34, 0xfe20, 0xfe0c, 0xfdf8, 0xfde4, 0xfdd0, 0xfdbc, 0xfda8, 0xfd94}, + { 0x0000, 0xffed, 0xffda, 0xffc7, 0xffb4, 0xffa1, 0xff8e, 0xff7b, 0xff68, 0xff55, 0xff42, 0xff2f, 0xff1c, 0xff09, 0xfef6, 0xfee3, + 0xfed0, 0xfebd, 0xfeaa, 0xfe97, 0xfe84, 0xfe71, 0xfe5e, 0xfe4b, 0xfe38, 0xfe25, 0xfe12, 0xfdff, 0xfdec, 0xfdd9, 0xfdc6, 0xfdb3}, + { 0x0000, 0xffee, 0xffdc, 0xffca, 0xffb8, 0xffa6, 0xff94, 0xff82, 0xff70, 0xff5e, 0xff4c, 0xff3a, 0xff28, 0xff16, 0xff04, 0xfef2, + 0xfee0, 0xfece, 0xfebc, 0xfeaa, 0xfe98, 0xfe86, 0xfe74, 0xfe62, 0xfe50, 0xfe3e, 0xfe2c, 0xfe1a, 0xfe08, 0xfdf6, 0xfde4, 0xfdd2}, + { 0x0000, 0xffef, 0xffde, 0xffcd, 0xffbc, 0xffab, 0xff9a, 0xff89, 0xff78, 0xff67, 0xff56, 0xff45, 0xff34, 0xff23, 0xff12, 0xff01, + 0xfef0, 0xfedf, 0xfece, 0xfebd, 0xfeac, 0xfe9b, 0xfe8a, 0xfe79, 0xfe68, 0xfe57, 0xfe46, 0xfe35, 0xfe24, 0xfe13, 0xfe02, 0xfdf1}, + { 0x0000, 0xfff0, 0xffe0, 0xffd0, 0xffc0, 0xffb0, 0xffa0, 0xff90, 0xff80, 0xff70, 0xff60, 0xff50, 0xff40, 0xff30, 0xff20, 0xff10, + 0xff00, 0xfef0, 0xfee0, 0xfed0, 0xfec0, 0xfeb0, 0xfea0, 0xfe90, 0xfe80, 0xfe70, 0xfe60, 0xfe50, 0xfe40, 0xfe30, 0xfe20, 0xfe10}, + { 0x0000, 0xfff1, 0xffe2, 0xffd3, 0xffc4, 0xffb5, 0xffa6, 0xff97, 0xff88, 0xff79, 0xff6a, 0xff5b, 0xff4c, 0xff3d, 0xff2e, 0xff1f, + 0xff10, 0xff01, 0xfef2, 0xfee3, 0xfed4, 0xfec5, 0xfeb6, 0xfea7, 0xfe98, 0xfe89, 0xfe7a, 0xfe6b, 0xfe5c, 0xfe4d, 0xfe3e, 0xfe2f}, + { 0x0000, 0xfff2, 0xffe4, 0xffd6, 0xffc8, 0xffba, 0xffac, 0xff9e, 0xff90, 0xff82, 0xff74, 0xff66, 0xff58, 0xff4a, 0xff3c, 0xff2e, + 0xff20, 0xff12, 0xff04, 0xfef6, 0xfee8, 0xfeda, 0xfecc, 0xfebe, 0xfeb0, 0xfea2, 0xfe94, 0xfe86, 0xfe78, 0xfe6a, 0xfe5c, 0xfe4e}, + { 0x0000, 0xfff3, 0xffe6, 0xffd9, 0xffcc, 0xffbf, 0xffb2, 0xffa5, 0xff98, 0xff8b, 0xff7e, 0xff71, 0xff64, 0xff57, 0xff4a, 0xff3d, + 0xff30, 0xff23, 0xff16, 0xff09, 0xfefc, 0xfeef, 0xfee2, 0xfed5, 0xfec8, 0xfebb, 0xfeae, 0xfea1, 0xfe94, 0xfe87, 0xfe7a, 0xfe6d}, + { 0x0000, 0xfff4, 0xffe8, 0xffdc, 0xffd0, 0xffc4, 0xffb8, 0xffac, 0xffa0, 0xff94, 0xff88, 0xff7c, 0xff70, 0xff64, 0xff58, 0xff4c, + 0xff40, 0xff34, 0xff28, 0xff1c, 0xff10, 0xff04, 0xfef8, 0xfeec, 0xfee0, 0xfed4, 0xfec8, 0xfebc, 0xfeb0, 0xfea4, 0xfe98, 0xfe8c}, + { 0x0000, 0xfff5, 0xffea, 0xffdf, 0xffd4, 0xffc9, 0xffbe, 0xffb3, 0xffa8, 0xff9d, 0xff92, 0xff87, 0xff7c, 0xff71, 0xff66, 0xff5b, + 0xff50, 0xff45, 0xff3a, 0xff2f, 0xff24, 0xff19, 0xff0e, 0xff03, 0xfef8, 0xfeed, 0xfee2, 0xfed7, 0xfecc, 0xfec1, 0xfeb6, 0xfeab}, + { 0x0000, 0xfff6, 0xffec, 0xffe2, 0xffd8, 0xffce, 0xffc4, 0xffba, 0xffb0, 0xffa6, 0xff9c, 0xff92, 0xff88, 0xff7e, 0xff74, 0xff6a, + 0xff60, 0xff56, 0xff4c, 0xff42, 0xff38, 0xff2e, 0xff24, 0xff1a, 0xff10, 0xff06, 0xfefc, 0xfef2, 0xfee8, 0xfede, 0xfed4, 0xfeca}, + { 0x0000, 0xfff7, 0xffee, 0xffe5, 0xffdc, 0xffd3, 0xffca, 0xffc1, 0xffb8, 0xffaf, 0xffa6, 0xff9d, 0xff94, 0xff8b, 0xff82, 0xff79, + 0xff70, 0xff67, 0xff5e, 0xff55, 0xff4c, 0xff43, 0xff3a, 0xff31, 0xff28, 0xff1f, 0xff16, 0xff0d, 0xff04, 0xfefb, 0xfef2, 0xfee9}, + { 0x0000, 0xfff8, 0xfff0, 0xffe8, 0xffe0, 0xffd8, 0xffd0, 0xffc8, 0xffc0, 0xffb8, 0xffb0, 0xffa8, 0xffa0, 0xff98, 0xff90, 0xff88, + 0xff80, 0xff78, 0xff70, 0xff68, 0xff60, 0xff58, 0xff50, 0xff48, 0xff40, 0xff38, 0xff30, 0xff28, 0xff20, 0xff18, 0xff10, 0xff08}, + { 0x0000, 0xfff9, 0xfff2, 0xffeb, 0xffe4, 0xffdd, 0xffd6, 0xffcf, 0xffc8, 0xffc1, 0xffba, 0xffb3, 0xffac, 0xffa5, 0xff9e, 0xff97, + 0xff90, 0xff89, 0xff82, 0xff7b, 0xff74, 0xff6d, 0xff66, 0xff5f, 0xff58, 0xff51, 0xff4a, 0xff43, 0xff3c, 0xff35, 0xff2e, 0xff27}, + { 0x0000, 0xfffa, 0xfff4, 0xffee, 0xffe8, 0xffe2, 0xffdc, 0xffd6, 0xffd0, 0xffca, 0xffc4, 0xffbe, 0xffb8, 0xffb2, 0xffac, 0xffa6, + 0xffa0, 0xff9a, 0xff94, 0xff8e, 0xff88, 0xff82, 0xff7c, 0xff76, 0xff70, 0xff6a, 0xff64, 0xff5e, 0xff58, 0xff52, 0xff4c, 0xff46}, + { 0x0000, 0xfffb, 0xfff6, 0xfff1, 0xffec, 0xffe7, 0xffe2, 0xffdd, 0xffd8, 0xffd3, 0xffce, 0xffc9, 0xffc4, 0xffbf, 0xffba, 0xffb5, + 0xffb0, 0xffab, 0xffa6, 0xffa1, 0xff9c, 0xff97, 0xff92, 0xff8d, 0xff88, 0xff83, 0xff7e, 0xff79, 0xff74, 0xff6f, 0xff6a, 0xff65}, + { 0x0000, 0xfffc, 0xfff8, 0xfff4, 0xfff0, 0xffec, 0xffe8, 0xffe4, 0xffe0, 0xffdc, 0xffd8, 0xffd4, 0xffd0, 0xffcc, 0xffc8, 0xffc4, + 0xffc0, 0xffbc, 0xffb8, 0xffb4, 0xffb0, 0xffac, 0xffa8, 0xffa4, 0xffa0, 0xff9c, 0xff98, 0xff94, 0xff90, 0xff8c, 0xff88, 0xff84}, + { 0x0000, 0xfffd, 0xfffa, 0xfff7, 0xfff4, 0xfff1, 0xffee, 0xffeb, 0xffe8, 0xffe5, 0xffe2, 0xffdf, 0xffdc, 0xffd9, 0xffd6, 0xffd3, + 0xffd0, 0xffcd, 0xffca, 0xffc7, 0xffc4, 0xffc1, 0xffbe, 0xffbb, 0xffb8, 0xffb5, 0xffb2, 0xffaf, 0xffac, 0xffa9, 0xffa6, 0xffa3}, + { 0x0000, 0xfffe, 0xfffc, 0xfffa, 0xfff8, 0xfff6, 0xfff4, 0xfff2, 0xfff0, 0xffee, 0xffec, 0xffea, 0xffe8, 0xffe6, 0xffe4, 0xffe2, + 0xffe0, 0xffde, 0xffdc, 0xffda, 0xffd8, 0xffd6, 0xffd4, 0xffd2, 0xffd0, 0xffce, 0xffcc, 0xffca, 0xffc8, 0xffc6, 0xffc4, 0xffc2}, + { 0x0000, 0xffff, 0xfffe, 0xfffd, 0xfffc, 0xfffb, 0xfffa, 0xfff9, 0xfff8, 0xfff7, 0xfff6, 0xfff5, 0xfff4, 0xfff3, 0xfff2, 0xfff1, + 0xfff0, 0xffef, 0xffee, 0xffed, 0xffec, 0xffeb, 0xffea, 0xffe9, 0xffe8, 0xffe7, 0xffe6, 0xffe5, 0xffe4, 0xffe3, 0xffe2, 0xffe1}, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f}, + { 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, 0x0010, 0x0012, 0x0014, 0x0016, 0x0018, 0x001a, 0x001c, 0x001e, + 0x0020, 0x0022, 0x0024, 0x0026, 0x0028, 0x002a, 0x002c, 0x002e, 0x0030, 0x0032, 0x0034, 0x0036, 0x0038, 0x003a, 0x003c, 0x003e}, + { 0x0000, 0x0003, 0x0006, 0x0009, 0x000c, 0x000f, 0x0012, 0x0015, 0x0018, 0x001b, 0x001e, 0x0021, 0x0024, 0x0027, 0x002a, 0x002d, + 0x0030, 0x0033, 0x0036, 0x0039, 0x003c, 0x003f, 0x0042, 0x0045, 0x0048, 0x004b, 0x004e, 0x0051, 0x0054, 0x0057, 0x005a, 0x005d}, + { 0x0000, 0x0004, 0x0008, 0x000c, 0x0010, 0x0014, 0x0018, 0x001c, 0x0020, 0x0024, 0x0028, 0x002c, 0x0030, 0x0034, 0x0038, 0x003c, + 0x0040, 0x0044, 0x0048, 0x004c, 0x0050, 0x0054, 0x0058, 0x005c, 0x0060, 0x0064, 0x0068, 0x006c, 0x0070, 0x0074, 0x0078, 0x007c}, + { 0x0000, 0x0005, 0x000a, 0x000f, 0x0014, 0x0019, 0x001e, 0x0023, 0x0028, 0x002d, 0x0032, 0x0037, 0x003c, 0x0041, 0x0046, 0x004b, + 0x0050, 0x0055, 0x005a, 0x005f, 0x0064, 0x0069, 0x006e, 0x0073, 0x0078, 0x007d, 0x0082, 0x0087, 0x008c, 0x0091, 0x0096, 0x009b}, + { 0x0000, 0x0006, 0x000c, 0x0012, 0x0018, 0x001e, 0x0024, 0x002a, 0x0030, 0x0036, 0x003c, 0x0042, 0x0048, 0x004e, 0x0054, 0x005a, + 0x0060, 0x0066, 0x006c, 0x0072, 0x0078, 0x007e, 0x0084, 0x008a, 0x0090, 0x0096, 0x009c, 0x00a2, 0x00a8, 0x00ae, 0x00b4, 0x00ba}, + { 0x0000, 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x002a, 0x0031, 0x0038, 0x003f, 0x0046, 0x004d, 0x0054, 0x005b, 0x0062, 0x0069, + 0x0070, 0x0077, 0x007e, 0x0085, 0x008c, 0x0093, 0x009a, 0x00a1, 0x00a8, 0x00af, 0x00b6, 0x00bd, 0x00c4, 0x00cb, 0x00d2, 0x00d9}, + { 0x0000, 0x0008, 0x0010, 0x0018, 0x0020, 0x0028, 0x0030, 0x0038, 0x0040, 0x0048, 0x0050, 0x0058, 0x0060, 0x0068, 0x0070, 0x0078, + 0x0080, 0x0088, 0x0090, 0x0098, 0x00a0, 0x00a8, 0x00b0, 0x00b8, 0x00c0, 0x00c8, 0x00d0, 0x00d8, 0x00e0, 0x00e8, 0x00f0, 0x00f8}, + { 0x0000, 0x0009, 0x0012, 0x001b, 0x0024, 0x002d, 0x0036, 0x003f, 0x0048, 0x0051, 0x005a, 0x0063, 0x006c, 0x0075, 0x007e, 0x0087, + 0x0090, 0x0099, 0x00a2, 0x00ab, 0x00b4, 0x00bd, 0x00c6, 0x00cf, 0x00d8, 0x00e1, 0x00ea, 0x00f3, 0x00fc, 0x0105, 0x010e, 0x0117}, + { 0x0000, 0x000a, 0x0014, 0x001e, 0x0028, 0x0032, 0x003c, 0x0046, 0x0050, 0x005a, 0x0064, 0x006e, 0x0078, 0x0082, 0x008c, 0x0096, + 0x00a0, 0x00aa, 0x00b4, 0x00be, 0x00c8, 0x00d2, 0x00dc, 0x00e6, 0x00f0, 0x00fa, 0x0104, 0x010e, 0x0118, 0x0122, 0x012c, 0x0136}, + { 0x0000, 0x000b, 0x0016, 0x0021, 0x002c, 0x0037, 0x0042, 0x004d, 0x0058, 0x0063, 0x006e, 0x0079, 0x0084, 0x008f, 0x009a, 0x00a5, + 0x00b0, 0x00bb, 0x00c6, 0x00d1, 0x00dc, 0x00e7, 0x00f2, 0x00fd, 0x0108, 0x0113, 0x011e, 0x0129, 0x0134, 0x013f, 0x014a, 0x0155}, + { 0x0000, 0x000c, 0x0018, 0x0024, 0x0030, 0x003c, 0x0048, 0x0054, 0x0060, 0x006c, 0x0078, 0x0084, 0x0090, 0x009c, 0x00a8, 0x00b4, + 0x00c0, 0x00cc, 0x00d8, 0x00e4, 0x00f0, 0x00fc, 0x0108, 0x0114, 0x0120, 0x012c, 0x0138, 0x0144, 0x0150, 0x015c, 0x0168, 0x0174}, + { 0x0000, 0x000d, 0x001a, 0x0027, 0x0034, 0x0041, 0x004e, 0x005b, 0x0068, 0x0075, 0x0082, 0x008f, 0x009c, 0x00a9, 0x00b6, 0x00c3, + 0x00d0, 0x00dd, 0x00ea, 0x00f7, 0x0104, 0x0111, 0x011e, 0x012b, 0x0138, 0x0145, 0x0152, 0x015f, 0x016c, 0x0179, 0x0186, 0x0193}, + { 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, + 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2}, + { 0x0000, 0x000f, 0x001e, 0x002d, 0x003c, 0x004b, 0x005a, 0x0069, 0x0078, 0x0087, 0x0096, 0x00a5, 0x00b4, 0x00c3, 0x00d2, 0x00e1, + 0x00f0, 0x00ff, 0x010e, 0x011d, 0x012c, 0x013b, 0x014a, 0x0159, 0x0168, 0x0177, 0x0186, 0x0195, 0x01a4, 0x01b3, 0x01c2, 0x01d1}, + { 0x0000, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050, 0x0060, 0x0070, 0x0080, 0x0090, 0x00a0, 0x00b0, 0x00c0, 0x00d0, 0x00e0, 0x00f0, + 0x0100, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0170, 0x0180, 0x0190, 0x01a0, 0x01b0, 0x01c0, 0x01d0, 0x01e0, 0x01f0}, + { 0x0000, 0x0011, 0x0022, 0x0033, 0x0044, 0x0055, 0x0066, 0x0077, 0x0088, 0x0099, 0x00aa, 0x00bb, 0x00cc, 0x00dd, 0x00ee, 0x00ff, + 0x0110, 0x0121, 0x0132, 0x0143, 0x0154, 0x0165, 0x0176, 0x0187, 0x0198, 0x01a9, 0x01ba, 0x01cb, 0x01dc, 0x01ed, 0x01fe, 0x020f}, + { 0x0000, 0x0012, 0x0024, 0x0036, 0x0048, 0x005a, 0x006c, 0x007e, 0x0090, 0x00a2, 0x00b4, 0x00c6, 0x00d8, 0x00ea, 0x00fc, 0x010e, + 0x0120, 0x0132, 0x0144, 0x0156, 0x0168, 0x017a, 0x018c, 0x019e, 0x01b0, 0x01c2, 0x01d4, 0x01e6, 0x01f8, 0x020a, 0x021c, 0x022e}, + { 0x0000, 0x0013, 0x0026, 0x0039, 0x004c, 0x005f, 0x0072, 0x0085, 0x0098, 0x00ab, 0x00be, 0x00d1, 0x00e4, 0x00f7, 0x010a, 0x011d, + 0x0130, 0x0143, 0x0156, 0x0169, 0x017c, 0x018f, 0x01a2, 0x01b5, 0x01c8, 0x01db, 0x01ee, 0x0201, 0x0214, 0x0227, 0x023a, 0x024d}, + { 0x0000, 0x0014, 0x0028, 0x003c, 0x0050, 0x0064, 0x0078, 0x008c, 0x00a0, 0x00b4, 0x00c8, 0x00dc, 0x00f0, 0x0104, 0x0118, 0x012c, + 0x0140, 0x0154, 0x0168, 0x017c, 0x0190, 0x01a4, 0x01b8, 0x01cc, 0x01e0, 0x01f4, 0x0208, 0x021c, 0x0230, 0x0244, 0x0258, 0x026c}, + { 0x0000, 0x0015, 0x002a, 0x003f, 0x0054, 0x0069, 0x007e, 0x0093, 0x00a8, 0x00bd, 0x00d2, 0x00e7, 0x00fc, 0x0111, 0x0126, 0x013b, + 0x0150, 0x0165, 0x017a, 0x018f, 0x01a4, 0x01b9, 0x01ce, 0x01e3, 0x01f8, 0x020d, 0x0222, 0x0237, 0x024c, 0x0261, 0x0276, 0x028b}, + { 0x0000, 0x0016, 0x002c, 0x0042, 0x0058, 0x006e, 0x0084, 0x009a, 0x00b0, 0x00c6, 0x00dc, 0x00f2, 0x0108, 0x011e, 0x0134, 0x014a, + 0x0160, 0x0176, 0x018c, 0x01a2, 0x01b8, 0x01ce, 0x01e4, 0x01fa, 0x0210, 0x0226, 0x023c, 0x0252, 0x0268, 0x027e, 0x0294, 0x02aa}, + { 0x0000, 0x0017, 0x002e, 0x0045, 0x005c, 0x0073, 0x008a, 0x00a1, 0x00b8, 0x00cf, 0x00e6, 0x00fd, 0x0114, 0x012b, 0x0142, 0x0159, + 0x0170, 0x0187, 0x019e, 0x01b5, 0x01cc, 0x01e3, 0x01fa, 0x0211, 0x0228, 0x023f, 0x0256, 0x026d, 0x0284, 0x029b, 0x02b2, 0x02c9}, + { 0x0000, 0x0018, 0x0030, 0x0048, 0x0060, 0x0078, 0x0090, 0x00a8, 0x00c0, 0x00d8, 0x00f0, 0x0108, 0x0120, 0x0138, 0x0150, 0x0168, + 0x0180, 0x0198, 0x01b0, 0x01c8, 0x01e0, 0x01f8, 0x0210, 0x0228, 0x0240, 0x0258, 0x0270, 0x0288, 0x02a0, 0x02b8, 0x02d0, 0x02e8}, + { 0x0000, 0x0019, 0x0032, 0x004b, 0x0064, 0x007d, 0x0096, 0x00af, 0x00c8, 0x00e1, 0x00fa, 0x0113, 0x012c, 0x0145, 0x015e, 0x0177, + 0x0190, 0x01a9, 0x01c2, 0x01db, 0x01f4, 0x020d, 0x0226, 0x023f, 0x0258, 0x0271, 0x028a, 0x02a3, 0x02bc, 0x02d5, 0x02ee, 0x0307}, + { 0x0000, 0x001a, 0x0034, 0x004e, 0x0068, 0x0082, 0x009c, 0x00b6, 0x00d0, 0x00ea, 0x0104, 0x011e, 0x0138, 0x0152, 0x016c, 0x0186, + 0x01a0, 0x01ba, 0x01d4, 0x01ee, 0x0208, 0x0222, 0x023c, 0x0256, 0x0270, 0x028a, 0x02a4, 0x02be, 0x02d8, 0x02f2, 0x030c, 0x0326}, + { 0x0000, 0x001b, 0x0036, 0x0051, 0x006c, 0x0087, 0x00a2, 0x00bd, 0x00d8, 0x00f3, 0x010e, 0x0129, 0x0144, 0x015f, 0x017a, 0x0195, + 0x01b0, 0x01cb, 0x01e6, 0x0201, 0x021c, 0x0237, 0x0252, 0x026d, 0x0288, 0x02a3, 0x02be, 0x02d9, 0x02f4, 0x030f, 0x032a, 0x0345}, + { 0x0000, 0x001c, 0x0038, 0x0054, 0x0070, 0x008c, 0x00a8, 0x00c4, 0x00e0, 0x00fc, 0x0118, 0x0134, 0x0150, 0x016c, 0x0188, 0x01a4, + 0x01c0, 0x01dc, 0x01f8, 0x0214, 0x0230, 0x024c, 0x0268, 0x0284, 0x02a0, 0x02bc, 0x02d8, 0x02f4, 0x0310, 0x032c, 0x0348, 0x0364}, + { 0x0000, 0x001d, 0x003a, 0x0057, 0x0074, 0x0091, 0x00ae, 0x00cb, 0x00e8, 0x0105, 0x0122, 0x013f, 0x015c, 0x0179, 0x0196, 0x01b3, + 0x01d0, 0x01ed, 0x020a, 0x0227, 0x0244, 0x0261, 0x027e, 0x029b, 0x02b8, 0x02d5, 0x02f2, 0x030f, 0x032c, 0x0349, 0x0366, 0x0383}, + { 0x0000, 0x001e, 0x003c, 0x005a, 0x0078, 0x0096, 0x00b4, 0x00d2, 0x00f0, 0x010e, 0x012c, 0x014a, 0x0168, 0x0186, 0x01a4, 0x01c2, + 0x01e0, 0x01fe, 0x021c, 0x023a, 0x0258, 0x0276, 0x0294, 0x02b2, 0x02d0, 0x02ee, 0x030c, 0x032a, 0x0348, 0x0366, 0x0384, 0x03a2}, + { 0x0000, 0x001f, 0x003e, 0x005d, 0x007c, 0x009b, 0x00ba, 0x00d9, 0x00f8, 0x0117, 0x0136, 0x0155, 0x0174, 0x0193, 0x01b2, 0x01d1, + 0x01f0, 0x020f, 0x022e, 0x024d, 0x026c, 0x028b, 0x02aa, 0x02c9, 0x02e8, 0x0307, 0x0326, 0x0345, 0x0364, 0x0383, 0x03a2, 0x03c1} +}; + +static const INT8 outLvlTbl[16][16] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2}, + { 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4}, + { 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6}, + { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8}, + { 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10}, + { 0, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12}, + { 0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 8, 10, 11, 12, 13, 14}, + { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, + { 0, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17}, + { 0, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19}, + { 0, 2, 3, 5, 6, 7, 9, 10, 12, 13, 14, 16, 17, 18, 20, 21}, + { 0, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23}, + { 0, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 18, 20, 22, 23, 25}, + { 0, 2, 4, 6, 8, 9, 11, 13, 15, 16, 18, 20, 22, 23, 25, 27}, + { 0, 2, 4, 6, 8, 10, 12, 14, 16, 17, 19, 21, 23, 25, 27, 29} +}; + +INLINE UINT8 mgetb(register UINT8 *ptr) { return *ptr; } +INLINE void mputb(UINT8 *ptr, INT8 data) { *ptr = data; } + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// vboysnd_device - constructor +//------------------------------------------------- + +vboysnd_device::vboysnd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VBOYSND, "Virtual Boy audio", tag, owner, clock, "vboysnd", __FILE__), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vboysnd_device::device_start() +{ + int i; + + // create the stream + m_stream = machine().sound().stream_alloc(*this, 0, 2, AUDIO_FREQ); + + for (i=0; i<2048; i++) + waveFreq2LenTbl[i] = AUDIO_FREQ / (5000000.0f/(float)((2048-i) * 32)); + for (i=0; i<32; i++) + waveTimer2LenTbl[i] = ((0.00384f*(float)(i+1)) * (float)AUDIO_FREQ); + for (i=0; i<8; i++) + waveEnv2LenTbl[i] = ((0.01536f*(float)(i+1)) * (float)AUDIO_FREQ); + + for (i = 0; i < 5; i++) + memset(&snd_channel[i], 0, sizeof(s_snd_channel)); + + memset(m_aram, 0, 0x600); + + m_timer = timer_alloc(0, NULL); + m_timer->adjust(attotime::zero, 0, attotime::from_hz(AUDIO_FREQ/4)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void vboysnd_device::device_reset() +{ + m_stream->update(); + + int i; + + for (i=0; i<4; i++) + snd_channel[i].playing = false; +} + +//------------------------------------------------- +// device_timer - called when our device timer expires +//------------------------------------------------- + +void vboysnd_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +{ + m_stream->update(); +} + +//------------------------------------------------- +// sound_stream_update - handle update requests for +// our sound stream +//------------------------------------------------- + +void vboysnd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *outL, *outR; + int len, i, j, channel; + + outL = outputs[0]; + outR = outputs[1]; + + len = samples; + +// if (mgetb(m_aram+SST0P) & 0x1) // Sound Stop Reg +// goto end; + + for (channel=0; channel<5; channel++) + { + float size; + int k = 0, waveAddr; + + i = channel * 0x40; + snd_channel[channel].sample_len = waveFreq2LenTbl[((mgetb(m_aram+SxFQHb+i) & 0x7) << 8) | mgetb(m_aram+SxFQLb+i)]; + waveAddr = (mgetb(m_aram + SxRAMb + i) & 0x3) << 7; + + size = (float)snd_channel[channel].sample_len / 32.0f; + for (j=0; j<32;) + { + INT8 byte = mgetb(m_aram + waveAddr + (j++ << 2)) & 0x3f; +// INT8 nbyte = mgetb(m_aram + waveAddr + (j << 2)) & 0x3f; + int end = (int)(((float)j)*size); + float val, add; + + val = (float)byte; + add = /*(nbyte-byte)/(end-k)*/ 0.0; // no interpolation + + for (; kplaying) + continue; + + outLeft = outLvlTbl[channel->volLeft][channel->envelope]; + outRight = outLvlTbl[channel->volRight][channel->envelope]; +// env1 = ((UINT8)mgetb(m_aram+SxEV1b+i*0x40)); + if (channel->env1 & 0x01) + { + channel->env_time++; + +// env0 = ((UINT8)mgetb(m_aram+SxEV0b+i*0x40)); + if (channel->env_time >= channel->env_steptime /*waveEnv2LenTbl[env0 & 0x7]*/) + { + // it's time for a step + channel->env_time = 0; + if (channel->env0 & 0x08) + { + // step up + channel->envelope++; + if (channel->envelope >= 0xf) + { + if (channel->env1 & 0x02) channel->envelope = channel->env0 >> 4; + else { channel->env1 &= ~0x01; channel->envelope = 0xf; } + } + } + else + { + // step down + channel->envelope--; + if (channel->envelope <= 0) + { + if (channel->env1 & 0x02) channel->envelope = channel->env0 >> 4; + else { channel->env1 &= ~0x01; channel->envelope = 0x0; } + } + } + } + } + + outTblPtr = (INT16 *) outTbl[channel->sample[channel->offset]]; + if (outLeft) note_left += outTblPtr[outLeft ]; + if (outRight) note_right += outTblPtr[outRight]; + channel->offset++; + + if (channel->offset >= channel->sample_len) + channel->offset = 0; + + if (channel->time > 0) + { + channel->time--; + if (channel->time <= 0) + channel->playing = false; + } + } + + + // scale to 16 bits + note_left = (note_left << 5) | ((note_left >> 6) & 0x1f); + note_right = (note_right << 5) | ((note_right >> 6) & 0x1f); + if (note_left < -32767) note_left = -32767; if (note_left > 32767) note_left = 32767; + if (note_right < -32767) note_right = -32767; if (note_right > 32767) note_right = 32767; + + *(outL++) = ((INT16)note_left); + *(outR++) = ((INT16)note_right); + } +} + +//------------------------------------------------- +// read - read from the chip's registers and internal RAM +//------------------------------------------------- + +READ8_MEMBER( vboysnd_device::read ) +{ + m_stream->update(); + return m_aram[offset]; +} + +//------------------------------------------------- +// write - write to the chip's registers and internal RAM +//------------------------------------------------- + +WRITE8_MEMBER( vboysnd_device::write ) +{ + int freq, i; +// int waveAddr; + int volReg, intervalReg; + int channel, ouroffs; + + mputb((UINT8 *)m_aram+offset, data); + if (offset < 0x400) + return; + + channel = (offset-0x400) >> 6; + ouroffs = offset & 0x3f; + + ///process_sound(cpu.vcount); + + if (channel == 6 && ouroffs == 0) + { + if (mgetb(m_aram+SST0P) & 0x1) + for (i=0; i<4; i++) + snd_channel[i].playing = 0; + return; + } + + // Extract frequencies and build the wave for the first 4 sound sources + i = channel * 0x40; + switch (ouroffs) + { + case SxLRV: + if (channel < 5) + { + volReg = mgetb(m_aram + SxLRVb + i); // 6-4-4 - L/R output level setting + if (snd_channel[channel].playing) + { + snd_channel[channel].volLeft = ((UINT8)volReg) >> 4; + snd_channel[channel].volRight = ((UINT8)volReg) & 0xf; + break; + } + } + case SxINT: + if (channel < 5) + { + UINT8 env0, env1; + // find out if the sound is playing + intervalReg = mgetb(m_aram + SxINTb + i); // 6-4-6 - Sound Interval + volReg = mgetb(m_aram + SxLRVb + i); // 6-4-4 - L/R output level setting + + if (((intervalReg & 0x80) == 0) || (volReg == 0)) + { + snd_channel[channel].playing = false; + return; + } + snd_channel[channel].playing = true; + + // 6-4-1 - Waveform address comes from SxRAM. +// waveAddr = (mgetb(m_aram + SxRAMb + i) & 0x3) << 7; + + // 6-4-15 - Frequency comes from here + freq = ((mgetb(m_aram+SxFQHb+i) & 0x7) << 8) | mgetb(m_aram+SxFQLb+i); + + env0 = mgetb(m_aram+SxEV0b+i); env1 = mgetb(m_aram+SxEV1b+i); + snd_channel[channel].env0 = env0; + snd_channel[channel].env1 = env1; + snd_channel[channel].volLeft = ((UINT8)volReg) >> 4; + snd_channel[channel].volRight = ((UINT8)volReg) & 0xf; + snd_channel[channel].env_steptime = (env1 & 0x1) ? waveEnv2LenTbl[env0 & 0x7] : 0; + snd_channel[channel].sample_len = waveFreq2LenTbl[freq]; + + snd_channel[channel].offset = 0; + snd_channel[channel].time = (intervalReg & 0x20) ? waveTimer2LenTbl[intervalReg & 0x1f] : 0; + snd_channel[channel].envelope = ((UINT8)mgetb(m_aram+SxEV0b+i)) >> 4; + snd_channel[channel].env_time = 0; + } + else + { + intervalReg = mgetb(m_aram + SxINTb + i); // 6-4-6 - Sound Interval + volReg = mgetb(m_aram + SxLRVb + i); // 6-4-4 - L/R output level setting + + if (((intervalReg & 0x80) == 0) || (volReg == 0)) + { +// snd_channel[channel].playing = false; + return; + } +// Debugger(); // uses white noise +// snd_channel[channel].playing = true; + } + break; + + case SxEV0: + if (channel < 5) + if (snd_channel[channel].playing) + snd_channel[channel].envelope = ((UINT8)mgetb(m_aram+SxEV0b+i)) >> 4; + break; + } +} diff --git a/src/mame/audio/vboy.h b/src/mame/audio/vboy.h new file mode 100644 index 00000000000..8849ecf292e --- /dev/null +++ b/src/mame/audio/vboy.h @@ -0,0 +1,108 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/* + vboy.h - Virtual Boy audio emulation + + By Richard Bannister and Gil Pedersen. + MESS device adaptation by R. Belmont +*/ + +#pragma once + +#ifndef __VBOY_SND_H__ +#define __VBOY_SND_H__ + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define AUDIO_FREQ 44100 +#define CHANNELS 4 + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_VBOYSND_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, VBOYSND, AUDIO_FREQ) + +#define MCFG_VBOYSND_REPLACE(_tag) \ + MCFG_DEVICE_REPLACE(_tag, VBOYSND, AUDIO_FREQ) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +struct s_snd_channel { + INT8 playing; // the sound is playing + + // state when sound was enabled + UINT32 env_steptime; // Envelope step time + UINT8 env0; // Envelope data + UINT8 env1; // Envelope data + UINT8 volLeft; // Left output volume + UINT8 volRight; // Right output volume + UINT8 sample[580]; // sample to play + int sample_len; // length of sample + + // values that change, as the sample is played + int offset; // current offset in sample + int time; // the duration that this sample is to be played + UINT8 envelope; // Current envelope level (604) + int env_time; // The duration between envelope decay/grow (608) +}; + +struct s_regchan { + INT32 sINT; + INT32 sLRV; + INT32 sFQL; + INT32 sFQH; + INT32 sEV0; + INT32 sEV1; + INT32 sRAM; +}; + +struct s_sreg { + // Sound registers structure + s_regchan c[4]; +}; + +// ======================> vboysnd_device + +class vboysnd_device : public device_t, public device_sound_interface +{ +public: + // construction/destruction + vboysnd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER(read); + DECLARE_WRITE8_MEMBER(write); + + sound_stream *m_stream; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + + // inline data + s_sreg sound_registers(void); + + s_snd_channel snd_channel[5]; + + UINT16 waveFreq2LenTbl[2048]; + UINT16 waveTimer2LenTbl[32]; + UINT16 waveEnv2LenTbl[8]; + + emu_timer *m_timer; + + UINT8 m_aram[0x600]; +}; + +// device type definition +extern const device_type VBOYSND; + +#endif //__VBOY_SND_H__ diff --git a/src/mame/audio/vc4000snd.c b/src/mame/audio/vc4000snd.c new file mode 100644 index 00000000000..00b33d308ae --- /dev/null +++ b/src/mame/audio/vc4000snd.c @@ -0,0 +1,74 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/*************************************************************************** + + PeT mess@utanet.at + main part in video/ + +***************************************************************************/ + +#include "vc4000snd.h" + + +const device_type VC4000_SND = &device_creator; + +vc4000_sound_device::vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VC4000_SND, "Intertion Electronic VC 4000 Audio Custom", tag, owner, clock, "vc4000_sound", __FILE__), + device_sound_interface(mconfig, *this), + m_channel(NULL), + m_size(0), + m_pos(0), + m_level(0) +{ + memset(m_reg, 0, sizeof(UINT8)*1); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vc4000_sound_device::device_start() +{ + m_channel = stream_alloc(0, 1, machine().sample_rate()); +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void vc4000_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + int i; + stream_sample_t *buffer = outputs[0]; + + for (i = 0; i < samples; i++, buffer++) + { + *buffer = 0; + if (m_reg[0] && m_pos <= m_size / 2) + { + *buffer = 0x7fff; + } + if (m_pos <= m_size) + m_pos++; + if (m_pos > m_size) + m_pos = 0; + } +} + + +void vc4000_sound_device::soundport_w(int offset, int data) +{ + m_channel->update(); + m_reg[offset] = data; + switch (offset) + { + case 0: + m_pos = 0; + m_level = TRUE; + // frequency 7874/(data+1) + m_size = machine().sample_rate() * (data + 1) /7874; + break; + } +} diff --git a/src/mame/audio/vc4000snd.h b/src/mame/audio/vc4000snd.h new file mode 100644 index 00000000000..611ad0188d8 --- /dev/null +++ b/src/mame/audio/vc4000snd.h @@ -0,0 +1,47 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/vc4000snd.h + * + ****************************************************************************/ + +#ifndef _VC4000SND_H_ +#define _VC4000SND_H_ + +#include "emu.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> vc4000_sound_device + +class vc4000_sound_device : public device_t, + public device_sound_interface +{ +public: + vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vc4000_sound_device() { } + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +public: + void soundport_w(int mode, int data); + +private: + sound_stream *m_channel; + UINT8 m_reg[1]; + int m_size; + int m_pos; + unsigned m_level; +}; + +extern const device_type VC4000_SND; + +#endif /* _VC4000SND_H_ */ diff --git a/src/mame/audio/wswan_snd.c b/src/mame/audio/wswan_snd.c new file mode 100644 index 00000000000..77a21d7cb3b --- /dev/null +++ b/src/mame/audio/wswan_snd.c @@ -0,0 +1,374 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/************************************************************************************** + + Wonderswan sound emulation + + Wilbert Pol + + Sound emulation is preliminary and not complete + + +The noise taps and behavior are the same as the Virtual Boy. + +**************************************************************************************/ + +#include "wswan_snd.h" + + +// device type definition +const device_type WSWAN_SND = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// wswan_sound_device - constructor +//------------------------------------------------- + +wswan_sound_device::wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, WSWAN_SND, "WonderSwan Audio Custom", tag, owner, clock, "wswan_sound", __FILE__), + device_sound_interface(mconfig, *this), + m_channel(NULL), + m_sweep_step(0), + m_sweep_time(0), + m_sweep_count(0), + m_noise_type(0), + m_noise_reset(0), + m_noise_enable(0), + m_sample_address(0), + m_audio2_voice(0), + m_audio3_sweep(0), + m_audio4_noise(0), + m_mono(0), + m_voice_data(0), + m_output_volume(0), + m_external_stereo(0), + m_external_speaker(0), + m_noise_shift(0), + m_master_volume(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void wswan_sound_device::device_start() +{ + m_channel = stream_alloc(0, 2, machine().sample_rate()); + + save_item(NAME(m_sweep_step)); + save_item(NAME(m_sweep_time)); + save_item(NAME(m_sweep_count)); + save_item(NAME(m_noise_type)); + save_item(NAME(m_noise_reset)); + save_item(NAME(m_noise_enable)); + save_item(NAME(m_sample_address)); + save_item(NAME(m_audio2_voice)); + save_item(NAME(m_audio3_sweep)); + save_item(NAME(m_audio4_noise)); + save_item(NAME(m_mono)); + save_item(NAME(m_voice_data)); + save_item(NAME(m_output_volume)); + save_item(NAME(m_external_stereo)); + save_item(NAME(m_external_speaker)); + save_item(NAME(m_noise_shift)); + save_item(NAME(m_master_volume)); + + save_item(NAME(m_audio1.freq)); + save_item(NAME(m_audio1.period)); + save_item(NAME(m_audio1.pos)); + save_item(NAME(m_audio1.vol_left)); + save_item(NAME(m_audio1.vol_right)); + save_item(NAME(m_audio1.on)); + save_item(NAME(m_audio1.signal)); + + save_item(NAME(m_audio2.freq)); + save_item(NAME(m_audio2.period)); + save_item(NAME(m_audio2.pos)); + save_item(NAME(m_audio2.vol_left)); + save_item(NAME(m_audio2.vol_right)); + save_item(NAME(m_audio2.on)); + save_item(NAME(m_audio2.signal)); + + save_item(NAME(m_audio3.freq)); + save_item(NAME(m_audio3.period)); + save_item(NAME(m_audio3.pos)); + save_item(NAME(m_audio3.vol_left)); + save_item(NAME(m_audio3.vol_right)); + save_item(NAME(m_audio3.on)); + save_item(NAME(m_audio3.signal)); + + save_item(NAME(m_audio4.freq)); + save_item(NAME(m_audio4.period)); + save_item(NAME(m_audio4.pos)); + save_item(NAME(m_audio4.vol_left)); + save_item(NAME(m_audio4.vol_right)); + save_item(NAME(m_audio4.on)); + save_item(NAME(m_audio4.signal)); +} + + +//------------------------------------------------- +// device_reset +//------------------------------------------------- + +void wswan_sound_device::device_reset() +{ + m_audio1.on = 0; + m_audio1.signal = 16; + m_audio1.pos = 0; + m_audio2.on = 0; + m_audio2.signal = 16; + m_audio2.pos = 0; + m_audio3.on = 0; + m_audio3.signal = 16; + m_audio3.pos = 0; + m_audio4.on = 0; + m_audio4.signal = 16; + m_audio4.pos = 0; +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void wswan_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t sample, left, right; + + while( samples-- > 0 ) + { + left = right = 0; + + if ( m_audio1.on ) + { + sample = m_audio1.signal; + m_audio1.pos++; + if ( m_audio1.pos >= m_audio1.period / 2 ) + { + m_audio1.pos = 0; + m_audio1.signal = -m_audio1.signal; + } + left += m_audio1.vol_left * sample; + right += m_audio1.vol_right * sample; + } + + if ( m_audio2.on ) + { + if ( m_audio2_voice ) + { + left += (m_voice_data - 128)*(m_master_volume & 0x0f); + right += (m_voice_data - 128)*(m_master_volume & 0x0f); + } + else + { + sample = m_audio2.signal; + m_audio2.pos++; + if ( m_audio2.pos >= m_audio2.period / 2 ) + { + m_audio2.pos = 0; + m_audio2.signal = -m_audio2.signal; + } + left += m_audio2.vol_left * sample; + right += m_audio2.vol_right * sample; + } + } + + if ( m_audio3.on ) + { + sample = m_audio3.signal; + m_audio3.pos++; + if ( m_audio3.pos >= m_audio3.period / 2 ) + { + m_audio3.pos = 0; + m_audio3.signal = -m_audio3.signal; + } + if ( m_audio3_sweep && m_sweep_time ) + { + m_sweep_count++; + if ( m_sweep_count >= m_sweep_time ) + { + m_sweep_count = 0; + m_audio3.freq += m_sweep_step; + m_audio3.period = machine().sample_rate() / (3072000 / ((2048 - (m_audio3.freq & 0x7ff)) << 5)); + } + } + left += m_audio3.vol_left * sample; + right += m_audio3.vol_right * sample; + } + + if ( m_audio4.on ) + { + sample = m_audio4.signal; + m_audio4.pos++; + if ( m_audio4.pos >= m_audio4.period / 2 ) + { + m_audio4.signal = -m_audio4.signal; + m_audio4.pos = 0; + + if (m_noise_enable) + { + UINT16 new_bit = 0; + + if (m_noise_type == 0) + { + new_bit = (m_noise_shift ^ (m_noise_shift >> 5) ^ (m_noise_shift >> 8)) & 1; + } + else + { + static int shift_bit[] = { 0, 10, 13, 4, 8, 6, 9, 11 }; + + new_bit = (1 ^ (m_noise_shift >> 7) ^ (m_noise_shift >> shift_bit[m_noise_type])) & 1; + } + m_noise_shift = (m_noise_shift << 1) | new_bit; + + if (m_audio4_noise) + { + m_audio4.signal = (m_noise_shift & 0x8000) ? 16 : -16; + } + + m_noise_shift &= 0x7fff; + + if (m_noise_shift == 0x7fff) + { + m_noise_shift = (m_noise_type == 0) ? 0x80 : 0; + } + } + } + left += m_audio4.vol_left * sample; + right += m_audio4.vol_right * sample; + } + + left <<= 5; + right <<= 5; + + *(outputs[0]++) = left; + *(outputs[1]++) = right; + } +} + + +void wswan_sound_device::wswan_ch_set_freq( CHAN *ch, UINT16 freq ) +{ + freq &= 0x7ff; // docs say freq is 11bits and a few games (Morita Shougi, World Stadium + others) write 0x800 causing a divide by 0 crash + ch->freq = freq; + ch->period = machine().sample_rate() / (3072000 / ((2048 - freq) << 5)); +} + +WRITE8_MEMBER( wswan_sound_device::port_w ) +{ + m_channel->update(); + + switch( offset ) + { + case 0x80: /* Audio 1 freq (lo) */ + wswan_ch_set_freq(&m_audio1, (m_audio1.freq & 0xff00) | data); + break; + + case 0x81: /* Audio 1 freq (hi) */ + wswan_ch_set_freq(&m_audio1, (data << 8 ) | (m_audio1.freq & 0x00ff)); + break; + + case 0x82: /* Audio 2 freq (lo) */ + wswan_ch_set_freq(&m_audio2, (m_audio2.freq & 0xff00) | data); + break; + + case 0x83: /* Audio 2 freq (hi) */ + wswan_ch_set_freq(&m_audio2, (data << 8 ) | (m_audio2.freq & 0x00ff)); + break; + + case 0x84: /* Audio 3 freq (lo) */ + wswan_ch_set_freq(&m_audio3, (m_audio3.freq & 0xff00) | data); + break; + + case 0x85: /* Audio 3 freq (hi) */ + wswan_ch_set_freq(&m_audio3, (data << 8) | (m_audio3.freq & 0x00ff)); + break; + + case 0x86: /* Audio 4 freq (lo) */ + wswan_ch_set_freq(&m_audio4, (m_audio4.freq & 0xff00) | data); + break; + + case 0x87: /* Audio 4 freq (hi) */ + wswan_ch_set_freq(&m_audio4, (data << 8) | (m_audio4.freq & 0x00ff)); + break; + + case 0x88: /* Audio 1 volume */ + m_audio1.vol_left = ( data & 0xF0 ) >> 4; + m_audio1.vol_right = data & 0x0F; + break; + + case 0x89: /* Audio 2 volume */ + m_voice_data = data; + m_audio2.vol_left = ( data & 0xF0 ) >> 4; + m_audio2.vol_right = data & 0x0F; + break; + + case 0x8A: /* Audio 3 volume */ + m_audio3.vol_left = ( data & 0xF0 ) >> 4; + m_audio3.vol_right = data & 0x0F; + break; + + case 0x8B: /* Audio 4 volume */ + m_audio4.vol_left = ( data & 0xF0 ) >> 4; + m_audio4.vol_right = data & 0x0F; + break; + + case 0x8C: /* Sweep step */ + m_sweep_step = (INT8)data; + break; + + case 0x8D: /* Sweep time */ + m_sweep_time = space.machine().sample_rate() / ( 3072000 / ( 8192 * (data + 1) ) ); + break; + + case 0x8E: /* Noise control */ + m_noise_type = data & 0x07; + m_noise_reset = ( data & 0x08 ) >> 3; + m_noise_enable = ( data & 0x10 ) >> 4; + if (m_noise_reset) + { + m_noise_shift = (m_noise_type == 0) ? 0x80 : 0; + } + break; + + case 0x8F: /* Sample location */ + m_sample_address = data << 6; + break; + + case 0x90: /* Audio control */ + m_audio1.on = data & 0x01; + m_audio2.on = ( data & 0x02 ) >> 1; + m_audio3.on = ( data & 0x04 ) >> 2; + m_audio4.on = ( data & 0x08 ) >> 3; + m_audio2_voice = ( data & 0x20 ) >> 5; + m_audio3_sweep = ( data & 0x40 ) >> 6; + m_audio4_noise = ( data & 0x80 ) >> 7; + break; + + case 0x91: /* Audio output */ + m_mono = data & 0x01; + m_output_volume = ( data & 0x06 ) >> 1; + m_external_stereo = ( data & 0x08 ) >> 3; + m_external_speaker = 1; + break; + + case 0x92: /* Noise counter shift register (lo) */ + m_noise_shift = ( m_noise_shift & 0xFF00 ) | data; + break; + + case 0x93: /* Noise counter shift register (hi) */ + m_noise_shift = ( ( data & 0x7f ) << 8 ) | ( m_noise_shift & 0x00FF ); + break; + + case 0x94: /* Master volume */ + m_master_volume = data; + break; + } +} diff --git a/src/mame/audio/wswan_snd.h b/src/mame/audio/wswan_snd.h new file mode 100644 index 00000000000..42ba3ed5160 --- /dev/null +++ b/src/mame/audio/wswan_snd.h @@ -0,0 +1,91 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/***************************************************************************** + * + * includes/wswan_snd.h + * + ****************************************************************************/ + +#pragma once + +#ifndef _WSWAN_SND_H_ +#define _WSWAN_SND_H_ + +#include "emu.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +struct CHAN +{ + CHAN() : + freq(0), + period(0), + pos(0), + vol_left(0), + vol_right(0), + on(0), + signal(0) { } + + UINT16 freq; /* frequency */ + UINT32 period; /* period */ + UINT32 pos; /* position */ + UINT8 vol_left; /* volume left */ + UINT8 vol_right; /* volume right */ + UINT8 on; /* on/off */ + INT8 signal; /* signal */ +}; + + +// ======================> wswan_sound_device + +class wswan_sound_device : public device_t, + public device_sound_interface +{ +public: + wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~wswan_sound_device() { } + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +public: + DECLARE_WRITE8_MEMBER( port_w ); + +private: + void wswan_ch_set_freq( CHAN *ch, UINT16 freq ); + +private: + sound_stream *m_channel; + CHAN m_audio1; /* Audio channel 1 */ + CHAN m_audio2; /* Audio channel 2 */ + CHAN m_audio3; /* Audio channel 3 */ + CHAN m_audio4; /* Audio channel 4 */ + INT8 m_sweep_step; /* Sweep step */ + UINT32 m_sweep_time; /* Sweep time */ + UINT32 m_sweep_count; /* Sweep counter */ + UINT8 m_noise_type; /* Noise generator type */ + UINT8 m_noise_reset; /* Noise reset */ + UINT8 m_noise_enable; /* Noise enable */ + UINT16 m_sample_address; /* Sample address */ + UINT8 m_audio2_voice; /* Audio 2 voice */ + UINT8 m_audio3_sweep; /* Audio 3 sweep */ + UINT8 m_audio4_noise; /* Audio 4 noise */ + UINT8 m_mono; /* mono */ + UINT8 m_voice_data; /* voice data */ + UINT8 m_output_volume; /* output volume */ + UINT8 m_external_stereo; /* external stereo */ + UINT8 m_external_speaker; /* external speaker */ + UINT16 m_noise_shift; /* Noise counter shift register */ + UINT8 m_master_volume; /* Master volume */ +}; + +extern const device_type WSWAN_SND; + +#endif diff --git a/src/mame/drivers/4004clk.c b/src/mame/drivers/4004clk.c new file mode 100644 index 00000000000..0d750822b7c --- /dev/null +++ b/src/mame/drivers/4004clk.c @@ -0,0 +1,193 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + 4004 Nixie Clock + + 03/08/2009 Initial driver + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i4004/i4004.h" +#include "sound/dac.h" +#include "4004clk.lh" + +class nixieclock_state : public driver_device +{ +public: + nixieclock_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dac(*this, "dac"), + m_input(*this, "INPUT") + { } + + required_device m_maincpu; + required_device m_dac; + required_ioport m_input; + DECLARE_READ8_MEMBER( data_r ); + DECLARE_WRITE8_MEMBER( nixie_w ); + DECLARE_WRITE8_MEMBER( neon_w ); + DECLARE_WRITE8_MEMBER( relays_w ); + UINT16 m_nixie[16]; + UINT8 m_timer; + virtual void machine_start(); + TIMER_DEVICE_CALLBACK_MEMBER(timer_callback); + UINT8 nixie_to_num(UINT16 val); + inline void output_set_nixie_value(int index, int value); + inline void output_set_neon_value(int index, int value); +}; + +READ8_MEMBER(nixieclock_state::data_r) +{ + return m_input->read() & 0x0f; +} + +UINT8 nixieclock_state::nixie_to_num(UINT16 val) +{ + if (BIT(val,0)) return 0; + if (BIT(val,1)) return 1; + if (BIT(val,2)) return 2; + if (BIT(val,3)) return 3; + if (BIT(val,4)) return 4; + if (BIT(val,5)) return 5; + if (BIT(val,6)) return 6; + if (BIT(val,7)) return 7; + if (BIT(val,8)) return 8; + if (BIT(val,9)) return 9; + return 10; +} + +inline void nixieclock_state::output_set_nixie_value(int index, int value) +{ + output_set_indexed_value("nixie", index, value); +} + +inline void nixieclock_state::output_set_neon_value(int index, int value) +{ + output_set_indexed_value("neon", index, value); +} + +WRITE8_MEMBER(nixieclock_state::nixie_w) +{ + m_nixie[offset] = data; + output_set_nixie_value(5,nixie_to_num(((m_nixie[2] & 3)<<8) | (m_nixie[1] << 4) | m_nixie[0])); + output_set_nixie_value(4,nixie_to_num((m_nixie[4] << 6) | (m_nixie[3] << 2) | (m_nixie[2] >>2))); + output_set_nixie_value(3,nixie_to_num(((m_nixie[7] & 3)<<8) | (m_nixie[6] << 4) | m_nixie[5])); + output_set_nixie_value(2,nixie_to_num((m_nixie[9] << 6) | (m_nixie[8] << 2) | (m_nixie[7] >>2))); + output_set_nixie_value(1,nixie_to_num(((m_nixie[12] & 3)<<8) | (m_nixie[11] << 4) | m_nixie[10])); + output_set_nixie_value(0,nixie_to_num((m_nixie[14] << 6) | (m_nixie[13] << 2) | (m_nixie[12] >>2))); +} + +WRITE8_MEMBER(nixieclock_state::neon_w) +{ + output_set_neon_value(0,BIT(data,3)); + output_set_neon_value(1,BIT(data,2)); + output_set_neon_value(2,BIT(data,1)); + output_set_neon_value(3,BIT(data,0)); +} + +WRITE8_MEMBER(nixieclock_state::relays_w) +{ + m_dac->write_unsigned8((data & 1) ? 0x80 : 0x40); //tick - tock +} + +static ADDRESS_MAP_START(4004clk_rom, AS_PROGRAM, 8, nixieclock_state) + AM_RANGE(0x0000, 0x0FFF) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(4004clk_mem, AS_DATA, 8, nixieclock_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x007F) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( 4004clk_io, AS_IO, 8, nixieclock_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x0e) AM_WRITE(nixie_w) + AM_RANGE(0x00, 0x00) AM_READ(data_r) + AM_RANGE(0x0f, 0x0f) AM_WRITE(neon_w) + AM_RANGE(0x10, 0x10) AM_WRITE(relays_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( 4004clk ) + PORT_START("INPUT") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Browse") PORT_CODE(KEYCODE_2) + + PORT_CONFNAME( 0x04, 0x00, "Tick-Tock") + PORT_CONFSETTING( 0x00, "ON" ) + PORT_CONFSETTING( 0x04, "OFF" ) + PORT_CONFNAME( 0x08, 0x08, "50/60 Hz") + PORT_CONFSETTING( 0x00, "50 Hz" ) + PORT_CONFSETTING( 0x08, "60 Hz" ) +INPUT_PORTS_END + +/* + 16ms Int generator + __ __ + _| |_| + 0 1 0 1 + +*/ + +TIMER_DEVICE_CALLBACK_MEMBER(nixieclock_state::timer_callback) +{ + m_maincpu->set_test(m_timer); + m_timer^=1; +} + +void nixieclock_state::machine_start() +{ + m_timer = 0; + + /* register for state saving */ + save_item(NAME(m_timer)); + save_pointer(NAME(m_nixie), 6); +} + +static MACHINE_CONFIG_START( 4004clk, nixieclock_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I4004, XTAL_5MHz / 8) + MCFG_CPU_PROGRAM_MAP(4004clk_rom) + MCFG_CPU_DATA_MAP(4004clk_mem) + MCFG_CPU_IO_MAP(4004clk_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_4004clk) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("4004clk_timer", nixieclock_state, timer_callback, attotime::from_hz(120)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( 4004clk ) + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "clock.u30", 0x0000, 0x0100, CRC(3d8608a5) SHA1(47fa0a91779e1afc34592f91068f8af2e74593d4)) + ROM_LOAD( "clock.u31", 0x0100, 0x0100, CRC(c83af4bc) SHA1(c8bd7ff1322e5ad280364ed87fc9e2ed38120c21)) + ROM_LOAD( "clock.u32", 0x0200, 0x0100, CRC(72442ae7) SHA1(dc25269cf9db7a9e70a86fededeb01efecf80fe7)) + ROM_LOAD( "clock.u33", 0x0300, 0x0100, CRC(74789383) SHA1(ca5ef2c42dae1761599ead56498fb0bfa0db80a5)) + ROM_LOAD( "clock.u34", 0x0400, 0x0100, CRC(d817cc54) SHA1(a54e744465dde20d37ba54bf2bdb1c4708235f9a)) + ROM_LOAD( "clock.u35", 0x0500, 0x0100, CRC(ece36d21) SHA1(c8cf7e08e90463e910ed2d21d8e562e73d7e0b08)) + ROM_LOAD( "clock.u36", 0x0600, 0x0100, CRC(65aa3cb1) SHA1(9b134bd46747a1bccc004c347b3162e9dc846426)) + ROM_LOAD( "clock.u37", 0x0700, 0x0100, CRC(4c2a2632) SHA1(5f75c2d67571ffcfb98f37944f7f4bc7f531c109)) + ROM_LOAD( "clock.u38", 0x0800, 0x0100, CRC(133da0d6) SHA1(08863a287471c0e77f27cea087cb4a3b372d49c1)) + ROM_LOAD( "clock.u39", 0x0900, 0x0100, CRC(0628593c) SHA1(34249753056cd425e0d48c188c830d64464006c9)) + ROM_LOAD( "clock.u40", 0x0A00, 0x0100, CRC(1c2e94b5) SHA1(89e6c70b936fd9882a229de671dcada7c39b9e8e)) + ROM_LOAD( "clock.u41", 0x0B00, 0x0100, CRC(48b4510d) SHA1(17c5eedc36b469bfae23e204c614ccc01bd4df02)) + ROM_LOAD( "clock.u42", 0x0C00, 0x0100, CRC(4b768675) SHA1(8862b9911bd5907e679539c1e98921f0686b8a76)) + ROM_LOAD( "clock.u43", 0x0D00, 0x0100, CRC(df8db80f) SHA1(34ef8e9ae9fd4e88659e1e14759a2baf1cf589a5)) + ROM_LOAD( "clock.u44", 0x0E00, 0x0100, CRC(23037c71) SHA1(87702bdf5985fa58d4cabcc0d4530e229bfebcbb)) + ROM_LOAD( "clock.u45", 0x0F00, 0x0100, CRC(a8d419ef) SHA1(86742a5ad410c027e9cf9a95e2006dc1128715e5)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +SYST( 2008, 4004clk, 0, 0, 4004clk, 4004clk, driver_device, 0, "John L. Weinrich", "4004 Nixie Clock", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/68ksbc.c b/src/mame/drivers/68ksbc.c new file mode 100644 index 00000000000..2ff1bc85cac --- /dev/null +++ b/src/mame/drivers/68ksbc.c @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Skeleton driver for 68k Single Board Computer + + 29/03/2011 + + http://www.kmitl.ac.th/~kswichit/68k/68k.html + + TODO: + - Add RTC (type DS12887) + + All of the address and i/o decoding is done by a pair of XC9536 + mask-programmed custom devices. + + There are some chips used for unclear purposes (GPI, GPO, LCD). + + This computer has no sound, and no facility for saving or loading programs. + + When started, press ? key for a list of commands. + + Has 1MB of flash (which is actually just 12k of program), + and 1MB of RAM. Memory map should probably be corrected. + + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "machine/6850acia.h" +#include "machine/clock.h" + + +class c68ksbc_state : public driver_device +{ +public: + c68ksbc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_acia(*this, "acia") + { + } + + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + +private: + required_device m_maincpu; + required_device m_acia; +}; + +static ADDRESS_MAP_START(c68ksbc_mem, AS_PROGRAM, 16, c68ksbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x002fff) AM_ROM + AM_RANGE(0x003000, 0x5fffff) AM_RAM + AM_RANGE(0x600000, 0x600001) AM_DEVREADWRITE8("acia", acia6850_device, status_r, control_w, 0x00ff) + AM_RANGE(0x600002, 0x600003) AM_DEVREADWRITE8("acia", acia6850_device, data_r, data_w, 0x00ff) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( c68ksbc ) +INPUT_PORTS_END + + +WRITE_LINE_MEMBER(c68ksbc_state::write_acia_clock) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + +static MACHINE_CONFIG_START( c68ksbc, c68ksbc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 8000000) // text says 8MHz, schematic says 10MHz + MCFG_CPU_PROGRAM_MAP(c68ksbc_mem) + + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(c68ksbc_state, write_acia_clock)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( 68ksbc ) + ROM_REGION(0x1000000, "maincpu", 0) + ROM_LOAD( "t68k.bin", 0x0000, 0x2f78, CRC(20a8d0d0) SHA1(544fd8bd8ed017115388c8b0f7a7a59a32253e43) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 2002, 68ksbc, 0, 0, c68ksbc, c68ksbc, driver_device, 0, "Wichit Sirichote", "68k Single Board Computer", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/a2600.c b/src/mame/drivers/a2600.c new file mode 100644 index 00000000000..cf61e133b62 --- /dev/null +++ b/src/mame/drivers/a2600.c @@ -0,0 +1,552 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Wilbert Pol +/*************************************************************************** + + Atari VCS 2600 driver + +TODO: +- Move the 2 32-in-1 rom dumps into their own driver +- Add 128-in-1 driver + +***************************************************************************/ + +#include "emu.h" +#include "machine/mos6530n.h" +#include "cpu/m6502/m6502.h" +#include "sound/tiaintf.h" +#include "video/tia.h" +#include "bus/vcs/vcs_slot.h" +#include "bus/vcs/rom.h" +#include "bus/vcs/dpc.h" +#include "bus/vcs/scharger.h" +#include "bus/vcs/compumat.h" +#include "bus/vcs_ctrl/ctrl.h" + +#define CONTROL1_TAG "joyport1" +#define CONTROL2_TAG "joyport2" + + +class a2600_state : public driver_device +{ +public: + a2600_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_riot_ram(*this, "riot_ram"), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG) , + m_cart(*this, "cartslot"), + m_tia(*this, "tia_video"), + m_maincpu(*this, "maincpu"), + m_screen(*this, "screen"), + m_swb(*this, "SWB") + { } + + required_shared_ptr m_riot_ram; + UINT16 m_current_screen_height; + + DECLARE_MACHINE_START(a2600); + DECLARE_WRITE8_MEMBER(switch_A_w); + DECLARE_READ8_MEMBER(switch_A_r); + DECLARE_WRITE8_MEMBER(switch_B_w); + DECLARE_WRITE_LINE_MEMBER(irq_callback); + DECLARE_READ8_MEMBER(riot_input_port_8_r); + DECLARE_READ16_MEMBER(a2600_read_input_port); + DECLARE_READ8_MEMBER(a2600_get_databus_contents); + DECLARE_WRITE16_MEMBER(a2600_tia_vsync_callback); + DECLARE_WRITE16_MEMBER(a2600_tia_vsync_callback_pal); + DECLARE_WRITE8_MEMBER(cart_over_tia_w); + // investigate how the carts mapped here (Mapper JVP) interact with the RIOT device + DECLARE_READ8_MEMBER(cart_over_riot_r); + DECLARE_WRITE8_MEMBER(cart_over_riot_w); + +protected: + required_device m_joy1; + required_device m_joy2; + required_device m_cart; + required_device m_tia; + + unsigned long detect_2600controllers(); + required_device m_maincpu; + required_device m_screen; + required_ioport m_swb; +}; + + + +#define MASTER_CLOCK_NTSC 3579545 +#define MASTER_CLOCK_PAL 3546894 +#define CATEGORY_SELECT 16 + +static const UINT16 supported_screen_heights[4] = { 262, 312, 328, 342 }; + + +static ADDRESS_MAP_START(a2600_mem, AS_PROGRAM, 8, a2600_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0f00) AM_DEVREADWRITE("tia_video", tia_video_device, read, write) + AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0d00) AM_RAM AM_SHARE("riot_ram") + AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d00) AM_DEVICE("riot", mos6532_t, io_map) + // AM_RANGE(0x1000, 0x1fff) is cart data and it is configured at reset time, depending on the mounted cart! +ADDRESS_MAP_END + +WRITE8_MEMBER(a2600_state::switch_A_w) +{ + /* Left controller port */ + m_joy1->joy_w( data >> 4 ); + + /* Right controller port */ + m_joy2->joy_w( data & 0x0f ); + +// switch( ioport("CONTROLLERS")->read() % CATEGORY_SELECT ) +// { +// case 0x0a: /* KidVid voice module */ +// m_cassette->change_state(( data & 0x02 ) ? (cassette_state)CASSETTE_MOTOR_DISABLED : (cassette_state)(CASSETTE_MOTOR_ENABLED | CASSETTE_PLAY), (cassette_state)CASSETTE_MOTOR_DISABLED ); +// break; +// } +} + +READ8_MEMBER(a2600_state::switch_A_r) +{ + UINT8 val = 0; + + /* Left controller port PINs 1-4 ( 4321 ) */ + val |= ( m_joy1->joy_r() & 0x0F ) << 4; + + /* Right controller port PINs 1-4 ( 4321 ) */ + val |= m_joy2->joy_r() & 0x0F; + + return val; +} + +WRITE8_MEMBER(a2600_state::switch_B_w) +{ +} + +WRITE_LINE_MEMBER(a2600_state::irq_callback) +{ +} + +READ8_MEMBER(a2600_state::riot_input_port_8_r) +{ + return m_swb->read(); +} + + +READ16_MEMBER(a2600_state::a2600_read_input_port) +{ + switch( offset ) + { + case 0: /* Left controller port PIN 5 */ + return m_joy1->pot_x_r(); + + case 1: /* Left controller port PIN 9 */ + return m_joy1->pot_y_r(); + + case 2: /* Right controller port PIN 5 */ + return m_joy2->pot_x_r(); + + case 3: /* Right controller port PIN 9 */ + return m_joy2->pot_y_r(); + + case 4: /* Left controller port PIN 6 */ + return ( m_joy1->joy_r() & 0x20 ) ? 0xff : 0x7f; + + case 5: /* Right controller port PIN 6 */ + return ( m_joy2->joy_r() & 0x20 ) ? 0xff : 0x7f; + } + return 0xff; +} + +/* There are a few games that do an LDA ($80-$FF),Y instruction. + The contents off the databus then depend on whatever was read + from the RAM. To do this really properly the 6502 core would + need to keep track of the last databus contents so we can query + that. For now this is a quick hack to determine that value anyway. + Examples: + Q-Bert's Qubes (NTSC,F6) at 0x1594 + Berzerk at 0xF093. +*/ +READ8_MEMBER(a2600_state::a2600_get_databus_contents) +{ + UINT16 last_address, prev_address; + UINT8 last_byte, prev_byte; + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + + last_address = m_maincpu->pc() + 1; + if ( ! ( last_address & 0x1080 ) ) + { + return offset; + } + last_byte = prog_space.read_byte(last_address ); + if ( last_byte < 0x80 || last_byte == 0xFF ) + { + return last_byte; + } + prev_address = last_address - 1; + if ( ! ( prev_address & 0x1080 ) ) + { + return last_byte; + } + prev_byte = prog_space.read_byte(prev_address ); + if ( prev_byte == 0xB1 ) + { /* LDA (XX),Y */ + return prog_space.read_byte(last_byte + 1 ); + } + return last_byte; +} + +#if 0 +static const rectangle visarea[4] = { + { 26, 26 + 160 + 16, 24, 24 + 192 + 31 }, /* 262 */ + { 26, 26 + 160 + 16, 32, 32 + 228 + 31 }, /* 312 */ + { 26, 26 + 160 + 16, 45, 45 + 240 + 31 }, /* 328 */ + { 26, 26 + 160 + 16, 48, 48 + 240 + 31 } /* 342 */ +}; +#endif + +WRITE16_MEMBER(a2600_state::a2600_tia_vsync_callback) +{ + int i; + + for ( i = 0; i < ARRAY_LENGTH(supported_screen_heights); i++ ) + { + if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) + { + if ( supported_screen_heights[i] != m_current_screen_height ) + { + m_current_screen_height = supported_screen_heights[i]; +// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * m_current_screen_height ); + } + } + } +} + +WRITE16_MEMBER(a2600_state::a2600_tia_vsync_callback_pal) +{ + int i; + + for ( i = 0; i < ARRAY_LENGTH(supported_screen_heights); i++ ) + { + if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) + { + if ( supported_screen_heights[i] != m_current_screen_height ) + { + m_current_screen_height = supported_screen_heights[i]; +// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * m_current_screen_height ); + } + } + } +} + +// TODO: is this the correct behavior for the real hardware?!? +READ8_MEMBER(a2600_state::cart_over_riot_r) +{ + if (!space.debugger_access()) + m_cart->write_bank(space, offset, 0); + return m_riot_ram[0x20 + offset]; +} + +WRITE8_MEMBER(a2600_state::cart_over_riot_w) +{ + m_cart->write_bank(space, offset, 0); + m_riot_ram[0x20 + offset] = data; + +} + +WRITE8_MEMBER(a2600_state::cart_over_tia_w) +{ + // Both Cart & TIA see these addresses + m_cart->write_bank(space, offset, data); + m_tia->write(space, offset, data); +} + +MACHINE_START_MEMBER(a2600_state,a2600) +{ + m_current_screen_height = m_screen->height(); + memset(m_riot_ram, 0x00, 0x80); + + switch (m_cart->get_cart_type()) + { + case A26_2K: + case A26_4K: + case A26_F4: + case A26_F8: + case A26_F8SW: + case A26_FA: + case A26_E0: + case A26_E7: + case A26_CV: + case A26_DC: + case A26_FV: + case A26_8IN1: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); + break; + case A26_F6: + case A26_DPC: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(vcs_cart_slot_device::cart_opbase),(vcs_cart_slot_device*)m_cart)); + break; + case A26_FE: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_ram),(vcs_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x01fe, 0x01ff, read8_delegate(FUNC(vcs_cart_slot_device::read_bank),(vcs_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x01fe, 0x01fe, write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); + break; + case A26_3E: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_ram),(vcs_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x00, 0x3f, write8_delegate(FUNC(a2600_state::cart_over_tia_w), this)); + break; + case A26_3F: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x00, 0x3f, write8_delegate(FUNC(a2600_state::cart_over_tia_w), this)); + break; + case A26_UA: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x200, 0x27f, read8_delegate(FUNC(vcs_cart_slot_device::read_bank),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); + break; + case A26_JVP: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); + // to verify the actual behavior... + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xfa0, 0xfc0, read8_delegate(FUNC(a2600_state::cart_over_riot_r), this), write8_delegate(FUNC(a2600_state::cart_over_riot_w), this)); + break; + case A26_4IN1: + case A26_32IN1: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); + break; + case A26_SS: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); + break; + case A26_CM: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); + break; + } + + /* Banks may have changed, reset the cpu so it uses the correct reset vector */ + m_maincpu->reset(); + + save_item(NAME(m_current_screen_height)); +} + + +#ifdef UNUSED_FUNCTIONS +// try to detect 2600 controller setup. returns 32bits with left/right controller info +unsigned a2600_state::long detect_2600controllers() +{ +#define JOYS 0x001 +#define PADD 0x002 +#define KEYP 0x004 +#define LGUN 0x008 +#define INDY 0x010 +#define BOOS 0x020 +#define KVID 0x040 +#define CMTE 0x080 +#define MLNK 0x100 +#define AMSE 0x200 +#define CX22 0x400 +#define CX80 0x800 + + unsigned int left,right; + int i,j,foundkeypad = 0; + UINT8 *cart; + static const unsigned char signatures[][5] = { + { 0x55, 0xa5, 0x3c, 0x29, 0}, // star raiders + { 0xf9, 0xff, 0xa5, 0x80, 1}, // sentinel + { 0x81, 0x02, 0xe8, 0x86, 1}, // shooting arcade + { 0x02, 0xa9, 0xec, 0x8d, 1}, // guntest4 tester + { 0x85, 0x2c, 0x85, 0xa7, 2}, // INDY 500 + { 0xa1, 0x8d, 0x9d, 0x02, 2}, // omega race INDY + { 0x65, 0x72, 0x44, 0x43, 2}, // Sprintmaster INDY + { 0x89, 0x8a, 0x99, 0xaa, 3}, // omega race + { 0x9a, 0x8e, 0x81, 0x02, 4}, + { 0xdd, 0x8d, 0x80, 0x02, 4}, + { 0x85, 0x8e, 0x81, 0x02, 4}, + { 0x8d, 0x81, 0x02, 0xe6, 4}, + { 0xff, 0x8d, 0x81, 0x02, 4}, + { 0xa9, 0x03, 0x8d, 0x81, 5}, + { 0xa9, 0x73, 0x8d, 0x80, 6}, + // { 0x82, 0x02, 0x85, 0x8f, 7}, // Mind Maze (really Mind Link??) + { 0xa9, 0x30, 0x8d, 0x80, 7}, // Bionic Breakthrough + { 0x02, 0x8e, 0x81, 0x02, 7}, // Telepathy + { 0x41, 0x6d, 0x69, 0x67, 9}, // Missile Command Amiga Mouse + { 0x43, 0x58, 0x2d, 0x32, 10}, // Missile Command CX22 TrackBall + { 0x43, 0x58, 0x2d, 0x38, 11}, // Missile Command CX80 TrackBall + { 0x4e, 0xa8, 0xa4, 0xa2, 12}, // Omega Race for Joystick ONLY + { 0xa6, 0xef, 0xb5, 0x38, 8} // Warlords.. paddles ONLY + }; + // start with this.. if anyone finds a game that does NOT work with both controllers enabled + // it can be fixed here with a new signature (note that the Coleco Gemini has this setup also) + left = JOYS+PADD; right = JOYS+PADD; + // default for bad dumps and roms too large to have special controllers + if ((m_cart_size > 0x4000) || (m_cart_size & 0x7ff)) return (left << 16) + right; + + cart = CART; + for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++) + { + for (j = 0; j < (sizeof signatures/sizeof signatures[0]); j++) + { + if (!memcmp(&cart[i], &signatures[j],sizeof signatures[0] - 1)) + { + int k = signatures[j][4]; + if (k == 0) return (JOYS << 16) + KEYP; + if (k == 1) return (LGUN << 16); + if (k == 2) return (INDY << 16) + INDY; + if (k == 3) return (BOOS << 16) + BOOS; + if (k == 5) return (JOYS << 16) + KVID; + if (k == 6) return (CMTE << 16) + CMTE; + if (k == 7) return (MLNK << 16) + MLNK; + if (k == 8) return (PADD << 16) + PADD; + if (k == 9) return (AMSE << 16) + AMSE; + if (k == 10) return (CX22 << 16) + CX22; + if (k == 11) return (CX80 << 16) + CX80; + if (k == 12) return (JOYS << 16) + JOYS; + if (k == 4) foundkeypad = 1; + } + } + } + if (foundkeypad) return (KEYP << 16) + KEYP; + return (left << 16) + right; +} +#endif + + +static INPUT_PORTS_START( a2600 ) + PORT_START("SWB") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Reset Game") PORT_CODE(KEYCODE_2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Select Game") PORT_CODE(KEYCODE_1) + PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x08, 0x08, "TV Type" ) PORT_CODE(KEYCODE_C) PORT_TOGGLE + PORT_DIPSETTING( 0x08, "Color" ) + PORT_DIPSETTING( 0x00, "B&W" ) + PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x40, 0x00, "Left Diff. Switch" ) PORT_CODE(KEYCODE_3) PORT_TOGGLE + PORT_DIPSETTING( 0x40, "A" ) + PORT_DIPSETTING( 0x00, "B" ) + PORT_DIPNAME( 0x80, 0x00, "Right Diff. Switch" ) PORT_CODE(KEYCODE_4) PORT_TOGGLE + PORT_DIPSETTING( 0x80, "A" ) + PORT_DIPSETTING( 0x00, "B" ) +INPUT_PORTS_END + + +static SLOT_INTERFACE_START(a2600_cart) + SLOT_INTERFACE_INTERNAL("a26_2k", A26_ROM_2K) + SLOT_INTERFACE_INTERNAL("a26_4k", A26_ROM_4K) + SLOT_INTERFACE_INTERNAL("a26_f4", A26_ROM_F4) + SLOT_INTERFACE_INTERNAL("a26_f6", A26_ROM_F6) + SLOT_INTERFACE_INTERNAL("a26_f8", A26_ROM_F8) + SLOT_INTERFACE_INTERNAL("a26_f8sw", A26_ROM_F8_SW) + SLOT_INTERFACE_INTERNAL("a26_fa", A26_ROM_FA) + SLOT_INTERFACE_INTERNAL("a26_fe", A26_ROM_FE) + SLOT_INTERFACE_INTERNAL("a26_3e", A26_ROM_3E) + SLOT_INTERFACE_INTERNAL("a26_3f", A26_ROM_3F) + SLOT_INTERFACE_INTERNAL("a26_e0", A26_ROM_E0) + SLOT_INTERFACE_INTERNAL("a26_e7", A26_ROM_E7) + SLOT_INTERFACE_INTERNAL("a26_ua", A26_ROM_UA) + SLOT_INTERFACE_INTERNAL("a26_cv", A26_ROM_CV) + SLOT_INTERFACE_INTERNAL("a26_dc", A26_ROM_DC) + SLOT_INTERFACE_INTERNAL("a26_fv", A26_ROM_FV) + SLOT_INTERFACE_INTERNAL("a26_jvp", A26_ROM_JVP) + SLOT_INTERFACE_INTERNAL("a26_cm", A26_ROM_COMPUMATE) + SLOT_INTERFACE_INTERNAL("a26_ss", A26_ROM_SUPERCHARGER) + SLOT_INTERFACE_INTERNAL("a26_dpc", A26_ROM_DPC) + SLOT_INTERFACE_INTERNAL("a26_4in1", A26_ROM_4IN1) + SLOT_INTERFACE_INTERNAL("a26_8in1", A26_ROM_8IN1) + SLOT_INTERFACE_INTERNAL("a26_32in1", A26_ROM_32IN1) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_FRAGMENT(a2600_cartslot) + MCFG_VCS_CARTRIDGE_ADD("cartslot", a2600_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","a2600") + MCFG_SOFTWARE_LIST_ADD("cass_list","a2600_cass") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( a2600, a2600_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK_NTSC / 3) /* actually M6507 */ + MCFG_M6502_DISABLE_DIRECT() + MCFG_CPU_PROGRAM_MAP(a2600_mem) + + MCFG_MACHINE_START_OVERRIDE(a2600_state,a2600) + + /* video hardware */ + MCFG_DEVICE_ADD("tia_video", TIA_NTSC_VIDEO, 0) + MCFG_TIA_READ_INPUT_PORT_CB(READ16(a2600_state, a2600_read_input_port)) + MCFG_TIA_DATABUS_CONTENTS_CB(READ8(a2600_state, a2600_get_databus_contents)) + MCFG_TIA_VSYNC_CB(WRITE16(a2600_state, a2600_tia_vsync_callback)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( MASTER_CLOCK_NTSC, 228, 26, 26 + 160 + 16, 262, 24 , 24 + 192 + 31 ) + MCFG_SCREEN_UPDATE_DEVICE("tia_video", tia_video_device, screen_update) + MCFG_SCREEN_PALETTE("tia_video:palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_TIA_ADD("tia", MASTER_CLOCK_NTSC/114) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) + + /* devices */ + MCFG_DEVICE_ADD("riot", MOS6532n, MASTER_CLOCK_NTSC / 3) + MCFG_MOS6530n_IN_PA_CB(READ8(a2600_state, switch_A_r)) + MCFG_MOS6530n_OUT_PA_CB(WRITE8(a2600_state, switch_A_w)) + MCFG_MOS6530n_IN_PB_CB(READ8(a2600_state, riot_input_port_8_r)) + MCFG_MOS6530n_OUT_PB_CB(WRITE8(a2600_state, switch_B_w)) + MCFG_MOS6530n_IRQ_CB(WRITELINE(a2600_state, irq_callback)) + + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, "joy") + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) + + MCFG_FRAGMENT_ADD(a2600_cartslot) + MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( a2600p, a2600_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK_PAL / 3) /* actually M6507 */ + MCFG_CPU_PROGRAM_MAP(a2600_mem) + MCFG_M6502_DISABLE_DIRECT() + + MCFG_MACHINE_START_OVERRIDE(a2600_state,a2600) + + /* video hardware */ + MCFG_DEVICE_ADD("tia_video", TIA_PAL_VIDEO, 0) + MCFG_TIA_READ_INPUT_PORT_CB(READ16(a2600_state, a2600_read_input_port)) + MCFG_TIA_DATABUS_CONTENTS_CB(READ8(a2600_state, a2600_get_databus_contents)) + MCFG_TIA_VSYNC_CB(WRITE16(a2600_state, a2600_tia_vsync_callback_pal)) + + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( MASTER_CLOCK_PAL, 228, 26, 26 + 160 + 16, 312, 32, 32 + 228 + 31 ) + MCFG_SCREEN_UPDATE_DEVICE("tia_video", tia_video_device, screen_update) + MCFG_SCREEN_PALETTE("tia_video:palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_TIA_ADD("tia", MASTER_CLOCK_PAL/114) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) + + /* devices */ + MCFG_DEVICE_ADD("riot", MOS6532n, MASTER_CLOCK_PAL / 3) + MCFG_MOS6530n_IN_PA_CB(READ8(a2600_state, switch_A_r)) + MCFG_MOS6530n_OUT_PA_CB(WRITE8(a2600_state, switch_A_w)) + MCFG_MOS6530n_IN_PB_CB(READ8(a2600_state, riot_input_port_8_r)) + MCFG_MOS6530n_OUT_PB_CB(WRITE8(a2600_state, switch_B_w)) + MCFG_MOS6530n_IRQ_CB(WRITELINE(a2600_state, irq_callback)) + + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, "joy") + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) + + MCFG_FRAGMENT_ADD(a2600_cartslot) + MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") +MACHINE_CONFIG_END + + +ROM_START( a2600 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) +ROM_END + +#define rom_a2600p rom_a2600 + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1977, a2600, 0, 0, a2600, a2600, driver_device, 0, "Atari", "Atari 2600 (NTSC)" , MACHINE_SUPPORTS_SAVE ) +CONS( 1978, a2600p, a2600, 0, a2600p, a2600, driver_device, 0, "Atari", "Atari 2600 (PAL)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/a310.c b/src/mame/drivers/a310.c new file mode 100644 index 00000000000..61764ca4cbd --- /dev/null +++ b/src/mame/drivers/a310.c @@ -0,0 +1,453 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese, R. Belmont, Juergen Buchmueller +/****************************************************************************** + * + * Acorn Archimedes 310 + * + * Skeleton: Juergen Buchmueller , Jul 2000 + * Enhanced: R. Belmont, June 2007 + * Angelo Salese, August 2010 + * + * TODO: + * - Make floppies to work; + * - Attempting to load the GUI gives an exception; + * - Graphics in GUI misses some vram data on the right edges (for example white vertical stripe on the far right), rmw bug related to the above? + * - Apparently same deal happens to Arthur OS, on a bunch of icons; + * - Hook up mouse in AAKART; + * - Add shifted version of keyboard inputs, necessary especially for loading programs thru Supervisor Mode; + * - try to understand why bios 2 was working at some point and now isn't + * + * + * +======================================================================================= + * + * Memory map (from http://b-em.bbcmicro.com/arculator/archdocs.txt) + * + * 0000000 - 1FFFFFF - logical RAM (32 meg) + * 2000000 - 2FFFFFF - physical RAM (supervisor only - max 16MB - requires quad MEMCs) + * 3000000 - 33FFFFF - IOC (IO controllers - supervisor only) + * 3310000 - FDC - WD1772 + * 33A0000 - Econet - 6854 + * 33B0000 - Serial - 6551 + * 3240000 - 33FFFFF - internal expansion cards + * 32D0000 - hard disc controller (not IDE) - HD63463 + * 3350010 - printer + * 3350018 - latch A + * 3350040 - latch B + * 3270000 - external expansion cards + * + * 3400000 - 3FFFFFF - ROM (read - 12 meg - Arthur and RiscOS 2 512k, RiscOS 3 2MB) + * 3400000 - 37FFFFF - Low ROM (4 meg, I think this is expansion ROMs) + * 3800000 - 3FFFFFF - High ROM (main OS ROM) + * + * 3400000 - 35FFFFF - VICD10 (write - supervisor only) + * 3600000 - 3FFFFFF - MEMC (write - supervisor only) + * + *****************************************************************************/ +/* + DASM of code (bios 2 / RISC OS 2) + 0x380d4e0: MEMC: control to 0x10c (page size 32 kbytes, DRAM ram refresh only during flyback) + 0x380d4f0: VIDC: params (screen + sound frequency) + 0x380d51c: IOC: sets control to 0xff, clear IRQA and FIQ masks, sets IRQB mask to 0x80 (keyboard receive full irq) + 0x380d530: IOC: sets timer 0 to 0x4e20, go command + 0x380e0a8: work RAM physical check, max size etc. + 0x380e1f8: IOC: Disables DRAM ram refresh, sets timer 1 to 0x7ffe, go command, then it tests the latch of this timer, enables DRAM refresh + 0x380d00c: Set up default logical space + 0x380d16c: Set up case by case logical space + + +*/ + + +#include "emu.h" +#include "cpu/arm/arm.h" +#include "sound/dac.h" +#include "includes/archimds.h" +#include "machine/i2cmem.h" +//#include "machine/aakart.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "formats/applix_dsk.h" + + +class a310_state : public archimedes_state +{ +public: + a310_state(const machine_config &mconfig, device_type type, const char *tag) + : archimedes_state(mconfig, type, tag) + , m_physram(*this, "physicalram") + , m_ram(*this, RAM_TAG) + { } + + required_shared_ptr m_physram; + + DECLARE_READ32_MEMBER(a310_psy_wram_r); + DECLARE_WRITE32_MEMBER(a310_psy_wram_w); + DECLARE_WRITE_LINE_MEMBER(a310_wd177x_intrq_w); + DECLARE_WRITE_LINE_MEMBER(a310_wd177x_drq_w); + DECLARE_DRIVER_INIT(a310); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + +protected: + required_device m_ram; +}; + + +WRITE_LINE_MEMBER(a310_state::a310_wd177x_intrq_w) +{ + printf("%d IRQ\n",state); + if (state) + { + archimedes_request_fiq(ARCHIMEDES_FIQ_FLOPPY); + } + else + archimedes_clear_fiq(ARCHIMEDES_FIQ_FLOPPY); +} + +WRITE_LINE_MEMBER(a310_state::a310_wd177x_drq_w) +{ + printf("%d DRQ\n",state); + if (state) + { + archimedes_request_fiq(ARCHIMEDES_FIQ_FLOPPY_DRQ); + } + else + archimedes_clear_fiq(ARCHIMEDES_FIQ_FLOPPY_DRQ); +} + +READ32_MEMBER(a310_state::a310_psy_wram_r) +{ + return m_physram[offset]; +} + +WRITE32_MEMBER(a310_state::a310_psy_wram_w) +{ + COMBINE_DATA(&m_physram[offset]); +} + + +DRIVER_INIT_MEMBER(a310_state,a310) +{ + UINT32 ram_size = m_ram->size(); + + m_maincpu->space(AS_PROGRAM).install_readwrite_handler( 0x02000000, 0x02000000+(ram_size-1), read32_delegate(FUNC(a310_state::a310_psy_wram_r), this), write32_delegate(FUNC(a310_state::a310_psy_wram_w), this)); + + archimedes_driver_init(); +} + +void a310_state::machine_start() +{ + archimedes_init(); + + + + // reset the DAC to centerline + //m_dac->write_signed8(0x80); +} + +void a310_state::machine_reset() +{ + archimedes_reset(); +} + +static ADDRESS_MAP_START( a310_mem, AS_PROGRAM, 32, a310_state ) + AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(archimedes_memc_logical_r, archimedes_memc_logical_w) + AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_SHARE("physicalram") /* physical RAM - 16 MB for now, should be 512k for the A310 */ + AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(archimedes_ioc_r, archimedes_ioc_w) + AM_RANGE(0x03400000, 0x035fffff) AM_READWRITE(archimedes_vidc_r, archimedes_vidc_w) + AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(archimedes_memc_r, archimedes_memc_w) + AM_RANGE(0x03800000, 0x03ffffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(archimedes_memc_page_w) +ADDRESS_MAP_END + + +INPUT_CHANGED_MEMBER(a310_state::key_stroke) +{ + UINT8 row_val = (UINT8)(FPTR)(param) >> 4; + UINT8 col_val = (UINT8)(FPTR)(param) & 0xf; + + if(newval && !oldval) + m_kart->send_keycode_down(row_val,col_val); + + if(oldval && !newval) + m_kart->send_keycode_up(row_val,col_val); +} + +// TODO: +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0c) PORT_IMPULSE(1) <- led enabled & 4 +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1d) PORT_IMPULSE(1) <- English Pound symbol +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x21) PORT_IMPULSE(1) <- unknown but used (changes cursor to full) +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x22) PORT_IMPULSE(1) <- led enabled & 1 +// 0x37 - 0x39 another 7 - 9 (keypad?) +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3a) PORT_IMPULSE(1) <- another minus (keypad?) +// 0x48 - 0x4a another 4 - 6 (keypad?) +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4b) PORT_IMPULSE(1) <- + +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4c) PORT_IMPULSE(1) <- another English Pound +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x57) PORT_IMPULSE(1) <- another / +// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x5d) PORT_IMPULSE(1) <- led enabled & 2 + +static INPUT_PORTS_START( a310 ) + PORT_START("dip") /* DIP switches */ + PORT_BIT(0xfd, 0xfd, IPT_UNUSED) + + PORT_START("key0") /* KEY ROW 0 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x00) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x11) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x12) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x13) PORT_IMPULSE(1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x14) PORT_IMPULSE(1) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x15) PORT_IMPULSE(1) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x16) PORT_IMPULSE(1) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x17) PORT_IMPULSE(1) + + PORT_START("key1") /* KEY ROW 1 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x18) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x19) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1a) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1b) PORT_IMPULSE(1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1c) PORT_IMPULSE(1) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x10) PORT_IMPULSE(1) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1e) PORT_IMPULSE(1) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x26) PORT_IMPULSE(1) + + PORT_START("key2") /* KEY ROW 2 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x27) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("w W") PORT_CODE(KEYCODE_W) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x28) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("e E") PORT_CODE(KEYCODE_E) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x29) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("r R") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2a) PORT_IMPULSE(1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("t T") PORT_CODE(KEYCODE_T) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2b) PORT_IMPULSE(1) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("y Y") PORT_CODE(KEYCODE_Y) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2c) PORT_IMPULSE(1) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("u U") PORT_CODE(KEYCODE_U) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2d) PORT_IMPULSE(1) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("i I") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2e) PORT_IMPULSE(1) + + PORT_START("key3") /* KEY ROW 3 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("o O") PORT_CODE(KEYCODE_O) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2f) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("p P") PORT_CODE(KEYCODE_P) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x30) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x31) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x32) PORT_IMPULSE(1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x47) PORT_IMPULSE(1) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x61) PORT_IMPULSE(1) + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + + PORT_START("key4") /* KEY ROW 4 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3c) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("s S") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3d) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("d D") PORT_CODE(KEYCODE_D) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3e) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("f F") PORT_CODE(KEYCODE_F) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3f) PORT_IMPULSE(1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("g G") PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x40) PORT_IMPULSE(1) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("h H") PORT_CODE(KEYCODE_H) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x41) PORT_IMPULSE(1) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("j J") PORT_CODE(KEYCODE_J) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x42) PORT_IMPULSE(1) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("k K") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x43) PORT_IMPULSE(1) + + PORT_START("key5") /* KEY ROW 5 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("l L") PORT_CODE(KEYCODE_L) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x44) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x45) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x46) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_ASTERISK) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x33) PORT_IMPULSE(1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("SHIFT (L)") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("z Z") PORT_CODE(KEYCODE_Z) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4e) PORT_IMPULSE(1) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("x X") PORT_CODE(KEYCODE_X) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4f) PORT_IMPULSE(1) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("c C") PORT_CODE(KEYCODE_C) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x50) PORT_IMPULSE(1) + + PORT_START("key6") /* KEY ROW 6 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x51) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x52) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("n N") PORT_CODE(KEYCODE_N) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x53) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("m M") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x54) PORT_IMPULSE(1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x55) PORT_IMPULSE(1) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x56) PORT_IMPULSE(1) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x23) PORT_IMPULSE(1) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("SHIFT (R)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x58) PORT_IMPULSE(1) + + PORT_START("key7") /* KEY ROW 7 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED") + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x5f) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("ENTER (KP)") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME(". (KP)") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("0 (KP)") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("1 (KP)") PORT_CODE(KEYCODE_1_PAD) + + PORT_START("key8") /* KEY ROW 8 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("2 (KP)") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("3 (KP)") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("4 (KP)") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("5 (KP)") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("6 (KP)") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("7 (KP)") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD) + + PORT_START("key9") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x20) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x24) PORT_IMPULSE(1) // (KP?) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("#") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x25) PORT_IMPULSE(1) // (KP?) + + PORT_START("keya") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x01) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x02) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x03) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x04) PORT_IMPULSE(1) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x05) PORT_IMPULSE(1) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x06) PORT_IMPULSE(1) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x07) PORT_IMPULSE(1) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x08) PORT_IMPULSE(1) + + PORT_START("keyb") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x09) PORT_IMPULSE(1) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0a) PORT_IMPULSE(1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0b) PORT_IMPULSE(1) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0c) PORT_IMPULSE(1) +// PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x05) PORT_IMPULSE(1) +// PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x06) PORT_IMPULSE(1) +// PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x07) PORT_IMPULSE(1) +// PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x08) PORT_IMPULSE(1) + + + PORT_START("via1a") /* VIA #1 PORT A */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_4WAY + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_4WAY + + PORT_START("tape")/* tape control */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("TAPE STOP") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("TAPE PLAY") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("TAPE REW") PORT_CODE(KEYCODE_F7) + PORT_BIT (0xf8, 0x80, IPT_UNUSED) +INPUT_PORTS_END + +FLOPPY_FORMATS_MEMBER( a310_state::floppy_formats ) + FLOPPY_APPLIX_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( a310_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER( archimedes_state::a310_kart_tx_w ) +{ + if(state) + archimedes_request_irq_b(ARCHIMEDES_IRQB_KBD_RECV_FULL); + else + archimedes_clear_irq_b(ARCHIMEDES_IRQB_KBD_RECV_FULL); +} + +WRITE_LINE_MEMBER( archimedes_state::a310_kart_rx_w ) +{ + if(state) + archimedes_request_irq_b(ARCHIMEDES_IRQB_KBD_XMIT_EMPTY); + else + archimedes_clear_irq_b(ARCHIMEDES_IRQB_KBD_XMIT_EMPTY); +} + +static MACHINE_CONFIG_START( a310, a310_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", ARM, 8000000) /* 8 MHz */ + MCFG_CPU_PROGRAM_MAP(a310_mem) + MCFG_ARM_COPRO(ARM_COPRO_TYPE_VL86C020) + + MCFG_DEVICE_ADD("kart", AAKART, 8000000/256) + MCFG_AAKART_OUT_TX_CB(WRITELINE(archimedes_state, a310_kart_tx_w)) + MCFG_AAKART_OUT_RX_CB(WRITELINE(archimedes_state, a310_kart_rx_w)) + + MCFG_I2CMEM_ADD("i2cmem") + MCFG_I2CMEM_DATA_SIZE(0x100) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1280, 1024) //TODO: default screen size + MCFG_SCREEN_VISIBLE_AREA(0*8, 1280 - 1, 0*16, 1024 - 1) + MCFG_SCREEN_UPDATE_DRIVER(archimedes_state, screen_update) + + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("512K, 1M, 4M, 8M, 16M") + + MCFG_WD1772_ADD("fdc", 8000000 / 1) // TODO: frequency + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE( a310_state, a310_wd177x_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(a310_state, a310_wd177x_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", a310_floppies, "35dd", a310_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", a310_floppies, "35dd", a310_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "archimedes") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac0", DAC, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.10) + + MCFG_SOUND_ADD("dac1", DAC, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.10) + + MCFG_SOUND_ADD("dac2", DAC, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.10) + + MCFG_SOUND_ADD("dac3", DAC, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.10) + + MCFG_SOUND_ADD("dac4", DAC, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.10) + + MCFG_SOUND_ADD("dac5", DAC, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.10) + + MCFG_SOUND_ADD("dac6", DAC, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.10) + + MCFG_SOUND_ADD("dac7", DAC, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.10) +MACHINE_CONFIG_END + +ROM_START(a310) + ROM_REGION( 0x800000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "311", "RiscOS 3.11 (29 Sep 1992)" ) + ROMX_LOAD( "ic24.rom", 0x000000, 0x80000, CRC(c1adde84) SHA1(12d060e0401dd0523d44453f947bdc55dd2c3240), ROM_BIOS(1) ) + ROMX_LOAD( "ic25.rom", 0x080000, 0x80000, CRC(15d89664) SHA1(78f5d0e6f1e8ee603317807f53ff8fe65a3b3518), ROM_BIOS(1) ) + ROMX_LOAD( "ic26.rom", 0x100000, 0x80000, CRC(a81ceb7c) SHA1(46b870876bc1f68f242726415f0c49fef7be0c72), ROM_BIOS(1) ) + ROMX_LOAD( "ic27.rom", 0x180000, 0x80000, CRC(707b0c6c) SHA1(345199a33fed23996374b9db8170a52ab63f0380), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "120", "Arthur/RiscOS 1.20 (25 Sep 1987)" ) + ROMX_LOAD( "arthur.bin", 0x000000, 0x080000, CRC(eb3fda57) SHA1(1181ff9c2c2f3d6d414054ec33b2260404bafc81), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "200", "RiscOS 2.0 (05 Oct 1988)" ) + ROMX_LOAD( "riscos2.bin", 0x000000, 0x080000, CRC(89c4ad36) SHA1(b82a78830dac386f9b649b6d32a34f9c6910546d), ROM_BIOS(3) ) + + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x100, "i2cmem", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( a3010 ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD( "0296,061-01.ic4" , 0x000000, 0x100000, CRC(b77fe215) SHA1(57b19ea4b97a9b6a240aa61211c2c134cb295aa0)) + ROM_LOAD32_WORD( "0296,062-01.ic15", 0x000002, 0x100000, CRC(d42e196e) SHA1(64243d39d1bca38b10761f66a8042c883bde87a4)) + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x100, "i2cmem", ROMREGION_ERASE00 ) + + ROM_REGION( 0x10000, "battery", ROMREGION_ERASE00 ) + ROM_LOAD( "0296,063-2.ic40", 0x00000, 0x10000, CRC(9ca3a6be) SHA1(75905b031f49960605d55c3e7350d309559ed440)) +ROM_END + +ROM_START( a3020 ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD32_WORD( "riscos_3.11_1.bin", 0x000000, 0x100000, CRC(552fc3aa) SHA1(b2f1911e53d7377f2e69e1a870139745d3df494b)) + ROM_LOAD32_WORD( "riscos_3.11_2.bin", 0x000002, 0x100000, CRC(308d5a4a) SHA1(b309e1dd85670a06d77ec504dbbec6c42336329f)) + ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) + ROM_REGION( 0x100, "i2cmem", ROMREGION_ERASE00 ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1988, a310, 0, 0, a310, a310, a310_state, a310, "Acorn", "Archimedes 310", MACHINE_NOT_WORKING) +COMP( 1988, a3010, a310, 0, a310, a310, a310_state, a310, "Acorn", "Archimedes 3010", MACHINE_NOT_WORKING) +COMP( 1988, a3020, a310, 0, a310, a310, a310_state, a310, "Acorn", "Archimedes 3020", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/a5105.c b/src/mame/drivers/a5105.c new file mode 100644 index 00000000000..03be992da60 --- /dev/null +++ b/src/mame/drivers/a5105.c @@ -0,0 +1,624 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese, Robbbert +/*************************************************************************** + + A5105 + + 12/05/2009 Skeleton driver. + + http://www.robotrontechnik.de/index.htm?/html/computer/a5105.htm + http://www.sax.de/~zander/bic/bic_bw.html + + - this looks like "somehow" inspired by the MSX1 machine? + + +ToDo: +- Fix hang when it should scroll +- Cassette Load (bit 7 of port 91) + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/upd7220.h" +#include "machine/ram.h" +#include "machine/upd765.h" +#include "formats/a5105_dsk.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "imagedev/cassette.h" +#include "imagedev/flopdrv.h" +#include "sound/wave.h" +#include "sound/beep.h" + + + +class a5105_state : public driver_device +{ +public: + a5105_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_hgdc(*this, "upd7220"), + m_cass(*this, "cassette"), + m_beep(*this, "beeper"), + m_fdc(*this, "upd765a"), + m_floppy0(*this, "upd765a:0"), + m_floppy1(*this, "upd765a:1"), + m_floppy2(*this, "upd765a:2"), + m_floppy3(*this, "upd765a:3"), + m_video_ram(*this, "video_ram"), + m_ram(*this, RAM_TAG), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_hgdc; + required_device m_cass; + required_device m_beep; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + + DECLARE_READ8_MEMBER(a5105_memsel_r); + DECLARE_READ8_MEMBER(key_r); + DECLARE_READ8_MEMBER(key_mux_r); + DECLARE_WRITE8_MEMBER(key_mux_w); + DECLARE_WRITE8_MEMBER(a5105_ab_w); + DECLARE_WRITE8_MEMBER(a5105_memsel_w); + DECLARE_WRITE8_MEMBER( a5105_upd765_w ); + DECLARE_WRITE8_MEMBER(pcg_addr_w); + DECLARE_WRITE8_MEMBER(pcg_val_w); + required_shared_ptr m_video_ram; + UINT8 *m_ram_base; + UINT8 *m_rom_base; + UINT8 *m_char_ram; + UINT16 m_pcg_addr; + UINT16 m_pcg_internal_addr; + UINT8 m_key_mux; + UINT8 m_memsel[4]; + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(a5105); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + required_device m_ram; + required_device m_gfxdecode; + required_device m_palette; + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); + UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); +}; + +/* TODO */ +UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + int xi,gfx; + UINT8 pen; + + gfx = m_video_ram[(address & 0x1ffff) >> 1]; + + for(xi=0;xi<16;xi++) + { + pen = ((gfx >> xi) & 1) ? 7 : 0; + + bitmap.pix32(y, x + xi) = palette[pen]; + } +} + +UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int x; + int xi,yi; + int tile,color; + UINT8 tile_data; + + for( x = 0; x < pitch; x++ ) + { + tile = (m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] & 0xff); + color = ((m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] >> 8) & 0x0f); + + for( yi = 0; yi < lr; yi++) + { + tile_data = m_char_ram[(tile*8+yi) & 0x7ff]; + + if(cursor_on && cursor_addr == addr+x && machine().first_screen()->frame_number() & 0x10) + tile_data^=0xff; + + for( xi = 0; xi < 8; xi++) + { + int res_x,res_y; + int pen = (tile_data >> xi) & 1 ? color : 0; + + res_x = x * 8 + xi; + res_y = y + yi; + + if(yi >= 8) { pen = 0; } + + if(!machine().first_screen()->visible_area().contains(res_x+0, res_y)) + continue; + + bitmap.pix32(res_y, res_x) = palette[pen]; + } + } + } +} + +static ADDRESS_MAP_START(a5105_mem, AS_PROGRAM, 8, a5105_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("bank4") +ADDRESS_MAP_END + +WRITE8_MEMBER( a5105_state::pcg_addr_w ) +{ + m_pcg_addr = data << 3; + m_pcg_internal_addr = 0; +} + +WRITE8_MEMBER( a5105_state::pcg_val_w ) +{ + m_char_ram[m_pcg_addr | m_pcg_internal_addr] = data; + + m_gfxdecode->gfx(0)->mark_dirty(m_pcg_addr >> 3); + + m_pcg_internal_addr++; + m_pcg_internal_addr&=7; +} + +READ8_MEMBER( a5105_state::key_r ) +{ + static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", + "KEY4", "KEY5", "KEY6", "KEY7", + "KEY8", "KEY9", "KEYA", "UNUSED", + "UNUSED", "UNUSED", "UNUSED", "UNUSED" }; + + return ioport(keynames[m_key_mux & 0x0f])->read(); +} + +READ8_MEMBER( a5105_state::key_mux_r ) +{ + return m_key_mux; +} + +WRITE8_MEMBER( a5105_state::key_mux_w ) +{ + /* + xxxx ---- unknown + ---- xxxx keyboard mux + */ + + m_key_mux = data; +} + +WRITE8_MEMBER( a5105_state::a5105_ab_w ) +{ +/*port $ab + ---- 100x tape motor, active low + ---- 101x tape data + ---- 110x led (color green) + ---- 111x key click, active high +*/ + switch (data & 6) + { + case 0: + if (BIT(data, 0)) + m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + else + m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + break; + + case 2: + m_cass->output( BIT(data, 0) ? -1.0 : +1.0); + break; + + case 4: + //led + break; + + case 6: + m_beep->set_state(BIT(data, 0)); + break; + } +} + +READ8_MEMBER( a5105_state::a5105_memsel_r ) +{ + UINT8 res; + + res = (m_memsel[0] & 3) << 0; + res|= (m_memsel[1] & 3) << 2; + res|= (m_memsel[2] & 3) << 4; + res|= (m_memsel[3] & 3) << 6; + + return res; +} + +WRITE8_MEMBER( a5105_state::a5105_memsel_w ) +{ + address_space &prog = m_maincpu->space( AS_PROGRAM ); + + if (m_memsel[0] != ((data & 0x03) >> 0)) + { + m_memsel[0] = (data & 0x03) >> 0; + + switch (m_memsel[0]) + { + case 0: + membank("bank1")->set_base(m_rom_base); + prog.install_read_bank(0x0000, 0x3fff, "bank1"); + prog.unmap_write(0x0000, 0x3fff); + break; + case 2: + membank("bank1")->set_base(m_ram_base); + prog.install_readwrite_bank(0x0000, 0x3fff, "bank1"); + break; + default: + prog.unmap_readwrite(0x0000, 0x3fff); + break; + } + } + + if (m_memsel[1] != ((data & 0x0c) >> 2)) + { + m_memsel[1] = (data & 0x0c) >> 2; + + switch (m_memsel[1]) + { + case 0: + membank("bank2")->set_base(m_rom_base + 0x4000); + prog.install_read_bank(0x4000, 0x7fff, "bank2"); + prog.unmap_write(0x4000, 0x4000); + break; + case 1: + membank("bank2")->set_base(memregion("k5651")->base()); + prog.install_read_bank(0x4000, 0x7fff, "bank2"); + prog.unmap_write(0x4000, 0x4000); + break; + case 2: + membank("bank2")->set_base(m_ram_base + 0x4000); + prog.install_readwrite_bank(0x4000, 0x7fff, "bank2"); + break; + default: + prog.unmap_readwrite(0x4000, 0x7fff); + break; + } + } + + if (m_memsel[2] != ((data & 0x30) >> 4)) + { + m_memsel[2] = (data & 0x30) >> 4; + + switch (m_memsel[2]) + { + case 0: + membank("bank3")->set_base(m_rom_base + 0x8000); + prog.install_read_bank(0x8000, 0xbfff, "bank3"); + prog.unmap_write(0x8000, 0xbfff); + break; + case 2: + membank("bank3")->set_base(m_ram_base + 0x8000); + prog.install_readwrite_bank(0x8000, 0xbfff, "bank3"); + break; + default: + prog.unmap_readwrite(0x8000, 0xbfff); + break; + } + } + + if (m_memsel[3] != ((data & 0xc0) >> 6)) + { + m_memsel[3] = (data & 0xc0) >> 6; + + switch (m_memsel[3]) + { + case 2: + membank("bank4")->set_base(m_ram_base + 0xc000); + prog.install_readwrite_bank(0xc000, 0xffff, "bank4"); + break; + default: + prog.unmap_readwrite(0xc000, 0xffff); + break; + } + } + + //printf("Memsel change to %02x %02x %02x %02x\n",m_memsel[0],m_memsel[1],m_memsel[2],m_memsel[3]); +} + +WRITE8_MEMBER( a5105_state::a5105_upd765_w ) +{ + m_floppy0->get_device()->mon_w(!BIT(data,0)); + m_floppy1->get_device()->mon_w(!BIT(data,1)); + m_floppy2->get_device()->mon_w(!BIT(data,2)); + m_floppy3->get_device()->mon_w(!BIT(data,3)); + + m_fdc->tc_w(BIT(data, 4)); +} + +static ADDRESS_MAP_START(a5105_io, AS_IO, 8, a5105_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x41) AM_DEVICE("upd765a", upd765a_device, map) + AM_RANGE(0x48, 0x4f) AM_WRITE(a5105_upd765_w) + + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + AM_RANGE(0x90, 0x93) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) + AM_RANGE(0x98, 0x99) AM_DEVREADWRITE("upd7220", upd7220_device, read, write) + + AM_RANGE(0x9c, 0x9c) AM_WRITE(pcg_val_w) +// AM_RANGE(0x9d, 0x9d) crtc area (ff-based), palette routes here + AM_RANGE(0x9e, 0x9e) AM_WRITE(pcg_addr_w) + +// AM_RANGE(0xa0, 0xa1) ay8910? + AM_RANGE(0xa8, 0xa8) AM_READWRITE(a5105_memsel_r,a5105_memsel_w) + AM_RANGE(0xa9, 0xa9) AM_READ(key_r) + AM_RANGE(0xaa, 0xaa) AM_READWRITE(key_mux_r,key_mux_w) + AM_RANGE(0xab, 0xab) AM_WRITE(a5105_ab_w) //misc output, see above +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( a5105 ) + PORT_START("KEY0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 =") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 \\") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\\') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 /") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + + PORT_START("KEY1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("< >") PORT_CODE(KEYCODE_COLON) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+ *") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb6 \xc3\x96") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa4 \xc3\x84") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xbc \xc3\x9c") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("# ^") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('^') + + PORT_START("KEY2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("' `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\'') PORT_CHAR('`') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("? beta") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". :") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // appears to do nothing + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + + PORT_START("KEY3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START("KEY4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + + PORT_START("KEY5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("KEY6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) /* gives keyclick but does nothing */PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CODE") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("KEY7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SELECT") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("KEY8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("KEY9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + + PORT_START("KEYA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_START("UNUSED") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +void a5105_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + a5105_ab_w(space, 0, 9); // turn motor off + m_beep->set_frequency(500); + + m_ram_base = (UINT8*)m_ram->pointer(); + m_rom_base = (UINT8*)memregion("maincpu")->base(); + + membank("bank1")->set_base(m_rom_base); + membank("bank2")->set_base(m_rom_base + 0x4000); + membank("bank3")->set_base(m_ram_base); + membank("bank4")->set_base(m_ram_base + 0x4000); +} + + +static const gfx_layout a5105_chars_8x8 = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 7, 6, 5, 4, 3, 2, 1, 0 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( a5105 ) + GFXDECODE_ENTRY( "pcg", 0x0000, a5105_chars_8x8, 0, 8 ) +GFXDECODE_END + + +PALETTE_INIT_MEMBER(a5105_state, a5105) +{ + int i; + int r,g,b; + + for ( i = 0; i < 16; i++ ) + { + r = i & 4 ? ((i & 8) ? 0xaa : 0xff) : 0x00; + g = i & 2 ? ((i & 8) ? 0xaa : 0xff) : 0x00; + b = i & 1 ? ((i & 8) ? 0xaa : 0xff) : 0x00; + + palette.set_pen_color(i, rgb_t(r,g,b)); + } +} + +void a5105_state::video_start() +{ + // find memory regions + m_char_ram = memregion("pcg")->base(); +} + +static ADDRESS_MAP_START( upd7220_map, AS_0, 16, a5105_state) + ADDRESS_MAP_GLOBAL_MASK(0x1ffff) + AM_RANGE(0x00000, 0x1ffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +FLOPPY_FORMATS_MEMBER( a5105_state::floppy_formats ) + FLOPPY_A5105_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( a5105_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +static const z80_daisy_config a5105_daisy_chain[] = +{ + { "z80ctc" }, + { "z80pio" }, + { NULL } +}; + +static MACHINE_CONFIG_START( a5105, a5105_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_15MHz / 4) + MCFG_CPU_PROGRAM_MAP(a5105_mem) + MCFG_CPU_IO_MAP(a5105_io) + MCFG_CPU_CONFIG(a5105_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) + MCFG_SCREEN_SIZE(40*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 25*8-1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", a5105) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(a5105_state, a5105) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_15MHz / 16) // unk clock + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(a5105_state, hgdc_display_pixels) + MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(a5105_state, hgdc_draw_text) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_15MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg2)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_15MHz / 4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", 0)) + + MCFG_CASSETTE_ADD( "cassette" ) + + MCFG_UPD765A_ADD("upd765a", true, true) + MCFG_FLOPPY_DRIVE_ADD("upd765a:0", a5105_floppies, "525qd", a5105_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765a:1", a5105_floppies, "525qd", a5105_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765a:2", a5105_floppies, "525qd", a5105_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765a:3", a5105_floppies, "525qd", a5105_state::floppy_formats) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( a5105 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "k1505_00.rom", 0x0000, 0x8000, CRC(0ed5f556) SHA1(5c33139db9f59e50da5c76729752f8e653ae34ae)) + ROM_LOAD( "k1505_80.rom", 0x8000, 0x2000, CRC(350e4958) SHA1(7e5b587c59676e8549561117ea0b70234f439a94)) + + ROM_REGION( 0x800, "pcg", ROMREGION_ERASE00 ) + + ROM_REGION( 0x4000, "k5651", ROMREGION_ERASEFF ) + ROM_LOAD( "k5651_40.rom", 0x0000, 0x2000, CRC(f4ad4739) SHA1(9a7bbe6f0d180dd513c7854f441cee986c8d9765)) + ROM_LOAD( "k5651_60.rom", 0x2000, 0x2000, CRC(c77dde3f) SHA1(7c16226be6c4c71013e8008fba9d2e9c5640b6a7)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, a5105, 0, 0, a5105, a5105, driver_device, 0, "VEB Robotron", "BIC A5105", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/a51xx.c b/src/mame/drivers/a51xx.c new file mode 100644 index 00000000000..2155fce0124 --- /dev/null +++ b/src/mame/drivers/a51xx.c @@ -0,0 +1,177 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + A51xx + + 12/05/2009 Skeleton driver. + + http://www.robotrontechnik.de/index.htm?/html/computer/a5120.htm + http://www.robotrontechnik.de/index.htm?/html/computer/a5130.htm + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + + +class a51xx_state : public driver_device +{ +public: + a51xx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + DECLARE_MACHINE_RESET(a5130); + DECLARE_VIDEO_START(a5130); + UINT32 screen_update_a5120(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_a5130(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(a5120_mem, AS_PROGRAM, 8, a51xx_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x03ff ) AM_ROM + AM_RANGE( 0x0400, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( a5120_io, AS_IO, 8, a51xx_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(a5130_mem, AS_PROGRAM, 8, a51xx_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_ROM + AM_RANGE( 0x1000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( a5130_io, AS_IO, 8, a51xx_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( a5120 ) +INPUT_PORTS_END + + +void a51xx_state::machine_reset() +{ +} + +void a51xx_state::video_start() +{ +} + +UINT32 a51xx_state::screen_update_a5120(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +/* Input ports */ +static INPUT_PORTS_START( a5130 ) +INPUT_PORTS_END + + +MACHINE_RESET_MEMBER(a51xx_state,a5130) +{ +} + +VIDEO_START_MEMBER(a51xx_state,a5130) +{ +} + +UINT32 a51xx_state::screen_update_a5130(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout a51xx_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 1024*8, 1025*8, 1026*8, 1027*8, 1028*8, 1029*8, 1030*8, 1031*8 }, + 8*8 /* every char takes 2 x 8 bytes */ +}; + +static GFXDECODE_START( a51xx ) + GFXDECODE_ENTRY( "chargen", 0x0000, a51xx_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( a5120, a51xx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(a5120_mem) + MCFG_CPU_IO_MAP(a5120_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(a51xx_state, screen_update_a5120) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", a51xx) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( a5130, a5120 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(a5130_mem) + MCFG_CPU_IO_MAP(a5130_io) + + MCFG_MACHINE_RESET_OVERRIDE(a51xx_state,a5130) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(a51xx_state, screen_update_a5130) + + MCFG_VIDEO_START_OVERRIDE(a51xx_state,a5130) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( a5120 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v1", "v1" ) + ROMX_LOAD( "a5120_v1.rom", 0x0000, 0x0400, CRC(b2b3fee0) SHA1(6198513b263d8a7a867f1dda368b415bb37fcdae), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v2", "v2" ) + ROMX_LOAD( "a5120_v2.rom", 0x0000, 0x0400, CRC(052386c2) SHA1(e545d30a0882cb7ee7acdbea842b57440552e4a6), ROM_BIOS(2)) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "bab47_1_lat.bin", 0x0000, 0x0400, CRC(93220886) SHA1(a5a1ab4e2e06eabc58c84991caa6a1cf55f1462d)) + ROM_LOAD( "bab46_2_lat.bin", 0x0400, 0x0400, CRC(7a578ec8) SHA1(d17d3f1c182c23e9e9fd4dd56f3ac3de4c18fb1a)) +ROM_END + +/* ROM definition */ +ROM_START( a5130 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "dzr5130.rom", 0x0000, 0x1000, CRC(4719beb7) SHA1(09295a658b8c5b75b20faea57ad925f69f07a9b5)) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "bab47_1_lat.bin", 0x0000, 0x0400, CRC(93220886) SHA1(a5a1ab4e2e06eabc58c84991caa6a1cf55f1462d)) + ROM_LOAD( "bab46_2_lat.bin", 0x0400, 0x0400, CRC(7a578ec8) SHA1(d17d3f1c182c23e9e9fd4dd56f3ac3de4c18fb1a)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, a5120, 0, 0, a5120, a5120, driver_device, 0, "VEB Robotron", "A5120", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1983, a5130, a5120, 0, a5130, a5130, driver_device, 0, "VEB Robotron", "A5130", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/a6809.c b/src/mame/drivers/a6809.c new file mode 100644 index 00000000000..38a455614ca --- /dev/null +++ b/src/mame/drivers/a6809.c @@ -0,0 +1,277 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert and unknown others +/*************************************************************************** + + Acorn 6809 + + 2009-05-12 Skeleton driver. + 2013-12-16 Fixed video [Robbbert] + + Acorn System 3 update? + http://acorn.chriswhy.co.uk/8bit_Upgrades/Acorn_6809_CPU.html + + This is a few boards emulated together: + - 6809 main board + - 80x25 video board + - FDC board (to come) + +The video board has a mc6845, and the characters do not go to a character +generator, instead they go to a SAA5050, which has its own CG inbuilt, plus +many other features. + +ToDo: + - FDC (address A00) + - Centronics Printer (VIA port A) + +Commands: +C - Echo to printer ( C '+' turns it on) +D - boot from disk +G - Go +L - Load tape +P - Run from pc reg +R - Display regs +S - Save tape +T - Trace +V - Set breakpoint + +M - Modify memory +MV - Modify memory at breakpoint address +MG - Modify memory from Go address +MP - Modify memory from pc-reg address +MR - Modify regs + +While modifying memory: +, show next address +- show previous address +enter show next address +; exit + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/6522via.h" +#include "machine/keyboard.h" +#include "video/saa5050.h" +#include "video/mc6845.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" + + +class a6809_state : public driver_device +{ +public: + a6809_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_p_videoram(*this, "videoram") + , m_via(*this, "via") + , m_cass(*this, "cassette") + , m_maincpu(*this, "maincpu") + , m_crtc(*this, "mc6845") + { } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(videoram_r); + DECLARE_WRITE8_MEMBER(a6809_address_w); + DECLARE_WRITE8_MEMBER(a6809_register_w); + DECLARE_WRITE_LINE_MEMBER(cass_w); + DECLARE_MACHINE_RESET(a6809); + TIMER_DEVICE_CALLBACK_MEMBER(a6809_c); + TIMER_DEVICE_CALLBACK_MEMBER(a6809_p); + required_shared_ptr m_p_videoram; + UINT16 m_start_address; + UINT16 m_cursor_address; +private: + UINT8 m_cass_data[4]; + bool m_cass_state; + bool m_cassold; + UINT8 m_video_index; + required_device m_via; + required_device m_cass; + required_device m_maincpu; + required_device m_crtc; +}; + + +static ADDRESS_MAP_START(a6809_mem, AS_PROGRAM, 8, a6809_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0x03ff) AM_RAM + AM_RANGE(0x0400,0x07ff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x0800,0x0800) AM_DEVREAD("mc6845", mc6845_device, status_r) AM_WRITE(a6809_address_w) + AM_RANGE(0x0801,0x0801) AM_DEVREAD("mc6845", mc6845_device, register_r) AM_WRITE(a6809_register_w) + AM_RANGE(0x0900,0x090f) AM_MIRROR(0xf0) AM_DEVREADWRITE("via", via6522_device, read, write) + AM_RANGE(0xf000,0xf7ff) // optional ROM + AM_RANGE(0xf800,0xffff) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( a6809_io, AS_IO, 8, a6809_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( a6809 ) +INPUT_PORTS_END + + +MACHINE_RESET_MEMBER( a6809_state, a6809) +{ + m_via->write_pb0(0); + m_via->write_pb1(0); + m_via->write_pb2(0); + m_via->write_pb3(0); + m_via->write_pb4(0); + m_via->write_pb5(0); + m_via->write_pb6(0); + m_via->write_pb7(0); +} + +READ8_MEMBER( a6809_state::videoram_r ) +{ + offset += m_start_address; + + if (m_cursor_address == offset) + return 0x7f; // cheap cursor + else + return m_p_videoram[offset&0x3ff]; +} + +WRITE8_MEMBER( a6809_state::a6809_address_w ) +{ + m_crtc->address_w( space, 0, data ); + + m_video_index = data & 0x1f; +} + +WRITE8_MEMBER( a6809_state::a6809_register_w ) +{ + UINT16 temp = m_start_address; + UINT16 temq = m_cursor_address; + + // data is 18, but we need 19, to give the 20 rows needed by the SAA5050 + if (m_video_index == 9) + data++; + + m_crtc->register_w( space, 0, data ); + + // Get start address + if (m_video_index == 12) + m_start_address = ((data & 7) << 8 ) | (temp & 0xff); + else + if (m_video_index == 13) + m_start_address = data | (temp & 0x3f00); + + else + // Get cursor address + if (m_video_index == 14) + m_cursor_address = ((data & 7) << 8 ) | (temq & 0xff); + else + if (m_video_index == 15) + m_cursor_address = data | (temq & 0x3f00); +} + +WRITE_LINE_MEMBER( a6809_state::cass_w ) +{ + m_cass_state = state; +} + +TIMER_DEVICE_CALLBACK_MEMBER(a6809_state::a6809_c) +{ + m_cass_data[3]++; + + if (m_cass_state != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +TIMER_DEVICE_CALLBACK_MEMBER(a6809_state::a6809_p) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_via->write_pb7(m_cass_data[1] < 12); + m_cass_data[1] = 0; + } +} + +WRITE8_MEMBER( a6809_state::kbd_put ) +{ + UINT8 d = data & 0x7f; + if (d == 8) d = 0x7f; // allow backspace to work + + m_via->write_pb0((d>>0)&1); + m_via->write_pb1((d>>1)&1); + m_via->write_pb2((d>>2)&1); + m_via->write_pb3((d>>3)&1); + m_via->write_pb4((d>>4)&1); + m_via->write_pb5((d>>5)&1); + m_via->write_pb6((d>>6)&1); + m_via->write_cb1(1); + m_via->write_cb1(0); +} + +static MACHINE_CONFIG_START( a6809, a6809_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6809E, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(a6809_mem) + MCFG_CPU_IO_MAP(a6809_io) + MCFG_MACHINE_RESET_OVERRIDE(a6809_state, a6809) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(40 * 12, 25 * 20) + MCFG_SCREEN_VISIBLE_AREA(0, 40 * 12 - 1, 0, 25 * 20 - 1) + MCFG_SCREEN_UPDATE_DEVICE("saa5050", saa5050_device, screen_update) + MCFG_PALETTE_ADD("palette", 8) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_DEVICE_ADD("via", VIA6522, XTAL_4MHz / 4) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(a6809_state, cass_w)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + + MCFG_MC6845_ADD("mc6845", MC6845, "screen", XTAL_4MHz / 2) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(12) + + MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000) + MCFG_SAA5050_D_CALLBACK(READ8(a6809_state, videoram_r)) + MCFG_SAA5050_SCREEN_SIZE(40, 25, 40) + + MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(a6809_state, kbd_put)) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_TIMER_DRIVER_ADD_PERIODIC("a6809_c", a6809_state, a6809_c, attotime::from_hz(4800)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("a6809_p", a6809_state, a6809_p, attotime::from_hz(40000)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( a6809 ) + ROM_REGION( 0x800, "maincpu", 0 ) + ROM_LOAD( "acorn6809.bin", 0x000, 0x800, CRC(5fa5b632) SHA1(b14a884bf82a7a8c23bc03c2e112728dd1a74896) ) + + ROM_REGION( 0x100, "proms", 0 ) + ROM_LOAD( "acorn6809.ic11", 0x0000, 0x0100, CRC(7908317d) SHA1(e0f1e5bd3a8598d3b62bc432dd1f3892ed7e66d8) ) // address decoder +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, a6809, 0, 0, a6809, a6809, driver_device, 0, "Acorn", "System 3 (6809 CPU)", 0 ) diff --git a/src/mame/drivers/a7150.c b/src/mame/drivers/a7150.c new file mode 100644 index 00000000000..47935cf9b79 --- /dev/null +++ b/src/mame/drivers/a7150.c @@ -0,0 +1,83 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Robotron A7150 + + 04/10/2009 Skeleton driver. + + http://www.robotrontechnik.de/index.htm?/html/computer/a7150.htm + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" + + +class a7150_state : public driver_device +{ +public: + a7150_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_a7150(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(a7150_mem, AS_PROGRAM, 16, a7150_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0xeffff) AM_RAM + AM_RANGE(0xf8000,0xfffff) AM_ROM AM_REGION("user1", 0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( a7150 ) +INPUT_PORTS_END + + +void a7150_state::machine_reset() +{ +} + +void a7150_state::video_start() +{ +} + +UINT32 a7150_state::screen_update_a7150(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( a7150, a7150_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 4915000) + MCFG_CPU_PROGRAM_MAP(a7150_mem) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(a7150_state, screen_update_a7150) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( a7150 ) + ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "a7150.rom", 0x0000, 0x8000, CRC(57855abd) SHA1(b58f1363623d2c3ff1221e449529ecaa22573bff)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, a7150, 0, 0, a7150, a7150, driver_device, 0, "VEB Robotron", "A7150", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/a7800.c b/src/mame/drivers/a7800.c new file mode 100644 index 00000000000..0d979502d7d --- /dev/null +++ b/src/mame/drivers/a7800.c @@ -0,0 +1,1464 @@ +// license:BSD-3-Clause +// copyright-holders:Dan Boris, Fabio Priuli, Mike Saarna, Robert Tuccitto +/*************************************************************************** + + a7800.c + + Driver file to handle emulation of the Atari 7800. + + Dan Boris + + 2002/05/13 kubecj added more banks for bankswitching + added PAL machine description + changed clock to be precise + improved cart emulation (in machine/) + + 2012/10/25 Robert Tuccitto NTSC Color Generator utilized for + color palette with hue shift/start + based on observation of several + systems across multiple displays + + 2012/11/09 Robert Tuccitto Fixed 3 degree hue begin point + miscalculation of color palette + + 2012/12/05 Robert Tuccitto Implemented proper IRE and phase + value to the palette + + 2012/12/14 Robert Tuccitto Adjusted colorburst/tint/hue of entire + palette to closer reflect default hardware configuration + setting of ~180 degrees. Palette settings now correspond + documented and calculated settings as follows: + + Contrast = 0.0526 --> 0.05 + Brightness = 0.0 --> 0.00 + Color = 0.2162 --> 0.22 + Phase = 25.714 --> 25.7 + Colorburst/Hue = 180 degrees + + 2013/02/27 Robert Tuccitto Palette rebuild due to misaligned + data references. Corrected PAL color sequence order. + + 2013/03/19 Robert Tuccitto Stripped palette to raw video output + values removing YIQ/YUV infer data. + + 2013/04/02 Robert Tuccitto Corrected rotation values and errors + including duplicate entries for palette. + + 2013/04/07 Robert Tuccitto Address map locations for the XBOARD + added. + + 2013/05/01 Robert Tuccitto Red and Blue miscalculated proportions + fixed. + + 2013/08/04 Robert Tuccitto Green miscalculated proportions fixed. + + 2013/08/13 Robert Tuccitto Normalized contrast and brightness, + providing a standardize grayscale and adjusted color values. + + 2013/09/02 Robert Tuccitto Stored data for 26.7 & 27.7 phase shifts + with corrections and label for 25.7 values. Made 26.7 + (medium) default. Phase shifting falls outside the realm of + video controls and hope to implement a selectable toggle + hardware option similar to Donkey Kong TKG02/TKG04. + + 2013/09/19 Robert Tuccitto Cleanup of Address Maps, high score maps + added. + + 2013/10/16 Robert Tuccitto Added Phase Shifts 24.7, 25.2, 26.2, 27.2. + Phase Shifts 24.7 through 27.7 degrees with 0.5 degree + increments documented. Phase Shift 26.2 degrees made active. + Fixed typo under 26.7 7$. + + 2013/10/27 Robert Tuccitto Modernized screen parameters for NTSC & PAL. + + 2013/11/03 Robert Tuccitto Fixed correctly typo under 26.7 7$. + + 2013/11/23 Robert Tuccitto Added NTSC Palette Notes. + + 2014/01/02 Robert Tuccitto Corrected joystick buttons assignment & minor + palette notes cleanup. + + 2014/01/09 Robert Tuccitto Positional description for difficulty + switches added. + + 2014/02/15 Robert Tuccitto Added more details and clarification + regarding the potentiometer. + + 2014/03/25 Mike Saarna Fixed Riot Timer + + 2014/04/04 Mike Saarna Fix to controller button RIOT behavior + + 2014/05/06 Mike Saarna/Robert Tuccitto Brought initial Maria cycle counts + inline from measurements taken with logic analyzer and tests. + + 2014/08/25 Fabio Priuli Converted carts to be slot devices and cleaned + up the driver (removed the pokey, cleaned up rom regions, etc.) + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "sound/tiaintf.h" +#include "sound/tiasound.h" +#include "machine/mos6530n.h" +#include "video/maria.h" +#include "bus/a7800/a78_carts.h" + + +#define A7800_NTSC_Y1 XTAL_14_31818MHz +#define CLK_PAL 1773447 + + +class a7800_state : public driver_device +{ +public: + a7800_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_tia(*this, "tia"), + m_maria(*this, "maria"), + m_io_joysticks(*this, "joysticks"), + m_io_buttons(*this, "buttons"), + m_io_console_buttons(*this, "console_buttons"), + m_cart(*this, "cartslot"), + m_screen(*this, "screen"), + m_bios(*this, "maincpu") { } + + int m_lines; + int m_ispal; + + int m_ctrl_lock; + int m_ctrl_reg; + int m_maria_flag; + int m_p1_one_button; + int m_p2_one_button; + int m_bios_enabled; + + DECLARE_READ8_MEMBER(bios_or_cart_r); + DECLARE_WRITE8_MEMBER(ram0_w); + DECLARE_READ8_MEMBER(tia_r); + DECLARE_WRITE8_MEMBER(tia_w); + DECLARE_READ8_MEMBER(maria_r); + DECLARE_WRITE8_MEMBER(maria_w); + DECLARE_DRIVER_INIT(a7800_pal); + DECLARE_DRIVER_INIT(a7800_ntsc); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(a7800); + DECLARE_PALETTE_INIT(a7800p); + TIMER_DEVICE_CALLBACK_MEMBER(interrupt); + TIMER_CALLBACK_MEMBER(maria_startdma); + DECLARE_READ8_MEMBER(riot_joystick_r); + DECLARE_READ8_MEMBER(riot_console_button_r); + DECLARE_WRITE8_MEMBER(riot_button_pullup_w); + +protected: + required_device m_maincpu; + required_device m_tia; + required_device m_maria; + required_ioport m_io_joysticks; + required_ioport m_io_buttons; + required_ioport m_io_console_buttons; + required_device m_cart; + required_device m_screen; + required_region_ptr m_bios; +}; + + +/*************************************************************************** + MEMORY HANDLERS + ***************************************************************************/ + +// RIOT +READ8_MEMBER(a7800_state::riot_joystick_r) +{ + return m_io_joysticks->read(); +} + +READ8_MEMBER(a7800_state::riot_console_button_r) +{ + return m_io_console_buttons->read(); +} + +WRITE8_MEMBER(a7800_state::riot_button_pullup_w) +{ + if(m_maincpu->space(AS_PROGRAM).read_byte(0x283) & 0x04) + m_p1_one_button = data & 0x04; // pin 6 of the controller port is held high by the riot chip when reading two-button controllers (from schematic) + if(m_maincpu->space(AS_PROGRAM).read_byte(0x283) & 0x10) + m_p2_one_button = data & 0x10; +} + +READ8_MEMBER(a7800_state::tia_r) +{ + switch (offset & 0x0f) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + /* Even though the 7800 doesn't use the TIA graphics the collision registers should + still return a reasonable value */ + return 0x00; + case 0x08: + return ((m_io_buttons->read() & 0x02) << 6); + case 0x09: + return ((m_io_buttons->read() & 0x08) << 4); + case 0x0a: + return ((m_io_buttons->read() & 0x01) << 7); + case 0x0b: + return ((m_io_buttons->read() & 0x04) << 5); + case 0x0c: + if (((m_io_buttons->read() & 0x08) ||(m_io_buttons->read() & 0x02)) && m_p1_one_button) + return 0x00; + else + return 0x80; + case 0x0d: + if (((m_io_buttons->read() & 0x01) ||(m_io_buttons->read() & 0x04)) && m_p2_one_button) + return 0x00; + else + return 0x80; + default: + logerror("undefined TIA read %x\n",offset); + + } + return 0xff; +} + +// TIA +WRITE8_MEMBER(a7800_state::tia_w) +{ + if (offset < 0x20) + { //INPTCTRL covers TIA registers 0x00-0x1F until locked + if (data & 0x01) + { + if (m_ctrl_lock && offset == 0x01) + m_maria_flag = 1; + else if (!m_ctrl_lock) + m_maria_flag = 1; + } + if (!m_ctrl_lock) + { + m_ctrl_lock = data & 0x01; + m_ctrl_reg = data; + } + } + m_tia->tia_sound_w(space, offset, data); +} + + +// TIMERS + +TIMER_DEVICE_CALLBACK_MEMBER(a7800_state::interrupt) +{ + // DMA Begins 7 cycles after hblank + machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(7), timer_expired_delegate(FUNC(a7800_state::maria_startdma),this)); + m_maria->interrupt(m_lines); +} + +TIMER_CALLBACK_MEMBER(a7800_state::maria_startdma) +{ + m_maria->startdma(m_lines); +} + + + +// ROM +READ8_MEMBER(a7800_state::bios_or_cart_r) +{ + if (!(m_ctrl_reg & 0x04)) + return m_bios[offset]; + else + return m_cart->read_40xx(space, offset + 0x8000); +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( a7800_mem, AS_PROGRAM, 8, a7800_state ) + AM_RANGE(0x0000, 0x001f) AM_MIRROR(0x300) AM_READWRITE(tia_r, tia_w) + AM_RANGE(0x0020, 0x003f) AM_MIRROR(0x300) AM_DEVREADWRITE("maria", atari_maria_device, read, write) + AM_RANGE(0x0040, 0x00ff) AM_RAMBANK("zpmirror") // mirror of 0x2040-0x20ff, for zero page + AM_RANGE(0x0140, 0x01ff) AM_RAMBANK("spmirror") // mirror of 0x2140-0x21ff, for stack page + AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x60) AM_DEVICE("riot", mos6532_t, io_map) + AM_RANGE(0x0480, 0x04ff) AM_MIRROR(0x100) AM_DEVICE("riot", mos6532_t, ram_map) + AM_RANGE(0x1800, 0x1fff) AM_RAM AM_SHARE("6116_1") + AM_RANGE(0x2000, 0x27ff) AM_RAM AM_SHARE("6116_2") + // According to the official Software Guide, the RAM at 0x2000 is + // repeatedly mirrored up to 0x3fff, but this is evidently incorrect + // because the High Score Cartridge maps ROM at 0x3000-0x3fff + // Hardware tests show that only the page at 0x2700 appears at + // 0x2800, and only on some hardware (MARIA? motherboard?) revisions, + // and even then with inconsistent and unreliable results. + AM_RANGE(0x4000, 0xffff) AM_DEVWRITE("cartslot", a78_cart_slot_device, write_40xx) + AM_RANGE(0x4000, 0xbfff) AM_DEVREAD("cartslot", a78_cart_slot_device, read_40xx) + AM_RANGE(0xc000, 0xffff) AM_READ(bios_or_cart_r) // here also the BIOS can be accessed +ADDRESS_MAP_END + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( a7800 ) + PORT_START("joysticks") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY + + PORT_START("buttons") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("console_buttons") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select") PORT_CODE(KEYCODE_S) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_O) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_DIPNAME(0x40, 0x40, "Left Difficulty Switch") + PORT_DIPSETTING(0x40, "A - Right Position" ) + PORT_DIPSETTING(0x00, "B - Left Position" ) + PORT_DIPNAME(0x80, 0x80, "Right Difficulty Switch") + PORT_DIPSETTING(0x80, "A - Right Position" ) + PORT_DIPSETTING(0x00, "B - Left Position" ) +INPUT_PORTS_END + +/*************************************************************************** +Atari 7800 NTSC Palette Notes: + +Palette on a modern flat panel display (LCD, LED, Plasma, etc.) appears +different from a traditional CRT. The most outstanding difference is Hue 1x, +the hue begin point. Hue 1x looks very 'green' (~-60 to -45 degrees - +depending on how poor or well it handles the signal conversion and its +calibration) on a modern flat panel display, as opposed to 'gold' (~-33 +degrees) on a CRT. + +The potentiometer (pot adjustment) for the 7800 modifies the delay line +regarding colors it will exhibit and is extremely sensitive. The slightest +turn can have a significant impact. + +A system whose potentiometer is not properly calibrated via +'CPS 7800 Diagnostic Test Cartridge' or/and just slightly off from the +desired factory settings may exhibit consequences such as too much blue in +place of green (Pot adjusted slightly too far left) or washed out reddish +tones in place of where most other systems display a darker reddish tones +(Pot adjusted slightly too far right). + +This is a result of the phase shifting of lesser degrees (Pot adjusted more +to the left) or phase shifting of greater degrees (Pot adjusted more to the +right). + +Turning the pot adjustment to the right, it can be observed that the values +of the higher end of the scale will match the lower end of the scale. +For example, after some turning to the right, the values of Dx, Ex, Fx, +can be set to match 1x, 2x, 3x. + +After further turning to the right, now the palette can be brought to make +Ax, Bx, Cx, Dx, Ex, Fx will match 1x, 2x, 3x, 4x, 5x, 6x. + +Ultimately though, too much turning to the right results in all colors being +wiped from the scale, excluding the hue begin point 1x (Which remains +unchanged while tweaking the potentiometer either left or right). + +Continuously turning the pot adjustment to the left, red and blue become the +most dominant two colors encompassing the palette with only a slight +influence of green at the highest end of the palette (Fx), once turned all +the way leftward. + +The degree range for adjustment of the phase shifting on the 7800 appears +to be as low as approximately 15 degrees when tuned all the way left, and +seems to be able to achieve as high as approximately 45 degrees when turned +right before losing all color (Excluding 1x) from the palette scale. + +For even a properly calibrated system at power on, the system's phase +shift appears as low as ~23 degrees and after a considerable consistent +runtime ('warm-up'), can be as high as ~28 degrees. + +In general, the low end of ~23 degrees lasts for maybe several seconds, +whereas higher values such as ~25-27 degrees is the most dominant during +system run time. 180 degrees colorburst takes place at ~25.7 degrees (A +near exact match of Hue 1x and 15x - To the naked eye they appear to be +the same). + +However, consistent system run time causes Hue 15x (F$) to become +stronger/darker gold (More brown then ultimately red-brown); as well +as leans Hue 14x (E$) more brown than green. Once achieving a phase shift +of 27.7, Hue 14x (E$) and Hue 15x (F$) near-exact match Hue 1x and 2x +respectively. + +Therefore, an ideal phase shift while accounting for the reality of +shifting while warming up, as well as maintaining differences between 1x, +2x and 14x, 15x, would likely fall between a 25.7 and 27.7. Phase shifts +26.2 degrees and 26.7 degrees places Hue 15x (F$) between Hue 1x and +Hue 2x, having 26.2 degrees leaning closer to Hue 1x and 26.7 degrees +leaning closer to Hue 2x. + +The above notion would also harmonize with what has been documented for +the colors of 1x, 2x, 14x, 15x on the 7800. 1x = Gold, 2x = Orange, +14x (E$) = Orange-Green. 15x (F$) = Light Orange. Color descriptions are +best measured in the middle of the brightness scale. It should be +mentioned that Green-Yellow is referenced at Hue 13x (D$), nowhere near +Hue 1x. A Green-Yellow Hue 1x is how the palette is manipulated and +modified (in part) under a modern flat panel display. + +Additionally, the blue to red (And consequently blue to green) ratio +proportions may appear different on a modern flat panel display than a CRT +in some instances for the Atari 7800 system. Furthermore, you may have +some variation of proportions even within the same display type. + +One side effect of this on the console's palette is that some values of +red may appear too pinkish - Too much blue to red. This is not the same +as a traditional tint-hue control adjustment; rather, can be demonstrated +by changing the blue ratio values via MESS HLSL settings. + +Lastly, the Atari 2600 & 5200 NTSC color palettes hold the same hue +structure order and have similar appearance differences that are dependent +upon display type. +***************************************************************************/ + +/*************************************************************************** + PALETTE - 25.7 PHASE SHIFT +***************************************************************************/ + +#define NTSC_GREY \ + rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ + rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ + rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ + rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) + +#define NTSC_GOLD \ + rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ + rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ + rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ + rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) + +#define NTSC_ORANGE \ + rgb_t(0x31,0x00,0x00), rgb_t(0x42,0x06,0x00), rgb_t(0x53,0x17,0x00), rgb_t(0x64,0x28,0x00), \ + rgb_t(0x75,0x39,0x00), rgb_t(0x86,0X4A,0x00), rgb_t(0x97,0x5B,0x0A), rgb_t(0xA8,0x6C,0x1B), \ + rgb_t(0xB9,0x7D,0x2C), rgb_t(0xCA,0x8E,0x3D), rgb_t(0xDB,0x9F,0x4E), rgb_t(0xEC,0xB0,0x5F), \ + rgb_t(0xFD,0xC1,0x70), rgb_t(0xFF,0xD2,0x85), rgb_t(0xFF,0xE3,0x9C), rgb_t(0xFF,0xF4,0xB2 ) + +#define NTSC_RED_ORANGE \ + rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x08,0x00), rgb_t(0x71,0x19,0x00), \ + rgb_t(0x82,0x2A,0x0D), rgb_t(0x93,0x3B,0x1E), rgb_t(0xA4,0x4C,0x2F), rgb_t(0xB5,0x5D,0x40), \ + rgb_t(0xC6,0x6E,0x51), rgb_t(0xD7,0x7F,0x62), rgb_t(0xE8,0x90,0x73), rgb_t(0xF9,0xA1,0x83), \ + rgb_t(0xFF,0xB2,0x98), rgb_t(0xFF,0xC3,0xAE), rgb_t(0xFF,0xD4,0xC4), rgb_t(0xFF,0xE5,0xDA ) + +#define NTSC_PINK \ + rgb_t(0x3F,0x00,0x03), rgb_t(0x50,0x00,0x0F), rgb_t(0x61,0x00,0x1B), rgb_t(0x72,0x0F,0x2B), \ + rgb_t(0x83,0x20,0x3C), rgb_t(0x94,0x31,0x4D), rgb_t(0xA5,0x42,0x5E), rgb_t(0xB6,0x53,0x6F), \ + rgb_t(0xC7,0x64,0x80), rgb_t(0xD8,0x75,0x91), rgb_t(0xE9,0x86,0xA2), rgb_t(0xFA,0x97,0xB3), \ + rgb_t(0xFF,0xA8,0xC8), rgb_t(0xFF,0xB9,0xDE), rgb_t(0xFF,0xCA,0xEF), rgb_t(0xFF,0xDB,0xF4 ) + +#define NTSC_PURPLE \ + rgb_t(0x33,0x00,0x35), rgb_t(0x44,0x00,0x41), rgb_t(0x55,0x00,0x4C), rgb_t(0x66,0x0C,0x5C), \ + rgb_t(0x77,0x1D,0x6D), rgb_t(0x88,0x2E,0x7E), rgb_t(0x99,0x3F,0x8F), rgb_t(0xAA,0x50,0xA0), \ + rgb_t(0xBB,0x61,0xB1), rgb_t(0xCC,0x72,0xC2), rgb_t(0xDD,0x83,0xD3), rgb_t(0xEE,0x94,0xE4), \ + rgb_t(0xFF,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) + +#define NTSC_PURPLE_BLUE \ + rgb_t(0x1D,0x00,0x5C), rgb_t(0x2E,0x00,0x68), rgb_t(0x40,0x00,0x74), rgb_t(0x51,0x10,0x84), \ + rgb_t(0x62,0x21,0x95), rgb_t(0x73,0x32,0xA6), rgb_t(0x84,0x43,0xB7), rgb_t(0x95,0x54,0xC8), \ + rgb_t(0xA6,0x65,0xD9), rgb_t(0xB7,0x76,0xEA), rgb_t(0xC8,0x87,0xEB), rgb_t(0xD9,0x98,0xEB), \ + rgb_t(0xE9,0xA9,0xEC), rgb_t(0xFB,0xBA,0xEB), rgb_t(0xFF,0xCB,0xEF), rgb_t(0xFF,0xDC,0xF4 ) + +#define NTSC_BLUE1 \ + rgb_t(0x02,0x00,0x71), rgb_t(0x13,0x00,0x7D), rgb_t(0x24,0x0B,0x8C), rgb_t(0x35,0x1C,0x9D), \ + rgb_t(0x46,0x2D,0xAE), rgb_t(0x57,0x3E,0xBF), rgb_t(0x68,0x4F,0xD0), rgb_t(0x79,0x60,0xE1), \ + rgb_t(0x8A,0x71,0xF2), rgb_t(0x9B,0x82,0xF7), rgb_t(0xAC,0x93,0xF7), rgb_t(0xBD,0xA4,0xF7), \ + rgb_t(0xCE,0xB5,0xF7), rgb_t(0xDF,0xC6,0xF7), rgb_t(0xF0,0xD7,0xF7), rgb_t(0xFF,0xE8,0xF8 ) + +#define NTSC_BLUE2 \ + rgb_t(0x00,0x00,0x68), rgb_t(0x00,0x0A,0x7C), rgb_t(0x08,0x1B,0x90), rgb_t(0x19,0x2C,0xA1), \ + rgb_t(0x2A,0x3D,0xB2), rgb_t(0x3B,0x4E,0xC3), rgb_t(0x4C,0x5F,0xD4), rgb_t(0x5D,0x70,0xE5), \ + rgb_t(0x6E,0x81,0xF6), rgb_t(0x7F,0x92,0xFF), rgb_t(0x90,0xA3,0xFF), rgb_t(0xA1,0xB4,0xFF), \ + rgb_t(0xB2,0xC5,0xFF), rgb_t(0xC3,0xD6,0xFF), rgb_t(0xD4,0xE7,0xFF), rgb_t(0xE5,0xF8,0xFF ) + +#define NTSC_LIGHT_BLUE \ + rgb_t(0x00,0x0A,0x4D), rgb_t(0x00,0x1B,0x63), rgb_t(0x00,0x2C,0x79), rgb_t(0x02,0x3D,0x8F), \ + rgb_t(0x13,0x4E,0xA0), rgb_t(0x24,0x5F,0xB1), rgb_t(0x35,0x70,0xC2), rgb_t(0x46,0x81,0xD3), \ + rgb_t(0x57,0x92,0xE4), rgb_t(0x68,0xA3,0xF5), rgb_t(0x79,0xB4,0xFF), rgb_t(0x8A,0xC5,0xFF), \ + rgb_t(0x9B,0xD6,0xFF), rgb_t(0xAC,0xE7,0xFF), rgb_t(0xBD,0xF8,0xFF), rgb_t(0xCE,0xFF,0xFF ) + +#define NTSC_TURQUOISE \ + rgb_t(0x00,0x1A,0x26), rgb_t(0x00,0x2B,0x3C), rgb_t(0x00,0x3C,0x52), rgb_t(0x00,0x4D,0x68), \ + rgb_t(0x06,0x5E,0x7C), rgb_t(0x17,0x6F,0x8D), rgb_t(0x28,0x80,0x9E), rgb_t(0x39,0x91,0xAF), \ + rgb_t(0x4A,0xA2,0xC0), rgb_t(0x5B,0xB3,0xD1), rgb_t(0x6C,0xC4,0xE2), rgb_t(0x7D,0xD5,0xF3), \ + rgb_t(0x8E,0xE6,0xFF), rgb_t(0x9F,0xF7,0xFF), rgb_t(0xB0,0xFF,0xFF), rgb_t(0xC1,0xFF,0xFF ) + +#define NTSC_GREEN_BLUE \ + rgb_t(0x00,0x24,0x0B), rgb_t(0x00,0x35,0x10), rgb_t(0x00,0x46,0x22), rgb_t(0x00,0x57,0x38), \ + rgb_t(0x05,0x68,0x4D), rgb_t(0x16,0x79,0x5E), rgb_t(0x27,0x8A,0x6F), rgb_t(0x38,0x9B,0x80), \ + rgb_t(0x49,0xAC,0x91), rgb_t(0x5A,0xBD,0xA2), rgb_t(0x6B,0xCE,0xB3), rgb_t(0x7C,0xDF,0xC4), \ + rgb_t(0x8D,0xF0,0xD5), rgb_t(0x9E,0xFF,0xE5), rgb_t(0xAF,0xFF,0xF1), rgb_t(0xC0,0xFF,0xFD ) + +#define NTSC_GREEN \ + rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1B), \ + rgb_t(0x10,0x6B,0x1B), rgb_t(0x21,0x7C,0x2C), rgb_t(0x32,0x8D,0x3D), rgb_t(0x43,0x9E,0x4E), \ + rgb_t(0x54,0xAF,0x5F), rgb_t(0x65,0xC0,0x70), rgb_t(0x76,0xD1,0x81), rgb_t(0x87,0xE2,0x92), \ + rgb_t(0x98,0xF3,0xA3), rgb_t(0xA9,0xFF,0xB3), rgb_t(0xBA,0xFF,0xBF), rgb_t(0xCB,0xFF,0xCB ) + +#define NTSC_YELLOW_GREEN \ + rgb_t(0x00,0x23,0x0A), rgb_t(0x00,0x34,0x10), rgb_t(0x04,0x45,0x13), rgb_t(0x15,0x56,0x13), \ + rgb_t(0x26,0x67,0x13), rgb_t(0x37,0x78,0x13), rgb_t(0x48,0x89,0x14), rgb_t(0x59,0x9A,0x25), \ + rgb_t(0x6A,0xAB,0x36), rgb_t(0x7B,0xBC,0x47), rgb_t(0x8C,0xCD,0x58), rgb_t(0x9D,0xDE,0x69), \ + rgb_t(0xAE,0xEF,0x7A), rgb_t(0xBF,0xFF,0x8B), rgb_t(0xD0,0xFF,0x97), rgb_t(0xE1,0xFF,0xA3 ) + +#define NTSC_ORANGE_GREEN \ + rgb_t(0x00,0x17,0x07), rgb_t(0x0E,0x28,0x08), rgb_t(0x1F,0x39,0x08), rgb_t(0x30,0x4A,0x08), \ + rgb_t(0x41,0x5B,0x08), rgb_t(0x52,0x6C,0x08), rgb_t(0x63,0x7D,0x08), rgb_t(0x74,0x8E,0x0D), \ + rgb_t(0x85,0x9F,0x1E), rgb_t(0x96,0xB0,0x2F), rgb_t(0xA7,0xC1,0x40), rgb_t(0xB8,0xD2,0x51), \ + rgb_t(0xC9,0xE3,0x62), rgb_t(0xDA,0xF4,0x73), rgb_t(0xEB,0xFF,0x82), rgb_t(0xFC,0xFF,0x8E ) + +#define NTSC_LIGHT_ORANGE \ + rgb_t(0x19,0x07,0x00), rgb_t(0x2A,0x18,0x00), rgb_t(0x3B,0x29,0x00), rgb_t(0x4C,0x3A,0x00), \ + rgb_t(0x5D,0x4B,0x00), rgb_t(0x6E,0x5C,0x00), rgb_t(0x7F,0x6D,0x00), rgb_t(0x90,0x7E,0x09), \ + rgb_t(0xA1,0x8F,0x1A), rgb_t(0xB2,0xA0,0x2B), rgb_t(0xC3,0xB1,0x3C), rgb_t(0xD4,0xC2,0x4D), \ + rgb_t(0xE5,0xD3,0x5E), rgb_t(0xF6,0xE4,0x6F), rgb_t(0xFF,0xF5,0x82), rgb_t(0xFF,0xFF,0x96 ) + +static const rgb_t a7800_palette[256*3] = +{ + NTSC_GREY, + NTSC_GOLD, + NTSC_ORANGE, + NTSC_RED_ORANGE, + NTSC_PINK, + NTSC_PURPLE, + NTSC_PURPLE_BLUE, + NTSC_BLUE1, + NTSC_BLUE2, + NTSC_LIGHT_BLUE, + NTSC_TURQUOISE, + NTSC_GREEN_BLUE, + NTSC_GREEN, + NTSC_YELLOW_GREEN, + NTSC_ORANGE_GREEN, + NTSC_LIGHT_ORANGE +}; + +static const rgb_t a7800p_palette[256*3] = +{ + NTSC_GREY, + NTSC_ORANGE_GREEN, + NTSC_GOLD, + NTSC_ORANGE, + NTSC_RED_ORANGE, + NTSC_PINK, + NTSC_PURPLE, + NTSC_PURPLE_BLUE, + NTSC_BLUE1, + NTSC_BLUE2, + NTSC_LIGHT_BLUE, + NTSC_TURQUOISE, + NTSC_GREEN_BLUE, + NTSC_GREEN, + NTSC_YELLOW_GREEN, + NTSC_ORANGE_GREEN +}; + +/*************************************************************************** + PALETTE - 24.7 PHASE SHIFT + + +define NTSC_GREY + rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ + rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ + rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ + rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) + +define NTSC_GOLD + rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ + rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ + rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ + rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) + +define NTSC_ORANGE + rgb_t(0x30,0x00,0x00), rgb_t(0x41,0x07,0x00), rgb_t(0x52,0x18,0x00), rgb_t(0x63,0x29,0x00), \ + rgb_t(0x74,0x3A,0x00), rgb_t(0x85,0x4B,0x00), rgb_t(0x96,0x5C,0x0A), rgb_t(0xA7,0x6D,0x1B), \ + rgb_t(0xB8,0x7E,0x2C), rgb_t(0xC9,0x8F,0x3D), rgb_t(0xDA,0xA0,0x4E), rgb_t(0xEB,0xB1,0x5F), \ + rgb_t(0xFC,0xC2,0x70), rgb_t(0xFF,0xD3,0x85), rgb_t(0xFF,0xE4,0x9B), rgb_t(0xFF,0xF5,0xB1 ) + +define NTSC_RED_ORANGE + rgb_t(0x3D,0x00,0x00), rgb_t(0x4E,0x00,0x00), rgb_t(0x5F,0x09,0x00), rgb_t(0x70,0x1A,0x00), \ + rgb_t(0x81,0x2B,0x09), rgb_t(0x92,0x3C,0x1A), rgb_t(0xA3,0x4D,0x2B), rgb_t(0xB4,0x5E,0x3C), \ + rgb_t(0xC5,0x6F,0x4D), rgb_t(0xD6,0x80,0x5E), rgb_t(0xE7,0x91,0x6F), rgb_t(0xF8,0xA2,0x80), \ + rgb_t(0xFF,0xB3,0x94), rgb_t(0xFF,0xC4,0xAA), rgb_t(0xFF,0xD5,0xC0), rgb_t(0xFF,0xE6,0xD6 ) + +define NTSC_PINK + rgb_t(0x3F,0x00,0x00), rgb_t(0x50,0x00,0x09), rgb_t(0x61,0x00,0x15), rgb_t(0x72,0x10,0x26), \ + rgb_t(0x83,0x21,0x37), rgb_t(0x94,0x32,0x48), rgb_t(0xA5,0x43,0x59), rgb_t(0xB6,0x54,0x6A), \ + rgb_t(0xC7,0x65,0x7B), rgb_t(0xD8,0x76,0x8C), rgb_t(0xE9,0x87,0x9D), rgb_t(0xFA,0x98,0xAE), \ + rgb_t(0xFF,0xA9,0xC2), rgb_t(0xFF,0xBA,0xD8), rgb_t(0xFF,0xCB,0xEE), rgb_t(0xFF,0xDC,0xF4 ) + +define NTSC_PURPLE + rgb_t(0x36,0x00,0x2E), rgb_t(0x47,0x00,0x3A), rgb_t(0x58,0x00,0x46), rgb_t(0x69,0x0C,0x55), \ + rgb_t(0x7A,0x1D,0x66), rgb_t(0x8B,0x2E,0x77), rgb_t(0x9C,0x3F,0x88), rgb_t(0xAD,0x50,0x99), \ + rgb_t(0xBE,0x61,0xAA), rgb_t(0xCF,0x72,0xBB), rgb_t(0xE0,0x83,0xCC), rgb_t(0xF1,0x94,0xDD), \ + rgb_t(0xFF,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) + +define NTSC_PURPLE_BLUE + rgb_t(0x23,0x00,0x55), rgb_t(0x34,0x00,0x61), rgb_t(0x45,0x00,0x6D), rgb_t(0x56,0x0F,0x7E), \ + rgb_t(0x67,0x20,0x8F), rgb_t(0x78,0x31,0xA0), rgb_t(0x89,0x42,0xB1), rgb_t(0x9A,0x53,0xC2), \ + rgb_t(0xAB,0x64,0xD3), rgb_t(0xBC,0x75,0xE4), rgb_t(0xCD,0x86,0xEA), rgb_t(0xDE,0x97,0xEA), \ + rgb_t(0xEF,0xA8,0xEA), rgb_t(0xFF,0xB9,0xEA), rgb_t(0xFF,0xCA,0xEF), rgb_t(0xFF,0xDB,0xF4 ) + +define NTSC_BLUE1 + rgb_t(0x09,0x00,0x6E), rgb_t(0x1A,0x00,0x7A), rgb_t(0x2B,0x08,0x88), rgb_t(0x3C,0x19,0x99), \ + rgb_t(0x4D,0x2A,0xAA), rgb_t(0x5E,0x3B,0xBB), rgb_t(0x6F,0x4C,0xCC), rgb_t(0x80,0x5D,0xDD), \ + rgb_t(0x91,0x6E,0xEE), rgb_t(0xA2,0x7F,0xF4), rgb_t(0xB3,0x90,0xF4), rgb_t(0xC4,0xA1,0xF4), \ + rgb_t(0xD5,0xB2,0xF4), rgb_t(0xE6,0xC3,0xF4), rgb_t(0xF7,0xD4,0xF4), rgb_t(0xFF,0xE5,0xF7 ) + +define NTSC_BLUE2 + rgb_t(0x00,0x00,0x6D), rgb_t(0x00,0x05,0x80), rgb_t(0x10,0x16,0x91), rgb_t(0x21,0x27,0xA2), \ + rgb_t(0x32,0x38,0xB3), rgb_t(0x43,0x49,0xC4), rgb_t(0x54,0x5A,0xD5), rgb_t(0x65,0x6B,0xE6), \ + rgb_t(0x76,0x7C,0xF7), rgb_t(0x87,0x8D,0xFF), rgb_t(0x98,0x9E,0xFF), rgb_t(0xA9,0xAF,0xFF), \ + rgb_t(0xBA,0xC0,0xFF), rgb_t(0xCB,0xD1,0xFF), rgb_t(0xDC,0xE2,0xFF), rgb_t(0xED,0xF3,0xFF ) + +define NTSC_LIGHT_BLUE + rgb_t(0x00,0x05,0x57), rgb_t(0x00,0x16,0x6E), rgb_t(0x00,0x27,0x84), rgb_t(0x09,0x38,0x97), \ + rgb_t(0x1A,0x49,0xA8), rgb_t(0x2B,0x5A,0xB9), rgb_t(0x3C,0x6B,0xCA), rgb_t(0x4D,0x7C,0xDB), \ + rgb_t(0x5E,0x8D,0xEC), rgb_t(0x6F,0x9E,0xFD), rgb_t(0x80,0xAF,0xFF), rgb_t(0x91,0xC0,0xFF), \ + rgb_t(0xA2,0xD1,0xFF), rgb_t(0xB3,0xE2,0xFF), rgb_t(0xC4,0xF3,0xFF), rgb_t(0xD5,0xFF,0xFF ) + +define NTSC_TURQUOISE + rgb_t(0x00,0x15,0x34), rgb_t(0x00,0x26,0x4A), rgb_t(0x00,0x37,0x60), rgb_t(0x00,0x48,0x77), \ + rgb_t(0x0A,0x59,0x8A), rgb_t(0x1B,0x6A,0x9B), rgb_t(0x2C,0x7B,0xAC), rgb_t(0x3D,0x8C,0xBD), \ + rgb_t(0x4E,0x9D,0xCE), rgb_t(0x5F,0xAE,0xDF), rgb_t(0x70,0xBF,0xF0), rgb_t(0x81,0xD0,0xFF), \ + rgb_t(0x92,0xE1,0xFF), rgb_t(0xA3,0xF2,0xFF), rgb_t(0xB4,0xFF,0xFF), rgb_t(0xC5,0xFF,0xFF ) + +define NTSC_GREEN_BLUE + rgb_t(0x00,0x21,0x0A), rgb_t(0x00,0x32,0x1F), rgb_t(0x00,0x43,0x35), rgb_t(0x00,0x54,0x4B), \ + rgb_t(0x04,0x65,0x60), rgb_t(0x15,0x76,0x71), rgb_t(0x26,0x87,0x82), rgb_t(0x37,0x98,0x93), \ + rgb_t(0x48,0xA9,0xA4), rgb_t(0x59,0xBA,0xB5), rgb_t(0x6A,0xCB,0xC6), rgb_t(0x7B,0xDC,0xD7), \ + rgb_t(0x8C,0xED,0xE8), rgb_t(0x9D,0xFE,0xF9), rgb_t(0xAE,0xFF,0xFF), rgb_t(0xBF,0xFF,0xFF ) + +define NTSC_GREEN + rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1D), \ + rgb_t(0x0A,0x6B,0x30), rgb_t(0x1B,0x7C,0x41), rgb_t(0x2C,0x8D,0x52), rgb_t(0x3D,0x9E,0x63), \ + rgb_t(0x4E,0xAF,0x74), rgb_t(0x5F,0xC0,0x85), rgb_t(0x70,0xD1,0x96), rgb_t(0x81,0xE2,0xA7), \ + rgb_t(0x92,0xF3,0xB8), rgb_t(0xA3,0xFF,0xC8), rgb_t(0xB4,0xFF,0xD3), rgb_t(0xC5,0xFF,0xDF ) + +define NTSC_YELLOW_GREEN + rgb_t(0x00,0x26,0x0B), rgb_t(0x00,0x37,0x10), rgb_t(0x00,0x48,0x16), rgb_t(0x0A,0x59,0x18), \ + rgb_t(0x1B,0x6A,0x18), rgb_t(0x2C,0x7B,0x18), rgb_t(0x3D,0x8C,0x27), rgb_t(0x4E,0x9D,0x38), \ + rgb_t(0x5F,0xAE,0x49), rgb_t(0x70,0xBF,0x5A), rgb_t(0x81,0xD0,0x6B), rgb_t(0x92,0xE1,0x7C), \ + rgb_t(0xA3,0xF2,0x8D), rgb_t(0xB4,0xFF,0x9C), rgb_t(0xC5,0xFF,0xA8), rgb_t(0xD6,0xFF,0xB4 ) + +define NTSC_ORANGE_GREEN + rgb_t(0x00,0x1E,0x09), rgb_t(0x00,0x2F,0x0E), rgb_t(0x11,0x40,0x0E), rgb_t(0x22,0x51,0x0E), \ + rgb_t(0x33,0x62,0x0E), rgb_t(0x44,0x73,0x0E), rgb_t(0x55,0x84,0x0E), rgb_t(0x66,0x95,0x17), \ + rgb_t(0x77,0xA6,0x28), rgb_t(0x88,0xB7,0x39), rgb_t(0x99,0xC8,0x4A), rgb_t(0xAA,0xD9,0x5B), \ + rgb_t(0xBB,0xEA,0x6C), rgb_t(0xCC,0xFB,0x7D), rgb_t(0xDD,0xFF,0x8A), rgb_t(0xEE,0xFF,0x96 ) + +define NTSC_LIGHT_ORANGE + rgb_t(0x0A,0x11,0x02), rgb_t(0x1B,0x22,0x02), rgb_t(0x2C,0x33,0x02), rgb_t(0x3D,0x44,0x02), \ + rgb_t(0x4E,0x55,0x02), rgb_t(0x5F,0x66,0x02), rgb_t(0x70,0x77,0x02), rgb_t(0x81,0x88,0x09), \ + rgb_t(0x92,0x99,0x1A), rgb_t(0xA3,0xAA,0x2B), rgb_t(0xB4,0xBB,0x3C), rgb_t(0xC5,0xCC,0x4D), \ + rgb_t(0xD6,0xDD,0x5E), rgb_t(0xE7,0xEE,0x6F), rgb_t(0xF8,0xFF,0x80), rgb_t(0xFF,0xFF,0x8F ) +***************************************************************************/ + + +/*************************************************************************** + PALETTE - 25.2 PHASE SHIFT + + +define NTSC_GREY + rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ + rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ + rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ + rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) + +define NTSC_GOLD + rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ + rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ + rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ + rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) + +define NTSC_ORANGE + rgb_t(0x30,0x00,0x00), rgb_t(0x41,0x07,0x00), rgb_t(0x52,0x18,0x00), rgb_t(0x63,0x29,0x00), \ + rgb_t(0x74,0x3A,0x00), rgb_t(0x85,0x4B,0x00), rgb_t(0x96,0x5C,0x0A), rgb_t(0xA7,0x6D,0x1B), \ + rgb_t(0xB8,0x7E,0x2C), rgb_t(0xC9,0x8F,0x3D), rgb_t(0xDA,0xA0,0x4E), rgb_t(0xEB,0xB1,0x5F), \ + rgb_t(0xFC,0xC2,0x70), rgb_t(0xFF,0xD3,0x85), rgb_t(0xFF,0xE4,0x9B), rgb_t(0xFF,0xF5,0xB1 ) + +define NTSC_RED_ORANGE + rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x09,0x00), rgb_t(0x71,0x1A,0x00), \ + rgb_t(0x82,0x2B,0x0B), rgb_t(0x93,0x3C,0x1C), rgb_t(0xA4,0x4D,0x2D), rgb_t(0xB5,0x5E,0x3E), \ + rgb_t(0xC6,0x6F,0x4F), rgb_t(0xD7,0x80,0x60), rgb_t(0xE8,0x91,0x71), rgb_t(0xF9,0xA2,0x82), \ + rgb_t(0xFF,0xB3,0x96), rgb_t(0xFF,0xC4,0xAC), rgb_t(0xFF,0xD5,0xC2), rgb_t(0xFF,0xE6,0xD8 ) + +define NTSC_PINK + rgb_t(0x3F,0x00,0x00), rgb_t(0x50,0x00,0x0C), rgb_t(0x61,0x00,0x18), rgb_t(0x72,0x0F,0x28), \ + rgb_t(0x83,0x20,0x39), rgb_t(0x94,0x31,0x4A), rgb_t(0xA5,0x42,0x5B), rgb_t(0xB6,0x53,0x6C), \ + rgb_t(0xC7,0x64,0x7D), rgb_t(0xD8,0x75,0x8E), rgb_t(0xE9,0x86,0x9F), rgb_t(0xFA,0x97,0xB0), \ + rgb_t(0xFF,0xA8,0xC5), rgb_t(0xFF,0xB9,0xDB), rgb_t(0xFF,0xCA,0xEF), rgb_t(0xFF,0xDB,0xF4 ) + +define NTSC_PURPLE + rgb_t(0x35,0x00,0x31), rgb_t(0x46,0x00,0x3D), rgb_t(0x57,0x00,0x49), rgb_t(0x68,0x0C,0x58), \ + rgb_t(0x79,0x1D,0x69), rgb_t(0x8A,0x2E,0x7A), rgb_t(0x9B,0x3F,0x8B), rgb_t(0xAC,0x50,0x9C), \ + rgb_t(0xBD,0x61,0xAD), rgb_t(0xCE,0x72,0xBE), rgb_t(0xDF,0x83,0xCF), rgb_t(0xF0,0x94,0xE0), \ + rgb_t(0xFF,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) + +define NTSC_PURPLE_BLUE + rgb_t(0x20,0x00,0x59), rgb_t(0x31,0x00,0x65), rgb_t(0x42,0x00,0x71), rgb_t(0x53,0x10,0x82), \ + rgb_t(0x64,0x21,0x93), rgb_t(0x75,0x32,0xA4), rgb_t(0x86,0x43,0xB5), rgb_t(0x97,0x54,0xC6), \ + rgb_t(0xA8,0x65,0xD7), rgb_t(0xB9,0x76,0xE8), rgb_t(0xCA,0x87,0xEB), rgb_t(0xDB,0x98,0xEB), \ + rgb_t(0xEC,0xA9,0xEB), rgb_t(0xFD,0xBA,0xEB), rgb_t(0xFF,0xCB,0xEF), rgb_t(0xFF,0xDC,0xF4 ) + +define NTSC_BLUE1 + rgb_t(0x05,0x00,0x70), rgb_t(0x16,0x00,0x7C), rgb_t(0x27,0x09,0x8B), rgb_t(0x38,0x1A,0x9C), \ + rgb_t(0x49,0x2B,0xAD), rgb_t(0x5A,0x3C,0xBE), rgb_t(0x6B,0x4D,0xCF), rgb_t(0x7C,0x5E,0xE0), \ + rgb_t(0X8D,0x6F,0xF1), rgb_t(0x9E,0x80,0xF6), rgb_t(0xAF,0x91,0xF6), rgb_t(0xC0,0xA2,0xF6), \ + rgb_t(0xD1,0xB3,0xF6), rgb_t(0xE2,0xC4,0xF6), rgb_t(0xF3,0xD5,0xF6), rgb_t(0xFF,0xE6,0xF7 ) + +define NTSC_BLUE2 + rgb_t(0x00,0x00,0x6B), rgb_t(0x00,0x08,0x7E), rgb_t(0x0C,0x19,0x91), rgb_t(0x1D,0x2A,0xA2), \ + rgb_t(0x2E,0x3B,0xB3), rgb_t(0x3F,0x4C,0xC4), rgb_t(0x50,0x5D,0xD5), rgb_t(0x61,0x6E,0xE6), \ + rgb_t(0x72,0x7F,0xF7), rgb_t(0x83,0x90,0xFF), rgb_t(0x94,0xA1,0xFF), rgb_t(0xA5,0xB2,0xFF), \ + rgb_t(0xB6,0xC3,0xFF), rgb_t(0xC7,0xD4,0xFF), rgb_t(0xD8,0xE5,0xFF), rgb_t(0xE9,0xF6,0xFF ) + +define NTSC_LIGHT_BLUE + rgb_t(0x00,0x08,0x52), rgb_t(0x00,0x19,0x68), rgb_t(0x00,0x2A,0x7F), rgb_t(0x05,0x3B,0x93), \ + rgb_t(0x16,0x4C,0xA4), rgb_t(0x27,0x5D,0xB5), rgb_t(0x38,0x6E,0xC6), rgb_t(0x49,0x7F,0xD7), \ + rgb_t(0x5A,0x90,0xE8), rgb_t(0x6B,0xA1,0xF9), rgb_t(0x7C,0xB2,0xFF), rgb_t(0x8D,0xC3,0xFF), \ + rgb_t(0x9E,0xD4,0xFF), rgb_t(0xAF,0xE5,0xFF), rgb_t(0xC0,0xF6,0xFF), rgb_t(0xD1,0xFF,0xFF ) + +define NTSC_TURQUOISE + rgb_t(0x00,0x17,0x2D), rgb_t(0x00,0x28,0x43), rgb_t(0x00,0x39,0x59), rgb_t(0x00,0x4A,0x6F), \ + rgb_t(0x08,0x5B,0x83), rgb_t(0x19,0x6C,0x94), rgb_t(0x2A,0x7D,0xA5), rgb_t(0x3B,0x8E,0xB6), \ + rgb_t(0x4C,0x9F,0xC7), rgb_t(0x5D,0xB0,0xD8), rgb_t(0x6E,0xC1,0xE9), rgb_t(0x7F,0xD2,0xFA), \ + rgb_t(0x90,0xE3,0xFF), rgb_t(0xA1,0xF4,0xFF), rgb_t(0xB2,0xFF,0xFF), rgb_t(0xC3,0xFF,0xFF ) + +define NTSC_GREEN_BLUE + rgb_t(0x00,0x23,0x0A), rgb_t(0x00,0x34,0x15), rgb_t(0x00,0x45,0x2B), rgb_t(0x00,0x56,0x41), \ + rgb_t(0x04,0x67,0x56), rgb_t(0x15,0x78,0x67), rgb_t(0x26,0x89,0x78), rgb_t(0x37,0x9A,0x89), \ + rgb_t(0x48,0xAB,0x9A), rgb_t(0x59,0xBC,0xAB), rgb_t(0x6A,0xCD,0xBC), rgb_t(0x7B,0xDE,0xCD), \ + rgb_t(0x8C,0xEF,0xDE), rgb_t(0x9D,0xFF,0xEE), rgb_t(0xAE,0xFF,0xFA), rgb_t(0xBF,0xFF,0xFF ) + +define NTSC_GREEN + rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1B), \ + rgb_t(0x0D,0x6B,0x25), rgb_t(0x1E,0x7C,0x36), rgb_t(0x2F,0x8D,0x47), rgb_t(0x40,0x9E,0x58), \ + rgb_t(0x51,0xAF,0x69), rgb_t(0x62,0xC0,0x7A), rgb_t(0x73,0xD1,0x8B), rgb_t(0x84,0xE2,0x9C), \ + rgb_t(0x95,0xF3,0xAD), rgb_t(0xA6,0xFF,0xBD), rgb_t(0xB7,0xFF,0xC9), rgb_t(0xC8,0xFF,0xD4 ) + +define NTSC_YELLOW_GREEN + rgb_t(0x00,0x24,0x0B), rgb_t(0x00,0x35,0x10), rgb_t(0x00,0x46,0x15), rgb_t(0x10,0x57,0x15), \ + rgb_t(0x21,0x68,0x15), rgb_t(0x32,0x79,0x15), rgb_t(0x43,0x8A,0x1C), rgb_t(0x54,0x9B,0x2D), \ + rgb_t(0x65,0xAC,0x3E), rgb_t(0x76,0xBD,0x4F), rgb_t(0x87,0xCE,0x60), rgb_t(0x98,0xDF,0x71), \ + rgb_t(0xA9,0xF0,0x82), rgb_t(0xBA,0xFF,0x93), rgb_t(0xCB,0xFF,0x9F), rgb_t(0xDC,0xFF,0xAA ) + +define NTSC_ORANGE_GREEN + rgb_t(0x00,0x1B,0x08), rgb_t(0x08,0x2C,0x0B), rgb_t(0x19,0x3D,0x0B), rgb_t(0x2A,0x4E,0x0B), \ + rgb_t(0x3B,0x5F,0x0B), rgb_t(0x4C,0x70,0x0B), rgb_t(0x5D,0x81,0x0B), rgb_t(0x6E,0x92,0x11), \ + rgb_t(0x7F,0xA3,0x22), rgb_t(0x90,0xB4,0x33), rgb_t(0xA1,0xC5,0x44), rgb_t(0xB2,0xD6,0x55), \ + rgb_t(0xC3,0xE7,0x66), rgb_t(0xD4,0xF8,0x77), rgb_t(0xE5,0xFF,0x85), rgb_t(0xF6,0xFF,0x91 ) + +define NTSC_LIGHT_ORANGE + rgb_t(0x12,0x0C,0x00), rgb_t(0x23,0x1D,0x00), rgb_t(0x34,0x2E,0x00), rgb_t(0x45,0x3F,0x00), \ + rgb_t(0x56,0x50,0x00), rgb_t(0x67,0x61,0x00), rgb_t(0x78,0x72,0x00), rgb_t(0x89,0x83,0x08), \ + rgb_t(0x9A,0x94,0x19), rgb_t(0xAB,0xA5,0x2A), rgb_t(0xBC,0xB6,0x3B), rgb_t(0xCD,0xC7,0x4C), \ + rgb_t(0xDE,0xD8,0x5D), rgb_t(0xEF,0xE9,0x6E), rgb_t(0xFF,0xFA,0x80), rgb_t(0xFF,0xFF,0x92 ) +***************************************************************************/ + + +/*************************************************************************** + PALETTE - 25.7 PHASE SHIFT + + +define NTSC_GREY + rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ + rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ + rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ + rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) + +define NTSC_GOLD + rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ + rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ + rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ + rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) + +define NTSC_ORANGE + rgb_t(0x31,0x00,0x00), rgb_t(0x42,0x06,0x00), rgb_t(0x53,0x17,0x00), rgb_t(0x64,0x28,0x00), \ + rgb_t(0x75,0x39,0x00), rgb_t(0x86,0X4A,0x00), rgb_t(0x97,0x5B,0x0A), rgb_t(0xA8,0x6C,0x1B), \ + rgb_t(0xB9,0x7D,0x2C), rgb_t(0xCA,0x8E,0x3D), rgb_t(0xDB,0x9F,0x4E), rgb_t(0xEC,0xB0,0x5F), \ + rgb_t(0xFD,0xC1,0x70), rgb_t(0xFF,0xD2,0x85), rgb_t(0xFF,0xE3,0x9C), rgb_t(0xFF,0xF4,0xB2 ) + +define NTSC_RED_ORANGE + rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x08,0x00), rgb_t(0x71,0x19,0x00), \ + rgb_t(0x82,0x2A,0x0D), rgb_t(0x93,0x3B,0x1E), rgb_t(0xA4,0x4C,0x2F), rgb_t(0xB5,0x5D,0x40), \ + rgb_t(0xC6,0x6E,0x51), rgb_t(0xD7,0x7F,0x62), rgb_t(0xE8,0x90,0x73), rgb_t(0xF9,0xA1,0x83), \ + rgb_t(0xFF,0xB2,0x98), rgb_t(0xFF,0xC3,0xAE), rgb_t(0xFF,0xD4,0xC4), rgb_t(0xFF,0xE5,0xDA ) + +define NTSC_PINK + rgb_t(0x3F,0x00,0x03), rgb_t(0x50,0x00,0x0F), rgb_t(0x61,0x00,0x1B), rgb_t(0x72,0x0F,0x2B), \ + rgb_t(0x83,0x20,0x3C), rgb_t(0x94,0x31,0x4D), rgb_t(0xA5,0x42,0x5E), rgb_t(0xB6,0x53,0x6F), \ + rgb_t(0xC7,0x64,0x80), rgb_t(0xD8,0x75,0x91), rgb_t(0xE9,0x86,0xA2), rgb_t(0xFA,0x97,0xB3), \ + rgb_t(0xFF,0xA8,0xC8), rgb_t(0xFF,0xB9,0xDE), rgb_t(0xFF,0xCA,0xEF), rgb_t(0xFF,0xDB,0xF4 ) + +define NTSC_PURPLE + rgb_t(0x33,0x00,0x35), rgb_t(0x44,0x00,0x41), rgb_t(0x55,0x00,0x4C), rgb_t(0x66,0x0C,0x5C), \ + rgb_t(0x77,0x1D,0x6D), rgb_t(0x88,0x2E,0x7E), rgb_t(0x99,0x3F,0x8F), rgb_t(0xAA,0x50,0xA0), \ + rgb_t(0xBB,0x61,0xB1), rgb_t(0xCC,0x72,0xC2), rgb_t(0xDD,0x83,0xD3), rgb_t(0xEE,0x94,0xE4), \ + rgb_t(0xFF,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) + +define NTSC_PURPLE_BLUE + rgb_t(0x1D,0x00,0x5C), rgb_t(0x2E,0x00,0x68), rgb_t(0x40,0x00,0x74), rgb_t(0x51,0x10,0x84), \ + rgb_t(0x62,0x21,0x95), rgb_t(0x73,0x32,0xA6), rgb_t(0x84,0x43,0xB7), rgb_t(0x95,0x54,0xC8), \ + rgb_t(0xA6,0x65,0xD9), rgb_t(0xB7,0x76,0xEA), rgb_t(0xC8,0x87,0xEB), rgb_t(0xD9,0x98,0xEB), \ + rgb_t(0xE9,0xA9,0xEC), rgb_t(0xFB,0xBA,0xEB), rgb_t(0xFF,0xCB,0xEF), rgb_t(0xFF,0xDC,0xF4 ) + +define NTSC_BLUE1 + rgb_t(0x02,0x00,0x71), rgb_t(0x13,0x00,0x7D), rgb_t(0x24,0x0B,0x8C), rgb_t(0x35,0x1C,0x9D), \ + rgb_t(0x46,0x2D,0xAE), rgb_t(0x57,0x3E,0xBF), rgb_t(0x68,0x4F,0xD0), rgb_t(0x79,0x60,0xE1), \ + rgb_t(0x8A,0x71,0xF2), rgb_t(0x9B,0x82,0xF7), rgb_t(0xAC,0x93,0xF7), rgb_t(0xBD,0xA4,0xF7), \ + rgb_t(0xCE,0xB5,0xF7), rgb_t(0xDF,0xC6,0xF7), rgb_t(0xF0,0xD7,0xF7), rgb_t(0xFF,0xE8,0xF8 ) + +define NTSC_BLUE2 + rgb_t(0x00,0x00,0x68), rgb_t(0x00,0x0A,0x7C), rgb_t(0x08,0x1B,0x90), rgb_t(0x19,0x2C,0xA1), \ + rgb_t(0x2A,0x3D,0xB2), rgb_t(0x3B,0x4E,0xC3), rgb_t(0x4C,0x5F,0xD4), rgb_t(0x5D,0x70,0xE5), \ + rgb_t(0x6E,0x81,0xF6), rgb_t(0x7F,0x92,0xFF), rgb_t(0x90,0xA3,0xFF), rgb_t(0xA1,0xB4,0xFF), \ + rgb_t(0xB2,0xC5,0xFF), rgb_t(0xC3,0xD6,0xFF), rgb_t(0xD4,0xE7,0xFF), rgb_t(0xE5,0xF8,0xFF ) + +define NTSC_LIGHT_BLUE + rgb_t(0x00,0x0A,0x4D), rgb_t(0x00,0x1B,0x63), rgb_t(0x00,0x2C,0x79), rgb_t(0x02,0x3D,0x8F), \ + rgb_t(0x13,0x4E,0xA0), rgb_t(0x24,0x5F,0xB1), rgb_t(0x35,0x70,0xC2), rgb_t(0x46,0x81,0xD3), \ + rgb_t(0x57,0x92,0xE4), rgb_t(0x68,0xA3,0xF5), rgb_t(0x79,0xB4,0xFF), rgb_t(0x8A,0xC5,0xFF), \ + rgb_t(0x9B,0xD6,0xFF), rgb_t(0xAC,0xE7,0xFF), rgb_t(0xBD,0xF8,0xFF), rgb_t(0xCE,0xFF,0xFF ) + +define NTSC_TURQUOISE + rgb_t(0x00,0x1A,0x26), rgb_t(0x00,0x2B,0x3C), rgb_t(0x00,0x3C,0x52), rgb_t(0x00,0x4D,0x68), \ + rgb_t(0x06,0x5E,0x7C), rgb_t(0x17,0x6F,0x8D), rgb_t(0x28,0x80,0x9E), rgb_t(0x39,0x91,0xAF), \ + rgb_t(0x4A,0xA2,0xC0), rgb_t(0x5B,0xB3,0xD1), rgb_t(0x6C,0xC4,0xE2), rgb_t(0x7D,0xD5,0xF3), \ + rgb_t(0x8E,0xE6,0xFF), rgb_t(0x9F,0xF7,0xFF), rgb_t(0xB0,0xFF,0xFF), rgb_t(0xC1,0xFF,0xFF ) + +define NTSC_GREEN_BLUE + rgb_t(0x00,0x24,0x0B), rgb_t(0x00,0x35,0x10), rgb_t(0x00,0x46,0x22), rgb_t(0x00,0x57,0x38), \ + rgb_t(0x05,0x68,0x4D), rgb_t(0x16,0x79,0x5E), rgb_t(0x27,0x8A,0x6F), rgb_t(0x38,0x9B,0x80), \ + rgb_t(0x49,0xAC,0x91), rgb_t(0x5A,0xBD,0xA2), rgb_t(0x6B,0xCE,0xB3), rgb_t(0x7C,0xDF,0xC4), \ + rgb_t(0x8D,0xF0,0xD5), rgb_t(0x9E,0xFF,0xE5), rgb_t(0xAF,0xFF,0xF1), rgb_t(0xC0,0xFF,0xFD ) + +define NTSC_GREEN + rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1B), \ + rgb_t(0x10,0x6B,0x1B), rgb_t(0x21,0x7C,0x2C), rgb_t(0x32,0x8D,0x3D), rgb_t(0x43,0x9E,0x4E), \ + rgb_t(0x54,0xAF,0x5F), rgb_t(0x65,0xC0,0x70), rgb_t(0x76,0xD1,0x81), rgb_t(0x87,0xE2,0x92), \ + rgb_t(0x98,0xF3,0xA3), rgb_t(0xA9,0xFF,0xB3), rgb_t(0xBA,0xFF,0xBF), rgb_t(0xCB,0xFF,0xCB ) + +define NTSC_YELLOW_GREEN + rgb_t(0x00,0x23,0x0A), rgb_t(0x00,0x34,0x10), rgb_t(0x04,0x45,0x13), rgb_t(0x15,0x56,0x13), \ + rgb_t(0x26,0x67,0x13), rgb_t(0x37,0x78,0x13), rgb_t(0x48,0x89,0x14), rgb_t(0x59,0x9A,0x25), \ + rgb_t(0x6A,0xAB,0x36), rgb_t(0x7B,0xBC,0x47), rgb_t(0x8C,0xCD,0x58), rgb_t(0x9D,0xDE,0x69), \ + rgb_t(0xAE,0xEF,0x7A), rgb_t(0xBF,0xFF,0x8B), rgb_t(0xD0,0xFF,0x97), rgb_t(0xE1,0xFF,0xA3 ) + +define NTSC_ORANGE_GREEN + rgb_t(0x00,0x17,0x07), rgb_t(0x0E,0x28,0x08), rgb_t(0x1F,0x39,0x08), rgb_t(0x30,0x4A,0x08), \ + rgb_t(0x41,0x5B,0x08), rgb_t(0x52,0x6C,0x08), rgb_t(0x63,0x7D,0x08), rgb_t(0x74,0x8E,0x0D), \ + rgb_t(0x85,0x9F,0x1E), rgb_t(0x96,0xB0,0x2F), rgb_t(0xA7,0xC1,0x40), rgb_t(0xB8,0xD2,0x51), \ + rgb_t(0xC9,0xE3,0x62), rgb_t(0xDA,0xF4,0x73), rgb_t(0xEB,0xFF,0x82), rgb_t(0xFC,0xFF,0x8E ) + +define NTSC_LIGHT_ORANGE + rgb_t(0x19,0x07,0x00), rgb_t(0x2A,0x18,0x00), rgb_t(0x3B,0x29,0x00), rgb_t(0x4C,0x3A,0x00), \ + rgb_t(0x5D,0x4B,0x00), rgb_t(0x6E,0x5C,0x00), rgb_t(0x7F,0x6D,0x00), rgb_t(0x90,0x7E,0x09), \ + rgb_t(0xA1,0x8F,0x1A), rgb_t(0xB2,0xA0,0x2B), rgb_t(0xC3,0xB1,0x3C), rgb_t(0xD4,0xC2,0x4D), \ + rgb_t(0xE5,0xD3,0x5E), rgb_t(0xF6,0xE4,0x6F), rgb_t(0xFF,0xF5,0x82), rgb_t(0xFF,0xFF,0x96 ) +***************************************************************************/ + + +/*************************************************************************** + PALETTE - 26.2 PHASE SHIFT + + +#define NTSC_GREY \ + rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ + rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ + rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ + rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) + +#define NTSC_GOLD \ + rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ + rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ + rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ + rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) + +#define NTSC_ORANGE \ + rgb_t(0x31,0x00,0x00), rgb_t(0x42,0x06,0x00), rgb_t(0x53,0x17,0x00), rgb_t(0x64,0x28,0x00), \ + rgb_t(0x75,0x39,0x00), rgb_t(0x86,0X4A,0x00), rgb_t(0x97,0x5B,0x0B), rgb_t(0xA8,0x6C,0x1C), \ + rgb_t(0xB9,0x7D,0x2D), rgb_t(0xCA,0x8E,0x3E), rgb_t(0xDB,0x9F,0x4F), rgb_t(0xEC,0xB0,0x60), \ + rgb_t(0xFD,0xC1,0x71), rgb_t(0xFF,0xD2,0x86), rgb_t(0xFF,0xE3,0x9D), rgb_t(0xFF,0xF4,0xB3 ) + +#define NTSC_RED_ORANGE \ + rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x08,0x00), rgb_t(0x71,0x19,0x00), \ + rgb_t(0x82,0x2A,0x0F), rgb_t(0x93,0x3B,0x20), rgb_t(0xA4,0x4C,0x31), rgb_t(0xB5,0x5D,0x42), \ + rgb_t(0xC6,0x6E,0x53), rgb_t(0xD7,0x7F,0x64), rgb_t(0xE8,0x90,0x75), rgb_t(0xF9,0xA1,0x86), \ + rgb_t(0xFF,0xB2,0x9A), rgb_t(0xFF,0xC3,0xB0), rgb_t(0xFF,0xD4,0xC6), rgb_t(0xFF,0xE5,0xDC ) + +#define NTSC_PINK \ + rgb_t(0x3E,0x00,0x06), rgb_t(0x4F,0x00,0x12), rgb_t(0x60,0x00,0x1E), rgb_t(0x71,0x0E,0x2E), \ + rgb_t(0x82,0x1F,0x3F), rgb_t(0x93,0x30,0x50), rgb_t(0xA4,0x41,0x61), rgb_t(0xB5,0x52,0x72), \ + rgb_t(0xC6,0x63,0x83), rgb_t(0xD7,0x74,0x94), rgb_t(0xE8,0x85,0xA5), rgb_t(0xF9,0x96,0xB6), \ + rgb_t(0xFF,0xA7,0xCB), rgb_t(0xFF,0xB8,0xE1), rgb_t(0xFF,0xC9,0xEF), rgb_t(0xFF,0xDA,0xF4 ) + +#define NTSC_PURPLE \ + rgb_t(0x32,0x00,0x38), rgb_t(0x43,0x00,0x44), rgb_t(0x54,0x00,0x50), rgb_t(0x65,0x0C,0x5F), \ + rgb_t(0x76,0x1D,0x70), rgb_t(0x87,0x2E,0x81), rgb_t(0x98,0x3F,0x92), rgb_t(0xA9,0x50,0xA3), \ + rgb_t(0xBA,0x61,0xB4), rgb_t(0xCB,0x72,0xC5), rgb_t(0xDC,0x83,0xD6), rgb_t(0xED,0x94,0xE4), \ + rgb_t(0xFE,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) + +#define NTSC_PURPLE_BLUE \ + rgb_t(0x1B,0x00,0x5F), rgb_t(0x2C,0x00,0x6B), rgb_t(0x3D,0x00,0x77), rgb_t(0x4E,0x11,0x88), \ + rgb_t(0x5F,0x22,0x99), rgb_t(0x70,0x33,0xAA), rgb_t(0x81,0x44,0xBB), rgb_t(0x92,0x55,0xCC), \ + rgb_t(0xA3,0x66,0xDD), rgb_t(0xB4,0x77,0xED), rgb_t(0xC5,0x88,0xED), rgb_t(0xD6,0x99,0xED), \ + rgb_t(0xE7,0xAA,0xED), rgb_t(0xF8,0xBB,0xED), rgb_t(0xFF,0xCC,0xF0), rgb_t(0xFF,0xDD,0xF5 ) + +#define NTSC_BLUE1 \ + rgb_t(0x00,0x00,0x72), rgb_t(0x10,0x00,0x7E), rgb_t(0x21,0x0D,0x8E), rgb_t(0x32,0x1E,0x9F), \ + rgb_t(0x43,0x2F,0xB0), rgb_t(0x54,0x40,0xC1), rgb_t(0x65,0x51,0xD2), rgb_t(0x76,0x62,0xE3), \ + rgb_t(0x87,0x73,0xF4), rgb_t(0x98,0x84,0xF9), rgb_t(0xA9,0x95,0xF9), rgb_t(0xBA,0xA6,0xF9), \ + rgb_t(0xCB,0xB7,0xF9), rgb_t(0xDC,0xC8,0xF9), rgb_t(0xED,0xD9,0xF9), rgb_t(0xFE,0xEA,0xF9 ) + +#define NTSC_BLUE2 \ + rgb_t(0x00,0x00,0x65), rgb_t(0x00,0x0C,0x7A), rgb_t(0x05,0x1D,0x8E), rgb_t(0x16,0x2E,0x9F), \ + rgb_t(0x27,0x3F,0xB0), rgb_t(0x38,0x50,0xC1), rgb_t(0x49,0x61,0xD2), rgb_t(0x5A,0x72,0xE3), \ + rgb_t(0x6B,0x83,0xF4), rgb_t(0x7C,0x94,0xFF), rgb_t(0x8D,0xA5,0xFF), rgb_t(0x9E,0xB6,0xFF), \ + rgb_t(0xAF,0xC7,0xFF), rgb_t(0xC0,0xD8,0xFF), rgb_t(0xD1,0xE9,0xFF), rgb_t(0xE2,0xFA,0xFF ) + +#define NTSC_LIGHT_BLUE \ + rgb_t(0x00,0x0D,0x48), rgb_t(0x00,0x1E,0x5E), rgb_t(0x00,0x2F,0x74), rgb_t(0x00,0x40,0x8A), \ + rgb_t(0x11,0x51,0x9B), rgb_t(0x22,0x62,0xAC), rgb_t(0x33,0x73,0xBD), rgb_t(0x44,0x84,0xCE), \ + rgb_t(0x55,0x95,0xDF), rgb_t(0x66,0xA6,0xF0), rgb_t(0x77,0xB7,0xFF), rgb_t(0x88,0xC8,0xFF), \ + rgb_t(0x99,0xD9,0xFF), rgb_t(0xAA,0xEA,0xFF), rgb_t(0xBB,0xFB,0xFF), rgb_t(0xCC,0xFF,0xFF ) + +#define NTSC_TURQUOISE \ + rgb_t(0x00,0x1C,0x1C), rgb_t(0x00,0x2D,0x32), rgb_t(0x00,0x3E,0x49), rgb_t(0x00,0x4F,0x5F), \ + rgb_t(0x05,0x60,0x73), rgb_t(0x16,0x71,0x84), rgb_t(0x27,0x82,0x95), rgb_t(0x38,0x93,0xA6), \ + rgb_t(0x49,0xA4,0xB7), rgb_t(0x5A,0xB5,0xC8), rgb_t(0x6B,0xC6,0xD9), rgb_t(0x7C,0xD7,0xEA), \ + rgb_t(0x8D,0xE8,0xFB), rgb_t(0x9E,0xF9,0xFF), rgb_t(0xAF,0xFF,0xFF), rgb_t(0xC0,0xFF,0xFF ) + +#define NTSC_GREEN_BLUE \ + rgb_t(0x00,0x25,0x0B), rgb_t(0x00,0x36,0x10), rgb_t(0x00,0x47,0x18), rgb_t(0x00,0x58,0x2E), \ + rgb_t(0x07,0x69,0x42), rgb_t(0x18,0x7A,0x53), rgb_t(0x29,0x8B,0x64), rgb_t(0x3A,0x9C,0x75), \ + rgb_t(0x4B,0xAD,0x86), rgb_t(0x5C,0xBE,0x97), rgb_t(0x6D,0xCF,0xA8), rgb_t(0x7E,0xE0,0xB9), \ + rgb_t(0x8F,0xF1,0xCA), rgb_t(0xA0,0xFF,0xDA), rgb_t(0xB1,0xFF,0xE6), rgb_t(0xC2,0xFF,0xF2 ) + +#define NTSC_GREEN \ + rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x04,0x5A,0x1A), \ + rgb_t(0x15,0x6B,0x1A), rgb_t(0x26,0x7C,0x22), rgb_t(0x37,0x8D,0x33), rgb_t(0x48,0x9E,0x44), \ + rgb_t(0x59,0xAF,0x55), rgb_t(0x6A,0xC0,0x66), rgb_t(0x7B,0xD1,0x77), rgb_t(0x8C,0xE2,0x88), \ + rgb_t(0x9D,0xF3,0x99), rgb_t(0xAE,0xFF,0xA8), rgb_t(0xBF,0xFF,0xB4), rgb_t(0xD0,0xFF,0xC0 ) + +#define NTSC_YELLOW_GREEN \ + rgb_t(0x00,0x21,0x0A), rgb_t(0x00,0x32,0x0F), rgb_t(0x0A,0x43,0x11), rgb_t(0x1B,0x54,0x11), \ + rgb_t(0x2C,0x65,0x11), rgb_t(0x3D,0x76,0x11), rgb_t(0x4E,0x87,0x11), rgb_t(0x5F,0x98,0x1E), \ + rgb_t(0x70,0xA9,0x2F), rgb_t(0x81,0xBA,0x40), rgb_t(0x92,0xCB,0x51), rgb_t(0xA3,0xDC,0x62), \ + rgb_t(0xB4,0xED,0x73), rgb_t(0xC5,0xFE,0x84), rgb_t(0xD6,0xFF,0x90), rgb_t(0xE7,0xFF,0x9C ) + +#define NTSC_ORANGE_GREEN \ + rgb_t(0x05,0x13,0x04), rgb_t(0x16,0x24,0x04), rgb_t(0x27,0x35,0x04), rgb_t(0x38,0x46,0x04), \ + rgb_t(0x49,0x57,0x04), rgb_t(0x5A,0x68,0x04), rgb_t(0x6B,0x79,0x04), rgb_t(0x7C,0x8A,0x09), \ + rgb_t(0x8D,0x9B,0x1A), rgb_t(0x9E,0xAC,0x2B), rgb_t(0xAF,0xBD,0x3C), rgb_t(0xC0,0xCE,0x4D), \ + rgb_t(0xD1,0xDF,0x5E), rgb_t(0xE2,0xF0,0x6F), rgb_t(0xF3,0xFF,0x80), rgb_t(0xFF,0xFF,0x8D ) + +#define NTSC_LIGHT_ORANGE \ + rgb_t(0x21,0x02,0x00), rgb_t(0x32,0x13,0x00), rgb_t(0x43,0x24,0x00), rgb_t(0x54,0x35,0x00), \ + rgb_t(0x65,0x46,0x00), rgb_t(0x76,0x57,0x00), rgb_t(0x87,0x68,0x00), rgb_t(0x98,0x79,0x0C), \ + rgb_t(0xA9,0x8A,0x1D), rgb_t(0xBA,0x9B,0x2E), rgb_t(0xCB,0xAC,0x3F), rgb_t(0xDC,0xBD,0x50), \ + rgb_t(0xED,0xCE,0x61), rgb_t(0xFE,0xDF,0x72), rgb_t(0xFF,0xF0,0x87), rgb_t(0xFF,0xFF,0x9D ) +***************************************************************************/ + + +/*************************************************************************** + PALETTE - 26.7 PHASE SHIFT + + +define NTSC_GREY + rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ + rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ + rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ + rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) + +define NTSC_GOLD + rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ + rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ + rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ + rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xFF,0x97 ) + +define NTSC_ORANGE + rgb_t(0x32,0x00,0x00), rgb_t(0x43,0x06,0x00), rgb_t(0x54,0x17,0x00), rgb_t(0x65,0x28,0x00), \ + rgb_t(0x79,0x39,0x00), rgb_t(0x87,0x4A,0x00), rgb_t(0x98,0x5B,0x0C), rgb_t(0xA9,0x6C,0x1D), \ + rgb_t(0xBA,0x7D,0x2E), rgb_t(0xCB,0x8E,0x3F), rgb_t(0xDC,0x9F,0x50), rgb_t(0xED,0xB0,0x61), \ + rgb_t(0xFE,0xC1,0x72), rgb_t(0xFF,0xD2,0x87), rgb_t(0xFF,0xE3,0x9E), rgb_t(0xFF,0xF4,0xB4 ) + +define NTSC_RED_ORANGE + rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x07,0x00), rgb_t(0x71,0x18,0x00), \ + rgb_t(0x82,0x29,0x10), rgb_t(0x93,0x3A,0x21), rgb_t(0xA4,0x4B,0x32), rgb_t(0xB5,0x5C,0x43), \ + rgb_t(0xC6,0x6D,0x54), rgb_t(0xD7,0x7E,0x65), rgb_t(0xE8,0x8F,0x76), rgb_t(0xF9,0xA0,0x87), \ + rgb_t(0xFF,0xB1,0x9C), rgb_t(0xFF,0xC2,0xB2), rgb_t(0xFF,0xD3,0xC8), rgb_t(0xFF,0xE4,0xDE ) + +define NTSC_PINK + rgb_t(0x3E,0x00,0x09), rgb_t(0x4F,0x00,0x15), rgb_t(0x60,0x00,0x21), rgb_t(0x71,0x0E,0x31), \ + rgb_t(0x82,0x1F,0x42), rgb_t(0x93,0x30,0x53), rgb_t(0xA4,0x41,0x64), rgb_t(0xB5,0x52,0x75), \ + rgb_t(0xC6,0x63,0x86), rgb_t(0xD7,0x74,0x97), rgb_t(0xE8,0x85,0xA8), rgb_t(0xF9,0x96,0xB9), \ + rgb_t(0xFF,0xA7,0xCE), rgb_t(0xFF,0xB8,0xE4), rgb_t(0xFF,0xC9,0xEF), rgb_t(0xFF,0xDA,0xF4 ) + +define NTSC_PURPLE + rgb_t(0x30,0x00,0x3D), rgb_t(0x41,0x00,0x48), rgb_t(0x52,0x00,0x54), rgb_t(0x63,0x0C,0x64), \ + rgb_t(0x74,0x1D,0x75), rgb_t(0x85,0x2E,0x86), rgb_t(0x96,0x3F,0x97), rgb_t(0xA7,0x50,0xA8), \ + rgb_t(0xB8,0x61,0xB9), rgb_t(0xC9,0x72,0xCA), rgb_t(0xDA,0x83,0xDB), rgb_t(0xEB,0x94,0xE5), \ + rgb_t(0xFC,0xA5,0xE5), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) + +define NTSC_PURPLE_BLUE + rgb_t(0x18,0x00,0x62), rgb_t(0x29,0x00,0x6E), rgb_t(0x3A,0x01,0x7A), rgb_t(0x4B,0x12,0x8B), \ + rgb_t(0x5C,0x23,0x9C), rgb_t(0x6D,0x34,0xAD), rgb_t(0x7E,0x45,0xBE), rgb_t(0x8F,0x56,0xCF), \ + rgb_t(0xA0,0x67,0xE0), rgb_t(0xB1,0x78,0xEE), rgb_t(0xC2,0x89,0xEE), rgb_t(0xD3,0x9A,0xEE), \ + rgb_t(0xE4,0xAB,0xEE), rgb_t(0xF5,0xBC,0xEE), rgb_t(0xFF,0xCD,0xE0), rgb_t(0xFF,0xDE,0xF5 ) + +define NTSC_BLUE1 + rgb_t(0x00,0x00,0x72), rgb_t(0x0C,0x00,0x7F), rgb_t(0x1D,0x0E,0x8F), rgb_t(0x2E,0x1F,0xA0), \ + rgb_t(0x3F,0x30,0xB1), rgb_t(0x50,0x41,0xC2), rgb_t(0x61,0x52,0xD3), rgb_t(0x72,0x63,0xE4), \ + rgb_t(0x83,0x74,0xF5), rgb_t(0x94,0x85,0xFA), rgb_t(0xA5,0x96,0xFA), rgb_t(0xB6,0xA7,0xFA), \ + rgb_t(0xC7,0xB8,0xFA), rgb_t(0xD8,0xC9,0xFA), rgb_t(0xE9,0xDA,0xFA), rgb_t(0xFA,0xE8,0xFA ) + +define NTSC_BLUE2 + rgb_t(0x00,0x00,0x62), rgb_t(0x00,0x0F,0x77), rgb_t(0x01,0x20,0x8D), rgb_t(0x12,0x31,0x9E), \ + rgb_t(0x23,0x42,0xAF), rgb_t(0x34,0x53,0xC0), rgb_t(0x45,0x64,0xD1), rgb_t(0x56,0x75,0xE2), \ + rgb_t(0x67,0x86,0xF3), rgb_t(0x78,0x97,0xFF), rgb_t(0x89,0xA8,0xFF), rgb_t(0x9A,0xB9,0xFF), \ + rgb_t(0xAB,0xCA,0xFF), rgb_t(0xBC,0xDB,0xFF), rgb_t(0xCD,0xEC,0xFF), rgb_t(0xDE,0xFD,0xFF ) + +define NTSC_LIGHT_BLUE + rgb_t(0x00,0x10,0x42), rgb_t(0x00,0x21,0x58), rgb_t(0x00,0x32,0x6E), rgb_t(0x00,0x43,0x84), \ + rgb_t(0x0E,0x54,0x96), rgb_t(0x1F,0x65,0xA7), rgb_t(0x30,0x76,0xB8), rgb_t(0x41,0x87,0xC9), \ + rgb_t(0x52,0x98,0xDA), rgb_t(0x63,0xA9,0xEB), rgb_t(0x74,0xBA,0xFC), rgb_t(0x85,0xCB,0xFF), \ + rgb_t(0x96,0xDC,0xFF), rgb_t(0xA7,0xED,0xFF), rgb_t(0xB8,0xFE,0xFF), rgb_t(0xC9,0xFF,0xFF ) + +define NTSC_TURQUOISE + rgb_t(0x00,0x1E,0x14), rgb_t(0x00,0x2F,0x2A), rgb_t(0x00,0x40,0x40), rgb_t(0x00,0x51,0x56), \ + rgb_t(0x04,0x62,0x6B), rgb_t(0x15,0x73,0x7C), rgb_t(0x26,0x84,0x8D), rgb_t(0x37,0x95,0x9E), \ + rgb_t(0x48,0xA6,0xAF), rgb_t(0x59,0xB7,0xC0), rgb_t(0x6A,0xC8,0xD1), rgb_t(0x7B,0xD9,0xE2), \ + rgb_t(0x8C,0xEA,0xF3), rgb_t(0x9D,0xFB,0xFF), rgb_t(0xAE,0xFF,0xFF), rgb_t(0xBF,0xFF,0xFF ) + +define NTSC_GREEN_BLUE + rgb_t(0x00,0x26,0x0B), rgb_t(0x00,0x37,0x10), rgb_t(0x00,0x48,0x16), rgb_t(0x00,0x59,0x25), \ + rgb_t(0x08,0x6A,0x38), rgb_t(0x19,0x7B,0x49), rgb_t(0x2A,0x8C,0x5A), rgb_t(0x3B,0x9D,0x6B), \ + rgb_t(0x4C,0xAE,0x7C), rgb_t(0x5D,0xBF,0x8D), rgb_t(0x6E,0xD0,0x9E), rgb_t(0x7F,0xE1,0xAF), \ + rgb_t(0x90,0xF2,0xC0), rgb_t(0xA1,0xFF,0xD0), rgb_t(0xB2,0xFF,0xDC), rgb_t(0xC3,0xFF,0xE8 ) + +define NTSC_GREEN + rgb_t(0x00,0x26,0x0B), rgb_t(0x00,0x37,0x10), rgb_t(0x00,0x48,0x16), rgb_t(0x08,0x59,0x18), \ + rgb_t(0x19,0x6A,0x18), rgb_t(0x2A,0x7B,0x18), rgb_t(0x3B,0x8C,0x29), rgb_t(0x4C,0x9D,0x3A), \ + rgb_t(0x5D,0xAE,0x4B), rgb_t(0x6E,0xBF,0x5C), rgb_t(0x7F,0xD0,0x6D), rgb_t(0x90,0xE1,0x7E), \ + rgb_t(0xA1,0xF2,0x8F), rgb_t(0xB2,0xFF,0x9F), rgb_t(0xC3,0xFF,0xAB), rgb_t(0xD4,0xFF,0xB7 ) + +define NTSC_YELLOW_GREEN + rgb_t(0x00,0x1E,0x09), rgb_t(0x00,0x2F,0x0E), rgb_t(0x11,0x40,0x0E), rgb_t(0x22,0x51,0x0E), \ + rgb_t(0x33,0x62,0x0E), rgb_t(0x44,0x73,0x0E), rgb_t(0x55,0x84,0x0E), rgb_t(0x66,0x95,0x17), \ + rgb_t(0x77,0xA6,0x28), rgb_t(0x88,0xB7,0x39), rgb_t(0x99,0xC8,0x4A), rgb_t(0xAA,0xD9,0x5B), \ + rgb_t(0xBB,0xEA,0x6C), rgb_t(0xCC,0xFB,0x7D), rgb_t(0xDD,0xFF,0x8A), rgb_t(0xEE,0xFF,0x96 ) + +define NTSC_ORANGE_GREEN + rgb_t(0x0D,0x0F,0x01), rgb_t(0x1E,0x20,0x01), rgb_t(0x2F,0x31,0x01), rgb_t(0x40,0x42,0x01), \ + rgb_t(0x51,0x53,0x01), rgb_t(0x62,0x64,0x01), rgb_t(0x73,0x75,0x01), rgb_t(0x84,0x86,0x08), \ + rgb_t(0x95,0x97,0x19), rgb_t(0xA6,0xA8,0x2A), rgb_t(0xB7,0xB9,0x3B), rgb_t(0xC8,0xCA,0x4C), \ + rgb_t(0xD9,0xDB,0x5D), rgb_t(0xEA,0xEC,0x6E), rgb_t(0xFB,0xFD,0x7F), rgb_t(0xFF,0xFF,0x8F ) + +define NTSC_LIGHT_ORANGE + rgb_t(0x28,0x00,0x00), rgb_t(0x39,0x0E,0x00), rgb_t(0x4A,0x1F,0x00), rgb_t(0x5B,0x30,0x00), \ + rgb_t(0x6C,0x41,0x00), rgb_t(0x7D,0x52,0x00), rgb_t(0x8E,0x63,0x00), rgb_t(0x9F,0x74,0x10), \ + rgb_t(0xB0,0x85,0x21), rgb_t(0xC1,0x96,0x32), rgb_t(0xD2,0xA7,0x43), rgb_t(0xE3,0xB8,0x54), \ + rgb_t(0xF4,0xC9,0x65), rgb_t(0xFF,0xDA,0x78), rgb_t(0xFF,0xEB,0x8E), rgb_t(0xFF,0xFC,0xA4 ) +***************************************************************************/ + + +/*************************************************************************** + PALETTE - 27.2 PHASE SHIFT + + +define NTSC_GREY + rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ + rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ + rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ + rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) + +define NTSC_GOLD + rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ + rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ + rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ + rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) + +define NTSC_ORANGE + rgb_t(0x32,0x00,0x00), rgb_t(0x43,0x05,0x00), rgb_t(0x54,0x16,0x00), rgb_t(0x65,0x27,0x00), \ + rgb_t(0x76,0x38,0x00), rgb_t(0x87,0X49,0x00), rgb_t(0x98,0x5A,0x0C), rgb_t(0xA9,0x6B,0x1D), \ + rgb_t(0xBA,0x7C,0x2E), rgb_t(0xCB,0x8D,0x3F), rgb_t(0xDC,0x9E,0x50), rgb_t(0xED,0xAF,0x61), \ + rgb_t(0xFE,0xC0,0x72), rgb_t(0xFF,0xD1,0x88), rgb_t(0xFF,0xE2,0x9E), rgb_t(0xFF,0xF3,0xB4 ) + +define NTSC_RED_ORANGE + rgb_t(0x3F,0x00,0x00), rgb_t(0x50,0x00,0x00), rgb_t(0x61,0x07,0x00), rgb_t(0x72,0x18,0x01), \ + rgb_t(0x83,0x29,0x12), rgb_t(0x94,0x3A,0x23), rgb_t(0xA5,0x4B,0x34), rgb_t(0xB6,0x5C,0x45), \ + rgb_t(0xC7,0x6D,0x56), rgb_t(0xD8,0x7E,0x67), rgb_t(0xE9,0x8F,0x78), rgb_t(0xFA,0xA0,0x89), \ + rgb_t(0xFF,0xB1,0x9E), rgb_t(0xFF,0xC2,0xB4), rgb_t(0xFF,0xD3,0xCA), rgb_t(0xFF,0xE4,0xE0 ) + +define NTSC_PINK + rgb_t(0x3E,0x00,0x0C), rgb_t(0x4F,0x00,0x18), rgb_t(0x60,0x00,0x24), rgb_t(0x71,0x0E,0x34), \ + rgb_t(0x82,0x1F,0x45), rgb_t(0x93,0x30,0x56), rgb_t(0xA4,0x41,0x67), rgb_t(0xB5,0x52,0x78), \ + rgb_t(0xC6,0x63,0x89), rgb_t(0xD7,0x74,0x9A), rgb_t(0xE8,0x85,0xAB), rgb_t(0xF9,0x96,0xB6), \ + rgb_t(0xFF,0xA7,0xD1), rgb_t(0xFF,0xB8,0xE7), rgb_t(0xFF,0xC9,0xEF), rgb_t(0xFF,0xDA,0xF4 ) + +define NTSC_PURPLE + rgb_t(0x2F,0x00,0x3F), rgb_t(0x40,0x00,0x4B), rgb_t(0x51,0x00,0x57), rgb_t(0x62,0x0C,0x66), \ + rgb_t(0x73,0x1D,0x77), rgb_t(0x84,0x2E,0x88), rgb_t(0x95,0x3F,0x99), rgb_t(0xA6,0x50,0xAA), \ + rgb_t(0xB7,0x61,0xBB), rgb_t(0xC8,0x72,0xCC), rgb_t(0xD9,0x83,0xDD), rgb_t(0xEA,0x94,0xE5), \ + rgb_t(0xFB,0xA5,0xE5), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) + +define NTSC_PURPLE_BLUE + rgb_t(0x16,0x00,0x64), rgb_t(0x27,0x00,0x70), rgb_t(0x38,0x02,0x7D), rgb_t(0x49,0x13,0x8E), \ + rgb_t(0x5A,0x24,0x9F), rgb_t(0x6B,0x35,0xB0), rgb_t(0x7C,0x46,0xC1), rgb_t(0x8D,0x57,0xD2), \ + rgb_t(0x9E,0x68,0xE3), rgb_t(0xAF,0x79,0xEF), rgb_t(0xC0,0x8A,0xEF), rgb_t(0xD1,0x9D,0xEF), \ + rgb_t(0xE2,0xAC,0xEF), rgb_t(0xF3,0xBD,0xEF), rgb_t(0xFF,0xCE,0xF0), rgb_t(0xFF,0xDF,0xF5 ) + +define NTSC_BLUE1 + rgb_t(0x00,0x00,0x71), rgb_t(0x09,0x00,0x7F), rgb_t(0x1A,0x10,0x90), rgb_t(0x2B,0x21,0xA1), \ + rgb_t(0x3C,0x32,0xB2), rgb_t(0x4D,0x43,0xC3), rgb_t(0x5E,0x54,0xD4), rgb_t(0x6F,0x65,0xE5), \ + rgb_t(0x80,0x76,0xF6), rgb_t(0x91,0x87,0xFC), rgb_t(0xA2,0x98,0xFC), rgb_t(0xB3,0xA9,0xFC), \ + rgb_t(0xC4,0xBA,0xFC), rgb_t(0xD5,0xCB,0xFC), rgb_t(0xE6,0xDC,0xFC), rgb_t(0xF7,0xED,0xFC ) + +define NTSC_BLUE2 + rgb_t(0x00,0x00,0x5E), rgb_t(0x00,0x11,0x74), rgb_t(0x00,0x22,0x8A), rgb_t(0x0F,0x33,0x9C), \ + rgb_t(0x20,0x44,0xAD), rgb_t(0x31,0x55,0xBE), rgb_t(0x42,0x66,0xCF), rgb_t(0x53,0x77,0xE0), \ + rgb_t(0x64,0x88,0xF1), rgb_t(0x75,0x99,0xFF), rgb_t(0x86,0xAA,0xFF), rgb_t(0x97,0xBB,0xFF), \ + rgb_t(0xA8,0xCC,0xFF), rgb_t(0xB9,0xDD,0xFF), rgb_t(0xCA,0xEE,0xFF), rgb_t(0xDB,0xFF,0xFF ) + +define NTSC_LIGHT_BLUE + rgb_t(0x00,0x12,0x3B), rgb_t(0x00,0x23,0x51), rgb_t(0x00,0x34,0x68), rgb_t(0x00,0x45,0x7E), \ + rgb_t(0x0C,0x56,0x90), rgb_t(0x1D,0x67,0xA1), rgb_t(0x2E,0x78,0xB2), rgb_t(0x3F,0x89,0xC3), \ + rgb_t(0x50,0x9A,0xD4), rgb_t(0x61,0xAB,0xE5), rgb_t(0x72,0xBC,0xF6), rgb_t(0x83,0xCD,0xFF), \ + rgb_t(0x94,0xDE,0xFF), rgb_t(0xA5,0xEF,0xFF), rgb_t(0xB6,0xFF,0xFF), rgb_t(0xC7,0xFF,0xFF ) + +define NTSC_TURQUOISE + rgb_t(0x00,0x20,0x0C), rgb_t(0x00,0x31,0x22), rgb_t(0x00,0x42,0x38), rgb_t(0x00,0x53,0x4E), \ + rgb_t(0x04,0x64,0x63), rgb_t(0x15,0x75,0x74), rgb_t(0x26,0x86,0x85), rgb_t(0x37,0x97,0x96), \ + rgb_t(0x48,0xA8,0xA7), rgb_t(0x59,0xB9,0xB8), rgb_t(0x6A,0xCA,0xC9), rgb_t(0x7B,0xDB,0xDA), \ + rgb_t(0x8C,0xEC,0xEB), rgb_t(0x9D,0xFD,0xFC), rgb_t(0xAE,0xFF,0xFF), rgb_t(0xBF,0xFF,0xFF ) + +define NTSC_GREEN_BLUE + rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1C), \ + rgb_t(0x0B,0x6B,0x2F), rgb_t(0x1C,0x7C,0x40), rgb_t(0x2D,0x8D,0x51), rgb_t(0x3E,0x9E,0x62), \ + rgb_t(0x4F,0xAF,0x73), rgb_t(0x60,0xC0,0x84), rgb_t(0x71,0xD1,0x95), rgb_t(0x82,0xE2,0xA6), \ + rgb_t(0x93,0xF3,0xB7), rgb_t(0xA4,0xFF,0xC6), rgb_t(0xB5,0xFF,0xD2), rgb_t(0xC6,0xFF,0xDE ) + +define NTSC_GREEN + rgb_t(0x00,0x25,0x0B), rgb_t(0x00,0x36,0x10), rgb_t(0x00,0x47,0x15), rgb_t(0x0D,0x58,0x16), \ + rgb_t(0x1E,0x69,0x16), rgb_t(0x2F,0x7A,0x16), rgb_t(0x40,0x8B,0x21), rgb_t(0x51,0x9C,0x32), \ + rgb_t(0x62,0xAD,0x43), rgb_t(0x73,0xBE,0x54), rgb_t(0x84,0xCF,0x65), rgb_t(0x95,0xE0,0x76), \ + rgb_t(0xA6,0xF1,0x87), rgb_t(0xB7,0xFF,0x98), rgb_t(0xC8,0xFF,0xA3), rgb_t(0xD9,0xFF,0xAF ) + +define NTSC_YELLOW_GREEN + rgb_t(0x00,0x1B,0x08), rgb_t(0x06,0x2C,0x0B), rgb_t(0x17,0x3D,0x0B), rgb_t(0x28,0x4E,0x0B), \ + rgb_t(0x39,0x5F,0x0B), rgb_t(0x4A,0x70,0x0B), rgb_t(0x5B,0x81,0x0B), rgb_t(0x6C,0x92,0x12), \ + rgb_t(0x7D,0xA3,0x23), rgb_t(0x8E,0xB4,0x34), rgb_t(0x9F,0xC5,0x45), rgb_t(0xB0,0xD6,0x56), \ + rgb_t(0xC1,0xE7,0x67), rgb_t(0xD2,0xF8,0x78), rgb_t(0xE3,0xFF,0x86), rgb_t(0xF4,0xFF,0x92 ) + +define NTSC_ORANGE_GREEN + rgb_t(0x13,0x0B,0x00), rgb_t(0x24,0x1C,0x00), rgb_t(0x35,0x2D,0x00), rgb_t(0x46,0x3E,0x00), \ + rgb_t(0x57,0x4F,0x00), rgb_t(0x68,0x60,0x00), rgb_t(0x79,0x71,0x00), rgb_t(0x8A,0x82,0x08), \ + rgb_t(0x9B,0x93,0x19), rgb_t(0xAC,0xA4,0x2A), rgb_t(0xBD,0xB5,0x3B), rgb_t(0xCE,0xC6,0x4C), \ + rgb_t(0xDF,0xD7,0x5D), rgb_t(0xF0,0xE8,0x6E), rgb_t(0xFF,0xF9,0x7F), rgb_t(0xFF,0xFF,0x92 ) + +define NTSC_LIGHT_ORANGE + rgb_t(0x2D,0x00,0x00), rgb_t(0x3E,0x0A,0x00), rgb_t(0x4F,0x1B,0x00), rgb_t(0x60,0x2C,0x00), \ + rgb_t(0x71,0x3D,0x00), rgb_t(0x82,0x4E,0x00), rgb_t(0x93,0x5F,0x05), rgb_t(0xA4,0x70,0x16), \ + rgb_t(0xB5,0x81,0x27), rgb_t(0xC4,0x90,0x37), rgb_t(0xD7,0xA3,0x49), rgb_t(0xE8,0xB4,0x5A), \ + rgb_t(0xF9,0xC5,0x6B), rgb_t(0xFF,0xD6,0x80), rgb_t(0xFF,0xE7,0x96), rgb_t(0xFF,0xF8,0xAC ) +***************************************************************************/ + + +/*************************************************************************** + PALETTE - 27.7 PHASE SHIFT + + +define NTSC_GREY + rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ + rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ + rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ + rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) + +define NTSC_GOLD + rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ + rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ + rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ + rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xFF,0x97 ) + +define NTSC_ORANGE + rgb_t(0x32,0x00,0x00), rgb_t(0x43,0x05,0x00), rgb_t(0x54,0x16,0x00), rgb_t(0x65,0x27,0x00), \ + rgb_t(0x76,0x38,0x00), rgb_t(0x87,0x49,0x00), rgb_t(0x98,0x5A,0x0C), rgb_t(0xA9,0x6B,0x1D), \ + rgb_t(0xBA,0x7C,0x2E), rgb_t(0xCB,0x8D,0x3F), rgb_t(0xDC,0x9E,0x50), rgb_t(0xED,0xAF,0x61), \ + rgb_t(0xFE,0xC0,0x72), rgb_t(0xFF,0xD1,0x88), rgb_t(0xFF,0xE2,0x9E), rgb_t(0xFF,0xF3,0xB4 ) + +define NTSC_RED_ORANGE + rgb_t(0x3F,0x00,0x00), rgb_t(0x50,0x00,0x00), rgb_t(0x61,0x06,0x00), rgb_t(0x72,0x17,0x03), \ + rgb_t(0x83,0x28,0x14), rgb_t(0x94,0x39,0x25), rgb_t(0xA5,0x4A,0x36), rgb_t(0xB6,0x5B,0x47), \ + rgb_t(0xC7,0x6C,0x58), rgb_t(0xD8,0x7D,0x69), rgb_t(0xE9,0x8E,0x7A), rgb_t(0xFA,0x9F,0x8B), \ + rgb_t(0xFF,0xB0,0x9F), rgb_t(0xFF,0xC1,0xB5), rgb_t(0xFF,0xD2,0xCB), rgb_t(0xFF,0xE3,0xE1 ) + +define NTSC_PINK + rgb_t(0x3D,0x00,0x10), rgb_t(0x4E,0x00,0x1C), rgb_t(0x5F,0x00,0x27), rgb_t(0x70,0x0D,0x37), \ + rgb_t(0x81,0x1E,0x48), rgb_t(0x92,0x2F,0x59), rgb_t(0xA3,0x40,0x6A), rgb_t(0xB4,0x51,0x7B), \ + rgb_t(0xC5,0x62,0x8C), rgb_t(0xD6,0x73,0x9D), rgb_t(0xE7,0x84,0xAE), rgb_t(0xF8,0x95,0xBF), \ + rgb_t(0xFF,0xA6,0xD3), rgb_t(0xFF,0xB7,0xE9), rgb_t(0xFF,0xC8,0xEE), rgb_t(0xFF,0xD9,0xF4 ) + +define NTSC_PURPLE + rgb_t(0x2D,0x00,0x42), rgb_t(0x3E,0x00,0x4E), rgb_t(0x4F,0x00,0x5A), rgb_t(0x60,0x0C,0x6A), \ + rgb_t(0x71,0x1D,0x7B), rgb_t(0x82,0x2E,0x8C), rgb_t(0x93,0x3F,0x9D), rgb_t(0xA4,0x50,0xAE), \ + rgb_t(0xB5,0x61,0xBF), rgb_t(0xC6,0x72,0xD0), rgb_t(0xD7,0x83,0xE1), rgb_t(0xE8,0x94,0xE6), \ + rgb_t(0xF9,0xA5,0xE6), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) + +define NTSC_PURPLE_BLUE + rgb_t(0x13,0x00,0x67), rgb_t(0x24,0x00,0x73), rgb_t(0x35,0x03,0x80), rgb_t(0x46,0x14,0x91), \ + rgb_t(0x57,0x25,0xA2), rgb_t(0x68,0x36,0xB3), rgb_t(0x79,0x47,0xC4), rgb_t(0x8A,0x58,0xD5), \ + rgb_t(0x9B,0x69,0xE6), rgb_t(0xAC,0x7A,0xF0), rgb_t(0xBD,0x8B,0xF0), rgb_t(0xCE,0x9C,0xF0), \ + rgb_t(0xDF,0xAD,0xF0), rgb_t(0xF0,0xBE,0xF0), rgb_t(0xFF,0xCF,0xF1), rgb_t(0xFF,0xE0,0xF6 ) + +define NTSC_BLUE1 + rgb_t(0x00,0x00,0x70), rgb_t(0x05,0x01,0x80), rgb_t(0x16,0x12,0x91), rgb_t(0x27,0x23,0xA2), \ + rgb_t(0x38,0x34,0xB3), rgb_t(0x49,0x45,0xC4), rgb_t(0x5A,0x56,0xD5), rgb_t(0x6B,0x67,0xE6), \ + rgb_t(0x7C,0x78,0xF7), rgb_t(0x8D,0x89,0xFE), rgb_t(0x9E,0x9A,0xFE), rgb_t(0xAF,0xAB,0xFE), \ + rgb_t(0xC0,0xBC,0xFE), rgb_t(0xD1,0xCD,0xFE), rgb_t(0xE2,0xDE,0xFE), rgb_t(0xF3,0xEF,0xFE ) + +define NTSC_BLUE2 + rgb_t(0x00,0x03,0x5B), rgb_t(0x00,0x14,0x71), rgb_t(0x00,0x25,0x87), rgb_t(0x0C,0x36,0x9A), \ + rgb_t(0x1D,0x47,0xAB), rgb_t(0x2E,0x58,0xBC), rgb_t(0x3F,0x69,0xCD), rgb_t(0x50,0x7A,0xDE), \ + rgb_t(0x61,0x8B,0xEF), rgb_t(0x72,0x9C,0xFF), rgb_t(0x83,0xAD,0xFF), rgb_t(0x94,0xBE,0xFF), \ + rgb_t(0xA5,0xCF,0xFF), rgb_t(0xB6,0xE0,0xFF), rgb_t(0xC7,0xF1,0xFF), rgb_t(0xD8,0xFF,0xFF ) + +define NTSC_LIGHT_BLUE + rgb_t(0x00,0x15,0x35), rgb_t(0x00,0x26,0x4B), rgb_t(0x00,0x37,0x61), rgb_t(0x00,0x48,0x78), \ + rgb_t(0x0A,0x59,0x8B), rgb_t(0x1B,0x6A,0x9C), rgb_t(0x2C,0x7B,0xAD), rgb_t(0x3D,0x8C,0xBE), \ + rgb_t(0x4E,0x9D,0xCF), rgb_t(0x5F,0xAE,0xE0), rgb_t(0x70,0xBF,0xF1), rgb_t(0x81,0xD0,0xFF), \ + rgb_t(0x92,0xE1,0xFF), rgb_t(0xA3,0xF2,0xFF), rgb_t(0xB4,0xFF,0xFF), rgb_t(0xC5,0xFF,0xFF ) + +define NTSC_TURQUOISE + rgb_t(0x00,0x22,0x0A), rgb_t(0x00,0x33,0x19), rgb_t(0x00,0x44,0x2F), rgb_t(0x00,0x55,0x45), \ + rgb_t(0x04,0x66,0x5A), rgb_t(0x15,0x77,0x6B), rgb_t(0x26,0x88,0x7C), rgb_t(0x37,0x99,0x8D), \ + rgb_t(0x48,0xAA,0x9E), rgb_t(0x59,0xBB,0xAF), rgb_t(0x6A,0xCC,0xC0), rgb_t(0x7B,0xDD,0xD1), \ + rgb_t(0x8C,0xEE,0xE2), rgb_t(0x9D,0xFF,0xF3), rgb_t(0xAE,0xFF,0xFF), rgb_t(0xBF,0xFF,0xFF ) + +define NTSC_GREEN_BLUE + rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1B), \ + rgb_t(0x0D,0x6B,0x25), rgb_t(0x1E,0x7C,0x36), rgb_t(0x2F,0x8D,0x47), rgb_t(0x40,0x9E,0x58), \ + rgb_t(0x51,0xAF,0x69), rgb_t(0x62,0xC0,0x7A), rgb_t(0x73,0xD1,0x8B), rgb_t(0x84,0xE2,0x9C), \ + rgb_t(0x95,0xF3,0xAD), rgb_t(0xA6,0xFF,0xBD), rgb_t(0xB7,0xFF,0xC9), rgb_t(0xC8,0xFF,0xD4 ) + +define NTSC_GREEN + rgb_t(0x00,0x24,0x0B), rgb_t(0x00,0x35,0x10), rgb_t(0x01,0x46,0x15), rgb_t(0x12,0x57,0x15), \ + rgb_t(0x23,0x68,0x15), rgb_t(0x34,0x79,0x15), rgb_t(0x45,0x8A,0x19), rgb_t(0x56,0x9B,0x2A), \ + rgb_t(0x67,0xAC,0x3B), rgb_t(0x78,0xBD,0x4C), rgb_t(0x89,0xCE,0x5D), rgb_t(0x9A,0xDF,0x6E), \ + rgb_t(0xAB,0xF0,0x7F), rgb_t(0xBC,0xFF,0x8F), rgb_t(0xCD,0xFF,0x9B), rgb_t(0xDE,0xFF,0xA7 ) + +define NTSC_YELLOW_GREEN + rgb_t(0x00,0x18,0x07), rgb_t(0x00,0x29,0x0C), rgb_t(0x1E,0x3A,0x08), rgb_t(0x2F,0x4B,0x08), \ + rgb_t(0x40,0x5C,0x08), rgb_t(0x51,0x6D,0x08), rgb_t(0x62,0x7E,0x08), rgb_t(0x73,0x8F,0x0D), \ + rgb_t(0x84,0xA0,0x1E), rgb_t(0x95,0xB1,0x2F), rgb_t(0xA6,0xC2,0x40), rgb_t(0xB7,0xD3,0x51), \ + rgb_t(0xC8,0xE4,0x62), rgb_t(0xD9,0xF5,0x73), rgb_t(0xEA,0xFF,0x82), rgb_t(0xFB,0xFF,0x8E ) + +define NTSC_ORANGE_GREEN + rgb_t(0x1B,0x07,0x00), rgb_t(0x2C,0x18,0x00), rgb_t(0x3D,0x29,0x00), rgb_t(0x4E,0x3A,0x00), \ + rgb_t(0x5F,0x4B,0x00), rgb_t(0x70,0x5C,0x00), rgb_t(0x81,0x6D,0x00), rgb_t(0x92,0x7E,0x09), \ + rgb_t(0xA3,0x8F,0x1A), rgb_t(0xB4,0xA0,0x2B), rgb_t(0xC5,0xB1,0x3C), rgb_t(0xD6,0xC2,0x4D), \ + rgb_t(0xE7,0xD3,0x5E), rgb_t(0xF8,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xFF,0x97 ) + +define NTSC_LIGHT_ORANGE + rgb_t(0x33,0x00,0x00), rgb_t(0x44,0x05,0x00), rgb_t(0x55,0x16,0x00), rgb_t(0x66,0x27,0x00), \ + rgb_t(0x77,0x38,0x00), rgb_t(0x88,0x49,0x00), rgb_t(0x99,0x5A,0x0D), rgb_t(0xAA,0x6B,0x1E), \ + rgb_t(0xBB,0x7C,0x2F), rgb_t(0xCC,0x8D,0x40), rgb_t(0xDD,0x9E,0x51), rgb_t(0xEE,0xAF,0x62), \ + rgb_t(0xFF,0xC0,0x73), rgb_t(0xFF,0xD1,0x89), rgb_t(0xFF,0xE2,0x9F), rgb_t(0xFF,0xF3,0xB5 ) +***************************************************************************/ + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(a7800_state, a7800) +{ + palette.set_pen_colors(0, a7800_palette, ARRAY_LENGTH(a7800_palette)); +} + + +PALETTE_INIT_MEMBER(a7800_state,a7800p) +{ + palette.set_pen_colors(0, a7800p_palette, ARRAY_LENGTH(a7800p_palette)); +} + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +void a7800_state::machine_start() +{ + save_item(NAME(m_p1_one_button)); + save_item(NAME(m_p2_one_button)); + save_item(NAME(m_bios_enabled)); + save_item(NAME(m_ctrl_lock)); + save_item(NAME(m_ctrl_reg)); + save_item(NAME(m_maria_flag)); + + // set up RAM mirrors + UINT8 *ram = reinterpret_cast(memshare("6116_2")->ptr()); + membank("zpmirror")->set_base(ram + 0x0040); + membank("spmirror")->set_base(ram + 0x0140); + + // install additional handlers, if needed + if (m_cart->exists()) + { + switch (m_cart->get_cart_type()) + { + case A78_HSC: + // ROM+NVRAM accesses for HiScore + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x17ff, read8_delegate(FUNC(a78_cart_slot_device::read_10xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_10xx),(a78_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x3000, 0x3fff, read8_delegate(FUNC(a78_cart_slot_device::read_30xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_30xx),(a78_cart_slot_device*)m_cart)); + break; + case A78_XB_BOARD: + case A78_TYPE0_POK450: + case A78_TYPE1_POK450: + case A78_TYPE6_POK450: + case A78_TYPEA_POK450: + case A78_VERSA_POK450: + // POKEY and RAM regs at 0x400-0x47f + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0400, 0x047f, read8_delegate(FUNC(a78_cart_slot_device::read_04xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_04xx),(a78_cart_slot_device*)m_cart)); + break; + case A78_XM_BOARD: + // POKEY and RAM and YM regs at 0x400-0x47f + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0400, 0x047f, read8_delegate(FUNC(a78_cart_slot_device::read_04xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_04xx),(a78_cart_slot_device*)m_cart)); + // ROM+NVRAM accesses for HiScore + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x17ff, read8_delegate(FUNC(a78_cart_slot_device::read_10xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_10xx),(a78_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x3000, 0x3fff, read8_delegate(FUNC(a78_cart_slot_device::read_30xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_30xx),(a78_cart_slot_device*)m_cart)); + break; + } + } +} + +void a7800_state::machine_reset() +{ + m_ctrl_lock = 0; + m_ctrl_reg = 0; + m_maria_flag = 0; + m_bios_enabled = 0; +} + +static MACHINE_CONFIG_START( a7800_ntsc, a7800_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, A7800_NTSC_Y1/8) /* 1.79 MHz (switches to 1.19 MHz on TIA or RIOT access) */ + MCFG_CPU_PROGRAM_MAP(a7800_mem) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a7800_state, interrupt, "screen", 0, 1) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( 7159090, 454, 0, 320, 263, 27, 27 + 192 + 32 ) + MCFG_SCREEN_UPDATE_DEVICE("maria", atari_maria_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(a7800_palette) / 3) + MCFG_PALETTE_INIT_OWNER(a7800_state, a7800) + + MCFG_DEVICE_ADD("maria", ATARI_MARIA, 0) + MCFG_MARIA_DMACPU("maincpu") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_TIA_ADD("tia", 31400) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_DEVICE_ADD("riot", MOS6532n, A7800_NTSC_Y1/8) + MCFG_MOS6530n_IN_PA_CB(READ8(a7800_state, riot_joystick_r)) + MCFG_MOS6530n_IN_PB_CB(READ8(a7800_state, riot_console_button_r)) + MCFG_MOS6530n_OUT_PB_CB(WRITE8(a7800_state, riot_button_pullup_w)) + + MCFG_A78_CARTRIDGE_ADD("cartslot", a7800_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","a7800") + MCFG_SOFTWARE_LIST_FILTER("cart_list","NTSC") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( a7800_pal, a7800_ntsc ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(CLK_PAL) +// MCFG_TIMER_ADD_SCANLINE("scantimer", a7800_interrupt, "screen", 0, 1) + + MCFG_SCREEN_MODIFY( "screen" ) + MCFG_SCREEN_RAW_PARAMS( 7093788, 454, 0, 320, 313, 35, 35 + 228 + 32 ) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(a7800_state, a7800p ) + + /* devices */ + MCFG_DEVICE_REMOVE("riot") + MCFG_DEVICE_ADD("riot", MOS6532n, CLK_PAL) + MCFG_MOS6530n_IN_PA_CB(READ8(a7800_state, riot_joystick_r)) + MCFG_MOS6530n_IN_PB_CB(READ8(a7800_state, riot_console_button_r)) + MCFG_MOS6530n_OUT_PB_CB(WRITE8(a7800_state, riot_button_pullup_w)) + + /* software lists */ + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list","a7800") + MCFG_SOFTWARE_LIST_FILTER("cart_list","PAL") +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( a7800 ) + ROM_REGION(0x4000, "maincpu", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "a7800", "Atari 7800" ) + ROMX_LOAD("7800.u7", 0x3000, 0x1000, CRC(5d13730c) SHA1(d9d134bb6b36907c615a594cc7688f7bfcef5b43), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "a7800pr", "Atari 7800 (prototype with Asteroids)" ) + ROMX_LOAD("c300558-001a.u7", 0x0000, 0x4000, CRC(a0e10edf) SHA1(14584b1eafe9721804782d4b1ac3a4a7313e455f), ROM_BIOS(2)) +ROM_END + +ROM_START( a7800p ) + ROM_REGION(0x4000, "maincpu", ROMREGION_ERASEFF) + ROM_LOAD("7800pal.rom", 0x0000, 0x4000, CRC(d5b61170) SHA1(5a140136a16d1d83e4ff32a19409ca376a8df874)) +ROM_END + + +/*************************************************************************** + DRIVER INIT + ***************************************************************************/ + +DRIVER_INIT_MEMBER(a7800_state,a7800_ntsc) +{ + m_ispal = FALSE; + m_lines = 263; + m_p1_one_button = 1; + m_p2_one_button = 1; +} + + +DRIVER_INIT_MEMBER(a7800_state,a7800_pal) +{ + m_ispal = TRUE; + m_lines = 313; + m_p1_one_button = 1; + m_p2_one_button = 1; +} + + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1986, a7800, 0, 0, a7800_ntsc, a7800, a7800_state, a7800_ntsc, "Atari", "Atari 7800 (NTSC)" , 0) +CONS( 1986, a7800p, a7800, 0, a7800_pal, a7800, a7800_state, a7800_pal, "Atari", "Atari 7800 (PAL)" , 0) diff --git a/src/mame/drivers/abc1600.c b/src/mame/drivers/abc1600.c new file mode 100644 index 00000000000..bdaa4823471 --- /dev/null +++ b/src/mame/drivers/abc1600.c @@ -0,0 +1,967 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Luxor ABC 1600 + + How to create HDD image: + ------------------------ + chdman createhd -chs 615,4,17 -ss 512 -o necd5126a.chd + + How to format HDD: + ------------------ + mf(2,0) + mf(2,0) + abcenix + sas/format/format + sa(40,0) + y + 5 + necd5126a + + How to install OS: + ------------------ + mf(2,0) + mf(2,0) + abcenix + loadsys1 + + + +*/ + +/* + + TODO: + + - short/long reset (RSTBUT) + - CIO + - optimize timers! + - port C, open drain output bit PC1 (RTC/NVRAM data) + - hard disk + - 4105 SASI interface card + - SASI interface (scsibus.c) + - connect RS-232 port A + +*/ + +#include "includes/abc1600.h" + + + +//************************************************************************** +// CONSTANTS / MACROS +//************************************************************************** + +#define LOG 0 + + +#define A1 BIT(offset, 1) +#define A2 BIT(offset, 2) +#define A4 BIT(offset, 4) +#define X11 BIT(offset, 11) +#define A1_A2 ((A1 << 1) | A2) +#define A2_A1 ((offset >> 1) & 0x03) + + +// external I/O +enum +{ + INP = 0, + STAT, + OPS +}; + +enum +{ + OUT = 0, + C1 = 2, + C2, + C3, + C4 +}; + + + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// bus_r - +//------------------------------------------------- + +READ8_MEMBER( abc1600_state::bus_r ) +{ + UINT8 data = 0; + + // card select pulse + UINT8 cs = (m_cs7 << 7) | ((offset >> 5) & 0x3f); + + m_bus0i->cs_w(cs); + m_bus0x->cs_w(cs); + m_bus1->cs_w(cs); + m_bus2->cs_w(cs); + + // card select b? + m_csb = m_bus2->csb_r(); + m_csb |= m_bus1->csb_r() << 1; + m_csb |= m_bus0x->xcsb2_r() << 2; + m_csb |= m_bus0x->xcsb3_r() << 3; + m_csb |= m_bus0x->xcsb4_r() << 4; + m_csb |= m_bus0x->xcsb5_r() << 5; + m_csb |= m_bus0x->csb_r() << 6; + m_csb |= m_bus0i->csb_r() << 7; + + m_bus0 = !((m_csb & 0xfc) == 0xfc); + + if (X11) + { + if (A4) + { + // EXP + data = m_bus0x->exp_r(); + + if (LOG) logerror("%s EXP %02x: %02x\n", machine().describe_context(), cs, data); + } + else + { + // RCSB + if (m_bus0) + { + /* + + bit description + + 0 1 + 1 1 + 2 LXCSB2* + 3 LXCSB3* + 4 LXCSB4* + 5 LXCSB5* + 6 LCSB*-0 + 7 LCSB*-0I + + */ + + data = (m_csb & 0xfc) | 0x03; + } + else + { + /* + + bit description + + 0 LCSB*-2 + 1 LCSB*-1 + 2 1 + 3 1 + 4 1 + 5 1 + 6 1 + 7 1 + + */ + + data = 0xfc | (m_csb & 0x03); + } + + if (LOG) logerror("%s RCSB %02x\n", machine().describe_context(), data); + } + } + else + { + data = 0xff; + + switch ((offset >> 1) & 0x07) + { + case INP: + if (m_bus0) + { + data &= m_bus0i->inp_r(); + data &= m_bus0x->inp_r(); + } + else + { + data &= m_bus1->inp_r(); + data &= m_bus2->inp_r(); + } + + if (LOG) logerror("%s INP %02x: %02x\n", machine().describe_context(), cs, data); + break; + + case STAT: + if (m_bus0) + { + data &= m_bus0i->stat_r(); + data &= m_bus0x->stat_r(); + } + else + { + data &= m_bus1->stat_r(); + data &= m_bus2->stat_r(); + } + + if (LOG) logerror("%s STAT %02x: %02x\n", machine().describe_context(), cs, data); + break; + + case OPS: + if (m_bus0) + { + data &= m_bus0i->ops_r(); + data &= m_bus0x->ops_r(); + } + else + { + data &= m_bus1->ops_r(); + data &= m_bus2->ops_r(); + } + + if (LOG) logerror("%s OPS %02x: %02x\n", machine().describe_context(), cs, data); + break; + + default: + if (LOG) logerror("%s Unmapped read from virtual I/O %06x\n", machine().describe_context(), offset); + } + } + + return data; +} + + +//------------------------------------------------- +// bus_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_state::bus_w ) +{ + UINT8 cs = (m_cs7 << 7) | ((offset >> 5) & 0x3f); + + m_bus0i->cs_w(cs); + m_bus0x->cs_w(cs); + m_bus1->cs_w(cs); + m_bus2->cs_w(cs); + + switch ((offset >> 1) & 0x07) + { + case OUT: + if (LOG) logerror("%s OUT %02x: %02x\n", machine().describe_context(), cs, data); + + if (m_bus0) + { + m_bus0i->out_w(data); + m_bus0x->out_w(data); + } + else + { + m_bus1->out_w(data); + m_bus2->out_w(data); + } + break; + + case C1: + if (LOG) logerror("%s C1 %02x: %02x\n", machine().describe_context(), cs, data); + + if (m_bus0) + { + m_bus0i->c1_w(data); + m_bus0x->c1_w(data); + } + else + { + m_bus1->c1_w(data); + m_bus2->c1_w(data); + } + break; + + case C2: + if (LOG) logerror("%s C2 %02x: %02x\n", machine().describe_context(), cs, data); + + if (m_bus0) + { + m_bus0i->c2_w(data); + m_bus0x->c2_w(data); + } + else + { + m_bus1->c2_w(data); + m_bus2->c2_w(data); + } + break; + + case C3: + if (LOG) logerror("%s C3 %02x: %02x\n", machine().describe_context(), cs, data); + + if (m_bus0) + { + m_bus0i->c3_w(data); + m_bus0x->c3_w(data); + } + else + { + m_bus1->c3_w(data); + m_bus2->c3_w(data); + } + break; + + case C4: + if (LOG) logerror("%s C4 %02x: %02x\n", machine().describe_context(), cs, data); + + if (m_bus0) + { + m_bus0i->c4_w(data); + m_bus0x->c4_w(data); + } + else + { + m_bus1->c4_w(data); + m_bus2->c4_w(data); + } + break; + + default: + if (LOG) logerror("%s Unmapped write %02x to virtual I/O %06x\n", machine().describe_context(), data, offset); + } +} + + +//------------------------------------------------- +// fw0_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_state::fw0_w ) +{ + /* + + bit description + + 0 SEL1 + 1 SEL2 + 2 SEL3 + 3 MOTOR + 4 LC/PC + 5 LC/PC + 6 + 7 + + */ + + if (LOG) logerror("FW0 %02x\n", data); + + // drive select + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + + m_fdc->set_floppy(floppy); + + // floppy motor + if (floppy) floppy->mon_w(!BIT(data, 3)); +} + + +//------------------------------------------------- +// fw1_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_state::fw1_w ) +{ + /* + + bit description + + 0 MR + 1 DDEN + 2 HLT + 3 MINI + 4 HLD + 5 P0 + 6 P1 + 7 P2 + + */ + + if (LOG) logerror("FW1 %02x\n", data); + + // FDC master reset + if (!BIT(data, 0)) m_fdc->reset(); + + // density select + m_fdc->dden_w(BIT(data, 1)); +} + + +//------------------------------------------------- +// spec_contr_reg_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_state::spec_contr_reg_w ) +{ + int state = BIT(data, 3); + + switch (data & 0x07) + { + case 0: // CS7 + m_cs7 = state; + break; + + case 1: + break; + + case 2: // _BTCE + m_btce = state; + break; + + case 3: // _ATCE + m_atce = state; + break; + + case 4: // PARTST + m_partst = state; + break; + + case 5: // _DMADIS + m_dmadis = state; + break; + + case 6: // SYSSCC + m_sysscc = state; + + m_cio->pb5_w(!state); + m_bus1->pren_w(!state); + + update_drdy1(); + break; + + case 7: // SYSFS + m_sysfs = state; + + m_cio->pb6_w(!state); + m_bus0i->pren_w(!state); + m_bus0x->pren_w(!state); + + update_drdy0(); + break; + } +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( abc1600_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc1600_mem, AS_PROGRAM, 8, abc1600_state ) + AM_RANGE(0x00000, 0xfffff) AM_DEVICE(ABC1600_MAC_TAG, abc1600_mac_device, map) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( mac_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( mac_mem, AS_PROGRAM, 8, abc1600_state ) + AM_RANGE(0x000000, 0x0fffff) AM_RAM + AM_RANGE(0x100000, 0x17ffff) AM_DEVICE(ABC1600_MOVER_TAG, abc1600_mover_device, vram_map) + AM_RANGE(0x1fe000, 0x1fefff) AM_READWRITE(bus_r, bus_w) + AM_RANGE(0x1ff000, 0x1ff000) AM_MIRROR(0xf9) AM_DEVREADWRITE(SAB1797_02P_TAG, fd1797_t, status_r, cmd_w) + AM_RANGE(0x1ff002, 0x1ff002) AM_MIRROR(0xf9) AM_DEVREADWRITE(SAB1797_02P_TAG, fd1797_t, track_r, track_w) + AM_RANGE(0x1ff004, 0x1ff004) AM_MIRROR(0xf9) AM_DEVREADWRITE(SAB1797_02P_TAG, fd1797_t, sector_r, sector_w) + AM_RANGE(0x1ff006, 0x1ff006) AM_MIRROR(0xf9) AM_DEVREADWRITE(SAB1797_02P_TAG, fd1797_t, data_r, data_w) + AM_RANGE(0x1ff100, 0x1ff101) AM_MIRROR(0xfe) AM_DEVICE(ABC1600_MOVER_TAG, abc1600_mover_device, crtc_map) + AM_RANGE(0x1ff200, 0x1ff207) AM_MIRROR(0xf8) AM_READWRITE(dart_r, dart_w) + AM_RANGE(0x1ff300, 0x1ff300) AM_MIRROR(0xff) AM_DEVREADWRITE(Z8410AB1_0_TAG, z80dma_device, read, write) + AM_RANGE(0x1ff400, 0x1ff400) AM_MIRROR(0xff) AM_DEVREADWRITE(Z8410AB1_1_TAG, z80dma_device, read, write) + AM_RANGE(0x1ff500, 0x1ff500) AM_MIRROR(0xff) AM_DEVREADWRITE(Z8410AB1_2_TAG, z80dma_device, read, write) + AM_RANGE(0x1ff600, 0x1ff607) AM_MIRROR(0xf8) AM_READWRITE(scc_r, scc_w) + AM_RANGE(0x1ff700, 0x1ff707) AM_MIRROR(0xf8) AM_READWRITE(cio_r, cio_w) + AM_RANGE(0x1ff800, 0x1ffaff) AM_DEVICE(ABC1600_MOVER_TAG, abc1600_mover_device, io_map) + AM_RANGE(0x1ffb00, 0x1ffb00) AM_MIRROR(0x7e) AM_WRITE(fw0_w) + AM_RANGE(0x1ffb01, 0x1ffb01) AM_MIRROR(0x7e) AM_WRITE(fw1_w) + AM_RANGE(0x1ffd00, 0x1ffd07) AM_MIRROR(0xf8) AM_DEVWRITE(ABC1600_MAC_TAG, abc1600_mac_device, dmamap_w) + AM_RANGE(0x1ffe00, 0x1ffe00) AM_MIRROR(0xff) AM_WRITE(spec_contr_reg_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( abc1600 ) +//------------------------------------------------- + +static INPUT_PORTS_START( abc1600 ) + // inputs defined in machine/abc99.c +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// Z80DMA 0 +//------------------------------------------------- + +void abc1600_state::update_drdy0() +{ + if (m_sysfs) + { + // floppy + m_dma0->rdy_w(!m_fdc->drq_r()); + } + else + { + // BUS0I/BUS0X + int trrq0 = m_bus0i->trrq_r() && m_bus0x->trrq_r(); + + m_dma0->rdy_w(trrq0); + } +} + +WRITE_LINE_MEMBER( abc1600_state::dbrq_w ) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state && m_dmadis); +} + +//------------------------------------------------- +// Z80DMA 1 +//------------------------------------------------- + +void abc1600_state::update_drdy1() +{ + if (m_sysscc) + { + // SCC + m_dma1->rdy_w(1); + } + else + { + // BUS1 + m_dma1->rdy_w(m_bus1->trrq_r()); + } +} + +//------------------------------------------------- +// Z80DMA 2 +//------------------------------------------------- + +void abc1600_state::update_drdy2() +{ + // Winchester + m_dma2->rdy_w(1); +} + +//------------------------------------------------- +// Z80DART +//------------------------------------------------- + +READ8_MEMBER( abc1600_state::dart_r ) +{ + return m_dart->ba_cd_r(space, A2_A1 ^ 0x03); +} + +WRITE8_MEMBER( abc1600_state::dart_w ) +{ + m_dart->ba_cd_w(space, A2_A1 ^ 0x03, data); +} + +//------------------------------------------------- +// SCC8530_INTERFACE( sc_intf ) +//------------------------------------------------- + +READ8_MEMBER( abc1600_state::scc_r ) +{ + return m_scc->reg_r(space, A1_A2); +} + +WRITE8_MEMBER( abc1600_state::scc_w ) +{ + m_scc->reg_w(space, A1_A2, data); +} + + +//------------------------------------------------- +// Z8536_INTERFACE( cio_intf ) +//------------------------------------------------- + +READ8_MEMBER( abc1600_state::cio_r ) +{ + return m_cio->read(space, A2_A1); +} + +WRITE8_MEMBER( abc1600_state::cio_w ) +{ + m_cio->write(space, A2_A1, data); +} + +READ8_MEMBER( abc1600_state::cio_pa_r ) +{ + /* + + bit description + + PA0 BUS2 + PA1 BUS1 + PA2 BUS0X*2 + PA3 BUS0X*3 + PA4 BUS0X*4 + PA5 BUS0X*5 + PA6 BUS0X + PA7 BUS0I + + */ + + UINT8 data = 0; + + data |= m_bus2->irq_r(); + data |= m_bus1->irq_r() << 1; + data |= m_bus0x->xint2_r() << 2; + data |= m_bus0x->xint3_r() << 3; + data |= m_bus0x->xint4_r() << 4; + data |= m_bus0x->xint5_r() << 5; + data |= m_bus0x->irq_r() << 6; + data |= m_bus0i->irq_r() << 7; + + return data; +} + +READ8_MEMBER( abc1600_state::cio_pb_r ) +{ + /* + + bit description + + PB0 + PB1 POWERFAIL + PB2 + PB3 + PB4 MINT + PB5 _PREN-1 + PB6 _PREN-0 + PB7 FINT + + */ + + UINT8 data = 0; + + data |= !m_sysscc << 5; + data |= !m_sysfs << 6; + + // floppy interrupt + data |= m_fdc->intrq_r() << 7; + + return data; +} + +WRITE8_MEMBER( abc1600_state::cio_pb_w ) +{ + /* + + bit description + + PB0 PRBR + PB1 + PB2 + PB3 + PB4 + PB5 + PB6 + PB7 + + */ + + // printer baudrate + int prbr = BIT(data, 0); + + m_dart->txca_w(prbr); + m_dart->rxca_w(prbr); +} + +READ8_MEMBER( abc1600_state::cio_pc_r ) +{ + /* + + bit description + + PC0 1 + PC1 DATA IN + PC2 1 + PC3 1 + + */ + + UINT8 data = 0x0d; + + // data in + data |= (m_rtc->dio_r() || m_nvram->do_r()) << 1; + + return data; +} + +WRITE8_MEMBER( abc1600_state::cio_pc_w ) +{ + /* + + bit description + + PC0 CLOCK + PC1 DATA OUT + PC2 RTC CS + PC3 NVRAM CS + + */ + + int clock = BIT(data, 0); + int data_out = BIT(data, 1); + int rtc_cs = BIT(data, 2); + int nvram_cs = BIT(data, 3); + + if (LOG) logerror("CLK %u DATA %u RTC %u NVRAM %u\n", clock, data_out, rtc_cs, nvram_cs); + + m_rtc->cs_w(rtc_cs); + m_rtc->dio_w(data_out); + m_rtc->clk_w(clock); + + m_nvram->cs_w(nvram_cs); + m_nvram->di_w(data_out); + m_nvram->sk_w(clock); +} + +static SLOT_INTERFACE_START( abc1600_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER( abc1600_state::fdc_drq_w ) +{ + update_drdy0(); +} + + +//------------------------------------------------- +// ABC1600BUS_INTERFACE( abcbus_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc1600_state::nmi_w ) +{ + if (state == ASSERT_LINE) + { + m_maincpu->set_input_line(M68K_IRQ_7, ASSERT_LINE); + } +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// IRQ_CALLBACK_MEMBER( abc1600_int_ack ) +//------------------------------------------------- + +IRQ_CALLBACK_MEMBER( abc1600_state::abc1600_int_ack ) +{ + int data = 0; + + switch (irqline) + { + case M68K_IRQ_2: + data = m_cio->intack_r(); + break; + + case M68K_IRQ_5: + data = m_dart->m1_r(); + break; + + case M68K_IRQ_7: + m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); + + data = M68K_INT_ACK_AUTOVECTOR; + break; + } + + return data; +} + + +void abc1600_state::machine_start() +{ + // state saving + save_item(NAME(m_dmadis)); + save_item(NAME(m_sysscc)); + save_item(NAME(m_sysfs)); + save_item(NAME(m_partst)); + save_item(NAME(m_cs7)); + save_item(NAME(m_bus0)); + save_item(NAME(m_csb)); + save_item(NAME(m_atce)); + save_item(NAME(m_btce)); +} + + +void abc1600_state::machine_reset() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + // clear special control register + for (int i = 0; i < 8; i++) + { + spec_contr_reg_w(program, 0, i); + } + + // clear floppy registers + fw0_w(program, 0, 0); + fw1_w(program, 0, 0); + + // clear NMI + m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( abc1600 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( abc1600, abc1600_state ) + // basic machine hardware + MCFG_CPU_ADD(MC68008P8_TAG, M68008, XTAL_64MHz/8) + MCFG_CPU_PROGRAM_MAP(abc1600_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(abc1600_state,abc1600_int_ack) + + MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1600)) // XTAL_64MHz/8/10/20000/8/8 + + // video hardware + MCFG_ABC1600_MOVER_ADD() + + // devices + MCFG_ABC1600_MAC_ADD(MC68008P8_TAG, mac_mem) + + MCFG_DEVICE_ADD(Z8410AB1_0_TAG, Z80DMA, XTAL_64MHz/16) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(abc1600_state, dbrq_w)) + MCFG_Z80DMA_OUT_BAO_CB(DEVWRITELINE(Z8410AB1_1_TAG, z80dma_device, bai_w)) + MCFG_Z80DMA_IN_MREQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma0_mreq_r)) + MCFG_Z80DMA_OUT_MREQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma0_mreq_w)) + MCFG_Z80DMA_IN_IORQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma0_iorq_r)) + MCFG_Z80DMA_OUT_IORQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma0_iorq_w)) + + MCFG_DEVICE_ADD(Z8410AB1_1_TAG, Z80DMA, XTAL_64MHz/16) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(abc1600_state, dbrq_w)) + MCFG_Z80DMA_OUT_BAO_CB(DEVWRITELINE(Z8410AB1_2_TAG, z80dma_device, bai_w)) + MCFG_Z80DMA_IN_MREQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma1_mreq_r)) + MCFG_Z80DMA_OUT_MREQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma1_mreq_w)) + MCFG_Z80DMA_IN_IORQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma1_iorq_r)) + MCFG_Z80DMA_OUT_IORQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma1_iorq_w)) + + MCFG_DEVICE_ADD(Z8410AB1_2_TAG, Z80DMA, XTAL_64MHz/16) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(abc1600_state, dbrq_w)) + MCFG_Z80DMA_IN_MREQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma2_mreq_r)) + MCFG_Z80DMA_OUT_MREQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma2_mreq_w)) + MCFG_Z80DMA_IN_IORQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma2_iorq_r)) + MCFG_Z80DMA_OUT_IORQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma2_iorq_w)) + + MCFG_Z80DART_ADD(Z8470AB1_TAG, XTAL_64MHz/16, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(MC68008P8_TAG, M68K_IRQ_5)) // shared with SCC + + MCFG_DEVICE_ADD(Z8530B1_TAG, SCC8530, XTAL_64MHz/16) + MCFG_Z8530_INTRQ_CALLBACK(INPUTLINE(MC68008P8_TAG, M68K_IRQ_5)) + + MCFG_DEVICE_ADD(Z8536B1_TAG, Z8536, XTAL_64MHz/16) + MCFG_Z8536_IRQ_CALLBACK(INPUTLINE(MC68008P8_TAG, M68K_IRQ_2)) + MCFG_Z8536_PA_IN_CALLBACK(READ8(abc1600_state, cio_pa_r)) + MCFG_Z8536_PB_IN_CALLBACK(READ8(abc1600_state, cio_pb_r)) + MCFG_Z8536_PB_OUT_CALLBACK(WRITE8(abc1600_state, cio_pb_w)) + MCFG_Z8536_PC_IN_CALLBACK(READ8(abc1600_state, cio_pc_r)) + MCFG_Z8536_PC_OUT_CALLBACK(WRITE8(abc1600_state, cio_pc_w)) + + MCFG_NMC9306_ADD(NMC9306_TAG) + MCFG_E0516_ADD(E050_C16PC_TAG, XTAL_32_768kHz) + MCFG_FD1797_ADD(SAB1797_02P_TAG, XTAL_64MHz/64) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pb7_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(abc1600_state, fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD(SAB1797_02P_TAG":0", abc1600_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(SAB1797_02P_TAG":1", abc1600_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(SAB1797_02P_TAG":2", abc1600_floppies, "525qd", floppy_image_device::default_floppy_formats) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z8470AB1_TAG, z80dart_device, rxa_w)) + + MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc99") + MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z8470AB1_TAG, z80dart_device, rxb_w)) + MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z8470AB1_TAG, z80dart_device, rxtxcb_w)) + MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z8470AB1_TAG, z80dart_device, dcdb_w)) + + MCFG_ABCBUS_SLOT_ADD("bus0i", abc1600bus_cards, NULL) + MCFG_ABCBUS_SLOT_IRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa7_w)) + MCFG_ABCBUS_SLOT_ADD("bus0x", abc1600bus_cards, NULL) + MCFG_ABCBUS_SLOT_IRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa6_w)) + MCFG_ABCBUS_SLOT_NMI_CALLBACK(WRITELINE(abc1600_state, nmi_w)) + MCFG_ABCBUS_SLOT_XINT2_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa2_w)) + MCFG_ABCBUS_SLOT_XINT3_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa3_w)) + MCFG_ABCBUS_SLOT_XINT4_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa4_w)) + MCFG_ABCBUS_SLOT_XINT5_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa5_w)) + MCFG_ABCBUS_SLOT_ADD("bus1", abc1600bus_cards, NULL) + MCFG_ABCBUS_SLOT_IRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa1_w)) + MCFG_ABCBUS_SLOT_ADD("bus2", abc1600bus_cards, "4105") + MCFG_ABCBUS_SLOT_IRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa0_w)) + //MCFG_ABCBUS_SLOT_PREN_CALLBACK(DEVWRITELINE(Z8410AB1_2_TAG, z80dma_device, iei_w)) + MCFG_ABCBUS_SLOT_TRRQ_CALLBACK(DEVWRITELINE(Z8410AB1_2_TAG, z80dma_device, rdy_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1M") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "abc1600") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( abc1600 ) +//------------------------------------------------- + +ROM_START( abc1600 ) + ROM_REGION( 0x71c, "plds", 0 ) + ROM_LOAD( "1020 6490349-01.8b", 0x104, 0x104, CRC(1fa065eb) SHA1(20a95940e39fa98e97e59ea1e548ac2e0c9a3444) ) // expansion bus strobes + ROM_LOAD( "1021 6490350-01.5d", 0x208, 0x104, CRC(96f6f44b) SHA1(12d1cd153dcc99d1c4a6c834122f370d49723674) ) // interrupt encoder and ROM/RAM control + ROM_LOAD( "1023 6490352-01.11e", 0x410, 0x104, CRC(a2f350ac) SHA1(77e08654a197080fa2111bc3031cd2c7699bf82b) ) // interrupt acknowledge + ROM_LOAD( "1024 6490353-01.12e", 0x514, 0x104, CRC(67f1328a) SHA1(b585495fe14a7ae2fbb29f722dca106d59325002) ) // expansion bus timing and control + ROM_LOAD( "1025 6490354-01.6e", 0x618, 0x104, CRC(9bda0468) SHA1(ad373995dcc18532274efad76fa80bd13c23df25) ) // DMA transfer + //ROM_LOAD( "pal16r4.10c", 0x71c, 0x104, NO_DUMP ) // SCC read/write, mentioned in the preliminary service manual, but not present on the PCB +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1985, abc1600, 0, 0, abc1600, abc1600, driver_device, 0, "Luxor", "ABC 1600", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/abc80.c b/src/mame/drivers/abc80.c new file mode 100644 index 00000000000..5bfb37c94db --- /dev/null +++ b/src/mame/drivers/abc80.c @@ -0,0 +1,630 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Luxor ABC 80 + +PCB Layout +---------- + +55 10470-02 + + CN1 CN2 CN5 + SW1 |-----| |------------------------| |-----| +|-------| |--| |----------------------------------| |---| +| CN3 CN4 | +| 7912 | +| MC1488 | +| MC1489 7812 | +| LS245 LS138 | +| |-------| | +| |-----CN6-----| LS241 LS241 LS138 LS32 |SN76477| LS04 LM339 | +| |-------| | +| |--------------| |------------| PROM0 LS132 LS273 7406 LS08 | +| | Z80A PIO | | Z80A | | +| |--------------| |------------| LS04 LS74A LS86 LS161 LS166 74393 | +| | +| ROM3 LS107 4116 4116 LS10 LS257 LS74A LS08 LS107 PROM2 | +| | +| ROM2 LS257 4116 4116 LS139 74393 LS107 LS32 LS175 74393 | +| | +| ROM1 LS257 4116 4116 LS08 LS283 LS10 LS32 PROM1 74393 | +| | +| ROM0 LS257 4116 4116 LS257 74393 LS375 74S263 LS145 PROM4 | +| | +| DIPSW1 DIPSW2 4045 4045 LS257 LS245 LS375 LS273 LS166 PROM3 | +|--------------------------------------------------------------------------------------| + +Notes: + All IC's shown. + + ROM0-3 - Texas Instruments TMS4732 4Kx8 General Purpose Mask Programmable ROM + PROM0-2 - Philips Semiconductors N82S129 256x4 TTL Bipolar PROM + PROM3-4 - Philips Semiconductors N82S131 512x4 TTL Bipolar PROM + 4116 - Texas Instruments TMS4116-25 16Kx1 Dynamic RAM + 4045 - Texas Instruments TMS4045-15 1Kx4 General Purpose Static RAM with Multiplexed I/O + Z80A - Sharp LH0080A Z80A CPU + Z80APIO - SGS-Thomson Z8420AB1 Z80A PIO + SN76477 - Texas Instruments SN76477N Complex Sound Generator + 74S263 - Texas Instruments SN74S263N Row Output Character Generator + MC1488 - Texas Instruments MC1488 Quadruple Line Driver + MC1489 - Texas Instruments MC1489 Quadruple Line Receiver + CN1 - RS-232 connector + CN2 - ABC bus connector (DIN 41612) + CN3 - video connector + CN4 - cassette motor connector + CN5 - cassette connector + CN6 - keyboard connector + SW1 - reset switch + DIPSW1 - + DIPSW2 - + +*/ + +/* + + TODO: + + - proper keyboard controller emulation + - MyAB TKN80 80-column card + - GeJo 80-column card + - Mikrodatorn 64K expansion + - floppy + - Metric ABC CAD 1000 + +*/ + +#include "includes/abc80.h" + + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define LOG 0 + + + +//************************************************************************** +// MEMORY MANAGEMENT +//************************************************************************** + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( abc80_state::read ) +{ + UINT8 data = 0xff; + UINT8 mmu = m_mmu_rom->base()[0x40 | (offset >> 10)]; + + if (!(mmu & MMU_XM)) + { + data = m_bus->xmemfl_r(space, offset); + } + else if (!(mmu & MMU_ROM)) + { + data = m_rom->base()[offset & 0x3fff]; + } + else if (mmu & MMU_VRAMS) + { + data = m_video_ram[offset & 0x3ff]; + } + else if (!(mmu & MMU_RAM)) + { + data = m_ram->pointer()[offset & 0x3fff]; + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( abc80_state::write ) +{ + UINT8 mmu = m_mmu_rom->base()[0x40 | (offset >> 10)]; + + if (!(mmu & MMU_XM)) + { + m_bus->xmemw_w(space, offset, data); + } + else if (mmu & MMU_VRAMS) + { + m_video_ram[offset & 0x3ff] = data; + } + else if (!(mmu & MMU_RAM)) + { + m_ram->pointer()[offset & 0x3fff] = data; + } +} + + + +//************************************************************************** +// SOUND +//************************************************************************** + +//------------------------------------------------- +// vco_voltage_w - CSG VCO voltage select +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc80_state::vco_voltage_w ) +{ + m_psg->vco_voltage_w(state ? 2.5 : 0); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( abc80_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc80_mem, AS_PROGRAM, 8, abc80_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( abc80_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc80_io, AS_IO, 8, abc80_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x17) + AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, inp_r, out_w) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, stat_r, cs_w) + AM_RANGE(0x02, 0x02) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c1_w) + AM_RANGE(0x03, 0x03) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c2_w) + AM_RANGE(0x04, 0x04) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c3_w) + AM_RANGE(0x05, 0x05) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c4_w) + AM_RANGE(0x06, 0x06) AM_WRITE_PORT("SN76477") + AM_RANGE(0x07, 0x07) AM_DEVREAD(ABCBUS_TAG, abcbus_slot_t, rst_r) + AM_RANGE(0x10, 0x13) AM_MIRROR(0x04) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read_alt, write_alt) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( abc80 ) +//------------------------------------------------- + +static INPUT_PORTS_START( abc80 ) + PORT_START("SW1") + PORT_DIPUNKNOWN_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" ) + PORT_DIPUNKNOWN_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) + PORT_DIPUNKNOWN_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) + PORT_DIPUNKNOWN_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" ) + PORT_DIPUNKNOWN_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW1:5" ) + PORT_DIPUNKNOWN_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" ) + PORT_DIPUNKNOWN_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" ) + PORT_DIPUNKNOWN_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" ) + + PORT_START("SW2") + PORT_DIPUNKNOWN_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW2:1" ) + PORT_DIPUNKNOWN_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW2:2" ) + PORT_DIPUNKNOWN_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW2:3" ) + PORT_DIPUNKNOWN_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW2:4" ) + PORT_DIPUNKNOWN_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW2:5" ) + PORT_DIPUNKNOWN_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" ) + PORT_DIPUNKNOWN_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" ) + PORT_DIPUNKNOWN_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" ) + + PORT_START("SN76477") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, enable_w) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, abc80_state, vco_voltage_w) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, vco_w) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, mixer_b_w) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, mixer_a_w) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, mixer_c_w) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, envelope_2_w) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, envelope_1_w) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// Z80PIO +//------------------------------------------------- + +READ8_MEMBER( abc80_state::pio_pa_r ) +{ + /* + + PIO Port A + + bit description + + 0 keyboard data + 1 keyboard data + 2 keyboard data + 3 keyboard data + 4 keyboard data + 5 keyboard data + 6 keyboard data + 7 keyboard strobe + + */ + + UINT8 data = 0; + + //data |= m_kb->data_r(); + data |= m_key_data; + data |= (m_key_strobe << 7); + + return data; +} + +READ8_MEMBER( abc80_state::pio_pb_r ) +{ + /* + + PIO Channel B + + 0 R RS-232C RxD + 1 R RS-232C _CTS + 2 R RS-232C _DCD + 3 W RS-232C TxD + 4 W RS-232C _RTS + 5 W Cassette Motor + 6 W Cassette Data + 7 R Cassette Data + + */ + + UINT8 data = 0; + + // receive data + data |= m_rs232->rxd_r(); + + // clear to send + data |= m_rs232->cts_r() << 1; + + // data carrier detect + data |= m_rs232->dcd_r() << 2; + + // cassette data + data |= m_tape_in_latch << 7; + + if (LOG) logerror("%s %s read tape latch %u\n", machine().time().as_string(), machine().describe_context(), m_tape_in_latch); + + return data; +} + +WRITE8_MEMBER( abc80_state::pio_pb_w ) +{ + /* + + PIO Channel B + + 0 R RS-232C RxD + 1 R RS-232C _CTS + 2 R RS-232C _DCD + 3 W RS-232C TxD + 4 W RS-232C _RTS + 5 W Cassette Motor + 6 W Cassette Data + 7 R Cassette Data + + */ + + // transmit data + m_rs232->write_txd(BIT(data, 3)); + + // request to send + m_rs232->write_rts(BIT(data, 4)); + + // cassette motor + if (BIT(data, 5)) + { + if (!m_motor) if (LOG) logerror("%s %s started cassette motor\n", machine().time().as_string(), machine().describe_context()); + m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_motor = true; + } + else + { + if (m_motor) if (LOG) logerror("%s %s stopped cassette motor\n", machine().time().as_string(), machine().describe_context()); + m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_motor = false; + } + + // cassette data + m_cassette->output(BIT(data, 6) ? -1.0 : +1.0); + + // cassette input latch + if (BIT(data, 6)) + { + if (LOG) logerror("%s %s clear tape in latch\n", machine().time().as_string(), machine().describe_context()); + + m_tape_in_latch = 1; + + m_pio->pb7_w(m_tape_in_latch); + } +} + + +//------------------------------------------------- +// Z80 Daisy Chain +//------------------------------------------------- + +static const z80_daisy_config abc80_daisy_chain[] = +{ + { Z80PIO_TAG }, + { NULL } +}; + + +//------------------------------------------------- +// ABC80_KEYBOARD_INTERFACE( kb_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc80_state::keydown_w ) +{ + m_key_strobe = state; + + m_pio->port_a_write(m_key_strobe << 7); +} + +WRITE8_MEMBER( abc80_state::kbd_w ) +{ + m_key_data = data; + m_key_strobe = 1; + + UINT8 pio_data = 0x80 | data; + m_pio->port_a_write(pio_data); + + timer_set(attotime::from_msec(50), TIMER_ID_FAKE_KEYBOARD_CLEAR); +} + +/* +DEVICE_INPUT_DEFAULTS_START( abc830_slow ) + DEVICE_INPUT_DEFAULTS("SW1", 0x0f, 0x03) + DEVICE_INPUT_DEFAULTS("S1", 0x01, 0x01) +DEVICE_INPUT_DEFAULTS_END +*/ + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void abc80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_ID_PIO: + m_pio_astb = !m_pio_astb; + + m_pio->strobe_a(m_pio_astb); + break; + + case TIMER_ID_CASSETTE: + { + if (!m_motor) return; + + int tape_in = m_cassette->input() > 0; + + if (m_tape_in != tape_in) + if (LOG) logerror("%s tape flank %u\n", machine().time().as_string(), tape_in); + + if (m_tape_in_latch && (m_tape_in != tape_in)) + { + if (LOG) logerror("%s set tape in latch\n", machine().time().as_string()); + m_tape_in_latch = 0; + + m_pio->port_b_write(m_tape_in_latch << 7); + } + + m_tape_in = tape_in; + } + break; + + case TIMER_ID_BLINK: + m_blink = !m_blink; + break; + + case TIMER_ID_VSYNC_ON: + if (LOG) logerror("%s vsync 1\n", machine().time().as_string()); + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + break; + + case TIMER_ID_VSYNC_OFF: + if (LOG) logerror("%s vsync 0\n", machine().time().as_string()); + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + break; + + case TIMER_ID_FAKE_KEYBOARD_CLEAR: + m_pio->port_a_write(m_key_data); + m_key_strobe = 0; + m_key_data = 0; + break; + } +} + + +//------------------------------------------------- +// MACHINE_START( abc80 ) +//------------------------------------------------- + +void abc80_state::machine_start() +{ + // start timers + m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE); + m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); + + // register for state saving + save_item(NAME(m_key_data)); + save_item(NAME(m_key_strobe)); + save_item(NAME(m_pio_astb)); + save_item(NAME(m_latch)); + save_item(NAME(m_blink)); + save_item(NAME(m_motor)); + save_item(NAME(m_tape_in)); + save_item(NAME(m_tape_in_latch)); +} + +QUICKLOAD_LOAD_MEMBER( abc80_state, bac ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + offs_t address = space.read_byte(BOFA + 1) << 8 | space.read_byte(BOFA); + if (LOG) logerror("BOFA %04x\n",address); + + dynamic_buffer data; + data.resize(quickload_size); + image.fread(&data[0], quickload_size); + for (int i = 1; i < quickload_size; i++) + space.write_byte(address++, data[i]); + + offs_t eofa = address; + space.write_byte(EOFA, eofa & 0xff); + space.write_byte(EOFA + 1, eofa >> 8); + if (LOG) logerror("EOFA %04x\n",address); + + offs_t head = address + 1; + space.write_byte(HEAD, head & 0xff); + space.write_byte(HEAD + 1, head >> 8); + if (LOG) logerror("HEAD %04x\n",address); + + return IMAGE_INIT_PASS; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( abc80 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( abc80, abc80_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_11_9808MHz/2/2) // 2.9952 MHz + MCFG_CPU_PROGRAM_MAP(abc80_mem) + MCFG_CPU_IO_MAP(abc80_io) + MCFG_CPU_CONFIG(abc80_daisy_chain) + + // video hardware + MCFG_FRAGMENT_ADD(abc80_video) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SN76477_TAG, SN76477, 0) + MCFG_SN76477_NOISE_PARAMS(RES_K(47), RES_K(330), CAP_P(390)) // noise + filter: R26 47k - R24 330k - C52 390p + MCFG_SN76477_DECAY_RES(RES_K(47)) // decay_res: R23 47k + MCFG_SN76477_ATTACK_PARAMS(CAP_U(10), RES_K(2.2)) // attack_decay_cap + attack_res: C50 10u/35V - R21 2.2k + MCFG_SN76477_AMP_RES(RES_K(33)) // amplitude_res: R19 33k + MCFG_SN76477_FEEDBACK_RES(RES_K(10)) // feedback_res: R18 10k + MCFG_SN76477_VCO_PARAMS(0, CAP_N(10), RES_K(100)) // VCO volt + cap + res: 0V or 2.5V - C48 10n - R20 100k + MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage: N/C + MCFG_SN76477_SLF_PARAMS(CAP_U(1), RES_K(220)) // slf caps + res: C51 1u/35V - R22 220k + MCFG_SN76477_ONESHOT_PARAMS(CAP_U(0.1), RES_K(330)) // oneshot caps + res: C53 0.1u - R25 330k + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_11_9808MHz/2/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(abc80_state, pio_pa_r)) + MCFG_Z80PIO_IN_PB_CB(READ8(abc80_state, pio_pb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(abc80_state, pio_pb_w)) + + MCFG_CASSETTE_ADD(CASSETTE_TAG) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("abc80_cass") + + MCFG_DEVICE_ADD(ABC80_KEYBOARD_TAG, ABC80_KEYBOARD, 0) + MCFG_ABC80_KEYBOARD_KEYDOWN_CALLBACK(WRITELINE(abc80_state, keydown_w)) + + MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abc80_cards, "abcexp") + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(abc80_state, kbd_w)) + + MCFG_QUICKLOAD_ADD("quickload", abc80_state, bac, "bac", 2) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + + // software list + MCFG_SOFTWARE_LIST_ADD("cass_list", "abc80_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "abc80_flop") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( abc80 ) +//------------------------------------------------- + +ROM_START( abc80 ) + ROM_REGION( 0x4000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS("v2") + ROM_SYSTEM_BIOS( 0, "v1", "V1" ) + ROMX_LOAD( "3506_3.a5", 0x0000, 0x1000, CRC(7c004fb6) SHA1(9aee1d085122f4537c3e6ecdab9d799bd429ef52), ROM_BIOS(1) ) + ROMX_LOAD( "3507_3.a3", 0x1000, 0x1000, CRC(d1850a84) SHA1(f7719f3af9173601a2aa23ae38ae00de1a387ad8), ROM_BIOS(1) ) + ROMX_LOAD( "3508_3.a4", 0x2000, 0x1000, CRC(b55528e9) SHA1(3e5017e8cacad1f13215242f1bbd89d1d3eee131), ROM_BIOS(1) ) + ROMX_LOAD( "3509_3.a2", 0x3000, 0x1000, CRC(659cab1e) SHA1(181db748cef22cdcccd311a60aa6189c85343db7), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v2", "V2" ) + ROMX_LOAD( "3506_3_v2.a5", 0x0000, 0x1000, CRC(e2afbf48) SHA1(9883396edd334835a844dcaa792d29599a8c67b9), ROM_BIOS(2) ) + ROMX_LOAD( "3507_3_v2.a3", 0x1000, 0x1000, CRC(d224412a) SHA1(30968054bba7c2aecb4d54864b75a446c1b8fdb1), ROM_BIOS(2) ) + ROMX_LOAD( "3508_3_v2.a4", 0x2000, 0x1000, CRC(1502ba5b) SHA1(5df45909c2c4296e5701c6c99dfaa9b10b3a729b), ROM_BIOS(2) ) + ROMX_LOAD( "3509_3_v2.a2", 0x3000, 0x1000, CRC(bc8860b7) SHA1(28b6cf7f5a4f81e017c2af091c3719657f981710), ROM_BIOS(2) ) + + ROM_REGION( 0xa00, "chargen", 0 ) + ROM_LOAD( "sn74s263.h2", 0x0000, 0x0a00, BAD_DUMP CRC(9e064e91) SHA1(354783c8f2865f73dc55918c9810c66f3aca751f) ) // created by hand + + ROM_REGION( 0x100, "hsync", 0 ) + ROM_LOAD( "abc80_11.k5", 0x0000, 0x0100, CRC(e4f7e018) SHA1(63e718a39537f37286ea183e6469808c271dbfa5) ) // "64 40029-01" 82S129 256x4 horizontal sync + + ROM_REGION( 0x200, "vsync", 0 ) + ROM_LOAD( "abc80_21.k2", 0x0000, 0x0200, CRC(445a45b9) SHA1(bcc1c4fafe68b3500b03de785ca32abd63cea252) ) // "64 40030-01" 82S131 512x4 vertical sync + + ROM_REGION( 0x100, "attr", 0 ) + ROM_LOAD( "abc80_12.j3", 0x0000, 0x0100, CRC(6c46811c) SHA1(2d3bdf2d3a2a88ddb1c0c637967e1b2b9541a928) ) // "64 40056-01" 82S129 256x4 attribute + + ROM_REGION( 0x200, "line", 0 ) + ROM_LOAD( "abc80_22.k1", 0x0000, 0x0200, CRC(74de7a0b) SHA1(96f37b0ca65aa8af4242bad38124f410b7f657fe) ) // "64 40058-01" 82S131 512x4 chargen 74S263 row address + + ROM_REGION( 0x100, "mmu", 0 ) + ROM_LOAD( "abc80_13.e7", 0x0000, 0x0100, CRC(f7738834) SHA1(b02df3e678fb50c9cb75b4a97615222d3b4577a3) ) // "64 40057-01" 82S129 256x4 address decoder +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1978, abc80, 0, 0, abc80, abc80, driver_device, 0, "Luxor Datorer AB", "ABC 80", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_KEYBOARD ) diff --git a/src/mame/drivers/abc80x.c b/src/mame/drivers/abc80x.c new file mode 100644 index 00000000000..a328baa87c0 --- /dev/null +++ b/src/mame/drivers/abc80x.c @@ -0,0 +1,1641 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Luxor ABC 800C/800M + +Main PCB Layout +--------------- + +|-----------------------|-----------------------------------| +| 4116 4116 | | +| 4116 4116 | | +| 4116 4116 | | +| 4116 4116 | Z80 Z80CTC | +| 4116 4116 |CN1 | +| 4116 4116 | | +| 4116 4116 | Z80DART | +| | CN6 | +| ROM3 ROM7 | | +| | Z80SIO2 | +| ROM2 ROM6 |-----------------------------------| +| | +| ROM1 ROM5 | +| CN2 | +| ROM0 ROM4 | +| CN7 | +|-------------------------------------------| CN3 | +| | | +| | | +| | CN4 | +| | | +| VIDEO BOARD | | +| | CN5 | +| | | +| | | +| | | +|-------------------------------------------|---------------| + +Notes: + Relevant IC's shown. + + Z80 - ? Z80A CPU (labeled "Z80A (800) KASS.") + Z80CTC - Sharp LH0082A Z80A-CTC + Z80DART - SGS Z8470AB1 Z80A-DART + Z8OSIO2 - SGS Z8442AB1 Z80A-SIO/2 + 4116 - Toshiba TMS4116-20NL 1Kx8 RAM + ROM0 - NEC D2732D 4Kx8 EPROM "ABC M-12" + ROM1 - NEC D2732D 4Kx8 EPROM "ABC 1-12" + ROM2 - NEC D2732D 4Kx8 EPROM "ABC 2-12" + ROM3 - NEC D2732D 4Kx8 EPROM "ABC 3-12" + ROM4 - NEC D2732D 4Kx8 EPROM "ABC 4-12" + ROM5 - NEC D2732D 4Kx8 EPROM "ABC 5-12" + ROM6 - Hitachi HN462732G 4Kx8 EPROM "ABC 6-52" + ROM7 - NEC D2732D 4Kx8 EPROM "ABC 7-22" + CN1 - ABC bus connector + CN2 - tape connector + CN3 - RS-232 channel B connector + CN4 - RS-232 channel A connector + CN5 - video connector + CN6 - keyboard connector + CN7 - video board connector + + +Video PCB Layout (Color) +------------------------ + +55 10789-01 + +|-------------------------------------------| +| | +| | +| 2114 | +| | +| 2114 TROM | +| | +| 12MHz TIC | +| | +| | +|-------------------------------------------| + +Notes: + Relevant IC's shown. + + 2114 - GTE Microcircuits 2114-2CB 1Kx4 RAM + TIC - Philips SAA5020 Teletext Timing Chain + TROM - Philips SAA5052 Teletext Character Generator w/Swedish Character Set + + +Video PCB Layout (Monochrome) +----------------------------- + +55 10790-02 + +|-------------------------------------------| +| | +| 2114 | +| 2114 | +| 12MHz| +| 2114 | +| 2114 | +| | +| CRTC ROM0 | +| | +|-------------------------------------------| + +Notes: + Relevant IC's shown. + + 2114 - Toshiba TMM314AP-1 1Kx4 RAM + CRTC - Hitachi HD46505SP CRTC + ROM0 - NEC D2716D 2Kx8 EPROM "VUM SE" + + +Video PCB Layout (High Resolution) +---------------------------------- + +55 10791-01 + +|-------------------------------------------| +| | +| 4116 PROM1 | +| 4116 | +| 4116 | +| 4116 | +| 4116 | +| 4116 | +| 4116 | +| 4116 PROM0 | +|-------------------------------------------| + +Notes: + Relevant IC's shown. + + 4116 - Motorola MCM4116AC25 1Kx8 RAM + PROM0 - Philips 82S123 32x8 Bipolar PROM "HRU I" + PROM1 - Philips 82S131 512x4 Bipolar PROM "HRU II" + +*/ + +/* + + TODO: + + - cassette + - abc806 RTC + - abc806 disks except ufd631 won't boot + +*/ + +#include "includes/abc80x.h" + + + +//************************************************************************** +// SOUND +//************************************************************************** + +//------------------------------------------------- +// DISCRETE_SOUND( abc800 ) +//------------------------------------------------- + +static DISCRETE_SOUND_START( abc800 ) + DISCRETE_INPUT_LOGIC(NODE_01) + DISCRETE_OUTPUT(NODE_01, 5000) +DISCRETE_SOUND_END + + +//------------------------------------------------- +// pling_r - speaker read +//------------------------------------------------- + +READ8_MEMBER( abc800_state::pling_r ) +{ + m_pling = !m_pling; + + m_discrete->write(space, NODE_01, m_pling); + + return 0xff; +} + + +//------------------------------------------------- +// pling_r - speaker read +//------------------------------------------------- + +READ8_MEMBER( abc802_state::pling_r ) +{ + m_pling = !m_pling; + + m_discrete->write(space, NODE_01, m_pling); + + return 0xff; +} + + + +//************************************************************************** +// MEMORY BANKING +//************************************************************************** + +//------------------------------------------------- +// bankswitch +//------------------------------------------------- + +void abc800_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + if (m_fetch_charram) + { + // HR video RAM selected + program.install_ram(0x0000, 0x3fff, m_video_ram); + } + else + { + // BASIC ROM selected + program.install_rom(0x0000, 0x3fff, m_rom->base()); + } +} + + +//------------------------------------------------- +// bankswitch +//------------------------------------------------- + +void abc802_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + if (m_lrs) + { + // ROM and video RAM selected + program.install_rom(0x0000, 0x77ff, m_rom->base()); + program.install_ram(0x7800, 0x7fff, m_char_ram); + } + else + { + // low RAM selected + program.install_ram(0x0000, 0x7fff, m_ram->pointer()); + } +} + + +//------------------------------------------------- +// bankswitch +//------------------------------------------------- + +void abc806_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT32 videoram_mask = m_ram->size() - (32 * 1024) - 1; + int bank; + char bank_name[10]; + + if (!m_keydtr) + { + // 32K block mapping + + UINT32 videoram_start = (m_hrs & 0xf0) << 11; + + for (bank = 1; bank <= 8; bank++) + { + // 0x0000-0x7FFF is video RAM + + UINT16 start_addr = 0x1000 * (bank - 1); + UINT16 end_addr = start_addr + 0xfff; + UINT32 videoram_offset = (videoram_start + start_addr) & videoram_mask; + sprintf(bank_name,"bank%d",bank); + //logerror("%04x-%04x: Video RAM %04x (32K)\n", start_addr, end_addr, videoram_offset); + + program.install_readwrite_bank(start_addr, end_addr, bank_name); + membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset); + membank(bank_name)->set_entry(1); + } + + for (bank = 9; bank <= 16; bank++) + { + // 0x8000-0xFFFF is main RAM + + UINT16 start_addr = 0x1000 * (bank - 1); + UINT16 end_addr = start_addr + 0xfff; + sprintf(bank_name,"bank%d",bank); + //logerror("%04x-%04x: Work RAM (32K)\n", start_addr, end_addr); + + program.install_readwrite_bank(start_addr, end_addr, bank_name); + membank(bank_name)->set_entry(0); + } + } + else + { + // 4K block mapping + + for (bank = 1; bank <= 16; bank++) + { + UINT16 start_addr = 0x1000 * (bank - 1); + UINT16 end_addr = start_addr + 0xfff; + UINT8 map = m_map[bank - 1]; + UINT32 videoram_offset = ((map & 0x7f) << 12) & videoram_mask; + sprintf(bank_name,"bank%d",bank); + if (BIT(map, 7) && m_eme) + { + // map to video RAM + //logerror("%04x-%04x: Video RAM %04x (4K)\n", start_addr, end_addr, videoram_offset); + + program.install_readwrite_bank(start_addr, end_addr, bank_name); + membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset); + membank(bank_name)->set_entry(1); + } + else + { + // map to ROM/RAM + + switch (bank) + { + case 1: case 2: case 3: case 4: case 5: case 6: case 7: + // ROM + //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr); + + program.install_read_bank(start_addr, end_addr, bank_name); + program.unmap_write(start_addr, end_addr); + membank(bank_name)->set_entry(0); + break; + + case 8: + // ROM/char RAM + //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr); + + program.install_read_bank(0x7000, 0x77ff, bank_name); + program.unmap_write(0x7000, 0x77ff); + program.install_readwrite_handler(0x7800, 0x7fff, 0, 0, READ8_DELEGATE(abc806_state, charram_r), WRITE8_DELEGATE(abc806_state, charram_w)); + membank(bank_name)->set_entry(0); + break; + + default: + // work RAM + //logerror("%04x-%04x: Work RAM (4K)\n", start_addr, end_addr); + + program.install_readwrite_bank(start_addr, end_addr, bank_name); + membank(bank_name)->set_entry(0); + break; + } + } + } + } + + if (m_fetch_charram) + { + // 30K block mapping + + UINT32 videoram_start = (m_hrs & 0xf0) << 11; + + for (bank = 1; bank <= 8; bank++) + { + // 0x0000-0x77FF is video RAM + + UINT16 start_addr = 0x1000 * (bank - 1); + UINT16 end_addr = start_addr + 0xfff; + UINT32 videoram_offset = (videoram_start + start_addr) & videoram_mask; + sprintf(bank_name,"bank%d",bank); + //logerror("%04x-%04x: Video RAM %04x (30K)\n", start_addr, end_addr, videoram_offset); + + if (start_addr == 0x7000) + { + program.install_readwrite_bank(0x7000, 0x77ff, bank_name); + program.install_readwrite_handler(0x7800, 0x7fff, 0, 0, READ8_DELEGATE(abc806_state, charram_r), WRITE8_DELEGATE(abc806_state, charram_w)); + } + else + { + program.install_readwrite_bank(start_addr, end_addr, bank_name); + } + + membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset); + membank(bank_name)->set_entry(1); + } + } +} + + +//------------------------------------------------- +// mai_r - memory bank map read +//------------------------------------------------- + +READ8_MEMBER( abc806_state::mai_r ) +{ + int bank = offset >> 12; + + return m_map[bank]; +} + + +//------------------------------------------------- +// mao_w - memory bank map write +//------------------------------------------------- + +WRITE8_MEMBER( abc806_state::mao_w ) +{ + /* + + bit description + + 0 physical block address bit 0 + 1 physical block address bit 1 + 2 physical block address bit 2 + 3 physical block address bit 3 + 4 physical block address bit 4 + 5 + 6 + 7 allocate block + + */ + + int bank = offset >> 12; + + m_map[bank] = data; + + bankswitch(); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( abc800c_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc800c_mem, AS_PROGRAM, 8, abc800c_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0x4000, 0x7bff) AM_ROM + AM_RANGE(0x7c00, 0x7fff) AM_RAM AM_SHARE("char_ram") + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( abc800c_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc800c_io, AS_IO, 8, abc800_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_MIRROR(0x18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, inp_r, out_w) + AM_RANGE(0x01, 0x01) AM_MIRROR(0x18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, stat_r, cs_w) + AM_RANGE(0x02, 0x02) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c1_w) + AM_RANGE(0x03, 0x03) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c2_w) + AM_RANGE(0x04, 0x04) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c3_w) + AM_RANGE(0x05, 0x05) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c4_w) + AM_RANGE(0x05, 0x05) AM_MIRROR(0x18) AM_READ(pling_r) + AM_RANGE(0x06, 0x06) AM_MIRROR(0x18) AM_WRITE(hrs_w) + AM_RANGE(0x07, 0x07) AM_MIRROR(0x18) AM_DEVREAD(ABCBUS_TAG, abcbus_slot_t, rst_r) AM_WRITE(hrc_w) + AM_RANGE(0x20, 0x23) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x40, 0x43) AM_MIRROR(0x1c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio2_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x60, 0x63) AM_MIRROR(0x1c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( abc800m_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc800m_mem, AS_PROGRAM, 8, abc800_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0x4000, 0x77ff) AM_ROM + AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE("char_ram") + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( abc800m_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc800m_io, AS_IO, 8, abc800_state ) + AM_IMPORT_FROM( abc800c_io ) + AM_RANGE(0x31, 0x31) AM_MIRROR(0x06) AM_DEVREAD(MC6845_TAG, mc6845_device, register_r) + AM_RANGE(0x38, 0x38) AM_MIRROR(0x06) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) + AM_RANGE(0x39, 0x39) AM_MIRROR(0x06) AM_DEVWRITE(MC6845_TAG, mc6845_device, register_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( abc802_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc802_mem, AS_PROGRAM, 8, abc802_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x77ff) AM_ROM + AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE("char_ram") + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( abc802_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc802_io, AS_IO, 8, abc802_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_MIRROR(0x18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, inp_r, out_w) + AM_RANGE(0x01, 0x01) AM_MIRROR(0x18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, stat_r, cs_w) + AM_RANGE(0x02, 0x02) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c1_w) + AM_RANGE(0x03, 0x03) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c2_w) + AM_RANGE(0x04, 0x04) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c3_w) + AM_RANGE(0x05, 0x05) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c4_w) + AM_RANGE(0x05, 0x05) AM_MIRROR(0x08) AM_READ(pling_r) + AM_RANGE(0x07, 0x07) AM_MIRROR(0x18) AM_DEVREAD(ABCBUS_TAG, abcbus_slot_t, rst_r) + AM_RANGE(0x20, 0x23) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x31, 0x31) AM_MIRROR(0x06) AM_DEVREAD(MC6845_TAG, mc6845_device, register_r) + AM_RANGE(0x38, 0x38) AM_MIRROR(0x06) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) + AM_RANGE(0x39, 0x39) AM_MIRROR(0x06) AM_DEVWRITE(MC6845_TAG, mc6845_device, register_w) + AM_RANGE(0x40, 0x43) AM_MIRROR(0x1c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio2_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x60, 0x63) AM_MIRROR(0x1c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( abc806_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc806_mem, AS_PROGRAM, 8, abc806_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") + AM_RANGE(0x1000, 0x1fff) AM_RAMBANK("bank2") + AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") + AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4") + AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank5") + AM_RANGE(0x5000, 0x5fff) AM_RAMBANK("bank6") + AM_RANGE(0x6000, 0x6fff) AM_RAMBANK("bank7") + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank8") + AM_RANGE(0x8000, 0x8fff) AM_RAMBANK("bank9") + AM_RANGE(0x9000, 0x9fff) AM_RAMBANK("bank10") + AM_RANGE(0xa000, 0xafff) AM_RAMBANK("bank11") + AM_RANGE(0xb000, 0xbfff) AM_RAMBANK("bank12") + AM_RANGE(0xc000, 0xcfff) AM_RAMBANK("bank13") + AM_RANGE(0xd000, 0xdfff) AM_RAMBANK("bank14") + AM_RANGE(0xe000, 0xefff) AM_RAMBANK("bank15") + AM_RANGE(0xf000, 0xffff) AM_RAMBANK("bank16") +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( abc806_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc806_io, AS_IO, 8, abc806_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, inp_r, out_w) + AM_RANGE(0x01, 0x01) AM_MIRROR(0xff18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, stat_r, cs_w) + AM_RANGE(0x02, 0x02) AM_MIRROR(0xff18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c1_w) + AM_RANGE(0x03, 0x03) AM_MIRROR(0xff18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c2_w) + AM_RANGE(0x04, 0x04) AM_MIRROR(0xff18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c3_w) + AM_RANGE(0x05, 0x05) AM_MIRROR(0xff18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c4_w) + AM_RANGE(0x06, 0x06) AM_MIRROR(0xff18) AM_WRITE(hrs_w) + AM_RANGE(0x07, 0x07) AM_MIRROR(0xff18) AM_DEVREAD(ABCBUS_TAG, abcbus_slot_t, rst_r) AM_WRITE(hrc_w) + AM_RANGE(0x20, 0x23) AM_MIRROR(0xff0c) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x31, 0x31) AM_MIRROR(0xff00) AM_DEVREAD(MC6845_TAG, mc6845_device, register_r) + AM_RANGE(0x34, 0x34) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_READWRITE(mai_r, mao_w) + AM_RANGE(0x35, 0x35) AM_MIRROR(0xff00) AM_READWRITE(ami_r, amo_w) + AM_RANGE(0x36, 0x36) AM_MIRROR(0xff00) AM_READWRITE(sti_r, sto_w) + AM_RANGE(0x37, 0x37) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_READWRITE(cli_r, sso_w) + AM_RANGE(0x38, 0x38) AM_MIRROR(0xff00) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) + AM_RANGE(0x39, 0x39) AM_MIRROR(0xff00) AM_DEVWRITE(MC6845_TAG, mc6845_device, register_w) + AM_RANGE(0x40, 0x43) AM_MIRROR(0xff1c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio2_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x60, 0x63) AM_MIRROR(0xff1c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( abc800 ) +//------------------------------------------------- + +INPUT_PORTS_START( abc800 ) + PORT_START("SB") + PORT_DIPNAME( 0xff, 0xaa, "Serial Communications" ) PORT_DIPLOCATION("SB:1,2,3,4,5,6,7,8") + PORT_DIPSETTING( 0xaa, "Asynchronous, Single Speed" ) + PORT_DIPSETTING( 0x2e, "Asynchronous, Split Speed" ) + PORT_DIPSETTING( 0x50, "Synchronous" ) + PORT_DIPSETTING( 0x8b, "ABC NET" ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( abc802 ) +//------------------------------------------------- + +static INPUT_PORTS_START( abc802 ) + PORT_START("SB") + PORT_DIPNAME( 0xff, 0xaa, "Serial Communications" ) PORT_DIPLOCATION("SB:1,2,3,4,5,6,7,8") + PORT_DIPSETTING( 0xaa, "Asynchronous, Single Speed" ) + PORT_DIPSETTING( 0x2e, "Asynchronous, Split Speed" ) + PORT_DIPSETTING( 0x50, "Synchronous" ) + PORT_DIPSETTING( 0x8b, "ABC NET" ) + + PORT_START("CONFIG") + PORT_DIPNAME( 0x01, 0x00, "Clear Screen Time Out" ) PORT_DIPLOCATION("S1:1") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("S2:1") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, "Characters Per Line" ) PORT_DIPLOCATION("S3:1") + PORT_DIPSETTING( 0x00, "40" ) + PORT_DIPSETTING( 0x04, "80" ) + PORT_DIPNAME( 0x08, 0x08, "Frame Frequency" ) + PORT_DIPSETTING( 0x00, "60 Hz" ) + PORT_DIPSETTING( 0x08, "50 Hz" ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( abc806 ) +//------------------------------------------------- + +static INPUT_PORTS_START( abc806 ) + PORT_START("SB") + PORT_DIPNAME( 0xff, 0xaa, "Serial Communications" ) PORT_DIPLOCATION("SB:1,2,3,4,5,6,7,8") + PORT_DIPSETTING( 0xaa, "Asynchronous, Single Speed" ) + PORT_DIPSETTING( 0x2e, "Asynchronous, Split Speed" ) + PORT_DIPSETTING( 0x50, "Synchronous" ) + PORT_DIPSETTING( 0x8b, "ABC NET" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// Z80CTC +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc800_state::ctc_z0_w ) +{ + if (BIT(m_sb, 2)) + { + m_sio->txca_w(state); + m_ctc->trg3(state); + } + + clock_cassette(state); +} + +WRITE_LINE_MEMBER( abc800_state::ctc_z1_w ) +{ + if (BIT(m_sb, 3)) + { + m_sio->rxca_w(state); + } + + if (BIT(m_sb, 4)) + { + m_sio->txca_w(state); + m_ctc->trg3(state); + } +} + +WRITE_LINE_MEMBER( abc800_state::ctc_z2_w ) +{ + m_dart->rxca_w(state); + m_dart->txca_w(state); +} + +//------------------------------------------------- +// Z80SIO +//------------------------------------------------- + +void abc800_state::clock_cassette(int state) +{ + if (m_cassette == NULL) return; + + if (m_ctc_z0 && !state) + { + m_sio_txcb = !m_sio_txcb; + m_sio->txcb_w(!m_sio_txcb); + + if (m_sio_txdb || m_sio_txcb) + { + m_dfd_out = !m_dfd_out; + m_cassette->output((m_dfd_out & m_sio_rtsb) ? +1.0 : -1.0); + } + + if (m_tape_ctr < 15) + { + m_tape_ctr++; + } + + m_sio->rxcb_w(m_tape_ctr == 15); + } + + m_ctc_z0 = state; +} + +WRITE_LINE_MEMBER( abc800_state::sio_txdb_w ) +{ + m_sio_txdb = state; +} + +WRITE_LINE_MEMBER( abc800_state::sio_dtrb_w ) +{ + if (m_cassette == NULL) return; + + if (state) + { + m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_cassette_timer->enable(true); + } + else + { + m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_cassette_timer->enable(false); + } +} + +WRITE_LINE_MEMBER( abc800_state::sio_rtsb_w ) +{ + if (m_cassette == NULL) return; + + m_sio_rtsb = state; + + if (!m_sio_rtsb) + { + m_cassette->output(-1.0); + } +} + +//------------------------------------------------- +// Z80DART abc802 +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc802_state::lrs_w ) +{ + m_lrs = state; + + bankswitch(); +} + +WRITE_LINE_MEMBER( abc802_state::mux80_40_w ) +{ + m_80_40_mux = state; +} + +//------------------------------------------------- +// Z80DART abc806 +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc806_state::keydtr_w ) +{ + m_keydtr = state; + + bankswitch(); +} + +//------------------------------------------------- +// z80_daisy_config abc800_daisy_chain +//------------------------------------------------- + +static const z80_daisy_config abc800_daisy_chain[] = +{ + { Z80CTC_TAG }, + { Z80SIO_TAG }, + { Z80DART_TAG }, + { NULL } +}; + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void abc800_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_ID_CTC: + m_ctc->trg0(1); + m_ctc->trg0(0); + + m_ctc->trg1(1); + m_ctc->trg1(0); + + m_ctc->trg2(1); + m_ctc->trg2(0); + break; + + case TIMER_ID_CASSETTE: + { + int dfd_in = m_cassette->input() > 0; + + if (m_dfd_in && !dfd_in) + { + m_sio->rxb_w(!(m_tape_ctr == 15)); + } + + if (!dfd_in && (m_tape_ctr == 15)) + { + m_tape_ctr = 4; + } + + m_dfd_in = dfd_in; + } + break; + } +} + + +//------------------------------------------------- +// machine_start +//------------------------------------------------- + +void abc800_state::machine_start() +{ + // start timers + m_ctc_timer = timer_alloc(TIMER_ID_CTC); + m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2)); + + m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE); + m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); + m_cassette_timer->enable(false); + + // register for state saving + save_item(NAME(m_fetch_charram)); + save_item(NAME(m_pling)); + save_item(NAME(m_sb)); + save_item(NAME(m_ctc_z0)); + save_item(NAME(m_sio_txcb)); + save_item(NAME(m_sio_txdb)); + save_item(NAME(m_sio_rtsb)); + save_item(NAME(m_dfd_out)); + save_item(NAME(m_dfd_in)); + save_item(NAME(m_tape_ctr)); +} + + +//------------------------------------------------- +// machine_reset +//------------------------------------------------- + +void abc800_state::machine_reset() +{ + m_sb = m_io_sb->read(); + + m_fetch_charram = 0; + bankswitch(); + + m_dart->ria_w(1); + + // 50/60 Hz + m_dart->ctsb_w(0); // 0 = 50Hz, 1 = 60Hz + + m_dfd_in = 0; +} + + +//------------------------------------------------- +// machine_start +//------------------------------------------------- + +void abc802_state::machine_start() +{ + // start timers + m_ctc_timer = timer_alloc(TIMER_ID_CTC); + m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2)); + + m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE); + m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); + + // register for state saving + save_item(NAME(m_pling)); + save_item(NAME(m_sb)); + save_item(NAME(m_ctc_z0)); + save_item(NAME(m_sio_txcb)); + save_item(NAME(m_sio_txdb)); + save_item(NAME(m_sio_rtsb)); + save_item(NAME(m_dfd_out)); + save_item(NAME(m_dfd_in)); + save_item(NAME(m_tape_ctr)); + save_item(NAME(m_lrs)); +} + + +//------------------------------------------------- +// machine_reset +//------------------------------------------------- + +void abc802_state::machine_reset() +{ + UINT8 config = m_config->read(); + m_sb = m_io_sb->read(); + + // memory banking + m_lrs = 1; + bankswitch(); + + // clear screen time out (S1) + m_sio->dcdb_w(BIT(config, 0)); + + // unknown (S2) + m_sio->ctsb_w(BIT(config, 1)); + + // 40/80 char (S3) + m_dart->ria_w(BIT(config, 2)); // 0 = 40, 1 = 80 + + // 50/60 Hz + m_dart->ctsb_w(BIT(config, 3)); // 0 = 50Hz, 1 = 60Hz + + m_dfd_in = 0; +} + + +//------------------------------------------------- +// machine_start +//------------------------------------------------- + +void abc806_state::machine_start() +{ + // start timers + m_ctc_timer = timer_alloc(TIMER_ID_CTC); + m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2)); + + // setup memory banking + UINT8 *mem = m_rom->base(); + UINT32 videoram_size = m_ram->size() - (32 * 1024); + int bank; + char bank_name[10]; + + m_video_ram.allocate(videoram_size); + + for (bank = 1; bank <= 16; bank++) + { + sprintf(bank_name,"bank%d",bank); + membank(bank_name)->configure_entry(0, mem + (0x1000 * (bank - 1))); + membank(bank_name)->configure_entry(1, m_video_ram); + membank(bank_name)->set_entry(0); + } + + // register for state saving + save_item(NAME(m_fetch_charram)); + save_item(NAME(m_pling)); + save_item(NAME(m_sb)); + save_item(NAME(m_ctc_z0)); + save_item(NAME(m_sio_txcb)); + save_item(NAME(m_sio_txdb)); + save_item(NAME(m_sio_rtsb)); + save_item(NAME(m_dfd_out)); + save_item(NAME(m_dfd_in)); + save_item(NAME(m_tape_ctr)); + save_item(NAME(m_keydtr)); + save_item(NAME(m_eme)); + save_item(NAME(m_map)); +} + + +//------------------------------------------------- +// machine_reset +//------------------------------------------------- + +void abc806_state::machine_reset() +{ + m_sb = m_io_sb->read(); + + // setup memory banking + int bank; + char bank_name[10]; + + for (bank = 1; bank <= 16; bank++) + { + sprintf(bank_name,"bank%d",bank); + membank(bank_name)->set_entry(0); + } + + bankswitch(); + + // clear STO lines + m_eme = 0; + m_40 = 0; + m_hru2_a8 = 0; + m_txoff = 0; + m_rtc->cs_w(1); + m_rtc->clk_w(1); + m_rtc->dio_w(1); + + m_dart->ria_w(1); + + // 50/60 Hz + m_dart->ctsb_w(0); // 0 = 50Hz, 1 = 60Hz + + m_dfd_in = 0; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( abc800c ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( abc800c, abc800c_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) + MCFG_CPU_CONFIG(abc800_daisy_chain) + MCFG_CPU_PROGRAM_MAP(abc800c_mem) + MCFG_CPU_IO_MAP(abc800c_io) + + // video hardware + MCFG_FRAGMENT_ADD(abc800c_video) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(abc800) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + // peripheral hardware + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(abc800_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(abc800_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(abc800_state, ctc_z2_w)) + + MCFG_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) + + MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc800") + MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) + + // ABC bus + MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_cards, "abc830") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "abc800") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "abc800_hdd") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( abc800m ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( abc800m, abc800m_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) + MCFG_CPU_CONFIG(abc800_daisy_chain) + MCFG_CPU_PROGRAM_MAP(abc800m_mem) + MCFG_CPU_IO_MAP(abc800m_io) + + // video hardware + MCFG_FRAGMENT_ADD(abc800m_video) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(abc800) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + // peripheral hardware + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(abc800_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(abc800_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(abc800_state, ctc_z2_w)) + + MCFG_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) + + MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc800") + MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) + + // ABC bus + MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_cards, "abc830") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "abc800") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "abc800_hdd") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( abc802 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( abc802, abc802_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) + MCFG_CPU_CONFIG(abc800_daisy_chain) + MCFG_CPU_PROGRAM_MAP(abc802_mem) + MCFG_CPU_IO_MAP(abc802_io) + + // video hardware + MCFG_FRAGMENT_ADD(abc802_video) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(abc800) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + // peripheral hardware + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(abc800_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(abc800_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(abc800_state, ctc_z2_w)) + + MCFG_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) + MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc802_state, lrs_w)) + MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc802_state, mux80_40_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) + + MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc55") + MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) + + // ABC bus + MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_cards, "abc834") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // software list + //MCFG_SOFTWARE_LIST_ADD("flop_list", "abc802") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "abc800_hdd") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( abc806 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( abc806, abc806_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) + MCFG_CPU_CONFIG(abc800_daisy_chain) + MCFG_CPU_PROGRAM_MAP(abc806_mem) + MCFG_CPU_IO_MAP(abc806_io) + + // video hardware + MCFG_FRAGMENT_ADD(abc806_video) + + // peripheral hardware + MCFG_E0516_ADD(E0516_TAG, ABC806_X02) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(abc800_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(abc800_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(abc800_state, ctc_z2_w)) + + MCFG_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc800_state, sio_txdb_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) + MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc806_state, keydtr_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) + + MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc77") + MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) + + // ABC bus + MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_cards, "abc832") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("512K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "abc806") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "abc800_hdd") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +/* + + ABC800 DOS ROMs + + Label Drive Type + ---------------------------- + ABC 6-1X ABC830,DD82,DD84 + 800 8" DD88 + ABC 6-2X ABC832 + ABC 6-3X ABC838 + ABC 6-5X UFD dos + ABC 6-52 UFD dos with HD + UFD 6.XX Winchester + + + Floppy Controllers + + Art N/O + -------- + 55 10761-01 "old" controller + 55 10828-01 "old" controller + 55 20900-0x + 55 21046-11 Luxor Conkort 25 pin D-sub connector + 55 21046-21 Luxor Conkort 34 pin FDD connector + 55 21046-41 Luxor Conkort both of the above + +*/ + +//------------------------------------------------- +// ROM( abc800c ) +//------------------------------------------------- + +ROM_START( abc800c ) + ROM_REGION( 0x8000, Z80_TAG, 0 ) + ROM_LOAD( "abc c-1.1m", 0x0000, 0x1000, CRC(37009d29) SHA1(a1acd817ff8c2ed93935a163c5cf3d83d8bd6fb5) ) + ROM_LOAD( "abc 1-1.1l", 0x1000, 0x1000, CRC(ff15a28d) SHA1(bb4523ab1d190bc787f1923567b86795f66c26e2) ) + ROM_LOAD( "abc 2-1.1k", 0x2000, 0x1000, CRC(6ff2f528) SHA1(32d1639769c4a20b7a45c44f4c6993f77397f7a1) ) + ROM_LOAD( "abc 3-1.1j", 0x3000, 0x1000, CRC(9a43c47a) SHA1(964eb28e3d9779d1b13e0e938495133bbdb3aed3) ) + ROM_LOAD( "abc 4-1.2m", 0x4000, 0x1000, CRC(ba18db9c) SHA1(0c4543766fe9b10bee333f3f832f6f2209e449f8) ) + ROM_LOAD( "abc 5-1.2l", 0x5000, 0x1000, CRC(abbeb026) SHA1(44ebe417e3fa8d7878c23b56782aac8b443f1bfc) ) + ROM_LOAD( "abc 6-1.2k", 0x6000, 0x1000, CRC(4bd5e808) SHA1(5ca0a60571de6cfa3d6d166e0cde3c78560569f3) ) // 1981-01-12 + ROM_LOAD( "abc 7-22.2j", 0x7000, 0x1000, CRC(774511ab) SHA1(5171e43213a402c2d96dee33453c8306ac1aafc8) ) + + ROM_REGION( 0x20, "hru", 0 ) + ROM_LOAD( "hru i.4g", 0x00, 0x20, CRC(d970a972) SHA1(c47fdd61fccc68368d42f03a01c7af90ab1fe1ab) ) + + ROM_REGION( 0x200, "hru2", 0 ) + ROM_LOAD( "hru ii.3a", 0x000, 0x200, CRC(8e9d7cdc) SHA1(4ad16dc0992e31cdb2e644c7be81d334a56f7ad6) ) +ROM_END + + +//------------------------------------------------- +// ROM( abc800m ) +//------------------------------------------------- + +ROM_START( abc800m ) + ROM_REGION( 0x8000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS("ufd20") + ROM_LOAD( "abc m-12.1m", 0x0000, 0x1000, CRC(f85b274c) SHA1(7d0f5639a528d8d8130a22fe688d3218c77839dc) ) + ROM_LOAD( "abc 1-12.1l", 0x1000, 0x1000, CRC(1e99fbdc) SHA1(ec6210686dd9d03a5ed8c4a4e30e25834aeef71d) ) + ROM_LOAD( "abc 2-12.1k", 0x2000, 0x1000, CRC(ac196ba2) SHA1(64fcc0f03fbc78e4c8056e1fa22aee12b3084ef5) ) + ROM_LOAD( "abc 3-12.1j", 0x3000, 0x1000, CRC(3ea2b5ee) SHA1(5a51ac4a34443e14112a6bae16c92b5eb636603f) ) + ROM_LOAD( "abc 4-12.2m", 0x4000, 0x1000, CRC(695cb626) SHA1(9603ce2a7b2d7b1cbeb525f5493de7e5c1e5a803) ) + ROM_LOAD( "abc 5-12.2l", 0x5000, 0x1000, CRC(b4b02358) SHA1(95338efa3b64b2a602a03bffc79f9df297e9534a) ) + ROM_SYSTEM_BIOS( 0, "13", "ABC-DOS (1982-07-19)" ) + ROMX_LOAD( "abc 6-13.2k", 0x6000, 0x1000, CRC(6fa71fb6) SHA1(b037dfb3de7b65d244c6357cd146376d4237dab6), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "ufd19", "UFD-DOS v.19 (1983-05-31)" ) + ROMX_LOAD( "abc 6-11 ufd.2k", 0x6000, 0x1000, CRC(2a45be80) SHA1(bf08a18a74e8bdaee2656a3c8246c0122398b58f), ROM_BIOS(2) ) // is this "ABC 6-5" or "ABC 6-51" instead? + ROM_SYSTEM_BIOS( 2, "ufd20", "UFD-DOS v.20 (1984-03-02)" ) + ROMX_LOAD( "abc 6-52.2k", 0x6000, 0x1000, CRC(c311b57a) SHA1(4bd2a541314e53955a0d53ef2f9822a202daa485), ROM_BIOS(3) ) + ROM_LOAD_OPTIONAL( "abc 7-21.2j", 0x7000, 0x1000, CRC(fd137866) SHA1(3ac914d90db1503f61397c0ea26914eb38725044) ) + ROM_LOAD( "abc 7-22.2j", 0x7000, 0x1000, CRC(774511ab) SHA1(5171e43213a402c2d96dee33453c8306ac1aafc8) ) + + ROM_REGION( 0x800, MC6845_TAG, 0 ) + ROM_LOAD( "vum se.7c", 0x000, 0x800, CRC(f9152163) SHA1(997313781ddcbbb7121dbf9eb5f2c6b4551fc799) ) + + ROM_REGION( 0x20, "hru", 0 ) + ROM_LOAD( "hru i.4g", 0x00, 0x20, CRC(d970a972) SHA1(c47fdd61fccc68368d42f03a01c7af90ab1fe1ab) ) + + ROM_REGION( 0x200, "hru2", 0 ) + ROM_LOAD( "hru ii.3a", 0x000, 0x200, CRC(8e9d7cdc) SHA1(4ad16dc0992e31cdb2e644c7be81d334a56f7ad6) ) +ROM_END + + +//------------------------------------------------- +// ROM( abc802 ) +//------------------------------------------------- + +ROM_START( abc802 ) + ROM_REGION( 0x8000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS("ufd20") + ROM_LOAD( "abc 02-11.9f", 0x0000, 0x2000, CRC(b86537b2) SHA1(4b7731ef801f9a03de0b5acd955f1e4a1828355d) ) + ROM_LOAD( "abc 12-11.11f", 0x2000, 0x2000, CRC(3561c671) SHA1(f12a7c0fe5670ffed53c794d96eb8959c4d9f828) ) + ROM_LOAD( "abc 22-11.12f", 0x4000, 0x2000, CRC(8dcb1cc7) SHA1(535cfd66c84c0370fd022d6edf702d3d1ad1b113) ) + ROM_SYSTEM_BIOS( 0, "abc", "ABC-DOS (1983-05-31)" ) + ROMX_LOAD( "abc 32-12.14f", 0x6000, 0x2000, CRC(23cd0f43) SHA1(639daec4565dcdb4de408b808d0c6cd97baa35d2), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "ufd19", "UFD-DOS v.19 (1984-03-02)" ) + ROMX_LOAD( "abc 32-21.14f", 0x6000, 0x2000, CRC(57050b98) SHA1(b977e54d1426346a97c98febd8a193c3e8259574), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "ufd20", "UFD-DOS v.20 (1984-04-03)" ) + ROMX_LOAD( "abc 32-31.14f", 0x6000, 0x2000, CRC(fc8be7a8) SHA1(a1d4cb45cf5ae21e636dddfa70c99bfd2050ad60), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "mica620", "MICA DOS v.20 (1984-03-02)" ) + ROMX_LOAD( "mica820.14f", 0x6000, 0x2000, CRC(edf998af) SHA1(daae7e1ff6ef3e0ddb83e932f324c56f4a98f79b), ROM_BIOS(4) ) + + ROM_REGION( 0x1000, MC6845_TAG, 0 ) + ROM_LOAD( "abc t02-1.3g", 0x0000, 0x1000, CRC(4d54eed8) SHA1(04cb5fc5f3d7ba9b9a5ae0ec94241d1fe83647f7) ) // 64 90191-01 + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "abc p2-1.2g", 0x000, 0x400, NO_DUMP ) // PAL16R4 +ROM_END + + +//------------------------------------------------- +// ROM( abc806 ) +//------------------------------------------------- + +ROM_START( abc806 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS("ufd20") + ROM_LOAD( "abc 06-11.1m", 0x0000, 0x1000, CRC(27083191) SHA1(9b45592273a5673e4952c6fe7965fc9398c49827) ) // BASIC PROM ABC 06-11 "64 90231-02" + ROM_LOAD( "abc 16-11.1l", 0x1000, 0x1000, CRC(eb0a08fd) SHA1(f0b82089c5c8191fbc6a3ee2c78ce730c7dd5145) ) // BASIC PROM ABC 16-11 "64 90232-02" + ROM_LOAD( "abc 26-11.1k", 0x2000, 0x1000, CRC(97a95c59) SHA1(013bc0a2661f4630c39b340965872bf607c7bd45) ) // BASIC PROM ABC 26-11 "64 90233-02" + ROM_LOAD( "abc 36-11.1j", 0x3000, 0x1000, CRC(b50e418e) SHA1(991a59ed7796bdcfed310012b2bec50f0b8df01c) ) // BASIC PROM ABC 36-11 "64 90234-02" + ROM_LOAD( "abc 46-11.2m", 0x4000, 0x1000, CRC(17a87c7d) SHA1(49a7c33623642b49dea3d7397af5a8b9dde8185b) ) // BASIC PROM ABC 46-11 "64 90235-02" + ROM_LOAD( "abc 56-11.2l", 0x5000, 0x1000, CRC(b4b02358) SHA1(95338efa3b64b2a602a03bffc79f9df297e9534a) ) // BASIC PROM ABC 56-11 "64 90236-02" + ROM_SYSTEM_BIOS( 0, "ufd19", "UFD-DOS v.19 (1984-03-02)" ) + ROMX_LOAD( "abc 66-21.2k", 0x6000, 0x1000, CRC(c311b57a) SHA1(4bd2a541314e53955a0d53ef2f9822a202daa485), ROM_BIOS(1) ) // DOS PROM ABC 66-21 "64 90314-01" + ROM_SYSTEM_BIOS( 1, "ufd20", "UFD-DOS v.20 (1984-04-03)" ) + ROMX_LOAD( "abc 66-31.2k", 0x6000, 0x1000, CRC(a2e38260) SHA1(0dad83088222cb076648e23f50fec2fddc968883), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "mica20", "MICA DOS v.20 (1984-04-03)" ) + ROMX_LOAD( "mica2006.2k", 0x6000, 0x1000, CRC(58bc2aa8) SHA1(0604bd2396f7d15fcf3d65888b4b673f554037c0), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "catnet", "CAT-NET" ) + ROMX_LOAD( "cmd8_5.2k", 0x6000, 0x1000, CRC(25430ef7) SHA1(03a36874c23c215a19b0be14ad2f6b3b5fb2c839), ROM_BIOS(4) ) + ROM_LOAD_OPTIONAL( "abc 76-11.2j", 0x7000, 0x1000, CRC(3eb5f6a1) SHA1(02d4e38009c71b84952eb3b8432ad32a98a7fe16) ) // Options-PROM ABC 76-11 "64 90238-02" + ROM_LOAD( "abc 76-xx.2j", 0x7000, 0x1000, CRC(b364cc49) SHA1(9a2c373778856a31902cdbd2ae3362c200a38e24) ) // Enhanced Options-PROM + + ROM_REGION( 0x1000, MC6845_TAG, 0 ) + ROM_LOAD( "abc t6-11.7c", 0x0000, 0x1000, CRC(b17c51c5) SHA1(e466e80ec989fbd522c89a67d274b8f0bed1ff72) ) // 64 90243-01 + + ROM_REGION( 0x200, "rad", 0 ) + ROM_LOAD( "60 90241-01.9b", 0x000, 0x200, CRC(ad549ebb) SHA1(4fe228ce3b84ed6f0ffd5431f2f33b94c3e5268b) ) // "RAD" 7621/7643 (82S131/82S137), character line address + + ROM_REGION( 0x20, "hru", 0 ) + ROM_LOAD( "60 90128-01.6e", 0x00, 0x20, CRC(d970a972) SHA1(c47fdd61fccc68368d42f03a01c7af90ab1fe1ab) ) // "HRU I" 7603 (82S123), HR horizontal timing and video memory access + + ROM_REGION( 0x200, "hru2", 0 ) + ROM_LOAD( "60 90127-01.12g", 0x000, 0x200, CRC(8e9d7cdc) SHA1(4ad16dc0992e31cdb2e644c7be81d334a56f7ad6) ) // "HRU II" 7621 (82S131), ABC800C HR compatibility mode palette + + ROM_REGION( 0x200, "v50", 0 ) + ROM_LOAD( "60 90242-01.7e", 0x000, 0x200, CRC(788a56d8) SHA1(d81e55cdddc36f5d41bf0a33104c75fac590b764) ) // "V50" 7621 (82S131), HR vertical timing 50Hz + + //ROM_REGION( 0x200, "v60", 0 ) + //ROM_LOAD( "60 90319-01.7e", 0x000, 0x200, NO_DUMP ) // "V60" 7621 (82S131), HR vertical timing 60Hz + + ROM_REGION( 0x400, "att_hand", 0 ) + /* + 1 E6P (RAD A8) + 2 THP (chargen A12) + 3 CCLK + 4 B0 (TX ATT 6) + 5 B1 (TX ATT 7) + 6 CONDP (40/80) + 7 B2 (TX ATT 0) + 8 B3 (TX ATT 1) + 9 ULP (RAD A5) + 10 FLP (RAD A6) + 11 F2P (RTF) + 12 GND + 13 F3P (GTF) + 14 F4P (BTF) + 15 B5P (RTB) + 16 B4 (TX ATT 2) + 17 B5 (TX ATT 3) + 18 B6 (TX ATT 4) + 19 B7 (TX ATT 5) + 20 LP (*DEN+3) + 21 B6P (GTB) + 22 B7P (BTB) + 23 E5P (RAD A7) + 24 Vcc + */ + ROM_LOAD( "60 90225-01.11c", 0x000, 0x400, NO_DUMP ) // "VIDEO ATTRIBUTE" 40033A (?) + + ROM_REGION( 0x104, "abc_p3", 0 ) + ROM_LOAD( "60 90239-01.1b", 0x000, 0x104, CRC(f3d0ba00) SHA1(bcc0ee26ecac0028aef6bf5cb308133b509bb360) ) // "ABC P3-11" PAL16R4, color encoder + + ROM_REGION( 0x104, "abc_p4", 0 ) + ROM_LOAD( "60 90240-01.2d", 0x000, 0x104, CRC(3cc5518d) SHA1(343cf951d01c9d361b695bb4e80eaadf0820b6bc) ) // "ABC P4-11" PAL16L8, memory mapper +ROM_END + + + +//************************************************************************** +// DRIVER INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// DRIVER_INIT( abc800c ) +//------------------------------------------------- + +DIRECT_UPDATE_MEMBER( abc800c_state::direct_update_handler ) +{ + if (address >= 0x7c00 && address < 0x8000) + { + direct.explicit_configure(0x7c00, 0x7fff, 0x3ff, m_rom->base() + 0x7c00); + + if (!m_fetch_charram) + { + m_fetch_charram = 1; + bankswitch(); + } + + return ~0; + } + + if (m_fetch_charram) + { + m_fetch_charram = 0; + bankswitch(); + } + + return address; +} + +DRIVER_INIT_MEMBER(abc800c_state,driver_init) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc800c_state::direct_update_handler), this)); +} + + +//------------------------------------------------- +// DRIVER_INIT( abc800m ) +//------------------------------------------------- + +DIRECT_UPDATE_MEMBER( abc800m_state::direct_update_handler ) +{ + if (address >= 0x7800 && address < 0x8000) + { + direct.explicit_configure(0x7800, 0x7fff, 0x7ff, m_rom->base() + 0x7800); + + if (!m_fetch_charram) + { + m_fetch_charram = 1; + bankswitch(); + } + + return ~0; + } + + if (m_fetch_charram) + { + m_fetch_charram = 0; + bankswitch(); + } + + return address; +} + +DRIVER_INIT_MEMBER(abc800m_state,driver_init) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc800m_state::direct_update_handler), this)); +} + + +//------------------------------------------------- +// DRIVER_INIT( abc802 ) +//------------------------------------------------- + +DIRECT_UPDATE_MEMBER( abc802_state::direct_update_handler ) +{ + if (m_lrs) + { + if (address >= 0x7800 && address < 0x8000) + { + direct.explicit_configure(0x7800, 0x7fff, 0x7ff, m_rom->base() + 0x7800); + return ~0; + } + } + + return address; +} + +DRIVER_INIT_MEMBER(abc802_state,driver_init) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc802_state::direct_update_handler), this)); +} + + +//------------------------------------------------- +// DRIVER_INIT( abc806 ) +//------------------------------------------------- + +DIRECT_UPDATE_MEMBER( abc806_state::direct_update_handler ) +{ + if (address >= 0x7800 && address < 0x8000) + { + direct.explicit_configure(0x7800, 0x7fff, 0x7ff, m_rom->base() + 0x7800); + + if (!m_fetch_charram) + { + m_fetch_charram = 1; + bankswitch(); + } + + return ~0; + } + + if (m_fetch_charram) + { + m_fetch_charram = 0; + bankswitch(); + } + + return address; +} + +DRIVER_INIT_MEMBER(abc806_state,driver_init) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc806_state::direct_update_handler), this)); +} + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1981, abc800c, 0, 0, abc800c, abc800, abc800c_state, driver_init, "Luxor Datorer AB", "ABC 800 C/HR", MACHINE_SUPPORTS_SAVE ) +COMP( 1981, abc800m, abc800c, 0, abc800m, abc800, abc800m_state, driver_init, "Luxor Datorer AB", "ABC 800 M/HR", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, abc802, 0, 0, abc802, abc802, abc802_state, driver_init, "Luxor Datorer AB", "ABC 802", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, abc806, 0, 0, abc806, abc806, abc806_state, driver_init, "Luxor Datorer AB", "ABC 806", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/ac1.c b/src/mame/drivers/ac1.c new file mode 100644 index 00000000000..bf67bbfff9e --- /dev/null +++ b/src/mame/drivers/ac1.c @@ -0,0 +1,218 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + AC1 video driver by Miodrag Milanovic + + 15/01/2009 Preliminary driver. + + 24/02/2011 Added cassette support ('ac1' and 'ac1_32' only) + + Note that Z command will get you into BASIC, and BYE command + takes you back to the Monitor. + + S xxxx yyyy = to save memory to tape. + L = to load it back in. + + Since there is no motor control, type in L then mount the tape. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80pio.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "includes/ac1.h" + +static GFXDECODE_START( ac1 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, ac1_charlayout, 0, 1 ) +GFXDECODE_END + +/* Address maps */ +static ADDRESS_MAP_START(ac1_mem, AS_PROGRAM, 8, ac1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff ) AM_ROM // Monitor + AM_RANGE( 0x0800, 0x0fff ) AM_ROM // BASIC + AM_RANGE( 0x1000, 0x17ff ) AM_RAM // Video RAM + AM_RANGE( 0x1800, 0x1fff ) AM_RAM // RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ac1_32_mem, AS_PROGRAM, 8, ac1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff ) AM_ROM // Monitor + AM_RANGE( 0x0800, 0x0fff ) AM_ROM // BASIC + AM_RANGE( 0x1000, 0x17ff ) AM_RAM // Video RAM + AM_RANGE( 0x1800, 0xffff ) AM_RAM // RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ac1_io, AS_IO, 8, ac1_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ac1 ) + PORT_START("LINE.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') + + PORT_START("LINE.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + + PORT_START("LINE.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("LINE.4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + + PORT_START("LINE.5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) +INPUT_PORTS_END + +/* Machine driver */ +static MACHINE_CONFIG_START( ac1, ac1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz / 4) + MCFG_CPU_PROGRAM_MAP(ac1_mem) + MCFG_CPU_IO_MAP(ac1_io) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_8MHz / 4) + MCFG_Z80PIO_IN_PA_CB(READ8(ac1_state, ac1_port_a_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(ac1_state, ac1_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(ac1_state, ac1_port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(ac1_state, ac1_port_b_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*6, 16*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 16*8-1) + MCFG_SCREEN_UPDATE_DRIVER(ac1_state, screen_update_ac1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ac1 ) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ac1_32, ac1 ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(ac1_32_mem) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(64*6, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1) + MCFG_SCREEN_UPDATE_DRIVER(ac1_state, screen_update_ac1_32) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ac1 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v1", "Version 3.1 (orig)" ) + ROMX_LOAD( "mon_v31_16.bin", 0x0000, 0x0800, CRC(1ba65e4d) SHA1(3382b8d03f31166a56aea49fd1ec1e82a7108300), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v2", "Version 3.1 (fixed)" ) + ROMX_LOAD( "mon_v31_16_v2.bin", 0x0000, 0x0800, CRC(8904beb4) SHA1(db8d00a2537ac3a662e3c91e55eb2bf824a72062), ROM_BIOS(2)) + // from Funkamateur 01/85 + ROM_LOAD( "minibasic.bin", 0x0800, 0x0800, CRC(06782639) SHA1(3fd57b3ae3f538374b0d794d8aa15d06bcaaddd8)) + ROM_REGION(0x0800, "gfx1",0) + // 64 chars - U402 BM513 + ROM_LOAD ("u402.bin", 0x0000, 0x0200, CRC(cfb67f28) SHA1(e3a62a3a8bce0d098887e31fd16410f38832fd18)) + ROM_COPY("gfx1", 0x0000, 0x0200, 0x0200) + ROM_COPY("gfx1", 0x0000, 0x0400, 0x0200) + ROM_COPY("gfx1", 0x0000, 0x0600, 0x0200) +ROM_END + +ROM_START( ac1_32 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mon_v31_32.bin", 0x0000, 0x0800, CRC(bea78b1a) SHA1(8a3e2ac2033aa0bb016be742cfea7e4b09c0813b)) + // from Funkamateur 01/85 + ROM_LOAD( "minibasic.bin", 0x0800, 0x0800, CRC(06782639) SHA1(3fd57b3ae3f538374b0d794d8aa15d06bcaaddd8)) + ROM_REGION(0x0800, "gfx1",0) + ROM_SYSTEM_BIOS( 0, "128", "128 chars" ) + // 128 chars - U555 or 2708 from Funkamateur 06/86 128 including pseudo graphics + ROMX_LOAD ("zg_128.bin", 0x0000, 0x0400, CRC(0a6f7796) SHA1(64d77639b1ea23f45b4bd38c251851acb2d03822), ROM_BIOS(1)) + ROMX_LOAD ("zg_128.bin", 0x0400, 0x0400, CRC(0a6f7796) SHA1(64d77639b1ea23f45b4bd38c251851acb2d03822), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "256", "256 chars" ) + // 256 chars - 2716 from Computerclub Dessau including pseudo graphics + ROMX_LOAD ("zg_256.bin", 0x0000, 0x0800, CRC(b4171df5) SHA1(abdec4e00257f86b1a57e02b9c6b4d2df2a2a2db), ROM_BIOS(2)) +ROM_END + +ROM_START( ac1scch ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v7", "Version 7" ) + ROMX_LOAD( "mon_v7.bin", 0x0000, 0x1000, CRC(fd17b0cf) SHA1(e47113025bd9dadc1522425e21703f43e584b00f),ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v8", "Version 8" ) + ROMX_LOAD( "mon_v8.bin", 0x0000, 0x1000, CRC(5af68da5) SHA1(e760d4400b9c937e7e789d52b8ec975ff253a122),ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v10", "Version 10" ) + ROMX_LOAD( "mon_v10.bin", 0x0000, 0x1000, CRC(f8e67ecb) SHA1(7953676fc8c22824ceff464c7177e9ac0343b8ce),ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "v1088", "Version 10/88" ) + ROMX_LOAD( "mon_v1088.bin", 0x0000, 0x1000, CRC(bbb0a6df) SHA1(de9389e142541a8b5ff238b59e98bf571c794bef),ROM_BIOS(4)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("zg_scch.bin", 0x0000, 0x0800, CRC(fbfaf5da) SHA1(667568c5909e9a17675cf09dfbce2fc090c420ab)) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, ac1, 0, 0, ac1, ac1, ac1_state, ac1, "Frank Heyder", "Amateurcomputer AC1 Berlin", 0 ) +COMP( 1984, ac1_32, ac1, 0, ac1_32, ac1, ac1_state, ac1, "Frank Heyder", "Amateurcomputer AC1 Berlin (32 lines)", 0 ) +COMP( 1984, ac1scch, ac1, 0, ac1_32, ac1, ac1_state, ac1, "Frank Heyder", "Amateurcomputer AC1 SCCH", 0 ) diff --git a/src/mame/drivers/acrnsys1.c b/src/mame/drivers/acrnsys1.c new file mode 100644 index 00000000000..23d35f2807a --- /dev/null +++ b/src/mame/drivers/acrnsys1.c @@ -0,0 +1,282 @@ +// license:BSD-3-Clause +// copyright-holders:Dirk Best, Robbbert +/****************************************************************************** + + Acorn System 1 (Microcomputer Kit) + + Skeleton driver + + Driver by Dirk Best + +2011-06-26 Keyboard & display fixed. [Robbbert] + + +http://speleotrove.com/acorn/ + +- (modify) Memory display and modification l (load) Reads a block of bytes from tape +X (go) Run program starting at an address r (return) Resume after a breakpoint +p (point) Inserts or removes breakpoint (up) Increment displayed address +s (store) Writes a block of bytes to tape (down) Decrement displayed address + +Pasting: + 0-F : as is + (inc) : ^ + (dec) : V + M (memory) : - + G (Go) : X + +Test Paste: + -0100^11^22^33^44^55^66^77^88^99^-0100^ + Now press up-arrow to confirm the data has been entered. + + +Example usage: Turn on. Press -. Mode letter will show 'A'. Type in an address + (example FE00). Press - (or any command key). Contents will show + on the right. Use Up & Down keys to cycle through addresses. + +To save a tape, press S then enter start address, press S, enter end address+1, + start recording and press S. The save only takes a few seconds. + +To load a tape, the display must just have dots, (reset if necessary), start + playing tape and immediately press L. The last digit will flicker + as the bytes load. At the end, the dots will show again. There's + no error checking, so if it doesn't work, reset and try again. + +Note that left-most digit is not wired up, and therefore will always be blank. + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/ins8154.h" +#include "machine/74145.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "acrnsys1.lh" + + +class acrnsys1_state : public driver_device +{ +public: + acrnsys1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ttl74145(*this, "ic8_7445"), + m_cass(*this, "cassette"), + m_digit(0) + { } + + DECLARE_READ8_MEMBER(ins8154_b1_port_a_r); + DECLARE_WRITE8_MEMBER(ins8154_b1_port_a_w); + DECLARE_WRITE8_MEMBER(acrnsys1_led_segment_w); + TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_c); + TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_p); +private: + required_device m_maincpu; + required_device m_ttl74145; + required_device m_cass; + UINT8 m_digit; + UINT8 m_cass_data[4]; + bool m_cass_state; + bool m_cassold; +}; + + + +/*************************************************************************** + KEYBOARD HANDLING +***************************************************************************/ +// bit 7 is cassin +READ8_MEMBER( acrnsys1_state::ins8154_b1_port_a_r ) +{ + UINT8 data = 0x7f, i, key_line = m_ttl74145->read(); + + for (i = 0; i < 8; i++) + { + if (BIT(key_line, i)) + { + char kbdrow[6]; + sprintf(kbdrow,"X%X",i); + data = (ioport(kbdrow)->read() & 0x38) | m_digit; + break; + } + } + data |= m_cass_data[2]; + return data; +} + +// bit 6 is cassout +WRITE8_MEMBER( acrnsys1_state::ins8154_b1_port_a_w ) +{ + m_digit = data & 0x47; + m_ttl74145->write(m_digit & 7); + m_cass_state = BIT(data, 6); +} + +TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_c) +{ + m_cass_data[3]++; + + if (m_cass_state != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_p) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_cass_data[2] = ((m_cass_data[1] < 12) ? 128 : 0); + m_cass_data[1] = 0; + } +} + +/*************************************************************************** + LED DISPLAY +***************************************************************************/ + +WRITE8_MEMBER( acrnsys1_state::acrnsys1_led_segment_w ) +{ + UINT8 key_line = m_ttl74145->read(); + + output_set_digit_value(key_line, data); +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( acrnsys1_map, AS_PROGRAM, 8, acrnsys1_state ) + AM_RANGE(0x0000, 0x03ff) AM_RAM + AM_RANGE(0x0e00, 0x0e7f) AM_MIRROR(0x100) AM_DEVREADWRITE("b1", ins8154_device, ins8154_r, ins8154_w) + AM_RANGE(0x0e80, 0x0eff) AM_MIRROR(0x100) AM_RAM + AM_RANGE(0xf800, 0xf9ff) AM_MIRROR(0x600) AM_ROM +ADDRESS_MAP_END + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( acrnsys1 ) + PORT_START("X0") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X1") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X2") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X3") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X4") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X5") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X6") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X7") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("reset") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RST") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("switch") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Switch") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("config") + PORT_CONFNAME( 0x03, 0x00, "Switch connected to") + PORT_CONFSETTING( 0x00, "IRQ" ) + PORT_CONFSETTING( 0x01, "NMI" ) + PORT_CONFSETTING( 0x02, "RST" ) +INPUT_PORTS_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static MACHINE_CONFIG_START( acrnsys1, acrnsys1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 1008000) /* 1.008 MHz */ + MCFG_CPU_PROGRAM_MAP(acrnsys1_map) + + MCFG_DEFAULT_LAYOUT(layout_acrnsys1) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD("b1", INS8154, 0) + MCFG_INS8154_IN_A_CB(READ8(acrnsys1_state, ins8154_b1_port_a_r)) + MCFG_INS8154_OUT_A_CB(WRITE8(acrnsys1_state, ins8154_b1_port_a_w)) + MCFG_INS8154_OUT_B_CB(WRITE8(acrnsys1_state, acrnsys1_led_segment_w)) + MCFG_DEVICE_ADD("ic8_7445", TTL74145, 0) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_c", acrnsys1_state, acrnsys1_c, attotime::from_hz(4800)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_p", acrnsys1_state, acrnsys1_p, attotime::from_hz(40000)) +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( acrnsys1 ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("acrnsys1.bin", 0xf800, 0x0200, CRC(43dcfc16) SHA1(b987354c55beb5e2ced761970c3339b895a8c09d)) +ROM_END + + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, acrnsys1, 0, 0, acrnsys1, acrnsys1, driver_device, 0, "Acorn", "Acorn System 1", 0 ) diff --git a/src/mame/drivers/adam.c b/src/mame/drivers/adam.c new file mode 100644 index 00000000000..75682bad25d --- /dev/null +++ b/src/mame/drivers/adam.c @@ -0,0 +1,1147 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Coleco Adam + + The Coleco ADAM is a Z80-based micro with all peripheral devices + attached to an internal serial serial bus (ADAMnet) managed by 6801 + microcontrollers (processor, internal RAM, internal ROM, serial port).Each + device had its own 6801, and the ADAMnet was managed by a "master" 6801 on + the ADAM motherboard. Each device was allotted a block of 21 bytes in Z80 + address space; device control was accomplished by poking function codes into + the first byte of each device control block (hereafter DCB) after setup of + other DCB locations with such things as: buffer address in Z80 space, # of + bytes to transfer, block # to access if it was a block device like a tape + or disk drive, etc. The master 6801 would interpret this data, and pass + along internal ADAMnet requests to the desired peripheral, which would then + send/receive its data and return the status of the operation. The status + codes were left in the same byte of the DCB as the function request, and + certain bits of the status byte would reflect done/working on it/error/ + not present, and error codes were left in another DCB byte for things like + CRC error, write protected disk, missing block, etc. + + ADAM's ROM operating system, EOS (Elementary OS), was constructed + similar to CP/M in that it provided both a filesystem (like BDOS) and raw + device interface (BIOS). At the file level, sequential files could be + created, opened, read, written, appended, closed, and deleted. Forward- + only random access was implemented (you could not move the R/W pointer + backward, except clear to the beginning!), and all files had to be + contiguous on disk/tape. Directories could be initialized or searched + for a matching filename (no wildcards allowed). At the device level, + individual devices could be read/written by block (for disks/tapes) or + character-by-character (for printer, keyboard, and a prototype serial + board which was never released). Devices could be checked for their + ADAMnet status, and reset if necessary. There was no function provided + to do low-level formatting of disks/tapes. + + At system startup, the EOS was loaded from ROM into the highest + 8K of RAM, a function call made to initialize the ADAMnet, and then + any disks or tapes were checked for a boot medium; if found, block 0 of + the medium was loaded in, and a jump made to the start of the boot code. + The boot block would take over loading in the rest of the program. If no + boot media were found, a jump would be made to a ROM word processor (called + SmartWriter). + + Coleco designed the ADAMnet to have up to 15 devices attached. + Before they went bankrupt, Coleco had released a 64K memory expander and + a 300-baud internal modem, but surprisingly neither of these was an + ADAMnet device. Disassembly of the RAMdisk drivers in ADAM CP/M 2.2, and + of the ADAMlink terminal program revealed that these were simple port I/O + devices, banks of XRAM being accessed by a special memory switch port not + documented as part of the EOS. The modem did not even use the interrupt + capabilities of the Z80--it was simply polled. A combination serial/ + parallel interface, each port of which *was* an ADAMnet device, reached the + prototype stage, as did a 5MB hard disk, but neither was ever released to + the public. (One prototype serial/parallel board is still in existence, + but the microcontroller ROMs have not yet been succcessfully read.) So + when Coleco finally bailed out of the computer business, a maximum ADAM + system consisted of a daisy wheel printer, a keyboard, 2 tape drives, and + 2 disk drives (all ADAMnet devices), a 64K expander and a 300-baud modem + (which were not ADAMnet devices). + + Third-party vendors reverse-engineered the modem (which had a + 2651 UART at its heart) and made a popular serial interface board. It was + not an ADAMnet device, however, because nobody knew how to make a new ADAMnet + device (no design specs were ever released), and the 6801 microcontrollers + had unreadable mask ROMs. Disk drives, however, were easily upgraded from + 160K to as high as 1MB because, for some unknown reason, the disk controller + boards used a separate microprocessor and *socketed* EPROM (which was + promptly disassembled and reworked). Hard drives were cobbled together from + a Kaypro-designed board and accessed as standard I/O port devices. A parallel + interface card was similarly set up at its own I/O port. + + Devices (15 max): + Device 0 = Master 6801 ADAMnet controller (uses the adam_pcb as DCB) + Device 1 = Keyboard + Device 2 = ADAM printer + Device 3 = Copywriter (projected) + Device 4 = Disk drive 1 + Device 5 = Disk drive 2 + Device 6 = Disk drive 3 (third party) + Device 7 = Disk drive 4 (third party) + Device 8 = Tape drive 1 + Device 9 = Tape drive 3 (projected) + Device 10 = Unused + Device 11 = Non-ADAMlink modem + Device 12 = Hi-resolution monitor + Device 13 = ADAM parallel interface (never released) + Device 14 = ADAM serial interface (never released) + Device 15 = Gateway + Device 24 = Tape drive 2 (share DCB with Tape1) + Device 25 = Tape drive 4 (projected, may have share DCB with Tape3) + Device 26 = Expansion RAM disk drive (third party ID, not used by Coleco) + + Terminology: + EOS = Elementary Operating System + DCB = Device Control Block Table (21bytes each DCB, DCB+16=dev#, DCB+0=Status Byte) (0xFD7C) + + 0 Status byte + 1-2 Buffer start address (lobyte, hibyte) + 3-4 Buffer length (lobyte, hibyte) + 5-8 Block number accessed (loword, hiword in lobyte, hibyte format) + 9 High nibble of device number + 10-15 Always zero (unknown purpose) + 16 Low nibble of device number + 17-18 Maximum block length (lobyte, hibyte) + 19 Device type (0 for block device, 1 for character device) + 20 Node type + + - Writing to byte0 requests the following operations: + 1 Return current status + 2 Soft reset + 3 Write + 4 Read + + + FCB = File Control Block Table (32bytes, 2 max each application) (0xFCB0) + OCB = Overlay Control Block Table + adam_pcb = Processor Control Block Table, 4bytes (adam_pcb+3 = Number of valid DCBs) (0xFEC0 relocatable), current adam_pcb=[0xFD70] + adam_pcb+0 = Status, 0=Request Status of Z80 -> must return 0x81..0x82 to sync Master 6801 clk with Z80 clk + adam_pcb+1,adam_pcb+2 = address of adam_pcb start + adam_pcb+3 = device # + + - Writing to byte0: + 1 Synchronize the Z80 clock (should return 0x81) + 2 Synchronize the Master 6801 clock (should return 0x82) + 3 Relocate adam_pcb + + - Status values: + 0x80 -> Success + 0x81 -> Z80 clock in sync + 0x82 -> Master 6801 clock in sync + 0x83 -> adam_pcb relocated + 0x9B -> Time Out + + DEV_ID = Device id + + + The ColecoAdam I/O map is contolled by the MIOC (Memory Input Output Controller): + + 20-3F (W) = Adamnet Writes + 20-3F (R) = Adamnet Reads + + 42-42 (W) = Expansion RAM page selection, only useful if expansion greater than 64k + + 40-40 (W) = Printer Data Out + 40-40 (R) = Printer (Returns 0x41) + + 5E-5E (RW)= Modem Data I/O + 5F-5F (RW)= Modem Data Control Status + + 60-7F (W) = Set Memory configuration + 60-7F (R) = Read Memory configuration + + 80-9F (W) = Set both controllers to keypad mode + 80-9F (R) = Not Connected + + A0-BF (W) = Video Chip (TMS9928A), A0=0 -> Write Register 0 , A0=1 -> Write Register 1 + A0-BF (R) = Video Chip (TMS9928A), A0=0 -> Read Register 0 , A0=1 -> Read Register 1 + + C0-DF (W) = Set both controllers to joystick mode + C0-DF (R) = Not Connected + + E0-FF (W) = Sound Chip (SN76489A) + E0-FF (R) = Read Controller data, A1=0 -> read controller 1, A1=1 -> read controller 2 +*/ + +/* + Detailed Coleco ADAM Computer I/O Address Map + +Port # Device Input Output +__________________________________________________________________________________________ + +00 Powermate SASI Hard Drive Input Data Output Data +01 Powermate SASI Hard Drive Status Register Command Register +01 MIB2 RESET line * Not Used on MIB2 * Bit 3 = 1 for MIB2 RESET +01 Powermate IDE Hard Drive Error Register * Not Used on IDE HD * +02 Powermate IDE Hard Drive Sector Count Register Sector Count Register +03 Powermate IDE Hard Drive Sector Number Register Sector Number Register +04 Powermate IDE Hard Drive Cylinder Low Register Cylinder Low Register +05 Powermate IDE Hard Drive Cylinder High Register Cylinder High Register +06 Powermate IDE Hard Drive SDH Register SDH Register +07 Powermate IDE Hard Drive Status Register Command Register +08 Bonafide Sys MIDI Interface +09 Bonafide Sys MIDI Interface +0A Bonafide Sys MIDI Interface +0B Bonafide Sys MIDI Interface +0C Bonafide Sys MIDI Interface +0D Bonafide Sys MIDI Interface +0E Bonafide Sys MIDI Interface +0F Bonafide Sys MIDI Interface +10 Powermate Serial ports Mode Register A Mode Register A +11 Powermate Serial ports Status Register A Clock Select Reg A +12 Powermate Serial ports * DO NOT USE * Command Register A +13 Powermate Serial ports RX Holding Register A TX Holding Reg A +14 Powermate Serial ports Input Port Change Reg Aux Control Register +15 Powermate Serial ports Interrupt Status Reg Interrupt Mask Reg +16 Powermate Serial ports Read Counter Upper Set C/T Upper Register +17 Powermate Serial ports Read Counter Lower Set C/T Lower Register +18 Powermate Serial ports Mode Register B Mode Register B +19 Powermate Serial ports Status Register B Clock Select Reg B +1A Powermate Serial ports * DO NOT USE * Command Register B +1B Powermate Serial ports RX Holding Register B TX Holding Register B +1C Powermate Serial ports * Reserved (note 5) * MIB3 Serial Port RESET +1D Powermate Serial ports Read Input Port Bits Output Port Config Reg +1E Coleco AutoDialer ?? ?? +1E Powermate Serial ports Start Counter Cmd Port Set Output Port Bits +1F Powermate Serial ports Stop Counter Cmd Port Reset Output Port Bits +20-3F AdamNet Reset Input MAY be available Output is NOT available +40 Parallel Printer interface Printer status Output Data +41 May be unused (see note 1) Input may NOT be avail Output MAY be available +42 Expansion Memory * Not Used * Bank Number +43 May be unused (see note 1) Input may NOT be avail Output MAY be available +44-47 Eve/Orphanware Serial Port +48-4B Eve Speech Synth/Clock Card +4C-4F Orphanware Serial Port 2 (Standard Eve 80 column terminal ports) +4F Coleco Steering controller (Listed in Hackers guide as Expansion conn #2) +50-53 Super Game Module +54-57 Orphanware Serial Port 3 (Standard Orphanware 80 column terminal ports) +58 Powermate IDE Hard Disk Input Data Lower 8 bits Output Data Lower 8 bits +59 Powermate IDE Hard Disk Input Data Upper 8 bits Output Data Upper 8 bits +5A Powermate IDE Hard Disk Alternate Status Reg Fixed Disk Control Reg +5B Powermate IDE Hard Disk Digital Input Register ** Not Used by IDE HD ** +5C-5F Orphanware Serial Port 4 +5E Adamlink Modem Input Data Output Data +5F Adamlink Modem Status Control +60-7F Memory Bank Switch Port Input MAY be available Output is NOT available +80-8F *** Unused *** (see note 2) STA (?) +90-9F Orphanware Hard Drive STA (?) +A0-BF Video Display Processor +C0 Strobe Reset STB (?) +C1-DF *** Unused *** (see note 2) STB (?) +EO-FF Sound Chip (Out only) +FC Joystick #1 (In only) +FE Joystick #2 (In only) + + +Notes: + +1) Port 41 or port 43 is used by the Eve 80 column unit as a keyboard input port. +2) Not useable from expansion card slots (can't read or write data to or from ports) - + may be available on side port. +3) Powermate IDE hard disk drive will not interfere with Powermate serial ports. +4) Powermate serial ports will probably interfere with autodialer. +5) Reserved ports in Powermate serial port map: Input ports 12 and 1A - screw up serial + ports if used; Input port 1C doesn't bother anything but the 2681 drives the bus; +6) Orphanware serial port number 4 probably interferes with the ADAMlink modem. + 7) According to my analysis of circuit U6 in the ADAM computer, all of upper I/O address + space is decoded (by an LS138). However, not all outputs appear to be used. The + circuit description follows. Please correct any misassumptions I've made. Note that + if my analysis is correct, then the Orphanware hard disk should be interfering with + the signal STA\ (which is associated with the joysticks in some way). + + + + U6 + 74LS138 A6 A5 WR\ + |--------------| + WR\ -----|A Y0|o---- 0 0 0 80-9F Write (STA\) + | | + A5 -----|B Y1|o---- 0 0 1 80-9F Read (Not Used) + | | + A6 -----|C Y2|o---- 0 1 0 A0-BF Write (VDP CSW\) + | | + A7 -----|G1 Y3|o---- 0 1 1 A0-BF Read (VDP CSR\) + | | +IORQ\ ----o|G2A Y4|o---- 1 0 0 C0-DF Write (STB\) + | | +WAIT\ ----o|G2B Y5|o---- 1 0 1 C0-DF Read (Not Used) + | | + | Y6|o---- 1 1 0 E0-FF Write (Sound CE\) + | | + | Y7|o---- 1 1 1 E0-FF Read (Joystick Enables) + |--------------| + +Conventions: + +1) The "o" symbol next to an input or an output implies that the pin requires an active + low signal. +2) The "\" symbol following a signal mnemonic indicates that the signal is active low. + + +Rev. 3 +8/30/92 +Mark Gordon +*/ + +/* + + TODO: + + - spinner INT + - printer + - SPI + + http://drushel.cwru.edu/atm/atm.html + http://rich.dirocco.org/Coleco/adam/ADAM.htm + http://users.stargate.net/~drushel/pub/coleco/twwmca/index.html + +*/ + +#include "includes/adam.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +enum +{ + LO_SMARTWRITER = 0, + LO_INTERNAL_RAM, + LO_RAM_EXPANSION, + LO_OS7_ROM_INTERNAL_RAM +}; + + +enum +{ + HI_INTERNAL_RAM = 0, + HI_ROM_EXPANSION, + HI_RAM_EXPANSION, + HI_CARTRIDGE_ROM +}; + + +enum +{ + ADAMNET_MASTER = 0, + ADAMNET_KEYBOARD, + ADAMNET_DDP, + ADAMNET_PRINTER, + ADAMNET_FDC +}; + + + +//************************************************************************** +// MEMORY BANKING +//************************************************************************** + +//------------------------------------------------- +// mreq_r - memory request read +//------------------------------------------------- + +READ8_MEMBER( adam_state::mreq_r ) +{ + int bmreq = 0, biorq = 1, eos_enable = 1, boot_rom_cs = 1, aux_decode_1 = 1, aux_rom_cs = 1, cas1 = 1, cas2 = 1, cs1 = 1, cs2 = 1, cs3 = 1, cs4 = 1; + + UINT8 data = 0; + + if (offset < 0x8000) + { + switch (m_mioc & 0x03) + { + case LO_SMARTWRITER: + boot_rom_cs = 0; + eos_enable = BIT(m_an, 1); + break; + + case LO_INTERNAL_RAM: + cas1 = 0; + break; + + case LO_RAM_EXPANSION: + cas2 = 0; + break; + + case LO_OS7_ROM_INTERNAL_RAM: + if (offset < 0x2000) + { + aux_decode_1 = 0; + } + else + { + cas1 = 0; + } + break; + } + } + else + { + switch ((m_mioc >> 2) & 0x03) + { + case HI_INTERNAL_RAM: + cas1 = 0; + break; + + case HI_ROM_EXPANSION: + aux_rom_cs = 0; + break; + + case HI_RAM_EXPANSION: + if (m_game) + { + aux_decode_1 = 0; + } + else + { + cas2 = 0; + } + break; + + case HI_CARTRIDGE_ROM: + aux_decode_1 = 0; + break; + } + } + + if (!cas1) + { + data = m_ram->pointer()[offset]; + } + + if (!boot_rom_cs) + { + if (offset < 0x6000) + { + data = m_boot_rom->base()[offset]; + } + else + { + data = m_boot_rom->base()[(eos_enable << 13) + offset]; + } + } + + if (!aux_decode_1) + { + switch (offset >> 13) + { + case 0: // U2 + data = m_os7_rom->base()[offset]; + break; + + case 1: break; + case 2: break; + + case 4: + cs1 = 0; + break; + + case 5: + cs2 = 0; + break; + + case 6: + cs3 = 0; + break; + + case 7: + cs4 = 0; + break; + } + } + + data = m_cart->bd_r(space, offset & 0x7fff, data, cs1, cs2, cs3, cs4); + data = m_slot1->bd_r(space, offset & 0xff, data, 1, biorq, 1, 1, 1); + data = m_slot2->bd_r(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2); + data = m_slot3->bd_r(space, offset, data, 1, 1, 1, cas1, cas2); + + return data; +} + + +//------------------------------------------------- +// mreq_w - memory request write +//------------------------------------------------- + +WRITE8_MEMBER( adam_state::mreq_w ) +{ + int bmreq = 0, biorq = 1, aux_rom_cs = 1, cas1 = 1, cas2 = 1; + + if (offset < 0x8000) + { + switch (m_mioc & 0x03) + { + case LO_INTERNAL_RAM: + cas1 = 0; + break; + + case LO_RAM_EXPANSION: + cas2 = 0; + break; + + case LO_OS7_ROM_INTERNAL_RAM: + if (offset >= 0x2000) + { + cas1 = 0; + } + break; + } + } + else + { + switch ((m_mioc >> 2) & 0x03) + { + case HI_INTERNAL_RAM: + cas1 = 0; + break; + + case HI_RAM_EXPANSION: + if (!m_game) + { + cas2 = 0; + } + break; + } + } + + if (!cas1) + { + m_ram->pointer()[offset] = data; + } + + m_slot1->bd_w(space, offset & 0xff, data, 1, biorq, 1, 1, 1); + m_slot2->bd_w(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2); + m_slot3->bd_w(space, offset, data, 1, 1, 1, cas1, cas2); +} + + +//------------------------------------------------- +// iorq_r - I/O request read +//------------------------------------------------- + +READ8_MEMBER( adam_state::iorq_r ) +{ + int bmreq = 1, biorq = 0, aux_rom_cs = 1, cas1 = 1, cas2 = 1; + + UINT8 data = 0; + + switch ((offset >> 5) & 0x07) + { + case 1: + data = adamnet_r(space, 0); + break; + + case 3: + data = mioc_r(space, 0); + break; + + case 5: + if (BIT(offset, 0)) + { + data = m_vdc->register_read(space, 0); + } + else + { + data = m_vdc->vram_read(space, 0); + } + break; + + case 7: + if (BIT(offset, 1)) + { + data = m_joy2->read(); + } + else + { + data = m_joy1->read(); + } + break; + } + + data = m_slot1->bd_r(space, offset & 0xff, data, 1, biorq, 1, 1, 1); + data = m_slot2->bd_r(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2); + data = m_slot3->bd_r(space, offset, data, 1, 1, 1, cas1, cas2); + + return data; +} + + +//------------------------------------------------- +// iorq_w - I/O request write +//------------------------------------------------- + +WRITE8_MEMBER( adam_state::iorq_w ) +{ + int bmreq = 1, biorq = 0, aux_rom_cs = 1, cas1 = 1, cas2 = 1; + + switch ((offset >> 5) & 0x07) + { + case 1: + adamnet_w(space, 0, data); + break; + + case 3: + mioc_w(space, 0, data); + break; + + case 4: + m_joy1->common0_w(1); + m_joy1->common1_w(0); + m_joy2->common0_w(1); + m_joy2->common1_w(0); + break; + + case 5: + if (BIT(offset, 0)) + { + m_vdc->register_write(space, 0, data); + } + else + { + m_vdc->vram_write(space, 0, data); + } + break; + + case 6: + m_joy1->common0_w(0); + m_joy1->common1_w(1); + m_joy2->common0_w(0); + m_joy2->common1_w(1); + break; + + case 7: + m_psg->write(space, 0, data); + break; + } + + m_slot1->bd_w(space, offset & 0xff, data, 1, biorq, 1, 1, 1); + m_slot2->bd_w(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2); + m_slot3->bd_w(space, offset, data, 1, 1, 1, cas1, cas2); +} + + +//------------------------------------------------- +// mioc_r - +//------------------------------------------------- + +READ8_MEMBER( adam_state::mioc_r ) +{ + return m_mioc & 0x0f; +} + + +//------------------------------------------------- +// mioc_w - +//------------------------------------------------- + +WRITE8_MEMBER( adam_state::mioc_w ) +{ + /* + + bit description + + 0 Lower memory option 0 + 1 Lower memory option 1 + 2 Upper memory option 0 + 3 Upper memory option 1 + 4 + 5 + 6 + 7 + + */ + + m_mioc = data; +} + + + +//************************************************************************** +// ADAMNET +//************************************************************************** + +//------------------------------------------------- +// adamnet_r - +//------------------------------------------------- + +READ8_MEMBER( adam_state::adamnet_r ) +{ + return m_an & 0x0f; +} + + +//------------------------------------------------- +// adamnet_w - +//------------------------------------------------- + +WRITE8_MEMBER( adam_state::adamnet_w ) +{ + /* + + bit description + + 0 Network reset + 1 EOS enable + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + if (BIT(m_an, 0) && !BIT(data, 0)) + { + // network reset + m_adamnet->reset_w(ASSERT_LINE); + m_adamnet->reset_w(CLEAR_LINE); + } + + m_an = data; +} + + +//------------------------------------------------- +// m6801_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( adam_state::m6801_p1_w ) +{ + /* + + bit description + + 0 BA8 + 1 BA9 + 2 BA10 + 3 BA11 + 4 BA12 + 5 BA13 + 6 BA14 + 7 BA15 + + */ + + m_ba = (data << 8) | (m_ba & 0xff); +} + + +//------------------------------------------------- +// m6801_p2_r - +//------------------------------------------------- + +READ8_MEMBER( adam_state::m6801_p2_r ) +{ + /* + + bit description + + 0 M6801 mode bit 0 + 1 M6801 mode bit 1 + 2 M6801 mode bit 2 + 3 NET RXD + 4 + + */ + + UINT8 data = M6801_MODE_7; + + // NET RXD + data |= m_adamnet->rxd_r() << 3; + + return data; +} + + +//------------------------------------------------- +// m6801_p2_w - +//------------------------------------------------- + +WRITE8_MEMBER( adam_state::m6801_p2_w ) +{ + /* + + bit description + + 0 _DMA + 1 + 2 _BWR + 3 + 4 NET TXD + + */ + + // DMA + m_dma = BIT(data, 0); + + // write + m_bwr = BIT(data, 2); + + // NET TXD + m_adamnet->txd_w(BIT(data, 4)); +} + + +//------------------------------------------------- +// m6801_p3_r - +//------------------------------------------------- + +READ8_MEMBER( adam_state::m6801_p3_r ) +{ + /* + + bit description + + 0 BD0 + 1 BD1 + 2 BD2 + 3 BD3 + 4 BD4 + 5 BD5 + 6 BD6 + 7 BD7 + + */ + + return m_data_out; +} + + +//------------------------------------------------- +// m6801_p3_w - +//------------------------------------------------- + +WRITE8_MEMBER( adam_state::m6801_p3_w ) +{ + /* + + bit description + + 0 BD0 + 1 BD1 + 2 BD2 + 3 BD3 + 4 BD4 + 5 BD5 + 6 BD6 + 7 BD7 + + */ + + m_data_in = data; +} + + +//------------------------------------------------- +// m6801_p4_w - +//------------------------------------------------- + +WRITE8_MEMBER( adam_state::m6801_p4_w ) +{ + /* + + bit description + + 0 BA0 + 1 BA1 + 2 BA2 + 3 BA3 + 4 BA4 + 5 BA5 + 6 BA6 + 7 BA7 + + */ + + m_ba = (m_ba & 0xff00) | data; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( adam_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( adam_mem, AS_PROGRAM, 8, adam_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(mreq_r, mreq_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( adam_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( adam_io, AS_IO, 8, adam_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(iorq_r, iorq_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( m6801_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( m6801_mem, AS_PROGRAM, 8, adam_state ) + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(M6801_TAG, m6801_cpu_device, m6801_io_r, m6801_io_w) + AM_RANGE(0x0080, 0x00ff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6801_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( m6801_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( m6801_io, AS_IO, 8, adam_state ) + AM_RANGE(M6801_PORT1, M6801_PORT1) AM_WRITE(m6801_p1_w) + AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(m6801_p2_r, m6801_p2_w) + AM_RANGE(M6801_PORT3, M6801_PORT3) AM_READWRITE(m6801_p3_r, m6801_p3_w) + AM_RANGE(M6801_PORT4, M6801_PORT4) AM_WRITE(m6801_p4_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( adam ) +//------------------------------------------------- + +static INPUT_PORTS_START( adam ) + // defined in bus/adamnet/kb.c +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// TMS9928A_INTERFACE( vdc_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( adam_state::vdc_int_w ) +{ + if (state && !m_vdp_nmi) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } + + m_vdp_nmi = state; +} + +//------------------------------------------------- +// M6801_INTERFACE( m6801_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( adam_state::os3_w ) +{ + if (state && !m_dma) + { + if (!m_bwr) + { + //logerror("Master 6801 write to %04x data %02x\n", m_ba, m_data_in); + + m_ram->pointer()[m_ba] = m_data_in; + } + else + { + m_data_out = m_ram->pointer()[m_ba]; + + //logerror("Master 6801 read from %04x data %02x\n", m_ba, m_data_out); + + m_netcpu->set_input_line(M6801_SC1_LINE, ASSERT_LINE); + m_netcpu->set_input_line(M6801_SC1_LINE, CLEAR_LINE); + } + } +} + + +WRITE_LINE_MEMBER( adam_state::joy1_irq_w ) +{ + // TODO +} + +WRITE_LINE_MEMBER( adam_state::joy2_irq_w ) +{ + // TODO +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( adam ) +//------------------------------------------------- + +void adam_state::machine_start() +{ + // state saving + save_item(NAME(m_mioc)); + save_item(NAME(m_game)); + save_item(NAME(m_an)); + save_item(NAME(m_ba)); + save_item(NAME(m_dma)); + save_item(NAME(m_bwr)); + save_item(NAME(m_data_in)); + save_item(NAME(m_data_out)); + save_item(NAME(m_spindis)); + save_item(NAME(m_vdp_nmi)); +} + + +void adam_state::machine_reset() +{ + if (m_cart->exists()) + { + // game reset + m_game = 1; + m_mioc = (HI_CARTRIDGE_ROM << 2) | LO_OS7_ROM_INTERNAL_RAM; + } + else + { + // computer reset + m_game = 0; + m_mioc = 0; + } + + m_an = 0; + + m_maincpu->reset(); + m_netcpu->reset(); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// DEVICE_INPUT_DEFAULTS( drive2 ) +//------------------------------------------------- + +DEVICE_INPUT_DEFAULTS_START( drive2 ) + DEVICE_INPUT_DEFAULTS("SW3", 0x01, 0x01) +DEVICE_INPUT_DEFAULTS_END + + +//------------------------------------------------- +// MACHINE_CONFIG( adam ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( adam, adam_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_7_15909MHz/2) + MCFG_CPU_PROGRAM_MAP(adam_mem) + MCFG_CPU_IO_MAP(adam_io) + + MCFG_CPU_ADD(M6801_TAG, M6801, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(m6801_mem) + MCFG_CPU_IO_MAP(m6801_io) + MCFG_M6801_SC2(WRITELINE(adam_state, os3_w)) + MCFG_QUANTUM_PERFECT_CPU(M6801_TAG) + + // video hardware + MCFG_DEVICE_ADD(TMS9928A_TAG, TMS9928A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(adam_state, vdc_int_w)) + MCFG_TMS9928A_SCREEN_ADD_NTSC(SCREEN_TAG) + MCFG_SCREEN_UPDATE_DEVICE(TMS9928A_TAG, tms9928a_device, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SN76489A_TAG, SN76489A, XTAL_7_15909MHz/2) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SN76496_READY_HANDLER(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + + // devices + MCFG_ADAMNET_BUS_ADD() + MCFG_ADAMNET_SLOT_ADD("net1", adamnet_devices, "kb") + MCFG_ADAMNET_SLOT_ADD("net2", adamnet_devices, "prn") + MCFG_ADAMNET_SLOT_ADD("net3", adamnet_devices, "ddp") + MCFG_ADAMNET_SLOT_ADD("net4", adamnet_devices, "fdc") + MCFG_ADAMNET_SLOT_ADD("net5", adamnet_devices, "fdc") + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("fdc", drive2) + MCFG_ADAMNET_SLOT_ADD("net6", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net7", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net8", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net9", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net10", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net11", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net12", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net13", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net14", adamnet_devices, NULL) + MCFG_ADAMNET_SLOT_ADD("net15", adamnet_devices, NULL) + + MCFG_COLECOVISION_CARTRIDGE_SLOT_ADD(COLECOVISION_CARTRIDGE_SLOT_TAG, colecovision_cartridges, NULL) + MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_LEFT_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, adam_slot1_devices, "adamlink") + MCFG_ADAM_EXPANSION_SLOT_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_CENTER_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, adam_slot2_devices, NULL) + MCFG_ADAM_EXPANSION_SLOT_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_RIGHT_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, adam_slot3_devices, "ram") + + MCFG_COLECOVISION_CONTROL_PORT_ADD(CONTROL1_TAG, colecovision_control_port_devices, "hand") + MCFG_COLECOVISION_CONTROL_PORT_IRQ_CALLBACK(WRITELINE(adam_state, joy1_irq_w)) + MCFG_COLECOVISION_CONTROL_PORT_ADD(CONTROL2_TAG, colecovision_control_port_devices, NULL) + MCFG_COLECOVISION_CONTROL_PORT_IRQ_CALLBACK(WRITELINE(adam_state, joy2_irq_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("colec_cart_list", "coleco") + MCFG_SOFTWARE_LIST_ADD("adam_cart_list", "adam_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "adam_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "adam_flop") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( adam ) +//------------------------------------------------- + +ROM_START( adam ) + ROM_REGION( 0x2000, "os7", 0) + ROM_LOAD( "os7.u2", 0x0000, 0x2000, CRC(3aa93ef3) SHA1(45bedc4cbdeac66c7df59e9e599195c778d86a92) ) + + ROM_REGION( 0xa000, "boot", 0) + ROM_LOAD( "alf #1 rev 57 e3d5.u8", 0x0000, 0x2000, CRC(565b364a) SHA1(ebdafad6e268e7ed1674c1fb89607622748a5b36) ) + ROM_LOAD( "alf #2 rev 57 ae6a.u20", 0x2000, 0x2000, CRC(44a1cff4) SHA1(661cdf36d9699d6c21c5f9e205ebc41c707359dd) ) + ROM_LOAD( "alf #3 rev 57 8534.u21", 0x4000, 0x2000, CRC(77657b90) SHA1(d25d32ab6c8fafbc21b4b925b3e644fa26d111f7) ) + ROM_LOAD( "eos 6 rev 57 08dd.u22", 0x8000, 0x2000, CRC(ef6403c5) SHA1(28c7616cd02e4286f9b4c1c4a8b8850832b49fcb) ) + ROM_CONTINUE( 0x6000, 0x2000 ) + ROM_LOAD( "wp_r80.rom", 0x0000, 0x8000, BAD_DUMP CRC(58d86a2a) SHA1(d4aec4efe1431e56fe52d83baf9118542c525255) ) // should be separate 8/16K ROMs + + ROM_REGION( 0x800, M6801_TAG, 0 ) + ROM_LOAD( "master rev a 174b.u6", 0x000, 0x800, CRC(035a7a3d) SHA1(0426e6eaf18c2be9fe08066570c214ab5951ee14) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1982, adam, 0, coleco, adam, adam, driver_device, 0, "Coleco", "Adam", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/advision.c b/src/mame/drivers/advision.c new file mode 100644 index 00000000000..5dfb5985964 --- /dev/null +++ b/src/mame/drivers/advision.c @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/************************************************************************* + + drivers/advision.c + + Driver for the Entex Adventure Vision + +**************************************************************************/ + +/* + + TODO: + + - Turtles music is monotonous + - convert to discrete sound + - screen pincushion distortion + +*/ + +#include "emu.h" +#include "includes/advision.h" +#include "cpu/mcs48/mcs48.h" +#include "cpu/cop400/cop400.h" +#include "sound/dac.h" + +/* Memory Maps */ + +READ8_MEMBER( advision_state::rom_r ) +{ + offset += 0x400; + return m_cart->read_rom(space, offset & 0xfff); +} + +static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, advision_state ) + AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1") + AM_RANGE(0x0400, 0x0fff) AM_READ(rom_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( io_map, AS_IO, 8, advision_state ) + AM_RANGE(0x00, 0xff) AM_READWRITE(ext_ram_r, ext_ram_w) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(controller_r, bankswitch_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(av_control_w) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(vsync_r) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( advision ) + PORT_START("joystick") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY +INPUT_PORTS_END + +/* Machine Driver */ + +static MACHINE_CONFIG_START( advision, advision_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I8048_TAG, I8048, XTAL_11MHz) + MCFG_CPU_PROGRAM_MAP(program_map) + MCFG_CPU_IO_MAP(io_map) + + MCFG_CPU_ADD(COP411_TAG, COP411, 52631*16) // COP411L-KCN/N + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_RAM_POWER_SUPPLY, COP400_MICROBUS_DISABLED) + MCFG_COP400_READ_L_CB(READ8(advision_state, sound_cmd_r)) + MCFG_COP400_WRITE_G_CB(WRITE8(advision_state, sound_g_w)) + MCFG_COP400_WRITE_D_CB(WRITE8(advision_state, sound_d_w)) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(4*15) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(advision_state, screen_update) + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(84, 235, 60, 142) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(advision_state, advision) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "advision_cart") + MCFG_GENERIC_MANDATORY + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","advision") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( advision ) + ROM_REGION( 0x1000, I8048_TAG, ROMREGION_ERASE00 ) + ROM_LOAD( "b225__ins8048-11kdp_n.u5", 0x000, 0x400, CRC(279e33d1) SHA1(bf7b0663e9125c9bfb950232eab627d9dbda8460) ) // " /B225 \\ INS8048-11KDP/N" + + ROM_REGION( 0x200, COP411_TAG, 0 ) + ROM_LOAD( "b8223__cop411l-kcn_n.u8", 0x000, 0x200, CRC(81e95975) SHA1(8b6f8c30dd3e9d8e43f1ea20fba2361b383790eb) ) // " /B8223 \\ COP411L-KCN/N" +ROM_END + +/* Game Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1982, advision, 0, 0, advision, advision, driver_device, 0, "Entex", "Adventure Vision", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/aim65.c b/src/mame/drivers/aim65.c new file mode 100644 index 00000000000..163ea0e2774 --- /dev/null +++ b/src/mame/drivers/aim65.c @@ -0,0 +1,288 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner, Dan Boris, Dirk Best, Robbbert +/****************************************************************************** + PeT mess@utanet.at Nov 2000pia6821_device +Updated by Dan Boris, 3/4/2007 +Rewrite in progress, Dirk Best, 2007-07-31 + +ToDo: + - Printer. Tried to implement this but it was not working, currently disabled. + - Dual tape interface (done, but see bugs below) + - Implement punchtape reader/writer and TTY keyboard + - Front panel Reset switch (switch S1) + - Front panel Run/Step switch (switch S2) + +Bugs + - Cassette should output data on PB7, but the bit stays High. + - At the end of saving, both motors sometimes get turned on! + - CA2 should switch the cassette circuits between input and output. + It goes High on Read (correct) but doesn't go Low for Write. + - Read of CA1 is to check the printer, but it never happens. + - Write to CB1 should occur to activate printer's Start line, but it + also never happens. + - The common factor is the 6522, maybe it has problems.. + +******************************************************************************/ + +#include "includes/aim65.h" +#include "aim65.lh" + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +/* Note: RAM is mapped dynamically in machine/aim65.c */ +static ADDRESS_MAP_START( aim65_mem, AS_PROGRAM, 8, aim65_state ) + AM_RANGE( 0x1000, 0x9fff ) AM_NOP /* User available expansions */ + AM_RANGE( 0xa000, 0xa00f ) AM_MIRROR(0x3f0) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) // user via + AM_RANGE( 0xa400, 0xa47f ) AM_DEVICE("riot", mos6532_t, ram_map) + AM_RANGE( 0xa480, 0xa497 ) AM_DEVICE("riot", mos6532_t, io_map) + AM_RANGE( 0xa498, 0xa7ff ) AM_NOP /* Not available */ + AM_RANGE( 0xa800, 0xa80f ) AM_MIRROR(0x3f0) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) // system via + AM_RANGE( 0xac00, 0xac03 ) AM_DEVREADWRITE("pia6821", pia6821_device, read, write) + AM_RANGE( 0xac04, 0xac43 ) AM_RAM /* PIA RAM */ + AM_RANGE( 0xac44, 0xafff ) AM_NOP /* Not available */ + AM_RANGE( 0xb000, 0xffff ) AM_ROM /* 5 ROM sockets */ +ADDRESS_MAP_END + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( aim65 ) + PORT_START("keyboard_0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("keyboard_1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LF @") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(10) PORT_CHAR('@') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("keyboard_2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Print") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("keyboard_3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') + + PORT_START("keyboard_4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("keyboard_5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("keyboard_6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("keyboard_7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("switches") + PORT_DIPNAME(0x08, 0x08, "KB/TTY") + PORT_DIPLOCATION("S3:1") + PORT_DIPSETTING( 0x00, "TTY") + PORT_DIPSETTING( 0x08, "KB") +INPUT_PORTS_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +int aim65_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag) +{ + UINT32 size = slot->common_get_size(slot_tag); + + if (size > 0x1000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + if (image.software_entry() != NULL && image.get_software_region(slot_tag) == NULL) + { + std::string errmsg; + strprintf(errmsg,"Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension", + slot_tag, slot_tag); + image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); + return IMAGE_INIT_FAIL; + } + + slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + slot->common_load_rom(slot->get_rom_base(), size, slot_tag); + + return IMAGE_INIT_PASS; +} + + +static MACHINE_CONFIG_START( aim65, aim65_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, AIM65_CLOCK) /* 1 MHz */ + MCFG_CPU_PROGRAM_MAP(aim65_mem) + + + MCFG_DEFAULT_LAYOUT(layout_aim65) + + /* alpha-numeric display */ + MCFG_DEVICE_ADD("ds1", DL1416T, 0) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds1)) + MCFG_DEVICE_ADD("ds2", DL1416T, 0) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds2)) + MCFG_DEVICE_ADD("ds3", DL1416T, 0) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds3)) + MCFG_DEVICE_ADD("ds4", DL1416T, 0) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds4)) + MCFG_DEVICE_ADD("ds5", DL1416T, 0) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds5)) + + /* Sound - wave sound only */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* other devices */ + MCFG_DEVICE_ADD("riot", MOS6532n, AIM65_CLOCK) + MCFG_MOS6530n_OUT_PA_CB(WRITE8(aim65_state, aim65_riot_a_w)) + MCFG_MOS6530n_IN_PB_CB(READ8(aim65_state, aim65_riot_b_r)) + MCFG_MOS6530n_IRQ_CB(INPUTLINE("maincpu", M6502_IRQ_LINE)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) + MCFG_VIA6522_READPB_HANDLER(READ8(aim65_state, aim65_pb_r)) + // in CA1 printer ready? + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(aim65_state, aim65_pb_w)) + // out CB1 printer start + // out CA2 cass control (H=in) + // out CB2 turn printer on + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 0) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) + + MCFG_DEVICE_ADD("pia6821", PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(aim65_state, aim65_pia_a_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(aim65_state, aim65_pia_b_w)) + + // Deck 1 can play and record + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + // Deck 2 can only record + MCFG_CASSETTE_ADD( "cassette2" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_RECORD | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_GENERIC_SOCKET_ADD("z26", generic_plain_slot, "aim65_cart") + MCFG_GENERIC_EXTENSIONS("z26") + MCFG_GENERIC_LOAD(aim65_state, z26_load) + + MCFG_GENERIC_SOCKET_ADD("z25", generic_plain_slot, "aim65_cart") + MCFG_GENERIC_EXTENSIONS("z25") + MCFG_GENERIC_LOAD(aim65_state, z25_load) + + MCFG_GENERIC_SOCKET_ADD("z24", generic_plain_slot, "aim65_cart") + MCFG_GENERIC_EXTENSIONS("z24") + MCFG_GENERIC_LOAD(aim65_state, z24_load) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("1K,2K,3K") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","aim65_cart") +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( aim65 ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "aim65", "Rockwell AIM-65") + ROMX_LOAD("aim65mon.z23", 0xe000, 0x1000, CRC(90e44afe) SHA1(78e38601edf6bfc787b58750555a636b0cf74c5c), ROM_BIOS(1)) + ROMX_LOAD("aim65mon.z22", 0xf000, 0x1000, CRC(d01914b0) SHA1(e5b5ddd4cd43cce073a718ee4ba5221f2bc84eaf), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "dynatem", "Dynatem AIM-65") + ROMX_LOAD("dynaim65.z23", 0xe000, 0x1000, CRC(90e44afe) SHA1(78e38601edf6bfc787b58750555a636b0cf74c5c), ROM_BIOS(2)) + ROMX_LOAD("dynaim65.z22", 0xf000, 0x1000, CRC(83e1c6e7) SHA1(444134043edd83385bd70434cb100269901c4417), ROM_BIOS(2)) +ROM_END + +/* Currently dumped and available software: + * + * Name Loc CRC32 SHA1 + * ------------------------------------------------------------------------ + * Assembler Z24 0878b399 483e92b57d64be51643a9f6490521a8572aa2f68 + * Basic V1.1 Z25 d7b42d2a 4bbdb28d332429825adea0266ed9192786d9e392 + * Basic V1.1 Z26 36a61f39 f5ce0126cb594a565e730973fd140d03c298cefa + * Forth V1.3 Z25 0671d019 dd2a1613e435c833634100cf4a22c6cff70c7a26 + * Forth V1.3 Z26 a80ad472 42a2e8c86829a2fe48090e6665ff9fe25b12b070 + * Mathpack Z24 4889af55 5e9541ddfc06e3802d09b30d1bd89c5da914c76e + * Monitor Z22 d01914b0 e5b5ddd4cd43cce073a718ee4ba5221f2bc84eaf + * Monitor Z23 90e44afe 78e38601edf6bfc787b58750555a636b0cf74c5c + * Monitor Dynatem Z22 83e1c6e7 444134043edd83385bd70434cb100269901c4417 + * PL/65 V1.0 Z25 76dcf864 e937c54ed109401f796640cd45b27dfefb76667e + * PL/65 V1.0 Z26 2ac71abd 6df5e3125bebefac80d51d9337555f54bdf0d8ea + * + */ + + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP(1977, aim65, 0, 0, aim65, aim65, driver_device, 0, "Rockwell", "AIM 65", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/aim65_40.c b/src/mame/drivers/aim65_40.c new file mode 100644 index 00000000000..df749db8493 --- /dev/null +++ b/src/mame/drivers/aim65_40.c @@ -0,0 +1,145 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Rockwell AIM-65/40 + + Skeleton driver + +***************************************************************************/ + +/* + +Attached are the three main aim-65/40 roms, plus one unlabeled expansion rom for the 65/40 which someone had accidentally stuck into the aim-65 non/40 I was restoring on campus. (The rom pinout is different between the two systems, iirc.). I have no idea what that rom does. +The .zxx location on the rom filename (labeled R2332LP // R3224-11 // 8224) is hence wrong; it should probably be .z70 (at 0xc000-cfff) or .z72 (0xe000-0xefff) + + +The aim-65/40 has the following stuff on it: +XTALS: 16Mhz, 1.8432Mhz +6522 VIA ('Keyboard VIA' which reads the keyboard) +6522 VIA ('System VIA' which does the display and printer, and probably the cassette interface) +6522 VIA ('User VIA' which is in charge of the parallel port and expansion I/O) +6502 processor (clock is some division of the 16Mhz XTAL) +6551 ACIA (marked JACIA on board; used for serial port, has its own 1.8432Mhz XTAL) +Onboard beeper/speaker +Other chips: MC3242A, MC3480P, SN74159N, mc1488/1489 pair (for rs232) +ROM: 8 sockets meant for 2332 mask roms/mcm68732 eproms, or, if only 4 sockets are used, 2364 mask roms/mcm68764 eproms, selectable which mode by jumper. (normal 2732s won't work due to an inverted vpp pin i think, but theres jumpers on the board which will probably allow it), each socket addresses 0x1000 (or 0x2000) of space: +z63 is 0x8000-0x8fff, (see below about possible expansion ram here instead of rom) +z64 is 0x9000-0x9fff, (see below about possible expansion ram here instead of rom) +z65 is 0xa000-0xafff (first monitor rom lives here on my board),(see below about possible expansion ram here instead of rom) +z66 is 0xb000-0xbfff (second monitor rom lives here on my board),(see below about possible expansion ram here instead of rom) +z70 is 0xc000-0xcfff +z71 is 0xd000-0xdfff +z72 is 0xe000-0xefff +z73 is 0xf000-0xffff (i/o rom always lives here) +RAM: +The aim-65/40 comes standard with anywhere from 4k to 16k of ram at 0x0000-0x3fff, and can be populated in 4k increments with another 16k at 0x4000-0x7fff and another 16k at 0x8000-0xbfff (if installed, this last 16k prevents the first four rom sockets from being used since they address the same place, and the monitor roms must be moved to the z70 and z71, or z71 and z72 sockets. The i/o rom knows to search on 4k boundaries for the monitor roms) +The vias and acia are memory mapped over top of a blank area in the i/o rom from 0xff80 to 0xffe0, as such: +ff80-ff9f = unknown, open bus? +ffa0-ffaf = user via +ffb0-ffbf = system via +ffc0-ffcf = keyboars via +ffd0-ffd3 (mirrored at ffd4, ffd8, ffdc probably) = acia + +I have a copy of the official 'green book' Aim 65/40 i/o rom listing/asm source code, which is very informative about how the hardware works. However it is going to be a major pain in the ass to scan, owing to its small size and failing binding. +The source code there implies that *maybe* ff7e and ff7f are also open bus. + +*/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/6522via.h" +#include "machine/mos6551.h" +#include "aim65_40.lh" + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define M6502_TAG "m6502" +#define M6522_0_TAG "m6522_0" +#define M6522_1_TAG "m6522_1" +#define M6522_2_TAG "m6522_2" +#define M6551_TAG "m6551" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class aim65_40_state : public driver_device +{ +public: + aim65_40_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) { } + + // devices + device_t *m_via0; + device_t *m_via1; + device_t *m_via2; + device_t *m_speaker; +}; + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( aim65_40_mem, AS_PROGRAM, 8, aim65_40_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAM + AM_RANGE(0xa000, 0xff7f) AM_ROM + AM_RANGE(0xffa0, 0xffaf) AM_DEVREADWRITE(M6522_0_TAG, via6522_device, read, write) + AM_RANGE(0xffb0, 0xffbf) AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write) + AM_RANGE(0xffc0, 0xffcf) AM_DEVREADWRITE(M6522_2_TAG, via6522_device, read, write) + AM_RANGE(0xffd0, 0xffd3) AM_DEVREADWRITE(M6551_TAG, mos6551_device, read, write) + AM_RANGE(0xffe0, 0xffff) AM_ROM +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( aim65_40 ) +INPUT_PORTS_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static MACHINE_CONFIG_START( aim65_40, aim65_40_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M6502_TAG, M6502, 1000000) + MCFG_CPU_PROGRAM_MAP(aim65_40_mem) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_aim65_40) + + /* sound hardware */ + + /* devices */ + MCFG_DEVICE_ADD(M6522_0_TAG, VIA6522, 0) + MCFG_DEVICE_ADD(M6522_1_TAG, VIA6522, 0) + MCFG_DEVICE_ADD(M6522_2_TAG, VIA6522, 0) + MCFG_DEVICE_ADD(M6551_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) +MACHINE_CONFIG_END + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( aim65_40 ) + ROM_REGION( 0x10000, M6502_TAG, 0 ) + ROM_LOAD( "mon a v1.0 r32u5-11.z65", 0xa000, 0x1000, CRC(8c970c67) SHA1(5c8aecb2155a10777a57d4f0f2d16b7ba7b1fb45) ) + ROM_LOAD( "mon b v1.0 r32u6-11.z66", 0xb000, 0x1000, CRC(38a1e0cd) SHA1(37c34e32ad25d27e9590ee3f325801ca311be7b1) ) + ROM_LOAD( "r2332lp r3224-11.z70", 0xc000, 0x1000, CRC(0878b399) SHA1(483e92b57d64be51643a9f6490521a8572aa2f68) ) // Assembler + ROM_LOAD( "i-of v1.0 r32t3-12.z73", 0xf000, 0x1000, CRC(a62bec4a) SHA1(a2fc69a33dc3b7684bf3399beff7b22eaf05c843) ) +ROM_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, aim65_40, 0, 0, aim65_40, aim65_40, driver_device, 0, "Rockwell", "AIM-65/40", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/alesis.c b/src/mame/drivers/alesis.c new file mode 100644 index 00000000000..605305b6b64 --- /dev/null +++ b/src/mame/drivers/alesis.c @@ -0,0 +1,485 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Alesis HR-16 and SR-16 drum machines + + 06/04/2010 Skeleton driver. + + http://www.vintagesynth.com/misc/hr16.php + http://www.vintagesynth.com/misc/sr16.php + http://www.vintagesynth.com/misc/mmt8.php + +****************************************************************************/ + +#include "emu.h" +#include "includes/alesis.h" +#include "sr16.lh" + + +WRITE8_MEMBER( alesis_state::kb_matrix_w ) +{ + m_kb_matrix = data; +} + +READ8_MEMBER( alesis_state::kb_r ) +{ + UINT8 data = 0xff; + + if (!(m_kb_matrix & 0x01)) + data &= m_col1->read(); + if (!(m_kb_matrix & 0x02)) + data &= m_col2->read(); + if (!(m_kb_matrix & 0x04)) + data &= m_col3->read(); + if (!(m_kb_matrix & 0x08)) + data &= m_col4->read(); + if (!(m_kb_matrix & 0x10)) + data &= m_col5->read(); + if (!(m_kb_matrix & 0x20)) + data &= m_col6->read(); + + return data; +} + +WRITE8_MEMBER( alesis_state::led_w ) +{ + output_set_value("patt_led", data & 0x01 ? 1 : 0); + output_set_value("song_led", data & 0x01 ? 0 : 1); + output_set_value("play_led", data & 0x02 ? 0 : 1); + output_set_value("record_led",data & 0x04 ? 0 : 1); + output_set_value("voice_led", data & 0x08 ? 0 : 1); + output_set_value("tune_led", data & 0x10 ? 0 : 1); + output_set_value("mix_led", data & 0x20 ? 0 : 1); + output_set_value("tempo_led", data & 0x40 ? 0 : 1); + output_set_value("midi_led", data & 0x80 ? 0 : 1); +} + +READ8_MEMBER( alesis_state::p3_r ) +{ + UINT8 data = 0xff; + + data &= ~(m_cassette->input() > 0.01 ? 0x00 : 0x08); + + return data; +} + +WRITE8_MEMBER( alesis_state::p3_w ) +{ + m_cassette->output(data & 0x04 ? -1.0 : +1.0); +} + +WRITE8_MEMBER( alesis_state::sr16_lcd_w ) +{ + m_lcdc->write(space, BIT(m_kb_matrix,7), data); +} + +WRITE8_MEMBER( alesis_state::mmt8_led_w ) +{ + output_set_value("play_led", data & 0x01 ? 0 : 1); + output_set_value("record_led" , data & 0x02 ? 0 : 1); + output_set_value("part_led", data & 0x04 ? 0 : 1); + output_set_value("edit_led", data & 0x08 ? 0 : 1); + output_set_value("song_led", data & 0x10 ? 0 : 1); + output_set_value("echo_led", data & 0x20 ? 0 : 1); + output_set_value("loop_led", data & 0x40 ? 0 : 1); + + m_leds = data; +} + +READ8_MEMBER( alesis_state::mmt8_led_r ) +{ + return m_leds; +} + +WRITE8_MEMBER( alesis_state::track_led_w ) +{ + for (int i=0; i<8; i++) + output_set_indexed_value("track_led", i + 1, BIT(data, i)); +} + +READ8_MEMBER( alesis_state::mmt8_p3_r ) +{ + // ---- -x-- Tape in + // ---- x--- Start/Stop input + UINT8 data = 0xff; + + data &= ~(m_cassette->input() > 0.01 ? 0x00 : 0x04); + + return data; +} + +WRITE8_MEMBER( alesis_state::mmt8_p3_w ) +{ + // ---x ---- Tape out + // --x- ---- Click out + + m_cassette->output(data & 0x10 ? -1.0 : +1.0); +} + +static ADDRESS_MAP_START(hr16_mem, AS_PROGRAM, 8, alesis_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_MIRROR(0x8000) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(hr16_io, AS_IO, 8, alesis_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0000) AM_READ(kb_r) + AM_RANGE(0x0002, 0x0002) AM_DEVWRITE("dm3ag", alesis_dm3ag_device, write) + AM_RANGE(0x0004, 0x0004) AM_WRITE(led_w) + AM_RANGE(0x0006, 0x0007) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) + AM_RANGE(0x0008, 0x0008) AM_WRITE(kb_matrix_w) + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READ_PORT("SELECT") AM_WRITENOP + AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITENOP + AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_r, p3_w) + AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("nvram") // 32Kx8 SRAM, (battery-backed) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sr16_mem, AS_PROGRAM, 8, alesis_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sr16_io, AS_IO, 8, alesis_state) + //ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0000) AM_MIRROR(0xff) AM_DEVWRITE("dm3ag", alesis_dm3ag_device, write) + AM_RANGE(0x0200, 0x0200) AM_MIRROR(0xff) AM_WRITE(sr16_lcd_w) + AM_RANGE(0x0300, 0x0300) AM_MIRROR(0xff) AM_WRITE(kb_matrix_w) + AM_RANGE(0x0400, 0x0400) AM_MIRROR(0xff) AM_READ(kb_r) + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READNOP + AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITENOP + AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_r, p3_w) + AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("nvram") // 32Kx8 SRAM, (battery-backed) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mmt8_io, AS_IO, 8, alesis_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xff02, 0xff02) AM_WRITE(track_led_w) + AM_RANGE(0xff04, 0xff04) AM_READWRITE(mmt8_led_r, mmt8_led_w) + AM_RANGE(0xff06, 0xff06) AM_WRITE(kb_matrix_w) + AM_RANGE(0xff08, 0xff09) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) + AM_RANGE(0xff0e, 0xff0e) AM_READNOP + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READ(kb_r) + AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITENOP + AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(mmt8_p3_r, mmt8_p3_w) + AM_RANGE(0x0000, 0xffff) AM_RAM AM_SHARE("nvram") // 2x32Kx8 SRAM, (battery-backed) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( hr16 ) + PORT_START("COL1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFFSET") PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SWING") PORT_CODE(KEYCODE_W) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("QUANT") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LENGTH") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PATT") PORT_CODE(KEYCODE_P) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI/UTIL") PORT_CODE(KEYCODE_U) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO") PORT_CODE(KEYCODE_T) + PORT_START("COL2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INSERT") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SONG") PORT_CODE(KEYCODE_S) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_START("COL3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FILL") PORT_CODE(KEYCODE_F) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_START("COL4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PLAY") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP/CONTINUE") PORT_CODE(KEYCODE_END) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RECORD") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("< -") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("> +") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("VOICE") PORT_CODE(KEYCODE_V) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TUNE") PORT_CODE(KEYCODE_H) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIX") PORT_CODE(KEYCODE_M) + PORT_START("COL5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIDE") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CRASH") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 1") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 2") PORT_CODE(KEYCODE_F8) + PORT_START("COL6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KICK") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SNARE") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLOSED HAT") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MID HAT") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OPEN HAT") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLAPS") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 3") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 4") PORT_CODE(KEYCODE_8_PAD) + + PORT_START("SELECT") + PORT_BIT(0xff, 0x00, IPT_DIAL) PORT_NAME("SELECT Slider") PORT_SENSITIVITY(50) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_DOWN) PORT_CODE_INC(KEYCODE_UP) +INPUT_PORTS_END + +static INPUT_PORTS_START( mmt8 ) + PORT_START("COL1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<<") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(">>") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRANS") PORT_CODE(KEYCODE_R) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PLAY") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP/CONTINUE") PORT_CODE(KEYCODE_END) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_C) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RECORD") PORT_CODE(KEYCODE_HOME) + PORT_START("COL2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 8") PORT_CODE(KEYCODE_F8) + PORT_START("COL3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO") PORT_CODE(KEYCODE_T) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x38, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAGE DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAGE UP") PORT_CODE(KEYCODE_UP) + PORT_START("COL4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLICK") PORT_CODE(KEYCODE_G) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI CHAN") PORT_CODE(KEYCODE_I) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE") PORT_CODE(KEYCODE_Y) + PORT_START("COL5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLOCK") PORT_CODE(KEYCODE_K) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SONG") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MERGE") PORT_CODE(KEYCODE_M) + PORT_START("COL6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI FILTER") PORT_CODE(KEYCODE_F) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI ECHO") PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOOP") PORT_CODE(KEYCODE_J) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("QUANT") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LENGTH") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PART") PORT_CODE(KEYCODE_P) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EDIT") PORT_CODE(KEYCODE_E) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NAME") PORT_CODE(KEYCODE_N) +INPUT_PORTS_END + +static INPUT_PORTS_START( sr16 ) + PORT_START("COL1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRESET/USER") PORT_CODE(KEYCODE_U) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PATTERN/SONG") PORT_CODE(KEYCODE_P) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + PORT_START("COL2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RECORD SETUP") PORT_CODE(KEYCODE_R) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DRUM SET") PORT_CODE(KEYCODE_D) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_START("COL3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKUP") PORT_CODE(KEYCODE_K) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PLAY") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FILL") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_C) + PORT_START("COL4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI SETUP") PORT_CODE(KEYCODE_M) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO/PAGE UP") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIDE") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CRASH") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 1") PORT_CODE(KEYCODE_6_PAD) + PORT_START("COL5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERFORM/COMPOSE") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO/PAGE DOWN") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KICK") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SNARE") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLOSED HAT") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OPEN HAT") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLAPS") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 2") PORT_CODE(KEYCODE_F6) + PORT_START("COL6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +PALETTE_INIT_MEMBER(alesis_state, alesis) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +void alesis_state::machine_reset() +{ + m_kb_matrix = 0xff; + m_leds = 0; + memset(m_lcd_digits, 0, sizeof(m_lcd_digits)); +} + + +static HD44780_PIXEL_UPDATE(sr16_pixel_update) +{ + alesis_state *driv_state = device.machine().driver_data(); + + if (line == 1 && pos >= 6 && pos < 8) // last 2 characters of the second line are used to control the LCD symbols + driv_state->update_lcd_symbols(bitmap, pos, y, x, state); + else if (pos < 8) + bitmap.pix16(line*9 + y, pos*6 + x) = state; +} + +static MACHINE_CONFIG_START( hr16, alesis_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8031, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(hr16_mem) + MCFG_CPU_IO_MAP(hr16_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(6*16, 9*2) + MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_PALETTE_INIT_OWNER(alesis_state, alesis) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) + MCFG_CASSETTE_INTERFACE("hr16_cass") + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 16) + + /* sound hardware */ + MCFG_ALESIS_DM3AG_ADD("dm3ag", XTAL_12MHz/2) + + MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sr16, hr16 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sr16_mem) + MCFG_CPU_IO_MAP(sr16_io) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(6*8, 9*2) + MCFG_SCREEN_VISIBLE_AREA(0, 6*8-1, 0, 9*2-1) + MCFG_DEFAULT_LAYOUT(layout_sr16) + + MCFG_DEVICE_MODIFY("hd44780") + MCFG_HD44780_LCD_SIZE(2, 8) + MCFG_HD44780_PIXEL_UPDATE_CB(sr16_pixel_update) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mmt8, hr16 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(mmt8_io) + + MCFG_DEVICE_REMOVE("dm3ag") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( hr16 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS("v109") + ROM_SYSTEM_BIOS(0, "v106", "ver 1.06") + ROMX_LOAD( "hr16-v1.06.bin", 0x0000, 0x8000, CRC(f0cdb899) SHA1(f21cd87af15ad5a0bfec992e38131c4f4e4c5102), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v107", "ver 1.07") + ROMX_LOAD( "2-19-0256-v107.u11", 0x0000, 0x8000, CRC(2582b6a2) SHA1(f1f135335578c938be63b37ed207e82b7a0e13be), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v109", "ver 1.09") + ROMX_LOAD( "2-19-0256-v109.u11", 0x0000, 0x8000, CRC(a9bdbf20) SHA1(229b4230c7b5380efbfd42fa95645723d3fd6d55), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v200", "ver 2.00") + ROMX_LOAD( "hr16-v2.0.bin", 0x0000, 0x8000, CRC(a3fcba12) SHA1(4c94be7e94e5a1d86443571cd4d375158a6e7b65), ROM_BIOS(4)) + + ROM_REGION( 0x100000, "dm3ag", 0 ) + ROM_LOAD( "2-27-0004.u16", 0x00000, 0x80000, CRC(8e103536) SHA1(092e1cf649fbef171cfaf91e20707d89998b7a1e)) + ROM_LOAD( "2-27-0003.u15", 0x80000, 0x80000, CRC(82e9b78c) SHA1(89728cb38ae172b5e347a03018617c94a087dce0)) +ROM_END + +ROM_START( hr16b ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v200", "ver 2.00") + ROMX_LOAD( "2-19-0256-v200.u11",0x0000, 0x8000, CRC(19cf0fce) SHA1(f8b3786b32d68e3627a654b8b3916befbe9bc540), ROM_BIOS(1)) + + ROM_REGION( 0x100000, "dm3ag", 0 ) + ROM_LOAD( "2-27-0008.u16", 0x00000, 0x80000, CRC(11ca930e) SHA1(2f57fdd02f9b2146a551370a74cab1fa800145ab)) + ROM_LOAD( "2-27-0007.u15", 0x80000, 0x80000, CRC(319746db) SHA1(46b32a3ab2fbad67fb4566f607f578a2e9defd63)) +ROM_END + +ROM_START( mmt8 ) + ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v111", "ver 1.11") + ROMX_LOAD( "mt8v1-11.bin", 0x00000, 0x08000, CRC(c9951946) SHA1(149bc5ea46466537de4074820c66a2296ea43bc1), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v109", "ver 1.09") + ROMX_LOAD( "mt8v1-09.bin", 0x00000, 0x08000, CRC(0ec41dec) SHA1(2c283965e510b586a08f0290df4dd357e6b19b62), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v108", "ver 1.08") + ROMX_LOAD( "mt8v1-08.bin", 0x00000, 0x08000, CRC(a0615455) SHA1(77395c837b356b34d6b96f6f46eca8c89b57434e), ROM_BIOS(3)) +ROM_END + +ROM_START( sr16 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v104", "ver 1.04") + ROMX_LOAD( "sr16_v1_04.bin", 0x0000, 0x10000, CRC(d049af6e) SHA1(0bbeb4bd25e33a9eca64d5a31480f96a0040617e), ROM_BIOS(1)) + + ROM_REGION( 0x100000, "dm3ag", ROMREGION_ERASEFF ) + ROM_LOAD( "sr16.u6", 0x00000, 0x80000, CRC(6da96987) SHA1(3ec8627d440bc73841e1408a19def09a8b0b77f7)) + ROM_LOAD( "sr16.u5", 0x80000, 0x80000, CRC(8bb25cfa) SHA1(273ad59d017b54a7e8d5e1ec61c8cd807a0e4af3)) +ROM_END + + +DRIVER_INIT_MEMBER(alesis_state,hr16) +{ + int i; + UINT8 *ROM = memregion("maincpu")->base(); + UINT8 *orig = memregion("user1")->base(); + for (i = 0; i < 0x8000; i++) + { + ROM[BITSWAP16(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i]; + } +} + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +SYST( 1987, hr16, 0, 0, hr16, hr16, alesis_state, hr16, "Alesis", "HR-16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +SYST( 1987, mmt8, 0, 0, mmt8, mmt8, driver_device, 0, "Alesis", "MMT-8", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +SYST( 1989, hr16b, hr16, 0, hr16, hr16, alesis_state, hr16, "Alesis", "HR-16B", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +SYST( 1990, sr16, 0, 0, sr16, sr16, driver_device, 0, "Alesis", "SR-16 (Alesis)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/alphasma.c b/src/mame/drivers/alphasma.c new file mode 100644 index 00000000000..d20012238d4 --- /dev/null +++ b/src/mame/drivers/alphasma.c @@ -0,0 +1,479 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + AlphaSmart Pro + + driver by Sandro Ronco + + TODO: + - ADB and PS/2 + - charset ROM is wrong + +****************************************************************************/ + +#include "emu.h" +#include "cpu/mc68hc11/mc68hc11.h" +#include "machine/nvram.h" +#include "machine/ram.h" +#include "video/hd44780.h" +#include "rendlay.h" + +class alphasmart_state : public driver_device +{ +public: + alphasmart_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_lcdc0(*this, "ks0066_0"), + m_lcdc1(*this, "ks0066_1"), + m_nvram(*this, "nvram"), + m_ram(*this, RAM_TAG), + m_rambank(*this, "rambank"), + m_keyboard(*this, "COL"), + m_battery_status(*this, "BATTERY") + { } + + required_device m_maincpu; + required_device m_lcdc0; + required_device m_lcdc1; + required_device m_nvram; + required_device m_ram; + required_memory_bank m_rambank; + required_ioport_array<16> m_keyboard; + required_ioport m_battery_status; + + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(alphasmart); + virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_INPUT_CHANGED_MEMBER(kb_irq); + DECLARE_READ8_MEMBER(kb_r); + DECLARE_WRITE8_MEMBER(kb_matrixl_w); + DECLARE_WRITE8_MEMBER(kb_matrixh_w); + DECLARE_READ8_MEMBER(port_a_r); + virtual DECLARE_WRITE8_MEMBER(port_a_w); + DECLARE_READ8_MEMBER(port_d_r); + DECLARE_WRITE8_MEMBER(port_d_w); + void update_lcdc(address_space &space, bool lcdc0, bool lcdc1); + +protected: + UINT8 m_matrix[2]; + UINT8 m_port_a; + UINT8 m_port_d; + bitmap_ind16 * m_tmp_bitmap; +}; + +class asma2k_state : public alphasmart_state +{ +public: + asma2k_state(const machine_config &mconfig, device_type type, const char *tag) + : alphasmart_state(mconfig, type, tag), + m_intram(*this, "internal_ram") + { } + + required_shared_ptr m_intram; + + DECLARE_READ8_MEMBER(io_r); + DECLARE_WRITE8_MEMBER(io_w); + DECLARE_WRITE8_MEMBER(port_a_w); + +private: + UINT8 m_lcd_ctrl; +}; + +INPUT_CHANGED_MEMBER(alphasmart_state::kb_irq) +{ + m_maincpu->set_input_line(MC68HC11_IRQ_LINE, HOLD_LINE); +} + +READ8_MEMBER(alphasmart_state::kb_r) +{ + UINT16 matrix = (m_matrix[1]<<8) | m_matrix[0]; + UINT8 data = 0xff; + + for(int i=0; i<16; i++) + if (!(matrix & (1<read(); + + return data; +} + +WRITE8_MEMBER(alphasmart_state::kb_matrixl_w) +{ + m_matrix[0] = data; +} + +WRITE8_MEMBER(alphasmart_state::kb_matrixh_w) +{ + m_matrix[1] = data; +} + +READ8_MEMBER(alphasmart_state::port_a_r) +{ + return (m_port_a & 0xfd) | (m_battery_status->read() << 1); +} + +void alphasmart_state::update_lcdc(address_space &space, bool lcdc0, bool lcdc1) +{ + if (m_matrix[1] & 0x04) + { + UINT8 lcdc_data = 0; + + if (lcdc0) + lcdc_data |= m_lcdc0->read(space, BIT(m_matrix[1], 1)); + + if (lcdc1) + lcdc_data |= m_lcdc1->read(space, BIT(m_matrix[1], 1)); + + m_port_d = (m_port_d & 0xc3) | (lcdc_data>>2); + } + else + { + UINT8 lcdc_data = (m_port_d<<2) & 0xf0; + + if (lcdc0) + m_lcdc0->write(space, BIT(m_matrix[1], 1), lcdc_data); + + if (lcdc1) + m_lcdc1->write(space, BIT(m_matrix[1], 1), lcdc_data); + } +} + +WRITE8_MEMBER(alphasmart_state::port_a_w) +{ + UINT8 changed = (m_port_a ^ data) & data; + update_lcdc(space, changed & 0x80, changed & 0x20); + m_rambank->set_entry(((data>>3) & 0x01) | ((data>>4) & 0x02)); + m_port_a = data; +} + +READ8_MEMBER(alphasmart_state::port_d_r) +{ + return m_port_d; +} + +WRITE8_MEMBER(alphasmart_state::port_d_w) +{ + m_port_d = data; +} + + +static ADDRESS_MAP_START(alphasmart_mem, AS_PROGRAM, 8, alphasmart_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x003f ) AM_NOP // internal registers + AM_RANGE( 0x0040, 0x00ff ) AM_RAM // internal RAM + AM_RANGE( 0x0000, 0x7fff ) AM_RAMBANK("rambank") + AM_RANGE( 0x8000, 0x8000 ) AM_READWRITE(kb_r, kb_matrixh_w) + AM_RANGE( 0xc000, 0xc000 ) AM_WRITE(kb_matrixl_w) + AM_RANGE( 0x8000, 0xffff ) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(alphasmart_io, AS_IO, 8, alphasmart_state) + AM_RANGE( MC68HC11_IO_PORTA, MC68HC11_IO_PORTA ) AM_READWRITE(port_a_r, port_a_w) + AM_RANGE( MC68HC11_IO_PORTD, MC68HC11_IO_PORTD ) AM_READWRITE(port_d_r, port_d_w) +ADDRESS_MAP_END + +READ8_MEMBER(asma2k_state::io_r) +{ + if (offset == 0x2000) + return kb_r(space, offset); + + //else printf("unknown r: %x\n", offset); + + return 0; +} + +WRITE8_MEMBER(asma2k_state::io_w) +{ + if (offset == 0x2000) + kb_matrixh_w(space, offset, data); + else if (offset == 0x4000) + { + UINT8 changed = (m_lcd_ctrl ^ data) & data; + update_lcdc(space, changed & 0x01, changed & 0x02); + m_lcd_ctrl = data; + } + + //else printf("unknown w: %x %x\n", offset, data); +} + +WRITE8_MEMBER(asma2k_state::port_a_w) +{ + if ((m_port_a ^ data) & 0x40) + { + address_space &space = m_maincpu->space(AS_PROGRAM); + + if (data & 0x40) + space.install_readwrite_bank(0x0000, 0x7fff, "rambank"); + else + space.install_readwrite_handler(0x0000, 0x7fff, read8_delegate(FUNC(asma2k_state::io_r), this), write8_delegate(FUNC(asma2k_state::io_w), this)); + + // internal registers / RAM + space.nop_readwrite(0x00, 0x3f); + space.install_ram(0x40, 0xff, m_intram.target()); + } + + m_rambank->set_entry(((data>>4) & 0x03)); + m_port_a = data; +} + + +static ADDRESS_MAP_START(asma2k_mem, AS_PROGRAM, 8, asma2k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x003f ) AM_NOP // internal registers + AM_RANGE( 0x0040, 0x00ff ) AM_RAM AM_SHARE("internal_ram") // internal RAM + AM_RANGE( 0x0000, 0x7fff ) AM_RAMBANK("rambank") + AM_RANGE( 0x9000, 0x9000 ) AM_WRITE(kb_matrixl_w) + AM_RANGE( 0x8000, 0xffff ) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( alphasmart ) + PORT_START("COL.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("COL.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("COL.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Left Command") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Right Command") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL)// + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear File") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("COL.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_NAME("Send") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("COL.9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_NAME("Left Alt/Option") PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_NAME("Right Alt/Option") PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.10") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.11") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("Pause") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Backspace") PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("ScrLk") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Return") PORT_CHAR(13) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.12") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.13") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.14") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_START("COL.15") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) + + PORT_START("BATTERY") + PORT_CONFNAME(0x01, 0x01, "Battery status") + PORT_CONFSETTING (0x00, DEF_STR(Low)) + PORT_CONFSETTING (0x01, DEF_STR(Normal)) +INPUT_PORTS_END + +PALETTE_INIT_MEMBER(alphasmart_state, alphasmart) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +UINT32 alphasmart_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_lcdc0->screen_update(screen, *m_tmp_bitmap, cliprect); + copybitmap(bitmap, *m_tmp_bitmap, 0, 0, 0, 0, cliprect); + m_lcdc1->screen_update(screen, *m_tmp_bitmap, cliprect); + copybitmap(bitmap, *m_tmp_bitmap, 0, 0, 0, 18,cliprect); + return 0; +} + +void alphasmart_state::machine_start() +{ + UINT8* ram = m_ram->pointer(); + + m_rambank->configure_entries(0, 4, ram, 0x8000); + m_nvram->set_base(ram, 0x8000*4); + + m_tmp_bitmap = auto_bitmap_ind16_alloc(machine(), 6*40, 9*4); +} + +void alphasmart_state::machine_reset() +{ + m_rambank->set_entry(0); + m_matrix[0] = m_matrix[1] = 0; + m_port_a = 0; + m_port_d = 0; +} + +static MACHINE_CONFIG_START( alphasmart, alphasmart_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", MC68HC11, XTAL_8MHz/2) // MC68HC11D0, XTAL is 8 Mhz, unknown divider + MCFG_CPU_PROGRAM_MAP(alphasmart_mem) + MCFG_CPU_IO_MAP(alphasmart_io) + MCFG_MC68HC11_CONFIG(0, 192, 0x00) + + MCFG_KS0066_F05_ADD("ks0066_0") + MCFG_HD44780_LCD_SIZE(2, 40) + MCFG_KS0066_F05_ADD("ks0066_1") + MCFG_HD44780_LCD_SIZE(2, 40) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(alphasmart_state, screen_update) + MCFG_SCREEN_SIZE(6*40, 9*4) + MCFG_SCREEN_VISIBLE_AREA(0, (6*40)-1, 0, (9*4)-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(alphasmart_state, alphasmart) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( asma2k, alphasmart, asma2k_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(asma2k_mem) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( asmapro ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "alphasmartpro212.rom", 0x0000, 0x8000, CRC(896ddf1c) SHA1(c3c6a421c9ced92db97431d04b4a3f09a39de716) ) // Checksum 8D24 on label +ROM_END + +ROM_START( asma2k ) + ROM_REGION( 0x10000, "maincpu", 0 ) + /* + These dumps 33,253 bytes each, probably contain 32768 bytes of rom, + plus the remaining area is pal data for the mapper/io pal, all of + which is integrated onto one plcc44 chip called a zpsd211r. + */ + ROM_SYSTEM_BIOS( 0, "v314", "v3.14" ) + ROMX_LOAD( "alphasmart__2000__v3.1.4__h4.zpsd211r.plcc44.bin", 0x0000, 0x81e5, CRC(49487f6d) SHA1(e0b777dc68c671c31ba808e214fb9d2573b9a853), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v308", "v3.08" ) + ROMX_LOAD( "alphasmart__2000__v3.0.8.zpsd211r.plcc44.bin", 0x0000, 0x81e5, CRC(0b3b1a0c) SHA1(97878819188a1ec40052fbce9d5a5059728d5aec), ROM_BIOS(2) ) + + ROM_REGION( 0x8000, "spellcheck", 0 ) + ROM_LOAD( "spellcheck.bin", 0x0000, 0x8000, NO_DUMP ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1995, asmapro, 0, 0, alphasmart, alphasmart, driver_device, 0, "Intelligent Peripheral Devices", "AlphaSmart Pro" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1997, asma2k , 0, 0, asma2k , alphasmart, driver_device, 0, "Intelligent Peripheral Devices", "AlphaSmart 2000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/alphatro.c b/src/mame/drivers/alphatro.c new file mode 100644 index 00000000000..f13841c8dc8 --- /dev/null +++ b/src/mame/drivers/alphatro.c @@ -0,0 +1,517 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald, Robbbert +/*************************************************************************** + + Triumph-Adler (or Royal) Alphatronic PC + + skeleton driver + + z80 + HD46505SP as a CRTC + + Other chips: 8251, 8257, 8259 + Crystals: 16MHz, 17.73447MHz + Floppy format: 13cm, 2 sides, 40 tracks, 16 sectors, 256 bytes = 320kb. + FDC (uPD765) is in a plug-in module, with an undumped rom. + + Has a socket for monochrome (to the standard amber monitor), + and another for RGB. We emulate this with a configuration switch. + + This machine has 64k RAM, the ROMs being copied into RAM when + needed. + + There are several mystery ports which might be connected to the floppy + disk system. These are Port 30 (in and out), Port 20 (out) and certain + bits of Port 10 (in). This unit communicates via a simple parallel + interface. + + Port 10 bit 6 when high switches A000-DFFF over to roms that are in + a cart which is plugged into the RomPack socket. If C3 is found at + A000 or C000, then a jump is made to that address. It is however + possible that one of these addresses might be for the rom in the + floppy controller unit. + + + ToDo: + - Add fdc, then connect up software list + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "machine/i8251.h" +#include "machine/clock.h" +#include "imagedev/cassette.h" +#include "sound/beep.h" +#include "sound/wave.h" +#include "machine/ram.h" + +#define MAIN_CLOCK XTAL_4MHz + + +class alphatro_state : public driver_device +{ +public: + enum + { + TIMER_SYSTEM + }; + + alphatro_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_p_videoram(*this, "videoram") + , m_maincpu(*this, "maincpu") + , m_crtc(*this, "crtc") + , m_usart(*this, "usart") + , m_cass(*this, "cassette") + , m_beep(*this, "beeper") + , m_p_ram(*this, "main_ram"), + m_palette(*this, "palette") + { } + + DECLARE_READ8_MEMBER(port10_r); + DECLARE_WRITE8_MEMBER(port10_w); + DECLARE_INPUT_CHANGED_MEMBER(alphatro_break); + DECLARE_WRITE_LINE_MEMBER(txdata_callback); + DECLARE_WRITE_LINE_MEMBER(write_usart_clock); + DECLARE_PALETTE_INIT(alphatro); + TIMER_DEVICE_CALLBACK_MEMBER(timer_c); + TIMER_DEVICE_CALLBACK_MEMBER(timer_p); + MC6845_UPDATE_ROW(crtc_update_row); + required_shared_ptr m_p_videoram; + UINT8 *m_p_chargen; + UINT8 m_flashcnt; + +private: + UINT8 m_timer_bit; + UINT8 m_cass_data[4]; + bool m_cass_state; + bool m_cassold; + emu_timer* m_sys_timer; + virtual void video_start(); + virtual void machine_start(); + virtual void machine_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + required_device m_maincpu; + required_device m_crtc; + required_device m_usart; + required_device m_cass; + required_device m_beep; + required_shared_ptr m_p_ram; +public: + required_device m_palette; +}; + +READ8_MEMBER( alphatro_state::port10_r ) +{ + //return (space.machine().device("screen")->vblank() ? 0x00 : 0x80); + return m_timer_bit; +} + +WRITE8_MEMBER( alphatro_state::port10_w ) +{ +// Bit 0 -> 0 = 40 cols; 1 = 80 cols +// Bit 1 ? each keystroke, and a lot when it scrolls +// Bit 2 ? after a cload +// Bit 3 -> cassette relay +// Bit 4 -> BEEP +// Bit 6 -> 1 = select ROM pack + + data &= 0xfe; + + m_beep->set_state(BIT(data, 4)); + + m_cass->change_state( BIT(data, 3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + if (BIT(data,2)) + m_cass_state = 1; +} + +void alphatro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_SYSTEM: + m_timer_bit ^= 0x80; + break; + default: + assert_always(FALSE, "Unknown id in alphatro_state::device_timer"); + } +} + +WRITE_LINE_MEMBER( alphatro_state::txdata_callback ) +{ + m_cass_state = state; +} + +WRITE_LINE_MEMBER( alphatro_state::write_usart_clock ) +{ + m_usart->write_txc(state); + m_usart->write_rxc(state); +} + +void alphatro_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +MC6845_UPDATE_ROW( alphatro_state::crtc_update_row ) +{ + const rgb_t *pens = m_palette->palette()->entry_list_raw(); + bool palette = BIT(ioport("CONFIG")->read(), 5); + if (y==0) m_flashcnt++; + bool inv; + UINT8 chr,gfx,attr,bg,fg; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + inv = (x == cursor_x); + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + attr = m_p_videoram[mem | 0x800]; + bg = (palette) ? 8 : attr & 7; // amber or RGB + fg = (palette) ? 0 : (attr & 0x38) >> 3; + + if BIT(attr, 7) // reverse video + { + inv ^= 1; + chr &= 0x7f; + } + + if (BIT(attr, 6) & BIT(m_flashcnt, 4)) // flashing + { + inv ^= 1; + } + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | ra]; + + if (inv) + { + UINT8 t = bg; + bg = fg; + fg = t; + } + + /* Display a scanline of a character (8 pixels) */ + *p++ = pens[BIT(gfx, 7) ? fg : bg]; + *p++ = pens[BIT(gfx, 6) ? fg : bg]; + *p++ = pens[BIT(gfx, 5) ? fg : bg]; + *p++ = pens[BIT(gfx, 4) ? fg : bg]; + *p++ = pens[BIT(gfx, 3) ? fg : bg]; + *p++ = pens[BIT(gfx, 2) ? fg : bg]; + *p++ = pens[BIT(gfx, 1) ? fg : bg]; + *p++ = pens[BIT(gfx, 0) ? fg : bg]; + } +} + +INPUT_CHANGED_MEMBER( alphatro_state::alphatro_break ) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); +} + +static ADDRESS_MAP_START( alphatro_map, AS_PROGRAM, 8, alphatro_state ) + AM_RANGE(0x0000, 0xefff) AM_RAM AM_SHARE("main_ram") + AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( alphatro_io, AS_IO, 8, alphatro_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x10, 0x10) AM_READWRITE(port10_r,port10_w) + AM_RANGE(0x20, 0x20) AM_READ_PORT("X0") + AM_RANGE(0x21, 0x21) AM_READ_PORT("X1") + AM_RANGE(0x22, 0x22) AM_READ_PORT("X2") + AM_RANGE(0x23, 0x23) AM_READ_PORT("X3") + AM_RANGE(0x24, 0x24) AM_READ_PORT("X4") + AM_RANGE(0x25, 0x25) AM_READ_PORT("X5") + AM_RANGE(0x26, 0x26) AM_READ_PORT("X6") + AM_RANGE(0x27, 0x27) AM_READ_PORT("X7") + AM_RANGE(0x28, 0x28) AM_READ_PORT("X8") + AM_RANGE(0x29, 0x29) AM_READ_PORT("X9") + AM_RANGE(0x2a, 0x2a) AM_READ_PORT("XA") + AM_RANGE(0x2b, 0x2b) AM_READ_PORT("XB") + //AM_RANGE(0x30, 0x30) unknown + // USART for cassette reading and writing + AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("usart", i8251_device, data_r, data_w) + AM_RANGE(0x41, 0x41) AM_DEVREADWRITE("usart", i8251_device, status_r, control_w) + // CRTC - HD46505 / HD6845SP + AM_RANGE(0x50, 0x50) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0x51, 0x51) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( alphatro ) + PORT_START("X0") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_START("X1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad - /") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ASTERISK) // keypad equals + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad + x") PORT_CODE(KEYCODE_PLUS_PAD) + + PORT_START("X2") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("X3") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("X4") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + + PORT_START("X5") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("X6") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xa3) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("X7") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_DEL) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + + PORT_START("X8") + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + + PORT_START("X9") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("XA") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Clear Home") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + + PORT_START("XB") + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + + PORT_START("other") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF,alphatro_state,alphatro_break,0) + + PORT_START("CONFIG") + PORT_CONFNAME( 0x20, 0x00, "Monitor") + PORT_CONFSETTING( 0x00, "RGB") + PORT_CONFSETTING( 0x20, "Amber") +INPUT_PORTS_END + +static const gfx_layout charlayout = +{ + 8,16, + RGN_FRAC(1,1), + 1, + { RGN_FRAC(0,1) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 +}; + +static GFXDECODE_START( alphatro ) + GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 4 ) +GFXDECODE_END + +void alphatro_state::machine_start() +{ + m_sys_timer = timer_alloc(TIMER_SYSTEM); +} + +void alphatro_state::machine_reset() +{ + // do what the IPL does + UINT8* ROM = memregion("roms")->base(); + m_maincpu->set_pc(0xe000); + // If BASIC is missing then it boots into the Monitor + memcpy(m_p_ram, ROM, 0x6000); // Copy BASIC to RAM + // Top half of this rom has keyboard tables and appears to be unused + memcpy(m_p_ram+0xe000, ROM+0xe000, 0x1000); // copy BIOS + Monitor to RAM + + // probably not correct, exact meaning of port is unknown, vblank/vsync is too slow. + m_sys_timer->adjust(attotime::from_usec(10),0,attotime::from_usec(10)); + m_timer_bit = 0; + m_cass_data[0] = m_cass_data[1] = m_cass_data[2] = m_cass_data[3] = 0; + m_cass_state = 0; + m_cassold = 0; + m_usart->write_rxd(0); + m_beep->set_state(0); + m_beep->set_frequency(950); /* piezo-device needs to be measured */ +} + +PALETTE_INIT_MEMBER(alphatro_state, alphatro) +{ + // RGB colours + palette.set_pen_color(0, 0x00, 0x00, 0x00); + palette.set_pen_color(1, 0x00, 0x00, 0xff); + palette.set_pen_color(2, 0xff, 0x00, 0x00); + palette.set_pen_color(3, 0xff, 0x00, 0xff); + palette.set_pen_color(4, 0x00, 0xff, 0x00); + palette.set_pen_color(5, 0x00, 0xff, 0xff); + palette.set_pen_color(6, 0xff, 0xff, 0x00); + palette.set_pen_color(7, 0xff, 0xff, 0xff); + // Amber + palette.set_pen_color(8, 0xf7, 0xaa, 0x00); +} + + +TIMER_DEVICE_CALLBACK_MEMBER(alphatro_state::timer_c) +{ + m_cass_data[3]++; + + if (m_cass_state != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +TIMER_DEVICE_CALLBACK_MEMBER(alphatro_state::timer_p) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_usart->write_rxd((m_cass_data[1] < 12) ? 1 : 0); + m_cass_data[1] = 0; + } +} + +static MACHINE_CONFIG_START( alphatro, alphatro_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80,MAIN_CLOCK) + MCFG_CPU_PROGRAM_MAP(alphatro_map) + MCFG_CPU_IO_MAP(alphatro_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not correct + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", alphatro) + MCFG_PALETTE_ADD("palette", 9) // 8 colours + amber + MCFG_PALETTE_INIT_OWNER(alphatro_state, alphatro) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12_288MHz / 8) // clk unknown + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(alphatro_state, crtc_update_row) + + MCFG_DEVICE_ADD("usart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(alphatro_state, txdata_callback)) + + MCFG_DEVICE_ADD("usart_clock", CLOCK, 19218) // 19218 to load a real tape, 19222 to load a tape made by this driver + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(alphatro_state, write_usart_clock)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("alphatro_cass") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_c", alphatro_state, timer_c, attotime::from_hz(4800)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", alphatro_state, timer_p, attotime::from_hz(40000)) + + MCFG_RAM_ADD("ram") + MCFG_RAM_DEFAULT_SIZE("64K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "alphatro_flop") +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( alphatro ) + ROM_REGION( 0x10000, "roms", ROMREGION_ERASE00) + ROM_LOAD( "613256.ic-1058", 0x0000, 0x6000, CRC(ceea4cb3) SHA1(b332dea0a2d3bb2978b8422eb0723960388bb467) ) + ROM_LOAD( "2764.ic-1038", 0xe000, 0x2000, CRC(e337db3b) SHA1(6010bade6a21975636383179903b58a4ca415e49) ) + + ROM_REGION( 0x10000, "user1", ROMREGION_ERASE00 ) + ROM_LOAD( "ipl.bin", 0x8000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "2732.ic-1067", 0x0000, 0x1000, CRC(61f38814) SHA1(35ba31c58a10d5bd1bdb202717792ca021dbe1a8) ) +ROM_END + +COMP( 1983, alphatro, 0, 0, alphatro, alphatro, driver_device, 0, "Triumph-Adler", "Alphatronic PC", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/altair.c b/src/mame/drivers/altair.c new file mode 100644 index 00000000000..e324a807478 --- /dev/null +++ b/src/mame/drivers/altair.c @@ -0,0 +1,132 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + MITS Altair 8800b Turnkey + + 04/12/2009 Initial driver by Miodrag Milanovic + + Commands: + All commands must be in uppercase. Address and data is + specified in Octal format (not hex). + + Press space to input your command line (not return). + + D - Memory Dump + J - Jump to address + M - Modify memory + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/i8085/i8085.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "imagedev/snapquik.h" + + +class altair_state : public driver_device +{ +public: + altair_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_mc6850(*this, "mc6850"), + m_ram(*this, "ram") + { + } + + DECLARE_QUICKLOAD_LOAD_MEMBER(altair); + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + +protected: + virtual void machine_reset(); + +private: + required_device m_maincpu; + required_device m_mc6850; + required_shared_ptr m_ram; +}; + + + +static ADDRESS_MAP_START(altair_mem, AS_PROGRAM, 8, altair_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xfcff ) AM_RAM AM_SHARE("ram") + AM_RANGE( 0xfd00, 0xfdff ) AM_ROM + AM_RANGE( 0xff00, 0xffff ) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(altair_io, AS_IO, 8, altair_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // TODO: Remove AM_MIRROR() and use SIO address S0-S7 + AM_RANGE( 0x00, 0x00 ) AM_MIRROR(0x10) AM_DEVREADWRITE("mc6850", acia6850_device, status_r, control_w) + AM_RANGE( 0x01, 0x01 ) AM_MIRROR(0x10) AM_DEVREADWRITE("mc6850", acia6850_device, data_r, data_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( altair ) +INPUT_PORTS_END + + +QUICKLOAD_LOAD_MEMBER( altair_state,altair) +{ + int quick_length; + int read_; + quick_length = image.length(); + if (quick_length >= 0xfd00) + return IMAGE_INIT_FAIL; + read_ = image.fread(m_ram, quick_length); + if (read_ != quick_length) + return IMAGE_INIT_FAIL; + + return IMAGE_INIT_PASS; +} + +WRITE_LINE_MEMBER(altair_state::write_acia_clock) +{ + m_mc6850->write_txc(state); + m_mc6850->write_rxc(state); +} + +void altair_state::machine_reset() +{ + // Set startup addess done by turn-key + m_maincpu->set_state_int(I8085_PC, 0xFD00); +} + +static MACHINE_CONFIG_START( altair, altair_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(altair_mem) + MCFG_CPU_IO_MAP(altair_io) + + /* video hardware */ + MCFG_DEVICE_ADD("mc6850", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("mc6850", acia6850_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("mc6850", acia6850_device, write_dcd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("mc6850", acia6850_device, write_cts)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) // TODO: this is set using jumpers S3/S2/S1/S0 + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(altair_state, write_acia_clock)) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", altair_state, altair, "bin", 0) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( al8800bt ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "turnmon.bin", 0xfd00, 0x0100, CRC(5c629294) SHA1(125c76216954b681721fff84a3aca05094b21a28)) + ROM_LOAD( "88dskrom.bin", 0xff00, 0x0100, CRC(7c5232f3) SHA1(24f940ad70ad2829e1bc800c6790b6e993e6ebf6)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1975, al8800bt, 0, 0, altair, altair, driver_device, 0, "MITS", "Altair 8800bt", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/alto2.c b/src/mame/drivers/alto2.c new file mode 100644 index 00000000000..c2142b0c304 --- /dev/null +++ b/src/mame/drivers/alto2.c @@ -0,0 +1,303 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/*************************************************************************** + * Xerox AltoII driver for MESS + * + ***************************************************************************/ + +#include "emu.h" +#include "rendlay.h" +#include "cpu/alto2/alto2cpu.h" +#include "machine/diablo_hd.h" + +class alto2_state : public driver_device +{ +public: + alto2_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_io_row0(*this, "ROW0"), + m_io_row1(*this, "ROW1"), + m_io_row2(*this, "ROW2"), + m_io_row3(*this, "ROW3"), + m_io_row4(*this, "ROW4"), + m_io_row5(*this, "ROW5"), + m_io_row6(*this, "ROW6"), + m_io_row7(*this, "ROW7"), + m_io_config(*this, "CONFIG") + { } + + DECLARE_DRIVER_INIT(alto2); + DECLARE_MACHINE_RESET(alto2); + +protected: + required_device m_maincpu; + required_ioport m_io_row0; + required_ioport m_io_row1; + required_ioport m_io_row2; + required_ioport m_io_row3; + required_ioport m_io_row4; + required_ioport m_io_row5; + required_ioport m_io_row6; + required_ioport m_io_row7; + optional_ioport m_io_config; +}; + +/* Input Ports */ + +#define PORT_KEY(_bit,_code,_char1,_char2,_name) \ + PORT_BIT(_bit, IP_ACTIVE_LOW, IPT_KEYBOARD) \ + PORT_CODE(_code) PORT_NAME(_name) \ + PORT_CHAR(_char1) PORT_CHAR(_char2) +#define SPACING " " + +static INPUT_PORTS_START( alto2 ) + PORT_START("ROW0") + PORT_KEY(A2_KEY_5, KEYCODE_5, '5', '%', "5" SPACING "%") //!< normal: 5 shifted: % + PORT_KEY(A2_KEY_4, KEYCODE_4, '4', '$', "4" SPACING "$") //!< normal: 4 shifted: $ + PORT_KEY(A2_KEY_6, KEYCODE_6, '6', '~', "6" SPACING "~") //!< normal: 6 shifted: ~ + PORT_KEY(A2_KEY_E, KEYCODE_E, 'e', 'E', "e" SPACING "E") //!< normal: e shifted: E + PORT_KEY(A2_KEY_7, KEYCODE_7, '7', '&', "7" SPACING "&") //!< normal: 7 shifted: & + PORT_KEY(A2_KEY_D, KEYCODE_D, 'd', 'D', "d" SPACING "D") //!< normal: d shifted: D + PORT_KEY(A2_KEY_U, KEYCODE_U, 'u', 'U', "u" SPACING "U") //!< normal: u shifted: U + PORT_KEY(A2_KEY_V, KEYCODE_V, 'v', 'V', "v" SPACING "V") //!< normal: v shifted: V + PORT_KEY(A2_KEY_0, KEYCODE_0, '0', ')', "0" SPACING ")") //!< normal: 0 shifted: ) + PORT_KEY(A2_KEY_K, KEYCODE_K, 'k', 'K', "k" SPACING "K") //!< normal: k shifted: K + PORT_KEY(A2_KEY_MINUS, KEYCODE_MINUS, '-', '_', "-" SPACING "_") //!< normal: - shifted: _ + PORT_KEY(A2_KEY_P, KEYCODE_P, 'p', 'P', "p" SPACING "P") //!< normal: p shifted: P + PORT_KEY(A2_KEY_SLASH, KEYCODE_SLASH, '/', '?', "/" SPACING "?") //!< normal: / shifted: ? + PORT_KEY(A2_KEY_BACKSLASH, KEYCODE_BACKSLASH, '\\', '|', "\\" SPACING "|") //!< normal: \ shifted: | + PORT_KEY(A2_KEY_LF, KEYCODE_DOWN, 10, 10, "LF" ) //!< normal: LF shifted: ? + PORT_KEY(A2_KEY_BS, KEYCODE_BACKSPACE, 8, 8, "BS" ) //!< normal: BS shifted: ? + + PORT_START("ROW1") + PORT_KEY(A2_KEY_3, KEYCODE_3, '3', '#', "3" SPACING "#") //!< normal: 3 shifted: # + PORT_KEY(A2_KEY_2, KEYCODE_2, '2', '@', "2" SPACING "@") //!< normal: 2 shifted: @ + PORT_KEY(A2_KEY_W, KEYCODE_W, 'w', 'W', "w" SPACING "W") //!< normal: w shifted: W + PORT_KEY(A2_KEY_Q, KEYCODE_Q, 'q', 'Q', "q" SPACING "Q") //!< normal: q shifted: Q + PORT_KEY(A2_KEY_S, KEYCODE_S, 's', 'S', "s" SPACING "S") //!< normal: s shifted: S + PORT_KEY(A2_KEY_A, KEYCODE_A, 'a', 'A', "a" SPACING "A") //!< normal: a shifted: A + PORT_KEY(A2_KEY_9, KEYCODE_9, '9', '(', "9" SPACING "(") //!< normal: 9 shifted: ( + PORT_KEY(A2_KEY_I, KEYCODE_I, 'i', 'I', "i" SPACING "I") //!< normal: i shifted: I + PORT_KEY(A2_KEY_X, KEYCODE_X, 'x', 'X', "x" SPACING "X") //!< normal: x shifted: X + PORT_KEY(A2_KEY_O, KEYCODE_O, 'o', 'O', "o" SPACING "O") //!< normal: o shifted: O + PORT_KEY(A2_KEY_L, KEYCODE_L, 'l', 'L', "l" SPACING "L") //!< normal: l shifted: L + PORT_KEY(A2_KEY_COMMA, KEYCODE_COMMA, ',', '<', "," SPACING "<") //!< normal: , shifted: < + PORT_KEY(A2_KEY_QUOTE, KEYCODE_QUOTE, 39, 34, "'" SPACING "\"") //!< normal: ' shifted: " + PORT_KEY(A2_KEY_RBRACKET, KEYCODE_CLOSEBRACE, ']', '}', "]" SPACING "}") //!< normal: ] shifted: } + PORT_KEY(A2_KEY_BLANK_MID, KEYCODE_END, 0, 0, "MID" ) //!< middle blank key + PORT_KEY(A2_KEY_BLANK_TOP, KEYCODE_PGUP, 0, 0, "TOP" ) //!< top blank key + + PORT_START("ROW2") + PORT_KEY(A2_KEY_1, KEYCODE_1, '1', '!', "1" SPACING "!") //!< normal: 1 shifted: ! + PORT_KEY(A2_KEY_ESCAPE, KEYCODE_ESC, 27, 0, "ESC" ) //!< normal: ESC shifted: ? + PORT_KEY(A2_KEY_TAB, KEYCODE_TAB, 9, 0, "TAB" ) //!< normal: TAB shifted: ? + PORT_KEY(A2_KEY_F, KEYCODE_F, 'f', 'F', "f" SPACING "F") //!< normal: f shifted: F + PORT_KEY(A2_KEY_CTRL, KEYCODE_LCONTROL, 0, 0, "CTRL" ) //!< CTRL + PORT_KEY(A2_KEY_C, KEYCODE_C, 'c', 'C', "c" SPACING "C") //!< normal: c shifted: C + PORT_KEY(A2_KEY_J, KEYCODE_J, 'j', 'J', "j" SPACING "J") //!< normal: j shifted: J + PORT_KEY(A2_KEY_B, KEYCODE_B, 'b', 'B', "b" SPACING "B") //!< normal: b shifted: B + PORT_KEY(A2_KEY_Z, KEYCODE_Z, 'z', 'Z', "z" SPACING "Z") //!< normal: z shifted: Z + PORT_KEY(A2_KEY_LSHIFT, KEYCODE_LSHIFT, UCHAR_SHIFT_1, 0, "LSHIFT" ) //!< LSHIFT + PORT_KEY(A2_KEY_PERIOD, KEYCODE_STOP, '.', '>', "." SPACING ">") //!< normal: . shifted: > + PORT_KEY(A2_KEY_SEMICOLON, KEYCODE_COLON, ';', ':', ";" SPACING ":") //!< normal: ; shifted: : + PORT_KEY(A2_KEY_RETURN, KEYCODE_ENTER, 13, 0, "RETURN" ) //!< RETURN + PORT_KEY(A2_KEY_LEFTARROW, KEYCODE_LEFT, 0, 0, "???" SPACING "???") //!< normal: left arrow shifted: up arrow (caret) + PORT_KEY(A2_KEY_DEL, KEYCODE_DEL, UCHAR_MAMEKEY(DEL), 0, "DEL" ) //!< normal: DEL shifted: ? + PORT_KEY(A2_KEY_MSW_2_17, KEYCODE_MENU, 0, 0, "MSW2/17" ) //!< unused on Microswitch KDB + + PORT_START("ROW3") + PORT_KEY(A2_KEY_R, KEYCODE_R, 'r', 'R', "r" SPACING "R") //!< normal: r shifted: R + PORT_KEY(A2_KEY_T, KEYCODE_T, 't', 'T', "t" SPACING "T") //!< normal: t shifted: T + PORT_KEY(A2_KEY_G, KEYCODE_G, 'g', 'G', "g" SPACING "G") //!< normal: g shifted: G + PORT_KEY(A2_KEY_Y, KEYCODE_Y, 'y', 'Y', "y" SPACING "Y") //!< normal: y shifted: Y + PORT_KEY(A2_KEY_H, KEYCODE_H, 'h', 'H', "h" SPACING "H") //!< normal: h shifted: H + PORT_KEY(A2_KEY_8, KEYCODE_8, '8', '*', "8" SPACING "*") //!< normal: 8 shifted: * + PORT_KEY(A2_KEY_N, KEYCODE_N, 'n', 'N', "n" SPACING "N") //!< normal: n shifted: N + PORT_KEY(A2_KEY_M, KEYCODE_M, 'm', 'M', "m" SPACING "M") //!< normal: m shifted: M + PORT_KEY(A2_KEY_LOCK, KEYCODE_SCRLOCK, 0, 0, "LOCK" ) //!< LOCK + PORT_KEY(A2_KEY_SPACE, KEYCODE_SPACE, 32, 0, "SPACE" ) //!< SPACE + PORT_KEY(A2_KEY_LBRACKET, KEYCODE_OPENBRACE, '[', '{', "[" SPACING "{") //!< normal: [ shifted: { + PORT_KEY(A2_KEY_EQUALS, KEYCODE_EQUALS, '=', '+', "=" SPACING "+") //!< normal: = shifted: + + PORT_KEY(A2_KEY_RSHIFT, KEYCODE_RSHIFT, UCHAR_SHIFT_2, 0, "RSHIFT" ) //!< RSHIFT + PORT_KEY(A2_KEY_BLANK_BOT, KEYCODE_PGDN, 0, 0, "BOT" ) //!< bottom blank key + PORT_KEY(A2_KEY_MSW_3_16, KEYCODE_HOME, 0, 0, "MSW3/16" ) //!< unused on Microswitch KDB + PORT_KEY(A2_KEY_MSW_3_17, KEYCODE_INSERT, 0, 0, "MSW3/17" ) //!< unused on Microswitch KDB + + PORT_START("ROW4") + PORT_KEY(A2_KEY_FR2, KEYCODE_F6, 0, 0, "FR2" ) //!< ADL right function key 2 + PORT_KEY(A2_KEY_FL2, KEYCODE_F2, 0, 0, "FL2" ) //!< ADL left function key 2 + + PORT_START("ROW5") + PORT_KEY(A2_KEY_FR4, KEYCODE_F8, 0, 0, "FR4" ) //!< ADL right funtion key 4 + PORT_KEY(A2_KEY_BW, KEYCODE_F10, 0, 0, "BW" ) //!< ADL BW (?) + + PORT_START("ROW6") + PORT_KEY(A2_KEY_FR3, KEYCODE_F7, 0, 0, "FR3" ) //!< ADL right function key 3 + PORT_KEY(A2_KEY_FL1, KEYCODE_F1, 0, 0, "FL1" ) //!< ADL left function key 1 + PORT_KEY(A2_KEY_FL3, KEYCODE_F3, 0, 0, "FL3" ) //!< ADL left function key 3 + + PORT_START("ROW7") + PORT_KEY(A2_KEY_FR1, KEYCODE_F5, 0, 0, "FR1" ) //!< ADL right function key 1 + PORT_KEY(A2_KEY_FL4, KEYCODE_F4, 0, 0, "FL4" ) //!< ADL left function key 4 + PORT_KEY(A2_KEY_FR5, KEYCODE_F9, 0, 0, "FR5" ) //!< ADL right function key 5 + + PORT_START("mouseb0") // Mouse button 0 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Mouse RED (left)") PORT_PLAYER(1) PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_button_0, 0 ) + PORT_START("mouseb1") // Mouse button 1 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Mouse BLUE (right)") PORT_PLAYER(1) PORT_CODE(MOUSECODE_BUTTON2) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_button_1, 0 ) + PORT_START("mouseb2") // Mouse button 2 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Mouse YELLOW (middle)") PORT_PLAYER(1) PORT_CODE(MOUSECODE_BUTTON3) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_button_2, 0 ) + + PORT_START("mousex") // Mouse - X AXIS + PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_motion_x, 0 ) + + PORT_START("mousey") // Mouse - Y AXIS + PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_motion_y, 0 ) + + PORT_START("CONFIG") /* Memory switch on AIM board */ + PORT_CONFNAME( 0x01, 0x01, "Memory switch") + PORT_CONFSETTING( 0x00, "on") + PORT_CONFSETTING( 0x01, "off") + PORT_CONFNAME( 0x70, 0x00, "Ethernet breath-of-life") + PORT_CONFSETTING( 0x00, "off") + PORT_CONFSETTING( 0x10, "5 seconds") + PORT_CONFSETTING( 0x20, "10 seconds") + PORT_CONFSETTING( 0x30, "15 seconds") + PORT_CONFSETTING( 0x40, "30 seconds") + PORT_CONFSETTING( 0x50, "60 seconds") + PORT_CONFSETTING( 0x60, "90 seconds") + PORT_CONFSETTING( 0x70, "120 seconds") + + PORT_START("ETHERID") + PORT_DIPNAME( 0377, 0042, "Ethernet ID") + PORT_DIPSETTING( 0000, "No ether") PORT_DIPSETTING( 0001, "ID 001") PORT_DIPSETTING( 0002, "ID 002") PORT_DIPSETTING( 0003, "ID 003") + PORT_DIPSETTING( 0004, "ID 004") PORT_DIPSETTING( 0005, "ID 005") PORT_DIPSETTING( 0006, "ID 006") PORT_DIPSETTING( 0007, "ID 007") + PORT_DIPSETTING( 0010, "ID 010") PORT_DIPSETTING( 0011, "ID 011") PORT_DIPSETTING( 0012, "ID 012") PORT_DIPSETTING( 0013, "ID 013") + PORT_DIPSETTING( 0014, "ID 014") PORT_DIPSETTING( 0015, "ID 015") PORT_DIPSETTING( 0016, "ID 016") PORT_DIPSETTING( 0017, "ID 017") + PORT_DIPSETTING( 0020, "ID 020") PORT_DIPSETTING( 0021, "ID 021") PORT_DIPSETTING( 0022, "ID 022") PORT_DIPSETTING( 0023, "ID 023") + PORT_DIPSETTING( 0024, "ID 024") PORT_DIPSETTING( 0025, "ID 025") PORT_DIPSETTING( 0026, "ID 026") PORT_DIPSETTING( 0027, "ID 027") + PORT_DIPSETTING( 0030, "ID 030") PORT_DIPSETTING( 0031, "ID 031") PORT_DIPSETTING( 0032, "ID 032") PORT_DIPSETTING( 0033, "ID 033") + PORT_DIPSETTING( 0034, "ID 034") PORT_DIPSETTING( 0035, "ID 035") PORT_DIPSETTING( 0036, "ID 036") PORT_DIPSETTING( 0037, "ID 037") + PORT_DIPSETTING( 0040, "ID 040") PORT_DIPSETTING( 0041, "ID 041") PORT_DIPSETTING( 0042, "ID 042") PORT_DIPSETTING( 0043, "ID 043") + PORT_DIPSETTING( 0044, "ID 044") PORT_DIPSETTING( 0045, "ID 045") PORT_DIPSETTING( 0046, "ID 046") PORT_DIPSETTING( 0047, "ID 047") + PORT_DIPSETTING( 0050, "ID 050") PORT_DIPSETTING( 0051, "ID 051") PORT_DIPSETTING( 0052, "ID 052") PORT_DIPSETTING( 0053, "ID 053") + PORT_DIPSETTING( 0054, "ID 054") PORT_DIPSETTING( 0055, "ID 055") PORT_DIPSETTING( 0056, "ID 056") PORT_DIPSETTING( 0057, "ID 057") + PORT_DIPSETTING( 0060, "ID 060") PORT_DIPSETTING( 0061, "ID 061") PORT_DIPSETTING( 0062, "ID 062") PORT_DIPSETTING( 0063, "ID 063") + PORT_DIPSETTING( 0064, "ID 064") PORT_DIPSETTING( 0065, "ID 065") PORT_DIPSETTING( 0066, "ID 066") PORT_DIPSETTING( 0067, "ID 067") + PORT_DIPSETTING( 0070, "ID 070") PORT_DIPSETTING( 0071, "ID 071") PORT_DIPSETTING( 0072, "ID 072") PORT_DIPSETTING( 0073, "ID 073") + PORT_DIPSETTING( 0074, "ID 074") PORT_DIPSETTING( 0075, "ID 075") PORT_DIPSETTING( 0076, "ID 076") PORT_DIPSETTING( 0077, "ID 077") + PORT_DIPSETTING( 0100, "ID 100") PORT_DIPSETTING( 0101, "ID 101") PORT_DIPSETTING( 0102, "ID 102") PORT_DIPSETTING( 0103, "ID 103") + PORT_DIPSETTING( 0104, "ID 104") PORT_DIPSETTING( 0105, "ID 105") PORT_DIPSETTING( 0106, "ID 106") PORT_DIPSETTING( 0107, "ID 107") + PORT_DIPSETTING( 0110, "ID 110") PORT_DIPSETTING( 0111, "ID 111") PORT_DIPSETTING( 0112, "ID 112") PORT_DIPSETTING( 0113, "ID 113") + PORT_DIPSETTING( 0114, "ID 114") PORT_DIPSETTING( 0115, "ID 115") PORT_DIPSETTING( 0116, "ID 116") PORT_DIPSETTING( 0117, "ID 117") + PORT_DIPSETTING( 0120, "ID 120") PORT_DIPSETTING( 0121, "ID 121") PORT_DIPSETTING( 0122, "ID 122") PORT_DIPSETTING( 0123, "ID 123") + PORT_DIPSETTING( 0124, "ID 124") PORT_DIPSETTING( 0125, "ID 125") PORT_DIPSETTING( 0126, "ID 126") PORT_DIPSETTING( 0127, "ID 127") + PORT_DIPSETTING( 0130, "ID 130") PORT_DIPSETTING( 0131, "ID 131") PORT_DIPSETTING( 0132, "ID 132") PORT_DIPSETTING( 0133, "ID 133") + PORT_DIPSETTING( 0134, "ID 134") PORT_DIPSETTING( 0135, "ID 135") PORT_DIPSETTING( 0136, "ID 136") PORT_DIPSETTING( 0137, "ID 137") + PORT_DIPSETTING( 0140, "ID 140") PORT_DIPSETTING( 0141, "ID 141") PORT_DIPSETTING( 0142, "ID 142") PORT_DIPSETTING( 0143, "ID 143") + PORT_DIPSETTING( 0144, "ID 144") PORT_DIPSETTING( 0145, "ID 145") PORT_DIPSETTING( 0146, "ID 146") PORT_DIPSETTING( 0147, "ID 147") + PORT_DIPSETTING( 0150, "ID 150") PORT_DIPSETTING( 0151, "ID 151") PORT_DIPSETTING( 0152, "ID 152") PORT_DIPSETTING( 0153, "ID 153") + PORT_DIPSETTING( 0154, "ID 154") PORT_DIPSETTING( 0155, "ID 155") PORT_DIPSETTING( 0156, "ID 156") PORT_DIPSETTING( 0157, "ID 157") + PORT_DIPSETTING( 0160, "ID 160") PORT_DIPSETTING( 0161, "ID 161") PORT_DIPSETTING( 0162, "ID 162") PORT_DIPSETTING( 0163, "ID 163") + PORT_DIPSETTING( 0164, "ID 164") PORT_DIPSETTING( 0165, "ID 165") PORT_DIPSETTING( 0166, "ID 166") PORT_DIPSETTING( 0167, "ID 167") + PORT_DIPSETTING( 0170, "ID 170") PORT_DIPSETTING( 0171, "ID 171") PORT_DIPSETTING( 0172, "ID 172") PORT_DIPSETTING( 0173, "ID 173") + PORT_DIPSETTING( 0174, "ID 174") PORT_DIPSETTING( 0175, "ID 175") PORT_DIPSETTING( 0176, "ID 176") PORT_DIPSETTING( 0177, "ID 177") + PORT_DIPSETTING( 0200, "ID 200") PORT_DIPSETTING( 0201, "ID 201") PORT_DIPSETTING( 0202, "ID 202") PORT_DIPSETTING( 0203, "ID 203") + PORT_DIPSETTING( 0204, "ID 204") PORT_DIPSETTING( 0205, "ID 205") PORT_DIPSETTING( 0206, "ID 206") PORT_DIPSETTING( 0207, "ID 207") + PORT_DIPSETTING( 0210, "ID 210") PORT_DIPSETTING( 0211, "ID 211") PORT_DIPSETTING( 0212, "ID 212") PORT_DIPSETTING( 0213, "ID 213") + PORT_DIPSETTING( 0214, "ID 214") PORT_DIPSETTING( 0215, "ID 215") PORT_DIPSETTING( 0216, "ID 216") PORT_DIPSETTING( 0217, "ID 217") + PORT_DIPSETTING( 0220, "ID 220") PORT_DIPSETTING( 0221, "ID 221") PORT_DIPSETTING( 0222, "ID 222") PORT_DIPSETTING( 0223, "ID 223") + PORT_DIPSETTING( 0224, "ID 224") PORT_DIPSETTING( 0225, "ID 225") PORT_DIPSETTING( 0226, "ID 226") PORT_DIPSETTING( 0227, "ID 227") + PORT_DIPSETTING( 0230, "ID 230") PORT_DIPSETTING( 0231, "ID 231") PORT_DIPSETTING( 0232, "ID 232") PORT_DIPSETTING( 0233, "ID 233") + PORT_DIPSETTING( 0234, "ID 234") PORT_DIPSETTING( 0235, "ID 235") PORT_DIPSETTING( 0236, "ID 236") PORT_DIPSETTING( 0237, "ID 237") + PORT_DIPSETTING( 0240, "ID 240") PORT_DIPSETTING( 0241, "ID 241") PORT_DIPSETTING( 0242, "ID 242") PORT_DIPSETTING( 0243, "ID 243") + PORT_DIPSETTING( 0244, "ID 244") PORT_DIPSETTING( 0245, "ID 245") PORT_DIPSETTING( 0246, "ID 246") PORT_DIPSETTING( 0247, "ID 247") + PORT_DIPSETTING( 0250, "ID 250") PORT_DIPSETTING( 0251, "ID 251") PORT_DIPSETTING( 0252, "ID 252") PORT_DIPSETTING( 0253, "ID 253") + PORT_DIPSETTING( 0254, "ID 254") PORT_DIPSETTING( 0255, "ID 255") PORT_DIPSETTING( 0256, "ID 256") PORT_DIPSETTING( 0257, "ID 257") + PORT_DIPSETTING( 0260, "ID 260") PORT_DIPSETTING( 0261, "ID 261") PORT_DIPSETTING( 0262, "ID 262") PORT_DIPSETTING( 0263, "ID 263") + PORT_DIPSETTING( 0264, "ID 264") PORT_DIPSETTING( 0265, "ID 265") PORT_DIPSETTING( 0266, "ID 266") PORT_DIPSETTING( 0267, "ID 267") + PORT_DIPSETTING( 0270, "ID 270") PORT_DIPSETTING( 0271, "ID 271") PORT_DIPSETTING( 0272, "ID 272") PORT_DIPSETTING( 0273, "ID 273") + PORT_DIPSETTING( 0274, "ID 274") PORT_DIPSETTING( 0275, "ID 275") PORT_DIPSETTING( 0276, "ID 276") PORT_DIPSETTING( 0277, "ID 277") + PORT_DIPSETTING( 0300, "ID 300") PORT_DIPSETTING( 0301, "ID 301") PORT_DIPSETTING( 0302, "ID 302") PORT_DIPSETTING( 0303, "ID 303") + PORT_DIPSETTING( 0304, "ID 304") PORT_DIPSETTING( 0305, "ID 305") PORT_DIPSETTING( 0306, "ID 306") PORT_DIPSETTING( 0307, "ID 307") + PORT_DIPSETTING( 0310, "ID 310") PORT_DIPSETTING( 0311, "ID 311") PORT_DIPSETTING( 0312, "ID 312") PORT_DIPSETTING( 0313, "ID 313") + PORT_DIPSETTING( 0314, "ID 314") PORT_DIPSETTING( 0315, "ID 315") PORT_DIPSETTING( 0316, "ID 316") PORT_DIPSETTING( 0317, "ID 317") + PORT_DIPSETTING( 0320, "ID 320") PORT_DIPSETTING( 0321, "ID 321") PORT_DIPSETTING( 0322, "ID 322") PORT_DIPSETTING( 0323, "ID 323") + PORT_DIPSETTING( 0324, "ID 324") PORT_DIPSETTING( 0325, "ID 325") PORT_DIPSETTING( 0326, "ID 326") PORT_DIPSETTING( 0327, "ID 327") + PORT_DIPSETTING( 0330, "ID 330") PORT_DIPSETTING( 0331, "ID 331") PORT_DIPSETTING( 0332, "ID 332") PORT_DIPSETTING( 0333, "ID 333") + PORT_DIPSETTING( 0334, "ID 334") PORT_DIPSETTING( 0335, "ID 335") PORT_DIPSETTING( 0336, "ID 336") PORT_DIPSETTING( 0337, "ID 337") + PORT_DIPSETTING( 0340, "ID 340") PORT_DIPSETTING( 0341, "ID 341") PORT_DIPSETTING( 0342, "ID 342") PORT_DIPSETTING( 0343, "ID 343") + PORT_DIPSETTING( 0344, "ID 344") PORT_DIPSETTING( 0345, "ID 345") PORT_DIPSETTING( 0346, "ID 346") PORT_DIPSETTING( 0347, "ID 347") + PORT_DIPSETTING( 0350, "ID 350") PORT_DIPSETTING( 0351, "ID 351") PORT_DIPSETTING( 0352, "ID 352") PORT_DIPSETTING( 0353, "ID 353") + PORT_DIPSETTING( 0354, "ID 354") PORT_DIPSETTING( 0355, "ID 355") PORT_DIPSETTING( 0356, "ID 356") PORT_DIPSETTING( 0357, "ID 357") + PORT_DIPSETTING( 0360, "ID 360") PORT_DIPSETTING( 0361, "ID 361") PORT_DIPSETTING( 0362, "ID 362") PORT_DIPSETTING( 0363, "ID 363") + PORT_DIPSETTING( 0364, "ID 364") PORT_DIPSETTING( 0365, "ID 365") PORT_DIPSETTING( 0366, "ID 366") PORT_DIPSETTING( 0367, "ID 367") + PORT_DIPSETTING( 0370, "ID 370") PORT_DIPSETTING( 0371, "ID 371") PORT_DIPSETTING( 0372, "ID 372") PORT_DIPSETTING( 0373, "ID 373") + PORT_DIPSETTING( 0374, "ID 374") PORT_DIPSETTING( 0375, "ID 375") +INPUT_PORTS_END + +/* ROM */ +ROM_START( alto2 ) + // dummy region for the maincpu - this is not used in any way + ROM_REGION( 0400, "maincpu", 0 ) + ROM_FILL(0, 0400, ALTO2_UCODE_INVERTED) +ROM_END + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +ADDRESS_MAP_START( alto2_ucode_map, AS_0, 32, alto2_state ) + AM_RANGE(0, ALTO2_UCODE_SIZE-1) AM_DEVICE32( "maincpu", alto2_cpu_device, ucode_map, 0xffffffffUL ) +ADDRESS_MAP_END + +ADDRESS_MAP_START( alto2_const_map, AS_1, 16, alto2_state ) + AM_RANGE(0, ALTO2_CONST_SIZE-1) AM_DEVICE16( "maincpu", alto2_cpu_device, const_map, 0xffffU ) +ADDRESS_MAP_END + +ADDRESS_MAP_START( alto2_iomem_map, AS_2, 16, alto2_state ) + AM_RANGE(0, 2*ALTO2_RAM_SIZE-1) AM_DEVICE16( "maincpu", alto2_cpu_device, iomem_map, 0xffffU ) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( alto2, alto2_state ) + /* basic machine hardware */ + // SYSCLK is Display Control part A51 (tagged 29.4MHz) divided by 5(?) + // 5.8MHz according to de.wikipedia.org/wiki/Xerox_Alto + MCFG_CPU_ADD("maincpu", ALTO2, XTAL_29_4912MHz/5) + MCFG_CPU_PROGRAM_MAP(alto2_ucode_map) + MCFG_CPU_DATA_MAP(alto2_const_map) + MCFG_CPU_IO_MAP(alto2_iomem_map) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_20_16MHz, + ALTO2_DISPLAY_TOTAL_WIDTH, 0, ALTO2_DISPLAY_WIDTH, + ALTO2_DISPLAY_TOTAL_HEIGHT, 0, ALTO2_DISPLAY_HEIGHT + ALTO2_FAKE_STATUS_H) + MCFG_SCREEN_REFRESH_RATE(60) // two interlaced fields + MCFG_SCREEN_VBLANK_TIME(ALTO2_DISPLAY_VBLANK_TIME) + MCFG_SCREEN_UPDATE_DEVICE("maincpu", alto2_cpu_device, screen_update) + MCFG_SCREEN_VBLANK_DEVICE("maincpu", alto2_cpu_device, screen_eof) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT( layout_vertical ) + + MCFG_PALETTE_ADD_WHITE_AND_BLACK("palette") + + MCFG_DIABLO_DRIVES_ADD() +MACHINE_CONFIG_END + +/* Driver Init */ + +DRIVER_INIT_MEMBER( alto2_state, alto2 ) +{ + // make the diablo drives known to the CPU core + alto2_cpu_device* cpu = downcast(m_maincpu.target()); + cpu->set_diablo(0, downcast(machine().device(DIABLO_HD_0))); + cpu->set_diablo(1, downcast(machine().device(DIABLO_HD_1))); +} + +/* Game Drivers */ + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1977, alto2, 0, 0, alto2, alto2, alto2_state, alto2, "Xerox", "Alto-II", MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/altos5.c b/src/mame/drivers/altos5.c new file mode 100644 index 00000000000..24136a110d7 --- /dev/null +++ b/src/mame/drivers/altos5.c @@ -0,0 +1,457 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Altos 5-15 + + Boots, terminal works, memory banking works. + + Error when reading floppy disk (bdos error) + + ToDo: + - Get floppy to read the disk (only ones found are .TD0 format) + - Further work once the floppy is fixed + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/z80dma.h" +#include "machine/wd_fdc.h" + + +class altos5_state : public driver_device +{ +public: + altos5_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pio0(*this, "z80pio_0"), + m_pio1(*this, "z80pio_1"), + m_dart(*this, "z80dart"), + m_sio (*this, "z80sio"), + m_dma (*this, "z80dma"), + m_ctc (*this, "z80ctc"), + m_fdc (*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1") + { } + + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + DECLARE_READ8_MEMBER(port08_r); + DECLARE_READ8_MEMBER(port09_r); + DECLARE_WRITE8_MEMBER(port08_w); + DECLARE_WRITE8_MEMBER(port09_w); + DECLARE_WRITE8_MEMBER(port14_w); + DECLARE_DRIVER_INIT(altos5); + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); +private: + UINT8 m_port08; + UINT8 m_port09; + UINT8 *m_p_prom; + bool m_ipl; + offs_t m_curr_bank; + floppy_image_device *m_floppy; + UINT8 convert(offs_t offset, bool state); + void setup_banks(UINT8 source); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_pio0; + required_device m_pio1; + required_device m_dart; + required_device m_sio; + required_device m_dma; + required_device m_ctc; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; +}; + +static ADDRESS_MAP_START(altos5_mem, AS_PROGRAM, 8, altos5_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE( 0x1000, 0x1fff ) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") + AM_RANGE( 0x2000, 0x2fff ) AM_READ_BANK("bankr2") AM_WRITE_BANK("bankw2") + AM_RANGE( 0x3000, 0x3fff ) AM_READ_BANK("bankr3") AM_WRITE_BANK("bankw3") + AM_RANGE( 0x4000, 0x4fff ) AM_READ_BANK("bankr4") AM_WRITE_BANK("bankw4") + AM_RANGE( 0x5000, 0x5fff ) AM_READ_BANK("bankr5") AM_WRITE_BANK("bankw5") + AM_RANGE( 0x6000, 0x6fff ) AM_READ_BANK("bankr6") AM_WRITE_BANK("bankw6") + AM_RANGE( 0x7000, 0x7fff ) AM_READ_BANK("bankr7") AM_WRITE_BANK("bankw7") + AM_RANGE( 0x8000, 0x8fff ) AM_READ_BANK("bankr8") AM_WRITE_BANK("bankw8") + AM_RANGE( 0x9000, 0x9fff ) AM_READ_BANK("bankr9") AM_WRITE_BANK("bankw9") + AM_RANGE( 0xa000, 0xafff ) AM_READ_BANK("bankra") AM_WRITE_BANK("bankwa") + AM_RANGE( 0xb000, 0xbfff ) AM_READ_BANK("bankrb") AM_WRITE_BANK("bankwb") + AM_RANGE( 0xc000, 0xcfff ) AM_READ_BANK("bankrc") AM_WRITE_BANK("bankwc") + AM_RANGE( 0xd000, 0xdfff ) AM_READ_BANK("bankrd") AM_WRITE_BANK("bankwd") + AM_RANGE( 0xe000, 0xefff ) AM_READ_BANK("bankre") AM_WRITE_BANK("bankwe") + AM_RANGE( 0xf000, 0xffff ) AM_READ_BANK("bankrf") AM_WRITE_BANK("bankwf") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(altos5_io, AS_IO, 8, altos5_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80dma", z80dma_device, read, write) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("fdc", fd1797_t, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_0", z80pio_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("z80pio_1", z80pio_device, read, write) + AM_RANGE(0x14, 0x17) AM_WRITE(port14_w) + AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80dart", z80dart_device, ba_cd_r, ba_cd_w) + //AM_RANGE(0x20, 0x23) // Hard drive + AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80sio", z80sio0_device, ba_cd_r, ba_cd_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( altos5 ) +INPUT_PORTS_END + +UINT8 altos5_state::convert(offs_t offset, bool state) +{ + UINT8 data = m_p_prom[offset]; + + // if IPL and /A12, point at rom + if (!state && m_ipl && !BIT(offset, 0)) + data = 0x31; + else + // if WPRT point at nothing + if (state && BIT(data, 7)) + data = 0x30; + + // mask off wprt (no longer needed) + // normalise bank number (4x becomes 0x; 2x and 1x are already ok) + return data & 0x3f; +} + +void altos5_state::setup_banks(UINT8 source) +{ + offs_t offs,temp; + // WPRT | template | dma bank / cpu bank + + if (source == 1) // use DMA banks only if BUSACK is asserted + offs = ((~m_port09 & 0x20) << 3) | ((m_port09 & 0x06) << 5) | ((m_port09 & 0xc0) >> 2); + else + offs = ((~m_port09 & 0x20) << 3) | ((m_port09 & 0x06) << 5) | ((m_port09 & 0x18) << 1); + + temp = offs; + if ((source == 2) || (temp != m_curr_bank)) + { + membank("bankr0")->set_entry(convert(offs++, 0)); + membank("bankr1")->set_entry(convert(offs++, 0)); + membank("bankr2")->set_entry(convert(offs++, 0)); + membank("bankr3")->set_entry(convert(offs++, 0)); + membank("bankr4")->set_entry(convert(offs++, 0)); + membank("bankr5")->set_entry(convert(offs++, 0)); + membank("bankr6")->set_entry(convert(offs++, 0)); + membank("bankr7")->set_entry(convert(offs++, 0)); + membank("bankr8")->set_entry(convert(offs++, 0)); + membank("bankr9")->set_entry(convert(offs++, 0)); + membank("bankra")->set_entry(convert(offs++, 0)); + membank("bankrb")->set_entry(convert(offs++, 0)); + membank("bankrc")->set_entry(convert(offs++, 0)); + membank("bankrd")->set_entry(convert(offs++, 0)); + membank("bankre")->set_entry(convert(offs++, 0)); + membank("bankrf")->set_entry(convert(offs++, 0)); + + offs = temp; + membank("bankw0")->set_entry(convert(offs++, 1)); + membank("bankw1")->set_entry(convert(offs++, 1)); + membank("bankw2")->set_entry(convert(offs++, 1)); + membank("bankw3")->set_entry(convert(offs++, 1)); + membank("bankw4")->set_entry(convert(offs++, 1)); + membank("bankw5")->set_entry(convert(offs++, 1)); + membank("bankw6")->set_entry(convert(offs++, 1)); + membank("bankw7")->set_entry(convert(offs++, 1)); + membank("bankw8")->set_entry(convert(offs++, 1)); + membank("bankw9")->set_entry(convert(offs++, 1)); + membank("bankwa")->set_entry(convert(offs++, 1)); + membank("bankwb")->set_entry(convert(offs++, 1)); + membank("bankwc")->set_entry(convert(offs++, 1)); + membank("bankwd")->set_entry(convert(offs++, 1)); + membank("bankwe")->set_entry(convert(offs++, 1)); + membank("bankwf")->set_entry(convert(offs++, 1)); + } + + m_curr_bank = temp; +} + +void altos5_state::machine_reset() +{ + m_curr_bank = 0; + m_port08 = 0; + m_port09 = 0; + m_ipl = 1; + setup_banks(2); + m_maincpu->reset(); +} + +static const z80_daisy_config daisy_chain_intf[] = +{ + { "z80dma" }, + { "z80pio_0" }, + { "z80pio_1" }, + { "z80ctc" }, + { "z80dart" }, + { "z80sio" }, + { NULL } +}; + + +// turns off IPL mode, removes boot rom from memory map +WRITE8_MEMBER( altos5_state::port14_w ) +{ + m_ipl = 0; + setup_banks(2); +} + +READ8_MEMBER(altos5_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(altos5_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset, data); +} + +READ8_MEMBER(altos5_state::io_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(altos5_state::io_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + prog_space.write_byte(offset, data); +} + +WRITE_LINE_MEMBER( altos5_state::busreq_w ) +{ +// since our Z80 has no support for BUSACK, we assume it is granted immediately + m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); + m_maincpu->set_input_line(INPUT_LINE_HALT, state); // do we need this? + m_dma->bai_w(state); // tell dma that bus has been granted + setup_banks(state); // adjust banking for dma or cpu +} + +// baud rate generator and RTC. All inputs are 2MHz. +TIMER_DEVICE_CALLBACK_MEMBER(altos5_state::ctc_tick) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); + m_ctc->trg1(1); + m_ctc->trg1(0); + m_ctc->trg2(1); + m_ctc->trg2(0); + m_ctc->trg3(1); + m_ctc->trg3(0); +} + +WRITE_LINE_MEMBER( altos5_state::ctc_z1_w ) +{ + m_dart->rxca_w(state); + m_dart->txca_w(state); + m_sio->rxca_w(state); + m_sio->txca_w(state); +} + +/* +d0: L = a HD is present +d1: L = a 2nd hard drive is present +d2: unused configuration input (must be H to skip HD boot) +d3: selected floppy is single(L) or double sided(H) +d7: IRQ from FDC +*/ +READ8_MEMBER( altos5_state::port08_r ) +{ + UINT8 data = m_port08 | 0x87; + if (m_floppy) + data |= ((UINT8)m_floppy->twosid_r() << 3); // get number of sides + return data; +} + +/* +d0: HD IRQ +*/ +READ8_MEMBER( altos5_state::port09_r ) +{ + return m_port09 | 0x01; +} + +/* +d4: DDEN (H = double density) +d5: DS (H = drive 2) +d6: SS (H = side 2) +*/ +WRITE8_MEMBER( altos5_state::port08_w ) +{ + m_port08 = data & 0x70; + + m_floppy = NULL; + if (BIT(data, 5)) + m_floppy = m_floppy1->get_device(); + else + m_floppy = m_floppy0->get_device(); + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + { + m_floppy->mon_w(0); + m_floppy->ss_w(BIT(data, 6)); + m_fdc->dden_w(!BIT(data, 4)); + } +} + +/* +d1, 2: Memory Map template selection (0 = diag; 1 = oasis; 2 = mp/m) +d3, 4: CPU bank select +d5: H = Write protect of common area +d6, 7: DMA bank select (not emulated) +*/ +WRITE8_MEMBER( altos5_state::port09_w ) +{ + m_port09 = data; + setup_banks(2); +} + +static SLOT_INTERFACE_START( altos5_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER( altos5_state::fdc_intrq_w ) +{ + UINT8 data = m_port08 | ((UINT8)(state) << 7); + m_pio0->port_a_write(data); +} + +DRIVER_INIT_MEMBER( altos5_state, altos5 ) +{ + m_p_prom = memregion("proms")->base(); + + UINT8 *RAM = memregion("maincpu")->base(); + + membank("bankr0")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr1")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr2")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr3")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr4")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr5")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr6")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr7")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr8")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankr9")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankra")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankrb")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankrc")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankrd")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankre")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankrf")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw0")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw1")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw2")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw3")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw4")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw5")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw6")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw7")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw8")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankw9")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankwa")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankwb")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankwc")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankwd")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankwe")->configure_entries(0, 50, &RAM[0], 0x1000); + membank("bankwf")->configure_entries(0, 50, &RAM[0], 0x1000); +} + +static MACHINE_CONFIG_START( altos5, altos5_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz / 2) + MCFG_CPU_PROGRAM_MAP(altos5_mem) + MCFG_CPU_IO_MAP(altos5_io) + MCFG_CPU_CONFIG(daisy_chain_intf) + + /* devices */ + MCFG_DEVICE_ADD("z80dma", Z80DMA, XTAL_8MHz / 2) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(altos5_state, busreq_w)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + // BAO, not used + MCFG_Z80DMA_IN_MREQ_CB(READ8(altos5_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(altos5_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(altos5_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(altos5_state, io_write_byte)) + + MCFG_DEVICE_ADD("z80pio_0", Z80PIO, XTAL_8MHz / 2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(altos5_state, port08_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(altos5_state, port08_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(altos5_state, port09_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(altos5_state, port09_w)) + + MCFG_DEVICE_ADD("z80pio_1", Z80PIO, XTAL_8MHz / 2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_Z80DART_ADD("z80dart", XTAL_8MHz / 2, 0, 0, 0, 0 ) + // Channel A - console #3 + // Channel B - printer + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_Z80SIO0_ADD("z80sio", XTAL_8MHz / 2, 0, 0, 0, 0 ) + // Channel A - console #2 + // WRDY connects to (altos5_state, fdc_intrq_w) + // Channel B - console #1 + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_8MHz / 2) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80sio", z80dart_device, rxtxcb_w)) // SIO Ch B + MCFG_Z80CTC_ZC1_CB(WRITELINE(altos5_state, ctc_z1_w)) // Z80DART Ch A, SIO Ch A + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w)) // Z80DART Ch B + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80sio", z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("z80sio", z80dart_device, dcdb_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("z80sio", z80dart_device, rib_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("z80sio", z80dart_device, ctsb_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", altos5_state, ctc_tick, attotime::from_hz(XTAL_8MHz / 4)) + MCFG_FD1797_ADD("fdc", XTAL_8MHz / 8) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(altos5_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("z80dma", z80dma_device, rdy_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", altos5_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", altos5_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "altos5") +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( altos5 ) // 00000-2FFFF = ram banks; 30000-30FFF wprt space; 31000-31FFF ROM + ROM_REGION( 0x32000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("2732.bin", 0x31000, 0x1000, CRC(15fdc7eb) SHA1(e15bdf5d5414ad56f8c4bb84edc6f967a5f01ba9)) // bios + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD("82s141.bin", 0x0000, 0x0200, CRC(35c8078c) SHA1(dce24374bfcc5d23959e2c03485d82a119c0c3c9)) // banking control +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP(1982, altos5, 0, 0, altos5, altos5, altos5_state, altos5, "Altos", "Altos 5-15", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/amico2k.c b/src/mame/drivers/amico2k.c new file mode 100644 index 00000000000..4a1c9667c51 --- /dev/null +++ b/src/mame/drivers/amico2k.c @@ -0,0 +1,241 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli, Curt Coder +/*************************************************************************** + + A.S.EL. Amico 2000 + + 07/2009 Skeleton driver. + + IC9 - Monitor PROM, handwritten from book listing by Davide + IC10 - Recorder PROM, yet to be found + IC6/IC7 - PROMs reconstructed by Luigi Serrantoni + + To Do: + * Basically everything, in particular implement PROM (described in details + at the link below) and i8255 + + http://www.computerhistory.it/index.php?option=com_content&task=view&id=85&Itemid=117 + + Pasting: + 0-F : as is + ^ (inc) : ^ + AD : - + DA : = + GO : X + + Test Paste: + =11^22^33^44^55^66^77^88^99^-0000 + Now press up-arrow to confirm the data has been entered. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/i8255.h" +#include "amico2k.lh" + + +class amico2k_state : public driver_device +{ +public: + amico2k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + void machine_start(); + + DECLARE_READ8_MEMBER( ppi_pa_r ); + DECLARE_WRITE8_MEMBER( ppi_pa_w ); + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_WRITE8_MEMBER( ppi_pb_w ); + + int m_ls145_p; + UINT8 m_segment; + + // timers + emu_timer *m_led_refresh_timer; + TIMER_CALLBACK_MEMBER(led_refresh); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START( amico2k_mem, AS_PROGRAM, 8, amico2k_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x03ff) AM_RAM +// AM_RANGE(0x0400, 0x07ff) AM_RAM // optional expansion RAM + AM_RANGE(0xfb00, 0xfcff) AM_ROM + AM_RANGE(0xfd00, 0xfd03) AM_DEVREADWRITE("i8255", i8255_device, read, write) + AM_RANGE(0xfe00, 0xffff) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( amico2k ) + PORT_START("Q0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Q1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Q2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_P) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +TIMER_CALLBACK_MEMBER(amico2k_state::led_refresh) +{ + if (m_ls145_p > 3) + { + output_set_digit_value(m_ls145_p - 4, m_segment); + } +} + +READ8_MEMBER( amico2k_state::ppi_pa_r ) +{ + /* + + bit description + + PA0 keyboard data 0 + PA1 keyboard data 1 + PA2 keyboard data 2 + PA3 keyboard data 3 + PA4 keyboard data 4 + PA5 keyboard data 5 + PA6 keyboard data 6 + PA7 reg out + + */ + + switch (m_ls145_p) + { + case 0: return ioport("Q0")->read(); + case 1: return ioport("Q1")->read(); + case 2: return ioport("Q2")->read(); + default: return 0xff; + } +} + +WRITE8_MEMBER( amico2k_state::ppi_pa_w ) +{ + /* + + bit description + + PA0 LED segment A + PA1 LED segment B + PA2 LED segment C + PA3 LED segment D + PA4 LED segment E + PA5 LED segment F + PA6 LED segment G + PA7 + + */ + + m_segment = data; + m_led_refresh_timer->adjust(attotime::from_usec(70)); +} + +READ8_MEMBER( amico2k_state::ppi_pb_r ) +{ + /* + + bit description + + PB0 reg out + PB1 + PB2 + PB3 + PB4 + PB5 + PB6 + PB7 + + */ + + return 0; +} + +WRITE8_MEMBER( amico2k_state::ppi_pb_w ) +{ + /* + + bit description + + PB0 + PB1 LS145 P0 + PB2 LS145 P1 + PB3 LS145 P2 + PB4 LS145 P3 + PB5 reg in + PB6 reg in + PB7 led output enable + + */ + + m_ls145_p = (data >> 1) & 0x0f; +} + +void amico2k_state::machine_start() +{ + m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amico2k_state::led_refresh),this)); + + // state saving + save_item(NAME(m_ls145_p)); + save_item(NAME(m_segment)); +} + +static MACHINE_CONFIG_START( amico2k, amico2k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 1000000) /* 1MHz */ + MCFG_CPU_PROGRAM_MAP(amico2k_mem) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_amico2k ) + + MCFG_DEVICE_ADD("i8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(amico2k_state, ppi_pa_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(amico2k_state, ppi_pa_w)) + MCFG_I8255_IN_PORTB_CB(READ8(amico2k_state, ppi_pb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(amico2k_state, ppi_pb_w)) +MACHINE_CONFIG_END + + +/* ROM definition */ +// not sure the ROMs are loaded correctly +ROM_START( amico2k ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "prom.ic10", 0xfb00, 0x200, NO_DUMP ) // cassette recorder ROM, not published anywhere. a board is needed! + ROM_LOAD( "prom.ic9", 0xfe00, 0x200, CRC(86449f7c) SHA1(fe7deca86e90ab89aae23f11e9dbaf343b4242dc) ) + + ROM_REGION( 0x200, "proms", ROMREGION_ERASEFF ) + ROM_LOAD( "prom.ic6", 0x000, 0x100, CRC(4005f760) SHA1(7edcd85feb5a576f6da1bbb723b3cf668cf3df45) ) + ROM_LOAD( "prom.ic7", 0x100, 0x100, CRC(8785d864) SHA1(d169c3b5f5690664083030948db9f33571b08656) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, amico2k, 0, 0, amico2k, amico2k, driver_device, 0, "A.S.E.L.", "Amico 2000", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/amiga.c b/src/mame/drivers/amiga.c new file mode 100644 index 00000000000..d464a27591e --- /dev/null +++ b/src/mame/drivers/amiga.c @@ -0,0 +1,2144 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Commodore Amiga + +***************************************************************************/ + +#include "emu.h" +#include "includes/amiga.h" +#include "bus/amiga/zorro/zorro.h" +#include "cpu/m68000/m68000.h" +#include "cpu/m6502/m6502.h" +#include "machine/bankdev.h" +#include "machine/6525tpi.h" +#include "machine/mos6526.h" +#include "machine/gayle.h" +#include "machine/ataintf.h" +#include "machine/dmac.h" +#include "machine/nvram.h" +#include "machine/i2cmem.h" +#include "machine/amigafdc.h" +#include "machine/amigakbd.h" +#include "machine/cr511b.h" +#include "machine/rp5c01.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a1000_state : public amiga_state +{ +public: + a1000_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_bootrom(*this, "bootrom"), + m_wom(*this, "wom") + { } + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + DECLARE_WRITE16_MEMBER( write_protect_w ); + +protected: + virtual void machine_start(); + virtual void machine_reset(); + +private: + required_device m_bootrom; + required_memory_bank m_wom; + std::vector m_wom_ram; +}; + +class a2000_state : public amiga_state +{ +public: + a2000_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_rtc(*this, "u65"), + m_zorro(*this, ZORROBUS_TAG), + m_zorro2_int2(0), + m_zorro2_int6(0) + { } + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + DECLARE_WRITE_LINE_MEMBER( zorro2_int2_w ); + DECLARE_WRITE_LINE_MEMBER( zorro2_int6_w ); + + DECLARE_READ16_MEMBER( clock_r ); + DECLARE_WRITE16_MEMBER( clock_w ); + +protected: + virtual void machine_reset(); + + // amiga_state overrides + virtual bool int2_pending(); + virtual bool int6_pending(); + +private: + // devices + required_device m_rtc; + required_device m_zorro; + + // internal state + int m_zorro2_int2; + int m_zorro2_int6; +}; + +class a500_state : public amiga_state +{ +public: + a500_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_side(*this, EXP_SLOT_TAG), + m_side_int2(0), + m_side_int6(0) + { } + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + virtual void machine_reset(); + + // amiga_state overrides + virtual bool int2_pending(); + virtual bool int6_pending(); + +private: + // devices + required_device m_side; + + // internal state + int m_side_int2; + int m_side_int6; +}; + +class cdtv_state : public amiga_state +{ +public: + cdtv_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_rtc(*this, "u61"), + m_dmac(*this, "u36"), + m_tpi(*this, "u32"), + m_cdrom(*this, "cdrom"), + m_dmac_irq(0), + m_tpi_irq(0) + { } + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + DECLARE_READ16_MEMBER( clock_r ); + DECLARE_WRITE16_MEMBER( clock_w ); + + DECLARE_READ8_MEMBER( dmac_scsi_data_read ); + DECLARE_WRITE8_MEMBER( dmac_scsi_data_write ); + DECLARE_READ8_MEMBER( dmac_io_read ); + DECLARE_WRITE8_MEMBER( dmac_io_write ); + DECLARE_WRITE_LINE_MEMBER( dmac_int_w ); + + DECLARE_WRITE8_MEMBER( tpi_port_b_write ); + DECLARE_WRITE_LINE_MEMBER( tpi_int_w ); + +protected: + // driver_device overrides + virtual void machine_start(); + + // amiga_state overrides + virtual bool int2_pending(); + virtual bool int6_pending(); + +private: + // devices + required_device m_rtc; + required_device m_dmac; + required_device m_tpi; + required_device m_cdrom; + + // internal state + int m_dmac_irq; + int m_tpi_irq; +}; + +class a3000_state : public amiga_state +{ +public: + a3000_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag) + { } + + DECLARE_READ32_MEMBER( scsi_r ); + DECLARE_WRITE32_MEMBER( scsi_w ); + DECLARE_READ32_MEMBER( motherboard_r ); + DECLARE_WRITE32_MEMBER( motherboard_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + +private: +}; + +class a500p_state : public amiga_state +{ +public: + a500p_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_rtc(*this, "u9"), + m_side(*this, EXP_SLOT_TAG), + m_side_int2(0), + m_side_int6(0) + { } + + DECLARE_READ16_MEMBER( clock_r ); + DECLARE_WRITE16_MEMBER( clock_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + virtual void machine_reset(); + + // amiga_state overrides + virtual bool int2_pending(); + virtual bool int6_pending(); + +private: + // devices + required_device m_rtc; + required_device m_side; + + // internal state + int m_side_int2; + int m_side_int6; +}; + +class a600_state : public amiga_state +{ +public: + a600_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_gayle_int2(0) + { } + + DECLARE_WRITE_LINE_MEMBER( gayle_int2_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + static const UINT8 GAYLE_ID = 0xd0; + +protected: + virtual bool int2_pending(); + +private: + int m_gayle_int2; +}; + +class a1200_state : public amiga_state +{ +public: + a1200_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_gayle_int2(0) + { } + + DECLARE_WRITE_LINE_MEMBER( gayle_int2_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + static const UINT8 GAYLE_ID = 0xd1; + +protected: + virtual bool int2_pending(); + +private: + int m_gayle_int2; +}; + +class a4000_state : public amiga_state +{ +public: + a4000_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_ata(*this, "ata"), + m_ramsey_config(0), + m_gary_coldboot(1), + m_gary_timeout(0), + m_gary_toenb(0), + m_ide_interrupt(0) + { } + + DECLARE_READ32_MEMBER( scsi_r ); + DECLARE_WRITE32_MEMBER( scsi_w ); + DECLARE_READ16_MEMBER( ide_r ); + DECLARE_WRITE16_MEMBER( ide_w ); + DECLARE_WRITE_LINE_MEMBER( ide_interrupt_w ); + DECLARE_READ32_MEMBER( motherboard_r ); + DECLARE_WRITE32_MEMBER( motherboard_w ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + +protected: + +private: + required_device m_ata; + + int m_ramsey_config; + int m_gary_coldboot; + int m_gary_timeout; + int m_gary_toenb; + int m_ide_interrupt; +}; + +class cd32_state : public amiga_state +{ +public: + cd32_state(const machine_config &mconfig, device_type type, const char *tag) : + amiga_state(mconfig, type, tag), + m_p1_port(*this, "p1_cd32_buttons"), + m_p2_port(*this, "p2_cd32_buttons"), + m_cdda(*this, "cdda") + { } + + DECLARE_WRITE8_MEMBER( akiko_cia_0_port_a_write ); + + DECLARE_CUSTOM_INPUT_MEMBER( cd32_input ); + DECLARE_CUSTOM_INPUT_MEMBER( cd32_sel_mirror_input ); + + DECLARE_DRIVER_INIT( pal ); + DECLARE_DRIVER_INIT( ntsc ); + + required_ioport m_p1_port; + required_ioport m_p2_port; + + int m_oldstate[2]; + int m_cd32_shifter[2]; + UINT16 m_potgo_value; + +protected: + // amiga_state overrides + virtual void potgo_w(UINT16 data); + +private: + required_device m_cdda; +}; + + +//************************************************************************** +// REAL TIME CLOCK +//************************************************************************** + +READ16_MEMBER( cdtv_state::clock_r ) +{ + return m_rtc->read(space, offset / 2); +} + +WRITE16_MEMBER( cdtv_state::clock_w ) +{ + m_rtc->write(space, offset / 2, data); +} + +READ16_MEMBER( a2000_state::clock_r ) +{ + return m_rtc->read(space, offset / 2); +} + +WRITE16_MEMBER( a2000_state::clock_w ) +{ + m_rtc->write(space, offset / 2, data); +} + +READ16_MEMBER( a500p_state::clock_r ) +{ + return m_rtc->read(space, offset / 2); +} + +WRITE16_MEMBER( a500p_state::clock_w ) +{ + m_rtc->write(space, offset / 2, data); +} + + +//************************************************************************** +// CD-ROM CONTROLLER +//************************************************************************** + +READ8_MEMBER( cdtv_state::dmac_scsi_data_read ) +{ + if (offset >= 0xb0 && offset <= 0xbf) + return m_tpi->read(space, offset); + + return 0xff; +} + +WRITE8_MEMBER( cdtv_state::dmac_scsi_data_write ) +{ + if (offset >= 0xb0 && offset <= 0xbf) + m_tpi->write(space, offset, data); +} + +READ8_MEMBER( cdtv_state::dmac_io_read ) +{ + return m_cdrom->read(space, 0); +} + +WRITE8_MEMBER( cdtv_state::dmac_io_write ) +{ + m_cdrom->write(space, 0, data); +} + +WRITE_LINE_MEMBER( cdtv_state::dmac_int_w ) +{ + m_dmac_irq = state; + update_int2(); +} + +WRITE8_MEMBER( cdtv_state::tpi_port_b_write ) +{ + m_cdrom->cmd_w(BIT(data, 0)); + m_cdrom->enable_w(BIT(data, 1)); +} + +WRITE_LINE_MEMBER( cdtv_state::tpi_int_w ) +{ + m_tpi_irq = state; + update_int2(); +} + + +//************************************************************************** +// DRIVER INIT +//************************************************************************** + +// ocs chipset (agnus with support for 512k or 1mb chip ram, denise) +DRIVER_INIT_MEMBER( a1000_state, pal ) +{ + m_agnus_id = AGNUS_PAL; // 8367 + m_denise_id = DENISE; // 8362 +} + +DRIVER_INIT_MEMBER( a1000_state, ntsc ) +{ + m_agnus_id = AGNUS_NTSC; // 8361 + m_denise_id = DENISE; // 8362 +} + +DRIVER_INIT_MEMBER( a2000_state, pal ) +{ + m_agnus_id = AGNUS_PAL; // 8371 (later versions 8372A) + m_denise_id = DENISE; // 8362 +} + +DRIVER_INIT_MEMBER( a2000_state, ntsc ) +{ + m_agnus_id = AGNUS_NTSC; // 8370 (later versions 8372A) + m_denise_id = DENISE; // 8362 +} + +DRIVER_INIT_MEMBER( a500_state, pal ) +{ + m_agnus_id = AGNUS_PAL; // 8371 (later versions 8372A) + m_denise_id = DENISE; // 8362 +} + +DRIVER_INIT_MEMBER( a500_state, ntsc ) +{ + m_agnus_id = AGNUS_NTSC; // 8370 (later versions 8372A) + m_denise_id = DENISE; // 8362 +} + +DRIVER_INIT_MEMBER( cdtv_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; // 8372A + m_denise_id = DENISE; // 8362 +} + +DRIVER_INIT_MEMBER( cdtv_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC; // 8372A + m_denise_id = DENISE; // 8362 +} + +// ecs chipset (agnus with support for 2mb chip ram, super denise) +DRIVER_INIT_MEMBER( a3000_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL_NEW; // 8372B (early versions: 8372AB) + m_denise_id = DENISE_HR; // 8373 +} + +DRIVER_INIT_MEMBER( a3000_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC_NEW; // 8372B (early versions: 8372AB) + m_denise_id = DENISE_HR; // 8373 +} + +DRIVER_INIT_MEMBER( a500p_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; // 8375 (390544-01) + m_denise_id = DENISE_HR; // 8373 +} + +DRIVER_INIT_MEMBER( a500p_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02) + m_denise_id = DENISE_HR; // 8373 +} + +DRIVER_INIT_MEMBER( a600_state, pal ) +{ + m_agnus_id = AGNUS_HR_PAL; // 8375 (390544-01) + m_denise_id = DENISE_HR; // 8373 +} + +DRIVER_INIT_MEMBER( a600_state, ntsc ) +{ + m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02) + m_denise_id = DENISE_HR; // 8373 +} + +// aga chipset (alice and lisa) +DRIVER_INIT_MEMBER( a1200_state, pal ) +{ + m_agnus_id = ALICE_PAL_NEW; + m_denise_id = LISA; +} + +DRIVER_INIT_MEMBER( a1200_state, ntsc ) +{ + m_agnus_id = ALICE_NTSC_NEW; + m_denise_id = LISA; +} + +DRIVER_INIT_MEMBER( a4000_state, pal ) +{ + m_agnus_id = ALICE_PAL_NEW; + m_denise_id = LISA; +} + +DRIVER_INIT_MEMBER( a4000_state, ntsc ) +{ + m_agnus_id = ALICE_NTSC_NEW; + m_denise_id = LISA; +} + +DRIVER_INIT_MEMBER( cd32_state, pal ) +{ + m_agnus_id = ALICE_PAL_NEW; + m_denise_id = LISA; +} + +DRIVER_INIT_MEMBER( cd32_state, ntsc ) +{ + m_agnus_id = ALICE_NTSC_NEW; + m_denise_id = LISA; +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void a1000_state::machine_start() +{ + // start base machine + amiga_state::machine_start(); + + // allocate 256kb for wom + m_wom_ram.resize(256 * 1024 / 2); + m_wom->set_base(&m_wom_ram[0]); +} + +void a1000_state::machine_reset() +{ + // base reset + amiga_state::machine_reset(); + + // bootrom visible, wom writable + m_bootrom->set_bank(0); + m_maincpu->space(AS_PROGRAM).install_write_bank(0xfc0000, 0xffffff, "wom"); +} + +// any write to this area will write protect the wom and disable the bootrom +WRITE16_MEMBER( a1000_state::write_protect_w ) +{ + m_bootrom->set_bank(1); + m_maincpu->space(AS_PROGRAM).nop_write(0xfc0000, 0xffffff); +} + +void a2000_state::machine_reset() +{ + // base reset + amiga_state::machine_reset(); + + // reset zorro devices + m_zorro->reset(); +} + +WRITE_LINE_MEMBER( a2000_state::zorro2_int2_w ) +{ + m_zorro2_int2 = state; + update_int2(); +} + +WRITE_LINE_MEMBER( a2000_state::zorro2_int6_w ) +{ + m_zorro2_int6 = state; + update_int6(); +} + +bool a2000_state::int2_pending() +{ + return m_cia_0_irq || m_zorro2_int2; +} + +bool a2000_state::int6_pending() +{ + return m_cia_1_irq || m_zorro2_int6; +} + +void a500_state::machine_reset() +{ + // base reset + amiga_state::machine_reset(); + + // reset side expansion slot device + m_side->reset(); +} + +bool a500_state::int2_pending() +{ + return m_cia_0_irq || m_side_int2; +} + +bool a500_state::int6_pending() +{ + return m_cia_1_irq || m_side_int6; +} + +void cdtv_state::machine_start() +{ + // start base machine + amiga_state::machine_start(); + + // setup dmac + m_dmac->set_address_space(&m_maincpu->space(AS_PROGRAM)); + m_dmac->ramsz_w(0); +} + +bool cdtv_state::int2_pending() +{ + return m_cia_0_irq || m_dmac_irq || m_tpi_irq; +} + +bool cdtv_state::int6_pending() +{ + return m_cia_1_irq; +} + +READ32_MEMBER( a3000_state::scsi_r ) +{ + UINT32 data = 0xffffffff; + logerror("scsi_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} + +WRITE32_MEMBER( a3000_state::scsi_w ) +{ + logerror("scsi_w(%06x): %08x & %08x\n", offset, data, mem_mask); +} + +READ32_MEMBER( a3000_state::motherboard_r ) +{ + UINT32 data = 0xffffffff; + logerror("motherboard_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} + +WRITE32_MEMBER( a3000_state::motherboard_w ) +{ + logerror("motherboard_w(%06x): %08x & %08x\n", offset, data, mem_mask); +} + +void a500p_state::machine_reset() +{ + // base reset + amiga_state::machine_reset(); + + // reset side expansion slot device + m_side->reset(); +} + +bool a500p_state::int2_pending() +{ + return m_cia_0_irq || m_side_int2; +} + +bool a500p_state::int6_pending() +{ + return m_cia_1_irq || m_side_int6; +} + +bool a600_state::int2_pending() +{ + return m_cia_0_irq || m_gayle_int2; +} + +WRITE_LINE_MEMBER( a600_state::gayle_int2_w ) +{ + m_gayle_int2 = state; + update_int2(); +} + +bool a1200_state::int2_pending() +{ + return m_cia_0_irq || m_gayle_int2; +} + +WRITE_LINE_MEMBER( a1200_state::gayle_int2_w ) +{ + m_gayle_int2 = state; + update_int2(); +} + +READ32_MEMBER( a4000_state::scsi_r ) +{ + UINT16 data = 0xffff; + logerror("scsi_r(%06x): %08x & %08x\n", offset, data, mem_mask); + return data; +} + +WRITE32_MEMBER( a4000_state::scsi_w ) +{ + logerror("scsi_w(%06x): %08x & %08x\n", offset, data, mem_mask); +} + +READ16_MEMBER( a4000_state::ide_r ) +{ + UINT16 data = 0xffff; + + // ide interrupt register + if (offset == 0x1010) + return m_ide_interrupt << 15; + + // swap + mem_mask = (mem_mask << 8) | (mem_mask >> 8); + + // this very likely doesn't respond to all the addresses, figure out which ones + if (BIT(offset, 12)) + data = m_ata->read_cs1(space, (offset >> 1) & 0x07, mem_mask); + else + data = m_ata->read_cs0(space, (offset >> 1) & 0x07, mem_mask); + + // swap + data = (data << 8) | (data >> 8); + + return data; +} + +WRITE16_MEMBER( a4000_state::ide_w ) +{ + // ide interrupt register, read only + if (offset == 0x1010) + return; + + // swap + mem_mask = (mem_mask << 8) | (mem_mask >> 8); + data = (data << 8) | (data >> 8); + + // this very likely doesn't respond to all the addresses, figure out which ones + if (BIT(offset, 12)) + m_ata->write_cs1(space, (offset >> 1) & 0x07, data, mem_mask); + else + m_ata->write_cs0(space, (offset >> 1) & 0x07, data, mem_mask); +} + +WRITE_LINE_MEMBER( a4000_state::ide_interrupt_w ) +{ + m_ide_interrupt = state; +} + +READ32_MEMBER( a4000_state::motherboard_r ) +{ + UINT32 data = 0; + + if (offset == 0) + { + if (ACCESSING_BITS_0_7) + data |= m_ramsey_config & 0xff; + if (ACCESSING_BITS_8_15) + data |= (m_gary_coldboot << 7 | 0x7f) << 8; + if (ACCESSING_BITS_16_23) + data |= (m_gary_toenb << 7 | 0x7f) << 16; + if (ACCESSING_BITS_24_31) + data |= (m_gary_timeout << 7 | 0x7f) << 24; + } + else + data = 0xffffffff; + + logerror("motherboard_r(%06x): %08x & %08x\n", offset, data, mem_mask); + + return data; +} + +WRITE32_MEMBER( a4000_state::motherboard_w ) +{ + if (offset == 0) + { + if (ACCESSING_BITS_0_7) + m_ramsey_config = data & 0xff; + if (ACCESSING_BITS_8_15) + m_gary_coldboot = BIT(data, 7); + if (ACCESSING_BITS_16_23) + m_gary_toenb = BIT(data, 7); + if (ACCESSING_BITS_24_31) + m_gary_timeout = BIT(data, 7); + } + + logerror("motherboard_w(%06x): %08x & %08x\n", offset, data, mem_mask); +} + +void cd32_state::potgo_w(UINT16 data) +{ + int i; + + m_potgo_value = m_potgo_value & 0x5500; + m_potgo_value |= data & 0xaa00; + + for (i = 0; i < 8; i += 2) + { + UINT16 dir = 0x0200 << i; + if (data & dir) + { + UINT16 d = 0x0100 << i; + m_potgo_value &= ~d; + m_potgo_value |= data & d; + } + } + for (i = 0; i < 2; i++) + { + UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ + UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ + if ((m_potgo_value & p5dir) && (m_potgo_value & p5dat)) + m_cd32_shifter[i] = 8; + } +} + +static void handle_cd32_joystick_cia(running_machine &machine, UINT8 pra, UINT8 dra) +{ + cd32_state *state = machine.driver_data(); + int i; + + for (i = 0; i < 2; i++) + { + UINT8 but = 0x40 << i; + UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ + UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ + + if (!(state->m_potgo_value & p5dir) || !(state->m_potgo_value & p5dat)) + { + if ((dra & but) && (pra & but) != state->m_oldstate[i]) + { + if (!(pra & but)) + { + state->m_cd32_shifter[i]--; + if (state->m_cd32_shifter[i] < 0) + state->m_cd32_shifter[i] = 0; + } + } + } + state->m_oldstate[i] = pra & but; + } +} + +static UINT16 handle_joystick_potgor(running_machine &machine, UINT16 potgor) +{ + cd32_state *state = machine.driver_data(); + ioport_port * player_portname[] = { state->m_p1_port, state->m_p2_port }; + int i; + + for (i = 0; i < 2; i++) + { + UINT16 p9dir = 0x0800 << (i * 4); /* output enable P9 */ + UINT16 p9dat = 0x0400 << (i * 4); /* data P9 */ + UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ + UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ + + /* p5 is floating in input-mode */ + potgor &= ~p5dat; + potgor |= state->m_potgo_value & p5dat; + if (!(state->m_potgo_value & p9dir)) + potgor |= p9dat; + /* P5 output and 1 -> shift register is kept reset (Blue button) */ + if ((state->m_potgo_value & p5dir) && (state->m_potgo_value & p5dat)) + state->m_cd32_shifter[i] = 8; + /* shift at 1 == return one, >1 = return button states */ + if (state->m_cd32_shifter[i] == 0) + potgor &= ~p9dat; /* shift at zero == return zero */ + if (state->m_cd32_shifter[i] >= 2 && ((player_portname[i])->read() & (1 << (state->m_cd32_shifter[i] - 2)))) + potgor &= ~p9dat; + } + return potgor; +} + +CUSTOM_INPUT_MEMBER( cd32_state::cd32_input ) +{ + return handle_joystick_potgor(machine(), m_potgo_value) >> 8; +} + +CUSTOM_INPUT_MEMBER( cd32_state::cd32_sel_mirror_input ) +{ + ioport_port* ports[2]= { m_p1_port, m_p2_port }; + UINT8 bits = ports[(int)(FPTR)param]->read(); + return (bits & 0x20)>>5; +} + +WRITE8_MEMBER( cd32_state::akiko_cia_0_port_a_write ) +{ + // bit 0, cd audio mute + m_cdda->set_output_gain(0, BIT(data, 0) ? 0.0 : 1.0); + + // bit 1, power led + set_led_status(machine(), 0, BIT(data, 1) ? 0 : 1); + + handle_cd32_joystick_cia(machine(), data, m_cia_0->read(space, 2)); +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +// The first Amiga systems used a PAL to decode chip selects, later systems +// switched to the "Gary" chip, the A3000 and A4000 used the "Super Gary" +// chip. The A600 and A1200 use the Gayle chip, while the CD32 uses its +// Akiko custom chip. + +#if 0 +static ADDRESS_MAP_START( a1000_overlay_map, AS_PROGRAM, 16, a1000_state ) + AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0x1c0000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x201fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) + AM_RANGE(0x280000, 0x2bffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x300000, 0x33ffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x380000, 0x381fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) +ADDRESS_MAP_END +#endif + +static ADDRESS_MAP_START( a1000_overlay_map, AS_PROGRAM, 16, a1000_state ) + AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x201fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) + AM_RANGE(0x280000, 0x2fffff) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x300000, 0x37ffff) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x380000, 0x381fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( a1000_bootrom_map, AS_PROGRAM, 16, a1000_state ) + AM_RANGE(0x000000, 0x001fff) AM_MIRROR(0x3e000) AM_ROM AM_REGION("bootrom", 0) AM_WRITE(write_protect_w) + AM_RANGE(0x040000, 0x07ffff) AM_ROMBANK("wom") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( a1000_mem, AS_PROGRAM, 16, a1000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xfbffff) AM_DEVICE("bootrom", address_map_bank_device, amap16) + AM_RANGE(0xfc0000, 0xffffff) AM_READWRITE_BANK("wom") +ADDRESS_MAP_END + +// Gary/Super Gary/Gayle with 512KB chip RAM +static ADDRESS_MAP_START( overlay_512kb_map, AS_PROGRAM, 16, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// Gary/Super Gary/Gayle with 1MB chip RAM +static ADDRESS_MAP_START( overlay_1mb_map, AS_PROGRAM, 16, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_MIRROR(0x100000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// Gary/Super Gary/Gayle with 1MB chip RAM (32 bit system) +static ADDRESS_MAP_START( overlay_1mb_map32, AS_PROGRAM, 32, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_MIRROR(0x100000) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// Gary/Super Gary/Gayle with 2MB chip RAM (32 bit system) +static ADDRESS_MAP_START( overlay_2mb_map16, AS_PROGRAM, 16, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// Gary/Super Gary/Gayle with 2MB chip RAM (32 bit system) +static ADDRESS_MAP_START( overlay_2mb_map32, AS_PROGRAM, 32, amiga_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("chip_ram") + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// 512KB chip RAM, 512KB slow RAM, RTC +static ADDRESS_MAP_START( a2000_mem, AS_PROGRAM, 16, a2000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xc7ffff) AM_RAM + AM_RANGE(0xc80000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xdbffff) AM_NOP + AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// 512KB chip RAM and no clock +static ADDRESS_MAP_START( a500_mem, AS_PROGRAM, 16, a500_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// 1MB chip RAM, RTC and CDTV specific hardware +static ADDRESS_MAP_START( cdtv_mem, AS_PROGRAM, 16, cdtv_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xdbffff) AM_NOP + AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) + AM_RANGE(0xdc8000, 0xdc87ff) AM_MIRROR(0x7800) AM_RAM AM_SHARE("sram") + AM_RANGE(0xdd0000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xe00000, 0xe3ffff) AM_MIRROR(0x40000) AM_RAM AM_SHARE("memcard") + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf00000, 0xf3ffff) AM_MIRROR(0x40000) AM_ROM AM_REGION("cdrom", 0) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cdtv_rc_mem, AS_PROGRAM, 8, cdtv_state ) + AM_RANGE(0x0800, 0x0fff) AM_ROM AM_REGION("rcmcu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( a3000_mem, AS_PROGRAM, 32, a3000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x001fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) + AM_RANGE(0x00b80000, 0x00bfffff) AM_READWRITE16(cia_r, cia_w, 0xffffffff) + AM_RANGE(0x00c00000, 0x00cfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) + AM_RANGE(0x00d00000, 0x00dbffff) AM_NOP + AM_RANGE(0x00dc0000, 0x00dcffff) AM_DEVREADWRITE8("rtc", rp5c01_device, read, write, 0x000000ff) + AM_RANGE(0x00dd0000, 0x00ddffff) AM_READWRITE(scsi_r, scsi_w) + AM_RANGE(0x00de0000, 0x00deffff) AM_READWRITE(motherboard_r, motherboard_w) + AM_RANGE(0x00df0000, 0x00dfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) + AM_RANGE(0x00e80000, 0x00efffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0x00f00000, 0x00f7ffff) AM_NOP // cartridge space + AM_RANGE(0x00f80000, 0x00ffffff) AM_ROM AM_REGION("kickstart", 0) + AM_RANGE(0x07f00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward +ADDRESS_MAP_END + +// 1MB chip RAM and RTC +static ADDRESS_MAP_START( a500p_mem, AS_PROGRAM, 16, a500p_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) + AM_RANGE(0xc00000, 0xc7ffff) AM_RAM + AM_RANGE(0xc80000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xd80000, 0xdbffff) AM_NOP + AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) + AM_RANGE(0xd80000, 0xddffff) AM_NOP + AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// 1MB chip RAM, IDE and PCMCIA +static ADDRESS_MAP_START( a600_mem, AS_PROGRAM, 16, a600_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) + AM_RANGE(0x200000, 0xa7ffff) AM_NOP + AM_RANGE(0xa80000, 0xafffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xb00000, 0xb7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xb80000, 0xbeffff) AM_NOP // reserved (cdtv) + AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE(cia_r, gayle_cia_w) + AM_RANGE(0xc00000, 0xd7ffff) AM_NOP // slow mem + AM_RANGE(0xd80000, 0xd8ffff) AM_NOP // spare chip select + AM_RANGE(0xd90000, 0xd9ffff) AM_NOP // arcnet chip select + AM_RANGE(0xda0000, 0xdaffff) AM_DEVREADWRITE("gayle", gayle_device, gayle_r, gayle_w) + AM_RANGE(0xdb0000, 0xdbffff) AM_NOP // reserved (external ide) + AM_RANGE(0xdc0000, 0xdcffff) AM_NOP // rtc + AM_RANGE(0xdd0000, 0xddffff) AM_NOP // reserved (dma controller) + AM_RANGE(0xde0000, 0xdeffff) AM_DEVREADWRITE("gayle", gayle_device, gayle_id_r, gayle_id_w) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// 2MB chip RAM, IDE and PCMCIA +static ADDRESS_MAP_START( a1200_mem, AS_PROGRAM, 32, a1200_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) + AM_RANGE(0x200000, 0xa7ffff) AM_NOP + AM_RANGE(0xa80000, 0xafffff) AM_WRITENOP AM_READ(rom_mirror32_r) + AM_RANGE(0xb00000, 0xb7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) + AM_RANGE(0xb80000, 0xbeffff) AM_NOP // reserved (cdtv) + AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE16(cia_r, gayle_cia_w, 0xffffffff) + AM_RANGE(0xc00000, 0xd7ffff) AM_NOP // slow mem + AM_RANGE(0xd80000, 0xd8ffff) AM_NOP // spare chip select + AM_RANGE(0xd90000, 0xd9ffff) AM_NOP // arcnet chip select + AM_RANGE(0xda0000, 0xdaffff) AM_DEVREADWRITE16("gayle", gayle_device, gayle_r, gayle_w, 0xffffffff) + AM_RANGE(0xdb0000, 0xdbffff) AM_NOP // reserved (external ide) + AM_RANGE(0xdc0000, 0xdcffff) AM_NOP // rtc + AM_RANGE(0xdd0000, 0xddffff) AM_NOP // reserved (dma controller) + AM_RANGE(0xde0000, 0xdeffff) AM_DEVREADWRITE16("gayle", gayle_device, gayle_id_r, gayle_id_w, 0xffffffff) + AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) + AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) + AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) + AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// 2MB chip RAM, 4 MB fast RAM, RTC and IDE +static ADDRESS_MAP_START( a4000_mem, AS_PROGRAM, 32, a4000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x001fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) + AM_RANGE(0x00200000, 0x009fffff) AM_NOP // zorro2 expansion + AM_RANGE(0x00a00000, 0x00b7ffff) AM_NOP + AM_RANGE(0x00b80000, 0x00beffff) AM_NOP + AM_RANGE(0x00bf0000, 0x00bfffff) AM_READWRITE16(cia_r, cia_w, 0xffffffff) + AM_RANGE(0x00c00000, 0x00cfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) + AM_RANGE(0x00d00000, 0x00d9ffff) AM_NOP + AM_RANGE(0x00da0000, 0x00dbffff) AM_NOP + AM_RANGE(0x00dc0000, 0x00dcffff) AM_DEVREADWRITE8("rtc", rp5c01_device, read, write, 0x000000ff) + AM_RANGE(0x00dd0000, 0x00dd0fff) AM_NOP + AM_RANGE(0x00dd1000, 0x00dd3fff) AM_READWRITE16(ide_r, ide_w, 0xffffffff) + AM_RANGE(0x00dd4000, 0x00ddffff) AM_NOP + AM_RANGE(0x00de0000, 0x00deffff) AM_READWRITE(motherboard_r, motherboard_w) + AM_RANGE(0x00df0000, 0x00dfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) + AM_RANGE(0x00e00000, 0x00e7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) + AM_RANGE(0x00e80000, 0x00efffff) AM_NOP // zorro2 autoconfig space (installed by devices) + AM_RANGE(0x00f00000, 0x00f7ffff) AM_NOP // cartridge space + AM_RANGE(0x00f80000, 0x00ffffff) AM_ROM AM_REGION("kickstart", 0) + AM_RANGE(0x01000000, 0x017fffff) AM_NOP // reserved (8 mb chip ram) + AM_RANGE(0x01800000, 0x06ffffff) AM_NOP // reserved (motherboard fast ram expansion) + AM_RANGE(0x07000000, 0x07bfffff) AM_NOP // motherboard ram + AM_RANGE(0x07c00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward +ADDRESS_MAP_END + +// 2MB chip RAM, 2 MB fast RAM, RTC and IDE +static ADDRESS_MAP_START( a400030_mem, AS_PROGRAM, 32, a4000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_IMPORT_FROM(a4000_mem) + AM_RANGE(0x07000000, 0x07dfffff) AM_NOP // motherboard ram + AM_RANGE(0x07e00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward +ADDRESS_MAP_END + +// 2MB chip RAM and CD-ROM +static ADDRESS_MAP_START( cd32_mem, AS_PROGRAM, 32, cd32_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) + AM_RANGE(0xb80000, 0xb8003f) AM_DEVREADWRITE("akiko", akiko_device, read, write) + AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE16(cia_r, gayle_cia_w, 0xffffffff) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) + AM_RANGE(0xe00000, 0xe7ffff) AM_ROM AM_REGION("kickstart", 0x80000) + AM_RANGE(0xa00000, 0xf7ffff) AM_NOP + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) +ADDRESS_MAP_END + +// 2 MB chip RAM, IDE, RTC and SCSI +static ADDRESS_MAP_START( a4000t_mem, AS_PROGRAM, 32, a4000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_IMPORT_FROM(a4000_mem) + AM_RANGE(0x00dd0000, 0x00dd0fff) AM_READWRITE(scsi_r, scsi_w) +ADDRESS_MAP_END + + +//************************************************************************** +// INPUTS +//************************************************************************** + +static INPUT_PORTS_START( amiga ) + PORT_START("input") + PORT_CONFNAME(0x10, 0x00, "Game Port 0 Device") + PORT_CONFSETTING(0x00, "Mouse") + PORT_CONFSETTING(0x10, DEF_STR(Joystick)) + PORT_CONFNAME(0x20, 0x20, "Game Port 1 Device") + PORT_CONFSETTING(0x00, "Mouse") + PORT_CONFSETTING(0x20, DEF_STR(Joystick) ) + + PORT_START("cia_0_port_a") + PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, floppy_drive_status, 0) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + + PORT_START("joy_0_dat") + PORT_BIT(0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 0) + PORT_BIT(0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("joy_1_dat") + PORT_BIT(0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 1) + PORT_BIT(0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("potgo") + PORT_BIT(0x0100, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(1) + PORT_BIT(0x0400, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x1000, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(2) + PORT_BIT(0x4000, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0xaaff, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("p1_joy") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + + PORT_START("p2_joy") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + + PORT_START("p1_mouse_x") + PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) + + PORT_START("p1_mouse_y") + PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) + + PORT_START("p2_mouse_x") + PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(2) + + PORT_START("p2_mouse_y") + PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(2) +INPUT_PORTS_END + +INPUT_PORTS_START( cd32 ) + PORT_INCLUDE(amiga) + + PORT_MODIFY("cia_0_port_a") + PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) + // this is the regular port for reading a single button joystick on the Amiga, many CD32 games require this to mirror the pad start button! + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_sel_mirror_input, 0) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_sel_mirror_input, 1) + + PORT_MODIFY("joy_0_dat") + PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 0) + PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_MODIFY("joy_1_dat") + PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 1) + PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_MODIFY("potgo") + PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_input, 0) + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + // CD32 '11' button pad (4 dpad directions + 7 buttons), not read directly + PORT_START("p1_cd32_buttons") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Play/Pause") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Left Trigger/Rewind") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Right Trigger/Forward") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Green/Stop") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Yellow/Shuffle") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Red/Select") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Blue/Loop") + + // CD32 '11' button pad (4 dpad directions + 7 buttons), not read directly + PORT_START("p2_cd32_buttons") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Play/Pause") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Left Trigger/Rewind") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Right Trigger/Forward") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Green/Stop") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Yellow/Shuffle") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Red/Select") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Blue/Loop") +INPUT_PORTS_END + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static SLOT_INTERFACE_START( amiga_floppies ) + SLOT_INTERFACE("35dd", FLOPPY_35_DD) +SLOT_INTERFACE_END + +// basic elements common to all amigas +static MACHINE_CONFIG_START( amiga_base, amiga_state ) + // video + MCFG_FRAGMENT_ADD(pal_video) + + MCFG_PALETTE_ADD("palette", 4096) + MCFG_PALETTE_INIT_OWNER(amiga_state, amiga) + + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga) + + // cia + MCFG_DEVICE_ADD("cia_0", MOS8520, amiga_state::CLK_E_PAL) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_0_irq)) + MCFG_MOS6526_PA_INPUT_CALLBACK(IOPORT("cia_0_port_a")) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE("centronics", centronics_device, write_strobe)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE("kbd", amigakbd_device, kdat_w)) + + MCFG_DEVICE_ADD("cia_1", MOS8520, amiga_state::CLK_E_PAL) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, cia_1_port_a_read)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_1_port_a_write)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("fdc", amiga_fdc, ciaaprb_w)) + + // audio + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_PAL) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) + MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) + + // floppy drives + MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_PAL) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", amiga_floppies, "35dd", amiga_fdc::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", amiga_floppies, 0, amiga_fdc::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", amiga_floppies, 0, amiga_fdc::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", amiga_floppies, 0, amiga_fdc::floppy_formats) + + // rs232 + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(WRITELINE(amiga_state, rs232_rx_w)) + MCFG_RS232_DCD_HANDLER(WRITELINE(amiga_state, rs232_dcd_w)) + MCFG_RS232_DSR_HANDLER(WRITELINE(amiga_state, rs232_dsr_w)) + MCFG_RS232_RI_HANDLER(WRITELINE(amiga_state, rs232_ri_w)) + MCFG_RS232_CTS_HANDLER(WRITELINE(amiga_state, rs232_cts_w)) + + // centronics + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(amiga_state, centronics_ack_w)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amiga_state, centronics_busy_w)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(amiga_state, centronics_perror_w)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(amiga_state, centronics_select_w)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + // keyboard + MCFG_DEVICE_ADD("kbd", AMIGAKBD, 0) + MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(DEVWRITELINE("cia_0", mos8520_device, cnt_w)) + MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(DEVWRITELINE("cia_0", mos8520_device, sp_w)) + MCFG_AMIGA_KEYBOARD_KRST_CALLBACK(WRITELINE(amiga_state, kbreset_w)) + + // software + MCFG_SOFTWARE_LIST_ADD("wb_list", "amiga_workbench") + MCFG_SOFTWARE_LIST_ADD("hardware_list", "amiga_hardware") + MCFG_SOFTWARE_LIST_ADD("apps_list", "amiga_apps") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a1000, amiga_base, a1000_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a1000_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(a1000_overlay_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + MCFG_DEVICE_ADD("bootrom", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(a1000_bootrom_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(19) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x40000) + + MCFG_SOFTWARE_LIST_ADD("a1000_list", "amiga_a1000") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a1000n, a1000, a1000_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a2000, amiga_base, a2000_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a2000_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // real-time clock + MCFG_DEVICE_ADD("u65", MSM6242, XTAL_32_768kHz) + + // cpu slot + MCFG_EXPANSION_SLOT_ADD("maincpu", a2000_expansion_cards, NULL) + + // zorro slots + MCFG_ZORRO2_ADD("maincpu") + MCFG_ZORRO2_INT2_HANDLER(WRITELINE(a2000_state, zorro2_int2_w)) + MCFG_ZORRO2_INT6_HANDLER(WRITELINE(a2000_state, zorro2_int6_w)) + MCFG_ZORRO2_SLOT_ADD("zorro1", zorro2_cards, NULL) + MCFG_ZORRO2_SLOT_ADD("zorro2", zorro2_cards, NULL) + MCFG_ZORRO2_SLOT_ADD("zorro3", zorro2_cards, NULL) + MCFG_ZORRO2_SLOT_ADD("zorro4", zorro2_cards, NULL) + MCFG_ZORRO2_SLOT_ADD("zorro5", zorro2_cards, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a2000n, a2000, a2000_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a500, amiga_base, a500_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a500_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + //MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // cpu slot + MCFG_EXPANSION_SLOT_ADD("maincpu", a500_expansion_cards, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a500n, a500, a500_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( cdtv, amiga_base, cdtv_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(cdtv_mem) + + // remote control input converter + MCFG_CPU_ADD("u75", M6502, XTAL_3MHz) + MCFG_CPU_PROGRAM_MAP(cdtv_rc_mem) + MCFG_DEVICE_DISABLE() + + // lcd controller +#if 0 + MCFG_CPU_ADD("u62", LC6554, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(lcd_mem) +#endif + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // standard sram + MCFG_NVRAM_ADD_0FILL("sram") + + // 256kb memory card + MCFG_NVRAM_ADD_0FILL("memcard") + + // real-time clock + MCFG_DEVICE_ADD("u61", MSM6242, XTAL_32_768kHz) + + // cd-rom controller + MCFG_DMAC_ADD("u36", amiga_state::CLK_7M_PAL) + MCFG_DMAC_SCSI_READ_HANDLER(READ8(cdtv_state, dmac_scsi_data_read)) + MCFG_DMAC_SCSI_WRITE_HANDLER(WRITE8(cdtv_state, dmac_scsi_data_write)) + MCFG_DMAC_IO_READ_HANDLER(READ8(cdtv_state, dmac_io_read)) + MCFG_DMAC_IO_WRITE_HANDLER(WRITE8(cdtv_state, dmac_io_write)) + MCFG_DMAC_INT_HANDLER(WRITELINE(cdtv_state, dmac_int_w)) + + MCFG_DEVICE_ADD("u32", TPI6525, 0) + MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(cdtv_state, tpi_int_w)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cdtv_state, tpi_port_b_write)) + + // cd-rom + MCFG_CR511B_ADD("cdrom") + MCFG_CR511B_SCOR_HANDLER(DEVWRITELINE("u32", tpi6525_device, i1_w)) MCFG_DEVCB_INVERT + MCFG_CR511B_STCH_HANDLER(DEVWRITELINE("u32", tpi6525_device, i2_w)) MCFG_DEVCB_INVERT + MCFG_CR511B_STEN_HANDLER(DEVWRITELINE("u32", tpi6525_device, i3_w)) + MCFG_CR511B_XAEN_HANDLER(DEVWRITELINE("u32", tpi6525_device, pb2_w)) + MCFG_CR511B_DRQ_HANDLER(DEVWRITELINE("u36", dmac_device, xdreq_w)) + MCFG_CR511B_DTEN_HANDLER(DEVWRITELINE("u36", dmac_device, xdreq_w)) + + MCFG_SOFTWARE_LIST_ADD("cd_list", "cdtv") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( cdtvn, cdtv, cdtv_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("u36") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a3000, amiga_base, a3000_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68030, XTAL_32MHz / 2) + MCFG_CPU_PROGRAM_MAP(a3000_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // real-time clock + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) + + // todo: zorro3 slots, super dmac, scsi + + MCFG_SOFTWARE_LIST_ADD("a3000_list", "amiga_a3000") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a3000n, a3000, a3000_state ) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a500p, amiga_base, a500p_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a500p_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + // real-time clock + MCFG_DEVICE_ADD("u9", MSM6242, XTAL_32_768kHz) + + // cpu slot + MCFG_EXPANSION_SLOT_ADD("maincpu", a500_expansion_cards, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a500pn, a500p, a500p_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a600, amiga_base, a600_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) + MCFG_CPU_PROGRAM_MAP(a600_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map16) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + MCFG_GAYLE_ADD("gayle", amiga_state::CLK_28M_PAL / 2, a600_state::GAYLE_ID) + MCFG_GAYLE_INT2_HANDLER(WRITELINE(a600_state, gayle_int2_w)) + MCFG_GAYLE_CS0_READ_HANDLER(DEVREAD16("ata", ata_interface_device, read_cs0)) + MCFG_GAYLE_CS0_WRITE_HANDLER(DEVWRITE16("ata", ata_interface_device, write_cs0)) + MCFG_GAYLE_CS1_READ_HANDLER(DEVREAD16("ata", ata_interface_device, read_cs1)) + MCFG_GAYLE_CS1_WRITE_HANDLER(DEVWRITE16("ata", ata_interface_device, write_cs1)) + + MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, false) + MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("gayle", gayle_device, ide_interrupt_w)) + + // todo: pcmcia +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a600n, a600, a600_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) + MCFG_DEVICE_MODIFY("gayle") + MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a1200, amiga_base, a1200_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68EC020, amiga_state::CLK_28M_PAL / 2) + MCFG_CPU_PROGRAM_MAP(a1200_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + + MCFG_DEVICE_REMOVE("palette") + + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) + + MCFG_GAYLE_ADD("gayle", amiga_state::CLK_28M_PAL / 2, a1200_state::GAYLE_ID) + MCFG_GAYLE_INT2_HANDLER(WRITELINE(a1200_state, gayle_int2_w)) + MCFG_GAYLE_CS0_READ_HANDLER(DEVREAD16("ata", ata_interface_device, read_cs0)) + MCFG_GAYLE_CS0_WRITE_HANDLER(DEVWRITE16("ata", ata_interface_device, write_cs0)) + MCFG_GAYLE_CS1_READ_HANDLER(DEVREAD16("ata", ata_interface_device, read_cs1)) + MCFG_GAYLE_CS1_WRITE_HANDLER(DEVWRITE16("ata", ata_interface_device, write_cs1)) + + MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, false) + MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("gayle", gayle_device, ide_interrupt_w)) + + // todo: pcmcia +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a1200n, a1200, a1200_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) + MCFG_DEVICE_MODIFY("gayle") + MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a4000, amiga_base, a4000_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68040, XTAL_50MHz / 2) + MCFG_CPU_PROGRAM_MAP(a4000_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + + MCFG_DEVICE_REMOVE("palette") + + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) + + // real-time clock + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) + + // ide + MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, false) + MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(a4000_state, ide_interrupt_w)) + + // todo: zorro3 +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a4000n, a4000, a4000_state ) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a400030, a4000, a4000_state ) + // main cpu + MCFG_DEVICE_REMOVE("maincpu") + MCFG_CPU_ADD("maincpu", M68EC030, XTAL_50MHz / 2) + MCFG_CPU_PROGRAM_MAP(a400030_mem) + + // todo: ide +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a400030n, a400030, a4000_state ) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( cd32, amiga_base, cd32_state ) + // main cpu + MCFG_CPU_ADD("maincpu", M68EC020, amiga_state::CLK_28M_PAL / 2) + MCFG_CPU_PROGRAM_MAP(cd32_mem) + + MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) + + MCFG_I2CMEM_ADD("i2cmem") + MCFG_I2CMEM_PAGE_SIZE(16) + MCFG_I2CMEM_DATA_SIZE(1024) + + MCFG_AKIKO_ADD("akiko", "maincpu") + MCFG_AKIKO_SCL_HANDLER(DEVWRITELINE("i2cmem", i2cmem_device, write_scl)) + MCFG_AKIKO_SDA_READ_HANDLER(DEVREADLINE("i2cmem", i2cmem_device, read_sda)) + MCFG_AKIKO_SDA_WRITE_HANDLER(DEVWRITELINE("i2cmem", i2cmem_device, write_sda)) + + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + + MCFG_DEVICE_REMOVE("palette") + + MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) + + MCFG_SOUND_ADD("cdda", CDDA, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + + MCFG_DEVICE_MODIFY("cia_0") + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cd32_state, akiko_cia_0_port_a_write)) + MCFG_MOS6526_SP_CALLBACK(NULL) + + MCFG_CDROM_ADD("cdrom") + MCFG_CDROM_INTERFACE("cd32_cdrom") + + MCFG_DEVICE_REMOVE("kbd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( cd32n, cd32, cd32_state ) + MCFG_DEVICE_MODIFY("maincpu") + MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a4000t, a4000, a4000_state ) + // main cpu + MCFG_DEVICE_REMOVE("maincpu") + MCFG_CPU_ADD("maincpu", M68040, XTAL_50MHz / 2) + MCFG_CPU_PROGRAM_MAP(a4000t_mem) + + // todo: ide, zorro3, scsi, super dmac +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( a4000tn, a4000, a4000_state ) + MCFG_DEVICE_REMOVE("screen") + MCFG_FRAGMENT_ADD(ntsc_video) + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) + MCFG_DEVICE_MODIFY("amiga") + MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) + MCFG_DEVICE_MODIFY("cia_0") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("cia_1") + MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) + MCFG_DEVICE_MODIFY("fdc") + MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) +MACHINE_CONFIG_END + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +// Amiga 1000 +// +// Shipped with a small bootrom to load kickstart from disk because the +// Kickstart wasn't finished in time. + +ROM_START( a1000 ) + ROM_REGION16_BE(0x2000, "bootrom", 0) + ROM_LOAD16_BYTE("252179-01.u5n", 0x0000, 0x1000, CRC(42553bc4) SHA1(8855a97f7a44e3f62d1c88d938fee1f4c606af5b)) + ROM_LOAD16_BYTE("252180-01.u5p", 0x0001, 0x1000, CRC(8e5b9a37) SHA1(d10f1564b99f5ffe108fa042362e877f569de2c3)) + + // PALs, all of type PAL16L8 + ROM_REGION(0x104, "dpalen", 0) + ROM_LOAD("252128-01.u4t", 0, 0x104, CRC(28209ff2) SHA1(20c03b6b8e7254231f4b3014dc2c4d9274d469d2)) + ROM_REGION(0x104, "dpalcas", 0) + ROM_LOAD("252128-02.u6p", 0, 0x104, CRC(b928efd2) SHA1(430794a544d9160e1b786e97e0dec5f25502a00a)) + ROM_REGION(0x104, "daugen", 0) + ROM_LOAD("252128-03.u4s", 0, 0x104, CRC(87747964) SHA1(00d72ec707c582363525fde56176973c7327b1d7)) + ROM_REGION(0x104, "daugcas", 0) + ROM_LOAD("252128-04.u6n", 0, 0x104, CRC(f903adb4) SHA1(4c8fb696fd1aaf9bb8c9efddeac24bb36f119c5f)) +ROM_END + +#define rom_a1000n rom_a1000 + +// Amiga 2000 and Amiga 500 +// +// Early models shipped with Kickstart 1.2, later versions with Kickstart 1.3. +// Kickstart 2.04 and 3.1 upgrade available. The Kickstart 2.04 upgrade was also +// available as a special version that included a jumper wire, which was needed +// for some early motherboard revisions (P/N: 363968-01). + +ROM_START( a2000 ) + ROM_REGION16_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick13") + ROM_SYSTEM_BIOS(0, "kick12", "Kickstart 1.2 (33.180)") + ROMX_LOAD("315093-01.u2", 0x00000, 0x40000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88), ROM_GROUPWORD | ROM_BIOS(1)) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) + ROM_SYSTEM_BIOS(1, "kick13", "Kickstart 1.3 (34.5)") + ROMX_LOAD("315093-02.u2", 0x00000, 0x40000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD | ROM_BIOS(2)) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) + ROM_SYSTEM_BIOS(2, "kick204", "Kickstart 2.04 (37.175)") + ROMX_LOAD("390979-01.u2", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "kick31", "Kickstart 3.1 (40.63)") + ROMX_LOAD("kick40063.u2", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "logica2", "Logica Diagnostic 2.0") + ROMX_LOAD("logica2.u2", 0x00000, 0x80000, CRC(8484f426) SHA1(ba10d16166b2e2d6177c979c99edf8462b21651e), ROM_GROUPWORD | ROM_BIOS(5)) +ROM_END + +// Amiga 2000CR chip location: U500 +#define rom_a2000n rom_a2000 + +// Amiga 500 chip location: U6 +#define rom_a500 rom_a2000 +#define rom_a500n rom_a2000 + +// Amiga 500+ +// +// Shipped with Kickstart 2.04. Kickstart 3.1 upgrade available. + +ROM_START( a500p ) + ROM_REGION16_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick204") + ROM_SYSTEM_BIOS(0, "kick204", "Kickstart 2.04 (37.175)") + ROMX_LOAD("390979-01.u6", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick31", "Kickstart 3.1 (40.63)") + ROMX_LOAD("kick40063.u6", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "logica2", "Logica Diagnostic 2.0") + ROMX_LOAD("logica2.u6", 0x00000, 0x80000, CRC(8484f426) SHA1(ba10d16166b2e2d6177c979c99edf8462b21651e), ROM_GROUPWORD | ROM_BIOS(3)) +ROM_END + +#define rom_a500pn rom_a500p + +// Commodore CDTV +// +// Shipped with a standard Kickstart 1.3 and the needed additional drivers +// in two extra chips. + +ROM_START( cdtv ) + // cd-rom driver + ROM_REGION16_BE(0x40000, "cdrom", 0) + ROM_LOAD16_BYTE("391008-01.u34", 0x00000, 0x20000, CRC(791cb14b) SHA1(277a1778924496353ffe56be68063d2a334360e4)) + ROM_LOAD16_BYTE("391009-01.u35", 0x00001, 0x20000, CRC(accbbc2e) SHA1(41b06d1679c6e6933c3378b7626025f7641ebc5c)) + + // standard amiga kickstart 1.3 + ROM_REGION16_BE(0x80000, "kickstart", 0) + ROMX_LOAD("315093-02.u13", 0x00000, 0x40000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD) + ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) + + // remote control input converter, mos 6500/1 mcu + ROM_REGION(0x800, "rcmcu", 0) + ROM_LOAD("252609-02.u75", 0x000, 0x800, NO_DUMP) + + // lcd controller, sanyo lc6554h + ROM_REGION(0x1000, "lcd", 0) + ROM_LOAD("252608-01.u62", 0x0000, 0x1000, NO_DUMP) +ROM_END + +#define rom_cdtvn rom_cdtv + +// Amiga 3000 +// +// Early models have a special version of Kickstart 1.4/2.0 that boots +// Kickstart 1.3 or 2.0 from hard disk or floppy. Later versions have +// Kickstart 2.04 installed as ROM. Upgrade available for +// Kickstart 3.1. + +ROM_START( a3000 ) + ROM_REGION32_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick20") + ROM_SYSTEM_BIOS(0, "kick14", "Kickstart 1.4 (3312.20085?)") + ROMX_LOAD("390629-01.u182", 0x00000, 0x40000, NO_DUMP, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD("390630-01.u183", 0x00002, 0x40000, NO_DUMP, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick20", "Kickstart 2.0 (36.16)") + // COPYRIGHT 1990 CAI // ALL RIGHTS RESERVED // ALPHA 5 ROM 0 CS=9713 + ROMX_LOAD("390629-02.u182", 0x00000, 0x40000, CRC(58327536) SHA1(d1713d7f31474a5948e6d488e33686061cf3d1e2), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + // COPYRIGHT 1990 CAI // ALL RIGHTS RESERVED // ALPHA 5 ROM 1 CS=9B21 + ROMX_LOAD("390630-02.u183", 0x00002, 0x40000, CRC(fe2f7fb9) SHA1(c05c9c52d014c66f9019152b3f2a2adc2c678794), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "kick204", "Kickstart 2.04 (37.175)") + ROMX_LOAD("390629-03.u182", 0x00000, 0x40000, CRC(a245dbdf) SHA1(83bab8e95d378b55b0c6ae6561385a96f638598f), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) + ROMX_LOAD("390630-03.u183", 0x00002, 0x40000, CRC(7db1332b) SHA1(48f14b31279da6757848df6feb5318818f8f576c), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "kick31", "Kickstart 3.1 (40.68)") + ROMX_LOAD("kick31.u182", 0x00000, 0x40000, CRC(286b9a0d) SHA1(6763a2258ec493f7408cf663110dae9a17803ad1), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(4)) + ROMX_LOAD("kick31.u183", 0x00002, 0x40000, CRC(0b8cde6a) SHA1(5f02e97b48ebbba87d516a56b0400c6fc3434d8d), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "logica2", "Logica Diagnostic 2.0") + ROMX_LOAD("logica2.u182", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(5)) + ROMX_LOAD("logica2.u183", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(5)) +ROM_END + +#define rom_a3000n rom_a3000 + + +// Amiga 600 +// +// According to Greg Donner's Workbench page, very early models shipped with +// Kickstart 2.04. +// +// Kickstart 2.05 differences: +// - 2.05 37.299: No HDD support +// - 2.05 37.300: HDD support +// - 2.05 37.350: HDD size limits removed +// +// Kickstart 3.1 upgrade available. +// +// The keyboard controller is included on the motherboard, still based on the +// 6500/1. + +ROM_START( a600 ) + ROM_REGION16_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick205-350") + ROM_SYSTEM_BIOS(0, "kick204", "Kickstart 2.04 (37.175)") + ROMX_LOAD("390979-01.u6", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick205-299", "Kickstart 2.05 (37.299)") + ROMX_LOAD("391388-01.u6", 0x00000, 0x80000, CRC(83028fb5) SHA1(87508de834dc7eb47359cede72d2e3c8a2e5d8db), ROM_GROUPWORD | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "kick205-300", "Kickstart 2.05 (37.300)") + ROMX_LOAD("391304-01.u6", 0x00000, 0x80000, CRC(64466c2a) SHA1(f72d89148dac39c696e30b10859ebc859226637b), ROM_GROUPWORD | ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "kick205-350", "Kickstart 2.05 (37.300)") + ROMX_LOAD("391304-02.u6", 0x00000, 0x80000, CRC(43b0df7b) SHA1(02843c4253bbd29aba535b0aa3bd9a85034ecde4), ROM_GROUPWORD | ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "kick31", "Kickstart 3.1 (40.63)") + ROMX_LOAD("kick40063.u6", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "logica2", "Logica Diagnostic 2.0") + ROMX_LOAD("logica2.u6", 0x00000, 0x80000, CRC(8484f426) SHA1(ba10d16166b2e2d6177c979c99edf8462b21651e), ROM_GROUPWORD | ROM_BIOS(6)) + + ROM_REGION(0x800, "keyboard", 0) + ROM_LOAD("391079-01.u13", 0x000, 0x800, NO_DUMP) +ROM_END + +#define rom_a600n rom_a600 + +// Amiga 1200 +// +// Early models shipped with Kickstart 3.0, later versions with +// Kickstart 3.1. Keyboard controller is included on the motherboard, +// but was changed to a 68HC05 core. + +ROM_START( a1200 ) + ROM_REGION32_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick31") + ROM_SYSTEM_BIOS(0, "kick30", "Kickstart 3.0 (39.106)") + ROMX_LOAD("391523-01.u6a", 0x00000, 0x40000, CRC(c742a412) SHA1(999eb81c65dfd07a71ee19315d99c7eb858ab186), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD("391524-01.u6b", 0x00002, 0x40000, CRC(d55c6ec6) SHA1(3341108d3a402882b5ef9d3b242cbf3c8ab1a3e9), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick31", "Kickstart 3.1 (40.68)") + ROMX_LOAD("391773-01.u6a", 0x00000, 0x40000, CRC(08dbf275) SHA1(b8800f5f909298109ea69690b1b8523fa22ddb37), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROMX_LOAD("391774-01.u6b", 0x00002, 0x40000, CRC(16c07bf8) SHA1(90e331be1970b0e53f53a9b0390b51b59b3869c2), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "logica2", "Logica Diagnostic 2.0") + ROMX_LOAD("logica2.u6a", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) + ROMX_LOAD("logica2.u6b", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) + + ROM_REGION(0x4000, "keyboard", 0) + ROM_LOAD("391508-01.u13", 0x0000, 0x1040, NO_DUMP) // COMMODORE | 391508-01 REV0 | KEYBOARD MPU (MC68HC05C4AFN) + ROM_LOAD("391508-02.u13", 0x0000, 0x2f40, NO_DUMP) // Amiga Tech REV1 Keyboard MPU (MC68HC05C12FN) +ROM_END + +#define rom_a1200n rom_a1200 + +// Amiga 4000 +// +// Shipped with Kickstart 3.0, upgradable to Kickstart 3.1. + +ROM_START( a4000 ) + ROM_REGION32_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick30") + ROM_SYSTEM_BIOS(0, "kick30", "Kickstart 3.0 (39.106)") + ROMX_LOAD("391513-02.u175", 0x00000, 0x40000, CRC(36f64dd0) SHA1(196e9f3f9cad934e181c07da33083b1f0a3c702f), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD("391514-02.u176", 0x00002, 0x40000, CRC(17266a55) SHA1(42fbed3453d1f11ccbde89a9826f2d1175cca5cc), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "kick31-68", "Kickstart 3.1 (40.68)") + ROMX_LOAD("kick40068.u175", 0x00000, 0x40000, CRC(b2af34f8) SHA1(24e52b5efc02049517387ab7b1a1475fc540350e), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROMX_LOAD("kick40068.u176", 0x00002, 0x40000, CRC(e65636a3) SHA1(313c7cbda5779e56f19a41d34e760f517626d882), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "kick31-70", "Kickstart 3.1 (40.70)") + ROMX_LOAD("kick40070.u175", 0x00000, 0x40000, CRC(f9cbecc9) SHA1(138d8cb43b8312fe16d69070de607469b3d4078e), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) + ROMX_LOAD("kick40070.u176", 0x00002, 0x40000, CRC(f8248355) SHA1(c23795479fae3910c185512ca268b82f1ae4fe05), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "logica2", "Logica Diagnostic 2.0") + ROMX_LOAD("logica2.u6a", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(4)) + ROMX_LOAD("logica2.u6b", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(4)) +ROM_END + +#define rom_a4000n rom_a4000 +#define rom_a400030 rom_a4000 +#define rom_a400030n rom_a4000 + +// Amiga 4000T +// +// Shipped with Kickstart 3.1 (40.70). + +ROM_START( a4000t ) + ROM_REGION32_BE(0x80000, "kickstart", 0) + ROM_DEFAULT_BIOS("kick31") + ROM_SYSTEM_BIOS(0, "kick31", "Kickstart 3.1 (40.70)") + ROMX_LOAD("391657-01.u175", 0x00000, 0x40000, CRC(0ca94f70) SHA1(b3806edacb3362fc16a154ce1eeec5bf5bc24789), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD("391658-01.u176", 0x00002, 0x40000, CRC(dfe03120) SHA1(cd7a706c431b04d87814d3a2d8b397100cf44c0c), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "logica2", "Logica Diagnostic 2.0") + ROMX_LOAD("logica2.u6a", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) + ROMX_LOAD("logica2.u6b", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) +ROM_END + +#define rom_a4000tn rom_a4000t + +// Amiga CD32 +// +// Shipped with Kickstart 3.1 and additional software interleaved in a 1MB rom chip. + +ROM_START( cd32 ) + ROM_REGION32_BE(0x100000, "kickstart", 0) +// ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(a4fbc94a) SHA1(816ce6c5077875850c7d43452230a9ba3a2902db)) // todo: this is the real dump + ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(d3837ae4) SHA1(06807db3181637455f4d46582d9972afec8956d9)) +ROM_END + +#define rom_cd32n rom_cd32 + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// OCS Chipset +COMP( 1985, a1000, 0, 0, a1000, amiga, a1000_state, pal, "Commodore", "Amiga 1000 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1985, a1000n, a1000, 0, a1000n, amiga, a1000_state, ntsc, "Commodore", "Amiga 1000 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1987, a2000, 0, 0, a2000, amiga, a2000_state, pal, "Commodore", "Amiga 2000 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1987, a2000n, a2000, 0, a2000n, amiga, a2000_state, ntsc, "Commodore", "Amiga 2000 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1987, a500, 0, 0, a500, amiga, a500_state, pal, "Commodore", "Amiga 500 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1987, a500n, a500, 0, a500n, amiga, a500_state, ntsc, "Commodore", "Amiga 500 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1990, cdtv, 0, 0, cdtv, amiga, cdtv_state, pal, "Commodore", "CDTV (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1990, cdtvn, cdtv, 0, cdtvn, amiga, cdtv_state, ntsc, "Commodore", "CDTV (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) + +// ECS Chipset +COMP( 1990, a3000, 0, 0, a3000, amiga, a3000_state, pal, "Commodore", "Amiga 3000 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1990, a3000n, a3000, 0, a3000n, amiga, a3000_state, ntsc, "Commodore", "Amiga 3000 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1992, a500p, 0, 0, a500p, amiga, a500p_state, pal, "Commodore", "Amiga 500 Plus (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1992, a500pn, a500p, 0, a500pn, amiga, a500p_state, ntsc, "Commodore", "Amiga 500 Plus (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1992, a600, 0, 0, a600, amiga, a600_state, pal, "Commodore", "Amiga 600 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1992, a600n, a600, 0, a600n, amiga, a600_state, ntsc, "Commodore", "Amiga 600 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) + +// AGA Chipset +COMP( 1992, a1200, 0, 0, a1200, amiga, a1200_state, pal, "Commodore", "Amiga 1200 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1992, a1200n, a1200, 0, a1200n, amiga, a1200_state, ntsc, "Commodore", "Amiga 1200 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1992, a4000, 0, 0, a4000, amiga, a4000_state, pal, "Commodore", "Amiga 4000/040 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1992, a4000n, a4000, 0, a4000n, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000/040 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1993, a400030, a4000, 0, a400030, amiga, a4000_state, pal, "Commodore", "Amiga 4000/030 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1993, a400030n, a4000, 0, a400030n, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000/030 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1993, cd32, 0, 0, cd32, cd32, cd32_state, pal, "Commodore", "Amiga CD32 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1993, cd32n, cd32, 0, cd32n, cd32, cd32_state, ntsc, "Commodore", "Amiga CD32 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1994, a4000t, 0, 0, a4000t, amiga, a4000_state, pal, "Commodore", "Amiga 4000T (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1994, a4000tn, a4000t, 0, a4000tn, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000T (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/ampro.c b/src/mame/drivers/ampro.c new file mode 100644 index 00000000000..3cd31d47e29 --- /dev/null +++ b/src/mame/drivers/ampro.c @@ -0,0 +1,202 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Ampro Little Z80 Board + +2013-09-02 Skeleton driver. + +Chips: Z80A @4MHz, Z80CTC, Z80DART, WD1770/2, NCR5380. Crystal: 16 MHz + +This is a complete CP/M single-board computer that could be mounted +on top of a standard 13cm floppy drive. You needed to supply your own +power supply and serial terminal. + +The later versions included a SCSI chip (NCR5380) enabling the use +of a hard drive of up to 88MB. + +ToDo: +- (maybe) add scsi interface +- Add printer + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/wd_fdc.h" + + +class ampro_state : public driver_device +{ +public: + ampro_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_dart(*this, "z80dart") + , m_ctc (*this, "z80ctc") + , m_fdc (*this, "fdc") + , m_floppy0(*this, "fdc:0") + { } + + DECLARE_DRIVER_INIT(ampro); + DECLARE_MACHINE_RESET(ampro); + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE8_MEMBER(port00_w); + DECLARE_READ8_MEMBER(io_r); + DECLARE_WRITE8_MEMBER(io_w); +private: + required_device m_maincpu; + required_device m_dart; + required_device m_ctc; + required_device m_fdc; + required_device m_floppy0; +}; + +/* +d0..d3 Drive select 0-3 (we only emulate 1 drive) +d4 Side select 0=side0 +d5 /DDEN +d6 Banking 0=rom +d7 FDC master clock 0=8MHz 1=16MHz (for 20cm disks, not emulated) +*/ +WRITE8_MEMBER( ampro_state::port00_w ) +{ + membank("bankr0")->set_entry(BIT(data, 6)); + m_fdc->dden_w(BIT(data, 5)); + floppy_image_device *floppy = NULL; + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + m_fdc->set_floppy(floppy); + if (floppy) + floppy->ss_w(BIT(data, 4)); +} + +READ8_MEMBER( ampro_state::io_r ) +{ + if (offset < 0x40) + return m_ctc->read(space, offset>>4); + else + return m_dart->ba_cd_r(space, offset>>2); +} + +WRITE8_MEMBER( ampro_state::io_w ) +{ + if (offset < 0x40) + m_ctc->write(space, offset>>4, data); + else + m_dart->ba_cd_w(space, offset>>2, data); +} + +static ADDRESS_MAP_START(ampro_mem, AS_PROGRAM, 8, ampro_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x1000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ampro_io, AS_IO, 8, ampro_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(port00_w) // system + //AM_RANGE(0x01, 0x01) AM_WRITE(port01_w) // printer data + //AM_RANGE(0x02, 0x03) AM_WRITE(port02_w) // printer strobe + //AM_RANGE(0x20, 0x27) AM_READWRITE() // scsi chip + //AM_RANGE(0x28, 0x28) AM_WRITE(port28_w) // scsi control + //AM_RANGE(0x29, 0x29) AM_READ(port29_r) // ID port + AM_RANGE(0x40, 0x8f) AM_READWRITE(io_r,io_w) + AM_RANGE(0xc0, 0xc3) AM_DEVWRITE("fdc", wd1772_t, write) + AM_RANGE(0xc4, 0xc7) AM_DEVREAD("fdc", wd1772_t, read) +ADDRESS_MAP_END + +static const z80_daisy_config daisy_chain_intf[] = +{ + { "z80ctc" }, + { "z80dart" }, + { NULL } +}; + +// Baud rate generator. All inputs are 2MHz. +TIMER_DEVICE_CALLBACK_MEMBER( ampro_state::ctc_tick ) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); + m_ctc->trg1(1); + m_ctc->trg1(0); +} + +WRITE_LINE_MEMBER( ampro_state::ctc_z0_w ) +{ + m_dart->rxca_w(state); + m_dart->txca_w(state); +} + +static SLOT_INTERFACE_START( ampro_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +/* Input ports */ +static INPUT_PORTS_START( ampro ) +INPUT_PORTS_END + +MACHINE_RESET_MEMBER( ampro_state, ampro ) +{ + membank("bankr0")->set_entry(0); // point at rom + membank("bankw0")->set_entry(0); // always write to ram +} + +DRIVER_INIT_MEMBER( ampro_state, ampro ) +{ + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(1, &main[0x0000]); + membank("bankr0")->configure_entry(0, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); +} + +static MACHINE_CONFIG_START( ampro, ampro_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(ampro_mem) + MCFG_CPU_IO_MAP(ampro_io) + MCFG_CPU_CONFIG(daisy_chain_intf) + MCFG_MACHINE_RESET_OVERRIDE(ampro_state, ampro) + + /* Devices */ + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(ampro_state, ctc_z0_w)) // Z80DART Ch A, SIO Ch A + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w)) // SIO Ch B + + MCFG_Z80DART_ADD("z80dart", XTAL_16MHz / 4, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80dart", z80dart_device, rxa_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", ampro_state, ctc_tick, attotime::from_hz(XTAL_16MHz / 8)) + MCFG_WD1772_ADD("fdc", XTAL_16MHz / 2) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ampro_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_SOFTWARE_LIST_ADD("flop_list", "ampro") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ampro ) + ROM_REGION( 0x11000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "mntr", "Monitor") + ROMX_LOAD( "mntr", 0x10000, 0x1000, CRC(d59d0909) SHA1(936410f414b1e71445253840eea0045545e4ff0b), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "boot", "Boot") + ROMX_LOAD( "boot", 0x10000, 0x1000, CRC(b3524046) SHA1(5466f7d28c1a04cfbf328095cb35ad1525e91f44), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "scsi", "SCSI Boot") + ROMX_LOAD( "scsi", 0x10000, 0x1000, CRC(8eb20e5d) SHA1(0ab1ff65cf6d3c1a713a8ac5c1ee4c662ac3da0c), ROM_BIOS(3)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, ampro, 0, 0, ampro, ampro, ampro_state, ampro, "Ampro", "Little Z80 Board", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/amstr_pc.c b/src/mame/drivers/amstr_pc.c new file mode 100644 index 00000000000..8ba877cd182 --- /dev/null +++ b/src/mame/drivers/amstr_pc.c @@ -0,0 +1,659 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + drivers/amstr_pc.c + + Driver file for Amstrad PC1512 and related machines. + + PC-XT memory map + + 00000-9FFFF RAM + A0000-AFFFF NOP or videoram EGA/VGA + B0000-B7FFF videoram MDA, page #0 + B8000-BFFFF videoram CGA and/or MDA page #1, T1T mapped RAM + C0000-C7FFF NOP or ROM EGA/VGA + C8000-C9FFF ROM XT HDC #1 + CA000-CBFFF ROM XT HDC #2 + D0000-EFFFF NOP or 'adapter RAM' + F0000-FDFFF NOP or ROM Basic + other Extensions + FE000-FFFFF ROM + +Amstrad PC1640 +============== + +More information can be found at http://www.seasip.info/AmstradXT/1640tech/index.html + +***************************************************************************/ + +#include "emu.h" +#include "cpu/nec/nec.h" +#include "cpu/i86/i86.h" + +#include "machine/mc146818.h" +#include "includes/genpc.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" + +#include "machine/pckeybrd.h" +#include "machine/pc_lpt.h" + +class amstrad_pc_state : public driver_device +{ +public: + amstrad_pc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_mb(*this, "mb"), + m_keyboard(*this, "pc_keyboard"), + m_lpt1(*this, "lpt_1"), + m_lpt2(*this, "lpt_2") + { m_mouse.x =0; m_mouse.y=0;} + + required_device m_maincpu; + required_device m_mb; + required_device m_keyboard; + required_device m_lpt1; + required_device m_lpt2; + + DECLARE_READ8_MEMBER( pc1640_port60_r ); + DECLARE_WRITE8_MEMBER( pc1640_port60_w ); + + DECLARE_READ8_MEMBER( pc1640_mouse_x_r ); + DECLARE_READ8_MEMBER( pc1640_mouse_y_r ); + DECLARE_WRITE8_MEMBER( pc1640_mouse_x_w ); + DECLARE_WRITE8_MEMBER( pc1640_mouse_y_w ); + + DECLARE_READ8_MEMBER( pc200_port378_r ); + DECLARE_READ8_MEMBER( pc200_port278_r ); + DECLARE_READ8_MEMBER( pc1640_port378_r ); + DECLARE_READ8_MEMBER( pc1640_port3d0_r ); + DECLARE_READ8_MEMBER( pc1640_port4278_r ); + DECLARE_READ8_MEMBER( pc1640_port278_r ); + + DECLARE_DRIVER_INIT(pc1640); + + struct { + UINT8 x,y; //byte clipping needed + } m_mouse; + + // 64 system status register? + UINT8 m_port60; + UINT8 m_port61; + UINT8 m_port62; + UINT8 m_port65; + + int m_dipstate; +}; + +static ADDRESS_MAP_START( ppc512_map, AS_PROGRAM, 16, amstrad_pc_state ) + AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") + AM_RANGE(0x80000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ppc640_map, AS_PROGRAM, 16, amstrad_pc_state ) + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ppc512_io, AS_IO, 16, amstrad_pc_state ) + AM_RANGE(0x0060, 0x0065) AM_READWRITE8(pc1640_port60_r, pc1640_port60_w, 0xffff) + AM_RANGE(0x0070, 0x0071) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffff) + AM_RANGE(0x0078, 0x0079) AM_READWRITE8(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff) + AM_RANGE(0x007a, 0x007b) AM_READWRITE8(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff) + AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) + AM_RANGE(0x0278, 0x027b) AM_READ8(pc200_port278_r, 0xffff) AM_DEVWRITE8("lpt_2", pc_lpt_device, write, 0x00ff) + AM_RANGE(0x0378, 0x037b) AM_READ8(pc200_port378_r, 0xffff) AM_DEVWRITE8("lpt_1", pc_lpt_device, write, 0x00ff) + AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0x00ff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pc200_io, AS_IO, 16, amstrad_pc_state ) + AM_RANGE(0x0060, 0x0065) AM_READWRITE8(pc1640_port60_r, pc1640_port60_w, 0xffff) + AM_RANGE(0x0078, 0x0079) AM_READWRITE8(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff) + AM_RANGE(0x007a, 0x007b) AM_READWRITE8(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff) + AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) + AM_RANGE(0x0278, 0x027b) AM_READ8(pc200_port278_r, 0xffff) AM_DEVWRITE8("lpt_2", pc_lpt_device, write, 0x00ff) + AM_RANGE(0x0378, 0x037b) AM_READ8(pc200_port378_r, 0xffff) AM_DEVWRITE8("lpt_1", pc_lpt_device, write, 0x00ff) + AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0x00ff) +ADDRESS_MAP_END + + +/* pc20 (v2) + fc078 + fc102 color/mono selection + fc166 + fc1b4 + fd841 (output something) + ff17c (output something, read monitor type inputs) + fc212 + fc26c + fc2df + fc3fe + fc0f4 + fc432 + fc49f + fc514 + fc566 + fc5db + fc622 in 3de + +port 0379 read +port 03de write/read + */ + +/* pc1512 (v1) + fc1b5 + fc1f1 + fc264 + fc310 + fc319 + fc385 + fc436 + fc459 + fc4cb + fc557 + fc591 + fc624 + fc768 + fc818 + fc87d display amstrad .. + fca17 keyboard check + fca69 + fd680 + fd7f9 + fca7b !keyboard interrupt routine for this check + */ + + +/* pc1640 (v3) + bios power up self test + important addresses + + fc0c9 + fc0f2 + fc12e + fc193 + fc20e + fc2c1 + fc2d4 + + + fc375 + fc3ba + fc3e1 + fc412 + fc43c + fc47d + fc48f + fc51f + fc5a2 + fc5dd mouse + + fc1c0 + fc5fa + the following when language selection not 0 (test for presence of 0x80000..0x9ffff ram) + fc60e + fc667 + fc678 + fc6e5 + fc72e + fc78f + fc7cb ; coprocessor related + fc834 + feda6 no problem with disk inserted + + fca2a + + cmos ram 28 0 amstrad pc1512 integrated cga + cmos ram 23 dipswitches? +*/ + +/* test sequence in bios + write 00 to 65 + write 30 to 61 + read 62 and (0x10) + write 34 to 61 + read 62 and (0x0f) + return or of the 2 62 reads + + allows set of the original ibm pc "dipswitches"!!!! + + 66 write gives reset? +*/ + +/* mouse x counter at 0x78 (read- writable) + mouse y counter at 0x7a (read- writable) + + mouse button 1,2 keys + joystick (4 directions, 2 buttons) keys + these get value from cmos ram + 74 15 00 enter + 70 17 00 forward del + 77 1b 00 joystick button 1 + 78 19 00 joystick button 2 + + + 79 00 4d right + 7a 00 4b left + 7b 00 50 down + 7c 00 48 up + + 7e 00 01 mouse button left + 7d 01 01 mouse button right +*/ + +DRIVER_INIT_MEMBER(amstrad_pc_state,pc1640) +{ + address_space &io_space = m_maincpu->space( AS_IO ); + + io_space.install_read_handler(0x278, 0x27b, read8_delegate(FUNC(amstrad_pc_state::pc1640_port278_r),this), 0xffff); + io_space.install_read_handler(0x4278, 0x427b, read8_delegate(FUNC(amstrad_pc_state::pc1640_port4278_r),this), 0xffff); +} + +WRITE8_MEMBER( amstrad_pc_state::pc1640_port60_w ) +{ + switch (offset) { + case 1: + m_port61=data; + if (data==0x30) m_port62=(m_port65&0x10)>>4; + else if (data==0x34) m_port62=m_port65&0xf; + m_mb->m_pit8253->write_gate2(BIT(data, 0)); + m_mb->pc_speaker_set_spkrdata( data & 0x02 ); + m_keyboard->enable(data&0x40); + if(data & 0x80) + m_mb->m_pic8259->ir1_w(0); + + break; + case 4: + if (data&0x80) { + m_port60=data^0x8d; + } else { + m_port60=data; + } + break; + case 5: + // stores the configuration data for port 62 configuration dipswitch emulation + m_port65=data; + break; + } + + logerror("pc1640 write %.2x %.2x\n",offset,data); +} + + +READ8_MEMBER( amstrad_pc_state::pc1640_port60_r ) +{ + int data=0; + switch (offset) { + case 0: + if (m_port61&0x80) + data=m_port60; + else + data = m_keyboard->read(space, 0); + break; + + case 1: + data = m_port61; + break; + + case 2: + data = m_port62; + if (m_mb->m_pit_out2) + data |= 0x20; + break; + } + return data; +} + +READ8_MEMBER( amstrad_pc_state::pc200_port378_r ) +{ + UINT8 data = m_lpt1->read(space, offset); + + if (offset == 1) + data = (data & ~7) | (ioport("DSW0")->read() & 7); + if (offset == 2) + data = (data & ~0xe0) | (ioport("DSW0")->read() & 0xc0); + + return data; +} + +READ8_MEMBER( amstrad_pc_state::pc200_port278_r ) +{ + UINT8 data = m_lpt2->read(space, offset); + + if (offset == 1) + data = (data & ~7) | (ioport("DSW0")->read() & 7); + if (offset == 2) + data = (data & ~0xe0) | (ioport("DSW0")->read() & 0xc0); + + return data; +} + + +READ8_MEMBER( amstrad_pc_state::pc1640_port378_r ) +{ + UINT8 data = m_lpt1->read(space, offset); + + if (offset == 1) + data=(data & ~7) | (ioport("DSW0")->read() & 7); + if (offset == 2) + { + switch (m_dipstate) + { + case 0: + data = (data&~0xe0) | (ioport("DSW0")->read() & 0xe0); + break; + case 1: + data = (data&~0xe0) | ((ioport("DSW0")->read() & 0xe000)>>8); + break; + case 2: + data = (data&~0xe0) | ((ioport("DSW0")->read() & 0xe00)>>4); + break; + + } + } + return data; +} + +READ8_MEMBER( amstrad_pc_state::pc1640_port3d0_r ) +{ + if (offset==0xa) m_dipstate=0; + return space.read_byte(0x3d0+offset); +} + +READ8_MEMBER( amstrad_pc_state::pc1640_port4278_r ) +{ + if (offset==2) m_dipstate=1; + // read parallelport + return 0; +} + +READ8_MEMBER( amstrad_pc_state::pc1640_port278_r ) +{ + if ((offset==2)||(offset==0)) m_dipstate=2; + // read parallelport + return 0; +} + +READ8_MEMBER( amstrad_pc_state::pc1640_mouse_x_r ) +{ + return m_mouse.x - ioport("pc_mouse_x")->read(); +} + +READ8_MEMBER( amstrad_pc_state::pc1640_mouse_y_r ) +{ + return m_mouse.y - ioport("pc_mouse_y")->read(); +} + +WRITE8_MEMBER( amstrad_pc_state::pc1640_mouse_x_w ) +{ + m_mouse.x = data + ioport("pc_mouse_x")->read(); +} + +WRITE8_MEMBER( amstrad_pc_state::pc1640_mouse_y_w ) +{ + m_mouse.y = data + ioport("pc_mouse_y")->read(); +} + +static INPUT_PORTS_START( pc200 ) + PORT_START("DSW0") /* IN1 */ + PORT_DIPNAME( 0x07, 0x07, "Name/Language") + PORT_DIPSETTING( 0x00, "English/less checks" ) + PORT_DIPSETTING( 0x01, DEF_STR( Italian ) ) //prego attendere + PORT_DIPSETTING( 0x02, "V.g. v\xC3\xA4nta" ) + PORT_DIPSETTING( 0x03, "Vent et cjeblik" ) // seldom c + PORT_DIPSETTING( 0x04, DEF_STR( Spanish ) ) //Por favor + PORT_DIPSETTING( 0x05, DEF_STR( French ) ) //patientez + PORT_DIPSETTING( 0x06, DEF_STR( German ) ) // bitte warten + PORT_DIPSETTING( 0x07, DEF_STR( English ) ) // please wait + PORT_DIPNAME( 0x08, 0x00, "37a 0x40") + PORT_DIPSETTING( 0x00, "0x00" ) + PORT_DIPSETTING( 0x08, "0x08" ) +/* 2008-05 FP: This Dip Switch overlaps the next one. +Since pc200 is anyway NOT_WORKING, I comment out this one */ +/* PORT_DIPNAME( 0x10, 0x00, "37a 0x80") + PORT_DIPSETTING( 0x00, "0x00" ) + PORT_DIPSETTING( 0x10, "0x10" ) */ + PORT_DIPNAME( 0x30, 0x00, "Integrated Graphics Adapter") + PORT_DIPSETTING( 0x00, "CGA 1" ) + PORT_DIPSETTING( 0x10, "CGA 2" ) + PORT_DIPSETTING( 0x20, "external" ) + PORT_DIPSETTING( 0x30, "MDA" ) + PORT_DIPNAME( 0xc0, 0x80, "Startup Mode") + PORT_DIPSETTING( 0x00, "external Color 80 Columns" ) + PORT_DIPSETTING( 0x40, "Color 40 Columns" ) + PORT_DIPSETTING( 0x80, "Color 80 Columns" ) + PORT_DIPSETTING( 0xc0, DEF_STR( Mono ) ) + + PORT_START("DSW1") /* IN2 */ + PORT_BIT ( 0x80, 0x80, IPT_UNUSED ) // com 1 on motherboard + PORT_DIPNAME( 0x40, 0x40, "COM2: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x20, 0x00, "COM3: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x10, 0x00, "COM4: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_BIT ( 0x04, 0x04, IPT_UNUSED ) // lpt 1 on motherboard + PORT_DIPNAME( 0x02, 0x00, "LPT3: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x01, 0x00, "Game port enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) + + PORT_START("DSW2") /* IN3 */ + PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) + PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ + PORT_BIT( 0x01, 0x01, IPT_UNUSED ) + + PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ +INPUT_PORTS_END + +// static const gfx_layout pc200_charlayout = +// { + // 8, 16, /* 8 x 16 characters */ + // 2048, /* 2048 characters */ + // 1, /* 1 bits per pixel */ + // { 0 }, /* no bitplanes */ + // /* x offsets */ + // { 0, 1, 2, 3, 4, 5, 6, 7 }, + // /* y offsets */ + // { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + // 8*16 /* every char takes 16 bytes */ +// }; + +// static GFXDECODE_START( pc200 ) + // GFXDECODE_ENTRY( "gfx1", 0x0000, pc200_charlayout, 3, 1 ) +// GFXDECODE_END + +// has it's own mouse +static MACHINE_CONFIG_FRAGMENT( cfg_com ) + MCFG_DEVICE_MODIFY("serport0") + MCFG_SLOT_DEFAULT_OPTION(NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pc200, amstrad_pc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 8000000) + MCFG_CPU_PROGRAM_MAP(ppc640_map) + MCFG_CPU_IO_MAP(pc200_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") + + MCFG_ISA8_SLOT_ADD("mb:isa", "aga", pc_isa8_cards, "aga_pc200", true) + MCFG_ISA8_SLOT_ADD("mb:isa", "fdc", pc_isa8_cards, "fdc_xt", true) + MCFG_ISA8_SLOT_ADD("mb:isa", "com", pc_isa8_cards, "com", true) + MCFG_SLOT_OPTION_MACHINE_CONFIG("com", cfg_com) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) + + /* printer */ + MCFG_DEVICE_ADD("lpt_0", PC_LPT, 0) + MCFG_PC_LPT_IRQ_HANDLER(DEVWRITELINE("mb:pic8259", pic8259_device, ir7_w)) + + MCFG_DEVICE_ADD("lpt_1", PC_LPT, 0) + MCFG_PC_LPT_IRQ_HANDLER(DEVWRITELINE("mb:pic8259", pic8259_device, ir7_w)) + + MCFG_DEVICE_ADD("lpt_2", PC_LPT, 0) + MCFG_PC_LPT_IRQ_HANDLER(DEVWRITELINE("mb:pic8259", pic8259_device, ir5_w)) + + MCFG_PC_JOY_ADD("pc_joy") + + MCFG_PC_KEYB_ADD("pc_keyboard", DEVWRITELINE("mb:pic8259", pic8259_device, ir1_w)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ppc512, pc200 ) + MCFG_DEVICE_REMOVE("maincpu") + + MCFG_CPU_ADD("maincpu", V30, 8000000) + MCFG_CPU_PROGRAM_MAP(ppc512_map) + MCFG_CPU_IO_MAP(ppc512_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_DEVICE_REMOVE("isa1") + MCFG_DEVICE_REMOVE("isa2") + + MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ppc640, ppc512 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(ppc640_map) +MACHINE_CONFIG_END + +/* +Sinclair PC200 ROMs (from a v1.2 PC200): + +40109.ic159 -- Character set, the same as in the 1.5 PC200. Label: + + AMSTRAD + 40109 + 8827 B + +40184.ic132 -- BIOS v1.2. +40185.ic129 Labels are: + + AMSTRAD AMSTRAD + 40184 40185 + V1.2:5EA8 V1.2:A058 +*/ +ROM_START( pc200 ) +// ROM_REGION(0x100000,"maincpu", 0) + ROM_REGION16_LE(0x100000,"maincpu", 0) + // special bios at 0xe0000 !? + ROM_SYSTEM_BIOS(0, "v15", "v1.5") + ROMX_LOAD("40185-2.ic129", 0xfc001, 0x2000, CRC(41302eb8) SHA1(8b4b2afea543b96b45d6a30365281decc15f2932), ROM_SKIP(1) | ROM_BIOS(1)) // v2 + ROMX_LOAD("40184-2.ic132", 0xfc000, 0x2000, CRC(71b84616) SHA1(4135102a491b25fc659d70b957e07649f3eacf24), ROM_SKIP(1) | ROM_BIOS(1)) // v2 + ROM_SYSTEM_BIOS(1, "v13", "v1.3") + ROMX_LOAD("40185v13.ic129", 0xfc001, 0x2000, CRC(f082f08e) SHA1(b332db419033588a7380bfecdf46104974347341), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("40184v13.ic132", 0xfc000, 0x2000, CRC(5daf6068) SHA1(93a2ccfb0e29c8f2c98f06c64bb0ea0b3acafb13), ROM_SKIP(1) | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v12", "v1.2") + ROMX_LOAD("40185.ic129", 0xfc001, 0x2000, CRC(c2b4eeac) SHA1(f11015fadf0c16d86ce2c5047be3e6a4782044f7), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD("40184.ic132", 0xfc000, 0x2000, CRC(b22704a6) SHA1(dadd573db6cd34f339f2f0ae55b07537924c024a), ROM_SKIP(1) | ROM_BIOS(3)) + // also mapped to f0000, f4000, f8000 + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "40112.ic801", 0x000, 0x800, CRC(842a954c) SHA1(93ca6badf20e0215025fe109959eddead8c52f38) ) +ROM_END + + +ROM_START( pc20 ) +// ROM_REGION(0x100000,"maincpu", 0) + ROM_REGION16_LE(0x100000,"maincpu", 0) + + // special bios at 0xe0000 !? + // This is probably referring to a check for the Amstrad RP5-2 diagnostic + // card, which can be plugged into an Amstrad XT for troubleshooting purposes. + // - John Elliott + ROM_LOAD16_BYTE("pc20v2.0", 0xfc001, 0x2000, CRC(41302eb8) SHA1(8b4b2afea543b96b45d6a30365281decc15f2932)) // v2 + ROM_LOAD16_BYTE("pc20v2.1", 0xfc000, 0x2000, CRC(71b84616) SHA1(4135102a491b25fc659d70b957e07649f3eacf24)) // v2 + // also mapped to f0000, f4000, f8000 +ROM_END + + +ROM_START( ppc512 ) +// ROM_REGION(0x100000,"maincpu", 0) + ROM_REGION16_LE(0x100000,"maincpu", 0) + // special bios at 0xe0000 !? + ROM_LOAD16_BYTE("40107.v1", 0xfc000, 0x2000, CRC(4e37e769) SHA1(88be3d3375ec3b0a7041dbcea225b197e50d4bfe)) // v1.9 + ROM_LOAD16_BYTE("40108.v1", 0xfc001, 0x2000, CRC(4f0302d9) SHA1(e4d69ca98c3b98f3705a2902b16746360043f039)) // v1.9 + // also mapped to f0000, f4000, f8000 + ROM_REGION( 0x800, "keyboard", 0 ) // PPC512 / PPC640 / PC200 102-key keyboard + ROM_LOAD( "40112.ic801", 0x000, 0x800, CRC(842a954c) SHA1(93ca6badf20e0215025fe109959eddead8c52f38) ) +ROM_END + + +ROM_START( ppc640 ) +// ROM_REGION(0x100000,"maincpu", 0) + ROM_REGION16_LE(0x100000,"maincpu", 0) + // special bios at 0xe0000 !? + ROM_LOAD16_BYTE("40107.v2", 0xfc000, 0x2000, CRC(0785b63e) SHA1(4dbde6b9e9500298bb6241a8daefd85927f1ad28)) // v2.1 + ROM_LOAD16_BYTE("40108.v2", 0xfc001, 0x2000, CRC(5351cf8c) SHA1(b4dbf11b39378ab4afd2107d3fe54a99fffdedeb)) // v2.1 + // also mapped to f0000, f4000, f8000 + ROM_REGION(0x2000,"subcpu", 0) + ROM_LOAD("40135.ic192", 0x00000, 0x2000, CRC(75d99199) SHA1(a76d39fda3d5140e1fb9ce70fcddbdfb8f891dc6)) + + ROM_REGION( 0x800, "keyboard", 0 ) // PPC512 / PPC640 / PC200 102-key keyboard + ROM_LOAD( "40112.ic801", 0x000, 0x800, CRC(842a954c) SHA1(93ca6badf20e0215025fe109959eddead8c52f38) ) +ROM_END + + +ROM_START( pc2086 ) + ROM_REGION16_LE( 0x100000, "maincpu", 0 ) + ROM_LOAD( "40186.ic171", 0xc0000, 0x8000, CRC(959f00ba) SHA1(5df1efe4203cd076292a7713bd7ebd1196dca577) ) + ROM_LOAD16_BYTE( "40179.ic129", 0xfc000, 0x2000, CRC(003605e4) SHA1(b882e97ee81b9ba0e7d969c63da3f2052f23b4b9) ) + ROM_LOAD16_BYTE( "40180.ic132", 0xfc001, 0x2000, CRC(28ee5e58) SHA1(93e045609466fcec74e2bb72578bb7405281cf7b) ) + + ROM_REGION( 0x800, "keyboard", 0 ) // PC2086 / PC3086 102-key keyboard + ROM_LOAD( "40178.ic801", 0x000, 0x800, CRC(f72f1c2e) SHA1(34897e78b3d10f96b36d81778e97c4a9a1b8618b) ) +ROM_END + + +ROM_START( pc3086 ) + ROM_REGION16_LE( 0x100000, "maincpu", 0 ) + ROM_LOAD( "c000.bin", 0xc0000, 0x8000, CRC(5a6c38e9) SHA1(382d2028e0dc5515a68843829563ce29018edb08) ) + ROM_LOAD( "c800.bin", 0xc8000, 0x2000, CRC(3329c6d5) SHA1(982e852278185d69acde47a4f3942bc09ed76777) ) + ROM_LOAD( "fc00.bin", 0xfc000, 0x4000, CRC(b5630753) SHA1(98c344831cc4dc59ebb39bbb1961964a8d39fe20) ) + + ROM_REGION( 0x800, "keyboard", 0 ) // PC2086 / PC3086 102-key keyboard + ROM_LOAD( "40178.ic801", 0x000, 0x800, CRC(f72f1c2e) SHA1(34897e78b3d10f96b36d81778e97c4a9a1b8618b) ) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1987, ppc512, ibm5150, 0, ppc512, pc200, driver_device, 0, "Amstrad plc", "Amstrad PPC512", MACHINE_NOT_WORKING) +COMP( 1987, ppc640, ibm5150, 0, ppc640, pc200, driver_device, 0, "Amstrad plc", "Amstrad PPC640", MACHINE_NOT_WORKING) +COMP( 1988, pc20, ibm5150, 0, pc200, pc200, driver_device, 0, "Amstrad plc", "Amstrad PC20" , MACHINE_NOT_WORKING) +COMP( 1988, pc200, ibm5150, 0, pc200, pc200, driver_device, 0, "Sinclair Research Ltd", "PC200 Professional Series", MACHINE_NOT_WORKING) +COMP( 1988, pc2086, ibm5150, 0, pc200, pc200, driver_device, 0, "Amstrad plc", "Amstrad PC2086", MACHINE_NOT_WORKING ) +COMP( 1990, pc3086, ibm5150, 0, pc200, pc200, driver_device, 0, "Amstrad plc", "Amstrad PC3086", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/amstrad.c b/src/mame/drivers/amstrad.c new file mode 100644 index 00000000000..8e88e135151 --- /dev/null +++ b/src/mame/drivers/amstrad.c @@ -0,0 +1,1287 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Barry Rodewald +/****************************************************************************** + + amstrad.c + system driver + + Amstrad Hardware: + - 8255 connected to AY-3-8912 sound generator, + keyboard, cassette, printer, crtc vsync output, + and some PCB links + - 6845 (either HD6845S, UM6845R or M6845) crtc graphics display + controller + - UPD765 floppy disc controller (CPC664,CPC6128) + - Z80 CPU running at 4 MHz (slowed by wait states on memory + access) + - custom ASIC "Gate Array" controlling rom paging, ram paging, + current display mode and colour palette + + Kevin Thacker [MESS driver] + + May-June 2004 - Yoann Courtois (aka Papagayo/ex GMC/ex PARADOX) - rewriting some code with hardware documentation from http://www.cepece.info/amstrad/ + + June 2006 - Very preliminary CPC+ support. CPR cart image handling, secondary ROM register, ASIC unlock detection + Supported: + 12-bit palette, + 12-bit hardware sprites (largely works from what I've seen, some games have display issues), + Programmable Raster Interrupt (seems to work), + Split screen registers, + Soft scroll registers (only byte-by-byre horizontally for now), + Analogue controls (may well be completely wrong, I have no idea on how these should work), + Vectored interrupts for Z80 interrupt mode 2 (used by Pang), + DMA sound channels (may still be some issues, noticeable in Navy Seals and Copter 271) + 04/07/06: Added interrupt vector support for IM 2. + Added soft scroll register implementation. Vertical adjustments are a bit shaky. + 05/07/06: Fixed hardware sprite offsets + 14/07/06: Added basic analogue control support. + 04/08/06: Fixed PRI and Split screen scanline offsets (based on code in Arnold ;)) + Implemented DMA sound channels + 06/08/06: Fixed CRTC palette if the ASIC was re-locked after already being unlocked and used. + This fixes Klax, which is now playable. + 08/08/06: Fixed up vertical soft scroll, now we just need to get a finer detail on horizontal soft scroll + (Only works on a byte level for now) + Fixed DMA pause function when the prescaler is set to 0. + + Tested with the Arnold 5 Diagnostic Cartridge. Mostly works fine, but the soft scroll test is + noticeably wrong. + + Known issues with some games (as at 12/01/08): + Robocop 2: playable, but sprites should be cut off outside the playing area (partial updates should be able to fix this). + Navy Seals: Playable, but sound effects cut out at times (probably DMA related). + Dick Tracy: Sprite visibility issues + Switchblade: has some slowdown when numerous enemies are on screen (normal?) + Epyx World of Sports: doesn't start at all. + Tennis Cup II: controls don't seem to work. + Fire and Forget II: playable, but the top half of the screen flickers + Crazy Cars II: playable, with slight shaking of horizon + No Exit: Display is wrong, but usable, uses demo-like techniques. + + + January 2008 - added preliminary Aleste 520EX support + The Aleste 520EX is a Russian clone of the CPC6128, that expands on existing video modes, and can run MSX-DOS. + It also adds an MC146818 RTC/NVRAM, an Intel 8253 timer, and the "Magic Sound" board, a 4-channel DMA-based + sample player. Also includes a software emulation of the MSX2 VDP, used in the ports of MSX games. + + Known issues: + - The RTC doesn't always update in setup. It expects bit 4 of register C (Update End Interrupt) to be high. + - Title screens appear then disappear quickly (probably because the 8253 hasn't been plugged in yet). + - Some video modes display wrong (still needs some work here). + - Vampire Killer crashes after collecting a certain key part way through stage 1. + - Magic Sound isn't emulated. + + + January 2009 - changed drivers to use the mc6845 device implementation + To get rid of duplicated code the drivers have been changed to use the new mc6845 device + implementation. As a result the (runtime) selection of CRTC type has been removed. + + July 2011 - added basic expansion port interface, with support for both the Amstrad SSA-1 and DK'Tronics + speech synthesisers. + + +Some bugs left : +---------------- + - CRTC all type support (0,1,2,3,4) ? + - Gate Array and CRTC aren't synchronised. (The Gate Array can change the color every microseconds?) So the multi-rasters in one line aren't supported (see yao demo p007's part)! + - Implement full Asic for CPC+ emulation. Soft scroll is rather dodgy. + - The KC Compact should not reuse the gate array functionality. Instead z8536 support should be added. (bug #42) + + ******************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "includes/amstrad.h" + +/* Components */ +#include "machine/i8255.h" /* for 8255 ppi */ +#include "cpu/z80/z80.h" /* for cycle tables */ +#include "video/mc6845.h" /* CRTC */ +#include "machine/upd765.h" /* for floppy disc controller */ +#include "sound/ay8910.h" +#include "sound/wave.h" +#include "machine/mc146818.h" /* Aleste RTC */ +#include "bus/centronics/ctronics.h" + +/* Devices */ +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "formats/tzx_cas.h" +#include "formats/msx_dsk.h" + +#include "machine/ram.h" + +#define MANUFACTURER_NAME 0x07 +#define TV_REFRESH_RATE 0x10 + +#define SYSTEM_CPC 0 +#define SYSTEM_PLUS 1 +#define SYSTEM_GX4000 2 + + +/* Memory is banked in 16k blocks. However, the multiface +pages the memory in 8k blocks! The ROM can +be paged into bank 0 and bank 3. */ +static ADDRESS_MAP_START(amstrad_mem, AS_PROGRAM, 8, amstrad_state ) + AM_RANGE(0x00000, 0x01fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank9") + AM_RANGE(0x02000, 0x03fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank10") + AM_RANGE(0x04000, 0x05fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank11") + AM_RANGE(0x06000, 0x07fff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank12") + AM_RANGE(0x08000, 0x09fff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank13") + AM_RANGE(0x0a000, 0x0bfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank14") + AM_RANGE(0x0c000, 0x0dfff) AM_READ_BANK("bank7") AM_WRITE_BANK("bank15") + AM_RANGE(0x0e000, 0x0ffff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank16") +ADDRESS_MAP_END + +/* I've handled the I/O ports in this way, because the ports +are not fully decoded by the CPC h/w. Doing it this way means +I can decode it myself and a lot of software should work */ +static ADDRESS_MAP_START(amstrad_io, AS_IO, 8, amstrad_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(amstrad_cpc_io_r, amstrad_cpc_io_w ) +ADDRESS_MAP_END + + +/************************************* + * + * Input ports + * + *************************************/ + +static INPUT_PORTS_START( amstrad_keyboard ) + PORT_START("kbrow.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_START("kbrow.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + + PORT_START("kbrow.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('\\') PORT_CHAR('`') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("kbrow.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 \xC2\xA3") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR(0xa3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xC2\xA6") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('|') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("kbrow.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("kbrow.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + + PORT_START("kbrow.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("kbrow.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("kbrow.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_CHAR('~') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("kbrow.9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) +/* The bit for the third button is officially undocumented: Amstrad joysticks actually + use only two buttons. The only device that reads this bit is the AMX mouse, which uses + dedicated hardware to connect to the joystick port. +*/ +// PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(8) + +/* Second joystick port need to be defined: the second joystick is daisy-chained on the back of the first one + Joystick 2 is mapped to keyboard line 6. */ + +/* The CPC supports at least two different brands of lightpens, probably connected to the expansion port */ + +INPUT_PORTS_END + + +/* Steph 2000-10-27 I remapped the 'Machine Name' Dip Switches (easier to understand) */ +INPUT_CHANGED_MEMBER(amstrad_state::cpc_monitor_changed) +{ + if ( (m_io_green_display->read()) & 0x01 ) + { + PALETTE_INIT_NAME( amstrad_cpc_green )(m_palette); + } + else + { + PALETTE_INIT_NAME( amstrad_cpc )(m_palette); + } +} + + +static INPUT_PORTS_START( crtc_links ) + +/* the following are solder links on the circuit board. The links are open or closed when the + * PCB is made, and are set depending on which country the Amstrad system was to go to + * (reference: http://amstrad.cpc.free.fr/article.php?sid=26) + +lk1 lk2 lk3 Manufacturer Name (CPC and CPC+ only): + +0 0 0 Isp +0 0 1 Triumph (UK?) +0 1 0 Saisho (UK: Saisho is Dixons brand name for their electronic goods) +0 1 1 Solavox +1 0 0 Awa (Australia) +1 0 1 Schneider (Germany) +1 1 0 Orion (Japan?) +1 1 1 Amstrad (UK) + +lk4 Frequency +0 60 Hz +1 50 Hz +*/ + PORT_START("solder_links") + PORT_CONFNAME(0x07, 0x07, "Manufacturer Name") + PORT_CONFSETTING(0x00, "Isp") + PORT_CONFSETTING(0x01, "Triumph") + PORT_CONFSETTING(0x02, "Saisho") + PORT_CONFSETTING(0x03, "Solavox") + PORT_CONFSETTING(0x04, "Awa") + PORT_CONFSETTING(0x05, "Schneider") + PORT_CONFSETTING(0x06, "Orion") + PORT_CONFSETTING(0x07, "Amstrad") + PORT_CONFNAME(0x10, 0x10, "TV Refresh Rate") + PORT_CONFSETTING(0x00, "60 Hz") + PORT_CONFSETTING(0x10, "50 Hz") + +/* Part number Manufacturer Type number + UM6845 UMC 0 + HD6845S Hitachi 0 + UM6845R UMC 1 + MC6845 Motorola 2 + AMS40489 Amstrad 3 + Pre-ASIC??? Amstrad? 4 In the "cost-down" CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often referred to as the "Pre-ASIC" because it preceded the CPC+ ASIC +As far as I know, the KC compact used HD6845S only. +*/ +// PORT_START("crtc") +// PORT_CONFNAME( 0xFF, M6845_PERSONALITY_UM6845R, "CRTC Type") +// PORT_CONFSETTING(M6845_PERSONALITY_UM6845, "Type 0 - UM6845") +// PORT_CONFSETTING(M6845_PERSONALITY_HD6845S, "Type 0 - HD6845S") +// PORT_CONFSETTING(M6845_PERSONALITY_UM6845R, "Type 1 - UM6845R") +// PORT_CONFSETTING(M6845_PERSONALITY_GENUINE, "Type 2 - MC6845") +// PORT_CONFSETTING(M6845_PERSONALITY_AMS40489, "Type 3 - AMS40489") +// PORT_CONFSETTING(M6845_PERSONALITY_PREASIC, "Type 4 - Pre-ASIC") + + PORT_START("green_display") + PORT_CONFNAME( 0x01, 0x00, "Monitor" ) PORT_CHANGED_MEMBER(DEVICE_SELF, amstrad_state, cpc_monitor_changed, 0 ) + PORT_CONFSETTING(0x00, "CTM640 Colour Monitor" ) + PORT_CONFSETTING(0x01, "GT64 Green Monitor" ) + +INPUT_PORTS_END + +static INPUT_PORTS_START( amx_mouse ) + PORT_START("mouse_input1") + PORT_BIT(0xff , 0, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) + + PORT_START("mouse_input2") + PORT_BIT(0xff , 0, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) + + PORT_START("mouse_input3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON5) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON6) PORT_NAME("Middle mouse button") PORT_CODE(MOUSECODE_BUTTON3) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) + + PORT_START("controller_type") + PORT_CONFNAME( 0x03, 0x00, "Joystick port device" ) + PORT_CONFSETTING(0x00, "2-button Joystick" ) + PORT_CONFSETTING(0x01, "AMX mouse interface" ) + PORT_CONFSETTING(0x02, "Nothing" ) + +INPUT_PORTS_END + +static INPUT_PORTS_START( cpc464 ) + PORT_INCLUDE(amstrad_keyboard) + PORT_INCLUDE(crtc_links) + PORT_INCLUDE(amx_mouse) +INPUT_PORTS_END + + +static INPUT_PORTS_START( cpc664 ) + PORT_INCLUDE(amstrad_keyboard) + + PORT_MODIFY("kbrow.0") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + + PORT_MODIFY("kbrow.1") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + + PORT_MODIFY("kbrow.2") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + + PORT_INCLUDE(crtc_links) + PORT_INCLUDE(amx_mouse) +INPUT_PORTS_END + + +static INPUT_PORTS_START( cpc6128 ) + PORT_INCLUDE(amstrad_keyboard) + + PORT_MODIFY("kbrow.0") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_MODIFY("kbrow.1") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + + PORT_MODIFY("kbrow.2") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('\\') PORT_CHAR('`') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_INCLUDE(crtc_links) + PORT_INCLUDE(amx_mouse) +INPUT_PORTS_END + + +/* This CPC6128 sold in France has the AZERTY layout. Reference: http://amstrad.cpc.free.fr/amstrad/cpc6128.htm */ +static INPUT_PORTS_START( cpc6128f ) + PORT_INCLUDE(amstrad_keyboard) + + PORT_MODIFY("kbrow.0") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_MODIFY("kbrow.1") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + + PORT_MODIFY("kbrow.2") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('$') PORT_CHAR('@') PORT_CHAR('\\') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_MODIFY("kbrow.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR('[') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ \xC2\xA6") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xB9 %") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xF9) PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') + + PORT_MODIFY("kbrow.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA0 0") PORT_CODE(KEYCODE_0) PORT_CHAR(0xE0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA7 9") PORT_CODE(KEYCODE_9) PORT_CHAR(0xE7) PORT_CHAR('9') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR(',') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(';') PORT_CHAR('.') + + PORT_MODIFY("kbrow.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('!') PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA9 7") PORT_CODE(KEYCODE_7) PORT_CHAR(0xE8) PORT_CHAR('7') + + PORT_MODIFY("kbrow.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR(']') PORT_CHAR('6') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') + + PORT_MODIFY("kbrow.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('\"') PORT_CHAR('3') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_MODIFY("kbrow.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('&') PORT_CHAR('1') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA9 2 ~") PORT_CODE(KEYCODE_2) PORT_CHAR(0xE9) PORT_CHAR('2') PORT_CHAR('~') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('w') PORT_CHAR('W') + + PORT_INCLUDE(crtc_links) + PORT_INCLUDE(amx_mouse) +INPUT_PORTS_END + +static INPUT_PORTS_START( cpc6128s ) + PORT_INCLUDE(cpc6128) + + PORT_MODIFY("kbrow.2") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x9C") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00DC) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x89") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00E9) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('/') PORT_CHAR('?') + + PORT_MODIFY("kbrow.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x85") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00C5) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x84") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x96") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + + PORT_MODIFY("kbrow.4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') +INPUT_PORTS_END + +/* + * The BIOS of the KC Compact would be able to recognize the keypresses + * generated by F5-F9. Unfortunately these keys are not present on the + * keyboard! Reference: http://www.cepece.info/amstrad/docs/kcc/kcc01.jpg + * + */ +static INPUT_PORTS_START( kccomp ) + PORT_INCLUDE(amstrad_keyboard) + + PORT_MODIFY("kbrow.0") + PORT_BIT(0x08, 0x08, IPT_UNUSED) + PORT_BIT(0x10, 0x10, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_MODIFY("kbrow.1") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x04, 0x04, IPT_UNUSED) + PORT_BIT(0x08, 0x08, IPT_UNUSED) + PORT_BIT(0x10, 0x10, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + + PORT_MODIFY("kbrow.2") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('\\') PORT_CHAR('`') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_INCLUDE(crtc_links) + PORT_INCLUDE(amx_mouse) +INPUT_PORTS_END + + +static INPUT_PORTS_START( plus ) + PORT_INCLUDE(cpc664) + + /* The CPC+ and GX4000 adds support for analogue controllers. + Up to two joysticks or four paddles can be used, although the ASIC supports twice that. + Read at &6808-&680f in ASIC RAM + I am unsure if these are even close to correct. + + UPDATE: the analog port supports (probably with an Y-cable) up to two analog joysticks + with two buttons each or four paddles with one button each. The CPC+/GX4000 have also an + AUX port which supports a lightgun/lightpen with two buttons. + Since all these devices have their dedicated connector, two digital joystick, two analog joysticks + and one lightgun can be connected at the same moment. + + The connectors' description for both CPCs and CPC+'s can be found at http://www.hardwarebook.info/Category:Computer */ + + PORT_START("analog.0") + PORT_BIT(0x3f , 0, IPT_AD_STICK_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(1) + + PORT_START("analog.1") + PORT_BIT(0x3f , 0, IPT_AD_STICK_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(1) + + PORT_START("analog.2") + PORT_BIT(0x3f , 0, IPT_AD_STICK_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(2) + + PORT_START("analog.3") + PORT_BIT(0x3f , 0, IPT_AD_STICK_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(2) + +// Not used, but are here for completeness + PORT_START("analog.4") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(3) + + PORT_START("analog.5") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(3) + + PORT_START("analog.6") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(4) + + PORT_START("analog.7") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(4) +INPUT_PORTS_END + + +static INPUT_PORTS_START( gx4000 ) + + // The GX4000 is a console, so no keyboard access other than the joysticks. + PORT_START("kbrow.0") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.1") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.2") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.3") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.4") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.5") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.6") // Joystick 2 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.7") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.8") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("kbrow.9") // Joystick 1 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE(crtc_links) // included to keep the driver happy + + PORT_START("analog.0") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(1) + + PORT_START("analog.1") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(1) + + PORT_START("analog.2") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(2) + + PORT_START("analog.3") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(2) + +// Not used, but are here for completeness + PORT_START("analog.4") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(3) + + PORT_START("analog.5") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(3) + + PORT_START("analog.6") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(4) + + PORT_START("analog.7") + PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_PLAYER(4) +INPUT_PORTS_END + + +static INPUT_PORTS_START( aleste ) + PORT_INCLUDE(amstrad_keyboard) + + PORT_MODIFY( "kbrow.9" ) + /* Documentation marks this input as "R/L", it's purpose is unknown - I can't even find it on the keyboard */ + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R L") PORT_CODE(KEYCODE_PGUP) + + PORT_START( "kbrow.10" ) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4 F9") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F10") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HELP") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Funny looking Russian symbol") PORT_CODE(KEYCODE_END) + + PORT_INCLUDE(crtc_links) + PORT_INCLUDE(amx_mouse) +INPUT_PORTS_END + + +#if 0 + +static const gfx_layout asic_sprite_layout = +{ + 16,16, + 16, + 4, + { 4,5,6,7 }, + { 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120 }, + { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 }, + 16*16*8 +}; + +static GFXDECODE_START( asic_sprite ) + GFXDECODE_ENTRY( "user1", 0, asic_sprite_layout, 32, 1 ) +GFXDECODE_END +#endif + + + +/************************************* + * + * Machine drivers + * + *************************************/ + +/* actual clock to CPU is 4 MHz, but it is slowed by memory +accessess. A HALT is used for every memory access by the CPU. +This stretches the timing for opcodes, and gives an effective +speed of 3.8 MHz */ + +/* Info about structures below: + + The Amstrad has a CPU running at 4 MHz, slowed with wait states. + I have measured 19968 NOP instructions per frame, which gives, + 50.08 fps as the tv refresh rate. + + There are 312 lines on a PAL screen, giving 64us per line. + + There is only 50us visible per line, and 35*8 lines visible on the screen. + + This is the reason why the displayed area is not the same as the visible area. + */ + + +static SLOT_INTERFACE_START( amstrad_floppies ) + SLOT_INTERFACE( "3ssdd", FLOPPY_3_SSDD ) + SLOT_INTERFACE( "35ssdd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( aleste_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( amstrad_state::aleste_floppy_formats ) + FLOPPY_MSX_FORMAT +FLOPPY_FORMATS_END + +static MACHINE_CONFIG_FRAGMENT( cpcplus_cartslot ) + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "gx4000_cart") + MCFG_GENERIC_EXTENSIONS("bin,cpr") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(amstrad_state, amstrad_plus_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "gx4000") +MACHINE_CONFIG_END + +SLOT_INTERFACE_START(cpc464_exp_cards) + SLOT_INTERFACE("ddi1", CPC_DDI1) + SLOT_INTERFACE("ssa1", CPC_SSA1) + SLOT_INTERFACE("dkspeech", CPC_DKSPEECH) + SLOT_INTERFACE("rom", CPC_ROM) + SLOT_INTERFACE("multiface2", CPC_MFACE2) + SLOT_INTERFACE("pds", CPC_PDS) + SLOT_INTERFACE("rs232", CPC_RS232) + SLOT_INTERFACE("amsrs232", CPC_RS232_AMS) + SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) + SLOT_INTERFACE("amdrum", CPC_AMDRUM) + SLOT_INTERFACE("playcity", CPC_PLAYCITY) + SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) + SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) + SLOT_INTERFACE("hd20", CPC_HD20) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START(cpc_exp_cards) + SLOT_INTERFACE("ssa1", CPC_SSA1) + SLOT_INTERFACE("dkspeech", CPC_DKSPEECH) + SLOT_INTERFACE("rom", CPC_ROM) + SLOT_INTERFACE("multiface2", CPC_MFACE2) + SLOT_INTERFACE("pds", CPC_PDS) + SLOT_INTERFACE("rs232", CPC_RS232) + SLOT_INTERFACE("amsrs232", CPC_RS232_AMS) + SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) + SLOT_INTERFACE("amdrum", CPC_AMDRUM) + SLOT_INTERFACE("playcity", CPC_PLAYCITY) + SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) + SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) + SLOT_INTERFACE("hd20", CPC_HD20) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START(cpcplus_exp_cards) + SLOT_INTERFACE("ssa1", CPC_SSA1) + SLOT_INTERFACE("dkspeech", CPC_DKSPEECH) + SLOT_INTERFACE("rom", CPC_ROM) + SLOT_INTERFACE("pds", CPC_PDS) + SLOT_INTERFACE("rs232", CPC_RS232) + SLOT_INTERFACE("amsrs232", CPC_RS232_AMS) + SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) + SLOT_INTERFACE("amdrum", CPC_AMDRUM) + SLOT_INTERFACE("playcity", CPC_PLAYCITY) + SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) + SLOT_INTERFACE("hd20", CPC_HD20) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START(aleste_exp_cards) + SLOT_INTERFACE("ssa1", CPC_SSA1) + SLOT_INTERFACE("dkspeech", CPC_DKSPEECH) + SLOT_INTERFACE("rom", CPC_ROM) + SLOT_INTERFACE("multiface2", CPC_MFACE2) + SLOT_INTERFACE("pds", CPC_PDS) + SLOT_INTERFACE("rs232", CPC_RS232) + SLOT_INTERFACE("amsrs232", CPC_RS232_AMS) + SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) + SLOT_INTERFACE("amdrum", CPC_AMDRUM) + SLOT_INTERFACE("playcity", CPC_PLAYCITY) + SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) + SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) + SLOT_INTERFACE("hd20", CPC_HD20) + SLOT_INTERFACE("magicsound", AL_MAGICSOUND) +SLOT_INTERFACE_END + +SLOT_INTERFACE_START(amstrad_centronics_devices) + SLOT_INTERFACE("pl80", COMX_PL80) + SLOT_INTERFACE("ex800", EPSON_EX800) + SLOT_INTERFACE("lx800", EPSON_LX800) + SLOT_INTERFACE("lx810l", EPSON_LX810L) + SLOT_INTERFACE("ap2000", EPSON_AP2000) + SLOT_INTERFACE("printer", CENTRONICS_PRINTER) + SLOT_INTERFACE("digiblst", CENTRONICS_DIGIBLASTER) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( amstrad_base, amstrad_state ) + /* Machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(amstrad_mem) + MCFG_CPU_IO_MAP(amstrad_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(amstrad_state,amstrad_cpu_acknowledge_int) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(amstrad_state, amstrad ) + MCFG_MACHINE_RESET_OVERRIDE(amstrad_state, amstrad ) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(amstrad_state, amstrad_ppi_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(amstrad_state, amstrad_ppi_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(amstrad_state, amstrad_ppi_portb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(amstrad_state, amstrad_ppi_portc_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( XTAL_16MHz, 1024, 32, 32 + 640 + 64, 312, 56 + 15, 200 + 15 ) + MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad) + MCFG_SCREEN_VBLANK_DRIVER(amstrad_state, screen_eof_amstrad) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 32) + MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_cpc) + + MCFG_MC6845_ADD("mc6845", MC6845, NULL, XTAL_16MHz / 16) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(16) + MCFG_MC6845_OUT_DE_CB(WRITELINE(amstrad_state, amstrad_de_changed)) + MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(amstrad_state, amstrad_hsync_changed)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(amstrad_state, amstrad_vsync_changed)) + MCFG_MC6845_OUT_CUR_CB(DEVWRITELINE("exp", cpc_expansion_slot_device, cursor_w)) + + MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay", AY8912, XTAL_16MHz / 16) + MCFG_AY8910_PORT_A_READ_CB(READ8(amstrad_state, amstrad_psg_porta_read)) /* portA read */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", amstrad_centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amstrad_state, write_centronics_busy)) + + /* snapshot */ + MCFG_SNAPSHOT_ADD("snapshot", amstrad_state, amstrad, "sna", 0) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(cdt_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("cpc_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","cpc_cass") + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( cpc464, amstrad_base ) + MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(cpc464_exp_cards, NULL, false) + MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS + MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("128K,320K,576K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( cpc664, amstrad_base ) + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", amstrad_floppies, "3ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", amstrad_floppies, "35ssdd", floppy_image_device::default_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","cpc_flop") + + MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(cpc_exp_cards, NULL, false) + MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS + MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("128K,320K,576K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( cpc6128, amstrad_base ) + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", amstrad_floppies, "3ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", amstrad_floppies, "35ssdd", floppy_image_device::default_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","cpc_flop") + + MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(cpc_exp_cards, NULL, false) + MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS + MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("320K,576K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( kccomp, cpc6128 ) + MCFG_MACHINE_START_OVERRIDE(amstrad_state,kccomp) + MCFG_MACHINE_RESET_OVERRIDE(amstrad_state,kccomp) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(amstrad_state,kccomp) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( cpcplus, amstrad_state ) + /* Machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_40MHz / 10) + MCFG_CPU_PROGRAM_MAP(amstrad_mem) + MCFG_CPU_IO_MAP(amstrad_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(amstrad_state,amstrad_cpu_acknowledge_int) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(amstrad_state, plus ) + MCFG_MACHINE_RESET_OVERRIDE(amstrad_state, plus ) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(amstrad_state, amstrad_ppi_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(amstrad_state, amstrad_ppi_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(amstrad_state, amstrad_ppi_portb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(amstrad_state, amstrad_ppi_portc_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( ( XTAL_40MHz * 2 ) / 5, 1024, 32, 32 + 640 + 64, 312, 56 + 15, 200 + 15 ) + MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad) + MCFG_SCREEN_VBLANK_DRIVER(amstrad_state, screen_eof_amstrad) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 4096) + MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_plus) + + MCFG_MC6845_ADD("mc6845", MC6845, NULL, XTAL_40MHz / 40) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(16) + MCFG_MC6845_OUT_DE_CB(WRITELINE(amstrad_state, amstrad_plus_de_changed)) + MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(amstrad_state, amstrad_plus_hsync_changed)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(amstrad_state, amstrad_plus_vsync_changed)) + + MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay", AY8912, XTAL_40MHz / 40) + MCFG_AY8910_PORT_A_READ_CB(READ8(amstrad_state, amstrad_psg_porta_read)) /* portA read */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amstrad_state, write_centronics_busy)) + + /* snapshot */ + MCFG_SNAPSHOT_ADD("snapshot", amstrad_state, amstrad, "sna", 0) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(cdt_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("cpc_cass") + + MCFG_UPD765A_ADD("upd765", true, true) + + MCFG_FRAGMENT_ADD(cpcplus_cartslot) + + MCFG_FLOPPY_DRIVE_ADD("upd765:0", amstrad_floppies, "3ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", amstrad_floppies, "35ssdd", floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(cpcplus_exp_cards, NULL, false) + MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS + MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("64K,320K,576K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( gx4000, amstrad_state ) + /* Machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_40MHz / 10) + MCFG_CPU_PROGRAM_MAP(amstrad_mem) + MCFG_CPU_IO_MAP(amstrad_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(amstrad_state,amstrad_cpu_acknowledge_int) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(amstrad_state, gx4000 ) + MCFG_MACHINE_RESET_OVERRIDE(amstrad_state, gx4000 ) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(amstrad_state, amstrad_ppi_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(amstrad_state, amstrad_ppi_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(amstrad_state, amstrad_ppi_portb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(amstrad_state, amstrad_ppi_portc_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( ( XTAL_40MHz * 2 ) / 5, 1024, 32, 32 + 640 + 64, 312, 56 + 15, 200 + 15 ) + MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad) + MCFG_SCREEN_VBLANK_DRIVER(amstrad_state, screen_eof_amstrad) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 4096) + MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_plus) + + MCFG_MC6845_ADD("mc6845", MC6845, NULL, XTAL_40MHz / 40) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(16) + MCFG_MC6845_OUT_DE_CB(WRITELINE(amstrad_state, amstrad_plus_de_changed)) + MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(amstrad_state, amstrad_plus_hsync_changed)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(amstrad_state, amstrad_plus_vsync_changed)) + + MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay", AY8912, XTAL_40MHz / 40) + MCFG_AY8910_PORT_A_READ_CB(READ8(amstrad_state, amstrad_psg_porta_read)) /* portA read */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_FRAGMENT_ADD(cpcplus_cartslot) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( aleste, cpc6128 ) + MCFG_MACHINE_START_OVERRIDE(amstrad_state,aleste) + MCFG_MACHINE_RESET_OVERRIDE(amstrad_state,aleste) + + MCFG_SOUND_REPLACE("ay", AY8912, XTAL_16MHz / 16) + MCFG_AY8910_PORT_A_READ_CB(READ8(amstrad_state, amstrad_psg_porta_read)) /* portA read */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(32+64) + MCFG_PALETTE_INIT_OWNER(amstrad_state,aleste) + MCFG_MC146818_ADD( "rtc", XTAL_4_194304Mhz ) + + MCFG_DEVICE_REMOVE("upd765") + MCFG_I8272A_ADD("upd765", true) + + MCFG_DEVICE_REMOVE("exp") + MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(aleste_exp_cards, NULL, false) + MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS + MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) + + MCFG_FLOPPY_DRIVE_ADD("upd765:0", aleste_floppies, "35dd", amstrad_state::aleste_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", aleste_floppies, "35dd", amstrad_state::aleste_floppy_formats) + + MCFG_DEVICE_REMOVE("flop_list") + MCFG_SOFTWARE_LIST_ADD("flop_list", "aleste") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cpc_list", "cpc_flop") + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") +MACHINE_CONFIG_END + + + +/************************************* + * + * ROM definitions + * + *************************************/ + +/* cpc6128.rom contains OS in first 16k, BASIC in second 16k */ +/* cpcados.rom contains Amstrad DOS */ + +/* I am loading the roms outside of the Z80 memory area, because they +are banked. */ +ROM_START( cpc6128 ) + /* this defines the total memory size - 64k ram, 16k OS, 16k BASIC, 16k DOS */ + ROM_REGION(0x020000, "maincpu", 0) + /* load the os to offset 0x01000 from memory base */ + ROM_LOAD("cpc6128.rom", 0x10000, 0x8000, CRC(9e827fe1) SHA1(5977adbad3f7c1e0e082cd02fe76a700d9860c30)) + ROM_LOAD("cpcados.rom", 0x18000, 0x4000, CRC(1fe22ecd) SHA1(39102c8e9cb55fcc0b9b62098780ed4a3cb6a4bb)) +ROM_END + + +ROM_START( cpc6128f ) + /* this defines the total memory size (128kb))- 64k ram, 16k OS, 16k BASIC, 16k DOS +16k*/ + ROM_REGION(0x020000, "maincpu", 0) + + /* load the os to offset 0x01000 from memory base */ + ROM_LOAD("cpc6128f.rom", 0x10000, 0x8000, CRC(1574923b) SHA1(200d59076dfef36db061d6d7d21d80021cab1237)) + ROM_LOAD("cpcados.rom", 0x18000, 0x4000, CRC(1fe22ecd) SHA1(39102c8e9cb55fcc0b9b62098780ed4a3cb6a4bb)) +ROM_END + + +ROM_START( cpc6128s ) + /* this defines the total memory size (128kb))- 64k ram, 16k OS, 16k BASIC, 16k DOS +16k*/ + ROM_REGION(0x020000, "maincpu", 0) + + /* load the os to offset 0x01000 from memory base */ + ROM_LOAD("cpc6128s.rom", 0x10000, 0x8000, CRC(588b5540) SHA1(6765a91a42fed68a807325bf62a728e5ac5d622f)) + ROM_LOAD("cpcados.rom", 0x18000, 0x4000, CRC(1fe22ecd) SHA1(39102c8e9cb55fcc0b9b62098780ed4a3cb6a4bb)) +ROM_END + + +ROM_START( cpc464 ) + /* this defines the total memory size - 64k ram, 16k OS, 16k BASIC, 16k DOS */ + ROM_REGION(0x01c000, "maincpu", 0) + /* load the os to offset 0x01000 from memory base */ + ROM_LOAD("cpc464.rom", 0x10000, 0x8000, CRC(40852f25) SHA1(56d39c463da60968d93e58b4ba0e675829412a20)) +ROM_END + + +ROM_START( cpc664 ) + /* this defines the total memory size - 64k ram, 16k OS, 16k BASIC, 16k DOS */ + ROM_REGION(0x01c000, "maincpu", 0) + /* load the os to offset 0x01000 from memory base */ + ROM_LOAD("cpc664.rom", 0x10000, 0x8000, CRC(9ab5a036) SHA1(073a7665527b5bd8a148747a3947dbd3328682c8)) + ROM_LOAD("cpcados.rom", 0x18000, 0x4000, CRC(1fe22ecd) SHA1(39102c8e9cb55fcc0b9b62098780ed4a3cb6a4bb)) +ROM_END + + +ROM_START( kccomp ) + ROM_REGION(0x01c000, "maincpu", 0) + ROM_LOAD("kccos.rom", 0x10000, 0x4000, CRC(7f9ab3f7) SHA1(f828045e98e767f737fd93df0af03917f936ad08)) + ROM_LOAD("kccbas.rom", 0x14000, 0x4000, CRC(ca6af63d) SHA1(d7d03755099d0aff501fa5fffc9c0b14c0825448)) + ROM_RELOAD(0x18000, 0x4000) // has no AMSDOS ROM, so just reload BASIC in it's place (BASIC appears in any unused ROM slot) + + ROM_REGION(0x018000+0x0800, "proms", 0) + ROM_LOAD("farben.rom", 0x18000, 0x0800, CRC(a50fa3cf) SHA1(2f229ac9f62d56973139dad9992c208421bc0f51)) + + /* fake region - required by graphics decode structure */ + /*ROM_REGION(0x0c00, "gfx1") */ +ROM_END + + +/* this system must have a cartridge installed to run */ +ROM_START(cpc6128p) + ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x04000, "user1", ROMREGION_ERASEFF) +ROM_END + +#define rom_cpc464p rom_cpc6128p +#define rom_gx4000 rom_cpc6128p + + +ROM_START( al520ex ) + ROM_REGION(0x80000, "maincpu", 0) + ROM_LOAD("al512.bin", 0x10000, 0x10000, CRC(e8c2a9a1) SHA1(ad5827582cb19eaaae1b76e67df62d96da6ad96b)) + + ROM_REGION(0x20, "user2", 0) + ROM_LOAD("af.bin", 0x00, 0x20, CRC(c81fb524) SHA1(17738d0603915a67ec1fddc4cbf7d6b98cdeb8f6)) + + ROM_REGION(0x100, "user3", 0) // RAM bank mappings + ROM_LOAD("mapper.bin", 0x00, 0x100, CRC(0daebd80) SHA1(8633073cba752c38c5dc912ff9f6a3c89357539b)) + + ROM_REGION(0x800, "user4", 0) // Colour data + ROM_LOAD("rfcoldat.bin", 0x00, 0x800, CRC(c6ace0e6) SHA1(2f4c51fcfaacb8deed68f6ae9388b870bc962cef)) + + ROM_REGION(0x800, "user5", 0) // Keyboard / Video + ROM_LOAD("rfvdkey.bin", 0x00, 0x800, CRC(cf2aa4b0) SHA1(20f37da3bc3c377b1c47ae4d9ab8d150faae19a0)) + + ROM_REGION(0x100, "user6", 0) + ROM_LOAD("romram.bin", 0x00, 0x100, CRC(b3ea95d7) SHA1(1252390737a7ead4ecec988c873181798fbc291b)) +ROM_END + +/************************************* + * + * Driver definitions + * + *************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, cpc464, 0, 0, cpc464, cpc464, driver_device, 0, "Amstrad plc", "Amstrad CPC464", 0 ) +COMP( 1985, cpc664, cpc464, 0, cpc664, cpc664, driver_device, 0, "Amstrad plc", "Amstrad CPC664", 0 ) +COMP( 1985, cpc6128, cpc464, 0, cpc6128, cpc6128, driver_device, 0, "Amstrad plc", "Amstrad CPC6128", 0 ) +COMP( 1985, cpc6128f, cpc464, 0, cpc6128, cpc6128f, driver_device, 0, "Amstrad plc", "Amstrad CPC6128 (France, AZERTY Keyboard)", 0 ) +COMP( 1985, cpc6128s, cpc464, 0, cpc6128, cpc6128s, driver_device, 0, "Amstrad plc", "Amstrad CPC6128 (Sweden/Finland)", 0 ) +COMP( 1990, cpc464p, 0, 0, cpcplus, plus, driver_device, 0, "Amstrad plc", "Amstrad CPC464+", 0 ) +COMP( 1990, cpc6128p, 0, 0, cpcplus, plus, driver_device, 0, "Amstrad plc", "Amstrad CPC6128+", 0 ) +CONS( 1990, gx4000, 0, 0, gx4000, gx4000, driver_device, 0, "Amstrad plc", "Amstrad GX4000", 0 ) +COMP( 1989, kccomp, cpc464, 0, kccomp, kccomp, driver_device, 0, "VEB Mikroelektronik", "KC Compact", 0 ) +COMP( 1993, al520ex, cpc464, 0, aleste, aleste, driver_device, 0, "Patisonic", "Aleste 520EX", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/amust.c b/src/mame/drivers/amust.c new file mode 100644 index 00000000000..a49a0db462b --- /dev/null +++ b/src/mame/drivers/amust.c @@ -0,0 +1,467 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Amust Compak - also known as Amust Executive 816. + +2014-03-21 Skeleton driver. [Robbbert] + +An unusual-looking CP/M computer. +There are no manuals or schematics known to exist. +The entire driver is guesswork. +The board has LH0080 (Z80A), 2x 8251, 2x 8255, 8253, uPD765A and a HD46505SP-2. +The videoram is a 6116 RAM. There is a piezo beeper. There are 3 crystals, +X1 = 4.9152 (serial chips?), X2 = 16 (CPU), X3 = 14.31818 MHz (Video?). +There are numerous jumpers, all of which perform unknown functions. + +The keyboard is a plug-in unit, same idea as Kaypro and Zorba. It has these +chips: INS8035N-6, F74145, 74LS373N, SN75451BP, 2716 rom with label KBD-3. +Crystal: 3.579545 MHz + +The main rom is identical between the 2 halves, except that the initial +crtc parameters are slightly different. I've chosen to ignore the first +half. (perhaps 50/60 Hz selectable by jumper?) + +Preliminary I/O ports +--------------------- +00-01 uart 1 +02-03 uart 2 +04-07 ppi 1 +08-0b ppi 2 +0d-0f crtc +10-11 fdc +14-17 pit + +PIT. +Having the PIT on ports 14-17 seems to make sense. It sets counters 1 and 2 +to mode 3, binary, initial count = 0x80. Counter 0 not used? + + +Floppy Parameters: +------------------ +Double Density +Two Side +80 track +1024 byte sectors +5 sectors/track +800k capacity +128 directory entries +2k block size +Skew 1,3,5,2,4 + + +Stuff that doesn't make sense: +------------------------------ +1. To access the screen, it waits for IRQ presumably from sync pulse. It sets INT +mode 0 which means a page-zero jump, but doesn't write anything to the zero-page ram. +That's why I added a RETI at 0008 and set the vector to there. A bit later it writes +a jump at 0000. Then it sets the interrupting device to the fdc (not sure how yet), +then proceeds to overwrite all of page-zero with the disk contents. This of course +kills the jump it just wrote, and my RETI. So it runs into the weeds at high speed. +What should happen is after loading the boot sector succesfully it will jump to 0000, +otherwise it will write BOOT NG to the screen and you're in the monitor. The bios +contains no RETI instructions. +2. At F824 it copies itself to the same address which is presumably shadow ram. But +it never switches to it. The ram is physically in the machine. + + +Monitor Commands: +----------------- +B = Boot from floppy +(YES! Most useless monitor ever) + + +ToDo: +- Everything +- Need software +- Keyboard controller needs to be emulated +- If booting straight to CP/M, the load message should be in the middle of the screen. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "machine/upd765.h" +#include "machine/keyboard.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "sound/beep.h" + + +class amust_state : public driver_device +{ +public: + enum + { + TIMER_BEEP_OFF + }; + + amust_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_beep(*this, "beeper") + , m_fdc (*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + { } + + DECLARE_DRIVER_INIT(amust); + DECLARE_MACHINE_RESET(amust); + DECLARE_READ8_MEMBER(port00_r); + DECLARE_READ8_MEMBER(port01_r); + DECLARE_READ8_MEMBER(port04_r); + DECLARE_WRITE8_MEMBER(port04_w); + DECLARE_READ8_MEMBER(port05_r); + DECLARE_READ8_MEMBER(port06_r); + DECLARE_WRITE8_MEMBER(port06_w); + DECLARE_READ8_MEMBER(port08_r); + DECLARE_WRITE8_MEMBER(port08_w); + DECLARE_READ8_MEMBER(port09_r); + DECLARE_READ8_MEMBER(port0a_r); + DECLARE_WRITE8_MEMBER(port0a_w); + DECLARE_WRITE8_MEMBER(port0d_w); + DECLARE_WRITE8_MEMBER(kbd_put); + INTERRUPT_GEN_MEMBER(irq_vs); + MC6845_UPDATE_ROW(crtc_update_row); + UINT8 *m_p_videoram; + const UINT8 *m_p_chargen; + required_device m_palette; +private: + UINT8 m_port04; + UINT8 m_port06; + UINT8 m_port08; + UINT8 m_port0a; + UINT8 m_term_data; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + required_device m_maincpu; + required_device m_beep; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; +}; + +void amust_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BEEP_OFF: + m_beep->set_state(0); + break; + default: + assert_always(FALSE, "Unknown id in amust_state::device_timer"); + } +} + +//WRITE8_MEMBER( amust_state::port00_w ) +//{ +// membank("bankr0")->set_entry(BIT(data, 6)); +// m_fdc->dden_w(BIT(data, 5)); +// floppy_image_device *floppy = NULL; +// if (BIT(data, 0)) floppy = m_floppy0->get_device(); +// m_fdc->set_floppy(floppy); +// if (floppy) +// floppy->ss_w(BIT(data, 4)); +//} + +static ADDRESS_MAP_START(amust_mem, AS_PROGRAM, 8, amust_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(amust_io, AS_IO, 8, amust_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + //AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) + //AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) + AM_RANGE(0x00, 0x00) AM_READ(port00_r) + AM_RANGE(0x01, 0x01) AM_READ(port01_r) + AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w) + AM_RANGE(0x03, 0x03) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi1", i8255_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi2", i8255_device, read, write) + AM_RANGE(0x0d, 0x0d) AM_READNOP AM_WRITE(port0d_w) + AM_RANGE(0x0e, 0x0e) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0x0f, 0x0f) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0x10, 0x11) AM_DEVICE("fdc", upd765a_device, map) + AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("pit", pit8253_device, read, write) +ADDRESS_MAP_END + +static SLOT_INTERFACE_START( amust_floppies ) + SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) + SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +/* Input ports */ +static INPUT_PORTS_START( amust ) +INPUT_PORTS_END + +READ8_MEMBER( amust_state::port00_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( amust_state::port01_r ) +{ + return 0xff; +} + +// bodgy +INTERRUPT_GEN_MEMBER( amust_state::irq_vs ) +{ + m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xcf); +} + +READ8_MEMBER( amust_state::port04_r ) +{ + return m_port04; +} + +WRITE8_MEMBER( amust_state::port04_w ) +{ + m_port04 = data; +} + +READ8_MEMBER( amust_state::port05_r ) +{ + return 0; +} + +READ8_MEMBER( amust_state::port06_r ) +{ + return m_port06; +} + +// BIT 5 low while writing to screen +WRITE8_MEMBER( amust_state::port06_w ) +{ + m_port06 = data; +} + +READ8_MEMBER( amust_state::port08_r ) +{ + return m_port08; +} + +// lower 8 bits of video address +WRITE8_MEMBER( amust_state::port08_w ) +{ + m_port08 = data; +} + +/* +d0 - something to do with type of disk +d1 - +d2 - +d3 - +d4 - H = go to monitor; L = boot from disk +d5 - status of disk-related; loops till NZ +d6 - +d7 - +*/ +READ8_MEMBER( amust_state::port09_r ) +{ + printf("%s\n",machine().describe_context()); + return 0xff; +} + +READ8_MEMBER( amust_state::port0a_r ) +{ + return m_port0a; +} + +/* Bits 7,6,5,3 something to do +with selecting which device causes interrupt? +50, 58 = video sync +70 disk +D0 ? +Bit 4 low = beeper. +Lower 3 bits = upper part of video address */ +WRITE8_MEMBER( amust_state::port0a_w ) +{ + m_port0a = data; + + if (!BIT(data, 4)) + { + m_beep->set_state(1); + timer_set(attotime::from_msec(150), TIMER_BEEP_OFF); + } +} + +WRITE8_MEMBER( amust_state::port0d_w ) +{ + UINT16 video_address = m_port08 | ((m_port0a & 7) << 8); + m_p_videoram[video_address] = data; +} + +WRITE8_MEMBER( amust_state::kbd_put ) +{ + m_term_data = data; +} + +/* F4 Character Displayer */ +static const gfx_layout amust_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( amust ) + GFXDECODE_ENTRY( "chargen", 0x0000, amust_charlayout, 0, 1 ) +GFXDECODE_END + +MC6845_UPDATE_ROW( amust_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,inv; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + inv = (x == cursor_x) ? 0xff : 0; + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + if (ra < 8) + gfx = m_p_chargen[(chr<<3) | ra] ^ inv; + else + gfx = inv; + + /* Display a scanline of a character (8 pixels) */ + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} + +MACHINE_RESET_MEMBER( amust_state, amust ) +{ + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("videoram")->base(); + membank("bankr0")->set_entry(0); // point at rom + membank("bankw0")->set_entry(0); // always write to ram + m_beep->set_frequency(800); + address_space &space = m_maincpu->space(AS_PROGRAM); + space.write_byte(8, 0xed); + space.write_byte(9, 0x4d); + m_port04 = 0; + m_port06 = 0; + m_port08 = 0; + m_port0a = 0; + m_maincpu->set_state_int(Z80_PC, 0xf800); +} + +DRIVER_INIT_MEMBER( amust_state, amust ) +{ + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(1, &main[0xf800]); + membank("bankr0")->configure_entry(0, &main[0x10800]); + membank("bankw0")->configure_entry(0, &main[0xf800]); +} + +static MACHINE_CONFIG_START( amust, amust_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(amust_mem) + MCFG_CPU_IO_MAP(amust_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", amust_state, irq_vs) + MCFG_MACHINE_RESET_OVERRIDE(amust_state, amust) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", amust) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_14_31818MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(amust_state, crtc_update_row) + + MCFG_DEVICE_ADD("keybd", GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(amust_state, kbd_put)) + MCFG_UPD765A_ADD("fdc", false, true) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", amust_floppies, "drive0", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", amust_floppies, "drive1", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + //MCFG_DEVICE_ADD("uart1", I8251, 0) + //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + //MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_DEVICE_ADD("uart2", I8251, 0) + //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + //MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + //MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + //MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_rxd)) + //MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_cts)) + //MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_dsr)) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + + MCFG_DEVICE_ADD("ppi1", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(amust_state, port04_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(amust_state, port04_w)) + MCFG_I8255_IN_PORTB_CB(READ8(amust_state, port05_r)) + MCFG_I8255_IN_PORTC_CB(READ8(amust_state, port06_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(amust_state, port06_w)) + + MCFG_DEVICE_ADD("ppi2", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(amust_state, port08_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(amust_state, port08_w)) + MCFG_I8255_IN_PORTB_CB(READ8(amust_state, port09_r)) + MCFG_I8255_IN_PORTC_CB(READ8(amust_state, port0a_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(amust_state, port0a_w)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( amust ) + ROM_REGION( 0x11000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mon_h.rom", 0x10000, 0x1000, CRC(10dceac6) SHA1(1ef80039063f7a6455563d59f1bcc23e09eca369) ) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "cg4.rom", 0x000, 0x800, CRC(52e7b9d8) SHA1(cc6d457634eb688ccef471f72bddf0424e64b045) ) + + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "kbd_3.rom", 0x000, 0x800, CRC(d9441b35) SHA1(ce250ab1e892a13fd75182703f259855388c6bf4) ) + + ROM_REGION( 0x800, "videoram", ROMREGION_ERASE00 ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, amust, 0, 0, amust, amust, amust_state, amust, "Amust", "Amust Executive 816", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/apc.c b/src/mame/drivers/apc.c new file mode 100644 index 00000000000..78a08b343da --- /dev/null +++ b/src/mame/drivers/apc.c @@ -0,0 +1,1000 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese +/*************************************************************************** + + Advanced Personal Computer (c) 1982 NEC + + preliminary driver by Angelo Salese + + TODO: + - video emulation (bitmap part) + - NMI seems valid, dumps a x86 stack to vram? + - What are exactly APU and MPU devices? They sounds scary ... + - DMA hook-ups + - serial ports + - parallel ports + - Extract info regarding Hard Disk functionality + - Various unknown ports + - What kind of external ROM actually maps at 0xa****? + - Jumper settings (comms settings and display select) + +============================================================================ + front ^ + | + card + ---- + 69PFCU 7220 PFCU1R 2764 + 69PTS 7220 + - + 69PFB2 8086/8087 DFBU2J PFBU2L 2732 + 69SNB RAM + +---------------------------------------------------------------------------- + i/o memory map (preliminary): + 0x00 - 0x1f DMA + 0x20 - 0x23 i8259 master + 0x28 - 0x2f i8259 slave (even), pit8253 (odd) + 0x30 - 0x37 serial i8251, even #1 / odd #2 + 0x38 - 0x3f DMA segments + 0x40 - 0x43 upd7220, even chr / odd bitmap + 0x48 - 0x4f keyboard + 0x50 - 0x53 upd765 + 0x58 rtc + 0x5a - 0x5e APU + 0x60 MPU (melody) + 0x61 - 0x67 (Mirror of pit8253?) + 0x68 - 0x6f parallel port + +---------------------------------------------------------------------------- +0xfe3c2: checks if the floppy has a valid string for booting (either "CP/M-86" + or "MS-DOS"), if not, branches with the successive jne. + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "audio/upd1771.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/am9517a.h" +#include "machine/upd765.h" +#include "machine/upd1990a.h" +#include "machine/nvram.h" +#include "video/upd7220.h" + +//#include "sound/ay8910.h" + +#define MAIN_CLOCK XTAL_5MHz + +class apc_state : public driver_device +{ +public: + apc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_hgdc1(*this, "upd7220_chr"), + m_hgdc2(*this, "upd7220_btm"), + m_rtc(*this, "upd1990a"), + m_i8259_m(*this, "pic8259_master"), + m_i8259_s(*this, "pic8259_slave"), + m_fdc(*this, "upd765"), + m_dmac(*this, "i8237"), + m_pit(*this, "pit8253"), + m_video_ram_1(*this, "video_ram_1"), + m_video_ram_2(*this, "video_ram_2"), + m_palette(*this, "palette") + { } + + // devices + required_device m_maincpu; + required_device m_hgdc1; + required_device m_hgdc2; + required_device m_rtc; + required_device m_i8259_m; + required_device m_i8259_s; + required_device m_fdc; + required_device m_dmac; + required_device m_pit; + UINT8 *m_char_rom; + UINT8 *m_aux_pcg; + + required_shared_ptr m_video_ram_1; + required_shared_ptr m_video_ram_2; + + required_device m_palette; + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + + DECLARE_READ8_MEMBER(apc_port_28_r); + DECLARE_WRITE8_MEMBER(apc_port_28_w); + DECLARE_READ8_MEMBER(apc_gdc_r); + DECLARE_WRITE8_MEMBER(apc_gdc_w); + DECLARE_READ8_MEMBER(apc_kbd_r); + DECLARE_WRITE8_MEMBER(apc_kbd_w); + DECLARE_WRITE8_MEMBER(apc_dma_segments_w); + DECLARE_READ8_MEMBER(apc_dma_r); + DECLARE_WRITE8_MEMBER(apc_dma_w); + DECLARE_WRITE8_MEMBER(apc_irq_ack_w); + DECLARE_READ8_MEMBER(apc_rtc_r); + DECLARE_WRITE8_MEMBER(apc_rtc_w); +// DECLARE_READ8_MEMBER(aux_pcg_r); +// DECLARE_WRITE8_MEMBER(aux_pcg_w); + + struct { + UINT8 status; //status + UINT8 data; //key data + UINT8 sig; //switch signal port + UINT8 sh; //shift switches + }m_keyb; + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE_LINE_MEMBER(apc_dma_hrq_changed); + DECLARE_WRITE_LINE_MEMBER(apc_tc_w); + DECLARE_WRITE_LINE_MEMBER(apc_dack0_w); + DECLARE_WRITE_LINE_MEMBER(apc_dack1_w); + DECLARE_WRITE_LINE_MEMBER(apc_dack2_w); + DECLARE_WRITE_LINE_MEMBER(apc_dack3_w); + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); + DECLARE_READ8_MEMBER(apc_dma_read_byte); + DECLARE_WRITE8_MEMBER(apc_dma_write_byte); + + DECLARE_DRIVER_INIT(apc); + + int m_dack; + UINT8 m_dma_offset[4]; + + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); + UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + inline void set_dma_channel(int channel, int state); +}; + +void apc_state::video_start() +{ + m_char_rom = memregion("gfx")->base(); + m_aux_pcg = memregion("aux_pcg")->base(); +} + +UINT32 apc_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) +{ + bitmap.fill(m_palette->black_pen(), cliprect); + + /* graphics */ + m_hgdc2->screen_update(screen, bitmap, cliprect); + m_hgdc1->screen_update(screen, bitmap, cliprect); + + return 0; +} + + +UPD7220_DISPLAY_PIXELS_MEMBER( apc_state::hgdc_display_pixels ) +{ + // ... +} + +UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int xi,yi,yi_trans; + int x; + UINT8 char_size; +// UINT8 interlace_on; + +// if(m_video_ff[DISPLAY_REG] == 0) //screen is off +// return; + +// interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */ + char_size = 19; + + for(x=0;x> 1] >> 8) & 0x00ff; + tile_sel = m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] & 0x00ff; + attr = (m_video_ram_1[((tile_addr*2 & 0x1fff) | 0x2000) >> 1] & 0x00ff); + + u_line = attr & 0x01; + o_line = attr & 0x02; + v_line = attr & 0x04; + blink = attr & 0x08; + reverse = attr & 0x10; +// secret= (attr & 1) ^ 1; + color = (attr & 0xe0) >> 5; + + for(yi=0;yivisible_area().contains(res_x, res_y)) + continue; + + /* + Addr bus: C BA98 7654 3210 + | |||| |\\\ \\\\- character number bits 0-6 + | |||| \--------- y' bit 0 + | |||\----------- y' bit 1 + | ||\------------ y' bit 2 + | |\------------- y' bit 3 + | \-------------- character number bit 7 + \---------------- y' bit 4 + + y to y' (assumed; this needs hardware tests since there could be one more 'blank' line between all char rows): + y = 0 1 2 3 ... 16 17 18 + y' = 18 0 1 2 ... 15 16 17 + + Data bus: 76543210 = pixels, in left->01234567->right order + */ + if(tile_sel == 0x89)// Aux character RAM select TODO: correct triggering? + { + if(yi & 0x10) + tile_data = 0; + else + tile_data = m_aux_pcg[(tile & 0xff)*0x20+yi*2]; + } + else + tile_data = m_char_rom[(tile & 0x7f)+((tile & 0x80)<<4)+((yi_trans & 0xf)*0x80)+((yi_trans & 0x10)<<8)]; + + if(reverse) { tile_data^=0xff; } + if(u_line && yi == lr-1) { tile_data = 0xff; } + if(o_line && yi == 0) { tile_data = 0xff; } + if(v_line) { tile_data|=1; } + if(blink && machine().first_screen()->frame_number() & 0x20) { tile_data = 0; } // TODO: rate & correct behaviour + + if(cursor_on && cursor_addr == tile_addr && machine().first_screen()->frame_number() & 0x10) + tile_data^=0xff; + + if(yi >= char_size) + pen = 0; + else + pen = (tile_data >> (xi) & 1) ? color : 0; + + if(pen) + bitmap.pix32(res_y, res_x) = palette[pen]; + } + } + } +} + +READ8_MEMBER(apc_state::apc_port_28_r) +{ + UINT8 res; + + if(offset & 1) + res = m_pit->read(space, (offset & 6) >> 1); + else + { + if(offset & 4) + { + printf("Read undefined port %02x\n",offset+0x28); + res = 0xff; + } + else + res = m_i8259_s->read(space, (offset & 2) >> 1); + } + + return res; +} + +WRITE8_MEMBER(apc_state::apc_port_28_w) +{ + if(offset & 1) + m_pit->write(space, (offset & 6) >> 1, data); + else + { + if(offset & 4) + printf("Write undefined port %02x\n",offset+0x28); + else + m_i8259_s->write(space, (offset & 2) >> 1, data); + } +} + + +READ8_MEMBER(apc_state::apc_gdc_r) +{ + UINT8 res; + + if(offset & 1) + res = m_hgdc2->read(space, (offset & 2) >> 1); // upd7220 bitmap port + else + res = m_hgdc1->read(space, (offset & 2) >> 1); // upd7220 character port + + return res; +} + +WRITE8_MEMBER(apc_state::apc_gdc_w) +{ + if(offset & 1) + m_hgdc2->write(space, (offset & 2) >> 1,data); // upd7220 bitmap port + else + m_hgdc1->write(space, (offset & 2) >> 1,data); // upd7220 character port +} + +READ8_MEMBER(apc_state::apc_kbd_r) +{ + UINT8 res = 0; + + switch(offset & 3) + { + case 0: res = m_keyb.data; machine().device("pic8259_master")->ir4_w(0); break; // according to the source, reading there acks the irq + case 1: res = m_keyb.status; break; + case 2: res = m_keyb.sig; break; // bit 0: CTRL bit 1: function key (or reversed) + case 3: res = ioport("KEY_MOD")->read() & 0xff; break; // sh + } + + return res; +} + +WRITE8_MEMBER(apc_state::apc_kbd_w) +{ + printf("KEYB %08x %02x\n",offset,data); +} + +WRITE8_MEMBER(apc_state::apc_dma_segments_w) +{ + m_dma_offset[offset & 3] = data & 0x0f; +} + +/* +NEC APC i8237 hook-up looks pretty weird ... + + NEC APC (shift 1) IBM PC +CH0_ADR == 0X01 0x00 0x00 ; CH-0 address (RW) +CH1_ADR == 0X03 0x01 0x02 ; CH-1 address (RW) +CH2_ADR == 0X05 0x02 0x04 ; CH-2 address (RW) +CH3_ADR == 0X07 0x03 0x06 ; CH-3 address (RW) +DMA_ST == 0X09 0x04 0x08 ; status register (R) +DMA_CMD == 0X09 0x04 0x08 ; command register (W) +DMA_WSM == 0X0B 0x05 0x0a ; write single mask (W) +DMA_CFF == 0X0D 0x06 0x0c ; clear flip flop (W) + +CH0_TC == 0X11 0x08 0x01 ; CH-0 terminal count (RW) +CH1_TC == 0X13 0x09 0x03 ; CH-1 terminal count (RW) +CH2_TC == 0X15 0x0a 0x05 ; CH-2 terminal count (RW) +CH3_TC == 0X17 0x0b 0x07 ; CH-3 terminal count (RW) +DMA_WRR == 0X19 0x0c 0x09 ; write request register (W) +DMA_MODE== 0X1B 0x0d 0x0b ; write mode (W) +DMA_RTR == 0X1D 0x0e 0x0d? ; read temp register (R) +DMA_MC == 0X1D 0x0e 0x0d ; master clear (W) +DMA_WAM == 0X1F 0x0f 0x0f? ; write all mask (W) +CH0_EXA == 0X38 ; CH-0 extended address (W) +CH1_EXA == 0X3A ; CH-1 extended address (W) +CH2_EXA == 0X3C ; CH-2 extended address (W) +CH3_EXA == 0X3E ; CH-3 extended address (W) + +... apparently, they rotated right the offset, compared to normal hook-up. +*/ + +READ8_MEMBER(apc_state::apc_dma_r) +{ + return m_dmac->read(space, BITSWAP8(offset,7,6,5,4,2,1,0,3), 0xff); +} + +WRITE8_MEMBER(apc_state::apc_dma_w) +{ + m_dmac->write(space, BITSWAP8(offset,7,6,5,4,2,1,0,3), data, 0xff); +} + +WRITE8_MEMBER(apc_state::apc_irq_ack_w) +{ + /* + x--- GDC + -x-- TM + --x- APU + ---x CRT + */ + if(data & 4) + machine().device("pic8259_master")->ir3_w(0); + + if(data & ~4) + logerror("IRQ ACK %02x\n",data); +} + +READ8_MEMBER(apc_state::apc_rtc_r) +{ + /* + bit 1 high: low battery. + */ + //fprintf(stderr, "RTC Read: %d\n", m_rtc->data_out_r()); + return m_rtc->data_out_r(); +} + +WRITE8_MEMBER(apc_state::apc_rtc_w) +{ +/* +RTC write: 0x01 0001 +RTC write: 0x03 0011 +RTC write: 0x0b 1011 <- cmd: read clock to shifter latch +RTC write: 0x03 0011 +RTC write: 0x01 0001 +RTC write: 0x09 1001 <- cmd: begin shifting latch data out +RTC write: 0x01 0001 +RTC write: 0x11 +RTC write: 0x01 +RTC write: 0x11 +RTC write: 0x01 +RTC write: 0x11 +... + +RTC write bits: 76543210 + |||||||\- c0 + ||||||\-- c1 + |||||\--- c2 + ||||\---- STB + |||\----- CLK + ||\------ DATA_IN + |\------- "don't care" + \-------- /// +*/ + if (data&0xc0) fprintf(stderr,"RTC write: 0x%02x\n", data); + m_rtc->c0_w(BIT(data, 0)); // correct assuming theres a delay for changing command lines before stb + m_rtc->c1_w(BIT(data, 1)); // " + m_rtc->c2_w(BIT(data, 2)); // " + m_rtc->stb_w(BIT(data, 3)); // seems correct assuming delay for changing command line + m_rtc->clk_w(BIT(data, 4)); // correct for sure + m_rtc->data_in_w(BIT(data, 5)); // ? no idea about this. + m_rtc->oe_w(1); +} + +static ADDRESS_MAP_START( apc_map, AS_PROGRAM, 16, apc_state ) + AM_RANGE(0x00000, 0x9ffff) AM_RAM + AM_RANGE(0xa0000, 0xa0fff) AM_RAM AM_SHARE("cmos") +// AM_RANGE(0xa1000, 0xbffff) mirror CMOS +// AM_RANGE(0xc0000, 0xcffff) standard character ROM + AM_RANGE(0xd8000, 0xd9fff) AM_RAM AM_REGION("aux_pcg", 0) // AUX character RAM +// AM_RANGE(0xe0000, 0xeffff) Special Character RAM + AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( apc_io, AS_IO, 16, apc_state ) +// ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x1f) AM_READWRITE8(apc_dma_r, apc_dma_w,0xff00) + AM_RANGE(0x20, 0x23) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff) // i8259 + AM_RANGE(0x28, 0x2f) AM_READWRITE8(apc_port_28_r, apc_port_28_w, 0xffff) // i8259 (even) / pit8253 (odd) +// 0x30, 0x37 serial port 0/1 (i8251) (even/odd) + AM_RANGE(0x38, 0x3f) AM_WRITE8(apc_dma_segments_w,0x00ff) + AM_RANGE(0x40, 0x43) AM_READWRITE8(apc_gdc_r, apc_gdc_w, 0xffff) + AM_RANGE(0x46, 0x47) AM_WRITE8(apc_irq_ack_w, 0x00ff) + AM_RANGE(0x48, 0x4f) AM_READWRITE8(apc_kbd_r, apc_kbd_w, 0x00ff) + AM_RANGE(0x50, 0x53) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff ) // upd765 + AM_RANGE(0x58, 0x59) AM_READWRITE8(apc_rtc_r, apc_rtc_w, 0x00ff) +// 0x59 CMOS enable +// 0x5a APU data (Arithmetic Processing Unit!) +// 0x5b, Power Off +// 0x5e APU status/command + AM_RANGE(0x60, 0x61) AM_DEVREADWRITE8("upd1771c", upd1771c_device, read, write, 0x00ff) +// AM_RANGE(0x68, 0x6f) i8255 , ODA printer port (A: status (R) B: data (W) C: command (W)) +// 0x70, 0x76 AM_DEVREADWRITE8("upd7220_btm", upd7220_device, read, write, 0x00ff) +// 0x71, 0x77 IDA Controller +// 0x80, 0x90 Communication Adapter +// 0xf0, 0xf6 ASOP Controller +ADDRESS_MAP_END + +/* TODO: key repeat, remove port impulse! */ +INPUT_CHANGED_MEMBER(apc_state::key_stroke) +{ + if(newval && !oldval) + { + m_keyb.data = (UINT8)(FPTR)(param) & 0xff; + //m_keyb.status &= ~1; + machine().device("pic8259_master")->ir4_w(1); + } + + if(oldval && !newval) + { + m_keyb.data = 0xff; + //m_keyb.status |= 1; + } +} + + +static INPUT_PORTS_START( apc ) + PORT_START("KEY0") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x30) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x31) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x32) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x33) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x34) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x35) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x36) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x37) + + PORT_START("KEY1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x38) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x39) + + PORT_START("KEY2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x41) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x42) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x43) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x44) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x45) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x46) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x47) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x48) + + PORT_START("KEY3") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x49) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4a) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4b) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4c) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4d) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4e) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4f) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x50) + + PORT_START("KEY4") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x51) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x52) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x53) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x54) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x55) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x56) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x57) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x58) + + PORT_START("KEY5") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x59) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5a) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ / {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5b) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ / |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5c) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] / }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5d) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(up score) / ^") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5e) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- / _") PORT_CODE(KEYCODE_MINUS) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5f) +// PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("unk6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x26) + + PORT_START("KEY6") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x20) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; / :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x3a) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= / +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2d) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("` / ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x40) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' / \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x3b) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", / <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2c) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". / >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ / ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2f) + + +/* +; +; Special table for screwed-up keys. Scan codes are converted. +; +SPECTBL: + BYTE 0X2D,0X3D + BYTE 0X40,0X60 + BYTE 0X3A,0X3B + BYTE 0X3B,0X27 +SPECTLN == (.-SPECTBL)/2 ; length of table +; +; Shift case table +; +CASETBL: + BYTE "1!" + BYTE "2@" + BYTE "3#" + BYTE "4$" + BYTE "5%" + BYTE "6",0XD0 + BYTE "7&" + BYTE "8*" + BYTE "9(" + BYTE "0)" + BYTE "-_" + BYTE "=+" + BYTE "`~" + BYTE "[{" + BYTE "]}" + BYTE "\\|" + BYTE ",<" + BYTE ".>" + BYTE "/?" + BYTE ";:" + BYTE 0X27,0X22 + BYTE 0X18,"^" +*/ + +/* + BYTE 0X18 ; 5E - Control-X + BYTE "-" ; 5F +*/ + +/* + #REPEAT 0X96-0X80 ; 80 to 95 - function keys +*/ + PORT_START("KEY_PF1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x80) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x81) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x82) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x83) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x84) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x85) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x86) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x87) + + PORT_START("KEY_PF2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x88) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x89) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF11") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF12") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF13") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF14") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF15") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF16") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8f) + + PORT_START("KEY_PF3") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF17") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x90) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF18") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x91) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF19") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x92) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF20") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x93) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF21") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x94) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF22") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x95) + +/* + BYTE "*" ; 6A + BYTE "+" ; 6B + BYTE 0XFF ; 6C - undefined code + BYTE "-" ; 6D + BYTE "." ; 6E + BYTE "/" ; 6F + BYTE "0" ; 70 + BYTE "1" ; 71 + BYTE "2" ; 72 + BYTE "3" ; 73 + BYTE "4" ; 74 + BYTE "5" ; 75 + BYTE "6" ; 76 + BYTE "7" ; 77 + BYTE "8" ; 78 + BYTE "9" ; 79 +*/ + + PORT_START("KEY_PAD1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6a) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6b) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) // 0x6c + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6d) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6e) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6f) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x70) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x71) + + PORT_START("KEY_PAD2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x72) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x73) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x74) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x75) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x76) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x77) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x78) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x79) + + +/* BYTE 0X00 ; 96 - break stop + BYTE 0X0D ; 97 - return + BYTE 0X09 ; 98 - tab/back tab + BYTE 0XFF ; 99 - undefined code + BYTE 0X1E ; 9A - home/clear + BYTE 0XFF ; 9B - undefined code + BYTE 0X08 ; 9C - back space +*/ + PORT_START("KEY_S1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CHAR(0x00) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x96) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x97) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") /*PORT_CODE(KEYCODE_TAB)*/ PORT_CHAR(0x09) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x98) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_UNUSED) //0x99 + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHAR(0x1e) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x9a) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_UNUSED) //0x9b + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x9c) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(0x1b) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x1b) + +/* + BYTE 0X0B ; F7 - up arrow + BYTE 0X0A ; F8 - down arrow + BYTE 0X0C ; F9 - right arrow + BYTE 0X08 ; FA - left arrow + BYTE 0XFF (?) ; FB - ins + BYTE 0X7F ; FC - del + BYTE 0X0D ; FD - enter +*/ + PORT_START("KEY_S2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(0x0b) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xf7) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(0x0a) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xf8) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(0x0c) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xf9) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(0x08) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfa) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CHAR(0xff) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfb) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CHAR(0x7f) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfc) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER (PAD)") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(0x0d) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfd) + + PORT_START("KEY_MOD") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE +INPUT_PORTS_END + +void apc_state::machine_start() +{ + m_fdc->set_rate(500000); + + m_rtc->cs_w(1); +// m_rtc->oe_w(1); +} + +void apc_state::machine_reset() +{ + m_keyb.status = 0; + m_keyb.data = 0; + m_keyb.sig = 0; +} + +static const gfx_layout charset_8x16 = +{ + 8, 16, + 128, + 1, + { 0 }, + { 7, 6, 5, 4, 3, 2, 1, 0 }, + { 0*1024, 1*1024, 2*1024, 3*1024, 4*1024, 5*1024, 6*1024, 7*1024, 8*1024, 9*1024, 10*1024, 11*1024, 12*1024, 13*1024, 14*1024, 15*1024 }, + 8 +}; + +#if 0 +static const gfx_layout charset_pcg = +{ + 8, 16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 7, 6, 5, 4, 3, 2, 1, 0 }, + { STEP16(0,16) }, + 8*32 +}; +#endif + +static GFXDECODE_START( apc ) + GFXDECODE_ENTRY( "gfx", 0x0000, charset_8x16, 0, 128 ) + GFXDECODE_ENTRY( "gfx", 0x0800, charset_8x16, 0, 128 ) + GFXDECODE_ENTRY( "gfx", 0x1000, charset_8x16, 0, 128 ) + GFXDECODE_ENTRY( "gfx", 0x1800, charset_8x16, 0, 128 ) +// GFXDECODE_ENTRY( "aux_pcg", 0x0000, charset_pcg, 0, 128 ) +GFXDECODE_END + + + +static ADDRESS_MAP_START( upd7220_1_map, AS_0, 16, apc_state) + AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram_1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( upd7220_2_map, AS_0, 16, apc_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram_2") +ADDRESS_MAP_END + +/* +irq assignment: +(note: documentation shows ODA Printer at ir7 master, but clearly everything is shifted one place due of the + master-slave irq comms. This is trusted also because MS-DOS effectively wants FDC irq at ir4 slave) + +8259 master: +ir0 all stop (enabled at POST, unknown purpose) +ir1 Communication +ir2 Option +ir3 Timer +ir4 keyboard (almost trusted, check code at fe64a) +ir5 Option +ir6 Option +ir7 slave irq + +8259 slave: +ir0 ODA Printer +ir1 Option +ir2 Option +ir3 CRT +ir4 FDD +ir5 Option +ir6 Option +ir7 APU +*/ + +READ8_MEMBER(apc_state::get_slave_ack) +{ + if (offset==7) { // IRQ = 7 + return machine().device( "pic8259_slave" )->acknowledge(); + } + return 0x00; +} + +/**************************************** +* +* I8237 DMA interface +* +****************************************/ + +WRITE_LINE_MEMBER(apc_state::apc_dma_hrq_changed) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + m_dmac->hack_w(state); + +// printf("%02x HLDA\n",state); +} + +WRITE_LINE_MEMBER( apc_state::apc_tc_w ) +{ + /* floppy terminal count */ + m_fdc->tc_w(state); + +// printf("TC %02x\n",state); +} + +READ8_MEMBER(apc_state::apc_dma_read_byte) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + offs_t addr = (m_dma_offset[m_dack] << 16) | offset; + +// printf("%08x\n",addr); + + return program.read_byte(addr); +} + + +WRITE8_MEMBER(apc_state::apc_dma_write_byte) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + offs_t addr = (m_dma_offset[m_dack] << 16) | offset; + +// printf("%08x %02x\n",addr,data); + + program.write_byte(addr, data); +} + +inline void apc_state::set_dma_channel(int channel, int state) +{ + if (!state) m_dack = channel; +} + +WRITE_LINE_MEMBER(apc_state::apc_dack0_w){ /*printf("%02x 0\n",state);*/ set_dma_channel(0, state); } +WRITE_LINE_MEMBER(apc_state::apc_dack1_w){ /*printf("%02x 1\n",state);*/ set_dma_channel(1, state); } +WRITE_LINE_MEMBER(apc_state::apc_dack2_w){ /*printf("%02x 2\n",state);*/ set_dma_channel(2, state); } +WRITE_LINE_MEMBER(apc_state::apc_dack3_w){ /*printf("%02x 3\n",state);*/ set_dma_channel(3, state); } + +READ8_MEMBER(apc_state::fdc_r) +{ + return m_fdc->dma_r(); +} + +WRITE8_MEMBER(apc_state::fdc_w) +{ + m_fdc->dma_w(data); +} + +/* +CH0: CRT +CH1: FDC +CH2: ("reserved for future graphics expansion") +CH3: AUX +*/ + +static const floppy_format_type apc_floppy_formats[] = { + FLOPPY_D88_FORMAT, + FLOPPY_IMD_FORMAT, + FLOPPY_MFI_FORMAT, + NULL +}; + +static SLOT_INTERFACE_START( apc_floppies ) + SLOT_INTERFACE( "8", FLOPPY_8_DSDD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( apc, apc_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8086,MAIN_CLOCK) + MCFG_CPU_PROGRAM_MAP(apc_map) + MCFG_CPU_IO_MAP(apc_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(MAIN_CLOCK) /* heartbeat IRQ */ + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259_master", pic8259_device, ir3_w)) + MCFG_PIT8253_CLK1(MAIN_CLOCK) /* Memory Refresh */ + MCFG_PIT8253_CLK2(MAIN_CLOCK) /* RS-232c */ + + MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(apc_state,get_slave_ack) ) + MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL ) // TODO: check ir7_w + MCFG_DEVICE_ADD("i8237", AM9517A, MAIN_CLOCK) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(apc_state, apc_dma_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(apc_state, apc_tc_w)) + MCFG_I8237_IN_MEMR_CB(READ8(apc_state, apc_dma_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(apc_state, apc_dma_write_byte)) + MCFG_I8237_IN_IOR_1_CB(READ8(apc_state, fdc_r)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(apc_state, fdc_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(apc_state, apc_dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(apc_state, apc_dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(apc_state, apc_dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(apc_state, apc_dack3_w)) + + MCFG_NVRAM_ADD_1FILL("cmos") + MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL) + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("pic8259_slave", pic8259_device, ir4_w)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("i8237", am9517a_device, dreq1_w)) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", apc_floppies, "8", apc_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", apc_floppies, "8", apc_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("disk_list","apc") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_UPDATE_DRIVER(apc_state, screen_update) + MCFG_SCREEN_SIZE(640, 494) + MCFG_SCREEN_VISIBLE_AREA(0*8, 640-1, 0*8, 494-1) + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", apc) + + MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 3579545) // unk clock + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map) + MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(apc_state, hgdc_draw_text) + + MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 3579545) // unk clock + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(apc_state, hgdc_display_pixels) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD( "upd1771c", UPD1771C, MAIN_CLOCK ) //uPD1771C-006 + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( apc ) + ROM_REGION( 0x2000, "ipl", ROMREGION_ERASE00 ) + ROM_LOAD16_BYTE( "pfbu2j.bin", 0x00000, 0x001000, CRC(86970df5) SHA1(be59c5dad3bd8afc21e9f2f1404553d4371978be) ) + ROM_LOAD16_BYTE( "pfbu2l.bin", 0x00001, 0x001000, CRC(38df2e70) SHA1(a37ccaea00c2b290610d354de08b489fa897ec48) ) + +// ROM_REGION( 0x10000, "file", ROMREGION_ERASE00 ) +// ROM_LOAD( "sioapc.o", 0, 0x10000, CRC(1) SHA1(1) ) + + ROM_REGION( 0x2000, "gfx", ROMREGION_ERASE00 ) + ROM_LOAD("pfcu1r.bin", 0x000000, 0x002000, CRC(683efa94) SHA1(43157984a1746b2e448f3236f571011af9a3aa73) ) + + ROM_REGION( 0x2000, "aux_pcg", ROMREGION_ERASE00 ) +ROM_END + +DRIVER_INIT_MEMBER(apc_state,apc) +{ + // ... +} + +COMP( 1982, apc, 0, 0, apc, apc, apc_state, apc, "NEC", "APC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/apexc.c b/src/mame/drivers/apexc.c new file mode 100644 index 00000000000..afeeae693bc --- /dev/null +++ b/src/mame/drivers/apexc.c @@ -0,0 +1,911 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet, Robbbert +/* + drivers/apexc.c : APEXC driver + + By Raphael Nabet + + see cpu/apexc.c for background and tech info +*/ + +#include "emu.h" +#include "cpu/apexc/apexc.h" + + +class apexc_state : public driver_device +{ +public: + apexc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_screen(*this, "screen") { } + + UINT32 m_panel_data_reg; /* value of a data register on the control panel which can + be edited - the existence of this register is a personnal + guess */ + + bitmap_ind16 *m_bitmap; + + UINT32 m_old_edit_keys; + int m_old_control_keys; + + int m_letters; + int m_pos; + DECLARE_DRIVER_INIT(apexc); + virtual void machine_start(); + virtual void video_start(); + DECLARE_PALETTE_INIT(apexc); + UINT32 screen_update_apexc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(apexc_interrupt); + DECLARE_READ8_MEMBER(tape_read); + DECLARE_WRITE8_MEMBER(tape_write); + void apexc_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); + void apexc_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color); + void apexc_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color); + void apexc_teletyper_init(); + void apexc_teletyper_linefeed(); + void apexc_teletyper_putchar(int character); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_screen; +}; + +void apexc_state::machine_start() +{ + apexc_teletyper_init(); +} + + +/* + APEXC RAM loading/saving from cylinder image + + Note that, in an actual APEXC, the RAM contents are not read from the cylinder : + the cylinder IS the RAM. + + This feature is important : of course, the tape reader allows to enter programs, but you + still need an object code loader in memory. (Of course, the control panel enables + the user to enter such a loader manually, but it would take hours...) +*/ + +class apexc_cylinder_image_device : public device_t, public device_image_interface +{ +public: + // construction/destruction + apexc_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_CYLINDER; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 1; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "apc"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +private: + int m_writable; +}; + +const device_type APEXC_CYLINDER = &device_creator; + +apexc_cylinder_image_device::apexc_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, APEXC_CYLINDER, "APEXC Cylinder", tag, owner, clock, "apexc_cylinder_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +/* + Open cylinder image and read RAM +*/ +bool apexc_cylinder_image_device::call_load() +{ + /* load RAM contents */ + m_writable = !is_readonly(); + + fread( machine().root_device().memregion("maincpu")->base(), 0x1000); +#ifdef LSB_FIRST + { /* fix endianness */ + UINT32 *RAM = (UINT32 *)(machine().root_device().memregion("maincpu")->base()); + + for (int i=0; i < 0x0400; i++) + RAM[i] = BIG_ENDIANIZE_INT32(RAM[i]); + } +#endif + + return IMAGE_INIT_PASS; +} + +/* + Save RAM to cylinder image and close it +*/ +void apexc_cylinder_image_device::call_unload() +{ + if (m_writable) + { /* save RAM contents */ + /* rewind file */ + fseek(0, SEEK_SET); +#ifdef LSB_FIRST + { /* fix endianness */ + UINT32 *RAM = (UINT32 *)(machine().root_device().memregion("maincpu")->base()); + + for (int i=0; i < /*0x2000*/0x0400; i++) + RAM[i] = BIG_ENDIANIZE_INT32(RAM[i]); + } +#endif + /* write */ + fwrite(machine().root_device().memregion("maincpu")->base(), /*0x8000*/0x1000); + } +} + + +#define MCFG_APEXC_CYLINDER_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, APEXC_CYLINDER, 0) + + +/* + APEXC tape support + + APEXC does all I/O on paper tape. There are 5 punch rows on tape. + + Both a reader (read-only), and a puncher (write-only) are provided. + + Tape output can be fed into a teletyper, in order to have text output : + + code Symbol + (binary) Letters Figures + 00000 0 + 00001 T 1 + 00010 B 2 + 00011 O 3 + 00100 E 4 + 00101 H 5 + 00110 N 6 + 00111 M 7 + 01000 A 8 + 01001 L 9 + 01010 R + + 01011 G - + 01100 I z + 01101 P . + 01110 C d + 01111 V = + 10000 Space + 10001 Z y + 10010 D theta (greek letter) + 10011 Line Space (i.e. LF) + 10100 S , + 10101 Y Sigma (greek letter) + 10110 F x + 10111 X / + 11000 Carriage Return + 11001 W phi (greek letter) + 11010 J - (dash ?) + 11011 Figures + 11100 U pi (greek letter) + 11101 Q ) + 11110 K ( + 11111 Letters +*/ + +class apexc_tape_puncher_image_device : public device_t, public device_image_interface +{ +public: + // construction/destruction + apexc_tape_puncher_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } + + virtual bool is_readable() const { return 0; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "tap"; } + virtual const option_guide *create_option_guide() const { return NULL; } +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type APEXC_TAPE_PUNCHER = &device_creator; + +apexc_tape_puncher_image_device::apexc_tape_puncher_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, APEXC_TAPE_PUNCHER, "APEXC Tape Puncher", tag, owner, clock, "apexc_tape_puncher_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +#define MCFG_APEXC_TAPE_PUNCHER_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, APEXC_TAPE_PUNCHER, 0) + +class apexc_tape_reader_image_device : public device_t, public device_image_interface +{ +public: + // construction/destruction + apexc_tape_reader_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 0; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "tap"; } + virtual const option_guide *create_option_guide() const { return NULL; } +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type APEXC_TAPE_READER = &device_creator; + +apexc_tape_reader_image_device::apexc_tape_reader_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, APEXC_TAPE_READER, "APEXC Tape Reader", tag, owner, clock, "apexc_tape_reader_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +#define MCFG_APEXC_TAPE_READER_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, APEXC_TAPE_READER, 0) + +/* + Open a tape image +*/ + +READ8_MEMBER(apexc_state::tape_read) +{ + device_t *device = machine().device("tape_reader"); + UINT8 reply; + device_image_interface *image = dynamic_cast(device); + + if (image->exists() && (image->fread(& reply, 1) == 1)) + return reply & 0x1f; + else + return 0; /* unit not ready - I don't know what we should do */ +} + +WRITE8_MEMBER(apexc_state::tape_write) +{ + device_t *device = machine().device("tape_puncher"); + UINT8 data5 = (data & 0x1f); + device_image_interface *image = dynamic_cast(device); + + if (image->exists()) + image->fwrite(& data5, 1); + + apexc_teletyper_putchar(data & 0x1f); /* display on screen */ +} + +/* + APEXC control panel + + I know really little about the details, although the big picture is obvious. + + Things I know : + * "As well as starting and stopping the machine, [it] enables information to be inserted + manually and provides for the inspection of the contents of the memory via various + storage registers." (Booth, p. 2) + * "Data can be inserted manually from the control panel [into the control register]". + (Booth, p. 3) + * The contents of the R register can be edited, too. A button allows to clear + a complete X (or Y ???) field. (forgot the reference, but must be somewhere in Booth) + * There is no trace mode (Booth, p. 213) + + Since the control panel is necessary for the operation of the APEXC, I tried to + implement a commonplace control panel. I cannot tell how close the feature set and + operation of this control panel is to the original APEXC control panel, but it + cannot be too different in the basic principles. +*/ + + +#if 0 +/* defines for input port numbers */ +enum +{ + panel_control = 0, + panel_edit1, + panel_edit2 +}; +#endif + + +/* defines for each bit and mask in input port panel_control */ +enum +{ + /* bit numbers */ + panel_run_bit = 0, + panel_CR_bit, + panel_A_bit, + panel_R_bit, + panel_HB_bit, + panel_ML_bit, + panel_mem_bit, + panel_write_bit, + + /* masks */ + panel_run = (1 << panel_run_bit), + panel_CR = (1 << panel_CR_bit), + panel_A = (1 << panel_A_bit), + panel_R = (1 << panel_R_bit), + panel_HB = (1 << panel_HB_bit), + panel_ML = (1 << panel_ML_bit), + panel_mem = (1 << panel_mem_bit), + panel_write = (1 << panel_write_bit) +}; + +/* fake input ports with keyboard keys */ +static INPUT_PORTS_START(apexc) + + PORT_START("panel") /* 0 : panel control */ + PORT_BIT(panel_run, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Run/Stop") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(panel_CR, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read CR") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(panel_A, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read A") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(panel_R, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read R") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(panel_HB, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read HB") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(panel_ML, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read ML") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(panel_mem, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read mem") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(panel_write, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Write instead of read") PORT_CODE(KEYCODE_LSHIFT) + + PORT_START("data") /* data edit */ + PORT_BIT(0x80000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x40000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x20000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x08000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x02000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x01000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #10") PORT_CODE(KEYCODE_0) + PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #11") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #12") PORT_CODE(KEYCODE_W) + PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #13") PORT_CODE(KEYCODE_E) + PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #14") PORT_CODE(KEYCODE_R) + PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #15") PORT_CODE(KEYCODE_T) + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #16") PORT_CODE(KEYCODE_Y) + + PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #17") PORT_CODE(KEYCODE_U) + PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #18") PORT_CODE(KEYCODE_I) + PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #19") PORT_CODE(KEYCODE_O) + PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #20") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #21") PORT_CODE(KEYCODE_A) + PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #22") PORT_CODE(KEYCODE_S) + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #23") PORT_CODE(KEYCODE_D) + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #24") PORT_CODE(KEYCODE_F) + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #25") PORT_CODE(KEYCODE_G) + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #26") PORT_CODE(KEYCODE_H) + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #27") PORT_CODE(KEYCODE_J) + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #28") PORT_CODE(KEYCODE_K) + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #29") PORT_CODE(KEYCODE_L) + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #30") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #31") PORT_CODE(KEYCODE_X) + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #32") PORT_CODE(KEYCODE_C) +INPUT_PORTS_END + + +/* + Not a real interrupt - just handle keyboard input +*/ +INTERRUPT_GEN_MEMBER(apexc_state::apexc_interrupt) +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT32 edit_keys; + int control_keys; + + int control_transitions; + + + /* read new state of edit keys */ + edit_keys = ioport("data")->read(); + + /* toggle data reg according to transitions */ + m_panel_data_reg ^= edit_keys & (~m_old_edit_keys); + + /* remember new state of edit keys */ + m_old_edit_keys = edit_keys; + + + /* read new state of control keys */ + control_keys = ioport("panel")->read(); + + /* compute transitions */ + control_transitions = control_keys & (~m_old_control_keys); + + /* process commands */ + + if (control_transitions & panel_run) + { /* toggle run/stop state */ + device.state().set_state_int(APEXC_STATE, ! device.state().state_int(APEXC_STATE)); + } + + while (control_transitions & (panel_CR | panel_A | panel_R | panel_ML | panel_HB)) + { /* read/write a register */ + /* note that we must take into account the possibility of simulteanous keypresses + (which would be a goofy thing to do when reading, but a normal one when writing, + if the user wants to clear several registers at once) */ + int reg_id = -1; + + /* determinate value of reg_id */ + if (control_transitions & panel_CR) + { /* CR register selected ? */ + control_transitions &= ~panel_CR; /* clear so that it is ignored on next iteration */ + reg_id = APEXC_CR; /* matching register ID */ + } + else if (control_transitions & panel_A) + { + control_transitions &= ~panel_A; + reg_id = APEXC_A; + } + else if (control_transitions & panel_R) + { + control_transitions &= ~panel_R; + reg_id = APEXC_R; + } + else if (control_transitions & panel_HB) + { + control_transitions &= ~panel_HB; + reg_id = APEXC_WS; + } + else if (control_transitions & panel_ML) + { + control_transitions &= ~panel_ML; + reg_id = APEXC_ML; + } + + if (-1 != reg_id) + { + /* read/write register #reg_id */ + if (control_keys & panel_write) + /* write reg */ + device.state().set_state_int(reg_id, m_panel_data_reg); + else + /* read reg */ + m_panel_data_reg = device.state().state_int(reg_id); + } + } + + if (control_transitions & panel_mem) + { /* read/write memory */ + + if (control_keys & panel_write) { + /* write memory */ + space.write_dword(device.state().state_int(APEXC_ML_FULL)<<2, m_panel_data_reg); + } + else { + /* read memory */ + m_panel_data_reg = space.read_dword(device.state().state_int(APEXC_ML_FULL)<<2); + } + } + + /* remember new state of control keys */ + m_old_control_keys = control_keys; +} + +/* + apexc video emulation. + + Since the APEXC has no video display, we display the control panel. + + Additionnally, We display one page of teletyper output. +*/ + +static const rgb_t apexc_palette[] = +{ + rgb_t::white, + rgb_t::black, + rgb_t(255, 0, 0), + rgb_t(50, 0, 0) +}; + +#if 0 +static const unsigned short apexc_colortable[] = +{ + 0, 1 +}; +#endif + +#define APEXC_PALETTE_SIZE ARRAY_LENGTH(apexc_palette) +#define APEXC_COLORTABLE_SIZE sizeof(apexc_colortable)/2 + +enum +{ + /* size and position of panel window */ + panel_window_width = 256, + panel_window_height = 64, + panel_window_offset_x = 0, + panel_window_offset_y = 0, + /* size and position of teletyper window */ + teletyper_window_width = 256, + teletyper_window_height = 128, + teletyper_window_offset_x = 0, + teletyper_window_offset_y = panel_window_height +}; + +static const rectangle panel_window( + panel_window_offset_x, panel_window_offset_x+panel_window_width-1, /* min_x, max_x */ + panel_window_offset_y, panel_window_offset_y+panel_window_height-1/* min_y, max_y */ +); +static const rectangle teletyper_window( + teletyper_window_offset_x, teletyper_window_offset_x+teletyper_window_width-1, /* min_x, max_x */ + teletyper_window_offset_y, teletyper_window_offset_y+teletyper_window_height-1/* min_y, max_y */ +); +enum +{ + teletyper_scroll_step = 8 +}; +static const rectangle teletyper_scroll_clear_window( + teletyper_window_offset_x, teletyper_window_offset_x+teletyper_window_width-1, /* min_x, max_x */ + teletyper_window_offset_y+teletyper_window_height-teletyper_scroll_step, teletyper_window_offset_y+teletyper_window_height-1 /* min_y, max_y */ +); +//static const int var_teletyper_scroll_step = - teletyper_scroll_step; + +PALETTE_INIT_MEMBER(apexc_state, apexc) +{ + palette.set_pen_colors(0, apexc_palette, APEXC_PALETTE_SIZE); +} + +void apexc_state::video_start() +{ + int width = m_screen->width(); + int height = m_screen->height(); + + m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); + m_bitmap->fill(0, /*machine().visible_area*/teletyper_window); +} + +/* draw a small 8*8 LED (well, there were no LEDs at the time, so let's call this a lamp ;-) ) */ +void apexc_state::apexc_draw_led(bitmap_ind16 &bitmap, int x, int y, int state) +{ + int xx, yy; + + for (yy=1; yy<7; yy++) + for (xx=1; xx<7; xx++) + bitmap.pix16(y+yy, x+xx) = state ? 2 : 3; +} + +/* write a single char on screen */ +void apexc_state::apexc_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color) +{ + m_gfxdecode->gfx(0)->transpen(bitmap,bitmap.cliprect(), character-32, color, 0, 0, + x+1, y, 0); +} + +/* write a string on screen */ +void apexc_state::apexc_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) +{ + while (* buf) + { + apexc_draw_char(bitmap, *buf, x, y, color); + + x += 8; + buf++; + } +} + + +UINT32 apexc_state::screen_update_apexc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int i; + char the_char; + + bitmap.fill(0, /*machine().visible_area*/panel_window); + apexc_draw_string(bitmap, "power", 8, 0, 0); + apexc_draw_string(bitmap, "running", 8, 8, 0); + apexc_draw_string(bitmap, "data :", 0, 24, 0); + + copybitmap(bitmap, *m_bitmap, 0, 0, 0, 0, teletyper_window); + + + apexc_draw_led(bitmap, 0, 0, 1); + + apexc_draw_led(bitmap, 0, 8, m_maincpu->state_int(APEXC_STATE)); + + for (i=0; i<32; i++) + { + apexc_draw_led(bitmap, i*8, 32, (m_panel_data_reg << i) & 0x80000000UL); + the_char = '0' + ((i + 1) % 10); + apexc_draw_char(bitmap, the_char, i*8, 40, 0); + if (((i + 1) % 10) == 0) + { + the_char = '0' + ((i + 1) / 10); + apexc_draw_char(bitmap, the_char, i*8, 48, 0); + } + } + return 0; +} + +void apexc_state::apexc_teletyper_init() +{ + m_letters = FALSE; + m_pos = 0; +} + +void apexc_state::apexc_teletyper_linefeed() +{ + UINT8 buf[teletyper_window_width]; + int y; + + for (y=teletyper_window_offset_y; ypens()); + } + + m_bitmap->fill(0, teletyper_scroll_clear_window); +} + +void apexc_state::apexc_teletyper_putchar(int character) +{ + static const char ascii_table[2][32] = + { + { + '0', '1', '2', '3', + '4', '5', '6', '7', + '8', '9', '+', '-', + 'z', '.', 'd', '=', + ' ', 'y', /*'@'*/'\200'/*theta*/,'\n'/*Line Space*/, + ',', /*'&'*/'\201'/*Sigma*/,'x', '/', + '\r'/*Carriage Return*/,/*'!'*/'\202'/*Phi*/,'_'/*???*/, '\0'/*Figures*/, + /*'#'*/'\203'/*pi*/,')', '(', '\0'/*Letters*/ + }, + { + ' '/*???*/, 'T', 'B', 'O', + 'E', 'H', 'N', 'M', + 'A', 'L', 'R', 'G', + 'I', 'P', 'C', 'V', + ' ', 'Z', 'D', '\n'/*Line Space*/, + 'S', 'Y', 'F', 'X', + '\r'/*Carriage Return*/,'W', 'J', '\0'/*Figures*/, + 'U', 'Q', 'K', '\0'/*Letters*/ + } + }; + + char buffer[2] = "x"; + + character &= 0x1f; + + switch (character) + { + case 19: + /* Line Space */ + apexc_teletyper_linefeed(); + break; + + case 24: + /* Carriage Return */ + m_pos = 0; + break; + + case 27: + /* Figures */ + m_letters = FALSE; + break; + + case 31: + /* Letters */ + m_letters = TRUE; + break; + + default: + /* Any printable character... */ + + if (m_pos >= 32) + { /* if past right border, wrap around */ + apexc_teletyper_linefeed(); /* next line */ + m_pos = 0; /* return to start of line */ + } + + /* print character */ + buffer[0] = ascii_table[m_letters][character]; /* lookup ASCII equivalent in table */ + buffer[1] = '\0'; /* terminate string */ + apexc_draw_string(*m_bitmap, buffer, 8*m_pos, 176, 0); /* print char */ + m_pos++; /* step carriage forward */ + + break; + } +} + +enum +{ + apexc_charnum = /*96+4*/128, /* ASCII set + 4 special characters */ + /* for whatever reason, 96+4 breaks greek characters */ + + apexcfontdata_size = 8 * apexc_charnum +}; + +/* apexc driver init : builds a font for use by the teletyper */ +DRIVER_INIT_MEMBER(apexc_state,apexc) +{ + UINT8 *dst; + + static const unsigned char fontdata6x8[apexcfontdata_size] = + { /* ASCII characters */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00, + 0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08, + 0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00, + 0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00, + 0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00, + 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00, + 0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00, + 0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, + 0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00, + 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00, + 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60, + 0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, + 0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, + 0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, + 0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, + 0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, + 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00, + 0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, + 0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08, + 0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, + 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00, + 0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00, + 0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00, + 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00, + 0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc, + 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, + 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00, + 0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, + 0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, + 0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00, + 0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00, + 0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, + 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, + 0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, + 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00, + 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00, + 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, + 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, + 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00, + + /* theta */ + 0x70, + 0x88, + 0x88, + 0xF8, + 0x88, + 0x88, + 0x70, + 0x00, + + /* Sigma */ + 0xf8, + 0x40, + 0x20, + 0x10, + 0x20, + 0x40, + 0xf8, + 0x00, + + /* Phi */ + 0x20, + 0x70, + 0xA8, + 0xA8, + 0xA8, + 0xA8, + 0x70, + 0x20, + + /* pi */ + 0x00, + 0x00, + 0xF8, + 0x50, + 0x50, + 0x50, + 0x50, + 0x00 + }; + + dst = memregion("chargen")->base(); + + memcpy(dst, fontdata6x8, apexcfontdata_size); +} + +static const gfx_layout fontlayout = +{ + 6, 8, /* 6*8 characters */ + apexc_charnum, /* 96+4 characters */ + 1, /* 1 bit per pixel */ + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 consecutive bytes */ +}; + +static GFXDECODE_START( apexc ) + GFXDECODE_ENTRY( "chargen", 0, fontlayout, 0, 2 ) +GFXDECODE_END + + +static ADDRESS_MAP_START(apexc_mem_map, AS_PROGRAM, 32, apexc_state ) +#if 0 + AM_RANGE(0x0000, 0x03ff) AM_RAM /* 1024 32-bit words (expandable to 8192) */ + AM_RANGE(0x0400, 0x1fff) AM_NOP +#else + AM_RANGE(0x0000, 0x0fff) AM_RAM AM_REGION("maincpu", 0x0000) + AM_RANGE(0x1000, 0x7fff) AM_NOP +#endif +ADDRESS_MAP_END + +static ADDRESS_MAP_START(apexc_io_map, AS_IO, 8, apexc_state ) + AM_RANGE(0x00, 0x00) AM_READ(tape_read) + AM_RANGE(0x00, 0x00) AM_WRITE(tape_write) +ADDRESS_MAP_END + + +static MACHINE_CONFIG_START( apexc, apexc_state ) + + /* basic machine hardware */ + /* APEXC CPU @ 2.0 kHz (memory word clock frequency) */ + MCFG_CPU_ADD("maincpu", APEXC, 2000) + /*MCFG_CPU_CONFIG(NULL)*/ + MCFG_CPU_PROGRAM_MAP(apexc_mem_map) + MCFG_CPU_IO_MAP(apexc_io_map) + /* dummy interrupt: handles the control panel */ + MCFG_CPU_VBLANK_INT_DRIVER("screen", apexc_state, apexc_interrupt) + + + /* video hardware does not exist, but we display a control panel and the typewriter output */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 192) + MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 192-1) + MCFG_SCREEN_UPDATE_DRIVER(apexc_state, screen_update_apexc) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", apexc) + MCFG_PALETTE_ADD("palette", APEXC_PALETTE_SIZE) + MCFG_PALETTE_INIT_OWNER(apexc_state, apexc) + + + MCFG_APEXC_CYLINDER_ADD("cylinder") + MCFG_APEXC_TAPE_PUNCHER_ADD("tape_puncher") + MCFG_APEXC_TAPE_READER_ADD("tape_reader") +MACHINE_CONFIG_END + +ROM_START(apexc) + /*CPU memory space*/ + ROM_REGION32_BE(0x10000, "maincpu", ROMREGION_ERASEFF) + /* Note this computer has no ROM... */ + + ROM_REGION(apexcfontdata_size, "chargen", ROMREGION_ERASEFF) + /* space filled with our font */ +ROM_END + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +//COMP( 1951, apexc53, 0, 0, apexc53, apexc, apexc_state, apexc, "Andrew Donald Booth", "All Purpose Electronic X-ray Computer (as described in 1953)" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1955, apexc, 0, 0, apexc, apexc, apexc_state, apexc, "Andrew Donald Booth", "All Purpose Electronic X-ray Computer (as described in 1957)" , MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/apf.c b/src/mame/drivers/apf.c new file mode 100644 index 00000000000..8509777d21b --- /dev/null +++ b/src/mame/drivers/apf.c @@ -0,0 +1,605 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/****************************************************************************** + +Driver completely rewritten by Robbbert in a process begun on 2014-01-22. + +Based on the previous work done by PeT around February 2008, and possible others prior. + added apfm1000 cartridge loading + fixed apfm1000 pads + added apf video mode + + +APF M1000/MP1000 and Imagination Machine +---------------------------------------- +- The M1000 contains the video RAM, ROM, CPU, PIA0, handsets, Video and cart slot, and thus was a TV Game computer. +- The MPA-10 was a base unit containing the main keyboard, custom cassette recorder, 8k RAM and PIA1. +- When the two were joined, they formed the Imagination Machine. +- Although the BASIC cart could be plugged into the M1000, it could not be used as it needs the main keyboard. +- BB-01 Building Block - provides 4 cart slots. Includes a RS-232 cart for a printer or modem. +- R8-K 8K RAM Expansion cart. +- FI-100 Minifloppy Disk Interface Cartridge - drives 1 or 2 D100-0 floppy drives on AS-400 bus. +- D100-0 Floppy drive 5 1/4" +- A cassette program must be loaded on the same memory size it was saved from. Since the standard machine + had 8K, almost all tapes require this exact amount of RAM to be present +- The cart-slot is physically the same as the Arcadia 2001. + + +RAM switch +---------- +- The M1000 only had available the 1K video ram (0000-03FF) +- Space Destroyer needs more, so it includes another 1K in the cart +- The MPA-10 base includes 8K of RAM (A000-BFFF) (-ram 8K) +- A very few games need 16K which requires hacking the pcb (-ram 16K) +- Basic will work with 8K or 16K. + + +Status of cart-based games +-------------------------- +backgammon - works, needs offset of 0x120, bottom line is coming from 0x3E0, should be 0x380 +baseball - works, needs offset of 0x200, some bad colours +basic - works in apfimag only (as designed) +blackjack - works, some bad colours +bowling - works +boxing - works +brickdown - works +columns - runs but seems to be buggy +casino - appears to work (need instructions) +catena - works +hangman - works +pinball - works +movblock - works +rocket patrol - works, some bad colours +space destroyer - works +ufo - works + + +ToDo: +----- +- When pasting a large program, characters can be lost +- Some bad colours or graphics +- Tape loading is not very reliable +- Add back the disk support when we can get some info on it + (6600, 6500-6503 wd179x disc controller? 6400, 6401) +- Need to add back the disk format in the new wdc code + (40 tracks, 1 head, 8 sectors, 256 bytes sector length, first sector id 1) +- Need disk-based software + + +******************************************************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "video/mc6847.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "machine/6821pia.h" +#include "machine/wd_fdc.h" +#include "imagedev/cassette.h" +#include "formats/apf_apt.h" +#include "machine/ram.h" + +#include "bus/apf/slot.h" +#include "bus/apf/rom.h" + + +class apf_state : public driver_device +{ +public: + apf_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_has_cart_ram(false) + , m_maincpu(*this, "maincpu") + , m_ram(*this, RAM_TAG) + , m_crtc(*this, "mc6847") + , m_speaker(*this, "speaker") + , m_pia0(*this, "pia0") + , m_pia1(*this, "pia1") + , m_cass(*this, "cassette") + , m_cart(*this, "cartslot") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_joy(*this, "joy") + , m_key(*this, "key") + , m_p_videoram(*this, "videoram") + { } + + DECLARE_READ8_MEMBER(videoram_r); + DECLARE_READ8_MEMBER(pia0_porta_r); + DECLARE_WRITE8_MEMBER(pia0_portb_w); + DECLARE_WRITE_LINE_MEMBER(pia0_ca2_w); + DECLARE_READ8_MEMBER(pia1_porta_r); + DECLARE_READ8_MEMBER(pia1_portb_r); + DECLARE_WRITE8_MEMBER(pia1_portb_w); + DECLARE_WRITE8_MEMBER(apf_dischw_w); + DECLARE_READ8_MEMBER(serial_r); + DECLARE_WRITE8_MEMBER(serial_w); + +private: + UINT8 m_latch; + UINT8 m_keyboard_data; + UINT8 m_pad_data; + UINT8 m_portb; + bool m_ca2; + bool m_has_cart_ram; + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + optional_device m_ram; + required_device m_crtc; + required_device m_speaker; + required_device m_pia0; + optional_device m_pia1; + optional_device m_cass; + required_device m_cart; + optional_device m_fdc; + optional_device m_floppy0; + optional_device m_floppy1; + required_ioport_array<4> m_joy; + optional_ioport_array<8> m_key; + required_shared_ptr m_p_videoram; +}; + + +READ8_MEMBER( apf_state::videoram_r ) +{ + if BIT(m_pad_data, 7) // AG line + { + // Need the cpu and crtc to be locked together for proper graphics + // This is a hack to fix Rocket Patrol and Blackjack + if (BIT(m_pad_data, 6) && !m_has_cart_ram) + offset -= 0x400; + + // This is a hack to fix Space Destroyer + if (BIT(m_pad_data, 6) && m_has_cart_ram) + offset -= 0x120; + + UINT16 part1 = offset & 0x1f; + UINT16 part2 = (offset & 0x1e0) >> 5; + UINT16 part3 = (offset & 0x1e00) >> 4; + if (m_ca2) m_latch = m_p_videoram[part3 | part1]; // get chr + m_crtc->css_w(BIT(m_latch, 6)); + UINT16 latch = (m_latch & 0x1f) << 4; + return m_p_videoram[latch | part2 | 0x200]; // get gfx + } + else + { + UINT8 data = m_p_videoram[(offset & 0x1ff) | 0x200]; + if (m_ca2) m_crtc->css_w(BIT(data, 6)); + m_crtc->inv_w(BIT(data, 6)); + m_crtc->as_w(BIT(data, 7)); + return data; + } +} + +READ8_MEMBER( apf_state::pia0_porta_r ) +{ + UINT8 data = 0xff; + + for (int i = 3; i >= 0; i--) + if (!BIT(m_pad_data, i)) + data &= m_joy[i]->read(); + + return data; +} + +WRITE8_MEMBER( apf_state::pia0_portb_w ) +{ + /* bit 7..6 video control */ + m_crtc->ag_w(BIT(data, 7)); + m_crtc->gm0_w(BIT(data, 6)); + + /* bit 3..0 keypad line select */ + m_pad_data = data; +} + +WRITE_LINE_MEMBER( apf_state::pia0_ca2_w ) +{ + m_ca2 = state; +} + +READ8_MEMBER( apf_state::pia1_porta_r ) +{ + return m_key[m_keyboard_data]->read(); +} + +READ8_MEMBER( apf_state::pia1_portb_r ) +{ + UINT8 data = m_portb; + + if (m_cass->input() > 0.0038) + data |= 0x80; + + return data; +} + + +WRITE8_MEMBER( apf_state::pia1_portb_w ) +{ + /* bits 2..0 = keyboard line */ + /* bit 3 = cass audio enable */ + /* bit 4 = cassette motor */ + /* bit 5 = /cass write enable */ + /* bit 6 = cass out */ + /* bit 7 = cass in */ + + m_portb = data & 0x7f; + m_keyboard_data = data & 7; + + m_cass->change_state(BIT(data, 4) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + if (!BIT(data, 5)) + m_cass->output(BIT(data, 6) ? -1.0 : 1.0); +} + + +void apf_state::machine_start() +{ + if (m_cart->exists()) + { + switch (m_cart->get_type()) + { + case APF_BASIC: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x6800, 0x7fff, read8_delegate(FUNC(apf_cart_slot_device::extra_rom),(apf_cart_slot_device*)m_cart)); + break; + case APF_SPACEDST: + m_maincpu->space(AS_PROGRAM).unmap_readwrite(0x9800, 0x9fff); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9800, 0x9bff, read8_delegate(FUNC(apf_cart_slot_device::read_ram),(apf_cart_slot_device*)m_cart), write8_delegate(FUNC(apf_cart_slot_device::write_ram),(apf_cart_slot_device*)m_cart)); + m_has_cart_ram = true; + break; + } + + m_cart->save_ram(); + } +} + + +void apf_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + m_portb = 0; + m_ca2 = 0; + + // apfimag only + if (m_ram) + { + /* if we specified 8K of RAM, delete the extended RAM */ + if (m_ram->size() < 16*1024) + space.unmap_readwrite(0xc000, 0xdfff); + // this is a hack to get 'columns' to work. It misbehaves if a000-a003 are all zero + else + space.write_byte(0xa002, 0xe5); + } +} + +WRITE8_MEMBER( apf_state::apf_dischw_w) +{ + /* bit 3 is index of drive to select */ + UINT8 drive = BIT(data, 3); + + floppy_image_device *floppy = NULL; + if (drive) + floppy = m_floppy1->get_device(); + else + floppy = m_floppy0->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + } + + logerror("disc w %04x %04x\n",offset,data); +} + +READ8_MEMBER( apf_state::serial_r) +{ + logerror("serial r %04x\n",offset); + return 0; +} + +WRITE8_MEMBER( apf_state::serial_w) +{ + logerror("serial w %04x %04x\n",offset,data); +} + +static ADDRESS_MAP_START( apfm1000_map, AS_PROGRAM, 8, apf_state ) + AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x2000, 0x3fff) AM_MIRROR(0x1ffc) AM_DEVREADWRITE("pia0", pia6821_device, read, write) + AM_RANGE(0x4000, 0x4fff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0x6800, 0x7fff) AM_NOP // BASIC accesses ROM here too, but this is installed at machine_start + AM_RANGE(0x8000, 0x9fff) AM_DEVREAD("cartslot", apf_cart_slot_device, read_rom) + AM_RANGE(0xe000, 0xefff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( apfimag_map, AS_PROGRAM, 8, apf_state ) + AM_IMPORT_FROM(apfm1000_map) + AM_RANGE(0x6000, 0x63ff) AM_MIRROR(0x03fc) AM_DEVREADWRITE("pia1", pia6821_device, read, write) + // These need to be confirmed, disk does not work + AM_RANGE(0x6400, 0x64ff) AM_READWRITE(serial_r, serial_w) + AM_RANGE(0x6500, 0x6503) AM_DEVREADWRITE("fdc", fd1771_t, read, write) + AM_RANGE(0x6600, 0x6600) AM_WRITE(apf_dischw_w) + AM_RANGE(0xa000, 0xbfff) AM_RAM // standard + AM_RANGE(0xc000, 0xdfff) AM_RAM // expansion +ADDRESS_MAP_END + + +/* Each controller has these features: + + 1 8-way joystick + 1 big red fire button on the upper side + 12-keys keypad with the following layout + + 7 8 9 0 + 4 5 6 Cl + 1 2 3 En + + On the control panel of the M-1000 there are two big buttons: a Reset key and the Power switch + + Reference: http://www.nausicaa.net/~lgreenf/apfpage2.htm +*/ + +static INPUT_PORTS_START( apfm1000 ) + +/* + This simple Basic program can be used to read the joysticks and the keyboard: + + 10 PRINT KEY$(n); + 20 GOTO 10 + + where n = 0, 1 or 2 - 0 = keyboard, 1,2 = joysticks #1 and #2 + + When reading the keyboard KEY$(0) returns the character associated to the key, with the + following exceptions: + + Ctrl = CHR$(1) + Rept = CHR$(2) + Here Is = CHR$(4) + Rubout = CHR$(8) + + When reading the joysticks, KEY$() = "N", "S", "E", "W" for the directions + "0" - "9" for the keypad digits + "?" for "Cl" + "!" for "En" + + + ? player right is player 1 +*/ + + PORT_START("joy.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 1") PORT_CODE(KEYCODE_1) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 0") PORT_CODE(KEYCODE_0) PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 4") PORT_CODE(KEYCODE_4) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 7") PORT_CODE(KEYCODE_7) PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 1") PORT_CODE(KEYCODE_1_PAD) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 0") PORT_CODE(KEYCODE_0_PAD) PORT_PLAYER(1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 4") PORT_CODE(KEYCODE_4_PAD) PORT_PLAYER(1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 7") PORT_CODE(KEYCODE_7_PAD) PORT_PLAYER(1) + + PORT_START("joy.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("PAD 1/RIGHT down") PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("PAD 1/RIGHT right") PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 1/RIGHT up") PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("PAD 1/RIGHT left") PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("PAD 2/LEFT down") PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("PAD 2/LEFT right") PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 2/LEFT up") PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("PAD 2/LEFT left") PORT_PLAYER(1) PORT_8WAY + + PORT_START("joy.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 3") PORT_CODE(KEYCODE_3) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT clear") PORT_CODE(KEYCODE_DEL) PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 6") PORT_CODE(KEYCODE_6) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 9") PORT_CODE(KEYCODE_9) PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 3") PORT_CODE(KEYCODE_3_PAD) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT clear") PORT_CODE(KEYCODE_DEL_PAD) PORT_PLAYER(1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 6") PORT_CODE(KEYCODE_6_PAD) PORT_PLAYER(1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 9") PORT_CODE(KEYCODE_9_PAD) PORT_PLAYER(1) + + PORT_START("joy.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 2") PORT_CODE(KEYCODE_2) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT enter/fire") PORT_CODE(KEYCODE_ENTER) PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 5") PORT_CODE(KEYCODE_5) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 8") PORT_CODE(KEYCODE_8) PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 2") PORT_CODE(KEYCODE_2_PAD) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT enter/fire") PORT_CODE(KEYCODE_ENTER_PAD) PORT_PLAYER(1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 5") PORT_CODE(KEYCODE_5_PAD) PORT_PLAYER(1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 8") PORT_CODE(KEYCODE_8_PAD) PORT_PLAYER(1) +INPUT_PORTS_END + + +static INPUT_PORTS_START( apfimag ) + + PORT_INCLUDE( apfm1000 ) + + /* Reference: http://www.nausicaa.net/~lgreenf/apfpage2.htm */ + + PORT_START("key.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q IF") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \" LET") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! GOSUB") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W STEP") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + + PORT_START("key.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R READ") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # DATA") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ INPUT") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E STOP") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("key.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N ^") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('^') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T NEXT") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 & FOR") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % DIM") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y PRINT") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + + PORT_START("key.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M ]") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR(']') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I LIST") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ' RETURN") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K [") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('[') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 ( THEN") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U END") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + + PORT_START("key.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O _ REM") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('_') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 GOTO") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L \\") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ) ON") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P @ USING") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('@') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + + PORT_START("key.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(13) + PORT_BIT(0x08, 0x08, IPT_UNUSED) + PORT_BIT(0x10, 0x10, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- = RESTORE") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(10) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rubout") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(8) + + PORT_START("key.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_TAB) PORT_CHAR(27) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rept") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Here Is") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x40, 0x40, IPT_UNUSED) // another X + PORT_BIT(0x80, 0x80, IPT_UNUSED) // another Z + + PORT_START("key.7") + PORT_BIT(0xff, 0xff, IPT_UNUSED) +INPUT_PORTS_END + + +static SLOT_INTERFACE_START( apf_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_SSDD ) +SLOT_INTERFACE_END + + +static SLOT_INTERFACE_START(apf_cart) + SLOT_INTERFACE_INTERNAL("std", APF_ROM_STD) + SLOT_INTERFACE_INTERNAL("basic", APF_ROM_BASIC) + SLOT_INTERFACE_INTERNAL("spacedst", APF_ROM_SPACEDST) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( apfm1000, apf_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6800, XTAL_3_579545MHz / 4 ) // divided by 4 in external clock circuit + MCFG_CPU_PROGRAM_MAP(apfm1000_map) + + /* video hardware */ + MCFG_SCREEN_MC6847_NTSC_ADD("screen", "mc6847") + + MCFG_DEVICE_ADD("mc6847", MC6847_NTSC, XTAL_3_579545MHz) + MCFG_MC6847_FSYNC_CALLBACK(DEVWRITELINE("pia0", pia6821_device, cb1_w)) + MCFG_MC6847_INPUT_CALLBACK(READ8(apf_state, videoram_r)) + MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM2 | MC6847_MODE_GM1) + // INTEXT = GND + // other lines not connected + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("pia0", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(apf_state, pia0_porta_r)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(apf_state, pia0_portb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(apf_state, pia0_ca2_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) + + MCFG_APF_CARTRIDGE_ADD("cartslot", apf_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "apfm1000") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apfimag, apfm1000 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( apfimag_map) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8K") + MCFG_RAM_EXTRA_OPTIONS("16K") + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) + + MCFG_DEVICE_ADD("pia1", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(apf_state, pia1_porta_r)) + MCFG_PIA_READPB_HANDLER(READ8(apf_state, pia1_portb_r)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(apf_state, pia1_portb_w)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(apf_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) + + MCFG_FD1771_ADD("fdc", 1000000) // guess + MCFG_FLOPPY_DRIVE_ADD("fdc:0", apf_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", apf_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + MCFG_SOFTWARE_LIST_ADD("cass_list", "apfimag_cass") +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(apfm1000) + ROM_REGION(0x1000,"roms", 0) + ROM_SYSTEM_BIOS( 0, "0", "Standard" ) + ROMX_LOAD("apf_4000.rom", 0x0000, 0x0800, CRC(cc6ac840) SHA1(1110a234bcad99bd0894ad44c591389d16376ca4), ROM_BIOS(1) ) + ROM_RELOAD(0x0800, 0x0800) + + ROM_SYSTEM_BIOS( 1, "trash", "Trash II" ) // In Rocket Patrol, the ships are replaced by garbage trucks + ROMX_LOAD("trash-ii.bin", 0x0000, 0x1000, CRC(3bd8640a) SHA1(da4cd8163990adbc5acd3eab604b41e1066bb832), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS( 2, "mod", "Mod Bios" ) // (c) 1982 W.Lunquist - In Basic, CALL 18450 to get a machine-language monitor + ROMX_LOAD("mod_bios.bin", 0x0000, 0x1000, CRC(f320aba6) SHA1(9442349fca8b001a5765e2fe8b84db4ece7886c1), ROM_BIOS(3) ) +ROM_END + +#define rom_apfimag rom_apfm1000 + +// old rom, has a bad byte at 0087. +//ROMX_LOAD("apf_4000.rom", 0x0000, 0x0800, CRC(2a331a33) SHA1(387b90882cd0b66c192d9cbaa3bec250f897e4f1), ROM_BIOS(1) ) + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP( 1979, apfimag, apfm1000, 0, apfimag, apfimag, driver_device, 0, "APF Electronics Inc.", "APF Imagination Machine", 0 ) +CONS( 1978, apfm1000, 0, 0, apfm1000, apfm1000, driver_device, 0, "APF Electronics Inc.", "APF M-1000", 0 ) diff --git a/src/mame/drivers/apogee.c b/src/mame/drivers/apogee.c new file mode 100644 index 00000000000..c6e6b5897f4 --- /dev/null +++ b/src/mame/drivers/apogee.c @@ -0,0 +1,280 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Apogee BK-01 driver by Miodrag Milanovic + + 05/06/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/wave.h" +#include "sound/speaker.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "imagedev/cassette.h" +#include "formats/rk_cas.h" +#include "includes/radio86.h" + + +class apogee_state : public radio86_state +{ +public: + apogee_state(const machine_config &mconfig, device_type type, const char *tag) + : radio86_state(mconfig, type, tag), + m_speaker(*this, "speaker") { } + + UINT8 m_out0; + UINT8 m_out1; + UINT8 m_out2; + DECLARE_WRITE_LINE_MEMBER(pit8253_out0_changed); + DECLARE_WRITE_LINE_MEMBER(pit8253_out1_changed); + DECLARE_WRITE_LINE_MEMBER(pit8253_out2_changed); + I8275_DRAW_CHARACTER_MEMBER(display_pixels); + + required_device m_speaker; +}; + + +/* Address maps */ +static ADDRESS_MAP_START(apogee_mem, AS_PROGRAM, 8, apogee_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x1000, 0xebff ) AM_RAM // RAM + AM_RANGE( 0xec00, 0xec03 ) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) AM_MIRROR(0x00fc) + AM_RANGE( 0xed00, 0xed03 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x00fc) + //AM_RANGE( 0xee00, 0xee03 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x00fc) + AM_RANGE( 0xef00, 0xef01 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x00fe) // video + AM_RANGE( 0xf000, 0xf0ff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( apogee ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgDn") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('X') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) +INPUT_PORTS_END + +static const INT16 speaker_levels[] = {-32767, -10922, 10922, 32767}; + +WRITE_LINE_MEMBER(apogee_state::pit8253_out0_changed) +{ + m_out0 = state; + m_speaker->level_w(m_out0+m_out1+m_out2); +} + +WRITE_LINE_MEMBER(apogee_state::pit8253_out1_changed) +{ + m_out1 = state; + m_speaker->level_w(m_out0+m_out1+m_out2); +} + +WRITE_LINE_MEMBER(apogee_state::pit8253_out2_changed) +{ + m_out2 = state; + m_speaker->level_w(m_out0+m_out1+m_out2); +} + +I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels) +{ + int i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + const UINT8 *charmap = m_charmap + (gpa & 1) * 0x400; + UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; + if(linecount == 8) + pixels = 0; + if (vsp) { + pixels = 0; + } + if (lten) { + pixels = 0xff; + } + if (rvv) { + pixels ^= 0xff; + } + for(i=0;i<6;i++) { + bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + } +} + +/* F4 Character Displayer */ +static const gfx_layout apogee_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( apogee ) + GFXDECODE_ENTRY( "gfx1", 0x0000, apogee_charlayout, 0, 1 ) +GFXDECODE_END + + +/* Machine driver */ +static MACHINE_CONFIG_START( apogee, apogee_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, XTAL_16MHz / 9) + MCFG_CPU_PROGRAM_MAP(apogee_mem) + MCFG_MACHINE_RESET_OVERRIDE(apogee_state, radio86 ) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_16MHz/9) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(apogee_state,pit8253_out0_changed)) + MCFG_PIT8253_CLK1(XTAL_16MHz/9) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(apogee_state,pit8253_out1_changed)) + MCFG_PIT8253_CLK2(XTAL_16MHz/9) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(apogee_state,pit8253_out2_changed)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) + + //MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + + MCFG_DEVICE_ADD("i8275", I8275, XTAL_16MHz / 12) + MCFG_I8275_CHARACTER_WIDTH(6) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(apogee_state, display_pixels) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma8257",i8257_device, dreq2_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(78*6, 30*10) + MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", apogee) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(apogee_state,radio86) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(4, speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(radio86_state, hrq_w)) + MCFG_I8257_IN_MEMR_CB(READ8(radio86_state, memory_read_byte)) + MCFG_I8257_OUT_MEMW_CB(WRITE8(radio86_state, memory_write_byte)) + MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("i8275", i8275_device, dack_w)) + MCFG_I8257_REVERSE_RW_MODE(1) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rka_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("apogee_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","apogee") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( apogee ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "apogee.rom", 0xf000, 0x1000, CRC(a47383a7) SHA1(6a868371c7980f92c2fc9ced921517209f197375)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("apogee.fnt", 0x0000, 0x0800, CRC(fe5867f0) SHA1(82c5aca63ada5e4533eb0516384aaa7b77a1f8e2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, apogee, radio86,0, apogee, apogee, radio86_state,radio86, "Zavod BRA", "Apogee BK-01", 0) diff --git a/src/mame/drivers/apollo.c b/src/mame/drivers/apollo.c new file mode 100644 index 00000000000..1c41ed2c7d9 --- /dev/null +++ b/src/mame/drivers/apollo.c @@ -0,0 +1,1276 @@ +// license:BSD-3-Clause +// copyright-holders:Hans Ostermeyer, R. Belmont +/* + * apollo.c - APOLLO DN3500/DN3000 driver + * + * Created on: May 12, 2010 + * Author: Hans Ostermeyer + * + * Adapted February 19, 2012 for general MAME/MESS standards by R. Belmont + * + * TODO: use MESS ram device and MCFG_RAM_* to handle RAM sizing. + * Remove need for instruction hook. + * Convert to modern address map. + * + * see also: + * - Domain Series 3000/Series 4000 Hardware Architecture Handbook (Order No. 007861 Rev. 02) + * - Domain Personal Workstations and Servers Technical Reference (Apollo Order No. 008778-A01) + * - Servicing the Domain Personal Workstations and Servers (Apollo Order No. 007859-A01) + * - http://www.bitsavers.org/pdf/apollo/002398-04_Domain_Engineering_Handbook_Rev4_Jan87.pdf + * - http://www.bitsavers.org/pdf/apollo/008778-03_DOMAIN_Series_3000_4000_Technical_Reference_Aug87.pdf + * - http://www.bitsavers.org/pdf/apollo/AEGIS_Internals_and_Data_Structures_Jan86.pdf + * - http://www.bitsavers.org/pdf/apollo/019411-A00_Addendum_to_Domain_Personal_Workstations_and_Servers_Hardware_Architecture_Handbook_1991.pdf + * - data sheets from Intel and Motorola + */ + +#define VERBOSE 0 + +#include "includes/apollo.h" +#include "debugger.h" +#include "cpu/m68000/m68kcpu.h" +#include "sound/beep.h" +#include "apollo_dsp.lh" + +// we use set_verbose +#include "bus/isa/omti8621.h" +#include "bus/isa/3c505.h" + +#define TERMINAL_TAG "terminal" + +// we use this to prevent excessive logging (if emulation runs amok) +// error.log will be 10 MB for 100000 lines +#define APOLLO_MAX_NO_OF_LOG_LINES 1000000 + +// ISA/AT Bus notes +// I/O space: to get the Apollo address = take the PC I/O address, keep the low 3 bits how they are, and shift the rest left 7, inserting zeros. +// then add 0x40000 for the I/O base. +// +// example: 3c503 Ethernet is at I/O 300h on PC, which is (%1100000000 -> 1 1000 0000 0000 0000) + 0x40000 = 0x58000 +// +// Memory space: addresses from 0x80000 to 0xffffff are supported, including the possibility of stock PC MDA at a0000 + +#define ATBUS_IO_BASE 0x040000 +#define ATBUS_IO_END 0x05ffff +#define ATBUS_MEMORY_BASE 0x080000 +#define ATBUS_MEMORY_END 0xffffff + +#define DN3500_RAM_SIZE 16 // 8, 16 or 32 MB + +#if DN3500_RAM_SIZE == 8 +#define DN3500_RAM_BASE 0x1000000 +#define DN3500_RAM_END 0x17fffff +#define DN3500_RAM_CONFIG_BYTE 0x64 // 4-4-0-0 +#elif DN3500_RAM_SIZE == 16 +#define DN3500_RAM_BASE 0x1000000 +#define DN3500_RAM_END 0x1ffffff +#define DN3500_RAM_CONFIG_BYTE 0x60 // 4-4-4-4 +#else /* DN3500_RAM_SIZE == 32 */ +#define DN3500_RAM_BASE 0x1000000 +#define DN3500_RAM_END 0x3ffffff +#define DN3500_RAM_CONFIG_BYTE 0x20 // 8-8-8-8 +#endif + +#define DN3000_RAM_BASE 0x100000 +#define DN3000_RAM_END 0x8fffff +#define DN3000_RAM_CONFIG_8MB 0x20 // 2-2-2-2 + +#define DN5500_RAM_SIZE 32 // 16 or 32 MB + +#if DN5500_RAM_SIZE == 16 +#define DN5500_RAM_BASE 0x1000000 +#define DN5500_RAM_END 0x1ffffff +#define DN5500_RAM_CONFIG_BYTE 0x14 // 8-8-0-0 +#define DN5500_MEM_PRESENT_BYTE 0xAA // 8-8-0-0 +#else /* DN5500_RAM_SIZE == 32 */ +#define DN5500_RAM_BASE 0x1000000 +#define DN5500_RAM_END 0x2ffffff +#define DN5500_RAM_CONFIG_BYTE 0x20 // 8-8-8-8 +#define DN5500_MEM_PRESENT_BYTE 0x00 // 8-8-8-8 +#endif + +#define NODE_TYPE_DN3000 3000 +#define NODE_TYPE_DN3500 3500 +#define NODE_TYPE_DN5500 5500 +#define NODE_TYPE_DSP3000 -3000 +#define NODE_TYPE_DSP3500 -3500 +#define NODE_TYPE_DSP5500 -5500 + +#define DEFAULT_NODE_ID 0x12345 + +static UINT8 cache_control_register = 0x00; +static UINT8 cache_status_register = 0xff; +static UINT8 task_alias_register = 0x00; + +static offs_t parity_error_offset = 0; +static UINT16 parity_error_byte_mask = 0; +static int parity_error_handler_is_installed = 0; +static int parity_error_handler_install_counter = 0; + +static UINT16 latch_page_on_parity_error_register = 0x0000; +static UINT16 master_req_register = 0x0000; + +// DN3000: Node Id 1D117 at 0x9600 - 0x961f +// DN3500: Node Id 2616D at 0x11200 - 0x1121f + +static UINT32 node_id = DEFAULT_NODE_ID; + +static UINT32 ram_base_address; +static UINT32 ram_end_address; + +static int node_type; + +// FIXME: value of ram_config_byte must match with default/selected RAM size +static UINT8 ram_config_byte; + +static UINT32 log_line_counter = 0; + +/*************************************************************************** + cpu_context - return a string describing which CPU is currently executing and their PC + ***************************************************************************/ + +const char *apollo_cpu_context(device_t *cpu) { + static char statebuf[64]; /* string buffer containing state description */ + + /* if we have an executing CPU, output data */ + if (cpu != NULL) { + osd_ticks_t t = osd_ticks(); + int s = t / osd_ticks_per_second(); + int ms = (t % osd_ticks_per_second()) / 1000; + + sprintf(statebuf, "%d.%03d %s pc=%08x", s, ms, cpu->tag(), cpu->safe_pcbase()); + } else { + strcpy(statebuf, "(no context)"); + } + return statebuf; +} + +/*------------------------------------------------- + apollo_set_cpu_has_fpu - enable/disable the FPU + -------------------------------------------------*/ + +void apollo_set_cpu_has_fpu(m68000_base_device *device, int onoff) +{ + if (device == NULL || (device->type() != M68020PMMU && device->type() != M68030)) + { + DLOG1(("set_cpu_has_fpu: unexpected CPU device")); + } + else + { + device->has_fpu = onoff; + DLOG1(("apollo_set_cpu_has_fpu: FPU has been %s", onoff ? "enabled" : "disabled")); + } +} + +/*************************************************************************** + apollo_check_log - check for excessive logging + ***************************************************************************/ + +void apollo_check_log() { + if (++log_line_counter >= APOLLO_MAX_NO_OF_LOG_LINES) { + fatalerror("apollo_check_log: maximum number of log lines exceeded.\n"); + } +} + +/*************************************************************************** + apollo_is_dn3000 - return 1 if node is DN3000 or DSP3000, 0 otherwise + ***************************************************************************/ + +int apollo_is_dn3000(void) { + return node_type == NODE_TYPE_DN3000 || node_type == NODE_TYPE_DSP3000; +} + +/*************************************************************************** + apollo_is_dn5500 - return 1 if node is DN5500 or DSP5500, 0 otherwise + ***************************************************************************/ + +int apollo_is_dn5500(void) { + return node_type == NODE_TYPE_DN5500 || node_type == NODE_TYPE_DSP5500; +} + +/*************************************************************************** + apollo_is_dsp3x00 - return 1 if node is DSP3x00 or DSP5500, 0 otherwise + ***************************************************************************/ + +int apollo_is_dsp3x00(void) { + switch (node_type) + { + case NODE_TYPE_DSP3000: + case NODE_TYPE_DSP3500: + case NODE_TYPE_DSP5500: + return 1; + } + return 0; +} + +/*************************************************************************** + apollo_get_ram_config_byte - get the ram configuration byte + ***************************************************************************/ + +UINT8 apollo_get_ram_config_byte(void) { + return ram_config_byte; +} + +/*************************************************************************** + apollo_get_node_id - get the node id + ***************************************************************************/ + +UINT32 apollo_get_node_id(void) { + return node_id; +} + +/*************************************************************************** + apollo_instruction_hook + must be called by the CPU core before executing each instruction +***************************************************************************/ +READ32_MEMBER(apollo_state::apollo_instruction_hook) +{ + static UINT16 idle_counter = 0; + + // m_maincpu->ir still has previous instruction + UINT16 last_ir = m_maincpu->ir; + + // get next instruction (or 0 if unavailable) + UINT16 next_ir = (m_maincpu->pref_addr == REG_PC(m_maincpu)) ? m_maincpu->pref_data : 0; + + // check for NULLPROC: + // 027C F8FF AND.W #F8FF,SR + // 60FA BRA *-4 + + if ((next_ir == 0x60fa && last_ir == 0x027c) || (next_ir == 0x027c && last_ir == 0x60fa)) + { + // we are within the idle loop, slow down CPU to reduce power usage + m_maincpu->remaining_cycles -= 500; + + if (apollo_config(APOLLO_CONF_IDLE_SLEEP) && apollo_is_dsp3x00() && ++idle_counter >= 1000) + { + // slow down even more on DSP3x00 + idle_counter -= 100; + // sleep 1 ms + osd_sleep(osd_ticks_per_second() / 1000); + } + } + else + { + // we are outside of the idle loop + idle_counter = 0; + } + + if (!m_maincpu->has_fpu && !m_maincpu->pmmu_enabled && (m_maincpu->ir & 0xff00) == 0xf200) + { + // set APOLLO_CSR_SR_FP_TRAP in cpu status register for /sau7/self_test + apollo_csr_set_status_register(APOLLO_CSR_SR_FP_TRAP, APOLLO_CSR_SR_FP_TRAP); + } + + if (m_maincpu->t1_flag && !m_maincpu->s_flag) + { + // FIXME: trace emulation is disabled in m68kcpu.h; why??? + m68ki_exception_trace(m_maincpu); + } + + return apollo_debug_instruction_hook(m_maincpu, offset); +} + +/*************************************************************************** + apollo bus error + ***************************************************************************/ + +void apollo_state::apollo_bus_error() +{ + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + + apollo_csr_set_status_register(APOLLO_CSR_SR_CPU_TIMEOUT, APOLLO_CSR_SR_CPU_TIMEOUT); +} + +IRQ_CALLBACK_MEMBER(apollo_state::apollo_irq_acknowledge) +{ + int result = M68K_INT_ACK_AUTOVECTOR; + + m_maincpu->set_input_line(irqline, CLEAR_LINE); + + MLOG2(("apollo_irq_acknowledge: interrupt level=%d", irqline)); + + if (irqline == 6) { + result = apollo_pic_acknowledge(device, irqline); + } + return result; +} + +/*************************************************************************** + DN3500 Cache Control/Status Register at 0x10200 + ***************************************************************************/ + +WRITE8_MEMBER(apollo_state::cache_control_register_w){ + if (apollo_is_dn5500()) + { + SLOG1(("Error: writing DN5500 Cache Status Register at offset %02x = %02x", offset, data)); + } + else + { + cache_control_register = data; + cache_status_register = (cache_status_register & 0x7f) | (cache_control_register & 0x80); + SLOG2(("writing Cache Control Register at offset %02x = %02x", offset, data)); + } +} + +READ8_MEMBER(apollo_state::cache_status_register_r){ + UINT8 data = cache_status_register; + + if (apollo_is_dn5500()) { +#define DN5500_CSR_NOT_HSI_PRESENT 8 +#define DN5500_CSR_MEM_TIME 1 + data |= DN5500_CSR_NOT_HSI_PRESENT; + } + + SLOG2(("reading Cache Status Register at offset %02x = %02x", offset, data)); + return data; +} + +void apollo_set_cache_status_register(UINT8 mask, UINT8 data) { + UINT16 new_value = (cache_status_register & ~mask) | (data & mask); + if (new_value != cache_status_register) { + cache_status_register = new_value; + LOG2(("setting Cache Status Register with data=%02x and mask=%02x to %02x", + data, mask, cache_status_register)); + } +} + +/*************************************************************************** + DN3500 Task Alias Register at 0x10300 + ***************************************************************************/ + +WRITE8_MEMBER(apollo_state::task_alias_register_w){ + task_alias_register = data; + apollo_set_cache_status_register(0x07, data); + SLOG(("writing Task Alias Register at offset %02x = %02x",offset, data)); +} + +READ8_MEMBER(apollo_state::task_alias_register_r){ + UINT8 data = 0xff; + SLOG(("reading Task Alias Register at offset %02x = %02x", offset, data)); + return data; +} + +/*************************************************************************** + DN3000/DN3500 Node Id PROM at 0x9600/0x11200 + ***************************************************************************/ + +WRITE16_MEMBER(apollo_state::apollo_node_id_w){ + SLOG1(("Error: writing node id ROM at offset %02x = %04x & %04x", offset, data, mem_mask)); +} + +READ16_MEMBER(apollo_state::apollo_node_id_r){ + UINT16 data; + switch (offset & 0x0f) { + case 1: // msb + data = (node_id >> 16) & 0xff; + break; + case 2: + data = (node_id >> 8) & 0xff; + break; + case 3: // lsb + data = node_id & 0xff; + break; + case 15: // checksum + data = ((node_id >> 16) + (node_id >> 8) + node_id) & 0xff; + break; + default: + data = 0; + break; + } + data <<= 8; + SLOG2(("reading node id ROM at offset %02x = %04x & %04x", offset, data, mem_mask)); + return data; +} + +/*************************************************************************** + DN3000/DN3500 Latch Page on Parity Error Register at 0x9300/0x11300 + ***************************************************************************/ + +WRITE16_MEMBER(apollo_state::latch_page_on_parity_error_register_w){ + latch_page_on_parity_error_register = data; + SLOG1(("writing Latch Page on Error Parity Register at offset %02x = %04x", offset*2, data)); +} + +READ16_MEMBER(apollo_state::latch_page_on_parity_error_register_r){ + UINT16 data = latch_page_on_parity_error_register; + SLOG2(("reading Latch Page on Error Parity Register at offset %02x = %04x", offset*2, data)); + return data; +} + +/*************************************************************************** + DN3500 Master REQ Register at 0x11600 + ***************************************************************************/ + +WRITE8_MEMBER(apollo_state::master_req_register_w){ + master_req_register = data; + SLOG2(("writing Master REQ Register at offset %02x = %02x", offset, data)); +} + +READ8_MEMBER(apollo_state::master_req_register_r){ + UINT8 data = 0xff; + SLOG1(("reading Master REQ Register at offset %02x = %02x", offset, data)); + return data; +} + +/*************************************************************************** + DN3500 Selective Clear Locations at 0x11600 + ***************************************************************************/ + +WRITE16_MEMBER(apollo_state::selective_clear_locations_w){ + SLOG2(("writing Selective Clear Locations at offset %02x = %02x", offset*2, data)); + switch (offset * 2) { + case 0x00: // Clear All + apollo_csr_set_status_register(APOLLO_CSR_SR_CLEAR_ALL, 0); + break; + case 0x04: // clear floating-point trap + apollo_csr_set_status_register(APOLLO_CSR_SR_FP_TRAP, 0); + break; + case 0x06: // clear Parity error interrupt + apollo_csr_set_status_register(APOLLO_CSR_SR_PARITY_BYTE_MASK, 0); + break; + case 0x08: // clear Bus Error Status (CPU Timeout) + apollo_csr_set_status_register(APOLLO_CSR_SR_CPU_TIMEOUT, 0); + break; + case 0x0e: // Clear (Flush) Cache + break; + } +} + +READ16_MEMBER(apollo_state::selective_clear_locations_r){ + UINT16 data = 0xffff; + SLOG1(("reading Selective Clear Locations at offset %02x = %02x", offset*2, data)); + return data; +} + +/*************************************************************************** + DN3000/DN3500 RAM with parity (and null proc loop delay for DomainOS) + ***************************************************************************/ + +READ32_MEMBER(apollo_state::ram_with_parity_r){ + UINT32 data = m_messram_ptr[parity_error_offset+offset]; + + SLOG2(("memory dword read with parity error at %08x = %08x & %08x parity_byte=%04x", + ram_base_address + parity_error_offset*4 + offset*4,data, mem_mask, parity_error_byte_mask)); + + if (parity_error_byte_mask != 0) { + latch_page_on_parity_error_register = (ram_base_address + parity_error_offset * 4) >> 10; + + apollo_csr_set_status_register(APOLLO_CSR_CR_PARITY_BYTE_MASK, apollo_csr_get_status_register() |parity_error_byte_mask); + + if (apollo_csr_get_control_register() & APOLLO_CSR_CR_INTERRUPT_ENABLE) { + // force parity error (if NMI is enabled) +// cpu_set_input_line_and_vector(&space.device(), 7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + m_maincpu->set_input_line_and_vector(7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + + } + } + return data; +} + +WRITE32_MEMBER(apollo_state::ram_with_parity_w){ + COMBINE_DATA(m_messram_ptr+offset); + + if (apollo_csr_get_control_register() & APOLLO_CSR_CR_FORCE_BAD_PARITY) { + parity_error_byte_mask = (apollo_csr_get_control_register() + & APOLLO_CSR_CR_PARITY_BYTE_MASK); + + if (!apollo_is_dn3000()) { + parity_error_byte_mask ^= APOLLO_CSR_CR_PARITY_BYTE_MASK; + } + + parity_error_offset = offset; + +// SLOG1(("memory dword write with parity to %08x = %08x & %08x parity_byte=%04x", +// ram_base_address +offset * 4, data, mem_mask, parity_error_byte_mask)); + + if (parity_error_handler_is_installed == 0) { + // no more than 192 read/write handlers may be used + // see table_assign_handler in memory.c + if (parity_error_handler_install_counter < 40) { + //memory_install_read32_handler(space, ram_base_address+offset*4, ram_base_address+offset*4+3, 0xffffffff, 0, ram_with_parity_r); + space.install_read_handler(ram_base_address+offset*4, ram_base_address+offset*4+3, 0xffffffff,0,read32_delegate(FUNC(apollo_state::ram_with_parity_r),this)); + parity_error_handler_is_installed = 1; + parity_error_handler_install_counter++; + } + } + } else if (parity_error_handler_is_installed && offset == parity_error_offset) { + SLOG1(("memory dword write with parity to %08x = %08x & %08x reset %d", + ram_base_address +parity_error_offset*4, data, mem_mask, parity_error_handler_install_counter)); + + // uninstall not supported, reinstall previous read handler instead + + // memory_install_rom(space, ram_base_address, ram_end_address, 0xffffffff, 0, messram_ptr.v); + space.install_rom(ram_base_address,ram_end_address,0xffffffff,0,&m_messram_ptr[0]); + + parity_error_handler_is_installed = 0; + parity_error_byte_mask = 0; + } +} + +/*************************************************************************** + DN3000/DN3500 unmapped memory + ***************************************************************************/ + +READ32_MEMBER(apollo_state::apollo_unmapped_r) +{ + offs_t address = offset * 4; + + m68000_base_device *m68k = m_maincpu; + + if ((address & 0xfff00000) == 0xfa800000 && VERBOSE < 2) { + // ? + } else if ((address & 0xfff00ff7) == 0xfd800000 && VERBOSE < 2) { + // omit logging for memory sizing in FPA address space + // strange: MD seems to search for the 3C505 Boot ROM + // note (6.10.2010): might be color7 address space (!?!) + } else if ((address & 0xfc03ffff) == 0x00000000 && VERBOSE < 2) { + // omit logging for memory sizing in standalone utilities + } else if (address == 0xfff90000 && VERBOSE < 2) { + // omit logging for FPA trial access + } else if (address == 0x00030000 && VERBOSE < 2) { + // omit logging for Bus error test address in DN3500 boot prom and self_test + } else if (address == 0x0000ac00 && VERBOSE < 2) { + // omit logging for Bus error test address in DN3000 boot prom + } else { + SLOG1(("unmapped memory dword read from %08x with mask %08x (ir=%04x)", address , mem_mask, m68k->ir)); + } + + /* unmapped; access causes a bus error */ + apollo_bus_error(); + return 0xffffffff; +} + +WRITE32_MEMBER(apollo_state::apollo_unmapped_w) +{ + SLOG(("unmapped memory dword write to %08x = %08x & %08x", offset * 4, data, mem_mask)); + + /* unmapped; access causes a bus error */ + apollo_bus_error(); +} + +/*************************************************************************** + DN3000/DN3500 ROM write + ***************************************************************************/ + +WRITE32_MEMBER(apollo_state::apollo_rom_w) +{ + offs_t address = offset * 4; + offs_t pc = space.device().safe_pcbase(); + + if (pc == 0x00002c1c && address == 0x00000004 && VERBOSE < 2) { + // don't log invalid code in 3500_boot_12191_7.bin + } else { + SLOG1(("ROM dword write to %08x = %08x & %08x", offset * 4, data, mem_mask)); + } +} + +/*************************************************************************** + DN3000/DN3500 AT Bus I/O space + ***************************************************************************/ + +READ16_MEMBER(apollo_state::apollo_atbus_io_r) +{ + UINT32 isa_addr = (offset & 3) + ((offset & ~0x1ff) >> 7); + + // Motorola CPU is MSB first, ISA Bus is LSB first + UINT16 data = m_isa->io16_swap_r(space, isa_addr, mem_mask); + + SLOG2(("apollo_atbus_io_r at %08x -> %04x = %04x & %04x", offset*2, isa_addr*2, data, mem_mask)); + + return data; +} + +WRITE16_MEMBER(apollo_state::apollo_atbus_io_w) +{ + UINT32 isa_addr = (offset & 3) + ((offset & ~0x1ff) >> 7); + + SLOG2(("apollo_atbus_io_w at %08x -> %04x = %04x & %04x", offset*2, isa_addr*2, data, mem_mask)); + + // Motorola CPU is MSB first, ISA Bus is LSB first + m_isa->io16_swap_w(space, isa_addr, data, mem_mask); +} + +/*************************************************************************** + DN3000/DN3500 AT Bus memory space + ***************************************************************************/ + +READ16_MEMBER(apollo_state::apollo_atbus_memory_r) +{ + // Motorola CPU is MSB first, ISA Bus is LSB first + UINT16 data = m_isa->prog16_swap_r(space, offset, mem_mask); + + SLOG2(("apollo_atbus_memory_r at %08x = %04x & %04x", offset*2, data, mem_mask)); + + return data; +} + +WRITE16_MEMBER(apollo_state::apollo_atbus_memory_w) +{ + SLOG2(("apollo_atbus_memory_w at %08x = %04x & %04x", offset*2, data, mem_mask)); + + // Motorola CPU is MSB first, ISA Bus is LSB first + m_isa->prog16_swap_w(space, offset, data, mem_mask); +} + +/*************************************************************************** + DN5500 Memory Present Register at 0x11400-0x114ff + Strange: documented but not used + ***************************************************************************/ + +WRITE8_MEMBER(apollo_state::dn5500_memory_present_register_w){ + SLOG(("Error: writing DN5500 Memory Present Register at offset %02x = %02x", offset, data)); +} + +READ8_MEMBER(apollo_state::dn5500_memory_present_register_r){ + UINT8 data = DN5500_MEM_PRESENT_BYTE; + SLOG(("reading DN5500 Memory Present Register at offset %02x = %02x", offset, data)); + return data; +} + +/*************************************************************************** + DN5500 11500 Registers at 0x11500-0x115ff (undocumented, what does it do?) + ***************************************************************************/ + +WRITE8_MEMBER(apollo_state::dn5500_11500_w){ + SLOG1(("writing DN5500 11500 at offset %02x = %02x", offset, data)); +} + +READ8_MEMBER(apollo_state::dn5500_11500_r){ + UINT8 data = 0xff; + SLOG1(("reading DN5500 11500 at offset %02x = %02x", offset, data)); + return data; +} + +/*************************************************************************** + DN5500 I/O Protection Map at 0x7000000-0x700FFFF + ***************************************************************************/ + +WRITE8_MEMBER(apollo_state::dn5500_io_protection_map_w){ + // TODO + SLOG1(("writing DN5500 I/O Protection Map at offset %02x = %02x", offset, data)); +} + +READ8_MEMBER(apollo_state::dn5500_io_protection_map_r){ + UINT8 data = 0xff; + SLOG1(("reading DN5500 I/O Protection Map at offset %02x = %02x", offset, data)); + return data; +} + +#if 0 +/*************************************************************************** + DN3000/DN3500 at f8000000 - ffffffff (used by fpa and/or color7?) + ***************************************************************************/ + +READ32_MEMBER(apollo_state::apollo_f8_r){ + offs_t address = 0xf8000000 + offset * 4; + UINT32 data = 0xffffffff; + SLOG2(("unexpected memory dword read from %08x = %08x & %08x", + address, data, mem_mask)); + return data; +} + +WRITE32_MEMBER(apollo_state::apollo_f8_w){ + offs_t address = 0xf8000000 +offset * 4; + + SLOG2(("unexpected memory dword write to %08x = %08x & %08x", + address, data, mem_mask)); +} +#endif + +/*************************************************************************** + ADDRESS MAPS + ***************************************************************************/ + +static ADDRESS_MAP_START(dn3500_map, AS_PROGRAM, 32, apollo_state ) + AM_RANGE(0x000000, 0x00ffff) AM_ROM /* boot ROM */ + AM_RANGE(0x000000, 0x00ffff) AM_WRITE(apollo_rom_w) + AM_RANGE(0x010000, 0x0100ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) + AM_RANGE(0x010100, 0x0101ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) + AM_RANGE(0x010200, 0x0102ff) AM_READWRITE8(cache_status_register_r, cache_control_register_w, 0xffffffff ) + AM_RANGE(0x010300, 0x0103ff) AM_READWRITE8(task_alias_register_r , task_alias_register_w , 0xffffffff ) + AM_RANGE(0x010400, 0x0104ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) + AM_RANGE(0x010500, 0x0105ff) AM_DEVREADWRITE8(APOLLO_SIO2_TAG, mc68681_device, read, write, 0x00ff00ff ) + AM_RANGE(0x010800, 0x0108ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) + AM_RANGE(0x010900, 0x0109ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) + AM_RANGE(0x010c00, 0x010cff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) + AM_RANGE(0x010d00, 0x010dff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) + AM_RANGE(0x011000, 0x0110ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x011100, 0x0111ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x011200, 0x0112ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) + AM_RANGE(0x011300, 0x0113ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) + AM_RANGE(0x011600, 0x0116ff) AM_READWRITE8(master_req_register_r, master_req_register_w, 0xffffffff) + + AM_RANGE(0x016400, 0x0164ff) AM_READWRITE16(selective_clear_locations_r, selective_clear_locations_w, 0xffffffff ) + AM_RANGE(0x017000, 0x017fff) AM_READWRITE16(apollo_address_translation_map_r, apollo_address_translation_map_w, 0xffffffff ) + + AM_RANGE(0x05d800, 0x05dc07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mcr_r, apollo_mcr_w, 0xffffffff) + AM_RANGE(0xfa0000, 0xfdffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mgm_r, apollo_mgm_w, 0xffffffff) + + AM_RANGE(0x05e800, 0x05ec07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_ccr_r, apollo_ccr_w, 0xffffffff) + AM_RANGE(0x0a0000, 0x0bffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_cgm_r, apollo_cgm_w, 0xffffffff) + + AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) + + // FIXME: must match with RAM size in driver/apollo_sio.c + // AM_RANGE(DN3500_RAM_BASE, DN3500_RAM_END) AM_RAM /* 8MB RAM */ + AM_RANGE(DN3500_RAM_BASE, DN3500_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") + + AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) + +// AM_RANGE(0x03020000, 0x0303ffff) Cache Tag Store (DN4500 only) +// AM_RANGE(0x04000000, 0x0400ffff) Cache Tag Data (DN4500 only) +// AM_RANGE(0x0e000000, 0x0fffffff) FPA address space + +// AM_RANGE(0xf8000000, 0xffffffff) AM_READWRITE(apollo_f8_r, apollo_f8_w) + AM_RANGE(0x00000000, 0xffffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(dsp3500_map, AS_PROGRAM, 32, apollo_state ) + AM_RANGE(0x000000, 0x00ffff) AM_ROM /* boot ROM */ + AM_RANGE(0x000000, 0x00ffff) AM_WRITE(apollo_rom_w) + AM_RANGE(0x010000, 0x0100ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) + AM_RANGE(0x010100, 0x0101ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) + AM_RANGE(0x010200, 0x0102ff) AM_READWRITE8(cache_status_register_r, cache_control_register_w, 0xffffffff ) + AM_RANGE(0x010300, 0x0103ff) AM_READWRITE8(task_alias_register_r , task_alias_register_w , 0xffffffff ) + AM_RANGE(0x010400, 0x0104ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) + AM_RANGE(0x010500, 0x0105ff) AM_DEVREADWRITE8(APOLLO_SIO2_TAG, mc68681_device, read, write, 0x00ff00ff ) + AM_RANGE(0x010800, 0x0108ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) + AM_RANGE(0x010900, 0x0109ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) + AM_RANGE(0x010c00, 0x010cff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) + AM_RANGE(0x010d00, 0x010dff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) + AM_RANGE(0x011000, 0x0110ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x011100, 0x0111ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x011200, 0x0112ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) + AM_RANGE(0x011300, 0x0113ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) + AM_RANGE(0x011600, 0x0116ff) AM_READWRITE8(master_req_register_r, master_req_register_w, 0xffffffff) + + AM_RANGE(0x016400, 0x0164ff) AM_READWRITE16(selective_clear_locations_r, selective_clear_locations_w, 0xffffffff ) + AM_RANGE(0x017000, 0x017fff) AM_READWRITE16(apollo_address_translation_map_r, apollo_address_translation_map_w, 0xffffffff ) + + AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) + + AM_RANGE(DN3500_RAM_BASE, DN3500_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") + + AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) + +// AM_RANGE(0xf8000000, 0xffffffff) AM_READWRITE(apollo_f8_r, apollo_f8_w) + AM_RANGE(0x00000000, 0xffffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(dn3000_map, AS_PROGRAM, 32, apollo_state ) + AM_RANGE(0x000000, 0x007fff) AM_ROM /* boot ROM */ + AM_RANGE(0x000000, 0x007fff) AM_WRITE(apollo_rom_w) + AM_RANGE(0x008000, 0x0080ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) + AM_RANGE(0x008100, 0x0081ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) + AM_RANGE(0x008400, 0x0087ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) + AM_RANGE(0x008800, 0x0088ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) + AM_RANGE(0x008900, 0x0089ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) + AM_RANGE(0x009000, 0x0090ff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) + AM_RANGE(0x009100, 0x0091ff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) + AM_RANGE(0x009200, 0x0092ff) AM_READWRITE8(apollo_dma_page_register_r, apollo_dma_page_register_w, 0xffffffff ) + AM_RANGE(0x009300, 0x0093ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) + AM_RANGE(0x009400, 0x0094ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x009500, 0x0095ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x009600, 0x0096ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) + + AM_RANGE(0x05d800, 0x05dc07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mcr_r, apollo_mcr_w, 0xffffffff) + AM_RANGE(0xfa0000, 0xfdffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mgm_r, apollo_mgm_w, 0xffffffff) + + AM_RANGE(0x05e800, 0x05ec07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_ccr_r, apollo_ccr_w, 0xffffffff) + AM_RANGE(0x0a0000, 0x0bffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_cgm_r, apollo_cgm_w, 0xffffffff) + + AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) + + // FIXME: must match with RAM size in driver/apollo_sio.c + // AM_RANGE(DN3000_RAM_BASE, DN3000_RAM_END) AM_RAM /* 8MB RAM */ + AM_RANGE(DN3000_RAM_BASE, DN3000_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") + + AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) + + AM_RANGE(0x000000, 0xffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(dsp3000_map, AS_PROGRAM, 32, apollo_state ) + AM_RANGE(0x000000, 0x007fff) AM_ROM /* boot ROM */ + AM_RANGE(0x000000, 0x007fff) AM_WRITE(apollo_rom_w) + AM_RANGE(0x008000, 0x0080ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) + AM_RANGE(0x008100, 0x0081ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) + AM_RANGE(0x008400, 0x0087ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) + AM_RANGE(0x008800, 0x0088ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) + AM_RANGE(0x008900, 0x0089ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) + + AM_RANGE(0x009000, 0x0090ff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) + AM_RANGE(0x009100, 0x0091ff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) + AM_RANGE(0x009200, 0x0092ff) AM_READWRITE8(apollo_dma_page_register_r, apollo_dma_page_register_w, 0xffffffff ) + AM_RANGE(0x009300, 0x0093ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) + AM_RANGE(0x009400, 0x0094ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x009500, 0x0095ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x009600, 0x0096ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) + + AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) + + // FIXME: must match with RAM size in driver/apollo_sio.c + // AM_RANGE(DN3000_RAM_BASE, DN3000_RAM_END) AM_RAM /* 8MB RAM */ + AM_RANGE(DN3000_RAM_BASE, DN3000_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") + + AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) + + AM_RANGE(0x000000, 0xffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(dn5500_map, AS_PROGRAM, 32, apollo_state ) + AM_RANGE(0x000000, 0x00ffff) AM_ROM /* boot ROM */ + AM_RANGE(0x000000, 0x00ffff) AM_WRITE(apollo_rom_w) + AM_RANGE(0x010000, 0x0100ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) + AM_RANGE(0x010100, 0x0101ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) + AM_RANGE(0x010200, 0x0102ff) AM_READWRITE8(cache_status_register_r, cache_control_register_w, 0xffffffff ) + AM_RANGE(0x010300, 0x0103ff) AM_READWRITE8(task_alias_register_r , task_alias_register_w , 0xffffffff ) + AM_RANGE(0x010400, 0x0104ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) + AM_RANGE(0x010500, 0x0105ff) AM_DEVREADWRITE8(APOLLO_SIO2_TAG, mc68681_device, read, write, 0x00ff00ff ) + AM_RANGE(0x010800, 0x0108ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) + AM_RANGE(0x010900, 0x0109ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) + AM_RANGE(0x010c00, 0x010cff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) + AM_RANGE(0x010d00, 0x010dff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) + AM_RANGE(0x011000, 0x0110ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x011100, 0x0111ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x011200, 0x0112ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) + AM_RANGE(0x011300, 0x0113ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) + AM_RANGE(0x011400, 0x0114ff) AM_READWRITE8(dn5500_memory_present_register_r, dn5500_memory_present_register_w, 0xffffffff ) + AM_RANGE(0x011500, 0x0115ff) AM_READWRITE8(dn5500_11500_r, dn5500_11500_w, 0xffffffff ) + AM_RANGE(0x011600, 0x0116ff) AM_READWRITE8(master_req_register_r, master_req_register_w, 0xffffffff) + + AM_RANGE(0x016400, 0x0164ff) AM_READWRITE16(selective_clear_locations_r, selective_clear_locations_w, 0xffffffff ) + AM_RANGE(0x017000, 0x017fff) AM_READWRITE16(apollo_address_translation_map_r, apollo_address_translation_map_w, 0xffffffff ) + + AM_RANGE(0x05d800, 0x05dc07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mcr_r, apollo_mcr_w, 0xffffffff) + AM_RANGE(0xfa0000, 0xfdffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mgm_r, apollo_mgm_w, 0xffffffff) + + AM_RANGE(0x05e800, 0x05ec07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_ccr_r, apollo_ccr_w, 0xffffffff) + AM_RANGE(0x0a0000, 0x0bffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_cgm_r, apollo_cgm_w, 0xffffffff) + + AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) + + // FIXME: must match with RAM size in driver/apollo_sio.c + // AM_RANGE(DN3500_RAM_BASE, DN3500_RAM_END) AM_RAM /* 8MB RAM */ + AM_RANGE(DN5500_RAM_BASE, DN5500_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") + + AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) + +// AM_RANGE(0x03020000, 0x0303ffff) Cache Tag Store (DN4500 only) +// AM_RANGE(0x04000000, 0x0400ffff) Cache Tag Data (DN4500 only) + AM_RANGE(0x07000000, 0x0700FFFF) AM_READWRITE8(dn5500_io_protection_map_r, dn5500_io_protection_map_w, 0xffffffff ) +// AM_RANGE(0x0e000000, 0x0fffffff) FPA address space + +// AM_RANGE(0xf8000000, 0xffffffff) AM_READWRITE(apollo_f8_r, apollo_f8_w) + AM_RANGE(0x00000000, 0xffffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(dsp5500_map, AS_PROGRAM, 32, apollo_state ) + AM_RANGE(0x000000, 0x00ffff) AM_ROM /* boot ROM */ + AM_RANGE(0x000000, 0x00ffff) AM_WRITE(apollo_rom_w) + AM_RANGE(0x010000, 0x0100ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) + AM_RANGE(0x010100, 0x0101ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) + AM_RANGE(0x010200, 0x0102ff) AM_READWRITE8(cache_status_register_r, cache_control_register_w, 0xffffffff ) + AM_RANGE(0x010300, 0x0103ff) AM_READWRITE8(task_alias_register_r , task_alias_register_w , 0xffffffff ) + AM_RANGE(0x010400, 0x0104ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) + AM_RANGE(0x010500, 0x0105ff) AM_DEVREADWRITE8(APOLLO_SIO2_TAG, mc68681_device, read, write, 0x00ff00ff ) + AM_RANGE(0x010800, 0x0108ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) + AM_RANGE(0x010900, 0x0109ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) + AM_RANGE(0x010c00, 0x010cff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) + AM_RANGE(0x010d00, 0x010dff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) + AM_RANGE(0x011000, 0x0110ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x011100, 0x0111ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x011200, 0x0112ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) + AM_RANGE(0x011300, 0x0113ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) + AM_RANGE(0x011400, 0x0114ff) AM_READWRITE8(dn5500_memory_present_register_r, dn5500_memory_present_register_w, 0xffffffff ) + AM_RANGE(0x011500, 0x0115ff) AM_READWRITE8(dn5500_11500_r, dn5500_11500_w, 0xffffffff ) + AM_RANGE(0x011600, 0x0116ff) AM_READWRITE8(master_req_register_r, master_req_register_w, 0xffffffff) + + AM_RANGE(0x016400, 0x0164ff) AM_READWRITE16(selective_clear_locations_r, selective_clear_locations_w, 0xffffffff ) + AM_RANGE(0x017000, 0x017fff) AM_READWRITE16(apollo_address_translation_map_r, apollo_address_translation_map_w, 0xffffffff ) + + AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) + + // FIXME: must match with RAM size in driver/apollo_sio.c + AM_RANGE(DN5500_RAM_BASE, DN5500_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") + + AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) + + AM_RANGE(0x07000000, 0x0700FFFF) AM_READWRITE8(dn5500_io_protection_map_r, dn5500_io_protection_map_w, 0xffffffff ) +// AM_RANGE(0xf8000000, 0xffffffff) AM_READWRITE(apollo_f8_r, apollo_f8_w) + AM_RANGE(0x00000000, 0xffffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) +ADDRESS_MAP_END + +/*************************************************************************** + Machine Reset + ***************************************************************************/ + +void apollo_state::machine_reset() +{ + //MLOG1(("machine_reset_dn3500")); + + MACHINE_RESET_CALL_MEMBER(apollo); + + // we can't do this any more + #if 0 + // set configuration + omti8621_device::set_verbose(apollo_config(APOLLO_CONF_DISK_TRACE)); + threecom3c505_device::set_verbose(apollo_config(APOLLO_CONF_NET_TRACE)); + + if (apollo_config(APOLLO_CONF_NODE_ID)) + { + UINT8 db[0x50]; + UINT16 sector1 = apollo_is_dn5500() ? 4 : 1; + + // check label of physical volume and get sector data of logical volume 1 + // Note: sector data starts with 32 byte block header + if (omti8621_get_sector(machine().device(APOLLO_WDC_TAG), 0, db, sizeof(db), 0) == sizeof(db) && + memcmp (db+0x22, "APOLLO", 6) == 0 && + omti8621_get_sector(machine().device(APOLLO_WDC_TAG), sector1, db, sizeof(db), 0) == sizeof(db)) + { + // set node_id from UID of logical volume 1 of logical unit 0 + node_id = (((db[0x49] << 8) | db[0x4a]) << 8) | db[0x4b]; + + MLOG2(("machine_reset_dn3500: node ID is %06X (from disk)", node_id)); + } + } + #endif + + m_maincpu->set_instruction_hook(read32_delegate(FUNC(apollo_state::apollo_instruction_hook),this)); +} + +WRITE_LINE_MEMBER(apollo_state::apollo_reset_instr_callback) +{ + MLOG1(("apollo_reset_instr_callback")); + + // reset the CPU board devices + MACHINE_RESET_CALL_MEMBER(apollo); + + // reset the ISA bus devices + m_isa->reset(); + + if (!apollo_is_dsp3x00()) + { + machine().device(APOLLO_SCREEN_TAG)->reset(); + machine().device(APOLLO_KBD_TAG )->reset(); + } +} + +/*************************************************************************** + Machine Start + ***************************************************************************/ + +void apollo_state::machine_start(){ + memory_share *messram = memshare("messram"); + //MLOG1(("machine_start_dn3500: ram size is %d MB", (int)messram->bytes()/(1024*1024))); + + // clear ram + memset(messram->ptr(), 0x55, messram->bytes()); + + MACHINE_START_CALL_MEMBER(apollo); +} + +/*************************************************************************** + Driver Init + ***************************************************************************/ + +DRIVER_INIT_MEMBER(apollo_state,dn3500) +{ +// MLOG1(("driver_init_dn3500")); + + /* hook the RESET line, which resets a slew of other components */ + m_maincpu->set_reset_callback(write_line_delegate(FUNC(apollo_state::apollo_reset_instr_callback),this)); + + ram_base_address = DN3500_RAM_BASE; + ram_end_address = DN3500_RAM_END; + + node_type= NODE_TYPE_DN3500; + ram_config_byte= DN3500_RAM_CONFIG_BYTE; + + DRIVER_INIT_CALL(apollo); +} + +DRIVER_INIT_MEMBER(apollo_state,dsp3500) +{ + DRIVER_INIT_CALL( dn3500 ); +// MLOG1(("driver_init_dsp3500")); + node_type = NODE_TYPE_DSP3500; +} + +DRIVER_INIT_MEMBER(apollo_state,dn3000) +{ + DRIVER_INIT_CALL( dn3500 ); +// MLOG1(("driver_init_dn3000")); + + ram_base_address = DN3000_RAM_BASE; + ram_end_address = DN3000_RAM_END; + + node_type = NODE_TYPE_DN3000; + ram_config_byte= DN3000_RAM_CONFIG_8MB; +} + +DRIVER_INIT_MEMBER(apollo_state,dsp3000) +{ + DRIVER_INIT_CALL( dn3000 ); +// MLOG1(("driver_init_dsp3000")); + node_type = NODE_TYPE_DSP3000; +} + +DRIVER_INIT_MEMBER(apollo_state,dn5500) +{ + DRIVER_INIT_CALL( dn3500 ); +// MLOG1(("driver_init_dn5500")); + + ram_base_address = DN5500_RAM_BASE; + ram_end_address = DN5500_RAM_END; + + node_type = NODE_TYPE_DN5500; + ram_config_byte= DN5500_RAM_CONFIG_BYTE; +} + +DRIVER_INIT_MEMBER(apollo_state,dsp5500) +{ + DRIVER_INIT_CALL( dn5500 ); +// MLOG1(("driver_init_dsp5500")); + node_type = NODE_TYPE_DSP5500; +} + +/*************************************************************************** + Input Ports + ***************************************************************************/ + +static INPUT_PORTS_START( dn3500 ) + PORT_INCLUDE(apollo_config) + PORT_INCLUDE(apollo_kbd) +INPUT_PORTS_END + +static INPUT_PORTS_START( dsp3500 ) + PORT_INCLUDE(apollo_config) +INPUT_PORTS_END + +READ_LINE_MEMBER( apollo_state::apollo_kbd_is_german ) +{ + return (apollo_config(APOLLO_CONF_GERMAN_KBD) != 0) ? ASSERT_LINE : CLEAR_LINE; +} + +/*************************************************************************** + MACHINE DRIVERS + ***************************************************************************/ + +static MACHINE_CONFIG_START( dn3500, apollo_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU, M68030, 25000000) /* 25 MHz 68030 */ + MCFG_CPU_PROGRAM_MAP(dn3500_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_FRAGMENT_ADD( apollo ) + + /* keyboard beeper */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beep", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* internal ram */ + MCFG_RAM_ADD("messram") + MCFG_RAM_DEFAULT_SIZE("8M") + MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( dsp3500, apollo_state ) + MCFG_CPU_ADD(MAINCPU, M68030, 25000000) /* 25 MHz 68030 */ + MCFG_CPU_PROGRAM_MAP(dsp3500_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_FRAGMENT_ADD( apollo_terminal ) + + /* keyboard beeper */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beep", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* internal ram */ + MCFG_RAM_ADD("messram") + MCFG_RAM_DEFAULT_SIZE("8M") + MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M") + + /* terminal hardware */ + MCFG_DEFAULT_LAYOUT( layout_apollo_dsp ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dn3500_19i, dn3500 ) + /* video hardware 19" monochrome */ + MCFG_APOLLO_MONO19I_ADD(APOLLO_SCREEN_TAG) + MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) + MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) + MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dn3500_15i, dn3500 ) + /* video hardware is 15" monochrome or color */ + MCFG_APOLLO_GRAPHICS_ADD(APOLLO_SCREEN_TAG) + MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) + MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) + MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dn3000, dn3500 ) + MCFG_CPU_REPLACE(MAINCPU, M68020PMMU, 12000000) /* 12 MHz */ + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) + MCFG_CPU_PROGRAM_MAP(dn3000_map) + MCFG_DEVICE_REMOVE( APOLLO_SIO2_TAG ) + MCFG_RAM_MODIFY("messram") + MCFG_RAM_DEFAULT_SIZE("8M") + MCFG_RAM_EXTRA_OPTIONS("4M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( dsp3000, apollo_state ) + MCFG_CPU_ADD(MAINCPU, M68020PMMU, 12000000) /* 12 MHz */ + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) + MCFG_CPU_PROGRAM_MAP(dsp3000_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_FRAGMENT_ADD( apollo_terminal ) + + /* keyboard beeper */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beep", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* internal ram */ + MCFG_RAM_ADD("messram") + MCFG_RAM_DEFAULT_SIZE("8M") + MCFG_RAM_EXTRA_OPTIONS("4M") + + MCFG_DEVICE_REMOVE( APOLLO_SIO2_TAG ) + MCFG_RAM_MODIFY("messram") + + /* terminal hardware */ + MCFG_DEFAULT_LAYOUT( layout_apollo_dsp ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dn3000_19i, dn3000 ) + /* video hardware 19" monochrome */ + MCFG_APOLLO_MONO19I_ADD(APOLLO_SCREEN_TAG) + MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) + MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) + MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dn3000_15i, dn3000 ) + /* video hardware 15" monochrome */ + MCFG_APOLLO_GRAPHICS_ADD(APOLLO_SCREEN_TAG) + MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) + MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) + MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dn5500, dn3500 ) + MCFG_CPU_REPLACE(MAINCPU, M68040, 25000000) /* 25 MHz */ + MCFG_CPU_PROGRAM_MAP(dn5500_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( dsp5500, apollo_state ) + MCFG_CPU_ADD(MAINCPU, M68040, 25000000) /* 25 MHz */ + MCFG_CPU_PROGRAM_MAP(dsp5500_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_FRAGMENT_ADD(apollo_terminal) + + /* keyboard beeper */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beep", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* terminal hardware */ + MCFG_DEFAULT_LAYOUT( layout_apollo_dsp ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dn5500_19i, dn5500 ) + /* video hardware 19" monochrome */ + MCFG_APOLLO_MONO19I_ADD(APOLLO_SCREEN_TAG) + MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) + MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) + MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dn5500_15i, dn5500 ) + /* video hardware 15" monochrome */ + MCFG_APOLLO_GRAPHICS_ADD(APOLLO_SCREEN_TAG) + MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) + MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) + MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) +MACHINE_CONFIG_END + +/*************************************************************************** + ROM Definitions + ***************************************************************************/ + +ROM_START( dn3500 ) + // dn3500 boot ROM (Note: use sha1sum -b ) + ROM_REGION( 0x0100000, MAINCPU, 0 ) /* 68000 code */ + + // http://www.bitsavers.org/bits/Apollo/firmware/3500_BOOT_12191_7.bin + // Note: file name must be converted to lower case (i.e. 3500_boot_12191_7.bin) + // Note: this duplicates boot rom md7c-rev-8.00-1989-08-16-17-23-52.bin + ROM_SYSTEM_BIOS( 0, "md7c-rev-8.00", "MD7C REV 8.00, 1989/08/16.17:23:52" ) + ROMX_LOAD( "3500_boot_12191_7.bin", 0x00000, 0x10000, CRC(3132067d) SHA1(36f3c83d9f2df42f2537b09ca2f051a8c9dfbfc2) , ROM_BIOS(1) ) + + ROM_LOAD_OPTIONAL( "3000_3c505_010728-00.bin", 0x80000, 0x02000, CRC(69b77ec6) SHA1(7ac36cc6fc90b90ddfc56c45303b514cbe18ae58) ) +ROM_END + +ROM_START( dn5500 ) + // dn5500 boot ROM (Note: use sha1sum -b ) + ROM_REGION( 0x0100000, MAINCPU, 0 ) /* 68000 code */ + + ROM_SYSTEM_BIOS( 0, "md7c-rev-8.00", "MD7C REV 8.00, 1989/08/16.17:23:52" ) + ROMX_LOAD( "5500_boot_a1631-80046_1-30-92.bin", 0x00000, 0x10000, CRC(7b9ed610) SHA1(7315a884ec4551c44433c6079cc06509223cb02b) , ROM_BIOS(1) ) + + ROM_LOAD_OPTIONAL( "3000_3c505_010728-00.bin", 0x80000, 0x02000, CRC(69b77ec6) SHA1(7ac36cc6fc90b90ddfc56c45303b514cbe18ae58) ) +ROM_END + +ROM_START( dn3000) + ROM_REGION( 0x0090000, MAINCPU, 0 ) /* 68000 code */ + + ROM_SYSTEM_BIOS( 0, "md8-rev-7.0", "MD8 REV 7.0, 1988/08/16.15:14:39" ) + ROMX_LOAD( "3000_boot_8475_7.bin", 0x00000, 0x08000, CRC(0fe2d471) SHA1(6c383d2266719a3d069b7bf015f6945179395e7a), ROM_BIOS(1) ) + + ROM_LOAD_OPTIONAL( "3000_3c505_010728-00.bin", 0x80000, 0x02000, CRC(69b77ec6) SHA1(7ac36cc6fc90b90ddfc56c45303b514cbe18ae58) ) +ROM_END + +#define rom_dsp3500 rom_dn3500 +#define rom_dn3500_15i rom_dn3500 +#define rom_dn3500_19i rom_dn3500 + +#define rom_dsp3000 rom_dn3000 +#define rom_dn3000_19i rom_dn3000 + +#define rom_dsp5500 rom_dn5500 +#define rom_dn5500_15i rom_dn5500 +#define rom_dn5500_19i rom_dn5500 + +/*************************************************************************** + GAME DRIVERS + ***************************************************************************/ + +#define DN_FLAGS 0 +#define DSP_FLAGS 0 +//#define DSP_FLAGS MACHINE_NO_SOUND + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, dn3500, 0, 0, dn3500_15i, dn3500, apollo_state, dn3500, "Apollo", "Apollo DN3500", DN_FLAGS ) +COMP( 1989, dsp3500, dn3500, 0, dsp3500, dsp3500, apollo_state,dsp3500,"Apollo", "Apollo DSP3500", DSP_FLAGS ) +COMP( 1989, dn3500_19i, dn3500, 0, dn3500_19i, dn3500, apollo_state, dn3500, "Apollo", "Apollo DN3500 19\" Monochrome", DN_FLAGS ) + +COMP( 1988, dn3000, dn3500, 0, dn3000_15i, dn3500, apollo_state, dn3000, "Apollo", "Apollo DN3000", DN_FLAGS ) +COMP( 1988, dsp3000, dn3500, 0, dsp3000, dsp3500, apollo_state,dsp3000,"Apollo", "Apollo DSP3000", DSP_FLAGS ) +COMP( 1988, dn3000_19i, dn3500, 0, dn3000_19i, dn3500, apollo_state, dn3000, "Apollo", "Apollo DN3000 19\" Monochrome", DN_FLAGS ) + +COMP( 1991, dn5500, dn3500, 0, dn5500_15i, dn3500, apollo_state, dn5500, "Apollo", "Apollo DN5500", MACHINE_NOT_WORKING ) +COMP( 1991, dsp5500, dn3500, 0, dsp5500, dsp3500, apollo_state,dsp5500,"Apollo", "Apollo DSP5500", MACHINE_NOT_WORKING ) +COMP( 1991, dn5500_19i, dn3500, 0, dn5500_19i, dn3500, apollo_state, dn5500, "Apollo", "Apollo DN5500 19\" Monochrome", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/apple1.c b/src/mame/drivers/apple1.c new file mode 100644 index 00000000000..7af5cf2d8ae --- /dev/null +++ b/src/mame/drivers/apple1.c @@ -0,0 +1,331 @@ +// license:??? +// copyright-holders:Paul Daniels, Colin Howell, R. Belmont +/********************************************************************** + +Apple I + +CPU: 6502 @ 1.023 MHz + (Effective speed with RAM refresh waits is 0.960 MHz.) + +RAM: 4-8 KB on main board (4 KB standard) + + Additional memory could be added via the expansion + connector, but the user was responsible for making sure + the extra memory was properly interfaced. + + Some users replaced the onboard 4-kilobit RAM chips with + 16-kilobit RAM chips, increasing on-board memory to 32 KB, + but this required modifying the RAM interface circuitry. + +ROM: 256 bytes for Monitor program + + Optional cassette interface included 256 bytes for + cassette routines. + +Interrupts: None. + (The system board had jumpers to allow interrupts, but + these were not connected in a standard system.) + +Video: Dumb terminal, based on 7 1K-bit shift registers + +Sound: None + +Hardware: Motorola 6820 PIA for keyboard and display interface + +Memory map: + +$0000-$1FFF: RAM address space + $0000-$00FF: 6502 zero page + $0024-$002B: Zero page locations used by the Monitor + $0100-$01FF: 6502 processor stack + $0200-$027F: Keyboard input buffer storage used by the Monitor + $0280-$0FFF: RAM space available for a program in a 4 KB system + $1000-$1FFF: Extra RAM space available for a program in an 8 KB system + not using cassette BASIC + +$2000-$BFFF: Unused address space, available for RAM in systems larger + than 8 KB. + +$C000-$CFFF: Address space for optional cassette interface + $C000-$C0FF: Cassette interface I/O range + $C100-$C1FF: Cassette interface ROM + +$D000-$DFFF: I/O address space + $D010-$D013: Motorola 6820 PIA registers. + $D010: Keyboard input port + $D011: Control register for keyboard input port, with + key-available flag. + $D012: Display output port (bit 7 is a status input) + $D013: Control register for display output port + (PIA registers also mirrored at $D014-$D017, $D018-$D01B, $D01C-$D01F, + $D030-$D03F, $D050-$D05F, ... , $DFD0-$DFDF, $DFF0-$DFFF.) + +$E000-$EFFF: Extra RAM space available for a program in an 8 KB system + modified to use cassette BASIC + (The system simulated here always includes this RAM.) + +If you wanted to load the BASIC as rom, here are the details: +ROM_LOAD("basic.bin", 0xE000, 0x1000, CRC(d5e86efc) SHA1(04269c1c66e7d5b4aa5035462c6e612bf2ae9b91) ) + + +$F000-$FFFF: ROM address space + $FF00-$FFFF: Apple Monitor ROM + + +How to use cassettes: +The system has no error checking or checksums, and the cassette +has no header. +Therefore, you must know the details, and pass these to the +interface yourself. +BASIC has no cassette handling. You must enter the monitor +with: CALL -151 +then when finished, re-enter BASIC with: E2B3R + + +Examples: + +A machine-language program will typically be like this: +C100R (enter the interface) +0300.0FFFR (enter the load and end addresses, then load the tape) +You start the tape. +When the prompt returns you stop the tape. +0300R (run your program) + + +To Load Tape Basic: +C100R +E000.EFFFR +You start the tape. +When the prompt returns you stop the tape. +E000R (It must say 4C - if not, your tape is no good). +The BASIC prompt will appear +>@ + + +A BASIC program is split into two areas, one for the scratch pad, +and one for the program proper. +In BASIC you may have to adjust the allowed memory area, such as +LOMEM = 768 +Then, go to the monitor: CALL -151 +C100R (enter the interface) +00A4.00FFR 0300.0FFFR (load the 2 parts) +You start the tape. +When the prompt returns you stop the tape. +E2B3R (back to BASIC) +You can LIST or RUN now. + + +Saving is almost the same, when you specify the address range, enter +W instead of R. The difficulty is finding out how long your program is. + +Insert a blank tape +C100R +0300.0FFFW +Quickly press Record. +When the prompt returns, press Stop. + +**********************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/6821pia.h" +#include "includes/apple1.h" +#include "imagedev/snapquik.h" +#include "machine/ram.h" + +#include "bus/a1bus/a1bus.h" +#include "bus/a1bus/a1cassette.h" +#include "bus/a1bus/a1cffa.h" + +/* port i/o functions */ + +/* memory w/r functions */ + +static ADDRESS_MAP_START( apple1_map, AS_PROGRAM, 8, apple1_state ) + /* In $D000-$DFFF, PIA is selected by address bit 4 being high, + and PIA registers are addressed with address bits 0-1. All + other address bits are ignored. Thus $D010-$D013 is mirrored + at all $Dxxx addresses with bit 4 high. */ + AM_RANGE(0xd010, 0xd013) AM_MIRROR(0x0fec) AM_DEVREADWRITE("pia",pia6821_device, read, write) + + /* We always include the remapped RAM for cassette BASIC, both for + simplicity and to allow the running of BASIC programs. */ + AM_RANGE(0xe000, 0xefff) AM_RAM + + AM_RANGE(0xf000, 0xfeff) AM_NOP + + /* Monitor ROM: */ + AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +/* graphics output */ + +const gfx_layout apple1_charlayout = +{ + 7, 8, /* character cell is 7 pixels wide by 8 pixels high */ + 64, /* 64 characters in 2513 character generator ROM */ + 1, /* 1 bitplane */ + { 0 }, + /* 5 visible pixels per row, starting at bit 3, with MSB being 0: */ + { 3, 4, 5, 6, 7 }, + /* pixel rows stored from top to bottom: */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8 * 8 /* 8 8-bit pixel rows per character */ +}; + +static GFXDECODE_START( apple1 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, apple1_charlayout, 0, 1 ) +GFXDECODE_END + +/* keyboard input */ +/* + It's very likely that the keyboard assgnments are totally wrong: the code in machine/apple1.c + makes arbitrary assumptions about the mapping of the keys. The schematics that are available + on the web can help revealing the real layout. + The large picture of Woz's Apple I at http://home.earthlink.net/~judgementcall/apple1.jpg + show probably how the real keyboard was meant to be: note how the shifted symbols on the digits + and on some letters are different from the ones produced by current emulation and the presence + of the gray keys. +*/ + +static INPUT_PORTS_START( apple1 ) + PORT_START("KEY0") /* first sixteen keys */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + + PORT_START("KEY1") /* second sixteen keys */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + + PORT_START("KEY2") /* third sixteen keys */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backarrow") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') + + PORT_START("KEY3") /* fourth sixteen keys */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("KEY4") /* shift keys */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control (Left)") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control (Right)") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("KEY5") /* RESET and CLEAR SCREEN pushbutton switches */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) +INPUT_PORTS_END + +static SLOT_INTERFACE_START(apple1_cards) + SLOT_INTERFACE("cassette", A1BUS_CASSETTE) + SLOT_INTERFACE("cffa", A1BUS_CFFA) +SLOT_INTERFACE_END + +/* machine definition */ +static MACHINE_CONFIG_START( apple1, apple1_state ) + /* basic machine hardware */ + /* Actual CPU speed is 1.023 MHz, but RAM refresh effectively + slows it to 960 kHz. */ + MCFG_CPU_ADD("maincpu", M6502, 960000) /* 1.023 MHz */ + MCFG_CPU_PROGRAM_MAP(apple1_map) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + /* Video is blanked for 70 out of 262 scanlines per refresh cycle. + Each scanline is composed of 65 character times, 40 of which + are visible, and each character time is 7 dot times; a dot time + is 2 cycles of the fundamental 14.31818 MHz oscillator. The + total blanking time is about 4450 microseconds. */ + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((int) (70 * 65 * 7 * 2 / 14.31818))) + /* It would be nice if we could implement some sort of display + overscan here. */ + MCFG_SCREEN_SIZE(40 * 7, 24 * 8) + MCFG_SCREEN_VISIBLE_AREA(0, 40 * 7 - 1, 0, 24 * 8 - 1) + MCFG_SCREEN_UPDATE_DRIVER(apple1_state, screen_update_apple1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", apple1) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_DEVICE_ADD( "pia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(apple1_state,apple1_pia0_kbdin)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(apple1_state,apple1_pia0_dspout)) + MCFG_PIA_CB2_HANDLER(WRITELINE(apple1_state,apple1_pia0_dsp_write_signal)) + + MCFG_DEVICE_ADD("a1bus", A1BUS, 0) + MCFG_A1BUS_CPU("maincpu") + MCFG_A1BUS_SLOT_ADD("a1bus", "exp", apple1_cards, "cassette") + + /* snapshot */ + MCFG_SNAPSHOT_ADD("snapshot", apple1_state, apple1, "snp", 0) + + MCFG_SOFTWARE_LIST_ADD("cass_list","apple1") + + /* Note that because we always include 4K of RAM at $E000-$EFFF, + the RAM amounts listed here will be 4K below the actual RAM + total. */ + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") + MCFG_RAM_EXTRA_OPTIONS("4K,8K,12K,16K,20K,24K,28K,32K,36K,40K,44K") + +MACHINE_CONFIG_END + +ROM_START(apple1) + ROM_REGION(0x100, "maincpu",0) + /* 256-byte main monitor ROM, in two 82s129 or mmi6301 256x4 proms at A1 and A2 called APPLE-A1(bits D3-D0) and APPLE-A2(bits D7-D4) */ + ROM_LOAD_NIB_HIGH( "apple-a2.a2", 0x0000, 0x0100, CRC(254bfb95) SHA1(b6468b72295b7d8ac288d104d252f24de1f1d611) ) + ROM_LOAD_NIB_LOW( "apple-a1.a1", 0x0000, 0x0100, CRC(434f8ce6) SHA1(9deee2d39903209b20c3fc6b58e16372f8efece1) ) + /* 512-byte Signetics 2513 character generator ROM at location D2-D3 */ + ROM_REGION(0x0200, "gfx1",0) + ROM_LOAD("s2513.d2", 0x0000, 0x0200, CRC(a7e567fc) SHA1(b18aae0a2d4f92f5a7e22640719bbc4652f3f4ee)) // apple1.vid +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1976, apple1, 0, 0, apple1, apple1, apple1_state, apple1, "Apple Computer", "Apple I" , MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/apple2.c b/src/mame/drivers/apple2.c new file mode 100644 index 00000000000..8cf74588ffc --- /dev/null +++ b/src/mame/drivers/apple2.c @@ -0,0 +1,1614 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + apple2.c - Apple II/II Plus and clones + + Next generation driver written in September/October 2014 by R. Belmont. + Thanks to the original Apple II series driver's authors: Mike Balfour, Nathan Woods, and R. Belmont + Special thanks to the Apple II Documentation Project/Antoine Vignau and Peter Ferrie. + +II: original base model. RAM sizes of 4, 8, 12, 16, 20, 24, 32, 36, and 48 KB possible. + 8K of ROM at $E000-$FFFF, empty sockets for $D000-$D7FF and $D800-$DFFF. + Programmer's Aid #1 was sold by Apple for $D000-$D7FF, some third-party ROMs + were also available. + + Revision 0 (very rare) had only 4 hi-res colors (blue and orange were missing). + Revision 0 boards also did not include a color killer in text mode, making text + fringey on color TVs/monitors. + + ROM contains original non-autostart Monitor and Integer BASIC; apparently + Autostart + Integer is also possible. + +II Plus: RAM options reduced to 16/32/48 KB. + ROM expanded to 12KB from $D000-$FFFF containing Applesoft BASIC and + the Autostart Monitor. Applesoft is a licensed version of Microsoft's + 6502 BASIC as also found in Commodore and many other computers. + + + Users of both models often connected the SHIFT key to the paddle #2 button + (mapped to $C063) in order to inform properly written software that characters + were to be intended upper/lower case. + + Both models commonly included a RAM "language card" in slot 0 which added 16K + of RAM which could be banked into the $D000-$FFFF space to replace the ROMs. + This allowed running Applesoft on a II and Integer BASIC on a II Plus. + A II Plus with this card installed is often called a "64K Apple II"; this is + the base configuration required to run ProDOS and some larger games. + +************************************************************************/ + +#include "emu.h" +#include "machine/bankdev.h" +#include "machine/ram.h" +#include "machine/kb3600.h" +#include "sound/speaker.h" +#include "imagedev/flopdrv.h" +#include "imagedev/cassette.h" +#include "formats/ap2_dsk.h" +#include "cpu/m6502/m6502.h" +#include "video/apple2.h" + +#include "bus/a2bus/a2bus.h" +#include "bus/a2bus/a2diskii.h" +#include "bus/a2bus/a2diskiing.h" +#include "bus/a2bus/a2mockingboard.h" +#include "bus/a2bus/a2cffa.h" +#include "bus/a2bus/a2memexp.h" +#include "bus/a2bus/a2scsi.h" +#include "bus/a2bus/a2thunderclock.h" +#include "bus/a2bus/a2softcard.h" +#include "bus/a2bus/a2videoterm.h" +#include "bus/a2bus/a2ssc.h" +#include "bus/a2bus/a2swyft.h" +#include "bus/a2bus/a2themill.h" +#include "bus/a2bus/a2sam.h" +#include "bus/a2bus/a2alfam2.h" +#include "bus/a2bus/laser128.h" +#include "bus/a2bus/a2echoii.h" +#include "bus/a2bus/a2arcadebd.h" +#include "bus/a2bus/a2midi.h" +#include "bus/a2bus/a2zipdrive.h" +#include "bus/a2bus/a2applicard.h" +#include "bus/a2bus/a2ultraterm.h" +#include "bus/a2bus/a2pic.h" +#include "bus/a2bus/a2corvus.h" +#include "bus/a2bus/a2mcms.h" +#include "bus/a2bus/a2dx1.h" +#include "bus/a2bus/timemasterho.h" +#include "bus/a2bus/mouse.h" +#include "bus/a2bus/ramcard16k.h" +#include "bus/a2bus/ramcard128k.h" +#include "bus/a2bus/ezcgi.h" + +#define A2_CPU_TAG "maincpu" +#define A2_KBDC_TAG "ay3600" +#define A2_BUS_TAG "a2bus" +#define A2_SPEAKER_TAG "speaker" +#define A2_CASSETTE_TAG "tape" +#define A2_UPPERBANK_TAG "inhbank" +#define A2_VIDEO_TAG "a2video" + +class napple2_state : public driver_device +{ +public: + napple2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, A2_CPU_TAG), + m_ram(*this, RAM_TAG), + m_ay3600(*this, A2_KBDC_TAG), + m_video(*this, A2_VIDEO_TAG), + m_a2bus(*this, A2_BUS_TAG), + m_joy1x(*this, "joystick_1_x"), + m_joy1y(*this, "joystick_1_y"), + m_joy2x(*this, "joystick_2_x"), + m_joy2y(*this, "joystick_2_y"), + m_joybuttons(*this, "joystick_buttons"), + m_kbspecial(*this, "keyb_special"), + m_kbrepeat(*this, "keyb_repeat"), + m_resetdip(*this, "reset_dip"), + m_sysconfig(*this, "a2_config"), + m_speaker(*this, A2_SPEAKER_TAG), + m_cassette(*this, A2_CASSETTE_TAG), + m_upperbank(*this, A2_UPPERBANK_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_ay3600; + required_device m_video; + required_device m_a2bus; + required_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons; + required_ioport m_kbspecial; + required_ioport m_kbrepeat; + optional_ioport m_resetdip; + required_ioport m_sysconfig; + required_device m_speaker; + required_device m_cassette; + required_device m_upperbank; + + TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(ay3600_repeat); + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_PALETTE_INIT(apple2); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER(ram_r); + DECLARE_WRITE8_MEMBER(ram_w); + DECLARE_READ8_MEMBER(c000_r); + DECLARE_WRITE8_MEMBER(c000_w); + DECLARE_READ8_MEMBER(c080_r); + DECLARE_WRITE8_MEMBER(c080_w); + DECLARE_READ8_MEMBER(c100_r); + DECLARE_WRITE8_MEMBER(c100_w); + DECLARE_READ8_MEMBER(c800_r); + DECLARE_WRITE8_MEMBER(c800_w); + DECLARE_READ8_MEMBER(inh_r); + DECLARE_WRITE8_MEMBER(inh_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); + DECLARE_READ_LINE_MEMBER(ay3600_shift_r); + DECLARE_READ_LINE_MEMBER(ay3600_control_r); + DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); + DECLARE_WRITE_LINE_MEMBER(ay3600_ako_w); + +private: + int m_speaker_state; + int m_cassette_state; + + double m_joystick_x1_time; + double m_joystick_y1_time; + double m_joystick_x2_time; + double m_joystick_y2_time; + + UINT16 m_lastchar, m_strobe; + UINT8 m_transchar; + bool m_anykeydown; + + int m_inh_slot; + int m_cnxx_slot; + + bool m_page2; + bool m_an0, m_an1, m_an2, m_an3; + + UINT8 *m_ram_ptr; + int m_ram_size; + + int m_inh_bank; + + double m_x_calibration, m_y_calibration; + + device_a2bus_card_interface *m_slotdevice[8]; + + void do_io(address_space &space, int offset); + UINT8 read_floatingbus(); +}; + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +#define JOYSTICK_DELTA 80 +#define JOYSTICK_SENSITIVITY 50 +#define JOYSTICK_AUTOCENTER 80 + +WRITE_LINE_MEMBER(napple2_state::a2bus_irq_w) +{ + m_maincpu->set_input_line(M6502_IRQ_LINE, state); +} + +WRITE_LINE_MEMBER(napple2_state::a2bus_nmi_w) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, state); +} + +// This code makes a ton of assumptions because we can guarantee a pre-IIe machine! +WRITE_LINE_MEMBER(napple2_state::a2bus_inh_w) +{ + if (state == ASSERT_LINE) + { + // assume no cards are pulling /INH + m_inh_slot = -1; + + // scan the slots to figure out which card(s) are INHibiting stuff + for (int i = 0; i <= 7; i++) + { + if (m_slotdevice[i]) + { + // this driver only can inhibit from 0xd000-0xffff + if ((m_slotdevice[i]->inh_start() == 0xd000) && + (m_slotdevice[i]->inh_end() == 0xffff)) + { + if ((m_slotdevice[i]->inh_type() & INH_READ) == INH_READ) + { + if (m_inh_bank != 1) + { + m_upperbank->set_bank(1); + m_inh_bank = 1; + } + } + else + { + if (m_inh_bank != 0) + { + m_upperbank->set_bank(0); + m_inh_bank = 0; + } + } + + m_inh_slot = i; + break; + } + } + } + + // if no slots are inhibiting, make sure ROM is fully switched in + if ((m_inh_slot == -1) && (m_inh_bank != 0)) + { + m_upperbank->set_bank(0); + m_inh_bank = 0; + } + } +} + +/*************************************************************************** + START/RESET +***************************************************************************/ + +void napple2_state::machine_start() +{ + m_ram_ptr = m_ram->pointer(); + m_ram_size = m_ram->size(); + m_speaker_state = 0; + m_speaker->level_w(m_speaker_state); + m_cassette_state = 0; + m_cassette->output(-1.0f); + m_upperbank->set_bank(0); + m_inh_bank = 0; + + // precalculate joystick time constants + m_x_calibration = attotime::from_usec(12).as_double(); + m_y_calibration = attotime::from_usec(13).as_double(); + + // cache slot devices + for (int i = 0; i <= 7; i++) + { + m_slotdevice[i] = m_a2bus->get_a2bus_card(i); + } + + // setup save states + save_item(NAME(m_speaker_state)); + save_item(NAME(m_cassette_state)); + save_item(NAME(m_joystick_x1_time)); + save_item(NAME(m_joystick_y1_time)); + save_item(NAME(m_joystick_x2_time)); + save_item(NAME(m_joystick_y2_time)); + save_item(NAME(m_lastchar)); + save_item(NAME(m_strobe)); + save_item(NAME(m_transchar)); + save_item(NAME(m_inh_slot)); + save_item(NAME(m_inh_bank)); + save_item(NAME(m_cnxx_slot)); + save_item(NAME(m_page2)); + save_item(NAME(m_an0)); + save_item(NAME(m_an1)); + save_item(NAME(m_an2)); + save_item(NAME(m_an3)); + save_item(NAME(m_anykeydown)); + + // setup video pointers + m_video->m_ram_ptr = m_ram_ptr; + m_video->m_aux_ptr = m_ram_ptr; + m_video->m_char_ptr = memregion("gfx1")->base(); + m_video->m_char_size = memregion("gfx1")->bytes(); +} + +void napple2_state::machine_reset() +{ + m_inh_slot = -1; + m_cnxx_slot = -1; + m_page2 = false; + m_an0 = m_an1 = m_an2 = m_an3 = false; + m_anykeydown = false; +} + +/*************************************************************************** + VIDEO +***************************************************************************/ + +TIMER_DEVICE_CALLBACK_MEMBER(napple2_state::apple2_interrupt) +{ + int scanline = param; + + if((scanline % 8) == 0) + machine().first_screen()->update_partial(machine().first_screen()->vpos()); + + // update the video system's shadow copy of the system config at the end of the frame + if (scanline == 192) + { + m_video->m_sysconfig = m_sysconfig->read(); + + // check reset + if (m_resetdip) // if reset DIP is present, use it + { + if (m_resetdip->read() & 1) + { // CTRL-RESET + if ((m_kbspecial->read() & 0x88) == 0x88) + { + m_maincpu->reset(); + } + } + else // plain RESET + { + if (m_kbspecial->read() & 0x80) + { + m_maincpu->reset(); + } + } + } + else // no DIP, so always plain RESET + { + if (m_kbspecial->read() & 0x80) + { + m_maincpu->reset(); + } + } + } +} + +PALETTE_INIT_MEMBER(napple2_state, apple2) +{ + m_video->palette_init_apple2(palette); +} + +UINT32 napple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // always update the flash timer here so it's smooth regardless of mode switches + m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; + + if (m_video->m_graphics) + { + if (m_video->m_hires) + { + if (m_video->m_mix) + { + m_video->hgr_update(screen, bitmap, cliprect, 0, 159); + if (!strcmp(machine().system().name, "ivelultr")) + { + m_video->text_update_ultr(screen, bitmap, cliprect, 160, 191); + } + else + { + m_video->text_update_orig(screen, bitmap, cliprect, 160, 191); + } + } + else + { + m_video->hgr_update(screen, bitmap, cliprect, 0, 191); + } + } + else // lo-res + { + if (m_video->m_mix) + { + m_video->lores_update(screen, bitmap, cliprect, 0, 159); + if (!strcmp(machine().system().name, "ivelultr")) + { + m_video->text_update_ultr(screen, bitmap, cliprect, 160, 191); + } + else + { + m_video->text_update_orig(screen, bitmap, cliprect, 160, 191); + } + } + else + { + m_video->lores_update(screen, bitmap, cliprect, 0, 191); + } + } + } + else + { + if (!strcmp(machine().system().name, "ivelultr")) + { + m_video->text_update_ultr(screen, bitmap, cliprect, 0, 191); + } + else + { + m_video->text_update_orig(screen, bitmap, cliprect, 0, 191); + } + } + + return 0; +} + +/*************************************************************************** + I/O +***************************************************************************/ +// most softswitches don't care about read vs write, so handle them here +void napple2_state::do_io(address_space &space, int offset) +{ + if(space.debugger_access()) + { + return; + } + + switch (offset) + { + case 0x20: + m_cassette_state ^= 1; + m_cassette->output(m_cassette_state ? 1.0f : -1.0f); + break; + + case 0x30: + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + break; + + case 0x50: // graphics mode + m_video->m_graphics = true; break; + + case 0x51: // text mode + m_video->m_graphics = false; break; + + case 0x52: // no mix + m_video->m_mix = false; break; + + case 0x53: // mixed mode + m_video->m_mix = true; break; + + case 0x54: // set page 1 + m_page2 = false; + m_video->m_page2 = false; + break; + + case 0x55: // set page 2 + m_page2 = true; + m_video->m_page2 = true; + break; + + case 0x56: // select lo-res + m_video->m_hires = false; break; + + case 0x57: // select hi-res + m_video->m_hires = true; break; + + case 0x58: // AN0 off + m_an0 = false; break; + + case 0x59: // AN0 on + m_an0 = true; break; + + case 0x5a: // AN1 off + m_an1 = false; break; + + case 0x5b: // AN1 on + m_an1 = true; break; + + case 0x5c: // AN2 off + m_an2 = false; break; + + case 0x5d: // AN2 on + m_an2 = true; break; + + case 0x5e: // AN3 off + m_an3 = false; break; + + case 0x5f: // AN3 on + m_an3 = true; break; + + case 0x68: // IIgs STATE register, which ProDOS touches + break; + + case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: + m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_joy1x->read(); + m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_joy1y->read(); + m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_joy2x->read(); + m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read(); + break; + } +} + +READ8_MEMBER(napple2_state::c000_r) +{ + switch (offset) + { + case 0x00: // keyboard latch + return m_transchar | m_strobe; + + case 0x10: // reads any key down, clears strobe + { + UINT8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); + m_strobe = 0; + return rv; + } + + case 0x60: // cassette in + case 0x68: + return m_cassette->input() > 0.0 ? 0x80 : 0; + + case 0x61: // button 0 + case 0x69: + return (m_joybuttons->read() & 0x10) ? 0x80 : 0; + + case 0x62: // button 1 + case 0x6a: + return (m_joybuttons->read() & 0x20) ? 0x80 : 0; + + case 0x63: // button 2 + case 0x6b: + // check if SHIFT key mod configured + if (m_sysconfig->read() & 0x04) + { + return ((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0; + } + return (m_joybuttons->read() & 0x40) ? 0x80 : 0; + + case 0x64: // joy 1 X axis + case 0x6c: + return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; + + case 0x65: // joy 1 Y axis + case 0x6d: + return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; + + case 0x66: // joy 2 X axis + case 0x6e: + return (space.machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0; + + case 0x67: // joy 2 Y axis + case 0x6f: + return (space.machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0; + + default: + do_io(space, offset); + break; + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(napple2_state::c000_w) +{ + switch (offset) + { + case 0x10: // clear keyboard latch + m_strobe = 0; + break; + + default: + do_io(space, offset); + break; + } +} + +READ8_MEMBER(napple2_state::c080_r) +{ + if(!space.debugger_access()) + { + int slot; + + offset &= 0x7F; + slot = offset / 0x10; + + if (m_slotdevice[slot] != NULL) + { + return m_slotdevice[slot]->read_c0nx(space, offset % 0x10); + } + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(napple2_state::c080_w) +{ + int slot; + + offset &= 0x7F; + slot = offset / 0x10; + + if (m_slotdevice[slot] != NULL) + { + m_slotdevice[slot]->write_c0nx(space, offset % 0x10, data); + } +} + +READ8_MEMBER(napple2_state::c100_r) +{ + int slotnum; + + slotnum = ((offset>>8) & 0xf) + 1; + + if (m_slotdevice[slotnum] != NULL) + { + if ((m_slotdevice[slotnum]->take_c800()) && (!space.debugger_access())) + { + m_cnxx_slot = slotnum; + } + + return m_slotdevice[slotnum]->read_cnxx(space, offset&0xff); + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(napple2_state::c100_w) +{ + int slotnum; + + slotnum = ((offset>>8) & 0xf) + 1; + + if (m_slotdevice[slotnum] != NULL) + { + if ((m_slotdevice[slotnum]->take_c800()) && (!space.debugger_access())) + { + m_cnxx_slot = slotnum; + } + + m_slotdevice[slotnum]->write_cnxx(space, offset&0xff, data); + } +} + +READ8_MEMBER(napple2_state::c800_r) +{ + if (offset == 0x7ff) + { + m_cnxx_slot = -1; + return 0xff; + } + + if ((m_cnxx_slot != -1) && (m_slotdevice[m_cnxx_slot] != NULL)) + { + return m_slotdevice[m_cnxx_slot]->read_c800(space, offset&0xfff); + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(napple2_state::c800_w) +{ + if (offset == 0x7ff) + { + m_cnxx_slot = -1; + return; + } + + if ((m_cnxx_slot != -1) && (m_slotdevice[m_cnxx_slot] != NULL)) + { + m_slotdevice[m_cnxx_slot]->write_c800(space, offset&0xfff, data); + } +} + +READ8_MEMBER(napple2_state::inh_r) +{ + if (m_inh_slot != -1) + { + return m_slotdevice[m_inh_slot]->read_inh_rom(space, offset + 0xd000); + } + + assert(0); // hitting inh_r with invalid m_inh_slot should not be possible + return read_floatingbus(); +} + +WRITE8_MEMBER(napple2_state::inh_w) +{ + if (m_inh_slot != -1) + { + m_slotdevice[m_inh_slot]->write_inh_rom(space, offset + 0xd000, data); + } +} + +// floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter +UINT8 napple2_state::read_floatingbus() +{ + enum + { + // scanner types + kScannerNone = 0, kScannerApple2, kScannerApple2e, + + // scanner constants + kHBurstClock = 53, // clock when Color Burst starts + kHBurstClocks = 4, // clocks per Color Burst duration + kHClock0State = 0x18, // H[543210] = 011000 + kHClocks = 65, // clocks per horizontal scan (including HBL) + kHPEClock = 40, // clock when HPE (horizontal preset enable) goes low + kHPresetClock = 41, // clock when H state presets + kHSyncClock = 49, // clock when HSync starts + kHSyncClocks = 4, // clocks per HSync duration + kNTSCScanLines = 262, // total scan lines including VBL (NTSC) + kNTSCVSyncLine = 224, // line when VSync starts (NTSC) + kPALScanLines = 312, // total scan lines including VBL (PAL) + kPALVSyncLine = 264, // line when VSync starts (PAL) + kVLine0State = 0x100, // V[543210CBA] = 100000000 + kVPresetLine = 256, // line when V state presets + kVSyncLines = 4, // lines per VSync duration + kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? + }; + + // vars + // + int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ + h_clock, h_state, h_0, h_1, h_2, h_3, h_4, h_5, + v_line, v_state, v_A, v_B, v_C, v_0, v_1, v_2, v_3, v_4, /* v_5, */ + _hires, addend0, addend1, addend2, sum, address; + + // video scanner data + // + i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync + + // machine state switches + // + Hires = (m_video->m_hires && m_video->m_graphics) ? 1 : 0; + Mixed = m_video->m_mix ? 1 : 0; + Page2 = m_page2 ? 1 : 0; + _80Store = 0; + + // calculate video parameters according to display standard + // + ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? + // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? + // ScanCycles = ScanLines * kHClocks; + + // calculate horizontal scanning state + // + h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock + h_state = kHClock0State + h_clock; // H state bits + if (h_clock >= kHPresetClock) // check for horizontal preset + { + h_state -= 1; // correct for state preset (two 0 states) + } + h_0 = (h_state >> 0) & 1; // get horizontal state bits + h_1 = (h_state >> 1) & 1; + h_2 = (h_state >> 2) & 1; + h_3 = (h_state >> 3) & 1; + h_4 = (h_state >> 4) & 1; + h_5 = (h_state >> 5) & 1; + + // calculate vertical scanning state + // + v_line = i / kHClocks; // which vertical scanning line + v_state = kVLine0State + v_line; // V state bits + if ((v_line >= kVPresetLine)) // check for previous vertical state preset + { + v_state -= ScanLines; // compensate for preset + } + v_A = (v_state >> 0) & 1; // get vertical state bits + v_B = (v_state >> 1) & 1; + v_C = (v_state >> 2) & 1; + v_0 = (v_state >> 3) & 1; + v_1 = (v_state >> 4) & 1; + v_2 = (v_state >> 5) & 1; + v_3 = (v_state >> 6) & 1; + v_4 = (v_state >> 7) & 1; + //v_5 = (v_state >> 8) & 1; + + // calculate scanning memory address + // + _hires = Hires; + if (Hires && Mixed && (v_4 & v_2)) + { + _hires = 0; // (address is in text memory) + } + + addend0 = 0x68; // 1 1 0 1 + addend1 = (h_5 << 5) | (h_4 << 4) | (h_3 << 3); + addend2 = (v_4 << 6) | (v_3 << 5) | (v_4 << 4) | (v_3 << 3); + sum = (addend0 + addend1 + addend2) & (0x0F << 3); + + address = 0; + address |= h_0 << 0; // a0 + address |= h_1 << 1; // a1 + address |= h_2 << 2; // a2 + address |= sum; // a3 - aa6 + address |= v_0 << 7; // a7 + address |= v_1 << 8; // a8 + address |= v_2 << 9; // a9 + address |= ((_hires) ? v_A : (1 ^ (Page2 & (1 ^ _80Store)))) << 10; // a10 + address |= ((_hires) ? v_B : (Page2 & (1 ^ _80Store))) << 11; // a11 + if (_hires) // hires? + { + // Y: insert hires only address bits + // + address |= v_C << 12; // a12 + address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 + address |= (Page2 & (1 ^ _80Store)) << 14; // a14 + } + else + { + // N: text, so no higher address bits unless Apple ][, not Apple //e + // + if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) + (kHPEClock <= h_clock) && // Y: HBL? + (h_clock <= (kHClocks - 1))) + { + address |= 1 << 12; // Y: a12 (add $1000 to address!) + } + } + + return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? +} + +/*************************************************************************** + ADDRESS MAP +***************************************************************************/ + +READ8_MEMBER(napple2_state::ram_r) +{ + if (offset < m_ram_size) + { + return m_ram_ptr[offset]; + } + + return 0xff; +} + +WRITE8_MEMBER(napple2_state::ram_w) +{ + if (offset < m_ram_size) + { + m_ram_ptr[offset] = data; + } +} + +static ADDRESS_MAP_START( apple2_map, AS_PROGRAM, 8, napple2_state ) + AM_RANGE(0x0000, 0xbfff) AM_READWRITE(ram_r, ram_w) + AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) + AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) + AM_RANGE(0xc100, 0xc7ff) AM_READWRITE(c100_r, c100_w) + AM_RANGE(0xc800, 0xcfff) AM_READWRITE(c800_r, c800_w) + AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( inhbank_map, AS_PROGRAM, 8, napple2_state ) + AM_RANGE(0x0000, 0x2fff) AM_ROM AM_REGION("maincpu", 0x1000) AM_WRITE(inh_w) + AM_RANGE(0x3000, 0x5fff) AM_READWRITE(inh_r, inh_w) +ADDRESS_MAP_END + +/*************************************************************************** + KEYBOARD +***************************************************************************/ + +READ_LINE_MEMBER(napple2_state::ay3600_shift_r) +{ + // either shift key + if (m_kbspecial->read() & 0x06) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +READ_LINE_MEMBER(napple2_state::ay3600_control_r) +{ + if (m_kbspecial->read() & 0x08) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +static const UINT8 a2_key_remap[0x32][4] = +{ +/* norm shft ctrl both */ + { 0x33,0x23,0x33,0x23 }, /* 3 # 00 */ + { 0x34,0x24,0x34,0x24 }, /* 4 $ 01 */ + { 0x35,0x25,0x35,0x25 }, /* 5 % 02 */ + { 0x36,'&', 0x35,'&' }, /* 6 & 03 */ + { 0x37,0x27,0x37,0x27 }, /* 7 ' 04 */ + { 0x38,0x28,0x38,0x28 }, /* 8 ( 05 */ + { 0x39,0x29,0x39,0x29 }, /* 9 ) 06 */ + { 0x30,0x30,0x30,0x30 }, /* 0 07 */ + { 0x3a,0x2a,0x3b,0x2a }, /* : * 08 */ + { 0x2d,0x3d,0x2d,0x3d }, /* - = 09 */ + { 0x51,0x51,0x11,0x11 }, /* q Q 0a */ + { 0x57,0x57,0x17,0x17 }, /* w W 0b */ + { 0x45,0x45,0x05,0x05 }, /* e E 0c */ + { 0x52,0x52,0x12,0x12 }, /* r R 0d */ + { 0x54,0x54,0x14,0x14 }, /* t T 0e */ + { 0x59,0x59,0x19,0x19 }, /* y Y 0f */ + { 0x55,0x55,0x15,0x15 }, /* u U 10 */ + { 0x49,0x49,0x09,0x09 }, /* i I 11 */ + { 0x4f,0x4f,0x0f,0x0f }, /* o O 12 */ + { 0x50,0x40,0x10,0x40 }, /* p P 13 */ + { 0x44,0x44,0x04,0x04 }, /* d D 14 */ + { 0x46,0x46,0x06,0x06 }, /* f F 15 */ + { 0x47,0x47,0x07,0x07 }, /* g G 16 */ + { 0x48,0x48,0x08,0x08 }, /* h H 17 */ + { 0x4a,0x4a,0x0a,0x0a }, /* j J 18 */ + { 0x4b,0x4b,0x0b,0x0b }, /* k K 19 */ + { 0x4c,0x4c,0x0c,0x0c }, /* l L 1a */ + { ';' ,0x2b,';' ,0x2b }, /* ; + 1b */ + { 0x08,0x08,0x08,0x08 }, /* Left 1c */ + { 0x15,0x15,0x15,0x15 }, /* Right 1d */ + { 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */ + { 0x58,0x58,0x18,0x18 }, /* x X 1f */ + { 0x43,0x43,0x03,0x03 }, /* c C 20 */ + { 0x56,0x56,0x16,0x16 }, /* v V 21 */ + { 0x42,0x42,0x02,0x02 }, /* b B 22 */ + { 0x4e,0x5e,0x0e,0x5e }, /* n N 23 */ + { 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */ + { 0x2c,0x3c,0x2c,0x3c }, /* , < 25 */ + { 0x2e,0x3e,0x2e,0x3e }, /* . > 26 */ + { 0x2f,0x3f,0x2f,0x3f }, /* / ? 27 */ + { 0x53,0x53,0x13,0x13 }, /* s S 28 */ + { 0x32,0x22,0x32,0x00 }, /* 2 " 29 */ + { 0x31,0x21,0x31,0x31 }, /* 1 ! 2a */ + { 0x1b,0x1b,0x1b,0x1b }, /* Escape 2b */ + { 0x41,0x41,0x01,0x01 }, /* a A 2c */ + { 0x20,0x20,0x20,0x20 }, /* Space 2d */ + { 0x00,0x00,0x00,0x00 }, /* 0x2e unused */ + { 0x00,0x00,0x00,0x00 }, /* 0x2f unused */ + { 0x00,0x00,0x00,0x00 }, /* 0x30 unused */ + { 0x0d,0x0d,0x0d,0x0d }, /* Enter 31 */ +}; + +WRITE_LINE_MEMBER(napple2_state::ay3600_data_ready_w) +{ + if (state == ASSERT_LINE) + { + int mod = 0; + m_lastchar = m_ay3600->b_r(); + + mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; + mod |= (m_kbspecial->read() & 0x08) ? 0x02 : 0x00; + + m_transchar = a2_key_remap[m_lastchar&0x3f][mod]; + + if (m_transchar != 0) + { + m_strobe = 0x80; +// printf("new char = %04x (%02x)\n", m_lastchar&0x3f, m_transchar); + } + } +} + +WRITE_LINE_MEMBER(napple2_state::ay3600_ako_w) +{ + m_anykeydown = (state == ASSERT_LINE) ? true : false; +} + +TIMER_DEVICE_CALLBACK_MEMBER(napple2_state::ay3600_repeat) +{ + // is the key still down? + if (m_anykeydown) + { + if (m_kbrepeat->read() & 1) + { + m_strobe = 0x80; + } + } +} + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( apple2_joystick ) + PORT_START("joystick_1_x") /* Joystick 1 X Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P1 Joystick X") + PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) + PORT_KEYDELTA(JOYSTICK_DELTA) + PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) + PORT_MINMAX(0,0xff) PORT_PLAYER(1) + PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) + PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) + + PORT_START("joystick_1_y") /* Joystick 1 Y Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P1 Joystick Y") + PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) + PORT_KEYDELTA(JOYSTICK_DELTA) + PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) + PORT_MINMAX(0,0xff) PORT_PLAYER(1) + PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) + PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) + + PORT_START("joystick_2_x") /* Joystick 2 X Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P2 Joystick X") + PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) + PORT_KEYDELTA(JOYSTICK_DELTA) + PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) + PORT_MINMAX(0,0xff) PORT_PLAYER(2) + PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) + + PORT_START("joystick_2_y") /* Joystick 2 Y Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P2 Joystick Y") + PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) + PORT_KEYDELTA(JOYSTICK_DELTA) + PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) + PORT_MINMAX(0,0xff) PORT_PLAYER(2) + PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) + + PORT_START("joystick_buttons") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CODE(JOYCODE_BUTTON1) +INPUT_PORTS_END + +INPUT_PORTS_START( apple2_gameport ) + PORT_INCLUDE( apple2_joystick ) +INPUT_PORTS_END + +INPUT_PORTS_START( apple2_sysconfig ) + PORT_START("a2_config") + PORT_CONFNAME(0x03, 0x00, "Composite monitor type") + PORT_CONFSETTING(0x00, "Color") + PORT_CONFSETTING(0x01, "B&W") + PORT_CONFSETTING(0x02, "Green") + PORT_CONFSETTING(0x03, "Amber") + + PORT_CONFNAME(0x04, 0x04, "Shift key mod") // default to installed + PORT_CONFSETTING(0x00, "Not present") + PORT_CONFSETTING(0x04, "Installed") +INPUT_PORTS_END + + /* + Apple II / II Plus key matrix (from "The Apple II Circuit Description") + + | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | + | | | | | | | | | | | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X0 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | :* | - | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X1 | Q | W | E | R | T | Y | U | I | O | P | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X2 | D | F | G | H | J | K | L | ;+ |LEFT |RIGHT| + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X3 | Z | X | C | V | B | N | M | ,< | .> | /? | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X4 | S | 2 | 1 | ESC | A |SPACE| | | |ENTER| + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + */ + +static INPUT_PORTS_START( apple2_common ) + PORT_START("X0") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + + PORT_START("X1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('@') + + PORT_START("X2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + + PORT_START("X3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('^') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("X4") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("X5") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("X6") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("X7") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("X8") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) +INPUT_PORTS_END + +static INPUT_PORTS_START( apple2 ) + PORT_INCLUDE(apple2_common) + + PORT_START("keyb_repeat") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + + /* other devices */ + PORT_INCLUDE( apple2_gameport ) + + PORT_INCLUDE(apple2_sysconfig) +INPUT_PORTS_END + +static INPUT_PORTS_START( apple2p ) + PORT_INCLUDE( apple2 ) + + PORT_START("reset_dip") + PORT_DIPNAME( 0x01, 0x01, "Reset" ) + PORT_DIPSETTING( 0x01, "CTRL-RESET" ) + PORT_DIPSETTING( 0x00, "RESET" ) +INPUT_PORTS_END + +static SLOT_INTERFACE_START(apple2_slot0_cards) + SLOT_INTERFACE("lang", A2BUS_RAMCARD16K) /* Apple II RAM Language Card */ + SLOT_INTERFACE("ssram", A2BUS_RAMCARD128K) /* Saturn Systems 128K extended language card */ +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(apple2_cards) + SLOT_INTERFACE("diskii", A2BUS_DISKII) /* Disk II Controller Card */ + SLOT_INTERFACE("diskiing", A2BUS_DISKIING) /* Disk II Controller Card, cycle-accurate version */ + SLOT_INTERFACE("mockingboard", A2BUS_MOCKINGBOARD) /* Sweet Micro Systems Mockingboard */ + SLOT_INTERFACE("phasor", A2BUS_PHASOR) /* Applied Engineering Phasor */ + SLOT_INTERFACE("cffa2", A2BUS_CFFA2) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 65C02/65816 firmware */ + SLOT_INTERFACE("cffa202", A2BUS_CFFA2_6502) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */ + SLOT_INTERFACE("memexp", A2BUS_MEMEXP) /* Apple II Memory Expansion Card */ + SLOT_INTERFACE("ramfactor", A2BUS_RAMFACTOR) /* Applied Engineering RamFactor */ + SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK) /* ThunderWare ThunderClock Plus */ + SLOT_INTERFACE("softcard", A2BUS_SOFTCARD) /* Microsoft SoftCard */ + SLOT_INTERFACE("videoterm", A2BUS_VIDEOTERM) /* Videx VideoTerm */ + SLOT_INTERFACE("ssc", A2BUS_SSC) /* Apple Super Serial Card */ + SLOT_INTERFACE("swyft", A2BUS_SWYFT) /* IAI SwyftCard */ + SLOT_INTERFACE("themill", A2BUS_THEMILL) /* Stellation Two The Mill (6809 card) */ + SLOT_INTERFACE("sam", A2BUS_SAM) /* SAM Software Automated Mouth (8-bit DAC + speaker) */ + SLOT_INTERFACE("alfam2", A2BUS_ALFAM2) /* ALF Apple Music II */ + SLOT_INTERFACE("echoii", A2BUS_ECHOII) /* Street Electronics Echo II */ + SLOT_INTERFACE("ap16", A2BUS_IBSAP16) /* IBS AP16 (German VideoTerm clone) */ + SLOT_INTERFACE("ap16alt", A2BUS_IBSAP16ALT) /* IBS AP16 (German VideoTerm clone), alternate revision */ + SLOT_INTERFACE("vtc1", A2BUS_VTC1) /* Unknown VideoTerm clone #1 */ + SLOT_INTERFACE("vtc2", A2BUS_VTC2) /* Unknown VideoTerm clone #2 */ + SLOT_INTERFACE("arcbd", A2BUS_ARCADEBOARD) /* Third Millenium Engineering Arcade Board */ + SLOT_INTERFACE("midi", A2BUS_MIDI) /* Generic 6840+6850 MIDI board */ + SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE) /* ZIP Technologies IDE card */ + SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS) /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */ + SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */ + SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */ + SLOT_INTERFACE("aesms", A2BUS_AESMS) /* Applied Engineering Super Music Synthesizer */ + SLOT_INTERFACE("ultraterm", A2BUS_ULTRATERM) /* Videx UltraTerm (original) */ + SLOT_INTERFACE("ultratermenh", A2BUS_ULTRATERMENH) /* Videx UltraTerm (enhanced //e) */ + SLOT_INTERFACE("aevm80", A2BUS_VTC2) /* Applied Engineering ViewMaster 80 */ + SLOT_INTERFACE("parallel", A2BUS_PIC) /* Apple Parallel Interface Card */ + SLOT_INTERFACE("corvus", A2BUS_CORVUS) /* Corvus flat-cable HDD interface (see notes in a2corvus.c) */ + SLOT_INTERFACE("mcms1", A2BUS_MCMS1) /* Mountain Computer Music System, card 1 of 2 */ + SLOT_INTERFACE("mcms2", A2BUS_MCMS2) /* Mountain Computer Music System, card 2 of 2. must be in card 1's slot + 1! */ + SLOT_INTERFACE("dx1", A2BUS_DX1) /* Decillonix DX-1 sampler card */ + SLOT_INTERFACE("tm2ho", A2BUS_TIMEMASTERHO) /* Applied Engineering TimeMaster II H.O. */ + SLOT_INTERFACE("mouse", A2BUS_MOUSE) /* Apple II Mouse Card */ + SLOT_INTERFACE("ezcgi", A2BUS_EZCGI) /* E-Z Color Graphics Interface */ + SLOT_INTERFACE("ezcgi9938", A2BUS_EZCGI_9938) /* E-Z Color Graphics Interface (TMS9938) */ + SLOT_INTERFACE("ezcgi9958", A2BUS_EZCGI_9958) /* E-Z Color Graphics Interface (TMS9958) */ +// SLOT_INTERFACE("magicmusician", A2BUS_MAGICMUSICIAN) /* Magic Musician Card */ +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( apple2_common, napple2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(A2_CPU_TAG, M6502, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(apple2_map) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", napple2_state, apple2_interrupt, "screen", 0, 1) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD(A2_VIDEO_TAG, APPLE2_VIDEO, XTAL_14_31818MHz) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192) + MCFG_SCREEN_UPDATE_DRIVER(napple2_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(napple2_state, apple2) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(A2_SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* /INH banking */ + MCFG_DEVICE_ADD(A2_UPPERBANK_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(inhbank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x3000) + + /* keyboard controller */ + MCFG_DEVICE_ADD(A2_KBDC_TAG, AY3600, 0) + MCFG_AY3600_MATRIX_X0(IOPORT("X0")) + MCFG_AY3600_MATRIX_X1(IOPORT("X1")) + MCFG_AY3600_MATRIX_X2(IOPORT("X2")) + MCFG_AY3600_MATRIX_X3(IOPORT("X3")) + MCFG_AY3600_MATRIX_X4(IOPORT("X4")) + MCFG_AY3600_MATRIX_X5(IOPORT("X5")) + MCFG_AY3600_MATRIX_X6(IOPORT("X6")) + MCFG_AY3600_MATRIX_X7(IOPORT("X7")) + MCFG_AY3600_MATRIX_X8(IOPORT("X8")) + MCFG_AY3600_SHIFT_CB(READLINE(napple2_state, ay3600_shift_r)) + MCFG_AY3600_CONTROL_CB(READLINE(napple2_state, ay3600_control_r)) + MCFG_AY3600_DATA_READY_CB(WRITELINE(napple2_state, ay3600_data_ready_w)) + MCFG_AY3600_AKO_CB(WRITELINE(napple2_state, ay3600_ako_w)) + + /* repeat timer. 15 Hz from page 90 of "The Apple II Circuit Description */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("repttmr", napple2_state, ay3600_repeat, attotime::from_hz(15)) + + /* slot devices */ + MCFG_DEVICE_ADD(A2_BUS_TAG, A2BUS, 0) + MCFG_A2BUS_CPU(A2_CPU_TAG) + MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(napple2_state, a2bus_irq_w)) + MCFG_A2BUS_OUT_NMI_CB(WRITELINE(napple2_state, a2bus_nmi_w)) + MCFG_A2BUS_OUT_INH_CB(WRITELINE(napple2_state, a2bus_inh_w)) + MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl0", apple2_slot0_cards, "lang") + MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl1", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl2", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl3", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl4", apple2_cards, "mockingboard") + MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl5", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl6", apple2_cards, "diskiing") + MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl7", apple2_cards, NULL) + + MCFG_SOFTWARE_LIST_ADD("flop525_list","apple2") + + MCFG_CASSETTE_ADD(A2_CASSETTE_TAG) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apple2, apple2_common ) + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") + MCFG_RAM_EXTRA_OPTIONS("4K,8K,12K,16K,20K,24K,32K,36K,48K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apple2p, apple2_common ) + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") + MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( space84, apple2p ) +MACHINE_CONFIG_END + +#if 0 +static MACHINE_CONFIG_DERIVED( laba2p, apple2p ) + MCFG_MACHINE_START_OVERRIDE(napple2_state,laba2p) + + MCFG_A2BUS_SLOT_REMOVE("sl0") + MCFG_A2BUS_SLOT_REMOVE("sl3") + MCFG_A2BUS_SLOT_REMOVE("sl6") + +// MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl3", A2BUS_LAB_80COL, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_IWM_FDC, NULL) + +MACHINE_CONFIG_END +#endif + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(apple2) /* the classic, non-autoboot apple2 with integer basic in rom. optional card with autoboot and applesoft basic was possible but isn't yet supported */ + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "a2.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) /* current dump is 341-0036 which is the appleII+ character generator, not the original appleII one, whose rom number is not yet known! */ + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD_OPTIONAL ( "341-0016-00.d0", 0x1000, 0x0800, CRC(4234e88a) SHA1(c9a81d704dc2f0c3416c20f9c4ab71fedda937ed)) /* 341-0016: Programmer's Aid #1 D0 */ + + ROM_LOAD ( "341-0001-00.e0", 0x2000, 0x0800, CRC(c0a4ad3b) SHA1(bf32195efcb34b694c893c2d342321ec3a24b98f)) /* Needs verification. From eBay: Label: S7925E // C48077 // 3410001-00 // (C)APPLE78 E0 */ + ROM_LOAD ( "341-0002-00.e8", 0x2800, 0x0800, CRC(a99c2cf6) SHA1(9767d92d04fc65c626223f25564cca31f5248980)) /* Needs verification. From eBay: Label: S7916E // C48078 // 3410002-00 // (C)APPLE78 E8 */ + ROM_LOAD ( "341-0003-00.f0", 0x3000, 0x0800, CRC(62230d38) SHA1(f268022da555e4c809ca1ae9e5d2f00b388ff61c)) /* Needs verification. From eBay: Label: S7908E // C48709 // 3410003 // CAPPLE78 F0 */ + ROM_LOAD ( "341-0004-00.f8", 0x3800, 0x0800, CRC(020a86d0) SHA1(52a18bd578a4694420009cad7a7a5779a8c00226)) + ROM_END + +ROM_START(apple2p) /* the autoboot apple2+ with applesoft (microsoft-written) basic in rom; optional card with monitor and integer basic was possible but isn't yet supported */ + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "341-0036.chr", 0x0000, 0x0800, CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) + + ROM_REGION(0x4000, "maincpu", ROMREGION_LE) + ROM_LOAD ( "341-0011.d0", 0x1000, 0x0800, CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) + ROM_LOAD ( "341-0012.d8", 0x1800, 0x0800, CRC(1f08087c) SHA1(a75ce5aab6401355bf1ab01b04e4946a424879b5)) + ROM_LOAD ( "341-0013.e0", 0x2000, 0x0800, CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) + ROM_LOAD ( "341-0014.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) + ROM_LOAD ( "341-0015.f0", 0x3000, 0x0800, CRC(9a04eecf) SHA1(e6bf91ed28464f42b807f798fc6422e5948bf581)) + ROM_LOAD ( "341-0020-00.f8", 0x3800, 0x0800, CRC(079589c4) SHA1(a28852ff997b4790e53d8d0352112c4b1a395098)) /* 341-0020-00: Autostart Monitor/Applesoft Basic $f800; Was sometimes mounted on Language card; Label(from Apple Language Card - Front.jpg): S 8115 // C68018 // 341-0020-00 */ +ROM_END + +ROM_START(elppa) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "elppa.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) // Taken from 341-0036.chr used in apple2p + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "elppa.d0", 0x1000, 0x0800, CRC(ce5b0e7e) SHA1(2c1a0aa023ae6deb2bddb8937345ee354028aeef)) + ROM_LOAD ( "elppa.d8", 0x1800, 0x0800, CRC(bd409bad) SHA1(5145d238042938efbb9b71e0a4ef9a980b0e38de)) + ROM_LOAD ( "elppa.e0", 0x2000, 0x0800, CRC(4c997c88) SHA1(70b639d8cbafcd5367d2f9dfd6890e5d1c6890f0)) + ROM_LOAD ( "elppa.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) + ROM_LOAD ( "elppa.f0", 0x3000, 0x0800, CRC(9a04eecf) SHA1(e6bf91ed28464f42b807f798fc6422e5948bf581)) + ROM_LOAD ( "elppa.f8", 0x3800, 0x0800, CRC(62c0c761) SHA1(19f28544fd5021a2d72e6015b3183c462c0e86f8)) +ROM_END + +ROM_START(prav82) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "pravetz82.chr", 0x0000, 0x0800, BAD_DUMP CRC(8c55c984) SHA1(5a5a202000576b88b4ae2e180dd2d1b9b337b594)) // Taken from Agat computer + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "pravetz82.d0", 0x1000, 0x0800, CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) + ROM_LOAD ( "pravetz82.d8", 0x1800, 0x0800, CRC(1f08087c) SHA1(a75ce5aab6401355bf1ab01b04e4946a424879b5)) + ROM_LOAD ( "pravetz82.e0", 0x2000, 0x0800, CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) + ROM_LOAD ( "pravetz82.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) + ROM_LOAD ( "pravetz82.f0", 0x3000, 0x0800, CRC(e26d9d35) SHA1(ce6e42e6c9a6c98e92522af7a6090cd04c56c778)) + ROM_LOAD ( "pravetz82.f8", 0x3800, 0x0800, CRC(57547818) SHA1(db30bedec98305e31a14acb9e2a92be1c4853807)) +ROM_END + +ROM_START(prav8m) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "pravetz8m.chr", 0x0000, 0x0800, BAD_DUMP CRC(8c55c984) SHA1(5a5a202000576b88b4ae2e180dd2d1b9b337b594)) // Taken from Agat computer + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "pravetz8m.d0", 0x1000, 0x0800, CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) + ROM_LOAD ( "pravetz8m.d8", 0x1800, 0x0800, CRC(654b6f7b) SHA1(f7b1457b48fe6974c4de7e976df3a8fca6b7b661)) + ROM_LOAD ( "pravetz8m.e0", 0x2000, 0x0800, CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) + ROM_LOAD ( "pravetz8m.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) + ROM_LOAD ( "pravetz8m.f0", 0x3000, 0x0800, CRC(e26d9d35) SHA1(ce6e42e6c9a6c98e92522af7a6090cd04c56c778)) + ROM_LOAD ( "pravetz8m.f8", 0x3800, 0x0800, CRC(5bab0a46) SHA1(f6c0817ce37d2e2c43f482c339acaede0a73359b)) +ROM_END + +ROM_START(uniap2pt) + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "unitron.chr", 0x0000, 0x1000, CRC(7fdd1af6) SHA1(2f4f90d90f2f3a8c1fbea304e1072780fb22e698)) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "unitron_pt.d0", 0x1000, 0x1000, CRC(311beae6) SHA1(f6379aba9ac982850edc314c93a393844a3349ef)) + ROM_LOAD ( "unitron.e0" , 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) + ROM_LOAD ( "unitron.f0" , 0x3000, 0x1000, CRC(8e047c4a) SHA1(78c57c0e00dfce7fdec9437fe2b4c25def447e5d)) +ROM_END + +ROM_START(uniap2en) + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "unitron.chr", 0x0000, 0x1000, CRC(7fdd1af6) SHA1(2f4f90d90f2f3a8c1fbea304e1072780fb22e698)) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "unitron_en.d0", 0x1000, 0x1000, CRC(24d73c7b) SHA1(d17a15868dc875c67061c95ec53a6b2699d3a425)) + ROM_LOAD ( "unitron.e0" , 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) + ROM_LOAD ( "unitron.f0" , 0x3000, 0x1000, CRC(8e047c4a) SHA1(78c57c0e00dfce7fdec9437fe2b4c25def447e5d)) +ROM_END + +ROM_START(uniap2ti) /* "Teclado Inteligente" means "smart keyboard" in brazilian portuguese */ + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "unitron.chr", 0x0000, 0x1000, CRC(7fdd1af6) SHA1(2f4f90d90f2f3a8c1fbea304e1072780fb22e698)) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "unitron_pt.d0", 0x1000, 0x1000, CRC(311beae6) SHA1(f6379aba9ac982850edc314c93a393844a3349ef)) + ROM_LOAD ( "unitron.e0" , 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) + ROM_LOAD ( "unitron.f0" , 0x3000, 0x1000, CRC(8e047c4a) SHA1(78c57c0e00dfce7fdec9437fe2b4c25def447e5d)) + + ROM_REGION(0x4000,"keyboard",0) + ROM_LOAD ( "unitron_apii+_keyboard.ic3", 0x0800, 0x0800, CRC(edc43205) SHA1(220cc21d86f1ab63a301ae7a9c5ff0f3f6cddb70)) +ROM_END + + +/* + J-Plus ROM numbers confirmed by: + http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/Apple%20II/Apple%20II%20j-plus/Photos/Apple%20II%20j-plus%20-%20Motherboard.jpg +*/ + +ROM_START(apple2jp) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "a2jp.chr", 0x0000, 0x0800, CRC(487104b5) SHA1(0a382be58db5215c4a3de53b19a72fab660d5da2)) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "341-0011.d0", 0x1000, 0x0800, BAD_DUMP CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) + ROM_LOAD ( "341-0012.d8", 0x1800, 0x0800, BAD_DUMP CRC(1f08087c) SHA1(a75ce5aab6401355bf1ab01b04e4946a424879b5)) + ROM_LOAD ( "341-0013.e0", 0x2000, 0x0800, BAD_DUMP CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) + ROM_LOAD ( "341-0014.e8", 0x2800, 0x0800, BAD_DUMP CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) + ROM_LOAD ( "341-0015.f0", 0x3000, 0x0800, BAD_DUMP CRC(9a04eecf) SHA1(e6bf91ed28464f42b807f798fc6422e5948bf581)) + ROM_LOAD ( "341-0047.f8", 0x3800, 0x0800, CRC(6ea8379b) SHA1(00a75ae3b58e1917ad640249366f654608589cf4)) +ROM_END + +ROM_START(maxxi) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "maxxi.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) // Taken from 341-0036.chr used in apple2p + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "maxxi.d0", 0x1000, 0x1000, CRC(7831f025) SHA1(0eb4161e5223c0dde2d140fcbace80d292ff9dc6)) + ROM_LOAD ( "maxxi.e0", 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) + ROM_LOAD ( "maxxi.f0", 0x3000, 0x1000, CRC(34e4d01b) SHA1(44853b2d59ddd234db76c1a0d529180fb1e008ef)) + + ROM_REGION(0x0800,"keyboard",0) + ROM_LOAD ( "maxxi_teclado.rom", 0x0000, 0x0800, CRC(10c2d5b6) SHA1(226036d2f6f8fa5675303640ee1e5f0bab1135c6)) +ROM_END + +ROM_START(ace100) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "ace100.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) // copy of a2.chr - real Ace chr is undumped + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "ace100.rom", 0x1000, 0x3000, CRC(9d5ec94f) SHA1(8f2b3f2561788bebc7a805f620ec9e7ade973460)) +ROM_END + +ROM_START(space84) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD( "space 84 mobo chargen.bin", 0x0000, 0x2000, CRC(ceb98990) SHA1(8b2758da611bcfdd3d144edabc63ef1df2ca787b) ) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD ( "341-0011.d0", 0x1000, 0x0800, CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) + ROM_LOAD ( "341-0012.d8", 0x1800, 0x0800, CRC(1f08087c) SHA1(a75ce5aab6401355bf1ab01b04e4946a424879b5)) + ROM_LOAD ( "341-0013.e0", 0x2000, 0x0800, CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) + ROM_LOAD ( "341-0014.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) + ROM_LOAD( "space84_f.bin", 0x3000, 0x1000, CRC(4e741069) SHA1(ca1f16da9fb40e966ee4a899964cd6a7e140ab50)) +ROM_END + +ROM_START(am64) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD( "gm-2716.bin", 0x0000, 0x0800, CRC(863e657f) SHA1(cc954204c503bc545ec0d08862483aaad83805d5) ) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD( "am64-27128.bin", 0x0000, 0x4000, CRC(f25cdc7b) SHA1(235e72b77695938a9df8781f5bea3cbbbe1f4c76) ) + + ROM_REGION(0x2000, "spares", 0) + // parallel card ROM + ROM_LOAD( "ap-2716.bin", 0x0000, 0x0800, CRC(c6990f08) SHA1(e7daf63639234e46738a4d78a49287d11ccaf537) ) + // i8048 keyboard MCU ROM + ROM_LOAD( "tk10.bin", 0x0800, 0x0800, CRC(a06c5b78) SHA1(27c5160b913e0f62120f384026d24b9f1acb6970) ) +ROM_END + +ROM_START( agat7 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) + ROMX_LOAD( "monitor7.rom", 0x3800, 0x0800, CRC(071fda0b) SHA1(6089d46b7addc4e2ae096b2cf81124681bd2b27a), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) + ROMX_LOAD( "agat_pzu.bin", 0x3800, 0x0800, CRC(c605163d) SHA1(b30fd1b264a347a9de69bb9e3105483254994d06), ROM_BIOS(2)) + // Floppy controllers + ROM_LOAD( "shugart7.rom", 0x4500, 0x0100, CRC(c6e4850c) SHA1(71626d3d2d4bbeeac2b77585b45a5566d20b8d34)) + ROM_LOAD( "teac.rom", 0x4500, 0x0100, CRC(94266928) SHA1(5d369bad6cdd6a70b0bb16480eba69640de87a2e)) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD( "agathe7.fnt", 0x0000, 0x0800, CRC(fcffb490) SHA1(0bda26ae7ad75f74da835c0cf6d9928f9508844c)) +ROM_END + +ROM_START( agat9 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) + ROMX_LOAD( "monitor9.rom", 0x3800, 0x0800, CRC(b90bb66a) SHA1(02217f0785913b41fc25eabcff70fa814799c69a), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) + ROMX_LOAD( "monitor91.rom", 0x3800, 0x0800, CRC(89b10fc1) SHA1(7fe1ede32b5525255f82597ca9c3c2034c5996fa), ROM_BIOS(2)) + // Floppy controllers + ROM_LOAD( "shugart9.rom", 0x4500, 0x0100, CRC(964a0ce2) SHA1(bf955189ebffe874c20ef649a3db8177dc16af61)) + ROM_LOAD( "teac.rom", 0x4500, 0x0100, CRC(94266928) SHA1(5d369bad6cdd6a70b0bb16480eba69640de87a2e)) + // Printer card + ROM_LOAD( "cm6337.rom", 0x8000, 0x0100, CRC(73be16ec) SHA1(ead1abbef5b86f1def0b956147d5b267f0d544b5)) + ROM_LOAD( "cm6337p.rom", 0x8100, 0x0800, CRC(9120f11f) SHA1(78107653491e88d5ea12e07367c4c028771a4aca)) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD( "agathe9.fnt", 0x0000, 0x0800, CRC(8c55c984) SHA1(5a5a202000576b88b4ae2e180dd2d1b9b337b594)) +ROM_END + +ROM_START(ivelultr) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD( "ultra.chr", 0x0000, 0x1000,CRC(fed62c85) SHA1(479fb3f38a3f7332cef2e8c4856871afe8dc6017)) + ROM_LOAD( "ultra.chr", 0x1000, 0x1000,CRC(fed62c85) SHA1(479fb3f38a3f7332cef2e8c4856871afe8dc6017)) + + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD( "ultra1.bin", 0x2000, 0x1000, CRC(8ab49c1c) SHA1(b41da28a40c3a22bc10a954a86716a1a2bae04a4)) + ROM_CONTINUE(0x1000, 0x1000) + ROM_LOAD( "ultra2.bin", 0x3000, 0x1000, CRC(1ac1e17e) SHA1(a5b8adec37da91970c303905b5e2c4d1b715ee4e)) + + ROM_REGION(0x800, "kbmcu", 0) // 6802 code for keyboard MCU (very unlike real Apples, will require some reverse-engineering) + ROM_LOAD( "ultra4.bin", 0x0000, 0x0800, CRC(3dce51ac) SHA1(676b6e775d5159049cae5b6143398ec7b2bf437a) ) +ROM_END + +#if 0 +ROM_START(laba2p) /* II Plus clone with on-board Disk II controller and Videx-compatible 80-column card, supposedly from lab equipment */ + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD( "char.u30", 0x0000, 0x1000, CRC(2dbaef88) SHA1(9834842796132a11facd57923326d6954bcb609f) ) + + ROM_REGION(0x4700,"maincpu",0) + ROM_LOAD( "maind0.u35", 0x1000, 0x1000, CRC(24d73c7b) SHA1(d17a15868dc875c67061c95ec53a6b2699d3a425) ) + ROM_LOAD( "maine0.u34", 0x2000, 0x2000, CRC(314462ca) SHA1(5a23616dca14e59b4aca8ff6cfa0d98592a78a79) ) + + ROM_REGION(0x1000, "fw80col", 0) + ROM_LOAD( "80cfw.u3", 0x0000, 0x1000, CRC(92d2b8b0) SHA1(5149483eb3e550ece1584e85fc821bb04d068dec) ) // firmware for on-board Videx + + ROM_REGION(0x1000, "cg80col", 0) + ROM_LOAD( "80ccgv80.u25", 0x0000, 0x1000, CRC(6d5e2707) SHA1(c56f76e8a366fee7374eb09f4866435c692490b2) ) // character generator for on-board Videx + + ROM_REGION(0x800, "diskii", 0) + ROM_LOAD( "diskfw.u7", 0x0000, 0x0800, CRC(9207ef4e) SHA1(5fcffa4c68b16a7ef2f62651d4c7470400e5bd35) ) // firmware for on-board Disk II + + ROM_REGION(0x800, "unknown", 0) + ROM_LOAD( "unk.u5", 0x0000, 0x0800, CRC(240a1774) SHA1(e6aeb0702dc99d76fd8c5a642fdfbe9ab896acd4) ) // unknown ROM +ROM_END +#endif + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1977, apple2, 0, 0, apple2, apple2, driver_device, 0, "Apple Computer", "Apple ][", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, apple2p, apple2, 0, apple2p, apple2p, driver_device, 0, "Apple Computer", "Apple ][+", MACHINE_SUPPORTS_SAVE ) +COMP( 1980, apple2jp, apple2, 0, apple2p, apple2p, driver_device, 0, "Apple Computer", "Apple ][ J-Plus", MACHINE_SUPPORTS_SAVE ) +COMP( 198?, elppa, apple2, 0, apple2p, apple2p, driver_device, 0, "Victor do Brasil", "Elppa II+", MACHINE_SUPPORTS_SAVE ) +COMP( 1982, maxxi, apple2, 0, apple2p, apple2p, driver_device, 0, "Polymax", "Maxxi", MACHINE_SUPPORTS_SAVE ) +COMP( 1982, prav82, apple2, 0, apple2p, apple2p, driver_device, 0, "Pravetz", "Pravetz 82", MACHINE_SUPPORTS_SAVE ) +COMP( 1982, ace100, apple2, 0, apple2, apple2p, driver_device, 0, "Franklin Computer", "Franklin Ace 100", MACHINE_SUPPORTS_SAVE ) +COMP( 1982, uniap2en, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II (in English)", MACHINE_SUPPORTS_SAVE ) +COMP( 1982, uniap2pt, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II (in Brazilian Portuguese)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, uniap2ti, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II+ (Teclado Inteligente)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, agat7, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-7", MACHINE_NOT_WORKING) // disk controller ROM JSRs to $FCA8 which is a delay on apple II, illegal instruction crash here :( +// reverse font direction -\/ +COMP( 1984, ivelultr, apple2, 0, apple2p, apple2p, driver_device, 0, "Ivasim", "Ivel Ultra", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, agat9, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-9", MACHINE_NOT_WORKING) +COMP( 1985, prav8m, apple2, 0, apple2p, apple2p, driver_device, 0, "Pravetz", "Pravetz 8M", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, space84, apple2, 0, space84, apple2p, driver_device, 0, "ComputerTechnik/IBS", "Space 84", MACHINE_NOT_WORKING ) +COMP( 1985, am64, apple2, 0, space84, apple2p, driver_device, 0, "ASEM", "AM 64", MACHINE_SUPPORTS_SAVE ) +//COMP( 19??, laba2p, apple2, 0, laba2p, apple2p, driver_device, 0, "", "Lab equipment Apple II Plus clone", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/apple2e.c b/src/mame/drivers/apple2e.c new file mode 100644 index 00000000000..e5eb2193aa8 --- /dev/null +++ b/src/mame/drivers/apple2e.c @@ -0,0 +1,3582 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + apple2e.c - Apple IIe/IIc/IIc Plus and clones + + Next generation driver written in September/October 2014 by R. Belmont. + Thanks to the original Apple II series driver's authors: Mike Balfour, Nathan Woods, and R. Belmont + Special thanks to the Apple II Documentation Project/Antoine Vignau and Peter Ferrie. + + + IIe: base of this driver. 64K RAM, slot 0 language card emulation without the double-read requirement, + lowercase and SHIFT key on button 2, Open and Solid Apple buttons on joy buttons 0 and 1, + auxiliary slot, built-in 80 column support if extra RAM added. + + Physical slot 0 was eliminated thanks to the built-in language card. + + Most of the write-only softswitches gained readback locations, necessary to make interrupt-driven + software possible. + + Base 80-column card: 1K RAM, allows 80 columns and double-lo-res, + no double-hi-res. + + Extended 80-column card: 64K RAM (including a second language card), + allows 80 columns, double-lo-res, and double-hi-res. + + Revision A motherboards (very rare) don't support double-hi-res; it's unclear + if double-lo-res works or not. We emulate the much more common Rev B or later + board. + + IIe enhanced: 65C02 CPU with more instructions, MouseText in the character generator. + + IIe platinum: Like enhanced but with added numeric keypad and extended 80-column card + included in the box. Keypad CLEAR generates ESC by default, one hardware mod + made it generate CTRL-X instead. (new keyboard encoder ROM?) + + NOTE: On real IIe and IIe enhanced h/w, pressing SHIFT and paddle button 2 will + short out the power supply and cause a safety shutdown. (We don't emulate + this "feature", and it was relatively rare in real life as Apple joysticks only + had buttons 0 and 1 normally). + + IIc: IIe enhanced shrunken into a pizzabox with a Disk II compatible + half-height drive included in the case. + + No slots, but included functionality equivalent to the following slots + on the motherboard: + - 2 Super Serial Cards (modem and printer ports) + - extended 80 column card / 128K RAM + - Disk II IWM controller + - Apple II Mouse card (firmware entry points are compatible, + but the hardware implementation omits the 68705 and is quite different!) + + Has a 40/80 column switch and a QWERTY/DVORAK switch. + + IIc (UniDisk 3.5): IIc with ROM doubled to 32K and the ROMSWITCH register + added to page between the original 16K ROM and the new added 16K. The + extra firmware space was dedicated to implementing the Protocol Converter, + later renamed "SmartPort", which communicates with "smart" packet devices + over the IWM bus. + + Partial AppleTalk code also exists in this ROM but it doesn't work and + was not completed. + + IIc (Original Memory Expansion): + Removes AppleTalk and adds support for a memory expansion card with up + to 1 MB; this is identical both in hardware and firmware to the "Slinky" + memory expansion card for the Apple IIe (a2bus/a2memexp.c). + + IIc (Revised Memory Expansion, Rev. 3): + Fixes several nasty bugs in the Original Memory Expansion version. Not + currently dumped. + + IIc (Rev 4): + Fixes memory size detection for memory cards with less than 1MB. Fixes + several screen hole errors introduced in Rev 3, and fixes Terminal Mode + wherein the firmware can be put into a built-in terminal mode for simple + tests with a modem. + + IIc Plus: + Like IIc with memory expansion, but with licensed built-in Zip Chip which + runs the 65C02 at 4 MHz turbo speed with a small cache RAM. + + The machine has an internal "Apple 3.5" drive plus a custom gate array + which emulates the functionality of the UniDisk 3.5's on-board 65C02. + This gets around the fact that 1 MHz isn't sufficient to handle direct + Woz-style control of a double-density 3.5" drive. + + External drive port allows IIgs-style daisy-chaining. + +---------------------------------- + +TK3000 keyboard matrix + +Data bus D0-D7 is X0-X7 +Address bus A0-A11 is Y0-Y11 + +***************************************************************************/ + +#include "emu.h" +#include "machine/bankdev.h" +#include "machine/ram.h" +#include "machine/kb3600.h" +#include "sound/speaker.h" +#include "imagedev/flopdrv.h" +#include "imagedev/cassette.h" +#include "formats/ap2_dsk.h" +#include "cpu/m6502/m6502.h" +#include "cpu/m6502/m65c02.h" +#include "cpu/z80/z80.h" +#include "formats/ap_dsk35.h" +#include "machine/sonydriv.h" +#include "machine/appldriv.h" +#include "bus/rs232/rs232.h" +#include "machine/mos6551.h" +#include "video/apple2.h" + +#include "bus/a2bus/a2bus.h" +#include "bus/a2bus/a2lang.h" +#include "bus/a2bus/a2diskii.h" +#include "bus/a2bus/a2diskiing.h" +#include "bus/a2bus/a2mockingboard.h" +#include "bus/a2bus/a2cffa.h" +#include "bus/a2bus/a2memexp.h" +#include "bus/a2bus/a2scsi.h" +#include "bus/a2bus/a2thunderclock.h" +#include "bus/a2bus/a2softcard.h" +#include "bus/a2bus/a2videoterm.h" +#include "bus/a2bus/a2ssc.h" +#include "bus/a2bus/a2swyft.h" +#include "bus/a2bus/a2themill.h" +#include "bus/a2bus/a2sam.h" +#include "bus/a2bus/a2alfam2.h" +#include "bus/a2bus/laser128.h" +#include "bus/a2bus/a2echoii.h" +#include "bus/a2bus/a2arcadebd.h" +#include "bus/a2bus/a2midi.h" +#include "bus/a2bus/a2zipdrive.h" +#include "bus/a2bus/a2applicard.h" +#include "bus/a2bus/a2ultraterm.h" +#include "bus/a2bus/a2pic.h" +#include "bus/a2bus/a2corvus.h" +#include "bus/a2bus/a2mcms.h" +#include "bus/a2bus/a2dx1.h" +#include "bus/a2bus/timemasterho.h" +#include "bus/a2bus/mouse.h" +#include "bus/a2bus/ezcgi.h" +#include "bus/a2bus/a2eauxslot.h" +#include "bus/a2bus/a2estd80col.h" +#include "bus/a2bus/a2eext80col.h" +#include "bus/a2bus/a2eramworks3.h" + +#define A2_CPU_TAG "maincpu" +#define A2_KBDC_TAG "ay3600" +#define A2_BUS_TAG "a2bus" +#define A2_SPEAKER_TAG "speaker" +#define A2_CASSETTE_TAG "tape" +#define A2_UPPERBANK_TAG "inhbank" +#define IIC_ACIA1_TAG "acia1" +#define IIC_ACIA2_TAG "acia2" +#define IICP_IWM_TAG "iwm" +#define LASER128_UDC_TAG "l128udc" +#define PRINTER_PORT_TAG "printer" +#define MODEM_PORT_TAG "modem" +#define A2_AUXSLOT_TAG "auxbus" +#define A2_VIDEO_TAG "a2video" + +#define A2_0000_TAG "r00bank" +#define A2_0200_TAG "r02bank" +#define A2_0400_TAG "r04bank" +#define A2_0800_TAG "r08bank" +#define A2_2000_TAG "r20bank" +#define A2_4000_TAG "r40bank" +#define A2_C100_TAG "c1bank" +#define A2_C300_TAG "c3bank" +#define A2_C400_TAG "c4bank" +#define A2_C800_TAG "c8bank" +#define A2_LCBANK_TAG "lcbank" + +#define MOUSE_BUTTON_TAG "mse_button" +#define MOUSE_XAXIS_TAG "mse_x" +#define MOUSE_YAXIS_TAG "mse_y" + +#define CNXX_UNCLAIMED -1 +#define CNXX_INTROM -2 + +#define IRQ_SLOT 0 +#define IRQ_VBL 1 +#define IRQ_MOUSEXY 2 + +class apple2e_state : public driver_device +{ +public: + apple2e_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, A2_CPU_TAG), + m_ram(*this, RAM_TAG), + m_rom(*this, "maincpu"), + m_ay3600(*this, A2_KBDC_TAG), + m_video(*this, A2_VIDEO_TAG), + m_a2bus(*this, A2_BUS_TAG), + m_a2eauxslot(*this, A2_AUXSLOT_TAG), + m_joy1x(*this, "joystick_1_x"), + m_joy1y(*this, "joystick_1_y"), + m_joy2x(*this, "joystick_2_x"), + m_joy2y(*this, "joystick_2_y"), + m_joybuttons(*this, "joystick_buttons"), + m_mouseb(*this, MOUSE_BUTTON_TAG), + m_mousex(*this, MOUSE_XAXIS_TAG), + m_mousey(*this, MOUSE_YAXIS_TAG), + m_kbdrom(*this, "keyboard"), + m_kbspecial(*this, "keyb_special"), + m_sysconfig(*this, "a2_config"), + m_speaker(*this, A2_SPEAKER_TAG), + m_cassette(*this, A2_CASSETTE_TAG), + m_upperbank(*this, A2_UPPERBANK_TAG), + m_0000bank(*this, A2_0000_TAG), + m_0200bank(*this, A2_0200_TAG), + m_0400bank(*this, A2_0400_TAG), + m_0800bank(*this, A2_0800_TAG), + m_2000bank(*this, A2_2000_TAG), + m_4000bank(*this, A2_4000_TAG), + m_c100bank(*this, A2_C100_TAG), + m_c300bank(*this, A2_C300_TAG), + m_c400bank(*this, A2_C400_TAG), + m_c800bank(*this, A2_C800_TAG), + m_lcbank(*this, A2_LCBANK_TAG), + m_acia1(*this, IIC_ACIA1_TAG), + m_acia2(*this, IIC_ACIA2_TAG), + m_laserudc(*this, LASER128_UDC_TAG), + m_iicpiwm(*this, IICP_IWM_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + required_memory_region m_rom; + required_device m_ay3600; + required_device m_video; + required_device m_a2bus; + optional_device m_a2eauxslot; + required_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons; + optional_ioport m_mouseb, m_mousex, m_mousey; + optional_memory_region m_kbdrom; + required_ioport m_kbspecial; + required_ioport m_sysconfig; + required_device m_speaker; + optional_device m_cassette; + required_device m_upperbank; + required_device m_0000bank; + required_device m_0200bank; + required_device m_0400bank; + required_device m_0800bank; + required_device m_2000bank; + required_device m_4000bank; + required_device m_c100bank; + required_device m_c300bank; + required_device m_c400bank; + required_device m_c800bank; + required_device m_lcbank; + optional_device m_acia1, m_acia2; + optional_device m_laserudc; + optional_device m_iicpiwm; + + TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(ay3600_repeat); + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_PALETTE_INIT(apple2); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER(ram0000_r); + DECLARE_WRITE8_MEMBER(ram0000_w); + DECLARE_READ8_MEMBER(ram0200_r); + DECLARE_WRITE8_MEMBER(ram0200_w); + DECLARE_READ8_MEMBER(ram0400_r); + DECLARE_WRITE8_MEMBER(ram0400_w); + DECLARE_READ8_MEMBER(ram0800_r); + DECLARE_WRITE8_MEMBER(ram0800_w); + DECLARE_READ8_MEMBER(ram2000_r); + DECLARE_WRITE8_MEMBER(ram2000_w); + DECLARE_READ8_MEMBER(ram4000_r); + DECLARE_WRITE8_MEMBER(ram4000_w); + DECLARE_READ8_MEMBER(auxram0000_r); + DECLARE_WRITE8_MEMBER(auxram0000_w); + DECLARE_READ8_MEMBER(auxram0200_r); + DECLARE_WRITE8_MEMBER(auxram0200_w); + DECLARE_READ8_MEMBER(auxram0400_r); + DECLARE_WRITE8_MEMBER(auxram0400_w); + DECLARE_READ8_MEMBER(auxram0800_r); + DECLARE_WRITE8_MEMBER(auxram0800_w); + DECLARE_READ8_MEMBER(auxram2000_r); + DECLARE_WRITE8_MEMBER(auxram2000_w); + DECLARE_READ8_MEMBER(auxram4000_r); + DECLARE_WRITE8_MEMBER(auxram4000_w); + DECLARE_READ8_MEMBER(c000_r); + DECLARE_WRITE8_MEMBER(c000_w); + DECLARE_READ8_MEMBER(c000_iic_r); + DECLARE_WRITE8_MEMBER(c000_iic_w); + DECLARE_READ8_MEMBER(c080_r); + DECLARE_WRITE8_MEMBER(c080_w); + DECLARE_READ8_MEMBER(c100_r); + DECLARE_READ8_MEMBER(c100_int_r); + DECLARE_READ8_MEMBER(c100_int_bank_r); + DECLARE_WRITE8_MEMBER(c100_w); + DECLARE_READ8_MEMBER(c300_r); + DECLARE_READ8_MEMBER(c300_int_r); + DECLARE_READ8_MEMBER(c300_int_bank_r); + DECLARE_WRITE8_MEMBER(c300_w); + DECLARE_READ8_MEMBER(c400_r); + DECLARE_READ8_MEMBER(c400_int_r); + DECLARE_READ8_MEMBER(c400_int_bank_r); + DECLARE_WRITE8_MEMBER(c400_w); + DECLARE_READ8_MEMBER(c800_r); + DECLARE_WRITE8_MEMBER(c800_w); + DECLARE_READ8_MEMBER(inh_r); + DECLARE_WRITE8_MEMBER(inh_w); + DECLARE_READ8_MEMBER(lc_r); + DECLARE_WRITE8_MEMBER(lc_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); + DECLARE_READ_LINE_MEMBER(ay3600_shift_r); + DECLARE_READ_LINE_MEMBER(ay3600_control_r); + DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); + DECLARE_WRITE_LINE_MEMBER(ay3600_ako_w); + DECLARE_READ8_MEMBER(memexp_r); + DECLARE_WRITE8_MEMBER(memexp_w); + +private: + int m_speaker_state; + int m_cassette_state, m_cassette_out; + + double m_joystick_x1_time; + double m_joystick_y1_time; + double m_joystick_x2_time; + double m_joystick_y2_time; + + UINT16 m_lastchar, m_strobe; + UINT8 m_transchar; + bool m_anykeydown; + int m_repeatdelay; + + int m_inh_slot; + int m_cnxx_slot; + + bool m_page2; + bool m_an0, m_an1, m_an2, m_an3; + + bool m_vbl, m_vblmask; + + bool m_xy, m_x0edge, m_y0edge; + bool m_x0, m_x1, m_y0, m_y1; + bool m_xirq, m_yirq; + int last_mx, last_my, count_x, count_y; + + bool m_intcxrom; + bool m_80store; + bool m_slotc3rom; + bool m_altzp; + bool m_ramrd, m_ramwrt; + bool m_lcram, m_lcram2, m_lcwriteenable; + bool m_ioudis; + bool m_romswitch; + + bool m_isiic, m_isiicplus; + UINT8 m_iicplus_ce00[0x200]; + + UINT8 *m_ram_ptr, *m_rom_ptr; + int m_ram_size; + + UINT8 *m_aux_ptr, *m_aux_bank_ptr; + + int m_inh_bank; + + double m_x_calibration, m_y_calibration; + + device_a2bus_card_interface *m_slotdevice[8]; + device_a2eauxslot_card_interface *m_auxslotdevice; + + int m_irqmask; + + UINT8 m_exp_bankhior; + int m_exp_addrmask; + UINT8 m_exp_regs[0x10]; + UINT8 *m_exp_ram; + int m_exp_wptr, m_exp_liveptr; + + void do_io(address_space &space, int offset, bool is_iic); + UINT8 read_floatingbus(); + void update_slotrom_banks(); + void lc_update(int offset); + UINT8 read_slot_rom(address_space &space, int slotbias, int offset); + void write_slot_rom(address_space &space, int slotbias, int offset, UINT8 data); + UINT8 read_int_rom(address_space &space, int slotbias, int offset); + void auxbank_update(); + void raise_irq(int irq); + void lower_irq(int irq); + void update_iic_mouse(); +}; + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +#define JOYSTICK_DELTA 80 +#define JOYSTICK_SENSITIVITY 50 +#define JOYSTICK_AUTOCENTER 80 + +WRITE_LINE_MEMBER(apple2e_state::a2bus_irq_w) +{ + if (state == ASSERT_LINE) + { + raise_irq(IRQ_SLOT); + } + else + { + lower_irq(IRQ_SLOT); + } +} + +WRITE_LINE_MEMBER(apple2e_state::a2bus_nmi_w) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, state); +} + +// TODO: this assumes /INH only on ROM, needs expansion to support e.g. phantom-slotting cards and etc. +WRITE_LINE_MEMBER(apple2e_state::a2bus_inh_w) +{ + if (state == ASSERT_LINE) + { + // assume no cards are pulling /INH + m_inh_slot = -1; + + // scan the slots to figure out which card(s) are INHibiting stuff + for (int i = 0; i <= 7; i++) + { + if (m_slotdevice[i]) + { + // this driver only can inhibit from 0xd000-0xffff + if ((m_slotdevice[i]->inh_start() == 0xd000) && + (m_slotdevice[i]->inh_end() == 0xffff)) + { + if ((m_slotdevice[i]->inh_type() & INH_READ) == INH_READ) + { + if (m_inh_bank != 1) + { + m_upperbank->set_bank(1); + m_inh_bank = 1; + } + } + else + { + if (m_inh_bank != 0) + { + m_upperbank->set_bank(0); + m_inh_bank = 0; + } + } + + m_inh_slot = i; + break; + } + } + } + + // if no slots are inhibiting, make sure ROM is fully switched in + if ((m_inh_slot == -1) && (m_inh_bank != 0)) + { + m_upperbank->set_bank(0); + m_inh_bank = 0; + } + } +} + +READ8_MEMBER(apple2e_state::memexp_r) +{ + UINT8 retval = m_exp_regs[offset]; + + if (!m_exp_ram) + { + return 0xff; + } + + if (offset == 3) + { + if (m_exp_liveptr <= m_exp_addrmask) + { + retval = m_exp_ram[m_exp_liveptr]; + } + else + { + retval = 0xff; + } + m_exp_liveptr++; + m_exp_regs[0] = m_exp_liveptr & 0xff; + m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; + } + + return retval; +} + +WRITE8_MEMBER(apple2e_state::memexp_w) +{ + if (!m_exp_ram) + { + return; + } + + switch (offset & 0xf) + { + case 0: + m_exp_wptr &= ~0xff; + m_exp_wptr |= data; + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 1: + m_exp_wptr &= ~0xff00; + m_exp_wptr |= (data<<8); + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 2: + m_exp_wptr &= ~0xff0000; + m_exp_wptr |= (data<<16); + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 3: +// printf("Write %02x to RAM[%x]\n", data, m_liveptr); + if (m_exp_liveptr <= m_exp_addrmask) + { + m_exp_ram[m_exp_liveptr] = data; + } + m_exp_liveptr++; + m_exp_regs[0] = m_exp_liveptr & 0xff; + m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; + break; + + default: + m_exp_regs[offset] = data; + break; + } +} + +/*************************************************************************** + START/RESET +***************************************************************************/ + +void apple2e_state::machine_start() +{ + m_ram_ptr = m_ram->pointer(); + m_rom_ptr = m_rom->base(); + m_ram_size = m_ram->size(); + m_speaker_state = 0; + m_speaker->level_w(m_speaker_state); + m_cassette_state = 0; + m_cassette_out = 0; + if (m_cassette) + { + m_cassette->output(-1.0f); + } + m_upperbank->set_bank(0); + m_lcbank->set_bank(0); + m_0000bank->set_bank(0); + m_0200bank->set_bank(0); + m_0400bank->set_bank(0); + m_0800bank->set_bank(0); + m_2000bank->set_bank(0); + m_4000bank->set_bank(0); + m_inh_bank = 0; + + // expansion RAM size + if (m_ram_size > (128*1024)) + { + m_exp_addrmask = m_ram_size - (128*1024) - 1; + m_exp_ram = m_ram_ptr + (128*1024); + } + else // no expansion + { + m_exp_addrmask = 0; + m_exp_ram = NULL; + } + + // precalculate joystick time constants + m_x_calibration = attotime::from_usec(12).as_double(); + m_y_calibration = attotime::from_usec(13).as_double(); + + // cache slot devices + for (int i = 0; i <= 7; i++) + { + m_slotdevice[i] = m_a2bus->get_a2bus_card(i); + } + + // and aux slot device if any + m_aux_ptr = NULL; + m_aux_bank_ptr = NULL; + if (m_a2eauxslot) + { + m_auxslotdevice = m_a2eauxslot->get_a2eauxslot_card(); + if (m_auxslotdevice) + { + m_aux_ptr = m_auxslotdevice->get_vram_ptr(); + m_aux_bank_ptr = m_auxslotdevice->get_auxbank_ptr(); + } + } + else // IIc has 128K right on the motherboard + { + m_auxslotdevice = NULL; + + if (m_ram_size >= (128*1024)) + { + m_aux_ptr = &m_ram_ptr[0x10000]; + m_aux_bank_ptr = m_aux_ptr; + } + } + + // setup video pointers + m_video->m_ram_ptr = m_ram_ptr; + m_video->m_aux_ptr = m_aux_ptr; + m_video->m_char_ptr = memregion("gfx1")->base(); + m_video->m_char_size = memregion("gfx1")->bytes(); + + m_inh_slot = -1; + m_cnxx_slot = CNXX_UNCLAIMED; + + // setup save states + save_item(NAME(m_speaker_state)); + save_item(NAME(m_cassette_state)); + save_item(NAME(m_joystick_x1_time)); + save_item(NAME(m_joystick_y1_time)); + save_item(NAME(m_joystick_x2_time)); + save_item(NAME(m_joystick_y2_time)); + save_item(NAME(m_lastchar)); + save_item(NAME(m_strobe)); + save_item(NAME(m_transchar)); + save_item(NAME(m_inh_slot)); + save_item(NAME(m_inh_bank)); + save_item(NAME(m_cnxx_slot)); + save_item(NAME(m_page2)); + save_item(NAME(m_an0)); + save_item(NAME(m_an1)); + save_item(NAME(m_an2)); + save_item(NAME(m_an3)); + save_item(NAME(m_intcxrom)); + save_item(NAME(m_80store)); + save_item(NAME(m_slotc3rom)); + save_item(NAME(m_altzp)); + save_item(NAME(m_ramrd)); + save_item(NAME(m_ramwrt)); + save_item(NAME(m_ioudis)); + save_item(NAME(m_vbl)); + save_item(NAME(m_vblmask)); + save_item(NAME(m_romswitch)); + save_item(NAME(m_irqmask)); + save_item(NAME(m_anykeydown)); + save_item(NAME(m_repeatdelay)); + save_item(NAME(m_xy)); + save_item(NAME(m_x0edge)); + save_item(NAME(m_y0edge)); + save_item(NAME(last_mx)); + save_item(NAME(last_my)); + save_item(NAME(count_x)); + save_item(NAME(count_y)); + save_item(NAME(m_x0)); + save_item(NAME(m_x1)); + save_item(NAME(m_y0)); + save_item(NAME(m_y1)); + save_item(NAME(m_xirq)); + save_item(NAME(m_yirq)); + save_item(NAME(m_iicplus_ce00)); + save_item(NAME(m_exp_regs)); + save_item(NAME(m_exp_wptr)); + save_item(NAME(m_exp_liveptr)); + save_item(NAME(m_exp_bankhior)); + save_item(NAME(m_exp_addrmask)); + save_item(NAME(m_lcram)); + save_item(NAME(m_lcram2)); + save_item(NAME(m_lcwriteenable)); +} + +void apple2e_state::machine_reset() +{ + m_page2 = false; + m_video->m_page2 = false; + m_an0 = m_an1 = m_an2 = m_an3 = false; + m_vbl = m_vblmask = false; + m_slotc3rom = false; + m_romswitch = false; + m_irqmask = 0; + m_anykeydown = false; + m_repeatdelay = 10; + m_xy = false; + m_x0edge = false; + m_y0edge = false; + m_xirq = false; + m_yirq = false; + + // IIe prefers INTCXROM default to off, IIc has it always on + if (m_rom_ptr[0x3bc0] == 0x00) + { + m_intcxrom = true; + m_slotc3rom = false; + m_isiic = true; + + if (m_rom_ptr[0x3bbf] == 0x05) + { + m_isiicplus = true; + } + else + { + m_isiicplus = false; + } + } + else + { + m_intcxrom = false; + m_isiic = false; + m_isiicplus = false; + } + + m_80store = false; + m_altzp = false; + m_ramrd = false; + m_ramwrt = false; + m_ioudis = true; + + // LC default state: read ROM, write enabled, Dxxx bank 2 + m_lcram = false; + m_lcram2 = true; + m_lcwriteenable = true; + + m_exp_bankhior = 0xf0; + + // sync up the banking with the variables. + // RESEARCH: how does RESET affect LC state and aux banking states? + auxbank_update(); + update_slotrom_banks(); +} + +void apple2e_state::raise_irq(int irq) +{ + m_irqmask |= (1 << irq); + + if (m_irqmask) + { + m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + } +} + + +void apple2e_state::lower_irq(int irq) +{ + m_irqmask &= ~(1 << irq); + + if (!m_irqmask) + { + m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); + } +} + +/*************************************************************************** + VIDEO +***************************************************************************/ + +TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::apple2_interrupt) +{ + int scanline = param; + + if((scanline % 8) == 0) + { + machine().first_screen()->update_partial(machine().first_screen()->vpos()); + } + + if (m_isiic) + { + update_iic_mouse(); + } + + if (scanline == 192) + { + m_vbl = true; + + // update the video system's shadow copy of the system config + m_video->m_sysconfig = m_sysconfig->read(); + + if (m_vblmask) + { + raise_irq(IRQ_VBL); + } + + // check for ctrl-reset + if ((m_kbspecial->read() & 0x88) == 0x88) + { + m_maincpu->reset(); + } + } +} + +PALETTE_INIT_MEMBER(apple2e_state, apple2) +{ + m_video->palette_init_apple2(palette); +} + +UINT32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bool old_page2 = m_video->m_page2; + + // don't display page2 if 80store is set (we just saved the previous value, don't worry) + if (m_80store) + { + m_video->m_page2 = false; + } + + // always update the flash timer here so it's smooth regardless of mode switches + m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; + + if (m_video->m_graphics) + { + if (m_video->m_hires) + { + if (m_video->m_mix) + { + if ((m_video->m_dhires) && (m_video->m_80col)) + { + m_video->dhgr_update(screen, bitmap, cliprect, 0, 159); + } + else + { + m_video->hgr_update(screen, bitmap, cliprect, 0, 159); + } + m_video->text_update(screen, bitmap, cliprect, 160, 191); + } + else + { + if ((m_video->m_dhires) && (m_video->m_80col)) + { + m_video->dhgr_update(screen, bitmap, cliprect, 0, 191); + } + else + { + m_video->hgr_update(screen, bitmap, cliprect, 0, 191); + } + } + } + else // lo-res + { + if (m_video->m_mix) + { + if ((m_video->m_dhires) && (m_video->m_80col)) + { + m_video->dlores_update(screen, bitmap, cliprect, 0, 159); + } + else + { + m_video->lores_update(screen, bitmap, cliprect, 0, 159); + } + + m_video->text_update(screen, bitmap, cliprect, 160, 191); + } + else + { + if ((m_video->m_dhires) && (m_video->m_80col)) + { + m_video->dlores_update(screen, bitmap, cliprect, 0, 191); + } + else + { + m_video->lores_update(screen, bitmap, cliprect, 0, 191); + } + } + } + } + else + { + m_video->text_update(screen, bitmap, cliprect, 0, 191); + } + + m_video->m_page2 = old_page2; + + return 0; +} + +/*************************************************************************** + I/O +***************************************************************************/ +void apple2e_state::auxbank_update() +{ + int ramwr = (m_ramrd ? 1 : 0) | (m_ramwrt ? 2 : 0); + + m_0000bank->set_bank(m_altzp ? 1 : 0); + m_0200bank->set_bank(ramwr); + + if (m_80store) + { + if (m_page2) + { + m_0400bank->set_bank(3); + } + else + { + m_0400bank->set_bank(0); + } + } + else + { + m_0400bank->set_bank(ramwr); + } + + m_0800bank->set_bank(ramwr); + + if ((m_80store) && (m_video->m_hires)) + { + if (m_page2) + { + m_2000bank->set_bank(3); + } + else + { + m_2000bank->set_bank(0); + } + } + else + { + m_2000bank->set_bank(ramwr); + } + + m_4000bank->set_bank(ramwr); +} + +void apple2e_state::update_slotrom_banks() +{ + int cxswitch = 0; + + // IIc and IIc+ have working (readable) INTCXROM/SLOTC3ROM switches, but + // internal ROM is always present in the slots. + if ((m_intcxrom) || (m_isiic)) + { + if (m_romswitch) + { + cxswitch = 2; + } + else + { + cxswitch = 1; + } + } + + m_c100bank->set_bank(cxswitch); + m_c400bank->set_bank(cxswitch); + +// printf("intcxrom %d cnxx_slot %d isiic %d romswitch %d\n", m_intcxrom, m_cnxx_slot, m_isiic, m_romswitch); + if ((m_intcxrom) || (m_cnxx_slot < 0) || (m_isiic)) + { + if (m_romswitch) + { + m_c800bank->set_bank(2); + } + else + { + m_c800bank->set_bank(1); + } + } + else + { + m_c800bank->set_bank(0); + } + + if ((!m_slotc3rom) || (m_isiic)) + { + if (m_romswitch) + { + m_c300bank->set_bank(2); + } + else + { + m_c300bank->set_bank(1); + } + } + else + { + m_c300bank->set_bank(0); + } +} + +void apple2e_state::lc_update(int offset) +{ + bool m_last_lcram = m_lcram; + + m_lcram = false; + m_lcram2 = false; + m_lcwriteenable = false; + + if (offset & 1) + { + m_lcwriteenable = true; + } + + switch(offset & 0x03) + { + case 0x00: + case 0x03: + m_lcram = true; + break; + } + + if (!(offset & 8)) + { + m_lcram2 = true; + } + + if (m_lcram != m_last_lcram) + { + if (m_lcram) + { + m_lcbank->set_bank(1); + } + else + { + if (m_romswitch) + { + m_lcbank->set_bank(2); + } + else + { + m_lcbank->set_bank(0); + } + } + } + + #if 0 + printf("LC: new state %c%c dxxx=%04x altzp=%d\n", + m_lcram ? 'R' : 'x', + m_lcwriteenable ? 'W' : 'x', + m_lcram2 ? 0x1000 : 0x0000, + m_altzp); + #endif +} + +// most softswitches don't care about read vs write, so handle them here +void apple2e_state::do_io(address_space &space, int offset, bool is_iic) +{ + if(space.debugger_access()) return; + + // Handle C058-C05F according to IOUDIS + if ((offset & 0x58) == 0x58) + { + // IIc-specific switches + if (m_isiic) + { + switch (offset) + { + case 0x58: // DisXY + m_xy = false; break; + + case 0x59: // EnbXY + m_xy = true; break; + + case 0x5a: // DisVBL + m_vblmask = false; break; + + case 0x5b: // EnVBL + m_vblmask = true; break; + + case 0x5c: // RisX0Edge + m_x0edge = false; break; + + case 0x5d: // FalX0Edge + m_x0edge = true; break; + + case 0x5e: // RisY0Edge + if (!m_ioudis) + { + m_y0edge = false; + } + break; + + case 0x5f: // FalY0Edge + if (!m_ioudis) + { + m_y0edge = true; + } + break; + } + } + + if (m_ioudis) + { + switch (offset) + { + case 0x5e: // SETDHIRES + m_video->m_dhires = true; + break; + + case 0x5f: // CLRDHIRES + m_video->m_dhires = false; + break; + } + } + + return; + } + + switch (offset) + { + case 0x20: + if (m_cassette) + { + m_cassette_state ^= 1; + m_cassette->output(m_cassette_state ? 1.0f : -1.0f); + } + break; + + case 0x28: + if (is_iic) + { + m_romswitch = !m_romswitch; + update_slotrom_banks(); + + // if LC is not enabled + if (!m_lcram) + { + if (m_romswitch) + { + m_lcbank->set_bank(2); + } + else + { + m_lcbank->set_bank(0); + } + } + } + break; + + case 0x30: + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + break; + + case 0x48: // (IIc only) clear mouse X/Y interrupt flags + m_xirq = m_yirq = false; + lower_irq(IRQ_MOUSEXY); + break; + + case 0x50: // graphics mode + m_video->m_graphics = true; break; + + case 0x51: // text mode + m_video->m_graphics = false; break; + + case 0x52: // no mix + m_video->m_mix = false; break; + + case 0x53: // mixed mode + m_video->m_mix = true; break; + + case 0x54: // set page 1 + m_page2 = false; + m_video->m_page2 = false; + auxbank_update(); + break; + + case 0x55: // set page 2 + m_page2 = true; + m_video->m_page2 = true; + auxbank_update(); + break; + + case 0x56: // select lo-res + m_video->m_hires = false; + auxbank_update(); + break; + + case 0x57: // select hi-res + m_video->m_hires = true; + auxbank_update(); + break; + + case 0x58: // AN0 off + m_an0 = false; break; + + case 0x59: // AN0 on + m_an0 = true; break; + + case 0x5a: // AN1 off + m_an1 = false; break; + + case 0x5b: // AN1 on + m_an1 = true; break; + + case 0x5c: // AN2 off + m_an2 = false; break; + + case 0x5d: // AN2 on + m_an2 = true; break; + + case 0x5e: // AN3 off + m_an3 = false; break; + + case 0x5f: // AN3 on + m_an3 = true; break; + + case 0x68: // IIgs STATE register, which ProDOS touches + break; + + // trigger joypad read + case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: + if (is_iic) + { + m_vbl = false; + lower_irq(IRQ_VBL); + } + + m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_joy1x->read(); + m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_joy1y->read(); + m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_joy2x->read(); + m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read(); + break; + + default: + logerror("do_io: unknown switch $C0%02X\n", offset); + break; + } +} + +READ8_MEMBER(apple2e_state::c000_r) +{ + if(space.debugger_access()) return read_floatingbus(); + + switch (offset) + { + case 0x00: // keyboard latch + return m_transchar | m_strobe; + + case 0x02: // RAMRDOFF + m_ramrd = false; + auxbank_update(); + break; + + case 0x03: // RAMRDON + m_ramrd = true; + auxbank_update(); + break; + + case 0x04: // RAMWRTOFF + m_ramwrt = false; + auxbank_update(); + break; + + case 0x05: // RAMWRTON + m_ramwrt = true; + auxbank_update(); + break; + + case 0x10: // read any key down, reset keyboard strobe + { + UINT8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); + m_strobe = 0; + return rv; + } + + case 0x11: // read LCRAM2 (LC Dxxx bank) + return m_lcram2 ? 0x80 : 0x00; + + case 0x12: // read LCRAM (is LC readable?) + return m_lcram ? 0x80 : 0x00; + + case 0x13: // read RAMRD + return m_ramrd ? 0x80 : 0x00; + + case 0x14: // read RAMWRT + return m_ramwrt ? 0x80 : 0x00; + + case 0x15: // read INTCXROM + return m_intcxrom ? 0x80 : 0x00; + + case 0x16: // read ALTZP + return m_altzp ? 0x80 : 0x00; + + case 0x17: // read SLOTC3ROM + return m_slotc3rom ? 0x80 : 0x00; + + case 0x18: // read 80STORE + return m_80store ? 0x80 : 0x00; + + case 0x19: // read VBLBAR + return space.machine().first_screen()->vblank() ? 0x00 : 0x80; + + case 0x1a: // read TEXT + return m_video->m_graphics ? 0x00 : 0x80; + + case 0x1b: // read MIXED + return m_video->m_mix ? 0x80 : 0x00; + + case 0x1c: // read PAGE2 + return m_page2 ? 0x80 : 0x00; + + case 0x1d: // read HIRES + return m_video->m_hires ? 0x80 : 0x00; + + case 0x1e: // read ALTCHARSET + return m_video->m_altcharset ? 0x80 : 0x00; + + case 0x1f: // read 80COL + return m_video->m_80col ? 0x80 : 0x00; + + case 0x60: // cassette in + case 0x68: + if (m_cassette) + { + return m_cassette->input() > 0.0 ? 0x80 : 0; + } + return 0; + + case 0x61: // button 0 or Open Apple + case 0x69: + return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0; + + case 0x62: // button 1 or Solid Apple + case 0x6a: + return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0; + + case 0x63: // button 2 or SHIFT key + case 0x6b: + return ((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0; + + case 0x64: // joy 1 X axis + case 0x6c: + return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; + + case 0x65: // joy 1 Y axis + case 0x6d: + return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; + + case 0x66: // joy 2 X axis + case 0x6e: + return (space.machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0; + + case 0x67: // joy 2 Y axis + case 0x6f: + return (space.machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0; + + case 0x7e: // read IOUDIS + return m_ioudis ? 0x80 : 0x00; + + case 0x7f: // read DHIRES + return m_video->m_dhires ? 0x00 : 0x80; + + default: + do_io(space, offset, false); + break; + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(apple2e_state::c000_w) +{ + if(space.debugger_access()) return; + + switch (offset) + { + case 0x00: // 80STOREOFF + m_80store = false; + auxbank_update(); + break; + + case 0x01: // 80STOREON + m_80store = true; + auxbank_update(); + break; + + case 0x02: // RAMRDOFF + m_ramrd = false; + auxbank_update(); + break; + + case 0x03: // RAMRDON + m_ramrd = true; + auxbank_update(); + break; + + case 0x04: // RAMWRTOFF + m_ramwrt = false; + auxbank_update(); + break; + + case 0x05: // RAMWRTON + m_ramwrt = true; + auxbank_update(); + break; + + case 0x06: // INTCXROMOFF + m_intcxrom = false; + update_slotrom_banks(); + break; + + case 0x07: // INTCXROMON + m_intcxrom = true; + update_slotrom_banks(); + break; + + case 0x08: // ALTZPOFF + m_altzp = false; + auxbank_update(); + break; + + case 0x09: // ALTZPON + m_altzp = true; + auxbank_update(); + break; + + case 0x0a: // SETINTC3ROM + m_slotc3rom = false; + update_slotrom_banks(); + break; + + case 0x0b: // SETSLOTC3ROM + m_slotc3rom = true; + update_slotrom_banks(); + break; + + case 0x0c: // 80COLOFF + m_video->m_80col = false; + break; + + case 0x0d: // 80COLON + m_video->m_80col = true; + break; + + case 0x0e: // ALTCHARSETOFF + m_video->m_altcharset = false; + break; + + case 0x0f: // ALTCHARSETON + m_video->m_altcharset = true; + break; + + case 0x10: // clear keyboard latch + m_strobe = 0; + break; + + case 0x20: // cassette output + if (m_cassette) + { + m_cassette_out ^= 1; + m_cassette->output(m_cassette_out ? 1.0f : -1.0f); + } + break; + + case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: + if (m_auxslotdevice) + { + m_auxslotdevice->write_c07x(space, offset & 0xf, data); + + // card may have banked auxram; get a new bank pointer + m_aux_bank_ptr = m_auxslotdevice->get_auxbank_ptr(); + } + do_io(space, offset, false); // make sure it also side-effect resets the paddles as documented + break; + + case 0x7e: // SETIOUDIS + m_ioudis = true; break; + + case 0x7f: // CLRIOUDIS + m_ioudis = false; break; + + default: + do_io(space, offset, false); + break; + } +} + +READ8_MEMBER(apple2e_state::c000_iic_r) +{ + if(space.debugger_access()) return read_floatingbus(); + + switch (offset) + { + case 0x00: // keyboard latch + return m_transchar | m_strobe; + + case 0x02: // RAMRDOFF + m_ramrd = false; + auxbank_update(); + break; + + case 0x03: // RAMRDON + m_ramrd = true; + auxbank_update(); + break; + + case 0x04: // RAMWRTOFF + m_ramwrt = false; + auxbank_update(); + break; + + case 0x05: // RAMWRTON + m_ramwrt = true; + auxbank_update(); + break; + + case 0x10: // read any key down, reset keyboard strobe + { + UINT8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); + m_strobe = 0; + return rv; + } + + case 0x11: // read LCRAM2 (LC Dxxx bank) + return m_lcram2 ? 0x80 : 0x00; + break; + + case 0x12: // read LCRAM (is LC readable?) + return m_lcram ? 0x80 : 0x00; + break; + + case 0x13: // read RAMRD + return m_ramrd ? 0x80 : 0x00; + + case 0x14: // read RAMWRT + return m_ramwrt ? 0x80 : 0x00; + + case 0x15: // read & reset mouse X0 interrupt flag + lower_irq(IRQ_MOUSEXY); + return m_xirq ? 0x80 : 0x00; + + case 0x16: // read ALTZP + return m_altzp ? 0x80 : 0x00; + + case 0x17: // read & reset mouse Y0 interrupt flag + lower_irq(IRQ_MOUSEXY); + return m_yirq ? 0x80 : 0x00; + + case 0x18: // read 80STORE + return m_80store ? 0x80 : 0x00; + + case 0x19: // read VBL + return m_vbl ? 0x80 : 0x00; + + case 0x1a: // read TEXT + return m_video->m_graphics ? 0x00 : 0x80; + + case 0x1b: // read MIXED + return m_video->m_mix ? 0x80 : 0x00; + + case 0x1c: // read PAGE2 + return m_page2 ? 0x80 : 0x00; + + case 0x1d: // read HIRES + return m_video->m_hires ? 0x80 : 0x00; + + case 0x1e: // read ALTCHARSET + return m_video->m_altcharset ? 0x80 : 0x00; + + case 0x1f: // read 80COL + return m_video->m_80col ? 0x80 : 0x00; + + case 0x40: // read XYMask (IIc only) + return m_xy ? 0x80 : 0x00; + + case 0x41: // read VBL mask (IIc only) + return m_vblmask ? 0x80 : 0x00; + + case 0x42: // read X0Edge (IIc only) + return m_x0edge ? 0x80 : 0x00; + + case 0x43: // read Y0Edge (IIc only) + return m_y0edge ? 0x80 : 0x00; + + case 0x60: // 40/80 column switch (IIc only) + return (m_sysconfig->read() & 0x04) ? 0x80 : 0; + + case 0x61: // button 0 or Open Apple or mouse button 1 + case 0x69: + return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0; + + case 0x62: // button 1 or Solid Apple + case 0x6a: + return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0; + + case 0x63: // mouse button 2 (no other function on IIc) + case 0x6b: + return m_mouseb->read() ? 0 : 0x80; + + case 0x64: // joy 1 X axis + case 0x6c: + return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; + + case 0x65: // joy 1 Y axis + case 0x6d: + return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; + + case 0x66: // mouse X1 (IIc only) + case 0x6e: + return m_x1 ? 0x80 : 0; + + case 0x67: // mouse Y1 (IIc only) + case 0x6f: + return m_y1 ? 0x80 : 0; + + case 0x7e: // read IOUDIS + m_vbl = false; + lower_irq(IRQ_VBL); + return m_ioudis ? 0x80 : 0x00; + + case 0x7f: // read DHIRES + return m_video->m_dhires ? 0x00 : 0x80; + + default: + do_io(space, offset, true); + break; + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(apple2e_state::c000_iic_w) +{ + if(space.debugger_access()) return; + + switch (offset) + { + case 0x00: // 80STOREOFF + m_80store = false; + auxbank_update(); + break; + + case 0x01: // 80STOREON + m_80store = true; + auxbank_update(); + break; + + case 0x02: // RAMRDOFF + m_ramrd = false; + auxbank_update(); + break; + + case 0x03: // RAMRDON + m_ramrd = true; + auxbank_update(); + break; + + case 0x04: // RAMWRTOFF + m_ramwrt = false; + auxbank_update(); + break; + + case 0x05: // RAMWRTON + m_ramwrt = true; + auxbank_update(); + break; + + case 0x06: // INTCXROMOFF + m_intcxrom = false; + update_slotrom_banks(); + break; + + case 0x07: // INTCXROMON + m_intcxrom = true; + update_slotrom_banks(); + break; + + case 0x08: // ALTZPOFF + m_altzp = false; + auxbank_update(); + break; + + case 0x09: // ALTZPON + m_altzp = true; + auxbank_update(); + break; + + case 0x0a: // SETINTC3ROM + m_slotc3rom = false; + update_slotrom_banks(); + break; + + case 0x0b: // SETSLOTC3ROM + m_slotc3rom = true; + update_slotrom_banks(); + break; + + case 0x0c: // 80COLOFF + m_video->m_80col = false; + break; + + case 0x0d: // 80COLON + m_video->m_80col = true; + break; + + case 0x0e: // ALTCHARSETOFF + m_video->m_altcharset = false; + break; + + case 0x0f: // ALTCHARSETON + m_video->m_altcharset = true; + break; + + case 0x10: // clear keyboard latch + m_strobe = 0; + break; + + case 0x78: + case 0x79: + m_vbl = false; + lower_irq(IRQ_VBL); + break; + + case 0x7e: // SETIOUDIS + m_ioudis = true; + break; + + case 0x7f: // CLRIOUDIS + m_ioudis = false; + break; + + default: + do_io(space, offset, true); + break; + } +} + +void apple2e_state::update_iic_mouse() +{ + int new_mx, new_my; + + // read the axes + new_mx = m_mousex->read(); + new_my = m_mousey->read(); + + // did X change? + if (new_mx != last_mx) + { + int diff = new_mx - last_mx; + + /* check for wrap */ + if (diff > 0x80) + diff = 0x100-diff; + if (diff < -0x80) + diff = -0x100-diff; + + count_x += diff; + last_mx = new_mx; + } + + // did Y change? + if (new_my != last_my) + { + int diff = new_my - last_my; + + /* check for wrap */ + if (diff > 0x80) + diff = 0x100-diff; + if (diff < -0x80) + diff = -0x100-diff; + + count_y += diff; + last_my = new_my; + } + + if (count_x) + { + if (count_x < 0) + { + count_x++; + m_x1 = false; + } + else + { + count_x--; + m_x1 = true; + } + + // x0 is going to state-flip, generate an IRQ + if (((m_x0) && (m_x0edge)) || // falling? + (!(m_x0) && !(m_x0edge))) // rising? + { + if (m_xy) + { + m_xirq = true; + raise_irq(IRQ_MOUSEXY); + } + } + + m_x0 = !m_x0; + } + else if (count_y) + { + if (count_y < 0) + { + count_y++; + m_y1 = true; + } + else + { + count_y--; + m_y1 = false; + } + + // y0 is going to state-flip, generate an IRQ + if (((m_y0) && (m_y0edge)) || // falling? + (!(m_y0) && !(m_y0edge))) // rising? + { + if (m_xy) + { + m_yirq = true; + raise_irq(IRQ_MOUSEXY); + } + } + + m_y0 = !m_y0; + } +} + +READ8_MEMBER(apple2e_state::c080_r) +{ + if(!space.debugger_access()) + { + int slot; + + offset &= 0x7F; + slot = offset / 0x10; + + if (slot == 0) + { + lc_update(offset & 0xf); + } + else + { + if (m_slotdevice[slot] != NULL) + { + return m_slotdevice[slot]->read_c0nx(space, offset % 0x10); + } + } + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(apple2e_state::c080_w) +{ + int slot; + + offset &= 0x7F; + slot = offset / 0x10; + + if (slot == 0) + { + lc_update(offset & 0xf); + } + else + { + if (m_slotdevice[slot] != NULL) + { + m_slotdevice[slot]->write_c0nx(space, offset % 0x10, data); + } + } +} + +UINT8 apple2e_state::read_slot_rom(address_space &space, int slotbias, int offset) +{ + int slotnum = ((offset>>8) & 0xf) + slotbias; + + if (m_slotdevice[slotnum] != NULL) + { + if ((m_cnxx_slot == CNXX_UNCLAIMED) && (m_slotdevice[slotnum]->take_c800()) && (!space.debugger_access())) + { + m_cnxx_slot = slotnum; + update_slotrom_banks(); + } + + return m_slotdevice[slotnum]->read_cnxx(space, offset&0xff); + } + + return read_floatingbus(); +} + +void apple2e_state::write_slot_rom(address_space &space, int slotbias, int offset, UINT8 data) +{ + int slotnum = ((offset>>8) & 0xf) + slotbias; + + if (m_slotdevice[slotnum] != NULL) + { + if ((m_cnxx_slot == CNXX_UNCLAIMED) && (m_slotdevice[slotnum]->take_c800()) && (!space.debugger_access())) + { + m_cnxx_slot = slotnum; + update_slotrom_banks(); + } + + m_slotdevice[slotnum]->write_cnxx(space, offset&0xff, data); + } +} + +UINT8 apple2e_state::read_int_rom(address_space &space, int slotbias, int offset) +{ + if ((m_cnxx_slot == CNXX_UNCLAIMED) && (!space.debugger_access())) + { + m_cnxx_slot = CNXX_INTROM; + update_slotrom_banks(); + } + + return m_rom_ptr[slotbias + offset]; +} + +READ8_MEMBER(apple2e_state::c100_r) { return read_slot_rom(space, 1, offset); } +READ8_MEMBER(apple2e_state::c100_int_r) { return read_int_rom(space, 0x100, offset); } +READ8_MEMBER(apple2e_state::c100_int_bank_r) { return read_int_rom(space, 0x4100, offset); } +WRITE8_MEMBER(apple2e_state::c100_w) { write_slot_rom(space, 1, offset, data); } +READ8_MEMBER(apple2e_state::c300_r) { return read_slot_rom(space, 3, offset); } +READ8_MEMBER(apple2e_state::c300_int_r) { return read_int_rom(space, 0x300, offset); } +READ8_MEMBER(apple2e_state::c300_int_bank_r) { return read_int_rom(space, 0x4300, offset); } +WRITE8_MEMBER(apple2e_state::c300_w) { write_slot_rom(space, 3, offset, data); } +READ8_MEMBER(apple2e_state::c400_r) { return read_slot_rom(space, 4, offset); } +READ8_MEMBER(apple2e_state::c400_int_r) { return read_int_rom(space, 0x400, offset); } +READ8_MEMBER(apple2e_state::c400_int_bank_r) { return read_int_rom(space, 0x4400, offset); } +WRITE8_MEMBER(apple2e_state::c400_w) { write_slot_rom(space, 4, offset, data); } + +READ8_MEMBER(apple2e_state::c800_r) +{ + if ((m_isiicplus) && (offset >= 0x600)) + { + return m_iicplus_ce00[offset-0x600]; + } + + if (offset == 0x7ff) + { + m_cnxx_slot = CNXX_UNCLAIMED; + update_slotrom_banks(); + return 0xff; + } + + if ((m_cnxx_slot > 0) && (m_slotdevice[m_cnxx_slot] != NULL)) + { + return m_slotdevice[m_cnxx_slot]->read_c800(space, offset&0xfff); + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(apple2e_state::c800_w) +{ + if ((m_isiicplus) && (offset >= 0x600)) + { + m_iicplus_ce00[offset-0x600] = data; + return; + } + + if (offset == 0x7ff) + { + m_cnxx_slot = CNXX_UNCLAIMED; + update_slotrom_banks(); + return; + } + + if ((m_cnxx_slot > 0) && (m_slotdevice[m_cnxx_slot] != NULL)) + { + m_slotdevice[m_cnxx_slot]->write_c800(space, offset&0xfff, data); + } +} + +READ8_MEMBER(apple2e_state::inh_r) +{ + if (m_inh_slot != -1) + { + return m_slotdevice[m_inh_slot]->read_inh_rom(space, offset + 0xd000); + } + + assert(0); // hitting inh_r with invalid m_inh_slot should not be possible + return read_floatingbus(); +} + +WRITE8_MEMBER(apple2e_state::inh_w) +{ + if (m_inh_slot != -1) + { + m_slotdevice[m_inh_slot]->write_inh_rom(space, offset + 0xd000, data); + } +} + +READ8_MEMBER(apple2e_state::lc_r) +{ + if (m_altzp) + { + if (m_aux_bank_ptr) + { + if (offset < 0x1000) + { + if (m_lcram2) + { + return m_aux_bank_ptr[(offset & 0xfff) + 0xd000]; + } + else + { + return m_aux_bank_ptr[(offset & 0xfff) + 0xc000]; + } + } + + return m_aux_bank_ptr[(offset & 0x1fff) + 0xe000]; + } + else + { + return read_floatingbus(); + } + } + else + { + if (offset < 0x1000) + { + if (m_lcram2) + { + return m_ram_ptr[(offset & 0xfff) + 0xd000]; + } + else + { + return m_ram_ptr[(offset & 0xfff) + 0xc000]; + } + } + + return m_ram_ptr[(offset & 0x1fff) + 0xe000]; + } +} + +WRITE8_MEMBER(apple2e_state::lc_w) +{ + if (!m_lcwriteenable) + { + return; + } + + if (m_altzp) + { + if (m_aux_bank_ptr) + { + if (offset < 0x1000) + { + if (m_lcram2) + { + m_aux_bank_ptr[(offset & 0xfff) + 0xd000] = data; + } + else + { + m_aux_bank_ptr[(offset & 0xfff) + 0xc000] = data; + } + return; + } + + m_aux_bank_ptr[(offset & 0x1fff) + 0xe000] = data; + } + } + else + { + if (offset < 0x1000) + { + if (m_lcram2) + { + m_ram_ptr[(offset & 0xfff) + 0xd000] = data; + } + else + { + m_ram_ptr[(offset & 0xfff) + 0xc000] = data; + } + return; + } + + m_ram_ptr[(offset & 0x1fff) + 0xe000] = data; + } +} + +// floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter +UINT8 apple2e_state::read_floatingbus() +{ + enum + { + // scanner types + kScannerNone = 0, kScannerApple2, kScannerApple2e, + + // scanner constants + kHBurstClock = 53, // clock when Color Burst starts + kHBurstClocks = 4, // clocks per Color Burst duration + kHClock0State = 0x18, // H[543210] = 011000 + kHClocks = 65, // clocks per horizontal scan (including HBL) + kHPEClock = 40, // clock when HPE (horizontal preset enable) goes low + kHPresetClock = 41, // clock when H state presets + kHSyncClock = 49, // clock when HSync starts + kHSyncClocks = 4, // clocks per HSync duration + kNTSCScanLines = 262, // total scan lines including VBL (NTSC) + kNTSCVSyncLine = 224, // line when VSync starts (NTSC) + kPALScanLines = 312, // total scan lines including VBL (PAL) + kPALVSyncLine = 264, // line when VSync starts (PAL) + kVLine0State = 0x100, // V[543210CBA] = 100000000 + kVPresetLine = 256, // line when V state presets + kVSyncLines = 4, // lines per VSync duration + kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? + }; + + // vars + // + int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ + h_clock, h_state, h_0, h_1, h_2, h_3, h_4, h_5, + v_line, v_state, v_A, v_B, v_C, v_0, v_1, v_2, v_3, v_4, /* v_5, */ + _hires, addend0, addend1, addend2, sum, address; + + // video scanner data + // + i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync + + // machine state switches + // + Hires = (m_video->m_hires && m_video->m_graphics) ? 1 : 0; + Mixed = m_video->m_mix ? 1 : 0; + Page2 = m_page2 ? 1 : 0; + _80Store = m_80store ? 1 : 0; + + // calculate video parameters according to display standard + // + ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? + // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? + // ScanCycles = ScanLines * kHClocks; + + // calculate horizontal scanning state + // + h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock + h_state = kHClock0State + h_clock; // H state bits + if (h_clock >= kHPresetClock) // check for horizontal preset + { + h_state -= 1; // correct for state preset (two 0 states) + } + h_0 = (h_state >> 0) & 1; // get horizontal state bits + h_1 = (h_state >> 1) & 1; + h_2 = (h_state >> 2) & 1; + h_3 = (h_state >> 3) & 1; + h_4 = (h_state >> 4) & 1; + h_5 = (h_state >> 5) & 1; + + // calculate vertical scanning state + // + v_line = i / kHClocks; // which vertical scanning line + v_state = kVLine0State + v_line; // V state bits + if ((v_line >= kVPresetLine)) // check for previous vertical state preset + { + v_state -= ScanLines; // compensate for preset + } + v_A = (v_state >> 0) & 1; // get vertical state bits + v_B = (v_state >> 1) & 1; + v_C = (v_state >> 2) & 1; + v_0 = (v_state >> 3) & 1; + v_1 = (v_state >> 4) & 1; + v_2 = (v_state >> 5) & 1; + v_3 = (v_state >> 6) & 1; + v_4 = (v_state >> 7) & 1; + //v_5 = (v_state >> 8) & 1; + + // calculate scanning memory address + // + _hires = Hires; + if (Hires && Mixed && (v_4 & v_2)) + { + _hires = 0; // (address is in text memory) + } + + addend0 = 0x68; // 1 1 0 1 + addend1 = (h_5 << 5) | (h_4 << 4) | (h_3 << 3); + addend2 = (v_4 << 6) | (v_3 << 5) | (v_4 << 4) | (v_3 << 3); + sum = (addend0 + addend1 + addend2) & (0x0F << 3); + + address = 0; + address |= h_0 << 0; // a0 + address |= h_1 << 1; // a1 + address |= h_2 << 2; // a2 + address |= sum; // a3 - aa6 + address |= v_0 << 7; // a7 + address |= v_1 << 8; // a8 + address |= v_2 << 9; // a9 + address |= ((_hires) ? v_A : (1 ^ (Page2 & (1 ^ _80Store)))) << 10; // a10 + address |= ((_hires) ? v_B : (Page2 & (1 ^ _80Store))) << 11; // a11 + if (_hires) // hires? + { + // Y: insert hires only address bits + // + address |= v_C << 12; // a12 + address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 + address |= (Page2 & (1 ^ _80Store)) << 14; // a14 + } + else + { + // N: text, so no higher address bits unless Apple ][, not Apple //e + // + if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) + (kHPEClock <= h_clock) && // Y: HBL? + (h_clock <= (kHClocks - 1))) + { + address |= 1 << 12; // Y: a12 (add $1000 to address!) + } + } + + return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? +} + +/*************************************************************************** + ADDRESS MAP +***************************************************************************/ + +READ8_MEMBER(apple2e_state::ram0000_r) { return m_ram_ptr[offset]; } +WRITE8_MEMBER(apple2e_state::ram0000_w) { m_ram_ptr[offset] = data; } +READ8_MEMBER(apple2e_state::ram0200_r) { return m_ram_ptr[offset+0x200]; } +WRITE8_MEMBER(apple2e_state::ram0200_w) { m_ram_ptr[offset+0x200] = data; } +READ8_MEMBER(apple2e_state::ram0400_r) { return m_ram_ptr[offset+0x400]; } +WRITE8_MEMBER(apple2e_state::ram0400_w) { m_ram_ptr[offset+0x400] = data; } +READ8_MEMBER(apple2e_state::ram0800_r) { return m_ram_ptr[offset+0x800]; } +WRITE8_MEMBER(apple2e_state::ram0800_w) { m_ram_ptr[offset+0x800] = data; } +READ8_MEMBER(apple2e_state::ram2000_r) { return m_ram_ptr[offset+0x2000]; } +WRITE8_MEMBER(apple2e_state::ram2000_w) { m_ram_ptr[offset+0x2000] = data; } +READ8_MEMBER(apple2e_state::ram4000_r) { return m_ram_ptr[offset+0x4000]; } +WRITE8_MEMBER(apple2e_state::ram4000_w) { m_ram_ptr[offset+0x4000] = data; } + +READ8_MEMBER(apple2e_state::auxram0000_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset]; } else { return read_floatingbus(); } } +WRITE8_MEMBER(apple2e_state::auxram0000_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset] = data; } } +READ8_MEMBER(apple2e_state::auxram0200_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x200]; } else { return read_floatingbus(); } } +WRITE8_MEMBER(apple2e_state::auxram0200_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x200] = data; } } +READ8_MEMBER(apple2e_state::auxram0400_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x400]; } else { return read_floatingbus(); } } +WRITE8_MEMBER(apple2e_state::auxram0400_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x400] = data; } } +READ8_MEMBER(apple2e_state::auxram0800_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x800]; } else { return read_floatingbus(); } } +WRITE8_MEMBER(apple2e_state::auxram0800_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x800] = data; } } +READ8_MEMBER(apple2e_state::auxram2000_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x2000]; } else { return read_floatingbus(); } } +WRITE8_MEMBER(apple2e_state::auxram2000_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x2000] = data; } } +READ8_MEMBER(apple2e_state::auxram4000_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x4000]; } else { return read_floatingbus(); } } +WRITE8_MEMBER(apple2e_state::auxram4000_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x4000] = data; } } + +static ADDRESS_MAP_START( apple2e_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x01ff) AM_DEVICE(A2_0000_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0200, 0x03ff) AM_DEVICE(A2_0200_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0400, 0x07ff) AM_DEVICE(A2_0400_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0800, 0x1fff) AM_DEVICE(A2_0800_TAG, address_map_bank_device, amap8) + AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) + AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) + AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) + AM_RANGE(0xc100, 0xc2ff) AM_DEVICE(A2_C100_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc300, 0xc3ff) AM_DEVICE(A2_C300_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc400, 0xc7ff) AM_DEVICE(A2_C400_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc800, 0xcfff) AM_DEVICE(A2_C800_TAG, address_map_bank_device, amap8) + AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( apple2c_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x01ff) AM_DEVICE(A2_0000_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0200, 0x03ff) AM_DEVICE(A2_0200_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0400, 0x07ff) AM_DEVICE(A2_0400_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0800, 0x1fff) AM_DEVICE(A2_0800_TAG, address_map_bank_device, amap8) + AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) + AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_iic_r, c000_iic_w) + AM_RANGE(0xc098, 0xc09b) AM_DEVREADWRITE(IIC_ACIA1_TAG, mos6551_device, read, write) + AM_RANGE(0xc0a8, 0xc0ab) AM_DEVREADWRITE(IIC_ACIA2_TAG, mos6551_device, read, write) + AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) + AM_RANGE(0xc100, 0xc2ff) AM_DEVICE(A2_C100_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc300, 0xc3ff) AM_DEVICE(A2_C300_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc400, 0xc7ff) AM_DEVICE(A2_C400_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc800, 0xcfff) AM_DEVICE(A2_C800_TAG, address_map_bank_device, amap8) + AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( apple2c_memexp_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x01ff) AM_DEVICE(A2_0000_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0200, 0x03ff) AM_DEVICE(A2_0200_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0400, 0x07ff) AM_DEVICE(A2_0400_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0800, 0x1fff) AM_DEVICE(A2_0800_TAG, address_map_bank_device, amap8) + AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) + AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_iic_r, c000_iic_w) + AM_RANGE(0xc098, 0xc09b) AM_DEVREADWRITE(IIC_ACIA1_TAG, mos6551_device, read, write) + AM_RANGE(0xc0a8, 0xc0ab) AM_DEVREADWRITE(IIC_ACIA2_TAG, mos6551_device, read, write) + AM_RANGE(0xc0c0, 0xc0c3) AM_READWRITE(memexp_r, memexp_w) + AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) + AM_RANGE(0xc100, 0xc2ff) AM_DEVICE(A2_C100_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc300, 0xc3ff) AM_DEVICE(A2_C300_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc400, 0xc7ff) AM_DEVICE(A2_C400_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc800, 0xcfff) AM_DEVICE(A2_C800_TAG, address_map_bank_device, amap8) + AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( laser128_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x01ff) AM_DEVICE(A2_0000_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0200, 0x03ff) AM_DEVICE(A2_0200_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0400, 0x07ff) AM_DEVICE(A2_0400_TAG, address_map_bank_device, amap8) + AM_RANGE(0x0800, 0x1fff) AM_DEVICE(A2_0800_TAG, address_map_bank_device, amap8) + AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) + AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) +// AM_RANGE(0xc098, 0xc09b) AM_DEVREADWRITE(IIC_ACIA1_TAG, mos6551_device, read, write) +// AM_RANGE(0xc0a8, 0xc0ab) AM_DEVREADWRITE(IIC_ACIA2_TAG, mos6551_device, read, write) + AM_RANGE(0xc0d0, 0xc0d3) AM_READWRITE(memexp_r, memexp_w) + AM_RANGE(0xc0e0, 0xc0ef) AM_DEVREADWRITE(LASER128_UDC_TAG, applefdc_base_device, read, write) + AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) + AM_RANGE(0xc100, 0xc2ff) AM_DEVICE(A2_C100_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc300, 0xc3ff) AM_DEVICE(A2_C300_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc400, 0xc7ff) AM_DEVICE(A2_C400_TAG, address_map_bank_device, amap8) + AM_RANGE(0xc800, 0xcfff) AM_DEVICE(A2_C800_TAG, address_map_bank_device, amap8) + AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( r0000bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x01ff) AM_READWRITE(ram0000_r, ram0000_w) + AM_RANGE(0x0200, 0x03ff) AM_READWRITE(auxram0000_r, auxram0000_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( r0200bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x01ff) AM_READWRITE(ram0200_r, ram0200_w) // wr 0 rd 0 + AM_RANGE(0x0200, 0x03ff) AM_READWRITE(auxram0200_r, ram0200_w) // wr 0 rd 1 + AM_RANGE(0x0400, 0x05ff) AM_READWRITE(ram0200_r, auxram0200_w) // wr 1 rd 0 + AM_RANGE(0x0600, 0x07ff) AM_READWRITE(auxram0200_r, auxram0200_w) // wr 1 rd 1 +ADDRESS_MAP_END + +static ADDRESS_MAP_START( r0400bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x03ff) AM_READWRITE(ram0400_r, ram0400_w) // wr 0 rd 0 + AM_RANGE(0x0400, 0x07ff) AM_READWRITE(auxram0400_r, ram0400_w) // wr 0 rd 1 + AM_RANGE(0x0800, 0x0bff) AM_READWRITE(ram0400_r, auxram0400_w) // wr 1 rd 0 + AM_RANGE(0x0c00, 0x0fff) AM_READWRITE(auxram0400_r, auxram0400_w) // wr 1 rd 1 +ADDRESS_MAP_END + +static ADDRESS_MAP_START( r0800bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x17ff) AM_READWRITE(ram0800_r, ram0800_w) + AM_RANGE(0x2000, 0x37ff) AM_READWRITE(auxram0800_r, ram0800_w) + AM_RANGE(0x4000, 0x57ff) AM_READWRITE(ram0800_r, auxram0800_w) + AM_RANGE(0x6000, 0x77ff) AM_READWRITE(auxram0800_r, auxram0800_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( r2000bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x1fff) AM_READWRITE(ram2000_r, ram2000_w) + AM_RANGE(0x2000, 0x3fff) AM_READWRITE(auxram2000_r, ram2000_w) + AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ram2000_r, auxram2000_w) + AM_RANGE(0x6000, 0x7fff) AM_READWRITE(auxram2000_r, auxram2000_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( r4000bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x00000, 0x07fff) AM_READWRITE(ram4000_r, ram4000_w) + AM_RANGE(0x08000, 0x0ffff) AM_READWRITE(auxram4000_r, ram4000_w) + AM_RANGE(0x10000, 0x17fff) AM_READWRITE(ram4000_r, auxram4000_w) + AM_RANGE(0x18000, 0x1ffff) AM_READWRITE(auxram4000_r, auxram4000_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c100bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x01ff) AM_READWRITE(c100_r, c100_w) + AM_RANGE(0x0200, 0x03ff) AM_READ(c100_int_r) AM_WRITENOP + AM_RANGE(0x0400, 0x05ff) AM_READ(c100_int_bank_r) AM_WRITENOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c300bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x00ff) AM_READWRITE(c300_r, c300_w) + AM_RANGE(0x0100, 0x01ff) AM_READ(c300_int_r) AM_WRITENOP + AM_RANGE(0x0200, 0x02ff) AM_READ(c300_int_bank_r) AM_WRITENOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c400bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x03ff) AM_READWRITE(c400_r, c400_w) + AM_RANGE(0x0400, 0x07ff) AM_READ(c400_int_r) AM_WRITENOP + AM_RANGE(0x0800, 0x0bff) AM_READ(c400_int_bank_r) AM_WRITENOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c800bank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x07ff) AM_READWRITE(c800_r, c800_w) + AM_RANGE(0x0800, 0x0fff) AM_ROM AM_REGION("maincpu", 0x800) + AM_RANGE(0x1000, 0x17ff) AM_ROM AM_REGION("maincpu", 0x4800) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( inhbank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x2fff) AM_DEVICE(A2_LCBANK_TAG, address_map_bank_device, amap8) + AM_RANGE(0x3000, 0x5fff) AM_READWRITE(inh_r, inh_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( lcbank_map, AS_PROGRAM, 8, apple2e_state ) + AM_RANGE(0x0000, 0x2fff) AM_ROM AM_REGION("maincpu", 0x1000) AM_WRITE(lc_w) + AM_RANGE(0x3000, 0x5fff) AM_READWRITE(lc_r, lc_w) + AM_RANGE(0x6000, 0x8fff) AM_ROM AM_REGION("maincpu", 0x5000) AM_WRITE(lc_w) +ADDRESS_MAP_END + +/*************************************************************************** + KEYBOARD +***************************************************************************/ + +READ_LINE_MEMBER(apple2e_state::ay3600_shift_r) +{ + // either shift key + if (m_kbspecial->read() & 0x06) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +READ_LINE_MEMBER(apple2e_state::ay3600_control_r) +{ + if (m_kbspecial->read() & 0x08) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +WRITE_LINE_MEMBER(apple2e_state::ay3600_data_ready_w) +{ + if (state == ASSERT_LINE) + { + UINT8 *decode = m_kbdrom->base(); + UINT16 trans; + + m_lastchar = m_ay3600->b_r(); + + trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff + trans |= (m_lastchar & 0x100)>>2; // bring the 0x100 bit down to the 0x40 place + trans <<= 2; // 4 entries per key + trans |= (m_kbspecial->read() & 0x06) ? 0x00 : 0x01; // shift is bit 1 (active low) + trans |= (m_kbspecial->read() & 0x08) ? 0x00 : 0x02; // control is bit 2 (active low) + trans |= (m_kbspecial->read() & 0x01) ? 0x0000 : 0x0200; // caps lock is bit 9 (active low) + + if (m_isiic) + { + if (m_sysconfig->read() & 0x08) + { + trans += 0x400; // go to DVORAK half of the ROM + } + } + + m_transchar = decode[trans]; + m_strobe = 0x80; + +// printf("new char = %04x (%02x)\n", m_lastchar, m_transchar); + } +} + +WRITE_LINE_MEMBER(apple2e_state::ay3600_ako_w) +{ + m_anykeydown = (state == ASSERT_LINE) ? true : false; + + if (m_anykeydown) + { + m_repeatdelay = 10; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::ay3600_repeat) +{ + // is the key still down? + if (m_anykeydown) + { + if (m_repeatdelay) + { + m_repeatdelay--; + } + else + { + m_strobe = 0x80; + } + } +} + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( apple2_joystick ) + PORT_START("joystick_1_x") /* Joystick 1 X Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P1 Joystick X") + PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) + PORT_KEYDELTA(JOYSTICK_DELTA) + PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) + PORT_MINMAX(0,0xff) PORT_PLAYER(1) + PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) + PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) + + PORT_START("joystick_1_y") /* Joystick 1 Y Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P1 Joystick Y") + PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) + PORT_KEYDELTA(JOYSTICK_DELTA) + PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) + PORT_MINMAX(0,0xff) PORT_PLAYER(1) + PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) + PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) + + PORT_START("joystick_2_x") /* Joystick 2 X Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P2 Joystick X") + PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) + PORT_KEYDELTA(JOYSTICK_DELTA) + PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) + PORT_MINMAX(0,0xff) PORT_PLAYER(2) + PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) + + PORT_START("joystick_2_y") /* Joystick 2 Y Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P2 Joystick Y") + PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) + PORT_KEYDELTA(JOYSTICK_DELTA) + PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) + PORT_MINMAX(0,0xff) PORT_PLAYER(2) + PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) + + PORT_START("joystick_buttons") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CODE(JOYCODE_BUTTON1) +INPUT_PORTS_END + +static INPUT_PORTS_START( apple2_gameport ) + PORT_INCLUDE( apple2_joystick ) +INPUT_PORTS_END + +static INPUT_PORTS_START( apple2_sysconfig ) + PORT_START("a2_config") + PORT_CONFNAME(0x03, 0x00, "Composite monitor type") + PORT_CONFSETTING(0x00, "Color") + PORT_CONFSETTING(0x01, "B&W") + PORT_CONFSETTING(0x02, "Green") + PORT_CONFSETTING(0x03, "Amber") +INPUT_PORTS_END + +static INPUT_PORTS_START( apple2c_sysconfig ) + PORT_START("a2_config") + PORT_CONFNAME(0x03, 0x00, "Composite monitor type") + PORT_CONFSETTING(0x00, "Color") + PORT_CONFSETTING(0x01, "B&W") + PORT_CONFSETTING(0x02, "Green") + PORT_CONFSETTING(0x03, "Amber") + PORT_CONFNAME(0x04, 0x04, "40/80 Columns") + PORT_CONFSETTING(0x00, "80 columns") + PORT_CONFSETTING(0x04, "40 columns") + PORT_CONFNAME(0x08, 0x00, "QWERTY/DVORAK") + PORT_CONFSETTING(0x00, "QWERTY") + PORT_CONFSETTING(0x08, "DVORAK") +INPUT_PORTS_END + + /* + Apple IIe & IIc key matrix (from "Sams ComputerFacts: Apple IIe" and "Sams ComputerFacts: Apple IIc") + + | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | + | | | | | | | | | | | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X0 | ESC | 1 | 2 | 3 | 4 | 6 | 5 | 7 | 8 | 9 | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X1 | TAB | Q | W | E | R | Y | T | U | I | O | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X2 | A | D | S | H | F | G | J | K | ;: | L | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X3 | Z | X | C | V | B | M | N | ,< | .> | /? | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X4 | | | | | | | \| | += | 0 | -_ | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X5 | | | | | | | `~ | P | [{ | ]} | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X6 | | | | | | |RETRN| UP | SPC | '" | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X7 | | | | | | | DEL |DOWN |LEFT |RIGHT| + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + */ + + /* + Apple IIe platinum key matrix + + | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | + | | | | | | | | | | | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X0 | ESC | 1 | 2 | 3 | 4 | 6 | 5 | 7 | 8 | 9 | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X1 | TAB | Q | W | E | R | Y | T | U | I | O | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X2 | A | D | S | H | F | G | J | K | ;: | L | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X3 | Z | X | C | V | B | M | N | ,< | .> | /? | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X4 | KP/ | | KP0 | KP1 | KP2 | KP3 | \| | += | 0 | -_ | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X5 | |KPEsc| KP4 | KP5 | KP6 | KP7 | `~ | P | [{ | ]} | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X6 | KP* | | KP8 | KP9 | KP. | KP+ |RETRN| UP | SPC | '" | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X7 | | | | KP- |KPENT| | DEL |DOWN |LEFT |RIGHT| + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + */ + +static INPUT_PORTS_START( apple2e_common ) + PORT_START("X0") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("X1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("X2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + + PORT_START("X3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("X4") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + + PORT_START("X5") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("X6") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + + PORT_START("X7") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + + PORT_START("X8") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) +INPUT_PORTS_END + +static INPUT_PORTS_START( apple2e ) + PORT_INCLUDE( apple2e_common ) + PORT_INCLUDE( apple2_gameport ) + PORT_INCLUDE( apple2_sysconfig ) +INPUT_PORTS_END + +static INPUT_PORTS_START( apple2c ) + PORT_INCLUDE( apple2e_common ) + PORT_INCLUDE( apple2_gameport ) + PORT_INCLUDE( apple2c_sysconfig ) + + PORT_START(MOUSE_BUTTON_TAG) /* Mouse - button */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) + + PORT_START(MOUSE_XAXIS_TAG) /* Mouse - X AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(20) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START(MOUSE_YAXIS_TAG) /* Mouse - Y AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(20) PORT_KEYDELTA(0) PORT_PLAYER(1) +INPUT_PORTS_END + +static INPUT_PORTS_START( apple2euk ) + PORT_START("X0") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xa3) // a3 is Unicode for the pound sign + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("X1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("X2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + + PORT_START("X3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("X4") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + + PORT_START("X5") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("X6") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + + PORT_START("X7") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + + PORT_START("X8") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) + + PORT_INCLUDE( apple2_gameport ) + PORT_INCLUDE(apple2_sysconfig) +INPUT_PORTS_END + +INPUT_PORTS_START( apple2ep ) + PORT_START("X0") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("X1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("X2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + + PORT_START("X3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("X4") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + + PORT_START("X5") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad Esc") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("X6") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + + PORT_START("X7") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + + PORT_START("X8") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) + + PORT_INCLUDE( apple2_gameport ) + PORT_INCLUDE(apple2_sysconfig) +INPUT_PORTS_END + +static SLOT_INTERFACE_START(apple2_cards) + SLOT_INTERFACE("diskii", A2BUS_DISKII) /* Disk II Controller Card */ + SLOT_INTERFACE("diskiing", A2BUS_DISKIING) /* Disk II Controller Card, cycle-accurate version */ + SLOT_INTERFACE("mockingboard", A2BUS_MOCKINGBOARD) /* Sweet Micro Systems Mockingboard */ + SLOT_INTERFACE("phasor", A2BUS_PHASOR) /* Applied Engineering Phasor */ + SLOT_INTERFACE("cffa2", A2BUS_CFFA2) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 65C02/65816 firmware */ + SLOT_INTERFACE("cffa202", A2BUS_CFFA2_6502) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */ + SLOT_INTERFACE("memexp", A2BUS_MEMEXP) /* Apple II Memory Expansion Card */ + SLOT_INTERFACE("ramfactor", A2BUS_RAMFACTOR) /* Applied Engineering RamFactor */ + SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK) /* ThunderWare ThunderClock Plus */ + SLOT_INTERFACE("softcard", A2BUS_SOFTCARD) /* Microsoft SoftCard */ + SLOT_INTERFACE("videoterm", A2BUS_VIDEOTERM) /* Videx VideoTerm */ + SLOT_INTERFACE("ssc", A2BUS_SSC) /* Apple Super Serial Card */ + SLOT_INTERFACE("swyft", A2BUS_SWYFT) /* IAI SwyftCard */ + SLOT_INTERFACE("themill", A2BUS_THEMILL) /* Stellation Two The Mill (6809 card) */ + SLOT_INTERFACE("sam", A2BUS_SAM) /* SAM Software Automated Mouth (8-bit DAC + speaker) */ + SLOT_INTERFACE("alfam2", A2BUS_ALFAM2) /* ALF Apple Music II */ + SLOT_INTERFACE("echoii", A2BUS_ECHOII) /* Street Electronics Echo II */ + SLOT_INTERFACE("ap16", A2BUS_IBSAP16) /* IBS AP16 (German VideoTerm clone) */ + SLOT_INTERFACE("ap16alt", A2BUS_IBSAP16ALT) /* IBS AP16 (German VideoTerm clone), alternate revision */ + SLOT_INTERFACE("vtc1", A2BUS_VTC1) /* Unknown VideoTerm clone #1 */ + SLOT_INTERFACE("vtc2", A2BUS_VTC2) /* Unknown VideoTerm clone #2 */ + SLOT_INTERFACE("arcbd", A2BUS_ARCADEBOARD) /* Third Millenium Engineering Arcade Board */ + SLOT_INTERFACE("midi", A2BUS_MIDI) /* Generic 6840+6850 MIDI board */ + SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE) /* ZIP Technologies IDE card */ + SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS) /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */ + SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */ + SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */ + SLOT_INTERFACE("aesms", A2BUS_AESMS) /* Applied Engineering Super Music Synthesizer */ + SLOT_INTERFACE("ultraterm", A2BUS_ULTRATERM) /* Videx UltraTerm (original) */ + SLOT_INTERFACE("ultratermenh", A2BUS_ULTRATERMENH) /* Videx UltraTerm (enhanced //e) */ + SLOT_INTERFACE("aevm80", A2BUS_VTC2) /* Applied Engineering ViewMaster 80 */ + SLOT_INTERFACE("parallel", A2BUS_PIC) /* Apple Parallel Interface Card */ + SLOT_INTERFACE("corvus", A2BUS_CORVUS) /* Corvus flat-cable HDD interface (see notes in a2corvus.c) */ + SLOT_INTERFACE("mcms1", A2BUS_MCMS1) /* Mountain Computer Music System, card 1 of 2 */ + SLOT_INTERFACE("mcms2", A2BUS_MCMS2) /* Mountain Computer Music System, card 2 of 2. must be in card 1's slot + 1! */ + SLOT_INTERFACE("dx1", A2BUS_DX1) /* Decillonix DX-1 sampler card */ + SLOT_INTERFACE("tm2ho", A2BUS_TIMEMASTERHO) /* Applied Engineering TimeMaster II H.O. */ + SLOT_INTERFACE("mouse", A2BUS_MOUSE) /* Apple II Mouse Card */ + SLOT_INTERFACE("ezcgi", A2BUS_EZCGI) /* E-Z Color Graphics Interface */ + SLOT_INTERFACE("ezcgi9938", A2BUS_EZCGI_9938) /* E-Z Color Graphics Interface (TMS9938) */ + SLOT_INTERFACE("ezcgi9958", A2BUS_EZCGI_9958) /* E-Z Color Graphics Interface (TMS9958) */ +// SLOT_INTERFACE("magicmusician", A2BUS_MAGICMUSICIAN) /* Magic Musician Card */ +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(apple2eaux_cards) + SLOT_INTERFACE("std80", A2EAUX_STD80COL) /* Apple IIe Standard 80 Column Card */ + SLOT_INTERFACE("ext80", A2EAUX_EXT80COL) /* Apple IIe Extended 80 Column Card */ + SLOT_INTERFACE("rw3", A2EAUX_RAMWORKS3) /* Applied Engineering RamWorks III */ +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( apple2e, apple2e_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(apple2e_map) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2e_state, apple2_interrupt, "screen", 0, 1) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD(A2_VIDEO_TAG, APPLE2_VIDEO, XTAL_14_31818MHz) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192) + MCFG_SCREEN_UPDATE_DRIVER(apple2e_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(apple2e_state, apple2) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(A2_SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* RAM */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_DEFAULT_VALUE(0x00) + + /* 0000 banking */ + MCFG_DEVICE_ADD(A2_0000_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(r0000bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200) + + /* 0200 banking */ + MCFG_DEVICE_ADD(A2_0200_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(r0200bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200) + + /* 0400 banking */ + MCFG_DEVICE_ADD(A2_0400_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(r0400bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) + + /* 0800 banking */ + MCFG_DEVICE_ADD(A2_0800_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(r0800bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000) + + /* 2000 banking */ + MCFG_DEVICE_ADD(A2_2000_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(r2000bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000) + + /* 4000 banking */ + MCFG_DEVICE_ADD(A2_4000_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(r4000bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x8000) + + /* C100 banking */ + MCFG_DEVICE_ADD(A2_C100_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(c100bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x200) + + /* C300 banking */ + MCFG_DEVICE_ADD(A2_C300_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(c300bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x100) + + /* C400 banking */ + MCFG_DEVICE_ADD(A2_C400_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(c400bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) + + /* C800 banking */ + MCFG_DEVICE_ADD(A2_C800_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(c800bank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x800) + + /* built-in language card emulation */ + MCFG_DEVICE_ADD(A2_LCBANK_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(lcbank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x3000) + + /* /INH banking */ + MCFG_DEVICE_ADD(A2_UPPERBANK_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(inhbank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x3000) + + /* keyboard controller */ + MCFG_DEVICE_ADD("ay3600", AY3600, 0) + MCFG_AY3600_MATRIX_X0(IOPORT("X0")) + MCFG_AY3600_MATRIX_X1(IOPORT("X1")) + MCFG_AY3600_MATRIX_X2(IOPORT("X2")) + MCFG_AY3600_MATRIX_X3(IOPORT("X3")) + MCFG_AY3600_MATRIX_X4(IOPORT("X4")) + MCFG_AY3600_MATRIX_X5(IOPORT("X5")) + MCFG_AY3600_MATRIX_X6(IOPORT("X6")) + MCFG_AY3600_MATRIX_X7(IOPORT("X7")) + MCFG_AY3600_MATRIX_X8(IOPORT("X8")) + MCFG_AY3600_SHIFT_CB(READLINE(apple2e_state, ay3600_shift_r)) + MCFG_AY3600_CONTROL_CB(READLINE(apple2e_state, ay3600_control_r)) + MCFG_AY3600_DATA_READY_CB(WRITELINE(apple2e_state, ay3600_data_ready_w)) + MCFG_AY3600_AKO_CB(WRITELINE(apple2e_state, ay3600_ako_w)) + + /* repeat timer. 15 Hz from page 7-15 of "Understanding the Apple IIe" */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("repttmr", apple2e_state, ay3600_repeat, attotime::from_hz(15)) + + /* slot devices */ + MCFG_DEVICE_ADD("a2bus", A2BUS, 0) + MCFG_A2BUS_CPU("maincpu") + MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(apple2e_state, a2bus_irq_w)) + MCFG_A2BUS_OUT_NMI_CB(WRITELINE(apple2e_state, a2bus_nmi_w)) + MCFG_A2BUS_OUT_INH_CB(WRITELINE(apple2e_state, a2bus_inh_w)) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl1", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl2", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl3", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl4", apple2_cards, "mockingboard") + MCFG_A2BUS_SLOT_ADD("a2bus", "sl5", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl6", apple2_cards, "diskiing") + MCFG_A2BUS_SLOT_ADD("a2bus", "sl7", apple2_cards, NULL) + + MCFG_DEVICE_ADD(A2_AUXSLOT_TAG, A2EAUXSLOT, 0) + MCFG_A2EAUXSLOT_CPU("maincpu") + MCFG_A2EAUXSLOT_OUT_IRQ_CB(WRITELINE(apple2e_state, a2bus_irq_w)) + MCFG_A2EAUXSLOT_OUT_NMI_CB(WRITELINE(apple2e_state, a2bus_nmi_w)) + MCFG_A2EAUXSLOT_SLOT_ADD(A2_AUXSLOT_TAG, "aux", apple2eaux_cards, "ext80") // default to an extended 80-column card + + MCFG_SOFTWARE_LIST_ADD("flop525_list","apple2") + + MCFG_CASSETTE_ADD(A2_CASSETTE_TAG) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mprof3, apple2e ) + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apple2ee, apple2e ) + MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(apple2e_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tk3000, apple2e ) + MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(apple2e_map) + +// MCFG_CPU_ADD("subcpu", Z80, 1021800) // schematics are illegible on where the clock comes from, but it *seems* to be the same as the 65C02 clock +// MCFG_CPU_PROGRAM_MAP(tk3000_kbd_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apple2ep, apple2e ) + MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(apple2e_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apple2c, apple2ee ) + MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(apple2c_map) + + // IIc and friends have no cassette port + MCFG_DEVICE_REMOVE(A2_CASSETTE_TAG) + + MCFG_A2BUS_SLOT_REMOVE("sl1") // IIc has no slots, of course :) + MCFG_A2BUS_SLOT_REMOVE("sl2") + MCFG_A2BUS_SLOT_REMOVE("sl3") + MCFG_A2BUS_SLOT_REMOVE("sl4") + MCFG_A2BUS_SLOT_REMOVE("sl5") + MCFG_A2BUS_SLOT_REMOVE("sl6") + MCFG_A2BUS_SLOT_REMOVE("sl7") + + MCFG_DEVICE_ADD(IIC_ACIA1_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_14_31818MHz / 8) // ~1.789 MHz + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(PRINTER_PORT_TAG, rs232_port_device, write_txd)) + + MCFG_DEVICE_ADD(IIC_ACIA2_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) // matches SSC so modem software is compatible + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("modem", rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD(PRINTER_PORT_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_cts)) + + MCFG_RS232_PORT_ADD(MODEM_PORT_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_cts)) + + // TODO: populate the IIc's other virtual slots with ONBOARD_ADD + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_DISKIING, NULL) + + MCFG_A2EAUXSLOT_SLOT_REMOVE("aux") + MCFG_DEVICE_REMOVE(A2_AUXSLOT_TAG) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("128K") +MACHINE_CONFIG_END + +const applefdc_interface a2cp_interface = +{ + sony_set_lines, /* set_lines */ + sony_set_enable_lines, /* set_enable_lines */ + + sony_read_data, /* read_data */ + sony_write_data, /* write_data */ + sony_read_status /* read_status */ +}; + +static const floppy_interface apple2cp_floppy35_floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple35_iigs), + "floppy_3_5" +}; + +static MACHINE_CONFIG_DERIVED( apple2cp, apple2c ) + MCFG_A2BUS_SLOT_REMOVE("sl6") + MCFG_IWM_ADD(IICP_IWM_TAG, a2cp_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(apple2cp_floppy35_floppy_interface) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apple2c_iwm, apple2c ) + + MCFG_A2BUS_SLOT_REMOVE("sl6") + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_IWM_FDC, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apple2c_mem, apple2c ) + MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(apple2c_memexp_map) + + MCFG_A2BUS_SLOT_REMOVE("sl6") + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_IWM_FDC, NULL) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("128K, 384K, 640K, 896K, 1152K") +MACHINE_CONFIG_END + +const applefdc_interface fdc_interface = +{ + apple525_set_lines, /* set_lines */ + apple525_set_enable_lines, /* set_enable_lines */ + + apple525_read_data, /* read_data */ + apple525_write_data, /* write_data */ + apple525_read_status /* read_status */ +}; + +static const floppy_interface floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple2), + "floppy_5_25" +}; + +static MACHINE_CONFIG_DERIVED( laser128, apple2c ) + MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(laser128_map) + + MCFG_APPLEFDC_ADD(LASER128_UDC_TAG, fdc_interface) + MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(floppy_interface,15,16) + + MCFG_A2BUS_SLOT_REMOVE("sl6") + + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl1", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl2", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl3", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl4", A2BUS_LASER128, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl5", apple2_cards, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_LASER128, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl7", apple2_cards, NULL) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("128K, 384K, 640K, 896K, 1152K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( laser128ex2, apple2c ) + MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(laser128_map) + + MCFG_APPLEFDC_ADD(LASER128_UDC_TAG, fdc_interface) + MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(floppy_interface,15,16) + + MCFG_A2BUS_SLOT_REMOVE("sl6") + + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl1", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl2", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl3", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl4", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl5", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_LASER128, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl7", A2BUS_LASER128, NULL) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("128K, 384K, 640K, 896K, 1152K") +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(apple2e) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "342-0133-a.chr", 0x0000, 0x1000,CRC(b081df66) SHA1(7060de104046736529c1e8a687a0dd7b84f8c51b)) + ROM_LOAD ( "342-0133-a.chr", 0x1000, 0x1000,CRC(b081df66) SHA1(7060de104046736529c1e8a687a0dd7b84f8c51b)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ( "342-0135-b.64", 0x0000, 0x2000, CRC(e248835e) SHA1(523838c19c79f481fa02df56856da1ec3816d16e)) + ROM_LOAD ( "342-0134-a.64", 0x2000, 0x2000, CRC(fc3d59d8) SHA1(8895a4b703f2184b673078f411f4089889b61c54)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak +ROM_END + +ROM_START(apple2euk) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD( "341-0160-a.chr", 0x0000, 0x2000, CRC(9be77112) SHA1(48aafa9a72002c495bc1f3d28150630ff89ca47e) ) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ( "342-0135-b.64", 0x0000, 0x2000, CRC(e248835e) SHA1(523838c19c79f481fa02df56856da1ec3816d16e)) + ROM_LOAD ( "342-0134-a.64", 0x2000, 0x2000, CRC(fc3d59d8) SHA1(8895a4b703f2184b673078f411f4089889b61c54)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "341-0150-a.e12", 0x000, 0x800, CRC(66ffacd7) SHA1(47bb9608be38ff75429a989b930a93b47099648e) ) +ROM_END + +ROM_START(mprof3) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "mpf3.chr", 0x0000, 0x1000,CRC(2597bc19) SHA1(e114dcbb512ec24fb457248c1b53cbd78039ed20)) + ROM_LOAD ( "mpf3.chr", 0x1000, 0x1000,CRC(2597bc19) SHA1(e114dcbb512ec24fb457248c1b53cbd78039ed20)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ( "mpf3-cd.rom", 0x0000, 0x2000, CRC(5b662e06) SHA1(aa0db775ca78986480829fcc10f00e57629e1a7c)) + ROM_LOAD ( "mpf3-ef.rom", 0x2000, 0x2000, CRC(2c5e8b92) SHA1(befeb03e04b7c3ef36ef5829948a53880df85e92)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // need to dump real mprof keyboard ROM +ROM_END + +ROM_START(apple2ee) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "342-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + ROM_LOAD ( "342-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ( "342-0304-a.e10", 0x0000, 0x2000, CRC(443aa7c4) SHA1(3aecc56a26134df51e65e17f33ae80c1f1ac93e6)) /* PCB: "CD ROM // 342-0304", 2364 mask rom */ + ROM_LOAD ( "342-0303-a.e8", 0x2000, 0x2000, CRC(95e10034) SHA1(afb09bb96038232dc757d40c0605623cae38088e)) /* PCB: "EF ROM // 342-0303", 2364 mask rom */ + + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +ROM_START(apple2eeuk) + ROM_REGION(0x2000, "gfx1", 0) + ROM_LOAD( "342-0273-a.chr", 0x0000, 0x2000, CRC(9157085a) SHA1(85479a509d6c8176949a5b20720567b7022aa631) ) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ( "342-0304-a.e10", 0x0000, 0x2000, CRC(443aa7c4) SHA1(3aecc56a26134df51e65e17f33ae80c1f1ac93e6)) /* PCB: "CD ROM // 342-0304", 2364 mask rom */ + ROM_LOAD ( "342-0303-a.e8", 0x2000, 0x2000, CRC(95e10034) SHA1(afb09bb96038232dc757d40c0605623cae38088e)) /* PCB: "EF ROM // 342-0303", 2364 mask rom */ + + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0150-a.e12", 0x000, 0x800, CRC(66ffacd7) SHA1(47bb9608be38ff75429a989b930a93b47099648e) ) +ROM_END + +ROM_START(apple2ep) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "342-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + ROM_LOAD ( "342-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ("32-0349-b.128", 0x0000, 0x4000, CRC(1d70b193) SHA1(b8ea90abe135a0031065e01697c4a3a20d51198b)) /* should rom name be 342-0349-b? */ + + ROM_REGION( 0x800, "keyboard", 0 ) + // chip printed markings say 342-0132-d, but internally text says "341-0132-d". Go figure. + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +ROM_START(apple2c) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ( "a2c.128", 0x0000, 0x4000, CRC(f0edaa1b) SHA1(1a9b8aca5e32bb702ddb7791daddd60a89655729)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak +ROM_END + +// unlike the very unique TK2000, the TK3000 is a mostly stock enhanced IIe clone +ROM_START(tk3000) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD( "tk3000.f7", 0x000000, 0x002000, CRC(70157693) SHA1(a7922e2137f95271011042441d80466fba7bb828) ) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD( "tk3000.f4f6", 0x000000, 0x004000, CRC(5b1e8ab2) SHA1(f163e5753c18ff0e812a448e8da406f102600edf) ) + + ROM_REGION(0x2000, "kbdcpu", 0) + ROM_LOAD( "tk3000.e13", 0x000000, 0x002000, CRC(f9b860d3) SHA1(6a127f1458f43a00199d3dde94569b8928f05a53) ) + + ROM_REGION(0x800, "keyboard", ROMREGION_ERASE00) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // probably not this machine's actual ROM +ROM_END + +ROM_START(prav8c) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "charrom.d20", 0x0000, 0x2000,CRC(935212cc) SHA1(934603a441c631bd841ea0d2ff39525474461e47)) + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD ( "prom_cd.d46", 0x0000, 0x2000, CRC(195d0b48) SHA1(f8c4f3722159081f6950207f03bc85da30980c08)) + ROM_LOAD ( "prom_ef.d41", 0x2000, 0x2000, CRC(ec6aa2f6) SHA1(64bce893ebf0e22cd8f22436b97ef1bfeddf692f)) + + // contains slot firmware for slots 1, 2, and 6 (6 is the usual Disk II f/w) + ROM_REGION(0x2000,"unknown",0) + ROM_LOAD ( "eprom.d38", 0x0000, 0x2000, CRC(c8d00b19) SHA1(13d156957ea68d0e7bc4be57cb1580c8b1399981)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // we don't know what this machine used +ROM_END + +ROM_START(apple2c0) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD("3420033a.256", 0x0000, 0x8000, CRC(c8b979b3) SHA1(10767e96cc17bad0970afda3a4146564e6272ba1)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak +ROM_END + +ROM_START(apple2c3) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD("342-0445-a.256", 0x0000, 0x8000, CRC(bc5a79ff) SHA1(5338d9baa7ae202457b6500fde5883dbdc86e5d3)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak +ROM_END + +ROM_START(apple2c4) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD("3410445b.256", 0x0000, 0x8000, CRC(06f53328) SHA1(015061597c4cda7755aeb88b735994ffd2f235ca)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak +ROM_END + +ROM_START(laser128) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom + ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD("laser128.256", 0x0000, 0x8000, CRC(39e59ed3) SHA1(cbd2f45c923725bfd57f8548e65cc80b13bc18da)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // need to dump real laser rom +ROM_END + +ROM_START(las128ex) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom + ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD("las128ex.256", 0x0000, 0x8000, CRC(b67c8ba1) SHA1(8bd5f82a501b1cf9d988c7207da81e514ca254b0)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // need to dump real laser rom +ROM_END + +ROM_START(las128e2) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom + ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD( "laser 128ex2 rom version 6.1.bin", 0x000000, 0x008000, CRC(7f911c90) SHA1(125754c1bd777d4c510f5239b96178c6f2e3236b) ) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // need to dump real laser rom +ROM_END + +ROM_START(apple2cp) + ROM_REGION(0x2000,"gfx1",0) + ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + + ROM_REGION(0x8000,"maincpu",0) + ROM_LOAD("341-0625-a.256", 0x0000, 0x8000, CRC(0b996420) SHA1(1a27ae26966bbafd825d08ad1a24742d3e33557c)) + + ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1983, apple2e, 0, apple2, apple2e, apple2e, driver_device, 0, "Apple Computer", "Apple //e", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, apple2euk,apple2e, 0, apple2e, apple2euk,driver_device, 0, "Apple Computer", "Apple //e (UK)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, mprof3, apple2e, 0, mprof3, apple2e, driver_device, 0, "Multitech", "Microprofessor III", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1985, apple2ee, apple2e, 0, apple2ee, apple2e, driver_device, 0, "Apple Computer", "Apple //e (enhanced)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, apple2eeuk,apple2e, 0, apple2ee, apple2euk, driver_device,0, "Apple Computer", "Apple //e (enhanced, UK)", MACHINE_SUPPORTS_SAVE ) +COMP( 1987, apple2ep, apple2e, 0, apple2ep, apple2ep, driver_device, 0, "Apple Computer", "Apple //e (Platinum)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, apple2c, 0, apple2, apple2c, apple2c, driver_device, 0, "Apple Computer", "Apple //c" , MACHINE_SUPPORTS_SAVE ) +COMP( 1986, tk3000, apple2c, 0, tk3000, apple2e, driver_device, 0, "Microdigital", "TK3000//e" , MACHINE_SUPPORTS_SAVE ) +COMP( 1989, prav8c, apple2e, 0, apple2e, apple2e, driver_device, 0, "Pravetz", "Pravetz 8C", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1987, laser128, apple2c, 0, laser128, apple2e, driver_device, 0, "Video Technology", "Laser 128 (version 4.2)", MACHINE_SUPPORTS_SAVE ) +COMP( 1988, las128ex, apple2c, 0, laser128, apple2e, driver_device, 0, "Video Technology", "Laser 128ex (version 4.5)", MACHINE_SUPPORTS_SAVE ) +COMP( 1988, las128e2, apple2c, 0, laser128ex2, apple2e, driver_device, 0, "Video Technology", "Laser 128ex2 (version 6.1)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, apple2c0, apple2c, 0, apple2c_iwm, apple2c, driver_device, 0, "Apple Computer", "Apple //c (UniDisk 3.5)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, apple2c3, apple2c, 0, apple2c_mem, apple2c, driver_device, 0, "Apple Computer", "Apple //c (Original Memory Expansion)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, apple2c4, apple2c, 0, apple2c_mem, apple2c, driver_device, 0, "Apple Computer", "Apple //c (rev 4)", MACHINE_SUPPORTS_SAVE ) +COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2c, driver_device, 0, "Apple Computer", "Apple //c Plus", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/apple2gs.c b/src/mame/drivers/apple2gs.c new file mode 100644 index 00000000000..54c4674f9df --- /dev/null +++ b/src/mame/drivers/apple2gs.c @@ -0,0 +1,597 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,R. Belmont +/*************************************************************************** + + drivers/apple2gs.c + Apple IIgs + Driver by Nathan Woods and R. Belmont + + TODO: + - Fix spurious interrupt problem (caused by ADB HLE; switching to emulation of the M50740 + GLU should solve this) + - Fix 5.25" disks + - Optimize video code + - More RAM configurations + + NOTES: + + Video timing and the h/vcount registers: + VCounts + HCounts go like this: 0xfa (start of frame, still in vblank) + 0 0x40 0x41 0x58 (first visible pixel) 0x7f + ____________________________________ 0x100 (first visible scan line) + | | + | | + | | + | | + | | + HBL region | | + | | + | | + | | + | | + | | 0x1c0 (first line of Vblank, c019 and heartbeat trigger here, only true VBL if in A2 classic modes) + | | + ____________________________________ 0x1c8 (actual start of vblank in IIgs modes) + + 0x1ff (end of frame, in vblank) + + There are 64 HCounts total, and 704 pixels total, so HCounts do not map to the pixel clock. + VCounts do map directly to scanlines however, and count 262 of them. + +================================================================= + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/g65816/g65816.h" +#include "includes/apple2.h" +#include "imagedev/flopdrv.h" +#include "formats/ap2_dsk.h" +#include "formats/ap_dsk35.h" +#include "includes/apple2gs.h" +#include "machine/sonydriv.h" +#include "machine/appldriv.h" +#include "sound/es5503.h" +#include "machine/applefdc.h" +#include "machine/8530scc.h" +#include "sound/speaker.h" +#include "machine/ram.h" + +#include "bus/a2bus/a2bus.h" +#include "bus/a2bus/a2lang.h" +#include "bus/a2bus/a2diskii.h" +#include "bus/a2bus/a2mockingboard.h" +#include "bus/a2bus/a2cffa.h" +#include "bus/a2bus/a2memexp.h" +#include "bus/a2bus/a2scsi.h" +#include "bus/a2bus/a2thunderclock.h" +#include "bus/a2bus/a2ssc.h" +#include "bus/a2bus/a2softcard.h" +#include "bus/a2bus/a2sam.h" +#include "bus/a2bus/a2alfam2.h" +#include "bus/a2bus/a2echoii.h" +#include "bus/a2bus/a2arcadebd.h" +#include "bus/a2bus/a2midi.h" +#include "bus/a2bus/a2vulcan.h" +#include "bus/a2bus/a2zipdrive.h" +//#include "bus/a2bus/a2udrive.h" +#include "bus/a2bus/a2hsscsi.h" + +static const gfx_layout apple2gs_text_layout = +{ + 14,8, /* 14*8 characters */ + 512, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + { 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1 }, /* x offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout apple2gs_dbltext_layout = +{ + 7,8, /* 7*8 characters */ + 512, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + { 7, 6, 5, 4, 3, 2, 1 }, /* x offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( apple2gs ) + GFXDECODE_ENTRY( "gfx1", 0x0000, apple2gs_text_layout, 0, 2 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, apple2gs_dbltext_layout, 0, 2 ) +GFXDECODE_END + +static const unsigned char apple2gs_palette[] = +{ + 0x0, 0x0, 0x0, /* Black $0 $0000 */ + 0xD, 0x0, 0x3, /* Deep Red $1 $0D03 */ + 0x0, 0x0, 0x9, /* Dark Blue $2 $0009 */ + 0xD, 0x2, 0xD, /* Purple $3 $0D2D */ + 0x0, 0x7, 0x2, /* Dark Green $4 $0072 */ + 0x5, 0x5, 0x5, /* Dark Gray $5 $0555 */ + 0x2, 0x2, 0xF, /* Medium Blue $6 $022F */ + 0x6, 0xA, 0xF, /* Light Blue $7 $06AF */ + 0x8, 0x5, 0x0, /* Brown $8 $0850 */ + 0xF, 0x6, 0x0, /* Orange $9 $0F60 */ + 0xA, 0xA, 0xA, /* Light Gray $A $0AAA */ + 0xF, 0x9, 0x8, /* Pink $B $0F98 */ + 0x1, 0xD, 0x0, /* Light Green $C $01D0 */ + 0xF, 0xF, 0x0, /* Yellow $D $0FF0 */ + 0x4, 0xF, 0x9, /* Aquamarine $E $04F9 */ + 0xF, 0xF, 0xF /* White $F $0FFF */ +}; + +static INPUT_PORTS_START( apple2gs ) + PORT_INCLUDE( apple2ep ) + + PORT_START("adb_mouse_x") + PORT_BIT( 0x7f, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 1") + + PORT_START("adb_mouse_y") + PORT_BIT( 0x7f, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 0") + +INPUT_PORTS_END + + + +/* Initialize the palette */ +PALETTE_INIT_MEMBER(apple2gs_state,apple2gs) +{ + int i; + +// PALETTE_INIT_NAME(apple2)(palette); + + for (i = 0; i < 16; i++) + { + palette.set_pen_color(i, + apple2gs_palette[(3*i)]*17, + apple2gs_palette[(3*i)+1]*17, + apple2gs_palette[(3*i)+2]*17); + + m_a2_palette[i] = rgb_t(apple2gs_palette[(3*i)]*17, apple2gs_palette[(3*i)+1]*17, apple2gs_palette[(3*i)+2]*17); + } +} + +READ8_MEMBER(apple2gs_state::apple2gs_adc_read) +{ + return 0x80; +} + +static const floppy_interface apple2gs_floppy35_floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple35_iigs), + "floppy_3_5" +}; + +static const floppy_interface apple2gs_floppy525_floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple2), + "floppy_5_25" +}; + + +static ADDRESS_MAP_START( apple2gs_map, AS_PROGRAM, 8, apple2gs_state ) + /* nothing in the address map - everything is added dynamically */ +ADDRESS_MAP_END + +// ADB microcontroller emulation +// +// Huge thanks to Neil Parker's writeup on the ADB microcontroller! +// http://www.llx.com/~nparker/a2/adb.html + +#if RUN_ADB_MICRO +READ8_MEMBER(apple2gs_state::adbmicro_p0_in) +{ + return m_glu_bus; +} + +READ8_MEMBER(apple2gs_state::adbmicro_p1_in) +{ + if (m_is_rom3) + { + return 0x06; // indicate ROM 3 + } + + return 0xff; +} + +READ8_MEMBER(apple2gs_state::adbmicro_p2_in) +{ + UINT8 rv = 0; + + rv |= 0x40; // no reset + rv |= (m_adb_line) ? 0x00 : 0x80; + + return rv; +} + +READ8_MEMBER(apple2gs_state::adbmicro_p3_in) +{ + return 0x7; // don't press IIE capslock/ctrl/shift +} + +WRITE8_MEMBER(apple2gs_state::adbmicro_p0_out) +{ + m_glu_bus = data; +} + +WRITE8_MEMBER(apple2gs_state::adbmicro_p1_out) +{ +} + +WRITE8_MEMBER(apple2gs_state::adbmicro_p2_out) +{ + if (!(data & 0x10)) + { + if (m_adbmicro->are_port_bits_output(0, 0xff)) + { + keyglu_mcu_write(data & 7, m_glu_bus); + } + else // read GLU + { + m_glu_bus = keyglu_mcu_read(data & 7); + } + } +} + +WRITE8_MEMBER(apple2gs_state::adbmicro_p3_out) +{ + if (((data & 0x08) == 0x08) != m_adb_line) + { + m_adb_dtime = (int)(machine().time().as_ticks(XTAL_3_579545MHz*2) - m_last_adb_time); +// printf("ADB change to %d (dtime %d)\n", (data>>3) & 1, m_adb_dtime); + m_last_adb_time = machine().time().as_ticks(XTAL_3_579545MHz*2); + m_adb_line = (data & 0x8) ? true : false; + } +} +#endif + +WRITE_LINE_MEMBER(apple2gs_state::a2bus_irq_w) +{ + if (state) + { + apple2gs_add_irq(IRQ_SLOT); + } + else + { + apple2gs_remove_irq(IRQ_SLOT); + } +} + +WRITE_LINE_MEMBER(apple2gs_state::a2bus_nmi_w) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, state); +} + +WRITE_LINE_MEMBER(apple2gs_state::a2bus_inh_w) +{ + m_inh_slot = -1; + apple2_update_memory(); +} + +static SLOT_INTERFACE_START(apple2_cards) + SLOT_INTERFACE("diskii", A2BUS_DISKII) /* Disk II Controller Card */ + SLOT_INTERFACE("mockingboard", A2BUS_MOCKINGBOARD) /* Sweet Micro Systems Mockingboard */ + SLOT_INTERFACE("phasor", A2BUS_PHASOR) /* Applied Engineering Phasor */ + SLOT_INTERFACE("cffa2", A2BUS_CFFA2) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 65C02/65816 firmware */ + SLOT_INTERFACE("cffa202", A2BUS_CFFA2_6502) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */ + SLOT_INTERFACE("memexp", A2BUS_MEMEXP) /* Apple II Memory Expansion Card */ + SLOT_INTERFACE("ramfactor", A2BUS_RAMFACTOR) /* Applied Engineering RamFactor */ + SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK) /* ThunderWare ThunderClock Plus */ + SLOT_INTERFACE("ssc", A2BUS_SSC) /* Apple Super Serial Card */ + SLOT_INTERFACE("sam", A2BUS_SAM) /* SAM Software Automated Mouth (8-bit DAC + speaker) */ + SLOT_INTERFACE("alfam2", A2BUS_ALFAM2) /* ALF Apple Music II */ + SLOT_INTERFACE("echoii", A2BUS_ECHOII) /* Street Electronics Echo II */ + SLOT_INTERFACE("arcbd", A2BUS_ARCADEBOARD) /* Third Millenium Engineering Arcade Board */ + SLOT_INTERFACE("midi", A2BUS_MIDI) /* Generic 6840+6850 MIDI board */ + SLOT_INTERFACE("vulcan", A2BUS_VULCAN) /* AE Vulcan IDE card */ + SLOT_INTERFACE("vulcangold", A2BUS_VULCANGOLD) /* AE Vulcan Gold IDE card */ + SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE) /* ZIP Technologies IDE card */ + SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS) /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */ +// SLOT_INTERFACE("mdturbo", A2BUS_UDRIVE_TURBO) /* ///SHH Systeme MicroDrive Turbo IDE card */ + +// SLOT_INTERFACE("softcard", A2BUS_SOFTCARD) /* Microsoft SoftCard */ // appears not to be IIgs compatible? + SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */ + SLOT_INTERFACE("hsscsi", A2BUS_HSSCSI) /* Apple II High-Speed SCSI Card */ +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( apple2gs, apple2gs_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", G65816, APPLE2GS_14M/5) + MCFG_CPU_PROGRAM_MAP(apple2gs_map) + #if RUN_ADB_MICRO + MCFG_CPU_ADD(ADBMICRO_TAG, M50741, XTAL_3_579545MHz) + MCFG_M5074X_PORT0_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p0_in)) + MCFG_M5074X_PORT0_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p0_out)) + MCFG_M5074X_PORT1_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p1_in)) + MCFG_M5074X_PORT1_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p1_out)) + MCFG_M5074X_PORT2_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p2_in)) + MCFG_M5074X_PORT2_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p2_out)) + MCFG_M5074X_PORT3_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p3_in)) + MCFG_M5074X_PORT3_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p3_out)) + #endif + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2gs_state, apple2_interrupt, "screen", 0, 1) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(704, 262) // 640+32+32 for the borders + MCFG_SCREEN_VISIBLE_AREA(0,703,0,230) + MCFG_SCREEN_UPDATE_DRIVER(apple2gs_state, screen_update_apple2gs) + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(apple2gs_state, apple2gs) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", apple2gs ) + + MCFG_MACHINE_START_OVERRIDE(apple2gs_state, apple2gs ) + MCFG_MACHINE_RESET_OVERRIDE(apple2gs_state, apple2gs ) + + MCFG_VIDEO_START_OVERRIDE(apple2gs_state, apple2gs ) + + /* keyboard controller */ + MCFG_DEVICE_ADD("ay3600", AY3600, 0) + MCFG_AY3600_MATRIX_X0(IOPORT("X0")) + MCFG_AY3600_MATRIX_X1(IOPORT("X1")) + MCFG_AY3600_MATRIX_X2(IOPORT("X2")) + MCFG_AY3600_MATRIX_X3(IOPORT("X3")) + MCFG_AY3600_MATRIX_X4(IOPORT("X4")) + MCFG_AY3600_MATRIX_X5(IOPORT("X5")) + MCFG_AY3600_MATRIX_X6(IOPORT("X6")) + MCFG_AY3600_MATRIX_X7(IOPORT("X7")) + MCFG_AY3600_MATRIX_X8(IOPORT("X8")) + MCFG_AY3600_SHIFT_CB(READLINE(apple2_state, ay3600_shift_r)) + MCFG_AY3600_CONTROL_CB(READLINE(apple2_state, ay3600_control_r)) + MCFG_AY3600_DATA_READY_CB(WRITELINE(apple2_state, ay3600_iie_data_ready_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("a2speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_ES5503_ADD("es5503", APPLE2GS_7M) + MCFG_ES5503_OUTPUT_CHANNELS(2) + MCFG_ES5503_IRQ_FUNC(WRITELINE(apple2gs_state, apple2gs_doc_irq)) + MCFG_ES5503_ADC_FUNC(READ8(apple2gs_state, apple2gs_adc_read)) + + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* slot devices */ + MCFG_DEVICE_ADD("a2bus", A2BUS, 0) + MCFG_A2BUS_CPU("maincpu") + MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(apple2gs_state, a2bus_irq_w)) + MCFG_A2BUS_OUT_NMI_CB(WRITELINE(apple2gs_state, a2bus_nmi_w)) + MCFG_A2BUS_OUT_INH_CB(WRITELINE(apple2gs_state, a2bus_inh_w)) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl0", A2BUS_LANG, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl1", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl2", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl3", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl4", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl5", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl6", apple2_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl7", apple2_cards, NULL) + + MCFG_IWM_ADD("fdc", apple2_fdc_interface) + + /* SCC */ + MCFG_DEVICE_ADD("scc", SCC8530, APPLE2GS_14M/2) + + MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(apple2gs_floppy525_floppy_interface,15,16) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(apple2gs_floppy35_floppy_interface) + + MCFG_NVRAM_ADD_0FILL("nvram") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") // 1M on board + 1M in the expansion slot was common for ROM 03 + MCFG_RAM_EXTRA_OPTIONS("1M,3M,4M,5M,6M,7M,8M") + MCFG_RAM_DEFAULT_VALUE(0x00) + + MCFG_SOFTWARE_LIST_ADD("flop35_list","apple2gs") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop525_list", "apple2") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apple2gsr1, apple2gs ) + MCFG_MACHINE_START_OVERRIDE(apple2gs_state, apple2gsr1 ) + + #if RUN_ADB_MICRO + MCFG_CPU_REPLACE(ADBMICRO_TAG, M50740, XTAL_3_579545MHz) + MCFG_M5074X_PORT0_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p0_in)) + MCFG_M5074X_PORT0_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p0_out)) + MCFG_M5074X_PORT1_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p1_in)) + MCFG_M5074X_PORT1_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p1_out)) + MCFG_M5074X_PORT2_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p2_in)) + MCFG_M5074X_PORT2_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p2_out)) + MCFG_M5074X_PORT3_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p3_in)) + MCFG_M5074X_PORT3_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p3_out)) + #endif + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1280K") // 256K on board + 1M in the expansion slot was common for ROM 01 + MCFG_RAM_EXTRA_OPTIONS("256K,512K,768K,1M,2M,3M,4M,5M,6M,7M,8M") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(apple2gs) + // M50740/50741 ADB MCU inside the IIgs system unit + ROM_REGION(0x1000,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) + ROM_LOAD( "341s0632-2.bin", 0x000000, 0x001000, CRC(e1c11fb0) SHA1(141d18c36a617ab9dce668445440d34354be0672) ) + + // i8048 microcontroller inside the IIgs ADB Standard Keyboard + ROM_REGION(0x400, "kmcu", 0) + // from early-production ROM 00 Woz Limited Edition IIgs. keyboard "Part Number 658-4081 825-1301-A" + // ROM is marked "NEC Japan 8626XD 341-0232A 543" so 26th week of 1986 + ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) + // from later non-Woz ROM 01. keyboard "Model A9M0330" + // ROM is marked "NEC Japan 8806HD 8048HC610 341-0124-A (c) APPLE 87" so 6th week of 1988 + ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) + + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) /* need label/part number */ + + ROM_REGION(0x40000,"maincpu",0) + ROM_LOAD("341-0737", 0x0000, 0x20000, CRC(8d410067) SHA1(c0f4704233ead14cb8e1e8a68fbd7063c56afd27)) /* Needs verification; 341-0737: IIgs ROM03 FC-FD */ + ROM_LOAD("341-0748", 0x20000, 0x20000, CRC(d4c50550) SHA1(2784cdd7ac7094b3e494409db3e72b4e6d2d9e81)) /* Needs verification; 341-0748: IIgs ROM03 FE-FF */ + + ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) + + // temporary: use IIe enhanced keyboard decode ROM + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +ROM_START(apple2gsr3p) + ROM_REGION(0x1000,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) + ROM_LOAD( "341s0632-2.bin", 0x000000, 0x001000, CRC(e1c11fb0) SHA1(141d18c36a617ab9dce668445440d34354be0672) ) + + ROM_REGION(0x400, "kmcu", 0) + ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) + ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) + + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) /* need label/part number */ + + ROM_REGION(0x40000,"maincpu",0) + ROM_LOAD("341-0728", 0x0000, 0x20000, NO_DUMP) /* 341-0728: IIgs ROM03 prototype FC-FD */ + ROM_LOAD("341-0729", 0x20000, 0x20000, NO_DUMP) /* 341-0729: IIgs ROM03 prototype FE-FF */ + + ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) + + // temporary: use IIe enhanced keyboard decode ROM + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +ROM_START(apple2gsr3lp) + ROM_REGION(0x1000,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) + ROM_LOAD( "341s0632-2.bin", 0x000000, 0x001000, CRC(e1c11fb0) SHA1(141d18c36a617ab9dce668445440d34354be0672) ) + + ROM_REGION(0x400, "kmcu", 0) + ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) + ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) + + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) /* need label/part number */ + + ROM_REGION(0x40000,"maincpu",0) + ROM_LOAD("341-0737", 0x0000, 0x20000, CRC(8d410067) SHA1(c0f4704233ead14cb8e1e8a68fbd7063c56afd27)) /* 341-0737: IIgs ROM03 FC-FD */ + ROM_LOAD("341-0749", 0x20000, 0x20000, NO_DUMP) /* 341-0749: unknown ?post? ROM03 IIgs prototype? FE-FF */ + + ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) + + // temporary: use IIe enhanced keyboard decode ROM + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +ROM_START(apple2gsr1) + ROM_REGION(0xc00,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) + ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) ) + + ROM_REGION(0x400, "kmcu", 0) + ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) + ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) + + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) /* need label/part number */ + + ROM_REGION(0x20000,"maincpu",0) + ROM_LOAD("342-0077-b", 0x0000, 0x20000, CRC(42f124b0) SHA1(e4fc7560b69d062cb2da5b1ffbe11cd1ca03cc37)) /* 342-0077-B: IIgs ROM01 */ + + ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) + + // temporary: use IIe enhanced keyboard decode ROM + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +ROM_START(apple2gsr0) + ROM_REGION(0xc00,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) + ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) ) + + ROM_REGION(0x400, "kmcu", 0) + ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) + ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) + + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) + + ROM_REGION(0x20000,"maincpu",0) + /* Should these roms really be split like this? according to the unofficial apple rom list, IIgs ROM00 was on one rom labeled 342-0077-A */ + ROM_LOAD("rom0a.bin", 0x0000, 0x8000, CRC(9cc78238) SHA1(0ea82e10720a01b68722ab7d9f66efec672a44d3)) + ROM_LOAD("rom0b.bin", 0x8000, 0x8000, CRC(8baf2a79) SHA1(91beeb11827932fe10475252d8036a63a2edbb1c)) + ROM_LOAD("rom0c.bin", 0x10000, 0x8000, CRC(94c32caa) SHA1(4806d50d676b06f5213b181693fc1585956b98bb)) + ROM_LOAD("rom0d.bin", 0x18000, 0x8000, CRC(200a15b8) SHA1(0c2890bb169ead63369738bbd5f33b869f24c42a)) + + ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) + + // temporary: use IIe enhanced keyboard decode ROM + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +ROM_START(apple2gsr0p) // 6/19/1986 Cortland prototype + ROM_REGION(0xc00,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) + ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) ) + + ROM_REGION(0x400, "kmcu", 0) + ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) + ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) + + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) + + ROM_REGION(0x20000,"maincpu",0) + ROM_LOAD( "rombf.bin", 0x000000, 0x020000, CRC(ab04fedf) SHA1(977589a17553956d583a21020080a39dd396df5c) ) + + ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) + + // temporary: use IIe enhanced keyboard decode ROM + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +ROM_START(apple2gsr0p2) // 3/10/1986 Cortland prototype, boots as "Apple //'ing - Alpha 2.0" + ROM_REGION(0xc00,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) + ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) ) + + ROM_REGION(0x400, "kmcu", 0) + ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) + ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) + + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) + + ROM_REGION(0x20000,"maincpu",0) + ROM_LOAD( "apple iigs alpha rom 2.0 19860310.bin", 0x000000, 0x020000, CRC(a47d275f) SHA1(c5836adcfc8be69c7351b84afa94c814e8d92b81) ) + + ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) + + // temporary: use IIe enhanced keyboard decode ROM + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1989, apple2gs, 0, apple2, apple2gs, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03)", MACHINE_SUPPORTS_SAVE ) +COMP( 198?, apple2gsr3p, apple2gs, 0, apple2gs, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03 prototype)", MACHINE_NOT_WORKING ) +COMP( 1989, apple2gsr3lp, apple2gs, 0, apple2gs, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03 late prototype?)", MACHINE_NOT_WORKING ) +COMP( 1987, apple2gsr1, apple2gs, 0, apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM01)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, apple2gsr0, apple2gs, 0, apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM00)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, apple2gsr0p,apple2gs, 0, apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM00 prototype 6/19/1986)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, apple2gsr0p2,apple2gs,0, apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM00 prototype 3/10/1986)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/apple3.c b/src/mame/drivers/apple3.c new file mode 100644 index 00000000000..22c27441640 --- /dev/null +++ b/src/mame/drivers/apple3.c @@ -0,0 +1,349 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,R. Belmont +/*************************************************************************** + + drivers/apple3.c + + Apple /// + + driver by Nathan Woods and R. Belmont + + Special thanks to Chris Smolinski (author of the Sara emulator) + for his input about this poorly known system. + + Also thanks to Washington Apple Pi for the "Apple III DVD" containing the + technical manual, schematics, and software. + +***************************************************************************/ + +#include "emu.h" +#include "bus/rs232/rs232.h" +#include "includes/apple3.h" +#include "includes/apple2.h" +#include "formats/ap2_dsk.h" + +#include "bus/a2bus/a2cffa.h" +#include "bus/a2bus/a2applicard.h" +#include "bus/a2bus/a2thunderclock.h" +#include "bus/a2bus/mouse.h" + +static ADDRESS_MAP_START( apple3_map, AS_PROGRAM, 8, apple3_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(apple3_memory_r, apple3_memory_w) +ADDRESS_MAP_END + +static SLOT_INTERFACE_START(apple3_cards) + SLOT_INTERFACE("cffa2", A2BUS_CFFA2_6502) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */ + SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */ + SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK) /* ThunderWare ThunderClock Plus - driver assumes slot 2 by default */ + SLOT_INTERFACE("mouse", A2BUS_MOUSE) /* Apple II Mouse Card */ +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( a3_floppies ) + SLOT_INTERFACE( "525", FLOPPY_525_SD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( apple3_state::floppy_formats ) + FLOPPY_A216S_FORMAT, FLOPPY_RWTS18_FORMAT, FLOPPY_EDD_FORMAT +FLOPPY_FORMATS_END + +static MACHINE_CONFIG_START( apple3, apple3_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 2000000) /* 2 MHz */ + MCFG_M6502_SYNC_CALLBACK(WRITELINE(apple3_state, apple3_sync_w)) + MCFG_CPU_PROGRAM_MAP(apple3_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_RESET_OVERRIDE(apple3_state, apple3 ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(280*2, 224) + MCFG_SCREEN_VISIBLE_AREA(0, (280*2)-1,0,192-1) + MCFG_SCREEN_UPDATE_DRIVER(apple3_state, screen_update_apple3) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 32) + MCFG_PALETTE_INIT_OWNER(apple3_state, apple3 ) + + MCFG_VIDEO_START_OVERRIDE(apple3_state, apple3 ) + + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple3_state, apple3_interrupt, "screen", 0, 1) + + /* keyboard controller */ + MCFG_DEVICE_ADD("ay3600", AY3600, 0) + MCFG_AY3600_MATRIX_X0(IOPORT("X0")) + MCFG_AY3600_MATRIX_X1(IOPORT("X1")) + MCFG_AY3600_MATRIX_X2(IOPORT("X2")) + MCFG_AY3600_MATRIX_X3(IOPORT("X3")) + MCFG_AY3600_MATRIX_X4(IOPORT("X4")) + MCFG_AY3600_MATRIX_X5(IOPORT("X5")) + MCFG_AY3600_MATRIX_X6(IOPORT("X6")) + MCFG_AY3600_MATRIX_X7(IOPORT("X7")) + MCFG_AY3600_MATRIX_X8(IOPORT("X8")) + MCFG_AY3600_SHIFT_CB(READLINE(apple3_state, ay3600_shift_r)) + MCFG_AY3600_CONTROL_CB(READLINE(apple3_state, ay3600_control_r)) + MCFG_AY3600_DATA_READY_CB(WRITELINE(apple3_state, ay3600_data_ready_w)) + + /* slot bus */ + MCFG_DEVICE_ADD("a2bus", A2BUS, 0) + MCFG_A2BUS_CPU("maincpu") + MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(apple3_state, a2bus_irq_w)) + MCFG_A2BUS_OUT_NMI_CB(WRITELINE(apple3_state, a2bus_nmi_w)) + //MCFG_A2BUS_OUT_INH_CB(WRITELINE(apple3_state, a2bus_inh_w)) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl1", apple3_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl2", apple3_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl3", apple3_cards, NULL) + MCFG_A2BUS_SLOT_ADD("a2bus", "sl4", apple3_cards, NULL) + + /* fdc */ + MCFG_DEVICE_ADD("fdc", APPLEIII_FDC, 1021800*2) + MCFG_FLOPPY_DRIVE_ADD("0", a3_floppies, "525", apple3_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("1", a3_floppies, "525", apple3_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("2", a3_floppies, "525", apple3_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("3", a3_floppies, "525", apple3_state::floppy_formats) + + /* softlist for fdc */ + MCFG_SOFTWARE_LIST_ADD("flop525_list","apple3") + + /* acia */ + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) // HACK: The schematic shows an external clock generator but using a XTAL is faster to emulate. + MCFG_MOS6551_IRQ_HANDLER(WRITELINE(apple3_state, apple3_acia_irq_func)) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) + // TODO: remove cts kludge from machine/apple3.c and come up with a good way of coping with pull up resistors. + + /* paddle */ + MCFG_TIMER_DRIVER_ADD("pdltimer", apple3_state, paddle_timer); + + /* rtc */ + MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz) + + /* via */ + MCFG_DEVICE_ADD("via6522_0", VIA6522, 2000000) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(apple3_state, apple3_via_0_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(apple3_state, apple3_via_0_out_b)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(apple3_state, apple3_via_0_irq_func)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 2000000) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(apple3_state, apple3_via_1_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(apple3_state, apple3_via_1_out_b)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(apple3_state, apple3_via_1_irq_func)) + + /* sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_ADD(DAC_TAG, DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_TIMER_DRIVER_ADD_PERIODIC("c040", apple3_state, apple3_c040_tick, attotime::from_hz(2000)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + MCFG_RAM_EXTRA_OPTIONS("128K, 512K") +MACHINE_CONFIG_END + + +static INPUT_PORTS_START( apple3 ) + /* + KB3600 Keyboard matrix (KB3600 has custom layout mask ROM, Apple p/n 341-0035) + + | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | + | | | | | | | | | | | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X0 | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X1 | TAB | Q | W | E | R | T | Y | U | I | O | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X2 | A | S | D | F | H | G | J | K | ;: | L | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X3 | Z | X | C | V | B | N | M | <, | >. | ?/ | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X4 | | KP9 | | KP8 | | KP7 | \| | += | 0 | -_ | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X5 | | KP6 | | KP5 | | KP4 | `~ | ]} | P | [{ | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X6 | | KP3 | KP. | KP2 | KP0 | KP1 |RETRN| UP |BACKS| '" | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X7 | | |KPENT|SPACE| | KP- |RIGHT|DOWN |LEFT | | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + */ + +/* + Esc + 0x00 + + ` 1 2 3 4 5 6 7 8 9 0 - = BACKSPACE + 0x38 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x30 0x31 0x2f 0x104 + + Tab Q W E R T Y U I O P [ ] \ + 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x3a 0x3b 0x39 0x2e + + A S D F G H J K L ; ' ENTER + 0x14 0x15 0x16 0x17 0x19 0x18 0x1a 0x1b 0x1d 0x1c 0x105 0x102 + + Z X C V B N M , . / + 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 + + SPACE UP LT DN RT KP- KP7 KP8 KP9 + 0x109 0x103 0x10e 0x10d 0x10c 0x10b 0x2d 0x2b 0x29 + + KP4 KP5 KP6 KP1 KP2 KP3 KPEN KP0 KP. + 0x37 0x35 0x33 0x101 0x3f 0x3d 0x108 0x100 0x3e +*/ + PORT_START("X0") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("X1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("X2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + + PORT_START("X3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("X4") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + + PORT_START("X5") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + + PORT_START("X6") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + + PORT_START("X7") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("X8") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyb_special") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) + + PORT_START("joy_1_x") /* Joystick 1 X Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("P1 Joystick X") + PORT_MINMAX(0, 0xff) PORT_PLAYER(1) + + PORT_START("joy_1_y") /* Joystick 1 Y Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("P1 Joystick Y") + PORT_MINMAX(0,0xff) PORT_PLAYER(1) + + PORT_START("joy_2_x") /* Joystick 2 X Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("P2 Joystick X") + PORT_MINMAX(0,0xff) PORT_PLAYER(2) + + PORT_START("joy_2_y") /* Joystick 2 Y Axis */ + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("P2 Joystick Y") + PORT_MINMAX(0,0xff) PORT_PLAYER(2) + + PORT_START("joy_buttons") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_NAME("Joystick 1 Button 1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_NAME("Joystick 1 Button 2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_NAME("Joystick 2 Button 1") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) PORT_NAME("Joystick 2 Button 2") +INPUT_PORTS_END + +ROM_START(apple3) + ROM_REGION(0x1000,"maincpu",0) + ROM_LOAD( "apple3.rom", 0x0000, 0x1000, CRC(55e8eec9) SHA1(579ee4cd2b208d62915a0aa482ddc2744ff5e967)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1980, apple3, 0, 0, apple3, apple3, apple3_state, apple3, "Apple Computer", "Apple ///", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/applix.c b/src/mame/drivers/applix.c new file mode 100644 index 00000000000..2b5097470ee --- /dev/null +++ b/src/mame/drivers/applix.c @@ -0,0 +1,1104 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Applix 1616 computer + + See for docs: http;//www.microbee-mspp.org.au + + First revealed to the world in December 1986 issue of Electronics Today + International (ETI) an Australian electronics magazine which is now defunct. + + The main articles appeared in ETI February/March/April 1987, followed by + other articles in various issues after that. + + Current Status: + After 60 seconds, boots to the ramdisk. You can enter commands. + If you have a floppy mounted, it will boot from the disk. + + The system could support 1 or 2 5.25 or 3.5 floppy drives, although 3.5 + was the recommended hardware. Format is similar to the PC 720kb, except + it has 5 sectors of 1024 bytes, giving 800kb total. We only support the + 3.5-sized disks. + + TODO: + - Cassette interface (coded but not working) + - Use kbtro device (tried and failed) + - Optional serial device Z8530 Z80SCC + - Optional SCSI controller NCR5380 and hard drive (max 40mb) + - Joystick + - Audio: it could be better + - DAC output is used to compare against analog inputs; core doesn't permit + audio outputs to be used for non-speaker purposes. + - Bios 5 crashes mess after scrolling about half a screen + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "cpu/z80/z80.h" +#include "cpu/mcs51/mcs51.h" +#include "video/mc6845.h" +#include "machine/6522via.h" +#include "sound/dac.h" +#include "sound/wave.h" +#include "machine/wd_fdc.h" +#include "formats/applix_dsk.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" + + + +class applix_state : public driver_device +{ +public: + applix_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_base(*this, "base"), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "crtc"), + m_via(*this, "via6522"), + m_centronics(*this, "centronics"), + m_cent_data_out(*this, "cent_data_out"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_dacl(*this, "dacl"), + m_dacr(*this, "dacr"), + m_cass(*this, "cassette"), + m_io_dsw(*this, "DSW"), + m_io_fdc(*this, "FDC"), + m_io_k0f(*this, "K0f"), + m_io_k300(*this, "K30_0"), + m_io_k301(*this, "K30_1"), + m_io_k310(*this, "K31_0"), + m_io_k311(*this, "K31_1"), + m_io_k320(*this, "K32_0"), + m_io_k321(*this, "K32_1"), + m_io_k330(*this, "K33_0"), + m_io_k331(*this, "K33_1"), + m_io_k340(*this, "K34_0"), + m_io_k341(*this, "K34_1"), + m_io_k350(*this, "K35_0"), + m_io_k351(*this, "K35_1"), + m_io_k360(*this, "K36_0"), + m_io_k361(*this, "K36_1"), + m_io_k370(*this, "K37_0"), + m_io_k371(*this, "K37_1"), + m_io_k380(*this, "K38_0"), + m_io_k390(*this, "K39_0"), + m_io_k3a0(*this, "K3a_0"), + m_io_k3b0(*this, "K3b_0"), + m_io_k0b(*this, "K0b"), + m_expansion(*this, "expansion"), + m_palette(*this, "palette"){ } + + DECLARE_READ16_MEMBER(applix_inputs_r); + DECLARE_WRITE16_MEMBER(palette_w); + DECLARE_WRITE16_MEMBER(analog_latch_w); + DECLARE_WRITE16_MEMBER(dac_latch_w); + DECLARE_WRITE16_MEMBER(video_latch_w); + DECLARE_READ8_MEMBER(applix_pb_r); + DECLARE_WRITE8_MEMBER(applix_pa_w); + DECLARE_WRITE8_MEMBER(applix_pb_w); + DECLARE_WRITE_LINE_MEMBER(vsync_w); + DECLARE_READ8_MEMBER(port00_r); + DECLARE_READ8_MEMBER(port08_r); + DECLARE_READ8_MEMBER(port10_r); + DECLARE_READ8_MEMBER(port18_r); + DECLARE_READ8_MEMBER(port20_r); + DECLARE_READ8_MEMBER(port60_r); + DECLARE_WRITE8_MEMBER(port08_w); + DECLARE_WRITE8_MEMBER(port10_w); + DECLARE_WRITE8_MEMBER(port18_w); + DECLARE_WRITE8_MEMBER(port20_w); + DECLARE_WRITE8_MEMBER(port60_w); + DECLARE_READ16_MEMBER(fdc_data_r); + DECLARE_READ16_MEMBER(fdc_stat_r); + DECLARE_WRITE16_MEMBER(fdc_data_w); + DECLARE_WRITE16_MEMBER(fdc_cmd_w); + DECLARE_WRITE_LINE_MEMBER(kbd_clock_w); + DECLARE_WRITE_LINE_MEMBER(kbd_data_w); + DECLARE_FLOPPY_FORMATS(floppy_formats); + DECLARE_READ8_MEMBER( internal_data_read ); + DECLARE_WRITE8_MEMBER( internal_data_write ); + DECLARE_READ8_MEMBER( p1_read ); + DECLARE_WRITE8_MEMBER( p1_write ); + DECLARE_READ8_MEMBER( p2_read ); + DECLARE_WRITE8_MEMBER( p2_write ); + DECLARE_READ8_MEMBER( p3_read ); + DECLARE_WRITE8_MEMBER( p3_write ); + TIMER_DEVICE_CALLBACK_MEMBER(cass_timer); + DECLARE_DRIVER_INIT(applix); + MC6845_UPDATE_ROW(crtc_update_row); + UINT8 m_video_latch; + UINT8 m_pa; + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(applix); + UINT8 m_palette_latch[4]; + required_shared_ptr m_base; +private: + UINT8 m_pb; + UINT8 m_analog_latch; + UINT8 m_dac_latch; + UINT8 m_port08; + UINT8 m_data_to_fdc; + UINT8 m_data_from_fdc; + bool m_data; + bool m_data_or_cmd; + bool m_buffer_empty; + bool m_fdc_cmd; + UINT8 m_clock_count; + bool m_cp; + UINT8 m_p1; + UINT8 m_p1_data; + UINT8 m_p2; + UINT8 m_p3; + UINT16 m_last_write_addr; + UINT8 m_cass_data[4]; + int m_centronics_busy; + required_device m_maincpu; + required_device m_crtc; + required_device m_via; + required_device m_centronics; + required_device m_cent_data_out; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_dacl; + required_device m_dacr; + required_device m_cass; + required_ioport m_io_dsw; + required_ioport m_io_fdc; + required_ioport m_io_k0f; + required_ioport m_io_k300; + required_ioport m_io_k301; + required_ioport m_io_k310; + required_ioport m_io_k311; + required_ioport m_io_k320; + required_ioport m_io_k321; + required_ioport m_io_k330; + required_ioport m_io_k331; + required_ioport m_io_k340; + required_ioport m_io_k341; + required_ioport m_io_k350; + required_ioport m_io_k351; + required_ioport m_io_k360; + required_ioport m_io_k361; + required_ioport m_io_k370; + required_ioport m_io_k371; + required_ioport m_io_k380; + required_ioport m_io_k390; + required_ioport m_io_k3a0; + required_ioport m_io_k3b0; + required_ioport m_io_k0b; + required_shared_ptr m_expansion; +public: + required_device m_palette; +}; + +/* +d0,1,2 = joystick +d3 = cassette LED, low=on +d4,5,6 = audio select +d7 = cassette relay, low=on +*/ +WRITE16_MEMBER( applix_state::analog_latch_w ) +{ + data &= 0xff; + if (data != m_analog_latch) + { + m_cass->change_state( + (BIT(data,7)) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + + m_analog_latch = data; + } +} + +WRITE16_MEMBER( applix_state::dac_latch_w ) +{ + data &= 0xff; + m_dac_latch = data; + + if ((m_analog_latch & 0x70) == 0) // right + m_dacr->write_unsigned8(m_dac_latch); + else + if ((m_analog_latch & 0x70) == 0x10) // left + m_dacl->write_unsigned8(m_dac_latch); +} + +//cent = odd, video = even +WRITE16_MEMBER( applix_state::palette_w ) +{ + offset >>= 4; + if (ACCESSING_BITS_0_7) + { + m_cent_data_out->write(space, 0, data); + } + else + m_palette_latch[offset] = (data >> 8) & 15; +} + +WRITE16_MEMBER( applix_state::video_latch_w ) +{ + if (ACCESSING_BITS_0_7) + m_video_latch = data; +} + +/* +d0 = dac output + external signal = analog input +d1 = cassette in +d2,3 = joystick in +d4-7 = SW2 dipswitch block +*/ +READ16_MEMBER( applix_state::applix_inputs_r ) +{ + return m_io_dsw->read() | m_cass_data[2]; +} + +READ8_MEMBER( applix_state::applix_pb_r ) +{ + return m_pb; +} + +/* +d0 = /(in) printer busy signal +d1 = /(out) printer strobe +d2 = /(out) enable cassette write IRQ +d3 = (out) H = 640 video mode +d4 = /(out) enable cassette read IRQ +d5 = /(out) clear cass IRQ and output line +d6 = /(out) reset keyboard by pulling kbd clock low +d7 = /(out) reset keyboard flipflop +*/ +WRITE8_MEMBER( applix_state::applix_pa_w ) +{ + // Reset flipflop counter + if (!BIT(data, 7)) + m_clock_count = 0; + + // Reset keyboard + if (!BIT(data, 6)) + { + m_p3 = 0xff; + m_last_write_addr = 0; + } + m_cass->output(BIT(data, 5) ? -1.0 : +1.0); + + // high-to-low of PA5 when reading cassette - /PRE on IC32b + if (BIT(m_pa, 5) && !BIT(data, 5) && !BIT(data, 4)) + m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); + + // low-to-high of PA2 when writing cassette - /PRE on IC49 + if (!BIT(m_pa, 2) && BIT(data, 2)) + m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); + + m_centronics->write_strobe(BIT(data, 1)); + + m_pa = data; +} + +/* +d0-6 = user +d7 = square wave output for cassette IRQ +*/ +WRITE8_MEMBER( applix_state::applix_pb_w ) +{ + // low-to-high of PB7 when writing cassette - CLK on IC49 + if (!BIT(m_pb, 7) && BIT(data, 7)) + if (!BIT(m_pa, 2)) + m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); + + m_pb = data; +} + +/* +d0 = H if 68000 sent a command +d1 = H if 68000 sent a byte +d2 = H if 68000 has read last byte +d3 = test switch +*/ +READ8_MEMBER( applix_state::port00_r ) +{ + return (UINT8)m_data_or_cmd | ((UINT8)m_data << 1) | ((UINT8)m_buffer_empty << 2) | m_io_fdc->read(); +} + +/* +d0 = /RDY +d1 = /DISC CHANGE +d2 = DS0 +d3 = DS1 +d4 = MOTORON +d5 = SIDE +d6 = BANK +d7 = MAP +*/ +READ8_MEMBER( applix_state::port08_r ) +{ + return m_port08 | 3; +} + +/* +d0 = /INUSE +d1 = /EJECT +d2-7 same as for port08_r +*/ +WRITE8_MEMBER( applix_state::port08_w ) +{ + m_port08 = data; + membank("bank1")->set_entry(BIT(data, 6)); + + floppy_image_device *floppy = NULL; + if (BIT(data, 2)) floppy = m_floppy0->get_device(); + if (BIT(data, 3)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 5)); + } +} + +READ8_MEMBER( applix_state::port10_r ) +{ + return 0; +} + +WRITE8_MEMBER( applix_state::port10_w ) +{ +} + +READ8_MEMBER( applix_state::port18_r ) +{ + m_data = 0; + return m_data_to_fdc; +} + +WRITE8_MEMBER( applix_state::port18_w ) +{ + m_data_from_fdc = data; + m_buffer_empty = 0; + m_fdc_cmd = BIT(offset, 2); +} + +READ8_MEMBER( applix_state::port20_r ) +{ + return 0; +} + +WRITE8_MEMBER( applix_state::port20_w ) +{ +} + +READ8_MEMBER( applix_state::port60_r ) +{ + return 0; +} + +WRITE8_MEMBER( applix_state::port60_w ) +{ +} + +READ16_MEMBER( applix_state::fdc_stat_r ) +{ + UINT8 data = 0; + switch (offset) + { + case 0: data = (UINT8)m_buffer_empty^1; break; + case 1: data = (UINT8)m_data^1; break; + default: data = (UINT8)m_fdc_cmd; // case 2 + } + return data << 7; +} + +READ16_MEMBER( applix_state::fdc_data_r ) +{ + m_buffer_empty = 1; + return m_data_from_fdc; +} + +WRITE16_MEMBER( applix_state::fdc_data_w ) +{ + m_data_to_fdc = data; + m_data = 1; + m_data_or_cmd = 0; +} + +WRITE16_MEMBER( applix_state::fdc_cmd_w ) +{ + m_data_to_fdc = data; + m_data = 1; + m_data_or_cmd = 1; +} + +static ADDRESS_MAP_START(applix_mem, AS_PROGRAM, 16, applix_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xffffff) + AM_RANGE(0x000000, 0x3fffff) AM_RAM AM_SHARE("expansion") // Expansion + AM_RANGE(0x400000, 0x47ffff) AM_RAM AM_MIRROR(0x80000) AM_SHARE("base") // Main ram + AM_RANGE(0x500000, 0x51ffff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x600000, 0x60007f) AM_WRITE(palette_w) + AM_RANGE(0x600080, 0x6000ff) AM_WRITE(dac_latch_w) + AM_RANGE(0x600100, 0x60017f) AM_WRITE(video_latch_w) //video latch (=border colour, high nybble; video base, low nybble) (odd) + AM_RANGE(0x600180, 0x6001ff) AM_WRITE(analog_latch_w) + //AM_RANGE(0x700000, 0x700007) z80-scc (ch b control, ch b data, ch a control, ch a data) on even addresses + AM_RANGE(0x700080, 0x7000ff) AM_READ(applix_inputs_r) + AM_RANGE(0x700100, 0x70011f) AM_MIRROR(0x60) AM_DEVREADWRITE8("via6522", via6522_device, read, write, 0xff00) + AM_RANGE(0x700180, 0x700181) AM_MIRROR(0x7c) AM_DEVREADWRITE8("crtc", mc6845_device, status_r, address_w, 0xff00) + AM_RANGE(0x700182, 0x700183) AM_MIRROR(0x7c) AM_DEVREADWRITE8("crtc", mc6845_device, register_r, register_w, 0xff00) + AM_RANGE(0xffffc0, 0xffffc1) AM_READWRITE(fdc_data_r,fdc_data_w) + //AM_RANGE(0xffffc2, 0xffffc3) AM_READWRITE(fdc_int_r,fdc_int_w) // optional + AM_RANGE(0xffffc8, 0xffffcd) AM_READ(fdc_stat_r) + AM_RANGE(0xffffd0, 0xffffd1) AM_WRITE(fdc_cmd_w) + //600000, 6FFFFF io ports and latches + //700000, 7FFFFF peripheral chips and devices + //800000, FFC000 optional roms + //FFFFC0, FFFFFF disk controller board +ADDRESS_MAP_END + +static ADDRESS_MAP_START( subcpu_mem, AS_PROGRAM, 8, applix_state ) + AM_RANGE(0x0000, 0x5fff) AM_ROM + AM_RANGE(0x6000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( subcpu_io, AS_IO, 8, applix_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x07) AM_READ(port00_r) //PORTR + AM_RANGE(0x08, 0x0f) AM_READWRITE(port08_r,port08_w) //Disk select + AM_RANGE(0x10, 0x17) AM_READWRITE(port10_r,port10_w) //IRQ + AM_RANGE(0x18, 0x1f) AM_READWRITE(port18_r,port18_w) //data&command + AM_RANGE(0x20, 0x27) AM_MIRROR(0x18) AM_READWRITE(port20_r,port20_w) //SCSI NCR5380 + AM_RANGE(0x40, 0x43) AM_MIRROR(0x1c) AM_DEVREADWRITE("fdc", wd1772_t, read, write) //FDC + AM_RANGE(0x60, 0x63) AM_MIRROR(0x1c) AM_READWRITE(port60_r,port60_w) //anotherZ80SCC +ADDRESS_MAP_END + +static ADDRESS_MAP_START( keytronic_pc3270_program, AS_PROGRAM, 8, applix_state ) + AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("kbdcpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( keytronic_pc3270_io, AS_IO, 8, applix_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(internal_data_read, internal_data_write) + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(p1_read, p1_write) + AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_READWRITE(p2_read, p2_write) + AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_read, p3_write) +ADDRESS_MAP_END + +// io priorities: +// 4 cassette +// 3 scc +// 2 via + +/* Input ports */ +static INPUT_PORTS_START( applix ) + PORT_START( "K0f" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') /* 06 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') /* 05 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* 14 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* 13 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* 22 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* 21 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 (IRMA)") /* 41 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6a?") /* 6a */ + + PORT_START( "K30_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* 31 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* 32 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* 30 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* 2f */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* 2e */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') /* 33 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K30_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) /* 58 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) /* 59 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) /* 5a */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) /* 5b */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) /* 5c */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) /* 5d */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6b?") /* 6b */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 (IRMA)") /* 42 */ + + PORT_START( "K31_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') /* 07 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') /* 08 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* 15 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* 16 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* 23 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* 24 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K31_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) /* 37 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) /* 5f */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("LShift") /* 2a */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<") /* 70 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* 2c */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* 2d */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6c?") /* 6c */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 (IRMA)") /* 43 */ + + PORT_START( "K32_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') /* 0a */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') /* 09 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* 18 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* 17 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* 26 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* 25 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K32_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) /* 57 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) /* 1d */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) /* 71 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_NAME("LAlt") /* 38 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') /* 39 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_NAME("RAlt") /* 38 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?69?") /* 69 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 (IRMA)") /* 40 */ + + PORT_START( "K33_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("KP 2") /* 50 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) PORT_NAME("KP 1") /* 4f */ + PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Down") /* 55 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") /* 75 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K33_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') /* 02 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') /* 29 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* 10 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* 0f */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* 1e */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("Caps") /* 3a */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?68?") /* 68 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 (IRMA)") /* 3f */ + + PORT_START( "K34_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') /* 35 */ + PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) /* 36 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") /* 56 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') /* 34 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K34_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') /* 02 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') /* 03 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* 11 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* 12 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* 1f */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* 20 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?67?") /* 67 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 (IRMA)") /* 3e */ + + PORT_START( "K35_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0b */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') /* 0c */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* 19 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') /* 1a */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') /* 27 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') /* 28 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K35_1" ) + PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?66?") /* 66 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 (IRMA)") /* 3d */ + + PORT_START( "K36_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* 0e */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') /* 0d */ + PORT_BIT( 0x14, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* 1c */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') /* 2b */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') /* 1b */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K36_1" ) + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 (IRMA)") /* 3c */ + + PORT_START( "K37_0" ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA1") /* 7b */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<--") /* 7e */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a\\") /* 7a */ + PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("KP +") /* 4e */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K37_1" ) + PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?64?") /* 64 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 (IRMA)") /* 3b */ + + PORT_START( "K38_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SysReq") /* 54 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) /*PORT_CODE(KEYCODE_SCRLOCK)*/ PORT_NAME("ScrLock") /* 46 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-->|") /* 7c */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("KP 9") /* 49 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("KP -") /* 4a */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("KP 6") /* 4d */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "K39_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") /* 01 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_NAME("NumLock") /* 45 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) PORT_NAME("KP 7") /* 47 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_NAME("KP 8") /* 48 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("KP 4") /* 4b */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("KP 5") /* 4c */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?76?") /* 76 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?63?") /* 63 */ + + PORT_START( "K3a_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PrtSc *") /* 6f */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA2") /* 7f */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right") /* 7d */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a") /* 79 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Center") /* 77 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6e?") /* 6e */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?62?") /* 62 */ + + PORT_START( "K3b_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("KP 3") /* 51 */ + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("KP 0") /* 52 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("KP .") /* 53 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Up") /* 78 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6d?") /* 6d */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 (IRMA)") /* 44 */ + + PORT_START( "K0b" ) + PORT_DIPNAME( 0x01, 0x01, "Protocol selection" ) + PORT_DIPSETTING( 0x00, "Enhanced XT, AT and PS/2 models" ) + PORT_DIPSETTING( 0x01, "Standard PC and XT" ) + PORT_DIPNAME( 0x02, 0x00, "IRMA/Native scan code set" ) + PORT_DIPSETTING( 0x00, "Native scan code set" ) + PORT_DIPSETTING( 0x02, "IRMA Emulation" ) + PORT_DIPNAME( 0x04, 0x04, "Enhanced 101/Native scan code set" ) + PORT_DIPSETTING( 0x00, "Native scan code set" ) + PORT_DIPSETTING( 0x04, "Enhanced 101 scan code set" ) + PORT_DIPNAME( 0x08, 0x08, "Enable E0" ) + PORT_DIPSETTING( 0x00, "Enable E0" ) + PORT_DIPSETTING( 0x08, "Disable E0" ) + PORT_DIPNAME( 0x10, 0x10, "Code tables" ) + PORT_DIPSETTING( 0x00, "U.S. code tables" ) + PORT_DIPSETTING( 0x10, "International code tables" ) + PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x80, 0x80, "Key click" ) + PORT_DIPSETTING( 0x00, "No key click" ) + PORT_DIPSETTING( 0x80, "Key click" ) + + PORT_START("DSW") + PORT_BIT( 0xf, 0, IPT_UNUSED ) + PORT_DIPNAME( 0x10, 0x00, "Switch 0") PORT_DIPLOCATION("SW2:1") + PORT_DIPSETTING( 0x10, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x20, 0x00, "Switch 1") PORT_DIPLOCATION("SW2:2") + PORT_DIPSETTING( 0x20, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x40, 0x00, "Switch 2") PORT_DIPLOCATION("SW2:3") + PORT_DIPSETTING( 0x40, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x80, 0x80, "Switch 3") PORT_DIPLOCATION("SW2:4") + PORT_DIPSETTING( 0x80, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + + PORT_START("FDC") + PORT_BIT( 0xf7, 0, IPT_UNUSED ) + PORT_DIPNAME( 0x08, 0x08, "FDC Test") PORT_DIPLOCATION("SW3:1") + PORT_DIPSETTING( 0x08, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) +INPUT_PORTS_END + + +void applix_state::machine_reset() +{ + UINT8* ROM = memregion("maincpu")->base(); + memcpy(m_expansion, ROM, 8); + membank("bank1")->set_entry(0); + m_p3 = 0xff; + m_last_write_addr = 0; + m_maincpu->reset(); +} + +FLOPPY_FORMATS_MEMBER( applix_state::floppy_formats ) + FLOPPY_APPLIX_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( applix_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + + +PALETTE_INIT_MEMBER(applix_state, applix) +{ // shades need to be verified - the names on the right are from the manual + const UINT8 colors[16*3] = { + 0x00, 0x00, 0x00, // 0 Black + 0x40, 0x40, 0x40, // 1 Dark Grey + 0x00, 0x00, 0x80, // 2 Dark Blue + 0x00, 0x00, 0xff, // 3 Mid Blue + 0x00, 0x80, 0x00, // 4 Dark Green + 0x00, 0xff, 0x00, // 5 Green + 0x00, 0xff, 0xff, // 6 Blue Grey + 0x00, 0x7f, 0x7f, // 7 Light Blue + 0x7f, 0x00, 0x00, // 8 Dark Red + 0xff, 0x00, 0x00, // 9 Red + 0x7f, 0x00, 0x7f, // 10 Dark Violet + 0xff, 0x00, 0xff, // 11 Violet + 0x7f, 0x7f, 0x00, // 12 Brown + 0xff, 0xff, 0x00, // 13 Yellow + 0xbf, 0xbf, 0xbf, // 14 Light Grey + 0xff, 0xff, 0xff }; // 15 White + + UINT8 r, b, g, i, color_count = 0; + + for (i = 0; i < 48; color_count++) + { + r = colors[i++]; g = colors[i++]; b = colors[i++]; + palette.set_pen_color(color_count, rgb_t(r, g, b)); + } +} + + +void applix_state::video_start() +{ +} + +MC6845_UPDATE_ROW( applix_state::crtc_update_row ) +{ +// The display is bitmapped. 2 modes are supported here, 320x200x16 and 640x200x4. +// Need to display a border colour. +// There is a monochrome mode, but no info found as yet. + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 i; + UINT16 chr,x; + UINT32 mem, vidbase = (m_video_latch & 15) << 14, *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + mem = vidbase + ma + x + (ra<<12); + chr = m_base[mem]; + + if (BIT(m_pa, 3)) + // 640 x 200 x 4of16 mode + { + for (i = 0; i < 8; i++) + { + *p++ = palette[m_palette_latch[chr>>14]]; + chr <<= 2; + } + } + else + // 320 x 200 x 16 mode + { + for (i = 0; i < 4; i++) + { + *p++ = palette[chr>>12]; + *p++ = palette[chr>>12]; + chr <<= 4; + } + } + } +} + +WRITE_LINE_MEMBER( applix_state::vsync_w ) +{ + m_via->write_ca2(state); +} + +TIMER_DEVICE_CALLBACK_MEMBER(applix_state::cass_timer) +{ + /* cassette - turn 2500/5000Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_cass_data[2] = ((m_cass_data[1] < 12) ? 2 : 0); + m_cass_data[1] = 0; + // low-to-high transition when reading cassette - CLK on IC32b + if ((cass_ws) && !BIT(m_pa, 4)) + m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); + } +} + +static MACHINE_CONFIG_START( applix, applix_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 7500000) + MCFG_CPU_PROGRAM_MAP(applix_mem) + MCFG_CPU_ADD("subcpu", Z80, XTAL_16MHz / 2) // Z80H + MCFG_CPU_PROGRAM_MAP(subcpu_mem) + MCFG_CPU_IO_MAP(subcpu_io) + MCFG_CPU_ADD("kbdcpu", I8051, 11060250) + MCFG_CPU_PROGRAM_MAP(keytronic_pc3270_program) + MCFG_CPU_IO_MAP(keytronic_pc3270_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(applix_state, applix) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("dacl", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 2.0 ) + MCFG_SOUND_ADD("dacr", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 2.0 ) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) + + /* Devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", 1875000) // 6545 + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(applix_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(applix_state, vsync_w)) + + MCFG_DEVICE_ADD("via6522", VIA6522, 0) + MCFG_VIA6522_READPB_HANDLER(READ8(applix_state, applix_pb_r)) + // in CB1 kbd clk + // in CA2 vsync + // in CB2 kdb data + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(applix_state, applix_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(applix_state, applix_pb_w)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m68000_device, write_irq2)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522", via6522_device, write_ca1)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("via6522", via6522_device, write_pa0)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_WD1772_ADD("fdc", XTAL_16MHz / 2) //connected to Z80H clock pin + MCFG_FLOPPY_DRIVE_ADD("fdc:0", applix_floppies, "35dd", applix_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", applix_floppies, "35dd", applix_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_TIMER_DRIVER_ADD_PERIODIC("applix_c", applix_state, cass_timer, attotime::from_hz(100000)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( applix ) + ROM_REGION16_BE(0x20000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "v4.5a", "V4.5a") + ROMX_LOAD( "1616osl.45a", 0x00000, 0x10000, CRC(9dfb3224) SHA1(5223833a357f90b147f25826c01713269fc1945f), ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD( "1616osh.45a", 0x00001, 0x10000, CRC(951bd441) SHA1(e0a38c8d0d38d84955c1de3f6a7d56ce06b063f6), ROM_SKIP(1) | ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "v4.4a", "V4.4a") + ROMX_LOAD( "1616osl.44a", 0x00000, 0x10000, CRC(4a1a90d3) SHA1(4df504bbf6fc5dad76c29e9657bfa556500420a6), ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD( "1616osh.44a", 0x00001, 0x10000, CRC(ef619994) SHA1(ff16fe9e2c99a1ffc855baf89278a97a2a2e881a), ROM_SKIP(1) | ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "v4.3a", "V4.3a") + ROMX_LOAD( "1616osl.43a", 0x00000, 0x10000, CRC(c09b9ff8) SHA1(c46f2a98470d2d09cf9f9eec0f4096ab762407b5), ROM_SKIP(1) | ROM_BIOS(3) ) + ROMX_LOAD( "1616osh.43a", 0x00001, 0x10000, CRC(071a2505) SHA1(42c4cc6e3e78b6a5320f9d9c858fc9f4e6220857), ROM_SKIP(1) | ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "v4.0c", "V4.0c") + ROMX_LOAD( "1616osl.40c", 0x00000, 0x10000, CRC(6a517b5d) SHA1(e0f4eba0cb8d273ba681b9d2c6d4b1beff9ef325), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "1616osh.40c", 0x00001, 0x10000, CRC(7851651f) SHA1(d7d329aa7fe9f4418de0cdf813b61e70243e0e77), ROM_SKIP(1) | ROM_BIOS(4) ) + ROM_SYSTEM_BIOS(4, "v3.0b", "V3.0b") + ROMX_LOAD( "1616osl.30b", 0x00000, 0x10000, CRC(fb9198c3) SHA1(e0e7a1dd176c1cbed063df1c405821c261d48f3a), ROM_SKIP(1) | ROM_BIOS(5) ) + ROMX_LOAD( "1616osh.30b", 0x00001, 0x10000, CRC(a279e1d7) SHA1(3451b2cae87a9ccee5f579fd1d49cf52d9f97b83), ROM_SKIP(1) | ROM_BIOS(5) ) + ROM_SYSTEM_BIOS(5, "v2.4a", "V2.4a") + ROMX_LOAD( "1616osl.24a", 0x00000, 0x08000, CRC(b155830b) SHA1(b32db6a06c8a3c544210ba9faba7c49497c504fb), ROM_SKIP(1) | ROM_BIOS(6) ) + ROMX_LOAD( "1616osh.24a", 0x00001, 0x08000, CRC(6d9fc0e0) SHA1(07111f46386494ed3f426c1e50308f0209587f06), ROM_SKIP(1) | ROM_BIOS(6) ) + + ROM_REGION(0x18000, "subcpu", 0) + ROM_LOAD( "1616ssdv.022", 0x0000, 0x8000, CRC(6d8e413a) SHA1(fc27d92c34f231345a387b06670f36f8c1705856) ) + + ROM_REGION(0x20000, "user1", 0) + ROM_LOAD( "ssdcromv.22", 0x0000, 0x8000, CRC(c85c47fb) SHA1(6f0bb3753fc0d74ee5901d71d05a74ec6a4a1d05) ) + ROM_LOAD( "ssddromv.14a", 0x8000, 0x8000, CRC(8fe2db78) SHA1(487484003aba4d8960101ced6a689dc81676235d) ) + + ROM_REGION(0x2000, "kbdcpu", 0) + ROM_LOAD( "14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e) ) +ROM_END + + +DRIVER_INIT_MEMBER(applix_state, applix) +{ + UINT8 *RAM = memregion("subcpu")->base(); + membank("bank1")->configure_entries(0, 2, &RAM[0x8000], 0x8000); +} + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, applix, 0, 0, applix, applix, applix_state, applix, "Applix Pty Ltd", "Applix 1616", 0 ) + + + +/**************************************************** KEYBOARD MODULE *****************************************/ + +READ8_MEMBER( applix_state::internal_data_read ) +{ + m_via->write_cb2( BIT(offset, 8) ); // data + bool cp = !BIT(offset, 9); + if (cp != m_cp) + { + m_cp = cp; + if (cp) + m_clock_count++; + } + if (m_clock_count > 2) + m_via->write_cb1( cp ); + + return 0xff; +} + + +WRITE8_MEMBER( applix_state::internal_data_write ) +{ + /* Check for low->high transition on AD8 */ + if ( ! ( m_last_write_addr & 0x0100 ) && ( offset & 0x0100 ) ) + { + switch (m_p1) + { + case 0x0e: + break; + case 0x0f: + m_p1_data = m_io_k0f->read(); + break; + case 0x30: + m_p1_data = m_io_k300->read(); + break; + case 0x31: + m_p1_data = m_io_k310->read(); + break; + case 0x32: + m_p1_data = m_io_k320->read(); + break; + case 0x33: + m_p1_data = m_io_k330->read(); + break; + case 0x34: + m_p1_data = m_io_k340->read(); + break; + case 0x35: + m_p1_data = m_io_k350->read(); + break; + case 0x36: + m_p1_data = m_io_k360->read(); + break; + case 0x37: + m_p1_data = m_io_k370->read() | (m_io_k360->read() & 0x01); + break; + case 0x38: + m_p1_data = m_io_k380->read(); + break; + case 0x39: + m_p1_data = m_io_k390->read(); + break; + case 0x3a: + m_p1_data = m_io_k3a0->read(); + break; + case 0x3b: + m_p1_data = m_io_k3b0->read(); + break; + } + } + + /* Check for low->high transition on AD9 */ + if ( ! ( m_last_write_addr & 0x0200 ) && ( offset & 0x0200 ) ) + { + switch (m_p1) + { + case 0x0b: + m_p1_data = m_io_k0b->read(); + break; + case 0x30: + m_p1_data = m_io_k301->read(); + break; + case 0x31: + m_p1_data = m_io_k311->read(); + break; + case 0x32: + m_p1_data = m_io_k321->read(); + break; + case 0x33: + m_p1_data = m_io_k331->read(); + break; + case 0x34: + m_p1_data = m_io_k341->read(); + break; + case 0x35: + m_p1_data = m_io_k351->read(); + break; + case 0x36: + m_p1_data = m_io_k361->read(); + break; + case 0x37: + m_p1_data = m_io_k371->read(); + break; + case 0x38: + m_p1_data = 0xff; + break; + case 0x39: + m_p1_data = 0xff; + break; + case 0x3a: + m_p1_data = 0xff; + break; + } + } + + m_last_write_addr = offset; +} + + +READ8_MEMBER( applix_state::p1_read ) +{ + return m_p1 & m_p1_data; +} + + +WRITE8_MEMBER( applix_state::p1_write ) +{ + m_p1 = data; +} + + +READ8_MEMBER( applix_state::p2_read ) +{ + return m_p2; +} + + +WRITE8_MEMBER( applix_state::p2_write ) +{ + m_p2 = data; +} + + +READ8_MEMBER( applix_state::p3_read ) +{ + UINT8 data = m_p3; + + data &= ~0x14; + + /* -INT0 signal */ + data |= 4; + + /* T0 signal */ + data |= 0; + + return data; +} + + +WRITE8_MEMBER( applix_state::p3_write ) +{ + m_p3 = data; +} diff --git a/src/mame/drivers/apricot.c b/src/mame/drivers/apricot.c new file mode 100644 index 00000000000..575c2672c02 --- /dev/null +++ b/src/mame/drivers/apricot.c @@ -0,0 +1,509 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + ACT Apricot PC/Xi + + - Error 29 (timer failed) + - Dump of the keyboard MCU ROM needed (can be dumped using test mode) + +***************************************************************************/ + +#include "cpu/i86/i86.h" +#include "cpu/i8089/i8089.h" +#include "machine/ram.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "machine/pic8259.h" +#include "machine/z80dart.h" +#include "machine/wd_fdc.h" +#include "video/mc6845.h" +#include "sound/sn76496.h" +#include "machine/apricotkb_hle.h" +#include "imagedev/flopdrv.h" +#include "formats/apridisk.h" +#include "bus/centronics/ctronics.h" +#include "bus/rs232/rs232.h" +#include "bus/apricot/expansion.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class apricot_state : public driver_device +{ +public: + apricot_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_cpu(*this, "ic91"), + m_iop(*this, "ic71"), + m_ram(*this, RAM_TAG), + m_crtc(*this, "ic30"), + m_ppi(*this, "ic17"), + m_pic(*this, "ic31"), + m_pit(*this, "ic16"), + m_sio(*this, "ic15"), + m_rs232(*this, "rs232"), + m_centronics(*this, "centronics"), + m_fdc(*this, "ic68"), + m_floppy0(*this, "ic68:0"), + m_floppy1(*this, "ic68:1"), + m_palette(*this, "palette"), + m_screen_buffer(*this, "screen_buffer"), + m_data_selector_dtr(1), + m_data_selector_rts(1), + m_video_mode(0), + m_display_on(1), + m_display_enabled(0), + m_centronics_fault(1), + m_centronics_perror(1), + m_bus_locked(0) + { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + DECLARE_WRITE_LINE_MEMBER(i8086_lock_w); + DECLARE_WRITE8_MEMBER(i8089_ca1_w); + DECLARE_WRITE8_MEMBER(i8089_ca2_w); + DECLARE_WRITE8_MEMBER(i8255_portb_w); + DECLARE_READ8_MEMBER(i8255_portc_r); + DECLARE_WRITE8_MEMBER(i8255_portc_w); + DECLARE_WRITE_LINE_MEMBER(timer_out1); + DECLARE_WRITE_LINE_MEMBER(timer_out2); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_READ8_MEMBER(sio_da_r); + DECLARE_READ8_MEMBER(sio_ca_r); + DECLARE_READ8_MEMBER(sio_db_r); + DECLARE_READ8_MEMBER(sio_cb_r); + + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + + DECLARE_WRITE_LINE_MEMBER(apricot_mc6845_de) { m_display_enabled = state; }; + + DECLARE_WRITE_LINE_MEMBER(data_selector_dtr_w) { m_data_selector_dtr = state; }; + DECLARE_WRITE_LINE_MEMBER(data_selector_rts_w) { m_data_selector_rts = state; }; + + MC6845_UPDATE_ROW(crtc_update_row); + UINT32 screen_update_apricot(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +protected: + virtual void machine_start(); + +private: + required_device m_cpu; + required_device m_iop; + required_device m_ram; + required_device m_crtc; + required_device m_ppi; + required_device m_pic; + required_device m_pit; + required_device m_sio; + required_device m_rs232; + required_device m_centronics; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_palette; + required_shared_ptr m_screen_buffer; + + int m_data_selector_dtr; + int m_data_selector_rts; + + bool m_video_mode; + bool m_display_on; + + int m_display_enabled; + + int m_centronics_fault; + int m_centronics_perror; + + int m_bus_locked; +}; + + +//************************************************************************** +// I/O +//************************************************************************** + +WRITE8_MEMBER( apricot_state::i8089_ca1_w ) +{ + m_iop->sel_w(0); + m_iop->ca_w(1); + m_iop->ca_w(0); +} + +WRITE8_MEMBER( apricot_state::i8089_ca2_w ) +{ + m_iop->sel_w(1); + m_iop->ca_w(1); + m_iop->ca_w(0); +} + +WRITE_LINE_MEMBER( apricot_state::write_centronics_fault ) +{ + m_centronics_fault = state; + m_sio->syncb_w(state); + m_ppi->pc2_w(state); +} + +WRITE_LINE_MEMBER( apricot_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +READ8_MEMBER( apricot_state::i8255_portc_r ) +{ + UINT8 data = 0; + + data |= m_centronics_perror << 0; + // schematic page 294 says pc1 is centronics pin 34, which is n/c. + data |= m_centronics_fault << 2; + data |= m_display_enabled << 3; + + return data; +} + +WRITE8_MEMBER( apricot_state::i8255_portb_w ) +{ + // bit 0, crt reset + // bit 1, not connected + + m_display_on = BIT(data, 3); + m_video_mode = BIT(data, 4); + + floppy_image_device *floppy = NULL; + + // bit 5, enable disk select + // bit 6, disk select + if (!BIT(data, 5)) + floppy = BIT(data, 6) ? m_floppy1->get_device() : m_floppy0->get_device(); + + m_fdc->set_floppy(floppy); + + // bit 2, head load (motor on is wired to be active once a disk has been inserted) + // we just let the motor run all the time for now + if (floppy) + floppy->mon_w(0); + + // switch video modes + m_crtc->set_clock(m_video_mode ? XTAL_15MHz / 10 : XTAL_15MHz / 16); + m_crtc->set_hpixels_per_column(m_video_mode ? 10 : 16); + + // PB7 Centronics transceiver direction. 0 = output, 1 = input +} + +WRITE8_MEMBER( apricot_state::i8255_portc_w ) +{ +// schematic page 294 says pc4 outputs to centronics pin 13, which is the "select" output from the printer. + m_centronics->write_strobe(BIT(data, 5)); +// schematic page 294 says pc6 outputs to centronics pin 15, which is unused +} + +WRITE_LINE_MEMBER( apricot_state::timer_out1 ) +{ + // receive clock via timer 1 + if (m_data_selector_rts == 0 && m_data_selector_dtr == 0) + m_sio->rxca_w(state); +} + +WRITE_LINE_MEMBER( apricot_state::timer_out2 ) +{ + // transmit clock via timer 2 + if (m_data_selector_rts == 0 && m_data_selector_dtr == 0) + m_sio->txca_w(state); + + // transmit and receive clock via timer 2 + if (m_data_selector_rts == 1 && m_data_selector_dtr == 0) + { + m_sio->txca_w(state); + m_sio->rxca_w(state); + } +} + +READ8_MEMBER( apricot_state::sio_da_r ) +{ + if (m_bus_locked) + return m_sio->m1_r(); + + return m_sio->da_r(space, offset); +} + +READ8_MEMBER( apricot_state::sio_ca_r ) +{ + if (m_bus_locked) + return m_sio->m1_r(); + + return m_sio->ca_r(space, offset); +} + +READ8_MEMBER( apricot_state::sio_cb_r ) +{ + if (m_bus_locked) + return m_sio->m1_r(); + + return m_sio->cb_r(space, offset); +} + +READ8_MEMBER( apricot_state::sio_db_r ) +{ + if (m_bus_locked) + return m_sio->m1_r(); + + return m_sio->db_r(space, offset); +} + + +//************************************************************************** +// FLOPPY +//************************************************************************** + +WRITE_LINE_MEMBER( apricot_state::fdc_intrq_w ) +{ + m_pic->ir4_w(state); + m_iop->ext1_w(state); +} + +FLOPPY_FORMATS_MEMBER( apricot_state::floppy_formats ) + FLOPPY_APRIDISK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( apricot_floppies ) + SLOT_INTERFACE("d31v", SONY_OA_D31V) + SLOT_INTERFACE("d32w", SONY_OA_D32W) +SLOT_INTERFACE_END + + +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +UINT32 apricot_state::screen_update_apricot(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (!m_display_on) + m_crtc->screen_update(screen, bitmap, cliprect); + else + bitmap.fill(rgb_t::black, cliprect); + + return 0; +} + +MC6845_UPDATE_ROW( apricot_state::crtc_update_row ) +{ + const pen_t *pen = m_palette->pens(); + + for (int i = 0; i < x_count; i++) + { + UINT16 code = m_screen_buffer[(ma + i) & 0x7ff]; + UINT16 offset = ((code & 0x7ff) << 5) | (ra << 1); + UINT16 data = m_cpu->space(AS_PROGRAM).read_word(offset); + + if (m_video_mode) + { + int fill = 0; + + if (i == cursor_x) fill = 1; // cursor? + if (BIT(code, 12) && BIT(data, 14)) fill = 1; // strike-through? + if (BIT(code, 13) && BIT(data, 15)) fill = 1; // underline? + + // draw 10 pixels of the character + for (int x = 0; x <= 10; x++) + { + int color = fill ? 1 : BIT(data, x); + if (BIT(code, 15)) color = !color; // reverse? + bitmap.pix32(y, x + i*10) = pen[color ? 1 + BIT(code, 14) : 0]; + } + } + else + { + // draw 16 pixels of the cell + for (int x = 0; x <= 16; x++) + bitmap.pix32(y, x + i*16) = pen[BIT(data, x)]; + } + } +} + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void apricot_state::machine_start() +{ + membank("ram")->set_base(m_ram->pointer()); +} + +WRITE_LINE_MEMBER( apricot_state::i8086_lock_w ) +{ + m_bus_locked = state; +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( apricot_mem, AS_PROGRAM, 16, apricot_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAMBANK("ram") + AM_RANGE(0xf0000, 0xf0fff) AM_MIRROR(0x7000) AM_RAM AM_SHARE("screen_buffer") + AM_RANGE(0xfc000, 0xfffff) AM_MIRROR(0x4000) AM_ROM AM_REGION("bootstrap", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( apricot_io, AS_IO, 16, apricot_state ) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8("ic31", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x40, 0x47) AM_DEVREADWRITE8("ic68", wd2797_t, read, write, 0x00ff) + AM_RANGE(0x48, 0x4f) AM_DEVREADWRITE8("ic17", i8255_device, read, write, 0x00ff) + AM_RANGE(0x50, 0x51) AM_MIRROR(0x06) AM_DEVWRITE8("ic7", sn76489_device, write, 0x00ff) + AM_RANGE(0x58, 0x5f) AM_DEVREADWRITE8("ic16", pit8253_device, read, write, 0x00ff) + AM_RANGE(0x60, 0x61) AM_READ8(sio_da_r, 0x00ff) AM_DEVWRITE8("ic15", z80sio0_device, da_w, 0x00ff) + AM_RANGE(0x62, 0x63) AM_READ8(sio_ca_r, 0x00ff) AM_DEVWRITE8("ic15", z80sio0_device, ca_w, 0x00ff) + AM_RANGE(0x64, 0x65) AM_READ8(sio_db_r, 0x00ff) AM_DEVWRITE8("ic15", z80sio0_device, db_w, 0x00ff) + AM_RANGE(0x66, 0x67) AM_READ8(sio_cb_r, 0x00ff) AM_DEVWRITE8("ic15", z80sio0_device, cb_w, 0x00ff) + AM_RANGE(0x68, 0x69) AM_MIRROR(0x04) AM_DEVWRITE8("ic30", mc6845_device, address_w, 0x00ff) + AM_RANGE(0x6a, 0x6b) AM_MIRROR(0x04) AM_DEVREADWRITE8("ic30", mc6845_device, register_r, register_w, 0x00ff) + AM_RANGE(0x70, 0x71) AM_MIRROR(0x04) AM_WRITE8(i8089_ca1_w, 0x00ff) + AM_RANGE(0x72, 0x73) AM_MIRROR(0x04) AM_WRITE8(i8089_ca2_w, 0x00ff) + AM_RANGE(0x78, 0x7f) AM_NOP // unavailable +ADDRESS_MAP_END + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static MACHINE_CONFIG_START( apricot, apricot_state ) + // main cpu + MCFG_CPU_ADD("ic91", I8086, XTAL_15MHz / 3) + MCFG_CPU_PROGRAM_MAP(apricot_mem) + MCFG_CPU_IO_MAP(apricot_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("ic31", pic8259_device, inta_cb) + MCFG_I8086_LOCK_HANDLER(WRITELINE(apricot_state, i8086_lock_w)) + + // i/o cpu + MCFG_CPU_ADD("ic71", I8089, XTAL_15MHz / 3) + MCFG_CPU_PROGRAM_MAP(apricot_mem) + MCFG_CPU_IO_MAP(apricot_io) + MCFG_I8089_DATABUS_WIDTH(16) + MCFG_I8089_SINTR1(DEVWRITELINE("ic31", pic8259_device, ir0_w)) + MCFG_I8089_SINTR2(DEVWRITELINE("ic31", pic8259_device, ir1_w)) + + // ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256k") + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_SIZE(800, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 800-1, 0, 400-1) + MCFG_SCREEN_REFRESH_RATE(72) + MCFG_SCREEN_UPDATE_DRIVER(apricot_state, screen_update_apricot) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + MCFG_MC6845_ADD("ic30", MC6845, "screen", XTAL_15MHz / 10) + MCFG_MC6845_INTERLACE_ADJUST(1) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(10) + MCFG_MC6845_UPDATE_ROW_CB(apricot_state, crtc_update_row) + MCFG_MC6845_OUT_DE_CB(WRITELINE(apricot_state, apricot_mc6845_de)) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ic7", SN76489, XTAL_4MHz / 2) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + // devices + MCFG_DEVICE_ADD("ic17", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(apricot_state, i8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(apricot_state, i8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(apricot_state, i8255_portc_w)) + + MCFG_PIC8259_ADD("ic31", INPUTLINE("ic91", 0), VCC, NULL) + + MCFG_DEVICE_ADD("ic16", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_4MHz / 16) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("ic31", pic8259_device, ir6_w)) + MCFG_PIT8253_CLK1(XTAL_4MHz / 2) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(apricot_state, timer_out1)) + MCFG_PIT8253_CLK2(XTAL_4MHz / 2) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(apricot_state, timer_out2)) + + MCFG_Z80SIO0_ADD("ic15", XTAL_15MHz / 6, 0, 0, XTAL_4MHz / 16, XTAL_4MHz / 16) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_WRDYA_CB(DEVWRITELINE("ic71", i8089_device, drq2_w)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("keyboard", apricot_keyboard_hle_device, rxd_w)) + MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(apricot_state, data_selector_dtr_w)) + MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(apricot_state, data_selector_rts_w)) + MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE("ic31", pic8259_device, ir5_w)) + + // rs232 port + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) +// note: missing a receive clock callback to support external clock mode +// (m_data_selector_rts == 1 and m_data_selector_dtr == 0) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ic15", z80sio0_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ic15", z80sio0_device, dcda_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ic15", z80sio0_device, synca_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ic15", z80sio0_device, ctsa_w)) + + // keyboard (hle) + MCFG_APRICOT_KEYBOARD_ADD("keyboard") + MCFG_APRICOT_KEYBOARD_TXD_HANDLER(DEVWRITELINE("ic15", z80sio0_device, rxb_w)) + + // centronics printer + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("ic15", z80dart_device, ctsb_w)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("ic15", z80dart_device, dcdb_w)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(apricot_state, write_centronics_fault)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(apricot_state, write_centronics_perror)) + //MCFG_CENTRONICS_SELECT_HANDLER() // schematic page 294 says this is connected to pc4, but that is an output to the printer + + MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + // floppy + MCFG_WD2797_ADD("ic68", XTAL_4MHz / 2) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(apricot_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("ic71", i8089_device, drq1_w)) + MCFG_FLOPPY_DRIVE_ADD("ic68:0", apricot_floppies, "d32w", apricot_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("ic68:1", apricot_floppies, "d32w", apricot_state::floppy_formats) + + // expansion bus + MCFG_EXPANSION_ADD("exp", "ic91") + MCFG_EXPANSION_IOP_ADD("ic71") + MCFG_EXPANSION_SLOT_ADD("exp:1", apricot_expansion_cards, NULL) + MCFG_EXPANSION_SLOT_ADD("exp:2", apricot_expansion_cards, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( apricotxi, apricot ) +MACHINE_CONFIG_END + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( apricot ) + ROM_REGION(0x4000, "bootstrap", 0) + ROM_LOAD16_BYTE("pc_bios_lo_001.bin", 0x0000, 0x2000, CRC(0c217cc2) SHA1(0d7a2b61e17966462b555115f962a175fadcf72a)) + ROM_LOAD16_BYTE("pc_bios_hi_001.bin", 0x0001, 0x2000, CRC(7c27f36c) SHA1(c801bbf904815f76ec6463e948f57e0118a26292)) +ROM_END + +ROM_START( apricotxi ) + ROM_REGION(0x4000, "bootstrap", 0) + ROM_LOAD16_BYTE("lo_ve007.u11", 0x0000, 0x2000, CRC(e74e14d1) SHA1(569133b0266ce3563b21ae36fa5727308797deee)) // LO Ve007 03.04.84 + ROM_LOAD16_BYTE("hi_ve007.u9", 0x0001, 0x2000, CRC(b04fb83e) SHA1(cc2b2392f1b4c04bb6ec8ee26f8122242c02e572)) // HI Ve007 03.04.84 +ROM_END + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1983, apricot, 0, 0, apricot, 0, driver_device, 0, "ACT", "Apricot PC", MACHINE_NOT_WORKING ) +COMP( 1984, apricotxi, apricot, 0, apricotxi, 0, driver_device, 0, "ACT", "Apricot Xi", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/apricotf.c b/src/mame/drivers/apricotf.c new file mode 100644 index 00000000000..9ea574b7a1d --- /dev/null +++ b/src/mame/drivers/apricotf.c @@ -0,0 +1,435 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese, Robbbert +/*************************************************************************** + + ACT Apricot F1 series + + preliminary driver by Angelo Salese + + +11/09/2011 - modernised. The portable doesn't seem to have + scroll registers, and it sets the palette to black. + I've added a temporary video output so that you can get + an idea of what the screen should look like. [Robbbert] + +****************************************************************************/ + +/* + + TODO: + + - CTC/SIO interrupt acknowledge + - CTC clocks + - sound + +*/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "cpu/z80/z80daisy.h" +#include "imagedev/flopdrv.h" +#include "machine/apricotkb.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "machine/wd_fdc.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "formats/apridisk.h" + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define SCREEN_TAG "screen" +#define I8086_TAG "10d" +#define Z80CTC_TAG "13d" +#define Z80SIO2_TAG "15d" +#define WD2797_TAG "5f" +#define CENTRONICS_TAG "centronics" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> f1_state + +class f1_state : public driver_device +{ +public: + f1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I8086_TAG), + m_ctc(*this, Z80CTC_TAG), + m_sio(*this, Z80SIO2_TAG), + m_fdc(*this, WD2797_TAG), + m_floppy0(*this, WD2797_TAG ":0"), + m_floppy1(*this, WD2797_TAG ":1"), + m_centronics(*this, CENTRONICS_TAG), + m_cent_data_out(*this, "cent_data_out"), + m_ctc_int(CLEAR_LINE), + m_sio_int(CLEAR_LINE), + m_p_scrollram(*this, "p_scrollram"), + m_p_paletteram(*this, "p_paletteram"), + m_palette(*this, "palette") + { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + virtual void machine_start(); + + required_device m_maincpu; + required_device m_ctc; + required_device m_sio; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_centronics; + required_device m_cent_data_out; + int m_ctc_int; + int m_sio_int; + required_shared_ptr m_p_scrollram; + required_shared_ptr m_p_paletteram; + required_device m_palette; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ16_MEMBER( palette_r ); + DECLARE_WRITE16_MEMBER( palette_w ); + DECLARE_WRITE8_MEMBER( system_w ); + DECLARE_WRITE_LINE_MEMBER( sio_int_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_int_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); + + int m_40_80; + int m_200_256; +}; + + +//************************************************************************** +// VIDEO +//************************************************************************** + +UINT32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + int lines = m_200_256 ? 200 : 256; + + for (int y = 0; y < lines; y++) + { + offs_t addr = m_p_scrollram[y] << 1; + + for (int sx = 0; sx < 80; sx++) + { + UINT16 data = program.read_word(addr); + + if (m_40_80) + { + for (int x = 0; x < 8; x++) + { + int color = (BIT(data, 15) << 1) | BIT(data, 7); + + bitmap.pix16(y, (sx * 8) + x) = color; + + data <<= 1; + } + } + else + { + for (int x = 0; x < 4; x++) + { + int color = (BIT(data, 15) << 3) | (BIT(data, 14) << 2) | (BIT(data, 7) << 1) | BIT(data, 6); + + bitmap.pix16(y, (sx * 8) + (x * 2)) = color; + bitmap.pix16(y, (sx * 8) + (x * 2) + 1) = color; + + data <<= 2; + } + } + + addr += 2; + } + } + + return 0; +} + +READ16_MEMBER( f1_state::palette_r ) +{ + return m_p_paletteram[offset]; +} + +WRITE16_MEMBER( f1_state::palette_w ) +{ + UINT8 i,r,g,b; + COMBINE_DATA(&m_p_paletteram[offset]); + + if(ACCESSING_BITS_0_7 && offset) //TODO: offset 0 looks bogus + { + i = m_p_paletteram[offset] & 1; + r = ((m_p_paletteram[offset] & 2)>>0) | i; + g = ((m_p_paletteram[offset] & 4)>>1) | i; + b = ((m_p_paletteram[offset] & 8)>>2) | i; + + m_palette->set_pen_color(offset, pal2bit(r), pal2bit(g), pal2bit(b)); + } +} + + +static const gfx_layout charset_8x8 = +{ + 8,8, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + + +static GFXDECODE_START( act_f1 ) + GFXDECODE_ENTRY( I8086_TAG, 0x0800, charset_8x8, 0, 1 ) +GFXDECODE_END + + +WRITE8_MEMBER( f1_state::system_w ) +{ + switch(offset) + { + case 0: // centronics data port + m_cent_data_out->write(space, 0, data); + break; + + case 1: // drive select + m_fdc->set_floppy(BIT(data, 0) ? m_floppy0->get_device() : m_floppy1->get_device()); + break; + + case 3: // drive head load + break; + + case 5: // drive motor on + m_floppy0->get_device()->mon_w(!BIT(data, 0)); + m_floppy1->get_device()->mon_w(!BIT(data, 0)); + break; + + case 7: // video lines (1=200, 0=256) + m_200_256 = BIT(data, 0); + break; + + case 9: // video columns (1=80, 0=40) + m_40_80 = BIT(data, 0); + break; + + case 0x0b: // LED 0 enable + break; + + case 0x0d: // LED 1 enable + break; + + case 0x0f: // centronics strobe output + m_centronics->write_strobe(!BIT(data, 0)); + break; + } +} + + +void f1_state::machine_start() +{ +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( act_f1_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( act_f1_mem, AS_PROGRAM, 16, f1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x01dff) AM_RAM + AM_RANGE(0x01e00, 0x01fff) AM_RAM AM_SHARE("p_scrollram") + AM_RANGE(0x02000, 0x3ffff) AM_RAM + AM_RANGE(0xe0000, 0xe001f) AM_READWRITE(palette_r, palette_w) AM_SHARE("p_paletteram") + AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( act_f1_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( act_f1_io, AS_IO, 16, f1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x000f) AM_WRITE8(system_w, 0xffff) + AM_RANGE(0x0010, 0x0017) AM_DEVREADWRITE8(Z80CTC_TAG, z80ctc_device, read, write, 0x00ff) + AM_RANGE(0x0020, 0x0027) AM_DEVREADWRITE8(Z80SIO2_TAG, z80sio2_device, ba_cd_r, ba_cd_w, 0x00ff) +// AM_RANGE(0x0030, 0x0031) AM_WRITE8(ctc_ack_w, 0x00ff) + AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8(WD2797_TAG, wd2797_t, read, write, 0x00ff) +// AM_RANGE(0x01e0, 0x01ff) winchester +ADDRESS_MAP_END + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( act ) +//------------------------------------------------- + +static INPUT_PORTS_START( act ) + // defined in machine/apricotkb.c +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// Z80SIO +//------------------------------------------------- + +WRITE_LINE_MEMBER( f1_state::sio_int_w ) +{ + m_sio_int = state; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_ctc_int || m_sio_int); +} + +//------------------------------------------------- +// Z80CTC +//------------------------------------------------- + +WRITE_LINE_MEMBER( f1_state::ctc_int_w ) +{ + m_ctc_int = state; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_ctc_int | m_sio_int); +} + +WRITE_LINE_MEMBER( f1_state::ctc_z1_w ) +{ + m_sio->rxcb_w(state); + m_sio->txcb_w(state); +} + +WRITE_LINE_MEMBER( f1_state::ctc_z2_w ) +{ + m_sio->txca_w(state); +} + +//------------------------------------------------- +// floppy +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER( f1_state::floppy_formats ) + FLOPPY_APRIDISK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( apricotf_floppies ) + SLOT_INTERFACE( "d31v", SONY_OA_D31V ) + SLOT_INTERFACE( "d32w", SONY_OA_D32W ) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( act_f1 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( act_f1, f1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I8086_TAG, I8086, XTAL_14MHz/4) + MCFG_CPU_PROGRAM_MAP(act_f1_mem) + MCFG_CPU_IO_MAP(act_f1_io) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(f1_state, screen_update) + MCFG_SCREEN_SIZE(640, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 256-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", act_f1) + + /* Devices */ + MCFG_DEVICE_ADD(APRICOT_KEYBOARD_TAG, APRICOT_KEYBOARD, 0) + + MCFG_Z80SIO2_ADD(Z80SIO2_TAG, 2500000, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(WRITELINE(f1_state, sio_int_w)) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 2500000) + MCFG_Z80CTC_INTR_CB(WRITELINE(f1_state, ctc_int_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(f1_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(f1_state, ctc_z2_w)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(Z80SIO2_TAG, z80dart_device, ctsa_w)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + // floppy + MCFG_WD2797_ADD(WD2797_TAG, XTAL_4MHz / 2 /* ? */) + MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(I8086_TAG, INPUT_LINE_NMI)) + MCFG_WD_FDC_DRQ_CALLBACK(INPUTLINE(I8086_TAG, INPUT_LINE_TEST)) + + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", apricotf_floppies, "d32w", f1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", apricotf_floppies, "d32w", f1_state::floppy_formats) +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( f1 ) +//------------------------------------------------- + +ROM_START( f1 ) + ROM_REGION( 0x8000, I8086_TAG, 0 ) + ROM_LOAD16_BYTE( "lo_f1_1.6.8f", 0x0000, 0x4000, CRC(be018be2) SHA1(80b97f5b2111daf112c69b3f58d1541a4ba69da0) ) // Labelled F1 - LO Vr. 1.6 + ROM_LOAD16_BYTE( "hi_f1_1.6.10f", 0x0001, 0x4000, CRC(bbba77e2) SHA1(e62bed409eb3198f4848f85fccd171cd0745c7c0) ) // Labelled F1 - HI Vr. 1.6 +ROM_END + +#define rom_f1e rom_f1 +#define rom_f2 rom_f1 + + +//------------------------------------------------- +// ROM( f10 ) +//------------------------------------------------- + +ROM_START( f10 ) + ROM_REGION( 0x8000, I8086_TAG, 0 ) + ROM_LOAD16_BYTE( "lo_f10_3.1.1.8f", 0x0000, 0x4000, CRC(bfd46ada) SHA1(0a36ef379fa9af7af9744b40c167ce6e12093485) ) // Labelled LO-FRange Vr3.1.1 + ROM_LOAD16_BYTE( "hi_f10_3.1.1.10f", 0x0001, 0x4000, CRC(67ad5b3a) SHA1(a5ececb87476a30167cf2a4eb35c03aeb6766601) ) // Labelled HI-FRange Vr3.1.1 +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1984, f1, 0, 0, act_f1, act, driver_device, 0, "ACT", "Apricot F1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1984, f1e, f1, 0, act_f1, act, driver_device, 0, "ACT", "Apricot F1e", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1984, f2, f1, 0, act_f1, act, driver_device, 0, "ACT", "Apricot F2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1985, f10, f1, 0, act_f1, act, driver_device, 0, "ACT", "Apricot F10", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/apricotp.c b/src/mame/drivers/apricotp.c new file mode 100644 index 00000000000..be9384b4c04 --- /dev/null +++ b/src/mame/drivers/apricotp.c @@ -0,0 +1,690 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese +/*************************************************************************** + + ACT Apricot FP + + preliminary driver by Angelo Salese + + +11/09/2011 - modernised. The portable doesn't seem to have + scroll registers, and it sets the palette to black. + I've added a temporary video output so that you can get + an idea of what the screen should look like. [Robbbert] + +****************************************************************************/ + +/* + + TODO: + + - devices + - LCD + - sound + +*/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "cpu/m6800/m6800.h" +#include "machine/am9517a.h" +#include "machine/apricotkb.h" +#include "bus/centronics/ctronics.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "machine/z80dart.h" +#include "sound/sn76496.h" +#include "video/mc6845.h" +#include "formats/apridisk.h" +#include "apricotp.lh" + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8086_TAG "ic7" +#define I8284_TAG "ic30" +#define I8237_TAG "ic17" +#define I8259A_TAG "ic51" +#define I8253A5_TAG "ic20" +#define TMS4500_TAG "ic42" +#define MC6845_TAG "ic69" +#define HD63B01V1_TAG "ic29" +#define AD7574_TAG "ic34" +#define AD1408_TAG "ic37" +#define Z80SIO0_TAG "ic6" +#define WD2797_TAG "ic5" +#define SN76489AN_TAG "ic13" +#define CENTRONICS_TAG "centronics" +#define SCREEN_LCD_TAG "screen0" +#define SCREEN_CRT_TAG "screen1" + +enum +{ + LED_STOP = 0, + LED_POWER, + LED_SHIFT_LOCK, + LED_DISK, + LED_VOICE, + LED_COLOUR_SELECT, + LED_CAPS_LOCK +}; + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> fp_state + +class fp_state : public driver_device +{ +public: + fp_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I8086_TAG), + m_soundcpu(*this, HD63B01V1_TAG), + m_dmac(*this, I8237_TAG), + m_pic(*this, I8259A_TAG), + m_pit(*this, I8253A5_TAG), + m_sio(*this, Z80SIO0_TAG), + m_fdc(*this, WD2797_TAG), + m_crtc(*this, MC6845_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, WD2797_TAG":0"), + m_floppy1(*this, WD2797_TAG":1"), + m_floppy(NULL), + m_centronics(*this, CENTRONICS_TAG), + m_work_ram(*this, "work_ram"), + m_video_ram(*this, "video_ram") + { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_maincpu; + required_device m_soundcpu; + required_device m_dmac; + required_device m_pic; + required_device m_pit; + required_device m_sio; + required_device m_fdc; + required_device m_crtc; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + floppy_image_device *m_floppy; + required_device m_centronics; + + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + MC6845_UPDATE_ROW(update_row); + DECLARE_READ16_MEMBER( mem_r ); + DECLARE_WRITE16_MEMBER( mem_w ); + DECLARE_READ8_MEMBER( prtr_snd_r ); + DECLARE_WRITE8_MEMBER( pint_clr_w ); + DECLARE_WRITE8_MEMBER( ls_w ); + DECLARE_WRITE8_MEMBER( contrast_w ); + DECLARE_WRITE8_MEMBER( palette_w ); + DECLARE_WRITE16_MEMBER( video_w ); + DECLARE_WRITE8_MEMBER( lat_w ); + + void lat_ls259_w(offs_t offset, int state); + + optional_shared_ptr m_work_ram; + + // video state + optional_shared_ptr m_video_ram; + UINT8 m_video; + + int m_centronics_busy; + int m_centronics_select; + int m_centronics_fault; + int m_centronics_perror; + + DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_fault ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_perror ); +}; + + +//************************************************************************** +// VIDEO +//************************************************************************** + +void fp_state::video_start() +{ + // allocate memory + m_video_ram.allocate(0x20000); +} + +MC6845_UPDATE_ROW( fp_state::update_row ) +{ +} + +UINT32 fp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + offs_t addr = (!BIT(m_video, 4) << 15) | (BIT(m_video, 1) << 14); + + for (int y = 0; y < 200; y++) + { + for (int sx = 0; sx < 40; sx++) + { + UINT16 data = m_video_ram[addr++]; + + for (int x = 0; x < 16; x++) + { + int color = BIT(data, 15); + + bitmap.pix16(y, (sx * 16) + x) = color; + + data <<= 1; + } + } + } + + return 0; +} + + +static const gfx_layout charset_8x8 = +{ + 8,8, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + + +static GFXDECODE_START( act_f1 ) + GFXDECODE_ENTRY( I8086_TAG, 0x0800, charset_8x8, 0, 1 ) +GFXDECODE_END + + +READ8_MEMBER( fp_state::prtr_snd_r ) +{ + /* + + bit description + + 0 BUSY + 1 SE + 2 _FAULT + 3 PE + 4 LP23 + 5 DCNG-L + 6 J9 1-2 + 7 J9 3-4 + + */ + + UINT8 data = 0; + + // centronics + data |= m_centronics_busy; + data |= m_centronics_select << 1; + data |= m_centronics_fault << 2; + data |= m_centronics_perror << 3; + + // floppy + data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 5; + + return data; +} + +WRITE8_MEMBER( fp_state::pint_clr_w ) +{ + m_pic->ir6_w(CLEAR_LINE); +} + + +WRITE8_MEMBER( fp_state::ls_w ) +{ + m_centronics->write_strobe(!BIT(data, 0)); +} + + +WRITE8_MEMBER( fp_state::contrast_w ) +{ +} + + +WRITE8_MEMBER( fp_state::palette_w ) +{ + /* + + bit description + + 0 B + 1 G + 2 R + 3 I + 4 index + 5 index + 6 index + 7 index + + */ +} + + +WRITE16_MEMBER( fp_state::video_w ) +{ + /* + + bit description + + 0 CRTRES-H + 1 SEL1 + 2 DON-H + 3 LCDON-H + 4 SEL2 + 5 L3 even access + 6 L2 odd access + 7 L1 video RAM enable + 8 + 9 STOP LED + 10 POWER LED + 11 SHIFT LOCK LED + 12 DISK LED + 13 VOICE LED + 14 COLOUR SELECT LED + 15 CAPS LOCK LED + + */ + + m_video = data & 0xff; +} + +void fp_state::lat_ls259_w(offs_t offset, int state) +{ + switch (offset) + { + case 0: + { + m_floppy = NULL; + + if (state) m_floppy = m_floppy0->get_device(); + else m_floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + m_floppy->mon_w(0); + } + break; + } +} + +WRITE8_MEMBER( fp_state::lat_w ) +{ + lat_ls259_w((offset >> 1) & 0x07, BIT(data, 0)); +} + + +READ16_MEMBER( fp_state::mem_r ) +{ + UINT16 data = 0xffff; + + if (offset >= 0xd0000/2 && offset < 0xf0000/2) + { + if (BIT(m_video, 7)) + { + data = m_video_ram[offset - 0xd0000/2]; + } + else + { + if (offset < m_ram->size()/2) + { + data = m_work_ram[offset]; + } + } + } + else + { + if (offset < m_ram->size()/2) + { + data = m_work_ram[offset]; + } + } + + return data; +} + + +WRITE16_MEMBER( fp_state::mem_w ) +{ + if (offset >= 0xd0000/2 && offset < 0xe0000/2) + { + if (BIT(m_video, 7)) + { + m_video_ram[offset - 0xd0000/2] = data; + } + else + { + if (offset < m_ram->size()/2) + { + m_work_ram[offset] = data; + } + } + } + else if (offset >= 0xe0000/2 && offset < 0xf0000/2) + { + if (BIT(m_video, 7)) + { + if (BIT(m_video, 5)) + { + m_video_ram[offset - 0xd0000/2] = (data & 0xff00) | (m_video_ram[offset - 0xd0000/2] & 0x00ff); + } + + if (BIT(m_video, 6)) + { + m_video_ram[offset - 0xd0000/2] = (data & 0x00ff) | (m_video_ram[offset - 0xd0000/2] & 0xff00); + } + } + else + { + if (offset < m_ram->size()/2) + { + m_work_ram[offset] = data; + } + } + } + else + { + if (offset < m_ram->size()/2) + { + m_work_ram[offset] = data; + } + } +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( fp_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( fp_mem, AS_PROGRAM, 16, fp_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0xf7fff) AM_READWRITE(mem_r, mem_w) + AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( fp_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( fp_io, AS_IO, 16, fp_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000, 0x007) AM_DEVREADWRITE8(WD2797_TAG, wd2797_t, read, write, 0x00ff) + AM_RANGE(0x008, 0x00f) AM_DEVREADWRITE8(I8253A5_TAG, pit8253_device, read, write, 0x00ff) + AM_RANGE(0x018, 0x01f) AM_DEVREADWRITE8(Z80SIO0_TAG, z80sio0_device, ba_cd_r, ba_cd_w, 0x00ff) + AM_RANGE(0x020, 0x021) AM_DEVWRITE8("cent_data_out", output_latch_device, write, 0x00ff) + AM_RANGE(0x022, 0x023) AM_WRITE8(pint_clr_w, 0x00ff) + AM_RANGE(0x024, 0x025) AM_READ8(prtr_snd_r, 0x00ff) + AM_RANGE(0x026, 0x027) AM_DEVWRITE8(SN76489AN_TAG, sn76489a_device, write, 0x00ff) + AM_RANGE(0x028, 0x029) AM_WRITE8(contrast_w, 0x00ff) + AM_RANGE(0x02a, 0x02b) AM_WRITE8(palette_w, 0x00ff) + AM_RANGE(0x02e, 0x02f) AM_WRITE(video_w) + AM_RANGE(0x040, 0x05f) AM_DEVREADWRITE8(I8237_TAG, am9517a_device, read, write, 0x00ff) + AM_RANGE(0x068, 0x06b) AM_DEVREADWRITE8(I8259A_TAG, pic8259_device, read, write, 0x00ff) + AM_RANGE(0x06c, 0x06d) AM_DEVWRITE8(MC6845_TAG, mc6845_device, address_w, 0x00ff) + AM_RANGE(0x06e, 0x06f) AM_DEVREADWRITE8(MC6845_TAG, mc6845_device, register_r, register_w, 0x00ff) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( sound_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( sound_mem, AS_PROGRAM, 8, fp_state ) + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD63B01V1_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( sound_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( sound_io, AS_IO, 8, fp_state ) + AM_RANGE(M6801_PORT1, M6801_PORT1) + AM_RANGE(M6801_PORT2, M6801_PORT2) + AM_RANGE(M6801_PORT3, M6801_PORT3) + AM_RANGE(M6801_PORT4, M6801_PORT4) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( act ) +//------------------------------------------------- + +static INPUT_PORTS_START( fp ) + // defined in machine/apricotkb.c +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// pic8259_interface pic_intf +//------------------------------------------------- + +/* + + INT0 TIMER + INT1 FDC + INT2 6301 + INT3 COMS + INT4 USART + INT5 COMS + INT6 PRINT + INT7 EOP + +*/ + +WRITE_LINE_MEMBER( fp_state::write_centronics_busy ) +{ + m_centronics_busy = state; + if (!state) m_pic->ir6_w(ASSERT_LINE); +} + +WRITE_LINE_MEMBER( fp_state::write_centronics_select ) +{ + m_centronics_select = state; +} + +WRITE_LINE_MEMBER( fp_state::write_centronics_fault ) +{ + m_centronics_fault = state; +} + +WRITE_LINE_MEMBER( fp_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( fp ) +//------------------------------------------------- + +void fp_state::machine_start() +{ + // allocate memory + m_work_ram.allocate(m_ram->size() / 2); +} + + +void fp_state::machine_reset() +{ + m_video = 0; + + m_fdc->dden_w(0); + + for (offs_t offset = 0; offset < 7; offset++) + { + lat_ls259_w(offset, 0); + } +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +FLOPPY_FORMATS_MEMBER( fp_state::floppy_formats ) + FLOPPY_APRIDISK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( fp_floppies ) + SLOT_INTERFACE("d32w", SONY_OA_D32W) +SLOT_INTERFACE_END + + +//------------------------------------------------- +// MACHINE_CONFIG( fp ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( fp, fp_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I8086_TAG, I8086, XTAL_15MHz/3) + MCFG_CPU_PROGRAM_MAP(fp_mem) + MCFG_CPU_IO_MAP(fp_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A_TAG, pic8259_device, inta_cb) + + MCFG_CPU_ADD(HD63B01V1_TAG, HD6301, 2000000) + MCFG_CPU_PROGRAM_MAP(sound_mem) + MCFG_CPU_IO_MAP(sound_io) + MCFG_DEVICE_DISABLE() + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_apricotp ) + + MCFG_SCREEN_ADD(SCREEN_LCD_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(fp_state, screen_update) + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_SCREEN_ADD(SCREEN_CRT_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) + MCFG_SCREEN_SIZE(640, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 256-1) + + MCFG_PALETTE_ADD("palette", 16) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", act_f1) + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_CRT_TAG, 4000000) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(fp_state, update_row) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, 2000000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* Devices */ + MCFG_DEVICE_ADD(APRICOT_KEYBOARD_TAG, APRICOT_KEYBOARD, 0) + MCFG_DEVICE_ADD(I8237_TAG, AM9517A, 250000) + MCFG_I8237_OUT_EOP_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir7_w)) + MCFG_I8237_IN_IOR_1_CB(DEVREAD8(WD2797_TAG, wd_fdc_t, data_r)) + MCFG_I8237_OUT_IOW_1_CB(DEVWRITE8(WD2797_TAG, wd_fdc_t, data_w)) + MCFG_PIC8259_ADD(I8259A_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL) + + MCFG_DEVICE_ADD(I8253A5_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(2000000) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259A_TAG, pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(2000000) + MCFG_PIT8253_CLK2(2000000) + + MCFG_Z80SIO0_ADD(Z80SIO0_TAG, 2500000, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir4_w)) + + MCFG_WD2797_ADD(WD2797_TAG, 2000000) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir1_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq1_w)) + + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", fp_floppies, "d32w", fp_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", fp_floppies, NULL, fp_state::floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fp_state, write_centronics_busy)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(fp_state, write_centronics_select)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fp_state, write_centronics_fault)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fp_state, write_centronics_perror)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + MCFG_RAM_EXTRA_OPTIONS("512K,1M") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( fp ) +//------------------------------------------------- + +ROM_START( fp ) + ROM_REGION( 0x8000, I8086_TAG, 0 ) + ROM_LOAD16_BYTE( "lo_fp_3.1.ic20", 0x0000, 0x4000, CRC(0572add2) SHA1(c7ab0e5ced477802e37f9232b5673f276b8f5623) ) // Labelled 11212721 F97E PORT LO VR 3.1 + ROM_LOAD16_BYTE( "hi_fp_3.1.ic9", 0x0001, 0x4000, CRC(3903674b) SHA1(8418682dcc0c52416d7d851760fea44a3cf2f914) ) // Labelled 11212721 BD2D PORT HI VR 3.1 + + ROM_REGION( 0x1000, HD63B01V1_TAG, 0 ) + ROM_LOAD( "voice interface hd63b01v01.ic29", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x100, "proms", 0 ) + ROM_LOAD( "tbp24s10.ic73", 0x000, 0x100, NO_DUMP ) // address decoder 256x4 + + ROM_REGION( 0x100, "plds", 0 ) + ROM_LOAD( "pal1 pal12l6.ic2", 0x000, 0x100, NO_DUMP ) // ? + ROM_LOAD( "pal2 pal10l8.ic35", 0x000, 0x100, NO_DUMP ) // address decoder + ROM_LOAD( "pal3 pal12l6.ic77", 0x000, 0x100, NO_DUMP ) // ? +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1984, fp, 0, 0, fp, fp, driver_device, 0, "ACT", "Apricot Portable / FP", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/aquarius.c b/src/mame/drivers/aquarius.c new file mode 100644 index 00000000000..84df8234eac --- /dev/null +++ b/src/mame/drivers/aquarius.c @@ -0,0 +1,420 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + Mattel Aquarius + + + TODO: + + - slot interface for cartridges + - hand controllers + - scramble RAM also + - CAQ tape support + - memory mapper + - proper video timings + - PAL mode + - floppy support (I/O 0xe6-0xe7 = drive 1, 0xea-0xeb = drive 2) + - modem + - "old" version of BASIC ROM + - Aquarius II + +***************************************************************************/ + +#include "includes/aquarius.h" + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define XTAL1 8866000 +#define XTAL2 XTAL_7_15909MHz + + +/*************************************************************************** + GLOBAL VARIABLES +***************************************************************************/ + + + +/*************************************************************************** + READ/WRITE HANDLERS +***************************************************************************/ + +/* + To read stored data from cassette the program should look at bit zero of + the cassette input port and measure the time difference between leading + edges or trailing edges. This is to prevent DC level shifting from altering + pulse width of data. The program should then look for sync bytes for data + synchronisation before data block transfer. If there is any task that must + be performed during cassette loading, the maximum allowable time to do the + job after one byte from cassette, must be less than 80% of the period of a + mark cycle. Control must be returned at that time to the cassette routine + in order to maintain data integrity. +*/ +READ8_MEMBER(aquarius_state::cassette_r) +{ + return ((m_cassette)->input() < +0.0) ? 0 : 1; +} + + +/* + Sound and cassette port use a common pin. Therefore the signal to cassette + will appear on audio output. Sound port is a simple one bit I/O and therefore + it must be toggled at a specific rate under software control. +*/ +WRITE8_MEMBER(aquarius_state::cassette_w) +{ + m_speaker->level_w(BIT(data, 0)); + m_cassette->output(BIT(data, 0) ? +1.0 : -1.0); +} + + +/* + The current state of the vertical sync will appear on bit 0 during a read of + this port. The waveform and timing spec is shown as follows: + + |<- Active scan period ->|V.sync |<- + | 12.8 ms |3.6 ms (PAL) + | |2.8 ms (NTSC) + +++++++++++++++++++++++++++++++ ++++++++++++ + + + + + + + + + +++++ +++++++++ +*/ +READ8_MEMBER(aquarius_state::vsync_r) +{ + return m_screen->vblank() ? 0 : 1; +} + + +/* + Bit D0 of this port controls the swapping of the lower 16K block in the memory + map with the upper 16K. A 1 in this bit indicates swapping. This bit is reset + after power up initialization. +*/ +WRITE8_MEMBER(aquarius_state::mapper_w) +{ +} + + +/* + Printer handshaking port (read) Port 0xFE when read, presents the clear + to send status from PRNHASK pin at bit D0. A 1 indicates printer is ready, + 0 means not ready. +*/ +READ8_MEMBER(aquarius_state::printer_r) +{ + return 1; /* ready */ +} + + +/* + This is a single bit I/O at D0, it will perform as a serial output + port under software control. Since timing is done by software the + baudrate is variable. In BASIC this is a 1200 baud printer port for + the 40 column thermal printer. +*/ +WRITE8_MEMBER(aquarius_state::printer_w) +{ +} + + +/* + This port is 6 bits wide, when read, it returns the row data from the + keyboard matrix. The keyboard is usually scanned in the following manner: + + The keyboard is a 6 row by 8 column matrix. The column is connected to + the higher order address bus A15-A8. When Z80 executes its input + instruction sets, either the current content of the accumulator (A) or + the content of register (B) will go to the higher order address bus. + Therefore the keyboard can be scanned by placing a specific scanning + pattern in (A) or (B) and reading the result returned on rows. +*/ +READ8_MEMBER(aquarius_state::keyboard_r) +{ + UINT8 result = 0xff; + + if (!BIT(offset, 8)) result &= m_y0->read(); + if (!BIT(offset, 9)) result &= m_y1->read(); + if (!BIT(offset, 10)) result &= m_y2->read(); + if (!BIT(offset, 11)) result &= m_y3->read(); + if (!BIT(offset, 12)) result &= m_y4->read(); + if (!BIT(offset, 13)) result &= m_y5->read(); + if (!BIT(offset, 14)) result &= m_y6->read(); + if (!BIT(offset, 15)) result &= m_y7->read(); + + return result; +} + + +/* + Software lock: Writing this port with an 8 bit value will set the software + scrambler pattern. The data that appears on the output side will be the + result of the input bus EX-ORed with this pattern, bit by bit. The software + lock is a scrambler built between the CPU and external interface. The + scrambling pattern is contained in port 0xFF and is not readable. CPU data + output to external bus will be XORed with this pattern in a bit by bit + fashion to generate the real data on external bus. By the same mechanism, + data from external bus is also XORed with this pattern and read by CPU. + + Therefore it the external device is RAM, the software lock simply has no + effect as long as the scrambling pattern remains unchanged. For I/O + operation the pattern is gated to 0 and thus scrambling action is nullified. + + In BASIC operation the scrambling pattern is generated by a random number + routine. For game cartridge the lock pattern is generated from data in the + game cartridge itself. +*/ +WRITE8_MEMBER(aquarius_state::scrambler_w) +{ + m_scrambler = data; +} + +READ8_MEMBER(aquarius_state::cartridge_r) +{ + UINT8 data = 0; + if (m_cart->exists()) + data = m_cart->read_rom(space, offset); + + return data ^ m_scrambler; +} + + +/*************************************************************************** + DRIVER INIT +***************************************************************************/ + +DRIVER_INIT_MEMBER(aquarius_state,aquarius) +{ + /* install expansion memory if available */ + if (m_ram->size() > 0x1000) + { + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.install_readwrite_bank(0x4000, 0x4000 + m_ram->size() - 0x1000 - 1, "bank1"); + membank("bank1")->set_base(m_ram->pointer()); + } +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( aquarius_mem, AS_PROGRAM, 8, aquarius_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x3000, 0x33ff) AM_RAM_WRITE(aquarius_videoram_w) AM_SHARE("videoram") + AM_RANGE(0x3400, 0x37ff) AM_RAM_WRITE(aquarius_colorram_w) AM_SHARE("colorram") + AM_RANGE(0x3800, 0x3fff) AM_RAM + AM_RANGE(0x4000, 0xbfff) AM_NOP /* expansion ram */ + AM_RANGE(0xc000, 0xffff) AM_READ(cartridge_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( aquarius_io, AS_IO, 8, aquarius_state ) +// AM_RANGE(0x7e, 0x7f) AM_MIRROR(0xff00) AM_READWRITE(modem_r, modem_w) + AM_RANGE(0xf6, 0xf6) AM_MIRROR(0xff00) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) + AM_RANGE(0xf7, 0xf7) AM_MIRROR(0xff00) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0xfc, 0xfc) AM_MIRROR(0xff00) AM_READWRITE(cassette_r, cassette_w) + AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_READWRITE(vsync_r, mapper_w) + AM_RANGE(0xfe, 0xfe) AM_MIRROR(0xff00) AM_READWRITE(printer_r, printer_w) + AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_READWRITE(keyboard_r, scrambler_w) +ADDRESS_MAP_END + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/* the 'reset' key is directly tied to the reset line of the cpu */ +INPUT_CHANGED_MEMBER(aquarius_state::aquarius_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( aquarius ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= +\tNEXT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90 \\") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR('\\') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": *\tPEEK") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RTN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; @\tPOKE") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". >\tVAL") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _\tFOR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ^") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('/') PORT_CHAR('^') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 ?") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('?') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(16) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L\tPOINT") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(12) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", <\tSTR$") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 )\tCOPY") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(15) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K\tPRESET") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(11) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(13) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N\tRIGHT$") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(14) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J\tPSET") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(10) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 (\tRETURN") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(9) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 '\tGOSUB") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(21) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(8) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B\tMID$") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(2) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 &\tON") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(25) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G\tBELL") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(7) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V\tLEFT$") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(22) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C\tSTOP") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(3) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F\tDATA") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(6) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 %\tGOTO") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T\tINPUT") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(20) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $\tTHEN") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R\tRETYP") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(18) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D\tREAD") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(4) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X\tDELINE") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(24) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 #\tIF") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E\tDIM") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(5) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S\tSTPLST") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(19) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z\tCLOAD") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(26) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE\tCHR$") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A\tCSAVE") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(1) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 \"\tLIST") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W\tREM") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(23) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 !\tRUN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(17) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("RESET") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_state, aquarius_reset, 0) + + PORT_START("LEFT") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("RIGHT") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) +INPUT_PORTS_END + + +/*************************************************************************** + CHARACTER LAYOUT +***************************************************************************/ + +static const gfx_layout aquarius_charlayout = +{ + 8, 8, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, }, + 8 * 8 +}; + +/* Graphics Decode Information */ + +static GFXDECODE_START( aquarius ) + GFXDECODE_ENTRY( "gfx1", 0x0000, aquarius_charlayout, 0, 256 ) +GFXDECODE_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static MACHINE_CONFIG_START( aquarius, aquarius_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz) // ??? + MCFG_CPU_PROGRAM_MAP(aquarius_mem) + MCFG_CPU_IO_MAP(aquarius_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", aquarius_state, irq0_line_hold) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2800)) + MCFG_SCREEN_SIZE(40 * 8, 25 * 8) + MCFG_SCREEN_VISIBLE_AREA(0, 40 * 8 - 1, 0 * 8, 25 * 8 - 1) + MCFG_SCREEN_UPDATE_DRIVER(aquarius_state, screen_update_aquarius) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", aquarius ) + MCFG_TEA1002_ADD("encoder", XTAL_8_867238MHz) + MCFG_PALETTE_ADD("palette", 512) + MCFG_PALETTE_INDIRECT_ENTRIES(16) + MCFG_PALETTE_INIT_OWNER(aquarius_state, aquarius) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_3_579545MHz/2) // ??? AY-3-8914 + MCFG_AY8910_PORT_A_READ_CB(IOPORT("RIGHT")) + MCFG_AY8910_PORT_B_READ_CB(IOPORT("LEFT")) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "aquarius_cart") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("8K,20K,36K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","aquarius") +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( aquarius ) + ROM_REGION(0x10000, "maincpu", 0) + + /* basic rom */ + ROM_DEFAULT_BIOS("rev2") + ROM_SYSTEM_BIOS(0, "rev1", "Revision 1") + ROMX_LOAD("aq1.u2", 0x0000, 0x2000, NO_DUMP, ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rev2", "Revision 2") + ROMX_LOAD("aq2.u2", 0x0000, 0x2000, CRC(a2d15bcf) SHA1(ca6ef55e9ead41453efbf5062d6a60285e9661a6), ROM_BIOS(2)) + + /* charrom */ + ROM_REGION(0x800, "gfx1", 0) + ROM_LOAD("aq2.u5", 0x000, 0x800, CRC(e117f57c) SHA1(3588c0267c67dfbbda615bcf8dc3d3a5c5bd815a)) +ROM_END + + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, aquarius, 0, 0, aquarius, aquarius, aquarius_state, aquarius, "Mattel", "Aquarius (NTSC)", 0 ) +//COMP( 1984, aquariu2, aquarius, 0, aquarius, aquarius, driver_device, 0, "Mattel", "Aquarius II", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c new file mode 100644 index 00000000000..c6eb8bd58d2 --- /dev/null +++ b/src/mame/drivers/arcadia.c @@ -0,0 +1,842 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** +Consolidation and enhancement of documentation by Manfred Schneider based on previous work from + PeT mess@utanet.at and Paul Robson (autismuk@aol.com) minor updates by incog + + Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/ + + TODO: implement the RESET key on the front panel + find a dump of the character ROM + convert the drawing code to tilemap + + + 1. General + SYSTEM +- Signetics 2650 CPU at 3.58/4 MHz(for NTSC) or at 4,433/5 (for PAL) +- 1k x 8 of RAM (physically present but only 512 byte available) +- 2 x 2 axis Analogue Joysticks +- 2 x 12 button Controllers +- 3 buttons on system unit and CPU Reset + VIDEO +- 128 x 208 pixel resolution (alternate 128 x 104 mode available) +- 16 x 26 (can be 16x13) background display (2 colour 8 x 8 pixel characters) +- 4 x 8 x 8 Sprites (2 colour 8 x 8 pixels) +- total of 8 user defined characters available + SOUND +- Single channel beeper + + +2. Memory map +The memory map of the 2001 is below. +0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) +1000 - 13FF mirror of $1800-$1BFF +1400 - 17FF mirror of $1800-$1BFF +1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) + 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits + 18D0 - 18EF Free for user programs. + 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 + 18F8 - 1908 registers of UVI + 1909 - 197F Unmapped + 1980 - 19BF User defined characters (8 possible, 8 bytes per character) + 19C0 - 19F7 Unmapped + 19F8 - 19FF registers of UVI + 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits + 1AD0 - 1AFF User memory + 1B00 - 1BFF mirror of 1900-19FF +1C00 - 1FFF mirror of 1800-1BFF +2000 - 2FFF 4k ROM Block 2 (for 8k carts such as Jungler) +3000 - 3FFF mirror of 1000-1FFF +4000 - 4FFF mirror of 0000-0FFF +5000 - 5FFF mirror of 1000-1FFF +6000 - 6FFF mirror of 0000-0FFF +7000 - 7FFF mirror of 1000-1FFF + +The Palladium VCG memory map is as follows. +0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) +1000 - 17FF could be ROM or RAM but no Cartridge uses this +1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) + 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits + 18D0 - 18EF Free for user programs. + 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 + 18F8 - 1908 registers of UVI + 1909 - 197F Unmapped + 1980 - 19BF User defined characters (8 possible, 8 bytes per character) + 19C0 - 19F7 Unmapped + 19F8 - 19FF registers of UVI + 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits + 1AD0 - 1AFF User memory + 1B00 - 1BFF mirror of 1900-19FF +1C00 - 1FFF could be ROM or RAM but no Cartridge uses this +2000 - 2FFF 4k ROM Block (for 8k carts such as Jungler) +3000 - 3FFF could be ROM or RAM but no Cartridge uses this +4000 - 4FFF 4k ROM Block (first 2K used by Golf) +5000 - 5FFF 4k ROM Block +6000 - 6FFF 4k ROM Block +7000 - 7FFF 4k ROM Block + + +3. ROM Images +ROM Images are loaded into 0000-0FFF. If the ROM is an 8k ROM the +second half of the Rom is located at 2000-2FFF. Except for the Golf cart +which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on +Palladium VCG. + + +4. Controls +All key controls are indicated by a bit going to '1'. Unused bits at +the memory location are set to zero. + +Keypads + +1900-1902 (Player 1) 1904-1906 (Player 2) +The keypads are arranged as follows :- + + 1 2 3 + 4 5 6 + 7 8 9 + Enter 0 Clear + +Row 1/4/7 is 1900/4, Row 2/5/8/0 is 1901/5 and Row 3/6/9 is 1902/6 +The topmost key is bit 3, the lowermost key is bit 0. + +Location $1908 contains bit 0 Start,bit 1 Option,bit 2 Difficulty. +These keys are "latched" i.e. a press causes a logic 1 to appear +on the current frame. + +The fire buttons are equivalent to Keypad #2 e.g. they are 1901 and +1905 bit 3. + +Palladium has 4 additional key per keypad which are mapped at +1903 palladium player 1 +1907 palladium player 2 + + +5. Other information +Interrupts are not supported +The Read/Write 2650 CPU Port-Commands do not appear to be connected to +anything in hardware. No cartridge has been found which uses them. + +******************************************************************************/ + +#include "includes/arcadia.h" + +static ADDRESS_MAP_START( arcadia_mem, AS_PROGRAM, 8, arcadia_state ) + AM_RANGE( 0x0000, 0x0fff) AM_DEVREAD("cartslot", arcadia_cart_slot_device, read_rom) + AM_RANGE( 0x1800, 0x1aff) AM_READWRITE(video_r, video_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( arcadia_io, AS_IO, 8, arcadia_state ) + AM_RANGE( S2650_SENSE_PORT,S2650_SENSE_PORT) AM_READ(vsync_r) +ADDRESS_MAP_END + +/* The Emerson Arcadia 2001 controllers have 2 fire buttons on the side, + but actually they are wired to keypad button #2. The following definitions + are meant to document this fact. The keypad has the following layout: + + 1 2 3 + 4 5 6 + 7 8 9 + Cl 0 En */ + +static INPUT_PORTS_START( arcadia ) + PORT_START("panel") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Option") PORT_CODE(KEYCODE_O) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Select") +// PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) Not implemented + + PORT_START("controller1_col1") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Clear") PORT_CODE(KEYCODE_MINUS_PAD) + + PORT_START("controller1_col2") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 0") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("controller1_col3") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Enter") PORT_CODE(KEYCODE_PLUS_PAD) + + PORT_START("controller1_extra") + PORT_BIT( 0xff, 0xf0, IPT_UNUSED) // used in palladium + + PORT_START("controller2_col1") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Clear") PORT_CODE(KEYCODE_V) + + PORT_START("controller2_col2") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 0") PORT_CODE(KEYCODE_F) + + PORT_START("controller2_col3") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Enter") PORT_CODE(KEYCODE_R) + + PORT_START("controller2_extra") + PORT_BIT( 0xff, 0xf0, IPT_UNUSED) // used in palladium + +/* FIXME: the joystick are analog - the actual definition is merely an hack */ + +#if 0 + // auto centering too slow, so only using 5 bits, and scaling at videoside + PORT_START("controller1_joy_x") + PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_X) + PORT_SENSITIVITY(1) + PORT_KEYDELTA(2000) + PORT_MINMAX(0,0x1f) + PORT_CODE_DEC(KEYCODE_LEFT) + PORT_CODE_INC(KEYCODE_RIGHT) + PORT_CODE_DEC(JOYCODE_1_LEFT) + PORT_CODE_INC(JOYCODE_1_RIGHT) + PORT_PLAYER(1) + PORT_RESET + + PORT_START("controller1_joy_y") + PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_Y) + PORT_SENSITIVITY(1) + PORT_KEYDELTA(2000) + PORT_MINMAX(0,0x1f) + PORT_CODE_DEC(KEYCODE_UP) + PORT_CODE_INC(KEYCODE_DOWN) + PORT_CODE_DEC(JOYCODE_1_UP) + PORT_CODE_INC(JOYCODE_1_DOWN) + PORT_PLAYER(1) + PORT_RESET + + PORT_START("controller2_joy_x") + PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_MINMAX(0,0x1f) + PORT_CODE_DEC(KEYCODE_DEL) + PORT_CODE_INC(KEYCODE_PGDN) + PORT_CODE_DEC(JOYCODE_2_LEFT) + PORT_CODE_INC(JOYCODE_2_RIGHT) + PORT_PLAYER(2) + PORT_RESET + + PORT_START("controller2_joy_y") + PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_MINMAX(0,0x1f) + PORT_CODE_DEC(KEYCODE_HOME) + PORT_CODE_INC(KEYCODE_END) + PORT_CODE_DEC(JOYCODE_2_UP) + PORT_CODE_INC(JOYCODE_2_DOWN) + PORT_PLAYER(2) + PORT_RESET +#else + PORT_START("joysticks") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY +#endif +INPUT_PORTS_END + +/* The Palladium Video-Computer-Game controllers have no fire buttons on their side + but have a 16 keys unlabeled keypad. The keys are fully independent and layed out + according to this weird scheme, which keeps backward compatibility to Arcadia 2001's + electrical wiring. + + 2 + 13 14 15 + 1 16 3 + 4 5 6 + 7 8 9 + 10 11 12 */ + +static INPUT_PORTS_START( plldium ) + PORT_START("panel") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Selector A") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Selector B") PORT_CODE(KEYCODE_O) +// PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) Not implemented + + PORT_START("controller1_col1") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) // some bits must be high + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 10") PORT_CODE(KEYCODE_MINUS_PAD) + + PORT_START("controller1_col2") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 11") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("controller1_col3") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 12") PORT_CODE(KEYCODE_PLUS_PAD) + + PORT_START("controller1_extra") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 13") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 14") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 15") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 16") PORT_CODE(KEYCODE_DEL_PAD) + + PORT_START("controller2_col1") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 10") PORT_CODE(KEYCODE_V) + + PORT_START("controller2_col2") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 11") PORT_CODE(KEYCODE_F) + + PORT_START("controller2_col3") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 12") PORT_CODE(KEYCODE_R) + + PORT_START("controller2_extra") + PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 13") PORT_CODE(KEYCODE_B) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 14") PORT_CODE(KEYCODE_G) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 15") PORT_CODE(KEYCODE_T) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 16") PORT_CODE(KEYCODE_H) + +/* FIXME: the joystick are analog - the actual definition is merely an hack */ + +#if 0 + // auto centering too slow, so only using 5 bits, and scaling at videoside + PORT_START("controller1_joy_x") + PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_X) + PORT_SENSITIVITY(1) + PORT_KEYDELTA(2000) + PORT_MINMAX(0,0x1f) + PORT_CODE_DEC(KEYCODE_LEFT) + PORT_CODE_INC(KEYCODE_RIGHT) + PORT_CODE_DEC(JOYCODE_1_LEFT) + PORT_CODE_INC(JOYCODE_1_RIGHT) + PORT_PLAYER(1) + PORT_RESET + + PORT_START("controller1_joy_y") + PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_Y) + PORT_SENSITIVITY(1) + PORT_KEYDELTA(2000) + PORT_MINMAX(0,0x1f) + PORT_CODE_DEC(KEYCODE_UP) + PORT_CODE_INC(KEYCODE_DOWN) + PORT_CODE_DEC(JOYCODE_1_UP) + PORT_CODE_INC(JOYCODE_1_DOWN) + PORT_PLAYER(1) + PORT_RESET + + PORT_START("controller2_joy_x") + PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_X) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_MINMAX(0,0x1f) + PORT_CODE_DEC(KEYCODE_DEL) + PORT_CODE_INC(KEYCODE_PGDN) + PORT_CODE_DEC(JOYCODE_2_LEFT) + PORT_CODE_INC(JOYCODE_2_RIGHT) + PORT_PLAYER(2) + PORT_RESET + + PORT_START("controller2_joy_y") + PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_Y) + PORT_SENSITIVITY(100) + PORT_KEYDELTA(10) + PORT_MINMAX(0,0x1f) + PORT_CODE_DEC(KEYCODE_HOME) + PORT_CODE_INC(KEYCODE_END) + PORT_CODE_DEC(JOYCODE_2_UP) + PORT_CODE_INC(JOYCODE_2_DOWN) + PORT_PLAYER(2) + PORT_RESET +#else + PORT_START("joysticks") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY +#endif +INPUT_PORTS_END + +static const gfx_layout arcadia_charlayout = +{ + 8, /*width*/ + 1, /*height*/ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, /* x offsets */ + { 0 }, /* y offsets */ + 1*8 +}; + +static GFXDECODE_START( arcadia ) + GFXDECODE_ENTRY( "gfx1", 0x0000, arcadia_charlayout, 0, 68 ) +GFXDECODE_END + +static const rgb_t arcadia_colors[] = +{ + rgb_t::white, /* white */ + rgb_t(0xff, 0xff, 0x00), /* yellow */ + rgb_t(0x00, 0xff, 0xff), /* cyan */ + rgb_t(0x00, 0xff, 0x00), /* green */ + rgb_t(0xff, 0x00, 0xff), /* magenta */ + rgb_t(0xff, 0x00, 0x00), /* red */ + rgb_t(0x00, 0x00, 0xff), /* blue */ + rgb_t::black /* black */ +}; + +static const unsigned short arcadia_palette[128+8] = /* bgnd, fgnd */ +{ + 0,1,2,3,4,5,6,7, + + 0,0, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, + 1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, + 2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7, + 3,0, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7, + 4,0, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7, + 5,0, 5,1, 5,2, 5,3, 5,4, 5,5, 5,6, 5,7, + 6,0, 6,1, 6,2, 6,3, 6,4, 6,5, 6,6, 6,7, + 7,0, 7,1, 7,2, 7,3, 7,4, 7,5, 7,6, 7,7 +}; + +PALETTE_INIT_MEMBER(arcadia_state, arcadia) +{ + for (int i = 0; i < 8; i++) + palette.set_indirect_color(i, arcadia_colors[i]); + + for (int i = 0; i < 128+8; i++) + palette.set_pen_indirect(i, arcadia_palette[i]); +} + +void arcadia_state::machine_start() +{ + if (m_cart->exists()) + { + switch (m_cart->get_type()) + { + case ARCADIA_STD: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0xffff, read8_delegate(FUNC(arcadia_cart_slot_device::extra_rom),(arcadia_cart_slot_device*)m_cart)); + break; + case ARCADIA_GOLF: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x4fff, read8_delegate(FUNC(arcadia_cart_slot_device::extra_rom),(arcadia_cart_slot_device*)m_cart)); + break; + } + } +} + +static SLOT_INTERFACE_START(arcadia_cart) + SLOT_INTERFACE_INTERNAL("std", ARCADIA_ROM_STD) + SLOT_INTERFACE_INTERNAL("golf", ARCADIA_ROM_GOLF) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( arcadia, arcadia_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", S2650, 3580000/4) /* 0.895 MHz */ + MCFG_CPU_PROGRAM_MAP(arcadia_mem) + MCFG_CPU_IO_MAP(arcadia_io) + MCFG_CPU_PERIODIC_INT_DRIVER(arcadia_state, video_line, 262*60) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(128+2*XPOS, 262) + MCFG_SCREEN_VISIBLE_AREA(0, 2*XPOS+128-1, 0, 262-1) + MCFG_SCREEN_UPDATE_DRIVER(arcadia_state, screen_update_arcadia) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", arcadia ) + MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(arcadia_palette)) + MCFG_PALETTE_INDIRECT_ENTRIES(8) + MCFG_PALETTE_INIT_OWNER(arcadia_state, arcadia) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_ARCADIA_SOUND_ADD("custom") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* cartridge */ + MCFG_ARCADIA_CARTRIDGE_ADD("cartslot", arcadia_cart, NULL) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","arcadia") +MACHINE_CONFIG_END + + +ROM_START(advsnha) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(bndarc) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(arcadia) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(tccosmos) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(dynavisn) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(ekusera) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(hanihac) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(hmg2650) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(intmpt03) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(ixl2000) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(intervsn) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(itmcmtp3) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(lvision) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(leonardo) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(mratlus) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(ormatu) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(plldium) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(polyvcg) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(poppympt) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(prestmpt) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(rowtrn2k) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(tvg2000) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(sheenhvc) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(soundic) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(telefevr) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(tempestm) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(tbbympt3) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(trakcvg) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(tunixha) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(tryomvgc) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(orbituvi) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + +ROM_START(vdmaster) + ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) + ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) +ROM_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +DRIVER_INIT_MEMBER(arcadia_state,arcadia) +{ + int i; + UINT8 *gfx=memregion("gfx1")->base(); + for (i=0; i<256; i++) gfx[i]=i; +#if 0 + // this is here to allow developement of some simple testroutines + // for a real console + { + UINT8 *rom=memregion("maincpu")->base(); + /* this is a simple routine to display all rom characters + on the display for a snapshot */ + static const UINT8 prog[]={ // address 0 of course + 0x20, // eorz, 0 + 0x1b, 0x01, // bctr,a $0004 + 0x17, // retc a + 0x76, 0x20, // ppsu ii + + // fill screen + 0x04, 0x00, // lodi,0 0 + 0x04|1, 0x00, // lodi,1 0 + 0xcc|1, 0x78, 0x10, //a: stra,0 $1800,r1 + 0x75,9, //cpsl wc|c + 0x84,0x41, // addi,0 0x41 + 0x75,9, //cpsl wc|c + 0x84|1, 0x01, // addi,1 1 + 0xe4|1, 0x40, // comi,1 40 + 0x98, 0x80-15, // bcfr,0 a + + 0x04, 0xff, // lodi,0 7 + 0xcc, 0x18, 0xfc, // stra,0 $19f8 + 0x04, 0x00, // lodi,0 7 + 0xcc, 0x18, 0xfd, // stra,0 $18fd + 0x04, 0x07, // lodi,0 7 + 0xcc, 0x19, 0xf9, // stra,0 $19f9 + + 0x04, 0x00, // lodi,0 7 + 0xcc, 0x19, 0xbe, // stra,0 $19bf + 0x04, 0x00, // lodi,0 7 + 0xcc, 0x19, 0xbf, // stra,0 $19bf + + //loop: 0x0021 + // print keyboards + 0x04|1, 0x00, //y:lodi,1 0 + 0x0c|1, 0x79, 0x00, //x: ldra,0 1900,r1 + 0x44|0, 0x0f, //andi,0 0f + 0x64|0, 0x10, //ori,0 10 + 0xcc|1, 0x78, 0x01, //stra,0 1840,r1 + 0x75,9, //cpsl wc|c + 0x84|1, 0x01, //addi,1 1 + 0xe4|1, 0x09, //comi,1 9 + 0x98, 0x80-18, //bcfr,0 x + + // cycle colors + 0x0c|1, 0x19, 0x00, //ldra,1 1900 + 0x44|1, 0xf, //andi,0 0f + 0xe4|1, 1, //comi,1 1 + 0x98, +10, //bcfr,0 c + 0x0c, 0x19, 0xbf,//ldra,0 19f9,0 + 0x84, 1, //addi,0 1 + 0xcc, 0x19, 0xbf, //stra,0 19f9,0 + 0x18|3, 12, // bctr,a + 0xe4|1, 2, //c:comi,1 2 + 0x98, +10, //bcfr,0 d + 0x0c, 0x19, 0xbf, //ldra,0 19f9,0 + 0x84, 8, //addi,0 8 + 0xcc, 0x19, 0xbf, //stra,0 19f9,0 + 0x18|3, 12, // bctr,a + + // cycle colors + 0xe4|1, 4, //comi,1 4 + 0x98, +10, //bcfr,0 c + 0x0c, 0x19, 0xbe,//ldra,0 19f9,0 + 0x84, 1, //addi,0 1 + 0xcc, 0x19, 0xbe, //stra,0 19f9,0 + 0x18|3, 12, // bctr,a + 0xe4|1, 8, //c:comi,1 2 + 0x98, +8+9, //bcfr,0 d + 0x0c, 0x19, 0xbe, //ldra,0 19f9,0 + 0x84, 8, //addi,0 8 + 0xcc, 0x19, 0xbe, //stra,0 19f9,0 + + 0x0c, 0x19, 0x00, //b: ldra,0 1900 + 0x44|0, 0xf, //andi,0 0f + 0xe4, 0, //comi,0 0 + 0x98, 0x80-9, //bcfr,0 b + + 0x0c, 0x19, 0xbe, //ldra,0 19bf + 0xcc, 0x19, 0xf8, //stra,0 19f8 + 0x0c, 0x19, 0xbf, //ldra,0 19bf + 0xcc, 0x19, 0xf9, //stra,0 19f8 + + 0x0c, 0x19, 0xbe, //ldra,0 17ff + 0x44|0, 0xf, //andi,0 7 + 0x64|0, 0x10, //ori,0 10 + 0xcc, 0x18, 0x0d, //stra,0 180f + 0x0c, 0x19, 0xbe, //x: ldra,0 19bf + 0x50, 0x50, 0x50, 0x50, //shr,0 4 + 0x44|0, 0xf, //andi,0 7 + 0x64|0, 0x10, //ori,0 10 + 0xcc, 0x18, 0x0c, //stra,0 180e + + 0x0c, 0x19, 0xbf, //ldra,0 17ff + 0x44|0, 0xf, //andi,0 7 + 0x64|0, 0x10, //ori,0 10 + 0xcc, 0x18, 0x0f, //stra,0 180f + 0x0c, 0x19, 0xbf, //x: ldra,0 19bf + 0x50, 0x50, 0x50, 0x50, //shr,0 4 + 0x44|0, 0xf, //andi,0 7 + 0x64|0, 0x10, //ori,0 10 + 0xcc, 0x18, 0x0e, //stra,0 180e + + 0x0c, 0x18, 0x00, //ldra,0 1800 + 0x84, 1, //addi,0 1 + 0xcc, 0x18, 0x00, //stra,0 1800 + +// 0x1b, 0x80-20-29-26-9-8-2 // bctr,a y + 0x1c|3, 0, 0x32, // bcta,3 loop + + // calling too many subdirectories causes cpu to reset! + // bxa causes trap + }; +#if 1 + FILE *f; + f=fopen("chartest.bin","wb"); + fwrite(prog, ARRAY_LENGTH(prog), sizeof(prog[0]), f); + fclose(f); +#endif + for (i=0; i m_maincpu; + DECLARE_WRITE8_MEMBER(argo_videoram_w); + DECLARE_READ8_MEMBER(argo_io_r); + DECLARE_WRITE8_MEMBER(argo_io_w); + required_shared_ptr m_p_videoram; + const UINT8 *m_p_chargen; + UINT8 m_framecnt; + UINT8 m_cursor_pos[3]; + UINT8 m_p_cursor_pos; + bool m_ram_ctrl; + UINT8 m_scroll_ctrl; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_DRIVER_INIT(argo); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +// write to videoram if following 'out b9,61' otherwise write to the unknown 'extra' ram +WRITE8_MEMBER(argo_state::argo_videoram_w) +{ + UINT8 *RAM; + if (m_ram_ctrl) + RAM = memregion("videoram")->base(); + else + RAM = memregion("extraram")->base(); + + RAM[offset] = data; +} + +READ8_MEMBER(argo_state::argo_io_r) +{ + UINT8 low_io = offset; + + switch (low_io) + { + case 0xA1: // keyboard + char kbdrow[6]; + sprintf(kbdrow,"X%X",offset>>8); + return ioport(kbdrow)->read(); + + case 0xE8: // wants bit 4 low then high + return m_framecnt << 4; + + default: + logerror("%s: In %X\n",machine().describe_context(),low_io); + return 0xff; + } +} + +WRITE8_MEMBER(argo_state::argo_io_w) +{ + UINT8 low_io = offset; + + switch (low_io) + { + case 0xA1: // prep scroll step 1 + m_scroll_ctrl = (data == 0x61); + break; + + case 0xA9: // prep scroll step 2 + if ((m_scroll_ctrl == 1) && (data == 0x61)) + m_scroll_ctrl++; + break; + + case 0xE8: // hardware scroll - we should use ports E0,E1,E2,E3 + if ((m_scroll_ctrl == 2) & (data == 0xe3)) + { + UINT8 *RAM = memregion("videoram")->base(); + m_scroll_ctrl = 0; + memcpy(RAM, RAM+80, 24*80); + } + break; + + case 0xC4: // prepare to receive cursor position + m_p_cursor_pos = (data == 0x80); + break; + + case 0xC0: // store cursor position if it followed 'out c4,80' + if (m_p_cursor_pos) + { + m_cursor_pos[m_p_cursor_pos]=data; + if (m_p_cursor_pos == 1) m_p_cursor_pos++; + } + break; + + case 0xB9: // switch between videoram and extraram + m_ram_ctrl = (data == 0x61); + break; + + default: + logerror("%s: Out %X,%X\n",machine().describe_context(),low_io,data); + } +} + + + +static ADDRESS_MAP_START(argo_mem, AS_PROGRAM, 8, argo_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") + AM_RANGE(0x0800, 0xf7af) AM_RAM + AM_RANGE(0xf7b0, 0xf7ff) AM_RAM AM_SHARE("p_videoram") + AM_RANGE(0xf800, 0xffff) AM_ROM AM_WRITE(argo_videoram_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(argo_io, AS_IO, 8, argo_state) + AM_RANGE(0x0000, 0xFFFF) AM_READWRITE(argo_io_r,argo_io_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( argo ) // Keyboard was worked out by trial & error;'F' keys produce symbols + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) // J + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // nothing + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // nothing + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RShift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) // A + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) // B + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('M') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) // K + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) // H + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) // I + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) // C + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) // G + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) // F + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) // D + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_START("X8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) // E + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_START("X9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_START("XA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') // if L is the first character, computer hangs + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_START("XB") + PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +void argo_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BOOT: + /* after the first 4 bytes have been read from ROM, switch the ram back in */ + membank("boot")->set_entry(0); + break; + default: + assert_always(FALSE, "Unknown id in argo_state::device_timer"); + } +} + +void argo_state::machine_reset() +{ + membank("boot")->set_entry(1); + timer_set(attotime::from_usec(5), TIMER_BOOT); +} + +DRIVER_INIT_MEMBER(argo_state,argo) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf800); +} + +void argo_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 argo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + UINT8 *p_vram = m_p_videoram; + + m_framecnt++; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 1; x < 81; x++) // align x to the cursor position numbers + { + gfx = 0; + + if (ra < 9) + { + chr = p_vram[x+ma-1]; + + /* Take care of flashing characters */ + //if ((chr & 0x80) && (m_framecnt & 0x08)) + // chr = 0x20; + + chr &= 0x7f; + + gfx = m_p_chargen[(chr<<4) | ra ]; + } + else + // display cursor if at cursor position and flash on + if ((x==m_cursor_pos[1]) && (y==m_cursor_pos[2]) && (m_framecnt & 0x08)) + gfx = 0xff; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + + if (y) + ma+=80; + else + { + ma=0; + p_vram = memregion("videoram")->base(); + } + } + return 0; +} + +static MACHINE_CONFIG_START( argo, argo_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 3500000) + MCFG_CPU_PROGRAM_MAP(argo_mem) + MCFG_CPU_IO_MAP(argo_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(argo_state, screen_update) + MCFG_SCREEN_SIZE(640, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( argo ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "argo.rom", 0xf800, 0x0800, CRC(4c4c045b) SHA1(be2b97728cc190d4a8bd27262ba9423f252d31a3) ) + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASEFF ) + ROM_REGION( 0x0800, "extraram", ROMREGION_ERASEFF ) // no idea what this is for + + /* character generator not dumped, using the one from 'c10' for now */ + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, argo, 0, 0, argo, argo, argo_state, argo, "", "Argo", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/asst128.c b/src/mame/drivers/asst128.c new file mode 100644 index 00000000000..0aab5a981d7 --- /dev/null +++ b/src/mame/drivers/asst128.c @@ -0,0 +1,145 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +#include "emu.h" +#include "includes/genpc.h" +#include "machine/pc_fdc.h" +#include "cpu/i86/i86.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "formats/asst128_dsk.h" +#include "bus/pc_kbd/keyboards.h" + +class asst128_mb_device : public ibm5150_mb_device +{ +public: + // construction/destruction + asst128_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ibm5150_mb_device(mconfig, tag, owner, clock) { } + +protected: + // device-level overrides + void device_start(); +}; + +void asst128_mb_device::device_start() +{ + install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) ); + install_device(0x0040, 0x0043, 0, 0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit8253), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit8253) ); + install_device(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255) ); + install_device(0x0080, 0x0087, 0, 0, read8_delegate(FUNC(ibm5160_mb_device::pc_page_r), this), write8_delegate(FUNC(ibm5160_mb_device::pc_page_w),this) ); + install_device(0x00a0, 0x00a1, 0, 0, read8_delegate(), write8_delegate(FUNC(ibm5160_mb_device::nmi_enable_w),this)); + /* MESS managed RAM */ + if ( m_ram->pointer() ) + membank( "bank10" )->set_base( m_ram->pointer() ); +} + +const device_type ASST128_MOTHERBOARD = &device_creator; + +class asst128_state : public driver_device +{ +public: + // construction/destruction + asst128_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_mb(*this, "mb") + , m_fdc(*this, "fdc") + { } + + required_device m_maincpu; + required_device m_mb; + required_device m_fdc; + + DECLARE_FLOPPY_FORMATS( asst128_formats ); + DECLARE_WRITE8_MEMBER(asst128_fdc_dor_w); + + void machine_start(); +}; + +void asst128_state::machine_start() +{ + memory_region* font = memregion(":board0:cga_mc1502:gfx1"); + memcpy(font->base(), memregion("maincpu")->base()+0xffa6e, 0x0400); + memcpy(font->base()+0x0400, memregion("maincpu")->base()+0xf4000, 0x0400); +} + +WRITE8_MEMBER(asst128_state::asst128_fdc_dor_w) +{ + m_fdc->tc_w((data & 0x80) == 0x80); + m_fdc->dor_w(space, offset, data, mem_mask); +} + +static ADDRESS_MAP_START( asst128_map, AS_PROGRAM, 16, asst128_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(asst128_io, AS_IO, 16, asst128_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) + AM_RANGE(0x03f2, 0x03f3) AM_WRITE8(asst128_fdc_dor_w, 0xffff) + AM_RANGE(0x03f4, 0x03f5) AM_DEVICE8("fdc:upd765", upd765a_device, map, 0xffff) +ADDRESS_MAP_END + +static SLOT_INTERFACE_START( asst128_floppies ) + SLOT_INTERFACE( "525ssqd", FLOPPY_525_SSQD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( asst128_state::asst128_formats ) + FLOPPY_ASST128_FORMAT +FLOPPY_FORMATS_END + +static DEVICE_INPUT_DEFAULTS_START( asst128 ) + DEVICE_INPUT_DEFAULTS("DSW0", 0x30, 0x20) +DEVICE_INPUT_DEFAULTS_END + +static MACHINE_CONFIG_START( asst128, asst128_state ) + MCFG_CPU_ADD("maincpu", I8086, 4772720) + MCFG_CPU_PROGRAM_MAP(asst128_map) + MCFG_CPU_IO_MAP(asst128_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_DEVICE_ADD("mb", ASST128_MOTHERBOARD, 0) + asst128_mb_device::static_set_cputag(*device, "maincpu"); + MCFG_DEVICE_INPUT_DEFAULTS(asst128) + +// MCFG_DEVICE_REMOVE("mb:dma8237") + + MCFG_DEVICE_REMOVE("mb:cassette") + MCFG_CASSETTE_ADD("mb:cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_ISA8_SLOT_ADD("mb:isa", "board0", pc_isa8_cards, "cga_mc1502", true) + MCFG_ISA8_SLOT_ADD("mb:isa", "board1", pc_isa8_cards, "lpt", true) + + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + + MCFG_PC_FDC_XT_ADD("fdc") + MCFG_PC_FDC_INTRQ_CALLBACK(DEVWRITELINE("mb:pic8259", pic8259_device, ir6_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", asst128_floppies, "525ssqd", asst128_state::asst128_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", asst128_floppies, "525ssqd", asst128_state::asst128_formats) + + MCFG_PC_JOY_ADD("pc_joy") + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + +ROM_START( asst128 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_LOAD( "extbios.bin", 0xf4000, 0x2000, CRC(e3bf22de) SHA1(d4319edc82c0015ca0adc6c8771e887659717e62)) + ROM_LOAD( "basic.bin", 0xf6000, 0x8000, CRC(a4ec66f6) SHA1(80e934986022681ccde180e92aa108e716c4f19b)) + ROM_LOAD( "mainbios.bin", 0xfe000, 0x2000, CRC(8426cbf5) SHA1(41d14137ffa651977041da22aa8071c0f7854158)) + + // XXX needs dumping + ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) + ROM_LOAD( "asst128cg.bin", 0, 0x2000, NO_DUMP ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 198?, asst128, ibm5150, 0, asst128, 0, driver_device, 0, "Schetmash", "Assistent 128", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/astrohome.c b/src/mame/drivers/astrohome.c new file mode 100644 index 00000000000..a3149dd048c --- /dev/null +++ b/src/mame/drivers/astrohome.c @@ -0,0 +1,272 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Mike Coates, Frank Palazzolo, Aaron Giles, Dirk Best +/**************************************************************************** + + Bally Astrocade consumer hardware + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "includes/astrocde.h" +#include "machine/ram.h" +#include "sound/astrocde.h" +#include "bus/astrocde/slot.h" +#include "bus/astrocde/rom.h" +#include "bus/astrocde/exp.h" +#include "bus/astrocde/ram.h" + +class astrocde_mess_state : public astrocde_state +{ +public: + astrocde_mess_state(const machine_config &mconfig, device_type type, const char *tag) + : astrocde_state(mconfig, type, tag), + m_cart(*this, "cartslot"), + m_exp(*this, "exp") + { } + + required_device m_cart; + required_device m_exp; + DECLARE_MACHINE_START(astrocde); +}; + +/********************************************************************************* + * + * Memory maps + * + * $0000 to $1FFF: 8K on-board ROM (could be one of three available BIOS dumps) + * $2000 to $3FFF: 8K cartridge ROM + * $4000 to $4FFF: 4K screen RAM + * $5000 to $FFFF: 44K address space not available in standard machine. With a + * sufficiently large RAM expansion, all of this RAM can be added, and accessed + * by an extended BASIC program. Bally and Astrocade BASIC can access from + * $5000 to $7FFF if available. + * + *********************************************************************************/ + +static ADDRESS_MAP_START( astrocade_mem, AS_PROGRAM, 8, astrocde_mess_state ) + AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w) + AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */ + AM_RANGE(0x4000, 0x4fff) AM_RAM AM_SHARE("videoram") /* ASG */ + //AM_RANGE(0x5000, 0xffff) AM_DEVREADWRITE("exp", astrocade_exp_device, read, write) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( astrocade_io, AS_IO, 8, astrocde_mess_state ) + AM_RANGE(0x00, 0x1f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w) +ADDRESS_MAP_END + +/************************************* + * + * Input ports + * + * + * The Astrocade has ports for four hand controllers. Each controller has a + * knob on top that can be simultaneously pushed as an eight-way joystick and + * twisted as a paddle, in addition to a trigger button. The knob can twist + * through about 270 degrees, registering 256 unique positions. It does not + * autocenter. When selecting options on the menu, twisting the knob to the + * right gives lower numbers, and twisting to the left gives larger numbers. + * Paddle games like Clowns have more intuitive behavior -- twisting to the + * right moves the character right. + * + * There is a 24-key keypad on the system itself (6 rows, 4 columns). It is + * labeled for the built-in calculator, but overlays were released for other + * programs, the most popular being the BASIC cartridges, which allowed a + * large number of inputs by making the bottom row shift buttons. The labels + * below first list the calculator key, then the BASIC keys in the order of no + * shift, GREEN shift, RED shift, BLUE shift, WORDS shift. + * + *************************************/ + +static INPUT_PORTS_START( astrocde ) + PORT_START("P1HANDLE") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("P2HANDLE") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("P3HANDLE") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(3) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(3) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(3) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3) + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("P4HANDLE") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(4) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(4) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(4) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4) + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KEYPAD0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("% \xC3\xB7 [ ] LIST") PORT_CODE(KEYCODE_O) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("/ x J K L NEXT") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("x - V W X IF") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("- + & @ * GOTO") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("+ = # % : PRINT") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("= WORDS Shift") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KEYPAD1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x93 HALT RUN") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CH 9 G H I STEP") PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9 6 S T U RND") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("6 3 \xE2\x86\x91 . \xE2\x86\x93 BOX") PORT_CODE(KEYCODE_6) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("3 ERASE ( ; )") PORT_CODE(KEYCODE_3) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(". BLUE Shift") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KEYPAD2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x91 PAUSE / \\") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MS 8 D E F TO") PORT_CODE(KEYCODE_S) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("8 5 P Q R RETN") PORT_CODE(KEYCODE_8) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("5 2 \xE2\x86\x90 ' \xE2\x86\x92 LINE") PORT_CODE(KEYCODE_5) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2 0 < \" > INPUT") PORT_CODE(KEYCODE_2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0 RED Shift") PORT_CODE(KEYCODE_0) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KEYPAD3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C GO +10") PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MR 7 A B C FOR") PORT_CODE(KEYCODE_R) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("7 4 M N O GOSB") PORT_CODE(KEYCODE_7) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("4 1 Y Z ! CLEAR") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1 SPACE $ , ?") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE GREEN Shift") PORT_CODE(KEYCODE_E) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("P1_KNOB") + PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1) + + PORT_START("P2_KNOB") + PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) + + PORT_START("P3_KNOB") + PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_PLAYER(3) + + PORT_START("P4_KNOB") + PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4) +INPUT_PORTS_END + + +/************************************* + * + * Machine drivers + * + *************************************/ + +static SLOT_INTERFACE_START(astrocade_cart) + SLOT_INTERFACE_INTERNAL("rom", ASTROCADE_ROM_STD) + SLOT_INTERFACE_INTERNAL("rom_256k", ASTROCADE_ROM_256K) + SLOT_INTERFACE_INTERNAL("rom_512k", ASTROCADE_ROM_512K) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(astrocade_exp) + SLOT_INTERFACE("blue_ram_4k", ASTROCADE_BLUERAM_4K) + SLOT_INTERFACE("blue_ram_16k", ASTROCADE_BLUERAM_16K) + SLOT_INTERFACE("blue_ram_32k", ASTROCADE_BLUERAM_32K) + SLOT_INTERFACE("viper_sys1", ASTROCADE_VIPER_SYS1) + SLOT_INTERFACE("lil_white_ram", ASTROCADE_WHITERAM) + SLOT_INTERFACE("rl64_ram", ASTROCADE_RL64RAM) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( astrocde, astrocde_mess_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4) /* 1.789 MHz */ + MCFG_CPU_PROGRAM_MAP(astrocade_mem) + MCFG_CPU_IO_MAP(astrocade_io) + + MCFG_MACHINE_START_OVERRIDE(astrocde_mess_state, astrocde) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(ASTROCADE_CLOCK, 455, 0, 352, 262, 0, 240) + MCFG_SCREEN_UPDATE_DRIVER(astrocde_state, screen_update_astrocde) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 512) + MCFG_PALETTE_INIT_OWNER(astrocde_state, astrocde) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* expansion port */ + MCFG_ASTROCADE_EXPANSION_SLOT_ADD("exp", astrocade_exp, NULL) + + /* cartridge */ + MCFG_ASTROCADE_CARTRIDGE_ADD("cartslot", astrocade_cart, NULL) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","astrocde") +MACHINE_CONFIG_END + + +/************************************* + * + * ROM definitions + * + *************************************/ + +ROM_START( astrocde ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "astro.bin", 0x0000, 0x2000, CRC(ebc77f3a) SHA1(b902c941997c9d150a560435bf517c6a28137ecc) ) +ROM_END + +ROM_START( astrocdl ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "ballyhlc.bin", 0x0000, 0x2000, CRC(d7c517ba) SHA1(6b2bef5d970e54ed204549f58ba6d197a8bfd3cc) ) +ROM_END + +ROM_START( astrocdw ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "bioswhit.bin", 0x0000, 0x2000, CRC(6eb53e79) SHA1(d84341feec1a0a0e8aa6151b649bc3cf6ef69fbf) ) +ROM_END + +/************************************* + * + * Driver initialization + * + *************************************/ + +DRIVER_INIT_MEMBER(astrocde_state,astrocde) +{ + m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS; +} + +MACHINE_START_MEMBER(astrocde_mess_state, astrocde) +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x3fff, read8_delegate(FUNC(astrocade_cart_slot_device::read_rom),(astrocade_cart_slot_device*)m_cart)); + + // if no RAM is mounted and the handlers are installed, the system starts with garbage on screen and a RESET is necessary + // thus, install RAM only if an expansion is mounted + if (m_exp->get_card_mounted()) + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x5000, 0xffff, read8_delegate(FUNC(astrocade_exp_device::read),(astrocade_exp_device*)m_exp), write8_delegate(FUNC(astrocade_exp_device::write),(astrocade_exp_device*)m_exp)); +} + +/************************************* + * + * Driver definitions + * + *************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1978, astrocde, 0, 0, astrocde, astrocde, astrocde_state, astrocde, "Bally Manufacturing", "Bally Professional Arcade", MACHINE_SUPPORTS_SAVE ) +CONS( 1977, astrocdl, astrocde, 0, astrocde, astrocde, astrocde_state, astrocde, "Bally Manufacturing", "Bally Home Library Computer", MACHINE_SUPPORTS_SAVE ) +CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, astrocde_state, astrocde, "Bally Manufacturing", "Bally Computer System", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/at.c b/src/mame/drivers/at.c new file mode 100644 index 00000000000..e02423a3b32 --- /dev/null +++ b/src/mame/drivers/at.c @@ -0,0 +1,1708 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Miodrag Milanovic +/*************************************************************************** + + IBM AT Compatibles + +***************************************************************************/ + +/* mingw-gcc defines this */ +#ifdef i386 +#undef i386 +#endif /* i386 */ + + +#include "includes/at.h" +#include "bus/pc_kbd/keyboards.h" + +static ADDRESS_MAP_START( at16_map, AS_PROGRAM, 16, at_state ) + AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10") + AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM + AM_RANGE(0x0c8000, 0x0cffff) AM_ROM + AM_RANGE(0x0d0000, 0x0effff) AM_RAM + AM_RANGE(0x0f0000, 0x0fffff) AM_ROM + AM_RANGE(0xff0000, 0xffffff) AM_ROM AM_REGION("maincpu", 0x0f0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ps2m30286_map, AS_PROGRAM, 16, at_state) + AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10") + AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM + AM_RANGE(0x0c8000, 0x0cffff) AM_ROM + AM_RANGE(0x0d0000, 0x0dffff) AM_RAM + AM_RANGE(0x0e0000, 0x0fffff) AM_ROM + AM_RANGE(0xfe0000, 0xffffff) AM_ROM AM_REGION("maincpu", 0x0e0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ps1_286_map, AS_PROGRAM, 16, at_state ) + AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10") + AM_RANGE(0x0a0000, 0x0bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffff) + AM_RANGE(0x0c0000, 0x0fffff) AM_ROM + AM_RANGE(0xff0000, 0xffffff) AM_ROM AM_REGION("maincpu", 0x0f0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( at386_map, AS_PROGRAM, 32, at_state ) + AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10") + AM_RANGE(0x000a0000, 0x000bffff) AM_NOP + AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM + AM_RANGE(0x000c8000, 0x000cffff) AM_ROM + AM_RANGE(0x000d0000, 0x000effff) AM_ROM + AM_RANGE(0x000f0000, 0x000fffff) AM_ROM + AM_RANGE(0x00800000, 0x00800bff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0xffff0000, 0xffffffff) AM_ROM AM_REGION("maincpu", 0x0f0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( at586_map, AS_PROGRAM, 32, at586_state ) + AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10") + AM_RANGE(0x000a0000, 0x000bffff) AM_NOP + AM_RANGE(0x00800000, 0x00800bff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("isa", 0x20000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ficpio_map, AS_PROGRAM, 32, at_state ) + AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10") + AM_RANGE(0x000a0000, 0x000bffff) AM_NOP + AM_RANGE(0x000c0000, 0x000c7fff) AM_NOP + AM_RANGE(0x000c8000, 0x000cffff) AM_NOP + AM_RANGE(0x000d0000, 0x000effff) AM_RAM + AM_RANGE(0x000f0000, 0x000fffff) AM_RAM + AM_RANGE(0x00800000, 0x00800bff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("isa", 0x20000) +ADDRESS_MAP_END + + +READ8_MEMBER( at_state::at_dma8237_2_r ) +{ + return m_dma8237_2->read(space, offset / 2); +} + +WRITE8_MEMBER( at_state::at_dma8237_2_w ) +{ + m_dma8237_2->write(space, offset / 2, data); +} + +READ8_MEMBER( at_state::at_keybc_r ) +{ + switch (offset) + { + case 0: return m_keybc->data_r(space, 0); + case 1: return at_portb_r(space, 0); + } + + return 0xff; +} + +WRITE8_MEMBER( at_state::at_keybc_w ) +{ + switch (offset) + { + case 0: m_keybc->data_w(space, 0, data); break; + case 1: at_portb_w(space, 0, data); break; + } +} + + +WRITE8_MEMBER( at_state::write_rtc ) +{ + if (offset==0) { + m_nmi_enabled = BIT(data,7); + m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0)); + m_mc146818->write(space,0,data); + } + else { + m_mc146818->write(space,offset,data); + } +} + +static ADDRESS_MAP_START( at16_io, AS_IO, 16, at_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffff) + AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffff) + AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffff) + AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) + AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff) + AM_RANGE(0x0070, 0x007f) AM_DEVREAD8("rtc", mc146818_device, read, 0xffff) AM_WRITE8(write_rtc , 0xffff) + AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffff) + AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffff) + AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffff) +ADDRESS_MAP_END + +READ16_MEMBER( at_state::ps1_unk_r ) +{ + return m_ps1_reg[offset]; +} + +WRITE16_MEMBER( at_state::ps1_unk_w ) +{ + if((offset == 0) && (data == 0x60)) + data = 0x68; + + m_ps1_reg[offset] = (m_ps1_reg[offset] & ~mem_mask) | (data & mem_mask); +} + +READ8_MEMBER( at_state::ps1_kbdc_r ) +{ + UINT8 ret; + if(offset == 0) ret = at_keybc_r(space, offset, mem_mask); + else ret = ps2_portb_r(space,offset, mem_mask); + return ret; +} + +static ADDRESS_MAP_START(ps1_286_io, AS_IO, 16, at_state ) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffff) + AM_RANGE(0x0060, 0x0063) AM_READWRITE8(ps1_kbdc_r, at_keybc_w, 0xffff) + AM_RANGE(0x0102, 0x0105) AM_READWRITE(ps1_unk_r, ps1_unk_w) + AM_IMPORT_FROM( at16_io ) +ADDRESS_MAP_END + +READ16_MEMBER( at_state::neat_chipset_r ) +{ + if (ACCESSING_BITS_0_7) + return 0xff; + if (ACCESSING_BITS_8_15) + return m_cs8221->data_r(space, 0, 0) << 8; + return 0xffff; +} + +WRITE16_MEMBER( at_state::neat_chipset_w ) +{ + if (ACCESSING_BITS_0_7) + m_cs8221->address_w(space, 0, data, 0); + + if (ACCESSING_BITS_8_15) + m_cs8221->data_w(space, 0, data >> 8, 0); +} + +static ADDRESS_MAP_START( neat_io, AS_IO, 16, at_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffff) + AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffff) + AM_RANGE(0x0022, 0x0023) AM_READWRITE(neat_chipset_r, neat_chipset_w) + AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffff) + AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) + AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff) + AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffff) + AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffff) + AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffff) + AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( at386_io, AS_IO, 32, at_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffffffff) + AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff) + AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) + AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff) + AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffffffff) + AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff) + AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( at586_io, AS_IO, 32, at586_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ficpio_io, AS_IO, 32, at_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffffffff) + AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff) + AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) + AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff) + AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffffffff) + AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff) + AM_RANGE(0x00a0, 0x00a7) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x00a8, 0x00af) AM_DEVREADWRITE8("chipset", vt82c496_device, read, write, 0xffffffff) + AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff) + AM_RANGE(0x0170, 0x0177) AM_DEVREADWRITE("ide2", ide_controller_32_device, read_cs0, write_cs0) + AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE("ide", ide_controller_32_device, read_cs0, write_cs0) + AM_RANGE(0x0370, 0x0377) AM_DEVREADWRITE("ide2", ide_controller_32_device, read_cs1, write_cs1) + AM_RANGE(0x03f0, 0x03f7) AM_DEVREADWRITE("ide", ide_controller_32_device, read_cs1, write_cs1) + AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_device, read, write) +ADDRESS_MAP_END + +DRIVER_INIT_MEMBER(megapc_state, megapc) +{ + UINT8* ROM = memregion("bios")->base(); + ROM[0xf9145] = 0x45; // hack to fix keyboard. To be removed when the keyboard controller from the MegaPC is dumped + ROM[0xffea0] = 0x20; // to correct checksum +} + +DRIVER_INIT_MEMBER(megapc_state, megapcpl) +{ + UINT8* ROM = memregion("bios")->base(); + ROM[0xf87b1] = 0x55; // hack to fix keyboard. To be removed when the keyboard controller from the MegaPC is dumped + ROM[0xffea0] = 0x20; // to correct checksum +} + +DRIVER_INIT_MEMBER(at_state, megapcpla) +{ + UINT8* ROM = memregion("maincpu")->base(); + + init_at_common(0xa0000); + + ROM[0xf3c2a] = 0x45; // hack to fix keyboard. To be removed when the keyboard controller from the MegaPC is dumped + ROM[0xfaf37] = 0x45; + ROM[0xfcf1b] = 0x54; // this will allow the keyboard to work during the POST memory test + ROM[0xffffe] = 0x1c; + ROM[0xfffff] = 0x41; // to correct checksum +} + +READ16_MEMBER( megapc_state::wd7600_ior ) +{ + if (offset < 4) + return m_isabus->dack_r(offset); + else + return m_isabus->dack16_r(offset); +} + +WRITE16_MEMBER( megapc_state::wd7600_iow ) +{ + if (offset < 4) + m_isabus->dack_w(offset, data); + else + m_isabus->dack16_w(offset, data); +} + +WRITE_LINE_MEMBER( megapc_state::wd7600_hold ) +{ + // halt cpu + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + // and acknowledge hold + m_wd7600->hlda_w(state); +} + +static ADDRESS_MAP_START( megapc_map, AS_PROGRAM, 16, at_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( megapcpl_map, AS_PROGRAM, 32, at_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( megapc_io, AS_IO, 16, at_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +static ADDRESS_MAP_START( megapcpl_io, AS_IO, 32, at_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + + +static INPUT_PORTS_START( atcga ) +INPUT_PORTS_END + +static INPUT_PORTS_START( atvga ) + PORT_START("IN0") + PORT_DIPNAME( 0x08, 0x00, "VGA 1") + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, "VGA 2") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "VGA 3") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x01, 0x01, "VGA 4") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +WRITE_LINE_MEMBER( at_state::at_mc146818_irq ) +{ + m_pic8259_slave->ir0_w((state) ? 0 : 1); +} + +UINT32 at_state::at_286_a20(bool state) +{ + return (state ? 0xffffff : 0xefffff); +} + +WRITE_LINE_MEMBER( at_state::at_shutdown ) +{ + if(state) + m_maincpu->reset(); +} + +static MACHINE_CONFIG_FRAGMENT( at_motherboard ) + MCFG_MACHINE_START_OVERRIDE(at_state, at ) + MCFG_MACHINE_RESET_OVERRIDE(at_state, at ) + + MCFG_DEVICE_ADD("pit8254", PIT8254, 0) + MCFG_PIT8253_CLK0(4772720/4) /* heartbeat IRQ */ + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(at_state, at_pit8254_out0_changed)) + MCFG_PIT8253_CLK1(4772720/4) /* dram refresh */ + MCFG_PIT8253_CLK2(4772720/4) /* pio port c pin 4, and speaker polling enough */ + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(at_state, at_pit8254_out2_changed)) + + MCFG_DEVICE_ADD( "dma8237_1", AM9517A, XTAL_14_31818MHz/3 ) + MCFG_I8237_OUT_HREQ_CB(DEVWRITELINE("dma8237_2", am9517a_device, dreq0_w)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(at_state, at_dma8237_out_eop)) + MCFG_I8237_IN_MEMR_CB(READ8(at_state, pc_dma_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(at_state, pc_dma_write_byte)) + MCFG_I8237_IN_IOR_0_CB(READ8(at_state, pc_dma8237_0_dack_r)) + MCFG_I8237_IN_IOR_1_CB(READ8(at_state, pc_dma8237_1_dack_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(at_state, pc_dma8237_2_dack_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(at_state, pc_dma8237_3_dack_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(at_state, pc_dma8237_0_dack_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(at_state, pc_dma8237_1_dack_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(at_state, pc_dma8237_2_dack_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(at_state, pc_dma8237_3_dack_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(at_state, pc_dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(at_state, pc_dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(at_state, pc_dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(at_state, pc_dack3_w)) + MCFG_DEVICE_ADD( "dma8237_2", AM9517A, XTAL_14_31818MHz/3 ) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(at_state, pc_dma_hrq_changed)) + MCFG_I8237_IN_MEMR_CB(READ8(at_state, pc_dma_read_word)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(at_state, pc_dma_write_word)) + MCFG_I8237_IN_IOR_1_CB(READ8(at_state, pc_dma8237_5_dack_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(at_state, pc_dma8237_6_dack_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(at_state, pc_dma8237_7_dack_r)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(at_state, pc_dma8237_5_dack_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(at_state, pc_dma8237_6_dack_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(at_state, pc_dma8237_7_dack_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(at_state, pc_dack4_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(at_state, pc_dack5_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(at_state, pc_dack6_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(at_state, pc_dack7_w)) + + MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(at_state, get_slave_ack) ) + MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir2_w), GND, NULL ) + + MCFG_DEVICE_ADD("isabus", ISA16, 0) + MCFG_ISA16_CPU(":maincpu") + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir2_w)) // in place of irq 2 on at irq 9 is used + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir7_w)) + MCFG_ISA_OUT_IRQ10_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ11_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ12_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ14_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ15_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir7_w)) + MCFG_ISA_OUT_DRQ0_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq0_w)) + MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq3_w)) + MCFG_ISA_OUT_DRQ5_CB(DEVWRITELINE("dma8237_2", am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ6_CB(DEVWRITELINE("dma8237_2", am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ7_CB(DEVWRITELINE("dma8237_2", am9517a_device, dreq3_w)) + + MCFG_DEVICE_ADD("keybc", AT_KEYBOARD_CONTROLLER, XTAL_12MHz) + MCFG_AT_KEYBOARD_CONTROLLER_SYSTEM_RESET_CB(INPUTLINE("maincpu", INPUT_LINE_RESET)) + MCFG_AT_KEYBOARD_CONTROLLER_GATE_A20_CB(INPUTLINE("maincpu", INPUT_LINE_A20)) + MCFG_AT_KEYBOARD_CONTROLLER_INPUT_BUFFER_FULL_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir1_w)) + MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_CLOCK_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, clock_write_from_mb)) + MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_DATA_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, data_write_from_mb)) + MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0) + MCFG_PC_KBDC_OUT_CLOCK_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_clock_w)) + MCFG_PC_KBDC_OUT_DATA_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_data_w)) + + MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) + MCFG_MC146818_IRQ_HANDLER(WRITELINE(at_state, at_mc146818_irq)) + MCFG_MC146818_CENTURY_INDEX(0x32) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( at_softlists ) + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("pc_disk_list","ibm5150") + MCFG_SOFTWARE_LIST_ADD("xt_disk_list","ibm5160_flop") + MCFG_SOFTWARE_LIST_ADD("at_disk_list","ibm5170") + MCFG_SOFTWARE_LIST_ADD("at_cdrom_list","ibm5170_cdrom") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ibm5170, at_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, XTAL_12MHz/2 /*6000000*/) + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(at16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + MCFG_80286_A20(at_state, at_286_a20) + MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_FRAGMENT_ADD( at_motherboard ) + + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "ega", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "fdc", false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "ide", false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_IBM_PC_AT_84) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ibm5170a, ibm5170 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(XTAL_16MHz/2) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ec1842, ibm5170 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(12000000) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ec1849, ibm5170 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(12000000) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ibmps1, at_state ) + MCFG_CPU_ADD("maincpu", I80286, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(ps1_286_map) + MCFG_CPU_IO_MAP(ps1_286_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + MCFG_80286_A20(at_state, at_286_a20) + MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + MCFG_FRAGMENT_ADD( pcvideo_vga ) + + MCFG_FRAGMENT_ADD( at_motherboard ) + + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdc", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "comat", false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "ide", false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ibm5162, at_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, 6000000 /*6000000*/) + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(at16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + MCFG_80286_A20(at_state, at_286_a20) + MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_FRAGMENT_ADD( at_motherboard ) + + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdc", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "ide", false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "cga", false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_IBM_PC_AT_84) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( ps2m30286, at_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, 10000000) + MCFG_CPU_PROGRAM_MAP(ps2m30286_map) + MCFG_CPU_IO_MAP(ps1_286_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + MCFG_80286_A20(at_state, at_286_a20) + MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + MCFG_FRAGMENT_ADD( pcvideo_vga ) + + MCFG_FRAGMENT_ADD( at_motherboard ) + + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdc", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "ide", false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_IBM_PC_AT_84) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( neat, at_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, 12000000) + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(neat_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + MCFG_80286_A20(at_state, at_286_a20) + MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) + + MCFG_FRAGMENT_ADD( at_motherboard ) + + MCFG_ISA16_SLOT_ADD("isabus", "isa1", pc_isa16_cards, "fdc", false) + MCFG_ISA16_SLOT_ADD("isabus", "isa2", pc_isa16_cards, "ide", false) + MCFG_ISA16_SLOT_ADD("isabus", "isa3", pc_isa16_cards, "comat", false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "svga_et4k", false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + MCFG_CS8221_ADD("cs8221", "maincpu", "isa", "bios") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( atvga, at_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, 12000000) + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(at16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + MCFG_80286_A20(at_state, at_286_a20) + MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) + + MCFG_FRAGMENT_ADD( at_motherboard ) + + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdcsmc", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "ide", false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "ne2000", false) + MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, "svga_et4k", false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( xb42639, at_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, 12500000) + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(at16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + MCFG_80286_A20(at_state, at_286_a20) + MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) + + MCFG_FRAGMENT_ADD( at_motherboard ) + + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdc", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "ide", false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "svga_et4k", false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( at386, at_state ) + MCFG_CPU_ADD("maincpu", I386, 12000000) + MCFG_CPU_PROGRAM_MAP(at386_map) + MCFG_CPU_IO_MAP(at386_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_FRAGMENT_ADD( at_motherboard ) + MCFG_NVRAM_ADD_0FILL("nvram") + + // on board devices + MCFG_ISA16_SLOT_ADD("isabus","board1", pc_isa16_cards, "fdcsmc", true) + MCFG_ISA16_SLOT_ADD("isabus","board2", pc_isa16_cards, "comat", true) + MCFG_ISA16_SLOT_ADD("isabus","board3", pc_isa16_cards, "ide", true) + MCFG_ISA16_SLOT_ADD("isabus","board4", pc_isa16_cards, "lpt", true) + // ISA cards + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "svga_et4k", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, NULL, false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M,16M,32M,64M,128M,256M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( at486, at386 ) + MCFG_CPU_REPLACE("maincpu", I486, 25000000) + MCFG_CPU_PROGRAM_MAP(at386_map) + MCFG_CPU_IO_MAP(at386_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( k286i, at_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, XTAL_12MHz/2 /*6000000*/) + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(at16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + MCFG_80286_A20(at_state, at_286_a20) + MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_FRAGMENT_ADD( at_motherboard ) + + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "cga", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "fdc", false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa6", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa7", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa8", pc_isa16_cards, NULL, false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1M") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,16M") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_FRAGMENT( tx_config ) + MCFG_I82439TX_CPU( "maincpu" ) + MCFG_I82439TX_REGION( "isa" ) +MACHINE_CONFIG_END + +static SLOT_INTERFACE_START( pci_devices ) + SLOT_INTERFACE_INTERNAL("i82439tx", I82439TX) + SLOT_INTERFACE_INTERNAL("i82371ab", I82371AB) + SLOT_INTERFACE_INTERNAL("i82371sb", I82371SB) + SLOT_INTERFACE_INTERNAL("vt82c505", VT82C505) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( at586, at586_state ) + MCFG_CPU_ADD("maincpu", PENTIUM, 60000000) + MCFG_CPU_PROGRAM_MAP(at586_map) + MCFG_CPU_IO_MAP(at586_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pcibus:1:i82371ab:pic8259_master", pic8259_device, inta_cb) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,16M,32M,64M,128M,256M") + + MCFG_PCI_BUS_ADD("pcibus", 0) + MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "i82439tx", true) + MCFG_SLOT_OPTION_MACHINE_CONFIG("i82439tx", tx_config) + + MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "i82371ab", true) + + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa1", pc_isa16_cards, "svga_et4k", false) + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa2", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa3", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa4", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa5", pc_isa16_cards, NULL, false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( at586x3, at586_state ) + MCFG_CPU_ADD("maincpu", PENTIUM, 60000000) + MCFG_CPU_PROGRAM_MAP(at586_map) + MCFG_CPU_IO_MAP(at586_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pcibus:1:i82371sb:pic8259_master", pic8259_device, inta_cb) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,16M,32M,64M") + + MCFG_PCI_BUS_ADD("pcibus", 0) + MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "i82439tx", true) + MCFG_SLOT_OPTION_MACHINE_CONFIG("i82439tx", tx_config) + + MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "i82371sb", true) + + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa1", pc_isa16_cards, "svga_et4k", false) + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa2", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa3", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa4", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa5", pc_isa16_cards, NULL, false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( at386sx, atvga ) + MCFG_CPU_REPLACE("maincpu", I386SX, 16000000) /* 386SX */ + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(at16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ct386sx, neat ) + MCFG_CPU_REPLACE("maincpu", I386SX, 16000000) + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(neat_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( megapc, megapc_state ) + MCFG_CPU_ADD("maincpu", I386SX, XTAL_50MHz / 2) + MCFG_CPU_PROGRAM_MAP(megapc_map) + MCFG_CPU_IO_MAP(megapc_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("wd7600", wd7600_device, intack_cb) + + MCFG_WD7600_ADD("wd7600",XTAL_50MHz / 2, ":maincpu", ":isa", ":bios", ":keybc") + MCFG_WD7600_HOLD(WRITELINE(megapc_state, wd7600_hold)); + MCFG_WD7600_NMI(INPUTLINE("maincpu", INPUT_LINE_NMI)); + MCFG_WD7600_INTR(INPUTLINE("maincpu", INPUT_LINE_IRQ0)); + MCFG_WD7600_CPURESET(INPUTLINE("maincpu", INPUT_LINE_RESET)); + MCFG_WD7600_A20M(INPUTLINE("maincpu", INPUT_LINE_A20)); + // isa dma + MCFG_WD7600_IOR(READ16(megapc_state, wd7600_ior)) + MCFG_WD7600_IOW(WRITE16(megapc_state, wd7600_iow)) + MCFG_WD7600_TC(WRITE8(megapc_state, wd7600_tc)) + // speaker + MCFG_WD7600_SPKR(WRITELINE(megapc_state, wd7600_spkr)) + + // on board devices + MCFG_DEVICE_ADD("isabus", ISA16, 0) + MCFG_ISA16_CPU(":maincpu") + MCFG_ISA_BUS_IOCHCK(DEVWRITELINE("wd7600", wd7600_device, iochck_w)) + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("wd7600", wd7600_device, irq09_w)) + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("wd7600", wd7600_device, irq03_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("wd7600", wd7600_device, irq04_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("wd7600", wd7600_device, irq05_w)) + MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("wd7600", wd7600_device, irq06_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("wd7600", wd7600_device, irq07_w)) + MCFG_ISA_OUT_IRQ10_CB(DEVWRITELINE("wd7600", wd7600_device, irq10_w)) + MCFG_ISA_OUT_IRQ11_CB(DEVWRITELINE("wd7600", wd7600_device, irq11_w)) + MCFG_ISA_OUT_IRQ12_CB(DEVWRITELINE("wd7600", wd7600_device, irq12_w)) + MCFG_ISA_OUT_IRQ14_CB(DEVWRITELINE("wd7600", wd7600_device, irq14_w)) + MCFG_ISA_OUT_IRQ15_CB(DEVWRITELINE("wd7600", wd7600_device, irq15_w)) + MCFG_ISA_OUT_DRQ0_CB(DEVWRITELINE("wd7600", wd7600_device, dreq0_w)) + MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("wd7600", wd7600_device, dreq1_w)) + MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("wd7600", wd7600_device, dreq2_w)) + MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("wd7600", wd7600_device, dreq3_w)) + MCFG_ISA_OUT_DRQ5_CB(DEVWRITELINE("wd7600", wd7600_device, dreq5_w)) + MCFG_ISA_OUT_DRQ6_CB(DEVWRITELINE("wd7600", wd7600_device, dreq6_w)) + MCFG_ISA_OUT_DRQ7_CB(DEVWRITELINE("wd7600", wd7600_device, dreq7_w)) + MCFG_ISA16_SLOT_ADD("isabus","board1", pc_isa16_cards, "fdcsmc", true) + MCFG_ISA16_SLOT_ADD("isabus","board2", pc_isa16_cards, "comat", true) + MCFG_ISA16_SLOT_ADD("isabus","board3", pc_isa16_cards, "ide", true) + MCFG_ISA16_SLOT_ADD("isabus","board4", pc_isa16_cards, "lpt", true) + MCFG_ISA16_SLOT_ADD("isabus","board5", pc_isa16_cards, "vga", true) + // ISA cards + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, NULL, false) + + MCFG_DEVICE_ADD("keybc", AT_KEYBOARD_CONTROLLER, XTAL_12MHz) + MCFG_AT_KEYBOARD_CONTROLLER_SYSTEM_RESET_CB(DEVWRITELINE("wd7600", wd7600_device, kbrst_w)) + MCFG_AT_KEYBOARD_CONTROLLER_GATE_A20_CB(DEVWRITELINE("wd7600", wd7600_device, gatea20_w)) + MCFG_AT_KEYBOARD_CONTROLLER_INPUT_BUFFER_FULL_CB(DEVWRITELINE("wd7600", wd7600_device, irq01_w)) + MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_CLOCK_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, clock_write_from_mb)) + MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_DATA_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, data_write_from_mb)) + MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0) + MCFG_PC_KBDC_OUT_CLOCK_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_clock_w)) + MCFG_PC_KBDC_OUT_DATA_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_data_w)) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,15M,16M") + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + // video hardware + MCFG_PALETTE_ADD("palette", 256) // todo: really needed? + + /* software lists */ + MCFG_FRAGMENT_ADD( at_softlists ) + MCFG_SOFTWARE_LIST_ADD("disk_list","megapc") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( megapcpl, megapc ) + MCFG_CPU_REPLACE("maincpu", I486, 66000000 / 2) + MCFG_CPU_PROGRAM_MAP(megapcpl_map) + MCFG_CPU_IO_MAP(megapcpl_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("wd7600", wd7600_device, intack_cb) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( megapcpla, at_state ) + MCFG_CPU_ADD("maincpu", I486, 66000000 / 2) // 486SLC + MCFG_CPU_PROGRAM_MAP(at386_map) + MCFG_CPU_IO_MAP(at386_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_FRAGMENT_ADD( at_motherboard ) + MCFG_NVRAM_ADD_0FILL("nvram") + + // on board devices + MCFG_ISA16_SLOT_ADD("isabus","board1", pc_isa16_cards, "fdcsmc", true) + MCFG_ISA16_SLOT_ADD("isabus","board2", pc_isa16_cards, "comat", true) + MCFG_ISA16_SLOT_ADD("isabus","board3", pc_isa16_cards, "ide", true) + MCFG_ISA16_SLOT_ADD("isabus","board4", pc_isa16_cards, "lpt", true) + // ISA cards + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "svga_dm", false) // closest to the CL-GD5420 + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, NULL, false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("2M,8M,15M,16M,32M,64M,128M,256M") + + /* software lists */ + MCFG_FRAGMENT_ADD( at_softlists ) + MCFG_SOFTWARE_LIST_ADD("disk_list","megapc") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ficpio2, at_state ) + MCFG_CPU_ADD("maincpu", I486, 25000000) + MCFG_CPU_PROGRAM_MAP(ficpio_map) + MCFG_CPU_IO_MAP(ficpio_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_FRAGMENT_ADD(at_motherboard) + + MCFG_DEVICE_REMOVE("rtc") + MCFG_DS12885_ADD("rtc") + MCFG_MC146818_IRQ_HANDLER(WRITELINE(at_state, at_mc146818_irq)) + MCFG_MC146818_CENTURY_INDEX(0x32) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,16M,32M,64M,128M") + + // on board devices + MCFG_ISA16_SLOT_ADD("isabus","board1", pc_isa16_cards, "fdcsmc", true) + MCFG_ISA16_SLOT_ADD("isabus","board2", pc_isa16_cards, "comat", true) + MCFG_ISA16_SLOT_ADD("isabus","board3", pc_isa16_cards, "lpt", true) + + MCFG_IDE_CONTROLLER_32_ADD("ide", ata_devices, "hdd", NULL, true) + MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir6_w)) + MCFG_IDE_CONTROLLER_32_ADD("ide2", ata_devices, "cdrom", NULL, true) + MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir7_w)) + + MCFG_PCI_BUS_ADD("pcibus", 0) + MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "vt82c505", true) + MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "svga_et4k", false) + MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, NULL, false) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + MCFG_VT82C496_ADD("chipset") + MCFG_VT82C496_CPU("maincpu") + MCFG_VT82C496_REGION("isa") + + MCFG_FRAGMENT_ADD( at_softlists ) +MACHINE_CONFIG_END + +#if 0 + // ibm at + // most likely 2 32 kbyte chips for 16 bit access + ROM_LOAD("atbios.bin", 0xf0000, 0x10000, CRC(674426be)) // BASIC C1.1, beeps + // split into 2 chips for 16 bit access + ROM_LOAD_EVEN("ibmat.0", 0xf0000, 0x8000, CRC(4995be7a)) + ROM_LOAD_ODD("ibmat.1", 0xf0000, 0x8000, CRC(c32713e4)) + + /* I know about a 1984 version in 2 32kb roms */ + + /* at, ami bios and diagnostics */ + ROM_LOAD_EVEN("rom01.bin", 0xf0000, 0x8000, CRC(679296a7)) + ROM_LOAD_ODD("rom02.bin", 0xf0000, 0x8000, CRC(65ae1f97)) + + /* */ + ROM_LOAD("neat286.bin", 0xf0000, 0x10000, CRC(07985d9b)) + // split into 2 chips for 16 bit access + ROM_LOAD_EVEN("neat.0", 0xf0000, 0x8000, CRC(4c36e61d)) + ROM_LOAD_ODD("neat.1", 0xf0000, 0x8000, CRC(4e90f294)) + + /* most likely 1 chip!, for lower costs */ + ROM_LOAD("at386.bin", 0xf0000, 0x10000, CRC(3df9732a)) + + /* at486 */ + ROM_LOAD("at486.bin", 0xf0000, 0x10000, CRC(31214616)) + + ROM_LOAD("", 0x??000, 0x2000, CRC()) +#endif + +ROM_START( ibm5170 ) + ROM_REGION(0x100000,"maincpu", 0) + + ROM_SYSTEM_BIOS( 0, "rev1", "IBM PC/AT 5170 01/10/84") + ROMX_LOAD("6181028.u27", 0xf0000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a), ROM_SKIP(1) | ROM_BIOS(1)) /* T 6181028 8506AAA // TMM23256P-5878 // (C)IBM CORP 1981,-1984 */ + ROMX_LOAD("6181029.u47", 0xf0001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be), ROM_SKIP(1) | ROM_BIOS(1)) /* T 6181029 8506AAA // TMM23256P-5879 // (C)IBM CORP 1981,-1984 */ + + ROM_SYSTEM_BIOS( 1, "rev2", "IBM PC/AT 5170 06/10/85") /* Another verifaction of these crcs would be nice */ + ROMX_LOAD("6480090.u27", 0xf0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("6480091.u47", 0xf0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(2)) + +// ROM_SYSTEM_BIOS( 2, "atdiag", "IBM PC/AT 5170 w/Super Diagnostics") +// ROMX_LOAD("atdiage.bin", 0xf8000, 0x4000, CRC(e8855d0c) SHA1(c9d53e61c08da0a64f43d691bf6cadae5393843a), ROM_SKIP(1) | ROM_BIOS(3)) +// ROMX_LOAD("atdiago.bin", 0xf8001, 0x4000, CRC(606fa71d) SHA1(165e45bae7ae2da274f1e645c763c5bfcbde027b), ROM_SKIP(1) | ROM_BIOS(3)) + + /* Mainboard PALS */ + ROM_REGION( 0x2000, "pals", 0 ) + ROM_LOAD("1501824_717750.mmipal14l4.u87.jed", 0x0000, 0x02E7, CRC(3c819a27) SHA1(d2f4889e628dbbef50b7f48cb1d1a313232bacc8)) /* MMI 1501824 717750 // (C)1983 IBM(M) */ + ROM_LOAD("1503135_705075.mmipal14l4.u130.jed", 0x02E7, 0x02E7, CRC(aac77198) SHA1(b318da3a1fbe5402836c1b548e231e0794d0c032)) /* MMI 1503135 705075 // (C) IBM CORP 83 */ + /* P/N 6320947 Serial/Parallel ISA expansion card PAL */ + ROM_LOAD("1503085.mmipal.u14.jed", 0x1000, 0x0800, NO_DUMP) /* MMI 1503085 8449 // (C) IBM CORP 83 */ /* Not sure of type */ + + /* Mainboard PROMS */ + ROM_REGION( 0x2000, "proms", 0 ) + ROM_LOAD("1501814.82s123an.u115", 0x0000, 0x0020, CRC(849c9217) SHA1(2955ae1705c3b59170f1373f99b3ea5c174c4544)) /* N82S123AN 8713 // SK-D 1501814 */ + ROM_LOAD("55x8041.82s147an.u72", 0x0020, 0x0200, CRC(f2cc4fe6) SHA1(e285468516bd05083155a8a272583deef655315a)) /* S N82S147AN 8709 // V-C55X8041 */ +ROM_END + +ROM_START( ec1842 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_LOAD16_BYTE( "4202004.bin", 0xfc001, 0x2000, CRC(33fb5382) SHA1(35eb62328324d93e7a06f2f9d1ad0002f83fc99b)) + ROM_LOAD16_BYTE( "4202005.bin", 0xfc000, 0x2000, CRC(8e05c119) SHA1(9d81613b4fc305c14ae9fda0b1dd97a290715530)) + ROM_LOAD16_BYTE( "4202006.bin", 0xf8001, 0x2000, CRC(6da537ef) SHA1(f79feb433dcf41f5cdef52b845e3550d5f0fb5c0)) + ROM_LOAD16_BYTE( "4202007.bin", 0xf8000, 0x2000, CRC(d6ee0e95) SHA1(6fd4c42190e879501198fede70ae43bc420681d0)) + // EGA ROM + ROM_LOAD16_BYTE( "4200009.bin", 0xc0000, 0x2000, CRC(9deeb39f) SHA1(255b859d3ea05891aa65a4a742ecaba744dfc923)) + ROM_LOAD16_BYTE( "4200010.bin", 0xc0001, 0x2000, CRC(f2c38d93) SHA1(dcb3741d06089bf1a80cb766a6b94029ad698d73)) +ROM_END + +ROM_START( ec1849 ) + ROM_REGION16_LE(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "cpu-card_27c256_015.rom", 0xf0000, 0x8000, CRC(68eadf0a) SHA1(903a7f1c3ebc6b27c31b512b2908c483608b5c13)) + ROM_LOAD16_BYTE( "cpu-card_27c256_016.rom", 0xf0001, 0x8000, CRC(bc3924d6) SHA1(596be415e6c2bc4ff30a187f146664531565712c)) + ROM_LOAD16_BYTE( "video-card_573rf6( 2764)_040.rom", 0xc0001, 0x2000, CRC(a3ece315) SHA1(e800e11c3b1b6fcaf41bfb7d4058a9d34fdd2b3f)) + ROM_LOAD16_BYTE( "video-card_573rf6( 2764)_041.rom", 0xc0000, 0x2000, CRC(b0a2ba7f) SHA1(c8160e8bc97cd391558f1dddd3fd3ec4a19d030c)) +ROM_END + +ROM_START( ibm5170a ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_SYSTEM_BIOS( 0, "rev3", "IBM PC/AT 5170 11/15/85") + ROMX_LOAD("61x9266.u27", 0xf0000, 0x8000, CRC(4995be7a) SHA1(8e8e5c863ae3b8c55fd394e345d8cca48b6e575c), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("61x9265.u47", 0xf0001, 0x8000, CRC(c32713e4) SHA1(22ed4e2be9f948682891e2fd056a97dbea01203c), ROM_SKIP(1) | ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "3270at", "IBM 3270 PC/AT 5281 11/15/85") /* pretty much just a part string and checksum change from the 5170 rev3 */ + ROMX_LOAD("62x0820.u27", 0xf0000, 0x8000, CRC(e9cc3761) SHA1(ff9373c1a1f34a32fb6acdabc189c61b01acf9aa), ROM_SKIP(1) | ROM_BIOS(2)) /* T 62X0820-U27 8714HAK // TMM23256P-6746 // (C)IBM CORP 1981,-1985 */ + ROMX_LOAD("62x0821.u47", 0xf0001, 0x8000, CRC(b5978ccb) SHA1(2a1aeb9ae3cd7e60fc4c383ca026208b82156810), ROM_SKIP(1) | ROM_BIOS(2)) /* T 62X0821-U47 8715HAK // TMM23256P-6747 // (C)IBM CORP 1981,-1985 */ + + /* Mainboard PALS */ + ROM_REGION( 0x2000, "pals", 0 ) + ROM_LOAD("1501824_717750.mmipal14l4.u87.jed", 0x0000, 0x02E7, CRC(3c819a27) SHA1(d2f4889e628dbbef50b7f48cb1d1a313232bacc8)) /* MMI 1501824 717750 // (C)1983 IBM(M) */ + ROM_LOAD("1503135_705075.mmipal14l4.u130.jed", 0x02E7, 0x02E7, CRC(aac77198) SHA1(b318da3a1fbe5402836c1b548e231e0794d0c032)) /* MMI 1503135 705075 // (C) IBM CORP 83 */ /* P/N 6320947 Serial/Parallel ISA expansion card PAL */ + ROM_LOAD("1503085.mmipal.u14.jed", 0x1000, 0x0800, NO_DUMP) /* MMI 1503085 8449 // (C) IBM CORP 83 */ /* Not sure of type */ + + /* Mainboard PROMS */ + ROM_REGION( 0x2000, "proms", 0 ) + ROM_LOAD("1501814.82s123an.u115", 0x0000, 0x0020, CRC(849c9217) SHA1(2955ae1705c3b59170f1373f99b3ea5c174c4544)) /* N82S123AN 8713 // SK-D 1501814 */ + ROM_LOAD("55x8041.82s147an.u72", 0x0020, 0x0200, CRC(f2cc4fe6) SHA1(e285468516bd05083155a8a272583deef655315a)) /* S N82S147AN 8709 // V-C55X8041 */ +ROM_END + + +ROM_START( ibm5162 ) //MB p/n 62x1168 + ROM_REGION16_LE(0x1000000,"maincpu", 0) + + ROM_LOAD16_BYTE("78x7460.u34", 0xf0000, 0x8000, CRC(1db4bd8f) SHA1(7be669fbb998d8b4626fefa7cd1208d3b2a88c31)) /* 78X7460 U34 // (C) IBM CORP // 1981-1986 */ + ROM_LOAD16_BYTE("78x7461.u35", 0xf0001, 0x8000, CRC(be14b453) SHA1(ec7c10087dbd53f9c6d1174e8f14212e2aec1818)) /* 78X7461 U35 // (C) IBM CORP // 1981-1986 */ + + /* Mainboard PALS */ + ROM_REGION( 0x2000, "pals", 0 ) + ROM_LOAD("59x7599.mmipal20l8.u27.jed", 0x0000, 0x02E7, NO_DUMP) /* MMI PAL20L8ACN5 8631 // N59X7599 IBM (C)85 K3 */ + ROM_LOAD("1503135.mmipal14l4.u81.jed", 0x02E7, 0x02E7, CRC(aac77198) SHA1(b318da3a1fbe5402836c1b548e231e0794d0c032)) /* MMI 1503135 8625 // (C) IBM CORP 83 */ + /* P/N 6320947 Serial/Parallel ISA expansion card PAL */ + ROM_LOAD("1503085.mmipal.u14.jed", 0x1000, 0x0800, NO_DUMP) /* MMI 1503085 8449 // (C) IBM CORP 83 */ /* Not sure of type */ + + /* Mainboard PROMS */ + ROM_REGION( 0x2000, "proms", 0 ) + ROM_LOAD("1501814.82s123an.u72", 0x0000, 0x0020, CRC(849c9217) SHA1(2955ae1705c3b59170f1373f99b3ea5c174c4544)) /* N82S123AN 8623 // SK-U 1501814 */ + ROM_LOAD("59x7594.82s147an.u90", 0x0020, 0x0200, NO_DUMP) /* S N82S147AN 8629 // VCT 59X7594 */ +ROM_END + + +ROM_START( i8530286 ) + ROM_REGION(0x1000000,"maincpu", 0) + // saved from running machine + ROM_LOAD16_BYTE("ps2m30.0", 0xe0000, 0x10000, CRC(9965a634) SHA1(c237b1760f8a4561ec47dc70fe2e9df664e56596)) + ROM_RELOAD(0xfe0000,0x10000) + ROM_LOAD16_BYTE("ps2m30.1", 0xe0001, 0x10000, CRC(1448d3cb) SHA1(13fa26d895ce084278cd5ab1208fc16c80115ebe)) + ROM_RELOAD(0xfe0001,0x10000) +ROM_END + +/* + +8530-H31 (Model 30/286) +====================== + P/N Date +33F5381A EC C01446 1990 + +*/ +ROM_START( i8530h31 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD( "33f5381a.bin", 0xe0000, 0x20000, CRC(ff57057d) SHA1(d7f1777077a8df43c3c14d175b9709bd3969c4b1)) + ROM_RELOAD(0xfe0000,0x20000) +ROM_END + +/* +8535-043 (Model 35) +=================== + P/N Checksum Date +04G2021 C26C 1991 ODD +04G2022 9B94 1991 EVEN +*/ +ROM_START( i8535043 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "04g2021.bin", 0xe0001, 0x10000, CRC(4069b2eb) SHA1(9855c84c81d1f07e1da66b1ca45c1c10c0717a90)) + ROM_RELOAD(0xfe0001, 0x10000) + ROM_LOAD16_BYTE( "04g2022.bin", 0xe0000, 0x10000, CRC(35c1af65) SHA1(7d2445cc463969c808fdd78e0a27a03db5dfc698)) + ROM_RELOAD(0xfe0000, 0x10000) +ROM_END + +/* +8550-021 (Model 50) +=================== + Code Date Internal +90X7420 4/12/87 --> 90X6815 +90X7423 8/12/87 --> 90X6816 +90X7426 8/12/87 --> 90X6817 +90X7429 18/12/87 --> 90X6818 + +Same ROMs used by : (According to http://www.ibmmuseum.com/ohlandl/8565/8560.html) + +IBM Personal System/2 Model 60 (8560-041 and 8560-071) +IBM Personal System/2 Model 65 SX (8565-061 and 8565-121) + +*/ +ROM_START( i8550021 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "90x7423.zm14", 0xe0000, 0x8000, CRC(2c1633e0) SHA1(1af7faa526585a7cfb69e71d90a75e1f1c541586)) + ROM_RELOAD(0xfe0000, 0x8000) + ROM_LOAD16_BYTE( "90x7426.zm16", 0xe0001, 0x8000, CRC(e7c762ce) SHA1(228f67dc915d84519da7fc1a59b7f9254278f3a0)) + ROM_RELOAD(0xfe0001, 0x8000) + ROM_LOAD16_BYTE( "90x7420.zm13", 0xf0001, 0x8000, CRC(19a57cc1) SHA1(5b31ba66cd3690e651a450619a32b7210769945d)) + ROM_RELOAD(0xff0001, 0x8000) + ROM_LOAD16_BYTE( "90x7429.zm18", 0xf0000, 0x8000, CRC(6f0120f6) SHA1(e112c291ac3d9f6507c93ac49ad26f9fd2245fd2)) + ROM_RELOAD(0xff0000, 0x8000) + + ROM_REGION( 0x800, "keyboard", 0 ) + ROM_LOAD( "72x8455.zm82", 0x000, 0x800, CRC(7da223d3) SHA1(54c52ff6c6a2310f79b2c7e6d1259be9de868f0e) ) +ROM_END + +/* +8550-061 (Model 50Z) +=================== + P/N Date +AMI 8935MKN 15F8365 S63512 1988 +AMI 8948MML 15F8366 S63512 1988 + +http://ps-2.kev009.com:8081/ohlandl/8550/8550z_Planar.html + + +*/ +ROM_START( i8550061 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "15f8365.zm5", 0xe0001, 0x10000, CRC(35aa3ecf) SHA1(a122531092a9cb08600b276da9c9c3ce385aab7b)) + ROM_RELOAD(0xfe0001, 0x10000) + ROM_LOAD16_BYTE( "15f8366.zm6", 0xe0000, 0x10000, CRC(11bf564d) SHA1(0dda6a7ca9294cfaab5bdf4c05973be13b2766fc)) + ROM_RELOAD(0xfe0000, 0x10000) +ROM_END + +/* +8555-X61 (Model 55SX) +=================== + Code Date Internal +ODD 33F8145 13/03/90 --> 33F8153 +EVEN 33F8146 31/01/90 --> 33F8152 + +8555-081 (Model 55SX) +=================== + Code Date Internal +ODD AMI 9205MEN 92F0627 EC32680 88 --> 33F8153 +EVEN AMI 9203MGS 92F0626 EC32680 88 --> 33F8152 + +*/ +ROM_START( i8555081 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE("33f8145.zm40", 0xe0001, 0x10000, CRC(0895894c) SHA1(7cee77828867ad1bdbe0ac223bc25d23c65b28a0)) + ROM_RELOAD(0xfe0001, 0x10000) + ROM_LOAD16_BYTE("33f8146.zm41", 0xe0000, 0x10000, CRC(c6020680) SHA1(b25a64e4b2dca07c567648401100e04e89bbcddb)) + ROM_RELOAD(0xfe0000, 0x10000) +ROM_END + +/* +8580-071 (Model 80) +=================== + Code Date Internal +AMI 8924MBW 90X8548 1987 --> 72X7551 +AMI 8924MBL 90X8549 1987 --> 72X7554 +AMI 8924MBG 90X8550 1987 --> 72X7557 +AMI 8921MBK 90X8551 1987 --> 72X7560 +*/ +ROM_START( i8580071 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD( "90x8548.bin", 0xe0000, 0x8000, CRC(1f13eea5) SHA1(0bf53ad86f47db3825a713ea2e4ef23715cc4f79)) + ROM_LOAD( "90x8549.bin", 0xe0001, 0x8000, CRC(9e0f4a99) SHA1(b8600f04159ed281a57416274390ba9302be541b)) + ROM_LOAD( "90x8550.bin", 0xf0000, 0x8000, CRC(cb21df96) SHA1(0c2765f6becfa3f9171c4f13f7b74d19c4c9acc2)) + ROM_LOAD( "90x8551.bin", 0xf0001, 0x8000, CRC(3d7e9868) SHA1(2928fe0e48a573cc2c0c41bd7f7188a54a908229)) +ROM_END + +/* +8580-111 (Model 80) +=================== + Code Date Internal +AMI 8934MDL 15F6637 1987 --> 15F6597 +AMI 8944MDI 15F6639 1987 --> 15F6600 +*/ +ROM_START( i8580111 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "15f6637.bin", 0xe0000, 0x10000, CRC(76c36d1a) SHA1(c68d52a2e5fbd303225ebb006f91869b29ef700a)) + ROM_LOAD16_BYTE( "15f6639.bin", 0xe0001, 0x10000, CRC(82cf0f7d) SHA1(13bb39225757b89749af70e881af0228673dbe0c)) +ROM_END + +ROM_START( ibmps1es ) + ROM_REGION(0x1000000, "maincpu", 0) + ROM_LOAD16_BYTE( "ibm_1057757_24-05-90.bin", 0xc0000, 0x20000, CRC(c8f81ea4) SHA1(925ed0e98f9f2997cb86554ef384bcfaf2a4ecbe)) + ROM_LOAD16_BYTE( "ibm_1057757_29-15-90.bin", 0xc0001, 0x20000, CRC(c2dd6b5c) SHA1(f6b5785002dd628b6b1fb3bb101e076299eba3b6)) +ROM_END + +ROM_START( at ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "ami211", "AMI 21.1") /*(Motherboard Manufacturer: Dataexpert Corp. Motherboard) (Neat 286 Bios, 82c21x Chipset ) (BIOS release date:: 09-04-1990)*/ + ROMX_LOAD( "ami211.bin", 0xf0000, 0x10000,CRC(a0b5d269) SHA1(44db8227d35a09e39b93ed944f85dcddb0dd0d39), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "at", "PC 286") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 03-11-1987)*/ + ROMX_LOAD("at110387.1", 0xf0001, 0x8000, CRC(679296a7) SHA1(ae891314cac614dfece686d8e1d74f4763cf40e3),ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD("at110387.0", 0xf0000, 0x8000, CRC(65ae1f97) SHA1(91a29c7deecf7a9afbba330e64e0eee9aafee4d1),ROM_SKIP(1) | ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "ami206", "AMI C 206.1") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 15-10-1990)*/ + ROMX_LOAD( "amic206.bin", 0xf0000, 0x10000,CRC(25a67c34) SHA1(91e9d8cdc2f1b40a601a23ceaff2189fd1245f3b), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "amic21", "AMI C 21.1") /* bad dump, checksum off by 8 in the lsb*/ + ROMX_LOAD( "amic21-2.bin", 0xf0001, 0x8000, CRC(8ffe7752) SHA1(68215f07a170ee7bdcb3e52b370d470af1741f7e),ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "amic21-1.bin", 0xf0000, 0x8000, CRC(5644ed38) SHA1(963555ec77845defc3b42b433280908e1797076e),ROM_SKIP(1) | ROM_BIOS(4) ) + ROM_SYSTEM_BIOS(4, "ami101", "AMI HT 101.1") /* Quadtel Enhanced 286 Bios Version 3.04.02 */ + ROMX_LOAD( "amiht-h.bin", 0xf0001, 0x8000, CRC(8022545f) SHA1(42541d4392ad00b0e064b3a8ccf2786d875c7c19),ROM_SKIP(1) | ROM_BIOS(5) ) + ROMX_LOAD( "amiht-l.bin", 0xf0000, 0x8000, CRC(285f6b8f) SHA1(2fce4ec53b68c9a7580858e16c926dc907820872),ROM_SKIP(1) | ROM_BIOS(5) ) + ROM_SYSTEM_BIOS(5, "ami121", "AMI HT 12.1") + ROMX_LOAD( "ami2od86.bin", 0xf0001, 0x8000, CRC(04a2cec4) SHA1(564d37a8b2c0f4d0e23cd1e280a09d47c9945da8),ROM_SKIP(1) | ROM_BIOS(6) ) + ROMX_LOAD( "ami2ev86.bin", 0xf0000, 0x8000, CRC(55deb5c2) SHA1(19ce1a7cc985b5895c585e39211475de2e3b0dd1),ROM_SKIP(1) | ROM_BIOS(6) ) + ROM_SYSTEM_BIOS(6, "ami122", "AMI HT 12.2") + ROMX_LOAD( "ami2od89.bin", 0xf0001, 0x8000, CRC(7c81bbe8) SHA1(a2c7eca586f6e2e76b9101191e080a1f1cb8b833),ROM_SKIP(1) | ROM_BIOS(7) ) + ROMX_LOAD( "ami2ev89.bin", 0xf0000, 0x8000, CRC(705d36e0) SHA1(0c9cfb71ced4587f109b9b6dfc2a9c92302fdb99),ROM_SKIP(1) | ROM_BIOS(7) ) + ROM_SYSTEM_BIOS(7, "ami123", "AMI HT 12.3") /*(Motherboard Manufacturer: Aquarius Systems USA Inc.) (BIOS release date:: 13-06-1990)*/ + ROMX_LOAD( "ht12h.bin", 0xf0001, 0x8000, CRC(db8b471e) SHA1(7b5fa1c131061fa7719247db3e282f6d30226778),ROM_SKIP(1) | ROM_BIOS(8) ) + ROMX_LOAD( "ht12l.bin", 0xf0000, 0x8000, CRC(74fd178a) SHA1(97c8283e574abbed962b701f3e8091fb82823b80),ROM_SKIP(1) | ROM_BIOS(8) ) + ROM_SYSTEM_BIOS(8, "ami181", "AMI HT 18.1") /* not a bad dump, sets unknown probably chipset related registers at 0x1e8 before failing post */ + ROMX_LOAD( "ht18.bin", 0xf0000, 0x10000, CRC(f65a6f9a) SHA1(7dfdf7d243f9f645165dc009c5097dd515f86fbb), ROM_BIOS(9) ) + ROM_SYSTEM_BIOS(9, "amiht21", "AMI HT 21.1") /* as above */ + ROMX_LOAD( "ht21e.bin", 0xf0000, 0x10000, CRC(e80f7fed) SHA1(62d958d98c95e9e4d1b290a6c1054ae98770f276), ROM_BIOS(10) ) + ROM_SYSTEM_BIOS(10, "amip1", "AMI P.1") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 09-04-1990)*/ + ROMX_LOAD( "poisk-h.bin", 0xf0001, 0x8000, CRC(83fd3f8c) SHA1(ca94850bbd949b97b11710629886b0ee69489a81),ROM_SKIP(1) | ROM_BIOS(11) ) + ROMX_LOAD( "poisk-l.bin", 0xf0000, 0x8000, CRC(0b2ed291) SHA1(bb51a3f317cf4d429a6cfb44a46ca0ac39d9aaa7),ROM_SKIP(1) | ROM_BIOS(11) ) + ROM_SYSTEM_BIOS(11, "aw201", "Award 201") + ROMX_LOAD( "83201-5h.bin", 0xf0001, 0x8000, CRC(968d1fc0) SHA1(dc4122a6c696f0b43e7894dc1b669346eed755d5),ROM_SKIP(1) | ROM_BIOS(12) ) + ROMX_LOAD( "83201-5l.bin", 0xf0000, 0x8000, CRC(bf50a89a) SHA1(2349a1db6017a7fb0673e99d3680c8753407be8d),ROM_SKIP(1) | ROM_BIOS(12) ) + ROM_SYSTEM_BIOS(12, "aw303", "Award 303 NFS") + ROMX_LOAD( "aw303-hi.bin", 0xf8001, 0x4000, CRC(78f32d7e) SHA1(1c88398fb171b33b7e6191bad63704ae85bfed8b), ROM_SKIP(1) | ROM_BIOS(13) ) + ROMX_LOAD( "aw303-lo.bin", 0xf8000, 0x4000, CRC(3d2a70c0) SHA1(1329113bec514ed2a6d803067b1132744ef534dd), ROM_SKIP(1) | ROM_BIOS(13) ) + ROM_SYSTEM_BIOS(13, "aw303gs", "Award 303GS") + ROMX_LOAD( "aw303gs-hi.bin", 0xf8001, 0x4000, CRC(82392e18) SHA1(042453b7b29933a1b72301d21fcf8fa6b293c9c9), ROM_SKIP(1) | ROM_BIOS(14) ) + ROMX_LOAD( "aw303gs-lo.bin", 0xf8000, 0x4000, CRC(a4cf8ba1) SHA1(b73e34be3b2754aaed1ac06471f4441fea06c67c), ROM_SKIP(1) | ROM_BIOS(14) ) +ROM_END + +ROM_START( cmdpc30 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROMX_LOAD( "commodore pc 30 iii even.bin", 0xf8000, 0x4000, CRC(36307aa9) SHA1(50237ffea703b867de426ab9ebc2af46bac1d0e1),ROM_SKIP(1)) + ROMX_LOAD( "commodore pc 30 iii odd.bin", 0xf8001, 0x4000, CRC(41bae42d) SHA1(27d6ad9554be86359d44331f25591e3122a31519),ROM_SKIP(1)) +ROM_END + +ROM_START( atvga ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "vl82c", "VL82C311L-FC4")/*(Motherboard Manufacturer: Biostar Microtech Corp.) (BIOS release date: 05-05-1991)*/ + ROMX_LOAD( "2vlm001.bin", 0xf0000, 0x10000, CRC(f34d800a) SHA1(638aca592a0e525f957beb525e95ca666a994ee8), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "ami211", "AMI 21.1") /*(Motherboard Manufacturer: Dataexpert Corp. Motherboard) (Neat 286 Bios, 82c21x Chipset ) (BIOS release date:: 09-04-1990)*/ + ROMX_LOAD( "ami211.bin", 0xf0000, 0x10000,CRC(a0b5d269) SHA1(44db8227d35a09e39b93ed944f85dcddb0dd0d39), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "ami206", "AMI C 206.1") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 15-10-1990)*/ + ROMX_LOAD( "amic206.bin", 0xf0000, 0x10000,CRC(25a67c34) SHA1(91e9d8cdc2f1b40a601a23ceaff2189fd1245f3b), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "amic21", "AMI C 21.1") /* bad dump, checksum off by 8 in the lsb*/ + ROMX_LOAD( "amic21-2.bin", 0xf0001, 0x8000, CRC(8ffe7752) SHA1(68215f07a170ee7bdcb3e52b370d470af1741f7e),ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "amic21-1.bin", 0xf0000, 0x8000, CRC(5644ed38) SHA1(963555ec77845defc3b42b433280908e1797076e),ROM_SKIP(1) | ROM_BIOS(4) ) + ROM_SYSTEM_BIOS(4, "ami101", "AMI HT 101.1") /* Quadtel Enhanced 286 Bios Version 3.04.02 */ + ROMX_LOAD( "amiht-h.bin", 0xf0001, 0x8000, CRC(8022545f) SHA1(42541d4392ad00b0e064b3a8ccf2786d875c7c19),ROM_SKIP(1) | ROM_BIOS(5) ) + ROMX_LOAD( "amiht-l.bin", 0xf0000, 0x8000, CRC(285f6b8f) SHA1(2fce4ec53b68c9a7580858e16c926dc907820872),ROM_SKIP(1) | ROM_BIOS(5) ) + ROM_SYSTEM_BIOS(5, "ami121", "AMI HT 12.1") + ROMX_LOAD( "ami2od86.bin", 0xf0001, 0x8000, CRC(04a2cec4) SHA1(564d37a8b2c0f4d0e23cd1e280a09d47c9945da8),ROM_SKIP(1) | ROM_BIOS(6) ) + ROMX_LOAD( "ami2ev86.bin", 0xf0000, 0x8000, CRC(55deb5c2) SHA1(19ce1a7cc985b5895c585e39211475de2e3b0dd1),ROM_SKIP(1) | ROM_BIOS(6) ) + ROM_SYSTEM_BIOS(6, "ami122", "AMI HT 12.2") + ROMX_LOAD( "ami2od89.bin", 0xf0001, 0x8000, CRC(7c81bbe8) SHA1(a2c7eca586f6e2e76b9101191e080a1f1cb8b833),ROM_SKIP(1) | ROM_BIOS(7) ) + ROMX_LOAD( "ami2ev89.bin", 0xf0000, 0x8000, CRC(705d36e0) SHA1(0c9cfb71ced4587f109b9b6dfc2a9c92302fdb99),ROM_SKIP(1) | ROM_BIOS(7) ) + ROM_SYSTEM_BIOS(7, "ami123", "AMI HT 12.3") /*(Motherboard Manufacturer: Aquarius Systems USA Inc.) (BIOS release date:: 13-06-1990)*/ + ROMX_LOAD( "ht12h.bin", 0xf0001, 0x8000, CRC(db8b471e) SHA1(7b5fa1c131061fa7719247db3e282f6d30226778),ROM_SKIP(1) | ROM_BIOS(8) ) + ROMX_LOAD( "ht12l.bin", 0xf0000, 0x8000, CRC(74fd178a) SHA1(97c8283e574abbed962b701f3e8091fb82823b80),ROM_SKIP(1) | ROM_BIOS(8) ) + ROM_SYSTEM_BIOS(8, "ami181", "AMI HT 18.1") /* not a bad dump, sets unknown probably chipset related registers at 0x1e8 before failing post */ + ROMX_LOAD( "ht18.bin", 0xf0000, 0x10000, CRC(f65a6f9a) SHA1(7dfdf7d243f9f645165dc009c5097dd515f86fbb), ROM_BIOS(9) ) + ROM_SYSTEM_BIOS(9, "amiht21", "AMI HT 21.1") /* as above */ + ROMX_LOAD( "ht21e.bin", 0xf0000, 0x10000, CRC(e80f7fed) SHA1(62d958d98c95e9e4d1b290a6c1054ae98770f276), ROM_BIOS(10) ) + ROM_SYSTEM_BIOS(10, "amip1", "AMI P.1") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 09-04-1990)*/ + ROMX_LOAD( "poisk-h.bin", 0xf0001, 0x8000, CRC(83fd3f8c) SHA1(ca94850bbd949b97b11710629886b0ee69489a81),ROM_SKIP(1) | ROM_BIOS(11) ) + ROMX_LOAD( "poisk-l.bin", 0xf0000, 0x8000, CRC(0b2ed291) SHA1(bb51a3f317cf4d429a6cfb44a46ca0ac39d9aaa7),ROM_SKIP(1) | ROM_BIOS(11) ) + ROM_SYSTEM_BIOS(11, "ami1131", "AMI-1131") /*(Motherboard Manufacturer: Elitegroup Computer Co., Ltd.) (BIOS release date:: 09-04-1990)*/ + ROMX_LOAD( "2hlm003h.bin", 0xf0001, 0x8000, CRC(2babb42b) SHA1(3da6538f44b434cdec0cbdddd392ccfd34666f06),ROM_SKIP(1) | ROM_BIOS(12) ) + ROMX_LOAD( "2hlm003l.bin", 0xf0000, 0x8000, CRC(317cbcbf) SHA1(1adad6280d8b07c2921fc5fc13ecaa10e6bfebdc),ROM_SKIP(1) | ROM_BIOS(12) ) + ROM_SYSTEM_BIOS(12, "at", "PC 286") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 03-11-1987)*/ + ROMX_LOAD("at110387.1", 0xf0001, 0x8000, CRC(679296a7) SHA1(ae891314cac614dfece686d8e1d74f4763cf40e3),ROM_SKIP(1) | ROM_BIOS(13) ) + ROMX_LOAD("at110387.0", 0xf0000, 0x8000, CRC(65ae1f97) SHA1(91a29c7deecf7a9afbba330e64e0eee9aafee4d1),ROM_SKIP(1) | ROM_BIOS(13) ) +ROM_END + +ROM_START( xb42639 ) + /* actual VGA BIOS not dumped*/ + ROM_REGION(0x1000000, "maincpu", 0) + // XEN-S (Venus I Motherboard) + ROM_LOAD16_BYTE("3-10-17i.lo", 0xf0000, 0x8000, CRC(3786ca1e) SHA1(c682d7c76f234559d03bcf21010c13c4dbeafb69)) + ROM_RELOAD(0xff0000,0x8000) + ROM_LOAD16_BYTE("3-10-17i.hi", 0xf0001, 0x8000, CRC(d66710eb) SHA1(e8c1cd5f9ecfbd8825655e416d7ddf2ae362e69b)) + ROM_RELOAD(0xff0001,0x8000) +ROM_END + +ROM_START( xb42639a ) + /* actual VGA BIOS not dumped*/ + ROM_REGION(0x1000000, "maincpu", 0) + // XEN-S (Venus II Motherboard) + ROM_LOAD16_BYTE("10217.lo", 0xf0000, 0x8000, CRC(ea53406f) SHA1(2958dfdbda14de4e6b9d6a8c3781131ab1e32bef)) + ROM_RELOAD(0xff0000,0x8000) + ROM_LOAD16_BYTE("10217.hi", 0xf0001, 0x8000, CRC(111725cf) SHA1(f6018a45bda4476d40c5881fb0a506ff75ec1688)) + ROM_RELOAD(0xff0001,0x8000) +ROM_END + +ROM_START( xb42664 ) + /* actual VGA BIOS not dumped */ + ROM_REGION(0x1000000, "maincpu", 0) + // XEN-S (Venus I Motherboard) + ROM_LOAD16_BYTE("3-10-17i.lo", 0xf0000, 0x8000, CRC(3786ca1e) SHA1(c682d7c76f234559d03bcf21010c13c4dbeafb69)) + ROM_RELOAD(0xff0000,0x8000) + ROM_LOAD16_BYTE("3-10-17i.hi", 0xf0001, 0x8000, CRC(d66710eb) SHA1(e8c1cd5f9ecfbd8825655e416d7ddf2ae362e69b)) + ROM_RELOAD(0xff0001,0x8000) +ROM_END + +ROM_START( xb42664a ) + /* actual VGA BIOS not dumped*/ + ROM_REGION(0x1000000, "maincpu", 0) + // XEN-S (Venus II Motherboard) + ROM_LOAD16_BYTE("10217.lo", 0xf0000, 0x8000, CRC(ea53406f) SHA1(2958dfdbda14de4e6b9d6a8c3781131ab1e32bef)) + ROM_RELOAD(0xff0000,0x8000) + ROM_LOAD16_BYTE("10217.hi", 0xf0001, 0x8000, CRC(111725cf) SHA1(f6018a45bda4476d40c5881fb0a506ff75ec1688)) + ROM_RELOAD(0xff0001,0x8000) +ROM_END + + +ROM_START( neat ) + ROM_REGION(0x1000000,"maincpu", 0) + //ROM_SYSTEM_BIOS(0, "neat286", "NEAT 286") + ROM_LOAD16_BYTE("at030389.0", 0xf0000, 0x8000, CRC(4c36e61d) SHA1(094e8d5e6819889163cb22a2cf559186de782582)) + //ROM_RELOAD(0xff0000,0x8000) + ROM_LOAD16_BYTE("at030389.1", 0xf0001, 0x8000, CRC(4e90f294) SHA1(18c21fd8d7e959e2292a9afbbaf78310f9cad12f)) + //ROM_RELOAD(0xff0001,0x8000) +ROM_END + +ROM_START( ct386sx ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "neatsx", "NEATsx 386sx") + ROMX_LOAD("012l-u25.bin", 0xf0000, 0x8000, CRC(4ab1862d) SHA1(d4e8d0ff43731270478ca7671a129080ff350a4f),ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD("012h-u24.bin", 0xf0001, 0x8000, CRC(17472521) SHA1(7588c148fe53d9dc4cb2d0ab6e0fd51a39bb5d1a),ROM_SKIP(1) | ROM_BIOS(1) ) + ROM_FILL(0xfe2c9, 1, 0) // skip incompatible keyboard controller test + ROM_FILL(0xfe2cb, 1, 0xbb) // fix checksum +ROM_END + +ROM_START( at386 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "ami386", "AMI 386") + ROMX_LOAD("ami386.bin", 0xf0000, 0x10000, CRC(3a807d7f) SHA1(8289ba36a3dfc3324333b1a834bc6b0402b546f0), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "at386", "unknown 386") // This dump possibly comes from a MITAC INC 386 board, given that the original driver had it as manufacturer + ROMX_LOAD("at386.bin", 0xf0000, 0x10000, CRC(3df9732a) SHA1(def71567dee373dc67063f204ef44ffab9453ead), ROM_BIOS(2)) + //ROM_RELOAD(0xff0000,0x10000) + + ROM_SYSTEM_BIOS(2, "amicg", "AMI CG") + ROMX_LOAD( "amicg.1", 0xf0000, 0x10000,CRC(8408965a) SHA1(9893d3ac851e01b06a68a67d3721df36ca2c96f5), ROM_BIOS(3) ) +ROM_END + + +ROM_START( at486 ) + ROM_REGION(0x1000000, "maincpu", 0) + + ROM_SYSTEM_BIOS(0, "at486", "PC/AT 486") + ROMX_LOAD("at486.bin", 0x0f0000, 0x10000, CRC(31214616) SHA1(51b41fa44d92151025fc9ad06e518e906935e689), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "mg48602", "UMC MG-48602") + ROMX_LOAD("mg48602.bin", 0x0f0000, 0x10000, CRC(45797823) SHA1(a5fab258aecabde615e1e97af5911d6cf9938c11), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "ft01232", "Free Tech 01-232") + ROMX_LOAD("ft01232.bin", 0x0f0000, 0x10000, CRC(30efaf92) SHA1(665c8ef05ca052dcc06bb473c9539546bfef1e86), ROM_BIOS(3)) + + /* 486 boards from FIC + + naming convention + xxxxx101 --> for EPROM + xxxxx701 --> for EEPROM using a Flash Utility v5.02 + xxxxBxxx --> NS 311/312 IO Core Logic + xxxxCxxx --> NS 332 IO Core Logic + xxxxGxxx --> Winbond W83787F IO Core Logic + xxxxJxxx --> Winbond W83877F IO Core Logic + + */ + + /* this is the year 2000 beta bios from FIC, supports GIO-VT, GAC-V, GAC-2, VIP-IO, VIO-VP and GVT-2 */ + ROM_SYSTEM_BIOS(3, "ficy2k", "FIC 486 3.276GN1") /* 1997-06-16, includes CL-GD5429 VGA BIOS 1.00a */ + ROMX_LOAD("3276gn1.bin", 0x0e0000, 0x20000, CRC(d4ff0cc4) SHA1(567b6bdbc9bff306c8c955f275e01ae4c45fd5f2), ROM_BIOS(4)) + + ROM_SYSTEM_BIOS(4, "ficgac2", "FIC 486-GAC-2") /* 1994-04-29, includes CL-GD542X VGA BIOS 1.50 */ + ROMX_LOAD("att409be.bin", 0x0e0000, 0x20000, CRC(c58e017b) SHA1(14c19e720ce62eb2afe28a70f4e4ebafab0f9e77), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "ficgacv", "FIC 486-GAC-V 3.27GN1") /* 1996-04-08, includes CL-GD542X VGA BIOS 1.41 */ + ROMX_LOAD("327gn1.awd", 0x0e0000, 0x20000, CRC(017614d4) SHA1(2228c28f21a7e78033d24319449297936465b164), ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "ficgiovp", "FIC 486-GIO-VP 3.15GN") /* 1994-05-06 */ + ROMX_LOAD("giovp315.rom", 0x0f0000, 0x10000, CRC(e102c3f5) SHA1(f15a7e9311cc17afe86da0b369607768b030ddec), ROM_BIOS(7)) + ROM_SYSTEM_BIOS(7, "ficgiovt", "FIC 486-GIO-VT 3.06G") /* 1994-11-20 */ + ROMX_LOAD("306gcd00.awd", 0x0f0000, 0x10000, CRC(75f3ded4) SHA1(999d4b58204e0b0f33262d0613c855b528bf9597), ROM_BIOS(8)) + + ROM_SYSTEM_BIOS(8, "ficgiovt2_326", "FIC 486-GIO-VT2 3.26G") /* 1994-07-06 */ + ROMX_LOAD("326g1c00.awd", 0x0f0000, 0x10000, CRC(2e729ab5) SHA1(b713f97fa0e0b62856dab917f417f5b21020b354), ROM_BIOS(9)) + ROM_SYSTEM_BIOS(9, "ficgiovt2_3276", "FIC 486-GIO-VT2 3.276") /* 1997-07-17 */ + ROMX_LOAD("32760000.bin", 0x0f0000, 0x10000, CRC(ad179128) SHA1(595f67ba4a1c8eb5e118d75bf657fff3803dcf4f), ROM_BIOS(10)) + + ROM_SYSTEM_BIOS(10, "ficgvt2", "FIC 486-GVT-2 3.07G") /* 1994-11-02 */ + ROMX_LOAD("3073.bin", 0x0f0000, 0x10000, CRC(a6723863) SHA1(ee93a2f1ec84a3d67e267d0a490029f9165f1533), ROM_BIOS(11)) + ROM_SYSTEM_BIOS(11, "ficgpak2", "FIC 486-PAK-2 5.15S") /* 1995-06-27, includes Phoenix S3 TRIO64 Enhanced VGA BIOS 1.4-01 */ + ROMX_LOAD("515sbd8a.awd", 0x0e0000, 0x20000, CRC(778247e1) SHA1(07d8f0f2464abf507be1e8dfa06cd88737782411), ROM_BIOS(12)) + + ROM_SYSTEM_BIOS(12, "ficpio3g7", "FIC 486-PIO-3 1.15G705") /* pnp */ + ROMX_LOAD("115g705.awd", 0x0e0000, 0x20000, CRC(ddb1544a) SHA1(d165c9ecdc9397789abddfe0fef69fdf954fa41b), ROM_BIOS(13)) + ROM_SYSTEM_BIOS(13, "ficpio3g1", "FIC 486-PIO-3 1.15G105") /* non-pnp */ + ROMX_LOAD("115g105.awd", 0x0e0000, 0x20000, CRC(b327eb83) SHA1(9e1ff53e07ca035d8d43951bac345fec7131678d), ROM_BIOS(14)) + + ROM_SYSTEM_BIOS(14, "ficpos", "FIC 486-POS") + ROMX_LOAD("116di6b7.bin", 0x0e0000, 0x20000, CRC(d1d84616) SHA1(2f2b27ce100cf784260d8e155b48db8cfbc63285), ROM_BIOS(15)) + ROM_SYSTEM_BIOS(15, "ficpvt", "FIC 486-PVT 5.15") /* 1995-06-27 */ + ROMX_LOAD("5150eef3.awd", 0x0e0000, 0x20000, CRC(eb35785d) SHA1(1e601bc8da73f22f11effe9cdf5a84d52576142b), ROM_BIOS(16)) + ROM_SYSTEM_BIOS(16, "ficpvtio", "FIC 486-PVT-IO 5.162W2") /* 1995-10-05 */ + ROMX_LOAD("5162cf37.awd", 0x0e0000, 0x20000, CRC(378d813d) SHA1(aa674eff5b972b31924941534c3c988f6f78dc93), ROM_BIOS(17)) + ROM_SYSTEM_BIOS(17, "ficvipio426", "FIC 486-VIP-IO 4.26GN2") /* 1994-12-07 */ + ROMX_LOAD("426gn2.awd", 0x0e0000, 0x20000, CRC(5f472aa9) SHA1(9160abefae32b450e973651c052657b4becc72ba), ROM_BIOS(18)) + ROM_SYSTEM_BIOS(18, "ficvipio427", "FIC 486-VIP-IO 4.27GN2A") /* 1996-02-14 */ + ROMX_LOAD("427gn2a.awd", 0x0e0000, 0x20000, CRC(035ad56d) SHA1(0086db3eff711fc710b30e7f422fc5b4ab8d47aa), ROM_BIOS(19)) + ROM_SYSTEM_BIOS(19, "ficvipio2", "FIC 486-VIP-IO2") + ROMX_LOAD("1164g701.awd", 0x0e0000, 0x20000, CRC(7b762683) SHA1(84debce7239c8b1978246688ae538f7c4f519d13), ROM_BIOS(20)) + + ROM_SYSTEM_BIOS(20, "qdi", "QDI PX486DX33/50P3") + ROMX_LOAD("qdi_px486.u23", 0x0f0000, 0x10000, CRC(c80ecfb6) SHA1(34cc9ef68ff719cd0771297bf184efa83a805f3e), ROM_BIOS(21)) +ROM_END + + +// FIC 486-PIO-2 (4 ISA, 4 PCI) +// VIA VT82C505 (ISA/VL to PCI bridge) + VT82C496G (system chipset) + VT82C406MV (keyboard controller, RTC, CMOS), NS311/312 or NS332 I/O +ROM_START( ficpio2 ) + ROM_REGION(0x40000, "isa", 0) + ROM_SYSTEM_BIOS(0, "ficpio2c7", "FIC 486-PIO-2 1.15C701") /* pnp, i/o core: NS 332, doesn't boot, requires cache emulation? */ + ROMX_LOAD("115c701.awd", 0x020000, 0x20000, CRC(b0dd7975) SHA1(bfde13b0fbd141bc945d37d92faca9f4f59b716d), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "ficpio2b7", "FIC 486-PIO-2 1.15B701") /* pnp, i/o core: NS 311/312, doesn't boot, requires cache emulation? */ + ROMX_LOAD("115b701.awd", 0x020000, 0x20000, CRC(ac24abad) SHA1(01174d84ed32fb1d95cd632d09f773acb8666c83), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "ficpio2c1", "FIC 486-PIO-2 1.15C101") /* non-pnp, i/o core: NS 332, working */ + ROMX_LOAD("115c101.awd", 0x020000, 0x20000, CRC(5fadde88) SHA1(eff79692c1ecf34b6ea3f02409d14ce1f5c51bf9), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "ficpio2b1", "FIC 486-PIO-2 1.15B101") /* non-pnp, i/o core: NS 311/312, working */ + ROMX_LOAD("115b101.awd", 0x020000, 0x20000, CRC(ff69617d) SHA1(ecbfc7315dcf6bd3e5b59e3ae9258759f64fe7a0), ROM_BIOS(4)) +ROM_END + + +ROM_START( at586 ) + ROM_REGION32_LE(0x40000, "isa", 0) + ROM_SYSTEM_BIOS(0, "sptx", "SP-586TX") + ROMX_LOAD("sp586tx.bin", 0x20000, 0x20000, CRC(1003d72c) SHA1(ec9224ff9b0fdfd6e462cb7bbf419875414739d6), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "unisys", "Unisys 586") // probably bad dump due to need of hack in i82439tx to work + ROMX_LOAD("at586.bin", 0x20000, 0x20000, CRC(717037f5) SHA1(1d49d1b7a4a40d07d1a897b7f8c827754d76f824), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(2, "ga586t2", "Gigabyte GA-586T2") // ITE 8679 I/O + ROMX_LOAD("gb_ga586t2.bin", 0x20000, 0x20000, CRC(3a50a6e1) SHA1(dea859b4f1492d0d08aacd260ed1e83e00ebac08), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "5tx52", "Acorp 5TX52") // W83877TF I/O + ROMX_LOAD("acorp_5tx52.bin", 0x20000, 0x20000, CRC(04d69419) SHA1(983377674fef05e710c8665c14cc348c99166fb6), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "txp4", "ASUS TXP4") // W83977TF-A I/O + ROMX_LOAD("asus_txp4.bin", 0x20000, 0x20000, CRC(a1321bb1) SHA1(92e5f14d8505119f85b148a63510617ac12bcdf3), ROM_BIOS(5)) +ROM_END + +ROM_START( at586x3 ) + ROM_REGION32_LE(0x40000, "isa", 0) + ROM_LOAD("5hx29.bin", 0x20000, 0x20000, CRC(07719a55) SHA1(b63993fd5186cdb4f28c117428a507cd069e1f68)) +ROM_END + +ROM_START( c386sx16 ) + ROM_REGION(0x1000000,"maincpu", 0) + /* actual VGA BIOS not dumped - uses a WD Paradise according to http://www.cbmhardware.de/pc/pc.php */ + + /* Commodore 80386SX BIOS Rev. 1.03 */ + /* Copyright (C) 1985-1990 Commodore Electronics Ltd. */ + /* Copyright (C) 1985-1990 Phoenix Technologies Ltd. */ + ROM_LOAD16_BYTE( "390914-01.u39", 0xf0000, 0x8000, CRC(8f849198) SHA1(550b04bac0d0807d6e95ec25391a81272779b41b)) /* 390914-01 V1.03 CS-2100 U39 Copyright (C) 1990 CBM */ + ROM_LOAD16_BYTE( "390915-01.u38", 0xf0001, 0x8000, CRC(ee4bad92) SHA1(6e02ef97a7ce336485814c06a1693bc099ce5cfb)) /* 390915-01 V1.03 CS-2100 U38 Copyright (C) 1990 CBM */ +ROM_END + +ROM_START( xb42663 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "qi310223.lo", 0xe0000, 0x10000, CRC(53047f49) SHA1(7b38e533f7f27295269549c63e5477d950239167)) + ROM_LOAD16_BYTE( "qi310223.hi", 0xe0001, 0x10000, CRC(4852869f) SHA1(98599d4691d40b3fac2936034c70b386ce4caf77)) +ROM_END + +ROM_START( qi600 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "qi610223.lo", 0xe0000, 0x10000, CRC(563114a9) SHA1(62932b3bf0b5502ff708f604c21773f00afda58e)) + ROM_LOAD16_BYTE( "qi610223.hi", 0xe0001, 0x10000, CRC(0ae133f6) SHA1(6039c366f7fe0ebf60b34c1a7d6b2d781b664001)) +ROM_END + +ROM_START( qi900 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "qi910224.lo", 0xe0000, 0x10000, CRC(b012ad3c) SHA1(807e788a6bd03f5e983fe503af3d0b202c754b8a)) + ROM_LOAD16_BYTE( "qi910224.hi", 0xe0001, 0x10000, CRC(36e66d56) SHA1(0900c5272ec3ced550f18fb08db59ab7f67a621e)) +ROM_END + +ROM_START( ftsserv ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "fts10226.lo", 0xe0000, 0x10000, CRC(efbd738f) SHA1(d5258760bafdaf1bf13c4a49da76d4b5e7b4ccbd)) + ROM_LOAD16_BYTE( "fts10226.hi", 0xe0001, 0x10000, CRC(2460853f) SHA1(a6bba8d2f800140afd129c4d5278f7ae8fe7e63a)) + /* FT Server series Front Panel */ + ROM_REGION(0x10000,"front", 0) + ROM_LOAD( "fp10009.bin", 0x0000, 0x8000, CRC(8aa7f718) SHA1(9ee6c6a5bb92622ea8d3805196d42ff68887d820)) +ROM_END + +ROM_START( apxenls3 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "31020.lo", 0xf0000, 0x8000, CRC(a19678d2) SHA1(d13c12fa7e94333555eabf58b81bad421e21cd91)) + ROM_LOAD16_BYTE( "31020.hi", 0xf0001, 0x8000, CRC(4922e020) SHA1(64e6448323dad2209e004cd93fa181582e768ed5)) +ROM_END + +ROM_START( aplanst ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "31024", "Bios 3-10-24") + ROMX_LOAD("31024.lo", 0xf0000, 0x8000, CRC(e52b59e1) SHA1(cfcaa4d8d658df8df463108ef30695bd4ee7a617), ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD("31024.hi", 0xf0001, 0x8000, CRC(7286aefa) SHA1(dfc0e3f4936780fa62ae9ec392ce17aa65e717cd), ROM_SKIP(1) | ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "31025", "Bios 3-10-25") + ROMX_LOAD("31025.lo", 0xf0000, 0x8000, CRC(1aec09bc) SHA1(51d56c97c7c1674554aa89b68945329ea967a8bc), ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD("31025.hi", 0xf0001, 0x8000, CRC(0763caa5) SHA1(48510a933dcd6efea3b14d04444f584c3e6fefeb), ROM_SKIP(1) | ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "31026", "Bios 3-10-26i") + ROMX_LOAD("31026i.lo", 0xf0000, 0x8000, CRC(670b6ab4) SHA1(8d61a0edf187f99b67eb58f5e11276deee801d17), ROM_SKIP(1) | ROM_BIOS(3) ) + ROMX_LOAD("31026i.hi", 0xf0001, 0x8000, CRC(ef01c54f) SHA1(911f95d65ab96878e5e7ebccfc4b329db47a1351), ROM_SKIP(1) | ROM_BIOS(3) ) +ROM_END + +ROM_START( aplannb ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "lsl31025.lo", 0xe0000, 0x10000, CRC(8bb7229b) SHA1(31449d12884ec4e7752e6c1ce7ce9e0d044eadf2)) + ROM_LOAD16_BYTE( "lsh31025.hi", 0xe0001, 0x10000, CRC(09e5c1b9) SHA1(d42be83b4181d3733268c29df04a4d2918370f4e)) +ROM_END + +ROM_START( apvxft ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "ft10221.lo", 0xe0000, 0x10000, CRC(8f339de0) SHA1(a6542406746eaf1ff7f9e3678c5cbe5522fb314a)) + ROM_LOAD16_BYTE( "ft10221.hi", 0xe0001, 0x10000, CRC(3b16bc31) SHA1(0592d1d81e7fd4715b0612083482db122d78c7f2)) +ROM_END + +ROM_START( aplscar ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "car306", "Caracal 3.06") + ROMX_LOAD("car306.bin", 0xc0000, 0x40000, CRC(fc271dea) SHA1(6207cfd312c9957243b8157c90a952404e43b237), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "car307", "Caracal 3.07") + ROMX_LOAD("car307.bin", 0xc0000, 0x40000, CRC(66a01852) SHA1(b0a68c9d67921d27ba483a1c50463406c08d3085), ROM_BIOS(2)) +ROM_END + +ROM_START( apxena1 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD("a1-r26.bin", 0xe0000, 0x20000, CRC(d29e983e) SHA1(5977df7f8d7ac2a154aa043bb6f539d96d51fcad)) +ROM_END + +ROM_START( apxenp2 ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "p2r02g2", "p2r02g2") + ROMX_LOAD("p2r02g2.bin", 0xe0000, 0x20000, CRC(311bcc5a) SHA1(be6fa144322077dcf66b065e7f4e61aab8c278b4), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "lep121s", "SCSI-Enabling ROMs") + ROMX_LOAD("p2r01f0.bin", 0xe0000, 0x20000, CRC(bbc68f2e) SHA1(6954a52a7dda5521794151aff7a04225e9c7df77), ROM_BIOS(2)) +ROM_END + +ROM_START( apxeni ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "lep121", "Rom Bios 1.2.1") + ROMX_LOAD( "lep121.bin", 0xf8000, 0x8000, CRC(948c1927) SHA1(d06bdbd6292db73c815ad1060daf055293dfddf5), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "lep121s", "SCSI-Enabling ROMs") + ROMX_LOAD( "lep121s.bin", 0xf8000, 0x8000, CRC(296118e4) SHA1(d1feaa9704e6ce3bc10c900bdd310d9494b02304), ROM_BIOS(2)) +ROM_END + +ROM_START( aplsbon ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "bon106", "Boinsai 1-06") + ROMX_LOAD("bon106.bin", 0xe0000, 0x20000, CRC(98a4eb76) SHA1(e0587afa78aeb9a8803f9b9f9e457e9847b0a2b2), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "bon203", "Boinsai 2-03") + ROMX_LOAD("bon203.bin", 0xe0000, 0x20000, CRC(32a0e125) SHA1(a4fcbd76952599993fa8b76aa36a96386648abb2), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "bon10703", "Boinsai 1-07-03") + ROMX_LOAD("bon10703.bin", 0xe0000, 0x20000, CRC(0275b3c2) SHA1(55ef4cbb7f3166f678aaa478234a42049deaba5f), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "bon20402", "Boinsai 2.03") + ROMX_LOAD("bon20402.bin", 0xe0000, 0x20000, CRC(ac5803fb) SHA1(b8fe92711c6a38a5d9e6497e76a0929c1685c631), ROM_BIOS(4)) +ROM_END + +ROM_START( apxlsam ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "sam107", "ROM BIOS Version 1-07") + ROMX_LOAD("sam1-07.bin", 0xe0000, 0x20000, CRC(65e05a8e) SHA1(c3cd198a129122cb05a28798e54331b06cfdd310), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "sam206", "ROM BIOS Version 2-06") + ROMX_LOAD("sam2-06.bin", 0xe0000, 0x20000, CRC(9768bb0f) SHA1(8166b77b133072f72f23debf85984eb19578ffc1), ROM_BIOS(2)) +ROM_END + +/* FIC VT-503 (Intel TX chipset, ITE 8679 Super I/O) */ +ROM_START( ficvt503 ) + ROM_REGION32_LE(0x40000, "isa", 0) + ROM_SYSTEM_BIOS(0, "109gi13", "1.09GI13") /* 1997-10-02 */ + ROMX_LOAD("109gi13.bin", 0x20000, 0x20000, CRC(0c32af48) SHA1(2cce40a98598f1ed1f398975f7a90c8be4200667), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "109gi14", "1.09GI14") /* 1997-11-07 */ + ROMX_LOAD("109gi14.awd", 0x20000, 0x20000, CRC(588c5cc8) SHA1(710e5405850fd975b362a422bfe9bc6d6c9a36cd), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "109gi15", "1.09GI15") /* 1997-11-07 */ + ROMX_LOAD("109gi15.awd", 0x20000, 0x20000, CRC(649a3481) SHA1(e681c6ab55a67cec5978dfffa75fcddc2aa0de4d), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "109gi16", "1.09GI16") /* 2000-03-23 */ + ROMX_LOAD("109gi16.bin", 0x20000, 0x20000, CRC(a928f271) SHA1(127a83a60752cc33b3ca49774488e511ec7bac55), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "115gk140", "1.15GK140") /* 1999-03-03 */ + ROMX_LOAD("115gk140.awd", 0x20000, 0x20000, CRC(65e88956) SHA1(f94bb0732e00b5b0f18f4e349db24a289f8379c5), ROM_BIOS(5)) +ROM_END + +ROM_START( aprpand ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD( "pf10226.std", 0xe0000, 0x20000, CRC(7396fb87) SHA1(a109cbad2179eec55f86c0297a59bb015461da21)) +ROM_END + +ROM_START( aprfte ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD( "1-2r2-4.486", 0xe0000, 0x20000, CRC(bccc236d) SHA1(0765299363e68cf65710a688c360a087856ece8f)) +ROM_END + +ROM_START( megapc ) + ROM_REGION(0x40000, "isa", ROMREGION_ERASEFF) + ROM_REGION(0x100000, "bios", 0) + ROM_LOAD16_BYTE( "41651-bios lo.u18", 0xe0000, 0x10000, CRC(1e9bd3b7) SHA1(14fd39ec12df7fae99ccdb0484ee097d93bf8d95)) + ROM_LOAD16_BYTE( "211253-bios hi.u19", 0xe0001, 0x10000, CRC(6acb573f) SHA1(376d483db2bd1c775d46424e1176b24779591525)) +ROM_END + +ROM_START( megapcpl ) + ROM_REGION(0x40000, "isa", ROMREGION_ERASEFF) + ROM_REGION(0x100000, "bios", 0) + ROM_LOAD16_BYTE( "41652.u18", 0xe0000, 0x10000, CRC(6f5b9a1c) SHA1(cae981a35a01234fcec99a96cb38075d7bf23474)) + ROM_LOAD16_BYTE( "486slc.u19", 0xe0001, 0x10000, CRC(6fb7e3e9) SHA1(c439cb5a0d83176ceb2a3555e295dc1f84d85103)) +ROM_END + +ROM_START( megapcpla ) + ROM_REGION(0x40000, "isa", ROMREGION_ERASEFF) + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD( "megapc_bios.bin", 0xc0000, 0x10000, CRC(b84938a2) SHA1(cecab72a96993db4f7c648c229b4211a8c53a380)) + ROM_CONTINUE(0xf0000, 0x10000) +ROM_END + +ROM_START( t2000sx ) + ROM_REGION( 0x1000000, "maincpu", 0 ) + ROM_LOAD( "014d.ic9", 0xe0000, 0x20000, CRC(e9010b02) SHA1(75688fc8e222640fa22bcc90343c6966fe0da87f)) +ROM_END + +ROM_START( pc2386 ) + ROM_REGION( 0x1000000, "maincpu", 0 ) + ROM_LOAD( "c000.bin", 0xc0000, 0x4000, CRC(33145bbf) SHA1(c49eaec19f656482e12c8bf282cd4ee5986d227d) ) + ROM_LOAD( "f000.bin", 0xf0000, 0x10000, CRC(f54a063c) SHA1(ce70ec493053afab662f51199ef9c9304a209b8e) ) + + ROM_REGION( 0x2000, "gfx1", ROMREGION_ERASE00 ) + + ROM_REGION( 0x1000, "keyboard", 0 ) // PC2286 / PC2386 102-key keyboard + ROM_LOAD( "40211.ic801", 0x000, 0x1000, CRC(4440d981) SHA1(a76006a929f26c178e09908c66f28abc92e7744c) ) +ROM_END + +ROM_START( k286i ) + ROM_REGION(0x1000000,"maincpu", 0) + ROM_LOAD16_BYTE( "81_1598", 0xf8000, 0x4000, CRC(e25a1e43) SHA1(d00b976ac94323f3867b1c256e315839c906dd5a) ) + ROM_LOAD16_BYTE( "81_1599", 0xf8001, 0x4000, CRC(08e2a17b) SHA1(a86ef116e82eb9240e60b52f76e5e510cdd393fd) ) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1984, ibm5170, 0, ibm5150, ibm5170, atcga, at_state, atcga, "International Business Machines", "IBM PC/AT 5170", MACHINE_NOT_WORKING ) +COMP ( 1985, ibm5170a, ibm5170, 0, ibm5170a, atcga, at_state, atcga, "International Business Machines", "IBM PC/AT 5170 8MHz", MACHINE_NOT_WORKING ) +COMP ( 1985, ibm5162, ibm5170, 0, ibm5162, atcga, at_state, atcga, "International Business Machines", "IBM PC/XT-286 5162", MACHINE_NOT_WORKING ) +COMP ( 1990, i8530h31, ibm5170, 0, ps2m30286, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8530-H31 (Model 30/286)", MACHINE_NOT_WORKING ) +COMP ( 1988, i8530286, ibm5170, 0, ps2m30286, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 Model 30-286", MACHINE_NOT_WORKING ) +COMP ( 198?, i8535043, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8535-043 (Model 35)", MACHINE_NOT_WORKING ) +COMP ( 198?, i8550021, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8550-021 (Model 50)", MACHINE_NOT_WORKING ) +COMP ( 198?, i8550061, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8550-061 (Model 50Z)", MACHINE_NOT_WORKING ) +COMP ( 1989, i8555081, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8550-081 (Model 55SX)", MACHINE_NOT_WORKING ) +COMP ( 198?, i8580071, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8580-071 (Model 80)", MACHINE_NOT_WORKING ) +COMP ( 198?, i8580111, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8580-111 (Model 80)", MACHINE_NOT_WORKING ) +COMP ( 1989, ibmps1es, ibm5170, 0, ibmps1, atvga, at_state, atvga, "International Business Machines", "IBM PS/1 (Spanish)", MACHINE_NOT_WORKING ) +COMP ( 1987, at, ibm5170, 0, ibm5162, atcga, at_state, atcga, "", "PC/AT (CGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) +COMP ( 1987, atvga, ibm5170, 0, atvga, atvga, at_state, atvga, "", "PC/AT (VGA, MF2 Keyboard)" , MACHINE_NOT_WORKING ) +COMP ( 1988, at386, ibm5170, 0, at386, atvga, at_state, atvga, "", "PC/AT 386 (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) +COMP ( 1988, ct386sx, ibm5170, 0, ct386sx, atvga, at_state, atvga, "", "NEAT 386SX (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) +//COMP ( 1988, at386sx, ibm5170, 0, ct386sx, atvga, at_state, atvga, "", "PC/AT 386SX (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) +COMP ( 1990, at486, ibm5170, 0, at486, atvga, at_state, atvga, "", "PC/AT 486 (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) +COMP ( 1990, at586, ibm5170, 0, at586, atvga, at586_state, at586, "", "PC/AT 586 (PIIX4)", MACHINE_NOT_WORKING ) +COMP ( 1990, at586x3, ibm5170, 0, at586x3, atvga, at586_state, at586, "", "PC/AT 586 (PIIX3)", MACHINE_NOT_WORKING ) +COMP ( 1989, neat, ibm5170, 0, neat, atvga, at_state, atvga, "", "NEAT (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) +COMP ( 1989, ec1842, ibm5150, 0, ec1842, atcga, at_state, atcga, "", "EC-1842", MACHINE_NOT_WORKING ) +COMP ( 1993, ec1849, ibm5170, 0, ec1849, atcga, at_state, atcga, "", "EC-1849", MACHINE_NOT_WORKING ) +COMP ( 1993, megapc, 0, 0, megapc, 0, megapc_state,megapc, "Amstrad plc", "MegaPC", MACHINE_NOT_WORKING ) +COMP ( 199?, megapcpl, megapc, 0, megapcpl, 0, megapc_state,megapcpl, "Amstrad plc", "MegaPC Plus", MACHINE_NOT_WORKING ) +COMP ( 199?, megapcpla, megapc, 0, megapcpla, 0, at_state, megapcpla,"Amstrad plc", "MegaPC Plus (WINBUS chipset)", MACHINE_NOT_WORKING ) +COMP ( 1989, pc2386, ibm5170, 0, at386, atvga, at_state, atvga, "Amstrad plc", "Amstrad PC2386", MACHINE_NOT_WORKING ) +COMP ( 1991, aprfte, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot FT//ex 486 (J3 Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1991, ftsserv, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot FTs (Scorpion)", MACHINE_NOT_WORKING ) +COMP ( 1992, aprpand, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot FTs (Panther Rev F 1.02.26)", MACHINE_NOT_WORKING ) +COMP ( 1990, aplanst, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot LANstation (Krypton Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1990, aplannb, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot LANstation (Novell Remote Boot)", MACHINE_NOT_WORKING ) +COMP ( 1992, aplscar, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot LS Pro (Caracal Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1992, aplsbon, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot LS Pro (Bonsai Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1988, xb42663, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot Qi 300 (Rev D,E & F Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1988, qi600, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot Qi 600 (Neptune Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1990, qi900, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot Qi 900 (Scorpion Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1989, apvxft, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot VX FT server", MACHINE_NOT_WORKING ) +COMP ( 1991, apxenls3, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot XEN-LS (Venus IV Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1993, apxlsam, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot XEN-LS II (Samurai Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1987, apxeni, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot XEN-i 386 (Leopard Motherboard)" , MACHINE_NOT_WORKING ) +COMP ( 1989, xb42639, ibm5170, 0, xb42639, atvga, at_state, atvga, "Apricot", "Apricot XEN-S (Venus I Motherboard 286)" , MACHINE_NOT_WORKING ) +COMP ( 1990, xb42639a, ibm5170, 0, xb42639, atvga, at_state, atvga, "Apricot", "Apricot XEN-S (Venus II Motherboard 286)" , MACHINE_NOT_WORKING ) +COMP ( 1989, xb42664, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot XEN-S (Venus I Motherboard 386)" , MACHINE_NOT_WORKING ) +COMP ( 1990, xb42664a, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot XEN-S (Venus II Motherboard 386)" , MACHINE_NOT_WORKING ) +COMP ( 1993, apxena1, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot XEN PC (A1 Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1993, apxenp2, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot XEN PC (P2 Motherboard)", MACHINE_NOT_WORKING ) +COMP ( 1990, c386sx16, ibm5170, 0, at386sx, atvga, at_state, atvga, "Commodore Business Machines", "Commodore 386SX-16", MACHINE_NOT_WORKING ) +COMP ( 1988, cmdpc30, ibm5170, 0, ibm5162, atcga, at_state, atcga, "Commodore Business Machines", "PC 30 III", MACHINE_NOT_WORKING ) +COMP ( 1995, ficpio2, ibm5170, 0, ficpio2, atvga, at_state, atpci, "FIC", "486-PIO-2", MACHINE_NOT_WORKING ) +COMP ( 1997, ficvt503, ibm5170, 0, at586, atvga, driver_device, 0, "FIC", "VT-503", MACHINE_NOT_WORKING ) +COMP ( 1985, k286i, ibm5170, 0, k286i, atcga, at_state, atcga, "Kaypro", "286i", MACHINE_NOT_WORKING ) +COMP ( 1991, t2000sx, ibm5170, 0, at386sx, atvga, at_state, atvga, "Toshiba", "T2000SX", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/atari400.c b/src/mame/drivers/atari400.c new file mode 100644 index 00000000000..73844078019 --- /dev/null +++ b/src/mame/drivers/atari400.c @@ -0,0 +1,2480 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/****************************************************************************** + Atari 400/800 + + MESS Driver + + Juergen Buchmueller, June 1998 + + 2009-05 FP changes: + Factored out MESS specific code from MAME + Added skeleton support for other XL/XE machines (VERY preliminary): + - a600xl based on maxaflex emulation in MAME + - a1200xl sharing a800xl code without BASIC + - a65xe, a65xea, a130xe, a800xe, xegs sharing a800xl code (and this is wrong + at least for xegs) + Added proper dumps and labels, thanks to Freddy Offenga researches (a few + are still marked BAD_DUMP while waiting for crc confirmation, since they + have been obtained by splitting whole dumps) + + To Do: + - Find out why a600xl and a800xl don't work (xe machines should then follow) + - Investigate supported RAM sizes and OS versions in different models + - Implement differences between various models (currently most of the + XL/XE are exactly an a800xl, but this will change as soon as emulation + starts to work) + - Fix various keyboard differences + - Freddy emulation for 800XLF? + - Add support for proto boards and expansions (a1400xl, C/PM board, etc.) + - Clean up the whole driver + cart + floppy structure + + 2013-11-06 Robert Tuccitto: + Updated Palette per 'CGIA D020577' and 'GTIA C014805', including + normalized grayscale with proper color gradient. Added Phase Shift + values 24.7 thru 27.7 degrees in 0.5 degree increments. Enabled + Phase Shift 26.2 degrees as default. + + 2013-11-23 Robert Tuccitto: + Added palette notes + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/6821pia.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/pokey.h" +#include "includes/atari.h" +#include "machine/atarifdc.h" +#include "bus/a800/a800_slot.h" +#include "bus/a800/a800_carts.h" +#include "bus/a800/a8sio.h" + + +/****************************************************************************** + Atari 800 memory map (preliminary) + + ***************** read access ******************* + range short description + 0000-9FFF RAM main memory + A000-BFFF RAM/ROM RAM or (banked) ROM cartridges + C000-CFFF ROM unused or monitor ROM + + ********* GTIA ******************************** + + D000 m0pf missile 0 playfield collisions + D001 m1pf missile 1 playfield collisions + D002 m2pf missile 2 playfield collisions + D003 m3pf missile 3 playfield collisions + D004 p0pf player 0 playfield collisions + D005 p1pf player 1 playfield collisions + D006 p2pf player 2 playfield collisions + D007 p3pf player 3 playfield collisions + D008 m0pl missile 0 player collisions + D009 m1pl missile 1 player collisions + D00A m2pl missile 2 player collisions + D00B m3pl missile 3 player collisions + D00C p0pl player 0 player collisions + D00D p1pl player 1 player collisions + D00E p2pl player 2 player collisions + D00F p3pl player 3 player collisions + D010 but0 button stick 0 + D011 but1 button stick 1 + D012 but2 button stick 2 + D013 but3 button stick 3 + D014 xff unused + D015 xff unused + D016 xff unused + D017 xff unused + D018 xff unused + D019 xff unused + D01A xff unused + D01B xff unused + D01C xff unused + D01D xff unused + D01E xff unused + D01F cons console keys + D020-D0FF repeated 7 times + + D100-D1FF xff + + ********* POKEY ******************************** + D200 pot0 paddle 0 + D201 pot1 paddle 1 + D202 pot2 paddle 2 + D203 pot3 paddle 3 + D204 pot4 paddle 4 + D205 pot5 paddle 5 + D206 pot6 paddle 6 + D207 pot7 paddle 7 + D208 potb all paddles + D209 kbcode keyboard scan code + D20A random random number generator + D20B xff unused + D20C xff unused + D20D serin serial input + D20E irqst IRQ status + D20F skstat sk status + D210-D2FF repeated 15 times + + ********* PIO ******************************** + D300 porta read pio port A + D301 portb read pio port B + D302 pactl read pio port A control + D303 pbctl read pio port B control + D304-D3FF repeated 63 times + + ********* ANTIC ******************************** + D400 xff unused + D401 xff unused + D402 xff unused + D403 xff unused + D404 xff unused + D405 xff unused + D406 xff unused + D407 xff unused + D408 xff unused + D409 xff unused + D40A xff unused + D40B vcount vertical (scanline) counter + D40C penh light pen horizontal pos + D40D penv light pen vertical pos + D40E xff unused + D40F nmist NMI status + + D500-D7FF xff unused memory + + D800-DFFF ROM floating point ROM + E000-FFFF ROM bios ROM + + ***************** write access ******************* + range short description + 0000-9FFF RAM main memory + A000-BFFF RAM/ROM RAM or (banked) ROM + C000-CFFF ROM unused or monitor ROM + + ********* GTIA ******************************** + D000 hposp0 player 0 horz position + D001 hposp1 player 1 horz position + D002 hposp2 player 2 horz position + D003 hposp3 player 3 horz position + D004 hposm0 missile 0 horz position + D005 hposm1 missile 0 horz position + D006 hposm2 missile 0 horz position + D007 hposm3 missile 0 horz position + D008 sizep0 size player 0 + D009 sizep1 size player 0 + D00A sizep2 size player 0 + D00B sizep3 size player 0 + D00C sizem size missiles + D00D grafp0 graphics data for player 0 + D00E grafp1 graphics data for player 1 + D00F grafp2 graphics data for player 2 + D010 grafp3 graphics data for player 3 + D011 grafm graphics data for missiles + D012 colpm0 color for player/missile 0 + D013 colpm1 color for player/missile 1 + D014 colpm2 color for player/missile 2 + D015 colpm3 color for player/missile 3 + D016 colpf0 color 0 playfield + D017 colpf1 color 1 playfield + D018 colpf2 color 2 playfield + D019 colpf3 color 3 playfield + D01A colbk background playfield + D01B prior priority select + D01C vdelay delay until vertical retrace + D01D gractl graphics control + D01E hitclr clear collisions + D01F wcons write console (speaker) + D020-D0FF repeated 7 times + + D100-D1FF xff unused + + ********* POKEY ******************************** + D200 audf1 frequency audio chan #1 + D201 audc1 control audio chan #1 + D202 audf2 frequency audio chan #2 + D203 audc2 control audio chan #2 + D204 audf3 frequency audio chan #3 + D205 audc3 control audio chan #3 + D206 audf4 frequency audio chan #4 + D207 audc4 control audio chan #4 + D208 audctl audio control + D209 stimer start timer + D20A skres sk reset + D20B potgo start pot AD conversion + D20C xff unused + D20D serout serial output + D20E irqen IRQ enable + D20F skctl sk control + D210-D2FF repeated 15 times + + ********* PIO ******************************** + D300 porta write pio port A (output or mask) + D301 portb write pio port B (output or mask) + D302 pactl write pio port A control + D303 pbctl write pio port B control + D304-D3FF repeated + + ********* ANTIC ******************************** + D400 dmactl write DMA control + D401 chactl write character control + D402 dlistl write display list lo + D403 dlisth write display list hi + D404 hscrol write horz scroll + D405 vscrol write vert scroll + D406 xff unused + D407 pmbash player/missile base addr hi + D408 xff unused + D409 chbash character generator base addr hi + D40A wsync wait for hsync + D40B xff unused + D40C xff unused + D40D xff unused + D40E nmien NMI enable + D40F nmires NMI reset + + D500-D7FF xff unused memory + + D800-DFFF ROM floating point ROM + E000-FFFF ROM BIOS ROM +******************************************************************************/ + +class a400_state : public atari_common_state +{ +public: + a400_state(const machine_config &mconfig, device_type type, const char *tag) + : atari_common_state(mconfig, type, tag), + m_ram(*this, RAM_TAG), + m_pia(*this, "pia"), + m_dac(*this, "dac"), + m_region_maincpu(*this, "maincpu"), + m_0000(*this, "0000"), + m_8000(*this, "8000"), + m_a000(*this, "a000"), + m_cart(*this, "cartleft"), + m_cart2(*this, "cartright") { } + + DECLARE_MACHINE_START(a400); + DECLARE_MACHINE_START(a800); + DECLARE_MACHINE_START(a800xl); + DECLARE_MACHINE_START(a5200); + DECLARE_PALETTE_INIT(a400); + + DECLARE_MACHINE_RESET(a400); + + DECLARE_WRITE8_MEMBER(gtia_cb); + + DECLARE_WRITE8_MEMBER(a600xl_pia_pb_w); + DECLARE_WRITE8_MEMBER(a800xl_pia_pb_w); + + DECLARE_READ8_MEMBER(read_d5xx); // at least one cart type can enable/disable roms when reading + DECLARE_WRITE8_MEMBER(disable_cart); + + // these are needed to handle carts which can disable ROM without + // installing/disinstalling continuously RAM and ROM (with e.g. big + // preformance hit in Williams carts) + DECLARE_READ8_MEMBER(special_read_8000); + DECLARE_WRITE8_MEMBER(special_write_8000); + DECLARE_READ8_MEMBER(special_read_a000); + DECLARE_WRITE8_MEMBER(special_write_a000); + + DECLARE_READ8_MEMBER(a600xl_low_r); + DECLARE_READ8_MEMBER(a1200xl_low_r); + DECLARE_READ8_MEMBER(a800xl_low_r); + DECLARE_WRITE8_MEMBER(a800xl_low_w); + DECLARE_READ8_MEMBER(a800xl_high_r); + DECLARE_WRITE8_MEMBER(a800xl_high_w); + DECLARE_READ8_MEMBER(a130xe_low_r); + DECLARE_WRITE8_MEMBER(a130xe_low_w); + DECLARE_READ8_MEMBER(xegs_low_r); + DECLARE_WRITE8_MEMBER(xegs_low_w); + DECLARE_READ8_MEMBER(xegs_high_r); + DECLARE_WRITE8_MEMBER(xegs_high_w); + + TIMER_DEVICE_CALLBACK_MEMBER(a400_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(a800xl_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(a5200_interrupt); + +protected: + //required_device m_maincpu; // maincpu is already contained in atari_common_state + required_device m_ram; + required_device m_pia; + optional_device m_dac; + required_memory_region m_region_maincpu; + optional_memory_bank m_0000; + optional_memory_bank m_8000; + optional_memory_bank m_a000; + optional_device m_cart; + optional_device m_cart2; + + int m_cart_disabled, m_cart_helper; + int m_last_offs; + UINT8 m_mmu, m_ext_bank; + + void setup_ram(int bank,UINT32 size); + void setup_cart(a800_cart_slot_device *slot); +}; + + + +/************************************************************** + * + * Memory handlers + * + **************************************************************/ + +READ8_MEMBER(a400_state::a600xl_low_r) +{ + if (m_mmu & 0x80) + return 0xff; + else + return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; +} + + +READ8_MEMBER(a400_state::a1200xl_low_r) +{ + if (offset < 0x5000) // 0x0000-0x4fff + return m_ram->pointer()[offset]; + else if (offset < 0x5800) // 0x5000-0x57ff + { + if (m_mmu & 0x80) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; + } + else if (offset < 0xc000) // 0x5800-0xbfff + return m_ram->pointer()[offset]; + else // 0xc000-0xcfff + { + if (!(m_mmu & 0x01)) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[offset]; + } +} + +READ8_MEMBER(a400_state::a800xl_low_r) +{ + if (offset < 0x5000) // 0x0000-0x4fff + return m_ram->pointer()[offset]; + else if (offset < 0x5800) // 0x5000-0x57ff + { + if (m_mmu & 0x80) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; + } + else if (offset < 0xa000) // 0x5800-0x9fff + return m_ram->pointer()[offset]; + else if (offset < 0xc000) // 0xa000-0xbfff + { + if (m_mmu & 0x02) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[(offset & 0x1fff) + 0xa000]; + } + else // 0xc000-0xcfff + { + if (!(m_mmu & 0x01)) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[offset]; + } +} + +WRITE8_MEMBER(a400_state::a800xl_low_w) +{ + if (offset < 0x5000) // 0x0000-0x4fff + m_ram->pointer()[offset] = data; + else if (offset < 0x5800) // 0x5000-0x57ff + { + if (m_mmu & 0x80) + m_ram->pointer()[offset] = data; + } + else if (offset < 0xa000) // 0x5800-0x7fff + m_ram->pointer()[offset] = data; + else if (offset < 0xc000) // 0xa000-0xbfff + { + if (m_mmu & 0x02) + m_ram->pointer()[offset] = data; + } + else // 0xc000-0xcfff + { + if (!(m_mmu & 0x01)) + m_ram->pointer()[offset] = data; + } +} + +READ8_MEMBER(a400_state::a800xl_high_r) +{ + if (m_mmu & 0x01) + return m_region_maincpu->base()[0xd800 + offset]; + else + return m_ram->pointer()[0xd800 + offset]; +} + +WRITE8_MEMBER(a400_state::a800xl_high_w) +{ + if (!(m_mmu & 0x01)) + m_ram->pointer()[0xd800 + offset] = data; +} + +READ8_MEMBER(a400_state::a130xe_low_r) +{ + if (offset < 0x4000) // 0x0000-0x3fff + return m_ram->pointer()[offset]; + else if (offset < 0x8000) // 0x4000-0x7fff + { + // NOTE: ANTIC accesses to extra RAM are not supported yet! + if (!(m_mmu & 0x80) && offset >= 0x5000 && offset < 0x5800) + return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; + if (!(m_mmu & 0x10)) + return m_ram->pointer()[offset + 0x10000 + (m_ext_bank * 0x4000)]; + else + return m_ram->pointer()[offset]; + } + else if (offset < 0xa000) // 0x8000-0x9fff + return m_ram->pointer()[offset]; + else if (offset < 0xc000) // 0xa000-0xbfff + { + if (m_mmu & 0x02) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[(offset & 0x1fff) + 0xa000]; + } + else // 0xc000-0xcfff + { + if (!(m_mmu & 0x01)) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[offset]; + } +} + +WRITE8_MEMBER(a400_state::a130xe_low_w) +{ + if (offset < 0x4000) // 0x0000-0x3fff + m_ram->pointer()[offset] = data; + else if (offset < 0x8000) // 0x4000-0x7fff + { + // NOTE: ANTIC accesses to extra RAM are not supported yet! + if (!(m_mmu & 0x80) && offset >= 0x5000 && offset < 0x5800) + return; + if (!(m_mmu & 0x10)) + m_ram->pointer()[offset + 0x10000 + (m_ext_bank * 0x4000)] = data; + else + m_ram->pointer()[offset] = data; + } + else if (offset < 0xa000) // 0x5800-0x7fff + m_ram->pointer()[offset] = data; + else if (offset < 0xc000) // 0xa000-0xbfff + { + if (m_mmu & 0x02) + m_ram->pointer()[offset] = data; + } + else // 0xc000-0xcfff + { + if (!(m_mmu & 0x01)) + m_ram->pointer()[offset] = data; + } +} + +READ8_MEMBER(a400_state::xegs_low_r) +{ + if (offset < 0x5000) // 0x0000-0x4fff + return m_ram->pointer()[offset]; + else if (offset < 0x5800) // 0x5000-0x57ff + { + if (m_mmu & 0x80) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; + } + else if (offset < 0x8000) // 0x5800-0x7fff + return m_ram->pointer()[offset]; + else if (offset < 0xa000) // 0x8000-0x9fff + return m_region_maincpu->base()[0x8000 + (offset & 0x1fff)]; + else if (offset < 0xc000) // 0xa000-0xbfff + return m_region_maincpu->base()[0x8000 + (offset & 0x1fff)]; + else // 0xc000-0xcfff + { + if (!(m_mmu & 0x01)) + return m_ram->pointer()[offset]; + else + return m_region_maincpu->base()[offset]; + } +} + +WRITE8_MEMBER(a400_state::xegs_low_w) +{ + if (offset < 0x5000) // 0x0000-0x4fff + m_ram->pointer()[offset] = data; + else if (offset < 0x5800) // 0x5000-0x57ff + { + if (m_mmu & 0x80) + m_ram->pointer()[offset] = data; + } + else if (offset < 0x8000) // 0x5800-0x7fff + m_ram->pointer()[offset] = data; + else if (offset < 0xc000) // 0xa000-0xbfff + return; + else // 0xc000-0xcfff + { + if (!(m_mmu & 0x01)) + m_ram->pointer()[offset] = data; + } +} + +/************************************************************** + * + * Memory maps + * + **************************************************************/ + + +static ADDRESS_MAP_START(a400_mem, AS_PROGRAM, 8, a400_state) + AM_RANGE(0x0000, 0xbfff) AM_NOP // RAM installed at runtime + AM_RANGE(0xc000, 0xcfff) AM_ROM + AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) + AM_RANGE(0xd100, 0xd1ff) AM_NOP + AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) + AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) + AM_RANGE(0xd500, 0xd7ff) AM_NOP + AM_RANGE(0xd800, 0xffff) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(a600xl_mem, AS_PROGRAM, 8, a400_state) + AM_RANGE(0x0000, 0x3fff) AM_RAM + AM_RANGE(0x5000, 0x57ff) AM_READ(a600xl_low_r) // self test or NOP + AM_RANGE(0xa000, 0xbfff) AM_ROM // BASIC + AM_RANGE(0xc000, 0xcfff) AM_ROM // OS + AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) + AM_RANGE(0xd100, 0xd1ff) AM_NOP + AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) + AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) + AM_RANGE(0xd500, 0xd7ff) AM_NOP + AM_RANGE(0xd800, 0xffff) AM_ROM // OS +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(a1200xl_mem, AS_PROGRAM, 8, a400_state) + AM_RANGE(0x0000, 0xcfff) AM_READWRITE(a1200xl_low_r, xegs_low_w) + AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) + AM_RANGE(0xd100, 0xd1ff) AM_NOP + AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) + AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) + AM_RANGE(0xd500, 0xd7ff) AM_NOP + AM_RANGE(0xd800, 0xffff) AM_READWRITE(a800xl_high_r, a800xl_high_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(a800xl_mem, AS_PROGRAM, 8, a400_state) + AM_RANGE(0x0000, 0xcfff) AM_READWRITE(a800xl_low_r, a800xl_low_w) + AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) + AM_RANGE(0xd100, 0xd1ff) AM_NOP + AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) + AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) + AM_RANGE(0xd500, 0xd7ff) AM_NOP + AM_RANGE(0xd800, 0xffff) AM_READWRITE(a800xl_high_r, a800xl_high_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(a130xe_mem, AS_PROGRAM, 8, a400_state) + AM_RANGE(0x0000, 0xcfff) AM_READWRITE(a130xe_low_r, a800xl_low_w) + AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) + AM_RANGE(0xd100, 0xd1ff) AM_NOP + AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) + AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) + AM_RANGE(0xd500, 0xd7ff) AM_NOP + AM_RANGE(0xd800, 0xffff) AM_READWRITE(a800xl_high_r, a800xl_high_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(xegs_mem, AS_PROGRAM, 8, a400_state) + AM_RANGE(0x0000, 0xcfff) AM_READWRITE(xegs_low_r, xegs_low_w) + AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) + AM_RANGE(0xd100, 0xd1ff) AM_NOP + AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) + AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) + AM_RANGE(0xd500, 0xd7ff) AM_NOP + AM_RANGE(0xd800, 0xffff) AM_READWRITE(a800xl_high_r, a800xl_high_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(a5200_mem, AS_PROGRAM, 8, a400_state) + AM_RANGE(0x0000, 0x3fff) AM_RAM + AM_RANGE(0x4000, 0xbfff) AM_NOP // ROM installed at machine start + AM_RANGE(0xc000, 0xcfff) AM_DEVREADWRITE("gtia", gtia_device, read, write) + AM_RANGE(0xd400, 0xdfff) AM_DEVREADWRITE("antic", antic_device, read, write) + // 0xe000-0xe7ff - Expansion? + AM_RANGE(0xe800, 0xefff) AM_DEVREADWRITE("pokey", pokey_device, read, write) + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + + + +/************************************************************** + * + * Input ports + * + **************************************************************/ + + +#define JOYSTICK_DELTA 10 +#define JOYSTICK_SENSITIVITY 200 + +static INPUT_PORTS_START( atari_artifacting ) + PORT_START("artifacts") + PORT_CONFNAME(0x40, 0x00, "Television Artifacts" ) + PORT_CONFSETTING(0x00, DEF_STR( Off ) ) + PORT_CONFSETTING(0x40, DEF_STR( On ) ) +INPUT_PORTS_END + + + +static INPUT_PORTS_START( atari_console ) + PORT_START("console") + PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_NAME("CONS.2: Option") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("CONS.1: Select") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("CONS.0: Start") PORT_CODE(KEYCODE_F1) +INPUT_PORTS_END + + + +static INPUT_PORTS_START( atari_digital_joystick2 ) + PORT_START("djoy_0_1") + PORT_BIT(0x01, 0x01, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x02, 0x02, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x04, 0x04, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x08, 0x08, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x10, 0x10, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(2) + PORT_BIT(0x20, 0x20, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) + PORT_BIT(0x40, 0x40, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(2) + PORT_BIT(0x80, 0x80, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) + + PORT_START("djoy_2_3") + PORT_BIT(0x01, 0x01, IPT_UNUSED) + PORT_BIT(0x02, 0x02, IPT_UNUSED) + PORT_BIT(0x04, 0x04, IPT_UNUSED) + PORT_BIT(0x08, 0x08, IPT_UNUSED) + PORT_BIT(0x10, 0x10, IPT_UNUSED) + PORT_BIT(0x20, 0x20, IPT_UNUSED) + PORT_BIT(0x40, 0x40, IPT_UNUSED) + PORT_BIT(0x80, 0x80, IPT_UNUSED) + + PORT_START("djoy_b") + PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x04, 0x04, IPT_UNUSED) + PORT_BIT(0x08, 0x08, IPT_UNUSED) + PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0x40, 0x40, IPT_UNUSED) + PORT_BIT(0x80, 0x80, IPT_UNUSED) +INPUT_PORTS_END + + + +static INPUT_PORTS_START( atari_digital_joystick4 ) + PORT_START("djoy_0_1") + PORT_BIT(0x01, 0x01, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x02, 0x02, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x04, 0x04, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x08, 0x08, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x10, 0x10, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(2) + PORT_BIT(0x20, 0x20, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) + PORT_BIT(0x40, 0x40, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(2) + PORT_BIT(0x80, 0x80, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) + + PORT_START("djoy_2_3") + PORT_BIT(0x01, 0x01, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(3) + PORT_BIT(0x02, 0x02, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(3) + PORT_BIT(0x04, 0x04, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(3) + PORT_BIT(0x08, 0x08, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(3) + PORT_BIT(0x10, 0x10, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(4) + PORT_BIT(0x20, 0x20, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(4) + PORT_BIT(0x40, 0x40, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(4) + PORT_BIT(0x80, 0x80, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(4) + + PORT_START("djoy_b") + PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x04, 0x04, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(3) + PORT_BIT(0x08, 0x08, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(4) + PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0x40, 0x40, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(3) + PORT_BIT(0x80, 0x80, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(4) +INPUT_PORTS_END + + + +/* 2009-04 FP: +Small note about natural keyboard support: currently, +- "Break" is mapped to 'F1' +- "Clear" is mapped to 'F2' +- "Atari" is mapped to 'F3' */ + +static INPUT_PORTS_START( atari_keyboard ) + PORT_START("keyboard.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('\\') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('^') + + PORT_START("keyboard.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) // None! + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('=') PORT_CHAR('|') + + PORT_START("keyboard.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("keyboard.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("keyboard.4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('[') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(']') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Atari") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("keyboard.5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START("keyboard.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BackS Delete") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('@') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("< Clear") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('<') PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("> Insert") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('>') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("keyboard.7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START("fake") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) +INPUT_PORTS_END + + +static INPUT_PORTS_START( atari_analog_paddles ) + PORT_START("analog_0") + PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(1) PORT_REVERSE + + PORT_START("analog_1") + PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(2) PORT_REVERSE + + PORT_START("analog_2") + PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(3) PORT_REVERSE + + PORT_START("analog_3") + PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(4) PORT_REVERSE + + PORT_START("analog_4") + PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_REVERSE /* PORT_PLAYER(5) */ + + PORT_START("analog_5") + PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_REVERSE /* PORT_PLAYER(6) */ + + PORT_START("analog_6") + PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_REVERSE /* PORT_PLAYER(7) */ + + PORT_START("analog_7") + PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_REVERSE /* PORT_PLAYER(8) */ +INPUT_PORTS_END + + + +static INPUT_PORTS_START( a800 ) + PORT_INCLUDE( atari_artifacting ) + PORT_INCLUDE( atari_console ) + PORT_INCLUDE( atari_digital_joystick4 ) + PORT_INCLUDE( atari_keyboard ) + PORT_INCLUDE( atari_analog_paddles ) +INPUT_PORTS_END + + + +static INPUT_PORTS_START( a800xl ) + PORT_INCLUDE( atari_artifacting ) + PORT_INCLUDE( atari_console ) + PORT_INCLUDE( atari_digital_joystick2 ) + PORT_INCLUDE( atari_keyboard ) + PORT_INCLUDE( atari_analog_paddles ) +INPUT_PORTS_END + + + +static INPUT_PORTS_START( a5200 ) + PORT_INCLUDE( atari_artifacting ) + + PORT_START("djoy_b") /* lower/upper buttons */ + PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x04, 0x04, IPT_BUTTON1) PORT_PLAYER(3) + PORT_BIT(0x08, 0x08, IPT_BUTTON1) PORT_PLAYER(4) + PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0x40, 0x40, IPT_BUTTON2) PORT_PLAYER(3) + PORT_BIT(0x80, 0x80, IPT_BUTTON2) PORT_PLAYER(4) + + PORT_START("keypad.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("(Break)") PORT_CODE(KEYCODE_PAUSE) // is this correct? + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[#]") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[0]") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[*]") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keypad.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[9]") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[8]") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[7]") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keypad.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_F2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[6]") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[5]") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[4]") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keypad.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START) PORT_NAME("Start") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[3]") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[2]") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[1]") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("analog_0") + PORT_BIT(0xff, 0x72, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(1) + + PORT_START("analog_1") + PORT_BIT(0xff, 0x72, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(1) + + PORT_START("analog_2") + PORT_BIT(0xff, 0x72, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(2) + + PORT_START("analog_3") + PORT_BIT(0xff, 0x72, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(2) + + PORT_START("analog_4") + PORT_BIT(0xff, 0x72, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(3) + + PORT_START("analog_5") + PORT_BIT(0xff, 0x72, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(3) + + PORT_START("analog_6") + PORT_BIT(0xff, 0x72, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(4) + + PORT_START("analog_7") + PORT_BIT(0xff, 0x72, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(4) + +INPUT_PORTS_END +/*************************************************************** +Atari 5200 Palette Notes: + +Palette on a modern flat panel display (LCD, LED, Plasma, etc.) +appears different from a traditional CRT. The most outstanding +difference is Hue 1x, the hue begin point. Hue 1x looks very +'green' (~-60 to -45 degrees - depending on how poor or well it +handles the signal conversion and its calibration) on a modern +flat panel display, as opposed to 'gold' (~-33 degrees) on a +CRT. The official technical document, "GTIA C014805 NTSC" +stipulates Hue 1x as gold. + +The "Atari 5200 Field Service Manual" provides two different +sets of instructions in harmony with utilizing the "PAM +Diagnostic SALT Cartridge v1.1". In one account it states the +color just below and above the reference bar to be within one +shade of each other. + +Under the same reference document, directions are given for it +to be the same color. Phase Shift 25.7 degrees matches Hue 1x, +15x and the color below the reference bar. + +However, if the system is adjusted within the first several +minutes of running, the warm up, consistent system run time, +causes Hue 15x (F$) to become stronger/darker gold (More brown +then ultimately red-brown); as well as leans Hue 14x (E$) more +brown than green. Once achieving a phase shift of 27.7, +Hue 14x (E$) and Hue 15x (F$) near-exact match Hue 1x and 2x +respectively. + +Accounting for system 'warm-up', phase shifting, as well as the +instructions for it to be within one shade of each other, would +make Phase Shift 26.2 degrees or 26.7 degrees a realistic +logical choice. + +It also collaborates with the official "GTIA C014805 NTSC" +document for color order: Hue 1x = Gold, Hue 2x = Orange, +Hue 15x (F$) = Light-Orange; Phase Shift 26.2 places +Hue 15x (F$) between Hue 1x, Gold and Hue 2x, Orange; +a Light Orange in color. Color descriptions are best measured +in the middle of the brightness scale. + +It should be mentioned that Green-Yellow is referenced at +Hue 13x (D$), nowhere near Hue 1x. A Green-Yellow Hue 1x is +how the palette is manipulated and modified (in part) under +a modern flat panel display. + +Note though, even a properly calibrated console, at power on, +the phase shift appears as low as ~23 degrees and after a +considerable consistent runtime, can be as high as ~28 degrees. +In general, the low end of ~23 degrees lasts for maybe several +seconds, whereas higher values such as ~25-27 degrees is the +most dominant during system run time. + +Additionally, the blue to red (And consequently blue to green) +ratio proportions may appear different on a modern flat panel +display than a CRT in some instances for the Atari 5200 system. +Furthermore, you may have some variation of proportions even +within the same display type. + +One side effect of this on the console's palette is that some +values of red may appear too pinkish - Too much blue to red. +This is not the same as a traditional tint-hue control +adjustment; rather, can be demonstrated by changing the blue +ratio values via MESS HLSL settings. + +Lastly, the Atari 2600 & 7800 NTSC color palettes hold the same +hue structure order and have similar appearance differences +dependent upon display type. +***************************************************************/ +/************************************************************** + * + * Palette - Phase Shift 26.2 + * + **************************************************************/ + +static const UINT8 atari_palette[256*3] = +{ + /* Grey */ + 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, + 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, + 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, + 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, + /* Gold */ + 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, + 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, + 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, + 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, + /* Orange */ + 0x31,0x00,0x00, 0x42,0x06,0x00, 0x53,0x17,0x00, 0x64,0x28,0x00, + 0x75,0x39,0x00, 0x86,0X4A,0x00, 0x97,0x5B,0x0B, 0xA8,0x6C,0x1C, + 0xB9,0x7D,0x2D, 0xCA,0x8E,0x3E, 0xDB,0x9F,0x4F, 0xEC,0xB0,0x60, + 0xFD,0xC1,0x71, 0xFF,0xD2,0x86, 0xFF,0xE3,0x9D, 0xFF,0xF4,0xB3, + /* Red-Orange */ + 0x3E,0x00,0x00, 0x4F,0x00,0x00, 0x60,0x08,0x00, 0x71,0x19,0x00, + 0x82,0x2A,0x0F, 0x93,0x3B,0x20, 0xA4,0x4C,0x31, 0xB5,0x5D,0x42, + 0xC6,0x6E,0x53, 0xD7,0x7F,0x64, 0xE8,0x90,0x75, 0xF9,0xA1,0x86, + 0xFF,0xB2,0x9A, 0xFF,0xC3,0xB0, 0xFF,0xD4,0xC6, 0xFF,0xE5,0xDC, + /* Pink */ + 0x3E,0x00,0x06, 0x4F,0x00,0x12, 0x60,0x00,0x1E, 0x71,0x0E,0x2E, + 0x82,0x1F,0x3F, 0x93,0x30,0x50, 0xA4,0x41,0x61, 0xB5,0x52,0x72, + 0xC6,0x63,0x83, 0xD7,0x74,0x94, 0xE8,0x85,0xA5, 0xF9,0x96,0xB6, + 0xFF,0xA7,0xCB, 0xFF,0xB8,0xE1, 0xFF,0xC9,0xEF, 0xFF,0xDA,0xF4, + /* Purple */ + 0x32,0x00,0x38, 0x43,0x00,0x44, 0x54,0x00,0x50, 0x65,0x0C,0x5F, + 0x76,0x1D,0x70, 0x87,0x2E,0x81, 0x98,0x3F,0x92, 0xA9,0x50,0xA3, + 0xBA,0x61,0xB4, 0xCB,0x72,0xC5, 0xDC,0x83,0xD6, 0xED,0x94,0xE4, + 0xFE,0xA5,0xE4, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, + /* Purple-Blue */ + 0x1B,0x00,0x5F, 0x2C,0x00,0x6B, 0x3D,0x00,0x77, 0x4E,0x11,0x88, + 0x5F,0x22,0x99, 0x70,0x33,0xAA, 0x81,0x44,0xBB, 0x92,0x55,0xCC, + 0xA3,0x66,0xDD, 0xB4,0x77,0xED, 0xC5,0x88,0xED, 0xD6,0x99,0xED, + 0xE7,0xAA,0xED, 0xF8,0xBB,0xED, 0xFF,0xCC,0xF0, 0xFF,0xDD,0xF5, + /* Blue 1 */ + 0x00,0x00,0x72, 0x10,0x00,0x7E, 0x21,0x0D,0x8E, 0x32,0x1E,0x9F, + 0x43,0x2F,0xB0, 0x54,0x40,0xC1, 0x65,0x51,0xD2, 0x76,0x62,0xE3, + 0x87,0x73,0xF4, 0x98,0x84,0xF9, 0xA9,0x95,0xF9, 0xBA,0xA6,0xF9, + 0xCB,0xB7,0xF9, 0xDC,0xC8,0xF9, 0xED,0xD9,0xF9, 0xFE,0xEA,0xF9, + /* Blue 2 */ + 0x00,0x00,0x65, 0x00,0x0C,0x7A, 0x05,0x1D,0x8E, 0x16,0x2E,0x9F, + 0x27,0x3F,0xB0, 0x38,0x50,0xC1, 0x49,0x61,0xD2, 0x5A,0x72,0xE3, + 0x6B,0x83,0xF4, 0x7C,0x94,0xFF, 0x8D,0xA5,0xFF, 0x9E,0xB6,0xFF, + 0xAF,0xC7,0xFF, 0xC0,0xD8,0xFF, 0xD1,0xE9,0xFF, 0xE2,0xFA,0xFF, + /* Light-Blue */ + 0x00,0x0D,0x48, 0x00,0x1E,0x5E, 0x00,0x2F,0x74, 0x00,0x40,0x8A, + 0x11,0x51,0x9B, 0x22,0x62,0xAC, 0x33,0x73,0xBD, 0x44,0x84,0xCE, + 0x55,0x95,0xDF, 0x66,0xA6,0xF0, 0x77,0xB7,0xFF, 0x88,0xC8,0xFF, + 0x99,0xD9,0xFF, 0xAA,0xEA,0xFF, 0xBB,0xFB,0xFF, 0xCC,0xFF,0xFF, + /* Turquoise */ + 0x00,0x1C,0x1C, 0x00,0x2D,0x32, 0x00,0x3E,0x49, 0x00,0x4F,0x5F, + 0x05,0x60,0x73, 0x16,0x71,0x84, 0x27,0x82,0x95, 0x38,0x93,0xA6, + 0x49,0xA4,0xB7, 0x5A,0xB5,0xC8, 0x6B,0xC6,0xD9, 0x7C,0xD7,0xEA, + 0x8D,0xE8,0xFB, 0x9E,0xF9,0xFF, 0xAF,0xFF,0xFF, 0xC0,0xFF,0xFF, + /* Green-Blue */ + 0x00,0x25,0x0B, 0x00,0x36,0x10, 0x00,0x47,0x18, 0x00,0x58,0x2E, + 0x07,0x69,0x42, 0x18,0x7A,0x53, 0x29,0x8B,0x64, 0x3A,0x9C,0x75, + 0x4B,0xAD,0x86, 0x5C,0xBE,0x97, 0x6D,0xCF,0xA8, 0x7E,0xE0,0xB9, + 0x8F,0xF1,0xCA, 0xA0,0xFF,0xDA, 0xB1,0xFF,0xE6, 0xC2,0xFF,0xF2, + /* Green */ + 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x04,0x5A,0x1A, + 0x15,0x6B,0x1A, 0x26,0x7C,0x22, 0x37,0x8D,0x33, 0x48,0x9E,0x44, + 0x59,0xAF,0x55, 0x6A,0xC0,0x66, 0x7B,0xD1,0x77, 0x8C,0xE2,0x88, + 0x9D,0xF3,0x99, 0xAE,0xFF,0xA8, 0xBF,0xFF,0xB4, 0xD0,0xFF,0xC0, + /* Yellow-Green */ + 0x00,0x21,0x0A, 0x00,0x32,0x0F, 0x0A,0x43,0x11, 0x1B,0x54,0x11, + 0x2C,0x65,0x11, 0x3D,0x76,0x11, 0x4E,0x87,0x11, 0x5F,0x98,0x1E, + 0x70,0xA9,0x2F, 0x81,0xBA,0x40, 0x92,0xCB,0x51, 0xA3,0xDC,0x62, + 0xB4,0xED,0x73, 0xC5,0xFE,0x84, 0xD6,0xFF,0x90, 0xE7,0xFF,0x9C, + /* Orange-Green */ + 0x05,0x13,0x04, 0x16,0x24,0x04, 0x27,0x35,0x04, 0x38,0x46,0x04, + 0x49,0x57,0x04, 0x5A,0x68,0x04, 0x6B,0x79,0x04, 0x7C,0x8A,0x09, + 0x8D,0x9B,0x1A, 0x9E,0xAC,0x2B, 0xAF,0xBD,0x3C, 0xC0,0xCE,0x4D, + 0xD1,0xDF,0x5E, 0xE2,0xF0,0x6F, 0xF3,0xFF,0x80, 0xFF,0xFF,0x8D, + /* Light-Orange */ + 0x21,0x02,0x00, 0x32,0x13,0x00, 0x43,0x24,0x00, 0x54,0x35,0x00, + 0x65,0x46,0x00, 0x76,0x57,0x00, 0x87,0x68,0x00, 0x98,0x79,0x0C, + 0xA9,0x8A,0x1D, 0xBA,0x9B,0x2E, 0xCB,0xAC,0x3F, 0xDC,0xBD,0x50, + 0xED,0xCE,0x61, 0xFE,0xDF,0x72, 0xFF,0xF0,0x87, 0xFF,0xFF,0x9D +}; + + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(a400_state, a400) +{ + for (int i = 0; i < sizeof(atari_palette) / 3; i++ ) + { + palette.set_pen_color(i, atari_palette[i*3], atari_palette[i*3+1], atari_palette[i*3+2]); + } +} +/****************************************************************** + PALETTE - PHASE 24.7 SHIFT + +GREY + 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, + 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, + 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, + 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, + +GOLD + 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, + 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, + 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, + 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, + +ORANGE + 0x30,0x00,0x00, 0x41,0x07,0x00, 0x52,0x18,0x00, 0x63,0x29,0x00, + 0x74,0x3A,0x00, 0x85,0x4B,0x00, 0x96,0x5C,0x0A, 0xA7,0x6D,0x1B, + 0xB8,0x7E,0x2C, 0xC9,0x8F,0x3D, 0xDA,0xA0,0x4E, 0xEB,0xB1,0x5F, + 0xFC,0xC2,0x70, 0xFF,0xD3,0x85, 0xFF,0xE4,0x9B, 0xFF,0xF5,0xB1, + +RED-ORANGE + 0x3D,0x00,0x00, 0x4E,0x00,0x00, 0x5F,0x09,0x00, 0x70,0x1A,0x00, + 0x81,0x2B,0x09, 0x92,0x3C,0x1A, 0xA3,0x4D,0x2B, 0xB4,0x5E,0x3C, + 0xC5,0x6F,0x4D, 0xD6,0x80,0x5E, 0xE7,0x91,0x6F, 0xF8,0xA2,0x80, + 0xFF,0xB3,0x94, 0xFF,0xC4,0xAA, 0xFF,0xD5,0xC0, 0xFF,0xE6,0xD6, + +PINK + 0x3F,0x00,0x00, 0x50,0x00,0x09, 0x61,0x00,0x15, 0x72,0x10,0x26, + 0x83,0x21,0x37, 0x94,0x32,0x48, 0xA5,0x43,0x59, 0xB6,0x54,0x6A, + 0xC7,0x65,0x7B, 0xD8,0x76,0x8C, 0xE9,0x87,0x9D, 0xFA,0x98,0xAE, + 0xFF,0xA9,0xC2, 0xFF,0xBA,0xD8, 0xFF,0xCB,0xEE, 0xFF,0xDC,0xF4, + +PURPLE + 0x36,0x00,0x2E, 0x47,0x00,0x3A, 0x58,0x00,0x46, 0x69,0x0C,0x55, + 0x7A,0x1D,0x66, 0x8B,0x2E,0x77, 0x9C,0x3F,0x88, 0xAD,0x50,0x99, + 0xBE,0x61,0xAA, 0xCF,0x72,0xBB, 0xE0,0x83,0xCC, 0xF1,0x94,0xDD, + 0xFF,0xA5,0xE4, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, + +PURPLE-BLUE + 0x23,0x00,0x55, 0x34,0x00,0x61, 0x45,0x00,0x6D, 0x56,0x0F,0x7E, + 0x67,0x20,0x8F, 0x78,0x31,0xA0, 0x89,0x42,0xB1, 0x9A,0x53,0xC2, + 0xAB,0x64,0xD3, 0xBC,0x75,0xE4, 0xCD,0x86,0xEA, 0xDE,0x97,0xEA, + 0xEF,0xA8,0xEA, 0xFF,0xB9,0xEA, 0xFF,0xCA,0xEF, 0xFF,0xDB,0xF4, + +BLUE1 + 0x09,0x00,0x6E, 0x1A,0x00,0x7A, 0x2B,0x08,0x88, 0x3C,0x19,0x99, + 0x4D,0x2A,0xAA, 0x5E,0x3B,0xBB, 0x6F,0x4C,0xCC, 0x80,0x5D,0xDD, + 0x91,0x6E,0xEE, 0xA2,0x7F,0xF4, 0xB3,0x90,0xF4, 0xC4,0xA1,0xF4, + 0xD5,0xB2,0xF4, 0xE6,0xC3,0xF4, 0xF7,0xD4,0xF4, 0xFF,0xE5,0xF7, + +BLUE2 + 0x00,0x00,0x6D, 0x00,0x05,0x80, 0x10,0x16,0x91, 0x21,0x27,0xA2, + 0x32,0x38,0xB3, 0x43,0x49,0xC4, 0x54,0x5A,0xD5, 0x65,0x6B,0xE6, + 0x76,0x7C,0xF7, 0x87,0x8D,0xFF, 0x98,0x9E,0xFF, 0xA9,0xAF,0xFF, + 0xBA,0xC0,0xFF, 0xCB,0xD1,0xFF, 0xDC,0xE2,0xFF, 0xED,0xF3,0xFF + +LIGHT-BLUE + 0x00,0x05,0x57, 0x00,0x16,0x6E, 0x00,0x27,0x84, 0x09,0x38,0x97, + 0x1A,0x49,0xA8, 0x2B,0x5A,0xB9, 0x3C,0x6B,0xCA, 0x4D,0x7C,0xDB, + 0x5E,0x8D,0xEC, 0x6F,0x9E,0xFD, 0x80,0xAF,0xFF, 0x91,0xC0,0xFF, + 0xA2,0xD1,0xFF, 0xB3,0xE2,0xFF, 0xC4,0xF3,0xFF, 0xD5,0xFF,0xFF, + +TURQUOISE + 0x00,0x15,0x34, 0x00,0x26,0x4A, 0x00,0x37,0x60, 0x00,0x48,0x77, + 0x0A,0x59,0x8A, 0x1B,0x6A,0x9B, 0x2C,0x7B,0xAC, 0x3D,0x8C,0xBD, + 0x4E,0x9D,0xCE, 0x5F,0xAE,0xDF, 0x70,0xBF,0xF0, 0x81,0xD0,0xFF, + 0x92,0xE1,0xFF, 0xA3,0xF2,0xFF, 0xB4,0xFF,0xFF, 0xC5,0xFF,0xFF + +GREEN-BLUE + 0x00,0x21,0x0A, 0x00,0x32,0x1F, 0x00,0x43,0x35, 0x00,0x54,0x4B, + 0x04,0x65,0x60, 0x15,0x76,0x71, 0x26,0x87,0x82, 0x37,0x98,0x93, + 0x48,0xA9,0xA4, 0x59,0xBA,0xB5, 0x6A,0xCB,0xC6, 0x7B,0xDC,0xD7, + 0x8C,0xED,0xE8, 0x9D,0xFE,0xF9, 0xAE,0xFF,0xFF, 0xBF,0xFF,0xFF, + +GREEN + 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1D, + 0x0A,0x6B,0x30, 0x1B,0x7C,0x41, 0x2C,0x8D,0x52, 0x3D,0x9E,0x63, + 0x4E,0xAF,0x74, 0x5F,0xC0,0x85, 0x70,0xD1,0x96, 0x81,0xE2,0xA7, + 0x92,0xF3,0xB8, 0xA3,0xFF,0xC8, 0xB4,0xFF,0xD3, 0xC5,0xFF,0xDF, + +YELLOW-GREEN + 0x00,0x26,0x0B, 0x00,0x37,0x10, 0x00,0x48,0x16, 0x0A,0x59,0x18, + 0x1B,0x6A,0x18, 0x2C,0x7B,0x18, 0x3D,0x8C,0x27, 0x4E,0x9D,0x38, + 0x5F,0xAE,0x49, 0x70,0xBF,0x5A, 0x81,0xD0,0x6B, 0x92,0xE1,0x7C, + 0xA3,0xF2,0x8D, 0xB4,0xFF,0x9C, 0xC5,0xFF,0xA8, 0xD6,0xFF,0xB4, + +ORANGE-GREEN + 0x00,0x1E,0x09, 0x00,0x2F,0x0E, 0x11,0x40,0x0E, 0x22,0x51,0x0E, + 0x33,0x62,0x0E, 0x44,0x73,0x0E, 0x55,0x84,0x0E, 0x66,0x95,0x17, + 0x77,0xA6,0x28, 0x88,0xB7,0x39, 0x99,0xC8,0x4A, 0xAA,0xD9,0x5B, + 0xBB,0xEA,0x6C, 0xCC,0xFB,0x7D, 0xDD,0xFF,0x8A, 0xEE,0xFF,0x96, + +LIGHT-ORANGE + 0x0A,0x11,0x02, 0x1B,0x22,0x02, 0x2C,0x33,0x02, 0x3D,0x44,0x02, + 0x4E,0x55,0x02, 0x5F,0x66,0x02, 0x70,0x77,0x02, 0x81,0x88,0x09, + 0x92,0x99,0x1A, 0xA3,0xAA,0x2B, 0xB4,0xBB,0x3C, 0xC5,0xCC,0x4D, + 0xD6,0xDD,0x5E, 0xE7,0xEE,0x6F, 0xF8,0xFF,0x80, 0xFF,0xFF,0x8F, +******************************************************************* + +******************************************************************* + PALETTE - PHASE 25.2 SHIFT + +GREY + 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, + 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, + 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, + 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, + +GOLD + 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, + 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, + 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, + 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, + +ORANGE + 0x30,0x00,0x00, 0x41,0x07,0x00, 0x52,0x18,0x00, 0x63,0x29,0x00, + 0x74,0x3A,0x00, 0x85,0x4B,0x00, 0x96,0x5C,0x0A, 0xA7,0x6D,0x1B, + 0xB8,0x7E,0x2C, 0xC9,0x8F,0x3D, 0xDA,0xA0,0x4E, 0xEB,0xB1,0x5F, + 0xFC,0xC2,0x70, 0xFF,0xD3,0x85, 0xFF,0xE4,0x9B, 0xFF,0xF5,0xB1, + +RED-ORANGE + 0x3E,0x00,0x00, 0x4F,0x00,0x00, 0x60,0x09,0x00, 0x71,0x1A,0x00, + 0x82,0x2B,0x0B, 0x93,0x3C,0x1C, 0xA4,0x4D,0x2D, 0xB5,0x5E,0x3E, + 0xC6,0x6F,0x4F, 0xD7,0x80,0x60, 0xE8,0x91,0x71, 0xF9,0xA2,0x82, + 0xFF,0xB3,0x96, 0xFF,0xC4,0xAC, 0xFF,0xD5,0xC2, 0xFF,0xE6,0xD8, + +PINK + 0x3F,0x00,0x00, 0x50,0x00,0x0C, 0x61,0x00,0x18, 0x72,0x0F,0x28, + 0x83,0x20,0x39, 0x94,0x31,0x4A, 0xA5,0x42,0x5B, 0xB6,0x53,0x6C, + 0xC7,0x64,0x7D, 0xD8,0x75,0x8E, 0xE9,0x86,0x9F, 0xFA,0x97,0xB0, + 0xFF,0xA8,0xC5, 0xFF,0xB9,0xDB, 0xFF,0xCA,0xEF, 0xFF,0xDB,0xF4, + +PURPLE + 0x35,0x00,0x31, 0x46,0x00,0x3D, 0x57,0x00,0x49, 0x68,0x0C,0x58, + 0x79,0x1D,0x69, 0x8A,0x2E,0x7A, 0x9B,0x3F,0x8B, 0xAC,0x50,0x9C, + 0xBD,0x61,0xAD, 0xCE,0x72,0xBE, 0xDF,0x83,0xCF, 0xF0,0x94,0xE0, + 0xFF,0xA5,0xE4, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, + +PURPLE-BLUE + 0x20,0x00,0x59, 0x31,0x00,0x65, 0x42,0x00,0x71, 0x53,0x10,0x82, + 0x64,0x21,0x93, 0x75,0x32,0xA4, 0x86,0x43,0xB5, 0x97,0x54,0xC6, + 0xA8,0x65,0xD7, 0xB9,0x76,0xE8, 0xCA,0x87,0xEB, 0xDB,0x98,0xEB, + 0xEC,0xA9,0xEB, 0xFD,0xBA,0xEB, 0xFF,0xCB,0xEF, 0xFF,0xDC,0xF4, + +BLUE1 + 0x05,0x00,0x70, 0x16,0x00,0x7C, 0x27,0x09,0x8B, 0x38,0x1A,0x9C, + 0x49,0x2B,0xAD, 0x5A,0x3C,0xBE, 0x6B,0x4D,0xCF, 0x7C,0x5E,0xE0, + 0X8D,0x6F,0xF1, 0x9E,0x80,0xF6, 0xAF,0x91,0xF6, 0xC0,0xA2,0xF6, + 0xD1,0xB3,0xF6, 0xE2,0xC4,0xF6, 0xF3,0xD5,0xF6, 0xFF,0xE6,0xF7, + +BLUE2 + 0x00,0x00,0x6B, 0x00,0x08,0x7E, 0x0C,0x19,0x91, 0x1D,0x2A,0xA2, + 0x2E,0x3B,0xB3, 0x3F,0x4C,0xC4, 0x50,0x5D,0xD5, 0x61,0x6E,0xE6, + 0x72,0x7F,0xF7, 0x83,0x90,0xFF, 0x94,0xA1,0xFF, 0xA5,0xB2,0xFF, + 0xB6,0xC3,0xFF, 0xC7,0xD4,0xFF, 0xD8,0xE5,0xFF, 0xE9,0xF6,0xFF, + +LIGHT-BLUE + 0x00,0x08,0x52, 0x00,0x19,0x68, 0x00,0x2A,0x7F, 0x05,0x3B,0x93, + 0x16,0x4C,0xA4, 0x27,0x5D,0xB5, 0x38,0x6E,0xC6, 0x49,0x7F,0xD7, + 0x5A,0x90,0xE8, 0x6B,0xA1,0xF9, 0x7C,0xB2,0xFF, 0x8D,0xC3,0xFF, + 0x9E,0xD4,0xFF, 0xAF,0xE5,0xFF, 0xC0,0xF6,0xFF, 0xD1,0xFF,0xFF, + +TURQUOISE + 0x00,0x17,0x2D, 0x00,0x28,0x43, 0x00,0x39,0x59, 0x00,0x4A,0x6F, + 0x08,0x5B,0x83, 0x19,0x6C,0x94, 0x2A,0x7D,0xA5, 0x3B,0x8E,0xB6, + 0x4C,0x9F,0xC7, 0x5D,0xB0,0xD8, 0x6E,0xC1,0xE9, 0x7F,0xD2,0xFA, + 0x90,0xE3,0xFF, 0xA1,0xF4,0xFF, 0xB2,0xFF,0xFF, 0xC3,0xFF,0xFF, + +GREEN-BLUE + 0x00,0x23,0x0A, 0x00,0x34,0x15, 0x00,0x45,0x2B, 0x00,0x56,0x41, + 0x04,0x67,0x56, 0x15,0x78,0x67, 0x26,0x89,0x78, 0x37,0x9A,0x89, + 0x48,0xAB,0x9A, 0x59,0xBC,0xAB, 0x6A,0xCD,0xBC, 0x7B,0xDE,0xCD, + 0x8C,0xEF,0xDE, 0x9D,0xFF,0xEE, 0xAE,0xFF,0xFA, 0xBF,0xFF,0xFF, + +GREEN + 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1B, + 0x0D,0x6B,0x25, 0x1E,0x7C,0x36, 0x2F,0x8D,0x47, 0x40,0x9E,0x58, + 0x51,0xAF,0x69, 0x62,0xC0,0x7A, 0x73,0xD1,0x8B, 0x84,0xE2,0x9C, + 0x95,0xF3,0xAD, 0xA6,0xFF,0xBD, 0xB7,0xFF,0xC9, 0xC8,0xFF,0xD4, + +YELLOW-GREEN + 0x00,0x24,0x0B, 0x00,0x35,0x10, 0x00,0x46,0x15, 0x10,0x57,0x15, + 0x21,0x68,0x15, 0x32,0x79,0x15, 0x43,0x8A,0x1C, 0x54,0x9B,0x2D, + 0x65,0xAC,0x3E, 0x76,0xBD,0x4F, 0x87,0xCE,0x60, 0x98,0xDF,0x71, + 0xA9,0xF0,0x82, 0xBA,0xFF,0x93, 0xCB,0xFF,0x9F, 0xDC,0xFF,0xAA, + +ORANGE-GREEN + 0x00,0x1B,0x08, 0x08,0x2C,0x0B, 0x19,0x3D,0x0B, 0x2A,0x4E,0x0B, + 0x3B,0x5F,0x0B, 0x4C,0x70,0x0B, 0x5D,0x81,0x0B, 0x6E,0x92,0x11, + 0x7F,0xA3,0x22, 0x90,0xB4,0x33, 0xA1,0xC5,0x44, 0xB2,0xD6,0x55, + 0xC3,0xE7,0x66, 0xD4,0xF8,0x77, 0xE5,0xFF,0x85, 0xF6,0xFF,0x91, + +LIGHT-ORANGE + 0x12,0x0C,0x00, 0x23,0x1D,0x00, 0x34,0x2E,0x00, 0x45,0x3F,0x00, + 0x56,0x50,0x00, 0x67,0x61,0x00, 0x78,0x72,0x00, 0x89,0x83,0x08, + 0x9A,0x94,0x19, 0xAB,0xA5,0x2A, 0xBC,0xB6,0x3B, 0xCD,0xC7,0x4C, + 0xDE,0xD8,0x5D, 0xEF,0xE9,0x6E, 0xFF,0xFA,0x80, 0xFF,0xFF,0x92, +******************************************************************* + +******************************************************************* + PALETTE - PHASE 25.7 SHIFT +GREY + 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, + 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, + 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, + 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, + +GOLD + 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, + 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, + 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, + 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, + +ORANGE + 0x31,0x00,0x00, 0x42,0x06,0x00, 0x53,0x17,0x00, 0x64,0x28,0x00, + 0x75,0x39,0x00, 0x86,0X4A,0x00, 0x97,0x5B,0x0A, 0xA8,0x6C,0x1B, + 0xB9,0x7D,0x2C, 0xCA,0x8E,0x3D, 0xDB,0x9F,0x4E, 0xEC,0xB0,0x5F, + 0xFD,0xC1,0x70, 0xFF,0xD2,0x85, 0xFF,0xE3,0x9C, 0xFF,0xF4,0xB2, + +RED-ORANGE + 0x3E,0x00,0x00, 0x4F,0x00,0x00, 0x60,0x08,0x00, 0x71,0x19,0x00, + 0x82,0x2A,0x0D, 0x93,0x3B,0x1E, 0xA4,0x4C,0x2F, 0xB5,0x5D,0x40, + 0xC6,0x6E,0x51, 0xD7,0x7F,0x62, 0xE8,0x90,0x73, 0xF9,0xA1,0x83, + 0xFF,0xB2,0x98, 0xFF,0xC3,0xAE, 0xFF,0xD4,0xC4, 0xFF,0xE5,0xDA, + +PINK + 0x3F,0x00,0x03, 0x50,0x00,0x0F, 0x61,0x00,0x1B, 0x72,0x0F,0x2B, + 0x83,0x20,0x3C, 0x94,0x31,0x4D, 0xA5,0x42,0x5E, 0xB6,0x53,0x6F, + 0xC7,0x64,0x80, 0xD8,0x75,0x91, 0xE9,0x86,0xA2, 0xFA,0x97,0xB3, + 0xFF,0xA8,0xC8, 0xFF,0xB9,0xDE, 0xFF,0xCA,0xEF, 0xFF,0xDB,0xF4, + +PURPLE + 0x33,0x00,0x35, 0x44,0x00,0x41, 0x55,0x00,0x4C, 0x66,0x0C,0x5C, + 0x77,0x1D,0x6D, 0x88,0x2E,0x7E, 0x99,0x3F,0x8F, 0xAA,0x50,0xA0, + 0xBB,0x61,0xB1, 0xCC,0x72,0xC2, 0xDD,0x83,0xD3, 0xEE,0x94,0xE4, + 0xFF,0xA5,0xE4, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, + +PURPLE-BLUE + 0x1D,0x00,0x5C, 0x2E,0x00,0x68, 0x40,0x00,0x74, 0x51,0x10,0x84, + 0x62,0x21,0x95, 0x73,0x32,0xA6, 0x84,0x43,0xB7, 0x95,0x54,0xC8, + 0xA6,0x65,0xD9, 0xB7,0x76,0xEA, 0xC8,0x87,0xEB, 0xD9,0x98,0xEB, + 0xE9,0xA9,0xEC, 0xFB,0xBA,0xEB, 0xFF,0xCB,0xEF, 0xFF,0xDC,0xF4, + +BLUE1 + 0x02,0x00,0x71, 0x13,0x00,0x7D, 0x24,0x0B,0x8C, 0x35,0x1C,0x9D, + 0x46,0x2D,0xAE, 0x57,0x3E,0xBF, 0x68,0x4F,0xD0, 0x79,0x60,0xE1, + 0x8A,0x71,0xF2, 0x9B,0x82,0xF7, 0xAC,0x93,0xF7, 0xBD,0xA4,0xF7, + 0xCE,0xB5,0xF7, 0xDF,0xC6,0xF7, 0xF0,0xD7,0xF7, 0xFF,0xE8,0xF8, + +BLUE2 + 0x00,0x00,0x68, 0x00,0x0A,0x7C, 0x08,0x1B,0x90, 0x19,0x2C,0xA1, + 0x2A,0x3D,0xB2, 0x3B,0x4E,0xC3, 0x4C,0x5F,0xD4, 0x5D,0x70,0xE5, + 0x6E,0x81,0xF6, 0x7F,0x92,0xFF, 0x90,0xA3,0xFF, 0xA1,0xB4,0xFF, + 0xB2,0xC5,0xFF, 0xC3,0xD6,0xFF, 0xD4,0xE7,0xFF, 0xE5,0xF8,0xFF, + +LIGHT-BLUE + 0x00,0x0A,0x4D, 0x00,0x1B,0x63, 0x00,0x2C,0x79, 0x02,0x3D,0x8F, + 0x13,0x4E,0xA0, 0x24,0x5F,0xB1, 0x35,0x70,0xC2, 0x46,0x81,0xD3, + 0x57,0x92,0xE4, 0x68,0xA3,0xF5, 0x79,0xB4,0xFF, 0x8A,0xC5,0xFF, + 0x9B,0xD6,0xFF, 0xAC,0xE7,0xFF, 0xBD,0xF8,0xFF, 0xCE,0xFF,0xFF, + +TURQUOISE + 0x00,0x1A,0x26, 0x00,0x2B,0x3C, 0x00,0x3C,0x52, 0x00,0x4D,0x68, + 0x06,0x5E,0x7C, 0x17,0x6F,0x8D, 0x28,0x80,0x9E, 0x39,0x91,0xAF, + 0x4A,0xA2,0xC0, 0x5B,0xB3,0xD1, 0x6C,0xC4,0xE2, 0x7D,0xD5,0xF3, + 0x8E,0xE6,0xFF, 0x9F,0xF7,0xFF, 0xB0,0xFF,0xFF, 0xC1,0xFF,0xFF, + +GREEN-BLUE + 0x00,0x24,0x0B, 0x00,0x35,0x10, 0x00,0x46,0x22, 0x00,0x57,0x38, + 0x05,0x68,0x4D, 0x16,0x79,0x5E, 0x27,0x8A,0x6F, 0x38,0x9B,0x80, + 0x49,0xAC,0x91, 0x5A,0xBD,0xA2, 0x6B,0xCE,0xB3, 0x7C,0xDF,0xC4, + 0x8D,0xF0,0xD5, 0x9E,0xFF,0xE5, 0xAF,0xFF,0xF1, 0xC0,0xFF,0xFD, + +GREEN + 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1B, + 0x10,0x6B,0x1B, 0x21,0x7C,0x2C, 0x32,0x8D,0x3D, 0x43,0x9E,0x4E, + 0x54,0xAF,0x5F, 0x65,0xC0,0x70, 0x76,0xD1,0x81, 0x87,0xE2,0x92, + 0x98,0xF3,0xA3, 0xA9,0xFF,0xB3, 0xBA,0xFF,0xBF, 0xCB,0xFF,0xCB, + +YELLOW-GREEN + 0x00,0x23,0x0A, 0x00,0x34,0x10, 0x04,0x45,0x13, 0x15,0x56,0x13, + 0x26,0x67,0x13, 0x37,0x78,0x13, 0x48,0x89,0x14, 0x59,0x9A,0x25, + 0x6A,0xAB,0x36, 0x7B,0xBC,0x47, 0x8C,0xCD,0x58, 0x9D,0xDE,0x69, + 0xAE,0xEF,0x7A, 0xBF,0xFF,0x8B, 0xD0,0xFF,0x97, 0xE1,0xFF,0xA3, + +ORANGE-GREEN + 0x00,0x17,0x07, 0x0E,0x28,0x08, 0x1F,0x39,0x08, 0x30,0x4A,0x08, + 0x41,0x5B,0x08, 0x52,0x6C,0x08, 0x63,0x7D,0x08, 0x74,0x8E,0x0D, + 0x85,0x9F,0x1E, 0x96,0xB0,0x2F, 0xA7,0xC1,0x40, 0xB8,0xD2,0x51, + 0xC9,0xE3,0x62, 0xDA,0xF4,0x73, 0xEB,0xFF,0x82, 0xFC,0xFF,0x8E, + +LIGHT-ORANGE + 0x19,0x07,0x00, 0x2A,0x18,0x00, 0x3B,0x29,0x00, 0x4C,0x3A,0x00, + 0x5D,0x4B,0x00, 0x6E,0x5C,0x00, 0x7F,0x6D,0x00, 0x90,0x7E,0x09, + 0xA1,0x8F,0x1A, 0xB2,0xA0,0x2B, 0xC3,0xB1,0x3C, 0xD4,0xC2,0x4D, + 0xE5,0xD3,0x5E, 0xF6,0xE4,0x6F, 0xFF,0xF5,0x82, 0xFF,0xFF,0x96, +******************************************************************* + +******************************************************************* + PALETTE - PHASE 26.7 SHIFT + +GREY + 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, + 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, + 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, + 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, + +GOLD + 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, + 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, + 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, + 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xFF,0x97, + +ORANGE + 0x32,0x00,0x00, 0x43,0x06,0x00, 0x54,0x17,0x00, 0x65,0x28,0x00, + 0x79,0x39,0x00, 0x87,0x4A,0x00, 0x98,0x5B,0x0C, 0xA9,0x6C,0x1D, + 0xBA,0x7D,0x2E, 0xCB,0x8E,0x3F, 0xDC,0x9F,0x50, 0xED,0xB0,0x61, + 0xFE,0xC1,0x72, 0xFF,0xD2,0x87, 0xFF,0xE3,0x9E, 0xFF,0xF4,0xB4, + +RED-ORANGE + 0x3E,0x00,0x00, 0x4F,0x00,0x00, 0x60,0x07,0x00, 0x71,0x18,0x00, + 0x82,0x29,0x10, 0x93,0x3A,0x21, 0xA4,0x4B,0x32, 0xB5,0x5C,0x43, + 0xC6,0x6D,0x54, 0xD7,0x7E,0x65, 0xE8,0x8F,0x76, 0xF9,0xA0,0x87, + 0xFF,0xB1,0x9C, 0xFF,0xC2,0xB2, 0xFF,0xD3,0xC8, 0xFF,0xE4,0xDE, + +PINK + 0x3E,0x00,0x09, 0x4F,0x00,0x15, 0x60,0x00,0x21, 0x71,0x0E,0x31, + 0x82,0x1F,0x42, 0x93,0x30,0x53, 0xA4,0x41,0x64, 0xB5,0x52,0x75, + 0xC6,0x63,0x86, 0xD7,0x74,0x97, 0xE8,0x85,0xA8, 0xF9,0x96,0xB9, + 0xFF,0xA7,0xCE, 0xFF,0xB8,0xE4, 0xFF,0xC9,0xEF, 0xFF,0xDA,0xF4, + +PURPLE + 0x30,0x00,0x3D, 0x41,0x00,0x48, 0x52,0x00,0x54, 0x63,0x0C,0x64, + 0x74,0x1D,0x75, 0x85,0x2E,0x86, 0x96,0x3F,0x97, 0xA7,0x50,0xA8, + 0xB8,0x61,0xB9, 0xC9,0x72,0xCA, 0xDA,0x83,0xDB, 0xEB,0x94,0xE5, + 0xFC,0xA5,0xE5, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, + +PURPLE-BLUE + 0x18,0x00,0x62, 0x29,0x00,0x6E, 0x3A,0x01,0x7A, 0x4B,0x12,0x8B, + 0x5C,0x23,0x9C, 0x6D,0x34,0xAD, 0x7E,0x45,0xBE, 0x8F,0x56,0xCF, + 0xA0,0x67,0xE0, 0xB1,0x78,0xEE, 0xC2,0x89,0xEE, 0xD3,0x9A,0xEE, + 0xE4,0xAB,0xEE, 0xF5,0xBC,0xEE, 0xFF,0xCD,0xE0, 0xFF,0xDE,0xF5, + +BLUE1 + 0x00,0x00,0x72, 0x0C,0x00,0x7F, 0x1D,0x0E,0x8F, 0x2E,0x1F,0xA0, + 0x3F,0x30,0xB1, 0x50,0x41,0xC2, 0x61,0x52,0xD3, 0x72,0x63,0xE4, + 0x83,0x74,0xF5, 0x94,0x85,0xFA, 0xA5,0x96,0xFA, 0xB6,0xA7,0xFA, + 0xC7,0xB8,0xFA, 0xD8,0xC9,0xFA, 0xE9,0xDA,0xFA, 0xFA,0xE8,0xFA, + +BLUE2 + 0x00,0x00,0x62, 0x00,0x0F,0x77, 0x01,0x20,0x8D, 0x12,0x31,0x9E, + 0x23,0x42,0xAF, 0x34,0x53,0xC0, 0x45,0x64,0xD1, 0x56,0x75,0xE2, + 0x67,0x86,0xF3, 0x78,0x97,0xFF, 0x89,0xA8,0xFF, 0x9A,0xB9,0xFF, + 0xAB,0xCA,0xFF, 0xBC,0xDB,0xFF, 0xCD,0xEC,0xFF, 0xDE,0xFD,0xFF, + +LIGHT-BLUE + 0x00,0x10,0x42, 0x00,0x21,0x58, 0x00,0x32,0x6E, 0x00,0x43,0x84, + 0x0E,0x54,0x96, 0x1F,0x65,0xA7, 0x30,0x76,0xB8, 0x41,0x87,0xC9, + 0x52,0x98,0xDA, 0x63,0xA9,0xEB, 0x74,0xBA,0xFC, 0x85,0xCB,0xFF, + 0x96,0xDC,0xFF, 0xA7,0xED,0xFF, 0xB8,0xFE,0xFF, 0xC9,0xFF,0xFF, + +TURQUOISE + 0x00,0x1E,0x14, 0x00,0x2F,0x2A, 0x00,0x40,0x40, 0x00,0x51,0x56, + 0x04,0x62,0x6B, 0x15,0x73,0x7C, 0x26,0x84,0x8D, 0x37,0x95,0x9E, + 0x48,0xA6,0xAF, 0x59,0xB7,0xC0, 0x6A,0xC8,0xD1, 0x7B,0xD9,0xE2, + 0x8C,0xEA,0xF3, 0x9D,0xFB,0xFF, 0xAE,0xFF,0xFF, 0xBF,0xFF,0xFF, + +GREEN-BLUE + 0x00,0x26,0x0B, 0x00,0x37,0x10, 0x00,0x48,0x16, 0x00,0x59,0x25, + 0x08,0x6A,0x38, 0x19,0x7B,0x49, 0x2A,0x8C,0x5A, 0x3B,0x9D,0x6B, + 0x4C,0xAE,0x7C, 0x5D,0xBF,0x8D, 0x6E,0xD0,0x9E, 0x7F,0xE1,0xAF, + 0x90,0xF2,0xC0, 0xA1,0xFF,0xD0, 0xB2,0xFF,0xDC, 0xC3,0xFF,0xE8, + +GREEN + 0x00,0x26,0x0B, 0x00,0x37,0x10, 0x00,0x48,0x16, 0x08,0x59,0x18, + 0x19,0x6A,0x18, 0x2A,0x7B,0x18, 0x3B,0x8C,0x29, 0x4C,0x9D,0x3A, + 0x5D,0xAE,0x4B, 0x6E,0xBF,0x5C, 0x7F,0xD0,0x6D, 0x90,0xE1,0x7E, + 0xA1,0xF2,0x8F, 0xB2,0xFF,0x9F, 0xC3,0xFF,0xAB, 0xD4,0xFF,0xB7, + +YELLOW-GREEN + 0x00,0x1E,0x09, 0x00,0x2F,0x0E, 0x11,0x40,0x0E, 0x22,0x51,0x0E, + 0x33,0x62,0x0E, 0x44,0x73,0x0E, 0x55,0x84,0x0E, 0x66,0x95,0x17, + 0x77,0xA6,0x28, 0x88,0xB7,0x39, 0x99,0xC8,0x4A, 0xAA,0xD9,0x5B, + 0xBB,0xEA,0x6C, 0xCC,0xFB,0x7D, 0xDD,0xFF,0x8A, 0xEE,0xFF,0x96, + +ORANGE-GREEN + 0x0D,0x0F,0x01, 0x1E,0x20,0x01, 0x2F,0x31,0x01, 0x40,0x42,0x01, + 0x51,0x53,0x01, 0x62,0x64,0x01, 0x73,0x75,0x01, 0x84,0x86,0x08, + 0x95,0x97,0x19, 0xA6,0xA8,0x2A, 0xB7,0xB9,0x3B, 0xC8,0xCA,0x4C, + 0xD9,0xDB,0x5D, 0xEA,0xEC,0x6E, 0xFB,0xFD,0x7F, 0xFF,0xFF,0x8F, + +LIGHT-ORANGE + 0x28,0x00,0x00, 0x39,0x0E,0x00, 0x4A,0x1F,0x00, 0x5B,0x30,0x00, + 0x6C,0x41,0x00, 0x7D,0x52,0x00, 0x8E,0x63,0x00, 0x9F,0x74,0x10, + 0xB0,0x85,0x21, 0xC1,0x96,0x32, 0xD2,0xA7,0x43, 0xE3,0xB8,0x54, + 0xF4,0xC9,0x65, 0xFF,0xDA,0x78, 0xFF,0xEB,0x8E, 0xFF,0xFC,0xA4, +******************************************************************* + +******************************************************************* + PALETTE - PHASE 27.2 SHIFT + + +GREY + 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, + 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, + 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, + 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, + +GOLD + 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, + 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, + 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, + 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, + +ORANGE + 0x32,0x00,0x00, 0x43,0x05,0x00, 0x54,0x16,0x00, 0x65,0x27,0x00, + 0x76,0x38,0x00, 0x87,0X49,0x00, 0x98,0x5A,0x0C, 0xA9,0x6B,0x1D, + 0xBA,0x7C,0x2E, 0xCB,0x8D,0x3F, 0xDC,0x9E,0x50, 0xED,0xAF,0x61, + 0xFE,0xC0,0x72, 0xFF,0xD1,0x88, 0xFF,0xE2,0x9E, 0xFF,0xF3,0xB4, + +RED-ORANGE + 0x3F,0x00,0x00, 0x50,0x00,0x00, 0x61,0x07,0x00, 0x72,0x18,0x01, + 0x83,0x29,0x12, 0x94,0x3A,0x23, 0xA5,0x4B,0x34, 0xB6,0x5C,0x45, + 0xC7,0x6D,0x56, 0xD8,0x7E,0x67, 0xE9,0x8F,0x78, 0xFA,0xA0,0x89, + 0xFF,0xB1,0x9E, 0xFF,0xC2,0xB4, 0xFF,0xD3,0xCA, 0xFF,0xE4,0xE0, + +PINK + 0x3E,0x00,0x0C, 0x4F,0x00,0x18, 0x60,0x00,0x24, 0x71,0x0E,0x34, + 0x82,0x1F,0x45, 0x93,0x30,0x56, 0xA4,0x41,0x67, 0xB5,0x52,0x78, + 0xC6,0x63,0x89, 0xD7,0x74,0x9A, 0xE8,0x85,0xAB, 0xF9,0x96,0xB6, + 0xFF,0xA7,0xD1, 0xFF,0xB8,0xE7, 0xFF,0xC9,0xEF, 0xFF,0xDA,0xF4, + +PURPLE + 0x2F,0x00,0x3F, 0x40,0x00,0x4B, 0x51,0x00,0x57, 0x62,0x0C,0x66, + 0x73,0x1D,0x77, 0x84,0x2E,0x88, 0x95,0x3F,0x99, 0xA6,0x50,0xAA, + 0xB7,0x61,0xBB, 0xC8,0x72,0xCC, 0xD9,0x83,0xDD, 0xEA,0x94,0xE5, + 0xFB,0xA5,0xE5, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, + +PURPLE-BLUE + 0x16,0x00,0x64, 0x27,0x00,0x70, 0x38,0x02,0x7D, 0x49,0x13,0x8E, + 0x5A,0x24,0x9F, 0x6B,0x35,0xB0, 0x7C,0x46,0xC1, 0x8D,0x57,0xD2, + 0x9E,0x68,0xE3, 0xAF,0x79,0xEF, 0xC0,0x8A,0xEF, 0xD1,0x9D,0xEF, + 0xE2,0xAC,0xEF, 0xF3,0xBD,0xEF, 0xFF,0xCE,0xF0, 0xFF,0xDF,0xF5, + +BLUE1 + 0x00,0x00,0x71, 0x09,0x00,0x7F, 0x1A,0x10,0x90, 0x2B,0x21,0xA1, + 0x3C,0x32,0xB2, 0x4D,0x43,0xC3, 0x5E,0x54,0xD4, 0x6F,0x65,0xE5, + 0x80,0x76,0xF6, 0x91,0x87,0xFC, 0xA2,0x98,0xFC, 0xB3,0xA9,0xFC, + 0xC4,0xBA,0xFC, 0xD5,0xCB,0xFC, 0xE6,0xDC,0xFC, 0xF7,0xED,0xFC, + +BLUE2 + 0x00,0x00,0x5E, 0x00,0x11,0x74, 0x00,0x22,0x8A, 0x0F,0x33,0x9C, + 0x20,0x44,0xAD, 0x31,0x55,0xBE, 0x42,0x66,0xCF, 0x53,0x77,0xE0, + 0x64,0x88,0xF1, 0x75,0x99,0xFF, 0x86,0xAA,0xFF, 0x97,0xBB,0xFF, + 0xA8,0xCC,0xFF, 0xB9,0xDD,0xFF, 0xCA,0xEE,0xFF, 0xDB,0xFF,0xFF, + +LIGHT-BLUE + 0x00,0x12,0x3B, 0x00,0x23,0x51, 0x00,0x34,0x68, 0x00,0x45,0x7E, + 0x0C,0x56,0x90, 0x1D,0x67,0xA1, 0x2E,0x78,0xB2, 0x3F,0x89,0xC3, + 0x50,0x9A,0xD4, 0x61,0xAB,0xE5, 0x72,0xBC,0xF6, 0x83,0xCD,0xFF, + 0x94,0xDE,0xFF, 0xA5,0xEF,0xFF, 0xB6,0xFF,0xFF, 0xC7,0xFF,0xFF, + +TURQUOISE + 0x00,0x20,0x0C, 0x00,0x31,0x22, 0x00,0x42,0x38, 0x00,0x53,0x4E, + 0x04,0x64,0x63, 0x15,0x75,0x74, 0x26,0x86,0x85, 0x37,0x97,0x96, + 0x48,0xA8,0xA7, 0x59,0xB9,0xB8, 0x6A,0xCA,0xC9, 0x7B,0xDB,0xDA, + 0x8C,0xEC,0xEB, 0x9D,0xFD,0xFC, 0xAE,0xFF,0xFF, 0xBF,0xFF,0xFF, + +GREEN-BLUE + 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1C, + 0x0B,0x6B,0x2F, 0x1C,0x7C,0x40, 0x2D,0x8D,0x51, 0x3E,0x9E,0x62, + 0x4F,0xAF,0x73, 0x60,0xC0,0x84, 0x71,0xD1,0x95, 0x82,0xE2,0xA6, + 0x93,0xF3,0xB7, 0xA4,0xFF,0xC6, 0xB5,0xFF,0xD2, 0xC6,0xFF,0xDE, + +GREEN + 0x00,0x25,0x0B, 0x00,0x36,0x10, 0x00,0x47,0x15, 0x0D,0x58,0x16, + 0x1E,0x69,0x16, 0x2F,0x7A,0x16, 0x40,0x8B,0x21, 0x51,0x9C,0x32, + 0x62,0xAD,0x43, 0x73,0xBE,0x54, 0x84,0xCF,0x65, 0x95,0xE0,0x76, + 0xA6,0xF1,0x87, 0xB7,0xFF,0x98, 0xC8,0xFF,0xA3, 0xD9,0xFF,0xAF, + +YELLOW-GREEN + 0x00,0x1B,0x08, 0x06,0x2C,0x0B, 0x17,0x3D,0x0B, 0x28,0x4E,0x0B, + 0x39,0x5F,0x0B, 0x4A,0x70,0x0B, 0x5B,0x81,0x0B, 0x6C,0x92,0x12, + 0x7D,0xA3,0x23, 0x8E,0xB4,0x34, 0x9F,0xC5,0x45, 0xB0,0xD6,0x56, + 0xC1,0xE7,0x67, 0xD2,0xF8,0x78, 0xE3,0xFF,0x86, 0xF4,0xFF,0x92, + +ORANGE-GREEN + 0x13,0x0B,0x00, 0x24,0x1C,0x00, 0x35,0x2D,0x00, 0x46,0x3E,0x00, + 0x57,0x4F,0x00, 0x68,0x60,0x00, 0x79,0x71,0x00, 0x8A,0x82,0x08, + 0x9B,0x93,0x19, 0xAC,0xA4,0x2A, 0xBD,0xB5,0x3B, 0xCE,0xC6,0x4C, + 0xDF,0xD7,0x5D, 0xF0,0xE8,0x6E, 0xFF,0xF9,0x7F, 0xFF,0xFF,0x92, + +LIGHT-ORANGE + 0x2D,0x00,0x00, 0x3E,0x0A,0x00, 0x4F,0x1B,0x00, 0x60,0x2C,0x00, + 0x71,0x3D,0x00, 0x82,0x4E,0x00, 0x93,0x5F,0x05, 0xA4,0x70,0x16, + 0xB5,0x81,0x27, 0xC4,0x90,0x37, 0xD7,0xA3,0x49, 0xE8,0xB4,0x5A, + 0xF9,0xC5,0x6B, 0xFF,0xD6,0x80, 0xFF,0xE7,0x96, 0xFF,0xF8,0xAC, +******************************************************************* + +******************************************************************* + PALETTE - 27.7 PHASE SHIFT + +GREY + 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, + 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, + 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, + 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, + +GOLD + 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, + 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, + 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, + 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xFF,0x97, + +ORANGE + 0x32,0x00,0x00, 0x43,0x05,0x00, 0x54,0x16,0x00, 0x65,0x27,0x00, + 0x76,0x38,0x00, 0x87,0x49,0x00, 0x98,0x5A,0x0C, 0xA9,0x6B,0x1D, + 0xBA,0x7C,0x2E, 0xCB,0x8D,0x3F, 0xDC,0x9E,0x50, 0xED,0xAF,0x61, + 0xFE,0xC0,0x72, 0xFF,0xD1,0x88, 0xFF,0xE2,0x9E, 0xFF,0xF3,0xB4, + +RED-ORANGE + 0x3F,0x00,0x00, 0x50,0x00,0x00, 0x61,0x06,0x00, 0x72,0x17,0x03, + 0x83,0x28,0x14, 0x94,0x39,0x25, 0xA5,0x4A,0x36, 0xB6,0x5B,0x47, + 0xC7,0x6C,0x58, 0xD8,0x7D,0x69, 0xE9,0x8E,0x7A, 0xFA,0x9F,0x8B, + 0xFF,0xB0,0x9F, 0xFF,0xC1,0xB5, 0xFF,0xD2,0xCB, 0xFF,0xE3,0xE1, + +PINK + 0x3D,0x00,0x10, 0x4E,0x00,0x1C, 0x5F,0x00,0x27, 0x70,0x0D,0x37, + 0x81,0x1E,0x48, 0x92,0x2F,0x59, 0xA3,0x40,0x6A, 0xB4,0x51,0x7B, + 0xC5,0x62,0x8C, 0xD6,0x73,0x9D, 0xE7,0x84,0xAE, 0xF8,0x95,0xBF, + 0xFF,0xA6,0xD3, 0xFF,0xB7,0xE9, 0xFF,0xC8,0xEE, 0xFF,0xD9,0xF4, + +PURPLE + 0x2D,0x00,0x42, 0x3E,0x00,0x4E, 0x4F,0x00,0x5A, 0x60,0x0C,0x6A, + 0x71,0x1D,0x7B, 0x82,0x2E,0x8C, 0x93,0x3F,0x9D, 0xA4,0x50,0xAE, + 0xB5,0x61,0xBF, 0xC6,0x72,0xD0, 0xD7,0x83,0xE1, 0xE8,0x94,0xE6, + 0xF9,0xA5,0xE6, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, + +PURPLE-BLUE + 0x13,0x00,0x67, 0x24,0x00,0x73, 0x35,0x03,0x80, 0x46,0x14,0x91, + 0x57,0x25,0xA2, 0x68,0x36,0xB3, 0x79,0x47,0xC4, 0x8A,0x58,0xD5, + 0x9B,0x69,0xE6, 0xAC,0x7A,0xF0, 0xBD,0x8B,0xF0, 0xCE,0x9C,0xF0, + 0xDF,0xAD,0xF0, 0xF0,0xBE,0xF0, 0xFF,0xCF,0xF1, 0xFF,0xE0,0xF6, + +BLUE1 + 0x00,0x00,0x70, 0x05,0x01,0x80, 0x16,0x12,0x91, 0x27,0x23,0xA2, + 0x38,0x34,0xB3, 0x49,0x45,0xC4, 0x5A,0x56,0xD5, 0x6B,0x67,0xE6, + 0x7C,0x78,0xF7, 0x8D,0x89,0xFE, 0x9E,0x9A,0xFE, 0xAF,0xAB,0xFE, + 0xC0,0xBC,0xFE, 0xD1,0xCD,0xFE, 0xE2,0xDE,0xFE, 0xF3,0xEF,0xFE, + +BLUE2 + 0x00,0x03,0x5B, 0x00,0x14,0x71, 0x00,0x25,0x87, 0x0C,0x36,0x9A, + 0x1D,0x47,0xAB, 0x2E,0x58,0xBC, 0x3F,0x69,0xCD, 0x50,0x7A,0xDE, + 0x61,0x8B,0xEF, 0x72,0x9C,0xFF, 0x83,0xAD,0xFF, 0x94,0xBE,0xFF, + 0xA5,0xCF,0xFF, 0xB6,0xE0,0xFF, 0xC7,0xF1,0xFF, 0xD8,0xFF,0xFF, + +LIGHT-BLUE + 0x00,0x15,0x35, 0x00,0x26,0x4B, 0x00,0x37,0x61, 0x00,0x48,0x78, + 0x0A,0x59,0x8B, 0x1B,0x6A,0x9C, 0x2C,0x7B,0xAD, 0x3D,0x8C,0xBE, + 0x4E,0x9D,0xCF, 0x5F,0xAE,0xE0, 0x70,0xBF,0xF1, 0x81,0xD0,0xFF, + 0x92,0xE1,0xFF, 0xA3,0xF2,0xFF, 0xB4,0xFF,0xFF, 0xC5,0xFF,0xFF, + +TURQUOISE + 0x00,0x22,0x0A, 0x00,0x33,0x19, 0x00,0x44,0x2F, 0x00,0x55,0x45, + 0x04,0x66,0x5A, 0x15,0x77,0x6B, 0x26,0x88,0x7C, 0x37,0x99,0x8D, + 0x48,0xAA,0x9E, 0x59,0xBB,0xAF, 0x6A,0xCC,0xC0, 0x7B,0xDD,0xD1, + 0x8C,0xEE,0xE2, 0x9D,0xFF,0xF3, 0xAE,0xFF,0xFF, 0xBF,0xFF,0xFF, + +GREEN-BLUE + 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1B, + 0x0D,0x6B,0x25, 0x1E,0x7C,0x36, 0x2F,0x8D,0x47, 0x40,0x9E,0x58, + 0x51,0xAF,0x69, 0x62,0xC0,0x7A, 0x73,0xD1,0x8B, 0x84,0xE2,0x9C, + 0x95,0xF3,0xAD, 0xA6,0xFF,0xBD, 0xB7,0xFF,0xC9, 0xC8,0xFF,0xD4, + +GREEN + 0x00,0x24,0x0B, 0x00,0x35,0x10, 0x01,0x46,0x15, 0x12,0x57,0x15, + 0x23,0x68,0x15, 0x34,0x79,0x15, 0x45,0x8A,0x19, 0x56,0x9B,0x2A, + 0x67,0xAC,0x3B, 0x78,0xBD,0x4C, 0x89,0xCE,0x5D, 0x9A,0xDF,0x6E, + 0xAB,0xF0,0x7F, 0xBC,0xFF,0x8F, 0xCD,0xFF,0x9B, 0xDE,0xFF,0xA7, + +YELLOW-GREEN + 0x00,0x18,0x07, 0x00,0x29,0x0C, 0x1E,0x3A,0x08, 0x2F,0x4B,0x08, + 0x40,0x5C,0x08, 0x51,0x6D,0x08, 0x62,0x7E,0x08, 0x73,0x8F,0x0D, + 0x84,0xA0,0x1E, 0x95,0xB1,0x2F, 0xA6,0xC2,0x40, 0xB7,0xD3,0x51, + 0xC8,0xE4,0x62, 0xD9,0xF5,0x73, 0xEA,0xFF,0x82, 0xFB,0xFF,0x8E, + +ORANGE-GREEN + 0x1B,0x07,0x00, 0x2C,0x18,0x00, 0x3D,0x29,0x00, 0x4E,0x3A,0x00, + 0x5F,0x4B,0x00, 0x70,0x5C,0x00, 0x81,0x6D,0x00, 0x92,0x7E,0x09, + 0xA3,0x8F,0x1A, 0xB4,0xA0,0x2B, 0xC5,0xB1,0x3C, 0xD6,0xC2,0x4D, + 0xE7,0xD3,0x5E, 0xF8,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xFF,0x97, + +LIGHT-ORANGE + 0x33,0x00,0x00, 0x44,0x05,0x00, 0x55,0x16,0x00, 0x66,0x27,0x00, + 0x77,0x38,0x00, 0x88,0x49,0x00, 0x99,0x5A,0x0D, 0xAA,0x6B,0x1E, + 0xBB,0x7C,0x2F, 0xCC,0x8D,0x40, 0xDD,0x9E,0x51, 0xEE,0xAF,0x62, + 0xFF,0xC0,0x73, 0xFF,0xD1,0x89, 0xFF,0xE2,0x9F, 0xFF,0xF3,0xB5 +*******************************************************************/ + +/************************************************************** + * + * Memory setup + * + **************************************************************/ + +void a400_state::setup_ram(int bank, UINT32 size) +{ + offs_t ram_top; + + switch (bank) + { + case 0: // 0x0000-0x7fff + ram_top = MIN(size, 0x8000) - 1; + m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, ram_top, "0000"); + if (m_0000 == NULL) + m_0000.findit(); + m_0000->set_base(m_ram->pointer()); + break; + case 1: // 0x8000-0x9fff + ram_top = MIN(size, 0xa000) - 1; + if (ram_top > 0x8000) + { + m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x8000, ram_top, "8000"); + if (m_8000 == NULL) + m_8000.findit(); + m_8000->set_base(m_ram->pointer() + 0x8000); + } + break; + case 2: // 0xa000-0xbfff + ram_top = MIN(size, 0xc000) - 1; + if (ram_top > 0xa000) + { + m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0xa000, ram_top, "a000"); + if (m_a000 == NULL) + m_a000.findit(); + m_a000->set_base(m_ram->pointer() + 0xa000); + } + break; + } +} + + +// these handle cart enable/disable without calling setup_ram thousands of times +READ8_MEMBER(a400_state::special_read_8000) +{ + if (!m_cart_disabled) + return m_cart->read_80xx(space, offset); + else + { + offset += 0x8000; + if (m_ram->size() < offset) + return 0; + else + return m_ram->pointer()[offset]; + } +} + +WRITE8_MEMBER(a400_state::special_write_8000) +{ + if (m_cart_disabled) + { + offset += 0x8000; + if (m_ram->size() >= offset) + m_ram->pointer()[offset] = data; + } +} + +READ8_MEMBER(a400_state::special_read_a000) +{ + if (!m_cart_disabled) + return m_cart->read_80xx(space, offset); + else + { + offset += 0xa000; + if (m_ram->size() < offset) + return 0; + else + return m_ram->pointer()[offset]; + } +} + +WRITE8_MEMBER(a400_state::special_write_a000) +{ + if (m_cart_disabled) + { + offset += 0xa000; + if (m_ram->size() >= offset) + m_ram->pointer()[offset] = data; + } +} + + +READ8_MEMBER(a400_state::read_d5xx) +{ + disable_cart(space, offset, 0); + return 0xff; +} + +WRITE8_MEMBER(a400_state::disable_cart) +{ + if (m_cart->exists()) + { + switch (m_cart->get_cart_type()) + { + case A800_PHOENIX: + case A800_BLIZZARD: + if (!m_cart_disabled) + m_cart_disabled = 1; + break; + case A800_OSS034M: + case A800_OSS043M: + case A800_EXPRESS: + case A800_DIAMOND: + case A800_WILLIAMS: + // use m_cart_disabled & m_last_offs to avoid continuous remapping of + // the memory space in some games (e.g. dropzone) + if (offset & 0x8 && !m_cart_disabled) + m_cart_disabled = 1; + else if (!(offset & 0x8)) + { + if (m_cart_disabled) + m_cart_disabled = 0; + + if ((offset & 0x7) != m_last_offs) + { + // we enter here only if we are writing to a different offset than last time + m_last_offs = offset & 0x7; + m_cart->write_d5xx(space, offset, data); + } + } + break; + case A800_TURBO64: + case A800_TURBO128: + if (offset & 0x10 && !m_cart_disabled) + m_cart_disabled = 1; + else if (!(offset & 0x10)) + { + if (m_cart_disabled) + m_cart_disabled = 0; + + if ((offset & 0x0f) != m_last_offs) + { + // we enter here only if we are writing to a different offset than last time + m_last_offs = offset & 0x0f; + m_cart->write_d5xx(space, offset & 0x0f, data); + } + } + break; + case A800_SPARTADOS: + // writes with offset & 8 are also used to enable/disable the subcart, so they go through! + m_cart->write_d5xx(space, offset, data); + break; + case A800_OSSM091: + case A800_OSS8K: + if ((offset & 0x9) == 0x08) + m_cart_disabled = 1; + else + { + m_cart_disabled = 0; + m_cart->write_d5xx(space, offset, data); + } + break; + case A800_MICROCALC: + m_cart_helper = (m_cart_helper + 1) % 5; + if (m_cart_helper == 4) + m_cart_disabled = 1; + else + { + m_cart_disabled = 0; + m_cart->write_d5xx(space, offset, m_cart_helper); + } + break; + default: + break; + } + } +} + +void a400_state::setup_cart(a800_cart_slot_device *slot) +{ + m_cart_disabled = 0; + m_last_offs = -1; + + if (slot->exists()) + { + switch (slot->get_cart_type()) + { + case A800_8K: + m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff); + break; + case A800_8K_RIGHT: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0x9fff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0x9fff); + break; + case A800_16K: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0xbfff); + break; + case A800_BBSB: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x8000, 0x9fff, write8_delegate(FUNC(a800_cart_slot_device::write_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff); + break; + case A800_OSS034M: + case A800_OSS043M: + case A800_OSSM091: + case A800_OSS8K: + case A800_TURBO64: + case A800_TURBO128: + case A800_PHOENIX: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::disable_cart), this)); + break; + case A800_EXPRESS: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd570, 0xd57f, write8_delegate(FUNC(a400_state::disable_cart), this)); + break; + case A800_DIAMOND: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd5d0, 0xd5df, write8_delegate(FUNC(a400_state::disable_cart), this)); + break; + case A800_WILLIAMS: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd50f, write8_delegate(FUNC(a400_state::disable_cart), this)); + break; + case A800_SPARTADOS: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd5e0, 0xd5ef, write8_delegate(FUNC(a400_state::disable_cart), this)); + break; + case A800_BLIZZARD: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x8000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_8000), this), write8_delegate(FUNC(a400_state::special_write_8000), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::disable_cart), this)); + break; + case A800_MICROCALC: + // this can also disable ROM when reading in 0xd500-0xd5ff + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd500, 0xd5ff, read8_delegate(FUNC(a400_state::read_d5xx), this), write8_delegate(FUNC(a400_state::disable_cart), this)); + break; + case A800_TELELINK2: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x9000, 0x90ff, write8_delegate(FUNC(a800_cart_slot_device::write_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff); + m_maincpu->space(AS_PROGRAM).install_read_handler(0xd501, 0xd501, read8_delegate(FUNC(a800_cart_slot_device::read_d5xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd502, 0xd502, write8_delegate(FUNC(a800_cart_slot_device::write_d5xx),(a800_cart_slot_device*)slot)); + break; + case A800_XEGS: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0xbfff); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a800_cart_slot_device::write_d5xx),(a800_cart_slot_device*)slot)); + break; + case A5200_4K: + case A5200_8K: + case A5200_16K: + case A5200_32K: + case A5200_16K_2CHIPS: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).unmap_write(0x4000, 0xbfff); + break; + case A5200_BBSB: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(a800_cart_slot_device::write_80xx),(a800_cart_slot_device*)slot)); + m_maincpu->space(AS_PROGRAM).unmap_write(0x6000, 0xbfff); + break; + } + } +} + + +TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a400_interrupt ) +{ + m_antic->generic_interrupt(4); +} + +TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a800xl_interrupt ) +{ + m_antic->generic_interrupt(2); +} + +TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a5200_interrupt ) +{ + m_antic->generic_interrupt(4); +} + +MACHINE_RESET_MEMBER( a400_state, a400 ) +{ + pokey_device *pokey = machine().device("pokey"); + pokey->write(15,0); +} + + +MACHINE_START_MEMBER( a400_state, a400 ) +{ + setup_ram(0, m_ram->size()); + setup_ram(1, m_ram->size()); + setup_ram(2, m_ram->size()); + setup_cart(m_cart); + + save_item(NAME(m_cart_disabled)); + save_item(NAME(m_cart_helper)); + save_item(NAME(m_last_offs)); +} + + +MACHINE_START_MEMBER( a400_state, a800 ) +{ + setup_ram(0, m_ram->size()); + setup_ram(1, m_ram->size()); + setup_ram(2, m_ram->size()); + setup_cart(m_cart); + setup_cart(m_cart2); + + save_item(NAME(m_cart_disabled)); + save_item(NAME(m_cart_helper)); + save_item(NAME(m_last_offs)); +} + +MACHINE_START_MEMBER( a400_state, a800xl ) +{ + m_mmu = 0xfd; + m_ext_bank = 0x03; // only used by a130xe + setup_cart(m_cart); + + save_item(NAME(m_cart_disabled)); + save_item(NAME(m_cart_helper)); + save_item(NAME(m_last_offs)); + save_item(NAME(m_mmu)); + save_item(NAME(m_ext_bank)); +} + + +MACHINE_START_MEMBER( a400_state, a5200 ) +{ + setup_cart(m_cart); + + save_item(NAME(m_cart_disabled)); + save_item(NAME(m_cart_helper)); + save_item(NAME(m_last_offs)); +} + + +/************************************************************** + * + * GTIA interface + * + **************************************************************/ + +WRITE8_MEMBER(a400_state::gtia_cb) +{ + if (data & 0x08) + m_dac->write_unsigned8((UINT8)-120); + else + m_dac->write_unsigned8(+120); +} + +/************************************************************** + * + * PIA interface + * + **************************************************************/ + +WRITE8_MEMBER(a400_state::a600xl_pia_pb_w) +{ + m_mmu = data; +} + +WRITE8_MEMBER(a400_state::a800xl_pia_pb_w) +{ + if (m_pia->port_b_z_mask() != 0xff) + { + m_mmu = data; + m_ext_bank = (m_mmu & 0x0c) >> 2; + } +} + +/************************************************************** + * + * Machine drivers + * + **************************************************************/ + + +static MACHINE_CONFIG_START( atari_common_nodac, a400_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT) + + MCFG_MACHINE_RESET_OVERRIDE( a400_state, a400 ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1)) + MCFG_SCREEN_VISIBLE_AREA(MIN_X, MAX_X, MIN_Y, MAX_Y) + MCFG_SCREEN_UPDATE_DEVICE("antic", antic_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", sizeof(atari_palette) / 3) + MCFG_PALETTE_INIT_OWNER(a400_state, a400) + + MCFG_DEVICE_ADD("pia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(IOPORT("djoy_0_1")) + MCFG_PIA_READPB_HANDLER(IOPORT("djoy_2_3")) + MCFG_PIA_CA2_HANDLER(DEVWRITELINE("a8sio", a8sio_device, motor_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE("fdc", atari_fdc_device, pia_cb2_w)) + + MCFG_DEVICE_ADD("a8sio", A8SIO, 0) + MCFG_A8SIO_DATA_IN_CB(DEVWRITELINE("pokey", pokey_device, sid_w)) + MCFG_A8SIO_SLOT_ADD("a8sio", "sio", NULL) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT) + MCFG_POKEY_POT0_R_CB(IOPORT("analog_0")) + MCFG_POKEY_POT1_R_CB(IOPORT("analog_1")) + MCFG_POKEY_POT2_R_CB(IOPORT("analog_2")) + MCFG_POKEY_POT3_R_CB(IOPORT("analog_3")) + MCFG_POKEY_POT4_R_CB(IOPORT("analog_4")) + MCFG_POKEY_POT5_R_CB(IOPORT("analog_5")) + MCFG_POKEY_POT6_R_CB(IOPORT("analog_6")) + MCFG_POKEY_POT7_R_CB(IOPORT("analog_7")) + MCFG_POKEY_SERIN_R_CB(DEVREAD8("fdc", atari_fdc_device, serin_r)) + MCFG_POKEY_SEROUT_W_CB(DEVWRITE8("fdc", atari_fdc_device, serout_w)) + MCFG_POKEY_KEYBOARD_CB(atari_common_state, a800_keyboard) + MCFG_POKEY_INTERRUPT_CB(atari_common_state, interrupt_cb) + + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( atari_common, atari_common_nodac ) + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") + + MCFG_DEVICE_ADD("gtia", ATARI_GTIA, 0) + MCFG_GTIA_READ_CB(IOPORT("console")) + MCFG_GTIA_WRITE_CB(WRITE8(a400_state, gtia_cb)) + + MCFG_DEVICE_ADD("antic", ATARI_ANTIC, 0) + MCFG_ANTIC_GTIA("gtia") + + /* devices */ + MCFG_DEVICE_ADD("fdc", ATARI_FDC, 0) + + MCFG_A800_CARTRIDGE_ADD("cartleft", a800_left, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("flop_list","a800_flop") + MCFG_SOFTWARE_LIST_ADD("cart_list","a800") + MCFG_SOFTWARE_LIST_ADD("xegs_list","xegs") +MACHINE_CONFIG_END + + +// memory map A400 + NTSC screen +static MACHINE_CONFIG_DERIVED( a400, atari_common ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a400_mem) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1) + + MCFG_MACHINE_START_OVERRIDE( a400_state, a400 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) + MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) +MACHINE_CONFIG_END + + +// memory map A400 + PAL screen +static MACHINE_CONFIG_DERIVED( a400pal, atari_common ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a400_mem) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1) + + MCFG_MACHINE_START_OVERRIDE( a400_state, a400 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_50HZ) + MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_50HZ) +MACHINE_CONFIG_END + + +// memory map A800 + NTSC screen + Right cartslot +static MACHINE_CONFIG_DERIVED( a800, atari_common ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a400_mem) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1) + + MCFG_MACHINE_START_OVERRIDE( a400_state, a800 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) + MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) + + MCFG_A800_CARTRIDGE_ADD("cartright", a800_right, NULL) +MACHINE_CONFIG_END + + +// memory map A800 + PAL screen + Right cartslot +static MACHINE_CONFIG_DERIVED( a800pal, atari_common ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a400_mem) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1) + + MCFG_MACHINE_START_OVERRIDE( a400_state, a800 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_50HZ) + MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_50HZ) + + MCFG_A800_CARTRIDGE_ADD("cartright", a800_right, NULL) +MACHINE_CONFIG_END + + +// memory map A600XL (same as 800XL but less RAM) + NTSC screen + MMU via PIA portB +static MACHINE_CONFIG_DERIVED( a600xl, atari_common ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a600xl_mem) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a800xl_interrupt, "screen", 0, 1) + + MCFG_DEVICE_MODIFY("pia") + MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a600xl_pia_pb_w)) + + MCFG_MACHINE_START_OVERRIDE( a400_state, a800xl ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) + MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + + +// memory map A800XL + NTSC screen + MMU via PIA portB +static MACHINE_CONFIG_DERIVED( a800xl, atari_common ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a800xl_mem) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a800xl_interrupt, "screen", 0, 1) + + MCFG_DEVICE_MODIFY("pia") + MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a800xl_pia_pb_w)) + + MCFG_MACHINE_START_OVERRIDE( a400_state, a800xl ) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) + MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) +MACHINE_CONFIG_END + + +// memory map A800XL + PAL screen + MMU via PIA portB +static MACHINE_CONFIG_DERIVED( a800xlpal, a800xl ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_CLOCK( 1773000 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_50HZ) + MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_50HZ) + + MCFG_SOUND_MODIFY("pokey") + MCFG_SOUND_CLOCK(1773000) +MACHINE_CONFIG_END + + +// memory map A1200XL+ MMU via PIA portB +static MACHINE_CONFIG_DERIVED( a1200xl, a800xl ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a1200xl_mem) + + MCFG_DEVICE_MODIFY("pia") + MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a800xl_pia_pb_w)) +MACHINE_CONFIG_END + + +// memory map A130XE (extra RAM only partially emulated) +static MACHINE_CONFIG_DERIVED( a130xe, a800xl ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a130xe_mem) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + +// memory map XEGS, only XEGS bankswitch supported +static MACHINE_CONFIG_DERIVED( xegs, a800xl ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(xegs_mem) + + MCFG_DEVICE_REMOVE("cartleft") + MCFG_DEVICE_REMOVE("cart_list") + + MCFG_XEGS_CARTRIDGE_ADD("cartleft", xegs_carts, NULL) +MACHINE_CONFIG_END + + +// memory map A5200, different ports, less RAM +static MACHINE_CONFIG_DERIVED( a5200, atari_common_nodac ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(a5200_mem) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a5200_interrupt, "screen", 0, 1) + + // FIXME: should there be anything connected where other system have the fdc? + MCFG_SOUND_MODIFY("pokey") + MCFG_POKEY_SERIN_R_CB(NULL) + MCFG_POKEY_SEROUT_W_CB(NULL) + MCFG_POKEY_KEYBOARD_CB(atari_common_state, a5200_keypads) + MCFG_POKEY_INTERRUPT_CB(atari_common_state, interrupt_cb) + + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_DEVICE_ADD("gtia", ATARI_GTIA, 0) + + MCFG_DEVICE_ADD("antic", ATARI_ANTIC, 0) + MCFG_ANTIC_GTIA("gtia") + + MCFG_DEVICE_MODIFY("pia") + MCFG_PIA_READPA_HANDLER(NULL) // FIXME: is there anything connected here + MCFG_PIA_READPB_HANDLER(NULL) // FIXME: is there anything connected here + MCFG_PIA_CB2_HANDLER(NULL) // FIXME: is there anything connected here + + MCFG_MACHINE_START_OVERRIDE( a400_state, a5200 ) + + MCFG_SCREEN_MODIFY( "screen" ) + MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) + MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) + + MCFG_A5200_CARTRIDGE_ADD("cartleft", a5200_carts, NULL) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","a5200") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + + +/************************************************************** + * + * ROM loading + * + **************************************************************/ + +ROM_START(a400) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co12399b.rom", 0xd800, 0x0800, CRC(6a5d766e) SHA1(01a6044f7a81d409c938e7dfde0a1af5832229d2) ) + ROM_SYSTEM_BIOS(0, "default", "OS Rev. B") + ROMX_LOAD( "co12499b.rom", 0xe000, 0x1000, BAD_DUMP CRC(d818f3e8) SHA1(bcdec2188f6a6a5bfc1df4e383bd828d34b5c4ac), ROM_BIOS(1) ) // CRC and label waiting for confirmation + ROMX_LOAD( "co14599b.rom", 0xf000, 0x1000, BAD_DUMP CRC(c1690a9b) SHA1(c5248e8565574fd39ae1c3f4f356aa4cac07df95), ROM_BIOS(1) ) // CRC and label waiting for confirmation + ROM_SYSTEM_BIOS(1, "reva", "OS Rev. A") + ROMX_LOAD( "co12499a.rom", 0xe000, 0x1000, BAD_DUMP CRC(29f64e17) SHA1(abf7ec488c6b600f1b7f30bdc7f8a2bf6a727675), ROM_BIOS(2) ) // CRC and label waiting for confirmation + ROMX_LOAD( "co14599a.rom", 0xf000, 0x1000, BAD_DUMP CRC(bc533f0c) SHA1(e217148495fa747fe5488132d8d22533e68c7e58), ROM_BIOS(2) ) // CRC and label waiting for confirmation +ROM_END + +ROM_START(a400pal) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co12399b.rom", 0xd800, 0x0800, CRC(6a5d766e) SHA1(01a6044f7a81d409c938e7dfde0a1af5832229d2) ) + ROM_LOAD( "co15199.rom", 0xe000, 0x1000, BAD_DUMP CRC(8e547f56) SHA1(1bd746ea798b723bfb18495a7facca113183d713) ) // Rev. A - CRC and label waiting for confirmation + ROM_LOAD( "co15299.rom", 0xf000, 0x1000, BAD_DUMP CRC(be55b413) SHA1(d88afae49b08e75943d0258cb580e5d34756414a) ) // Rev. A - CRC and label waiting for confirmation +ROM_END + +ROM_START(a800) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co12399b.rom", 0xd800, 0x0800, CRC(6a5d766e) SHA1(01a6044f7a81d409c938e7dfde0a1af5832229d2) ) + ROM_SYSTEM_BIOS(0, "default", "OS Rev. B") + ROMX_LOAD( "co12499b.rom", 0xe000, 0x1000, BAD_DUMP CRC(d818f3e8) SHA1(bcdec2188f6a6a5bfc1df4e383bd828d34b5c4ac), ROM_BIOS(1) ) // CRC and label waiting for confirmation + ROMX_LOAD( "co14599b.rom", 0xf000, 0x1000, BAD_DUMP CRC(c1690a9b) SHA1(c5248e8565574fd39ae1c3f4f356aa4cac07df95), ROM_BIOS(1) ) // CRC and label waiting for confirmation + ROM_SYSTEM_BIOS(1, "reva", "OS Rev. A") + ROMX_LOAD( "co12499a.rom", 0xe000, 0x1000, BAD_DUMP CRC(29f64e17) SHA1(abf7ec488c6b600f1b7f30bdc7f8a2bf6a727675), ROM_BIOS(2) ) // CRC and label waiting for confirmation + ROMX_LOAD( "co14599a.rom", 0xf000, 0x1000, BAD_DUMP CRC(bc533f0c) SHA1(e217148495fa747fe5488132d8d22533e68c7e58), ROM_BIOS(2) ) // CRC and label waiting for confirmation +ROM_END + +ROM_START(a800pal) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co12399b.rom", 0xd800, 0x0800, CRC(6a5d766e) SHA1(01a6044f7a81d409c938e7dfde0a1af5832229d2) ) + ROM_LOAD( "co15199.rom", 0xe000, 0x1000, BAD_DUMP CRC(8e547f56) SHA1(1bd746ea798b723bfb18495a7facca113183d713) ) // Rev. A - CRC and label waiting for confirmation + ROM_LOAD( "co15299.rom", 0xf000, 0x1000, BAD_DUMP CRC(be55b413) SHA1(d88afae49b08e75943d0258cb580e5d34756414a) ) // Rev. A - CRC and label waiting for confirmation +ROM_END + +ROM_START(a1200xl) + ROM_REGION(0x10000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "default", "OS Rev. 11") + ROMX_LOAD( "co60616b.rom", 0xc000, 0x2000, BAD_DUMP CRC(6e29ec8d) SHA1(3f9c06d6b4d261f3d5bf4354e3cff0c17b9347b9), ROM_BIOS(1) ) // CRC and label waiting for confirmation + ROMX_LOAD( "co60617b.rom", 0xe000, 0x2000, BAD_DUMP CRC(d73ce29a) SHA1(64790242d902643fe0c40dd842749f1fe461831b), ROM_BIOS(1) ) // CRC and label waiting for confirmation + ROM_SYSTEM_BIOS(1, "rev10", "OS Rev. 10") + ROMX_LOAD( "co60616a.rom", 0xc000, 0x2000, BAD_DUMP CRC(0391386b) SHA1(7c176657c88b89b8a69bf021fa8e0939efc0dff2), ROM_BIOS(2) ) // CRC and label waiting for confirmation + ROMX_LOAD( "co60617a.rom", 0xe000, 0x2000, BAD_DUMP CRC(b502f1e7) SHA1(6688db57d97fa570aef5c15cef3e5fb2688879c2), ROM_BIOS(2) ) // CRC and label waiting for confirmation +ROM_END + +ROM_START(a600xl) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co60302a.rom", 0xa000, 0x2000, CRC(f0202fb3) SHA1(7ad88dd99ff4a6ee66f6d162074db6f8bef7a9b6) ) // Rev. B + ROM_LOAD( "co62024.rom", 0xc000, 0x4000, CRC(643bcc98) SHA1(881d030656b40bbe48f15a696b28f22c0b752ab0) ) // Rev. 1 +ROM_END + +ROM_START(a800xl) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co60302a.rom", 0xa000, 0x2000, CRC(f0202fb3) SHA1(7ad88dd99ff4a6ee66f6d162074db6f8bef7a9b6) ) // Rev. B + ROM_LOAD( "co61598b.rom", 0xc000, 0x4000, CRC(1f9cd270) SHA1(ae4f523ba08b6fd59f3cae515a2b2410bbd98f55) ) // Rev. 2 +ROM_END + +#define rom_a800xlp rom_a800xl + +ROM_START(a65xe) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co24947a.rom", 0xa000, 0x2000, CRC(7d684184) SHA1(3693c9cb9bf3b41bae1150f7a8264992468fc8c0) ) // Rev. C + ROM_LOAD( "co61598b.rom", 0xc000, 0x4000, CRC(1f9cd270) SHA1(ae4f523ba08b6fd59f3cae515a2b2410bbd98f55) ) // Rev. 2 +ROM_END + +ROM_START(a65xea) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "basic_ar.rom", 0xa000, 0x2000, CRC(c899f4d6) SHA1(043df191d1fe402e792266a108e147ffcda35130) ) // is this correct? or shall we use Rev. C? +// ROM_LOAD( "c101700.rom", 0xc000, 0x4000, CRC(7f9a76c8) SHA1(57eb6d87850a763f11767f53d4eaede186f831a2) ) // this was from Savetz and has wrong bits! + ROM_LOAD( "c101700.rom", 0xc000, 0x4000, CRC(45f47988) SHA1(a36b8b20f657580f172749bb0625c08706ed824c) ) // Rev. 3B ? +ROM_END + +ROM_START(a130xe) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co24947a.rom", 0xa000, 0x2000, CRC(7d684184) SHA1(3693c9cb9bf3b41bae1150f7a8264992468fc8c0) ) // Rev. C + ROM_LOAD( "co61598b.rom", 0xc000, 0x4000, CRC(1f9cd270) SHA1(ae4f523ba08b6fd59f3cae515a2b2410bbd98f55) ) // Rev. 2 +ROM_END + +ROM_START(a800xe) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "co24947a.rom", 0xa000, 0x2000, CRC(7d684184) SHA1(3693c9cb9bf3b41bae1150f7a8264992468fc8c0) ) // Rev. C + ROM_LOAD( "c300717.rom", 0xc000, 0x4000, CRC(29f133f7) SHA1(f03b9b93000ee84abb9cf8d6367241006f172182) ) // Rev. 3 +ROM_END + +ROM_START(xegs) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASE00) + ROM_LOAD( "c101687.rom", 0x8000, 0x8000, CRC(d50260d1) SHA1(0e0625ab2473f8431640df3ac8af61925760b9b9) ) // Rev. C + Rev. 4 + Missile Command +ROM_END + + +ROM_START(a5200) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "default", "a5200") + ROMX_LOAD( "5200.rom", 0xf800, 0x0800, CRC(4248d3e3) SHA1(6ad7a1e8c9fad486fbec9498cb48bf5bc3adc530), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "alt", "a5200 (alt)") + ROMX_LOAD( "5200a.rom", 0xf800, 0x0800, CRC(c2ba2613) SHA1(1d2a3f00109d75d2d79fecb565775eb95b7d04d5), ROM_BIOS(2) ) +ROM_END + + +/************************************************************** + * + * Game driver(s) + * + **************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1979, a400, 0, 0, a400, a800, driver_device, 0, "Atari", "Atari 400 (NTSC)", 0) +COMP ( 1979, a400pal, a400, 0, a400pal, a800, driver_device, 0, "Atari", "Atari 400 (PAL)", 0) +COMP ( 1979, a800, 0, 0, a800, a800, driver_device, 0, "Atari", "Atari 800 (NTSC)", 0) +COMP ( 1979, a800pal, a800, 0, a800pal, a800, driver_device, 0, "Atari", "Atari 800 (PAL)", 0) +COMP ( 1982, a1200xl, a800, 0, a1200xl, a800xl, driver_device, 0, "Atari", "Atari 1200XL", MACHINE_NOT_WORKING ) // 64k RAM +COMP ( 1983, a600xl, a800xl, 0, a600xl, a800xl, driver_device, 0, "Atari", "Atari 600XL", MACHINE_IMPERFECT_GRAPHICS ) // 16k RAM +COMP ( 1983, a800xl, 0, 0, a800xl, a800xl, driver_device, 0, "Atari", "Atari 800XL (NTSC)", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM +COMP ( 1983, a800xlp, a800xl, 0, a800xlpal, a800xl, driver_device, 0, "Atari", "Atari 800XL (PAL)", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM +COMP ( 1986, a65xe, a800xl, 0, a800xl, a800xl, driver_device, 0, "Atari", "Atari 65XE", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM +COMP ( 1986, a65xea, a800xl, 0, a800xl, a800xl, driver_device, 0, "Atari", "Atari 65XE (Arabic)", MACHINE_NOT_WORKING ) +COMP ( 1986, a130xe, a800xl, 0, a130xe, a800xl, driver_device, 0, "Atari", "Atari 130XE", MACHINE_NOT_WORKING ) // 128k RAM +COMP ( 1986, a800xe, a800xl, 0, a800xl, a800xl, driver_device, 0, "Atari", "Atari 800XE", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM +COMP ( 1987, xegs, 0, 0, xegs, a800xl, driver_device, 0, "Atari", "Atari XE Game System", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM + +CONS ( 1982, a5200, 0, 0, a5200, a5200, driver_device, 0, "Atari", "Atari 5200", 0) diff --git a/src/mame/drivers/atarist.c b/src/mame/drivers/atarist.c new file mode 100644 index 00000000000..1bc2c0eb8cf --- /dev/null +++ b/src/mame/drivers/atarist.c @@ -0,0 +1,3224 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Olivier Galibert +#include "includes/atarist.h" +#include "machine/clock.h" +#include "bus/midi/midi.h" +#include "video/atarist.h" + +/* + + TODO: + + - floppy write + - floppy DMA transfer timer + - mouse moves too fast? + - UK keyboard layout for the special keys + - accurate screen timing + - STe DMA sound and LMC1992 Microwire mixer + - Mega ST/STe MC68881 FPU + - Mega STe 16KB cache + - Mega STe LAN + + http://dev-docs.atariforge.org/ + http://info-coach.fr/atari/software/protection.php + +*/ + +#include "formats/st_dsk.h" +#include "formats/pasti_dsk.h" +#include "formats/mfi_dsk.h" +#include "formats/dfi_dsk.h" +#include "formats/ipf_dsk.h" + + +//************************************************************************** +// CONSTANTS / MACROS +//************************************************************************** + +#define LOG 0 + +static const int IKBD_MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } }; +static const int IKBD_MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } }; + +static const int DMASOUND_RATE[] = { (int)(Y2/640/8), (int)(Y2/640/4), (int)(Y2/640/2), (int)(Y2/640) }; + + +//************************************************************************** +// TIMERS +//************************************************************************** + +void st_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_MOUSE_TICK: + mouse_tick(); + break; + case TIMER_SHIFTER_TICK: + shifter_tick(); + break; + case TIMER_GLUE_TICK: + glue_tick(); + break; + case TIMER_BLITTER_TICK: + blitter_tick(); + break; + default: + assert_always(FALSE, "Unknown id in st_state::device_timer"); + } +} + + +//************************************************************************** +// FLOPPY +//************************************************************************** + +//------------------------------------------------- +// toggle_dma_fifo - +//------------------------------------------------- + +void st_state::toggle_dma_fifo() +{ + if (LOG) logerror("Toggling DMA FIFO\n"); + + m_fdc_fifo_sel = !m_fdc_fifo_sel; + m_fdc_fifo_index = 0; +} + + +//------------------------------------------------- +// flush_dma_fifo - +//------------------------------------------------- + +void st_state::flush_dma_fifo() +{ + if (m_fdc_fifo_empty[m_fdc_fifo_sel]) return; + + if (m_fdc_dmabytes) { + address_space &program = m_maincpu->space(AS_PROGRAM); + for (int i = 0; i < 8; i++) { + UINT16 data = m_fdc_fifo[m_fdc_fifo_sel][i]; + + if (LOG) logerror("Flushing DMA FIFO %u data %04x to address %06x\n", m_fdc_fifo_sel, data, m_dma_base); + + if(m_dma_base >= 8) + program.write_word(m_dma_base, data); + m_dma_base += 2; + } + m_fdc_dmabytes -= 16; + if (!m_fdc_dmabytes) { + m_fdc_sectors--; + + if (m_fdc_sectors) + m_fdc_dmabytes = DMA_SECTOR_SIZE; + } + } else + m_dma_error = 0; + + m_fdc_fifo_empty[m_fdc_fifo_sel] = 1; +} + + +//------------------------------------------------- +// fill_dma_fifo - +//------------------------------------------------- + +void st_state::fill_dma_fifo() +{ + if (m_fdc_dmabytes) { + address_space &program = m_maincpu->space(AS_PROGRAM); + for (int i = 0; i < 8; i++) { + UINT16 data = program.read_word(m_dma_base); + + if (LOG) logerror("Filling DMA FIFO %u with data %04x from memory address %06x\n", m_fdc_fifo_sel, data, m_dma_base); + + m_fdc_fifo[m_fdc_fifo_sel][i] = data; + m_dma_base += 2; + } + m_fdc_dmabytes -= 16; + if (!m_fdc_dmabytes) { + m_fdc_sectors--; + + if (m_fdc_sectors) + m_fdc_dmabytes = DMA_SECTOR_SIZE; + } + } else + m_dma_error = 0; + + m_fdc_fifo_empty[m_fdc_fifo_sel] = 0; +} + + +//------------------------------------------------- +// fdc_dma_transfer - +//------------------------------------------------- + +void st_state::fdc_dma_transfer() +{ + if (m_fdc_mode & DMA_MODE_READ_WRITE) + { + UINT16 data = m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index]; + + if (m_fdc_fifo_msb) + { + // write LSB to disk + m_fdc->data_w(data & 0xff); + + if (LOG) logerror("DMA Write to FDC %02x\n", data & 0xff); + + m_fdc_fifo_index++; + } + else + { + // write MSB to disk + m_fdc->data_w(data >> 8); + + if (LOG) logerror("DMA Write to FDC %02x\n", data >> 8); + } + + // toggle MSB/LSB + m_fdc_fifo_msb = !m_fdc_fifo_msb; + + if (m_fdc_fifo_index == 8) + { + m_fdc_fifo_index--; + m_fdc_fifo_empty[m_fdc_fifo_sel] = 1; + + toggle_dma_fifo(); + + if (m_fdc_fifo_empty[m_fdc_fifo_sel]) + { + fill_dma_fifo(); + } + } + } + else + { + // read from controller to FIFO + UINT8 data = m_fdc->data_r(); + + m_fdc_fifo_empty[m_fdc_fifo_sel] = 0; + + if (LOG) logerror("DMA Read from FDC %02x\n", data); + + if (m_fdc_fifo_msb) + { + // write MSB to FIFO + m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index] |= data; + m_fdc_fifo_index++; + } + else + { + // write LSB to FIFO + m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index] = data << 8; + } + + // toggle MSB/LSB + m_fdc_fifo_msb = !m_fdc_fifo_msb; + + if (m_fdc_fifo_index == 8) + { + flush_dma_fifo(); + toggle_dma_fifo(); + } + } +} + + +//------------------------------------------------- +// fdc_data_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::fdc_data_r ) +{ + UINT8 data = 0; + + if (m_fdc_mode & DMA_MODE_SECTOR_COUNT) + { + if (LOG) logerror("Indeterminate DMA Sector Count Read!\n"); + + // sector count register is write only, reading it returns unpredictable values + data = machine().rand() & 0xff; + } + else + { + if (!(m_fdc_mode & DMA_MODE_FDC_HDC_CS)) + { + // floppy controller + int offset = (m_fdc_mode & DMA_MODE_ADDRESS_MASK) >> 1; + + data = m_fdc->gen_r(offset); + + if (LOG) logerror("FDC Register %u Read %02x\n", offset, data); + } + } + + return data; +} + + +//------------------------------------------------- +// fdc_data_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::fdc_data_w ) +{ + if (m_fdc_mode & DMA_MODE_SECTOR_COUNT) + { + if (LOG) logerror("DMA Sector Count %u\n", data); + + // sector count register + m_fdc_sectors = data; + + if (m_fdc_sectors) + { + m_fdc_dmabytes = DMA_SECTOR_SIZE; + } + + if (m_fdc_mode & DMA_MODE_READ_WRITE) + { + // fill both FIFOs with data + fill_dma_fifo(); + toggle_dma_fifo(); + fill_dma_fifo(); + toggle_dma_fifo(); + } + } + else + { + if (!(m_fdc_mode & DMA_MODE_FDC_HDC_CS)) + { + // floppy controller + int offset = (m_fdc_mode & DMA_MODE_ADDRESS_MASK) >> 1; + + if (LOG) logerror("FDC Register %u Write %02x\n", offset, data); + + m_fdc->gen_w(offset, data); + } + } +} + + +//------------------------------------------------- +// dma_status_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::dma_status_r ) +{ + UINT16 data = 0; + + // DMA error + data |= m_dma_error; + + // sector count null + data |= !(m_fdc_sectors == 0) << 1; + + // DRQ state + data |= m_fdc->drq_r() << 2; + + return data; +} + + +//------------------------------------------------- +// dma_mode_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::dma_mode_w ) +{ + if (LOG) logerror("DMA Mode %04x\n", data); + + if ((data & DMA_MODE_READ_WRITE) != (m_fdc_mode & DMA_MODE_READ_WRITE)) + { + if (LOG) logerror("DMA reset\n"); + + m_dma_error = 1; + m_fdc_sectors = 0; + m_fdc_fifo_sel = 0; + m_fdc_fifo_msb = 0; + m_fdc_fifo_index = 0; + } + + m_fdc_mode = data; +} + + +//------------------------------------------------- +// dma_counter_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::dma_counter_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0: + data = (m_dma_base >> 16) & 0xff; + break; + case 1: + data = (m_dma_base >> 8) & 0xff; + break; + case 2: + data = m_dma_base & 0xff; + break; + } + + return data; +} + + +//------------------------------------------------- +// dma_base_w - +//------------------------------------------------- + +WRITE8_MEMBER( st_state::dma_base_w ) +{ + switch (offset) + { + case 0: + m_dma_base = (m_dma_base & 0x00ffff) | (data << 16); + if (LOG) logerror("DMA Address High %02x (%06x)\n", data & 0xff, m_dma_base); + break; + + case 1: + m_dma_base = (m_dma_base & 0xff00ff) | (data << 8); + if (LOG) logerror("DMA Address Mid %02x (%06x)\n", data & 0xff, m_dma_base); + break; + + case 2: + m_dma_base = (m_dma_base & 0xffff00) | data; + if (LOG) logerror("DMA Address Low %02x (%06x)\n", data & 0xff, m_dma_base); + break; + } +} + + + +//************************************************************************** +// MMU +//************************************************************************** + +//------------------------------------------------- +// mmu_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::mmu_r ) +{ + return m_mmu; +} + + +//------------------------------------------------- +// mmu_w - +//------------------------------------------------- + +WRITE8_MEMBER( st_state::mmu_w ) +{ + if (LOG) logerror("Memory Configuration Register: %02x\n", data); + + m_mmu = data; +} + + +WRITE16_MEMBER( st_state::berr_w ) +{ + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); +} + +READ16_MEMBER( st_state::berr_r ) +{ + if(!space.debugger_access()) { + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + } + return 0xffff; +} + + +//************************************************************************** +// IKBD +//************************************************************************** + +//------------------------------------------------- +// mouse_tick - +//------------------------------------------------- + +void st_state::mouse_tick() +{ + /* + + Right Left Up Down + + XA 1100 0110 YA 1100 0110 + XB 0110 1100 YB 0110 1100 + + */ + + UINT8 x = m_mousex->read(); + UINT8 y = m_mousey->read(); + + if (m_ikbd_mouse_pc == 0) + { + if (x == m_ikbd_mouse_x) + { + m_ikbd_mouse_px = IKBD_MOUSE_PHASE_STATIC; + } + else if ((x > m_ikbd_mouse_x) || (x == 0 && m_ikbd_mouse_x == 0xff)) + { + m_ikbd_mouse_px = IKBD_MOUSE_PHASE_POSITIVE; + } + else if ((x < m_ikbd_mouse_x) || (x == 0xff && m_ikbd_mouse_x == 0)) + { + m_ikbd_mouse_px = IKBD_MOUSE_PHASE_NEGATIVE; + } + + if (y == m_ikbd_mouse_y) + { + m_ikbd_mouse_py = IKBD_MOUSE_PHASE_STATIC; + } + else if ((y > m_ikbd_mouse_y) || (y == 0 && m_ikbd_mouse_y == 0xff)) + { + m_ikbd_mouse_py = IKBD_MOUSE_PHASE_POSITIVE; + } + else if ((y < m_ikbd_mouse_y) || (y == 0xff && m_ikbd_mouse_y == 0)) + { + m_ikbd_mouse_py = IKBD_MOUSE_PHASE_NEGATIVE; + } + + m_ikbd_mouse_x = x; + m_ikbd_mouse_y = y; + } + + m_ikbd_mouse = 0; + + m_ikbd_mouse |= IKBD_MOUSE_XYB[m_ikbd_mouse_px][m_ikbd_mouse_pc]; // XB + m_ikbd_mouse |= IKBD_MOUSE_XYA[m_ikbd_mouse_px][m_ikbd_mouse_pc] << 1; // XA + m_ikbd_mouse |= IKBD_MOUSE_XYB[m_ikbd_mouse_py][m_ikbd_mouse_pc] << 2; // YA + m_ikbd_mouse |= IKBD_MOUSE_XYA[m_ikbd_mouse_py][m_ikbd_mouse_pc] << 3; // YB + + m_ikbd_mouse_pc++; + m_ikbd_mouse_pc &= 0x03; +} + + +//------------------------------------------------- +// ikbd_port1_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::ikbd_port1_r ) +{ + /* + + bit description + + 0 Keyboard column input + 1 Keyboard column input + 2 Keyboard column input + 3 Keyboard column input + 4 Keyboard column input + 5 Keyboard column input + 6 Keyboard column input + 7 Keyboard column input + + */ + + UINT8 data = 0xff; + + // keyboard data + if (!BIT(m_ikbd_keylatch, 1)) data &= m_p31->read(); + if (!BIT(m_ikbd_keylatch, 2)) data &= m_p32->read(); + if (!BIT(m_ikbd_keylatch, 3)) data &= m_p33->read(); + if (!BIT(m_ikbd_keylatch, 4)) data &= m_p34->read(); + if (!BIT(m_ikbd_keylatch, 5)) data &= m_p35->read(); + if (!BIT(m_ikbd_keylatch, 6)) data &= m_p36->read(); + if (!BIT(m_ikbd_keylatch, 7)) data &= m_p37->read(); + if (!BIT(m_ikbd_keylatch, 8)) data &= m_p40->read(); + if (!BIT(m_ikbd_keylatch, 9)) data &= m_p41->read(); + if (!BIT(m_ikbd_keylatch, 10)) data &= m_p42->read(); + if (!BIT(m_ikbd_keylatch, 11)) data &= m_p43->read(); + if (!BIT(m_ikbd_keylatch, 12)) data &= m_p44->read(); + if (!BIT(m_ikbd_keylatch, 13)) data &= m_p45->read(); + if (!BIT(m_ikbd_keylatch, 14)) data &= m_p46->read(); + if (!BIT(m_ikbd_keylatch, 15)) data &= m_p47->read(); + + return data; +} + + +//------------------------------------------------- +// ikbd_port2_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::ikbd_port2_r ) +{ + /* + + bit description + + 0 JOY 1-5 + 1 JOY 0-6 + 2 JOY 1-6 + 3 SD FROM CPU + 4 + + */ + + UINT8 data = m_joy1 ? m_joy1->read() & 0x06 : 0x06; + + // serial receive + data |= m_ikbd_tx << 3; + + return data; +} + + +//------------------------------------------------- +// ikbd_port2_w - +//------------------------------------------------- + +WRITE8_MEMBER( st_state::ikbd_port2_w ) +{ + /* + + bit description + + 0 joystick enable + 1 + 2 + 3 + 4 SD TO CPU + + */ + + // joystick enable + m_ikbd_joy = BIT(data, 0); + + // serial transmit + m_acia0->write_rxd(BIT(data, 4)); +} + + +//------------------------------------------------- +// ikbd_port3_w - +//------------------------------------------------- + +WRITE8_MEMBER( st_state::ikbd_port3_w ) +{ + /* + + bit description + + 0 CAPS LOCK LED + 1 Keyboard row select + 2 Keyboard row select + 3 Keyboard row select + 4 Keyboard row select + 5 Keyboard row select + 6 Keyboard row select + 7 Keyboard row select + + */ + + // caps lock led + set_led_status(machine(), 1, BIT(data, 0)); + + // keyboard row select + m_ikbd_keylatch = (m_ikbd_keylatch & 0xff00) | data; +} + + +//------------------------------------------------- +// ikbd_port4_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::ikbd_port4_r ) +{ + /* + + bit description + + 0 JOY 0-1 or mouse XB + 1 JOY 0-2 or mouse XA + 2 JOY 0-3 or mouse YA + 3 JOY 0-4 or mouse YB + 4 JOY 1-1 + 5 JOY 1-2 + 6 JOY 1-3 + 7 JOY 1-4 + + */ + + if (m_ikbd_joy) return 0xff; + + UINT8 data = m_joy0 ? m_joy0->read() : 0xff; + + if ((m_config->read() & 0x01) == 0) + { + data = (data & 0xf0) | m_ikbd_mouse; + } + + return data; +} + + +//------------------------------------------------- +// ikbd_port4_w - +//------------------------------------------------- + +WRITE8_MEMBER( st_state::ikbd_port4_w ) +{ + /* + + bit description + + 0 Keyboard row select + 1 Keyboard row select + 2 Keyboard row select + 3 Keyboard row select + 4 Keyboard row select + 5 Keyboard row select + 6 Keyboard row select + 7 Keyboard row select + + */ + + // keyboard row select + m_ikbd_keylatch = (data << 8) | (m_ikbd_keylatch & 0xff); +} + + + +//************************************************************************** +// FPU +//************************************************************************** + +//------------------------------------------------- +// fpu_r - +//------------------------------------------------- + +READ16_MEMBER( megast_state::fpu_r ) +{ + // HACK diagnostic cartridge wants to see this value + return 0x0802; +} + + +WRITE16_MEMBER( megast_state::fpu_w ) +{ +} + +WRITE_LINE_MEMBER( st_state::write_monochrome ) +{ + m_monochrome = state; + m_mfp->i7_w(m_monochrome); +} + + + +//************************************************************************** +// DMA SOUND +//************************************************************************** + +//------------------------------------------------- +// dmasound_set_state - +//------------------------------------------------- + +void ste_state::dmasound_set_state(int level) +{ + m_dmasnd_active = level; + m_mfp->tai_w(m_dmasnd_active); + m_mfp->i7_w(m_monochrome ^ m_dmasnd_active); + + if (level == 0) + { + m_dmasnd_baselatch = m_dmasnd_base; + m_dmasnd_endlatch = m_dmasnd_end; + } + else + { + m_dmasnd_cntr = m_dmasnd_baselatch; + } +} + + +WRITE_LINE_MEMBER( ste_state::write_monochrome ) +{ + m_monochrome = state; + m_mfp->i7_w(m_monochrome ^ m_dmasnd_active); +} + +//------------------------------------------------- +// dmasound_tick - +//------------------------------------------------- + +void ste_state::dmasound_tick() +{ + if (m_dmasnd_samples == 0) + { + UINT8 *RAM = m_ram->pointer(); + + for (int i = 0; i < 8; i++) + { + m_dmasnd_fifo[i] = RAM[m_dmasnd_cntr]; + m_dmasnd_cntr++; + m_dmasnd_samples++; + + if (m_dmasnd_cntr == m_dmasnd_endlatch) + { + dmasound_set_state(0); + break; + } + } + } + + if (m_dmasnd_ctrl & 0x80) + { + if (LOG) logerror("DMA sound left %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]); + m_dmasnd_samples--; + + if (LOG) logerror("DMA sound right %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]); + m_dmasnd_samples--; + } + else + { + if (LOG) logerror("DMA sound mono %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]); + m_dmasnd_samples--; + } + + if ((m_dmasnd_samples == 0) && (m_dmasnd_active == 0)) + { + if ((m_dmasnd_ctrl & 0x03) == 0x03) + { + dmasound_set_state(1); + } + else + { + m_dmasound_timer->enable(0); + } + } +} + + +void ste_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_DMASOUND_TICK: + dmasound_tick(); + break; + case TIMER_MICROWIRE_TICK: + microwire_tick(); + break; + default: + st_state::device_timer(timer, id, param, ptr); + } +} + + +//------------------------------------------------- +// sound_dma_control_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::sound_dma_control_r ) +{ + return m_dmasnd_ctrl; +} + + +//------------------------------------------------- +// sound_dma_base_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::sound_dma_base_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0x00: + data = (m_dmasnd_base >> 16) & 0x3f; + break; + + case 0x01: + data = (m_dmasnd_base >> 8) & 0xff; + break; + + case 0x02: + data = m_dmasnd_base & 0xff; + break; + } + + return data; +} + + +//------------------------------------------------- +// sound_dma_counter_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::sound_dma_counter_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0x00: + data = (m_dmasnd_cntr >> 16) & 0x3f; + break; + + case 0x01: + data = (m_dmasnd_cntr >> 8) & 0xff; + break; + + case 0x02: + data = m_dmasnd_cntr & 0xff; + break; + } + + return data; +} + + +//------------------------------------------------- +// sound_dma_end_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::sound_dma_end_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0x00: + data = (m_dmasnd_end >> 16) & 0x3f; + break; + + case 0x01: + data = (m_dmasnd_end >> 8) & 0xff; + break; + + case 0x02: + data = m_dmasnd_end & 0xff; + break; + } + + return data; +} + + +//------------------------------------------------- +// sound_mode_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::sound_mode_r ) +{ + return m_dmasnd_mode; +} + + +//------------------------------------------------- +// sound_dma_control_w - +//------------------------------------------------- + +WRITE8_MEMBER( ste_state::sound_dma_control_w ) +{ + m_dmasnd_ctrl = data & 0x03; + + if (m_dmasnd_ctrl & 0x01) + { + if (!m_dmasnd_active) + { + dmasound_set_state(1); + m_dmasound_timer->adjust(attotime::zero, 0, attotime::from_hz(DMASOUND_RATE[m_dmasnd_mode & 0x03])); + } + } + else + { + dmasound_set_state(0); + m_dmasound_timer->enable(0); + } +} + + +//------------------------------------------------- +// sound_dma_base_w - +//------------------------------------------------- + +WRITE8_MEMBER( ste_state::sound_dma_base_w ) +{ + switch (offset) + { + case 0x00: + m_dmasnd_base = (data << 16) & 0x3f0000; + break; + case 0x01: + m_dmasnd_base = (m_dmasnd_base & 0x3f00fe) | (data << 8); + break; + case 0x02: + m_dmasnd_base = (m_dmasnd_base & 0x3fff00) | (data & 0xfe); + break; + } + + if (!m_dmasnd_active) + { + m_dmasnd_baselatch = m_dmasnd_base; + } +} + + +//------------------------------------------------- +// sound_dma_end_w - +//------------------------------------------------- + +WRITE8_MEMBER( ste_state::sound_dma_end_w ) +{ + switch (offset) + { + case 0x00: + m_dmasnd_end = (data << 16) & 0x3f0000; + break; + case 0x01: + m_dmasnd_end = (m_dmasnd_end & 0x3f00fe) | (data & 0xff) << 8; + break; + case 0x02: + m_dmasnd_end = (m_dmasnd_end & 0x3fff00) | (data & 0xfe); + break; + } + + if (!m_dmasnd_active) + { + m_dmasnd_endlatch = m_dmasnd_end; + } +} + + +//------------------------------------------------- +// sound_mode_w - +//------------------------------------------------- + +WRITE8_MEMBER( ste_state::sound_mode_w ) +{ + m_dmasnd_mode = data & 0x83; +} + + + +//************************************************************************** +// MICROWIRE +//************************************************************************** + +//------------------------------------------------- +// microwire_shift - +//------------------------------------------------- + +void ste_state::microwire_shift() +{ + if (BIT(m_mw_mask, 15)) + { + m_lmc1992->data_w(BIT(m_mw_data, 15)); + m_lmc1992->clock_w(1); + m_lmc1992->clock_w(0); + } + + // rotate mask and data left + m_mw_mask = (m_mw_mask << 1) | BIT(m_mw_mask, 15); + m_mw_data = (m_mw_data << 1) | BIT(m_mw_data, 15); + m_mw_shift++; +} + + +//------------------------------------------------- +// microwire_tick - +//------------------------------------------------- + +void ste_state::microwire_tick() +{ + switch (m_mw_shift) + { + case 0: + m_lmc1992->enable_w(0); + microwire_shift(); + break; + + default: + microwire_shift(); + break; + + case 15: + microwire_shift(); + m_lmc1992->enable_w(1); + m_mw_shift = 0; + m_microwire_timer->enable(0); + break; + } +} + + +//------------------------------------------------- +// microwire_data_r - +//------------------------------------------------- + +READ16_MEMBER( ste_state::microwire_data_r ) +{ + return m_mw_data; +} + + +//------------------------------------------------- +// microwire_data_w - +//------------------------------------------------- + +WRITE16_MEMBER( ste_state::microwire_data_w ) +{ + if (!m_microwire_timer->enabled()) + { + m_mw_data = data; + m_microwire_timer->adjust(attotime::zero, 0, attotime::from_usec(2)); + } +} + + +//------------------------------------------------- +// microwire_mask_r - +//------------------------------------------------- + +READ16_MEMBER( ste_state::microwire_mask_r ) +{ + return m_mw_mask; +} + + +//------------------------------------------------- +// microwire_mask_w - +//------------------------------------------------- + +WRITE16_MEMBER( ste_state::microwire_mask_w ) +{ + if (!m_microwire_timer->enabled()) + { + m_mw_mask = data; + } +} + + + +//************************************************************************** +// CACHE +//************************************************************************** + +//------------------------------------------------- +// cache_r - +//------------------------------------------------- + +READ16_MEMBER( megaste_state::cache_r ) +{ + return m_cache; +} + + +//------------------------------------------------- +// cache_w - +//------------------------------------------------- + +WRITE16_MEMBER( megaste_state::cache_w ) +{ + m_cache = data; + + m_maincpu->set_unscaled_clock(BIT(data, 0) ? Y2/2 : Y2/4); +} + + + +//************************************************************************** +// STBOOK +//************************************************************************** + +//------------------------------------------------- +// config_r - +//------------------------------------------------- + +READ16_MEMBER( stbook_state::config_r ) +{ + /* + + bit description + + 0 _POWER_SWITCH + 1 _TOP_CLOSED + 2 _RTC_ALARM + 3 _SOURCE_DEAD + 4 _SOURCE_LOW + 5 _MODEM_WAKE + 6 (reserved) + 7 _EXPANSION_WAKE + 8 (reserved) + 9 (reserved) + 10 (reserved) + 11 (reserved) + 12 (reserved) + 13 SELF TEST + 14 LOW SPEED FLOPPY + 15 DMA AVAILABLE + + */ + + return (m_sw400->read() << 8) | 0xff; +} + + +//------------------------------------------------- +// lcd_control_w - +//------------------------------------------------- + +WRITE16_MEMBER( stbook_state::lcd_control_w ) +{ + /* + + bit description + + 0 Shadow Chip OFF + 1 _SHIFTER OFF + 2 POWEROFF + 3 _22ON + 4 RS-232_OFF + 5 (reserved) + 6 (reserved) + 7 MTR_PWR_ON + + */ +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( ikbd_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ikbd_map, AS_PROGRAM, 8, st_state ) + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_TAG, hd6301_cpu_device, m6801_io_r, m6801_io_w) + AM_RANGE(0x0080, 0x00ff) AM_RAM + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6301V1_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( ikbd_io_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ikbd_io_map, AS_IO, 8, st_state ) + AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READ(ikbd_port1_r) + AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(ikbd_port2_r, ikbd_port2_w) + AM_RANGE(M6801_PORT3, M6801_PORT3) AM_WRITE(ikbd_port3_w) + AM_RANGE(M6801_PORT4, M6801_PORT4) AM_READWRITE(ikbd_port4_r, ikbd_port4_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( st_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( st_map, AS_PROGRAM, 16, st_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0) AM_WRITE(berr_w) + AM_RANGE(0x000008, 0x1fffff) AM_RAM + AM_RANGE(0x200000, 0x3fffff) AM_RAM + AM_RANGE(0x400000, 0xf9ffff) AM_READWRITE(berr_r, berr_w) + //AM_RANGE(0xfa0000, 0xfbffff) // mapped by the cartslot + AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0) AM_WRITE(berr_w) + AM_RANGE(0xff8000, 0xff8001) AM_READWRITE8(mmu_r, mmu_w, 0x00ff) + AM_RANGE(0xff8200, 0xff8203) AM_READWRITE8(shifter_base_r, shifter_base_w, 0x00ff) + AM_RANGE(0xff8204, 0xff8209) AM_READ8(shifter_counter_r, 0x00ff) + AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(shifter_sync_r, shifter_sync_w, 0xff00) + AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(shifter_palette_r, shifter_palette_w) + AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(shifter_mode_r, shifter_mode_w, 0xff00) + AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(fdc_data_r, fdc_data_w) + AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(dma_status_r, dma_mode_w) + AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(dma_counter_r, dma_base_w, 0x00ff) + AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM2149_TAG, ay8910_device, data_r, address_w, 0xff00) AM_MIRROR(0xfc) + AM_RANGE(0xff8802, 0xff8803) AM_DEVREADWRITE8(YM2149_TAG, ay8910_device, data_r, data_w, 0xff00) AM_MIRROR(0xfc) +#if 0 + AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) + AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) + AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) + AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) + AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) + AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) + AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) + AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) + AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) + AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) + AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) + AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w) +#endif + AM_RANGE(0xfffa00, 0xfffa3f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff) + AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, status_r, control_w, 0xff00) + AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, data_r, data_w, 0xff00) + AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, status_r, control_w, 0xff00) + AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, data_r, data_w, 0xff00) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( megast_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( megast_map, AS_PROGRAM, 16, megast_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0) + AM_RANGE(0x000008, 0x1fffff) AM_RAM + AM_RANGE(0x200000, 0x3fffff) AM_RAM + //AM_RANGE(0xfa0000, 0xfbffff) // mapped by the cartslot + AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0) +// AM_RANGE(0xff7f30, 0xff7f31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) // for TOS 1.02 + AM_RANGE(0xff8000, 0xff8001) AM_READWRITE8(mmu_r, mmu_w, 0x00ff) + AM_RANGE(0xff8200, 0xff8203) AM_READWRITE8(shifter_base_r, shifter_base_w, 0x00ff) + AM_RANGE(0xff8204, 0xff8209) AM_READ8(shifter_counter_r, 0x00ff) + AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(shifter_sync_r, shifter_sync_w, 0xff00) + AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(shifter_palette_r, shifter_palette_w) + AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(shifter_mode_r, shifter_mode_w, 0xff00) + AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(fdc_data_r, fdc_data_w) + AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(dma_status_r, dma_mode_w) + AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(dma_counter_r, dma_base_w, 0x00ff) + AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM2149_TAG, ay8910_device, data_r, address_w, 0xff00) + AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM2149_TAG, ay8910_device, data_w, 0xff00) + AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) + AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) + AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) + AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) + AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) + AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) + AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) + AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) + AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) + AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) + AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) + AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w) + AM_RANGE(0xfffa00, 0xfffa3f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff) + AM_RANGE(0xfffa40, 0xfffa57) AM_READWRITE(fpu_r, fpu_w) + AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, status_r, control_w, 0xff00) + AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, data_r, data_w, 0xff00) + AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, status_r, control_w, 0xff00) + AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, data_r, data_w, 0xff00) + AM_RANGE(0xfffc20, 0xfffc3f) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( ste_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ste_map, AS_PROGRAM, 16, ste_state ) + AM_IMPORT_FROM(st_map) +/* AM_RANGE(0xe00000, 0xe3ffff) AM_ROM AM_REGION(M68000_TAG, 0) + AM_RANGE(0xff8204, 0xff8209) AM_READWRITE8(shifter_counter_r, shifter_counter_w, 0x00ff) + AM_RANGE(0xff820c, 0xff820d) AM_READWRITE8(shifter_base_low_r, shifter_base_low_w, 0x00ff) + AM_RANGE(0xff820e, 0xff820f) AM_READWRITE8(shifter_lineofs_r, shifter_lineofs_w, 0x00ff) + AM_RANGE(0xff8264, 0xff8265) AM_READWRITE8(shifter_pixelofs_r, shifter_pixelofs_w, 0xffff) + AM_RANGE(0xff8900, 0xff8901) AM_READWRITE8(sound_dma_control_r, sound_dma_control_w, 0x00ff) + AM_RANGE(0xff8902, 0xff8907) AM_READWRITE8(sound_dma_base_r, sound_dma_base_w, 0x00ff) + AM_RANGE(0xff8908, 0xff890d) AM_READ8(sound_dma_counter_r, 0x00ff) + AM_RANGE(0xff890e, 0xff8913) AM_READWRITE8(sound_dma_end_r, sound_dma_end_w, 0x00ff) + AM_RANGE(0xff8920, 0xff8921) AM_READWRITE8(sound_mode_r, sound_mode_w, 0x00ff) + AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w) + AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w) + AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) + AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) + AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) + AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) + AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) + AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) + AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) + AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) + AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) + AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) + AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) + AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w)*/ + AM_RANGE(0xff9200, 0xff9201) AM_READ_PORT("JOY0") + AM_RANGE(0xff9202, 0xff9203) AM_READ_PORT("JOY1") + AM_RANGE(0xff9210, 0xff9211) AM_READ_PORT("PADDLE0X") + AM_RANGE(0xff9212, 0xff9213) AM_READ_PORT("PADDLE0Y") + AM_RANGE(0xff9214, 0xff9215) AM_READ_PORT("PADDLE1X") + AM_RANGE(0xff9216, 0xff9217) AM_READ_PORT("PADDLE1Y") + AM_RANGE(0xff9220, 0xff9221) AM_READ_PORT("GUNX") + AM_RANGE(0xff9222, 0xff9223) AM_READ_PORT("GUNY") +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( megaste_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( megaste_map, AS_PROGRAM, 16, megaste_state ) + AM_IMPORT_FROM(st_map) +/* AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(shifter_counter_r, shifter_counter_w) + AM_RANGE(0xff820c, 0xff820d) AM_READWRITE(shifter_base_low_r, shifter_base_low_w) + AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(shifter_lineofs_r, shifter_lineofs_w) + AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(shifter_pixelofs_r, shifter_pixelofs_w) + AM_RANGE(0xff8900, 0xff8901) AM_READWRITE8(sound_dma_control_r, sound_dma_control_w, 0x00ff) + AM_RANGE(0xff8902, 0xff8907) AM_READWRITE8(sound_dma_base_r, sound_dma_base_w, 0x00ff) + AM_RANGE(0xff8908, 0xff890d) AM_READ8(sound_dma_counter_r, 0x00ff) + AM_RANGE(0xff890e, 0xff8913) AM_READWRITE8(sound_dma_end_r, sound_dma_end_w, 0x00ff) + AM_RANGE(0xff8920, 0xff8921) AM_READWRITE8(sound_mode_r, sound_mode_w, 0x00ff) + AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w) + AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w) + AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) + AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) + AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) + AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) + AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) + AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) + AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) + AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) + AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) + AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) + AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) + AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w) + AM_RANGE(0xff8e00, 0xff8e0f) AM_READWRITE(vme_r, vme_w) + AM_RANGE(0xff8e20, 0xff8e21) AM_READWRITE(cache_r, cache_w) +// AM_RANGE(0xfffa40, 0xfffa5f) AM_READWRITE(fpu_r, fpu_w)*/ + AM_RANGE(0xff8c80, 0xff8c87) AM_DEVREADWRITE8(Z8530_TAG, scc8530_t, reg_r, reg_w, 0x00ff) + AM_RANGE(0xfffc20, 0xfffc3f) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( stbook_map ) +//------------------------------------------------- +#if 0 +static ADDRESS_MAP_START( stbook_map, AS_PROGRAM, 16, stbook_state ) + AM_RANGE(0x000000, 0x1fffff) AM_RAM + AM_RANGE(0x200000, 0x3fffff) AM_RAM +// AM_RANGE(0xd40000, 0xd7ffff) AM_ROM + AM_RANGE(0xe00000, 0xe3ffff) AM_ROM AM_REGION(M68000_TAG, 0) +// AM_RANGE(0xe80000, 0xebffff) AM_ROM +// AM_RANGE(0xfa0000, 0xfbffff) AM_ROM // cartridge + AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0) +/* AM_RANGE(0xf00000, 0xf1ffff) AM_READWRITE(stbook_ide_r, stbook_ide_w) + AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(stbook_mmu_r, stbook_mmu_w) + AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(stbook_shifter_base_r, stbook_shifter_base_w) + AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(stbook_shifter_counter_r, stbook_shifter_counter_w) + AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(stbook_shifter_sync_r, stbook_shifter_sync_w, 0xff00) + AM_RANGE(0xff820c, 0xff820d) AM_READWRITE(stbook_shifter_base_low_r, stbook_shifter_base_low_w) + AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(stbook_shifter_lineofs_r, stbook_shifter_lineofs_w) + AM_RANGE(0xff8240, 0xff8241) AM_READWRITE(stbook_shifter_palette_r, stbook_shifter_palette_w) + AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(stbook_shifter_mode_r, stbook_shifter_mode_w, 0xff00) + AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(stbook_shifter_pixelofs_r, stbook_shifter_pixelofs_w) + AM_RANGE(0xff827e, 0xff827f) AM_WRITE(lcd_control_w)*/ + AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM3439_TAG, ay8910_device, data_r, address_w, 0xff00) + AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM3439_TAG, ay8910_device, data_w, 0xff00) +/* AM_RANGE(0xff8900, 0xff8901) AM_READWRITE8(sound_dma_control_r, sound_dma_control_w, 0x00ff) + AM_RANGE(0xff8902, 0xff8907) AM_READWRITE8(sound_dma_base_r, sound_dma_base_w, 0x00ff) + AM_RANGE(0xff8908, 0xff890d) AM_READ8(sound_dma_counter_r, 0x00ff) + AM_RANGE(0xff890e, 0xff8913) AM_READWRITE8(sound_dma_end_r, sound_dma_end_w, 0x00ff) + AM_RANGE(0xff8920, 0xff8921) AM_READWRITE8(sound_mode_r, sound_mode_w, 0x00ff) + AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w) + AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w) + AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) + AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) + AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) + AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) + AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) + AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) + AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) + AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) + AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) + AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) + AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) + AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w) + AM_RANGE(0xff9200, 0xff9201) AM_READ(config_r) + AM_RANGE(0xff9202, 0xff9203) AM_READWRITE(lcd_contrast_r, lcd_contrast_w) + AM_RANGE(0xff9210, 0xff9211) AM_READWRITE(power_r, power_w) + AM_RANGE(0xff9214, 0xff9215) AM_READWRITE(reference_r, reference_w)*/ +ADDRESS_MAP_END +#endif + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( ikbd ) +//------------------------------------------------- + +static INPUT_PORTS_START( ikbd ) + PORT_START("P31") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0xef, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("P32") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0xde, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("P33") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(DEF_STR( Alternate )) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0xbe, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("P34") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") + PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("P35") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + + PORT_START("P36") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("P37") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_NAME("F6") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + + PORT_START("P40") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_NAME("F7") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + + PORT_START("P41") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_NAME("F8") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + + PORT_START("P42") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_NAME("F9") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("P43") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_NAME("F10") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00B4) PORT_CHAR('`') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + + PORT_START("P44") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE(KEYCODE_F11) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + + PORT_START("P45") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Undo") PORT_CODE(KEYCODE_F12) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("P46") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad (") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad )") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) + + PORT_START("P47") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad /") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( st ) +//------------------------------------------------- + +static INPUT_PORTS_START( st ) + PORT_START("config") + PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device") + PORT_CONFSETTING( 0x00, "Mouse" ) + PORT_CONFSETTING( 0x01, DEF_STR( Joystick ) ) + PORT_CONFNAME( 0x80, 0x80, "Monitor") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, st_state, write_monochrome) + PORT_CONFSETTING( 0x00, "Monochrome (Atari SM124)" ) + PORT_CONFSETTING( 0x80, "Color (Atari SC1224)" ) + + PORT_INCLUDE( ikbd ) + + PORT_START("IKBD_JOY0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("config", 0x01, EQUALS, 0x01) // XB + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("config", 0x01, EQUALS, 0x01) // XA + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("config", 0x01, EQUALS, 0x01) // YA + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("config", 0x01, EQUALS, 0x01) // YB + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + + PORT_START("IKBD_JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("config", 0x01, EQUALS, 0x01) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + + PORT_START("IKBD_MOUSEX") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_CONDITION("config", 0x01, EQUALS, 0x00) + + PORT_START("IKBD_MOUSEY") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_CONDITION("config", 0x01, EQUALS, 0x00) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( ste ) +//------------------------------------------------- + +static INPUT_PORTS_START( ste ) + PORT_START("config") + PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device") + PORT_CONFSETTING( 0x00, "Mouse" ) + PORT_CONFSETTING( 0x01, DEF_STR( Joystick ) ) + PORT_CONFNAME( 0x80, 0x80, "Monitor") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, ste_state, write_monochrome) + PORT_CONFSETTING( 0x00, "Monochrome (Atari SM124)" ) + PORT_CONFSETTING( 0x80, "Color (Atari SC1435)" ) + + PORT_INCLUDE( ikbd ) + + PORT_START("JOY0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("JOY1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_8WAY + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_8WAY + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_8WAY + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_8WAY + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_8WAY + + PORT_START("PADDLE0X") + PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(1) + + PORT_START("PADDLE0Y") + PORT_BIT( 0xff, 0x00, IPT_PADDLE_V ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(1) + + PORT_START("PADDLE1X") + PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(2) + + PORT_START("PADDLE1Y") + PORT_BIT( 0xff, 0x00, IPT_PADDLE_V ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(2) + + PORT_START("GUNX") // should be 10-bit + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) + + PORT_START("GUNY") // should be 10-bit + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(1) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( stbook ) +//------------------------------------------------- + +#if 0 +static INPUT_PORTS_START( stbook ) + PORT_START("SW400") + PORT_DIPNAME( 0x80, 0x80, "DMA sound hardware") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x40, 0x00, "WD1772 FDC") + PORT_DIPSETTING( 0x40, "Low Speed (8 MHz)" ) + PORT_DIPSETTING( 0x00, "High Speed (16 MHz)" ) + PORT_DIPNAME( 0x20, 0x00, "Bypass Self Test") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) + PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END +#endif + + +//------------------------------------------------- +// INPUT_PORTS( tt030 ) +//------------------------------------------------- + +static INPUT_PORTS_START( tt030 ) + PORT_INCLUDE(ste) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( falcon ) +//------------------------------------------------- + +static INPUT_PORTS_START( falcon ) + PORT_INCLUDE(ste) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// ay8910_interface psg_intf +//------------------------------------------------- + +WRITE8_MEMBER( st_state::psg_pa_w ) +{ + /* + + bit description + + 0 SIDE 0 + 1 DRIVE 0 + 2 DRIVE 1 + 3 RTS + 4 DTR + 5 STROBE + 6 GPO + 7 + + */ + + // drive select + floppy_image_device *floppy = 0; + if (!BIT(data, 1)) + floppy = floppy_devices[0]; + else if(!BIT(data, 2)) + floppy = floppy_devices[1]; + + // side select + if(floppy) + floppy->ss_w(BIT(data, 0) ? 0 : 1); + + m_fdc->set_floppy(floppy); + + // request to send + m_rs232->write_rts(BIT(data, 3)); + + // data terminal ready + m_rs232->write_dtr(BIT(data, 4)); + + // centronics strobe + m_centronics->write_strobe(BIT(data, 5)); +} + +//------------------------------------------------- +// ay8910_interface stbook_psg_intf +//------------------------------------------------- + +WRITE8_MEMBER( stbook_state::psg_pa_w ) +{ + /* + + bit description + + 0 SIDE 0 + 1 DRIVE 0 + 2 DRIVE 1 + 3 RTS + 4 DTR + 5 STROBE + 6 IDE RESET + 7 DDEN + + */ + + // drive select + floppy_image_device *floppy = 0; + if (!BIT(data, 1)) + floppy = floppy_devices[0]; + else if(!BIT(data, 2)) + floppy = floppy_devices[1]; + + // side select + if(floppy) + floppy->ss_w(BIT(data, 0) ? 0 : 1); + + m_fdc->set_floppy(floppy); + + // request to send + m_rs232->write_rts(BIT(data, 3)); + + // data terminal ready + m_rs232->write_dtr(BIT(data, 4)); + + // centronics strobe + m_centronics->write_strobe(BIT(data, 5)); + + // density select + m_fdc->dden_w(BIT(data, 7)); +} + +WRITE_LINE_MEMBER( st_state::ikbd_tx_w ) +{ + m_ikbd_tx = state; +} + +WRITE_LINE_MEMBER( st_state::acia_ikbd_irq_w ) +{ + m_acia_ikbd_irq = state; + + m_mfp->i4_w(!(m_acia_ikbd_irq || m_acia_midi_irq)); +} + + +WRITE_LINE_MEMBER( st_state::acia_midi_irq_w ) +{ + m_acia_midi_irq = state; + + m_mfp->i4_w(!(m_acia_ikbd_irq || m_acia_midi_irq)); +} + +WRITE_LINE_MEMBER(st_state::write_acia_clock) +{ + m_acia0->write_txc(state); + m_acia0->write_rxc(state); + m_acia1->write_txc(state); + m_acia1->write_rxc(state); +} + + +WRITE_LINE_MEMBER( st_state::mfp_tdo_w ) +{ + m_mfp->clock_w(state); +} + +WRITE_LINE_MEMBER( st_state::fdc_drq_w ) +{ + if (state && (!(m_fdc_mode & DMA_MODE_ENABLED)) && (m_fdc_mode & DMA_MODE_FDC_HDC_ACK)) + fdc_dma_transfer(); +} + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// IRQ_CALLBACK_MEMBER( atarist_int_ack ) +//------------------------------------------------- + +IRQ_CALLBACK_MEMBER(st_state::atarist_int_ack) +{ + if (irqline == M68K_IRQ_6) + { + return m_mfp->get_vector(); + } + + return M68K_INT_ACK_AUTOVECTOR; +} + + +//------------------------------------------------- +// configure_memory - +//------------------------------------------------- + +void st_state::configure_memory() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + switch (m_ram->size()) + { + case 256 * 1024: + program.unmap_readwrite(0x040000, 0x3fffff); + break; + + case 512 * 1024: + program.unmap_readwrite(0x080000, 0x3fffff); + break; + + case 1024 * 1024: + program.unmap_readwrite(0x100000, 0x3fffff); + break; + + case 2048 * 1024: + program.unmap_readwrite(0x200000, 0x3fffff); + break; + } +} + +//------------------------------------------------- +// state_save - +//------------------------------------------------- + +void st_state::state_save() +{ + m_dma_error = 1; + + save_item(NAME(m_mmu)); + save_item(NAME(m_dma_base)); + save_item(NAME(m_dma_error)); + save_item(NAME(m_fdc_mode)); + save_item(NAME(m_fdc_sectors)); + save_item(NAME(m_fdc_dmabytes)); + save_item(NAME(m_ikbd_keylatch)); + save_item(NAME(m_ikbd_mouse)); + save_item(NAME(m_ikbd_mouse_x)); + save_item(NAME(m_ikbd_mouse_y)); + save_item(NAME(m_ikbd_mouse_px)); + save_item(NAME(m_ikbd_mouse_py)); + save_item(NAME(m_ikbd_mouse_pc)); + save_item(NAME(m_ikbd_tx)); + save_item(NAME(m_ikbd_joy)); + save_item(NAME(m_midi_tx)); + save_item(NAME(m_acia_ikbd_irq)); + save_item(NAME(m_acia_midi_irq)); +} + +//------------------------------------------------- +// MACHINE_START( st ) +//------------------------------------------------- + +void st_state::machine_start() +{ + // configure RAM banking + configure_memory(); + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart)); + + // allocate timers + if(m_mousex) { + m_mouse_timer = timer_alloc(TIMER_MOUSE_TICK); + m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(500)); + } + + // register for state saving + state_save(); + + static const char *names[] = { WD1772_TAG ":0", WD1772_TAG ":1" }; + for(int i=0; i != 2; i++) { + floppy_connector *con = machine().device(names[i]); + if(con) + floppy_devices[i] = con->get_device(); + else + floppy_devices[i] = 0; + } + + /// TODO: get callbacks to trigger these. + m_mfp->i0_w(1); + m_mfp->i5_w(1); + m_mfp->i7_w(1); +} + + +//------------------------------------------------- +// state_save - +//------------------------------------------------- + +void ste_state::state_save() +{ + st_state::state_save(); + + save_item(NAME(m_dmasnd_base)); + save_item(NAME(m_dmasnd_end)); + save_item(NAME(m_dmasnd_cntr)); + save_item(NAME(m_dmasnd_baselatch)); + save_item(NAME(m_dmasnd_endlatch)); + save_item(NAME(m_dmasnd_ctrl)); + save_item(NAME(m_dmasnd_mode)); + save_item(NAME(m_dmasnd_fifo)); + save_item(NAME(m_dmasnd_samples)); + save_item(NAME(m_dmasnd_active)); + save_item(NAME(m_mw_data)); + save_item(NAME(m_mw_mask)); + save_item(NAME(m_mw_shift)); +} + + +//------------------------------------------------- +// MACHINE_START( ste ) +//------------------------------------------------- + +void ste_state::machine_start() +{ + /* configure RAM banking */ + configure_memory(); + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart)); + + /* allocate timers */ + m_dmasound_timer = timer_alloc(TIMER_DMASOUND_TICK); + m_microwire_timer = timer_alloc(TIMER_MICROWIRE_TICK); + + /* register for state saving */ + state_save(); + + /// TODO: get callbacks to trigger these. + m_mfp->i0_w(1); + m_mfp->i5_w(1); + m_mfp->i7_w(1); +} + + +//------------------------------------------------- +// MACHINE_START( megaste ) +//------------------------------------------------- + +void megaste_state::machine_start() +{ + ste_state::machine_start(); + + save_item(NAME(m_cache)); +} + + +//------------------------------------------------- +// MACHINE_START( stbook ) +//------------------------------------------------- + +void stbook_state::machine_start() +{ + /* configure RAM banking */ + address_space &program = m_maincpu->space(AS_PROGRAM); + + switch (m_ram->size()) + { + case 1024 * 1024: + program.unmap_readwrite(0x100000, 0x3fffff); + break; + } + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart)); + + /* register for state saving */ + ste_state::state_save(); + + /// TODO: get callbacks to trigger these. + m_mfp->i0_w(1); + m_mfp->i5_w(1); +} + +FLOPPY_FORMATS_MEMBER( st_state::floppy_formats ) + FLOPPY_ST_FORMAT, FLOPPY_MSA_FORMAT, FLOPPY_PASTI_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( atari_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( st ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( st, st_state ) + // basic machine hardware + MCFG_CPU_ADD(M68000_TAG, M68000, Y2/4) + MCFG_CPU_PROGRAM_MAP(st_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(st_state,atarist_int_ack) + + MCFG_CPU_ADD(HD6301V1_TAG, HD6301, Y2/8) + MCFG_CPU_PROGRAM_MAP(ikbd_map) + MCFG_CPU_IO_MAP(ikbd_io_map) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(st_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(Y2/2, ATARIST_HTOT_PAL*2, ATARIST_HBEND_PAL*2, ATARIST_HBSTART_PAL*2, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL) + + MCFG_PALETTE_ADD("palette", 16) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(YM2149_TAG, YM2149, Y2/16) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_RES_LOADS(RES_K(1), 0, 0) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(st_state, psg_pa_w)) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + + MCFG_WD1772_ADD(WD1772_TAG, Y2/4) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, st_state::floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD(MC68901_TAG, MC68901, Y2/8) + MCFG_MC68901_TIMER_CLOCK(Y1) + MCFG_MC68901_RX_CLOCK(0) + MCFG_MC68901_TX_CLOCK(0) + MCFG_MC68901_OUT_IRQ_CB(INPUTLINE(M68000_TAG, M68K_IRQ_6)) + MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) + MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i1_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i2_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i6_w)) + + MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(st_state, ikbd_tx_w)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_ikbd_irq_w)) + + MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_midi_irq_w)) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_DEVICE_ADD("acia_clock", CLOCK, Y2/64) // 500kHz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(st_state, write_acia_clock)) + + // cartridge + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "st_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) + MCFG_SOFTWARE_LIST_ADD("cart_list", "st_cart") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1M") // 1040ST + MCFG_RAM_EXTRA_OPTIONS("512K,256K") // 520ST, 260ST + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "st_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( megast ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( megast, megast_state ) + // basic machine hardware + MCFG_CPU_ADD(M68000_TAG, M68000, Y2/4) + MCFG_CPU_PROGRAM_MAP(megast_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(st_state,atarist_int_ack) + + MCFG_CPU_ADD(HD6301V1_TAG, HD6301, Y2/8) + MCFG_CPU_PROGRAM_MAP(ikbd_map) + MCFG_CPU_IO_MAP(ikbd_io_map) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(megast_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL) + + MCFG_PALETTE_ADD("palette", 16) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(YM2149_TAG, YM2149, Y2/16) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_RES_LOADS(RES_K(1), 0, 0) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(st_state, psg_pa_w)) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) + + MCFG_WD1772_ADD(WD1772_TAG, Y2/4) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, st_state::floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD(MC68901_TAG, MC68901, Y2/8) + MCFG_MC68901_TIMER_CLOCK(Y1) + MCFG_MC68901_RX_CLOCK(0) + MCFG_MC68901_TX_CLOCK(0) + MCFG_MC68901_OUT_IRQ_CB(INPUTLINE(M68000_TAG, M68K_IRQ_6)) + MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) + MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i1_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i2_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i6_w)) + + MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(st_state, ikbd_tx_w)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_ikbd_irq_w)) + + MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_midi_irq_w)) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_DEVICE_ADD("acia_clock", CLOCK, Y2/64) // 500kHz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(st_state, write_acia_clock)) + + // cartridge + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "st_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) + MCFG_SOFTWARE_LIST_ADD("cart_list", "st_cart") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") // Mega ST 4 + MCFG_RAM_EXTRA_OPTIONS("2M,1M") // Mega ST 2 ,Mega ST 1 + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "st_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( ste ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ste, ste_state ) + // basic machine hardware + MCFG_CPU_ADD(M68000_TAG, M68000, Y2/4) + MCFG_CPU_PROGRAM_MAP(ste_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(st_state,atarist_int_ack) + + MCFG_CPU_ADD(HD6301V1_TAG, HD6301, Y2/8) + MCFG_CPU_PROGRAM_MAP(ikbd_map) + MCFG_CPU_IO_MAP(ikbd_io_map) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(ste_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL) + + MCFG_PALETTE_ADD("palette", 512) + + // sound hardware + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_ADD(YM2149_TAG, YM2149, Y2/16) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_RES_LOADS(RES_K(1), 0, 0) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(st_state, psg_pa_w)) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(0, "rspeaker", 0.50) +/* + MCFG_SOUND_ADD("custom", CUSTOM, 0) // DAC + MCFG_SOUND_ROUTE(0, "rspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) +*/ + MCFG_LMC1992_ADD(LMC1992_TAG /* ,atariste_lmc1992_intf */) + + // devices + + MCFG_WD1772_ADD(WD1772_TAG, Y2/4) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, st_state::floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD(MC68901_TAG, MC68901, Y2/8) + MCFG_MC68901_TIMER_CLOCK(Y1) + MCFG_MC68901_RX_CLOCK(0) + MCFG_MC68901_TX_CLOCK(0) + MCFG_MC68901_OUT_IRQ_CB(INPUTLINE(M68000_TAG, M68K_IRQ_6)) + MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) + MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i1_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i2_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i6_w)) + + MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(st_state, ikbd_tx_w)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_ikbd_irq_w)) + + MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_midi_irq_w)) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_DEVICE_ADD("acia_clock", CLOCK, Y2/64) // 500kHz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(st_state, write_acia_clock)) + + // cartridge + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "st_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) +// MCFG_SOFTWARE_LIST_ADD("cart_list", "ste_cart") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1M") // 1040STe + MCFG_RAM_EXTRA_OPTIONS("512K") // 520STe + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "st_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( megaste ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( megaste, ste ) + MCFG_CPU_MODIFY(M68000_TAG) + MCFG_CPU_PROGRAM_MAP(megaste_map) + MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) + MCFG_DEVICE_ADD(Z8530_TAG, SCC8530, Y2/4) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") // Mega STe 4 + MCFG_RAM_EXTRA_OPTIONS("2M,1M") // Mega STe 2 ,Mega STe 1 +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( stbook ) +//------------------------------------------------- +#if 0 +static MACHINE_CONFIG_START( stbook, stbook_state ) + // basic machine hardware + MCFG_CPU_ADD(M68000_TAG, M68000, U517/2) + MCFG_CPU_PROGRAM_MAP(stbook_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(st_state,atarist_int_ack) + + //MCFG_CPU_ADD(COP888_TAG, COP888, Y700) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_UPDATE_DRIVER(stbook_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(YM3439_TAG, YM3439, U517/8) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_RES_LOADS(RES_K(1), 0, 0) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(stbook_state, psg_pa_w)) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_DEVICE_ADD(MC68901_TAG, MC68901, U517/8) + MCFG_MC68901_TIMER_CLOCK(Y1) + MCFG_MC68901_RX_CLOCK(0) + MCFG_MC68901_TX_CLOCK(0) + MCFG_MC68901_OUT_IRQ_CB(INPUTLINE(M68000_TAG, M68K_IRQ_6)) + MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) + MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + + MCFG_WD1772_ADD(WD1772_TAG, U517/2) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", 0, st_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, 0, st_state::floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_SERIAL_OUT_RX_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) + MCFG_RS232_OUT_DCD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i1_w)) + MCFG_RS232_OUT_CTS_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i2_w)) + MCFG_RS232_OUT_RI_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i6_w)) + + // device hardware + MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(st_state, ikbd_tx_w)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_ikbd_irq_w)) + + MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_midi_irq_w)) + + MCFG_SERIAL_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) + + MCFG_SERIAL_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_DEVICE_ADD("acia_clock", CLOCK, U517/2/16) // 500kHz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(st_state, write_acia_clock)) + + // cartridge + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "st_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) + MCFG_SOFTWARE_LIST_ADD("cart_list", "st_cart") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("1M") +MACHINE_CONFIG_END +#endif + +//------------------------------------------------- +// MACHINE_CONFIG( tt030 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( tt030, ste ) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( falcon ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( falcon, ste ) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( falcon40 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( falcon40, ste ) +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( st ) +//------------------------------------------------- + +ROM_START( st ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos100") + ROM_SYSTEM_BIOS( 0, "tos099", "TOS 0.99 (Disk TOS)" ) + ROMX_LOAD( "tos099.bin", 0x00000, 0x04000, CRC(cee3c664) SHA1(80c10b31b63b906395151204ec0a4984c8cb98d6), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos100", "TOS 1.0 (ROM TOS)" ) + ROMX_LOAD( "tos100.bin", 0x00000, 0x30000, BAD_DUMP CRC(d331af30) SHA1(7bcc2311d122f451bd03c9763ade5a119b2f90da), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102.bin", 0x00000, 0x30000, BAD_DUMP CRC(d3c32283) SHA1(735793fdba07fe8d5295caa03484f6ef3de931f5), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(90f4fbff) SHA1(2487f330b0895e5d88d580d4ecb24061125e88ad), ROM_BIOS(4) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( st_uk ) +//------------------------------------------------- + +ROM_START( st_uk ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos100") + ROM_SYSTEM_BIOS( 0, "tos100", "TOS 1.0 (ROM TOS)" ) + ROMX_LOAD( "tos100uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(1a586c64) SHA1(9a6e4c88533a9eaa4d55cdc040e47443e0226eb2), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(3b5cd0c5) SHA1(87900a40a890fdf03bd08be6c60cc645855cbce5), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(3) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( st_de ) +//------------------------------------------------- + +ROM_START( st_de ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos100") + ROM_SYSTEM_BIOS( 0, "tos100", "TOS 1.0 (ROM TOS)" ) + ROMX_LOAD( "tos100de.bin", 0x00000, 0x30000, BAD_DUMP CRC(16e3e979) SHA1(663d9c87cfb44ae8ada855fe9ed3cccafaa7a4ce), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102de.bin", 0x00000, 0x30000, BAD_DUMP CRC(36a0058e) SHA1(cad5d2902e875d8bf0a14dc5b5b8080b30254148), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104de.bin", 0x00000, 0x30000, BAD_DUMP CRC(62b82b42) SHA1(5313733f91b083c6265d93674cb9d0b7efd02da8), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "tos10x", "TOS 1.0?" ) + ROMX_LOAD( "st 7c1 a4.u4", 0x00000, 0x08000, CRC(867fdd7e) SHA1(320d12acf510301e6e9ab2e3cf3ee60b0334baa0), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "st 7c1 a9.u7", 0x00001, 0x08000, CRC(30e8f982) SHA1(253f26ff64b202b2681ab68ffc9954125120baea), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "st 7c1 b0.u3", 0x10000, 0x08000, CRC(b91337ed) SHA1(21a338f9bbd87bce4a12d38048e03a361f58d33e), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "st 7a4 a6.u6", 0x10001, 0x08000, CRC(969d7bbe) SHA1(72b998c1f25211c2a96c81a038d71b6a390585c2), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "st 7c1 a2.u2", 0x20000, 0x08000, CRC(d0513329) SHA1(49855a3585e2f75b2af932dd4414ed64e6d9501f), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "st 7c1 b1.u5", 0x20001, 0x08000, CRC(c115cbc8) SHA1(2b52b81a1a4e0818d63f98ee4b25c30e2eba61cb), ROM_SKIP(1) | ROM_BIOS(4) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( st_fr ) +//------------------------------------------------- + +ROM_START( st_fr ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos100") + ROM_SYSTEM_BIOS( 0, "tos100", "TOS 1.0 (ROM TOS)" ) + ROMX_LOAD( "tos100fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(2b7f2117) SHA1(ecb00a2e351a6205089a281b4ce6e08959953704), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(8688fce6) SHA1(f5a79aac0a4e812ca77b6ac51d58d98726f331fe), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(a305a404) SHA1(20dba880344b810cf63cec5066797c5a971db870), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "tos10x", "TOS 1.0?" ) + ROMX_LOAD( "c101658-001.u63", 0x00000, 0x08000, CRC(9c937f6f) SHA1(d4a3ea47568ef6233f3f2056e384b09eedd84961), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "c101661-001.u67", 0x00001, 0x08000, CRC(997298f3) SHA1(9e06d42df88557252a36791b514afe455600f679), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "c101657-001.u59", 0x10000, 0x08000, CRC(b63be6a1) SHA1(434f443472fc649568e4f8be6880f39c2def7819), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "c101660-001.u62", 0x10001, 0x08000, CRC(a813892c) SHA1(d041c113050dfb00166c4a7a52766e1b7eac9cab), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "c101656-001.u48", 0x20000, 0x08000, CRC(dbd93fb8) SHA1(cf9ec11e4bc2465490e7e6c981d9f61eae6cb359), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "c101659-001.u53", 0x20001, 0x08000, CRC(67c9785a) SHA1(917a17e9f83bee015c25b327780eebb11cb2c5a5), ROM_SKIP(1) | ROM_BIOS(4) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( st_es ) +//------------------------------------------------- + +ROM_START( st_es ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos100") + ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104es.bin", 0x00000, 0x30000, BAD_DUMP CRC(f4e8ecd2) SHA1(df63f8ac09125d0877b55d5ba1282779b7f99c16), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( st_nl ) +//------------------------------------------------- + +ROM_START( st_nl ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos100") + ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104nl.bin", 0x00000, 0x30000, BAD_DUMP CRC(bb4370d4) SHA1(6de7c96b2d2e5c68778f4bce3eaf85a4e121f166), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( st_se ) +//------------------------------------------------- + +ROM_START( st_se ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos102") + ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102se.bin", 0x00000, 0x30000, BAD_DUMP CRC(673fd0c2) SHA1(433de547e09576743ae9ffc43d43f2279782e127), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104se.bin", 0x00000, 0x30000, BAD_DUMP CRC(80ecfdce) SHA1(b7ad34d5cdfbe86ea74ae79eca11dce421a7bbfd), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( st_sg ) +//------------------------------------------------- + +ROM_START( st_sg ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos102") + ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(5fe16c66) SHA1(45acb2fc4b1b13bd806c751aebd66c8304fc79bc), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(e58f0bdf) SHA1(aa40bf7203f02b2251b9e4850a1a73ff1c7da106), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megast ) +//------------------------------------------------- + +ROM_START( megast ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos104") + ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102.bin", 0x00000, 0x30000, BAD_DUMP CRC(d3c32283) SHA1(735793fdba07fe8d5295caa03484f6ef3de931f5), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(90f4fbff) SHA1(2487f330b0895e5d88d580d4ecb24061125e88ad), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megast_uk ) +//------------------------------------------------- + +ROM_START( megast_uk ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos104") + ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(3b5cd0c5) SHA1(87900a40a890fdf03bd08be6c60cc645855cbce5), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megast_de ) +//------------------------------------------------- + +ROM_START( megast_de ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos104") + ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102de.bin", 0x00000, 0x30000, BAD_DUMP CRC(36a0058e) SHA1(cad5d2902e875d8bf0a14dc5b5b8080b30254148), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104de.bin", 0x00000, 0x30000, BAD_DUMP CRC(62b82b42) SHA1(5313733f91b083c6265d93674cb9d0b7efd02da8), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megast_fr ) +//------------------------------------------------- + +ROM_START( megast_fr ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos104") + ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(8688fce6) SHA1(f5a79aac0a4e812ca77b6ac51d58d98726f331fe), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(a305a404) SHA1(20dba880344b810cf63cec5066797c5a971db870), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megast_se ) +//------------------------------------------------- + +ROM_START( megast_se ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos104") + ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102se.bin", 0x00000, 0x30000, BAD_DUMP CRC(673fd0c2) SHA1(433de547e09576743ae9ffc43d43f2279782e127), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104se.bin", 0x00000, 0x30000, BAD_DUMP CRC(80ecfdce) SHA1(b7ad34d5cdfbe86ea74ae79eca11dce421a7bbfd), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megast_sg ) +//------------------------------------------------- + +ROM_START( megast_sg ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos104") + ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) + ROMX_LOAD( "tos102sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(5fe16c66) SHA1(45acb2fc4b1b13bd806c751aebd66c8304fc79bc), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(e58f0bdf) SHA1(aa40bf7203f02b2251b9e4850a1a73ff1c7da106), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( stacy ) +//------------------------------------------------- + +#if 0 +ROM_START( stacy ) + ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" ) + ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END +#endif + + +//------------------------------------------------- +// ROM( ste ) +//------------------------------------------------- + +ROM_START( ste ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) + ROMX_LOAD( "tos106.bin", 0x00000, 0x40000, BAD_DUMP CRC(a2e25337) SHA1(6a850810a92fdb1e64d005a06ea4079f51c97145), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) + ROMX_LOAD( "tos162.bin", 0x00000, 0x40000, BAD_DUMP CRC(1c1a4eba) SHA1(42b875f542e5b728905d819c83c31a095a6a1904), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206.bin", 0x00000, 0x40000, BAD_DUMP CRC(3f2f840f) SHA1(ee58768bdfc602c9b14942ce5481e97dd24e7c83), ROM_BIOS(3) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( ste_uk ) +//------------------------------------------------- + +ROM_START( ste_uk ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) + ROMX_LOAD( "tos106uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(d72fea29) SHA1(06f9ea322e74b682df0396acfaee8cb4d9c90cad), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) + ROMX_LOAD( "tos162uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(d1c6f2fa) SHA1(70db24a7c252392755849f78940a41bfaebace71), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(3) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( ste_de ) +//------------------------------------------------- + +ROM_START( ste_de ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) + ROMX_LOAD( "tos106de.bin", 0x00000, 0x40000, BAD_DUMP CRC(7c67c5c9) SHA1(3b8cf5ffa41b252eb67f8824f94608fa4005d6dd), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) + ROMX_LOAD( "tos162de.bin", 0x00000, 0x40000, BAD_DUMP CRC(2cdeb5e5) SHA1(10d9f61705048ee3dcbec67df741bed49b922149), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206de.bin", 0x00000, 0x40000, BAD_DUMP CRC(143cd2ab) SHA1(d1da866560734289c4305f1028c36291d331d417), ROM_BIOS(3) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( ste_es ) +//------------------------------------------------- + +ROM_START( ste_es ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos106") + ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) + ROMX_LOAD( "tos106es.bin", 0x00000, 0x40000, BAD_DUMP CRC(5cd2a540) SHA1(3a18f342c8288c0bc1879b7a209c73d5d57f7e81), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( ste_fr ) +//------------------------------------------------- + +ROM_START( ste_fr ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) + ROMX_LOAD( "tos106fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(b6e58a46) SHA1(7d7e3cef435caa2fd7733a3fbc6930cb9ea7bcbc), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) + ROMX_LOAD( "tos162fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(0ab003be) SHA1(041e134da613f718fca8bd47cd7733076e8d7588), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(e3a99ca7) SHA1(387da431e6e3dd2e0c4643207e67d06cf33618c3), ROM_BIOS(3) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( ste_it ) +//------------------------------------------------- + +ROM_START( ste_it ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos106") + ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) + ROMX_LOAD( "tos106it.bin", 0x00000, 0x40000, BAD_DUMP CRC(d3a55216) SHA1(28dc74e5e0fa56b685bbe15f9837f52684fee9fd), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( ste_se ) +//------------------------------------------------- + +ROM_START( ste_se ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) + ROMX_LOAD( "tos162se.bin", 0x00000, 0x40000, BAD_DUMP CRC(90f124b1) SHA1(6e5454e861dbf4c46ce5020fc566c31202087b88), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206se.bin", 0x00000, 0x40000, BAD_DUMP CRC(be61906d) SHA1(ebdf5a4cf08471cd315a91683fcb24e0f029d451), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( ste_sg ) +//------------------------------------------------- + +ROM_START( ste_sg ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206sg.bin", 0x00000, 0x40000, BAD_DUMP CRC(8c4fe57d) SHA1(c7a9ae3162f020dcac0c2a46cf0c033f91b98644), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megaste ) +//------------------------------------------------- + +ROM_START( megaste ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) + ROMX_LOAD( "tos205.bin", 0x00000, 0x40000, BAD_DUMP CRC(d8845f8d) SHA1(e069c14863819635bea33074b90c22e5bd99f1bd), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206.bin", 0x00000, 0x40000, BAD_DUMP CRC(3f2f840f) SHA1(ee58768bdfc602c9b14942ce5481e97dd24e7c83), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megaste_uk ) +//------------------------------------------------- + +ROM_START( megaste_uk ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") +#if 0 + ROM_SYSTEM_BIOS( 0, "tos202", "TOS 2.02 (Mega STE TOS)" ) + ROMX_LOAD( "tos202uk.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos205", "TOS 2.05 (Mega STE TOS)" ) + ROMX_LOAD( "tos205uk.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(3) ) +#else + ROM_SYSTEM_BIOS( 0, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(1) ) +#endif + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megaste_fr ) +//------------------------------------------------- + +ROM_START( megaste_fr ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) + ROMX_LOAD( "tos205fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(27b83d2f) SHA1(83963b0feb0d119b2ca6f51e483e8c20e6ab79e1), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(e3a99ca7) SHA1(387da431e6e3dd2e0c4643207e67d06cf33618c3), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megaste_de ) +//------------------------------------------------- + +ROM_START( megaste_de ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) + ROMX_LOAD( "tos205de.bin", 0x00000, 0x40000, BAD_DUMP CRC(518b24e6) SHA1(084e083422f8fd9ac7a2490f19b81809c52b91b4), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206de.bin", 0x00000, 0x40000, BAD_DUMP CRC(143cd2ab) SHA1(d1da866560734289c4305f1028c36291d331d417), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megaste_es ) +//------------------------------------------------- + +ROM_START( megaste_es ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos205") + ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) + ROMX_LOAD( "tos205es.bin", 0x00000, 0x40000, BAD_DUMP CRC(2a426206) SHA1(317715ad8de718b5acc7e27ecf1eb833c2017c91), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megaste_it ) +//------------------------------------------------- + +ROM_START( megaste_it ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos205") + ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) + ROMX_LOAD( "tos205it.bin", 0x00000, 0x40000, BAD_DUMP CRC(b28bf5a1) SHA1(8e0581b442384af69345738849cf440d72f6e6ab), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( megaste_se ) +//------------------------------------------------- + +ROM_START( megaste_se ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos206") + ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) + ROMX_LOAD( "tos205se.bin", 0x00000, 0x40000, BAD_DUMP CRC(6d49ccbe) SHA1(c065b1a9a2e42e5e373333e99be829028902acaa), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) + ROMX_LOAD( "tos206se.bin", 0x00000, 0x40000, BAD_DUMP CRC(be61906d) SHA1(ebdf5a4cf08471cd315a91683fcb24e0f029d451), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( stbook ) +//------------------------------------------------- + +#if 0 +ROM_START( stbook ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "tos208", "TOS 2.08" ) + ROMX_LOAD( "tos208.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) ) + + ROM_REGION( 0x1000, COP888_TAG, 0 ) + ROM_LOAD( "cop888c0.u703", 0x0000, 0x1000, NO_DUMP ) +ROM_END +#endif + + +//------------------------------------------------- +// ROM( stpad ) +//------------------------------------------------- + +#if 0 +ROM_START( stpad ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05" ) + ROMX_LOAD( "tos205.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) ) +ROM_END +#endif + + +//------------------------------------------------- +// ROM( tt030 ) +//------------------------------------------------- + +ROM_START( tt030 ) + ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos306") + ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) + ROMX_LOAD( "tos306.bin", 0x00000, 0x80000, BAD_DUMP CRC(e65adbd7) SHA1(b15948786278e1f2abc4effbb6d40786620acbe8), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( tt030_uk ) +//------------------------------------------------- + +ROM_START( tt030_uk ) + ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos306") + ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) + ROMX_LOAD( "tos306uk.bin", 0x00000, 0x80000, BAD_DUMP CRC(75dda215) SHA1(6325bdfd83f1b4d3afddb2b470a19428ca79478b), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( tt030_de ) +//------------------------------------------------- + +ROM_START( tt030_de ) + ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos306") + ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) + ROMX_LOAD( "tos306de.bin", 0x00000, 0x80000, BAD_DUMP CRC(4fcbb59d) SHA1(80af04499d1c3b8551fc4d72142ff02c2182e64a), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( tt030_fr ) +//------------------------------------------------- + +ROM_START( tt030_fr ) + ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos306") + ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) + ROMX_LOAD( "tos306fr.bin", 0x00000, 0x80000, BAD_DUMP CRC(1945511c) SHA1(6bb19874e1e97dba17215d4f84b992c224a81b95), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( tt030_pl ) +//------------------------------------------------- + +ROM_START( tt030_pl ) + ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos306") + ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) + ROMX_LOAD( "tos306pl.bin", 0x00000, 0x80000, BAD_DUMP CRC(4f2404bc) SHA1(d122b8ceb202b52754ff0d442b1c81f8b4de3436), ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( fx1 ) +//------------------------------------------------- + +#if 0 +ROM_START( fx1 ) + ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "tos207", "TOS 2.07" ) + ROMX_LOAD( "tos207.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END +#endif + + +//------------------------------------------------- +// ROM( falcon30 ) +//------------------------------------------------- + +ROM_START( falcon30 ) + ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) + ROM_DEFAULT_BIOS("tos404") +#if 0 + ROM_SYSTEM_BIOS( 0, "tos400", "TOS 4.00" ) + ROMX_LOAD( "tos400.bin", 0x00000, 0x7ffff, BAD_DUMP CRC(1fbc5396) SHA1(d74d09f11a0bf37a86ccb50c6e7f91aac4d4b11b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos401", "TOS 4.01" ) + ROMX_LOAD( "tos401.bin", 0x00000, 0x80000, NO_DUMP, ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos402", "TOS 4.02" ) + ROMX_LOAD( "tos402.bin", 0x00000, 0x80000, BAD_DUMP CRC(63f82f23) SHA1(75de588f6bbc630fa9c814f738195da23b972cc6), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "tos404", "TOS 4.04" ) + ROMX_LOAD( "tos404.bin", 0x00000, 0x80000, BAD_DUMP CRC(028b561d) SHA1(27dcdb31b0951af99023b2fb8c370d8447ba6ebc), ROM_BIOS(4) ) +#else + ROM_SYSTEM_BIOS( 0, "tos400", "TOS 4.00" ) + ROMX_LOAD( "tos400.bin", 0x00000, 0x7ffff, BAD_DUMP CRC(1fbc5396) SHA1(d74d09f11a0bf37a86ccb50c6e7f91aac4d4b11b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tos402", "TOS 4.02" ) + ROMX_LOAD( "tos402.bin", 0x00000, 0x80000, BAD_DUMP CRC(63f82f23) SHA1(75de588f6bbc630fa9c814f738195da23b972cc6), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tos404", "TOS 4.04" ) + ROMX_LOAD( "tos404.bin", 0x00000, 0x80000, BAD_DUMP CRC(028b561d) SHA1(27dcdb31b0951af99023b2fb8c370d8447ba6ebc), ROM_BIOS(3) ) +#endif + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + +//------------------------------------------------- +// ROM( falcon40 ) +//------------------------------------------------- + +ROM_START( falcon40 ) + ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "tos492", "TOS 4.92" ) + ROMX_LOAD( "tos492.bin", 0x00000, 0x7d314, BAD_DUMP CRC(bc8e497f) SHA1(747a38042844a6b632dcd9a76d8525fccb5eb892), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) + ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1985, st, 0, 0, st, st, driver_device, 0, "Atari", "ST (USA)", MACHINE_NOT_WORKING ) +COMP( 1985, st_uk, st, 0, st, st, driver_device, 0, "Atari", "ST (UK)", MACHINE_NOT_WORKING ) +COMP( 1985, st_de, st, 0, st, st, driver_device, 0, "Atari", "ST (Germany)", MACHINE_NOT_WORKING ) +COMP( 1985, st_es, st, 0, st, st, driver_device, 0, "Atari", "ST (Spain)", MACHINE_NOT_WORKING ) +COMP( 1985, st_fr, st, 0, st, st, driver_device, 0, "Atari", "ST (France)", MACHINE_NOT_WORKING ) +COMP( 1985, st_nl, st, 0, st, st, driver_device, 0, "Atari", "ST (Netherlands)", MACHINE_NOT_WORKING ) +COMP( 1985, st_se, st, 0, st, st, driver_device, 0, "Atari", "ST (Sweden)", MACHINE_NOT_WORKING ) +COMP( 1985, st_sg, st, 0, st, st, driver_device, 0, "Atari", "ST (Switzerland)", MACHINE_NOT_WORKING ) +COMP( 1987, megast, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (USA)", MACHINE_NOT_WORKING ) +COMP( 1987, megast_uk, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (UK)", MACHINE_NOT_WORKING ) +COMP( 1987, megast_de, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (Germany)", MACHINE_NOT_WORKING ) +COMP( 1987, megast_fr, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (France)", MACHINE_NOT_WORKING ) +COMP( 1987, megast_se, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (Sweden)", MACHINE_NOT_WORKING ) +COMP( 1987, megast_sg, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (Switzerland)",MACHINE_NOT_WORKING ) +COMP( 1989, ste, 0, 0, ste, ste, driver_device, 0, "Atari", "STE (USA)", MACHINE_NOT_WORKING ) +COMP( 1989, ste_uk, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (UK)", MACHINE_NOT_WORKING ) +COMP( 1989, ste_de, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Germany)", MACHINE_NOT_WORKING ) +COMP( 1989, ste_es, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Spain)", MACHINE_NOT_WORKING ) +COMP( 1989, ste_fr, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (France)", MACHINE_NOT_WORKING ) +COMP( 1989, ste_it, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Italy)", MACHINE_NOT_WORKING ) +COMP( 1989, ste_se, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Sweden)", MACHINE_NOT_WORKING ) +COMP( 1989, ste_sg, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Switzerland)", MACHINE_NOT_WORKING ) +//COMP( 1990, stbook, ste, 0, stbook, stbook, driver_device, 0, "Atari", "STBook", MACHINE_NOT_WORKING ) +COMP( 1990, tt030, 0, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (USA)", MACHINE_NOT_WORKING ) +COMP( 1990, tt030_uk, tt030, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (UK)", MACHINE_NOT_WORKING ) +COMP( 1990, tt030_de, tt030, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (Germany)", MACHINE_NOT_WORKING ) +COMP( 1990, tt030_fr, tt030, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (France)", MACHINE_NOT_WORKING ) +COMP( 1990, tt030_pl, tt030, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (Poland)", MACHINE_NOT_WORKING ) +COMP( 1991, megaste, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (USA)", MACHINE_NOT_WORKING ) +COMP( 1991, megaste_uk, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (UK)", MACHINE_NOT_WORKING ) +COMP( 1991, megaste_de, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (Germany)", MACHINE_NOT_WORKING ) +COMP( 1991, megaste_es, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (Spain)", MACHINE_NOT_WORKING ) +COMP( 1991, megaste_fr, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (France)", MACHINE_NOT_WORKING ) +COMP( 1991, megaste_it, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (Italy)", MACHINE_NOT_WORKING ) +COMP( 1991, megaste_se, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (Sweden)", MACHINE_NOT_WORKING ) +COMP( 1992, falcon30, 0, 0, falcon, falcon, driver_device, 0, "Atari", "Falcon030", MACHINE_NOT_WORKING ) +COMP( 1992, falcon40, falcon30, 0, falcon40, falcon, driver_device, 0, "Atari", "Falcon040 (prototype)",MACHINE_NOT_WORKING ) +//COMP( 1989, stacy, st, 0, stacy, stacy, driver_device, 0, "Atari", "Stacy", MACHINE_NOT_WORKING ) +//COMP( 1991, stpad, ste, 0, stpad, stpad, driver_device, 0, "Atari", "STPad (prototype)", MACHINE_NOT_WORKING ) +//COMP( 1992, fx1, 0, 0, falcon, falcon, driver_device, 0, "Atari", "FX-1 (prototype)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/atm.c b/src/mame/drivers/atm.c new file mode 100644 index 00000000000..300f503d90e --- /dev/null +++ b/src/mame/drivers/atm.c @@ -0,0 +1,248 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/******************************************************************************************* + +MicroART ATM (clone of Spectrum) + +Not working because of banking issues. + +The direct_update_handler needs rewriting, because removing it allows the +computer to boot up (with keyboard problems). + +*******************************************************************************************/ + +#include "emu.h" +#include "includes/spectrum.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/ay8910.h" +#include "sound/speaker.h" +#include "machine/beta.h" +#include "machine/ram.h" + + +class atm_state : public spectrum_state +{ +public: + atm_state(const machine_config &mconfig, device_type type, const char *tag) + : spectrum_state(mconfig, type, tag) + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_bank4(*this, "bank4") + , m_beta(*this, BETA_DISK_TAG) + { } + + DECLARE_WRITE8_MEMBER(atm_port_7ffd_w); + DIRECT_UPDATE_MEMBER(atm_direct); + DECLARE_MACHINE_RESET(atm); + +protected: + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_device m_beta; + +private: + UINT8 *m_p_ram; + void atm_update_memory(); +}; + + +DIRECT_UPDATE_MEMBER(atm_state::atm_direct) +{ + UINT16 pc = m_maincpu->state_int(STATE_GENPCBASE); + + if (m_beta->started() && m_beta->is_active()) + { + if (pc >= 0x4000) + { + m_ROMSelection = BIT(m_port_7ffd_data, 4); + m_beta->disable(); + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); + } + } + else if (((pc & 0xff00) == 0x3d00) && (m_ROMSelection==1)) + { + m_ROMSelection = 3; + if (m_beta->started()) + m_beta->enable(); + + } + if(address<=0x3fff) + { + if (m_ROMSelection == 3) + { + direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x18000]); + m_bank1->set_base(&m_p_ram[0x18000]); + } + else + { + direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x10000 + (m_ROMSelection<<14)]); + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); + } + return ~0; + } + return address; +} + +void atm_state::atm_update_memory() +{ + UINT8 *messram = m_ram->pointer(); + + m_screen_location = messram + ((m_port_7ffd_data & 8) ? (7<<14) : (5<<14)); + + m_bank4->set_base(messram + ((m_port_7ffd_data & 0x07) * 0x4000)); + + if (m_beta->started() && m_beta->is_active() && !( m_port_7ffd_data & 0x10 ) ) + m_ROMSelection = 3; + else + /* ROM switching */ + m_ROMSelection = BIT(m_port_7ffd_data, 4) ; + + /* rom 0 is 128K rom, rom 1 is 48 BASIC */ + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); +} + +WRITE8_MEMBER(atm_state::atm_port_7ffd_w) +{ + /* disable paging */ + if (m_port_7ffd_data & 0x20) + return; + + /* store new state */ + m_port_7ffd_data = data; + + /* update memory */ + atm_update_memory(); +} + +static ADDRESS_MAP_START (atm_io, AS_IO, 8, atm_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, status_r, command_w) AM_MIRROR(0xff00) + AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, track_r, track_w) AM_MIRROR(0xff00) + AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, sector_r, sector_w) AM_MIRROR(0xff00) + AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, data_r, data_w) AM_MIRROR(0xff00) + AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) + AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, state_r, param_w) AM_MIRROR(0xff00) + AM_RANGE(0x4000, 0x4000) AM_WRITE(atm_port_7ffd_w) AM_MIRROR(0x3ffd) + AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3ffd) + AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd) +ADDRESS_MAP_END + +MACHINE_RESET_MEMBER(atm_state,atm) +{ + UINT8 *messram = m_ram->pointer(); + address_space &space = m_maincpu->space(AS_PROGRAM); + m_p_ram = memregion("maincpu")->base(); + + space.install_read_bank(0x0000, 0x3fff, "bank1"); + space.unmap_write(0x0000, 0x3fff); + + if (m_beta->started()) + { + m_beta->enable(); + } + space.set_direct_update_handler(direct_update_delegate(FUNC(atm_state::atm_direct), this)); + + memset(messram,0,128*1024); + + /* Bank 5 is always in 0x4000 - 0x7fff */ + m_bank2->set_base(messram + (5<<14)); + + /* Bank 2 is always in 0x8000 - 0xbfff */ + m_bank3->set_base(messram + (2<<14)); + + m_port_7ffd_data = 0; + m_port_1ffd_data = -1; + + atm_update_memory(); +} + +/* F4 Character Displayer */ +static const gfx_layout spectrum_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 96, /* 96 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( atm ) + GFXDECODE_ENTRY( "maincpu", 0x1fd00, spectrum_charlayout, 0, 8 ) +GFXDECODE_END + +static GFXDECODE_START( atmtb2 ) + GFXDECODE_ENTRY( "maincpu", 0x13d00, spectrum_charlayout, 0, 8 ) +GFXDECODE_END + + +static MACHINE_CONFIG_DERIVED_CLASS( atm, spectrum_128, atm_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(atm_io) + MCFG_MACHINE_RESET_OVERRIDE(atm_state, atm ) + + MCFG_BETA_DISK_ADD(BETA_DISK_TAG) + + MCFG_GFXDECODE_MODIFY("gfxdecode", atm) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( atmtb2, atm ) + MCFG_GFXDECODE_MODIFY("gfxdecode", atmtb2) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( atm ) + ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "v1", "v.1.03") + ROMX_LOAD( "atm103.rom", 0x010000, 0x10000, CRC(4912e249) SHA1(a4adff05bb215dd126c47201b36956115b8fed76), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "v.1.06 joined") + ROMX_LOAD( "atm106.rom", 0x010000, 0x10000, CRC(75350b37) SHA1(2afc9994f026645c74b6c4b35bcee2e0bc0d6edc), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v3", "v.1.06") + ROMX_LOAD( "atm106-1.rom", 0x010000, 0x4000, CRC(658c98f1) SHA1(1ec694795aa6cac10147e58f38a9db0bdf7ed89b), ROM_BIOS(3)) + ROMX_LOAD( "atm106-2.rom", 0x014000, 0x4000, CRC(8fe367f9) SHA1(56de8fd39061663b9c315b74fd3c31acddae279c), ROM_BIOS(3)) + ROMX_LOAD( "atm106-3.rom", 0x018000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(3)) + ROMX_LOAD( "atm106-4.rom", 0x01c000, 0x4000, CRC(f352f2ab) SHA1(6045500ab01be708cef62327e9821b4a358a4673), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v4", "v.1.03rs") + ROMX_LOAD( "atm103rs.rom", 0x010000, 0x10000, CRC(cdec1dfb) SHA1(08190807c6b110cb2e657d8e7d0ad18668915375), ROM_BIOS(4)) +ROM_END + +ROM_START( atmtb2 ) + ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "v1", "v.1.07.12 joined") + ROMX_LOAD( "atmtb2.rom", 0x010000, 0x10000,CRC(05218c26) SHA1(71ed9864e7aa85131de97cf1e53dc152e7c79488), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "v.1.07.12") + ROMX_LOAD( "atmtb2-1.rom", 0x010000, 0x4000, CRC(658c98f1) SHA1(1ec694795aa6cac10147e58f38a9db0bdf7ed89b), ROM_BIOS(2)) + ROMX_LOAD( "atmtb2-2.rom", 0x014000, 0x4000, CRC(bc3f6b2b) SHA1(afa9df63857141fef270e2c97e12d2edc60cf919), ROM_BIOS(2)) + ROMX_LOAD( "atmtb2-3.rom", 0x018000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(2)) + ROMX_LOAD( "atmtb2-4.rom", 0x01c000, 0x4000, CRC(5869d8c4) SHA1(c3e198138f528ac4a8dff3c76cd289fd4713abff), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v3", "v.1.07.13") + ROMX_LOAD( "atmtb213.rom", 0x010000, 0x10000, CRC(34a91d53) SHA1(8f0af0f3c0ff1644535f20545c73d01576d6e52f), ROM_BIOS(3)) + + ROM_REGION(0x01000, "keyboard", ROMREGION_ERASEFF) + // XT Keyboard + ROM_LOAD( "rf2ve3.rom", 0x0000, 0x0580, CRC(35e0f9ec) SHA1(adcf14758fab8472cfa0167af7e8326c66416416)) + // AT Keyboard + ROM_LOAD( "rfat710.rom", 0x0600, 0x0680, CRC(03734365) SHA1(6cb6311727fad9bc4ccb18919c3c39b37529b8e6)) + ROM_REGION(0x08000, "charrom", ROMREGION_ERASEFF) + // Char gen rom + ROM_LOAD( "sgen.rom", 0x0000, 0x0800, CRC(1f4387d6) SHA1(93b3774dc8a486643a1bdd48c606b0c84fa0e22b)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP( 1991, atm, spec128, 0, atm, spec_plus, driver_device, 0, "MicroART", "ATM", MACHINE_NOT_WORKING) +//COMP( 1991, atmtb1, spec128, 0, atm, spec_plus, driver_device, 0, "MicroART", "ATM-turbo1", MACHINE_NOT_WORKING) +COMP( 1993, atmtb2, spec128, 0, atmtb2, spec_plus, driver_device, 0, "MicroART", "ATM-turbo2", MACHINE_NOT_WORKING) +//COMP( 1994, turbo2, spec128, 0, atm, spec_plus, driver_device, 0, "MicroART", "TURBO 2+", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/atom.c b/src/mame/drivers/atom.c new file mode 100644 index 00000000000..9403c7c62e5 --- /dev/null +++ b/src/mame/drivers/atom.c @@ -0,0 +1,893 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** +Acorn Atom: + +Memory map. + +CPU: 65C02 + 0000-00ff Zero page + 0100-01ff Stack + 0200-1fff RAM (expansion) + 0a00-0a04 FDC 8271 + 2000-21ff RAM (dos catalogue buffer) + 2200-27ff RAM (dos seq file buffer) + 2800-28ff RAM (float buffer) + 2900-7fff RAM (text RAM) + 8000-97ff VDG 6847 + 9800-9fff RAM (expansion) + a000-afff ROM (extension) + b000-b003 PPIA 8255 + b003-b7ff NOP + b800-bbff VIA 6522 + bc00-bfdf NOP + bfe0-bfe2 MOUSE - extension?? + bfe3-bfff NOP + c000-cfff ROM (basic) + d000-dfff ROM (float) + e000-efff ROM (dos) + f000-ffff ROM (kernel) + +Video: MC6847 + +Sound: Buzzer +Floppy: FDC8271 + +Hardware: PPIA 8255 + + output b000 0 - 3 keyboard row, 4 - 7 graphics mode + b002 0 cas output, 1 enable 2.4kHz, 2 buzzer, 3 colour set + + input b001 0 - 5 keyboard column, 6 CTRL key, 7 SHIFT key + b002 4 2.4kHz input, 5 cas input, 6 REPT key, 7 60 Hz input + + VIA 6522 + + + DOS: + + The original location of the 8271 memory mapped registers is 0xa00-0x0a04. + (This is the memory range assigned by Acorn in their design.) + + This is in the middle of the area for expansion RAM. Many Atom owners + thought this was a bad design and have modified their Atom's and dos rom + to use a different memory area. + + The atom driver in MESS uses the original memory area. + + + http://www.xs4all.nl/~fjkraan/comp/atom/index.html + + --- + + The Econet card for the ATOM is decoded on the ATOM PCB at memory address B400 (hex). The Econet Eurocard has decoding circuits on it which select memory address 1940 (hex). + There are then five significant addresses above these bases which contain the following registers: - + + ATOM card Eurocard + 6854 register 1 B400 1940 + 6854 register 2 B401 1941 + 6854 register 3 B402 1942 + 6854 Tx/Rx Data reg. B403 1943 + Station identification B404 1944 + + Station identification + + The identity number of each station is set up in hardware by links to IC 8. IC 8 is an octal buffer which when enabled feeds the cards station ID to the computer bus. + Each link codes a bit in an eight bit binary number allowing any station ID in the range 0 to 255 to be set up. if a link is left open then the bit is a one, when a + link is made the bit is a zero. Hence all links open corresponds to station ID 255, and all links made to station ID 0. Each station must have a unique identity and + some indentities are associated with specific functions on the network. Station ID zero is reserved for broadcast signals and should not be used. Station ID 255 is + reserved at present for the file server, and 235 for the printer server. Wire links must be soldered to each network station card during installation, a sugested + scheme for number allocation is to number normal user stations from one upwards and to number special stations and servers from 255 downwards. + + 2011 June 04 - Phill Harvey-Smith + Fixed "ERROR" repeating infinite loop, caused by random values in machine_start() being poked into the wrong memory reigion causing the basic ROM to become + corrupted. Values are now correctly placed in bytes 0x0008 - 0x000B of RAM. + + +***************************************************************************/ + +/* + + TODO: + + - connect to softwarelist + - e000 EPROM switching + - display should be monochrome -- Should be optional, Acorn produced a Colour Card, and there is + at least one aftermarket Colour card. + - ram expansion + - tap files + - mouse + - color card + - CP/M card + - speech synthesis card (SPO256 connected to VIA) + - econet + - teletext card + - Busicomputers Prophet 2 + * The Shift and Return keys are orange and the Return key is large, + * There is a MODE switch to the top right of the keyboard, + * There is a VIDEO port in addition to the TV output, + * An Acorn AtomCalc ROM PCB is installed (is this standard on the Prophet2 or an upgrade?), + * An Acorn 32K dynamic RAM card is installed, + * A 5v DC input is added in addition to the standard power in (but this may be a later upgrade), + * The Utility ROM is labelled P2/FP is installed + +*/ + +#include "includes/atom.h" +#include "formats/imageutl.h" + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +#define LOG 1 + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +/*------------------------------------------------- + QUICKLOAD_LOAD_MEMBER( atom_state, atom_atm ) +-------------------------------------------------*/ + +QUICKLOAD_LOAD_MEMBER( atom_state, atom_atm ) +{ + /* + + The format for the .ATM files is as follows: + + Offset Size Description + ------ -------- ----------------------------------------------------------- + 0000h 16 BYTEs ATOM filename (if less than 16 BYTEs, rest is 00h bytes) + 0010h WORD Start address for load + 0012h WORD Execution address + 0014h WORD Size of data in BYTEs + 0016h Size Data + + */ + + UINT8 header[0x16] = { 0 }; + void *ptr; + + image.fread(header, 0x16); + + UINT16 start_address = pick_integer_le(header, 0x10, 2); + UINT16 run_address = pick_integer_le(header, 0x12, 2); + UINT16 size = pick_integer_le(header, 0x14, 2); + + if (LOG) + { + header[16] = 0; + logerror("ATM filename: %s\n", header); + logerror("ATM start address: %04x\n", start_address); + logerror("ATM run address: %04x\n", run_address); + logerror("ATM size: %04x\n", size); + } + + ptr = m_maincpu->space(AS_PROGRAM).get_write_ptr(start_address); + image.fread(ptr, size); + + m_maincpu->set_pc(run_address); + + return IMAGE_INIT_PASS; +} + +/*************************************************************************** + READ/WRITE HANDLERS +***************************************************************************/ + +/*------------------------------------------------- + eprom_r - EPROM slot select read +-------------------------------------------------*/ + +READ8_MEMBER( atomeb_state::eprom_r ) +{ + return m_eprom; +} + +/*------------------------------------------------- + eprom_w - EPROM slot select write +-------------------------------------------------*/ + +WRITE8_MEMBER( atomeb_state::eprom_w ) +{ + /* + + bit description + + 0 block A bit 0 + 1 block A bit 1 + 2 block A bit 2 + 3 block A bit 3 + 4 + 5 + 6 + 7 block E + + */ + + /* block A and E */ + m_eprom = data; +} + +/*------------------------------------------------- + ext_r - read external roms at 0xa000 + -------------------------------------------------*/ + +READ8_MEMBER( atomeb_state::ext_r ) +{ + if (m_ext[m_eprom & 0x0f]->exists()) + return m_ext[m_eprom & 0x0f]->read_rom(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + dor_r - read DOS roms at 0xe000 + -------------------------------------------------*/ + +READ8_MEMBER( atomeb_state::dos_r ) +{ + if (m_e0->exists() && !BIT(m_eprom, 7)) + return m_e0->read_rom(space, offset); + else if (m_e1->exists() && BIT(m_eprom, 7)) + return m_e1->read_rom(space, offset); + else + return 0xff; +} + + +/*************************************************************************** + MEMORY MAPS +***************************************************************************/ + +/*------------------------------------------------- + ADDRESS_MAP( atom_mem ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( atom_mem, AS_PROGRAM, 8, atom_state ) + AM_RANGE(0x0000, 0x09ff) AM_RAM + AM_RANGE(0x0a00, 0x0a03) AM_MIRROR(0x1f8) AM_DEVICE(I8271_TAG, i8271_device, map) + AM_RANGE(0x0a04, 0x0a04) AM_MIRROR(0x1f8) AM_DEVREADWRITE(I8271_TAG, i8271_device, data_r, data_w) + AM_RANGE(0x0a05, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0x97ff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0x9800, 0x9fff) AM_RAM +// AM_RANGE(0xa000, 0xafff) // mapped by the cartslot + AM_RANGE(0xb000, 0xb003) AM_MIRROR(0x3fc) AM_DEVREADWRITE(INS8255_TAG, i8255_device, read, write) +// AM_RANGE(0xb400, 0xb403) AM_DEVREADWRITE(MC6854_TAG, mc6854_device, read, write) +// AM_RANGE(0xb404, 0xb404) AM_READ_PORT("ECONET") + AM_RANGE(0xb800, 0xb80f) AM_MIRROR(0x3f0) AM_DEVREADWRITE(R6522_TAG, via6522_device, read, write) + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(SY6502_TAG, 0) +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( atomeb_mem ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( atomeb_mem, AS_PROGRAM, 8, atomeb_state ) + AM_IMPORT_FROM(atom_mem) + AM_RANGE(0xa000, 0xafff) AM_READ(ext_r) + AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(eprom_r, eprom_w) + AM_RANGE(0xe000, 0xefff) AM_READ(dos_r) +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( atombb_mem ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( atombb_mem, AS_PROGRAM, 8, atom_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAM + AM_RANGE(0x4000, 0x57ff) AM_RAM AM_SHARE("video_ram") + + AM_RANGE(0x7000, 0x7003) AM_MIRROR(0x3fc) AM_DEVREADWRITE(INS8255_TAG, i8255_device, read, write) + AM_RANGE(0x7800, 0x780f) AM_MIRROR(0x3f0) AM_DEVREADWRITE(R6522_TAG, via6522_device, read, write) + AM_RANGE(0x8000, 0xbfff) AM_ROM AM_REGION("basic", 0) + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(SY6502_TAG, 0) +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/*------------------------------------------------- + INPUT_CHANGED_MEMBER( trigger_reset ) +-------------------------------------------------*/ + +INPUT_CHANGED_MEMBER( atom_state::trigger_reset ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +/*------------------------------------------------- + INPUT_PORTS( atom ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( atom ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\x95") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\x94") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('^') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COPY") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('[') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("RPT") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPT") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + + PORT_START("BRK") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHANGED_MEMBER(DEVICE_SELF, atom_state, trigger_reset, 0) + + PORT_START("ECONET") + // station ID (0-255) +INPUT_PORTS_END + +/*************************************************************************** + DEVICE CONFIGURATION +***************************************************************************/ + +/*------------------------------------------------- + I8255 interface +-------------------------------------------------*/ + +WRITE8_MEMBER( atom_state::ppi_pa_w ) +{ + /* + + bit description + + 0 keyboard column 0 + 1 keyboard column 1 + 2 keyboard column 2 + 3 keyboard column 3 + 4 MC6847 A/G + 5 MC6847 GM0 + 6 MC6847 GM1 + 7 MC6847 GM2 + + */ + + /* keyboard column */ + m_keylatch = data & 0x0f; + + /* MC6847 */ + m_vdg->ag_w(BIT(data, 4)); + m_vdg->gm0_w(BIT(data, 5)); + m_vdg->gm1_w(BIT(data, 6)); + m_vdg->gm2_w(BIT(data, 7)); +} + +READ8_MEMBER( atom_state::ppi_pb_r ) +{ + /* + + bit description + + 0 keyboard row 0 + 1 keyboard row 1 + 2 keyboard row 2 + 3 keyboard row 3 + 4 keyboard row 4 + 5 keyboard row 5 + 6 keyboard CTRL + 7 keyboard SFT + + */ + + UINT8 data = 0xff; + + switch (m_keylatch) + { + case 0: data &= m_y0->read(); break; + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 9: data &= m_y9->read(); break; + } + + data &= m_y10->read(); + + return data; +} + +READ8_MEMBER( atom_state::ppi_pc_r ) +{ + /* + + bit description + + 0 O/P 1, cassette output 0 + 1 O/P 2, cassette output 1 + 2 O/P 3, speaker output + 3 O/P 4, MC6847 CSS + 4 2400 Hz input + 5 cassette input + 6 keyboard RPT + 7 MC6847 FS + + */ + + UINT8 data = 0; + + /* 2400 Hz input */ + data |= m_hz2400 << 4; + + /* cassette input */ + data |= (m_cassette->input() > 0.0) << 5; + + /* keyboard RPT */ + data |= BIT(m_rpt->read(), 0) << 6; + + /* MC6847 FS */ + data |= (m_vdg->fs_r() ? 1 : 0) << 7; + + return data; +} + +WRITE8_MEMBER( atom_state::ppi_pc_w ) +{ + /* + + bit description + + 0 O/P 1, cassette output 0 + 1 O/P 2, cassette output 1 + 2 O/P 3, speaker output + 3 O/P 4, MC6847 CSS + 4 2400 Hz input + 5 cassette input + 6 keyboard RPT + 7 MC6847 FS + + */ + + /* cassette output */ + m_pc0 = BIT(data, 0); + m_pc1 = BIT(data, 1); + + /* speaker output */ + m_speaker->level_w(BIT(data, 2)); + + /* MC6847 CSS */ + m_vdg->css_w(BIT(data, 3)); +} + +/*------------------------------------------------- + i8271 interface +-------------------------------------------------*/ + +WRITE_LINE_MEMBER( atom_state::atom_8271_interrupt_callback ) +{ + /* I'm assuming that the nmi is edge triggered */ + /* a interrupt from the fdc will cause a change in line state, and + the nmi will be triggered, but when the state changes because the int + is cleared this will not cause another nmi */ + /* I'll emulate it like this to be sure */ + + if (state!=m_previous_i8271_int_state) + { + if (state) + { + /* I'll pulse it because if I used hold-line I'm not sure + it would clear - to be checked */ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } + } + + m_previous_i8271_int_state = state; +} + +WRITE_LINE_MEMBER( atom_state::motor_w ) +{ + m_fdc->subdevice("0")->get_device()->mon_w(!state); + m_fdc->subdevice("1")->get_device()->mon_w(!state); +} + +TIMER_DEVICE_CALLBACK_MEMBER(atom_state::cassette_output_tick) +{ + int level = !(!(!m_hz2400 && m_pc1) && m_pc0); + + m_cassette->output(level ? -1.0 : +1.0); + + m_hz2400 = !m_hz2400; +} + +/*------------------------------------------------- + mc6847 interface +-------------------------------------------------*/ + +READ8_MEMBER( atom_state::vdg_videoram_r ) +{ + if (offset == ~0) return 0xff; + + m_vdg->as_w(BIT(m_video_ram[offset], 6)); + m_vdg->intext_w(BIT(m_video_ram[offset], 6)); + m_vdg->inv_w(BIT(m_video_ram[offset], 7)); + + return m_video_ram[offset]; +} + +/*************************************************************************** + MACHINE INITIALIZATION +***************************************************************************/ + +/*------------------------------------------------- + MACHINE_START( atom ) +-------------------------------------------------*/ + +void atom_state::machine_start() +{ + /* this is temporary */ + /* Kees van Oss mentions that address 8-b are used for the random number + generator. I don't know if this is hardware, or random data because the + ram chips are not cleared at start-up. So at this time, these numbers + are poked into the memory to simulate it. When I have more details I will fix it */ + UINT8 *m_baseram = (UINT8 *)m_maincpu->space(AS_PROGRAM).get_write_ptr(0x0000); + + m_baseram[0x08] = machine().rand() & 0x0ff; + m_baseram[0x09] = machine().rand() & 0x0ff; + m_baseram[0x0a] = machine().rand() & 0x0ff; + m_baseram[0x0b] = machine().rand() & 0x0ff; + + if (m_cart && m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xafff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +/*------------------------------------------------- + MACHINE_START( atomeb ) +-------------------------------------------------*/ + +void atomeb_state::machine_start() +{ + atom_state::machine_start(); +} + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +int atom_state::load_cart(device_image_interface &image, generic_slot_device *slot) +{ + UINT32 size = slot->common_get_size("rom"); + + if (size > 0x1000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + slot->common_load_rom(slot->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +static SLOT_INTERFACE_START(atom_floppies) + SLOT_INTERFACE("525sssd", FLOPPY_525_SSSD) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER(atom_state::floppy_formats) + FLOPPY_ATOM_FORMAT +FLOPPY_FORMATS_END + +/*------------------------------------------------- + MACHINE_DRIVER( atom ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( atom, atom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(SY6502_TAG, M6502, X2/4) + MCFG_CPU_PROGRAM_MAP(atom_mem) + + /* video hardware */ + MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, MC6847_TAG) + + MCFG_DEVICE_ADD(MC6847_TAG, MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_INPUT_CALLBACK(READ8(atom_state, vdg_videoram_r)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("hz2400", atom_state, cassette_output_tick, attotime::from_hz(4806)) + + MCFG_DEVICE_ADD(R6522_TAG, VIA6522, X2/4) + MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(SY6502_TAG, m6502_device, irq_line)) + + MCFG_DEVICE_ADD(INS8255_TAG, I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(atom_state, ppi_pa_w)) + MCFG_I8255_IN_PORTB_CB(READ8(atom_state, ppi_pb_r)) + MCFG_I8255_IN_PORTC_CB(READ8(atom_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(atom_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(I8271_TAG, I8271 , 0) + MCFG_I8271_IRQ_CALLBACK(WRITELINE(atom_state, atom_8271_interrupt_callback)) + MCFG_I8271_HDL_CALLBACK(WRITELINE(atom_state, motor_w)) + MCFG_FLOPPY_DRIVE_ADD(I8271_TAG ":0", atom_floppies, "525sssd", atom_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(I8271_TAG ":1", atom_floppies, "525sssd", atom_state::floppy_formats) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_ca1)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_pa7)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(atom_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_QUICKLOAD_ADD("quickload", atom_state, atom_atm, "atm", 0) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "atom_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(atom_state, cart_load) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") + MCFG_RAM_EXTRA_OPTIONS("4K,6K,8K,10K,12K,32K") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","atom") +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_DRIVER( atomeb ) +-------------------------------------------------*/ + +#define MCFG_ATOM_ROM_ADD(_tag, _load) \ + MCFG_GENERIC_SOCKET_ADD(_tag, generic_linear_slot, "atom_cart") \ + MCFG_GENERIC_EXTENSIONS("bin,rom") \ + MCFG_GENERIC_LOAD(atomeb_state, _load) + +static MACHINE_CONFIG_DERIVED_CLASS( atomeb, atom, atomeb_state ) + MCFG_CPU_MODIFY(SY6502_TAG) + MCFG_CPU_PROGRAM_MAP(atomeb_mem) + + /* cartridges */ + MCFG_DEVICE_REMOVE("cartslot") + + MCFG_ATOM_ROM_ADD("rom_a0", a0_load) + MCFG_ATOM_ROM_ADD("rom_a1", a1_load) + MCFG_ATOM_ROM_ADD("rom_a2", a2_load) + MCFG_ATOM_ROM_ADD("rom_a3", a3_load) + MCFG_ATOM_ROM_ADD("rom_a4", a4_load) + MCFG_ATOM_ROM_ADD("rom_a5", a5_load) + MCFG_ATOM_ROM_ADD("rom_a6", a6_load) + MCFG_ATOM_ROM_ADD("rom_a7", a7_load) + MCFG_ATOM_ROM_ADD("rom_a8", a8_load) + MCFG_ATOM_ROM_ADD("rom_a9", a9_load) + MCFG_ATOM_ROM_ADD("rom_aa", aa_load) + MCFG_ATOM_ROM_ADD("rom_ab", ab_load) + MCFG_ATOM_ROM_ADD("rom_ac", ac_load) + MCFG_ATOM_ROM_ADD("rom_ad", ad_load) + MCFG_ATOM_ROM_ADD("rom_ae", ae_load) + MCFG_ATOM_ROM_ADD("rom_af", af_load) + + MCFG_ATOM_ROM_ADD("rom_e0", e0_load) + MCFG_ATOM_ROM_ADD("rom_e1", e1_load) +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_DRIVER( atombb ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( atombb, atom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(SY6502_TAG, M6502, X2/4) + MCFG_CPU_PROGRAM_MAP(atombb_mem) + + /* video hardware */ + MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, MC6847_TAG) + + MCFG_DEVICE_ADD(MC6847_TAG, MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_INPUT_CALLBACK(READ8(atom_state, vdg_videoram_r)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("hz2400", atom_state, cassette_output_tick, attotime::from_hz(4806)) + + MCFG_DEVICE_ADD(R6522_TAG, VIA6522, X2/4) + MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(SY6502_TAG, m6502_device, irq_line)) + + MCFG_DEVICE_ADD(INS8255_TAG, I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(atom_state, ppi_pa_w)) + MCFG_I8255_IN_PORTB_CB(READ8(atom_state, ppi_pb_r)) + MCFG_I8255_IN_PORTC_CB(READ8(atom_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(atom_state, ppi_pc_w)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_ca1)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_pa7)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(atom_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("8K,12K") + +MACHINE_CONFIG_END + +/*************************************************************************** + ROMS +***************************************************************************/ + +/*------------------------------------------------- + ROM( atom ) +-------------------------------------------------*/ + +ROM_START( atom ) + ROM_REGION( 0x4000, SY6502_TAG, 0 ) + ROM_LOAD( "abasic.ic20", 0x0000, 0x1000, CRC(289b7791) SHA1(0072c83458a9690a3ea1f6094f0f38cf8e96a445) ) + ROM_CONTINUE( 0x3000, 0x1000 ) + ROM_LOAD( "afloat.ic21", 0x1000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802) ) + ROM_LOAD( "dosrom.u15", 0x2000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c) ) +ROM_END + +/*------------------------------------------------- + ROM( atomeb ) +-------------------------------------------------*/ + +ROM_START( atomeb ) + ROM_REGION( 0x4000, SY6502_TAG, 0 ) + ROM_LOAD( "abasic.ic20", 0x0000, 0x1000, CRC(289b7791) SHA1(0072c83458a9690a3ea1f6094f0f38cf8e96a445) ) + ROM_CONTINUE( 0x3000, 0x1000 ) + ROM_LOAD( "afloat.ic21", 0x1000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802) ) + ROM_LOAD( "dosrom.u15", 0x2000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c) ) +ROM_END + +/*------------------------------------------------- + ROM( atombb ) +-------------------------------------------------*/ + +ROM_START( atombb ) + ROM_REGION( 0x1000, SY6502_TAG, 0 ) + ROM_LOAD( "mos.rom",0x0000, 0x1000, CRC(20158bd8) SHA1(5ee4c0d2b65be72646e17d69b76fb00a0e5298df) ) + ROM_REGION( 0x4000, "basic", 0) + ROM_LOAD( "bbcbasic.rom", 0x0000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281) ) +ROM_END + + +DRIVER_INIT_MEMBER(atomeb_state, atomeb) +{ + // these have to be set here, so that we can pass m_ext[*] to device_image_load! + char str[8]; + for (int i = 0; i < 16; i++) + { + sprintf(str,"rom_a%x", i); + m_ext[i] = machine().device(str); + } +} + + +/*************************************************************************** + SYSTEM DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1979, atom, 0, 0, atom, atom, driver_device, 0, "Acorn", "Atom" , 0) +COMP( 1979, atomeb, atom, 0, atomeb, atom, atomeb_state, atomeb, "Acorn", "Atom with Eprom Box" , 0) +COMP( 1979, atombb, atom, 0, atombb, atom, driver_device, 0, "Acorn", "Atom with BBC Basic" , 0) +//COMP( 1983, prophet2, atom, 0, atom, atom, driver_device, 0, "Busicomputers", "Prophet 2" , 0) diff --git a/src/mame/drivers/attache.c b/src/mame/drivers/attache.c new file mode 100644 index 00000000000..223a60d82f1 --- /dev/null +++ b/src/mame/drivers/attache.c @@ -0,0 +1,1010 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + * attache.c + * + * Created on: 17/05/2013 + * + * Driver by Barry Rodewald + * + * + * Otrona Attache + * + * CPU: Zilog Z80-A, 4MHz + * RAM: 64kB + * DMA: AMD 9517A (or compatible) + * RTC: Oki MSM5832, Z80-PIO + * Sound: GI AY-3-8912 + * FDC: NEC D765A, 5.25" floppies + * Video: CRT5027, 320x240 + * Serial: Z80-SIO + * + * Note: + * In terminal mode (when disk booting fails or no disk is inserted), press Ctrl+Linefeed (ctrl+pgdn by default) + * to enter monitor mode. From here you can run a bunch of diagnostic tests. + * + * G - Display Test Pattern + * H - Display RAM Test + * nnI - Input Test (nn = port number) + * J - Jump + * K - Keyboard Test + * L - Loop Tests + * M - Map Test + * nnmmO - Output Test (nn = port number, mm = data to send) + * P - Format Diskette (P to format disk in Drive A, 1P for Drive B) + * Q - CMOS RAM Test + * nR - Main RAM Test (n = 16kB bank to test [0-3]) + * bbpcS - Select Output Ports (first b = printer baud rate, second b = comm baud rate, p = printer port, c = comm port) + * T - Real Time Clock Test + * U - United Tests + * cchsV - Read a sector from disk (cc = cylinder, h = head [bit 0=drive, bit 2=side], s = sector) + * cchsW - Write a sector from disk + * nnnnmmmmX - I/O port transmit (nnnn = number of bytes to transmit, mmmm = start of data to transmit) + * nnnnY - I/O port receive (nnnn = address of data loaded) + * Z - Auto Disk Test (1Z for drive B) + * + * + * TODO: + * - Keyboard repeat + * - Get at least some of the system tests to pass + * - and probably lots more I've forgotten, too. + * + */ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "sound/ay8910.h" +#include "machine/msm5832.h" +#include "machine/z80dart.h" +#include "machine/z80pio.h" +#include "machine/z80ctc.h" +#include "machine/am9517a.h" +#include "machine/upd765.h" +#include "video/tms9927.h" +#include "machine/ram.h" +#include "machine/nvram.h" + +class attache_state : public driver_device +{ +public: + attache_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this,"maincpu"), + m_rom(*this,"boot"), + m_ram(*this,RAM_TAG), + m_char_rom(*this,"video"), + m_rtc(*this,"rtc"), + m_psg(*this,"psg"), + m_fdc(*this,"fdc"), + m_sio(*this,"sio"), + m_pio(*this,"pio"), + m_ctc(*this,"ctc"), + m_crtc(*this,"crtc"), + m_dma(*this, "dma"), + m_palette(*this, "palette"), + m_floppy0(*this, "fdc:0:525dd"), + m_floppy1(*this, "fdc:1:525dd"), + m_kb_row0(*this, "row0"), + m_kb_row1(*this, "row1"), + m_kb_row2(*this, "row2"), + m_kb_row3(*this, "row3"), + m_kb_row4(*this, "row4"), + m_kb_row5(*this, "row5"), + m_kb_row6(*this, "row6"), + m_kb_row7(*this, "row7"), + m_kb_mod(*this, "modifiers"), + m_membank1(*this, "bank1"), + m_membank2(*this, "bank2"), + m_membank3(*this, "bank3"), + m_membank4(*this, "bank4"), + m_membank5(*this, "bank5"), + m_membank6(*this, "bank6"), + m_membank7(*this, "bank7"), + m_membank8(*this, "bank8"), + m_nvram(*this, "nvram"), + m_rom_active(true), + m_gfx_enabled(false), + m_kb_clock(true), + m_kb_empty(true) + { } + + // PIO port B operation select + enum + { + PIO_SEL_8910_ADDR = 0, + PIO_SEL_8910_DATA, + PIO_SEL_5832_READ, + PIO_SEL_5832_WRITE, + PIO_SEL_5101_WRITE, + PIO_SEL_5101_READ, + PIO_SEL_LATCH, + PIO_SEL_NOP + }; + + // Display controller operation select + enum + { + DISP_GFX_0 = 0, + DISP_GFX_1, + DISP_GFX_2, + DISP_GFX_3, + DISP_GFX_4, + DISP_CRTC, + DISP_ATTR, + DISP_CHAR + }; + + // overrides + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void vblank_int(screen_device &screen, bool state); + virtual void driver_start(); + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER(rom_r); + DECLARE_WRITE8_MEMBER(rom_w); + DECLARE_READ8_MEMBER(pio_portA_r); + DECLARE_READ8_MEMBER(pio_portB_r); + DECLARE_WRITE8_MEMBER(pio_portA_w); + DECLARE_WRITE8_MEMBER(pio_portB_w); + DECLARE_WRITE8_MEMBER(display_command_w); + DECLARE_READ8_MEMBER(display_data_r); + DECLARE_WRITE8_MEMBER(display_data_w); + DECLARE_READ8_MEMBER(dma_mask_r); + DECLARE_WRITE8_MEMBER(dma_mask_w); + DECLARE_READ8_MEMBER(fdc_dma_r); + DECLARE_WRITE8_MEMBER(fdc_dma_w); + DECLARE_READ8_MEMBER(memmap_r); + DECLARE_WRITE8_MEMBER(memmap_w); + DECLARE_READ8_MEMBER(dma_mem_r); + DECLARE_WRITE8_MEMBER(dma_mem_w); + DECLARE_WRITE_LINE_MEMBER(hreq_w); + DECLARE_WRITE_LINE_MEMBER(eop_w); + DECLARE_WRITE_LINE_MEMBER(fdc_dack_w); + void operation_strobe(address_space& space,UINT8 data); + void keyboard_clock_w(bool state); + UINT8 keyboard_data_r(); + UINT16 get_key(); +private: + required_device m_maincpu; + required_memory_region m_rom; + required_device m_ram; + required_memory_region m_char_rom; + required_device m_rtc; + required_device m_psg; + required_device m_fdc; + required_device m_sio; + required_device m_pio; + required_device m_ctc; + required_device m_crtc; + required_device m_dma; + required_device m_palette; + required_device m_floppy0; + required_device m_floppy1; + required_ioport m_kb_row0; + required_ioport m_kb_row1; + required_ioport m_kb_row2; + required_ioport m_kb_row3; + required_ioport m_kb_row4; + required_ioport m_kb_row5; + required_ioport m_kb_row6; + required_ioport m_kb_row7; + required_ioport m_kb_mod; + required_memory_bank m_membank1; + required_memory_bank m_membank2; + required_memory_bank m_membank3; + required_memory_bank m_membank4; + required_memory_bank m_membank5; + required_memory_bank m_membank6; + required_memory_bank m_membank7; + required_memory_bank m_membank8; + required_device m_nvram; + + bool m_rom_active; + bool m_gfx_enabled; + UINT8 m_pio_porta; + UINT8 m_pio_portb; + UINT8 m_pio_select; + UINT8 m_pio_latch; + UINT8 m_crtc_reg_select; + UINT8 m_current_cmd; + UINT8 m_char_ram[128*32]; + UINT8 m_attr_ram[128*32]; + UINT8 m_gfx_ram[128*32*5]; + UINT8 m_char_line; + UINT8 m_attr_line; + UINT8 m_gfx_line; + UINT8 m_cmos_ram[64]; + UINT8 m_cmos_select; + UINT16 m_kb_current_key; + bool m_kb_clock; + bool m_kb_empty; + UINT8 m_kb_bitpos; + UINT8 m_memmap; +}; + +// Attributes (based on schematics): +// bit 0 = ALT +// bit 1 = RW +// bit 2 = BKG (reverse?) +// bit 3 = brightness +// bit 4 = double-size (width) +// bit 5 = underline +// bit 6 = superscript +// bit 7 = subscript (superscript and subscript combined produces strikethrough) +UINT32 attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT8 x,y,bit,scan,data; + UINT8 dbl_mode = 0; // detemines which half of character to display when using double size attribute, + // as it can start on either odd or even character cells. + + // Graphics output (if enabled) + if(m_gfx_enabled) + { + const pen_t *pen = m_palette->pens(); + + for(y=0;y<(bitmap.height()-1)/10;y++) + { + for(x=0;x<(bitmap.width()-1)/8;x++) + { + // graphics pixels use half the clock of text, so 4 graphics pixels per character + for(scan=0;scan<10;scan+=2) + { + data = m_gfx_ram[(128*32*(scan/2))+(y*128+x)]; + bitmap.pix32(y*10+scan,x*8) = pen[BIT(data,7)]; + bitmap.pix32(y*10+scan,x*8+1) = pen[BIT(data,7)]; + bitmap.pix32(y*10+scan,x*8+2) = pen[BIT(data,6)]; + bitmap.pix32(y*10+scan,x*8+3) = pen[BIT(data,6)]; + bitmap.pix32(y*10+scan,x*8+4) = pen[BIT(data,5)]; + bitmap.pix32(y*10+scan,x*8+5) = pen[BIT(data,5)]; + bitmap.pix32(y*10+scan,x*8+6) = pen[BIT(data,4)]; + bitmap.pix32(y*10+scan,x*8+7) = pen[BIT(data,4)]; + bitmap.pix32(y*10+scan+1,x*8) = pen[BIT(data,3)]; + bitmap.pix32(y*10+scan+1,x*8+1) = pen[BIT(data,3)]; + bitmap.pix32(y*10+scan+1,x*8+2) = pen[BIT(data,2)]; + bitmap.pix32(y*10+scan+1,x*8+3) = pen[BIT(data,2)]; + bitmap.pix32(y*10+scan+1,x*8+4) = pen[BIT(data,1)]; + bitmap.pix32(y*10+scan+1,x*8+5) = pen[BIT(data,1)]; + bitmap.pix32(y*10+scan+1,x*8+6) = pen[BIT(data,0)]; + bitmap.pix32(y*10+scan+1,x*8+7) = pen[BIT(data,0)]; + } + } + } + } + else + bitmap.fill(0); + + // Text output + for(y=0;y<(bitmap.height()-1)/10;y++) // lines + { + for(x=0;x<(bitmap.width()-1)/8;x++) // columns + { + assert(((y*128)+x) >= 0 && ((y*128)+x) < ARRAY_LENGTH(m_char_ram)); + UINT8 ch = m_char_ram[(y*128)+x]; + pen_t fg = m_palette->pen(m_attr_ram[(y*128)+x] & 0x08 ? 2 : 1); // brightness + if(m_attr_ram[(y*128)+x] & 0x10) // double-size + dbl_mode++; + else + dbl_mode = 0; + + for(scan=0;scan<10;scan++) // 10 scanlines per line + { + data = m_char_rom->base()[ch*16+scan]; + if((m_attr_ram[(y*128)+x] & 0xc0) != 0xc0) // if not strikethrough + { + if(m_attr_ram[(y*128)+x] & 0x40) // superscript + { + if(scan >= 5) + data = 0; + else + data = m_char_rom->base()[ch*16+(scan*2)+1]; + } + if(m_attr_ram[(y*128)+x] & 0x80) // subscript + { + if(scan < 5) + data = 0; + else + data = m_char_rom->base()[ch*16+((scan-5)*2)+1]; + } + } + if((m_attr_ram[(y*128)+x] & 0x20) && scan == 9) // underline + data = 0xff; + if((m_attr_ram[(y*128)+x] & 0xc0) == 0xc0 && scan == 3) // strikethrough + data = 0xff; + if(m_attr_ram[(y*128)+x] & 0x04) // reverse + data = ~data; + if(m_attr_ram[(y*128)+x] & 0x10) // double-size + { + UINT8 newdata = 0; + if(dbl_mode & 1) + { + newdata = (data & 0x80) | ((data & 0x80) >> 1) + | ((data & 0x40) >> 1) | ((data & 0x40) >> 2) + | ((data & 0x20) >> 2) | ((data & 0x20) >> 3) + | ((data & 0x10) >> 3) | ((data & 0x10) >> 4); + } + else + { + newdata = ((data & 0x08) << 4) | ((data & 0x08) << 3) + | ((data & 0x04) << 3) | ((data & 0x04) << 2) + | ((data & 0x02) << 2) | ((data & 0x02) << 1) + | ((data & 0x01) << 1) | (data & 0x01); + } + data = newdata; + } + + for(bit=0;bit<8;bit++) // 8 pixels per character + { + UINT16 xpos = x*8+bit; + UINT16 ypos = y*10+scan; + + if(BIT(data,7-bit)) + bitmap.pix32(ypos,xpos) = fg; + } + } + } + } + return 0; +} + +void attache_state::vblank_int(screen_device &screen, bool state) +{ + m_ctc->trg2(state); +} + +READ8_MEMBER(attache_state::rom_r) +{ + if(m_rom_active) + return m_rom->base()[offset]; + else + return m_ram->pointer()[m_membank1->entry()*0x2000 + offset]; +} + +WRITE8_MEMBER(attache_state::rom_w) +{ + m_ram->pointer()[m_membank1->entry()*0x2000 + offset] = data; +} + +UINT16 attache_state::get_key() +{ + UINT8 row,bits,data; + ioport_port* keys[8] = { m_kb_row0, m_kb_row1, m_kb_row2, m_kb_row3, m_kb_row4, m_kb_row5, m_kb_row6, m_kb_row7 }; + UINT8 res = 0; + + // scan input ports + for(row=0;row<8;row++) + { + data = keys[row]->read(); + for(bits=0;bits<8;bits++) + { + if(BIT(data,bits)) + { + res = bits & 0x07; + res |= ((row & 0x07) << 3); + m_kb_empty = false; + data = m_kb_mod->read(); + if(~data & 0x01) + res |= 0x80; // shift + if(data & 0x02) + res |= 0x40; // ctrl + //logerror("KB: hit row %i, bit %i\n",row,bits); + return res; + } + } + } + // no key pressed + m_kb_empty = true; + return res; +} + +UINT8 attache_state::keyboard_data_r() +{ + UINT16 key; + if(m_kb_bitpos == 1) // start bit, if data is available + { + key = get_key(); + if(m_kb_current_key != key) + m_kb_current_key = key; + else + return 0x00; + //logerror("KB: bit position %i, key %02x, empty %i\n",m_kb_bitpos,m_kb_current_key,m_kb_empty); + if(m_kb_empty) + return 0x00; + else + return 0x40; + } + else + { + //logerror("KB: bit position %i, key %02x, empty %i\n",m_kb_bitpos,m_kb_current_key,m_kb_empty); + if(m_kb_current_key & (1<<(m_kb_bitpos-2))) + return 0x00; + else + return 0x40; + } +} + +void attache_state::keyboard_clock_w(bool state) +{ + if(!state && m_kb_clock) // high to low transition - advance bit position + { + m_kb_bitpos++; + if(m_kb_bitpos > 9) + m_kb_bitpos = 1; + } + m_kb_clock = state; +} + +// TODO: Figure out exactly how the HLD, RD, WR and CS lines on the RTC are hooked up +READ8_MEMBER(attache_state::pio_portA_r) +{ + UINT8 ret = 0xff; + UINT8 porta = m_pio_porta; + + switch(m_pio_select) + { + case PIO_SEL_8910_DATA: + ret = m_psg->data_r(space,0); + logerror("PSG: data read %02x\n",ret); + break; + case PIO_SEL_5832_WRITE: + m_rtc->cs_w(1); + m_rtc->write_w(0); + m_rtc->read_w(1); + m_rtc->address_w((porta & 0xf0) >> 4); + ret = m_rtc->data_r(space,0); + logerror("RTC: read %02x from %02x (write)\n",ret,(porta & 0xf0) >> 4); + break; + case PIO_SEL_5832_READ: + m_rtc->cs_w(1); + m_rtc->write_w(0); + m_rtc->read_w(1); + m_rtc->address_w((porta & 0xf0) >> 4); + ret = m_rtc->data_r(space,0); + logerror("RTC: read %02x from %02x\n",ret,(porta & 0xf0) >> 4); + break; + case PIO_SEL_5101_WRITE: + m_cmos_select = (m_cmos_select & 0xf0) | ((porta & 0xf0) >> 4); + ret = m_cmos_ram[m_cmos_select] & 0x0f; + logerror("CMOS: read %02x from byte %02x (write)\n",ret, m_cmos_select); + break; + case PIO_SEL_5101_READ: + m_cmos_select = (m_cmos_select & 0xf0) | ((porta & 0xf0) >> 4); + ret = m_cmos_ram[m_cmos_select] & 0x0f; + logerror("CMOS: read %02x from byte %02x\n",ret, m_cmos_select); + break; + case PIO_SEL_LATCH: + ret = 0x00; // Write-only? + break; + case PIO_SEL_NOP: + logerror("PIO: NOP read\n"); + break; + } + //logerror("PIO: Port A read operation %i returning %02x\n",m_pio_select,ret); + + return ret; +} + +READ8_MEMBER(attache_state::pio_portB_r) +{ + UINT8 ret = m_pio_portb & 0xbf; + ret |= keyboard_data_r(); + return ret; +} + +void attache_state::operation_strobe(address_space& space, UINT8 data) +{ + //logerror("PIO: Port A write operation %i, data %02x\n",m_pio_select,data); + switch(m_pio_select) + { + case PIO_SEL_8910_ADDR: + m_psg->address_w(space,0,data); + break; + case PIO_SEL_8910_DATA: + m_psg->data_w(space,0,data); + break; + case PIO_SEL_5832_WRITE: + m_rtc->cs_w(1); + m_rtc->write_w(1); + m_rtc->read_w(0); + m_rtc->address_w((data & 0xf0) >> 4); + m_rtc->data_w(space,0,data & 0x0f); + logerror("RTC: write %01x to %01x\n",data & 0x0f,(data & 0xf0) >> 4); + break; + case PIO_SEL_5832_READ: + m_rtc->cs_w(1); + m_rtc->write_w(0); + m_rtc->read_w(0); + m_rtc->address_w((data & 0xf0) >> 4); + logerror("RTC: write %01x to %01x (read)\n",data & 0x0f,(data & 0xf0) >> 4); + break; + case PIO_SEL_5101_WRITE: + m_cmos_select = (m_cmos_select & 0xf0) | ((data & 0xf0) >> 4); + m_cmos_ram[m_cmos_select] = data & 0x0f; + logerror("CMOS: write %01x to byte %02x\n",data & 0x0f, m_cmos_select); + break; + case PIO_SEL_5101_READ: + m_cmos_select = (m_cmos_select & 0xf0) | ((data & 0xf0) >> 4); + logerror("CMOS: write %01x to byte %02x (read)\n",data & 0x0f, m_cmos_select); + break; + case PIO_SEL_LATCH: + m_pio_latch = data; + m_rom_active = ~data & 0x04; + m_floppy0->mon_w((data & 0x01) ? 0 : 1); + m_floppy1->mon_w((data & 0x01) ? 0 : 1); + m_gfx_enabled = data & 0x02; + // TODO: display brightness + break; + case PIO_SEL_NOP: + logerror("PIO: NOP write\n"); + break; + default: + logerror("PIO: Invalid write operation %i, data %02x\n",m_pio_select,data); + } +} + +WRITE8_MEMBER(attache_state::pio_portA_w) +{ + // AO-7 = LATCH DATA OUT: + // LO = MOTOR ON + // L1 = GRAPHICS ENABLE + // L2 = /EPROM ENABLE + // L3-7 = DISPLAY BRIGHTNESS + // AO-7 = 8910 DATA I/O: + // AO-3 = 5832 DO-3 I/O + // A4-7 = 5832 AO-3 OUT + // AO-3 = 5101 DO-3 I/O + // A4-7 = 5101 AO-3 OUT + m_pio_porta = data; +} + +WRITE8_MEMBER(attache_state::pio_portB_w) +{ + // BO-1 = 5101 A4-5 + // B2-4 = OPERATION SELECT + // 0 = 8910 ADDR LOAD + // 1 = 8910 DATA LOAD + // 2 = 5832 WRITE -- the CP/M BIOS dumped from an actual disc seems to switch the RTC operations around + // 3 = 5832 READ this differs from the BIOS source listings available for both CP/M 2.2.3 and 2.2.5 + // 4 = 5101 WRITE + // 5 = 5101 READ + // 6 = LATCH LOAD + // 7 = NO-OP + //B5 = /'138 OPERATION STROBE + //B6 = /KEYBOARD DATA IN + //B7 = /KEYBOARD CLOCK OUT + m_cmos_select = ((data & 0x03) << 4) | (m_cmos_select & 0x0f); + if(!(data & 0x20) && (m_pio_portb & 0x20)) + { + m_pio_select = (data & 0x1c) >> 2; + operation_strobe(space,m_pio_porta); + } + m_pio_portb = data; + keyboard_clock_w(data & 0x80); +} + +// Display uses A8-A15 placed on the bus by the OUT instruction as an extra parameter +READ8_MEMBER(attache_state::display_data_r) +{ + UINT8 ret = 0xff; + UINT8 param = (offset & 0xff00) >> 8; + + switch(m_current_cmd) + { + case DISP_GFX_0: + ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)]; + break; + case DISP_GFX_1: + ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32)]; + break; + case DISP_GFX_2: + ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*2)]; + break; + case DISP_GFX_3: + ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*3)]; + break; + case DISP_GFX_4: + ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*4)]; + break; + case DISP_CRTC: + ret = m_crtc->read(space, m_crtc_reg_select); + break; + case DISP_ATTR: + ret = m_attr_ram[(m_attr_line*128)+(param & 0x7f)]; + break; + case DISP_CHAR: + ret = m_char_ram[(m_char_line*128)+(param & 0x7f)]; + break; + default: + logerror("Unimplemented display operation %02x\n",m_current_cmd); + } + + return ret; +} + +WRITE8_MEMBER(attache_state::display_data_w) +{ + UINT8 param = (offset & 0xff00) >> 8; + switch(m_current_cmd) + { + case DISP_GFX_0: + m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)] = data; + break; + case DISP_GFX_1: + m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32)] = data; + break; + case DISP_GFX_2: + m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*2)] = data; + break; + case DISP_GFX_3: + m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*3)] = data; + break; + case DISP_GFX_4: + m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*4)] = data; + break; + case DISP_CRTC: + m_crtc->write(space, m_crtc_reg_select, data); + break; + case DISP_ATTR: + m_attr_ram[(m_attr_line*128)+(param & 0x7f)] = data; + break; + case DISP_CHAR: + m_char_ram[(m_char_line*128)+(param & 0x7f)] = data; + break; +// default: +// logerror("Unimplemented display operation %02x data %02x param %02x\n",m_current_cmd,data,param); + } +} + +WRITE8_MEMBER(attache_state::display_command_w) +{ + UINT8 cmd = (data & 0xe0) >> 5; + + m_current_cmd = cmd; + + switch(cmd) + { + case DISP_GFX_0: + case DISP_GFX_1: + case DISP_GFX_2: + case DISP_GFX_3: + case DISP_GFX_4: + m_gfx_line = data & 0x1f; + break; + case DISP_CRTC: + // CRT5027/TMS9927 registers + m_crtc_reg_select = data & 0x0f; + break; + case DISP_ATTR: + // Attribute RAM + m_attr_line = data & 0x1f; + break; + case DISP_CHAR: + // Character RAM + m_char_line = data & 0x1f; + break; + } +} + +READ8_MEMBER(attache_state::memmap_r) +{ + return m_memmap; +} + +WRITE8_MEMBER(attache_state::memmap_w) +{ + // TODO: figure this out properly + // Tech manual says that RAM is split into 8kB chunks. + // Would seem that bit 4 is always 0 and bit 3 is always 1? + UINT8 bank = (data & 0xe0) >> 5; + UINT8 loc = data & 0x07; + memory_bank* banknum[8] = { m_membank1, m_membank2, m_membank3, m_membank4, m_membank5, m_membank6, m_membank7, m_membank8 }; + m_memmap = data; + + banknum[bank]->set_entry(loc); + + logerror("MEM: write %02x - bank %i, location %i\n",data, bank, loc); +} + +READ8_MEMBER(attache_state::dma_mask_r) +{ + return m_dma->read(space,0x0f); +} + +WRITE8_MEMBER(attache_state::dma_mask_w) +{ + m_dma->write(space,0x0f,data); +} + +READ8_MEMBER(attache_state::fdc_dma_r) +{ + UINT8 ret = m_fdc->dma_r(); + return ret; +} + +WRITE8_MEMBER(attache_state::fdc_dma_w) +{ + m_fdc->dma_w(data); +} + +READ8_MEMBER(attache_state::dma_mem_r) +{ + return m_maincpu->space(AS_PROGRAM).read_byte(offset); +} + +WRITE8_MEMBER(attache_state::dma_mem_w) +{ + m_maincpu->space(AS_PROGRAM).write_byte(offset,data); +} + +WRITE_LINE_MEMBER( attache_state::hreq_w ) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + m_dma->hack_w(state); +} + +WRITE_LINE_MEMBER(attache_state::eop_w) +{ + m_fdc->tc_w(state); +} + +WRITE_LINE_MEMBER( attache_state::fdc_dack_w ) +{ +} + +static ADDRESS_MAP_START( attache_map , AS_PROGRAM, 8, attache_state) + AM_RANGE(0x0000,0x1fff) AM_RAMBANK("bank1") + AM_RANGE(0x2000,0x3fff) AM_RAMBANK("bank2") + AM_RANGE(0x4000,0x5fff) AM_RAMBANK("bank3") + AM_RANGE(0x6000,0x7fff) AM_RAMBANK("bank4") + AM_RANGE(0x8000,0x9fff) AM_RAMBANK("bank5") + AM_RANGE(0xa000,0xbfff) AM_RAMBANK("bank6") + AM_RANGE(0xc000,0xdfff) AM_RAMBANK("bank7") + AM_RANGE(0xe000,0xffff) AM_RAMBANK("bank8") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( attache_io , AS_IO, 8, attache_state) + AM_RANGE(0xe0, 0xed) AM_DEVREADWRITE("dma",am9517a_device,read,write) AM_MIRROR(0xff00) + AM_RANGE(0xee, 0xee) AM_WRITE(display_command_w) AM_MIRROR(0xff00) + AM_RANGE(0xef, 0xef) AM_READWRITE(dma_mask_r, dma_mask_w) AM_MIRROR(0xff00) + AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("sio",z80sio0_device,ba_cd_r, ba_cd_w) AM_MIRROR(0xff00) + AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("ctc",z80ctc_device,read,write) AM_MIRROR(0xff00) + AM_RANGE(0xf8, 0xfb) AM_DEVREADWRITE("pio",z80pio_device,read_alt,write_alt) AM_MIRROR(0xff00) + AM_RANGE(0xfc, 0xfd) AM_DEVICE("fdc",upd765a_device,map) AM_MIRROR(0xff00) + AM_RANGE(0xfe, 0xfe) AM_READWRITE(display_data_r, display_data_w) AM_MIRROR(0xff00) AM_MASK(0xffff) + AM_RANGE(0xff, 0xff) AM_READWRITE(memmap_r, memmap_w) AM_MIRROR(0xff00) +ADDRESS_MAP_END + +static INPUT_PORTS_START(attache) + PORT_START("row0") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x18,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_PGUP) + + PORT_START("row1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x06,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + + PORT_START("row2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 *") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("row3") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + + PORT_START("row4") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("row5") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("row6") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("row7") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + + PORT_START("modifiers") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) + +INPUT_PORTS_END + +// IRQ daisy chain = CTC -> SIO -> Expansion +static const z80_daisy_config attache_daisy_chain[] = +{ + { "ctc" }, + { "sio" }, + // expansion + { NULL } +}; + +static SLOT_INTERFACE_START( attache_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +void attache_state::driver_start() +{ + UINT8 *RAM = m_ram->pointer(); + + m_membank1->configure_entries(0, 8, &RAM[0x0000], 0x2000); + m_membank2->configure_entries(0, 8, &RAM[0x0000], 0x2000); + m_membank3->configure_entries(0, 8, &RAM[0x0000], 0x2000); + m_membank4->configure_entries(0, 8, &RAM[0x0000], 0x2000); + m_membank5->configure_entries(0, 8, &RAM[0x0000], 0x2000); + m_membank6->configure_entries(0, 8, &RAM[0x0000], 0x2000); + m_membank7->configure_entries(0, 8, &RAM[0x0000], 0x2000); + m_membank8->configure_entries(0, 8, &RAM[0x0000], 0x2000); + + m_membank1->set_entry(0); + m_membank2->set_entry(1); + m_membank3->set_entry(2); + m_membank4->set_entry(3); + m_membank5->set_entry(4); + m_membank6->set_entry(5); + m_membank7->set_entry(6); + m_membank8->set_entry(7); + + memset(RAM,0,65536); + + m_nvram->set_base(m_cmos_ram,64); + + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0000,0x0fff,read8_delegate(FUNC(attache_state::rom_r),this),write8_delegate(FUNC(attache_state::rom_w),this)); + + save_pointer(m_char_ram,"Character RAM",128*32); + save_pointer(m_attr_ram,"Attribute RAM",128*32); + save_pointer(m_gfx_ram,"Graphics RAM",128*32*5); + save_pointer(m_cmos_ram,"CMOS RAM",64); +} + +void attache_state::machine_start() +{ + // initialise RAM + memset(m_cmos_ram,0,64); + memset(m_attr_ram,0,128*32); + memset(m_char_ram,0,128*32); + memset(m_gfx_ram,0,128*32*5); +} + +void attache_state::machine_reset() +{ + m_kb_bitpos = 0; +} + +static MACHINE_CONFIG_START( attache, attache_state ) + MCFG_CPU_ADD("maincpu",Z80,XTAL_8MHz / 2) + MCFG_CPU_PROGRAM_MAP(attache_map) + MCFG_CPU_IO_MAP(attache_io) + MCFG_CPU_CONFIG(attache_daisy_chain) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(64)) /* not accurate */ + MCFG_SCREEN_SIZE(640,240) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 240-1) + MCFG_SCREEN_UPDATE_DRIVER(attache_state, screen_update) + MCFG_SCREEN_VBLANK_DRIVER(attache_state, vblank_int) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("psg", AY8912, XTAL_8MHz / 4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_MSM5832_ADD("rtc",XTAL_32_768kHz) + + MCFG_DEVICE_ADD("pio", Z80PIO, XTAL_8MHz/26) + MCFG_Z80PIO_IN_PA_CB(READ8(attache_state, pio_portA_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(attache_state, pio_portA_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(attache_state, pio_portB_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(attache_state, pio_portB_w)) + + MCFG_Z80SIO0_ADD("sio",XTAL_8MHz / 26, 0, 0, 0, 0) + + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_8MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("dma", AM9517A, XTAL_8MHz / 4) + MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(attache_state, hreq_w)) + MCFG_AM9517A_OUT_EOP_CB(WRITELINE(attache_state, eop_w)) + MCFG_AM9517A_IN_MEMR_CB(READ8(attache_state, dma_mem_r)) + MCFG_AM9517A_OUT_MEMW_CB(WRITE8(attache_state, dma_mem_w)) + MCFG_AM9517A_IN_IOR_0_CB(READ8(attache_state, fdc_dma_r)) + MCFG_AM9517A_OUT_IOW_0_CB(WRITE8(attache_state, fdc_dma_w)) + // MCFG_AM9517A_OUT_DACK_0_CB(WRITELINE(attache_state, fdc_dack_w)) + + MCFG_UPD765A_ADD("fdc", true, true) + MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("ctc", z80ctc_device, trg3)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma", am9517a_device, dreq0_w)) MCFG_DEVCB_INVERT + MCFG_FLOPPY_DRIVE_ADD("fdc:0", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD("crtc", TMS9927, 12324000) + MCFG_TMS9927_CHAR_WIDTH(8) + + MCFG_NVRAM_ADD_0FILL("nvram") + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64k") + + MCFG_SOFTWARE_LIST_ADD("disk_list","attache") +MACHINE_CONFIG_END + +ROM_START( attache ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_FILL(0x0000,0x10000,0x00) + + ROM_REGION(0x1000, "boot", 0) + ROM_SYSTEM_BIOS(0, "u252revg", "Boot Rev.G") + ROMX_LOAD("u252revg.bin", 0x0000, 0x1000, CRC(113136b7) SHA1(845afd9ed2fd2b28c39921d8f2ba99e5295e0330), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "u252revf", "Boot Rev.F") + ROMX_LOAD("u252revf.bin", 0x0000, 0x1000, CRC(b49eb3b2) SHA1(5b1b348301b2f76b1f250ba68bb8733fc15d18c2), ROM_BIOS(2)) + + ROM_REGION(0x1000, "video", 0) + ROM_LOAD("u416vid.bin", 0x0000, 0x1000, CRC(e376ec59) SHA1(7b9e9db575e77ce2f479eb9ae913528e4f0d125d) ) + + ROM_REGION(0x100, "attr", 0) + ROM_LOAD("u413.bin", 0x0000, 0x0100, CRC(5b60e622) SHA1(43450c747db1394466eabe5c26a61bf75a4f3b52) ) + + ROM_REGION(0x200, "iosel", 0) + ROM_LOAD("u110.bin", 0x0000, 0x0200, CRC(70dd255a) SHA1(36dcce07a2c14eefc069433459c422341bd47efb) ) + + ROM_REGION(0x100, "floppy", 0) + ROM_LOAD("u630.bin", 0x0000, 0x0100, CRC(f7a5c821) SHA1(fea07d9ac7e4e5f4f72aa7b2159deaedbd662ead) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT DEVICE INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, attache, 0, 0, attache, attache, driver_device, 0, "Otrona", "Attach\xC3\xA9", MACHINE_IMPERFECT_GRAPHICS|MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/aussiebyte.c b/src/mame/drivers/aussiebyte.c new file mode 100644 index 00000000000..4980be8204d --- /dev/null +++ b/src/mame/drivers/aussiebyte.c @@ -0,0 +1,574 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/************************************************************************************************* + + The Aussie Byte II Single-Board Computer, created by SME Systems, Melbourne, Australia. + Also known as the Knight 2000 Microcomputer. + + Status: + Boots up from floppy. + Output to serial terminal and to 6545 are working. Serial keyboard works. + + Developed in conjunction with members of the MSPP. Written in July, 2015. + + ToDo: + - CRT8002 attributes controller + - Graphics + - Hard drive controllers and drives + - Test Centronics printer + - PIO connections + - RTC not working + + Note of MAME restrictions: + - Votrax doesn't sound anything like the real thing + - WD1001/WD1002 device is not emulated + - CRT8002 device is not emulated + +**************************************************************************************************/ + +/*********************************************************** + + Includes + +************************************************************/ +#include "includes/aussiebyte.h" + + +/*********************************************************** + + Address Maps + +************************************************************/ + +static ADDRESS_MAP_START( aussiebyte_map, AS_PROGRAM, 8, aussiebyte_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank2") + AM_RANGE(0xc000, 0xffff) AM_RAM AM_REGION("mram", 0x0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( aussiebyte_io, AS_IO, 8, aussiebyte_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("sio1", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("pio1", z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_NOP // winchester interface + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", wd2797_t, read, write) + AM_RANGE(0x14, 0x14) AM_DEVREADWRITE("dma", z80dma_device, read, write) + AM_RANGE(0x15, 0x15) AM_WRITE(port15_w) // boot rom disable + AM_RANGE(0x16, 0x16) AM_WRITE(port16_w) // fdd select + AM_RANGE(0x17, 0x17) AM_WRITE(port17_w) // DMA mux + AM_RANGE(0x18, 0x18) AM_WRITE(port18_w) // fdc select + AM_RANGE(0x19, 0x19) AM_READ(port19_r) // info port + AM_RANGE(0x1a, 0x1a) AM_WRITE(port1a_w) // membank + AM_RANGE(0x1b, 0x1b) AM_WRITE(port1b_w) // winchester control + AM_RANGE(0x1c, 0x1f) AM_WRITE(port1c_w) // gpebh select + AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("pio2", z80pio_device, read, write) + AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("sio2", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x28, 0x28) AM_READ(port28_r) AM_DEVWRITE("votrax", votrax_sc01_device, write) + AM_RANGE(0x2c, 0x2c) AM_DEVWRITE("votrax", votrax_sc01_device, inflection_w) + AM_RANGE(0x30, 0x30) AM_WRITE(address_w) + AM_RANGE(0x31, 0x31) AM_DEVREAD("crtc", mc6845_device, status_r) + AM_RANGE(0x32, 0x32) AM_WRITE(register_w) + AM_RANGE(0x33, 0x33) AM_READ(port33_r) + AM_RANGE(0x34, 0x34) AM_WRITE(port34_w) // video control + AM_RANGE(0x35, 0x35) AM_WRITE(port35_w) // data to vram and aram + AM_RANGE(0x36, 0x36) AM_READ(port36_r) // data from vram and aram + AM_RANGE(0x37, 0x37) AM_READ(port37_r) // read dispen flag + AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("rtc", msm5832_device, data_r, data_w) +ADDRESS_MAP_END + +/*********************************************************** + + Keyboard + +************************************************************/ +static INPUT_PORTS_START( aussiebyte ) +INPUT_PORTS_END + +/*********************************************************** + + I/O Ports + +************************************************************/ +WRITE8_MEMBER( aussiebyte_state::port15_w ) +{ + membank("bankr0")->set_entry(m_port15); // point at ram + m_port15 = true; +} + +/* FDD select +0 Drive Select bit O +1 Drive Select bit 1 +2 Drive Select bit 2 +3 Drive Select bit 3 + - These bits connect to a 74LS145 binary to BCD converter. + - Drives 0 to 3 are 5.25 inch, 4 to 7 are 8 inch, 9 and 0 are not used. + - Currently we only support drive 0. +4 Side Select to Disk Drives. +5 Disable 5.25 inch floppy spindle motors. +6 Unused. +7 Enable write precompensation on WD2797 controller. */ +WRITE8_MEMBER( aussiebyte_state::port16_w ) +{ + floppy_image_device *m_floppy = NULL; + if ((data & 15) == 0) + m_floppy = m_floppy0->get_device(); + else + if ((data & 15) == 1) + m_floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + { + m_floppy->mon_w(BIT(data, 5)); + m_floppy->ss_w(BIT(data, 4)); + } +} + +/* DMA select +0 - FDC +1 - SIO Ch A +2 - SIO Ch B +3 - Winchester bus +4 - SIO Ch C +5 - SIO Ch D +6 - Ext ready 1 +7 - Ext ready 2 */ +WRITE8_MEMBER( aussiebyte_state::port17_w ) +{ + m_port17 = data & 7; + m_dma->rdy_w(BIT(m_port17_rdy, data)); +} + +/* FDC params +2 EXC: WD2797 clock frequency. H = 5.25"; L = 8" +3 WIEN: WD2797 Double density select. */ +WRITE8_MEMBER( aussiebyte_state::port18_w ) +{ + m_fdc->set_unscaled_clock(BIT(data, 2) ? 1e6 : 2e6); + m_fdc->dden_w(BIT(data, 3)); +} + +READ8_MEMBER( aussiebyte_state::port19_r ) +{ + return m_port19; +} + +// Memory banking +WRITE8_MEMBER( aussiebyte_state::port1a_w ) +{ + data &= 7; + switch (data) + { + case 0: + case 1: + case 2: + case 3: + case 4: + m_port1a = data*3+1; + if (m_port15) + membank("bankr0")->set_entry(data*3+1); + membank("bankw0")->set_entry(data*3+1); + membank("bank1")->set_entry(data*3+2); + membank("bank2")->set_entry(data*3+3); + break; + case 5: + m_port1a = 1; + if (m_port15) + membank("bankr0")->set_entry(1); + membank("bankw0")->set_entry(1); + membank("bank1")->set_entry(2); + membank("bank2")->set_entry(13); + break; + case 6: + m_port1a = 14; + if (m_port15) + membank("bankr0")->set_entry(14); + membank("bankw0")->set_entry(14); + membank("bank1")->set_entry(15); + //membank("bank2")->set_entry(0); // open bus + break; + case 7: + m_port1a = 1; + if (m_port15) + membank("bankr0")->set_entry(1); + membank("bankw0")->set_entry(1); + membank("bank1")->set_entry(4); + membank("bank2")->set_entry(13); + break; + } +} + +// Winchester control +WRITE8_MEMBER( aussiebyte_state::port1b_w ) +{ +} + +// GPEHB control +WRITE8_MEMBER( aussiebyte_state::port1c_w ) +{ +} + +WRITE8_MEMBER( aussiebyte_state::port20_w ) +{ + m_speaker->level_w(BIT(data, 7)); +} + +READ8_MEMBER( aussiebyte_state::port28_r ) +{ + return m_port28; +} + +/*********************************************************** + + DMA + +************************************************************/ +READ8_MEMBER( aussiebyte_state::memory_read_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER( aussiebyte_state::memory_write_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset, data); +} + +READ8_MEMBER( aussiebyte_state::io_read_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER( aussiebyte_state::io_write_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + prog_space.write_byte(offset, data); +} + +WRITE_LINE_MEMBER( aussiebyte_state::busreq_w ) +{ +// since our Z80 has no support for BUSACK, we assume it is granted immediately + m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); + m_dma->bai_w(state); // tell dma that bus has been granted +} + +/*********************************************************** + + DMA selector + +************************************************************/ +WRITE_LINE_MEMBER( aussiebyte_state::sio1_rdya_w ) +{ + m_port17_rdy = (m_port17_rdy & 0xfd) | (UINT8)(state << 1); + if (m_port17 == 1) + m_dma->rdy_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::sio1_rdyb_w ) +{ + m_port17_rdy = (m_port17_rdy & 0xfb) | (UINT8)(state << 2); + if (m_port17 == 2) + m_dma->rdy_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::sio2_rdya_w ) +{ + m_port17_rdy = (m_port17_rdy & 0xef) | (UINT8)(state << 4); + if (m_port17 == 4) + m_dma->rdy_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::sio2_rdyb_w ) +{ + m_port17_rdy = (m_port17_rdy & 0xdf) | (UINT8)(state << 5); + if (m_port17 == 5) + m_dma->rdy_w(state); +} + + +/*********************************************************** + + Video + +************************************************************/ + +/* F4 Character Displayer */ +static const gfx_layout crt8002_charlayout = +{ + 8, 12, /* 7 x 11 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( crt8002 ) + GFXDECODE_ENTRY( "chargen", 0x0000, crt8002_charlayout, 0, 1 ) +GFXDECODE_END + +/*************************************************************** + + Daisy Chain + +****************************************************************/ + +static const z80_daisy_config daisy_chain_intf[] = +{ + { "dma" }, + { "pio2" }, + { "sio1" }, + { "sio2" }, + { "pio1" }, + { "ctc" }, + { NULL } +}; + + +/*********************************************************** + + CTC + +************************************************************/ + +// baud rate generator. All inputs are 1.2288MHz. +TIMER_DEVICE_CALLBACK_MEMBER( aussiebyte_state::ctc_tick ) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); + m_ctc->trg1(1); + m_ctc->trg1(0); + m_ctc->trg2(1); + m_ctc->trg2(0); +} + +WRITE_LINE_MEMBER( aussiebyte_state::ctc_z0_w ) +{ + m_sio1->rxca_w(state); + m_sio1->txca_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::ctc_z1_w ) +{ + m_sio1->rxtxcb_w(state); + m_sio2->rxca_w(state); + m_sio2->txca_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::ctc_z2_w ) +{ + m_sio2->rxtxcb_w(state); + m_ctc->trg3(1); + m_ctc->trg3(0); +} + +/*********************************************************** + + Centronics ack + +************************************************************/ +WRITE_LINE_MEMBER( aussiebyte_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +/*********************************************************** + + Speech ack + +************************************************************/ +WRITE_LINE_MEMBER( aussiebyte_state::votrax_w ) +{ + m_port28 = state; +} + + +/*********************************************************** + + Floppy Disk + +************************************************************/ + +WRITE_LINE_MEMBER( aussiebyte_state::fdc_intrq_w ) +{ + UINT8 data = (m_port19 & 0xbf) | (state ? 0x40 : 0); + m_port19 = data; +} + +WRITE_LINE_MEMBER( aussiebyte_state::fdc_drq_w ) +{ + UINT8 data = (m_port19 & 0x7f) | (state ? 0x80 : 0); + m_port19 = data; + state ^= 1; // inverter on pin38 of fdc + m_port17_rdy = (m_port17_rdy & 0xfe) | (UINT8)state; + if (m_port17 == 0) + m_dma->rdy_w(state); +} + +static SLOT_INTERFACE_START( aussiebyte_floppies ) + SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) + SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +/*********************************************************** + + Machine Driver + +************************************************************/ +MACHINE_RESET_MEMBER( aussiebyte_state, aussiebyte ) +{ + m_port15 = false; + m_port17 = 0; + m_port17_rdy = 0; + m_port1a = 1; + m_alpha_address = 0; + m_graph_address = 0; + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("vram")->base(); + m_p_attribram = memregion("aram")->base(); + membank("bankr0")->set_entry(16); // point at rom + membank("bankw0")->set_entry(1); // always write to ram + membank("bank1")->set_entry(2); + membank("bank2")->set_entry(3); + m_maincpu->reset(); +} + +static MACHINE_CONFIG_START( aussiebyte, aussiebyte_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(aussiebyte_map) + MCFG_CPU_IO_MAP(aussiebyte_io) + MCFG_CPU_CONFIG(daisy_chain_intf) + + MCFG_MACHINE_RESET_OVERRIDE(aussiebyte_state, aussiebyte ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", crt8002) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720kHz? needs verify */ + MCFG_VOTRAX_SC01_REQUEST_CB(WRITELINE(aussiebyte_state, votrax_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(aussiebyte_state, write_centronics_busy)) + MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_16MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(aussiebyte_state, ctc_z0_w)) // SIO1 Ch A + MCFG_Z80CTC_ZC1_CB(WRITELINE(aussiebyte_state, ctc_z1_w)) // SIO1 Ch B, SIO2 Ch A + MCFG_Z80CTC_ZC2_CB(WRITELINE(aussiebyte_state, ctc_z2_w)) // SIO2 Ch B, CTC Ch 3 + + MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_16MHz / 4) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(aussiebyte_state, busreq_w)) + // BAO, not used + MCFG_Z80DMA_IN_MREQ_CB(READ8(aussiebyte_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(aussiebyte_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(aussiebyte_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(aussiebyte_state, io_write_byte)) + + MCFG_DEVICE_ADD("pio1", Z80PIO, XTAL_16MHz / 4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_IN_PB_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) + MCFG_Z80PIO_OUT_ARDY_CB(DEVWRITELINE("centronics", centronics_device, write_strobe)) MCFG_DEVCB_INVERT + + MCFG_DEVICE_ADD("pio2", Z80PIO, XTAL_16MHz / 4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(aussiebyte_state, port20_w)) + + MCFG_Z80SIO0_ADD("sio1", XTAL_16MHz / 4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(aussiebyte_state, sio1_rdya_w)) + MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(aussiebyte_state, sio1_rdyb_w)) + + MCFG_Z80SIO0_ADD("sio2", XTAL_16MHz / 4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(aussiebyte_state, sio2_rdya_w)) + MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(aussiebyte_state, sio2_rdyb_w)) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "keyboard") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sio2", z80sio0_device, rxa_w)) + + MCFG_WD2797_ADD("fdc", XTAL_16MHz / 16) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(aussiebyte_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(aussiebyte_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", aussiebyte_floppies, "drive0", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", aussiebyte_floppies, "drive1", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + /* devices */ + MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_16MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(aussiebyte_state, crtc_update_row) + MCFG_MC6845_ADDR_CHANGED_CB(aussiebyte_state, crtc_update_addr) + + MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", aussiebyte_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz / 4)) +MACHINE_CONFIG_END + + +DRIVER_INIT_MEMBER( aussiebyte_state, aussiebyte ) +{ + // Main ram is divided into 16k blocks (0-15). The boot rom is block number 16. + // For convenience, bank 0 is permanently assigned to C000-FFFF + UINT8 *main = memregion("roms")->base(); + UINT8 *ram = memregion("mram")->base(); + + membank("bankr0")->configure_entries(0, 16, &ram[0x0000], 0x4000); + membank("bankw0")->configure_entries(0, 16, &ram[0x0000], 0x4000); + membank("bank1")->configure_entries(0, 16, &ram[0x0000], 0x4000); + membank("bank2")->configure_entries(0, 16, &ram[0x0000], 0x4000); + membank("bankr0")->configure_entry(16, &main[0x0000]); +} + + +/*********************************************************** + + Game driver + +************************************************************/ + + +ROM_START(aussieby) + ROM_REGION(0x4000, "roms", 0) // Size of bank 16 + ROM_LOAD( "knight_boot_0000.u27", 0x0000, 0x1000, CRC(1f200437) SHA1(80d1d208088b325c16a6824e2da605fb2b00c2ce) ) + + ROM_REGION(0x800, "chargen", 0) + ROM_LOAD( "8002.bin", 0x0000, 0x0800, CRC(fdd6eb13) SHA1(a094d416e66bdab916e72238112a6265a75ca690) ) + + ROM_REGION(0x40000, "mram", ROMREGION_ERASE00) // main ram, 256k dynamic + ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) // video ram, 64k dynamic + ROM_REGION(0x00800, "aram", ROMREGION_ERASEFF) // attribute ram, 2k static +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, aussieby, 0, 0, aussiebyte, aussiebyte, aussiebyte_state, aussiebyte, "SME Systems", "Aussie Byte II" , MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/avigo.c b/src/mame/drivers/avigo.c new file mode 100644 index 00000000000..f9730f56c90 --- /dev/null +++ b/src/mame/drivers/avigo.c @@ -0,0 +1,1017 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/****************************************************************************** + + avigo.c + + TI "Avigo" PDA + + + system driver + + Documentation: + Hans B Pufal + Avigo simulator + + + MEMORY MAP: + 0x0000-0x03fff: flash 0 block 0 + 0x4000-0x07fff: bank 1 + 0x8000-0x0bfff: bank 2 + 0xc000-0x0ffff: ram block 0 + + Bankswitch: + Bank 1 is controlled by ports 5 and 6, port 5 is the bank select + and port 6 is the chip select, the known chip select are: + - 0: flash 0 + - 1: RAM + - 3: flash 1 + - 5: flash 2 (optional) + - 6: VideoRAM + - 7: flash 0 + + Bank 2 have the same behavior but is controlled by ports 7 and 8 + + Hardware: + - Z80 CPU + - 16c500c UART + - amd29f080 flash-file memory x 3 (3mb) + - 128k ram + - stylus pen + - touch-pad screen + + Flash: + The following flash ID are checked by Avigo OS, if the returned + ID is different the PDA doesn't boot. + + Maker ID Device ID Description + 0xb0 0x21 Sharp LH28F004 + 0x89 0xa6 Sharp LH28F008 + 0x89 0xaa Sharp LH28F016 + 0xb0 0x88 Sharp LH28F032 + 0x01 0xa4 AMD AM29F040 + 0x01 0xd5 AMD AM29F080 + 0x01 0xad AMD AM29F016 + + TODO: + - Found a better way to emulate the touchscreen panel out of the screen + area (the six buttons at the bottom) + - Alarm doesn't work + - Serial communications and IR port. + + I don't have any documentation on the hardware, so a lot of this + driver has been written using educated guesswork and a lot of help + from an existing emulation written by Hans Pufal. Hans's emulator + is also written from educated guesswork. + + MESS Driver by Kevin Thacker and Sandro Ronco + + ******************************************************************************/ + + +#include "includes/avigo.h" +#include "avigo.lh" + + +#define AVIGO_LOG 0 +#define LOG(x) do { if (AVIGO_LOG) logerror x; } while (0) + + +/* memory 0x0000-0x03fff */ +READ8_MEMBER(avigo_state::flash_0x0000_read_handler) +{ + return m_flashes[0]->read(offset); +} + +/* memory 0x0000-0x03fff */ +WRITE8_MEMBER(avigo_state::flash_0x0000_write_handler) +{ + m_flashes[0]->write(offset, data); +} + +/* memory 0x04000-0x07fff */ +READ8_MEMBER(avigo_state::flash_0x4000_read_handler) +{ + return m_flashes[m_flash_at_0x4000]->read((m_bank1_l<<14) | offset); +} + +/* memory 0x04000-0x07fff */ +WRITE8_MEMBER(avigo_state::flash_0x4000_write_handler) +{ + m_flashes[m_flash_at_0x4000]->write((m_bank1_l<<14) | offset, data); +} + +/* memory 0x08000-0x0bfff */ +READ8_MEMBER(avigo_state::flash_0x8000_read_handler) +{ + return m_flashes[m_flash_at_0x8000]->read((m_bank2_l<<14) | offset); +} + +/* memory 0x08000-0x0bfff */ +WRITE8_MEMBER(avigo_state::flash_0x8000_write_handler) +{ + m_flashes[m_flash_at_0x8000]->write((m_bank2_l<<14) | offset, data); +} + + +/* + IRQ bits (port 3) ordered by priority: + + bit 7: power down request high priority. When it occurs, clear this bit. + bit 5: real time clock + bit 3: uart int + bit 6: pen int An interrupt when pen is pressed against screen. + bit 4: 1 sec int used for auto power off + bit 2: synchronisation link interrupt???keyboard int ;; check bit 5 of port 1, + bit 1: ??? (cleared in nmi, and then set again) + bit 0: not checked, probably unused +*/ + +void avigo_state::refresh_ints() +{ + if (m_irq!=0) + m_maincpu->set_input_line(0, HOLD_LINE); + else + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +/* does not do anything yet */ +WRITE_LINE_MEMBER( avigo_state::tc8521_alarm_int ) +{ +//#if 0 + m_irq &=~(1<<5); + + if (state) + { + m_irq |= (1<<5); + } + + refresh_ints(); +//#endif +} + +void avigo_state::refresh_memory(UINT8 bank, UINT8 chip_select) +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + int &active_flash = (bank == 1 ? m_flash_at_0x4000 : m_flash_at_0x8000); + char bank_tag[6]; + + LOG(("Chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff)); + + switch (chip_select) + { + case 0x06: // videoram + space.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, read8_delegate(FUNC(avigo_state::vid_memory_r), this), write8_delegate(FUNC(avigo_state::vid_memory_w), this)); + active_flash = -1; + break; + + case 0x01: // banked RAM + sprintf(bank_tag,"bank%d", bank); + membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1_l : m_bank2_l) & 0x07)<<14)); + space.install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag); + active_flash = -1; + break; + + case 0x00: // flash 0 + case 0x03: // flash 1 + case 0x05: // flash 2 + case 0x07: // flash 0 + if (active_flash < 0) // to avoid useless calls to install_readwrite_handler that cause slowdowns + { + if (bank == 1) + space.install_readwrite_handler(0x4000, 0x7fff, read8_delegate(FUNC(avigo_state::flash_0x4000_read_handler), this), write8_delegate(FUNC(avigo_state::flash_0x4000_write_handler), this)); + else + space.install_readwrite_handler(0x8000, 0xbfff, read8_delegate(FUNC(avigo_state::flash_0x8000_read_handler), this), write8_delegate(FUNC(avigo_state::flash_0x8000_write_handler), this)); + } + + switch (chip_select) + { + case 0x00: + case 0x07: active_flash = 0; break; + case 0x03: active_flash = 1; break; + case 0x05: active_flash = 2; break; + } + break; + + default: + logerror("Unknown chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff); + space.unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff); + active_flash = -1; + break; + } +} + + +WRITE_LINE_MEMBER( avigo_state::com_interrupt ) +{ + LOG(("com int\r\n")); + + m_irq &= ~(1<<3); + + if (state) + { + m_irq |= (1<<3); + } + + refresh_ints(); +} + +void avigo_state::machine_reset() +{ + /* if is a cold start initialize flash contents */ + if (!m_warm_start) + { + memcpy(m_flashes[0]->space().get_read_ptr(0), memregion("bios")->base() + 0x000000, 0x100000); + memcpy(m_flashes[1]->space().get_read_ptr(0), memregion("bios")->base() + 0x100000, 0x100000); + } + + m_irq = 0; + m_bank1_l = 0; + m_bank1_h = 0; + m_bank2_l = 0; + m_bank2_h = 0; + m_flash_at_0x4000 = -1; + m_flash_at_0x8000 = -1; + + refresh_memory(1, m_bank1_h & 0x07); + refresh_memory(2, m_bank2_h & 0x07); +} + +void avigo_state::machine_start() +{ + m_ram_base = (UINT8*)m_ram->pointer(); + + // bank3 always first ram bank + membank("bank3")->set_base(m_ram_base); + + /* keep machine pointers to flash devices */ + m_flashes[0] = machine().device("flash0"); + m_flashes[1] = machine().device("flash1"); + m_flashes[2] = machine().device("flash2"); + + machine().device("nvram")->set_base(m_ram_base, m_ram->size()); + m_warm_start = 1; + + // register for state saving + save_item(NAME(m_key_line)); + save_item(NAME(m_irq)); + save_item(NAME(m_port2)); + save_item(NAME(m_bank2_l)); + save_item(NAME(m_bank2_h)); + save_item(NAME(m_bank1_l)); + save_item(NAME(m_bank1_h)); + save_item(NAME(m_ad_control_status)); + save_item(NAME(m_flash_at_0x4000)); + save_item(NAME(m_flash_at_0x8000)); + save_item(NAME(m_ad_value)); + save_item(NAME(m_screen_column)); + save_item(NAME(m_warm_start)); + + // save all flash contents + save_pointer(NAME((UINT8*)m_flashes[0]->space().get_read_ptr(0)), 0x100000); + save_pointer(NAME((UINT8*)m_flashes[1]->space().get_read_ptr(0)), 0x100000); + save_pointer(NAME((UINT8*)m_flashes[2]->space().get_read_ptr(0)), 0x100000); + + // register postload callback + machine().save().register_postload(save_prepost_delegate(FUNC(avigo_state::postload), this)); +} + +void avigo_state::postload() +{ + // refresh the bankswitch + refresh_memory(1, m_bank1_h & 0x07); + refresh_memory(2, m_bank2_h & 0x07); +} + +static ADDRESS_MAP_START( avigo_mem , AS_PROGRAM, 8, avigo_state) + AM_RANGE(0x0000, 0x3fff) AM_READWRITE(flash_0x0000_read_handler, flash_0x0000_write_handler) + AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank1") + AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank2") + AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("bank3") +ADDRESS_MAP_END + + +READ8_MEMBER(avigo_state::key_data_read_r) +{ + UINT8 data = 0x0f; + + if (!(m_key_line & 0x01)) + { + data &= ioport("LINE0")->read(); + } + + if (!(m_key_line & 0x02)) + { + data &= ioport("LINE1")->read(); + } + + if (!(m_key_line & 0x04)) + { + data &= ioport("LINE2")->read(); + } + + /* bit 3 is cold/warm start */ + data &= ((m_warm_start<<3) ^ 0xff); + + /* if bit 5 is clear shows synchronisation logo! */ + data |= (1<<5); + + return data; +} + + +/* set key line(s) to read */ +/* bit 0 set for line 0, bit 1 set for line 1, bit 2 set for line 2 */ +WRITE8_MEMBER(avigo_state::set_key_line_w) +{ + /* 5, 101, read back 3 */ + m_key_line = data; + + m_warm_start = BIT(data, 3); +} + +READ8_MEMBER(avigo_state::irq_r) +{ + return m_irq; +} + +WRITE8_MEMBER(avigo_state::irq_w) +{ + m_irq &= data; + + refresh_ints(); +} + +WRITE8_MEMBER(avigo_state::port2_w) +{ + /* + bit 4 LCD backlight on/off + bit 5-6 source select for a/d converter + */ + + if ((m_port2 ^ data) & 0x10) + popmessage("Backlight %s", data & 0x10 ? "on" : "off"); + + m_port2 = data; +} + +READ8_MEMBER(avigo_state::bank1_r) +{ + return offset ? m_bank1_h: m_bank1_l; +} + +READ8_MEMBER(avigo_state::bank2_r) +{ + return offset ? m_bank2_h: m_bank2_l; +} + +WRITE8_MEMBER(avigo_state::bank1_w) +{ + if (offset) + { + LOG(("bank1 h w: %04x\n", data)); + m_bank1_h = data; + } + else + { + LOG(("bank1 l w: %04x\n", data)); + m_bank1_l = data & 0x3f; + } + + refresh_memory(1, m_bank1_h & 0x07); +} + +WRITE8_MEMBER(avigo_state::bank2_w) +{ + if (offset) + { + LOG(("bank2 h w: %04x\n", data)); + m_bank2_h = data; + } + else + { + LOG(("bank2 l w: %04x\n", data)); + m_bank2_l = data & 0x3f; + } + + refresh_memory(2, m_bank2_h & 0x07); +} + +READ8_MEMBER(avigo_state::ad_control_status_r) +{ + LOG(("avigo ad control read %02x\n", (int) m_ad_control_status)); + return m_ad_control_status; +} + + +WRITE8_MEMBER(avigo_state::ad_control_status_w) +{ + LOG(("avigo ad control w %02x\n",data)); + + switch (m_port2 & 0x60) + { + case 0x20: + // read main battery status valid range 0x000-0x3ff + LOG(("a/d main battery status\n")); + + m_ad_value = 0x3ff; + break; + case 0x40: + // read backup battery status valid range 0x000-0x3ff + LOG(("a/d backup battery status\n")); + + m_ad_value = 0x3ff; + break; + case 0x60: + if ((data & 0x070)==0x070) + { + /* bit 3 appears to select between 1 = x coord, 0 = y coord */ + /* when 6,5,4 = 1 */ + if ((data & 0x08)!=0) + { + LOG(("a/d select x coordinate\n")); + LOG(("x coord: %d\n", ioport("POSX")->read())); + + /* on screen range 0x060->0x03a0 */ + if (ioport("LINE3")->read() & 0x01) + { + /* this might not be totally accurate because hitable screen + area may include the border around the screen! */ + m_ad_value = ioport("POSX")->read(); + } + else + { + m_ad_value = 0; + } + + LOG(("ad value: %d\n",m_ad_value)); + + } + else + { + /* in the avigo rom, the y coordinate is inverted! */ + /* therefore a low value would be near the bottom of the display, + and a high value at the top */ + + /* total valid range 0x044->0x03a6 */ + /* 0x0350 is also checked */ + + /* assumption 0x044->0x0350 is screen area and + 0x0350->0x03a6 is panel at bottom */ + + LOG(("a/d select y coordinate\n")); + LOG(("y coord: %d\n", ioport("POSY")->read())); + + if (ioport("LINE3")->read() & 0x01) + { + m_ad_value = ioport("POSY")->read(); + } + else + { + m_ad_value = 0; + } + + LOG(("ad value: %d\n",m_ad_value)); + } + } + } + + /* bit 0: 1 if a/d complete, 0 if a/d not complete */ + m_ad_control_status = data | 1; +} + +READ8_MEMBER(avigo_state::ad_data_r) +{ + UINT8 data = 0; + + /* original */ + + /* status AND 11110111 */ + /* status OR 01110000 -> C20F */ + + switch (m_ad_control_status & 0x078) + { + /* x1110xxx */ + /* read upper 4 bits of 10 bit A/D number */ + case 0x060: + case 0x070: + case 0x078: + { + /* upper 4 bits of 10 bit A/D number in bits 7-4 of data */ + /* bit 0 must be 0, bit 1 must be 0 */ + /* bit 3 must be 1. bit 2 can have any value */ + + LOG(("a/d read upper 4 bits\n")); + data = ((m_ad_value>>6) & 0x0f)<<4; + data |= 8; + } + break; + + /* x0111xxx */ + case 0x020: + case 0x038: + { + /* lower 6 bits of 10-bit A/D number in bits 7-2 of data */ + /* bit 0 must be 1, bit 1 must be 0 */ + + LOG(("a/d lower 6-bits\n")); + data = ((m_ad_value & 0x03f)<<2); + data |= 1; + } + break; + + default: + break; + } + + /* x coord? */ + /* wait for bit 0 of status to become 1 */ + /* read data -> d */ + + + /* C20f AND 10111111 */ + /* C20f OR 00001000 */ + /* x0111xxx */ + + /* bit 1 must be 0, bit 0 must be 1 */ + /* read data -> e */ + + /* upper 4 bits of d contain data */ + /* bits 0 and 1 do not contain data of e, but all other bits do */ + + /* get bit 5 and 6 of d */ + /* and put into bit 0 and 1 of e */ + + /* C20f OR 01000000 */ + /* x1111xxx */ + + /* y coord? */ + /* bit 0 must be 0, bit 1 must be 0 */ + /* bit 3 must be 1. bit 2 can have any value */ + /* read data -> d */ + + /* C20f AND 10111111 */ + /* x0111xxx */ + + /* bit 1 must be 0, bit 0 must be 1 */ + /* read data -> e */ + + + /* original and 1111100 */ + /* original or 1111000 */ + /* 1111x00 */ + + + + /* if fails! */ + /* original */ + /* AND 1001100 */ + /* OR 1001000 */ + /* 1001x00 */ + + + /* AND 1101100 */ + /* OR 1101000 */ + /* 1101x00 */ + + /* 1111x00 */ + + LOG(("avigo ad read %02x\n",data)); + + return data; +} + + +WRITE8_MEMBER(avigo_state::speaker_w) +{ + /* Speaker output state */ + m_speaker->level_w(BIT(data, 3)); +} + + +/* port 0x04: + + bit 7: ??? if set, does a write 0x00 to 0x02e */ + + /* port 0x029: + port 0x02e */ +READ8_MEMBER(avigo_state::port_04_r) +{ + /* must be both 0 for it to boot! */ + return 0x0ff^((1<<7) | (1<<5)); +} + + + +static ADDRESS_MAP_START( avigo_io, AS_IO, 8, avigo_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x001, 0x001) AM_READWRITE( key_data_read_r, set_key_line_w ) + AM_RANGE(0x002, 0x002) AM_WRITE( port2_w ) + AM_RANGE(0x003, 0x003) AM_READWRITE( irq_r, irq_w ) + AM_RANGE(0x004, 0x004) AM_READ( port_04_r ) + AM_RANGE(0x005, 0x006) AM_READWRITE( bank1_r, bank1_w ) + AM_RANGE(0x007, 0x008) AM_READWRITE( bank2_r, bank2_w ) + AM_RANGE(0x009, 0x009) AM_READWRITE( ad_control_status_r, ad_control_status_w ) + AM_RANGE(0x010, 0x01f) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) + AM_RANGE(0x028, 0x028) AM_WRITE( speaker_w ) + AM_RANGE(0x02d, 0x02d) AM_READ( ad_data_r ) + AM_RANGE(0x030, 0x037) AM_DEVREADWRITE("ns16550", ns16550_device, ins8250_r, ins8250_w ) +ADDRESS_MAP_END + + +INPUT_CHANGED_MEMBER( avigo_state::pen_irq ) +{ + LOG(("pen pressed interrupt\n")); + + // an irq is generated when the pen is pressed down on the screen + // or lifted up from the screen + m_irq |= (1<<6); + + refresh_ints(); +} + +INPUT_CHANGED_MEMBER( avigo_state::pen_move_irq ) +{ + // an irq is generated when the pen is down on the screen and is being moved + if (ioport("LINE3")->read() & 0x01) + { + LOG(("pen move interrupt\n")); + m_irq |= (1<<6); + + refresh_ints(); + } +} + +INPUT_CHANGED_MEMBER( avigo_state::kb_irq ) +{ + LOG(("key pressed interrupt\n")); + + if (!newval) + { + m_irq |= (1<<2); + + refresh_ints(); + } +} + +INPUT_CHANGED_MEMBER( avigo_state::power_down_irq ) +{ + if(newval) + { + m_irq |= (1<<7); + + refresh_ints(); + } +} + +static INPUT_PORTS_START(avigo) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PAGE UP") PORT_CODE(KEYCODE_PGUP) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PAGE DOWN") PORT_CODE(KEYCODE_PGDN) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("LIGHT") PORT_CODE(KEYCODE_L) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("TO DO") PORT_CODE(KEYCODE_T) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("ADDRESS") PORT_CODE(KEYCODE_A) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("SCHEDULE") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("MEMO") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pen/Stylus pressed") PORT_CODE(KEYCODE_ENTER) PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, pen_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("?? Causes a NMI") PORT_CODE(KEYCODE_W) PORT_CODE(JOYCODE_BUTTON2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Power Down") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, power_down_irq, NULL ) + + /* these two ports are used to emulate the position of the pen/stylus on the screen */ + PORT_START("POSX") /* Mouse - X AXIS */ + PORT_BIT(0x3ff, 0x060, IPT_LIGHTGUN_X) PORT_SENSITIVITY(100) PORT_CROSSHAIR(X, 1, 0, 0) PORT_MINMAX(0x060, 0x3a0) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, pen_move_irq, NULL ) + + PORT_START("POSY") /* Mouse - Y AXIS */ + PORT_BIT(0x3ff, 0x044, IPT_LIGHTGUN_Y) PORT_SENSITIVITY(100) PORT_CROSSHAIR(Y, 1, 0, 0) PORT_MINMAX(0x044, 0x3a6) PORT_INVERT PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, pen_move_irq, NULL ) +INPUT_PORTS_END + +/* F4 Character Displayer */ +static const gfx_layout avigo_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 96, /* 96 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static const gfx_layout avigo_8_by_14 = +{ + 8, 14, /* 8 x 16 characters */ + 1024, /* 1024 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*32 /* every char takes 32 bytes */ +}; + +static const gfx_layout avigo_16_by_15 = +{ + 16, 15, /* 8 x 16 characters */ + 1024, /* 1024 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + /* y offsets */ + { 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, + 16*16 /* every char takes 16 bytes */ +}; + +static const gfx_layout avigo_15_by_16 = +{ + 15, 16, /* 8 x 16 characters */ + 1024, /* 1024 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, + /* y offsets */ + { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + 16*16 /* every char takes 16 bytes */ +}; + +static const gfx_layout avigo_8_by_8 = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 16*16 /* every char takes 16 bytes */ +}; + +static const gfx_layout avigo_6_by_8 = +{ + 6, 8, /* 6 x 8 characters */ + 255, /* 255 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + /* y offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + 16*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( avigo ) + GFXDECODE_ENTRY( "bios", 0x08992, avigo_charlayout, 0, 1 ) + GFXDECODE_ENTRY( "bios", 0x0c020, avigo_8_by_14, 0, 1 ) + GFXDECODE_ENTRY( "bios", 0x0c020, avigo_16_by_15, 0, 1 ) + GFXDECODE_ENTRY( "bios", 0x14020, avigo_15_by_16, 0, 1 ) + GFXDECODE_ENTRY( "bios", 0x1c020, avigo_8_by_8, 0, 1 ) + GFXDECODE_ENTRY( "bios", 0x1e020, avigo_6_by_8, 0, 1 ) +GFXDECODE_END + + +TIMER_DEVICE_CALLBACK_MEMBER(avigo_state::avigo_scan_timer) +{ + m_irq |= (1<<1); + + refresh_ints(); +} + +TIMER_DEVICE_CALLBACK_MEMBER(avigo_state::avigo_1hz_timer) +{ + m_irq |= (1<<4); + + refresh_ints(); +} + +QUICKLOAD_LOAD_MEMBER( avigo_state,avigo) +{ + address_space& flash1 = m_flashes[1]->space(0); + const char *systemname = machine().system().name; + UINT32 first_app_page = (0x50000>>14); + int app_page; + + // german and spanish language are 4 pages bigger than other + if ( strcmp( systemname, "avigo_de" ) == 0 || strcmp( systemname, "avigo_es" ) == 0 ) + first_app_page += 4; + + // search the first empty page + for (app_page = first_app_page + 1; app_page<0x40; app_page++) + { + bool empty_page = true; + + for (int offset=0; offset<0x4000; offset++) + { + if (flash1.read_byte((app_page<<14) + offset) != 0xff) + { + empty_page = false; + break; + } + } + + if (empty_page) + break; + } + + // if there is the required free space installs the application + if ((app_page + (image.length()>>14)) < 0x40) + { + logerror("Application loaded at 0x%05x-0x%05x\n", app_page<<14, (app_page<<14) + (UINT32)image.length()); + + // copy app file into flash memory + image.fread((UINT8*)m_flashes[1]->space().get_read_ptr(app_page<<14), image.length()); + + // update the application ID + flash1.write_byte((app_page<<14) + 0x1a5, 0x80 + (app_page - (first_app_page>>14))); + + // reset the CPU for allow at the Avigo OS to recognize the installed app + m_warm_start = 1; + m_maincpu->reset(); + + return IMAGE_INIT_PASS; + } + + return IMAGE_INIT_FAIL; +} + +void avigo_state::nvram_init(nvram_device &nvram, void *base, size_t size) +{ + m_warm_start = 0; + memset(base, 0x00, size); +} + +static MACHINE_CONFIG_START( avigo, avigo_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(avigo_mem) + MCFG_CPU_IO_MAP(avigo_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD( "ns16550", NS16550, XTAL_1_8432MHz ) + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport", rs232_port_device, write_txd)) + MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport", rs232_port_device, write_dtr)) + MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport", rs232_port_device, write_rts)) + MCFG_INS8250_OUT_INT_CB(WRITELINE(avigo_state, com_interrupt)) + + MCFG_RS232_PORT_ADD( "serport", default_rs232_devices, NULL ) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, dsr_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, ri_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, cts_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(avigo_state, screen_update) + MCFG_SCREEN_SIZE(AVIGO_SCREEN_WIDTH, AVIGO_SCREEN_HEIGHT + AVIGO_PANEL_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, AVIGO_SCREEN_WIDTH-1, 0, AVIGO_SCREEN_HEIGHT + AVIGO_PANEL_HEIGHT -1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_avigo) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", avigo) + MCFG_PALETTE_ADD("palette", AVIGO_NUM_COLOURS) + MCFG_PALETTE_INIT_OWNER(avigo_state, avigo) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* real time clock */ + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) + MCFG_RP5C01_OUT_ALARM_CB(WRITELINE(avigo_state, tc8521_alarm_int)) + + /* flash ROMs */ + MCFG_AMD_29F080_ADD("flash0") + MCFG_AMD_29F080_ADD("flash1") + MCFG_AMD_29F080_ADD("flash2") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", avigo_state, nvram_init) + + // IRQ 1 is used for scan the pen and for cursor blinking + MCFG_TIMER_DRIVER_ADD_PERIODIC("scan_timer", avigo_state, avigo_scan_timer, attotime::from_hz(50)) + + // IRQ 4 is generated every second, used for auto power off + MCFG_TIMER_DRIVER_ADD_PERIODIC("1hz_timer", avigo_state, avigo_1hz_timer, attotime::from_hz(1)) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", avigo_state, avigo, "app", 0) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ +ROM_START(avigo) + ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) + + ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) + ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) + ROMX_LOAD("english_1004.rom", 0x100000, 0x050000, CRC(c9c3a225) SHA1(7939993a5615ca59ff2047e69b6d85122d437dca), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) + ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) + ROMX_LOAD("english_1002.rom", 0x100000, 0x050000, CRC(31cab0ac) SHA1(87d337830506a12514a4beb9a8502a0de94816f2), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) + ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) + ROMX_LOAD("english_100.rom", 0x100000, 0x050000, CRC(e2824b44) SHA1(3252454b05c3d3a4d7df1cb48dc3441ae82f2b1c), ROM_BIOS(3)) + +ROM_END + +ROM_START(avigo_de) + ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) + + ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) + ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) + ROMX_LOAD("german_1004.rom", 0x100000, 0x060000, CRC(0fa437b3) SHA1(e9352aa8fee6d93b898412bd129452b82baa9a21), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) + ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) + ROMX_LOAD("german_1002.rom", 0x100000, 0x060000, CRC(c6bf07ba) SHA1(d3185687aa510f6c3b3ab3baaabe7e8ce1a79e3b), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) + ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) + ROMX_LOAD("german_100.rom", 0x100000, 0x060000, CRC(117d9189) SHA1(7e959ab1381ba831821fcf87973b25d87f12d34e), ROM_BIOS(3)) + +ROM_END + +ROM_START(avigo_fr) + ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) + + ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) + ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) + ROMX_LOAD("french_1004.rom", 0x100000, 0x050000, CRC(5e4d90f7) SHA1(07df3af8a431ba65e079d6c987fb5d544f6541d8), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) + ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) + ROMX_LOAD("french_1002.rom", 0x100000, 0x050000,CRC(caa3eb91) SHA1(ab199986de301d933f069a5e1f5150967e1d7f59), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) + ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) + ROMX_LOAD("french_100.rom", 0x100000, 0x050000, CRC(fffa2345) SHA1(399447cede3cdd0be768952cb24f7e4431147e3d), ROM_BIOS(3)) + +ROM_END + +ROM_START(avigo_es) + ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) + + ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) + ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) + ROMX_LOAD("spanish_1004.rom", 0x100000, 0x060000, CRC(235a7f8d) SHA1(94da4ecafb54dcd5d80bc5063cb4024e66e6a21f), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) + ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) + ROMX_LOAD("spanish_1002.rom", 0x100000, 0x060000, CRC(a6e80cc4) SHA1(e741657558c11f7bce646ba3d7b5f845bfa275b7), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) + ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) + ROMX_LOAD("spanish_100.rom", 0x100000, 0x060000, CRC(953a5276) SHA1(b9ba1dbdc2127b1ef419c911ef66313024a7351a), ROM_BIOS(3)) + +ROM_END + +ROM_START(avigo_it) + ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) + + ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) + ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) + ROMX_LOAD("italian_1004.rom", 0x100000, 0x050000, CRC(fb7941ec) SHA1(230e8346a3b0da1ee24568ec090ce6860ebfe995), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) + ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) + ROMX_LOAD("italian_1002.rom", 0x100000, 0x050000, CRC(093bc032) SHA1(2c75d950d356a7fd1d058808e5f0be8e15b8ea2a), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) + ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) + ROMX_LOAD("italian_100.rom", 0x100000, 0x050000, CRC(de359218) SHA1(6185727aba8ffc98723f2df74dda388fd0d70cc9), ROM_BIOS(3)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP(1997, avigo, 0, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA", MACHINE_SUPPORTS_SAVE) +COMP(1997, avigo_de, avigo, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA (German)", MACHINE_SUPPORTS_SAVE) +COMP(1997, avigo_fr, avigo, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA (French)", MACHINE_SUPPORTS_SAVE) +COMP(1997, avigo_es, avigo, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA (Spanish)", MACHINE_SUPPORTS_SAVE) +COMP(1997, avigo_it, avigo, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA (Italian)", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/drivers/ax20.c b/src/mame/drivers/ax20.c new file mode 100644 index 00000000000..d5025a92952 --- /dev/null +++ b/src/mame/drivers/ax20.c @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Axel AX-20 + + 27/12/2011 Skeleton driver. + + Hardware description: + - CPU: I8088 + - FDC: I8272 + - PIT: I8253 + - PIC: I8259 + + Also marketed under the Matra brand as MAX-20 ("M" for Matra ?) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "bus/isa/fdc.h" + +class ax20_state : public driver_device +{ +public: + ax20_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_p_vram(*this, "p_vram"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_fdc(*this, "fdc") { } + + required_device m_maincpu; + required_shared_ptr m_p_vram; + required_device m_gfxdecode; + required_device m_palette; + required_device m_fdc; + + virtual void machine_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER(unk_r); + DECLARE_WRITE8_MEMBER(tc_w); + DECLARE_WRITE8_MEMBER(ctl_w); +}; + +READ8_MEMBER(ax20_state::unk_r) +{ + return 0; +} + +WRITE8_MEMBER(ax20_state::tc_w) +{ + m_fdc->tc_w((data & 0xf0) == 0xf0); +} + +WRITE8_MEMBER(ax20_state::ctl_w) +{ + m_fdc->subdevice("0")->get_device()->mon_w(!(data & 1)); +} + +UINT32 ax20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for ( int y = 0; y < 24; y++ ) + { + for ( int x = 0; x < 80; x++ ) + { + UINT16 tile = m_p_vram[24 + y * 128 + x ] & 0x7f; + + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*12); + } + } + + return 0; +} + + +static ADDRESS_MAP_START(ax20_map, AS_PROGRAM, 8, ax20_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0x1ffff) AM_RAM + AM_RANGE(0x20000,0x3ffff) AM_RAM //optional RAM + AM_RANGE(0xf0400,0xf0fff) AM_RAM AM_SHARE("p_vram") + AM_RANGE(0xff800,0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ax20_io, AS_IO, 8, ax20_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xffc0, 0xffc0) AM_WRITE(tc_w) + AM_RANGE(0xffd0, 0xffd0) AM_WRITE(ctl_w) + AM_RANGE(0xffe0, 0xffe0) AM_READ(unk_r) + AM_RANGE(0xff80, 0xff81) AM_DEVICE("fdc", i8272a_device, map) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ax20 ) +INPUT_PORTS_END + + +void ax20_state::machine_start() +{ +} + +static const gfx_layout ax20_charlayout = +{ + 8, 12, + 128, + 1, + { 0 }, + { 4*8+7, 4*8+6, 4*8+5, 4*8+4, 4*8+3, 4*8+2, 4*8+1, 4*8+0 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11 }, + 8*16 +}; + +static GFXDECODE_START( ax20 ) + GFXDECODE_ENTRY( "chargen", 0x0000, ax20_charlayout, 0, 1 ) +GFXDECODE_END + +static SLOT_INTERFACE_START( ax20_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( ax20, ax20_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8088, XTAL_14_31818MHz/3) + MCFG_CPU_PROGRAM_MAP(ax20_map) + MCFG_CPU_IO_MAP(ax20_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(ax20_state, screen_update) + MCFG_SCREEN_SIZE(80*8, 24*12) + MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*12-1) + MCFG_SCREEN_PALETTE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ax20) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_I8272A_ADD("fdc", true) + + /* Devices */ + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ax20_floppies, "525dd", isa8_fdc_device::floppy_formats) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ax20 ) + ROM_REGION( 0x0800, "ipl", 0 ) + ROM_LOAD( "ax20-s.rom", 0x0000, 0x0800, CRC(f11f95b9) SHA1(59949332dd431fcf8211c2d556e1f49351e90750)) + + ROM_REGION( 0x4000, "chargen", 0 ) + ROM_LOAD( "ax20-g.rom", 0x0000, 0x0800, CRC(90bcef80) SHA1(922067fd7316de9e69b9600c793ada5c87197eeb)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, ax20, 0, 0, ax20, ax20, driver_device, 0, "Axel", "AX-20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/b16.c b/src/mame/drivers/b16.c new file mode 100644 index 00000000000..64904bff3c6 --- /dev/null +++ b/src/mame/drivers/b16.c @@ -0,0 +1,312 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Hitachi B(asic Master?) 16 + + very preliminary driver by Angelo Salese + + TODO: + - Driver is all made up of educated guesses (no documentation available) + + 0xfcc67 after the ROM checksum to zero (bp 0xfc153 -> SI = 0) -> system boots + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "video/mc6845.h" +#include "machine/am9517a.h" + + + +class b16_state : public driver_device +{ +public: + b16_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_vram(*this, "vram"), + m_dma8237(*this, "8237dma"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + UINT8 *m_char_rom; + required_shared_ptr m_vram; + UINT8 m_crtc_vreg[0x100],m_crtc_index; + + DECLARE_READ16_MEMBER(vblank_r); + DECLARE_WRITE8_MEMBER(b16_pcg_w); + DECLARE_WRITE8_MEMBER(b16_6845_address_w); + DECLARE_WRITE8_MEMBER(b16_6845_data_w); + DECLARE_READ8_MEMBER(unk_dev_r); + DECLARE_WRITE8_MEMBER(unk_dev_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + mc6845_device *m_mc6845; + required_device m_dma8237; + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; +}; + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + + +void b16_state::video_start() +{ + // find memory regions + m_char_rom = memregion("pcg")->base(); +} + + +UINT32 b16_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + int xi,yi; + UINT8 *gfx_rom = memregion("pcg")->base(); + + for(y=0;y> 8; + int pen; + + for(yi=0;yi> (7-xi) & 1) ? color : 0; + + if(y*mc6845_tile_height < 400 && x*8+xi < 640) /* TODO: safety check */ + bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); + } + } + } + } + + return 0; +} + +WRITE8_MEMBER( b16_state::b16_pcg_w ) +{ + m_char_rom[offset] = data; + + m_gfxdecode->gfx(0)->mark_dirty(offset >> 4); +} + +static ADDRESS_MAP_START( b16_map, AS_PROGRAM, 16, b16_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00000, 0x9ffff ) AM_RAM // probably not all of it. + AM_RANGE( 0xa0000, 0xaffff ) AM_RAM // bitmap? + AM_RANGE( 0xb0000, 0xb7fff ) AM_RAM AM_SHARE("vram") // tvram + AM_RANGE( 0xb8000, 0xbbfff ) AM_WRITE8(b16_pcg_w,0x00ff) // pcg + AM_RANGE( 0xfc000, 0xfffff ) AM_ROM AM_REGION("ipl",0) +ADDRESS_MAP_END + +READ16_MEMBER( b16_state::vblank_r ) +{ + return ioport("SYSTEM")->read(); +} + +WRITE8_MEMBER( b16_state::b16_6845_address_w ) +{ + m_crtc_index = data; + m_mc6845->address_w(space,offset, data); +} + +WRITE8_MEMBER( b16_state::b16_6845_data_w ) +{ + m_crtc_vreg[m_crtc_index] = data; + m_mc6845->register_w(space, offset, data); +} + +/* +Pretty weird protocol, dunno what it is ... + +8a (06) W +(04) R +ff (04) W +(04) R +ff (04) W +36 (0e) W +ff (08) W +ff (08) W +06 (0e) W +(08) R +(08) R +36 (0e) W +40 (08) W +9c (08) W +76 (0e) W +ff (0a) W +ff (0a) W +46 (0e) W +(0a) R +(0a) R +76 (0e) W +1a (0a) W +00 (0a) W +b6 (0e) W +ff (0c) W +ff (0c) W +86 (0e) W +(0c) R +(0c) R +b6 (0e) W +34 (0c) W +00 (0c) W +36 (0e) W +b6 (0e) W +40 (08) W +9c (08) W +34 (0c) W +00 (0c) W +8a (06) W +06 (06) W +05 (06) W +*/ + +READ8_MEMBER( b16_state::unk_dev_r ) +{ + static int test; + + printf("(%02x) R\n",offset << 1); + + if(offset == 0x8/2 || offset == 0x0a/2 || offset == 0x0c/2) // quick hack + { + test^=1; + return test ? 0x9f : 0x92; + } + + return 0xff; +} + +WRITE8_MEMBER( b16_state::unk_dev_w ) +{ + printf("%02x (%02x) W\n",data,offset << 1); + +} + +static ADDRESS_MAP_START( b16_io, AS_IO, 16, b16_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x0f) AM_READWRITE8(unk_dev_r,unk_dev_w,0x00ff) // DMA device? + AM_RANGE(0x20, 0x21) AM_WRITE8(b16_6845_address_w,0x00ff) + AM_RANGE(0x22, 0x23) AM_WRITE8(b16_6845_data_w,0x00ff) + //0x79 bit 0 DSW? + AM_RANGE(0x80, 0x81) AM_READ(vblank_r) // TODO +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( b16 ) + PORT_START("SYSTEM") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") +INPUT_PORTS_END + + + + +static const gfx_layout b16_charlayout = +{ + 8, 16, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP8(0,1) }, + { STEP16(0,8) }, + 8*16 +}; + +static GFXDECODE_START( b16 ) + GFXDECODE_ENTRY( "pcg", 0x0000, b16_charlayout, 0, 1 ) +GFXDECODE_END + +void b16_state::machine_start() +{ + m_mc6845 = machine().device("crtc"); +} + +void b16_state::machine_reset() +{ +} + + +READ8_MEMBER(b16_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(b16_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.write_byte(offset, data); +} + + +static MACHINE_CONFIG_START( b16, b16_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8086, XTAL_14_31818MHz/2) //unknown xtal + MCFG_CPU_PROGRAM_MAP(b16_map) + MCFG_CPU_IO_MAP(b16_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(b16_state, screen_update) + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_14_31818MHz/5) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_DEVICE_ADD("8237dma", AM9517A, XTAL_14_31818MHz/2) + MCFG_I8237_IN_MEMR_CB(READ8(b16_state, memory_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(b16_state, memory_write_byte)) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", b16) + MCFG_PALETTE_ADD("palette", 8) +// MCFG_PALETTE_INIT_STANDARD(black_and_white) // TODO + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( b16 ) + ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x4000, CRC(7c1c93d5) SHA1(2a1e63a689c316ff836f21646166b38714a18e03) ) + + ROM_REGION( 0x4000/2, "pcg", ROMREGION_ERASE00 ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, b16, 0, 0, b16, b16, driver_device, 0, "Hitachi", "B16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/b2m.c b/src/mame/drivers/b2m.c new file mode 100644 index 00000000000..99a3b03ccd6 --- /dev/null +++ b/src/mame/drivers/b2m.c @@ -0,0 +1,273 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Bashkiria-2M driver by Miodrag Milanovic + + 28/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "machine/i8255.h" +#include "machine/pic8259.h" +#include "machine/i8251.h" +#include "machine/wd_fdc.h" +#include "machine/ram.h" +#include "includes/b2m.h" +#include "formats/smx_dsk.h" + +/* Address maps */ +static ADDRESS_MAP_START(b2m_mem, AS_PROGRAM, 8, b2m_state ) + AM_RANGE (0x0000, 0x27ff) AM_RAMBANK("bank1") + AM_RANGE (0x2800, 0x2fff) AM_RAMBANK("bank2") + AM_RANGE (0x3000, 0x6fff) AM_RAMBANK("bank3") + AM_RANGE (0x7000, 0xdfff) AM_RAMBANK("bank4") + AM_RANGE (0xe000, 0xffff) AM_RAMBANK("bank5") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( b2m_io, AS_IO, 8, b2m_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1f) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w) + AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) + AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_device, read, write ) + AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("fd1793", fd1793_t, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( b2m_rom_io, AS_IO, 8, b2m_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1f) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_3", i8255_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w) + AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) + AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_device, read, write ) + AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( b2m ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('{') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('}') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('*') PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('&') PORT_CHAR('7') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('^') PORT_CHAR('6') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('%') PORT_CHAR('5') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('$') PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('#') PORT_CHAR('3') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('@') PORT_CHAR('2') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_CHAR('-') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('\'') PORT_CHAR(';') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('=') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('|') PORT_CHAR('\\') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(')') PORT_CHAR('0') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('(') PORT_CHAR('9') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rshift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LAlt") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LCtrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("???") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgdN") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("end") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('?') PORT_CHAR('/') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\"') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("LINE10") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("MONITOR") + PORT_CONFNAME(0x01, 0x01, "Monitor") + PORT_CONFSETTING( 0x01, "Color") + PORT_CONFSETTING( 0x00, "B/W") +INPUT_PORTS_END + +FLOPPY_FORMATS_MEMBER( b2m_state::b2m_floppy_formats ) + FLOPPY_SMX_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( b2m_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + + +/* Machine driver */ +static MACHINE_CONFIG_START( b2m, b2m_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(b2m_mem) + MCFG_CPU_IO_MAP(b2m_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", b2m_state, b2m_vblank_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(384, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(b2m_state, screen_update_b2m) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 4) + MCFG_PALETTE_INIT_OWNER(b2m_state, b2m) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(0) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) + MCFG_PIT8253_CLK1(2000000) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(b2m_state,bm2_pit_out1)) + MCFG_PIT8253_CLK2(2000000) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pit8253", pit8253_device, write_clk0)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(b2m_state, b2m_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(b2m_state, b2m_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(b2m_state, b2m_8255_portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(b2m_state, b2m_8255_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_OUT_PORTC_CB(WRITE8(b2m_state, b2m_ext_8255_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_3", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(b2m_state, b2m_romdisk_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(b2m_state, b2m_romdisk_portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(b2m_state, b2m_romdisk_portc_w)) + + MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), VCC, NULL ) + + /* sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* uart */ + MCFG_DEVICE_ADD("uart", I8251, 0) + + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(b2m_state, b2m_fdc_drq)) + + MCFG_FLOPPY_DRIVE_ADD("fd0", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","b2m") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( b2mrom, b2m ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(b2m_rom_io) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( b2m ) + ROM_REGION( 0x12000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "b2m.rom", 0x10000, 0x2000, CRC(3f3214d6) SHA1(dd93e7fbabf14d1aed6777fe1ccfe0a3ca8fcaf2) ) +ROM_END + +ROM_START( b2mrom ) + ROM_REGION( 0x22000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bios2.rom", 0x10000, 0x2000, CRC(c22a98b7) SHA1(7de91e653bf4b191ded62cf21532578268e4a2c1) ) + ROM_LOAD( "ramdos.sys", 0x12000, 0x60c0, CRC(91ed6df0) SHA1(4fd040f2647a6b7930c330c75560a035027d0606) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, b2m, 0, 0, b2m, b2m, b2m_state, b2m, "BNPO", "Bashkiria-2M", MACHINE_SUPPORTS_SAVE) +COMP( 1989, b2mrom, b2m, 0, b2mrom, b2m, b2m_state, b2m, "BNPO", "Bashkiria-2M ROM-disk", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/drivers/babbage.c b/src/mame/drivers/babbage.c new file mode 100644 index 00000000000..e89bd9b3e75 --- /dev/null +++ b/src/mame/drivers/babbage.c @@ -0,0 +1,278 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Babbage-2nd skeleton driver (19/OCT/2011) + + http://homepage3.nifty.com/takeda-toshiya/babbage/index.html + + Pasting: + 0-F : as is + INC : ^ + AD : - + DA : = + GO : X + + Here is a test program to turn on the LEDs. + Copy the text and Paste into the emulator. + =3E^=0F^=D3^=13^=3E^=07^=D3^=13^=3E^=00^=D3^=12^=76^-1000X + + ToDo: + - Blank the display if digits aren't being refreshed + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "cpu/z80/z80daisy.h" +#include "babbage.lh" + +#define MAIN_CLOCK 25e5 + +class babbage_state : public driver_device +{ +public: + babbage_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pio_1(*this, "z80pio_1"), + m_pio_2(*this, "z80pio_2"), + m_ctc(*this, "z80ctc") + { } + + required_device m_maincpu; + required_device m_pio_1; + required_device m_pio_2; + required_device m_ctc; + DECLARE_READ8_MEMBER(pio2_a_r); + DECLARE_WRITE8_MEMBER(pio1_b_w); + DECLARE_WRITE8_MEMBER(pio2_b_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); + UINT8 m_segment; + UINT8 m_key; + UINT8 m_prev_key; + bool m_step; + virtual void machine_reset(); + virtual void machine_start(); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); +}; + + + +/*************************************************************************** + + Machine + +***************************************************************************/ + +void babbage_state::machine_start() +{ +} + +void babbage_state::machine_reset() +{ +} + + + +/*************************************************************************** + + Address Map + +***************************************************************************/ + +static ADDRESS_MAP_START( babbage_map, AS_PROGRAM, 8, babbage_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x1000, 0x17ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( babbage_io, AS_IO, 8, babbage_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) + AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80pio_2", z80pio_device, read_alt, write_alt) +ADDRESS_MAP_END + + + +/************************************************************************** + + Keyboard Layout + +***************************************************************************/ + +// no idea of the actual key matrix +static INPUT_PORTS_START( babbage ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INC") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') +INPUT_PORTS_END + +/* Z80-CTC Interface */ + +WRITE_LINE_MEMBER( babbage_state::ctc_z0_w ) +{ +} + +WRITE_LINE_MEMBER( babbage_state::ctc_z1_w ) +{ +} + +WRITE_LINE_MEMBER( babbage_state::ctc_z2_w ) +{ +} + +/* Z80-PIO Interface */ + +// The 8 LEDs +// bios never writes here - you need to set PIO for output yourself - see test program above +WRITE8_MEMBER( babbage_state::pio1_b_w ) +{ + char ledname[8]; + for (int i = 0; i < 8; i++) + { + sprintf(ledname,"led%d",i); + output_set_value(ledname, BIT(data, i)); + } +} + +READ8_MEMBER( babbage_state::pio2_a_r ) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); // release interrupt + return m_key; +} + +WRITE8_MEMBER( babbage_state::pio2_b_w ) +{ + if (BIT(data, 7)) + m_step = false; + else + if (!m_step) + { + m_segment = data; + m_step = true; + } + else + output_set_digit_value(data, m_segment); +} + +static const z80_daisy_config babbage_daisy_chain[] = +{// need to check the order + { "z80pio_1" }, + { "z80pio_2" }, + { "z80ctc" }, + { NULL } +}; + +TIMER_DEVICE_CALLBACK_MEMBER(babbage_state::keyboard_callback) +{ + UINT8 i, j, inp; + char kbdrow[6]; + UINT8 data = 0xff; + + for (i = 0; i < 4; i++) + { + sprintf(kbdrow,"X%X",i); + inp = ioport(kbdrow)->read(); + + for (j = 0; j < 5; j++) + if (BIT(inp, j)) + data = (j << 2) | i; + } + + /* make sure only one keystroke */ + if (data != m_prev_key) + m_prev_key = data; + else + data = 0xff; + + /* while key is down, activate strobe. When key released, deactivate strobe which causes an interrupt */ + if (data < 0xff) + { + m_key = data; + m_pio_2->strobe(0, 0); + } + else + m_pio_2->strobe(0, 1); +} + + +/*************************************************************************** + + Machine driver + +***************************************************************************/ + +static MACHINE_CONFIG_START( babbage, babbage_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, MAIN_CLOCK) //2.5MHz + MCFG_CPU_PROGRAM_MAP(babbage_map) + MCFG_CPU_IO_MAP(babbage_io) + MCFG_CPU_CONFIG(babbage_daisy_chain) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_babbage) + + /* Devices */ + MCFG_DEVICE_ADD("z80ctc", Z80CTC, MAIN_CLOCK) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(babbage_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(babbage_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(babbage_state, ctc_z2_w)) + + MCFG_DEVICE_ADD("z80pio_1", Z80PIO, MAIN_CLOCK) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(babbage_state, pio1_b_w)) + + MCFG_DEVICE_ADD("z80pio_2", Z80PIO, MAIN_CLOCK) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(babbage_state, pio2_a_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(babbage_state, pio2_b_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", babbage_state, keyboard_callback, attotime::from_hz(30)) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver + +***************************************************************************/ + +ROM_START(babbage) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_LOAD("mon.rom", 0x0000, 0x0200, CRC(469bd607) SHA1(8f3489a0f96de6a03b05c1ee01b89d9848f4b152) ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1986, babbage, 0, 0, babbage, babbage, driver_device, 0, "Mr Takafumi Aihara", "Babbage-2nd" , MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/banctec.c b/src/mame/drivers/banctec.c new file mode 100644 index 00000000000..4a25e665b67 --- /dev/null +++ b/src/mame/drivers/banctec.c @@ -0,0 +1,133 @@ +// license:GPL-2.0+ +// copyright-holders:Felipe Sanches +/*************************************************************************** + This driver covers only the Operator Panel of the BancTec 91690 Document Processor equipment + + Author: Felipe Sanches + + Maintainence Manual: +*/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "cpu/m6805/m6805.h" +#include "includes/banctec.h" +#include "video/mc6845.h" + +static ADDRESS_MAP_START( banctec_mem , AS_PROGRAM, 8, banctec_state ) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0xffff) AM_RAM /* Probably wrong. Must be verified on pcb! */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( banctec_mcu_mem , AS_PROGRAM, 8, banctec_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0x7fff) AM_RAM /* Probably wrong. Must be verified on pcb! */ + AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("videoram") /* Probably wrong. Must be verified on pcb! */ +ADDRESS_MAP_END + +void banctec_state::machine_reset() +{ +} + + +/**************************** +* Video/Character functions * +****************************/ + +TILE_GET_INFO_MEMBER(banctec_state::get_bg_tile_info) +{ + UINT8 *videoram = m_videoram; + int code = videoram[tile_index]; + int color = 1; + + SET_TILE_INFO_MEMBER(0, code, color, 0); +} + +void banctec_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(banctec_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 40, 25); +} + +UINT32 banctec_state::screen_update_banctec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + +/* ROCKWELL 6545 - Transparent Memory Addressing */ + +MC6845_ON_UPDATE_ADDR_CHANGED(banctec_state::crtc_addr) +{ + /* What is this function meant to do ? */ +} + +/****************************** +* Graphics Decode Information * +******************************/ + +const gfx_layout banctec_gfx_layout = +{ + 8, 8, /* 8x8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {0, 1, 2, 3, 4, 5, 6, 7}, + {0 * 256*8, 1 * 256*8, 2 * 256*8, 3 * 256*8, 4 * 256*8, 5 * 256*8, 6 * 256*8, 7 * 256*8}, + 8 /* size of one char */ +}; + +static GFXDECODE_START( banctec ) + GFXDECODE_ENTRY( "gfx", 0x00000, banctec_gfx_layout, 0, 2 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( banctec, banctec_state ) + /* basic machine hardware */ + + MCFG_CPU_ADD("maincpu", I80C31, XTAL_11_0592MHz) + MCFG_CPU_PROGRAM_MAP(banctec_mem) + + MCFG_CPU_ADD("mcu", M6805, 4000000) /* Actual MCU is a Motorola 6803 and the clock frequency is still unknown */ + MCFG_CPU_PROGRAM_MAP(banctec_mcu_mem) + +// The video signal is generated by a R6545EAP character generator chip +// The U20 EPROM holds the image data for the character set. + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE((52+1)*8, (31+1)*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 25*8-1) + MCFG_SCREEN_UPDATE_DRIVER(banctec_state, screen_update_banctec) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", banctec) + MCFG_PALETTE_ADD("palette", 2) +// MCFG_PALETTE_INIT_OWNER(banctec_state, banctec) + + MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_20MHz) /* (?) */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_ADDR_CHANGED_CB(banctec_state, crtc_addr) + +MACHINE_CONFIG_END + +ROM_START(banctec) + ROM_REGION(0x800,"maincpu",0) + ROM_LOAD("banctec_eseries_panel_opnl.u20", 0x000, 0x800, CRC(c2ab9c06) SHA1(a296589034f656790ad5ffbce028dd846a40cf03)) + + ROM_REGION(0x2000,"mcu",0) + ROM_LOAD("banctec_eseries_panel.u8", 0x0000, 0x2000, CRC(f3335e0a) SHA1(5ca45fdcb7ef45a65c28c79abfa9ebb7a8a06619)) + + ROM_REGION(0x1000,"gfx",0) + ROM_LOAD("banctec_eseries_panel.u20", 0x0000, 0x1000, CRC(5b6ecec9) SHA1(35aff8f965bce77205e3a43d71e39097585091a7)) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT MONITOR COMPANY FULLNAME */ +CONS( 1989, banctec, 0, 0, banctec, 0, driver_device, 0, "DALE Electronics", "BancTec ESeries Panel", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/basic52.c b/src/mame/drivers/basic52.c new file mode 100644 index 00000000000..c8369c8b5c5 --- /dev/null +++ b/src/mame/drivers/basic52.c @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + MCS BASIC 52 and MCS BASIC 31 board + + 03/12/2009 Skeleton driver. + + 2012-08-08 Made to work [Robbbert] + +BASIC-52 is an official Intel release. + +BASIC-31 (and variants) as found on the below url, are homebrews. + +http://dsaprojects.110mb.com/electronics/8031-ah/8031-bas.html + + +The driver is working, however there are issues with the cpu serial code. +When started, you are supposed to press Space and the system works out +the baud rate and boots up. + +However, the way the cpu is written, it actually passes bytes around, so +the auto-speed detection doesn't work as intended. Also the cpu interface +is horribly outdated and needs to be brought up to date. + +So, as it stands, start the driver, then press d and g in turn until +something starts happening. Basic-52 usually starts at a very slow rate, +about 1 character per second, while Basic-31 is much faster. + +Once the system starts, all input must be in uppercase. Read the manual +to discover the special features of this Basic. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "machine/i8255.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class basic52_state : public driver_device +{ +public: + basic52_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(unk_r); + UINT8 m_term_data; + required_device m_maincpu; + required_device m_terminal; + virtual void machine_reset(); + DECLARE_WRITE8_MEMBER(to_term); + DECLARE_READ8_MEMBER(from_term); +}; + + +static ADDRESS_MAP_START(basic52_mem, AS_PROGRAM, 8, basic52_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0x7fff) AM_RAM + //AM_RANGE(0x8000, 0x9fff) AM_ROM // EPROM + //AM_RANGE(0xc000, 0xdfff) // Expansion block + //AM_RANGE(0xe000, 0xffff) // Expansion block +ADDRESS_MAP_END + +static ADDRESS_MAP_START(basic52_io, AS_IO, 8, basic52_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0x9fff) AM_ROM // EPROM + AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // PPI-8255 + //AM_RANGE(0xc000, 0xdfff) // Expansion block + //AM_RANGE(0xe000, 0xffff) // Expansion block + AM_RANGE(0x20003, 0x20003) AM_READ(unk_r); +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( basic52 ) +INPUT_PORTS_END + +// won't compile unless these are static +WRITE8_MEMBER( basic52_state::to_term) +{ + m_terminal->write(space, 0, data); +} + +READ8_MEMBER(basic52_state::from_term) +{ + return m_term_data; +} + +READ8_MEMBER( basic52_state::unk_r) +{ + return m_term_data; // won't boot without this +} + +void basic52_state::machine_reset() +{ + m_maincpu->i8051_set_serial_tx_callback(write8_delegate(FUNC(basic52_state::to_term),this)); + m_maincpu->i8051_set_serial_rx_callback(read8_delegate(FUNC(basic52_state::from_term),this)); +} + +WRITE8_MEMBER( basic52_state::kbd_put ) +{ + m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); + m_maincpu->set_input_line(MCS51_RX_LINE, CLEAR_LINE); + m_term_data = data; +} + +static MACHINE_CONFIG_START( basic31, basic52_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8031, XTAL_11_0592MHz) + MCFG_CPU_PROGRAM_MAP(basic52_mem) + MCFG_CPU_IO_MAP(basic52_io) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(basic52_state, kbd_put)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( basic52, basic31 ) + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", I8052, XTAL_11_0592MHz) + MCFG_CPU_PROGRAM_MAP(basic52_mem) + MCFG_CPU_IO_MAP(basic52_io) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( basic52 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v11", "v 1.1") + ROMX_LOAD( "mcs-51-11.bin", 0x0000, 0x2000, CRC(4157b22b) SHA1(bd9e6869b400cc1c9b163243be7bdcf16ce72789), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v11b", "v 1.1b") + ROMX_LOAD( "mcs-51-11b.bin", 0x0000, 0x2000, CRC(a60383cc) SHA1(9515cc435e2ca3d3adb19631c03a62dfbeab0826), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v131", "v 1.3.1") + ROMX_LOAD( "mcs-51-131.bin", 0x0000, 0x2000, CRC(6a493162) SHA1(ed1079a6b4d4dbf448e15238c5a9e4dd004e401c), ROM_BIOS(3)) +ROM_END + +ROM_START( basic31 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v12", "v 1.2") + ROMX_LOAD( "mcs-51-12.bin", 0x0000, 0x2000, CRC(ee667c7c) SHA1(e69b32e69ecda2012c7113649634a3a64e984bed), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v12a", "v 1.2a") + ROMX_LOAD( "mcs-51-12a.bin", 0x0000, 0x2000, CRC(225bb2f0) SHA1(46e97643a7a5cb4c278f9e3c73d18cd93209f8bf), ROM_BIOS(2)) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, basic52, 0, 0, basic52, basic52, driver_device, 0, "Intel", "MCS BASIC 52", MACHINE_NO_SOUND_HW) +COMP( 1985, basic31, basic52, 0, basic31, basic52, driver_device, 0, "Intel", "MCS BASIC 31", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/bbc.c b/src/mame/drivers/bbc.c new file mode 100644 index 00000000000..d60964282ab --- /dev/null +++ b/src/mame/drivers/bbc.c @@ -0,0 +1,1998 @@ +// license:BSD-3-Clause +// copyright-holders:Gordon Jefferyes, Nigel Barnes +/****************************************************************************** + BBC Model A,B + + ANA01 - Model A + ANA02 - Model A with Econet interface + + ANB01 - Model B + ANB02 - Model B with Econet interface + ANB03 - Model B with Disc interface + ANB04 - Model B with Disc and Econet interfaces + + GNB14 - Model B with Disc, Econet & Speech (German model) + UNB09 - Model B with Disc, Econet & Speech (US model) + + BBC Model B+ + + ANB51 - BBC Model B+ 64K + ANB52 - BBC Model B+ 64K with Econet + ANB53 - BBC Model B+ 64K with Disc interface + ANB54 - BBC Model B+ 64K with Disc and Econet interfaces + ANB55 - BBC Model B+ 128K with Disc interface + + BBC Master + + AMB15 - Master 128 + ADB12 - Master Econet Terminal + AVC12 - Master AIV + ARM1 - ARM Evaluation System + ADB20 - Master Compact + + + MESS Driver By: + + Gordon Jefferyes + mess_bbc@romvault.com + Nigel Barnes + ngbarnes@hotmail.com + +******************************************************************************/ + +/* Core includes */ +#include "emu.h" + +/* Components */ +#include "bus/rs232/rs232.h" +#include "cpu/m6502/m6502.h" +#include "cpu/m6502/m65sc02.h" +#include "machine/6522via.h" +#include "bus/centronics/ctronics.h" +#include "bus/econet/econet.h" +#include "sound/tms5220.h" /* Speech */ +#include "video/saa5050.h" /* Teletext */ +#include "bbc.lh" + +/* Devices */ +#include "imagedev/flopdrv.h" +#include "formats/bbc_dsk.h" +#include "imagedev/cassette.h" +#include "formats/uef_cas.h" +#include "formats/csw_cas.h" +#include "includes/bbc.h" + + +/****************************************************************************** +A = BBC Model A +B = BBC Model B +B+ = BBC Model B+ +M = BBC Master + + A B B+ M ++ &0000 + + + + +| | | | | +| &1000 | | | | +|1 | | |1 |1 +| &2000 |1 | | | +| | | | | ++ &3000 | | + + +|2 | | | | ++ &4000 + |1 | | +| | | | | +| &5000 | | | | +| | | |2 |2 +|3 &6000 |3 | | | +| | | | | +| &7000 | | | | +| | | | | ++ &8000 + + + + +|4 | | | |4 ++ &9000 | | | + +| | | |4 | +|5 &A000 |4 |4 | |5 +| | | | | ++ &B000 | | + | +|6 | | |6 | ++ &C000 + + + + +| | | | |7 +|7 &D000 | | | | +| | | | | ++ &E000 |7 |7 |7 + +| | | | | +|8 &F000 | | | |8 +| | | | | ++ &FC00 FRED + + + + + &FD00 JIM + + + + + &FE00 SHEILA + + + + ++ &FF00 + + + + +|9 |9 |9 |9 |9 ++ &FFFF + + + + + + + +&00-&07 6845 CRTC Video controller 8 ( 2 bytes x 4 ) 1MHz +&08-&0F 6850 ACIA Serial controller 8 ( 2 bytes x 4 ) 1MHz +&10-&17 Serial ULA Serial system chip 8 ( 1 byte x 8 ) 1MHz +&18-&1f INTOFF/STATID ECONET Interrupt Off / ID No. 8 ( 1 byte x 8 ) 1MHz +write: +&20-&2F Video ULA Video system chip 16 ( 2 bytes x 8 ) 2MHz +&30-&3F 74LS161 Paged ROM selector 16 ( 1 byte x 16 ) 2MHz +read: +&20-&2F INTON ECONET Interrupt On 16 ( 1 bytes x 16 ) 2MHz +&30-&3F Not Connected Not Connected 2MHz + +&40-&5F 6522 VIA SYSTEM VIA 32 (16 bytes x 2 ) 1MHz +&60-&7F 6522 VIA USER VIA 32 (16 bytes x 2 ) 1MHz +&80-&9F 8271 FDC FDC Floppy disc controller 32 ( 8 bytes x 4 ) 2MHz +&A0-&BF 68B54 ADLC ECONET controller 32 ( 4 bytes x 8 ) 2MHz +&C0-&DF uPD7002 Analogue to digital converter 32 ( 4 bytes x 8 ) 1MHz +&E0-&FF Tube ULA Tube system interface 32 (32 bytes x 1 ) 2MHz +******************************************************************************/ + +READ8_MEMBER(bbc_state::bbc_fe_r) +{ + return 0xfe; +} + +static ADDRESS_MAP_START( bbca_mem, AS_PROGRAM, 8, bbc_state ) + ADDRESS_MAP_UNMAP_HIGH /* Hardware marked with a # is not present in a Model A */ + + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorya1_w) /* 0000-3fff Regular Ram */ + AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank3") AM_WRITE(bbc_memoryb3_w) /* 4000-7fff Repeat of the Regular Ram */ + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank4") AM_WRITE(bbc_memoryb4_w) /* 8000-bfff Paged ROM */ + AM_RANGE(0xc000, 0xfbff) AM_READ_BANK("bank7") /* c000-fbff OS ROM */ + AM_RANGE(0xfc00, 0xfdff) AM_NOP /* fc00-fdff FRED & JIM Pages */ + /* fe00-feff SHEILA Address Page */ + AM_RANGE(0xfe00, 0xfe00) AM_MIRROR(0x06) AM_DEVREADWRITE("mc6845", mc6845_device, status_r, address_w) /* fe00-fe07 6845 CRTC Video controller */ + AM_RANGE(0xfe01, 0xfe01) AM_MIRROR(0x06) AM_DEVREADWRITE("mc6845", mc6845_device, register_r, register_w) + AM_RANGE(0xfe08, 0xfe08) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_device, status_r, control_w) /* fe08-fe0F 6850 ACIA Serial controller */ + AM_RANGE(0xfe09, 0xfe09) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_device, data_r, data_w) + AM_RANGE(0xfe10, 0xfe17) AM_READWRITE(bbc_fe_r, bbc_SerialULA_w) /* fe10-fe17 Serial ULA Serial system chip */ + AM_RANGE(0xfe18, 0xfe1f) AM_NOP /* fe18-fe1f INTOFF/STATID # ECONET Interrupt Off / ID No. */ + AM_RANGE(0xfe20, 0xfe2f) AM_WRITE(bbc_videoULA_w) /* R: fe20-fe2f INTON # ECONET Interrupt On */ + /* W: fe20-fe2f Video ULA Video system chip */ + AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selecta_w) /* R: fe30-fe3f NC Not Connected */ + /* W: fe30-fe3f 84LS161 Paged ROM selector */ + AM_RANGE(0xfe40, 0xfe5f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) /* fe40-fe5f 6522 VIA SYSTEM VIA */ + AM_RANGE(0xfe60, 0xfe7f) AM_NOP /* fe60-fe7f 6522 VIA # USER VIA */ + AM_RANGE(0xfe80, 0xfe9f) AM_NOP /* fe80-fe9f 8271/1770 FDC # Floppy disc controller */ + AM_RANGE(0xfea0, 0xfebf) AM_READ(bbc_fe_r) /* fea0-febf 68B54 ADLC # ECONET controller */ + AM_RANGE(0xfec0, 0xfedf) AM_NOP /* fec0-fedf uPD7002 # Analogue to digital converter */ + AM_RANGE(0xfee0, 0xfeff) AM_READ(bbc_fe_r) /* fee0-feff Tube ULA # Tube system interface */ + AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("os", 0x3f00) /* ff00-ffff OS Rom (continued) */ +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( bbc_base, AS_PROGRAM, 8, bbc_state ) + ADDRESS_MAP_UNMAP_HIGH + + AM_RANGE(0xc000, 0xfbff) AM_READ_BANK("bank7") /* c000-fbff OS ROM */ + AM_RANGE(0xfc00, 0xfdff) AM_NOP /* fc00-fdff FRED & JIM Pages */ + /* fe00-feff SHEILA Address Page */ + AM_RANGE(0xfe00, 0xfe00) AM_MIRROR(0x06) AM_DEVREADWRITE("mc6845", mc6845_device, status_r, address_w) /* fe00-fe07 6845 CRTC Video controller */ + AM_RANGE(0xfe01, 0xfe01) AM_MIRROR(0x06) AM_DEVREADWRITE("mc6845", mc6845_device, register_r, register_w) + AM_RANGE(0xfe08, 0xfe08) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_device, status_r, control_w) /* fe08-fe0F 6850 ACIA Serial controller */ + AM_RANGE(0xfe09, 0xfe09) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_device, data_r, data_w) + AM_RANGE(0xfe10, 0xfe17) AM_READWRITE(bbc_fe_r, bbc_SerialULA_w) /* fe10-fe17 Serial ULA Serial system chip */ + AM_RANGE(0xfe18, 0xfe1f) AM_READ_PORT("S11") /* fe18-fe1f INTOFF/STATID ECONET Interrupt Off / ID No. */ + AM_RANGE(0xfe20, 0xfe2f) AM_WRITE(bbc_videoULA_w) /* R: fe20-fe2f INTON ECONET Interrupt On */ + /* W: fe20-fe2f Video ULA Video system chip */ + AM_RANGE(0xfe40, 0xfe5f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) /* fe40-fe5f 6522 VIA SYSTEM VIA */ + AM_RANGE(0xfe60, 0xfe7f) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) /* fe60-fe7f 6522 VIA USER VIA */ + /* fe80-fe9f FDC Floppy disc controller */ + AM_RANGE(0xfea0, 0xfebf) AM_READ(bbc_fe_r) /* fea0-febf 68B54 ADLC ECONET controller */ + AM_RANGE(0xfec0, 0xfedf) AM_DEVREADWRITE("upd7002", upd7002_device, read, write) /* fec0-fedf uPD7002 Analogue to digital converter */ + AM_RANGE(0xfee0, 0xfeff) AM_READ(bbc_fe_r) /* fee0-feff Tube ULA Tube system interface */ + AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("os", 0x3f00) /* ff00-ffff OS ROM (continued) */ +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( bbcb_mem, AS_PROGRAM, 8, bbc_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorya1_w) /* 0000-3fff Regular Ram */ + AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank3") AM_WRITE(bbc_memoryb3_w) /* 4000-7fff Regular Ram */ + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank4") AM_WRITE(bbc_memoryb4_w) /* 8000-bfff Paged ROM */ + AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectb_w) /* R: fe30-fe3f NC Not Connected */ + /* W: fe30-fe3f 84LS161 Paged ROM selector */ + AM_RANGE(0xfe80, 0xfe83) AM_DEVICE("i8271" , i8271_device, map) /* fe80-fe9f 8271 FDC Floppy disc controller */ + AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("i8271", i8271_device, data_r, data_w) /* fe80-fe9f 8271 FDC Floppy disc controller */ + AM_IMPORT_FROM(bbc_base) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(bbcb1770_mem, AS_PROGRAM, 8, bbc_state) + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorya1_w) /* 0000-3fff Regular Ram */ + AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank3") AM_WRITE(bbc_memoryb3_w) /* 4000-7fff Regular Ram */ + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank4") AM_WRITE(bbc_memoryb4_w) /* 8000-bfff Paged ROM */ + AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectb_w) /* R: fe30-fe3f NC Not Connected */ + /* W: fe30-fe3f 84LS161 Paged ROM selector */ + AM_RANGE(0xfe80, 0xfe83) AM_WRITE(bbc_wd1770_status_w) /* fe80-fe83 1770 FDC Drive control register */ + AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("wd1770", wd1770_t, read, write) /* fe84-fe9f 1770 FDC Floppy disc controller */ + AM_IMPORT_FROM(bbc_base) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( bbcbp_mem, AS_PROGRAM, 8, bbc_state ) + AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorybp1_w) /* 0000-2fff Regular Ram */ + AM_RANGE(0x3000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE(bbc_memorybp2_w) /* 3000-7fff Video/Shadow Ram */ + AM_RANGE(0x8000, 0xafff) AM_READ_BANK("bank4") AM_WRITE(bbc_memorybp4_w) /* 8000-afff Paged ROM or 12K of SWRAM */ + AM_RANGE(0xb000, 0xbfff) AM_READ_BANK("bank6") /* b000-bfff Rest of paged ROM area */ + AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectbp_w) /* R: fe30-fe3f NC Not Connected */ + /* W: fe30-fe3f 84LS161 Paged ROM selector */ + AM_RANGE(0xfe80, 0xfe83) AM_WRITE(bbc_wd1770_status_w) /* fe80-fe83 1770 FDC Drive control register */ + AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("wd1770", wd1770_t, read, write) /* fe84-fe9f 1770 FDC Floppy disc controller */ + AM_IMPORT_FROM(bbc_base) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( bbcbp128_mem, AS_PROGRAM, 8, bbc_state ) + AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorybp1_w) /* 0000-2fff Regular Ram */ + AM_RANGE(0x3000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE(bbc_memorybp2_w) /* 3000-7fff Video/Shadow Ram */ + AM_RANGE(0x8000, 0xafff) AM_READ_BANK("bank4") AM_WRITE(bbc_memorybp4_128_w) /* 8000-afff Paged ROM or 12K of SWRAM */ + AM_RANGE(0xb000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE(bbc_memorybp6_128_w) /* b000-bfff Rest of paged ROM area */ + AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectbp_w) /* R: fe30-fe3f NC Not Connected */ + /* W: fe30-fe3f 84LS161 Paged ROM selector */ + AM_RANGE(0xfe80, 0xfe83) AM_WRITE(bbc_wd1770_status_w) /* fe80-fe83 1770 FDC Drive control register */ + AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("wd1770", wd1770_t, read, write) /* fe84-fe9f 1770 FDC Floppy disc controller */ + AM_IMPORT_FROM(bbc_base) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( reutapm_mem, AS_PROGRAM, 8, bbc_state ) + AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorybp1_w) /* 0000-2fff Regular Ram */ + AM_RANGE(0x3000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE(bbc_memorybp2_w) /* 3000-7fff Video/Shadow Ram */ + AM_RANGE(0x8000, 0xafff) AM_READ_BANK("bank4") AM_WRITE(bbc_memorybp4_w) /* 8000-afff Paged ROM or 12K of SWRAM */ + AM_RANGE(0xb000, 0xbfff) AM_READ_BANK("bank6") /* b000-bfff Rest of paged ROM area */ + AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectbp_w) /* R: fe30-fe3f NC Not Connected */ + /* W: fe30-fe3f 84LS161 Paged ROM selector */ + AM_RANGE(0xfe80, 0xfe83) AM_NOP /* fe80-fe83 1770 FDC Drive control register */ + AM_RANGE(0xfe84, 0xfe9f) AM_NOP /* fe84-fe9f 1770 FDC Floppy disc controller */ + AM_IMPORT_FROM(bbc_base) +ADDRESS_MAP_END + +/****************************************************************************** +&FC00-&FCFF FRED +&FD00-&FDFF JIM +&FE00-&FEFF SHEILA Read Write +&00-&07 6845 CRTC Video controller Video Controller 8 ( 2 bytes x 4 ) +&08-&0F 6850 ACIA Serial controller Serial Controller 8 ( 2 bytes x 4 ) +&10-&17 Serial ULA - Serial system chip 8 ( 1 byte x 8 ) +&18-&1F uPD7002 A to D converter A to D converter 8 ( 4 bytes x 2 ) + +&20-&23 Video ULA - Video system chip 4 ( 2 bytes x 2 ) +&24-&27 FDC Latch 1770 Control latch 1770 Control latch 4 ( 1 byte x 4 ) +&28-&2F 1770 registers 1770 Disc Controller 1770 Disc Controller 8 ( 4 bytes x 2 ) +&30-&33 ROMSEL - ROM Select 4 ( 1 byte x 4 ) +&34-&37 ACCCON ACCCON select reg. ACCCON select reg 4 ( 1 byte x 4 ) +&38-&3F NC - - +&40-&5F 6522 VIA SYSTEM VIA SYSTEM VIA 32 (16 bytes x 2 ) 1MHz +&60-&7F 6522 VIA USER VIA USER VIA 32 (16 bytes x 2 ) 1MHz +&80-&9F Int. Modem Int. Modem Int Modem +&A0-&BF 68B54 ADLC ECONET controller ECONET controller 32 ( 4 bytes x 8 ) 2MHz +&C0-&DF NC - - +&E0-&FF Tube ULA Tube system interface Tube system interface 32 (32 bytes x 1 ) 2MHz +******************************************************************************/ + + +static ADDRESS_MAP_START(bbcm_mem, AS_PROGRAM, 8, bbc_state ) + AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorybm1_w) /* 0000-2fff Regular Ram */ + AM_RANGE(0x3000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE(bbc_memorybm2_w) /* 3000-7fff Video/Shadow Ram */ + AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bank4") AM_WRITE(bbc_memorybm4_w) /* 8000-8fff Paged ROM/RAM or 4K of RAM ANDY */ + AM_RANGE(0x9000, 0xbfff) AM_READ_BANK("bank5") AM_WRITE(bbc_memorybm5_w) /* 9000-bfff Rest of paged ROM/RAM area */ + AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank7") AM_WRITE(bbc_memorybm7_w) /* c000-dfff OS ROM or 8K of RAM HAZEL */ + AM_RANGE(0xe000, 0xfbff) AM_ROM AM_REGION("os", 0x2000) /* e000-fbff OS ROM */ + AM_RANGE(0xfc00, 0xfeff) AM_READ_BANK("bank8") AM_WRITE(bbcm_w) /* processed directly because it can be ROM or hardware */ + AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("os", 0x3f00) /* ff00-ffff OS ROM (continued) */ +ADDRESS_MAP_END + + +static const rgb_t bbc_palette[8]= +{ + rgb_t(0x0ff,0x0ff,0x0ff), + rgb_t(0x000,0x0ff,0x0ff), + rgb_t(0x0ff,0x000,0x0ff), + rgb_t(0x000,0x000,0x0ff), + rgb_t(0x0ff,0x0ff,0x000), + rgb_t(0x000,0x0ff,0x000), + rgb_t(0x0ff,0x000,0x000), + rgb_t(0x000,0x000,0x000) +}; + +PALETTE_INIT_MEMBER(bbc_state, bbc) +{ + palette.set_pen_colors(0, bbc_palette, ARRAY_LENGTH(bbc_palette)); +} + + +INPUT_CHANGED_MEMBER(bbc_state::trigger_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + + +/* Port Key description Emulated key Natural key Shift 1 Shift 2 (Ctrl) */ + +static INPUT_PORTS_START(bbc_keyboard) + PORT_START("COL0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFTLOCK") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESCAPE") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("COL1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("COL2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("COL3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("COL4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \\") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("COL5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("COL6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("COL7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + + PORT_START("COL8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_ \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') PORT_CHAR('\xA3') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') + + PORT_START("COL9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("BRK") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_CHANGED_MEMBER(DEVICE_SELF, bbc_state, trigger_reset, 0) + + /* Keyboard columns 10 -> 12 are reserved for BBC Master */ + PORT_START("COL10") + PORT_START("COL11") + PORT_START("COL12") + + PORT_START("IN0") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) +INPUT_PORTS_END + + +static INPUT_PORTS_START(bbc_keypad) + PORT_MODIFY("COL10") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad /") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad #") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + + PORT_MODIFY("COL11") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad DELETE") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + + PORT_MODIFY("COL12") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad RETURN") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_STOP) PORT_CHAR(UCHAR_MAMEKEY(STOP)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(UCHAR_MAMEKEY(COMMA)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) +INPUT_PORTS_END + + +static INPUT_PORTS_START(bbc_dipswitch) + PORT_MODIFY("COL2") + PORT_DIPNAME(0x01, 0x01, "Default File System") PORT_DIPLOCATION("KBD:1") + PORT_DIPSETTING( 0x00, "NFS" ) + PORT_DIPSETTING( 0x01, "DFS" ) + + PORT_MODIFY("COL3") + PORT_DIPNAME(0x01, 0x01, "Not Used") PORT_DIPLOCATION("KBD:2") + PORT_DIPSETTING( 0x00, DEF_STR( Off )) + PORT_DIPSETTING( 0x01, DEF_STR( On )) + + PORT_MODIFY("COL4") + PORT_DIPNAME(0x01, 0x01, "Disc Timings") PORT_DIPLOCATION("KBD:3") + PORT_DIPSETTING( 0x00, DEF_STR( Off )) + PORT_DIPSETTING( 0x01, DEF_STR( On )) + + PORT_MODIFY("COL5") + PORT_DIPNAME(0x01, 0x01, "Disc Timings") PORT_DIPLOCATION("KBD:4") + PORT_DIPSETTING( 0x00, DEF_STR( Off )) + PORT_DIPSETTING( 0x01, DEF_STR( On )) + + PORT_MODIFY("COL6") + PORT_DIPNAME(0x01, 0x01, "Boot") PORT_DIPLOCATION("KBD:5") + PORT_DIPSETTING( 0x00, "SHIFT" ) + PORT_DIPSETTING( 0x01, "SHIFT-BREAK" ) + + PORT_MODIFY("COL7") + PORT_DIPNAME(0x01, 0x01, "Screen Mode") PORT_DIPLOCATION("KBD:6") + PORT_DIPSETTING( 0x00, "+0" ) + PORT_DIPSETTING( 0x01, "+4" ) + + PORT_MODIFY("COL8") + PORT_DIPNAME(0x01, 0x01, "Screen Mode") PORT_DIPLOCATION("KBD:7") + PORT_DIPSETTING( 0x00, "+0" ) + PORT_DIPSETTING( 0x01, "+2" ) + + PORT_MODIFY("COL9") + PORT_DIPNAME(0x01, 0x01, "Screen Mode") PORT_DIPLOCATION("KBD:8") + PORT_DIPSETTING( 0x00, "+0" ) + PORT_DIPSETTING( 0x01, "+1" ) +INPUT_PORTS_END + + +static INPUT_PORTS_START(bbc_links) + PORT_START("S11") + PORT_DIPNAME(0xff, 0xfe, "Econet ID") PORT_DIPLOCATION("S11:1,2,3,4,5,6,7,8") + PORT_DIPSETTING( 0x00, "0" ) PORT_DIPSETTING( 0x01, "1" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x05, "5" ) PORT_DIPSETTING( 0x06, "6" ) PORT_DIPSETTING( 0x07, "7" ) PORT_DIPSETTING( 0x08, "8" ) PORT_DIPSETTING( 0x09, "9" ) + PORT_DIPSETTING( 0x0a, "10" ) PORT_DIPSETTING( 0x0b, "11" ) PORT_DIPSETTING( 0x0c, "12" ) PORT_DIPSETTING( 0x0d, "13" ) PORT_DIPSETTING( 0x0e, "14" ) + PORT_DIPSETTING( 0x0f, "15" ) PORT_DIPSETTING( 0x10, "16" ) PORT_DIPSETTING( 0x11, "17" ) PORT_DIPSETTING( 0x12, "18" ) PORT_DIPSETTING( 0x13, "19" ) + PORT_DIPSETTING( 0x14, "20" ) PORT_DIPSETTING( 0x15, "21" ) PORT_DIPSETTING( 0x16, "22" ) PORT_DIPSETTING( 0x17, "23" ) PORT_DIPSETTING( 0x18, "24" ) + PORT_DIPSETTING( 0x19, "25" ) PORT_DIPSETTING( 0x1a, "26" ) PORT_DIPSETTING( 0x1b, "27" ) PORT_DIPSETTING( 0x1c, "28" ) PORT_DIPSETTING( 0x1d, "29" ) + PORT_DIPSETTING( 0x1e, "30" ) PORT_DIPSETTING( 0x1f, "31" ) PORT_DIPSETTING( 0x20, "32" ) PORT_DIPSETTING( 0x21, "33" ) PORT_DIPSETTING( 0x22, "34" ) + PORT_DIPSETTING( 0x23, "35" ) PORT_DIPSETTING( 0x24, "36" ) PORT_DIPSETTING( 0x25, "37" ) PORT_DIPSETTING( 0x26, "38" ) PORT_DIPSETTING( 0x27, "39" ) + PORT_DIPSETTING( 0x28, "40" ) PORT_DIPSETTING( 0x29, "41" ) PORT_DIPSETTING( 0x2a, "42" ) PORT_DIPSETTING( 0x2b, "43" ) PORT_DIPSETTING( 0x2c, "44" ) + PORT_DIPSETTING( 0x2d, "45" ) PORT_DIPSETTING( 0x2e, "46" ) PORT_DIPSETTING( 0x2f, "47" ) PORT_DIPSETTING( 0x30, "48" ) PORT_DIPSETTING( 0x31, "49" ) + PORT_DIPSETTING( 0x32, "50" ) PORT_DIPSETTING( 0x33, "51" ) PORT_DIPSETTING( 0x34, "52" ) PORT_DIPSETTING( 0x35, "53" ) PORT_DIPSETTING( 0x36, "54" ) + PORT_DIPSETTING( 0x37, "15" ) PORT_DIPSETTING( 0x38, "56" ) PORT_DIPSETTING( 0x39, "57" ) PORT_DIPSETTING( 0x3a, "58" ) PORT_DIPSETTING( 0x3b, "59" ) + PORT_DIPSETTING( 0x3c, "60" ) PORT_DIPSETTING( 0x3d, "61" ) PORT_DIPSETTING( 0x3e, "62" ) PORT_DIPSETTING( 0x3f, "63" ) PORT_DIPSETTING( 0x40, "64" ) + PORT_DIPSETTING( 0x41, "65" ) PORT_DIPSETTING( 0x42, "66" ) PORT_DIPSETTING( 0x43, "67" ) PORT_DIPSETTING( 0x44, "68" ) PORT_DIPSETTING( 0x45, "69" ) + PORT_DIPSETTING( 0x46, "70" ) PORT_DIPSETTING( 0x47, "71" ) PORT_DIPSETTING( 0x48, "72" ) PORT_DIPSETTING( 0x49, "73" ) PORT_DIPSETTING( 0x4a, "74" ) + PORT_DIPSETTING( 0x4b, "75" ) PORT_DIPSETTING( 0x4c, "76" ) PORT_DIPSETTING( 0x4d, "77" ) PORT_DIPSETTING( 0x4e, "78" ) PORT_DIPSETTING( 0x4f, "79" ) + PORT_DIPSETTING( 0x50, "80" ) PORT_DIPSETTING( 0x51, "81" ) PORT_DIPSETTING( 0x52, "82" ) PORT_DIPSETTING( 0x53, "83" ) PORT_DIPSETTING( 0x54, "84" ) + PORT_DIPSETTING( 0x55, "85" ) PORT_DIPSETTING( 0x56, "86" ) PORT_DIPSETTING( 0x57, "87" ) PORT_DIPSETTING( 0x58, "88" ) PORT_DIPSETTING( 0x59, "89" ) + PORT_DIPSETTING( 0x5a, "90" ) PORT_DIPSETTING( 0x5b, "91" ) PORT_DIPSETTING( 0x5c, "92" ) PORT_DIPSETTING( 0x5d, "93" ) PORT_DIPSETTING( 0x5e, "94" ) + PORT_DIPSETTING( 0x5f, "95" ) PORT_DIPSETTING( 0x60, "96" ) PORT_DIPSETTING( 0x61, "97" ) PORT_DIPSETTING( 0x62, "98" ) PORT_DIPSETTING( 0x63, "99" ) + PORT_DIPSETTING( 0x64, "100" ) PORT_DIPSETTING( 0x65, "101" ) PORT_DIPSETTING( 0x66, "102" ) PORT_DIPSETTING( 0x67, "103" ) PORT_DIPSETTING( 0x68, "104" ) + PORT_DIPSETTING( 0x69, "105" ) PORT_DIPSETTING( 0x6a, "106" ) PORT_DIPSETTING( 0x6b, "107" ) PORT_DIPSETTING( 0x6c, "108" ) PORT_DIPSETTING( 0x6d, "109" ) + PORT_DIPSETTING( 0x6e, "110" ) PORT_DIPSETTING( 0x6f, "111" ) PORT_DIPSETTING( 0x70, "112" ) PORT_DIPSETTING( 0x71, "113" ) PORT_DIPSETTING( 0x72, "114" ) + PORT_DIPSETTING( 0x73, "115" ) PORT_DIPSETTING( 0x74, "116" ) PORT_DIPSETTING( 0x75, "117" ) PORT_DIPSETTING( 0x76, "118" ) PORT_DIPSETTING( 0x77, "119" ) + PORT_DIPSETTING( 0x78, "120" ) PORT_DIPSETTING( 0x79, "121" ) PORT_DIPSETTING( 0x7a, "122" ) PORT_DIPSETTING( 0x7b, "123" ) PORT_DIPSETTING( 0x7c, "124" ) + PORT_DIPSETTING( 0x7d, "125" ) PORT_DIPSETTING( 0x7e, "126" ) PORT_DIPSETTING( 0x7f, "127" ) PORT_DIPSETTING( 0x80, "128" ) PORT_DIPSETTING( 0x81, "129" ) + PORT_DIPSETTING( 0x82, "130" ) PORT_DIPSETTING( 0x83, "131" ) PORT_DIPSETTING( 0x84, "132" ) PORT_DIPSETTING( 0x85, "133" ) PORT_DIPSETTING( 0x86, "134" ) + PORT_DIPSETTING( 0x87, "135" ) PORT_DIPSETTING( 0x88, "136" ) PORT_DIPSETTING( 0x89, "137" ) PORT_DIPSETTING( 0x8a, "138" ) PORT_DIPSETTING( 0x8b, "139" ) + PORT_DIPSETTING( 0x8c, "140" ) PORT_DIPSETTING( 0x8d, "141" ) PORT_DIPSETTING( 0x8e, "142" ) PORT_DIPSETTING( 0x8f, "143" ) PORT_DIPSETTING( 0x90, "144" ) + PORT_DIPSETTING( 0x91, "145" ) PORT_DIPSETTING( 0x92, "146" ) PORT_DIPSETTING( 0x93, "147" ) PORT_DIPSETTING( 0x94, "148" ) PORT_DIPSETTING( 0x95, "149" ) + PORT_DIPSETTING( 0x96, "150" ) PORT_DIPSETTING( 0x97, "151" ) PORT_DIPSETTING( 0x98, "152" ) PORT_DIPSETTING( 0x99, "153" ) PORT_DIPSETTING( 0x9a, "154" ) + PORT_DIPSETTING( 0x9b, "155" ) PORT_DIPSETTING( 0x9c, "156" ) PORT_DIPSETTING( 0x9d, "157" ) PORT_DIPSETTING( 0x9e, "158" ) PORT_DIPSETTING( 0x9f, "159" ) + PORT_DIPSETTING( 0xa0, "160" ) PORT_DIPSETTING( 0xa1, "161" ) PORT_DIPSETTING( 0xa2, "162" ) PORT_DIPSETTING( 0xa3, "163" ) PORT_DIPSETTING( 0xa4, "164" ) + PORT_DIPSETTING( 0xa5, "165" ) PORT_DIPSETTING( 0xa6, "166" ) PORT_DIPSETTING( 0xa7, "167" ) PORT_DIPSETTING( 0xa8, "168" ) PORT_DIPSETTING( 0xa9, "169" ) + PORT_DIPSETTING( 0xaa, "170" ) PORT_DIPSETTING( 0xab, "171" ) PORT_DIPSETTING( 0xac, "172" ) PORT_DIPSETTING( 0xad, "173" ) PORT_DIPSETTING( 0xae, "174" ) + PORT_DIPSETTING( 0xaf, "175" ) PORT_DIPSETTING( 0xb0, "176" ) PORT_DIPSETTING( 0xb1, "177" ) PORT_DIPSETTING( 0xb2, "178" ) PORT_DIPSETTING( 0xb3, "179" ) + PORT_DIPSETTING( 0xb4, "180" ) PORT_DIPSETTING( 0xb5, "181" ) PORT_DIPSETTING( 0xb6, "182" ) PORT_DIPSETTING( 0xb7, "183" ) PORT_DIPSETTING( 0xb8, "184" ) + PORT_DIPSETTING( 0xb9, "185" ) PORT_DIPSETTING( 0xba, "186" ) PORT_DIPSETTING( 0xbb, "187" ) PORT_DIPSETTING( 0xbc, "188" ) PORT_DIPSETTING( 0xbd, "189" ) + PORT_DIPSETTING( 0xbe, "190" ) PORT_DIPSETTING( 0xbf, "191" ) PORT_DIPSETTING( 0xc0, "192" ) PORT_DIPSETTING( 0xc1, "193" ) PORT_DIPSETTING( 0xc2, "194" ) + PORT_DIPSETTING( 0xc3, "195" ) PORT_DIPSETTING( 0xc4, "196" ) PORT_DIPSETTING( 0xc5, "197" ) PORT_DIPSETTING( 0xc6, "198" ) PORT_DIPSETTING( 0xc7, "199" ) + PORT_DIPSETTING( 0xc8, "200" ) PORT_DIPSETTING( 0xc9, "201" ) PORT_DIPSETTING( 0xca, "202" ) PORT_DIPSETTING( 0xcb, "203" ) PORT_DIPSETTING( 0xcc, "204" ) + PORT_DIPSETTING( 0xcd, "205" ) PORT_DIPSETTING( 0xce, "206" ) PORT_DIPSETTING( 0xcf, "207" ) PORT_DIPSETTING( 0xd0, "208" ) PORT_DIPSETTING( 0xd1, "209" ) + PORT_DIPSETTING( 0xd2, "210" ) PORT_DIPSETTING( 0xd3, "211" ) PORT_DIPSETTING( 0xd4, "212" ) PORT_DIPSETTING( 0xd5, "213" ) PORT_DIPSETTING( 0xd6, "214" ) + PORT_DIPSETTING( 0xd7, "215" ) PORT_DIPSETTING( 0xd8, "216" ) PORT_DIPSETTING( 0xd9, "217" ) PORT_DIPSETTING( 0xda, "218" ) PORT_DIPSETTING( 0xdb, "219" ) + PORT_DIPSETTING( 0xdc, "220" ) PORT_DIPSETTING( 0xdd, "221" ) PORT_DIPSETTING( 0xde, "222" ) PORT_DIPSETTING( 0xdf, "223" ) PORT_DIPSETTING( 0xe0, "224" ) + PORT_DIPSETTING( 0xe1, "225" ) PORT_DIPSETTING( 0xe2, "226" ) PORT_DIPSETTING( 0xe3, "227" ) PORT_DIPSETTING( 0xe4, "228" ) PORT_DIPSETTING( 0xe5, "229" ) + PORT_DIPSETTING( 0xe6, "230" ) PORT_DIPSETTING( 0xe7, "231" ) PORT_DIPSETTING( 0xe8, "232" ) PORT_DIPSETTING( 0xe9, "233" ) PORT_DIPSETTING( 0xea, "234" ) + PORT_DIPSETTING( 0xeb, "235" ) PORT_DIPSETTING( 0xec, "236" ) PORT_DIPSETTING( 0xed, "237" ) PORT_DIPSETTING( 0xee, "238" ) PORT_DIPSETTING( 0xef, "239" ) + PORT_DIPSETTING( 0xf0, "240" ) PORT_DIPSETTING( 0xf1, "241" ) PORT_DIPSETTING( 0xf2, "242" ) PORT_DIPSETTING( 0xf3, "243" ) PORT_DIPSETTING( 0xf4, "244" ) + PORT_DIPSETTING( 0xf5, "245" ) PORT_DIPSETTING( 0xf6, "246" ) PORT_DIPSETTING( 0xf7, "247" ) PORT_DIPSETTING( 0xf8, "248" ) PORT_DIPSETTING( 0xf9, "249" ) + PORT_DIPSETTING( 0xfa, "250" ) PORT_DIPSETTING( 0xfb, "251" ) PORT_DIPSETTING( 0xfc, "252" ) PORT_DIPSETTING( 0xfd, "253" ) PORT_DIPSETTING( 0xfe, "254" ) + PORT_DIPSETTING( 0xff, "255" ) +INPUT_PORTS_END + + +static INPUT_PORTS_START(bbc_joy) + PORT_START("JOY0") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(1) + + PORT_START("JOY1") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(1) + + PORT_START("JOY2") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(2) + + PORT_START("JOY3") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(2) +INPUT_PORTS_END + + +static INPUT_PORTS_START(bbc_config) + PORT_START("BBCCONFIG") + + PORT_CONFNAME( 0x01, 0x00, "Speech Upgrade" ) + PORT_CONFSETTING( 0x00, DEF_STR( On ) ) + PORT_CONFSETTING( 0x01, DEF_STR( Off ) ) + + PORT_CONFNAME( 0x18, 0x00, "Sideways RAM Type" ) + PORT_CONFSETTING( 0x00, DEF_STR( None ) ) + PORT_CONFSETTING( 0x08, "Solidisk 128K (fe62)" ) + PORT_CONFSETTING( 0x10, "Acorn 64K (fe30)" ) + PORT_CONFSETTING( 0x18, "Acorn 128K (fe30)" ) +// PORT_CONFSETTING( 0x20, "ATPL Sidewise 16K" ) +INPUT_PORTS_END + +static INPUT_PORTS_START(bbca) + PORT_INCLUDE(bbc_keyboard) + PORT_INCLUDE(bbc_dipswitch) +INPUT_PORTS_END + +static INPUT_PORTS_START(bbcb) + PORT_INCLUDE(bbc_config) + PORT_INCLUDE(bbc_keyboard) + PORT_INCLUDE(bbc_dipswitch) + PORT_INCLUDE(bbc_links) + PORT_INCLUDE(bbc_joy) +INPUT_PORTS_END + +static INPUT_PORTS_START(abc) + PORT_INCLUDE(bbc_keyboard) + PORT_INCLUDE(bbc_keypad) + PORT_INCLUDE(bbc_dipswitch) + PORT_INCLUDE(bbc_links) + PORT_INCLUDE(bbc_joy) +INPUT_PORTS_END + +static INPUT_PORTS_START(bbcm) + PORT_INCLUDE(bbc_keyboard) + PORT_INCLUDE(bbc_keypad) + PORT_INCLUDE(bbc_joy) +INPUT_PORTS_END + + +INTERRUPT_GEN_MEMBER(bbc_state::bbcb_vsync) +{ + via6522_device *via_0 = machine().device("via6522_0"); + via_0->write_ca1(1); + via_0->write_ca1(0); +} + + +WRITE_LINE_MEMBER(bbc_state::bbcb_acia6850_irq_w) +{ + m_acia_irq = state; + + check_interrupts(); +} + + +FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_525sd ) + FLOPPY_BBC_SSD_525_FORMAT, + FLOPPY_BBC_DSD_525_FORMAT +FLOPPY_FORMATS_END + +FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_525dd ) + FLOPPY_BBC_SSD_525_FORMAT, + FLOPPY_BBC_DSD_525_FORMAT, + FLOPPY_BBC_ADF_525_FORMAT +FLOPPY_FORMATS_END + +FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_35dd ) + FLOPPY_BBC_ADF_35_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( bbc_floppies_525 ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) + SLOT_INTERFACE("sd", FLOPPY_525_SD) + SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) + SLOT_INTERFACE("dd", FLOPPY_525_DD) + SLOT_INTERFACE("ssqd", FLOPPY_525_SSQD) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( bbc_floppies_35 ) + SLOT_INTERFACE("qd", FLOPPY_35_DD) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER(bbc_state::econet_clk_w) +{ + m_adlc->rxc_w(state); + m_adlc->txc_w(state); +} + +// 4 x EPROM sockets (16K) in BBC-A, these should grow to 16 for BBC-B and later... +static MACHINE_CONFIG_FRAGMENT( bbc_eprom_sockets ) + MCFG_GENERIC_SOCKET_ADD("exp_rom1", generic_linear_slot, "bbc_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(bbc_state, exp1_load) + + MCFG_GENERIC_SOCKET_ADD("exp_rom2", generic_linear_slot, "bbc_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(bbc_state, exp2_load) + + MCFG_GENERIC_SOCKET_ADD("exp_rom3", generic_linear_slot, "bbc_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(bbc_state, exp3_load) + + MCFG_GENERIC_SOCKET_ADD("exp_rom4", generic_linear_slot, "bbc_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(bbc_state, exp4_load) +MACHINE_CONFIG_END + + +/*************************************************************************** + + BBC Micro + +****************************************************************************/ + + +static MACHINE_CONFIG_START( bbca, bbc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 2000000) /* 2.00 MHz */ + MCFG_CPU_PROGRAM_MAP(bbca_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", bbc_state, bbcb_vsync) /* screen refresh interrupts */ + MCFG_CPU_PERIODIC_INT_DRIVER(bbc_state, bbcb_keyscan, 1000) /* scan keyboard */ + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K") + MCFG_RAM_DEFAULT_VALUE(0x00) + + MCFG_MACHINE_START_OVERRIDE(bbc_state, bbca) + MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbca) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_SIZE(640, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 256-1) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(128)) + MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update) + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(bbc_state,bbc) + + MCFG_DEVICE_ADD("saa5050", SAA5050, XTAL_12MHz/2) + MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) + + /* crtc */ + MCFG_MC6845_ADD("mc6845", MC6845, "screen", 2000000) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(bbc_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(bbc_state, bbc_vsync)) + + MCFG_VIDEO_START_OVERRIDE(bbc_state, bbca) + + MCFG_DEFAULT_LAYOUT(layout_bbc) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("sn76489", SN76489, 4000000) /* 4 MHz */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(bbc_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("bbc_cass") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_ls_a", "bbca_cass") + + /* acia */ + MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(bbc_state, bbc_txd_w)) + MCFG_ACIA6850_RTS_HANDLER(WRITELINE(bbc_state, bbc_rts_w)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_acia6850_irq_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(WRITELINE(bbc_state, write_rxd_serial)) + MCFG_RS232_DCD_HANDLER(WRITELINE(bbc_state, write_dcd_serial)) + MCFG_RS232_CTS_HANDLER(WRITELINE(bbc_state, write_cts_serial)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, XTAL_16MHz / 13) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bbc_state, write_acia_clock)) + + /* system via */ + MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) + MCFG_VIA6522_READPA_HANDLER(READ8(bbc_state, bbcb_via_system_read_porta)) + MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_system_read_portb)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(bbc_state, bbcb_via_system_write_porta)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_system_write_portb)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_system_irq_w)) + + /* EPROM sockets */ + MCFG_FRAGMENT_ADD(bbc_eprom_sockets) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcb, bbca ) + /* basic machine hardware */ + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(bbcb_mem) + + MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcb) + MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcb) + MCFG_VIDEO_START_OVERRIDE(bbc_state, bbcb) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_DEFAULT_VALUE(0x00) + + /* speech hardware */ + MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) + MCFG_SOUND_ADD("tms5220", TMS5220, 640000) + MCFG_TMS52XX_SPEECHROM("vsm") + + /* user via */ + MCFG_DEVICE_ADD("via6522_1", VIA6522, 1000000) + MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_user_read_portb)) + MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_user_write_portb)) + MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_user_irq_w)) + + /* adc */ + MCFG_DEVICE_ADD("upd7002", UPD7002, 0) + MCFG_UPD7002_GET_ANALOGUE_CB(bbc_state, BBC_get_analogue_input) + MCFG_UPD7002_EOC_CB(bbc_state, BBC_uPD7002_EOC) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522_1", via6522_device, write_ca1)) MCFG_DEVCB_INVERT /* ack seems to be inverted? */ + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* fdc */ + MCFG_DEVICE_ADD("i8271" , I8271 , 0) + MCFG_I8271_IRQ_CALLBACK(WRITELINE(bbc_state, bbc_i8271_interrupt)) + MCFG_I8271_HDL_CALLBACK(WRITELINE(bbc_state, motor_w)) + MCFG_FLOPPY_DRIVE_ADD("i8271:0", bbc_floppies_525, "qd", bbc_state::floppy_formats_525sd) + MCFG_FLOPPY_DRIVE_ADD("i8271:1", bbc_floppies_525, "qd", bbc_state::floppy_formats_525sd) + + /* software lists */ + MCFG_DEVICE_REMOVE("cass_ls_a") + MCFG_SOFTWARE_LIST_ADD("cass_ls_b", "bbcb_cass") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_a", "bbca_cass") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED(bbcb1770, bbcb) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(bbcb1770_mem) + + /* fdc */ + MCFG_DEVICE_REMOVE("i8271") + + MCFG_WD1770_ADD("wd1770", XTAL_16MHz / 2) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("wd1770:0", bbc_floppies_525, "qd", bbc_state::floppy_formats_525dd) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("wd1770:1", bbc_floppies_525, "qd", bbc_state::floppy_formats_525dd) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcb_de, bbcb ) + /* software lists */ + MCFG_DEVICE_REMOVE("cass_ls_b") + MCFG_SOFTWARE_LIST_ADD("flop_ls_b_de", "bbcb_de_cass") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_b", "bbcb_cass") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcb_us, bbcb ) + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_REFRESH_RATE(60) + + /* software lists */ + MCFG_DEVICE_REMOVE("cass_ls_b") + MCFG_SOFTWARE_LIST_ADD("flop_ls_b_us", "bbcb_us_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_b", "bbcb_cass") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcbp, bbcb1770 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY( "maincpu" ) /* M6512 */ + MCFG_CPU_PROGRAM_MAP(bbcbp_mem) + + MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcbp) + MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcbp) + MCFG_VIDEO_START_OVERRIDE(bbc_state, bbcbp) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcbp128, bbcb1770 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY( "maincpu" ) /* M6512 */ + MCFG_CPU_PROGRAM_MAP(bbcbp128_mem) + + MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcbp) + MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcbp) + MCFG_VIDEO_START_OVERRIDE(bbc_state, bbcbp) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Acorn Business Computers + +****************************************************************************/ + + +static MACHINE_CONFIG_DERIVED( abc110, bbcbp ) + /* fdc */ + MCFG_DEVICE_REMOVE("wd1770:1") + + /* Add Z80 co-processor */ + + /* Add ADAPTEC ACB-4000 Winchester Disc Controller */ + + /* Add 10MB ST-412 Winchester */ + +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( abc210, bbcbp ) + /* fdc */ + MCFG_DEVICE_REMOVE("wd1770:1") + + /* Add 32016 co-processor */ + + /* Add ADAPTEC ACB-4000 Winchester Disc Controller */ + + /* Add 10MB ST-412 Winchester ABC210 */ + + /* Add 20MB ST-412 Winchester Cambridge */ + +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( abc310, bbcbp ) + /* fdc */ + MCFG_DEVICE_REMOVE("wd1770:1") + + /* Add 80286 co-processor */ + + /* Add ADAPTEC ACB-4000 Winchester Disc Controller */ + + /* Add 10MB ST-412 Winchester */ + +MACHINE_CONFIG_END + + +/*************************************************************************** + + Reuters APM Board (Application Processor Module) + +****************************************************************************/ + + +static MACHINE_CONFIG_DERIVED( reutapm, bbcbp ) + /* basic machine hardware */ + MCFG_CPU_MODIFY( "maincpu" ) /* M6512 */ + MCFG_CPU_PROGRAM_MAP(reutapm_mem) + + /* sound hardware */ + MCFG_DEVICE_REMOVE("mono") + MCFG_DEVICE_REMOVE("sn76489") + MCFG_DEVICE_REMOVE("vsm") + MCFG_DEVICE_REMOVE("tms5220") + + /* cassette */ + MCFG_DEVICE_REMOVE( "cassette" ) + + /* fdc */ + MCFG_DEVICE_REMOVE("wd1770") + + /* software lists */ + MCFG_DEVICE_REMOVE("cass_ls_a") + MCFG_DEVICE_REMOVE("cass_ls_b") +MACHINE_CONFIG_END + + +/*************************************************************************** + + BBC Master Series + +****************************************************************************/ + + +static MACHINE_CONFIG_START( bbcm, bbc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M65SC02, 2000000) /* 2.00 MHz */ + MCFG_CPU_PROGRAM_MAP(bbcm_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", bbc_state, bbcb_vsync) /* screen refresh interrupts */ + MCFG_CPU_PERIODIC_INT_DRIVER(bbc_state, bbcb_keyscan, 1000) /* scan keyboard */ + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_DEFAULT_VALUE(0x00) + + MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcm) + MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcm) + + MCFG_DEFAULT_LAYOUT(layout_bbc) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(128)) + MCFG_SCREEN_SIZE(640, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(bbc_state,bbc) + + MCFG_DEVICE_ADD("saa5050", SAA5050, XTAL_12MHz/2) + MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) + + /* crtc */ + MCFG_MC6845_ADD("mc6845", MC6845, "screen", 2000000) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(bbc_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(bbc_state, bbc_vsync)) + + MCFG_VIDEO_START_OVERRIDE(bbc_state, bbcm) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("sn76489", SN76489, 4000000) /* 4 MHz */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* rtc and cmos */ + MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522_1", via6522_device, write_ca1)) MCFG_DEVCB_INVERT /* ack seems to be inverted? */ + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(bbc_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("bbc_cass") + + // 2 x EPROM sockets (32K) in BBC-Master + MCFG_GENERIC_SOCKET_ADD("exp_rom1", generic_plain_slot, "bbcm_cart") + MCFG_GENERIC_LOAD(bbc_state, bbcm_exp1_load) + + MCFG_GENERIC_SOCKET_ADD("exp_rom2", generic_plain_slot, "bbcm_cart") + MCFG_GENERIC_LOAD(bbc_state, bbcm_exp2_load) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_ls_m", "bbcm_cass") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_a", "bbca_cass") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_b", "bbcb_cass") + MCFG_SOFTWARE_LIST_ADD("cart_ls_m", "bbcm_cart") + + /* acia */ + MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(bbc_state, bbc_txd_w)) + MCFG_ACIA6850_RTS_HANDLER(WRITELINE(bbc_state, bbc_rts_w)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_acia6850_irq_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(WRITELINE(bbc_state, write_rxd_serial)) + MCFG_RS232_DCD_HANDLER(WRITELINE(bbc_state, write_dcd_serial)) + MCFG_RS232_CTS_HANDLER(WRITELINE(bbc_state, write_cts_serial)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, XTAL_16MHz / 13) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bbc_state, write_acia_clock)) + + /* adc */ + MCFG_DEVICE_ADD("upd7002", UPD7002, 0) + MCFG_UPD7002_GET_ANALOGUE_CB(bbc_state, BBC_get_analogue_input) + MCFG_UPD7002_EOC_CB(bbc_state, BBC_uPD7002_EOC) + + /* system via */ + MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) + MCFG_VIA6522_READPA_HANDLER(READ8(bbc_state, bbcb_via_system_read_porta)) + MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_system_read_portb)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(bbc_state, bbcb_via_system_write_porta)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_system_write_portb)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_system_irq_w)) + + /* user via */ + MCFG_DEVICE_ADD("via6522_1", VIA6522, 1000000) + MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_user_read_portb)) + MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_user_write_portb)) + MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_user_irq_w)) + + /* fdc */ + MCFG_WD1770_ADD("wd1770", XTAL_16MHz / 2) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("wd1770:0", bbc_floppies_525, "qd", bbc_state::floppy_formats_525dd) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("wd1770:1", bbc_floppies_525, "qd", bbc_state::floppy_formats_525dd) + MCFG_FLOPPY_DRIVE_SOUND(true) + + /* econet */ + MCFG_DEVICE_ADD("mc6854", MC6854, 0) + MCFG_MC6854_OUT_TXD_CB(DEVWRITELINE(ECONET_TAG, econet_device, data_w)) + MCFG_ECONET_ADD() + MCFG_ECONET_CLK_CALLBACK(WRITELINE(bbc_state, econet_clk_w)) + MCFG_ECONET_DATA_CALLBACK(DEVWRITELINE("mc6854", mc6854_device, set_rx)) + MCFG_ECONET_SLOT_ADD("econet254", 254, econet_devices, NULL) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcmt, bbcm ) + + /* Add 65C102 co-processor */ + +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcmaiv, bbcm ) + + /* Add 65C102 co-processor */ + + /* Add Philips VP415 Laserdisc player */ + + /* Add Acorn Tracker Ball */ + +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcmet, bbcm ) + /* sound hardware */ + MCFG_DEVICE_REMOVE("mono") + MCFG_DEVICE_REMOVE("sn76489") + + /* printer */ + MCFG_DEVICE_REMOVE("centronics") + + /* cassette */ + MCFG_DEVICE_REMOVE("cassette") + + /* software lists */ + MCFG_SOFTWARE_LIST_REMOVE("cass_ls_m") + MCFG_SOFTWARE_LIST_REMOVE("cass_ls_a") + MCFG_SOFTWARE_LIST_REMOVE("cass_ls_b") + + /* acia */ + MCFG_DEVICE_REMOVE("acia6850") + MCFG_DEVICE_REMOVE(RS232_TAG) + MCFG_DEVICE_REMOVE("acia_clock") + + /* devices */ + MCFG_DEVICE_REMOVE("upd7002") + MCFG_DEVICE_REMOVE("via6522_1") + + /* fdc */ + MCFG_DEVICE_REMOVE("wd1770") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcm512, bbcm ) + + /* Add Intel 80186 co-processor */ + +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( bbcmarm, bbcm ) + + /* Add ARM co-processor */ + +MACHINE_CONFIG_END + + +/*************************************************************************** + + BBC Master Compact + +****************************************************************************/ + + +static MACHINE_CONFIG_DERIVED( bbcmc, bbcm ) + /* cassette */ + MCFG_DEVICE_REMOVE("cassette") + + /* fdc */ + MCFG_DEVICE_REMOVE("wd1770") + + MCFG_WD1772_ADD("wd1772", XTAL_16MHz / 2) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("wd1772:0", bbc_floppies_35, "qd", bbc_state::floppy_formats_35dd) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("wd1772:1", bbc_floppies_35, NULL, bbc_state::floppy_formats_35dd) + MCFG_FLOPPY_DRIVE_SOUND(true) + + /* eeprom pcd8572 */ + //MCFG_DEVICE_REMOVE("rtc") + + /* software lists */ + MCFG_SOFTWARE_LIST_REMOVE("cass_ls_m") + MCFG_SOFTWARE_LIST_REMOVE("cass_ls_a") + MCFG_SOFTWARE_LIST_REMOVE("cass_ls_b") + MCFG_SOFTWARE_LIST_REMOVE("cart_ls_m") + MCFG_SOFTWARE_LIST_ADD("flop_ls_mc", "bbcmc_flop") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED(pro128s, bbcmc) + /* software lists */ + MCFG_SOFTWARE_LIST_REMOVE("flop_ls_mc") + MCFG_SOFTWARE_LIST_ADD("flop_ls_pro128s", "pro128s_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop_ls_mc", "bbcmc_flop") +MACHINE_CONFIG_END + + +/* the BBC came with 4 rom sockets on the motherboard as shown in the model A driver */ +/* you could get a number of rom upgrade boards that took this up to 16 roms as in the */ +/* model B driver */ + +ROM_START(bbca) + ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ + + ROM_REGION(0x14000,"option",0) /* ROM */ + /* rom page 0 00000 SPARE SOCKET */ + /* rom page 1 04000 SPARE SOCKET */ + /* rom page 2 08000 SPARE SOCKET */ + /* rom page 3 0c000 BASIC */ + ROM_DEFAULT_BIOS("os12b2") + ROM_SYSTEM_BIOS( 0, "os12b2", "OS 1.20 / BASIC2" ) + ROMX_LOAD("os12.rom", 0x10000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(1)) /* os */ + ROMX_LOAD("basic2.rom", 0x0c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(1)) /* rom page 3 0c000 */ + ROM_SYSTEM_BIOS( 1, "os12b1", "OS 1.20 / BASIC1" ) + ROMX_LOAD("os12.rom", 0x10000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(2)) /* os */ + ROMX_LOAD("basic1.rom", 0x0c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(2)) /* rom page 3 0c000 */ + ROM_SYSTEM_BIOS( 2, "os10b2", "OS 1.00 / BASIC2" ) + ROMX_LOAD("os10.rom", 0x10000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(3)) /* os */ + ROMX_LOAD("basic2.rom", 0x0c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(3)) /* rom page 3 0c000 */ + ROM_SYSTEM_BIOS( 3, "os10b1", "OS 1.00 / BASIC1" ) + ROMX_LOAD("os10.rom", 0x10000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(4)) /* os */ + ROMX_LOAD("basic1.rom", 0x0c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(4)) /* rom page 3 0c000 */ + /* OS0.1 does not support rom paging, load BASIC into all pages */ + ROM_SYSTEM_BIOS( 4, "os01b2", "OS 0.10 / BASIC2" ) + ROMX_LOAD("os01.rom", 0x10000, 0x4000, CRC(45ee0980) SHA1(4b0ece6dc139d5d3f4fabd023716fb6f25149b80), ROM_BIOS(5)) /* os */ + ROMX_LOAD("basic2.rom", 0x00000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(5)) /* rom page 0 00000 */ + ROMX_LOAD("basic2.rom", 0x04000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(5)) /* rom page 1 04000 */ + ROMX_LOAD("basic2.rom", 0x08000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(5)) /* rom page 2 08000 */ + ROMX_LOAD("basic2.rom", 0x0c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(5)) /* rom page 3 0c000 */ + ROM_SYSTEM_BIOS( 5, "os01b1", "OS 0.10 / BASIC1" ) + ROMX_LOAD("os01.rom", 0x10000, 0x4000, CRC(45ee0980) SHA1(4b0ece6dc139d5d3f4fabd023716fb6f25149b80), ROM_BIOS(6)) /* os */ + ROMX_LOAD("basic1.rom", 0x00000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(6)) /* rom page 0 00000 */ + ROMX_LOAD("basic1.rom", 0x04000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(6)) /* rom page 1 04000 */ + ROMX_LOAD("basic1.rom", 0x08000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(6)) /* rom page 2 08000 */ + ROMX_LOAD("basic1.rom", 0x0c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(6)) /* rom page 3 0c000 */ + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x10000, 0, 0x4000) +ROM_END + + +/* 0000- 7fff ram */ +/* 8000- bfff this area is mapped over with one of the roms from "option" region 0x00000-0x40000 */ +/* c000- ffff OS rom and memory mapped hardware at fc00-feff, from "option" region 0x40000-0x44000 */ + + +ROM_START(bbcb) + ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 */ + /* rom page 3 0c000 */ + /* rom page 4 10000 */ + /* rom page 5 14000 */ + /* rom page 6 18000 */ + /* rom page 7 1c000 */ + /* rom page 8 20000 */ + /* rom page 9 24000 */ + /* rom page 10 28000 */ + /* rom page 11 2c000 */ + /* rom page 12 30000 SPARE SOCKET */ + /* rom page 13 34000 SPARE SOCKET */ + /* rom page 14 38000 DFS */ + /* rom page 15 3c000 BASIC */ + ROM_DEFAULT_BIOS("os12b2") + ROM_SYSTEM_BIOS( 0, "os12b2", "OS 1.20 / BASIC2" ) + ROMX_LOAD("os12.rom", 0x40000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(1)) /* os */ + ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(1)) /* rom page 15 3c000 */ + ROM_SYSTEM_BIOS( 1, "os12b1", "OS 1.20 / BASIC1" ) + ROMX_LOAD("os12.rom", 0x40000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(2)) /* os */ + ROMX_LOAD("basic1.rom", 0x3c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(2)) /* rom page 15 3c000 */ + ROM_SYSTEM_BIOS( 2, "os10b2", "OS 1.00 / BASIC2" ) + ROMX_LOAD("os10.rom", 0x40000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(3)) /* os */ + ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(3)) /* rom page 15 3c000 */ + ROM_SYSTEM_BIOS( 3, "os10b1", "OS 1.00 / BASIC1" ) + ROMX_LOAD("os10.rom", 0x40000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(4)) /* os */ + ROMX_LOAD("basic1.rom", 0x3c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(4)) /* rom page 15 3c000 */ + + ROM_LOAD("dnfs.rom", 0x38000, 0x4000, CRC(8ccd2157) SHA1(7e3c536baeae84d6498a14e8405319e01ee78232)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + +ROM_START(bbcb1770) + ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 */ + /* rom page 3 0c000 */ + /* rom page 4 10000 */ + /* rom page 5 14000 */ + /* rom page 6 18000 */ + /* rom page 7 1c000 */ + /* rom page 8 20000 */ + /* rom page 9 24000 */ + /* rom page 10 28000 */ + /* rom page 11 2c000 */ + /* rom page 12 30000 SPARE SOCKET */ + /* rom page 13 34000 SPARE SOCKET */ + /* rom page 14 38000 DDFS */ + /* rom page 15 3c000 BASIC */ + ROM_DEFAULT_BIOS("os12b2") + ROM_SYSTEM_BIOS( 0, "os12b2", "OS 1.20 / BASIC2" ) + ROMX_LOAD("os12.rom", 0x40000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(1)) /* os */ + ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(1)) /* rom page 15 3c000 */ + ROM_SYSTEM_BIOS( 1, "os12b1", "OS 1.20 / BASIC1" ) + ROMX_LOAD("os12.rom", 0x40000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(2)) /* os */ + ROMX_LOAD("basic1.rom", 0x3c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(2)) /* rom page 15 3c000 */ + ROM_SYSTEM_BIOS( 2, "os10b2", "OS 1.00 / BASIC2" ) + ROMX_LOAD("os10.rom", 0x40000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(3)) /* os */ + ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(3)) /* rom page 15 3c000 */ + ROM_SYSTEM_BIOS( 3, "os10b1", "OS 1.00 / BASIC1" ) + ROMX_LOAD("os10.rom", 0x40000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(4)) /* os */ + ROMX_LOAD("basic1.rom", 0x3c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(4)) /* rom page 15 3c000 */ + + ROM_LOAD("ddfs223.rom", 0x38000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + +ROM_START(bbcb_de) + ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 */ + /* rom page 3 0c000 */ + /* rom page 4 10000 */ + /* rom page 5 14000 */ + /* rom page 6 18000 */ + /* rom page 7 1c000 */ + /* rom page 8 20000 */ + /* rom page 9 24000 */ + /* rom page 10 28000 */ + /* rom page 11 2c000 */ + /* rom page 12 30000 SPARE SOCKET */ + /* rom page 13 34000 SPARE SOCKET */ + /* rom page 14 38000 DFS */ + /* rom page 15 3c000 BASIC */ + ROM_DEFAULT_BIOS("os12") + ROM_SYSTEM_BIOS( 0, "os12", "OS 1.20 / BASIC2" ) + ROMX_LOAD("os_de.rom", 0x40000, 0x4000, CRC(b7262caf) SHA1(aadf90338ee9d1c85dfa73beba50e930c2a38f10), ROM_BIOS(1)) + ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(1)) /* rom page 15 3c000 */ + + ROM_LOAD("dfs10.rom", 0x38000, 0x4000, CRC(7e367e8c) SHA1(161f585dc45665ea77433c84afd2f95049f7f5a0)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + +ROM_START(bbcb_us) + ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 */ + /* rom page 3 0c000 */ + /* rom page 4 10000 */ + /* rom page 5 14000 */ + /* rom page 6 18000 */ + /* rom page 7 1c000 */ + /* rom page 8 20000 */ + /* rom page 9 24000 */ + /* rom page 10 28000 */ + /* rom page 11 2c000 */ + /* rom page 12 30000 SPARE SOCKET */ + /* rom page 13 34000 SPARE SOCKET */ + /* rom page 14 38000 DFS */ + /* rom page 15 3c000 BASIC */ + ROM_DEFAULT_BIOS("os10b3") + ROM_SYSTEM_BIOS( 0, "os10b3", "OS A1.0 / BASIC3" ) + ROMX_LOAD("os10_us.rom", 0x40000, 0x4000, CRC(c8e946a9) SHA1(83d91d089dca092d2c8b7c3650ff8143c9069b89), ROM_BIOS(1)) + ROMX_LOAD("basic3.rom", 0x3c000, 0x4000, CRC(161b9539) SHA1(b39014610a968789afd7695aa04d1277d874405c), ROM_BIOS(1)) /* rom page 15 3c000 */ + + ROM_LOAD("dfs10.rom", 0x38000, 0x4000, CRC(7e367e8c) SHA1(161f585dc45665ea77433c84afd2f95049f7f5a0)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phrom_us.bin", 0x0000, 0x4000, CRC(bf4b3b64) SHA1(66876702d1d95eecc034d20f25047f893a27cde5)) +ROM_END + + +ROM_START(bbcbp) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("os20") + ROM_SYSTEM_BIOS( 0, "os20", "OS 2.00" ) + ROMX_LOAD("bpos2.ic71", 0x3c000, 0x4000, CRC(9f356396) SHA1(ea7d3a7e3ee1ecfaa1483af994048057362b01f2), ROM_BIOS(1)) /* rom page 15 3C000 BASIC */ + ROM_CONTINUE( 0x40000, 0x4000) /* OS */ + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 32K IN PAGE 3 */ + /* rom page 3 0c000 SPARE SOCKET */ + /* rom page 4 10000 32K IN PAGE 5 */ + /* rom page 5 14000 ADFS */ + /* rom page 6 18000 32K IN PAGE 7 */ + /* rom page 7 1c000 DDFS */ + /* rom page 8 20000 32K IN PAGE 9 */ + /* rom page 9 24000 SPARE SOCKET */ + /* rom page 10 28000 32K IN PAGE 11 */ + /* rom page 11 2c000 SPARE SOCKET */ + /* rom page 12 30000 */ + /* rom page 13 34000 */ + /* rom page 14 38000 32K IN PAGE 15 */ + /* rom page 15 3C000 BASIC */ + ROM_LOAD("adfs130.rom", 0x14000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) + ROM_LOAD("ddfs223.rom", 0x1c000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + +ROM_START(bbcbp128) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("os20") + ROM_SYSTEM_BIOS( 0, "os20", "OS 2.00" ) + ROMX_LOAD("bpos2.ic71", 0x3c000, 0x4000, CRC(9f356396) SHA1(ea7d3a7e3ee1ecfaa1483af994048057362b01f2), ROM_BIOS(1)) /* rom page 15 3C000 BASIC */ + ROM_CONTINUE( 0x40000, 0x4000) /* OS */ + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 32K IN PAGE 3 */ + /* rom page 3 0c000 SPARE SOCKET */ + /* rom page 4 10000 32K IN PAGE 5 */ + /* rom page 5 14000 ADFS */ + /* rom page 6 18000 32K IN PAGE 7 */ + /* rom page 7 1c000 DDFS */ + /* rom page 8 20000 32K IN PAGE 9 */ + /* rom page 9 24000 SPARE SOCKET */ + /* rom page 10 28000 32K IN PAGE 11 */ + /* rom page 11 2c000 SPARE SOCKET */ + /* rom page 12 30000 */ + /* rom page 13 34000 */ + /* rom page 14 38000 32K IN PAGE 15 */ + /* rom page 15 3C000 BASIC */ + ROM_LOAD("adfs130.rom", 0x14000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) + ROM_LOAD("ddfs223.rom", 0x1c000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + +ROM_START(abc110) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos200") + ROM_SYSTEM_BIOS( 0, "mos200", "MOS2.00" ) + ROMX_LOAD("mos200.rom", 0x40000, 0x4000, CRC(5e88f994) SHA1(76235ff15d736f5def338f73ac7497c41b916505), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "mos123", "MOS1.23" ) + ROMX_LOAD("mos123.rom", 0x40000, 0x4000, CRC(90d31d08) SHA1(42a01892cf8bd2ada4db1c8b36aff80c85eb5dcb), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "mos120", "MOS1.20" ) + ROMX_LOAD("mos120.rom", 0x40000, 0x4000, CRC(0a1e83a0) SHA1(21dc3a94eef7c003b194686730fb461779f44925), ROM_BIOS(3)) + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 32K IN PAGE 3 */ + /* rom page 3 0c000 SPARE SOCKET */ + /* rom page 4 10000 32K IN PAGE 5 */ + /* rom page 5 14000 DDFS */ + /* rom page 6 18000 32K IN PAGE 7 */ + /* rom page 7 1c000 ADFS */ + /* rom page 8 20000 32K IN PAGE 9 */ + /* rom page 9 24000 SPARE SOCKET */ + /* rom page 10 28000 32K IN PAGE 11 */ + /* rom page 11 2c000 SPARE SOCKET */ + /* rom page 12 30000 */ + /* rom page 13 34000 */ + /* rom page 14 38000 32K IN PAGE 15 */ + /* rom page 15 3C000 BASIC */ + ROM_LOAD("ddfs223.rom", 0x14000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) + ROM_LOAD("adfs130.rom", 0x1c000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) + ROM_LOAD("basic200.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + +ROM_START(abc210) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos200") + ROM_SYSTEM_BIOS( 0, "mos200", "MOS2.00" ) + ROMX_LOAD("mos200.rom", 0x40000, 0x4000, CRC(5e88f994) SHA1(76235ff15d736f5def338f73ac7497c41b916505), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "mos123", "MOS1.23" ) + ROMX_LOAD("mos123.rom", 0x40000, 0x4000, CRC(90d31d08) SHA1(42a01892cf8bd2ada4db1c8b36aff80c85eb5dcb), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "mos120", "MOS1.20" ) + ROMX_LOAD("mos120.rom", 0x40000, 0x4000, CRC(0a1e83a0) SHA1(21dc3a94eef7c003b194686730fb461779f44925), ROM_BIOS(3)) + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 32K IN PAGE 3 */ + /* rom page 3 0c000 SPARE SOCKET */ + /* rom page 4 10000 32K IN PAGE 5 */ + /* rom page 5 14000 DDFS */ + /* rom page 6 18000 32K IN PAGE 7 */ + /* rom page 7 1c000 ADFS */ + /* rom page 8 20000 32K IN PAGE 9 */ + /* rom page 9 24000 SPARE SOCKET */ + /* rom page 10 28000 32K IN PAGE 11 */ + /* rom page 11 2c000 SPARE SOCKET */ + /* rom page 12 30000 */ + /* rom page 13 34000 */ + /* rom page 14 38000 32K IN PAGE 15 */ + /* rom page 15 3C000 BASIC */ + ROM_LOAD("ddfs223.rom", 0x14000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) + ROM_LOAD("adfs130.rom", 0x1c000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) + ROM_LOAD("basic200.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + +ROM_START(abc310) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos200") + ROM_SYSTEM_BIOS( 0, "mos200", "MOS2.00" ) + ROMX_LOAD("mos200.rom", 0x40000, 0x4000, CRC(5e88f994) SHA1(76235ff15d736f5def338f73ac7497c41b916505), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "mos123", "MOS1.23" ) + ROMX_LOAD("mos123.rom", 0x40000, 0x4000, CRC(90d31d08) SHA1(42a01892cf8bd2ada4db1c8b36aff80c85eb5dcb), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "mos120", "MOS1.20" ) + ROMX_LOAD("mos120.rom", 0x40000, 0x4000, CRC(0a1e83a0) SHA1(21dc3a94eef7c003b194686730fb461779f44925), ROM_BIOS(3)) + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 32K IN PAGE 3 */ + /* rom page 3 0c000 SPARE SOCKET */ + /* rom page 4 10000 32K IN PAGE 5 */ + /* rom page 5 14000 DDFS */ + /* rom page 6 18000 32K IN PAGE 7 */ + /* rom page 7 1c000 ADFS */ + /* rom page 8 20000 32K IN PAGE 9 */ + /* rom page 9 24000 SPARE SOCKET */ + /* rom page 10 28000 32K IN PAGE 11 */ + /* rom page 11 2c000 SPARE SOCKET */ + /* rom page 12 30000 */ + /* rom page 13 34000 */ + /* rom page 14 38000 32K IN PAGE 15 */ + /* rom page 15 3C000 BASIC */ + ROM_LOAD("ddfs223.rom", 0x14000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) + ROM_LOAD("adfs130.rom", 0x1c000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) + ROM_LOAD("basic200.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281)) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + +ROM_START(reutapm) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + /* rom page 0 00000 */ + /* rom page 1 04000 */ + /* rom page 2 08000 32K IN PAGE 3 */ + /* rom page 3 0c000 SPARE SOCKET */ + /* rom page 4 10000 32K IN PAGE 5 */ + /* rom page 5 14000 SPARE SOCKET */ + /* rom page 6 18000 32K IN PAGE 7 */ + /* rom page 7 1c000 SPARE SOCKET */ + /* rom page 8 20000 32K IN PAGE 9 */ + /* rom page 9 24000 SPARE SOCKET */ + /* rom page 10 28000 32K IN PAGE 11 */ + /* rom page 11 2c000 SPARE SOCKET */ + /* rom page 12 30000 */ + /* rom page 13 34000 */ + /* rom page 14 38000 32K IN PAGE 15 */ + /* rom page 15 3C000 SPARE SOCKET */ + ROM_LOAD("reutera100.rom", 0x1c000, 0x4000, CRC(98ebabfb) SHA1(a7887e1e5c206203491e1e06682b9508b0fef49d)) + ROM_LOAD("reuterb.rom", 0x2c000, 0x4000, CRC(9e02f59b) SHA1(1e63aa3bf4b37bf9ba41e454f95db05c3d15bfbf)) + + ROM_REGION(0x4000, "os", 0) + ROM_LOAD("mos_r030.rom", 0x0000, 0x4000, CRC(8b652337) SHA1(6a5c7ace255c8ac96c983d5ba67084fbd71ff61e)) +ROM_END + + +ROM_START(bbcm) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos350") + ROM_SYSTEM_BIOS( 0, "mos350", "Enhanced MOS 3.50" ) + ROMX_LOAD("mos350.ic24", 0x20000, 0x20000, CRC(141027b9) SHA1(85211b5bc7c7a269952d2b063b7ec0e1f0196803), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "mos320", "Original MOS 3.20" ) + ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(2)) + ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x20000, 0x4000, 0xFFFF) + /* 00000 rom 0 Rear Cartridge bottom 16K */ + /* 04000 rom 1 Rear Cartridge top 16K */ + /* 08000 rom 2 Front Cartridge bottom 16K */ + /* 0c000 rom 3 Front Cartridge top 16K */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 SPARE SOCKET */ + /* 24000 rom 9 DFS + SRAM */ + /* 28000 rom 10 Viewsheet */ + /* 2c000 rom 11 Edit */ + /* 30000 rom 12 BASIC */ + /* 34000 rom 13 ADFS */ + /* 38000 rom 14 View + MOS code */ + /* 3c000 rom 15 Terminal + Tube host + CFS */ +// ROM_LOAD("anfs424.rom", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) // TODO where to load this? + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x40,"rtc",0) /* mc146818 */ + /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ + ROMX_LOAD("mos350.cmos", 0x00, 0x40, CRC(e84c1854) SHA1(f3cb7f12b7432caba28d067f01af575779220aac), ROM_BIOS(1)) + ROMX_LOAD("mos320.cmos", 0x00, 0x40, CRC(c7f9e85a) SHA1(f24cc9db0525910689219f7204bf8b864033ee94), ROM_BIOS(2)) +ROM_END + + +ROM_START(bbcmt) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos350") + ROM_SYSTEM_BIOS( 0, "mos350", "Enhanced MOS 3.50" ) + ROMX_LOAD("mos350.ic24", 0x20000, 0x20000, CRC(141027b9) SHA1(85211b5bc7c7a269952d2b063b7ec0e1f0196803), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "mos320", "Original MOS 3.20" ) + ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(2)) + ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x20000, 0x4000, 0xFFFF) + /* 00000 rom 0 Rear Cartridge bottom 16K */ + /* 04000 rom 1 Rear Cartridge top 16K */ + /* 08000 rom 2 Front Cartridge bottom 16K */ + /* 0c000 rom 3 Front Cartridge top 16K */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 SPARE SOCKET */ + /* 24000 rom 9 DFS + SRAM */ + /* 28000 rom 10 Viewsheet */ + /* 2c000 rom 11 Edit */ + /* 30000 rom 12 BASIC */ + /* 34000 rom 13 ADFS */ + /* 38000 rom 14 View + MOS code */ + /* 3c000 rom 15 Terminal + Tube host + CFS */ +// ROM_LOAD("anfs424.ic27", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) // TODO where to load this? + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x40,"rtc",0) /* mc146818 */ + /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ + ROMX_LOAD("mos350.cmos", 0x00, 0x40, CRC(e84c1854) SHA1(f3cb7f12b7432caba28d067f01af575779220aac), ROM_BIOS(1)) + ROMX_LOAD("mos320.cmos", 0x00, 0x40, CRC(c7f9e85a) SHA1(f24cc9db0525910689219f7204bf8b864033ee94), ROM_BIOS(2)) +ROM_END + + +ROM_START(bbcmaiv) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos320") + ROM_SYSTEM_BIOS( 0, "mos320", "MOS 3.20" ) + ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(1)) + ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x20000, 0x4000, 0xFFFF) + /* 00000 rom 0 Rear Cartridge bottom 16K */ + /* 04000 rom 1 Rear Cartridge top 16K */ + /* 08000 rom 2 Front Cartridge bottom 16K */ + /* 0c000 rom 3 Front Cartridge top 16K */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 VFS */ + /* 24000 rom 9 DFS + SRAM */ + /* 28000 rom 10 Viewsheet */ + /* 2c000 rom 11 Edit */ + /* 30000 rom 12 BASIC */ + /* 34000 rom 13 ADFS */ + /* 38000 rom 14 View + MOS code */ + /* 3c000 rom 15 Terminal + Tube host + CFS */ + ROM_LOAD("vfs170.rom", 0x20000, 0x4000, CRC(b124a0bb) SHA1(ba31c757815cf470402d7829a70a0e1d3fb1355b) ) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x40,"rtc",0) /* mc146818 */ + /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ + ROMX_LOAD("mos320aiv.cmos", 0x0E, 0x32, BAD_DUMP CRC(b9ae42a1) SHA1(abf3e94b013f24027ca36c96720963c3411e93f8), ROM_BIOS(1)) +ROM_END + + +ROM_START(bbcmet) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos400") + ROM_SYSTEM_BIOS( 0, "mos400", "Econet MOS 4.00" ) + ROMX_LOAD("mos400.ic24", 0x30000, 0x10000, BAD_DUMP CRC(81729034) SHA1(d4bc2c7f5e66b5298786138f395908e70c772971), ROM_BIOS(1)) /* Merged individual ROM bank dumps */ + ROM_COPY("option", 0x34000, 0x24000, 0xC000) /* Mirror */ + ROM_COPY("option", 0x30000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x30000, 0x4000, 0xFFFF) + /* 00000 rom 0 Rear Cartridge bottom 16K */ + /* 04000 rom 1 Rear Cartridge top 16K */ + /* 08000 rom 2 Front Cartridge bottom 16K */ + /* 0c000 rom 3 Front Cartridge top 16K */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 NO SOCKET */ + /* 24000 rom 9 BASIC */ + /* 28000 rom 10 ANFS */ + /* 2c000 rom 11 MOS code */ + /* 30000 rom 12 UNUSED */ + /* 34000 rom 13 BASIC */ + /* 38000 rom 14 ANFS */ + /* 3c000 rom 15 MOS code */ + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x40,"rtc",0) /* mc146818 */ + /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ + ROMX_LOAD("mos400.cmos", 0x0E, 0x32, BAD_DUMP CRC(fff41cc5) SHA1(3607568758f90b3bd6c7dc9533e2aa24f9806ff3), ROM_BIOS(1)) +ROM_END + + +ROM_START(bbcm512) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos350") + ROM_SYSTEM_BIOS( 0, "mos350", "Enhanced MOS 3.50" ) + ROMX_LOAD("mos350.ic24", 0x20000, 0x20000, CRC(141027b9) SHA1(85211b5bc7c7a269952d2b063b7ec0e1f0196803), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "mos320", "Original MOS 3.20" ) + ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(2)) + ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x20000, 0x4000, 0xFFFF) + /* 00000 rom 0 Rear Cartridge bottom 16K */ + /* 04000 rom 1 Rear Cartridge top 16K */ + /* 08000 rom 2 Front Cartridge bottom 16K */ + /* 0c000 rom 3 Front Cartridge top 16K */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 SPARE SOCKET */ + /* 24000 rom 9 DFS + SRAM */ + /* 28000 rom 10 Viewsheet */ + /* 2c000 rom 11 Edit */ + /* 30000 rom 12 BASIC */ + /* 34000 rom 13 ADFS */ + /* 38000 rom 14 View + MOS code */ + /* 3c000 rom 15 Terminal + Tube host + CFS */ +// ROM_LOAD("anfs424.ic27", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x40,"rtc",0) /* mc146818 */ + /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ + ROMX_LOAD("mos350.cmos", 0x00, 0x40, CRC(e84c1854) SHA1(f3cb7f12b7432caba28d067f01af575779220aac), ROM_BIOS(1)) + ROMX_LOAD("mos320.cmos", 0x00, 0x40, CRC(c7f9e85a) SHA1(f24cc9db0525910689219f7204bf8b864033ee94), ROM_BIOS(2)) +ROM_END + + +ROM_START(bbcmarm) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos320") + ROM_SYSTEM_BIOS( 0, "mos320", "Original MOS 3.20" ) + ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(1)) + ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x20000, 0x4000, 0xFFFF) + /* 00000 rom 0 Rear Cartridge bottom 16K */ + /* 04000 rom 1 Rear Cartridge top 16K */ + /* 08000 rom 2 Front Cartridge bottom 16K */ + /* 0c000 rom 3 Front Cartridge top 16K */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 SPARE SOCKET */ + /* 24000 rom 9 DFS + SRAM */ + /* 28000 rom 10 Viewsheet */ + /* 2c000 rom 11 Edit */ + /* 30000 rom 12 BASIC */ + /* 34000 rom 13 ADFS */ + /* 38000 rom 14 View + MOS code */ + /* 3c000 rom 15 Terminal + Tube host + CFS */ +// ROM_LOAD("anfs424.ic27", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + ROM_REGION(0x40,"rtc",0) /* mc146818 */ + /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ + ROMX_LOAD("mos320arm.cmos", 0x00, 0x40, CRC(56117257) SHA1(ed98563bef18f9d2a0b2d941cd20823d760fb127), ROM_BIOS(1)) +ROM_END + + +ROM_START(bbcmc) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos510") + ROM_SYSTEM_BIOS( 0, "mos510", "Enhanced MOS 5.10" ) + ROMX_LOAD("mos510.ic49", 0x30000, 0x10000, BAD_DUMP CRC(9a2a6086) SHA1(094ab37b0b6437c4f1653eaa0602ef102737adb6), ROM_BIOS(1)) /* Merged individual ROM bank dumps */ + ROM_SYSTEM_BIOS( 1, "mos500", "Original MOS 5.00" ) + ROMX_LOAD("mos500.ic49", 0x30000, 0x10000, BAD_DUMP CRC(f6170023) SHA1(140d002d2d9cd34b47197a2ba823505af2a84633), ROM_BIOS(2)) /* Merged individual ROM bank dumps */ + ROM_COPY("option", 0x30000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x30000, 0x4000, 0xFFFF) + /* 00000 rom 0 EXTERNAL */ + /* 04000 rom 1 EXTERNAL */ + /* 08000 rom 2 SPARE SOCKET */ + /* 0c000 rom 3 SPARE SOCKET */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 SPARE SOCKET */ + /* 24000 rom 9 UNUSED */ + /* 28000 rom 10 UNUSED */ + /* 2c000 rom 11 UNUSED */ + /* 30000 rom 12 UNUSED */ + /* 34000 rom 13 ADFS */ + /* 38000 rom 14 BASIC */ + /* 3c000 rom 15 Utils */ + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + +// ROM_REGION(0x80,"mc146818",0) /* mc146818 */ + /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ +// ROM_LOAD("mos500.cmos", 0x00, 0x80, CRC(d8458039) SHA1(72c056d493e74ceca41f48936012b012b496a226)) +ROM_END + + +ROM_START(bbcmc_ar) + ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000,"option",0) /* ROM */ + ROM_DEFAULT_BIOS("mos511i") + ROM_SYSTEM_BIOS( 0, "mos511i", "International MOS 5.11" ) + ROMX_LOAD("mos511.ic49", 0x30000, 0x10000, BAD_DUMP CRC(8708803c) SHA1(d2170c8b9b536f3ad84a4a603a7fe712500cc751), ROM_BIOS(1)) /* Merged individual ROM bank dumps */ + ROM_COPY("option", 0x30000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x30000, 0x4000, 0xFFFF) + /* 00000 rom 0 EXTERNAL */ + /* 04000 rom 1 EXTERNAL */ + /* 08000 rom 2 International */ + /* 0c000 rom 3 SPARE SOCKET */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 Arabian */ + /* 24000 rom 9 UNUSED */ + /* 28000 rom 10 UNUSED */ + /* 2c000 rom 11 UNUSED */ + /* 30000 rom 12 UNUSED */ + /* 34000 rom 13 ADFS */ + /* 38000 rom 14 BASIC */ + /* 3c000 rom 15 Utils */ + ROM_LOAD("international16.rom", 0x8000 , 0x4000, CRC(0ef527b1) SHA1(dc5149ccf588cd591a6ad47727474ef3313272ce) ) + ROM_LOAD("arabian-c22.rom" , 0x20000, 0x4000, CRC(4f3aadff) SHA1(2bbf61ba68264ce5845aab9c54e750b0efe219c8) ) + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + +// ROM_REGION(0x80,"mc146818",0) /* mc146818 */ + /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ +// ROM_LOAD("mos500.cmos", 0x00, 0x80, CRC(d8458039) SHA1(72c056d493e74ceca41f48936012b012b496a226)) +ROM_END + + +ROM_START(pro128s) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) /* ROM MEMORY */ + + ROM_REGION(0x44000, "option", 0) /* ROM */ + ROM_DEFAULT_BIOS("mos510o") + ROM_SYSTEM_BIOS(0, "mos510o", "Olivetti MOS 5.10") + ROMX_LOAD("mos510o.ic49", 0x30000, 0x10000, CRC(c16858d3) SHA1(ad231ed21a55e493b553703285530d1cacd3de7a), ROM_BIOS(1)) + ROM_COPY("option", 0x30000, 0x40000, 0x4000) /* Move loaded roms into place */ + ROM_FILL(0x30000, 0x4000, 0xFFFF) + /* 00000 rom 0 EXTERNAL */ + /* 04000 rom 1 EXTERNAL */ + /* 08000 rom 2 SPARE SOCKET */ + /* 0c000 rom 3 SPARE SOCKET */ + /* 10000 rom 4 SWRAM */ + /* 14000 rom 5 SWRAM */ + /* 18000 rom 6 SWRAM */ + /* 1c000 rom 7 SWRAM */ + /* 20000 rom 8 SPARE SOCKET */ + /* 24000 rom 9 UNUSED */ + /* 28000 rom 10 UNUSED */ + /* 2c000 rom 11 UNUSED */ + /* 30000 rom 12 UNUSED */ + /* 34000 rom 13 ADFS */ + /* 38000 rom 14 BASIC */ + /* 3c000 rom 15 Utils */ + + ROM_REGION(0x4000, "os", 0) + ROM_COPY("option", 0x40000, 0, 0x4000) + + // ROM_REGION(0x80,"eeprom",0) /* pcd8572 */ + /* Factory defaulted EEPROM, sets default language ROM, etc. */ + // ROM_LOAD("mos510o.epr", 0x00, 0x80, CRC(d8458039) SHA1(72c056d493e74ceca41f48936012b012b496a226)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP ( 1981, bbcb, 0, bbca, bbcb, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B w/8271 FDC", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1981, bbca, bbcb, 0, bbca, bbca, bbc_state, bbc, "Acorn", "BBC Micro Model A", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1981, bbcb_de, bbcb, 0, bbcb_de, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B (German)", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1983, bbcb_us, bbcb, 0, bbcb_us, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B (US)", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1985, bbcb1770, bbcb, 0, bbcb1770, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B w/1770 FDC", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1985, bbcbp, 0, bbcb, bbcbp, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B+ 64K", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1985, bbcbp128, bbcbp, 0, bbcbp128, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B+ 128K", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1985, abc110, abc210, 0, abc110, abc, bbc_state, bbc, "Acorn", "ABC 110", MACHINE_NOT_WORKING) +COMP ( 1985, abc210, 0, 0, abc210, abc, bbc_state, bbc, "Acorn", "ABC 210/Cambridge Workstation", MACHINE_NOT_WORKING) +COMP ( 1985, abc310, abc210, 0, abc310, abc, bbc_state, bbc, "Acorn", "ABC 310", MACHINE_NOT_WORKING) +COMP ( 1985, reutapm, 0, 0, reutapm, bbcb, bbc_state, bbc, "Acorn", "Reuters APM", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) +COMP ( 1986, bbcm, 0, bbcb, bbcm, bbcm, bbc_state, bbc, "Acorn", "BBC Master 128", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1986, bbcmt, bbcm, 0, bbcmt, bbcm, bbc_state, bbc, "Acorn", "BBC Master Turbo", MACHINE_NOT_WORKING) +COMP ( 1986, bbcmaiv, bbcm, 0, bbcmaiv, bbcm, bbc_state, bbc, "Acorn", "BBC Master AIV", MACHINE_NOT_WORKING) +COMP ( 1986, bbcmet, bbcm, 0, bbcmet, bbcm, bbc_state, bbc, "Acorn", "BBC Master ET", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1986, bbcm512, bbcm, 0, bbcm512, bbcm, bbc_state, bbc, "Acorn", "BBC Master 512", MACHINE_NOT_WORKING) +COMP ( 1986, bbcmarm, bbcm, 0, bbcmarm, bbcm, bbc_state, bbc, "Acorn", "ARM Evaluation System", MACHINE_NOT_WORKING) +COMP ( 1986, bbcmc, 0, bbcm, bbcmc, bbcm, bbc_state, bbc, "Acorn", "BBC Master Compact", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1986, bbcmc_ar, bbcmc, 0, bbcmc, bbcm, bbc_state, bbc, "Acorn", "BBC Master Compact (Arabic)", MACHINE_IMPERFECT_GRAPHICS) +COMP ( 1987, pro128s, bbcmc, 0, pro128s, bbcm, bbc_state, bbc, "Olivetti", "Prodest PC 128S", MACHINE_IMPERFECT_GRAPHICS) diff --git a/src/mame/drivers/bbcbc.c b/src/mame/drivers/bbcbc.c new file mode 100644 index 00000000000..8a11968e0c4 --- /dev/null +++ b/src/mame/drivers/bbcbc.c @@ -0,0 +1,164 @@ +// license:BSD-3-Clause +// copyright-holders:Incog, Robbbert +/*************************************************************************** + + bbcbc.c + + BBC Bridge Companion + + Inputs hooked up - 2009-03-14 - Robbbert + Clock Freq added - 2009-05-18 - incog + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/tms9928a.h" +#include "machine/z80pio.h" +#include "cpu/z80/z80daisy.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class bbcbc_state : public driver_device +{ +public: + bbcbc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot") + { } + + required_device m_maincpu; + required_device m_cart; + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_WRITE_LINE_MEMBER(tms_interrupt); +}; + + +#define MAIN_CLOCK XTAL_4_433619MHz + + +static ADDRESS_MAP_START( bbcbc_prg, AS_PROGRAM, 8, bbcbc_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM + //AM_RANGE(0x4000, 0xbfff) // mapped by the cartslot + AM_RANGE(0xe000, 0xe02f) AM_RAM + AM_RANGE(0xe030, 0xe030) AM_READ_PORT("LINE01") + AM_RANGE(0xe031, 0xe031) AM_READ_PORT("LINE02") + AM_RANGE(0xe032, 0xe032) AM_READ_PORT("LINE03") + AM_RANGE(0xe033, 0xe033) AM_READ_PORT("LINE04") + AM_RANGE(0xe034, 0xe034) AM_READ_PORT("LINE05") + AM_RANGE(0xe035, 0xe035) AM_READ_PORT("LINE06") + AM_RANGE(0xe036, 0xe036) AM_READ_PORT("LINE07") + AM_RANGE(0xe037, 0xe037) AM_READ_PORT("LINE08") + AM_RANGE(0xe038, 0xe038) AM_READ_PORT("LINE09") + AM_RANGE(0xe039, 0xe039) AM_READ_PORT("LINE10") + AM_RANGE(0xe03a, 0xe03a) AM_READ_PORT("LINE11") + AM_RANGE(0xe03b, 0xe03b) AM_READ_PORT("LINE12") + AM_RANGE(0xe03c, 0xe7ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bbcbc_io, AS_IO, 8, bbcbc_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x43) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) + AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("tms9129", tms9129_device, vram_read, vram_write) + AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("tms9129", tms9129_device, register_read, register_write) +ADDRESS_MAP_END + +static INPUT_PORTS_START( bbcbc ) + PORT_START("LINE01") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Pass") PORT_CODE(KEYCODE_W) PORT_IMPULSE(1) + + PORT_START("LINE02") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clubs") PORT_CODE(KEYCODE_G) PORT_IMPULSE(1) + + PORT_START("LINE03") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Spades") PORT_CODE(KEYCODE_D) PORT_IMPULSE(1) + + PORT_START("LINE04") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rdbl") PORT_CODE(KEYCODE_T) PORT_IMPULSE(1) + + PORT_START("LINE05") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NT") PORT_CODE(KEYCODE_E) PORT_IMPULSE(1) + + PORT_START("LINE06") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Hearts, Up") PORT_CODE(KEYCODE_S) PORT_IMPULSE(1) + + PORT_START("LINE07") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Play, Yes") PORT_CODE(KEYCODE_X) PORT_IMPULSE(1) + + PORT_START("LINE08") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_A) PORT_IMPULSE(1) + + PORT_START("LINE09") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Dbl") PORT_CODE(KEYCODE_R) PORT_IMPULSE(1) + + PORT_START("LINE10") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Diamonds, Down") PORT_CODE(KEYCODE_F) PORT_IMPULSE(1) + + PORT_START("LINE11") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Start") PORT_CODE(KEYCODE_Q) PORT_IMPULSE(1) + + PORT_START("LINE12") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Play, No") PORT_CODE(KEYCODE_B) PORT_IMPULSE(1) +INPUT_PORTS_END + +WRITE_LINE_MEMBER(bbcbc_state::tms_interrupt) +{ + m_maincpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); +} + +static const z80_daisy_config bbcbc_daisy_chain[] = +{ + { "z80pio" }, + { NULL } +}; + + +void bbcbc_state::machine_start() +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +void bbcbc_state::machine_reset() +{ +} + + +static MACHINE_CONFIG_START( bbcbc, bbcbc_state ) + MCFG_CPU_ADD( "maincpu", Z80, MAIN_CLOCK / 8 ) + MCFG_CPU_PROGRAM_MAP( bbcbc_prg) + MCFG_CPU_IO_MAP( bbcbc_io) + MCFG_CPU_CONFIG(bbcbc_daisy_chain) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, MAIN_CLOCK/8) + + MCFG_DEVICE_ADD( "tms9129", TMS9129, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(bbcbc_state, tms_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9129", tms9928a_device, screen_update ) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "bbcbc_cart") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","bbcbc") +MACHINE_CONFIG_END + + +ROM_START( bbcbc ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("br_4_1.ic3", 0x0000, 0x2000, CRC(7c880d75) SHA1(954db096bd9e8edfef72946637a12f1083841fb0)) + ROM_LOAD("br_4_2.ic4", 0x2000, 0x2000, CRC(16a33aef) SHA1(9529f9f792718a3715af2063b91a5fb18f741226)) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS(1985, bbcbc, 0, 0, bbcbc, bbcbc, driver_device, 0, "BBC", "Bridge Companion", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/bcs3.c b/src/mame/drivers/bcs3.c new file mode 100644 index 00000000000..8292aedd270 --- /dev/null +++ b/src/mame/drivers/bcs3.c @@ -0,0 +1,492 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + BCS 3 + + 2009-05-12 Skeleton driver. + 2015-09-25 Improvements + + http://hc-ddr.hucki.net/wiki/doku.php/homecomputer:bcs3 + + East German home built computer. No sound facilities. + All documents are in German. + + Main CPU is a U880 (Z80 equivalent). Other ICs also have unusual names. + + The CTC sends an interrupt every so often. This uses a lookup table to + jump to an address in the range 38xx-39xx. This seems to work much the + same as reading video memory in the ZX80. This, I think, is to stop snow + appearing on the screen. It also slows everything down noticeably. + + It appears that a read of 1400 activates the Z80's /WAIT pin. This will + be released by a VS pulse. (Not emulated) + + Cassette is hooked up according to the documentation, but it doesn't work. + + Known Memory Map: + 0000 - 0FFF: Main ROM + 1000 - 13FF: Keyboard + 1400 - 17FF: /WAIT circuit + 1800 - 1BFF: Output one character's scanline to the monitor. ZX-video process. + 1C00 - 1FFF: Video RAM + 2000 - 3FFF: Mirror of 0000 - 1FFF. + 4000 - up : Extra RAM (required for hack versions) + + Hack versions: + - They are fitted with Basic 3.x, require more RAM, and use hardware scrolling. + - No schematic has been found, so the code is educated guesswork. + - The ZX process is still to be worked out. For now, we return 0xF7 to finish. + - There is a machine-language monitor fitted to some models. To access: + -- Y = USR(0F000H) + -- Commands are S (substitute), M (move), T (test), G (go), Q (quit) + + To Do: + - Need software + - Fix cassette + - Hack versions: fix the ZX process + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "imagedev/cassette.h" + + +class bcs3_state : public driver_device +{ +public: + bcs3_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_ctc(*this, "ctc") + , m_p_chargen(*this, "chargen") + , m_p_videoram(*this, "videoram") + , m_cass(*this, "cassette") + , m_io_keyboard(*this, "KEY") + { } + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_READ8_MEMBER(video_r); + DECLARE_READ8_MEMBER(zx_r); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_DRIVER_INIT(bcs3a); + DECLARE_DRIVER_INIT(bcs3b); + DECLARE_DRIVER_INIT(bcs3c); + DECLARE_DRIVER_INIT(bcs3d); + UINT32 screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_bcs3a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + bool m_cass_bit; + UINT8 s_curs; + UINT8 s_init; + UINT8 s_rows; + UINT8 s_cols; + + required_device m_maincpu; + required_device m_ctc; + required_memory_region m_p_chargen; + required_shared_ptr m_p_videoram; + required_device m_cass; + required_ioport_array<10> m_io_keyboard; +}; + +READ8_MEMBER( bcs3_state::keyboard_r ) +{ + UINT8 i, data = 0; + + if (offset == 0) + data = (m_cass->input() > +0.01) ? 0x80 : 0; + + offset ^= 0x3ff; + + for (i = 0; i < 10; i++) + if BIT(offset, i) + data |= m_io_keyboard[i]->read(); + + return data; +} + +// 00-7F = NUL, 0xE0 = end of line. +READ8_MEMBER( bcs3_state::video_r ) +{ + UINT8 data = m_p_videoram[offset]; + return BIT(data, 7) ? data : 0; +} + +// Unsure of how this works. +// 00-7F = NUL, 0xFF = end of line, 0xF7 = finish. +READ8_MEMBER( bcs3_state::zx_r ) +{ + return 0xf7; +} + +static ADDRESS_MAP_START(bcs3_mem, AS_PROGRAM, 8, bcs3_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_MIRROR(0x2000) AM_ROM AM_REGION("roms", 0) + AM_RANGE( 0x1000, 0x13ff ) AM_MIRROR(0x2000) AM_READ(keyboard_r) + AM_RANGE( 0x1400, 0x17ff ) AM_MIRROR(0x2000) AM_NOP // /WAIT circuit + AM_RANGE( 0x1800, 0x1bff ) AM_MIRROR(0x2000) AM_READ(video_r) + AM_RANGE( 0x1c00, 0x1fff ) AM_MIRROR(0x2000) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(bcs3a_mem, AS_PROGRAM, 8, bcs3_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_MIRROR(0x2000) AM_ROM AM_REGION("roms", 0) + AM_RANGE( 0x1000, 0x13ff ) AM_MIRROR(0x2000) AM_READ(keyboard_r) + AM_RANGE( 0x1400, 0x17ff ) AM_MIRROR(0x2000) AM_NOP // /WAIT circuit + AM_RANGE( 0x1800, 0x1bff ) AM_MIRROR(0x2000) AM_READ(zx_r) + AM_RANGE( 0x3c00, 0x7fff ) AM_RAM AM_SHARE("videoram") + AM_RANGE( 0xf000, 0xf3ff ) AM_ROM AM_REGION("roms", 0x1000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bcs3_io, AS_IO, 8, bcs3_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(3) + // coded in the rom as F8 to FB + AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( bcs3 ) + PORT_START("KEY.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K :") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR(':') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A &") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_START("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L ;") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR(';') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B '") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("KEY.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M <") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C (") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(34) + + PORT_START("KEY.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N =") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D )") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START("KEY.4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O >") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E *") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + + PORT_START("KEY.5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F +") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G ,") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR(',') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + + PORT_START("KEY.7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H -") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('-') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) + + PORT_START("KEY.8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I .") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('.') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("KEY.9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J /") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('/') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') +INPUT_PORTS_END + +// Official version +UINT32 bcs3_state::screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,rat; + UINT16 sy=0,ma=0x50,x; + + for (y = 0; y < 12; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + rat = (ra + 1) & 7; + + for (x = ma; x < ma + 28; x++) + { + if (ra < 8) + { + chr = m_p_videoram[x] & 0x7f; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen->base()[(chr<<3) | rat ] ^ 0xff; + } + else + gfx = 0xff; + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=28; + } + return 0; +} + +/* Hacks: When it starts, it has 4 lines of data. Pressing enter causes it to allocate 100 lines. + I'm assuming that it only shows a portion of this, with the cursor always in sight. */ +UINT32 bcs3_state::screen_update_bcs3a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,rat; + UINT16 sy = 0, ma = s_init, x; + UINT16 cursor = (m_p_videoram[s_curs] | (m_p_videoram[s_curs+1] << 8)) - 0x3c00 - ma; // get cursor relative position + rat = cursor / (s_cols+1); + if (rat > (s_rows-1)) ma += (rat-(s_rows-1)) * (s_cols+1); + + for (y = 0; y < s_rows; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + rat = (ra + 1) & 7; + + for (x = ma; x < ma + s_cols; x++) + { + if (ra < 8) + { + chr = m_p_videoram[x] & 0x7f; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen->base()[(chr<<3) | rat ] ^ 0xff; + } + else + gfx = 0xff; + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=(s_cols+1); + } + return 0; +} + + +/* F4 Character Displayer */ +static const gfx_layout bcs3_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 0*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( bcs3 ) + GFXDECODE_ENTRY( "chargen", 0x0000, bcs3_charlayout, 0, 1 ) +GFXDECODE_END + +WRITE_LINE_MEMBER( bcs3_state::ctc_z0_w ) +{ + m_ctc->trg1(state); + if (state) + { + m_cass_bit ^= 1; + m_cass->output(m_cass_bit ? -1.0 : +1.0); + } +} + +WRITE_LINE_MEMBER( bcs3_state::ctc_z1_w ) +{ + m_ctc->trg2(state); +} + +static const z80_daisy_config daisy_chain_intf[] = +{ + { "ctc" }, + { NULL } +}; + +DRIVER_INIT_MEMBER( bcs3_state, bcs3a ) +{ + s_curs = 0x7a; + s_init = 0x80; + s_rows = 12; + s_cols = 29; +} + +DRIVER_INIT_MEMBER( bcs3_state, bcs3b ) +{ + s_curs = 0x7a; + s_init = 0x80; + s_rows = 24; + s_cols = 40; +} + +DRIVER_INIT_MEMBER( bcs3_state, bcs3c ) +{ + s_curs = 0x08; + s_init = 0xa0; + s_rows = 12; + s_cols = 29; +} + +DRIVER_INIT_MEMBER( bcs3_state, bcs3d ) +{ + s_curs = 0x08; + s_init = 0xb4; + s_rows = 12; + s_cols = 29; +} + +static MACHINE_CONFIG_START( bcs3, bcs3_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_5MHz /2) + MCFG_CPU_PROGRAM_MAP(bcs3_mem) + MCFG_CPU_IO_MAP(bcs3_io) + MCFG_CPU_CONFIG(daisy_chain_intf) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(28*8, 12*10) + MCFG_SCREEN_VISIBLE_AREA(0,28*8-1,0,12*10-1) + MCFG_SCREEN_UPDATE_DRIVER(bcs3_state, screen_update_bcs3) + MCFG_SCREEN_PALETTE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", bcs3) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_5MHz / 2) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(bcs3_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(bcs3_state, ctc_z1_w)) + + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( bcs3a, bcs3_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_7MHz /2) + MCFG_CPU_PROGRAM_MAP(bcs3a_mem) + MCFG_CPU_IO_MAP(bcs3_io) + MCFG_CPU_CONFIG(daisy_chain_intf) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(29*8, 12*10) + MCFG_SCREEN_VISIBLE_AREA(0,29*8-1,0,12*10-1) + MCFG_SCREEN_UPDATE_DRIVER(bcs3_state, screen_update_bcs3a) + MCFG_SCREEN_PALETTE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", bcs3) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_7MHz / 2) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(bcs3_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(bcs3_state, ctc_z1_w)) + + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bcs3b, bcs3a ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(40*8, 24*10) + MCFG_SCREEN_VISIBLE_AREA(0,40*8-1,0,24*10-1) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( bcs3 ) + ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) + //ROM_LOAD( "se24.bin", 0x0000, 0x0800, CRC(268de5ee) SHA1(78784945956c1b0282a4e82ad55e7c3a77389e50)) + ROM_LOAD( "se24_000.d6", 0x0000, 0x0400, CRC(157a0d28) SHA1(0a6666c289b95d98128fd282478dff6319031b6e) ) + ROM_LOAD( "se24_400.d7", 0x0400, 0x0400, CRC(2159de0f) SHA1(09b567e750931019de914f25d5ab1e4910465de6) ) + + ROM_REGION( 0x0400, "chargen", 0 ) + ROM_LOAD( "bcs_zg_24.d21", 0x0000, 0x0400, CRC(eaed9d84) SHA1(7023a6187cd6bd0c6489d76ff662453f14e5b636)) +ROM_END + +ROM_START( bcs3a ) + ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) + //ROM_LOAD( "se31_29.bin", 0x0000, 0x1000, CRC(e9b55544) SHA1(82bae68c4bcaecf66632f5b43913b50a1acba316)) + ROM_LOAD( "se31_000.d6", 0x0000, 0x0400, CRC(0765bd83) SHA1(137ceffd50eeaf21caab286d3e01161ba3267ea4) ) + ROM_LOAD( "se31_400.d7", 0x0400, 0x0400, CRC(1a87a3ed) SHA1(c8121ff198f8cf0c7bc7bc7e258ecfa51d3bb02c) ) + ROM_LOAD( "se31_800.d8", 0x0800, 0x0400, CRC(05654a8f) SHA1(b42fa6cf5710dab23f062dbeea81e85b4c18e1b0) ) + ROM_LOAD( "se31_c00.d9", 0x0c00, 0x0400, CRC(858ca28b) SHA1(90f943b0c1d102dd058a859ba139057a0bd278a6) ) + ROM_LOAD( "se31mceditor.bin", 0x1000, 0x0400, CRC(8eac92ec) SHA1(8950a3ef05d02abf34269bfce002c46d273ce113)) + + ROM_REGION( 0x0400, "chargen", 0 ) + ROM_LOAD( "bcs_zg_31.d21", 0x0000, 0x0400, CRC(a20c93c9) SHA1(b2be1c0d98b7ac05713349b099b392975968be1d)) +ROM_END + +ROM_START( bcs3b ) + ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) + ROM_LOAD( "se31_40.bin", 0x0000, 0x1000, CRC(4e993152) SHA1(6bb01ff5779627fa2eb2df432fffcfccc1e33231)) + ROM_LOAD( "se31mceditor.bin", 0x1000, 0x0400, CRC(8eac92ec) SHA1(8950a3ef05d02abf34269bfce002c46d273ce113)) + + ROM_REGION( 0x0400, "chargen", 0 ) + ROM_LOAD( "bcs_zg_31.d21", 0x0000, 0x0400, CRC(a20c93c9) SHA1(b2be1c0d98b7ac05713349b099b392975968be1d)) +ROM_END + +ROM_START( bcs3c ) + ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) + ROM_LOAD( "bcs32.bin", 0x0000, 0x1000, CRC(1523b846) SHA1(ca5e3213707a604e02d9e7a7ebfc362ef294ddb8) ) + + ROM_REGION( 0x0400, "chargen", 0 ) + ROM_LOAD( "bcs_zg_32.d21", 0x0000, 0x0400, CRC(abe9e820) SHA1(03a8792d08774cd67b98efd3f83a78e897b4e001) ) +ROM_END + +ROM_START( bcs3d ) + ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) + ROM_LOAD( "sp33_29.bin", 0x0000, 0x1000, CRC(1c851eb2) SHA1(4f8bb5274ea1861a35a840e8f3482bdc693047c4)) + + ROM_REGION( 0x0400, "chargen", 0 ) + ROM_LOAD( "bcs_zg_33.d21", 0x0000, 0x0400, CRC(b27f1c07) SHA1(61c80c585f198370ba5e856839c12b15acdc58ee)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, bcs3, 0, 0, bcs3, bcs3, driver_device, 0, "Eckhard Schiller", "BCS 3 rev 2.4", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP( 1986, bcs3a, bcs3, 0, bcs3a, bcs3, bcs3_state, bcs3a, "Eckhard Schiller", "BCS 3 rev 3.1 29-column", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP( 1986, bcs3b, bcs3, 0, bcs3b, bcs3, bcs3_state, bcs3b, "Eckhard Schiller", "BCS 3 rev 3.1 40-column", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP( 1986, bcs3c, bcs3, 0, bcs3a, bcs3, bcs3_state, bcs3c, "Eckhard Schiller", "BCS 3 rev 3.2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP( 1986, bcs3d, bcs3, 0, bcs3a, bcs3, bcs3_state, bcs3d, "Eckhard Schiller", "BCS 3 rev 3.3", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/bebox.c b/src/mame/drivers/bebox.c new file mode 100644 index 00000000000..cd3aec4c163 --- /dev/null +++ b/src/mame/drivers/bebox.c @@ -0,0 +1,261 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, R. Belmont +/*************************************************************************** + + drivers/bebox.c + + BeBox + +***************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "includes/bebox.h" + +/* Components */ +#include "video/clgd542x.h" +#include "bus/lpci/cirrus.h" +#include "cpu/powerpc/ppc.h" +#include "sound/3812intf.h" +#include "machine/mc146818.h" +#include "machine/pckeybrd.h" +#include "bus/lpci/mpc105.h" +#include "bus/scsi/scsi.h" + +/* Devices */ +#include "bus/scsi/scsicd.h" +#include "bus/scsi/scsihd.h" +#include "formats/pc_dsk.h" +#include "machine/8042kbdc.h" + +READ8_MEMBER(bebox_state::at_dma8237_1_r) { return m_dma8237_2->read(space, offset / 2); } +WRITE8_MEMBER(bebox_state::at_dma8237_1_w) { m_dma8237_2->write(space, offset / 2, data); } + +static ADDRESS_MAP_START( bebox_mem, AS_PROGRAM, 64, bebox_state ) + AM_RANGE(0x7FFFF0F0, 0x7FFFF0F7) AM_READWRITE(bebox_cpu0_imask_r, bebox_cpu0_imask_w ) + AM_RANGE(0x7FFFF1F0, 0x7FFFF1F7) AM_READWRITE(bebox_cpu1_imask_r, bebox_cpu1_imask_w ) + AM_RANGE(0x7FFFF2F0, 0x7FFFF2F7) AM_READ(bebox_interrupt_sources_r ) + AM_RANGE(0x7FFFF3F0, 0x7FFFF3F7) AM_READWRITE(bebox_crossproc_interrupts_r, bebox_crossproc_interrupts_w ) + AM_RANGE(0x7FFFF4F0, 0x7FFFF4F7) AM_WRITE(bebox_processor_resets_w ) + + AM_RANGE(0x80000000, 0x8000001F) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000020, 0x8000003F) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000040, 0x8000005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000060, 0x8000006F) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000070, 0x8000007F) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , U64(0xffffffffffffffff) ) + AM_RANGE(0x80000080, 0x8000009F) AM_READWRITE8(bebox_page_r, bebox_page_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x800000A0, 0x800000BF) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, U64(0xffffffffffffffff) ) + AM_RANGE(0x800000C0, 0x800000DF) AM_READWRITE8(at_dma8237_1_r, at_dma8237_1_w, U64(0xffffffffffffffff)) + AM_RANGE(0x800001F0, 0x800001F7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs0, write_cs0, U64(0xffffffffffffffff) ) + AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8( "ns16550_1", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000380, 0x80000387) AM_DEVREADWRITE8( "ns16550_2", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000388, 0x8000038F) AM_DEVREADWRITE8( "ns16550_3", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x800003b0, 0x800003bf) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03b0_r, port_03b0_w, U64(0xffffffffffffffff)) + AM_RANGE(0x800003c0, 0x800003cf) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03c0_r, port_03c0_w, U64(0xffffffffffffffff)) + AM_RANGE(0x800003d0, 0x800003df) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03d0_r, port_03d0_w, U64(0xffffffffffffffff)) + AM_RANGE(0x800003F0, 0x800003F7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs1, write_cs1, U64(0xffffffffffffffff) ) + AM_RANGE(0x800003F0, 0x800003F7) AM_DEVICE8( "smc37c78", smc37c78_device, map, U64(0xffffffffffffffff) ) + AM_RANGE(0x800003F8, 0x800003FF) AM_DEVREADWRITE8( "ns16550_0",ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000480, 0x8000048F) AM_READWRITE8(bebox_80000480_r, bebox_80000480_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000CF8, 0x80000CFF) AM_DEVREADWRITE("pcibus", pci_bus_device, read_64be, write_64be ) + //AM_RANGE(0x800042E8, 0x800042EF) AM_DEVWRITE8("cirrus", cirrus_device, cirrus_42E8_w, U64(0xffffffffffffffff) ) + + AM_RANGE(0xBFFFFFF0, 0xBFFFFFFF) AM_READ(bebox_interrupt_ack_r ) + AM_RANGE(0xC00A0000, 0XC00BFFFF) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, mem_r, mem_w, U64(0xffffffffffffffff) ) + AM_RANGE(0xC1000000, 0XC11FFFFF) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, mem_linear_r, mem_linear_w, U64(0xffffffffffffffff) ) + AM_RANGE(0xFFF00000, 0xFFF03FFF) AM_ROMBANK("bank2") + AM_RANGE(0xFFF04000, 0xFFFFFFFF) AM_READWRITE8(bebox_flash_r, bebox_flash_w, U64(0xffffffffffffffff) ) +ADDRESS_MAP_END + +// The following is a gross hack to let the BeBox boot ROM identify the processors correctly. +// This needs to be done in a better way if someone comes up with one. + +READ64_MEMBER(bebox_state::bb_slave_64be_r) +{ + // 2e94 is the real address, 2e84 is where the PC appears to be under full DRC + if ((space.device().safe_pc() == 0xfff02e94) || (space.device().safe_pc() == 0xfff02e84)) + { + return 0x108000ff; // indicate slave CPU + } + + return m_pcibus->read_64be(space, offset, mem_mask); +} + +static ADDRESS_MAP_START( bebox_slave_mem, AS_PROGRAM, 64, bebox_state ) + AM_RANGE(0x80000cf8, 0x80000cff) AM_READ(bb_slave_64be_r) + AM_RANGE(0x80000cf8, 0x80000cff) AM_DEVWRITE("pcibus", pci_bus_device, write_64be ) + AM_IMPORT_FROM(bebox_mem) +ADDRESS_MAP_END + +#define BYTE_REVERSE32(x) (((x >> 24) & 0xff) | \ + ((x >> 8) & 0xff00) | \ + ((x << 8) & 0xff0000) | \ + ((x << 24) & 0xff000000)) + +LSI53C810_FETCH_CB(bebox_state::scsi_fetch) +{ + UINT32 result = m_ppc1->space(AS_PROGRAM).read_dword(dsp & 0x7FFFFFFF); + return BYTE_REVERSE32(result); +} + + +LSI53C810_IRQ_CB(bebox_state::scsi_irq_callback) +{ + bebox_set_irq_bit(21, state); +} + + +LSI53C810_DMA_CB(bebox_state::scsi_dma_callback) +{ +} + +FLOPPY_FORMATS_MEMBER( bebox_state::floppy_formats ) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( bebox_floppies ) + SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_FRAGMENT( mpc105_config ) + MCFG_MPC105_CPU( "ppc1" ) + MCFG_MPC105_BANK_BASE_DEFAULT( 0 ) +MACHINE_CONFIG_END + + +/************************************* + * + * Keyboard + * + *************************************/ + +WRITE_LINE_MEMBER(bebox_state::bebox_keyboard_interrupt) +{ + bebox_set_irq_bit(16, state); + m_pic8259_1->ir1_w(state); +} + +static SLOT_INTERFACE_START( pci_devices ) + SLOT_INTERFACE_INTERNAL("mpc105", MPC105) + SLOT_INTERFACE("cirrus", CIRRUS) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( bebox, bebox_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("ppc1", PPC603, 66000000) /* 66 MHz */ + MCFG_CPU_PROGRAM_MAP(bebox_mem) + + MCFG_CPU_ADD("ppc2", PPC603, 66000000) /* 66 MHz */ + MCFG_CPU_PROGRAM_MAP(bebox_slave_mem) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("pit8254", PIT8254, 0) + MCFG_PIT8253_CLK0(4772720/4) /* heartbeat IRQ */ + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(bebox_state, bebox_timer0_w)) + MCFG_PIT8253_CLK1(4772720/4) /* dram refresh */ + MCFG_PIT8253_CLK2(4772720/4) /* pio port c pin 4, and speaker polling enough */ + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("kbdc", kbdc8042_device, write_out2)) + + MCFG_DEVICE_ADD( "dma8237_1", AM9517A, XTAL_14_31818MHz/3 ) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(bebox_state, bebox_dma_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(bebox_state, bebox_dma8237_out_eop)) + MCFG_I8237_IN_MEMR_CB(READ8(bebox_state, bebox_dma_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(bebox_state, bebox_dma_write_byte)) + MCFG_I8237_IN_IOR_2_CB(READ8(bebox_state, bebox_dma8237_fdc_dack_r)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(bebox_state, bebox_dma8237_fdc_dack_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(bebox_state, pc_dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(bebox_state, pc_dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(bebox_state, pc_dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(bebox_state, pc_dack3_w)) + + MCFG_DEVICE_ADD( "dma8237_2", AM9517A, XTAL_14_31818MHz/3 ) + + MCFG_PIC8259_ADD( "pic8259_1", WRITELINE(bebox_state,bebox_pic8259_master_set_int_line), VCC, READ8(bebox_state,get_slave_ack) ) + + MCFG_PIC8259_ADD( "pic8259_2", WRITELINE(bebox_state,bebox_pic8259_slave_set_int_line), GND, NULL ) + + MCFG_DEVICE_ADD( "ns16550_0", NS16550, 0 ) /* TODO: Verify model */ + MCFG_DEVICE_ADD( "ns16550_1", NS16550, 0 ) /* TODO: Verify model */ + MCFG_DEVICE_ADD( "ns16550_2", NS16550, 0 ) /* TODO: Verify model */ + MCFG_DEVICE_ADD( "ns16550_3", NS16550, 0 ) /* TODO: Verify model */ + + /* video hardware */ + MCFG_FRAGMENT_ADD( pcvideo_cirrus_gd5428 ) + + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ym3812", YM3812, 3579545) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_FUJITSU_29F016A_ADD("flash") + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "cdrom", SCSICD, SCSI_ID_3) + + MCFG_DEVICE_ADD("lsi53c810", LSI53C810, 0) + MCFG_LSI53C810_IRQ_CB(bebox_state, scsi_irq_callback) + MCFG_LSI53C810_DMA_CB(bebox_state, scsi_dma_callback) + MCFG_LSI53C810_FETCH_CB(bebox_state, scsi_fetch) + MCFG_LEGACY_SCSI_PORT("scsi") + + MCFG_IDE_CONTROLLER_ADD( "ide", ata_devices, "hdd", NULL, false ) /* FIXME */ + MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(bebox_state, bebox_ide_interrupt)) + + /* pci */ + MCFG_PCI_BUS_ADD("pcibus", 0) + MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "mpc105", true) + MCFG_SLOT_OPTION_MACHINE_CONFIG("mpc105", mpc105_config) + + MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "cirrus", true) + + /*MCFG_PCI_BUS_DEVICE(12, NULL, scsi53c810_pci_read, scsi53c810_pci_write)*/ + + MCFG_SMC37C78_ADD("smc37c78") + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(bebox_state, fdc_interrupt)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8237_1", am9517a_device, dreq2_w)) + MCFG_FLOPPY_DRIVE_ADD("smc37c78:0", bebox_floppies, "35hd", bebox_state::floppy_formats) + + MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) + + MCFG_DEVICE_ADD("kbdc", KBDC8042, 0) + MCFG_KBDC8042_KEYBOARD_TYPE(KBDC8042_STANDARD) + MCFG_KBDC8042_SYSTEM_RESET_CB(INPUTLINE("ppc1", INPUT_LINE_RESET)) + MCFG_KBDC8042_INPUT_BUFFER_FULL_CB(WRITELINE(bebox_state, bebox_keyboard_interrupt)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32M") + MCFG_RAM_EXTRA_OPTIONS("8M,16M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bebox2, bebox ) + MCFG_CPU_REPLACE("ppc1", PPC603E, 133000000) /* 133 MHz */ + MCFG_CPU_PROGRAM_MAP(bebox_mem) + + MCFG_CPU_REPLACE("ppc2", PPC603E, 133000000) /* 133 MHz */ + MCFG_CPU_PROGRAM_MAP(bebox_slave_mem) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( bebox ) + PORT_INCLUDE( at_keyboard ) +INPUT_PORTS_END + +ROM_START(bebox) + ROM_REGION(0x00200000, "user1", ROMREGION_64BIT | ROMREGION_BE) + ROM_LOAD( "bootmain.rom", 0x000000, 0x20000, CRC(df2d19e0) SHA1(da86a7d23998dc953dd96a2ac5684faaa315c701) ) + ROM_REGION(0x4000, "user2", ROMREGION_64BIT | ROMREGION_BE) + ROM_LOAD( "bootnub.rom", 0x000000, 0x4000, CRC(5348d09a) SHA1(1b637a3d7a2b072aa128dd5c037bbb440d525c1a) ) +ROM_END + +ROM_START(bebox2) + ROM_REGION(0x00200000, "user1", ROMREGION_64BIT | ROMREGION_BE) + ROM_LOAD( "bootmain.rom", 0x000000, 0x20000, CRC(df2d19e0) SHA1(da86a7d23998dc953dd96a2ac5684faaa315c701) ) + ROM_REGION(0x4000, "user2", ROMREGION_64BIT | ROMREGION_BE) + ROM_LOAD( "bootnub.rom", 0x000000, 0x4000, CRC(5348d09a) SHA1(1b637a3d7a2b072aa128dd5c037bbb440d525c1a) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1995, bebox, 0, 0, bebox, bebox, bebox_state, bebox, "Be Inc", "BeBox Dual603-66", MACHINE_NOT_WORKING ) +COMP( 1996, bebox2, bebox, 0, bebox2, bebox, bebox_state, bebox, "Be Inc", "BeBox Dual603-133", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/beehive.c b/src/mame/drivers/beehive.c new file mode 100644 index 00000000000..a751969f919 --- /dev/null +++ b/src/mame/drivers/beehive.c @@ -0,0 +1,322 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + BEEHIVE DM3270 + + 25/05/2009 Skeleton driver [Robbbert] + + This is a conventional computer terminal using a serial link. + Could be a clone of the IBM3276-2. + + The character gen rom is not dumped. Using the one from 'c10' + for the moment. + + Screen goes crazy during the memory test, just ignore it. + System freezes if ^G pressed. + + 25/04/2011 Added partial keyboard. + 26/06/2011 Added modifier keys. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" + + +class beehive_state : public driver_device +{ +public: + beehive_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_p_videoram(*this, "videoram"){ } + + required_device m_maincpu; + DECLARE_READ8_MEMBER(beehive_60_r); + DECLARE_WRITE8_MEMBER(beehive_62_w); + const UINT8 *m_p_chargen; + required_shared_ptr m_p_videoram; + UINT8 m_keyline; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + +READ8_MEMBER(beehive_state::beehive_60_r) +{ + if (BIT(m_keyline, 4)) + { + char kbdrow[6]; + sprintf(kbdrow,"X%d", m_keyline&15); + return ioport(kbdrow)->read(); + } + else + return 0xff; +} + +WRITE8_MEMBER(beehive_state::beehive_62_w) +{ + m_keyline = data; +} + +static ADDRESS_MAP_START(beehive_mem, AS_PROGRAM, 8, beehive_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x17ff ) AM_ROM + AM_RANGE( 0x8000, 0x8fff ) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( beehive_io, AS_IO, 8, beehive_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x11, 0x11) AM_READ_PORT("DIPS") + AM_RANGE(0x60, 0x60) AM_READ(beehive_60_r) + AM_RANGE(0x61, 0x61) AM_READ_PORT("MODIFIERS") + AM_RANGE(0x62, 0x62) AM_WRITE(beehive_62_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( beehive ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("{") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('{') PORT_CHAR('}') + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_PGDN) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7pad") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8pad") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9pad") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED // Does a HOME + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4pad") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5pad") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6pad") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("X8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1pad") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2pad") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3pad") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0pad") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("X9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".pad") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-pad") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + + PORT_START("X10") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("XMIT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + // This row is scanned but nothing happens + PORT_START("X11") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + // These probably not exist + PORT_START("X12") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_START("X13") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_START("X14") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_START("X15") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("MODIFIERS") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Capslock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LCtrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RCtrl") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RShift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x83, IP_ACTIVE_LOW, IPT_UNUSED) + + // assumed to be dipswitches, purpose unknown, see code from 12D + PORT_START("DIPS") + PORT_DIPNAME( 0x01, 0x01, "Switch A") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x02, 0x02, "Switch B") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_BIT(0x3c, 0x2c, IPT_UNUSED) // this is required to sync keyboard and A-LOCK indicator + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) // unused + PORT_DIPNAME( 0x80, 0x80, "Switch C") PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x80, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) +INPUT_PORTS_END + + +void beehive_state::machine_reset() +{ +} + +void beehive_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +/* This system appears to have inline attribute bytes of unknown meaning. + Currently they are ignored. */ +UINT32 beehive_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 cursor_pos = (m_p_videoram[0xcaf] | (m_p_videoram[0xcb0] << 8)) & 0xfff; + UINT16 p_linelist; + UINT8 line_length; + UINT8 y,ra,chr,gfx,inv; + UINT16 sy=0,ma,x; + + for (y = 0; y < 25; y++) + { + p_linelist = 0x1af + y*3; + line_length = m_p_videoram[p_linelist]+1; + ma = (m_p_videoram[p_linelist+1] | (m_p_videoram[p_linelist+2] << 8)) & 0xfff; + + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + UINT8 chars = 0; + + for (x = ma; x < ma + line_length; x++) + { + inv = gfx = chr = 0; + if (y == 24) inv=0xff; // status line reverse video + if (ra < 9) + { + if (x == cursor_pos) inv=0xff; // show cursor + chr = m_p_videoram[x]; // get char in videoram + gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; // get dot pattern in chargen + } + + if ((chars < 80) && (!BIT(chr, 7))) // ignore attribute bytes + { + chars++; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + } + } + return 0; +} + +static MACHINE_CONFIG_START( beehive, beehive_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8085A, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(beehive_mem) + MCFG_CPU_IO_MAP(beehive_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(beehive_state, screen_update) + MCFG_SCREEN_SIZE(640, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( beehive ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "dm3270-1.rom", 0x0000, 0x0800, CRC(781bde32) SHA1(a3fe25baadd2bfc2b1791f509bb0f4960281ee32) ) + ROM_LOAD( "dm3270-2.rom", 0x0800, 0x0800, CRC(4d3476b7) SHA1(627ad42029ca6c8574cda8134d047d20515baf53) ) + ROM_LOAD( "dm3270-3.rom", 0x1000, 0x0800, CRC(dbf15833) SHA1(ae93117260a259236c50885c5cecead2aad9b3c4) ) + + /* character generator not dumped, using the one from 'c10' for now */ + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, beehive, 0, 0, beehive, beehive, driver_device, 0, "BeeHive", "DM3270", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/besta.c b/src/mame/drivers/besta.c new file mode 100644 index 00000000000..32b19329c20 --- /dev/null +++ b/src/mame/drivers/besta.c @@ -0,0 +1,164 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + Besta-88 and Besta-90 engineering workstations. + + Derived (OEMd?) from Force Computers' SYS68K series. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/68230pit.h" +#include "machine/terminal.h" + +#define VERBOSE_DBG 1 /* general debug messages */ + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + +#define TERMINAL_TAG "terminal" + +class besta_state : public driver_device +{ +public: + besta_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pit1 (*this, "pit1"), + m_pit2 (*this, "pit2"), + m_terminal(*this, TERMINAL_TAG), + m_p_ram(*this, "p_ram") + { + } + + DECLARE_READ8_MEMBER( mpcc_reg_r ); + DECLARE_WRITE8_MEMBER( mpcc_reg_w ); + DECLARE_WRITE8_MEMBER( kbd_put ); + UINT8 m_term_data; + UINT8 m_mpcc_regs[32]; + + required_device m_maincpu; + required_device m_pit1; + required_device m_pit2; + virtual void machine_reset(); + + required_device m_terminal; + required_shared_ptr m_p_ram; +}; + +READ8_MEMBER( besta_state::mpcc_reg_r ) +{ + UINT8 ret; + + if (!(offset == 0 && !m_mpcc_regs[0])) { + DBG_LOG(1,"mpcc_reg_r",("(%d) = %02X at %s\n", offset, + (offset > 31 ? -1 : m_mpcc_regs[offset]), machine().describe_context())); + } + + switch (offset) { + case 0: /* r_stat aka ... */ + return (m_term_data) ? 0x80 : 0; + case 2: /* r_data aka ... */ + ret = m_term_data; + m_term_data = 0; + return ret; + default: + return m_mpcc_regs[offset]; + } +} + +WRITE8_MEMBER( besta_state::mpcc_reg_w ) +{ + device_t *devconf = machine().device(TERMINAL_TAG); + + DBG_LOG(1,"mpcc_reg_w",("(%d) <- %02X at %s\n", offset, data, machine().describe_context())); + + switch (offset) { + case 2: + m_term_data = data; + break; + case 10: + dynamic_cast(devconf)->write(*machine().memory().first_space(), 0, data); + default: + m_mpcc_regs[offset] = data; + break; + } +} + +WRITE8_MEMBER( besta_state::kbd_put ) +{ + mpcc_reg_w(space, (offs_t)2, data, mem_mask); +} + +static ADDRESS_MAP_START(besta_mem, AS_PROGRAM, 32, besta_state) + AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("p_ram") // local bus DRAM, 4MB +// AM_RANGE(0x08010000, 0x08011fff) AM_RAM // unknown -- accessed by cp31dssp +// AM_RANGE(0xfca03500, 0xfca0350f) AM_READWRITE8(iscsi_reg_r, iscsi_reg_w, 0xffffffff) + AM_RANGE(0xff000000, 0xff00ffff) AM_ROM AM_REGION("user1", 0) // actual mapping is up to 0xff03ffff + AM_RANGE(0xff040000, 0xff07ffff) AM_RAM // onboard SRAM +// AM_RANGE(0xff800000, 0xff80001f) AM_DEVREADWRITE8("mpcc", mpcc68561_t, reg_r, reg_w, 0xffffffff) + AM_RANGE(0xff800000, 0xff80001f) AM_READWRITE8(mpcc_reg_r, mpcc_reg_w, 0xffffffff) // console + AM_RANGE(0xff800200, 0xff800237) AM_DEVREADWRITE8 ("pit2", pit68230_device, read, write, 0xffffffff) +// AM_RANGE(0xff800400, 0xff800xxx) // ??? -- shows up in cp31dssp log +// AM_RANGE(0xff800800, 0xff800xxx) // 68153 BIM +// AM_RANGE(0xff800a00, 0xff800xxx) // 62421 RTC + AM_RANGE(0xff800c00, 0xff800c37) AM_DEVREADWRITE8 ("pit1", pit68230_device, read, write, 0xffffffff) +// AM_RANGE(0xff800e00, 0xff800xxx) // PIT3? +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( besta ) +INPUT_PORTS_END + + +void besta_state::machine_reset() +{ + UINT8* user1 = memregion("user1")->base(); + + memcpy((UINT8*)m_p_ram.target(),user1,0x10000); // not really what happens but... + memset(m_mpcc_regs, 0, sizeof(m_mpcc_regs)); // should initialize to defined values + m_mpcc_regs[8] = 0x80; // always ready to transmit + + m_maincpu->reset(); +} + +/* CP31 processor board */ +static MACHINE_CONFIG_START( besta, besta_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68030, 2*16670000) + MCFG_CPU_PROGRAM_MAP(besta_mem) + + MCFG_DEVICE_ADD ("pit1", PIT68230, 16670000 / 2) // XXX verify clock + + MCFG_DEVICE_ADD ("pit2", PIT68230, 16670000 / 2) // XXX verify clock + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(besta_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( besta88 ) + ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) + + ROM_SYSTEM_BIOS(0, "cp31dbg", "CP31 Debug") + ROMX_LOAD( "cp31dbgboot.27c512", 0x0000, 0x10000, CRC(9bf057de) SHA1(b13cb16042e4c6ca63ae26058a78259c0849d0b6), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "cp31dssp", "CP31 DSSP") + ROMX_LOAD( "cp31dsspboot.27c512", 0x0000, 0x10000, CRC(607a0a55) SHA1(c257a88672ab39d2f3fad681d22e062182b0236d), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "cp31os9", "CP31 OS9") + ROMX_LOAD( "cp31os9.27c512", 0x0000, 0x10000, CRC(607a0a55) SHA1(c257a88672ab39d2f3fad681d22e062182b0236d), ROM_BIOS(3)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1988, besta88, 0, 0, besta, besta, driver_device, 0, "Sapsan", "Besta-88", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/beta.c b/src/mame/drivers/beta.c new file mode 100644 index 00000000000..c545a4622a8 --- /dev/null +++ b/src/mame/drivers/beta.c @@ -0,0 +1,378 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Beta Computer + + http://retro.hansotten.nl/index.php?page=beta-computer + + When first started, press G to begin. + + Pasting: + 0-F : as is + M (inc) : ^ + AD : - + DA : = + GO : X + + Test Paste: + X-0011=11^22^33^44^55^66^77^88^99^-0011 + Now press M to confirm the data has been entered. + +****************************************************************************/ + +/* + + TODO: + + - verify whether feeding a 0xff-filled 2K binary file as cart allows + to write back correctly EPROM or not + +*/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/mos6530n.h" +#include "machine/ram.h" +#include "sound/speaker.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#include "beta.lh" + +#define SCREEN_TAG "screen" +#define M6502_TAG "m6502" +#define M6532_TAG "m6532" +#define EPROM_TAG "eprom" +//#define SPEAKER_TAG "b237" + +class beta_state : public driver_device +{ +public: + beta_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M6502_TAG), + m_speaker(*this, "speaker"), + m_eprom(*this, EPROM_TAG), + m_q6(*this, "Q6"), + m_q7(*this, "Q7"), + m_q8(*this, "Q8"), + m_q9(*this, "Q9") + { } + + required_device m_maincpu; + required_device m_speaker; + required_device m_eprom; + required_ioport m_q6; + required_ioport m_q7; + required_ioport m_q8; + required_ioport m_q9; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( riot_pa_r ); + DECLARE_WRITE8_MEMBER( riot_pa_w ); + DECLARE_READ8_MEMBER( riot_pb_r ); + DECLARE_WRITE8_MEMBER( riot_pb_w ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( beta_eprom ); + DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( beta_eprom ); + + /* EPROM state */ + int m_eprom_oe; + int m_eprom_ce; + UINT16 m_eprom_addr; + UINT8 m_eprom_data; + UINT8 m_old_data; + dynamic_buffer m_eprom_rom; + + /* display state */ + UINT8 m_ls145_p; + UINT8 m_segment; + + emu_timer *m_led_refresh_timer; + TIMER_CALLBACK_MEMBER(led_refresh); +}; + + +/* Memory Maps */ + +static ADDRESS_MAP_START( beta_mem, AS_PROGRAM, 8, beta_state ) + AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x7f00) AM_DEVICE(M6532_TAG, mos6532_t, ram_map) + AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x7f00) AM_DEVICE(M6532_TAG, mos6532_t, io_map) + AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x7800) AM_ROM +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( beta_state::trigger_reset ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( beta ) + PORT_START("Q6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Q7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Q8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Q9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, beta_state, trigger_reset, 0) +INPUT_PORTS_END + +/* M6532 Interface */ + +TIMER_CALLBACK_MEMBER(beta_state::led_refresh) +{ + if (m_ls145_p < 6) + { + output_set_digit_value(m_ls145_p, m_segment); + } +} + +READ8_MEMBER( beta_state::riot_pa_r ) +{ + /* + + bit description + + PA0 2716 D0, segment D, key bit 0 + PA1 2716 D1, segment E, key bit 1 + PA2 2716 D2, segment C, key bit 2 + PA3 2716 D3, segment G, key bit 3 + PA4 2716 D4, segment F, key bit 4 + PA5 2716 D5, segment B + PA6 2716 D6, segment A + PA7 2716 D7 + + */ + + UINT8 data = 0xff; + + switch (m_ls145_p) + { + case 6: data &= m_q6->read(); break; + case 7: data &= m_q7->read(); break; + case 8: data &= m_q8->read(); break; + case 9: data &= m_q9->read(); break; + default: + if (!m_eprom_oe && !m_eprom_ce) + { + data = m_eprom_rom[m_eprom_addr & 0x7ff]; + popmessage("EPROM read %04x = %02x\n", m_eprom_addr & 0x7ff, data); + } + } + + return data; +} + +WRITE8_MEMBER( beta_state::riot_pa_w ) +{ + /* + + bit description + + PA0 2716 D0, segment D, key bit 0 + PA1 2716 D1, segment E, key bit 1 + PA2 2716 D2, segment C, key bit 2 + PA3 2716 D3, segment G, key bit 3 + PA4 2716 D4, segment F, key bit 4 + PA5 2716 D5, segment B + PA6 2716 D6, segment A + PA7 2716 D7 + + */ + +// logerror("PA %02x\n", data); + + /* display */ + m_segment = BITSWAP8(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f; + m_led_refresh_timer->adjust(attotime::from_usec(70)); + + /* EPROM data */ + m_eprom_data = data; +} + +READ8_MEMBER( beta_state::riot_pb_r ) +{ + return 0; +} + +WRITE8_MEMBER( beta_state::riot_pb_w ) +{ + /* + + bit description + + PB0 74LS145 P0 + PB1 74LS145 P1 + PB2 74LS145 P2 + PB3 74LS145 P3, 74LS164 D + PB4 loudspeaker, data led + PB5 address led, 74LS164 CP + PB6 2716 _OE + PB7 2716 _CE + + */ + + //logerror("PB %02x %02x\n", data, olddata); + + /* display */ + m_ls145_p = data & 0x0f; + + /* speaker */ + m_speaker->level_w(!BIT(data, 4)); + + /* address led */ + output_set_led_value(0, BIT(data, 5)); + + /* data led */ + output_set_led_value(1, !BIT(data, 5)); + + /* EPROM address shift */ + if (!BIT(m_old_data, 5) && BIT(data, 5)) + { + m_eprom_addr <<= 1; + m_eprom_addr |= BIT(m_old_data, 3); + } + + /* EPROM output enable */ + m_eprom_oe = BIT(data, 6); + + /* EPROM chip enable */ + m_eprom_ce = BIT(data, 7); + + if (BIT(data, 6) && (!BIT(m_old_data, 7) && BIT(data, 7))) + { + popmessage("EPROM write %04x = %02x\n", m_eprom_addr & 0x7ff, m_eprom_data); + m_eprom_rom[m_eprom_addr & 0x7ff] &= m_eprom_data; + } + + m_old_data = data; +} + +/* EPROM socket */ + +DEVICE_IMAGE_LOAD_MEMBER( beta_state, beta_eprom ) +{ + UINT32 size = m_eprom->common_get_size("rom"); + + if (size != 0x800) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_eprom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_eprom->common_load_rom(m_eprom->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom ) +{ + if (image.software_entry() == NULL) + image.fwrite(&m_eprom_rom[0], 0x800); +} + +/* Machine Initialization */ + +void beta_state::machine_start() +{ + m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beta_state::led_refresh),this)); + + m_eprom_rom.resize(0x800); + + if (!m_eprom->exists()) + memset(&m_eprom_rom[0], 0xff, 0x800); + else + { + std::string region_tag; + memcpy(&m_eprom_rom[0], memregion(region_tag.assign(m_eprom->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(), 0x800); + } + + // state saving + save_item(NAME(m_eprom_oe)); + save_item(NAME(m_eprom_ce)); + save_item(NAME(m_eprom_addr)); + save_item(NAME(m_eprom_data)); + save_item(NAME(m_old_data)); + save_item(NAME(m_eprom_rom)); + save_item(NAME(m_ls145_p)); + save_item(NAME(m_segment)); +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( beta, beta_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_4MHz/4) + MCFG_CPU_PROGRAM_MAP(beta_mem) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_beta ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(M6532_TAG, MOS6532n, XTAL_4MHz/4) + MCFG_MOS6530n_IN_PA_CB(READ8(beta_state, riot_pa_r)) + MCFG_MOS6530n_OUT_PA_CB(WRITE8(beta_state, riot_pa_w)) + MCFG_MOS6530n_IN_PB_CB(READ8(beta_state, riot_pb_r)) + MCFG_MOS6530n_OUT_PB_CB(WRITE8(beta_state, riot_pb_w)) + MCFG_MOS6530n_IRQ_CB(INPUTLINE(M6502_TAG, M6502_IRQ_LINE)) + + /* EPROM socket */ + MCFG_GENERIC_CARTSLOT_ADD(EPROM_TAG, generic_plain_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(beta_state, beta_eprom) + MCFG_GENERIC_UNLOAD(beta_state, beta_eprom) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( beta ) + ROM_REGION( 0x10000, M6502_TAG, 0 ) + ROM_LOAD( "beta.rom", 0x8000, 0x0800, CRC(d42fdb17) SHA1(595225a0cd43dd76c46b2aff6c0f27d5991cc4f0)) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, beta, 0, 0, beta, beta, driver_device, 0, "Pitronics", "Beta", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/bigbord2.c b/src/mame/drivers/bigbord2.c new file mode 100644 index 00000000000..7f8612a2806 --- /dev/null +++ b/src/mame/drivers/bigbord2.c @@ -0,0 +1,621 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Big Board 2 + + 12/05/2009 Skeleton driver. + + This is very much under construction. + + Despite the name, this is not like the xerox or bigboard at all. + + It is compatible only if the software uses the same published + calls to the bios. Everything else is different. + +80 = sio ce +84 = ctca ce +88 = ctcb ce +8c = dma ce +c0 = prog +c4 = status 7,6,5,4 = sw1-4; 3 = kbdstb; 2 = motor; 1 = rxdb; 0 = rxda +c8 = sys1 +cc = sys2 +d0 = kbd +d4 = 1793 ce +d8 = port7 +dc = 6845 ce + + +Difficulties encountered: + +CTCA controls a pair of vectored interrupts. +One is triggered by a keypress, the other by a vsync pulse.. +Once a key is pressed, CTCA continually issues a keyboard interrupt, +causing a complete freeze. Therefore CTCA has been isolated, and the +2 interrupts are triggered by a hack. It isn't a very good hack, +because the system crashes after a while. However it will allow +testing and development to continue. + +The FDC has a INTRQ pin, the diagram says it goes to page 6, but +it just vanishes instead. + +What works: + +Turn it on, wait for cursor to appear in the top corner. Press Enter. +Now you can enter commands. + +Memory banking: + +0000-7FFF are controlled by bit 0 of port C8, and select ROM&video, or RAM +8000-FFFF control if RAM is onboard, or on S100 bus (do not know what controls this) +We do not emulate the S100, so therefore banks 1&2 are the same as 3&4. +The switching from port C8 is emulated. + +ToDo: +- Finish floppy disk support (i have no boot disk) +- Finish the DMA switch in portcc_w. +- Fix the above problems with the CTC. +- Finish connecting up the SIO, when it becomes usable. +- Connect up the SASI, Centronics and other interfaces on ports D8-DB. +- Connect up the programming port C0-C3. +- Connect up the numerous board jumpers. +- Need software + +Monitor commands: +B - boot from disk +C - copy memory +D - dump memory +F - fill memory +G - go +I - in port +M - modify memory +O - out port +R - read a sector +T - test memory +V - compare blocks of memory +X - change banks + +****************************************************************************/ + + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/z80dma.h" +#include "video/mc6845.h" +#include "machine/keyboard.h" +#include "sound/beep.h" +#include "machine/wd_fdc.h" + +#define SCREEN_TAG "screen" +#define KEYBOARD_TAG "keyboard" +#define Z80_TAG "u39" +#define Z80SIO_TAG "u16" +#define Z80CTCA_TAG "u37" +#define Z80CTCB_TAG "u21" +#define Z80DMA_TAG "u62" + +class bigbord2_state : public driver_device +{ +public: + bigbord2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_6845(*this, "crtc"), + m_ctca(*this, Z80CTCA_TAG), + m_ctcb(*this, Z80CTCB_TAG), + m_dma(*this, Z80DMA_TAG), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_beeper(*this, "beeper"), + m_dsw(*this, "DSW"), + m_bankr(*this, "bankr"), + m_bankv(*this, "bankv"), + m_banka(*this, "banka"), + m_palette(*this, "palette") + { + } + + DECLARE_WRITE8_MEMBER(portc8_w ); + DECLARE_WRITE8_MEMBER(portcc_w ); + DECLARE_READ8_MEMBER(portc4_r); + DECLARE_READ8_MEMBER(portd0_r); + DECLARE_WRITE8_MEMBER(bigbord2_kbd_put); + DECLARE_WRITE_LINE_MEMBER(intrq_w); + DECLARE_WRITE_LINE_MEMBER(drq_w); + DECLARE_WRITE_LINE_MEMBER(frame); + DECLARE_DRIVER_INIT(bigbord2); + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + MC6845_UPDATE_ROW(crtc_update_row); + UINT8 *m_p_chargen; /* character ROM */ + UINT8 *m_p_videoram; /* Video RAM */ + UINT8 *m_p_attribram; /* Attribute RAM */ +private: + UINT8 m_term_data; + UINT8 m_term_status; + int m_c8[8]; + floppy_image_device *m_floppy; + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + void fdc_intrq_w(bool state); + void fdc_drq_w(bool state); + address_space *m_mem; + address_space *m_io; + required_device m_maincpu; + required_device m_6845; + required_device m_ctca; + required_device m_ctcb; + required_device m_dma; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_beeper; + required_ioport m_dsw; + required_memory_bank m_bankr; + required_memory_bank m_bankv; + required_memory_bank m_banka; +public: + required_device m_palette; +}; + +/* Status port + 0 = RXDA + 1 = RXDB + 2 = MOTOR + 3 = KBDSTB + 4 = DIPSW 1 + 5 = DIPSW 2 + 6 = DIPSW 3 + 7 = DIPSW 4 */ + +READ8_MEMBER( bigbord2_state::portc4_r ) +{ + UINT8 ret = m_term_status | 3 | (m_c8[6]<<2) | m_dsw->read(); + m_term_status = 0; + return ret; +} + +// KBD port - read ascii value of key pressed + +READ8_MEMBER( bigbord2_state::portd0_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( bigbord2_state::bigbord2_kbd_put ) +{ + if (data) + { + m_term_data = data; + m_term_status = 8; + m_ctca->trg0(0); + m_ctca->trg0(1); + if (m_mem->read_byte(0xf13d) == 0x4d) + { + // simulate interrupt by saving current pc on + // the stack and jumping to interrupt handler. + UINT16 spreg = m_maincpu->state_int(Z80_SP); + UINT16 pcreg = m_maincpu->state_int(Z80_PC); + spreg--; + m_mem->write_byte(spreg, pcreg >> 8); + spreg--; + m_mem->write_byte(spreg, pcreg); + m_maincpu->set_state_int(Z80_SP, spreg); + m_maincpu->set_state_int(Z80_PC, 0xF120); + } + } +} + +/* Z80 DMA */ + + +READ8_MEMBER(bigbord2_state::memory_read_byte) +{ + return m_mem->read_byte(offset); +} + +WRITE8_MEMBER(bigbord2_state::memory_write_byte) +{ + m_mem->write_byte(offset, data); +} + +READ8_MEMBER(bigbord2_state::io_read_byte) +{ + return m_io->read_byte(offset); +} + +WRITE8_MEMBER(bigbord2_state::io_write_byte) +{ + m_io->write_byte(offset, data); +} + + +/* Read/Write Handlers */ + + +WRITE8_MEMBER( bigbord2_state::portc8_w ) +{ + /* + + This port uses a 74LS259, which allows individual bits + to be switched on and off, while the other bits are + unaffected. + + bit signal description + + 0 D_S memory bank + 1 SIDSEL side select + 2 SMC1 u6 data separator pin 5 + 3 SMC2 u6 data separator pin 6 + 4 DDEN density + 5 HLD head load + 6 MOTOR disk motor + 7 BELL beeper pulse + + */ + + m_c8[data&7] = BIT(data, 3); + + switch (data&7) + { + case 0: + // memory bank + m_bankr->set_entry(m_c8[0]); + m_bankv->set_entry(m_c8[0]); + m_banka->set_entry(m_c8[0]); + break; + case 1: + // side select + if (m_floppy) + { + m_floppy->ss_w(m_c8[1]); + } + + break; + + case 2: + case 3: + // these connect to "U6 (FDC9216B)" which drives the fdc "rawread" and "rclk" pins + break; + case 4: + // density + m_fdc->dden_w(m_c8[4]); + break; + case 5: + // connects to HLD pin on floppy drive + break; + case 6: + // motor on + if (m_floppy) + { + m_floppy->mon_w(~m_c8[6]); + } + break; + case 7: + // beeper + m_beeper->set_state(m_c8[7]); + break; + } +} + +WRITE8_MEMBER( bigbord2_state::portcc_w ) +{ + /* + + bit signal description + + 0,1,2 operates a 74LS151 for 8 individual inputs to DMA RDY + 0 W/RDYA channel A of SIO + 1 W/RDYB channel B of SIO + 2 DRQ DRQ on fdc + 3 JB7 pin 1 + 4 JB7 pin 2 + 5 JB7 pin 3 + 6 JB7 pin 4 + 7 JB7 pin 5 + 3 /TEST test pin on FDC + 4 DS3 drive 3 select + 5 DS2 drive 2 select + 6 DS1 drive 1 select + 7 DS0 drive 0 select + + */ + + /* drive select */ + m_floppy = NULL; + if BIT(data, 7) m_floppy = m_floppy0->get_device(); + if BIT(data, 6) m_floppy = m_floppy1->get_device(); + //if BIT(data, 5) m_floppy = m_floppy2->get_device(); + //if BIT(data, 4) m_floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(m_floppy); + + bool dma_rdy = 0; + if ((data & 7) == 2) + dma_rdy = m_fdc->drq_r(); + + m_dma->rdy_w(dma_rdy); +} + + + +/* Memory Maps */ + +static ADDRESS_MAP_START( bigbord2_mem, AS_PROGRAM, 8, bigbord2_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bankr") + AM_RANGE(0x1000, 0x5fff) AM_RAM + AM_RANGE(0x6000, 0x6fff) AM_RAMBANK("bankv") + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("banka") + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bigbord2_io, AS_IO, 8, bigbord2_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) + //AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(Z80CTCA_TAG, z80ctc_device, read, write) //has issues + AM_RANGE(0x88, 0x8b) AM_DEVREADWRITE(Z80CTCB_TAG, z80ctc_device, read, write) + AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) + //AM_RANGE(0xC0, 0xC3) eprom programming port + AM_RANGE(0xC4, 0xC7) AM_READ(portc4_r) + AM_RANGE(0xC8, 0xCB) AM_WRITE(portc8_w) + AM_RANGE(0xCC, 0xCF) AM_WRITE(portcc_w) + AM_RANGE(0xD0, 0xD3) AM_READ(portd0_r) + AM_RANGE(0xD4, 0xD7) AM_DEVREADWRITE("fdc", mb8877_t, read, write) + //AM_RANGE(0xD8, 0xDB) AM_READWRITE(portd8_r, portd8_w) // various external data ports; DB = centronics printer + AM_RANGE(0xDC, 0xDC) AM_MIRROR(2) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0xDD, 0xDD) AM_MIRROR(2) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) +ADDRESS_MAP_END + + +/* Input Ports */ + +static INPUT_PORTS_START( bigbord2 ) + PORT_START("DSW") + PORT_BIT( 0xf, 0, IPT_UNUSED ) + PORT_DIPNAME( 0x10, 0x10, "Switch 4") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x10, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x20, 0x00, "Switch 3") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x20, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x40, 0x00, "Switch 2") PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x40, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x80, 0x00, "Switch 1") PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x80, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) +INPUT_PORTS_END + + +/* Z80 CTC */ + +TIMER_DEVICE_CALLBACK_MEMBER(bigbord2_state::ctc_tick) +{ + m_ctcb->trg0(1); + m_ctcb->trg1(1); + m_ctcb->trg0(0); + m_ctcb->trg1(0); +} + +WRITE_LINE_MEMBER( bigbord2_state::frame ) +{ + static UINT8 framecnt; + framecnt++; + + if ((m_mem->read_byte(0xf13d) == 0x4d) & (framecnt > 3)) + { + framecnt = 0; + // simulate interrupt by saving current pc on + // the stack and jumping to interrupt handler. + UINT16 spreg = m_maincpu->state_int(Z80_SP); + UINT16 pcreg = m_maincpu->state_int(Z80_PC); + spreg--; + m_mem->write_byte(spreg, pcreg >> 8); + spreg--; + m_mem->write_byte(spreg, pcreg); + m_maincpu->set_state_int(Z80_SP, spreg); + m_maincpu->set_state_int(Z80_PC, 0xF18E); + } +} + + +/* Z80 Daisy Chain */ + +static const z80_daisy_config bigbord2_daisy_chain[] = +{ + { Z80DMA_TAG }, + { Z80CTCA_TAG }, + { Z80CTCB_TAG }, + { Z80SIO_TAG }, + { NULL } +}; + +/* WD1793 Interface */ + +static SLOT_INTERFACE_START( bigbord2_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + + +/* Video */ + +void bigbord2_state::video_start() +{ + /* find memory regions */ + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion(Z80_TAG)->base()+0x6000; + m_p_attribram = memregion(Z80_TAG)->base()+0x7000; +} + + +/* Machine Initialization */ + +void bigbord2_state::machine_start() +{ + /* register for state saving */ + save_item(NAME(m_term_data)); +} + +void bigbord2_state::machine_reset() +{ + UINT8 i; + for (i = 0; i < 8; i++) + m_c8[i] = 0; + m_beeper->set_state(0); + m_beeper->set_frequency(950); // actual frequency is unknown + m_bankr->set_entry(0); + m_bankv->set_entry(0); + m_banka->set_entry(0); +} + +DRIVER_INIT_MEMBER(bigbord2_state,bigbord2) +{ + m_mem = &m_maincpu->space(AS_PROGRAM); + m_io = &m_maincpu->space(AS_IO); + UINT8 *RAM = memregion(Z80_TAG)->base(); + m_bankr->configure_entries(0, 2, &RAM[0x0000], 0x10000); + m_bankv->configure_entries(0, 2, &RAM[0x6000], 0x10000); + m_banka->configure_entries(0, 2, &RAM[0x7000], 0x10000); +} + + +/* Screen */ + +/* F4 Character Displayer */ +static const gfx_layout bigbord2_charlayout = +{ + 8, 16, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( bigbord2 ) + GFXDECODE_ENTRY( "chargen", 0x0000, bigbord2_charlayout, 0, 1 ) +GFXDECODE_END + +MC6845_UPDATE_ROW( bigbord2_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,inv; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + inv=0; + mem = (ma + x) & 0x7ff; + if (BIT(m_p_attribram[mem], 7)) inv^=0xff; + chr = m_p_videoram[mem]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; + + /* Display a scanline of a character */ + *p++ = palette[BIT( gfx, 7 )]; + *p++ = palette[BIT( gfx, 6 )]; + *p++ = palette[BIT( gfx, 5 )]; + *p++ = palette[BIT( gfx, 4 )]; + *p++ = palette[BIT( gfx, 3 )]; + *p++ = palette[BIT( gfx, 2 )]; + *p++ = palette[BIT( gfx, 1 )]; + *p++ = palette[BIT( gfx, 0 )]; + } +} + +/* Machine Drivers */ + +#define MAIN_CLOCK XTAL_8MHz / 2 + +static MACHINE_CONFIG_START( bigbord2, bigbord2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, MAIN_CLOCK) + MCFG_CPU_PROGRAM_MAP(bigbord2_mem) + MCFG_CPU_IO_MAP(bigbord2_io) + MCFG_CPU_CONFIG(bigbord2_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_10_69425MHz, 700, 0, 560, 260, 0, 240) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", bigbord2) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* keyboard */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bigbord2_state, ctc_tick, attotime::from_hz(MAIN_CLOCK)) + + /* devices */ + MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, MAIN_CLOCK) + MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(bigbord2_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(bigbord2_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(bigbord2_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(bigbord2_state, io_write_byte)) + + MCFG_Z80SIO0_ADD(Z80SIO_TAG, MAIN_CLOCK, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80CTCA_TAG, Z80CTC, MAIN_CLOCK) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + // other inputs of ctca: + // trg0 = KBDSTB; trg1 = index pulse from fdc; trg2 = synca output from sio + + MCFG_DEVICE_ADD(Z80CTCB_TAG, Z80CTC, MAIN_CLOCK / 6) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + // ZC0 = SIO channel B clock, ZC1 = SIO channel A clock + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTCB_TAG, z80ctc_device, trg3)) + + MCFG_MB8877_ADD("fdc", XTAL_16MHz / 16) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", bigbord2_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", bigbord2_floppies, "525dd", floppy_image_device::default_floppy_formats) + + MCFG_MC6845_ADD("crtc", MC6845, SCREEN_TAG, XTAL_16MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(bigbord2_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(bigbord2_state, frame)) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(bigbord2_state, bigbord2_kbd_put)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + +/* ROMs */ + + +ROM_START( bigbord2 ) + ROM_REGION( 0x18000, Z80_TAG, 0 ) + ROM_LOAD( "bigbrdii.bin", 0x0000, 0x1000, CRC(c588189e) SHA1(4133903171ee8b9fcf12cc72de843af782b4a645) ) + + // internal to 8002 chip (undumped) we will use one from 'vta2000' for now + ROM_REGION( 0x2000, "chargen", ROMREGION_INVERT ) + ROM_LOAD( "bdp-15_14.rom", 0x0000, 0x2000, BAD_DUMP CRC(a1dc4f8e) SHA1(873fd211f44713b713d73163de2d8b5db83d2143) ) +ROM_END +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, bigbord2, bigboard, 0, bigbord2, bigbord2, bigbord2_state, bigbord2, "Digital Research Computers", "Big Board II", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/binbug.c b/src/mame/drivers/binbug.c new file mode 100644 index 00000000000..14c079e6156 --- /dev/null +++ b/src/mame/drivers/binbug.c @@ -0,0 +1,590 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + BINBUG and DG640 + + 2013-01-14 Driver created + + All input must be in uppercase. + + Commands: + A - See and alter memory + B - Set breakpoint (2 permitted) + C - Clear breakpoint + D - cassette save + G - Go to address, run + L - cassette load + S - See and alter registers + + BINBUG is an alternate bios to PIPBUG, however it uses its own + video output. Method of output is through a DG640 board (sold by + Applied Technology) which uses a MCM6574 as a character generator. + The DG640 also supports blinking, reverse-video, and LORES graphics. + It is a S100 card, also known as ETI-640. + + Keyboard input, like PIPBUG, is via a serial device. + The baud rate is 300, 8N1. + + The SENSE and FLAG lines are used for 300 baud cassette, in + conjunction with unknown hardware. + + There are 3 versions of BINBUG: + + - 3.6 300 baud tape routines, 300 baud keyboard, memory-mapped VDU + + - 4.4 300 baud keyboard, ACOS tape system, advanced video routines + + - 5.2 ACOS tape system, 1200 baud terminal + + + Status: + - DG640 is completely emulated, even though BINBUG doesn't use most + of its features. + - BINBUG works except that the cassette interface isn't the same as + real hardware. But you can save, and load it back. + + ToDo: + - Need dumps of 4.4 and 5.2. + - Fix cassette + +****************************************************************************/ + +#include "bus/rs232/keyboard.h" +#include "cpu/s2650/s2650.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "imagedev/snapquik.h" + +#define KEYBOARD_TAG "keyboard" + +class binbug_state : public driver_device +{ +public: + binbug_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_rs232(*this, KEYBOARD_TAG), + m_cass(*this, "cassette"), + m_p_videoram(*this, "videoram"), + m_p_attribram(*this, "attribram"), + m_maincpu(*this, "maincpu") + { + } + + DECLARE_WRITE8_MEMBER(binbug_ctrl_w); + DECLARE_READ8_MEMBER(binbug_serial_r); + DECLARE_WRITE_LINE_MEMBER(binbug_serial_w); + const UINT8 *m_p_chargen; + UINT8 m_framecnt; + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + optional_device m_rs232; + required_device m_cass; + required_shared_ptr m_p_videoram; + required_shared_ptr m_p_attribram; + required_device m_maincpu; + DECLARE_QUICKLOAD_LOAD_MEMBER( binbug ); +}; + +WRITE8_MEMBER( binbug_state::binbug_ctrl_w ) +{ +} + +READ8_MEMBER( binbug_state::binbug_serial_r ) +{ + return m_rs232->rxd_r() & (m_cass->input() < 0.03); +} + +WRITE_LINE_MEMBER( binbug_state::binbug_serial_w ) +{ + m_cass->output(state ? -1.0 : +1.0); +} + +static ADDRESS_MAP_START(binbug_mem, AS_PROGRAM, 8, binbug_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x03ff) AM_ROM + AM_RANGE( 0x0400, 0x77ff) AM_RAM + AM_RANGE( 0x7800, 0x7bff) AM_RAM AM_SHARE("videoram") + AM_RANGE( 0x7c00, 0x7fff) AM_RAM AM_SHARE("attribram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(binbug_io, AS_IO, 8, binbug_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_WRITE(binbug_ctrl_w) + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(binbug_serial_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( binbug ) +INPUT_PORTS_END + +void binbug_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 binbug_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +// attributes bit 0 = flash, bit 1 = lores. Also bit 7 of the character = reverse-video (text only). + UINT8 y,ra,chr,gfx,attr,inv,gfxbit; + UINT16 sy=0,ma=0,x; + bool flash; + m_framecnt++; + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 16; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x++) + { + attr = m_p_attribram[x]; + chr = m_p_videoram[x]; + flash = BIT(m_framecnt, 4) & BIT(attr, 0); + + if (BIT(attr, 1)) // lores gfx - can flash + { + if (flash) chr = 0; // blank part of flashing + + gfxbit = (ra & 0x0c)>>1; + /* Display one line of a lores character (8 pixels) */ + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + gfxbit++; + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + } + else + { + gfx = 0; + + if (!flash) + { + inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed + chr &= 0x7f; + gfx = inv; + + // if g,j,p,q,y; lower the descender + if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79)) + { + if (ra > 6) + gfx = m_p_chargen[(chr<<4) | (ra-7) ] ^ inv; + } + else + { + if ((ra > 3) & (ra < 13)) + gfx = m_p_chargen[(chr<<4) | (ra-4) ] ^ inv; + } + } + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + } + ma+=64; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout dg640_charlayout = +{ + 7, 9, /* 7 x 9 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( dg640 ) + GFXDECODE_ENTRY( "chargen", 0x0000, dg640_charlayout, 0, 1 ) +GFXDECODE_END + +QUICKLOAD_LOAD_MEMBER( binbug_state, binbug ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int i; + int quick_addr = 0x440; + int exec_addr; + int quick_length; + dynamic_buffer quick_data; + int read_; + int result = IMAGE_INIT_FAIL; + + quick_length = image.length(); + if (quick_length < 0x0444) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.message(" File too short"); + } + else if (quick_length > 0x8000) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.message(" File too long"); + } + else + { + quick_data.resize(quick_length); + read_ = image.fread( &quick_data[0], quick_length); + if (read_ != quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.message(" Cannot read the file"); + } + else if (quick_data[0] != 0xc4) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.message(" Invalid header"); + } + else + { + exec_addr = quick_data[1] * 256 + quick_data[2]; + + if (exec_addr >= quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.message(" Exec address beyond end of file"); + } + else + { + for (i = quick_addr; i < read_; i++) + space.write_byte(i, quick_data[i]); + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); + + // Start the quickload + m_maincpu->set_state_int(S2650_PC, exec_addr); + + result = IMAGE_INIT_PASS; + } + } + } + + return result; +} + +static DEVICE_INPUT_DEFAULTS_START( keyboard ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_300 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +static MACHINE_CONFIG_START( binbug, binbug_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(binbug_mem) + MCFG_CPU_IO_MAP(binbug_io) + MCFG_S2650_FLAG_HANDLER(WRITELINE(binbug_state, binbug_serial_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(binbug_state, screen_update) + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", dg640) + MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") + + /* Keyboard */ + MCFG_RS232_PORT_ADD(KEYBOARD_TAG, default_rs232_devices, "keyboard") + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("keyboard", keyboard) + + /* Cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", binbug_state, binbug, "pgm", 1) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( binbug ) + ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "binbug.rom", 0x0000, 0x0400, CRC(2cb1ac6e) SHA1(a969883fc767484d6b0fa103cfa4b4129b90441b) ) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "6574.bin", 0x0000, 0x0800, CRC(fd75df4f) SHA1(4d09aae2f933478532b7d3d1a2dee7123d9828ca) ) + ROM_FILL(0, 16, 0) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, binbug, pipbug, 0, binbug, binbug, driver_device, 0, "MicroByte", "BINBUG 3.6", 0 ) + + + +/******************************************************************************************************************/ + +/* + +DG680 (ETI-680), using the DGOS-Z80 operating system. + +This is a S100 card. + +In some ways, this system is the ancestor of the original Microbee. + +ROM is typed in from a PDF, therefore marked a bad dump. + +No schematic available, most of this is guesswork. + +Port 0 is the input from an ascii keyboard. + +Port 2 is the cassette interface. + +Port 8 controls some kind of memory protection scheme. +The code indicates that B is the page to protect, and +A is the code (0x08 = inhibit; 0x0B = unprotect; +0x0C = enable; 0x0E = protect). There are 256 pages so +each page is 256 bytes. + +The clock is controlled by the byte in D80D. + +Monitor Commands: +C (compare)* +E (edit)* +F (fill)* +G - Go to address +I - Inhibit CTC +M (move)* +P (clear screen)* +R (read tape)* +S (search)* +T hhmm [ss] - Set the time +W (write tape)* +X - protection status +XC - clear ram +XD - same as X +XE - enable facilities +XF - disable facilities +XP - protect block +XU - unprotect block +Z - go to 0000. + +* These commands are identical to the Microbee ones. + +ToDo: +- dips +- leds +- need schematic to find out what else is missing +- cassette +- ctc / clock + +*/ + + +#include "cpu/z80/z80.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "cpu/z80/z80daisy.h" + + +class dg680_state : public binbug_state +{ +public: + dg680_state(const machine_config &mconfig, device_type type, const char *tag) + : binbug_state(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ctc(*this, "z80ctc"), + m_pio(*this, "z80pio") + { } + + DECLARE_READ8_MEMBER(porta_r); + DECLARE_READ8_MEMBER(portb_r); + DECLARE_WRITE8_MEMBER(portb_w); + DECLARE_READ8_MEMBER(port08_r); + DECLARE_WRITE8_MEMBER(port08_w); + DECLARE_WRITE8_MEMBER(kbd_put); + TIMER_DEVICE_CALLBACK_MEMBER(time_tick); + TIMER_DEVICE_CALLBACK_MEMBER(uart_tick); + UINT8 m_pio_b; + UINT8 m_term_data; + UINT8 m_protection[0x100]; + virtual void machine_reset(); + required_device m_maincpu; + required_device m_ctc; + required_device m_pio; +}; + +static ADDRESS_MAP_START(dg680_mem, AS_PROGRAM, 8, dg680_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xcfff) AM_RAM + AM_RANGE( 0xd000, 0xd7ff) AM_ROM + AM_RANGE( 0xd800, 0xefff) AM_RAM + AM_RANGE( 0xf000, 0xf3ff) AM_RAM AM_SHARE("videoram") + AM_RANGE( 0xf400, 0xf7ff) AM_RAM AM_SHARE("attribram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(dg680_io, AS_IO, 8, dg680_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00,0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x04,0x07) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + AM_RANGE(0x08,0x08) AM_READWRITE(port08_r,port08_w) //SWP Control and Status + //AM_RANGE(0x09,0x09) parallel input port + // Optional AM9519 Programmable Interrupt Controller (port c = data, port d = control) + //AM_RANGE(0x0c,0x0d) AM_DEVREADWRITE("am9519", am9519_device, read, write) +ADDRESS_MAP_END + +void dg680_state::machine_reset() +{ + m_maincpu->set_pc(0xd000); +} + +// this is a guess there is no information available +static const z80_daisy_config dg680_daisy_chain[] = +{ + { "z80ctc" }, + { "z80pio" }, + { NULL } +}; + + +/* Input ports */ +static INPUT_PORTS_START( dg680 ) +INPUT_PORTS_END + +WRITE8_MEMBER( dg680_state::kbd_put ) +{ + m_term_data = data; + /* strobe in keyboard data */ + m_pio->strobe_a(0); + m_pio->strobe_a(1); +} + +READ8_MEMBER( dg680_state::porta_r ) +{ + UINT8 data = m_term_data; + m_term_data = 0; + return data; +} + +READ8_MEMBER( dg680_state::portb_r ) +{ + return m_pio_b | (m_cass->input() > 0.03); +} + +// bit 1 = cassout; bit 2 = motor on +WRITE8_MEMBER( dg680_state::portb_w ) +{ + m_pio_b = data & 0xfe; + m_cass->output(BIT(data, 1) ? -1.0 : +1.0); +} + +READ8_MEMBER( dg680_state::port08_r ) +{ + UINT8 breg = m_maincpu->state_int(Z80_B); + return m_protection[breg]; +} + +WRITE8_MEMBER( dg680_state::port08_w ) +{ + UINT8 breg = m_maincpu->state_int(Z80_B); + m_protection[breg] = data; +} + +TIMER_DEVICE_CALLBACK_MEMBER(dg680_state::time_tick) +{ +// ch0 is for the clock + m_ctc->trg0(1); + m_ctc->trg0(0); +// no idea about ch2 + m_ctc->trg2(1); + m_ctc->trg2(0); +} + +TIMER_DEVICE_CALLBACK_MEMBER(dg680_state::uart_tick) +{ +// ch3 is for cassette + m_ctc->trg3(1); + m_ctc->trg3(0); +} + +static MACHINE_CONFIG_START( dg680, dg680_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz / 4) + MCFG_CPU_PROGRAM_MAP(dg680_mem) + MCFG_CPU_IO_MAP(dg680_io) + MCFG_CPU_CONFIG(dg680_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(binbug_state, screen_update) + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", dg640) + MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") + + /* Keyboard */ + MCFG_DEVICE_ADD("keyb", GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(dg680_state, kbd_put)) + + /* Cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_8MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_8MHz / 4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(dg680_state, porta_r)) + // OUT_ARDY - this activates to ask for kbd data but not known if actually used + MCFG_Z80PIO_IN_PB_CB(READ8(dg680_state, portb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(dg680_state, portb_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc0", dg680_state, time_tick, attotime::from_hz(200)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc3", dg680_state, uart_tick, attotime::from_hz(4800)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( dg680 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "dg680.rom", 0xd000, 0x0800, BAD_DUMP CRC(c1aaef6a) SHA1(1508ca8315452edfb984718e795ccbe79a0c0b58) ) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "6574.bin", 0x0000, 0x0800, CRC(fd75df4f) SHA1(4d09aae2f933478532b7d3d1a2dee7123d9828ca) ) + + ROM_REGION( 0x0020, "proms", 0 ) + ROM_LOAD( "82s123.bin", 0x0000, 0x0020, NO_DUMP ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, dg680, 0, 0, dg680, dg680, driver_device, 0, "David Griffiths", "DG680 with DGOS-Z80 1.4", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/bitgraph.c b/src/mame/drivers/bitgraph.c new file mode 100644 index 00000000000..8209fe9f20c --- /dev/null +++ b/src/mame/drivers/bitgraph.c @@ -0,0 +1,622 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + BBN BitGraph -- monochrome, raster graphics (768x1024), serial terminal. + + Apparently had at least four hardware revisions, A-D, but which ROM + revisions support which hardware is unclear. A Versabus slot, and + various hardware and software options are mentioned in the docs. Best + guesses follow. + + Onboard hardware (common to all revisions) is + - 32K ROM + - 128K RAM (includes frame buffer) + - 3 serial ports, each driven by 6850 ACIA + - some kind of baud rate generator, possibly COM8016 + - sync serial port, driven by 6854 but apparently never supported by ROM + - 682x PIA + - AY-3-891x PSG + - ER2055 EAROM + - DEC VT100 keyboard interface + + Rev A has additional 4th serial port for mouse (not supported by ROM 1.25). + Rev A has 40 hz realtime clock, the rest use 1040 hz. + Rev A-C use AY-3-8912 (with one external PIO port, to connect the EAROM). + Rev D uses AY-3-8913 (no external ports; EAROM is wired to TBD). + Rev B-D have onboard 8035 to talk to parallel printer and mouse. + Rev B-D have more memory (at least up to 512K). + + ROM 1.25 doesn't support mouse, setup mode, pixel data upload and autowrap. + + Missing/incorrect emulation: + Bidirectional keyboard interface (to drive LEDs and speaker). + 8035. + EAROM. + 1.25 only -- clksync() is dummied out -- causes watchdog resets. + Selectable memory size. + Video enable/reverse video switch. + +****************************************************************************/ + +#include "emu.h" + +#include "bus/centronics/ctronics.h" +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/6821pia.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "machine/com8116.h" +#include "machine/er2055.h" +#include "machine/i8243.h" +#include "machine/mc6854.h" +#include "machine/ram.h" +#include "sound/ay8910.h" + +#include "bitgrpha.lh" +#include "bitgrphb.lh" + +#define M68K_TAG "maincpu" +#define PPU_TAG "ppu" + +#define ACIA0_TAG "acia0" +#define ACIA1_TAG "acia1" +#define ACIA2_TAG "acia2" +#define ACIA3_TAG "acia3" +#define RS232_H_TAG "rs232host" +#define RS232_K_TAG "rs232kbd" +#define RS232_D_TAG "rs232debug" +#define RS232_M_TAG "rs232mouse" +#define COM8116_A_TAG "com8116_a" +#define COM8116_B_TAG "com8116_b" +#define ADLC_TAG "adlc" +#define PIA_TAG "pia" +#define PSG_TAG "psg" +#define EAROM_TAG "earom" + +#define VERBOSE_DBG 1 /* general debug messages */ + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + +class bitgraph_state : public driver_device +{ +public: + bitgraph_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, M68K_TAG) + , m_ram(*this, RAM_TAG) + , m_acia0(*this, ACIA0_TAG) + , m_acia1(*this, ACIA1_TAG) + , m_acia2(*this, ACIA2_TAG) + , m_acia3(*this, ACIA3_TAG) + , m_adlc(*this, ADLC_TAG) + , m_dbrga(*this, COM8116_A_TAG) + , m_dbrgb(*this, COM8116_B_TAG) + , m_pia(*this, PIA_TAG) + , m_psg(*this, PSG_TAG) + , m_earom(*this, EAROM_TAG) + , m_centronics(*this, "centronics") + , m_screen(*this, "screen") + { } + + DECLARE_READ8_MEMBER( pia_r ); + DECLARE_WRITE8_MEMBER( pia_w ); + DECLARE_READ8_MEMBER( pia_pa_r ); + DECLARE_READ8_MEMBER( pia_pb_r ); + DECLARE_WRITE8_MEMBER( pia_pa_w ); + DECLARE_WRITE8_MEMBER( pia_pb_w ); + DECLARE_READ_LINE_MEMBER( pia_ca1_r ); + DECLARE_READ_LINE_MEMBER( pia_cb1_r ); + DECLARE_WRITE_LINE_MEMBER( pia_ca2_w ); + DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); + + DECLARE_WRITE16_MEMBER( baud_write ); + DECLARE_WRITE_LINE_MEMBER( com8116_a_fr_w ); + DECLARE_WRITE_LINE_MEMBER( com8116_a_ft_w ); + DECLARE_WRITE_LINE_MEMBER( com8116_b_fr_w ); + DECLARE_WRITE_LINE_MEMBER( com8116_b_ft_w ); + + DECLARE_READ8_MEMBER( adlc_r ); + DECLARE_WRITE8_MEMBER( adlc_w ); + + DECLARE_WRITE8_MEMBER( earom_write ); + DECLARE_WRITE8_MEMBER( misccr_write ); + DECLARE_WRITE_LINE_MEMBER( system_clock_write ); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( ppu_read ); + DECLARE_WRITE8_MEMBER( ppu_write ); + DECLARE_WRITE8_MEMBER( ppu_i8243_w ); + +private: + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_ram; + required_device m_acia0; + required_device m_acia1; + required_device m_acia2; + optional_device m_acia3; + optional_device m_adlc; + required_device m_dbrga; + required_device m_dbrgb; + required_device m_pia; + required_device m_psg; + required_device m_earom; + optional_device m_centronics; + required_device m_screen; + + UINT8 *m_videoram; + UINT8 m_misccr; + UINT8 m_pia_a; + UINT8 m_pia_b; + UINT8 m_ppu[4]; +}; + +static ADDRESS_MAP_START(bitgrapha_mem, AS_PROGRAM, 16, bitgraph_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x007fff) AM_ROM + AM_RANGE(0x010000, 0x010001) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, data_r, data_w, 0xff00) // HOST + AM_RANGE(0x010002, 0x010003) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, status_r, control_w, 0xff00) + AM_RANGE(0x010008, 0x010009) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, data_r, data_w, 0x00ff) // KEYBOARD + AM_RANGE(0x01000a, 0x01000b) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, status_r, control_w, 0x00ff) + AM_RANGE(0x010010, 0x010011) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, data_r, data_w, 0x00ff) // DEBUGGER + AM_RANGE(0x010012, 0x010013) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, status_r, control_w, 0x00ff) + AM_RANGE(0x010018, 0x010019) AM_DEVREADWRITE8(ACIA3_TAG, acia6850_device, data_r, data_w, 0x00ff) // POINTER + AM_RANGE(0x01001a, 0x01001b) AM_DEVREADWRITE8(ACIA3_TAG, acia6850_device, status_r, control_w, 0x00ff) + AM_RANGE(0x010020, 0x010027) AM_READWRITE8(adlc_r, adlc_w, 0xff00) + AM_RANGE(0x010028, 0x01002f) AM_READWRITE8(pia_r, pia_w, 0xff00) // EAROM, PSG + AM_RANGE(0x010030, 0x010031) AM_WRITE(baud_write) + AM_RANGE(0x3e0000, 0x3fffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(bitgraphb_mem, AS_PROGRAM, 16, bitgraph_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x007fff) AM_ROM + AM_RANGE(0x010000, 0x010001) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, data_r, data_w, 0xff00) // HOST + AM_RANGE(0x010002, 0x010003) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, status_r, control_w, 0xff00) + AM_RANGE(0x010008, 0x010009) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, data_r, data_w, 0x00ff) // KEYBOARD + AM_RANGE(0x01000a, 0x01000b) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, status_r, control_w, 0x00ff) + AM_RANGE(0x010010, 0x010011) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, data_r, data_w, 0x00ff) // DEBUGGER + AM_RANGE(0x010012, 0x010013) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, status_r, control_w, 0x00ff) + AM_RANGE(0x01001a, 0x01001b) AM_WRITE8(misccr_write, 0x00ff) + AM_RANGE(0x010020, 0x010027) AM_READWRITE8(adlc_r, adlc_w, 0xff00) + AM_RANGE(0x010028, 0x01002f) AM_READWRITE8(pia_r, pia_w, 0xff00) // EAROM, PSG + AM_RANGE(0x010030, 0x010031) AM_WRITE(baud_write) +// AM_RANGE(0x010030, 0x010037) AM_READ8(ppu_read, 0x00ff) +// AM_RANGE(0x010038, 0x01003f) AM_WRITE8(ppu_write, 0x00ff) + AM_RANGE(0x380000, 0x3fffff) AM_RAM +ADDRESS_MAP_END + +static INPUT_PORTS_START(bitgraph) +INPUT_PORTS_END + +READ8_MEMBER(bitgraph_state::pia_r) +{ + DBG_LOG(3,"PIA", ("R %d\n", offset)); + return m_pia->read(space, 3-offset); +} + +WRITE8_MEMBER(bitgraph_state::pia_w) +{ + DBG_LOG(3,"PIA", ("W %d < %02X\n", offset, data)); + return m_pia->write(space, 3-offset, data); +} + +READ_LINE_MEMBER(bitgraph_state::pia_ca1_r) +{ + return m_screen->frame_number() & 1; +} + +WRITE_LINE_MEMBER(bitgraph_state::pia_cb2_w) +{ + // XXX shut up verbose log +} + +READ8_MEMBER(bitgraph_state::pia_pa_r) +{ + UINT8 data = BIT(m_pia_b, 3) ? m_earom->data() : m_pia_a; + DBG_LOG(2,"PIA", ("A == %02X (%s)\n", data, BIT(m_pia_b, 3) ? "earom" : "pia")); + return data; +} + +WRITE8_MEMBER(bitgraph_state::pia_pa_w) +{ + DBG_LOG(2,"PIA", ("A <- %02X\n", data)); + m_pia_a = data; +} + +/* + B0 O: BC1 to noisemaker. + B1 O: BDIR to noisemaker. + B2 O: Clock for EAROM. + B3 O: CS1 for EAROM. + B4 O: Enable HDLC Xmt interrupt. + B5 O: Enable HDLC Rcv interrupt. + B6 O: Clear Clock interrupt. Must write a 0 [clear interrupt], then a 1. + B7 I: EVEN field ?? +*/ +READ8_MEMBER(bitgraph_state::pia_pb_r) +{ + DBG_LOG(2,"PIA", ("B == %02X\n", m_pia_b)); + return m_pia_b; +} + +WRITE8_MEMBER(bitgraph_state::pia_pb_w) +{ + DBG_LOG(2,"PIA", ("B <- %02X\n", data)); + m_pia_b = data; + + switch (m_pia_b & 0x03) { + case 2: m_psg->data_w(space, 0, m_pia_a); break; + case 3: m_psg->address_w(space, 0, m_pia_a); break; + } + + if (BIT(m_pia_b, 3)) { + DBG_LOG(2,"EAROM", ("data <- %02X\n", m_pia_a)); + m_earom->set_data(m_pia_a); + } + // CS1, ~CS2, C1, C2, CK + m_earom->set_control(BIT(m_pia_b, 3), BIT(m_pia_b, 3), BIT(m_pia_a, 6), BIT(m_pia_a, 7), BIT(m_pia_b, 2)); + + if (!BIT(m_pia_b, 6)) { + m_maincpu->set_input_line(M68K_IRQ_6, CLEAR_LINE); + } +} + +WRITE8_MEMBER(bitgraph_state::earom_write) +{ + DBG_LOG(2,"EAROM", ("addr <- %02X (%02X)\n", data & 0x3f, data)); + m_earom->set_address(data & 0x3f); +} + +// written once and never changed +WRITE8_MEMBER(bitgraph_state::misccr_write) +{ + DBG_LOG(1,"MISCCR", ("<- %02X (DTR %d MAP %d)\n", data, BIT(data, 3), (data & 3))); + m_misccr = data; +} + +WRITE_LINE_MEMBER(bitgraph_state::system_clock_write) +{ + if (!BIT(m_pia_b, 6)) { + m_maincpu->set_input_line(M68K_IRQ_6, CLEAR_LINE); + return; + } + if (state) { + m_maincpu->set_input_line_and_vector(M68K_IRQ_6, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + } else { + m_maincpu->set_input_line(M68K_IRQ_6, CLEAR_LINE); + } +} + +WRITE16_MEMBER(bitgraph_state::baud_write) +{ + DBG_LOG(1,"Baud", ("%04X\n", data)); + m_dbrgb->str_w(data & 15); // 2 DBG + m_dbrga->stt_w((data >> 4) & 15); // 1 KBD + m_dbrgb->stt_w((data >> 8) & 15); // 3 PNT + m_dbrga->str_w((data >> 12) & 15); // 0 HOST +} + +WRITE_LINE_MEMBER(bitgraph_state::com8116_a_fr_w) +{ + m_acia0->write_txc(state); + m_acia0->write_rxc(state); +} + +WRITE_LINE_MEMBER(bitgraph_state::com8116_a_ft_w) +{ + m_acia1->write_txc(state); + m_acia1->write_rxc(state); +} + +WRITE_LINE_MEMBER(bitgraph_state::com8116_b_fr_w) +{ + m_acia2->write_txc(state); + m_acia2->write_rxc(state); +} + +WRITE_LINE_MEMBER(bitgraph_state::com8116_b_ft_w) +{ + if (m_acia3) { + m_acia3->write_txc(state); + m_acia3->write_rxc(state); + } +} + +READ8_MEMBER(bitgraph_state::adlc_r) +{ + DBG_LOG(1,"ADLC", ("R %d\n", offset)); + return m_adlc ? m_adlc->read(space, 3-offset) : 0xff; +} + +WRITE8_MEMBER(bitgraph_state::adlc_w) +{ + DBG_LOG(1,"ADLC", ("W %d < %02X\n", offset, data)); + if (m_adlc) return m_adlc->write(space, 3-offset, data); +} + +UINT32 bitgraph_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 gfx=0; + int x,y; + + for (y = 0; y < 768; y++) + { + UINT16 *p = &bitmap.pix16(y); + + for (x = 0; x < 1024/8; x+=2) + { + gfx = m_videoram[ (x+1) | (y<<7)]; + + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + + gfx = m_videoram[ x | (y<<7)]; + + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + return 0; +} + +READ8_MEMBER(bitgraph_state::ppu_read) +{ + UINT8 data = m_ppu[offset]; + DBG_LOG(1,"PPU", ("%d == %02X\n", offset, data)); + return data; +} + +WRITE8_MEMBER(bitgraph_state::ppu_write) +{ + DBG_LOG(1,"PPU", ("%d <- %02X\n", offset, data)); + m_ppu[offset] = data; +} + +#ifdef UNUSED_FUNCTION +static ADDRESS_MAP_START(ppu_io, AS_IO, 8, bitgraph_state) +// AM_RANGE(0x00, 0x00) AM_READ(ppu_irq) +// AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) +// AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(ppu_t0_r) + AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w) +ADDRESS_MAP_END +#endif + +/* + p4 O: Centronics data 3..0 + p5 O: Centronics data 7..4 + p6 O: Centronics control + p7 I: Centronics status +*/ +WRITE8_MEMBER(bitgraph_state::ppu_i8243_w) +{ + DBG_LOG(1,"PPU", ("8243 %d <- %02X\n", offset + 4, data)); + switch (offset) { + case 0: + m_centronics->write_data0(BIT(data, 0)); + m_centronics->write_data1(BIT(data, 1)); + m_centronics->write_data2(BIT(data, 2)); + m_centronics->write_data3(BIT(data, 3)); + break; + case 1: + m_centronics->write_data4(BIT(data, 0)); + m_centronics->write_data5(BIT(data, 1)); + m_centronics->write_data6(BIT(data, 2)); + m_centronics->write_data7(BIT(data, 3)); + break; + case 2: + m_centronics->write_strobe(BIT(data, 0)); + // 1: Paper instruction + m_centronics->write_init(BIT(data, 2)); + break; + case 3: + m_centronics->write_ack(BIT(data, 0)); + m_centronics->write_busy(BIT(data, 1)); + m_centronics->write_perror(BIT(data, 2)); + m_centronics->write_select(BIT(data, 3)); + break; + } +} + + +void bitgraph_state::machine_start() +{ + m_videoram = (UINT8 *)m_maincpu->space(AS_PROGRAM).get_write_ptr(0x3e0000); +} + +void bitgraph_state::machine_reset() +{ + m_maincpu->reset(); + m_misccr = 0; + m_pia_a = 0; + m_pia_b = 0; + memset(m_ppu, 0, sizeof(m_ppu)); +} + + +static MACHINE_CONFIG_FRAGMENT( bg_motherboard ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(40) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1024, 768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + MCFG_SCREEN_UPDATE_DRIVER(bitgraph_state, screen_update) + + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_DEVICE_ADD(ACIA0_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_H_TAG, rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_H_TAG, rs232_port_device, write_rts)) + MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE(M68K_TAG, m68000_device, write_irq1)) + + MCFG_RS232_PORT_ADD(RS232_H_TAG, default_rs232_devices, "null_modem") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA0_TAG, acia6850_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA0_TAG, acia6850_device, write_dcd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA0_TAG, acia6850_device, write_cts)) + + MCFG_DEVICE_ADD(ACIA1_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_K_TAG, rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_K_TAG, rs232_port_device, write_rts)) + MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE(M68K_TAG, m68000_device, write_irq1)) + + MCFG_RS232_PORT_ADD(RS232_K_TAG, default_rs232_devices, "keyboard") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA1_TAG, acia6850_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA1_TAG, acia6850_device, write_dcd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA1_TAG, acia6850_device, write_cts)) + + MCFG_DEVICE_ADD(ACIA2_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_rts)) + MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE(M68K_TAG, m68000_device, write_irq1)) + + MCFG_RS232_PORT_ADD(RS232_D_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA2_TAG, acia6850_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA2_TAG, acia6850_device, write_dcd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA2_TAG, acia6850_device, write_cts)) + + // XXX actual part may be something else + MCFG_DEVICE_ADD(COM8116_A_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(bitgraph_state, com8116_a_fr_w)) + MCFG_COM8116_FT_HANDLER(WRITELINE(bitgraph_state, com8116_a_ft_w)) + + MCFG_DEVICE_ADD(COM8116_B_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(bitgraph_state, com8116_b_fr_w)) + MCFG_COM8116_FT_HANDLER(WRITELINE(bitgraph_state, com8116_b_ft_w)) + + MCFG_DEVICE_ADD(PIA_TAG, PIA6821, 0) + MCFG_PIA_READCA1_HANDLER(READLINE(bitgraph_state, pia_ca1_r)) + MCFG_PIA_CB2_HANDLER(WRITELINE(bitgraph_state, pia_cb2_w)) + MCFG_PIA_READPA_HANDLER(READ8(bitgraph_state, pia_pa_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(bitgraph_state, pia_pa_w)) + MCFG_PIA_READPB_HANDLER(READ8(bitgraph_state, pia_pb_r)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(bitgraph_state, pia_pb_w)) + + MCFG_ER2055_ADD(EAROM_TAG) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(PSG_TAG, AY8912, XTAL_1_2944MHz) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bitgraph_state, earom_write)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + +#ifdef UNUSED_FUNCTION +static MACHINE_CONFIG_FRAGMENT( bg_ppu ) + MCFG_CPU_ADD(PPU_TAG, I8035, XTAL_6_9MHz) + MCFG_CPU_IO_MAP(ppu_io) + + MCFG_I8243_ADD("i8243", NOOP, WRITE8(bitgraph_state, ppu_i8243_w)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit6)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) + MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) + MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) + + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END +#endif + +static MACHINE_CONFIG_START( bitgrpha, bitgraph_state ) + MCFG_CPU_ADD(M68K_TAG, M68000, XTAL_6_9MHz) + MCFG_CPU_PROGRAM_MAP(bitgrapha_mem) + + MCFG_FRAGMENT_ADD(bg_motherboard) + + MCFG_DEVICE_ADD("system_clock", CLOCK, 40) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bitgraph_state, system_clock_write)) + + MCFG_DEVICE_ADD(ACIA3_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_M_TAG, rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_M_TAG, rs232_port_device, write_rts)) + MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE(M68K_TAG, m68000_device, write_irq1)) + + MCFG_RS232_PORT_ADD(RS232_M_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA3_TAG, acia6850_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA3_TAG, acia6850_device, write_dcd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA3_TAG, acia6850_device, write_cts)) + + MCFG_DEFAULT_LAYOUT(layout_bitgrpha) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( bitgrphb, bitgraph_state ) + MCFG_CPU_ADD(M68K_TAG, M68000, XTAL_6_9MHz) + MCFG_CPU_PROGRAM_MAP(bitgraphb_mem) + + MCFG_FRAGMENT_ADD(bg_motherboard) +// MCFG_FRAGMENT_ADD(bg_ppu) + + MCFG_DEVICE_ADD("system_clock", CLOCK, 1040) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bitgraph_state, system_clock_write)) + + MCFG_DEFAULT_LAYOUT(layout_bitgrphb) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( bitgrpha ) + ROM_REGION16_BE( 0x8000, M68K_TAG, 0 ) + ROM_LOAD( "bg125.rom", 0x000000, 0x008000, CRC(b86c974e) SHA1(5367db80a856444c2a55de22b69a13f97a62f602)) + ROM_FILL( 0x38e4, 1, 0x4e ) // disable clksync() + ROM_FILL( 0x38e5, 1, 0x75 ) +ROM_END + +ROM_START( bitgrphb ) + ROM_REGION16_BE( 0x8000, M68K_TAG, 0 ) + ROM_DEFAULT_BIOS("2.33A") + + ROM_SYSTEM_BIOS(0, "2.33A", "rev 2.33 Alpha' ROM") + ROMX_LOAD( "bg2.32lo_u10.bin", 0x004001, 0x002000, CRC(6a702a96) SHA1(acdf1ba34038b4ccafb5b8069e70ae57a3b8a7e0), ROM_BIOS(1)|ROM_SKIP(1)) + ROMX_LOAD( "bg2.32hi_u12.bin", 0x004000, 0x002000, CRC(a282a2c8) SHA1(ea7e4d4e197201c8944acef54479d5c2b26d409f), ROM_BIOS(1)|ROM_SKIP(1)) + ROMX_LOAD( "bg2.32lo_u11.bin", 0x000001, 0x002000, CRC(46912afd) SHA1(c1f771adc1ef62b1fb1b904ed1d2a61009e24f55), ROM_BIOS(1)|ROM_SKIP(1)) + ROMX_LOAD( "bg2.32hi_u13.bin", 0x000000, 0x002000, CRC(731df44f) SHA1(8c238b5943b8864e539f92891a0ffa6ddd4fc779), ROM_BIOS(1)|ROM_SKIP(1)) + + ROM_SYSTEM_BIOS(1, "3.0P", "rev 3.0P ROM") + ROMX_LOAD( "bg5173_u10.bin", 0x004001, 0x002000, CRC(40014850) SHA1(ef0b7da58a5183391a3a03947882197f25694518), ROM_BIOS(2)|ROM_SKIP(1)) + ROMX_LOAD( "bg5175_u12.bin", 0x004000, 0x002000, CRC(c2c4cc6c) SHA1(dbbce7cb58b4cef1557a834cbb07b3ace298cb8b), ROM_BIOS(2)|ROM_SKIP(1)) + ROMX_LOAD( "bg5174_u11.bin", 0x000001, 0x002000, CRC(639768b9) SHA1(68f623bcf3bb75390ba2b17efc067cf25f915ec0), ROM_BIOS(2)|ROM_SKIP(1)) + ROMX_LOAD( "bg5176_u13.bin", 0x000000, 0x002000, CRC(984e7e8c) SHA1(dd13cbaff96a8b9936ae8cb07205c6abe8b27b6e), ROM_BIOS(2)|ROM_SKIP(1)) + + ROM_SYSTEM_BIOS(2, "ramtest", "RAM test") + ROMX_LOAD( "ramtest.rom", 0x000000, 0x004000, CRC(fabe3b34) SHA1(4d892a2ed2b7ea12d83843609981be9069611d43), ROM_BIOS(3)) + + ROM_REGION( 0x800, PPU_TAG, 0 ) + ROM_LOAD( "bg_mouse_u9.bin", 0x0000, 0x0800, CRC(fd827ff5) SHA1(6d4a8e9b18c7610c5cfde40464826d144d387601)) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, bitgrpha, 0, 0, bitgrpha, bitgraph, driver_device, 0, "BBN", "BitGraph rev A", MACHINE_IMPERFECT_KEYBOARD) +COMP( 1982, bitgrphb, 0, 0, bitgrphb, bitgraph, driver_device, 0, "BBN", "BitGraph rev B", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_KEYBOARD) diff --git a/src/mame/drivers/bk.c b/src/mame/drivers/bk.c new file mode 100644 index 00000000000..555dddae766 --- /dev/null +++ b/src/mame/drivers/bk.c @@ -0,0 +1,235 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + BK driver by Miodrag Milanovic + + 10/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/t11/t11.h" +#include "sound/wave.h" +#include "includes/bk.h" +#include "imagedev/cassette.h" +#include "formats/rk_cas.h" + + /* Address maps */ +static ADDRESS_MAP_START(bk0010_mem, AS_PROGRAM, 16, bk_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x3fff ) AM_RAM // RAM + AM_RANGE( 0x4000, 0x7fff ) AM_RAM AM_SHARE("video_ram") // Video RAM + AM_RANGE( 0x8000, 0x9fff ) AM_ROM // ROM + AM_RANGE( 0xa000, 0xbfff ) AM_ROM // ROM + AM_RANGE( 0xc000, 0xdfff ) AM_ROM // ROM + AM_RANGE( 0xe000, 0xfeff ) AM_ROM // ROM + AM_RANGE( 0xffb0, 0xffb1 ) AM_READWRITE(bk_key_state_r,bk_key_state_w) + AM_RANGE( 0xffb2, 0xffb3 ) AM_READ(bk_key_code_r) + AM_RANGE( 0xffb4, 0xffb5 ) AM_READWRITE(bk_vid_scrool_r,bk_vid_scrool_w) + AM_RANGE( 0xffce, 0xffcf ) AM_READWRITE(bk_key_press_r,bk_key_press_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(bk0010fd_mem, AS_PROGRAM, 16, bk_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x3fff ) AM_RAM // RAM + AM_RANGE( 0x4000, 0x7fff ) AM_RAM AM_SHARE("video_ram") // Video RAM + AM_RANGE( 0x8000, 0x9fff ) AM_ROM // ROM + AM_RANGE( 0xa000, 0xdfff ) AM_RAM // RAM + AM_RANGE( 0xe000, 0xfdff ) AM_ROM // ROM + AM_RANGE( 0xfe58, 0xfe59 ) AM_READWRITE(bk_floppy_cmd_r,bk_floppy_cmd_w) + AM_RANGE( 0xfe5a, 0xfe5b ) AM_READWRITE(bk_floppy_data_r,bk_floppy_data_w) + AM_RANGE( 0xffb0, 0xffb1 ) AM_READWRITE(bk_key_state_r,bk_key_state_w) + AM_RANGE( 0xffb2, 0xffb3 ) AM_READ(bk_key_code_r) + AM_RANGE( 0xffb4, 0xffb5 ) AM_READWRITE(bk_vid_scrool_r,bk_vid_scrool_w) + AM_RANGE( 0xffce, 0xffcf ) AM_READWRITE(bk_key_press_r,bk_key_press_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( bk0010 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rus") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lat") PORT_CODE(KEYCODE_RALT) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab left") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab right") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0xFE, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE5") + PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_END) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("LINE10") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + + PORT_START("LINE11") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) // this alone gives nothing and gives ` with Shift! + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) // this alone acts like Enter and gives no result with Shift +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( bk0010, bk_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", T11, 3000000) + MCFG_T11_INITIAL_MODE(0x36ff) /* initial mode word has DAL15,14,11,8 pulled low */ + MCFG_CPU_PROGRAM_MAP(bk0010_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(bk_state,bk0010_irq_callback) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(bk_state, screen_update_bk0010) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("bk0010_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","bk0010") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bk0010fd, bk0010 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(bk0010fd_mem) +MACHINE_CONFIG_END + + +/* ROM definition */ + +ROM_START( bk0010 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "monit10.rom", 0x8000, 0x2000, CRC(26c6e8a0) SHA1(4e83a94ae5155bbea14d7331a5a8db82457bd5ae) ) + ROM_LOAD( "focal.rom", 0xa000, 0x2000, CRC(717149b7) SHA1(75df26f81ebd281bcb5c55ba81a7d97f31e388b2) ) + ROM_LOAD( "tests.rom", 0xe000, 0x1f80, CRC(91aecb4d) SHA1(6b14d552045194a3004bb6b795a2538110921519) ) +ROM_END + +ROM_START( bk001001 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "monit10.rom", 0x8000, 0x2000, CRC(26c6e8a0) SHA1(4e83a94ae5155bbea14d7331a5a8db82457bd5ae) ) + ROM_LOAD( "basic10-1.rom", 0xa000, 0x2000, CRC(5e3ff5da) SHA1(5ea4db1eaac87bd0ac96e52a608bc783709f5042) ) + ROM_LOAD( "basic10-2.rom", 0xc000, 0x2000, CRC(ea63863c) SHA1(acf068925e4052989b05dd5cf736a1dab5438011) ) + ROM_LOAD( "basic10-3.rom", 0xe000, 0x1f80, CRC(63f3df2e) SHA1(b5463f08e7c5f9f5aa31a2e7b6c1ed94fe029d65) ) +ROM_END + +ROM_START( bk0010fd ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "monit10.rom", 0x8000, 0x2000, CRC(26c6e8a0) SHA1(4e83a94ae5155bbea14d7331a5a8db82457bd5ae) ) + ROM_LOAD( "disk_327.rom", 0xe000, 0x1000, CRC(ed8a43ae) SHA1(28eefbb63047b26e4aec104aeeca74e2f9d0276c) ) +ROM_END + +ROM_START( bk0011m ) + ROM_REGION( 0x1A000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bas11m_0.rom", 0x10000, 0x4000, CRC(e71f9339) SHA1(9d76f3eefd64e032c763fa1ebf9cd3d9bd22317a) ) + ROM_LOAD( "bas11m_1.rom", 0x14000, 0x2000, CRC(4c68ff59) SHA1(34fa37599f2f9eb607390ef2458a3c22d87f09a9) ) + ROM_LOAD( "b11m_ext.rom", 0x16000, 0x2000, CRC(b2e4c33c) SHA1(f087af69044432a1ef2431a72ac06946e32f2dd3) ) + ROM_LOAD( "b11m_bos.rom", 0x18000, 0x2000, CRC(8ffd5efa) SHA1(7e9a30e38d7b78981999821640a68a201bb6df01) ) + ROM_LOAD( "disk_327.rom", 0x19000, 0x1000, CRC(ed8a43ae) SHA1(28eefbb63047b26e4aec104aeeca74e2f9d0276c) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, bk0010, 0, 0, bk0010, bk0010, driver_device, 0, "Elektronika", "BK 0010", 0) +COMP( 1986, bk001001, bk0010, 0, bk0010, bk0010, driver_device, 0, "Elektronika", "BK 0010-01", 0) +COMP( 1986, bk0010fd, bk0010, 0, bk0010fd, bk0010, driver_device, 0, "Elektronika", "BK 0010 FDD", MACHINE_NOT_WORKING) +COMP( 1986, bk0011m, bk0010, 0, bk0010fd, bk0010, driver_device, 0, "Elektronika", "BK 0011M", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/bmjr.c b/src/mame/drivers/bmjr.c new file mode 100644 index 00000000000..4ad812b6295 --- /dev/null +++ b/src/mame/drivers/bmjr.c @@ -0,0 +1,385 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Basic Master Jr (MB-6885) (c) 1982? Hitachi + + preliminary driver by Angelo Salese + + TODO: + - for whatever reason, BASIC won't work if you try to use it directly, + it does if you enter into MON first then exit (with E) + - tape hook-up doesn't work yet (shouldn't be hard to fix) + - Break key is unemulated (tied with the NMI) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "sound/beep.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" + + +class bmjr_state : public driver_device +{ +public: + bmjr_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cass(*this, "cassette"), + m_beep(*this, "beeper") + , + m_p_wram(*this, "p_wram"){ } + + required_device m_maincpu; + required_device m_cass; + required_device m_beep; + DECLARE_READ8_MEMBER(key_r); + DECLARE_WRITE8_MEMBER(key_w); + DECLARE_READ8_MEMBER(ff_r); + DECLARE_READ8_MEMBER(unk_r); + DECLARE_READ8_MEMBER(tape_r); + DECLARE_WRITE8_MEMBER(tape_w); + DECLARE_READ8_MEMBER(tape_stop_r); + DECLARE_READ8_MEMBER(tape_start_r); + DECLARE_WRITE8_MEMBER(xor_display_w); + bool m_tape_switch; + required_shared_ptr m_p_wram; + UINT8 *m_p_chargen; + UINT8 m_xor_display; + UINT8 m_key_mux; + DECLARE_DRIVER_INIT(bmjr); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_bmjr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + + +void bmjr_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 bmjr_state::screen_update_bmjr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,fg=4; + UINT16 sy=0,ma=0x100,x; + UINT8 inv = (m_xor_display) ? 0xff : 0; + + for(y = 0; y < 24; y++ ) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 32; x++) + { + chr = m_p_wram[x]; + gfx = m_p_chargen[(chr<<3) | ra] ^ inv; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7) ? fg : 0; + *p++ = BIT(gfx, 6) ? fg : 0; + *p++ = BIT(gfx, 5) ? fg : 0; + *p++ = BIT(gfx, 4) ? fg : 0; + *p++ = BIT(gfx, 3) ? fg : 0; + *p++ = BIT(gfx, 2) ? fg : 0; + *p++ = BIT(gfx, 1) ? fg : 0; + *p++ = BIT(gfx, 0) ? fg : 0; + } + } + ma+=32; + } + + return 0; +} + +READ8_MEMBER( bmjr_state::key_r ) +{ + char kbdrow[6]; + sprintf(kbdrow,"KEY%X", m_key_mux); + return (ioport(kbdrow)->read() & 15) | (ioport("KEYMOD")->read() << 4); +} + +WRITE8_MEMBER( bmjr_state::key_w ) +{ + m_key_mux = data & 0xf; + +// if(data & 0xf0) +// printf("%02x",data & 0xf0); +} + + +READ8_MEMBER( bmjr_state::ff_r ) +{ + return 0xff; +} + +READ8_MEMBER( bmjr_state::unk_r ) +{ + return 0x30; +} + +READ8_MEMBER( bmjr_state::tape_r ) +{ + //m_cass->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); + + return ((m_cass->input()) > 0.03) ? 0xff : 0x00; +} + +WRITE8_MEMBER( bmjr_state::tape_w ) +{ + if(!m_tape_switch) + { + m_beep->set_state(!BIT(data, 7)); + } + else + { + //m_cass->change_state(CASSETTE_RECORD,CASSETTE_MASK_UISTATE); + m_cass->output(BIT(data, 0) ? -1.0 : +1.0); + } +} + +READ8_MEMBER( bmjr_state::tape_stop_r ) +{ + m_tape_switch = 0; + //m_cass->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + return 0x01; +} + +READ8_MEMBER( bmjr_state::tape_start_r ) +{ + m_tape_switch = 1; + m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + return 0x01; +} + +WRITE8_MEMBER( bmjr_state::xor_display_w ) +{ + m_xor_display = data; +} + +static ADDRESS_MAP_START(bmjr_mem, AS_PROGRAM, 8, bmjr_state) + ADDRESS_MAP_UNMAP_HIGH + //0x0100, 0x03ff basic vram + //0x0900, 0x20ff vram, modes 0x40 / 0xc0 + //0x2100, 0x38ff vram, modes 0x44 / 0xcc + AM_RANGE(0x0000, 0xafff) AM_RAM AM_SHARE("p_wram") + AM_RANGE(0xb000, 0xdfff) AM_ROM + AM_RANGE(0xe000, 0xe7ff) AM_ROM +// AM_RANGE(0xe890, 0xe890) W MP-1710 tile color +// AM_RANGE(0xe891, 0xe891) W MP-1710 background color +// AM_RANGE(0xe892, 0xe892) W MP-1710 monochrome / color setting + AM_RANGE(0xee00, 0xee00) AM_READ(tape_stop_r) //R stop tape + AM_RANGE(0xee20, 0xee20) AM_READ(tape_start_r) //R start tape + AM_RANGE(0xee40, 0xee40) AM_WRITE(xor_display_w) //W Picture reverse + AM_RANGE(0xee80, 0xee80) AM_READWRITE(tape_r,tape_w)//RW tape input / output + AM_RANGE(0xeec0, 0xeec0) AM_READWRITE(key_r,key_w)//RW keyboard + AM_RANGE(0xef00, 0xef00) AM_READ(ff_r) //R timer + AM_RANGE(0xef40, 0xef40) AM_READ(ff_r) //R unknown + AM_RANGE(0xef80, 0xef80) AM_READ(unk_r) //R unknown +// AM_RANGE(0xefe0, 0xefe0) W screen mode + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( bmjr ) + PORT_START("KEY0") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY1") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY2") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY3") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY4") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY5") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY6") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY7") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY8") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEY9") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEYA") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_UNUSED ) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@ Up") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('@') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEYB") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[ Down") PORT_CODE(KEYCODE_OPENBRACE) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('[') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^ Right") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('^') + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEYC") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("\xC2\xA5 / Left") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("KEYD") + PORT_DIPNAME( 0x01, 0x01, "D" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEYE") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEYF") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEYMOD") /* Note: you should press Normal to return from a Kana state and vice-versa */ + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(DEF_STR( Normal )) PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Kana Shift") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Kana") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) +INPUT_PORTS_END + +static const gfx_layout bmjr_charlayout = +{ + 8, 8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( bmjr ) + GFXDECODE_ENTRY( "chargen", 0x0000, bmjr_charlayout, 0, 4 ) +GFXDECODE_END + +void bmjr_state::machine_start() +{ + m_beep->set_frequency(1200); //guesswork + m_beep->set_state(0); +} + +void bmjr_state::machine_reset() +{ + m_tape_switch = 0; + m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); +} + +static MACHINE_CONFIG_START( bmjr, bmjr_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6800, XTAL_4MHz/4) //unknown clock / divider + MCFG_CPU_PROGRAM_MAP(bmjr_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", bmjr_state, irq0_line_hold) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 192) + MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 192-1) + MCFG_SCREEN_UPDATE_DRIVER(bmjr_state, screen_update_bmjr) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", bmjr) + + /* Audio */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( bmjr ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bas.rom", 0xb000, 0x3000, BAD_DUMP CRC(2318e04e) SHA1(cdb3535663090f5bcaba20b1dbf1f34724ef6a5f)) //12k ROMs doesn't exist ... + ROM_LOAD( "mon.rom", 0xf000, 0x1000, CRC(776cfa3a) SHA1(be747bc40fdca66b040e0f792b05fcd43a1565ce)) + ROM_LOAD( "prt.rom", 0xe000, 0x0800, CRC(b9aea867) SHA1(b8dd5348790d76961b6bdef41cfea371fdbcd93d)) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(258c6fd7) SHA1(d7c7dd57d6fc3b3d44f14c32182717a48e24587f)) //taken from a JP emulator +ROM_END + +/* Driver */ +DRIVER_INIT_MEMBER(bmjr_state,bmjr) +{ +} + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, bmjr, 0, 0, bmjr, bmjr, bmjr_state, bmjr, "Hitachi", "Basic Master Jr", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/bml3.c b/src/mame/drivers/bml3.c new file mode 100644 index 00000000000..9b8b5eff66b --- /dev/null +++ b/src/mame/drivers/bml3.c @@ -0,0 +1,1114 @@ +// license:GPL-2.0+ +// copyright-holders:Angelo Salese, Jonathan Edwards, Christopher Edwards,Robbbert +/************************************************************************************** + + Basic Master Level 3 (MB-689x) (c) 1980 Hitachi + + Driver by Angelo Salese, Jonathan Edwards and Christopher Edwards + + TODO: + - implement sound as a bml3bus slot device + - account for hardware differences between MB-6890, MB-6891 and MB-6892 + (e.g. custom font support on the MB-6892) + +**************************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "video/mc6845.h" +#include "machine/6821pia.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "sound/2203intf.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "bus/bml3/bml3bus.h" +#include "bus/bml3/bml3mp1802.h" +#include "bus/bml3/bml3mp1805.h" +#include "bus/bml3/bml3kanji.h" + +// System clock definitions, from the MB-6890 servce manual, p.48: + +#define MASTER_CLOCK ( 32256000 ) // Master clock crystal (X1) frequency, 32.256 MHz. "fx" in the manual. + +#define D80_CLOCK ( MASTER_CLOCK / 2 ) // Graphics dot clock in 80-column mode. ~16 MHz. +#define D40_CLOCK ( D80_CLOCK / 2 ) // Graphics dot clock in 40-column mode. ~8 MHz. + +#define CPU_EXT_CLOCK ( D40_CLOCK / 2 ) // IC37, 4.032 MHz signal to EXTAL on the 6809 MPU. +#define CPU_CLOCK ( CPU_EXT_CLOCK / 4 ) // Actual MPU clock frequency ("fE" in the manual). The division yielding CPU_CLOCK is done in the 6809 itself. Also used as the 40-column character clock. + +#define C80_CLOCK ( CPU_EXT_CLOCK / 2 ) // 80-column character mode. IC37, "80CHRCK"; ~2 MHz. +#define C40_CLOCK ( CPU_CLOCK ) // 40-column character mode; same as MPU clock. "40CHRCK"; ~1 MHz. + +// Video signal clocks from the HD4650SSP CRTC (IC36) +// In the real hardware, the 80-/40-column Mode switch changes the CRTC character clock input source. However, it just uses a different divider, so the end result is the same horizontal vsync frequency. +#define H_CLOCK ( C80_CLOCK / 128 ) // in 80-column mode +//#define H_CLOCK ( C40_CLOCK / 64 ) // in 40-column mode (either way the frequency is the same: 15.75 kHz) +#define V_CLOCK ( 2 * H_CLOCK / 525 ) // Vertical refresh rate comes out at exactly 60 Hz. + +// TODO: ACIA RS-232C and cassette interface clocks (service manual p.67); perhaps reverse the order and simply divide by 2 from each previous frequency. +// IC111 (74LS157P) takes 16.128 MHz and 1.008 MHz TTL clock inputs. The RS/C SW input line determines the mode (high -> RS-232C). + +// Frequencies for RS-232C mode: +// D80_CLOCK / 840.0 // 19200 Hz +// D80_CLOCK / 420 // 38400 Hz +// D80_CLOCK / 210 // 76800 Hz +// D80_CLOCK / 105.0 // 153600 Hz + +// Frequencies for cassette mode: +// / 13440 //1200 +// / 6720 // 2400 +// / 3360 // 4800 +// / 1680 // 9600 + + +class bml3_state : public driver_device +{ +public: + bml3_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_bml3bus(*this, "bml3bus"), + m_crtc(*this, "crtc"), + m_cass(*this, "cassette"), + m_speaker(*this, "speaker"), + m_ym2203(*this, "ym2203"), + m_acia6850(*this, "acia6850"), + m_palette(*this, "palette") + { + } + + DECLARE_READ8_MEMBER(bml3_6845_r); + DECLARE_WRITE8_MEMBER(bml3_6845_w); + DECLARE_READ8_MEMBER(bml3_keyboard_r); + DECLARE_WRITE8_MEMBER(bml3_keyboard_w); + DECLARE_WRITE8_MEMBER(bml3_hres_reg_w); + DECLARE_WRITE8_MEMBER(bml3_vres_reg_w); + DECLARE_READ8_MEMBER(bml3_vram_r); + DECLARE_WRITE8_MEMBER(bml3_vram_w); + DECLARE_READ8_MEMBER(bml3_psg_latch_r); + DECLARE_WRITE8_MEMBER(bml3_psg_latch_w); + DECLARE_READ8_MEMBER(bml3_vram_attr_r); + DECLARE_WRITE8_MEMBER(bml3_vram_attr_w); + DECLARE_READ8_MEMBER(bml3_beep_r); + DECLARE_WRITE8_MEMBER(bml3_beep_w); + DECLARE_WRITE8_MEMBER(bml3_piaA_w); + DECLARE_READ8_MEMBER(bml3_keyb_nmi_r); + DECLARE_WRITE8_MEMBER(bml3_firq_mask_w); + DECLARE_READ8_MEMBER(bml3_firq_status_r); + DECLARE_WRITE8_MEMBER(relay_w); + DECLARE_WRITE_LINE_MEMBER(bml3bus_nmi_w); + DECLARE_WRITE_LINE_MEMBER(bml3bus_irq_w); + DECLARE_WRITE_LINE_MEMBER(bml3bus_firq_w); + DECLARE_WRITE_LINE_MEMBER(bml3_acia_tx_w); + DECLARE_WRITE_LINE_MEMBER(bml3_acia_rts_w); + DECLARE_WRITE_LINE_MEMBER(bml3_acia_irq_w); + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + + DECLARE_READ8_MEMBER(bml3_a000_r); DECLARE_WRITE8_MEMBER(bml3_a000_w); + DECLARE_READ8_MEMBER(bml3_c000_r); DECLARE_WRITE8_MEMBER(bml3_c000_w); + DECLARE_READ8_MEMBER(bml3_e000_r); DECLARE_WRITE8_MEMBER(bml3_e000_w); + DECLARE_READ8_MEMBER(bml3_f000_r); DECLARE_WRITE8_MEMBER(bml3_f000_w); + DECLARE_READ8_MEMBER(bml3_fff0_r); DECLARE_WRITE8_MEMBER(bml3_fff0_w); + + MC6845_UPDATE_ROW(crtc_update_row); + + UINT8 *m_p_videoram; + UINT8 *m_p_chargen; + UINT8 m_hres_reg; + UINT8 m_crtc_vreg[0x100]; + // INTERRUPT_GEN_MEMBER(bml3_irq); + INTERRUPT_GEN_MEMBER(bml3_timer_firq); + TIMER_DEVICE_CALLBACK_MEMBER(bml3_c); + TIMER_DEVICE_CALLBACK_MEMBER(bml3_p); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); + DECLARE_READ8_MEMBER(bml3_ym2203_r); + DECLARE_WRITE8_MEMBER(bml3_ym2203_w); + +private: + UINT8 m_psg_latch; + UINT8 m_attr_latch; + UINT8 m_vres_reg; + bool m_keyb_interrupt_disabled; + bool m_keyb_nmi_disabled; // not used yet + bool m_keyb_counter_operation_disabled; + UINT8 m_keyb_empty_scan; + UINT8 m_keyb_scancode; + bool m_keyb_capslock_led_on; + bool m_keyb_hiragana_led_on; + bool m_keyb_katakana_led_on; + bool m_cassbit; + bool m_cassold; + UINT8 m_cass_data[4]; + virtual void machine_reset(); + virtual void machine_start(); + void m6845_change_clock(UINT8 setting); + UINT8 m_crtc_index; + UINT8 *m_extram; + UINT8 m_firq_mask; + UINT8 m_firq_status; + required_device m_maincpu; + required_device m_bml3bus; + required_device m_crtc; + required_device m_cass; + required_device m_speaker; + optional_device m_ym2203; + required_device m_acia6850; +public: + required_device m_palette; +}; + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + + + +READ8_MEMBER( bml3_state::bml3_6845_r ) +{ + if (offset) + return m_crtc->register_r(space, 0); + else + return m_crtc->status_r(space, 0); +} + +WRITE8_MEMBER( bml3_state::bml3_6845_w ) +{ + if(offset == 0) + { + m_crtc_index = data; + m_crtc->address_w(space, 0, data); + } + else + { + m_crtc_vreg[m_crtc_index] = data; + m_crtc->register_w(space, 0, data); + } +} + +READ8_MEMBER( bml3_state::bml3_keyboard_r ) +{ + UINT8 ret = m_keyb_scancode; + m_keyb_scancode &= 0x7f; + return ret; +} + +WRITE8_MEMBER( bml3_state::bml3_keyboard_w ) +{ + m_keyb_katakana_led_on = BIT(data, 0); + m_keyb_hiragana_led_on = BIT(data, 1); + m_keyb_capslock_led_on = BIT(data, 2); + m_keyb_counter_operation_disabled = BIT(data, 3); + m_keyb_interrupt_disabled = !BIT(data, 6); + m_keyb_nmi_disabled = !BIT(data, 7); +} + +void bml3_state::m6845_change_clock(UINT8 setting) +{ + int m6845_clock = CPU_CLOCK; // CRTC and MPU are synchronous by default + + switch(setting & 0x88) + { + case 0x00: m6845_clock = C40_CLOCK; break; //320 x 200 + case 0x08: m6845_clock = C40_CLOCK; break; //320 x 200, interlace + case 0x80: m6845_clock = C80_CLOCK; break; //640 x 200 + case 0x88: m6845_clock = C80_CLOCK; break; //640 x 200, interlace + } + + m_crtc->set_clock(m6845_clock); +} + +WRITE8_MEMBER( bml3_state::bml3_hres_reg_w ) +{ + // MODE SEL register (see service manual p.43). + /* + x--- ---- "W" bit: 0 = 40 columns, 1 = 80 columns + -x-- ---- "HR" bit: 0 = high resolution, 1 = normal + --x- ---- "C" bit - ACIA mode: 0 = cassette, 1 = RS-232C + ---- -RGB Background colour + */ + + m_hres_reg = data; + + m6845_change_clock((m_hres_reg & 0x80) | (m_vres_reg & 0x08)); +} + +WRITE8_MEMBER( bml3_state::bml3_vres_reg_w ) +{ + // The MB-6890 had an interlaced video mode which was used for displaying Japanese (Hiragana and Katakana) text (8x16 character glyph bitmaps). + /* + ---- x--- Interlace select: 0 = non-interlace, 1 = interlace + */ + m_vres_reg = data; + + m6845_change_clock((m_hres_reg & 0x80) | (m_vres_reg & 0x08)); +} + + +READ8_MEMBER( bml3_state::bml3_vram_r ) +{ + // Bit 7 masks reading back to the latch + if (!BIT(m_attr_latch, 7)) + { + m_attr_latch = m_p_videoram[offset+0x4000]; + } + + return m_p_videoram[offset]; +} + +WRITE8_MEMBER( bml3_state::bml3_vram_w ) +{ + m_p_videoram[offset] = data; + // color ram is 5-bit + m_p_videoram[offset+0x4000] = m_attr_latch & 0x1F; +} + +READ8_MEMBER( bml3_state::bml3_psg_latch_r) +{ + return 0x7f; +} + +WRITE8_MEMBER( bml3_state::bml3_psg_latch_w) +{ + m_psg_latch = data; +} + +READ8_MEMBER(bml3_state::bml3_ym2203_r) +{ + UINT8 dev_offs = ((m_psg_latch & 3) != 3); + + return m_ym2203->read(space, dev_offs); +} + +WRITE8_MEMBER(bml3_state::bml3_ym2203_w) +{ + UINT8 dev_offs = ((m_psg_latch & 3) != 3); + + m_ym2203->write(space, dev_offs, data); +} + +READ8_MEMBER( bml3_state::bml3_vram_attr_r) +{ + // C-REG-SELECT register + // Reads from a VRAM address copy the corresponding 'colour RAM' address to the low-order 5 bits of this register as a side-effect + // (unless MK bit indicates 'prohibit write') + return m_attr_latch; +} + +WRITE8_MEMBER( bml3_state::bml3_vram_attr_w) +{ + // C-REG-SELECT register + // Writes to a VRAM address copy the low-order 5 bits of this register to the corresponding 'colour RAM' address as a side-effect + /* + x--- ---- "MK" bit: 0 = enable write, 1 = prohibit write + ---x ---- "GC" bit: 0 = character, 1 = graphic + ---- x--- "RV" bit: 0 = normal, 1 - reverse + ---- -RGB Foreground colour + */ + m_attr_latch = data; +} + +READ8_MEMBER( bml3_state::bml3_beep_r) +{ + return -1; // BEEP status read? +} + +WRITE8_MEMBER( bml3_state::bml3_beep_w) +{ + m_speaker->level_w(BIT(data, 7)); +} + +WRITE8_MEMBER( bml3_state::relay_w ) +{ + m_cass->change_state( + BIT(data,7) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + +READ8_MEMBER( bml3_state::bml3_a000_r) { return m_extram[offset + 0xa000]; } +WRITE8_MEMBER( bml3_state::bml3_a000_w) { m_extram[offset + 0xa000] = data; } +READ8_MEMBER( bml3_state::bml3_c000_r) { return m_extram[offset + 0xc000]; } +WRITE8_MEMBER( bml3_state::bml3_c000_w) { m_extram[offset + 0xc000] = data; } +READ8_MEMBER( bml3_state::bml3_e000_r) { return m_extram[offset + 0xe000]; } +WRITE8_MEMBER( bml3_state::bml3_e000_w) { m_extram[offset + 0xe000] = data; } +READ8_MEMBER( bml3_state::bml3_f000_r) { return m_extram[offset + 0xf000]; } +WRITE8_MEMBER( bml3_state::bml3_f000_w) { m_extram[offset + 0xf000] = data; } +READ8_MEMBER( bml3_state::bml3_fff0_r) { return m_extram[offset + 0xfff0]; } +WRITE8_MEMBER( bml3_state::bml3_fff0_w) { m_extram[offset + 0xfff0] = data; } + +READ8_MEMBER( bml3_state::bml3_keyb_nmi_r) +{ + return 0; // bit 7 used to signal a BREAK key pressure +} + +WRITE8_MEMBER( bml3_state::bml3_firq_mask_w) +{ + m_firq_mask = data & 0x80; + if(m_firq_mask) + { + m_firq_status = 0; // clear pending firq + m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); + } +} + +READ8_MEMBER( bml3_state::bml3_firq_status_r ) +{ + UINT8 res = m_firq_status << 7; + m_firq_status = 0; + m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); + return res; +} + +WRITE_LINE_MEMBER(bml3_state::bml3bus_nmi_w) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, state); +} + +WRITE_LINE_MEMBER(bml3_state::bml3bus_irq_w) +{ + m_maincpu->set_input_line(M6809_IRQ_LINE, state); +} + +WRITE_LINE_MEMBER(bml3_state::bml3bus_firq_w) +{ + m_maincpu->set_input_line(M6809_FIRQ_LINE, state); +} + + +static ADDRESS_MAP_START(bml3_mem, AS_PROGRAM, 8, bml3_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x03ff) AM_RAM + AM_RANGE(0x0400, 0x43ff) AM_READWRITE(bml3_vram_r,bml3_vram_w) + AM_RANGE(0x4400, 0x9fff) AM_RAM + AM_RANGE(0xff40, 0xff46) AM_NOP // lots of unknown reads and writes + AM_RANGE(0xffc0, 0xffc3) AM_DEVREADWRITE("pia6821", pia6821_device, read, write) + AM_RANGE(0xffc4, 0xffc4) AM_DEVREADWRITE("acia6850", acia6850_device, status_r, control_w) + AM_RANGE(0xffc5, 0xffc5) AM_DEVREADWRITE("acia6850", acia6850_device, data_r, data_w) + AM_RANGE(0xffc6, 0xffc7) AM_READWRITE(bml3_6845_r,bml3_6845_w) + // KBNMI - Keyboard "Break" key non-maskable interrupt + AM_RANGE(0xffc8, 0xffc8) AM_READ(bml3_keyb_nmi_r) // keyboard nmi + // DIPSW - DIP switches on system mainboard + AM_RANGE(0xffc9, 0xffc9) AM_READ_PORT("DSW") + // TIMER - System timer enable + AM_RANGE(0xffca, 0xffca) AM_READ(bml3_firq_status_r) // timer irq + // LPFLG - Light pen interrupt +// AM_RANGE(0xffcb, 0xffcb) + // MODE_SEL - Graphics mode select + AM_RANGE(0xffd0, 0xffd0) AM_WRITE(bml3_hres_reg_w) + // TRACE - Trace counter +// AM_RANGE(0xffd1, 0xffd1) + // REMOTE - Remote relay control for cassette - bit 7 + AM_RANGE(0xffd2, 0xffd2) AM_WRITE(relay_w) + // MUSIC_SEL - Music select: toggle audio output level when rising + AM_RANGE(0xffd3, 0xffd3) AM_READWRITE(bml3_beep_r,bml3_beep_w) + // TIME_MASK - Prohibit timer IRQ + AM_RANGE(0xffd4, 0xffd4) AM_WRITE(bml3_firq_mask_w) + // LPENBL - Light pen operation enable + AM_RANGE(0xffd5, 0xffd5) AM_NOP + // INTERLACE_SEL - Interlaced video mode (manual has "INTERACE SEL"!) + AM_RANGE(0xffd6, 0xffd6) AM_WRITE(bml3_vres_reg_w) +// AM_RANGE(0xffd7, 0xffd7) baud select + // C_REG_SEL - Attribute register (character/video mode and colours) + AM_RANGE(0xffd8, 0xffd8) AM_READWRITE(bml3_vram_attr_r,bml3_vram_attr_w) + // KB - Keyboard mode register, interrupt control, keyboard LEDs + AM_RANGE(0xffe0, 0xffe0) AM_READWRITE(bml3_keyboard_r,bml3_keyboard_w) +// AM_RANGE(0xffe8, 0xffe8) bank register +// AM_RANGE(0xffe9, 0xffe9) IG mode register +// AM_RANGE(0xffea, 0xffea) IG enable register + AM_RANGE(0xa000, 0xfeff) AM_ROM AM_REGION("maincpu", 0xa000) + AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("maincpu", 0xfff0) + AM_RANGE(0xa000, 0xbfff) AM_WRITE(bml3_a000_w) + AM_RANGE(0xc000, 0xdfff) AM_WRITE(bml3_c000_w) + AM_RANGE(0xe000, 0xefff) AM_WRITE(bml3_e000_w) + AM_RANGE(0xf000, 0xfeff) AM_WRITE(bml3_f000_w) + AM_RANGE(0xfff0, 0xffff) AM_WRITE(bml3_fff0_w) + +#if 0 + AM_RANGE(0xff00, 0xff00) AM_READWRITE(bml3_ym2203_r,bml3_ym2203_w) + AM_RANGE(0xff02, 0xff02) AM_READWRITE(bml3_psg_latch_r,bml3_psg_latch_w) // PSG address/data select +#endif +ADDRESS_MAP_END + +static ADDRESS_MAP_START(bml3mk2_mem, AS_PROGRAM, 8, bml3_state) + AM_IMPORT_FROM(bml3_mem) + // TODO: anything to add here? + +ADDRESS_MAP_END + +static ADDRESS_MAP_START(bml3mk5_mem, AS_PROGRAM, 8, bml3_state) + AM_IMPORT_FROM(bml3_mem) + // TODO: anything to add here? + +ADDRESS_MAP_END + +/* Input ports */ + +static INPUT_PORTS_START( bml3 ) + + // DIP switches (service manual p.88) + // Note the NEWON command reboots with a soft override for the DIP switch + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x01, "BASIC/terminal mode") + PORT_DIPSETTING(0x00, "Terminal mode") + PORT_DIPSETTING(0x01, "BASIC mode") + PORT_DIPNAME( 0x02, 0x02, "Interlaced video") + PORT_DIPSETTING(0x00, DEF_STR( Off ) ) + PORT_DIPSETTING(0x02, DEF_STR( On )) + // This is overridden by the 'Mode' toggle button + PORT_DIPNAME( 0x04, 0x04, "40-/80-column") + PORT_DIPSETTING(0x00, "40 chars/line") + PORT_DIPSETTING(0x04, "80 chars/line") + PORT_DIPNAME( 0x08, 0x00, "Video resolution") + PORT_DIPSETTING(0x00, "High") + PORT_DIPSETTING(0x08, "Low") + PORT_DIPNAME( 0x10, 0x00, "Show PF key content") + PORT_DIPSETTING(0x00, DEF_STR ( Off ) ) + PORT_DIPSETTING(0x10, DEF_STR ( On )) + PORT_DIPNAME( 0x20, 0x00, "Terminal duplex") + PORT_DIPSETTING(0x00, "Full duplex") + PORT_DIPSETTING(0x20, "Half duplex") + PORT_DIPNAME( 0x40, 0x00, "Terminal bits") + PORT_DIPSETTING(0x00, "8 bits/char") + PORT_DIPSETTING(0x40, "7 bits/char") + PORT_DIPNAME( 0x80, 0x00, "Hiragana->Katakana") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + +// TODO: also model the CS jumper block? + + // RAM expansion configurations (see service manual p.76) +/* + PORT_START("RAM") + PORT_DIPNAME( 0x0003, 0x0002, "RAM size" ) + PORT_DIPSETTING( 0x0000, "32 kiB (standard)" ) + PORT_DIPSETTING( 0x0001, "40 kiB (32 kiB + 8 kiB)" ) + PORT_DIPSETTING( 0x0002, "60 kiB (32 kiB + 28 kiB)" ) +*/ + + PORT_START("key1") //0x00-0x1f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("? PAD") PORT_CHAR('?') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift")PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X2") // ??? + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana Lock") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana Shift") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 PAD") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 PAD") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 PAD") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Delete PAD") //backspace + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xC2\xA5") PORT_CODE(KEYCODE_TAB) // yen sign + + PORT_START("key2") //0x20-0x3f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 PAD") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) //or cls? + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 PAD") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 PAD") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 PAD") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- PAD") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') + + PORT_START("key3") //0x40-0x5f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ PAD") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 PAD") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 PAD") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 PAD") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0xffe00000,IP_ACTIVE_HIGH,IPT_UNKNOWN) +INPUT_PORTS_END + +MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + // The MB-6890 has a 5-bit colour RAM region. The meaning of the bits are: + // 0: blue + // 1: red + // 2: green + // 3: reverse/inverse video + // 4: graphic (not character) + + UINT8 x=0,hf=0,xi=0,interlace=0,bgcolor=0,rawbits=0,dots[2],color=0,pen=0; + bool reverse=0,graphic=0,lowres=0; + UINT16 mem=0; + + interlace = (m_crtc_vreg[8] & 3) ? 1 : 0; + lowres = BIT(m_hres_reg, 6); + bgcolor = m_hres_reg & 7; + + if (interlace) + { + ra >>= 1; + if (y > 0x176) return; + } + + // redundant initializers to keep compiler happy + dots[0] = dots[1] = 0; + + for(x=0; x> ra/2 & 0x11) * 0xf; + } + else + { + dots[0] = dots[1] = rawbits; + } + } + else + { + // character mode + int tile = rawbits & 0x7f; + int tile_bank = BIT(rawbits, 7); + if (interlace) + { + dots[0] = m_p_chargen[(tile_bank<<11)|(tile<<4)|(ra<<1)]; + dots[1] = m_p_chargen[(tile_bank<<11)|(tile<<4)|(ra<<1)|tile_bank]; + } + else + { + dots[0] = dots[1] = m_p_chargen[(tile<<4)|(ra<<1)|tile_bank]; + } + } + + for(hf=0;hf<=interlace;hf++) + { + for(xi=0;xi<8;xi++) + { + if(reverse) + pen = (dots[hf] >> (7-xi) & 1) ? bgcolor : color; + else + pen = (dots[hf] >> (7-xi) & 1) ? color : bgcolor; + + bitmap.pix32(y, x*8+xi) = palette[pen]; + // when the mc6845 device gains full interlace&video support, replace the line above with the line below + // bitmap.pix32(y*(interlace+1)+hf, x*8+xi) = palette[pen]; + } + } + } +} + + +TIMER_DEVICE_CALLBACK_MEMBER(bml3_state::keyboard_callback) +{ + static const char *const portnames[3] = { "key1","key2","key3" }; + int i,port_i,trigger = 0; + + if(!(m_keyb_scancode & 0x80)) + { + m_keyb_scancode = (m_keyb_scancode + 1) & 0x7F; + if (m_keyb_counter_operation_disabled) + { + m_keyb_scancode &= 0x7; + } + + if (m_keyb_scancode == 0x7F) + { + if (m_keyb_empty_scan == 1) + { + // full scan completed with no keypress + trigger = !0; + } + if (m_keyb_empty_scan > 0) + m_keyb_empty_scan--; + } + else if (m_keyb_scancode < 32*3) + { + port_i = m_keyb_scancode / 32; + i = m_keyb_scancode % 32; + if((ioport(portnames[port_i])->read()>>i) & 1) + { + m_keyb_empty_scan = 2; + trigger = !0; + } + } + if (trigger) + { + m_keyb_scancode |= 0x80; + if (!m_keyb_interrupt_disabled) + m_maincpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); + } + /* Don't need this apparently... + else + { + m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE); + } + */ + } +} + +TIMER_DEVICE_CALLBACK_MEMBER( bml3_state::bml3_p ) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_acia6850->write_rxd((m_cass_data[1] < 12) ? 1 : 0); + m_cass_data[1] = 0; + } +} + +#if 0 +INTERRUPT_GEN_MEMBER(bml3_state::bml3_irq) +{ + m_maincpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); +} +#endif + + +INTERRUPT_GEN_MEMBER(bml3_state::bml3_timer_firq) +{ + if(!m_firq_mask) + { + m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); + m_firq_status = 1; + } +} + +void bml3_state::machine_start() +{ + m_extram = auto_alloc_array(machine(),UINT8,0x10000); + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("vram")->base(); + m_psg_latch = 0; + m_attr_latch = 0; + m_vres_reg = 0; + m_keyb_interrupt_disabled = 0; + m_keyb_nmi_disabled = 0; + m_keyb_counter_operation_disabled = 0; + m_keyb_empty_scan = 0; + m_keyb_scancode = 0; + m_keyb_capslock_led_on = 0; + m_keyb_hiragana_led_on = 0; + m_keyb_katakana_led_on = 0; + m_crtc_index = 0; + m_firq_status = 0; + m_cassbit = 0; + m_cassold = 0; +} + +void bml3_state::machine_reset() +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + + /* defaults */ + mem.install_rom(0xa000, 0xfeff,memregion("maincpu")->base() + 0xa000); + mem.install_rom(0xfff0, 0xffff,memregion("maincpu")->base() + 0xfff0); + mem.install_write_handler(0xa000, 0xbfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_a000_w), this),0); + mem.install_write_handler(0xc000, 0xdfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_c000_w), this),0); + mem.install_write_handler(0xe000, 0xefff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_e000_w), this),0); + mem.install_write_handler(0xf000, 0xfeff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_f000_w), this),0); + mem.install_write_handler(0xfff0, 0xffff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_fff0_w), this),0); + + m_firq_mask = -1; // disable firq +} + +WRITE8_MEMBER(bml3_state::bml3_piaA_w) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + /* ROM banking: + -0-- --0- 0xa000 - 0xbfff ROM R RAM W + -1-- --0- 0xa000 - 0xbfff RAM R/W + -x-- --1- 0xa000 - 0xbfff no change + 0--- -0-- 0xc000 - 0xdfff ROM R RAM W + 1--- -0-- 0xc000 - 0xdfff RAM R/W + x--- -1-- 0xc000 - 0xdfff no change + 0--- 0--- 0xe000 - 0xefff ROM R RAM W + 1--- 0--- 0xe000 - 0xefff RAM R/W + x--- 1--- 0xe000 - 0xefff no change + ---- ---x 0xf000 - 0xfeff (0) ROM R RAM W (1) RAM R/W + ---- --x- 0xfff0 - 0xffff (0) ROM R RAM W (1) RAM R/W + */ + logerror("Check banking PIA A -> %02x\n",data); + + if(!(data & 0x2)) + { + if(data & 0x40) + { + mem.install_readwrite_handler(0xa000, 0xbfff, 0, 0, + read8_delegate(FUNC(bml3_state::bml3_a000_r), this), + write8_delegate(FUNC(bml3_state::bml3_a000_w), this), 0); + } + else + { + mem.install_rom(0xa000, 0xbfff, + memregion("maincpu")->base() + 0xa000); + mem.install_write_handler(0xa000, 0xbfff, 0, 0, + write8_delegate(FUNC(bml3_state::bml3_a000_w), this), + 0); + } + } + + if(!(data & 0x4)) + { + if(data & 0x40) + { + mem.install_readwrite_handler(0xc000, 0xdfff, 0, 0, + read8_delegate(FUNC(bml3_state::bml3_c000_r), this), + write8_delegate(FUNC(bml3_state::bml3_c000_w), this), 0); + } + else + { + mem.install_rom(0xc000, 0xdfff, + memregion("maincpu")->base() + 0xc000); + mem.install_write_handler(0xc000, 0xdfff, 0, 0, + write8_delegate(FUNC(bml3_state::bml3_c000_w), this), + 0); + } + } + + if(!(data & 0x8)) + { + if(data & 0x80) + { + mem.install_readwrite_handler(0xe000, 0xefff, 0, 0, + read8_delegate(FUNC(bml3_state::bml3_e000_r), this), + write8_delegate(FUNC(bml3_state::bml3_e000_w), this), 0); + } + else + { + mem.install_rom(0xe000, 0xefff, + memregion("maincpu")->base() + 0xe000); + mem.install_write_handler(0xe000, 0xefff, 0, 0, + write8_delegate(FUNC(bml3_state::bml3_e000_w), this), + 0); + } + } + + if(data & 1) + { + mem.install_readwrite_handler(0xf000, 0xfeff, 0, 0, + read8_delegate(FUNC(bml3_state::bml3_f000_r), this), + write8_delegate(FUNC(bml3_state::bml3_f000_w), this), 0); + } + else + { + mem.install_rom(0xf000, 0xfeff, + memregion("maincpu")->base() + 0xf000); + mem.install_write_handler(0xf000, 0xfeff, 0, 0, + write8_delegate(FUNC(bml3_state::bml3_f000_w), this), + 0); + } + + if(data & 2) + { + mem.install_readwrite_handler(0xfff0, 0xffff, 0, 0, + read8_delegate(FUNC(bml3_state::bml3_fff0_r), this), + write8_delegate(FUNC(bml3_state::bml3_fff0_w), this), 0); + } + else + { + mem.install_rom(0xfff0, 0xffff, + memregion("maincpu")->base() + 0xfff0); + mem.install_write_handler(0xfff0, 0xffff, 0, 0, + write8_delegate(FUNC(bml3_state::bml3_fff0_w), this), + 0); + } +} + +WRITE_LINE_MEMBER( bml3_state::bml3_acia_tx_w ) +{ + //logerror("%02x TAPE\n",state); + m_cassbit = state; +} + + +WRITE_LINE_MEMBER( bml3_state::bml3_acia_rts_w ) +{ + logerror("%02x TAPE RTS\n",state); +} + +WRITE_LINE_MEMBER( bml3_state::bml3_acia_irq_w ) +{ + logerror("%02x TAPE IRQ\n",state); +} + +WRITE_LINE_MEMBER( bml3_state::write_acia_clock ) +{ + m_acia6850->write_txc(state); + m_acia6850->write_rxc(state); +} + +TIMER_DEVICE_CALLBACK_MEMBER( bml3_state::bml3_c ) +{ + m_cass_data[3]++; + + if (m_cassbit != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cassbit; + } + + if (m_cassbit) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +#if 0 +static const ay8910_interface ay8910_config = +{ + AY8910_LEGACY_OUTPUT, + AY8910_DEFAULT_LOADS, + DEVCB_NULL, // read A + DEVCB_NULL, // read B + DEVCB_NULL, // write A + DEVCB_NULL // write B +}; +#endif + +static SLOT_INTERFACE_START(bml3_cards) + SLOT_INTERFACE("bml3mp1802", BML3BUS_MP1802) /* MP-1802 Floppy Controller Card */ + SLOT_INTERFACE("bml3mp1805", BML3BUS_MP1805) /* MP-1805 Floppy Controller Card */ + SLOT_INTERFACE("bml3kanji", BML3BUS_KANJI) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( bml3_common, bml3_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6809, CPU_CLOCK) + MCFG_CPU_VBLANK_INT_DRIVER("screen", bml3_state, bml3_timer_firq) +// MCFG_CPU_PERIODIC_INT_DRIVER(bml3_state, bml3_firq, 45) + +// MCFG_MACHINE_RESET_OVERRIDE(bml3_state,bml3) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2400)) /* Service manual specifies "Raster return period" as 2.4 ms (p.64), although the total vertical non-displaying time seems to be 4 ms. */ + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + /* Devices */ + // CRTC clock should be synchronous with the CPU clock. + MCFG_MC6845_ADD("crtc", H46505, "screen", CPU_CLOCK) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(bml3_state, crtc_update_row) + + // fire once per scan of an individual key + // According to the service manual (p.65), the keyboard timer is driven by the horizontal video sync clock. + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", bml3_state, keyboard_callback, attotime::from_hz(H_CLOCK/2)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("bml3_c", bml3_state, bml3_c, attotime::from_hz(4800)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("bml3_p", bml3_state, bml3_p, attotime::from_hz(40000)) + + MCFG_DEVICE_ADD("pia6821", PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(bml3_state, bml3_piaA_w)) + + MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(bml3_state, bml3_acia_tx_w)) + MCFG_ACIA6850_RTS_HANDLER(WRITELINE(bml3_state, bml3_acia_rts_w)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(bml3_state, bml3_acia_irq_w)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 9600) // 600 baud x 16(divider) = 9600 + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bml3_state, write_acia_clock)) + + MCFG_CASSETTE_ADD( "cassette" ) + + /* Audio */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* slot devices */ + MCFG_DEVICE_ADD("bml3bus", BML3BUS, 0) + MCFG_BML3BUS_CPU("maincpu") + MCFG_BML3BUS_OUT_NMI_CB(WRITELINE(bml3_state, bml3bus_nmi_w)) + MCFG_BML3BUS_OUT_IRQ_CB(WRITELINE(bml3_state, bml3bus_irq_w)) + MCFG_BML3BUS_OUT_FIRQ_CB(WRITELINE(bml3_state, bml3bus_firq_w)) + /* Default to MP-1805 disk (3" or 5.25" SS/SD), as our MB-6892 ROM dump includes + the MP-1805 ROM. + User may want to switch this to MP-1802 (5.25" DS/DD). + Note it isn't feasible to use both, as they each place boot ROM at F800. + */ + MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl1", bml3_cards, "bml3mp1805") + MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl2", bml3_cards, NULL) + MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl3", bml3_cards, NULL) + MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl4", bml3_cards, NULL) + MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl5", bml3_cards, NULL) + MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl6", bml3_cards, "bml3kanji") + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bml3, bml3_common ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(bml3_mem) + +#if 0 + // TODO: slot device for sound card + // audio + MCFG_SOUND_ADD("ym2203", YM2203, 2000000) //unknown clock / divider + MCFG_YM2203_AY8910_INTF(&ay8910_config) + MCFG_SOUND_ROUTE(0, "mono", 0.25) + MCFG_SOUND_ROUTE(1, "mono", 0.25) + MCFG_SOUND_ROUTE(2, "mono", 0.50) + MCFG_SOUND_ROUTE(3, "mono", 0.50) +#endif +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bml3mk2, bml3_common ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(bml3mk2_mem) + + // TODO: anything to add here? +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bml3mk5, bml3_common ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(bml3mk5_mem) + + // TODO: anything to add here? +MACHINE_CONFIG_END + + + +/* ROM definition */ +ROM_START( bml3 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) +// ROM_LOAD( "l3bas.rom", 0xa000, 0x6000, BAD_DUMP CRC(d81baa07) SHA1(a8fd6b29d8c505b756dbf5354341c48f9ac1d24d)) //original, 24k isn't a proper rom size! + // TODO: replace with MB-6890 ROMs (these are from an MB-6892) + ROM_LOAD( "598 p16611.ic3", 0xa000, 0x2000, BAD_DUMP CRC(954b9bad) SHA1(047948fac6808717c60a1d0ac9205a5725362430)) + ROM_LOAD( "599 p16561.ic4", 0xc000, 0x2000, BAD_DUMP CRC(b27a48f5) SHA1(94cb616df4caa6415c5076f9acdf675acb7453e2)) + // TODO: Replace checksums with a ROM dump without a disk controller patch (checksums here are inclusive of the MP1805 patch) + ROM_LOAD( "600 p16681.ic5", 0xe000, 0x2000, BAD_DUMP CRC(fe3988a5) SHA1(edc732f1cd421e0cf45ffcfc71c5589958ceaae7)) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD("font.rom", 0x00000, 0x1000, BAD_DUMP CRC(0b6f2f10) SHA1(dc411b447ca414e94843636d8b5f910c954581fb) ) // handcrafted + + ROM_REGION( 0x8000, "vram", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( bml3mk2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) +// ROM_LOAD( "l3bas.rom", 0xa000, 0x6000, BAD_DUMP CRC(d81baa07) SHA1(a8fd6b29d8c505b756dbf5354341c48f9ac1d24d)) //original, 24k isn't a proper rom size! + // TODO: replace with MB-6891 ROMs (these are from an MB-6892) + ROM_LOAD( "598 p16611.ic3", 0xa000, 0x2000, BAD_DUMP CRC(954b9bad) SHA1(047948fac6808717c60a1d0ac9205a5725362430)) + ROM_LOAD( "599 p16561.ic4", 0xc000, 0x2000, BAD_DUMP CRC(b27a48f5) SHA1(94cb616df4caa6415c5076f9acdf675acb7453e2)) + ROM_LOAD( "600 p16681.ic5", 0xe000, 0x2000, BAD_DUMP CRC(fe3988a5) SHA1(edc732f1cd421e0cf45ffcfc71c5589958ceaae7)) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD("font.rom", 0x00000, 0x1000, BAD_DUMP CRC(0b6f2f10) SHA1(dc411b447ca414e94843636d8b5f910c954581fb) ) // handcrafted + + ROM_REGION( 0x8000, "vram", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( bml3mk5 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) +// ROM_LOAD( "l3bas.rom", 0xa000, 0x6000, BAD_DUMP CRC(d81baa07) SHA1(a8fd6b29d8c505b756dbf5354341c48f9ac1d24d)) //original, 24k isn't a proper rom size! + /* Handcrafted ROMs, rom labels and contents might not match */ + ROM_LOAD( "598 p16611.ic3", 0xa000, 0x2000, BAD_DUMP CRC(954b9bad) SHA1(047948fac6808717c60a1d0ac9205a5725362430)) + ROM_LOAD( "599 p16561.ic4", 0xc000, 0x2000, BAD_DUMP CRC(b27a48f5) SHA1(94cb616df4caa6415c5076f9acdf675acb7453e2)) + // TODO: Replace checksums with a ROM dump without a disk controller patch (checksums here are inclusive of the MP1805 patch) + ROM_LOAD( "600 p16681.ic5", 0xe000, 0x2000, BAD_DUMP CRC(fe3988a5) SHA1(edc732f1cd421e0cf45ffcfc71c5589958ceaae7)) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD("font.rom", 0x00000, 0x1000, BAD_DUMP CRC(0b6f2f10) SHA1(dc411b447ca414e94843636d8b5f910c954581fb) ) // handcrafted + + ROM_REGION( 0x8000, "vram", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, bml3, 0, 0, bml3, bml3, driver_device, 0, "Hitachi", "MB-6890 Basic Master Level 3", MACHINE_NOT_WORKING) +COMP( 1982, bml3mk2,bml3, 0, bml3mk2, bml3, driver_device, 0, "Hitachi", "MB-6891 Basic Master Level 3 Mark 2", MACHINE_NOT_WORKING) +COMP( 1983, bml3mk5,bml3, 0, bml3mk5, bml3, driver_device, 0, "Hitachi", "MB-6892 Basic Master Level 3 Mark 5", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/bob85.c b/src/mame/drivers/bob85.c new file mode 100644 index 00000000000..ce09e503fc3 --- /dev/null +++ b/src/mame/drivers/bob85.c @@ -0,0 +1,226 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + BOB85 driver by Miodrag Milanovic + + 2008-05-24 Preliminary driver. + 2009-05-12 Skeleton driver. + 2013-06-02 Working driver. + +Pasting: + 0-F : as is + NEXT : ^ + SMEM : - + GO : X + +Test Paste: + -0600^11^22^33^44^55^66^77^88^99^--0600^ + Now press up-arrow to confirm the data has been entered. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "bob85.lh" + + +class bob85_state : public driver_device +{ +public: + bob85_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cass(*this, "cassette"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1"), + m_line2(*this, "LINE2") { } + + required_device m_maincpu; + required_device m_cass; + DECLARE_READ8_MEMBER(bob85_keyboard_r); + DECLARE_WRITE8_MEMBER(bob85_7seg_w); + DECLARE_WRITE_LINE_MEMBER(sod_w); + DECLARE_READ_LINE_MEMBER(sid_r); + UINT8 m_prev_key; + UINT8 m_count_key; + virtual void machine_reset(); + +protected: + required_ioport m_line0; + required_ioport m_line1; + required_ioport m_line2; +}; + + + +READ8_MEMBER(bob85_state::bob85_keyboard_r) +{ + UINT8 retVal = 0; + UINT8 line0 = m_line0->read(); + UINT8 line1 = m_line1->read(); + UINT8 line2 = m_line2->read(); + + if (line0) + { + switch(line0) + { + case 0x01 : retVal = 0x80; break; + case 0x02 : retVal = 0x81; break; + case 0x04 : retVal = 0x82; break; + case 0x08 : retVal = 0x83; break; + case 0x10 : retVal = 0x84; break; + case 0x20 : retVal = 0x85; break; + case 0x40 : retVal = 0x86; break; + case 0x80 : retVal = 0x87; break; + default : break; + } + } + + if (line1) + { + switch(line1) + { + case 0x01 : retVal = 0x88; break; + case 0x02 : retVal = 0x89; break; + case 0x04 : retVal = 0x8A; break; + case 0x08 : retVal = 0x8B; break; + case 0x10 : retVal = 0x8C; break; + case 0x20 : retVal = 0x8D; break; + case 0x40 : retVal = 0x8E; break; + case 0x80 : retVal = 0x8F; break; + default : break; + } + } + + if (line2) + { + switch(line2) + { + case 0x01 : retVal |= 0x90; break; + case 0x02 : retVal |= 0xA0; break; + case 0x04 : retVal |= 0xB0; break; + case 0x08 : retVal |= 0xC0; break; + case 0x10 : retVal |= 0xD0; break; + case 0x20 : retVal |= 0xE0; break; + default : break; + } + } + + if (retVal != m_prev_key) + { + m_prev_key = retVal; + m_count_key = 0; + return retVal; + } + else + { + if (m_count_key <1) + { + m_count_key++; + return retVal; + } + else + return 0; + } + + if (retVal == 0) + { + m_prev_key = 0; + m_count_key = 0; + } + + return retVal; +} + +WRITE8_MEMBER(bob85_state::bob85_7seg_w) +{ + output_set_digit_value(offset, BITSWAP8( data,3,2,1,0,7,6,5,4 )); +} + +static ADDRESS_MAP_START( bob85_mem, AS_PROGRAM, 8, bob85_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x02ff) AM_ROM + AM_RANGE(0x0600, 0x09ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bob85_io, AS_IO, 8, bob85_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0a, 0x0a) AM_READ(bob85_keyboard_r) + AM_RANGE(0x0a, 0x0f) AM_WRITE(bob85_7seg_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( bob85 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SMEM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REC") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VEK1") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VEK2") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0xC0, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +void bob85_state::machine_reset() +{ +} + +WRITE_LINE_MEMBER( bob85_state::sod_w ) +{ + m_cass->output(state ? +1.0 : -1.0); +} + +READ_LINE_MEMBER( bob85_state::sid_r ) +{ + return m_cass->input() > 0.0; +} + +static MACHINE_CONFIG_START( bob85, bob85_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8085A, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(bob85_mem) + MCFG_CPU_IO_MAP(bob85_io) + MCFG_I8085A_SID(READLINE(bob85_state, sid_r)) + MCFG_I8085A_SOD(WRITELINE(bob85_state, sod_w)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_bob85) + + // devices + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( bob85 ) + ROM_REGION( 0x600, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bob85.rom", 0x0000, 0x0300, BAD_DUMP CRC(adde33a8) SHA1(00f26dd0c52005e7705e6cc9cb11a20e572682c6) ) // should be 6 separate 74S287's (256x4) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, bob85, 0, 0, bob85, bob85, driver_device, 0, "Josef Kratochvil", "BOB-85", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/br8641.c b/src/mame/drivers/br8641.c new file mode 100644 index 00000000000..671aeab491d --- /dev/null +++ b/src/mame/drivers/br8641.c @@ -0,0 +1,200 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Brandt 8641 + + Currency Counter + + 2012-12-24 Skeleton driver. [Micko] + 2015-09-27 Added devices & inputs based entirely on guesswork [Robbbert] + + There seems to be 15 buttons (according to images, I just have board) + also there are 8 dips currently set at 00011100 (1 is on) + + Looks like a LCD display? I think ports 8 & 9 write to it. Also looks + like the display should say 8641 when machine is turned on. + +ToDo: +- Need manuals, schematics, etc. +- Artwork +- Everything + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "sound/beep.h" + +class brandt8641_state : public driver_device +{ +public: + brandt8641_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_pio1(*this, "pio1") + , m_pio2(*this, "pio2") + , m_pio3(*this, "pio3") + , m_ctc(*this, "ctc") + , m_io_keyboard(*this, "KEY") + , m_beep(*this, "beeper") + { } + + DECLARE_READ8_MEMBER(port08_r); + DECLARE_WRITE8_MEMBER(port08_w); + DECLARE_WRITE8_MEMBER(port09_w); + DECLARE_MACHINE_RESET(br8641); + +private: + UINT8 m_port08; + UINT8 m_port09; + required_device m_maincpu; + required_device m_pio1; + required_device m_pio2; + required_device m_pio3; + required_device m_ctc; + required_ioport_array<8> m_io_keyboard; + required_device m_beep; +}; + +static ADDRESS_MAP_START(brandt8641_mem, AS_PROGRAM, 8, brandt8641_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_ROM // 27256 at U12 + AM_RANGE(0x8000, 0x9fff) AM_RAM // 8KB static ram 6264 at U12 +ADDRESS_MAP_END + +static ADDRESS_MAP_START(brandt8641_io, AS_IO, 8, brandt8641_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("pio1", z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("pio2", z80pio_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("pio3", z80pio_device, read, write) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) + AM_RANGE(0x1E, 0x1F) AM_WRITENOP // unknown device +ADDRESS_MAP_END + +/* Input ports */ +// No idea what each key does +static INPUT_PORTS_START( brandt8641 ) + PORT_START("KEY.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) + + PORT_START("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) + + PORT_START("KEY.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) + + PORT_START("KEY.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) + + PORT_START("KEY.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) + + PORT_START("KEY.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) + + PORT_START("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) + + PORT_START("KEY.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) +INPUT_PORTS_END + +READ8_MEMBER( brandt8641_state::port08_r ) +{ + UINT8 i, data = 7; + + for (i = 0; i < 8; i++) + if BIT(m_port09, i) + data &= m_io_keyboard[i]->read(); + + return data | m_port08; +} + +WRITE8_MEMBER( brandt8641_state::port08_w ) +{ + m_port08 = data & 0xf8; + m_beep->set_state(BIT(data, 4)); +} + +WRITE8_MEMBER( brandt8641_state::port09_w ) +{ + m_port09 = data ^ 0xff; +} + +MACHINE_RESET_MEMBER( brandt8641_state, br8641 ) +{ + m_beep->set_frequency(2000); +} + +static const z80_daisy_config daisy_chain_intf[] = +{ + { "pio1" }, + { "pio2" }, + { "pio3" }, + { "ctc" }, + { NULL } +}; + + + +static MACHINE_CONFIG_START( brandt8641, brandt8641_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) // U4 ,4MHz crystal on board + MCFG_CPU_PROGRAM_MAP(brandt8641_mem) + MCFG_CPU_IO_MAP(brandt8641_io) + MCFG_CPU_CONFIG(daisy_chain_intf) + + MCFG_MACHINE_RESET_OVERRIDE(brandt8641_state, br8641) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + // Z80APIO U9 + // Z80APIO U14 + // Z80PIO U7 - unknown which is which + MCFG_DEVICE_ADD("pio1", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("pio2", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(brandt8641_state, port08_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(brandt8641_state, port08_w)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(brandt8641_state, port09_w)) + + MCFG_DEVICE_ADD("pio3", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_4MHz) // Z80CTC U8 +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( br8641 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "v0911he.u11", 0x0000, 0x8000, CRC(59a16951) SHA1(893dba60ec8bfa391fb2d2a30db5d42d601f5eb9)) +ROM_END + +/* Driver */ +COMP( 1986, br8641, 0, 0, brandt8641, brandt8641, driver_device, 0, "Brandt", "Brandt 8641", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/bullet.c b/src/mame/drivers/bullet.c new file mode 100644 index 00000000000..8cfdd256dc4 --- /dev/null +++ b/src/mame/drivers/bullet.c @@ -0,0 +1,1297 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Wave Mate Bullet + +PCB Layout +---------- + +|-------------------------------------------| +| CN7 CN6 | +| PIO | +| FDC | +| 4164 4164 CN5 | +| 4164 4164 SW1 CN2| +| 4164 4164 | +| 4164 4164 PROM | +| 4164 4164 4.9152MHz | +| 4164 4164 16MHz DMA CPU | +| 4164 4164 | +| 4164 4164 CN4 CN3 CN1| +| | +| DART CTC | +| CN8 | +|-------------------------------------------| + +Notes: + Relevant IC's shown. + + CPU - SGS Z80ACPUB1 Z80A CPU + DMA - Zilog Z8410APS Z80A DMA + PIO - SGS Z80APIOB1 Z80A PIO + DART - Zilog Z8470APS Z80A DART + CTC - Zilog Z8430APS Z80A CTC + FDC - Synertek SY1793-02 FDC + PROM - AMD AM27S190C 32x8 TTL PROM + 4164 - Fujitsu MB8264-15 64Kx1 RAM + CN1 - 2x25 PCB header, external DMA bus + CN2 - 2x17 PCB header, Winchester / 2x25 header, SCSI (in board revision E) + CN3 - 2x5 PCB header, RS-232 A (system console) + CN4 - 2x5 PCB header, RS-232 B + CN5 - 2x17 PCB header, Centronics + CN6 - 2x25 PCB header, 8" floppy drives + CN7 - 2x17 PCB header, 5.25" floppy drives + CN8 - 4-pin Molex + +*/ + +/* + + TODO: + + - memory banking is broken + - z80dart wait/ready + - IMI 7710 Winchester controller + chdman createhd -o imi7710.chd -chs 350,3,10 -ss 1024 + - revision E model + +*/ + +#include "includes/bullet.h" +#include "bus/rs232/rs232.h" +#include "bus/scsi/scsihd.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +// DMA ready sources +enum +{ + FDRDY = 0, + DARTARDY, + DARTBRDY, + WINRDY, + EXRDY1, + EXRDY2 +}; + +#define SEG0 \ + BIT(m_mbank, 0) + +#define SEG5 \ + BIT(m_mbank, 5) + +#define DMB4 \ + BIT(m_xdma0, 4) + +#define DMB6 \ + BIT(m_xdma0, 6) + + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// mreq_r - +//------------------------------------------------- + +READ8_MEMBER( bullet_state::mreq_r ) +{ + UINT8 data = 0; + + if (!m_brom && !BIT(offset, 5)) + { + data = m_rom->base()[offset & 0x1f]; + } + else + { + if (offset < 0xc000) + { + data = m_ram->pointer()[(m_segst << 16) | offset]; + } + else + { + data = m_ram->pointer()[offset]; + } + } + + return data; +} + + +//------------------------------------------------- +// mreq_w - +//------------------------------------------------- + +WRITE8_MEMBER( bullet_state::mreq_w ) +{ + if (offset < 0xc000) + { + m_ram->pointer()[(m_segst << 16) | offset] = data; + } + else + { + m_ram->pointer()[offset] = data; + } +} + + +//------------------------------------------------- +// win_r - +//------------------------------------------------- + +READ8_MEMBER( bullet_state::win_r ) +{ + return 0; +} + + +//------------------------------------------------- +// wstrobe_w - +//------------------------------------------------- + +WRITE8_MEMBER( bullet_state::wstrobe_w ) +{ +} + + +//------------------------------------------------- +// brom_r - +//------------------------------------------------- + +READ8_MEMBER( bullet_state::brom_r ) +{ + m_brom = 1; + + return 0; +} + + +//------------------------------------------------- +// brom_w - +//------------------------------------------------- + +WRITE8_MEMBER( bullet_state::brom_w ) +{ + m_brom = 1; +} + + +//------------------------------------------------- +// exdsk_w - +//------------------------------------------------- + +WRITE8_MEMBER( bullet_state::exdsk_w ) +{ + /* + + bit signal description + + 0 drive select 0 + 1 drive select 1 + 2 select 8" floppy + 3 MSE select software control of port + 4 SIDE select side 2 + 5 _MOTOR disable 5" floppy spindle motors + 6 + 7 WPRC enable write precompensation + + */ + + if (BIT(data, 3)) + { + m_exdsk_sw = true; + } + + if (m_exdsk_sw) + { + // drive select + m_floppy = NULL; + + switch (data & 0x07) + { + // 5.25" + case 0: m_floppy = m_floppy0->get_device(); break; + case 1: m_floppy = m_floppy1->get_device(); break; + case 2: m_floppy = m_floppy2->get_device(); break; + case 3: m_floppy = m_floppy3->get_device(); break; + // 8" + case 4: m_floppy = m_floppy4->get_device(); break; + case 5: m_floppy = m_floppy5->get_device(); break; + case 6: m_floppy = m_floppy6->get_device(); break; + case 7: m_floppy = m_floppy7->get_device(); break; + } + + m_fdc->set_floppy(m_floppy); + } + + if (m_floppy) + { + // side select + m_floppy->ss_w(BIT(data, 4)); + + // floppy motor + m_floppy->mon_w(BIT(data, 5)); + } +} + + +//------------------------------------------------- +// exdma_w - +//------------------------------------------------- + +WRITE8_MEMBER( bullet_state::exdma_w ) +{ + /* + + bit description + + 0 DMA ready source select 0 + 1 DMA ready source select 1 + 2 DMA ready source select 2 + 3 memory control 0 + 4 memory control 1 + 5 + 6 + 7 + + */ + + m_exdma = data; + + m_buf = BIT(data, 3); + + update_dma_rdy(); +} + + +//------------------------------------------------- +// hdcon_w - +//------------------------------------------------- + +WRITE8_MEMBER( bullet_state::hdcon_w ) +{ + /* + + bit signal description + + 0 PLO phase lock oscillator + 1 RCD read clock frequency + 2 EXC MB8877 clock frequency + 3 DEN MB8877 density select + 4 enable software control of mode + 5 + 6 + 7 + + */ + + if (BIT(data, 4)) + { + m_hdcon_sw = true; + } + + if (m_hdcon_sw) + { + // FDC clock + m_fdc->set_unscaled_clock(BIT(data, 2) ? XTAL_16MHz/16 : XTAL_16MHz/8); + + // density select + m_fdc->dden_w(BIT(data, 3)); + } +} + + +//------------------------------------------------- +// info_r - +//------------------------------------------------- + +READ8_MEMBER( bullet_state::info_r ) +{ + /* + + bit signal description + + 0 SW1 DIP switch 1 + 1 SW2 DIP switch 2 + 2 SW3 DIP switch 3 + 3 SW4 DIP switch 4 + 4 HLDST floppy disk head load status + 5 *XDCG floppy disk exchange (8" only) + 6 FDIRQ FDC interrupt request line + 7 FDDRQ FDC data request line + + */ + + UINT8 data = 0; + + // DIP switches + data |= m_sw1->read() & 0x0f; + + // floppy + data |= m_fdc->hld_r() << 4; + data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 5; + data |= m_fdc->intrq_r() << 6; + data |= m_fdc->drq_r() << 7; + + return data; +} + + +//------------------------------------------------- +// segst_w - +//------------------------------------------------- + +WRITE8_MEMBER( bullet_state::segst_w ) +{ + m_segst = BIT(data, 0); +} + + +//------------------------------------------------- +// mreq_r - +//------------------------------------------------- + +READ8_MEMBER( bulletf_state::mreq_r ) +{ + UINT8 data = 0; + + if (!m_rome && !BIT(offset, 5)) + { + data = m_rom->base()[offset & 0x1f]; + } + else + { + if (offset < 0xc000) + { + if (!SEG5) + { + data = m_ram->pointer()[(SEG0 << 16) | offset]; + } + else if (offset >= 0x8000) + { + data = m_ram->pointer()[0x1c000 + (offset - 0x8000)]; + } + } + else + { + data = m_ram->pointer()[offset]; + } + } + + return data; +} + + +//------------------------------------------------- +// mreq_w - +//------------------------------------------------- + +WRITE8_MEMBER( bulletf_state::mreq_w ) +{ + if (offset < 0xc000) + { + if (!SEG5) + { + m_ram->pointer()[(SEG0 << 16) | offset] = data; + } + else if (offset >= 0x8000) + { + m_ram->pointer()[0x1c000 + (offset - 0x8000)] = data; + } + } + else + { + m_ram->pointer()[offset] = data; + } +} + + +//------------------------------------------------- +// xdma0_w - +//------------------------------------------------- + +WRITE8_MEMBER( bulletf_state::xdma0_w ) +{ + /* + + bit signal + + 0 device select (0=FDC, 1=SCSI) + 1 + 2 + 3 + 4 DMB4 Source bank + 5 + 6 DMB6 Destination bank + 7 + + */ + + m_rome = 1; + + m_xdma0 = data; +} + + +//------------------------------------------------- +// xfdc_w - +//------------------------------------------------- + +WRITE8_MEMBER( bulletf_state::xfdc_w ) +{ + /* + + bit signal + + 0 Unit select number + 1 Unit select number + 2 Unit select number + 3 Unit select number + 4 Select side 2 + 5 Disable 3 & 5 inch spindle motors + 6 Set for 1 MHz controller operation, reset for 2 MHz controller operation + 7 Set to select single density + + */ + + // drive select + m_floppy = NULL; + + switch (data & 0x0f) + { + // 5.25" + case 0: m_floppy = m_floppy0->get_device(); break; + case 1: m_floppy = m_floppy1->get_device(); break; + case 2: m_floppy = m_floppy2->get_device(); break; + case 3: m_floppy = m_floppy3->get_device(); break; + // 8" + case 4: m_floppy = m_floppy4->get_device(); break; + case 5: m_floppy = m_floppy5->get_device(); break; + case 6: m_floppy = m_floppy6->get_device(); break; + case 7: m_floppy = m_floppy7->get_device(); break; + // 3.5" + case 8: m_floppy = m_floppy8->get_device(); break; + case 9: m_floppy = m_floppy9->get_device(); break; + } + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + { + // side select + m_floppy->ss_w(BIT(data, 4)); + + // floppy motor + m_floppy->mon_w(BIT(data, 5)); + } + + // FDC clock + m_fdc->set_unscaled_clock(BIT(data, 6) ? XTAL_16MHz/16 : XTAL_16MHz/8); + + // density select + m_fdc->dden_w(BIT(data, 7)); +} + + +//------------------------------------------------- +// mbank_w - +//------------------------------------------------- + +WRITE8_MEMBER( bulletf_state::mbank_w ) +{ + /* + + bit signal + + 0 Select active bank (0=bank 0, 1=bank 1) + 1 + 2 + 3 + 4 Select system space overlay (0=no overlay, 1=overlay) + 5 + 6 + 7 + + */ + + m_mbank = data; +} + + +//------------------------------------------------- +// scsi_r - +//------------------------------------------------- + +READ8_MEMBER( bulletf_state::scsi_r ) +{ + UINT8 data = m_scsi_data_in->read(); + + m_scsibus->write_ack(1); + + m_wack = 0; + update_dma_rdy(); + + return data; +} + + +//------------------------------------------------- +// scsi_w - +//------------------------------------------------- + +WRITE8_MEMBER( bulletf_state::scsi_w ) +{ + m_scsi_data_out->write(data); + + m_scsibus->write_ack(1); + + m_wack = 0; + update_dma_rdy(); +} + +//------------------------------------------------- +// hwsts_r - +//------------------------------------------------- + +READ8_MEMBER( bulletf_state::hwsts_r ) +{ + /* + + bit signal + + 0 CBUSY Centronics busy + 1 SW2 DIP switch 2 + 2 SW3 DIP switch 3 + 3 FD2S *Floppy disk two sided + 4 HLDST Floppy disk head load status + 5 XDCG *Floppy disk exchange (8-inch only) + 6 FDIRQ FDC interrupt request line + 7 FDDRQ FDC data request line + + */ + + UINT8 data = 0; + + // centronics busy + data |= m_centronics_busy; + + // DIP switches + data |= m_sw1->read() & 0x06; + + // floppy + data |= (m_floppy ? m_floppy->twosid_r() : 1) << 3; + data |= m_fdc->hld_r() << 4; + data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 5; + data |= m_fdc->intrq_r() << 6; + data |= m_fdc->drq_r() << 7; + + return data; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( bullet_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( bullet_mem, AS_PROGRAM, 8, bullet_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(mreq_r, mreq_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( bullet_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( bullet_io, AS_IO, 8, bullet_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1f) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x03) AM_READWRITE(win_r, wstrobe_w) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(MB8877_TAG, mb8877_t, read, write) + AM_RANGE(0x14, 0x14) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) + AM_RANGE(0x15, 0x15) AM_READWRITE(brom_r, brom_w) + AM_RANGE(0x16, 0x16) AM_WRITE(exdsk_w) + AM_RANGE(0x17, 0x17) AM_WRITE(exdma_w) + AM_RANGE(0x18, 0x18) AM_WRITE(hdcon_w) + AM_RANGE(0x19, 0x19) AM_READ(info_r) + AM_RANGE(0x1a, 0x1a) AM_WRITE(segst_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( bulletf_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( bulletf_mem, AS_PROGRAM, 8, bulletf_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(mreq_r, mreq_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( bulletf_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( bulletf_io, AS_IO, 8, bulletf_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3f) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(MB8877_TAG, mb8877_t, read, write) + AM_RANGE(0x14, 0x14) AM_WRITE(xdma0_w) + AM_RANGE(0x16, 0x16) AM_WRITE(xfdc_w) + AM_RANGE(0x17, 0x17) AM_WRITE(mbank_w) + AM_RANGE(0x19, 0x19) AM_READWRITE(scsi_r, scsi_w) + AM_RANGE(0x1a, 0x1a) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) + AM_RANGE(0x1b, 0x1b) AM_READ(hwsts_r) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( bullet ) +//------------------------------------------------- + +INPUT_PORTS_START( bullet ) + PORT_START("SW1") + PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" ) + PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) + PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) + PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" ) + PORT_DIPNAME( 0xf0, 0x50, "Floppy Type" ) PORT_DIPLOCATION("SW1:5,6,7,8") + PORT_DIPSETTING( 0xf0, "5.25\" SD" ) + PORT_DIPSETTING( 0x50, "5.25\" DD" ) + PORT_DIPSETTING( 0x90, "8\" SD" ) + PORT_DIPSETTING( 0x00, "8\" DD" ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( bulletf ) +//------------------------------------------------- + +INPUT_PORTS_START( bulletf ) + PORT_START("SW1") + PORT_DIPNAME( 0x01, 0x01, "SCSI Bus Termination" ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) + PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) + PORT_DIPNAME( 0x08, 0x08, "Boot ROM Device" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x00, "Onboard" ) + PORT_DIPSETTING( 0x08, "EPROM" ) + PORT_DIPNAME( 0xf0, 0xc0, "Floppy Type" ) PORT_DIPLOCATION("SW1:5,6,7,8") + PORT_DIPSETTING( 0x10, "3\" DD" ) + PORT_DIPSETTING( 0xc0, "5.25\" SD" ) + PORT_DIPSETTING( 0x40, "5.25\" DD" ) + PORT_DIPSETTING( 0xa0, "8\" SD" ) + PORT_DIPSETTING( 0x20, "8\" DD" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// Z80CTC +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(bullet_state::ctc_tick) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); + + m_ctc->trg1(1); + m_ctc->trg1(0); + + m_ctc->trg2(1); + m_ctc->trg2(0); +} + +WRITE_LINE_MEMBER( bullet_state::dart_rxtxca_w ) +{ + m_dart->txca_w(state); + m_dart->rxca_w(state); +} + +//------------------------------------------------- +// Z80DART +//------------------------------------------------- + +WRITE_LINE_MEMBER( bullet_state::dartardy_w ) +{ + m_dartardy = state; + update_dma_rdy(); +} + +WRITE_LINE_MEMBER( bullet_state::dartbrdy_w ) +{ + m_dartbrdy = state; + update_dma_rdy(); +} + +//------------------------------------------------- +// Z80DMA +//------------------------------------------------- + +void bullet_state::update_dma_rdy() +{ + int rdy = 1; + + switch (m_exdma & 0x07) + { + case FDRDY: + rdy = m_fdrdy; + break; + + case DARTARDY: + rdy = m_dartardy; + break; + + case DARTBRDY: + rdy = m_dartbrdy; + break; + + case WINRDY: + rdy = m_winrdy; + break; + + case EXRDY1: + rdy = m_exrdy1; + break; + + case EXRDY2: + rdy = m_exrdy2; + break; + } + + m_dmac->rdy_w(rdy); +} + +READ8_MEMBER( bullet_state::dma_mreq_r ) +{ + UINT8 data = m_ram->pointer()[(m_buf << 16) | offset]; + + if (BIT(m_exdma, 4)) + { + m_buf = !m_buf; + } + + return data; +} + +WRITE8_MEMBER( bullet_state::dma_mreq_w ) +{ + m_ram->pointer()[(m_buf << 16) | offset] = data; + + if (BIT(m_exdma, 4)) + { + m_buf = !m_buf; + } +} + +READ8_MEMBER(bullet_state::io_read_byte) +{ + return m_maincpu->space(AS_IO).read_byte(offset); +} + +WRITE8_MEMBER(bullet_state::io_write_byte) +{ + m_maincpu->space(AS_IO).write_byte(offset, data); +} + +//------------------------------------------------- +// Z80DMA for bulletf (not used currently) +//------------------------------------------------- + +void bulletf_state::update_dma_rdy() +{ + int rdy = 1; + + if (BIT(m_xdma0, 0)) + { + rdy = m_wack || m_wrdy; + } + else + { + rdy = m_fdrdy; + } + + m_dmac->rdy_w(rdy); +} + +READ8_MEMBER( bulletf_state::dma_mreq_r ) +{ + return m_ram->pointer()[(DMB4 << 16) | offset]; +} + +WRITE8_MEMBER( bulletf_state::dma_mreq_w ) +{ + m_ram->pointer()[(DMB6 << 16) | offset] = data; +} + +//------------------------------------------------- +// Z80PIO +//------------------------------------------------- + +DECLARE_WRITE_LINE_MEMBER( bullet_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +DECLARE_WRITE_LINE_MEMBER( bullet_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +DECLARE_WRITE_LINE_MEMBER( bullet_state::write_centronics_select ) +{ + m_centronics_select = state; +} + +DECLARE_WRITE_LINE_MEMBER( bullet_state::write_centronics_fault ) +{ + m_centronics_fault = state; +} + +READ8_MEMBER( bullet_state::pio_pb_r ) +{ + /* + + bit signal description + + 0 centronics busy + 1 centronics paper end + 2 centronics selected + 3 *FAULT centronics fault + 4 external vector + 5 WBUSDIR winchester bus direction + 6 WCOMPLETE winchester command complete + 7 *WINRDY winchester ready + + */ + + UINT8 data = 0; + + // centronics + data |= m_centronics_busy; + data |= m_centronics_perror << 1; + data |= m_centronics_select << 2; + data |= m_centronics_fault << 3; + + return data; +} + + +WRITE8_MEMBER( bulletf_state::pio_pa_w ) +{ + /* + + bit signal + + 0 ATN + 1 RST + 2 SEL + 3 BUSY + 4 MSG + 5 C/D + 6 REQ + 7 I/O + + */ + + m_scsibus->write_atn(BIT(data, 0)); + m_scsibus->write_rst(BIT(data, 1)); + m_scsibus->write_sel(BIT(data, 2)); +} + +WRITE_LINE_MEMBER( bulletf_state::cstrb_w ) +{ + m_centronics->write_strobe(!state); +} + +static SLOT_INTERFACE_START( bullet_525_floppies ) + SLOT_INTERFACE( "525sd", FLOPPY_525_SD ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( bullet_8_floppies ) + SLOT_INTERFACE( "8dssd", FLOPPY_8_DSSD ) + SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( bullet_35_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER( bullet_state::fdc_drq_w ) +{ + m_fdrdy = !state; + update_dma_rdy(); +} + +WRITE_LINE_MEMBER( bulletf_state::req_w ) +{ + if (!state) + { + m_scsibus->write_ack(0); + + m_wack = 1; + } + + m_wrdy = !state; + update_dma_rdy(); + + m_scsi_ctrl_in->write_bit6(state); +} + + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + + +//------------------------------------------------- +// z80_daisy_config daisy_chain +//------------------------------------------------- + +static const z80_daisy_config daisy_chain[] = +{ + { Z80DMA_TAG }, + { Z80DART_TAG }, + { Z80PIO_TAG }, + { Z80CTC_TAG }, + { NULL } +}; + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( bullet ) +//------------------------------------------------- + +void bullet_state::machine_start() +{ + // state saving + save_item(NAME(m_segst)); + save_item(NAME(m_brom)); + save_item(NAME(m_exdma)); + save_item(NAME(m_buf)); + save_item(NAME(m_fdrdy)); + save_item(NAME(m_dartardy)); + save_item(NAME(m_dartbrdy)); + save_item(NAME(m_winrdy)); + save_item(NAME(m_exrdy1)); + save_item(NAME(m_exrdy2)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_perror)); + save_item(NAME(m_centronics_select)); + save_item(NAME(m_centronics_fault)); +} + + +//------------------------------------------------- +// MACHINE_START( bulletf ) +//------------------------------------------------- + +void bulletf_state::machine_start() +{ + // state saving + save_item(NAME(m_fdrdy)); + save_item(NAME(m_rome)); + save_item(NAME(m_xdma0)); + save_item(NAME(m_mbank)); + save_item(NAME(m_wack)); + save_item(NAME(m_wrdy)); + save_item(NAME(m_centronics_busy)); +} + + +void bullet_state::machine_reset() +{ + // memory banking + m_brom = 0; + m_segst = 0; + + // DMA ready + m_exdma = 0; + m_buf = 0; + update_dma_rdy(); + + // disable software control + m_exdsk_sw = false; + m_hdcon_sw = false; + + UINT8 sw1 = m_sw1->read(); + int mini = BIT(sw1, 6); + m_fdc->set_unscaled_clock(mini ? XTAL_16MHz/16 : XTAL_16MHz/8); + m_fdc->dden_w(BIT(sw1, 7)); + + if (mini) + { + m_floppy = m_floppy0->get_device(); + } + else + { + m_floppy = m_floppy4->get_device(); + } + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + { + m_floppy->ss_w(0); + m_floppy->mon_w(0); + } +} + + +void bulletf_state::machine_reset() +{ + // memory banking + m_rome = 0; + m_mbank = 0; + + // DMA ready + m_xdma0 = 0; + m_wack = 0; + m_wrdy = 0; + update_dma_rdy(); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( bullet ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( bullet, bullet_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) + MCFG_CPU_PROGRAM_MAP(bullet_mem) + MCFG_CPU_IO_MAP(bullet_io) + MCFG_CPU_CONFIG(daisy_chain) + + // devices + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(bullet_state, dart_rxtxca_w)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bullet_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4)) + + MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_16MHz/4, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(bullet_state, dartardy_w)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(bullet_state, dartbrdy_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_16MHz/4) + MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(bullet_state, dma_mreq_r)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(bullet_state, dma_mreq_w)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(bullet_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(bullet_state, io_write_byte)) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_16MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_IN_PB_CB(READ8(bullet_state, pio_pb_r)) + + MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bullet_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", bullet_525_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":1", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":2", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":3", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":4", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":5", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":6", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":7", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(bullet_state, write_centronics_busy)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(bullet_state, write_centronics_perror)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(bullet_state, write_centronics_select)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(bullet_state, write_centronics_fault)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "wmbullet") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( bulletf ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( bulletf, bulletf_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) + MCFG_CPU_PROGRAM_MAP(bulletf_mem) + MCFG_CPU_IO_MAP(bulletf_io) + MCFG_CPU_CONFIG(daisy_chain) + + // devices + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(bullet_state, dart_rxtxca_w)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bullet_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4)) + + MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_16MHz/4, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(bullet_state, dartardy_w)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(bullet_state, dartbrdy_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_16MHz/4) + MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(bullet_state, dma_mreq_r)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(bullet_state, dma_mreq_w)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(bullet_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(bullet_state, io_write_byte)) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_16MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(DEVREAD8("scsi_ctrl_in", input_buffer_device, read)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(bulletf_state, pio_pa_w)) + MCFG_Z80PIO_OUT_ARDY_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(bulletf_state, cstrb_w)) + + MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z80DART_TAG, z80dart_device, rib_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bullet_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", bullet_525_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":1", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":2", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":3", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":4", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":5", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":6", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":7", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":8", bullet_35_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":9", bullet_35_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(bullet_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + + MCFG_DEVICE_ADD(SCSIBUS_TAG, SCSI_PORT, 0) + MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3)) + MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit4)) + MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit5)) + MCFG_SCSI_REQ_HANDLER(WRITELINE(bulletf_state, req_w)) + MCFG_SCSI_IO_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit7)) + MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") + + MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SCSIBUS_TAG) + MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0) + MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) + + MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "wmbullet") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( bullet ) +//------------------------------------------------- + +ROM_START( wmbullet ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "sr70x.u8", 0x00, 0x20, CRC(d54b8a30) SHA1(65ff8753dd63c9dd1899bc9364a016225585d050) ) +ROM_END + + +#define rom_wmbulletf rom_wmbullet + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +// the setname 'bullet' is used by Sega's Bullet in MAME. +COMP( 1982, wmbullet, 0, 0, bullet, bullet, driver_device, 0, "Wave Mate", "Bullet", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1984, wmbulletf, wmbullet, 0, bulletf, bulletf, driver_device, 0, "Wave Mate", "Bullet (Revision F)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/busicom.c b/src/mame/drivers/busicom.c new file mode 100644 index 00000000000..adcb77be331 --- /dev/null +++ b/src/mame/drivers/busicom.c @@ -0,0 +1,249 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Busicom 141-PF + + 04/08/2009 Initial driver by Miodrag Milanovic + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i4004/i4004.h" +#include "includes/busicom.h" + + +UINT8 busicom_state::get_bit_selected(UINT32 val,int num) +{ + int i; + for(i=0;iread(); +} + +READ8_MEMBER(busicom_state::printer_r) +{ + UINT8 retVal = 0; + if (m_drum_index==0) retVal |= 1; + retVal |= ioport("PAPERADV")->read() & 1 ? 8 : 0; + return retVal; +} + + +WRITE8_MEMBER(busicom_state::shifter_w) +{ + if (BIT(data,0)) { + m_keyboard_shifter <<= 1; + m_keyboard_shifter |= BIT(data,1); + } + if (BIT(data,2)) { + m_printer_shifter <<= 1; + m_printer_shifter |= BIT(data,1); + } +} + +WRITE8_MEMBER(busicom_state::printer_w) +{ + int i,j; + if (BIT(data,0)) { + logerror("color : %02x %02x %d\n",BIT(data,0),data,m_drum_index); + m_printer_line_color[10] = 1; + + } + if (BIT(data,1)) { + for(i=3;i<18;i++) { + if(BIT(m_printer_shifter,i)) { + m_printer_line[10][i-3] = m_drum_index + 1; + } + } + if(BIT(m_printer_shifter,0)) { + m_printer_line[10][15] = m_drum_index + 13 + 1; + } + if(BIT(m_printer_shifter,1)) { + m_printer_line[10][16] = m_drum_index + 26 + 1; + } + } + if (BIT(data,3)) { + for(j=0;j<10;j++) { + for(i=0;i<17;i++) { + m_printer_line[j][i] = m_printer_line[j+1][i]; + m_printer_line_color[j] = m_printer_line_color[j+1]; + } + } + for(i=0;i<17;i++) { + m_printer_line[10][i] = 0; + } + m_printer_line_color[10] = 0; + + } +} +WRITE8_MEMBER(busicom_state::status_w) +{ +#if 0 + UINT8 mem_lamp = BIT(data,0); + UINT8 over_lamp = BIT(data,1); + UINT8 minus_lamp = BIT(data,2); +#endif + //logerror("status %c %c %c\n",mem_lamp ? 'M':'x',over_lamp ? 'O':'x',minus_lamp ? '-':'x'); +} + +WRITE8_MEMBER(busicom_state::printer_ctrl_w) +{ +} + +static ADDRESS_MAP_START(busicom_rom, AS_PROGRAM, 8, busicom_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x04FF) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(busicom_mem, AS_DATA, 8, busicom_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07F) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( busicom_io , AS_IO, 8, busicom_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_WRITE(shifter_w) // ROM0 I/O + AM_RANGE(0x01, 0x01) AM_READWRITE(keyboard_r,printer_ctrl_w) // ROM1 I/O + AM_RANGE(0x02, 0x02) AM_READ(printer_r) // ROM2 I/O + AM_RANGE(0x10, 0x10) AM_WRITE(printer_w) // RAM0 output + AM_RANGE(0x11, 0x11) AM_WRITE(status_w) // RAM1 output +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( busicom ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CM") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RM") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M-") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M+") PORT_CODE(KEYCODE_4) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SQRT") PORT_CODE(KEYCODE_S) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("%") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M=-") PORT_CODE(KEYCODE_6) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M=+") PORT_CODE(KEYCODE_7) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("diamond") PORT_CODE(KEYCODE_D) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("diamond 2") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("000") PORT_CODE(KEYCODE_8) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("00") PORT_CODE(KEYCODE_9) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Sign") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EX") PORT_CODE(KEYCODE_X) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CE") PORT_CODE(KEYCODE_E) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_START("LINE8") + PORT_CONFNAME( 0x0f, 0x00, "Digital point") + PORT_CONFSETTING( 0x00, "0" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x03, "3" ) + PORT_CONFSETTING( 0x04, "4" ) + PORT_CONFSETTING( 0x05, "5" ) + PORT_CONFSETTING( 0x06, "6" ) + PORT_CONFSETTING( 0x08, "8" ) + PORT_START("LINE9") + PORT_CONFNAME( 0x0f, 0x00, "Rounding") + PORT_CONFSETTING( 0x01, "/N" ) + PORT_CONFSETTING( 0x00, "FL" ) + PORT_CONFSETTING( 0x08, "5/4" ) + PORT_START("PAPERADV") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Paper adv.") PORT_CODE(KEYCODE_SPACE) + +INPUT_PORTS_END + + +TIMER_DEVICE_CALLBACK_MEMBER(busicom_state::timer_callback) +{ + m_timer ^=1; + if (m_timer==1) m_drum_index++; + if (m_drum_index==13) m_drum_index=0; + m_maincpu->set_test(m_timer); + +} + +void busicom_state::machine_start() +{ +} + +void busicom_state::machine_reset() +{ + int i,j; + m_drum_index =0; + m_keyboard_shifter = 0; + m_printer_shifter = 0; + + for(i=0;i<17;i++) { + for(j=0;j<11;j++) { + m_printer_line[j][i] = 0; + m_printer_line_color[j] = 0; + } + } + +} + +//static const char layout_busicom [] = "busicom"; + +static MACHINE_CONFIG_START( busicom, busicom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I4004, 750000) + MCFG_CPU_PROGRAM_MAP(busicom_rom) + MCFG_CPU_DATA_MAP(busicom_mem) + MCFG_CPU_IO_MAP(busicom_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(40*17, 44*11) + MCFG_SCREEN_VISIBLE_AREA(0, 40*17-1, 0, 44*11-1) + MCFG_SCREEN_UPDATE_DRIVER(busicom_state, screen_update_busicom) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(busicom_state, busicom) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("busicom_timer", busicom_state, timer_callback, attotime::from_msec(28*2)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( busicom ) + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "busicom.l01", 0x0000, 0x0100, CRC(51ae2513) SHA1(5cb4097a3945db35af4ed64b629b20b08fc9824f)) + ROM_LOAD( "busicom.l02", 0x0100, 0x0100, CRC(a05411ad) SHA1(81503a99a0d34fa29bf1245de0a44af2f174abdd)) + ROM_LOAD( "busicom.l05", 0x0200, 0x0100, CRC(6120addf) SHA1(4b7ec183613630120b3c313c782122713d4327c5)) + ROM_LOAD( "busicom.l07", 0x0300, 0x0100, CRC(84a90daa) SHA1(e2931753b0fd35144cb5a9d73fcae8e104e5e3ed)) + ROM_LOAD( "busicom.l11", 0x0400, 0x0100, CRC(4d2b2942) SHA1(9a59db76eff084369797735ec19da8cbc70d0d39)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1974, busicom, 0, 0, busicom, busicom, driver_device, 0, "Business Computer Corporation", "Busicom 141-PF", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/bw12.c b/src/mame/drivers/bw12.c new file mode 100644 index 00000000000..6d880bcd38e --- /dev/null +++ b/src/mame/drivers/bw12.c @@ -0,0 +1,670 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Bondwell 12/14 + + 12/05/2009 Skeleton driver. + + - Z80A CPU 4MHz + - 64KB RAM (BW 12), 128KB RAM (BW 14) + - 4KB ROM System + - UPD765A Floppy controller + - 2 x 5.25" Floppy drives 48 tpi SSDD (BW 12), DSDD (BW 14) + - MC6845 Video controller + - 2KB RAM Video buffer + - 4KB ROM Character set + - Z80SIO Serial interface + - MC6821 Parallel interface + - I8253 Counter-timer + - MC1408 8-bit DAC sound + - KB3600 PRO (AY-5-3600 PRO) Keyboard controller + + http://www.eld.leidenuniv.nl/~moene/Home/sitemap/ + http://www.baltissen.org/newhtm/schemas.htm + +****************************************************************************/ + +#include "includes/bw12.h" +#include "bus/rs232/rs232.h" + +/* + + TODO: + + - floppy motor off timer + +*/ + +void bw12_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + switch (m_bank) + { + case 0: /* ROM */ + program.install_read_bank(0x0000, 0x7fff, "bank1"); + program.unmap_write(0x0000, 0x7fff); + break; + + case 1: /* BK0 */ + program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); + break; + + case 2: /* BK1 */ + case 3: /* BK2 */ + if (m_ram->size() > 64*1024) + { + program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); + } + else + { + program.unmap_readwrite(0x0000, 0x7fff); + } + break; + } + + membank("bank1")->set_entry(m_bank); +} + +void bw12_state::floppy_motor_off() +{ + m_floppy0->mon_w(1); + m_floppy1->mon_w(1); + + m_motor_on = 0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(bw12_state::floppy_motor_off_tick) +{ + floppy_motor_off(); +} + +void bw12_state::set_floppy_motor_off_timer() +{ + if (m_motor0 || m_motor1) + { + m_motor_on = 1; + m_floppy_timer->enable(false); + } + else + { + /* trigger floppy motor off NE556 timer */ + /* + + R18 = RES_K(100) + C11 = CAP_U(4.7) + + */ + + //m_floppy_timer->adjust(attotime::zero); + floppy_motor_off(); + } +} + +void bw12_state::ls259_w(int address, int data) +{ + switch (address) + { + case 0: /* LS138 A0 */ + m_bank = (m_bank & 0x02) | data; + bankswitch(); + break; + + case 1: /* LS138 A1 */ + m_bank = (data << 1) | (m_bank & 0x01); + bankswitch(); + break; + + case 2: /* not connected */ + break; + + case 3: /* _INIT */ + break; + + case 4: /* CAP LOCK */ + output_set_led_value(0, data); + break; + + case 5: /* MOTOR 0 */ + m_motor0 = data; + break; + + case 6: /* MOTOR 1 */ + m_motor1 = data; + break; + + case 7: /* FDC TC */ + m_fdc->tc_w(data); + break; + } + + m_motor_on = m_motor0 || m_motor1; + + m_floppy0->mon_w(!m_motor_on); + m_floppy1->mon_w(!m_motor_on); +} + +WRITE8_MEMBER( bw12_state::ls259_w ) +{ + int d = BIT(offset, 0); + int a = (offset >> 1) & 0x07; + + ls259_w(a, d); +} + +READ8_MEMBER( bw12_state::ls259_r ) +{ + ls259_w(space, offset, 0); + + return 0; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( bw12_mem, AS_PROGRAM, 8, bw12_state ) + AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bw12_io, AS_IO, 8, bw12_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x0f) AM_READWRITE(ls259_r, ls259_w) + AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) + AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r, register_w) + AM_RANGE(0x20, 0x21) AM_MIRROR(0x0e) AM_DEVICE(UPD765_TAG, upd765a_device, map) + AM_RANGE(0x30, 0x33) AM_MIRROR(0x0c) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write) + AM_RANGE(0x40, 0x43) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_DEVWRITE(MC1408_TAG, dac_device, write_unsigned8) + AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREADWRITE(PIT8253_TAG, pit8253_device, read, write) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( bw12 ) + /* + + KB3600 PRO2 Keyboard matrix + + | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | + | | | | | | | | | | | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X0 | 7 | 8 | 9 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X1 | U | I | O | P | Q | W | E | R | T | Y | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X2 | F15 | F16 | RET | N. | SP | LOCK| F11 | F12 | F13 | F14 | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X3 | F7 | F8 | F9 | F10 | F1 | F2 | F3 | F4 | F5 | F6 | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X4 | LEFT|RIGHT| N3 | BS | @ | | - | ] | UP | DOWN| + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X5 | N9 | CL | N2 | LF | DEL | HT |ARROW| [ | N7 | N8 | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X6 | M | , | . | / | Z | X | C | V | B | N | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X7 | J | K | L | ; | A | S | D | F | G | H | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + X8 | N6 | - | N1 | N0 | ESC | | : | NRET| N4 | N5 | + ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + + */ + + PORT_START("X0") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('|') + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + + PORT_START("X1") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + + PORT_START("X2") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F15") + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F16") + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13") + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F14") + + PORT_START("X3") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("X4") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') PORT_CHAR('\\') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("X5") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CL") + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LF") + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HT") + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) + + PORT_START("X6") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("X7") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + + PORT_START("X8") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad RET") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + + PORT_START("MODIFIERS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) +INPUT_PORTS_END + +/* Video */ + +MC6845_UPDATE_ROW( bw12_state::crtc_update_row ) +{ + const pen_t *pen = m_palette->pens(); + int column, bit; + + for (column = 0; column < x_count; column++) + { + UINT8 code = m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; + UINT16 addr = code << 4 | (ra & 0x0f); + UINT8 data = m_char_rom->base()[addr & BW12_CHARROM_MASK]; + + if (column == cursor_x) + { + data = 0xff; + } + + for (bit = 0; bit < 8; bit++) + { + int x = (column * 8) + bit; + int color = BIT(data, 7) && de; + + bitmap.pix32(vbp + y, hbp + x) = pen[color]; + + data <<= 1; + } + } +} + + +/* PIA6821 Interface */ + +WRITE_LINE_MEMBER( bw12_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( bw12_state::write_centronics_fault ) +{ + m_centronics_fault = state; +} + +WRITE_LINE_MEMBER( bw12_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +READ8_MEMBER( bw12_state::pia_pa_r ) +{ + /* + + bit description + + PA0 Input from Centronics BUSY status + PA1 Input from Centronics ERROR status + PA2 Input from Centronics PAPER OUT status + PA3 Input from FDC MOTOR + PA4 Input from PIT OUT2 + PA5 Input from keyboard strobe + PA6 Input from keyboard serial data + PA7 Input from FDC interrupt + + */ + + UINT8 data = 0; + + data |= m_centronics_busy; + data |= (m_centronics_fault << 1); + data |= (m_centronics_perror << 2); + data |= (m_motor_on << 3); + data |= (m_pit_out2 << 4); + data |= (m_key_stb << 5); + data |= (m_key_sin << 6); + data |= (m_fdc->get_irq() ? 1 : 0) << 7; + + return data; +} + +WRITE_LINE_MEMBER( bw12_state::pia_cb2_w ) +{ + if (state) + { + /* keyboard shift clock */ + m_key_shift++; + + if (m_key_shift < 10) + { + m_key_sin = m_key_data[m_key_shift]; + } + } +} + +/* PIT8253 Interface */ + +WRITE_LINE_MEMBER( bw12_state::pit_out0_w ) +{ + m_sio->txca_w(state); + m_sio->rxca_w(state); +} + +WRITE_LINE_MEMBER( bw12_state::pit_out2_w ) +{ + m_pit_out2 = state; +} + +/* AY-5-3600-PRO-002 Interface */ + +READ_LINE_MEMBER( bw12_state::ay3600_shift_r ) +{ + return BIT(m_modifiers->read(), 0); +} + +READ_LINE_MEMBER( bw12_state::ay3600_control_r ) +{ + return BIT(m_modifiers->read(), 1); +} + +WRITE_LINE_MEMBER( bw12_state::ay3600_data_ready_w ) +{ + m_key_stb = state; + + m_pia->cb1_w(state); + + if (state) + { + UINT16 data = m_kbc->b_r(); + + m_key_data[0] = BIT(data, 6); + m_key_data[1] = BIT(data, 3); + m_key_data[2] = BIT(data, 1); + m_key_data[3] = BIT(data, 0); + m_key_data[4] = BIT(data, 2); + m_key_data[5] = BIT(data, 4); + m_key_data[6] = BIT(data, 5); + m_key_data[7] = BIT(data, 7); + m_key_data[8] = BIT(data, 8); + + m_key_shift = 0; + m_key_sin = m_key_data[m_key_shift]; + } +} + +/* Machine Initialization */ + +void bw12_state::machine_start() +{ + /* setup memory banking */ + membank("bank1")->configure_entry(0, m_rom->base()); + membank("bank1")->configure_entry(1, m_ram->pointer()); + membank("bank1")->configure_entries(2, 2, m_ram->pointer() + 0x10000, 0x8000); + + /* register for state saving */ + save_item(NAME(m_bank)); + save_item(NAME(m_pit_out2)); + save_item(NAME(m_key_data)); + save_item(NAME(m_key_sin)); + save_item(NAME(m_key_stb)); + save_item(NAME(m_key_shift)); + save_item(NAME(m_motor_on)); + save_item(NAME(m_motor0)); + save_item(NAME(m_motor1)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_fault)); + save_item(NAME(m_centronics_perror)); + machine().save().register_postload(save_prepost_delegate(FUNC(bw12_state::bankswitch), this)); +} + +void bw12_state::machine_reset() +{ + for (int i = 0; i < 8; i++) + { + ls259_w(i, 0); + } +} + +static SLOT_INTERFACE_START( bw12_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_SSDD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( bw12_state::bw12_floppy_formats ) + FLOPPY_BW12_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( bw14_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( bw12_state::bw14_floppy_formats ) + FLOPPY_BW12_FORMAT +FLOPPY_FORMATS_END + + +/* F4 Character Displayer */ +static const gfx_layout bw12_charlayout = +{ + 8, 9, /* 8 x 9 characters */ + 256, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( bw12 ) + GFXDECODE_ENTRY( "chargen", 0x0000, bw12_charlayout, 0, 1 ) +GFXDECODE_END + + +/* Machine Driver */ +static MACHINE_CONFIG_START( common, bw12_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) + MCFG_CPU_PROGRAM_MAP(bw12_mem) + MCFG_CPU_IO_MAP(bw12_io) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", bw12) + MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/8) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(bw12_state, crtc_update_row) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD(MC1408_TAG, DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_TIMER_DRIVER_ADD(FLOPPY_TIMER_TAG, bw12_state, floppy_motor_off_tick) + MCFG_UPD765A_ADD(UPD765_TAG, false, true) + + MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(bw12_state, pia_pa_r)) + MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_PIA_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) + MCFG_PIA_CB2_HANDLER(WRITELINE(bw12_state, pia_cb2_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE(Z80_TAG, z80_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE(Z80_TAG, z80_device, irq_line)) + + MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_16MHz/4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(PIT8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_1_8432MHz) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(bw12_state, pit_out0_w)) + MCFG_PIT8253_CLK1(XTAL_1_8432MHz) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + MCFG_PIT8253_CLK2(XTAL_1_8432MHz) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(bw12_state, pit_out2_w)) + + MCFG_DEVICE_ADD(AY3600PRO002_TAG, AY3600, 0) + MCFG_AY3600_MATRIX_X0(IOPORT("X0")) + MCFG_AY3600_MATRIX_X1(IOPORT("X1")) + MCFG_AY3600_MATRIX_X2(IOPORT("X2")) + MCFG_AY3600_MATRIX_X3(IOPORT("X3")) + MCFG_AY3600_MATRIX_X4(IOPORT("X4")) + MCFG_AY3600_MATRIX_X5(IOPORT("X5")) + MCFG_AY3600_MATRIX_X6(IOPORT("X6")) + MCFG_AY3600_MATRIX_X7(IOPORT("X7")) + MCFG_AY3600_MATRIX_X8(IOPORT("X8")) + MCFG_AY3600_SHIFT_CB(READLINE(bw12_state, ay3600_shift_r)) + MCFG_AY3600_CONTROL_CB(READLINE(bw12_state, ay3600_control_r)) + MCFG_AY3600_DATA_READY_CB(WRITELINE(bw12_state, ay3600_data_ready_w)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcdb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsb_w)) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(PIA6821_TAG, pia6821_device, ca1_w)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(bw12_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(bw12_state, write_centronics_fault)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(bw12_state, write_centronics_perror)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bw12, common ) + /* floppy drives */ + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", bw12_floppies, "525dd", bw12_state::bw12_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", bw12_floppies, "525dd", bw12_state::bw12_floppy_formats) + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "bw12") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( bw14, common ) + /* floppy drives */ + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", bw14_floppies, "525dd", bw12_state::bw14_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", bw14_floppies, "525dd", bw12_state::bw14_floppy_formats) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( bw12 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "bw14boot.ic41", 0x0000, 0x1000, CRC(782fe341) SHA1(eefe5ad6b1ef77a1caf0af743b74de5fa1c4c19d) ) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "bw14char.ic1", 0x0000, 0x1000, CRC(f9dd68b5) SHA1(50132b759a6d84c22c387c39c0f57535cd380411) ) +ROM_END + +#define rom_bw14 rom_bw12 + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, bw12, 0, 0, bw12, bw12, driver_device, 0, "Bondwell Holding", "Bondwell 12", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, bw14, bw12, 0, bw14, bw12, driver_device, 0, "Bondwell Holding", "Bondwell 14", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/bw2.c b/src/mame/drivers/bw2.c new file mode 100644 index 00000000000..546abec3575 --- /dev/null +++ b/src/mame/drivers/bw2.c @@ -0,0 +1,678 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + drivers/bw2.c + + Bondwell BW 2 + + - Z80L CPU 4MHz + - 64KB RAM, expandable to 224KB RAM. + - 4KB System ROM + - MSM6255 LCD controller, 640x200 pixels + - 16KB Video RAM + - TMS2797 FDC controller + - 8251 USART serial interface + - 8253 PIT timer + - 8255 PPI + + http://www.thebattles.net/bondwell/ + + http://www.vintage-computer.com/bondwell2.shtml + + http://www2.okisemi.com/site/productscatalog/displaydrivers/availabledocuments/Intro-7090.html + +***************************************************************************/ + +#include "includes/bw2.h" +#include "bus/rs232/rs232.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +enum +{ + RAM1 = 0, + VRAM, + RAM2, + RAM3, + RAM4, + RAM5, + RAM6, + ROM +}; + +#define HAS_KB_OF_RAM(_kb) \ + (m_ram->size() >= (_kb * 1024)) + + +//************************************************************************** +// ADDRESS DECODING +//************************************************************************** + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( bw2_state::read ) +{ + int rom = 1, vram = 1, ram1 = 1, ram2 = 1, ram3 = 1, ram4 = 1, ram5 = 1, ram6 = 1; + + UINT8 data = 0xff; + + switch (m_bank) + { + case RAM1: ram1 = 0; break; + case VRAM: vram = 0; break; + case RAM2: ram2 = 0; break; + case RAM3: ram3 = 0; break; + case RAM4: ram4 = 0; break; + case RAM5: ram5 = 0; break; + case RAM6: ram6 = 0; break; + case ROM: rom = 0; break; + } + + if (offset < 0x8000) + { + if (!rom) + { + data = m_rom->base()[offset & 0x3fff]; + } + + if (!vram) + { + data = m_video_ram[offset & 0x3fff]; + } + + if (!ram1) + { + data = m_ram->pointer()[offset]; + } + + if (!ram2 && HAS_KB_OF_RAM(96)) + { + data = m_ram->pointer()[0x10000 | offset]; + } + + if (!ram3 && HAS_KB_OF_RAM(128)) + { + data = m_ram->pointer()[0x18000 | offset]; + } + + if (!ram4 && HAS_KB_OF_RAM(160)) + { + data = m_ram->pointer()[0x20000 | offset]; + } + + if (!ram5 && HAS_KB_OF_RAM(192)) + { + data = m_ram->pointer()[0x28000 | offset]; + } + + if (!ram6 && HAS_KB_OF_RAM(224)) + { + data = m_ram->pointer()[0x30000 | offset]; + } + } + else + { + data = m_ram->pointer()[offset]; + } + + return m_exp->cd_r(space, offset, data, ram2, ram3, ram4, ram5, ram6); +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( bw2_state::write ) +{ + int vram = 1, ram1 = 1, ram2 = 1, ram3 = 1, ram4 = 1, ram5 = 1, ram6 = 1; + + switch (m_bank) + { + case RAM1: ram1 = 0; break; + case VRAM: vram = 0; break; + case RAM2: ram2 = 0; break; + case RAM3: ram3 = 0; break; + case RAM4: ram4 = 0; break; + case RAM5: ram5 = 0; break; + case RAM6: ram6 = 0; break; + } + + if (offset < 0x8000) + { + if (!vram) + { + m_video_ram[offset & 0x3fff] = data; + } + + if (!ram1) + { + m_ram->pointer()[offset] = data; + } + + if (!ram2 && HAS_KB_OF_RAM(96)) + { + m_ram->pointer()[0x10000 | offset] = data; + } + + if (!ram3 && HAS_KB_OF_RAM(128)) + { + m_ram->pointer()[0x18000 | offset] = data; + } + + if (!ram4 && HAS_KB_OF_RAM(160)) + { + m_ram->pointer()[0x20000 | offset] = data; + } + + if (!ram5 && HAS_KB_OF_RAM(192)) + { + m_ram->pointer()[0x28000 | offset] = data; + } + + if (!ram6 && HAS_KB_OF_RAM(224)) + { + m_ram->pointer()[0x30000 | offset] = data; + } + } + else + { + m_ram->pointer()[offset] = data; + } + + m_exp->cd_w(space, offset, data, ram2, ram3, ram4, ram5, ram6); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( bw2_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( bw2_mem, AS_PROGRAM, 8, bw2_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( bw2_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( bw2_io, AS_IO, 8, bw2_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(I8253_TAG, pit8253_device, read, write) + AM_RANGE(0x20, 0x21) AM_DEVICE(MSM6255_TAG, msm6255_device, map) + AM_RANGE(0x30, 0x3f) AM_DEVREADWRITE(BW2_EXPANSION_SLOT_TAG, bw2_expansion_slot_device, slot_r, slot_w) + AM_RANGE(0x40, 0x40) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x41, 0x41) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x50, 0x50) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x60, 0x63) AM_DEVREADWRITE(WD2797_TAG, wd2797_t, read, write) + AM_RANGE(0x70, 0x7f) AM_DEVREADWRITE(BW2_EXPANSION_SLOT_TAG, bw2_expansion_slot_device, modsel_r, modsel_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( lcdc_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( lcdc_map, AS_0, 8, bw2_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( bw2 ) +//------------------------------------------------- + +/* + Keyboard matrix + X0 X1 X2 X3 X4 X5 X6 X7 + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y9 |CAPS | | | | | | | | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y8 |SHIFT| |SPACE| Z | A | Q | 2 " | F1 | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y7 |CTRL | - = | \ | | X | S | W | 3 # | F2 | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y6 | @ ` | P | UP | C | D | E | 4 $ | F3 | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y5 | 1 ! | | | V | F | R | 5 % | F4 | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y4 | ESC | | | B | G | T | 6 & | F5 | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y3 | TAB | : * |ENTER| N | H | Y | 7 ' | F6 | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y2 |DOWN | ^ ~ | [ { | M | J | U | 8 ( | F7 | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y1 |RIGHT| ; + | ] } | , < | K | I | 9 ) | F8 | + +-----+-----+-----+-----+-----+-----+-----+-----+ + Y0 |LEFT | BS | / ? | . > | L | O | 0 _ | DEL | + +-----+-----+-----+-----+-----+-----+-----+-----+ +*/ + +static INPUT_PORTS_START( bw2 ) + PORT_START("Y0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + + PORT_START("Y1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + + PORT_START("Y2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("Y3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("Y4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("Y5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("Y6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("Y7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("Y8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("Y9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("BAUD") + PORT_CONFNAME( 0x05, 0x05, "Baud rate") + PORT_CONFSETTING( 0x00, "9600 baud" ) + PORT_CONFSETTING( 0x01, "4800 baud" ) + PORT_CONFSETTING( 0x02, "2400 baud" ) + PORT_CONFSETTING( 0x03, "1200 baud" ) + PORT_CONFSETTING( 0x04, "600 baud" ) + PORT_CONFSETTING( 0x05, "300 baud" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +WRITE_LINE_MEMBER( bw2_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +//------------------------------------------------- +// I8255A interface +//------------------------------------------------- + +WRITE8_MEMBER( bw2_state::ppi_pa_w ) +{ + /* + + PA0 KB0 Keyboard line select 0 + PA1 KB1 Keyboard line select 1 + PA2 KB2 Keyboard line select 2 + PA3 KB3 Keyboard line select 3 + PA4 /DS0 Drive select 0 + PA5 /DS1 Drive select 1 + PA6 Select RS232 connector + PA7 /STROBE to centronics printer + + */ + + // keyboard + m_kb = data & 0x0f; + + // drive select + m_floppy = NULL; + if (BIT(data, 4)) m_floppy = m_floppy0->get_device(); + if (BIT(data, 5)) m_floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(m_floppy); + if (m_floppy) m_floppy->mon_w(m_mtron); + + // centronics strobe + m_centronics->write_strobe(BIT(data, 7)); +} + +READ8_MEMBER( bw2_state::ppi_pb_r ) +{ + /* + + PB0 Keyboard column status of selected line + PB1 Keyboard column status of selected line + PB2 Keyboard column status of selected line + PB3 Keyboard column status of selected line + PB4 Keyboard column status of selected line + PB5 Keyboard column status of selected line + PB6 Keyboard column status of selected line + PB7 Keyboard column status of selected line + + */ + + UINT8 data = 0xff; + + switch (m_kb) + { + case 0: data = m_y0->read(); break; + case 1: data = m_y1->read(); break; + case 2: data = m_y2->read(); break; + case 3: data = m_y3->read(); break; + case 4: data = m_y4->read(); break; + case 5: data = m_y5->read(); break; + case 6: data = m_y6->read(); break; + case 7: data = m_y7->read(); break; + case 8: data = m_y8->read(); break; + case 9: data = m_y9->read(); break; + } + + return data; +} + +WRITE8_MEMBER( bw2_state::ppi_pc_w ) +{ + /* + + PC0 Memory bank select + PC1 Memory bank select + PC2 Memory bank select + PC3 Not connected + + */ + + m_bank = data & 0x07; +} + +READ8_MEMBER( bw2_state::ppi_pc_r ) +{ + /* + + PC4 BUSY from centronics printer + PC5 M/FDBK motor feedback + PC6 RLSD Carrier detect from RS232 + PC7 /PROT Write protected disk + + */ + + UINT8 data = 0; + + // centronics busy + data |= m_centronics_busy << 4; + + // floppy motor + data |= m_mfdbk << 5; + + // write protect + if (m_floppy) data |= m_floppy->wpt_r() << 7; + + return data; +} + +//------------------------------------------------- +// pit8253_config pit_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( bw2_state::pit_out0_w ) +{ + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + +WRITE_LINE_MEMBER( bw2_state::mtron_w ) +{ + m_mtron = state; + m_mfdbk = !state; + + if (m_floppy) m_floppy->mon_w(m_mtron); +} + +//------------------------------------------------- +// floppy_format_type floppy_formats +//------------------------------------------------- + +WRITE_LINE_MEMBER( bw2_state::fdc_drq_w ) +{ + if (state) + { + if (m_maincpu->state_int(Z80_HALT)) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, HOLD_LINE); + } + } + else + { + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + } +} + +FLOPPY_FORMATS_MEMBER( bw2_state::floppy_formats ) + FLOPPY_BW2_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( bw2_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) // Teac FD-35 +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + + +PALETTE_INIT_MEMBER(bw2_state, bw2) +{ + palette.set_pen_color(0, 0xa5, 0xad, 0xa5); + palette.set_pen_color(1, 0x31, 0x39, 0x10); +} + + +//------------------------------------------------- +// MACHINE_START( bw2 ) +//------------------------------------------------- + +void bw2_state::machine_start() +{ + // register for state saving + save_item(NAME(m_kb)); + save_item(NAME(m_bank)); + save_item(NAME(m_mtron)); + save_item(NAME(m_mfdbk)); + save_item(NAME(m_centronics_busy)); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( bw2 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( bw2, bw2_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) + MCFG_CPU_PROGRAM_MAP(bw2_mem) + MCFG_CPU_IO_MAP(bw2_io) + + // video hardware + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DEVICE( MSM6255_TAG, msm6255_device, screen_update ) + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(bw2_state, bw2) + + // devices + MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_16MHz/4) // 8251 USART TXC, RXC + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(bw2_state, pit_out0_w)) + MCFG_PIT8253_CLK1(11000) // LCD controller + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE(I8253_TAG, pit8253_device, write_clk2)) + MCFG_PIT8253_CLK2(0) // Floppy /MTRON + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(bw2_state, mtron_w)) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(bw2_state, ppi_pa_w)) + MCFG_I8255_IN_PORTB_CB(READ8(bw2_state, ppi_pb_r)) + MCFG_I8255_IN_PORTC_CB(READ8(bw2_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(bw2_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(MSM6255_TAG, MSM6255, XTAL_16MHz) + MCFG_DEVICE_ADDRESS_MAP(AS_0, lcdc_map) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(bw2_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) + + MCFG_WD2797_ADD(WD2797_TAG, XTAL_16MHz/16) + MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bw2_state, fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG":0", bw2_floppies, "35dd", bw2_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG":1", bw2_floppies, NULL, bw2_state::floppy_formats) + MCFG_BW2_EXPANSION_SLOT_ADD(BW2_EXPANSION_SLOT_TAG, XTAL_16MHz, bw2_expansion_cards, NULL) + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list","bw2") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("96K,128K,160K,192K,224K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( bw2 ) +//------------------------------------------------- + +ROM_START( bw2 ) + ROM_REGION( 0x1000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "v20" ) + ROM_SYSTEM_BIOS( 0, "v12", "BW 2 v1.2" ) + ROMX_LOAD( "bw2-12.ic8", 0x0000, 0x1000, CRC(0ab42d10) SHA1(430b232631eee9b715151b8d191b7eb9449ac513), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v20", "BW 2 v2.0" ) + ROMX_LOAD( "bw2-20.ic8", 0x0000, 0x1000, CRC(86f36471) SHA1(a3e2ba4edd50ff8424bb0675bdbb3b9f13c04c9d), ROM_BIOS(2) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1985, bw2, 0, 0, bw2, bw2, driver_device, 0, "Bondwell Holding", "Bondwell Model 2", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/c10.c b/src/mame/drivers/c10.c new file mode 100644 index 00000000000..e1b0bc221a4 --- /dev/null +++ b/src/mame/drivers/c10.c @@ -0,0 +1,191 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Cromemco C-10 Personal Computer + + 30/08/2010 Skeleton driver + + Driver currently gets to a loop where it waits for an interrupt. + The interrupt routine presumably writes to FE69 which the loop is + constantly looking at. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + + +class c10_state : public driver_device +{ +public: + enum + { + TIMER_RESET + }; + + c10_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_p_videoram(*this, "p_videoram"){ } + + required_device m_maincpu; + const UINT8 *m_p_chargen; + required_shared_ptr m_p_videoram; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_DRIVER_INIT(c10); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + + +static ADDRESS_MAP_START(c10_mem, AS_PROGRAM, 8, c10_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot") + AM_RANGE(0x1000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xf0a1) AM_RAM + AM_RANGE(0xf0a2, 0xffff) AM_RAM AM_SHARE("p_videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c10_io, AS_IO, 8, c10_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( c10 ) +INPUT_PORTS_END + +void c10_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_RESET: + /* after the first 4 bytes have been read from ROM, switch the ram back in */ + membank("boot")->set_entry(0); + break; + default: + assert_always(FALSE, "Unknown id in c10_state::device_timer"); + } +} + +void c10_state::machine_reset() +{ + membank("boot")->set_entry(1); + timer_set(attotime::from_usec(4), TIMER_RESET); +} + +void c10_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +/* This system appears to have inline attribute bytes of unknown meaning. + Currently they are ignored. The word at FAB5 looks like it might be cursor location. */ +UINT32 c10_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + //static UINT8 framecnt=0; + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x,xx; + + //framecnt++; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + xx = ma; + for (x = ma; x < ma + 80; x++) + { + gfx = 0; + if (ra < 9) + { + chr = m_p_videoram[xx++]; + + // /* Take care of flashing characters */ + // if ((chr < 0x80) && (framecnt & 0x08)) + // chr |= 0x80; + + if BIT(chr, 7) // ignore attribute bytes + x--; + else + gfx = m_p_chargen[(chr<<4) | ra ]; + } + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=96; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout c10_charlayout = +{ + 8, 9, /* 8 x 9 characters */ + 512, /* 512 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( c10 ) + GFXDECODE_ENTRY( "chargen", 0x0000, c10_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( c10, c10_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(c10_mem) + MCFG_CPU_IO_MAP(c10_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(c10_state, screen_update) + MCFG_SCREEN_SIZE(640, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) + MCFG_SCREEN_PALETTE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", c10) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER(c10_state,c10) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x8000); +} + +/* ROM definition */ +ROM_START( c10 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "c10_cros.bin", 0x8000, 0x4000, CRC(2ccf5983) SHA1(52f7c497f5284bf5df9eb0d6e9142bb1869d8c24)) + + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, c10, 0, 0, c10, c10, c10_state, c10, "Cromemco", "C-10", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/c128.c b/src/mame/drivers/c128.c new file mode 100644 index 00000000000..abe3f7bde8b --- /dev/null +++ b/src/mame/drivers/c128.c @@ -0,0 +1,1977 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + TODO: + + - connect CAPS LOCK to charom A12 on international variants + +*/ + +#include "includes/c128.h" +#include "bus/cbmiec/c1571.h" +#include "bus/cbmiec/c1581.h" +#include "cpu/z80/z80.h" +#include "machine/cbm_snqk.h" +#include "sound/dac.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + +#define A15 BIT(offset, 15) +#define A14 BIT(offset, 14) +#define A13 BIT(offset, 13) +#define A12 BIT(offset, 12) +#define A11 BIT(offset, 11) +#define A10 BIT(offset, 10) +#define VMA5 BIT(vma, 13) +#define VMA4 BIT(vma, 12) + +enum +{ + PLA_OUT_SDEN = 0, + PLA_OUT_ROM4 = 1, + PLA_OUT_ROM2 = 2, + PLA_OUT_DIR = 3, + PLA_OUT_ROML = 4, + PLA_OUT_ROMH = 5, + PLA_OUT_CLRBANK = 6, + PLA_OUT_FROM1 = 7, + PLA_OUT_ROM3 = 8, + PLA_OUT_ROM1 = 9, + PLA_OUT_IOCS = 10, + PLA_OUT_DWE = 11, + PLA_OUT_CASENB = 12, + PLA_OUT_VIC = 13, + PLA_OUT_IOACC = 14, + PLA_OUT_GWE = 15, + PLA_OUT_COLORRAM = 16, + PLA_OUT_CHAROM = 17 +}; + + +QUICKLOAD_LOAD_MEMBER( c128_state, cbm_c64 ) +{ + return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress); +} + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// check_interrupts - +//------------------------------------------------- + +inline void c128_state::check_interrupts() +{ + int irq = m_cia1_irq || m_vic_irq || m_exp_irq; + int nmi = m_cia2_irq || !m_restore || m_exp_nmi; + //int aec = m_exp_dma && m_z80_busack; + //int rdy = m_vic_aec && m_z80en && m_vic_ba; + //int busreq = !m_z80en || !(m_z80_busack && !aec) + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, irq); + + m_subcpu->set_input_line(M8502_IRQ_LINE, irq); + m_subcpu->set_input_line(M8502_NMI_LINE, nmi); +} + + + +//************************************************************************** +// ADDRESS DECODING +//************************************************************************** + +//------------------------------------------------- +// read_pla - +//------------------------------------------------- + +int c128_state::read_pla(offs_t offset, offs_t ca, offs_t vma, int ba, int rw, int aec, int z80io, int ms3, int ms2, int ms1, int ms0) +{ + int _128_256 = 1; + int dmaack = 1; + int vicfix = 1; + int sphi2 = m_vic->phi0_r(); + + m_game = m_exp->game_r(ca, sphi2, ba, rw, m_hiram); + m_exrom = m_exp->exrom_r(ca, sphi2, ba, rw, m_hiram); + + UINT32 input = sphi2 << 26 | m_va14 << 25 | m_charen << 24 | + m_hiram << 23 | m_loram << 22 | ba << 21 | VMA5 << 20 | VMA4 << 19 | ms0 << 18 | ms1 << 17 | ms2 << 16 | + m_exrom << 15 | m_game << 14 | rw << 13 | aec << 12 | A10 << 11 | A11 << 10 | A12 << 9 | A13 << 8 | + A14 << 7 | A15 << 6 | z80io << 5 | m_z80en << 4 | ms3 << 3 | vicfix << 2 | dmaack << 1 | _128_256; + + return m_pla->read(input); +} + + +//------------------------------------------------- +// read_memory - +//------------------------------------------------- + +UINT8 c128_state::read_memory(address_space &space, offs_t offset, offs_t vma, int ba, int aec, int z80io) +{ + int rw = 1, ms0 = 1, ms1 = 1, ms2 = 1, ms3 = 1, cas0 = 1, cas1 = 1; + int io1 = 1, io2 = 1; + int sphi2 = m_vic->phi0_r(); + + UINT8 data = 0xff; + + offs_t ta = m_mmu->ta_r(offset, aec, &ms0, &ms1, &ms2, &ms3, &cas0, &cas1); + offs_t ma = 0; + offs_t sa = 0; + + if (aec) + { + data = m_vic->bus_r(); + ma = ta | (offset & 0xff); + sa = offset & 0xff; + } + else + { + ta &= ~0xf00; + ta |= (vma & 0xf00); + ma = (!m_va15 << 15) | (!m_va14 << 14) | vma; + sa = vma & 0xff; + } + + offs_t ca = ta | sa; + + int plaout = read_pla(offset, ca, vma, ba, rw, aec, z80io, ms3, ms2, ms1, ms0); + + m_clrbank = BIT(plaout, PLA_OUT_CLRBANK); + + if (!BIT(plaout, PLA_OUT_CASENB)) + { + if (!cas0) + { + data = m_ram->pointer()[ma]; + } + if (!cas1) + { + data = m_ram->pointer()[0x10000 | ma]; + } + } + if (!BIT(plaout, PLA_OUT_ROM1)) + { + // CR: data = m_rom1[(ms3 << 14) | ((BIT(ta, 14) && BIT(offset, 13)) << 13) | (ta & 0x1000) | (offset & 0xfff)]; + data = m_rom->base()[((BIT(ta, 14) && BIT(offset, 13)) << 13) | (ta & 0x1000) | (offset & 0xfff)]; + } + if (!BIT(plaout, PLA_OUT_ROM2)) + { + data = m_rom->base()[0x4000 | (offset & 0x3fff)]; + } + if (!BIT(plaout, PLA_OUT_ROM3)) + { + // CR: data = m_rom3[(BIT(offset, 15) << 14) | (offset & 0x3fff)]; + data = m_rom->base()[0x8000 | (offset & 0x3fff)]; + } + if (!BIT(plaout, PLA_OUT_ROM4)) + { + data = m_rom->base()[0xc000 | (ta & 0x1000) | (offset & 0x2fff)]; + } + if (!BIT(plaout, PLA_OUT_CHAROM)) + { + data = m_charom->base()[(ms3 << 12) | (ta & 0xf00) | sa]; + } + if (!BIT(plaout, PLA_OUT_COLORRAM) && aec) + { + data = m_color_ram[(m_clrbank << 10) | (ta & 0x300) | sa] & 0x0f; + } + if (!BIT(plaout, PLA_OUT_VIC)) + { + data = m_vic->read(space, offset & 0x3f); + } + if (!BIT(plaout, PLA_OUT_FROM1) && m_from->exists()) + { + data = m_from->read_rom(space, offset & 0x7fff); + } + if (!BIT(plaout, PLA_OUT_IOCS) && BIT(offset, 10)) + { + switch ((BIT(offset, 11) << 2) | ((offset >> 8) & 0x03)) + { + case 0: // SID + data = m_sid->read(space, offset & 0x1f); + break; + + case 2: // CS8563 + if BIT(offset, 0) + { + data = m_vdc->register_r(space, 0); + } + else + { + data = m_vdc->status_r(space, 0); + } + break; + + case 4: // CIA1 + data = m_cia1->read(space, offset & 0x0f); + break; + + case 5: // CIA2 + data = m_cia2->read(space, offset & 0x0f); + break; + + case 6: // I/O1 + io1 = 0; + break; + + case 7: // I/O2 + io2 = 0; + break; + } + } + + int roml = BIT(plaout, PLA_OUT_ROML); + int romh = BIT(plaout, PLA_OUT_ROMH); + + data = m_exp->cd_r(space, ca, data, sphi2, ba, roml, romh, io1, io2); + + return m_mmu->read(offset, data); +} + + +//------------------------------------------------- +// write_memory - +//------------------------------------------------- + +void c128_state::write_memory(address_space &space, offs_t offset, offs_t vma, UINT8 data, int ba, int aec, int z80io) +{ + int rw = 0, ms0 = 1, ms1 = 1, ms2 = 1, ms3 = 1, cas0 = 1, cas1 = 1; + int io1 = 1, io2 = 1; + int sphi2 = m_vic->phi0_r(); + + offs_t ta = m_mmu->ta_r(offset, aec, &ms0, &ms1, &ms2, &ms3, &cas0, &cas1); + offs_t ca = ta | (offset & 0xff); + offs_t ma = ta | (offset & 0xff); + offs_t sa = offset & 0xff; + + int plaout = read_pla(offset, ca, vma, ba, rw, aec, z80io, ms3, ms2, ms1, ms0); + + m_clrbank = BIT(plaout, PLA_OUT_CLRBANK); + + if (!BIT(plaout, PLA_OUT_CASENB) && !BIT(plaout, PLA_OUT_DWE)) + { + if (!cas0) + { + m_ram->pointer()[ma] = data; + } + if (!cas1) + { + m_ram->pointer()[0x10000 | ma] = data; + } + } + if (!BIT(plaout, PLA_OUT_COLORRAM) && !BIT(plaout, PLA_OUT_GWE)) + { + m_color_ram[(m_clrbank << 10) | (ta & 0x300) | sa] = data & 0x0f; + } + if (!BIT(plaout, PLA_OUT_VIC)) + { + m_vic->write(space, offset & 0x3f, data); + } + if (!BIT(plaout, PLA_OUT_IOCS) && BIT(offset, 10)) + { + switch ((BIT(offset, 11) << 2) | ((offset >> 8) & 0x03)) + { + case 0: // SID + m_sid->write(space, offset & 0x1f, data); + break; + + case 2: // CS8563 + if BIT(offset, 0) + { + m_vdc->register_w(space, 0, data); + } + else + { + m_vdc->address_w(space, 0, data); + } + break; + + case 4: // CIA1 + m_cia1->write(space, offset & 0x0f, data); + break; + + case 5: // CIA2 + m_cia2->write(space, offset & 0x0f, data); + break; + + case 6: // I/O1 + io1 = 0; + break; + + case 7: // I/O2 + io2 = 0; + break; + } + } + + int roml = BIT(plaout, PLA_OUT_ROML); + int romh = BIT(plaout, PLA_OUT_ROMH); + + m_exp->cd_w(space, ca, data, sphi2, ba, roml, romh, io1, io2); + + m_mmu->write(space, offset, data); +} + + +//------------------------------------------------- +// z80_r - +//------------------------------------------------- + +READ8_MEMBER( c128_state::z80_r ) +{ + int ba = 1, aec = 1, z80io = 1; + offs_t vma = 0; + + return read_memory(space, offset, vma, ba, aec, z80io); +} + + +//------------------------------------------------- +// z80_w - +//------------------------------------------------- + +WRITE8_MEMBER( c128_state::z80_w ) +{ + int ba = 1, aec = 1, z80io = 1; + offs_t vma = 0; + + write_memory(space, offset, vma, data, ba, aec, z80io); +} + + +//------------------------------------------------- +// z80_io_r - +//------------------------------------------------- + +READ8_MEMBER( c128_state::z80_io_r ) +{ + int ba = 1, aec = 1, z80io = 0; + offs_t vma = 0; + + return read_memory(space, offset, vma, ba, aec, z80io); +} + + +//------------------------------------------------- +// z80_io_w - +//------------------------------------------------- + +WRITE8_MEMBER( c128_state::z80_io_w ) +{ + int ba = 1, aec = 1, z80io = 0; + offs_t vma = 0; + + write_memory(space, offset, vma, data, ba, aec, z80io); +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( c128_state::read ) +{ + int ba = 1, aec = 1, z80io = 1; + offs_t vma = 0; + + return read_memory(space, offset, vma, ba, aec, z80io); +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( c128_state::write ) +{ + int ba = 1, aec = 1, z80io = 1; + offs_t vma = 0; + + write_memory(space, offset, vma, data, ba, aec, z80io); +} + + +//------------------------------------------------- +// vic_videoram_r - +//------------------------------------------------- + +READ8_MEMBER( c128_state::vic_videoram_r ) +{ + int ba = 0, aec = 0, z80io = 1; + + return read_memory(space, 0, offset, ba, aec, z80io); +} + + +//------------------------------------------------- +// vic_colorram_r - +//------------------------------------------------- + +READ8_MEMBER( c128_state::vic_colorram_r ) +{ + return m_color_ram[(m_clrbank << 10) | offset]; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( z80_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, c128_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(z80_r, z80_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( z80_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( z80_io, AS_IO, 8, c128_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(z80_io_r, z80_io_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( m8502_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( m8502_mem, AS_PROGRAM, 8, c128_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_videoram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, c128_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_colorram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, c128_state ) + AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vdc_videoram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vdc_videoram_map, AS_0, 8, c128_state ) + AM_RANGE(0x0000, 0xffff) AM_RAM +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( c128 ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c128_state::write_restore ) +{ + m_restore = state; + + check_interrupts(); +} + +INPUT_CHANGED_MEMBER( c128_state::caps_lock ) +{ + m_caps_lock = newval; +} + +static INPUT_PORTS_START( c128 ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START( "K0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_F6) PORT_CHAR('\t') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + + PORT_START( "K1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START( "K2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NO SCROLL") PORT_CODE(KEYCODE_F12) PORT_TOGGLE + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + + PORT_START( "RESTORE" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, c128_state, write_restore) + + PORT_START( "LOCK" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "CAPS" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_F8) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, c128_state, caps_lock, 0) + + PORT_START( "40_80" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("40/80 DISPLAY") PORT_CODE(KEYCODE_F11) PORT_TOGGLE +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( c128_de ) +//------------------------------------------------- + +static INPUT_PORTS_START( c128_de ) + PORT_INCLUDE( c128 ) + + PORT_MODIFY( "ROW1" ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z { Y }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # { 3 Paragraph }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_MODIFY( "ROW3" ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y { Z }") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 ' { 7 / }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_MODIFY( "ROW4" ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 { = }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_MODIFY( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", < { ; }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Paragraph \xE2\x86\x91 { \xc3\xbc }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00A7) PORT_CHAR(0x2191) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xa4 }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". > { : }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- { ' ` }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+ { \xc3\x9f ? }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + + PORT_MODIFY( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ? { - _ }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Sum Pi { ] \\ }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x03A3) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= { # ' }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; ] { \xc3\xb6 }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* ` { + * }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ { [ \xE2\x86\x91 }") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') + + PORT_MODIFY( "ROW7" ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') + + PORT_MODIFY( "CAPS" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ASCII/DIN") PORT_CODE(KEYCODE_F8) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, c128_state, caps_lock, 0) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( c128_fr ) +//------------------------------------------------- +#ifdef UNUSED_CODE +static INPUT_PORTS_START( c128_fr ) + PORT_INCLUDE( c128 ) + + PORT_MODIFY( "ROW1" ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z { W }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $ { ' 4 }") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A { Q }") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W { Z }") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # { \" 3 }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_MODIFY( "ROW2" ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 & { Paragraph 6 }") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 % { ( 5 }") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_MODIFY( "ROW3" ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 ( { ! 8 }") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 ' { \xc3\xa8 7 }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_MODIFY( "ROW4" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K Large- { \\ }") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M Large-/ { , ? }") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 { \xc3\xa0 0 }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 ) { \xc3\xa7 9 }") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_MODIFY( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", < { ; . }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@ \xc3\xbb { ^ \xc2\xa8 }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR(0x00FB) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xb9 % }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". > { : / }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- \xc2\xb0 { - _ }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('\xB0') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+ \xc3\xab { ) \xc2\xb0 }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR(0x00EB) + + PORT_MODIFY( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ? { = + }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi { * ] }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= {\xE2\x86\x91 \\ }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; ] { M Large-/ }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* ` { $ [ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ { @ # }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + + PORT_MODIFY( "ROW7" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q { A }") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 \" { \xc3\xa9 2 }") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 ! { & 1 }") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_MODIFY( "CAPS" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK ASCII/CC") PORT_CODE(KEYCODE_F8) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, c128_state, caps_lock, 0) +INPUT_PORTS_END +#endif + +//------------------------------------------------- +// INPUT_PORTS( c128_it ) +//------------------------------------------------- +#ifdef UNUSED_CODE +static INPUT_PORTS_START( c128_it ) + PORT_INCLUDE( c128 ) + + PORT_MODIFY( "ROW1" ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z { W }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $ { ' 4 }") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W { Z }") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # { \" 3 }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_MODIFY( "ROW2" ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 & { _ 6 }") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 % { ( 5 }") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_MODIFY( "ROW3" ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 ( { & 8 }") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 ' { \xc3\xa8 7 }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_MODIFY( "ROW4" ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M Large-/ { , ? }") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 { \xc3\xa0 0 }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 ) { \xc3\xa7 9 }") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_MODIFY( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", < { ; . }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@ \xc3\xbb { \xc3\xac = }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR(0x00FB) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xb9 % }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". > { : / }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- \xc2\xb0 { - + }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('\xb0') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+ \xc3\xab { ) \xc2\xb0 }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR(0x00EB) + + PORT_MODIFY( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ? { \xc3\xb2 ! }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi { * ] }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= { \xE2\x86\x91 \\ }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; ] { M }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* ` { $ [ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ { @ # }") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') + + PORT_MODIFY( "ROW7" ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 \" { \xc3\xa9 2 }") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 ! { \xc2\xa3 1 }") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') +INPUT_PORTS_END +#endif + +//------------------------------------------------- +// INPUT_PORTS( c128_se ) +//------------------------------------------------- + +static INPUT_PORTS_START( c128_se ) + PORT_INCLUDE( c128 ) + + PORT_MODIFY( "ROW1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # { 3 Paragraph }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_MODIFY( "ROW3" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 ' { 7 / }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_MODIFY( "ROW5" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("] { \xc3\xa2 }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(']') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ { \xc3\xa4 }") PORT_CODE(KEYCODE_COLON) PORT_CHAR('[') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_MODIFY( "ROW6" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xa3 { \xc3\xb6 }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\xA3') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('@') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') + + PORT_MODIFY( "ROW7" ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') + + PORT_MODIFY( "CAPS" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK ASCII/CC") PORT_CODE(KEYCODE_F8) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, c128_state, caps_lock, 0) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MOS8722_INTERFACE( mmu_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c128_state::mmu_z80en_w ) +{ + if (state) + { + m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_subcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + if (m_reset) + { + m_subcpu->reset(); + + m_reset = 0; + } + } + else + { + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_subcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + } + + m_z80en = state; +} + +WRITE_LINE_MEMBER( c128_state::mmu_fsdir_w ) +{ + update_iec(); +} + +READ_LINE_MEMBER( c128_state::mmu_game_r ) +{ + return m_game; +} + +READ_LINE_MEMBER( c128_state::mmu_exrom_r ) +{ + return m_exrom; +} + +READ_LINE_MEMBER( c128_state::mmu_sense40_r ) +{ + return BIT(m_40_80->read(), 0); +} + + +//------------------------------------------------- +// mc6845 +//------------------------------------------------- + +static GFXDECODE_START( c128 ) + GFXDECODE_ENTRY( "charom", 0x0000, gfx_8x8x1, 0, 1 ) +GFXDECODE_END + + +//------------------------------------------------- +// MOS8564_INTERFACE( vic_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c128_state::vic_irq_w ) +{ + m_vic_irq = state; + + check_interrupts(); +} + +WRITE8_MEMBER( c128_state::vic_k_w ) +{ + m_vic_k = data; +} + + +//------------------------------------------------- +// MOS6581_INTERFACE( sid_intf ) +//------------------------------------------------- + +READ8_MEMBER( c128_state::sid_potx_r ) +{ + UINT8 data = 0xff; + + switch (m_cia1->pa_r() >> 6) + { + case 1: data = m_joy1->pot_x_r(); break; + case 2: data = m_joy2->pot_x_r(); break; + case 3: + if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) + { + data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); + } + else if (m_joy1->has_pot_x()) + { + data = m_joy1->pot_x_r(); + } + else if (m_joy2->has_pot_x()) + { + data = m_joy2->pot_x_r(); + } + break; + } + + return data; +} + +READ8_MEMBER( c128_state::sid_poty_r ) +{ + UINT8 data = 0xff; + + switch (m_cia1->pa_r() >> 6) + { + case 1: data = m_joy1->pot_y_r(); break; + case 2: data = m_joy2->pot_y_r(); break; + case 3: + if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) + { + data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); + } + else if (m_joy1->has_pot_y()) + { + data = m_joy1->pot_y_r(); + } + else if (m_joy2->has_pot_y()) + { + data = m_joy2->pot_y_r(); + } + break; + } + + return data; +} + + +//------------------------------------------------- +// MOS6526_INTERFACE( cia1_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c128_state::cia1_irq_w ) +{ + m_cia1_irq = state; + + check_interrupts(); +} + +READ8_MEMBER( c128_state::cia1_pa_r ) +{ + /* + + bit description + + PA0 COL0, JOYB0 + PA1 COL1, JOYB1 + PA2 COL2, JOYB2 + PA3 COL3, JOYB3 + PA4 COL4, FBTNB + PA5 COL5 + PA6 COL6 + PA7 COL7 + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy_b = m_joy2->joy_r(); + + data &= (0xf0 | (joy_b & 0x0f)); + data &= ~(!BIT(joy_b, 5) << 4); + + // keyboard + UINT8 cia1_pb = m_cia1->pb_r(); + UINT8 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), + m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; + + for (int i = 0; i < 8; i++) + { + if (!BIT(cia1_pb, i)) + { + if (!BIT(row[7], i)) data &= ~0x80; + if (!BIT(row[6], i)) data &= ~0x40; + if (!BIT(row[5], i)) data &= ~0x20; + if (!BIT(row[4], i)) data &= ~0x10; + if (!BIT(row[3], i)) data &= ~0x08; + if (!BIT(row[2], i)) data &= ~0x04; + if (!BIT(row[1], i)) data &= ~0x02; + if (!BIT(row[0], i)) data &= ~0x01; + } + } + + return data; +} + +WRITE8_MEMBER( c128_state::cia1_pa_w ) +{ + /* + + bit description + + PA0 COL0, JOYB0 + PA1 COL1, JOYB1 + PA2 COL2, JOYB2 + PA3 COL3, JOYB3 + PA4 COL4, FBTNB + PA5 COL5 + PA6 COL6 + PA7 COL7 + + */ + + m_joy2->joy_w(data & 0x1f); +} + +READ8_MEMBER( c128_state::cia1_pb_r ) +{ + /* + + bit description + + PB0 ROW0, JOYA0 + PB1 ROW1, JOYA1 + PB2 ROW2, JOYA2 + PB3 ROW3, JOYA3 + PB4 ROW4, FBTNA, _LP + PB5 ROW5 + PB6 ROW6 + PB7 ROW7 + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy_a = m_joy1->joy_r(); + + data &= (0xf0 | (joy_a & 0x0f)); + data &= ~(!BIT(joy_a, 5) << 4); + + // keyboard + UINT8 cia1_pa = m_cia1->pa_r(); + + if (!BIT(cia1_pa, 7)) data &= m_row7->read(); + if (!BIT(cia1_pa, 6)) data &= m_row6->read(); + if (!BIT(cia1_pa, 5)) data &= m_row5->read(); + if (!BIT(cia1_pa, 4)) data &= m_row4->read(); + if (!BIT(cia1_pa, 3)) data &= m_row3->read(); + if (!BIT(cia1_pa, 2)) data &= m_row2->read(); + if (!BIT(cia1_pa, 1)) data &= m_row1->read() & m_lock->read(); + if (!BIT(cia1_pa, 0)) data &= m_row0->read(); + + if (!BIT(m_vic_k, 0)) data &= m_k0->read(); + if (!BIT(m_vic_k, 1)) data &= m_k1->read(); + if (!BIT(m_vic_k, 2)) data &= m_k2->read(); + + return data; +} + +WRITE8_MEMBER( c128_state::cia1_pb_w ) +{ + /* + + bit description + + PB0 ROW0, JOYA0 + PB1 ROW1, JOYA1 + PB2 ROW2, JOYA2 + PB3 ROW3, JOYA3 + PB4 ROW4, FBTNA, _LP + PB5 ROW5 + PB6 ROW6 + PB7 ROW7 + + */ + + m_joy1->joy_w(data & 0x1f); + + m_vic->lp_w(BIT(data, 4)); +} + +WRITE_LINE_MEMBER( c128_state::cia1_cnt_w ) +{ + m_cnt1 = state; + m_user->write_4(state); + + update_iec(); +} + +WRITE_LINE_MEMBER( c128_state::cia1_sp_w ) +{ + m_sp1 = state; + m_user->write_5(state); + + update_iec(); +} + + +//------------------------------------------------- +// MOS6526_INTERFACE( cia2_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c128_state::cia2_irq_w ) +{ + m_cia2_irq = state; + + check_interrupts(); +} + +READ8_MEMBER( c128_state::cia2_pa_r ) +{ + /* + + bit description + + PA0 + PA1 + PA2 USER PORT + PA3 + PA4 + PA5 + PA6 CLK + PA7 DATA + + */ + + UINT8 data = 0; + + // user port + data |= m_user_pa2 << 2; + + // IEC bus + data |= m_iec->clk_r() << 6; + data |= m_iec->data_r() << 7; + + return data; +} + +WRITE8_MEMBER( c128_state::cia2_pa_w ) +{ + /* + + bit description + + PA0 _VA14 + PA1 _VA15 + PA2 USER PORT + PA3 ATN OUT + PA4 CLK OUT + PA5 DATA OUT + PA6 + PA7 + + */ + + // VIC banking + m_va14 = BIT(data, 0); + m_va15 = BIT(data, 1); + + // user port + m_user->write_m(BIT(data, 2)); + + // IEC bus + m_iec->atn_w(!BIT(data, 3)); + m_iec->clk_w(!BIT(data, 4)); + m_iec_data_out = BIT(data, 5); + + update_iec(); +} + +READ8_MEMBER( c128_state::cia2_pb_r ) +{ + return m_user_pb; +} + +WRITE8_MEMBER( c128_state::cia2_pb_w ) +{ + m_user->write_c((data>>0)&1); + m_user->write_d((data>>1)&1); + m_user->write_e((data>>2)&1); + m_user->write_f((data>>3)&1); + m_user->write_h((data>>4)&1); + m_user->write_j((data>>5)&1); + m_user->write_k((data>>6)&1); + m_user->write_l((data>>7)&1); +} + +//------------------------------------------------- +// M6510_INTERFACE( cpu_intf ) +//------------------------------------------------- + +READ8_MEMBER( c128_state::cpu_r) +{ + /* + + bit description + + P0 1 + P1 1 + P2 1 + P3 + P4 CASS SENSE + P5 + P6 CAPS LOCK + + */ + + UINT8 data = 0x07; + + // cassette sense + data |= m_cassette->sense_r() << 4; + + // CAPS LOCK + data |= m_caps_lock << 6; + + return data; +} + +WRITE8_MEMBER( c128_state::cpu_w ) +{ + /* + + bit description + + P0 LORAM + P1 HIRAM + P2 CHAREN + P3 CASS WRT + P4 + P5 CASS MOTOR + P6 + + */ + + // memory banking + m_loram = BIT(data, 0); + m_hiram = BIT(data, 1); + m_charen = BIT(data, 2); + + // cassette write + m_cassette->write(BIT(data, 3)); + + // cassette motor + m_cassette->motor_w(BIT(data, 5)); +} + + +//------------------------------------------------- +// CBM_IEC_INTERFACE( cbm_iec_intf ) +//------------------------------------------------- + +inline void c128_state::update_iec() +{ + int fsdir = m_mmu->fsdir_r(); + + // fast serial data in + int data_in = m_iec->data_r(); + + m_cia1->sp_w(fsdir || data_in); + + // fast serial data out + int data_out = !m_iec_data_out; + + if (fsdir) data_out &= m_sp1; + + m_iec->data_w(data_out); + + // fast serial clock in + int srq_in = m_iec->srq_r(); + + m_cia1->cnt_w(fsdir || srq_in); + + // fast serial clock out + int srq_out = 1; + + if (fsdir) srq_out &= m_cnt1; + + m_iec->srq_w(srq_out); +} + +WRITE_LINE_MEMBER( c128_state::iec_srq_w ) +{ + update_iec(); +} + +WRITE_LINE_MEMBER( c128_state::iec_data_w ) +{ + update_iec(); +} + + +//------------------------------------------------- +// C64_EXPANSION_INTERFACE( expansion_intf ) +//------------------------------------------------- + +READ8_MEMBER( c128_state::exp_dma_cd_r ) +{ + int ba = 0, aec = 1, z80io = 1; + offs_t vma = 0; + + return read_memory(space, offset, vma, ba, aec, z80io); +} + +WRITE8_MEMBER( c128_state::exp_dma_cd_w ) +{ + int ba = 0, aec = 1, z80io = 1; + offs_t vma = 0; + + return write_memory(space, offset, data, vma, ba, aec, z80io); +} + +WRITE_LINE_MEMBER( c128_state::exp_irq_w ) +{ + m_exp_irq = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( c128_state::exp_nmi_w ) +{ + m_exp_nmi = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( c128_state::exp_dma_w ) +{ + m_exp_dma = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( c128_state::exp_reset_w ) +{ + if (!state) + { + machine_reset(); + } +} + + +//------------------------------------------------- +// SLOT_INTERFACE( c128dcr_iec_devices ) +//------------------------------------------------- + +SLOT_INTERFACE_START( c128dcr_iec_devices ) + SLOT_INTERFACE("c1571", C1571) + SLOT_INTERFACE("c1571cr", C1571CR) +SLOT_INTERFACE_END + + +//------------------------------------------------- +// SLOT_INTERFACE( c128d81_iec_devices ) +//------------------------------------------------- + +SLOT_INTERFACE_START( c128d81_iec_devices ) + SLOT_INTERFACE("c1563", C1563) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( c64 ) +//------------------------------------------------- + +void c128_state::machine_start() +{ + // allocate memory + m_color_ram.allocate(0x800); + + // initialize memory + UINT8 data = 0xff; + + for (offs_t offset = 0; offset < m_ram->size(); offset++) + { + m_ram->pointer()[offset] = data; + if (!(offset % 64)) data ^= 0xff; + } + + // state saving + save_item(NAME(m_z80en)); + save_item(NAME(m_loram)); + save_item(NAME(m_hiram)); + save_item(NAME(m_charen)); + save_item(NAME(m_game)); + save_item(NAME(m_exrom)); + save_item(NAME(m_reset)); + save_item(NAME(m_va14)); + save_item(NAME(m_va15)); + save_item(NAME(m_clrbank)); + save_item(NAME(m_cnt1)); + save_item(NAME(m_sp1)); + save_item(NAME(m_iec_data_out)); + save_item(NAME(m_cia1_irq)); + save_item(NAME(m_cia2_irq)); + save_item(NAME(m_vic_irq)); + save_item(NAME(m_exp_irq)); + save_item(NAME(m_exp_nmi)); + save_item(NAME(m_exp_dma)); + save_item(NAME(m_vic_k)); + save_item(NAME(m_caps_lock)); +} + + +void c128_state::machine_reset() +{ + m_maincpu->reset(); + m_reset = 1; + + m_mmu->reset(); + m_vic->reset(); + m_vdc->reset(); + m_sid->reset(); + m_cia1->reset(); + m_cia2->reset(); + + m_iec->reset(); + m_exp->reset(); + + m_user->write_3(0); + m_user->write_3(1); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( ntsc ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ntsc, c128_state ) + // basic hardware + MCFG_CPU_ADD(Z80A_TAG, Z80, XTAL_14_31818MHz*2/3.5/2) + MCFG_CPU_PROGRAM_MAP(z80_mem) + MCFG_CPU_IO_MAP(z80_io) + MCFG_QUANTUM_PERFECT_CPU(Z80A_TAG) + + MCFG_CPU_ADD(M8502_TAG, M8502, XTAL_14_31818MHz*2/3.5/8) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_M8502_PORT_CALLBACKS(READ8(c128_state, cpu_r), WRITE8(c128_state, cpu_w)) + MCFG_M8502_PORT_PULLS(0x07, 0x20) + MCFG_CPU_PROGRAM_MAP(m8502_mem) + MCFG_QUANTUM_PERFECT_CPU(M8502_TAG) + + // video hardware + MCFG_MOS8563_ADD(MOS8563_TAG, SCREEN_VDC_TAG, XTAL_16MHz, vdc_videoram_map) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_SCREEN_ADD(SCREEN_VDC_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DEVICE(MOS8563_TAG, mos8563_device, screen_update) + + MCFG_DEVICE_ADD(MOS8564_TAG, MOS8564, XTAL_14_31818MHz*2/3.5) + MCFG_MOS6566_CPU(M8502_TAG) + MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c128_state, vic_irq_w)) + MCFG_MOS8564_K_CALLBACK(WRITE8(c128_state, vic_k_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_VIC_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) + MCFG_SCREEN_ADD(SCREEN_VIC_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) + MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) + MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DEVICE(MOS8564_TAG, mos8564_device, screen_update) + + MCFG_GFXDECODE_ADD("gfxdecode", MOS8563_TAG":palette", c128) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_14_31818MHz*2/3.5/8) + MCFG_MOS6581_POTX_CALLBACK(READ8(c128_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c128_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_DEVICE_ADD(MOS8722_TAG, MOS8722, XTAL_14_31818MHz*2/3.5/8) + MCFG_MOS8722_Z80EN_CALLBACK(WRITELINE(c128_state, mmu_z80en_w)) + MCFG_MOS8722_FSDIR_CALLBACK(WRITELINE(c128_state, mmu_fsdir_w)) + MCFG_MOS8722_GAME_CALLBACK(READLINE(c128_state, mmu_game_r)) + MCFG_MOS8722_EXROM_CALLBACK(READLINE(c128_state, mmu_exrom_r)) + MCFG_MOS8722_SENSE40_CALLBACK(READLINE(c128_state, mmu_sense40_r)) + MCFG_MOS8721_ADD(MOS8721_TAG) + MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_14_31818MHz*2/3.5/8) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c128_state, cia1_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(WRITELINE(c128_state, cia1_cnt_w)) + MCFG_MOS6526_SP_CALLBACK(WRITELINE(c128_state, cia1_sp_w)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia1_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia1_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pb_w)) + MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_14_31818MHz*2/3.5/8) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c128_state, cia2_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia2_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia2_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia2_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia2_pb_w)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS8564_TAG, mos8564_device, lp_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") + MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_14_31818MHz*2/3.5/8, c64_expansion_cards, NULL) + MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c128_state, exp_irq_w)) + MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c128_state, exp_nmi_w)) + MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c128_state, exp_reset_w)) + MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c128_state, exp_dma_cd_r)) + MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c128_state, exp_dma_cd_w)) + MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c128_state, exp_dma_w)) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) + MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c128_state, exp_reset_w)) + MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) + MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c128_state, write_user_pb0)) + MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c128_state, write_user_pb1)) + MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c128_state, write_user_pb2)) + MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c128_state, write_user_pb3)) + MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c128_state, write_user_pb4)) + MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c128_state, write_user_pb5)) + MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c128_state, write_user_pb6)) + MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c128_state, write_user_pb7)) + MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c128_state, write_user_pa2)) + + MCFG_QUICKLOAD_ADD("quickload", c128_state, cbm_c64, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") + MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") + MCFG_SOFTWARE_LIST_ADD("cart_list", "c128_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list_c64", "c64_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list_c64", "c64_flop") + MCFG_SOFTWARE_LIST_ADD("flop_list", "c128_flop") + MCFG_SOFTWARE_LIST_ADD("from_list", "c128_rom") + MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("cass_list_c64", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("flop_list_c64", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("from_list", "NTSC") + + // function ROM + MCFG_GENERIC_SOCKET_ADD("from", generic_plain_slot, "c128_rom") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( c128 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( c128, ntsc ) + MCFG_CBM_IEC_ADD("c1571") + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) + MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( c128dcr ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( c128dcr, ntsc ) + MCFG_CBM_IEC_ADD("c1571") // TODO c1571cr + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) + MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( c128d81 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( c128d81, ntsc ) + MCFG_CBM_IEC_ADD(NULL) + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) + MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) + + MCFG_DEVICE_MODIFY("iec8") + MCFG_DEVICE_SLOT_INTERFACE(c128d81_iec_devices, "c1563", false) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pal ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pal, c128_state ) + // basic hardware + MCFG_CPU_ADD(Z80A_TAG, Z80, XTAL_17_734472MHz*2/4.5/2) + MCFG_CPU_PROGRAM_MAP(z80_mem) + MCFG_CPU_IO_MAP(z80_io) + MCFG_QUANTUM_PERFECT_CPU(Z80A_TAG) + + MCFG_CPU_ADD(M8502_TAG, M8502, XTAL_17_734472MHz*2/4.5/8) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_M8502_PORT_CALLBACKS(READ8(c128_state, cpu_r), WRITE8(c128_state, cpu_w)) + MCFG_M8502_PORT_PULLS(0x07, 0x20) + MCFG_CPU_PROGRAM_MAP(m8502_mem) + MCFG_QUANTUM_PERFECT_CPU(M8502_TAG) + + // video hardware + MCFG_MOS8563_ADD(MOS8563_TAG, SCREEN_VDC_TAG, XTAL_16MHz, vdc_videoram_map) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_SCREEN_ADD(SCREEN_VDC_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DEVICE(MOS8563_TAG, mos8563_device, screen_update) + + MCFG_DEVICE_ADD(MOS8566_TAG, MOS8566, XTAL_17_734472MHz*2/4.5) + MCFG_MOS6566_CPU(M8502_TAG) + MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c128_state, vic_irq_w)) + MCFG_MOS8564_K_CALLBACK(WRITE8(c128_state, vic_k_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_VIC_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) + MCFG_SCREEN_ADD(SCREEN_VIC_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) + MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) + MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DEVICE(MOS8566_TAG, mos8566_device, screen_update) + + MCFG_GFXDECODE_ADD("gfxdecode", MOS8563_TAG":palette", c128) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_17_734472MHz*2/4.5/8) + MCFG_MOS6581_POTX_CALLBACK(READ8(c128_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c128_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_DEVICE_ADD(MOS8722_TAG, MOS8722, XTAL_17_734472MHz*2/4.5/8) + MCFG_MOS8722_Z80EN_CALLBACK(WRITELINE(c128_state, mmu_z80en_w)) + MCFG_MOS8722_FSDIR_CALLBACK(WRITELINE(c128_state, mmu_fsdir_w)) + MCFG_MOS8722_GAME_CALLBACK(READLINE(c128_state, mmu_game_r)) + MCFG_MOS8722_EXROM_CALLBACK(READLINE(c128_state, mmu_exrom_r)) + MCFG_MOS8722_SENSE40_CALLBACK(READLINE(c128_state, mmu_sense40_r)) + MCFG_MOS8721_ADD(MOS8721_TAG) + MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_17_734472MHz*2/4.5/8) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c128_state, cia1_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(WRITELINE(c128_state, cia1_cnt_w)) + MCFG_MOS6526_SP_CALLBACK(WRITELINE(c128_state, cia1_sp_w)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia1_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia1_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pb_w)) + MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz*2/4.5/8) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c128_state, cia2_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia2_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia2_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia2_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia2_pb_w)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS8566_TAG, mos8566_device, lp_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") + MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_17_734472MHz*2/4.5/8, c64_expansion_cards, NULL) + MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c128_state, exp_irq_w)) + MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c128_state, exp_nmi_w)) + MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c128_state, exp_reset_w)) + MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c128_state, exp_dma_cd_r)) + MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c128_state, exp_dma_cd_w)) + MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c128_state, exp_dma_w)) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) + MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c128_state, exp_reset_w)) + MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) + MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c128_state, write_user_pb0)) + MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c128_state, write_user_pb1)) + MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c128_state, write_user_pb2)) + MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c128_state, write_user_pb3)) + MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c128_state, write_user_pb4)) + MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c128_state, write_user_pb5)) + MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c128_state, write_user_pb6)) + MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c128_state, write_user_pb7)) + MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c128_state, write_user_pa2)) + + MCFG_QUICKLOAD_ADD("quickload", c128_state, cbm_c64, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") + MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") + MCFG_SOFTWARE_LIST_ADD("cart_list", "c128_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list_c64", "c64_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list_c64", "c64_flop") + MCFG_SOFTWARE_LIST_ADD("flop_list", "c128_flop") + MCFG_SOFTWARE_LIST_ADD("from_list", "c128_rom") + MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "PAL") + MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "PAL") + MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") + MCFG_SOFTWARE_LIST_FILTER("cass_list_c64", "PAL") + MCFG_SOFTWARE_LIST_FILTER("flop_list_c64", "PAL") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") + MCFG_SOFTWARE_LIST_FILTER("from_list", "PAL") + + // function ROM + MCFG_GENERIC_SOCKET_ADD("from", generic_plain_slot, "c128_rom") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( c128pal ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( c128pal, pal ) + MCFG_CBM_IEC_ADD("c1571") + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) + MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( c128dcrp ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( c128dcrp, pal ) + MCFG_CBM_IEC_ADD("c1571") // TODO c1571cr + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) + MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( c128 ) +//------------------------------------------------- + +ROM_START( c128 ) + ROM_REGION( 0x10000, M8502_TAG, 0 ) + ROM_DEFAULT_BIOS("r4") + ROM_LOAD( "251913-01.u32", 0x0000, 0x4000, CRC(0010ec31) SHA1(765372a0e16cbb0adf23a07b80f6b682b39fbf88) ) + ROM_SYSTEM_BIOS( 0, "r2", "Revision 2" ) + ROMX_LOAD( "318018-02.u33", 0x4000, 0x4000, CRC(2ee6e2fa) SHA1(60e1491e1d5782e3cf109f518eb73427609badc6), ROM_BIOS(1) ) + ROMX_LOAD( "318019-02.u34", 0x8000, 0x4000, CRC(d551fce0) SHA1(4d223883e866645328f86a904b221464682edc4f), ROM_BIOS(1) ) + ROMX_LOAD( "318020-03.u35", 0xc000, 0x4000, CRC(1e94bb02) SHA1(e80ffbafae068cc0e42698ec5c5c39af46ac612a), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) + ROMX_LOAD( "318018-04.u33", 0x4000, 0x4000, CRC(9f9c355b) SHA1(d53a7884404f7d18ebd60dd3080c8f8d71067441), ROM_BIOS(2) ) + ROMX_LOAD( "318019-04.u34", 0x8000, 0x4000, CRC(6e2c91a7) SHA1(c4fb4a714e48a7bf6c28659de0302183a0e0d6c0), ROM_BIOS(2) ) + ROMX_LOAD( "318020-05.u35", 0xc000, 0x4000, CRC(ba456b8e) SHA1(ceb6e1a1bf7e08eb9cbc651afa29e26adccf38ab), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "jiffydos", "JiffyDOS v6.01" ) + ROMX_LOAD( "318018-04.u33", 0x4000, 0x4000, CRC(9f9c355b) SHA1(d53a7884404f7d18ebd60dd3080c8f8d71067441), ROM_BIOS(3) ) + ROMX_LOAD( "318019-04.u34", 0x8000, 0x4000, CRC(6e2c91a7) SHA1(c4fb4a714e48a7bf6c28659de0302183a0e0d6c0), ROM_BIOS(3) ) + ROMX_LOAD( "jiffydos c128.u35", 0xc000, 0x4000, CRC(4b7964de) SHA1(7d1898f32beae4b2ae610d469ce578a588efaa7c), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "quikslvr", "QuickSilver 128" ) // requires add-on cartridge + ROMX_LOAD( "318018-04.u33", 0x4000, 0x4000, CRC(9f9c355b) SHA1(d53a7884404f7d18ebd60dd3080c8f8d71067441), ROM_BIOS(4) ) + ROMX_LOAD( "318019-04.u34", 0x8000, 0x4000, CRC(6e2c91a7) SHA1(c4fb4a714e48a7bf6c28659de0302183a0e0d6c0), ROM_BIOS(4) ) + ROMX_LOAD( "quicksilver128.u35", 0xc000, 0x4000, CRC(c2e74338) SHA1(916cdcc62eb631073aa7f096815dcf33b3229ca8), ROM_BIOS(4) ) + + ROM_REGION( 0x2000, "charom", 0 ) + ROM_LOAD( "390059-01.u18", 0x0000, 0x2000, CRC(6aaaafe6) SHA1(29ed066d513f2d5c09ff26d9166ba23c2afb2b3f) ) + + ROM_REGION( 0xc88, MOS8721_TAG, 0 ) + // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt + ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) +ROM_END + +#define rom_c128p rom_c128 +#define rom_c128d rom_c128 +#define rom_c128dp rom_c128 +#define rom_c128dpr rom_c128 +#define rom_c128d81 rom_c128 + + +//------------------------------------------------- +// ROM( c128_de ) +//------------------------------------------------- + +ROM_START( c128_de ) + ROM_REGION( 0x10000, M8502_TAG, 0 ) + ROM_DEFAULT_BIOS("r4") + ROM_LOAD( "251913-01.u32", 0x0000, 0x4000, CRC(0010ec31) SHA1(765372a0e16cbb0adf23a07b80f6b682b39fbf88) ) + ROM_SYSTEM_BIOS( 0, "r2", "Revision 2" ) + ROMX_LOAD( "318018-02.u33", 0x4000, 0x4000, CRC(2ee6e2fa) SHA1(60e1491e1d5782e3cf109f518eb73427609badc6), ROM_BIOS(1) ) + ROMX_LOAD( "318019-02.u34", 0x8000, 0x4000, CRC(d551fce0) SHA1(4d223883e866645328f86a904b221464682edc4f), ROM_BIOS(1) ) + ROMX_LOAD( "315078-01.u35", 0xc000, 0x4000, CRC(a51e2168) SHA1(bcf82a89a8fc5d086bec2ff3bcbdecc8af2be3af), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) + ROMX_LOAD( "318018-04.u33", 0x4000, 0x4000, CRC(9f9c355b) SHA1(d53a7884404f7d18ebd60dd3080c8f8d71067441), ROM_BIOS(2) ) + ROMX_LOAD( "318019-04.u34", 0x8000, 0x4000, CRC(6e2c91a7) SHA1(c4fb4a714e48a7bf6c28659de0302183a0e0d6c0), ROM_BIOS(2) ) + ROMX_LOAD( "315078-02.u35", 0xc000, 0x4000, CRC(b275bb2e) SHA1(78ac5dcdd840b092ba1ee6d19b33af079613291f), ROM_BIOS(2) ) + + ROM_REGION( 0x2000, "charom", 0 ) + ROM_LOAD( "315079-01.u18", 0x00000, 0x2000, CRC(fe5a2db1) SHA1(638f8aff51c2ac4f99a55b12c4f8c985ef4bebd3) ) + + ROM_REGION( 0xc88, MOS8721_TAG, 0 ) + // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt + ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) +ROM_END + + +//------------------------------------------------- +// ROM( c128_se ) +//------------------------------------------------- + +ROM_START( c128_se ) + ROM_REGION( 0x10000, M8502_TAG, 0 ) + ROM_LOAD( "325182-01.u32", 0x0000, 0x4000, CRC(2aff27d3) SHA1(267654823c4fdf2167050f41faa118218d2569ce) ) // "C128 64 Sw/Fi" + ROM_LOAD( "318018-02.u33", 0x4000, 0x4000, CRC(2ee6e2fa) SHA1(60e1491e1d5782e3cf109f518eb73427609badc6) ) + ROM_LOAD( "318019-02.u34", 0x8000, 0x4000, CRC(d551fce0) SHA1(4d223883e866645328f86a904b221464682edc4f) ) + ROM_LOAD( "325189-01.u35", 0xc000, 0x4000, CRC(9526fac4) SHA1(a01dd871241c801db51e8ebc30fedfafd8cc506b) ) // "C128 Ker Sw/Fi" + + ROM_REGION( 0x2000, "charom", 0 ) + ROM_LOAD( "325181-01.bin", 0x0000, 0x2000, CRC(7a70d9b8) SHA1(aca3f7321ee7e6152f1f0afad646ae41964de4fb) ) // "C128 Char Sw/Fi" + + ROM_REGION( 0xc88, MOS8721_TAG, 0 ) + // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt + ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) +ROM_END + + +//------------------------------------------------- +// ROM( c128cr ) +//------------------------------------------------- + +ROM_START( c128cr ) + /* C128CR prototype, owned by Bo Zimmers + PCB markings: "COMMODORE 128CR REV.3 // PCB NO.252270" and "PCB ASSY NO.250783" + Sticker on rom cart shield: "C128CR No.2 // ENG. SAMPLE // Jun/9/'86 KNT" + 3 ROMs (combined basic, combined c64/kernal, plain character rom) + 6526A-1 CIAs + ?prototype? 2568R1X VDC w/ 1186 datecode + */ + ROM_REGION( 0x10000, M8502_TAG, 0 ) + ROM_LOAD( "252343-03.u34", 0x4000, 0x8000, CRC(bc07ed87) SHA1(0eec437994a3f2212343a712847213a8a39f4a7b) ) // "252343-03 // U34" + ROM_LOAD( "252343-04.u32", 0x0000, 0x4000, CRC(cc6bdb69) SHA1(36286b2e8bea79f7767639fd85e12c5447c7041b) ) // "252343-04 // US // U32" + ROM_CONTINUE( 0xc000, 0x4000 ) + + ROM_REGION( 0x2000, "charom", 0 ) + ROM_LOAD( "390059-01.u18", 0x0000, 0x2000, CRC(6aaaafe6) SHA1(29ed066d513f2d5c09ff26d9166ba23c2afb2b3f) ) // "MOS // (C)1985 CBM // 390059-01 // M468613 8547H" + + ROM_REGION( 0xc88, MOS8721_TAG, 0 ) + // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt + ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) +ROM_END + + +//------------------------------------------------- +// ROM( c128dcr ) +//------------------------------------------------- + +ROM_START( c128dcr ) + ROM_REGION( 0x10000, M8502_TAG, 0 ) + ROM_LOAD( "318022-02.u34", 0x4000, 0x8000, CRC(af1ae1e8) SHA1(953dcdf5784a6b39ef84dd6fd968c7a03d8d6816) ) + ROM_LOAD( "318023-02.u32", 0x0000, 0x4000, CRC(eedc120a) SHA1(f98c5a986b532c78bb68df9ec6dbcf876913b99f) ) + ROM_CONTINUE( 0xc000, 0x4000 ) + + ROM_REGION( 0x2000, "charom", 0 ) + ROM_LOAD( "390059-01.u18", 0x0000, 0x2000, CRC(6aaaafe6) SHA1(29ed066d513f2d5c09ff26d9166ba23c2afb2b3f) ) + + ROM_REGION( 0xc88, MOS8721_TAG, 0 ) + // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt + ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) +ROM_END + +#define rom_c128dcrp rom_c128dcr + + +//------------------------------------------------- +// ROM( c128dcr_de ) +//------------------------------------------------- + +ROM_START( c128dcr_de ) + ROM_REGION( 0x10000, M8502_TAG, 0 ) + ROM_LOAD( "318022-02.u34", 0x4000, 0x8000, CRC(af1ae1e8) SHA1(953dcdf5784a6b39ef84dd6fd968c7a03d8d6816) ) + ROM_LOAD( "318077-01.u32", 0x0000, 0x4000, CRC(eb6e2c8f) SHA1(6b3d891fedabb5335f388a5d2a71378472ea60f4) ) + ROM_CONTINUE( 0xc000, 0x4000 ) + + ROM_REGION( 0x2000, "charom", 0 ) + ROM_LOAD( "315079-01.u18", 0x0000, 0x2000, CRC(fe5a2db1) SHA1(638f8aff51c2ac4f99a55b12c4f8c985ef4bebd3) ) + + ROM_REGION( 0xc88, MOS8721_TAG, 0 ) + // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt + ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) +ROM_END + + +//------------------------------------------------- +// ROM( c128dcr_se ) +//------------------------------------------------- + +ROM_START( c128dcr_se ) + ROM_REGION( 0x10000, M8502_TAG, 0 ) + ROM_LOAD( "318022-02.u34", 0x4000, 0x8000, CRC(af1ae1e8) SHA1(953dcdf5784a6b39ef84dd6fd968c7a03d8d6816) ) + ROM_LOAD( "318034-01.u32", 0x0000, 0x4000, CRC(cb4e1719) SHA1(9b0a0cef56d00035c611e07170f051ee5e63aa3a) ) + ROM_CONTINUE( 0xc000, 0x4000 ) + + ROM_REGION( 0x2000, "charom", 0 ) + ROM_LOAD( "325181-01.u18", 0x0000, 0x2000, CRC(7a70d9b8) SHA1(aca3f7321ee7e6152f1f0afad646ae41964de4fb) ) + + ROM_REGION( 0xc88, MOS8721_TAG, 0 ) + // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt + ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1985, c128, 0, 0, c128, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, c128p, 0, 0, c128pal, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128 (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, c128_de, c128, 0, c128pal, c128_de, driver_device, 0, "Commodore Business Machines", "Commodore 128 (Germany)", MACHINE_SUPPORTS_SAVE ) +//COMP( 1985, c128_fr, c128, 0, c128pal, c128_fr, driver_device, 0, "Commodore Business Machines", "Commodore 128 (France)", MACHINE_SUPPORTS_SAVE ) +//COMP( 1985, c128_no, c128, 0, c128pal, c128_it, driver_device, 0, "Commodore Business Machines", "Commodore 128 (Norway)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, c128_se, c128, 0, c128pal, c128_se, driver_device, 0, "Commodore Business Machines", "Commodore 128 (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, c128d, c128, 0, c128, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128D (NTSC, prototype)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, c128dp, c128, 0, c128pal, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128D (PAL)", MACHINE_SUPPORTS_SAVE ) + +COMP( 1986, c128cr, c128, 0, c128, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128CR (NTSC, prototype)", MACHINE_SUPPORTS_SAVE ) + +COMP( 1987, c128dcr, c128, 0, c128dcr, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128DCR (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1987, c128dcrp, c128, 0, c128dcrp, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128DCR (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1987, c128dcr_de, c128, 0, c128dcrp, c128_de, driver_device, 0, "Commodore Business Machines", "Commodore 128DCR (Germany)", MACHINE_SUPPORTS_SAVE ) +//COMP( 1986, c128dcr_it, c128, 0, c128dcrp, c128_it, driver_device, 0,"Commodore Business Machines", "Commodore 128DCR (Italy)", MACHINE_SUPPORTS_SAVE ) +COMP( 1987, c128dcr_se, c128, 0, c128dcrp, c128_se, driver_device, 0, "Commodore Business Machines", "Commodore 128DCR (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) + +COMP( 1986, c128d81, c128, 0, c128d81, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128D/81 (NTSC, prototype)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/c64.c b/src/mame/drivers/c64.c new file mode 100644 index 00000000000..56aaf5966da --- /dev/null +++ b/src/mame/drivers/c64.c @@ -0,0 +1,1847 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + TODO: + + - floating bus writes to peripheral registers in m6502.c + - sort out kernals between PAL/NTSC + - tsuit215 test failures + - IRQ (WRONG $DC0D) + - NMI (WRONG $DD0D) + - some CIA tests + - PDC Clipper (C64 in a briefcase with 3" floppy, electroluminescent flat screen, thermal printer) + +*/ + +#include "includes/c64.h" +#include "bus/cbmiec/c1541.h" +#include "machine/cbm_snqk.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define A15 BIT(offset, 15) +#define A14 BIT(offset, 14) +#define A13 BIT(offset, 13) +#define A12 BIT(offset, 12) +#define VA13 BIT(va, 13) +#define VA12 BIT(va, 12) + +enum +{ + PLA_OUT_CASRAM = 0, + PLA_OUT_BASIC = 1, + PLA_OUT_KERNAL = 2, + PLA_OUT_CHAROM = 3, + PLA_OUT_GRW = 4, + PLA_OUT_IO = 5, + PLA_OUT_ROML = 6, + PLA_OUT_ROMH = 7 +}; + + +QUICKLOAD_LOAD_MEMBER( c64_state, cbm_c64 ) +{ + return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress); +} + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// check_interrupts - +//------------------------------------------------- + +void c64_state::check_interrupts() +{ + int irq = m_cia1_irq || m_vic_irq || m_exp_irq; + int nmi = m_cia2_irq || !m_restore || m_exp_nmi; + //int rdy = m_exp_dma && m_vic_ba; + + m_maincpu->set_input_line(M6510_IRQ_LINE, irq); + m_maincpu->set_input_line(M6510_NMI_LINE, nmi); +} + + + +//************************************************************************** +// ADDRESS DECODING +//************************************************************************** + +//------------------------------------------------- +// read_pla - +//------------------------------------------------- + +int c64_state::read_pla(offs_t offset, offs_t va, int rw, int aec, int ba) +{ + //int ba = m_vic->ba_r(); + //int aec = !m_vic->aec_r(); + int sphi2 = m_vic->phi0_r(); + int game = m_exp->game_r(offset, sphi2, ba, rw, m_hiram); + int exrom = m_exp->exrom_r(offset, sphi2, ba, rw, m_hiram); + int cas = 0; + + UINT32 input = VA12 << 15 | VA13 << 14 | game << 13 | exrom << 12 | rw << 11 | aec << 10 | ba << 9 | A12 << 8 | + A13 << 7 | A14 << 6 | A15 << 5 | m_va14 << 4 | m_charen << 3 | m_hiram << 2 | m_loram << 1 | cas; + + return m_pla->read(input); +} + + +//------------------------------------------------- +// read_memory - +//------------------------------------------------- + +UINT8 c64_state::read_memory(address_space &space, offs_t offset, offs_t va, int aec, int ba) +{ + int rw = 1; + int io1 = 1, io2 = 1; + int sphi2 = m_vic->phi0_r(); + + int plaout = read_pla(offset, va, rw, !aec, ba); + + UINT8 data = 0xff; + + if (!aec) + { + data = m_vic->bus_r(); + } + + if (!BIT(plaout, PLA_OUT_CASRAM)) + { + if (aec) + { + data = m_ram->pointer()[offset]; + } + else + { + data = m_ram->pointer()[(!m_va15 << 15) | (!m_va14 << 14) | va]; + } + } + if (!BIT(plaout, PLA_OUT_BASIC)) + { + data = m_basic[offset & 0x1fff]; + } + if (!BIT(plaout, PLA_OUT_KERNAL)) + { + data = m_kernal[offset & 0x1fff]; + } + if (!BIT(plaout, PLA_OUT_CHAROM)) + { + data = m_charom[offset & 0xfff]; + } + if (!BIT(plaout, PLA_OUT_IO)) + { + switch ((offset >> 8) & 0x0f) + { + case 0: + case 1: + case 2: + case 3: // VIC + data = m_vic->read(space, offset & 0x3f); + break; + + case 4: + case 5: + case 6: + case 7: // SID + data = m_sid->read(space, offset & 0x1f); + break; + + case 0x8: + case 0x9: + case 0xa: + case 0xb: // COLOR + data = m_color_ram[offset & 0x3ff] & 0x0f; + break; + + case 0xc: // CIA1 + data = m_cia1->read(space, offset & 0x0f); + break; + + case 0xd: // CIA2 + data = m_cia2->read(space, offset & 0x0f); + break; + + case 0xe: // I/O1 + io1 = 0; + break; + + case 0xf: // I/O2 + io2 = 0; + break; + } + } + + int roml = BIT(plaout, PLA_OUT_ROML); + int romh = BIT(plaout, PLA_OUT_ROMH); + return m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2); +} + + +//------------------------------------------------- +// write_memory - +//------------------------------------------------- + +void c64_state::write_memory(address_space &space, offs_t offset, UINT8 data, int aec, int ba) +{ + int rw = 0; + offs_t va = 0; + int io1 = 1, io2 = 1; + int sphi2 = m_vic->phi0_r(); + + int plaout = read_pla(offset, va, rw, !aec, ba); + + if (offset < 0x0002) + { + // write to internal CPU register + data = m_vic->bus_r(); + } + + if (!BIT(plaout, PLA_OUT_CASRAM)) + { + m_ram->pointer()[offset] = data; + } + if (!BIT(plaout, PLA_OUT_IO)) + { + switch ((offset >> 8) & 0x0f) + { + case 0: + case 1: + case 2: + case 3: // VIC + m_vic->write(space, offset & 0x3f, data); + break; + + case 4: + case 5: + case 6: + case 7: // SID + m_sid->write(space, offset & 0x1f, data); + break; + + case 0x8: + case 0x9: + case 0xa: + case 0xb: // COLOR + if (!BIT(plaout, PLA_OUT_GRW)) m_color_ram[offset & 0x3ff] = data & 0x0f; + break; + + case 0xc: // CIA1 + m_cia1->write(space, offset & 0x0f, data); + break; + + case 0xd: // CIA2 + m_cia2->write(space, offset & 0x0f, data); + break; + + case 0xe: // I/O1 + io1 = 0; + break; + + case 0xf: // I/O2 + io2 = 0; + break; + } + } + + int roml = BIT(plaout, PLA_OUT_ROML); + int romh = BIT(plaout, PLA_OUT_ROMH); + m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2); +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( c64_state::read ) +{ + int aec = 1, ba = 1; + + // VIC address bus is floating + offs_t va = 0x3fff; + + return read_memory(space, offset, va, aec, ba); +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( c64_state::write ) +{ + int aec = 1, ba = 1; + + write_memory(space, offset, data, aec, ba); +} + + +//------------------------------------------------- +// vic_videoram_r - +//------------------------------------------------- + +READ8_MEMBER( c64_state::vic_videoram_r ) +{ + int aec = m_vic->aec_r(), ba = m_vic->ba_r(); + offs_t va = offset; + + // A15/A14 are not connected to VIC so they are floating + //offset |= 0xc000; + + return read_memory(space, offset, va, aec, ba); +} + + +//------------------------------------------------- +// vic_colorram_r - +//------------------------------------------------- + +READ8_MEMBER( c64_state::vic_colorram_r ) +{ + UINT8 data; + + if (m_vic->aec_r()) + { + // TODO low nibble of last opcode + data = 0x0f; + } + else + { + data = m_color_ram[offset] & 0x0f; + } + + return data; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( c64_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( c64_mem, AS_PROGRAM, 8, c64_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_videoram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, c64_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_colorram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, c64_state ) + AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( c64 ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c64_state::write_restore ) +{ + m_restore = state; + + check_interrupts(); +} + +static INPUT_PORTS_START( c64 ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START( "RESTORE" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, c64_state, write_restore) + + PORT_START( "LOCK" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( c64sw ) +//------------------------------------------------- + +static INPUT_PORTS_START( c64sw ) + PORT_INCLUDE( c64 ) + + PORT_MODIFY( "ROW5" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_MODIFY( "ROW6" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('@') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( c64gs ) +//------------------------------------------------- + +static INPUT_PORTS_START( c64gs ) + // no keyboard +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// vic2_interface vic_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( c64_state::vic_irq_w ) +{ + m_vic_irq = state; + + check_interrupts(); +} + + +//------------------------------------------------- +// MOS6581_INTERFACE( sid_intf ) +//------------------------------------------------- + +READ8_MEMBER( c64_state::sid_potx_r ) +{ + UINT8 data = 0xff; + + switch (m_cia1->pa_r() >> 6) + { + case 1: data = m_joy1->pot_x_r(); break; + case 2: data = m_joy2->pot_x_r(); break; + case 3: + if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) + { + data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); + } + else if (m_joy1->has_pot_x()) + { + data = m_joy1->pot_x_r(); + } + else if (m_joy2->has_pot_x()) + { + data = m_joy2->pot_x_r(); + } + break; + } + + return data; +} + +READ8_MEMBER( c64_state::sid_poty_r ) +{ + UINT8 data = 0xff; + + switch (m_cia1->pa_r() >> 6) + { + case 1: data = m_joy1->pot_y_r(); break; + case 2: data = m_joy2->pot_y_r(); break; + case 3: + if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) + { + data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); + } + else if (m_joy1->has_pot_y()) + { + data = m_joy1->pot_y_r(); + } + else if (m_joy2->has_pot_y()) + { + data = m_joy2->pot_y_r(); + } + break; + } + + return data; +} + + +//------------------------------------------------- +// MOS6526_INTERFACE( cia1_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c64_state::cia1_irq_w ) +{ + m_cia1_irq = state; + + check_interrupts(); +} + +READ8_MEMBER( c64_state::cia1_pa_r ) +{ + /* + + bit description + + PA0 COL0, JOY B0 + PA1 COL1, JOY B1 + PA2 COL2, JOY B2 + PA3 COL3, JOY B3 + PA4 COL4, BTNB + PA5 COL5 + PA6 COL6 + PA7 COL7 + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy_b = m_joy2->joy_r(); + + data &= (0xf0 | (joy_b & 0x0f)); + data &= ~(!BIT(joy_b, 5) << 4); + + // keyboard + UINT8 cia1_pb = m_cia1->pb_r(); + UINT8 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), + m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; + + for (int i = 0; i < 8; i++) + { + if (!BIT(cia1_pb, i)) + { + if (!BIT(row[7], i)) data &= ~0x80; + if (!BIT(row[6], i)) data &= ~0x40; + if (!BIT(row[5], i)) data &= ~0x20; + if (!BIT(row[4], i)) data &= ~0x10; + if (!BIT(row[3], i)) data &= ~0x08; + if (!BIT(row[2], i)) data &= ~0x04; + if (!BIT(row[1], i)) data &= ~0x02; + if (!BIT(row[0], i)) data &= ~0x01; + } + } + + return data; +} + +WRITE8_MEMBER( c64_state::cia1_pa_w ) +{ + /* + + bit description + + PA0 COL0, JOY B0 + PA1 COL1, JOY B1 + PA2 COL2, JOY B2 + PA3 COL3, JOY B3 + PA4 COL4, BTNB + PA5 COL5 + PA6 COL6 + PA7 COL7 + + */ + + m_joy2->joy_w(data & 0x1f); +} + +READ8_MEMBER( c64_state::cia1_pb_r ) +{ + /* + + bit description + + PB0 ROW0, JOY A0 + PB1 ROW1, JOY A1 + PB2 ROW2, JOY A2 + PB3 ROW3, JOY A3 + PB4 ROW4, BTNA, _LP + PB5 ROW5 + PB6 ROW6 + PB7 ROW7 + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy_a = m_joy1->joy_r(); + + data &= (0xf0 | (joy_a & 0x0f)); + data &= ~(!BIT(joy_a, 5) << 4); + + // keyboard + UINT8 cia1_pa = m_cia1->pa_r(); + + if (!BIT(cia1_pa, 7)) data &= m_row7->read(); + if (!BIT(cia1_pa, 6)) data &= m_row6->read(); + if (!BIT(cia1_pa, 5)) data &= m_row5->read(); + if (!BIT(cia1_pa, 4)) data &= m_row4->read(); + if (!BIT(cia1_pa, 3)) data &= m_row3->read(); + if (!BIT(cia1_pa, 2)) data &= m_row2->read(); + if (!BIT(cia1_pa, 1)) data &= m_row1->read() & m_lock->read(); + if (!BIT(cia1_pa, 0)) data &= m_row0->read(); + + return data; +} + +WRITE8_MEMBER( c64_state::cia1_pb_w ) +{ + /* + + bit description + + PB0 ROW0, JOY A0 + PB1 ROW1, JOY A1 + PB2 ROW2, JOY A2 + PB3 ROW3, JOY A3 + PB4 ROW4, BTNA, _LP + PB5 ROW5 + PB6 ROW6 + PB7 ROW7 + + */ + + m_joy1->joy_w(data & 0x1f); + + m_vic->lp_w(BIT(data, 4)); +} + +READ8_MEMBER( c64gs_state::cia1_pa_r ) +{ + /* + + bit description + + PA0 JOY B0 + PA1 JOY B1 + PA2 JOY B2 + PA3 JOY B3 + PA4 BTNB + PA5 + PA6 + PA7 + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy_b = m_joy2->joy_r(); + + data &= (0xf0 | (joy_b & 0x0f)); + data &= ~(!BIT(joy_b, 5) << 4); + + return data; +} + +READ8_MEMBER( c64gs_state::cia1_pb_r ) +{ + /* + + bit description + + PB0 JOY A0 + PB1 JOY A1 + PB2 JOY A2 + PB3 JOY A3 + PB4 BTNA/_LP + PB5 + PB6 + PB7 + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy_a = m_joy1->joy_r(); + + data &= (0xf0 | (joy_a & 0x0f)); + data &= ~(!BIT(joy_a, 5) << 4); + + return data; +} + + +//------------------------------------------------- +// MOS6526_INTERFACE( cia2_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c64_state::cia2_irq_w ) +{ + m_cia2_irq = state; + + check_interrupts(); +} + +READ8_MEMBER( c64_state::cia2_pa_r ) +{ + /* + + bit description + + PA0 + PA1 + PA2 USER PORT + PA3 + PA4 + PA5 + PA6 CLK + PA7 DATA + + */ + + UINT8 data = 0; + + // user port + data |= m_user_pa2 << 2; + + // IEC bus + data |= m_iec->clk_r() << 6; + data |= m_iec->data_r() << 7; + + return data; +} + +WRITE8_MEMBER( c64_state::cia2_pa_w ) +{ + /* + + bit description + + PA0 _VA14 + PA1 _VA15 + PA2 USER PORT + PA3 ATN OUT + PA4 CLK OUT + PA5 DATA OUT + PA6 + PA7 + + */ + + // VIC banking + m_va14 = BIT(data, 0); + m_va15 = BIT(data, 1); + + // user port + m_user->write_m(BIT(data, 2)); + + // IEC bus + m_iec->atn_w(!BIT(data, 3)); + m_iec->clk_w(!BIT(data, 4)); + m_iec->data_w(!BIT(data, 5)); +} + +READ8_MEMBER( c64_state::cia2_pb_r ) +{ + return m_user_pb; +} + +WRITE8_MEMBER( c64_state::cia2_pb_w ) +{ + m_user->write_c((data>>0)&1); + m_user->write_d((data>>1)&1); + m_user->write_e((data>>2)&1); + m_user->write_f((data>>3)&1); + m_user->write_h((data>>4)&1); + m_user->write_j((data>>5)&1); + m_user->write_k((data>>6)&1); + m_user->write_l((data>>7)&1); +} + +//------------------------------------------------- +// M6510_INTERFACE( cpu_intf ) +//------------------------------------------------- + +READ8_MEMBER( c64_state::cpu_r ) +{ + /* + + bit description + + P0 1 + P1 1 + P2 1 + P3 + P4 CASS SENS + P5 0 + + */ + + UINT8 data = 0x07; + + data |= m_cassette->sense_r() << 4; + + return data; +} + +WRITE8_MEMBER( c64_state::cpu_w ) +{ + /* + + bit description + + P0 LORAM + P1 HIRAM + P2 CHAREN + P3 CASS WRT + P4 + P5 CASS MOTOR + + */ + + // memory banking + m_loram = BIT(data, 0); + m_hiram = BIT(data, 1); + m_charen = BIT(data, 2); + + // cassette write + m_cassette->write(BIT(data, 3)); + + // cassette motor + m_cassette->motor_w(BIT(data, 5)); +} + + +//------------------------------------------------- +// M6510_INTERFACE( sx64_cpu_intf ) +//------------------------------------------------- + +READ8_MEMBER( sx64_state::cpu_r ) +{ + /* + + bit description + + P0 1 + P1 1 + P2 1 + P3 + P4 + P5 + + */ + + return 0x07; +} + +WRITE8_MEMBER( sx64_state::cpu_w ) +{ + /* + + bit description + + P0 LORAM + P1 HIRAM + P2 CHAREN + P3 + P4 + P5 + + */ + + // memory banking + m_loram = BIT(data, 0); + m_hiram = BIT(data, 1); + m_charen = BIT(data, 2); +} + + +//------------------------------------------------- +// M6510_INTERFACE( c64gs_cpu_intf ) +//------------------------------------------------- + +READ8_MEMBER( c64gs_state::cpu_r ) +{ + /* + + bit description + + P0 1 + P1 1 + P2 1 + P3 + P4 + P5 + + */ + + return 0x07; +} + +WRITE8_MEMBER( c64gs_state::cpu_w ) +{ + /* + + bit description + + P0 LORAM + P1 HIRAM + P2 CHAREN + P3 + P4 + P5 + + */ + + // memory banking + m_loram = BIT(data, 0); + m_hiram = BIT(data, 1); + m_charen = BIT(data, 2); +} + + +//------------------------------------------------- +// C64_EXPANSION_INTERFACE( expansion_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( c64_state::exp_irq_w ) +{ + m_exp_irq = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( c64_state::exp_nmi_w ) +{ + m_exp_nmi = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( c64_state::exp_dma_w ) +{ + if (m_exp_dma != state) + { + m_exp_dma = state; + + m_maincpu->set_input_line(INPUT_LINE_HALT, m_exp_dma); + } +} + +WRITE_LINE_MEMBER( c64_state::exp_reset_w ) +{ + if (!state) + { + machine_reset(); + } +} + + +//------------------------------------------------- +// SLOT_INTERFACE( sx1541_iec_devices ) +//------------------------------------------------- + +SLOT_INTERFACE_START( sx1541_iec_devices ) + SLOT_INTERFACE("sx1541", SX1541) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( c64 ) +//------------------------------------------------- + +void c64_state::machine_start() +{ + // get pointers to ROMs + if (memregion("basic") != NULL) + { + m_basic = memregion("basic")->base(); + m_kernal = memregion("kernal")->base(); + } + else + { + m_basic = memregion("kernal")->base(); + m_kernal = &m_basic[0x2000]; + } + m_charom = memregion("charom")->base(); + + // allocate memory + m_color_ram.allocate(0x400); + + // initialize memory + UINT8 data = 0xff; + + for (offs_t offset = 0; offset < m_ram->size(); offset++) + { + m_ram->pointer()[offset] = data; + if (!(offset % 64)) data ^= 0xff; + } + + // state saving + save_item(NAME(m_loram)); + save_item(NAME(m_hiram)); + save_item(NAME(m_charen)); + save_item(NAME(m_va14)); + save_item(NAME(m_va15)); + save_item(NAME(m_cia1_irq)); + save_item(NAME(m_cia2_irq)); + save_item(NAME(m_vic_irq)); + save_item(NAME(m_exp_irq)); + save_item(NAME(m_exp_nmi)); + save_item(NAME(m_exp_dma)); + save_item(NAME(m_user_pb)); + save_item(NAME(m_user_pa2)); +} + + +void c64_state::machine_reset() +{ + m_maincpu->reset(); + + m_vic->reset(); + m_sid->reset(); + m_cia1->reset(); + m_cia2->reset(); + + m_iec->reset(); + m_exp->reset(); + + m_user->write_3(0); + m_user->write_3(1); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( ntsc ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ntsc, c64_state ) + // basic hardware + MCFG_CPU_ADD(M6510_TAG, M6510, XTAL_14_31818MHz/14) + MCFG_CPU_PROGRAM_MAP(c64_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_M6510_PORT_CALLBACKS(READ8(c64_state, cpu_r), WRITE8(c64_state, cpu_w)) + MCFG_M6510_PORT_PULLS(0x17, 0xc8) + MCFG_QUANTUM_PERFECT_CPU(M6510_TAG) + + // video hardware + MCFG_DEVICE_ADD(MOS6567_TAG, MOS6567, XTAL_14_31818MHz/14) + MCFG_MOS6566_CPU(M6510_TAG) + MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c64_state, vic_irq_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) + MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) + MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DEVICE(MOS6567_TAG, mos6567_device, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_14_31818MHz/14) + MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_PLS100_ADD(PLA_TAG) + MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_14_31818MHz/14) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia1_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia1_pa_r)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia1_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pb_w)) + MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_14_31818MHz/14) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia2_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia2_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia2_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pb_w)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) + MCFG_CBM_IEC_ADD("c1541") + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) + MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_9)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6567_TAG, mos6567_device, lp_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") + MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/14, c64_expansion_cards, NULL) + MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c64_state, exp_irq_w)) + MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c64_state, exp_nmi_w)) + MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c64_state, exp_reset_w)) + MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c64_state, read)) + MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c64_state, write)) + MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c64_state, exp_dma_w)) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) + MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c64_state, exp_reset_w)) + MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) + MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c64_state, write_user_pb0)) + MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c64_state, write_user_pb1)) + MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c64_state, write_user_pb2)) + MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c64_state, write_user_pb3)) + MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c64_state, write_user_pb4)) + MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c64_state, write_user_pb5)) + MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c64_state, write_user_pb6)) + MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c64_state, write_user_pb7)) + MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c64_state, write_user_pa2)) + + MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") + MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "c64_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "c64_flop") + MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("cass_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet64 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet64, ntsc ) + // TODO monochrome green palette +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( ntsc_sx ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ntsc_sx, sx64_state ) + MCFG_FRAGMENT_ADD(ntsc) + + // basic hardware + MCFG_CPU_MODIFY(M6510_TAG) + MCFG_M6510_PORT_CALLBACKS(READ8(sx64_state, cpu_r), WRITE8(sx64_state, cpu_w)) + MCFG_M6510_PORT_PULLS(0x07, 0xc0) + + // devices + MCFG_DEVICE_MODIFY("iec8") + MCFG_DEVICE_SLOT_INTERFACE(sx1541_iec_devices, "sx1541", false) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( ntsc_dx ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ntsc_dx, sx64_state ) + MCFG_FRAGMENT_ADD(ntsc_sx) + + // devices + MCFG_DEVICE_MODIFY("iec9") + MCFG_DEVICE_SLOT_INTERFACE(sx1541_iec_devices, "sx1541", false) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( ntsc_c ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( ntsc_c, ntsc, c64c_state ) + MCFG_SOUND_REPLACE(MOS6581_TAG, MOS8580, XTAL_14_31818MHz/14) + MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pal ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pal, c64_state ) + // basic hardware + MCFG_CPU_ADD(M6510_TAG, M6510, XTAL_17_734472MHz/18) + MCFG_CPU_PROGRAM_MAP(c64_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_M6510_PORT_CALLBACKS(READ8(c64_state, cpu_r), WRITE8(c64_state, cpu_w)) + MCFG_M6510_PORT_PULLS(0x17, 0xc8) + MCFG_QUANTUM_PERFECT_CPU(M6510_TAG) + + // video hardware + MCFG_DEVICE_ADD(MOS6569_TAG, MOS6569, XTAL_17_734472MHz/18) + MCFG_MOS6566_CPU(M6510_TAG) + MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c64_state, vic_irq_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) + MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) + MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DEVICE(MOS6569_TAG, mos6569_device, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_17_734472MHz/18) + MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_PLS100_ADD(PLA_TAG) + MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_17_734472MHz/18) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia1_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia1_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia1_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pb_w)) + MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz/18) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia2_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia2_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia2_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pb_w)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) + MCFG_CBM_IEC_ADD("c1541") + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) + MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_9)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") + MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_17_734472MHz/18, c64_expansion_cards, NULL) + MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c64_state, exp_irq_w)) + MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c64_state, exp_nmi_w)) + MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c64_state, exp_reset_w)) + MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c64_state, read)) + MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c64_state, write)) + MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c64_state, exp_dma_w)) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) + MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c64_state, exp_reset_w)) + MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) + MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c64_state, write_user_pb0)) + MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c64_state, write_user_pb1)) + MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c64_state, write_user_pb2)) + MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c64_state, write_user_pb3)) + MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c64_state, write_user_pb4)) + MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c64_state, write_user_pb5)) + MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c64_state, write_user_pb6)) + MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c64_state, write_user_pb7)) + MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c64_state, write_user_pa2)) + + MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") + MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "c64_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "c64_flop") + MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "PAL") + MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "PAL") + MCFG_SOFTWARE_LIST_FILTER("cass_list", "PAL") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pal_sx ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pal_sx, sx64_state ) + MCFG_FRAGMENT_ADD(pal) + + // basic hardware + MCFG_CPU_MODIFY(M6510_TAG) + MCFG_M6510_PORT_CALLBACKS(READ8(sx64_state, cpu_r), WRITE8(sx64_state, cpu_w)) + MCFG_M6510_PORT_PULLS(0x07, 0xc0) + + // devices + MCFG_DEVICE_MODIFY("iec8") + MCFG_DEVICE_SLOT_INTERFACE(sx1541_iec_devices, "sx1541", false) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pal_c ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( pal_c, pal, c64c_state ) + MCFG_SOUND_REPLACE(MOS6581_TAG, MOS8580, XTAL_17_734472MHz/18) + MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pal_gs ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pal_gs, c64gs_state ) + // basic hardware + MCFG_CPU_ADD(M6510_TAG, M6510, XTAL_17_734472MHz/18) + MCFG_CPU_PROGRAM_MAP(c64_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_M6510_PORT_CALLBACKS(READ8(c64gs_state, cpu_r), WRITE8(c64gs_state, cpu_w)) + MCFG_M6510_PORT_PULLS(0x07, 0xc0) + MCFG_QUANTUM_PERFECT_CPU(M6510_TAG) + + // video hardware + MCFG_DEVICE_ADD(MOS6569_TAG, MOS8565, XTAL_17_734472MHz/18) + MCFG_MOS6566_CPU(M6510_TAG) + MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c64_state, vic_irq_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) + MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) + MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DEVICE(MOS6569_TAG, mos8565_device, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS8580, XTAL_17_734472MHz/18) + MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_PLS100_ADD(PLA_TAG) + MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_17_734472MHz/18) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia1_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64gs_state, cia1_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64gs_state, cia1_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pb_w)) + MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz/18) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia2_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia2_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia2_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pb_w)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) + MCFG_CBM_IEC_ADD(NULL) + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) + MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_9)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") + MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_17_734472MHz/18, c64_expansion_cards, NULL) + MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c64_state, exp_irq_w)) + MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c64_state, exp_nmi_w)) + MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c64_state, exp_reset_w)) + MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c64_state, read)) + MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c64_state, write)) + MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c64_state, exp_dma_w)) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) + MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c64_state, exp_reset_w)) + MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) + MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) + MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) + MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c64_state, write_user_pb0)) + MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c64_state, write_user_pb1)) + MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c64_state, write_user_pb2)) + MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c64_state, write_user_pb3)) + MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c64_state, write_user_pb4)) + MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c64_state, write_user_pb5)) + MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c64_state, write_user_pb6)) + MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c64_state, write_user_pb7)) + MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c64_state, write_user_pa2)) + + MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") + MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") + MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "PAL") + MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "PAL") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( c64 ) +//------------------------------------------------- + +ROM_START( c64 ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_DEFAULT_BIOS("r3") + ROM_SYSTEM_BIOS(0, "r1", "Kernal rev. 1" ) + ROMX_LOAD( "901227-01.u4", 0x0000, 0x2000, CRC(dce782fa) SHA1(87cc04d61fc748b82df09856847bb5c2754a2033), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "r2", "Kernal rev. 2" ) + ROMX_LOAD( "901227-02.u4", 0x0000, 0x2000, CRC(a5c687b3) SHA1(0e2e4ee3f2d41f00bed72f9ab588b83e306fdb13), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "r3", "Kernal rev. 3" ) + ROMX_LOAD( "901227-03.u4", 0x0000, 0x2000, CRC(dbe3e7c7) SHA1(1d503e56df85a62fee696e7618dc5b4e781df1bb), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "jiffydos", "JiffyDOS v6.01" ) + ROMX_LOAD( "jiffydos c64.u4", 0x0000, 0x2000, CRC(2f79984c) SHA1(31e73e66eccb28732daea8ec3ad1addd9b39a017), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS(4, "speeddos", "SpeedDOS" ) + ROMX_LOAD( "speed-dos.u4", 0x0000, 0x2000, CRC(5beb9ac8) SHA1(8896c8de9e26ef1396eb46020b2de346a3eeab7e), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS(5, "speeddos20", "SpeedDOS-Plus+ v2.0" ) + ROMX_LOAD( "speed-dosplus.u4", 0x0000, 0x2000, CRC(10aee0ae) SHA1(6cebd4dc0c5e8c0b073586a3f1c43cc3349b9736), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS(6, "speeddos27", "SpeedDOS-Plus+ v2.7" ) + ROMX_LOAD( "speed-dosplus27.u4", 0x0000, 0x2000, CRC(ff59995e) SHA1(c8d864e5fc7089af8afce97dc0a0224df11df1c3), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS(7, "prodos", "Professional-DOS v1" ) + ROMX_LOAD( "prodos.u4", 0x0000, 0x2000, CRC(37ed83a2) SHA1(35f4f0fe03c0b7b3762b526ba855de41b496fb60), ROM_BIOS(8) ) + ROM_SYSTEM_BIOS(8, "prodos2", "Professional-DOS Release 2/4L2" ) + ROMX_LOAD( "prodos24l2.u4", 0x0000, 0x2000, CRC(41dad9fe) SHA1(fbf3dcc2ed40e58b07595740ea6fbff7ab19ebad), ROM_BIOS(9) ) + ROM_SYSTEM_BIOS(9, "prodos3", "Professional-DOS Release 3/5L2" ) + ROMX_LOAD( "prodos35l2.u4", 0x0000, 0x2000, CRC(2822eee7) SHA1(77356b84c1648018863d1c8dd5bc3a37485bc00e), ROM_BIOS(10) ) + ROM_SYSTEM_BIOS(10, "turborom", "Cockroach Turbo-ROM" ) + ROMX_LOAD( "turborom.u4", 0x0000, 0x2000, CRC(e6c763a2) SHA1(eff5a4b6bc65daa9421bd3856dd99a3195068e1c), ROM_BIOS(11) ) + ROM_SYSTEM_BIOS(11, "dosrom", "DOS-ROM v1.2" ) + ROMX_LOAD( "dosrom12.u4", 0x0000, 0x2000, CRC(ac030fc0) SHA1(0e4b38e81b49f55d52162154a44f0fffd2b0d04f), ROM_BIOS(12) ) + ROM_SYSTEM_BIOS(12, "turborom2", "Datel Turbo ROM II (PAL)" ) + ROMX_LOAD( "turborom2.u4", 0x0000, 0x2000, CRC(ea3ba683) SHA1(4bb23f764a3d255119fbae37202ca820caa04e1f), ROM_BIOS(13) ) + ROM_SYSTEM_BIOS(13, "mercury", "Mercury-ROM v3 (NTSC)" ) + ROMX_LOAD( "mercury3.u4", 0x0000, 0x2000, CRC(6eac46a2) SHA1(4e351aa5fcb97c4c21e565aa2c830cc09bd47533), ROM_BIOS(14) ) + ROM_SYSTEM_BIOS(14, "dolphin", "Dolphin-DOS 1.0" ) + ROMX_LOAD( "kernal-10-mager.u4", 0x0000, 0x2000, CRC(c9bb21bc) SHA1(e305216e50ff8a7acf102be6c6343e3d44a16233), ROM_BIOS(15) ) + ROM_SYSTEM_BIOS(15, "dolphin201au", "Dolphin-DOS 2.0 1 au" ) + ROMX_LOAD( "kernal-20-1_au.u4", 0x0000, 0x2000, CRC(7068bbcc) SHA1(325ce7e32609a8fc704aaa76f5eb4cd7d8099a92), ROM_BIOS(16) ) + ROM_SYSTEM_BIOS(16, "dolphin201", "Dolphin-DOS 2.0 1" ) + ROMX_LOAD( "kernal-20-1.u4", 0x0000, 0x2000, CRC(c9c4c44e) SHA1(7f5d8f08c5ed2182ffb415a3d777fdd922496d02), ROM_BIOS(17) ) + ROM_SYSTEM_BIOS(17, "dolphin202", "Dolphin-DOS 2.0 2" ) + ROMX_LOAD( "kernal-20-2.u4", 0x0000, 0x2000, CRC(ffaeb9bc) SHA1(5f6c1bad379da16f77bccb58e80910f307dfd5f8), ROM_BIOS(18) ) + ROM_SYSTEM_BIOS(18, "dolphin203", "Dolphin-DOS 2.0 3" ) + ROMX_LOAD( "kernal-20-3.u4", 0x0000, 0x2000, CRC(4fd511f2) SHA1(316fba280dcb29496d593c0c4e3ee9a19844054e), ROM_BIOS(19) ) + ROM_SYSTEM_BIOS(19, "dolphin30", "Dolphin-DOS 3.0" ) + ROMX_LOAD( "kernal-30.u4", 0x0000, 0x2000, CRC(5402d643) SHA1(733acb96fead2fb4df77840c5bb618f08439fc7e), ROM_BIOS(20) ) + ROM_SYSTEM_BIOS(20, "taccess", "TurboAccess v2.6" ) + ROMX_LOAD( "turboaccess26.u4", 0x0000, 0x2000, CRC(93de6cd9) SHA1(a74478f3b9153c13176eac80ebfacc512ae7cbf0), ROM_BIOS(21) ) + ROM_SYSTEM_BIOS(21, "ttrans301", "TurboTrans v3.0 1" ) + ROMX_LOAD( "turboaccess301.u4", 0x0000, 0x2000, CRC(b3304dcf) SHA1(4d47a265ef65e4823f862cfc3d514c2a71473580), ROM_BIOS(22) ) + ROM_SYSTEM_BIOS(22, "ttrans302", "TurboTrans v3.0 2" ) + ROMX_LOAD( "turboaccess302.u4", 0x0000, 0x2000, CRC(9e696a7b) SHA1(5afae75d66d539f4bb4af763f029f0ef6523a4eb), ROM_BIOS(23) ) + ROM_SYSTEM_BIOS(23, "tprocess", "Turbo-Process (PAL)" ) + ROMX_LOAD( "turboprocess.u4", 0x0000, 0x2000, CRC(e5610d76) SHA1(e3f35777cfd16cce4717858f77ff354763395ba9), ROM_BIOS(24) ) + ROM_SYSTEM_BIOS(24, "tprocessn", "Turbo-Process (NTSC)" ) + ROMX_LOAD( "turboprocessus.u4", 0x0000, 0x2000, CRC(7480b76a) SHA1(ef1664b5057ae3cc6d104fc2f5c1fb29ee5a1b2b), ROM_BIOS(25) ) + ROM_SYSTEM_BIOS(25, "exos3", "EXOS v3" ) + ROMX_LOAD( "exos3.u4", 0x0000, 0x2000, CRC(4e54d020) SHA1(f8931b7c0b26807f4de0cc241f0b1e2c8f5271e9), ROM_BIOS(26) ) + ROM_SYSTEM_BIOS(26, "exos4", "EXOS v4" ) + ROMX_LOAD( "exos4.u4", 0x0000, 0x2000, CRC(d5cf83a9) SHA1(d5f03a5c0e9d00032d4751ecc6bcd6385879c9c7), ROM_BIOS(27) ) + ROM_SYSTEM_BIOS(27, "digidos", "DigiDOS" ) + ROMX_LOAD( "digidos.u4", 0x0000, 0x2000, CRC(2b0c8e89) SHA1(542d6f61c318bced0642e7c2d4d3b34a0f13e634), ROM_BIOS(28) ) + ROM_SYSTEM_BIOS(28, "magnum", "Magnum Load" ) + ROMX_LOAD( "magnum.u4", 0x0000, 0x2000, CRC(b2cffcc6) SHA1(827c782c1723b5d0992c05c00738ae4b2133b641), ROM_BIOS(29) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "906114-01.u17", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( c64_jp ) +//------------------------------------------------- + +ROM_START( c64_jp ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "906145-02.u4", 0x0000, 0x2000, CRC(3a9ef6f1) SHA1(4ff0f11e80f4b57430d8f0c3799ed0f0e0f4565d) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "906143-02.u5", 0x0000, 0x1000, CRC(1604f6c1) SHA1(0fad19dbcdb12461c99657b2979dbb5c2e47b527) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "906114-01.u17", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( c64p ) +//------------------------------------------------- + +#define rom_c64p rom_c64 + + +//------------------------------------------------- +// ROM( c64_se ) +//------------------------------------------------- + +ROM_START( c64_se ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "kernel.u4", 0x0000, 0x2000, CRC(f10c2c25) SHA1(e4f52d9b36c030eb94524eb49f6f0774c1d02e5e) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_SYSTEM_BIOS( 0, "default", "Swedish Characters" ) + ROMX_LOAD( "charswe.u5", 0x0000, 0x1000, CRC(bee9b3fd) SHA1(446ae58f7110d74d434301491209299f66798d8a), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "alt", "Swedish Characters (Alt)" ) + ROMX_LOAD( "charswe2.u5", 0x0000, 0x1000, CRC(377a382b) SHA1(20df25e0ba1c88f31689c1521397c96968967fac), ROM_BIOS(2) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "906114-01.u17", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( pet64 ) +//------------------------------------------------- + +ROM_START( pet64 ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "901246-01.u4", 0x0000, 0x2000, CRC(789c8cc5) SHA1(6c4fa9465f6091b174df27dfe679499df447503c) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "906114-01.u17", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( edu64 ) +//------------------------------------------------- + +#define rom_edu64 rom_c64 + + +//------------------------------------------------- +// ROM( sx64 ) +//------------------------------------------------- + +ROM_START( sx64 ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901226-01.ud4", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_SYSTEM_BIOS(0, "cbm", "Original" ) + ROMX_LOAD( "251104-04.ud3", 0x0000, 0x2000, CRC(2c5965d4) SHA1(aa136e91ecf3c5ac64f696b3dbcbfc5ba0871c98), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "jiffydos", "JiffyDOS v6.01" ) + ROMX_LOAD( "jiffydos sx64.ud3", 0x0000, 0x2000, CRC(2b5a88f5) SHA1(942c2150123dc30f40b3df6086132ef0a3c43948), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "1541flash", "1541 FLASH!" ) + ROMX_LOAD( "1541 flash.ud3", 0x0000, 0x2000, CRC(0a1c9b85) SHA1(0bfcaab0ae453b663a6e01cd59a9764805419e00), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "turborom", "Cockroach Turbo-ROM" ) + ROMX_LOAD( "turboromsx.u4", 0x0000, 0x2000, CRC(48579c30) SHA1(6c907fdd07c14e162eb8c8fb750b1bbaf69dccb4), ROM_BIOS(4) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901225-01.ud1", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "906114-01.ue4", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( rom_sx64p ) +//------------------------------------------------- + +#define rom_sx64p rom_sx64 + + +//------------------------------------------------- +// ROM( vip64 ) +//------------------------------------------------- + +ROM_START( vip64 ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901226-01.ud4", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "kernelsx.ud3", 0x0000, 0x2000, CRC(7858d3d7) SHA1(097cda60469492a8916c2677b7cce4e12a944bc0) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "charswe.ud1", 0x0000, 0x1000, CRC(bee9b3fd) SHA1(446ae58f7110d74d434301491209299f66798d8a) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "906114-01.ue4", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( dx64 ) +//------------------------------------------------- + +// ROM_LOAD( "dx64kern.bin", 0x0000, 0x2000, CRC(58065128) ) TODO where is this illusive ROM? +#define rom_dx64 rom_sx64 + + +//------------------------------------------------- +// ROM( tesa6240 ) +//------------------------------------------------- + +ROM_START( tesa6240 ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "tesa-basic.ud4", 0x0000, 0x2000, CRC(f319d661) SHA1(0033afa7d2fbff314d80427324633c5444fbf1cd) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "tesa-kernal.ud3", 0x0000, 0x2000, CRC(af638f9c) SHA1(a2c9c83f598623c9940949979ac643f12397e907) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "tesa-char.ud1", 0x0000, 0x1000, CRC(10765a90) SHA1(1b824df5a295d0479e830e272758640b9fe99344) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "906114-01.ue4", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( c64c ) +//------------------------------------------------- + +ROM_START( c64c ) + ROM_REGION( 0x4000, "kernal", 0 ) + ROM_DEFAULT_BIOS("cbm") + ROM_SYSTEM_BIOS(0, "cbm", "Original" ) + ROMX_LOAD( "251913-01.u4", 0x0000, 0x4000, CRC(0010ec31) SHA1(765372a0e16cbb0adf23a07b80f6b682b39fbf88), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "pdc", "ProLogic-DOS Classic" ) + ROMX_LOAD( "pdc.u4", 0x0000, 0x4000, CRC(6b653b9c) SHA1(0f44a9c62619424a0cd48a90e1b377b987b494e0), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "252715-01.u8", 0x00, 0xf5, BAD_DUMP CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( c64cp ) +//------------------------------------------------- + +#define rom_c64cp rom_c64c + + +//------------------------------------------------- +// ROM( c64g ) +//------------------------------------------------- + +#define rom_c64g rom_c64c + + +//------------------------------------------------- +// ROM( c64c_es ) +//------------------------------------------------- + +ROM_START( c64c_es ) + ROM_REGION( 0x4000, "kernal", 0 ) + ROM_LOAD( "251913-01.u4", 0x0000, 0x4000, CRC(0010ec31) SHA1(765372a0e16cbb0adf23a07b80f6b682b39fbf88) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "325056-03.u5", 0x0000, 0x1000, CRC(c890c175) SHA1(4f57259fff9ef1963a4e87165a6f35ca23864c76) ) // aka 325245-01 + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "252715-01.u8", 0x00, 0xf5, BAD_DUMP CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( c64c_se ) +//------------------------------------------------- + +ROM_START( c64c_se ) + ROM_REGION( 0x4000, "kernal", 0 ) + ROM_LOAD( "325182-01.u4", 0x0000, 0x4000, CRC(2aff27d3) SHA1(267654823c4fdf2167050f41faa118218d2569ce) ) // 128/64 FI + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "cbm 64 skand.gen.u5", 0x0000, 0x1000, CRC(377a382b) SHA1(20df25e0ba1c88f31689c1521397c96968967fac) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "252715-01.u8", 0x00, 0xf5, BAD_DUMP CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + +//------------------------------------------------- +// ROM( c64gs ) +//------------------------------------------------- + +ROM_START( c64gs ) + ROM_REGION( 0x4000, "kernal", 0 ) + ROM_LOAD( "390852-01.u4", 0x0000, 0x4000, CRC(b0a9c2da) SHA1(21940ef5f1bfe67d7537164f7ca130a1095b067a) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "252535-01.u8", 0x00, 0xf5, BAD_DUMP CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1982, c64, 0, 0, ntsc, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1982, c64_jp, c64, 0, ntsc, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64 (Japan)", MACHINE_SUPPORTS_SAVE ) +COMP( 1982, c64p, c64, 0, pal, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64 (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1982, c64_se, c64, 0, pal, c64sw, driver_device, 0, "Commodore Business Machines", "Commodore 64 / VIC-64S (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, pet64, c64, 0, pet64, c64, driver_device, 0, "Commodore Business Machines", "PET 64 / CBM 4064 (NTSC)", MACHINE_SUPPORTS_SAVE | MACHINE_WRONG_COLORS ) +COMP( 1983, edu64, c64, 0, pet64, c64, driver_device, 0, "Commodore Business Machines", "Educator 64 (NTSC)", MACHINE_SUPPORTS_SAVE | MACHINE_WRONG_COLORS ) +COMP( 1984, sx64, c64, 0, ntsc_sx, c64, driver_device, 0, "Commodore Business Machines", "SX-64 / Executive 64 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, sx64p, c64, 0, pal_sx, c64, driver_device, 0, "Commodore Business Machines", "SX-64 / Executive 64 (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, vip64, c64, 0, pal_sx, c64sw, driver_device, 0, "Commodore Business Machines", "VIP-64 (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, dx64, c64, 0, ntsc_dx, c64, driver_device, 0, "Commodore Business Machines", "DX-64 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, tesa6240,c64, 0, pal_sx, c64, driver_device, 0, "Tesa Etikett", "Etikettendrucker 6240", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, c64c, c64, 0, ntsc_c, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64C (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, c64cp, c64, 0, pal_c, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64C (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1988, c64c_es, c64, 0, pal_c, c64sw, driver_device, 0, "Commodore Business Machines", "Commodore 64C (Spain)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, c64c_se, c64, 0, pal_c, c64sw, driver_device, 0, "Commodore Business Machines", "Commodore 64C (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, c64g, c64, 0, pal_c, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64G (PAL)", MACHINE_SUPPORTS_SAVE ) +CONS( 1990, c64gs, c64, 0, pal_gs, c64gs, driver_device, 0, "Commodore Business Machines", "Commodore 64 Games System (PAL)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/c64dtv.c b/src/mame/drivers/c64dtv.c new file mode 100644 index 00000000000..4b707dfa585 --- /dev/null +++ b/src/mame/drivers/c64dtv.c @@ -0,0 +1,68 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "emu.h" + + +//************************************************************************** +// DRIVER STATE +//************************************************************************** + +class c64dtv_state : public driver_device +{ +public: + // constructor + c64dtv_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) { } + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) + { + bitmap.fill(rgb_t::black); + return 0; + } +}; + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +static INPUT_PORTS_START( c64dtv ) +INPUT_PORTS_END + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static MACHINE_CONFIG_START( c64dtv, c64dtv_state ) + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(c64dtv_state, screen_update) + MCFG_SCREEN_SIZE(640,480) + MCFG_SCREEN_VISIBLE_AREA(0,639, 0,479) + MCFG_SCREEN_REFRESH_RATE(30) +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +// BASIC sits at 0xa000-0xc000, chargen-like chunks sit at 0x1000-0x2000, 0x9000-0xa000 and 0xd000-0xe000 +// kernel sits at 0xe000 +// from 0x10000 on there are the games +ROM_START( c64dtv ) + ROM_REGION( 0x200000, "asic", 0 ) + ROM_LOAD( "flash.u2", 0x000000, 0x200000, CRC(b820375a) SHA1(b9f88919e2bed825eb2b2cb605977d55971b423b) ) +ROM_END + + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +CONS( 2005, c64dtv, 0, 0, c64dtv, c64dtv, driver_device, 0, "The Toy:Lobster Company", "Commodore 64 Direct-to-TV (Version 2 050711) (PAL)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/c65.c b/src/mame/drivers/c65.c new file mode 100644 index 00000000000..f2160b9e2cd --- /dev/null +++ b/src/mame/drivers/c65.c @@ -0,0 +1,669 @@ +// license:LGPL-2.1+ +// copyright-holders: Angelo Salese +/*************************************************************************** + +C=65 / C=64DX (c) 1991 Commodore + +Attempt at rewriting the driver ... + +TODO: +- I need to subtract border color to -1 in order to get blue color (-> register is 6 and blue color is 5 in palette array). + Also top-left logo seems to draw wrong palette for entries 4,5,6,7. CPU core bug? + +Note: +- VIC-4567 will be eventually be added via compile switch, once that I + get the hang of the system (and checking where the old code fails + eventually) + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/m6502/m4510.h" +#include "machine/mos6526.h" + +#define MAIN_CLOCK XTAL_3_5MHz + +class c65_state : public driver_device +{ +public: + c65_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cia0(*this, "cia_0"), + m_cia1(*this, "cia_1"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_workram(*this, "wram"), + m_palred(*this, "redpal"), + m_palgreen(*this, "greenpal"), + m_palblue(*this, "bluepal"), + m_dmalist(*this, "dmalist"), + m_cram(*this, "cram"), + m_gfxdecode(*this, "gfxdecode") + { } + + // devices + required_device m_maincpu; + required_device m_cia0; + required_device m_cia1; + required_device m_screen; + required_device m_palette; + required_shared_ptr m_workram; + required_shared_ptr m_palred; + required_shared_ptr m_palgreen; + required_shared_ptr m_palblue; + required_shared_ptr m_dmalist; + required_shared_ptr m_cram; + required_device m_gfxdecode; + + UINT8 *m_iplrom; + UINT8 m_keyb_input[10]; + UINT8 m_keyb_mux; + + DECLARE_READ8_MEMBER(vic4567_dummy_r); + DECLARE_WRITE8_MEMBER(vic4567_dummy_w); + DECLARE_WRITE8_MEMBER(PalRed_w); + DECLARE_WRITE8_MEMBER(PalGreen_w); + DECLARE_WRITE8_MEMBER(PalBlue_w); + DECLARE_WRITE8_MEMBER(DMAgic_w); + DECLARE_READ8_MEMBER(CIASelect_r); + DECLARE_WRITE8_MEMBER(CIASelect_w); + DECLARE_READ8_MEMBER(cia0_porta_r); + DECLARE_WRITE8_MEMBER(cia0_porta_w); + DECLARE_READ8_MEMBER(cia0_portb_r); + DECLARE_WRITE8_MEMBER(cia0_portb_w); + DECLARE_WRITE_LINE_MEMBER(cia0_irq); + + DECLARE_READ8_MEMBER(dummy_r); + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_PALETTE_INIT(c65); + DECLARE_DRIVER_INIT(c65); + DECLARE_DRIVER_INIT(c65pal); + + INTERRUPT_GEN_MEMBER(vic3_vblank_irq); +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); +private: + UINT8 m_VIC2_IRQPend, m_VIC2_IRQMask; + /* 0x20: border color (TODO: different thread?) */ + UINT8 m_VIC2_EXTColor; + /* 0x30: banking + PAL + EXT SYNC */ + UINT8 m_VIC3_ControlA; + /* 0x31: video modes */ + UINT8 m_VIC3_ControlB; + void PalEntryFlush(UINT8 offset); + void DMAgicExecute(address_space &space,UINT32 address); + void IRQCheck(UINT8 irq_cause); + int inner_x_char(int xoffs); + int inner_y_char(int yoffs); +}; + +void c65_state::video_start() +{ +} + +// TODO: inline? +int c65_state::inner_x_char(int xoffs) +{ + return xoffs>>3; +} + +int c65_state::inner_y_char(int yoffs) +{ + return yoffs>>3; +} + +UINT32 c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + int y,x; + int border_color = m_VIC2_EXTColor & 0xf; + + // TODO: border area + for(y=0;yheight();y++) + { + for(x=0;xwidth();x++) + { + //int, xi,yi,xm,ym,dot_x; + int xi = inner_x_char(x); + int yi = inner_y_char(y); + int xm = 7 - (x & 7); + int ym = (y & 7); + UINT8 tile = m_workram[xi+yi*80+0x800]; + UINT8 attr = m_cram[xi+yi*80]; + if(attr & 0xf0) + attr = machine().rand() & 0xf; + + int enable_dot = ((m_iplrom[(tile<<3)+ym+0xd000] >> xm) & 1); + + //if(cliprect.contains(x, y)) + bitmap.pix16(y, x) = m_palette->pen((enable_dot) ? attr & 0xf : border_color); + + + //gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); + } + } + + return 0; +} + +READ8_MEMBER(c65_state::vic4567_dummy_r) +{ + UINT8 res; + + res=0xff; + switch(offset) + { + case 0x11: + res = (m_screen->vpos() & 0x100) >> 1; + return res; + case 0x12: + res = (m_screen->vpos() & 0xff); + return res; + case 0x15: + return 0xff; // silence log for now + case 0x19: + return m_VIC2_IRQPend; + + case 0x1a: + return m_VIC2_IRQMask; + + case 0x20: + return m_VIC2_EXTColor; + + case 0x30: + return m_VIC3_ControlA; + case 0x31: + return m_VIC3_ControlB; + } + + if(!space.debugger_access()) + printf("%02x\n",offset); // TODO: PC + return res; +} + +WRITE8_MEMBER(c65_state::vic4567_dummy_w) +{ + switch(offset) + { + case 0x19: + m_VIC2_IRQPend &= ~data; + IRQCheck(0); + break; + case 0x1a: + m_VIC2_IRQMask = data & 0xf; + IRQCheck(0); + break; + case 0x20: + m_VIC2_EXTColor = data & 0xf; + break; + /* KEY register, handles vic-iii and vic-ii modes via two consecutive writes + 0xa5 -> 0x96 vic-iii mode + any other write vic-ii mode + */ + //case 0x2f: break; + case 0x30: + if((data & 0xfe) != 0x64) + printf("CONTROL A %02x\n",data); + m_VIC3_ControlA = data; + break; + case 0x31: + printf("CONTROL B %02x\n",data); + m_VIC3_ControlB = data; + break; + default: + if(!space.debugger_access()) + printf("%02x %02x\n",offset,data); + break; + } + +} + +void c65_state::PalEntryFlush(UINT8 offset) +{ + m_palette->set_pen_color(offset, pal4bit(m_palred[offset]), pal4bit(m_palgreen[offset]), pal4bit(m_palblue[offset])); +} + +WRITE8_MEMBER(c65_state::PalRed_w) +{ + m_palred[offset] = data; + PalEntryFlush(offset); +} + +WRITE8_MEMBER(c65_state::PalGreen_w) +{ + m_palgreen[offset] = data; + PalEntryFlush(offset); +} + +WRITE8_MEMBER(c65_state::PalBlue_w) +{ + m_palblue[offset] = data; + PalEntryFlush(offset); +} + +void c65_state::DMAgicExecute(address_space &space,UINT32 address) +{ + UINT8 cmd;// = space.read_byte(address++); + UINT16 length; //= space.read_byte(address++); + UINT32 src, dst; + static const char *const dma_cmd_string[] = + { + "COPY", // 0 + "MIX", + "SWAP", + "FILL" + }; + cmd = space.read_byte(address++); + length = space.read_byte(address++); + length|=(space.read_byte(address++)<<8); + src = space.read_byte(address++); + src|=(space.read_byte(address++)<<8); + src|=(space.read_byte(address++)<<16); + dst = space.read_byte(address++); + dst|=(space.read_byte(address++)<<8); + dst|=(space.read_byte(address++)<<16); + + if(cmd & 0xfc) + printf("%02x\n",cmd & 0xfc); + switch(cmd & 3) + { + case 0: // copy - TODO: untested + { + if(length != 1) + printf("DMAgic %s %02x -> %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src,dst,length,cmd & 4 ? "yes" : "no"); + UINT32 SourceIndex; + UINT32 DestIndex; + UINT16 SizeIndex; + SourceIndex = src & 0xfffff; + DestIndex = dst & 0xfffff; + SizeIndex = length; + do + { + space.write_byte(DestIndex++,space.read_byte(SourceIndex++)); + SizeIndex--; + }while(SizeIndex != 0); + + return; + } + case 3: // fill + { + /* TODO: upper bits of source */ + printf("DMAgic %s %02x -> %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src & 0xff,dst,length,cmd & 4 ? "yes" : "no"); + UINT8 FillValue; + UINT32 DestIndex; + UINT16 SizeIndex; + FillValue = src & 0xff; + DestIndex = dst & 0xfffff; + SizeIndex = length; + do + { + space.write_byte(DestIndex++,FillValue); + SizeIndex--; + }while(SizeIndex != 0); + } + return; + } + printf("DMAgic %s %08x %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src,dst,length,cmd & 4 ? "yes" : "no"); +} + + +WRITE8_MEMBER(c65_state::DMAgic_w) +{ + m_dmalist[offset] = data; + if(offset == 0) + DMAgicExecute(space,(m_dmalist[0])|(m_dmalist[1]<<8)|(m_dmalist[2]<<16)); +} + +READ8_MEMBER(c65_state::CIASelect_r) +{ + if(m_VIC3_ControlA & 1) + return m_cram[offset]; + else + { + // CIA at 0xdc00 + switch((offset & 0x700) | 0x800) + { + case 0xc00: + return m_cia0->read(space,offset); + case 0xd00: + return m_cia1->read(space,offset); + default: + printf("Unknown I/O access read to offset %04x\n",offset); + break; + } + + } + + return 0xff; +} + +WRITE8_MEMBER(c65_state::CIASelect_w) +{ + if(m_VIC3_ControlA & 1) + m_cram[offset] = data; + else + { + // CIA at 0xdc00 + switch((offset & 0x700) | 0x800) + { + case 0xc00: + m_cia0->write(space,offset,data); + break; + + case 0xd00: + m_cia1->write(space,offset,data); + break; + default: + printf("Unknown I/O access write to offset %04x data = %02x\n",offset,data); + break; + } + } + +} + +READ8_MEMBER(c65_state::cia0_porta_r) +{ + return 0xff; +} + +READ8_MEMBER(c65_state::cia0_portb_r) +{ + static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; + UINT8 res; + + res = 0xff; + for(int i=0;i<8;i++) + { + m_keyb_input[i] = machine().root_device().ioport(c64ports[i])->read(); + + if(m_keyb_mux & 1 << (i)) + res &= m_keyb_input[i]; + } + + return res; +} + +WRITE8_MEMBER(c65_state::cia0_porta_w) +{ + m_keyb_mux = ~data; + printf("%02x\n",m_keyb_mux); +} + +WRITE8_MEMBER(c65_state::cia0_portb_w) +{ +} + +READ8_MEMBER(c65_state::dummy_r) +{ + return 0; +} + +static ADDRESS_MAP_START( c65_map, AS_PROGRAM, 8, c65_state ) + AM_RANGE(0x00000, 0x07fff) AM_RAM AM_SHARE("wram") // TODO: bank + AM_RANGE(0x0c800, 0x0cfff) AM_ROM AM_REGION("maincpu", 0xc800) + AM_RANGE(0x0d000, 0x0d07f) AM_READWRITE(vic4567_dummy_r,vic4567_dummy_w) // 0x0d000, 0x0d07f VIC-4567 + AM_RANGE(0x0d080, 0x0d081) AM_READ(dummy_r) // 0x0d080, 0x0d09f FDC + // 0x0d0a0, 0x0d0ff Ram Expansion Control (REC) + AM_RANGE(0x0d100, 0x0d1ff) AM_RAM_WRITE(PalRed_w) AM_SHARE("redpal")// 0x0d100, 0x0d1ff Red Palette + AM_RANGE(0x0d200, 0x0d2ff) AM_RAM_WRITE(PalGreen_w) AM_SHARE("greenpal") // 0x0d200, 0x0d2ff Green Palette + AM_RANGE(0x0d300, 0x0d3ff) AM_RAM_WRITE(PalBlue_w) AM_SHARE("bluepal") // 0x0d300, 0x0d3ff Blue Palette + // 0x0d400, 0x0d4*f Right SID + // 0x0d440, 0x0d4*f Left SID + AM_RANGE(0x0d600, 0x0d6ff) AM_RAM // 0x0d600, 0x0d6** UART + AM_RANGE(0x0d700, 0x0d702) AM_WRITE(DMAgic_w) AM_SHARE("dmalist") // 0x0d700, 0x0d7** DMAgic + //AM_RANGE(0x0d703, 0x0d703) AM_READ(DMAgic_r) + // 0x0d800, 0x0d8** Color matrix + AM_RANGE(0x0d800, 0x0dfff) AM_READWRITE(CIASelect_r,CIASelect_w) AM_SHARE("cram") + // 0x0dc00, 0x0dc** CIA-1 + // 0x0dd00, 0x0dd** CIA-2 + // 0x0de00, 0x0de** Ext I/O Select 1 + // 0x0df00, 0x0df** Ext I/O Select 2 (RAM window?) + AM_RANGE(0x0e000, 0x0ffff) AM_ROM AM_REGION("maincpu",0x0e000) + AM_RANGE(0x10000, 0x1f7ff) AM_RAM + AM_RANGE(0x1f800, 0x1ffff) AM_RAM // VRAM attributes + AM_RANGE(0x20000, 0x3ffff) AM_ROM AM_REGION("maincpu",0) +ADDRESS_MAP_END + + + +static INPUT_PORTS_START( c65 ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + +INPUT_PORTS_END + + +void c65_state::machine_start() +{ + m_iplrom = memregion("maincpu")->base(); + + save_pointer(NAME(m_cram.target()), 0x800); +} + +void c65_state::machine_reset() +{ +} + + +PALETTE_INIT_MEMBER(c65_state, c65) +{ + // TODO: initial state? +} + +static const gfx_layout charlayout = +{ + 8,8, + 0x1000/8, + 1, + { RGN_FRAC(0,1) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( c65 ) + GFXDECODE_ENTRY( "maincpu", 0xd000, charlayout, 0, 16 ) // another identical copy is at 0x9000 +GFXDECODE_END + +void c65_state::IRQCheck(UINT8 irq_cause) +{ + m_VIC2_IRQPend |= (irq_cause != 0) ? 0x80 : 0x00; + m_VIC2_IRQPend |= irq_cause; + + m_maincpu->set_input_line(M4510_IRQ_LINE,m_VIC2_IRQMask & m_VIC2_IRQPend ? ASSERT_LINE : CLEAR_LINE); +} + +INTERRUPT_GEN_MEMBER(c65_state::vic3_vblank_irq) +{ + IRQCheck(1); + //if(m_VIC2_IRQMask & 1) + // m_maincpu->set_input_line(M4510_IRQ_LINE,HOLD_LINE); +} + +WRITE_LINE_MEMBER(c65_state::cia0_irq) +{ + printf("%d IRQ\n",state); + +#if 0 + if(state) + { + static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; + for(int i=0;i<8;i++) + m_keyb_input[i] = machine().root_device().ioport(c64ports[i])->read(); + } +#endif +// m_cia0_irq = state; +// c65_irq(state || m_vicirq); +} + +static MACHINE_CONFIG_START( c65, c65_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M4510,MAIN_CLOCK) + MCFG_CPU_PROGRAM_MAP(c65_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen",c65_state,vic3_vblank_irq) + + MCFG_DEVICE_ADD("cia_0", MOS6526, MAIN_CLOCK) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, cia0_irq)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, cia0_porta_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c65_state, cia0_porta_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c65_state, cia0_portb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c65_state, cia0_portb_w)) + + MCFG_DEVICE_ADD("cia_1", MOS6526, MAIN_CLOCK) + MCFG_MOS6526_TOD(60) +// MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, c65_cia1_interrupt)) +// MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, c65_cia1_port_a_r)) +// MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c65_state, c65_cia1_port_a_w)) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) +// MCFG_SCREEN_REFRESH_RATE(60) +// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_UPDATE_DRIVER(c65_state, screen_update) +// MCFG_SCREEN_SIZE(32*8, 32*8) +// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK*4, 910, 0, 640, 262, 0, 200) // mods needed + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", c65) + + MCFG_PALETTE_ADD("palette", 0x100) + MCFG_PALETTE_INIT_OWNER(c65_state, c65) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "c65_flop") +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( c65 ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "910111", "V0.9.910111" ) + ROMX_LOAD( "910111.bin", 0x0000, 0x20000, CRC(c5d8d32e) SHA1(71c05f098eff29d306b0170e2c1cdeadb1a5f206), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "910523", "V0.9.910523" ) + ROMX_LOAD( "910523.bin", 0x0000, 0x20000, CRC(e8235dd4) SHA1(e453a8e7e5b95de65a70952e9d48012191e1b3e7), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "910626", "V0.9.910626" ) + ROMX_LOAD( "910626.bin", 0x0000, 0x20000, CRC(12527742) SHA1(07c185b3bc58410183422f7ac13a37ddd330881b), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "910828", "V0.9.910828" ) + ROMX_LOAD( "910828.bin", 0x0000, 0x20000, CRC(3ee40b06) SHA1(b63d970727a2b8da72a0a8e234f3c30a20cbcb26), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "911001", "V0.9.911001" ) + ROMX_LOAD( "911001.bin", 0x0000, 0x20000, CRC(0888b50f) SHA1(129b9a2611edaebaa028ac3e3f444927c8b1fc5d), ROM_BIOS(5) ) +ROM_END + +ROM_START( c64dx ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "910429.bin", 0x0000, 0x20000, CRC(b025805c) SHA1(c3b05665684f74adbe33052a2d10170a1063ee7d) ) +ROM_END + +DRIVER_INIT_MEMBER(c65_state,c65) +{ +// m_dma.version = 2; +// c65_common_driver_init(); +} + +DRIVER_INIT_MEMBER(c65_state,c65pal) +{ +// m_dma.version = 1; +// c65_common_driver_init(); +// m_pal = 1; +} + +COMP( 1991, c65, 0, 0, c65, c65, c65_state, c65, "Commodore Business Machines", "Commodore 65 Development System (Prototype, NTSC)", MACHINE_NOT_WORKING ) +COMP( 1991, c64dx, c65, 0, c65, c65, c65_state, c65pal, "Commodore Business Machines", "Commodore 64DX Development System (Prototype, PAL, German)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/c65_old.c b/src/mame/drivers/c65_old.c new file mode 100644 index 00000000000..97d934ff1db --- /dev/null +++ b/src/mame/drivers/c65_old.c @@ -0,0 +1,648 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/*************************************************************************** + + Commodore C65 home computer + PeT mess@utanet.at + + documention + www.funet.fi + +***************************************************************************/ + +/* + +2008 - Driver Updates +--------------------- + +(most of the informations are taken from http://www.zimmers.net/cbmpics/ ) + + +[CBM systems which belong to this driver] + +* Commodore 65 (1989) + +Also known as C64 DX at early stages of the project. It was cancelled +around 1990-1991. Only few units survive (they were sold after Commodore +liquidation in 1994). + +CPU: CSG 4510 (3.54 MHz) +RAM: 128 kilobytes, expandable to 8 megabytes +ROM: 128 kilobytes +Video: CSG 4569 "VIC-III" (6 Video modes; Resolutions from 320x200 to + 1280x400; 80 columns text; Palette of 4096 colors) +Sound: CSG 8580 "SID" x2 (6 voice stereo synthesizer/digital sound + capabilities) +Ports: CSG 4510 (2 Joystick/Mouse ports; CBM Serial port; CBM 'USER' + port; CBM Monitor port; Power and reset switches; C65 bus drive + port; RGBI video port; 2 RCA audio ports; RAM expansion port; C65 + expansion port) +Keyboard: Full-sized 77 key QWERTY (12 programmable function keys; + 4 direction cursor-pad) +Additional Hardware: Built in 3.5" DD disk drive (1581 compatible) +Miscellaneous: Partially implemented Commodore 64 emulation + +[Notes] + +The datasette port was removed here. C65 supports an additional "dumb" +drive externally. It also features, in addition to the standard CBM +bus serial (available in all modes), a Fast and a Burst serial bus +(both available in C65 mode only) + +*/ + + +#include "emu.h" +#include "cpu/m6502/m4510.h" +#include "machine/mos6526.h" +#include "machine/cbm_snqk.h" +#include "includes/c65.h" +#include "bus/cbmiec/cbmiec.h" +#include "machine/ram.h" + +static void cbm_c65_quick_sethiaddress( address_space &space, UINT16 hiaddress ) +{ + space.write_byte(0x82, hiaddress & 0xff); + space.write_byte(0x83, hiaddress >> 8); +} + +QUICKLOAD_LOAD_MEMBER( c65_state, cbm_c65 ) +{ + return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_c65_quick_sethiaddress); +} + +/************************************* + * + * Main CPU memory handlers + * + *************************************/ + +static ADDRESS_MAP_START( c65_mem , AS_PROGRAM, 8, c65_state ) + AM_RANGE(0x00000, 0x07fff) AM_RAMBANK("bank11") + AM_RANGE(0x08000, 0x09fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank12") + AM_RANGE(0x0a000, 0x0bfff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank13") + AM_RANGE(0x0c000, 0x0cfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank14") + AM_RANGE(0x0d000, 0x0d7ff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank5") + AM_RANGE(0x0d800, 0x0dbff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") + AM_RANGE(0x0dc00, 0x0dfff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank9") + AM_RANGE(0x0e000, 0x0ffff) AM_READ_BANK("bank10") AM_WRITE_BANK("bank15") + AM_RANGE(0x10000, 0x1f7ff) AM_RAM + AM_RANGE(0x1f800, 0x1ffff) AM_RAM AM_SHARE("colorram") + + AM_RANGE(0x20000, 0x23fff) AM_ROM /* &c65_dos, maps to 0x8000 */ + AM_RANGE(0x24000, 0x28fff) AM_ROM /* reserved */ + AM_RANGE(0x29000, 0x29fff) AM_ROM AM_SHARE("c65_chargen") + AM_RANGE(0x2a000, 0x2bfff) AM_ROM AM_SHARE("basic") + AM_RANGE(0x2c000, 0x2cfff) AM_ROM AM_SHARE("interface") + AM_RANGE(0x2d000, 0x2dfff) AM_ROM AM_SHARE("chargen") + AM_RANGE(0x2e000, 0x2ffff) AM_ROM AM_SHARE("kernal") + + AM_RANGE(0x30000, 0x31fff) AM_ROM /*&c65_monitor, monitor maps to 0x6000 */ + AM_RANGE(0x32000, 0x37fff) AM_ROM /*&c65_basic, */ + AM_RANGE(0x38000, 0x3bfff) AM_ROM /*&c65_graphics, */ + AM_RANGE(0x3c000, 0x3dfff) AM_ROM /* reserved */ + AM_RANGE(0x3e000, 0x3ffff) AM_ROM /* &c65_kernal, */ + + AM_RANGE(0x40000, 0x7ffff) AM_NOP + /* 8 megabyte full address space! */ +ADDRESS_MAP_END + + +/************************************* + * + * Input Ports + * + *************************************/ + +static INPUT_PORTS_START( c65 ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_START("FUNCT") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13 F14") PORT_CODE(KEYCODE_F11) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11 F12") PORT_CODE(KEYCODE_F10) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9 F10") PORT_CODE(KEYCODE_F9) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F12) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_F2) /* non blocking */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NO SCRL") PORT_CODE(KEYCODE_F4) + + PORT_START( "SPECIAL" ) /* special keys */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_CONFNAME( 0x20, 0x00, "(C65) Caps Lock (switch)") PORT_CODE(KEYCODE_F3) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x20, DEF_STR( On ) ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("CTRLSEL") /* Controller selection */ + PORT_CONFNAME( 0x07, 0x00, "Gameport A" ) + PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) ) + PORT_CONFSETTING( 0x01, "Paddles 1 & 2" ) + PORT_CONFSETTING( 0x02, "Mouse 1351" ) + PORT_CONFSETTING( 0x03, "Mouse (Non Proportional) 1350" ) + PORT_CONFSETTING( 0x04, "Lightpen" ) +// PORT_CONFSETTING( 0x05, "Koala Pad" ) + PORT_CONFSETTING( 0x06, "Lightgun" ) + PORT_CONFSETTING( 0x07, "No Device Connected" ) + PORT_CONFNAME( 0x70, 0x00, "Gameport B" ) + PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) ) + PORT_CONFSETTING( 0x10, "Paddles 3 & 4" ) +// PORT_CONFSETTING( 0x20, "Mouse 1351" ) +// PORT_CONFSETTING( 0x30, "Mouse (Non Proportional) 1350" ) + PORT_CONFSETTING( 0x70, "No Device Connected" ) + PORT_CONFNAME( 0x80, 0x00, "Swap Gameport A and B") PORT_CODE(KEYCODE_F1) PORT_TOGGLE + PORT_CONFSETTING( 0x00, DEF_STR( No ) ) + PORT_CONFSETTING( 0x80, DEF_STR( Yes ) ) + + PORT_START("JOY1_1B") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("JOY2_1B") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) + + /* Mouse Commodore 1350 was basically working as a Joystick */ + PORT_START("JOY1_2B") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Up") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Down") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Left") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Right") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 1") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 2") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) + + /* Still to verify how many mice you were able to plug into a C64 */ + /* Only one, for now */ + PORT_START("JOY2_2B") + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) +/* PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_PGUP) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) +*/ + PORT_START("PADDLE1") + PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + + PORT_START("PADDLE2") + PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_DOWN) PORT_CODE_INC(KEYCODE_UP) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + + PORT_START("PADDLE3") + PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_HOME) PORT_CODE_INC(KEYCODE_PGUP) PORT_PLAYER(3) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + + PORT_START("PADDLE4") + PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_END) PORT_CODE_INC(KEYCODE_PGDN) PORT_PLAYER(4) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + + PORT_START("TRACKX") + PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + + PORT_START("TRACKY") + PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + + PORT_START("LIGHTX") + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_NAME("Lightpen X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) + + PORT_START("LIGHTY") + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_NAME("Lightpen Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) + + PORT_START("OTHER") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle 1 Button") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Paddle 2 Button") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Paddle 3 Button") PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Paddle 4 Button") PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightpen Signal") PORT_CODE(KEYCODE_LCONTROL) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button Left") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Button Right") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02)INPUT_PORTS_END + + +static INPUT_PORTS_START( c65ger ) + PORT_INCLUDE( c65 ) + + PORT_MODIFY( "ROW1" ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z { Y }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 # { 3 Paragraph }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_MODIFY( "ROW3" ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y { Z }") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 ' { 7 / }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_MODIFY( "ROW4" ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 { = }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_MODIFY( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", < { ; }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Paragraph \xE2\x86\x91 { \xc3\xbc }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00A7) PORT_CHAR(0x2191) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xa4 }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". > { : }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- { ' ` }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+ { \xc3\x9f ? }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + + PORT_MODIFY( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ? { - _ }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Sum Pi { ] \\ }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x03A3) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= { # ' }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; ] { \xc3\xb6 }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* ` { + * }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ { [ \xE2\x86\x91 }") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xa3') + + PORT_MODIFY( "ROW7" ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') + + PORT_MODIFY("SPECIAL") /* special keys */ + PORT_DIPNAME( 0x20, 0x00, "(C65) DIN ASC (switch)") PORT_CODE(KEYCODE_F3) + PORT_DIPSETTING( 0x00, "ASC" ) + PORT_DIPSETTING( 0x20, "DIN" ) +INPUT_PORTS_END + + + +/************************************* + * + * Sound definitions + * + *************************************/ + +int c65_state::c64_paddle_read( device_t *device, address_space &space, int which ) +{ + int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp; + UINT8 cia0porta = machine().device("cia_0")->pa_r(space, 0); + int controller1 = ioport("CTRLSEL")->read() & 0x07; + int controller2 = ioport("CTRLSEL")->read() & 0x70; + /* Notice that only a single input is defined for Mouse & Lightpen in both ports */ + switch (controller1) + { + case 0x01: + if (which) + pot2 = ioport("PADDLE2")->read(); + else + pot1 = ioport("PADDLE1")->read(); + break; + + case 0x02: + if (which) + pot2 = ioport("TRACKY")->read(); + else + pot1 = ioport("TRACKX")->read(); + break; + + case 0x03: + if (which && (ioport("JOY1_2B")->read() & 0x20)) /* Joy1 Button 2 */ + pot1 = 0x00; + break; + + case 0x04: + if (which) + pot2 = ioport("LIGHTY")->read(); + else + pot1 = ioport("LIGHTX")->read(); + break; + + case 0x06: + if (which && (ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */ + pot2 = 0x00; + break; + + case 0x00: + case 0x07: + break; + + default: + logerror("Invalid Controller Setting %d\n", controller1); + break; + } + + switch (controller2) + { + case 0x10: + if (which) + pot4 = ioport("PADDLE4")->read(); + else + pot3 = ioport("PADDLE3")->read(); + break; + + case 0x20: + if (which) + pot4 = ioport("TRACKY")->read(); + else + pot3 = ioport("TRACKX")->read(); + break; + + case 0x30: + if (which && (ioport("JOY2_2B")->read() & 0x20)) /* Joy2 Button 2 */ + pot4 = 0x00; + break; + + case 0x40: + if (which) + pot4 = ioport("LIGHTY")->read(); + else + pot3 = ioport("LIGHTX")->read(); + break; + + case 0x60: + if (which && (ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */ + pot4 = 0x00; + break; + + case 0x00: + case 0x70: + break; + + default: + logerror("Invalid Controller Setting %d\n", controller1); + break; + } + + if (ioport("CTRLSEL")->read() & 0x80) /* Swap */ + { + temp = pot1; pot1 = pot3; pot3 = temp; + temp = pot2; pot2 = pot4; pot4 = temp; + } + + switch (cia0porta & 0xc0) + { + case 0x40: + return which ? pot2 : pot1; + + case 0x80: + return which ? pot4 : pot3; + + case 0xc0: + return which ? pot2 : pot1; + + default: + return 0; + } +} + +READ8_MEMBER( c65_state::sid_potx_r ) +{ + return c64_paddle_read(m_sid_r, space, 0); +} + +READ8_MEMBER( c65_state::sid_poty_r ) +{ + return c64_paddle_read(m_sid_r, space, 1); +} + + +/************************************* + * + * VIC III interfaces + * + *************************************/ + +UINT32 c65_state::screen_update_c65(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_vic->video_update(bitmap, cliprect); + return 0; +} + +READ8_MEMBER(c65_state::c65_lightpen_x_cb) +{ + return ioport("LIGHTX")->read() & ~0x01; +} + +READ8_MEMBER(c65_state::c65_lightpen_y_cb) +{ + return ioport("LIGHTY")->read() & ~0x01; +} + +READ8_MEMBER(c65_state::c65_lightpen_button_cb) +{ + return ioport("OTHER")->read() & 0x04; +} + +READ8_MEMBER(c65_state::c65_c64_mem_r) +{ + return m_memory[offset]; +} + +INTERRUPT_GEN_MEMBER(c65_state::vic3_raster_irq) +{ + m_vic->raster_interrupt_gen(); +} + +/************************************* + * + * Machine driver + * + *************************************/ + +static MACHINE_CONFIG_START( c65, c65_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M4510, 3500000) /* or VIC6567_CLOCK, */ + MCFG_CPU_PROGRAM_MAP(c65_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", c65_state, c65_frame_interrupt) + MCFG_CPU_PERIODIC_INT_DRIVER(c65_state, vic3_raster_irq, VIC6567_HRETRACERATE) + + MCFG_MACHINE_START_OVERRIDE(c65_state, c65 ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(525 * 2, 520 * 2) + MCFG_SCREEN_VISIBLE_AREA(VIC6567_STARTVISIBLECOLUMNS ,(VIC6567_STARTVISIBLECOLUMNS + VIC6567_VISIBLECOLUMNS - 1) * 2, VIC6567_STARTVISIBLELINES, VIC6567_STARTVISIBLELINES + VIC6567_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DRIVER(c65_state, screen_update_c65) + MCFG_SCREEN_PALETTE("vic3:palette") + + MCFG_DEVICE_ADD("vic3", VIC3, 0) + MCFG_VIC3_CPU("maincpu") + MCFG_VIC3_TYPE(VIC4567_NTSC) + MCFG_VIC3_LIGHTPEN_X_CB(READ8(c65_state, c65_lightpen_x_cb)) + MCFG_VIC3_LIGHTPEN_Y_CB(READ8(c65_state, c65_lightpen_y_cb)) + MCFG_VIC3_LIGHTPEN_BUTTON_CB(READ8(c65_state, c65_lightpen_button_cb)) + MCFG_VIC3_DMA_READ_CB(READ8(c65_state, c65_dma_read)) + MCFG_VIC3_DMA_READ_COLOR_CB(READ8(c65_state, c65_dma_read_color)) + MCFG_VIC3_INTERRUPT_CB(WRITELINE(c65_state, c65_vic_interrupt)) + MCFG_VIC3_PORT_CHANGED_CB(WRITE8(c65_state, c65_bankswitch_interface)) + MCFG_VIC3_C64_MEM_R_CB(READ8(c65_state, c65_c64_mem_r)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("sid_r", MOS8580, 985248) + MCFG_MOS6581_POTX_CALLBACK(READ8(c65_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c65_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) + MCFG_SOUND_ADD("sid_l", MOS8580, 985248) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", c65_state, cbm_c65, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + /* cia */ + MCFG_DEVICE_ADD("cia_0", MOS6526, 3500000) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, c65_cia0_interrupt)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, c65_cia0_port_a_r)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c65_state, c65_cia0_port_b_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c65_state, c65_cia0_port_b_w)) + + MCFG_DEVICE_ADD("cia_1", MOS6526, 3500000) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, c65_cia1_interrupt)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, c65_cia1_port_a_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c65_state, c65_cia1_port_a_w)) + + /* floppy from serial bus */ + MCFG_CBM_IEC_ADD(NULL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("640K,4224K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( c65pal, c65 ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) + MCFG_SCREEN_SIZE(625 * 2, 520 * 2) + MCFG_SCREEN_VISIBLE_AREA(VIC6569_STARTVISIBLECOLUMNS, (VIC6569_STARTVISIBLECOLUMNS + VIC6569_VISIBLECOLUMNS - 1) * 2, VIC6569_STARTVISIBLELINES, VIC6569_STARTVISIBLELINES + VIC6569_VISIBLELINES - 1) + MCFG_SCREEN_PALETTE("vic3:palette") + + MCFG_DEVICE_MODIFY("vic3") + MCFG_VIC3_TYPE(VIC4567_PAL) + + /* sound hardware */ + MCFG_SOUND_REPLACE("sid_r", MOS8580, 1022727) + MCFG_MOS6581_POTX_CALLBACK(READ8(c65_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(c65_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) + MCFG_SOUND_REPLACE("sid_l", MOS8580, 1022727) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) + + /* cia */ + MCFG_DEVICE_MODIFY("cia_0") + MCFG_MOS6526_TOD(50) + + MCFG_DEVICE_MODIFY("cia_1") + MCFG_MOS6526_TOD(50) +MACHINE_CONFIG_END + + +/************************************* + * + * ROM definition(s) + * + *************************************/ + + +ROM_START( c65 ) + ROM_REGION( 0x400000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "910111", "V0.9.910111" ) + ROMX_LOAD( "910111.bin", 0x20000, 0x20000, CRC(c5d8d32e) SHA1(71c05f098eff29d306b0170e2c1cdeadb1a5f206), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "910523", "V0.9.910523" ) + ROMX_LOAD( "910523.bin", 0x20000, 0x20000, CRC(e8235dd4) SHA1(e453a8e7e5b95de65a70952e9d48012191e1b3e7), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "910626", "V0.9.910626" ) + ROMX_LOAD( "910626.bin", 0x20000, 0x20000, CRC(12527742) SHA1(07c185b3bc58410183422f7ac13a37ddd330881b), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "910828", "V0.9.910828" ) + ROMX_LOAD( "910828.bin", 0x20000, 0x20000, CRC(3ee40b06) SHA1(b63d970727a2b8da72a0a8e234f3c30a20cbcb26), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "911001", "V0.9.911001" ) + ROMX_LOAD( "911001.bin", 0x20000, 0x20000, CRC(0888b50f) SHA1(129b9a2611edaebaa028ac3e3f444927c8b1fc5d), ROM_BIOS(5) ) +ROM_END + +ROM_START( c64dx ) + ROM_REGION( 0x400000, "maincpu", 0 ) + ROM_LOAD( "910429.bin", 0x20000, 0x20000, CRC(b025805c) SHA1(c3b05665684f74adbe33052a2d10170a1063ee7d) ) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ + +COMP( 1991, c65, 0, 0, c65, c65, c65_state, c65, "Commodore Business Machines", "Commodore 65 Development System (Prototype, NTSC)", MACHINE_NOT_WORKING ) +COMP( 1991, c64dx, c65, 0, c65pal, c65ger, c65_state, c65pal, "Commodore Business Machines", "Commodore 64DX Development System (Prototype, PAL, German)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/c80.c b/src/mame/drivers/c80.c new file mode 100644 index 00000000000..4af7ab0c6db --- /dev/null +++ b/src/mame/drivers/c80.c @@ -0,0 +1,293 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + +C-80 + +Pasting: + 0-F : as is + + (inc) : ^ + - (dec) : V + M : - + GO : X + +Test Paste: + -800^11^22^33^44^55^66^77^88^99^-800 + Now press up-arrow to confirm the data has been entered. + +Commands: + R : REGister + M : MEMory manipulation + G : GO + F10 : RESet + ESC : BRK + +Functions (press F1 then the indicated number): + 0 : FILL + 1 : SAVE + 2 : LOAD + 3 : LOADP + 4 : MOVE + 5 : IN + 6 : OUT + +When REG is chosen, use UP to scroll through the list of regs, +or press 0 thru C to choose one directly: + 0 : SP + 1 : PC + 2 : AF + 3 : BC + 4 : DE + 5 : HL + 6 : AF' + 7 : BC' + 8 : DE' + 9 : HL' + A : IFF + B : IX + C : IY + +When MEM is chosen, enter the address, press UP, enter data, press UP, enter +data of next byte, and so on. + +****************************************************************************/ + +#include "includes/c80.h" +#include "sound/wave.h" +#include "c80.lh" + +/* Memory Maps */ + +static ADDRESS_MAP_START( c80_mem, AS_PROGRAM, 8, c80_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0x0bff) AM_MIRROR(0x400) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c80_io, AS_IO, 8, c80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x7c, 0x7f) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_device, read, write) + AM_RANGE(0xbc, 0xbf) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_device, read, write) +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( c80_state::trigger_reset ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER( c80_state::trigger_nmi ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( c80 ) + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FCN") PORT_CODE(KEYCODE_F1) + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_M) PORT_CHAR('-') + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RES") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, c80_state, trigger_reset, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BRK") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, c80_state, trigger_nmi, 0) +INPUT_PORTS_END + +/* Z80-PIO Interface */ + +READ8_MEMBER( c80_state::pio1_pa_r ) +{ + /* + + bit description + + PA0 keyboard row 0 input + PA1 keyboard row 1 input + PA2 keyboard row 2 input + PA3 + PA4 _BSTB input + PA5 display enable output (0=enabled, 1=disabled) + PA6 tape output + PA7 tape input + + */ + + UINT8 data = !m_pio1_brdy << 4 | 0x07; + + int i; + + for (i = 0; i < 8; i++) + { + if (!BIT(m_keylatch, i)) + { + if (!BIT(m_row0->read(), i)) data &= ~0x01; + if (!BIT(m_row1->read(), i)) data &= ~0x02; + if (!BIT(m_row2->read(), i)) data &= ~0x04; + } + } + + data |= (m_cassette->input() < +0.0) << 7; + + return data; +} + +WRITE8_MEMBER( c80_state::pio1_pa_w ) +{ + /* + + bit description + + PA0 keyboard row 0 input + PA1 keyboard row 1 input + PA2 keyboard row 2 input + PA3 + PA4 _BSTB input + PA5 display enable output (0=enabled, 1=disabled) + PA6 tape output + PA7 tape input + + */ + + m_pio1_a5 = BIT(data, 5); + + if (!BIT(data, 5)) + { + m_digit = 0; + } + + m_cassette->output(BIT(data, 6) ? +1.0 : -1.0); +} + +WRITE8_MEMBER( c80_state::pio1_pb_w ) +{ + /* + + bit description + + PB0 VQD30 segment A + PB1 VQD30 segment B + PB2 VQD30 segment C + PB3 VQD30 segment D + PB4 VQD30 segment E + PB5 VQD30 segment F + PB6 VQD30 segment G + PB7 VQD30 segment P + + */ + + if (!m_pio1_a5) + { + output_set_digit_value(m_digit, data); + } + + m_keylatch = data; +} + +WRITE_LINE_MEMBER( c80_state::pio1_brdy_w ) +{ + m_pio1_brdy = state; + + if (state) + { + if (!m_pio1_a5) + { + m_digit++; + } + + m_pio1->strobe_b(1); + m_pio1->strobe_b(0); + } +} + +/* Z80 Daisy Chain */ + +static const z80_daisy_config c80_daisy_chain[] = +{ + { Z80PIO1_TAG }, + { Z80PIO2_TAG }, + { NULL } +}; + +/* Machine Initialization */ + +void c80_state::machine_start() +{ + /* register for state saving */ + save_item(NAME(m_keylatch)); + save_item(NAME(m_digit)); + save_item(NAME(m_pio1_a5)); + save_item(NAME(m_pio1_brdy)); +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( c80, c80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 2500000) /* U880D */ + MCFG_CPU_PROGRAM_MAP(c80_mem) + MCFG_CPU_IO_MAP(c80_io) + MCFG_CPU_CONFIG(c80_daisy_chain) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_c80 ) + + /* devices */ + MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, 2500000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(c80_state, pio1_pa_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(c80_state, pio1_pa_w)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(c80_state, pio1_pb_w)) + MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(c80_state, pio1_brdy_w)) + + MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, 2500000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED ) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( c80 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "c80.d3", 0x0000, 0x0400, CRC(ad2b3296) SHA1(14f72cb73a4068b7a5d763cc0e254639c251ce2e) ) +ROM_END + + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, c80, 0, 0, c80, c80, driver_device, 0, "Joachim Czepa", "C-80", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/c900.c b/src/mame/drivers/c900.c new file mode 100644 index 00000000000..18e5238c3eb --- /dev/null +++ b/src/mame/drivers/c900.c @@ -0,0 +1,135 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/****************************************************************************************** + + Commodore C900 + UNIX prototype + + http://www.zimmers.net/cbmpics/c900.html + http://www.zimmers.net/cbmpics/cbm/900/c900-chips.txt + + Chips: Z8001 CPU, Z8010 MMU, Z8030 SCC, Z8036 CIO. Crystal: 12MHz + + The Z8030 runs 2 serial ports. The Z8036 runs the IEEE interface and the speaker. + + The FDC is an intelligent device that communicates with the main board via the MMU. + It has a 6508 CPU. + + Disk drive is a Matsushita JA-560-012 + +*******************************************************************************************/ + + +#include "emu.h" +#include "cpu/z8000/z8000.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class c900_state : public driver_device +{ +public: + c900_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_READ16_MEMBER(port1e_r); + DECLARE_READ16_MEMBER(key_r); + DECLARE_READ16_MEMBER(stat_r); + DECLARE_WRITE8_MEMBER(kbd_put); +private: + UINT8 m_term_data; + required_device m_maincpu; + required_device m_terminal; +}; + +static ADDRESS_MAP_START(c900_mem, AS_PROGRAM, 16, c900_state) + AM_RANGE(0x00000, 0x07fff) AM_ROM AM_REGION("roms", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(c900_data, AS_DATA, 16, c900_state) + AM_RANGE(0x00000, 0x07fff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0x08000, 0x6ffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(c900_io, AS_IO, 16, c900_state) + AM_RANGE(0x0010, 0x0011) AM_READ(stat_r) + AM_RANGE(0x001A, 0x001B) AM_READ(key_r) + AM_RANGE(0x001E, 0x001F) AM_READ(port1e_r) + AM_RANGE(0x0100, 0x0101) AM_READ(stat_r) + AM_RANGE(0x0110, 0x0111) AM_READ(key_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0x00ff) +ADDRESS_MAP_END + +static INPUT_PORTS_START( c900 ) +INPUT_PORTS_END + +READ16_MEMBER( c900_state::port1e_r ) +{ + return 0; +} + +READ16_MEMBER( c900_state::key_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ16_MEMBER( c900_state::stat_r ) +{ + return (m_term_data) ? 6 : 4; +} + +WRITE8_MEMBER( c900_state::kbd_put ) +{ + m_term_data = data; +} + +/* F4 Character Displayer */ +static const gfx_layout c900_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( c900 ) + GFXDECODE_ENTRY( "chargen", 0x0000, c900_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( c900, c900_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z8001, XTAL_12MHz / 2) + MCFG_CPU_PROGRAM_MAP(c900_mem) + MCFG_CPU_DATA_MAP(c900_data) + MCFG_CPU_IO_MAP(c900_io) + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(c900_state, kbd_put)) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", c900) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +ROM_START( c900 ) + ROM_REGION16_LE( 0x8000, "roms", 0 ) + ROM_LOAD16_BYTE( "c 900 boot-h v 1.0.bin.u17", 0x0001, 0x4000, CRC(c3aa7fc1) SHA1(ff12dd100fa7b1e7e931e9a8ef4c4f5cc056e099) ) + ROM_LOAD16_BYTE( "c 900 boot-l v 1.0.bin.u18", 0x0000, 0x4000, CRC(0aa39272) SHA1(b2c5da4586d38fc66bb33aafeae4dbda36080f1e) ) + + ROM_REGION( 0x2000, "fdc", 0 ) + ROM_LOAD( "s41_6-20-85.bin", 0x0000, 0x2000, CRC(ec245721) SHA1(4cc19014b4887833a56b1236dc5fe39cc5d7b5c3) ) + + ROM_REGION( 0x1000, "chargen", 0 ) // this must be for the c900 terminal as the mainframe has no video output + ROM_LOAD( "380217-01.u2", 0x0000, 0x1000, CRC(64cb4171) SHA1(e60d796170addfd27e2c33090f9c512c7e3f99f5) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, c900, 0, 0, c900, c900, driver_device, 0, "Commodore", "Commodore 900", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/camplynx.c b/src/mame/drivers/camplynx.c new file mode 100644 index 00000000000..1b977ffe513 --- /dev/null +++ b/src/mame/drivers/camplynx.c @@ -0,0 +1,633 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Camputers Lynx + + 05/2009 Skeleton driver. + + The Lynx was an 8-bit British home computer that was first released + in early 1983 as a 48 kB model. + The designer of the Lynx was John Shireff and several models were + available with 48 kB, 96 kB (from Sep 1983) or 128 kB RAM (from Dec + 1983). It was possible reach 192 kB with RAM expansions on-board. + + The machine was based around a Z80A CPU clocked at 4 MHz, and featured + a Motorola 6845 as video controller. It was possible to run CP/M with + the optional 5.25" floppy disk-drive on the 96 kB and 128 kB models. + Approximately 30,000 Lynx units were sold world-wide. + + Camputers ceased trading in June 1984. Anston Technology took over in + November the same year and a re-launch was planned but never happened. + + In June 1986, Anston sold everything - hardware, design rights and + thousands of cassettes - to the National Lynx User Group. The group + planned to produce a Super-Lynx but was too busy supplying spares and + technical information to owners of existing models, and the project never + came into being. + + Hardware info: + - CPU: Zilog Z80A 4 MHz + - CO-PROCESSOR: Motorola 6845 (CRT controller) + - RAM: 48 kb, 96 kb or 128 kb depending on models (max. 192 kb) + - ROM: 16 kb (48K version), 24 KB (96K and 128K versions) + - TEXT MODES: 40 x 24, 80 x 24 + - GRAPHIC MODES: 256 x 248, 512 x 480 + - SOUND: one voice beeper + + Lynx 128 Memory Map + + | 0000 2000 4000 6000 8000 a000 c000 e000 + | 1fff 3fff 5fff 7fff 9fff bfff dfff ffff + ------------------------------------------------------------------------- + | | | | + Bank 0 | BASIC ROM | Not Available | Ext | Ext + | | | ROM1 | ROM2 + ------------------------------------------------------------------------- + | | + Bank 1 | STORE | Workspace RAM + | | + ------------------------------------------------------------------------- + | | | | + Bank 2 | RED | BLUE | GREEN | Alt + | | | | Green + ------------------------------------------------------------------------- + | + Bank 3 | Available for Video Expansion + | + ------------------------------------------------------------------------- + | + Bank 4 | Available for User RAM Expansion + | + + + + 48k and 96k are basically the same machine. 128k is different. + + Notes: + - The screen doesn't scroll. This is normal. + - Variable names are case-sensitive. + - Break key is the Escape key. + - Typing a line number doesn't delete the line, you are in a calculator mode + (for example, typing 67-5 will print 62) + - DEL line-number deletes the line. + - To edit a line, press Ctrl-E, it asks for line number, type it in, + then arrows to move left-right, backspace to delete, press keys to insert them + - If you entered a line and got a syntax error, press Ctrl-Q to edit it. + - Cassette tapes made on 128k are a different speed to 48k tapes. To load a 128k + tape on a 48k system, enter TAPE 3 before loading. (2,3,4,5 all seem to work). + - When loading, there's no wildcard; you must specify the name. + + To Do: + - finish memory banking + - how is alt-green bank selected on 48k? + - port 80 on 48k + - disk + - printer + - joysticks + - find out the mc6845 clock frequency + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "sound/dac.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "formats/camplynx_cas.h" + +class camplynx_state : public driver_device +{ +public: + camplynx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_cass(*this, "cassette") + //, m_printer(*this, "centronics") + , m_crtc(*this, "crtc") + //, m_fdc(*this, "fdc") + , m_dac(*this, "dac") + { } + + // 48k + DECLARE_READ8_MEMBER(port80_r); // cassin for 48k + DECLARE_WRITE8_MEMBER(port80_w); // control port 48k + DECLARE_WRITE8_MEMBER(port84_w); // dac port 48k + DECLARE_WRITE8_MEMBER(lynx48k_bank_w); // banking 48k + DECLARE_DRIVER_INIT(lynx48k); + MC6845_UPDATE_ROW(lynx48k_update_row); + // 128k + DECLARE_WRITE8_MEMBER(lynx128k_port80_w); // control port 128k + DECLARE_READ8_MEMBER(lynx128k_port82_r); // cassin for 128k + DECLARE_WRITE8_MEMBER(lynx128k_port84_w); // dac port 128k + DECLARE_WRITE8_MEMBER(lynx128k_bank_w); // banking 128k + DECLARE_WRITE8_MEMBER(lynx128k_irq); + DECLARE_MACHINE_RESET(lynx128k); + MC6845_UPDATE_ROW(lynx128k_update_row); + // common + required_device m_palette; +private: + UINT8 m_port80; + required_device m_maincpu; + required_device m_cass; + //required_device<> m_printer; + required_device m_crtc; + //optional_device<> m_fdc; + required_device m_dac; +}; + +/* These bankswitch handlers are very incomplete, just enough to get the + computer working. Also, as it happens 6 times for every scanline + of every character, it causes a huge slowdown. */ + +WRITE8_MEMBER( camplynx_state::lynx48k_bank_w ) +{ + if (!data) + membank("bank1")->set_entry(0); + else + if (data & 2) + membank("bank1")->set_entry(1); + else + if (data & 4) + membank("bank1")->set_entry(2); + else + logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->pc(), data); +} + +WRITE8_MEMBER( camplynx_state::lynx128k_bank_w ) +{ + /* get address space */ + UINT8 *base = memregion("maincpu")->base(); + + /* Set read banks */ + UINT8 bank = data & 0x0f; + + if (!bank) + { + membank("bank1")->set_base(base + 0x00000); + membank("bank2")->set_base(base + 0x02000); + membank("bank3")->set_base(base + 0x04000); + membank("bank4")->set_base(base + 0x16000); + membank("bank5")->set_base(base + 0x18000); + membank("bank6")->set_base(base + 0x1a000); + membank("bank7")->set_base(base + 0x0c000); + membank("bank8")->set_base(base + 0x0e000); + } + else + if (bank == 0x0e) + { + membank("bank1")->set_base(base + 0x20000); + membank("bank2")->set_base(base + 0x22000); + membank("bank3")->set_base(base + 0x24000); + membank("bank4")->set_base(base + 0x26000); + membank("bank5")->set_base(base + 0x28000); + membank("bank6")->set_base(base + 0x2a000); + membank("bank7")->set_base(base + 0x2c000); + membank("bank8")->set_base(base + 0x2e000); + } + else + logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->pc(), data); + + /* Set write banks */ + bank = data & 0xd0; + + if (!bank) + { + membank("bank11")->set_base(base + 0x10000); + membank("bank12")->set_base(base + 0x12000); + membank("bank13")->set_base(base + 0x14000); + membank("bank14")->set_base(base + 0x16000); + membank("bank15")->set_base(base + 0x18000); + membank("bank16")->set_base(base + 0x1a000); + membank("bank17")->set_base(base + 0x1c000); + membank("bank18")->set_base(base + 0x1e000); + } + else + if (bank == 0xc0) + { + membank("bank11")->set_base(base + 0x20000); + membank("bank12")->set_base(base + 0x22000); + membank("bank13")->set_base(base + 0x24000); + membank("bank14")->set_base(base + 0x26000); + membank("bank15")->set_base(base + 0x28000); + membank("bank16")->set_base(base + 0x2a000); + membank("bank17")->set_base(base + 0x2c000); + membank("bank18")->set_base(base + 0x2e000); + } + else + logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->pc(), data); +} + +static ADDRESS_MAP_START( lynx48k_mem, AS_PROGRAM, 8, camplynx_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0x5fff) AM_ROM + AM_RANGE(0x6000,0x7fff) AM_RAM + AM_RANGE(0x8000,0xffff) AM_RAMBANK("bank1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( lynx128k_mem, AS_PROGRAM, 8, camplynx_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( lynx48k_io , AS_IO, 8, camplynx_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x007f,0x007f) AM_MIRROR(0xff00) AM_WRITE(lynx48k_bank_w) + AM_RANGE(0x0080,0x0080) AM_MIRROR(0xff00) AM_WRITE(port80_w) + AM_RANGE(0x0080,0x0080) AM_READ(port80_r) + AM_RANGE(0x0180,0x0180) AM_READ_PORT("LINE1") + AM_RANGE(0x0280,0x0280) AM_READ_PORT("LINE2") + AM_RANGE(0x0380,0x0380) AM_READ_PORT("LINE3") + AM_RANGE(0x0480,0x0480) AM_READ_PORT("LINE4") + AM_RANGE(0x0580,0x0580) AM_READ_PORT("LINE5") + AM_RANGE(0x0680,0x0680) AM_READ_PORT("LINE6") + AM_RANGE(0x0780,0x0780) AM_READ_PORT("LINE7") + AM_RANGE(0x0880,0x0880) AM_READ_PORT("LINE8") + AM_RANGE(0x0980,0x0980) AM_READ_PORT("LINE9") + AM_RANGE(0x0084,0x0084) AM_MIRROR(0xff00) AM_WRITE(port84_w) + AM_RANGE(0x0086,0x0086) AM_MIRROR(0xff00) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0x0087,0x0087) AM_MIRROR(0xff00) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( lynx128k_io , AS_IO, 8, camplynx_state ) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x0050,0x0053) AM_MIRROR(0xff80) AM_READ(wd179x_r) // uses a 1793 +// AM_RANGE(0x0054,0x0057) AM_MIRROR(0xff80) AM_WRITE(wd179x_w) +// AM_RANGE(0x0058,0x0058) AM_MIRROR(0xff80) AM_WRITE(lynx128k_disk_w) +// AM_RANGE(0x007a,0x007b) AM_MIRROR(0xff80) AM_READ(lynx128k_joysticks_r) +// AM_RANGE(0x007c,0x007c) AM_MIRROR(0xff80) AM_READ(lynx128k_printer_r) +// AM_RANGE(0x007d,0x007d) AM_MIRROR(0xff80) AM_WRITE(lynx128k_printer_init_w) // this is rw +// AM_RANGE(0x007e,0x007e) AM_MIRROR(0xff80) AM_WRITE(lynx128k_printer_w) + AM_RANGE(0x0080,0x0080) AM_MIRROR(0xff00) AM_WRITE(lynx128k_port80_w) + AM_RANGE(0x0080,0x0080) AM_READ_PORT("LINE0") + AM_RANGE(0x0180,0x0180) AM_READ_PORT("LINE1") + AM_RANGE(0x0280,0x0280) AM_READ_PORT("LINE2") + AM_RANGE(0x0380,0x0380) AM_READ_PORT("LINE3") + AM_RANGE(0x0480,0x0480) AM_READ_PORT("LINE4") + AM_RANGE(0x0580,0x0580) AM_READ_PORT("LINE5") + AM_RANGE(0x0680,0x0680) AM_READ_PORT("LINE6") + AM_RANGE(0x0780,0x0780) AM_READ_PORT("LINE7") + AM_RANGE(0x0880,0x0880) AM_READ_PORT("LINE8") + AM_RANGE(0x0980,0x0980) AM_READ_PORT("LINE9") + AM_RANGE(0x0082,0x0082) AM_MIRROR(0xff00) AM_READWRITE(lynx128k_port82_r,lynx128k_bank_w) // read=serial buffer + AM_RANGE(0x0084,0x0084) AM_MIRROR(0xff00) AM_WRITE(lynx128k_port84_w) + AM_RANGE(0x0086,0x0086) AM_MIRROR(0xff00) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0x0087,0x0087) AM_MIRROR(0xff00) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( lynx48k ) + PORT_START("LINE0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x0e, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_START("LINE1") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C CONT") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DEL") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X WEND") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E DATA") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_START("LINE2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A AUTO") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S STOP") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z RESTORE") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W WHILE") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q REM") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(34) + PORT_START("LINE3") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F DEFPROC") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V VERIFY") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T TRACE") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R REPEAT") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_START("LINE4") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B BEEP") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H GOSUB") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y RUN") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_START("LINE5") + PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J LABEL") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M RETURN") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U UNTIL") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) + PORT_START("LINE6") + PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K MON") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O ENDPROC") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_START("LINE7") + PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L LIST") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P PROC") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 _") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_START("LINE8") + PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(0x5e) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \\") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('\\') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_START("LINE9") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR(0x7f) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) +INPUT_PORTS_END + +READ8_MEMBER( camplynx_state::port80_r ) +{ + UINT8 data = ioport("LINE0")->read(); + // when reading tape, bit 0 becomes cass-in signal + if BIT(m_port80, 1) + { + data &= 0xfe; + data |= (m_cass->input() > +0.02) ? 0 : 1; + } + return data; +} + +// during normal operation continually outputs E4,40,0 +// bit 1 is for the cassette motor. Other bits unknown. +WRITE8_MEMBER( camplynx_state::port80_w ) +{ + m_port80 = data; + m_cass->change_state( BIT(data, 1) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + +/* DAC port. If writing cassette, output goes to tape as a sine wave, otherwise it goes to speaker. + There is code below to write as a sine wave or a square wave, both work and can be loaded successfully. + However the PALE emulator cannot load either of them, although it loads its own output. + MESS can load PALE's wav files though. + Currently square wave output is selected. */ + +WRITE8_MEMBER( camplynx_state::port84_w ) +{ + if BIT(m_port80, 1) + { + // Sine wave output + //float t = (float)(unsigned)data - 32.0f; + //m_cass->output(t/31); + + // Square wave output + m_cass->output(BIT(data, 5) ? -1.0 : +1.0); + } + else // speaker output + m_dac->write_unsigned8(space, 0, data); +} + +/* +d7 = clock +d2 = cass-in +d1 = serial data in +d0 = serial h/s in */ +READ8_MEMBER( camplynx_state::lynx128k_port82_r ) +{ + UINT8 data = 0xfb; // guess + data |= (m_cass->input() > +0.02) ? 4 : 0; + return data; +} + +/* +d7 = serial data out +d6 = interline control +d5 = cpu access +d4 = alt green or normal green +d3 = cass motor on +d2 = cass enable +d1 = serial h/s out +d0 = speaker */ +WRITE8_MEMBER( camplynx_state::lynx128k_port80_w ) +{ + m_port80 = data; + m_cass->change_state( BIT(data, 3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + +// DAC port (6-bit) +WRITE8_MEMBER( camplynx_state::lynx128k_port84_w ) +{ + if BIT(m_port80, 3) // could be bit 2 + { + // Square wave output + m_cass->output(BIT(data, 5) ? -1.0 : +1.0); + } + else // speaker output + m_dac->write_unsigned8(space, 0, data); +} + +MACHINE_RESET_MEMBER(camplynx_state,lynx128k) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + mem.install_read_bank (0x0000, 0x1fff, "bank1"); + mem.install_read_bank (0x2000, 0x3fff, "bank2"); + mem.install_read_bank (0x4000, 0x5fff, "bank3"); + mem.install_read_bank (0x6000, 0x7fff, "bank4"); + mem.install_read_bank (0x8000, 0x9fff, "bank5"); + mem.install_read_bank (0xa000, 0xbfff, "bank6"); + mem.install_read_bank (0xc000, 0xdfff, "bank7"); + mem.install_read_bank (0xe000, 0xffff, "bank8"); + mem.install_write_bank (0x0000, 0x1fff, "bank11"); + mem.install_write_bank (0x2000, 0x3fff, "bank12"); + mem.install_write_bank (0x4000, 0x5fff, "bank13"); + mem.install_write_bank (0x6000, 0x7fff, "bank14"); + mem.install_write_bank (0x8000, 0x9fff, "bank15"); + mem.install_write_bank (0xa000, 0xbfff, "bank16"); + mem.install_write_bank (0xc000, 0xdfff, "bank17"); + mem.install_write_bank (0xe000, 0xffff, "bank18"); + + lynx128k_bank_w(mem, 0, 0); +} + +WRITE8_MEMBER( camplynx_state::lynx128k_irq ) +{ + m_maincpu->set_input_line(0, data); +} + +MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) +{ + UINT8 *RAM = machine().root_device().memregion("maincpu")->base(); + UINT8 r,g,b,x; + UINT32 *p = &bitmap.pix32(y); + UINT16 mem = ((ma << 2) + (ra << 5)) & 0x3fff; + + for (x = 0; x < x_count; x++) + { + r = RAM[0x14000+mem+x]; + g = RAM[0x1c000+mem+x]; + b = RAM[0x10000+mem+x]; + + *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); + *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); + *p++ = m_palette->pen_color((BIT(b, 5) << 2) | (BIT(g, 5) << 1) | (BIT(r, 5))); + *p++ = m_palette->pen_color((BIT(b, 4) << 2) | (BIT(g, 4) << 1) | (BIT(r, 4))); + *p++ = m_palette->pen_color((BIT(b, 3) << 2) | (BIT(g, 3) << 1) | (BIT(r, 3))); + *p++ = m_palette->pen_color((BIT(b, 2) << 2) | (BIT(g, 2) << 1) | (BIT(r, 2))); + *p++ = m_palette->pen_color((BIT(b, 1) << 2) | (BIT(g, 1) << 1) | (BIT(r, 1))); + *p++ = m_palette->pen_color((BIT(b, 0) << 2) | (BIT(g, 0) << 1) | (BIT(r, 0))); + } +} + +MC6845_UPDATE_ROW( camplynx_state::lynx128k_update_row ) +{ + UINT8 *RAM = machine().root_device().memregion("maincpu")->base(); + UINT8 r,g,b,x; + UINT32 green_bank, *p = &bitmap.pix32(y); + UINT16 mem = ((ma << 2) + (ra << 6)) & 0x3fff; + // determine green bank + if BIT(m_port80, 4) + green_bank = 0x2c000+mem; // alt green + else + green_bank = 0x28000+mem; // normal green + + for (x = 0; x < x_count; x++) + { + r = RAM[0x20000+mem+x]; + b = RAM[0x24000+mem+x]; + g = RAM[green_bank+x]; + + *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); + *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); + *p++ = m_palette->pen_color((BIT(b, 5) << 2) | (BIT(g, 5) << 1) | (BIT(r, 5))); + *p++ = m_palette->pen_color((BIT(b, 4) << 2) | (BIT(g, 4) << 1) | (BIT(r, 4))); + *p++ = m_palette->pen_color((BIT(b, 3) << 2) | (BIT(g, 3) << 1) | (BIT(r, 3))); + *p++ = m_palette->pen_color((BIT(b, 2) << 2) | (BIT(g, 2) << 1) | (BIT(r, 2))); + *p++ = m_palette->pen_color((BIT(b, 1) << 2) | (BIT(g, 1) << 1) | (BIT(r, 1))); + *p++ = m_palette->pen_color((BIT(b, 0) << 2) | (BIT(g, 0) << 1) | (BIT(r, 0))); + } +} + +static MACHINE_CONFIG_START( lynx48k, camplynx_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(lynx48k_mem) + MCFG_CPU_IO_MAP(lynx48k_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 479) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + + MCFG_PALETTE_ADD_3BIT_RGB("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.5) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12MHz / 8 /*? dot clock divided by dots per char */) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(camplynx_state, lynx48k_update_row) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(lynx48k_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) + //MCFG_CASSETTE_INTERFACE("camplynx_cass") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( lynx128k, camplynx_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_6MHz) + MCFG_CPU_PROGRAM_MAP(lynx128k_mem) + MCFG_CPU_IO_MAP(lynx128k_io) + + MCFG_MACHINE_RESET_OVERRIDE(camplynx_state,lynx128k) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 479) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + + MCFG_PALETTE_ADD_3BIT_RGB("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.5) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12MHz / 8 /*? dot clock divided by dots per char */) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(camplynx_state, lynx128k_update_row) + MCFG_MC6845_OUT_HSYNC_CB(WRITE8(camplynx_state, lynx128k_irq)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(lynx128k_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) + //MCFG_CASSETTE_INTERFACE("camplynx_cass") +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER(camplynx_state,lynx48k) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("bank1")->configure_entries(0, 3, &RAM[0x8000], 0x8000); +} + + +/* ROM definition */ +ROM_START( lynx48k ) + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "1", "Set1") + ROMX_LOAD( "lynx48-1.rom", 0x0000, 0x2000, CRC(56feec44) SHA1(7ded5184561168e159a30fa8e9d3fde5e52aa91a), ROM_BIOS(1) ) + ROMX_LOAD( "lynx48-2.rom", 0x2000, 0x2000, CRC(d894562e) SHA1(c08a78ecb4eb05baa4c52488fce3648cd2688744), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "2", "Set2") + ROMX_LOAD( "lynx4811.rom", 0x0000, 0x2000, CRC(a933e577) SHA1(c7b30a28d99b38dbe63a1314c78e3e614287143b), ROM_BIOS(2) ) + ROMX_LOAD( "lynx4812.rom", 0x2000, 0x2000, CRC(3d3fdd0e) SHA1(259d124f05367a96f891790f9418cc9c7798e2f8), ROM_BIOS(2) ) +ROM_END + +ROM_START( lynx96k ) + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "lynx9646.rom", 0x0000, 0x2000, CRC(f86c5514) SHA1(77a4af7557382003d697d08f364839e2dc28f063) ) + ROM_LOAD( "lynx9645.rom", 0x2000, 0x2000, CRC(f596b9a3) SHA1(3fca46bd68422d34c6cd801dd904507e52bd8846) ) + ROM_LOAD( "lynx9644.rom", 0x4000, 0x1000, CRC(4b96b0de) SHA1(c372a8d26399b9b45e615b674d61ccda76491b8b) ) + ROM_LOAD( "dosrom.rom", 0xe000, 0x2000, CRC(011e106a) SHA1(e77f0ca99790551a7122945f3194516b2390fb69) ) +ROM_END + +ROM_START( lynx128k ) + ROM_REGION( 0x50000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "lynx128-1.rom", 0x0000, 0x2000, CRC(65d292ce) SHA1(36567c2fbd9cf72f758e8cb80c21cb4d82040752) ) + ROM_LOAD( "lynx128-2.rom", 0x2000, 0x2000, CRC(23288773) SHA1(e12a7ebea3fae5eb375c03e848dbb81070d9d189) ) + ROM_LOAD( "lynx128-3.rom", 0x4000, 0x2000, CRC(9827b9e9) SHA1(1092367b2af51c72ce9be367179240d692aeb131) ) + ROM_LOAD( "dosrom.rom", 0xe000, 0x2000, CRC(011e106a) SHA1(e77f0ca99790551a7122945f3194516b2390fb69) ) +ROM_END + + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, lynx48k, 0, 0, lynx48k, lynx48k, camplynx_state, lynx48k, "Camputers", "Lynx 48k", MACHINE_NOT_WORKING) +COMP( 1983, lynx96k, lynx48k, 0, lynx48k, lynx48k, camplynx_state, lynx48k, "Camputers", "Lynx 96k", MACHINE_NOT_WORKING) +COMP( 1983, lynx128k, lynx48k, 0, lynx128k, lynx48k, driver_device, 0, "Camputers", "Lynx 128k", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/canon_s80.c b/src/mame/drivers/canon_s80.c new file mode 100644 index 00000000000..2ee2325ce0e --- /dev/null +++ b/src/mame/drivers/canon_s80.c @@ -0,0 +1,54 @@ +// license:GPL2+ +// copyright-holders:FelipeSanches +/* + * canon_s80.c + * + * CANON S-80 electronic typewriter + * + * skeleton driver by: + * Felipe Correa da Silva Sanches + * + * known issues: + * - memory-map is uncertain + * - maincpu clock is guessed + * - still need to hookup the Hitachi HD44780 LCD Controller + * - still lacks description of the keyboard inputs + * - as well as a "paper" device to plot the output of the dot matrix print head + */ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +//#include "video/hd44780.h" + +class canons80_state : public driver_device +{ +public: + canons80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + { } + + DECLARE_DRIVER_INIT(canons80); +}; + + +static ADDRESS_MAP_START(canons80_map, AS_PROGRAM, 8, canons80_state ) + AM_RANGE(0x0000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( canons80, canons80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD6301, 5000000) /* hd63a01xop 5 MHz guessed: TODO: check on PCB */ + MCFG_CPU_PROGRAM_MAP(canons80_map) +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER(canons80_state, canons80) +{} + +ROM_START( canons80 ) + ROM_REGION( 0x10000, "maincpu", 0 ) /* 6800 code */ + ROM_LOAD( "canon_8735kx_nh4-0029_064.ic6", 0x8000, 0x8000, CRC(b6cd2ff7) SHA1(e47a136300c826e480fac1be7fc090523078a2a6) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1988, canons80, 0, 0, canons80, 0, canons80_state, canons80, "Canon", "Canon S-80 electronic typewriter", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/casloopy.c b/src/mame/drivers/casloopy.c new file mode 100644 index 00000000000..ec768a54c01 --- /dev/null +++ b/src/mame/drivers/casloopy.c @@ -0,0 +1,566 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese +/***************************************************************************** + + Casio Loopy (c) 1995 Casio + + skeleton driver + + TODO: + - Identify what actually is the NEC CDT-109 CPU, it should contain a program + controller for the thermal printer device + + Note: + - just a placeholder for any HW discovery, until we decap/trojan the BIOS, + the idea is to understand the HW enough to extract the SH-1 internal BIOS + data via a trojan; + + ASM notes: + - first vector is almost certainly VBR value. + - [VBR + 0x2c] irq for i/o? + - [VBR + 0x140] points to an internal BIOS routine, at 0x6238 + (Nigaoe Artist has a direct 0x648c instead) + - 0x0604 is probably a BRA -2 / NOP (some games puts that as a null irq vector) + - Nigaoe Artist jumps to 0x668 at some point. + + +=============================================================================== + +Casio Loopy PCB Layout +---------------------- + +JCM631-MA1M C +|---------------------------------------------------------| +| CB CC CD CE CF CG | +|--| | + | BA10339F | +|--| 15218 |--| CXA1645M CH| +| | | A1603C | +| 15218 | | | +| | | | +|BIOS.LSI352| | | +| | | 21MHz | +| |--------|| | |------| SW1 | +| |NEC || | |SH7021| |----------| | +| |CDT109 ||CA| | | | | | +| | || | |------| |CASIO | | +| |--------|| | |RH-7500 | | +| | | |5C315 | |--| +| |-------| | | | | | +| |CASIO | | | |----------| |--| +| |RH-7501| | | HM514260 | +| |5C350 | | | HM62256 | +| |-------| | | | +| 6379 |--| SW301 HM62256 / +|--------| HM538123 / + | / + | / + |--------------------------------------------/ + +Notes: + Connectors + ---------- + CA - Cartridge connector + CB - Power Input connector + CC - Composite Video and Audio Out connector + CD - Printer Cassette Motor connector + CE - Printer Data connector + CF - Printer Head connector + CG - Paper Sensor connector + CH - Joystick connector + Connectors on the back of the main unit include RCA audio (left/right), RCA composite video, + 24V DC power input and contrast knob. + On top of the main unit, there is a reset button, on/off slide switch, a big eject button, a + button to cut off stickers after they're printed, a button to open the hatch where the sticker + cassette is located and a red LED for power. + + IC's + ---- + BIOS2.LSI352- Hitachi HN62434 512k x8 (4MBit) maskROM (SOP40) + CDT-109 - NEC CDT109 (QFP120). This is some kind of CPU, the package looks a bit + like a V60. The BIOS is tied directly to it. + RH-7500 - Casio RH-7500 5C315 (QFP208). This is the graphics generator chip. + RH-7501 - Casio RH-7501 5C350 (QFP64). This is probably the sound chip. + SH7021 - Hitachi HD6437021TE20 SuperH RISC Engine SH-2A CPU with 32k internal maskROM (TQFP100) + The internal ROM (BIOS1) is not dumped. A SH-2A software programming manual is available here... + http://documentation.renesas.com/eng/products/mpumcu/rej09b0051_sh2a.pdf + CXA1645M - Sony CXA1645M RGB Encoder (RGB -> Composite Video) (SOIC24) + A1603C - NEC uPA1603C Compound Field Effect Power Transistor Array (DIP16) + HM514260 - Hitachi HM514260 256k x 16 DRAM (SOJ40) + HM538123 - Hitachi HM538123 128k x8 multi-port Video DRAM with 256-word x8 serial access memory (SOJ40) + HM62256 - Hitachi HM62256 32k x8 SRAM (SOP28) + BA10339F - Rohm BA10339F Quad Comparitor (SOIC14) + 6379 - NEC uPD6379 2-channel 16-bit D/A convertor for digital audio signal demodulation (SOIC8) + 15218 - Rohm BA15218 Dual High Slew Rate, Low Noise Operational Amplifier (SOIC8) + + Other + ----- + SW1 - Reset Switch + SW301 - ON/OFF Slide Switch + + +Carts +----- +There are reports of 11 existing carts. +Only 6 are available so far. + +XK-401: Anime Land +XK-402: HARIHARI Seal Paradise +XK-403: Dream Change +XK-404: Nigaoe Artist +XK-501: Wanwan Aijou Monogatari +XK-502: PC Collection + +The rest are not dumped yet..... + + +Lupiton's Wonder Palette +Magical Shop +Chakra-kun no Omajinai Paradise +XK-503: Little Romance +XK-504: I want a room in Loopy Town + + + +Inside the carts +---------------- + +Carts 401 - 404: +PCB 'JCM632-AN1M C' +1x 16M maskROM (SOP44) +1x 8k x8 SRAM (SOP28) +1x 3V coin battery (CR2032) + +Cart 501: +PCB 'Z544-1 A240427-1' +1x 16M maskROM (SOP44) +1x 8k x8 SRAM (SOP28) +1x OKI MSM6653A Voice Synthesis IC with 544Kbits internal maskROM (SOP24) +1x Rohm BA15218 High Slew Rate, Low Noise, Dual Operational Amplifier (SOIC8) +1x 74HC273 logic chip +1x 3V coin battery (CR2032) + +Cart 502: +PCB 'Z545-1 A240570-1' +1x 16M maskROM (SOP44) +1x 32k x8 SRAM (SOP28) +1x 74HC00 logic chip +1x 3V coin battery (CR2032) + +******************************************************************************/ + +#include "emu.h" +#include "cpu/sh2/sh2.h" +//#include "cpu/v60/v60.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class casloopy_state : public driver_device +{ +public: + casloopy_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_bios_rom(*this, "bios_rom"), + m_vregs(*this, "vregs"), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + required_shared_ptr m_bios_rom; + required_shared_ptr m_vregs; + required_device m_maincpu; + required_device m_cart; + required_device m_gfxdecode; + required_device m_palette; + + UINT16 *m_paletteram; + UINT8 *m_vram; + UINT8 *m_bitmap_vram; + UINT16 sh7021_regs[0x100]; + int m_gfx_index; + DECLARE_DRIVER_INIT(casloopy); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_casloopy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ16_MEMBER(vregs_r); + DECLARE_WRITE16_MEMBER(vregs_w); + DECLARE_READ16_MEMBER(pal_r); + DECLARE_WRITE16_MEMBER(pal_w); + DECLARE_READ8_MEMBER(vram_r); + DECLARE_WRITE8_MEMBER(vram_w); + DECLARE_READ32_MEMBER(cart_r); + DECLARE_READ16_MEMBER(sh7021_r); + DECLARE_WRITE16_MEMBER(sh7021_w); + DECLARE_READ8_MEMBER(bitmap_r); + DECLARE_WRITE8_MEMBER(bitmap_w); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(loopy_cart); +}; + + +static const gfx_layout casloopy_4bpp_layout = +{ + 8,8, + 0x10000/32, + 4, + { STEP4(0, 1) }, + { STEP8(0, 4) }, + { STEP8(0, 4*8) }, + 4*8*8 +}; + +static const gfx_layout casloopy_8bpp_layout = +{ + 8,8, + 0x10000/64, + 8, + { STEP8(0, 1) }, + { STEP8(0, 8) }, + { STEP8(0, 8*8) }, + 8*8*8 +}; + +void casloopy_state::video_start() +{ + /* TODO: proper sizes */ + m_paletteram = auto_alloc_array_clear(machine(), UINT16, 0x1000); + m_vram = auto_alloc_array_clear(machine(), UINT8, 0x10000); + m_bitmap_vram = auto_alloc_array_clear(machine(), UINT8, 0x20000); + + for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++) + if (m_gfxdecode->gfx(m_gfx_index) == 0) + break; + + for(int i=0;i<0x10000;i++) + m_vram[i] = i & 0xff; + + m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, casloopy_4bpp_layout, m_vram, 0, 0x10, 0))); + m_gfxdecode->set_gfx(m_gfx_index+1, global_alloc(gfx_element(m_palette, casloopy_8bpp_layout, m_vram, 0, 1, 0))); +} + +UINT32 casloopy_state::screen_update_casloopy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + gfx_element *gfx = m_gfxdecode->gfx(m_gfx_index); + int x,y; + int count; + + static int test; + + if(machine().input().code_pressed(KEYCODE_Z)) + test+=0x100; + + if(machine().input().code_pressed(KEYCODE_X)) + test-=0x100; + + //popmessage("%08x",test); + + #if 0 + int r,g,b; + + r = pal5bit((m_vregs[0x4/4] >> 10) & 0x1f); + g = pal5bit((m_vregs[0x4/4] >> 5) & 0x1f); + b = pal5bit((m_vregs[0x4/4] >> 0) & 0x1f); + m_palette->set_pen_color(0x100,rgb_t(r^0xff,g^0xff,b^0xff)); + bitmap.fill( 0x100 ,cliprect); + #endif + + count = test; + for (y=0;y<32;y++) + { + for (x=0;x<32;x++) + { + UINT16 tile = (m_vram[count+1])|(m_vram[count]<<8); + + tile &= 0x7ff; //??? + + gfx->transpen(bitmap,cliprect,tile,7,0,0,x*8,y*8,0xffffffff); + + count+=2; + } + } + + count = test; + + for (y=cliprect.min_y;yvblank() << 8) | (machine().rand() & 0xff); // vblank + vpos? + } + + if(offset == 2/2) + return machine().rand();/*(machine().first_screen()->hblank() << 8) | (machine().first_screen()->hpos() & 0xff);*/ // hblank + hpos? + + if(offset == 0/2) + return machine().rand(); // pccllect + + printf("%08x\n",offset*2); + + return 0xffff; +} + +WRITE16_MEMBER(casloopy_state::vregs_w) +{ + if(offset != 6/2) + printf("%08x %08x\n",offset*2,data); +} + +READ16_MEMBER(casloopy_state::pal_r) +{ + return m_paletteram[offset]; +} + +WRITE16_MEMBER(casloopy_state::pal_w) +{ + int r,g,b; + COMBINE_DATA(&m_paletteram[offset]); + + b = ((m_paletteram[offset])&0x001f)>>0; + g = ((m_paletteram[offset])&0x03e0)>>5; + r = ((m_paletteram[offset])&0x7c00)>>10; + + m_palette->set_pen_color(offset, pal5bit(r), pal5bit(g), pal5bit(b)); +} + +READ8_MEMBER(casloopy_state::vram_r) +{ + return m_vram[offset]; +} + +WRITE8_MEMBER(casloopy_state::vram_w) +{ + m_vram[offset] = data; + + m_gfxdecode->gfx(m_gfx_index)->mark_dirty(offset/32); + m_gfxdecode->gfx(m_gfx_index+1)->mark_dirty(offset/64); +} + +/* TODO: all of this should be internal to the SH core, this is just to check what it enables. */ +READ16_MEMBER(casloopy_state::sh7021_r) +{ + return sh7021_regs[offset]; +} + +WRITE16_MEMBER(casloopy_state::sh7021_w) +{ + COMBINE_DATA(&sh7021_regs[offset]); + + if(offset == 0x4e/2) + { + UINT32 src,dst,size,type; + + src = (sh7021_regs[0x40/2]<<16)|(sh7021_regs[0x42/2]&0xffff); + dst = (sh7021_regs[0x44/2]<<16)|(sh7021_regs[0x46/2]&0xffff); + size = (sh7021_regs[0x4a/2]&0xffff); + type = (sh7021_regs[0x4e/2]&0xffff); + + printf("0 %08x %08x %04x %04x\n",src & 0x7ffffff,dst & 0x7ffffff,size,type); + + sh7021_regs[0x4e/2]&=0xfffe; + } + + if(offset == 0x7e/2) + { + UINT32 src,dst,size,type; + + src = (sh7021_regs[0x70/2]<<16)|(sh7021_regs[0x72/2]&0xffff); + dst = (sh7021_regs[0x74/2]<<16)|(sh7021_regs[0x76/2]&0xffff); + size = (sh7021_regs[0x7a/2]&0xffff); + type = (sh7021_regs[0x7e/2]&0xffff); + + printf("3 %08x %08x %04x %04x\n",src & 0x7ffffff,dst & 0x7ffffff,size,type); + + sh7021_regs[0x7e/2]&=0xfffe; + } + +// printf("%08x %04x\n",sh7021_regs[offset],0x05ffff00+offset*2); +} + +READ8_MEMBER(casloopy_state::bitmap_r) +{ + return m_bitmap_vram[offset]; +} + +WRITE8_MEMBER(casloopy_state::bitmap_w) +{ + m_bitmap_vram[offset] = data; +} + +READ32_MEMBER(casloopy_state::cart_r) +{ + return m_cart->read32_rom(space, offset, mem_mask); +} + + +static ADDRESS_MAP_START( casloopy_map, AS_PROGRAM, 32, casloopy_state ) + AM_RANGE(0x00000000, 0x00007fff) AM_RAM AM_SHARE("bios_rom") + AM_RANGE(0x01000000, 0x0107ffff) AM_RAM AM_SHARE("wram")// stack pointer points here + AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE8(bitmap_r, bitmap_w, 0xffffffff) + AM_RANGE(0x04040000, 0x0404ffff) AM_READWRITE8(vram_r, vram_w, 0xffffffff) // tilemap + PCG + AM_RANGE(0x04050000, 0x040503ff) AM_RAM // ??? + AM_RANGE(0x04051000, 0x040511ff) AM_READWRITE16(pal_r, pal_w, 0xffffffff) + AM_RANGE(0x04058000, 0x04058007) AM_READWRITE16(vregs_r, vregs_w, 0xffffffff) + AM_RANGE(0x0405b000, 0x0405b00f) AM_RAM AM_SHARE("vregs") // RGB555 brightness control plus scrolling +// AM_RANGE(0x05ffff00, 0x05ffffff) AM_READWRITE16(sh7021_r, sh7021_w, 0xffffffff) +// AM_RANGE(0x05ffff00, 0x05ffffff) - SH7021 internal i/o + AM_RANGE(0x06000000, 0x061fffff) AM_READ(cart_r) + AM_RANGE(0x07000000, 0x070003ff) AM_RAM AM_SHARE("oram")// on-chip RAM, actually at 0xf000000 (1 kb) + AM_RANGE(0x09000000, 0x0907ffff) AM_RAM AM_SHARE("wram") + AM_RANGE(0x0e000000, 0x0e1fffff) AM_READ(cart_r) + AM_RANGE(0x0f000000, 0x0f0003ff) AM_RAM AM_SHARE("oram") +ADDRESS_MAP_END + +#if 0 +static ADDRESS_MAP_START( casloopy_sub_map, AS_PROGRAM, 16, casloopy_state ) + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("subcpu",0) +ADDRESS_MAP_END +#endif + +static INPUT_PORTS_START( casloopy ) +INPUT_PORTS_END + +void casloopy_state::machine_start() +{ +} + +void casloopy_state::machine_reset() +{ + //m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); //halt the CPU until we find enough data to proceed + +} + +#if 0 +static const gfx_layout casloopy_4bpp_layoutROM = +{ + 8,8, + RGN_FRAC(1,1), + 4, + { STEP4(0, 1) }, + { STEP8(0, 4) }, + { STEP8(0, 4*8) }, + 4*8*8 +}; + + +static const gfx_layout casloopy_8bpp_layoutROM = +{ + 8,8, + RGN_FRAC(1,1), + 8, + { STEP8(0, 1) }, + { STEP8(0, 8) }, + { STEP8(0, 8*8) }, + 8*8*8 +}; +#endif + + +DEVICE_IMAGE_LOAD_MEMBER( casloopy_state, loopy_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + UINT8 *SRC, *DST; + dynamic_buffer temp; + temp.resize(0x200000); + + m_cart->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_LITTLE); + + SRC = &temp[0]; + DST = m_cart->get_rom_base(); + m_cart->common_load_rom(&temp[0], size, "rom"); + + // fix endianness + for (int i = 0; i < 0x200000; i += 4) + { + UINT8 tempa = SRC[i + 0]; + UINT8 tempb = SRC[i + 1]; + DST[i + 0] = SRC[i + 2]; + DST[i + 1] = SRC[i + 3]; + DST[i + 2] = tempa; + DST[i + 3] = tempb; + } + + return IMAGE_INIT_PASS; +} + +static MACHINE_CONFIG_START( casloopy, casloopy_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",SH2A,8000000) + MCFG_CPU_PROGRAM_MAP(casloopy_map) + +// MCFG_CPU_ADD("subcpu",V60,8000000) +// MCFG_CPU_PROGRAM_MAP(casloopy_sub_map) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(8000000, 444, 0, 256, 263, 0, 224) + +// MCFG_SCREEN_REFRESH_RATE(60) +// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) +// MCFG_SCREEN_SIZE(444, 263) +// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MCFG_SCREEN_UPDATE_DRIVER(casloopy_state, screen_update_casloopy) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 512) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "loopy_cart") + MCFG_GENERIC_EXTENSIONS("bin,ic1") + MCFG_GENERIC_WIDTH(GENERIC_ROM32_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_LITTLE) + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(casloopy_state, loopy_cart) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","casloopy") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( casloopy ) + ROM_REGION( 0x80000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bios1", 0x0000, 0x8000, NO_DUMP ) // SH7021 uses 32 KB + + ROM_REGION( 0x80000, "subcpu", 0) //NEC CDT-109 + ROM_LOAD( "bios2.lsi352", 0x0000, 0x80000, CRC(8f51fa17) SHA1(99f50be06b083fdb07e08f30b0b26d9037afc869) ) +ROM_END + +DRIVER_INIT_MEMBER(casloopy_state,casloopy) +{ + /* load hand made bios data*/ + m_bios_rom[0/4] = 0x6000480;//0x600af3c;//0x6000964; //SPC + m_bios_rom[4/4] = 0x0000000; //SSP + + for(int i=0x400/4;i<0x8000/4;i++) + m_bios_rom[i] = 0x000b0009; // RTS + NOP +} + +CONS( 1995, casloopy, 0, 0, casloopy, casloopy, casloopy_state, casloopy, "Casio", "Loopy", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/cat.c b/src/mame/drivers/cat.c new file mode 100644 index 00000000000..161441bb667 --- /dev/null +++ b/src/mame/drivers/cat.c @@ -0,0 +1,1843 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu +/*************************************************************************** + + Canon Cat, Model V777 + IAI Swyft Model P0001 + Copyright (C) 2009-2013 Miodrag Milanovic and Jonathan Gevaryahu AKA Lord Nightmare + With information and help from John "Sandy" Bumgarner, Dwight Elvey, + Charles Springer, Terry Holmes, Jonathan Sand, Aza Raskin and others. + + + This driver is dedicated in memory of Jef Raskin and Dave Boulton + + 12/06/2009 Skeleton driver. + 15/06/2009 Working driver + +Pictures: http://www.regnirps.com/Apple6502stuff/apple_iie_cat.htm + +Canon cat blue "Use Front Labels": +` (really degree, +-, paragraph-mark and section-mark): LEFT MARGIN +-_: INDENT ++=: RIGHT MARGIN +UNDO: SPELL CHECK LEAP (this is actually a red LEAP label) +PERM SPACE/TAB: SET/CLEAR TAB +Q: UNDER LINE +W: BOLD +E: CAPS +T: Paragraph STYLE +U: LINE SPACE +O: ADD SPELLING +[ (really 1/4, 1/2, double-underline and |): SETUP +Backspace (really ERASE): ANSWER +LOCK: DOCUMENT LOCK +A: COPY +D: SEND CONTROL +G: CALC +J: PRINT +L: DISK +Colon: FORMAT/WIPE DISK (only when wheel! mode is enabled, see below) +"': PHONE +Enter (really RETURN): SEND +X: LOCAL LEAP +V: LEARN +N: EXPLAIN +,: SORT +?/: KBI/II +Pgup (really DOCUMENT/PAGE): TITLES +Leap Left: LEAP AGAIN (left) +Leap Right: LEAP AGAIN (right) + + +How to enable the FORTH interpreter (http://canoncat.org/canoncat/enableforth.html) + +The definitive instructions of going Forth on a Cat, tested on a living Cat. +The Canon Cat is programmed with FORTH, a remarkably different programming language in itself. +On the Canon Cat, you can access the FORTH interpreter with a special sequence of key presses. +Here are exact working instructions thanks to Sandy Bumgarner: +- Type Enable Forth Language exactly like that, capitals and all. +- Highlight from the En to the ge, exactly [i.e. Leap back to Enable by keeping the left Leap + key down while typing E n a, release the leap key, then click both leap keys simultaneously], + and press USE FRONT with ERASE (the ANSWER command). +- The Cat should beep and flash the ruler. +- Then press USE FRONT and the SHIFT keys together and tap the space bar. Note that the cursor + stops blinking. Now a Pressing the RETURN key gets the Forth OK and you are 'in' as they say. + +In MESS, to activate it as above: +* when the Cat boots, type (without quotes) "Enable Forth Language" +* hold left-alt(leap left) and type E n a, release left-alt (the left cursor is now at the first character) +* simultaneously press both alt keys for a moment and release both (the whole "Enable Forth Language" line will be selected) +* press control(use front) and press backspace(ERASE) (The cat will beep here) +* press control(use front), shift, and space (the cursor should stop blinking) +* press enter and the forth "ok" prompt should appear. you can type 'page' and enter to clear the screen +Optional further steps: +* type without quotes "-1 wheel! savesetup re" at the forth prompt to permanently + enable shift + use front + space to dump to forth mode easily +* change the keyboard setting in the setup menu (use front + [ ) to ASCII so you can type < and > +* after doing the -1 wheel! thing, you can compile a selected forth program in the editor + by selecting it and hitting ANSWER (use front + ERASE) + +If ever in forth mode you can return to the editor with the forth word (without quotes) "re" + +Canon cat gate array ASIC markings: +GA1 (prototype): D65013CW276 [same as final] +GA1 (final): NH4-5001 276 [schematic: upD65013CW-276] +GA2 (prototype): D65013CW208 [DIFFERENT FROM FINAL! larger asic used here, shrank for final?] +GA2 (final): NH4-5002 191 [schematic: upD65012CW-191] +GA3 (prototype): D65013CW141 [same as final? typo 65013 vs 65012?] +GA3 (final): NH4-5003 141 [schematic: upD65012CW-141] + +Canon cat credits easter egg: +* hold either leap key, then simultaneously hold shift, then type Q W E R A S D F Z X C V and release all the keys +* hit EXPLAIN (use front + N) and the credits screen will be displayed + +Canon Cat credits details: (WIP) +Scott Kim - responsible for fonts on swyft and cat +Ralph Voorhees - Model construction and mockups (swyft 'flat cat') + +Cat HLSL stuff: +*scanlines: +the cat has somewhat visible and fairly close scanlines with very little fuzziness +try hlsl options: +hlsl_prescale_x 4 +hlsl_prescale_y 4 +scanline_alpha 0.3 +scanline_size 1.0 +scanline_height 0.7 +scanline_bright_scale 1.0 +scanline_bright_offset 0.6 +*phosphor persistence of the original cat CRT is VERY LONG and fades to a greenish-yellow color, though the main color itself is white +try hlsl option: +phosphor_life 0.93,0.95,0.87 +which is fairly close but may actually be too SHORT compared to the real thing. + + +Swyft versions: +There are at least 4 variants of machines called 'swyft': +* The earliest desktop units which use plexi or rubber-tooled case and an + angled monitor; about a dozen were made and at least two of clear plexi. + These are sometimes called "wrinkled" swyfts. 5.25" drive, they may be able + to read Apple2 Swyftware/Swyftdisk and Swyftcard-created disks. + It is possible no prototypes of this type got beyond the 'runs forth console only' stage. + http://archive.computerhistory.org/resources/access/physical-object/2011/09/102746929.01.01.lg.JPG + http://www.digibarn.com/collections/systems/swyft/Swyft-No2-05-1271.jpg + http://www.digibarn.com/friends/jef-raskin/slides/iai/A%20-687%20SWYFTPRO.JPG +* The early "flat cat" or "roadkill" portable LCD screen units with a white + case and just a keyboard. Model SP0001 + http://www.digibarn.com/collections/systems/swyft/Image82.jpg +* The later "ur-cat" desktop units which use a machine tooled case and look + more or less like the canon cat. Around 100-200 were made. 3.5" drive. + These have a fully functional EDDE editor as the cat does, and can even compile + forth programs. + (the 'swyft' driver is based on one of these) +* The very late portable LCD units with a dark grey case and a row of hotkey + buttons below the screen. Not dumped yet. At least one functional prototype exists. + At least one plastic mockup exists with no innards. + http://www.digibarn.com/collections/systems/swyft/swyft.jpg + +Canon Cat versions: +There is really only one version of the cat which saw wide release, the US version. +* It is possible a very small number of UK/European units were released as a test. + If so, these will have slightly different keyboard key caps and different + system and spellcheck roms. + +As for prototypes/dev cat machines, a few minor variants exist: +* Prototype cat motherboards used 16k*4bit drams instead of 64k*4bit as the + final system did and hence max out at 128k of dram instead of 512k. + One of the gate arrays is also different, and the motherboard is arranged + differently. The IC9 "buserr" PAL is not used, even on the prototype. + The final system included 256k of dram and can be upgraded to 512k. +* At least some developer units were modified to have an external BNC + connector, ostensibly to display the internal screen's video externally. + http://www.digibarn.com/collections/systems/canon-cat/Image55.jpg + + +Canon Cat: + +Crystals: +X1: 19.968Mhz, used by GA2 (plus a PLL to multiply by 2?), and divide by 4 for + cpuclk, divide by 8 for 2.5mhz and divide by 5.5 for 3.63mhz (is this + supposed to be divide by 6? there may not be a pll if it is...) +X2: 3.579545Mhz, used by the DTMF generator chip AMI S2579 at IC40 +X3: 2.4576Mhz, used by the modem chip AMI S35213 at IC37 + +IAI Swyft: +Board name: 950-0001C +"INFORMATION APPLIANCE INC. COPYRIGHT 1985" + _________________|||||||||___________________________________________________________________________________ +| J8 [=======J3=======] ____ Trans- | +== / \ (E2) former | +==Jx 74LS107 J5 |PB1 | uA339 MC3403 -----| +| 7407 \____/ J7 = +| Y1 "TIMING B" 74LS132 74LS175 -----| +| ____________ 4N37 Relay -----| +| TMS4256 74LS161 "DECODE E" "DISK 3.5C" | | J6 = +| | MC6850P | -----| +| TMS4256 74LS166 74HCT259 74LS299 '------------' MC3403 MC3403 _____| +| ___________________ ___________________ || | = +| TMS4256 74LS373 | | | | J2 | J1 = +| | MC68008P8 | | R6522P | || I P R | = +| TMS4256 74F153 '-------------------' '-------------------' MN4053 || MN4053 N R E | B = +| (E1) D O S | R = +| TMS4256 74F153 74HCT08 __________ ___________________ MC14412 DS1489 U E T I | E = +| | | | | || C S E S | A = +| TMS4256 74F153 74HC4040E | AM27256 | | R6522P | || T D C T | K = +| '----------' '-------------------' || INFORMATION O T O | O = +| TMS4256 74F153 "VIDEO 2B" .----------. J4 APPLIANCE INC. R I R | U = +| | AM27256 | 74HC02 74HC374 || Copyright 1985 S O S | T = +| TMS4256 74F153 74LS393 B1|__________| || UM95089 Y2 N | = +|_____________________________[________J9___]__________________________________________________D13______|_____= + +*Devices of interest: +J1: breakout of joystick, serial/rs232, hex-keypad, parallel port, and forth switch (and maybe cassette?) pins + DIL 60 pin 2-row right-angle rectangular connector with metal shield contact; + not all 60 pins are populated in the connector, only pins 1-6, 8, 13-15, 17-18, 23-30, 35-60 are present + (traced partly by dwight) +J2: unpopulated 8-pin sip header, serial/rs232-related? + (vcc ? ? ? ? ? ? gnd) (random guess: txd, rxd, rts, cts, dsr, dtr, and one pin could be cd/ri though the modem circuit may do that separately?) +J3: Floppy Connector + (standard DIL 34 pin 2-row rectangular connector for mini-shugart/pc floppy cable; pin 2 IS connected somewhere and ?probably? is used for /DISKCHANGE like on an Amiga, with pin 34 being /TRUEREADY?) + (as opposed to normal ibm pc 3.5" drives where pin 2 is unconnected or is /DENSITY *input to drive*, and pin 34 is /DISKCHANGE) +J4: 18-pin sip header for keyboard ribbon cable; bottom edge of board is pin 1 + Pins: + 1: GND through 220k resistor r78 + 2: ? phone hook related? anode of diode d7; one of the pins of relay k2; topmost (boardwise) pin of transistor Q10 + 3: 74HCT34 pin + +J5: locking-tab-type "CONN HEADER VERT 4POS .100 TIN" connector for supplying power + through a small cable with a berg connector at the other end, to the floppy drive + (5v gnd gnd 12v) +J6: Phone connector, rj11 jack +J7: Line connector, rj11 jack +J8: 9-pin Video out/power in connector "CONN RECEPT 6POS .156 R/A PCB" plus "CONN RECEPT 3POS .156 R/A PCB" acting as one 9-pin connector + (NC ? ? ? NC NC ? 12v 5v) (video, vsync, hsync and case/video-gnd are likely here) + (the video pinout of the cat is: (Video Vsync Hsync SyncGnd PwrGnd PwrGnd +5v(VCC) +12v(VDD) -12v(VEE)) which is not the same as the swyft. +J9: unpopulated DIL 40-pin straight connector for a ROM debug/expansion/RAM-shadow daughterboard + the pins after pin 12 connect to that of the ROM-LO 27256 pinout counting pins 1,28,2,27,3,26,etc + the ROM-HI rom has a different /HICE pin which is not connected to this connector + /LOCE is a15 + /HICE is !a15 + /ROM_OE comes from pin 14 of DECODE_E pal, and is shorted to /ROM_OE' by the cuttable jumper B1 which is not cut + /ROM_OE' goes to the two EPROMS + DECODE_18 is DECODE_E pal pin 18 + pin 1 (GND) is in the lower left and the pins count low-high then to the right + (gnd N/C E_CLK R/W /ROM_OE a17 vcc a14 a13 a8 a9 a11 /ROM_OE' a10 a15 d7 d6 d5 d4 d3 ) + (GND /IPL1 DECODE_18 /RESET gnd a16 vcc a12 a7 a6 a5 a4 a3 a2 a1 a0 d0 d1 d2 gnd) +Jx: 4 pin on top side, 6 pin on bottom side edge ?debug? connector (doesn't have a Jx number) + (trace me!) +B1: a cuttable trace on the pcb. Not cut, affects one of the pins on the unpopulated J9 connector only. +E1: jumper, unknown purpose, not set +E2: jumper, unknown purpose, not set +D13: LED +R6522P (upper): parallel port via +R6522P (lower): keyboard via +UM95089: DTMF Tone generator chip (if you read the datasheet this is technically ROM based!) +Y1: 15.8976Mhz, main clock? +Y2: 3.579545Mhz, used by the DTMF generator chip UM95089 (connects to pins 7 and 8 of it) +TMS4256-15NL - 262144 x 1 DRAM +PB1 - piezo speaker + +*Pals: +"TIMING B" - AMPAL16R4APC (marked on silkscreen "TIMING PAL") +"DECODE E" - AMPAL16L8PC (marked on silkscreen "DECODE PAL") +"VIDEO 2B" - AMPAL16R4PC (marked on silkscreen "VIDEO PAL") +"DISK 3.5C" - AMPAL16R4PC (marked on silkscreen "DISK PAL") + +*Deviations from silkscreen: +4N37 (marked on silkscreen "4N35") +74F153 (marked on silkscreen "74ALS153") +74HCT259 is socketed, possibly intended that the rom expansion daughterboard will have a ribbon cable fit in its socket? + + +ToDo: +* Canon Cat +- Find the mirrors for the write-only video control register and figure out + what the writes actually do; hook these up properly to screen timing etc +- Floppy drive (3.5", Single Sided Double Density MFM, ~400kb) + * Cat has very low level control of data being read or written, much like + the Amiga or AppleII does + * first sector is id ZERO which is unusual since most MFM formats are base-1 + for sector numbering + * sectors are 512 bytes, standard MFM with usual address and data marks and + ccitt crc16 + * track 0 contains sector zero repeated identically 10 times; the cat SEEMS + to use this as a disk/document ID + * tracks 1-79 each contain ten sectors, id 0x0 thru 0x9 + ('normal' mfm parlance: sectors -1, 0, 1, ... 7, 8) + * this means the whole disk effectively contains 512*10*80 = 409600 bytes of + data, though track 0 is just a disk "unique" identifier for the cat + meaning 404480 usable bytes + * (Once the floppy is working I'd declare the system working) +- Centronics port finishing touches: verify where the paper out, slct/err, and + IPP pins map in memory. The firmware doesn't actually use them, but they must + map somewhere as they connect to the ASIC. +- RS232C port and Modem "port" connected to the DUART's two ports + These are currently optionally debug-logged but don't connect anywhere +- DTMF generator chip (connected to DUART 'user output' pins OP4,5,6,7) +- WIP: Watchdog timer/powerfail at 0x85xxxx (watchdog NMI needs to actually + fire if wdt goes above a certain number, possibly 3, 7 or F?) +- Canon Cat released versions known: 1.74 US (dumped), 2.40 US (dumped both + original compile, and Dwight's recompile from the released source code), + 2.42 (NEED DUMP) + It is possible a few prototype UK 1.74 or 2.40 units were produced; the code + roms of these will differ (they contain different spellcheck "core" code) as + well as the spellcheck roms, the keyboard id and the keycaps. +- Known Spellcheck roms: NH7-0684 (US, dumped); NH7-0724 (UK, NEED DUMP); + NH7-0813/0814 (Quebec/France, NEED DUMP); NH7-1019/1020/1021 (Germany, NEED DUMP) + It is possible the non-US roms were never officially released. + Wordlist sources: American Heritage (US and UK), Librarie Larousse (FR), + Langenscheidt (DE) +- (would-be-really-nice-but-totally-unnecessary feature): due to open bus, the + svrom1 and svrom2 checksums in diagnostics read as 01A80000 and 01020000 + respectively on a real machine (and hence appear inverted/'fail'-state). + This requires sub-cycle accurate 68k open bus emulation to pull off, as well + as emulating the fact that UDS/LDS are ?not connected? (unclear because this + happens inside an asic) for the SVROMS (or the svram or the code roms, for + that matter!) +- Hook Battery Low input to a dipswitch. +- Hook pfail to a dipswitch. +- Hook the floppy control register readback up properly, things seem to get + confused. + + +* Swyft +- Figure out the keyboard (interrupts are involved? or maybe an NMI on a + timer/vblank? It is possible this uses a similar 'keyboard read int' + to what the cat does) +- get the keyboard scanning actually working; the VIAs are going nuts right now. +- Beeper (on one of the vias?) +- vblank/hblank stuff +- Get the 6850 ACIA working for communications +- Floppy (probably similar to the Cat) +- Centronics port (attached to one of the VIAs) +- Joystick port (also likely on a via) +- Keypad? (also likely on a via done as a grid scan?) +- Forth button (on the port on the back; keep in mind shift-usefront-space ALWAYS enables forth on a swyft) +- Multple undumped firmware revisions exist (330 and 331 are dumped) + +// 74ls107 @ u18 pin 1 is 68008 /BERR pin + +// mc6850 @ u33 pin 2 (RX_DATA) is +// mc6850 @ u33 pin 3 (RX_CLK) is 6522 @ u35 pin 17 (PB7) +// mc6850 @ u33 pin 4 (TX_CLK) is 6522 @ u35 pin 17 (PB7) +// mc6850 @ u33 pin 5 (/RTS) is +// mc6850 @ u33 pin 6 (TX_DATA) is +// mc6850 @ u33 pin 7 (/IRQ) is 68008 /IPL1 pin 41 +// mc6850 @ u33 pin 8 (CS0) is 68008 A12 pin 10 +// mc6850 @ u33 pin 9 (CS2) is DECODE E pin 18 +// mc6850 @ u33 pin 10 (CS1) is 68008 /BERR pin 40 +// mc6850 @ u33 pin 11 (RS) is 68008 A0 pin 46 +// mc6850 @ u33 pin 13 (R/W) is 68008 R/W pin 30 +// mc6850 @ u33 pin 14 (E) is 68008 E pin 38 +// mc6850 @ u33 pin 15-22 (D7-D0) are 68008 D7 to D0 pins 20-27 +// mc6850 @ u33 pin 23 (/DCD) is 74hc02 @ u35 pin 1 +// mc6850 @ u33 pin 24 (/CTS) is N/C? + +// 6522 @ u34: +// pin 2 (PA0) : +// pin 3 (PA1) : +// pin 4 (PA2) : +// pin 5 (PA3) : +// pin 6 (PA4) : +// pin 7 (PA5) : +// pin 8 (PA6) : +// pin 9 (PA7) : +// pin 10 (PB0) : +// pin 11 (PB1) : +// pin 12 (PB2) : +// pin 13 (PB3) : +// pin 14 (PB4) : +// pin 15 (PB5) : +// pin 16 (PB6) : +// pin 17 (PB7) : +// pin 18 (CB1) : ?from/to? Floppy connector j3 pin 8 +// pin 19 (CB2) : ?from/to? 6522 @ u35 pin 16 (PB6) +// pin 21 (/IRQ) : out to 68008 /IPL1 pin 41 +// pin 22 (R/W) : in from 68008 R/W pin 30 +// pin 23 (/CS2) : in from DECODE E pin 18 +// pin 24 (CS1) : in from 68008 A13 pin 11 +// pin 25 (Phi2) : in from 68008 E pin 38 +// pins 26-33 : in/out from/to 68008 D7 to D0 pins 20-27 +// pin 34 (/RES) : in from 68008 /RESET pin 37 AND 68008 /HALT pin 36 +// pins 35-38 (RS3-RS0) are 68008 A9-A6 pins 7-4 +// pin 39 (CA2) is through inductor L11 and resistor r128 to peripheral connector pin 35 +// pin 40 (CA1) is through inductor L30 and resistor r138 to peripheral connector pin 53 + +// 6522 @ u35 +// pin 2 (PA0) : +// pin 3 (PA1) : +// pin 4 (PA2) : +// pin 5 (PA3) : +// pin 6 (PA4) : +// pin 7 (PA5) : +// pin 8 (PA6) : +// pin 9 (PA7) : +// pin 10 (PB0) : +// pin 11 (PB1) : in from 74hc02 @ u36 pin 4 +// pin 12 (PB2) : +// pin 13 (PB3) : +// pin 14 (PB4) : +// pin 15 (PB5) : +// pin 16 (PB6) : 6522 @ u34 pin 19 (CB2) +// pin 17 (PB7) : mc6850 @ u33 pins 3 and 4 (RX_CLK, TX_CLK) +// pin 18 (CB1) : ds1489an @ u45 pin 11 +// pin 19 (CB2) : mn4053b @ u40 pin 11 and mc14412 @ u41 pin 10 +// pin 21 (/IRQ) : out to 68008 /IPL1 pin 41 +// pin 22 (R/W) : in from 68008 R/W pin 30 +// pin 23 (/CS2) : in from DECODE E pin 18 +// pin 24 (CS1) : in from 68008 A14 pin 12 +// pin 25 (Phi2) : in from 68008 E pin 38 +// pins 26-33 : in/out from/to 68008 D7 to D0 pins 20-27 +// pin 34 (/RES) : in from 68008 /RESET pin 37 AND 68008 /HALT pin 36 +// pins 35-38 (RS3-RS0) : in from 68008 A9-A6 pins 7-4 +// pin 39 (CA2) : out to 74HCT34 pin 11 (CLK) (keyboard column latch) +// pin 40 (CA1) : out? to? ds1489an @ u45 pin 8 + +// 74hc02 @ u36: +// pin 1 (Y1) : out to mc6850 @ u33 pin 23 /DCD +// pin 2 (A1) : in from (2 places: resistor R58 to ua339 @ u38 pin 4 (In1-)) +// pin 3 (B1) : in from mn4053b @ u40 pin 10 +// pin 4 (Y2) : out to 6522 @u35 pin 11 +// pin 5 (A2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) +// pin 6 (B2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) +// pin 8 (B3) : +// pin 9 (A3) : +// pin 10 (Y3) : +// pin 11 (B4) : in from 68008 A15 +// pin 12 (A4) : in from 68008 A15 +// pin 13 (Y4) : out to EPROM @ U31 /CE + +****************************************************************************/ + +// Defines + +#undef DEBUG_GA2OPR_W +#undef DEBUG_VIDEO_CONTROL_W + +#undef DEBUG_FLOPPY_CONTROL_W +#undef DEBUG_FLOPPY_CONTROL_R +#undef DEBUG_FLOPPY_DATA_W +#undef DEBUG_FLOPPY_DATA_R +#undef DEBUG_FLOPPY_STATUS_R + +#undef DEBUG_PRINTER_DATA_W +#undef DEBUG_PRINTER_CONTROL_W + +#undef DEBUG_MODEM_R +#undef DEBUG_MODEM_W + +#undef DEBUG_DUART_OUTPUT_LINES +// data sent to rs232 port +#undef DEBUG_DUART_TXA +// data sent to modem chip +#undef DEBUG_DUART_TXB +#undef DEBUG_DUART_IRQ_HANDLER +#undef DEBUG_PRN_FF + +#undef DEBUG_TEST_W + +#define DEBUG_SWYFT_VIA0 1 +#define DEBUG_SWYFT_VIA1 1 + + +// Includes +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/clock.h" +#include "machine/mc68681.h" +#include "machine/6850acia.h" +#include "machine/6522via.h" +#include "machine/nvram.h" +#include "sound/speaker.h" +#include "bus/centronics/ctronics.h" + +class cat_state : public driver_device +{ +public: + enum + { + TIMER_KEYBOARD, + TIMER_COUNTER_6MS + }; + + cat_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + //m_nvram(*this, "nvram"), // merge with svram? + m_duart(*this, "duartn68681"), + m_ctx(*this, "ctx"), + m_ctx_data_out(*this, "ctx_data_out"), + m_acia6850(*this, "acia6850"), + m_via0(*this, "via6522_0"), + m_via1(*this, "via6522_1"), + m_speaker(*this, "speaker"), + m_svram(*this, "svram"), // nvram + m_p_cat_videoram(*this, "p_cat_vram"), + m_p_swyft_videoram(*this, "p_swyft_vram"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_dipsw(*this, "DIPSW1") + { } + + required_device m_maincpu; + //optional_device m_nvram; + optional_device m_duart; // only cat uses this + optional_device m_ctx; + optional_device m_ctx_data_out; + optional_device m_acia6850; // only swyft uses this + optional_device m_via0; // only swyft uses this + optional_device m_via1; // only swyft uses this + optional_device m_speaker; + optional_shared_ptr m_svram; + optional_shared_ptr m_p_cat_videoram; + optional_shared_ptr m_p_swyft_videoram; + optional_ioport m_y0; + optional_ioport m_y1; + optional_ioport m_y2; + optional_ioport m_y3; + optional_ioport m_y4; + optional_ioport m_y5; + optional_ioport m_y6; + optional_ioport m_y7; + optional_ioport m_dipsw; + emu_timer *m_keyboard_timer; + emu_timer *m_6ms_timer; + + DECLARE_MACHINE_START(cat); + DECLARE_MACHINE_RESET(cat); + DECLARE_VIDEO_START(cat); + DECLARE_DRIVER_INIT(cat); + DECLARE_MACHINE_START(swyft); + DECLARE_MACHINE_RESET(swyft); + DECLARE_VIDEO_START(swyft); + + UINT32 screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE_LINE_MEMBER(cat_duart_irq_handler); + DECLARE_WRITE_LINE_MEMBER(cat_duart_txa); + DECLARE_WRITE_LINE_MEMBER(cat_duart_txb); + DECLARE_WRITE8_MEMBER(cat_duart_output); + DECLARE_WRITE_LINE_MEMBER(prn_ack_ff); + + DECLARE_READ16_MEMBER(cat_floppy_control_r); + DECLARE_WRITE16_MEMBER(cat_floppy_control_w); + DECLARE_WRITE16_MEMBER(cat_printer_data_w); + DECLARE_READ16_MEMBER(cat_floppy_data_r); + DECLARE_WRITE16_MEMBER(cat_floppy_data_w); + DECLARE_READ16_MEMBER(cat_keyboard_r); + DECLARE_WRITE16_MEMBER(cat_keyboard_w); + DECLARE_WRITE16_MEMBER(cat_video_control_w); + DECLARE_READ16_MEMBER(cat_floppy_status_r); + DECLARE_READ16_MEMBER(cat_battery_r); + DECLARE_WRITE16_MEMBER(cat_printer_control_w); + DECLARE_READ16_MEMBER(cat_modem_r); + DECLARE_WRITE16_MEMBER(cat_modem_w); + DECLARE_READ16_MEMBER(cat_6ms_counter_r); + DECLARE_WRITE16_MEMBER(cat_opr_w); + DECLARE_READ16_MEMBER(cat_wdt_r); + DECLARE_WRITE16_MEMBER(cat_tcb_w); + DECLARE_READ16_MEMBER(cat_2e80_r); + DECLARE_READ16_MEMBER(cat_0080_r); + DECLARE_READ16_MEMBER(cat_0000_r); + + DECLARE_READ8_MEMBER(swyft_d0000); + + DECLARE_READ8_MEMBER(swyft_via0_r); + DECLARE_WRITE8_MEMBER(swyft_via0_w); + DECLARE_READ8_MEMBER(via0_pa_r); + DECLARE_WRITE8_MEMBER(via0_pa_w); + DECLARE_WRITE_LINE_MEMBER(via0_ca2_w); + DECLARE_READ8_MEMBER(via0_pb_r); + DECLARE_WRITE8_MEMBER(via0_pb_w); + DECLARE_WRITE_LINE_MEMBER(via0_cb1_w); + DECLARE_WRITE_LINE_MEMBER(via0_cb2_w); + DECLARE_WRITE_LINE_MEMBER(via0_int_w); + + DECLARE_READ8_MEMBER(swyft_via1_r); + DECLARE_WRITE8_MEMBER(swyft_via1_w); + DECLARE_READ8_MEMBER(via1_pa_r); + DECLARE_WRITE8_MEMBER(via1_pa_w); + DECLARE_WRITE_LINE_MEMBER(via1_ca2_w); + DECLARE_READ8_MEMBER(via1_pb_r); + DECLARE_WRITE8_MEMBER(via1_pb_w); + DECLARE_WRITE_LINE_MEMBER(via1_cb1_w); + DECLARE_WRITE_LINE_MEMBER(via1_cb2_w); + DECLARE_WRITE_LINE_MEMBER(via1_int_w); + + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + + /* gate array 2 has a 16-bit counter inside which counts at 10mhz and + rolls over at FFFF->0000; on roll-over (or likely at FFFF terminal count) + it triggers the KTOBF output. It does this every 6.5535ms, which causes + a 74LS74 d-latch at IC100 to invert the state of the DUART IP2 line; + this causes the DUART to fire an interrupt, which makes the 68000 read + the keyboard. + The watchdog counter and the 6ms counter are both incremented + every time the KTOBF pulses. + */ + UINT16 m_6ms_counter; + UINT8 m_wdt_counter; + UINT8 m_duart_ktobf_ff; + /* the /ACK line from the centronics printer port goes through a similar + flipflop to the ktobf line as well, so duart IP4 inverts on /ACK rising edge + */ + UINT8 m_duart_prn_ack_prev_state; + UINT8 m_duart_prn_ack_ff; + /* Gate array 2 is in charge of serializing the video for display to the screen; + Gate array 1 is in charge of vblank/hblank timing, and in charge of refreshing + dram and indicating to GA2, using the /LDPS signal, what times the address it is + writing to ram it is intending to be used by GA2 to read 16 bits of data to be + shifted out to the screen. (it is obviously not active during hblank and vblank) + GA2 then takes: ((output_bit XNOR video_invert) AND video enable), and serially + bangs the result to the analog display circuitry. + */ + UINT8 m_video_enable; + UINT8 m_video_invert; + UINT16 m_pr_cont; + UINT8 m_keyboard_line; + UINT8 m_floppy_control; + + //TIMER_CALLBACK_MEMBER(keyboard_callback); + TIMER_CALLBACK_MEMBER(counter_6ms_callback); + IRQ_CALLBACK_MEMBER(cat_int_ack); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +// TODO: this init doesn't actually work yet! please fix me! +/* +DRIVER_INIT_MEMBER( cat_state,cat ) +{ + UINT8 *svrom = memregion("svrom")->base(); + int i; + // fill svrom with the correct 2e80 pattern except where svrom1 sits + // first half + for (i = 0; i < 0x20000; i+=2) + svrom[i] = 0x2E; + // second half + for (i = 0x20000; i < 0x40000; i+=2) + { + svrom[i] = 0x2E; + svrom[i+1] = 0x80; + } +}*/ + +/* 0x600000-0x65ffff Write: Video Generator (AKA NH4-5001 AKA Gate Array #1 @ IC30) + writing to the video generator is done by putting the register number in the high 3 bits + and the data to write in the lower 12 (14?) bits. + The actual data-bus data written here is completely ignored, + in fact it isn't even connected to the gate array; The firmware writes 0x0000. + hence: + 0 = must be 0 + s = register select + d = data to write + ? = unknown + x = ignored + ? 1 1 ? ? s s s s ? ? ? ? ? ? d d d d d d d d . + 600xxx - VSE (End of Frame) + 608xxx - VST (End of VSync) + 610xxx - VSS (VSync Start) + 618xxx - VDE (Active Lines) = value written * 4 + 620xxx - unknown + 628xxx - unknown + 630xxx - unknown + 638xxx - unknown + 640xxx - HSE (End H Line) + 648xxx - HST (End HSync) + 650xxx - HSS (HSync Start) + 658xxx - VOC (Video Control) + */ +WRITE16_MEMBER( cat_state::cat_video_control_w ) +{ + /* + * 006500AE , ( HSS HSync Start 89 ) + * 006480C2 , ( HST End HSync 96 ) + * 006400CE , ( HSE End H Line 104 ) + * 006180B0 , ( VDE Active Lines 344 ) + * 006100D4 , ( VSS VSync Start 362 ) + * 006080F4 , ( VST End of VSync 378 ) + * 00600120 , ( VSE End of Frame 400 ) + * 006581C0 , ( VOC Video Control Normal Syncs ) + * based on diagrams from https://archive.org/details/DTCJefRaskinDoc062 + * we can determine what at least some of these values do: + * HORIZONTAL: + * 0 is the first pixel output to the screen at the end of the frontporch + * stuff is shifted to the screen here, and then zeroed for the backporch; manual claims backporch is 2 cycles, it is actually 7 + * HSS (89) is the horizontal count at which the HSYNC pin goes high + * sync is active here for 7 cycles; manual claims 10 but is wrong + * HST (96) is the horizontal count at which the HSYNC pin goes low + * sync is inactive here for 7 cycles, manual claims 8 but is wrong?, this is the frontporch + * HSE (104) is the horizontal count at which the horizontal counter is reset to 0 (so counts 0-103 then back to 0) + * + * VERTICAL: + * 0 is the first vertical line displayed to screen + * VDE (344) affects the number of lines that /LDPS is active for display of + * VSS (362) is the vertical line at which the VSYNC pin goes high + * VST (378) is the vertical line at which the VSYNC pin goes low + * VSE (400) is the vertical line at which the vertical line count is reset to 0 + * VOC (0x1c0) controls the polarity and enabling of the sync signals in some unknown way + * Suffice to say, whatever bit combination 0b00011100000x does, it enables both horiz and vert sync and both are positive + */ +#ifdef DEBUG_VIDEO_CONTROL_W + static const char *const regDest[16] = { "VSE (End of frame)", "VST (End of VSync)", "VSS (Start of VSync)", "VDE (Active Lines)", "unknown 620xxx", "unknown 628xxx", "unknown 630xxx", "unknown 638xxx", "HSE (end of horizontal line)", "HST (end of HSync)", "HSS (HSync Start)", "VOC (Video Control)", "unknown 660xxx", "unknown 668xxx", "unknown 670xxx", "unknown 678xxx" }; + fprintf(stderr,"Write to video chip address %06X; %02X -> register %s with data %04X\n", 0x600000+(offset<<1), offset&0xFF, regDest[(offset&0x3C000)>>14], data); +#endif +} + +// Floppy control register (called fd.cont in the cat source code) + /* FEDCBA98 (76543210 is open bus) + * |||||||\-- unknown[1] (may be some sort of 'reset' or debug bit? the cat code explicitly clears this bit but never sets it) + * ||||||\--- WRITE GATE: 0 = write head disabled, 1 = write head enabled (verified from cat source code) + * |||||\---- unknown[2] (leftover debug bit? unused by cat code) + * ||||\----- /DIRECTION: 1 = in, 0 = out (verified from forth cmd) + * |||\------ /SIDESEL: 1 = side1, 0 = side0 (verified from forth cmd) + * ||\------- STEP: 1 = STEP active, 0 = STEP inactive (verified from cat source code) + * |\-------- MOTOR ON: 1 = on, 0 = off (verified) + * \--------- /DRIVESELECT: 1 = drive 0, 0 = drive 1 (verified from forth cmd) + * all 8 bits 'stick' on write and are readable at this register as well + * [1] writing this bit as high seems to 'freeze' floppy acquisition so + * the value at the floppy_data_r register is held rather than updated + * with new data from the shifter/mfm clock/data separator + * [2] this bit's function is unknown. it could possibly be an FM vs MFM selector bit, where high = MFM, low = FM ? or MFM vs GCR? + */ +// 0x800000-0x800001 read +READ16_MEMBER( cat_state::cat_floppy_control_r ) +{ +#ifdef DEBUG_FLOPPY_CONTROL_R + fprintf(stderr,"Read from Floppy Status address %06X\n", 0x800000+(offset<<1)); +#endif + return (m_floppy_control << 8)|0x80; // LOW 8 BITS ARE OPEN BUS +} +// 0x800000-0x800001 write +WRITE16_MEMBER( cat_state::cat_floppy_control_w ) +{ +#ifdef DEBUG_FLOPPY_CONTROL_W + fprintf(stderr,"Write to Floppy Control address %06X, data %04X\n", 0x800000+(offset<<1), data); +#endif + m_floppy_control = (data >> 8)&0xFF; +} + +// 0x800002-0x800003 read = 0x0080, see open bus +// 0x800002-0x800003 write +WRITE16_MEMBER( cat_state::cat_keyboard_w ) +{ + m_keyboard_line = data >> 8; +} + +// 0x800004-0x800005 'pr.data' write +// /DSTB (centronics pin 1) is implied by the cat source code to be pulsed +// low (for some unknown period of time) upon any write to this port. +WRITE16_MEMBER( cat_state::cat_printer_data_w ) +{ +#ifdef DEBUG_PRINTER_DATA_W + fprintf(stderr,"Write to Printer Data address %06X, data %04X\n", 0x800004+(offset<<1), data); +#endif + m_ctx_data_out->write(data>>8); + m_ctx->write_strobe(1); + m_ctx->write_strobe(0); + m_ctx->write_strobe(1); +} +// 0x800006-0x800007: Floppy data register (called fd.dwr in the cat source code) +READ16_MEMBER( cat_state::cat_floppy_data_r ) +{ +#ifdef DEBUG_FLOPPY_DATA_R + fprintf(stderr,"Read from Floppy Data address %06X\n", 0x800006+(offset<<1)); +#endif + return 0x0080; +} +WRITE16_MEMBER( cat_state::cat_floppy_data_w ) +{ +#ifdef DEBUG_FLOPPY_DATA_W + fprintf(stderr,"Write to Floppy Data address %06X, data %04X\n", 0x800006+(offset<<1), data); +#endif +} + +// 0x800008-0x800009: Floppy status register (called fd.status in the cat source code) + /* FEDCBA98 (76543210 is open bus) + * |||||||\-- ? always low + * ||||||\--- ? always low + * |||||\---- READY: 1 = ready, 0 = not ready (verified from cat source code) + * ||||\----- /WRITE PROTECT: 1 = writable, 0 = protected (verified) + * |||\------ /TRACK0: 0 = on track 0, 1 = not on track 0 (verified) + * ||\------- /INDEX: 0 = index sensor active, 1 = index sensor inactive (verified) + * |\-------- ? this bit may indicate which drive is selected, i.e. same as floppy control bit 7; low on drive 1, high on drive 0? + * \--------- ? this bit may indicate 'data separator overflow'; it is usually low but becomes high if you manually select the floppy drive + ALL of these bits except bit F seem to be reset when the selected drive in floppy control is switched + */ +READ16_MEMBER( cat_state::cat_floppy_status_r ) +{ +#ifdef DEBUG_FLOPPY_STATUS_R + fprintf(stderr,"Read from Floppy Status address %06X\n", 0x800008+(offset<<1)); +#endif + return 0x2480; +} + +// 0x80000a-0x80000b +READ16_MEMBER( cat_state::cat_keyboard_r ) +{ + UINT16 retVal = 0; + // Read country code + if ((m_pr_cont&0xFF00) == 0x0900) + retVal = m_dipsw->read(); + + // Regular keyboard read + if ((m_pr_cont&0xFF00) == 0x0800 || (m_pr_cont&0xFF00) == 0x0a00) + { + retVal=0xff00; + switch(m_keyboard_line) + { + case 0x01: retVal = m_y0->read() << 8; break; + case 0x02: retVal = m_y1->read() << 8; break; + case 0x04: retVal = m_y2->read() << 8; break; + case 0x08: retVal = m_y3->read() << 8; break; + case 0x10: retVal = m_y4->read() << 8; break; + case 0x20: retVal = m_y5->read() << 8; break; + case 0x40: retVal = m_y6->read() << 8; break; + case 0x80: retVal = m_y7->read() << 8; break; + } + } +#if 0 + if (((m_pr_cont&0xFF00) != 0x0800) && ((m_pr_cont&0xFF00) != 0x0900) && ((m_pr_cont&0xFF00) != 0x0a00)) + { + fprintf(stderr,"Read from keyboard in %06X with unexpected pr_cont %04X\n", 0x80000a+(offset<<1), m_pr_cont); + } +#endif + return retVal; +} + +// 0x80000c-0x80000d (unused in cat source code; may have originally been a separate read only port where 800006 would have been write-only) + +// 0x80000e-0x80000f 'pr.cont' read +READ16_MEMBER( cat_state::cat_battery_r ) +{ + /* + * FEDCBA98 (76543210 is open bus) + * |||||||\-- ? possibly PE (pin 1) read ("PAPER OUT" pin 12 of centronics port) + * ||||||\--- ? possibly SLCT/ERR (pin 3) read ("not selected or error" NAND of pins 32 and 13 of centronics port) + * |||||\---- (always 0?) + * ||||\----- (always 0?) + * |||\------ (always 0?) + * ||\------- (always 0?) + * |\-------- (always 0?) + * \--------- Battery status (0 = good, 1 = bad) + */ + /* just return that battery is full, i.e. bit 15 is 0 */ + /* to make the cat think the battery is bad, return 0x8080 instead of 0x0080 */ + // TODO: hook this to a dipswitch + return 0x0080; +} +// 0x80000e-0x80000f 'pr.cont' write +WRITE16_MEMBER( cat_state::cat_printer_control_w ) +{ + /* + * FEDCBA98 (76543210 is ignored) + * |||||||\-- CC line enable (pin 34) (verified from cat source code) + * ||||||\--- LEDE line enable (pin 33) (verified from cat source code) + * |||||\---- ? + * ||||\----- ? may be IPP (pin 2) write (non-standard pin 34 of centronics port) or another watchdog reset bit; may also be /DSTB-enable-on-pr.data-write + * |||\------ ? + * ||\------- ? + * |\-------- ? + * \--------- ? + */ + // writes of 0x0A00 turn on the keyboard LED on the LOCK key + // writes of 0x0800 turn off the keyboard LED on the LOCK key +#ifdef DEBUG_PRINTER_CONTROL_W + fprintf(stderr,"Write to Printer Control address %06X, data %04X\n", (offset<<1)+0x80000e, data); +#endif + m_pr_cont = data; +} + +// 0x820000: AMI S35213 300/1200 Single Chip Modem (datasheet found at http://bitsavers.trailing-edge.com/pdf/ami/_dataBooks/1985_AMI_MOS_Products_Catalog.pdf on pdf page 243) +READ16_MEMBER( cat_state::cat_modem_r ) +{ +#ifdef DEBUG_MODEM_R + fprintf(stderr,"Read from s35213 modem address %06X\n", 0x820000+(offset<<1)); +#endif +// HACK: return default 'sane' modem state + return 0x00; +} + +WRITE16_MEMBER( cat_state::cat_modem_w ) +{ +#ifdef DEBUG_MODEM_W + fprintf(stderr,"Write to s35213 modem address %06X, data %04X\n", 0x820000+(offset<<1), data); +#endif +} + +// 0x830000: 6ms counter (counts KTOBF pulses and does not reset; 16 bits wide) +READ16_MEMBER( cat_state::cat_6ms_counter_r ) +{ + return m_6ms_counter; +} + +/* 0x840001: 'opr' or 'ga2opr' Output Port Register (within GA2) + * writing anything with bit 3 set here resets the watchdog + * if the watchdog expires /NMI (and maybe /RESET) are asserted to the cpu + * watchdog counter (counts KTOBF pulses and is reset on any ga2opr write with bit 3 set; <9 bits wide) + */ +WRITE16_MEMBER( cat_state::cat_opr_w ) +{ + /* + * 76543210 (FEDCBA98 are ignored) + * |||||||\-- OFFHOOK pin (pin 3) output control (1 = puts phone off hook by energizing relay K2) + * ||||||\--- PHONE pin (pin 4) output control (1 = connects phone and line together by energizing relay K1) + * |||||\---- Video enable (1 = video on, 0 = video off/screen black) + * ||||\----- Watchdog reset (the watchdog is reset whenever this bit is written with a 1) + * |||\------ Video invert (1 = black-on-white video; 0 = white-on-black) + * ||\------- (unused?) + * |\-------- (unused?) + * \--------- (unused?) + */ +#ifdef DEBUG_GA2OPR_W + if (data != 0x001C) + fprintf(stderr, "GA2 OPR (video ena/inv, watchdog, and phone relay) reg write: offset %06X, data %04X\n", 0x840000+(offset<<1), data); +#endif + if (data&0x08) m_wdt_counter = 0; + m_video_enable = BIT( data, 2 ); + m_video_invert = 1-BIT( data, 4 ); +} + +// 0x850000: 'wdt' "watchdog timer and power fail", read only? + /* NOTE: BELOW IS A GUESS based on seeing what the register reads as, + * the cat code barely touches this stuff at all, despite the fact + * that the service manual states that PFAIL is supposed to be checked + * before each write to SVRAM, the forth code does NOT actually do that! + * + * 76543210 + * ??????\\-- Watchdog count? (counts upward? if this reaches the watchdog fires? writing bit 3 set to opr above resets this) + * + * FEDCBA98 + * |||||||\-- PFAIL state (MB3771 comparator: 1: vcc = 5v; 0: vcc != 5v, hence do not write to svram!) + * ||||||\--- (always 0?) + * |||||\---- (always 0?) + * ||||\----- (always 0?) + * |||\------ (always 0?) + * ||\------- (always 0?) + * |\-------- (always 0?) + * \--------- (always 0?) + */ +READ16_MEMBER( cat_state::cat_wdt_r ) +{ + uint16 Retval = 0x0100; // set pfail to 1; should this be a dipswitch? + return Retval | m_wdt_counter; +} + +// 0x860000: 'tcb' "test control bits" test mode register; what the bits do is +// unknown. 0x0000 is written here to disable test mode, and that is the extent +// of the cat touching this register. +WRITE16_MEMBER( cat_state::cat_tcb_w ) +{ +#ifdef DEBUG_TEST_W + fprintf(stderr, "Test reg write: offset %06X, data %04X\n", 0x860000+(offset<<1), data); +#endif +} + +// open bus etc handlers +READ16_MEMBER( cat_state::cat_2e80_r ) +{ + return 0x2e80; +} + +READ16_MEMBER( cat_state::cat_0000_r ) +{ + return 0x0000; +} + +READ16_MEMBER( cat_state::cat_0080_r ) +{ + return 0x0080; +} + + +/* Canon cat memory map, based on testing and a 16MB dump of the entire address space of a running unit using forth "1000000 0 do i c@ semit loop" +68k address map: +a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 (a0 via UDS/LDS) +*i *i * x x * * * x x x x x x x x x x x x x x x x *GATE ARRAY 2 DECODES THESE LINES TO ENABLE THIS AREA* (a23 and a22 are indirectly decoded via the /RAMROMCS and /IOCS lines from gate array 1) +0 0 0 x x 0 a * * * * * * * * * * * * * * * * b R ROM (ab: 00=ic4 01=ic2 10=ic5 11=ic3) (EPROM 27C512 x 4) [controlled via GA2 /ROMCS] +0 0 0 x x 1 0 0 x x * * * * * * * * * * * * * 0 RW SVRAM ic11 d4364 (battery backed) [controlled via GA2 /RAMCS] +0 0 0 x x 1 x 1 x x x x x x x x x x x x x x x 0 O OPEN BUS (reads as 0x2e) [may be controlled via GA2 /RAMCS?] +0 0 0 x x 1 1 0 x x x x x x x x x x x x x x x 0 O OPEN BUS (reads as 0x2e) [may be controlled via GA2 /RAMCS?] +0 0 0 x x 1 x x x x x x x x x x x x x x x x x 1 O OPEN BUS (reads as 0x80) [may be controlled via GA2 /RAMCS?] +0 0 1 x x 0 * * * * * * * * * * * * * * * * * 0 R SVROM 2 ic7 (not present on cat as sold, open bus reads as 0x2e) [controlled via GA2 /SVCS0] +0 0 1 x x 0 * * * * * * * * * * * * * * * * * 1 R SVROM 0 ic6 (MASK ROM tc531000) [controlled via GA2 /SVCS0] +0 0 1 x x 1 * * * * * * * * * * * * * * * * * 0 O OPEN BUS (reads as 0x2e) [controlled via GA2 /SVCS1] *SEE BELOW* +0 0 1 x x 1 * * * * * * * * * * * * * * * * * 1 R SVROM 1 ic8 (not present on cat as sold, open bus reads as 0x80) [controlled via GA2 /SVCS1] *SEE BELOW* + *NOTE: on Dwight E's user-made developer unit, two 128K SRAMS are mapped in place of the two entries immediately above!* (this involves some creative wiring+sockets); the official IAI 'shadow ram board' maps the ram to the A00000-A3FFFF area instead) +0 1 * * * * * * * * * * * * * * * * * * * * * * *BOTH GATE ARRAYS 1 and 2 DECODE THIS AREA; 2 DEALS WITH ADDR AND 1 WITH DATA/CAS/RAS* +0 1 0 x x a b * * * * * * * * * * * * * * * * * RW VIDEO/SYSTEM DRAM (ab: 00=row 0, ic26-29; 01=row 1, ic22-25; 10=row 2; ic18-21; 11=row 3; ic14-17) + *NOTE: DRAM rows 2 and 3 above are only usually populated in cat developer units!* +0 1 1 ? ? * * * ? ? ? ? ? ? ? * * * * * * * * x W VIDEO CONTRL REGISTERS (reads as 0x2e80) +1 x x x x x x x x x x x x x x x x x x * * * * * *GATE ARRAY 3 DECODES THIS AREA, GA3 IS ENABLED BY /IOCS1 FROM GA2* +1 0 0 Y Y 0 0 0 x x x x x x x x x x x * * * * 0 {'ga3'} *IO AREA* Note byte reads in this area behave erratically if both Y bits are set while word reads work fine always + x x x x 1 O OPEN BUS (reads as 0x80) + 0 0 0 0 0 RW {'fd.cont'} Floppy control lines (drive select, motor on, direction, step, side select, ?write gate?) + 0 0 0 1 0 W {'kb.wr'} Keyboard Row Select (reads as 0x00) + 0 0 1 0 0 W {'pr.data'} Centronics Printer Data W (reads as 0x00) + 0 0 1 1 0 RW {'fd.dwr' and 'fd.drd'} Floppy data read/write register; maybe the write gate value in fd.cont chooses which? + 0 1 0 0 0 R {'fd.status'} Floppy status lines (write protect, ready, index, track0) + 0 1 0 1 0 R Keyboard Column Read + 0 1 1 0 0 W? Unknown (reads as 0x00) + 0 1 1 1 0 RW {'pr.cont'} Read: Battery status (MSB bit, 0 = ok, 1 = dead, other bits read as 0)/Write: Centronics Printer and Keyboard LED/Country Code Related + 1 x x x 0 W? Unknown (reads as 0x00) +1 0 0 x x 0 0 1 x x x x x x x x x x x * * * * 1 RW {'duart'} 68681 DUART at ic34 [controlled via GA2 /DUARTCS] +1 0 0 x x 0 1 0 x x x x x x x x x x * * * * * 0 RW {'modem'} Modem Chip AMI S35213 @ IC37 DATA BIT 7 ONLY [controlled via GA2 /SMCS] +1 0 0 x x 0 1 1 x x x x x x x x x x x x x x x * R {'timer'} Read: Fixed 16-bit counter from ga2. increments every 6.5535ms when another 16-bit counter clocked at 10mhz overflows +1 0 0 x x 1 0 0 x x x x x x x x x x x x x x x * W {'opr'} Output Port (Video/Sync enable and watchdog reset?) register (screen enable on bit 3?) (reads as 0x2e80) +1 0 0 x x 1 0 1 x x x x x x x x x x x x x x x * R {'wdt'} Watchdog timer reads as 0x0100 0x0101 or 0x0102, some sort of test register or video status register? +1 0 0 x x 1 1 0 x x x x x x x x x x x x x x x * R?W {'tcb'} test control bits (reads as 0x0000) +1 0 0 x x 1 1 1 x x x x x x x x x x x x x x x * ? Unknown (reads as 0x2e80) + +1 0 1 x x x x x x x x x x x x x x x x x x x x x O OPEN BUS (reads as 0x2e80) [68k DTACK is asserted by gate array 1 when accessing this area, for testing?] On real IAI shadow rom board, at least 0x40000 of ram lives here. +1 1 x x x x x x x x x x x x x x x x x x x x x x O OPEN BUS (reads as 0x2e80) [68k VPA is asserted by gate array 1 when accessing this area, for testing?] +*/ + + +static ADDRESS_MAP_START(cat_mem, AS_PROGRAM, 16, cat_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_MIRROR(0x180000) // 256 KB ROM + AM_RANGE(0x040000, 0x043fff) AM_RAM AM_SHARE("svram") AM_MIRROR(0x18C000)// SRAM powered by battery + AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("svrom",0x0000) AM_MIRROR(0x180000) // SV ROM + AM_RANGE(0x400000, 0x47ffff) AM_RAM AM_SHARE("p_cat_vram") AM_MIRROR(0x180000) // 512 KB RAM + AM_RANGE(0x600000, 0x67ffff) AM_READWRITE(cat_2e80_r,cat_video_control_w) AM_MIRROR(0x180000) // Gate Array #1: Video Addressing and Timing, dram refresh timing, dram /cs and /wr (ga2 does the actual video invert/display and access to the dram data bus) + AM_RANGE(0x800000, 0x800001) AM_READWRITE(cat_floppy_control_r, cat_floppy_control_w) AM_MIRROR(0x18FFE0) // floppy control lines and readback + AM_RANGE(0x800002, 0x800003) AM_READWRITE(cat_0080_r, cat_keyboard_w) AM_MIRROR(0x18FFE0) // keyboard col write + AM_RANGE(0x800004, 0x800005) AM_READWRITE(cat_0080_r, cat_printer_data_w) AM_MIRROR(0x18FFE0) // Centronics Printer Data + AM_RANGE(0x800006, 0x800007) AM_READWRITE(cat_floppy_data_r,cat_floppy_data_w) AM_MIRROR(0x18FFE0) // floppy data read/write + AM_RANGE(0x800008, 0x800009) AM_READ(cat_floppy_status_r) AM_MIRROR(0x18FFE0) // floppy status lines + AM_RANGE(0x80000a, 0x80000b) AM_READ(cat_keyboard_r) AM_MIRROR(0x18FFE0) // keyboard row read + AM_RANGE(0x80000c, 0x80000d) AM_READ(cat_0080_r) AM_MIRROR(0x18FFE0) // Open bus? + AM_RANGE(0x80000e, 0x80000f) AM_READWRITE(cat_battery_r,cat_printer_control_w) AM_MIRROR(0x18FFE0) // Centronics Printer Control, keyboard led and country code enable + AM_RANGE(0x800010, 0x80001f) AM_READ(cat_0080_r) AM_MIRROR(0x18FFE0) // Open bus? + AM_RANGE(0x810000, 0x81001f) AM_DEVREADWRITE8("duartn68681", mc68681_device, read, write, 0xff ) AM_MIRROR(0x18FFE0) + AM_RANGE(0x820000, 0x82003f) AM_READWRITE(cat_modem_r,cat_modem_w) AM_MIRROR(0x18FFC0) // AMI S35213 Modem Chip, all access is on bit 7 + AM_RANGE(0x830000, 0x830001) AM_READ(cat_6ms_counter_r) AM_MIRROR(0x18FFFE) // 16bit 6ms counter clocked by output of another 16bit counter clocked at 10mhz + AM_RANGE(0x840000, 0x840001) AM_READWRITE(cat_2e80_r,cat_opr_w) AM_MIRROR(0x18FFFE) // GA2 Output port register (video enable, invert, watchdog reset, phone relays) + AM_RANGE(0x850000, 0x850001) AM_READ(cat_wdt_r) AM_MIRROR(0x18FFFE) // watchdog and power fail state read + AM_RANGE(0x860000, 0x860001) AM_READWRITE(cat_0000_r, cat_tcb_w) AM_MIRROR(0x18FFFE) // Test mode + AM_RANGE(0x870000, 0x870001) AM_READ(cat_2e80_r) AM_MIRROR(0x18FFFE) // Open bus? + AM_RANGE(0xA00000, 0xA00001) AM_READ(cat_2e80_r) AM_MIRROR(0x1FFFFE) // Open bus/dtack? The 0xA00000-0xA3ffff area is ram used for shadow rom storage on cat developer machines, which is either banked over top of, or jumped to instead of the normal rom + AM_RANGE(0xC00000, 0xC00001) AM_READ(cat_2e80_r) AM_MIRROR(0x3FFFFE) // Open bus/vme? +ADDRESS_MAP_END + +/* Input ports */ + +/* 2009-07 FP + FIXME: Natural keyboard does not catch all the Shifted chars. No idea of the reason! */ +static INPUT_PORTS_START( cat ) + PORT_START("DIPSW1") + PORT_DIPNAME( 0x8000, 0x8000, "Mode" ) + PORT_DIPSETTING( 0x8000, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x0000, "Diagnostic" ) + PORT_DIPNAME( 0x7f00,0x7f00, "Country code" ) + PORT_DIPSETTING( 0x7f00, "United States" ) + PORT_DIPSETTING( 0x7e00, "Canada" ) + PORT_DIPSETTING( 0x7d00, "United Kingdom" ) + PORT_DIPSETTING( 0x7c00, "Norway" ) + PORT_DIPSETTING( 0x7b00, "France" ) + PORT_DIPSETTING( 0x7a00, "Denmark" ) + PORT_DIPSETTING( 0x7900, "Sweden" ) + PORT_DIPSETTING( 0x7800, DEF_STR(Japan) ) + PORT_DIPSETTING( 0x7700, "West Germany" ) + PORT_DIPSETTING( 0x7600, "Netherlands" ) + PORT_DIPSETTING( 0x7500, "Spain" ) + PORT_DIPSETTING( 0x7400, "Italy" ) + PORT_DIPSETTING( 0x7300, "Latin America" ) + PORT_DIPSETTING( 0x7200, "South Africa" ) + PORT_DIPSETTING( 0x7100, "Switzerland" ) + PORT_DIPSETTING( 0x7000, "ASCII" ) + + PORT_START("Y0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\xa2') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START("Y1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('n') PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + + PORT_START("Y2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // totally unused + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START("Y3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left USE FRONT") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // totally unused + + PORT_START("Y4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right USE FRONT") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_F2) // intl only: latin diaresis and latin !; norway, danish and finnish * and '; others + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + + PORT_START("Y5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\xbd') PORT_CHAR('\xbc') //PORT_CHAR('}') PORT_CHAR('{') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("Y6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_F1) // intl only: latin inv ? and inv !; norway and danish ! and |; finnish <>; others + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left LEAP") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('[') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // totally unused + + PORT_START("Y7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Leap") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Page") PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // totally unused + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UNDO") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\xb1') PORT_CHAR('\xb0') // PORT_CHAR('\\') PORT_CHAR('~') +INPUT_PORTS_END + +static INPUT_PORTS_START( swyft ) +// insert dwight and sandy's swyft keyboard map here once we figure out the byte line order +INPUT_PORTS_END + + +void cat_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_COUNTER_6MS: + counter_6ms_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in cat_state::device_timer"); + } +} + +TIMER_CALLBACK_MEMBER(cat_state::counter_6ms_callback) +{ + // This is effectively also the KTOBF (guessed: acronym for "Keyboard Timer Out Bit Flip") + // line connected in such a way to invert the d-flipflop connected to the duart IP2 + m_duart_ktobf_ff ^= 1; + m_duart->ip2_w(m_duart_ktobf_ff); + m_wdt_counter++; + m_6ms_counter++; +} + +IRQ_CALLBACK_MEMBER(cat_state::cat_int_ack) +{ + m_maincpu->set_input_line(M68K_IRQ_1,CLEAR_LINE); + return M68K_INT_ACK_AUTOVECTOR; +} + +MACHINE_START_MEMBER(cat_state,cat) +{ + m_duart_ktobf_ff = 0; // reset doesn't touch this + m_duart_prn_ack_prev_state = 1; // technically uninitialized + m_duart_prn_ack_ff = 0; // reset doesn't touch this + m_6ms_counter = 0; + m_wdt_counter = 0; + m_video_enable = 1; + m_video_invert = 0; + m_6ms_timer = timer_alloc(TIMER_COUNTER_6MS); + machine().device("nvram")->set_base(m_svram, 0x4000); +} + +MACHINE_RESET_MEMBER(cat_state,cat) +{ + m_6ms_counter = 0; + m_wdt_counter = 0; + m_floppy_control = 0; + m_6ms_timer->adjust(attotime::zero, 0, attotime::from_hz((XTAL_19_968MHz/2)/65536)); +} + +VIDEO_START_MEMBER(cat_state,cat) +{ +} + +UINT32 cat_state::screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 code; + int y, x, b; + + int addr = 0; + if (m_video_enable == 1) + { + for (y = 0; y < 344; y++) + { + int horpos = 0; + for (x = 0; x < 42; x++) + { + code = m_p_cat_videoram[addr++]; + for (b = 15; b >= 0; b--) + { + bitmap.pix16(y, horpos++) = ((code >> b) & 0x01) ^ m_video_invert; + } + } + } + } else { + const rectangle black_area(0, 672 - 1, 0, 344 - 1); + bitmap.fill(0, black_area); + } + return 0; +} + +/* The duart is the only thing actually connected to the cpu IRQ pin + * The KTOBF output of the gate array 2 (itself the terminal count output + * of a 16-bit counter clocked at ~10mhz, hence 6.5536ms period) goes to a + * d-latch and inputs on ip2 of the duart, causing the duart to fire an irq; + * this is used by the cat to read the keyboard. + * The duart also will, if configured to do so, fire an int when the state + * changes of the centronics /ACK pin; this is used while printing. + */ +WRITE_LINE_MEMBER(cat_state::cat_duart_irq_handler) +{ + int irqvector = m_duart->get_irq_vector(); + +#ifdef DEBUG_DUART_IRQ_HANDLER + fprintf(stderr, "Duart IRQ handler called: state: %02X, vector: %06X\n", state, irqvector); +#endif + m_maincpu->set_input_line_and_vector(M68K_IRQ_1, state, irqvector); +} + +WRITE_LINE_MEMBER(cat_state::cat_duart_txa) // semit sends stuff here; connects to the serial port on the back +{ +#ifdef DEBUG_DUART_TXA + fprintf(stderr, "Duart TXA: data %02X\n", state); +#endif +} + +WRITE_LINE_MEMBER(cat_state::cat_duart_txb) // memit sends stuff here; connects to the modem chip +{ +#ifdef DEBUG_DUART_TXB + fprintf(stderr, "Duart TXB: data %02X\n", state); +#endif +} + +/* mc68681 DUART Input pins: + * IP0: CTS [using the DUART builtin hardware-CTS feature?] + * IP1: Centronics /ACK (pin 10) positive edge detect (IP1 changes state 0->1 or 1->0 on the rising edge of /ACK using a 74ls74a d-flipflop) + * IP2: KTOBF (IP2 changes state 0->1 or 1->0 on the rising edge of KTOBF using a 74ls74a d-flipflop; KTOBF is a 6.5536ms-period squarewave generated by one of the gate arrays, I need to check with a scope to see whether it is a single spike/pulse every 6.5536ms or if from the gate array it inverts every 6.5536ms, documentation isn't 100% clear but I suspect the former) [uses the Delta IP2 state change detection feature to generate an interrupt; I'm not sure if IP2 is used as a counter clock source but given the beep frequency of the real unit I very much doubt it, 6.5536ms is too slow] + * IP3: RG ("ring" input) + * IP4: Centronics BUSY (pin 11), inverted + * IP5: DSR + */ + +/* mc68681 DUART Output pins: + * OP0: RTS [using the DUART builtin hardware-RTS feature?] + * OP1: DTR + * OP2: /TDCS (select/enable the S2579 DTMF tone generator chip) + * OP3: speaker out [using the 'channel b 1X tx or rx clock output' or more likely the 'timer output' feature to generate a squarewave] + * OP4: TD03 (data bus for the S2579 DTMF tone generator chip) + * OP5: TD02 " + * OP6: TD01 " + * OP7: TD00 " + */ +WRITE8_MEMBER(cat_state::cat_duart_output) +{ +#ifdef DEBUG_DUART_OUTPUT_LINES + fprintf(stderr,"Duart output io lines changed to: %02X\n", data); +#endif + m_speaker->level_w((data >> 3) & 1); +} + +WRITE_LINE_MEMBER(cat_state::prn_ack_ff) // switch the flipflop state on the rising edge of /ACK +{ + if ((m_duart_prn_ack_prev_state == 0) && (state == 1)) + { + m_duart_prn_ack_ff ^= 1; + } + m_duart->ip1_w(m_duart_prn_ack_ff); + m_duart_prn_ack_prev_state = state; +#ifdef DEBUG_PRN_FF + fprintf(stderr, "Printer ACK: state %02X, flipflop is now %02x\n", state, m_duart_prn_ack_ff); +#endif +} + +static MACHINE_CONFIG_START( cat, cat_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M68000, XTAL_19_968MHz/4) + MCFG_CPU_PROGRAM_MAP(cat_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(cat_state,cat_int_ack) + + MCFG_MACHINE_START_OVERRIDE(cat_state,cat) + MCFG_MACHINE_RESET_OVERRIDE(cat_state,cat) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(672, 344) + MCFG_SCREEN_VISIBLE_AREA(0, 672-1, 0, 344-1) + MCFG_SCREEN_UPDATE_DRIVER(cat_state, screen_update_cat) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_VIDEO_START_OVERRIDE(cat_state,cat) + + MCFG_MC68681_ADD( "duartn68681", (XTAL_19_968MHz*2)/11 ) // duart is normally clocked by 3.6864mhz xtal, but cat seemingly uses a divider from the main xtal instead which probably yields 3.63054545Mhz. There is a trace to cut and a mounting area to allow using an actual 3.6864mhz xtal if you so desire + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(cat_state, cat_duart_irq_handler)) + MCFG_MC68681_A_TX_CALLBACK(WRITELINE(cat_state, cat_duart_txa)) + MCFG_MC68681_B_TX_CALLBACK(WRITELINE(cat_state, cat_duart_txb)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(cat_state, cat_duart_output)) + + MCFG_CENTRONICS_ADD("ctx", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(cat_state, prn_ack_ff)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("duartn68681", mc68681_device, ip4_w)) MCFG_DEVCB_XOR(1) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("ctx_data_out", "ctx") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + + +/* Swyft Memory map, based on watching the infoapp roms do their thing: +68k address map: +(a23,a22,a21,a20 lines don't exist on the 68008 so are considered unconnected) +a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 +x x x x 0 0 ? ? 0 * * * * * * * * * * * * * * * R ROM-LO (/LOCE is 0, /HICE is 1) +x x x x 0 0 ? ? 1 * * * * * * * * * * * * * * * R ROM-HI (/LOCE is 1, /HICE is 0) +x x x x 0 1 * * * * * * * * * * * * * * * * * a RW RAM +x x x x 1 1 ?0? ?1? ? ? ? ? ? ? ? ? ? ? ? ? * * * * R ? status of something? floppy? +x x x x 1 1 ?1? ?0? ? 0 0 1 x x x x x x x x x x x * RW 6850 acia @U33, gets 0x55 steadystate and 0x57 written to it to reset it +x x x x 1 1 ?1? ?0? ? 0 1 0 x x * * * * x x x x x x RW Parallel VIA 0 @ U34 +x x x x 1 1 ?1? ?0? ? 1 0 0 x x * * * * x x x x x x RW Keyboard VIA 1 @ U35 + ^ ^ ^ ^ ^ + +*/ + +/* Swyft rom and ram notes: +rom: +**Vectors: +0x0000-0x0003: SP boot vector +0x0004-0x0007: PC boot vector +**unknown: +0x0009-0x00BF: ? table +0x00C0-0x01DF: ? table +0x01E0-0x02DF: ? table (may be part of next table) +0x02E0-0x03DF: ? table +0x03E0-0x0B3F: int16-packed jump table (expanded to int32s at ram at 0x46000-0x46EC0 on boot) +0x0B40-0x0E83: ? function index tables? +0x0E84-0x1544: binary code (purpose?) +0x1545-0x24CF: ? +**Fonts: +0x24D0-0x254F: ? (likely font 1 width lookup table) +0x2550-0x2BCF: Font 1 data +0x2BD0-0x2C4F: ? (likely font 2 width lookup table) +0x2C50-0x32CF: Font 2 data +**unknown?: +0x32D0-0x360F: String data (and control codes?) +0x3610-0x364F: ? fill (0x03 0xe8) +0x3650-0x369F: ? fill (0x03 0x20) +0x36A0-0x384d: ? forth code? +0x384e-0x385d: Lookup table for phone keypad +0x385e-...: ? +...-0xC951: ? +0xC952: boot vector +0xC952-0xCAAE: binary code (purpose?) + 0xCD26-0xCD3B: ?init forth bytecode? +0xCD3C-0xCEBA: 0xFF fill (unused?) +0xCEEB-0xFFFE: Forth dictionaries for compiling, with then <3 bytes> afterward? (or before it? most likely afterward) + +ram: (system dram ranges from 0x40000-0x7FFFF) +0x40000-0x425CF - the screen display ram +(?0x425D0-0x44BA0 - ?unknown (maybe screen ram page 2?)) +0x44DC6 - SP vector +0x46000-0x46EC0 - jump tables to instructions for ? (each forth word?) + + +on boot: +copy/expand packed rom short words 0x3E0-0xB3F to long words at 0x46000-0x46EC0 +copy 0x24f longwords of zero beyond that up to 0x47800 +CD26->A5 +44DC6->A7 +44F2A->A6 +EA2->A4 +E94->A3 +EAE->A2 +41800->D7 +46e3c->D4 +CD22->D5 +write 0xFFFF to d0004.l +jump to A4(EA2) + +read first stream byte (which is 0x03) from address pointed to by A5 (which is CD26), inc A5, OR the opcode (0x03) to D7 + (Note: if the forth opcodes are in order in the dictionary, then 0x03 is "!char" which is used to read a char from an arbitrary address) +copy D7 to A0 +Add A0 low word to itself +Add A0 low word to itself again +move the long word from address pointed to by A0 (i.e. the specific opcode's area at the 46xxx part of ram) to A1 +Jump to A1(11A4) + +11A4: move 41b00 to D0 (select an opcode "page" 1bxx) +jump to 118E + +118E: read next stream byte (in this case, 0x8E) from address pointed to by A5 (which is CD27), inc A5, OR the opcode (0x8e) to D7 +add to 41b00 in d0, for 41b8E +Add A0 low word to itself +Add A0 low word to itself again +move the long word from address pointed to by A0 (i.e. the specific opcode's area at the 46xxx part of ram) to A1 +Jump to A1(CD06) + +CD06: jump to A3 (E94) + +E94: subtract D5 from A5 (cd28 - cd22 = 0x0006) +write 6 to address @A5(44f28) and decrement A5 +write D4(46e3c) to address @a6(44f26) and decrement a5 +lea ($2, A1), A5 - i.e. increment A1 by 2, and write that to A5, so write CD06+2=CD08 to A5 +A1->D5 +A0->D4 +read next stream byte (in this case, 0x03) from address pointed to by A5 (which is CD08), inc A5, OR the opcode (0x03) to D7 + +*/ + +static ADDRESS_MAP_START(swyft_mem, AS_PROGRAM, 8, cat_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_MIRROR(0xF00000) // 64 KB ROM + AM_RANGE(0x040000, 0x07ffff) AM_RAM AM_MIRROR(0xF00000) AM_SHARE("p_swyft_vram") // 256 KB RAM + AM_RANGE(0x0d0000, 0x0d000f) AM_READ(swyft_d0000) AM_MIRROR(0xF00000) // status of something? reads from d0000, d0004, d0008, d000a, d000e + AM_RANGE(0x0e1000, 0x0e1000) AM_DEVWRITE("acia6850", acia6850_device, control_w) AM_MIRROR(0xF00000) // 6850 ACIA lives here + AM_RANGE(0x0e2000, 0x0e2fff) AM_READWRITE(swyft_via0_r, swyft_via0_w) AM_MIRROR(0xF00000)// io area with selector on a9 a8 a7 a6? + AM_RANGE(0x0e4000, 0x0e4fff) AM_READWRITE(swyft_via1_r, swyft_via1_w) AM_MIRROR(0xF00000) +ADDRESS_MAP_END + +MACHINE_START_MEMBER(cat_state,swyft) +{ + m_via0->write_ca1(1); + m_via0->write_ca2(1); + m_via0->write_cb1(1); + m_via0->write_cb2(1); + + m_via1->write_ca1(1); + m_via1->write_ca2(1); + m_via1->write_cb1(1); + m_via1->write_cb2(1); +} + +MACHINE_RESET_MEMBER(cat_state,swyft) +{ +} + +VIDEO_START_MEMBER(cat_state,swyft) +{ +} + +UINT32 cat_state::screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 code; + int y, x, b; + + int addr = 0; + for (y = 0; y < 242; y++) + { + int horpos = 0; + for (x = 0; x < 40; x++) + { + code = m_p_swyft_videoram[addr++]; + for (b = 7; b >= 0; b--) + { + bitmap.pix16(y, horpos++) = (code >> b) & 0x01; + } + } + } + return 0; +} + +READ8_MEMBER( cat_state::swyft_d0000 ) +{ + // wtf is this supposed to be? + UINT8 byte = 0xFF; // ? + logerror("mystery device: read from 0x%5X, returning %02X\n", offset+0xD0000, byte); + return byte; +} + + +// if bit is 1 enable: (obviously don't set more than one bit or you get bus contention!) +// acia +// via0 +// via1 +// x x x x 1 1 ?1? ?0? ? ^ ^ ^ ? ? * * * * ?*? ? ? ? ? ? +// ^ ^ ^ ^ <- these four bits address the VIA registers? is this correct? +static const char *const swyft_via_regnames[] = { "0: ORB/IRB", "1: ORA/IRA", "2: DDRB", "3: DDRA", "4: T1C-L", "5: T1C-H", "6: T1L-L", "7: T1L-H", "8: T2C-L" "9: T2C-H", "A: SR", "B: ACR", "C: PCR", "D: IFR", "E: IER", "F: ORA/IRA*" }; + +READ8_MEMBER( cat_state::swyft_via0_r ) +{ + if (offset&0x000C3F) fprintf(stderr,"VIA0: read from invalid offset in 68k space: %06X!\n", offset); + UINT8 data = m_via0->read(space, (offset>>6)&0xF); +#ifdef DEBUG_SWYFT_VIA0 + logerror("VIA0 register %s read by cpu: returning %02x\n", swyft_via_regnames[(offset>>5)&0xF], data); +#endif + return data; +} + +WRITE8_MEMBER( cat_state::swyft_via0_w ) +{ +#ifdef DEBUG_SWYFT_VIA0 + logerror("VIA0 register %s written by cpu with data %02x\n", swyft_via_regnames[(offset>>5)&0xF], data); +#endif + if (offset&0x000C3F) fprintf(stderr,"VIA0: write to invalid offset in 68k space: %06X, data: %02X!\n", offset, data); + m_via1->write(space, (offset>>6)&0xF, data); +} + +READ8_MEMBER( cat_state::swyft_via1_r ) +{ + if (offset&0x000C3F) fprintf(stderr," VIA1: read from invalid offset in 68k space: %06X!\n", offset); + UINT8 data = m_via1->read(space, (offset>>6)&0xF); +#ifdef DEBUG_SWYFT_VIA1 + logerror(" VIA1 register %s read by cpu: returning %02x\n", swyft_via_regnames[(offset>>5)&0xF], data); +#endif + return data; +} + +WRITE8_MEMBER( cat_state::swyft_via1_w ) +{ +#ifdef DEBUG_SWYFT_VIA1 + logerror(" VIA1 register %s written by cpu with data %02x\n", swyft_via_regnames[(offset>>5)&0xF], data); +#endif + if (offset&0x000C3F) fprintf(stderr," VIA1: write to invalid offset in 68k space: %06X, data: %02X!\n", offset, data); + m_via0->write(space, (offset>>6)&0xF, data); +} + +// first via +READ8_MEMBER( cat_state::via0_pa_r ) +{ + logerror("VIA0: Port A read!\n"); + return 0xFF; +} + +WRITE8_MEMBER( cat_state::via0_pa_w ) +{ + logerror("VIA0: Port A written with data of 0x%02x!\n", data); +} + +WRITE_LINE_MEMBER ( cat_state::via0_ca2_w ) +{ + logerror("VIA0: CA2 written with %d!\n", state); +} + +READ8_MEMBER( cat_state::via0_pb_r ) +{ + logerror("VIA0: Port B read!\n"); + return 0xFF; +} + +WRITE8_MEMBER( cat_state::via0_pb_w ) +{ + logerror("VIA0: Port B written with data of 0x%02x!\n", data); +} + +WRITE_LINE_MEMBER ( cat_state::via0_cb1_w ) +{ + logerror("VIA0: CB1 written with %d!\n", state); +} + +WRITE_LINE_MEMBER ( cat_state::via0_cb2_w ) +{ + logerror("VIA0: CB2 written with %d!\n", state); +} + +WRITE_LINE_MEMBER ( cat_state::via0_int_w ) +{ + logerror("VIA0: INT output set to %d!\n", state); +} + +// second via +READ8_MEMBER( cat_state::via1_pa_r ) +{ + logerror(" VIA1: Port A read!\n"); + return 0xFF; +} + +WRITE8_MEMBER( cat_state::via1_pa_w ) +{ + logerror(" VIA1: Port A written with data of 0x%02x!\n", data); +} + +WRITE_LINE_MEMBER ( cat_state::via1_ca2_w ) +{ + logerror(" VIA1: CA2 written with %d!\n", state); +} + +READ8_MEMBER( cat_state::via1_pb_r ) +{ + logerror(" VIA1: Port B read!\n"); + return 0xFF; +} + +WRITE8_MEMBER( cat_state::via1_pb_w ) +{ + logerror(" VIA1: Port B written with data of 0x%02x!\n", data); +} + +WRITE_LINE_MEMBER ( cat_state::via1_cb1_w ) +{ + logerror(" VIA1: CB1 written with %d!\n", state); +} + +WRITE_LINE_MEMBER ( cat_state::via1_cb2_w ) +{ + logerror(" VIA1: CB2 written with %d!\n", state); +} + +WRITE_LINE_MEMBER ( cat_state::via1_int_w ) +{ + logerror(" VIA1: INT output set to %d!\n", state); +} + +WRITE_LINE_MEMBER( cat_state::write_acia_clock ) +{ + m_acia6850->write_txc(state); + m_acia6850->write_rxc(state); +} + +static MACHINE_CONFIG_START( swyft, cat_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M68008, XTAL_15_8976MHz/2) //MC68008P8, Y1=15.8976Mhz, clock GUESSED at Y1 / 2 + MCFG_CPU_PROGRAM_MAP(swyft_mem) + + MCFG_MACHINE_START_OVERRIDE(cat_state,swyft) + MCFG_MACHINE_RESET_OVERRIDE(cat_state,swyft) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(320, 242) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 242-1) + MCFG_SCREEN_UPDATE_DRIVER(cat_state, screen_update_swyft) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_VIDEO_START_OVERRIDE(cat_state,swyft) + + MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) + // acia rx and tx clocks come from one of the VIA pins and are tied together, fix this below? acia e clock comes from 68008 + MCFG_DEVICE_ADD("acia_clock", CLOCK, (XTAL_15_8976MHz/2)/5) // out e clock from 68008, ~ 10in clocks per out clock + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(cat_state, write_acia_clock)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, (XTAL_15_8976MHz/2)/5) // out e clock from 68008 + MCFG_VIA6522_READPA_HANDLER(READ8(cat_state, via0_pa_r)) + MCFG_VIA6522_READPB_HANDLER(READ8(cat_state, via0_pb_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(cat_state, via0_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(cat_state, via0_pb_w)) + MCFG_VIA6522_CB1_HANDLER(WRITELINE(cat_state, via0_cb1_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(cat_state, via0_ca2_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(cat_state, via0_cb2_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(cat_state, via0_int_w)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, (XTAL_15_8976MHz/2)/5) // out e clock from 68008 + MCFG_VIA6522_READPA_HANDLER(READ8(cat_state, via1_pa_r)) + MCFG_VIA6522_READPB_HANDLER(READ8(cat_state, via1_pb_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(cat_state, via1_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(cat_state, via1_pb_w)) + MCFG_VIA6522_CB1_HANDLER(WRITELINE(cat_state, via1_cb1_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(cat_state, via1_ca2_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(cat_state, via1_cb2_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(cat_state, via1_int_w)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( swyft ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v331", "IAI Swyft Version 331 Firmware") + ROMX_LOAD( "331-lo.u30", 0x0000, 0x8000, CRC(d6cc2e2f) SHA1(39ff26c18b1cf589fc48793263f280ef3780cc61), ROM_BIOS(1)) + ROMX_LOAD( "331-hi.u31", 0x8000, 0x8000, CRC(4677630a) SHA1(8845d702fa8b8e1a08352f4c59d3076cc2e1307e), ROM_BIOS(1)) + /* this version of the swyft code identifies itself at 0x3FCB as version 330 */ + ROM_SYSTEM_BIOS( 1, "v330", "IAI Swyft Version 330 Firmware") + ROMX_LOAD( "infoapp.lo.u30", 0x0000, 0x8000, CRC(52c1bd66) SHA1(b3266d72970f9d64d94d405965b694f5dcb23bca), ROM_BIOS(2)) + ROMX_LOAD( "infoapp.hi.u31", 0x8000, 0x8000, CRC(83505015) SHA1(693c914819dd171114a8c408f399b56b470f6be0), ROM_BIOS(2)) + ROM_REGION( 0x4000, "pals", ROMREGION_ERASEFF ) + /* Swyft PALs: + * The Swyft has four PALs, whose rough function can be derived from their names: + * TIMING - state machine for DRAM refresh/access; handles ras/cas and choosing whether the video out shifter or the 68k is accessing ram. also divides clock + * DECODE - address decoder for the 68008 + * VIDEO - state machine for the video shifter (and vblank/hblank?) + * DISK 3.5 - state machine for the floppy drive interface + */ + /* U9: Timing AMPAL16R4 + * + * pins: + * 111111111000000000 + * 987654321987654321 + * ??QQQQ??EIIIIIIIIC + * |||||||||||||||||\-< /CK input - 15.8976mhz crystal and transistor oscillator + * ||||||||||||||||\--< ? + * |||||||||||||||\---< ? + * ||||||||||||||\----< ? + * |||||||||||||\-----< ? + * ||||||||||||\------< ? + * |||||||||||\-------< ? + * ||||||||||\--------< ? + * |||||||||\---------< ? + * ||||||||\----------< /OE input - shorted to GND + * |||||||\-----------? ? + * ||||||\------------? ? + * |||||\------------Q> /ROM_OE (to both eproms through jumper b1 and optionally j9 connector) + * ||||\-------------Q? ? + * |||\--------------Q? ? + * ||\---------------Q> output to decode pal pin 2 + * |\----------------->? output? to ram multiplexer 'A' pins + * \------------------< ? + */ + ROM_LOAD( "timing_b.ampal16r4a.u9.jed", 0x0000, 0xb08, CRC(643e6e83) SHA1(7db167883f9d6cf385ce496d08976dc16fc3e2c3)) + /* U20: Decode AMPAL16L8 + * + * pins: + * 111111111000000000 + * 987654321987654321 + * O??????OIIIIIIIIII + * |||||||||||||||||\-< TIMING PAL pin 5 + * ||||||||||||||||\--< TIMING PAL pin 17 + * |||||||||||||||\---< 68008 R/W (pin 30) + * ||||||||||||||\----< 68008 /DS (pin 29) + * |||||||||||||\-----< 68008 E (pin 38) + * ||||||||||||\------< 68008 A19 + * |||||||||||\-------< 68008 A18 + * ||||||||||\--------< 68008 A17 + * |||||||||\---------< 68008 A16 + * ||||||||\----------< ? + * |||||||\-----------> ? + * ||||||\------------? 68008 /VPA (pin 39) + * |||||\-------------> /ROM_OE (to both eproms through jumper b1 and optionally j9 connector) + * ||||\--------------? ? + * |||\---------------? ? + * ||\----------------? ? + * |\-----------------? goes to j9 connector pin 5 + * \------------------< ? + */ + ROM_LOAD( "decode_e.ampal16l8.u20.jed", 0x1000, 0xb08, CRC(0b1dbd76) SHA1(08c144ad7a7bbdd53eefd271b2f6813f8b3b1594)) + ROM_LOAD( "video_2b.ampal16r4.u25.jed", 0x2000, 0xb08, CRC(caf91148) SHA1(3f8ddcb512a1c05395c74ad9a6ba7b87027ce4ec)) + ROM_LOAD( "disk_3.5c.ampal16r4.u28.jed", 0x3000, 0xb08, CRC(fd994d02) SHA1(f910ab16587dd248d63017da1e5b37855e4c1a0c)) +ROM_END + +ROM_START( cat ) + ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF ) + // SYS ROM + /* This 2.40 code came from two development cat machines owned or formerly + * owned by former IAI employees Sandy Bumgarner and Dave Boulton. + * Dave Boulton's machine is interesting in that it has a prototype cat + * motherboard in it, which it has less space for dram than a 'released' + * cat does: it uses 16k*4 dram chips instead of 64k*4 as in the final + * cat, and hence can only support 128k of ram with all 4 rows of drams + * populated, as opposed to 256k-standard (2 rows) and 512k-max with all + * 4 rows populated on a "released" cat. + */ + ROM_SYSTEM_BIOS( 0, "r240", "Canon Cat V2.40 US Firmware") + ROMX_LOAD( "boultl0.ic2", 0x00001, 0x10000, CRC(77b66208) SHA1(9d718c0a521fefe4f86ef328805b7921bade9d89), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "boulth0.ic4", 0x00000, 0x10000, CRC(f1e1361a) SHA1(0a85385527e2cc55790de9f9919eb44ac32d7f62), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "boultl1.ic3", 0x20001, 0x10000, CRC(c61dafb0) SHA1(93216c26c2d5fc71412acc548c96046a996ea668), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "boulth1.ic5", 0x20000, 0x10000, CRC(bed1f761) SHA1(d177e1d3a39b005dd94a6bda186221d597129af4), ROM_SKIP(1) | ROM_BIOS(1)) + /* This 2.40 code was compiled by Dwight Elvey based on the v2.40 source + * code disks recovered around 2004. It does NOT exactly match the above + * set exactly but has a few small differences. One of the printer drivers + * may have been replaced by Dwight with an HP PCL4 driver. + * It is as of yet unknown whether it is earlier or later code than the + * set above. + */ + ROM_SYSTEM_BIOS( 1, "r240r", "Canon Cat V2.40 US Firmware compiled from recovered source code") + ROMX_LOAD( "r240l0.ic2", 0x00001, 0x10000, CRC(1b89bdc4) SHA1(39c639587dc30f9d6636b46d0465f06272838432), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "r240h0.ic4", 0x00000, 0x10000, CRC(94f89b8c) SHA1(6c336bc30636a02c625d31f3057ec86bf4d155fc), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "r240l1.ic3", 0x20001, 0x10000, CRC(1a73be4f) SHA1(e2de2cb485f78963368fb8ceba8fb66ca56dba34), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "r240h1.ic5", 0x20000, 0x10000, CRC(898dd9f6) SHA1(93e791dd4ed7e4afa47a04df6fdde359e41c2075), ROM_SKIP(1) | ROM_BIOS(2)) + /* This v1.74 code comes from (probably) the 'main us release' of first-run + * Canon cats, and was dumped from machine serial number R12014979 + * Canon cat v1.74 roms are labeled as r74; they only added the major number + * to the rom label after v2.0? + */ + ROM_SYSTEM_BIOS( 2, "r174", "Canon Cat V1.74 US Firmware") + ROMX_LOAD( "r74__0l__c18c.blue.ic2", 0x00001, 0x10000, CRC(b19aa0c8) SHA1(85b3e549cfb91bd3dd32335e02eaaf9350e80900), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "r74__0h__75a6.yellow.ic4", 0x00000, 0x10000, CRC(75281f77) SHA1(ed8b5e37713892ee83413d23c839d09e2fd2c1a9), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "r74__1l__c8a3.green.ic3", 0x20001, 0x10000, CRC(93275558) SHA1(f690077a87076fd51ae385ac5a455804cbc43c8f), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "r74__1h__3c37.white.ic5", 0x20000, 0x10000, CRC(5d7c3962) SHA1(8335993583fdd30b894c01c1a7a6aca61cd81bb4), ROM_SKIP(1) | ROM_BIOS(3)) + // According to Sandy Bumgarner, there should be a 2.42 version which fixes some bugs in the calc command vs 2.40 + // According to the Cat Repair Manual page 4-20, there should be a version called B91U0x (maybe 1.91 or 0.91?) with sum16s of 9F1F, FF0A, 79BF and 03FF + + ROM_REGION( 0x80000, "svrom", ROMREGION_ERASE00 ) + // SPELLING VERIFICATION ROM (SVROM) + /* Romspace here is a little strange: there are 3 rom sockets on the board: + * svrom-0 maps to 200000-21ffff every ODD byte (d8-d0) + * svrom-1 maps to 200000-21ffff every EVEN byte (d15-d7) + * (since no rom is in the socket; it reads as open bus, sometimes 0x2E) + * svrom-2 maps to 240000-25ffff every ODD byte (d8-d0) + * (since no rom is in the socket; it reads as open bus, sometimes 0x80) + * there is no svrom-3 socket; 240000-25ffff EVEN always reads as 0x2E + * since ROM_FILL16BE(0x0, 0x80000, 0x2e80) doesn't exist, the + * even bytes and latter chunk of the svrom space need to be filled in + * DRIVER_INIT or some other means needs to be found to declare them as + * 'open bus' once the mame/mess core supports that. + * NOTE: there are at least 6 more SVROMS which existed (possibly in + * limited form), and are not dumped: + * UK (1 rom, NH7-0724) + * French/Quebec (2 roms, NH7-0813/0814) + * German (3 roms, NH7-1019/1020/1021) + * Each of these will also have its own code romset as well. + */ + // NH7-0684 (US, dumped): + ROMX_LOAD( "uv1__nh7-0684__hn62301apc11__7h1.ic6", 0x00000, 0x20000, CRC(229ca210) SHA1(564b57647a34acdd82159993a3990a412233da14), ROM_SKIP(1)) // this is a 28pin tc531000 mask rom, 128KB long; "US" SVROM + + /* There is an unpopulated PAL16L8 at IC9 whose original purpose (based + * on the schematics) was probably to cause a 68k bus error when + * memory in certain ranges when accessed (likely so 'forth gone insane' + * won't destroy the contents of ram and svram). + * Its connections are (where Ix = inp on pin x, Ox = out on pin x): + * I1 = A23, I2 = A22, I3 = A2, I4 = R/W, I5 = A5, I6 = FC2, I7 = gnd, + * I8 = A1, I9 = gnd, I11 = gnd, O16 = /BERR, + * I14 = REMAP (connects to emulator 'shadow rom' board or to gnd when unused) + * Based on the inputs and outputs of this pal, almost if not the entire + * open bus and mirrored areas of the cat address space could be made + * to cause bus errors. REMAP was probably used to 'open up' the A00000-A7ffff + * shadow rom/ram area and make it writeable without erroring. + */ +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT DEVICE INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, swyft,0, 0, swyft, swyft, driver_device, 0, "Information Applicance Inc", "Swyft", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1987, cat, swyft, 0, cat, cat, driver_device, 0, "Canon", "Cat", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/cbm2.c b/src/mame/drivers/cbm2.c new file mode 100644 index 00000000000..9ff23fc32da --- /dev/null +++ b/src/mame/drivers/cbm2.c @@ -0,0 +1,2767 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + TODO: + + - 8088 board + - CIA timers fail in burn-in test + - cbm620hu charom banking? + +*/ + +#include "includes/cbm2.h" +#include "bus/rs232/rs232.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define P3 BIT(offset, 19) +#define P2 BIT(offset, 18) +#define P1 BIT(offset, 17) +#define P0 BIT(offset, 16) +#define A15 BIT(offset, 15) +#define A14 BIT(offset, 14) +#define A13 BIT(offset, 13) +#define A12 BIT(offset, 12) +#define A11 BIT(offset, 11) +#define A10 BIT(offset, 10) +#define A0 BIT(offset, 0) +#define VA12 BIT(va, 12) + +static void cbmb_quick_sethiaddress(address_space &space, UINT16 hiaddress) +{ + space.write_byte(0xf0046, hiaddress & 0xff); + space.write_byte(0xf0047, hiaddress >> 8); +} + +QUICKLOAD_LOAD_MEMBER( cbm2_state, cbmb ) +{ + return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0x10000, cbmb_quick_sethiaddress); +} + +QUICKLOAD_LOAD_MEMBER( p500_state, p500 ) +{ + return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbmb_quick_sethiaddress); +} + +//************************************************************************** +// ADDRESS DECODING +//************************************************************************** + +//------------------------------------------------- +// read_pla - low profile PLA read +//------------------------------------------------- + +void cbm2_state::read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4) +{ + UINT32 input = P0 << 15 | P1 << 14 | P2 << 13 | P3 << 12 | m_busy2 << 11 | eras << 10 | ecas << 9 | refen << 8 | cas << 7 | ras << 6; + UINT32 data = m_pla1->read(input); + + *casseg1 = BIT(data, 0); + *rasseg1 = BIT(data, 1); + *rasseg2 = BIT(data, 2); + *casseg2 = BIT(data, 3); + *rasseg4 = BIT(data, 4); + *casseg4 = BIT(data, 5); + *casseg3 = BIT(data, 6); + *rasseg3 = BIT(data, 7); +} + + +//------------------------------------------------- +// read_pla - high profile PLA read +//------------------------------------------------- + +void cbm2hp_state::read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4) +{ + UINT32 input = ras << 13 | cas << 12 | refen << 11 | eras << 10 | ecas << 9 | m_busy2 << 8 | P3 << 3 | P2 << 2 | P1 << 1 | P0; + UINT32 data = m_pla1->read(input); + + *casseg1 = BIT(data, 0); + *casseg2 = BIT(data, 1); + *casseg3 = BIT(data, 2); + *casseg4 = BIT(data, 3); + *rasseg1 = BIT(data, 4); + *rasseg2 = BIT(data, 5); + *rasseg3 = BIT(data, 6); + *rasseg4 = BIT(data, 7); +} + + +//------------------------------------------------- +// bankswitch - +//------------------------------------------------- + +void cbm2_state::bankswitch(offs_t offset, int eras, int ecas, int refen, int cas, int ras, int *sysioen, int *dramen, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *buframcs, int *extbufcs, int *vidramcs, + int *diskromcs, int *csbank1, int *csbank2, int *csbank3, int *basiccs, int *knbcs, int *kernalcs, + int *crtccs, int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs) +{ + int rasseg1 = 1, rasseg2 = 1, rasseg3 = 1, rasseg4 = 1; + + this->read_pla(offset, ras, cas, refen, eras, ecas, casseg1, casseg2, casseg3, casseg4, &rasseg1, &rasseg2, &rasseg3, &rasseg4); + + int decoden = 0; + *sysioen = !(P0 && P1 && P2 && P3) && m_busen1; + *dramen = !((!(P0 && P1 && P2 && P3)) && m_busen1); + + if (!decoden && !*sysioen) + { + switch ((offset >> 13) & 0x07) + { + case 0: + switch ((offset >> 11) & 0x03) + { + case 0: *buframcs = 0; break; + case 1: *extbufcs = 0; break; + case 2: // fallthru + case 3: *diskromcs = 0; break; + } + break; + + case 1: *csbank1 = 0; break; + case 2: *csbank2 = 0; break; + case 3: *csbank3 = 0; break; + case 4: *basiccs = 0; break; + case 5: *knbcs = 0; break; + case 6: + switch ((offset >> 11) & 0x03) + { + case 2: *vidramcs = 0; break; + case 3: + switch ((offset >> 8) & 0x07) + { + case 0: *crtccs = 0; break; + case 1: *cs1 = 0; break; + case 2: *sidcs = 0; break; + case 3: *extprtcs = 0; break; + case 4: *ciacs = 0; break; + case 5: *aciacs = 0; break; + case 6: *tript1cs = 0; break; + case 7: *tript2cs = 0; break; + } + break; + } + break; + + case 7: *kernalcs = 0; break; + } + } +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( cbm2_state::read ) +{ + int eras = 1, ecas = 1, refen = 0, cas = 0, ras = 1, sysioen = 1, dramen = 1; + int casseg1 = 1, casseg2 = 1, casseg3 = 1, casseg4 = 1, buframcs = 1, extbufcs = 1, vidramcs = 1; + int diskromcs = 1, csbank1 = 1, csbank2 = 1, csbank3 = 1, basiccs = 1, knbcs = 1, kernalcs = 1; + int crtccs = 1, cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; + + bankswitch(offset, eras, ecas, refen, cas, ras, &sysioen, &dramen, + &casseg1, &casseg2, &casseg3, &casseg4, &buframcs, &extbufcs, &vidramcs, + &diskromcs, &csbank1, &csbank2, &csbank3, &basiccs, &knbcs, &kernalcs, + &crtccs, &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs); + + UINT8 data = 0xff; + + if (!dramen) + { + if (!casseg1) + { + data = m_ram->pointer()[offset & 0xffff]; + } + if (!casseg2) + { + data = m_ram->pointer()[0x10000 | (offset & 0xffff)]; + } + if (!casseg3 && (m_ram->size() > 0x20000)) + { + data = m_ram->pointer()[0x20000 | (offset & 0xffff)]; + } + if (!casseg4 && (m_ram->size() > 0x30000)) + { + data = m_ram->pointer()[0x30000 | (offset & 0xffff)]; + } + } + + if (!sysioen) + { + if (!buframcs) + { + data = m_buffer_ram[offset & 0x7ff]; + } + if (!extbufcs && m_extbuf_ram) + { + data = m_extbuf_ram[offset & 0x7ff]; + } + if (!vidramcs) + { + data = m_video_ram[offset & 0x7ff]; + } + if (!basiccs || !knbcs) + { + data = m_basic->base()[offset & 0x3fff]; + } + if (!kernalcs) + { + data = m_kernal->base()[offset & 0x1fff]; + } + if (!crtccs) + { + if (A0) + { + data = m_crtc->register_r(space, 0); + } + else + { + data = m_crtc->status_r(space, 0); + } + } + if (!sidcs) + { + data = m_sid->read(space, offset & 0x1f); + } + if (!extprtcs && m_ext_cia) + { + data = m_ext_cia->read(space, offset & 0x0f); + } + if (!ciacs) + { + data = m_cia->read(space, offset & 0x0f); + } + if (!aciacs) + { + data = m_acia->read(space, offset & 0x03); + } + if (!tript1cs) + { + data = m_tpi1->read(space, offset & 0x07); + } + if (!tript2cs) + { + data = m_tpi2->read(space, offset & 0x07); + } + + data = m_exp->read(space, offset & 0x1fff, data, csbank1, csbank2, csbank3); + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( cbm2_state::write ) +{ + int eras = 1, ecas = 1, refen = 0, cas = 0, ras = 1, sysioen = 1, dramen = 1; + int casseg1 = 1, casseg2 = 1, casseg3 = 1, casseg4 = 1, buframcs = 1, extbufcs = 1, vidramcs = 1; + int diskromcs = 1, csbank1 = 1, csbank2 = 1, csbank3 = 1, basiccs = 1, knbcs = 1, kernalcs = 1; + int crtccs = 1, cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; + + bankswitch(offset, eras, ecas, refen, cas, ras, &sysioen, &dramen, + &casseg1, &casseg2, &casseg3, &casseg4, &buframcs, &extbufcs, &vidramcs, + &diskromcs, &csbank1, &csbank2, &csbank3, &basiccs, &knbcs, &kernalcs, + &crtccs, &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs); + + if (!dramen) + { + if (!casseg1) + { + m_ram->pointer()[offset & 0xffff] = data; + } + if (!casseg2) + { + m_ram->pointer()[0x10000 | (offset & 0xffff)] = data; + } + if (!casseg3 && (m_ram->size() > 0x20000)) + { + m_ram->pointer()[0x20000 | (offset & 0xffff)] = data; + } + if (!casseg4 && (m_ram->size() > 0x30000)) + { + m_ram->pointer()[0x30000 | (offset & 0xffff)] = data; + } + } + + if (!sysioen) + { + if (!buframcs) + { + m_buffer_ram[offset & 0x7ff] = data; + } + if (!extbufcs && m_extbuf_ram) + { + m_extbuf_ram[offset & 0x7ff] = data; + } + if (!vidramcs) + { + m_video_ram[offset & 0x7ff] = data; + } + if (!crtccs) + { + if (A0) + { + m_crtc->register_w(space, 0, data); + } + else + { + m_crtc->address_w(space, 0, data); + } + } + if (!sidcs) + { + m_sid->write(space, offset & 0x1f, data); + } + if (!extprtcs && m_ext_cia) + { + m_ext_cia->write(space, offset & 0x0f, data); + } + if (!ciacs) + { + m_cia->write(space, offset & 0x0f, data); + } + if (!aciacs) + { + m_acia->write(space, offset & 0x03, data); + } + if (!tript1cs) + { + m_tpi1->write(space, offset & 0x07, data); + } + if (!tript2cs) + { + m_tpi2->write(space, offset & 0x07, data); + } + + m_exp->write(space, offset & 0x1fff, data, csbank1, csbank2, csbank3); + } +} + + +//------------------------------------------------- +// ext_read - +//------------------------------------------------- + +READ8_MEMBER( cbm2_state::ext_read ) +{ +#ifdef USE_PLA_DECODE + int ras = 1, cas = 1, refen = 0, eras = 1, ecas = 0; + int casseg1 = 1, casseg2 = 1, casseg3 = 1, casseg4 = 1, rasseg1 = 1, rasseg2 = 1, rasseg3 = 1, rasseg4 = 1; + + this->read_pla(offset, ras, cas, refen, eras, ecas, &casseg1, &casseg2, &casseg3, &casseg4, &rasseg1, &rasseg2, &rasseg3, &rasseg4); + UINT8 data = 0xff; + + if (!casseg1) + { + data = m_ram->pointer()[offset & 0xffff]; + } + if (!casseg2) + { + data = m_ram->pointer()[0x10000 | (offset & 0xffff)]; + } + if (!casseg3 && (m_ram->size() > 0x20000)) + { + data = m_ram->pointer()[0x20000 | (offset & 0xffff)]; + } + if (!casseg4 && (m_ram->size() > 0x30000)) + { + data = m_ram->pointer()[0x30000 | (offset & 0xffff)]; + } + + return data; +#endif + + UINT8 data = 0; + if (offset < 0x40000) data = m_ram->pointer()[offset]; + return data; +} + + +//------------------------------------------------- +// ext_write - +//------------------------------------------------- + +WRITE8_MEMBER( cbm2_state::ext_write ) +{ +#ifdef USE_PLA_DECODE + int ras = 1, cas = 1, refen = 0, eras = 1, ecas = 0; + int casseg1 = 1, casseg2 = 1, casseg3 = 1, casseg4 = 1, rasseg1 = 1, rasseg2 = 1, rasseg3 = 1, rasseg4 = 1; + + this->read_pla(offset, ras, cas, refen, eras, ecas, &casseg1, &casseg2, &casseg3, &casseg4, &rasseg1, &rasseg2, &rasseg3, &rasseg4); + + if (!casseg1) + { + m_ram->pointer()[offset & 0xffff] = data; + } + if (!casseg2) + { + m_ram->pointer()[0x10000 | (offset & 0xffff)] = data; + } + if (!casseg3 && (m_ram->size() > 0x20000)) + { + m_ram->pointer()[0x20000 | (offset & 0xffff)] = data; + } + if (!casseg4 && (m_ram->size() > 0x30000)) + { + m_ram->pointer()[0x30000 | (offset & 0xffff)] = data; + } +#endif + + if (offset < 0x40000) m_ram->pointer()[offset] = data; +} + + +//------------------------------------------------- +// read_pla1 - P500 PLA #1 read +//------------------------------------------------- + +void p500_state::read_pla1(offs_t offset, int busy2, int clrnibcsb, int procvid, int refen, int ba, int aec, int srw, + int *datxen, int *dramxen, int *clrniben, int *segf, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr) +{ + int sphi2 = m_vic->phi0_r(); + int bras = 1; + + UINT32 input = P0 << 15 | P2 << 14 | bras << 13 | P1 << 12 | P3 << 11 | busy2 << 10 | m_statvid << 9 | sphi2 << 8 | + clrnibcsb << 7 | m_dramon << 6 | procvid << 5 | refen << 4 | m_vicdotsel << 3 | ba << 2 | aec << 1 | srw; + + UINT32 data = m_pla1->read(input); + + *datxen = BIT(data, 0); + *dramxen = BIT(data, 1); + *clrniben = BIT(data, 2); + *segf = BIT(data, 3); + *_64kcasen = BIT(data, 4); + *casenb = BIT(data, 5); + *viddaten = BIT(data, 6); + *viddat_tr = BIT(data, 7); +} + + +//------------------------------------------------- +// read_pla2 - P500 PLA #2 read +//------------------------------------------------- + +void p500_state::read_pla2(offs_t offset, offs_t va, int ba, int vicen, int ae, int segf, int bank0, + int *clrnibcsb, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *procvid, int *viccs, int *vidmatcs) +{ + int sphi2 = m_vic->phi0_r(); + int bcas = 1; + + UINT32 input = VA12 << 15 | ba << 14 | A13 << 13 | A15 << 12 | A14 << 11 | A11 << 10 | A10 << 9 | A12 << 8 | + sphi2 << 7 | vicen << 6 | m_statvid << 5 | m_vicdotsel << 4 | ae << 3 | segf << 2 | bcas << 1 | bank0; + + UINT32 data = m_pla2->read(input); + + *clrnibcsb = BIT(data, 0); + *extbufcs = BIT(data, 1); + *discromcs = BIT(data, 2); + *buframcs = BIT(data, 3); + *charomcs = BIT(data, 4); + *procvid = BIT(data, 5); + *viccs = BIT(data, 6); + *vidmatcs = BIT(data, 7); +} + + +//------------------------------------------------- +// bankswitch - +//------------------------------------------------- + +void p500_state::bankswitch(offs_t offset, offs_t va, int srw, int ba, int ae, int busy2, int refen, + int *datxen, int *dramxen, int *clrniben, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr, + int *clrnibcs, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *viccs, int *vidmatcs, + int *csbank1, int *csbank2, int *csbank3, int *basiclocs, int *basichics, int *kernalcs, + int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs, int *aec, int *vsysaden) +{ + int sphi2 = m_vic->phi0_r(); + int sphi1 = !sphi2; + //int ba = !m_vic->ba_r(); + //int ae = m_vic->aec_r(); + int bcas = 0; + + *aec = !((m_statvid || ae) && sphi2); + *vsysaden = sphi1 || ba; + + int clrnibcsb = 1, procvid = 1, segf = 1; + + read_pla1(offset, busy2, clrnibcsb, procvid, refen, ba, *aec, srw, + datxen, dramxen, clrniben, &segf, _64kcasen, casenb, viddaten, viddat_tr); + + int bank0 = 1, vicen = 1; + + if (!*aec && !segf) + { + switch ((offset >> 13) & 0x07) + { + case 0: bank0 = 0; break; + case 1: *csbank1 = 0; break; + case 2: *csbank2 = 0; break; + case 3: *csbank3 = 0; break; + case 4: *basiclocs = 0; break; + case 5: *basichics = 0; break; + case 6: + if (A12 && A11) + { + switch ((offset >> 8) & 0x07) + { + case 0: vicen = 0; break; + case 1: *cs1 = 0; break; + case 2: *sidcs = 0; break; + case 3: *extprtcs = 0; break; + case 4: *ciacs = 0; break; + case 5: *aciacs = 0; break; + case 6: *tript1cs = 0; break; + case 7: *tript2cs = 0; break; + } + } + break; + + case 7: *kernalcs = 0; break; + } + } + + int vidmatcsb = 1; + + read_pla2(offset, va, ba, vicen, ae, segf, bank0, + &clrnibcsb, extbufcs, discromcs, buframcs, charomcs, &procvid, viccs, &vidmatcsb); + + *clrnibcs = clrnibcsb || bcas; + *vidmatcs = vidmatcsb || bcas; + + read_pla1(offset, busy2, clrnibcsb, procvid, refen, ba, *aec, srw, + datxen, dramxen, clrniben, &segf, _64kcasen, casenb, viddaten, viddat_tr); +} + + +//------------------------------------------------- +// read_memory - +//------------------------------------------------- + +UINT8 p500_state::read_memory(address_space &space, offs_t offset, offs_t va, int ba, int ae) +{ + int srw = 1, busy2 = 1, refen = 0; + + int datxen = 1, dramxen = 1, clrniben = 1, _64kcasen = 1, casenb = 1, viddaten = 1, viddat_tr = 1; + int clrnibcs = 1, extbufcs = 1, discromcs = 1, buframcs = 1, charomcs = 1, viccs = 1, vidmatcs = 1; + int csbank1 = 1, csbank2 = 1, csbank3 = 1, basiclocs = 1, basichics = 1, kernalcs = 1; + int cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; + int aec = 1, vsysaden = 1; + + bankswitch(offset, va, srw, ba, ae, busy2, refen, + &datxen, &dramxen, &clrniben, &_64kcasen, &casenb, &viddaten, &viddat_tr, + &clrnibcs, &extbufcs, &discromcs, &buframcs, &charomcs, &viccs, &vidmatcs, + &csbank1, &csbank2, &csbank3, &basiclocs, &basichics, &kernalcs, + &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs, &aec, &vsysaden); + + UINT8 data = 0xff; + + if (clrniben) + { + if (!clrnibcs && !vsysaden) + { + data = m_color_ram[offset & 0x3ff]; + } + } + + if (!dramxen) + { + if (casenb) + { + switch (offset >> 16) + { + case 1: data = m_ram->pointer()[0x10000 + (offset & 0xffff)]; break; + case 2: if (m_ram->size() > 0x20000) data = m_ram->pointer()[0x20000 + (offset & 0xffff)]; break; + case 3: if (m_ram->size() > 0x30000) data = m_ram->pointer()[0x30000 + (offset & 0xffff)]; break; + } + } + } + + if (!datxen) + { + if (!_64kcasen && !aec) + { + data = m_ram->pointer()[offset & 0xffff]; + } + if (!buframcs) + { + data = m_buffer_ram[offset & 0x7ff]; + } + if (!vidmatcs && !vsysaden && !viddaten && viddat_tr) + { + data = m_video_ram[offset & 0x3ff]; + } + if (!basiclocs || !basichics) + { + data = m_basic->base()[offset & 0x3fff]; + } + if (!kernalcs) + { + data = m_kernal->base()[offset & 0x1fff]; + } + if (!charomcs && !vsysaden && !viddaten && viddat_tr) + { + data = m_charom->base()[offset & 0xfff]; + } + if (!viccs && !viddaten && viddat_tr) + { + data = m_vic->read(space, offset & 0x3f); + } + if (!sidcs) + { + data = m_sid->read(space, offset & 0x1f); + } + if (!ciacs) + { + data = m_cia->read(space, offset & 0x0f); + } + if (!aciacs) + { + data = m_acia->read(space, offset & 0x03); + } + if (!tript1cs) + { + data = m_tpi1->read(space, offset & 0x07); + } + if (!tript2cs) + { + data = m_tpi2->read(space, offset & 0x07); + } + + data = m_exp->read(space, offset & 0x1fff, data, csbank1, csbank2, csbank3); + } + + return data; +} + + +//------------------------------------------------- +// write_memory - +//------------------------------------------------- + +void p500_state::write_memory(address_space &space, offs_t offset, UINT8 data, int ba, int ae) +{ + int srw = 0, busy2 = 1, refen = 0; + offs_t va = 0xffff; + + int datxen = 1, dramxen = 1, clrniben = 1, _64kcasen = 1, casenb = 1, viddaten = 1, viddat_tr = 1; + int clrnibcs = 1, extbufcs = 1, discromcs = 1, buframcs = 1, charomcs = 1, viccs = 1, vidmatcs = 1; + int csbank1 = 1, csbank2 = 1, csbank3 = 1, basiclocs = 1, basichics = 1, kernalcs = 1; + int cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; + int aec = 1, vsysaden = 1; + + bankswitch(offset, va, srw, ba, ae, busy2, refen, + &datxen, &dramxen, &clrniben, &_64kcasen, &casenb, &viddaten, &viddat_tr, + &clrnibcs, &extbufcs, &discromcs, &buframcs, &charomcs, &viccs, &vidmatcs, + &csbank1, &csbank2, &csbank3, &basiclocs, &basichics, &kernalcs, + &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs, &aec, &vsysaden); + + if (clrniben) + { + if (!clrnibcs && !vsysaden) + { + m_color_ram[offset & 0x3ff] = data & 0x0f; + } + } + + if (!dramxen) + { + if (casenb) + { + switch (offset >> 16) + { + case 1: m_ram->pointer()[0x10000 + (offset & 0xffff)] = data; break; + case 2: if (m_ram->size() > 0x20000) m_ram->pointer()[0x20000 + (offset & 0xffff)] = data; break; + case 3: if (m_ram->size() > 0x30000) m_ram->pointer()[0x30000 + (offset & 0xffff)] = data; break; + } + } + } + + if (!datxen) + { + if (!_64kcasen && !aec) + { + m_ram->pointer()[offset & 0xffff] = data; + } + if (!buframcs) + { + m_buffer_ram[offset & 0x7ff] = data; + } + if (!vidmatcs && !vsysaden && !viddaten && !viddat_tr) + { + m_video_ram[offset & 0x3ff] = data; + } + if (!viccs && !viddaten && !viddat_tr) + { + m_vic->write(space, offset & 0x3f, data); + } + if (!sidcs) + { + m_sid->write(space, offset & 0x1f, data); + } + if (!ciacs) + { + m_cia->write(space, offset & 0x0f, data); + } + if (!aciacs) + { + m_acia->write(space, offset & 0x03, data); + } + if (!tript1cs) + { + m_tpi1->write(space, offset & 0x07, data); + } + if (!tript2cs) + { + m_tpi2->write(space, offset & 0x07, data); + } + + m_exp->write(space, offset & 0x1fff, data, csbank1, csbank2, csbank3); + } +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( p500_state::read ) +{ + int ba = 0, ae = 1; + offs_t va = 0xffff; + + return read_memory(space, offset, va, ba, ae); +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( p500_state::write ) +{ + int ba = 0, ae = 1; + + write_memory(space, offset, data, ba, ae); +} + + +//------------------------------------------------- +// vic_videoram_r - +//------------------------------------------------- + +READ8_MEMBER( p500_state::vic_videoram_r ) +{ + int srw = 1, busy2 = 1, refen = 0; + int ba = !m_vic->ba_r(), ae = m_vic->aec_r(); + int datxen = 1, dramxen = 1, clrniben = 1, _64kcasen = 1, casenb = 1, viddaten = 1, viddat_tr = 1; + int clrnibcs = 1, extbufcs = 1, discromcs = 1, buframcs = 1, charomcs = 1, viccs = 1, vidmatcs = 1; + int csbank1 = 1, csbank2 = 1, csbank3 = 1, basiclocs = 1, basichics = 1, kernalcs = 1; + int cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; + int aec = 1, vsysaden = 1; + + bankswitch(0, offset, srw, ba, ae, busy2, refen, + &datxen, &dramxen, &clrniben, &_64kcasen, &casenb, &viddaten, &viddat_tr, + &clrnibcs, &extbufcs, &discromcs, &buframcs, &charomcs, &viccs, &vidmatcs, + &csbank1, &csbank2, &csbank3, &basiclocs, &basichics, &kernalcs, + &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs, &aec, &vsysaden); + + UINT8 data = 0xff; +// UINT8 clrnib = 0xf; + + if (vsysaden) + { + if (!_64kcasen && !aec && !viddaten && !viddat_tr) + { + data = m_ram->pointer()[(m_vicbnksel << 14) | offset]; + } +/* if (!clrnibcs) + { + clrnib = m_color_ram[offset & 0x3ff]; + }*/ + if (!vidmatcs) + { + data = m_video_ram[offset & 0x3ff]; + } + if (!charomcs) + { + data = m_charom->base()[offset & 0xfff]; + } + } + + return data; +} + + +//------------------------------------------------- +// vic_videoram_r - +//------------------------------------------------- + +READ8_MEMBER( p500_state::vic_colorram_r ) +{ + int srw = 1, busy2 = 1, refen = 0; + int ba = !m_vic->ba_r(), ae = m_vic->aec_r(); + int datxen = 1, dramxen = 1, clrniben = 1, _64kcasen = 1, casenb = 1, viddaten = 1, viddat_tr = 1; + int clrnibcs = 1, extbufcs = 1, discromcs = 1, buframcs = 1, charomcs = 1, viccs = 1, vidmatcs = 1; + int csbank1 = 1, csbank2 = 1, csbank3 = 1, basiclocs = 1, basichics = 1, kernalcs = 1; + int cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; + int aec = 1, vsysaden = 1; + + bankswitch(0, offset, srw, ba, ae, busy2, refen, + &datxen, &dramxen, &clrniben, &_64kcasen, &casenb, &viddaten, &viddat_tr, + &clrnibcs, &extbufcs, &discromcs, &buframcs, &charomcs, &viccs, &vidmatcs, + &csbank1, &csbank2, &csbank3, &basiclocs, &basichics, &kernalcs, + &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs, &aec, &vsysaden); + + UINT8 data = 0x0f; + + if (!clrnibcs) + { + data = m_color_ram[offset & 0x3ff]; + } + + return data; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( cbm2_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( cbm2_mem, AS_PROGRAM, 8, cbm2_state ) + AM_RANGE(0x00000, 0xfffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( ext_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ext_mem, AS_PROGRAM, 8, cbm2_state ) + AM_RANGE(0x00000, 0xeffff) AM_READWRITE(ext_read, ext_write) + AM_RANGE(0xf0000, 0xf0fff) AM_MIRROR(0xf000) AM_ROM AM_REGION(EXT_I8088_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( ext_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ext_io, AS_IO, 8, cbm2_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x0001) AM_MIRROR(0x1e) AM_DEVREADWRITE(EXT_I8259A_TAG, pic8259_device, read, write) + AM_RANGE(0x0020, 0x0027) AM_MIRROR(0x18) AM_DEVREADWRITE(EXT_MOS6525_TAG, tpi6525_device, read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( p500_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( p500_mem, AS_PROGRAM, 8, p500_state ) + AM_RANGE(0x00000, 0xfffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_videoram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, p500_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_colorram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, p500_state ) + AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( cbm2 ) +//------------------------------------------------- + +static INPUT_PORTS_START( cbm2 ) + PORT_START("PB0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(TILDE)) PORT_CHAR(0x00a3) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xCF\x80") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0x03c0) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS/DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C=") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR/HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ?") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("OFF/RVS") PORT_CODE(KEYCODE_END) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad CE") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NORM/GRAPH") PORT_CODE(KEYCODE_PGUP) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 00") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN/STOP") PORT_CODE(KEYCODE_PGDN) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad /") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("LOCK") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE + PORT_BIT( 0xef, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( cbm2_de ) +//------------------------------------------------- + +static INPUT_PORTS_START( cbm2_de ) + PORT_INCLUDE(cbm2) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( cbm2_hu ) +//------------------------------------------------- + +static INPUT_PORTS_START( cbm2_hu ) + PORT_INCLUDE(cbm2) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( cbm2_se ) +//------------------------------------------------ + +static INPUT_PORTS_START( cbm2_se ) + PORT_INCLUDE(cbm2) + + PORT_MODIFY("PA0") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) + + PORT_MODIFY("PA1") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) + + PORT_MODIFY("PA2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" \xCF\x80") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(TILDE)) PORT_CHAR(0x03c0) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR(':') +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// mc6845 +//------------------------------------------------- + +MC6845_UPDATE_ROW( cbm2_state::crtc_update_row ) +{ + const pen_t *pen = m_palette->pens(); + + int x = 0; + + for (int column = 0; column < x_count; column++) + { + UINT8 code = m_video_ram[(ma + column) & 0x7ff]; + offs_t char_rom_addr = (ma & 0x1000) | (m_graphics << 11) | ((code & 0x7f) << 4) | (ra & 0x0f); + UINT8 data = m_charom->base()[char_rom_addr & 0xfff]; + + for (int bit = 0; bit < 9; bit++) + { + int color = BIT(data, 7) ^ BIT(code, 7) ^ BIT(ma, 13); + if (cursor_x == column) color ^= 1; + color &= de; + + bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + + if (bit < 8 || !m_graphics) data <<= 1; + } + } +} + +//------------------------------------------------- +// vic2_interface vic_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( p500_state::vic_irq_w ) +{ + m_vic_irq = state; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_vic_irq || m_tpi1_irq || m_user_irq); +} + + +//------------------------------------------------- +// MOS6581_INTERFACE( sid_intf ) +//------------------------------------------------- + +READ8_MEMBER( cbm2_state::sid_potx_r ) +{ + UINT8 data = 0xff; + + switch (m_cia_pa >> 6) + { + case 1: data = m_joy1->pot_x_r(); break; + case 2: data = m_joy2->pot_x_r(); break; + case 3: + if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) + { + data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); + } + else if (m_joy1->has_pot_x()) + { + data = m_joy1->pot_x_r(); + } + else if (m_joy2->has_pot_x()) + { + data = m_joy2->pot_x_r(); + } + break; + } + + return data; +} + +READ8_MEMBER( cbm2_state::sid_poty_r ) +{ + UINT8 data = 0xff; + + switch (m_cia_pa >> 6) + { + case 1: data = m_joy1->pot_y_r(); break; + case 2: data = m_joy2->pot_y_r(); break; + case 3: + if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) + { + data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); + } + else if (m_joy1->has_pot_y()) + { + data = m_joy1->pot_y_r(); + } + else if (m_joy2->has_pot_y()) + { + data = m_joy2->pot_y_r(); + } + break; + } + + return data; +} + + +//------------------------------------------------- +// tpi6525_interface tpi1_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( cbm2_state::tpi1_irq_w ) +{ + m_tpi1_irq = state; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_tpi1_irq || m_user_irq); +} + +WRITE_LINE_MEMBER( p500_state::tpi1_irq_w ) +{ + m_tpi1_irq = state; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_vic_irq || m_tpi1_irq || m_user_irq); +} + +READ8_MEMBER( cbm2_state::tpi1_pa_r ) +{ + /* + + bit description + + 0 0 + 1 0 + 2 REN + 3 ATN + 4 DAV + 5 EOI + 6 NDAC + 7 NRFD + + */ + + UINT8 data = 0; + + // IEEE-488 + data |= m_ieee2->ren_r() << 2; + data |= m_ieee2->atn_r() << 3; + data |= m_ieee2->dav_r() << 4; + data |= m_ieee2->eoi_r() << 5; + data |= m_ieee2->ndac_r() << 6; + data |= m_ieee2->nrfd_r() << 7; + + return data; +} + +WRITE8_MEMBER( cbm2_state::tpi1_pa_w ) +{ + /* + + bit description + + 0 75161A DC + 1 75161A TE + 2 REN + 3 ATN + 4 DAV + 5 EOI + 6 NDAC + 7 NRFD + + */ + + // IEEE-488 + m_ieee2->dc_w(BIT(data, 0)); + + m_ieee1->te_w(BIT(data, 1)); + m_ieee2->te_w(BIT(data, 1)); + + m_ieee2->ren_w(BIT(data, 2)); + m_ieee2->atn_w(BIT(data, 3)); + m_ieee2->dav_w(BIT(data, 4)); + m_ieee2->eoi_w(BIT(data, 5)); + m_ieee2->ndac_w(BIT(data, 6)); + m_ieee2->nrfd_w(BIT(data, 7)); +} + +READ8_MEMBER( cbm2_state::tpi1_pb_r ) +{ + /* + + bit description + + 0 IFC + 1 SRQ + 2 user port PB2 + 3 user port PB3 + 4 + 5 + 6 + 7 CASS SW + + */ + + UINT8 data = 0; + + // IEEE-488 + data |= m_ieee2->ifc_r(); + data |= m_ieee2->srq_r() << 1; + + // user port + data |= m_user->pb2_r() << 2; + data |= m_user->pb3_r() << 3; + + // cassette + data |= m_cassette->sense_r() << 7; + + return data; +} + +WRITE8_MEMBER( cbm2_state::tpi1_pb_w ) +{ + /* + + bit description + + 0 IFC + 1 SRQ + 2 user port PB2 + 3 user port PB3 + 4 DRAMON + 5 CASS WRT + 6 CASS MTR + 7 + + */ + + // IEEE-488 + m_ieee2->ifc_w(BIT(data, 0)); + m_ieee2->srq_w(BIT(data, 1)); + + // user port + m_user->pb2_w(BIT(data, 2)); + m_user->pb3_w(BIT(data, 3)); + + // memory + m_dramon = BIT(data, 4); + if (m_busy2) m_busen1 = m_dramon; + + // cassette + m_cassette->write(BIT(data, 5)); + m_cassette->motor_w(BIT(data, 6)); +} + +WRITE_LINE_MEMBER( cbm2_state::tpi1_ca_w ) +{ + m_graphics = state; +} + +WRITE_LINE_MEMBER( p500_state::tpi1_ca_w ) +{ + m_statvid = state; +} + +WRITE_LINE_MEMBER( p500_state::tpi1_cb_w ) +{ + m_vicdotsel = state; +} + +//------------------------------------------------- +// tpi6525_interface tpi2_intf +//------------------------------------------------- + +UINT8 cbm2_state::read_keyboard() +{ + UINT8 data = 0xff; + + if (!BIT(m_tpi2_pa, 0)) data &= m_pa0->read(); + if (!BIT(m_tpi2_pa, 1)) data &= m_pa1->read(); + if (!BIT(m_tpi2_pa, 2)) data &= m_pa2->read(); + if (!BIT(m_tpi2_pa, 3)) data &= m_pa3->read(); + if (!BIT(m_tpi2_pa, 4)) data &= m_pa4->read(); + if (!BIT(m_tpi2_pa, 5)) data &= m_pa5->read(); + if (!BIT(m_tpi2_pa, 6)) data &= m_pa6->read(); + if (!BIT(m_tpi2_pa, 7)) data &= m_pa7->read(); + if (!BIT(m_tpi2_pb, 0)) data &= m_pb0->read() & m_lock->read(); + if (!BIT(m_tpi2_pb, 1)) data &= m_pb1->read(); + if (!BIT(m_tpi2_pb, 2)) data &= m_pb2->read(); + if (!BIT(m_tpi2_pb, 3)) data &= m_pb3->read(); + if (!BIT(m_tpi2_pb, 4)) data &= m_pb4->read(); + if (!BIT(m_tpi2_pb, 5)) data &= m_pb5->read(); + if (!BIT(m_tpi2_pb, 6)) data &= m_pb6->read(); + if (!BIT(m_tpi2_pb, 7)) data &= m_pb7->read(); + + return data; +} + +WRITE8_MEMBER( cbm2_state::tpi2_pa_w ) +{ + m_tpi2_pa = data; +} + +WRITE8_MEMBER( cbm2_state::tpi2_pb_w ) +{ + m_tpi2_pb = data; +} + +READ8_MEMBER( cbm2_state::tpi2_pc_r ) +{ + /* + + bit description + + 0 COLUMN 0 + 1 COLUMN 1 + 2 COLUMN 2 + 3 COLUMN 3 + 4 COLUMN 4 + 5 COLUMN 5 + 6 0=PAL, 1=NTSC + 7 0 + + */ + + return (m_ntsc << 6) | (read_keyboard() & 0x3f); +} + +READ8_MEMBER( cbm2hp_state::tpi2_pc_r ) +{ + /* + + bit description + + 0 COLUMN 0 + 1 COLUMN 1 + 2 COLUMN 2 + 3 COLUMN 3 + 4 COLUMN 4 + 5 COLUMN 5 + 6 1 + 7 1 + + */ + + return read_keyboard(); +} + +READ8_MEMBER( p500_state::tpi2_pc_r ) +{ + /* + + bit description + + 0 COLUMN 0 + 1 COLUMN 1 + 2 COLUMN 2 + 3 COLUMN 3 + 4 COLUMN 4 + 5 COLUMN 5 + 6 0 + 7 0 + + */ + + return read_keyboard(); +} + +WRITE8_MEMBER( p500_state::tpi2_pc_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 VICBNKSEL0 + 7 VICBNKSEL1 + + */ + + m_vicbnksel = data >> 6; +} + +//------------------------------------------------- +// MOS6526_INTERFACE( cia_intf ) +//------------------------------------------------- + +READ8_MEMBER( cbm2_state::cia_pa_r ) +{ + /* + + bit description + + 0 IEEE-488 D0, user port 1D0 + 1 IEEE-488 D1, user port 1D1 + 2 IEEE-488 D2, user port 1D2 + 3 IEEE-488 D3, user port 1D3 + 4 IEEE-488 D4, user port 1D4 + 5 IEEE-488 D5, user port 1D5 + 6 IEEE-488 D6, user port 1D6, LTPN + 7 IEEE-488 D7, user port 1D7, GAME TRIGGER 24 + + */ + + UINT8 data = 0; + + // IEEE-488 + data |= m_ieee1->read(space, 0); + + // user port + data &= m_user->d1_r(space, 0); + + // joystick + data &= ~(!BIT(m_joy1->joy_r(), 5) << 6); + data &= ~(!BIT(m_joy2->joy_r(), 5) << 7); + + return data; +} + +WRITE8_MEMBER( cbm2_state::cia_pa_w ) +{ + /* + + bit description + + 0 IEEE-488 D0, user port 1D0 + 1 IEEE-488 D1, user port 1D1 + 2 IEEE-488 D2, user port 1D2 + 3 IEEE-488 D3, user port 1D3 + 4 IEEE-488 D4, user port 1D4 + 5 IEEE-488 D5, user port 1D5 + 6 IEEE-488 D6, user port 1D6 + 7 IEEE-488 D7, user port 1D7 + + */ + + // IEEE-488 + m_ieee1->write(space, 0, data); + + // user port + m_user->d1_w(space, 0, data); + + // joystick + m_cia_pa = data; +} + +READ8_MEMBER( cbm2_state::cia_pb_r ) +{ + /* + + bit description + + 0 user port 2D0, GAME10 + 1 user port 2D1, GAME11 + 2 user port 2D2, GAME12 + 3 user port 2D3, GAME13 + 4 user port 2D4, GAME20 + 5 user port 2D5, GAME21 + 6 user port 2D6, GAME22 + 7 user port 2D7, GAME23 + + */ + + UINT8 data = 0; + + // joystick + data |= m_joy1->joy_r() & 0x0f; + data |= (m_joy2->joy_r() & 0x0f) << 4; + + // user port + data &= m_user->d2_r(space, 0); + + return data; +} + + +//------------------------------------------------- +// tpi6525_interface ext_tpi_intf +//------------------------------------------------- + +void cbm2_state::set_busy2(int state) +{ + m_busy2 = state; + + if (m_busy2) + { + //m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + m_busen1 = m_dramon; + } + else + { + //m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + + m_busen1 = 0; + } +} + +READ8_MEMBER( cbm2_state::ext_tpi_pb_r ) +{ + /* + + bit description + + 0 _BUSY1 + 1 _BUSY2 + 2 _REQ + 3 _ACK + 4 DATA/_CMD + 5 DIR + 6 1 + 7 1 + + */ + + UINT8 data = 0xc0; + + // _BUSY1 + data |= !m_busen1; + + // _BUSY2 + data |= m_busy2 << 1; + + // CIA + data |= m_ext_tpi_pb & m_ext_cia_pb & 0x3c; + + return data; +} + +WRITE8_MEMBER( cbm2_state::ext_tpi_pb_w ) +{ + /* + + bit description + + 0 + 1 _BUSY2 + 2 + 3 + 4 + 5 + 6 CIA FLAG + 7 + + */ + + m_ext_tpi_pb = data; + + // _BUSY2 + if (!BIT(data, 1)) + { + set_busy2(0); + } + + // FLAG + m_ext_cia->flag_w(BIT(data, 6)); +} + +WRITE8_MEMBER( cbm2_state::ext_tpi_pc_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 BSYCLK + 6 + 7 + + */ + + // _BUSY2 + if (BIT(data, 5)) + { + set_busy2(1); + } +} + +//------------------------------------------------- +// MOS6526_INTERFACE( ext_cia_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( cbm2_state::ext_cia_irq_w ) +{ + m_tpi1->i3_w(!state); +} + +READ8_MEMBER( cbm2_state::ext_cia_pb_r ) +{ + /* + + bit description + + 0 _BUSY1 + 1 _BUSY2 + 2 _REQ + 3 _ACK + 4 DATA/_CMD + 5 DIR + 6 1 + 7 1 + + */ + + UINT8 data = 0xc0; + + // _BUSY1 + data |= !m_busen1; + + // _BUSY2 + data |= m_busy2 << 1; + + // TPI + data |= m_ext_tpi_pb & m_ext_cia_pb & 0x3c; + + return data; +} + +WRITE8_MEMBER( cbm2_state::ext_cia_pb_w ) +{ + /* + + bit description + + 0 + 1 _BUSY2 + 2 + 3 + 4 + 5 + 6 _INT1 + 7 _INT2 + + */ + + m_ext_cia_pb = data; + + // _BUSY2 + if (!BIT(data, 1)) + { + set_busy2(0); + } + + if (!BIT(data, 6)) + { + set_busy2(0); + } + + m_ext_pic->ir0_w(!BIT(data, 6)); + m_ext_pic->ir7_w(BIT(data, 7)); +} + + +//------------------------------------------------- +// CBM2_USER_PORT_INTERFACE( user_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( cbm2_state::user_irq_w ) +{ + m_user_irq = state; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_tpi1_irq || m_user_irq); +} + + +//------------------------------------------------- +// CBM2_USER_PORT_INTERFACE( p500_user_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( p500_state::user_irq_w ) +{ + m_user_irq = state; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_vic_irq || m_tpi1_irq || m_user_irq); +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void cbm2_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_tpi1->i0_w(m_todclk); + + if (m_ext_pic) m_ext_pic->ir2_w(m_todclk); + + m_todclk = !m_todclk; +} + + +//------------------------------------------------- +// MACHINE_START( cbm2 ) +//------------------------------------------------- + +MACHINE_START_MEMBER( cbm2_state, cbm2 ) +{ + // allocate memory + m_video_ram.allocate(m_video_ram_size); + m_buffer_ram.allocate(0x800); + + // allocate timer + int todclk = (m_ntsc ? 60 : 50) * 2; + + m_todclk_timer = timer_alloc(); + m_todclk_timer->adjust(attotime::from_hz(todclk), 0, attotime::from_hz(todclk)); + + // state saving + save_item(NAME(m_dramon)); + save_item(NAME(m_busen1)); + save_item(NAME(m_busy2)); + save_item(NAME(m_graphics)); + save_item(NAME(m_ntsc)); + save_item(NAME(m_todclk)); + save_item(NAME(m_tpi1_irq)); + save_item(NAME(m_tpi2_pa)); + save_item(NAME(m_tpi2_pb)); + save_item(NAME(m_cia_pa)); +} + + +//------------------------------------------------- +// MACHINE_START( cbm2_ntsc ) +//------------------------------------------------- + +MACHINE_START_MEMBER( cbm2_state, cbm2_ntsc ) +{ + m_ntsc = 1; + + MACHINE_START_CALL_MEMBER(cbm2); +} + + +//------------------------------------------------- +// MACHINE_START( cbm2_pal ) +//------------------------------------------------- + +MACHINE_START_MEMBER( cbm2_state, cbm2_pal ) +{ + m_ntsc = 0; + + MACHINE_START_CALL_MEMBER(cbm2); +} + + +//------------------------------------------------- +// MACHINE_START( cbm2x_ntsc ) +//------------------------------------------------- + +MACHINE_START_MEMBER( cbm2_state, cbm2x_ntsc ) +{ + // allocate memory + m_extbuf_ram.allocate(0x800); + + MACHINE_START_CALL_MEMBER(cbm2_ntsc); +} + + +//------------------------------------------------- +// MACHINE_START( cbm2x_pal ) +//------------------------------------------------- + +MACHINE_START_MEMBER( cbm2_state, cbm2x_pal ) +{ + // allocate memory + m_extbuf_ram.allocate(0x800); + + MACHINE_START_CALL_MEMBER(cbm2_pal); +} + + +//------------------------------------------------- +// MACHINE_START( p500 ) +//------------------------------------------------- + +MACHINE_START_MEMBER( p500_state, p500 ) +{ + m_video_ram_size = 0x400; + + MACHINE_START_CALL_MEMBER(cbm2); + + // allocate memory + m_color_ram.allocate(0x400); + + // state saving + save_item(NAME(m_statvid)); + save_item(NAME(m_vicdotsel)); + save_item(NAME(m_vicbnksel)); + save_item(NAME(m_vic_irq)); +} + + +//------------------------------------------------- +// MACHINE_START( p500_ntsc ) +//------------------------------------------------- + +MACHINE_START_MEMBER( p500_state, p500_ntsc ) +{ + m_ntsc = 1; + + MACHINE_START_CALL_MEMBER(p500); +} + + +//------------------------------------------------- +// MACHINE_START( p500_pal ) +//------------------------------------------------- + +MACHINE_START_MEMBER( p500_state, p500_pal ) +{ + m_ntsc = 0; + + MACHINE_START_CALL_MEMBER(p500); +} + + +MACHINE_RESET_MEMBER( cbm2_state, cbm2 ) +{ + m_dramon = 1; + m_busen1 = 1; + m_busy2 = 1; + m_graphics = 1; + m_tpi1_irq = CLEAR_LINE; + m_user_irq = CLEAR_LINE; + +m_ext_tpi_pb = 0xff; +m_ext_cia_pb = 0xff; + + m_maincpu->reset(); + + if (m_crtc) m_crtc->reset(); + m_sid->reset(); + m_tpi1->reset(); + m_tpi2->reset(); + m_acia->reset(); + m_cia->reset(); + + m_ieee->reset(); +} + + +MACHINE_RESET_MEMBER( p500_state, p500 ) +{ + MACHINE_RESET_CALL_MEMBER(cbm2); + + m_vic->reset(); + + m_statvid = 1; + m_vicdotsel = 1; + m_vicbnksel = 0x03; + m_vic_irq = CLEAR_LINE; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( 128k ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( 128k ) + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("256K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( 256k ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( 256k ) + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( p500_ntsc ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( p500_ntsc, p500_state ) + MCFG_MACHINE_START_OVERRIDE(p500_state, p500_ntsc) + MCFG_MACHINE_RESET_OVERRIDE(p500_state, p500) + + // basic hardware + MCFG_CPU_ADD(M6509_TAG, M6509, XTAL_14_31818MHz/14) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_CPU_PROGRAM_MAP(p500_mem) + MCFG_QUANTUM_PERFECT_CPU(M6509_TAG) + + // video hardware + MCFG_DEVICE_ADD(MOS6567_TAG, MOS6567, XTAL_14_31818MHz/14) + MCFG_MOS6566_CPU(M6509_TAG) + MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(p500_state, vic_irq_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) + MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) + MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DEVICE(MOS6567_TAG, mos6567_device, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_14_31818MHz/14) + MCFG_MOS6581_POTX_CALLBACK(READ8(p500_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(p500_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_PLS100_ADD(PLA1_TAG) + MCFG_PLS100_ADD(PLA2_TAG) + MCFG_DEVICE_ADD(MOS6525_1_TAG, TPI6525, 0) + MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(p500_state, tpi1_irq_w)) + MCFG_TPI6525_IN_PA_CB(READ8(cbm2_state, tpi1_pa_r)) + MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi1_pa_w)) + MCFG_TPI6525_IN_PB_CB(READ8(cbm2_state, tpi1_pb_r)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi1_pb_w)) + MCFG_TPI6525_OUT_CA_CB(WRITELINE(p500_state, tpi1_ca_w)) + MCFG_TPI6525_OUT_CB_CB(WRITELINE(p500_state, tpi1_cb_w)) + MCFG_DEVICE_ADD(MOS6525_2_TAG, TPI6525, 0) + MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi2_pa_w)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi2_pb_w)) + MCFG_TPI6525_IN_PC_CB(READ8(p500_state, tpi2_pc_r)) + MCFG_TPI6525_OUT_PC_CB(WRITE8(p500_state, tpi2_pc_w)) + MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, VIC6567_CLOCK) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_IRQ_HANDLER(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_MOS6551_RXC_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_etc)) + MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL_14_31818MHz/14) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(cbm2_state, cia_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cbm2_state, cia_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, cia_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w)) + MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) + MCFG_DEVICE_ADD(DS75161A_TAG, DS75161A, 0) + MCFG_DS75161A_IN_REN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ren_r)) + MCFG_DS75161A_IN_IFC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ifc_r)) + MCFG_DS75161A_IN_NDAC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ndac_r)) + MCFG_DS75161A_IN_NRFD_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, nrfd_r)) + MCFG_DS75161A_IN_DAV_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, dav_r)) + MCFG_DS75161A_IN_EOI_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, eoi_r)) + MCFG_DS75161A_IN_ATN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, atn_r)) + MCFG_DS75161A_IN_SRQ_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, srq_r)) + MCFG_DS75161A_OUT_REN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) + MCFG_DS75161A_OUT_IFC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) + MCFG_DS75161A_OUT_NDAC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) + MCFG_DS75161A_OUT_NRFD_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, nrfd_w)) + MCFG_DS75161A_OUT_DAV_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) + MCFG_DS75161A_OUT_EOI_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, eoi_w)) + MCFG_DS75161A_OUT_ATN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, atn_w)) + MCFG_DS75161A_OUT_SRQ_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, srq_w)) + MCFG_CBM_IEEE488_ADD("c8050") + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL, DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6567_TAG, mos6567_device, lp_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) + MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/14, cbm2_expansion_cards, NULL) + MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, cbm2_user_port_cards, NULL) + MCFG_CBM2_USER_PORT_IRQ_CALLBACK(WRITELINE(p500_state, user_irq_w)) + MCFG_CBM2_USER_PORT_SP_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w)) + MCFG_CBM2_USER_PORT_CNT_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w)) + MCFG_CBM2_USER_PORT_FLAG_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) + + MCFG_QUICKLOAD_ADD("quickload", p500_state, p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + // internal ram + MCFG_FRAGMENT_ADD(128k) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list", "cbm2_cart") + MCFG_SOFTWARE_LIST_ADD("flop_list", "p500_flop") + MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( p500_pal ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( p500_pal, p500_state ) + MCFG_MACHINE_START_OVERRIDE(p500_state, p500_pal) + MCFG_MACHINE_RESET_OVERRIDE(p500_state, p500) + + // basic hardware + MCFG_CPU_ADD(M6509_TAG, M6509, XTAL_17_734472MHz/18) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_CPU_PROGRAM_MAP(p500_mem) + MCFG_QUANTUM_PERFECT_CPU(M6509_TAG) + + // video hardware + MCFG_DEVICE_ADD(MOS6569_TAG, MOS6569, XTAL_17_734472MHz/18) + MCFG_MOS6566_CPU(M6509_TAG) + MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(p500_state, vic_irq_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) + MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) + MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DEVICE(MOS6569_TAG, mos6569_device, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_17_734472MHz/18) + MCFG_MOS6581_POTX_CALLBACK(READ8(p500_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(p500_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_PLS100_ADD(PLA1_TAG) + MCFG_PLS100_ADD(PLA2_TAG) + MCFG_DEVICE_ADD(MOS6525_1_TAG, TPI6525, 0) + MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(p500_state, tpi1_irq_w)) + MCFG_TPI6525_IN_PA_CB(READ8(cbm2_state, tpi1_pa_r)) + MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi1_pa_w)) + MCFG_TPI6525_IN_PB_CB(READ8(cbm2_state, tpi1_pb_r)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi1_pb_w)) + MCFG_TPI6525_OUT_CA_CB(WRITELINE(p500_state, tpi1_ca_w)) + MCFG_TPI6525_OUT_CB_CB(WRITELINE(p500_state, tpi1_cb_w)) + MCFG_DEVICE_ADD(MOS6525_2_TAG, TPI6525, 0) + MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi2_pa_w)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi2_pb_w)) + MCFG_TPI6525_IN_PC_CB(READ8(p500_state, tpi2_pc_r)) + MCFG_TPI6525_OUT_PC_CB(WRITE8(p500_state, tpi2_pc_w)) + MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_IRQ_HANDLER(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL_17_734472MHz/18) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(cbm2_state, cia_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cbm2_state, cia_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, cia_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w)) + MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) + MCFG_DEVICE_ADD(DS75161A_TAG, DS75161A, 0) + MCFG_DS75161A_IN_REN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ren_r)) + MCFG_DS75161A_IN_IFC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ifc_r)) + MCFG_DS75161A_IN_NDAC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ndac_r)) + MCFG_DS75161A_IN_NRFD_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, nrfd_r)) + MCFG_DS75161A_IN_DAV_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, dav_r)) + MCFG_DS75161A_IN_EOI_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, eoi_r)) + MCFG_DS75161A_IN_ATN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, atn_r)) + MCFG_DS75161A_IN_SRQ_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, srq_r)) + MCFG_DS75161A_OUT_REN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) + MCFG_DS75161A_OUT_IFC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) + MCFG_DS75161A_OUT_NDAC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) + MCFG_DS75161A_OUT_NRFD_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, nrfd_w)) + MCFG_DS75161A_OUT_DAV_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) + MCFG_DS75161A_OUT_EOI_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, eoi_w)) + MCFG_DS75161A_OUT_ATN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, atn_w)) + MCFG_DS75161A_OUT_SRQ_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, srq_w)) + MCFG_CBM_IEEE488_ADD("c8050") + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL, DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) + MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_17_734472MHz/18, cbm2_expansion_cards, NULL) + MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, cbm2_user_port_cards, NULL) + MCFG_CBM2_USER_PORT_IRQ_CALLBACK(WRITELINE(p500_state, user_irq_w)) + MCFG_CBM2_USER_PORT_SP_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w)) + MCFG_CBM2_USER_PORT_CNT_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w)) + MCFG_CBM2_USER_PORT_FLAG_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) + + MCFG_QUICKLOAD_ADD("quickload", p500_state, p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + // internal ram + MCFG_FRAGMENT_ADD(128k) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list", "cbm2_cart") + MCFG_SOFTWARE_LIST_ADD("flop_list", "p500_flop") + MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm2lp_ntsc ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( cbm2lp_ntsc, cbm2_state ) + MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2_ntsc) + MCFG_MACHINE_RESET_OVERRIDE(cbm2_state, cbm2) + + // basic hardware + MCFG_CPU_ADD(M6509_TAG, M6509, XTAL_18MHz/9) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_CPU_PROGRAM_MAP(cbm2_mem) + MCFG_QUANTUM_PERFECT_CPU(M6509_TAG) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DEVICE(MC68B45_TAG, mc6845_device, screen_update) + + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(768, 312) + MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 312-1) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_MC6845_ADD(MC68B45_TAG, MC6845, SCREEN_TAG, XTAL_18MHz/9) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(9) + MCFG_MC6845_UPDATE_ROW_CB(cbm2_state, crtc_update_row) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_18MHz/9) + MCFG_MOS6581_POTX_CALLBACK(READ8(cbm2_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(cbm2_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_PLS100_ADD(PLA1_TAG) + MCFG_DEVICE_ADD(MOS6525_1_TAG, TPI6525, 0) + MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(cbm2_state, tpi1_irq_w)) + MCFG_TPI6525_IN_PA_CB(READ8(cbm2_state, tpi1_pa_r)) + MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi1_pa_w)) + MCFG_TPI6525_IN_PA_CB(READ8(cbm2_state, tpi1_pb_r)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi1_pb_w)) + MCFG_TPI6525_OUT_CA_CB(WRITELINE(cbm2_state, tpi1_ca_w)) + MCFG_DEVICE_ADD(MOS6525_2_TAG, TPI6525, 0) + MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi2_pa_w)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi2_pb_w)) + MCFG_TPI6525_IN_PC_CB(READ8(cbm2_state, tpi2_pc_r)) + MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_IRQ_HANDLER(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL_18MHz/9) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(cbm2_state, cia_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cbm2_state, cia_pa_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, cia_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w)) + MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w)) + MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) + MCFG_DEVICE_ADD(DS75161A_TAG, DS75161A, 0) + MCFG_DS75161A_IN_REN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ren_r)) + MCFG_DS75161A_IN_IFC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ifc_r)) + MCFG_DS75161A_IN_NDAC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ndac_r)) + MCFG_DS75161A_IN_NRFD_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, nrfd_r)) + MCFG_DS75161A_IN_DAV_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, dav_r)) + MCFG_DS75161A_IN_EOI_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, eoi_r)) + MCFG_DS75161A_IN_ATN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, atn_r)) + MCFG_DS75161A_IN_SRQ_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, srq_r)) + MCFG_DS75161A_OUT_REN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) + MCFG_DS75161A_OUT_IFC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) + MCFG_DS75161A_OUT_NDAC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) + MCFG_DS75161A_OUT_NRFD_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, nrfd_w)) + MCFG_DS75161A_OUT_DAV_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) + MCFG_DS75161A_OUT_EOI_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, eoi_w)) + MCFG_DS75161A_OUT_ATN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, atn_w)) + MCFG_DS75161A_OUT_SRQ_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, srq_w)) + MCFG_CBM_IEEE488_ADD("c8050") + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL,DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) + MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_18MHz/9, cbm2_expansion_cards, NULL) + MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, cbm2_user_port_cards, NULL) + MCFG_CBM2_USER_PORT_IRQ_CALLBACK(WRITELINE(cbm2_state, user_irq_w)) + MCFG_CBM2_USER_PORT_SP_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w)) + MCFG_CBM2_USER_PORT_CNT_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w)) + MCFG_CBM2_USER_PORT_FLAG_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) + + MCFG_QUICKLOAD_ADD("quickload", cbm2_state, cbmb, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list", "cbm2_cart") + MCFG_SOFTWARE_LIST_ADD("flop_list", "cbm2_flop") + MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( b128 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( b128, cbm2lp_ntsc ) + MCFG_FRAGMENT_ADD(128k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( b256 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( b256, cbm2lp_ntsc ) + MCFG_FRAGMENT_ADD(256k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm2lp_pal ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm2lp_pal, cbm2lp_ntsc ) + MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2_pal) + + MCFG_DEVICE_MODIFY(MOS6526_TAG) + MCFG_MOS6526_TOD(50) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm610 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm610, cbm2lp_pal ) + MCFG_FRAGMENT_ADD(128k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm620 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm620, cbm2lp_pal ) + MCFG_FRAGMENT_ADD(256k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm2hp_ntsc ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( cbm2hp_ntsc, cbm2lp_ntsc, cbm2hp_state ) + MCFG_DEVICE_MODIFY(MOS6525_2_TAG) + MCFG_TPI6525_IN_PC_CB(READ8(cbm2hp_state, tpi2_pc_r)) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( b128hp ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( b128hp, cbm2hp_ntsc ) + MCFG_FRAGMENT_ADD(128k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( b256hp ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( b256hp, cbm2hp_ntsc ) + MCFG_FRAGMENT_ADD(256k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( bx256hp ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( bx256hp, b256hp ) + MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2x_ntsc) + + MCFG_CPU_ADD(EXT_I8088_TAG, I8088, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(ext_mem) + MCFG_CPU_IO_MAP(ext_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(EXT_I8259A_TAG, pic8259_device, inta_cb) + + MCFG_PIC8259_ADD(EXT_I8259A_TAG, INPUTLINE(EXT_I8088_TAG, INPUT_LINE_IRQ0), VCC, NULL) + MCFG_DEVICE_ADD(EXT_MOS6525_TAG, TPI6525, 0) + MCFG_TPI6525_IN_PA_CB(DEVREAD8(EXT_MOS6526_TAG, mos6526_device, pa_r)) + MCFG_TPI6525_IN_PB_CB(READ8(cbm2_state, ext_tpi_pb_r)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, ext_tpi_pb_w)) + MCFG_TPI6525_OUT_PC_CB(WRITE8(cbm2_state, ext_tpi_pc_w)) + MCFG_DEVICE_ADD(EXT_MOS6526_TAG, MOS6526, XTAL_18MHz/9) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(cbm2_state, ext_cia_irq_w)) + MCFG_MOS6526_PA_INPUT_CALLBACK(DEVREAD8(EXT_MOS6525_TAG, tpi6525_device, pa_r)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, ext_cia_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(cbm2_state, ext_cia_pb_w)) + + MCFG_SOFTWARE_LIST_ADD("flop_list2", "bx256hp_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm2hp_pal ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm2hp_pal, cbm2hp_ntsc ) + MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2_pal) + + // devices + MCFG_DEVICE_MODIFY(MOS6525_2_TAG) + MCFG_TPI6525_IN_PC_CB(READ8(cbm2hp_state, tpi2_pc_r)) + + MCFG_DEVICE_MODIFY(MOS6526_TAG) + MCFG_MOS6526_TOD(50) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm710 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm710, cbm2hp_pal ) + MCFG_FRAGMENT_ADD(128k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm720 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm720, cbm2hp_pal ) + MCFG_FRAGMENT_ADD(256k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm730 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm730, cbm720 ) + MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2x_pal) + + MCFG_CPU_ADD(EXT_I8088_TAG, I8088, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(ext_mem) + MCFG_CPU_IO_MAP(ext_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(EXT_I8259A_TAG, pic8259_device, inta_cb) + + MCFG_PIC8259_ADD(EXT_I8259A_TAG, INPUTLINE(EXT_I8088_TAG, INPUT_LINE_IRQ0), VCC, NULL) + MCFG_DEVICE_ADD(EXT_MOS6525_TAG, TPI6525, 0) + MCFG_TPI6525_IN_PA_CB(DEVREAD8(EXT_MOS6526_TAG, mos6526_device, pa_r)) + MCFG_TPI6525_IN_PB_CB(READ8(cbm2_state, ext_tpi_pb_r)) + MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, ext_tpi_pb_w)) + MCFG_TPI6525_OUT_PC_CB(WRITE8(cbm2_state, ext_tpi_pc_w)) + MCFG_DEVICE_ADD(EXT_MOS6526_TAG, MOS6526, XTAL_18MHz/9) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(cbm2_state, ext_cia_irq_w)) + MCFG_MOS6526_PA_INPUT_CALLBACK(DEVREAD8(EXT_MOS6525_TAG, tpi6525_device, pa_r)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, ext_cia_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(cbm2_state, ext_cia_pb_w)) + + MCFG_SOFTWARE_LIST_ADD("flop_list2", "bx256hp_flop") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( p500 ) +//------------------------------------------------- + +ROM_START( p500 ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_DEFAULT_BIOS("r2") + ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) + ROMX_LOAD( "901236-01.u84", 0x0000, 0x2000, CRC(33eb6aa2) SHA1(7e3497ae2edbb38c753bd31ed1bf3ae798c9a976), ROM_BIOS(1) ) + ROMX_LOAD( "901235-01.u83", 0x2000, 0x2000, CRC(18a27feb) SHA1(951b5370dd7db762b8504a141f9f26de345069bb), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) + ROMX_LOAD( "901236-02.u84", 0x0000, 0x2000, CRC(c62ab16f) SHA1(f50240407bade901144f7e9f489fa9c607834eca), ROM_BIOS(2) ) + ROMX_LOAD( "901235-02.u83", 0x2000, 0x2000, CRC(20b7df33) SHA1(1b9a55f12f8cf025754d8029cc5324b474c35841), ROM_BIOS(2) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROMX_LOAD( "901234-01.u82", 0x0000, 0x2000, CRC(67962025) SHA1(24b41b65c85bf30ab4e2911f677ce9843845b3b1), ROM_BIOS(1) ) + ROMX_LOAD( "901234-02.u82", 0x0000, 0x2000, CRC(f46bbd2b) SHA1(097197d4d08e0b82e0466a5f1fbd49a24f3d2523), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901225-01.u76", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-02.u78", 0x00, 0xf5, CRC(6436b20b) SHA1(57ebebe771791288051afd1abe9b7500bd2df847) ) + + ROM_REGION( 0xf5, PLA2_TAG, 0 ) + ROM_LOAD( "906114-03.u88", 0x00, 0xf5, CRC(668c073e) SHA1(1115858bb2dc91ea9e2016ba2e23ec94239358b4) ) +ROM_END + +#define rom_p500p rom_p500 + + +//------------------------------------------------- +// ROM( b500 ) +//------------------------------------------------- + +ROM_START( b500 ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "901243-01.u59", 0x0000, 0x2000, CRC(22822706) SHA1(901bbf59d8b8682b481be8b2de99b406fffa4bab) ) + ROM_LOAD( "901242-01a.u60", 0x2000, 0x2000, CRC(ef13d595) SHA1(2fb72985d7d4ab69c5780179178828c931a9f5b0) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "901244-01.u61", 0x0000, 0x2000, CRC(93414213) SHA1(a54a593dbb420ae1ac39b0acde9348160f7840ff) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901237-01.u25", 0x0000, 0x1000, CRC(1acf5098) SHA1(e63bf18da48e5a53c99ef127c1ae721333d1d102) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-04.u18", 0x00, 0xf5, CRC(ae3ec265) SHA1(334e0bc4b2c957ecb240c051d84372f7b47efba3) ) +ROM_END + + +//------------------------------------------------- +// ROM( b128 ) +//------------------------------------------------- + +ROM_START( b128 ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_DEFAULT_BIOS("r2") + ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) + ROMX_LOAD( "901243-02b.u59", 0x0000, 0x2000, CRC(9d0366f9) SHA1(625f7337ea972a8bce2bdf2daababc0ed0b3b69b), ROM_BIOS(1) ) + ROMX_LOAD( "901242-02b.u60", 0x2000, 0x2000, CRC(837978b5) SHA1(56e8d2f86bf73ba36b3d3cb84dd75806b66c530a), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) + ROMX_LOAD( "901243-04a.u59", 0x0000, 0x2000, CRC(b0dcb56d) SHA1(08d333208060ee2ce84d4532028d94f71c016b96), ROM_BIOS(2) ) + ROMX_LOAD( "901242-04a.u60", 0x2000, 0x2000, CRC(de04ea4f) SHA1(7c6de17d46a3343dc597d9b9519cf63037b31908), ROM_BIOS(2) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) + ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901237-01.u25", 0x0000, 0x1000, CRC(1acf5098) SHA1(e63bf18da48e5a53c99ef127c1ae721333d1d102) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-04.u18", 0x00, 0xf5, CRC(ae3ec265) SHA1(334e0bc4b2c957ecb240c051d84372f7b47efba3) ) +ROM_END + +#define rom_cbm610 rom_b128 +#define rom_cbm620 rom_b256 + + +//------------------------------------------------- +// ROM( b256 ) +//------------------------------------------------- + +ROM_START( b256 ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) + ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_DEFAULT_BIOS("r2") + ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) + ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) + ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901237-01.u25", 0x0000, 0x1000, CRC(1acf5098) SHA1(e63bf18da48e5a53c99ef127c1ae721333d1d102) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-04.u18", 0x00, 0xf5, CRC(ae3ec265) SHA1(334e0bc4b2c957ecb240c051d84372f7b47efba3) ) +ROM_END + + +//------------------------------------------------- +// ROM( cbm620_hu ) +//------------------------------------------------- + +ROM_START( cbm620_hu ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "610.u60", 0x0000, 0x4000, CRC(8eed0d7e) SHA1(9d06c5c3c012204eaaef8b24b1801759b62bf57e) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "kernhun.u61", 0x0000, 0x2000, CRC(0ea8ca4d) SHA1(9977c9f1136ee9c04963e0b50ae0c056efa5663f) ) + + ROM_REGION( 0x2000, "charom", 0 ) + ROM_LOAD( "charhun.u25", 0x0000, 0x2000, CRC(1fb5e596) SHA1(3254e069f8691b30679b19a9505b6afdfedce6ac) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-04.u18", 0x00, 0xf5, CRC(ae3ec265) SHA1(334e0bc4b2c957ecb240c051d84372f7b47efba3) ) +ROM_END + + +//------------------------------------------------- +// ROM( b128hp ) +//------------------------------------------------- + +ROM_START( b128hp ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_DEFAULT_BIOS("r2") + ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) + ROMX_LOAD( "901243-02b.u59", 0x0000, 0x2000, CRC(9d0366f9) SHA1(625f7337ea972a8bce2bdf2daababc0ed0b3b69b), ROM_BIOS(1) ) + ROMX_LOAD( "901242-02b.u60", 0x2000, 0x2000, CRC(837978b5) SHA1(56e8d2f86bf73ba36b3d3cb84dd75806b66c530a), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) + ROMX_LOAD( "901243-04a.u59", 0x0000, 0x2000, CRC(b0dcb56d) SHA1(08d333208060ee2ce84d4532028d94f71c016b96), ROM_BIOS(2) ) + ROMX_LOAD( "901242-04a.u60", 0x2000, 0x2000, CRC(de04ea4f) SHA1(7c6de17d46a3343dc597d9b9519cf63037b31908), ROM_BIOS(2) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) + ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901232-01.u25", 0x0000, 0x1000, CRC(3a350bc3) SHA1(e7f3cbc8e282f79a00c3e95d75c8d725ee3c6287) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) +ROM_END + +#define rom_cbm710 rom_b128hp + + +//------------------------------------------------- +// ROM( b256hp ) +//------------------------------------------------- + +ROM_START( b256hp ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) + ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_DEFAULT_BIOS("r2") + ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) + ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) + ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901232-01.u25", 0x0000, 0x1000, CRC(3a350bc3) SHA1(e7f3cbc8e282f79a00c3e95d75c8d725ee3c6287) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) +ROM_END + +#define rom_cbm720 rom_b256hp + + +//------------------------------------------------- +// ROM( bx256hp ) +//------------------------------------------------- + +ROM_START( bx256hp ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) + ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) + + ROM_REGION( 0x1000, EXT_I8088_TAG, 0) + ROM_LOAD( "8088.u14", 0x0000, 0x1000, CRC(195e0281) SHA1(ce8acd2a5fb6cbd70d837811d856d656544a1f97) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_DEFAULT_BIOS("r2") + ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) + ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) + ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901232-01.u25", 0x0000, 0x1000, CRC(3a350bc3) SHA1(e7f3cbc8e282f79a00c3e95d75c8d725ee3c6287) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) +ROM_END + +#define rom_cbm730 rom_bx256hp + + +//------------------------------------------------- +// ROM( cbm720_de ) +//------------------------------------------------- + +ROM_START( cbm720_de ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) + ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "324866-03a.u61", 0x0000, 0x2000, CRC(554b008d) SHA1(1483a46924308d86f4c7f9cb71c34851c510fcf4) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "324867-02.u25", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) +ROM_END + + +//------------------------------------------------- +// ROM( cbm720_se ) +//------------------------------------------------- + +ROM_START( cbm720_se ) + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) + ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "swe-901244-03.u61", 0x0000, 0x2000, CRC(87bc142b) SHA1(fa711f6082741b05a9c80744f5aee68dc8c1dcf4) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901233-03.u25", 0x0000, 0x1000, CRC(09518b19) SHA1(2e28491e31e2c0a3b6db388055216140a637cd09) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, p500, 0, 0, p500_ntsc, cbm2, driver_device, 0, "Commodore Business Machines", "P500 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, p500p, p500, 0, p500_pal, cbm2, driver_device, 0, "Commodore Business Machines", "P500 (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, b500, 0, 0, b128, cbm2, driver_device, 0, "Commodore Business Machines", "B500", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, b128, b500, 0, b128, cbm2, driver_device, 0, "Commodore Business Machines", "B128", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, b256, b500, 0, b256, cbm2, driver_device, 0, "Commodore Business Machines", "B256", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, cbm610, b500, 0, cbm610, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 610", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, cbm620, b500, 0, cbm620, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 620", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, cbm620_hu, b500, 0, cbm620, cbm2_hu, driver_device, 0, "Commodore Business Machines", "CBM 620 (Hungary)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, b128hp, 0, 0, b128hp, cbm2, driver_device, 0, "Commodore Business Machines", "B128-80HP", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, b256hp, b128hp, 0, b256hp, cbm2, driver_device, 0, "Commodore Business Machines", "B256-80HP", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, bx256hp, b128hp, 0, bx256hp, cbm2, driver_device, 0, "Commodore Business Machines", "BX256-80HP", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // 8088 co-processor is missing +COMP( 1983, cbm710, b128hp, 0, cbm710, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 710", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, cbm720, b128hp, 0, cbm720, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 720", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, cbm720_de, b128hp, 0, cbm720, cbm2_de, driver_device, 0, "Commodore Business Machines", "CBM 720 (Germany)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1983, cbm720_se, b128hp, 0, cbm720, cbm2_se, driver_device, 0, "Commodore Business Machines", "CBM 720 (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, cbm730, b128hp, 0, cbm730, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 730", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // 8088 co-processor is missing diff --git a/src/mame/drivers/cc40.c b/src/mame/drivers/cc40.c new file mode 100644 index 00000000000..ba5e937d423 --- /dev/null +++ b/src/mame/drivers/cc40.c @@ -0,0 +1,641 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + Texas Instruments Compact Computer 40 (aka CC-40) + hardware family: CC-40 -> CC-40+(unreleased) -> TI-74 BASICALC -> TI-95 PROCALC + + --------------------------------------------- + | --------------------------------------- | + | | | | + | | LCD screen | | + | | | --------------- + | --------------------------------------- | + | | + | | + | | + | *HD44100H | + | *HD44780A00 | + | | + | | + | | + ----|||||||||||-----------------------------|||||||||||---- + ||||||||||| ||||||||||| + ----|||||||||||-----------------------------|||||||||||---- + | | + | HM6116LP-4 HM6116LP-4 | + | | + | | + | HM6116LP-4 TMX70C20N2L | + | 5MHz | + | AMI 1041036-1 | + | HN61256PC09 | + | *Cartridge | + | --------------- + | | + | ------------------------------------- + |*HEXBUS| + --------- + + HM6116LP-4 - Hitachi 2KB SRAM (newer 18KB version has two HM6264 8KB chips) + HN61256PC09 - Hitachi DIP-28 32KB CMOS Mask PROM + TMX70C20N2L - Texas Instruments TMS70C20 CPU (128 bytes RAM, 2KB ROM) @ 2.5MHz, 40 pins - "X" implies prototype + AMI 1041036-1 - 68-pin QFP AMI Gate Array + HD44100H - 60-pin QFP Hitachi HD44100 LCD Driver + HD44780A00 - 80-pin TFP Hitachi HD44780 LCD Controller + + * - indicates that it's on the other side of the PCB + + + CC-40 is powered by 4 AA batteries. These will also save internal RAM, + provided that the machine is turned off properly. If a program is running, + you may have to press [BREAK] before turning the CC-40 off. If RAM contents + ends up dodgy somehow, just delete the nvram files. + + Officially, minimum total RAM size is 6KB. The system will still boot with less, + but don't expect all software to work properly. + + To run a cartridge, usually the command RUN "DIR" shows which program(s) + can be loaded. Load a program by pressing the [RUN] key while viewing the list, + or manually with the command RUN "" + + + TODO: + - external RAM cartridge (bus_control_w cartridge memory addressing) + - auto clock divider on slow memory access + - Hexbus interface and peripherals + * HX-1000: color plotter + * HX-1010: thermal printer + * HX-3000: RS-232 interface + * HX-3100: modem + * HX-3200: Centronics printer interface + +***************************************************************************/ + +#include "emu.h" +#include "cpu/tms7000/tms7000.h" +#include "video/hd44780.h" +#include "sound/dac.h" +#include "machine/nvram.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#include "cc40.lh" + + +class cc40_state : public driver_device +{ +public: + cc40_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dac(*this, "dac"), + m_cart(*this, "cartslot"), + m_key_matrix(*this, "IN"), + m_battery_inp(*this, "BATTERY") + { + m_sysram[0] = NULL; + m_sysram[1] = NULL; + } + + required_device m_maincpu; + required_device m_dac; + required_device m_cart; + required_ioport_array<8> m_key_matrix; + required_ioport m_battery_inp; + + nvram_device *m_nvram[2]; + + memory_region *m_cart_rom; + + UINT8 m_bus_control; + UINT8 m_power; + UINT8 m_banks; + UINT8 m_clock_control; + UINT8 m_clock_divider; + UINT8 m_key_select; + + UINT8 *m_sysram[2]; + UINT16 m_sysram_size[2]; + UINT16 m_sysram_end[2]; + UINT16 m_sysram_mask[2]; + + void postload(); + void init_sysram(int chip, UINT16 size); + void update_lcd_indicator(UINT8 y, UINT8 x, int state); + void update_clock_divider(); + + DECLARE_READ8_MEMBER(sysram_r); + DECLARE_WRITE8_MEMBER(sysram_w); + DECLARE_READ8_MEMBER(bus_control_r); + DECLARE_WRITE8_MEMBER(bus_control_w); + DECLARE_WRITE8_MEMBER(power_w); + DECLARE_WRITE8_MEMBER(sound_w); + DECLARE_READ8_MEMBER(battery_r); + DECLARE_READ8_MEMBER(bankswitch_r); + DECLARE_WRITE8_MEMBER(bankswitch_w); + DECLARE_READ8_MEMBER(clock_control_r); + DECLARE_WRITE8_MEMBER(clock_control_w); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(keyboard_w); + + virtual void machine_reset(); + virtual void machine_start(); + DECLARE_PALETTE_INIT(cc40); + DECLARE_INPUT_CHANGED_MEMBER(sysram_size_changed); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cc40_cartridge); +}; + + + +/*************************************************************************** + + File Handling + +***************************************************************************/ + +DEVICE_IMAGE_LOAD_MEMBER(cc40_state, cc40_cartridge) +{ + UINT32 size = m_cart->common_get_size("rom"); + + // max size is 4*32KB + if (size > 0x20000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(0x20000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // allocate a larger ROM region to have 4x32K banks + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + + +/*************************************************************************** + + Video + +***************************************************************************/ + +PALETTE_INIT_MEMBER(cc40_state, cc40) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); // background + palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on + palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off +} + +void cc40_state::update_lcd_indicator(UINT8 y, UINT8 x, int state) +{ + // reference _________________... + // output# |10 11 12 13 14 0 1 2 3 4 + // above | < SHIFT CTL FN DEG RAD GRAD I/O UCL > + // ---- raw lcd screen here ---- + // under | ERROR v v v v v v _LOW + // output# | 60 61 62 63 50 51 52 53 + output_set_lamp_value(y * 10 + x, state); +} + +static HD44780_PIXEL_UPDATE(cc40_pixel_update) +{ + // char size is 5x7 + cursor + if (x > 4 || y > 7) + return; + + if (line == 1 && pos == 15) + { + // the last char is used to control the 18 lcd indicators + cc40_state *driver_state = device.machine().driver_data(); + driver_state->update_lcd_indicator(y, x, state); + } + else if (line < 2 && pos < 16) + { + // internal: 2*16, external: 1*31 + if (y == 7) y++; // the cursor is slightly below the character + bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; + } +} + + + +/*************************************************************************** + + I/O, Memory Maps + +***************************************************************************/ + +READ8_MEMBER(cc40_state::sysram_r) +{ + // read system ram, based on addressing configured in bus_control_w + if (offset < m_sysram_end[0] && m_sysram_size[0] != 0) + return m_sysram[0][offset & (m_sysram_size[0] - 1)]; + else if (offset < m_sysram_end[1] && m_sysram_size[1] != 0) + return m_sysram[1][(offset - m_sysram_end[0]) & (m_sysram_size[1] - 1)]; + else + return 0xff; +} + +WRITE8_MEMBER(cc40_state::sysram_w) +{ + // write system ram, based on addressing configured in bus_control_w + if (offset < m_sysram_end[0] && m_sysram_size[0] != 0) + m_sysram[0][offset & (m_sysram_size[0] - 1)] = data; + else if (offset < m_sysram_end[1] && m_sysram_size[1] != 0) + m_sysram[1][(offset - m_sysram_end[0]) & (m_sysram_size[1] - 1)] = data; +} + +READ8_MEMBER(cc40_state::bus_control_r) +{ + return m_bus_control; +} + +WRITE8_MEMBER(cc40_state::bus_control_w) +{ + // d0,d1: auto enable clock divider on cartridge memory access (d0: area 1, d1: area 2) + + // d2,d3: system ram addressing + // 00: 8K, 8K @ $1000-$2fff, $3000-$4fff + // 01: 8K, 2K @ $1000-$2fff, $3000-$37ff + // 10: 2K, 8K @ $1000-$17ff, $1800-$37ff + // 11: 2K, 2K @ $1000-$17ff, $1800-$1fff + int d2 = (data & 4) ? 0x0800 : 0x2000; + int d3 = (data & 8) ? 0x0800 : 0x2000; + m_sysram_end[0] = d3; + m_sysram_mask[0] = d3 - 1; + m_sysram_end[1] = d3 + d2; + m_sysram_mask[1] = d2 - 1; + + // d4,d5: cartridge memory addressing + // 00: 2K @ $5000-$57ff & $5800-$5fff + // 01: 8K @ $5000-$6fff & $7000-$8fff + // 10:16K @ $5000-$8fff & $9000-$cfff + // 11: 8K @ $1000-$2fff & $3000-$4fff - system ram is disabled + + // d6: auto enable clock divider on system rom access + + // d7: unused? + m_bus_control = data; +} + +WRITE8_MEMBER(cc40_state::power_w) +{ + // d0: power-on hold latch + m_power = data & 1; + + // stop running + if (!m_power) + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); +} + +WRITE8_MEMBER(cc40_state::sound_w) +{ + // d0: piezo control + m_dac->write_signed8((data & 1) ? 0x7f : 0); +} + +READ8_MEMBER(cc40_state::battery_r) +{ + // d0: low battery sense line (0 = low power) + return m_battery_inp->read(); +} + +READ8_MEMBER(cc40_state::bankswitch_r) +{ + return m_banks; +} + +WRITE8_MEMBER(cc40_state::bankswitch_w) +{ + // d0-d1: system rom bankswitch + membank("sysbank")->set_entry(data & 3); + + // d2-d3: cartridge 32KB page bankswitch + if (m_cart_rom) + membank("cartbank")->set_entry(data >> 2 & 3); + + m_banks = data & 0x0f; +} + +READ8_MEMBER(cc40_state::clock_control_r) +{ + return m_clock_control; +} + +void cc40_state::update_clock_divider() +{ + // 2.5MHz /3 to /17 in steps of 2 + m_clock_divider = (~m_clock_control & 7) * 2 + 1; + m_maincpu->set_clock_scale((m_clock_control & 8) ? (1.0 / (double)m_clock_divider) : 1); +} + +WRITE8_MEMBER(cc40_state::clock_control_w) +{ + // d0-d2: clock divider + // d3: enable clock divider always + // other bits: unused? + if (m_clock_control != (data & 0x0f)) + { + m_clock_control = data; + update_clock_divider(); + } +} + +READ8_MEMBER(cc40_state::keyboard_r) +{ + UINT8 ret = 0; + + // read selected keyboard rows + for (int i = 0; i < 8; i++) + { + if (m_key_select >> i & 1) + ret |= m_key_matrix[i]->read(); + } + + return ret; +} + +WRITE8_MEMBER(cc40_state::keyboard_w) +{ + // d(0-7): select keyboard column + m_key_select = data; +} + +static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, cc40_state ) + ADDRESS_MAP_UNMAP_HIGH + + AM_RANGE(0x0110, 0x0110) AM_READWRITE(bus_control_r, bus_control_w) + AM_RANGE(0x0111, 0x0111) AM_WRITE(power_w) + AM_RANGE(0x0112, 0x0112) AM_NOP // d0-d3: Hexbus data + AM_RANGE(0x0113, 0x0113) AM_NOP // d0: Hexbus available + AM_RANGE(0x0114, 0x0114) AM_NOP // d0,d1: Hexbus handshake + AM_RANGE(0x0115, 0x0115) AM_WRITE(sound_w) + AM_RANGE(0x0116, 0x0116) AM_READ(battery_r) + AM_RANGE(0x0119, 0x0119) AM_READWRITE(bankswitch_r, bankswitch_w) + AM_RANGE(0x011a, 0x011a) AM_READWRITE(clock_control_r, clock_control_w) + AM_RANGE(0x011e, 0x011f) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) + + AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE("sysram.0") + AM_RANGE(0x1000, 0x4fff) AM_READWRITE(sysram_r, sysram_w) + AM_RANGE(0x5000, 0xcfff) AM_ROMBANK("cartbank") + AM_RANGE(0xd000, 0xefff) AM_ROMBANK("sysbank") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( main_io_map, AS_IO, 8, cc40_state ) + AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(keyboard_r) + AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(keyboard_w) +ADDRESS_MAP_END + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +INPUT_CHANGED_MEMBER(cc40_state::sysram_size_changed) +{ + init_sysram((int)(FPTR)param, newval << 11); +} + +static INPUT_PORTS_START( cc40 ) + PORT_START("RAMSIZE") + PORT_CONFNAME( 0x07, 0x01, "RAM Chip 1") PORT_CHANGED_MEMBER(DEVICE_SELF, cc40_state, sysram_size_changed, (void *)0) + PORT_CONFSETTING( 0x00, "None" ) + PORT_CONFSETTING( 0x01, "2KB" ) + PORT_CONFSETTING( 0x04, "8KB" ) + PORT_CONFNAME( 0x70, 0x10, "RAM Chip 2") PORT_CHANGED_MEMBER(DEVICE_SELF, cc40_state, sysram_size_changed, (void *)1) + PORT_CONFSETTING( 0x00, "None" ) // note: invalid configuration, unless Chip 1 is also 0x00 + PORT_CONFSETTING( 0x10, "2KB" ) + PORT_CONFSETTING( 0x40, "8KB" ) + + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) + PORT_CONFSETTING( 0x00, "Low" ) + PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) + + // 8x8 keyboard matrix, RESET and ON buttons are not on it. Unused entries are not connected, but some might have a purpose for factory testing(?) + // The numpad number keys are shared with the ones on the main keyboard, also on the real machine. + // PORT_NAME lists functions under [SHIFT] as secondaries. + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("IN.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + + PORT_START("IN.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("IN.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("IN.4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_NAME("SPACE") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("IN.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("CLR UCL") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("LEFT DEL") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("RIGHT INS") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_NAME("UP PB") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_NAME("/") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("DOWN") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("IN.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("+") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) PORT_NAME("ENTER") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME("*") + + PORT_START("IN.7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("CTL") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("SHIFT") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("BREAK") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("RUN") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("FN") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_NAME("OFF") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +void cc40_state::machine_reset() +{ + m_power = 1; + + update_clock_divider(); + + address_space &space = m_maincpu->space(AS_PROGRAM); + bankswitch_w(space, 0, 0); +} + +void cc40_state::init_sysram(int chip, UINT16 size) +{ + if (m_sysram[chip] == NULL) + { + // init to largest possible + m_sysram[chip] = auto_alloc_array(machine(), UINT8, 0x2000); + save_pointer(NAME(m_sysram[chip]), 0x2000, chip); + + save_item(NAME(m_sysram_size[chip]), chip); + save_item(NAME(m_sysram_end[chip]), chip); + save_item(NAME(m_sysram_mask[chip]), chip); + } + + m_nvram[chip]->set_base(m_sysram[chip], size); + m_sysram_size[chip] = size; +} + +void cc40_state::postload() +{ + init_sysram(0, m_sysram_size[0]); + init_sysram(1, m_sysram_size[1]); + + update_clock_divider(); +} + +void cc40_state::machine_start() +{ + // init + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + membank("sysbank")->configure_entries(0, 4, memregion("system")->base(), 0x2000); + if (m_cart_rom) + membank("cartbank")->configure_entries(0, 4, m_cart_rom->base(), 0x8000); + else + membank("cartbank")->set_base(memregion("maincpu")->base() + 0x5000); + + m_nvram[0] = machine().device("sysram.1"); + m_nvram[1] = machine().device("sysram.2"); + init_sysram(0, 0x800); // default to 6KB + init_sysram(1, 0x800); // " + + address_space &space = m_maincpu->space(AS_PROGRAM); + bus_control_w(space, 0, 0); + bankswitch_w(space, 0, 0); + + // zerofill other + m_power = 0; + m_clock_control = 0; + m_key_select = 0; + + // register for savestates + save_item(NAME(m_bus_control)); + save_item(NAME(m_power)); + save_item(NAME(m_banks)); + save_item(NAME(m_clock_control)); + save_item(NAME(m_clock_divider)); + save_item(NAME(m_key_select)); + + machine().save().register_postload(save_prepost_delegate(FUNC(cc40_state::postload), this)); +} + +static MACHINE_CONFIG_START( cc40, cc40_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS70C20, XTAL_5MHz / 2) + MCFG_CPU_PROGRAM_MAP(main_map) + MCFG_CPU_IO_MAP(main_io_map) + + MCFG_NVRAM_ADD_0FILL("sysram.0") + MCFG_NVRAM_ADD_0FILL("sysram.1") + MCFG_NVRAM_ADD_0FILL("sysram.2") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) // arbitrary + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(6*31+1, 9*1+1+1) + MCFG_SCREEN_VISIBLE_AREA(0, 6*31, 0, 9*1+1) + MCFG_DEFAULT_LAYOUT(layout_cc40) + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(cc40_state, cc40) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 16) // 2*16 internal + MCFG_HD44780_PIXEL_UPDATE_CB(cc40_pixel_update) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_DAC_ADD("dac") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "cc40_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom,256") + MCFG_GENERIC_LOAD(cc40_state, cc40_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "cc40_cart") +MACHINE_CONFIG_END + + + +/*************************************************************************** + + ROM Definitions + +***************************************************************************/ + +ROM_START( cc40 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "tms70c20.bin", 0xf800, 0x0800, CRC(a21bf6ab) SHA1(3da8435ecbee143e7fa149ee8e1c92949bade1d8) ) // internal cpu rom + + ROM_REGION( 0x8000, "system", 0 ) + ROM_LOAD( "hn61256pc09.bin", 0x0000, 0x8000, CRC(f5322fab) SHA1(1b5c4052a53654363c458f75eac7a27f0752def6) ) // system rom, banked +ROM_END + + +COMP( 1983, cc40, 0, 0, cc40, cc40, driver_device, 0, "Texas Instruments", "Compact Computer 40", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/ccs2810.c b/src/mame/drivers/ccs2810.c new file mode 100644 index 00000000000..5a38e72d9d6 --- /dev/null +++ b/src/mame/drivers/ccs2810.c @@ -0,0 +1,382 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +CCS Model 2810 + +2009-12-11 Skeleton driver. +2011-06-02 Connected to a terminal + +Chips: INS8250N-B, Z80A, uPD2716D, 82S129. Crystals: 16 MHz, 1.8432MHz + +SYSTEM OPERATION: +Press Enter to start the system. +All commands are in uppercase. + +A Assign logical device +Dn,n Dump memory +E Punch End-of-File to paper tape +F Fill +G Go +H Hex arithmetic +I In +L Punch Leader to paper tape +M Move +O Out +Q Query logical devices +R Read a file from paper tape +S Edit memory +T Test memory +V Verify (compare 2 blocks of memory) +W Write a file to paper tape +X Examine Registers +Y Set Baud rate of i8250 +Z Zleep (lock terminal). Press control+G twice to unlock. + +***************************************************************************** + +CCS Model 2422B + +Chips: UB1793/MB8877, 3 proms and one eprom. Crystal = 16MHz + +SYSTEM OPERATION: +Same as above, plus some extra commands + +B Boot from floppy +L removed +P Set disk parameters e.g. P0 10 0 = drive A, 10 sectors per track, 1 sided +Q Set disk position for raw read/write e.g. Q6 0 9 = track 6, side 0, sector 9 +Rs f Read absolute disk data (set by P and Q) to memory range s to f +Ws f Write absolute disk data (set by P and Q) from memory range s to f + +ToDo: +- fdc hld_r() has no code behind it, to be written +- not sure of the polarities of some of the floppy/fdc signals (not documented) +- no obvious option to change the fdc clock +- currently hard coded for a 20cm drive, not sure how to option select drive sizes +- a few jumpers to be added +- the one disk that exists fails the test: + Incorrect layout on track 0 head 0, expected_size=41666, current_size=68144 + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +//#include "machine/ins8250.h" +#include "machine/terminal.h" +#include "machine/wd_fdc.h" + +#define TERMINAL_TAG "terminal" + +class ccs_state : public driver_device +{ +public: + ccs_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_fdc (*this, "fdc"), + m_floppy0(*this, "fdc:0") + { + } + + DECLARE_DRIVER_INIT(ccs2810); + DECLARE_DRIVER_INIT(ccs2422); + DECLARE_MACHINE_RESET(ccs); + DECLARE_READ8_MEMBER(port04_r); + DECLARE_READ8_MEMBER(port20_r); + DECLARE_READ8_MEMBER(port25_r); + DECLARE_READ8_MEMBER(port26_r); + DECLARE_READ8_MEMBER(port34_r); + DECLARE_WRITE8_MEMBER(port04_w); + DECLARE_WRITE8_MEMBER(port20_w); + DECLARE_WRITE8_MEMBER(port34_w); + DECLARE_WRITE8_MEMBER(port40_w); + DECLARE_WRITE8_MEMBER(kbd_put); +private: + UINT8 m_term_data; + UINT8 m_26_count; + bool m_ss; + bool m_dden; + bool m_dsize; + UINT8 m_ds; + floppy_image_device *m_floppy; + void fdc_intrq_w(bool state); + void fdc_drq_w(bool state); + required_device m_maincpu; + required_device m_terminal; + optional_device m_fdc; + optional_device m_floppy0; +}; + +static ADDRESS_MAP_START(ccs2810_mem, AS_PROGRAM, 8, ccs_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xf7ff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0xf800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ccs2810_io, AS_IO, 8, ccs_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x20, 0x20) AM_READWRITE(port20_r,port20_w) + AM_RANGE(0x25, 0x25) AM_READ(port25_r) + AM_RANGE(0x26, 0x26) AM_READ(port26_r) + //AM_RANGE(0x20, 0x27) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ccs2422_io, AS_IO, 8, ccs_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x04, 0x04) AM_READWRITE(port04_r,port04_w) + AM_RANGE(0x20, 0x20) AM_READWRITE(port20_r,port20_w) + AM_RANGE(0x25, 0x25) AM_READ(port25_r) + AM_RANGE(0x26, 0x26) AM_READ(port26_r) + AM_RANGE(0x30, 0x33) AM_DEVREADWRITE("fdc", mb8877_t, read, write) + AM_RANGE(0x34, 0x34) AM_READWRITE(port34_r,port34_w) + AM_RANGE(0x40, 0x40) AM_WRITE(port40_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ccs2810 ) +INPUT_PORTS_END + +//************************************* +// +// Keyboard +// +//************************************* +READ8_MEMBER( ccs_state::port20_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( ccs_state::port25_r ) +{ + return (m_term_data) ? 0x21 : 0x20; +} + +READ8_MEMBER( ccs_state::port26_r ) +{ + if (m_26_count) m_26_count--; + return m_26_count; +} + +WRITE8_MEMBER( ccs_state::port20_w ) +{ + m_terminal->write(space, 0, data & 0x7f); +} + +WRITE8_MEMBER( ccs_state::kbd_put ) +{ + m_term_data = data; +} + +#if 0 +static const ins8250_interface com_intf = +{ + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL +}; +#endif + +//************************************* +// +// Status / Control ports +// +//************************************* + +/* Status 1 +d0 : intrq +d1 : ds0 +d2 : ds1 +d3 : ds2 +d4 : ds3 +d5 : hld (1=head loaded) +d6 : autoboot (1=go to monitor) +d7 : drq +*/ + +READ8_MEMBER( ccs_state::port34_r ) +{ + //return (UINT8)m_drq | (m_ds << 1) | ((UINT8)fdc->hld_r() << 5) | 0x40 | ((UINT8)m_intrq << 7); + return (UINT8)m_fdc->drq_r() | (m_ds << 1) | 0x20 | 0x40 | ((UINT8)m_fdc->intrq_r() << 7); // hld_r doesn't do anything +} + +/* Status 2 +d0 : trk00 (1=trk00 on 20cm drive; 0=trk00 on 13cm drive) +d1 : drive size (0=20cm, 1=13cm) +d2 : wprt from drive (0=write protected) +d3 : /ss (1=side 0 is selected) +d4 : index hole = 0 +d5 : dden (1 = double density) +d6 : double (0 = a double-sided 20cm disk is in the drive) +d7 : drq +*/ + +READ8_MEMBER( ccs_state::port04_r ) +{ + bool trk00=1,wprt=0,dside=1; + int idx=1; + if (m_floppy) + { + trk00 = !m_floppy->trk00_r(); + wprt = !m_floppy->wpt_r(); + idx = m_floppy->idx_r()^1; + dside = m_floppy->twosid_r(); + } + return (UINT8)trk00 | 0 | ((UINT8)wprt << 2) | ((UINT8)m_ss << 3) | + idx << 4 | ((UINT8)m_dden << 5) | ((UINT8)dside << 6) | ((UINT8)m_fdc->drq_r() << 7); +} + +/* Control 1 +d0 : ds0 +d1 : ds1 +d2 : ds2 +d3 : ds3 +d4 : drive size (adjusts fdc clock) +d5 : mon (1=motor on) +d6 : dden +d7 : autowait (0=ignore drq) +*/ + +WRITE8_MEMBER( ccs_state::port34_w ) +{ + m_ds = data & 15; + m_dsize = BIT(data, 4); + m_dden = BIT(data, 6); + + m_floppy = NULL; + if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); + m_fdc->set_floppy(m_floppy); + m_fdc->dden_w(!m_dden); + + if (m_floppy) + { + m_floppy->mon_w(!BIT(data, 5)); + } +} + +/* Control 2 +d2 : remote eject for persci drive (1=eject) +d4 : fast seek mode (1=on) +d6 : /ss (0=side 1 selected) +d7 : rom enable (1=firmware enabled) +other bits not used +*/ + +WRITE8_MEMBER( ccs_state::port04_w ) +{ + m_ss = BIT(data, 6); + if (m_floppy) + m_floppy->ss_w(!m_ss); +} + + +//************************************* +// +// Machine +// +//************************************* +WRITE8_MEMBER( ccs_state::port40_w ) +{ + membank("bankr0")->set_entry( (data) ? 1 : 0); +} + +MACHINE_RESET_MEMBER( ccs_state, ccs ) +{ + membank("bankr0")->set_entry(0); // point at rom + membank("bankw0")->set_entry(0); // always write to ram + m_26_count = 0x41; + m_maincpu->set_state_int(Z80_PC, 0xf000); +} + +DRIVER_INIT_MEMBER( ccs_state, ccs2810 ) +{ + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(1, &main[0x0000]); + membank("bankr0")->configure_entry(0, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); +} + +DRIVER_INIT_MEMBER( ccs_state, ccs2422 ) +{ + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(1, &main[0x0000]); + membank("bankr0")->configure_entry(0, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); +} + +//************************************* +// +// Disk +// +//************************************* + +static SLOT_INTERFACE_START( ccs_floppies ) + SLOT_INTERFACE( "8sssd", FLOPPY_8_SSSD ) +SLOT_INTERFACE_END + + //SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) + +static MACHINE_CONFIG_START( ccs2810, ccs_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(ccs2810_mem) + MCFG_CPU_IO_MAP(ccs2810_io) + MCFG_MACHINE_RESET_OVERRIDE(ccs_state, ccs) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ccs_state, kbd_put)) + + /* Devices */ + //MCFG_INS8250_ADD( "ins8250", com_intf, XTAL_1_8432MHz ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ccs2422, ccs_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(ccs2810_mem) + MCFG_CPU_IO_MAP(ccs2422_io) + MCFG_MACHINE_RESET_OVERRIDE(ccs_state, ccs) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ccs_state, kbd_put)) + + /* Devices */ + MCFG_MB8877_ADD("fdc", XTAL_16MHz / 8) // UB1793 or MB8877 + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ccs_floppies, "8sssd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ccs2810 ) + ROM_REGION( 0x10800, "maincpu", 0 ) + ROM_LOAD( "ccs2810.u8", 0x10000, 0x0800, CRC(0c3054ea) SHA1(c554b7c44a61af13decb2785f3c9b33c6fc2bfce)) +ROM_END + +ROM_START( ccs2422 ) + ROM_REGION( 0x10800, "maincpu", 0 ) + ROM_LOAD( "2422.u24", 0x10000, 0x0800, CRC(6b47586b) SHA1(73ba779a659da4a1f0e22a3fa351a2b36d8456a0)) + + ROM_REGION( 0x300, "proms", 0 ) + ROM_LOAD_OPTIONAL( "2422.u23", 0x0000, 0x0100, CRC(b279cada) SHA1(6cc6e00ec49ba2245c8836d6f09266b09d6e7648)) + ROM_LOAD_OPTIONAL( "2422.u22", 0x0100, 0x0100, CRC(e41858bb) SHA1(0be53725032ebea16e32cb720f099551a357e761)) + ROM_LOAD_OPTIONAL( "2422.u21", 0x0200, 0x0100, NO_DUMP ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, ccs2810, 0, 0, ccs2810, ccs2810, ccs_state, ccs2810, "California Computer Systems", "CCS Model 2810 CPU card", MACHINE_NO_SOUND_HW) +COMP( 1980, ccs2422, ccs2810, 0, ccs2422, ccs2810, ccs_state, ccs2422, "California Computer Systems", "CCS Model 2422B FDC card", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/ccs300.c b/src/mame/drivers/ccs300.c new file mode 100644 index 00000000000..a0842350bd2 --- /dev/null +++ b/src/mame/drivers/ccs300.c @@ -0,0 +1,142 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + CCS Model 300 + + 2009-12-11 Skeleton driver. + +It requires a floppy disk to boot from. + +There's no info available on this system, however the bankswitching +appears to be the same as their other systems. + +Early on, it does a read from port F2. If bit 3 is low, the system becomes +a Model 400. + +Since IM2 is used, it is assumed there are Z80 peripherals on board. +There's unknown usage of ports 11 thru 1B, 34, and F0 thru F2. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class ccs300_state : public driver_device +{ +public: + ccs300_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_DRIVER_INIT(ccs300); + DECLARE_MACHINE_RESET(ccs300); + DECLARE_READ8_MEMBER(port10_r); + DECLARE_READ8_MEMBER(port11_r); + DECLARE_WRITE8_MEMBER(port10_w); + DECLARE_WRITE8_MEMBER(port40_w); + DECLARE_WRITE8_MEMBER(kbd_put); +private: + UINT8 m_term_data; + required_device m_maincpu; + required_device m_terminal; +}; + +static ADDRESS_MAP_START(ccs300_mem, AS_PROGRAM, 8, ccs300_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x0800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ccs300_io, AS_IO, 8, ccs300_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x10, 0x10) AM_READWRITE(port10_r,port10_w) + AM_RANGE(0x11, 0x11) AM_READ(port11_r) + AM_RANGE(0x40, 0x40) AM_WRITE(port40_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ccs300 ) +INPUT_PORTS_END + +//************************************* +// +// Keyboard +// +//************************************* +READ8_MEMBER( ccs300_state::port10_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( ccs300_state::port11_r ) +{ + return (m_term_data) ? 5 : 4; +} + +WRITE8_MEMBER( ccs300_state::port10_w ) +{ + m_terminal->write(space, 0, data & 0x7f); +} + +WRITE8_MEMBER( ccs300_state::kbd_put ) +{ + m_term_data = data; +} + +//************************************* +// +// Machine +// +//************************************* +WRITE8_MEMBER( ccs300_state::port40_w ) +{ + membank("bankr0")->set_entry( (data) ? 1 : 0); +} + +MACHINE_RESET_MEMBER( ccs300_state, ccs300 ) +{ + membank("bankr0")->set_entry(0); // point at rom + membank("bankw0")->set_entry(0); // always write to ram +} + +DRIVER_INIT_MEMBER( ccs300_state, ccs300 ) +{ + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(1, &main[0x0000]); + membank("bankr0")->configure_entry(0, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); +} + +static MACHINE_CONFIG_START( ccs300, ccs300_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(ccs300_mem) + MCFG_CPU_IO_MAP(ccs300_io) + MCFG_MACHINE_RESET_OVERRIDE(ccs300_state, ccs300) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ccs300_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ccs300 ) + ROM_REGION( 0x10800, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ccs300.rom", 0x10000, 0x0800, CRC(6cf22e31) SHA1(9aa3327cd8c23d0eab82cb6519891aff13ebe1d0)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, ccs300, ccs2810, 0, ccs300, ccs300, ccs300_state, ccs300, "California Computer Systems", "CCS Model 300", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/cd2650.c b/src/mame/drivers/cd2650.c new file mode 100644 index 00000000000..2e2b8e0d895 --- /dev/null +++ b/src/mame/drivers/cd2650.c @@ -0,0 +1,323 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Central Data cd2650 + +2010-04-08 Skeleton driver. + +No info available on this computer apart from a few newsletters. +The system only uses 1000-14FF for videoram and 17F0-17FF for +scratch ram. All other ram is optional. + +Commands (must be in uppercase): +A Examine memory; press C to alter memory +B Set breakpoint? +C View breakpoint? +D Dump to tape +E Execute +I ? +L Load +R ? +V Verify? +Press Esc to exit most commands. + +TODO +- Lots, probably. The computer is a complete mystery. No manuals or schematics exist. +- Cassette doesn't work. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/s2650/s2650.h" +#include "machine/keyboard.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "sound/beep.h" + +#define KEYBOARD_TAG "keyboard" + +class cd2650_state : public driver_device +{ +public: + cd2650_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_beep(*this, "beeper"), + m_cass(*this, "cassette") + { + } + + DECLARE_READ8_MEMBER(keyin_r); + DECLARE_WRITE8_MEMBER(beep_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(cass_r); + DECLARE_WRITE_LINE_MEMBER(cass_w); + DECLARE_QUICKLOAD_LOAD_MEMBER(cd2650); + const UINT8 *m_p_chargen; + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; + +private: + UINT8 m_term_data; + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; + required_device m_beep; + required_device m_cass; +}; + + +WRITE8_MEMBER( cd2650_state::beep_w ) +{ + if (data & 7) + m_beep->set_state(BIT(data, 3)); +} + +WRITE_LINE_MEMBER( cd2650_state::cass_w ) +{ + m_cass->output(state ? -1.0 : +1.0); +} + +READ8_MEMBER( cd2650_state::cass_r ) +{ + return (m_cass->input() > 0.03) ? 1 : 0; +} + +READ8_MEMBER( cd2650_state::keyin_r ) +{ + UINT8 ret = m_term_data; + m_term_data = ret | 0x80; + return ret; +} + +static ADDRESS_MAP_START(cd2650_mem, AS_PROGRAM, 8, cd2650_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x03ff) AM_ROM AM_REGION("roms", 0) + AM_RANGE( 0x1000, 0x7fff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cd2650_io, AS_IO, 8, cd2650_state) + ADDRESS_MAP_UNMAP_HIGH + //AM_RANGE(0x80, 0x84) disk i/o + AM_RANGE(S2650_DATA_PORT,S2650_DATA_PORT) AM_READWRITE(keyin_r, beep_w) + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( cd2650 ) +INPUT_PORTS_END + + +void cd2650_state::machine_reset() +{ + m_term_data = 0x80; + m_beep->set_frequency(950); /* guess */ + m_beep->set_state(0); +} + +void cd2650_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 cd2650_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +/* The video is unusual in that the characters in each line are spaced at 16 bytes in memory, + thus line 1 starts at 1000, line 2 at 1001, etc. There are 16 lines of 80 characters. + Further, the letters have bit 6 set low, thus the range is 01 to 1A. + When the bottom of the screen is reached, it does not scroll, it just wraps around. */ + + UINT16 offset = 0; + UINT8 y,ra,chr,gfx; + UINT16 sy=0,x,mem; + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 80; x++) + { + gfx = 0; + if ((ra) && (ra < 9)) + { + mem = offset + y + (x<<4); + + if (mem > 0x4ff) + mem -= 0x500; + + chr = m_p_videoram[mem] & 0x3f; + + gfx = m_p_chargen[(BITSWAP8(chr,7,6,2,1,0,3,4,5)<<3) | (ra-1) ]; + } + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout cd2650_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 192, /* 64 characters in char.rom + 128 characters in char2.rom */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( cd2650 ) + GFXDECODE_ENTRY( "chargen", 0x0000, cd2650_charlayout, 0, 1 ) +GFXDECODE_END + +WRITE8_MEMBER( cd2650_state::kbd_put ) +{ + if (data) + m_term_data = data; +} + +QUICKLOAD_LOAD_MEMBER( cd2650_state, cd2650 ) +{ + int i, result = IMAGE_INIT_FAIL; + + int quick_length = image.length(); + if (quick_length < 0x1500) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.message(" File too short"); + } + else + if (quick_length > 0x8000) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.message(" File too long"); + } + else + { + dynamic_buffer quick_data(quick_length); + int read_ = image.fread( &quick_data[0], quick_length); + if (read_ != quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.message(" Cannot read the file"); + } + else + if (quick_data[0] != 0x40) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.message(" Invalid header"); + } + else + { + int exec_addr = quick_data[1] * 256 + quick_data[2]; + + if (exec_addr >= quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.message(" Exec address beyond end of file"); + } + else + { + // do not overwite system area (17E0-17FF) otherwise chess3 has problems + read_ = 0x17e0; + if (quick_length < 0x17e0) + read_ = quick_length; + + for (i = 0x1500; i < read_; i++) + m_p_videoram[i-0x1000] = quick_data[i]; + + if (quick_length > 0x17ff) + for (i = 0x1800; i < quick_length; i++) + m_p_videoram[i-0x1000] = quick_data[i]; + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); + + // Start the quickload + m_maincpu->set_state_int(S2650_PC, exec_addr); + + result = IMAGE_INIT_PASS; + } + } + } + + return result; +} + +static MACHINE_CONFIG_START( cd2650, cd2650_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(cd2650_mem) + MCFG_CPU_IO_MAP(cd2650_io) + MCFG_S2650_FLAG_HANDLER(WRITELINE(cd2650_state, cass_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(cd2650_state, screen_update) + MCFG_SCREEN_SIZE(640, 160) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 159) + MCFG_SCREEN_PALETTE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", cd2650) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", cd2650_state, cd2650, "pgm", 1) + + /* Sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(cd2650_state, kbd_put)) + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( cd2650 ) + ROM_REGION( 0x0400, "roms", 0 ) + ROM_LOAD( "cd2650.rom", 0x0000, 0x0400, CRC(5397328e) SHA1(7106fdb60e1ad2bc5e8e45527f348c23296e8d6a)) + + ROM_REGION( 0x0600, "chargen", 0 ) + ROM_LOAD( "char.rom", 0x0000, 0x0200, CRC(9b75db2a) SHA1(4367c01afa503d7cba0c38078fde0b95392c6c2c)) + ROM_LOAD_OPTIONAL( "char2.rom", 0x0200, 0x0400, CRC(b450eea8) SHA1(c1bdba52c2dc5698cad03b6b884b942a083465ed)) // not used + + // various unused roms found on Amigan site + ROM_REGION( 0xc900, "user1", 0 ) + ROM_LOAD_OPTIONAL( "01a_cd_boots.bin", 0x0000, 0x0200, CRC(5336c62f) SHA1(e94cf7be01ea806ff7c7b90aee1a4e88f4f1ba9f)) + ROM_LOAD_OPTIONAL( "01a_cd_dos.bin", 0x0200, 0x2000, CRC(3f177cdd) SHA1(01afd77ad2f065158cbe032aa26682cb20afe7d8)) + ROM_LOAD_OPTIONAL( "01a_cd_pop.bin", 0x2200, 0x1000, CRC(d8f44f11) SHA1(605ab5a045290fa5b99ff4fc8fbfa2a3f202578f)) + ROM_LOAD_OPTIONAL( "01b_cd_alp.bin", 0x3200, 0x2a00, CRC(b05568bb) SHA1(29e74633c0cd731c0be25313288cfffdae374236)) + ROM_LOAD_OPTIONAL( "01b_cd_basic.bin", 0x5c00, 0x3b00, CRC(0cf1e3d8) SHA1(3421e679c238aeea49cd170b34a6f344da4770a6)) + ROM_LOAD_OPTIONAL( "01b_cd_mon_m.bin", 0x9700, 0x0400, CRC(f6f19c08) SHA1(1984d85d57fc2a6c5a3bd51fbc58540d7129a0ae)) + ROM_LOAD_OPTIONAL( "01b_cd_mon_o.bin", 0x9b00, 0x0400, CRC(9d40b4dc) SHA1(35cffcbd983b7b37c878a15af44100568d0659d1)) + ROM_LOAD_OPTIONAL( "02b_cd_alp.bin", 0x9f00, 0x2a00, CRC(a66b7f32) SHA1(2588f9244b0ec6b861dcebe666d37d3fa88dd043)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, cd2650, 0, 0, cd2650, cd2650, driver_device, 0, "Central Data", "CD 2650", 0 ) diff --git a/src/mame/drivers/cdc721.c b/src/mame/drivers/cdc721.c new file mode 100644 index 00000000000..0f89b5f2944 --- /dev/null +++ b/src/mame/drivers/cdc721.c @@ -0,0 +1,144 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/************************************************************************************************************ + +Control Data Corporation CDC 721 Terminal (Viking) + +2013-08-13 Skeleton + + +*************************************************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" + +class cdc721_state : public driver_device +{ +public: + cdc721_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_p_videoram(*this, "videoram") + , m_maincpu(*this, "maincpu") + { } + +public: + virtual void machine_reset(); + DECLARE_PALETTE_INIT(cdc721); + const UINT8 *m_p_chargen; + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; +private: + required_device m_maincpu; + + +}; + +static ADDRESS_MAP_START( cdc721_mem, AS_PROGRAM, 8, cdc721_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x4000, 0xf097) AM_RAM + AM_RANGE(0xf098, 0xffff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cdc721_io, AS_IO, 8, cdc721_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +static INPUT_PORTS_START( cdc721 ) +INPUT_PORTS_END + +void cdc721_state::machine_reset() +{ + m_p_chargen = memregion("chargen")->base(); +} + +/* F4 Character Displayer */ +static const gfx_layout cdc721_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0*8, 0x100*8, 0x200*8, 0x300*8, 0x400*8, 0x500*8, 0x600*8, 0x700*8, + 0x800*8, 0x900*8, 0xa00*8, 0xb00*8, 0xc00*8, 0xd00*8, 0xe00*8, 0xf00*8 }, + 8 /* every char takes 16 x 1 bytes */ +}; + +static GFXDECODE_START( cdc721 ) + GFXDECODE_ENTRY( "chargen", 0x0000, cdc721_charlayout, 0, 1 ) +GFXDECODE_END + +PALETTE_INIT_MEMBER( cdc721_state, cdc721 ) +{ + palette.set_pen_color(0, 0, 0, 0 ); /* Black */ + palette.set_pen_color(1, 0, 255, 0 ); /* Full */ + palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */ +} + +UINT32 cdc721_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 24; y++) + { + for (ra = 3; ra < 13; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 160; x+=2) + { + chr = m_p_videoram[x+ma]; + + gfx = m_p_chargen[chr | (ra << 8) ]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 0); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 7); + } + } + ma+=160; + } + return 0; +} + +static MACHINE_CONFIG_START( cdc721, cdc721_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(cdc721_mem) + MCFG_CPU_IO_MAP(cdc721_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(cdc721_state, screen_update) + MCFG_SCREEN_SIZE(640, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(cdc721_state, cdc721) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", cdc721) +MACHINE_CONFIG_END + +ROM_START( cdc721 ) + ROM_REGION( 0x6000, "maincpu", 0 ) + ROM_LOAD( "66315359", 0x0000, 0x2000, CRC(20ff3eb4) SHA1(5f15cb14893d75a46dc66d3042356bb054d632c2) ) + ROM_LOAD( "66315361", 0x2000, 0x2000, CRC(21d59d09) SHA1(9c087537d68c600ddf1eb9b009cf458231c279f4) ) + ROM_LOAD( "66315360", 0x4000, 0x1000, CRC(feaa0fc5) SHA1(f06196553a1f10c07b2f7e495823daf7ea26edee) ) // rom @ 4000 + ROM_LOAD( "66307828", 0x5000, 0x1000, CRC(ac97136f) SHA1(0d280e1aa4b9502bd390d260f83af19bf24905cd) ) // keyboard + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "66315039", 0x0000, 0x1000, CRC(5c9aa968) SHA1(3ec7c5f25562579e6ed3fda7562428ff5e6b9550) ) // chargen +ROM_END + +COMP( 1981, cdc721, 0, 0, cdc721, cdc721, driver_device, 0, "Control Data Corporation", "CDC721 Terminal", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/cfx9850.c b/src/mame/drivers/cfx9850.c new file mode 100644 index 00000000000..30ec1e78b4b --- /dev/null +++ b/src/mame/drivers/cfx9850.c @@ -0,0 +1,293 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + Driver for Casio CFX-9850 + +To operate: +The unit is switched off by default, you have to switch it on by pressing 'Q'. + +Currently (year2011) it is on by default, the only key that works is '\' +which turns it off. After that nothing happens. + +Debugging information: +1. g 10b3 (Initialise system) +2. cs=23 +3. ip= one of these: ip=d1a4,d1af,d1ba,d1c5,d1d0,d1db,d1ea,d1f9,d208,d217, + d226,d235,d244 +4. g 23108c to get a test pattern on the screen. + +***************************************************************************/ + +#include "emu.h" +#include "cpu/hcd62121/hcd62121.h" +#include "rendlay.h" + +class cfx9850_state : public driver_device +{ +public: + cfx9850_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_video_ram(*this, "video_ram"), + m_display_ram(*this, "display_ram"), + m_ko1(*this, "KO1"), + m_ko2(*this, "KO2"), + m_ko3(*this, "KO3"), + m_ko4(*this, "KO4"), + m_ko5(*this, "KO5"), + m_ko6(*this, "KO6"), + m_ko7(*this, "KO7"), + m_ko8(*this, "KO8"), + m_ko9(*this, "KO9"), + m_ko10(*this, "KO10"), + m_ko11(*this, "KO11"), + m_ko12(*this, "KO12") , + m_maincpu(*this, "maincpu") { } + + DECLARE_WRITE8_MEMBER(cfx9850_kol_w); + DECLARE_WRITE8_MEMBER(cfx9850_koh_w); + DECLARE_READ8_MEMBER(cfx9850_ki_r); + DECLARE_READ8_MEMBER(cfx9850_battery_level_r); + required_shared_ptr m_video_ram; + required_shared_ptr m_display_ram; + UINT16 m_ko; /* KO lines KO1 - KO14 */ + DECLARE_PALETTE_INIT(cfx9850); + UINT32 screen_update_cfx9850(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + required_ioport m_ko1; + required_ioport m_ko2; + required_ioport m_ko3; + required_ioport m_ko4; + required_ioport m_ko5; + required_ioport m_ko6; + required_ioport m_ko7; + required_ioport m_ko8; + required_ioport m_ko9; + required_ioport m_ko10; + required_ioport m_ko11; + required_ioport m_ko12; + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START( cfx9850, AS_PROGRAM, 8, cfx9850_state ) + AM_RANGE( 0x000000, 0x007fff ) AM_ROM + AM_RANGE( 0x080000, 0x0807ff ) AM_RAM AM_SHARE("video_ram") +// AM_RANGE( 0x100000, 0x10ffff ) /* some memory mapped i/o? */ +// AM_RANGE( 0x110000, 0x11ffff ) /* some memory mapped i/o? */ + AM_RANGE( 0x200000, 0x27ffff ) AM_ROM AM_REGION( "bios", 0 ) + AM_RANGE( 0x400000, 0x40ffff ) AM_RAM + AM_RANGE( 0x600000, 0x601fff ) AM_MIRROR(0xf800) AM_RAM AM_SHARE("display_ram") +// AM_RANGE( 0xe10000, 0xe1ffff ) /* some memory mapped i/o? */ +ADDRESS_MAP_END + + +WRITE8_MEMBER( cfx9850_state::cfx9850_kol_w ) +{ + m_ko = ( m_ko & 0xff00 ) | data; +} + +WRITE8_MEMBER( cfx9850_state::cfx9850_koh_w ) +{ + m_ko = ( m_ko & 0x00ff ) | ( data << 8 ); +} + + +READ8_MEMBER( cfx9850_state::cfx9850_ki_r ) +{ + UINT8 data = 0; + + if ( m_ko & ( 1 << 0 ) ) data |= m_ko1->read(); + if ( m_ko & ( 1 << 1 ) ) data |= m_ko2->read(); + if ( m_ko & ( 1 << 2 ) ) data |= m_ko3->read(); + if ( m_ko & ( 1 << 3 ) ) data |= m_ko4->read(); + if ( m_ko & ( 1 << 4 ) ) data |= m_ko5->read(); + if ( m_ko & ( 1 << 5 ) ) data |= m_ko6->read(); + if ( m_ko & ( 1 << 6 ) ) data |= m_ko7->read(); + if ( m_ko & ( 1 << 7 ) ) data |= m_ko8->read(); + if ( m_ko & ( 1 << 8 ) ) data |= m_ko9->read(); + if ( m_ko & ( 1 << 9 ) ) data |= m_ko10->read(); + if ( m_ko & ( 1 << 10 ) ) data |= m_ko11->read(); + if ( m_ko & ( 1 << 11 ) ) data |= m_ko12->read(); + + return data; +} + + +READ8_MEMBER( cfx9850_state::cfx9850_battery_level_r ) +{ + return 0x30; +} + + +static ADDRESS_MAP_START( cfx9850_io, AS_IO, 8, cfx9850_state ) + AM_RANGE( HCD62121_KOL, HCD62121_KOL ) AM_WRITE( cfx9850_kol_w ) + AM_RANGE( HCD62121_KOH, HCD62121_KOH ) AM_WRITE( cfx9850_koh_w ) + AM_RANGE( HCD62121_KI, HCD62121_KI ) AM_READ( cfx9850_ki_r ) + AM_RANGE( HCD62121_IN0, HCD62121_IN0 ) AM_READ( cfx9850_battery_level_r ) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( cfx9850 ) + PORT_START( "KO1" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "AC On/Off" ) PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO2" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXE Enter" ) PORT_CODE(KEYCODE_ENTER) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "(-) Ares" ) PORT_CODE(KEYCODE_MINUS) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXP Pi" ) PORT_CODE(KEYCODE_EQUALS) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ". SPACE" ) PORT_CODE(KEYCODE_SPACE) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "0 Z" ) PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO3" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "- ] Y" ) PORT_CODE(KEYCODE_Y) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "+ [ X" ) PORT_CODE(KEYCODE_X) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "3 W" ) PORT_CODE(KEYCODE_W) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "2 V" ) PORT_CODE(KEYCODE_V) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "1 U" ) PORT_CODE(KEYCODE_U) + PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO4" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "/ } T" ) PORT_CODE(KEYCODE_T) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "* { S" ) PORT_CODE(KEYCODE_S) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "6 R" ) PORT_CODE(KEYCODE_R) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "5 Q" ) PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "4 P" ) PORT_CODE(KEYCODE_P) + PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO5" ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "DEL DG" ) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "9 O" ) PORT_CODE(KEYCODE_O) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "8 N" ) PORT_CODE(KEYCODE_N) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "7 M" ) PORT_CODE(KEYCODE_M) + PORT_BIT( 0x87, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO6" ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "TAB L" ) PORT_CODE(KEYCODE_L) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ", K" ) PORT_CODE(KEYCODE_K) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ") x^-1 J" ) PORT_CODE(KEYCODE_J) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "( .. I" ) PORT_CODE(KEYCODE_I) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F<=>0 H" ) PORT_CODE(KEYCODE_H) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "a b/c G" ) PORT_CODE(KEYCODE_G) + PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO7" ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "tan tan^-1 F" ) PORT_CODE(KEYCODE_F) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "cos cas^-1 E" ) PORT_CODE(KEYCODE_E) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "sin sin^-1 D" ) PORT_CODE(KEYCODE_D) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "ln e^x C" ) PORT_CODE(KEYCODE_C) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "log 10^x B" ) PORT_CODE(KEYCODE_B) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "x,d,t A" ) PORT_CODE(KEYCODE_A) + PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO8" ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Right" ) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Down" ) PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXIT QUIT" ) PORT_CODE(KEYCODE_STOP) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "/\\ .. .." ) PORT_CODE(KEYCODE_COMMA) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "x^2 sqrt .." ) PORT_CODE(KEYCODE_SLASH) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "ALPHA ..-LOCK" ) PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO9" ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Up" ) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Left" ) PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "MENU SET UP" ) PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "VARS PRGM" ) PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "OPTN" ) PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "SHIFT" ) PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO10" ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F6 G<=>T" ) PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F5 G-Solv" ) PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F4 Sketch" ) PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F3 V-Window" ) PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F2 Zoom" ) PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F1 Trace" ) PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) + + /* KO11 is not connected */ + PORT_START( "KO11" ) + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "KO12" ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "TEST" ) PORT_CODE(KEYCODE_TILDE) + PORT_BIT( 0xf7, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +PALETTE_INIT_MEMBER(cfx9850_state, cfx9850) +{ + palette.set_pen_color( 0, 0xff, 0xff, 0xff ); + palette.set_pen_color( 1, 0x00, 0x00, 0xff ); + palette.set_pen_color( 2, 0x00, 0xff, 0x00 ); + palette.set_pen_color( 3, 0xff, 0x00, 0x00 ); +} + + +UINT32 cfx9850_state::screen_update_cfx9850(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 offset = 0; + + for ( int i = 0; i < 16; i++ ) + { + int x = 120 - i * 8; + + for ( int j = 0; j < 64; j++ ) + { + UINT8 data1 = m_display_ram[ offset ]; + UINT8 data2 = m_display_ram[ offset + 0x400 ]; + + for ( int b = 0; b < 8; b++ ) + { + bitmap.pix16(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); + data1 <<= 1; + data2 <<= 1; + } + + offset++; + } + } + + return 0; +} + + +static MACHINE_CONFIG_START( cfx9850, cfx9850_state ) + MCFG_CPU_ADD( "maincpu", HCD62121, 4300000 ) /* 4.3 MHz */ + MCFG_CPU_PROGRAM_MAP( cfx9850 ) + MCFG_CPU_IO_MAP( cfx9850_io ) + + MCFG_SCREEN_ADD( "screen", LCD ) + MCFG_SCREEN_REFRESH_RATE( 60 ) + MCFG_SCREEN_SIZE( 128, 64 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 127, 0, 63 ) + MCFG_SCREEN_UPDATE_DRIVER(cfx9850_state, screen_update_cfx9850) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* TODO: It uses a color display, but I'm being lazy here. 3 colour lcd */ + MCFG_PALETTE_ADD( "palette", 4 ) + MCFG_PALETTE_INIT_OWNER(cfx9850_state, cfx9850) +MACHINE_CONFIG_END + + +ROM_START( cfx9850 ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "hcd62121.bin", 0x0000, 0x8000, CRC(e72075f8) SHA1(f50d176e1c225dab69abfc67702c9dfb296b6a78) ) + + ROM_REGION( 0x80000, "bios", 0 ) + /* No idea yet which rom is what version. */ + ROM_SYSTEM_BIOS( 0, "rom1", "rom1, version unknown" ) + ROMX_LOAD( "cfx9850.bin", 0x00000, 0x80000, CRC(6c9bd903) SHA1(d5b6677ab4e0d3f84e5769e89e8f3d101f98f848), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "rom2", "rom2, version unknown" ) + ROMX_LOAD( "cfx9850b.bin", 0x00000, 0x80000, CRC(cd3c497f) SHA1(1d1aa38205eec7aba3ed6bef7389767e38afe075), ROM_BIOS(2) ) +ROM_END + + +COMP( 1996, cfx9850, 0, 0, cfx9850, cfx9850, driver_device, 0, "Casio", "CFX-9850G", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/cgc7900.c b/src/mame/drivers/cgc7900.c new file mode 100644 index 00000000000..55123f9be74 --- /dev/null +++ b/src/mame/drivers/cgc7900.c @@ -0,0 +1,448 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Chromatics CGC 7900 + + 05/04/2010 Skeleton driver. + +****************************************************************************/ + +/* + + TODO: + + - does not boot + - interrupts + - vsync interrupt + - map ROM to 000000-000007 at boot + - floppy + - bitmap display + - Z mode read/write + - color status write + - bitmap roll + - overlay roll + - keyboard + - joystick + - light pen + - memory parity + - sync + - disk DMA + - PIO DMA + - serial port controller + - HVG + - OMTI Series 10 SCSI controller (8" Winchester HD) + +*/ + +#include "includes/cgc7900.h" + + + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +#define INT_RTC 0x0001 +#define INT_RS449_TXRDY 0x0002 +#define INT_BINT2 0x0004 +#define INT_RS232_TXRDY 0x0008 +#define INT_DISK 0x0010 +#define INT_BINT3 0x0020 +#define INT_BEZEL 0x0040 +#define INT_KEYBOARD 0x0080 +#define INT_RS449_RXRDY 0x0100 +#define INT_LIGHT_PEN 0x0200 +#define INT_BINT4 0x0400 +#define INT_JOYSTICK 0x0800 +#define INT_VSYNC 0x1000 +#define INT_BINT5 0x2000 +#define INT_BINT1 0x4000 +#define INT_RS232_RXRDY 0x8000 + +//static const int INT_LEVEL[] = { 5, 4, 5, 4, 4, 5, 4, 5, 5, 4, 5, 4, 4, 5, 4, 5 }; + +/*************************************************************************** + READ/WRITE HANDLERS +***************************************************************************/ + +/*------------------------------------------------- + keyboard_r - keyboard data read +-------------------------------------------------*/ + +READ16_MEMBER( cgc7900_state::keyboard_r ) +{ + /* + + bit description + + 0 key data bit 0 + 1 key data bit 1 + 2 key data bit 2 + 3 key data bit 3 + 4 key data bit 4 + 5 key data bit 5 + 6 key data bit 6 + 7 key data bit 7 + 8 SHIFT key + 9 CTRL key + 10 M1 key + 11 M2 key + 12 + 13 + 14 + 15 + + */ + + return 0; +} + +/*------------------------------------------------- + keyboard_w - keyboard data write +-------------------------------------------------*/ + +WRITE16_MEMBER( cgc7900_state::keyboard_w ) +{ + /* + + bit description + + 0 LED select bit 0 + 1 LED select bit 1 + 2 LED select bit 2 + 3 LED select bit 3 + 4 LED select bit 4 + 5 + 6 + 7 LED switch (1=on, 0=off) + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + + */ +} + +/*------------------------------------------------- + interrupt_mask_w - interrupt mask write +-------------------------------------------------*/ + +WRITE16_MEMBER( cgc7900_state::interrupt_mask_w ) +{ + /* + + bit description + + 0 real time clock + 1 RS-449 Tx ready + 2 BINT 2 + 3 RS-232 Tx ready + 4 disk + 5 BINT 3 + 6 bezel keys + 7 keyboard + 8 RS-449 Rx ready + 9 light pen + 10 BINT 4 + 11 joystick + 12 vertical retrace + 13 BINT 5 + 14 BINT 1 + 15 RS-232 Rx ready + + */ + + m_int_mask = data; +} + +/*------------------------------------------------- + disk_data_r - disk data read +-------------------------------------------------*/ + +READ16_MEMBER( cgc7900_state::disk_data_r ) +{ + return 0; +} + +/*------------------------------------------------- + disk_data_w - disk data write +-------------------------------------------------*/ + +WRITE16_MEMBER( cgc7900_state::disk_data_w ) +{ +} + +/*------------------------------------------------- + disk_status_r - disk status read +-------------------------------------------------*/ + +READ16_MEMBER( cgc7900_state::disk_status_r ) +{ + /* + + bit signal description + + 0 _I/O input/output + 1 _REQ request + 2 _BSY busy + 3 C/_D control/data + 4 _MSG message + 5 _RDY ready + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + + */ + + return 0xffff - 0x04; +} + +/*------------------------------------------------- + disk_command_w - disk command write +-------------------------------------------------*/ + +WRITE16_MEMBER( cgc7900_state::disk_command_w ) +{ +} + +/*************************************************************************** + MEMORY MAPS +***************************************************************************/ + +/*------------------------------------------------- + ADDRESS_MAP( cgc7900_mem ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( cgc7900_mem, AS_PROGRAM, 16, cgc7900_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0) + AM_RANGE(0x000008, 0x1fffff) AM_RAM AM_SHARE("chrom_ram") + AM_RANGE(0x800000, 0x80ffff) AM_ROM AM_REGION(M68000_TAG, 0) + AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(z_mode_r, z_mode_w) + AM_RANGE(0xc00000, 0xdfffff) AM_RAM AM_SHARE("plane_ram") + AM_RANGE(0xe00000, 0xe1ffff) AM_WRITE(color_status_w) +// AM_RANGE(0xe20000, 0xe23fff) Raster Processor + AM_RANGE(0xe30000, 0xe303ff) AM_RAM AM_SHARE("clut_ram") + AM_RANGE(0xe38000, 0xe3bfff) AM_RAM AM_SHARE("overlay_ram") + AM_RANGE(0xe40000, 0xe40001) AM_RAM AM_SHARE("roll_bitmap") + AM_RANGE(0xe40002, 0xe40003) AM_RAM AM_SHARE("pan_x") + AM_RANGE(0xe40004, 0xe40005) AM_RAM AM_SHARE("pan_y") + AM_RANGE(0xe40006, 0xe40007) AM_RAM AM_SHARE("zoom") + AM_RANGE(0xe40008, 0xe40009) AM_RAM + AM_RANGE(0xe4000a, 0xe4000f) AM_RAM // Raster Processor + AM_RANGE(0xe40010, 0xe40011) AM_RAM AM_SHARE("blink_select") + AM_RANGE(0xe40012, 0xe40013) AM_RAM AM_SHARE("plane_select") + AM_RANGE(0xe40014, 0xe40015) AM_RAM AM_SHARE("plane_switch") + AM_RANGE(0xe40016, 0xe40017) AM_RAM AM_SHARE("color_status_fg") + AM_RANGE(0xe40018, 0xe40019) AM_RAM AM_SHARE("color_status_bg") + AM_RANGE(0xe4001a, 0xe4001b) AM_RAM AM_SHARE("roll_overlay") + AM_RANGE(0xe4001c, 0xe40fff) AM_RAM +// AM_RANGE(0xefc440, 0xefc441) HVG Load X +// AM_RANGE(0xefc442, 0xefc443) HVG Load Y +// AM_RANGE(0xefc444, 0xefc445) HVG Load dX +// AM_RANGE(0xefc446, 0xefc447) HVG Load dY +// AM_RANGE(0xefc448, 0xefc449) HVG Load Pixel Color +// AM_RANGE(0xefc44a, 0xefc44b) HVG Load Trip + AM_RANGE(0xff8000, 0xff8001) AM_DEVREADWRITE8(INS8251_0_TAG, i8251_device, data_r, data_w, 0xff00) + AM_RANGE(0xff8002, 0xff8003) AM_DEVREADWRITE8(INS8251_0_TAG, i8251_device, status_r, control_w, 0xff00) + AM_RANGE(0xff8040, 0xff8041) AM_DEVREADWRITE8(INS8251_1_TAG, i8251_device, data_r, data_w, 0xff00) + AM_RANGE(0xff8042, 0xff8043) AM_DEVREADWRITE8(INS8251_1_TAG, i8251_device, status_r, control_w, 0xff00) + AM_RANGE(0xff8080, 0xff8081) AM_READWRITE(keyboard_r, keyboard_w) +// AM_RANGE(0xff80c6, 0xff80c7) Joystick X axis +// AM_RANGE(0xff80ca, 0xff80cb) Joystick Y axis +// AM_RANGE(0xff80cc, 0xff80cd) Joystick Z axis + AM_RANGE(0xff8100, 0xff8101) AM_READWRITE(disk_data_r, disk_data_w) + AM_RANGE(0xff8120, 0xff8121) AM_READWRITE(disk_status_r, disk_command_w) + AM_RANGE(0xff8140, 0xff8141) AM_READ_PORT("BEZEL") +// AM_RANGE(0xff8180, 0xff8181) AM_DEVWRITE8(K1135A_TAG, k1135a_w, 0xff00) Baud rate generator +// AM_RANGE(0xff81c0, 0xff81ff) AM_DEVREADWRITE8(MM58167_TAG, mm58167_r, mm58167_w, 0xff00) + AM_RANGE(0xff8200, 0xff8201) AM_WRITE(interrupt_mask_w) +// AM_RANGE(0xff8240, 0xff8241) Light Pen enable +// AM_RANGE(0xff8242, 0xff8243) Light Pen X value +// AM_RANGE(0xff8244, 0xff8245) Light Pen Y value +// AM_RANGE(0xff8246, 0xff8247) Buffer memory parity check +// AM_RANGE(0xff8248, 0xff8249) Buffer memory parity set/reset + AM_RANGE(0xff824a, 0xff824b) AM_READ(sync_r) + AM_RANGE(0xff83c0, 0xff83c1) AM_DEVWRITE8(AY8910_TAG, ay8910_device, address_w, 0xff00) + AM_RANGE(0xff83c2, 0xff83c3) AM_DEVREAD8(AY8910_TAG, ay8910_device, data_r, 0xff00) + AM_RANGE(0xff83c4, 0xff83c5) AM_DEVWRITE8(AY8910_TAG, ay8910_device, data_w, 0xff00) +// AM_RANGE(0xff8500, 0xff8501) Disk DMA Command Register +// AM_RANGE(0xff8502, 0xff8503) Disk DMA Address Register +// AM_RANGE(0xff8507, 0xff8507) Disk DMA Control/Status Register +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( keyboard_mem ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( keyboard_mem, AS_PROGRAM, 8, cgc7900_state ) + AM_RANGE(0x000, 0x7ff) AM_ROM +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( keyboard_io ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( keyboard_io, AS_IO, 8, cgc7900_state ) +/* AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS)*/ +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/*------------------------------------------------- + INPUT_PORTS( cgc7900 ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( cgc7900 ) + PORT_START("BEZEL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 7") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 8") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 5") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 6") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 3") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 4") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 2") + + PORT_START("JOYSTICK_X") + PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_X ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) + + PORT_START("JOYSTICK_Y") + PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Y ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) + + PORT_START("JOYSTICK_Z") + PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Z ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) + + PORT_START("LIGHT_PEN_X") + PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0, 511) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) + + PORT_START("LIGHT_PEN_Y") + PORT_BIT( 0x1ff, 0x0c0, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 383) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) +INPUT_PORTS_END + + +/*************************************************************************** + MACHINE INITIALIZATION +***************************************************************************/ + +/*------------------------------------------------- + MACHINE_START( cgc7900 ) +-------------------------------------------------*/ + +void cgc7900_state::machine_start() +{ + /* register for state saving */ + save_pointer(NAME(m_overlay_ram.target()), 0x4000); +} + +void cgc7900_state::machine_reset() +{ +} + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +/*------------------------------------------------- + MACHINE_DRIVER( cgc7900 ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( cgc7900, cgc7900_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M68000_TAG, M68000, XTAL_28_48MHz/4) + MCFG_CPU_PROGRAM_MAP(cgc7900_mem) + + MCFG_CPU_ADD(I8035_TAG, I8035, 1000000) + MCFG_CPU_PROGRAM_MAP(keyboard_mem) + MCFG_CPU_IO_MAP(keyboard_io) + MCFG_DEVICE_DISABLE() + +/* MCFG_CPU_ADD(AM2910_TAG, AM2910, XTAL_17_36MHz) + MCFG_CPU_PROGRAM_MAP(omti10_mem)*/ + + /* video hardware */ + MCFG_FRAGMENT_ADD(cgc7900_video) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_28_48MHz/16) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(INS8251_0_TAG, I8251, 0) + // rs232 + + MCFG_DEVICE_ADD(INS8251_1_TAG, I8251, 0) + // rs449 +MACHINE_CONFIG_END + +/*************************************************************************** + ROMS +***************************************************************************/ + +ROM_START( cgc7900 ) + ROM_REGION16_BE( 0x10000, M68000_TAG, 0 ) + ROM_LOAD16_BYTE( "210274 800k even a3ee term 1.4.ue24", 0x0000, 0x1000, CRC(5fa8f368) SHA1(120dbcfedce0badd38bf5b23e1fbc99667eb286c) ) + ROM_LOAD16_BYTE( "210275 800k odd bbb3 term 1.4.uf24", 0x0001, 0x1000, CRC(4d479457) SHA1(5fa96a1eadfd9ba493d28691286e2e001a489a19) ) + ROM_LOAD16_BYTE( "210276 802k even 0c22 term 1.4.ue22", 0x2000, 0x1000, CRC(c88c44ec) SHA1(f39d8a3cf7aaefd815b4426348965b076c1f2265) ) + ROM_LOAD16_BYTE( "210277 802k odd b58c term 1.4.uf22", 0x2001, 0x1000, CRC(52ffe01f) SHA1(683aa71c2eb17b7ad639b888487db73d7684901a) ) + ROM_LOAD16_BYTE( "210278 804k even eaf4 term 1.4.ue21", 0x4000, 0x1000, CRC(7fe326db) SHA1(d39d05e008160fb8afa62e0d4cfb1d813f2296d4) ) + ROM_LOAD16_BYTE( "210279 804k odd 3f6d term 1.4.uf21", 0x4001, 0x1000, CRC(6c12d81c) SHA1(efe7c20e567c02b9c5b66a2d18e035d5f5f56b28) ) + ROM_LOAD16_BYTE( "210280 806k even 679d term 1.4.ue20", 0x6000, 0x1000, CRC(70930d74) SHA1(a5ab1c0bd8bd829408961107e01598cd71a97fec) ) + ROM_LOAD16_BYTE( "210281 1.4 806k odd sum 611e.uf20", 0x6001, 0x1000, CRC(8080aa2a) SHA1(c018a23e6f2158e2d63723cade0a3ad737090921) ) + ROM_LOAD16_BYTE( "su7700 210282 808k even opmod term 1.4 sum 2550.ue18", 0x8000, 0x1000, CRC(8f5834cd) SHA1(3cd03c82aa85c30cbc8e954f5a9fc4e9034f913b) ) + ROM_LOAD16_BYTE( "su7700 210283 808k odd opmod term 1.4 sum faca.uf18", 0x8001, 0x1000, CRC(e593b133) SHA1(6c641df844706e0d990b5fd544e98594171080a1) ) + ROM_LOAD16_BYTE( "210258 80ak even b2f6 mon 1.3.ue15", 0xa000, 0x1000, CRC(ec5a1250) SHA1(ffef73d35f172ac610b35bdf729d51eb6f9346ba) ) + ROM_LOAD16_BYTE( "210259 80ak odd cd66 mon 1.3.uf15", 0xa001, 0x1000, CRC(61eb43c6) SHA1(baaae0b787798147da453aac1f815589ea4ed921) ) + ROM_LOAD16_BYTE( "210244 80c even ce40 dos 1.6b.ue13", 0xc000, 0x1000, CRC(3b64e4cb) SHA1(71b28d160b101ea6165e602ff1c54272b7b30ece) ) + ROM_LOAD16_BYTE( "210245 80c odd 1ac3 dos 1.6b.uf13", 0xc001, 0x1000, CRC(0b6539ca) SHA1(d49e6d3307e5d634a412fd80b59492f31e29f7e0) ) + ROM_LOAD16_BYTE( "210290 idris even rel3 sum 0cce.ue12", 0xe000, 0x1000, CRC(07065772) SHA1(620ea5d55021e5c38efc010722ddbd852cd49e39) ) + ROM_LOAD16_BYTE( "210291 idris odd rel3 sum 5d11.uf12", 0xe001, 0x1000, CRC(d81b30da) SHA1(228f9b4e39d430ce4aaa81ea63f4516a51e6d001) ) + + ROM_REGION( 0x800, "i8035", 0 ) + ROM_LOAD( "keyboard controller i8035", 0x0000, 0x0800, NO_DUMP ) + + ROM_REGION( 0x800, "gfx1", 0 ) + ROM_LOAD( "norm chrset 4b40.ua13", 0x0000, 0x0400, CRC(55eb7b87) SHA1(768cea80597e7396d9e26f8cd09e6b480a526fce) ) + ROM_LOAD( "alt 46a7.ua14", 0x0400, 0x0400, CRC(be22b7e4) SHA1(83ef252c7fab33b4d3821a3049b89d044df35de8) ) + + ROM_REGION( 0x20, "proms", 0 ) + ROM_LOAD( "rp0a.ub8", 0x0000, 0x0020, NO_DUMP ) + ROM_LOAD( "rp1a.ub7", 0x0000, 0x0020, NO_DUMP ) + ROM_LOAD( "rp2a.ub9", 0x0000, 0x0020, NO_DUMP ) + ROM_LOAD( "ha-5.ub1", 0x0000, 0x0020, NO_DUMP ) + ROM_LOAD( "03c0.ua16", 0x0000, 0x0020, NO_DUMP ) + ROM_LOAD( "03c0.ua11", 0x0000, 0x0020, NO_DUMP ) + + /* OMTI Series 10 SCSI controller */ + ROM_REGION( 0x1400, AM2910_TAG, 0 ) + ROM_LOAD( "35 1.7b", 0x0000, 0x0400, NO_DUMP ) /* 82S137N */ + ROM_LOAD( "35 2.7b", 0x0400, 0x0400, NO_DUMP ) /* 82S137N */ + ROM_LOAD( "35 3.7b", 0x0800, 0x0400, NO_DUMP ) /* 82S137N */ + ROM_LOAD( "35 4.7b", 0x0c00, 0x0400, NO_DUMP ) /* 82S137N */ + ROM_LOAD( "35 5.7b", 0x1000, 0x0400, NO_DUMP ) /* 82S137N */ +ROM_END + +/*************************************************************************** + SYSTEM DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, cgc7900, 0, 0, cgc7900, cgc7900, driver_device, 0, "Chromatics", "CGC 7900", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/cgenie.c b/src/mame/drivers/cgenie.c new file mode 100644 index 00000000000..3a5776814da --- /dev/null +++ b/src/mame/drivers/cgenie.c @@ -0,0 +1,522 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + EACA Colour Genie EG2000 + + TODO: + - System is too fast, there should be one wait cycle every five cycles? + - What's the exact MC6845 type? It can't be H46505 + - Adjust visible area so that the borders aren't that large (needs + MC6845 changes) + - Verify BASIC and character set versions + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "video/mc6845.h" +#include "sound/ay8910.h" +#include "imagedev/cassette.h" +#include "formats/cgen_cas.h" +#include "bus/rs232/rs232.h" +#include "bus/cgenie/expansion/expansion.h" +#include "bus/cgenie/parallel/parallel.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class cgenie_state : public driver_device +{ +public: + cgenie_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_crtc(*this, "crtc"), + m_rs232(*this, "rs232"), + m_exp(*this, "exp"), + m_char_rom(*this, "gfx1"), + m_color_ram(*this, "colorram"), + m_font_ram(*this, "fontram"), + m_keyboard(*this, "KEY"), + m_palette(NULL), + m_control(0xff), + m_rs232_rx(1), + m_rs232_dcd(1) + {} + + DECLARE_DRIVER_INIT(cgenie_eu); + DECLARE_DRIVER_INIT(cgenie_nz); + + MC6845_BEGIN_UPDATE(crtc_begin_update); + MC6845_UPDATE_ROW(crtc_update_row); + + // 4-bit color ram + DECLARE_READ8_MEMBER(colorram_r); + DECLARE_WRITE8_MEMBER(colorram_w); + + // control port + DECLARE_WRITE8_MEMBER(control_w); + DECLARE_READ8_MEMBER(control_r); + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_INPUT_CHANGED_MEMBER(rst_callback); + + DECLARE_WRITE_LINE_MEMBER(rs232_rx_w); + DECLARE_WRITE_LINE_MEMBER(rs232_dcd_w); + +protected: + virtual void machine_start(); + +private: + required_device m_maincpu; + required_device m_cassette; + required_device m_ram; + required_device m_crtc; + required_device m_rs232; + required_device m_exp; + required_memory_region m_char_rom; + required_shared_ptr m_color_ram; + required_shared_ptr m_font_ram; + required_ioport_array<8> m_keyboard; + + static const rgb_t m_palette_bg[]; + static const rgb_t m_palette_eu[]; + static const rgb_t m_palette_nz[]; + + const rgb_t *m_palette; + rgb_t m_background_color; + + UINT8 m_control; + + int m_rs232_rx; + int m_rs232_dcd; +}; + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( cgenie_mem, AS_PROGRAM, 8, cgenie_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROM +// AM_RANGE(0x4000, 0xbfff) AM_RAM // set up in machine_start + AM_RANGE(0xc000, 0xefff) AM_NOP // cartridge space + AM_RANGE(0xf000, 0xf3ff) AM_READWRITE(colorram_r, colorram_w) AM_SHARE("colorram") + AM_RANGE(0xf400, 0xf7ff) AM_RAM AM_SHARE("fontram") + AM_RANGE(0xf800, 0xf8ff) AM_MIRROR(0x300) AM_READ(keyboard_r) + AM_RANGE(0xfc00, 0xffff) AM_NOP // cartridge space +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cgenie_io, AS_IO, 8, cgenie_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf8, 0xf8) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0xf9, 0xf9) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) + AM_RANGE(0xfa, 0xfa) AM_DEVWRITE("crtc", mc6845_1_device, address_w) + AM_RANGE(0xfb, 0xfb) AM_DEVREADWRITE("crtc", mc6845_1_device, register_r, register_w) + AM_RANGE(0xff, 0xff) AM_READWRITE(control_r, control_w) +ADDRESS_MAP_END + + +//************************************************************************** +// INPUTS +//************************************************************************** + +static INPUT_PORTS_START( cgenie ) + PORT_START("KEY.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("KEY.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + + PORT_START("KEY.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) // produces [ and { when pressed, not on keyboard + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + + PORT_START("KEY.4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("KEY.5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("KEY.7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mod Sel") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rpt") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L.P.") // marked as "L.P." in the manual, lightpen? + + PORT_START("RST") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F5) PORT_NAME("Rst") PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, cgenie_state, rst_callback, NULL) +INPUT_PORTS_END + + +//************************************************************************** +// KEYBOARD +//************************************************************************** + +READ8_MEMBER( cgenie_state::keyboard_r ) +{ + UINT8 data = 0; + + for (int i = 0; i < 8; i++) + if (BIT(offset, i)) + data |= m_keyboard[i]->read(); + + return data; +} + +INPUT_CHANGED_MEMBER( cgenie_state::rst_callback ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval); +} + + +//************************************************************************** +// CONTROL PORT & RS232 +//************************************************************************** + +WRITE8_MEMBER( cgenie_state::control_w ) +{ + // cassette output + m_cassette->output(BIT(data, 0) ? -1.0 : 1.0); + + // serial output + m_rs232->write_txd(BIT(data, 1)); + + // background color selection + if (BIT(data, 2)) + m_background_color = m_palette_bg[4]; + else + m_background_color = m_palette_bg[data >> 6 & 0x03]; + + // graphics/text mode switch + m_crtc->set_hpixels_per_column(BIT(data, 5) ? 4 : 8); + + m_control = data; +} + +READ8_MEMBER( cgenie_state::control_r ) +{ + UINT8 data = 0; + + data |= m_cassette->input() > 0 ? 1 : 0; + data |= m_rs232_rx << 1; + data |= m_rs232_dcd << 2; + + return data; +} + +WRITE_LINE_MEMBER( cgenie_state::rs232_rx_w ) +{ + m_rs232_rx = state; +} + +WRITE_LINE_MEMBER( cgenie_state::rs232_dcd_w ) +{ + m_rs232_dcd = state; +} + + +//************************************************************************** +// DRIVER INIT +//************************************************************************** + +DRIVER_INIT_MEMBER( cgenie_state, cgenie_eu ) +{ + m_palette = &m_palette_eu[0]; +} + +DRIVER_INIT_MEMBER( cgenie_state, cgenie_nz ) +{ + m_palette = &m_palette_nz[0]; +} + +void cgenie_state::machine_start() +{ + // setup ram + m_maincpu->space(AS_PROGRAM).install_ram(0x4000, 0x4000 + m_ram->size() - 1, m_ram->pointer()); + + // setup expansion bus + m_exp->set_program_space(&m_maincpu->space(AS_PROGRAM)); + m_exp->set_io_space(&m_maincpu->space(AS_IO)); +} + + +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +READ8_MEMBER( cgenie_state::colorram_r ) +{ + return m_color_ram[offset] | 0xf0; +} + +WRITE8_MEMBER( cgenie_state::colorram_w ) +{ + m_color_ram[offset] = data & 0x0f; +} + +MC6845_BEGIN_UPDATE( cgenie_state::crtc_begin_update ) +{ + bitmap.fill(m_background_color, cliprect); +} + +MC6845_UPDATE_ROW( cgenie_state::crtc_update_row ) +{ + // don't need to do anything in vblank + if (!de) + return; + + for (int column = 0; column < x_count; column++) + { + UINT8 code = m_ram->pointer()[ma + column]; + UINT8 color = m_color_ram[(ma & 0xbff) + column]; + + // gfx mode? + if (BIT(m_control, 5)) + { + const rgb_t map[] = { m_background_color, m_palette[8], m_palette[6], m_palette[5] }; + + bitmap.pix32(y + vbp, column * 4 + hbp + 0) = map[code >> 6 & 0x03]; + bitmap.pix32(y + vbp, column * 4 + hbp + 1) = map[code >> 4 & 0x03]; + bitmap.pix32(y + vbp, column * 4 + hbp + 2) = map[code >> 2 & 0x03]; + bitmap.pix32(y + vbp, column * 4 + hbp + 3) = map[code >> 0 & 0x03]; + } + else + { + UINT8 gfx = 0; + + // cursor visible? + if (cursor_x == column) + gfx = 0xff; + + // or use character rom? + else if ((code < 128) || (code < 192 && BIT(m_control, 4)) || (code > 192 && BIT(m_control, 3))) + gfx = m_char_rom->base()[(code << 3) | ra]; + + // or the programmable characters? + else + gfx = m_font_ram[((code << 3) | ra) & 0x3ff]; + + // 8 pixel chars + for (int p = 0; p < 8; p++) + bitmap.pix32(y + vbp, column * 8 + hbp + p) = BIT(gfx, 7 - p) ? m_palette[color] : m_background_color; + } + } +} + + +//************************************************************************** +// PALETTE +//************************************************************************** + +// how accurate are these colors? +const rgb_t cgenie_state::m_palette_bg[] = +{ + rgb_t::black, + rgb_t(0x70, 0x28, 0x20), // dark orange + rgb_t(0x28, 0x70, 0x20), // dark green + rgb_t(0x48, 0x48, 0x48), // dark gray + rgb_t(0x70, 0x00, 0x70) // dark purple +}; + +// european palette +const rgb_t cgenie_state::m_palette_eu[] = +{ + rgb_t(0x5e, 0x5e, 0x5e), // gray + rgb_t(0x11, 0xff, 0xea), // cyan + rgb_t(0xff, 0x00, 0x5e), // red + rgb_t(0xea, 0xea, 0xea), // white + rgb_t(0xff, 0xf9, 0x00), // yellow + rgb_t(0x6e, 0xff, 0x00), // green + rgb_t(0xff, 0x52, 0x00), // orange + rgb_t(0xea, 0xff, 0x00), // light yellow + rgb_t(0x02, 0x48, 0xff), // blue + rgb_t(0x8e, 0xd4, 0xff), // light blue + rgb_t(0xff, 0x12, 0xff), // pink + rgb_t(0x88, 0x43, 0xff), // purple + rgb_t(0x8c, 0x8c, 0x8c), // light gray + rgb_t(0x00, 0xfb, 0x8c), // turquoise + rgb_t(0xd2, 0x00, 0xff), // magenta + rgb_t::white // bright white +}; + +// new zealand palette +const rgb_t cgenie_state::m_palette_nz[] = +{ + rgb_t::white, + rgb_t(0x12, 0xff, 0xff), + rgb_t(0xff, 0x6f, 0xff), + rgb_t(0x31, 0x77, 0xff), + rgb_t(0xff, 0xcb, 0x00), + rgb_t(0x6e, 0xff, 0x00), + rgb_t(0xff, 0x52, 0x00), + rgb_t(0x5e, 0x5e, 0x5e), + rgb_t(0xea, 0xea, 0xea), + rgb_t(0x00, 0xff, 0xdd), + rgb_t(0xd2, 0x00, 0xff), + rgb_t(0x02, 0x48, 0xff), + rgb_t(0xff, 0xf9, 0x00), + rgb_t(0x00, 0xda, 0x00), + rgb_t(0xff, 0x22, 0x00), + rgb_t::black +}; + + +//************************************************************************** +// MACHINE DEFINTIONS +//************************************************************************** + +static MACHINE_CONFIG_START( cgenie, cgenie_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, XTAL_17_73447MHz / 8) // 2.2168 MHz + MCFG_CPU_PROGRAM_MAP(cgenie_mem) + MCFG_CPU_IO_MAP(cgenie_io) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_17_73447MHz / 2, 568, 32, 416, 312, 28, 284) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + + MCFG_MC6845_ADD("crtc", MC6845_1, "screen", XTAL_17_73447MHz / 16) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_BEGIN_UPDATE_CB(cgenie_state, crtc_begin_update) + MCFG_MC6845_UPDATE_ROW_CB(cgenie_state, crtc_update_row) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_17_73447MHz / 8) + MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("par", parallel_slot_device, pa_r)) + MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("par", parallel_slot_device, pa_w)) + MCFG_AY8910_PORT_B_READ_CB(DEVREAD8("par", parallel_slot_device, pb_r)) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("par", parallel_slot_device, pb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(cgenie_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) + MCFG_CASSETTE_INTERFACE("cgenie_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "cgenie_cass") + + // serial port + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(WRITELINE(cgenie_state, rs232_rx_w)) + MCFG_RS232_DCD_HANDLER(WRITELINE(cgenie_state, rs232_dcd_w)) + + // cartridge expansion slot + MCFG_EXPANSION_SLOT_ADD("exp") + MCFG_EXPANSION_SLOT_INT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + // parallel slot + MCFG_PARALLEL_SLOT_ADD("par") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K") +MACHINE_CONFIG_END + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( cgenie ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_LOAD("cg_rom1.z1", 0x0000, 0x1000, CRC(d3369420) SHA1(fe7f06f8e2b648d695d4787d00a374d3e4ac5d39)) + ROM_LOAD("cg_rom2.z2", 0x1000, 0x1000, CRC(73d2c9ea) SHA1(343d595b4eeaea627f9c36d5cef3827c79593425)) + ROM_LOAD("cg_rom3.z3", 0x2000, 0x1000, CRC(3f358811) SHA1(6ba151759fd8fd367806cf2dd5f1dfc33ee9521f)) + ROM_LOAD("cg_rom4.z4", 0x3000, 0x1000, CRC(be235782) SHA1(d7d61208a9855ffd09ecb051618f5ed6a8816f3f)) + + ROM_REGION(0x0800, "gfx1", 0) + // this is a "german" character set with umlauts, is this official? + ROM_LOAD("cgenieg.fnt", 0x0000, 0x0800, CRC(c3e60d57) SHA1(fb96f608fdb47391145fdcd614a9c7a79756e6a4)) + // default character set + ROM_LOAD("cgenie1.fnt", 0x0000, 0x0800, CRC(4fed774a) SHA1(d53df8212b521892cc56be690db0bb474627d2ff)) +ROM_END + +ROM_START( cgenienz ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "old", "Old ROM") + ROMX_LOAD("cg-basic-rom-v1-pal-en.rom", 0x0000, 0x4000, CRC(844aaedd) SHA1(b7f984bc5cd979c7ad11ff909e8134f694aea7aa), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "new", "New ROM") + ROMX_LOAD("cgromv2.rom", 0x0000, 0x4000, CRC(cfb84e09) SHA1(e199e4429bab6f9fca2bb05e71324538928a693a), ROM_BIOS(2)) + + ROM_REGION(0x0800, "gfx1", 0) + ROM_LOAD("cgenie1.fnt", 0x0000, 0x0800, CRC(4fed774a) SHA1(d53df8212b521892cc56be690db0bb474627d2ff)) +ROM_END + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1982, cgenie, 0, 0, cgenie, cgenie, cgenie_state, cgenie_eu, "EACA", "Colour Genie EG2000", 0) +COMP( 1982, cgenienz, cgenie, 0, cgenie, cgenie, cgenie_state, cgenie_nz, "EACA", "Colour Genie EG2000 (New Zealand)", 0) diff --git a/src/mame/drivers/channelf.c b/src/mame/drivers/channelf.c new file mode 100644 index 00000000000..65cff8a5a96 --- /dev/null +++ b/src/mame/drivers/channelf.c @@ -0,0 +1,349 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle +/****************************************************************** + * + * Fairchild Channel F driver + * + * Juergen Buchmueller + * Frank Palazzolo + * Sean Riddle + * + * Fredric "e5frog" Blaoholtz, added support large cartridges + * also spanning from $3000 to $FFFF. Added clones + * Fabio "etabeta" Priuli, moved carts to be slot devices + * + ******************************************************************/ + +#include "includes/channelf.h" + +#ifndef VERBOSE +#define VERBOSE 0 +#endif + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +#define MASTER_CLOCK_PAL 2000000 /* PAL unit has a separate crystal at 4.000 MHz */ +#define PAL_VBLANK_TIME 4623 + + +/* The F8 has latches on its port pins + * These mimic's their behavior + * [0]=port0, [1]=port1, [2]=port4, [3]=port5 + * + * Note: this should really be moved into f8.c, + * but it's complicated by possible peripheral usage. + * + * If the read/write operation is going external to the F3850 + * (or F3853, etc.), then the latching applies. However, relaying the + * port read/writes from the F3850 to a peripheral like the F3853 + * should not be latched in this way. (See mk1 driver) + * + * The f8 cannot determine how its ports are mapped at runtime, + * so it can't easily decide to latch or not. + * + * ...so it stays here for now. + */ + +UINT8 channelf_state::port_read_with_latch(UINT8 ext, UINT8 latch_state) +{ + return (~ext | latch_state); +} + +READ8_MEMBER( channelf_state::port_0_r ) +{ + return port_read_with_latch(ioport("PANEL")->read(), m_latch[0]); +} + +READ8_MEMBER( channelf_state::port_1_r ) +{ + UINT8 ext_value; + + if ((m_latch[0] & 0x40) == 0) + ext_value = ioport("RIGHT_C")->read(); + else + ext_value = 0xc0 | ioport("RIGHT_C")->read(); + + return port_read_with_latch(ext_value,m_latch[1]); +} + +READ8_MEMBER( channelf_state::port_4_r ) +{ + UINT8 ext_value; + + if ((m_latch[0] & 0x40) == 0) + ext_value = ioport("LEFT_C")->read(); + else + ext_value = 0xff; + + return port_read_with_latch(ext_value,m_latch[2]); +} + +READ8_MEMBER( channelf_state::port_5_r ) +{ + return port_read_with_latch(0xff, m_latch[3]); +} + +WRITE8_MEMBER( channelf_state::port_0_w ) +{ + int offs; + + m_latch[0] = data; + + if (data & 0x20) + { + offs = m_row_reg*128+m_col_reg; + m_p_videoram[offs] = m_val_reg; + } +} + +WRITE8_MEMBER( channelf_state::port_1_w ) +{ + m_latch[1] = data; + m_val_reg = ((data ^ 0xff) >> 6) & 0x03; +} + +WRITE8_MEMBER( channelf_state::port_4_w ) +{ + m_latch[2] = data; + m_col_reg = (data | 0x80) ^ 0xff; +} + +WRITE8_MEMBER( channelf_state::port_5_w ) +{ + m_latch[3] = data; + m_custom->sound_w((data>>6)&3); + m_row_reg = (data | 0xc0) ^ 0xff; +} + +static ADDRESS_MAP_START( channelf_map, AS_PROGRAM, 8, channelf_state ) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0xffff) AM_DEVREAD("cartslot", channelf_cart_slot_device, read_rom) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( channelf_io, AS_IO, 8, channelf_state ) + AM_RANGE(0x00, 0x00) AM_READWRITE(port_0_r, port_0_w) /* Front panel switches */ + AM_RANGE(0x01, 0x01) AM_READWRITE(port_1_r, port_1_w) /* Right controller */ + AM_RANGE(0x04, 0x04) AM_READWRITE(port_4_r, port_4_w) /* Left controller */ + AM_RANGE(0x05, 0x05) AM_READWRITE(port_5_r, port_5_w) +ADDRESS_MAP_END + + + +static INPUT_PORTS_START( channelf ) + PORT_START("PANEL") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("TIME (Button 1)") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("HOLD (Button 2)") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MODE (Button 3)") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("START (Button 4)") PORT_CODE(KEYCODE_4) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("RIGHT_C") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("P1 Twist Counterclockwise") PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("P1 Twist Clockwise")PORT_PLAYER(1) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("P1 Pull Up") PORT_PLAYER(1) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P1 Push Down") PORT_PLAYER(1) + + PORT_START("LEFT_C") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("P2 Twist Counterclockwise") PORT_PLAYER(2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("P2 Twist Clockwise")PORT_PLAYER(2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("P2 Pull Up") PORT_PLAYER(2) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P2 Push Down") PORT_PLAYER(2) +INPUT_PORTS_END + + +void channelf_state::machine_start() +{ + if (m_cart->exists()) + { + switch (m_cart->get_type()) + { + case CF_MAZE: + m_maincpu->space(AS_IO).install_readwrite_handler(0x24, 0x25, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); + break; + case CF_HANGMAN: + m_maincpu->space(AS_IO).install_readwrite_handler(0x20, 0x21, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); + break; + case CF_CHESS: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); + break; + case CF_MULTI: + case CF_MULTI_OLD: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x3000, 0x3fff, write8_delegate(FUNC(channelf_cart_slot_device::write_bank),(channelf_cart_slot_device*)m_cart)); + break; + } + + m_cart->save_ram(); + } +} + +static SLOT_INTERFACE_START(cf_cart) + SLOT_INTERFACE_INTERNAL("std", CHANF_ROM_STD) + SLOT_INTERFACE_INTERNAL("maze", CHANF_ROM_MAZE) + SLOT_INTERFACE_INTERNAL("hangman", CHANF_ROM_HANGMAN) + SLOT_INTERFACE_INTERNAL("chess", CHANF_ROM_CHESS) + SLOT_INTERFACE_INTERNAL("multi_old",CHANF_ROM_MULTI_OLD) + SLOT_INTERFACE_INTERNAL("multi", CHANF_ROM_MULTI_FINAL) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_FRAGMENT( channelf_cart ) + /* cartridge */ + MCFG_CHANNELF_CARTRIDGE_ADD("cartslot", cf_cart, NULL) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","channelf") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( channelf, channelf_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", F8, 3579545/2) /* Colorburst/2 */ + MCFG_CPU_PROGRAM_MAP(channelf_map) + MCFG_CPU_IO_MAP(channelf_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(128, 64) + MCFG_SCREEN_VISIBLE_AREA(4, 112 - 7, 4, 64 - 3) + MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(channelf_state, channelf) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("custom", CHANNELF_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_FRAGMENT_ADD( channelf_cart ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( sabavdpl, channelf_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", F8, MASTER_CLOCK_PAL) /* PAL speed */ + MCFG_CPU_PROGRAM_MAP(channelf_map) + MCFG_CPU_IO_MAP(channelf_io) + MCFG_QUANTUM_TIME(attotime::from_hz(50)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(PAL_VBLANK_TIME)) /* approximate */ + MCFG_SCREEN_SIZE(128, 64) + MCFG_SCREEN_VISIBLE_AREA(4, 112 - 7, 4, 64 - 3) + MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(channelf_state, channelf) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("custom", CHANNELF_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_FRAGMENT_ADD( channelf_cart ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( channlf2, channelf_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", F8, 3579545/2) /* Colorburst / 2 */ + MCFG_CPU_PROGRAM_MAP(channelf_map) + MCFG_CPU_IO_MAP(channelf_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(128, 64) + MCFG_SCREEN_VISIBLE_AREA(4, 112 - 7, 4, 64 - 3) + MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(channelf_state, channelf) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("custom", CHANNELF_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_FRAGMENT_ADD( channelf_cart ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( sabavpl2, channelf_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", F8, MASTER_CLOCK_PAL) /* PAL speed */ + MCFG_CPU_PROGRAM_MAP(channelf_map) + MCFG_CPU_IO_MAP(channelf_io) + MCFG_QUANTUM_TIME(attotime::from_hz(50)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(PAL_VBLANK_TIME)) /* not accurate */ + MCFG_SCREEN_SIZE(128, 64) + MCFG_SCREEN_VISIBLE_AREA(4, 112 - 7, 4, 64 - 3) + MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(channelf_state, channelf) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("custom", CHANNELF_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_FRAGMENT_ADD( channelf_cart ) +MACHINE_CONFIG_END + +ROM_START( channelf ) + ROM_REGION(0x10000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "sl90025", "Luxor Video Entertainment System" ) + ROMX_LOAD("sl90025.rom", 0x0000, 0x0400, CRC(015c1e38) SHA1(759e2ed31fbde4a2d8daf8b9f3e0dffebc90dae2), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "sl31253", "Channel F" ) + ROMX_LOAD("sl31253.rom", 0x0000, 0x0400, CRC(04694ed9) SHA1(81193965a374d77b99b4743d317824b53c3e3c78), ROM_BIOS(2)) + ROM_LOAD("sl31254.rom", 0x0400, 0x0400, CRC(9c047ba3) SHA1(8f70d1b74483ba3a37e86cf16c849d601a8c3d2c)) + ROM_REGION(0x2000, "vram", ROMREGION_ERASE00) +ROM_END + +#define rom_sabavdpl rom_channelf +#define rom_luxorves rom_channelf +#define rom_channlf2 rom_channelf +#define rom_sabavdpl rom_channelf +#define rom_sabavpl2 rom_channelf +#define rom_luxorvec rom_channelf +#define rom_itttelma rom_channelf +#define rom_ingtelma rom_channelf + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1976, channelf, 0, 0, channelf, channelf, driver_device, 0, "Fairchild", "Channel F", 0 ) +CONS( 1977, sabavdpl, channelf, 0, sabavdpl, channelf, driver_device, 0, "SABA", "SABA Videoplay", 0 ) +CONS( 197?, luxorves, channelf, 0, sabavdpl, channelf, driver_device, 0, "Luxor", "Luxor Video Entertainment System", 0 ) +CONS( 1978, channlf2, 0, channelf, channlf2, channelf, driver_device, 0, "Fairchild", "Channel F II", 0 ) +CONS( 1978, sabavpl2, channlf2, 0, sabavpl2, channelf, driver_device, 0, "SABA", "SABA Videoplay 2", 0 ) +CONS( 197?, luxorvec, channlf2, 0, sabavpl2, channelf, driver_device, 0, "Luxor", "Luxor Video Entertainment Computer", 0 ) +CONS( 197?, itttelma, channlf2, 0, sabavpl2, channelf, driver_device, 0, "ITT", "ITT Tele-Match Processor", 0 ) +CONS( 1978, ingtelma, channlf2, 0, sabavpl2, channelf, driver_device, 0, "Ingelen", "Ingelen Tele-Match Processor", 0 ) diff --git a/src/mame/drivers/chaos.c b/src/mame/drivers/chaos.c new file mode 100644 index 00000000000..7c0c72ae3ac --- /dev/null +++ b/src/mame/drivers/chaos.c @@ -0,0 +1,164 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Chaos2 + + 08/04/2010 Skeleton driver. + 19/05/2012 Connected to a terminal, system is usable [Robbbert] + + This is a homebrew system: http://koo.corpus.cam.ac.uk/chaos/ + + There are no schematics or manuals, so the results might not be + totally accurate. + + With the DOS config switch turned off, the only accepted input + is a line starting with '&'. The actual commands are unknown. + + With DOS enabled, a large number of commands become available. + These are: + access, ask, ascdis, bpclr, bpset, close, control, copy, devfive, dir, + end, exec, execute, fill, find, goto, if, input, let, list, load, lowercase, + memdis, memset, open, port, read, reboot, runhex, run, save, type, typesl, + verify. + An example is: memdis 0 f + Don't try 'fill' - it fills all memory with zeroes, crashing the system. + + ToDo: + - Connect up floppy disk (no info available on this) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/s2650/s2650.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class chaos_state : public driver_device +{ +public: + chaos_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_terminal(*this, TERMINAL_TAG), + m_p_ram(*this, "p_ram") , + m_maincpu(*this, "maincpu") + { + } + + DECLARE_READ8_MEMBER(port1e_r); + DECLARE_WRITE8_MEMBER(port1f_w); + DECLARE_READ8_MEMBER(port90_r); + DECLARE_READ8_MEMBER(port91_r); + DECLARE_WRITE8_MEMBER(port92_w); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_term_data; + virtual void machine_reset(); + required_device m_terminal; + required_shared_ptr m_p_ram; + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START( chaos_mem, AS_PROGRAM, 8, chaos_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_RAM AM_SHARE("p_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( chaos_io, AS_IO, 8, chaos_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x1e, 0x1e) AM_READ(port1e_r) + AM_RANGE(0x1f, 0x1f) AM_READWRITE(port90_r, port1f_w) + AM_RANGE(0x90, 0x90) AM_READ(port90_r) + AM_RANGE(0x91, 0x91) AM_READ(port91_r) + AM_RANGE(0x92, 0x92) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x101, 0x103) AM_NOP // stops error log filling up while using debug +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( chaos ) + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x00, "Enable DOS") + PORT_CONFSETTING( 0x01, DEF_STR(No)) + PORT_CONFSETTING( 0x00, DEF_STR(Yes)) +INPUT_PORTS_END + + +// Port 1E - Bit 0 indicates key pressed, Bit 1 indicates ok to output + +READ8_MEMBER( chaos_state::port1e_r ) +{ + return (m_term_data) ? 1 : 0; +} + +WRITE8_MEMBER( chaos_state::port1f_w ) +{ + // make the output readable on our terminal + if (data == 0x09) + return; + else + if (!data) + data = 0x24; + + m_terminal->write(space, 0, data); + + if (data == 0x0d) + m_terminal->write(space, 0, 0x0a); +} + +READ8_MEMBER( chaos_state::port90_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +// Status port +// Bit 0 = L use ports 1E & 1F; H use ports 90 & 92 +// Bit 3 = key pressed +// Bit 7 = ok to output + +READ8_MEMBER( chaos_state::port91_r ) +{ + UINT8 ret = 0x80 | ioport("CONFIG")->read(); + ret |= (m_term_data) ? 8 : 0; + return ret; +} + +WRITE8_MEMBER( chaos_state::kbd_put ) +{ + m_term_data = data; +} + +void chaos_state::machine_reset() +{ + // copy the roms into ram + UINT8* ROM = memregion("maincpu")->base(); + memcpy(m_p_ram, ROM, 0x3000); + memcpy(m_p_ram+0x7000, ROM+0x7000, 0x1000); +} + +static MACHINE_CONFIG_START( chaos, chaos_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(chaos_mem) + MCFG_CPU_IO_MAP(chaos_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(chaos_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( chaos ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "chaos.001", 0x0000, 0x1000, CRC(3b433e72) SHA1(5b487337d71253d0e64e123f405da9eaf20e87ac)) + ROM_LOAD( "chaos.002", 0x1000, 0x1000, CRC(8b0b487f) SHA1(0d167cf3004a81c87446f2f1464e3debfa7284fe)) + ROM_LOAD( "chaos.003", 0x2000, 0x1000, CRC(5880db81) SHA1(29b8f1b03c83953f66464ad1fbbfe2e019637ce1)) + ROM_LOAD( "chaos.004", 0x7000, 0x1000, CRC(5d6839d6) SHA1(237f52f0780ac2e29d57bf06d0f7a982eb523084)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, chaos, 0, 0, chaos, chaos, driver_device, 0, "", "Chaos 2", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/chessmst.c b/src/mame/drivers/chessmst.c new file mode 100644 index 00000000000..765fd3078bb --- /dev/null +++ b/src/mame/drivers/chessmst.c @@ -0,0 +1,286 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Chess-Master + + TODO: + - add Reset and Halt buttons + - a better artwork + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80pio.h" +#include "sound/speaker.h" +#include "chessmst.lh" + + +class chessmst_state : public driver_device +{ +public: + chessmst_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker") + { } + + required_device m_maincpu; + required_device m_speaker; + + UINT16 m_matrix; + UINT16 m_led_sel; + UINT8 m_sensor[64]; + + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( pio1_port_a_w ); + DECLARE_WRITE8_MEMBER( pio1_port_b_w ); + DECLARE_READ8_MEMBER( pio2_port_a_r ); + DECLARE_WRITE8_MEMBER( pio2_port_b_w ); + DECLARE_INPUT_CHANGED_MEMBER(chessmst_sensor); +}; + + +static ADDRESS_MAP_START(chessmst_mem, AS_PROGRAM, 8, chessmst_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x7fff) // A15 not connected + AM_RANGE( 0x0000, 0x27ff ) AM_ROM + AM_RANGE( 0x3400, 0x3bff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( chessmst_io , AS_IO, 8, chessmst_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + //AM_RANGE(0x00, 0x03) AM_MIRROR(0xf0) read/write in both, not used by the software + AM_RANGE(0x04, 0x07) AM_MIRROR(0xf0) AM_DEVREADWRITE("z80pio1", z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_MIRROR(0xf0) AM_DEVREADWRITE("z80pio2", z80pio_device, read, write) +ADDRESS_MAP_END + +INPUT_CHANGED_MEMBER(chessmst_state::chessmst_sensor) +{ + UINT8 pos = (UINT8)(FPTR)param; + + if (newval) + { + m_sensor[pos] = !m_sensor[pos]; + } +} + +/* Input ports */ +static INPUT_PORTS_START( chessmst ) + PORT_START("COL_A") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 7) + PORT_START("COL_B") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 9) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 10) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 11) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 12) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 13) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 14) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 15) + PORT_START("COL_C") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 16) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 17) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 18) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 19) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 20) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 21) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 22) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 23) + PORT_START("COL_D") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 24) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 25) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 26) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 27) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 28) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 29) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 30) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 31) + PORT_START("COL_E") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 32) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 33) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 34) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 35) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 36) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 37) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 38) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 39) + PORT_START("COL_F") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 40) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 41) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 42) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 43) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 44) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 45) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 46) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 47) + PORT_START("COL_G") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 48) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 49) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 50) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 51) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 52) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 53) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 54) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 55) + PORT_START("COL_H") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 56) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 57) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 58) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 59) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 60) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 61) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 62) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 63) + + PORT_START("BUTTONS") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Hint [7]") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_H) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Random [6]") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_R) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Referee [5]") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_F) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Selfplay [4]") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Board [3]") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_B) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Color [2]") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_C) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Level [1]") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_L) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("New Game [0]") PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_ENTER) +INPUT_PORTS_END + +void chessmst_state::machine_reset() +{ + //reset all sensors + memset(m_sensor, 1, sizeof(m_sensor)); + + //positioning the pieces for start next game + for (int i=0; i<64; i+=8) + m_sensor[i+0] = m_sensor[i+1] = m_sensor[i+6] = m_sensor[i+7] = 0; +} + +WRITE8_MEMBER( chessmst_state::pio1_port_a_w ) +{ + for (int row=1; row<=8; row++) + { + if (m_led_sel & 0x01) + output_set_indexed_value("led_a", row, BIT(data, 8-row)); + if (m_led_sel & 0x02) + output_set_indexed_value("led_b", row, BIT(data, 8-row)); + if (m_led_sel & 0x04) + output_set_indexed_value("led_c", row, BIT(data, 8-row)); + if (m_led_sel & 0x08) + output_set_indexed_value("led_d", row, BIT(data, 8-row)); + if (m_led_sel & 0x10) + output_set_indexed_value("led_e", row, BIT(data, 8-row)); + if (m_led_sel & 0x20) + output_set_indexed_value("led_f", row, BIT(data, 8-row)); + if (m_led_sel & 0x40) + output_set_indexed_value("led_g", row, BIT(data, 8-row)); + if (m_led_sel & 0x80) + output_set_indexed_value("led_h", row, BIT(data, 8-row)); + if (m_led_sel & 0x100) + output_set_indexed_value("led_i", row, BIT(data, 8-row)); + if (m_led_sel & 0x200) + output_set_indexed_value("led_j", row, BIT(data, 8-row)); + } + + m_led_sel = 0; +} + +WRITE8_MEMBER( chessmst_state::pio1_port_b_w ) +{ + m_matrix = (m_matrix & 0xff) | ((data & 0x01)<<8); + m_led_sel = (m_led_sel & 0xff) | ((data & 0x03)<<8); + + m_speaker->level_w(BIT(data, 6)); +} + +READ8_MEMBER( chessmst_state::pio2_port_a_r ) +{ + UINT8 data = 0x00; + + // The pieces position on the chessboard is identified by 64 Hall + // sensors, which are in a 8x8 matrix with the corresponding LEDs. + for (int i=0; i<8; i++) + { + if (m_matrix & 0x01) + data |= (m_sensor[0+i] ? (1<read(); + + return data; +} + +WRITE8_MEMBER( chessmst_state::pio2_port_b_w ) +{ + m_matrix = (data & 0xff) | (m_matrix & 0x100); + m_led_sel = (data & 0xff) | (m_led_sel & 0x300); +} + +static MACHINE_CONFIG_START( chessmst, chessmst_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(chessmst_mem) + MCFG_CPU_IO_MAP(chessmst_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_chessmst) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_DEVICE_ADD("z80pio1", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(chessmst_state, pio1_port_a_w)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(chessmst_state, pio1_port_b_w)) + + MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_IN_PA_CB(READ8(chessmst_state, pio2_port_a_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(chessmst_state, pio2_port_b_w)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( chessmst ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "056.bin", 0x0000, 0x0400, CRC(2b90e5d3) SHA1(c47445964b2e6cb11bd1f27e395cf980c97af196)) + ROM_LOAD( "057.bin", 0x0400, 0x0400, CRC(e666fc56) SHA1(3fa75b82cead81973bea94191a5c35f0acaaa0e6)) + ROM_LOAD( "058.bin", 0x0800, 0x0400, CRC(6a17fbec) SHA1(019051e93a5114477c50eaa87e1ff01b02eb404d)) + ROM_LOAD( "059.bin", 0x0c00, 0x0400, CRC(e96e3d07) SHA1(20fab75f206f842231f0414ebc473ce2a7371e7f)) + ROM_LOAD( "060.bin", 0x1000, 0x0400, CRC(0e31f000) SHA1(daac924b79957a71a4b276bf2cef44badcbe37d3)) + ROM_LOAD( "061.bin", 0x1400, 0x0400, CRC(69ad896d) SHA1(25d999b59d4cc74bd339032c26889af00e64df60)) + ROM_LOAD( "062.bin", 0x1800, 0x0400, CRC(c42925fe) SHA1(c42d8d7c30a9b6d91ac994cec0cc2723f41324e9)) + ROM_LOAD( "063.bin", 0x1c00, 0x0400, CRC(86be4cdb) SHA1(741f984c15c6841e227a8722ba30cf9e6b86d878)) + ROM_LOAD( "064.bin", 0x2000, 0x0400, CRC(e82f5480) SHA1(38a939158052f5e6484ee3725b86e522541fe4aa)) + ROM_LOAD( "065.bin", 0x2400, 0x0400, CRC(4ec0e92c) SHA1(0b748231a50777391b04c1778750fbb46c21bee8)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, chessmst, 0, 0, chessmst, chessmst, driver_device, 0, "VEB Mikroelektronik Erfurt", "Chess-Master", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/chesstrv.c b/src/mame/drivers/chesstrv.c new file mode 100644 index 00000000000..bd79872d15a --- /dev/null +++ b/src/mame/drivers/chesstrv.c @@ -0,0 +1,256 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/****************************************************************************** + + Acetronic Chess Traveller + + TODO: + - Add emulation of the 3870 MCU to the F8 core, including timer interrupt + that is used by the Boris Diplomat. + +******************************************************************************/ + +#include "emu.h" +#include "cpu/f8/f8.h" +#include "chesstrv.lh" +#include "borisdpl.lh" + +class chesstrv_state : public driver_device +{ +public: + chesstrv_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( ram_addr_r ); + DECLARE_WRITE8_MEMBER( ram_addr_w ); + DECLARE_READ8_MEMBER( ram_r ); + DECLARE_WRITE8_MEMBER( ram_w ); + DECLARE_WRITE8_MEMBER( display_w ); + DECLARE_WRITE8_MEMBER( matrix_w ); + DECLARE_READ8_MEMBER( keypad_r ); + DECLARE_WRITE8_MEMBER( diplomat_display_w ); + DECLARE_READ8_MEMBER( diplomat_keypad_r ); + + UINT8 m_ram_addr; + UINT8 *m_ram; + UINT8 m_matrix; + //TIMER_DEVICE_CALLBACK_MEMBER(borisdpl_timer_interrupt); + required_device m_maincpu; +}; + +WRITE8_MEMBER( chesstrv_state::ram_addr_w ) +{ + m_ram_addr = data; +} + +READ8_MEMBER( chesstrv_state::ram_addr_r ) +{ + return m_ram_addr; +} + +READ8_MEMBER( chesstrv_state::ram_r ) +{ + return m_ram[m_ram_addr]; +} + +WRITE8_MEMBER( chesstrv_state::ram_w ) +{ + m_ram[m_ram_addr] = data; +} + +WRITE8_MEMBER( chesstrv_state::display_w ) +{ + UINT8 seg_data = BITSWAP8(data,0,1,2,3,4,5,6,7); + + if(!(m_matrix & 0x01)) + output_set_digit_value( 3, seg_data ); + if(!(m_matrix & 0x02)) + output_set_digit_value( 2, seg_data ); + if(!(m_matrix & 0x04)) + output_set_digit_value( 1, seg_data ); + if(!(m_matrix & 0x08)) + output_set_digit_value( 0, seg_data ); +} + +WRITE8_MEMBER( chesstrv_state::matrix_w ) +{ + m_matrix = data; +} + +READ8_MEMBER( chesstrv_state::keypad_r ) +{ + UINT8 data = 0; + + data |= ioport("LINE1")->read(); + data |= ioport("LINE2")->read(); + data |= ioport("LINE3")->read(); + data |= ioport("LINE4")->read(); + data |= (ioport("LINE1")->read() ? 0x10 : 0); + data |= (ioport("LINE2")->read() ? 0x20 : 0); + data |= (ioport("LINE3")->read() ? 0x40 : 0); + data |= (ioport("LINE4")->read() ? 0x80 : 0); + + return data; +} + +WRITE8_MEMBER( chesstrv_state::diplomat_display_w ) +{ + output_set_digit_value( m_matrix & 7, data ^ 0xff ); +} + +READ8_MEMBER( chesstrv_state::diplomat_keypad_r ) +{ + UINT8 data = m_matrix & 0x07; + + switch (m_matrix & 7) + { + case 0: data |= ioport("LINE1")->read(); break; + case 1: data |= ioport("LINE2")->read(); break; + case 2: data |= ioport("LINE3")->read(); break; + case 3: data |= ioport("LINE4")->read(); break; + } + + return data; +} + + +static ADDRESS_MAP_START( chesstrv_mem, AS_PROGRAM, 8, chesstrv_state ) + ADDRESS_MAP_GLOBAL_MASK(0x7ff) + AM_RANGE( 0x0000, 0x07ff ) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( chesstrv_io, AS_IO, 8, chesstrv_state ) + AM_RANGE( 0x00, 0x00 ) AM_READWRITE( ram_addr_r, ram_addr_w ) + AM_RANGE( 0x01, 0x01 ) AM_WRITE( display_w ) + AM_RANGE( 0x04, 0x04 ) AM_READWRITE( ram_r, ram_w ) + AM_RANGE( 0x05, 0x05 ) AM_READWRITE( keypad_r, matrix_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( borisdpl_io, AS_IO, 8, chesstrv_state ) + AM_RANGE( 0x00, 0x00 ) AM_READWRITE( diplomat_keypad_r, matrix_w ) + AM_RANGE( 0x01, 0x01 ) AM_WRITE( diplomat_display_w ) + AM_RANGE( 0x04, 0x04 ) AM_READWRITE( ram_r, ram_w ) + AM_RANGE( 0x05, 0x05 ) AM_READWRITE( ram_addr_r, ram_addr_w ) +ADDRESS_MAP_END + +static INPUT_PORTS_START( chesstrv ) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("FP") PORT_CODE(KEYCODE_K) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("EP") PORT_CODE(KEYCODE_O) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CB") PORT_CODE(KEYCODE_Q) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MM") PORT_CODE(KEYCODE_M) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( borisdpl ) + PORT_START("LINE1") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B/W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + + PORT_START("LINE2") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RANK") PORT_CODE(KEYCODE_R) + + PORT_START("LINE3") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TIME") PORT_CODE(KEYCODE_T) + + PORT_START("LINE4") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9/SET") PORT_CODE(KEYCODE_S) PORT_CODE(KEYCODE_9) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE") PORT_CODE(KEYCODE_DEL) + +INPUT_PORTS_END + +/* +TIMER_DEVICE_CALLBACK_MEMBER(chesstrv_state::borisdpl_timer_interrupt) +{ + m_maincpu->set_input_line_and_vector(F8_INPUT_LINE_INT_REQ, HOLD_LINE, 0x20); +} +*/ + +void chesstrv_state::machine_start() +{ + m_ram = memregion("ram")->base(); + + save_item(NAME(m_ram_addr)); + save_item(NAME(m_matrix)); +} + +static MACHINE_CONFIG_START( chesstrv, chesstrv_state ) + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", F8, 3000000 ) // Fairchild 3870 + MCFG_CPU_PROGRAM_MAP( chesstrv_mem ) + MCFG_CPU_IO_MAP( chesstrv_io ) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_chesstrv ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( borisdpl, chesstrv_state ) + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", F8, 30000000 ) // Motorola SC80265P + MCFG_CPU_PROGRAM_MAP( chesstrv_mem ) + MCFG_CPU_IO_MAP( borisdpl_io ) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_borisdpl ) + + //MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_interrupt", chesstrv_state, borisdpl_timer_interrupt, attotime::from_hz(40)) +MACHINE_CONFIG_END + + +ROM_START( chesstrv ) + ROM_REGION(0x0800, "maincpu", 0) + ROM_LOAD("3870-sl90387", 0x0000, 0x0800, CRC(b76214d8) SHA1(7760903a64d9c513eb54c4787f535dabec62eb64)) + + ROM_REGION(0x0100, "ram", ROMREGION_ERASE) +ROM_END + +ROM_START( borisdpl ) + ROM_REGION(0x0800, "maincpu", 0) + ROM_LOAD("007-7024-00_7847.u8", 0x0000, 0x0800, CRC(e20bac03) SHA1(9e17b9d90522371fbf7018926356150f70b9a3b6)) + + ROM_REGION(0x0100, "ram", ROMREGION_ERASE) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1980, chesstrv, 0, 0, chesstrv, chesstrv, driver_device, 0, "Acetronic", "Chess Traveller", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) +CONS( 1979, borisdpl, 0, 0, borisdpl, borisdpl, driver_device, 0, "Applied Concepts", "Boris Diplomat", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/clcd.c b/src/mame/drivers/clcd.c new file mode 100644 index 00000000000..ed56c2e82ea --- /dev/null +++ b/src/mame/drivers/clcd.c @@ -0,0 +1,847 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder,smf +/*************************************************************************** + + Commodore LCD prototype + + GTE G65SC102PI-2 + GTE G65SC51P-1 + Rockwell R65C22P2 x 2 + AMI S3530X Bell 103/V.21 Single chip modem + +****************************************************************************/ + + +#include "bus/centronics/ctronics.h" +#include "bus/rs232/rs232.h" +#include "cpu/m6502/m65c02.h" +#include "machine/6522via.h" +#include "machine/bankdev.h" +#include "machine/mos6551.h" +#include "machine/msm58321.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "sound/speaker.h" +#include "rendlay.h" + +class clcd_state : public driver_device +{ +public: + clcd_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_acia(*this, "acia"), + m_via0(*this, "via0"), + m_rtc(*this, "rtc"), + m_centronics(*this, "centronics"), + m_ram(*this,"ram"), + m_nvram(*this, "nvram"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_lcd_char_rom(*this, "lcd_char_rom"), + m_lcd_scrollx(0), + m_lcd_scrolly(0), + m_lcd_mode(0), + m_lcd_size(0), + m_irq_via0(0), + m_irq_via1(0), + m_irq_acia(0), + m_mmu_mode(MMU_MODE_KERN), + m_mmu_saved_mode(MMU_MODE_KERN), + m_mmu_offset1(0), + m_mmu_offset2(0), + m_mmu_offset3(0), + m_mmu_offset4(0), + m_mmu_offset5(0), + m_key_clk(0), + m_key_poll(0), + m_key_column(0), + m_key_shift(0), + m_key_force_format(0), + m_col0(*this, "COL0"), + m_col1(*this, "COL1"), + m_col2(*this, "COL2"), + m_col3(*this, "COL3"), + m_col4(*this, "COL4"), + m_col5(*this, "COL5"), + m_col6(*this, "COL6"), + m_col7(*this, "COL7"), + m_special(*this, "SPECIAL") + { + } + + virtual void driver_start() + { + m_mmu_mode = MMU_MODE_TEST; + update_mmu_mode(MMU_MODE_KERN); + + update_irq(); + + save_item(NAME(m_lcd_scrollx)); + save_item(NAME(m_lcd_scrolly)); + save_item(NAME(m_lcd_mode)); + save_item(NAME(m_lcd_size)); + save_item(NAME(m_mmu_mode)); + save_item(NAME(m_mmu_saved_mode)); + save_item(NAME(m_mmu_offset1)); + save_item(NAME(m_mmu_offset2)); + save_item(NAME(m_mmu_offset3)); + save_item(NAME(m_mmu_offset4)); + save_item(NAME(m_mmu_offset5)); + save_item(NAME(m_key_clk)); + save_item(NAME(m_key_poll)); + save_item(NAME(m_key_column)); + save_item(NAME(m_key_shift)); + + m_rtc->cs1_w(1); + m_acia->write_cts(0); + m_nvram->set_base(ram()->pointer(), ram()->size()); + } + + DECLARE_PALETTE_INIT(clcd) + { + palette.set_pen_color(0, rgb_t(36,72,36)); + palette.set_pen_color(1, rgb_t(2,4,2)); + } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) + { + if (m_lcd_mode & LCD_MODE_GRAPH) + { + for (int y = 0; y < 128; y++) + { + int offset = (m_lcd_scrolly * 128) + (y * 64); + + for (int x = 0; x < 60; x++) + { + UINT8 bit = m_ram->pointer()[offset++]; + + bitmap.pix16(y, (x * 8) + 0) = (bit >> 7) & 1; + bitmap.pix16(y, (x * 8) + 1) = (bit >> 6) & 1; + bitmap.pix16(y, (x * 8) + 2) = (bit >> 5) & 1; + bitmap.pix16(y, (x * 8) + 3) = (bit >> 4) & 1; + bitmap.pix16(y, (x * 8) + 4) = (bit >> 3) & 1; + bitmap.pix16(y, (x * 8) + 5) = (bit >> 2) & 1; + bitmap.pix16(y, (x * 8) + 6) = (bit >> 1) & 1; + bitmap.pix16(y, (x * 8) + 7) = (bit >> 0) & 1; + } + } + } + else + { + UINT8 *font = m_lcd_char_rom->base(); + if (m_lcd_mode & LCD_MODE_ALT) + { + font += 1024; + } + + int chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; + + for (int y = 0; y < 16; y++) + { + int offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + (y * 128); + + for (int x = 0; x < 480; x++) + { + UINT8 ch = m_ram->pointer()[offset + (x / chrw)]; + UINT8 bit = font[((ch & 0x7f) * chrw) + (x % chrw)]; + if (ch & 0x80) + { + bit = ~bit; + } + + bitmap.pix16((y * 8) + 0, x) = (bit >> 0) & 1; + bitmap.pix16((y * 8) + 1, x) = (bit >> 1) & 1; + bitmap.pix16((y * 8) + 2, x) = (bit >> 2) & 1; + bitmap.pix16((y * 8) + 3, x) = (bit >> 3) & 1; + bitmap.pix16((y * 8) + 4, x) = (bit >> 4) & 1; + bitmap.pix16((y * 8) + 5, x) = (bit >> 5) & 1; + bitmap.pix16((y * 8) + 6, x) = (bit >> 6) & 1; + bitmap.pix16((y * 8) + 7, x) = (bit >> 7) & 1; + } + } + } + + return 0; + } + + READ8_MEMBER(ram_r) + { + if (offset < m_ram->size()) + { + return m_ram->pointer()[offset]; + } + + return 0xff; + } + + WRITE8_MEMBER(ram_w) + { + if (offset < m_ram->size()) + { + m_ram->pointer()[offset] = data; + } + } + + enum + { + MMU_MODE_KERN, + MMU_MODE_APPL, + MMU_MODE_RAM, + MMU_MODE_TEST + }; + + enum + { + LCD_MODE_ALT = 1, + LCD_MODE_GRAPH = 2 + }; + + enum + { + LCD_SIZE_CHRW = 4 + }; + + void update_irq() + { + m_maincpu->irq_line(m_irq_via0 | m_irq_via1 | m_irq_acia); + } + + WRITE_LINE_MEMBER(write_irq_via0) + { + m_irq_via0 = state; + update_irq(); + } + + WRITE_LINE_MEMBER(write_irq_via1) + { + m_irq_via1 = state; + update_irq(); + } + + WRITE_LINE_MEMBER(write_irq_acia) + { + m_irq_acia = state; + update_irq(); + } + + void update_mmu_mode(int new_mode) + { + if (m_mmu_mode != new_mode) + { + m_mmu_mode = new_mode; + + switch (m_mmu_mode) + { + case MMU_MODE_KERN: + m_bank1->set_bank(0x04 + 0x00); + update_mmu_offset5(); + m_bank3->set_bank(0x20 + 0xc0); + m_bank4->set_bank(0x30 + 0xc0); + break; + + case MMU_MODE_APPL: + update_mmu_offset1(); + update_mmu_offset2(); + update_mmu_offset3(); + update_mmu_offset4(); + break; + + case MMU_MODE_RAM: + m_bank1->set_bank(0x04); + m_bank2->set_bank(0x10); + m_bank3->set_bank(0x20); + m_bank4->set_bank(0x30); + break; + + case MMU_MODE_TEST: + m_bank1->set_bank(0x04 + 0x200); + m_bank2->set_bank(0x10 + 0x200); + m_bank3->set_bank(0x20 + 0x200); + m_bank4->set_bank(0x30 + 0x200); + break; + } + } + } + + void update_mmu_offset1() + { + if (m_mmu_mode == MMU_MODE_APPL) + { + m_bank1->set_bank(0x04 + m_mmu_offset1); + } + } + + void update_mmu_offset2() + { + if (m_mmu_mode == MMU_MODE_APPL) + { + m_bank2->set_bank((0x10 + m_mmu_offset2) & 0xff); + } + } + + void update_mmu_offset3() + { + if (m_mmu_mode == MMU_MODE_APPL) + { + m_bank3->set_bank((0x20 + m_mmu_offset3) & 0xff); + } + } + + void update_mmu_offset4() + { + if (m_mmu_mode == MMU_MODE_APPL) + { + m_bank4->set_bank((0x30 + m_mmu_offset4) & 0xff); + } + } + + void update_mmu_offset5() + { + if (m_mmu_mode == MMU_MODE_KERN) + { + m_bank2->set_bank((0x10 + m_mmu_offset5) & 0xff); + } + } + + WRITE8_MEMBER(mmu_mode_kern_w) + { + update_mmu_mode(MMU_MODE_KERN); + } + + WRITE8_MEMBER(mmu_mode_appl_w) + { + update_mmu_mode(MMU_MODE_APPL); + } + + WRITE8_MEMBER(mmu_mode_ram_w) + { + update_mmu_mode(MMU_MODE_RAM); + } + + WRITE8_MEMBER(mmu_mode_recall_w) + { + update_mmu_mode(m_mmu_saved_mode); + } + + WRITE8_MEMBER(mmu_mode_save_w) + { + m_mmu_saved_mode = m_mmu_mode; + } + + WRITE8_MEMBER(mmu_mode_test_w) + { + update_mmu_mode(MMU_MODE_TEST); + } + + WRITE8_MEMBER(mmu_offset1_w) + { + if (m_mmu_offset1 != data) + { + m_mmu_offset1 = data; + update_mmu_offset1(); + } + } + + WRITE8_MEMBER(mmu_offset2_w) + { + if (m_mmu_offset2 != data) + { + m_mmu_offset2 = data; + update_mmu_offset2(); + } + } + + WRITE8_MEMBER(mmu_offset3_w) + { + if (m_mmu_offset3 != data) + { + m_mmu_offset3 = data; + update_mmu_offset3(); + } + } + + WRITE8_MEMBER(mmu_offset4_w) + { + if (m_mmu_offset4 != data) + { + m_mmu_offset4 = data; + update_mmu_offset4(); + } + } + + WRITE8_MEMBER(mmu_offset5_w) + { + if (m_mmu_offset5 != data) + { + m_mmu_offset5 = data; + update_mmu_offset5(); + } + } + + READ8_MEMBER(mmu_offset1_r) + { + return m_mmu_offset1; + } + + READ8_MEMBER(mmu_offset2_r) + { + return m_mmu_offset2; + } + + READ8_MEMBER(mmu_offset3_r) + { + return m_mmu_offset3; + } + + READ8_MEMBER(mmu_offset4_r) + { + return m_mmu_offset4; + } + + READ8_MEMBER(mmu_offset5_r) + { + return m_mmu_offset5; + } + + WRITE8_MEMBER(lcd_scrollx_w) + { + m_lcd_scrollx = data; + } + + WRITE8_MEMBER(lcd_scrolly_w) + { + m_lcd_scrolly = data; + } + + WRITE8_MEMBER(lcd_mode_w) + { + m_lcd_mode = data; + } + + WRITE8_MEMBER(lcd_size_w) + { + m_lcd_size = data; + } + + WRITE8_MEMBER(via0_pa_w) + { + m_key_column = data; + } + + int read_column(int column) + { + switch (column) + { + case 0: + return m_col0->read(); + + case 1: + return m_col1->read(); + + case 2: + return m_col2->read(); + + case 3: + return m_col3->read(); + + case 4: + return m_col4->read(); + + case 5: + return m_col5->read(); + + case 6: + return m_col6->read(); + + case 7: + return m_col7->read(); + } + + return 0; + } + + WRITE8_MEMBER(via0_pb_w) + { + write_key_poll((data >> 0) & 1); + m_rtc->cs2_w((data >> 1) & 1); + } + + WRITE_LINE_MEMBER(write_key_poll) + { + if (m_key_poll != state) + { + m_key_poll = state; + + if (m_key_poll != 0) + { + m_key_shift = m_special->read(); + + for (int i = 0; i < 8; i++) + { + if ((m_key_column & (128 >> i)) == 0) + { + m_key_shift |= read_column(i) << 8; + } + } + + if (m_key_force_format) + { + m_key_shift = 0x15; // Simulate holding CBM+SHIFT+STOP if you have no NVRAM + + m_key_force_format--; + } + } + } + } + + WRITE_LINE_MEMBER(via0_cb1_w) + { + int newm_key_clk = state & 1; + if (m_key_clk != newm_key_clk) + { + m_key_clk = newm_key_clk; + + if (!m_key_clk) + { + m_via0->write_cb2((m_key_shift & 0x8000) != 0); + m_key_shift <<= 1; + } + } + } + + WRITE8_MEMBER(via1_pa_w) + { + m_rtc->d0_w(BIT(data, 0)); + m_centronics->write_data0(BIT(data, 0)); + + m_rtc->d1_w(BIT(data, 1)); + m_centronics->write_data1(BIT(data, 1)); + + m_rtc->d2_w(BIT(data, 2)); + m_centronics->write_data2(BIT(data, 2)); + + m_rtc->d3_w(BIT(data, 3)); + m_centronics->write_data3(BIT(data, 3)); + + m_rtc->read_w(BIT(data, 4)); + m_centronics->write_data4(BIT(data, 4)); + + m_rtc->write_w(BIT(data, 5)); + m_centronics->write_data5(BIT(data, 5)); + + m_rtc->address_write_w(BIT(data, 6)); + m_centronics->write_data6(BIT(data, 6)); + + m_centronics->write_data7(BIT(data, 7)); + } + + WRITE8_MEMBER(via1_pb_w) + { + //int centronics_unknown = !BIT(data,5); + } + + ram_device *ram() + { + return m_ram; + } + + void force_format() + { + m_key_force_format = 10; + } + + void nvram_init(nvram_device &nvram, void *data, size_t size); + +private: + required_device m_maincpu; + required_device m_acia; + required_device m_via0; + required_device m_rtc; + required_device m_centronics; + required_device m_ram; + required_device m_nvram; + required_device m_bank1; + required_device m_bank2; + required_device m_bank3; + required_device m_bank4; + required_memory_region m_lcd_char_rom; + int m_lcd_scrollx; + int m_lcd_scrolly; + int m_lcd_mode; + int m_lcd_size; + int m_irq_via0; + int m_irq_via1; + int m_irq_acia; + int m_mmu_mode; + int m_mmu_saved_mode; + UINT8 m_mmu_offset1; + UINT8 m_mmu_offset2; + UINT8 m_mmu_offset3; + UINT8 m_mmu_offset4; + UINT8 m_mmu_offset5; + int m_key_clk; + int m_key_poll; + int m_key_column; + UINT16 m_key_shift; + int m_key_force_format; + required_ioport m_col0; + required_ioport m_col1; + required_ioport m_col2; + required_ioport m_col3; + required_ioport m_col4; + required_ioport m_col5; + required_ioport m_col6; + required_ioport m_col7; + required_ioport m_special; +}; + +void clcd_state::nvram_init(nvram_device &nvram, void *data, size_t size) +{ + memset(data, 0x00, size); + force_format(); +} + + +static ADDRESS_MAP_START( clcd_banked_mem, AS_PROGRAM, 8, clcd_state ) + /* KERN/APPL/RAM */ + AM_RANGE(0x00000, 0x1ffff) AM_MIRROR(0x40000) AM_READWRITE(ram_r, ram_w) + AM_RANGE(0x20000, 0x3ffff) AM_MIRROR(0x40000) AM_ROM AM_REGION("maincpu",0) + + /* TEST */ + AM_RANGE(0x81000, 0x83fff) AM_READ(mmu_offset1_r) + AM_RANGE(0x84000, 0x87fff) AM_READ(mmu_offset2_r) + AM_RANGE(0x88000, 0x8bfff) AM_READ(mmu_offset3_r) + AM_RANGE(0x8c000, 0x8dfff) AM_READ(mmu_offset4_r) + AM_RANGE(0x8e000, 0x8f7ff) AM_READ(mmu_offset5_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( clcd_mem, AS_PROGRAM, 8, clcd_state ) + AM_RANGE(0x0000, 0x0fff) AM_READWRITE(ram_r, ram_w) + AM_RANGE(0x1000, 0x3fff) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) + AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("bank2", address_map_bank_device, read8, write8) + AM_RANGE(0x8000, 0xbfff) AM_DEVREADWRITE("bank3", address_map_bank_device, read8, write8) + AM_RANGE(0xc000, 0xf7ff) AM_DEVREADWRITE("bank4", address_map_bank_device, read8, write8) + AM_RANGE(0xf800, 0xf80f) AM_MIRROR(0x70) AM_DEVREADWRITE("via0", via6522_device, read, write) + AM_RANGE(0xf880, 0xf88f) AM_MIRROR(0x70) AM_DEVREADWRITE("via1", via6522_device, read, write) + AM_RANGE(0xf980, 0xf983) AM_MIRROR(0x7c) AM_DEVREADWRITE("acia", mos6551_device, read, write) + AM_RANGE(0xfa00, 0xffff) AM_ROM AM_REGION("maincpu", 0x1fa00) + AM_RANGE(0xfa00, 0xfa00) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_kern_w) + AM_RANGE(0xfa80, 0xfa80) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_appl_w) + AM_RANGE(0xfb00, 0xfb00) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_ram_w) + AM_RANGE(0xfb80, 0xfb80) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_recall_w) + AM_RANGE(0xfc00, 0xfc00) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_save_w) + AM_RANGE(0xfc80, 0xfc80) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_test_w) + AM_RANGE(0xfd00, 0xfd00) AM_MIRROR(0x7f) AM_WRITE(mmu_offset1_w) + AM_RANGE(0xfd80, 0xfd80) AM_MIRROR(0x7f) AM_WRITE(mmu_offset2_w) + AM_RANGE(0xfe00, 0xfe00) AM_MIRROR(0x7f) AM_WRITE(mmu_offset3_w) + AM_RANGE(0xfe80, 0xfe80) AM_MIRROR(0x7f) AM_WRITE(mmu_offset4_w) + AM_RANGE(0xff00, 0xff00) AM_MIRROR(0x7f) AM_WRITE(mmu_offset5_w) + AM_RANGE(0xff80, 0xff80) AM_MIRROR(0x7c) AM_WRITE(lcd_scrollx_w) + AM_RANGE(0xff81, 0xff81) AM_MIRROR(0x7c) AM_WRITE(lcd_scrolly_w) + AM_RANGE(0xff82, 0xff82) AM_MIRROR(0x7c) AM_WRITE(lcd_mode_w) + AM_RANGE(0xff83, 0xff83) AM_MIRROR(0x7c) AM_WRITE(lcd_size_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( clcd ) + PORT_START( "COL0" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') + + PORT_START( "COL1" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START( "COL2" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": [") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START( "COL3" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START( "COL4" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START( "COL5" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + + PORT_START( "COL6" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("*") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + + PORT_START( "COL7" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL INST") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('\b') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START( "SPECIAL" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // clears screen and goes into infinite loop + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // clears screen and goes into infinite loop +INPUT_PORTS_END + +static MACHINE_CONFIG_START(clcd, clcd_state) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M65C02, 2000000) + MCFG_CPU_PROGRAM_MAP(clcd_mem) + + MCFG_DEVICE_ADD("via0", VIA6522, 2000000) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(clcd_state, via0_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(clcd_state, via0_pb_w)) + MCFG_VIA6522_CB1_HANDLER(WRITELINE(clcd_state, via0_cb1_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(clcd_state, write_irq_via0)) + + MCFG_DEVICE_ADD("via1", VIA6522, 2000000) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(clcd_state, via1_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(clcd_state, via1_pb_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(clcd_state, write_irq_via1)) + MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) MCFG_DEVCB_XOR(1) + MCFG_VIA6522_CB2_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) + + MCFG_DEVICE_ADD("acia", MOS6551, 2000000) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_IRQ_HANDLER(WRITELINE(clcd_state, write_irq_acia)) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("via1", via6522_device, write_pb4)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, NULL) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("via1", via6522_device, write_pb6)) MCFG_DEVCB_XOR(1) + + MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) + + MCFG_DEVICE_ADD("bank2", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) + + MCFG_DEVICE_ADD("bank3", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) + + MCFG_DEVICE_ADD("bank4", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) + + MCFG_DEVICE_ADD("rtc", MSM58321, XTAL_32_768kHz) + MCFG_MSM58321_D0_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa0)) + MCFG_MSM58321_D1_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa1)) + MCFG_MSM58321_D2_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa2)) + MCFG_MSM58321_D3_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa3)) + MCFG_MSM58321_BUSY_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa7)) + MCFG_MSM58321_YEAR0(1984) + MCFG_MSM58321_DEFAULT_24H(true) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(80) + MCFG_SCREEN_UPDATE_DRIVER(clcd_state, screen_update) + MCFG_SCREEN_SIZE(480, 128) + MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 128-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(clcd_state, clcd) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_RAM_ADD("ram") + MCFG_RAM_DEFAULT_VALUE(0) + MCFG_RAM_EXTRA_OPTIONS("32k,64k") + MCFG_RAM_DEFAULT_SIZE("128k") + + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", clcd_state, nvram_init) +MACHINE_CONFIG_END + + +ROM_START( clcd ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "ss-calc-13apr.u105", 0x00000, 0x8000, CRC(88a587a7) SHA1(b08f3169b7cd696bb6a9b6e6e87a077345377ac4)) + ROM_LOAD( "sept-m-13apr.u104", 0x08000, 0x8000, CRC(41028c3c) SHA1(fcab6f0bbeef178eb8e5ecf82d9c348d8f318a8f)) + ROM_LOAD( "sizapr.u103", 0x10000, 0x8000, CRC(0aa91d9f) SHA1(f0842f370607f95d0a0ec6afafb81bc063c32745)) + ROM_LOAD( "kizapr.u102", 0x18000, 0x8000, CRC(59103d52) SHA1(e49c20b237a78b54c2cb26b133d5903bb60bd8ef)) + + ROM_REGION( 0x20000, "lcd_char_rom", 0 ) + ROM_LOAD( "lcd_char_rom", 0x000000, 0x000800, BAD_DUMP CRC(7db9d225) SHA1(0a8835fa182efa55d027828b42aa554608795274) ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, clcd, 0, 0, clcd, clcd, driver_device, 0, "Commodore Business Machines", "LCD (Prototype)", 0 ) diff --git a/src/mame/drivers/cm1800.c b/src/mame/drivers/cm1800.c new file mode 100644 index 00000000000..a02bd552daa --- /dev/null +++ b/src/mame/drivers/cm1800.c @@ -0,0 +1,121 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + CM-1800 + (note name is in cyrilic letters) + + more info at http://ru.wikipedia.org/wiki/%D0%A1%D0%9C_%D0%AD%D0%92%D0%9C + and http://sapr.lti-gti.ru/index.php?id=66 + + 26/04/2011 Skeleton driver. + +Commands: +C Compare +D Dump +F Fill +G +I +L +M Move +S Edit +T +X Registers + +For most commands, enter all 4 digits of each hex address, the system will +add the appropriate spacing as you type. No need to press Enter. + +The L command looks like it might be for loading a file, for example +L ABC will read/write to port 70,71,73 and eventually time out if you wait +a while. No idea if it wants to read a disk or a tape. There doesn't seem +to be a save command. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class cm1800_state : public driver_device +{ +public: + cm1800_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_terminal(*this, TERMINAL_TAG) , + m_maincpu(*this, "maincpu") + { + } + + DECLARE_READ8_MEMBER( term_status_r ); + DECLARE_READ8_MEMBER( term_r ); + DECLARE_WRITE8_MEMBER( kbd_put ); + UINT8 m_term_data; + + required_device m_terminal; + virtual void machine_reset(); + required_device m_maincpu; +}; + +READ8_MEMBER( cm1800_state::term_status_r ) +{ + return (m_term_data) ? 5 : 4; +} + +READ8_MEMBER( cm1800_state::term_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( cm1800_state::kbd_put ) +{ + m_term_data = data; +} + +static ADDRESS_MAP_START(cm1800_mem, AS_PROGRAM, 8, cm1800_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff ) AM_ROM + AM_RANGE( 0x0800, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cm1800_io , AS_IO, 8, cm1800_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_READ(term_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x01, 0x01) AM_READ(term_status_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( cm1800 ) +INPUT_PORTS_END + + +void cm1800_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( cm1800, cm1800_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(cm1800_mem) + MCFG_CPU_IO_MAP(cm1800_io) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(cm1800_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( cm1800 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "cm1800.rom", 0x0000, 0x0800, CRC(85d71d25) SHA1(42dc87d2eddc2906fa26d35db88a2e29d50fb481) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, cm1800, 0, 0, cm1800, cm1800, driver_device, 0, "", "CM-1800", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/coco12.c b/src/mame/drivers/coco12.c new file mode 100644 index 00000000000..7ed66f1b9f2 --- /dev/null +++ b/src/mame/drivers/coco12.c @@ -0,0 +1,447 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco12.c + + TRS-80 Radio Shack Color Computer 1/2 + + Mathis Rosenhauer (original driver) + Nate Woods (current maintainer) + Tim Lindner (VHD and other work) + + Version information: + + Basic Extended Basic Disk Extended + coco 1.0 - - + cocoe 1.1 1.0 1.0 + coco2 1.2 1.1 1.1 + coco2b 1.3 1.1 1.1 + coco3 1.2 2.0 1.1 + coco3p 1.2 2.0 1.1 + coco3h 1.2 2.0 1.1 + +***************************************************************************/ + +#include "includes/coco12.h" +#include "imagedev/cassette.h" +#include "cpu/m6809/m6809.h" +#include "bus/coco/coco_232.h" +#include "bus/coco/coco_orch90.h" +#include "bus/coco/coco_pak.h" +#include "bus/coco/coco_fdc.h" +#include "bus/coco/coco_multi.h" +#include "bus/coco/coco_dwsock.h" +#include "formats/coco_cas.h" + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( coco_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( coco_mem, AS_PROGRAM, 8, coco_state ) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//-------------------------------------------------------------------------- +// INPUT_PORTS( coco_analog_control ) +// +// Other CoCo controllers were compatible with the Dragon, even if no +// software is known to make use of them We add them here, based on this +// compatibility, in case anyone wants to use them in homebrew software +//-------------------------------------------------------------------------- + +INPUT_PORTS_START( coco_analog_control ) + PORT_START(CTRL_SEL_TAG) /* Select Controller Type */ + PORT_CONFNAME( 0x0f, 0x01, "Right Controller Port (P1)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco_state, joystick_mode_changed, 0 ) + PORT_CONFSETTING( 0x00, "Unconnected" ) + PORT_CONFSETTING( 0x01, "Joystick" ) + PORT_CONFSETTING( 0x02, "The Rat Graphics Mouse" ) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, NOTEQUALS, 0x20) + PORT_CONFSETTING( 0x03, "Diecom Light Gun Adaptor" ) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, NOTEQUALS, 0x30) + PORT_CONFNAME( 0xf0, 0x10, "Left Controller Port (P2)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco_state, joystick_mode_changed, 0 ) + PORT_CONFSETTING( 0x00, "Unconnected" ) + PORT_CONFSETTING( 0x10, "Joystick" ) + PORT_CONFSETTING( 0x20, "The Rat Graphics Mouse" ) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, NOTEQUALS, 0x02) + PORT_CONFSETTING( 0x30, "Diecom Light Gun Adaptor" ) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, NOTEQUALS, 0x03) + + PORT_START(HIRES_INTF_TAG) + PORT_CONFNAME( 0x07, 0x00, "Hi-Res Joystick Interfaces" ) + PORT_CONFSETTING( 0x00, "None" ) + PORT_CONFSETTING( 0x01, "Hi-Res in Right Port" ) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_CONFSETTING( 0x02, "Hi-Res CoCoMax 3 Style in Right Port" ) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_CONFSETTING( 0x03, "Hi-Res in Left Port" ) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) + PORT_CONFSETTING( 0x04, "Hi-Res CoCoMax 3 Style in Left Port" ) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco_joystick ) +//------------------------------------------------- + +static INPUT_PORTS_START( coco_joystick ) + PORT_START(JOYSTICK_RX_TAG) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_START(JOYSTICK_RY_TAG) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_START(JOYSTICK_LX_TAG) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) + PORT_START(JOYSTICK_LY_TAG) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) + PORT_START(JOYSTICK_BUTTONS_TAG) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Right Button") PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left Button") PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco_cart_autostart ) +//------------------------------------------------- + +INPUT_PORTS_START( coco_cart_autostart ) + PORT_START(CART_AUTOSTART_TAG) + PORT_CONFNAME( 0x01, 0x01, "Cart Auto-Start" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( 0x01, DEF_STR( On )) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco_beckerport ) +//------------------------------------------------- + +INPUT_PORTS_START( coco_beckerport ) + PORT_START(BECKERPORT_TAG) + PORT_CONFNAME( 0x01, 0x01, "Becker Port" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( 0x01, DEF_STR( On )) +INPUT_PORTS_END + +//------------------------------------------------- +// INPUT_PORTS( coco_rtc ) +//------------------------------------------------- + +INPUT_PORTS_START( coco_rtc ) + PORT_START("real_time_clock") + PORT_CONFNAME( 0x03, 0x00, "Real Time Clock" ) + PORT_CONFSETTING( 0x00, "Disto" ) + PORT_CONFSETTING( 0x01, "Cloud-9" ) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco_keyboard ) +//------------------------------------------------- +// +// CoCo keyboard +// +// PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 +// PA6: Ent Clr Brk N/c N/c N/c N/c Shift +// PA5: 8 9 : ; , - . / +// PA4: 0 1 2 3 4 5 6 7 +// PA3: X Y Z Up Dwn Lft Rgt Space +// PA2: P Q R S T U V W +// PA1: H I J K L M N O +// PA0: @ A B C D E F G +//------------------------------------------------- + +static INPUT_PORTS_START( coco_keyboard ) + PORT_START("row0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("row1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("row2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("row3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("row4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("row5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("row6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x78, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco ) +//------------------------------------------------- + +static INPUT_PORTS_START( coco ) + PORT_INCLUDE( coco_keyboard ) + PORT_INCLUDE( coco_joystick ) + PORT_INCLUDE( coco_analog_control ) + PORT_INCLUDE( coco_cart_autostart ) + PORT_INCLUDE( coco_rtc ) + PORT_INCLUDE( coco_beckerport ) +INPUT_PORTS_END + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// SLOT_INTERFACE_START(coco_cart) +//------------------------------------------------- + +SLOT_INTERFACE_START( coco_cart ) + SLOT_INTERFACE("fdc", COCO_FDC) + SLOT_INTERFACE("fdcv11", COCO_FDC_V11) + SLOT_INTERFACE("cc3hdb1", COCO3_HDB1) + SLOT_INTERFACE("cp400_fdc", CP400_FDC) + SLOT_INTERFACE("rs232", COCO_232) + SLOT_INTERFACE("orch90", COCO_ORCH90) + SLOT_INTERFACE("banked_16k", COCO_PAK_BANKED) + SLOT_INTERFACE("pak", COCO_PAK) + SLOT_INTERFACE("multi", COCO_MULTIPAK) +SLOT_INTERFACE_END + + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( coco_sound ) +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( coco_sound ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(DAC_TAG, DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + +static DEVICE_INPUT_DEFAULTS_START( printer ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +//------------------------------------------------- +// MACHINE_CONFIG +//------------------------------------------------- + +static MACHINE_CONFIG_START( coco, coco12_state ) + // basic machine hardware + MCFG_CPU_ADD(MAINCPU_TAG, M6809E, XTAL_3_579545MHz) + MCFG_CPU_PROGRAM_MAP(coco_mem) + + // devices + MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia0_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia0_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia0_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia0_cb2_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia0_irq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia0_irq_b)) + + MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(coco_state, pia1_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(coco_state, pia1_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia1_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia1_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia1_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia1_cb2_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia1_firq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia1_firq_b)) + + MCFG_SAM6883_ADD(SAM_TAG, XTAL_3_579545MHz, MAINCPU_TAG, AS_PROGRAM) + MCFG_SAM6883_RES_CALLBACK(READ8(coco12_state, sam_read)) + + // Becker Port device + MCFG_DEVICE_ADD(DWSOCK_TAG, COCO_DWSOCK, 0) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(coco_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "printer") + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(PIA1_TAG, pia6821_device, ca1_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("printer", printer) + + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "pak") + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + + // video hardware + MCFG_SCREEN_MC6847_NTSC_ADD(SCREEN_TAG, VDG_TAG) + + MCFG_DEVICE_ADD(VDG_TAG, MC6847_NTSC, XTAL_3_579545MHz) + MCFG_MC6847_HSYNC_CALLBACK(WRITELINE(coco12_state, horizontal_sync)) + MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(coco12_state, field_sync)) + MCFG_MC6847_INPUT_CALLBACK(DEVREAD8(SAM_TAG, sam6883_device, display_read)) + + // sound hardware + MCFG_FRAGMENT_ADD( coco_sound ) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("4K,16K,32K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( cocoe, coco ) + MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdc") + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + MCFG_COCO_VHD_ADD(VHD0_TAG) + MCFG_COCO_VHD_ADD(VHD1_TAG) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( coco2, coco ) + MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdcv11") + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + MCFG_COCO_VHD_ADD(VHD0_TAG) + MCFG_COCO_VHD_ADD(VHD1_TAG) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( coco2b, coco2 ) + MCFG_DEVICE_REMOVE(VDG_TAG) + MCFG_DEVICE_ADD(VDG_TAG, MC6847T1_NTSC, XTAL_3_579545MHz) + MCFG_MC6847_HSYNC_CALLBACK(WRITELINE(coco12_state, horizontal_sync)) + MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(coco12_state, field_sync)) + MCFG_MC6847_INPUT_CALLBACK(DEVREAD8(SAM_TAG, sam6883_device, display_read)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( cp400, coco ) + MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "cp400_fdc") + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) +MACHINE_CONFIG_END + + +//************************************************************************** +// ROMS +//************************************************************************** + +ROM_START(coco) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("bas10.rom", 0x2000, 0x2000, CRC(00b50aaa) SHA1(1f08455cd48ce6a06132aea15c4778f264e19539)) +ROM_END + +ROM_START(cocoe) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("bas11.rom", 0x2000, 0x2000, CRC(6270955a) SHA1(cecb7c24ff1e0ab5836e4a7a8eb1b8e01f1fded3)) + ROM_LOAD("extbas10.rom", 0x0000, 0x2000, CRC(6111a086) SHA1(8aa58f2eb3e8bcfd5470e3e35e2b359e9a72848e)) +ROM_END + +ROM_START(coco2) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("bas12.rom", 0x2000, 0x2000, CRC(54368805) SHA1(0f14dc46c647510eb0b7bd3f53e33da07907d04f)) + ROM_LOAD("extbas11.rom", 0x0000, 0x2000, CRC(a82a6254) SHA1(ad927fb4f30746d820cb8b860ebb585e7f095dea)) +ROM_END + +ROM_START(coco2b) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("bas13.rom", 0x2000, 0x2000, CRC(d8f4d15e) SHA1(28b92bebe35fa4f026a084416d6ea3b1552b63d3)) + ROM_LOAD("extbas11.rom", 0x0000, 0x2000, CRC(a82a6254) SHA1(ad927fb4f30746d820cb8b860ebb585e7f095dea)) +ROM_END + +ROM_START(cp400) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("cp400bas.rom", 0x0000, 0x4000, CRC(878396a5) SHA1(292c545da3c77978e043b00a3dbc317201d18c3b)) +ROM_END + +ROM_START(mx1600 ) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("mx1600bas.rom", 0x2000, 0x2000, CRC(d918156e) SHA1(70a464edf3a654ed4ffe687e6dee4f0d2acc758b)) + ROM_LOAD("mx1600extbas.rom", 0x0000, 0x2000, CRC(322a3d58) SHA1(9079a477c3f22e46cebb1e68b61df5bd607c71a4)) +ROM_END + +ROM_START(lzcolor64 ) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("color64bas.rom", 0x2000, 0x2000, CRC(b0717d71) SHA1(ad1beef9d6f095ada69f91d0b8ad75985172d86f)) + ROM_LOAD("color64extbas.rom", 0x0000, 0x2000, CRC(d1b1560d) SHA1(7252de9df405ade453282e992eb1f1910adc8e50)) +ROM_END + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1980, coco, 0, 0, coco, coco, driver_device, 0, "Tandy Radio Shack", "Color Computer", 0) +COMP( 1981, cocoe, coco, 0, cocoe, coco, driver_device, 0, "Tandy Radio Shack", "Color Computer (Extended BASIC 1.0)", 0) +COMP( 1983, coco2, coco, 0, coco2, coco, driver_device, 0, "Tandy Radio Shack", "Color Computer 2", 0) +COMP( 1985?, coco2b, coco, 0, coco2b, coco, driver_device, 0, "Tandy Radio Shack", "Color Computer 2B", 0) +COMP( 1984, cp400, coco, 0, cp400, coco, driver_device, 0, "Prologica", "CP400", 0) +COMP( 1984, lzcolor64, coco, 0, coco, coco, driver_device, 0, "Digiponto", "LZ Color64", 0) +COMP( 1984, mx1600, coco, 0, coco, coco, driver_device, 0, "Dynacom", "MX-1600", 0) diff --git a/src/mame/drivers/coco3.c b/src/mame/drivers/coco3.c new file mode 100644 index 00000000000..8023151718f --- /dev/null +++ b/src/mame/drivers/coco3.c @@ -0,0 +1,375 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco3.c + + TRS-80 Radio Shack Color Computer 3 + + Mathis Rosenhauer (original driver) + Nate Woods (current maintainer) + Tim Lindner (VHD and other work) + +***************************************************************************/ + +#include "includes/coco3.h" +#include "cpu/m6809/m6809.h" +#include "cpu/m6809/hd6309.h" +#include "formats/coco_cas.h" +#include "coco3.lh" + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( coco3_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( coco3_mem, AS_PROGRAM, 8, coco3_state ) + AM_RANGE(0x0000, 0x1FFF) AM_READ_BANK("rbank0") AM_WRITE_BANK("wbank0") + AM_RANGE(0x2000, 0x3FFF) AM_READ_BANK("rbank1") AM_WRITE_BANK("wbank1") + AM_RANGE(0x4000, 0x5FFF) AM_READ_BANK("rbank2") AM_WRITE_BANK("wbank2") + AM_RANGE(0x6000, 0x7FFF) AM_READ_BANK("rbank3") AM_WRITE_BANK("wbank3") + AM_RANGE(0x8000, 0x9FFF) AM_READ_BANK("rbank4") AM_WRITE_BANK("wbank4") + AM_RANGE(0xA000, 0xBFFF) AM_READ_BANK("rbank5") AM_WRITE_BANK("wbank5") + AM_RANGE(0xC000, 0xDFFF) AM_READ_BANK("rbank6") AM_WRITE_BANK("wbank6") + AM_RANGE(0xE000, 0xFDFF) AM_READ_BANK("rbank7") AM_WRITE_BANK("wbank7") + AM_RANGE(0xFE00, 0xFEFF) AM_READ_BANK("rbank8") AM_WRITE_BANK("wbank8") + AM_RANGE(0xFF00, 0xFF1F) AM_READWRITE(ff00_read, ff00_write) + AM_RANGE(0xFF20, 0xFF3F) AM_READWRITE(ff20_read, ff20_write) + AM_RANGE(0xFF40, 0xFF5F) AM_READWRITE(ff40_read, ff40_write) + AM_RANGE(0xFF60, 0xFF8F) AM_READWRITE(ff60_read, ff60_write) + AM_RANGE(0xFF90, 0xFFDF) AM_DEVREADWRITE(GIME_TAG, gime_base_device, read, write) + + // While Tepolt and other sources say that the interrupt vectors are mapped to + // the same memory accessed at $BFFx, William Astle offered evidence that this + // memory on a CoCo 3 is not the same. + // + // http://lost.l-w.ca/0x05/coco3-and-interrupt-vectors/ + AM_RANGE(0xFFE0, 0xFFFF) AM_ROM AM_REGION(MAINCPU_TAG, 0x7FE0) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( coco3_keyboard ) +//------------------------------------------------- +// +// CoCo 3 keyboard +// +// PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 +// PA6: Ent Clr Brk Alt Ctr F1 F2 Shift +// PA5: 8 9 : ; , - . / +// PA4: 0 1 2 3 4 5 6 7 +// PA3: X Y Z Up Dwn Lft Rgt Space +// PA2: P Q R S T U V W +// PA1: H I J K L M N O +// PA0: @ A B C D E F G +//------------------------------------------------- + +static INPUT_PORTS_START( coco3_keyboard ) + PORT_START("row0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("row1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("row2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("row3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("row4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("row5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHAR('_') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("row6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco3_joystick ) +//------------------------------------------------- + +static INPUT_PORTS_START( coco3_joystick ) + PORT_START(JOYSTICK_RX_TAG) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_START(JOYSTICK_RY_TAG) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_START(JOYSTICK_LX_TAG) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) + PORT_START(JOYSTICK_LY_TAG) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) + PORT_START(JOYSTICK_BUTTONS_TAG) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Right Button 1") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Right Button 1") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left Button 1") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Left Button 1") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco_rat_mouse ) +//------------------------------------------------- + +static INPUT_PORTS_START( coco_rat_mouse ) + PORT_START(RAT_MOUSE_RX_TAG) + PORT_BIT( 0x03, 0x00, IPT_MOUSE_X) PORT_NAME("Rat Mouse X (Right Port)") PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x02) + PORT_START(RAT_MOUSE_RY_TAG) + PORT_BIT( 0x03, 0x00, IPT_MOUSE_Y) PORT_NAME("Rat Mouse Y (Right Port)") PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x02) + PORT_START(RAT_MOUSE_LX_TAG) + PORT_BIT( 0x03, 0x00, IPT_MOUSE_X) PORT_NAME("Rat Mouse X (Left Port)") PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x20) + PORT_START(RAT_MOUSE_LY_TAG) + PORT_BIT( 0x03, 0x00, IPT_MOUSE_Y) PORT_NAME("Rat Mouse Y (Left Port)") PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x20) + PORT_START(RAT_MOUSE_BUTTONS_TAG) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Rat Mouse Button 1 (Right Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x02) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Rat Mouse Button 2 (Right Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x02) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Rat Mouse Button 1 (Left Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x20) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Rat Mouse Button 2 (Left Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x20) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco_lightgun ) +//------------------------------------------------- + +static INPUT_PORTS_START( coco_lightgun ) + PORT_START(DIECOM_LIGHTGUN_RX_TAG) + PORT_BIT( 0x1ff, 266, IPT_LIGHTGUN_X ) PORT_NAME("Lightgun X (Right Port)") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(116,416) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x03) + PORT_START(DIECOM_LIGHTGUN_RY_TAG) + PORT_BIT( 0xff, 121, IPT_LIGHTGUN_Y ) PORT_NAME("Lightgun Y (Right Port)") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0,242) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x03) + PORT_START(DIECOM_LIGHTGUN_LX_TAG) + PORT_BIT( 0x1ff, 266, IPT_LIGHTGUN_X ) PORT_NAME("Lightgun X (Left Port)") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(116,416) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x30) + PORT_START(DIECOM_LIGHTGUN_LY_TAG) + PORT_BIT( 0xff, 121, IPT_LIGHTGUN_Y ) PORT_NAME("Lightgun Y (Left Port)") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0,242) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x30) + PORT_START(DIECOM_LIGHTGUN_BUTTONS_TAG) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightgun Trigger (Right Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x03) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightgun Trigger (Left Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x30) +INPUT_PORTS_END + + + +//------------------------------------------------- +// INPUT_PORTS( coco3 ) +//------------------------------------------------- + +static INPUT_PORTS_START( coco3 ) + PORT_INCLUDE( coco3_keyboard ) + PORT_INCLUDE( coco3_joystick ) + PORT_INCLUDE( coco_analog_control ) + PORT_INCLUDE( coco_cart_autostart ) + PORT_INCLUDE( coco_rat_mouse ) + PORT_INCLUDE( coco_lightgun ) + PORT_INCLUDE( coco_rtc ) + PORT_INCLUDE( coco_beckerport ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START( printer ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +static MACHINE_CONFIG_START( coco3, coco3_state ) + // basic machine hardware + MCFG_CPU_ADD(MAINCPU_TAG, M6809E, XTAL_3_579545MHz) + MCFG_CPU_PROGRAM_MAP(coco3_mem) + + // devices + MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia0_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia0_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia0_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia0_cb2_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia0_irq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia0_irq_b)) + + MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(coco_state, pia1_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(coco_state, pia1_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia1_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia1_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia1_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia1_cb2_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia1_firq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia1_firq_b)) + + // Becker Port device + MCFG_DEVICE_ADD(DWSOCK_TAG, COCO_DWSOCK, 0) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(coco_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "printer") + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(PIA1_TAG, pia6821_device, ca1_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("printer", printer) + + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdcv11") + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + + MCFG_COCO_VHD_ADD(VHD0_TAG) + MCFG_COCO_VHD_ADD(VHD1_TAG) + + // video hardware + MCFG_DEFAULT_LAYOUT(layout_coco3) + + MCFG_DEVICE_ADD(GIME_TAG, GIME_NTSC, XTAL_3_579545MHz) + MCFG_GIME_MAINCPU(MAINCPU_TAG) + MCFG_GIME_RAM(RAM_TAG) + MCFG_GIME_EXT(CARTRIDGE_TAG) + MCFG_GIME_HSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, ca1_w)) + MCFG_GIME_FSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, cb1_w)) + MCFG_GIME_IRQ_CALLBACK(WRITELINE(coco3_state, gime_irq_w)) + MCFG_GIME_FIRQ_CALLBACK(WRITELINE(coco3_state, gime_firq_w)) + MCFG_GIME_FLOATING_BUS_CALLBACK(READ8(coco_state, floating_bus_read)) + + // composite monitor + MCFG_SCREEN_ADD(COMPOSITE_SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DRIVER(coco3_state, screen_update) + MCFG_SCREEN_SIZE(640, 243) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 1, 241-1) + MCFG_SCREEN_VBLANK_TIME(0) + + // RGB monitor + MCFG_SCREEN_ADD(RGB_SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DRIVER(coco3_state, screen_update) + MCFG_SCREEN_SIZE(640, 243) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 1, 241-1) + MCFG_SCREEN_VBLANK_TIME(0) + + // sound hardware + MCFG_FRAGMENT_ADD( coco_sound ) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_EXTRA_OPTIONS("128K,2M,8M") + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") + + MCFG_SOFTWARE_LIST_ADD("flop_list","coco_flop") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( coco3p, coco3 ) + MCFG_DEVICE_REPLACE(GIME_TAG, GIME_PAL, XTAL_4_433619MHz) + MCFG_GIME_MAINCPU(MAINCPU_TAG) + MCFG_GIME_RAM(RAM_TAG) + MCFG_GIME_EXT(CARTRIDGE_TAG) + MCFG_GIME_HSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, ca1_w)) + MCFG_GIME_FSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, cb1_w)) + MCFG_GIME_IRQ_CALLBACK(WRITELINE(coco3_state, gime_irq_w)) + MCFG_GIME_FIRQ_CALLBACK(WRITELINE(coco3_state, gime_firq_w)) + MCFG_GIME_FLOATING_BUS_CALLBACK(READ8(coco_state, floating_bus_read)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( coco3h, coco3 ) + MCFG_CPU_REPLACE(MAINCPU_TAG, HD6309, XTAL_3_579545MHz) + MCFG_CPU_PROGRAM_MAP(coco3_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( coco3dw1, coco3 ) + MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "cc3hdb1") +MACHINE_CONFIG_END + +//************************************************************************** +// ROMS +//************************************************************************** + +ROM_START(coco3) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("coco3.rom", 0x0000, 0x8000, CRC(b4c88d6c) SHA1(e0d82953fb6fd03768604933df1ce8bc51fc427d)) +ROM_END + +ROM_START(coco3p) + ROM_REGION(0x8000,MAINCPU_TAG,0) + ROM_LOAD("coco3p.rom", 0x0000, 0x8000, CRC(ff050d80) SHA1(631e383068b1f52a8f419f4114b69501b21cf379)) +ROM_END + +#define rom_coco3h rom_coco3 +#define rom_coco3dw1 rom_coco3 + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +COMP( 1986, coco3, coco, 0, coco3, coco3, driver_device, 0, "Tandy Radio Shack", "Color Computer 3 (NTSC)", 0) +COMP( 1986, coco3p, coco, 0, coco3p, coco3, driver_device, 0, "Tandy Radio Shack", "Color Computer 3 (PAL)", 0) +COMP( 19??, coco3h, coco, 0, coco3h, coco3, driver_device, 0, "Tandy Radio Shack", "Color Computer 3 (NTSC; HD6309)", MACHINE_UNOFFICIAL) +COMP( 19??, coco3dw1, coco, 0, coco3dw1, coco3, driver_device, 0, "Tandy Radio Shack", "Color Computer 3 (NTSC; HDB-DOS)", MACHINE_UNOFFICIAL) diff --git a/src/mame/drivers/codata.c b/src/mame/drivers/codata.c new file mode 100644 index 00000000000..91c7459f450 --- /dev/null +++ b/src/mame/drivers/codata.c @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Contel Codata Corporation Codata + + 2010-01-11 Skeleton driver. + 2013-08-26 Connected to a terminal. + + Chips: uPD7201C, AM9513, SCN68000. Crystal: 16 MHz + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class codata_state : public driver_device +{ +public: + codata_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_base(*this, "rambase"), + m_terminal(*this, TERMINAL_TAG), + m_maincpu(*this, "maincpu") + { + } + + DECLARE_READ16_MEMBER(keyin_r); + DECLARE_READ16_MEMBER(status_r); + DECLARE_WRITE8_MEMBER(kbd_put); +private: + UINT8 m_term_data; + virtual void machine_reset(); + required_shared_ptr m_p_base; + required_device m_terminal; + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(codata_mem, AS_PROGRAM, 16, codata_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("rambase") + AM_RANGE(0x200000, 0x203fff) AM_ROM AM_REGION("user1", 0); + AM_RANGE(0x400000, 0x403fff) AM_ROM AM_REGION("user1", 0x4000); + AM_RANGE(0x600000, 0x600001) AM_READ(keyin_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff00) + AM_RANGE(0x600002, 0x600003) AM_READ(status_r) + //AM_RANGE(0x600000, 0x600003) uPD7201 SIO + //AM_RANGE(0x800000, 0x800003) AM9513 5 channel timer + //AM_RANGE(0xa00000, 0xbfffff) page map (rw) + //AM_RANGE(0xc00000, 0xdfffff) segment map (rw), context register (r) + //AM_RANGE(0xe00000, 0xffffff) context register (w), 16-bit parallel input port (r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( codata ) +INPUT_PORTS_END + + +READ16_MEMBER( codata_state::keyin_r ) +{ + UINT16 ret = m_term_data; + m_term_data = 0; + return ret << 8; +} + +READ16_MEMBER( codata_state::status_r ) +{ + return (m_term_data) ? 0x500 : 0x400; +} + +WRITE8_MEMBER( codata_state::kbd_put ) +{ + m_term_data = data; +} + +void codata_state::machine_reset() +{ + UINT8* RAM = memregion("user1")->base(); + memcpy(m_p_base, RAM, 16); + m_term_data = 0; + m_maincpu->reset(); +} + +static MACHINE_CONFIG_START( codata, codata_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M68000, XTAL_16MHz / 2) + MCFG_CPU_PROGRAM_MAP(codata_mem) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(codata_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( codata ) + ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "27-0042-01a boot 00 u101 rev 3.6.2 9-28-83.u101", 0x0000, 0x2000, CRC(70014b16) SHA1(19a82000894d79817358d40ae520200e976be310)) + ROM_LOAD16_BYTE( "27-0043-01a boot 01 u102 rev 3.6.2 9-28-83.u102", 0x4000, 0x2000, CRC(fca9c314) SHA1(2f8970fad479000f28536003867066d6df9e33d9)) + ROM_LOAD16_BYTE( "27-0044-01a boot e0 u103 rev 3.6.2 9-28-83.u103", 0x0001, 0x2000, CRC(dc5d5cea) SHA1(b3e9248abf89d674c463d21d2f7be34508cf16c2)) + ROM_LOAD16_BYTE( "27-0045-01a boot e1 u104 rev 3.6.2 9-28-83.u104", 0x4001, 0x2000, CRC(a937e7b3) SHA1(d809bbd437fe7d925325958072b9e0dc33dd36a6)) + + ROM_REGION( 0x240, "proms", 0 ) + ROM_LOAD( "p0.u502", 0x0000, 0x0020, CRC(20eb1183) SHA1(9b268792b28d858d6b6a1b6c4148af88a8d6b735) ) + ROM_LOAD( "p1.u602", 0x0020, 0x0020, CRC(ee1e5a14) SHA1(0d3346cb3b647fa2475bd7b4fa36ea6ecfdaf805) ) + ROM_LOAD( "p2.u503", 0x0040, 0x0200, CRC(12d9a6be) SHA1(fca99f9c5afc630ac67cbd4e5ba4e5242b826848) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, codata, 0, 0, codata, codata, driver_device, 0, "Contel Codata Corporation", "Codata", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/coleco.c b/src/mame/drivers/coleco.c new file mode 100644 index 00000000000..5f6c020e33c --- /dev/null +++ b/src/mame/drivers/coleco.c @@ -0,0 +1,499 @@ +// license:BSD-3-Clause +// copyright-holders:Mike Balfour, Ben Bruscella, Sean Young +/******************************************************************************************************* + + coleco.c + + Driver file to handle emulation of the ColecoVision. + + Marat Fayzullin (ColEm source) + Marcel de Kogel (AdamEm source) + Mike Balfour + Ben Bruscella + Sean Young + + NEWS: + - Modified memory map, now it has only 1k of RAM mapped on 8k Slot + - Modified I/O map, now it is handled as on a real ColecoVision: + The I/O map is broken into 4 write and 4 read ports: + 80-9F (W) = Set both controllers to keypad mode + 80-9F (R) = Not Connected + + A0-BF (W) = Video Chip (TMS9928A), A0=0 -> Write Register 0 , A0=1 -> Write Register 1 + A0-BF (R) = Video Chip (TMS9928A), A0=0 -> Read Register 0 , A0=1 -> Read Register 1 + + C0-DF (W) = Set both controllers to joystick mode + C0-DF (R) = Not Connected + + E0-FF (W) = Sound Chip (SN76489A) + E0-FF (R) = Read Controller data, A1=0 -> read controller 1, A1=1 -> read controller 2 + + - Modified paddle handler, now it is handled as on a real ColecoVision + - Added support for a Roller Controller (Trackball), enabled via category + - Added support for two Super Action Controller, enabled via category + + EXTRA CONTROLLERS INFO: + + -Driving Controller (Expansion Module #2). It consist of a steering wheel and a gas pedal. Only one + can be used on a real ColecoVision. The gas pedal is not analog, internally it is just a switch. + On a real ColecoVision, when the Driving Controller is enabled, the controller 1 do not work because + have been replaced by the Driving Controller, and controller 2 have to be used to start game, gear + shift, etc. + Driving Controller is just a spinner on controller 1 socket similar to the one on Roller Controller + and Super Action Controllers so you can use Roller Controller or Super Action Controllers to play + games requiring Driving Controller. + + -Roller Controller. Basically a trackball with four buttons (the two fire buttons from player 1 and + the two fire buttons from player 2). Only one Roller Controller can be used on a real ColecoVision. + Roller Controller is connected to both controller sockets and both controllers are conected to the Roller + Controller, it uses the spinner pins of both sockets to generate the X and Y signals (X from controller 1 + and the Y from controller 2) + + -Super Action Controllers. It is a hand controller with a keypad, four buttons (the two from + the player pad and two more), and a spinner. This was made primarily for two player sport games, but + will work for every other ColecoVision game. + +*******************************************************************************************************/ + +/* + + TODO: + + - Dina SG-1000 mode + +*/ + +#include "includes/coleco.h" + + +/* Read/Write Handlers */ + +READ8_MEMBER( coleco_state::paddle_1_r ) +{ + return m_joy_d7_state[0] | coleco_paddle_read(0, m_joy_mode, m_joy_analog_state[0]); +} + +READ8_MEMBER( coleco_state::paddle_2_r ) +{ + return m_joy_d7_state[1] | coleco_paddle_read(1, m_joy_mode, m_joy_analog_state[1]); +} + +WRITE8_MEMBER( coleco_state::paddle_off_w ) +{ + m_joy_mode = 0; +} + +WRITE8_MEMBER( coleco_state::paddle_on_w ) +{ + m_joy_mode = 1; +} + + +/* Memory Maps */ + +static ADDRESS_MAP_START( coleco_map, AS_PROGRAM, 8, coleco_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x6000, 0x63ff) AM_RAM AM_MIRROR(0x1c00) AM_SHARE("ram") + AM_RANGE(0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( coleco_io_map, AS_IO, 8, coleco_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(paddle_off_w) + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) + AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(paddle_on_w) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1f) AM_DEVWRITE("sn76489a", sn76489a_device, write) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1d) AM_READ(paddle_1_r) + AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x1d) AM_READ(paddle_2_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( czz50_map, AS_PROGRAM, 8, coleco_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x6000, 0x63ff) AM_RAM AM_MIRROR(0x1c00) AM_SHARE("ram") + AM_RANGE(0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + + +/* Input Ports */ + +static INPUT_PORTS_START( czz50 ) + PORT_START("STD_KEYPAD1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("#") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('#') + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("*") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('*') + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0xb000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("STD_JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("STD_KEYPAD2") + PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0f00, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0xb000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("STD_JOY2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) +INPUT_PORTS_END + + +/* Interrupts */ + +WRITE_LINE_MEMBER(coleco_state::coleco_vdp_interrupt) +{ + // NMI on rising edge + if (state && !m_last_nmi_state) + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + + m_last_nmi_state = state; +} + +TIMER_CALLBACK_MEMBER(coleco_state::paddle_d7reset_callback) +{ + m_joy_d7_state[param] = 0; + m_joy_analog_state[param] = 0; +} + +TIMER_CALLBACK_MEMBER(coleco_state::paddle_irqreset_callback) +{ + m_joy_irq_state[param] = 0; + + if (!m_joy_irq_state[param ^ 1]) + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); +} + +TIMER_CALLBACK_MEMBER(coleco_state::paddle_pulse_callback) +{ + if (m_joy_analog_reload[param]) + { + m_joy_analog_state[param] = m_joy_analog_reload[param]; + + // on movement, controller port d7 is set for a short period and an irq is fired on d7 rising edge + m_joy_d7_state[param] = 0x80; + m_joy_d7_timer[param]->adjust(attotime::from_usec(500), param); // TODO: measure duration + + // irq on rising edge, PULSE_LINE is not supported in this case, so clear it manually + m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + m_joy_irq_timer[param]->adjust(attotime::from_usec(11), param); // TODO: measure duration + m_joy_irq_state[param] = 1; + + // reload timer + m_joy_pulse_timer[param]->adjust(m_joy_pulse_reload[param], param); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(coleco_state::paddle_update_callback) +{ + // arbitrary timer for reading analog controls + coleco_scan_paddles(&m_joy_analog_reload[0], &m_joy_analog_reload[1]); + + for (int port = 0; port < 2; port++) + { + if (m_joy_analog_reload[port]) + { + const int sensitivity = 500; + int ipt = m_joy_analog_reload[port]; + if (ipt & 0x80) ipt = 0x100 - ipt; + attotime freq = attotime::from_msec(sensitivity / ipt); + + // change pulse intervals relative to spinner/trackball speed + m_joy_pulse_reload[port] = freq; + m_joy_pulse_timer[port]->adjust(min(freq, m_joy_pulse_timer[port]->remaining()), port); + } + } +} + +READ8_MEMBER( coleco_state::cart_r ) +{ + return m_cart->bd_r(space, offset & 0x7fff, 0, 0, 0, 0, 0); +} + +UINT8 coleco_state::coleco_scan_paddles(UINT8 *joy_status0, UINT8 *joy_status1) +{ + UINT8 ctrl_sel = (m_ctrlsel != NULL) ? m_ctrlsel->read() : 0; + + /* which controller shall we read? */ + if ((ctrl_sel & 0x07) == 0x02) // Super Action Controller P1 + *joy_status0 = (m_sac_slide1 != NULL) ? m_sac_slide1->read() : 0; + else if ((ctrl_sel & 0x07) == 0x03) // Driving Controller P1 + *joy_status0 = (m_driv_wheel1 != NULL) ? m_driv_wheel1->read() : 0; + + if ((ctrl_sel & 0x70) == 0x20) // Super Action Controller P2 + *joy_status1 = (m_sac_slide2 != NULL) ? m_sac_slide2->read() : 0; + else if ((ctrl_sel & 0x70) == 0x30) // Driving Controller P2 + *joy_status1 = (m_driv_wheel2 != NULL) ? m_driv_wheel2->read() : 0; + + /* In principle, even if not supported by any game, I guess we could have two Super + Action Controllers plugged into the Roller controller ports. Since I found no info + about the behavior of sliders in such a configuration, we overwrite SAC sliders with + the Roller trackball inputs and actually use the latter ones, when both are selected. */ + if (ctrl_sel & 0x80) // Roller controller + { + *joy_status0 = (m_roller_x != NULL) ? m_roller_x->read() : 0; + *joy_status1 = (m_roller_y != NULL) ? m_roller_y->read() : 0; + } + + return *joy_status0 | *joy_status1; +} + + +UINT8 coleco_state::coleco_paddle_read(int port, int joy_mode, UINT8 joy_status) +{ + UINT8 ctrl_sel = (m_ctrlsel != NULL ) ? m_ctrlsel->read() : 0; + UINT8 ctrl_extra = ctrl_sel & 0x80; + ctrl_sel = ctrl_sel >> (port*4) & 7; + + /* Keypad and fire 1 (SAC Yellow Button) */ + if (joy_mode == 0) + { + /* No key pressed by default */ + UINT8 data = 0x0f; + UINT16 ipt = 0xffff; + + if (ctrl_sel == 0) // ColecoVision Controller + ipt = port ? m_std_keypad2->read() : m_std_keypad1->read(); + else if (ctrl_sel == 2) // Super Action Controller + ipt = port ? m_sac_keypad2->read() : m_sac_keypad1->read(); + + /* Numeric pad buttons are not independent on a real ColecoVision, if you push more + than one, a real ColecoVision think that it is a third button, so we are going to emulate + the right behaviour */ + /* Super Action Controller additional buttons are read in the same way */ + if (!(ipt & 0x0001)) data &= 0x0a; /* 0 */ + if (!(ipt & 0x0002)) data &= 0x0d; /* 1 */ + if (!(ipt & 0x0004)) data &= 0x07; /* 2 */ + if (!(ipt & 0x0008)) data &= 0x0c; /* 3 */ + if (!(ipt & 0x0010)) data &= 0x02; /* 4 */ + if (!(ipt & 0x0020)) data &= 0x03; /* 5 */ + if (!(ipt & 0x0040)) data &= 0x0e; /* 6 */ + if (!(ipt & 0x0080)) data &= 0x05; /* 7 */ + if (!(ipt & 0x0100)) data &= 0x01; /* 8 */ + if (!(ipt & 0x0200)) data &= 0x0b; /* 9 */ + if (!(ipt & 0x0400)) data &= 0x06; /* # */ + if (!(ipt & 0x0800)) data &= 0x09; /* * */ + if (!(ipt & 0x1000)) data &= 0x04; /* Blue Action Button */ + if (!(ipt & 0x2000)) data &= 0x08; /* Purple Action Button */ + + return ((ipt & 0x4000) >> 8) | 0x30 | data; + } + /* Joystick and fire 2 (SAC Red Button) */ + else + { + UINT8 data = 0x7f; + + if (ctrl_sel == 0) // ColecoVision Controller + data = port ? m_std_joy2->read() : m_std_joy1->read(); + else if (ctrl_sel == 2) // Super Action Controller + data = port ? m_sac_joy2->read() : m_sac_joy1->read(); + else if (ctrl_sel == 3) // Driving Controller + data = port ? m_driv_pedal2->read() : m_driv_pedal1->read(); + + /* If any extra analog contoller enabled */ + if (ctrl_extra || ctrl_sel == 2 || ctrl_sel == 3) + { + if (joy_status & 0x80) data ^= 0x30; + else if (joy_status) data ^= 0x10; + } + + return data & 0x7f; + } +} + +void coleco_state::machine_start() +{ + memset(m_ram, 0xff, m_ram.bytes()); // initialize RAM + + // init paddles + for (int port = 0; port < 2; port++) + { + m_joy_pulse_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_pulse_callback),this)); + m_joy_d7_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_d7reset_callback),this)); + m_joy_irq_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_irqreset_callback),this)); + + m_joy_irq_state[port] = 0; + m_joy_d7_state[port] = 0; + m_joy_analog_state[port] = 0; + } + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(coleco_state::cart_r),this)); + + save_item(NAME(m_joy_mode)); + save_item(NAME(m_last_nmi_state)); + save_item(NAME(m_joy_irq_state)); + save_item(NAME(m_joy_d7_state)); + save_item(NAME(m_joy_analog_state)); + save_item(NAME(m_joy_analog_reload)); +} + +void coleco_state::machine_reset() +{ + m_last_nmi_state = 0; +} + +//static int coleco_cart_verify(const UINT8 *cartdata, size_t size) +//{ +// int retval = IMAGE_VERIFY_FAIL; +// +// /* Verify the file is in Colecovision format */ +// if ((cartdata[0] == 0xAA) && (cartdata[1] == 0x55)) /* Production Cartridge */ +// retval = IMAGE_VERIFY_PASS; +// if ((cartdata[0] == 0x55) && (cartdata[1] == 0xAA)) /* "Test" Cartridge. Some games use this method to skip ColecoVision title screen and delay */ +// retval = IMAGE_VERIFY_PASS; +// +// return retval; +//} + + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( coleco, coleco_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_7_15909MHz/2) // 3.579545 MHz + MCFG_CPU_PROGRAM_MAP(coleco_map) + MCFG_CPU_IO_MAP(coleco_io_map) + + /* video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(coleco_state, coleco_vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("sn76489a", SN76489A, XTAL_7_15909MHz/2) // 3.579545 MHz + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* cartridge */ + MCFG_COLECOVISION_CARTRIDGE_SLOT_ADD(COLECOVISION_CARTRIDGE_SLOT_TAG, colecovision_cartridges, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","coleco") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("paddle_timer", coleco_state, paddle_update_callback, attotime::from_msec(20)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( colecop, coleco ) + + /* video hardware */ + MCFG_DEVICE_REMOVE("tms9928a") + MCFG_DEVICE_REMOVE("screen") + + MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(coleco_state, coleco_vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( czz50, coleco ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") // note: cpu speed unverified, assume it's the same as ColecoVision + MCFG_CPU_PROGRAM_MAP(czz50_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dina, czz50 ) + + /* video hardware */ + MCFG_DEVICE_REMOVE("tms9928a") + MCFG_DEVICE_REMOVE("screen") + + MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(coleco_state, coleco_vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) +MACHINE_CONFIG_END + + +/* ROMs */ + +ROM_START (coleco) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "original", "Original" ) + ROMX_LOAD( "313 10031-4005 73108a.u2", 0x0000, 0x2000, CRC(3aa93ef3) SHA1(45bedc4cbdeac66c7df59e9e599195c778d86a92), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "thick", "Thick characters" ) + // differences to 0x3aa93ef3 modified characters, added a pad 2 related fix + ROMX_LOAD( "colecoa.rom", 0x0000, 0x2000, CRC(39bb16fc) SHA1(99ba9be24ada3e86e5c17aeecb7a2d68c5edfe59), ROM_BIOS(2) ) +ROM_END + +/* ONYX (Prototype) + Unreleased Brazilian Colecovision clone by Microdigital. + + It was never released and the only known prototypes were uncovered by an ex-employee of Microdigital + called Cl??udio Cassens who donated it to collectors (Eduardo Luccas) in June 2015. + -- Felipe Sanches +*/ +ROM_START (onyx) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "onyx.rom", 0x0000, 0x2000, CRC(011c32e7) SHA1(f44263221e330b2590dffc1a6f43ed2591fe19be) ) +ROM_END + +/* PAL Colecovision BIOS + +Country: Italy +Serial number: C0039036 +Model number: 240020 +Circuit board: (C) 1983 91162 rev D + +Information about the chip + +Motorola logo +(C)1983 COLECO +R72114A +8317 */ + +ROM_START (colecop) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "r72114a_8317.u2", 0x0000, 0x2000, CRC(d393c0cc) SHA1(160077afb139943725c634d6539898db59f33657) ) +ROM_END + +ROM_START (svi603) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "svi603.rom", 0x0000, 0x2000, CRC(19e91b82) SHA1(8a30abe5ffef810b0f99b86db38b1b3c9d259b78) ) +ROM_END + +ROM_START( czz50 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "czz50.rom", 0x0000, 0x2000, CRC(4999abc6) SHA1(96aecec3712c94517103d894405bc98a7dafa440) ) + ROM_CONTINUE( 0x8000, 0x2000 ) +ROM_END + +#define rom_dina rom_czz50 +#define rom_prsarcde rom_czz50 + + +/* System Drivers */ + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +CONS( 1982, coleco, 0, 0, coleco, coleco, driver_device, 0, "Coleco", "ColecoVision (NTSC)", 0 ) +CONS( 1982, onyx, coleco, 0, coleco, coleco, driver_device, 0, "Microdigital", "Onyx (Brazil/Prototype)", 0 ) +CONS( 1983, colecop, coleco, 0, colecop, coleco, driver_device, 0, "Coleco", "ColecoVision (PAL)", 0 ) +CONS( 1983, svi603, coleco, 0, coleco, coleco, driver_device, 0, "Spectravideo", "SVI-603 Coleco Game Adapter", 0 ) +CONS( 1986, czz50, 0, coleco, czz50, czz50, driver_device, 0, "Bit Corporation", "Chuang Zao Zhe 50", 0 ) +CONS( 1988, dina, czz50, 0, dina, czz50, driver_device, 0, "Telegames", "Dina", 0 ) +CONS( 1988, prsarcde, czz50, 0, czz50, czz50, driver_device, 0, "Telegames", "Personal Arcade", 0 ) diff --git a/src/mame/drivers/compis.c b/src/mame/drivers/compis.c new file mode 100644 index 00000000000..f2f2921436c --- /dev/null +++ b/src/mame/drivers/compis.c @@ -0,0 +1,792 @@ +// license:??? +// copyright-holders:Per Ola Ingvarsson, Tomas Karlsson +/****************************************************************************** + + drivers/compis.c + machine driver + + Per Ola Ingvarsson + Tomas Karlsson + + Hardware: + - Intel 80186 CPU 8MHz, integrated DMA(8237?), PIC(8259?), PIT(8253?) + - Intel 80130 OSP Operating system processor (PIC 8259, PIT 8254) + - Intel 8274 MPSC Multi-protocol serial communications controller (NEC 7201) + - Intel 8255 PPI Programmable peripheral interface + - Intel 8253 PIT Programmable interval timer + - Intel 8251 USART Universal synchronous asynchronous receiver transmitter + - National 58174 Real-time clock (compatible with 58274) + Peripheral: + - Intel 82720 GDC Graphic display processor (NEC uPD 7220) + - Intel 8272 FDC Floppy disk controller (Intel iSBX-218A) + - Western Digital WD1002-05 Winchester controller + + Memory map: + + 00000-3FFFF RAM LMCS (Low Memory Chip Select) + 40000-4FFFF RAM MMCS 0 (Midrange Memory Chip Select) + 50000-5FFFF RAM MMCS 1 (Midrange Memory Chip Select) + 60000-6FFFF RAM MMCS 2 (Midrange Memory Chip Select) + 70000-7FFFF RAM MMCS 3 (Midrange Memory Chip Select) + 80000-EFFFF NOP + F0000-FFFFF ROM UMCS (Upper Memory Chip Select) + +18/08/2011 -[Robbbert] +- Modernised +- Removed F4 display, as the gfx is in different places per bios. +- Changed to monochrome, it usually had a greenscreen monitor, although some + were amber. +- Still doesn't work. +- Added a nasty hack to get a display on compis2 (wait 20 seconds) + + + ******************************************************************************/ + +#include "includes/compis.h" +#include "bus/rs232/rs232.h" + + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// tape_mon_w - +//------------------------------------------------- + +WRITE8_MEMBER( compis_state::tape_mon_w ) +{ + cassette_state state = BIT(data, 0) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED; + + m_cassette->change_state(state, CASSETTE_MASK_MOTOR); +} + + +//------------------------------------------------- +// isbx +//------------------------------------------------- + +READ16_MEMBER( compis_state::isbx0_tdma_r ) +{ + if (ACCESSING_BITS_0_7) + { + return m_mpsc->cd_ba_r(space, offset & 0x03); + } + else + { + m_isbx0->tdma_w(0); + m_isbx0->tdma_w(1); + + return 0xff; + } +} + +WRITE16_MEMBER( compis_state::isbx0_tdma_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_mpsc->cd_ba_w(space, offset & 0x03, data); + } + else + { + m_isbx0->tdma_w(0); + m_isbx0->tdma_w(1); + } +} + +READ16_MEMBER( compis_state::isbx1_tdma_r ) +{ + if (ACCESSING_BITS_0_7) + { + if (offset < 2) + return m_crtc->read(space, offset & 0x01); + else + // monochrome only, hblank? vblank? + if(offset == 2) + { + switch(m_unk_video) + { + case 0x04: + m_unk_video = 0x44; + break; + case 0x44: + m_unk_video = 0x64; + break; + default: + m_unk_video = 0x04; + break; + } + return m_unk_video; + } + else + return 0; + } + else + { + m_isbx1->tdma_w(0); + m_isbx1->tdma_w(1); + + return 0xff; + } +} + +WRITE16_MEMBER( compis_state::isbx1_tdma_w ) +{ + if (ACCESSING_BITS_0_7) + { + // 0x336 is likely the color plane register + if (offset < 2) m_crtc->write(space, offset & 0x01, data); + + } + else + { + m_isbx1->tdma_w(0); + m_isbx1->tdma_w(1); + } +} + +READ16_MEMBER( compis_state::isbx0_cs_r ) +{ + if (ACCESSING_BITS_0_7) + { + return m_isbx0->mcs0_r(space, offset); + } + else + { + return m_isbx0->mcs1_r(space, offset) << 8; + } +} + +WRITE16_MEMBER( compis_state::isbx0_cs_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_isbx0->mcs0_w(space, offset, data); + } + else + { + m_isbx0->mcs1_w(space, offset, data >> 8); + } +} + +READ16_MEMBER( compis_state::isbx0_dack_r ) +{ + if (ACCESSING_BITS_0_7) + { + return m_isbx0->mcs1_r(space, offset); + } + else + { + return m_isbx0->mdack_r(space, offset) << 8; + } +} + +WRITE16_MEMBER( compis_state::isbx0_dack_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_isbx0->mcs1_w(space, offset, data); + } + else + { + m_isbx0->mdack_w(space, offset, data >> 8); + } +} + +READ16_MEMBER( compis_state::isbx1_cs_r ) +{ + if (ACCESSING_BITS_0_7) + { + return m_isbx1->mcs0_r(space, offset); + } + else + { + return m_isbx1->mcs1_r(space, offset) << 8; + } +} + +WRITE16_MEMBER( compis_state::isbx1_cs_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_isbx1->mcs0_w(space, offset, data); + } + else + { + m_isbx1->mcs1_w(space, offset, data >> 8); + } +} + +READ16_MEMBER( compis_state::isbx1_dack_r ) +{ + if (ACCESSING_BITS_0_7) + { + return m_isbx1->mcs1_r(space, offset); + } + else + { + return m_isbx1->mdack_r(space, offset) << 8; + } +} + +WRITE16_MEMBER( compis_state::isbx1_dack_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_isbx1->mcs1_w(space, offset, data); + } + else + { + m_isbx1->mdack_w(space, offset, data >> 8); + } +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( compis_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( compis_mem, AS_PROGRAM, 16, compis_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x1ffff) AM_RAM + AM_RANGE(0x60000, 0x63fff) AM_MIRROR(0x1c000) AM_DEVICE(I80130_TAG, i80130_device, rom_map) + AM_RANGE(0xe0000, 0xeffff) AM_MIRROR(0x10000) AM_ROM AM_REGION(I80186_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( compis2_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( compis2_mem, AS_PROGRAM, 16, compis_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0xbffff) AM_RAM + AM_RANGE(0xe0000, 0xeffff) AM_MIRROR(0x10000) AM_ROM AM_REGION(I80186_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( compis_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( compis_io, AS_IO, 16, compis_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0007) /* PCS0 */ AM_MIRROR(0x78) AM_DEVREADWRITE8(I8255_TAG, i8255_device, read, write, 0xff00) + AM_RANGE(0x0080, 0x0087) /* PCS1 */ AM_MIRROR(0x78) AM_DEVREADWRITE8(I8253_TAG, pit8253_device, read, write, 0x00ff) + AM_RANGE(0x0100, 0x011f) /* PCS2 */ AM_MIRROR(0x60) AM_DEVREADWRITE8(MM58174A_TAG, mm58274c_device, read, write, 0x00ff) + //AM_RANGE(0x0180, 0x0181) /* PCS3 */ AM_MIRROR(0x7e) + //AM_RANGE(0x0200, 0x0201) /* PCS4 */ AM_MIRROR(0x7e) + AM_RANGE(0x0280, 0x028f) /* PCS5 */ AM_MIRROR(0x70) AM_DEVICE(I80130_TAG, i80130_device, io_map) + AM_RANGE(0x0300, 0x0301) /* PCS6:0 */ AM_MIRROR(0xe) AM_WRITE8(tape_mon_w, 0x00ff) + AM_RANGE(0x0310, 0x0311) /* PCS6:3 */ AM_MIRROR(0xc) AM_DEVREADWRITE8(I8251A_TAG, i8251_device, data_r, data_w, 0xff00) + AM_RANGE(0x0312, 0x0313) /* PCS6:3 */ AM_MIRROR(0xc) AM_DEVREADWRITE8(I8251A_TAG, i8251_device, status_r, control_w, 0xff00) + AM_RANGE(0x0320, 0x032f) AM_READWRITE(isbx0_tdma_r, isbx0_tdma_w) + AM_RANGE(0x0330, 0x033f) AM_READWRITE(isbx1_tdma_r, isbx1_tdma_w) + AM_RANGE(0x0340, 0x034f) AM_READWRITE(isbx0_cs_r, isbx0_cs_w) + AM_RANGE(0x0350, 0x035f) AM_READWRITE(isbx0_dack_r, isbx0_dack_w) + AM_RANGE(0x0360, 0x036f) AM_READWRITE(isbx1_cs_r, isbx1_cs_w) + AM_RANGE(0x0370, 0x037f) AM_READWRITE(isbx1_dack_r, isbx1_dack_w) +#ifdef NOT_SUPPORTED_BY_MAME_CORE + AM_RANGE(0x0300, 0x0301) /* PCS6:1 */ AM_MIRROR(0xe) AM_DEVREADWRITE8("upd7220", upd7220_device, dack_r, dack_w, 0xff00) // DMA-ACK graphics + AM_RANGE(0x0310, 0x0311) /* PCS6:2 */ AM_MIRROR(0xe) AM_DEVREAD8(I8274_TAG, i8274_device, inta_r, 0x00ff) // 8274 INTERRUPT ACKNOWLEDGE + AM_RANGE(0x0320, 0x0323) /* PCS6:4 */ AM_MIRROR(0xc) AM_DEVREADWRITE8(I8274_TAG, i8274_device, cd_ba_r, cd_ba_w, 0x00ff) + AM_RANGE(0x0320, 0x0321) /* PCS6:5 */ AM_MIRROR(0xe) AM_READWRITE8(isbx0_tdma_r, isbx0_tdma_w, 0xff00) // DMA-TERMINATE J8 (iSBX0) + AM_RANGE(0x0330, 0x0333) /* PCS6:6 */ AM_DEVREADWRITE8("upd7220", upd7220_device, read, write, 0x00ff) + AM_RANGE(0x0330, 0x0331) /* PCS6:7 */ AM_MIRROR(0xe) AM_READWRITE8(isbx1_tdma_r, isbx1_tdma_w, 0xff00) // DMA-TERMINATE J9 (iSBX1) + AM_RANGE(0x0340, 0x034f) /* PCS6:8 */ AM_DEVREADWRITE8(ISBX_0_TAG, isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) // 8272 CS0 (8/16-bit) J8 (iSBX0) + AM_RANGE(0x0340, 0x034f) /* PCS6:9 */ AM_DEVREADWRITE8(ISBX_0_TAG, isbx_slot_device, mcs1_r, mcs1_w, 0xff00) // CS1 (16-bit) J8 (iSBX0) + AM_RANGE(0x0350, 0x035f) /* PCS6:10 */ AM_DEVREADWRITE8(ISBX_0_TAG, isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) // CS1 (8-bit) J8 (iSBX0) + AM_RANGE(0x0350, 0x035f) /* PCS6:11 */ AM_DEVREADWRITE8(ISBX_0_TAG, isbx_slot_device, mdack_r, mdack_w, 0xff00) // DMA-ACK J8 (iSBX0) + AM_RANGE(0x0360, 0x036f) /* PCS6:13 */ AM_DEVREADWRITE8(ISBX_1_TAG, isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) // CS0 (8/16-bit) J9 (iSBX1) + AM_RANGE(0x0360, 0x036f) /* PCS6:13 */ AM_DEVREADWRITE8(ISBX_1_TAG, isbx_slot_device, mcs1_r, mcs1_w, 0xff00) // CS1 (16-bit) J9 (iSBX1) + AM_RANGE(0x0370, 0x037f) /* PCS6:14 */ AM_DEVREADWRITE8(ISBX_1_TAG, isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) // CS1 (8-bit) J9 (iSBX1) + AM_RANGE(0x0370, 0x037f) /* PCS6:15 */ AM_DEVREADWRITE8(ISBX_1_TAG, isbx_slot_device, mdack_r, mdack_w, 0xff00) // DMA-ACK J9 (iSBX1) +#endif +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( upd7220_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( upd7220_map, AS_0, 16, compis_state ) + ADDRESS_MAP_GLOBAL_MASK(0x7fff) + AM_RANGE(0x00000, 0x7fff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( compis ) +//------------------------------------------------- + +static INPUT_PORTS_START( compis ) + PORT_START("S1") + PORT_CONFNAME( 0x01, 0x00, "S1 ROM Type") + PORT_CONFSETTING( 0x00, "27128" ) + PORT_CONFSETTING( 0x01, "27256" ) + + PORT_START("S2") + PORT_CONFNAME( 0x01, 0x00, "S2 IC36/IC40") + PORT_CONFSETTING( 0x00, "ROM" ) + PORT_CONFSETTING( 0x01, "RAM" ) + + PORT_START("S3") + PORT_CONFNAME( 0x03, 0x00, "S3 J4 RxC") + PORT_CONFSETTING( 0x00, "DCE" ) + PORT_CONFSETTING( 0x01, "Tmr3" ) + PORT_CONFSETTING( 0x02, "Tmr4" ) + + PORT_START("S4") + PORT_CONFNAME( 0x01, 0x01, "S4 iSBX0 Bus Width") + PORT_CONFSETTING( 0x00, "8 Bit" ) + PORT_CONFSETTING( 0x01, "16 Bit" ) + + PORT_START("S5") + PORT_CONFNAME( 0x01, 0x01, "S5 iSBX1 Bus Width") + PORT_CONFSETTING( 0x00, "8 Bit" ) + PORT_CONFSETTING( 0x01, "16 Bit" ) + + PORT_START("S6") + PORT_CONFNAME( 0x001, 0x001, "S6 INT 8274") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x001, DEF_STR( On ) ) + PORT_CONFNAME( 0x002, 0x000, "S6 TxRDY 8251") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x002, DEF_STR( On ) ) + PORT_CONFNAME( 0x004, 0x000, "S6 INT KB") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x004, DEF_STR( On ) ) + PORT_CONFNAME( 0x008, 0x008, "S6 DELAY 80150") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x008, DEF_STR( On ) ) + PORT_CONFNAME( 0x010, 0x000, "S6 INT0 iSBX1 (J9)") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x010, DEF_STR( On ) ) + PORT_CONFNAME( 0x020, 0x000, "S6 INT1 iSBX1 (J9)") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x020, DEF_STR( On ) ) + PORT_CONFNAME( 0x040, 0x040, "S6 ACK J7") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x040, DEF_STR( On ) ) + PORT_CONFNAME( 0x080, 0x000, "S6 SYSTICK 80150") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x080, DEF_STR( On ) ) + PORT_CONFNAME( 0x100, 0x100, "S6 RxRDY 8251") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x100, DEF_STR( On ) ) + PORT_CONFNAME( 0x200, 0x000, "S6 INT0 iSBX0 (J8)") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x200, DEF_STR( On ) ) + PORT_CONFNAME( 0x400, 0x400, "S6 INT1 iSBX0 (J8)") + PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x400, DEF_STR( On ) ) + + PORT_START("S7") + PORT_CONFNAME( 0x01, 0x00, "S7 ROM Type") + PORT_CONFSETTING( 0x00, "27128" ) + PORT_CONFSETTING( 0x01, "27256" ) + + PORT_START("S8") + PORT_CONFNAME( 0x18, 0x00, "S8 Test Mode") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x08, "Remote Test" ) + PORT_CONFSETTING( 0x10, "Standalone Test" ) + PORT_CONFSETTING( 0x18, "Reserved" ) + + PORT_START("S9") + PORT_CONFNAME( 0x03, 0x00, "S9 8274 TxCB") + PORT_CONFSETTING( 0x00, "DCE-Rxc (J4-11)" ) + PORT_CONFSETTING( 0x01, "DCE-Txc (J4-13)" ) + PORT_CONFSETTING( 0x02, "Tmr3" ) + + PORT_START("S10") + PORT_CONFNAME( 0x01, 0x01, "S10 8274 RxCA") + PORT_CONFSETTING( 0x00, "DCE (J2-11)" ) + PORT_CONFSETTING( 0x01, "Tmr5" ) + + PORT_START("S11") + PORT_CONFNAME( 0x03, 0x01, "S11 8274 TxCA") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, "DCE (J2-13)" ) + PORT_CONFSETTING( 0x02, "Tmr5" ) + + PORT_START("S12") + PORT_CONFNAME( 0x01, 0x01, "S12 8274 TxDA") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, "V24 (J2)" ) + + PORT_START("S13") + PORT_CONFNAME( 0x01, 0x01, "S13 8274 RxDA") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, "V24 (J2)" ) + + PORT_START("S14") + PORT_CONFNAME( 0x01, 0x01, "S14 8274 TxCA") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + + PORT_START("S15") + PORT_CONFNAME( 0x01, 0x00, "S15 Network") + PORT_CONFSETTING( 0x00, "Server" ) + PORT_CONFSETTING( 0x01, "Client" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// UPD7220_INTERFACE( hgdc_intf ) +//------------------------------------------------- + +UPD7220_DISPLAY_PIXELS_MEMBER( compis_state::hgdc_display_pixels ) +{ + UINT16 i,gfx = m_video_ram[(address & 0x7fff) >> 1]; + const pen_t *pen = m_palette->pens(); + + for(i=0; i<16; i++) + bitmap.pix32(y, x + i) = pen[BIT(gfx, i)]; +} + + +//------------------------------------------------- +// I80186_INTERFACE( cpu_intf ) +//------------------------------------------------- + +READ8_MEMBER( compis_state::compis_irq_callback ) +{ + return m_osp->inta_r(); +} + +WRITE_LINE_MEMBER( compis_state::tmr0_w ) +{ + m_tmr0 = state; + + m_cassette->output(m_tmr0 ? -1 : 1); + + m_maincpu->tmrin0_w(state); +} + +WRITE_LINE_MEMBER( compis_state::tmr1_w ) +{ + m_isbx0->mclk_w(state); + m_isbx1->mclk_w(state); + + m_maincpu->tmrin1_w(state); +} + + +//------------------------------------------------- +// I80130_INTERFACE( osp_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( compis_state::tmr2_w ) +{ + m_uart->write_rxc(state); + m_uart->write_txc(state); +} + + +WRITE_LINE_MEMBER( compis_state::tmr5_w ) +{ + m_mpsc->rxca_w(state); + m_mpsc->txca_w(state); +} + +//------------------------------------------------- +// I8255A interface +//------------------------------------------------- + +WRITE_LINE_MEMBER(compis_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER(compis_state::write_centronics_select) +{ + m_centronics_select = state; +} + +READ8_MEMBER( compis_state::ppi_pb_r ) +{ + /* + + bit description + + 0 J5-4 + 1 J5-5 + 2 J6-3 Cassette read + 3 J2-6 DSR / S8-4 Test + 4 J4-6 DSR / S8-3 Test + 5 J7-11 Centronics BUSY + 6 J7-13 Centronics SELECT + 7 Tmr0 + + */ + + UINT8 data = 0; + + /* DIP switch - Test mode */ + data = m_s8->read(); + + // cassette + data |= (m_cassette->input() > 0.0) << 2; + + /* Centronics busy */ + data |= m_centronics_busy << 5; + data |= m_centronics_select << 6; + + // TMR0 + data |= m_tmr0 << 7; + + return data; +} + +WRITE8_MEMBER( compis_state::ppi_pc_w ) +{ + /* + + bit description + + 0 J5-1 + 1 J5-2 + 2 Select: 1=time measure, DSR from J2/J4 pin 6. 0=read cassette + 3 Datex: Tristate datex output (low) + 4 V2-5 Floppy motor on/off + 5 J7-1 Centronics STROBE + 6 V2-4 Floppy Soft reset + 7 V2-3 Floppy Terminal count + + */ + + m_isbx0->opt1_w(BIT(data, 4)); + + m_centronics->write_strobe(BIT(data, 5)); + + if (BIT(data, 6)) + { + m_isbx0->reset(); + } + + m_isbx0->opt0_w(BIT(data, 7)); +} + +TIMER_DEVICE_CALLBACK_MEMBER( compis_state::tape_tick ) +{ + m_maincpu->tmrin0_w(m_cassette->input() > 0.0); +} + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// machine_start +//------------------------------------------------- + +void compis_state::machine_start() +{ + if (m_ram->size() == 256*1024) + { + m_maincpu->space(AS_PROGRAM).install_ram(0x20000, 0x3ffff, NULL); + } +} + + +//------------------------------------------------- +// machine_reset +//------------------------------------------------- + +void compis_state::machine_reset() +{ + m_uart->reset(); + m_mpsc->reset(); + m_ppi->reset(); + m_isbx0->reset(); + m_isbx1->reset(); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( compis ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( compis, compis_state ) + // basic machine hardware + MCFG_CPU_ADD(I80186_TAG, I80186, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(compis_mem) + MCFG_CPU_IO_MAP(compis_io) + MCFG_80186_IRQ_SLAVE_ACK(DEVREAD8(DEVICE_SELF, compis_state, compis_irq_callback)) + MCFG_80186_TMROUT0_HANDLER(DEVWRITELINE(DEVICE_SELF, compis_state, tmr0_w)) + MCFG_80186_TMROUT1_HANDLER(DEVWRITELINE(DEVICE_SELF, compis_state, tmr1_w)) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) + MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) + + MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4_433619MHz/2) // unknown clock + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(compis_state, hgdc_display_pixels) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + // devices + MCFG_DEVICE_ADD(I80130_TAG, I80130, XTAL_16MHz/2) + MCFG_I80130_IRQ_CALLBACK(DEVWRITELINE(I80186_TAG, i80186_cpu_device, int0_w)) + //MCFG_I80130_SYSTICK_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir3_w)) + MCFG_I80130_DELAY_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir7_w)) + MCFG_I80130_BAUD_CALLBACK(WRITELINE(compis_state, tmr2_w)) + + MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_16MHz/8) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8274_TAG, i8274_device, rxtxcb_w)) + MCFG_PIT8253_CLK1(XTAL_16MHz/8) + MCFG_PIT8253_CLK2(XTAL_16MHz/8) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(compis_state, tmr5_w)) + + MCFG_DEVICE_ADD(I8255_TAG, I8255, 0) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_IN_PORTB_CB(READ8(compis_state, ppi_pb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(compis_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(COMPIS_KEYBOARD_TAG, compis_keyboard_device, si_w)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(I80130_TAG, i80130_device, ir2_w)) + //MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I80186_TAG, i80186_cpu_device, int1_w)) + + MCFG_DEVICE_ADD(COMPIS_KEYBOARD_TAG, COMPIS_KEYBOARD, 0) + MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) + + MCFG_I8274_ADD(I8274_TAG, XTAL_16MHz/4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE(I80186_TAG, i80186_cpu_device, int3_w)) + + MCFG_DEVICE_ADD(MM58174A_TAG, MM58274C, 0) + MCFG_MM58274C_MODE24(0) // 12 hour + MCFG_MM58274C_DAY1(1) // monday + + MCFG_CASSETTE_ADD(CASSETTE_TAG) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", compis_state, tape_tick, attotime::from_hz(44100)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, ctsa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, dcdb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, ctsb_w)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(compis_state, write_centronics_busy)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(compis_state, write_centronics_select)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_ISBX_SLOT_ADD(ISBX_0_TAG, 0, isbx_cards, "fdc") + MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir1_w)) + MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir0_w)) + MCFG_ISBX_SLOT_MDRQT_CALLBACK(DEVWRITELINE(I80186_TAG, i80186_cpu_device, drq0_w)) + MCFG_ISBX_SLOT_ADD(ISBX_1_TAG, 0, isbx_cards, NULL) + MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir6_w)) + MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir5_w)) + MCFG_ISBX_SLOT_MDRQT_CALLBACK(DEVWRITELINE(I80186_TAG, i80186_cpu_device, drq1_w)) + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "compis") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("256K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( compis2 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( compis2, compis ) + // basic machine hardware + MCFG_CPU_MODIFY(I80186_TAG) + MCFG_CPU_PROGRAM_MAP(compis2_mem) + // TODO 8087 + + // devices + // TODO 525hd drives + + // internal ram + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("768K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( compis ) +//------------------------------------------------- + +ROM_START( compis ) + ROM_REGION16_LE( 0x10000, I80186_TAG, 0 ) + ROM_DEFAULT_BIOS( "v303" ) + + ROM_SYSTEM_BIOS( 0, "v20", "Compis v2.0 (1985-05-15)" ) + ROMX_LOAD( "sa883003.u40", 0x0000, 0x4000, CRC(195ef6bf) SHA1(eaf8ae897e1a4b62d3038ff23777ce8741b766ef), ROM_BIOS(1) | ROM_SKIP(1) ) + ROMX_LOAD( "sa883003.u36", 0x0001, 0x4000, CRC(7c918f56) SHA1(8ba33d206351c52f44f1aa76cc4d7f292dcef761), ROM_BIOS(1) | ROM_SKIP(1) ) + ROMX_LOAD( "sa883003.u39", 0x8000, 0x4000, CRC(3cca66db) SHA1(cac36c9caa2f5bb42d7a6d5b84f419318628935f), ROM_BIOS(1) | ROM_SKIP(1) ) + ROMX_LOAD( "sa883003.u35", 0x8001, 0x4000, CRC(43c38e76) SHA1(f32e43604107def2c2259898926d090f2ed62104), ROM_BIOS(1) | ROM_SKIP(1) ) + + ROM_SYSTEM_BIOS( 1, "v302", "Compis II v3.02 (1986-09-09)" ) + ROMX_LOAD( "comp302.u39", 0x0000, 0x8000, CRC(16a7651e) SHA1(4cbd4ba6c6c915c04dfc913ec49f87c1dd7344e3), ROM_BIOS(2) | ROM_SKIP(1) ) + ROMX_LOAD( "comp302.u35", 0x0001, 0x8000, CRC(ae546bef) SHA1(572e45030de552bb1949a7facbc885b8bf033fc6), ROM_BIOS(2) | ROM_SKIP(1) ) + + ROM_SYSTEM_BIOS( 2, "v303", "Compis II v3.03 (1987-03-09)" ) + ROMX_LOAD( "rysa094.u39", 0x0000, 0x8000, CRC(e7302bff) SHA1(44ea20ef4008849af036c1a945bc4f27431048fb), ROM_BIOS(3) | ROM_SKIP(1) ) + ROMX_LOAD( "rysa094.u35", 0x0001, 0x8000, CRC(b0694026) SHA1(eb6b2e3cb0f42fd5ffdf44f70e652ecb9714ce30), ROM_BIOS(3) | ROM_SKIP(1) ) +ROM_END + +#define rom_compis2 rom_compis + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP(1985, compis, 0, 0, compis, compis, driver_device, 0, "Telenova", "Compis" , MACHINE_NOT_WORKING ) +COMP(1986, compis2, compis, 0, compis2, compis, driver_device, 0, "Telenova", "Compis II" , MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/compucolor.c b/src/mame/drivers/compucolor.c new file mode 100644 index 00000000000..2286c43f10f --- /dev/null +++ b/src/mame/drivers/compucolor.c @@ -0,0 +1,506 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Compucolor II + + http://www.compucolor.org/index.html + +*/ + +/* + + TODO: + + - floppy + - interlaced video + - add-on ROM + - add-on RAM + - add-on unit + +*/ + +#define I8080_TAG "ua2" +#define TMS5501_TAG "ud2" +#define CRT5027_TAG "uf9" +#define RS232_TAG "rs232" + +#include "bus/rs232/rs232.h" +#include "cpu/i8085/i8085.h" +#include "bus/compucolor/floppy.h" +#include "machine/ram.h" +#include "machine/tms5501.h" +#include "video/tms9927.h" + +class compucolor2_state : public driver_device +{ +public: + compucolor2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I8080_TAG), + m_mioc(*this, TMS5501_TAG), + m_vtac(*this, CRT5027_TAG), + m_palette(*this, "palette"), + m_rs232(*this, RS232_TAG), + m_floppy0(*this, "cd0"), + m_floppy1(*this, "cd1"), + m_char_rom(*this, "chargen"), + m_video_ram(*this, "videoram"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_y10(*this, "Y10"), + m_y11(*this, "Y11"), + m_y12(*this, "Y12"), + m_y13(*this, "Y13"), + m_y14(*this, "Y14"), + m_y15(*this, "Y15"), + m_y128(*this, "Y128") + { } + + required_device m_maincpu; + required_device m_mioc; + required_device m_vtac; + required_device m_palette; + required_device m_rs232; + required_device m_floppy0; + required_device m_floppy1; + required_memory_region m_char_rom; + required_shared_ptr m_video_ram; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_y10; + required_ioport m_y11; + required_ioport m_y12; + required_ioport m_y13; + required_ioport m_y14; + required_ioport m_y15; + required_ioport m_y128; + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( xi_r ); + DECLARE_WRITE8_MEMBER( xo_w ); + DECLARE_WRITE_LINE_MEMBER( xmt_w ); + + IRQ_CALLBACK_MEMBER( int_ack ); + + UINT8 m_xo; +}; + +static ADDRESS_MAP_START( compucolor2_mem, AS_PROGRAM, 8, compucolor2_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION(I8080_TAG, 0) + AM_RANGE(0x6000, 0x6fff) AM_MIRROR(0x1000) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( compucolor2_io, AS_IO, 8, compucolor2_state ) + AM_RANGE(0x00, 0x0f) AM_MIRROR(0x10) AM_DEVICE(TMS5501_TAG, tms5501_device, io_map) + AM_RANGE(0x60, 0x6f) AM_MIRROR(0x10) AM_DEVREADWRITE(CRT5027_TAG, crt5027_device, read, write) + AM_RANGE(0x80, 0x9f) AM_MIRROR(0x60) AM_ROM AM_REGION("ua1", 0) +ADDRESS_MAP_END + +static INPUT_PORTS_START( compucolor2 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ CRT") PORT_CHAR('_') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F15 PLOT ESC") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BL/A7 OFF") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BLINK ON") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("^ USER") PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F14 CHAR RECT") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A7 ON") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BG ON") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("m M TERM MODE") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("] BLCK") PORT_CHAR(']') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F13 POINT X") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FG ON") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("l L LOCL") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ 45 UP") PORT_CHAR('\\') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F12 POINT Y") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE PAGE") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("k K ROLL") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ VIS") PORT_CHAR('[') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F11 POINT INC") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE LINE") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("z Z 45 DW") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 X BAR XO") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad X") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("y Y TEST") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 X BAR Y") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("h H HALF") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("x X XMIT") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 X BAR XM") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("g G BELL") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("w W BASIC") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 X BAR INC") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LIST") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("v V DEL LINE") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 Y BAR YO") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("POKE") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("e E BSC RST") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("u U INS LINE") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 Y BAR X") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AUTO") PORT_CODE(KEYCODE_PGDN) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("d D DISK FCS") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("t T TEXT EDIT") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 Y BAR YM") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE CHAR") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOAD") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y12") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("c C CURSOR X-Y") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("s S ASMB") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 Y BAR INC") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT LINE") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SAVE") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y13") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("b B PLOT") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("r R BAUD RATE") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 VECT X1") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE LINE") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PLOT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y14") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("a A PROT BLND") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("q Q INS CHAR") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 VECT Y1") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT CHAR") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PUT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y15") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@ NULL") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("p P CPU OP SYS") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F0 VECT INC") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK ATTN") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("OUT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y128") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CPU RESET") + PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPEAT") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) +INPUT_PORTS_END + +UINT32 compucolor2_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + for (int y = 0; y < 32*8; y++) + { + offs_t offset = (y / 8) * 128; + + for (int sx = 0; sx < 64; sx++) + { + UINT8 code = m_video_ram[offset++]; + UINT8 attr = m_video_ram[offset++]; + + offs_t char_offs = ((code & 0x7f) << 3) | (y & 0x07); + if (BIT(code, 7)) char_offs = ((code & 0x7f) << 3) | ((y >> 1) & 0x07); + + UINT8 data = m_char_rom->base()[char_offs]; + + rgb_t fg = m_palette->pen_color(attr & 0x07); + rgb_t bg = m_palette->pen_color((attr >> 3) & 0x07); + + for (int x = 0; x < 6; x++) + { + bitmap.pix32(y, (sx * 6) + x) = BIT(data, 7) ? fg : bg; + + data <<= 1; + } + } + } + + return 0; +} + +READ8_MEMBER( compucolor2_state::xi_r ) +{ + UINT8 data = 0xff; + + switch ((m_xo >> 4) & 0x03) + { + case 0: + switch (m_xo & 0x0f) + { + case 0: data &= m_y0->read(); break; + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 9: data &= m_y9->read(); break; + case 10: data &= m_y10->read(); break; + case 11: data &= m_y11->read(); break; + case 12: data &= m_y12->read(); break; + case 13: data &= m_y13->read(); break; + case 14: data &= m_y14->read(); break; + case 15: data &= m_y15->read(); break; + } + + if (BIT(m_xo, 7)) + { + data = (m_y128->read() & 0xf0) | (data & 0x0f); + } + break; + + default: + data = 0; + } + + return data; +} + +WRITE8_MEMBER( compucolor2_state::xo_w ) +{ + /* + + bit description + + 0 Keyboard A0, Stepper Phase 0 + 1 Keyboard A1, Stepper Phase 1 + 2 Keyboard A2, Stepper Phase 2 + 3 Keyboard A3, Disk _R/W + 4 00=Keyboard/Modem, 01=Internal Drive (CD0), 10=External Drive (CD1) + 5 ^ + 6 LED + 7 0=Normal Keyboard, 1=SHIFT/CONTROL/REPEAT/CAPS LOCK + + */ + + m_xo = data; + + switch ((m_xo >> 4) & 0x03) + { + case 1: + m_floppy0->select_w(0); + m_floppy0->rw_w(BIT(data, 3)); + m_floppy0->stepper_w(data & 0x07); + + m_floppy1->select_w(1); + break; + + case 2: + m_floppy1->select_w(0); + m_floppy1->rw_w(BIT(data, 3)); + m_floppy1->stepper_w(data & 0x07); + + m_floppy0->select_w(1); + break; + } +} + +WRITE_LINE_MEMBER( compucolor2_state::xmt_w ) +{ + switch ((m_xo >> 4) & 0x03) + { + case 0: + m_rs232->write_txd(state); + break; + + case 1: + m_floppy0->write_txd(state); + break; + + case 2: + m_floppy1->write_txd(state); + break; + } +} + +IRQ_CALLBACK_MEMBER( compucolor2_state::int_ack ) +{ + return m_mioc->get_vector(); +} + +void compucolor2_state::machine_start() +{ + // state saving + save_item(NAME(m_xo)); +} + +void compucolor2_state::machine_reset() +{ + m_rs232->write_rts(1); + m_rs232->write_dtr(1); +} + +static MACHINE_CONFIG_START( compucolor2, compucolor2_state ) + // basic machine hardware + MCFG_CPU_ADD(I8080_TAG, I8080, XTAL_17_9712MHz/9) + MCFG_CPU_PROGRAM_MAP(compucolor2_mem) + MCFG_CPU_IO_MAP(compucolor2_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(compucolor2_state,int_ack) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) + MCFG_SCREEN_UPDATE_DRIVER(compucolor2_state, screen_update) + MCFG_SCREEN_SIZE(64*6, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1) + + MCFG_PALETTE_ADD_3BIT_RGB("palette") + + MCFG_DEVICE_ADD(CRT5027_TAG, CRT5027, XTAL_17_9712MHz/2) + MCFG_TMS9927_CHAR_WIDTH(6) + MCFG_TMS9927_VSYN_CALLBACK(DEVWRITELINE(TMS5501_TAG, tms5501_device, sens_w)) + MCFG_VIDEO_SET_SCREEN("screen") + + // devices + MCFG_DEVICE_ADD(TMS5501_TAG, TMS5501, XTAL_17_9712MHz/9) + MCFG_TMS5501_IRQ_CALLBACK(INPUTLINE(I8080_TAG, I8085_INTR_LINE)) + MCFG_TMS5501_XMT_CALLBACK(WRITELINE(compucolor2_state, xmt_w)) + MCFG_TMS5501_XI_CALLBACK(READ8(compucolor2_state, xi_r)) + MCFG_TMS5501_XO_CALLBACK(WRITE8(compucolor2_state, xo_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w)) + + MCFG_COMPUCOLOR_FLOPPY_PORT_ADD("cd0", compucolor_floppy_port_devices, "floppy") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w)) + + MCFG_COMPUCOLOR_FLOPPY_PORT_ADD("cd1", compucolor_floppy_port_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("8K,16K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "compclr2_flop") +MACHINE_CONFIG_END + +ROM_START( compclr2 ) + ROM_REGION( 0x4000, I8080_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "678", "v6.78" ) + ROMX_LOAD( "v678.rom", 0x0000, 0x4000, BAD_DUMP CRC(5e559469) SHA1(fe308774aae1294c852fe24017e58d892d880cd3), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "879", "v8.79" ) + ROMX_LOAD( "v879.rom", 0x0000, 0x4000, BAD_DUMP CRC(4de8e652) SHA1(e5c55da3ac893b8a5a99c8795af3ca72b1645f3f), ROM_BIOS(2) ) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "chargen.uf6", 0x000, 0x400, BAD_DUMP CRC(7eef135a) SHA1(be488ef32f54c6e5f551fb84ab12b881aef72dd9) ) + ROM_LOAD( "chargen.uf7", 0x400, 0x400, BAD_DUMP CRC(2bee7cf6) SHA1(808e0fc6f2332b4297de190eafcf84668703e2f4) ) + + ROM_REGION( 0x20, "ua1", 0 ) + ROM_LOAD( "82s123.ua1", 0x00, 0x20, BAD_DUMP CRC(27ae54bc) SHA1(ccb056fbc1ec2132f2602217af64d77237494afb) ) // I/O PROM + + ROM_REGION( 0x20, "proms", 0 ) + ROM_LOAD( "82s129.ue2", 0x00, 0x20, NO_DUMP ) // Address Decoder/Timer for RAM + ROM_LOAD( "82s129.uf3", 0x00, 0x20, NO_DUMP ) // System Decoder + ROM_LOAD( "82s123.ub3", 0x00, 0x20, NO_DUMP ) // ROM/PROM Decoder + ROM_LOAD( "82s129.uf8", 0x00, 0x20, NO_DUMP ) // CPU & Horizontal Decoder + ROM_LOAD( "82s129.ug9", 0x00, 0x20, NO_DUMP ) // Scan Decoder + ROM_LOAD( "82s129.ug5", 0x00, 0x20, NO_DUMP ) // Color PROM +ROM_END + +COMP( 1977, compclr2, 0, 0, compucolor2, compucolor2, driver_device, 0, "Intelligent Systems Corporation", "Compucolor II", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/comquest.c b/src/mame/drivers/comquest.c new file mode 100644 index 00000000000..5329f09e1d4 --- /dev/null +++ b/src/mame/drivers/comquest.c @@ -0,0 +1,310 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + Peter.Trauner@jk.uni-linz.ac.at September 2000 + +******************************************************************************/ +/* +comquest plus +------------- +team concepts + +laptop for childs + +language german + +lcd black/white, about 128x64, manual contrast control +keyboard and 2 button joypad +speaker 2, manual volume control:2 levels +cartridge slot, serial port + +512 kbyte rom on print with little isolation/case +12 pin chip on print with little isolation/case (eeprom? at i2c bus) +cpu on print, soldered so nothing visible +32 kbyte sram + +compuest a4 power printer +------------------------- +line oriented ink printer (12 pixel head) +for comquest serial port + +3 buttons, 2 leds +bereit +druckqualitaet +zeilenvorschub/seitenvorschub + +only chip on board (40? dil) +lsc43331op +team concepts +icq3250a-d +1f71lctctab973 + + */ + +#include "emu.h" +#include "cpu/m6805/m6805.h" +#include "includes/comquest.h" + +#ifdef UNUSED_FUNCTION +READ8_MEMBER(comquest_state::comquest_read) +{ + UINT8 data=0; + logerror("comquest read %.4x %.2x\n",offset,data); + return data; +} + +WRITE8_MEMBER(comquest_state::comquest_write) +{ + logerror("comquest read %.4x %.2x\n",offset,data); +} +#endif + +static ADDRESS_MAP_START( comquest_mem , AS_PROGRAM, 8, comquest_state ) +// { 0x0000, 0x7fff, SMH_BANK(1) }, + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0xffff) AM_READONLY AM_WRITENOP +// { 0x8000, 0xffff, SMH_RAM }, // batterie buffered +ADDRESS_MAP_END + +static INPUT_PORTS_START( comquest ) + PORT_START("in0") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EIN") + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_START("in1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Druck") PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AUS") + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 Paragraph") PORT_CODE(KEYCODE_3) + PORT_START("in2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %%") PORT_CODE(KEYCODE_5) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 /") PORT_CODE(KEYCODE_7) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 =") PORT_CODE(KEYCODE_0) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sharp-s ?") PORT_CODE(KEYCODE_EQUALS) + PORT_START("in3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("acute") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("delete") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T +") PORT_CODE(KEYCODE_T) + PORT_START("in4") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z -") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U 4") PORT_CODE(KEYCODE_U) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I 5") PORT_CODE(KEYCODE_I) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O 6") PORT_CODE(KEYCODE_O) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Diaresis-U") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ *") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("capslock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_START("in5") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G mul") PORT_CODE(KEYCODE_G) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H div") PORT_CODE(KEYCODE_H) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J 1") PORT_CODE(KEYCODE_J) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K 2") PORT_CODE(KEYCODE_K) + PORT_START("in6") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L 3") PORT_CODE(KEYCODE_L) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Diaresis-O") + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Diaresis-A") + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("left-shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_START("in7") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B root") PORT_CODE(KEYCODE_B) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N square") PORT_CODE(KEYCODE_N) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". :") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("right-shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_START("in8") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Entf") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Strg") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AC") + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Spieler left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stufe up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Antwort down") PORT_CODE(KEYCODE_DOWN) + PORT_START("in9") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" right") PORT_CODE(KEYCODE_RIGHT) +#if 0 +/* + left button, right button + joypad: + left button, right button + 4 or 8 directions +*/ + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_7) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_6) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_7) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_6) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_7) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_6) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_7) +#endif + +INPUT_PORTS_END + +static const gfx_layout comquest_charlayout = +{ + 8,8, + 256*8, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + /* x offsets */ + { + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + }, + /* y offsets */ + { + 0, + 8, + 16, + 24, + 32, + 40, + 48, + 56, + }, + 8*8 +}; + +static GFXDECODE_START( comquest ) + GFXDECODE_ENTRY( "gfx1", 0x0000, comquest_charlayout, 0, 2 ) +GFXDECODE_END + + +void comquest_state::machine_reset() +{ +// UINT8 *mem=memregion("user1")->base(); +// membank(1)->set_base(mem+0x00000); +} + +static const UINT32 amask= 0xffff; + + +static MACHINE_CONFIG_START( comquest, comquest_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6805, 4000000) /* 4000000? */ + /*MCFG_CPU_ADD("maincpu", HD63705, 4000000) instruction set looks like m6805/m6808 */ + /*MCFG_CPU_ADD("maincpu", M68705, 4000000) instruction set looks like m6805/m6808 */ + +/* + 8 bit bus, integrated io, serial io?, + + starts at address zero? + + not saturn, although very similar hardware compared to hp48g (build into big plastic case) + not sc61860, 62015? + not cdp1802 + not tms9900? + not z80 + not 6502, mitsubishi 740 + not i86 + not 6809 + not 68008? + not tms32010 + not t11 + not arm + not 8039 + not tms370 + not lh5801 + not fujitsu mb89150 + not epson e0c88 +*/ + + MCFG_CPU_PROGRAM_MAP(comquest_mem) + MCFG_CPU_CONFIG( amask ) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(LCD_FRAMES_PER_SECOND) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*4, 128) /* 160 x 102 */ + MCFG_SCREEN_VISIBLE_AREA(0, 64*4-1, 0, 128-1) + MCFG_SCREEN_UPDATE_DRIVER(comquest_state, screen_update_comquest) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", comquest ) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + /* sound hardware */ + /* unknown ? */ +MACHINE_CONFIG_END + +ROM_START(comquest) +// ROM_REGION(0x10000,"maincpu",0) +// ROM_REGION(0x80000,"user1",0) + ROM_REGION(0x100000,"maincpu",0) + ROM_LOAD("comquest.bin", 0x00000, 0x80000, CRC(2bf4b1a8) SHA1(8d1821cbde37cca2055b18df001438f7d138a8c1)) +/* +000 +16kbyte graphics data? (first bytes: 80 0d 04 00 00 08 04 00 0f 02 04 01 00 10 04 01) +040 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 4f c7 f1 1d 4f) +080 8kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 10 a9 4f c7 f1) +0a0 8kbyte code (first bytes: 00 00 00 00 9a a6 00 c7 f5 ca cd 7c 9b cd 7c 98) +0c0 16kbyte code (first bytes: 00 00 00 00 a6 0a cd 7c c8 cd 7c 9b cd 7c 98 a6) +100 8kbyte code (first bytes: 00 00 00 00 a6 0a cd 7c c8 cd 7c 9b cd 7c 98 a6) +120 8kbyte data +140 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 a6 0d c7 fd 0f) +180 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 a6 00 c7 f2 2c) +1c0 16kbyte code (first bytes: 00 00 00 00 9a a6 00 c7 f3 00 c7 f3 02 a6 ff c7) +200 16kbyte code (first bytes: 00 00 00 00 9a a6 0d c7 fd 0f cd 7c 92 cd 7c 9b) +240 8kbyte code (first bytes: 00 00 00 00 9d 9d 9d 9d 9d 9d 9d 9d cd 7c 9b cd) +260 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 a6 00 b7 75 b7) +2a0 8kbyte code (first bytes: 00 00 00 00 a6 0a cd 7c c8 cd 7c 9b cd 7c 98 a6) +2c0 8kbyte code (first bytes: 00 00 00 00 a6 03 c7 fd 0f cd 7c 92 cd 7c 9b cd) +2e0 8kbyte code? (first bytes: 00 00 00 00 a6 0d c7 fd 0f cd 7c 92 cc 80 f1 20) +300 luts?+text (first bytes: 60 02 fb 08 9a 11 a1 1f 75 26 dc 2f 6a 3b 26 46) +720 empty +740 empty +760 empty +780 16kbyte code (first bytes: 00 00 00 00 cd 7c 9b cd 7c 98 4f cd 7c ad a6 0a) +7c0 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 4f c7 f1 6e c7) + */ + +// ROM_REGION(0x100,"gfx1",0) + ROM_REGION(0x80000,"gfx1",0) + ROM_LOAD("comquest.bin", 0x00000, 0x80000, CRC(2bf4b1a8) SHA1(8d1821cbde37cca2055b18df001438f7d138a8c1)) +ROM_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT MONITOR COMPANY FULLNAME */ +CONS( 1995, comquest, 0, 0, comquest, comquest, driver_device, 0, "Data Concepts", "ComQuest Plus (German)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/comx35.c b/src/mame/drivers/comx35.c new file mode 100644 index 00000000000..04bc334ce40 --- /dev/null +++ b/src/mame/drivers/comx35.c @@ -0,0 +1,723 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + TODO: + + - tape input/output + - PL-80 plotter + - serial printer + - thermal printer + +*/ + +#include "includes/comx35.h" +#include "formats/imageutl.h" + + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +#define LOG 0 + +enum +{ + COMX_TYPE_BINARY = 1, + COMX_TYPE_BASIC, + COMX_TYPE_BASIC_FM, + COMX_TYPE_RESERVED, + COMX_TYPE_DATA +}; + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +/*------------------------------------------------- + image_fread_memory - read image to memory +-------------------------------------------------*/ + +void comx35_state::image_fread_memory(device_image_interface &image, UINT16 addr, UINT32 count) +{ + UINT8 *ram = m_ram->pointer() + (addr - 0x4000); + + image.fread(ram, count); +} + +/*------------------------------------------------- + QUICKLOAD_LOAD_MEMBER( comx35_state, comx35_comx ) +-------------------------------------------------*/ + +QUICKLOAD_LOAD_MEMBER( comx35_state, comx35_comx ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + UINT8 header[16] = {0}; + int size = image.length(); + + if (size > m_ram->size()) + { + return IMAGE_INIT_FAIL; + } + + image.fread( header, 5); + + if (header[1] != 'C' || header[2] != 'O' || header[3] != 'M' || header[4] != 'X' ) + { + return IMAGE_INIT_FAIL; + } + + switch (header[0]) + { + case COMX_TYPE_BINARY: + /* + + Type 1: pure machine code (i.e. no basic) + + Byte 0 to 4: 1 - 'COMX' + Byte 5 and 6: Start address (1802 way; see above) + Byte 6 and 7: End address + Byte 9 and 10: Execution address + + Byte 11 to Eof, should be stored in ram from start to end; execution address + 'xxxx' for the CALL (@xxxx) basic statement to actually run the code. + + */ + { + UINT16 start_address, end_address, run_address; + + image.fread(header, 6); + + start_address = pick_integer_be(header, 0, 2); + end_address = pick_integer_be(header, 2, 2); + run_address = pick_integer_be(header, 4, 2); + + image_fread_memory(image, start_address, end_address - start_address); + + popmessage("Type CALL (@%04x) to start program", run_address); + } + break; + + case COMX_TYPE_BASIC: + /* + + Type 2: Regular basic code or machine code followed by basic + + Byte 0 to 4: 2 - 'COMX' + Byte 5 and 6: DEFUS value, to be stored on 0x4281 and 0x4282 + Byte 7 and 8: EOP value, to be stored on 0x4283 and 0x4284 + Byte 9 and 10: End array, start string to be stored on 0x4292 and 0x4293 + Byte 11 and 12: start array to be stored on 0x4294 and 0x4295 + Byte 13 and 14: EOD and end string to be stored on 0x4299 and 0x429A + + Byte 15 to Eof to be stored on 0x4400 and onwards + + Byte 0x4281-0x429A (or at least the ones above) should be set otherwise + BASIC won't 'see' the code. + + */ + + image_fread_memory(image, 0x4281, 4); + image_fread_memory(image, 0x4292, 4); + image_fread_memory(image, 0x4299, 2); + image_fread_memory(image, 0x4400, size); + break; + + case COMX_TYPE_BASIC_FM: + /* + + Type 3: F&M basic load + + Not the most important! But we designed our own basic extension, you can + find it in the F&M basic folder as F&M Basic.comx. When you run this all + basic code should start at address 0x6700 instead of 0x4400 as from + 0x4400-0x6700 the F&M basic stuff is loaded. So format is identical to Type + 2 except Byte 15 to Eof should be stored on 0x6700 instead. .comx files of + this format can also be found in the same folder as the F&M basic.comx file. + + */ + + image_fread_memory(image, 0x4281, 4); + image_fread_memory(image, 0x4292, 4); + image_fread_memory(image, 0x4299, 2); + image_fread_memory(image, 0x6700, size); + break; + + case COMX_TYPE_RESERVED: + /* + + Type 4: Incorrect DATA format, I suggest to forget this one as it won't work + in most cases. Instead I left this one reserved and designed Type 5 instead. + + */ + break; + + case COMX_TYPE_DATA: + /* + + Type 5: Data load + + Byte 0 to 4: 5 - 'COMX' + Byte 5 and 6: Array length + Byte 7 to Eof: Basic 'data' + + To load this first get the 'start array' from the running COMX, i.e. address + 0x4295/0x4296. Calculate the EOD as 'start array' + length of the data (i.e. + file length - 7). Store the EOD back on 0x4299 and ox429A. Calculate the + 'Start String' as 'start array' + 'Array length' (Byte 5 and 6). Store the + 'Start String' on 0x4292/0x4293. Load byte 7 and onwards starting from the + 'start array' value fetched from 0x4295/0x4296. + + */ + { + UINT16 start_array, end_array, start_string, array_length; + + image.fread(header, 2); + + array_length = pick_integer_be(header, 0, 2); + start_array = (program.read_byte(0x4295) << 8) | program.read_byte(0x4296); + end_array = start_array + (size - 7); + + program.write_byte(0x4299, end_array >> 8); + program.write_byte(0x429a, end_array & 0xff); + + start_string = start_array + array_length; + + program.write_byte(0x4292, start_string >> 8); + program.write_byte(0x4293, start_string & 0xff); + + image_fread_memory(image, start_array, size); + } + break; + } + + return IMAGE_INIT_PASS; +} + +//************************************************************************** +// MEMORY ACCESS +//************************************************************************** + +//------------------------------------------------- +// mem_r - memory read +//------------------------------------------------- + +READ8_MEMBER( comx35_state::mem_r ) +{ + int extrom = 1; + + UINT8 data = m_exp->mrd_r(space, offset, &extrom); + + if (offset < 0x4000) + { + if (extrom) data = m_rom->base()[offset & 0x3fff]; + } + else if (offset >= 0x4000 && offset < 0xc000) + { + data = m_ram->pointer()[offset - 0x4000]; + } + else if (offset >= 0xf400 && offset < 0xf800) + { + data = m_vis->char_ram_r(space, offset & 0x3ff); + } + + return data; +} + + +//------------------------------------------------- +// mem_w - memory write +//------------------------------------------------- + +WRITE8_MEMBER( comx35_state::mem_w ) +{ + m_exp->mwr_w(space, offset, data); + + if (offset >= 0x4000 && offset < 0xc000) + { + m_ram->pointer()[offset - 0x4000] = data; + } + else if (offset >= 0xf400 && offset < 0xf800) + { + m_vis->char_ram_w(space, offset & 0x3ff, data); + } + else if (offset >= 0xf800) + { + m_vis->page_ram_w(space, offset & 0x3ff, data); + } +} + + +//------------------------------------------------- +// io_r - I/O read +//------------------------------------------------- + +READ8_MEMBER( comx35_state::io_r ) +{ + UINT8 data = m_exp->io_r(space, offset); + + if (offset == 3) + { + data = m_kbe->read(space, 0); + } + + return data; +} + + +//------------------------------------------------- +// io_w - I/O write +//------------------------------------------------- + +WRITE8_MEMBER( comx35_state::io_w ) +{ + m_exp->io_w(space, offset, data); + + if (offset >= 3) + { + cdp1869_w(space, offset, data); + } +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( comx35_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( comx35_mem, AS_PROGRAM, 8, comx35_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_READWRITE(mem_r, mem_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( comx35_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( comx35_io, AS_IO, 8, comx35_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x07) AM_READWRITE(io_r, io_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_CHANGED_MEMBER( comx35_reset ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( comx35_state::trigger_reset ) +{ + if (newval && BIT(m_d6->read(), 7)) + { + machine_reset(); + } +} + + +//------------------------------------------------- +// INPUT_PORTS( comx35 ) +//------------------------------------------------- + +static INPUT_PORTS_START( comx35 ) + PORT_START("D1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 \xE2\x96\xA0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('?') + + PORT_START("D2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('[') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(']') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('<') PORT_CHAR('(') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('=') PORT_CHAR('^') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('>') PORT_CHAR(')') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('_') + + PORT_START("D3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('?') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("D4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("D5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("D6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR('+') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('|') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('}') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('~') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(8) + + PORT_START("D7") + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("D8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("D9") + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("D10") + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("D11") + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("MODIFIERS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_WRITE_LINE_DEVICE_MEMBER(CDP1871_TAG, cdp1871_device, shift_w) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CNTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) PORT_WRITE_LINE_DEVICE_MEMBER(CDP1871_TAG, cdp1871_device, control_w) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("RESET") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RT") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CHANGED_MEMBER(DEVICE_SELF, comx35_state, trigger_reset, 0) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// COSMAC_INTERFACE( cosmac_intf ) +//------------------------------------------------- + +void comx35_state::check_interrupt() +{ + m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, m_cr1 || m_int); +} + +READ_LINE_MEMBER( comx35_state::clear_r ) +{ + return m_clear; +} + +READ_LINE_MEMBER( comx35_state::ef2_r ) +{ + if (m_iden) + { + // interrupts disabled: PAL/NTSC + return m_vis->pal_ntsc_r(); + } + else + { + // interrupts enabled: keyboard repeat + return m_kbe->rpt_r(); + } +} + +READ_LINE_MEMBER( comx35_state::ef4_r ) +{ + return m_exp->ef4_r(); // | (m_cassette->input() > 0.0f); +} + +WRITE_LINE_MEMBER( comx35_state::q_w ) +{ + m_q = state; + + if (m_iden && state) + { + // enable interrupts + m_iden = 0; + } + + // cassette output + m_cassette->output(state ? +1.0 : -1.0); + + // expansion bus + m_exp->q_w(state); +} + +WRITE8_MEMBER( comx35_state::sc_w ) +{ + switch (data) + { + case COSMAC_STATE_CODE_S0_FETCH: + // not connected + break; + + case COSMAC_STATE_CODE_S1_EXECUTE: + // every other S1 triggers a DMAOUT request + if (m_dma) + { + m_dma = 0; + + if (!m_iden) + { + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAOUT, ASSERT_LINE); + } + } + else + { + m_dma = 1; + } + break; + + case COSMAC_STATE_CODE_S2_DMA: + // DMA acknowledge clears the DMAOUT request + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAOUT, CLEAR_LINE); + break; + + case COSMAC_STATE_CODE_S3_INTERRUPT: + // interrupt acknowledge clears the INT request + m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, CLEAR_LINE); + break; + } +} + + +//------------------------------------------------- +// COMX_EXPANSION_INTERFACE( expansion_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( comx35_state::irq_w ) +{ + m_int = state; + check_interrupt(); +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void comx35_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_ID_RESET: + m_clear = 1; + break; + } +} + + +//------------------------------------------------- +// MACHINE_START( comx35 ) +//------------------------------------------------- + +void comx35_state::machine_start() +{ + // clear the RAM since DOS card will go crazy if RAM is not all zeroes + UINT8 *ram = m_ram->pointer(); + memset(ram, 0, m_ram->size()); + + // register for state saving + save_item(NAME(m_clear)); + save_item(NAME(m_q)); + save_item(NAME(m_iden)); + save_item(NAME(m_dma)); + save_item(NAME(m_int)); + save_item(NAME(m_prd)); + save_item(NAME(m_cr1)); +} + + +void comx35_state::machine_reset() +{ + m_exp->reset(); + + int t = RES_K(27) * CAP_U(1) * 1000; // t = R1 * C1 + + m_clear = 0; + m_iden = 1; + m_cr1 = 1; + m_int = CLEAR_LINE; + m_prd = CLEAR_LINE; + + timer_set(attotime::from_msec(t), TIMER_ID_RESET); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( pal ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pal, comx35_state ) + // basic system hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, CDP1869_CPU_CLK_PAL) + MCFG_CPU_PROGRAM_MAP(comx35_mem) + MCFG_CPU_IO_MAP(comx35_io) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(comx35_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(comx35_state, ef2_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(comx35_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(comx35_state, q_w)) + MCFG_COSMAC_SC_CALLBACK(WRITE8(comx35_state, sc_w)) + + // sound and video hardware + MCFG_FRAGMENT_ADD(comx35_pal_video) + + // peripheral hardware + MCFG_DEVICE_ADD(CDP1871_TAG, CDP1871, CDP1869_CPU_CLK_PAL/8) + MCFG_CDP1871_D1_CALLBACK(IOPORT("D1")) + MCFG_CDP1871_D2_CALLBACK(IOPORT("D2")) + MCFG_CDP1871_D3_CALLBACK(IOPORT("D3")) + MCFG_CDP1871_D4_CALLBACK(IOPORT("D4")) + MCFG_CDP1871_D5_CALLBACK(IOPORT("D5")) + MCFG_CDP1871_D6_CALLBACK(IOPORT("D6")) + MCFG_CDP1871_D7_CALLBACK(IOPORT("D7")) + MCFG_CDP1871_D8_CALLBACK(IOPORT("D8")) + MCFG_CDP1871_D9_CALLBACK(IOPORT("D9")) + MCFG_CDP1871_D10_CALLBACK(IOPORT("D10")) + MCFG_CDP1871_D11_CALLBACK(IOPORT("D11")) + MCFG_CDP1871_DA_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF3)) + MCFG_QUICKLOAD_ADD("quickload", comx35_state, comx35_comx, "comx", 0) + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + // expansion bus + MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, comx_expansion_cards, "eb") + MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(comx35_state, irq_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( ntsc ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ntsc, comx35_state ) + // basic system hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, CDP1869_CPU_CLK_NTSC) + MCFG_CPU_PROGRAM_MAP(comx35_mem) + MCFG_CPU_IO_MAP(comx35_io) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(comx35_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(comx35_state, ef2_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(comx35_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(comx35_state, q_w)) + MCFG_COSMAC_SC_CALLBACK(WRITE8(comx35_state, sc_w)) + + // sound and video hardware + MCFG_FRAGMENT_ADD(comx35_ntsc_video) + + // peripheral hardware + MCFG_DEVICE_ADD(CDP1871_TAG, CDP1871, CDP1869_CPU_CLK_PAL/8) + MCFG_CDP1871_D1_CALLBACK(IOPORT("D1")) + MCFG_CDP1871_D2_CALLBACK(IOPORT("D2")) + MCFG_CDP1871_D3_CALLBACK(IOPORT("D3")) + MCFG_CDP1871_D4_CALLBACK(IOPORT("D4")) + MCFG_CDP1871_D5_CALLBACK(IOPORT("D5")) + MCFG_CDP1871_D6_CALLBACK(IOPORT("D6")) + MCFG_CDP1871_D7_CALLBACK(IOPORT("D7")) + MCFG_CDP1871_D8_CALLBACK(IOPORT("D8")) + MCFG_CDP1871_D9_CALLBACK(IOPORT("D9")) + MCFG_CDP1871_D10_CALLBACK(IOPORT("D10")) + MCFG_CDP1871_D11_CALLBACK(IOPORT("D11")) + MCFG_CDP1871_DA_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF3)) + MCFG_QUICKLOAD_ADD("quickload", comx35_state, comx35_comx, "comx", 0) + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + // expansion bus + MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, comx_expansion_cards, "eb") + MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(comx35_state, irq_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( comx35p ) +//------------------------------------------------- + +ROM_START( comx35p ) + ROM_REGION( 0x4000, CDP1802_TAG, 0 ) + ROM_DEFAULT_BIOS( "basic100" ) + ROM_SYSTEM_BIOS( 0, "basic100", "COMX BASIC V1.00" ) + ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "basic101", "COMX BASIC V1.01" ) + ROMX_LOAD( "comx_11.u21", 0x0000, 0x4000, CRC(609d89cd) SHA1(799646810510d8236fbfafaff7a73d5170990f16), ROM_BIOS(2) ) +ROM_END + + +//------------------------------------------------- +// ROM( comx35n ) +//------------------------------------------------- + +#define rom_comx35n rom_comx35p + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, comx35p, 0, 0, pal, comx35, driver_device, 0, "Comx World Operations Ltd", "COMX 35 (PAL)", MACHINE_IMPERFECT_SOUND ) +COMP( 1983, comx35n, comx35p,0, ntsc, comx35, driver_device, 0, "Comx World Operations Ltd", "COMX 35 (NTSC)", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/concept.c b/src/mame/drivers/concept.c new file mode 100644 index 00000000000..947d4bfcfa7 --- /dev/null +++ b/src/mame/drivers/concept.c @@ -0,0 +1,320 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet, Brett Wyer +/* + Corvus Concept driver + + Relatively simple 68k-based system + + * 256 or 512 kbytes of DRAM + * 4kbytes of SRAM + * 8kbyte boot ROM + * optional MacsBugs ROM + * two serial ports, keyboard, bitmapped display, simple sound, omninet + LAN port (seems more or less similar to AppleTalk) + * 4 expansion ports enable to add expansion cards, namely floppy disk + and hard disk controllers (the expansion ports are partially compatible + with Apple 2 expansion ports) + + Video: monochrome bitmapped display, 720*560 visible area (bitmaps are 768 + pixels wide in memory). One interesting feature is the fact that the + monitor can be rotated to give a 560*720 vertical display (you need to + throw a switch and reset the machine for the display rotation to be taken + into account, though). One oddity is that the video hardware scans the + display from the lower-left corner to the upper-left corner (or from the + upper-right corner to the lower-left if the screen is flipped). + Sound: simpler buzzer connected to the via shift register + Keyboard: intelligent controller, connected through an ACIA. See CCOS + manual pp. 76 through 78. and User Guide p. 2-1 through 2-9. + Clock: mm58174 RTC + + Raphael Nabet, Brett Wyer, 2003-2005 +*/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "includes/concept.h" +#include "bus/a2bus/a2corvus.h" +#include "bus/a2bus/corvfdc01.h" +#include "bus/a2bus/corvfdc02.h" +#include "bus/rs232/rs232.h" + +static ADDRESS_MAP_START(concept_memmap, AS_PROGRAM, 16, concept_state ) + AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION("maincpu", 0x010000) /* boot ROM mirror */ + AM_RANGE(0x000008, 0x000fff) AM_RAM /* static RAM */ + AM_RANGE(0x010000, 0x011fff) AM_ROM AM_REGION("maincpu", 0x010000) /* boot ROM */ + AM_RANGE(0x020000, 0x021fff) AM_ROM /* macsbugs ROM (optional) */ + AM_RANGE(0x030000, 0x03ffff) AM_READWRITE(concept_io_r,concept_io_w) /* I/O space */ + + AM_RANGE(0x080000, 0x0fffff) AM_RAM AM_SHARE("videoram")/* AM_RAMBANK(2) */ /* DRAM */ +ADDRESS_MAP_END + + +static INPUT_PORTS_START( concept ) + + PORT_START("KEY0") /* port 0: keys 0x00 through 0x0f */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(right)") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(left)") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(down)") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) + + PORT_START("KEY1") /* port 1: keys 0x10 through 0x1f */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) + + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) + + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_BACKSLASH2) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT (r)") PORT_CODE(KEYCODE_RSHIFT) + + PORT_START("KEY2") /* port 2: keys 0x20 through 0x2f */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + + PORT_START("KEY3") /* port 3: keys 0x30 through 0x3f */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT (l)") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + + PORT_START("KEY4") /* port 4: keys 0x40 through 0x4f */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FAST") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COMMAND") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(space)") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("00") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) + + PORT_START("KEY5") /* port 5: keys 0x50 through 0x5f */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(up)") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("???") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_PAUSE) + + PORT_START("DSW0") /* port 6: on-board DIP switches */ + PORT_DIPNAME(0x01, 0x00, "Omninet Address bit 0") + PORT_DIPSETTING(0x00, DEF_STR( Off )) + PORT_DIPSETTING(0x01, DEF_STR( On )) + PORT_DIPNAME(0x02, 0x02, "Omninet Address bit 1") + PORT_DIPSETTING(0x00, DEF_STR( Off )) + PORT_DIPSETTING(0x02, DEF_STR( On )) + PORT_DIPNAME(0x04, 0x00, "Omninet Address bit 2") + PORT_DIPSETTING(0x00, DEF_STR( Off )) + PORT_DIPSETTING(0x04, DEF_STR( On )) + PORT_DIPNAME(0x08, 0x00, "Omninet Address bit 3") + PORT_DIPSETTING(0x00, DEF_STR( Off )) + PORT_DIPSETTING(0x08, DEF_STR( On )) + PORT_DIPNAME(0x10, 0x00, "Omninet Address bit 4") + PORT_DIPSETTING(0x00, DEF_STR( Off )) + PORT_DIPSETTING(0x10, DEF_STR( On )) + PORT_DIPNAME(0x20, 0x00, "Omninet Address bit 5") + PORT_DIPSETTING(0x00, DEF_STR( Off )) + PORT_DIPSETTING(0x20, DEF_STR( On )) + PORT_DIPNAME(0xc0, 0x00, "Type of Boot") + PORT_DIPSETTING(0x00, "Prompt for type of Boot") // Documentation has 0x00 and 0xc0 reversed per boot PROM + PORT_DIPSETTING(0x40, "Boot from Omninet") + PORT_DIPSETTING(0x80, "Boot from Local Disk") + PORT_DIPSETTING(0xc0, "Boot from Diskette") + +#if 0 + PORT_START("DISPLAY") /* port 7: Display orientation */ + PORT_DIPNAME(0x01, 0x00, "Screen Orientation") + PORT_DIPSETTING(0x00, "Horizontal") + PORT_DIPSETTING(0x01, "Vertical") +#endif + +INPUT_PORTS_END + + + +/* init with simple, fixed, B/W palette */ +/* Is the palette black on white or white on black??? */ + +SLOT_INTERFACE_START( concept_a2_cards ) + SLOT_INTERFACE("fchdd", A2BUS_CORVUS) /* Corvus flat-cable HDD interface (see notes in a2corvus.c) */ + SLOT_INTERFACE("fdc01", A2BUS_CORVFDC01) /* Corvus WD1793 floppy controller */ + SLOT_INTERFACE("fdc02", A2BUS_CORVFDC02) /* Corvus NEC765 buffered floppy controller */ +SLOT_INTERFACE_END + + + +static MACHINE_CONFIG_START( concept, concept_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 8182000) /* 16.364 MHz / 2 */ + MCFG_CPU_PROGRAM_MAP(concept_memmap) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_REFRESH_RATE(60) /* 50 or 60, jumper-selectable */ + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(720, 560) + MCFG_SCREEN_VISIBLE_AREA(0, 720-1, 0, 560-1) + MCFG_SCREEN_UPDATE_DRIVER(concept_state, screen_update_concept) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* rtc */ + MCFG_DEVICE_ADD("mm58274c", MM58274C, 0) + MCFG_MM58274C_MODE24(0) // 12 hour + MCFG_MM58274C_DAY1(1) // monday + + /* via */ + MCFG_DEVICE_ADD("via6522_0", VIA6522, 1022750) + MCFG_VIA6522_READPA_HANDLER(READ8(concept_state, via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(concept_state, via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(concept_state, via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(concept_state, via_out_b)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(concept_state, via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(concept_state, via_irq_func)) + + /* ACIAs */ + MCFG_DEVICE_ADD(ACIA_0_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232a", rs232_port_device, write_txd)) + + MCFG_DEVICE_ADD(ACIA_1_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) + + MCFG_DEVICE_ADD(KBD_ACIA_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + + /* Apple II bus */ + MCFG_DEVICE_ADD(A2BUS_TAG, A2BUS, 0) + MCFG_A2BUS_CPU("maincpu") + MCFG_A2BUS_SLOT_ADD(A2BUS_TAG, "sl1", concept_a2_cards, NULL) + MCFG_A2BUS_SLOT_ADD(A2BUS_TAG, "sl2", concept_a2_cards, NULL) + MCFG_A2BUS_SLOT_ADD(A2BUS_TAG, "sl3", concept_a2_cards, NULL) + MCFG_A2BUS_SLOT_ADD(A2BUS_TAG, "sl4", concept_a2_cards, "fdc01") + + /* 2x RS232 ports */ + MCFG_RS232_PORT_ADD("rs232a", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA_0_TAG, mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA_0_TAG, mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(ACIA_0_TAG, mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA_0_TAG, mos6551_device, write_cts)) + + MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA_1_TAG, mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA_1_TAG, mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(ACIA_1_TAG, mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA_1_TAG, mos6551_device, write_cts)) +MACHINE_CONFIG_END + + +ROM_START( concept ) + ROM_REGION16_BE(0x100000,"maincpu",0) /* 68k rom and ram */ + + // concept boot ROM + ROM_SYSTEM_BIOS(0, "lvl8", "Level 8" ) // v0? + ROMX_LOAD("bootl08h", 0x010000, 0x1000, CRC(ee479f51) SHA1(b20ba18564672196076e46507020c6d69a640a2f), ROM_BIOS(1) | ROM_SKIP(1)) + ROMX_LOAD("bootl08l", 0x010001, 0x1000, CRC(acaefd07) SHA1(de0c7eaacaf4c0652aa45e523cebce2b2993c437), ROM_BIOS(1) | ROM_SKIP(1)) + + ROM_SYSTEM_BIOS(1, "lvl7", "Level 7" ) // v0? v1? + ROMX_LOAD("cc07h", 0x010000, 0x1000, CRC(455abac8) SHA1(b12e1580220242d34eafed1b486cebd89e823c8b), ROM_BIOS(2) | ROM_SKIP(1)) + ROMX_LOAD("cc07l", 0x010001, 0x1000, CRC(107a3830) SHA1(0ea12ef13b0d11fcd83b306b3a1bb8014ba910c0), ROM_BIOS(2) | ROM_SKIP(1)) + + ROM_SYSTEM_BIOS(2, "lvl6", "Level 6" ) // v0? + ROMX_LOAD("cc06h", 0x010000, 0x1000, CRC(66b6b259) SHA1(1199a38ef3e94f695e8da6a7c80c6432da3cb80c), ROM_BIOS(3) | ROM_SKIP(1)) + ROMX_LOAD("cc06l", 0x010001, 0x1000, CRC(600940d3) SHA1(c3278bf23b3b1c35ea1e3da48a05e877862a8345), ROM_BIOS(3) | ROM_SKIP(1)) + + ROM_REGION(0x400, "proms", 0) + ROM_LOAD("map04a.bin", 0x000, 0x400, CRC(1ae0db9b) SHA1(cdb6f63bb08072b454b4704e62de51c483ede734) ) + +#if 0 + // version 1 lvl 7 release + ROM_LOAD16_BYTE("bootl17h", 0x010000, 0x1000, CRC(6dd9718f)) // where does this come from? + ROM_LOAD16_BYTE("bootl17l", 0x010001, 0x1000, CRC(107a3830)) +#elif 0 + // version $F lvl 8 (development version found on a floppy disk along with + // the source code) + ROM_LOAD16_WORD("cc.prm", 0x010000, 0x2000, CRC(b5a87dab) SHA1(0da59af6cfeeb38672f71731527beac323d9c3d6)) +#endif + +#if 0 + // only known MACSbug release for the concept, with reset vector and + // entry point (the reset vector seems to be bogus: is the ROM dump bad, + // or were the ROMs originally loaded with buggy code?) + ROM_LOAD16_BYTE("macsbugh", 0x020000, 0x1000, CRC(aa357112)) + ROM_LOAD16_BYTE("macsbugl", 0x020001, 0x1000, CRC(b4b59de9)) +#endif + +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1982, concept, 0, 0, concept, concept, driver_device, 0, "Corvus Systems", "Concept" , 0 ) diff --git a/src/mame/drivers/cortex.c b/src/mame/drivers/cortex.c new file mode 100644 index 00000000000..e208d5c1899 --- /dev/null +++ b/src/mame/drivers/cortex.c @@ -0,0 +1,107 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Powertran Cortex + + 2012-04-20 Skeleton driver. + + ftp://ftp.whtech.com/Powertran Cortex/ + http://www.powertrancortex.com/index.html + + Uses Texas Instruments parts and similar to other TI computers. + It was designed by TI engineers, so it may perhaps be a clone + of another TI or the Geneve. + + Chips: + TMS9995 - CPU + TMS9929 - Video + TMS9911 - DMA to floppy + TMS9909 - Floppy Disk Controller + AY-5-2376 - Keyboard controller + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/tms9900/tms9995.h" +#include "video/tms9928a.h" + +class cortex_state : public driver_device +{ +public: + cortex_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_p_ram(*this, "ram") + { } + + virtual void machine_reset(); + required_device m_maincpu; + required_shared_ptr m_p_ram; +}; + +static ADDRESS_MAP_START( cortex_mem, AS_PROGRAM, 8, cortex_state ) + AM_RANGE(0x0000, 0xefff) AM_RAM AM_SHARE("ram") + AM_RANGE(0xf100, 0xf11f) AM_RAM // memory mapping unit + AM_RANGE(0xf120, 0xf120) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) + AM_RANGE(0xf121, 0xf121) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) + //AM_RANGE(0xf140, 0xf147) // fdc tms9909 +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cortex_io, AS_IO, 8, cortex_state ) + ADDRESS_MAP_UNMAP_HIGH + //AM_RANGE(0x0000, 0x000f) AM_READWRITE(pio_r,pio_w) + //AM_RANGE(0x0010, 0x001f) AM_READ(keyboard_r) + //AM_RANGE(0x0080, 0x00bf) AM_READWRITE(rs232_r,rs232_w) + //AM_RANGE(0x0180, 0x01bf) AM_READWRITE(cass_r,cass_w) + //AM_RANGE(0x0800, 0x080f) AM_WRITE(cent_data_w) + //AM_RANGE(0x0810, 0x0811) AM_WRITE(cent_strobe_w) + //AM_RANGE(0x0812, 0x0813) AM_READ(cent_stat_r) + //AM_RANGE(0x1ee0, 0x1eef) AM_READWRITE(cpu_int_r,cpu_int_w) + //AM_RANGE(0x1fda, 0x1fdb) AM_READWRITE(cpu_int1_r,cpu_int1_w) + AM_RANGE(0x10000, 0x10000) AM_NOP +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( cortex ) +INPUT_PORTS_END + + +void cortex_state::machine_reset() +{ + UINT8* ROM = memregion("maincpu")->base(); + memcpy(m_p_ram, ROM, 0x6000); + m_maincpu->set_ready(ASSERT_LINE); +} + +static MACHINE_CONFIG_START( cortex, cortex_state ) + /* basic machine hardware */ + /* TMS9995 CPU @ 12.0 MHz */ + // Standard variant, no overflow int + // No lines connected yet + MCFG_TMS99xx_ADD("maincpu", TMS9995, 12000000, cortex_mem, cortex_io) + + /* video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( cortex ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "basic", "Cortex Bios") + ROMX_LOAD( "cortex_ic47.bin", 0x0000, 0x2000, CRC(bdb8c7bd) SHA1(340829dcb7a65f2e830fd5aff82a312e3ed7918f), ROM_BIOS(1)) + ROMX_LOAD( "cortex_ic46.bin", 0x2000, 0x2000, CRC(4de459ea) SHA1(00a42fe556d4ffe1f85b2ce369f544b07fbd06d9), ROM_BIOS(1)) + ROMX_LOAD( "cortex_ic45.bin", 0x4000, 0x2000, CRC(b0c9b6e8) SHA1(4e20c3f0b7546b803da4805cd3b8616f96c3d923), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "forth", "FIG-Forth") + ROMX_LOAD( "forth_ic47.bin", 0x0000, 0x2000, CRC(999034be) SHA1(0dcc7404c38aa0ae913101eb0aa98da82104b5d4), ROM_BIOS(2)) + ROMX_LOAD( "forth_ic46.bin", 0x2000, 0x2000, CRC(8eca54cc) SHA1(0f1680e941ef60bb9bde9a4b843b78f30dff3202), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, cortex, 0, 0, cortex, cortex, driver_device, 0, "Powertran Cybernetics", "Cortex", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/cosmicos.c b/src/mame/drivers/cosmicos.c new file mode 100644 index 00000000000..8ec2903c821 --- /dev/null +++ b/src/mame/drivers/cosmicos.c @@ -0,0 +1,563 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + COSMICOS + + http://retro.hansotten.nl/index.php?page=1802-cosmicos + + + HEX-monitor + + 0 - start user program + 1 - inspect and/or change memory + 2 - write memory block to cassette + 3 - read memory block from cassette + 4 - move memory block + 5 - write memory block to EPROM + C - start user program from address 0000 + +*/ + +/* + + TODO: + + - display interface INH + - 2 segment display + - single step + - ascii monitor + - PPI 8255 + - Floppy WD1793 + - COM8017 UART to printer + +*/ + +#include "includes/cosmicos.h" +#include "cosmicos.lh" + +enum +{ + MODE_RUN, + MODE_LOAD, + MODE_PAUSE, + MODE_RESET +}; + +/* Read/Write Handlers */ + +READ8_MEMBER( cosmicos_state::read ) +{ + if (m_boot) offset |= 0xc0c0; + + UINT8 data = 0; + + if (offset < 0xc000) + { + // TODO + } + else if (offset < 0xd000) + { + data = m_rom->base()[offset & 0xfff]; + } + else if (!m_ram_disable && (offset >= 0xff00)) + { + data = m_ram->pointer()[offset & 0xff]; + } + + return data; +} + +WRITE8_MEMBER( cosmicos_state::write ) +{ + if (m_boot) offset |= 0xc0c0; + + if (offset < 0xc000) + { + // TODO + } + else if (!m_ram_disable && !m_ram_protect && (offset >= 0xff00)) + { + m_ram->pointer()[offset & 0xff] = data; + } +} + +READ8_MEMBER( cosmicos_state::video_off_r ) +{ + UINT8 data = 0; + + if (!m_q) + { + data = m_cti->dispoff_r(space, 0); + } + + return data; +} + +READ8_MEMBER( cosmicos_state::video_on_r ) +{ + UINT8 data = 0; + + if (!m_q) + { + data = m_cti->dispon_r(space, 0); + } + + return data; +} + +WRITE8_MEMBER( cosmicos_state::audio_latch_w ) +{ + if (m_q) + { + m_cti->tone_latch_w(space, 0, data); + } +} + +READ8_MEMBER( cosmicos_state::hex_keyboard_r ) +{ + UINT8 data = 0; + int i; + + for (i = 0; i < 4; i++) + { + if (BIT(m_keylatch, i)) + { + UINT8 keydata = m_key_row[i]->read(); + + if (BIT(keydata, 0)) data |= 0x01; + if (BIT(keydata, 1)) data |= 0x02; + if (BIT(keydata, 2)) data |= 0x04; + if (BIT(keydata, 3)) data |= 0x06; + } + } + + return data; +} + +WRITE8_MEMBER( cosmicos_state::hex_keylatch_w ) +{ + m_keylatch = data & 0x0f; +} + +READ8_MEMBER( cosmicos_state::reset_counter_r ) +{ + m_counter = 0; + + return 0; +} + +WRITE8_MEMBER( cosmicos_state::segment_w ) +{ + m_counter++; + + if (m_counter == 10) + { + m_counter = 0; + } + + if ((m_counter > 0) && (m_counter < 9)) + { + output_set_digit_value(10 - m_counter, data); + } +} + +READ8_MEMBER( cosmicos_state::data_r ) +{ + return m_data; +} + +WRITE8_MEMBER( cosmicos_state::display_w ) +{ + m_segment = data; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( cosmicos_mem, AS_PROGRAM, 8, cosmicos_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cosmicos_io, AS_IO, 8, cosmicos_state ) +// AM_RANGE(0x00, 0x00) + AM_RANGE(0x01, 0x01) AM_READ(video_on_r) + AM_RANGE(0x02, 0x02) AM_READWRITE(video_off_r, audio_latch_w) +// AM_RANGE(0x03, 0x03) +// AM_RANGE(0x04, 0x04) + AM_RANGE(0x05, 0x05) AM_READWRITE(hex_keyboard_r, hex_keylatch_w) + AM_RANGE(0x06, 0x06) AM_READWRITE(reset_counter_r, segment_w) + AM_RANGE(0x07, 0x07) AM_READWRITE(data_r, display_w) +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( cosmicos_state::data ) +{ + UINT8 data = m_io_data->read(); + int i; + + for (i = 0; i < 8; i++) + { + if (!BIT(data, i)) + { + m_data |= (1 << i); + output_set_led_value(LED_D0 - i, 1); + } + } +} + +INPUT_CHANGED_MEMBER( cosmicos_state::enter ) +{ + if (!newval && !m_wait && !m_clear) + { + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, ASSERT_LINE); + } +} + +INPUT_CHANGED_MEMBER( cosmicos_state::single_step ) +{ + // if in PAUSE mode, set RUN mode until TPB=active +} + +void cosmicos_state::set_cdp1802_mode(int mode) +{ + output_set_led_value(LED_RUN, 0); + output_set_led_value(LED_LOAD, 0); + output_set_led_value(LED_PAUSE, 0); + output_set_led_value(LED_RESET, 0); + + switch (mode) + { + case MODE_RUN: + output_set_led_value(LED_RUN, 1); + + m_wait = 1; + m_clear = 1; + break; + + case MODE_LOAD: + output_set_led_value(LED_LOAD, 1); + + m_wait = 0; + m_clear = 0; + break; + + case MODE_PAUSE: + output_set_led_value(LED_PAUSE, 1); + + m_wait = 1; + m_clear = 0; + break; + + case MODE_RESET: + m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, CLEAR_LINE); + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, CLEAR_LINE); + + m_wait = 1; + m_clear = 0; + m_boot = 1; + + output_set_led_value(LED_RESET, 1); + break; + } +} + +INPUT_CHANGED_MEMBER( cosmicos_state::run ) { if (!newval) set_cdp1802_mode(MODE_RUN); } +INPUT_CHANGED_MEMBER( cosmicos_state::load ) { if (!newval) set_cdp1802_mode(MODE_LOAD); } +INPUT_CHANGED_MEMBER( cosmicos_state::cosmicos_pause ) { if (!newval) set_cdp1802_mode(MODE_PAUSE); } +INPUT_CHANGED_MEMBER( cosmicos_state::reset ) { if (!newval) set_cdp1802_mode(MODE_RESET); } + +void cosmicos_state::clear_input_data() +{ + int i; + + m_data = 0; + + for (i = 0; i < 8; i++) + { + output_set_led_value(LED_D0 - i, 0); + } +} + +INPUT_CHANGED_MEMBER( cosmicos_state::clear_data ) +{ + clear_input_data(); +} + +INPUT_CHANGED_MEMBER( cosmicos_state::memory_protect ) +{ + m_ram_protect = newval; +} + +INPUT_CHANGED_MEMBER( cosmicos_state::memory_disable ) +{ + m_ram_disable = newval; +} + +static INPUT_PORTS_START( cosmicos ) + PORT_START("DATA") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) + + PORT_START("BUTTONS") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, enter, 0) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Single Step") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, single_step, 0) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("Run") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, run, 0) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("Load") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, load, 0) + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME(DEF_STR( Pause )) PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, cosmicos_pause, 0) + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, reset, 0) + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("Clear Data") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, clear_data, 0) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("Memory Protect") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, memory_protect, 0) PORT_TOGGLE + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("Memory Disable") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, memory_disable, 0) PORT_TOGGLE + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RET") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEC") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("REQ") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SEQ") PORT_CODE(KEYCODE_F4) +INPUT_PORTS_END + +/* Video */ + +TIMER_DEVICE_CALLBACK_MEMBER(cosmicos_state::digit_tick) +{ + m_digit = !m_digit; + + output_set_digit_value(m_digit, m_segment); +} + +TIMER_DEVICE_CALLBACK_MEMBER(cosmicos_state::int_tick) +{ + m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, ASSERT_LINE); +} + +WRITE_LINE_MEMBER( cosmicos_state::dmaout_w ) +{ + m_dmaout = state; +} + +WRITE_LINE_MEMBER( cosmicos_state::efx_w ) +{ + m_efx = state; +} + +/* CDP1802 Configuration */ + +READ_LINE_MEMBER( cosmicos_state::wait_r ) +{ + return m_wait; +} + +READ_LINE_MEMBER( cosmicos_state::clear_r ) +{ + return m_clear; +} + +READ_LINE_MEMBER( cosmicos_state::ef1_r ) +{ + UINT8 special = m_special->read(); + + return BIT(special, 0); +} + +READ_LINE_MEMBER( cosmicos_state::ef2_r ) +{ + UINT8 special = m_special->read(); + int casin = (m_cassette)->input() < 0.0; + + output_set_led_value(LED_CASSETTE, casin); + + return BIT(special, 1) | BIT(special, 3) | casin; +} + +READ_LINE_MEMBER( cosmicos_state::ef3_r ) +{ + UINT8 special = m_special->read(); + + return BIT(special, 2) | BIT(special, 3); +} + +READ_LINE_MEMBER( cosmicos_state::ef4_r ) +{ + return BIT(m_buttons->read(), 0); +} + +WRITE_LINE_MEMBER( cosmicos_state::q_w ) +{ + /* cassette */ + m_cassette->output(state ? +1.0 : -1.0); + + /* boot */ + if (state) m_boot = 0; + + /* CDP1864 audio enable */ + m_cti->aoe_w(state); + + m_q = state; +} + +READ8_MEMBER( cosmicos_state::dma_r ) +{ + return m_data; +} + +WRITE8_MEMBER( cosmicos_state::sc_w ) +{ + int sc1 = BIT(data, 1); + + if (m_sc1 && !sc1) + { + clear_input_data(); + } + + if (sc1) + { + m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, CLEAR_LINE); + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, CLEAR_LINE); + } + + m_sc1 = sc1; +} + +/* Machine Initialization */ + +void cosmicos_state::machine_start() +{ + /* initialize LED display */ + m_led->rbi_w(1); + + // find keyboard rows + m_key_row[0] = m_y1; + m_key_row[1] = m_y2; + m_key_row[2] = m_y3; + m_key_row[3] = m_y4; + + /* register for state saving */ + save_item(NAME(m_wait)); + save_item(NAME(m_clear)); + save_item(NAME(m_sc1)); + save_item(NAME(m_data)); + save_item(NAME(m_boot)); + save_item(NAME(m_ram_protect)); + save_item(NAME(m_ram_disable)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_segment)); + save_item(NAME(m_digit)); + save_item(NAME(m_counter)); + save_item(NAME(m_q)); + save_item(NAME(m_dmaout)); + save_item(NAME(m_efx)); + save_item(NAME(m_video_on)); +} + +void cosmicos_state::machine_reset() +{ + set_cdp1802_mode(MODE_RESET); +} + +/* Quickload */ + +QUICKLOAD_LOAD_MEMBER( cosmicos_state, cosmicos ) +{ + UINT8 *ptr = m_rom->base(); + int size = image.length(); + + /* load image to RAM */ + image.fread(ptr, size); + + return IMAGE_INIT_PASS; +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( cosmicos, cosmicos_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) + MCFG_CPU_PROGRAM_MAP(cosmicos_mem) + MCFG_CPU_IO_MAP(cosmicos_io) + MCFG_COSMAC_WAIT_CALLBACK(READLINE(cosmicos_state, wait_r)) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(cosmicos_state, clear_r)) + MCFG_COSMAC_EF1_CALLBACK(READLINE(cosmicos_state, ef1_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(cosmicos_state, ef2_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(cosmicos_state, ef3_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(cosmicos_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(cosmicos_state, q_w)) + MCFG_COSMAC_DMAR_CALLBACK(READ8(cosmicos_state, dma_r)) + MCFG_COSMAC_SC_CALLBACK(WRITE8(cosmicos_state, sc_w)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_cosmicos ) + MCFG_DEVICE_ADD(DM9368_TAG, DM9368, 0) + MCFG_TIMER_DRIVER_ADD_PERIODIC("digit", cosmicos_state, digit_tick, attotime::from_hz(100)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("interrupt", cosmicos_state, int_tick, attotime::from_hz(1000)) + + MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) + MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), WRITELINE(cosmicos_state, dmaout_w), WRITELINE(cosmicos_state, efx_w), NULL, VCC, VCC, VCC) + MCFG_CDP1864_CHROMINANCE(RES_K(2), 0, 0, 0) // R2 + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_QUICKLOAD_ADD("quickload", cosmicos_state, cosmicos, "bin", 0) + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256") + MCFG_RAM_EXTRA_OPTIONS("4K,48K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( cosmicos ) + ROM_REGION( 0x1000, CDP1802_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "hex", "Hex Monitor" ) + ROMX_LOAD( "hex.ic6", 0x000, 0x400, BAD_DUMP CRC(d25124bf) SHA1(121215ba3a979e1962327ebe73cbadf784c568d9), ROM_BIOS(1) ) /* typed in from manual */ + ROMX_LOAD( "hex.ic7", 0x400, 0x400, BAD_DUMP CRC(364ac81b) SHA1(83936ee6a7ed44632eb290889b98fb9a500f15d4), ROM_BIOS(1) ) /* typed in from manual */ + ROM_SYSTEM_BIOS( 1, "ascii", "ASCII Monitor" ) + ROMX_LOAD( "ascii.ic6", 0x000, 0x400, NO_DUMP, ROM_BIOS(2) ) + ROMX_LOAD( "ascii.ic7", 0x400, 0x400, NO_DUMP, ROM_BIOS(2) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, cosmicos, 0, 0, cosmicos, cosmicos, driver_device, 0, "Radio Bulletin", "Cosmicos", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/cp1.c b/src/mame/drivers/cp1.c new file mode 100644 index 00000000000..298e913ee3f --- /dev/null +++ b/src/mame/drivers/cp1.c @@ -0,0 +1,334 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Kosmos CP-1 + + 06/03/2012 Skeleton driver. + + on board there is also 8155 + KEYBOARD Membrane keyboard, 57 keys + 6 * 7 seg led display + +****************************************************************************/ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/i8155.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "cp1.lh" + +class cp1_state : public driver_device +{ +public: + cp1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_i8155(*this, "i8155"), + m_i8155_cp3(*this, "i8155_cp3"), + m_cassette(*this, "cassette"), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_line4(*this, "LINE4"), + m_io_config(*this, "CONFIG") + { } + + required_device m_maincpu; + required_device m_i8155; + required_device m_i8155_cp3; + required_device m_cassette; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_ioport m_io_line3; + required_ioport m_io_line4; + required_ioport m_io_config; + + virtual void machine_reset(); + DECLARE_READ8_MEMBER(port1_r); + DECLARE_READ8_MEMBER(port2_r); + DECLARE_READ8_MEMBER(getbus); + DECLARE_READ8_MEMBER(t0_r); + DECLARE_READ8_MEMBER(t1_r); + DECLARE_WRITE8_MEMBER(port1_w); + DECLARE_WRITE8_MEMBER(port2_w); + DECLARE_WRITE8_MEMBER(putbus); + DECLARE_QUICKLOAD_LOAD_MEMBER(quickload); + + DECLARE_READ8_MEMBER(i8155_read); + DECLARE_WRITE8_MEMBER(i8155_write); + DECLARE_WRITE8_MEMBER(i8155_porta_w); + DECLARE_READ8_MEMBER(i8155_portb_r); + DECLARE_WRITE8_MEMBER(i8155_portb_w); + DECLARE_WRITE8_MEMBER(i8155_portc_w); + +private: + UINT8 m_7seg; + UINT8 m_port2; + UINT8 m_matrix; +}; + +READ8_MEMBER(cp1_state::port1_r) +{ + logerror("Read from expansion port 1\n"); + + UINT8 data = 0; + + if (m_io_config->read() & 0x01) + data |= (m_cassette->input() > 0.03) ? 0x80 : 0x00; + + return data; +} + +WRITE8_MEMBER(cp1_state::port1_w) +{ + logerror("Write to expansion port 1 %x\n", data); + + if (m_io_config->read() & 0x01) + m_cassette->output(data & 0x80 ? +1.0 : -1.0); +} + +READ8_MEMBER(cp1_state::port2_r) +{ + // x--- ---- I8155 IO/M + // -x-- ---- I8155 RESET + // --x- ---- expansion port CE + // ---x ---- I8155 CE + // ---- xxxx keyboard input + + ioport_port* portnames[] = { m_io_line0, m_io_line1, m_io_line2, m_io_line3, m_io_line4 }; + UINT8 data = 0; + + for(int i=0; i<5; i++) + if (!(m_matrix & (1<read(); + + return (data & 0x0f) | (m_port2 & 0xf0); +} + +WRITE8_MEMBER(cp1_state::port2_w) +{ + if (data & 0x40) + { + m_i8155->reset(); + + if (m_io_config->read() & 0x02) + m_i8155_cp3->reset(); + } + + m_port2 = data; +} + +READ8_MEMBER(cp1_state::t0_r) +{ + logerror("t0_r\n"); + return 0; +} + +READ8_MEMBER(cp1_state::t1_r) +{ + logerror("t1_r\n"); + return 0; +} + +READ8_MEMBER(cp1_state::getbus) +{ + logerror("getbus\n"); + return 0; +} + +WRITE8_MEMBER(cp1_state::putbus) +{ + logerror("putbus\n"); +} + +READ8_MEMBER(cp1_state::i8155_read) +{ + UINT8 data = 0; + + if (!(m_port2 & 0x10)) + { + m_i8155->ale_w(space, BIT(m_port2, 7), offset); + data |= m_i8155->read(space, offset); + } + if ((m_io_config->read() & 0x02) && !(m_port2 & 0x20)) + { + // CP3 RAM expansion + m_i8155_cp3->ale_w(space, BIT(m_port2, 7), offset); + data |= m_i8155_cp3->read(space, offset); + } + + return data; +} + +WRITE8_MEMBER(cp1_state::i8155_write) +{ + if (!(m_port2 & 0x10)) + { + m_i8155->ale_w(space, BIT(m_port2, 7), offset); + m_i8155->write(space, offset, data); + } + if ((m_io_config->read() & 0x02) && !(m_port2 & 0x20)) + { + // CP3 RAM expansion + m_i8155_cp3->ale_w(space, BIT(m_port2, 7), offset); + m_i8155_cp3->write(space, offset, data); + } +} + +WRITE8_MEMBER(cp1_state::i8155_porta_w) +{ + data &= 0x7f; // PA7 is not connected + + if (m_7seg) + { + if (!(m_matrix & 0x01)) output_set_digit_value(5, data); + if (!(m_matrix & 0x02)) output_set_digit_value(4, data); + if (!(m_matrix & 0x04)) output_set_digit_value(3, data); + if (!(m_matrix & 0x08)) output_set_digit_value(2, data | 0x80); // this digit has always the dot active + if (!(m_matrix & 0x10)) output_set_digit_value(1, data); + if (!(m_matrix & 0x20)) output_set_digit_value(0, data); + } + + m_7seg ^= 0x01; +} + +READ8_MEMBER(cp1_state::i8155_portb_r) +{ + logerror("read from expansion port 2\n"); + return 0; +} + +WRITE8_MEMBER(cp1_state::i8155_portb_w) +{ + logerror("Write to expansion port 2 %x\n", data); +} + +WRITE8_MEMBER(cp1_state::i8155_portc_w) +{ + // --xx xxxx keyboard matrix + + m_matrix = data & 0x3f; +} + + +static ADDRESS_MAP_START( cp1_io , AS_IO, 8, cp1_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00, 0xff ) AM_READWRITE( i8155_read, i8155_write) + AM_RANGE( MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE( port1_r, port1_w ) + AM_RANGE( MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE( port2_r, port2_w ) + AM_RANGE( MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE( getbus, putbus ) + AM_RANGE( MCS48_PORT_T0, MCS48_PORT_T0) AM_READ( t0_r ) + AM_RANGE( MCS48_PORT_T1, MCS48_PORT_T1) AM_READ( t1_r ) +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( cp1 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_K) PORT_NAME("CAS [Cass. speichern]") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("CLR [Irrtum]") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("PC [Programmzahler]") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("ACC [Akku]") + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_NAME("CAL [Cass. lesen]") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("STEP [Schritt]") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("STP [Stopp]") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("RUN [Lauf]") + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("8") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_NAME("9") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_O) PORT_NAME("OUT [Auslesen]") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("INP [Eingeben]") + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("4") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("5") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("6") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("7") + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_NAME("0") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("1") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("2") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("3") + + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "CP2 Cassette Interface" ) + PORT_CONFSETTING( 0x00, DEF_STR( No ) ) + PORT_CONFSETTING( 0x01, DEF_STR( Yes ) ) + PORT_CONFNAME( 0x02, 0x00, "CP3 RAM Expansion" ) + PORT_CONFSETTING( 0x00, DEF_STR( No ) ) + PORT_CONFSETTING( 0x02, DEF_STR( Yes ) ) +INPUT_PORTS_END + +void cp1_state::machine_reset() +{ + m_port2 = 0; + m_matrix = 0; + m_7seg = 0; + m_cassette->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE); +} + +QUICKLOAD_LOAD_MEMBER( cp1_state, quickload ) +{ + UINT8 *dest = (UINT8*)m_i8155->space().get_read_ptr(0); + char line[0x10]; + int addr = 0; + while (image.fgets(line, 10) && addr < 0x100) + { + int op = 0, arg = 0; + if (sscanf(line, "%d.%d", &op, &arg) == 2) + { + dest[addr++] = op; + dest[addr++] = arg; + } + else + { + return IMAGE_INIT_FAIL; + } + } + + return IMAGE_INIT_PASS; +} + +static MACHINE_CONFIG_START( cp1, cp1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8049, XTAL_6MHz) + MCFG_CPU_IO_MAP(cp1_io) + + MCFG_DEVICE_ADD("i8155", I8155, 0) + MCFG_I8155_OUT_PORTA_CB(WRITE8(cp1_state, i8155_porta_w)) + MCFG_I8155_IN_PORTB_CB(READ8(cp1_state, i8155_portb_r)) + MCFG_I8155_OUT_PORTB_CB(WRITE8(cp1_state, i8155_portb_w)) + MCFG_I8155_OUT_PORTC_CB(WRITE8(cp1_state, i8155_portc_w)) + + MCFG_DEVICE_ADD("i8155_cp3", I8155, 0) + + MCFG_DEFAULT_LAYOUT(layout_cp1) + + MCFG_CASSETTE_ADD("cassette") + + MCFG_QUICKLOAD_ADD("quickload", cp1_state, quickload, "obj", 1) +MACHINE_CONFIG_END + +/* ROM definition */ +/* + KOSMOS B + M5L8049-136P-6 + JAPAN 83F301 +*/ + +ROM_START( cp1 ) + ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "b", "b" ) + ROMX_LOAD( "cp1-kosmos-b.rom", 0x0000, 0x0800, CRC(fea8a2b2) SHA1(c987b79a7b90fcbd58b66a69e95913f2655a1f0d), ROM_BIOS(1)) + // This is from 2716 eprom that was on board with I8039 instead of I8049 + ROM_SYSTEM_BIOS( 1, "2716", "2716" ) + ROMX_LOAD( "cp1-2716.bin", 0x0000, 0x0800, CRC(3a2caf0e) SHA1(ff4befcf82a664950186d3af1843fdef70d2209f), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, cp1, 0, 0, cp1, cp1, driver_device, 0, "Kosmos", "CP1 / Computer Praxis", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/craft.c b/src/mame/drivers/craft.c new file mode 100644 index 00000000000..34411a3f335 --- /dev/null +++ b/src/mame/drivers/craft.c @@ -0,0 +1,269 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/*\ +* * Linus Akesson's "Craft" +* * +* * Driver by MooglyGuy +\*/ + +#include "emu.h" +#include "cpu/avr8/avr8.h" +#include "sound/dac.h" + +#define VERBOSE_LEVEL (0) + +#define ENABLE_VERBOSE_LOG (0) + +#define MASTER_CLOCK 20000000 + +#define VISIBLE_CYCLES 480 +#define HSYNC_CYCLES 155 +#define LINE_CYCLES (VISIBLE_CYCLES + HSYNC_CYCLES) +#define VISIBLE_LINES 480 +#define VSYNC_LINES 45 +#define LINES_PER_FRAME (VISIBLE_LINES + VSYNC_LINES) +#define CYCLES_PER_FRAME (LINES_PER_FRAME * LINE_CYCLES) +#define PIXELS_PER_FRAME (CYCLES_PER_FRAME) + +/****************************************************\ +* I/O devices * +\****************************************************/ + +class craft_state : public driver_device +{ +public: + craft_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dac(*this, "dac") + { + } + + void video_update(); + + virtual void machine_start(); + + UINT32 m_last_cycles; + UINT64 m_frame_start_cycle; + + UINT8 m_port_b; + UINT8 m_port_c; + UINT8 m_port_d; + + UINT8 m_latched_color; + UINT8 m_pixels[PIXELS_PER_FRAME]; + + required_device m_maincpu; + + DECLARE_READ8_MEMBER(port_r); + DECLARE_WRITE8_MEMBER(port_w); + DECLARE_DRIVER_INIT(craft); + virtual void machine_reset(); + UINT32 screen_update_craft(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); + required_device m_dac; +}; + +inline void craft_state::verboselog(int n_level, const char *s_fmt, ...) +{ +#if ENABLE_VERBOSE_LOG + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%08x: %s", m_maincpu->safe_pc(), buf ); + } +#endif +} + +void craft_state::machine_start() +{ +} + +READ8_MEMBER(craft_state::port_r) +{ + switch( offset ) + { + case 0x00: // Port A + case 0x01: // Port B + case 0x02: // Port C + case 0x03: // Port D + // Unhandled + return 0x00; + } + + return 0; +} + +WRITE8_MEMBER(craft_state::port_w) +{ + switch( offset ) + { + case AVR8_IO_PORTA: // Port A + // Unhandled + break; + + case AVR8_IO_PORTB: // Port B + { + UINT8 old_port_b = m_port_b; + UINT8 pins = data; + UINT8 changed = pins ^ old_port_b; + if(pins & changed & 0x02) + { + m_frame_start_cycle = m_maincpu->get_elapsed_cycles(); + video_update(); + } + if(changed & 0x08) + { + video_update(); + m_latched_color = (pins & 0x08) ? (m_port_c & 0x3f) : 0x3f; + } + m_port_b = data; + break; + } + + case AVR8_IO_PORTC: // Port C + video_update(); + m_port_c = data; + m_latched_color = m_port_c; + break; + + case AVR8_IO_PORTD: // Port D + { + m_port_d = data; + UINT8 audio_sample = (data & 0x02) | ((data & 0xf4) >> 2); + m_dac->write_unsigned8(audio_sample << 1); + break; + } + } +} + +void craft_state::video_update() +{ + UINT64 cycles = m_maincpu->get_elapsed_cycles(); + UINT32 frame_cycles = (UINT32)(cycles - m_frame_start_cycle); + + if (m_last_cycles < frame_cycles) + { + for (UINT32 pixidx = m_last_cycles; pixidx < frame_cycles && pixidx < PIXELS_PER_FRAME; pixidx++) + { + m_pixels[pixidx] = m_latched_color; + } + } + else + { + UINT32 end_clear = sizeof(m_pixels) - m_last_cycles; + UINT32 start_clear = frame_cycles; + end_clear = (end_clear > PIXELS_PER_FRAME) ? (PIXELS_PER_FRAME - m_last_cycles) : end_clear; + start_clear = (start_clear > PIXELS_PER_FRAME) ? PIXELS_PER_FRAME : start_clear; + if (m_last_cycles < PIXELS_PER_FRAME) + { + memset(m_pixels + m_last_cycles, 0, end_clear); + } + if (start_clear < PIXELS_PER_FRAME) + { + memset(m_pixels, 0, start_clear); + } + } + + m_last_cycles = frame_cycles; +} + +/****************************************************\ +* Address maps * +\****************************************************/ + +static ADDRESS_MAP_START( craft_prg_map, AS_PROGRAM, 8, craft_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( craft_data_map, AS_DATA, 8, craft_state ) + AM_RANGE(0x0100, 0x04ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( craft_io_map, AS_IO, 8, craft_state ) + AM_RANGE(AVR8_IO_PORTA, AVR8_IO_PORTD) AM_READWRITE( port_r, port_w ) +ADDRESS_MAP_END + +/****************************************************\ +* Input ports * +\****************************************************/ + +static INPUT_PORTS_START( craft ) + PORT_START("MAIN") + PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +/****************************************************\ +* Video hardware * +\****************************************************/ + +UINT32 craft_state::screen_update_craft(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + for(int y = 0; y < LINES_PER_FRAME; y++) + { + UINT32 *line = &bitmap.pix32(y); + for(int x = 0; x < LINE_CYCLES; x++) + { + UINT8 pixel = m_pixels[y * LINE_CYCLES + x]; + UINT8 r = 0x55 * ((pixel & 0x30) >> 4); + UINT8 g = 0x55 * ((pixel & 0x0c) >> 2); + UINT8 b = 0x55 * (pixel & 0x03); + line[x] = 0xff000000 | (r << 16) | (g << 8) | b; + } + } + return 0; +} + +/****************************************************\ +* Machine definition * +\****************************************************/ + +DRIVER_INIT_MEMBER(craft_state,craft) +{ +} + +void craft_state::machine_reset() +{ + m_dac->write_unsigned8(0x00); + + m_frame_start_cycle = 0; + m_last_cycles = 0; +} + +static MACHINE_CONFIG_START( craft, craft_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", ATMEGA88, MASTER_CLOCK) + MCFG_CPU_PROGRAM_MAP(craft_prg_map) + MCFG_CPU_DATA_MAP(craft_data_map) + MCFG_CPU_IO_MAP(craft_io_map) + MCFG_CPU_AVR8_EEPROM("eeprom") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(59.99) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1429)) /* accurate */ + MCFG_SCREEN_SIZE(635, 525) + MCFG_SCREEN_VISIBLE_AREA(47, 526, 36, 515) + MCFG_SCREEN_UPDATE_DRIVER(craft_state, screen_update_craft) + MCFG_PALETTE_ADD("palette", 0x1000) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("avr8") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(0, "avr8", 1.00) +MACHINE_CONFIG_END + +ROM_START( craft ) + ROM_REGION( 0x2000, "maincpu", 0 ) /* Main program store */ + ROM_LOAD( "craft.bin", 0x0000, 0x2000, CRC(2e6f9ad2) SHA1(75e495bf18395d74289ca7ee2649622fc4010457) ) + ROM_REGION( 0x200, "eeprom", 0 ) /* on-die eeprom */ + ROM_LOAD( "eeprom.raw", 0x0000, 0x0200, CRC(e18a2af9) SHA1(81fc6f2d391edfd3244870214fac37929af0ac0c) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS(2008, craft, 0, 0, craft, craft, craft_state, craft, "Linus Akesson", "Craft", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/crvision.c b/src/mame/drivers/crvision.c new file mode 100644 index 00000000000..e6b26b8d287 --- /dev/null +++ b/src/mame/drivers/crvision.c @@ -0,0 +1,903 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Curt Coder +/* + This 1980s computer was manufactured by Vtech of Hong Kong. + known as: CreatiVision, Dick Smith Wizzard, Funvision, Rameses, VZ 2000 and possibly others. + + There is also a CreatiVision Mk 2, possibly also known as the Laser 500. This was a hardware variant, + sort of "evolved" hardware made compatible for the scheduled "ColecoVision expansion module", which + never actually shipped for CreatiVision, but for the Laser 2001 home computer (successor to + CreatiVision). + + TODO: + + CreatiVision + + - fix Diagnostic A (video) sprites generator test + - proper keyboard emulation, need keyboard schematics + - memory expansion 16K, can be chained + - centronics control/status port + - non-working cartridges: + * Diagnostic B (keyboard) + - homebrew roms with graphics issues: + * Christmas Demo 1.0 + * Titanic Frogger Demo 1.0 + * Titanic Frogger Demo 1.1 + + Salora Manager + + - keyboard Ctrl+I/J/N don't print out BASIC commands + - RAM mapping + - cassette (figure out correct input level) + - floppy (interface cartridge needed) + +*/ + +/* + +Salora Manager + +PCB Layout +---------- + +Main board + +35 0352 02 +700391F + +|-------------------------------------------------------------------------------| +| |-----CN1-----| |-----CN2-----| | +| 10.738MHz --| +| 4116 CN3 | +| ROM01 VDC | +| 4116 --| +| | +| ROM23 4116 - | +| | | +| 4116 | | +| LS04 CN6 --| +| 4116 | 6821 | +| LS32 | | +| 4116 - | +| LS139 PSG | +| 4116 | +| LS138 | +| 4116 CN4 | +| LS244 | +| | +| LS245 | +| | +| LS244 | +| 6502 --| +| LS244 | +| |-------------CN5-------------| | +|-------------------------------------------------------------------------------| + +Notes: +All IC's shown. Prototype-ish board, with many jumper wires and extra capacitors. + +ROM01 - Toshiba TMM2464P 8Kx8 one-time PROM, labeled "0.1" +ROM23 - Toshiba TMM2464P 8Kx8 one-time PROM, labeled "23" +6502 - Rockwell R6502AP 8-bit Microprocessor +6821 - Hitachi HD468B21P Peripheral Interface Adaptor +VDC - Texas Instruments TMS9929A Video Display Controller (covered w/heatsink) +PSG - Texas Instruments SN76489AN Programmable Sound Generator +4116 - Toshiba TMM416P-3 16Kx1 RAM (covered w/heatsink) +CN1 - sub board connector (17x2 pin header) +CN2 - RF board connector (17x1 pin header) +CN3 - printer connector (7x2 PCB edge male) +CN4 - expansion connector (30x2 PCB edge male) +CN5 - cartridge connector (18x2 PCB edge female) +CN6 - keyboard connector (16x1 pin header) + + +Sub board + +700472 +35 0473 03 + +|---------------------------------------| +| 17.73447MHz |-----CN1-----| | +| | +| 74S04 4116 | +| | +| LS90 4116 | +| | +| LS10 4116 | +| | +| LS367 4116 | +| | +| LS393 4116 | +| | +| LS244 4116 | +| | +| LS257 4116 | +| | +| LS257 4116 | +| | +| LS139 | +| | +|---------------------------------------| + +Notes: +All IC's shown. + +4116 - Toshiba TMM416P-3 16Kx1 RAM +CN1 - main board connector (17x2 pin header) + +*/ + +#include "includes/crvision.h" + +/*************************************************************************** + MEMORY MAPS +***************************************************************************/ + +/*------------------------------------------------- + ADDRESS_MAP( crvision_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( crvision_map, AS_PROGRAM, 8, crvision_state ) + AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM + AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write) + AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD(TMS9929_TAG, tms9928a_device, vram_read) + AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_DEVREAD(TMS9929_TAG, tms9928a_device, register_read) + AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffe) AM_DEVWRITE(TMS9929_TAG, tms9928a_device, vram_write) + AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_DEVWRITE(TMS9929_TAG, tms9928a_device, register_write) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(BANK_ROM2) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(BANK_ROM1) +// AM_RANGE(0xc000, 0xe7ff) AM_RAMBANK(3) + AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0xe801, 0xe801) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE(0xe801, 0xe801) AM_DEVWRITE("cent_ctrl_out", output_latch_device, write) +// AM_RANGE(0xe802, 0xf7ff) AM_RAMBANK(4) + AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0) +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( lasr2001_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( lasr2001_map, AS_PROGRAM, 8, laser2001_state ) + AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM + AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write) + AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD(TMS9929_TAG, tms9928a_device, vram_read) + AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_DEVREAD(TMS9929_TAG, tms9928a_device, register_read) + AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffe) AM_DEVWRITE(TMS9929_TAG, tms9928a_device, vram_write) + AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_DEVWRITE(TMS9929_TAG, tms9928a_device, register_write) + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK(BANK_ROM2) + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(BANK_ROM1) + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0) +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/*------------------------------------------------- + INPUT_CHANGED_MEMBER( trigger_nmi ) +-------------------------------------------------*/ + +INPUT_CHANGED_MEMBER( crvision_state::trigger_nmi ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + +/*------------------------------------------------- + INPUT_PORTS( crvision ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( crvision ) + // Player 1 Joystick + + PORT_START("PA0.0") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA0.1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0xfd, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA0.2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA0.3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0xf7, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA0.4") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA0.5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0xdf, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA0.6") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA0.7") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button 2 / CNT'L") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + // Player 1 Keyboard + + PORT_START("PA1.0") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x81, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA1.1") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x83, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA1.2") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x87, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA1.3") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x8f, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA1.4") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x9f, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA1.5") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA1.6") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA1.7") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button 1 / SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + + // Player 2 Joystick + + PORT_START("PA2.0") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA2.1") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0xfd, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA2.2") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA2.3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0xf7, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA2.4") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA2.5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0xdf, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA2.6") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA2.7") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button 2 / \xE2\x86\x92") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) PORT_PLAYER(2) + + // Player 2 Keyboard + + PORT_START("PA3.0") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RET'N") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x81, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA3.1") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x83, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA3.2") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x87, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA3.3") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x8f, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA3.4") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x9f, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA3.5") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA3.6") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA3.7") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button 1 / - =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_PLAYER(2) + + PORT_START("NMI") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, crvision_state, trigger_nmi, 0) +INPUT_PORTS_END + +/*------------------------------------------------- + INPUT_PORTS( manager ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( manager ) + PORT_START("Y.0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('-') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + + PORT_START("Y.1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x84 \xC3\xA4") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) PORT_CHAR(0x00E4) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + + PORT_START("Y.2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x85 \xC3\xA5") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00C5) PORT_CHAR(0x00E5) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("Y.3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x96 \xC3\xB6") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) PORT_CHAR(0x00F6) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + + PORT_START("Y.4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + + PORT_START("Y.5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + + PORT_START("Y.6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + + PORT_START("Y.7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + + PORT_START("JOY.0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) + + PORT_START("JOY.1") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) + + PORT_START("JOY.2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + + PORT_START("JOY.3") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) +INPUT_PORTS_END + +/*************************************************************************** + DEVICE CONFIGURATION +***************************************************************************/ + +WRITE8_MEMBER( crvision_state::pia_pa_w ) +{ + /* + Signal Description + + PA0 Keyboard raster player 1 output (joystick) + PA1 Keyboard raster player 1 output (hand keys) + PA2 Keyboard raster player 2 output (joystick) + PA3 Keyboard raster player 2 output (hand keys) + PA4 ? + PA5 ? + PA6 Cassette motor + PA7 Cassette data in/out + */ + + /* keyboard raster */ + m_keylatch = ~data & 0x0f; + + /* cassette motor */ + m_cassette->change_state(BIT(data,6) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + + /* cassette data output */ + m_cassette->output( BIT(data, 7) ? +1.0 : -1.0); +} + +UINT8 crvision_state::read_keyboard(int pa) +{ + UINT8 value = 0; + + for (int i = 0; i < 8; i++) + { + switch (pa & 3) + { + case 0: value = m_inp_pa0[i]->read(); break; + case 1: value = m_inp_pa1[i]->read(); break; + case 2: value = m_inp_pa2[i]->read(); break; + case 3: value = m_inp_pa3[i]->read(); break; + } + + if (value != 0xff) + { + if (value == 0xff - (1 << i)) + return value; + else + return value - (1 << i); + } + } + + return 0xff; +} + +READ8_MEMBER( crvision_state::pia_pa_r ) +{ + /* + PA0 Keyboard raster player 1 output (joystick) + PA1 Keyboard raster player 1 output (hand keys) + PA2 Keyboard raster player 2 output (joystick) + PA3 Keyboard raster player 2 output (hand keys) + PA4 ? + PA5 ? + PA6 Cassette motor + PA7 Cassette data in/out + */ + + UINT8 data = 0x7f; + + if ((m_cassette)->input() > -0.1469) data |= 0x80; + + return data; +} + +READ8_MEMBER( crvision_state::pia_pb_r ) +{ + /* + Signal Description + + PB0 Keyboard input + PB1 Keyboard input + PB2 Keyboard input + PB3 Keyboard input + PB4 Keyboard input + PB5 Keyboard input + PB6 Keyboard input + PB7 Keyboard input + */ + + UINT8 data = 0xff; + + for (int i = 0; i < 4; i++) + if (m_keylatch >> i & 1) + data &= read_keyboard(i); + + return data; +} + +READ8_MEMBER( laser2001_state::pia_pa_r ) +{ + /* + Signal Description + + PA0 Keyboard column 0 + PA1 Keyboard column 1 + PA2 Keyboard column 2 + PA3 Keyboard column 3 + PA4 Keyboard column 4 + PA5 Keyboard column 5 + PA6 Keyboard column 6 + PA7 Keyboard column 7 + */ + + UINT8 data = 0xff; + + for (int i = 0; i < 8; i++) + if (~m_keylatch >> i & 1) + data &= m_inp_y[i]->read(); + + return data; +} + +WRITE8_MEMBER( laser2001_state::pia_pa_w ) +{ + /* + PA0 Joystick player 1 output 0 + PA1 Joystick player 1 output 1 + PA2 Joystick player 2 output 0 + PA3 Joystick player 2 output 1 + PA4 ? + PA5 ? + PA6 ? + PA7 ? + */ + + m_joylatch = data; +} + +READ8_MEMBER( laser2001_state::pia_pb_r ) +{ + UINT8 data = 0xff; + + for (int i = 0; i < 4; i++) + if (~m_joylatch >> i & 1) + data &= m_inp_joy[i]->read(); + + return data; +} + +WRITE8_MEMBER( laser2001_state::pia_pb_w ) +{ + /* + Signal Description + + PB0 Keyboard row 0, PSG data 7, centronics data 0 + PB1 Keyboard row 1, PSG data 6, centronics data 1 + PB2 Keyboard row 2, PSG data 5, centronics data 2 + PB3 Keyboard row 3, PSG data 4, centronics data 3 + PB4 Keyboard row 4, PSG data 3, centronics data 4 + PB5 Keyboard row 5, PSG data 2, centronics data 5 + PB6 Keyboard row 6, PSG data 1, centronics data 6 + PB7 Keyboard row 7, PSG data 0, centronics data 7 + */ + + /* keyboard latch */ + m_keylatch = data; + + /* centronics data */ + m_cent_data_out->write(space, 0, data); +} + +READ_LINE_MEMBER( laser2001_state::pia_ca1_r ) +{ + return (m_cassette)->input() > -0.1469; +} + +WRITE_LINE_MEMBER( laser2001_state::pia_ca2_w ) +{ + m_cassette->output(state ? +1.0 : -1.0); +} + + +WRITE_LINE_MEMBER(laser2001_state::write_centronics_busy) +{ + m_centronics_busy = state; + m_pia->cb1_w(pia_cb1_r()); +} + +WRITE_LINE_MEMBER(laser2001_state::write_psg_ready) +{ + m_psg_ready = state; + m_pia->cb1_w(pia_cb1_r()); +} + +READ_LINE_MEMBER( laser2001_state::pia_cb1_r ) +{ + /* actually this is a diode-AND (READY & _BUSY), but ctronics.c returns busy status if no device is mounted -> Manager won't boot */ + return m_psg_ready && (!m_centronics_busy || m_pia->ca2_output_z()); +} + +WRITE_LINE_MEMBER( laser2001_state::pia_cb2_w ) +{ + if (m_pia->ca2_output_z()) + { + if (!state) m_psg->write(m_keylatch); + } + else + { + m_centronics->write_strobe(state); + } +} + +/*************************************************************************** + MACHINE INITIALIZATION +***************************************************************************/ + +void crvision_state::machine_start() +{ + // zerofill/state saving + m_keylatch = 0; + save_item(NAME(m_keylatch)); + + if (m_cart->exists()) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(crvision_cart_slot_device::read_rom40),(crvision_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(crvision_cart_slot_device::read_rom80),(crvision_cart_slot_device*)m_cart)); + } +} + +void laser2001_state::machine_start() +{ + crvision_state::machine_start(); + + // zerofill/state saving + m_joylatch = 0; + m_centronics_busy = 0; + m_psg_ready = 0; + + save_item(NAME(m_joylatch)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_psg_ready)); +} + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static SLOT_INTERFACE_START(crvision_cart) + SLOT_INTERFACE_INTERNAL("crv_rom4k", CRVISION_ROM_4K) + SLOT_INTERFACE_INTERNAL("crv_rom6k", CRVISION_ROM_6K) + SLOT_INTERFACE_INTERNAL("crv_rom8k", CRVISION_ROM_8K) + SLOT_INTERFACE_INTERNAL("crv_rom10k", CRVISION_ROM_10K) + SLOT_INTERFACE_INTERNAL("crv_rom12k", CRVISION_ROM_12K) + SLOT_INTERFACE_INTERNAL("crv_rom16k", CRVISION_ROM_16K) + SLOT_INTERFACE_INTERNAL("crv_rom18k", CRVISION_ROM_18K) +SLOT_INTERFACE_END + +/*------------------------------------------------- + MACHINE_CONFIG_START( creativision, crvision_state ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( creativision, crvision_state ) + // basic machine hardware + MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(crvision_map) + + // devices + MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(crvision_state, pia_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(crvision_state, pia_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(crvision_state, pia_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8(SN76489_TAG, sn76496_base_device, write)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) + + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) + MCFG_OUTPUT_LATCH_BIT4_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SN76489_TAG, SN76489A, XTAL_2MHz) + MCFG_SN76496_READY_HANDLER(DEVWRITELINE(PIA6821_TAG, pia6821_device, cb1_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(1, "mono", 0.25) + + // cartridge + MCFG_CRVISION_CARTRIDGE_ADD("cartslot", crvision_cart, NULL) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") // MAIN RAM + MCFG_RAM_EXTRA_OPTIONS("15K") // 16K expansion (lower 14K available only, upper 2K shared with BIOS ROM) + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list", "crvision") +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_CONFIG_DERIVED( ntsc, creativision ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_DERIVED( ntsc, creativision ) + // video hardware + MCFG_DEVICE_ADD( TMS9929_TAG, TMS9918, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) + MCFG_SCREEN_UPDATE_DEVICE( TMS9929_TAG, tms9918_device, screen_update ) +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_CONFIG_DERIVED( pal, creativision ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_DERIVED_CLASS( pal, creativision, crvision_pal_state ) + // video hardware + MCFG_DEVICE_ADD( TMS9929_TAG, TMS9929, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0)) + MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) + MCFG_SCREEN_UPDATE_DEVICE( TMS9929_TAG, tms9929_device, screen_update ) +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_CONFIG_START( lasr2001, laser2001_state ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( lasr2001, laser2001_state ) + // basic machine hardware + MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_17_73447MHz/9) + MCFG_CPU_PROGRAM_MAP(lasr2001_map) + + // devices + MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(laser2001_state, pia_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(laser2001_state, pia_pb_r)) + MCFG_PIA_READCA1_HANDLER(READLINE(laser2001_state, pia_ca1_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(laser2001_state, pia_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(laser2001_state, pia_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(laser2001_state, pia_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(laser2001_state, pia_cb2_w)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(laser2001_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + // video hardware + MCFG_DEVICE_ADD( TMS9929_TAG, TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0)) + MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) + MCFG_SCREEN_UPDATE_DEVICE( TMS9929_TAG, tms9929a_device, screen_update ) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SN76489_TAG, SN76489A, XTAL_17_73447MHz/9) + MCFG_SN76496_READY_HANDLER(WRITELINE(laser2001_state, write_psg_ready)) + + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(1, "mono", 0.25) + + // cartridge + MCFG_CRVISION_CARTRIDGE_ADD("cartslot", crvision_cart, NULL) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K") + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list","crvision") +MACHINE_CONFIG_END + +/*************************************************************************** + ROMS +***************************************************************************/ + +ROM_START( crvision ) + ROM_REGION( 0x10000, M6502_TAG, 0 ) + ROM_LOAD( "crvision.u20", 0x0000, 0x0800, CRC(c3c590c6) SHA1(5ac620c529e4965efb5560fe824854a44c983757) ) +ROM_END + +ROM_START( fnvision ) + ROM_REGION( 0x10000, M6502_TAG, 0 ) + ROM_LOAD( "funboot.rom", 0x0000, 0x0800, CRC(05602697) SHA1(c280b20c8074ba9abb4be4338b538361dfae517f) ) +ROM_END + +#define rom_wizzard rom_crvision +#define rom_crvisioj rom_crvision +#define rom_crvisio2 rom_crvision +#define rom_rameses rom_fnvision +#define rom_vz2000 rom_fnvision + +ROM_START( manager ) + ROM_REGION( 0x10000, M6502_TAG, 0 ) + ROM_LOAD( "01", 0x0000, 0x2000, CRC(702f4cf5) SHA1(cd14ee74e787d24b76c166de484dae24206e219b) ) + ROM_LOAD( "23", 0x2000, 0x2000, CRC(46489d88) SHA1(467f5bcd62d0b4117c443e13373df8f3c45df7b2) ) + + ROM_REGION( 0x1000, "disk", 0 ) + ROM_LOAD( "floppy interface cartridge", 0x0000, 0x1000, NO_DUMP ) +ROM_END + +/*************************************************************************** + SYSTEM DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1982, crvision, 0, 0, pal, crvision, driver_device, 0, "Video Technology", "CreatiVision", 0 ) +CONS( 1982, fnvision, crvision, 0, pal, crvision, driver_device, 0, "Video Technology", "FunVision", 0 ) +CONS( 1982, crvisioj, crvision, 0, ntsc, crvision, driver_device, 0, "Cheryco", "CreatiVision (Japan)", 0 ) +CONS( 1982, wizzard, crvision, 0, pal, crvision, driver_device, 0, "Dick Smith Electronics", "Wizzard (Oceania)", 0 ) +CONS( 1982, rameses, crvision, 0, pal, crvision, driver_device, 0, "Hanimex", "Rameses (Oceania)", 0 ) +CONS( 1983, vz2000, crvision, 0, pal, crvision, driver_device, 0, "Dick Smith Electronics", "VZ 2000 (Oceania)", 0 ) +CONS( 1983, crvisio2, crvision, 0, pal, crvision, driver_device, 0, "Video Technology", "CreatiVision MK-II (Europe)", 0 ) +//COMP( 1983, lasr2001, 0, 0, lasr2001, lasr2001, driver_device, 0, "Video Technology", "Laser 2001", MACHINE_NOT_WORKING ) +//COMP( 1983, vz2001, lasr2001, 0, lasr2001, lasr2001, driver_device, 0, "Dick Smith Electronics", "VZ 2001 (Oceania)", MACHINE_NOT_WORKING ) +COMP( 1983, manager, 0, 0, lasr2001, manager, driver_device, 0, "Salora", "Manager (Finland)", 0 ) diff --git a/src/mame/drivers/csc.c b/src/mame/drivers/csc.c new file mode 100644 index 00000000000..dcf62474038 --- /dev/null +++ b/src/mame/drivers/csc.c @@ -0,0 +1,346 @@ +// license:BSD-3-Clause +// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco +/****************************************************************************** + + Fidelity Champion Chess Challenger (model CSC) + + See fidelz80.c for hardware description + + TODO: + - speech doesn't work + - make a better artwork + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/6821pia.h" +#include "sound/s14001a.h" + +#include "debugger.h" + +// same layout of Sensory Chess Challenger +extern const char layout_vsc[]; + +class csc_state : public driver_device +{ +public: + csc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_speech(*this, "speech") + , + m_maincpu(*this, "maincpu") { } + + required_device m_speech; + + virtual void machine_start(); + + UINT16 input_read(int index); + DECLARE_WRITE8_MEMBER( pia0_pa_w ); + DECLARE_WRITE8_MEMBER( pia0_pb_w ); + DECLARE_READ8_MEMBER( pia0_pb_r ); + DECLARE_WRITE_LINE_MEMBER( pia0_ca2_w ); + DECLARE_WRITE8_MEMBER( pia1_pa_w ); + DECLARE_WRITE8_MEMBER( pia1_pb_w ); + DECLARE_READ8_MEMBER( pia1_pa_r ); + DECLARE_WRITE_LINE_MEMBER( pia1_ca2_w ); + DECLARE_WRITE_LINE_MEMBER( pia1_cb2_w ); + DECLARE_READ_LINE_MEMBER( pia1_ca1_r ); + DECLARE_READ_LINE_MEMBER( pia1_cb1_r ); + + UINT8 m_selector; + TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); + required_device m_maincpu; +}; + + +UINT16 csc_state::input_read(int index) +{ + static const char *const col_tag[] = + { + "COL_A", "COL_B", "COL_C", "COL_D", "COL_E", + "COL_F", "COL_G", "COL_H", "COL_I" + }; + + return ioport(col_tag[index])->read(); +} + + +WRITE8_MEMBER( csc_state::pia0_pa_w ) +{ + UINT8 out_digit = BITSWAP8(data,0,1,5,6,7,2,3,4 ); + + switch (m_selector) + { + case 0: + output_set_digit_value(0, out_digit & 0x7f); + output_set_value("pm_led", BIT(out_digit, 7)); + break; + case 1: + output_set_digit_value(1, out_digit & 0x7f); + break; + case 2: + output_set_digit_value(2, out_digit & 0x7f); + output_set_value("up_dot", BIT(out_digit, 7)); + break; + case 3: + output_set_digit_value(3, out_digit & 0x7f); + output_set_value("low_dot", BIT(out_digit, 7)); + break; + } + +// m_speech->reg_w(data & 0x3f); + + // for avoid the digit flashing + m_selector |= 0x80; +} + +WRITE8_MEMBER( csc_state::pia0_pb_w ) +{ +// m_speech->set_volume(15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... +// m_speech->rst_w(BIT(data, 1)); +} + +READ8_MEMBER( csc_state::pia0_pb_r ) +{ + UINT8 data = 0x04; + + if(m_speech->bsy_r()) + data |= 0x08; + + if (m_selector<9) + if (input_read(m_selector) & 0x100) + data |= 0x20; + + return data; +} + +WRITE_LINE_MEMBER( csc_state::pia0_ca2_w ) +{ +} + +WRITE8_MEMBER( csc_state::pia1_pa_w ) +{ + m_selector = (m_selector & 0x0c) | ((data>>6) & 0x03); +} + +WRITE8_MEMBER( csc_state::pia1_pb_w ) +{ + static const char *const row_tag[] = + { + "led_a", "led_b", "led_c", "led_d", + "led_e", "led_f", "led_g", "led_h" + }; + + if (m_selector < 8) + for (int i=0; i<8; i++) + output_set_indexed_value(row_tag[m_selector], i+1, BIT(data, 7-i)); +} + +READ8_MEMBER( csc_state::pia1_pa_r ) +{ + UINT8 data = 0xff; + + if (m_selector<9) + data = input_read(m_selector); + + return data & 0x3f; +} + +WRITE_LINE_MEMBER( csc_state::pia1_ca2_w ) +{ + m_selector = (m_selector & 0x07) | (state ? 8 : 0); +} + +WRITE_LINE_MEMBER( csc_state::pia1_cb2_w ) +{ + m_selector = (m_selector & 0x0b) | (state ? 4 : 0); +} + +READ_LINE_MEMBER( csc_state::pia1_ca1_r ) +{ + int data = 0x01; + + if (m_selector<9) + data = BIT(input_read(m_selector), 6); + + return data; +} + +READ_LINE_MEMBER( csc_state::pia1_cb1_r ) +{ + int data = 0x01; + + if (m_selector<9) + data = BIT(input_read(m_selector),7); + + return data; +} + + +TIMER_DEVICE_CALLBACK_MEMBER(csc_state::irq_timer) +{ + m_maincpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); +} + +/* Address maps */ +static ADDRESS_MAP_START(csc_mem, AS_PROGRAM, 8, csc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff) AM_RAM AM_MIRROR(0x4000) //2K RAM + AM_RANGE( 0x0800, 0x0bff) AM_RAM AM_MIRROR(0x4400) //1K RAM + AM_RANGE( 0x1000, 0x1003) AM_DEVREADWRITE("pia0", pia6821_device, read, write) AM_MIRROR(0x47fc) + AM_RANGE( 0x1800, 0x1803) AM_DEVREADWRITE("pia1", pia6821_device, read, write) AM_MIRROR(0x47fc) + AM_RANGE( 0x2000, 0x3fff) AM_ROM AM_MIRROR(0x4000) + AM_RANGE( 0x8000, 0x9fff) AM_NOP + AM_RANGE( 0xa000, 0xffff) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( csc ) + PORT_START("COL_A") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) + PORT_START("COL_B") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) + PORT_START("COL_C") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) + PORT_START("COL_D") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) + PORT_START("COL_E") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) + PORT_START("COL_F") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) + PORT_START("COL_G") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_START("COL_H") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_START("COL_I") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) + PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED +INPUT_PORTS_END + + +void csc_state::machine_start() +{ + save_item(NAME(m_selector)); +} + +/* Machine driver */ +static MACHINE_CONFIG_START( csc, csc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 3900000/2) + MCFG_CPU_PROGRAM_MAP(csc_mem) + + MCFG_DEFAULT_LAYOUT(layout_vsc) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", csc_state, irq_timer, attotime::from_hz(38400/64)) + + MCFG_DEVICE_ADD("pia0", PIA6821, 0) + MCFG_PIA_READPB_HANDLER(READ8(csc_state, pia0_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(csc_state, pia0_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(csc_state, pia0_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(csc_state, pia0_ca2_w)) + + MCFG_DEVICE_ADD("pia1", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(csc_state, pia1_pa_r)) + MCFG_PIA_READCA1_HANDLER(READLINE(csc_state, pia1_ca1_r)) + MCFG_PIA_READCB1_HANDLER(READLINE(csc_state, pia1_cb1_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(csc_state, pia1_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(csc_state, pia1_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(csc_state, pia1_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(csc_state, pia1_cb2_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speech", S14001A, 25000) // around 25khz + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START(csc) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341)) + ROM_LOAD("1025a03.bin", 0xa000, 0x2000, CRC(63982c07) SHA1(5ed4356323d5c80df216da55994abe94ba4aa94c)) + ROM_LOAD("1025a02.bin", 0xc000, 0x2000, CRC(9e6e7c69) SHA1(4f1ed9141b6596f4d2b1217d7a4ba48229f3f1b0)) + ROM_LOAD("1025a01.bin", 0xe000, 0x2000, CRC(57f068c3) SHA1(7d2ac4b9a2fba19556782863bdd89e2d2d94e97b)) + + ROM_LOAD("74s474.bin", 0xfe00, 0x0200, CRC(4511ba31) SHA1(e275b1739f8c3aa445cccb6a2b597475f507e456)) + + ROM_REGION(0x2000, "speech", 0) + ROM_LOAD("101-32107.bin", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Chess Challenger (model CSC)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK) diff --git a/src/mame/drivers/ct486.c b/src/mame/drivers/ct486.c new file mode 100644 index 00000000000..91cc9d85c3f --- /dev/null +++ b/src/mame/drivers/ct486.c @@ -0,0 +1,198 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + PC/AT 486 with Chips & Technologies CS4031 chipset + +***************************************************************************/ + +#include "emu.h" +#include "cpu/i386/i386.h" +#include "machine/ram.h" +#include "machine/cs4031.h" +#include "machine/at_keybc.h" +#include "bus/pc_kbd/pc_kbdc.h" +#include "bus/pc_kbd/keyboards.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "sound/speaker.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class ct486_state : public driver_device +{ +public: + ct486_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cs4031(*this, "cs4031"), + m_isabus(*this, "isabus"), + m_speaker(*this, "speaker") + { } + + required_device m_maincpu; + required_device m_cs4031; + required_device m_isabus; + required_device m_speaker; + + virtual void machine_start(); + + DECLARE_READ16_MEMBER( cs4031_ior ); + DECLARE_WRITE16_MEMBER( cs4031_iow ); + DECLARE_WRITE_LINE_MEMBER( cs4031_hold ); + DECLARE_WRITE8_MEMBER( cs4031_tc ) { m_isabus->eop_w(offset, data); } + DECLARE_WRITE_LINE_MEMBER( cs4031_spkr ) { m_speaker->level_w(state); } +}; + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void ct486_state::machine_start() +{ +} + +READ16_MEMBER( ct486_state::cs4031_ior ) +{ + if (offset < 4) + return m_isabus->dack_r(offset); + else + return m_isabus->dack16_r(offset); +} + +WRITE16_MEMBER( ct486_state::cs4031_iow ) +{ + if (offset < 4) + m_isabus->dack_w(offset, data); + else + m_isabus->dack16_w(offset, data); +} + +WRITE_LINE_MEMBER( ct486_state::cs4031_hold ) +{ + // halt cpu + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + // and acknowledge hold + m_cs4031->hlda_w(state); +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( ct486_map, AS_PROGRAM, 32, ct486_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ct486_io, AS_IO, 32, ct486_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static MACHINE_CONFIG_START( ct486, ct486_state ) + MCFG_CPU_ADD("maincpu", I486, XTAL_25MHz) + MCFG_CPU_PROGRAM_MAP(ct486_map) + MCFG_CPU_IO_MAP(ct486_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("cs4031", cs4031_device, int_ack_r) + + MCFG_CS4031_ADD("cs4031", XTAL_25MHz, "maincpu", "isa", "bios", "keybc") + // cpu connections + MCFG_CS4031_HOLD(WRITELINE(ct486_state, cs4031_hold)); + MCFG_CS4031_NMI(INPUTLINE("maincpu", INPUT_LINE_NMI)); + MCFG_CS4031_INTR(INPUTLINE("maincpu", INPUT_LINE_IRQ0)); + MCFG_CS4031_CPURESET(INPUTLINE("maincpu", INPUT_LINE_RESET)); + MCFG_CS4031_A20M(INPUTLINE("maincpu", INPUT_LINE_A20)); + // isa dma + MCFG_CS4031_IOR(READ16(ct486_state, cs4031_ior)) + MCFG_CS4031_IOW(WRITE16(ct486_state, cs4031_iow)) + MCFG_CS4031_TC(WRITE8(ct486_state, cs4031_tc)) + // speaker + MCFG_CS4031_SPKR(WRITELINE(ct486_state, cs4031_spkr)) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,16M,32M,64M") + + MCFG_DEVICE_ADD("keybc", AT_KEYBOARD_CONTROLLER, XTAL_12MHz) + MCFG_AT_KEYBOARD_CONTROLLER_SYSTEM_RESET_CB(DEVWRITELINE("cs4031", cs4031_device, kbrst_w)) + MCFG_AT_KEYBOARD_CONTROLLER_GATE_A20_CB(DEVWRITELINE("cs4031", cs4031_device, gatea20_w)) + MCFG_AT_KEYBOARD_CONTROLLER_INPUT_BUFFER_FULL_CB(DEVWRITELINE("cs4031", cs4031_device, irq01_w)) + MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_CLOCK_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, clock_write_from_mb)) + MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_DATA_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, data_write_from_mb)) + MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0) + MCFG_PC_KBDC_OUT_CLOCK_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_clock_w)) + MCFG_PC_KBDC_OUT_DATA_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_data_w)) + MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) + + MCFG_DEVICE_ADD("isabus", ISA16, 0) + MCFG_ISA16_CPU(":maincpu") + MCFG_ISA_BUS_IOCHCK(DEVWRITELINE("cs4031", cs4031_device, iochck_w)) + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("cs4031", cs4031_device, irq09_w)) + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("cs4031", cs4031_device, irq03_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("cs4031", cs4031_device, irq04_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("cs4031", cs4031_device, irq05_w)) + MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("cs4031", cs4031_device, irq06_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("cs4031", cs4031_device, irq07_w)) + MCFG_ISA_OUT_IRQ10_CB(DEVWRITELINE("cs4031", cs4031_device, irq10_w)) + MCFG_ISA_OUT_IRQ11_CB(DEVWRITELINE("cs4031", cs4031_device, irq11_w)) + MCFG_ISA_OUT_IRQ12_CB(DEVWRITELINE("cs4031", cs4031_device, irq12_w)) + MCFG_ISA_OUT_IRQ14_CB(DEVWRITELINE("cs4031", cs4031_device, irq14_w)) + MCFG_ISA_OUT_IRQ15_CB(DEVWRITELINE("cs4031", cs4031_device, irq15_w)) + MCFG_ISA_OUT_DRQ0_CB(DEVWRITELINE("cs4031", cs4031_device, dreq0_w)) + MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("cs4031", cs4031_device, dreq1_w)) + MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("cs4031", cs4031_device, dreq2_w)) + MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("cs4031", cs4031_device, dreq3_w)) + MCFG_ISA_OUT_DRQ5_CB(DEVWRITELINE("cs4031", cs4031_device, dreq5_w)) + MCFG_ISA_OUT_DRQ6_CB(DEVWRITELINE("cs4031", cs4031_device, dreq6_w)) + MCFG_ISA_OUT_DRQ7_CB(DEVWRITELINE("cs4031", cs4031_device, dreq7_w)) + MCFG_ISA16_SLOT_ADD("isabus", "board1", pc_isa16_cards, "fdcsmc", true) + MCFG_ISA16_SLOT_ADD("isabus", "board2", pc_isa16_cards, "comat", true) + MCFG_ISA16_SLOT_ADD("isabus", "board3", pc_isa16_cards, "ide", true) + MCFG_ISA16_SLOT_ADD("isabus", "board4", pc_isa16_cards, "lpt", true) + MCFG_ISA16_SLOT_ADD("isabus", "isa1", pc_isa16_cards, "svga_et4k", false) + MCFG_ISA16_SLOT_ADD("isabus", "isa2", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus", "isa3", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus", "isa4", pc_isa16_cards, NULL, false) + MCFG_ISA16_SLOT_ADD("isabus", "isa5", pc_isa16_cards, NULL, false) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + // video hardware + MCFG_PALETTE_ADD("palette", 256) // todo: really needed? + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("pc_disk_list","ibm5150") + MCFG_SOFTWARE_LIST_ADD("xt_disk_list","ibm5160_flop") + MCFG_SOFTWARE_LIST_ADD("at_disk_list","ibm5170") + MCFG_SOFTWARE_LIST_ADD("at_cdrom_list","ibm5170_cdrom") +MACHINE_CONFIG_END + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( ct486 ) + ROM_REGION(0x40000, "isa", ROMREGION_ERASEFF) + ROM_REGION(0x100000, "bios", 0) + ROM_LOAD("chips_1.ami", 0xf0000, 0x10000, CRC(a14a7511) SHA1(b88d09be66905ed2deddc26a6f8522e7d2d6f9a8)) +ROM_END + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +COMP( 1993, ct486, 0, 0, ct486, 0, driver_device, 0, "", "PC/AT 486 with CS4031 chipset", 0 ) diff --git a/src/mame/drivers/cvicny.c b/src/mame/drivers/cvicny.c new file mode 100644 index 00000000000..416309d78d0 --- /dev/null +++ b/src/mame/drivers/cvicny.c @@ -0,0 +1,149 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + CVICNY8080 - Practice-z80 - a homebrew from Czechoslavakia. + + More data at : + http://www.nostalcomp.cz/cvicny8080.php + + 21/OCT/2011 New working driver. [Robbbert] + + Keys: + 0-9,A-F : hexadecimal numbers + ADR : enter an address to work with. After the 4 digits are entered, + the data at that address shows, and you can modify the data. + + (inc) : Enter the data into memory, and increment the address by 1. + GO : execute the program located at the current address. + + Pasting: + 0-F : as is + + (inc) : ^ + ADR : - + GO : X + + Test Paste: + 11^22^33^44^55^66^77^88^99^-0800 + Now press up-arrow to confirm the data has been entered. + + ToDo: + - When ADR is pressed, sometimes a segment stays alight. Bug? + - Blank the display if digits aren't being refreshed + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cvicny.lh" + +class cvicny_state : public driver_device +{ +public: + cvicny_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_digit_last(0) + { } + + required_device m_maincpu; + DECLARE_READ8_MEMBER(key_r); + DECLARE_WRITE8_MEMBER(digit_w); + DECLARE_WRITE8_MEMBER(segment_w ); + UINT8 m_digit; + UINT8 m_digit_last; +}; + +WRITE8_MEMBER( cvicny_state::segment_w ) // output segments on the selected digit +{ + if (m_digit != m_digit_last) + output_set_digit_value(m_digit, data); + + m_digit_last = m_digit; +} + +WRITE8_MEMBER( cvicny_state::digit_w ) // set keyboard scanning row; set digit to display +{ + m_digit = data & 7; +} + +READ8_MEMBER( cvicny_state::key_r ) +{ + UINT8 data; + char kbdrow[6]; + sprintf(kbdrow,"X%d",m_digit); + data = ioport(kbdrow)->read(); + return ((data << 4) ^ 0xf0) | data; +} + +static ADDRESS_MAP_START( cvicny_mem, AS_PROGRAM, 8, cvicny_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM // 1 x 2716 + AM_RANGE(0x0800, 0x0bff) AM_RAM AM_MIRROR(0x400) // 2x 2114 static ram + AM_RANGE(0x1000, 0x17ff) AM_READ(key_r) + AM_RANGE(0x1800, 0x1fff) AM_WRITE(digit_w) + AM_RANGE(0x2000, 0x27ff) AM_WRITE(segment_w) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( cvicny ) + PORT_START("X0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("X3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + + PORT_START("X4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ADR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X5") + PORT_BIT( 0x0F, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X6") + PORT_BIT( 0x0F, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X7") + PORT_BIT( 0x0F, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( cvicny, cvicny_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(cvicny_mem) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_cvicny) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( cvicny ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("cvicny8080.bin", 0x0000, 0x05ea, CRC(e6119052) SHA1(d03c2cbfd047f0d090a787fbbde6353593cc2dd8) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, cvicny, 0, 0, cvicny, cvicny, driver_device, 0, "", "Practice-z80", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/cxhumax.c b/src/mame/drivers/cxhumax.c new file mode 100644 index 00000000000..4fc5ab65151 --- /dev/null +++ b/src/mame/drivers/cxhumax.c @@ -0,0 +1,1085 @@ +// license:BSD-3-Clause +// copyright-holders:Lukasz Markowski +/*************************************************************************** + HUMAX HDCI-2000 ( Conexant CX2417x ) + + http://www.humaxdigital.com/global/products/product_stb_satellite_hdci2000.asp + + Running on Nucleus PLUS - ARM7TDMI ADS v. 1.14 + some Conexant/Nucleus goodies may be found at http://code.google.com/p/cherices/ + + runs up to frame 280 or so... + +****************************************************************************/ + +#include "emu.h" +#include "includes/cxhumax.h" + +#define VERBOSE_LEVEL ( 0 ) + +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...) +{ + if (VERBOSE_LEVEL >= n_level) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt); + vsprintf( buf, s_fmt, v); + va_end( v); + logerror( "%s: %s", machine.describe_context( ), buf); + } +} + +READ32_MEMBER ( cxhumax_state::cx_gxa_r ) +{ + UINT32 res = m_gxa_cmd_regs[offset]; + verboselog( machine(), 9, "(GXA) %08X -> %08X\n", 0xE0600000 + (offset << 2), res); +/* UINT8 gxa_command_number = (offset >> 9) & 0x7F; + verboselog( machine(), 9, " Command: %08X\n", gxa_command_number); + switch (gxa_command_number) { + case GXA_CMD_RW_REGISTER: + switch(offset) { + case GXA_CFG2_REG: + break; + default: + verboselog( machine(), 9, " Unimplemented register - TODO?\n"); + break; + } + break; + default: + // do we need it? + verboselog( machine(), 9, " Unimplemented read command - TODO?\n"); + break; + }*/ + return res; +} + +WRITE32_MEMBER( cxhumax_state::cx_gxa_w ) +{ + verboselog( machine(), 9, "(GXA) %08X <- %08X\n", 0xE0600000 + (offset << 2), data); + UINT8 gxa_command_number = (offset >> 9) & 0x7F; + verboselog( machine(), 9, " Command: %08X\n", gxa_command_number); + + /* Clear non persistent data */ + m_gxa_cmd_regs[GXA_CMD_REG] &= 0xfffc0000; + + if (gxa_command_number == GXA_CMD_RW_REGISTER) { + verboselog( machine(), 9, " Register Number: %08X\n", offset & 0xff); + } else { + m_gxa_cmd_regs[GXA_CMD_REG] |= (offset << 2) & 0x3ffff; + verboselog( machine(), 9, " Source Bitmap Selector: %08X\n", (offset >> 6) & 0x7); + verboselog( machine(), 9, " Destination Bitmap Selector: %08X\n", (offset >> 3) & 0x7); + verboselog( machine(), 9, " Parameter Count: %08X\n", offset & 0x7); + } + switch (gxa_command_number) { + case GXA_CMD_RW_REGISTER: + switch(offset) { + case GXA_CFG2_REG: + // clear IRQ_STAT bits if requested + m_gxa_cmd_regs[GXA_CFG2_REG] = (m_gxa_cmd_regs[GXA_CFG2_REG]&(0xfff00000 & ~(data&0x00300000))) | (data & 0x000fffff); + break; + default: + verboselog( machine(), 9, " Unimplemented register - TODO?\n"); + COMBINE_DATA(&m_gxa_cmd_regs[offset]); + break; + } + break; + case GXA_CMD_QMARK: + verboselog( machine(), 9, " QMARK - TODO?\n"); + + /* Set value and copy of WAIT4_VERTICAL bit written by QMARK */ + m_gxa_cmd_regs[GXA_CMD_REG] = (m_gxa_cmd_regs[GXA_CMD_REG] & 0x3ffff) | (data<<24) | ((data&0x10)?1<<23:0); + + /* QMARK command has completed */ + m_gxa_cmd_regs[GXA_CFG2_REG] |= (1<set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + + break; + default: + verboselog( machine(), 9, " Unimplemented command - TODO?\n"); + break; + } +} + +WRITE32_MEMBER ( cxhumax_state::flash_w ) +{ + offset *= 2; + if(ACCESSING_BITS_0_15) + m_flash->write(offset, data); + if(ACCESSING_BITS_16_31) + m_flash->write(offset+1, data >> 16); + verboselog( machine(), 9, "(FLASH) %08X <- %08X\n", 0xF0000000 + (offset << 2), data); +} + +READ32_MEMBER ( cxhumax_state::flash_r ) +{ + UINT32 res = 0; + offset *= 2; + if(ACCESSING_BITS_0_15) + res |= m_flash->read(offset); + if(ACCESSING_BITS_16_31) + res |= m_flash->read(offset+1) << 16; + //if(m_flash->m_flash_mode!=FM_NORMAL) verboselog( machine(), 9, "(FLASH) %08X -> %08X\n", 0xF0000000 + (offset << 2), res); + return res; +} + +READ32_MEMBER ( cxhumax_state::dummy_flash_r ) +{ + return 0xFFFFFFFF; +} + +WRITE32_MEMBER ( cxhumax_state::cx_remap_w ) +{ + if(!(data&1)) { + verboselog( machine(), 9, "(REMAP) %08X -> %08X\n", 0xE0400014 + (offset << 2), data); + memset(m_ram, 0, 0x400000); // workaround :P + } +} + +READ32_MEMBER( cxhumax_state::cx_scratch_r ) +{ + UINT32 data = m_scratch_reg; + verboselog( machine(), 9, "(SCRATCH) %08X -> %08X\n", 0xE0400024 + (offset << 2), data); + + if((m_maincpu->pc()==0xF0003BB8) || (m_maincpu->pc()==0x01003724) || (m_maincpu->pc()==0x00005d8c)) { // HDCI-2000 + //we're in disabled debug_printf + unsigned char* buf = (unsigned char *)alloca(200); + unsigned char temp; + address_space &program = m_maincpu->space(AS_PROGRAM); + + memset(buf,0,200); + + int i = 0; + while ((temp=program.read_byte(m_maincpu->state_int(ARM7_R0)+i))) { + buf[i++]=temp; + //m_terminal->write(space, 0, temp); + } + osd_printf_debug("%s", buf); + verboselog( machine(), 9, "(DEBUG) %s", buf); + } + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_scratch_w ) +{ + verboselog( machine(), 9, "(SCRATCH) %08X <- %08X\n", 0xE0400024 + (offset << 2), data); + COMBINE_DATA(&m_scratch_reg); +} + +READ32_MEMBER( cxhumax_state::cx_hsx_r ) +{ + UINT32 data = 0; // dummy + verboselog( machine(), 9, "(HSX) %08X -> %08X\n", 0xE0000000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_hsx_w ) +{ + verboselog( machine(), 9, "(HSX) %08X <- %08X\n", 0xE0000000 + (offset << 2), data); +} + +READ32_MEMBER( cxhumax_state::cx_romdescr_r ) +{ + UINT32 data = m_romdescr_reg; + verboselog( machine(), 9, "(ROMDESC0) %08X -> %08X\n", 0xE0010000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_romdescr_w ) +{ + verboselog( machine(), 9, "(ROMDESC0) %08X <- %08X\n", 0xE0010000 + (offset << 2), data); + COMBINE_DATA(&m_romdescr_reg); +} + +READ32_MEMBER( cxhumax_state::cx_isaromdescr_r ) +{ + UINT32 data = m_isaromdescr_regs[offset]; + verboselog( machine(), 9, "(ISAROMDESC%d) %08X -> %08X\n", offset+1, 0xE0010004 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_isaromdescr_w ) +{ + verboselog( machine(), 9, "(ISAROMDESC%d) %08X <- %08X\n", offset+1, 0xE0010004 + (offset << 2), data); + COMBINE_DATA(&m_isaromdescr_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_isadescr_r ) +{ + UINT32 data = m_isaromdescr_regs[offset]; + verboselog( machine(), 9, "(ISA_DESC%d) %08X -> %08X\n", offset+4, 0xE0010010 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_isadescr_w ) +{ + verboselog( machine(), 9, "(ISA_DESC%d) %08X <- %08X\n", offset+4, 0xE0010010 + (offset << 2), data); + COMBINE_DATA(&m_isaromdescr_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_rommap_r ) +{ + UINT32 data = 0; + verboselog( machine(), 9, "(ROM%d_MAP) %08X -> %08X\n", offset, 0xE0010020 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_rommap_w ) +{ + verboselog( machine(), 9, "(ROM%d_MAP) %08X <- %08X\n", offset, 0xE0010020 + (offset << 2), data); +} + +READ32_MEMBER( cxhumax_state::cx_rommode_r ) +{ + UINT32 data = m_rommode_reg; + verboselog( machine(), 9, "(ROMMODE) %08X -> %08X\n", 0xE0010034 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_rommode_w ) +{ + verboselog( machine(), 9, "(ROMMODE) %08X <- %08X\n", 0xE0010034 + (offset << 2), data); + COMBINE_DATA(&m_rommode_reg); +} + +READ32_MEMBER( cxhumax_state::cx_xoemask_r ) +{ + UINT32 data = m_xoemask_reg; + verboselog( machine(), 9, "(XOEMASK) %08X -> %08X\n", 0xE0010034 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_xoemask_w ) +{ + verboselog( machine(), 9, "(XOEMASK) %08X <- %08X\n", 0xE0010034 + (offset << 2), data); + COMBINE_DATA(&m_xoemask_reg); +} + +READ32_MEMBER( cxhumax_state::cx_pci_r ) +{ + UINT32 data = 0; + switch (offset) { + case PCI_CFG_ADDR_REG: + data = m_pci_regs[offset]; break; + case PCI_CFG_DATA_REG: + { + switch (m_pci_regs[PCI_CFG_ADDR_REG]) { + case 0: data = (0x4170<<16) /*Device ID*/ | 0x14f1 /* Vendor ID */; break; + case 8: data = (0x060000 << 8) /* Class Code */ | 0x1f /* Revision ID */; break; + } + } break; + } + verboselog( machine(), 9, "(PCI) %08X -> %08X\n", 0xE0010040 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_pci_w ) +{ + verboselog( machine(), 9, "(PCI) %08X <- %08X\n", 0xE0010040 + (offset << 2), data); + COMBINE_DATA(&m_pci_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_extdesc_r ) +{ + UINT32 data = m_extdesc_regs[offset]; + verboselog( machine(), 9, "(EXTDESC) %08X -> %08X\n", 0xE0010080 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_extdesc_w ) +{ + verboselog( machine(), 9, "(EXTDESC) %08X <- %08X\n", 0xE0010080 + (offset << 2), data); + COMBINE_DATA(&m_extdesc_regs[offset]); +} + +TIMER_CALLBACK_MEMBER(cxhumax_state::timer_tick) +{ + m_timer_regs.timer[param].value++; + if(m_timer_regs.timer[param].value==m_timer_regs.timer[param].limit) { + /* Reset counter when reaching limit and RESET_CNTR bit is cleared */ + if(!(m_timer_regs.timer[param].mode & 2)) + m_timer_regs.timer[param].value=0; + + /* Indicate interrupt request if EN_INT bit is set */ + if (m_timer_regs.timer[param].mode & 8) { + //printf( "IRQ on Timer %d\n", param ); + verboselog( machine(), 9, "(TIMER%d) Interrupt\n", param); + m_intctrl_regs[INTREG(INTGROUP2, INTIRQ)] |= INT_TIMER_BIT; /* Timer interrupt */ + m_intctrl_regs[INTREG(INTGROUP2, INTSTATCLR)] |= INT_TIMER_BIT; /* Timer interrupt */ + m_intctrl_regs[INTREG(INTGROUP2, INTSTATSET)] |= INT_TIMER_BIT; /* Timer interrupt */ + + m_timer_regs.timer_irq |= 1<set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + } + } + attotime period = attotime::from_hz(XTAL_54MHz)*m_timer_regs.timer[param].timebase; + m_timer_regs.timer[param].timer->adjust(period,param); +} + +READ32_MEMBER( cxhumax_state::cx_timers_r ) +{ + UINT32 data = 0; + UINT8 index = offset>>2; + if(index==16) { + data = m_timer_regs.timer_irq; + //m_timer_regs.timer_irq=0; + verboselog( machine(), 9, "(TIMERIRQ) %08X -> %08X\n", 0xE0430000 + (offset << 2), data); + } + else { + switch (offset&3) { + case TIMER_VALUE: + data = m_timer_regs.timer[index].value; break; + case TIMER_LIMIT: + data = m_timer_regs.timer[index].limit; break; + case TIMER_MODE: + data = m_timer_regs.timer[index].mode; break; + case TIMER_TIMEBASE: + data = m_timer_regs.timer[index].timebase; break; + } + verboselog( machine(), 9, "(TIMER%d) %08X -> %08X\n", offset>>2, 0xE0430000 + (offset << 2), data); + } + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_timers_w ) +{ + UINT8 index = offset>>2; + if(index==16) { + verboselog( machine(), 9, "(TIMERIRQ) %08X <- %08X\n", 0xE0430000 + (offset << 2), data); + COMBINE_DATA(&m_timer_regs.timer_irq); + } + else { + verboselog( machine(), 9, "(TIMER%d) %08X <- %08X\n", index, 0xE0430000 + (offset << 2), data); + switch(offset&3) { + case TIMER_VALUE: + COMBINE_DATA(&m_timer_regs.timer[index].value); break; + case TIMER_LIMIT: + COMBINE_DATA(&m_timer_regs.timer[index].limit); break; + case TIMER_MODE: + COMBINE_DATA(&m_timer_regs.timer[index].mode); + if(data&1) { + attotime period = attotime::from_hz(XTAL_54MHz)*m_timer_regs.timer[index].timebase; + m_timer_regs.timer[index].timer->adjust(period,index); + } else { + m_timer_regs.timer[index].timer->adjust(attotime::never,index); + } break; + case TIMER_TIMEBASE: + COMBINE_DATA(&m_timer_regs.timer[index].timebase); break; + } + /* A timer will hold an interrupt active until any one of that timer?s registers is written. */ + if(m_timer_regs.timer_irq & (1< %08X\n", 0xE0411000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_uart2_w ) +{ + verboselog( machine(), 9, "(UART2) %08X <- %08X\n", 0xE0411000 + (offset << 2), data); + switch (offset) { + case UART_FIFO_REG: + if(!(m_uart2_regs[UART_FRMC_REG]&UART_FRMC_BDS_BIT)) { + /* Sending byte... add logging */ + m_terminal->write(space, 0, data); + + /* Transmitter Idle Interrupt Enable */ + if(m_uart2_regs[UART_IRQE_REG]&UART_IRQE_TIDE_BIT) { + /* Signal pending INT */ + m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] |= INT_UART2_BIT; + m_intctrl_regs[INTREG(INTGROUP1, INTSTATCLR)] |= INT_UART2_BIT; + m_intctrl_regs[INTREG(INTGROUP1, INTSTATSET)] |= INT_UART2_BIT; + + /* If INT is enabled at INT Ctrl raise it */ + if(m_intctrl_regs[INTREG(INTGROUP1, INTENABLE)]&INT_UART2_BIT) { + m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + } + } + } + default: + COMBINE_DATA(&m_uart2_regs[offset]); break; + } +} + +READ32_MEMBER( cxhumax_state::cx_pll_r ) +{ + UINT32 data = m_pll_regs[offset]; + verboselog( machine(), 9, "(PLL) %08X -> %08X\n", 0xE0440000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_pll_w ) +{ + verboselog( machine(), 9, "(PLL) %08X <- %08X\n", 0xE0440000 + (offset << 2), data); + COMBINE_DATA(&m_pll_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_pllprescale_r ) +{ + UINT32 data = m_pllprescale_reg; + verboselog( machine(), 9, "(PLLPRESCALE) %08X -> %08X\n", 0xE0440094 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_pllprescale_w ) +{ + verboselog( machine(), 9, "(PLLPRESCALE) %08X <- %08X\n", 0xE0440094 + (offset << 2), data); + COMBINE_DATA(&m_pllprescale_reg); +} + +READ32_MEMBER( cxhumax_state::cx_clkdiv_r ) +{ + UINT32 data = m_clkdiv_regs[offset]; + verboselog( machine(), 9, "(CLKDIV) %08X -> %08X\n", 0xE0440020 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_clkdiv_w ) +{ + verboselog( machine(), 9, "(CLKDIV) %08X <- %08X\n", 0xE0440020 + (offset << 2), data); + COMBINE_DATA(&m_clkdiv_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_chipcontrol_r ) +{ + UINT32 data = m_chipcontrol_regs[offset]; + verboselog( machine(), 9, "(CHIPCONTROL) %08X -> %08X\n", 0xE0440100 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_chipcontrol_w ) +{ + verboselog( machine(), 9, "(CHIPCONTROL) %08X <- %08X\n", 0xE0440100 + (offset << 2), data); + COMBINE_DATA(&m_chipcontrol_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_intctrl_r ) +{ + UINT32 data = m_intctrl_regs[offset]; + verboselog( machine(), 9, "(INTCTRL) %08X -> %08X\n", 0xE0450000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_intctrl_w ) +{ + verboselog( machine(), 9, "(INTCTRL) %08X <- %08X\n", 0xE0450000 + (offset << 2), data); + switch (offset >> 3) { // Decode the group + case 0: // Group 1 + switch(offset & 7) { + case INTSTATCLR: // ITC_INTSTATCLR_REG Group 1 + /* + Bits 15 (PWM), 14 (PIO103) of Group 1 are the logical OR of their lower level interrupt + status bits down within the interrupting module and are not registered. + + The source registers must be cleared to clear these interrupt bits. + */ + data &= ~(INT_PWM_BIT|INT_PIO103_BIT); + + m_intctrl_regs[INTREG(INTGROUP1, INTSTATCLR)] &= ~data; + m_intctrl_regs[INTREG(INTGROUP1, INTSTATSET)] &= ~data; + m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] &= ~data; + break; + default: + COMBINE_DATA(&m_intctrl_regs[offset]); + break; + } + break; + case 1: // Group 2 + switch(offset & 7) { + case INTSTATCLR: // ITC_INTSTATCLR_REG Group 2 + /* + The timer interrupt service routine must write to one of the timer + registers before clearing the corresponding Interrupt Controller ISR timer + interrupt bit. + + Bit 7 (Timers) of Group 2 is the logical OR of its lower level interrupt + status bits down within the interrupting module and are not registered. + + The source registers must be cleared to clear these interrupt bits. + */ + if(m_timer_regs.timer_irq) data &= ~INT_TIMER_BIT; + + m_intctrl_regs[INTREG(INTGROUP2, INTSTATCLR)] &= ~data; + m_intctrl_regs[INTREG(INTGROUP2, INTSTATSET)] &= ~data; + m_intctrl_regs[INTREG(INTGROUP2, INTIRQ)] &= ~data; + break; + default: + COMBINE_DATA(&m_intctrl_regs[offset]); + break; + } + break; + default: + break; + } + + if(m_i2c1_regs[I2C_STAT_REG]&I2C_INT_BIT) + { + m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] |= 1<<7; + m_intctrl_regs[INTREG(INTGROUP1, INTSTATCLR)] |= 1<<7; + m_intctrl_regs[INTREG(INTGROUP1, INTSTATSET)] |= 1<<7; + } + + /* check if */ + if((m_intctrl_regs[INTREG(INTGROUP2, INTIRQ)] & m_intctrl_regs[INTREG(INTGROUP2, INTENABLE)]) + || (m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] & m_intctrl_regs[INTREG(INTGROUP1, INTENABLE)])) + m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + else + m_maincpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); + +} + +READ32_MEMBER( cxhumax_state::cx_ss_r ) +{ + UINT32 data = 0; + switch(offset) { + case SS_FIFC_REG: + data = m_ss_regs[offset] & 0xFFF0; + break; + default: + data = m_ss_regs[offset]; + break; + } + verboselog( machine(), 9, "(SS) %08X -> %08X\n", 0xE0490000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_ss_w ) +{ + verboselog( machine(), 9, "(SS) %08X <- %08X\n", 0xE0490000 + (offset << 2), data); + switch(offset) { + case SS_CNTL_REG: + if (data&1) { + // "Send" pending data + UINT8 tfd = (m_ss_regs[SS_STAT_REG]>>4) & 0xF; + if ((tfd>1) && (m_ss_tx_fifo[0] == 0) && (m_ss_tx_fifo[1] != 0xFF)) { + // ASCII + printf("%s\n", &m_ss_tx_fifo[1]); + } else { + // UNKNOWN + for (int i=0; i>4) & 0xF; + if (tfd<8) { + m_ss_tx_fifo[tfd++] = data; + m_ss_regs[SS_STAT_REG] = (m_ss_regs[SS_STAT_REG] & 0xFF0F) | (tfd<<4); + } + } + break; + case SS_STAT_REG: + // read-only + break; + default: + COMBINE_DATA(&m_ss_regs[offset]); + break; + }; +} + +READ32_MEMBER( cxhumax_state::cx_i2c0_r ) +{ + UINT32 data = m_i2c0_regs[offset]; + verboselog( machine(), 9, "(I2C0) %08X -> %08X\n", 0xE04E0000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_i2c0_w ) +{ + verboselog( machine(), 9, "(I2C0) %08X <- %08X\n", 0xE04E0000 + (offset << 2), data); + COMBINE_DATA(&m_i2c0_regs[offset]); +} + +UINT8 cxhumax_state::i2cmem_read_byte(int last) +{ + UINT8 data = 0; + int i; + m_i2cmem->write_sda(1); + for (i = 0; i < 8; i++) + { + m_i2cmem->write_scl(1); + data = (data << 1) + (m_i2cmem->read_sda() ? 1 : 0); + m_i2cmem->write_scl(0); + } + m_i2cmem->write_sda(last); + m_i2cmem->write_scl(1); + m_i2cmem->write_scl(0); + return data; +} + +void cxhumax_state::i2cmem_write_byte(UINT8 data) +{ + int i; + for (i = 0; i < 8; i++) + { + m_i2cmem->write_sda((data & 0x80) ? 1 : 0); + data = data << 1; + m_i2cmem->write_scl(1); + m_i2cmem->write_scl(0); + } + m_i2cmem->write_sda(1); // ack bit + m_i2cmem->write_scl(1); + m_i2cmem->write_scl(0); +} + +void cxhumax_state::i2cmem_start() +{ + m_i2cmem->write_sda(1); + m_i2cmem->write_scl(1); + m_i2cmem->write_sda(0); + m_i2cmem->write_scl(0); +} + +void cxhumax_state::i2cmem_stop() +{ + m_i2cmem->write_sda(0); + m_i2cmem->write_scl(1); + m_i2cmem->write_sda(1); + m_i2cmem->write_scl(0); +} + +READ32_MEMBER( cxhumax_state::cx_i2c1_r ) +{ + UINT32 data=0; + switch(offset) { + case I2C_STAT_REG: + data |= m_i2cmem->read_sda()<<3; + // fall + default: + data |= m_i2c1_regs[offset]; break; + } + verboselog( machine(), 9, "(I2C1) %08X -> %08X\n", 0xE04E1000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_i2c1_w ) +{ + verboselog( machine(), 9, "(I2C1) %08X <- %08X\n", 0xE04E1000 + (offset << 2), data); + switch(offset) { + case I2C_CTRL_REG: + if(data&0x10) {// START + i2cmem_start(); + } + if((data&0x4) || ((data&3)==3)) // I2C READ + { + m_i2c1_regs[I2C_RDATA_REG] = 0; + if(data&0x10) i2cmem_write_byte((data>>24)&0xFF); + if(m_i2c1_regs[I2C_MODE_REG]&(1<<5)) // BYTE_ORDER + { + for(int i=0; i<(data&3); i++) { + m_i2c1_regs[I2C_RDATA_REG] |= i2cmem_read_byte(0) << (i*8); + } + m_i2c1_regs[I2C_RDATA_REG] |= i2cmem_read_byte((data&0x20)?1:0) << ((data&3)*8); + } + else + { + for(int i=0; i<(data&3); i++) { + m_i2c1_regs[I2C_RDATA_REG] |= i2cmem_read_byte(0); + m_i2c1_regs[I2C_RDATA_REG] <<= 8; + } + m_i2c1_regs[I2C_RDATA_REG] |= i2cmem_read_byte((data&0x20)?1:0); + } + } + else + { + for(int i=0; i<=(data&3); i++) { + i2cmem_write_byte((data>>(24-(i*8))&0xFF)); + } + } + if(data&0x20) {// STOP + i2cmem_stop(); + } + + /* The interrupt status bit is set at the end of an I2C read or write operation. */ + m_i2c1_regs[I2C_STAT_REG] |= I2C_INT_BIT; + m_i2c1_regs[I2C_STAT_REG] |= I2C_WACK_BIT; + + m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] |= 1<<7; + m_intctrl_regs[INTREG(INTGROUP1, INTSTATCLR)] |= 1<<7; + m_intctrl_regs[INTREG(INTGROUP1, INTSTATSET)] |= 1<<7; + if (m_intctrl_regs[INTREG(INTGROUP1, INTENABLE)] & (1<<7)) { + verboselog( machine(), 9, "(I2C1) Int\n" ); + m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + } + break; + case I2C_STAT_REG: + /* The interrupt status bit may be cleared by writing (anything) to the status register, which also clears the acknowledge status. */ + data&=~(I2C_WACK_BIT|I2C_INT_BIT); + // fall + default: + COMBINE_DATA(&m_i2c1_regs[offset]); + } +} + +READ32_MEMBER( cxhumax_state::cx_i2c2_r ) +{ + UINT32 data = m_i2c2_regs[offset]; + verboselog( machine(), 9, "(I2C2) %08X -> %08X\n", 0xE04E2000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_i2c2_w ) +{ + verboselog( machine(), 9, "(I2C2) %08X <- %08X\n", 0xE04E2000 + (offset << 2), data); + COMBINE_DATA(&m_i2c2_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_mc_cfg_r ) +{ + UINT32 data = m_mccfg_regs[offset]; + verboselog( machine(), 9, "(MC_CFG) %08X -> %08X\n", 0xE0500300 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_mc_cfg_w ) +{ + verboselog( machine(), 9, "(MC_CFG) %08X <- %08X\n", 0xE0500300 + (offset << 2), data); + COMBINE_DATA(&m_mccfg_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_drm0_r ) +{ + UINT32 data = m_drm0_regs[offset]; + verboselog( machine(), 9, "(DRM0) %08X -> %08X\n", 0xE0560000 + (offset << 2), data); + switch(offset) { + case 0x14/4: // DRM_STATUS_REG + data |= 1<<21; + data |= 1<<20; + } + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_drm0_w ) +{ + verboselog( machine(), 9, "(DRM0) %08X <- %08X\n", 0xE0560000 + (offset << 2), data); + COMBINE_DATA(&m_drm0_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_drm1_r ) +{ + UINT32 data = m_drm1_regs[offset]; + verboselog( machine(), 9, "(DRM1) %08X -> %08X\n", 0xE0570000 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_drm1_w ) +{ + verboselog( machine(), 9, "(DRM1) %08X <- %08X\n", 0xE0570000 + (offset << 2), data); + COMBINE_DATA(&m_drm1_regs[offset]); +} + +READ32_MEMBER( cxhumax_state::cx_hdmi_r ) +{ + UINT32 data = m_hdmi_regs[offset]; + verboselog( machine(), 9, "(HDMI) %08X -> %08X\n", 0xE05D0800 + (offset << 2), data); + return data; +} + +WRITE32_MEMBER( cxhumax_state::cx_hdmi_w ) +{ + verboselog( machine(), 9, "(HDMI) %08X <- %08X\n", 0xE05D0800 + (offset << 2), data); + switch(offset) { + case 0x40/4: // HDMI_CONFIG_REG + if(data&8) m_hdmi_regs[0xc0/4] |= 0x80; + } + COMBINE_DATA(&m_hdmi_regs[offset]); +} + +void cxhumax_state::video_start() +{ +} + +/* copy from emu/rendersw.inc */ +/*------------------------------------------------------------------------ + ycc_to_rgb - convert YCC to RGB; the YCC pixel + contains Y in the LSB, Cb << 8, and Cr << 16 + This actually a YCbCr conversion, + details my be found in chapter 6.4 ff of + http://softwarecommunity.intel.com/isn/downloads/softwareproducts/pdfs/346495.pdf + The document also contains the constants below as floats. +--------------------------------------------------------------------------*/ + +INLINE UINT8 clamp16_shift8(UINT32 x) +{ + return (((INT32) x < 0) ? 0 : (x > 65535 ? 255: x >> 8)); +} + +INLINE UINT32 ycc_to_rgb(UINT32 ycc) +{ + /* original equations: + + C = Y - 16 + D = Cb - 128 + E = Cr - 128 + + R = clip(( 298 * C + 409 * E + 128) >> 8) + G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8) + B = clip(( 298 * C + 516 * D + 128) >> 8) + + R = clip(( 298 * (Y - 16) + 409 * (Cr - 128) + 128) >> 8) + G = clip(( 298 * (Y - 16) - 100 * (Cb - 128) - 208 * (Cr - 128) + 128) >> 8) + B = clip(( 298 * (Y - 16) + 516 * (Cb - 128) + 128) >> 8) + + R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8) + G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8) + B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8) + + R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8) + G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8) + B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8) + + Now combine constants: + + R = clip(( 298 * Y + 409 * Cr - 56992) >> 8) + G = clip(( 298 * Y - 100 * Cb - 208 * Cr + 34784) >> 8) + B = clip(( 298 * Y + 516 * Cb - 70688) >> 8) + + Define common = 298 * y - 56992. This will save one addition + + R = clip(( common + 409 * Cr - 0) >> 8) + G = clip(( common - 100 * Cb - 208 * Cr + 91776) >> 8) + B = clip(( common + 516 * Cb - 13696) >> 8) + + */ + UINT8 y = ycc; + UINT8 cb = ycc >> 8; + UINT8 cr = ycc >> 16; + UINT32 r, g, b, common; + + common = 298 * y - 56992; + r = (common + 409 * cr); + g = (common - 100 * cb - 208 * cr + 91776); + b = (common + 516 * cb - 13696); + + /* Now clamp and shift back */ + return rgb_t(clamp16_shift8(r), clamp16_shift8(g), clamp16_shift8(b)); +} + +UINT32 cxhumax_state::screen_update_cxhumax(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int i, j; + + + UINT32 osd_pointer = m_drm1_regs[DRM_OSD_PTR_REG]; + + if(osd_pointer) + { + UINT32 *ram = m_ram; + UINT32 *osd_header = &ram[osd_pointer/4]; + UINT8 *vbuf = (UINT8*)(&ram[osd_header[3]/4]); + UINT32 *palette = &ram[osd_header[7]/4]; + + UINT32 x_disp_start_and_width = osd_header[1]; + UINT32 xdisp_width = (x_disp_start_and_width >> 16) & 0x1fff; + UINT32 xdisp_start = x_disp_start_and_width & 0xfff; + + UINT32 image_height_and_width = osd_header[2]; + UINT32 yimg_height = (image_height_and_width >> 16) & 0x7ff; + UINT32 ximg_width = image_height_and_width & 0x7ff; + + UINT32 y_position_and_region_alpha = osd_header[5]; + UINT32 ydisp_last = (y_position_and_region_alpha >> 12) & 0x7ff; + UINT32 ydisp_start = y_position_and_region_alpha & 0x7ff; + + /* UINT32 first_x = m_drm0_regs[DRM_ACTIVE_X_REG] & 0xffff; + UINT32 last_x = (m_drm0_regs[DRM_ACTIVE_X_REG] >> 16) & 0xffff; + + UINT32 first_y = m_drm0_regs[DRM_ACTIVE_Y_REG] & 0xfff; + UINT32 last_y = (m_drm0_regs[DRM_ACTIVE_Y_REG] >> 16) & 0xfff;*/ + + for (j=ydisp_start; j <= ydisp_last; j++) + { + UINT32 *bmp = &bitmap.pix32(j); + + for (i=xdisp_start; i <= (xdisp_start + xdisp_width); i++) + { + if ((i <= (xdisp_start + ximg_width)) && (j <= (ydisp_start + yimg_height))) { + bmp[i] = palette[vbuf[i+((j-ydisp_start)*ximg_width)]]; + } else { + bmp[i] = ycc_to_rgb(m_drm1_regs[DRM_BCKGND_REG]); + } + } + } + } + return 0; +} + +static ADDRESS_MAP_START(cxhumax_map, AS_PROGRAM, 32, cxhumax_state) + AM_RANGE(0x00000000, 0x03ffffff) AM_RAM AM_SHARE("ram") AM_MIRROR(0x40000000) // 64?MB RAM + AM_RANGE(0xe0000000, 0xe000ffff) AM_READWRITE(cx_hsx_r, cx_hsx_w) // HSX + AM_RANGE(0xe0010000, 0xe0010003) AM_READWRITE(cx_romdescr_r, cx_romdescr_w) // ROM Descriptor + AM_RANGE(0xe0010004, 0xe001000f) AM_READWRITE(cx_isaromdescr_r, cx_isaromdescr_w) // ISA/ROM Descriptors + AM_RANGE(0xe0010010, 0xe001001f) AM_READWRITE(cx_isadescr_r, cx_isadescr_w) // ISA Descriptors + AM_RANGE(0xe0010020, 0xe001002f) AM_READWRITE(cx_rommap_r, cx_rommap_w) // ROM Mapping + AM_RANGE(0xe0010030, 0xe0010033) AM_READWRITE(cx_rommode_r, cx_rommode_w) // ISA Mode + AM_RANGE(0xe0010034, 0xe0010037) AM_READWRITE(cx_xoemask_r, cx_xoemask_w) // XOE Mask + AM_RANGE(0xe0010040, 0xe0010047) AM_READWRITE(cx_pci_r, cx_pci_w) // PCI + AM_RANGE(0xe0010080, 0xe00100ff) AM_READWRITE(cx_extdesc_r, cx_extdesc_w) // Extended Control + AM_RANGE(0xe0400014, 0xe0400017) AM_WRITE(cx_remap_w) // RST_REMAP_REG + AM_RANGE(0xe0400024, 0xe0400027) AM_READWRITE(cx_scratch_r, cx_scratch_w) // RST_SCRATCH_REG - System Scratch Register + AM_RANGE(0xe0430000, 0xe0430103) AM_READWRITE(cx_timers_r, cx_timers_w) // Timers + AM_RANGE(0xe0411000, 0xe0411033) AM_READWRITE(cx_uart2_r, cx_uart2_w) // UART2 + AM_RANGE(0xe0440000, 0xe0440013) AM_READWRITE(cx_pll_r, cx_pll_w) // PLL Registers + AM_RANGE(0xe0440020, 0xe0440037) AM_READWRITE(cx_clkdiv_r, cx_clkdiv_w) // Clock Divider Registers + AM_RANGE(0xe0440094, 0xe0440097) AM_READWRITE(cx_pllprescale_r, cx_pllprescale_w) // PLL Prescale + AM_RANGE(0xe0440100, 0xe0440173) AM_READWRITE(cx_chipcontrol_r, cx_chipcontrol_w) // Chip Control Registers + AM_RANGE(0xe0450000, 0xe0450037) AM_READWRITE(cx_intctrl_r, cx_intctrl_w) // Interrupt Controller Registers + AM_RANGE(0xe0490000, 0xe0490017) AM_READWRITE(cx_ss_r, cx_ss_w) // Synchronous Serial Port + AM_RANGE(0xe04e0000, 0xe04e001f) AM_READWRITE(cx_i2c0_r, cx_i2c0_w) // I2C0 + AM_RANGE(0xe04e1000, 0xe04e101f) AM_READWRITE(cx_i2c1_r, cx_i2c1_w) // I2C1 + AM_RANGE(0xe04e2000, 0xe04e201f) AM_READWRITE(cx_i2c2_r, cx_i2c2_w) // I2C2 + AM_RANGE(0xe0500300, 0xe050030b) AM_READWRITE(cx_mc_cfg_r, cx_mc_cfg_w) // Memory Controller configuration + AM_RANGE(0xe0560000, 0xe05600fb) AM_READWRITE(cx_drm0_r, cx_drm0_w) // DRM0 + AM_RANGE(0xe0570000, 0xe05700fb) AM_READWRITE(cx_drm1_r, cx_drm1_w) // DRM1 + AM_RANGE(0xe05d0800, 0xe05d0bff) AM_READWRITE(cx_hdmi_r, cx_hdmi_w) // HDMI + AM_RANGE(0xe0600000, 0xe063ffff) AM_READWRITE(cx_gxa_r, cx_gxa_w) // GXA + AM_RANGE(0xe4017000, 0xe40173ff) AM_RAM // HSX - BSP - 1K Video Shared Dual Port RAM (shared with MVP) + AM_RANGE(0xe4080000, 0xe4083fff) AM_RAM // HSX - TSP 0 - 16K Private Instructions/Data and Host-Shared Data + AM_RANGE(0xf0000000, 0xf03fffff) AM_READWRITE(flash_r, flash_w) AM_MIRROR(0xf8000000) // 4MB FLASH (INTEL 28F320J3D) + AM_RANGE(0xf4000000, 0xf43fffff) AM_READ(dummy_flash_r) // do we need it? +ADDRESS_MAP_END + +static INPUT_PORTS_START( cxhumax ) +INPUT_PORTS_END + +void cxhumax_state::machine_start() +{ + int index = 0; + for(index = 0; index < MAX_CX_TIMERS; index++) + { + m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cxhumax_state::timer_tick),this)); + m_timer_regs.timer[index].timer->adjust(attotime::never, index); + } +} + +void cxhumax_state::machine_reset() +{ + m_i2c0_regs[0x08/4] = 0x08; // SDA high + m_i2c2_regs[0x08/4] = 0x08; // SDA high + + UINT8* FLASH = memregion("flash")->base(); + memcpy(m_ram,FLASH,0x400000); + + m_chipcontrol_regs[PIN_CONFIG_0_REG] = + 1 << 0 | /* Short Reset: 0=200ms delay ; 1=1ms delay */ + 1 << 1 | /* Software config bit. OK */ + 1 << 4 | /* SDRAM memory controller data width. 0=16bit 1=32bit */ + 1 << 11 | /* I/O Addr bus width 11=23 bit 10=22bit 01=21bit 00=20bit / PCImode: 0=held in reset 1=normal reset OK? */ + 0 << 16 | /* 0=PCI mode 1=Standard I/O mode */ + 1 << 23 | /* 0=PCI device 1=PCI host bridge OK */ + 1 << 26 | /* 0=SC1 used for NDS 1=SC1 not used for NDS */ + 1 << 27 | /* 0=8bit ROM 1=16bit ROM */ + 1 << 28 | /* 0=SC0 used for NDS 1=SC0 not used for NDS */ + 0 << 29 | /* 0=using SC2 1=not using SC2 */ + 0 << 30 | /* 0=using SC1 (TDA8004) 1=not using SC1 */ + 1 << 31; /* 0=Ext clk for boot 1=Int PLL for boot OK */ + m_chipcontrol_regs[SREG_MODE_REG] = 0x0000020F; + + memset(m_isaromdescr_regs,0,sizeof(m_isaromdescr_regs)); + memset(m_isadescr_regs,0,sizeof(m_isadescr_regs)); + m_rommode_reg=0; + m_xoemask_reg=0; + memset(m_extdesc_regs,0,sizeof(m_extdesc_regs)); + + m_pll_regs[SREG_MPG_0_INTFRAC_REG] = (0x1A << 25) /* integer */ | 0x5D1764 /* fraction */; + m_pll_regs[SREG_MPG_1_INTFRAC_REG] = (0x1A << 25) /* integer */ | 0x5D1764 /* fraction */; + m_pll_regs[SREG_ARM_INTFRAC_REG] = (0x28 << 25) /* integer */ | 0xCEDE62 /* fraction */; + m_pll_regs[SREG_MEM_INTFRAC_REG] = (0x13 << 25) /* integer */ | 0xC9B26D /* fraction */; + m_pll_regs[SREG_USB_INTFRAC_REG] = (0x08 << 25) /* integer */ | 0x52BF5B /* fraction */; + + m_clkdiv_regs[SREG_DIV_0_REG] = (2<<0)|(1<<6)|(2<<8)|(2<<14)|(10<<16)|(1<<22)|(10<<24)|(1<<30); + m_clkdiv_regs[SREG_DIV_1_REG] = (5<<0)|(0<<6)|(12<<8)|(0<<14)|(4<<16)|(1<<22)|(5<<24)|(1<<30); + m_clkdiv_regs[SREG_DIV_2_REG] = (22<<0)|(0<<6)|(12<<8)|(1<<14)|(4<<16)|(3<<22); //|(5<<24)|(1<<30);??? + m_clkdiv_regs[SREG_DIV_3_REG] = (5<<0)|(0<<6)|(5<<8)|(0<<14)|(5<<16)|(0<<22)|(5<<24)|(0<<30); + m_clkdiv_regs[SREG_DIV_4_REG] = (8<<0)|(0<<6)|(5<<8)|(0<<14)|(5<<16)|(0<<22)|(5<<24)|(0<<30); + m_clkdiv_regs[SREG_DIV_5_REG] = (8<<0)|(0<<6)|(5<<8)|(0<<14)|(5<<16)|(0<<22); + + m_pllprescale_reg=0xFFF; + + m_mccfg_regs[MC_CFG0] = ((m_chipcontrol_regs[PIN_CONFIG_0_REG]>>4)&1)<<16; + m_mccfg_regs[MC_CFG1] = 0; + m_mccfg_regs[MC_CFG2] = (7<<8)|(7<<0); + + // UART2 + m_uart2_regs[UART_FIFC_REG] = 0x30; + + // Clear SS TX FIFO + memset(m_ss_tx_fifo,0,sizeof(m_ss_tx_fifo)); + m_ss_regs[SS_BAUD_REG] = 1; // Default SS clock = 13,5MHz + + memset(m_intctrl_regs,0,sizeof(m_intctrl_regs)); + + memset(m_hdmi_regs,0,sizeof(m_hdmi_regs)); + + memset(m_gxa_cmd_regs,0,sizeof(m_gxa_cmd_regs)); +} + +static MACHINE_CONFIG_START( cxhumax, cxhumax_state ) + MCFG_CPU_ADD("maincpu", ARM920T, 180000000) // CX24175 (RevC up?) + MCFG_CPU_PROGRAM_MAP(cxhumax_map) + + + MCFG_INTEL_28F320J3D_ADD("flash") + MCFG_I2CMEM_ADD("eeprom") + MCFG_I2CMEM_DATA_SIZE(0x2000) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1920, 1080) + MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 1080-1) + MCFG_SCREEN_UPDATE_DRIVER(cxhumax_state, screen_update_cxhumax) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) +MACHINE_CONFIG_END + +ROM_START( hxhdci2k ) + ROM_REGION( 0x400000, "flash", 0 ) + ROM_SYSTEM_BIOS( 0, "FW10005", "HDCI REV 1.0 RHDXSCI 1.00.05" ) /* 19 AUG 2008 */ + ROM_LOAD16_WORD_SWAP( "28f320j3d.bin", 0x000000, 0x400000, BAD_DUMP CRC(63d98942) SHA1(c5b8d701677a3edc25f203854f44953b19c9158d) ) + + ROM_REGION16_BE( 0x2000, "eeprom", 0 ) + ROM_LOAD( "24lc64.bin", 0x0000, 0x2000, NO_DUMP) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +SYST( 2008, hxhdci2k, 0, 0, cxhumax, cxhumax, driver_device, 0, "HUMAX", "HUMAX HDCI-2000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/cybiko.c b/src/mame/drivers/cybiko.c new file mode 100644 index 00000000000..a3a4bd2864e --- /dev/null +++ b/src/mame/drivers/cybiko.c @@ -0,0 +1,461 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/************************************************************************************* + + Cybiko Wireless Inter-tainment System + + (c) 2001-2007 Tim Schuerewegen + + Cybiko Classic (V1) + Cybiko Classic (V2) + Cybiko Xtreme + +ToDo: +- Remove the memory leak in the nvram handler. +- Provide facility to load games via a "cart". +- Need instructions! The black screen doesn't fill me with confidence..unable to test. + +**************************************************************************************/ + + +#include "includes/cybiko.h" +#include "rendlay.h" + +// +------------------------------------------------------+ +// | Cybiko Classic (CY6411) | V2 | +// +------------------------------------------------------+ +// | - CYBIKO | CY-OS 1.1.7 | 6432241M04FA | 0028R JAPAN | +// | - SST 39VF020 | 90-4C-WH | 0012175-D | +// | - ATMEL 0027 | AT90S2313-4SC | +// | - ATMEL | AT45DB041A | TC | 0027 | +// | - RF2915 | RFMD0028 | 0F540BT | +// | - EliteMT | LP62S2048X-70LLT | 0026B H4A27HA | +// | - MP02AB | LMX2315 | TMD | +// +------------------------------------------------------+ + +// +------------------------------------------------------+ +// | Cybiko Xtreme (CY44802) | +// +------------------------------------------------------+ +// | - CYBIKO | CYBOOT 1.5A | HD6432323G03F | 0131 JAPAN | +// | - SST 39VF400A | 70-4C-EK | +// | - ATMEL 0033 | AT90S2313-4SC | +// | - SAMSUNG 129 | K4F171612D-TL60 | +// | - 2E16AB | USBN9604-28M | NSC00A1 | +// +------------------------------------------------------+ + +// +------------------------------------------------------+ +// | Cybiko MP3 Player (CY65P10) | +// +------------------------------------------------------+ +// | - H8S/2246 | 0G1 | HD6472246FA20 | JAPAN | +// | - MICRONAS | DAC3550A C2 | 0394 22 HM U | 089472.000 | +// | - 2E08AJ | USBN9603-28M | NSC99A1 | +// +------------------------------------------------------+ + +/////////////////////////// +// ADDRESS MAP - PROGRAM // +/////////////////////////// + +// 512 kbyte ram + no memory mapped flash +static ADDRESS_MAP_START( cybikov1_mem, AS_PROGRAM, 16, cybiko_state ) + AM_RANGE( 0x000000, 0x007fff ) AM_ROM + AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( cybiko_lcd_r, cybiko_lcd_w ) + AM_RANGE( 0xe00000, 0xe07fff ) AM_READ( cybikov1_key_r ) +ADDRESS_MAP_END + +// +-------------------------------------+ +// | Cybiko Classic (V2) - Memory Map | +// +-------------------------------------+ +// | 000000 - 007FFF | rom | +// | 008000 - 00FFFF | 17 51 17 51 .. | +// | 010000 - 0FFFFF | flash mirror | +// | 100000 - 13FFFF | flash | +// | 140000 - 1FFFFF | flash mirror | +// | 200000 - 23FFFF | ram | +// | 240000 - 3FFFFF | ram mirror | +// | 400000 - 5FFFFF | FF FF FF FF .. | +// | 600000 - 600001 | lcd | +// | 600002 - DFFFFF | FF FF FF FF .. | +// | E00000 - FFDBFF | keyboard | +// | FFDC00 - FFFFFF | onchip ram & regs | +// +-------------------------------------+ + +// 256 kbyte ram + 256 kbyte memory mapped flash +static ADDRESS_MAP_START( cybikov2_mem, AS_PROGRAM, 16, cybiko_state ) + AM_RANGE( 0x000000, 0x007fff ) AM_ROM + AM_RANGE( 0x100000, 0x13ffff ) AM_DEVREAD8("flash2", sst_39vf020_device, read, 0xffff) AM_MIRROR( 0x0c0000 ) + AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( cybiko_lcd_r, cybiko_lcd_w ) AM_MIRROR( 0x1ffffe ) + AM_RANGE( 0xe00000, 0xffdbff ) AM_READ( cybikov2_key_r ) +ADDRESS_MAP_END + +// 2048 kbyte ram + 512 kbyte memory mapped flash +static ADDRESS_MAP_START( cybikoxt_mem, AS_PROGRAM, 16, cybiko_state ) + AM_RANGE( 0x000000, 0x007fff ) AM_ROM AM_MIRROR( 0x038000 ) + AM_RANGE( 0x100000, 0x100001 ) AM_READWRITE( cybiko_lcd_r, cybiko_lcd_w ) + AM_RANGE( 0x200000, 0x200003 ) AM_WRITE( cybiko_usb_w ) + AM_RANGE( 0x600000, 0x67ffff ) AM_DEVREAD("flashxt", sst_39vf400a_device, read) AM_MIRROR( 0x180000 ) + AM_RANGE( 0xe00000, 0xefffff ) AM_READ( cybikoxt_key_r ) +ADDRESS_MAP_END + +WRITE16_MEMBER(cybiko_state::serflash_w) +{ + m_flash1->cs_w ((data & 0x10) ? 0 : 1); +} + +READ16_MEMBER(cybiko_state::clock_r) +{ + if (m_rtc->sda_r()) + { + return (0x01|0x04); + } + + return 0x04; +} + +WRITE16_MEMBER(cybiko_state::clock_w) +{ + m_rtc->scl_w((data & 0x02) ? 1 : 0); + m_rtc->sda_w((data & 0x01) ? 0 : 1); +} + +READ16_MEMBER(cybiko_state::xtclock_r) +{ + if (m_rtc->sda_r()) + { + return 0x40; + } + + return 0; +} + +WRITE16_MEMBER(cybiko_state::xtclock_w) +{ + m_rtc->scl_w((data & 0x02) ? 1 : 0); + m_rtc->sda_w((data & 0x40) ? 0 : 1); +} + +READ16_MEMBER(cybiko_state::xtpower_r) +{ + // bit 7 = on/off button + // bit 6 = battery charged if "1" + return 0xc0c0; +} + +////////////////////// +// ADDRESS MAP - IO // +////////////////////// + +static ADDRESS_MAP_START( cybikov1_io, AS_IO, 16, cybiko_state ) + AM_RANGE(h8_device::PORT_3, h8_device::PORT_3) AM_WRITE(serflash_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cybikov2_io, AS_IO, 16, cybiko_state ) + AM_RANGE(h8_device::PORT_3, h8_device::PORT_3) AM_WRITE(serflash_w) + AM_RANGE(h8_device::PORT_F, h8_device::PORT_F) AM_READWRITE(clock_r, clock_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( cybikoxt_io, AS_IO, 16, cybiko_state ) + AM_RANGE(h8_device::PORT_A, h8_device::PORT_A) AM_READ(xtpower_r) + AM_RANGE(h8_device::PORT_F, h8_device::PORT_F) AM_READWRITE(xtclock_r, xtclock_w) +ADDRESS_MAP_END + +///////////////// +// INPUT PORTS // +///////////////// + + +static INPUT_PORTS_START( cybiko ) + PORT_START("A.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('`') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("A.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("As") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Fn") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("A.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + + PORT_START("A.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + + PORT_START("A.4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Select") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("A.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR( 13 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + + PORT_START("A.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BkSp") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + + PORT_START("A.7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + + PORT_START("A.8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + +INPUT_PORTS_END + +static INPUT_PORTS_START( cybikoxt ) + PORT_START("A.0") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + + PORT_START("A.1") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + + PORT_START("A.2") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + + PORT_START("A.3") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + + PORT_START("A.4") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR( 13 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Select") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("A.5") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("As") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("A.6") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("A.7") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Fn") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("A.8") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("A.13") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + + PORT_START("A.14") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("On/Off") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + +INPUT_PORTS_END + +//////////////////// +// MACHINE DRIVER // +//////////////////// + +static MACHINE_CONFIG_START( cybikov1, cybiko_state ) + // cpu + MCFG_CPU_ADD( "maincpu", H8S2241, XTAL_11_0592MHz ) + MCFG_CPU_PROGRAM_MAP( cybikov1_mem ) + MCFG_CPU_IO_MAP( cybikov1_io ) + + MCFG_DEVICE_MODIFY("maincpu:sci1") + MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE("^flash1", at45db041_device, si_w)) + MCFG_H8_SCI_CLK_CALLBACK(DEVWRITELINE("^flash1", at45db041_device, sck_w)) + + // screen + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE( 60 ) + MCFG_SCREEN_SIZE( HD66421_WIDTH, HD66421_HEIGHT ) + MCFG_SCREEN_VISIBLE_AREA( 0, HD66421_WIDTH - 1, 0, HD66421_HEIGHT - 1 ) + MCFG_SCREEN_UPDATE_DEVICE("hd66421", hd66421_device, update_screen) + MCFG_SCREEN_PALETTE("hd66421:palette") + // video + MCFG_HD66421_ADD("hd66421") + MCFG_DEFAULT_LAYOUT(layout_lcd) + // sound + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + // machine + /* rtc */ + MCFG_PCF8593_ADD("rtc") + MCFG_AT45DB041_ADD("flash1") + MCFG_AT45DBXXX_SO_CALLBACK(DEVWRITELINE("maincpu:sci1", h8_sci_device, rx_w)) + + MCFG_NVRAM_ADD_0FILL("nvram") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_EXTRA_OPTIONS("1M") + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", cybiko_state, cybiko, "bin,nv", 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( cybikov2, cybikov1) + // cpu + MCFG_CPU_REPLACE("maincpu", H8S2246, XTAL_11_0592MHz) + MCFG_CPU_PROGRAM_MAP(cybikov2_mem) + MCFG_CPU_IO_MAP(cybikov2_io) + + MCFG_DEVICE_MODIFY("maincpu:sci1") + MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE("^flash1", at45db041_device, si_w)) + MCFG_H8_SCI_CLK_CALLBACK(DEVWRITELINE("^flash1", at45db041_device, sck_w)) + + // machine + MCFG_SST_39VF020_ADD("flash2") + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + MCFG_RAM_EXTRA_OPTIONS("512K,1M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( cybikoxt, cybikov1) + // cpu + MCFG_CPU_REPLACE("maincpu", H8S2323, XTAL_18_432MHz) + MCFG_CPU_PROGRAM_MAP(cybikoxt_mem ) + MCFG_CPU_IO_MAP(cybikoxt_io ) + + // machine + MCFG_DEVICE_REMOVE("flash1") + MCFG_SST_39VF400A_ADD("flashxt") + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + + /* quickload */ + MCFG_DEVICE_REMOVE("quickload") + MCFG_QUICKLOAD_ADD("quickload", cybiko_state, cybikoxt, "bin,nv", 0) +MACHINE_CONFIG_END + +///////// +// ROM // +///////// + +ROM_START( cybikov1 ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "cyrom112.bin", 0, 0x8000, CRC(9e1f1a0f) SHA1(6fc08de6b2c67d884ec78f748e4a4bad27ee8045) ) + + ROM_REGION( 0x84000, "flash1", 0 ) + ROM_LOAD( "flash1.bin", 0, 0x84000, NO_DUMP ) +ROM_END + +ROM_START( cybikov2 ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "cyrom117.bin", 0, 0x8000, CRC(268da7bf) SHA1(135eaf9e3905e69582aabd9b06bc4de0a66780d5) ) + + ROM_SYSTEM_BIOS( 0, "v1358", "v1.3.58" ) + ROM_SYSTEM_BIOS( 1, "v1357", "v1.3.57" ) + ROM_SYSTEM_BIOS( 2, "v1355", "v1.3.55" ) + + ROM_REGION( 0x84000, "flash1", 0 ) + ROMX_LOAD( "flash_v1358.bin", 0, 0x84000, CRC(e485880f) SHA1(e414d6d2f876c7c811946bcdfcb6212999412381), ROM_BIOS(1) ) + ROMX_LOAD( "flash_v1357.bin", 0, 0x84000, CRC(9fd3c058) SHA1(dad0c3db0f11c91747db6ccc1900004432afb881), ROM_BIOS(2) ) + ROMX_LOAD( "flash_v1355.bin", 0, 0x84000, CRC(497a5bbe) SHA1(0af611424cbf287b26c668a3109fb0861a27f603), ROM_BIOS(3) ) + + ROM_REGION( 0x40000, "flash2", 0 ) + ROMX_LOAD( "cyos_v1358.bin", 0, 0x40000, CRC(05ca4ece) SHA1(eee329e8541e1e36c22acb1317378ce23ccd1e12), ROM_BIOS(1) ) + ROMX_LOAD( "cyos_v1357.bin", 0, 0x40000, CRC(54ba7d43) SHA1(c6e0f7982e0f7a5fa65f2cecc8b27cb21909a407), ROM_BIOS(2) ) + ROMX_LOAD( "cyos_v1355.bin", 0, 0x40000, CRC(02d3dba5) SHA1(4ed728940bbcb3d2464fc7fba14d17924ece94aa), ROM_BIOS(3) ) +ROM_END + +ROM_START( cybikoxt ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "cyrom150.bin", 0, 0x8000, CRC(18b9b21f) SHA1(28868d6174eb198a6cec6c3c70b6e494517229b9) ) + + ROM_SYSTEM_BIOS( 0, "v1508", "v1.5.08" ) + + ROM_REGION( 0x80000, "flashxt", 0 ) + ROMX_LOAD( "cyos_v1508.bin", 0, 0x80000, CRC(f79400ba) SHA1(537a88e238746b3944b0cdfd4b0a9396460b2977), ROM_BIOS(1) ) +ROM_END + +////////////// +// DRIVERS // +////////////// + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 2000, cybikov1, 0, 0, cybikov1, cybiko, cybiko_state, cybiko , "Cybiko Inc", "Cybiko Classic (V1)", MACHINE_IMPERFECT_SOUND ) +COMP( 2000, cybikov2, cybikov1, 0, cybikov2, cybiko, cybiko_state, cybiko , "Cybiko Inc", "Cybiko Classic (V2)", MACHINE_IMPERFECT_SOUND ) +COMP( 2001, cybikoxt, cybikov1, 0, cybikoxt, cybikoxt, cybiko_state, cybikoxt, "Cybiko Inc", "Cybiko Xtreme", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/czk80.c b/src/mame/drivers/czk80.c new file mode 100644 index 00000000000..913d07d693f --- /dev/null +++ b/src/mame/drivers/czk80.c @@ -0,0 +1,230 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +CZK-80 + +2010-08-30 Skeleton driver +2010-11-27 Connected to a terminal +2014-01-08 Added devices + +Only known info: http://forum.z80.de/showtopic.php?threadid=280 + +On main board there are Z80A CPU, Z80A PIO, Z80A DART and Z80A CTC + there is 8K ROM and XTAL 16MHz + Two undumped proms, AM27S20DC and D3631-1. +FDC board contains Z80A DMA and NEC 765A (XTAL on it is 8MHZ) +Mega board contains 74LS612 and memory chips (32x 41256) + +Status: + It prints 2 lines of text, then: + - If fdc is enabled in address map, it hangs waiting for a fdc response. + - Otherwise, it displays an error, and you can press a key to try again. + +ToDo: +- Everything... no diagram or manuals, so EVERYTHING below is guesswork. +- Need software + +I/O ports: These ranges are what is guessed + 40 : rom switching + 4c-4F : PIO + 50-53 : DART + 54-57 : CTC + 80-81 : Parallel port (no programming bytes are sent, so it isn't a device) + C0-C1 : FDC + It is not known what address is used by: + - the DMA + - the Motor-on signal(s) + as there are no unknown writes. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/upd765.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/z80ctc.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class czk80_state : public driver_device +{ +public: + czk80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_fdc(*this, "fdc") + { + } + + DECLARE_DRIVER_INIT(czk80); + DECLARE_MACHINE_RESET(czk80); + TIMER_CALLBACK_MEMBER(czk80_reset); + DECLARE_READ8_MEMBER(port80_r); + DECLARE_READ8_MEMBER(port81_r); + DECLARE_READ8_MEMBER(portc0_r); + DECLARE_WRITE8_MEMBER(port40_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); +private: + UINT8 m_term_data; + required_device m_maincpu; + required_device m_terminal; + required_device m_fdc; +}; + + +WRITE8_MEMBER( czk80_state::port40_w ) +{ + membank("bankr1")->set_entry(BIT(data, 1)); +} + +READ8_MEMBER( czk80_state::port80_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( czk80_state::portc0_r ) +{ + return 0x80; +} + +READ8_MEMBER( czk80_state::port81_r ) +{ + return (m_term_data) ? 3 : 1; +} + +static ADDRESS_MAP_START(czk80_mem, AS_PROGRAM, 8, czk80_state) + AM_RANGE(0x0000, 0x1fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x2000, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(czk80_io, AS_IO, 8, czk80_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x40) AM_WRITE(port40_w) + AM_RANGE(0x4c, 0x4f) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) + AM_RANGE(0x50, 0x53) AM_DEVREADWRITE("z80dart", z80dart_device, cd_ba_r, cd_ba_w) + AM_RANGE(0x54, 0x57) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + AM_RANGE(0x80, 0x80) AM_READ(port80_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x81, 0x81) AM_READ(port81_r) + /* Select one of the below */ + //AM_RANGE(0xc0, 0xc0) AM_READ(portc0_r) + AM_RANGE(0xc0, 0xc1) AM_DEVICE("fdc", upd765a_device, map) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( czk80 ) +INPUT_PORTS_END + +/* Z80 Daisy Chain */ + +static const z80_daisy_config daisy_chain[] = +{ + { "z80pio" }, + { "z80dart" }, + { "z80ctc" }, + { NULL } +}; + +/* Z80-CTC Interface */ + +WRITE_LINE_MEMBER( czk80_state::ctc_z0_w ) +{ +// guess this generates clock for z80dart +} + +WRITE_LINE_MEMBER( czk80_state::ctc_z1_w ) +{ +} + +WRITE_LINE_MEMBER( czk80_state::ctc_z2_w ) +{ +} + +/* after the first 4 bytes have been read from ROM, switch the ram back in */ +TIMER_CALLBACK_MEMBER( czk80_state::czk80_reset) +{ + membank("bankr0")->set_entry(1); +} + +MACHINE_RESET_MEMBER( czk80_state, czk80 ) +{ + machine().scheduler().timer_set(attotime::from_usec(3), timer_expired_delegate(FUNC(czk80_state::czk80_reset),this)); + membank("bankr0")->set_entry(0); // point at rom + membank("bankw0")->set_entry(0); // always write to ram + membank("bankr1")->set_entry(0); // point at rom + membank("bankw1")->set_entry(0); // always write to ram +} + +DRIVER_INIT_MEMBER( czk80_state, czk80 ) +{ + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(1, &main[0x0000]); + membank("bankr0")->configure_entry(0, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); + + membank("bankr1")->configure_entry(1, &main[0xe000]); + membank("bankr1")->configure_entry(0, &main[0x10000]); + membank("bankw1")->configure_entry(0, &main[0xe000]); +} + +static SLOT_INTERFACE_START( czk80_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +WRITE8_MEMBER( czk80_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( czk80, czk80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(czk80_mem) + MCFG_CPU_IO_MAP(czk80_io) + MCFG_CPU_CONFIG(daisy_chain) + MCFG_MACHINE_RESET_OVERRIDE(czk80_state, czk80) + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(czk80_state, kbd_put)) + MCFG_UPD765A_ADD("fdc", false, true) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", czk80_floppies, "525dd", floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(czk80_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(czk80_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(czk80_state, ctc_z2_w)) + + MCFG_Z80DART_ADD("z80dart", XTAL_16MHz / 4, 0, 0, 0, 0 ) + //MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + //MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + //MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_16MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( czk80 ) + ROM_REGION( 0x12000, "maincpu", 0 ) + ROM_LOAD( "czk80.rom", 0x10000, 0x2000, CRC(7081b7c6) SHA1(13f75b14ea73b252bdfa2384e6eead6e720e49e3)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, czk80, 0, 0, czk80, czk80, czk80_state, czk80, "", "CZK-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/d6800.c b/src/mame/drivers/d6800.c new file mode 100644 index 00000000000..29f9a074051 --- /dev/null +++ b/src/mame/drivers/d6800.c @@ -0,0 +1,435 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/******************************************************************************** + + The Dream 6800 is a CHIP-8 computer roughly modelled on the Cosmac VIP. + It was described in Electronics Australia magazine in 4 articles starting + in May 1979. It has 1k of ROM and 1k of RAM. The video consists of 64x32 + pixels. The keyboard is a hexcode 4x4 matrix, plus a Function key. + + Designed by Michael Bauer, of the Division of Computing and Mathematics + at Deakin University, Australia. + + NOTE that the display only updates after each 4 digits is entered, and + you can't see what you type as you change bytes. This is by design. + + The cassette has no checksum, header or blocks. It is simply a stream + of pulses. The successful loading of a tape is therefore a matter of luck. + + Function keys: + FN 0 - Modify memory - firstly enter a 4-digit address, then 2-digit data + the address will increment by itself, enter the next byte. + FN by itself will step to the next address. + + FN 1 - Tape load. You must have entered the start address at 0002, and + the end address+1 at 0004 (big-endian). + + FN 2 - Tape save. You must have entered the start address at 0002, and + the end address+1 at 0004 (big-endian). + + FN 3 - Run. You must have entered the 4-digit go address first. + + All CHIP-8 programs load at 0x200 (max size 4k), and exec address + is C000. + + Information and programs can be found at http://chip8.com/?page=78 + + +**********************************************************************************/ + + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "sound/beep.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "sound/wave.h" +#include "machine/6821pia.h" + + +class d6800_state : public driver_device +{ +public: + d6800_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cass(*this, "cassette"), + m_pia(*this, "pia"), + m_beeper(*this, "beeper"), + m_videoram(*this, "videoram"), + m_io_x0(*this, "X0"), + m_io_x1(*this, "X1"), + m_io_x2(*this, "X2"), + m_io_x3(*this, "X3"), + m_io_y0(*this, "Y0"), + m_io_y1(*this, "Y1"), + m_io_y2(*this, "Y2"), + m_io_y3(*this, "Y3"), + m_io_shift(*this, "SHIFT") { } + + DECLARE_READ8_MEMBER( d6800_cassette_r ); + DECLARE_WRITE8_MEMBER( d6800_cassette_w ); + DECLARE_READ8_MEMBER( d6800_keyboard_r ); + DECLARE_WRITE8_MEMBER( d6800_keyboard_w ); + DECLARE_WRITE_LINE_MEMBER( d6800_screen_w ); + UINT32 screen_update_d6800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(d6800_c); + TIMER_DEVICE_CALLBACK_MEMBER(d6800_p); + DECLARE_QUICKLOAD_LOAD_MEMBER( d6800 ); +protected: + required_device m_maincpu; + required_device m_cass; + required_device m_pia; + required_device m_beeper; + required_shared_ptr m_videoram; + required_ioport m_io_x0; + required_ioport m_io_x1; + required_ioport m_io_x2; + required_ioport m_io_x3; + required_ioport m_io_y0; + required_ioport m_io_y1; + required_ioport m_io_y2; + required_ioport m_io_y3; + required_ioport m_io_shift; +private: + UINT8 m_rtc; + bool m_cb2; + bool m_cassold; + UINT8 m_cass_data[4]; + UINT8 m_portb; + virtual void machine_start(); + virtual void machine_reset(); +}; + + +/* Memory Maps */ + +static ADDRESS_MAP_START( d6800_map, AS_PROGRAM, 8, d6800_state ) + AM_RANGE(0x0000, 0x00ff) AM_RAM + AM_RANGE(0x0100, 0x01ff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x0200, 0x0fff) AM_RAM + AM_RANGE(0x8010, 0x8013) AM_DEVREADWRITE("pia", pia6821_device, read, write) + AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3800) AM_ROM +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( d6800 ) + PORT_START("X0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y0") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + + PORT_START("Y1") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("Y2") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + + PORT_START("Y3") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("SHIFT") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FN") PORT_CODE(KEYCODE_LSHIFT) + + PORT_START("VS") + /* vblank */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") +INPUT_PORTS_END + +/* Video */ + +UINT32 d6800_state::screen_update_d6800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 x,y,gfx=0; + + for (y = 0; y < 32; y++) + { + UINT16 *p = &bitmap.pix16(y); + + for (x = 0; x < 8; x++) + { + if (m_cb2) + gfx = m_videoram[ x | (y<<3)]; + + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + return 0; +} + +/* NE556 */ + +TIMER_DEVICE_CALLBACK_MEMBER(d6800_state::d6800_c) +{ + m_cass_data[3]++; + + if (BIT(m_portb, 0) != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = BIT(m_portb, 0); + } + + if (BIT(m_portb, 0)) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +/* PIA6821 Interface */ + +TIMER_DEVICE_CALLBACK_MEMBER(d6800_state::d6800_p) +{ + m_rtc++; + if (m_rtc > 159) + m_rtc = 0; + + UINT8 data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read(); + int ca1 = (data == 255) ? 0 : 1; + int ca2 = m_io_shift->read(); + int cb1 = (m_rtc) ? 1 : 0; + + m_pia->ca1_w(ca1); + m_pia->ca2_w(ca2); + m_pia->cb1_w(cb1); + + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_cass_data[2] = ((m_cass_data[1] < 12) ? 128 : 0); + m_cass_data[1] = 0; + } +} + + +WRITE_LINE_MEMBER( d6800_state::d6800_screen_w ) +{ + m_cb2 = state; +} + +READ8_MEMBER( d6800_state::d6800_cassette_r ) +{ + /* + Cassette circuit consists of a 741 op-amp, a 74121 oneshot, and a 74LS74. + When a pulse arrives, the oneshot is set. After a preset time, it triggers + and the 74LS74 compares this pulse to the output of the 741. Therefore it + knows if the tone is 1200 or 2400 Hz. Input to PIA is bit 7. + */ + + return m_cass_data[2] | m_portb; +} + +WRITE8_MEMBER( d6800_state::d6800_cassette_w ) +{ + /* + A NE556 runs at either 1200 or 2400 Hz, depending on the state of bit 0. + This output drives the speaker and the output signal to the cassette player. + Bit 6 enables the speaker. Also the speaker is silenced when cassette operations + are in progress (DMA/CB2 line low). + */ + + m_beeper->set_frequency(BIT(data, 0) ? 2400 : 1200); + m_beeper->set_state(BIT(data, 6) & m_cb2); + + m_portb = data & 0x7f; +} + +READ8_MEMBER( d6800_state::d6800_keyboard_r ) +{ + /* + This system reads the key matrix one way, then swaps the input and output + lines around and reads it another way. This isolates the key that was pressed. + */ + + UINT8 data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read() + & m_io_y0->read() & m_io_y1->read() & m_io_y2->read() & m_io_y3->read(); + + return data; +} + +WRITE8_MEMBER( d6800_state::d6800_keyboard_w ) +{ + /* + + bit description + + PA0 keyboard column 0 + PA1 keyboard column 1 + PA2 keyboard column 2 + PA3 keyboard column 3 + PA4 keyboard row 0 + PA5 keyboard row 1 + PA6 keyboard row 2 + PA7 keyboard row 3 + + */ + +} + +/* Machine Initialization */ + +void d6800_state::machine_start() +{ +} + +void d6800_state::machine_reset() +{ + m_beeper->set_state(0); + m_rtc = 0; + m_cass_data[0] = 0; + m_cass_data[1] = 0; + m_cass_data[2] = 128; + m_cass_data[3] = 0; +} + +/* Machine Drivers */ + +QUICKLOAD_LOAD_MEMBER( d6800_state, d6800 ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int i; + int quick_addr = 0x200; + int exec_addr = 0xc000; + int quick_length; + dynamic_buffer quick_data; + int read_; + int result = IMAGE_INIT_FAIL; + + quick_length = image.length(); + quick_data.resize(quick_length); + read_ = image.fread( &quick_data[0], quick_length); + if (read_ != quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.message(" Cannot read the file"); + } + else + { + for (i = 0; i < quick_length; i++) + if ((quick_addr + i) < 0x1000) + space.write_byte(i + quick_addr, quick_data[i]); + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length,quick_addr,quick_addr+quick_length,exec_addr); + + // Start the quickload + if (strcmp(image.filetype(), "bin") == 0) + m_maincpu->set_pc(quick_addr); + else + m_maincpu->set_pc(exec_addr); + + result = IMAGE_INIT_PASS; + } + + return result; +} + +static MACHINE_CONFIG_START( d6800, d6800_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6800, XTAL_4MHz/4) + MCFG_CPU_PROGRAM_MAP(d6800_map) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(64, 32) + MCFG_SCREEN_VISIBLE_AREA(0, 63, 0, 31) + MCFG_SCREEN_UPDATE_DRIVER(d6800_state, screen_update_d6800) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(25)) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_DEVICE_ADD("pia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(d6800_state, d6800_keyboard_r)) + MCFG_PIA_READPB_HANDLER(READ8(d6800_state, d6800_cassette_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(d6800_state, d6800_keyboard_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(d6800_state, d6800_cassette_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(d6800_state, d6800_screen_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("d6800_c", d6800_state, d6800_c, attotime::from_hz(4800)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("d6800_p", d6800_state, d6800_p, attotime::from_hz(40000)) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", d6800_state, d6800, "bin,c8,ch8", 1) +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( d6800 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS(0, "0", "Original") + ROMX_LOAD( "d6800.bin", 0xc000, 0x0400, CRC(3f97ca2e) SHA1(60f26e57a058262b30befceceab4363a5d65d877), ROM_BIOS(1) ) + ROMX_LOAD( "d6800.bin", 0xc400, 0x0400, CRC(3f97ca2e) SHA1(60f26e57a058262b30befceceab4363a5d65d877), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "1", "Dreamsoft") + ROMX_LOAD( "d6800d.bin", 0xc000, 0x0800, CRC(ded5712f) SHA1(f594f313a74d7135c9fdd0bcb0093fc5771a9b7d), ROM_BIOS(2) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS, INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, d6800, 0, 0, d6800, d6800, driver_device, 0, "Michael Bauer", "Dream 6800", 0 ) diff --git a/src/mame/drivers/d6809.c b/src/mame/drivers/d6809.c new file mode 100644 index 00000000000..a806be0d820 --- /dev/null +++ b/src/mame/drivers/d6809.c @@ -0,0 +1,167 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/******************************************************************************* + + 6809 Portable + + 12/05/2009 Skeleton driver. + 21/09/2011 connected to terminal, notes added [Robbbert] + +Chips used: +- 6809E CPU +- 6845 CRTC +- 6840 CTC +- 6551 UART Console +- 6551 UART Aux +- 6850 UART Unknown purpose +- uPD765 FDC +- 2764 8K ROM for CPU +- 2732 4K ROM for Chargen (not dumped) +- 6x 6264 RAM +- 3x 5516 RAM +- XTAL: 16MHz + +So much for the official documentation. + +In practice, it reads/writes to a terminal, and doesn't use most of the other +devices. + +'maincpu' (F9DD): unmapped program memory write to 00F0 = 05 & FF +'maincpu' (F9E3): unmapped program memory read from 0001 & FF <----- these 2 are CLR 0001 +'maincpu' (F9E3): unmapped program memory write to 0001 = 00 & FF +'maincpu' (F9E6): unmapped program memory read from 0005 & FF <----- these 2 are CLR 0005 +'maincpu' (F9E6): unmapped program memory write to 0005 = 00 & FF +'maincpu' (F9E9): unmapped program memory write to 0002 = 0B & FF <-- these 2 are STD 0002 +'maincpu' (F9E9): unmapped program memory write to 0003 = 1E & FF +'maincpu' (F9EC): unmapped program memory write to 0006 = 0B & FF <-- these 2 are STD 0006 +'maincpu' (F9EC): unmapped program memory write to 0007 = 1E & FF +'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF <-- the remainder seems to be disk related +'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF +'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF +'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF +'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF +'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF +'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF +'maincpu' (FA6E): unmapped program memory read from 00F0 & FF +'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF +'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF +'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF +'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF +'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF +'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF +'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF +'maincpu' (FA6E): unmapped program memory read from 00F0 & FF +'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF +'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF +'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF +'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF +'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF +'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF +'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF +'maincpu' (FA6E): unmapped program memory read from 00F0 & FF +'maincpu' (FA41): unmapped program memory write to 00F2 = 00 & FF +'maincpu' (FA46): unmapped program memory write to 00F0 = 04 & FF +'maincpu' (FA82): unmapped program memory read from 00F0 & FF +'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF +'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF +'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF +'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF +'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF +'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF +'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF +'maincpu' (FA6E): unmapped program memory read from 00F0 & FF +'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF +'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF +'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF +'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF +'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF +'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF +'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF +'maincpu' (FA6E): unmapped program memory read from 00F0 & FF <-- now it gives up & prints an error + + +**********************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class d6809_state : public driver_device +{ +public: + d6809_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_WRITE8_MEMBER( kbd_put ); + DECLARE_READ8_MEMBER( term_r ); + DECLARE_WRITE8_MEMBER( term_w ); + UINT8 m_term_data; + virtual void machine_reset(); +}; + +READ8_MEMBER( d6809_state::term_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( d6809_state::term_w ) +{ + if ((data > 0) && (data < 0x80)) + m_terminal->write(space, 0, data); +} + +static ADDRESS_MAP_START( d6809_mem, AS_PROGRAM, 8, d6809_state ) + ADDRESS_MAP_UNMAP_HIGH + // 00-FF is for various devices. + AM_RANGE(0x00ff, 0x00ff) AM_READWRITE(term_r,term_w) + AM_RANGE(0x1000, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xffff) AM_ROM +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( d6809 ) +INPUT_PORTS_END + + +WRITE8_MEMBER( d6809_state::kbd_put ) +{ + m_term_data = data; +} + +void d6809_state::machine_reset() +{ +} + + +static MACHINE_CONFIG_START( d6809, d6809_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6809E, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(d6809_mem) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(d6809_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( d6809 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "d6809.rom", 0xe000, 0x2000, CRC(2ceb40b8) SHA1(780111541234b4f0f781a118d955df61daa56e7e)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, d6809, 0, 0, d6809, d6809, driver_device, 0, "Dunfield", "6809 Portable", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/dai.c b/src/mame/drivers/dai.c new file mode 100644 index 00000000000..8f2a4b408c2 --- /dev/null +++ b/src/mame/drivers/dai.c @@ -0,0 +1,259 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha, Nathan Woods +/******************************************************************************* + +DAI driver by Krzysztof Strzecha and Nathan Woods + +What's new: +----------- +21.05.2004 TMS5501 fixes. Debug code cleanups. +06.03.2004 Stack overflow interrupt added. +05.09.2003 Random number generator added. Few video hardware bugs fixed. + Fixed few I8080 instructions, making much more BASIC games playable. + +Notes on emulation status and to do list: +----------------------------------------- +1. A lot to do. Too much to list. + +DAI technical information +========================== + +CPU: +---- + I8080 2MHz + + +Memory map: +----------- + 0000-bfff RAM + c000-dfff ROM (non-switchable) + e000-efff ROM (4 switchable banks) + f000-f7ff ROM extension (optional) + f800-f8ff SRAM (stack) + f900-ffff I/O + f900-faff spare + fb00-fbff AMD9511 math chip (optional) + fc00-fcff 8253 programmable interval timer + fd00-fdff discrete devices + fe00-feff 8255 PIO (DCE bus) + ff00-ffff timer + 5501 interrupt controller + +Interrupts: +----------- + + +Keyboard: +--------- + + +Video: +----- + + +Sound: +------ + + +Timings: +-------- + + +*******************************************************************************/ + +#include "emu.h" +#include "includes/dai.h" + +/* I/O ports */ +static ADDRESS_MAP_START( dai_io , AS_IO, 8, dai_state ) +ADDRESS_MAP_END + +/* memory w/r functions */ +static ADDRESS_MAP_START( dai_mem , AS_PROGRAM, 8, dai_state ) + AM_RANGE( 0x0000, 0xbfff) AM_RAMBANK("bank1") + AM_RANGE( 0xc000, 0xdfff) AM_ROM + AM_RANGE( 0xe000, 0xefff) AM_ROMBANK("bank2") + AM_RANGE( 0xf000, 0xf7ff) AM_WRITE(dai_stack_interrupt_circuit_w ) + AM_RANGE( 0xf800, 0xf8ff) AM_RAM + AM_RANGE( 0xfb00, 0xfbff) AM_READWRITE(dai_amd9511_r, dai_amd9511_w ) + AM_RANGE( 0xfc00, 0xfcff) AM_READWRITE(dai_pit_r, dai_pit_w) // AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE( 0xfd00, 0xfdff) AM_READWRITE(dai_io_discrete_devices_r, dai_io_discrete_devices_w ) + AM_RANGE( 0xfe00, 0xfeff) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) + AM_RANGE( 0xff00, 0xff0f) AM_MIRROR(0xf0) AM_DEVICE("tms5501", tms5501_device, io_map) +ADDRESS_MAP_END + + +/* keyboard input */ +static INPUT_PORTS_START (dai) + PORT_START("IN0") /* [0] - port ff07 bit 0 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("IN1") /* [1] - port ff07 bit 1 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("IN2") /* [2] - port ff07 bit 2 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("IN3") /* [3] - port ff07 bit 3 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("IN4") /* [4] - port ff07 bit 4 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("IN5") /* [5] - port ff07 bit 5 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("IN6") /* [6] - port ff07 bit 6 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rept") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("IN7") /* [7] - port ff07 bit 7 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Char del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("IN8") /* [8] */ + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0xcb, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +/* F4 Character Displayer */ +static const gfx_layout dai_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( dai ) + GFXDECODE_ENTRY( "gfx1", 0x0000, dai_charlayout, 0, 8 ) +GFXDECODE_END + +/* machine definition */ +static MACHINE_CONFIG_START( dai, dai_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(dai_mem) + MCFG_CPU_IO_MAP(dai_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(dai_state,int_ack) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(2000000) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("custom", dai_sound_device, set_input_ch0)) + MCFG_PIT8253_CLK1(2000000) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("custom", dai_sound_device, set_input_ch1)) + MCFG_PIT8253_CLK2(2000000) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("custom", dai_sound_device, set_input_ch2)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1056, 542) + MCFG_SCREEN_VISIBLE_AREA(0, 1056-1, 0, 302-1) + MCFG_SCREEN_UPDATE_DRIVER(dai_state, screen_update_dai) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", dai) + MCFG_PALETTE_ADD("palette", sizeof (dai_palette) / 3) + MCFG_PALETTE_INIT_OWNER(dai_state, dai) + + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("custom", DAI_SOUND, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("dai_cass") + + /* tms5501 */ + MCFG_DEVICE_ADD("tms5501", TMS5501, 2000000) + MCFG_TMS5501_IRQ_CALLBACK(INPUTLINE("maincpu", I8085_INTR_LINE)) + MCFG_TMS5501_XI_CALLBACK(READ8(dai_state, dai_keyboard_r)) + MCFG_TMS5501_XO_CALLBACK(WRITE8(dai_state, dai_keyboard_w)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list", "dai_cass") +MACHINE_CONFIG_END + +#define io_dai io_NULL + +ROM_START(dai) + ROM_REGION(0x14000,"maincpu",0) + ROM_LOAD("dai.bin", 0xc000, 0x2000, CRC(ca71a7d5) SHA1(6bbe2336c717354beab2ae201debeb4fd055bdcb)) + ROM_LOAD("dai00.bin", 0x10000, 0x1000, CRC(fa7d39ac) SHA1(3d1824a1f273882f934249ef3cb1b38ef99de7b9)) + ROM_LOAD("dai01.bin", 0x11000, 0x1000, CRC(cb5809f2) SHA1(523656f0a9d98888cd3e2bd66886c589e9ae75b4)) + ROM_LOAD("dai02.bin", 0x12000, 0x1000, CRC(03f72d4a) SHA1(573d65dc82321970dcaf81d7638a02252ea18a7a)) + ROM_LOAD("dai03.bin", 0x13000, 0x1000, CRC(c475c96f) SHA1(96fc3cc4b8a2873f0d044bd8033d1e7b7197dd97)) + ROM_REGION(0x2000, "gfx1",0) + ROM_LOAD ("nch.bin", 0x0000, 0x1000, CRC(a9f5b30b) SHA1(24119b2984ab4e50dc0dabae1065ff6d6c1f237d)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1978, dai, 0, 0, dai, dai, driver_device, 0, "Data Applications International", "DAI Personal Computer", 0) diff --git a/src/mame/drivers/daruma.c b/src/mame/drivers/daruma.c new file mode 100644 index 00000000000..33f3226230c --- /dev/null +++ b/src/mame/drivers/daruma.c @@ -0,0 +1,169 @@ +// license:GPL-2.0+ +// copyright-holders: Felipe Sanches +/*************************************************************************** + + Sigtron Daruma DS348 dot-matrix printer + https://www.hardstand.com.br/daruma/ds348 + + Driver by Felipe Correa da Silva Sanches + + Model: Print Plus - DS348 + Manufacturer: Sigtron Daruma + Firmware version 1.1 + Release Date: May 8th/1998 + PCB: SIGTRON DS348 REV.B + +***************************************************************************/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "sound/speaker.h" +//TODO: #include "ds348.lh" + +class daruma_state : public driver_device +{ +public: + daruma_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker") { } + + DECLARE_WRITE8_MEMBER(port_w); + DECLARE_READ8_MEMBER(port_r); + + DECLARE_READ8_MEMBER(dev0_r); + DECLARE_WRITE8_MEMBER(dev1_w); + DECLARE_WRITE8_MEMBER(dev2_w); + DECLARE_READ8_MEMBER(dev4_r); + required_device m_maincpu; + required_device m_speaker; + char port0, port1, port2, port3; +}; + +WRITE8_MEMBER(daruma_state::port_w) +{ +// printf("port_w: write %02X to PORT (offset=%02X)\n", data, offset); + switch(offset) + { + case MCS51_PORT_P0: port0=data; + case MCS51_PORT_P1: port1=data; + case MCS51_PORT_P2: port2=data; + case MCS51_PORT_P3: port3=data; + } +} + +READ8_MEMBER(daruma_state::port_r) +{ + switch(offset) + { + case MCS51_PORT_P0: printf("port_r: read %02X from PORT0\n", port0); return port0; + case MCS51_PORT_P1: printf("port_r: read %02X from PORT1\n", port1); return port1; + case MCS51_PORT_P2: printf("port_r: read %02X from PORT2\n", port2); return port2; + case MCS51_PORT_P3: printf("port_r: read %02X from PORT3\n", port3); return port3; + } + return 0; +} + +READ8_MEMBER(daruma_state::dev0_r) +{ + return 0xFF; +} + +READ8_MEMBER(daruma_state::dev4_r) +{ + return ioport("switches")->read(); +} + +WRITE8_MEMBER(daruma_state::dev1_w) +{ + //while attempting to identify which bit is used for + //controlling the buzzer, here's what I heard from each of + //the signals on this address: + + //0x80 serial comm.? (noise) + //0x20 LED? (3 clicks) + //0x10 LED? (1 click) + //0x08 serial comm.? click & noise + //0x04 LED? (2 clicks) + //0x02 motor control or printer heads? (I hear a series of rhythmic pulses) + //0x01 LED? (2 clicks) + m_speaker->level_w(data & 0x02); +} + +WRITE8_MEMBER(daruma_state::dev2_w) +{ + //while attempting to identify which bit is used for + //controlling the buzzer, here's what I heard from each of + //the signals on this address: + + //0x80: LED? (3 clicks) + //0x40: unused? + //0x20: unused? + //0x10: low freq brief beep followed by a click + //0x08: low freq brief noise followed by a click + //0x04: low freq brief beep followed by a click + //0x02: low freq brief beep followed by a click + //0x01: low freq brief noise + //m_speaker->level_w(data & 0x01); +} + +static ADDRESS_MAP_START( mem_prg, AS_PROGRAM, 8, daruma_state ) + AM_RANGE(0x0000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mem_io, AS_IO, 8, daruma_state ) + AM_RANGE(0x0000, 0x0000) AM_READ(dev0_r) + AM_RANGE(0x1000, 0x1000) AM_WRITE(dev1_w) +// AM_RANGE(0x2000, 0x2000) AM_WRITE(dev2_w) +// AM_RANGE(0x3000, 0x3000) AM_WRITE(dev3_w) + AM_RANGE(0x4000, 0x4000) AM_READ(dev4_r) + AM_RANGE(0x8000, 0xffff) AM_RAM /* 32K CMOS SRAM (HYUNDAY hy62256a) */ + AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(port_r, port_w) +ADDRESS_MAP_END + +//TODO: These buttons and switches are all guesses. We'll need to further investigate this. +static INPUT_PORTS_START( daruma ) + PORT_START("buttons") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Paper A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Paper B") PORT_CODE(KEYCODE_B) + + PORT_START("switches") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Limit Switch") PORT_CODE(KEYCODE_S) + +INPUT_PORTS_END + +static MACHINE_CONFIG_START( daruma, daruma_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80C32,11059200) //verified on pcb + MCFG_CPU_PROGRAM_MAP(mem_prg) + MCFG_CPU_IO_MAP(mem_io) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(0, "mono", 1.00) + +/* TODO: + MCFG_DEFAULT_LAYOUT(layout_daruma) + + Motors: MTA011 + http://pdf.datasheetcatalog.com/datasheet/Shindengen/mXstzvq.pdf + + The motor controller suposedly is used to cut the paper strip out after finishing printing something. +*/ +MACHINE_CONFIG_END + +ROM_START( ds348 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "daruma_ds348_v1_1.rom", 0x0000, 0x10000, CRC(10bf9036) SHA1(d654a13bc582f5384e759ec6fe5309a642bd8e18) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1998, ds348, 0, 0, daruma, daruma, driver_device, 0, "Sigtron Daruma", "Print Plus DS348 - Dot matrix printer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/dccons.c b/src/mame/drivers/dccons.c new file mode 100644 index 00000000000..fbb92009889 --- /dev/null +++ b/src/mame/drivers/dccons.c @@ -0,0 +1,760 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese, R. Belmont +/* + + dc.c - Sega Dreamcast driver + by R. Belmont & Angelo Salese + + SH-4 @ 200 MHz + ARM7DI @ 2.8223 MHz (no T or M extensions) + PowerVR 3D video + AICA audio + GD-ROM drive (modified ATAPI interface) + + NTSC/N NTSC/I PAL/N PAL/I VGA + (x/240) (x/480) (x/240) (x/480) (640x480) + VTOTAL 262 524 312 624 524 + HTOTAL 857 857 863 863 857 + + PCLKs = 26917135 (NTSC 480 @ 59.94), 26944080 (VGA 480 @ 60.0), 13458568 (NTSC 240 @ 59.94), + 25925600 (PAL 480 @ 50.00), 13462800 (PAL 240 @ 50.00) + + TODO: + - RTC error always pops up at start-up, no flash plus bug with ticks (needs rewrite) + - Inputs doesn't work most of the time; + - Candy Stripe: fills the log with "ATAPI_FEATURES_FLAG_OVL not supported", black screen + - Carrier: Jaleco logo uses YUV, but y size is halved? + - Close To: Hangs at FMV + - F355 Challenge: black screen after Sega logo; + - Gundam - Side Story 0079: currently hangs at Bandai logo (regression) + - Idol Janshi wo Tsukucchaou: pixel aspect is way wrong (stretched and offsetted horizontally) + - Power Stone: hangs at Capcom logo; + - Sega GT: no cursor on main menu; + - Tetris 4D: hangs at BPS FMV (bp 0C0B0C4E) + + Notes: + - DC US and DC PAL flash ROMs are definitely hacked, they are set to have Chinese instead of Japanese. + - 0x1a002 of flash ROM returns the region type (0x30=Japan, 0x31=USA, 0x32=Europe). Amusingly, if the value + on a non-jp console is different than these ones, the system shows a black swirl (and nothing boots). + - gdi file for DCLP (a Dreamcast tester) doesn't have first two tracks info, they are: + 1 0 4 2048 FILE0001.DUP 0 + 2 1798 0 2352 FILE0002.DUP 0 + serial i/o also fails on that, work ram addresses that needs to be patched with 0x0009 (nop) are: + 0xc0196da + 0xc0196ec + SH4 TEST: + UBC test (0101): + ok + FPU test (0201): + NG + 0xc03fe24 work ram flag check (1=error, 0=ok) + Cache test (03xx): + Cache Read/Write test (0301) + NG + Cache RAM mode Check (0305) + NG + MMU test (04xx): + asserts + TMU test (0501): + *_reg check -> ok + TCNT* reload -> NG + TCNT* underflow irq -> NG + MULT test (0601) + ok + DIVU test (0701) + ok + Store Queue test (0801): + ok + SCIF test (0901) + NG + Private Instruction test (0a01) + NG + Critical test (0dxx) + Critical (Store Queue) test (0d01): + ok + Critical (Write back) test (0d02): + ok + Critical (ADD,CMP/EQ) test (0d03): + ok + Critical (OC_OIX) test (0d04): + NG + Critical (MAX current) test (0d05): + ok (very slow!) + Critical (IC Cross Talk) test (0d06): + NG + Critical (Cache D-array) test (0d07): + NG + SH-4 BUG (0exx) + SH4_BUG 64bit FMOV + ok + SH4 BUG FIX (64bitFMOV) + ok + MEM TEST: + AICA (0102) + ok + Work RAM (0204): + ok + PV64 area (0303): + ok + PV32 area (0403): + ok + CLX TEST: + CLX internal RAM (0101): + ok + check (0401): + (sets up RGB888 mode 2, assuming it's critically failed) + TA TEST: + TA_YUVINT (0101): + ok -> IST_EOXFER_YUV + TA_OENDINT (0102): + ok -> IST_EOXFER_OPLST + TA_OMENDINT (0103): + ok -> IST_EOXFER_OPMV + TA_TENDINT (0104): + ok -> IST_EOXFER_TRLST + TA_TMENDINT (0105): + ok -> IST_EOXFER_TRMV + TA_PTENDINT (0106): + ok -> IST_EOXFER_PTLST + TA_ISPINT (0107): + NG -> ISP/TSP Parameter Overflow (error) + TA_OBJINT (0108): + NG -> OBJect list pointer Overflow (error) + TA_IPINT (0109): + NG -> TA: Illegal parameter (error) + YUV Converter (0201): + ok + DDT i/f TEST: + Sort, Normal DMA (1) (0101) + hangs (wants Sort DMA irq, of course) + Sort, Normal DMA (2) + ... + Through + NG, hangs again + DC_DEINT (0201) + ok + DC_SDTEINT (0202) + ok + DC_SDTERINT (0203) + ok (but returns error count ++, think it's a bug in the SW) + G2 TEST + DMA (0101): + G2 EXT AREA DETECT: + "!!!! ch00 ERROR DETECT !!!!" + Interrupt (0301): + G2 EXT AREA DETECT + DMA END INT + hangs + Ext Interrupt (06xx) + AICA INT (0601) + error detect + Modem INT (0602) + error detect + AICA TEST + Sound RAM (01xx) + Pattern R/W check (0101) + ok + Register (02xx) + CH Data (0201) + ok + EXT Input (0202) + ok + DSP Data (0203) + ok + S_Clock (03xx) + 50MSEC (0301) + NG -> ~0xa58 in 0x702814, must be > 0x889 and < 0x8b0 + 25MSEC (0302) + NG -> ~0x372 in 0x702814, must be > 0x443 and < 0x45a + Timer (04xx) + Timer A (0401) + NG + Timer B (0402) + NG + Timer C (0403) + NG + DMA (05xx) + SRAM -> CH Reg (0501) + ok + SRAM -> Comm Reg (0502) + ok + SRAM -> DSP Reg (0503) + ok + CH Reg -> SRAM (0504) + ok + Comm Reg -> SRAM (0505) + ok + DSP Reg -> SRAM (0506) + ok + Clear SRAM (0507) + ok + Clear CH Reg (0508) + ok + Clear Comm Reg (0509) + ok + Clear DSP Reg (050a) + ok + Interrupt (06xx) + Sampling clock (0601) + NG (irq 0x400) + Timer A (0602) + randomly NG/ok + Timer B (0603) + ok + Timer C (0604) + ok + DMA End (0605) + ok + Midi Out (0606) + NG + Main CPU (0607) + ok + RTC (07xx) + Write Protect (0701) + ok + RW Comp (0702) + ok + Clock (0703) + NG + ARM7 (08xx) + Load & Start (0801) + NG + Timer & Intr (0802) + NG + DMA (0803) + NG + Ch-Reg R/W (0804) + ok + SRAM incr (0805) + NG + SRAM pattern (0806) + ok + EG (09xx) + LSA-Reg Left (0901) + ok/NG + LSA-Reg Right (0902) + ok/NG + LSA-Reg Left & Right (0903) + ok/NG + MIDI (0axx) + OEMP bit (0a01) + NG + OFLL bit (0a02) + NG + PVRi/f test + DMA (01xx) + CPU trig (0101) + ok + INT trig + ok + Interrupt (02xx) + PVR DMA end Int (0201) + ok + PVR DMA IA Int (0202) + NG + PVR DMA end (0203) + NG + Flash test: + (SH-4 jumps to la la land as soon as this is started) + + +*/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "cpu/sh4/sh4.h" +#include "cpu/arm7/arm7core.h" +#include "sound/aica.h" +#include "machine/aicartc.h" +#include "includes/dc.h" +#include "includes/dccons.h" +#include "imagedev/chd_cd.h" +#include "machine/dc-ctrl.h" +#include "machine/gdrom.h" + +#define CPU_CLOCK (200000000) + +READ64_MEMBER(dc_cons_state::dcus_idle_skip_r ) +{ + //if (space.device().safe_pc()==0xc0ba52a) + // space.device().execute().spin_until_time(attotime::from_usec(2500)); + // device_spinuntil_int(&space.device()); + + return dc_ram[0x2303b0/8]; +} + +READ64_MEMBER(dc_cons_state::dcjp_idle_skip_r ) +{ + //if (space.device().safe_pc()==0xc0bac62) + // space.device().execute().spin_until_time(attotime::from_usec(2500)); + // device_spinuntil_int(&space.device()); + + return dc_ram[0x2302f8/8]; +} + +DRIVER_INIT_MEMBER(dc_cons_state,dc) +{ + dreamcast_atapi_init(); +} + +DRIVER_INIT_MEMBER(dc_cons_state,dcus) +{ + m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2303b0, 0xc2303b7, read64_delegate(FUNC(dc_cons_state::dcus_idle_skip_r),this)); + + DRIVER_INIT_CALL(dc); +} + +DRIVER_INIT_MEMBER(dc_cons_state,dcjp) +{ + m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2302f8, 0xc2302ff, read64_delegate(FUNC(dc_cons_state::dcjp_idle_skip_r),this)); + + DRIVER_INIT_CALL(dc); +} + +READ64_MEMBER(dc_cons_state::dc_pdtra_r ) +{ + UINT64 out = PCTRA<<32; + + out |= PDTRA & ~0x0303; + + // if both bits are inputs + if (!(PCTRA & 0x5)) + { + out |= 0x03; + } + + // one's input one's output, always pull up both bits + if (((PCTRA & 5) == 1) || ((PCTRA & 5) == 4)) + { + if (PDTRA & 3) + { + out |= 0x03; + } + } + + /* + cable setting, (0) VGA, (2) TV RGB (3) TV VBS/Y + S/C. + Note: several games doesn't like VGA setting (i.e. Idol Janshi wo Tsukucchaou, Airforce Delta), default to composite. + */ + out |= ioport("SCREEN_TYPE")->read() << 8; + + return out; +} + +WRITE64_MEMBER(dc_cons_state::dc_pdtra_w ) +{ + PCTRA = (data>>16) & 0xffff; + PDTRA = (data & 0xffff); +} + +READ64_MEMBER(dc_cons_state::dc_arm_r ) +{ + return *((UINT64 *)dc_sound_ram.target()+offset); +} + +WRITE64_MEMBER(dc_cons_state::dc_arm_w ) +{ + COMBINE_DATA((UINT64 *)dc_sound_ram.target() + offset); +} + +#if 0 +READ8_MEMBER(dc_cons_state::dc_flash_r) +{ + return m_dcflash->read(offset); +} + +WRITE8_MEMBER(dc_cons_state::dc_flash_w) +{ + m_dcflash->write(offset,data); +} +#endif + +static ADDRESS_MAP_START( dc_map, AS_PROGRAM, 64, dc_cons_state ) + AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_WRITENOP // BIOS + AM_RANGE(0x00200000, 0x0021ffff) AM_ROM AM_REGION("dcflash",0)//AM_READWRITE8(dc_flash_r,dc_flash_w, U64(0xffffffffffffffff)) + AM_RANGE(0x005f6800, 0x005f69ff) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) + AM_RANGE(0x005f6c00, 0x005f6cff) AM_DEVICE32( "maple_dc", maple_dc_device, amap, U64(0xffffffffffffffff) ) + AM_RANGE(0x005f7000, 0x005f701f) AM_DEVREADWRITE16("ata", ata_interface_device, read_cs1, write_cs1, U64(0x0000ffff0000ffff) ) + AM_RANGE(0x005f7080, 0x005f709f) AM_DEVREADWRITE16("ata", ata_interface_device, read_cs0, write_cs0, U64(0x0000ffff0000ffff) ) + AM_RANGE(0x005f7400, 0x005f74ff) AM_READWRITE32(dc_mess_g1_ctrl_r, dc_mess_g1_ctrl_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x005f7800, 0x005f78ff) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) + AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, U64(0xffffffffffffffff)) + AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) + AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE(dc_modem_r, dc_modem_w ) + AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, U64(0xffffffffffffffff)) + AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, U64(0x0000ffff0000ffff) ) + AM_RANGE(0x00800000, 0x009fffff) AM_READWRITE(dc_arm_r, dc_arm_w ) +// AM_RANGE(0x01000000, 0x01ffffff) G2 Ext Device #1 +// AM_RANGE(0x02700000, 0x02707fff) AICA reg mirror +// AM_RANGE(0x02800000, 0x02ffffff) AICA wave mem mirror + +// AM_RANGE(0x03000000, 0x03ffffff) G2 Ext Device #2 + + /* Area 1 */ + AM_RANGE(0x04000000, 0x04ffffff) AM_RAM AM_SHARE("dc_texture_ram") // texture memory 64 bit access + AM_RANGE(0x05000000, 0x05ffffff) AM_RAM AM_SHARE("frameram") // apparently this actually accesses the same memory as the 64-bit texture memory access, but in a different format, keep it apart for now + + /* Area 3 */ + AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM AM_SHARE("dc_ram") + AM_RANGE(0x0d000000, 0x0dffffff) AM_RAM AM_SHARE("dc_ram")// extra ram on Naomi (mirror on DC) + AM_RANGE(0x0e000000, 0x0effffff) AM_RAM AM_SHARE("dc_ram")// mirror + AM_RANGE(0x0f000000, 0x0fffffff) AM_RAM AM_SHARE("dc_ram")// mirror + + /* Area 4 */ + AM_RANGE(0x10000000, 0x107fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) + AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) + AM_RANGE(0x11000000, 0x117fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath0_w) AM_MIRROR(0x00800000) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue + + AM_RANGE(0x12000000, 0x127fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) + AM_RANGE(0x12800000, 0x12ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) + AM_RANGE(0x13000000, 0x137fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath1_w) AM_MIRROR(0x00800000) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue + +// AM_RANGE(0x14000000, 0x17ffffff) G2 Ext Device #3 + + AM_RANGE(0x8c000000, 0x8cffffff) AM_RAM AM_SHARE("dc_ram") // another RAM mirror + + AM_RANGE(0xa0000000, 0xa01fffff) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dc_port, AS_IO, 64, dc_cons_state ) + AM_RANGE(0x00000000, 0x00000007) AM_READWRITE(dc_pdtra_r, dc_pdtra_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dc_audio_map, AS_PROGRAM, 32, dc_cons_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("dc_sound_ram") /* shared with SH-4 */ + AM_RANGE(0x00800000, 0x00807fff) AM_READWRITE(dc_arm_aica_r, dc_arm_aica_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( dc ) + PORT_START("P1:0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 RIGHT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 LEFT") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 DOWN") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 UP") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("P1 START") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 C") + + PORT_START("P1:1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 2nd directional pad + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 D") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 X") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Y") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 Z") + + PORT_START("P1:A0") + PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P1 R") PORT_PLAYER(1) + + PORT_START("P1:A1") + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P1 L") PORT_PLAYER(1) + + PORT_START("P1:A2") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(1) + + PORT_START("P1:A3") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(1) + + //A4 - A5, second analog stick, unused on DC + + PORT_START("P2:0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 RIGHT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 LEFT") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 DOWN") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 UP") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 START") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P2 C") + + PORT_START("P2:1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 2nd directional pad + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 D") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 X") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Y") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 Z") + + PORT_START("P2:A0") + PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P2 R") PORT_PLAYER(2) + + PORT_START("P2:A1") + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P2 L") PORT_PLAYER(2) + + PORT_START("P2:A2") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(2) + + PORT_START("P2:A3") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(2) + + //A4 - A5, second analog stick, unused on DC + + PORT_START("P3:0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_NAME("P3 RIGHT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) PORT_NAME("P3 LEFT") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_NAME("P3 DOWN") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_NAME("P3 UP") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 ) PORT_NAME("P3 START") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 A") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 B") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 C") + + PORT_START("P3:1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 2nd directional pad + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 D") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 X") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) PORT_NAME("P3 Y") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 Z") + + PORT_START("P3:A0") + PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P3 R") PORT_PLAYER(3) + + PORT_START("P3:A1") + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P3 L") PORT_PLAYER(3) + + PORT_START("P3:A2") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(3) + + PORT_START("P3:A3") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(3) + + //A4 - A5, second analog stick, unused on DC + + PORT_START("P4:0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) PORT_NAME("P4 RIGHT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) PORT_NAME("P4 LEFT") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) PORT_NAME("P4 DOWN") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) PORT_NAME("P4 UP") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 ) PORT_NAME("P4 START") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 A") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 B") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P4 C") + + PORT_START("P4:1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 2nd directional pad + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 D") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 X") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4) PORT_NAME("P4 Y") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 Z") + + PORT_START("P4:A0") + PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P4 R") PORT_PLAYER(4) + + PORT_START("P4:A1") + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P4 L") PORT_PLAYER(4) + + PORT_START("P4:A2") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(4) + + PORT_START("P4:A3") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(4) + + //A4 - A5, second analog stick, unused on DC + + PORT_START("MAMEDEBUG") + PORT_DIPNAME( 0x01, 0x00, "Bilinear Filtering" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + + PORT_START("SCREEN_TYPE") + PORT_CONFNAME( 0x03, 0x03, "Screen Connection Type" ) + PORT_CONFSETTING( 0x00, "VGA" ) + PORT_CONFSETTING( 0x02, "Composite" ) + PORT_CONFSETTING( 0x03, "S-Video" ) +INPUT_PORTS_END + +MACHINE_RESET_MEMBER(dc_cons_state,dc_console) +{ + dc_state::machine_reset(); + m_aica->set_ram_base(dc_sound_ram, 2*1024*1024); +} + +WRITE_LINE_MEMBER(dc_cons_state::aica_irq) +{ + m_soundcpu->set_input_line(ARM7_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE_LINE_MEMBER(dc_cons_state::sh4_aica_irq) +{ + if(state) + dc_sysctrl_regs[SB_ISTEXT] |= IST_EXT_AICA; + else + dc_sysctrl_regs[SB_ISTEXT] &= ~IST_EXT_AICA; + + dc_update_interrupt_status(); +} + +static MACHINE_CONFIG_FRAGMENT( gdrom_config ) + MCFG_DEVICE_MODIFY("cdda") + MCFG_SOUND_ROUTE(0, "^^^^lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "^^^^rspeaker", 1.0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( dc, dc_cons_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", SH4LE, CPU_CLOCK) + MCFG_SH4_MD0(1) + MCFG_SH4_MD1(0) + MCFG_SH4_MD2(1) + MCFG_SH4_MD3(0) + MCFG_SH4_MD4(0) + MCFG_SH4_MD5(1) + MCFG_SH4_MD6(0) + MCFG_SH4_MD7(1) + MCFG_SH4_MD8(0) + MCFG_SH4_CLOCK(CPU_CLOCK) + MCFG_CPU_PROGRAM_MAP(dc_map) + MCFG_CPU_IO_MAP(dc_port) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dc_state, dc_scanline, "screen", 0, 1) + + MCFG_CPU_ADD("soundcpu", ARM7, ((XTAL_33_8688MHz*2)/3)/8) // AICA bus clock is 2/3rds * 33.8688. ARM7 gets 1 bus cycle out of each 8. + MCFG_CPU_PROGRAM_MAP(dc_audio_map) + + MCFG_MACHINE_RESET_OVERRIDE(dc_cons_state,dc_console ) + +// MCFG_MACRONIX_29LV160TMC_ADD("dcflash") + + MCFG_MAPLE_DC_ADD( "maple_dc", "maincpu", dc_maple_irq ) + MCFG_DC_CONTROLLER_ADD("dcctrl0", "maple_dc", 0, ":P1:0", ":P1:1", ":P1:A0", ":P1:A1", ":P1:A2", ":P1:A3", ":P1:A4", ":P1:A5") + MCFG_DC_CONTROLLER_ADD("dcctrl1", "maple_dc", 1, ":P2:0", ":P2:1", ":P2:A0", ":P2:A1", ":P2:A2", ":P2:A3", ":P2:A4", ":P2:A5") + MCFG_DC_CONTROLLER_ADD("dcctrl2", "maple_dc", 2, ":P3:0", ":P3:1", ":P3:A0", ":P3:A1", ":P3:A2", ":P3:A3", ":P3:A4", ":P3:A5") + MCFG_DC_CONTROLLER_ADD("dcctrl3", "maple_dc", 3, ":P4:0", ":P4:1", ":P4:A0", ":P4:A1", ":P4:A2", ":P4:A3", ":P4:A4", ":P4:A5") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(13458568*2, 857, 0, 640, 524, 0, 480) /* TODO: where pclk actually comes? */ + MCFG_SCREEN_UPDATE_DEVICE("powervr2", powervr2_device, screen_update) + MCFG_PALETTE_ADD("palette", 0x1000) + MCFG_POWERVR2_ADD("powervr2", WRITE8(dc_state, pvr_irq)) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("aica", AICA, 0) + MCFG_AICA_MASTER + MCFG_AICA_IRQ_CB(WRITELINE(dc_cons_state, aica_irq)) + MCFG_AICA_MAIN_IRQ_CB(WRITELINE(dc_cons_state, sh4_aica_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(0, "rspeaker", 1.0) + + MCFG_AICARTC_ADD("aicartc", XTAL_32_768kHz) + + MCFG_DEVICE_ADD("ata", ATA_INTERFACE, 0) + MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(dc_cons_state, ata_interrupt)) + + MCFG_DEVICE_MODIFY("ata:0") + MCFG_SLOT_OPTION_ADD("gdrom", GDROM) + MCFG_SLOT_OPTION_MACHINE_CONFIG("gdrom", gdrom_config) + MCFG_SLOT_DEFAULT_OPTION("gdrom") +MACHINE_CONFIG_END + +/* +PsyMan notes: + +Here's a basic report on the Dreamcast boot files used in MAME (BIOS+Flash pairs): + +----- + +"dc101d_us.bin", 0x000000, 0x200000, CRC(89f2b1a1) SHA1(8951d1bb219ab2ff8583033d2119c899cc81f18c) ) // BIOS +This is a proper European and USA BIOS. It's even possible that it was used at a later point for Japanese systems. +It only has minor differences compared to BIOS 1.01c. + + +"dcus_ntsc.bin", 0x000000, 0x020000, BAD_DUMP CRC(c611b498) SHA1(94d44d7f9529ec1642ba3771ed3c5f756d5bc872) ) // Flash +Checking at 0x0001A000 and the mirrored data at 0x0001A0A0 gives away that this is hacked from a PAL/European flash file. +The broadcast (0x0001A004) is also set at 50Hz which is a PAL standard. + + +"dc101d_eu.bin", 0x000000, 0x200000, CRC(a2564fad) SHA1(edc5d3d70a93c935703d26119b37731fd317d2bf),ROM_BIOS(1)) // BIOS +This BIOS has Chinese language added. So either this is a bad BIOS or Dreamcast was actually officially released there. + + +"dc101c_eu.bin", 0x000000, 0x200000, CRC(2f551bc5) SHA1(1ede8d5be49116a4c6f3fe0961175469537a0434),ROM_BIOS(2)) // BIOS +This seems to be a proper European and USA BIOS. It's even possible that it was used at a later point for Japanese systems. +It only has minor differences compared to BIOS 1.01d. + + + +"dceu_pal.bin", 0x000000, 0x020000, BAD_DUMP CRC(b7e5aeeb) SHA1(11e02433e13b793ec7ffe0ae2356750bb8a575b4) ) // Flash +This appears to be a valid PAL/European flash. It's unknown if the data at 0x0001A0A0 (from 0x0001A000) should be mirrored there. +Maybe a game does this mirroring or maybe it's there by default. It's certain that some games wrote to this flash though. + + +"dc1004jp.bin", 0x000000, 0x200000, CRC(5454841f) SHA1(1ea132c0fbbf07ef76789eadc07908045c089bd6) ) // BIOS +This seems to be a proper Japanese BIOS. This BIOS was used at least by early Japanese Dreamcast models. +Code-wise, it has major differences compared to later BIOS versions. + + +"dcjp_ntsc.bin", 0x000000, 0x020000, CRC(5f92bf76) SHA1(be78b834f512ab2cf3d67b96e377c9f3093ff82a) ) // Flash +Checking at 0x0001A000 and the mirrored data at 0x0001A0A0 gives away that this is hacked from a PAL/European flash file. +The broadcast (0x0001A004) is also set at 50Hz which is a PAL standard. + +----- + + +From all the aforementioned files the only personally verified one is "dc101d_us.bin", CRC(89f2b1a1). +The resulting file was dumped twice, once from an NTSC/USA system and once from a PAL/EUR system. Both files had a side by side byte match. +*/ + +ROM_START(dc) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "dc101d_us.bin", 0x000000, 0x200000, CRC(89f2b1a1) SHA1(8951d1bb219ab2ff8583033d2119c899cc81f18c) ) // BIOS + + ROM_REGION(0x020000, "dcflash", 0) + ROM_LOAD( "dcus_ntsc.bin", 0x000000, 0x020000, BAD_DUMP CRC(c611b498) SHA1(94d44d7f9529ec1642ba3771ed3c5f756d5bc872) ) // Flash + ROM_FILL( 0x1a004, 1, 0x30 ) // patch broadcast back to NTSC +ROM_END + +ROM_START( dceu ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "101d", "v1.01d") + ROMX_LOAD( "dc101d_eu.bin", 0x000000, 0x200000, CRC(a2564fad) SHA1(edc5d3d70a93c935703d26119b37731fd317d2bf),ROM_BIOS(1)) // BIOS + ROM_SYSTEM_BIOS(1, "101c", "v1.01c") + ROMX_LOAD( "dc101c_eu.bin", 0x000000, 0x200000, CRC(2f551bc5) SHA1(1ede8d5be49116a4c6f3fe0961175469537a0434),ROM_BIOS(2)) // BIOS + + ROM_REGION(0x020000, "dcflash", 0) + ROM_LOAD( "dceu_pal.bin", 0x000000, 0x020000, BAD_DUMP CRC(b7e5aeeb) SHA1(11e02433e13b793ec7ffe0ae2356750bb8a575b4) ) // Flash +ROM_END + +ROM_START( dcjp ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "dc1004jp.bin", 0x000000, 0x200000, CRC(5454841f) SHA1(1ea132c0fbbf07ef76789eadc07908045c089bd6) ) // BIOS + + ROM_REGION(0x020000, "dcflash", 0) + /* ROM_LOAD( "dcjp_ntsc.bad", 0x000000, 0x020000, BAD_DUMP CRC(307a7035) SHA1(1411423a9d071340ea52c56e19c1aafc4e1309ee) ) // Hacked Flash */ + ROM_LOAD( "dcjp_ntsc.bin", 0x000000, 0x020000, BAD_DUMP CRC(5f92bf76) SHA1(be78b834f512ab2cf3d67b96e377c9f3093ff82a) ) // Flash + ROM_FILL( 0x1a004, 1, 0x30 ) // patch broadcast back to NTSC +ROM_END + +ROM_START( dcdev ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "hkt-0120.bin", 0x000000, 0x200000, CRC(2186e0e5) SHA1(6bd18fb83f8fdb56f1941e079580e5dd672a6dad) ) // BIOS + + ROM_REGION(0x020000, "dcflash", 0) + ROM_LOAD( "hkt-0120-flash.bin", 0x000000, 0x020000, CRC(7784c304) SHA1(31ef57f550d8cd13e40263cbc657253089e53034) ) // Flash +ROM_END + +ROM_START( dcprt ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "katana-set5-v0.41-98-08-27.bin", 0x000000, 0x200000, CRC(485877bd) SHA1(dc1af1f1248ffa87d57bc5ef2ea41aac95ecfc5e) ) // BIOS + + ROM_REGION(0x020000, "dcflash", 0) + ROM_LOAD( "dcjp_ntsc.bin", 0x000000, 0x020000, CRC(5f92bf76) SHA1(be78b834f512ab2cf3d67b96e377c9f3093ff82a) ) // Flash +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1999, dc, dcjp, 0, dc, dc, dc_cons_state, dcus, "Sega", "Dreamcast (USA, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1998, dcjp, 0, 0, dc, dc, dc_cons_state, dcjp, "Sega", "Dreamcast (Japan, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1999, dceu, dcjp, 0, dc, dc, dc_cons_state, dcus, "Sega", "Dreamcast (Europe, PAL)", MACHINE_NOT_WORKING ) +CONS( 1998, dcdev, dcjp, 0, dc, dc, dc_cons_state, dc, "Sega", "HKT-0120 Sega Dreamcast Development Box", MACHINE_NOT_WORKING ) +CONS( 1998, dcprt, dcjp, 0, dc, dc, dc_cons_state, dcjp, "Sega", "Katana Set 5 Prototype", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/dct11em.c b/src/mame/drivers/dct11em.c new file mode 100644 index 00000000000..50cfe44458e --- /dev/null +++ b/src/mame/drivers/dct11em.c @@ -0,0 +1,83 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + DEC DCT11-EM + + 03/12/2010 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/t11/t11.h" + +class dct11em_state : public driver_device +{ +public: + dct11em_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_dct11em(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START( dct11em_mem, AS_PROGRAM, 16, dct11em_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_RAM // RAM + AM_RANGE( 0x2000, 0x2fff ) AM_RAM // Optional RAM + AM_RANGE( 0xa000, 0xdfff ) AM_ROM // RAM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( dct11em ) +INPUT_PORTS_END + + +void dct11em_state::machine_reset() +{ +} + +void dct11em_state::video_start() +{ +} + +UINT32 dct11em_state::screen_update_dct11em(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +static MACHINE_CONFIG_START( dct11em, dct11em_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",T11, 7500000) // 7.5MHz XTAL + MCFG_T11_INITIAL_MODE(0x1403) /* according to specs */ + MCFG_CPU_PROGRAM_MAP(dct11em_mem) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(dct11em_state, screen_update_dct11em) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( dct11em ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // Highest address line inverted + ROM_LOAD16_BYTE( "23-213e4.bin", 0x8000, 0x2000, CRC(bdd82f39) SHA1(347deeff77596b67eee27a39a9c40075fcf5c10d)) + ROM_LOAD16_BYTE( "23-214e4.bin", 0x8001, 0x2000, CRC(b523dae8) SHA1(cd1a64a2bce9730f7a9177d391663919c7f56073)) + ROM_COPY("maincpu", 0x8000, 0xc000, 0x2000) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, dct11em, 0, 0, dct11em, dct11em, driver_device, 0, "Digital Equipment Corporation", "DCT11-EM", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/dectalk.c b/src/mame/drivers/dectalk.c new file mode 100644 index 00000000000..506895e05ed --- /dev/null +++ b/src/mame/drivers/dectalk.c @@ -0,0 +1,1010 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/****************************************************************************** +* +* DECtalk DTC-01 Driver +* Copyright (C) 2009-2013 Jonathan Gevaryahu AKA Lord Nightmare +* with major help (dumping, tech questions answered, etc) +* from Kevin 'kevtris' Horton, without whom this driver would +* have been impossible. +* Special thanks to Al Kossow for archiving the DTC-01 schematic at bitsavers, +* http://bitsavers.org/pdf/dec/dectalk/MP-01820_DTC01_EngrDrws_Nov83.pdf +* which has been invaluable for work on this driver. +* Special thanks to leeeeee for helping figure out what the led selftest codes actually mean +* +* +* This driver dedicated in memory of Dennis Klatt and Jonathan Allen, without whose +* original work MITalk and hence KlattTalk and DECtalk would never have existed, +* in memory of Martin Minow, who wrote much of the DECtalk DTC-01 code, and +* in memory of Tony Vitale, who was one of the architects of the DECtalk project. +* +* Staff behind DECtalk itself: (mostly from http://amhistory.si.edu/archives/speechsynthesis/ss_dec.htm ): +* John C. Broihier +* Edward A. Bruckert (who followed the DECtalk IP from DEC->Compaq->HP->Force Computers->Fonix inc from where he retired in 2014) +* Dave Conroy (dtc-03 letter to sound rules; logic design, worked on dtc-01 and dtc-03, see correspondence below) +* Michael J. Crowley +* Dennis H. Klatt [1938 - Dec 30, 1988] (worked on klsyn and other parts of MITalk, wrote KLATTtalk which was exclusively licensed to DEC in 1982, worked on dtc-01 and dtc-03) +* Martin A. Minow [Nov 6, 1940 - Dec 21, 2000] (dtc-01 conversion of hunnicutt's letter to sound rules, phonetics and general programming) +* Walter Tetschner (DECtalk project director; as of 2013 publishes ASRnews: http://www.asrnews.com/) +* Anthony J. Vitale [Apr 30, 1945 - Aug 5, 2002] (DECtalk project architect; dtc-03 letter to sound rules; worked on dtc-01 and dtc-03) +* +* Staff behind MITalk: (also see http://amhistory.si.edu/archives/speechsynthesis/ss_mit.htm ) +* Dennis H. Klatt (see above) +* Jonathan Allen [Jun 4, 1934 - Apr 24, 2000] (speech synthesis theory and development) +* M. Sharon 'Sheri' Hunnicutt (worked on letter to phoneme rules, which were licensed non-exclusively to DEC in 1982; still works as a docent at KTH in Sweden as of 2013) +* +* TODO: +* * DUART: +* * The duart self tests are EXTENSIVE and make an excellent check of many of the duart internal bits. +* To enable the self tests rather than bypassing them, under dipswitches, set 'Skip Self Test(IP4)' to 'Open (VCC)' +* and under system configuration set 'Hack to prevent hang when skip self test is shorted' to 'Off' +* * DUART needs to be reset on reset line activation. as is it works ok, but it should be done anyway. +* * DUART needs its i/o pins connected as well: +* * pins IP0, IP2, and IP3 are connected to the primary serial port: +* * IP0 is CTS +* * IP2 is DSR +* * IP3 is RLS (received line signal, this pin is rarely used on rs232) +* * pins IP4, IP5 and IP6 are on jumpers on the DUART, tied high normally but jumperable low, should be handled as dipswitches: +* * IP4 low: skip hardware self tests +* * IP5 low: unknown +* * IP6 low: unknown +* * pins OP0 and OP2 are connected to the primary serial port: +* * OP0 is RTS +* * OP2 is DTR +* * Figure out why the v1.8 dectalk firmware clips/screeches like hell (it requires the older dsp code to work properly) +* * Figure out why the older -165/-166 and newer -409/-410 tms32010 dsp firmwares don't produce any sound, while the middle -204/-205 one does (fifo implementations were busted) +* * Actually store the X2212 nvram's eeprom data to disk rather than throwing it out on exit +* * Get setup mode with the serial BREAK int working enough to actually properly save the default nvram back to the chip in emulation, and get rid of the (currently unused) nvram default image in the rom definitions +* * emulate/simulate the MT8860 DTMF decoder and MT8865 DTMF filter as a 16-key input device? or hook it to some simple fft code? Francois Jalbert's fftmorse code ran full speed on a 12mhz 80286, maybe use that? +* Sarayan suggested this can be done in one of two ways: +* 1. Standalone 'canned' DTMF detector and discriminator code (francois' and peter jennings' 286 code, or modern fft code) +* 2. Emulate the MT8865 as a set of two 7th order bandpass filters with 2 +* outputs for the low and high band (as in real life as documented on the +* datasheet) and emulate the MT8860 exactly as in real life as well, as a +* dual-input pulse-width measurement device to distinguish the 4 low and +* high band DTMF tones as well as their combined presence. +* The latter is clearly more accurate but likely slower. +* * figure out how to plumb diserial/rs232 to have an external application send data to the two serial ports to be spoken; this shouldn't be too hard at this point. +* +* LED error code list (found by experimentation and help from leeeeee): +* Startup Self tests: +* FF 00 - M68k address register check fail or data register check fail (test code at $21E) +* (for some data register failures the processor just spins forever and no led code is generated) +* FF 01 - ROM check fail @ 0x00000, rom at E8 or E22 (test code at $278) +* FF 02 - ROM check fail @ 0x08000, rom at E7 or E21 " +* FF 03 - ROM check fail @ 0x10000, rom at E6 or E20 " +* FF 04 - ROM check fail @ 0x18000, rom at E5 or E19 " +* FF 05 - ROM check fail @ 0x20000, rom at E4 or E18 " +* FF 06 - ROM check fail @ 0x28000, rom at E3 or E17 " +* FF 07 - ROM check fail @ 0x30000, rom at E2 or E16 " +* FF 08 - ROM check fail @ 0x38000, rom at E1 or E15 " +* FF 0F - ROM check fail at multiple addresses +* FE 01 - RAM check fail @ 0x80000-0x83fff, ram at E36 or E49 (test code at $338) +* FE 02 - RAM check fail @ 0x84000-0x87fff, ram at E35 or E48 " +* FE 03 - RAM check fail @ 0x88000-0x8bfff, ram at E34 or E47 " +* FE 04 - RAM check fail @ 0x8c000-0x8ffff, ram at E33 or E46 " +* FE 05 - RAM check fail @ 0x90000-0x93fff, ram at E32 or E44 " +* FE 0F - RAM check fail at multiple addresses +* FD 00 - DUART test & DUART interrupt test (test code at $046C) +* FC 00 - This test doesn't exist. Some vestiges of it may remain in code for the FD and FB tests. +* FB 00 - TMS32010 extensive tests (test code at $051E): test spc interrupt [works] and make dtmf tone to test tlc interrupt [fails in mess, requires dtmf detection on output; this test is actually patented! US 4,552,992] +* Jump to $102C to skip the self tests +* During normal operation: +(table taken from http://www3.sympatico.ca/n.rieck/docs/DECtalk_notes.html ) +DTC-01 LEDs + + 76543210 LEDs + |||||||| + |||||||+-------- set if host asserting CTS + ||||||+--------- set if DECtalk asserting RTS + |||||+---------- set if host asserting DSR + ||||+----------- set if host asserting DCD + |||+------------ set if DECtalk asserting DTR + +++------------- 3 bit state code + + 000 in state 5, first 500 ms; waiting for CD & CTS in first 500 ms when DECtalk is on-line + 001 timing 2 second CD=0 while in state 6 (moving data) + 010 waiting for DSR=0 while disconnecting (part of state 7) + 011 waiting for DSR=1 while connecting (state 3) + 100 delaying for UK modems during disconnect (part of state 7) + 101 waiting for CD and CTS (main part of state 5) + 110 moving data (state 6) + 111 disconnecting (start of state 7) +* DECtalk dtc-01 hardware and rom version history, from DTC-01 schematic at bitsavers and with additional info from + http://americanhistory.si.edu/archives/speechsynthesis/ss_dec1.htm +* August 1983: Hardware version A done +* unknown date: Version 1.0 roms finalized +* unknown date: Version 1.1 roms released to fix a bug with insufficient stack space, see ss_dec1 above +* October 11 1983: Second half of Version 1.8 rom finalized +* December 05 1983: First half of Version 1.8 rom finalized +* March 1984: Hardware version B done + (integrates the output fifo sync error check onto the pcb; + Version A units are retrofitted when sent in for firmware upgrades) + (most of the schematics come from this time, and have the version 1.8 roms listed on them) +* July 02 1984: Second half of Version 2.0 rom finalized +* July 23 1984: First half of Version 2.0 rom finalized +* October 1984 (the rest of the schematics come from this time) +* sometime after 6th week of 1985: dsp roms updated to the -409/-410 set +* +* NVRAM related stuff found by leeeeee (in v2.0): +* $10402 - nvram recall/reset based on byte on stack (0 = recall, 1 = write default to nvram) +* $10f2E - nvram recall +* $10f52 - entry point for nvram check routine +* $11004(entry point)-$11030, $11032-$111B4 - nvram store routine: +* pass with a blank word on stack and be sure the test and branch at 11016 & 1101a passes (jumps to 1106a) +* It will then write currently loaded settings to nvram and execute a store, so do it after the defaults are loaded +* $1a7ae - default nvram image, without checksum (0x80 bytes) +*******************************************************************************/ +/*the 68k memory map is such: +0x000000-0x007fff: E22 low, E8 high +0x008000-0x00ffff: E21 low, E7 high +0x010000-0x017fff: E20 low, E6 high +0x018000-0x01ffff: E19 low, E5 high +0x020000-0x027fff: E18 low, E4 high +0x028000-0x02ffff: E17 low, E3 high +0x030000-0x037fff: E16 low, E2 high +0x038000-0x03ffff: E15 low, E1 high +mirrrored at 0x040000-0x07ffff +ram/nvram/speech mapping: +0x080000-0x083fff: e36 low, e49 high +0x084000-0x087fff: e35 low, e48 high +0x088000-0x08bfff: e34 low, e47 high +0x08c000-0x08ffff: e33 low, e46 high +0x090000-0x093fff: e32 low, e45 high +0x094000-0x097fff: LED/SW/NVR +0x098000-0x09bfff: 2681 DUART +0x09c000-0x09ffff: DTMF and TMS32010 (TLC, SPC) +mirrored at 0x0a0000-0x0fffff x3 +entire space mirrored at 0x100000-0x7fffff +0x800000-0xffffff is open bus? + +interrupts: +68k has an interrupt priority decoder attached to it: +TLC is INT level 4 +SPC is INT level 5 +DUART is INT level 6 +*/ +/* dtc-03 post by dave conroy from usenet comp.sys.dec on 12/29/2011: +> Wow. were they better than the DTC01? (OK, I guess they had to be.) + +I worked on both of these at DEC (in fact, I think if you look in the +options and modules +list, you will see my initials in the "responsible engineer" column +for the DTC03). + +The goals of the DTC03 were lower cost, better letter to sound rules, +and better packaging for large systems (it was pretty inconvenient to +set up 30-40 of +the big DTC01 boxes). + +The hardware was quite different. The DTC01 used a Motorola 68000 and +a TI DSP, connected +together by a big bank of (expensive) fifo chips. The DTC03 used then +(then new) Intel 80186 and the same +TI DSP, connected together by DMA (the DTC03 design was done in a way +that used *all* of the +capabilities of the 80186 to reduce the cost). The DTC01 used the +packaging of the VT240, and the DTC03 +used the packaging of a family of rack-mounted modems whose part +number escapes me. The +same guy (Rich Ellison) designed both of them. The DTC03 also had an +"option module" system which +was intended to allow non-US systems to be built without needing to +change the common +parts (because it was on an independent module, and could override all +of the telephone control ESC +sequences, it could be taken through the approval process in +isolation), although it was used +to build some semi-custom systems as well. + +The code in the DSP and the code that transformed a stream of phonemes +into a stream +of control commands for the DSP was pretty much the same in DTC01/ +DTC03, and was based on the work of +Dennis Klatt of MIT (Dennis actually wrote a lot of this code). The +letter to sound system +in DTC01 was the final step in the evolution of a set of letter-to- +sound rules that had been floating around DEC +for a long time; the bulk of the work getting them to work in the +DTC01 was done by +Martin Minow. The letter to sound system in DTC03 was a new design by +myself and Tony Vitale, +an ex-professor of linguistics from Cornell. Most people thought it +worked much +better; in reality, it's big advantage was it made far fewer stupid +stress-placement mistakes because +it did a much better job of understanding prefixes and suffixes. + +Dave Conroy +*/ +/* +There are 3 things on the pins. Serial I/O. The telephone line. Power. + +I believe the power is +5 and +12/-12. The +5 is for the logic, +and the +12/-12 is for the RS232 buffers and all of the analog stuff +in the anti-aliasing +filter, which is built from a pile of op-amps and stuff. + +The serial I/O pins go straight to the RS232 buffers and +onward to the UART (an SCN2661, if my memory is correct). + +The telephone pins go to the option connectors and the on-board +telephone line interface for the USA/Canada. Audio is available +somewhere on the +option connectors, but a really easy way to get at it is to take the +phone off-hook (send a "dial" command with an empty phone number +string) +and use the telephone pins as a transformer-coupled audio output. This +is what we +used to do in the lab all the time. + +dgc (dg(no!spam)cx@mac.com) +*/ + +// USE_LOOSE_TIMING makes the cpu interleave much lower and boosts it on fifo and flag writes by the 68k and semaphore sets by the dsp +#define USE_LOOSE_TIMING 1 +// makes use_loose_timing boost interleave when the outfifo is about to run out. slightly slows things down but may prevent some glitching +#undef USE_LOOSE_TIMING_OUTPUT +// generic logs like led state, and common writes for dsp and spc such as the speech int +#undef VERBOSE +// logs reads and writes to nvram, and nvram store/recall flag messages +#undef NVRAM_LOG +// logs reads and writes to TLC regs +#undef TLC_LOG +// logs reads and writes to SPC regs, 68k side only +#undef SPC_LOG_68K +// logs reads and writes to SPC regs, dsp side only +#undef SPC_LOG_DSP +// logs txa, txb and related serial lines to stderr +#undef SERIAL_TO_STDERR + +/* Core includes */ +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "cpu/tms32010/tms32010.h" +#include "machine/mc68681.h" +#include "machine/x2212.h" +#include "sound/dac.h" + + +class dectalk_state : public driver_device +{ +public: + enum + { + TIMER_OUTFIFO_READ + }; + + dectalk_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dsp(*this, "dsp"), + m_duart(*this, "duartn68681"), + m_nvram(*this, "x2212"), + m_dac(*this, "dac") + { + } + + // input fifo, between m68k and tms32010 + UINT16 m_infifo[32]; // technically eight 74LS224 4bit*16stage FIFO chips, arranged as a 32 stage, 16-bit wide fifo + UINT8 m_infifo_count; + UINT8 m_infifo_tail_ptr; + UINT8 m_infifo_head_ptr; + // output fifo, between tms32010 and 10khz sample latch for dac + UINT16 m_outfifo[16]; // technically three 74LS224 4bit*16stage FIFO chips, arranged as a 16 stage, 12-bit wide fifo + UINT8 m_outfifo_count; + UINT8 m_outfifo_tail_ptr; + UINT8 m_outfifo_head_ptr; + UINT8 m_infifo_semaphore; // latch for status of output fifo, d-latch 74ls74 @ E64 'lower half' + UINT8 m_spc_error_latch; // latch for error status of speech dsp, d-latch 74ls74 @ E64 'upper half' + UINT8 m_m68k_spcflags_latch; // latch for initializing the speech dsp, d-latch 74ls74 @ E29 'lower half', AND latch for spc irq enable, d-latch 74ls74 @ E29 'upper half'; these are stored in bits 0 and 6 respectively, the rest of the bits stored here MUST be zeroed! + UINT8 m_m68k_tlcflags_latch; // latch for telephone interface stuff, d-latches 74ls74 @ E93 'upper half' and @ 103 'upper and lower halves' + UINT8 m_simulate_outfifo_error; // simulate an error on the outfifo, which does something unusual to the dsp latches + UINT8 m_tlc_tonedetect; + UINT8 m_tlc_ringdetect; + UINT8 m_tlc_dtmf; // dtmf holding reg + UINT8 m_duart_inport; // low 4 bits of duart input + UINT8 m_duart_outport; // most recent duart output + UINT8 m_hack_self_test; // temp variable for hack below + + required_device m_maincpu; + required_device m_dsp; + required_device m_duart; + required_device m_nvram; + required_device m_dac; + DECLARE_WRITE_LINE_MEMBER(dectalk_duart_irq_handler); + DECLARE_WRITE_LINE_MEMBER(dectalk_duart_txa); + DECLARE_READ8_MEMBER(dectalk_duart_input); + DECLARE_WRITE8_MEMBER(dectalk_duart_output); + DECLARE_READ8_MEMBER(nvram_recall); + DECLARE_WRITE8_MEMBER(led_write); + DECLARE_WRITE8_MEMBER(nvram_store); + DECLARE_WRITE16_MEMBER(m68k_infifo_w); + DECLARE_READ16_MEMBER(m68k_spcflags_r); + DECLARE_WRITE16_MEMBER(m68k_spcflags_w); + DECLARE_READ16_MEMBER(m68k_tlcflags_r); + DECLARE_WRITE16_MEMBER(m68k_tlcflags_w); + DECLARE_READ16_MEMBER(m68k_tlc_dtmf_r); + DECLARE_WRITE16_MEMBER(spc_latch_outfifo_error_stats); + DECLARE_READ16_MEMBER(spc_infifo_data_r); + DECLARE_WRITE16_MEMBER(spc_outfifo_data_w); + DECLARE_READ16_MEMBER(spc_semaphore_r); + DECLARE_DRIVER_INIT(dectalk); + virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(outfifo_read_cb); + void dectalk_outfifo_check (); + void dectalk_clear_all_fifos( ); + void dectalk_semaphore_w ( UINT16 data ); + UINT16 dectalk_outfifo_r ( ); + DECLARE_WRITE_LINE_MEMBER(dectalk_reset); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +/* 2681 DUART */ +WRITE_LINE_MEMBER(dectalk_state::dectalk_duart_irq_handler) +{ + m_maincpu->set_input_line_and_vector(M68K_IRQ_6, state, M68K_INT_ACK_AUTOVECTOR); + //drvstate->m_maincpu->set_input_line_and_vector(M68K_IRQ_6, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); + //drvstate->m_maincpu->set_input_line_and_vector(M68K_IRQ_6, HOLD_LINE, vector); +} + +READ8_MEMBER(dectalk_state::dectalk_duart_input) +{ + UINT8 data = 0; + data |= m_duart_inport&0xF; + data |= (ioport("duart_in")->read()&0xF0); + if ((m_hack_self_test == 1) && (ioport("hacks")->read()&0x01)) data |= 0x10; // hack to prevent hang if selftest disable bit is kept low past the first read; i suppose the proper use of this bit was an incremental switch, or perhaps its expecting an interrupt later from serial in or tone in? added a dipswitch to disable the hack for testing + m_hack_self_test = 1; + return data; +} + +WRITE8_MEMBER(dectalk_state::dectalk_duart_output) +{ + m_duart_outport = data; +#ifdef SERIAL_TO_STDERR + fprintf(stderr, "RTS: %01X, DTR: %01X\n", data&1, (data&4)>>2); +#endif +} + +WRITE_LINE_MEMBER(dectalk_state::dectalk_duart_txa) +{ + //TODO: this needs to be plumbed so it shows up optionally on a second terminal somehow, or connects to diserial + // it is the second 'alternate' serial connection on the DTC-01, used for a serial passthru and other stuff. +#ifdef SERIAL_TO_STDERR + fprintf(stderr, "TXA:%02X ",data); +#endif +} + +/* FIFO and TMS32010 stuff */ +#define SPC_INITIALIZE state->m_m68k_spcflags_latch&0x1 // speech initialize flag +#define SPC_IRQ_ENABLED ((state->m_m68k_spcflags_latch&0x40)>>6) // irq enable flag + +void dectalk_state::dectalk_outfifo_check () +{ + // check if output fifo is full; if it isn't, set the int on the dsp + if (m_outfifo_count < 16) + m_dsp->set_input_line(0, ASSERT_LINE); // TMS32010 INT + else + m_dsp->set_input_line(0, CLEAR_LINE); // TMS32010 INT +} + +void dectalk_state::dectalk_clear_all_fifos( ) +{ + // clear fifos (TODO: memset would work better here...) + int i; + for (i=0; i<16; i++) m_outfifo[i] = 0; + m_outfifo_count = 0; + m_outfifo_tail_ptr = m_outfifo_head_ptr = 0; + for (i=0; i<32; i++) m_infifo[i] = 0; + m_infifo_count = 0; + m_infifo_tail_ptr = m_infifo_head_ptr = 0; + dectalk_outfifo_check(); +} + +// helper for dsp infifo_semaphore flag to make dealing with interrupts easier +void dectalk_state::dectalk_semaphore_w ( UINT16 data ) +{ + m_infifo_semaphore = data&1; + if ((m_infifo_semaphore == 1) && (m_m68k_spcflags_latch&0x40)) + { +#ifdef VERBOSE + logerror("speech int fired!\n"); +#endif + m_maincpu->set_input_line_and_vector(M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + } + else + m_maincpu->set_input_line_and_vector(M68K_IRQ_5, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); +} + +// read the output fifo and set the interrupt line active on the dsp +UINT16 dectalk_state::dectalk_outfifo_r ( ) +{ + UINT16 data = 0xFFFF; +#ifdef USE_LOOSE_TIMING_OUTPUT + // if outfifo count is less than two, boost the interleave to prevent running the fifo out + if (m_outfifo_count < 2) + machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(25)); +#endif +#ifdef VERBOSE + if (m_outfifo_count == 0) logerror("output fifo is EMPTY! repeating previous sample!\n"); +#endif + data = m_outfifo[m_outfifo_tail_ptr]; + // if fifo is empty (tail ptr == head ptr), do not increment the tail ptr, otherwise do. + if (m_outfifo_count > 0) + { + m_outfifo_tail_ptr++; + m_outfifo_count--; + } + m_outfifo_tail_ptr&=0xF; + dectalk_outfifo_check(); + return ((data&0xfff0)^0x8000); // yes this is right, top bit is inverted and bottom 4 are ignored + //return data; // not right but want to get it working first +} + +/* Machine reset and friends: stuff that needs setting up which IS directly affected by reset */ +WRITE_LINE_MEMBER(dectalk_state::dectalk_reset) +{ + m_hack_self_test = 0; // hack + // stuff that is DIRECTLY affected by the RESET line + machine().device("x2212")->recall(0); + machine().device("x2212")->recall(1); + machine().device("x2212")->recall(0); // nvram recall + m_m68k_spcflags_latch = 1; // initial status is speech reset(d0) active and spc int(d6) disabled + m_m68k_tlcflags_latch = 0; // initial status is tone detect int(d6) off, answer phone(d8) off, ring detect int(d14) off + machine().device("duartn68681")->reset(); // reset the DUART + // stuff that is INDIRECTLY affected by the RESET line + dectalk_clear_all_fifos(); // speech reset clears the fifos, though we have to do it explicitly here since we're not actually in the m68k_spcflags_w function. + dectalk_semaphore_w(0); // on the original DECtalk DTC-01 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. + m_spc_error_latch = 0; // spc error latch is cleared on /reset + m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // speech reset forces the CLR line active on the tms32010 + m_tlc_tonedetect = 0; // TODO, needed for selftest pass + m_tlc_ringdetect = 0; // TODO + m_tlc_dtmf = 0; // TODO + m_duart_inport = 0xF; + m_duart_outport = 0; +} + +void dectalk_state::machine_reset() +{ + /* hook the RESET line, which resets a slew of other components */ + m_maincpu->set_reset_callback(write_line_delegate(FUNC(dectalk_state::dectalk_reset),this)); +} + +/* Begin 68k i/o handlers */ + +READ8_MEMBER(dectalk_state::nvram_recall)// recall from x2212 nvram chip +{ +#ifdef NVRAM_LOG + fprintf(stderr,"NVRAM RECALL executed: offset %03x\n", offset); +#endif + m_nvram->recall(0); + m_nvram->recall(1); + m_nvram->recall(0); + return 0xFF; +} + +WRITE8_MEMBER(dectalk_state::led_write) +{ + popmessage("LED status: %02X\n", data&0xFF); +#ifdef VERBOSE + logerror("m68k: LED status: %02X\n", data&0xFF); +#endif + //popmessage("LED status: %x %x %x %x %x %x %x %x\n", data&0x80, data&0x40, data&0x20, data&0x10, data&0x8, data&0x4, data&0x2, data&0x1); +} + +WRITE8_MEMBER(dectalk_state::nvram_store) // store to X2212 NVRAM chip +{ +#ifdef NVRAM_LOG + fprintf(stderr,"NVRAM STORE executed: offset %03x, data written (and ignored) is %02x\n", offset, data); +#endif + m_nvram->store(0); + m_nvram->store(1); + m_nvram->store(0); +} + +WRITE16_MEMBER(dectalk_state::m68k_infifo_w)// 68k write to the speech input fifo +{ +#ifdef USE_LOOSE_TIMING + machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(25)); +#endif +#ifdef SPC_LOG_68K + logerror("m68k: SPC infifo written with data = %04X, fifo head was: %02X; fifo tail: %02X\n",data, m_infifo_head_ptr, m_infifo_tail_ptr); +#endif + // if fifo is full (head ptr = tail ptr-1), do not increment the head ptr and do not store the data + if (m_infifo_count == 32) + { +#ifdef SPC_LOG_68K + logerror("infifo was full, write ignored!\n"); +#endif + return; + } + m_infifo[m_infifo_head_ptr] = data; + m_infifo_head_ptr++; + m_infifo_count++; + m_infifo_head_ptr&=0x1F; +} + +READ16_MEMBER(dectalk_state::m68k_spcflags_r)// 68k read from the speech flags +{ + UINT8 data = 0; + data |= m_m68k_spcflags_latch; // bits 0 and 6 + data |= m_spc_error_latch<<5; // bit 5 + data |= m_infifo_semaphore<<7; // bit 7 +#ifdef SPC_LOG_68K + logerror("m68k: SPC flags read, returning data = %04X\n",data); +#endif + return data; +} + +WRITE16_MEMBER(dectalk_state::m68k_spcflags_w)// 68k write to the speech flags (only 3 bits do anything) +{ +#ifdef USE_LOOSE_TIMING + machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(25)); +#endif +#ifdef SPC_LOG_68K + logerror("m68k: SPC flags written with %04X, only storing %04X\n",data, data&0x41); +#endif + m_m68k_spcflags_latch = data&0x41; // ONLY store bits 6 and 0! + // d0: initialize speech flag (reset tms32010 and clear infifo and outfifo if high) + if ((data&0x1) == 0x1) // bit 0 + { +#ifdef SPC_LOG_68K + logerror(" | 0x01: initialize speech: fifos reset, clear error+semaphore latches and dsp reset\n"); +#endif + dectalk_clear_all_fifos(); + m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // speech reset forces the CLR line active on the tms32010 + // clear the two speech side latches + m_spc_error_latch = 0; + dectalk_semaphore_w(0); + } + else // (data&0x1) == 0 + { +#ifdef SPC_LOG_68K + logerror(" | 0x01 = 0: initialize speech off, dsp running\n"); +#endif + m_dsp->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); // speech reset deassert clears the CLR line on the tms32010 + } + if ((data&0x2) == 0x2) // bit 1 - clear error and semaphore latches + { +#ifdef SPC_LOG_68K + logerror(" | 0x02: clear error+semaphore latches\n"); +#endif + // clear the two speech side latches + m_spc_error_latch = 0; + dectalk_semaphore_w(0); + } + if ((data&0x40) == 0x40) // bit 6 - spc irq enable + { +#ifdef SPC_LOG_68K + logerror(" | 0x40: speech int enabled\n"); +#endif + if (m_infifo_semaphore == 1) + { +#ifdef SPC_LOG_68K + logerror(" speech int fired!\n"); +#endif + m_maincpu->set_input_line_and_vector(M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because semaphore was set + } + } + else // data&0x40 == 0 + { +#ifdef SPC_LOG_68K + logerror(" | 0x40 = 0: speech int disabled\n"); +#endif + m_maincpu->set_input_line_and_vector(M68K_IRQ_5, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); // clear int because int is now disabled + } +} + +READ16_MEMBER(dectalk_state::m68k_tlcflags_r)// dtmf flags read +{ + UINT16 data = 0; + data |= m_m68k_tlcflags_latch; // bits 6, 8, 14; + data |= m_tlc_tonedetect<<7; // bit 7 is tone detect + data |= m_tlc_ringdetect<<14; // bit 15 is ring detect +#ifdef TLC_LOG + logerror("m68k: TLC flags read, returning data = %04X\n",data); +#endif + return data; +} + +WRITE16_MEMBER(dectalk_state::m68k_tlcflags_w)// dtmf flags write +{ +#ifdef TLC_LOG + logerror("m68k: TLC flags written with %04X, only storing %04X\n",data, data&0x4140); +#endif + m_m68k_tlcflags_latch = data&0x4140; // ONLY store bits 6 8 and 14! + if ((data&0x40) == 0x40) // bit 6: tone detect interrupt enable + { +#ifdef TLC_LOG + logerror(" | 0x40: tone detect int enabled\n"); +#endif + if (m_tlc_tonedetect == 1) + { +#ifdef TLC_LOG + logerror(" TLC int fired!\n"); +#endif + m_maincpu->set_input_line_and_vector(M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because tone detect was set + } + } + else // data&0x40 == 0 + { +#ifdef TLC_LOG + logerror(" | 0x40 = 0: tone detect int disabled\n"); +#endif + if (((data&0x4000)!=0x4000) || (m_tlc_ringdetect == 0)) // check to be sure we don't disable int if both ints fired at once + m_maincpu->set_input_line_and_vector(M68K_IRQ_4, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); // clear int because int is now disabled + } + if ((data&0x100) == 0x100) // bit 8: answer phone relay enable + { +#ifdef TLC_LOG + logerror(" | 0x100: answer phone relay enabled\n"); +#endif + } + else // data&0x100 == 0 + { +#ifdef TLC_LOG + logerror(" | 0x100 = 0: answer phone relay disabled\n"); +#endif + } + if ((data&0x4000) == 0x4000) // bit 14: ring int enable + { +#ifdef TLC_LOG + logerror(" | 0x4000: ring detect int enabled\n"); +#endif + if (m_tlc_ringdetect == 1) + { +#ifdef TLC_LOG + logerror(" TLC int fired!\n"); +#endif + m_maincpu->set_input_line_and_vector(M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because tone detect was set + } + } + else // data&0x4000 == 0 + { +#ifdef TLC_LOG + logerror(" | 0x4000 = 0: ring detect int disabled\n"); +#endif + if (((data&0x40)!=0x40) || (m_tlc_tonedetect == 0)) // check to be sure we don't disable int if both ints fired at once + m_maincpu->set_input_line_and_vector(M68K_IRQ_4, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); // clear int because int is now disabled + } +} + +READ16_MEMBER(dectalk_state::m68k_tlc_dtmf_r)// dtmf chip read +{ +#ifdef TLC_LOG + UINT16 data = 0xFFFF; + data = m_tlc_dtmf&0xF; + logerror("m68k: TLC dtmf detector read, returning data = %02X", data); +#endif + return 0; +} +/* End 68k i/o handlers */ + +/* Begin tms32010 i/o handlers */ +WRITE16_MEMBER(dectalk_state::spc_latch_outfifo_error_stats)// latch 74ls74 @ E64 upper and lower halves with d0 and 1 respectively +{ +#ifdef USE_LOOSE_TIMING + machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(25)); +#endif +#ifdef SPC_LOG_DSP + logerror("dsp: set fifo semaphore and set error status = %01X\n",data&1); +#endif + dectalk_semaphore_w((~m_simulate_outfifo_error)&1); // always set to 1 here, unless outfifo desync-between-the-three-parallel-fifo-chips error occurs. + m_spc_error_latch = (data&1); // latch the dsp 'soft error' state aka "ERROR DETECTED D5 H" on schematics (different from the outfifo error state above!) +} + +READ16_MEMBER(dectalk_state::spc_infifo_data_r) +{ + UINT16 data = 0xFFFF; + data = m_infifo[m_infifo_tail_ptr]; +#ifdef SPC_LOG_DSP + logerror("dsp: SPC infifo read with data = %04X, fifo head: %02X; fifo tail was: %02X\n",data, m_infifo_head_ptr, m_infifo_tail_ptr); +#endif + // if fifo is empty (tail ptr == head ptr), do not increment the tail ptr, otherwise do. + if (m_infifo_count > 0) + { + m_infifo_tail_ptr++; + m_infifo_count--; + } + m_infifo_tail_ptr&=0x1F; + return data; +} + +WRITE16_MEMBER(dectalk_state::spc_outfifo_data_w) +{ + // the low 4 data bits are thrown out on the real unit due to use of a 12 bit dac (and to save use of another 16x4 fifo chip), though technically they're probably valid, and with suitable hacking a dtc-01 could probably output full 16 bit samples at 10khz. +#ifdef SPC_LOG_DSP + logerror("dsp: SPC outfifo write, data = %04X, fifo head was: %02X; fifo tail: %02X\n", data, m_outfifo_head_ptr, m_outfifo_tail_ptr); +#endif + m_dsp->set_input_line(0, CLEAR_LINE); //TMS32010 INT (cleared because LDCK inverts the IR line, clearing int on any outfifo write... for a moment at least.) + // if fifo is full (head ptr = tail ptr-1), do not increment the head ptr and do not store the data + if (m_outfifo_count == 16) + { +#ifdef SPC_LOG_DSP + logerror("outfifo was full, write ignored!\n"); +#endif + return; + } + m_outfifo[m_outfifo_head_ptr] = data; + m_outfifo_head_ptr++; + m_outfifo_count++; + m_outfifo_head_ptr&=0xF; + //dectalk_outfifo_check(); // outfifo check should only be done in the audio 10khz polling function +} + +READ16_MEMBER(dectalk_state::spc_semaphore_r)// Return state of d-latch 74ls74 @ E64 'lower half' in d0 which indicates whether infifo is readable +{ +#ifdef SPC_LOG_DSP + //logerror("dsp: read infifo semaphore, returned %d\n", m_infifo_semaphore); // commented due to extreme annoyance factor + if (!m_infifo_semaphore) logerror("dsp: read infifo semaphore, returned %d\n", m_infifo_semaphore); +#endif + return m_infifo_semaphore; +} +/* end tms32010 i/o handlers */ + + +/****************************************************************************** + Address Maps +******************************************************************************/ +/* +Address maps (x = ignored; * = selects address within this range) +68k address map: +a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 (a0 via UDS/LDS) +0 x x x 0 x * * * * * * * * * * * * * * * * * * R ROM +0 x x x 1 x x 0 * * * * * * * * * * * * * * * * RW RAM (first 4 chip pairs) +0 x x x 1 x x 1 0 0 * * * * * * * * * * * * * * RW RAM (last chip pair) +0 x x x 1 x x 1 0 1 x x x x x x x x x x x x x 0 W Status LED +0 x x x 1 x x 1 0 1 x x x x 0 * * * * * * * * 1 RW NVRAM (read/write volatile ram, does not store to eeprom) +0 x x x 1 x x 1 0 1 x x x x 1 * * * * * * * * 1 RW NVRAM (all reads do /recall from eeprom, all writes do /store to eeprom) +0 x x x 1 x x 1 1 0 x x x x x x x x x * * * * x RW DUART (keep in mind that a0 is not connected) +0 x x x 1 x x 1 1 1 x x x x x x x x x x x 0 0 * RW SPC flags: fifo writable (readonly, d7), spc irq suppress (readwrite, d6), fifo error status (readonly, d5), 'fifo release'/clear-tms-fifo-error-status-bits (writeonly, d1), speech initialize/clear (readwrite, d0) [see schematic sheet 4] +0 x x x 1 x x 1 1 1 x x x x x x x x x x x 0 1 0? W SPC fifo write (clocks fifo) +0 x x x 1 x x 1 1 1 x x x x x x x x x x x 1 0 * RW TLC flags: ring detect (readonly, d15), ring detected irq enable (readwrite, d14), answer phone (readwrite, d8), tone detected (readonly, d7), tone detected irq enable (readwrite, d6) [see schematic sheet 6] +0 x x x 1 x x 1 1 1 x x x x x x x x x x x 1 1 * R TLC tone chip read, reads on bits d0-d7 only, d4-d7 are tied low; d15-d8 are probably open bus + | | | | | +*/ + +static ADDRESS_MAP_START(m68k_mem, AS_PROGRAM, 16, dectalk_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_MIRROR(0x740000) /* ROM */ + AM_RANGE(0x080000, 0x093fff) AM_RAM AM_MIRROR(0x760000) /* RAM */ + AM_RANGE(0x094000, 0x0943ff) AM_WRITE8(led_write, 0x00FF) AM_MIRROR(0x763C00) /* LED array */ + AM_RANGE(0x094000, 0x0941ff) AM_DEVREADWRITE8("x2212", x2212_device, read, write, 0xFF00) AM_MIRROR(0x763C00) /* Xicor X2212 NVRAM */ + AM_RANGE(0x094200, 0x0943ff) AM_READWRITE8(nvram_recall, nvram_store, 0xFF00) AM_MIRROR(0x763C00) /* Xicor X2212 NVRAM */ + AM_RANGE(0x098000, 0x09801f) AM_DEVREADWRITE8("duartn68681", mc68681_device, read, write, 0xff ) AM_MIRROR(0x763FE0) /* DUART */ + AM_RANGE(0x09C000, 0x09C001) AM_READWRITE(m68k_spcflags_r, m68k_spcflags_w) AM_MIRROR(0x763FF8) /* SPC flags reg */ + AM_RANGE(0x09C002, 0x09C003) AM_WRITE(m68k_infifo_w) AM_MIRROR(0x763FF8) /* SPC fifo reg */ + AM_RANGE(0x09C004, 0x09C005) AM_READWRITE(m68k_tlcflags_r, m68k_tlcflags_w) AM_MIRROR(0x763FF8) /* telephone status flags */ + AM_RANGE(0x09C006, 0x09C007) AM_READ(m68k_tlc_dtmf_r) AM_MIRROR(0x763FF8) /* telephone dtmf read */ +ADDRESS_MAP_END + +// do we even need this below? +static ADDRESS_MAP_START(m68k_io, AS_IO, 16, dectalk_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tms32010_mem, AS_PROGRAM, 16, dectalk_state ) + AM_RANGE(0x000, 0x7ff) AM_ROM /* ROM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tms32010_io, AS_IO, 16, dectalk_state ) + AM_RANGE(0, 0) AM_WRITE(spc_latch_outfifo_error_stats) // *set* the outfifo_status_r semaphore, and also latch the error bit at D0. + AM_RANGE(1, 1) AM_READWRITE(spc_infifo_data_r, spc_outfifo_data_w) //read from input fifo, write to sound fifo + AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ(spc_semaphore_r) //read infifo-has-data-in-it fifo readable status + //AM_RANGE(8, 8) //the newer firmware seems to want something mapped here? +ADDRESS_MAP_END + +/****************************************************************************** + Input Ports +******************************************************************************/ +static INPUT_PORTS_START( dectalk ) +PORT_START("duart_in") // IP4, IP5, IP6 bits on duart are dipswitches (really unsoldered holes in the pcb where jumper wires can be soldered or shorted over) + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // these bits are dealt with elsewhere + PORT_DIPNAME( 0x10, 0x00, "Skip Self Test (IP4)" ) + PORT_DIPSETTING( 0x10, "Open (VCC)" ) + PORT_DIPSETTING( 0x00, "Short to GND" ) + PORT_DIPNAME( 0x20, 0x20, "Unknown (IP5)" ) + PORT_DIPSETTING( 0x20, "Open (VCC)" ) + PORT_DIPSETTING( 0x00, "Short to GND" ) + PORT_DIPNAME( 0x40, 0x40, "Unknown (IP6)" ) + PORT_DIPSETTING( 0x40, "Open (VCC)" ) + PORT_DIPSETTING( 0x00, "Short to GND" ) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // this pin (IP7) doesn't actually exist as a pin at all, reads as 1 + +PORT_START("hacks") + PORT_CONFNAME( 0x01, 0x01, "Hack to prevent hang when skip self test is shorted" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + +INPUT_PORTS_END + +/****************************************************************************** + Machine Drivers +******************************************************************************/ +void dectalk_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_OUTFIFO_READ: + outfifo_read_cb(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in dectalk_state::device_timer"); + } +} + +TIMER_CALLBACK_MEMBER(dectalk_state::outfifo_read_cb) +{ + UINT16 data; + data = dectalk_outfifo_r(); +#ifdef VERBOSE + if (data!= 0x8000) logerror("sample output: %04X\n", data); +#endif + timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ); + m_dac->write_signed16(data); + // hack for break key, requires hacked up duart core so disabled for now + // also it doesn't work well, the setup menu is badly corrupt + /*device_t *duart = machine().device("duartn68681"); + if (machine.input().code_pressed(KEYCODE_F1)) + duart68681_rx_break(duart, 1, 1); + else + duart68681_rx_break(duart, 1, 0);*/ +} + +/* Driver init: stuff that needs setting up which isn't directly affected by reset */ +DRIVER_INIT_MEMBER(dectalk_state,dectalk) +{ + dectalk_clear_all_fifos(); + m_simulate_outfifo_error = 0; + timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ); +} + +static MACHINE_CONFIG_START( dectalk, dectalk_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* E74 20MHz OSC (/2) */ + MCFG_CPU_PROGRAM_MAP(m68k_mem) + MCFG_CPU_IO_MAP(m68k_io) + MCFG_MC68681_ADD( "duartn68681", XTAL_3_6864MHz ) /* 2681 duart (not 68681!); Y3 3.6864MHz Xtal */ + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_irq_handler)) + MCFG_MC68681_A_TX_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_txa)) + MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_MC68681_INPORT_CALLBACK(READ8(dectalk_state, dectalk_duart_input)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(dectalk_state, dectalk_duart_output)) + + MCFG_CPU_ADD("dsp", TMS32010, XTAL_20MHz) /* Y1 20MHz xtal */ + MCFG_CPU_PROGRAM_MAP(tms32010_mem) + MCFG_CPU_IO_MAP(tms32010_io) +#ifdef USE_LOOSE_TIMING + MCFG_QUANTUM_TIME(attotime::from_hz(100)) +#else + MCFG_QUANTUM_PERFECT_CPU("dsp") +#endif + + MCFG_X2212_ADD("x2212") + + /* video hardware */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) /* E88 10KHz OSC, handled by timer */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.9) + + /* Y2 is a 3.579545 MHz xtal for the dtmf decoder chip */ + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duartn68681", mc68681_device, rx_b_w)) +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START( dectalk ) + ROM_REGION16_BE(0x40000,"maincpu", 0) + // DECtalk DTC-01 firmware v2.0 (first half: 23Jul84 tag; second half: 02Jul84 tag), all roms are 27128 eproms + // technically the correct rom names are 23-123e5.e8, etc, but the chips they were dumped from were NOT labeled that way + // labels were SP8510123E5 etc, which means the chips were burned at dec in week 10, 1985 + /* the labels dec uses for most non-factory-programmed eproms, proms and pals is something like SPddddnnnto or WBddddnnto + * where: + * SP or WB = ? + * dddd is a 4 digit datecode with yyww (i.e. 8510 = week 10, 1985) + * nnn = the dec internal rom number for that type + * t = programmable chip type (e = eprom, otprom or mask rom; a,b,f = proms of various sorts; there are others for plas and pals) + * o = size of rom + * for eproms/otproms or mask roms it is: e1 = 0x400, e2 = 0x800, e3 = 0x1000, e4 = 0x2000, e5 = 0x4000, e6 = 0x8000, etc) + * for proms it is: a1 = 82s123(0x20, 8b TS); a2 = 82s129(0x100 4b TS); a9 = 82s131(0x200 4b TS); b1 = 82s135(0x100 8b TS); f1 = 82s137(0x400 4b TS); f4 = 82s191(0x800 8b TS); s0 = MC68HC05; m2 = i8051 or other MCS-51; (there are more) + */ + ROM_SYSTEM_BIOS( 0, "v20", "DTC-01 Version 2.0") + ROMX_LOAD("23-123e5.e8", 0x00000, 0x4000, CRC(03e1eefa) SHA1(e586de03e113683c2534fca1f3f40ba391193044), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510123E5" @ E8 + ROMX_LOAD("23-119e5.e22", 0x00001, 0x4000, CRC(af20411f) SHA1(7954bb56b7591f8954403a22d34de31c7d5441ac), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510119E5" @ E22 + ROMX_LOAD("23-124e5.e7", 0x08000, 0x4000, CRC(9edeafcb) SHA1(7724babf4ae5d77c0b4200f608d599058d04b25c), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510124E5" @ E7 + ROMX_LOAD("23-120e5.e21", 0x08001, 0x4000, CRC(f2a346a6) SHA1(af5e4ea0b3631f7d6f16c22e86a33fa2cb520ee0), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510120E5" @ E21 + ROMX_LOAD("23-125e5.e6", 0x10000, 0x4000, CRC(1c0100d1) SHA1(1b60cd71dfa83408b17e13f683b6bf3198c905cc), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510125E5" @ E6 + ROMX_LOAD("23-121e5.e20", 0x10001, 0x4000, CRC(4cb081bd) SHA1(4ad0b00628a90085cd7c78a354256c39fd14db6c), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510121E5" @ E20 + ROMX_LOAD("23-126e5.e5", 0x18000, 0x4000, CRC(7823dedb) SHA1(e2b2415eec838ddd46094f2fea93fd289dd0caa2), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510126E5" @ E5 + ROMX_LOAD("23-122e5.e19", 0x18001, 0x4000, CRC(b86370e6) SHA1(92ab22a24484ad0d0f5c8a07347105509999f3ee), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510122E5" @ E19 + ROMX_LOAD("23-103e5.e4", 0x20000, 0x4000, CRC(35aac6b9) SHA1(b5aec0bf37a176ff4d66d6a10357715957662ebd), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510103E5" @ E4 + ROMX_LOAD("23-095e5.e18", 0x20001, 0x4000, CRC(2296fe39) SHA1(891f3a3b4ce75ef14001257bc8f1f60463a9a7cb), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510095E5" @ E18 + ROMX_LOAD("23-104e5.e3", 0x28000, 0x4000, CRC(9658b43c) SHA1(4d6808f67cbdd316df23adc8ddf701df57aa854a), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510104E5" @ E3 + ROMX_LOAD("23-096e5.e17", 0x28001, 0x4000, CRC(cf236077) SHA1(496c69e52cfa013173f7b9c500ce544a03ad01f7), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510096E5" @ E17 + ROMX_LOAD("23-105e5.e2", 0x30000, 0x4000, CRC(09cddd28) SHA1(de0c25687bab3ff0c88c98622092e0b58331aa16), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510105E5" @ E2 + ROMX_LOAD("23-097e5.e16", 0x30001, 0x4000, CRC(49434da1) SHA1(c450abae0ccf372d7eb87370b8a8c97a45e164d3), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510097E5" @ E16 + ROMX_LOAD("23-106e5.e1", 0x38000, 0x4000, CRC(a389ab31) SHA1(355348bfc96a04193136cdde3418366e6476c3ca), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510106E5" @ E1 + ROMX_LOAD("23-098e5.e15", 0x38001, 0x4000, CRC(3d8910e7) SHA1(01921e77b46c2d4845023605239c45ffa4a35872), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510098E5" @ E15 + + /* the undumped 2.0 (beta?) version likely has roms: + 23-091e5.e22, 23-092e5.e21, 23-093e5.e20, 23-094e5.e19, + 23-099e5.e8, 23-100e5.e7, 23-101e5.e6, 23-102e5.e5 + and shares the 23-103e5 thru 106e5, and 095e5 thru 098e5 roms with + the 2.0 version above + */ + + // DECtalk DTC-01 firmware v1.8 (first half: 05Dec83 tag; second half: 11Oct83 tag), all roms are 27128 eproms + ROM_SYSTEM_BIOS( 1, "v18", "DTC-01 Version 1.8") + ROMX_LOAD("23-063e5.e8", 0x00000, 0x4000, CRC(9f5ca045) SHA1(1b1b9c1e092c44329b385fb04001e13422eb8d39), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-059e5.e22", 0x00001, 0x4000, CRC(b299cf64) SHA1(84bbe9ff303ea6ce7b1c0b1ad05421edd18fae49), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-064e5.e7", 0x08000, 0x4000, CRC(e4ff20f4) SHA1(fdd91e4d2ef92608a08b2e78b6108e31ff53a1f9), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-060e5.e21", 0x08001, 0x4000, CRC(213c65ba) SHA1(c95662d0d40499af01cdc23f05936762ab54081a), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-065e5.e6", 0x10000, 0x4000, CRC(38ea0c75) SHA1(232b622cef6d69a493db1ed02e5236235c68daba), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-061e5.e20", 0x10001, 0x4000, CRC(44f6fe5c) SHA1(81daa4abae273c7f0aead902b5c3c842f7e7f116), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-066e5.e5", 0x18000, 0x4000, CRC(957aa8cf) SHA1(5f9f916b99867d1adbafd58d411feb630f6e4b6d), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-062e5.e19", 0x18001, 0x4000, CRC(10ab969c) SHA1(46ee22a295b8709b6f829751aca5f92e4f459a9f), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-032e5.e4", 0x20000, 0x4000, CRC(0f805e3a) SHA1(1d8008e30a448358224364fd8237dbb08907b219), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-031e5.e18", 0x20001, 0x4000, CRC(846b5b68) SHA1(55c759b3fb927d2dfc9d77e8e080748866bea854), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-034e5.e3", 0x28000, 0x4000, CRC(90700738) SHA1(738337c5b6acd3f30c3c4be2457370d2ce9313f9), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-033e5.e17", 0x28001, 0x4000, CRC(48756a4d) SHA1(5946ccd367d88a484bb1549d0cc990b9b7d88f0c), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-036e5.e2", 0x30000, 0x4000, CRC(5c2d4f73) SHA1(30f95e5383c4f71bc700346e2d49e8ad70b94c8c), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-035e5.e16", 0x30001, 0x4000, CRC(80116443) SHA1(7b3b68e61b421dedaad88b5600c739943a316c9e), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-038e5.e1", 0x38000, 0x4000, CRC(c840493f) SHA1(abd6af442690e981a9089f19febffc8f3fb52717), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("23-037e5.e15", 0x38001, 0x4000, CRC(d62ab309) SHA1(a743a23625feadf6e46ef889e2bb04af88589992), ROM_SKIP(1) | ROM_BIOS(2)) + + ROM_REGION(0x2000,"dsp", 0) + // NEWER/final? firmware 'later 2.0'; this firmware DOES WORK. + // this firmware seems to have some leftover test garbage mapped into its space, which is not present on the dtc-01 board + // it writes 0x0000 to 0x90 on start + // it writes a sequence of values to 0xFF down to 0xE9 + // it wants something readable mapped at 0x08 or else it waits for an interrupt + // Is this the same firmware as on the tms320P15 on the dtc-07 or a backported variant of such? + ROM_LOAD16_BYTE("23-410f4.e70", 0x000, 0x800, CRC(121e2ec3) SHA1(3fabe018d0e0b478093951cb20501853358faa18)) + ROM_LOAD16_BYTE("23-409f4.e69", 0x001, 0x800, CRC(61f67c79) SHA1(9a13426c92f879f2953f180f805990a91c37ac43)) + // DECtalk DTC-01 'klsyn' tms32010 firmware 'earlier 2.0', both proms are 82s191 equivalent; this firmware DOES WORK. + ROM_LOAD16_BYTE("23-205f4.e70", 0x000, 0x800, CRC(ed76a3ad) SHA1(3136bae243ef48721e21c66fde70dab5fc3c21d0)) // Label: "LM8506205F4 // M1-76161-5" @ E70 + ROM_LOAD16_BYTE("23-204f4.e69", 0x001, 0x800, CRC(79bb54ff) SHA1(9409f90f7a397b041e4440341f2d7934cb479285)) // Label: "LM8504204F4 // 78S191" @ E69 + // older dsp firmware from dectalk firmware 1.8; this firmware DOES WORK, and even works with 2.0 dectalk firmware! its a bit quieter than the others, though. + ROM_LOAD16_BYTE("23-166f4.e70", 0x000, 0x800, CRC(2d036ffc) SHA1(e8c25ca092dde2dc0aec73921af806026bdfbbc3)) // HM1-76161-5 + ROM_LOAD16_BYTE("23-165f4.e69", 0x001, 0x800, CRC(a3019ca4) SHA1(249f269c38f7f44edb6d025bcc867c8ca0de3e9c)) // HM1-76161-5 + + // TODO: load this as default if the nvram file is missing, OR get the setup page working enough that it can be saved properly to the chip from an NVR FAULT state! + // NOTE: this nvram image is ONLY VALID for v2.0; v1.8 expects a different image. + ROM_REGION(0x100,"nvram", 0) // default nvram image is at 0x1A7AE in main rom, read lsn first so 0x0005 in rom becomes 05 00 00 00 etc for all words of main rom + ROM_FILL(0x00, 0xff, 0x00) // blank it first; + ROM_FILL(0x00, 0x01, 0x05) + ROM_FILL(0x04, 0x01, 0x00) + ROM_FILL(0x08, 0x01, 0x06) + ROM_FILL(0x0C, 0x01, 0x01) + ROM_FILL(0x10, 0x01, 0x06) + ROM_FILL(0x14, 0x01, 0x0B) + ROM_FILL(0x18, 0x01, 0x02) + ROM_FILL(0x1C, 0x01, 0x02) + ROM_FILL(0x20, 0x01, 0x01) + ROM_FILL(0x24, 0x01, 0x01) + ROM_FILL(0x28, 0x01, 0x00) + ROM_FILL(0x2C, 0x01, 0x01) + ROM_FILL(0xFC, 0x01, 0x0D) // checksum, calculated some weird way which I haven't figured out yet + ROM_FILL(0xFD, 0x01, 0x02) // " + ROM_FILL(0xFE, 0x01, 0x05) // " + ROM_FILL(0xFF, 0x01, 0x0B) // " + +ROM_END + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, dectalk, 0, 0, dectalk, dectalk, dectalk_state, dectalk, "Digital Equipment Corporation", "DECtalk DTC-01", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/decwritr.c b/src/mame/drivers/decwritr.c new file mode 100644 index 00000000000..35d54c74e8e --- /dev/null +++ b/src/mame/drivers/decwritr.c @@ -0,0 +1,386 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/************************************************************************* + + decwritr.c + Digital Equipment Corporation + DECwriter III (LA120) Teletype/Teleprinter, 1978 + +**************************************************************************/ + +#include "emu.h" +#include "render.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8251.h" +#include "sound/beep.h" + +#define KBD_VERBOSE 1 +#define LED_VERBOSE 1 + +//************************************************************************** +// DRIVER STATE +//************************************************************************** + +class decwriter_state : public driver_device +{ +public: + // constructor + decwriter_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "beeper"), + m_uart(*this, "i8251") + { + } + required_device m_maincpu; + required_device m_speaker; + required_device m_uart; + //required_device m_terminal; + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) + { + bitmap.fill(rgb_t::black); + return 0; + } + DECLARE_READ8_MEMBER(la120_KBD_r); + DECLARE_WRITE8_MEMBER(la120_LED_w); + DECLARE_READ8_MEMBER(la120_NVR_r); + DECLARE_WRITE8_MEMBER(la120_NVR_w); + DECLARE_READ8_MEMBER(la120_DC305_r); + DECLARE_WRITE8_MEMBER(la120_DC305_w); +private: + virtual void machine_start(); + //virtual void machine_reset(); + ioport_port* m_col_array[16]; + UINT8 m_led_array; + UINT8 m_led_7seg_counter; + UINT8 m_led_7seg[4]; +}; + +READ8_MEMBER( decwriter_state::la120_KBD_r ) +{ + /* for reading the keyboard array, addr bits 5-11 are ignored. + * a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 + * 0 0 1 1 x x x x x x x * * * * * + * | | \---\---\--- column select + * | \--------------- kbd_banksel0 + * \------------------- kbd_banksel1 + * if both banks are selected, the resulting row read is a binary OR of both (LA120-TM1, page 4-5) + * + * d7 d6 d5 d4 d3 d2 d1 d0 + * \--\--\--\--\--\--\--\-- read from rows + */ + UINT8 code = 0; + if (offset&0x8) code |= m_col_array[offset&0x7]->read(); + if (offset&0x10) code |= m_col_array[(offset&0x7)+8]->read(); +#ifdef KBD_VERBOSE + logerror("Keyboard column %X read, returning %02X\n", offset&0xF, code); +#endif + return code; +} + +WRITE8_MEMBER( decwriter_state::la120_LED_w ) +{ + /* for writing the keyboard array, addr bits 5-11 are ignored. + * a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 + * 0 0 1 1 x x x x x x x 0 * * * 0 turn OFF LED # and clear 7seg counter + * 0 0 1 1 x x x x x x x 0 * * * 1 turn ON LED # and clear 7seg counter + * 0 0 1 1 x x x x x x x 1 * * * * display a digit in the digit pointed to by 7seg counter and increment counter + * data bus is UNUSED. + */ + if (!(offset&0x10)) // we're updating an led state + { +#ifdef LED_VERBOSE + logerror("Updated LED status array: LED #%d is now %d\n", ((offset&0xe)>>1), (offset&1)); +#endif + m_led_array &= ((1<<((offset&0xe)>>1))^0xFF); // mask out the old bit + m_led_array |= ((offset&1)<<((offset&0xe)>>1)); // OR in the new bit + m_led_7seg_counter = 0; + } + else // we're updating the 7segment display + { + m_led_7seg_counter++; + m_led_7seg_counter &= 0xF; +#ifdef LED_VERBOSE + logerror("Updated 7seg display: displaying a digit of %d in position %d\n", (offset&0xF)^0xF, m_led_7seg_counter-1); +#endif + if ((m_led_7seg_counter >= 1) && (m_led_7seg_counter <= 4)) + { + m_led_7seg[m_led_7seg_counter-1] = (offset&0xF)^0xF; + } + } +#ifdef LED_VERBOSE + logerror("LEDs: %c %c %c %c : %s %s %s %s %s %s %s %s\n", + m_led_7seg[3]+0x30, m_led_7seg[2]+0x30, m_led_7seg[1]+0x30, m_led_7seg[0]+0x30, + (m_led_array&0x80)?"ON LINE":"-------", + (m_led_array&0x40)?"LOCAL":"-----", + (m_led_array&0x20)?"ALT CHR SET":"-----------", + (m_led_array&0x10)?"":"-----", + (m_led_array&0x8)?"CTS":"---", + (m_led_array&0x4)?"DSR":"---", + (m_led_array&0x2)?"SET-UP":"------", + (m_led_array&0x1)?"PAPER OUT":"---------" ); +#endif +} + +READ8_MEMBER( decwriter_state::la120_NVR_r ) +{ + return 0xFF; +} + +WRITE8_MEMBER( decwriter_state::la120_NVR_w ) +{ +} +READ8_MEMBER( decwriter_state::la120_DC305_r ) +{ + return 0xFF; +} +WRITE8_MEMBER( decwriter_state::la120_DC305_w ) +{ +} + +static ADDRESS_MAP_START(la120_mem, AS_PROGRAM, 8, decwriter_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x2fff ) AM_ROM + AM_RANGE( 0x3000, 0x3fff ) AM_READWRITE(la120_KBD_r, la120_LED_w) // keyboard read, write to status and 7seg LEDS + AM_RANGE( 0x4000, 0x43ff ) AM_MIRROR(0x0c00) AM_RAM // 1k 'low ram' + AM_RANGE( 0x5000, 0x53ff ) AM_MIRROR(0x0c00) AM_RAM // 1k 'high ram' + AM_RANGE( 0x6000, 0x6fff ) AM_MIRROR(0x08fe) AM_READWRITE(la120_NVR_r, la120_NVR_w) // ER1400 EAROM + AM_RANGE( 0x7000, 0x7003 ) AM_MIRROR(0x0ffc) AM_READWRITE(la120_DC305_r, la120_DC305_w) // DC305 printer controller ASIC stuff + // 8000-ffff is reserved for expansion (i.e. unused, open bus); since this can generate interrupts this needs to be split to its own device. +ADDRESS_MAP_END + +/* + * 8080 IO address map (x = ignored; * = selects address within this range) + * (a15 to a8 are latched the same value as a7-a0 on the 8080 and 8085) + a7 a6 a5 a4 a3 a2 a1 a0 + 0 x x x x x 0 0 RW 8251 Data + 0 x x x x x 0 1 RW 8251 Status/Control + 0 x x x x x 1 x RW Flags Read/Write + 1 x x x x x x x RW Expansion (Open bus) + */ +static ADDRESS_MAP_START(la120_io, AS_IO, 8, decwriter_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_MIRROR(0x7C) AM_DEVREADWRITE("i8251", i8251_device, data_r, data_w) // 8251 Data + AM_RANGE(0x01, 0x01) AM_MIRROR(0x7C) AM_DEVREADWRITE("i8251", i8251_device, status_r, control_w) // 8251 Status/Control + //AM_RANGE(0x02, 0x02) AM_MIRROR(0x7D) // other io ports + // 0x80-0xff are reserved for expansion (i.e. unused, open bus) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( la120 ) + PORT_START("COL0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Local LF") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_START("COL1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Local FF") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(127) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // this is actually the cover open interlock sensor + PORT_START("COL2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HERE IS") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(alternate) Opt LF") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // this is actually the paper out interlock sensor + PORT_START("COL3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_LALT) PORT_CHAR(10) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LINE LOCAL") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("COL4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_TOGGLE PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK) // TODO: does the physical switch toggle? + PORT_START("COL5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_START("COL6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("COL7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Set Up") PORT_CODE(KEYCODE_F5) + PORT_START("COL8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLA") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLB") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLC") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLD") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLE") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLF") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) // this is actually the RO flag + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("View") PORT_CODE(KEYCODE_LWIN) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +void decwriter_state::machine_start() +{ + m_speaker->set_frequency(786); // TODO: LA120 speaker is controlled by asic; VT100 has: 7.945us per serial clock = ~125865.324hz, / 160 clocks per char = ~ 786 hz +#if 0 + output_set_value("online_led",1); + output_set_value("local_led", 0); + output_set_value("noscroll_led",1); + output_set_value("basic_led", 1); + output_set_value("hardcopy_led", 1); + output_set_value("l1_led", 1); + output_set_value("l2_led", 1); +#endif + char kbdcol[8]; + // look up all 16 tags 'the slow way' but only once on reset + for (int i = 0; i < 16; i++) + { + sprintf(kbdcol,"COL%X", i); + m_col_array[i] = ioport(kbdcol); + } + m_led_array = 0; + m_led_7seg_counter = 0; + m_led_7seg[0] = m_led_7seg[1] = m_led_7seg[2] = m_led_7seg[3] = 0xF; +} + +/* +void decwriter_state::machine_reset() +{ +} +*/ + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static MACHINE_CONFIG_START( la120, decwriter_state ) + + MCFG_CPU_ADD("maincpu",I8080, XTAL_18MHz / 9) // 18Mhz xtal on schematics, using an i8224 clock divider/reset sanitizer IC + MCFG_CPU_PROGRAM_MAP(la120_mem) + MCFG_CPU_IO_MAP(la120_io) + + /* video hardware */ + //TODO: no actual screen! has 8 leds above the keyboard (similar to vt100/vk100) and has 4 7segment leds for showing an error code. + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(decwriter_state, screen_update) + MCFG_SCREEN_SIZE(640,480) + MCFG_SCREEN_VISIBLE_AREA(0,639, 0,479) + MCFG_SCREEN_REFRESH_RATE(30) + + //MCFG_DEFAULT_LAYOUT( layout_la120 ) + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* i8251 */ + MCFG_DEVICE_ADD("i8251", I8251, 0) + /* + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_dsr)) + + MCFG_DEVICE_ADD(COM5016T_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxc)) + MCFG_COM8116_FT_HANDLER(DEVWRITELINE("i8251", i8251_device, write_txc)) + */ +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( la120 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // later romset, with 23-003e2.e6, 23-004e2.e8, 23-005e2.e12, 23-006e2.e17 replaced by one rom, 23-038e4.e6 which may be a concatenation of the old roms, unclear. + ROM_LOAD( "23-038e4-00.e6", 0x0000, 0x2000, CRC(cad4eb09) SHA1(d5db117da363d36817476F906251ea4ee1cb14b8)) + ROM_LOAD( "23-007e2-00.e4", 0x2000, 0x0800, CRC(41eaebf1) SHA1(c7d05417b24b853280d1636776d399a0aea34720)) // used by both earlier and later romset + // there is an optional 3 roms, european and APL (and BOTH) rom which goes from 2000-2fff in e4, all undumped. + // there is another romset used on the Bell Teleprinter 1000 (Model LAS12) which I believe is 23-004e4.e6 and 23-086e2.e4 +ROM_END + + +//************************************************************************** +// DRIVERS +//************************************************************************** +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, la120, 0, 0, la120, la120, driver_device, 0, "Digital Equipment Corporation", "DECwriter III (LA120)", MACHINE_NO_SOUND | MACHINE_IS_SKELETON | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/dgn_beta.c b/src/mame/drivers/dgn_beta.c new file mode 100644 index 00000000000..a06be61dd1e --- /dev/null +++ b/src/mame/drivers/dgn_beta.c @@ -0,0 +1,413 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + drivers/dgn_beta.c + + Dragon Beta prototype, based on two 68B09E processors, WD2797, 6845. + +Project Beta was the second machine that Dragon Data had in development at +the time they ceased trading, the first being Project Alpha (also know as the +Dragon Professional). + +The machine uses dual 68B09 CPUs which both sit on the same bus and access +the same memory and IO chips ! The first is the main processor, used to run +user code, the second is uses as a DMA controller to amongst other things +disk data transfers. The first processor controlled the second by having the +halt and nmi lines from the second CPU connected to PIA output lines so +that the could be changed under OS control. The first CPU just passed +instructions for the block to be transferred in 5 low ram addresses and +generated an NMI on the second CPU. + +Project Beta like the other Dragons used a WD2797 floppy disk controller +which is memory mapped, and controlled by the second CPU. + +Unlike the other Dragon machines, project Beta used a 68b45 to generate video, +and totally did away with the SAM. + +The machine has a 6551 ACIA chip, but I have not yet found where this is +memory mapped. + +Project Beta, had a custom MMU built from a combination of LSTTL logic, and +PAL programmable logic. This MMU could address 256 blocks of 4K, giving a +total addressable range of 1 megabyte, of this the first 768KB could be RAM, +however the machine by default, came with 256K or ram, and a 16K boot ROM, +which contained an OS-9 Level 2 bootstrap. + +A lot of the information required to start work on this driver has been +inferred from disassembly of the boot ROM, and from what little hardware +documentation still exists. + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/6821pia.h" +#include "includes/dgn_beta.h" +#include "machine/mos6551.h" +#include "formats/vdk_dsk.h" +#include "formats/dmk_dsk.h" +#include "imagedev/flopdrv.h" +#include "machine/ram.h" +#include "video/mc6845.h" + + +/* + Colour codes are as below acording to os-9 headers, however the presise values + may not be quite correct, also this will need changing as the pallate seems to + be controled by a 4x4bit register file in the video hardware + The text video ram seems to be aranged of words of character, attribute + The colour codes are stored in the attribute byte along with : + Underline bit $40 + Flash bit $80 + +These are yet to be implemented. + +*/ + +static const unsigned char dgnbeta_palette[] = +{ + /*normal brightness */ + 0x00,0x00,0x00, /* black */ + 0x80,0x00,0x00, /* red */ + 0x00,0x80,0x00, /* green */ + 0x80,0x80,0x00, /* yellow */ + 0x00,0x00,0x80, /* blue */ + 0x80,0x00,0x80, /* magenta */ + 0x00,0x80,0x80, /* cyan */ + 0x80,0x80,0x80, /* white */ + + /*enhanced brightness*/ + 0x00,0x00,0x00, /* black */ + 0xFF,0x00,0x00, /* red */ + 0x00,0xFF,0x00, /* green */ + 0xFF,0xFF,0x00, /* yellow */ + 0x00,0x00,0xFF, /* blue */ + 0xFF,0x00,0xFF, /* magenta */ + 0x00,0xFF,0xFF, /* cyan */ + 0xFF,0xFF,0xFF /* white */ +}; + +/* + 2005-05-10 + + I *THINK* I know how the memory paging works, the 64K memory map is devided + into 16x 4K pages, what is mapped into each page is controled by the IO at + FE00-FE0F like so :- + + Location Memory page Initialised to + $FE00 $0000-$0FFF $00 + $FE01 $1000-$1FFF $00 (used as ram test page, when sizing memory) + $FE02 $2000-$2FFF $00 + $FE03 $3000-$3FFF $00 + $FE04 $4000-$4FFF $00 + $FE05 $5000-$5FFF $00 + $FE06 $6000-$6FFF $1F ($1F000) + $FE07 $7000-$7FFF $00 + $FE08 $8000-$8FFF $00 + $FE09 $9000-$9FFF $00 + $FE0A $A000-$AFFF $00 + $FE0B $B000-$BFFF $00 + $FE0C $C000-$CFFF $00 + $FE0D $D000-$DFFF $00 + $FE0E $E000-$EFFF $FE + $FE0F $F000-$FFFF $FF + + The value stored at each location maps it's page to a 4K page within a 1M address + space. Acording to the Beta product descriptions released by Dragon Data, the + machine could have up to 768K of RAM, if this where true then pages $00-$BF could + potentially be RAM, and pages $C0-$FF would be ROM. The initialisation code maps in + the memory as described above. + + At reset time the Paging would of course be disabled, as the boot rom needs to be + mapped in at $C000, the initalisation code would set up the mappings above and then + enable the paging hardware. + + It appears to be more complicated than this, whilst the above is true, there appear to + be 16 sets of banking registers, the active set is controled by the bottom 4 bits of + FCC0, bit 6 has something to do with enabling and disabling banking. + + 2005-11-28 + + The value $C0 is guaranteed not to have any memory in it acording to the os9 headers, + quite how the MMU deals with this is still unknown to me. + + Bit 7 of $FCC0, sets maps in the system task which has fixed values for some pages, + the presise nature of this is yet to be descovered. + +*/ + +static ADDRESS_MAP_START( dgnbeta_map, AS_PROGRAM, 8, dgn_beta_state ) + AM_RANGE(0x0000, 0x0FFF) AM_RAMBANK("bank1") + AM_RANGE(0x1000, 0x1FFF) AM_RAMBANK("bank2") + AM_RANGE(0x2000, 0x2FFF) AM_RAMBANK("bank3") + AM_RANGE(0x3000, 0x3FFF) AM_RAMBANK("bank4") + AM_RANGE(0x4000, 0x4FFF) AM_RAMBANK("bank5") + AM_RANGE(0x5000, 0x5FFF) AM_RAMBANK("bank6") + AM_RANGE(0x6000, 0x6FFF) AM_RAMBANK("bank7") AM_SHARE("videoram") + AM_RANGE(0x7000, 0x7FFF) AM_RAMBANK("bank8") + AM_RANGE(0x8000, 0x8FFF) AM_RAMBANK("bank9") + AM_RANGE(0x9000, 0x9FFF) AM_RAMBANK("bank10") + AM_RANGE(0xA000, 0xAFFF) AM_RAMBANK("bank11") + AM_RANGE(0xB000, 0xBFFF) AM_RAMBANK("bank12") + AM_RANGE(0xC000, 0xCFFF) AM_RAMBANK("bank13") + AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK("bank14") + AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK("bank15") + AM_RANGE(0xF000, 0xFBFF) AM_RAMBANK("bank16") + AM_RANGE(0xfC00, 0xfC1F) AM_NOP + AM_RANGE(0xFC20, 0xFC23) AM_DEVREADWRITE(PIA_0_TAG, pia6821_device, read, write) + AM_RANGE(0xFC24, 0xFC27) AM_DEVREADWRITE(PIA_1_TAG, pia6821_device, read, write) + AM_RANGE(0xFC28, 0xfC7F) AM_NOP + AM_RANGE(0xfc80, 0xfc80) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0xfc81, 0xfc81) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0xfc82, 0xfC9F) AM_NOP + AM_RANGE(0xFCA0, 0xFCA3) AM_READNOP AM_WRITE(dgnbeta_colour_ram_w) /* 4x4bit colour ram for graphics modes */ + AM_RANGE(0xFCC0, 0xFCC3) AM_DEVREADWRITE(PIA_2_TAG, pia6821_device, read, write) + AM_RANGE(0xfcC4, 0xfcdf) AM_NOP + AM_RANGE(0xfce0, 0xfce3) AM_READWRITE(dgnbeta_wd2797_r ,dgnbeta_wd2797_w) /* Onboard disk interface */ + AM_RANGE(0xfce4, 0xfdff) AM_NOP + AM_RANGE(0xFE00, 0xFE0F) AM_READWRITE(dgn_beta_page_r ,dgn_beta_page_w) + AM_RANGE(0xfe10, 0xfEff) AM_NOP + AM_RANGE(0xFF00, 0xFFFF) AM_RAMBANK("bank17") + +ADDRESS_MAP_END + + + +static INPUT_PORTS_START( dgnbeta ) + PORT_START("KEY0") /* Key ROw 0 */ + /* Return shift if either shift key pressed */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + /* Return FuNction key, if either ALT key pressed */ + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + + + /* Set control on either CTRL key */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CapsLock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) + +/* PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) +*/ + + PORT_START("KEY1") /* Key row 2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) PORT_CHAR('b') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) PORT_CHAR('j') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) PORT_CHAR('i') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) PORT_CHAR('u') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) PORT_CHAR('h') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("KEY2") /* Key row 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) PORT_CHAR('n') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) PORT_CHAR('k') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) PORT_CHAR('o') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) PORT_CHAR('g') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + + PORT_START("KEY3") /* Key row 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) PORT_CHAR('m') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) PORT_CHAR('l') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) PORT_CHAR('p') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) PORT_CHAR('t') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) PORT_CHAR('f') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + + PORT_START("KEY4") /* Key row 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) PORT_CHAR('v') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) PORT_CHAR('d') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + + PORT_START("KEY5") /* Key row 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) PORT_CHAR('r') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) PORT_CHAR('s') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + + PORT_START("KEY6") /* Key row 7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) PORT_CHAR('c') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) PORT_CHAR('x') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("KEY7") /* Key row 8 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ASTERISK") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) PORT_CHAR('e') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + + PORT_START("KEY8") /* Key row 9 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) PORT_CHAR('w') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) PORT_CHAR('a') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + + PORT_START("KEY9") /* Key row 10 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_HASH") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('#') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOT_PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') + +INPUT_PORTS_END + + +PALETTE_INIT_MEMBER(dgn_beta_state, dgn) +{ + int i; + + for ( i = 0; i < sizeof(dgnbeta_palette) / 3; i++ ) { + palette.set_pen_color(i, dgnbeta_palette[i*3], dgnbeta_palette[i*3+1], dgnbeta_palette[i*3+2]); + } +} + +/* F4 Character Displayer */ +static const gfx_layout dgnbeta_charlayout = +{ + 8, 10, /* 8 x 10 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( dgnbeta ) + GFXDECODE_ENTRY( "gfx1", 0x0000, dgnbeta_charlayout, 0, 8 ) +GFXDECODE_END + +FLOPPY_FORMATS_MEMBER( dgn_beta_state::floppy_formats ) + FLOPPY_VDK_FORMAT, + FLOPPY_DMK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( dgn_beta_floppies ) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( dgnbeta, dgn_beta_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M6809E, DGNBETA_CPU_SPEED_HZ) /* 2 MHz */ + MCFG_CPU_PROGRAM_MAP(dgnbeta_map) + + /* both cpus in the beta share the same address/data busses */ + MCFG_CPU_ADD(DMACPU_TAG, M6809E, DGNBETA_CPU_SPEED_HZ) /* 2 MHz */ + MCFG_CPU_PROGRAM_MAP(dgnbeta_map) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(DGNBETA_FRAMES_PER_SECOND) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(100)) + MCFG_SCREEN_SIZE(700,550) + MCFG_SCREEN_VISIBLE_AREA(0, 699, 0, 549) + MCFG_SCREEN_UPDATE_DEVICE( "crtc", hd6845_device, screen_update ) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", dgnbeta) + MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(dgnbeta_palette) / 3) + MCFG_PALETTE_INIT_OWNER(dgn_beta_state, dgn) + + /* PIA 0 at $FC20-$FC23 I46 */ + MCFG_DEVICE_ADD(PIA_0_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(dgn_beta_state,d_pia0_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(dgn_beta_state,d_pia0_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(dgn_beta_state,d_pia0_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(dgn_beta_state,d_pia0_pb_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(dgn_beta_state,d_pia0_cb2_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(dgn_beta_state,d_pia0_irq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(dgn_beta_state,d_pia0_irq_b)) + + /* PIA 1 at $FC24-$FC27 I63 */ + MCFG_DEVICE_ADD(PIA_1_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(dgn_beta_state,d_pia1_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(dgn_beta_state,d_pia1_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(dgn_beta_state,d_pia1_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(dgn_beta_state,d_pia1_pb_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(dgn_beta_state,d_pia1_irq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(dgn_beta_state,d_pia1_irq_b)) + + /* PIA 2 at FCC0-FCC3 I28 */ + /* This seems to control the RAM paging system, and have the DRQ */ + /* from the WD2797 */ + MCFG_DEVICE_ADD(PIA_2_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(dgn_beta_state,d_pia2_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(dgn_beta_state,d_pia2_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(dgn_beta_state,d_pia2_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(dgn_beta_state,d_pia2_pb_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(dgn_beta_state,d_pia2_irq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(dgn_beta_state,d_pia2_irq_b)) + + MCFG_WD2797_ADD(FDC_TAG, XTAL_1MHz) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(dgn_beta_state, dgnbeta_fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dgn_beta_state, dgnbeta_fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", dgn_beta_floppies, "qd", dgn_beta_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", dgn_beta_floppies, "qd", dgn_beta_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":2", dgn_beta_floppies, "qd", dgn_beta_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":3", dgn_beta_floppies, "qd", dgn_beta_state::floppy_formats) + + MCFG_MC6845_ADD("crtc", HD6845, "screen", XTAL_12_288MHz / 16) //XTAL is guessed + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(16) /*?*/ + MCFG_MC6845_UPDATE_ROW_CB(dgn_beta_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(dgn_beta_state, dgnbeta_vsync_changed)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + MCFG_RAM_EXTRA_OPTIONS("128K,384K,512K,640K,768K") + /* Ram size can now be configured, since the machine was known as either the Dragon Beta or */ + /* the Dragon 128, I have added a config for 128K, however, the only working machine known */ + /* to exist was fitted with 256K, so I have made this the default. Also available */ + /* documentation seems to sugest a maximum of 768K, so I have included configs increasing */ + /* in blocks of 128K up to this maximum. */ +MACHINE_CONFIG_END + +ROM_START(dgnbeta) + ROM_REGION(0x4000,MAINCPU_TAG,0) + ROM_SYSTEM_BIOS( 0, "bootrom", "Dragon beta OS9 boot rom (1984)" ) + ROMX_LOAD("beta_bt.rom" ,0x0000 ,0x4000 ,CRC(4c54c1de) SHA1(141d9fcd2d187c305dff83fce2902a30072aed76), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "testrom", "Dragon beta test rom (1984?)" ) + ROMX_LOAD("beta_tst.rom" ,0x2000 ,0x2000 ,CRC(01d79d00) SHA1(343e08cf7656b5e8970514868df37ea0af1e2362), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "cfiles", "cfiles rom" ) + ROMX_LOAD("beta_cfi.rom" ,0x2000 ,0x2000 ,CRC(d312e4c0) SHA1(5c00daac488eaf8d36d66de6ec6c746ab7b78ecf), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "dfiles", "dfiles rom" ) + ROMX_LOAD("beta_dfi.rom" ,0x2000 ,0x2000 ,CRC(c4ad7f64) SHA1(50aa92a1c383321485d5a1aa41dfe4f90b3beaed), ROM_BIOS(4)) + + ROM_REGION (0x2000, "gfx1", 0) + ROM_LOAD("betachar.rom" ,0x0000 ,0x2000 ,CRC(ca79d66c) SHA1(8e2090d471dd97a53785a7f44a49d3c8c85b41f2)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, dgnbeta, 0, 0, dgnbeta, dgnbeta, driver_device, 0, "Dragon Data Ltd", "Dragon Beta Prototype", MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/digel804.c b/src/mame/drivers/digel804.c new file mode 100644 index 00000000000..f8e9ecf13a2 --- /dev/null +++ b/src/mame/drivers/digel804.c @@ -0,0 +1,726 @@ +// license:BSD-3-Clause +// copyright-holders:balrog,Jonathan Gevaryahu,Sandro Ronco +/****************************************************************************** +* +* Wavetek/Digelec model 804/EP804 (eprom programmer) driver +* By balrog and Jonathan Gevaryahu AKA Lord Nightmare +* Code adapted from zexall.c +* +* DONE: +* figure out z80 address space and hook up roms and rams (done) +* figure out where 10937 vfd controller lives (port 0x44 bits 7 and 0, POR has not been found yet) +* figure out how keypresses are detected (/INT?, port 0x43, and port 0x46) +* figure out how the banked ram works (writes to port 0x43 select a ram bank, fw2.2 supports 64k and fw4.1 supports 256k) +* tentatively figure out how flow control from ACIA works (/NMI)? +* hook up the speaker/beeper (port 0x45) +* hook up vfd controller (done to stderr, no artwork) +* hook up leds on front panel (done to stderr for now) +* hook up r6551 serial and attach terminal for sending to ep804 +* /nmi is emulated correctly (i.e. its tied to +5v. that was easy!) +* hook up keypad via 74C923 and mode buttons via logic gate mess +* +* TODO: +* remove ACIA hack in digel804_state::acia_command_w +* minor finishing touches to i/o map +* EPROM socket stuff (ports 0x40, 0x41, 0x42 and 0x47) +* artwork +* +******************************************************************************/ + +// port 40 read reads eprom socket pins 11-13, 15-19 (i.e. eprom pin D0 to pin D7) + +// port 40 write writes eprom socket pins 11-13, 15-19 (i.e. eprom pin D0 to pin D7) + +// port 41 write controls eprom socket pins 10 to 3 (d0 to d8 to eprom pins A0 to A7) and SIM pins 7, 20/11, 8/12, 27, 23, and 21 (d0 to d5, corresponding to SIM pins for A9, A10, A11, A12, A13, and A14+A15) +// Note: the v2.0 hardware has bit d6 controlling one of the pins going to the expansion ram socket +// The 2.0 hardware may also have separate SIM controls for A14 and A15, possibly using bit d7 to control sim A15 somehow + +// port 42 write controls eprom socket pins 25(d0), 2(d4), 27(d6) + +// port 43 read is status/mode +#undef PORT43_R_VERBOSE +// port 43 write is ram banking and ctl1-7; it also clears overload state +#define PORT43_W_VERBOSE 1 +// port 44 write is vfd serial/reset, as well as power and z80 control and various enables; it also clears powerfail state +#define PORT44_W_VERBOSE 1 +// port 45 write is speaker control +#undef PORT45_W_VERBOSE +// port 46 read is keypad + +// port 46 write is LED control +#undef PORT46_W_VERBOSE + +// port 47 write is tim0-tim7 + + +/* Core includes */ +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "machine/roc10937.h" +#include "machine/mos6551.h" +#include "machine/mm74c922.h" +#include "machine/ram.h" +#include "bus/rs232/rs232.h" +#include "digel804.lh" + + +class digel804_state : public driver_device +{ +public: + digel804_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_acia(*this, "acia"), + m_vfd(*this, "vfd"), + m_kb(*this, "74c923"), + m_ram(*this, RAM_TAG), + m_rambank(*this, "bankedram") + { + } + + required_device m_maincpu; + required_device m_speaker; + required_device m_acia; + required_device m_vfd; + required_device m_kb; + required_device m_ram; + required_memory_bank m_rambank; + + virtual void machine_reset(); + DECLARE_DRIVER_INIT(digel804); + DECLARE_WRITE8_MEMBER( op00 ); + DECLARE_READ8_MEMBER( ip40 ); + DECLARE_WRITE8_MEMBER( op40 ); + DECLARE_WRITE8_MEMBER( op41 ); + DECLARE_WRITE8_MEMBER( op42 ); + DECLARE_READ8_MEMBER( ip43 ); + DECLARE_WRITE8_MEMBER( op43 ); + DECLARE_WRITE8_MEMBER( op43_1_4 ); + DECLARE_WRITE8_MEMBER( op44 ); + DECLARE_WRITE8_MEMBER( op45 ); + DECLARE_READ8_MEMBER( ip46 ); + DECLARE_WRITE8_MEMBER( op46 ); + DECLARE_WRITE8_MEMBER( op47 ); + DECLARE_READ8_MEMBER( acia_rxd_r ); + DECLARE_WRITE8_MEMBER( acia_txd_w ); + DECLARE_READ8_MEMBER( acia_status_r ); + DECLARE_WRITE8_MEMBER( acia_reset_w ); + DECLARE_READ8_MEMBER( acia_command_r ); + DECLARE_WRITE8_MEMBER( acia_command_w ); + DECLARE_READ8_MEMBER( acia_control_r ); + DECLARE_WRITE8_MEMBER( acia_control_w ); + DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); + DECLARE_WRITE_LINE_MEMBER( ep804_acia_irq_w ); + DECLARE_WRITE_LINE_MEMBER( da_w ); + DECLARE_INPUT_CHANGED_MEMBER(mode_change); + // current speaker state for port 45 + UINT8 m_speaker_state; + // ram stuff for banking + UINT8 m_ram_bank; + // states + UINT8 m_acia_intq; + UINT8 m_overload_state; + UINT8 m_key_intq; + UINT8 m_remote_mode; + UINT8 m_key_mode; + UINT8 m_sim_mode; + UINT8 m_powerfail_state; + UINT8 m_chipinsert_state; + UINT8 m_keyen_state; + UINT8 m_op41; +}; + + +enum { MODE_OFF, MODE_KEY, MODE_REM, MODE_SIM }; + + +DRIVER_INIT_MEMBER(digel804_state,digel804) +{ + m_speaker_state = 0; + //port43_rtn = 0xEE;//0xB6; + m_acia_intq = 1; // /INT source 1 + m_overload_state = 0; // OVLD + m_key_intq = 1; // /INT source 2 + m_remote_mode = 1; // /REM + m_key_mode = 0; // /KEY + m_sim_mode = 1; // /SIM + m_powerfail_state = 1; // "O11" + m_chipinsert_state = 0; // PIN + m_ram_bank = 0; + m_op41 = 0; + m_keyen_state = 1; // /KEYEN + + m_rambank->set_base(m_ram->pointer()); +} + +void digel804_state::machine_reset() +{ + m_vfd->reset(); +} + +READ8_MEMBER( digel804_state::ip40 ) // eprom data bus read +{ + // TODO: would be nice to have a 'fake eprom' here + return 0xFF; +} + +WRITE8_MEMBER( digel804_state::op40 ) // eprom data bus write +{ + // TODO: would be nice to have a 'fake eprom' here + logerror("Digel804: port 40, eprom databus had %02X written to it!\n", data); +} + +WRITE8_MEMBER( digel804_state::op41 ) // eprom address low write AND SIM write, d6 also controls memory map somehow +{ + // TODO: would be nice to have a 'fake eprom' here + logerror("Digel804: port 41, eprom address low/sim/memorybank had %02X written to it!\n", data); + //fprintf(stderr,"op41 write of %02X, ram mapper bit is %d\n", data, (data&0x40)?1:0); + m_op41 = data; +} + +WRITE8_MEMBER( digel804_state::op42 ) // eprom address hi and control write +{ + // TODO: would be nice to have a 'fake eprom' here + logerror("Digel804: port 42, eprom address hi/control had %02X written to it!\n", data); +} + +READ8_MEMBER( digel804_state::ip43 ) +{ + /* Register 0x43: status/mode register read + bits 76543210 + |||||||\- overload state (0 = not overloaded; 1 = overload detected, led on and power disconnected to ic, writing to R43 sets this to ok) + ||||||\-- debug jumper X5 on the board; reads as 1 unless jumper is present + |||||\--- /INT status (any key pressed on keypad (0 = one or more pressed, 1 = none pressed) OR ACIA has thrown an int) + ||||\---- remote mode selected (0 = selected, 1 = not) \ + |||\----- key mode selected (0 = selected, 1 = not) > if all 3 of these are 1, unit is going to standby + ||\------ sim mode selected (0 = selected, 1 = not) / + |\------- power failure status (1 = power has failed, 0 = ok; writes to R44 set this to ok) + \-------- chip insert detect state 'PIN' (1 = no chip or cmos chip which ammeter cannot detect; 0 = nmos or detectable chip inserted) + after power failure (in key mode): + 0xEE 11101110 when no keypad key pressed + 0xEA 11101010 when keypad key pressed + in key mode: + 0xAE 10101110 when no keypad key pressed + 0xAA 10101010 when keypad key pressed + in remote mode: + 0xB6 10110110 when no keypad key pressed + 0xB2 10110010 when keypad key pressed + in sim mode: + 0x9E 10011110 when no keypad key pressed + 0x9A 10011010 when keypad key pressed + in off mode (before z80 is powered down): + 0xFE 11111110 + + */ + +#ifdef PORT43_R_VERBOSE + logerror("Digel804: returning %02X for port 43 status read\n", port43_rtn); +#endif + return ((m_overload_state<<0) + |((ioport("DEBUG")->read()&1)<<1) + |((m_key_intq&m_acia_intq)<<2) + |(m_remote_mode<<3) + |(m_key_mode<<4) + |(m_sim_mode<<5) + |(m_powerfail_state<<6) + |(m_chipinsert_state<<7)); + +} + +WRITE8_MEMBER( digel804_state::op00 ) +{ + m_ram_bank = data; + m_rambank->set_base(m_ram->pointer() + ((m_ram_bank * 0x8000) & m_ram->mask())); +} + +WRITE8_MEMBER( digel804_state::op43 ) +{ + /* writes to 0x43 control the ram banking on firmware which supports it + * bits:76543210 + * |||||\\\- select ram bank for 4000-bfff area based on these bits (2.0 hardware) + * \\\\\\\-- CTL lines + + * all writes to port 43 will reset the overload state unless the ammeter detects the overload is ongoing + */ + m_overload_state = 0; // writes to port 43 clear overload state +#ifdef PORT43_W_VERBOSE + logerror("Digel804: port 0x43 ram bank had %02x written to it!\n", data); + logerror(" op41 bit 6 is %d\n", (m_op41 & 0x40)?1:0); +#endif + m_ram_bank = data&7; + if ((data&0xF8)!=0) + logerror("Digel804: port 0x43 ram bank had unexpected data %02x written to it!\n", data); + + m_rambank->set_base(m_ram->pointer() + ((m_ram_bank * 0x8000) & m_ram->mask())); +} + +WRITE8_MEMBER( digel804_state::op43_1_4 ) +{ + m_overload_state = 0; // writes to port 43 clear overload state +} + +WRITE8_MEMBER( digel804_state::op44 ) // state write +{ + /* writes to 0x44 control the 10937 vfd chip, z80 power/busrq, eprom driving and some eprom power ctl lines + * bits:76543210 + * |||||||\- 10937 VFDC '/SCK' serial clock '/CDIS' + * ||||||\-- controls '/KEYEN' (which enables the four mode buttons when active) + * |||||\--- z80 and system power control (0 = power on, 1 = power off/standby), also controls '/MEMEN' which secondarily controls POR(power on/reset) for the VFDC chip + * ||||\---- controls the z80 /BUSRQ line (0 = idle/high, 1 = asserted/low) '/BRQ' + * |||\----- when 1, enables the output drivers of op40 to the rom data pins + * ||\------ controls 'CTL8' + * |\------- controls 'CTL9' + * \-------- 10937 VFDC 'DATA' serial data '/DDIS' + + * all writes to port 44 will reset the powerfail state + */ + m_powerfail_state = 0; // writes to port 44 clear powerfail state + m_keyen_state = BIT(data, 1); +#ifdef PORT44_W_VERBOSE + logerror("Digel804: port 0x44 vfd/state control had %02x written to it!\n", data); +#endif + m_vfd->por(!(data&0x04)); + m_vfd->data(data&0x80); + m_vfd->sclk(data&1); +} + +WRITE8_MEMBER( digel804_state::op45 ) // speaker write +{ + // all writes to here invert the speaker state, verified from schematics +#ifdef PORT45_W_VERBOSE + logerror("Digel804: port 0x45 speaker had %02x written to it!\n", data); +#endif + m_speaker_state ^= 0xFF; + m_speaker->level_w(m_speaker_state); +} + +READ8_MEMBER( digel804_state::ip46 ) // keypad read +{ + /* reads E* for a keypad number 0-F + * reads F0 for enter + * reads F4 for next + * reads F8 for rept + * reads FC for clear + * F* takes precedence over E* + * higher numbers take precedence over lower ones + * this value auto-latches on a key press and remains through multiple reads + * this is done by a 74C923 integrated circuit + */ + UINT8 kbd = m_kb->read(); +#ifdef PORT46_R_VERBOSE + logerror("Digel804: returning %02X for port 46 keypad read\n", kbd); +#endif + + return BITSWAP8(kbd,7,6,5,4,1,0,3,2); // verified from schematics +} + +WRITE8_MEMBER( digel804_state::op46 ) +{ + /* writes to 0x46 control the LEDS on the front panel + * bits:76543210 + * ||||\\\\- these four bits choose which of the 16 function leds is lit; the number is INVERTED first + * |||\----- if this bit is 1, the function leds are disabled + * ||\------ this bit controls the 'error' led; 1 = on + * |\------- this bit controls the 'busy' led; 1 = on + * \-------- this bit controls the 'input' led; 1 = on + */ +#ifdef PORT46_W_VERBOSE + logerror("Digel804: port 0x46 LED control had %02x written to it!\n", data); +#endif + //popmessage("LEDS: %s %s %s Func: %s%d\n", (data&0x80)?"INPUT":"-----", (data&0x40)?"BUSY":"----", (data&0x20)?"ERROR":"-----", (data&0x10)?"None":"", (data&0x10)?-1:(~data&0xF)); + //fprintf("LEDS: %s %s %s Func: %s%d\n", (data&0x80)?"INPUT":"-----", (data&0x40)?"BUSY":"----", (data&0x20)?"ERROR":"-----", (data&0x10)?"None":"", (data&0x10)?-1:(~data&0xF)); + + output_set_value("input_led", BIT(data,7)); + output_set_value("busy_led", BIT(data,6)); + output_set_value("error_led", BIT(data,5)); + + for(int i=0; i<16; i++) + output_set_indexed_value("func_led", i, (!(data & 0x10) && ((~data & 0x0f) == i)) ? 1 : 0); +} + +WRITE8_MEMBER( digel804_state::op47 ) // eprom timing/power and control write +{ + // TODO: would be nice to have a 'fake eprom' here + logerror("Digel804: port 47, eprom timing/power and control had %02X written to it!\n", data); +} + +INPUT_CHANGED_MEMBER( digel804_state::mode_change ) +{ + if (!newval && !m_keyen_state) + { + switch ((int)(FPTR)param) + { + case MODE_OFF: + m_key_mode = m_remote_mode = m_sim_mode = 1; + break; + case MODE_KEY: + m_remote_mode = m_sim_mode = 1; + m_key_mode = 0; + break; + case MODE_REM: + m_key_mode = m_sim_mode = 1; + m_remote_mode = 0; + break; + case MODE_SIM: + m_remote_mode = m_key_mode = 1; + m_sim_mode = 0; + break; + } + + m_acia->reset(); + } + + // press one of those keys reset the Z80 + m_maincpu->set_input_line(INPUT_LINE_RESET, (!newval && !m_keyen_state) ? ASSERT_LINE : CLEAR_LINE); +} + +/* ACIA Trampolines */ +READ8_MEMBER( digel804_state::acia_rxd_r ) +{ + return m_acia->read(space, 0); +} + +WRITE8_MEMBER( digel804_state::acia_txd_w ) +{ + m_acia->write(space, 0, data); +} + +READ8_MEMBER( digel804_state::acia_status_r ) +{ + return m_acia->read(space, 1); +} + +WRITE8_MEMBER( digel804_state::acia_reset_w ) +{ + m_acia->write(space, 1, data); +} + +READ8_MEMBER( digel804_state::acia_command_r ) +{ + return m_acia->read(space, 2); +} + +WRITE8_MEMBER( digel804_state::acia_command_w ) +{ + data |= 0x08; // HACK for ep804 remote mode + + m_acia->write(space, 2, data); +} + +READ8_MEMBER( digel804_state::acia_control_r ) +{ + return m_acia->read(space, 3); +} + +WRITE8_MEMBER( digel804_state::acia_control_w ) +{ + m_acia->write(space, 3, data); +} + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(z80_mem_804_1_4, AS_PROGRAM, 8, digel804_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROM // 3f in mapper = rom J3 + //AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("main_ram") // 6f in mapper = RAM D43 (6164) + //AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("main_ram") // 77 in mapper = RAM D44 (6164) + //AM_RANGE(0x8000, 0x9fff) AM_RAM AM_SHARE("main_ram") // 7b in mapper = RAM D45 (6164) + //AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("main_ram") // 7d in mapper = RAM D46 (6164) + AM_RANGE(0x4000,0xbfff) AM_RAMBANK("bankedram") + // c000-cfff is open bus in mapper, 7f + AM_RANGE(0xd000, 0xd7ff) AM_RAM // 7e in mapper = RAM P3 (6116) + AM_RANGE(0xd800, 0xf7ff) AM_ROM // 5f in mapper = rom K3 + // f800-ffff is open bus in mapper, 7f +ADDRESS_MAP_END + +static ADDRESS_MAP_START(z80_mem_804_1_2, AS_PROGRAM, 8, digel804_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM // 3f in mapper = rom D41 + AM_RANGE(0x2000, 0x3fff) AM_ROM // 5f in mapper = rom D42 + //AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("main_ram") // 6f in mapper = RAM D43 (6164) + //AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("main_ram") // 77 in mapper = RAM D44 (6164) + //AM_RANGE(0x8000, 0x9fff) AM_RAM AM_SHARE("main_ram") // 7b in mapper = RAM D45 (6164) + //AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("main_ram") // 7d in mapper = RAM D46 (6164) + AM_RANGE(0x4000,0xbfff) AM_RAMBANK("bankedram") + // c000-cfff is open bus in mapper, 7f + //AM_RANGE(0xc000, 0xc7ff) AM_RAM // hack for now to test, since sometimes it writes to c3ff + AM_RANGE(0xd000, 0xd7ff) AM_RAM // 7e in mapper = RAM D47 (6116) + // d800-ffff is open bus in mapper, 7f +ADDRESS_MAP_END + +static ADDRESS_MAP_START(z80_io_1_4, AS_IO, 8, digel804_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // io bits: x 1 x x x * * * + // writes to 47, 4e, 57, 5e, 67, 6e, 77, 7e, c7, ce, d7, de, e7, ee, f7, fe all go to 47, same with reads + AM_RANGE(0x00, 0x00) AM_MIRROR(0x38) AM_WRITE(op00) // W, banked ram + AM_RANGE(0x40, 0x40) AM_MIRROR(0xB8) AM_READWRITE(ip40, op40) // RW, eprom socket data bus input/output value + AM_RANGE(0x41, 0x41) AM_MIRROR(0xB8) AM_WRITE(op41) // W, eprom socket address low out + AM_RANGE(0x42, 0x42) AM_MIRROR(0xB8) AM_WRITE(op42) // W, eprom socket address hi/control out + AM_RANGE(0x43, 0x43) AM_MIRROR(0xB8) AM_READWRITE(ip43, op43_1_4) // RW, mode and status register, also checks if keypad is pressed; write is unknown + AM_RANGE(0x44, 0x44) AM_MIRROR(0xB8) AM_WRITE(op44) // W, 10937 vfd controller, z80 power and state control reg + AM_RANGE(0x45, 0x45) AM_MIRROR(0xB8) AM_WRITE(op45) // W, speaker bit; every write inverts state + AM_RANGE(0x46, 0x46) AM_MIRROR(0xB8) AM_READWRITE(ip46, op46) // RW, reads keypad, writes controls the front panel leds. + AM_RANGE(0x47, 0x47) AM_MIRROR(0xB8) AM_WRITE(op47) // W eprom socket power and timing control + // io bits: 1 0 x x x * * * + // writes to 80, 88, 90, 98, a0, a8, b0, b8 all go to 80, same with reads + AM_RANGE(0x80, 0x80) AM_MIRROR(0x38) AM_WRITE(acia_txd_w) // (ACIA xmit reg) + AM_RANGE(0x81, 0x81) AM_MIRROR(0x38) AM_READ(acia_rxd_r) // (ACIA rcv reg) + AM_RANGE(0x82, 0x82) AM_MIRROR(0x38) AM_WRITE(acia_reset_w) // (ACIA reset reg) + AM_RANGE(0x83, 0x83) AM_MIRROR(0x38) AM_READ(acia_status_r) // (ACIA status reg) + AM_RANGE(0x84, 0x84) AM_MIRROR(0x38) AM_WRITE(acia_command_w) // (ACIA command reg) + AM_RANGE(0x85, 0x85) AM_MIRROR(0x38) AM_READ(acia_command_r) // (ACIA command reg) + AM_RANGE(0x86, 0x86) AM_MIRROR(0x38) AM_WRITE(acia_control_w) // (ACIA control reg) + AM_RANGE(0x87, 0x87) AM_MIRROR(0x38) AM_READ(acia_control_r) // (ACIA control reg) + //AM_RANGE(0x80,0x87) AM_MIRROR(0x38) AM_SHIFT(-1) AM_DEVREADWRITE("acia", mos6551_device, read, write) // this doesn't work since we lack an AM_SHIFT command + +ADDRESS_MAP_END + +static ADDRESS_MAP_START(z80_io_1_2, AS_IO, 8, digel804_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // io bits: x 1 x x x * * * + // writes to 47, 4e, 57, 5e, 67, 6e, 77, 7e, c7, ce, d7, de, e7, ee, f7, fe all go to 47, same with reads + AM_RANGE(0x40, 0x40) AM_MIRROR(0xB8) AM_READWRITE(ip40, op40) // RW, eprom socket data bus input/output value + AM_RANGE(0x41, 0x41) AM_MIRROR(0xB8) AM_WRITE(op41) // W, eprom socket address low out + AM_RANGE(0x42, 0x42) AM_MIRROR(0xB8) AM_WRITE(op42) // W, eprom socket address hi/control out + AM_RANGE(0x43, 0x43) AM_MIRROR(0xB8) AM_READWRITE(ip43, op43) // RW, mode and status register, also checks if keypad is pressed; write is unknown + AM_RANGE(0x44, 0x44) AM_MIRROR(0xB8) AM_WRITE(op44) // W, 10937 vfd controller, z80 power and state control reg + AM_RANGE(0x45, 0x45) AM_MIRROR(0xB8) AM_WRITE(op45) // W, speaker bit; every write inverts state + AM_RANGE(0x46, 0x46) AM_MIRROR(0xB8) AM_READWRITE(ip46, op46) // RW, reads keypad, writes controls the front panel leds. + AM_RANGE(0x47, 0x47) AM_MIRROR(0xB8) AM_WRITE(op47) // W eprom socket power and timing control + // io bits: 1 0 x x x * * * + // writes to 80, 88, 90, 98, a0, a8, b0, b8 all go to 80, same with reads + AM_RANGE(0x80, 0x80) AM_MIRROR(0x38) AM_WRITE(acia_txd_w) // (ACIA xmit reg) + AM_RANGE(0x81, 0x81) AM_MIRROR(0x38) AM_READ(acia_rxd_r) // (ACIA rcv reg) + AM_RANGE(0x82, 0x82) AM_MIRROR(0x38) AM_WRITE(acia_reset_w) // (ACIA reset reg) + AM_RANGE(0x83, 0x83) AM_MIRROR(0x38) AM_READ(acia_status_r) // (ACIA status reg) + AM_RANGE(0x84, 0x84) AM_MIRROR(0x38) AM_WRITE(acia_command_w) // (ACIA command reg) + AM_RANGE(0x85, 0x85) AM_MIRROR(0x38) AM_READ(acia_command_r) // (ACIA command reg) + AM_RANGE(0x86, 0x86) AM_MIRROR(0x38) AM_WRITE(acia_control_w) // (ACIA control reg) + AM_RANGE(0x87, 0x87) AM_MIRROR(0x38) AM_READ(acia_control_r) // (ACIA control reg) + //AM_RANGE(0x80,0x87) AM_MIRROR(0x38) AM_SHIFT(-1) AM_DEVREADWRITE("acia", mos6551_device, read, write) // this doesn't work since we lack an AM_SHIFT command + +ADDRESS_MAP_END + + +/****************************************************************************** + Input Ports +******************************************************************************/ +static INPUT_PORTS_START( digel804 ) + PORT_START("LINE0") /* KEY ROW 0, 'X1' */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTR/INCR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('^') + + PORT_START("LINE1") /* KEY ROW 1, 'X2' */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT/DECR") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + + PORT_START("LINE2") /* KEY ROW 2, 'X3' */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("LINE3") /* KEY ROW 3, 'X4' */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_START("MODE") // TODO, connects entirely separately from the keypad through some complicated latching logic + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KEY") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER( DEVICE_SELF, digel804_state, mode_change, MODE_KEY ) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REM") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER( DEVICE_SELF, digel804_state, mode_change, MODE_REM ) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SIM") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER( DEVICE_SELF, digel804_state, mode_change, MODE_SIM ) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_O) PORT_CHANGED_MEMBER( DEVICE_SELF, digel804_state, mode_change, MODE_OFF ) + + PORT_START("DEBUG") // debug jumper on the board + PORT_DIPNAME( 0x01, 0x01, "Debug Mode" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START( digel804_rs232_defaults ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_ODD ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +/****************************************************************************** + Machine Drivers +******************************************************************************/ + +WRITE_LINE_MEMBER( digel804_state::da_w ) +{ + m_key_intq = state ? 0 : 1; + m_maincpu->set_input_line(0, (m_key_intq & m_acia_intq) ? CLEAR_LINE : ASSERT_LINE); +} + +WRITE_LINE_MEMBER( digel804_state::acia_irq_w ) +{ + m_acia_intq = state ? 0 : 1; + m_maincpu->set_input_line(0, (m_key_intq & m_acia_intq) ? CLEAR_LINE : ASSERT_LINE); +} + +WRITE_LINE_MEMBER( digel804_state::ep804_acia_irq_w ) +{ +} + +static MACHINE_CONFIG_START( digel804, digel804_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_3_6864MHz/2) /* Z80A, X1(aka E0 on schematics): 3.6864Mhz */ + MCFG_CPU_PROGRAM_MAP(z80_mem_804_1_4) + MCFG_CPU_IO_MAP(z80_io_1_4) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_ROC10937_ADD("vfd",0) // RIGHT_TO_LEFT + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_digel804) + + MCFG_DEVICE_ADD("74c923", MM74C923, 0) + MCFG_MM74C922_DA_CALLBACK(WRITELINE(digel804_state, da_w)) + MCFG_MM74C922_X1_CALLBACK(IOPORT("LINE0")) + MCFG_MM74C922_X2_CALLBACK(IOPORT("LINE1")) + MCFG_MM74C922_X3_CALLBACK(IOPORT("LINE2")) + MCFG_MM74C922_X4_CALLBACK(IOPORT("LINE3")) + + /* acia */ + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_3_6864MHz/2) + MCFG_MOS6551_IRQ_HANDLER(WRITELINE(digel804_state, acia_irq_w)) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", mos6551_device, write_cts)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("null_modem", digel804_rs232_defaults) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", digel804_rs232_defaults) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + MCFG_RAM_EXTRA_OPTIONS("32K,64K,128K") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ep804, digel804 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") /* Z80, X1(aka E0 on schematics): 3.6864Mhz */ + MCFG_CPU_PROGRAM_MAP(z80_mem_804_1_2) + MCFG_CPU_IO_MAP(z80_io_1_2) + + MCFG_DEVICE_MODIFY("acia") + MCFG_MOS6551_IRQ_HANDLER(WRITELINE(digel804_state, ep804_acia_irq_w)) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("64K") +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +/* +For the 82S23A/MMI6330-equivalent mapper PROM at D30: + +z80 a11 -> prom a0 +z80 a12 -> prom a1 +z80 a13 -> prom a2 +z80 a14 -> prom a3 +z80 a15 -> prom a4 + +prom d0 -> ram 6116 /CE (pin 18?) at d47 +prom d1 -> ram 6116/64 /CE (pin 20) at d46 +prom d2 -> ram 6116/64 /CE (pin 20) at d45 +prom d3 -> ram 6116/64 /CE (pin 20) at d44 +prom d4 -> ram 6116/64 /CE (pin 20) at d43 +prom d5 -> rom /CE at d42 +prom d6 -> rom /CE at d41 +prom d7 -> N/C (unused) + + +On the v2.0 804-0197B mainboard, the added connector X9 (for the ram expansion daughterboard) +near to the mapper prom at D30 has the pinout: + ___ +|1 10 +|2 9| +|3 8| +|4 7| +|5_6| + +1 -> pin 15 of CD74HC374E at D23 & eprom socket pin A6 (i.e. op41 bit 6) +2 -> N/C +3 -> ram 6116/64 /CE (pin 20) of D45 & mapper prom D2 (pin 3) +4 -> ram 6116/64 /CE (pin 20) of D43 & mapper prom D4 (pin 5) +5 -> CE2 (pin 26) of all four ram chips (D43 D44 D45 D46) +6 -> +5v +7 -> ram 6116/64 /CE (pin 20) of D44 & mapper prom D3 (pin 4) +8 -> ram 6116/64 /CE (pin 20) of D46 & mapper prom D1 (pin 2) +9 -> N/C +10 -> mapper prom /CE (pin 15) + +If the ram expansion is not installed (i.e. only 32k of base ram on the mainboard), there is a jumper present between pins 5 and 6 +*/ + +ROM_START(digel804) // address mapper 804-1-4 + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("1-04__76f1.27128.d41", 0x0000, 0x4000, CRC(61b50b61) SHA1(ad717fcbf3387b0a8fb0546025d3c527792eb3f0)) + // the second rom here is loaded bizarrely: the first 3/4 appears at e000-f7ff and the last 1/4 appears at d800-dfff + ROM_LOAD("2-04__d6cc.2764a.d42", 0xe000, 0x1800, CRC(098cb008) SHA1(9f04e12489ab5f714d2fd4af8158969421557e75)) + ROM_CONTINUE(0xd800, 0x800) + ROM_REGION(0x20, "proms", 0) + ROM_LOAD("804-1-4.82s23a.d30", 0x0000, 0x0020, CRC(f961beb1) SHA1(f2ec89375e656eeabc30246d42741cf718fb0f91)) // Address mapper prom, 82s23/mmi6330/tbp18sa030 equivalent 32x8 open collector +ROM_END + +ROM_START(ep804) // address mapper 804-1-2 + ROM_REGION(0x10000, "maincpu", 0) + ROM_DEFAULT_BIOS("ep804_v1.6") + ROM_SYSTEM_BIOS( 0, "ep804_v1.6", "Wavetek/Digelec EP804 FWv1.6") // hardware 1.1 + ROMX_LOAD("804-2__rev_1.6__07f7.hn482764g-4.d41", 0x0000, 0x2000, CRC(2d4c334c) SHA1(1be70ed5f4f315a8d2e38a17327a049e00fa174e), ROM_BIOS(1)) + ROMX_LOAD("804-3__rev_1.6__265c.hn482764g-4.d42", 0x2000, 0x2000, CRC(9c14906b) SHA1(41996039e604011c7c0f757397f82b6479ee3f62), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "ep804_v1.4", "Wavetek/Digelec EP804 FWv1.4") // hardware 1.1 + ROMX_LOAD("804-2_rev_1.4__7a7e.hn482764g-4.d41", 0x0000, 0x2000, CRC(fdc0d2e3) SHA1(da1bc1e8c4cb2a2d8cd2273f3e1a9f318ae8cb87), ROM_BIOS(2)) + ROMX_LOAD("804-3_rev_1.4__f240.2732.d42", 0x2000, 0x1000, CRC(29827e29) SHA1(4c7fadf81bcf32349a564d946f5d215de50315c5), ROM_BIOS(2)) + ROMX_LOAD("804-3_rev_1.4__f240.2732.d42", 0x3000, 0x1000, CRC(29827e29) SHA1(4c7fadf81bcf32349a564d946f5d215de50315c5), ROM_BIOS(2)) // load this twice + ROM_SYSTEM_BIOS( 2, "ep804_v2.21", "Wavetek/Digelec EP804 FWv2.21") // hardware 1.5 NOTE: this may use the address mapper 804-1-3 which is not dumped! + ROMX_LOAD("804-2_rev2.21__cs_ab50.hn482764g.d41", 0x0000, 0x2000, CRC(ffbc95f6) SHA1(b12aa97e23d546064f1d17aa9b90772017fec5ec), ROM_BIOS(3)) + ROMX_LOAD("804-3_rev2.21__cs_6b98.hn482764g.d42", 0x2000, 0x2000, CRC(a4acb9fe) SHA1(bbc7e3e2e6b3b1abe747380909dcddc985ef8d0d), ROM_BIOS(3)) + ROM_REGION(0x20, "proms", 0) + ROM_LOAD("804-1-2.mmi_6330-in.d30", 0x0000, 0x0020, CRC(30dd4721) SHA1(e4b2f5756118be4c8ab56c708dc4f42469c7e51b)) // Address mapper prom, 82s23/mmi6330/tbp18sa030 equivalent 32x8 open collector +ROM_END + + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, digel804, 0, 0, digel804, digel804, digel804_state, digel804, "Digelec, Inc", "Digelec 804 EPROM Programmer", MACHINE_NOT_WORKING ) +COMP( 1982, ep804, digel804, 0, ep804, digel804, digel804_state, digel804, "Wavetek/Digelec, Inc", "EP804 EPROM Programmer", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/dim68k.c b/src/mame/drivers/dim68k.c new file mode 100644 index 00000000000..7dce08a1a89 --- /dev/null +++ b/src/mame/drivers/dim68k.c @@ -0,0 +1,398 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Micro Craft Dimension 68000 + + 28/12/2011 Skeleton driver. + + This computer had the facility for plug-in cards to emulate popular + computers of the time such as apple, trs80, kaypro, etc. The floppy + disk parameters could be set to be able to read the disks of the + various systems, or you create any other format you wished. + + There is no schematic available, so not fully able to emulate at + this time. + + ToDo: + + - Floppy controller + - Floppy formats (not sure if MESS supports user-defined formats) + - Banking + - Graphics display (including colour and video_control options) + - DUART + - RTC + - RS232 interface + - Keyboard + - Centronics printer + - Video-high + - Video-reset + - Game switches, paddles and timers + - The plug-in boards + - Emulator trap function + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "sound/speaker.h" +#include "video/mc6845.h" +#include "machine/keyboard.h" +#include "machine/upd765.h" + + +class dim68k_state : public driver_device +{ +public: + dim68k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "crtc"), + m_speaker(*this, "speaker"), + m_ram(*this, "ram"), + m_palette(*this, "palette") { } + + DECLARE_READ16_MEMBER( dim68k_duart_r ); + DECLARE_READ16_MEMBER( dim68k_fdc_r ); + DECLARE_READ16_MEMBER( dim68k_game_switches_r ); + DECLARE_READ16_MEMBER( dim68k_speaker_r ); + DECLARE_WRITE16_MEMBER( dim68k_banksw_w ); + DECLARE_WRITE16_MEMBER( dim68k_duart_w ); + DECLARE_WRITE16_MEMBER( dim68k_fdc_w ); + DECLARE_WRITE16_MEMBER( dim68k_printer_strobe_w ); + DECLARE_WRITE16_MEMBER( dim68k_reset_timers_w ); + DECLARE_WRITE16_MEMBER( dim68k_speaker_w ); + DECLARE_WRITE16_MEMBER( dim68k_video_control_w ); + DECLARE_WRITE16_MEMBER( dim68k_video_high_w ); + DECLARE_WRITE16_MEMBER( dim68k_video_reset_w ); + DECLARE_WRITE8_MEMBER(kbd_put); + MC6845_UPDATE_ROW(crtc_update_row); + const UINT8 *m_p_chargen; + bool m_speaker_bit; + UINT8 m_video_control; + UINT8 m_term_data; + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; + required_device m_crtc; + required_device m_speaker; + required_shared_ptr m_ram; + required_device m_palette; +}; + +READ16_MEMBER( dim68k_state::dim68k_duart_r ) +// Port A is for the keyboard : 300 baud, no parity, 8 bits, 1 stop bit. Port B is for RS232. +// The device also controls the parallel printer (except the strobe) and the RTC. +// Device = SCN2681, not emulated. The keyboard is standard ASCII, so we can use the terminal +// keyboard for now. +{ + if (offset==3) + return m_term_data; + else + return 0; +} + +READ16_MEMBER( dim68k_state::dim68k_fdc_r ) +{ + return 0; +} + +READ16_MEMBER( dim68k_state::dim68k_game_switches_r ) +// Reading the game port switches +// FFCC11 = switch 0; FFCC13 = switch 1, etc to switch 3 +// FFCC19 = paddle 0; FFCC1B = paddle 1, etc to paddle 3 +{ + return 0xffff; +} + +READ16_MEMBER( dim68k_state::dim68k_speaker_r ) +// Any read or write of this address will toggle the position of the speaker cone +{ + m_speaker_bit ^= 1; + m_speaker->level_w(m_speaker_bit); + return 0; +} + +WRITE16_MEMBER( dim68k_state::dim68k_speaker_w ) +{ + m_speaker_bit ^= 1; + m_speaker->level_w(m_speaker_bit); +} + +WRITE16_MEMBER( dim68k_state::dim68k_fdc_w ) +{ +} + +WRITE16_MEMBER( dim68k_state::dim68k_video_high_w ) +// "write high byte of address in memory of start of display buffer" +{ +} + +WRITE16_MEMBER( dim68k_state::dim68k_video_control_w ) +{ +/* D7 0 = Hires/Graphics; 1= Lores/Text [not emulated yet] + D6 0 = 8 dots per character; 1 = 7 dots [emulated] + D5 0 = CRTC and CPU run Asynchronously; 1 = Synchronously [won't be emulated] + D4,D3 Dot clock: 00=14MHz; 01=3.58MHz; 10=7MHz; 11=1.79MHz [emulated] + D2 0 = Screen On; 1 = Off [emulated] + D1 0 = Standard Chars & LoRes; 1 = Alternate Chars & HiRes [not emulated yet] + D0 0 = Non-Mixed (all text or all Graphics); 1 = Mixed (Colour Graphics and Monochrome Text) [not emulated yet] + */ + m_crtc->set_hpixels_per_column((data & 0x40) ? 7 : 8); + m_video_control = data; + + switch (data & 0x18) + { + case 0x00: m_crtc->set_clock(XTAL_14MHz); + break; + case 0x08: m_crtc->set_clock(XTAL_3_579545MHz); + break; + case 0x10: m_crtc->set_clock(XTAL_14MHz / 2); + break; + case 0x18: m_crtc->set_clock(XTAL_3_579545MHz / 2); + break; + } +} + +WRITE16_MEMBER( dim68k_state::dim68k_video_reset_w ) +{ +} + +WRITE16_MEMBER( dim68k_state::dim68k_duart_w ) +{ +} + +WRITE16_MEMBER( dim68k_state::dim68k_reset_timers_w ) +// reset game port timer before reading paddles +{ +} + +WRITE16_MEMBER( dim68k_state::dim68k_printer_strobe_w ) +// anything sent here will trigger a one-shot for a strobe pulse +{ +} + +WRITE16_MEMBER( dim68k_state::dim68k_banksw_w ) +// At boot time, the rom and IO occupy 0-FFFF, this moves it to the proper place +{ +} + +static ADDRESS_MAP_START(dim68k_mem, AS_PROGRAM, 16, dim68k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x00feffff) AM_RAM AM_SHARE("ram") // 16MB RAM / ROM at boot + AM_RANGE(0x00ff0000, 0x00ff1fff) AM_ROM AM_REGION("bootrom", 0) + AM_RANGE(0x00ff2000, 0x00ff7fff) AM_RAM // Graphics Video RAM + AM_RANGE(0x00ff8000, 0x00ff8001) AM_DEVREADWRITE8("crtc", mc6845_device, status_r, address_w, 0xff) + AM_RANGE(0x00ff8002, 0x00ff8003) AM_DEVREADWRITE8("crtc", mc6845_device, register_r, register_w, 0xff) + AM_RANGE(0x00ff8004, 0x00ff8005) AM_WRITE(dim68k_video_high_w) + AM_RANGE(0x00ff8008, 0x00ff8009) AM_WRITE(dim68k_video_control_w) + AM_RANGE(0x00ff800a, 0x00ff800b) AM_WRITE(dim68k_video_reset_w) + AM_RANGE(0x00ff8800, 0x00ff8fff) AM_ROM AM_REGION("cop6512",0) // slot 1 controller rom + AM_RANGE(0x00ff9000, 0x00ff97ff) AM_ROM AM_REGION("copz80",0) // slot 2 controller rom + AM_RANGE(0x00ff9800, 0x00ff9fff) AM_ROM AM_REGION("cop8086",0) // slot 3 controller rom +#if 0 + AM_RANGE(0x00ffa000, 0x00ffa7ff) AM_ROM // slot 4 controller rom + AM_RANGE(0x00ffa800, 0x00ffafff) AM_ROM // slot 5 controller rom + AM_RANGE(0x00ffb000, 0x00ffb7ff) AM_ROM // slot 6 controller rom +#endif + AM_RANGE(0x00ffc400, 0x00ffc41f) AM_READWRITE(dim68k_duart_r,dim68k_duart_w) // Signetics SCN2681AC1N40 Dual UART + AM_RANGE(0x00ffc800, 0x00ffc801) AM_READWRITE(dim68k_speaker_r,dim68k_speaker_w) + AM_RANGE(0x00ffcc00, 0x00ffcc1f) AM_READWRITE(dim68k_game_switches_r,dim68k_reset_timers_w) + AM_RANGE(0x00ffd000, 0x00ffd003) AM_DEVICE8("fdc",upd765a_device,map,0x00ff) // NEC uPD765A + AM_RANGE(0x00ffd004, 0x00ffd005) AM_READWRITE(dim68k_fdc_r,dim68k_fdc_w) + //AM_RANGE(0x00ffd400, 0x00ffd403) emulation trap control + AM_RANGE(0x00ffd800, 0x00ffd801) AM_WRITE(dim68k_printer_strobe_w) + AM_RANGE(0x00ffdc00, 0x00ffdc01) AM_WRITE(dim68k_banksw_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( dim68k ) +INPUT_PORTS_END + + +void dim68k_state::machine_reset() +{ + UINT8* ROM = memregion("bootrom")->base(); + + memcpy((UINT8*)m_ram.target(), ROM, 0x2000); + + m_maincpu->reset(); +} + +void dim68k_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +// Text-only; graphics isn't emulated yet. Need to find out if hardware cursor is used. +MC6845_UPDATE_ROW( dim68k_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,x,xx,inv; + UINT16 chr16=0x2020; // set to spaces if screen is off + UINT32 *p = &bitmap.pix32(y); + UINT8 screen_on = ~m_video_control & 4; + UINT8 dot8 = ~m_video_control & 40; + + // need to divide everything in half to cater for 16-bit reads + x_count /= 2; + ma /= 2; + xx = 0; + + for (x = 0; x < x_count; x++) + { + if (screen_on) + chr16 = m_ram[ma+x]; // reads 2 characters + + inv=0; + if (xx == cursor_x && screen_on) inv=0xff; + xx++; + + chr = chr16>>8; + gfx = m_p_chargen[(chr<<4) | ra] ^ inv ^ ((chr & 0x80) ? 0xff : 0); + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + if (dot8) *p++ = palette[BIT(gfx, 1)]; + + inv = 0; + if (xx == cursor_x) inv=0xff; + xx++; + + chr = chr16; + gfx = m_p_chargen[(chr<<4) | ra] ^ inv ^ ((chr & 0x80) ? 0xff : 0); + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + if (dot8) *p++ = palette[BIT(gfx, 1)]; + } +} + +/* F4 Character Displayer */ +static const gfx_layout dim68k_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( dim68k ) + GFXDECODE_ENTRY( "chargen", 0x0000, dim68k_charlayout, 0, 1 ) +GFXDECODE_END + +static SLOT_INTERFACE_START( dim68k_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +WRITE8_MEMBER( dim68k_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( dim68k, dim68k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(dim68k_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 250-1) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", dim68k) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_UPD765A_ADD("fdc", true, true) // these options unknown + MCFG_FLOPPY_DRIVE_ADD("fdc:0", dim68k_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", dim68k_floppies, "525hd", floppy_image_device::default_floppy_formats) + + MCFG_MC6845_ADD("crtc", MC6845, "screen", 1790000) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(dim68k_state, crtc_update_row) + + MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(dim68k_state, kbd_put)) +MACHINE_CONFIG_END + +/* +68000 + +MC101A 82S100 +MC102B 82S100 +MC103E 2732A +MC104 2732A label "4050" underneath +MC105 2732A char gen + +6512 + +MC106 82LS135 U24 +MC107 82LS135 U20 +MC108 82S137 U23 +MC109 82S131 U16 +MC110 82LS135 U35 + +Z80 + +MC111 82S123 U11 + +8086 + +MC112 82LS135 U18 +MC113 82S153 U16 +*/ +/* ROM definition */ +ROM_START( dim68k ) + ROM_REGION( 0x2000, "bootrom", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "mc103e.bin", 0x0000, 0x1000, CRC(4730c902) SHA1(5c4bb79ad22def721a22eb63dd05e0391c8082be)) + ROM_LOAD16_BYTE( "mc104.bin", 0x0001, 0x1000, CRC(14b04575) SHA1(43e15d9ebe1c9c1bf1bcfc1be3899a49e6748200)) + + ROM_REGION( 0x1000, "chargen", ROMREGION_ERASEFF ) + ROM_LOAD( "mc105e.bin", 0x0000, 0x1000, CRC(7a09daa8) SHA1(844bfa579293d7c3442fcbfa21bda75fff930394)) + + // The remaining roms may not be in the correct positions or being loaded correctly + ROM_REGION( 0x1000, "cop6512", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "mc106.bin", 0x0000, 0x0100, CRC(11530d8a) SHA1(e3eae266535383bcaee2d84d7bed6052d40e4e4a)) + ROM_LOAD16_WORD_SWAP( "mc107.bin", 0x0100, 0x0100, CRC(966db11b) SHA1(3c3105ac842602d8e01b0f924152fd672a85f00c)) + ROM_LOAD16_WORD_SWAP( "mc108.bin", 0x0200, 0x0400, CRC(687f9b0a) SHA1(ed9f1265b25f89f6d3cf8cd0a7b0fb73cb129f9f)) + ROM_LOAD16_WORD_SWAP( "mc109.bin", 0x0600, 0x0200, CRC(4a857f98) SHA1(9f2bbc2171fc49f65aa798c9cd7799a26afd2ddf)) + ROM_LOAD16_WORD_SWAP( "mc110.bin", 0x0800, 0x0100, CRC(e207b457) SHA1(a8987ba3d1bbdb3d8b3b11cec90c532ff09e762e)) + + ROM_REGION( 0x1000, "copz80", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "mc111.bin", 0x0000, 0x0020, CRC(6a380057) SHA1(6522a7b3e0af9db14a6ed04d4eec3ee6e44c2dab)) + + ROM_REGION( 0x1000, "cop8086", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "mc112.bin", 0x0000, 0x0100, CRC(dfd4cdbb) SHA1(a7831d415943fa86c417066807038bccbabb2573)) + ROM_LOAD( "mc113.bin", 0x0100, 0x00ef, CRC(594bdf05) SHA1(36db911a27d930e023fa12683e86e9eecfffdba6)) + + ROM_REGION( 0x1000, "mb", ROMREGION_ERASEFF ) // mainboard unknown + ROM_LOAD( "mc102.bin", 0x0000, 0x00fa, CRC(38e2abac) SHA1(0d7e730b46fc162764c69c51dea3bbe8337b1a7d)) + ROM_LOAD( "mc101.bin", 0x0100, 0x00fa, CRC(caffb3a0) SHA1(36f5140b306565794c4d856e0c20589b8f2a37f4)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, dim68k, 0, 0, dim68k, dim68k, driver_device, 0, "Micro Craft", "Dimension 68000", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/dm7000.c b/src/mame/drivers/dm7000.c new file mode 100644 index 00000000000..cb808fb98fa --- /dev/null +++ b/src/mame/drivers/dm7000.c @@ -0,0 +1,352 @@ +// license:BSD-3-Clause +// copyright-holders:Lukasz Markowski +/*************************************************************************** + + Dream Multimedia Dreambox 7000/5620/500 + + 20/03/2010 Skeleton driver. + + + DM7000 - CPU STB04500 at 252 MHz + RAM 64MB + Flash 8MB + 1 x DVB-S + 1 x IDE interface + 1 x Common Interface (CI) + 1 x Compact flash + 2 x Smart card reader + 1 x USB + 1 x RS232 + 1 x LAN 100Mbit/s + 1 x LCD display + + DM56x0 - CPU STB04500 at 252 MHz + RAM 64MB + Flash 8MB + 1 x DVB-S + 2 x Common Interface (CI) + 1 x Smart card reader + 1 x LAN 100Mbit/s (just on 5620) + 1 x LCD display + + DM500 - CPU STBx25xx at 252 MHz + RAM 96MB + Flash 32MB + 1 x DVB-S + 1 x Smart card reader + 1 x LAN 100Mbit/s + +****************************************************************************/ + +#include "emu.h" +#include "includes/dm7000.h" + +#define VERBOSE_LEVEL ( 9 ) + +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...) +{ + if (VERBOSE_LEVEL >= n_level) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt); + vsprintf( buf, s_fmt, v); + va_end( v); + logerror( "%s: %s", machine.describe_context( ), buf); + } +} + +READ8_MEMBER( dm7000_state::dm7000_iic0_r ) +{ + UINT8 data = 0; // dummy + verboselog( machine(), 9, "(IIC0) %08X -> %08X\n", 0x40030000 + offset, data); + return data; +} + +WRITE8_MEMBER( dm7000_state::dm7000_iic0_w ) +{ + verboselog( machine(), 9, "(IIC0) %08X <- %08X\n", 0x40030000 + offset, data); +} + +READ8_MEMBER( dm7000_state::dm7000_iic1_r ) +{ + UINT8 data = 0; // dummy + verboselog( machine(), 9, "(IIC1) %08X -> %08X\n", 0x400b0000 + offset, data); + return data; +} + +WRITE8_MEMBER( dm7000_state::dm7000_iic1_w ) +{ + verboselog( machine(), 9, "(IIC1) %08X <- %08X\n", 0x400b0000 + offset, data); +} + +READ8_MEMBER( dm7000_state::dm7000_scc0_r ) +{ + UINT8 data = 0; + switch(offset) { + case UART_THR: + data = m_term_data; + if(m_term_data == 0xd) { + m_term_data = 0xa; + } else { + m_term_data = 0; + m_scc0_lsr = 0; + } + break; + case UART_LSR: + data = UART_LSR_THRE | UART_LSR_TEMT | m_scc0_lsr; + break; + } + verboselog( machine(), 9, "(SCC0) %08X -> %08X\n", 0x40040000 + offset, data); + return data; +} + +WRITE8_MEMBER( dm7000_state::dm7000_scc0_w ) +{ + switch(offset) { + case UART_THR: + if(!(m_scc0_lcr & UART_LCR_DLAB)) { + m_terminal->write(space, 0, data); + m_scc0_lsr = 1; + } + break; + case UART_LCR: + m_scc0_lcr = data; + break; + } + verboselog( machine(), 9, "(SCC0) %08X <- %08X\n", 0x40040000 + offset, data); +} + +READ8_MEMBER( dm7000_state::dm7000_gpio0_r ) +{ + UINT8 data = 0; // dummy + verboselog( machine(), 9, "(GPIO0) %08X -> %08X\n", 0x40060000 + offset, data); + return data; +} + +WRITE8_MEMBER( dm7000_state::dm7000_gpio0_w ) +{ + verboselog( machine(), 9, "(GPIO0) %08X <- %08X\n", 0x40060000 + offset, data); +} + +READ8_MEMBER( dm7000_state::dm7000_scp0_r ) +{ + UINT8 data = 0; // dummy + switch(offset) { + case SCP_STATUS: + data = SCP_STATUS_RXRDY; + break; + } + verboselog( machine(), 9, "(SCP0) %08X -> %08X\n", 0x400c0000 + offset, data); + return data; +} + +WRITE8_MEMBER( dm7000_state::dm7000_scp0_w ) +{ + verboselog( machine(), 9, "(SCP0) %08X <- %08X\n", 0x400c0000 + offset, data); + switch(offset) { + case SCP_TXDATA: + //printf("%02X ", data); + break; + } +} + +READ16_MEMBER( dm7000_state::dm7000_enet_r ) +{ + UINT16 data; + switch (offset) { + case 0x01: + data = 0x1801; + break; + case 0x05: + data = 0x3330; + break; + case 0x07: + data = 0x3300; + break; + default: + data = m_enet_regs[offset]; + break; + } + verboselog( machine(), 9, "(ENET) %08X -> %08X\n", 0x72000600 + (offset), data); + return data; +} + +WRITE16_MEMBER( dm7000_state::dm7000_enet_w ) +{ + verboselog( machine(), 9, "(ENET) %08X <- %08X\n", 0x72000600 + (offset), data); + COMBINE_DATA(&m_enet_regs[offset]); +} + +/* + Memory map for the IBM "Redwood-4" STB03xxx evaluation board. + + The STB03xxx internal i/o addresses don't work for us 1:1, + so we need to map them at a well know virtual address. + + 4000 000x uart1 + 4001 00xx ppu + 4002 00xx smart card + 4003 000x iic + 4004 000x uart0 + 4005 0xxx timer + 4006 00xx gpio + 4007 00xx smart card + 400b 000x iic + 400c 000x scp + 400d 000x modem + + STBx25xx + + 4000 000x Serial1 Controller + 4001 000x Serial2 Controller + 4002 00xx Smart Card Interface 0 + 4003 000x IIC Interface 0 + 4004 000x Serial0 Controller + 4005 0xxx General Purpose Timers + 4006 00xx General Purpose Input / Output + 4007 00xx Smart Card Interface 1 + 400c 000x Serial Controller Port + 400d 00xx Synchronous Serial Port + + STB04xxx + + 4000 00xx Serial1/Infrared Controller + 4001 00xx Universal Serial Bus + 4002 00xx Smart Card Interface 0 + 4003 000x IIC Interface 0 + 4004 000x Serial0/Uart750 Controller + 4005 0xxx General Purpose Timers + 4006 00xx General Purpose Input / Output + 4007 00xx Smart Card Interface 1 + 400b 000x IIC Interface 1 + 400c 000x Serial Controller Port + 400d 00xx Synchronous Serial Port + 400e 000x Serial2/UART750 Controller + 400f 0xxx IDE Controller + +*/ +static ADDRESS_MAP_START( dm7000_mem, AS_PROGRAM, 32, dm7000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x01ffffff) AM_RAM // RAM page 0 - 32MB + AM_RANGE(0x20000000, 0x21ffffff) AM_RAM // RAM page 1 - 32MB + + AM_RANGE(0x40030000, 0x4003000f) AM_READWRITE8(dm7000_iic0_r, dm7000_iic0_w, 0xffffffff) + AM_RANGE(0x40040000, 0x40040007) AM_READWRITE8(dm7000_scc0_r, dm7000_scc0_w, 0xffffffff) + AM_RANGE(0x40060000, 0x40060047) AM_READWRITE8(dm7000_gpio0_r, dm7000_gpio0_w, 0xffffffff) + AM_RANGE(0x400b0000, 0x400b000f) AM_READWRITE8(dm7000_iic1_r, dm7000_iic1_w, 0xffffffff) + AM_RANGE(0x400c0000, 0x400c0007) AM_READWRITE8(dm7000_scp0_r, dm7000_scp0_w, 0xffffffff) + + /* ENET - ASIX AX88796 */ + AM_RANGE(0x72000300, 0x720003ff) AM_READWRITE16(dm7000_enet_r, dm7000_enet_w, 0xffffffff) + + AM_RANGE(0x7f800000, 0x7ffdffff) AM_ROM AM_REGION("user2",0) + AM_RANGE(0x7ffe0000, 0x7fffffff) AM_ROM AM_REGION("user1",0) + //AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( dm7000 ) +INPUT_PORTS_END + + +void dm7000_state::machine_reset() +{ + dcr[DCRSTB045_CICVCR] = 0x00000001; + dcr[DCRSTB045_SCCR] = 0x00420080 /* default for serial divs */ | 0x3f /* undocumented?? used to print clocks */; + dcr[DCRSTB045_VIDEO_CNTL] = 0x00009000; + dcr[DCRSTB045_DISP_MODE] = 0x00880000; + dcr[DCRSTB045_FRAME_BUFR_BASE] = 0x0f000000; + m_scc0_lsr = UART_LSR_THRE | UART_LSR_TEMT; + + m_maincpu->ppc4xx_set_dcr_read_handler(read32_delegate(FUNC(dm7000_state::dcr_r),this)); + m_maincpu->ppc4xx_set_dcr_write_handler(write32_delegate(FUNC(dm7000_state::dcr_w),this)); +} + +void dm7000_state::video_start() +{ +} + +UINT32 dm7000_state::screen_update_dm7000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +READ32_MEMBER( dm7000_state::dcr_r ) +{ + osd_printf_debug("DCR %03X read\n", offset); + if(offset>=1024) {printf("get %04X\n", offset); return 0;} else + switch(offset) { + case DCRSTB045_CMD_STAT: + return 0; // assume that video dev is always ready + default: + return dcr[offset]; + } + +} + +WRITE32_MEMBER( dm7000_state::dcr_w ) +{ + osd_printf_debug("DCR %03X write = %08X\n", offset, data); + if(offset>=1024) {printf("get %04X\n", offset); } else + dcr[offset] = data; +} + +WRITE8_MEMBER( dm7000_state::kbd_put ) +{ + //printf("%02X\n", data); + m_term_data = data; + m_scc0_lsr = 1; +} + +static MACHINE_CONFIG_START( dm7000, dm7000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",PPC405GP, 252000000 / 10) // Should be PPC405D4? + // Slowed down 10 times in order to get normal response for now + MCFG_PPC_BUS_FREQUENCY(252000000) + MCFG_CPU_PROGRAM_MAP(dm7000_mem) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(dm7000_state, screen_update_dm7000) + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dm7000_state, kbd_put)) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( dm7000 ) + ROM_REGION( 0x20000, "user1", ROMREGION_32BIT | ROMREGION_BE ) + ROMX_LOAD( "dm7000.bin", 0x0000, 0x20000, CRC(8a410f67) SHA1(9d6c9e4f5b05b28453d3558e69a207f05c766f54), ROM_GROUPWORD ) + ROM_REGION( 0x800000, "user2", ROMREGION_32BIT | ROMREGION_BE | ROMREGION_ERASEFF ) + ROM_LOAD( "rel108_dm7000.img", 0x0000, 0x5e0000, CRC(e78b6407) SHA1(aaa786d341c629eec92fcf04bfafc1de43f6dabf)) +ROM_END + +ROM_START( dm5620 ) + ROM_REGION( 0x20000, "user1", ROMREGION_32BIT | ROMREGION_BE ) + ROMX_LOAD( "dm5620.bin", 0x0000, 0x20000, CRC(ccddb822) SHA1(3ecf553ced0671599438368f59d8d30df4d13ade), ROM_GROUPWORD ) + ROM_REGION( 0x800000, "user2", ROMREGION_32BIT | ROMREGION_BE | ROMREGION_ERASEFF ) + ROM_LOAD( "rel106_dm5620.img", 0x0000, 0x57b000, CRC(2313d71d) SHA1(0d3d99ab3b3266624f237b7b67e045d7910c44a5)) +ROM_END + +ROM_START( dm500 ) + ROM_REGION( 0x20000, "user1", ROMREGION_32BIT | ROMREGION_BE ) + ROM_SYSTEM_BIOS( 0, "alps", "Alps" ) + ROMX_LOAD( "dm500-alps-boot.bin", 0x0000, 0x20000, CRC(daf2da34) SHA1(68f3734b4589fcb3e73372e258040bc8b83fd739), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "phil", "Philips" ) + ROMX_LOAD( "dm500-philps-boot.bin", 0x0000, 0x20000, CRC(af3477c7) SHA1(9ac918f6984e6927f55bea68d6daaf008787136e), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(2)) + ROM_REGION( 0x800000, "user2", ROMREGION_32BIT | ROMREGION_BE | ROMREGION_ERASEFF ) + ROM_LOAD( "rel108_dm500.img", 0x0000, 0x5aa000, CRC(44be2376) SHA1(1f360572998b1bc4dc10c5210a2aed573a75e2fa)) +ROM_END +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +SYST( 2003, dm7000, 0, 0, dm7000, dm7000, driver_device, 0, "Dream Multimedia", "Dreambox 7000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +SYST( 2004, dm5620, dm7000, 0, dm7000, dm7000, driver_device, 0, "Dream Multimedia", "Dreambox 5620", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +SYST( 2006, dm500, dm7000, 0, dm7000, dm7000, driver_device, 0, "Dream Multimedia", "Dreambox 500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/dms5000.c b/src/mame/drivers/dms5000.c new file mode 100644 index 00000000000..cb10bffa23d --- /dev/null +++ b/src/mame/drivers/dms5000.c @@ -0,0 +1,86 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Digital Microsystems DMS-5000 + + 11/01/2010 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" + + +class dms5000_state : public driver_device +{ +public: + dms5000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_dms5000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START( dms5000_mem, AS_PROGRAM, 16, dms5000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x1ffff) AM_RAM + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dms5000_io, AS_IO, 16, dms5000_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( dms5000 ) +INPUT_PORTS_END + + +void dms5000_state::machine_reset() +{ +} + +void dms5000_state::video_start() +{ +} + +UINT32 dms5000_state::screen_update_dms5000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( dms5000, dms5000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8086, XTAL_9_8304MHz) + MCFG_CPU_PROGRAM_MAP(dms5000_mem) + MCFG_CPU_IO_MAP(dms5000_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(dms5000_state, screen_update_dms5000) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( dms5000 ) + ROM_REGION( 0x4000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "dms-5000_54-8673o.bin", 0x0001, 0x2000, CRC(dce9823e) SHA1(d36ab87d2e6f5e9f02d59a6a7724ad3ce2428a2f)) + ROM_LOAD16_BYTE( "dms-5000_54-8672e.bin", 0x0000, 0x2000, CRC(94d64c06) SHA1(be5a53da7bb29a5fa9ac31efe550d5d6ff8b77cd)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, dms5000, 0, 0, dms5000, dms5000, driver_device, 0, "Digital Microsystems", "DMS-5000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/dms86.c b/src/mame/drivers/dms86.c new file mode 100644 index 00000000000..c1927ec631f --- /dev/null +++ b/src/mame/drivers/dms86.c @@ -0,0 +1,131 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Digital Microsystems DMS-86 + + 11/01/2010 Skeleton driver. + +Monitor commands: +A +B boot to HiNet +D dump memory to screen +I in port +L memory test +O out port (e.g. O 84 77) +P +S write a byte to memory +T +X display registers + + +Note that bit 3 of port 82 is tested at boot. If low, the computer bypasses +the monitor and goes straight to "Joining HiNet". + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class dms86_state : public driver_device +{ +public: + dms86_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ16_MEMBER( dms86_82_r ); + DECLARE_READ16_MEMBER( dms86_84_r ); + DECLARE_READ16_MEMBER( dms86_86_r ); + DECLARE_READ16_MEMBER( dms86_9a_r ); + DECLARE_WRITE8_MEMBER( kbd_put ); + UINT8 *m_ram; + UINT8 m_term_data; + virtual void machine_reset(); +}; + +READ16_MEMBER( dms86_state::dms86_82_r ) +{ +// HiNet / Monitor switch + + return 0xff; +} + +READ16_MEMBER( dms86_state::dms86_84_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ16_MEMBER( dms86_state::dms86_86_r ) +{ + return 4 | (m_term_data ? 1 : 0); +} + +READ16_MEMBER( dms86_state::dms86_9a_r ) +{ + return 0; +} + + +static ADDRESS_MAP_START(dms86_mem, AS_PROGRAM, 16, dms86_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x1ffff) AM_RAM + AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(dms86_io, AS_IO, 16, dms86_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x82, 0x83) AM_READ(dms86_82_r) + AM_RANGE(0x84, 0x85) AM_READ(dms86_84_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff) + AM_RANGE(0x86, 0x87) AM_READ(dms86_86_r) + AM_RANGE(0x9A, 0x9B) AM_READ(dms86_9a_r) + AM_RANGE(0x9c, 0x9d) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( dms86 ) +INPUT_PORTS_END + + +void dms86_state::machine_reset() +{ +} + +WRITE8_MEMBER( dms86_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( dms86, dms86_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8086, XTAL_9_8304MHz) + MCFG_CPU_PROGRAM_MAP(dms86_mem) + MCFG_CPU_IO_MAP(dms86_io) + + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dms86_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( dms86 ) + ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "hns-86_54-8678.bin", 0x0000, 0x1000, CRC(95f58e1c) SHA1(6fc8f087f0c887d8b429612cd035c6c1faab570c)) + ROM_LOAD16_BYTE( "hns-86_54-8677.bin", 0x0001, 0x1000, CRC(78fad756) SHA1(ddcbff1569ec6975b8489935cdcfa80eba413502)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, dms86, 0, 0, dms86, dms86, driver_device, 0, "Digital Microsystems", "DMS-86", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/dmv.c b/src/mame/drivers/dmv.c new file mode 100644 index 00000000000..6db67eb8e9e --- /dev/null +++ b/src/mame/drivers/dmv.c @@ -0,0 +1,850 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + NCR Decision Mate V + + 04/01/2012 Skeleton driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/upd765.h" +#include "machine/am9517a.h" +#include "machine/pit8253.h" +#include "machine/dmv_keyb.h" +#include "sound/speaker.h" +#include "video/upd7220.h" +#include "formats/dmv_dsk.h" + +// expansion slots +#include "bus/dmv/dmvbus.h" +#include "bus/dmv/k210.h" +#include "bus/dmv/k220.h" +#include "bus/dmv/k230.h" +#include "bus/dmv/k233.h" +#include "bus/dmv/k801.h" +#include "bus/dmv/k803.h" +#include "bus/dmv/k806.h" +#include "bus/dmv/ram.h" + + +#include "dmv.lh" + +class dmv_state : public driver_device +{ +public: + dmv_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_hgdc(*this, "upd7220"), + m_dmac(*this, "dma8237"), + m_pit(*this, "pit8253"), + m_fdc(*this, "i8272"), + m_floppy0(*this, "i8272:0"), + m_floppy1(*this, "i8272:1"), + m_keyboard(*this, "keyboard"), + m_speaker(*this, "speaker"), + m_video_ram(*this, "video_ram"), + m_palette(*this, "palette"), + m_ram(*this, "ram"), + m_bootrom(*this, "boot"), + m_chargen(*this, "chargen"), + m_slot1(*this, "slot1"), + m_slot2(*this, "slot2"), + m_slot2a(*this, "slot2a"), + m_slot3(*this, "slot3"), + m_slot4(*this, "slot4"), + m_slot5(*this, "slot5"), + m_slot6(*this, "slot6"), + m_slot7(*this, "slot7"), + m_slot7a(*this, "slot7a") + { } + + required_device m_maincpu; + required_device m_hgdc; + required_device m_dmac; + required_device m_pit; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_keyboard; + required_device m_speaker; + required_shared_ptr m_video_ram; + required_device m_palette; + required_memory_region m_ram; + required_memory_region m_bootrom; + required_memory_region m_chargen; + + required_device m_slot1; + required_device m_slot2; + required_device m_slot2a; + required_device m_slot3; + required_device m_slot4; + required_device m_slot5; + required_device m_slot6; + required_device m_slot7; + required_device m_slot7a; + + virtual void machine_start(); + virtual void machine_reset(); + void update_halt_line(); + + DECLARE_WRITE8_MEMBER(leds_w); + DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); + DECLARE_WRITE_LINE_MEMBER(dmac_eop); + DECLARE_WRITE_LINE_MEMBER(dmac_dack3); + DECLARE_WRITE_LINE_MEMBER(fdc_irq); + DECLARE_WRITE_LINE_MEMBER(pit_out0); + DECLARE_WRITE_LINE_MEMBER(timint_w); + DECLARE_WRITE8_MEMBER(fdd_motor_w); + DECLARE_READ8_MEMBER(sys_status_r); + DECLARE_WRITE8_MEMBER(tc_set_w); + DECLARE_WRITE8_MEMBER(switch16_w); + DECLARE_READ8_MEMBER(ramsel_r); + DECLARE_READ8_MEMBER(romsel_r); + DECLARE_WRITE8_MEMBER(ramsel_w); + DECLARE_WRITE8_MEMBER(romsel_w); + DECLARE_READ8_MEMBER(kb_mcu_port1_r); + DECLARE_WRITE8_MEMBER(kb_mcu_port1_w); + DECLARE_WRITE8_MEMBER(kb_mcu_port2_w); + DECLARE_WRITE8_MEMBER(rambank_w); + DECLARE_READ8_MEMBER(program_r); + DECLARE_WRITE8_MEMBER(program_w); + DECLARE_READ8_MEMBER(exp_program_r); + DECLARE_WRITE8_MEMBER(exp_program_w); + DECLARE_WRITE_LINE_MEMBER(thold7_w); + + void update_busint(int slot, int state); + DECLARE_WRITE_LINE_MEMBER(busint2_w) { update_busint(0, state); } + DECLARE_WRITE_LINE_MEMBER(busint2a_w) { update_busint(1, state); } + DECLARE_WRITE_LINE_MEMBER(busint3_w) { update_busint(2, state); } + DECLARE_WRITE_LINE_MEMBER(busint4_w) { update_busint(3, state); } + DECLARE_WRITE_LINE_MEMBER(busint5_w) { update_busint(4, state); } + DECLARE_WRITE_LINE_MEMBER(busint6_w) { update_busint(5, state); } + DECLARE_WRITE_LINE_MEMBER(busint7_w) { update_busint(6, state); } + DECLARE_WRITE_LINE_MEMBER(busint7a_w) { update_busint(7, state); } + + void update_irqs(int slot, int state); + DECLARE_WRITE_LINE_MEMBER(irq2_w) { update_irqs(0, state); } + DECLARE_WRITE_LINE_MEMBER(irq2a_w) { update_irqs(1, state); } + DECLARE_WRITE_LINE_MEMBER(irq3_w) { update_irqs(2, state); } + DECLARE_WRITE_LINE_MEMBER(irq4_w) { update_irqs(3, state); } + DECLARE_WRITE_LINE_MEMBER(irq5_w) { update_irqs(4, state); } + DECLARE_WRITE_LINE_MEMBER(irq6_w) { update_irqs(5, state); } + DECLARE_WRITE_LINE_MEMBER(irq7_w) { update_irqs(6, state); } + DECLARE_WRITE_LINE_MEMBER(irq7a_w) { update_irqs(7, state); } + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + UINT8 program_read(address_space &space, int cas, offs_t offset); + void program_write(address_space &space, int cas, offs_t offset, UINT8 data); + + void ifsel_r(address_space &space, int ifsel, offs_t offset, UINT8 &data); + void ifsel_w(address_space &space, int ifsel, offs_t offset, UINT8 data); + DECLARE_READ8_MEMBER(ifsel0_r) { UINT8 data = 0xff; ifsel_r(space, 0, offset, data); return data; } + DECLARE_READ8_MEMBER(ifsel1_r) { UINT8 data = 0xff; ifsel_r(space, 1, offset, data); return data; } + DECLARE_READ8_MEMBER(ifsel2_r) { UINT8 data = 0xff; ifsel_r(space, 2, offset, data); return data; } + DECLARE_READ8_MEMBER(ifsel3_r) { UINT8 data = 0xff; ifsel_r(space, 3, offset, data); return data; } + DECLARE_READ8_MEMBER(ifsel4_r) { UINT8 data = 0xff; ifsel_r(space, 4, offset, data); return data; } + DECLARE_WRITE8_MEMBER(ifsel0_w) { ifsel_w(space, 0, offset, data); } + DECLARE_WRITE8_MEMBER(ifsel1_w) { ifsel_w(space, 1, offset, data); } + DECLARE_WRITE8_MEMBER(ifsel2_w) { ifsel_w(space, 2, offset, data); } + DECLARE_WRITE8_MEMBER(ifsel3_w) { ifsel_w(space, 3, offset, data); } + DECLARE_WRITE8_MEMBER(ifsel4_w) { ifsel_w(space, 4, offset, data); } + + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); + UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); + + bool m_ramoutdis; + int m_switch16; + int m_thold7; + int m_dma_hrq; + int m_ram_bank; + bool m_color_mode; + int m_eop_line; + int m_dack3_line; + int m_sd_poll_state; + int m_floppy_motor; + int m_busint[8]; + int m_irqs[8]; +}; + +WRITE8_MEMBER(dmv_state::tc_set_w) +{ + m_fdc->tc_w(true); +} + +WRITE8_MEMBER(dmv_state::switch16_w) +{ + m_switch16 = !m_switch16; + update_halt_line(); +} + +WRITE8_MEMBER(dmv_state::leds_w) +{ + /* + LEDs Value Significance + --------------------------------------- + None 0xFF Check complete + 1+8 0x7E Sumcheck error + 2+8 0xBE GDC error + 3+8 0xDE Disk drive error + 4+8 0xEE 16-bit processor error + 5+8 0xF6 Keyboard error + 6+8 0xFA DMA error + 7+8 0xFC Memory error + All 0x00 Processor error + */ + + for(int i=0; i<8; i++) + output_set_led_value(8-i, BIT(data, i)); +} + +READ8_MEMBER(dmv_state::ramsel_r) +{ + m_ramoutdis = false; + return 0; +} + +READ8_MEMBER(dmv_state::romsel_r) +{ + m_ramoutdis = true; + return 0; +} + +WRITE8_MEMBER(dmv_state::ramsel_w) +{ + m_ramoutdis = false; +} + +WRITE8_MEMBER(dmv_state::romsel_w) +{ + m_ramoutdis = true; +} + +WRITE8_MEMBER(dmv_state::rambank_w) +{ + m_ram_bank = offset; +} + +WRITE8_MEMBER(dmv_state::fdd_motor_w) +{ + m_pit->write_gate0(1); + m_pit->write_gate0(0); + + m_floppy_motor = 0; + m_floppy0->get_device()->mon_w(m_floppy_motor); + m_floppy1->get_device()->mon_w(m_floppy_motor); +} + +READ8_MEMBER(dmv_state::sys_status_r) +{ + /* + Main system status + x--- ---- FDD index + -x--- --- IRQ 2 + --x--- -- IRQ 3 + ---x--- - IRQ 4 + ---- x--- FDC interrupt + ---- -x-- FDD ready + ---- --x- 16-bit CPU available (active low) + ---- ---x FDD motor (active low) + */ + UINT8 data = 0x00; + + if (m_floppy_motor) + data |= 0x01; + + // 16-bit CPU + if (!(m_slot7->av16bit() || m_slot7a->av16bit())) + data |= 0x02; + + if (!m_floppy0->get_device()->ready_r()) + data |= 0x04; + + if (m_fdc->get_irq()) + data |= 0x08; + + if (m_irqs[3]) + data |= 0x10; // IRQ 4 + + if (m_irqs[2]) + data |= 0x20; // IRQ 3 + + if (m_irqs[0]) + data |= 0x40; // IRQ 2 + + return data; +} + +UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels ) +{ + if (m_color_mode) + { + // 96KB videoram (32KB green + 32KB red + 32KB blue) + UINT16 green = m_video_ram[(0x00000 + (address & 0x7fff)) >> 1]; + UINT16 red = m_video_ram[(0x08000 + (address & 0x7fff)) >> 1]; + UINT16 blue = m_video_ram[(0x10000 + (address & 0x7fff)) >> 1]; + + for(int xi=0; xi<16; xi++) + { + int r = ((red >> xi) & 1) ? 255 : 0; + int g = ((green >> xi) & 1) ? 255 : 0; + int b = ((blue >> xi) & 1) ? 255 : 0; + + if (bitmap.cliprect().contains(x + xi, y)) + bitmap.pix32(y, x + xi) = rgb_t(r, g, b); + } + } + else + { + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + // 32KB videoram + UINT16 gfx = m_video_ram[(address & 0xffff) >> 1]; + + for(int xi=0;xi<16;xi++) + { + if (bitmap.cliprect().contains(x + xi, y)) + bitmap.pix32(y, x + xi) = ((gfx >> xi) & 1) ? palette[1] : palette[0]; + } + } +} + +UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text ) +{ + for( int x = 0; x < pitch; x++ ) + { + UINT8 tile = m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] & 0xff; + UINT8 attr = m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] >> 8; + + rgb_t bg, fg; + if (m_color_mode) + { + bg = rgb_t(attr & 0x20 ? 0 : 255, attr & 0x40 ? 0 : 255, attr & 0x80 ? 0 : 255); + fg = rgb_t(attr & 0x04 ? 255 : 0, attr & 0x08 ? 255 : 0, attr & 0x10 ? 255 : 0); + } + else + { + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + bg = palette[(attr & 1) ? 1 : 0]; + fg = palette[(attr & 1) ? 0 : 1]; + } + + for( int yi = 0; yi < lr; yi++) + { + UINT8 tile_data = m_chargen->base()[(tile*16+yi) & 0x7ff]; + + if(cursor_on && cursor_addr == addr+x) //TODO + tile_data^=0xff; + + for( int xi = 0; xi < 8; xi++) + { + int res_x,res_y; + int pen = (tile_data >> xi) & 1 ? 1 : 0; + + res_x = x * 8 + xi; + res_y = y + yi; + + if(!machine().first_screen()->visible_area().contains(res_x, res_y)) + continue; + + if(yi >= 16) { pen = 0; } + + bitmap.pix32(res_y, res_x) = pen ? fg : bg; + } + } + } +} + +static SLOT_INTERFACE_START( dmv_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + + +void dmv_state::ifsel_r(address_space &space, int ifsel, offs_t offset, UINT8 &data) +{ + dmvcart_slot_device *slots[] = { m_slot2, m_slot2a, m_slot3, m_slot4, m_slot5, m_slot6, m_slot7, m_slot7a }; + for(int i=0; i<8; i++) + slots[i]->io_read(space, ifsel, offset, data); +} + +void dmv_state::ifsel_w(address_space &space, int ifsel, offs_t offset, UINT8 data) +{ + dmvcart_slot_device *slots[] = { m_slot2, m_slot2a, m_slot3, m_slot4, m_slot5, m_slot6, m_slot7, m_slot7a }; + for(int i=0; i<8; i++) + slots[i]->io_write(space, ifsel, offset, data); +} + +WRITE8_MEMBER(dmv_state::exp_program_w) +{ + program_write(space, (offset >> 16) & 0x07, offset, data); +} + +READ8_MEMBER(dmv_state::exp_program_r) +{ + return program_read(space, (offset >> 16) & 0x07, offset); +} + +WRITE8_MEMBER(dmv_state::program_w) +{ + program_write(space, m_ram_bank, offset, data); +} + +READ8_MEMBER(dmv_state::program_r) +{ + return program_read(space, m_ram_bank, offset); +} + +WRITE_LINE_MEMBER( dmv_state::thold7_w ) +{ + if (m_thold7 != state) + { + m_thold7 = state; + update_halt_line(); + } +} + +void dmv_state::update_busint(int slot, int state) +{ + m_busint[slot] = state; + + int new_state = CLEAR_LINE; + for (int i=0; i<8; i++) + if (m_busint[i] != CLEAR_LINE) + { + new_state = ASSERT_LINE; + break; + } + + m_slot7a->busint_w(new_state); + m_slot7->busint_w(new_state); + m_maincpu->set_input_line(0, new_state); +} + +void dmv_state::update_irqs(int slot, int state) +{ + m_irqs[slot] = state; + + switch(slot) + { + case 0: // slot 2 + m_slot7->irq2_w(state); + m_slot7a->irq2_w(state); + break; + case 1: // slot 2a + m_slot7->irq2a_w(state); + m_slot7a->irq2a_w(state); + break; + case 2: // slot 3 + m_slot7->irq3_w(state); + m_slot7a->irq3_w(state); + break; + case 3: // slot 4 + m_slot7->irq4_w(state); + m_slot7a->irq4_w(state); + break; + case 4: // slot 5 + m_slot7->irq5_w(state); + m_slot7a->irq5_w(state); + break; + case 5: // slot 6 + m_slot7->irq6_w(state); + m_slot7a->irq6_w(state); + break; + } +} + +void dmv_state::program_write(address_space &space, int cas, offs_t offset, UINT8 data) +{ + bool tramd = false; + dmvcart_slot_device *slots[] = { m_slot2, m_slot2a, m_slot3, m_slot4, m_slot5, m_slot6, m_slot7, m_slot7a }; + for(int i=0; i<8 && !tramd; i++) + tramd = slots[i]->write(offset, data); + + if (!tramd) + { + if (cas == 0) + m_ram->base()[offset & 0xffff] = data; + else + m_slot1->ram_write(cas, offset & 0xffff, data); + } +} + +UINT8 dmv_state::program_read(address_space &space, int cas, offs_t offset) +{ + UINT8 data = 0xff; + if (m_ramoutdis && offset < 0x2000) + { + data = m_bootrom->base()[offset]; + } + else + { + bool tramd = false; + dmvcart_slot_device *slots[] = { m_slot2, m_slot2a, m_slot3, m_slot4, m_slot5, m_slot6, m_slot7, m_slot7a }; + for(int i=0; i<8 && !tramd; i++) + tramd = slots[i]->read(offset, data); + + if (!tramd) + { + if (cas == 0) + data = m_ram->base()[offset & 0xffff]; + else + m_slot1->ram_read(cas, offset & 0xffff, data); + } + } + + return data; +} + +static ADDRESS_MAP_START(dmv_mem, AS_PROGRAM, 8, dmv_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xffff ) AM_READWRITE(program_r, program_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dmv_io , AS_IO, 8, dmv_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(leds_w) + AM_RANGE(0x10, 0x10) AM_READWRITE(ramsel_r, ramsel_w) + AM_RANGE(0x11, 0x11) AM_READWRITE(romsel_r, romsel_w) + AM_RANGE(0x12, 0x12) AM_WRITE(tc_set_w) + AM_RANGE(0x13, 0x13) AM_READ(sys_status_r) + AM_RANGE(0x14, 0x14) AM_WRITE(fdd_motor_w) + AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("dma8237", am9517a_device, read, write) + AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("kb_ctrl_mcu", upi41_cpu_device, upi41_master_r, upi41_master_w) + AM_RANGE(0x50, 0x51) AM_DEVICE("i8272", i8272a_device, map) + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE(0xa0, 0xa1) AM_DEVREADWRITE("upd7220", upd7220_device, read, write) + AM_RANGE(0xd0, 0xd7) AM_WRITE(switch16_w) + AM_RANGE(0xe0, 0xe7) AM_WRITE(rambank_w) + + AM_RANGE(0x60, 0x6f) AM_READWRITE(ifsel0_r, ifsel0_w) + AM_RANGE(0x70, 0x7f) AM_READWRITE(ifsel1_r, ifsel1_w) + AM_RANGE(0x30, 0x3f) AM_READWRITE(ifsel2_r, ifsel2_w) + AM_RANGE(0xb0, 0xbf) AM_READWRITE(ifsel3_r, ifsel3_w) + AM_RANGE(0xc0, 0xcf) AM_READWRITE(ifsel4_r, ifsel4_w) +ADDRESS_MAP_END + +READ8_MEMBER(dmv_state::kb_mcu_port1_r) +{ + return !(m_keyboard->sd_poll_r() & !m_sd_poll_state); +} + +WRITE8_MEMBER(dmv_state::kb_mcu_port1_w) +{ + m_sd_poll_state = BIT(data, 1); + m_keyboard->sd_poll_w(!m_sd_poll_state); +} + +WRITE8_MEMBER(dmv_state::kb_mcu_port2_w) +{ + m_speaker->level_w(BIT(data, 0)); + m_slot7a->keyint_w(BIT(data, 4)); + m_slot7->keyint_w(BIT(data, 4)); +} + +static ADDRESS_MAP_START( dmv_kb_ctrl_io, AS_IO, 8, dmv_state ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_mcu_port1_r, kb_mcu_port1_w) // bit 0 data from kb, bit 1 data to kb + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_mcu_port2_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( upd7220_map, AS_0, 16, dmv_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1ffff) + AM_RANGE(0x00000, 0x1ffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( dmv ) + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x00, "Video Board" ) + PORT_CONFSETTING( 0x00, "Monochrome" ) + PORT_CONFSETTING( 0x01, "Color" ) +INPUT_PORTS_END + +void dmv_state::machine_start() +{ +} + +void dmv_state::machine_reset() +{ + m_color_mode = ioport("CONFIG")->read() & 0x01; + + m_ramoutdis = true; + m_ram_bank = 0; + m_eop_line = 0; + m_dack3_line = 0; + m_sd_poll_state = 0; + m_floppy_motor = 1; + m_switch16 = 0; + m_thold7 = 0; + m_dma_hrq = 0; + memset(m_busint, 0, sizeof(m_busint)); + memset(m_irqs, 0, sizeof(m_irqs)); + + update_halt_line(); +} + +void dmv_state::update_halt_line() +{ + m_slot7->hold_w(m_dma_hrq); + m_slot7->switch16_w(m_switch16); + m_slot7a->hold_w(m_dma_hrq); + m_slot7a->switch16_w(m_switch16); + + m_maincpu->set_input_line(INPUT_LINE_HALT, (m_thold7 || m_switch16 || m_dma_hrq) ? ASSERT_LINE : CLEAR_LINE); +} + +/* F4 Character Displayer */ +static const gfx_layout dmv_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { STEP16(0,8) }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( dmv ) + GFXDECODE_ENTRY("chargen", 0x0000, dmv_charlayout, 0, 1) +GFXDECODE_END + + +//------------------------------------------------------------------------------------ +// I8237 +//------------------------------------------------------------------------------------ + +WRITE_LINE_MEMBER( dmv_state::dma_hrq_changed ) +{ + m_dma_hrq = state; + update_halt_line(); + + // Assert HLDA + m_dmac->hack_w(state); +} + +WRITE_LINE_MEMBER( dmv_state::dmac_eop ) +{ + if (!(m_dack3_line || m_eop_line) && (m_dack3_line || state)) + m_fdc->tc_w(true); + + m_eop_line = state; +} + +WRITE_LINE_MEMBER( dmv_state::dmac_dack3 ) +{ + if (!(m_dack3_line || m_eop_line) && (state || m_eop_line)) + m_fdc->tc_w(true); + + m_dack3_line = state; +} + +WRITE_LINE_MEMBER( dmv_state::pit_out0 ) +{ + if (!state) + { + m_floppy_motor = 1; + m_floppy0->get_device()->mon_w(m_floppy_motor); + m_floppy1->get_device()->mon_w(m_floppy_motor); + } +} + +WRITE_LINE_MEMBER( dmv_state::timint_w ) +{ + m_slot7a->timint_w(state); + m_slot7->timint_w(state); +} + +WRITE_LINE_MEMBER( dmv_state::fdc_irq ) +{ + m_slot7a->flexint_w(state); + m_slot7->flexint_w(state); + + if (state) + m_fdc->tc_w(false); +} + + +FLOPPY_FORMATS_MEMBER( dmv_state::floppy_formats ) + FLOPPY_DMV_FORMAT +FLOPPY_FORMATS_END + + +static SLOT_INTERFACE_START(dmv_slot1) + SLOT_INTERFACE("k200", DMV_K200) // K200 64K RAM expansion + SLOT_INTERFACE("k202", DMV_K202) // K202 192K RAM expansion + SLOT_INTERFACE("k208", DMV_K208) // K208 448K RAM expansion +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(dmv_slot2_6) + SLOT_INTERFACE("k210", DMV_K210) // K210 Centronics + SLOT_INTERFACE("k211", DMV_K211) // K211 RS-232 Communications Interface + SLOT_INTERFACE("k212", DMV_K212) // K212 RS-232 Printer Interface + SLOT_INTERFACE("k213", DMV_K213) // K213 RS-232 Plotter Interface + SLOT_INTERFACE("k233", DMV_K233) // K233 16K Shared RAM + SLOT_INTERFACE("k801", DMV_K801) // K801 RS-232 Switchable Interface + SLOT_INTERFACE("k803", DMV_K803) // K803 RTC module + SLOT_INTERFACE("k806", DMV_K806) // K806 Mouse module +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(dmv_slot7) + SLOT_INTERFACE("k220", DMV_K220) // K220 Diagnostic Module + SLOT_INTERFACE("k231", DMV_K231) // K231 External 8088 module without interrupt controller + SLOT_INTERFACE("k234", DMV_K234) // K234 External 68008 module +SLOT_INTERFACE_END + + +static SLOT_INTERFACE_START(dmv_slot2a) + +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(dmv_slot7a) + SLOT_INTERFACE("k230", DMV_K230) // K230 Internal 8088 module without interrupt controller + SLOT_INTERFACE("k235", DMV_K235) // K235 Internal 8088 module with interrupt controller +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( dmv, dmv_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_24MHz / 6) + MCFG_CPU_PROGRAM_MAP(dmv_mem) + MCFG_CPU_IO_MAP(dmv_io) + + MCFG_CPU_ADD("kb_ctrl_mcu", I8741, XTAL_6MHz) + MCFG_CPU_IO_MAP(dmv_kb_ctrl_io) + + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_DMV_KEYBOARD_ADD("keyboard") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", dmv) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + MCFG_DEFAULT_LAYOUT(layout_dmv) + + // devices + MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_5MHz/2) // unk clock + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(dmv_state, hgdc_display_pixels) + MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(dmv_state, hgdc_draw_text) + + MCFG_DEVICE_ADD( "dma8237", AM9517A, XTAL_4MHz ) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(dmv_state, dma_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(dmv_state, dmac_eop)) + MCFG_I8237_IN_MEMR_CB(READ8(dmv_state, program_r)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(dmv_state, program_w)) + MCFG_I8237_IN_IOR_0_CB(LOGGER("DMA CH1", 0)) + MCFG_I8237_OUT_IOW_0_CB(LOGGER("DMA CH1", 0)) + MCFG_I8237_IN_IOR_1_CB(LOGGER("DMA CH2", 0)) + MCFG_I8237_OUT_IOW_1_CB(LOGGER("DMA CH2", 0)) + MCFG_I8237_IN_IOR_2_CB(DEVREAD8("upd7220", upd7220_device, dack_r)) + MCFG_I8237_OUT_IOW_2_CB(DEVWRITE8("upd7220", upd7220_device, dack_w)) + MCFG_I8237_IN_IOR_3_CB(DEVREAD8("i8272", i8272a_device, mdma_r)) + MCFG_I8237_OUT_IOW_3_CB(DEVWRITE8("i8272", i8272a_device, mdma_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(dmv_state, dmac_dack3)) + + MCFG_I8272A_ADD( "i8272", true ) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(dmv_state, fdc_irq)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8237", am9517a_device, dreq3_w)) + MCFG_FLOPPY_DRIVE_ADD("i8272:0", dmv_floppies, "525dd", dmv_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("i8272:1", dmv_floppies, "525dd", dmv_state::floppy_formats) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(50) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(dmv_state, pit_out0)) + MCFG_PIT8253_CLK2(XTAL_24MHz / 3 / 16) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(dmv_state, timint_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_DEVICE_ADD("slot1", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot1, NULL, false) + MCFG_DEVICE_ADD("slot2", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2_w)) + MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq2_w)) + MCFG_DEVICE_ADD("slot2a", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2a, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2a_w)) + MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq2a_w)) + MCFG_DEVICE_ADD("slot3", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint3_w)) + MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq3_w)) + MCFG_DEVICE_ADD("slot4", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint4_w)) + MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq4_w)) + MCFG_DEVICE_ADD("slot5", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint5_w)) + MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq5_w)) + MCFG_DEVICE_ADD("slot6", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint6_w)) + MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq6_w)) + + MCFG_DEVICE_ADD("slot7", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7, NULL, false) + MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w)) + MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w)) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7_w)) + MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq7_w)) + MCFG_DEVICE_ADD("slot7a", DMVCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7a, "k230", false) + MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w)) + MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w)) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7a_w)) + MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq7a_w)) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "dmv") + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( dmv ) + ROM_REGION( 0x2000, "boot", 0 ) + ROM_SYSTEM_BIOS(0, "c07", "C.07.00") // ROM bears the handwritten note "Color 7.0", this is from the machine that originally had Color, 68K and internal 8088 + ROM_SYSTEM_BIOS(1, "m07", "M.07.00") // Mono machine with internal 8088 and internal HD + ROM_SYSTEM_BIOS(2, "m06", "M.06.00") // Mono machine + ROM_SYSTEM_BIOS(3, "m05", "M.05.00") // Mono machine, marked "updated" + + ROMX_LOAD( "dmv_mb_rom_33610.bin", 0x00000, 0x02000, CRC(bf25f3f0) SHA1(0c7dd37704db4799e340cc836f887cd543e5c964), ROM_BIOS(1) ) + ROMX_LOAD( "dmv_mb_rom_33609.bin", 0x00000, 0x02000, CRC(120951b6) SHA1(57bef9cc6379dea5730bc1477e8896508e00a349), ROM_BIOS(2) ) + ROMX_LOAD( "dmv_mb_rom_32676.bin", 0x00000, 0x02000, CRC(7796519e) SHA1(8d5dd9c1e66c96fcca271b6f673d6a0e784acb33), ROM_BIOS(3) ) + ROMX_LOAD( "dmv_mb_rom_32664.bin", 0x00000, 0x02000, CRC(6624610e) SHA1(e9226be897d2c5f875784ab77dad8807f14c7714), ROM_BIOS(4) ) + + ROM_REGION(0x400, "kb_ctrl_mcu", 0) + ROMX_LOAD( "dmv_mb_8741_32678.bin", 0x00000, 0x00400, CRC(50d1dc4c) SHA1(2c8251d6c8df9f507e11bf920869657f4d074db1), ROM_BIOS(1) ) + ROMX_LOAD( "dmv_mb_8741_32678.bin", 0x00000, 0x00400, CRC(50d1dc4c) SHA1(2c8251d6c8df9f507e11bf920869657f4d074db1), ROM_BIOS(2) ) + ROMX_LOAD( "dmv_mb_8741_32678.bin", 0x00000, 0x00400, CRC(50d1dc4c) SHA1(2c8251d6c8df9f507e11bf920869657f4d074db1), ROM_BIOS(3) ) + ROMX_LOAD( "dmv_mb_8741_32121.bin", 0x00000, 0x00400, CRC(a03af298) SHA1(144cba41294c46f5ca79b7ad8ced0e4408168775), ROM_BIOS(4) ) + + ROM_REGION(0x800, "chargen", 0) + ROM_LOAD( "76161.bin", 0x00000, 0x00800, CRC(6e4df4f9) SHA1(20ff4fc48e55eaf5131f6573fff93e7f97d2f45d)) // same for both color and monochrome board + + ROM_REGION(0x10000, "ram", ROMREGION_ERASE) // 64K RAM on mainboard +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, dmv, 0, 0, dmv, dmv, driver_device, 0, "NCR", "Decision Mate V", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/dolphunk.c b/src/mame/drivers/dolphunk.c new file mode 100644 index 00000000000..8ee69d20042 --- /dev/null +++ b/src/mame/drivers/dolphunk.c @@ -0,0 +1,266 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Dolphin / Dauphin + + 2010-04-08 Skeleton driver. + 2012-05-20 Fixed keyboard, added notes & speaker [Robbbert] + 2013-11-03 Added cassette [Robbbert] + + Minimal Setup: + 0000-00FF ROM "MO" (74S471) + 0100-01FF ROM "MONI" (74S471) + 0200-02FF RAM (2x 2112) + 18 pushbuttons for programming (0-F, ADR, NXT). + 4-digit LED display. + + Other options: + 0400-07FF Expansion RAM (8x 2112) + 0800-08FF Pulse for operation of an optional EPROM programmer + 0C00-0FFF ROM "MONA" (2708) + LEDs connected to all Address and Data Lines + LEDs connected to WAIT and FLAG lines. + Speaker with a LED wired across it. + PAUSE switch. + RUN/STOP switch. + STEP switch. + CLOCK switch. + + Cassette player connected to SENSE and FLAG lines. + + Keyboard encoder: AY-5-2376 (57 keys) + + CRT interface: (512 characters on a separate bus) + 2114 video ram (one half holds the lower 4 data bits, other half the upper bits) + 74LS175 holds the upper bits for the 74LS472 + 74LS472 Character Generator + + NOTE: a rom is missing, when the ADR button (- key) is pressed, + it causes a freeze in nodebug mode, and a crash in debug mode. + To see it, start in debug mode. g 6c. In the emulation, press the + minus key. The debugger will stop and you can see an instruction + referencing location 0100, which is in the missing rom. + + Keys: + 0-9,A-F hexadecimal numbers + UP - (NXT) to enter data and advance to the next address + MINUS - (ADR) to change the address to what is shown in the data side + Special keys: + Hold UP, hold 0, release UP, release 0 - execute program at the current address (i.e. 2xx) + Hold UP, hold 1, release UP, release 1 - execute program at address 0C00 (rom MONA) + Hold UP, hold 2, release UP, release 2 - play a tune with the keys + Hold UP, hold 3, release UP, release 3 - decrement the address by 2 + Hold MINUS, hold any hex key, release MINUS, release other key - execute program + at the current address-0x100 (i.e. 1xx). + + If you want to scan through other areas of memory (e.g. the roms), alter the + data at address 2F9 (high byte) and 2FA (low byte). + + How to Use: + The red digits are the address, and the orange digits are the data. + The address range is 200-2FF (the 2 isn't displayed). To select an address, + either press the UP key until you get there, or type the address and press + minus. The orange digits show the current data at that address. To alter + data, just type it in and press UP. + + To play the reflexes game, hold UP, press 1, release UP, release 1. + The display will show A--0 (or some random number in the last position). + Press any odd-numbered key (B is convenient), and read off the reaction time. + After a short delay it will show '--' again, this is the signal to react. + It doesn't seem to reset the counters each time around. + + TODO: + - Find missing roms + - Add optional hardware listed above + - Cassette is added, but no idea how to operate it. + + Thanks to Amigan site for various documents. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/s2650/s2650.h" +#include "sound/speaker.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "dolphunk.lh" + + +class dauphin_state : public driver_device +{ +public: + dauphin_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_speaker(*this, "speaker") + , m_cass(*this, "cassette") + { } + + DECLARE_READ8_MEMBER(cass_r); + DECLARE_WRITE_LINE_MEMBER(cass_w); + DECLARE_READ8_MEMBER(port07_r); + DECLARE_WRITE8_MEMBER(port00_w); + DECLARE_WRITE8_MEMBER(port06_w); + TIMER_DEVICE_CALLBACK_MEMBER(dauphin_c); +private: + UINT8 m_cass_data; + UINT8 m_last_key; + bool m_cass_state; + bool m_cassold; + bool m_speaker_state; + required_device m_maincpu; + required_device m_speaker; + required_device m_cass; +}; + +READ8_MEMBER( dauphin_state::cass_r ) +{ + return (m_cass->input() > 0.03) ? 1 : 0; +} + +WRITE_LINE_MEMBER( dauphin_state::cass_w ) +{ + m_cass_state = state; // get flag bit +} + +WRITE8_MEMBER( dauphin_state::port00_w ) +{ + output_set_digit_value(offset, data); +} + +WRITE8_MEMBER( dauphin_state::port06_w ) +{ + m_speaker_state ^=1; + m_speaker->level_w(m_speaker_state); +} + +READ8_MEMBER( dauphin_state::port07_r ) +{ + UINT8 keyin, i, data = 0x40; + + keyin = ioport("X0")->read(); + if (keyin != 0xff) + for (i = 0; i < 8; i++) + if BIT(~keyin, i) + data = i | 0xc0; + + keyin = ioport("X1")->read(); + if (keyin != 0xff) + for (i = 0; i < 8; i++) + if BIT(~keyin, i) + data = i | 0xc8; + + if (data == m_last_key) + data &= 0x7f; + else + m_last_key = data; + + data |= ioport("X2")->read(); + + return data; +} + +TIMER_DEVICE_CALLBACK_MEMBER(dauphin_state::dauphin_c) +{ + m_cass_data++; + + if (m_cass_state != m_cassold) + { + m_cass_data = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data, 1) ? -1.0 : +1.0); // 1000Hz + else + m_cass->output(BIT(m_cass_data, 0) ? -1.0 : +1.0); // 2000Hz +} + +static ADDRESS_MAP_START( dauphin_mem, AS_PROGRAM, 8, dauphin_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x01ff) AM_ROM + AM_RANGE( 0x0200, 0x02ff) AM_RAM + AM_RANGE( 0x0c00, 0x0fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dauphin_io, AS_IO, 8, dauphin_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_WRITE(port00_w) // 4-led display + AM_RANGE(0x06, 0x06) AM_WRITE(port06_w) // speaker (NOT a keyclick) + AM_RANGE(0x07, 0x07) AM_READ(port07_r) // pushbuttons + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) + AM_RANGE(0x102, 0x103) AM_NOP // stops error log filling up while using debug +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( dauphin ) + PORT_START("X0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("X2") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ADR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( dauphin, dauphin_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(dauphin_mem) + MCFG_CPU_IO_MAP(dauphin_io) + MCFG_S2650_FLAG_HANDLER(WRITELINE(dauphin_state, cass_w)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_dolphunk) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_TIMER_DRIVER_ADD_PERIODIC("dauphin_c", dauphin_state, dauphin_c, attotime::from_hz(4000)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( dauphin ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "dolphin_mo.rom", 0x0000, 0x0100, CRC(a8811f48) SHA1(233c629dc20fac286c8c1559e461bb0b742a675e) ) + // This one is used in winarcadia but it is a bad dump, we use the corrected one above + //ROM_LOAD( "dolphin_mo.rom", 0x0000, 0x0100, BAD_DUMP CRC(1ac4ac18) SHA1(62a63de6fcd6cd5fcee930d31c73fe603647f06c) ) + + ROM_LOAD( "dolphin_moni.rom", 0x0100, 0x0100, NO_DUMP ) + + //ROM_LOAD_OPTIONAL( "dolphin_mona.rom", 0x0c00, 0x0400, NO_DUMP ) + // This rom is a bugfixed and relocated version of the game found on the Amigan site + ROM_LOAD_OPTIONAL( "reflexes.bin", 0x0c00, 0x0400, CRC(14a1557d) SHA1(789d10551f1bb3472057901fa3cee0c6bfe220ac) ) + // This the original + //ROM_LOAD( "reflexes.bin", 0x0c00, 0x0072, CRC(c4bed94b) SHA1(cf525755a1dbce6a4681353be692ddf0346f323b) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, dauphin, 0, 0, dauphin, dauphin, driver_device, 0, "LCD EPFL Stoppani", "Dauphin", 0 ) diff --git a/src/mame/drivers/dps1.c b/src/mame/drivers/dps1.c new file mode 100644 index 00000000000..bb3a5b21746 --- /dev/null +++ b/src/mame/drivers/dps1.c @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert + +#include "emu.h" +#include "cpu/z80/z80.h" + +class dps1_state : public driver_device +{ +public: + dps1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + { } +}; + +static ADDRESS_MAP_START( dps1_mem, AS_PROGRAM, 8, dps1_state ) + AM_RANGE(0x0000, 0x03ff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x2000, 0x2fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dps1_io, AS_IO, 8, dps1_state ) +ADDRESS_MAP_END + +static INPUT_PORTS_START( dps1 ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( dps1, dps1_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(dps1_mem) + MCFG_CPU_IO_MAP(dps1_io) + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "dps1") +MACHINE_CONFIG_END + +ROM_START( dps1 ) + ROM_REGION( 0x400, "maincpu", 0 ) + ROM_LOAD( "boot 1280", 0x000, 0x400, CRC(9c2e98fa) SHA1(78e6c9d00aa6e8f6c4d3c65984cfdf4e99434c66) ) // actually on the FDC-2 board +ROM_END + +COMP( 1979, dps1, 0, 0, dps1, dps1, driver_device, 0, "Ithaca InterSystems", "DPS-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/dragon.c b/src/mame/drivers/dragon.c new file mode 100644 index 00000000000..61375867d28 --- /dev/null +++ b/src/mame/drivers/dragon.c @@ -0,0 +1,334 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + dragon.c + + Dragon + +***************************************************************************/ + +#include "includes/dragon.h" +#include "includes/dgnalpha.h" +#include "imagedev/cassette.h" +#include "formats/coco_cas.h" +#include "cpu/m6809/m6809.h" +#include "bus/coco/coco_232.h" +#include "bus/coco/coco_orch90.h" +#include "bus/coco/coco_pak.h" +#include "bus/coco/coco_fdc.h" +#include "bus/coco/coco_multi.h" +#include "formats/vdk_dsk.h" +#include "formats/dmk_dsk.h" +#include "imagedev/flopdrv.h" + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( dragon_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( dragon_mem, AS_PROGRAM, 8, dragon_state ) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +/* Dragon keyboard + + PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 + PA6: Ent Clr Brk N/c N/c N/c N/c Shift + PA5: X Y Z Up Dwn Lft Rgt Space + PA4: P Q R S T U V W + PA3: H I J K L M N O + PA2: @ A B C D E F G + PA1: 8 9 : ; , - . / + PA0: 0 1 2 3 4 5 6 7 + */ +static INPUT_PORTS_START( dragon32 ) + PORT_START("row0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("row1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("row2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("row3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("row4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("row5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("row6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x78, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + +static SLOT_INTERFACE_START(dragon_cart) + SLOT_INTERFACE("dragon_fdc", DRAGON_FDC) + SLOT_INTERFACE("sdtandy_fdc", SDTANDY_FDC) + SLOT_INTERFACE("pak", COCO_PAK) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( dragon_alpha_state::dragon_formats ) + FLOPPY_VDK_FORMAT, + FLOPPY_DMK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( dragon_floppies ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) + SLOT_INTERFACE("sd", FLOPPY_525_SD) + SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) + SLOT_INTERFACE("dd", FLOPPY_525_DD) + SLOT_INTERFACE("ssqd", FLOPPY_525_SSQD) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( dragon_base, dragon_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", M6809E, XTAL_4_433619MHz) + MCFG_CPU_PROGRAM_MAP(dragon_mem) + + // devices + MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia0_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia0_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia0_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia0_cb2_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia0_irq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia0_irq_b)) + + MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(coco_state, pia1_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(coco_state, pia1_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia1_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia1_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia1_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia1_cb2_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia1_firq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia1_firq_b)) + + MCFG_SAM6883_ADD(SAM_TAG, XTAL_4_433619MHz, MAINCPU_TAG, AS_PROGRAM) + MCFG_SAM6883_RES_CALLBACK(READ8(dragon_state, sam_read)) + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(coco_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_DEVICE_ADD(PRINTER_TAG, PRINTER, 0) + + // video hardware + MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, VDG_TAG) + + MCFG_DEVICE_ADD(VDG_TAG, MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_HSYNC_CALLBACK(WRITELINE(dragon_state, horizontal_sync)) + MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(dragon_state, field_sync)) + MCFG_MC6847_INPUT_CALLBACK(DEVREAD8(SAM_TAG, sam6883_device, display_read)) + + // sound hardware + MCFG_FRAGMENT_ADD( coco_sound ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dragon32, dragon_base ) + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("64K") + + // cartridge + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, "dragon_fdc") + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( dragon64, dragon_base, dragon64_state ) + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // cartridge + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, "dragon_fdc") + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + + // acia + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( d64plus, dragon_base, dragon64_state ) + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + + // cartridge + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, "dragon_fdc") + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + + // acia + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( dgnalpha, dragon_base, dragon_alpha_state ) + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // cartridge + MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, NULL) + MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) + MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) + MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + + // acia + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + + // floppy + MCFG_WD2797_ADD(WD2797_TAG, XTAL_1MHz) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(dragon_alpha_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dragon_alpha_state, fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", dragon_floppies, "qd", dragon_alpha_state::dragon_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", dragon_floppies, "qd", dragon_alpha_state::dragon_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":2", dragon_floppies, "qd", dragon_alpha_state::dragon_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":3", dragon_floppies, "qd", dragon_alpha_state::dragon_formats) + + // sound hardware + MCFG_SOUND_ADD(AY8912_TAG, AY8912, 1000000) + MCFG_AY8910_PORT_A_READ_CB(READ8(dragon_alpha_state, psg_porta_read)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(dragon_alpha_state, psg_porta_write)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + // pia 2 + MCFG_DEVICE_ADD( PIA2_TAG, PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(dragon_alpha_state, pia2_pa_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(dragon_alpha_state, pia2_firq_a)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(dragon_alpha_state, pia2_firq_b)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tanodr64, dragon64 ) + // cartridge + MCFG_DEVICE_MODIFY(CARTRIDGE_TAG) + MCFG_DEVICE_SLOT_INTERFACE(dragon_cart, "sdtandy_fdc", false) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(dragon32) + ROM_REGION(0xC000, "maincpu",0) + ROM_LOAD("d32.rom", 0x0000, 0x4000, CRC(e3879310) SHA1(f2dab125673e653995a83bf6b793e3390ec7f65a)) +ROM_END + +ROM_START(dragon64) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("d64_1.rom", 0x0000, 0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042)) + ROM_LOAD("d64_2.rom", 0x8000, 0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e)) +ROM_END + +ROM_START(dragon200) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ic18.rom", 0x0000, 0x4000, CRC(84f68bf9) SHA1(1983b4fb398e3dd9668d424c666c5a0b3f1e2b69)) + ROM_LOAD( "ic17.rom", 0x8000, 0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e)) +ROM_END + +ROM_START(dragon200e) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ic18_v1.4e.ic34", 0x0000, 0x4000, CRC(95af0a0a) SHA1(628543ee8b47a56df2b2175cfb763c0051517b90)) + ROM_LOAD( "ic17_v1.4e.ic37", 0x8000, 0x4000, CRC(48b985df) SHA1(c25632f3c2cfd1af3ee26b2f233a1ce1eccc365d)) + ROM_REGION( 0x1000, "gfx", ROMREGION_ERASEFF ) + ROM_LOAD( "rom26.ic1", 0x0000, 0x1000, CRC(565724bc) SHA1(da5b756ba2a9c9ecebaa7daa8ba8bfd984d56a6f)) +ROM_END + +ROM_START(d64plus) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("d64_1.rom", 0x0000, 0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042)) + ROM_LOAD("d64_2.rom", 0x8000, 0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e)) +ROM_END + +ROM_START(tanodr64) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("d64_1.rom", 0x0000, 0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042)) + ROM_LOAD("d64_2.rom", 0x8000, 0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e)) +ROM_END + +ROM_START(dgnalpha) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("alpha_bt.rom", 0x2000, 0x2000, CRC(c3dab585) SHA1(4a5851aa66eb426e9bb0bba196f1e02d48156068)) + ROM_LOAD("alpha_ba.rom", 0x8000, 0x4000, CRC(84f68bf9) SHA1(1983b4fb398e3dd9668d424c666c5a0b3f1e2b69)) +ROM_END + + +COMP( 1982, dragon32, coco, 0, dragon32, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 32", 0) +COMP( 1983, dragon64, coco, 0, dragon64, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 64", 0) +COMP( 1983, dragon200, coco, 0, dragon64, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 200", 0) +COMP( 1983, dragon200e, coco, 0, dragon64, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 200-E", 0) +COMP( 1983, d64plus, coco, 0, d64plus, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 64 Plus", 0) +COMP( 1983, tanodr64, coco, 0, tanodr64, dragon32, driver_device, 0, "Dragon Data Ltd / Tano Ltd", "Tano Dragon 64 (NTSC)", 0) +COMP( 1984, dgnalpha, coco, 0, dgnalpha, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon Alpha Prototype", 0) diff --git a/src/mame/drivers/dsb46.c b/src/mame/drivers/dsb46.c new file mode 100644 index 00000000000..a0066e94d80 --- /dev/null +++ b/src/mame/drivers/dsb46.c @@ -0,0 +1,122 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Robbbert +/******************************************************************************************************************** + +2013-07-31 Skeleton Driver [Curt Coder] +2013-07-31 Connected to terminal [Robbbert] + + +The photos show 3 boards: +- A scsi board (all 74-series TTL) +- CPU board (64k dynamic RAM, Z80A CPU, 2x Z80CTC, 2x Z80SIO/0, MB8877A, Z80DMA, 4x MC1488, + 4x MC1489, XTALS 1.8432MHz and 24MHz) +- ADES board (Adaptec Inc AIC-100, AIC-250, AIC-300, Intel D8086AH, unknown crystal) + +Both roms contain Z80 code. + + +********************************************************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class dsb46_state : public driver_device +{ +public: + dsb46_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_READ8_MEMBER(port00_r); + DECLARE_READ8_MEMBER(port01_r); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE8_MEMBER(port1a_w); + DECLARE_DRIVER_INIT(dsb46); + DECLARE_MACHINE_RESET(dsb46); +private: + UINT8 m_term_data; + required_device m_maincpu; + required_device m_terminal; +}; + +static ADDRESS_MAP_START( dsb46_mem, AS_PROGRAM, 8, dsb46_state ) + AM_RANGE(0x0000, 0x07ff) AM_READ_BANK("read") AM_WRITE_BANK("write") + AM_RANGE(0x0800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dsb46_io, AS_IO, 8, dsb46_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READ(port00_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x01, 0x01) AM_READ(port01_r) + AM_RANGE(0x1a, 0x1a) AM_WRITE(port1a_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( dsb46 ) +INPUT_PORTS_END + +DRIVER_INIT_MEMBER(dsb46_state, dsb46) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("read")->configure_entry(0, &RAM[0x10000]); + membank("read")->configure_entry(1, &RAM[0x00000]); + membank("write")->configure_entry(0, &RAM[0x00000]); +} + +MACHINE_RESET_MEMBER( dsb46_state,dsb46 ) +{ + membank("read")->set_entry(0); + membank("write")->set_entry(0); + m_term_data = 0; + m_maincpu->reset(); +} + +WRITE8_MEMBER( dsb46_state::port1a_w ) +{ + membank("read")->set_entry(data & 1); +} + +READ8_MEMBER( dsb46_state::port01_r ) +{ + return (m_term_data) ? 5 : 4; +} + +READ8_MEMBER( dsb46_state::port00_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( dsb46_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( dsb46, dsb46_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(dsb46_mem) + MCFG_CPU_IO_MAP(dsb46_io) + MCFG_MACHINE_RESET_OVERRIDE(dsb46_state, dsb46) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dsb46_state, kbd_put)) +MACHINE_CONFIG_END + +ROM_START( dsb46 ) + ROM_REGION( 0x10800, "maincpu", 0 ) + ROM_LOAD( "1538a.bin", 0x10000, 0x800, CRC(65b3e26e) SHA1(afe1f03f266b7d13fdb1f1bc6762df5e0aa5c764) ) + + ROM_REGION( 0x4000, "ades", 0 ) + ROM_LOAD( "ades.bin", 0x0000, 0x4000, CRC(d374abf0) SHA1(331f51a2bb81375aeffbe63c1ebc1d7cd779b9c3) ) +ROM_END + +COMP( 198?, dsb46, 0, 0, dsb46, dsb46, dsb46_state, dsb46, "Davidge", "DSB-4/6", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/dual68.c b/src/mame/drivers/dual68.c new file mode 100644 index 00000000000..d778d0c4f6a --- /dev/null +++ b/src/mame/drivers/dual68.c @@ -0,0 +1,115 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Dual Systems 68000 + + 09/12/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "cpu/i8085/i8085.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class dual68_state : public driver_device +{ +public: + dual68_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_p_ram(*this, "p_ram") + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_WRITE8_MEMBER( kbd_put ); + DECLARE_WRITE16_MEMBER( dual68_terminal_w ); + //UINT8 m_term_data; + required_shared_ptr m_p_ram; + virtual void machine_reset(); +}; + + + +WRITE16_MEMBER( dual68_state::dual68_terminal_w ) +{ + m_terminal->write(space, 0, data >> 8); +} + +static ADDRESS_MAP_START(dual68_mem, AS_PROGRAM, 16, dual68_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x0000ffff) AM_RAM AM_SHARE("p_ram") + AM_RANGE(0x00080000, 0x00081fff) AM_ROM AM_REGION("user1",0) + AM_RANGE(0x007f0000, 0x007f0001) AM_WRITE(dual68_terminal_w) + AM_RANGE(0x00800000, 0x00801fff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sio4_mem, AS_PROGRAM, 8, dual68_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sio4_io, AS_IO, 8, dual68_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( dual68 ) +INPUT_PORTS_END + + +void dual68_state::machine_reset() +{ + UINT8* user1 = memregion("user1")->base(); + + memcpy((UINT8*)m_p_ram.target(),user1,0x2000); + + m_maincpu->reset(); +} + +WRITE8_MEMBER( dual68_state::kbd_put ) +{ + //m_term_data = data; +} + +static MACHINE_CONFIG_START( dual68, dual68_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz / 2) + MCFG_CPU_PROGRAM_MAP(dual68_mem) + + MCFG_CPU_ADD("siocpu", I8085A, XTAL_16MHz / 8) + MCFG_CPU_PROGRAM_MAP(sio4_mem) + MCFG_CPU_IO_MAP(sio4_io) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dual68_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( dual68 ) + ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v1", "2 * 4KB" ) + ROMX_LOAD( "dual_cpu68000_1.bin", 0x0001, 0x1000, CRC(d1785c08) SHA1(73c1f68875f1d8eb5e92f4347f509c61103da90f),ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "dual_cpu68000_2.bin", 0x0000, 0x1000, CRC(b9f1ba3c) SHA1(8fd02936ad06d5a22d435d96f06e2442fc7d00ec),ROM_SKIP(1) | ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "v2", "2 * 2KB" ) + ROMX_LOAD( "dual.u2.bin", 0x0001, 0x0800, CRC(e9c44fcd) SHA1(d5cc609d6f5e6745d5f0af1aa6dc66012333ed60),ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "dual.u3.bin", 0x0000, 0x0800, CRC(827b049f) SHA1(8209f8ab3d1068e5bab51e7eb12be46d4ea28354),ROM_SKIP(1) | ROM_BIOS(2)) + + ROM_REGION( 0x10000, "siocpu", ROMREGION_ERASEFF ) + ROM_LOAD( "dual_sio4.bin", 0x0000, 0x0800, CRC(6b0a1965) SHA1(5d2dc6c6a315293ded4b9fc95c8ac1599bf31dd3)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, dual68, 0, 0, dual68, dual68, driver_device, 0, "Dual Systems Corporation", "Dual Systems 68000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/dvk_kcgd.c b/src/mame/drivers/dvk_kcgd.c new file mode 100644 index 00000000000..2903a402680 --- /dev/null +++ b/src/mame/drivers/dvk_kcgd.c @@ -0,0 +1,384 @@ +/*************************************************************************** + + KCGD (Kontroller Cvetnogo Graficheskogo Displeya = Colour Graphics + Display Controller), a replacement for KSM (dvk_ksm.c) in later + models of DVK desktops. + + MPI (Q-Bus clone) board. Interfaces with MS7004 (DEC LK201 workalike) + keyboard, mouse, and monochrome or color CRT. + + To do: + - K1801VM2 CPU core (interrupts and EVNT pin, full EIS set, other insns) + - Everything else :-) + +****************************************************************************/ + +#include "emu.h" + +#include "bus/rs232/rs232.h" +#include "cpu/t11/t11.h" +#include "machine/clock.h" +#include "machine/ms7004.h" + +#define KCGD_TOTAL_HORZ 1000 // XXX verify +#define KCGD_DISP_HORZ 800 +#define KCGD_HORZ_START 200 // XXX verify + +#define KCGD_TOTAL_VERT 600 // XXX verify +#define KCGD_DISP_VERT 480 +#define KCGD_VERT_START 100 // XXX verify + +#define KCGD_STATUS_PAGE 0 +#define KCGD_STATUS_INTERLACE 1 +#define KCGD_STATUS_TIMER_INT 5 +#define KCGD_STATUS_MODE_INT 6 +#define KCGD_STATUS_MODE_LAST 7 +#define KCGD_STATUS_TIMER_VAL 15 + +#define KCGD_PAGE_0 015574 +#define KCGD_PAGE_1 005574 + +#define VERBOSE_DBG 1 /* general debug messages */ + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + + +class kcgd_state : public driver_device +{ +public: + kcgd_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), +// m_ms7004(*this, "ms7004"), + m_palette(*this, "palette"), + m_screen(*this, "screen") + { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback); + DECLARE_PALETTE_INIT(kcgd); + + enum + { + TIMER_ID_VSYNC_ON, + TIMER_ID_VSYNC_OFF, + TIMER_ID_500HZ + }; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); + DECLARE_WRITE_LINE_MEMBER(write_line_clock); + + DECLARE_READ16_MEMBER(vram_addr_r); + DECLARE_READ16_MEMBER(vram_data_r); + DECLARE_READ16_MEMBER(vram_mmap_r); + DECLARE_WRITE16_MEMBER(vram_addr_w); + DECLARE_WRITE16_MEMBER(vram_data_w); + DECLARE_WRITE16_MEMBER(vram_mmap_w); + DECLARE_READ16_MEMBER(status_r); + DECLARE_WRITE16_MEMBER(status_w); + DECLARE_READ8_MEMBER(palette_index_r); + DECLARE_READ8_MEMBER(palette_data_r); + DECLARE_WRITE8_MEMBER(palette_index_w); + DECLARE_WRITE8_MEMBER(palette_data_w); + + emu_timer *m_vsync_on_timer; + emu_timer *m_vsync_off_timer; + emu_timer *m_500hz_timer; + +private: + void draw_scanline(UINT16 *p, UINT16 offset); + rectangle m_tmpclip; + bitmap_ind16 m_tmpbmp; + + struct { + UINT16 status; // 167770 + UINT8 control; // 167772 + int palette_index, vram_addr; + UINT8 palette[16]; + } m_video; + UINT32 *m_videoram; + +protected: + required_device m_maincpu; +// required_device m_ms7004; + required_device m_palette; + required_device m_screen; +}; + +static ADDRESS_MAP_START( kcgd_mem, AS_PROGRAM, 16, kcgd_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE (0000000, 0077777) AM_READWRITE(vram_mmap_r, vram_mmap_w) + AM_RANGE (0100000, 0157777) AM_ROM + AM_RANGE (0160000, 0160001) AM_MIRROR(03774) AM_READWRITE(vram_addr_r, vram_addr_w) + AM_RANGE (0160002, 0160003) AM_MIRROR(03774) AM_READWRITE(vram_data_r, vram_data_w) + AM_RANGE (0167770, 0167771) AM_READWRITE(status_r, status_w) + AM_RANGE (0167772, 0167773) AM_READWRITE8(palette_index_r, palette_index_w, 0x00ff) // reads always return 0 + AM_RANGE (0167772, 0167773) AM_READWRITE8(palette_data_r, palette_data_w, 0xff00) +// AM_RANGE (0176560, 0176567) AM_RAM // USART2 -- host +// AM_RANGE (0177560, 0177567) AM_RAM // USART3 -- keyboard +ADDRESS_MAP_END + +void kcgd_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { +/* + case TIMER_ID_VSYNC_ON: + m_maincpu->set_input_line(INPUT_LINE_EVNT, ASSERT_LINE); + break; + + case TIMER_ID_VSYNC_OFF: + m_maincpu->set_input_line(INPUT_LINE_EVNT, CLEAR_LINE); + break; +*/ + case TIMER_ID_500HZ: + m_video.status ^= (1 << KCGD_STATUS_TIMER_VAL); + break; + } +} + +void kcgd_state::machine_reset() +{ + memset(&m_video, 0, sizeof(m_video)); +} + +void kcgd_state::video_start() +{ +// screen_device *screen = machine().device("screen"); + + // 64 kwords, word size is 17 bits + m_videoram = auto_alloc_array(machine(), UINT32, 65536); + + m_tmpclip = rectangle(0, KCGD_DISP_HORZ-1, 0, KCGD_DISP_VERT-1); + m_tmpbmp.allocate(KCGD_DISP_HORZ, KCGD_DISP_VERT); +/* + m_vsync_on_timer = timer_alloc(TIMER_ID_VSYNC_ON); + m_vsync_on_timer->adjust(screen->time_until_pos(0, 0), 0, screen->frame_period()); + + m_vsync_off_timer = timer_alloc(TIMER_ID_VSYNC_OFF); + m_vsync_off_timer->adjust(screen->time_until_pos(16, 0), 0, screen->frame_period()); +*/ + m_500hz_timer = timer_alloc(TIMER_ID_500HZ); + m_500hz_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500)); +} + +PALETTE_INIT_MEMBER(kcgd_state, kcgd) +{ + for (int i = 0; i < 16; i++) + { + palette.set_pen_color(i, i?i:255, i?i:255, i?i:255); + } +} + +/* + VRAM is 128K and is word-addressable, so address fits into 16 bits. + Low 32K of VRAM are not used to store pixel data -- XXX. +*/ +WRITE16_MEMBER(kcgd_state::vram_addr_w) +{ + DBG_LOG(3,"VRAM WA", ("%06o\n", data)); + m_video.vram_addr = data; +} + +READ16_MEMBER(kcgd_state::vram_addr_r) +{ + DBG_LOG(3,"VRAM RA", ("\n")); + return m_video.vram_addr; +} + +WRITE16_MEMBER(kcgd_state::vram_data_w) +{ + DBG_LOG(1,"VRAM W2", ("%06o <- %04XH\n", m_video.vram_addr, data)); + m_videoram[m_video.vram_addr] = data | (BIT(m_video.control, 7) << 16); +} + +READ16_MEMBER(kcgd_state::vram_data_r) +{ + DBG_LOG(2,"VRAM R2", ("%06o\n", m_video.vram_addr)); + m_video.status = (m_video.status & 0xff7f) | (BIT(m_videoram[m_video.vram_addr], 16) << 7); + return (UINT16) (m_videoram[m_video.vram_addr] & 0xffff); +} + +WRITE16_MEMBER(kcgd_state::vram_mmap_w) +{ + DBG_LOG(3,"VRAM W1", ("%06o <- %04XH\n", offset, data)); + m_videoram[offset] = data | (BIT(m_video.control, 7) << 16); +} + +READ16_MEMBER(kcgd_state::vram_mmap_r) +{ + DBG_LOG(3,"VRAM R1", ("%06o\n", offset)); + return (UINT16) (m_videoram[offset] & 0xffff); +} + +WRITE16_MEMBER(kcgd_state::status_w) +{ + DBG_LOG(1,"Status W", ("data %04XH (useful %02XH)\n", data, data & 0x63)); + // bits 7 and 15 are read-only + m_video.status = (m_video.status & 0x8080) | (data & 0x7f7f); +} + +READ16_MEMBER(kcgd_state::status_r) +{ + UINT16 data = m_video.status ^ (BIT(m_video.control, 6) << 7); + DBG_LOG(1,"Status R", ("data %04X index %d\n", data, m_video.palette_index)); + return data; +} + +WRITE8_MEMBER(kcgd_state::palette_index_w) +{ + m_video.control = data; + m_video.palette_index = ((data >> 2) & 15); + DBG_LOG(1,"Palette index, Control W", ("data %02XH index %d\n", data, m_video.palette_index)); +} + +WRITE8_MEMBER(kcgd_state::palette_data_w) +{ + DBG_LOG(1,"Palette data W", ("data %02XH index %d\n", data, m_video.palette_index)); + m_video.palette[m_video.palette_index] = data; + m_palette->set_pen_color(m_video.palette_index, + 85*(data & 3), 85*((data >> 2) & 3), 85*((data >> 4) & 3)); +} + +READ8_MEMBER(kcgd_state::palette_index_r) +{ + return 0; +} + +READ8_MEMBER(kcgd_state::palette_data_r) +{ + DBG_LOG(1,"Palette data R", ("index %d\n", m_video.palette_index)); + return m_video.palette[m_video.palette_index]; +} + +/* + Raster sizes are: + - 800(400)x480 in hires(lores) 60 Hz interlaced mode + - 800(400)x240 in hires(lores) 30 Hz progressive mode + + Video memory is 17 bits wide (bit 16 indicates hi/lo res mode for each word, + host writes it separately (via bit 7 in 167772). +*/ + +void kcgd_state::draw_scanline(UINT16 *p, UINT16 offset) +{ + int i; + + for ( i = 0; i < 100; i++ ) + { + UINT32 data = m_videoram[ offset++ ]; + if (BIT(data, 16)) { + *p = ( data >> 12) & 0x0F; p++; + *p = ( data >> 12) & 0x0F; p++; + *p = ( data >> 8 ) & 0x0F; p++; + *p = ( data >> 8 ) & 0x0F; p++; + *p = ( data >> 4 ) & 0x0F; p++; + *p = ( data >> 4 ) & 0x0F; p++; + *p = data & 0x0F; p++; + *p = data & 0x0F; p++; + } else { + *p = 5*(( data >> 14) & 0x03); p++; + *p = 5*(( data >> 12) & 0x03); p++; + *p = 5*(( data >> 10) & 0x03); p++; + *p = 5*(( data >> 8 ) & 0x03); p++; + *p = 5*(( data >> 6 ) & 0x03); p++; + *p = 5*(( data >> 4 ) & 0x03); p++; + *p = 5*(( data >> 2 ) & 0x03); p++; + *p = 5*( data & 0x03); p++; + } + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(kcgd_state::scanline_callback) +{ + UINT16 y = m_screen->vpos(), offset; + + if (y < KCGD_VERT_START) return; + y -= KCGD_VERT_START; + if (y >= KCGD_DISP_VERT) return; + + offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1); + + DBG_LOG(2,"scanline_cb", ("frame %" I64FMT "d y %.3d page %d offset %04X *offset %04X\n", + m_screen->frame_number(), BIT(m_video.status, KCGD_STATUS_PAGE), + y, offset + y, m_videoram[offset + y])); + + draw_scanline(&m_tmpbmp.pix16(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]); +} + +UINT32 kcgd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_tmpbmp, 0, 0, KCGD_HORZ_START, KCGD_VERT_START, cliprect); + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout kcgd_charlayout = +{ + 8, 10, /* 8x10 pixels */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 8*10 /* every char takes 10 bytes */ +}; + +static GFXDECODE_START( kcgd ) + GFXDECODE_ENTRY("maincpu", 0112236, kcgd_charlayout, 0, 1) +GFXDECODE_END + +static MACHINE_CONFIG_START( kcgd, kcgd_state ) + MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_30_8MHz/4) + MCFG_CPU_PROGRAM_MAP(kcgd_mem) + MCFG_T11_INITIAL_MODE(0100000) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", kcgd_state, scanline_callback, attotime::from_hz(50*28*11)) // XXX verify + MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_30_8MHz/KCGD_HORZ_START)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(kcgd_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_30_8MHz, KCGD_TOTAL_HORZ, KCGD_HORZ_START, + KCGD_HORZ_START+KCGD_DISP_HORZ, KCGD_TOTAL_VERT, KCGD_VERT_START, + KCGD_VERT_START+KCGD_DISP_VERT); + + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(kcgd_state, kcgd) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", kcgd) +#if 0 + MCFG_DEVICE_ADD("ms7004", MS7004, 0) + MCFG_MS7004_TX_HANDLER(DEVWRITELINE("i8251kbd", i8251_device, write_rxd)) + + MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4800*16) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(kcgd_state, write_keyboard_clock)) +#endif +MACHINE_CONFIG_END + +ROM_START( dvk_kcgd ) + ROM_REGION16_BE(0x100000,"maincpu", ROMREGION_ERASE00) + ROM_DEFAULT_BIOS("181") + ROM_SYSTEM_BIOS(0, "181", "mask 181") + ROMX_LOAD("kr1801re2-181.bin", 0100000, 020000, CRC(acac124f) SHA1(412c3eb71bece6f791fc5a9d707cf4692fd0b45b), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "182", "mask 182") + ROMX_LOAD("kr1801re2-182.bin", 0100000, 020000, CRC(3ca2921a) SHA1(389b30c40ed7e41dae71d58c7bff630359a48153), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, dvk_kcgd, 0, 0, kcgd, 0, driver_device, 0, "USSR", "DVK KCGD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/dvk_ksm.c b/src/mame/drivers/dvk_ksm.c new file mode 100644 index 00000000000..36eaaa241fc --- /dev/null +++ b/src/mame/drivers/dvk_ksm.c @@ -0,0 +1,418 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + KSM (Kontroller Simvolnogo Monitora = Character Display Controller), + a single-board replacement for standalone 15IE-00-013 terminal (ie15.c) + in later-model DVK desktops. + + MPI (Q-Bus clone) board, consumes only power from the bus. + Interfaces with MS7004 (DEC LK201 workalike) keyboard and monochrome CRT. + + Hardware revisions (XXX verify everything): + - 7.102.076 -- has DIP switches, SRAM at 0x2000, model name "KSM" + - 7.102.228 -- no DIP switches, SRAM at 0x2100, model name "KSM-01" + + Emulates a VT52 without copier (ESC Z response is ESC / M), with + Hold Screen mode and Graphics character set (but it is unique and + mapped to a different range -- 100..137). + + F4 + 0..9 on numeric keypad = setup mode. 0 changes serial port speed, + 1..9 toggle one of mode bits: + + 1 XON/XOFF 0: Off 1: On + 2 Character set 0: N0/N1 2: N2 + 3 Auto LF 0: Off 1: On + 4 Auto repeat 0: On 1: Off + 5 Auto wraparound 0: On 1: Off + 6 Interpret controls 0: Interpret 1: Display + 7 Parity check 0: Off 1: On + 8 Parity bits 0: None 1: Even + 9 Stop bits + + N0/N1 charset has regular ASCII in C0 page and Cyrillic in C1 page, + switching between them via SI/SO. N2 charset has uppercase Cyrillic + chars in place of lowercase Latin ones. + + F1 toggles Hold Screen mode. + F9 resets terminal (clears memory). + F20 toggles on/off-line mode. + + Terminfo description would be something like + +ksm|DVK KSM, + am, bw, dch1=\EP, ich1=\EQ, + acsc=hRiTjXkClJmFnNqUtEuPv\174wKxW.M\054Q\055S\053\136~_{@}Z0\177, + use=vt52, + + To do: + - make Caps Lock work + - verify if pixel stretching is done by hw + - verify details of hw revisions + - baud rate selection (missing feature in bitbanger) + +****************************************************************************/ + +#include "emu.h" + +#include "bus/rs232/rs232.h" +#include "cpu/i8085/i8085.h" +#include "machine/clock.h" +#include "machine/i8251.h" +#include "machine/i8255.h" +#include "machine/ms7004.h" +#include "machine/pic8259.h" + +#define SCREEN_PAGE (80*48) + +#define KSM_TOTAL_HORZ 1000 +#define KSM_DISP_HORZ 800 +#define KSM_HORZ_START 200 + +#define KSM_TOTAL_VERT 28*11 +#define KSM_DISP_VERT 25*11 +#define KSM_VERT_START 2*11 + +#define KSM_STATUSLINE_TOTAL 11 +#define KSM_STATUSLINE_VRAM 0xF8B0 + +#define VERBOSE_DBG 0 /* general debug messages */ + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + + +class ksm_state : public driver_device +{ +public: + ksm_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_pic8259(*this, "pic8259"), + m_i8251line(*this, "i8251line"), + m_rs232(*this, "rs232"), + m_i8251kbd(*this, "i8251kbd"), + m_ms7004(*this, "ms7004"), + m_screen(*this, "screen") + { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER( scanline_callback ); + + DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); + DECLARE_WRITE_LINE_MEMBER(write_line_clock); + + DECLARE_WRITE8_MEMBER(ksm_ppi_porta_w); + DECLARE_WRITE8_MEMBER(ksm_ppi_portc_w); + +private: + UINT32 draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline); + rectangle m_tmpclip; + bitmap_ind16 m_tmpbmp; + + const UINT8 *m_p_chargen; + struct { + UINT8 line; + UINT16 ptr; + } m_video; + +protected: + required_shared_ptr m_p_videoram; + required_device m_maincpu; + required_device m_pic8259; + required_device m_i8251line; + required_device m_rs232; + required_device m_i8251kbd; + required_device m_ms7004; + required_device m_screen; +}; + +static ADDRESS_MAP_START( ksm_mem, AS_PROGRAM, 8, ksm_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE (0x0000, 0x0fff) AM_ROM + AM_RANGE (0x2000, 0x21ff) AM_RAM + AM_RANGE (0xc000, 0xffff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ksm_io, AS_IO, 8, ksm_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE (0x5e, 0x5f) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) + AM_RANGE (0x6e, 0x6e) AM_DEVREADWRITE("i8251kbd", i8251_device, data_r, data_w) + AM_RANGE (0x6f, 0x6f) AM_DEVREADWRITE("i8251kbd", i8251_device, status_r, control_w) + AM_RANGE (0x76, 0x76) AM_DEVREADWRITE("i8251line", i8251_device, data_r, data_w) + AM_RANGE (0x77, 0x77) AM_DEVREADWRITE("i8251line", i8251_device, status_r, control_w) + AM_RANGE (0x78, 0x7b) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ksm ) + PORT_START("SA1") + PORT_DIPNAME(0x01, 0x01, "Stop bits") + PORT_DIPSETTING(0x00, "2 bits") + PORT_DIPSETTING(0x01, "1 bit") + PORT_DIPNAME(0x02, 0x00, "Parity bits") + PORT_DIPSETTING(0x00, "0 bits") + PORT_DIPSETTING(0x02, "1 bit") + PORT_DIPNAME(0x04, 0x00, "Parity check") + PORT_DIPSETTING(0x00, "Off") + PORT_DIPSETTING(0x04, "On") + PORT_DIPNAME(0x08, 0x00, "Interpret controls") + PORT_DIPSETTING(0x00, "Interpret") + PORT_DIPSETTING(0x08, "Display") + PORT_DIPNAME(0x10, 0x00, "Auto wraparound") + PORT_DIPSETTING(0x00, "On") + PORT_DIPSETTING(0x10, "Off") + PORT_DIPNAME(0x20, 0x00, "Auto repeat") + PORT_DIPSETTING(0x00, "On") + PORT_DIPSETTING(0x20, "Off") + PORT_DIPNAME(0x40, 0x00, "Auto CR/LF") + PORT_DIPSETTING(0x00, "Off") + PORT_DIPSETTING(0x40, "On") + PORT_DIPNAME(0x80, 0x00, "Character set") + PORT_DIPSETTING(0x00, "KOI-8 N0/N1") + PORT_DIPSETTING(0x80, "KOI-8 N2") + PORT_START("SA2") + PORT_DIPNAME(0x01, 0x00, "XON/XOFF") + PORT_DIPSETTING(0x00, "Off") + PORT_DIPSETTING(0x01, "On") + PORT_DIPNAME(0x0E, 0x00, "Baud rate") + PORT_DIPSETTING(0x00, "9600") + PORT_DIPSETTING(0x02, "4800") + PORT_DIPSETTING(0x04, "2400") + PORT_DIPSETTING(0x06, "1200") + PORT_DIPSETTING(0x08, "600") + PORT_DIPSETTING(0x0A, "300") + PORT_DIPSETTING(0x0C, "150") + PORT_DIPSETTING(0x0E, "75") +INPUT_PORTS_END + +void ksm_state::machine_reset() +{ + memset(&m_video, 0, sizeof(m_video)); +} + +void ksm_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); + + m_tmpclip = rectangle(0, KSM_DISP_HORZ-1, 0, KSM_DISP_VERT-1); + m_tmpbmp.allocate(KSM_DISP_HORZ, KSM_DISP_VERT); +} + +WRITE8_MEMBER(ksm_state::ksm_ppi_porta_w) +{ + DBG_LOG(1,"PPI port A", ("line %d\n", data)); + m_video.line = data; +} + +WRITE8_MEMBER(ksm_state::ksm_ppi_portc_w) +{ + DBG_LOG(1,"PPI port C", ("blink %d speed %d\n", BIT(data, 7), ((data >> 4) & 7) )); +} + +WRITE_LINE_MEMBER(ksm_state::write_keyboard_clock) +{ +// KSM never sends data to keyboard +// m_i8251kbd->write_txc(state); + m_i8251kbd->write_rxc(state); +} + +WRITE_LINE_MEMBER(ksm_state::write_line_clock) +{ + m_i8251line->write_txc(state); + m_i8251line->write_rxc(state); +} + +/* + Raster size is 28x11 scan lines. + XXX VBlank is active for 2 topmost on-screen rows and 1 at the bottom. + + Usable raster is 800 x 275 pixels (80 x 25 characters). 24 lines are + available to the user and 25th (topmost) line is the status line. + Status line displays current serial port speed and 9 setup bits. + + No character attributes are available, but in 'display controls' mode + control characters stored in memory are shown as blinking chars. + + Character cell is 10 x 11; character generator provides 7 x 8 of that. + 3 extra horizontal pixels are always XXX blank. Blinking XXX cursor may be + displayed on 3 extra scan lines. +*/ + +UINT32 ksm_state::draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline) +{ + UINT8 gfx, fg, bg, ra, blink; + UINT16 x, chr; + + bg = 0; fg = 1; ra = scanline % 8; + blink = (m_screen->frame_number() % 10) > 4; + if (scanline > 7) { + offset -= 0x2000; + } + + for (x = offset; x < offset + 80; x++) + { + chr = m_p_videoram[x] << 3; + gfx = m_p_chargen[chr | ra]; + + if ((scanline > 7 && blink) || ((chr < (0x20<<3)) && !blink)) + gfx = 0; + + *p++ = BIT(gfx, 6) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 0) ? fg : bg; + *p++ = bg; + *p++ = bg; + *p++ = bg; + } + return 0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) +{ + UINT16 y = m_screen->vpos(); + UINT16 offset; + + DBG_LOG(2,"scanline_cb", + ("addr %02x frame %d x %.4d y %.3d row %.2d\n", + m_video.line, (int)m_screen->frame_number(), m_screen->hpos(), y, y%11)); + + if (y < KSM_VERT_START) return; + y -= KSM_VERT_START; + if (y >= KSM_DISP_VERT) return; + + if (y < KSM_STATUSLINE_TOTAL) { + offset = KSM_STATUSLINE_VRAM - 0xC000; + } else { + offset = 0x2000 + 0x30 + (((m_video.line + y/11 - 1) % 48) << 7); + } + + draw_scanline(&m_tmpbmp.pix16(y), offset, y%11); +} + +UINT32 ksm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_tmpbmp, 0, 0, KSM_HORZ_START, KSM_VERT_START, cliprect); + return 0; +} + + +/* F4 Character Displayer */ +static const gfx_layout ksm_charlayout = +{ + 7, 8, /* 7x8 pixels in 10x11 cell */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( ksm ) + GFXDECODE_ENTRY("chargen", 0x0000, ksm_charlayout, 0, 1) +GFXDECODE_END + +static MACHINE_CONFIG_START( ksm, ksm_state ) + MCFG_CPU_ADD("maincpu", I8080, XTAL_15_4MHz/10) + MCFG_CPU_PROGRAM_MAP(ksm_mem) + MCFG_CPU_IO_MAP(ksm_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", ksm_state, scanline_callback, attotime::from_hz(50*28*11)) + MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_15_4MHz/KSM_HORZ_START)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(ksm_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_15_4MHz, KSM_TOTAL_HORZ, KSM_HORZ_START, + KSM_HORZ_START+KSM_DISP_HORZ, KSM_TOTAL_VERT, KSM_VERT_START, + KSM_VERT_START+KSM_DISP_VERT); + + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ksm) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), VCC, NULL ) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(ksm_state, ksm_ppi_porta_w)) + MCFG_I8255_IN_PORTB_CB(IOPORT("SA1")) + MCFG_I8255_IN_PORTC_CB(IOPORT("SA2")) + MCFG_I8255_OUT_PORTC_CB(WRITE8(ksm_state, ksm_ppi_portc_w)) + + // serial connection to host + MCFG_DEVICE_ADD( "i8251line", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251line", i8251_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("i8251line", i8251_device, write_cts)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251line", i8251_device, write_dsr)) + + MCFG_DEVICE_ADD("line_clock", CLOCK, 9600*16) // 8251 is set to /16 on the clock input + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ksm_state, write_line_clock)) + + // serial connection to MS7004 keyboard + MCFG_DEVICE_ADD( "i8251kbd", I8251, 0) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) + + MCFG_DEVICE_ADD("ms7004", MS7004, 0) + MCFG_MS7004_TX_HANDLER(DEVWRITELINE("i8251kbd", i8251_device, write_rxd)) + + // baud rate is supposed to be 4800 but keyboard is slightly faster + MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4960*16) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ksm_state, write_keyboard_clock)) +MACHINE_CONFIG_END + + +/* + Assumes that SRAM is at 0x2000, which is where technical manual puts it. + Chargen has 1 missing pixel in 'G' character. +*/ +ROM_START( dvk_ksm ) + ROM_REGION(0x1000, "maincpu", ROMREGION_ERASE00) + ROM_LOAD( "ksm_04_rom0_d32.bin", 0x0000, 0x0800, CRC(6ad62715) SHA1(20f8f95119bc7fc6e0f16c67864e339a86edb44d)) + ROM_LOAD( "ksm_05_rom1_d33.bin", 0x0800, 0x0800, CRC(5b29bcd2) SHA1(1f4f82c2f88f1e8615ec02076559dc606497e654)) + + ROM_REGION(0x0800, "chargen", ROMREGION_ERASE00) + ROM_LOAD("ksm_03_cg_d31.bin", 0x0000, 0x0800, CRC(98853aa7) SHA1(09b8e1b5b10a00c0b0ae7e36ad1328113d31230a)) +ROM_END + +/* + Assumes that SRAM is at 0x2100, otherwise identical. + Chargen has no missing pixels in 'G' character. +*/ +ROM_START( dvk_ksm01 ) + ROM_REGION(0x1000, "maincpu", ROMREGION_ERASE00) + ROM_LOAD( "ksm_04_rom0_d32.bin", 0x0000, 0x0800, CRC(5276dc9a) SHA1(dd41dfb4cb3f1cf22d96d95f1ff6a27fe4eb9a38)) + ROM_LOAD( "ksm_05_rom1_d33.bin", 0x0800, 0x0800, CRC(5b29bcd2) SHA1(1f4f82c2f88f1e8615ec02076559dc606497e654)) + + ROM_REGION(0x0800, "chargen", ROMREGION_ERASE00) + ROM_LOAD("ksm_03_cg_d31.bin", 0x0000, 0x0800, CRC(98853aa7) SHA1(09b8e1b5b10a00c0b0ae7e36ad1328113d31230a)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, dvk_ksm, 0, 0, ksm, ksm, driver_device, 0, "USSR", "DVK KSM", 0) +COMP( 198?, dvk_ksm01,dvk_ksm,0, ksm, ksm, driver_device, 0, "USSR", "DVK KSM-01", 0) diff --git a/src/mame/drivers/eacc.c b/src/mame/drivers/eacc.c new file mode 100644 index 00000000000..1dbb2228a82 --- /dev/null +++ b/src/mame/drivers/eacc.c @@ -0,0 +1,280 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/****************************************************************************** +* +* EA Car Computer +* by Robbbert, March 2011. +* +* Described in Electronics Australia magazine during 1982. +* Construction and usage: http://messui.the-chronicles.org/comp/eacc.pdf +* +* The only RAM is the 128 bytes that comes inside the CPU. +* +* This computer is mounted in a car, and various sensors (fuel flow, etc) +* are connected up. By pressing the appropriate buttons various statistics +* may be obtained. +* +* Memory Map +* 0000-007F internal ram +* 4000-7FFF ROM +* 8000-BFFF 6821 +* C000-FFFF ROM (mirror) +* +* The ROM was typed in twice from the dump in the magazine article, and the +* results compared. Only one byte was different, so I can be confident that +* it has been typed in properly. +* +* Setting up: You need to enter the number of expected pulses from the fuel +* and distance sensors. Paste this: 5 6M123N 7M400N (start, set litres cal to +* 123 pulses. set km cal to 400 pulses). Then paste this: 1950M0N 1845M0N (set +* petrol tank capacity to 50 litres, set current amount of petrol to 45). +* Now enter: 28M100N (the journey is 100km). Press 5 to start the journey. +* All settings are saved in nvram. +* +* Stats you can see while travelling: +* 0 - time elapsed +* 08 - time remaining +* 1 - fuel used +* 18 - fuel left +* 2 - km travelled +* 28 - km remaining +* 29 - km that could be travelled with the fuel you have left +* 3 - speed now +* 39 - average speed +* 4 - fuel consumption now (litres per 100km) +* 49 - fuel average consumption +* +******************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "eacc.lh" +#include "machine/6821pia.h" +#include "machine/nvram.h" + + +class eacc_state : public driver_device +{ +public: + eacc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pia(*this, "pia"), + m_p_nvram(*this, "nvram") + { } + + DECLARE_READ_LINE_MEMBER( eacc_cb1_r ); + DECLARE_READ_LINE_MEMBER( eacc_distance_r ); + DECLARE_READ_LINE_MEMBER( eacc_fuel_sensor_r ); + DECLARE_READ8_MEMBER( eacc_keyboard_r ); + DECLARE_WRITE_LINE_MEMBER( eacc_cb2_w ); + DECLARE_WRITE8_MEMBER( eacc_digit_w ); + DECLARE_WRITE8_MEMBER( eacc_segment_w ); + bool m_cb1; + bool m_cb2; + bool m_nmi; + required_device m_maincpu; + required_device m_pia; + required_shared_ptr m_p_nvram; + virtual void machine_reset(); + TIMER_DEVICE_CALLBACK_MEMBER(eacc_cb1); + TIMER_DEVICE_CALLBACK_MEMBER(eacc_nmi); +private: + UINT8 m_digit; +}; + + + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(eacc_mem, AS_PROGRAM, 8, eacc_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xc7ff) // A11,A12,A13 not connected + AM_RANGE(0x0000, 0x001f) AM_RAM AM_SHARE("nvram") // inside cpu, battery-backed + AM_RANGE(0x0020, 0x007f) AM_RAM // inside cpu + AM_RANGE(0x6000, 0x67ff) AM_ROM AM_MIRROR(0x8000) + AM_RANGE(0x8004, 0x8007) AM_MIRROR(0x7fc) AM_DEVREADWRITE("pia", pia6821_device, read, write) +ADDRESS_MAP_END + + +/****************************************************************************** + Input Ports +******************************************************************************/ + +static INPUT_PORTS_START(eacc) + PORT_START("X0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 Litres Cal") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('M') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 km") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT( 0xf8, 0, IPT_UNUSED ) + + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 START") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("END") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('N') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 km/h") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT( 0xf8, 0, IPT_UNUSED ) + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 Km Cal") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 hour.min") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 l/100km") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT( 0xf8, 0, IPT_UNUSED ) + + PORT_START("X3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 REM") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 litres") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 AV") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT( 0xf8, 0, IPT_UNUSED ) +INPUT_PORTS_END + +void eacc_state::machine_reset() +{ + m_cb2 = 0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(eacc_state::eacc_cb1) +{ + m_cb1 ^= 1; // 15hz + if (m_cb2) + m_maincpu->set_input_line(M6800_IRQ_LINE, ASSERT_LINE); +} + +TIMER_DEVICE_CALLBACK_MEMBER(eacc_state::eacc_nmi) +{ + if (m_cb2) + { + m_nmi = true; + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + } +} + +READ_LINE_MEMBER( eacc_state::eacc_cb1_r ) +{ + return (m_cb2) ? m_cb1 : 1; +} + +READ_LINE_MEMBER( eacc_state::eacc_distance_r ) +{ + return machine().rand() & 1; // needs random pulses to simulate movement +} + +READ_LINE_MEMBER( eacc_state::eacc_fuel_sensor_r ) +{ + return machine().rand() & 1; // needs random pulses to simulate fuel usage +} + +WRITE_LINE_MEMBER( eacc_state::eacc_cb2_w ) +{ + m_cb2 = state; +} + +READ8_MEMBER( eacc_state::eacc_keyboard_r ) +{ + UINT8 data = m_digit; + + if (BIT(m_digit, 3)) + data |= ioport("X0")->read(); + if (BIT(m_digit, 4)) + data |= ioport("X1")->read(); + if (BIT(m_digit, 5)) + data |= ioport("X2")->read(); + if (BIT(m_digit, 6)) + data |= ioport("X3")->read(); + + return data; +} + +WRITE8_MEMBER( eacc_state::eacc_segment_w ) +{ + //d7 segment dot + //d6 segment c + //d5 segment d + //d4 segment e + //d3 segment a + //d2 segment b + //d1 segment f + //d0 segment g + + if (!m_nmi) + { + UINT8 i; + if (BIT(m_digit, 7)) + { + char lednum[6]; + data ^= 0xff; + + for (i = 0; i < 8; i++) + { + sprintf(lednum,"led%d",i); + output_set_value(lednum, BIT(data, i)); + } + } + else + { + for (i = 3; i < 7; i++) + if (BIT(m_digit, i)) + output_set_digit_value(i, BITSWAP8(data, 7, 0, 1, 4, 5, 6, 2, 3)); + } + } +} + +WRITE8_MEMBER( eacc_state::eacc_digit_w ) +{ + if (m_nmi) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_nmi = false; + } + m_digit = data & 0xf8; +} + + +/****************************************************************************** + Machine Drivers +******************************************************************************/ + +static MACHINE_CONFIG_START( eacc, eacc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6802, XTAL_3_579545MHz) /* Divided by 4 inside the m6802*/ + MCFG_CPU_PROGRAM_MAP(eacc_mem) + + MCFG_DEFAULT_LAYOUT(layout_eacc) + + MCFG_DEVICE_ADD("pia", PIA6821, 0) + MCFG_PIA_READPB_HANDLER(READ8(eacc_state, eacc_keyboard_r)) + MCFG_PIA_READCA1_HANDLER(READLINE(eacc_state, eacc_distance_r)) + MCFG_PIA_READCB1_HANDLER(READLINE(eacc_state, eacc_cb1_r)) + MCFG_PIA_READCA2_HANDLER(READLINE(eacc_state, eacc_fuel_sensor_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(eacc_state, eacc_segment_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(eacc_state, eacc_digit_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(eacc_state, eacc_cb2_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6802_cpu_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6802_cpu_device, irq_line)) + + MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_TIMER_DRIVER_ADD_PERIODIC("eacc_nmi", eacc_state, eacc_nmi, attotime::from_hz(600)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("eacc_cb1", eacc_state, eacc_cb1, attotime::from_hz(30)) +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START(eacc) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("eacc.bin", 0x4000, 0x0800, CRC(287a63c0) SHA1(f61b397d33ea40e5742e34d5f5468572125e8b39) ) +ROM_END + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, eacc, 0, 0, eacc, eacc, driver_device, 0, "Electronics Australia", "EA Car Computer", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/ec184x.c b/src/mame/drivers/ec184x.c new file mode 100644 index 00000000000..e6552e7ac0c --- /dev/null +++ b/src/mame/drivers/ec184x.c @@ -0,0 +1,387 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + drivers/ec184x.c + + Driver file for EC-184x series + + TODO (ec1840) + - memory bank size is smaller (128K) + + TODO (ec1841) + - hard disk is connected but requires changes to isa_hdc.c + +***************************************************************************/ + + +#include "emu.h" + +#include "includes/genpc.h" + +#include "bus/isa/xsu_cards.h" +#include "bus/pc_kbd/keyboards.h" +#include "cpu/i86/i86.h" +#include "machine/ram.h" + +#define VERBOSE_DBG 1 /* general debug messages */ + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + + + +class ec184x_state : public driver_device +{ +public: + ec184x_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + required_device m_maincpu; + + DECLARE_MACHINE_RESET(ec184x); + DECLARE_DRIVER_INIT(ec184x); + + struct { + UINT8 enable[4]; + int boards; + int board_size; + } m_memory; + + DECLARE_READ8_MEMBER(memboard_r); + DECLARE_WRITE8_MEMBER(memboard_w); +}; + +/* + * EC-1841 memory controller. The machine can hold four memory boards; + * each board has a control register, its address is set by a DIP switch + * on the board itself. + * + * Only one board should be enabled for read, and one for write. + * Normally, this is the same board. + * + * Each board is divided into 4 banks, internally numbererd 0..3. + * POST tests each board on startup, and an error (indicated by + * I/O CH CK bus signal) causes it to disable failing bank(s) by writing + * 'reconfiguration code' (inverted number of failing memory bank) to + * the register. + + * bit 1-0 'reconfiguration code' + * bit 2 enable read access + * bit 3 enable write access + */ + +READ8_MEMBER(ec184x_state::memboard_r) +{ + UINT8 data; + + data = offset % 4; + if (data > m_memory.boards) + data = 0xff; + else + data = m_memory.enable[data]; + DBG_LOG(1,"ec1841_memboard",("R (%d of %d) == %02X\n", offset, m_memory.boards, data )); + + return data; +} + +WRITE8_MEMBER(ec184x_state::memboard_w) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + ram_device *m_ram = machine().device(RAM_TAG); + UINT8 current; + + current = m_memory.enable[offset]; + + DBG_LOG(1,"ec1841_memboard",("W (%d of %d) <- %02X (%02X)\n", offset, m_memory.boards, data, current)); + + if (offset > m_memory.boards) { + return; + } + + if (BIT(current, 2) && !BIT(data, 2)) { + // disable read access + program.unmap_read(0, m_memory.board_size-1); + DBG_LOG(1,"ec1841_memboard_w",("unmap_read(%d)\n", offset)); + } + + if (BIT(current, 3) && !BIT(data, 3)) { + // disable write access + program.unmap_write(0, 0x7ffff); + DBG_LOG(1,"ec1841_memboard_w",("unmap_write(%d)\n", offset)); + } + + if (!BIT(current, 2) && BIT(data, 2)) { + for(int i=0; i<4; i++) + m_memory.enable[i] &= 0xfb; + // enable read access + membank("bank10")->set_base(m_ram->pointer() + offset*0x80000); + program.install_read_bank(0, m_memory.board_size-1, "bank10"); + DBG_LOG(1,"ec1841_memboard_w",("map_read(%d)\n", offset)); + } + + if (!BIT(current, 3) && BIT(data, 3)) { + for(int i=0; i<4; i++) + m_memory.enable[i] &= 0xf7; + // enable write access + membank("bank20")->set_base(m_ram->pointer() + offset*0x80000); + program.install_write_bank(0, m_memory.board_size-1, "bank20"); + DBG_LOG(1,"ec1841_memboard_w",("map_write(%d)\n", offset)); + } + + m_memory.enable[offset] = data; +} + +DRIVER_INIT_MEMBER( ec184x_state, ec184x ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + ram_device *m_ram = machine().device(RAM_TAG); + + m_memory.board_size = 512 * 1024; // XXX + m_memory.boards = m_ram->size()/m_memory.board_size - 1; + if (m_memory.boards > 3) + m_memory.boards = 3; + + program.install_read_bank(0, m_memory.board_size-1, "bank10"); + program.install_write_bank(0, m_memory.board_size-1, "bank20"); + membank( "bank10" )->set_base( m_ram->pointer() ); + membank( "bank20" )->set_base( m_ram->pointer() ); +} + +MACHINE_RESET_MEMBER( ec184x_state, ec184x ) +{ + memset(m_memory.enable, 0, sizeof(m_memory.enable)); + // mark 1st board enabled + m_memory.enable[0] = 0xc; +} + + +static ADDRESS_MAP_START( ec1840_map, AS_PROGRAM, 8, ec184x_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x7ffff) AM_RAM + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xdc000, 0xdffff) AM_RAM + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ec1841_map, AS_PROGRAM, 16, ec184x_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x7ffff) AM_RAM + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ec1847_map, AS_PROGRAM, 8, ec184x_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xdc000, 0xdffff) AM_RAM + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ec1840_io, AS_IO, 8, ec184x_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ec1841_io, AS_IO, 16, ec184x_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x02b0, 0x02b3) AM_READWRITE8(memboard_r, memboard_w, 0xffff); +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ec1847_io, AS_IO, 8, ec184x_state ) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x0210, 0x021f) AM_RAM // internal (non-standard?) bus extender +ADDRESS_MAP_END + + +static INPUT_PORTS_START( ec1841 ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START( ec1840 ) + DEVICE_INPUT_DEFAULTS("DSW0", 0x31, 0x21) +DEVICE_INPUT_DEFAULTS_END + +static DEVICE_INPUT_DEFAULTS_START( ec1841 ) + DEVICE_INPUT_DEFAULTS("DSW0", 0x31, 0x21) +DEVICE_INPUT_DEFAULTS_END + +static DEVICE_INPUT_DEFAULTS_START( ec1847 ) + DEVICE_INPUT_DEFAULTS("DSW0", 0x31, 0x31) +DEVICE_INPUT_DEFAULTS_END + +// XXX verify everything +static MACHINE_CONFIG_START( ec1840, ec184x_state ) + MCFG_CPU_ADD("maincpu", I8088, 4096000) + MCFG_CPU_PROGRAM_MAP(ec1840_map) + MCFG_CPU_IO_MAP(ec1840_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5150_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(ec1840) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", ec184x_isa8_cards, "ec1840.0002", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", ec184x_isa8_cards, "ec1841.0003", false) // actually ec1840.0003 -- w/o mouse port + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", ec184x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", ec184x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", ec184x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", ec184x_isa8_cards, NULL, false) + + MCFG_SOFTWARE_LIST_ADD("flop_list","ec1841") + + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ec1841, ec184x_state ) + MCFG_CPU_ADD("maincpu", I8086, 4096000) + MCFG_CPU_PROGRAM_MAP(ec1841_map) + MCFG_CPU_IO_MAP(ec1841_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_MACHINE_RESET_OVERRIDE(ec184x_state, ec184x) + + MCFG_EC1841_MOTHERBOARD_ADD("mb", "maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(ec1841) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", ec184x_isa8_cards, "ec1841.0002", false) // cga + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", ec184x_isa8_cards, "ec1841.0003", false) // fdc + mouse port + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", ec184x_isa8_cards, "hdc", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", ec184x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", ec184x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", ec184x_isa8_cards, NULL, false) + + MCFG_SOFTWARE_LIST_ADD("flop_list","ec1841") + + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_EXTRA_OPTIONS("1024K,1576K,2048K") // 640K variant not emulated +MACHINE_CONFIG_END + +// XXX verify everything +static MACHINE_CONFIG_START( ec1847, ec184x_state ) + MCFG_CPU_ADD("maincpu", I8088, 4772720) + MCFG_CPU_PROGRAM_MAP(ec1847_map) + MCFG_CPU_IO_MAP(ec1847_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(ec1847) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "hercules", false) // cga, ega and vga(?) are options too + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) // native variant (wd1010 + z80) not emulated + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, NULL, false) // native serial (2x8251) not emulated + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) + + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + +ROM_START( ec1840 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_DEFAULT_BIOS("v4") + // supports MDA only + ROM_SYSTEM_BIOS(0, "v1", "EC-1840.01") + ROMX_LOAD( "000-01.bin", 0xfe000, 0x0800, CRC(c3ab1fad) SHA1(8168bdee30698f4f9aa7bbb6dfabe62dd723cec5), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "001-01.bin", 0xff000, 0x0800, CRC(601d1155) SHA1(9684d33b92743749704587a48e679ef7a3b20f9c), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "002-01.bin", 0xfe001, 0x0800, CRC(ce4dddb7) SHA1(f9b1da60c848e68ff1c154d695a36a0833de4804), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "003-01.bin", 0xff001, 0x0800, CRC(14b40431) SHA1(ce7fffa41897405ee64fd4e86015e774f8bd108a), ROM_SKIP(1) | ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "v4", "EC-1840.04") + ROMX_LOAD( "000-04-971b.bin", 0xfe000, 0x0800, CRC(06aeaee8) SHA1(9f954e4c48156d573a8e0109e7ca652be9e6036a), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "001-04-92b7.bin", 0xff000, 0x0800, CRC(3fae650a) SHA1(c98b777fdeceadd72d6eb9465b3501b9ead55a08), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "002-04-9e17.bin", 0xfe001, 0x0800, CRC(d59712df) SHA1(02ea1b3ae9662f5c64c58920a32ca9db0f6fbd12), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "003-04-3ccb.bin", 0xff001, 0x0800, CRC(7fc362c7) SHA1(538e13639ad2b4c30bd72582e323181e63513306), ROM_SKIP(1) | ROM_BIOS(2)) + + ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) +ROM_END + +ROM_START( ec1841 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_DEFAULT_BIOS("v2") + ROM_SYSTEM_BIOS(0, "v1", "EC-1841.01") + ROMX_LOAD( "012-01-3107.bin", 0xfc000, 0x0800, CRC(77957396) SHA1(785f1dceb6e2b4618f5c5f0af15eb74a8c951448), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "013-01-203f.bin", 0xfc001, 0x0800, CRC(768bd3d5) SHA1(2e948f2ad262de306d889b7964c3f1aad45ff5bc), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "014-01-fa40.bin", 0xfd000, 0x0800, CRC(47722b58) SHA1(a6339ee8af516f834826b7828a5cf79cb650480c), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "015-01-bf1d.bin", 0xfd001, 0x0800, CRC(b585b5ea) SHA1(d0ebed586eb13031477c2e071c50416682f80489), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "016-01-65f7.bin", 0xfe000, 0x0800, CRC(28a07db4) SHA1(17fbcd60dacd1d3f8d8355db429f97e4d1d1ac88), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "017-01-5be1.bin", 0xfe001, 0x0800, CRC(928bda26) SHA1(ee889184067e2680b29a8ef1c3a76cf5afd4c78d), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "018-01-7090.bin", 0xff000, 0x0800, CRC(75ca7d7e) SHA1(6356426820c5326a7893a437d54b02f250ef8609), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "019-01-0492.bin", 0xff001, 0x0800, CRC(8a9d593e) SHA1(f3936d2cb4e6d130dd732973f126c3aa20612463), ROM_SKIP(1) | ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "v2", "EC-1841.02") + ROMX_LOAD( "012-02-37f6.bin", 0xfc000, 0x0800, CRC(8f5c6a20) SHA1(874b62f9cee8d3b974f33732f94eff10fc002c44), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "013-02-2552.bin", 0xfc001, 0x0800, CRC(e3c10128) SHA1(d6ed743ebe9c130925c9f17aad1a45db9194c967), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "014-02-0fbe.bin", 0xfd000, 0x0800, CRC(f8517e5e) SHA1(8034cd6ff5778365dc9daa494524f1753a74f1ed), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "015-02-d736.bin", 0xfd001, 0x0800, CRC(8538c52a) SHA1(ee981ce90870b6546a18f2a2e64d71b0038ce0dd), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "016-02-5b2c.bin", 0xfe000, 0x0800, CRC(3d1d1e67) SHA1(c527e29796537787c0f6c329f3c203f6131ca77f), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "017-02-4b9d.bin", 0xfe001, 0x0800, CRC(1b985264) SHA1(5ddcb9c13564be208c5068c105444a87159c67ee), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "018-02-7090.bin", 0xff000, 0x0800, CRC(75ca7d7e) SHA1(6356426820c5326a7893a437d54b02f250ef8609), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "019-02-0493.bin", 0xff001, 0x0800, CRC(61aae23d) SHA1(7b3aa24a63ee31b194297eb1e61c3827edfcb95a), ROM_SKIP(1) | ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(2, "v3", "EC-1841.03") + ROMX_LOAD( "012-03-37e7.bin", 0xfc000, 0x0800, CRC(49992bd5) SHA1(119121e1b4af1c44b9b8c2edabe7dc1d3019c4a6), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "013-03-2554.bin", 0xfc001, 0x0800, CRC(834bd7d7) SHA1(e37514fc4cb8a5cbe68e7564e0e07d5116c4021a), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "014-03-0fbe.bin", 0xfd000, 0x0800, CRC(f8517e5e) SHA1(8034cd6ff5778365dc9daa494524f1753a74f1ed), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "015-03-d736.bin", 0xfd001, 0x0800, CRC(8538c52a) SHA1(ee981ce90870b6546a18f2a2e64d71b0038ce0dd), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "016-03-5b2c.bin", 0xfe000, 0x0800, CRC(3d1d1e67) SHA1(c527e29796537787c0f6c329f3c203f6131ca77f), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "017-03-4b9d.bin", 0xfe001, 0x0800, CRC(1b985264) SHA1(5ddcb9c13564be208c5068c105444a87159c67ee), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "018-03-7090.bin", 0xff000, 0x0800, CRC(75ca7d7e) SHA1(6356426820c5326a7893a437d54b02f250ef8609), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "019-03-0493.bin", 0xff001, 0x0800, CRC(61aae23d) SHA1(7b3aa24a63ee31b194297eb1e61c3827edfcb95a), ROM_SKIP(1) | ROM_BIOS(3)) +ROM_END + +ROM_START( ec1845 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROMX_LOAD( "184500.bin", 0xfc000, 0x0800, CRC(7c472ef7) SHA1(3af53f27b49bbc731bf51f9300fbada23a1bfcfc), ROM_SKIP(1)) + ROMX_LOAD( "184501.bin", 0xfc001, 0x0800, CRC(db240dc6) SHA1(d7bb022213d09bbf2a8107fe4f1cd27b23939e18), ROM_SKIP(1)) + ROMX_LOAD( "184502.bin", 0xfd000, 0x0800, CRC(149e7e29) SHA1(7f2a297588fef1bc750c57e6ae0d5acf3d27c486), ROM_SKIP(1)) + ROMX_LOAD( "184503.bin", 0xfd001, 0x0800, CRC(e28cbd74) SHA1(cf1fba4e67c8e1dd8cdda547118e84b704029b03), ROM_SKIP(1)) + ROMX_LOAD( "184504.bin", 0xfe000, 0x0800, CRC(55fa7a1d) SHA1(58f7abab08b9d2f0a1c1636e11bb72af2694c95f), ROM_SKIP(1)) + ROMX_LOAD( "184505.bin", 0xfe001, 0x0800, CRC(c807e3f5) SHA1(08117e449f0d04f96041cff8d34893f500f3760d), ROM_SKIP(1)) + ROMX_LOAD( "184506.bin", 0xff000, 0x0800, CRC(24f5c27c) SHA1(7822dd7f715ef00ccf6d8408be8bbfe01c2eba20), ROM_SKIP(1)) + ROMX_LOAD( "184507.bin", 0xff001, 0x0800, CRC(75122203) SHA1(7b0fbdf1315230633e39574ac7360163bc7361e1), ROM_SKIP(1)) +ROM_END + +ROM_START( ec1847 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "vXXX", "EC-1847.0x") + ROMX_LOAD( "308_d47_2764.bin", 0xc8000, 0x2000, CRC(f06924f2) SHA1(83a5dedf1c06f875c598f087bbc087524bc9bfa3), ROM_BIOS(1)) + ROMX_LOAD( "188m_d47_2764.bin", 0xf4000, 0x2000, CRC(bc8742c7) SHA1(3af09d14e891e976b7a9a2a6e1af63f0eabe5426), ROM_BIOS(1)) + ROMX_LOAD( "188m_d48_2764.bin", 0xfe000, 0x2000, CRC(7d290e95) SHA1(e73e6c8e19477fce5de3f95b89693dc6ad6781ab), ROM_BIOS(1)) + + ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) + ROM_LOAD( "317_d28_2732.bin", 0x00000, 0x1000, CRC(8939599b) SHA1(53d02460cf93596882a96758ef4bac5fa1ce55b2)) // monochrome font +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR ROM NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1987, ec1840, ibm5150, 0, ec1840, ec1841, ec184x_state, ec184x, "", "EC-1840", MACHINE_NOT_WORKING) +COMP ( 1987, ec1841, ibm5150, 0, ec1841, ec1841, ec184x_state, ec184x, "", "EC-1841", 0) +COMP ( 1989, ec1845, ibm5150, 0, ec1841, ec1841, ec184x_state, ec184x, "", "EC-1845", MACHINE_NOT_WORKING) +COMP ( 1990, ec1847, ibm5150, 0, ec1847, ec1841, driver_device, 0, "", "EC-1847", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/ec65.c b/src/mame/drivers/ec65.c new file mode 100644 index 00000000000..4f0fc30580e --- /dev/null +++ b/src/mame/drivers/ec65.c @@ -0,0 +1,250 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + EC-65 + + 16/07/2009 Initial driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "cpu/g65816/g65816.h" +#include "video/mc6845.h" +#include "machine/6821pia.h" +#include "machine/6522via.h" +#include "machine/mos6551.h" +#include "machine/6850acia.h" +#include "machine/keyboard.h" + +#define PIA6821_TAG "pia6821" +#define ACIA6850_TAG "acia6850" +#define ACIA6551_TAG "acia6551" +#define VIA6522_0_TAG "via6522_0" +#define VIA6522_1_TAG "via6522_1" +#define MC6845_TAG "mc6845" +#define KEYBOARD_TAG "keyboard" + +class ec65_state : public driver_device +{ +public: + ec65_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_via_0(*this, VIA6522_0_TAG), + m_via_1(*this, VIA6522_1_TAG), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + MC6845_UPDATE_ROW(crtc_update_row); + UINT8 *m_p_chargen; + required_device m_via_0; + required_device m_via_1; + required_shared_ptr m_p_videoram; + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; + required_device m_palette; +}; + +class ec65k_state : public driver_device +{ +public: + ec65k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + { + } +}; + +static ADDRESS_MAP_START(ec65_mem, AS_PROGRAM, 8, ec65_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write) + AM_RANGE(0xe010, 0xe010) AM_DEVREADWRITE(ACIA6850_TAG, acia6850_device, status_r, control_w) + AM_RANGE(0xe011, 0xe011) AM_DEVREADWRITE(ACIA6850_TAG, acia6850_device, data_r, data_w) + AM_RANGE(0xe100, 0xe10f) AM_DEVREADWRITE(VIA6522_0_TAG, via6522_device, read, write) + AM_RANGE(0xe110, 0xe11f) AM_DEVREADWRITE(VIA6522_1_TAG, via6522_device, read, write) + AM_RANGE(0xe130, 0xe133) AM_DEVREADWRITE(ACIA6551_TAG, mos6551_device, read, write) + AM_RANGE(0xe140, 0xe140) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) + AM_RANGE(0xe141, 0xe141) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r , register_w) + AM_RANGE(0xe400, 0xe7ff) AM_RAM // 1KB on-board RAM + AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ec65k_mem, AS_PROGRAM, 8, ec65_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xe7ff) AM_RAM + AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ec65 ) +INPUT_PORTS_END + +WRITE8_MEMBER( ec65_state::kbd_put ) +{ + if (data) + { + m_via_0->write_pa0((data>>0)&1); + m_via_0->write_pa1((data>>1)&1); + m_via_0->write_pa2((data>>2)&1); + m_via_0->write_pa3((data>>3)&1); + m_via_0->write_pa4((data>>4)&1); + m_via_0->write_pa5((data>>5)&1); + m_via_0->write_pa6((data>>6)&1); + m_via_0->write_pa7((data>>7)&1); + m_via_0->write_ca1(1); + m_via_0->write_ca1(0); + } +} + +void ec65_state::machine_reset() +{ + m_via_1->write_pb0(1); + m_via_1->write_pb1(1); + m_via_1->write_pb2(1); + m_via_1->write_pb3(1); + m_via_1->write_pb4(1); + m_via_1->write_pb5(1); + m_via_1->write_pb6(1); + m_via_1->write_pb7(1); +} + +void ec65_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +MC6845_UPDATE_ROW( ec65_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,inv; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + inv = (x == cursor_x) ? 0xff : 0; + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; + + /* Display a scanline of a character */ + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} + +/* F4 Character Displayer */ +static const gfx_layout ec65_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( ec65 ) + GFXDECODE_ENTRY( "chargen", 0x0000, ec65_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( ec65, ec65_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6502, XTAL_4MHz / 4) + MCFG_CPU_PROGRAM_MAP(ec65_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) + MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ec65) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, "screen", XTAL_16MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) /*?*/ + MCFG_MC6845_UPDATE_ROW_CB(ec65_state, crtc_update_row) + + /* devices */ + MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) + + MCFG_DEVICE_ADD(ACIA6850_TAG, ACIA6850, 0) + + MCFG_DEVICE_ADD(VIA6522_0_TAG, VIA6522, XTAL_4MHz / 4) + + MCFG_DEVICE_ADD(VIA6522_1_TAG, VIA6522, XTAL_4MHz / 4) + + MCFG_DEVICE_ADD(ACIA6551_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(ec65_state, kbd_put)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ec65k, ec65k_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",G65816, XTAL_4MHz) // can use 4,2 or 1 MHz + MCFG_CPU_PROGRAM_MAP(ec65k_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) + MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ec65) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, "screen", XTAL_16MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) /*?*/ +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ec65 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ec65.ic6", 0xf000, 0x1000, CRC(acd928ed) SHA1(e02a688a057ff77294717cf7b887425fed0b1153)) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "chargen.ic19", 0x0000, 0x1000, CRC(9b56a28d) SHA1(41c04fd9fb542c50287bc0e366358a61fc4b0cd4)) // Located on VDU card +ROM_END + +ROM_START( ec65k ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ec65k.ic19", 0xf000, 0x1000, CRC(5e5a890a) SHA1(daa006f2179fd156833e11c73b37881cafe5dede)) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "chargen.ic19", 0x0000, 0x1000, CRC(9b56a28d) SHA1(41c04fd9fb542c50287bc0e366358a61fc4b0cd4)) // Located on VDU card +ROM_END +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, ec65, 0, 0, ec65, ec65, driver_device, 0, "Elektor Electronics", "EC-65", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1985, ec65k, ec65, 0, ec65k, ec65, driver_device, 0, "Elektor Electronics", "EC-65K", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/einstein.c b/src/mame/drivers/einstein.c new file mode 100644 index 00000000000..c0c6190c76c --- /dev/null +++ b/src/mame/drivers/einstein.c @@ -0,0 +1,833 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Dirk Best, Phill Harvey-Smith +/****************************************************************************** + + Tatung Einstein + + TMS9129 VDP Graphics + 16k ram + + Z80 CPU (4 MHz) + + Z80 CTC (4 MHz) + channel 0 is serial transmit clock + channel 1 is serial receive clock + trigger for channel 0,1 and 2 is a 2 MHz clock + trigger for channel 3 is the terminal count of channel 2 + + Intel 8251 Serial (2 MHz clock?) + + WD1770 Floppy Disc controller + density is fixed, 4 drives and double sided supported + + AY-3-8910 PSG (2 MHz) + port A and port B are connected to the keyboard. Port A is keyboard + line select, Port B is data. + + printer connected to port A of PIO. /ACK from printer is connected to /ASTB. + D7-D0 of PIO port A is printer data lines. + ARDY of PIO is connected to /STROBE on printer. + + user port is port B of PIO + keyboard connected to port A and port B of PSG + + TODO: + - The ADC is not emulated! + - printer emulation needs checking! + + Many thanks to Chris Coxall for the schematics of the TC-01, the dump of the + system rom and a dump of a Xtal boot disc. + + Many thanks to Andrew Dunipace for his help with the 80-column card + and Speculator hardware (Spectrum emulator). + + Kevin Thacker [MESS driver] + + + 2011-Mar-14, Phill Harvey-Smith. + Having traced out the circuit of the TK02 80 coumn card, I have changed the + emulation to match what the hardware does, the emulation was mostly correct, + just some minor issues with the addressing of the VRAM, and bit 0 of the + status register is the latched output of the 6845 DE, and not vblank. + + Also added defines to stop the log being flooded with keyboard messages :) + + ******************************************************************************/ + +#include "emu.h" +#include "machine/z80pio.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "sound/ay8910.h" +#include "rendlay.h" +#include "includes/einstein.h" + +#define VERBOSE_KEYBOARD 0 +#define VERBOSE_DISK 0 + +/*************************************************************************** + 80 COLUMN DEVICE +***************************************************************************/ + +/* lower 3 bits of address define a 256-byte "row". + * upper 8 bits define the offset in the row, + * data bits define data to write + */ +WRITE8_MEMBER(einstein_state::einstein_80col_ram_w) +{ + m_crtc_ram[((offset & 0x07) << 8) | ((offset >> 8) & 0xff)] = data; +} + +READ8_MEMBER(einstein_state::einstein_80col_ram_r) +{ + return m_crtc_ram[((offset & 0x07) << 8) | ((offset >> 8) & 0xff)]; +} + +/* TODO: Verify implementation */ +/* From traces of the TK02 board character ROM is addressed by the 6845 as follows + bit 0..2 ra0..ra2 + bit 3..10 data 0..7 from VRAM + bit 11 ra3 + bit 12 jumper M004, this could be used to select two different character + sets. +*/ +MC6845_UPDATE_ROW( einstein_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 *data = m_region_gfx1->base(); + UINT8 char_code, data_byte; + int i, x; + + for (i = 0, x = 0; i < x_count; i++, x += 8) + { + char_code = m_crtc_ram[(ma + i) & 0x07ff]; + data_byte = data[(char_code << 3) + (ra & 0x07) + ((ra & 0x08) << 8)]; + + bitmap.pix32(y, x + 0) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 7)]; + bitmap.pix32(y, x + 1) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 6)]; + bitmap.pix32(y, x + 2) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 5)]; + bitmap.pix32(y, x + 3) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 4)]; + bitmap.pix32(y, x + 4) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 3)]; + bitmap.pix32(y, x + 5) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 2)]; + bitmap.pix32(y, x + 6) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 1)]; + bitmap.pix32(y, x + 7) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 0)]; + } +} + +WRITE_LINE_MEMBER(einstein_state::einstein_6845_de_changed) +{ + m_de=state; +} + +/* bit 0 - latched display enabled (DE) from 6845 + * bit 1 - Jumper M003 0 = 40 column mode (color monitor), 1 = 80 column mode (b/w monitor) + * bit 2 - Jumper M002 0 = 50Hz, 1 = 60Hz + * bit 3 - Jumper M001 0 = ???, 1=??? perminently wired high on both the boards I have seen - PHS. + */ +READ8_MEMBER(einstein_state::einstein_80col_state_r) +{ + UINT8 result = 0; + + result |= m_de; + result |= m_80column_dips->read() & 0x06; + + return result; +} + +/* int priority */ +/* keyboard int->ctc/adc->pio */ +static const z80_daisy_config einstein_daisy_chain[] = +{ + { "keyboard_daisy" }, + { IC_I058 }, + { "adc_daisy" }, + { IC_I063 }, + { "fire_daisy" }, + { NULL } +}; + + +/*************************************************************************** + KEYBOARD +***************************************************************************/ + +/* refresh keyboard data. It is refreshed when the keyboard line is written */ +void einstein_state::einstein_scan_keyboard() +{ + UINT8 data = 0xff; + + if (!BIT(m_keyboard_line, 0)) data &= m_line0->read(); + if (!BIT(m_keyboard_line, 1)) data &= m_line1->read(); + if (!BIT(m_keyboard_line, 2)) data &= m_line2->read(); + if (!BIT(m_keyboard_line, 3)) data &= m_line3->read(); + if (!BIT(m_keyboard_line, 4)) data &= m_line4->read(); + if (!BIT(m_keyboard_line, 5)) data &= m_line5->read(); + if (!BIT(m_keyboard_line, 6)) data &= m_line6->read(); + if (!BIT(m_keyboard_line, 7)) data &= m_line7->read(); + + m_keyboard_data = data; +} + +TIMER_DEVICE_CALLBACK_MEMBER(einstein_state::einstein_keyboard_timer_callback) +{ + /* re-scan keyboard */ + einstein_scan_keyboard(); + + /* if /fire1 or /fire2 is 0, signal a fire interrupt */ + if ((m_buttons->read() & 0x03) != 0) + { + m_interrupt |= EINSTEIN_FIRE_INT; + } + + /* keyboard data changed? */ + if (m_keyboard_data != 0xff) + { + /* generate interrupt */ + m_interrupt |= EINSTEIN_KEY_INT; + } +} + +WRITE8_MEMBER(einstein_state::einstein_keyboard_line_write) +{ + if (VERBOSE_KEYBOARD) + logerror("einstein_keyboard_line_write: %02x\n", data); + + m_keyboard_line = data; + + /* re-scan the keyboard */ + einstein_scan_keyboard(); +} + +READ8_MEMBER(einstein_state::einstein_keyboard_data_read) +{ + /* re-scan the keyboard */ + einstein_scan_keyboard(); + + if (VERBOSE_KEYBOARD) + logerror("einstein_keyboard_data_read: %02x\n", m_keyboard_data); + + return m_keyboard_data; +} + + +/*************************************************************************** + FLOPPY DRIVES +***************************************************************************/ + +WRITE8_MEMBER(einstein_state::einstein_drsel_w) +{ + if(VERBOSE_DISK) + logerror("%s: einstein_drsel_w %02x\n", machine().describe_context(), data); + + /* bit 0 to 3 select the drive */ + static const char *names[] = { IC_I042 ":0", IC_I042 ":1", IC_I042 ":2", IC_I042 ":3" }; + floppy_image_device *floppy = 0; + for(int i=0; i<4; i++) { + if(BIT(data, i)) { + floppy_connector *con = machine().device(names[i]); + if(con) + floppy = con->get_device(); + } + } + + /* double sided drive connected? */ + if (m_config->read() & data) + { + /* bit 4 selects the side then */ + //floppy->ss_w(BIT(data, 4)); + } + if (floppy) floppy->ss_w(0); + m_fdc->set_floppy(floppy); +} + + +/*************************************************************************** + CTC +***************************************************************************/ + +/* channel 0 and 1 have a 2 MHz input clock for triggering */ +TIMER_DEVICE_CALLBACK_MEMBER(einstein_state::einstein_ctc_trigger_callback) +{ + /* toggle line status */ + m_ctc_trigger ^= 1; + + m_ctc->trg0(m_ctc_trigger); + m_ctc->trg1(m_ctc_trigger); +} + + +/*************************************************************************** + UART +***************************************************************************/ + +WRITE_LINE_MEMBER(einstein_state::einstein_serial_transmit_clock) +{ + m_uart->write_txc(state); +} + +WRITE_LINE_MEMBER(einstein_state::einstein_serial_receive_clock) +{ + m_uart->write_rxc(state); +} + + +/*************************************************************************** + MEMORY BANKING +***************************************************************************/ + +void einstein_state::einstein_page_rom() +{ + m_bank1->set_base(m_rom_enabled ? m_region_bios->base() : m_ram->pointer()); +} + +/* writing to this port is a simple trigger, and switches between RAM and ROM */ +WRITE8_MEMBER(einstein_state::einstein_rom_w) +{ + m_rom_enabled ^= 1; + einstein_page_rom(); +} + + +/*************************************************************************** + INTERRUPTS +***************************************************************************/ + +WRITE_LINE_MEMBER(einstein_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER(einstein_state::write_centronics_perror) +{ + m_centronics_perror = state; +} + +WRITE_LINE_MEMBER(einstein_state::write_centronics_fault) +{ + m_centronics_fault = state; +} + +READ8_MEMBER(einstein_state::einstein_kybintmsk_r) +{ + UINT8 data = 0; + + /* clear key int. a read of this I/O port will do this or a reset */ + m_interrupt &= ~EINSTEIN_KEY_INT; + + /* bit 0 and 1: fire buttons on the joysticks */ + data |= m_buttons->read(); + + /* bit 2 to 4: printer status */ + data |= m_centronics_busy << 2; + data |= m_centronics_perror << 3; + data |= m_centronics_fault << 4; + + /* bit 5 to 7: graph, control and shift key */ + data |= m_extra->read(); + + if(VERBOSE_KEYBOARD) + logerror("%s: einstein_kybintmsk_r %02x\n", machine().describe_context(), data); + + return data; +} + +WRITE8_MEMBER(einstein_state::einstein_kybintmsk_w) +{ + logerror("%s: einstein_kybintmsk_w %02x\n", machine().describe_context(), data); + + /* set mask from bit 0 */ + if (data & 0x01) + { + logerror("key int is disabled\n"); + m_interrupt_mask &= ~EINSTEIN_KEY_INT; + } + else + { + logerror("key int is enabled\n"); + m_interrupt_mask |= EINSTEIN_KEY_INT; + } +} + +/* writing to this I/O port sets the state of the mask; D0 is used */ +/* writing 0 enables the /ADC interrupt */ +WRITE8_MEMBER(einstein_state::einstein_adcintmsk_w) +{ + logerror("%s: einstein_adcintmsk_w %02x\n", machine().describe_context(), data); + + if (data & 0x01) + { + logerror("adc int is disabled\n"); + m_interrupt_mask &= ~EINSTEIN_ADC_INT; + } + else + { + logerror("adc int is enabled\n"); + m_interrupt_mask |= EINSTEIN_ADC_INT; + } +} + +/* writing to this I/O port sets the state of the mask; D0 is used */ +/* writing 0 enables the /FIRE interrupt */ +WRITE8_MEMBER(einstein_state::einstein_fire_int_w) +{ + logerror("%s: einstein_fire_int_w %02x\n", machine().describe_context(), data); + + if (data & 0x01) + { + logerror("fire int is disabled\n"); + m_interrupt_mask &= ~EINSTEIN_FIRE_INT; + } + else + { + logerror("fire int is enabled\n"); + m_interrupt_mask |= EINSTEIN_FIRE_INT; + } +} + + +/*************************************************************************** + MACHINE EMULATION +***************************************************************************/ + +void einstein_state::machine_start() +{ +} + +void einstein_state::machine_reset() +{ + //device_t *floppy; + //UINT8 config = m_config->read(); + + /* initialize memory mapping */ + m_bank2->set_base(m_ram->pointer()); + m_bank3->set_base(m_ram->pointer() + 0x8000); + m_rom_enabled = 1; + einstein_page_rom(); + + /* a reset causes the fire int, adc int, keyboard int mask + to be set to 1, which causes all these to be DISABLED */ + m_interrupt = 0; + m_interrupt_mask = 0; + + m_ctc_trigger = 0; + + /* configure floppy drives */ +/* floppy_type_t type_80 = FLOPPY_STANDARD_5_25_DSHD; + floppy_type_t type_40 = FLOPPY_STANDARD_5_25_SSDD_40; + floppy = machine().device("floppy0"); + floppy_drive_set_geometry(floppy, config & 0x01 ? type_80 : type_40); + floppy = machine().device("floppy1"); + floppy_drive_set_geometry(floppy, config & 0x02 ? type_80 : type_40); + floppy = machine().device("floppy2"); + floppy_drive_set_geometry(floppy, config & 0x04 ? type_80 : type_40); + floppy = machine().device("floppy3"); + floppy_drive_set_geometry(floppy, config & 0x08 ? type_80 : type_40);*/ +} + +MACHINE_RESET_MEMBER(einstein_state,einstein2) +{ + /* call standard initialization first */ + einstein_state::machine_reset(); + + /* 80 column card palette */ + m_palette->set_pen_color(TMS9928A_PALETTE_SIZE, rgb_t::black); + m_palette->set_pen_color(TMS9928A_PALETTE_SIZE + 1, rgb_t(0, 224, 0)); +} + +MACHINE_START_MEMBER(einstein_state,einstein2) +{ + m_crtc_ram = auto_alloc_array(machine(), UINT8, 2048); + memset(m_crtc_ram, 0, sizeof(UINT8) * 2048); + einstein_state::machine_start(); +} + + +/*************************************************************************** + VIDEO EMULATION +***************************************************************************/ + +UINT32 einstein_state::screen_update_einstein2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (&screen == m_color_screen) + { + bitmap_rgb32 &src = m_tms9929a->get_bitmap(); + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + bitmap.pix32(y, x) = src.pix32(y, x); + } + else if (&screen == m_crtc_screen) + m_mc6845->screen_update( screen, bitmap, cliprect); + else + fatalerror("Unknown screen '%s'\n", screen.tag()); + + return 0; +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( einstein_mem, AS_PROGRAM, 8, einstein_state ) + AM_RANGE(0x0000, 0x07fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") + AM_RANGE(0x8000, 0x0ffff) AM_RAMBANK("bank3") +ADDRESS_MAP_END + +/* The I/O ports are decoded into 8 blocks using address lines A3 to A7 */ +static ADDRESS_MAP_START( einstein_io, AS_IO, 8, einstein_state ) + /* block 0, ay8910 psg */ + AM_RANGE(0x02, 0x02) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I030, ay8910_device, data_r, address_w) + AM_RANGE(0x03, 0x03) AM_MIRROR(0xff04) AM_DEVWRITE(IC_I030, ay8910_device, data_w) + /* block 1, tms9928a vdp */ + AM_RANGE(0x08, 0x08) AM_MIRROR(0xff06) AM_DEVREADWRITE("tms9929a", tms9929a_device, vram_read, vram_write) + AM_RANGE(0x09, 0x09) AM_MIRROR(0xff06) AM_DEVREADWRITE("tms9929a", tms9929a_device, register_read, register_write) + /* block 2, i8251 uart */ + AM_RANGE(0x10, 0x10) AM_MIRROR(0xff06) AM_DEVREADWRITE(IC_I060, i8251_device, data_r, data_w) + AM_RANGE(0x11, 0x11) AM_MIRROR(0xff06) AM_DEVREADWRITE(IC_I060, i8251_device, status_r, control_w) + /* block 3, wd1770 floppy controller */ + AM_RANGE(0x18, 0x1b) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I042, wd1770_t, read, write) + /* block 4, internal controls */ + AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_READWRITE(einstein_kybintmsk_r, einstein_kybintmsk_w) + AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_WRITE(einstein_adcintmsk_w) + AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_WRITE(einstein_drsel_w) + AM_RANGE(0x24, 0x24) AM_MIRROR(0xff00) AM_WRITE(einstein_rom_w) + AM_RANGE(0x25, 0x25) AM_MIRROR(0xff00) AM_WRITE(einstein_fire_int_w) + /* block 5, z80ctc */ + AM_RANGE(0x28, 0x2b) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I058, z80ctc_device, read, write) + /* block 6, z80pio */ + AM_RANGE(0x30, 0x33) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I063, z80pio_device, read, write) +#if 0 + /* block 7, adc */ + AM_RANGE(0x38, 0x38) AM_MIRROR(0xff07) AM_DEVREADWRITE_LEGACY(IC_I050, adc0844_r, adc0844_w) +#endif +ADDRESS_MAP_END + +static ADDRESS_MAP_START( einstein2_io, AS_IO, 8, einstein_state ) + AM_IMPORT_FROM(einstein_io) + AM_RANGE(0x40, 0x47) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(einstein_80col_ram_r, einstein_80col_ram_w) + AM_RANGE(0x48, 0x48) AM_MIRROR(0xff00) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0x49, 0x49) AM_MIRROR(0xff00) AM_DEVWRITE("crtc", mc6845_device, register_w) + AM_RANGE(0x4c, 0x4c) AM_MIRROR(0xff00) AM_READ(einstein_80col_state_r) +ADDRESS_MAP_END + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( einstein ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('\xA3') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xBA') PORT_CHAR('\xBD') // is \xBA correct for double vertical bar || ? + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('-') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("EXTRA") + PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + /* fire buttons for analogue joysticks */ + PORT_START("BUTTONS") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1") PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 2 Button 1") PORT_PLAYER(2) + PORT_BIT(0xfc, IP_ACTIVE_HIGH, IPT_UNUSED) + + /* analog joystick 1 x axis */ + PORT_START("JOY1_X") + PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_REVERSE + + /* analog joystick 1 y axis */ + PORT_START("JOY1_Y") + PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_REVERSE + + /* analog joystick 2 x axis */ + PORT_START("JOY2_X") + PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_REVERSE + + /* analog joystick 2 Y axis */ + PORT_START("JOY2_Y") + PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE + + PORT_START("config") + PORT_CONFNAME(0x01, 0x00, "Floppy drive #1") + PORT_CONFSETTING(0x00, "Single sided") + PORT_CONFSETTING(0x01, "Double sided") + PORT_CONFNAME(0x02, 0x00, "Floppy drive #2") + PORT_CONFSETTING(0x00, "Single sided") + PORT_CONFSETTING(0x02, "Double sided") + PORT_CONFNAME(0x04, 0x00, "Floppy drive #3") + PORT_CONFSETTING(0x00, "Single sided") + PORT_CONFSETTING(0x04, "Double sided") + PORT_CONFNAME(0x08, 0x00, "Floppy drive #4") + PORT_CONFSETTING(0x00, "Single sided") + PORT_CONFSETTING(0x08, "Double sided") +INPUT_PORTS_END + +static INPUT_PORTS_START( einstein_80col ) + PORT_INCLUDE(einstein) + + /* dip switches on the 80 column card */ + PORT_START("80column_dips") + PORT_DIPNAME(0x02, 0x00, "Startup mode") + PORT_DIPSETTING(0x00, "40 column") + PORT_DIPSETTING(0x02, "80 column") + PORT_DIPNAME(0x04, 0x00, "50/60Hz") + PORT_DIPSETTING(0x00, "50Hz") + PORT_DIPSETTING(0x04, "60Hz") +INPUT_PORTS_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +/* F4 Character Displayer */ +static const gfx_layout einstei2_charlayout = +{ + 8, 10, /* 8 x 10 characters */ + 256, /* 256*2 characters */ + 1, /* 1 bits per pixel */ + { 0 }, + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 0x800*8, 0x801*8 }, + 8*8 +}; + +static GFXDECODE_START( einstei2 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, einstei2_charlayout, 16, 1 ) + GFXDECODE_ENTRY( "gfx1", 0x1000, einstei2_charlayout, 16, 1 ) +GFXDECODE_END + +static SLOT_INTERFACE_START( einstein_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( einstein, einstein_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(IC_I001, Z80, XTAL_X002 / 2) + MCFG_CPU_PROGRAM_MAP(einstein_mem) + MCFG_CPU_IO_MAP(einstein_io) + MCFG_CPU_CONFIG(einstein_daisy_chain) + + /* this is actually clocked at the system clock 4 MHz, but this would be too fast for our + driver. So we update at 50Hz and hope this is good enough. */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", einstein_state, einstein_keyboard_timer_callback, attotime::from_hz(50)) + + MCFG_DEVICE_ADD(IC_I063, Z80PIO, XTAL_X002 / 2) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_OUT_PB_CB(DEVWRITELINE("centronics", centronics_device, write_strobe)) + + MCFG_DEVICE_ADD(IC_I058, Z80CTC, XTAL_X002 / 2) + MCFG_Z80CTC_ZC0_CB(WRITELINE(einstein_state, einstein_serial_transmit_clock)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(einstein_state, einstein_serial_receive_clock)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(IC_I058, z80ctc_device, trg3)) + + /* the input to channel 0 and 1 of the ctc is a 2 MHz clock */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", einstein_state, einstein_ctc_trigger_callback, attotime::from_hz(XTAL_X002 /4)) + + /* Einstein daisy chain support for non-Z80 devices */ + MCFG_DEVICE_ADD("keyboard_daisy", EINSTEIN_KEYBOARD_DAISY, 0) + MCFG_DEVICE_ADD("adc_daisy", EINSTEIN_ADC_DAISY, 0) + MCFG_DEVICE_ADD("fire_daisy", EINSTEIN_FIRE_DAISY, 0) + + /* video hardware */ + MCFG_DEVICE_ADD( "tms9929a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) /* 16k RAM, provided by IC i040 and i041 */ + MCFG_TMS9928A_SET_SCREEN( "screen" ) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9929a", tms9929a_device, screen_update ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(IC_I030, AY8910, XTAL_X002 / 4) + MCFG_AY8910_PORT_B_READ_CB(READ8(einstein_state, einstein_keyboard_data_read)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(einstein_state, einstein_keyboard_line_write)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(IC_I063, z80pio_device, strobe_a)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(einstein_state, write_centronics_busy)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(einstein_state, write_centronics_perror)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(einstein_state, write_centronics_fault)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* uart */ + MCFG_DEVICE_ADD(IC_I060, I8251, 0) + + MCFG_WD1770_ADD(IC_I042, XTAL_X002) + + MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":0", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":1", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":2", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":3", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","einstein") + + /* RAM is provided by 8k DRAM ICs i009, i010, i011, i012, i013, i014, i015 and i016 */ + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( einstei2, einstein ) + + MCFG_CPU_MODIFY(IC_I001) + MCFG_CPU_IO_MAP(einstein2_io) + + MCFG_MACHINE_START_OVERRIDE(einstein_state,einstein2) + MCFG_MACHINE_RESET_OVERRIDE(einstein_state,einstein2) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_dualhsxs) + + MCFG_SCREEN_ADD("80column", RASTER) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DRIVER(einstein_state, screen_update_einstein2) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", einstei2) + + /* 2 additional colors for the 80 column screen */ + MCFG_PALETTE_ADD("palette", TMS9928A_PALETTE_SIZE + 2) + + MCFG_MC6845_ADD("crtc", MC6845, "80column", XTAL_X002 / 4) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(einstein_state, crtc_update_row) + MCFG_MC6845_OUT_DE_CB(WRITELINE(einstein_state, einstein_6845_de_changed)) +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +/* There are two sockets, i023 and i024, each either a 2764 or 27128 + * only i023 is used by default and fitted with the 8k bios (called MOS). + * + * We are missing dumps of version MOS 1.1, possibly of 1.0 if it exists. + */ +ROM_START( einstein ) + ROM_REGION(0x8000, "bios", 0) + /* i023 */ + ROM_SYSTEM_BIOS(0, "mos12", "MOS 1.2") + ROMX_LOAD("mos12.i023", 0, 0x2000, CRC(ec134953) SHA1(a02125d8ebcda48aa784adbb42a8b2d7ef3a4b77), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "mos121", "MOS 1.21") + ROMX_LOAD("mos121.i023", 0, 0x2000, CRC(a746eeb6) SHA1(f75aaaa777d0fd92225acba291f6bf428b341d3e), ROM_BIOS(2)) + ROM_RELOAD(0x2000, 0x2000) + /* i024 */ + ROM_FILL(0x4000, 0x4000, 0xff) +ROM_END + +ROM_START( einstei2 ) + ROM_REGION(0x8000, "bios", 0) + /* i023 */ + ROM_SYSTEM_BIOS(0, "mos12", "MOS 1.2") + ROMX_LOAD("mos12.i023", 0, 0x2000, CRC(ec134953) SHA1(a02125d8ebcda48aa784adbb42a8b2d7ef3a4b77), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "mos121", "MOS 1.21") + ROMX_LOAD("mos121.i023", 0, 0x2000, CRC(a746eeb6) SHA1(f75aaaa777d0fd92225acba291f6bf428b341d3e), ROM_BIOS(2)) + ROM_RELOAD(0x2000, 0x2000) + /* i024 */ + ROM_FILL(0x4000, 0x4000, 0xff) + + /* character rom from 80 column card */ + ROM_REGION(0x2000, "gfx1", 0) + ROM_LOAD("tk02-v1.00.rom", 0, 0x2000, CRC(ad3c4346) SHA1(cd57e630371b4d0314e3f15693753fb195c7257d)) +ROM_END + +ROM_START( einst256 ) + ROM_REGION(0x8000, "bios", 0) + ROM_LOAD("tc256.rom", 0x0000, 0x4000, CRC(ef8dad88) SHA1(eb2102d3bef572db7161c26a7c68a5fcf457b4d0) ) +ROM_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, einstein, 0, 0, einstein, einstein, driver_device, 0, "Tatung", "Einstein TC-01", 0 ) +COMP( 1984, einstei2, einstein, 0, einstei2, einstein_80col, driver_device, 0, "Tatung", "Einstein TC-01 + 80 column device", 0 ) +COMP( 1984, einst256, 0, 0, einstein, einstein, driver_device, 0, "Tatung", "Einstein 256", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/elecbowl.c b/src/mame/drivers/elecbowl.c new file mode 100644 index 00000000000..934bdd1f719 --- /dev/null +++ b/src/mame/drivers/elecbowl.c @@ -0,0 +1,222 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Kevin Horton +/*************************************************************************** + + ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** + + Marx Series 300 Electronic Bowling Game + Main board: + * TMS1100NLL MP3403 DBS 7836 SINGAPORE + * 4*SN75492 quad segment driver, 2*SN74259 8-line demultiplexer, + 2*CD4043 quad r/s input latch + * 5 7seg LEDs, 15 lamps(10 lamps projected to bowling pins reflection), + 1bit-sound with crude volume control + * edge connector to sensors(switches trigger when ball rolls over) + and other inputs + + lamp translation table: SN74259.u5(mux 1) goes to MAME output lamp5x, + SN74259.u6(mux 2) goes to MAME output lamp6x. u1-u3 are SN75492 ICs, + where other: u1 A2 is N/C, u3 A1 is from O2 and goes to digits seg C. + + u5 Q0 -> u1 A4 -> L2 (pin #2) u6 Q0 -> u3 A4 -> L1 (pin #1) + u5 Q1 -> u1 A5 -> L4 (pin #4) u6 Q1 -> u3 A5 -> L5 (pin #5) + u5 Q2 -> u1 A6 -> L7 (pin #7) u6 Q2 -> u2 A3 -> L11 (player 1) + u5 Q3 -> u1 A1 -> L8 (pin #8) u6 Q3 -> u2 A2 -> L12 (player 2) + u5 Q4 -> u3 A2 -> L3 (pin #3) u6 Q4 -> u2 A1 -> L15 (?) + u5 Q5 -> u2 A6 -> L6 (pin #6) u6 Q5 -> u3 A6 -> L14 (?) + u5 Q6 -> u2 A5 -> L10 (pin #10) u6 Q6 -> u1 A3 -> L13 (spare) + u5 Q7 -> u2 A4 -> L9 (pin #9) u6 Q7 -> u3 A3 -> digit 4 B+C + +***************************************************************************/ + +#include "includes/hh_tms1k.h" +#include "elecbowl.lh" + + +class elecbowl_state : public hh_tms1k_state +{ +public: + elecbowl_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + + +/*************************************************************************** + + Display + +***************************************************************************/ + +void elecbowl_state::prepare_display() +{ + // standard 7segs + for (int y = 0; y < 4; y++) + { + m_display_segmask[y] = 0x7f; + m_display_state[y] = (m_r >> (y + 4) & 1) ? m_o : 0; + } + + // lamp muxes + UINT8 mask = 1 << (m_o & 7); + UINT8 d = (m_r & 2) ? mask : 0; + if (~m_r & 1) + m_display_state[5] = (m_display_state[5] & ~mask) | d; + if (~m_r & 4) + m_display_state[6] = (m_display_state[6] & ~mask) | d; + + // digit 4 is from mux2 Q7 + m_display_segmask[4] = 6; + m_display_state[4] = (m_display_state[6] & 0x80) ? 6 : 0; + + set_display_size(8, 7); + display_update(); +} + + + +/*************************************************************************** + + I/O + +***************************************************************************/ + +WRITE16_MEMBER(elecbowl_state::write_r) +{ + // R5-R7,R10: input mux + m_inp_mux = (data >> 5 & 7) | (data >> 7 & 8); + + // R9: speaker out + // R3,R8: speaker volume.. + m_speaker->level_w(data >> 9 & 1); + + // R4-R7: select digit + // R0,R2: lamp mux1,2 _enable + // R1: lamp muxes state + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(elecbowl_state::write_o) +{ + //if (data & 0x80) printf("%X ",data&0x7f); + + // O0-O2: lamp muxes select + // O0-O6: digit segments A-G + // O7: N/C + m_o = data & 0x7f; + prepare_display(); +} + +READ8_MEMBER(elecbowl_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(4); +} + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +static INPUT_PORTS_START( elecbowl ) + PORT_START("IN.0") // R5 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) + + PORT_START("IN.1") // R6 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) // reset/test? + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) // reset/test? + + PORT_START("IN.2") // R7 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) + + PORT_START("IN.3") // R10 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) // 2 players sw? +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +// output PLA is not dumped +static const UINT16 elecbowl_output_pla[0x20] = +{ + lA+lB+lC+lD+lE+lF, // 0 + lB+lC, // 1 + lA+lB+lG+lE+lD, // 2 + lA+lB+lG+lC+lD, // 3 + lF+lB+lG+lC, // 4 + lA+lF+lG+lC+lD, // 5 + lA+lF+lG+lC+lD+lE, // 6 + lA+lB+lC, // 7 + lA+lB+lC+lD+lE+lF+lG, // 8 + lA+lB+lG+lF+lC+lD, // 9 + + 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0,1,2,3,4,5,6,7, // lamp muxes select + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f +}; + +static MACHINE_CONFIG_START( elecbowl, elecbowl_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K, C=100pf -> ~350kHz + MCFG_TMS1XXX_OUTPUT_PLA(elecbowl_output_pla) + MCFG_TMS1XXX_READ_K_CB(READ8(elecbowl_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecbowl_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(elecbowl_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_elecbowl) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( elecbowl ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp3403.u9", 0x0000, 0x0800, CRC(9eabaa7d) SHA1(b1f54587ed7f2bbf3a5d49075c807296384c2b06) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_elecbowl_output.pla", 0, 365, NO_DUMP ) +ROM_END + + +CONS( 1978, elecbowl, 0, 0, elecbowl, elecbowl, driver_device, 0, "Marx", "Electronic Bowling (Marx)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/electron.c b/src/mame/drivers/electron.c new file mode 100644 index 00000000000..0b4152026cf --- /dev/null +++ b/src/mame/drivers/electron.c @@ -0,0 +1,208 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/****************************************************************************** + Acorn Electron driver + + MESS Driver By: + + Wilbert Pol + +I don't have a real system to verify the behaviour of the emulation. The things +that can be done through BASIC programs seem to behave properly (most of the time :). + +Incomplete: + - Sound (sound is too high?) + - Graphics (seems to be wrong for several games) + - 1 MHz bus is not emulated + - Bus claiming by ULA is not implemented + - Currently the cartridge support always loads the upper rom in page 12 + and the lower rom in page 0. This might need further documentation in + the software list and loading code. + +Missing: + - Support for floppy disks + - Other peripherals + - Keyboard is missing the 'Break' key + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "includes/electron.h" +#include "imagedev/cassette.h" +#include "formats/uef_cas.h" +#include "sound/beep.h" + +static const rgb_t electron_palette[8]= +{ + rgb_t(0x0ff,0x0ff,0x0ff), + rgb_t(0x000,0x0ff,0x0ff), + rgb_t(0x0ff,0x000,0x0ff), + rgb_t(0x000,0x000,0x0ff), + rgb_t(0x0ff,0x0ff,0x000), + rgb_t(0x000,0x0ff,0x000), + rgb_t(0x0ff,0x000,0x000), + rgb_t(0x000,0x000,0x000) +}; + +PALETTE_INIT_MEMBER(electron_state, electron) +{ + palette.set_pen_colors(0, electron_palette, ARRAY_LENGTH(electron_palette)); +} + +static ADDRESS_MAP_START(electron_mem, AS_PROGRAM, 8, electron_state ) + AM_RANGE(0x0000, 0x7fff) AM_RAM AM_REGION("maincpu", 0x00000) /* 32KB of RAM */ + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") /* Banked ROM pages */ + AM_RANGE(0xc000, 0xfbff) AM_ROM AM_REGION("user1", 0x40000) /* OS ROM */ + AM_RANGE(0xfc00, 0xfcff) AM_READWRITE(electron_jim_r, electron_jim_w ) /* JIM pages */ + AM_RANGE(0xfd00, 0xfdff) AM_READWRITE(electron_1mhz_r, electron_1mhz_w ) /* 1 MHz bus */ + AM_RANGE(0xfe00, 0xfeff) AM_READWRITE(electron_ula_r, electron_ula_w ) /* Electron ULA */ + AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("user1", 0x43f00) /* OS ROM continued */ +ADDRESS_MAP_END + +static INPUT_PORTS_START( electron ) + + PORT_START("LINE.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92 | \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('|') PORT_CHAR('\\') // on the real keyboard, this would be on the 1st row, the 3rd key after 0 + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR('[') PORT_CHAR(']') + /* PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_) */ + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90 ^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93 _ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('_') PORT_CHAR('}') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_START("LINE.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 \xC2\xA3 {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('\xA3') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + /* PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_) */ + + PORT_START("LINE.3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE.4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("LINE.5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("LINE.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("LINE.7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("LINE.8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + + PORT_START("LINE.9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("LINE.10") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + + PORT_START("LINE.11") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("LINE.12") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("LINE.13") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESCAPE") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FUNC") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + +INPUT_PORTS_END + +static MACHINE_CONFIG_START( electron, electron_state ) + MCFG_CPU_ADD( "maincpu", M6502, 2000000 ) + MCFG_CPU_PROGRAM_MAP( electron_mem) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE( 50.08 ) + MCFG_SCREEN_SIZE( 640, 312 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 640-1, 0, 256-1 ) + MCFG_SCREEN_UPDATE_DRIVER(electron_state, screen_update_electron) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD( "palette", 16 ) + MCFG_PALETTE_INIT_OWNER(electron_state, electron) + + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(uef_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "electron_cart") + MCFG_GENERIC_LOAD(electron_state, electron_cart) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","electron_cart") +MACHINE_CONFIG_END + + +/* Electron Rom Load */ +ROM_START(electron) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x44000, "user1", 0 ) /* OS Rom */ + ROM_LOAD( "os.rom", 0x40000, 0x4000, CRC(bf63fb1f) SHA1(a48b8fa0cfb09140e808ac8a187316c605a0b32e) ) /* Os rom */ + /* 00000 0 available for cartridges */ + /* 04000 1 available for cartridges */ + /* 08000 2 available for cartridges */ + /* 0c000 3 available for cartridges */ + /* 10000 4 available for cartridges */ + /* 14000 5 available for cartridges */ + /* 18000 6 available for cartridges */ + /* 1c000 7 available for cartridges */ + /* 20000 8 keyboard */ + /* 24000 9 keyboard mirror */ + /* 28000 10 Basic rom */ + ROM_LOAD( "basic.rom", 0x28000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281) ) + /* 2c000 11 Basic rom mirror */ + ROM_COPY( "user1", 0x28000, 0x2c000, 0x4000 ) + /* 30000 12 available for cartridges with a language ROM */ + /* 34000 13 available for cartridges with a language ROM */ + /* 38000 14 available for cartridges with a language ROM */ + /* 3c000 15 available for cartridges with a language ROM */ +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1983, electron, 0, 0, electron, electron, driver_device, 0, "Acorn", "Acorn Electron", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/elekscmp.c b/src/mame/drivers/elekscmp.c new file mode 100644 index 00000000000..7783184917c --- /dev/null +++ b/src/mame/drivers/elekscmp.c @@ -0,0 +1,165 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Elektor SC/MP + + 22/11/2009 Skeleton driver. + + 10/MAY/2012 Added keyboard [Robbbert] + +To Use: +- Press MINUS to enter data input mode +- Press UP or DOWN to cycle through addresses + +At the moment Paste cannot be tested, but if it worked, you could +paste this in: -0F0011^22^33^44^55^66^77^88^99^ + +It seems the only way to exit each mode is to do a Soft Reset. + +ToDo: +- Add Cassette +- Verify that ROMS are good (they seem to be) + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/scmp/scmp.h" +#include "elekscmp.lh" + + +class elekscmp_state : public driver_device +{ +public: + elekscmp_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_x0(*this, "X0"), + m_x1(*this, "X1"), + m_x2(*this, "X2"), + m_x3(*this, "X3") { } + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(hex_display_w); + UINT8 convert_key(UINT8 data); + +protected: + required_device m_maincpu; + required_ioport m_x0; + required_ioport m_x1; + required_ioport m_x2; + required_ioport m_x3; +}; + + +WRITE8_MEMBER(elekscmp_state::hex_display_w) +{ + output_set_digit_value(offset, data); +} + +UINT8 elekscmp_state::convert_key(UINT8 data) +{ + UINT8 i; + for (i = 0; i < 8; i++) + if (BIT(data, i)) + return i; + + return 0xff; +} + +READ8_MEMBER(elekscmp_state::keyboard_r) +{ + UINT8 data; + + data = m_x0->read(); + + if (data) + return 0x80 | convert_key(data); + + data = m_x1->read(); + + if (data) + return 0x88 | convert_key(data); + + data = m_x2->read(); + + if (data) + return 0x80 | (convert_key(data) << 4); + + data = m_x3->read(); + + if (data) + m_maincpu->reset(); + + return 0; +} + +static ADDRESS_MAP_START(elekscmp_mem, AS_PROGRAM, 8, elekscmp_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x0fff) + AM_RANGE(0x000, 0x5ff) AM_ROM // ROM + AM_RANGE(0x700, 0x707) AM_WRITE(hex_display_w) + AM_RANGE(0x708, 0x70f) AM_READ(keyboard_r) + AM_RANGE(0x800, 0xfff) AM_RAM // RAM - up to 2K of RAM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( elekscmp ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CPU Reg") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Block Transfer") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cassette") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Subtract") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Modify") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Run") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('X') + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0xfe, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( elekscmp, elekscmp_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",INS8060, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(elekscmp_mem) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_elekscmp) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( elekscmp ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // Too many possible errors, few found and fixed, but not sure if there are more + ROM_LOAD( "elbug.001", 0x0000, 0x0200, BAD_DUMP CRC(f733da28) SHA1(b65d98be03eab80478167964beec26bb327bfdf3)) + ROM_LOAD( "elbug.002", 0x0200, 0x0200, BAD_DUMP CRC(529c0b88) SHA1(bd72dd890cd974e1744ca70aa3457657374cbf76)) + ROM_LOAD( "elbug.003", 0x0400, 0x0200, BAD_DUMP CRC(13585ad1) SHA1(93f722b3e84095a1b701b04bf9018c891933b9ff)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, elekscmp, 0, 0, elekscmp, elekscmp, driver_device, 0, "Elektor Electronics", "Elektor SC/MP", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/elf.c b/src/mame/drivers/elf.c new file mode 100644 index 00000000000..5fdfc47035b --- /dev/null +++ b/src/mame/drivers/elf.c @@ -0,0 +1,288 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Netronics Elf II + +****************************************************************************/ + +/* + + TODO: + + - proper layout + +*/ + +#include "includes/elf.h" +#include "elf2.lh" + +#define RUN \ + BIT(m_special->read(), 0) + +#define LOAD \ + BIT(m_special->read(), 1) + +#define MEMORY_PROTECT \ + BIT(m_special->read(), 2) + +#define INPUT \ + BIT(m_special->read(), 3) + +/* Read/Write Handlers */ + +READ8_MEMBER( elf2_state::dispon_r ) +{ + m_vdc->disp_on_w(1); + m_vdc->disp_on_w(0); + + return 0xff; +} + +READ8_MEMBER( elf2_state::data_r ) +{ + return m_data; +} + +WRITE8_MEMBER( elf2_state::data_w ) +{ + m_led_l->a_w(data & 0x0f); + m_led_h->a_w(data >> 4); +} + +WRITE8_MEMBER( elf2_state::memory_w ) +{ + if (LOAD) + { + if (MEMORY_PROTECT) + { + /* latch data from memory */ + data = m_ram->pointer()[offset]; + } + else + { + /* write latched data to memory */ + m_ram->pointer()[offset] = data; + } + + /* write data to 7 segment displays */ + m_led_l->a_w(data & 0x0f); + m_led_h->a_w(data >> 4); + } +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( elf2_mem, AS_PROGRAM, 8, elf2_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x00ff) AM_RAMBANK("bank1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( elf2_io, AS_IO, 8, elf2_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x01, 0x01) AM_READ(dispon_r) + AM_RANGE(0x04, 0x04) AM_READWRITE(data_r, data_w) +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( elf2_state::input_w ) +{ + if (newval) + { + /* assert DMAIN */ + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, ASSERT_LINE); + } +} + +static INPUT_PORTS_START( elf2 ) + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_R) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOAD") PORT_CODE(KEYCODE_L) PORT_TOGGLE + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M/P") PORT_CODE(KEYCODE_M) PORT_TOGGLE + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INPUT") PORT_CODE(KEYCODE_ENTER) PORT_CHANGED_MEMBER(DEVICE_SELF, elf2_state, input_w, 0) +INPUT_PORTS_END + +/* CDP1802 Configuration */ + +READ_LINE_MEMBER( elf2_state::wait_r ) +{ + return LOAD; +} + +READ_LINE_MEMBER( elf2_state::clear_r ) +{ + return RUN; +} + +READ_LINE_MEMBER( elf2_state::ef4_r ) +{ + return INPUT; +} + +WRITE_LINE_MEMBER( elf2_state::q_w ) +{ + output_set_led_value(0, state); +} + +READ8_MEMBER( elf2_state::dma_r ) +{ + return m_data; +} + +WRITE8_MEMBER( elf2_state::sc_w ) +{ + switch (data) + { + case COSMAC_STATE_CODE_S2_DMA: + case COSMAC_STATE_CODE_S3_INTERRUPT: + /* clear DMAIN */ + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, CLEAR_LINE); + break; + + default: + break; + } +} + +/* MM74C923 Interface */ + +WRITE_LINE_MEMBER( elf2_state::da_w ) +{ + if (state) + { + /* shift keyboard data to latch */ + m_data <<= 4; + m_data |= m_kb->read() & 0x0f; + + if (LOAD) + { + /* write data to 7 segment displays */ + m_led_l->a_w(m_data & 0x0f); + m_led_h->a_w(m_data >> 4); + } + } +} + +/* Machine Initialization */ + +void elf2_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* initialize LED displays */ + m_led_l->rbi_w(1); + m_led_h->rbi_w(1); + + /* setup memory banking */ + program.install_read_bank(0x0000, 0x00ff, "bank1"); + program.install_write_handler(0x0000, 0x00ff, write8_delegate(FUNC(elf2_state::memory_w), this)); + membank("bank1")->configure_entry(0, m_ram->pointer()); + membank("bank1")->set_entry(0); + + /* register for state saving */ + save_item(NAME(m_data)); +} + +/* Machine Driver */ + +QUICKLOAD_LOAD_MEMBER( elf2_state, elf ) +{ + int size = image.length(); + + if (size > m_ram->size()) + { + return IMAGE_INIT_FAIL; + } + + image.fread(m_ram->pointer(), size); + + return IMAGE_INIT_PASS; +} + +static MACHINE_CONFIG_START( elf2, elf2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_3_579545MHz/2) + MCFG_CPU_PROGRAM_MAP(elf2_mem) + MCFG_CPU_IO_MAP(elf2_io) + MCFG_COSMAC_WAIT_CALLBACK(READLINE(elf2_state, wait_r)) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(elf2_state, clear_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(elf2_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(elf2_state, q_w)) + MCFG_COSMAC_DMAR_CALLBACK(READ8(elf2_state, dma_r)) + MCFG_COSMAC_DMAW_CALLBACK(DEVWRITE8(CDP1861_TAG, cdp1861_device, dma_w)) + MCFG_COSMAC_SC_CALLBACK(WRITE8(elf2_state, sc_w)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_elf2) + + MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, XTAL_3_579545MHz/2) + MCFG_CDP1861_IRQ_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) + MCFG_CDP1861_DMA_OUT_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT)) + MCFG_CDP1861_EFX_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) + MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2) + + /* devices */ + MCFG_DEVICE_ADD(MM74C923_TAG, MM74C923, 0) + MCFG_MM74C922_OSC(CAP_U(0.15)) + MCFG_MM74C922_DEBOUNCE(CAP_U(1)) + MCFG_MM74C922_DA_CALLBACK(WRITELINE(elf2_state, da_w)) + MCFG_MM74C922_X1_CALLBACK(IOPORT("X1")) + MCFG_MM74C922_X2_CALLBACK(IOPORT("X2")) + MCFG_MM74C922_X3_CALLBACK(IOPORT("X3")) + MCFG_MM74C922_X4_CALLBACK(IOPORT("X4")) + + MCFG_DEVICE_ADD(DM9368_H_TAG, DM9368, 0) + MCFG_OUTPUT_NAME("digit0") + MCFG_DEVICE_ADD(DM9368_L_TAG, DM9368, 0) + MCFG_OUTPUT_NAME("digit1") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_QUICKLOAD_ADD("quickload", elf2_state, elf, "bin", 0) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( elf2 ) + ROM_REGION( 0x10000, CDP1802_TAG, ROMREGION_ERASE00 ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, elf2, 0, 0, elf2, elf2, driver_device, 0, "Netronics", "Elf II", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/elwro800.c b/src/mame/drivers/elwro800.c new file mode 100644 index 00000000000..fa377badef9 --- /dev/null +++ b/src/mame/drivers/elwro800.c @@ -0,0 +1,626 @@ +// license:BSD-3-Clause +// copyright-holders:Mariusz Wojcieszek +/*************************************************************************** + + Elwro 800 Junior + + Driver by Mariusz Wojcieszek + + ToDo: + - 8251 DTR and DTS signals are connected (with some additional logic) to NMI of Z80, this + is not emulated + - 8251 is used for JUNET network (a network of Elwro 800 Junior computers, allows sharing + floppy disc drives and printers) - network is not emulated + +****************************************************************************/ + +#include "emu.h" +#include "includes/spectrum.h" + +/* Components */ +#include "cpu/z80/z80.h" +#include "machine/upd765.h" /* for floppy disc controller */ +#include "machine/i8255.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8251.h" + +/* Devices */ +#include "imagedev/cassette.h" +#include "formats/tzx_cas.h" +#include "machine/ram.h" + + +class elwro800_state : public spectrum_state +{ +public: + elwro800_state(const machine_config &mconfig, device_type type, const char *tag) + : spectrum_state(mconfig, type, tag), + m_i8251(*this, "i8251"), + m_i8255(*this, "ppi8255"), + m_centronics(*this, "centronics"), + m_io_line8(*this, "LINE8"), + m_io_line9(*this, "LINE9"), + m_io_network_id(*this, "NETWORK ID") + { + } + + /* for elwro800 */ + /* RAM mapped at 0 */ + UINT8 m_ram_at_0000; + + /* NR signal */ + UINT8 m_NR; + UINT8 m_df_on_databus; + + DECLARE_DIRECT_UPDATE_MEMBER(elwro800_direct_handler); + DECLARE_WRITE8_MEMBER(elwro800jr_fdc_control_w); + DECLARE_READ8_MEMBER(elwro800jr_io_r); + DECLARE_WRITE8_MEMBER(elwro800jr_io_w); + DECLARE_MACHINE_RESET(elwro800); + INTERRUPT_GEN_MEMBER(elwro800jr_interrupt); + DECLARE_READ8_MEMBER(i8255_port_c_r); + DECLARE_WRITE8_MEMBER(i8255_port_c_w); + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + +protected: + required_device m_i8251; + required_device m_i8255; + required_device m_centronics; + required_ioport m_io_line8; + required_ioport m_io_line9; + required_ioport m_io_network_id; + + void elwro800jr_mmu_w(UINT8 data); + + int m_centronics_ack; +}; + + +/************************************* + * + * When RAM is mapped at 0x0000 - 0x1fff (in CP/J mode), reading a location 66 with /M1=0 + * (effectively reading NMI vector) is hardwired to return 0xDF (RST #18) + * (note that in CP/J mode address 66 is used for FCB) + * + *************************************/ +DIRECT_UPDATE_MEMBER(elwro800_state::elwro800_direct_handler) +{ + if (m_ram_at_0000 && address == 0x66) + { + direct.explicit_configure(0x66, 0x66, 0, &m_df_on_databus); + return ~0; + } + return address; +} + +/************************************* + * + * UPD765/Floppy drive + * + *************************************/ + +WRITE8_MEMBER(elwro800_state::elwro800jr_fdc_control_w) +{ + m_upd765_0->get_device()->mon_w(!BIT(data, 0)); + m_upd765_1->get_device()->mon_w(!BIT(data, 1)); + + m_upd765->tc_w(data & 0x04); + + if(!(data & 8)) + m_upd765->reset(); +} + +/************************************* + * + * I/O port F7: memory mapping + * + *************************************/ + +void elwro800_state::elwro800jr_mmu_w(UINT8 data) +{ + UINT8 *prom = memregion("proms")->base() + 0x200; + UINT8 *messram = m_ram->pointer(); + UINT8 cs; + UINT8 ls175; + + ls175 = BITSWAP8(data, 7, 6, 5, 4, 4, 5, 7, 6) & 0x0f; + + cs = prom[((0x0000 >> 10) | (ls175 << 6)) & 0x1ff]; + if (!BIT(cs,0)) + { + // rom BAS0 + membank("bank1")->set_base(memregion("maincpu")->base() + 0x0000); /* BAS0 ROM */ + m_maincpu->space(AS_PROGRAM).nop_write(0x0000, 0x1fff); + m_ram_at_0000 = 0; + } + else if (!BIT(cs,4)) + { + // rom BOOT + membank("bank1")->set_base(memregion("maincpu")->base() + 0x4000); /* BOOT ROM */ + m_maincpu->space(AS_PROGRAM).nop_write(0x0000, 0x1fff); + m_ram_at_0000 = 0; + } + else + { + // RAM + membank("bank1")->set_base(messram); + m_maincpu->space(AS_PROGRAM).install_write_bank(0x0000, 0x1fff, "bank1"); + m_ram_at_0000 = 1; + } + + cs = prom[((0x2000 >> 10) | (ls175 << 6)) & 0x1ff]; + if (!BIT(cs,1)) + { + membank("bank2")->set_base(memregion("maincpu")->base() + 0x2000); /* BAS1 ROM */ + m_maincpu->space(AS_PROGRAM).nop_write(0x2000, 0x3fff); + } + else + { + membank("bank2")->set_base(messram + 0x2000); /* RAM */ + m_maincpu->space(AS_PROGRAM).install_write_bank(0x2000, 0x3fff, "bank2"); + } + + if (BIT(ls175,2)) + { + // relok + m_screen_location = messram + 0xe000; + } + else + { + m_screen_location = messram + 0x4000; + } + + m_NR = BIT(ls175,3); + if (BIT(ls175,3)) + { + logerror("Reading network number\n"); + } +} + +/************************************* + * + * 8255: joystick and Centronics printer connections + * + *************************************/ + +WRITE_LINE_MEMBER(elwro800_state::write_centronics_ack) +{ + m_centronics_ack = state; + m_i8255->pc2_w(state); +} + +READ8_MEMBER(elwro800_state::i8255_port_c_r) +{ + return m_centronics_ack << 2; +} + +WRITE8_MEMBER(elwro800_state::i8255_port_c_w) +{ + m_centronics->write_strobe((data >> 7) & 0x01); +} + +/************************************* + * + * I/O reads and writes + * + * I/O accesses are decoded by prom which uses 8 low address lines (A0-A8) as input + * and outputs chip select signals for system components. Standard addresses are: + * + * 0x1F: 8255 port A (joystick) + * 0xBE: 8251 data (Junet network) + * 0xBF: 8251 control/status (Junet network) + * 0xDC: 8255 control + * 0xDD: 8255 port C (centronics 7-strobe, 2-ack) + * 0xDE: 8255 port B (centronics data) + * 0xDF: 8255 port A (joystick) + * 0xEE: FDC 765A status + * 0xEF: FDC 765A command and data + * 0xF1: FDC control (motor on/off) + * 0xF7: memory banking + * 0xFE (write): border color, speaker and tape (as in Spectrum) + * 0x??FE, 0x??7F, 0x??7B (read): keyboard reading + *************************************/ + +READ8_MEMBER(elwro800_state::elwro800jr_io_r) +{ + UINT8 *prom = memregion("proms")->base(); + UINT8 cs = prom[offset & 0x1ff]; + + if (!BIT(cs,0)) + { + // CFE + int mask = 0x8000; + int data = 0xff; + int i; + ioport_port *io_ports[9] = { m_io_line7, m_io_line6, m_io_line5, m_io_line4, m_io_line3, m_io_line2, m_io_line1, m_io_line0, m_io_line8 }; + + if ( !m_NR ) + { + for (i = 0; i < 9; mask >>= 1, i++) + { + if (!(offset & mask)) + { + data &= io_ports[i]->read(); + } + } + + if ((offset & 0xff) == 0xfb) + { + data &= m_io_line9->read(); + } + + /* cassette input from wav */ + if (m_cassette->input() > 0.0038 ) + { + data &= ~0x40; + } + } + else + { + data = m_io_network_id->read(); + } + + return data; + } + else if (!BIT(cs,1)) + { + // CF7 + } + else if (!BIT(cs,2)) + { + // CS55 + return m_i8255->read(space, (offset & 0x03) ^ 0x03); + } + else if (!BIT(cs,3)) + { + // CSFDC + if (offset & 1) + { + return m_upd765->fifo_r(space, 0, 0xff); + } + else + { + return m_upd765->msr_r(space, 0, 0xff); + } + } + else if (!BIT(cs,4)) + { + // CS51 + if (offset & 1) + { + return m_i8251->status_r(space, 0); + } + else + { + return m_i8251->data_r(space, 0); + } + } + else if (!BIT(cs,5)) + { + // CF1 + } + else + { + logerror("Unmapped I/O read: %04x\n", offset); + } + return 0x00; +} + +WRITE8_MEMBER(elwro800_state::elwro800jr_io_w) +{ + UINT8 *prom = memregion("proms")->base(); + UINT8 cs = prom[offset & 0x1ff]; + + if (!BIT(cs,0)) + { + // CFE + spectrum_port_fe_w(space, 0, data); + } + else if (!BIT(cs,1)) + { + // CF7 + elwro800jr_mmu_w(data); + } + else if (!BIT(cs,2)) + { + // CS55 + m_i8255->write(space, (offset & 0x03) ^ 0x03, data); + } + else if (!BIT(cs,3)) + { + // CSFDC + if (offset & 1) + { + m_upd765->fifo_w(space, 0, data, 0xff); + } + } + else if (!BIT(cs,4)) + { + // CS51 + if (offset & 1) + { + m_i8251->control_w(space, 0, data); + } + else + { + m_i8251->data_w(space, 0, data); + } + } + else if (!BIT(cs,5)) + { + // CF1 + elwro800jr_fdc_control_w(space, 0, data); + } + else + { + logerror("Unmapped I/O write: %04x %02x\n", offset, data); + } +} + +/************************************* + * + * Memory maps + * + *************************************/ + +static ADDRESS_MAP_START(elwro800_mem, AS_PROGRAM, 8, elwro800_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") + AM_RANGE(0x2000, 0x3fff) AM_RAMBANK("bank2") + AM_RANGE(0x4000, 0xffff) AM_RAMBANK("bank3") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(elwro800_io, AS_IO, 8, elwro800_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(elwro800jr_io_r, elwro800jr_io_w) +ADDRESS_MAP_END + +/************************************* + * + * Input ports + * + *************************************/ + +static INPUT_PORTS_START( elwro800 ) + PORT_START("LINE0") /* 0xFEFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(':') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + + PORT_START("LINE1") /* 0xFDFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + + PORT_START("LINE2") /* 0xFBFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + + PORT_START("LINE3") /* 0xF7FE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') + + PORT_START("LINE4") /* 0xEFFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 _") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + + PORT_START("LINE5") /* 0xDFFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + + PORT_START("LINE6") /* 0xBFFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + + PORT_START("LINE7") /* 0x7FFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SYMBOL SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ -") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('-') + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC4\x98") PORT_CODE(KEYCODE_0_PAD) // LATIN CAPITAL LETTER E WITH OGONEK + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x93") PORT_CODE(KEYCODE_1_PAD) // LATIN CAPITAL LETTER O WITH ACUTE + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\x9A") PORT_CODE(KEYCODE_2_PAD) // LATIN CAPITAL LETTER S WITH ACUTE + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\x81") PORT_CODE(KEYCODE_3_PAD) // LATIN CAPITAL LETTER L WITH STROKE + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\xB9") PORT_CODE(KEYCODE_4_PAD) // LATIN CAPITAL LETTER Z WITH ACUTE + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\x83") PORT_CODE(KEYCODE_5_PAD) // LATIN CAPITAL LETTER N WITH ACUTE + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC4\x84") PORT_CODE(KEYCODE_6_PAD) // LATIN CAPITAL LETTER A WITH OGONEK + + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DIR") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC4\x86") PORT_CODE(KEYCODE_7_PAD) // LATIN CAPITAL LETTER C WITH ACUTE + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\xBB") PORT_CODE(KEYCODE_8_PAD) // LATIN CAPITAL LETTER Z WITH DOT ABOVE + + PORT_START("JOY") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left") PORT_CODE(JOYCODE_X_LEFT_SWITCH) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up") PORT_CODE(JOYCODE_Y_UP_SWITCH) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire") PORT_CODE(JOYCODE_BUTTON1) + + PORT_START("NETWORK ID") + PORT_DIPNAME( 0x3f, 0x01, "Computer network ID" ) + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x10, "16" ) + PORT_DIPSETTING( 0x11, "17" ) + +INPUT_PORTS_END + +/************************************* + * + * Machine + * + *************************************/ + +MACHINE_RESET_MEMBER(elwro800_state,elwro800) +{ + UINT8 *messram = m_ram->pointer(); + + m_df_on_databus = 0xdf; + memset(messram, 0, 64*1024); + + membank("bank3")->set_base(messram + 0x4000); + + m_port_7ffd_data = 0; + m_port_1ffd_data = -1; + + // this is a reset of ls175 in mmu + elwro800jr_mmu_w(0); + + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(elwro800_state::elwro800_direct_handler), this)); +} + +INTERRUPT_GEN_MEMBER(elwro800_state::elwro800jr_interrupt) +{ + device.execute().set_input_line(0, HOLD_LINE); +} + +static SLOT_INTERFACE_START( elwro800jr_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +/* F4 Character Displayer */ +static const gfx_layout elwro800_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( elwro800 ) + GFXDECODE_ENTRY( "maincpu", 0x3c00, elwro800_charlayout, 0, 8 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( elwro800, elwro800_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, 3500000) /* 3.5 MHz */ + MCFG_CPU_PROGRAM_MAP(elwro800_mem) + MCFG_CPU_IO_MAP(elwro800_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", elwro800_state, elwro800jr_interrupt) + + MCFG_MACHINE_RESET_OVERRIDE(elwro800_state,elwro800) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50.08) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(SPEC_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, SPEC_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1) + MCFG_SCREEN_UPDATE_DRIVER(elwro800_state, screen_update_spectrum ) + MCFG_SCREEN_VBLANK_DRIVER(elwro800_state, screen_eof_spectrum) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(elwro800_state, spectrum ) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", elwro800) + + MCFG_VIDEO_START_OVERRIDE(elwro800_state, spectrum ) + + MCFG_UPD765A_ADD("upd765", true, true) + + MCFG_DEVICE_ADD("ppi8255", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(IOPORT("JOY")) + MCFG_I8255_IN_PORTB_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) + MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_IN_PORTC_CB(READ8(elwro800_state, i8255_port_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(elwro800_state, i8255_port_c_w)) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(elwro800_state, write_centronics_ack)) + + MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD("i8251", I8251, 0) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(tzx_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + + MCFG_FLOPPY_DRIVE_ADD("upd765:0", elwro800jr_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", elwro800jr_floppies, "525hd", floppy_image_device::default_floppy_formats) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +/************************************* + * + * ROM definition + * + *************************************/ + +ROM_START( elwro800 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bas04.epr", 0x0000, 0x2000, CRC(6ab16f36) SHA1(49a19b279f311279c7fed3d2b3f207732d674c26) ) + ROM_LOAD( "bas14.epr", 0x2000, 0x2000, CRC(a743eb80) SHA1(3a300550838535b4adfe6d05c05fe0b39c47df16) ) + ROM_LOAD( "bootv.epr", 0x4000, 0x2000, CRC(de5fa37d) SHA1(4f203efe53524d84f69459c54b1a0296faa83fd9) ) + + ROM_REGION(0x0400, "proms", 0 ) + ROM_LOAD( "junior_io_prom.bin", 0x0000, 0x0200, CRC(c6a777c4) SHA1(41debc1b4c3bd4eef7e0e572327c759e0399a49c)) + ROM_LOAD( "junior_mem_prom.bin", 0x0200, 0x0200, CRC(0f745f42) SHA1(360ec23887fb6d7e19ee85d2bb30d9fa57f4936e)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, elwro800, 0, 0, elwro800, elwro800, driver_device, 0, "Elwro", "800 Junior", 0) diff --git a/src/mame/drivers/enmirage.c b/src/mame/drivers/enmirage.c new file mode 100644 index 00000000000..1080a269dc9 --- /dev/null +++ b/src/mame/drivers/enmirage.c @@ -0,0 +1,286 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + drivers/mirage.c + + Ensoniq Mirage Sampler + Preliminary driver by R. Belmont + + Map for Mirage: + 0000-7fff: 32k window on 128k of sample RAM + 8000-bfff: main RAM + c000-dfff: optional expansion RAM + e100-e101: 6850 UART (for MIDI) + e200-e2ff: 6522 VIA + e408-e40f: filter cut-off frequency + e410-e417: filter resonance + e418-e41f: multiplexer address pre-set + e800-e803: WD1770 FDC + ec00-ecef: ES5503 "DOC" sound chip + f000-ffff: boot ROM + + NMI: IRQ from WD1772 + IRQ: DRQ from WD1772 wire-ORed with IRQ from ES5503 wire-ORed with IRQ from VIA6522 + FIRQ: IRQ from 6850 UART + + LED / switch matrix: + + A B C D E F G DP + ROW 0: LOAD UPPER LOAD LOWER SAMPLE UPPER PLAY SEQ LOAD SEQ SAVE SEQ REC SEQ SAMPLE LOWER + ROW 1: 3 6 9 5 8 0 2 Enter + ROW 2: 1 4 7 up arrow PARAM dn arrow VALUE CANCEL + L. AN: SEG A SEG B SEG C SEG D SEG E SEG F SEG G SEG DP (decimal point) + R. AN: SEG A SEG B SEG C SEG D SEG E SEG F SEG G SEG DP + + Column number in VIA port A bits 0-2 is converted to discrete lines by a 74LS145. + Port A bit 3 is right anode, bit 4 is left anode + ROW 0 is read on VIA port A bit 5, ROW 1 in port A bit 6, and ROW 2 in port A bit 7. + + Keyboard models talk to the R6500 through the VIA shifter: CA2 is handshake, CB1 is shift clock, CB2 is shift data. + This is unconnected on the rackmount version. + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/6850acia.h" +#include "machine/6522via.h" +#include "machine/wd_fdc.h" +#include "formats/esq8_dsk.h" +#include "sound/es5503.h" + +#include "mirage.lh" + +class mirage_state : public driver_device +{ +public: + mirage_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_fdc(*this, "wd1772"), + m_via(*this, "via6522") + { + } + + required_device m_maincpu; + required_device m_fdc; + required_device m_via; + + virtual void machine_reset(); + + int last_sndram_bank; + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + DECLARE_DRIVER_INIT(mirage); + virtual void video_start(); + UINT32 screen_update_mirage(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_WRITE8_MEMBER(mirage_via_write_porta); + DECLARE_WRITE8_MEMBER(mirage_via_write_portb); + DECLARE_WRITE_LINE_MEMBER(mirage_doc_irq); + DECLARE_READ8_MEMBER(mirage_adc_read); + + UINT8 m_l_segs, m_r_segs; + int m_l_hi, m_r_hi; +}; + +FLOPPY_FORMATS_MEMBER( mirage_state::floppy_formats ) + FLOPPY_ESQ8IMG_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( ensoniq_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER(mirage_state::mirage_doc_irq) +{ +// m_maincpu->set_input_line(M6809_IRQ_LINE, state); +} + +READ8_MEMBER(mirage_state::mirage_adc_read) +{ + return 0x00; +} + +void mirage_state::video_start() +{ +} + +UINT32 mirage_state::screen_update_mirage(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +void mirage_state::machine_reset() +{ + last_sndram_bank = 0; + membank("sndbank")->set_base(memregion("es5503")->base() ); +} + +static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 8, mirage_state ) + AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("sndbank") // 32k window on 128k of wave RAM + AM_RANGE(0x8000, 0xbfff) AM_RAM // main RAM + AM_RANGE(0xc000, 0xdfff) AM_RAM // expansion RAM + AM_RANGE(0xe100, 0xe100) AM_DEVREADWRITE("acia6850", acia6850_device, status_r, control_w) + AM_RANGE(0xe101, 0xe101) AM_DEVREADWRITE("acia6850", acia6850_device, data_r, data_w) + AM_RANGE(0xe200, 0xe2ff) AM_DEVREADWRITE("via6522", via6522_device, read, write) + AM_RANGE(0xe400, 0xe4ff) AM_NOP + AM_RANGE(0xe800, 0xe803) AM_DEVREADWRITE("wd1772", wd1772_t, read, write) + AM_RANGE(0xec00, 0xecef) AM_DEVREADWRITE("es5503", es5503_device, read, write) + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("osrom", 0) +ADDRESS_MAP_END + +// port A: front panel +// bits 0-2: column select from 0-7 +// bits 3/4 = right and left LED enable +// bits 5/6/7 keypad rows 0/1/2 return +WRITE8_MEMBER(mirage_state::mirage_via_write_porta) +{ + UINT8 seg = data & 7; + static const int segconv[8] = + { + 16, 8, 32, 2, 1, 64, 128, 4 + }; + +// printf("PA: %02x (PC=%x)\n", data, m_maincpu->pc()); + + // left LED selected? + if ((data & 0x10) == 0x10) + { + // if the segment number is lower than last time, we've + // started a new refresh cycle + if ((seg < m_l_hi) || (seg == 0)) + { + m_l_segs = segconv[seg]; + } + else + { + m_l_segs |= segconv[seg]; + } + + m_l_hi = seg; + output_set_digit_value(0, m_l_segs); +// printf("L LED: seg %d (hi %d conv %02x, %02x)\n", seg, m_l_hi, segconv[seg], m_l_segs); + } + // right LED selected? + if ((data & 0x08) == 0x08) + { + // if the segment number is lower than last time, we've + // started a new refresh cycle + if ((seg < m_r_hi) || (seg == 0)) + { + m_r_segs = segconv[seg]; + } + else + { + m_r_segs |= segconv[seg]; + } + + m_r_hi = seg; + output_set_digit_value(1, m_r_segs); +// printf("R LED: seg %d (hi %d conv %02x, %02x)\n", seg, m_r_hi, segconv[seg], m_r_segs); + } +} + +// port B: +// bit 7: OUT UART clock +// bit 4: OUT disk enable (motor on?) +// bit 3: OUT sample/play +// bit 2: OUT mic line/in +// bit 1: OUT upper/lower bank (64k halves) +// bit 0: OUT bank 0/bank 1 (32k halves) + +WRITE8_MEMBER(mirage_state::mirage_via_write_portb) +{ + int bank = 0; + + // handle sound RAM bank switching + bank = (data & 2) ? (64*1024) : 0; + bank += (data & 1) ? (32*1024) : 0; + if (bank != last_sndram_bank) + { + last_sndram_bank = bank; + membank("sndbank")->set_base(memregion("es5503")->base() + bank); + } +} + +static MACHINE_CONFIG_START( mirage, mirage_state ) + MCFG_CPU_ADD("maincpu", M6809E, 4000000) + MCFG_CPU_PROGRAM_MAP(mirage_map) + + MCFG_DEFAULT_LAYOUT( layout_mirage ) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_ES5503_ADD("es5503", 7000000) + MCFG_ES5503_OUTPUT_CHANNELS(2) + MCFG_ES5503_IRQ_FUNC(WRITELINE(mirage_state, mirage_doc_irq)) + MCFG_ES5503_ADC_FUNC(READ8(mirage_state, mirage_adc_read)) + + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_DEVICE_ADD("via6522", VIA6522, 1000000) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mirage_state, mirage_via_write_porta)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mirage_state, mirage_via_write_portb)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + + MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) + MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809e_device, firq_line)) + + MCFG_WD1772_ADD("wd1772", 8000000) + MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_WD_FDC_DRQ_CALLBACK(INPUTLINE("maincpu", M6809_IRQ_LINE)) + + MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", mirage_state::floppy_formats) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( mirage ) +INPUT_PORTS_END + +ROM_START( enmirage ) + ROM_REGION(0x1000, "osrom", 0) + ROM_LOAD( "mirage.bin", 0x0000, 0x1000, CRC(9fc7553c) SHA1(ec6ea5613eeafd21d8f3a7431a35a6ff16eed56d) ) + + ROM_REGION(0x20000, "es5503", ROMREGION_ERASE) +ROM_END + +DRIVER_INIT_MEMBER(mirage_state,mirage) +{ + floppy_connector *con = machine().device("wd1772:0"); + floppy_image_device *floppy = con ? con->get_device() : 0; + if (floppy) + { + m_fdc->set_floppy(floppy); + + floppy->ss_w(0); + } + + m_l_hi = m_r_hi = 9; + m_l_segs = m_r_segs = 0; + + // port A: front panel + m_via->write_pa0(0); + m_via->write_pa1(0); + m_via->write_pa2(0); + m_via->write_pa3(0); + m_via->write_pa4(0); + m_via->write_pa5(0); + m_via->write_pa6(0); + m_via->write_pa7(0); + + // port B: + // bit 6: IN FDC disk ready + // bit 5: IN 5503 sync (?) + m_via->write_pb0(0); + m_via->write_pb1(0); + m_via->write_pb2(0); + m_via->write_pb3(0); + m_via->write_pb4(0); + m_via->write_pb5(1); + m_via->write_pb6(1); + m_via->write_pb7(0); +} + +CONS( 1984, enmirage, 0, 0, mirage, mirage, mirage_state, mirage, "Ensoniq", "Ensoniq Mirage", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/ep64.c b/src/mame/drivers/ep64.c new file mode 100644 index 00000000000..4b384701d63 --- /dev/null +++ b/src/mame/drivers/ep64.c @@ -0,0 +1,600 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Enterprise Sixty Four / One Two Eight emulation + +**********************************************************************/ + +/* + +Enterprise Sixty Four / Enterprise One Two Eight +Enterprise Computers Ltd. 1985 + +MAIN PCB Layout +--------------- + DUAL +|-----------| 9V TAPE_IN/OUT RES +|HEATSINK | DC_IN MON1 AND REMOTE SR1 PR1 CN2A CN1A |-| +| |--||---|--||--|--| |--| |-||-||-||-||-| |----| |-----| |--| |--| |-|-|------| +|-----------|7805 | MOD | |-| |-| |-| |-| |-| |-| |-| EXP2 --|EXTERNAL + |---+7805 | | 74LS06 74LS273 74LS86 74LS32 --|EXPANSION + | | |------| 74LS244 --|CONNECTOR + | |78L12 POT1 LM386 |-----| |-----| EXP1 --| + CART | | LM1889 LM1886 74LS04|NICK | |DAVE | --| + CONN | | KEYB_8 POT2 KEYB_10 | | | | --| + | | 4.433619MHz 74LS145 POT3 LED |-----| |-----| --| + |---+ --| + | 74LS74 74LS244 74LS244 74LS245 |---------| + | | + | 74LS373 4164 4164 74F157 | + | | + | 16-2-103 LM339 LM324 4164 4164 74F157 EXOS.IC2 | + | 8MHz | + | 74LS373 4164 4164 | + | 74LS04 Z80A | + | 74LS273 4164 4164 | + |------------------------------------------------------------------| +Notes: (all IC's shown) + Z80A - Z80A CPU, clock input 4MHz [8/2] + EXOS.IC2 - 32k x8-bit mask ROM usually 23256 manufactured by GI (DIP24). Contains EXOS operating + system and built-in word processor software. A few official revisions were made and + there were a few unofficial revision made with additional capabilities and bug-fixes + ROM labelling of some official versions found.... + 9256DS-0019 (C)1984 INTELLIGENT SOFTWARE LTD ENTER 08-45-A GI + 9256DS-0036 (C)1984 INTELLIGENT SOFTWARE LTD ENTER 05-23-A GI + 4164 - 64k x1-bit Dynamic RAM with Page Mode (DIP16) + NICK - Custom graphics chip (QFP72) + DAVE - Custom sound chip (QFP72) + LM386 - National Semiconductor LM386 Low Voltage Audio Power Amplifier (DIP8) + LM1889 - National Semiconductor LM1889 TV Video Modulator (DIP18) + LM1886 - National Semiconductor LM1886 TV Video Matrix DAC (DIP20) + LM339 - SGS LM339 Low Power Low Offset Voltage Quad Comparator (DIP8) + LM324 - SGS LM324 Quad Operational Amplifier (DIP8) + 74LS04 - Hex Inverter (DIP14) + 74LS06 - Hex Inverter/Buffer with Open-Collector Outputs (DIP14) + 74LS32 - Quad 2-Input Positive OR Gate (DIP14) + 74LS74 - Dual Positive-Edge-Triggered D Flip-Flops with Preset, Clear and Complementary Outputs (DIP14) + 74LS86 - Quad 2-Input Exclusive OR Gate (DIP14) + 74LS145 - BCD to Deccimal Decoder/Driver (DIP16) + 74F157 - Quad 2-Line to 1-Line Data Selector/Multiplexer (DIP16). Early rev mainboards use 74LS158 instead + 74LS244 - Octal 3-State Noninverting Buffer/Line Driver/Line Receiver (DIP20) + 74LS245 - Octal Bus Tranceiver with Tri-State Outputs (DIP20) + 74LS273 - Octal D-Type Flip-Flop With Clear (DIP20) + 74LS373 - Octal D-Type Transparent Latches and Edge-Triggered Flip-Flops (DIP20) + 7805 - Voltage regulator. +9V DC input from DC power pack, +5V DC output + 78L12 - Voltage regulator. Voltage input via small transformer on PCB. +12V DC output + POT1 - Potentiometer located near modulator and video output circuitry + POT2 - Potentiometer located near video output circuitry. Probably used to fine-tune the video clock + POT3 - Potentiometer. Possibly for video/NICK-related adjustments + LED - LED to show +5V is present + 16-2-103 - Resistor Array (DIP16) + KEYB_8 - 8 pin keyboard connector + KEYB_10 - 10 pin keyboard connector + EXP1 - 28 pin internal expansion connector (solder holes only) used for internal 64k memory expansion card + EXP2 - 10 pin internal expansion connector (solder holes only) used for internal 64k memory expansion card + MOD - Astec UM1233 TV modulator + RES - Reset push button switch + MON1 - Monitor output connector. Pinout is.... + + Green A1 B1 NC + Ground A2 B2 Ground + Mono Comp. Video A3 B3 Blue + HSync A4 B4 Red + VSync A5 B5 Composite Sync + NC A6 B6 Mode Switch + Left Audio A7 B7 Right Audio + + SR1 - Serial/Network connector. Pinout is.... + + Reference A1 B1 Ground + - A2 B2 - + RTS A3 B3 Data Out + CTS A4 B4 Data In + + PR1 - Printer connector. Pinout is.... + + Ground A1 B1 Ground + Strobe A2 B2 Ready + Data 3 A3 B3 Data 4 + - A4 B4 - + Data 2 A5 B5 Data 5 + Data 1 A6 B6 Data 6 + Data 0 A7 B7 Data 7 + + CN2A - Joystick 2 connector + CN1A - Joystick 1 connector + Pinout is.... + + Keyboard J A1 B1 Ground + Keyboard L A2 B2 Keyboard K + - A3 B3 - + Right A4 B4 +5V + Down A5 B5 Left + Fire A6 B6 Up + + +Internal Memory Expansion PCB Layout +------------------------------------ + +|---------------------| +| 4164 74LS00 PL3 PL2| +|4164 74LS30 74F157 | +|4164 4164 | +|4164 4164 74F157 | +|4164 4164 74LS32 PL1| +|---------------------| +Notes: (All IC's shown) + PL1 - 28-pin connector (solder pads only) hard-wired to solder pads EXP1 on mainboard + PL2/PL3 - 5-pin connectors (solder pads only) hard-wired to solder pads EXP2 on mainboard + 4164 - 64k x1-bit Dynamic RAM with Page Mode (DIP16) + 74LS00 - Quad 2-Input NAND Gate (DIP14) + 74LS30 - 8-input NAND Gate (DIP14) + 74LS32 - Quad 2-Input Positive OR Gate (DIP14) + 74F157 - Quad 2-Line to 1-Line Data Selector/Multiplexer (DIP16). Early rev memory boards use 74LS158 instead + +*/ + +/* + + TODO: + + - POST RAM errors + - rewrite DAVE to output to discrete DAC + - rewrite NICK + - cassette + - external joysticks + + http://ep.homeserver.hu/Dokumentacio/Konyvek/ + +*/ + +#include "includes/ep64.h" + + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// rd0_r - +//------------------------------------------------- + +READ8_MEMBER( ep64_state::rd0_r ) +{ + UINT8 data = 0xff; + + switch (m_key) + { + case 0: data &= m_y0->read(); break; + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 9: data &= m_y9->read(); break; + } + + return data; +} + + +//------------------------------------------------- +// rd0_r - +//------------------------------------------------- + +WRITE8_MEMBER( ep64_state::wr0_w ) +{ + /* + + bit description + + 0 KEY A + 1 KEY B + 2 KEY C + 3 KEY D + 4 PRINTER _STB + 5 CASSETTE OUT + 6 REMOTE 1 + 7 REMOTE 2 + + */ + + // keyboard + m_key = data & 0x0f; + + // printer + m_centronics->write_strobe(!BIT(data, 4)); + + // cassette + m_cassette1->output(BIT(data, 5) ? -1.0 : +1.0); + m_cassette2->output(BIT(data, 5) ? -1.0 : +1.0); + + // cassette + m_cassette1->change_state(BIT(data, 6) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_cassette2->change_state(BIT(data, 7) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + +WRITE_LINE_MEMBER( ep64_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +//------------------------------------------------- +// rd1_r - +//------------------------------------------------- + +READ8_MEMBER( ep64_state::rd1_r ) +{ + /* + + bit description + + 0 KBJ + 1 KBK + 2 KBL + 3 PRINTER _RDY + 4 SERIAL/NET DATA IN + 5 SERIAL/NET STATUS IN + 6 CASSETTE IN + 7 ? + + */ + + UINT8 data = 0; + + // printer + data |= m_centronics_busy << 3; + + // serial + data |= m_rs232->rxd_r() << 4; + data |= m_rs232->cts_r() << 5; + + // cassette + data |= ((m_cassette1->input() < 0) || (m_cassette2->input() < 0)) << 6; + + return data; +} + + +//------------------------------------------------- +// wr2_w - +//------------------------------------------------- + +WRITE8_MEMBER( ep64_state::wr2_w ) +{ + /* + + bit description + + 0 SERIAL/NET DATA OUT + 1 SERIAL/NET STATUS OUT + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + // serial + m_rs232->write_txd(!BIT(data, 0)); + m_rs232->write_rts(!BIT(data, 1)); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( ep64_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ep64_mem, AS_PROGRAM, 8, ep64_state ) + AM_RANGE(0x0000, 0xffff) AM_DEVICE(DAVE_TAG, dave_device, z80_program_map) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( ep64_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ep64_io, AS_IO, 8, ep64_state ) + AM_RANGE(0x0000, 0xffff) AM_DEVICE(DAVE_TAG, dave_device, z80_io_map) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( dave_64k_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( dave_64k_mem, AS_PROGRAM, 8, ep64_state ) + AM_RANGE(0x000000, 0x007fff) AM_ROM AM_REGION(Z80_TAG, 0) + //AM_RANGE(0x010000, 0x01ffff) // mapped by the cartslot + AM_RANGE(0x3f0000, 0x3fffff) AM_DEVICE(NICK_TAG, nick_device, vram_map) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( dave_128k_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( dave_128k_mem, AS_PROGRAM, 8, ep64_state ) + AM_IMPORT_FROM(dave_64k_mem) + AM_RANGE(0x3e0000, 0x3effff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( dave_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( dave_io, AS_IO, 8, ep64_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x8f) AM_DEVICE(NICK_TAG, nick_device, vio_map) + AM_RANGE(0xb5, 0xb5) AM_READWRITE(rd0_r, wr0_w) + AM_RANGE(0xb6, 0xb6) AM_READ(rd1_r) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0xb7, 0xb7) AM_WRITE(wr2_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( ep64 ) +//------------------------------------------------- + +static INPUT_PORTS_START( ep64 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 \xC2\xA3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a3) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOLD") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( ep64 ) +//------------------------------------------------- + +void ep64_state::machine_start() +{ + if (m_cart->exists()) + m_dave->space(AS_PROGRAM).install_read_handler(0x010000, 0x01ffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + // state saving + save_item(NAME(m_key)); + save_item(NAME(m_centronics_busy)); +} + + +void ep64_state::machine_reset() +{ + m_dave->reset(); + m_nick->reset(); + + address_space &program = m_maincpu->space(AS_PROGRAM); + wr0_w(program, 0, 0); + machine().device("cent_data_out")->write(program, 0, 0); + wr2_w(program, 0, 0); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( ep64 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ep64, ep64_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) + MCFG_CPU_PROGRAM_MAP(ep64_mem) + MCFG_CPU_IO_MAP(ep64_io) + + // video hardware + MCFG_NICK_ADD(NICK_TAG, SCREEN_TAG, XTAL_8MHz) + MCFG_NICK_VIRQ_CALLBACK(DEVWRITELINE(DAVE_TAG, dave_device, int1_w)) + + // sound hardware + MCFG_DAVE_ADD(DAVE_TAG, XTAL_8MHz, dave_64k_mem, dave_io) + MCFG_DAVE_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + // devices + MCFG_EP64_EXPANSION_BUS_SLOT_ADD(EP64_EXPANSION_BUS_TAG, NULL) + MCFG_EP64_EXPANSION_BUS_SLOT_DAVE(DAVE_TAG) + MCFG_EP64_EXPANSION_BUS_SLOT_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_EP64_EXPANSION_BUS_SLOT_NMI_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_NMI)) + MCFG_EP64_EXPANSION_BUS_SLOT_WAIT_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(ep64_state, write_centronics_busy)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(DAVE_TAG, dave_device, int2_w)) + + MCFG_CASSETTE_ADD(CASSETTE1_TAG) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + MCFG_CASSETTE_INTERFACE("ep64_cass") + + MCFG_CASSETTE_ADD(CASSETTE2_TAG) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + MCFG_CASSETTE_INTERFACE("ep64_cass") + + // internal RAM + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // cartridge + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "ep64_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list", "ep64_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "ep64_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "ep64_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( ep128 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( ep128, ep64 ) + MCFG_DEVICE_MODIFY(DAVE_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, dave_128k_mem) + + // internal RAM + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( ep64 ) +//------------------------------------------------- + +ROM_START( ep64 ) + ROM_REGION( 0x8000, Z80_TAG, 0 ) + ROM_LOAD( "9256ds-0038_enter05-23-a.u2", 0x0000, 0x8000, CRC(d421795f) SHA1(6033a0535136c40c47137e4d1cd9273c06d5fdff) ) +ROM_END + +#define rom_phc64 rom_ep64 + + +//------------------------------------------------- +// ROM( ep128 ) +//------------------------------------------------- + +ROM_START( ep128 ) + ROM_REGION( 0x8000, Z80_TAG, 0 ) + ROM_LOAD( "9256ds-0019_enter08-45-a.u2", 0x0000, 0x8000, CRC(982a3b44) SHA1(55315b20fecb4441a07ee4bc5dc7153f396e0a2e) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1985, ep64, 0, 0, ep64, ep64, driver_device, 0, "Enterprise Computers", "Enterprise Sixty Four", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +COMP( 1985, phc64, ep64, 0, ep64, ep64, driver_device, 0, "Hegener & Glaser", "Mephisto PHC 64 (Germany)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +COMP( 1986, ep128, ep64, 0, ep128, ep64, driver_device, 0, "Enterprise Computers", "Enterprise One Two Eight", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/esq1.c b/src/mame/drivers/esq1.c new file mode 100644 index 00000000000..b37f26185aa --- /dev/null +++ b/src/mame/drivers/esq1.c @@ -0,0 +1,698 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont, Olivier Galibert +/*************************************************************************** + + drivers/esq1.c + + Ensoniq ESQ-1 Digital Wave Synthesizer + Ensoniq ESQ-M (rack-mount ESQ-1) + Ensoniq SQ-80 Cross Wave Synthesizer + Driver by R. Belmont and O. Galibert + + Map for ESQ-1 and ESQ-m: + 0000-1fff: OS RAM + 2000-3fff: Cartridge + 4000-5fff: SEQRAM + 6000-63ff: ES5503 DOC + 6400-67ff: MC2681 DUART + 6800-6fff: AD7524 (CV_MUX) + 7000-7fff: OS ROM low (banked) + 8000-ffff: OS ROM high (fixed) + + Map for SQ-80: + 0000-1fff: OS RAM + 2000-3fff: Cartridge + 4000-5fff: DOSRAM or SEQRAM (banked) + 6000-63ff: ES5503 DOC + 6400-67ff: MC2681 DUART + 6800-6bff: AD7524 (CV_MUX) + 6c00-6dff: Mapper (bit 0 only - determines DOSRAM or SEQRAM at 4000) + 6e00-6fff: WD1772 FDC (not present on ESQ1) + 7000-7fff: OS ROM low (banked) + 8000-ffff: OS ROM high (fixed) + + CV_MUX area: + write to output goes to + $68f8 $00 D/A converter + $68f0 -$08 Filter Frequency (FF) + $68e8 -$10 Filter Resonance (Q) + $68d8 -$20 Final DCA (ENV4) + $68b8 -$40 Panning (PAN) + $6878 -$80 Floppy (Motor/LED on - SQ-80 only) + +ESQ1: 8x CEM3379 VC Signal Processor Filter/Mix/VCA, 1x CEM3360 Dual VCA, 4x SSM2300 +SQ-80: 8x CEM3379 VC Signal Processor - Filter/Mix/VCA, 1x CEM3360 Dual VCA, 4x SSM2300 + + +If SEQRAM is mapped at 4000, DUART port 2 determines the 32KB "master bank" and ports 0 and 1 +determine which of the 4 8KB "sub banks" is visible. + +Output ports 3 to 1 determine the 4kB page which should be shown at $7000 to $7fff. + +IRQ sources are the DUART and the DRQ line from the FDC (SQ-80 only). +NMI is from the IRQ line on the FDC (again, SQ-80 only). + +TODO: + - VFD display + - Keyboard + - Analog filters and VCA on the back end of the 5503 + - SQ-80 support (additional banking, FDC) + +NOTES: + Commands from KPC are all 2 bytes + + first byte: command code, bit 7 is 1 = press, 0 = release + second byte is source: 00 = panel 01 = internal keyboard + + 04 SEQ + 05 CART A + 06 CART B + 07 INT + 08 1 / SEQ 1 + 09 2 / SEQ 2 + 0A 3 / SEQ 3 + 0B 4 / SONG + 0C COMPARE + 0D DATA UP + 0E DATA DOWN + 0F WRITE + 10 = UPPER 1 (buttons above display) + 11 = UPPER 2 + 12 = UPPER 3 + 13 = UPPER 4 + 14 = UPPER 5 + 15 = LOWER 1 (buttons below display) + 16 = LOWER 2 + 17 = LOWER 3 + 18 = LOWER 4 + 19 = LOWER 5 + 1a = LFO 1 + 1b = ENV 2 + 1c = MASTER + 1d = CREATE / ERASE + 1e = SELECT + 1f = RECORD + 20 = STORAGE + 21 = EDIT + 22 = MIX + 23 = STOP / CONT + 24 = MIDI + 25 = CONTROL + 26 = LOCATE + 27 = PLAY + 28 = OSC 1 + 29 = OSC 2 + 2A = OSC 3 + 2B = ENV 1 + 2C = DCA 1 + 2D = DCA 2 + 2E = DCA 3 + 2F = LFO 2 + 30 = LFO 3 + 31 = FILTER + 32 = ENV 4 + 33 = ENV 3 + 34 = DCA 4 + 35 = MODES + 36 = SPLIT / LAYER + + + Analog filters (CEM3379): + + The analog part is relatively simple. The digital part outputs 8 + voices, which are filtered, amplified, panned then summed + together. + + The filtering stage is a 4-level lowpass filter with a loopback: + + + +-[+]-<-[*-1]--------------------------+ + | | | + ^ [*r] | + | | | + | v ^ + input ---+-[+]--[LPF]---[LPF]---[LPF]---[LPF]---+--- output + + All 4 LPFs are identical, with a transconductance G: + + output = 1/(1+s/G)^4 * ( (1+r)*input - r*output) + + or + + output = input * (1+r)/((1+s/G)^4+r) + + to which the usual z-transform can be applied (see votrax.c) + + G is voltage controlled through the Vfreq input, with the formula (Vfreq in mV): + + G = 6060*exp(Vfreq/28.5) + + That gives a cutoff frequency (f=G/(2pi)) of 5Hz at 5mV, 964Hz at + 28.5mV and 22686Hz at 90mV. The resistor ladder between the DAC + and the input seem to map 0..255 into a range of -150.4mV to + +83.6mV. + + The resonance is controlled through the Vq input pin, and is not + well defined. Reading between the lines the control seems linear + and tops when then circuit is self-oscillation, at r=4. + + The amplification is exponential for a control voltage between 0 + to 0.2V from -100dB to -20dB, and then linear up to 5V at 0dB. Or + in other words: + amp(Vca) = Vca < 0.2 ? 10**(-5+20*Vca) : Vca*0.1875 + 0.0625 + + + Finally the panning is not very described. What is clear is that + the control voltage at 2.5V gives a gain of -6dB, the max + attenuation at 0/5V is -100dB. The doc also says the gain is + linear between 1V and 3.5V, which makes no sense since it's not + symmetrical, and logarithmic afterwards, probably meaning + exponential, otherwise the change between 0 and 1V would be + minimal. So we're going to do some assumptions: + - 0-1V exponential from -100Db to -30dB + - 1V-2.5V linear from -30dB to -6dB + - 2.5V-5V is 1-amp at 2.5V-v + + Note that this may be incorrect, maybe to sum of squares should be + constant, the half-point should be at -3dB and the linearity in dB + space. + + +***************************************************************************/ + +#include "bus/midi/midi.h" +#include "cpu/m6809/m6809.h" +#include "sound/es5503.h" +#include "machine/mc68681.h" +#include "machine/wd_fdc.h" +#include "machine/esqpanel.h" + +#define WD1772_TAG "wd1772" + +class esq1_filters : public device_t, + public device_sound_interface +{ +public: + // construction/destruction + esq1_filters(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + void set_vca(int channel, UINT8 value); + void set_vpan(int channel, UINT8 value); + void set_vq(int channel, UINT8 value); + void set_vfc(int channel, UINT8 value); + +protected: + // device-level overrides + virtual void device_start(); + + // device_sound_interface overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + struct filter { + UINT8 vca, vpan, vq, vfc; + double amp, lamp, ramp; + double a[5], b[5]; + double x[4], y[4]; + }; + + filter filters[8]; + + sound_stream *stream; + + void recalc_filter(filter &f); +}; + +static const device_type ESQ1_FILTERS = &device_creator; + +esq1_filters::esq1_filters(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ESQ1_FILTERS, "ESQ1 Filters stage", tag, owner, clock, "esq1-filters", __FILE__), + device_sound_interface(mconfig, *this) +{ +} + +void esq1_filters::set_vca(int channel, UINT8 value) +{ + if(filters[channel].vca != value) { + stream->update(); + filters[channel].vca = value; + recalc_filter(filters[channel]); + } +} + +void esq1_filters::set_vpan(int channel, UINT8 value) +{ + if(filters[channel].vpan != value) { + stream->update(); + filters[channel].vpan = value; + recalc_filter(filters[channel]); + } +} + +void esq1_filters::set_vq(int channel, UINT8 value) +{ + if(filters[channel].vq != value) { + stream->update(); + filters[channel].vq = value; + recalc_filter(filters[channel]); + } +} + +void esq1_filters::set_vfc(int channel, UINT8 value) +{ + if(filters[channel].vfc != value) { + stream->update(); + filters[channel].vfc = value; + recalc_filter(filters[channel]); + } +} + +void esq1_filters::recalc_filter(filter &f) +{ + // Filtering stage + // First let's establish the control values + // Some tuning may be required + + double vfc = -150.4 + (83.6+150.4)*f.vfc/255; + double r = 4.0*f.vq/255; + + + double g = 6060*exp(vfc/28.5); + double zc = g/tan(g/2/44100); + +/* if(f.vfc) { + double ff = g/(2*M_PI); + double fzc = 2*M_PI*ff/tan(M_PI*ff/44100); + fprintf(stderr, "%02x f=%f zc=%f zc1=%f\n", f.vfc, g/(2*M_PI), zc, fzc); + }*/ + + double gzc = zc/g; + double gzc2 = gzc*gzc; + double gzc3 = gzc2*gzc; + double gzc4 = gzc3*gzc; + double r1 = 1+r; + + f.a[0] = r1; + f.a[1] = 4*r1; + f.a[2] = 6*r1; + f.a[3] = 4*r1; + f.a[4] = r1; + + f.b[0] = r1 + 4*gzc + 6*gzc2 + 4*gzc3 + gzc4; + f.b[1] = 4*(r1 + 2*gzc - 2*gzc3 - gzc4); + f.b[2] = 6*(r1 - 2*gzc2 + gzc4); + f.b[3] = 4*(r1 - 2*gzc + 2*gzc3 - gzc4); + f.b[4] = r1 - 4*gzc + 6*gzc2 - 4*gzc3 + gzc4; + +/* if(f.vfc != 0) + for(int i=0; i<5; i++) + printf("a%d=%f\nb%d=%f\n", + i, f.a[i], i, f.b[i]);*/ + + // Amplification stage + double vca = f.vca*(5.0/255.0); + f.amp = vca < 0.2 ? pow(10, -5+20*vca) : vca*0.1875 + 0.0625; + + // Panning stage + // Very approximative at best + // Left/right unverified + double vpan = f.vpan*(5.0/255.0); + double vref = vpan > 2.5 ? 2.5 - vpan : vpan; + double pan_amp = vref < 1 ? pow(10, -5+3.5*vref) : vref*0.312 - 0.280; + if(vref < 2.5) { + f.lamp = pan_amp; + f.ramp = 1-pan_amp; + } else { + f.lamp = 1-pan_amp; + f.ramp = pan_amp; + } +} + +void esq1_filters::device_start() +{ + stream = stream_alloc(8, 2, 44100); + memset(filters, 0, sizeof(filters)); + for(int i=0; i<8; i++) + recalc_filter(filters[i]); +} + +void esq1_filters::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ +/* if(0) { + for(int i=0; i<8; i++) + fprintf(stderr, " [%02x %02x %02x %02x]", + filters[i].vca, + filters[i].vpan, + filters[i].vq, + filters[i].vfc); + fprintf(stderr, "\n"); + }*/ + + for(int i=0; i maxl) { + maxl = l; +// fprintf(stderr, "%f\n", maxl); + } + +// l *= 6553; +// r *= 6553; + l *= 2; + r *= 2; + outputs[0][i] = l < -32768 ? -32768 : l > 32767 ? 32767 : int(l); + outputs[1][i] = r < -32768 ? -32768 : r > 32767 ? 32767 : int(r); + } +} + +class esq1_state : public driver_device +{ +public: + esq1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_duart(*this, "duart"), + m_filters(*this, "filters"), + m_fdc(*this, WD1772_TAG), + m_panel(*this, "panel"), + m_mdout(*this, "mdout") + { } + + required_device m_maincpu; + required_device m_duart; + required_device m_filters; + optional_device m_fdc; + optional_device m_panel; + optional_device m_mdout; + + DECLARE_READ8_MEMBER(wd1772_r); + DECLARE_WRITE8_MEMBER(wd1772_w); + DECLARE_READ8_MEMBER(seqdosram_r); + DECLARE_WRITE8_MEMBER(seqdosram_w); + DECLARE_WRITE8_MEMBER(mapper_w); + DECLARE_WRITE8_MEMBER(analog_w); + + DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); + DECLARE_WRITE_LINE_MEMBER(duart_tx_a); + DECLARE_WRITE_LINE_MEMBER(duart_tx_b); + DECLARE_WRITE8_MEMBER(duart_output); + + DECLARE_WRITE_LINE_MEMBER(esq1_doc_irq); + DECLARE_READ8_MEMBER(esq1_adc_read); + + int m_mapper_state; + int m_seq_bank; + UINT8 m_seqram[0x10000]; + UINT8 m_dosram[0x2000]; + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + + void send_through_panel(UINT8 data); +}; + + +WRITE_LINE_MEMBER(esq1_state::esq1_doc_irq) +{ +} + +READ8_MEMBER(esq1_state::esq1_adc_read) +{ + return 0x00; +} + +void esq1_state::machine_reset() +{ + // set default OSROM banking + membank("osbank")->set_base(memregion("osrom")->base() ); + + m_mapper_state = 0; + m_seq_bank = 0; +} + +READ8_MEMBER(esq1_state::wd1772_r) +{ + return m_fdc->read(space, offset&3); +} + +WRITE8_MEMBER(esq1_state::wd1772_w) +{ + m_fdc->write(space, offset&3, data); +} + +WRITE8_MEMBER(esq1_state::mapper_w) +{ + m_mapper_state = (data & 1) ^ 1; + +// printf("mapper_state = %d\n", data ^ 1); +} + +WRITE8_MEMBER(esq1_state::analog_w) +{ + if(!(offset & 8)) + m_filters->set_vfc(offset & 7, data); + if(!(offset & 16)) + m_filters->set_vq(offset & 7, data); + if(!(offset & 32)) + m_filters->set_vpan(offset & 7, data); + if(!(offset & 64)) + m_filters->set_vca(offset & 7, data); +} + +READ8_MEMBER(esq1_state::seqdosram_r) +{ + if (m_mapper_state) + { + return m_dosram[offset]; + } + else + { + return m_seqram[offset + m_seq_bank]; + } +} + +WRITE8_MEMBER(esq1_state::seqdosram_w) +{ + if (m_mapper_state) + { + m_dosram[offset] = data; + } + else + { + m_seqram[offset + m_seq_bank] = data; + } +} + +static ADDRESS_MAP_START( esq1_map, AS_PROGRAM, 8, esq1_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAM // OSRAM + AM_RANGE(0x4000, 0x5fff) AM_RAM // SEQRAM + AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("es5503", es5503_device, read, write) + AM_RANGE(0x6400, 0x640f) AM_DEVREADWRITE("duart", mc68681_device, read, write) + AM_RANGE(0x6800, 0x68ff) AM_WRITE(analog_w) + AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("osbank") + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("osrom", 0x8000) // OS "high" ROM is always mapped here +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sq80_map, AS_PROGRAM, 8, esq1_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAM // OSRAM + AM_RANGE(0x4000, 0x5fff) AM_RAM // SEQRAM +// AM_RANGE(0x4000, 0x5fff) AM_READWRITE(seqdosram_r, seqdosram_w) + AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("es5503", es5503_device, read, write) + AM_RANGE(0x6400, 0x640f) AM_DEVREADWRITE("duart", mc68681_device, read, write) + AM_RANGE(0x6800, 0x68ff) AM_WRITE(analog_w) + AM_RANGE(0x6c00, 0x6dff) AM_WRITE(mapper_w) + AM_RANGE(0x6e00, 0x6fff) AM_READWRITE(wd1772_r, wd1772_w) + AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("osbank") + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("osrom", 0x8000) // OS "high" ROM is always mapped here +ADDRESS_MAP_END + +// from the schematics: +// +// DUART channel A is MIDI +// channel B is to the keyboard/display +// IP0 = tape in +// IP1 = sequencer expansion cartridge inserted +// IP2 = patch cartridge inserted +// IP3 & 4 are 0.5 MHz, IP 5 & 6 are 1 MHz (note 0.5 MHz / 16 = MIDI baud rate) +// +// OP0 = to display processor +// OP1/2/3 = bank select 0, 1, and 2 +// OP4 = metronome low +// OP5 = metronome hi +// OP6/7 = tape out + +WRITE_LINE_MEMBER(esq1_state::duart_irq_handler) +{ + m_maincpu->set_input_line(M6809_IRQ_LINE, state); +} + +WRITE8_MEMBER(esq1_state::duart_output) +{ + int bank = ((data >> 1) & 0x7); +// printf("DP [%02x]: %d mlo %d mhi %d tape %d\n", data, data&1, (data>>4)&1, (data>>5)&1, (data>>6)&3); +// printf("[%02x] bank %d => offset %x (PC=%x)\n", data, bank, bank * 0x1000, m_maincpu->safe_pc()); + membank("osbank")->set_base(memregion("osrom")->base() + (bank * 0x1000) ); + + m_seq_bank = (data & 0x8) ? 0x8000 : 0x0000; + m_seq_bank += ((data>>1) & 3) * 0x2000; +// printf("seqram_bank = %x\n", state->m_seq_bank); +} + +// MIDI send +WRITE_LINE_MEMBER(esq1_state::duart_tx_a) +{ + m_mdout->write_txd(state); +} + +WRITE_LINE_MEMBER(esq1_state::duart_tx_b) +{ + m_panel->rx_w(state); +} + +void esq1_state::send_through_panel(UINT8 data) +{ + m_panel->xmit_char(data); +} + +INPUT_CHANGED_MEMBER(esq1_state::key_stroke) +{ + if (oldval == 0 && newval == 1) + { + send_through_panel((UINT8)(FPTR)param); + send_through_panel((UINT8)(FPTR)0x00); + } + else if (oldval == 1 && newval == 0) + { + send_through_panel((UINT8)(FPTR)param&0x7f); + send_through_panel((UINT8)(FPTR)0x00); + } +} + +static MACHINE_CONFIG_START( esq1, esq1_state ) + MCFG_CPU_ADD("maincpu", M6809E, 4000000) // how fast is it? + MCFG_CPU_PROGRAM_MAP(esq1_map) + + MCFG_MC68681_ADD("duart", 4000000) + MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(esq1_state, duart_irq_handler)) + MCFG_MC68681_A_TX_CALLBACK(WRITELINE(esq1_state, duart_tx_a)) + MCFG_MC68681_B_TX_CALLBACK(WRITELINE(esq1_state, duart_tx_b)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(esq1_state, duart_output)) + + MCFG_ESQPANEL2x40_ADD("panel") + MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) // route MIDI Tx send directly to 68681 channel A Rx + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_ADD("filters", ESQ1_FILTERS, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_ES5503_ADD("es5503", 7000000) + MCFG_ES5503_OUTPUT_CHANNELS(8) + MCFG_ES5503_IRQ_FUNC(WRITELINE(esq1_state, esq1_doc_irq)) + MCFG_ES5503_ADC_FUNC(READ8(esq1_state, esq1_adc_read)) + + MCFG_SOUND_ROUTE_EX(0, "filters", 1.0, 0) + MCFG_SOUND_ROUTE_EX(1, "filters", 1.0, 1) + MCFG_SOUND_ROUTE_EX(2, "filters", 1.0, 2) + MCFG_SOUND_ROUTE_EX(3, "filters", 1.0, 3) + MCFG_SOUND_ROUTE_EX(4, "filters", 1.0, 4) + MCFG_SOUND_ROUTE_EX(5, "filters", 1.0, 5) + MCFG_SOUND_ROUTE_EX(6, "filters", 1.0, 6) + MCFG_SOUND_ROUTE_EX(7, "filters", 1.0, 7) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(sq80, esq1) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sq80_map) + + MCFG_WD1772_ADD(WD1772_TAG, 4000000) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( esq1 ) + PORT_START("KEY0") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x84) PORT_NAME("SEQ") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x85) PORT_NAME("CART A") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x86) PORT_NAME("CART B") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x87) PORT_NAME("INT") + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x88) PORT_NAME("1 / SEQ 1") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x89) PORT_NAME("2 / SEQ 2") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8a) PORT_NAME("3 / SEQ 3") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8b) PORT_NAME("4 / SONG") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8c) PORT_NAME("COMPARE") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8e) PORT_NAME("DATA DOWN") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8d) PORT_NAME("DATA UP") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8f) PORT_NAME("WRITE") + + PORT_START("KEY1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x90) PORT_NAME("UPPER 1") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x91) PORT_NAME("UPPER 2") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x92) PORT_NAME("UPPER 3") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x93) PORT_NAME("UPPER 4") + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x99) PORT_NAME("UPPER 5") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x94) PORT_NAME("LOWER 1") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x95) PORT_NAME("LOWER 2") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x96) PORT_NAME("LOWER 3") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x97) PORT_NAME("LOWER 4") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x98) PORT_NAME("LOWER 5") + + +INPUT_PORTS_END + +ROM_START( esq1 ) + ROM_REGION(0x10000, "osrom", 0) + ROM_LOAD( "3p5lo.bin", 0x0000, 0x8000, CRC(ed001ad8) SHA1(14d1150bccdbc15d90567cf1812aacdb3b6ee882) ) + ROM_LOAD( "3p5hi.bin", 0x8000, 0x8000, CRC(332c572f) SHA1(ddb4f62807eb2ab29e5ac6b5d209d2ecc74cf806) ) + + ROM_REGION(0x20000, "es5503", 0) + ROM_LOAD( "esq1wavlo.bin", 0x0000, 0x8000, CRC(4d04ac87) SHA1(867b51229b0a82c886bf3b216aa8893748236d8b) ) + ROM_LOAD( "esq1wavhi.bin", 0x8000, 0x8000, CRC(94c554a3) SHA1(ed0318e5253637585559e8cf24c06d6115bd18f6) ) +ROM_END + +ROM_START( sq80 ) + ROM_REGION(0x10000, "osrom", 0) + ROM_LOAD( "sq80rom.low", 0x0000, 0x008000, CRC(97ecd9a0) SHA1(cadff16ebbc15b52cf1d3335d22dc930d430a058) ) + ROM_LOAD( "sq80rom.hig", 0x8000, 0x008000, CRC(f83962b1) SHA1(e3e5cf41f15a37f8bf29b88fb1c85c0fca9ea912) ) + + ROM_REGION(0x40000, "es5503", 0) + ROM_LOAD( "2202.bin", 0x0000, 0x010000, CRC(dffd538c) SHA1(e90f6ff3a7804b54c8a3b1b574ec9c223a6c2bf9) ) + ROM_LOAD( "2203.bin", 0x0000, 0x010000, CRC(9be8cceb) SHA1(1ee4d7e6d2171b44e88e464071bdc4b800b69c4a) ) + ROM_LOAD( "2204.bin", 0x0000, 0x010000, CRC(4937c6f7) SHA1(4505efb9b28fe6d4bcc1f79e81a70bb215c399cb) ) + ROM_LOAD( "2205.bin", 0x0000, 0x010000, CRC(0f917d40) SHA1(1cfae9c80088f4c90b3c9e0b284c3b91f7ff61b9) ) + + ROM_REGION(0x8000, "kpc", 0) // 68HC11 keyboard/front panel processor + ROM_LOAD( "sq80_kpc_150.bin", 0x000000, 0x008000, CRC(8170b728) SHA1(3ad68bb03948e51b20d2e54309baa5c02a468f7c) ) +ROM_END + +ROM_START( esqm ) + ROM_REGION(0x10000, "osrom", 0) + ROM_LOAD( "1355500157_d640_esq-m_oshi.u14", 0x8000, 0x008000, CRC(ea6a7bae) SHA1(2830f8c52dc443b4ca469dc190b33e2ff15b78e1) ) + + ROM_REGION(0x20000, "es5503", 0) + ROM_LOAD( "esq1wavlo.bin", 0x0000, 0x8000, CRC(4d04ac87) SHA1(867b51229b0a82c886bf3b216aa8893748236d8b) ) + ROM_LOAD( "esq1wavhi.bin", 0x8000, 0x8000, CRC(94c554a3) SHA1(ed0318e5253637585559e8cf24c06d6115bd18f6) ) +ROM_END + + +CONS( 1986, esq1, 0 , 0, esq1, esq1, driver_device, 0, "Ensoniq", "ESQ-1", MACHINE_NOT_WORKING ) +CONS( 1986, esqm, esq1, 0, esq1, esq1, driver_device, 0, "Ensoniq", "ESQ-M", MACHINE_NOT_WORKING ) +CONS( 1988, sq80, 0, 0, sq80, esq1, driver_device, 0, "Ensoniq", "SQ-80", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/esq5505.c b/src/mame/drivers/esq5505.c new file mode 100644 index 00000000000..aaca4b127da --- /dev/null +++ b/src/mame/drivers/esq5505.c @@ -0,0 +1,955 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + esq5505.c - Ensoniq ES5505 + ES5510 based synthesizers and samplers + + Ensoniq VFX, VFX-SD, EPS, EPS-16 Plus, SD-1, SD-1 32, SQ-1 and SQ-R (SQ-1 Plus, + SQ-2, and KS-32 are known to also be this architecture). + + The Taito sound system in taito_en.c is directly derived from the 32-voice version + of the SD-1. + + Driver by R. Belmont with thanks to Parduz, Christian Brunschen, and Phil Bennett + + Memory map: + + 0x000000-0x007fff work RAM low (64k for SQ-1 and later) + 0x200000-0x20001f OTIS (5505) regs + 0x240000-0x2400ff DMAC (68450) regs (EPS/EPS-16) + 0x260000-0x2601ff ESP (5510) regs + 0x280000-0x28001f DUART (68681) regs + 0x2C0000-0x2C0003 Floppy (WD1772) regs (VFX-SD, SD-1, and EPS/EPS-16) + 0x2e0000-0x2fffff Expansion cartridge (VFX, VFX-SD, SD-1, SD-1 32 voice) + 0x300000-0x300003 EPS/EPS-16 SCSI (WD33C93, register at 300001, data at 300003) + 0x330000-0x37ffff VFX-SD / SD-1 sequencer RAM + 0x340000-0x3bffff EPS/EPS-16 sample RAM + 0xc00000-0xc3ffff OS ROM + 0xff8000-0xffffff work RAM hi (64k for SQ-1 and later) + + Note from es5700.pdf PLA equations: + RAM if (A23/22/21 = 000 and FC is not 6) or (A23/22/21 = 111 and FC is not 7) + ROM if (A23/22/21 = 110) or (A23/22/21 = 000 & FC is 6) + + Interrupts: + 5505 interrupts are on normal autovector IRQ 1 + DMAC interrupts (EPS only) are on autovector IRQ 2 + 68681 uses custom vector 0x40 (address 0x100) level 3 + + VFX / VFX-SD / SD-1 / SD-1 32 panel button codes: + 2 = PROGRAM CONTROL + 3 = WRITE + 4 = WAVE + 5 = SELECT VOICE + 6 = MIXER/SHAPER + 7 = EFFECT + 8 = COMPARE + 9 = COPY EFFECTS PARAMETERS + 10 = LFO + 11 = PITCH + 12 = ENV1 + 13 = PITCH MOD + 14 = ENV2 + 15 = FILTER + 16 = ENV3 + 17 = OUTPUT + 18 = ERROR 20 (VFX) / SEQ. CONTROL + 19 = RECORD + 20 = MASTER + 21 = STORAGE + 22 = STOP/CONT + 23 = PLAY + 24 = MIDI + 25 = BUTTON 9 + 26 = PSEL + 27 = STAT + 28 = EFFECT + 29 = SEQ? (toggles INT0 / TRAX display) + 30 = TRACKS 1-6 + 31 = TRACKS 7-12 + 32 = ERROR 20 (VFX) / CLICK-REC + 33 = ERROR 20 (VFX) / LOCATE + 34 = BUTTON 8 + 35 = BUTTON 7 + 36 = VOLUME + 37 = PAN + 38 = TIMBRE + 39 = KEY ZONE + 40 = TRANSPOSE + 41 = RELEASE + 42 = SOFT TOP CENTER + 43 = SOFT TOP RIGHT + 44 = SOFT BOTTOM CENTER + 45 = SOFT BOTTOM RIGHT + 46 = BUTTON 3 + 47 = BUTTON 4 + 48 = BUTTON 5 + 49 = BUTTON 6 + 50 = SOFT BOTTOM LEFT + 51 = ERROR 202 (VFX) / SEQ. + 52 = CART + 53 = SOUNDS + 54 = PRESETS + 55 = BUTTON 0 + 56 = BUTTON 1 + 57 = BUTTON 2 + 58 = SOFT TOP LEFT + 59 = ERROR 20 (VFX) / EDIT SEQUENCE + 60 = ERROR 20 (VFX) / EDIT SONG + 61 = ERROR 20 (VFX) / EDIT TRACK + 62 = DATA INCREMENT + 63 = DATA DECREMENT + + VFX / VFX-SD / SD-1 analog values: + 0 = Pitch Bend + 1 = Patch Select + 2 = Mod Wheel + 3 = Value, aka Data Entry Slider + 4 = Pedal / CV + 5 = Volume Slider + 6 = Battery + 7 = Voltage Reference + + SQ-1: + 4 = second digit of patch # becomes 2 + 5 = first digit of patch # becomes 2 + 6 = second digit of patch # becomes 4 + 7 = first digit of patch # becomes 4 + 8 = trk07 4volume=99 + 12 = patch -1 + 13 = patch +1 + 14 = second digit of patch # becomes 5 + 15 = first digit of patch # becomes 5 + 20 = select sound? + 22 = second digit of patch # becomes 6 + 23 = first digit of patch # becomes 6 + +***************************************************************************/ + +#include + +#include "bus/midi/midi.h" +#include "cpu/m68000/m68000.h" +#include "sound/es5506.h" +#include "sound/esqpump.h" +#include "machine/mc68681.h" +#include "cpu/es5510/es5510.h" +#include "machine/wd_fdc.h" +#include "machine/hd63450.h" // compatible with MC68450, which is what these really have +#include "formats/esq16_dsk.h" +#include "machine/esqvfd.h" +#include "machine/esqpanel.h" + +#define GENERIC (0) +#define EPS (1) +#define SQ1 (2) + +#define KEYBOARD_HACK (1) // turn on to play the SQ-1, SD-1, and SD-1 32-voice: Z and X are program up/down, A/S/D/F/G/H/J/K/L and Q/W/E/R/T/Y/U play notes + +#if KEYBOARD_HACK +static int shift = 32; +#endif + +#if 0 +static void ATTR_PRINTF(1,2) print_to_stderr(const char *format, ...) +{ + va_list arg; + va_start(arg, format); + vfprintf(stderr, format, arg); + va_end(arg); +} +#endif + +class esq5505_state : public driver_device +{ +public: + esq5505_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_duart(*this, "duart"), + m_otis(*this, "otis"), + m_esp(*this, "esp"), + m_pump(*this, "pump"), + m_fdc(*this, "wd1772"), + m_panel(*this, "panel"), + m_dmac(*this, "mc68450"), + m_mdout(*this, "mdout") + { } + + required_device m_maincpu; + required_device m_duart; + required_device m_otis; + required_device m_esp; + required_device m_pump; + optional_device m_fdc; + required_device m_panel; + optional_device m_dmac; + required_device m_mdout; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ16_MEMBER(lower_r); + DECLARE_WRITE16_MEMBER(lower_w); + + DECLARE_READ16_MEMBER(analog_r); + DECLARE_WRITE16_MEMBER(analog_w); + + DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); + DECLARE_WRITE_LINE_MEMBER(duart_tx_a); + DECLARE_WRITE_LINE_MEMBER(duart_tx_b); + DECLARE_WRITE8_MEMBER(duart_output); + + int m_system_type; + UINT8 m_duart_io; + UINT8 otis_irq_state; + UINT8 dmac_irq_state; + int dmac_irq_vector; + UINT8 duart_irq_state; + int duart_irq_vector; + + void update_irq_to_maincpu(); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + +private: + UINT16 *m_rom, *m_ram; + UINT16 m_analog_values[8]; + +public: + DECLARE_DRIVER_INIT(eps); + DECLARE_DRIVER_INIT(common); + DECLARE_DRIVER_INIT(sq1); + DECLARE_DRIVER_INIT(denib); + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + IRQ_CALLBACK_MEMBER(maincpu_irq_acknowledge_callback); + DECLARE_WRITE_LINE_MEMBER(esq5505_otis_irq); + + //dmac + DECLARE_WRITE8_MEMBER(dma_end); + DECLARE_WRITE8_MEMBER(dma_error); + DECLARE_READ8_MEMBER(fdc_read_byte); + DECLARE_WRITE8_MEMBER(fdc_write_byte); +}; + +FLOPPY_FORMATS_MEMBER( esq5505_state::floppy_formats ) + FLOPPY_ESQIMG_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( ensoniq_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +IRQ_CALLBACK_MEMBER(esq5505_state::maincpu_irq_acknowledge_callback) +{ + // We immediately update the interrupt presented to the CPU, so that it doesn't + // end up retrying the same interrupt over and over. We then return the appropriate vector. + int vector = 0; + switch(irqline) { + case 1: + otis_irq_state = 0; + vector = M68K_INT_ACK_AUTOVECTOR; + break; + case 2: + dmac_irq_state = 0; + vector = dmac_irq_vector; + break; + case 3: + duart_irq_state = 0; + vector = duart_irq_vector; + break; + default: + printf("\nUnexpected IRQ ACK Callback: IRQ %d\n", irqline); + return 0; + } + update_irq_to_maincpu(); + return vector; +} + +void esq5505_state::machine_start() +{ + driver_device::machine_start(); + // tell the pump about the OTIS & ESP chips + m_pump->set_otis(m_otis); + m_pump->set_esp(m_esp); +} + +void esq5505_state::machine_reset() +{ + floppy_connector *con = machine().device("wd1772:0"); + floppy_image_device *floppy = con ? con->get_device() : 0; + + m_rom = (UINT16 *)(void *)memregion("osrom")->base(); + m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); + + // Default analog values: + m_analog_values[0] = 0x7fff; // pitch mod: start in the center + m_analog_values[1] = 0x0000; // patch select: nothing pressed. + m_analog_values[2] = 0x0000; // mod wheel: at the bottom, no modulation + m_analog_values[3] = 0xcccc; // data entry: somewhere in the middle + m_analog_values[4] = 0xffff; // control voltage / pedal: full on. + m_analog_values[5] = 0xffff; // Volume control: full on. + m_analog_values[6] = 0x7fc0; // Battery voltage: something reasonable. + m_analog_values[7] = 0x5540; // vRef to check battery. + + // on VFX, bit 0 is 1 for 'cartridge present'. + // on VFX-SD and later, bit 0 is 1 for floppy present, bit 1 is 1 for cartridge present + if (core_stricmp(machine().system().name, "vfx") == 0) + { + // todo: handle VFX cart-in when we support cartridges + m_duart->ip0_w(ASSERT_LINE); + } + else + { + m_duart->ip1_w(CLEAR_LINE); + + if (floppy) + { + m_duart->ip0_w(ASSERT_LINE); + } + else + { + m_duart->ip0_w(CLEAR_LINE); + } + } +} + +void esq5505_state::update_irq_to_maincpu() { + //printf("\nupdating IRQ state: have OTIS=%d, DMAC=%d, DUART=%d\n", otis_irq_state, dmac_irq_state, duart_irq_state); + if (duart_irq_state) { + m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); + m_maincpu->set_input_line_and_vector(M68K_IRQ_3, ASSERT_LINE, duart_irq_vector); + } else if (dmac_irq_state) { + m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); + m_maincpu->set_input_line_and_vector(M68K_IRQ_2, ASSERT_LINE, dmac_irq_vector); + } else if (otis_irq_state) { + m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); + } else { + m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); + } +} + +READ16_MEMBER(esq5505_state::lower_r) +{ + offset &= 0x7fff; + + // get pointers when 68k resets + if (!m_rom) + { + m_rom = (UINT16 *)(void *)memregion("osrom")->base(); + m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); + } + + if (m_maincpu->get_fc() == 0x6) // supervisor mode = ROM + { + return m_rom[offset]; + } + else + { + return m_ram[offset]; + } +} + +WRITE16_MEMBER(esq5505_state::lower_w) +{ + offset &= 0x7fff; + + if (offset < 0x4000) + { + if (m_maincpu->get_fc() != 0x6) // if not supervisor mode, RAM + { + COMBINE_DATA(&m_ram[offset]); + } + else + { + logerror("Write to ROM: %x @ %x (fc=%x)\n", data, offset, m_maincpu->get_fc()); + } + } + else + { + COMBINE_DATA(&m_ram[offset]); + } +} + +static ADDRESS_MAP_START( vfx_map, AS_PROGRAM, 16, esq5505_state ) + AM_RANGE(0x000000, 0x007fff) AM_READWRITE(lower_r, lower_w) + AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("otis", es5505_device, read, write) + AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0x00ff) + AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x00ff) + AM_RANGE(0xc00000, 0xc1ffff) AM_ROM AM_REGION("osrom", 0) + AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( vfxsd_map, AS_PROGRAM, 16, esq5505_state ) + AM_RANGE(0x000000, 0x00ffff) AM_READWRITE(lower_r, lower_w) + AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("otis", es5505_device, read, write) + AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0x00ff) + AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x00ff) + AM_RANGE(0x2c0000, 0x2c0007) AM_DEVREADWRITE8("wd1772", wd1772_t, read, write, 0x00ff) + AM_RANGE(0x330000, 0x3bffff) AM_RAM // sequencer memory? + AM_RANGE(0xc00000, 0xc3ffff) AM_ROM AM_REGION("osrom", 0) + AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( eps_map, AS_PROGRAM, 16, esq5505_state ) + AM_RANGE(0x000000, 0x007fff) AM_READWRITE(lower_r, lower_w) + AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("otis", es5505_device, read, write) + AM_RANGE(0x240000, 0x2400ff) AM_DEVREADWRITE("mc68450", hd63450_device, read, write) + AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0x00ff) + AM_RANGE(0x2c0000, 0x2c0007) AM_DEVREADWRITE8("wd1772", wd1772_t, read, write, 0x00ff) + AM_RANGE(0x580000, 0x7fffff) AM_RAM // sample RAM? + AM_RANGE(0xc00000, 0xc1ffff) AM_ROM AM_REGION("osrom", 0) + AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sq1_map, AS_PROGRAM, 16, esq5505_state ) + AM_RANGE(0x000000, 0x03ffff) AM_READWRITE(lower_r, lower_w) + AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("otis", es5505_device, read, write) + AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x0ff) + AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0x00ff) + AM_RANGE(0x330000, 0x3bffff) AM_RAM // sequencer memory? + AM_RANGE(0xc00000, 0xc3ffff) AM_ROM AM_REGION("osrom", 0) + AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") +ADDRESS_MAP_END + +WRITE_LINE_MEMBER(esq5505_state::esq5505_otis_irq) +{ + otis_irq_state = (state != 0); + update_irq_to_maincpu(); +} + +WRITE16_MEMBER(esq5505_state::analog_w) +{ + offset &= 0x7; + m_analog_values[offset] = data; +} + +READ16_MEMBER(esq5505_state::analog_r) +{ + return m_analog_values[m_duart_io & 7]; +} + +WRITE_LINE_MEMBER(esq5505_state::duart_irq_handler) +{ +// printf("\nDUART IRQ: state %d vector %d\n", state, vector); + if (state == ASSERT_LINE) + { + duart_irq_vector = m_duart->get_irq_vector(); + duart_irq_state = 1; + } + else + { + duart_irq_state = 0; + } + update_irq_to_maincpu(); +} + +WRITE8_MEMBER(esq5505_state::duart_output) +{ + floppy_connector *con = machine().device("wd1772:0"); + floppy_image_device *floppy = con ? con->get_device() : 0; + + m_duart_io = data; + + /* + EPS: + bit 2 = SSEL + + VFX: + bits 0/1/2 = analog sel + bit 6 = ESPHALT + bit 7 = SACK (?) + + VFX-SD & SD-1 (32): + bits 0/1/2 = analog sel + bit 3 = SSEL (disk side) + bit 4 = DSEL (drive select?) + bit 6 = ESPHALT + bit 7 = SACK (?) + */ + + if (data & 0x40) { + if (!m_pump->get_esp_halted()) { + logerror("ESQ5505: Asserting ESPHALT\n"); + m_pump->set_esp_halted(true); + } + } else { + if (m_pump->get_esp_halted()) { + logerror("ESQ5505: Clearing ESPHALT\n"); + m_pump->set_esp_halted(false); + } + } + + if (floppy) + { + if (m_system_type == EPS) + { + floppy->ss_w((data & 2)>>1); + } + else + { + floppy->ss_w(((data & 8)>>3)^1); + } + } + +// printf("DUART output: %02x (PC=%x)\n", data, m_maincpu->pc()); +} + +// MIDI send +WRITE_LINE_MEMBER(esq5505_state::duart_tx_a) +{ + m_mdout->write_txd(state); +} + +WRITE_LINE_MEMBER(esq5505_state::duart_tx_b) +{ + m_panel->rx_w(state); +} + +WRITE8_MEMBER(esq5505_state::dma_end) +{ + if (data != 0) + { + printf("DMAC IRQ, vector = %x\n", m_dmac->get_vector(offset)); + dmac_irq_state = 1; + dmac_irq_vector = m_dmac->get_vector(offset); + } + else + { + dmac_irq_state = 0; + } + + update_irq_to_maincpu(); +} + +WRITE8_MEMBER(esq5505_state::dma_error) +{ + if(data != 0) + { + printf("DMAC error, vector = %x\n", m_dmac->get_error_vector(offset)); + dmac_irq_state = 1; + dmac_irq_vector = m_dmac->get_vector(offset); + } + else + { + dmac_irq_state = 0; + } + + update_irq_to_maincpu(); +} + +READ8_MEMBER(esq5505_state::fdc_read_byte) +{ + return m_fdc->data_r(); +} + +WRITE8_MEMBER(esq5505_state::fdc_write_byte) +{ + m_fdc->data_w(data & 0xff); +} + +#if KEYBOARD_HACK +INPUT_CHANGED_MEMBER(esq5505_state::key_stroke) +{ + int val = (UINT8)(FPTR)param; + + if (val < 0x60) + { + if (oldval == 0 && newval == 1) + { + if (val == 0 && shift > 0) + { + shift -= 32; + printf("New shift %d\n", shift); + } + else if (val == 1 && shift < 32) + { + shift += 32; + printf("New shift %d\n", shift); + } + else if (val == 0x02) + { + printf("Analog tests!\n"); + m_panel->xmit_char(54 | 0x80); m_panel->xmit_char(0); // Preset down + m_panel->xmit_char(8 | 0x80); m_panel->xmit_char(0); // Compare down + m_panel->xmit_char(8); m_panel->xmit_char(0); // Compare up + m_panel->xmit_char(54); m_panel->xmit_char(0); // Preset up + } + } + } + else + { + val += shift; + if (oldval == 0 && newval == 1) + { + printf("key pressed %d\n", val&0x7f); + m_panel->xmit_char(val); + m_panel->xmit_char(0x00); + } + else if (oldval == 1 && newval == 0) + { + // printf("key off %x\n", (UINT8)(FPTR)param); + m_panel->xmit_char(val&0x7f); + m_panel->xmit_char(0x00); + } + } +} +#endif + +static MACHINE_CONFIG_START( vfx, esq5505_state ) + MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(vfx_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(esq5505_state,maincpu_irq_acknowledge_callback) + + MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) + MCFG_DEVICE_DISABLE() + + MCFG_ESQPANEL2x40_ADD("panel") + MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) + MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) + + MCFG_MC68681_ADD("duart", 4000000) + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(esq5505_state, duart_irq_handler)) + MCFG_MC68681_A_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_a)) + MCFG_MC68681_B_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_b)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(esq5505_state, duart_output)) + MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) // route MIDI Tx send directly to 68681 channel A Rx + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_ADD("pump", ESQ_5505_5510_PUMP, XTAL_10MHz / (16 * 21)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_SOUND_ADD("otis", ES5505, XTAL_10MHz) + MCFG_ES5505_REGION0("waverom") /* Bank 0 */ + MCFG_ES5505_REGION1("waverom2") /* Bank 1 */ + MCFG_ES5505_CHANNELS(4) /* channels */ + MCFG_ES5505_IRQ_CB(WRITELINE(esq5505_state, esq5505_otis_irq)) /* irq */ + MCFG_ES5505_READ_PORT_CB(READ16(esq5505_state, analog_r)) /* ADC */ + MCFG_SOUND_ROUTE_EX(0, "pump", 1.0, 0) + MCFG_SOUND_ROUTE_EX(1, "pump", 1.0, 1) + MCFG_SOUND_ROUTE_EX(2, "pump", 1.0, 2) + MCFG_SOUND_ROUTE_EX(3, "pump", 1.0, 3) + MCFG_SOUND_ROUTE_EX(4, "pump", 1.0, 4) + MCFG_SOUND_ROUTE_EX(5, "pump", 1.0, 5) + MCFG_SOUND_ROUTE_EX(6, "pump", 1.0, 6) + MCFG_SOUND_ROUTE_EX(7, "pump", 1.0, 7) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(eps, vfx) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(eps_map) + + MCFG_ESQPANEL_2x40_REMOVE("panel") + MCFG_ESQPANEL1x22_ADD("panel") + MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) + MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) + + MCFG_WD1772_ADD("wd1772", 8000000) + MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) + + MCFG_DEVICE_ADD("mc68450", HD63450, 0) // MC68450 compatible + MCFG_HD63450_CPU("maincpu") // CPU - 68000 + MCFG_HD63450_CLOCKS(attotime::from_usec(32), attotime::from_nsec(450), attotime::from_usec(4), attotime::from_hz(15625/2)) + MCFG_HD63450_BURST_CLOCKS(attotime::from_usec(32), attotime::from_nsec(450), attotime::from_nsec(50), attotime::from_nsec(50)) + MCFG_HD63450_DMA_END_CB(WRITE8(esq5505_state, dma_end)) + MCFG_HD63450_DMA_ERROR_CB(WRITE8(esq5505_state, dma_error)) + MCFG_HD63450_DMA_READ_0_CB(READ8(esq5505_state, fdc_read_byte)) // ch 0 = fdc, ch 1 = 340001 (ADC?) + MCFG_HD63450_DMA_WRITE_0_CB(WRITE8(esq5505_state, fdc_write_byte)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(vfxsd, vfx) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(vfxsd_map) + + MCFG_WD1772_ADD("wd1772", 8000000) + MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) +MACHINE_CONFIG_END + +// 32-voice machines with the VFX-SD type config +static MACHINE_CONFIG_START(vfx32, esq5505_state) + MCFG_CPU_ADD("maincpu", M68000, XTAL_30_4761MHz / 2) + MCFG_CPU_PROGRAM_MAP(vfxsd_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(esq5505_state,maincpu_irq_acknowledge_callback) + + MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) + MCFG_DEVICE_DISABLE() + + MCFG_ESQPANEL2x40_ADD("panel") + MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) + MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) + + MCFG_MC68681_ADD("duart", 4000000) + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(esq5505_state, duart_irq_handler)) + MCFG_MC68681_A_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_a)) + MCFG_MC68681_B_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_b)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(esq5505_state, duart_output)) + MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) // route MIDI Tx send directly to 68681 channel A Rx + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_ADD("pump", ESQ_5505_5510_PUMP, XTAL_30_4761MHz / (2 * 16 * 32)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_SOUND_ADD("otis", ES5505, XTAL_30_4761MHz / 2) + MCFG_ES5505_REGION0("waverom") /* Bank 0 */ + MCFG_ES5505_REGION1("waverom2") /* Bank 1 */ + MCFG_ES5505_CHANNELS(4) /* channels */ + MCFG_ES5505_IRQ_CB(WRITELINE(esq5505_state, esq5505_otis_irq)) /* irq */ + MCFG_ES5505_READ_PORT_CB(READ16(esq5505_state, analog_r)) /* ADC */ + MCFG_SOUND_ROUTE_EX(0, "pump", 1.0, 0) + MCFG_SOUND_ROUTE_EX(1, "pump", 1.0, 1) + MCFG_SOUND_ROUTE_EX(2, "pump", 1.0, 2) + MCFG_SOUND_ROUTE_EX(3, "pump", 1.0, 3) + MCFG_SOUND_ROUTE_EX(4, "pump", 1.0, 4) + MCFG_SOUND_ROUTE_EX(5, "pump", 1.0, 5) + MCFG_SOUND_ROUTE_EX(6, "pump", 1.0, 6) + MCFG_SOUND_ROUTE_EX(7, "pump", 1.0, 7) + + MCFG_WD1772_ADD("wd1772", 8000000) + MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(sq1, vfx) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(sq1_map) + + MCFG_ESQPANEL_2x40_REMOVE("panel") + MCFG_ESQPANEL2x40_SQ1_ADD("panel") + MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) + MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( vfx ) +#if KEYBOARD_HACK + PORT_START("KEY0") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x80) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x81) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x82) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x83) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x84) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x85) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x86) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x87) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x88) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x89) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8a) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8b) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8c) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8d) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8e) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8f) + + PORT_START("KEY1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x90) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x91) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x92) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x93) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x94) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x95) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x96) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x97) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x98) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x99) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9a) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9b) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9c) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9d) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9e) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9f) + + PORT_START("KEY2") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 1) + + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 2) +#endif +INPUT_PORTS_END + +#define ROM_LOAD16_BYTE_BIOS(bios,name,offset,length,hash) \ + ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1) | ROM_BIOS(bios+1)) /* Note '+1' */ + +ROM_START( vfx ) + ROM_REGION(0x40000, "osrom", 0) + ROM_LOAD16_BYTE( "vfx210b-low.bin", 0x000000, 0x010000, CRC(c51b19cd) SHA1(2a125b92ffa02ae9d7fb88118d525491d785e87e) ) + ROM_LOAD16_BYTE( "vfx210b-high.bin", 0x000001, 0x010000, CRC(59853be8) SHA1(8e07f69d53f80885d15f624e0b912aeaf3212ee4) ) + + ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) + ROM_LOAD16_BYTE( "u14.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) ) + ROM_LOAD16_BYTE( "u15.bin", 0x100001, 0x080000, CRC(c0055975) SHA1(5a22f1d5e437c6277eb0cfb1ff1b3f8dcdea1cc6) ) + + ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00) + ROM_LOAD( "u16.bin", 0x000000, 0x080000, CRC(c3ddaf95) SHA1(44a7bd89cd7e82952cc5100479e110c385246559) ) +ROM_END + +ROM_START( vfxsd ) + ROM_REGION(0x40000, "osrom", 0) + ROM_LOAD16_BYTE( "vfxsd_200_lower.bin", 0x000000, 0x010000, CRC(7bd31aea) SHA1(812bf73c4861a5d963f128def14a4a98171c93ad) ) + ROM_LOAD16_BYTE( "vfxsd_200_upper.bin", 0x000001, 0x010000, CRC(9a40efa2) SHA1(e38a2a4514519c1573361cb1526139bfcf94e45a) ) + + ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) + ROM_LOAD16_BYTE( "u57.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) ) + ROM_LOAD16_BYTE( "u58.bin", 0x100001, 0x080000, CRC(c0055975) SHA1(5a22f1d5e437c6277eb0cfb1ff1b3f8dcdea1cc6) ) + + ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) + + ROM_REGION(0x80000, "nibbles", 0) + ROM_LOAD( "u60.bin", 0x000000, 0x080000, CRC(c3ddaf95) SHA1(44a7bd89cd7e82952cc5100479e110c385246559) ) +ROM_END + +ROM_START( sd1 ) + ROM_REGION(0x40000, "osrom", 0) + ROM_LOAD16_BYTE( "sd1_21_300b_lower.bin", 0x000000, 0x020000, CRC(a1358a0c) SHA1(64ac5358aa46da37ca4195002cf358554e00878a) ) + ROM_LOAD16_BYTE( "sd1_21_300b_upper.bin", 0x000001, 0x010000, CRC(465ba463) SHA1(899b0e83d0788c8d49c7b09ccf0b4a92b528c6e9) ) + + ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // BS=0 region (12-bit) + ROM_LOAD16_BYTE( "u34.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) ) + ROM_LOAD16_BYTE( "u35.bin", 0x100001, 0x080000, CRC(c0055975) SHA1(5a22f1d5e437c6277eb0cfb1ff1b3f8dcdea1cc6) ) + + ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) // BS=1 region (16-bit) + ROM_LOAD16_WORD_SWAP( "u38.bin", 0x000000, 0x100000, CRC(a904190e) SHA1(e4fd4e1130906086fb4182dcb8b51269969e2836) ) + ROM_LOAD16_WORD_SWAP( "u37.bin", 0x100000, 0x100000, CRC(d706cef3) SHA1(24ba35248509e9ca45110e2402b8085006ea0cfc) ) + + ROM_REGION(0x80000, "nibbles", 0) + ROM_LOAD( "u36.bin", 0x000000, 0x080000, CRC(c3ddaf95) SHA1(44a7bd89cd7e82952cc5100479e110c385246559) ) +ROM_END + +// note: all known 4.xx BIOSes are for the 32-voice SD-1 and play out of tune on 21-voice h/w +ROM_START( sd132 ) + ROM_REGION(0x40000, "osrom", 0) + ROM_SYSTEM_BIOS(0, "410", "SD-1 v4.10") + ROM_LOAD16_BYTE_BIOS(0, "sd1_410_lo.bin", 0x000000, 0x020000, CRC(faa613a6) SHA1(60066765cddfa9d3b5d09057d8f83fb120f4e65e) ) + ROM_LOAD16_BYTE_BIOS(0, "sd1_410_hi.bin", 0x000001, 0x010000, CRC(618c0aa8) SHA1(74acf458aa1d04a0a7a0cd5855c49e6855dbd301) ) + ROM_SYSTEM_BIOS(1, "402", "SD-1 v4.02") + ROM_LOAD16_BYTE_BIOS(1, "sd1_32_402_lo.bin", 0x000000, 0x020000, CRC(5da2572b) SHA1(cb6ddd637ed13bfeb40a99df56000479e63fc8ec) ) + ROM_LOAD16_BYTE_BIOS(1, "sd1_32_402_hi.bin", 0x000001, 0x010000, CRC(fc45c210) SHA1(23b81ebd9176112e6eae0c7c75b39fcb1656c953) ) + + ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // BS=0 region (12-bit) + ROM_LOAD16_BYTE( "u34.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) ) + ROM_LOAD16_BYTE( "u35.bin", 0x100001, 0x080000, CRC(c0055975) SHA1(5a22f1d5e437c6277eb0cfb1ff1b3f8dcdea1cc6) ) + + ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) // BS=1 region (16-bit) + ROM_LOAD16_WORD_SWAP( "u38.bin", 0x000000, 0x100000, CRC(a904190e) SHA1(e4fd4e1130906086fb4182dcb8b51269969e2836) ) + ROM_LOAD16_WORD_SWAP( "u37.bin", 0x100000, 0x100000, CRC(d706cef3) SHA1(24ba35248509e9ca45110e2402b8085006ea0cfc) ) + + ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00) + ROM_LOAD( "u36.bin", 0x000000, 0x080000, CRC(c3ddaf95) SHA1(44a7bd89cd7e82952cc5100479e110c385246559) ) +ROM_END + + +ROM_START( sq1 ) + ROM_REGION(0x40000, "osrom", 0) + ROM_LOAD16_BYTE( "sq1lo.bin", 0x000000, 0x010000, CRC(b004cf05) SHA1(567b0dae2e35b06e39da108f9c041fd9bc38fa35) ) + ROM_LOAD16_BYTE( "sq1up.bin", 0x000001, 0x010000, CRC(2e927873) SHA1(06a948cb71fa254b23f4b9236f29035d10778da1) ) + + ROM_REGION(0x200000, "waverom", 0) + ROM_LOAD16_BYTE( "sq1-u25.bin", 0x000001, 0x080000, CRC(26312451) SHA1(9f947a11592fd8420fc581914bf16e7ade75390c) ) + ROM_LOAD16_BYTE( "sq1-u26.bin", 0x100001, 0x080000, CRC(2edaa9dc) SHA1(72fead505c4f44e5736ff7d545d72dfa37d613e2) ) + + ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00) +ROM_END + +ROM_START( sqrack ) + ROM_REGION(0x40000, "osrom", 0) + ROM_LOAD16_BYTE( "sqr-102-lower.bin", 0x000000, 0x010000, CRC(186c85ad) SHA1(801c5cf82823ce31a88688fbee4c11ea5ffdbc10) ) + ROM_LOAD16_BYTE( "sqr-102-upper.bin", 0x000001, 0x010000, CRC(088c9d31) SHA1(30627f21d893888b6159c481bea08e3eedd21902) ) + + ROM_REGION(0x200000, "waverom", 0) + ROM_LOAD16_BYTE( "sq1-u25.bin", 0x000001, 0x080000, CRC(26312451) SHA1(9f947a11592fd8420fc581914bf16e7ade75390c) ) + ROM_LOAD16_BYTE( "sq1-u26.bin", 0x100001, 0x080000, CRC(2edaa9dc) SHA1(72fead505c4f44e5736ff7d545d72dfa37d613e2) ) + + ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00) +ROM_END + +ROM_START( eps ) + ROM_REGION(0x20000, "osrom", 0) + ROM_LOAD16_BYTE( "eps-l.bin", 0x000000, 0x008000, CRC(382beac1) SHA1(110e31edb03fcf7bbde3e17423b21929e5b32db2) ) + ROM_LOAD16_BYTE( "eps-h.bin", 0x000001, 0x008000, CRC(d8747420) SHA1(460597751386eb5f08465699b61381c4acd78065) ) + + ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // EPS-16 has no ROM sounds + + ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) +ROM_END + +ROM_START( eps16p ) + ROM_REGION(0x20000, "osrom", 0) + ROM_LOAD16_BYTE( "eps16plus-100f-lower.u27", 0x000000, 0x010000, CRC(78568d3f) SHA1(ac737e093f422e109e8f06d44548629a12d6418c) ) + ROM_LOAD16_BYTE( "eps16plus-100f-upper.u28", 0x000001, 0x010000, CRC(1264465f) SHA1(71604da091bd90a32f0d93698d70b9e114ec1697) ) + + ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // EPS-16 Plus has no ROM sounds + + ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) +ROM_END + +DRIVER_INIT_MEMBER(esq5505_state,common) +{ + m_system_type = GENERIC; + m_duart_io = 0; + + floppy_connector *con = machine().device("wd1772:0"); + floppy_image_device *floppy = con ? con->get_device() : 0; + if (floppy) + { + m_fdc->set_floppy(floppy); + floppy->ss_w(0); + } +} + +DRIVER_INIT_MEMBER(esq5505_state,eps) +{ + DRIVER_INIT_CALL(common); + m_system_type = EPS; +} + +DRIVER_INIT_MEMBER(esq5505_state,sq1) +{ + DRIVER_INIT_CALL(common); + m_system_type = SQ1; +} + +DRIVER_INIT_MEMBER(esq5505_state,denib) +{ + UINT8 *pNibbles = (UINT8 *)memregion("nibbles")->base(); + UINT8 *pBS0L = (UINT8 *)memregion("waverom")->base(); + UINT8 *pBS0H = pBS0L + 0x100000; + + DRIVER_INIT_CALL(common); + + // create the 12 bit samples by patching in the nibbles from the nibble ROM + // low nibbles go with the lower ROM, high nibbles with the upper ROM + for (int i = 0; i < 0x80000; i++) + { + *pBS0L = (*pNibbles & 0x0f) << 4; + *pBS0H = (*pNibbles & 0xf0); + pBS0L += 2; + pBS0H += 2; + pNibbles++; + } +} + +CONS( 1988, eps, 0, 0, eps, vfx, esq5505_state, eps, "Ensoniq", "EPS", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs) +CONS( 1989, vfx, 0, 0, vfx, vfx, esq5505_state, denib, "Ensoniq", "VFX", MACHINE_NOT_WORKING ) // 2x40 VFD +CONS( 1989, vfxsd, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "VFX-SD", MACHINE_NOT_WORKING ) // 2x40 VFD +CONS( 1990, eps16p,eps, 0, eps, vfx, esq5505_state, eps, "Ensoniq", "EPS-16 Plus", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs) +CONS( 1990, sd1, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (21 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD +CONS( 1990, sq1, 0, 0, sq1, vfx, esq5505_state, sq1, "Ensoniq", "SQ-1", MACHINE_NOT_WORKING ) // 2x16 LCD +CONS( 1990, sqrack,sq1, 0, sq1, vfx, esq5505_state, sq1, "Ensoniq", "SQ-Rack", MACHINE_NOT_WORKING ) // 2x16 LCD +CONS( 1991, sd132, sd1,0, vfx32, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (32 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD diff --git a/src/mame/drivers/esqasr.c b/src/mame/drivers/esqasr.c new file mode 100644 index 00000000000..6ae09247b70 --- /dev/null +++ b/src/mame/drivers/esqasr.c @@ -0,0 +1,167 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + esqasr.c - Ensoniq ASR-10 and ASR-X + + Skeleton driver by R. Belmont + + ASR-10 hardware: + CPU: 68302 MCU + Sound: ES5506 + Effects: ES5510 + FDC: NEC uPD72069 + DUART: 2681 + + Memory map: + 0x000000-0x03ffff OS ROM + 0xfb0000-0xfcffff OS RAM + + + ASR-X hardware: + CPU: 68340 MCU + Sound: ES5506 + Effects: ES5511 + FDC: NEC uPD72069 + + http://www.gweep.net/~shifty/music/asrxhack/ + + Memory map: + 0x00000000-0x000fffff OS ROM + 0x00800000-0x008000ff ESP2 5511? + 0x00f00000-0x00f007ff Unknown + 0x08000000-0x08200000 RAM + 0x0be00000-0x0befffff RAM (size unknown) + + These may want to be separated when they run more. + +***************************************************************************/ + +#include "emu.h" +#include "machine/68340.h" +#include "sound/es5506.h" +#include "cpu/es5510/es5510.h" +#include "machine/upd765.h" + +#include "machine/esqvfd.h" + +class esqasr_state : public driver_device +{ +public: + esqasr_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_esp(*this, "esp"), + m_sq1vfd(*this, "sq1vfd") + { } + + required_device m_maincpu; + required_device m_esp; + required_device m_sq1vfd; + + virtual void machine_reset(); + + DECLARE_DRIVER_INIT(asr); + DECLARE_WRITE_LINE_MEMBER(esq5506_otto_irq); + DECLARE_READ16_MEMBER(esq5506_read_adc); +}; + +void esqasr_state::machine_reset() +{ +} + +static ADDRESS_MAP_START( asr_map, AS_PROGRAM, 16, esqasr_state ) + AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0xf00000, 0xffffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( asrx_map, AS_PROGRAM, 32, esqasr_state ) + AM_RANGE(0x00000000, 0x000fffff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x08000000, 0x081fffff) AM_RAM + AM_RANGE(0x0be00000, 0x0befffff) AM_RAM +ADDRESS_MAP_END + +WRITE_LINE_MEMBER(esqasr_state::esq5506_otto_irq) +{ +} + +READ16_MEMBER(esqasr_state::esq5506_read_adc) +{ + return 0; +} + +static MACHINE_CONFIG_START( asr, esqasr_state ) + MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) // actually MC68302 + MCFG_CPU_PROGRAM_MAP(asr_map) + + MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) + MCFG_DEVICE_DISABLE() + + MCFG_ESQ2x40_SQ1_ADD("sq1vfd") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("ensoniq", ES5506, XTAL_16MHz) + MCFG_ES5506_REGION0("waverom") /* Bank 0 */ + MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ + MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ + MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ + MCFG_ES5506_CHANNELS(1) /* channels */ + MCFG_ES5506_IRQ_CB(WRITELINE(esqasr_state, esq5506_otto_irq)) /* irq */ + MCFG_ES5506_READ_PORT_CB(READ16(esqasr_state, esq5506_read_adc)) + MCFG_SOUND_ROUTE(0, "lspeaker", 2.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 2.0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( asrx, esqasr_state ) + MCFG_CPU_ADD("maincpu", M68020, XTAL_16MHz) // unknown, possibly 68340? + MCFG_CPU_PROGRAM_MAP(asrx_map) + + MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) + MCFG_DEVICE_DISABLE() + + MCFG_ESQ2x40_SQ1_ADD("sq1vfd") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("ensoniq", ES5506, XTAL_16MHz) + MCFG_ES5506_REGION0("waverom") /* Bank 0 */ + MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ + MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ + MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ + MCFG_ES5506_CHANNELS(1) /* channels */ + MCFG_ES5506_IRQ_CB(WRITELINE(esqasr_state, esq5506_otto_irq)) /* irq */ + MCFG_ES5506_READ_PORT_CB(READ16(esqasr_state, esq5506_read_adc)) + MCFG_SOUND_ROUTE(0, "lspeaker", 2.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 2.0) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( asr ) +INPUT_PORTS_END + +ROM_START( asr10 ) + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD16_BYTE( "asr-648c-lo-1.5b.bin", 0x000001, 0x020000, CRC(8e437843) SHA1(418f042acbc5323f5b59cbbd71fdc8b2d851f7d0) ) + ROM_LOAD16_BYTE( "asr-65e0-hi-1.5b.bin", 0x000000, 0x020000, CRC(b37cd3b6) SHA1(c4371848428a628b5e5a50e99be602d7abfc7904) ) + + ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) + ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) + ROM_REGION(0x200000, "waverom3", ROMREGION_ERASE00) + ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) +ROM_END + +ROM_START( asrx ) + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD16_BYTE( "asr267lo.bin", 0x000001, 0x080000, CRC(7408d441) SHA1(0113f84b6d224bf1423ad62c173f32a0c95ca715) ) + ROM_LOAD16_BYTE( "asr267hi.bin", 0x000000, 0x080000, CRC(7df14ea7) SHA1(895b99013c0f924edb52612eb93c3e6babb9f053) ) + + ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) + ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) + ROM_REGION(0x200000, "waverom3", ROMREGION_ERASE00) + ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) +ROM_END + +DRIVER_INIT_MEMBER(esqasr_state, asr) +{ +} + +CONS( 1992, asr10, 0, 0, asr, asr, esqasr_state, asr, "Ensoniq", "ASR-10", MACHINE_NOT_WORKING ) +CONS( 1997, asrx, 0, 0, asrx,asr, esqasr_state, asr, "Ensoniq", "ASR-X", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/esqkt.c b/src/mame/drivers/esqkt.c new file mode 100644 index 00000000000..293844aa880 --- /dev/null +++ b/src/mame/drivers/esqkt.c @@ -0,0 +1,272 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + esqkt.c - Ensoniq KT-76, KT-88, and E-Prime + + Driver by R. Belmont + + Hardware: + CPU: 68EC020-16 CPU + Serial/timers: SCN2681 (MC68681 clone) + Sound: 2xES5506 + Effects: ES5510 + + Memory map: + + 0x000000-0x07FFFF OS ROM + 0x200000-0x20003F Master ES5506 + 0x240000-0x24003F Slave ES5506 + 0x280000-0x2801FF ES5510 + 0x300000-0x30000F 68681 DUART + 0xFF0000-0xFFFFFF OS RAM + + Ensoniq KT-76 + Ensoniq 1994 + + This is a wavetable-based synth keyboard made by Ensoniq in 1994 + + PCB Layout + ---------- + + KT-76 + |---------------------------------------------| + |J12 J3 J11 J10 | + | LM393 LM358| + | 74HC4051| + |ADM691 | + | 62256 | + | | + |3V_BATTERY KT76_0590_LO.U5 ROM0 | + | | + | 68EC020 62256 OTTOR2 ROM1 | + | | + | KT76_690B_HI.U6 ROM2 | + | PAL1 | + | HP_6N138 | + | PAL2 OTTOR2 J6| + | 7407 | + | | + | D41464 D41464 | + | | + | SCN2681 D41464 D41464 | + | 137000402 | + | | + | 18.432MHz | + | ESPR6 16MHz | + | POT | + | R1136-11 | + | | + | LM339 LM339 | + | J13 J5 J1 J2 J4 | + |---------------------------------------------| + Notes: + J1 - connector for digital jacks + J2 - connector for keyboard + J3 - connector for LCD display + J4 - connector for keyboard + J5 - connector for power input + J6 - connector for wave expansion + J10 - connector for wheels/pressure + J11 - connector for memory card + J12 - connector for headphones + J13 - connector for analog jacks + 68EC020 - Motorola MC68EC020FG16 CPU. Clock input 16MHz + 1370000402 - Unknown PLCC44 IC stamped with the Ensoniq logo. Likely CPLD or gate array. + ESPR6 - Ensoniq ESPR6 (ES5510) sound chip + OTTOR2 - Ensoniq OTTOR2 (ES5506) sound chip + POT - ESP adjustment pot + KT76* - 27C2048/27C210 EPROM + ROM* - 2M x8-bit SOP44 mask ROM + R1136-11 - DIP40 IC manufactured by Rockwell - believed to be some type of MCU. + D41464 - NEC D41464 64k x4-bit DRAM + 62256 - 32k x8-bit SRAM + SCN2681 - Philips SCN2681 Dual Universal Asynchronous Receiver/Transmitter (DUART) + HP_6N138 - HP/Agilent HP 6N138 Low Input Current High Gain Optocoupler + PAL1 - MMI PAL20L8ACN stamped 'KT-76 MMU 6A0A'. Printing is faint so 0 could be a B or a D. + PAL2 - MMI PAL20L8ACN stamped 'KT-76 BCU 73D6' + +***************************************************************************/ + +#include "bus/midi/midi.h" +#include "cpu/m68000/m68000.h" +#include "cpu/es5510/es5510.h" +#include "sound/es5506.h" +#include "machine/mc68681.h" +#include "machine/esqpanel.h" + +class esqkt_state : public driver_device +{ +public: + esqkt_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_esp(*this, "esp"), + m_duart(*this, "duart"), + m_sq1panel(*this, "sq1panel"), + m_mdout(*this, "mdout") + { } + + required_device m_maincpu; + required_device m_esp; + required_device m_duart; + required_device m_sq1panel; + required_device m_mdout; + + virtual void machine_reset(); + + DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); + DECLARE_WRITE_LINE_MEMBER(duart_tx_a); + DECLARE_WRITE_LINE_MEMBER(duart_tx_b); + DECLARE_WRITE8_MEMBER(duart_output); + + UINT8 m_duart_io; + bool m_bCalibSecondByte; + +private: + UINT32 *m_rom, *m_ram; + +public: + DECLARE_DRIVER_INIT(kt); + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + DECLARE_WRITE_LINE_MEMBER(esq5506_otto_irq); + DECLARE_READ16_MEMBER(esq5506_read_adc); +}; + +void esqkt_state::machine_reset() +{ + m_bCalibSecondByte = false; +} + +static ADDRESS_MAP_START( kt_map, AS_PROGRAM, 32, esqkt_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_REGION("osrom", 0) + AM_RANGE(0x200000, 0x20003f) AM_DEVREADWRITE8("ensoniq", es5506_device, read, write, 0xffffffff) + AM_RANGE(0x240000, 0x24003f) AM_DEVREADWRITE8("ensoniq2", es5506_device, read, write, 0xffffffff) + AM_RANGE(0x280000, 0x2801ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0xffffffff) + AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0xffffffff) + AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") +ADDRESS_MAP_END + +WRITE_LINE_MEMBER(esqkt_state::esq5506_otto_irq) +{ + #if 0 // 5505/06 IRQ generation needs (more) work + m_maincpu->set_input_line(1, state); + #endif +} + +READ16_MEMBER(esqkt_state::esq5506_read_adc) +{ + switch ((m_duart_io & 7) ^ 7) + { + case 0: // vRef to check battery + return 0x5b00; + + case 2: // battery voltage + return 0x7f00; + + default: // pedal + return 0; + } + + if (m_duart_io & 1) + { + return 0x5b00; // vRef + } + else + { + return 0x7f00; // vBattery + } +} + +WRITE_LINE_MEMBER(esqkt_state::duart_irq_handler) +{ + m_maincpu->set_input_line(M68K_IRQ_3, state); +} + +WRITE8_MEMBER(esqkt_state::duart_output) +{ + m_duart_io = data; + +// printf("DUART output: %02x (PC=%x)\n", data, m_maincpu->pc()); +} + +WRITE_LINE_MEMBER(esqkt_state::duart_tx_a) +{ + m_mdout->write_txd(state); +} + +WRITE_LINE_MEMBER(esqkt_state::duart_tx_b) +{ + m_sq1panel->rx_w(state); +} + +static MACHINE_CONFIG_START( kt, esqkt_state ) + MCFG_CPU_ADD("maincpu", M68EC020, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(kt_map) + + MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) + MCFG_DEVICE_DISABLE() + + MCFG_ESQPANEL2x40_SQ1_ADD("sq1panel") + MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) + + MCFG_MC68681_ADD("duart", 4000000) + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(esqkt_state, duart_irq_handler)) + MCFG_MC68681_A_TX_CALLBACK(WRITELINE(esqkt_state, duart_tx_a)) + MCFG_MC68681_B_TX_CALLBACK(WRITELINE(esqkt_state, duart_tx_b)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(esqkt_state, duart_output)) + MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) + MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) // route MIDI Tx send directly to 68681 channel A Rx + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("ensoniq", ES5506, XTAL_16MHz) + MCFG_ES5506_REGION0("waverom") /* Bank 0 */ + MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ + MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ + MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ + MCFG_ES5506_CHANNELS(1) /* channels */ + MCFG_ES5506_IRQ_CB(WRITELINE(esqkt_state, esq5506_otto_irq)) /* irq */ + MCFG_ES5506_READ_PORT_CB(READ16(esqkt_state, esq5506_read_adc)) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) + MCFG_SOUND_ADD("ensoniq2", ES5506, XTAL_16MHz) + MCFG_ES5506_REGION0("waverom") /* Bank 0 */ + MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ + MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ + MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ + MCFG_ES5506_CHANNELS(1) /* channels */ + MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( kt ) +INPUT_PORTS_END + +ROM_START( kt76 ) + ROM_REGION(0x80000, "osrom", 0) + ROM_LOAD32_WORD( "kt76_162_lo.bin", 0x000000, 0x020000, CRC(1a1ab910) SHA1(dcc80db2297fd25993e090c2e5bb7f947319a8bf) ) + ROM_LOAD32_WORD( "kt76_162_hi.bin", 0x000002, 0x040000, CRC(de16d236) SHA1(c55fca86453e90e8c34a048bed45817063237370) ) + + ROM_REGION(0x400000, "waverom", ROMREGION_ERASE00) + ROM_LOAD16_BYTE( "1351000401_rom0.u103", 0x000001, 0x200000, CRC(425047af) SHA1(9680d1fc222b29ba24f0fbf6136982bee87a60ef) ) + + ROM_REGION(0x400000, "waverom2", ROMREGION_ERASE00) + ROM_LOAD16_BYTE( "1351000402_rom1.u102", 0x000001, 0x200000, CRC(64459185) SHA1(0fa20b16847fc02a384057fc3d385226eb3e7527) ) + + ROM_REGION(0x400000, "waverom3", ROMREGION_ERASE00) + ROM_LOAD16_BYTE( "1351000403_rom2.u104", 0x000001, 0x200000, CRC(c2aacc5d) SHA1(7fab518ba92ddb23cdc4dcb04751b26d25c298c0) ) + + ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) +ROM_END + +DRIVER_INIT_MEMBER(esqkt_state, kt) +{ + m_duart_io = 0; +} + +CONS( 1996, kt76, 0, 0, kt, kt, esqkt_state, kt, "Ensoniq", "KT-76", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/esqmr.c b/src/mame/drivers/esqmr.c new file mode 100644 index 00000000000..058bd186251 --- /dev/null +++ b/src/mame/drivers/esqmr.c @@ -0,0 +1,319 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + esqmr.c - Ensoniq MR-61, MR-76, and MR-Rack + + Skeleton driver by R. Belmont + + Hardware: + CPU: 68340 MCU + Sound: 2xES5506 + Effects: ES5511 + + Memory map: + + 0x000000-0x0FFFFF OS ROM + + MR Rack + Ensoniq, 1995 + + This is a 64-voice expandable synth module made by Ensoniq in 1995. + It is shipped with 12MB of 16-bit 44.1kHz wave data and can be expanded + with up to 3 ENSONIQ EXP Series Wave Expansion Boards containing up to a + maximum of 84MB of additional wave data. + + + PCB Layout + ---------- + + PN: 4001028501 REV C + |--------------------------------------------------------| + | J6 J7 J12 J13 J21 J23 J22| + | J5| + | 4565 4565 HP_6N138 | + | | + | BATTERY 7407 | + | 4565 | + | | + | OTTOR2 OTTOR2 | + |AD1861 | + |AD1861 | + |AD1861 | + |AD1861 |--J3-----| | + | HC04 |EXPANSION| | + | |BOARD #3 | | + | | | | + | 1370001501 | | | + | | | | + | |--J8-----| | + | ESP2 ROM2 | + | |--J2-----| | + | |EXPANSION| | + | ROM0 |BOARD #2 | | + | | | | + | D43256 IDT7130 | | | + | D43256 35MHz 16MHz ROM1 | | | + | D43256 J14 |--J9-----| | + | D43256 22.5792MHz ADM691| + | D43256 MC68340 |--J1-----| | + | D43256 |EXPANSION| | + | 6MHz |BOARD #1 | | + | EPROM_UP | | | + | MC68HC705C4A KM681000 | | + |J4 EPROM_LO KM681000 |J11| + | J19 J18 |--J10----| | + |--------------------------------------------------------| + Notes: + J4/J18/J19 - Connectors to front panel buttons, LCD etc + J1/J10 - Connectors for expansion board #1 + J2/J9 - Connectors for expansion board #2 + J3/J8 - Connectors for expansion board #3 + J11 - Memory card connector + J14 - JTAG connector + J6 - Main left/mono jack + J7 - Main right jack + J12 - Aux left/mono jack + J13 - Aux right jack + J21 - MIDI in connector + J23 - MIDI out connector + J22 - MIDI thru connector + J5 - Power input connector + 1370001501 - Unknown TQFP144 IC stamped with the Ensoniq logo. Possibly CPLD? + ESP2 - Ensoniq ESP2 sound chip + OTTOR2 - Ensoniq OTTOR2 sound chip + ROM* - 4M x8-bit SOP44 mask ROM + D43256 - NEC D43256 32k x8-bit Static RAM + HP_6N138 - HP/Agilent HP 6N138 Low Input Current High Gain Optocoupler + 4565 - JRC4565 Dual Operational Amplifier + AD1861 - Analog Devices AD1861 16-bit/18-bit PCM Audio DAC + MC68HC705C4A - Motorola MC68HC705C4A Microcontroller. Clock input is tied to the TQFP CPLD + MC68340 - Motorola MC68340PV16E 68000-compatible 32-bit processor with on-board peripherals. Clock input 6.000MHz + EPROM* - 27C4001 EPROM + IDT7130 - IDT7130 High Speed 1k x8-bit Dual Port Static RAM + KM681000 - Samsung KM681000 128k x8-bit Static RAM + ADM691 - Analog Devices ADM691 Microprocessor Supervisory Circuit with Automatic Battery Backup Switching + + + Additional notes from the manual: + --------------------------------- + + The MR-Rack can play special demonstration songs to give you an idea of how terrific it sounds. + + To Play the MR-Rack Main Demo + 1. Press the Audition button, and hold it down. + 2. While still holding Audition, press the Save button. + 3. Let go of both buttons. + + In an unexpanded MR-Rack, the display shows: + + Hit ENTER to Play: + MAINDEMO:MR Internal + + If you've installed any Expansion boards or a ROM card containing MAINDEMO-type + demonstration songs, your display will differ. Turn the Value knob counter-clockwise + until the display looks as it does above. + + Note: When MR-Rack demos are being viewed or playing, MIDI In is disabled. + + 4. Press Enter to play the demo. + 5. Press Enter again to stop the demo. + 6. When you're done listening to the demo song, press Exit to return to normal MR-Rack + + + The Version Number of Your MR-Rack Operating System: + You can easily find out what operating system (or O.S.) your MR-Rack is currently using. + To Find the Operating System: + 1. Press the Save button and hold it down. + 2. While still holding the Save button, press the System button. + The display briefly shows your current Operating System: + + ENSONIQ MR-RACK + O.S. Version: #.## + + + + ENSONIQ EXP Series Wave Expansion Boards + ---------------------------------------- + + These are small plug-in boards containing a 256k x8-bit EPROM (27C020) and from 1 to 6 + SOP44 mask ROMs. These add additional digital sound waves. These can be used with the MR + Rack, the full-size MR Keyboards and a few other models. + + PCB Layout + ---------- + + PN: 4001033401 REV B + |------------------| + | | + | U6 U7 | + |- | + || | + || U1 | + || U2 -| + || || + || || + || U3 || + || || + || U8 || + || U4 || + || || + || || + || U5 || + |- -| + |------------------| + Notes: + U1 - AC138 logic chip + U2 to U7 - 4M x 8-bit or 2M x 8-bit SOP44 mask ROM + U8 - 27C020 EPROM + + The EXP boards dumped so far are.... + + MROM # of + Name Version Size MROMs + ----------------------------------- + Piano V1.00 4M 4 (multisampled pianos, aka "The Perfect Piano") + The Real World V1.01 4M 6 (non-Western percusson and other "world music" sounds) + Drum V1.00 2M 1 (additional drum kits that are built in to the MR keyboards) + + + Additional notes from the manual: + --------------------------------- + + The MR-Rack provides three displays which can identify any EXP Wave Expansion boards + you have installed. + + To Identify an Installed Expansion Board + 1. Press the System button. + 2. Turn the Parameter knob until the display shows: + + System parameters: + WaveEXP1:xxxxxxxxxxx + + When an Expansion Board is installed, this read-only display will show the name of the + Expansion Board located in the first slot. + + 3. Turning the Parameter knob two more times will reveal two more displays which show + the names of the Expansion Boards in Wave EXP Slots 2 and 3 (if they're installed). + If there are no Expansion Boards installed, the display will show "WaveEXP1= **EMPTY**." + +***************************************************************************/ + +#include "emu.h" +#include "machine/68340.h" +#include "sound/es5506.h" + +#include "machine/esqvfd.h" + +class esqmr_state : public driver_device +{ +public: + esqmr_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_sq1vfd(*this, "sq1vfd") + { } + + required_device m_maincpu; + required_device m_sq1vfd; + + virtual void machine_reset(); + +public: + DECLARE_DRIVER_INIT(mr); + DECLARE_WRITE_LINE_MEMBER(esq5506_otto_irq); + DECLARE_READ16_MEMBER(esq5506_read_adc); +}; + +void esqmr_state::machine_reset() +{ +} + +static ADDRESS_MAP_START( mr_map, AS_PROGRAM, 32, esqmr_state ) + AM_RANGE(0x00000000, 0x000fffff) AM_ROM AM_REGION("maincpu", 0) +// AM_RANGE(0x200000, 0x20003f) AM_DEVREADWRITE8("ensoniq", es5506_device, read, write, 0xffffffff) +// AM_RANGE(0x240000, 0x24003f) AM_DEVREADWRITE8("ensoniq2", es5506_device, read, write, 0xffffffff) +// AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") +ADDRESS_MAP_END + +WRITE_LINE_MEMBER(esqmr_state::esq5506_otto_irq) +{ +} + +READ16_MEMBER(esqmr_state::esq5506_read_adc) +{ + return 0; +} + +static MACHINE_CONFIG_START( mr, esqmr_state ) + MCFG_CPU_ADD("maincpu", M68340, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(mr_map) + + MCFG_ESQ2x40_SQ1_ADD("sq1vfd") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("ensoniq", ES5506, XTAL_16MHz) + MCFG_ES5506_REGION0("waverom") /* Bank 0 */ + MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ + MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ + MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ + MCFG_ES5506_CHANNELS(1) /* channels */ + MCFG_ES5506_IRQ_CB(WRITELINE(esqmr_state, esq5506_otto_irq)) /* irq */ + MCFG_ES5506_READ_PORT_CB(READ16(esqmr_state, esq5506_read_adc)) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) + MCFG_SOUND_ADD("ensoniq2", ES5506, XTAL_16MHz) + MCFG_ES5506_REGION0("waverom") /* Bank 0 */ + MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ + MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ + MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ + MCFG_ES5506_CHANNELS(1) /* channels */ + MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( mr ) +INPUT_PORTS_END + +ROM_START( mr61 ) + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD16_WORD_SWAP( "mrw-osf-11af-2.10.bin", 0x000000, 0x080000, CRC(5854314e) SHA1(8fb2e2ee2f5fb12eae8ea33cb18f757efaec6780) ) + ROM_LOAD16_WORD_SWAP( "mrw-romc-32ef-1.20.bin", 0x080000, 0x080000, CRC(68321347) SHA1(56cb96943ba42c35ba2787a49b5f4adf7c8dffb8) ) + + ROM_REGION(0x400000, "waverom", ROMREGION_ERASE00) + + ROM_REGION(0x400000, "waverom2", ROMREGION_ERASE00) + + ROM_REGION(0x400000, "waverom3", ROMREGION_ERASE00) + + ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) +ROM_END + +ROM_START( mrrack ) + // 68340 main MCU + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD16_BYTE( "mr_r_ec51_lo_1.50.u36", 0x000001, 0x080000, CRC(b29988a1) SHA1(986c2def11de27fa2b9be55ac32f7fec0c414bca) ) + ROM_LOAD16_BYTE( "mr_r_9dac_up_1.50.u35", 0x000000, 0x080000, CRC(71511692) SHA1(54744f16f1db1ac5abb2f70b6e04aebf1e0e029d) ) + + // 68705 display/front panel MCU + ROM_REGION(0x2000, "mcu", 0) + ROM_LOAD( "68hc705.u40", 0x000000, 0x002000, CRC(7b0291a7) SHA1(c92c19ce9289b7b21dbc915475cdff8930e3c677) ) + + ROM_REGION(0x400000, "waverom", ROMREGION_ERASE00) + ROM_LOAD( "1351000901_h-rom0.u5", 0x000000, 0x400000, CRC(89654b42) SHA1(4bdffd8060eb20cdb01f6178222aeb32fdbfd703) ) + + ROM_REGION(0x400000, "waverom2", ROMREGION_ERASE00) + ROM_LOAD( "1351000902_h-rom1.u23", 0x000000, 0x400000, CRC(4a19e517) SHA1(e819f1e0b50c4911c4855ad95ed505998a2bbe86) ) + + ROM_REGION(0x400000, "waverom3", ROMREGION_ERASE00) + ROM_LOAD( "1351000903_h-rom2.u24", 0x000000, 0x400000, CRC(c9ab1214) SHA1(92f48b068bbe49eacbffd03e428599e3ab21b8ec) ) + + ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) +ROM_END + +DRIVER_INIT_MEMBER(esqmr_state, mr) +{ +} + +CONS( 1996, mr61, 0, 0, mr, mr, esqmr_state, mr, "Ensoniq", "MR-61 Workstation", MACHINE_NOT_WORKING ) +CONS( 1996, mrrack, 0, 0, mr, mr, esqmr_state, mr, "Ensoniq", "MR-Rack", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/et3400.c b/src/mame/drivers/et3400.c new file mode 100644 index 00000000000..bf9806787c0 --- /dev/null +++ b/src/mame/drivers/et3400.c @@ -0,0 +1,123 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + ET-3400 + + 12/05/2009 Skeleton driver. + + + TODO: + - Proper artwork + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "et3400.lh" + + +class et3400_state : public driver_device +{ +public: + et3400_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + required_device m_maincpu; + DECLARE_READ8_MEMBER( et3400_keypad_r ); + DECLARE_WRITE8_MEMBER( et3400_display_w ); +}; + + + +READ8_MEMBER( et3400_state::et3400_keypad_r ) +{ + UINT8 data = 0xff; + + if (~offset & 4) + data &= ioport("X2")->read(); + if (~offset & 2) + data &= ioport("X1")->read(); + if (~offset & 1) + data &= ioport("X0")->read(); + + return data; +} + +WRITE8_MEMBER( et3400_state::et3400_display_w ) +{ +/* This computer sets each segment, one at a time. */ + + static const UINT8 segments[8]={0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x80}; + UINT8 digit = (offset >> 4) & 7; + UINT8 segment = segments[offset & 7]; + UINT8 segdata = output_get_digit_value(digit); + + if (data & 1) + segdata |= segment; + else + segdata &= ~segment; + + output_set_digit_value(digit, segdata); +} + + +static ADDRESS_MAP_START(et3400_mem, AS_PROGRAM, 8, et3400_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x01ff ) AM_RAM + AM_RANGE( 0xc000, 0xc0ff ) AM_READ(et3400_keypad_r) + AM_RANGE( 0xc100, 0xc1ff ) AM_WRITE(et3400_display_w) + AM_RANGE( 0xfc00, 0xffff ) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( et3400 ) + PORT_START("X0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D DO") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A AUTO") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 RTI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 INDEX") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 ACCA") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0xc0, 0xc0, IPT_UNUSED ) + + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E EXAM") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B BACK") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 SS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 CC") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 ACCB") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT( 0xc0, 0xc0, IPT_UNUSED ) + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F FWD") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C CHAN") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 BR") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 SP") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 PC") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0xe0, 0xe0, IPT_UNUSED ) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( et3400, et3400_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6800, XTAL_4MHz / 8 ) + MCFG_CPU_PROGRAM_MAP(et3400_mem) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_et3400) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( et3400 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "et3400.bin", 0xfc00, 0x0400, CRC(2eff1f58) SHA1(38b655de7393d7a92b08276f7c14a99eaa2a4a9f)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1976, et3400, 0, 0, et3400, et3400, driver_device, 0, "Heath Inc", "Heathkit ET-3400", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/eti660.c b/src/mame/drivers/eti660.c new file mode 100644 index 00000000000..80b490eff0f --- /dev/null +++ b/src/mame/drivers/eti660.c @@ -0,0 +1,244 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + TODO: + + - does not boot! + - reset key + - allocate color ram + - quickload + - color on + + - keyboard not working + - foreground is black, according to the construction article it should be white. + - it is supposed to reset itself at boot, but that isn't working. You must press R. + - Pressing F3 causes it to jump into the weeds. + +*/ + +#include "includes/eti660.h" + +/* Read/Write Handlers */ + +READ8_MEMBER( eti660_state::pia_r ) +{ + int pia_offset = m_maincpu->get_memory_address() & 0x03; + + return m_pia->read(space, pia_offset); +} + +WRITE8_MEMBER( eti660_state::pia_w ) +{ + int pia_offset = m_maincpu->get_memory_address() & 0x03; + + m_pia->write(space, pia_offset, data); +} + +WRITE8_MEMBER( eti660_state::colorram_w ) +{ + int colorram_offset = m_maincpu->get_memory_address() & 0xff; + + colorram_offset = ((colorram_offset & 0xf8) >> 1) || (colorram_offset & 0x03); + + m_color_ram[colorram_offset] = data; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( eti660_map, AS_PROGRAM, 8, eti660_state ) + ADDRESS_MAP_GLOBAL_MASK(0xfff) + AM_RANGE(0x0000, 0x03ff) AM_ROM + AM_RANGE(0x0400, 0x0fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( eti660_io_map, AS_IO, 8, eti660_state ) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispon_r, step_bgcolor_w) + AM_RANGE(0x02, 0x02) AM_READWRITE(pia_r, pia_w) + AM_RANGE(0x03, 0x03) AM_WRITE(colorram_w) + AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispoff_r, tone_latch_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( eti660 ) + PORT_START("PA0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("PA1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + + PORT_START("PA2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + + PORT_START("PA3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_R) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("STEP") PORT_CODE(KEYCODE_S) +INPUT_PORTS_END + +/* Video */ + +READ_LINE_MEMBER( eti660_state::rdata_r ) +{ + return BIT(m_color, 0); +} + +READ_LINE_MEMBER( eti660_state::bdata_r ) +{ + return BIT(m_color, 1); +} + +READ_LINE_MEMBER( eti660_state::gdata_r ) +{ + return BIT(m_color, 2); +} + +/* CDP1802 Interface */ + +READ_LINE_MEMBER( eti660_state::clear_r ) +{ + return BIT(m_special->read(), 0); +} + +READ_LINE_MEMBER( eti660_state::ef2_r ) +{ + return m_cassette->input() < 0; +} + +READ_LINE_MEMBER( eti660_state::ef4_r ) +{ + return BIT(m_special->read(), 1); +} + +WRITE_LINE_MEMBER( eti660_state::q_w ) +{ + /* CDP1864 audio output enable */ + m_cti->aoe_w(state); + + /* PULSE led */ + set_led_status(machine(), LED_PULSE, state); + + /* tape output */ + m_cassette->output(state ? 1.0 : -1.0); +} + +WRITE8_MEMBER( eti660_state::dma_w ) +{ + UINT8 colorram_offset = ((offset & 0xf8) >> 1) | (offset & 0x03); + + m_color = m_color_ram[colorram_offset]; + + m_cti->con_w(0); // HACK + m_cti->dma_w(space, offset, data); +} + +/* PIA6821 Interface */ + +READ8_MEMBER( eti660_state::pia_pa_r ) +{ + /* + + bit description + + PA0 keyboard row 0 + PA1 keyboard row 1 + PA2 keyboard row 2 + PA3 keyboard row 3 + PA4 keyboard column 0 + PA5 keyboard column 1 + PA6 keyboard column 2 + PA7 keyboard column 3 + + */ + + UINT8 data = 0xf0; + + if (!BIT(m_keylatch, 0)) data &= m_pa0->read(); + if (!BIT(m_keylatch, 1)) data &= m_pa1->read(); + if (!BIT(m_keylatch, 2)) data &= m_pa2->read(); + if (!BIT(m_keylatch, 3)) data &= m_pa3->read(); + + return data | m_keylatch; +} + +WRITE8_MEMBER( eti660_state::pia_pa_w ) +{ + /* + + bit description + + PA0 keyboard row 0 + PA1 keyboard row 1 + PA2 keyboard row 2 + PA3 keyboard row 3 + PA4 keyboard column 0 + PA5 keyboard column 1 + PA6 keyboard column 2 + PA7 keyboard column 3 + + */ + + m_keylatch = data & 0x0f; +} + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( eti660, eti660_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_8_867238MHz/5) + MCFG_CPU_PROGRAM_MAP(eti660_map) + MCFG_CPU_IO_MAP(eti660_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(eti660_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(eti660_state, ef2_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(eti660_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(eti660_state, q_w)) + MCFG_COSMAC_DMAW_CALLBACK(WRITE8(eti660_state, dma_w)) + + /* video hardware */ + MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_8_867238MHz/5) + MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_8_867238MHz/5, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(eti660_state, rdata_r), READLINE(eti660_state, bdata_r), READLINE(eti660_state, gdata_r)) + MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(4.7), RES_K(4.7)) // R7, R5, R6, R4 + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(MC6821_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(eti660_state, pia_pa_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(eti660_state, pia_pa_w)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("3K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( eti660 ) + ROM_REGION( 0x10000, CDP1802_TAG, 0 ) + ROM_LOAD( "eti660.bin", 0x0000, 0x0400, CRC(811dfa62) SHA1(c0c4951e02f873f15560bdc3f35cdf3f99653922) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, eti660, 0, 0, eti660, eti660, driver_device, 0, "Electronics Today International", "ETI-660", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/europc.c b/src/mame/drivers/europc.c new file mode 100644 index 00000000000..a034b1213b1 --- /dev/null +++ b/src/mame/drivers/europc.c @@ -0,0 +1,508 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "coreutil.h" +#include "includes/genpc.h" +#include "machine/nvram.h" +#include "machine/pckeybrd.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" + +class europc_pc_state : public driver_device +{ +public: + europc_pc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_mb(*this, "mb"), + m_keyboard(*this, "pc_keyboard"), + m_jim_state(0), + m_port61(0) + { } + + required_device m_maincpu; + required_device m_mb; + required_device m_keyboard; + isa8_aga_device *m_aga; + + DECLARE_WRITE8_MEMBER( europc_pio_w ); + DECLARE_READ8_MEMBER( europc_pio_r ); + + DECLARE_WRITE8_MEMBER ( europc_jim_w ); + DECLARE_READ8_MEMBER ( europc_jim_r ); + DECLARE_READ8_MEMBER ( europc_jim2_r ); + + DECLARE_READ8_MEMBER( europc_rtc_r ); + DECLARE_WRITE8_MEMBER( europc_rtc_w ); + + DECLARE_DRIVER_INIT(europc); + + void europc_rtc_set_time(); + + UINT8 m_jim_data[16]; + UINT8 m_jim_state; + AGA_MODE m_jim_mode; + int m_port61; // bit 0,1 must be 0 for startup; reset? + UINT8 m_rtc_data[0x10]; + int m_rtc_reg; + int m_rtc_state; + + void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + emu_timer* m_rtc_timer; + + enum + { + TIMER_RTC + }; +}; + +/* + europc + fe107 bios checksum test + memory test + fe145 + irq vector init + fe156 + fe169 fd774 // test of special europc registers 254 354 + fe16c fe817 + fe16f + fec08 // test of special europc registers 800a rtc time or date error, rtc corrected + fef66 0xf + fdb3e 0x8..0xc + fd7f8 + fdb5f + fe172 + fecc5 // 801a video setup error + fd6c9 + copyright output + fe1b7 + fe1be di bits set mean output text!!!, + (801a) + 0x8000 output + 1 rtc error + 2 rtc time or date error + 4 checksum error in setup + 8 rtc status corrected + 10 video setup error + 20 video ram bad + 40 monitor type not recogniced + 80 mouse port enabled + 100 joystick port enabled + + fe1e2 fdc0c cpu speed is 4.77 MHz + fe1e5 ff9c0 keyboard processor error + fe1eb fc617 external lpt1 at 0x3bc + fe1ee fe8ee external coms at + + routines: + fc92d output text at bp + fdb3e rtc read reg cl + fe8ee piep + fe95e rtc write reg cl + polls until jim 0xa is zero, + output cl at jim 0xa + write ah hinibble as lownibble into jim 0xa + write ah lownibble into jim 0xa + fef66 rtc read reg cl + polls until jim 0xa is zero, + output cl at jim 0xa + read low 4 nibble at jim 0xa + read low 4 nibble at jim 0xa + return first nibble<<4|second nibble in ah + ff046 seldom compares ret + ffe87 0 -> ds + + 469: + bit 0: b0000 memory available + bit 1: b8000 memory available + 46a: 00 jim 250 01 jim 350 + */ + + +/* + 250..253 write only 00 be 00 10 + + 252 write 0 b0000 memory activ + 252 write 0x10 b8000 memory activ + + jim 04: 0:4.77 0x40:7.16 + pio 63: 11,19 4.77 51,59 7.16 + + 63 bit 6,7 clock select + 254 bit 6,7 clock select + 250 bit 0: mouse on + bit 1: joystick on + 254..257 r/w memory ? JIM asic? ram behaviour + +*/ + +WRITE8_MEMBER( europc_pc_state::europc_jim_w ) +{ + switch (offset) + { + case 2: + if (!(data & 0x80)) + { + switch (data) + { + case 0x1f: + case 0x0b: m_jim_mode = AGA_MONO; break; + case 0xe: //80 columns? + case 0xd: //40 columns? + case 0x18: + case 0x1a: m_jim_mode = AGA_COLOR; break; + default: m_jim_mode = AGA_OFF; break; + } + } +// mode= data&0x10?AGA_COLOR:AGA_MONO; +// mode= data&0x10?AGA_COLOR:AGA_OFF; + if (data & 0x80) m_jim_state = 0; + break; + case 4: + switch(data & 0xc0) + { + case 0x00: m_maincpu->set_clock_scale(1.0 / 2); break; + case 0x40: m_maincpu->set_clock_scale(3.0 / 4); break; + default: m_maincpu->set_clock_scale(1); break; + } + break; + case 0xa: + europc_rtc_w(space, 0, data); + return; + } + logerror("jim write %.2x %.2x\n", offset, data); + m_jim_data[offset] = data; +} + +READ8_MEMBER( europc_pc_state::europc_jim_r ) +{ + int data = 0; + switch(offset) + { + case 4: case 5: case 6: case 7: data = m_jim_data[offset]; break; + case 0: case 1: case 2: case 3: data = 0; break; + case 0xa: return europc_rtc_r(space, 0); + } + return data; +} + +READ8_MEMBER( europc_pc_state::europc_jim2_r ) +{ + switch (m_jim_state) + { + case 0: m_jim_state++; return 0; + case 1: m_jim_state++; return 0x80; + case 2: + m_jim_state = 0; + switch (m_jim_mode) + { + case AGA_COLOR: return 0x87; // for color; + case AGA_MONO: return 0x90; //for mono + case AGA_OFF: return 0x80; // for vram +// return 0x97; //for error + } + } + return 0; +} + +/* realtime clock and nvram EM M3002 + + reg 0: seconds + reg 1: minutes + reg 2: hours + reg 3: day 1 based + reg 4: month 1 based + reg 5: year bcd (no century, values bigger 88? are handled as 1900, else 2000) + reg 6: + reg 7: + reg 8: + reg 9: + reg a: + reg b: 0x10 written + bit 0,1: 0 video startup mode: 0=specialadapter, 1=color40, 2=color80, 3=monochrom + bit 2: internal video on + bit 4: color + bit 6,7: clock + reg c: + bit 0,1: language/country + reg d: xor checksum + reg e: + reg 0f: 01 status ok, when not 01 written +*/ + +void europc_pc_state::europc_rtc_set_time() +{ + system_time systime; + + /* get the current date/time from the core */ + machine().current_datetime(systime); + + m_rtc_data[0] = dec_2_bcd(systime.utc_time.second); + m_rtc_data[1] = dec_2_bcd(systime.utc_time.minute); + m_rtc_data[2] = dec_2_bcd(systime.utc_time.hour); + + m_rtc_data[3] = dec_2_bcd(systime.utc_time.mday); + m_rtc_data[4] = dec_2_bcd(systime.utc_time.month + 1); + m_rtc_data[5] = dec_2_bcd(systime.utc_time.year % 100); +} + +void europc_pc_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + int month, year; + + switch(id) + { + case TIMER_RTC: + m_rtc_data[0]=bcd_adjust(m_rtc_data[0]+1); + if (m_rtc_data[0]>=0x60) + { + m_rtc_data[0]=0; + m_rtc_data[1]=bcd_adjust(m_rtc_data[1]+1); + if (m_rtc_data[1]>=0x60) + { + m_rtc_data[1]=0; + m_rtc_data[2]=bcd_adjust(m_rtc_data[2]+1); + if (m_rtc_data[2]>=0x24) + { + m_rtc_data[2]=0; + m_rtc_data[3]=bcd_adjust(m_rtc_data[3]+1); + month=bcd_2_dec(m_rtc_data[4]); + year=bcd_2_dec(m_rtc_data[5])+2000; // save for julian_days_in_month_calculation + if (m_rtc_data[3]> gregorian_days_in_month(month, year)) + { + m_rtc_data[3]=1; + m_rtc_data[4]=bcd_adjust(m_rtc_data[4]+1); + if (m_rtc_data[4]>0x12) + { + m_rtc_data[4]=1; + m_rtc_data[5]=bcd_adjust(m_rtc_data[5]+1)&0xff; + } + } + } + } + } + break; + } +} + +READ8_MEMBER( europc_pc_state::europc_rtc_r ) +{ + int data=0; + switch (m_rtc_state) + { + case 1: + data=(m_rtc_data[m_rtc_reg]&0xf0)>>4; + m_rtc_state++; + break; + case 2: + data=m_rtc_data[m_rtc_reg]&0xf; + m_rtc_state=0; +// logerror("rtc read %x %.2x\n",m_rtc_reg, m_rtc_data[m_rtc_reg]); + break; + } + return data; +} + +WRITE8_MEMBER( europc_pc_state::europc_rtc_w ) +{ + switch (m_rtc_state) + { + case 0: + m_rtc_reg=data; + m_rtc_state=1; + break; + case 1: + m_rtc_data[m_rtc_reg]=(m_rtc_data[m_rtc_reg]&~0xf0)|((data&0xf)<<4); + m_rtc_state++; + break; + case 2: + m_rtc_data[m_rtc_reg]=(m_rtc_data[m_rtc_reg]&~0xf)|(data&0xf); + m_rtc_state=0; +// logerror("rtc written %x %.2x\n",m_rtc_reg, m_rtc_data[m_rtc_reg]); + break; + } +} + +DRIVER_INIT_MEMBER(europc_pc_state,europc) +{ + UINT8 *rom = &memregion("maincpu")->base()[0]; + + int i; + /* + fix century rom bios bug ! + if year <79 month (and not CENTURY) is loaded with 0x20 + */ + if (rom[0xff93e]==0xb6){ // mov dh, + UINT8 a; + rom[0xff93e]=0xb5; // mov ch, + for (i=0xf8000, a=0; i<0xfffff; i++ ) a+=rom[i]; + rom[0xfffff]=256-a; + } + + memset(&m_rtc_data,0,sizeof(m_rtc_data)); + m_rtc_reg = 0; + m_rtc_state = 0; + m_rtc_data[0xf]=1; + + m_rtc_timer = timer_alloc(); + m_rtc_timer->adjust(attotime::zero, 0, attotime(1,0)); + // europc_rtc_set_time(); + + machine().device("nvram")->set_base(m_rtc_data, sizeof(m_rtc_data)); + m_aga = machine().device("aga:aga"); + +} + +WRITE8_MEMBER( europc_pc_state::europc_pio_w ) +{ + switch (offset) + { + case 1: + m_port61=data; + m_mb->m_pit8253->write_gate2(BIT(data, 0)); + m_mb->pc_speaker_set_spkrdata(BIT(data, 1)); + m_keyboard->enable(BIT(data, 6)); + if(data & 0x80) + m_mb->m_pic8259->ir1_w(0); + break; + } + + logerror("europc pio write %.2x %.2x\n", offset, data); +} + + +READ8_MEMBER( europc_pc_state::europc_pio_r ) +{ + int data = 0; + switch (offset) + { + case 0: + data = m_keyboard->read(space, 0); + break; + case 1: + data = m_port61; + break; + case 2: + if (m_mb->m_pit_out2) + data |= 0x20; + break; + } + return data; +} + +/* +layout of an uk europc + +ESC, [SPACE], F1,F2,F3,F4,[SPACE],F5,F6,F7,F8,[SPACE],F9,F0,F11,F12 +[SPACE] +\|, 1,2,3,4,5,6,7,8,9,0 -,+, BACKSPACE,[SPACE], NUM LOCK, SCROLL LOCK, PRINT SCREEN, KEYPAD - +TAB,Q,W,E,R,T,Y,U,I,O,P,[,], RETURN, [SPACE], KEYPAD 7, KEYPAD 8, KEYPAD 9, KEYPAD + +CTRL, A,S,D,F,G,H,J,K,L,;,@,~, RETURN, [SPACE],KEYPAD 4,KEYPAD 5,KEYPAD 6, KEYPAD + +LEFT SHIFT, Z,X,C,V,B,N,M,<,>,?,RIGHT SHIFT,[SPACE],KEYPAD 1, KEYPAD 2, KEYPAD 3, KEYPAD ENTER +ALT,[SPACE], SPACE BAR,[SPACE],CAPS LOCK,[SPACE], KEYPAD 0, KEYPAD ., KEYPAD ENTER + +\ and ~ had to be swapped +i am not sure if keypad enter delivers the mf2 keycode + */ + +static INPUT_PORTS_START( europc ) + PORT_START("DSW0") /* IN1 */ + + PORT_START("DSW1") /* IN2 */ + PORT_DIPNAME( 0x80, 0x80, "COM1: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x40, 0x40, "COM2: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x20, 0x00, "COM3: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x10, 0x00, "COM4: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x00, "LPT2: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x02, 0x00, "LPT3: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x01, 0x00, "Game port enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) + + PORT_START("DSW2") /* IN3 */ + PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) + PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ + PORT_BIT( 0x01, 0x01, IPT_UNUSED ) + + PORT_INCLUDE(pc_keyboard) + PORT_MODIFY("pc_keyboard_2") /* IN6 */ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_BACKSLASH) /* ` 29 A9 */ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_TILDE) /* \ 2B AB */ + + PORT_MODIFY("pc_keyboard_5") /* IN9 */ + PORT_BIT ( 0x0070, 0x0000, IPT_UNUSED ) + /* 0x40 non us backslash 2 not available */ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) /* F11 57 D7 */ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) /* F12 58 D8 */ + + PORT_START("pc_keyboard_6") /* IN10 */\ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* PAD Enter 60 e0 */ + PORT_BIT(0xfffe, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static ADDRESS_MAP_START( europc_map, AS_PROGRAM, 8, europc_pc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xaffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_NOP + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(europc_io, AS_IO, 8, europc_pc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0060, 0x0063) AM_READWRITE(europc_pio_r, europc_pio_w) + AM_RANGE(0x0250, 0x025f) AM_READWRITE(europc_jim_r, europc_jim_w) + AM_RANGE(0x02e0, 0x02e0) AM_READ(europc_jim2_r) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( europc, europc_pc_state ) + MCFG_CPU_ADD("maincpu", I8088, 4772720*2) + MCFG_CPU_PROGRAM_MAP(europc_map) + MCFG_CPU_IO_MAP(europc_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "aga", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "lpt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "com", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "fdc_xt", false) + + MCFG_PC_KEYB_ADD("pc_keyboard", DEVWRITELINE("mb:pic8259", pic8259_device, ir1_w)) + + MCFG_NVRAM_ADD_0FILL("nvram"); + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + +ROM_START( europc ) + ROM_REGION(0x100000,"maincpu", 0) + // hdd bios integrated! + ROM_LOAD("50145", 0xf8000, 0x8000, CRC(1775a11d) SHA1(54430d4d0462860860397487c9c109e6f70db8e3)) // V2.07 +ROM_END + +COMP( 1988, europc, ibm5150, 0, europc, europc, europc_pc_state, europc, "Schneider Rdf. AG", "EURO PC", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/evmbug.c b/src/mame/drivers/evmbug.c new file mode 100644 index 00000000000..355eaca0769 --- /dev/null +++ b/src/mame/drivers/evmbug.c @@ -0,0 +1,117 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Stuart's Breadboard Project. TMS9995 evaluation kit TMAM6095. + + 2013-06-02 Skeleton driver. + + http://www.avjd51.dsl.pipex.com/tms9995_eval_module/tms9995_eval_module.htm + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/tms9900/tms9995.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class evmbug_state : public driver_device +{ +public: + evmbug_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_READ8_MEMBER(rs232_r); + DECLARE_WRITE8_MEMBER(rs232_w); + DECLARE_WRITE8_MEMBER(kbd_put); + virtual void machine_reset(); + UINT8 m_term_data; + UINT8 m_term_out; + required_device m_maincpu; + required_device m_terminal; +}; + +static ADDRESS_MAP_START( evmbug_mem, AS_PROGRAM, 8, evmbug_state ) + AM_RANGE(0x0000, 0x17ff) AM_ROM + AM_RANGE(0xec00, 0xefff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( evmbug_io, AS_IO, 8, evmbug_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0007) AM_WRITE(rs232_w) + AM_RANGE(0x0000, 0x0002) AM_READ(rs232_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( evmbug ) +INPUT_PORTS_END + +READ8_MEMBER( evmbug_state::rs232_r ) +{ + static UINT8 temp = 0; + temp^=0xff; + if (offset == 1) + return temp; + + if (offset == 2) + { + return 0xff;//(m_term_data) ? 0 : 0xff; + } + + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( evmbug_state::rs232_w ) +{ + if (offset == 0) + m_term_out = 0; + + m_term_out |= (data << offset); + + if (offset == 7) + m_terminal->write(space, 0, m_term_out & 0x7f); +} + +WRITE8_MEMBER( evmbug_state::kbd_put ) +{ + m_term_data = data; +} + +void evmbug_state::machine_reset() +{ + m_term_data = 0; + // Disable auto wait state generation by raising the READY line on reset + static_cast(machine().device("maincpu"))->set_ready(ASSERT_LINE); +} + +static MACHINE_CONFIG_START( evmbug, evmbug_state ) + // basic machine hardware + // TMS9995 CPU @ 12.0 MHz + // We have no lines connected yet + MCFG_TMS99xx_ADD("maincpu", TMS9995, 12000000, evmbug_mem, evmbug_io ) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(evmbug_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( evmbug ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) +// ROM_LOAD( "u8.bin", 0x0000, 0x1000, CRC(bdb8c7bd) SHA1(340829dcb7a65f2e830fd5aff82a312e3ed7918f) ) +// ROM_LOAD( "u9.bin", 0x1000, 0x0800, CRC(4de459ea) SHA1(00a42fe556d4ffe1f85b2ce369f544b07fbd06d9) ) + ROM_LOAD( "evmbug.bin", 0x0000, 0x8000, CRC(a239ec56) SHA1(65b500d7d0f897ce0c320cf3ec32ff4042774599) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, evmbug, 0, 0, evmbug, evmbug, driver_device, 0, "Texas Instruments", "TMAM6095", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/excali64.c b/src/mame/drivers/excali64.c new file mode 100644 index 00000000000..3e4664ca913 --- /dev/null +++ b/src/mame/drivers/excali64.c @@ -0,0 +1,647 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Excalibur 64 kit computer, designed and sold in Australia by BGR Computers. +The official schematics have a LOT of errors and omissions. + +Skeleton driver created on 2014-12-09. + +Chips: Z80A, 8251, 8253, 8255, 6845 +We have Basic 1.1. Other known versions are 1.01, 2.1 +There are 2 versions of the colour prom, which have different palettes. +We have the later version. + +Notes: +- Control W then Enter will switch between 40 and 80 characters per line. +- Control V turns cursor on +- Graphics commands such as LINE, CIRCLE, HGRCLS, HGRSET etc only work with disk basic + +ToDo: +- Colours are approximate. +- Hardware supports 20cm and 13cm floppies, but we only support 13cm as this + is the only software that exists. +- The schematic shows the audio counter connected to 2MHz, but this produces + sounds that are too high. Connected to 1MHz for now. +- Serial +- Pasting can sometimes drop a character. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "machine/i8251.h" +#include "bus/rs232/rs232.h" +//#include "machine/clock.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "sound/speaker.h" +#include "machine/z80dma.h" +#include "machine/rescap.h" +#include "machine/74123.h" +#include "machine/wd_fdc.h" +#include "formats/excali64_dsk.h" + +class excali64_state : public driver_device +{ +public: + excali64_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_cass(*this, "cassette") + , m_crtc(*this, "crtc") + , m_io_keyboard(*this, "KEY") + , m_dma(*this, "dma") + , m_u12(*this, "u12") + , m_centronics(*this, "centronics") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + { } + + DECLARE_PALETTE_INIT(excali64); + DECLARE_WRITE8_MEMBER(ppib_w); + DECLARE_READ8_MEMBER(ppic_r); + DECLARE_WRITE8_MEMBER(ppic_w); + DECLARE_READ8_MEMBER(port00_r); + DECLARE_READ8_MEMBER(port50_r); + DECLARE_WRITE8_MEMBER(port70_w); + DECLARE_WRITE8_MEMBER(porte4_w); + DECLARE_READ8_MEMBER(porte8_r); + DECLARE_WRITE8_MEMBER(portec_w); + DECLARE_FLOPPY_FORMATS(floppy_formats); + DECLARE_WRITE_LINE_MEMBER(cent_busy_w); + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + MC6845_UPDATE_ROW(update_row); + DECLARE_WRITE_LINE_MEMBER(crtc_hs); + DECLARE_WRITE_LINE_MEMBER(crtc_vs); + DECLARE_WRITE8_MEMBER(motor_w); + DECLARE_MACHINE_RESET(excali64); + required_device m_palette; + +private: + const UINT8 *m_p_chargen; + UINT8 *m_p_videoram; + UINT8 *m_p_hiresram; + UINT8 m_sys_status; + UINT8 m_kbdrow; + bool m_crtc_vs; + bool m_crtc_hs; + bool m_motor; + bool m_centronics_busy; + required_device m_maincpu; + required_device m_cass; + required_device m_crtc; + required_ioport_array<8> m_io_keyboard; + required_device m_dma; + required_device m_u12; + required_device m_centronics; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; +}; + +static ADDRESS_MAP_START(excali64_mem, AS_PROGRAM, 8, excali64_state) + AM_RANGE(0x0000, 0x1FFF) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") + AM_RANGE(0x2000, 0x2FFF) AM_READ_BANK("bankr2") AM_WRITE_BANK("bankw2") + AM_RANGE(0x3000, 0x3FFF) AM_READ_BANK("bankr3") AM_WRITE_BANK("bankw3") + AM_RANGE(0x4000, 0xBFFF) AM_READ_BANK("bankr4") AM_WRITE_BANK("bankw4") + AM_RANGE(0xC000, 0xFFFF) AM_RAM AM_REGION("rambank", 0xC000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(excali64_io, AS_IO, 8, excali64_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x0f) AM_READ(port00_r) + AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) + AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x20, 0x23) AM_MIRROR(0x0c) AM_DEVREADWRITE("pit", pit8253_device, read, write) + AM_RANGE(0x30, 0x30) AM_MIRROR(0x0e) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0x31, 0x31) AM_MIRROR(0x0e) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0x50, 0x5f) AM_READ(port50_r) + AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREADWRITE("ppi", i8255_device, read, write) + AM_RANGE(0x70, 0x7f) AM_WRITE(port70_w) + AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("dma", z80dma_device, read, write) + AM_RANGE(0xe4, 0xe7) AM_WRITE(porte4_w) + AM_RANGE(0xe8, 0xeb) AM_READ(porte8_r) + AM_RANGE(0xec, 0xef) AM_WRITE(portec_w) + AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("fdc", wd2793_t, read, write) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( excali64 ) + PORT_START("KEY.0") /* line 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) + + PORT_START("KEY.1") /* line 1 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // space + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // F1 + + PORT_START("KEY.2") /* line 2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) //B + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) //N + + PORT_START("KEY.3") /* line 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x27) PORT_CHAR(0x22) PORT_CHAR(0x27) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) + + PORT_START("KEY.4") /* line 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x7f) PORT_CHAR(0x1f) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + + PORT_START("KEY.5") /* line 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) + + PORT_START("KEY.6") /* line 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) //Z + + PORT_START("KEY.7") /* line 7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('=') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') +INPUT_PORTS_END + +WRITE_LINE_MEMBER( excali64_state::cent_busy_w ) +{ + m_centronics_busy = state; +} + +FLOPPY_FORMATS_MEMBER( excali64_state::floppy_formats ) + FLOPPY_EXCALI64_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( excali64_floppies ) + SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) + SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +// pulses from port E4 bit 5 restart the 74123. After 3.6 secs without a pulse, the motor gets turned off. +WRITE8_MEMBER( excali64_state::motor_w ) +{ + m_motor = BIT(data, 0); + m_floppy1->get_device()->mon_w(!m_motor); + m_floppy0->get_device()->mon_w(!m_motor); +} + +READ8_MEMBER( excali64_state::porte8_r ) +{ + return 0xfc | (UINT8)m_motor; +} + +WRITE8_MEMBER( excali64_state::porte4_w ) +{ + floppy_image_device *floppy = NULL; + if (BIT(data, 0)) + floppy = m_floppy0->get_device(); + + if (BIT(data, 1)) + floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + if (floppy) + floppy->ss_w(BIT(data, 4)); + + m_u12->b_w(space,offset, BIT(data, 5)); // motor pulse +} + +/* +d0 = precomp (selectable by jumper) +d1 = size select (we only support 13cm) +d2 = density select (0 = double) +*/ +WRITE8_MEMBER( excali64_state::portec_w ) +{ + m_fdc->dden_w(BIT(data, 2)); +} + +WRITE_LINE_MEMBER( excali64_state::busreq_w ) +{ +// since our Z80 has no support for BUSACK, we assume it is granted immediately + m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); + m_dma->bai_w(state); // tell dma that bus has been granted +} + +READ8_MEMBER( excali64_state::memory_read_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER( excali64_state::memory_write_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset, data); +} + +READ8_MEMBER( excali64_state::io_read_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER( excali64_state::io_write_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + prog_space.write_byte(offset, data); +} + +WRITE8_MEMBER( excali64_state::ppib_w ) +{ + m_kbdrow = data; +} + +READ8_MEMBER( excali64_state::ppic_r ) +{ + UINT8 data = 0xf4; // READY line must be low to print + data |= (UINT8)m_centronics_busy; + data |= (m_cass->input() > 0.1) << 3; + return data; +} + +WRITE8_MEMBER( excali64_state::ppic_w ) +{ + m_cass->output(BIT(data, 7) ? -1.0 : +1.0); + m_centronics->write_strobe(BIT(data, 4)); +} + +READ8_MEMBER( excali64_state::port00_r ) +{ + UINT8 data = 0xff; + + for (int i = 0; i < 8; i++) + { + if (!BIT(m_kbdrow, i)) + data &= m_io_keyboard[i]->read(); + } + + return data; +} + +/* +d0 : /rom ; screen +d1 : ram on +d2 : /low ; high res +d3 : 2nd colour set (previously, dispen, which is a mistake in hardware and schematic) +d4 : vsync +d5 : rombank +*/ +READ8_MEMBER( excali64_state::port50_r ) +{ + UINT8 data = m_sys_status & 0x2f; + bool csync = m_crtc_hs | m_crtc_vs; + data |= (UINT8)csync << 4; + return data; +} + +/* +d0,1,2,3,5 : same as port50 +(schematic wrongly says d7 used for 2nd colour set) +*/ +WRITE8_MEMBER( excali64_state::port70_w ) +{ + m_sys_status = data; + m_crtc->set_unscaled_clock(BIT(data, 2) ? 2e6 : 1e6); + if BIT(data, 1) + { + // select 64k ram + membank("bankr1")->set_entry(0); + membank("bankr2")->set_entry(0); + membank("bankr3")->set_entry(0); + membank("bankr4")->set_entry(0); + membank("bankw2")->set_entry(0); + membank("bankw3")->set_entry(0); + membank("bankw4")->set_entry(0); + } + else + if BIT(data, 0) + { + // select videoram and hiresram + membank("bankr1")->set_entry(1); + membank("bankr2")->set_entry(2); + membank("bankr3")->set_entry(2); + membank("bankw2")->set_entry(2); + membank("bankw3")->set_entry(2); + membank("bankr4")->set_entry(2); + membank("bankw4")->set_entry(2); + } + else + { + // select rom, videoram, and main ram + membank("bankr1")->set_entry(1); + membank("bankr2")->set_entry(1); + membank("bankr3")->set_entry(1); + membank("bankw2")->set_entry(2); + membank("bankw3")->set_entry(2); + membank("bankr4")->set_entry(0); + membank("bankw4")->set_entry(0); + } + + // other half of ROM_1 + if ((data & 0x22) == 0x20) + membank("bankr1")->set_entry(2); +} + +MACHINE_RESET_MEMBER( excali64_state, excali64 ) +{ + membank("bankr1")->set_entry(1); // read from ROM + membank("bankr2")->set_entry(1); // read from ROM + membank("bankr3")->set_entry(1); // read from ROM + membank("bankr4")->set_entry(0); // read from RAM + membank("bankw1")->set_entry(0); // write to RAM + membank("bankw2")->set_entry(2); // write to videoram + membank("bankw3")->set_entry(2); // write to videoram hires pointers + membank("bankw4")->set_entry(0); // write to RAM + m_maincpu->reset(); +} + +WRITE_LINE_MEMBER( excali64_state::crtc_hs ) +{ + m_crtc_hs = state; +} + +WRITE_LINE_MEMBER( excali64_state::crtc_vs ) +{ + m_crtc_vs = state; +} + +/* F4 Character Displayer */ +static const gfx_layout excali64_charlayout = +{ + 8, 12, /* 8 x 12 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( excali64 ) + GFXDECODE_ENTRY( "chargen", 0x0000, excali64_charlayout, 0, 1 ) +GFXDECODE_END + +// The prom, the schematic, and the manual all contradict each other, +// so the colours can only be described as wild guesses. Further, the 38 +// colour-load resistors are missing labels and values. +PALETTE_INIT_MEMBER( excali64_state, excali64 ) +{ + // do this here because driver_init hasn't run yet + m_p_videoram = memregion("videoram")->base(); + m_p_chargen = memregion("chargen")->base(); + m_p_hiresram = m_p_videoram + 0x2000; + UINT8 *main = memregion("roms")->base(); + UINT8 *ram = memregion("rambank")->base(); + + // main ram (cp/m mode) + membank("bankr1")->configure_entry(0, &ram[0x0000]); + membank("bankr2")->configure_entry(0, &ram[0x2000]); + membank("bankr3")->configure_entry(0, &ram[0x3000]); + membank("bankr4")->configure_entry(0, &ram[0x4000]);//boot + membank("bankw1")->configure_entry(0, &ram[0x0000]);//boot + membank("bankw2")->configure_entry(0, &ram[0x2000]); + membank("bankw3")->configure_entry(0, &ram[0x3000]); + membank("bankw4")->configure_entry(0, &ram[0x4000]);//boot + // rom_1 + membank("bankr1")->configure_entry(1, &main[0x0000]);//boot + membank("bankr1")->configure_entry(2, &main[0x2000]); + // rom_2 + membank("bankr2")->configure_entry(1, &main[0x4000]);//boot + membank("bankr3")->configure_entry(1, &main[0x5000]);//boot + // videoram + membank("bankr2")->configure_entry(2, &m_p_videoram[0x0000]); + membank("bankw2")->configure_entry(2, &m_p_videoram[0x0000]);//boot + // hiresram + membank("bankr3")->configure_entry(2, &m_p_videoram[0x1000]); + membank("bankw3")->configure_entry(2, &m_p_videoram[0x1000]);//boot + membank("bankr4")->configure_entry(2, &m_p_hiresram[0x0000]); + membank("bankw4")->configure_entry(2, &m_p_hiresram[0x0000]); + + // Set up foreground colours + UINT8 r,g,b,i,code; + for (i = 0; i < 32; i++) + { + code = m_p_chargen[0x1000+i]; + r = (BIT(code, 0) ? 38 : 0) + (BIT(code, 1) ? 73 : 0) + (BIT(code, 2) ? 144 : 0); + b = (BIT(code, 3) ? 38 : 0) + (BIT(code, 4) ? 73 : 0) + (BIT(code, 5) ? 144 : 0); + g = (BIT(code, 6) ? 85 : 0) + (BIT(code, 7) ? 170 : 0); + palette.set_pen_color(i, r, g, b); + } + + // Background + palette.set_pen_color(32, 0x00, 0x00, 0x00); // 0 Black + palette.set_pen_color(33, 0xff, 0x00, 0x00); // 1 Red + palette.set_pen_color(34, 0x00, 0x00, 0xff); // 2 Blue + palette.set_pen_color(35, 0xff, 0x00, 0xff); // 3 Magenta + palette.set_pen_color(36, 0x00, 0xff, 0x00); // 4 Green + palette.set_pen_color(37, 0xff, 0xff, 0x00); // 5 Yellow + palette.set_pen_color(38, 0x00, 0xff, 0xff); // 6 Cyan + palette.set_pen_color(39, 0xff, 0xff, 0xff); // 7 White +} + +MC6845_UPDATE_ROW( excali64_state::update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,col,bg,fg; + UINT16 mem,x; + UINT8 col_base = BIT(m_sys_status, 3) ? 16 : 0; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + col = m_p_videoram[mem+0x800]; + fg = col_base + (col >> 4); + bg = 32 + ((col >> 1) & 7); + + if BIT(col, 0) + { + UINT8 h = m_p_videoram[mem+0x1000] - 4; + if (h > 5) + h = 0; // keep us in bounds + // hires definition - pixels are opposite order to characters + gfx = BITSWAP8(m_p_hiresram[(h << 12) | (chr<<4) | ra], 0, 1, 2, 3, 4, 5, 6, 7); + } + else + gfx = m_p_chargen[(chr<<4) | ra]; // normal character + + gfx ^= (x == cursor_x) ? 0xff : 0; + + /* Display a scanline of a character */ + *p++ = palette[BIT(gfx, 0) ? fg : bg]; + *p++ = palette[BIT(gfx, 1) ? fg : bg]; + *p++ = palette[BIT(gfx, 2) ? fg : bg]; + *p++ = palette[BIT(gfx, 3) ? fg : bg]; + *p++ = palette[BIT(gfx, 4) ? fg : bg]; + *p++ = palette[BIT(gfx, 5) ? fg : bg]; + *p++ = palette[BIT(gfx, 6) ? fg : bg]; + *p++ = palette[BIT(gfx, 7) ? fg : bg]; + } +} + +static MACHINE_CONFIG_START( excali64, excali64_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(excali64_mem) + MCFG_CPU_IO_MAP(excali64_io) + + MCFG_MACHINE_RESET_OVERRIDE(excali64_state, excali64) + + MCFG_DEVICE_ADD("uart", I8251, 0) + //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_16MHz / 16) /* Timer 0: tone gen for speaker */ + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) + //MCFG_PIT8253_CLK1(XTAL_16MHz / 16) /* Timer 1: baud rate gen for 8251 */ + //MCFG_PIT8253_OUT1_HANDLER(WRITELINE(excali64_state, write_uart_clock)) + //MCFG_PIT8253_CLK2(XTAL_16MHz / 16) /* Timer 2: not used */ + + MCFG_DEVICE_ADD("ppi", I8255A, 0 ) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) // parallel port + MCFG_I8255_OUT_PORTB_CB(WRITE8(excali64_state, ppib_w)) + MCFG_I8255_IN_PORTC_CB(READ8(excali64_state, ppic_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(excali64_state, ppic_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(80*8, 24*12) + MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*12-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_PALETTE_ADD("palette", 40) + MCFG_PALETTE_INIT_OWNER(excali64_state, excali64) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", excali64) + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_16MHz / 16) // 1MHz for lowres; 2MHz for highres + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(excali64_state, update_row) + MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(excali64_state, crtc_hs)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(excali64_state, crtc_vs)) + + /* Devices */ + MCFG_CASSETTE_ADD( "cassette" ) + + MCFG_WD2793_ADD("fdc", XTAL_16MHz / 16) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "drive0", excali64_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "drive1", excali64_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_16MHz/4) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(excali64_state, busreq_w)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(excali64_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(excali64_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(excali64_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(excali64_state, io_write_byte)) + + MCFG_DEVICE_ADD("u12", TTL74123, 0) + MCFG_TTL74123_CONNECTION_TYPE(TTL74123_GROUNDED) /* Hook up type (no idea what this means) */ + MCFG_TTL74123_RESISTOR_VALUE(RES_K(100)) /* resistor connected between RCext & 5v */ + MCFG_TTL74123_CAPACITOR_VALUE(CAP_U(100)) /* capacitor connected between Cext and RCext */ + MCFG_TTL74123_A_PIN_VALUE(0) /* A pin - grounded */ + MCFG_TTL74123_B_PIN_VALUE(1) /* B pin - driven by port e4 bit 5 */ + MCFG_TTL74123_CLEAR_PIN_VALUE(1) /* Clear pin - pulled high */ + MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITE8(excali64_state, motor_w)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(excali64_state, cent_busy_w)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( excali64 ) + ROM_REGION(0x6000, "roms", 0) + ROM_LOAD( "rom_1.ic17", 0x0000, 0x4000, CRC(e129a305) SHA1(e43ec7d040c2b2e548d22fd6bbc7df8b45a26e5a) ) + ROM_LOAD( "rom_2.ic24", 0x4000, 0x2000, CRC(916d9f5a) SHA1(91c527cce963481b7bebf077e955ca89578bb553) ) + // fix a bug that causes screen to be filled with 'p' + ROM_FILL(0x4ee, 1, 0) + ROM_FILL(0x4ef, 1, 8) + ROM_FILL(0x4f6, 1, 0) + ROM_FILL(0x4f7, 1, 8) + // patch out the protection + ROM_FILL(0x3ce7, 1, 0) + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASE00) + ROM_REGION(0xA000, "videoram", ROMREGION_ERASE00) + + ROM_REGION(0x1020, "chargen", 0) + ROM_LOAD( "genex_3.ic43", 0x0000, 0x1000, CRC(b91619a9) SHA1(2ced636cb7b94ba9d329868d7ecf79963cefe9d9) ) + ROM_LOAD( "hm7603.ic55", 0x1000, 0x0020, CRC(c74f47dc) SHA1(331ff3c913846191ddd97cacb80bd19438c1ff71) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, excali64, 0, 0, excali64, excali64, driver_device, 0, "BGR Computers", "Excalibur 64", 0 ) diff --git a/src/mame/drivers/exelv.c b/src/mame/drivers/exelv.c new file mode 100644 index 00000000000..fc1ad3d0c0e --- /dev/null +++ b/src/mame/drivers/exelv.c @@ -0,0 +1,606 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + Experimental exelvision driver + + Raphael Nabet, 2004 + + Exelvision was a French company that designed and sold two computers: + * EXL 100 (1984) + * EXELTEL (1986), which is mostly compatible with EXL 100, but has an + integrated V23b modem and 5 built-in programs. Two custom variants of + the EXELTEL were designed for chemist's shops and car dealers: they were + bundled with application-specific business software, bar code reader, + etc. + These computer were mostly sold in France and in Europe (Spain); there was + an Arabic version, too. + + Exelvision was founded by former TI employees, which is why their designs + use TI components and have architectural reminiscences of the primitive + TI-99/4 design (both computers are built around a microcontroller, have + little CPU RAM and must therefore store program data in VRAM, and feature + I/R keyboard and joysticks) + +Specs: + * main CPU is a variant of tms7020 (exl100) or tms7040 (exeltel). AFAIK, + the only difference compared to a stock tms7020/7040 is the SWAP register + instruction is replaced by a custom microcoded LVDP instruction that + reads a byte from the VDP VRAM read port; it seems that the first 6 bytes + of internal ROM (0xF000-0xF005 on an exeltel) are missing, too. + * in addition to the internal 128-byte RAM and 2kb (exl100) or 4kb + (exeltel) ROM, there are 2kb of CPU RAM and 64(?)kb (exeltel only?) of + CPU ROM. + * I/O is controlled by a tms7041 (exl100) or tms7042 (exeltel) or a variant + thereof. Communication with the main CPU is done through some custom + interface (I think), details are still to be worked out. + * video: tms3556 VDP with 32kb of VRAM (expandable to 64kb), attached to + the main CPU. + * sound: tms5220 speech synthesizer with speech ROM, attached to the I/O + CPU + * keyboard and joystick: an I/R interface controlled by the I/O CPU enables + to use a keyboard and two joysticks + * mass storage: tape interface controlled by the main CPU + +STATUS: + * EXL 100 cannot be emulated because the ROMs are not dumped + * EXELTEL stops early in the boot process and displays a red error screen, + presumably because the I/O processor is not emulated + +TODO: + * dump exeltel tms7042 I/O CPU ROM + * everything +*/ + + +#include "emu.h" +#include "cpu/tms7000/tms7000.h" +#include "video/tms3556.h" +#include "sound/tms5220.h" +#include "machine/spchrom.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +//#include "imagedev/cassette.h" + + +class exelv_state : public driver_device +{ +public: + exelv_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_tms3556(*this, "tms3556"), + m_tms5220c(*this, "tms5220c"), + m_cart(*this, "cartslot") + { } + + required_device m_maincpu; + required_device m_tms3556; + required_device m_tms5220c; + optional_device m_cart; + + DECLARE_READ8_MEMBER( mailbox_wx319_r ); + DECLARE_WRITE8_MEMBER( mailbox_wx318_w ); + DECLARE_READ8_MEMBER( tms7020_porta_r ); + DECLARE_WRITE8_MEMBER( tms7020_portb_w ); + DECLARE_READ8_MEMBER( tms7041_porta_r ); + DECLARE_WRITE8_MEMBER( tms7041_portb_w ); + DECLARE_READ8_MEMBER( tms7041_portc_r ); + DECLARE_WRITE8_MEMBER( tms7041_portc_w ); + DECLARE_READ8_MEMBER( tms7041_portd_r ); + DECLARE_WRITE8_MEMBER( tms7041_portd_w ); + DECLARE_READ8_MEMBER( rom_r ); + + DECLARE_MACHINE_START(exl100); + DECLARE_MACHINE_START(exeltel); + + /* tms7020 i/o ports */ + UINT8 m_tms7020_portb; + + /* tms7041 i/o ports */ + UINT8 m_tms7041_portb; + UINT8 m_tms7041_portc; + UINT8 m_tms7041_portd; + + /* mailbox data */ + UINT8 m_wx318; /* data of 74ls374 labeled wx318 */ + UINT8 m_wx319; /* data of 74sl374 labeled wx319 */ + + TIMER_DEVICE_CALLBACK_MEMBER(exelv_hblank_interrupt); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( exelvision_cartridge ); +}; + + +TIMER_DEVICE_CALLBACK_MEMBER(exelv_state::exelv_hblank_interrupt) +{ + m_tms3556->interrupt(machine()); +} + + +/* + I/O CPU protocol (WIP): + + I do not have a dump of the I/O CPU ROMs. The I/O CPU CRC command should + enable to dump them, but don't take my word for it. + + * port B bit >01 is asserted on reset and after a byte is sent to the I/O + CPU. + * port B bit >02 is asserted after a byte is read from the I/O CPU. When + the I/O CPU sees this line asserted, it asserts port A bit >01. + * port A bit >01 is asserted after a byte is sent to CPU (condition + cleared when port B bit >01 is cleared after being asserted) and when + port B bit >02 is asserted. + * I/O CPU pulses the main CPU INT1 line when ready to send data; data can + be read by the main CPU on the mailbox port (P48). The data is a + function code optionally followed by several bytes of data. Function + codes are: + >00: unused + >01: joystick 0 receive + >02: joystick 1 receive + >03: speech buffer start + >04: speech buffer end + >05: serial + >06: unused + >07: introduction screen (logo) (EXL 100 only?) or character + definitions + data byte #1: data length - 1 MSB + data byte #2: data length - 1 LSB + data bytes #3 through (data length + 3): graphic data + >08: I/O cpu initialized + >09: I/O cpu serial interface ready + >0a: I/O cpu serial interface not ready + >0b: screen switched off + >0c: speech buffer start (EXELTEL only?) + >0d: speech ROM or I/O cpu CRC check (EXELTEL only?) + data byte #1: expected CRC MSB + data byte #2: expected CRC LSB + data byte #3: data length - 1 MSB + data byte #4: data length - 1 LSB + data bytes #5 through (data length + 5): data on which effective + CRC is computed + >0e: mailbox test, country code read (EXELTEL only?) + >0f: speech ROM read (data repeat) (EXELTEL only?) + * The main CPU sends data to the I/O CPU through the mailbox port (P48). + The data byte is a function code; some function codes ask for extra data + bytes, which are sent through the mailbox port as well. Function codes + are: + >00: I/O CPU reset + >01: NOP (EXELTEL only?) + >02: read joystick 0 current value + >03: read joystick 1 current value + >04: test serial interface availability + >05: transmit a byte to serial interface + >06: initialization of serial interface + >07: read contents of speech ROM (EXELTEL only?) + >08: reset speech synthesizer + >09: start speech synthesizer + >0a: synthesizer data + >0b: standard generator request + >0c: I/O CPU CRC (EXELTEL only?) + >0d: send exelvision logo (EXL 100 only), start speech ROM sound (EXELTEL only?) + >0e: data for speech on ROM (EXELTEL only?) + >0f: do not decode joystick 0 keys (EXELTEL only?) + >10: do not decode joystick 1 keys (EXELTEL only?) + >11: decode joystick 0 keys (EXELTEL only?) + >12: decode joystick 1 keys (EXELTEL only?) + >13: mailbox test: echo sent data (EXELTEL only?) + >14: enter sleep mode (EXELTEL only?) + >15: read country code in speech ROM (EXELTEL only?) + >16: position I/O CPU DSR without initialization (EXELTEL only?) + >17: handle speech ROM sound with address (EXELTEL only?) + other values: I/O CPU reset? +*/ + + +READ8_MEMBER(exelv_state::mailbox_wx319_r) +{ + logerror("[TMS7220] reading mailbox %d\n", m_wx319); + return m_wx319; +} + + +WRITE8_MEMBER(exelv_state::mailbox_wx318_w) +{ + logerror("wx318 write 0x%02x\n", data); + m_wx318 = data; +} + + +/* + TMS7020 PORT A + A0 - R - TMS7041 port B bit 7 (REV3) + A1 - + A2 - + A3 - + A4 - + A5 - + A6 - + A7 - +*/ +READ8_MEMBER(exelv_state::tms7020_porta_r) +{ + logerror("tms7020_porta_r\n"); + return ( m_tms7041_portb & 0x80 ) ? 0x01 : 0x00; +} + + +/* + TMS7020 PORT B + B0 - W - TMS7041 port A bit 2 (REV2) + B1 - W - TMS7041 port A bit 4 (REV4) + B2 - + B3 - + B4 - + B5 - + B6 - + B7 - +*/ +WRITE8_MEMBER(exelv_state::tms7020_portb_w) +{ + logerror("tms7020_portb_w: data = 0x%02x\n", data); + m_tms7020_portb = data; +} + + +/* + TMS7041 PORT A + A0 - X1 NDSR A8 + A1 - X1 MDTR A9 + A2 - R - TMS7020 port B bit 0 (REV2) + A3 - TMS5220 IRQ + A4 - R - TMS7020 port B bit 1 (REV4) + A5 - X1 RXD A4 (version b) / WX301-14 (version a) + A6 - X1 SCLK A9 + A7 - TMS5220 RDY +*/ +READ8_MEMBER(exelv_state::tms7041_porta_r) +{ + UINT8 data = 0x00; + static UINT8 data_last=0; + + // TMS5220 OK + data |= m_tms5220c->intq_r() ? 0x08 : 0x00; // A3 + data |= m_tms5220c->readyq_r() ? 0x80 : 0x00; // A7 + + // TMS7220 + data |= (m_tms7020_portb & 0x01 ) ? 0x04 : 0x00; // A2 + data |= (m_tms7020_portb & 0x02) ? 0x10 : 0x00; // A4 + + // SERIAL PORT + + if (data!=data_last) { + logerror("tms7041_porta_r %x\n",data); + } + data_last=data; + + return data; +} + + +/* + TMS7041 PORT B + B0 - W - TMS5220 W + B1 - W - TMS5220 R + B2 - W - TMS7020 pin 13 / IRQ1 + B3 - X1 TXD A5 (version b) / WX301-8 (version a) + B4 - TP3 + B5 - REV5 WX318-1 + B6 - W - REV6 WX319-11 + B7 - W - TMS7020 port A bit 0 (REV3) +*/ +WRITE8_MEMBER(exelv_state::tms7041_portb_w) +{ + logerror("tms7041_portb_w: data = 0x%02x\n", data); + + m_tms5220c->wsq_w((data & 0x01) ? 1 : 0); + m_tms5220c->rsq_w((data & 0x02) ? 1 : 0); + + logerror("TMS7020 %s int1\n",((data & 0x04) ? "clear" : "assert")); + m_maincpu->set_input_line(TMS7000_INT1_LINE, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE); + + /* Check for low->high transition on B6 */ + if (!(m_tms7041_portb & 0x40) && (data & 0x40)) + { + logerror("wx319 write 0x%02x\n", m_tms7041_portc); + m_wx319 = m_tms7041_portc; + } + + m_tms7041_portb = data; +} + + +/* + TMS7041 PORT C - connected to mailbox WX318 and WX319 data bits +*/ +READ8_MEMBER(exelv_state::tms7041_portc_r) +{ + UINT8 data = 0xff; + logerror("tms7041_portc_r\n"); + + /* Check if wx318 output is enabled */ + if (!(m_tms7041_portb & 0x20)) + data = m_wx318; + + return data; +} + + +WRITE8_MEMBER(exelv_state::tms7041_portc_w) +{ + logerror("tms7041_portc_w: data = 0x%02x\n", data); + m_tms7041_portc = data; +} + + +/* + TMS7041 PORT D + D0 - TMS5220 D7 + D1 - TMS5220 D6 + D2 - TMS5220 D5 + D3 - TMS5220 D4 + D4 - TMS5220 D3 + D5 - TMS5220 D2 + D6 - TMS5220 D1 + D7 - TMS5220 D0 +*/ +READ8_MEMBER(exelv_state::tms7041_portd_r) +{ + UINT8 data = 0xff; + data=m_tms5220c->status_r(space, 0, data); + logerror("tms7041_portd_r\n"); + return data; +} + + +WRITE8_MEMBER(exelv_state::tms7041_portd_w) +{ + logerror("tms7041_portd_w: data = 0x%02x\n", data); + + m_tms5220c->data_w(space, 0, data); + m_tms7041_portd = data; +} + + +/* + CARTRIDGE ACCESS +*/ +READ8_MEMBER(exelv_state::rom_r) +{ + if (m_cart && m_cart->exists()) + return m_cart->read_rom(space, offset + 0x200); + + return 0; +} + + +/* + Main CPU memory map summary: + + @>0000-@>007f: tms7020/tms7040 internal RAM + @>0080-@>00ff: reserved + @>0100-@>010b: tms7020/tms7040 internal I/O ports + @>104 (P4): port A + @>106 (P6): port B + bit >04: page select bit 0 (LSBit) + @>010c-@>01ff: external I/O ports? + @>012d (P45): tms3556 control write port??? + @>012e (P46): tms3556 VRAM write port??? + @>0130 (P48): I/O CPU communication port R/W ("mailbox") + @>0138 (P56): read sets page select bit 1, write clears it??? + @>0139 (P57): read sets page select bit 2 (MSBit), write clears it??? + @>0140 (P64) + bit >40: enable page select bit 1 and 2 (MSBits) + @>0200-@>7fff: system ROM? (two pages?) + cartridge ROMs? (one or two pages?) + @>8000-@>bfff: free for expansion? + @>c000-@>c7ff: CPU RAM? + @>c800-@>efff: free for expansion? + @>f000-@>f7ff: tms7040 internal ROM + @>f800-@>ffff: tms7020/tms7040 internal ROM +*/ + +static ADDRESS_MAP_START(tms7020_mem, AS_PROGRAM, 8, exelv_state) + AM_RANGE(0x0080, 0x00ff) AM_NOP + AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r) + AM_RANGE(0x0125, 0x0125) AM_DEVREAD("tms3556", tms3556_device, reg_r) + AM_RANGE(0x0128, 0x0128) AM_DEVREAD("tms3556", tms3556_device, initptr_r) + AM_RANGE(0x012d, 0x012d) AM_DEVWRITE("tms3556", tms3556_device, reg_w) + AM_RANGE(0x012e, 0x012e) AM_DEVWRITE("tms3556", tms3556_device, vram_w) + + AM_RANGE(0x0130, 0x0130) AM_READWRITE(mailbox_wx319_r, mailbox_wx318_w) + AM_RANGE(0x0200, 0x7fff) AM_READ(rom_r) + AM_RANGE(0x8000, 0xbfff) AM_NOP + AM_RANGE(0xc000, 0xc7ff) AM_RAM /* CPU RAM */ + AM_RANGE(0xc800, 0xf7ff) AM_NOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tms7020_port, AS_IO, 8, exelv_state) + AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(tms7020_porta_r) + AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(tms7020_portb_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tms7041_port, AS_IO, 8, exelv_state) + AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(tms7041_porta_r) + AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(tms7041_portb_w) + AM_RANGE(TMS7000_PORTC, TMS7000_PORTC) AM_READWRITE(tms7041_portc_r, tms7041_portc_w) + AM_RANGE(TMS7000_PORTD, TMS7000_PORTD) AM_READWRITE(tms7041_portd_r, tms7041_portd_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(tms7040_mem, AS_PROGRAM, 8, exelv_state) + AM_RANGE(0x0080, 0x00ff) AM_NOP + AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r) + AM_RANGE(0x0125, 0x0125) AM_DEVREAD("tms3556", tms3556_device, reg_r) + AM_RANGE(0x0128, 0x0128) AM_DEVREAD("tms3556", tms3556_device, initptr_r) + AM_RANGE(0x012d, 0x012d) AM_DEVWRITE("tms3556", tms3556_device, reg_w) + AM_RANGE(0x012e, 0x012e) AM_DEVWRITE("tms3556", tms3556_device, vram_w) + AM_RANGE(0x0130, 0x0130) AM_READWRITE(mailbox_wx319_r, mailbox_wx318_w) + AM_RANGE(0x0200, 0x7fff) AM_ROMBANK("bank1") /* system ROM */ + AM_RANGE(0x8000, 0xbfff) AM_NOP + AM_RANGE(0xc000, 0xc7ff) AM_RAM /* CPU RAM */ + AM_RANGE(0xc800, 0xefff) AM_NOP +ADDRESS_MAP_END + + +/* keyboard: ??? */ +static INPUT_PORTS_START(exelv) + + PORT_START("exelv") + +INPUT_PORTS_END + + +/* Machine Initialization */ + +MACHINE_START_MEMBER( exelv_state, exl100) +{ + /* register for state saving */ + save_item(NAME(m_tms7020_portb)); + save_item(NAME(m_tms7041_portb)); + save_item(NAME(m_tms7041_portc)); + save_item(NAME(m_tms7041_portd)); + save_item(NAME(m_wx318)); + save_item(NAME(m_wx319)); +} + +MACHINE_START_MEMBER( exelv_state, exeltel) +{ + UINT8 *rom = memregion("user1")->base() + 0x0200; + membank("bank1")->configure_entry(0, rom); + membank("bank1")->set_entry(0); + + /* register for state saving */ + save_item(NAME(m_tms7020_portb)); + save_item(NAME(m_tms7041_portb)); + save_item(NAME(m_tms7041_portc)); + save_item(NAME(m_tms7041_portd)); + save_item(NAME(m_wx318)); + save_item(NAME(m_wx319)); +} + + +static MACHINE_CONFIG_START( exl100, exelv_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS7020_EXL, XTAL_4_9152MHz) + MCFG_CPU_PROGRAM_MAP(tms7020_mem) + MCFG_CPU_IO_MAP(tms7020_port) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1) + MCFG_MACHINE_START_OVERRIDE(exelv_state, exl100) + + MCFG_CPU_ADD("tms7041", TMS7041, XTAL_4_9152MHz) + MCFG_CPU_IO_MAP(tms7041_port) + + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_TMS3556_ADD("tms3556") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_UPDATE_DEVICE("tms3556", tms3556_device, screen_update) +#if TMS3556_DOUBLE_WIDTH + MCFG_SCREEN_SIZE(TMS3556_TOTAL_WIDTH*2, TMS3556_TOTAL_HEIGHT*2) + MCFG_SCREEN_VISIBLE_AREA(0, TMS3556_TOTAL_WIDTH*2-1, 0, TMS3556_TOTAL_HEIGHT*2-1) +#else + MCFG_SCREEN_SIZE(TMS3556_TOTAL_WIDTH, TMS3556_TOTAL_HEIGHT*2) + MCFG_SCREEN_VISIBLE_AREA(0, TMS3556_TOTAL_WIDTH-1, 0, TMS3556_TOTAL_HEIGHT-1) +#endif + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_3BIT_RGB("palette") + + // MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) + + /* sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("tms5220c", TMS5220C, 640000) + // MCFG_TMS52XX_SPEECHROM("vsm") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "exelvision_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_SOFTWARE_LIST_ADD("cart_list", "exl100_cart") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( exeltel, exelv_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS7040, XTAL_4_9152MHz) + MCFG_CPU_PROGRAM_MAP(tms7040_mem) + MCFG_CPU_IO_MAP(tms7020_port) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1) + MCFG_MACHINE_START_OVERRIDE(exelv_state, exeltel) + + MCFG_CPU_ADD("tms7042", TMS7042, XTAL_4_9152MHz) + MCFG_CPU_IO_MAP(tms7041_port) + + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_TMS3556_ADD("tms3556") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_UPDATE_DEVICE("tms3556", tms3556_device, screen_update) +#if TMS3556_DOUBLE_WIDTH + MCFG_SCREEN_SIZE(TMS3556_TOTAL_WIDTH*2, TMS3556_TOTAL_HEIGHT*2) + MCFG_SCREEN_VISIBLE_AREA(0, TMS3556_TOTAL_WIDTH*2-1, 0, TMS3556_TOTAL_HEIGHT*2-1) +#else + MCFG_SCREEN_SIZE(TMS3556_TOTAL_WIDTH, TMS3556_TOTAL_HEIGHT*2) + MCFG_SCREEN_VISIBLE_AREA(0, TMS3556_TOTAL_WIDTH-1, 0, TMS3556_TOTAL_HEIGHT-1) +#endif + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_3BIT_RGB("palette") + + MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) + + /* sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("tms5220c", TMS5220C, 640000) + MCFG_TMS52XX_SPEECHROM("vsm") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + +/* + ROM loading +*/ +ROM_START(exl100) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("exl100in.bin", 0xf800, 0x0800, CRC(049109a3) SHA1(98a07297dcdacef41c793c197b6496dac1e8e744)) /* TMS7020 ROM, correct */ + + ROM_REGION(0x10000, "tms7041", 0) + ROM_LOAD("exl100_7041.bin", 0xf000, 0x1000, CRC(38f6fc7a) SHA1(b71d545664a974d8ad39bdf600c5b9884c3efab6)) /* TMS7041 internal ROM, correct */ +// ROM_REGION(0x8000, "vsm", 0) +ROM_END + + +ROM_START(exeltel) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("exeltel_7040.bin", 0xf000, 0x1000, CRC(2792f02f) SHA1(442a852eb68ef78974733d169084752a131de23d)) /* TMS7040 internal ROM */ + + ROM_REGION(0x10000, "tms7042", 0) + ROM_LOAD("exeltel_7042.bin", 0xf000, 0x1000, BAD_DUMP CRC(a0163507) SHA1(8452849df7eac8a89cf03ee98e2306047c1c4c38)) /* TMS7042 internal ROM, needs redump */ + + ROM_REGION(0x10000,"user1",0) + ROM_SYSTEM_BIOS( 0, "french", "French v1.4" ) + ROMX_LOAD("exeltel14.bin", 0x0000, 0x10000, CRC(52a80dd4) SHA1(2cb4c784fba3aec52770999bb99a9a303269bf89), ROM_BIOS(1)) /* French system ROM v1.4 */ + ROM_SYSTEM_BIOS( 1, "spanish", "Spanish" ) + ROMX_LOAD("amper.bin", 0x0000, 0x10000, CRC(45af256c) SHA1(3bff16542f8ac55b9841084ea38034132459facb), ROM_BIOS(2)) /* Spanish system rom */ + + ROM_REGION(0x8000, "vsm", 0) + ROM_LOAD("cm62312.bin", 0x0000, 0x4000, CRC(93b817de) SHA1(03863087a071b8f22d36a52d18243f1c33e17ff7)) /* system speech ROM */ +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP(1984, exl100, 0, 0, exl100, exelv, driver_device, 0, "Exelvision", "EXL 100", MACHINE_NOT_WORKING) +COMP(1986, exeltel, exl100, 0, exeltel, exelv, driver_device, 0, "Exelvision", "Exeltel", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/exp85.c b/src/mame/drivers/exp85.c new file mode 100644 index 00000000000..82d2c679f98 --- /dev/null +++ b/src/mame/drivers/exp85.c @@ -0,0 +1,234 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Explorer 85 + + 12/05/2009 Skeleton driver. + + Setting Up + ========== + The terminal must be set for + - Baud: 9600 + - Format: 7E1 + If it isn't, adjust the settings, then restart the system. + + Once started, press Space. The system will start up. + All input must be in upper case. + +****************************************************************************/ + +/* + + TODO: + + - dump of the hexadecimal keyboard monitor ROM + - disable ROM mirror after boot + - RAM expansions + +*/ + + +#include "includes/exp85.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8155.h" +#include "machine/i8355.h" +#include "machine/ram.h" + +/* Memory Maps */ + +static ADDRESS_MAP_START( exp85_mem, AS_PROGRAM, 8, exp85_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROMBANK("bank1") + AM_RANGE(0xc000, 0xdfff) AM_ROM + AM_RANGE(0xf000, 0xf7ff) AM_ROM + AM_RANGE(0xf800, 0xf8ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( exp85_io, AS_IO, 8, exp85_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE(I8355_TAG, i8355_device, io_r, io_w) + AM_RANGE(0xf8, 0xfd) AM_DEVREADWRITE(I8155_TAG, i8155_device, io_r, io_w) +// AM_RANGE(0xfe, 0xff) AM_DEVREADWRITE(I8279_TAG, i8279_r, i8279_w) +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( exp85_state::trigger_reset ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER( exp85_state::trigger_rst75 ) +{ + m_maincpu->set_input_line(I8085_RST75_LINE, newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( exp85 ) + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, exp85_state, trigger_reset, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF, exp85_state, trigger_rst75, 0) +INPUT_PORTS_END + +/* 8355 Interface */ + +READ8_MEMBER( exp85_state::i8355_a_r ) +{ + /* + + bit description + + PA0 tape control + PA1 jumper S17 (open=+5V closed=GND) + PA2 J5:13 + PA3 + PA4 J2:22 + PA5 + PA6 + PA7 speaker output + + */ + + return 0x02; +} + +WRITE8_MEMBER( exp85_state::i8355_a_w ) +{ + /* + + bit description + + PA0 tape control + PA1 jumper S17 (open=+5V closed=GND) + PA2 J5:13 + PA3 + PA4 J2:22 + PA5 + PA6 + PA7 speaker output + + */ + + /* tape control */ + m_tape_control = BIT(data, 0); + + /* speaker output */ + m_speaker->level_w(!BIT(data, 7)); +} + +/* I8085A Interface */ + +READ_LINE_MEMBER( exp85_state::sid_r ) +{ + int data = 1; + + if (m_tape_control) + { + data = (m_cassette->input() > +0.0); + } + else + { + data = m_rs232->rxd_r(); + } + + return data; +} + +WRITE_LINE_MEMBER( exp85_state::sod_w ) +{ + if (m_tape_control) + { + m_cassette->output(state ? -1.0 : +1.0); + } + else + { + m_rs232->write_txd(state); + } +} + +/* Terminal Interface */ + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +/* Machine Initialization */ + +void exp85_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* setup memory banking */ + program.install_read_bank(0x0000, 0x07ff, "bank1"); + program.unmap_write(0x0000, 0x07ff); + membank("bank1")->configure_entry(0, m_rom->base() + 0xf000); + membank("bank1")->configure_entry(1, m_rom->base()); + membank("bank1")->set_entry(0); +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( exp85, exp85_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I8085A_TAG, I8085A, XTAL_6_144MHz) + MCFG_CPU_PROGRAM_MAP(exp85_mem) + MCFG_CPU_IO_MAP(exp85_io) + MCFG_I8085A_SID(READLINE(exp85_state, sid_r)) + MCFG_I8085A_SOD(WRITELINE(exp85_state, sod_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_6_144MHz/2) + + MCFG_DEVICE_ADD(I8355_TAG, I8355, XTAL_6_144MHz/2) + MCFG_I8355_IN_PA_CB(READ8(exp85_state, i8355_a_r)) + MCFG_I8355_OUT_PA_CB(WRITE8(exp85_state, i8355_a_w)) + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256") + MCFG_RAM_EXTRA_OPTIONS("4K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( exp85 ) + ROM_REGION( 0x10000, I8085A_TAG, 0 ) + ROM_DEFAULT_BIOS("eia") + ROM_LOAD( "c000.bin", 0xc000, 0x0800, CRC(73ce4aad) SHA1(2c69cd0b6c4bdc92f4640bce18467e4e99255bab) ) + ROM_LOAD( "c800.bin", 0xc800, 0x0800, CRC(eb3fdedc) SHA1(af92d07f7cb7533841b16e1176401363176857e1) ) + ROM_LOAD( "d000.bin", 0xd000, 0x0800, CRC(c10c4a22) SHA1(30588ba0b27a775d85f8c581ad54400c8521225d) ) + ROM_LOAD( "d800.bin", 0xd800, 0x0800, CRC(dfa43ef4) SHA1(56a7e7a64928bdd1d5f0519023d1594cacef49b3) ) + ROM_SYSTEM_BIOS( 0, "eia", "EIA Terminal" ) + ROMX_LOAD( "ex 85.u105", 0xf000, 0x0800, CRC(1a99d0d9) SHA1(57b6d48e71257bc4ef2d3dddc9b30edf6c1db766), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "hex", "Hex Keyboard" ) + ROMX_LOAD( "1kbd.u105", 0xf000, 0x0800, NO_DUMP, ROM_BIOS(2) ) + + ROM_REGION( 0x800, I8355_TAG, ROMREGION_ERASE00 ) + +/* ROM_DEFAULT_BIOS("terminal") + ROM_SYSTEM_BIOS( 0, "terminal", "Terminal" ) + ROMX_LOAD( "eia.u105", 0xf000, 0x0800, CRC(1a99d0d9) SHA1(57b6d48e71257bc4ef2d3dddc9b30edf6c1db766), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "hexkbd", "Hex Keyboard" ) + ROMX_LOAD( "hex.u105", 0xf000, 0x0800, NO_DUMP, ROM_BIOS(2) )*/ +ROM_END + +/* System Drivers */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, exp85, 0, 0, exp85, exp85, driver_device, 0, "Netronics", "Explorer/85", 0 ) diff --git a/src/mame/drivers/fanucs15.c b/src/mame/drivers/fanucs15.c new file mode 100644 index 00000000000..ce3f9a79bac --- /dev/null +++ b/src/mame/drivers/fanucs15.c @@ -0,0 +1,423 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + Fanuc System 15 + + 2014-01-04 Skeleton driver. + + This is a circa-1990 CNC machine with a very custom GUI, made of a + bunch of boards plugged into a passive backplane. + + Possible boards include: + A16B-2200-0020/04B : Base 2 Board (contains 12 MHz 68020 "CNC CPU" and 1 or 2 MB of DRAM) + A16B-2200-0090/07A : Digital Servo 4-Axis Controller Board (no ROMs on this board) + A16B-2200-0121/06C : Base 0 Board (1 ROM location but position is empty. -0120 has 6081 001A) + + A16B-2200-0131/11B : Base 1 Board (15 ROMs on this board, 4040, 9030, AB02) + See detailed layout and description below. + + A16B-2200-0150/03A : Conversational Board (4 ROMs on this board, 5A00, probably for Mill) + or + A16B-2200-0150/03A : Conversational Board (4 ROMs on this board, 5C30. 5C for 2 axis Lathe) + or + A16B-2200-0150/03A : Conversational Board (4 ROMs on this board, 5D30. 5D for 4 axis (twin Turret) lathe) + Fanuc FBI-A MB605111 (QFP100) + MB1422A (DIP42 - DRAM Controller) + 51256-10 (x18) + MB89259A (SOP28) + Intel 80286-8 + Intel 80287-8 + MBL82288-8 (DIP10) + uPB8284 (DIP18) + 24MHz & 32MHz OSC's + 4 EPROMs + + A16B-2200-0160/07B : Graphic Board (3 ROMs on this board, 6082 001A, 600B 001D, 600B 002D. 600B is for Mill) + or + A16B-2200-0160/07B : Graphic Board (3 ROMs on this board, 6082 001A, 600A 001C, 600A 001D. 600A is for Lathe) + Fanuc FBI-A MB605111 (QFP100) + HD68HC000P10 (68000 @10MHz, PLCC68) + HM62256-10 (x2) + HM53461-12 (x3) + HD63484 (PLCC68) + HD6445 (PLCC44) + Fanuc GBC MB652147 (PGA135) + MB81464-12 (x12) + 20MHz OSC + 3 EPROMs. 6082 is common to both mills and lathes. + 600A is a known EPROM version required for lathes with FAPT conversational graphics. + 600B is unknown. Possibly for mills with FAPT. + + A20B-1003-0230/09C : Motherboard (dumb backplane, contains only slots) + A20B-1003-0500/01A : Additional Graphic Board for 15TTF only (for TT, connects to A16B-2200-0160 Board. No info on this PCB) + A20B-1003-0240/07B : Connector Assembly Unit / IO Board + A20B-1003-0580/01A : PMC Cassette C (16000 Step + Pascal 128KB, small PCB in a yellow plastic box, contains just 2 EPROMs) + + + Fanuc System 15A Base 1 Board A16B-2200-013 + + PCB Layout + ---------- + + A16B-2200-0131/03B (note 1 and 03B have been added/printed later) + |--------------| |---| + |------| CA34 |-----|CA4|-------------------------------------| + | |--------------|75463|---| LL LL MB81C79A| + | (x6) LL LL |--------| | + | HM53461(x5)|MB605117| | + | FA8191 | | | + |4040002E.M27 4040001E.M23 FA8191 | | | + | |--------| | + | | + | MC-122-41256A9A-12 |--------| | + |AB02142A.K27 AB02141A.K23 MC-122-41256A9A-12 |MB661128| | + | 9030001E.J18 | | | + | | | | + | |--------| | + |AB02102A.H27 AB02101A.H23 | + | | + | | + | | + |AB020C2A.F27 AB020C1A.F23 24MHz | + | | + | | + | |--------| | + |AB02082A.E27 AB02081A.E23 |------| |MB605111| | + | |68000 | | | | + | | | | | | + | |---------| | | |--------| | + | |---------| |------| | + | CNM1 |-----------------------| | + |------------------------------------------| CNA |--| + |-----------------------| + Notes: + MC-122-41256- NEC MC-122-41256A9A-12 256k RAM SIP module (with parity) containing NEC D41256L-12 32k x8 SRAM + 2 SIP modules populated, 9 chips per module, 18 total RAMs, total 512k + 68000 - Hitachi HD68HC000-12 68000 CPU. Clock 24/2 (PLCC68) + MB661128 - Fujitsu Fanuc SLC01 MB661128 (Serial Data Link Controller, PLCC68) + MB605117 - Fujitsu Fanuc BOC MB605117U (DRAM/SRAM Interface Controller, QFP100) + MB605111 - Fujitsu Fanuc FBI-A MB605111 (Global/Local Interface Controller, QFP100) + HM53461 - Hitachi HM53461-12 64k x4-bit multiport CMOS video RAM (x5, SOJ24) + MB81C79A - Fujitsu MB81C79A-35 8k x 9-bit (72k) CMOS Static RAM (SOP28) + FA8191 - Fanuc FA8191 RV07 custom ceramic module (contains resistors and transistors, SIL16) + 75463 - Texas Instruments SN75463 Dual High-Voltage, High-Current Peripheral Driver (DIP8) + L - LED + CA34 - Connector for PMC Cassette C A02B-0094-C103 (holds 2 EPROMs containing the PMC Ladder) + The Ladder is specific and unique to each CNC machine, depending on capability and options. + CA4 - Connector for cable joined to Servo Control Board A16B-2200-0090 or 16B-2200-0091 + CNA - Connector plugs into motherboard slot CNA2 (BASE 1) + CNM1 - 40 pin flat cable joined to optional board A16B-1600-0280/02A + + Note about EPROMs: + Software Series is denoted by the first 4 digits + ROM # (possibly relating to the memory location in hex) is the next 3 digits + Software Revision is the last letter + Both IC locations and ROM # are printed on this board + + ROM IC Memory EPROM Used + Label Location Location Type For... + ----------------------------------------------------------------------------------------- + 9030001E J18 381 27256 Digital Servo Control Program Version 9030 Revision E + + 4040001E M23 001 27C1001 PMC Control Program Version 4040 Revision E + 4040002E M27 002 27C1001 + + AB02081A E23 081 27C1001 Boot Software Version AB02 Revision A + AB02082A E27 082 27C1001 + AB020C1A F23 0C1 27C1001 + AB020C2A F27 0C2 27C1001 + AB02101A H23 101 27C1001 + AB02102A H27 102 27C1001 + AB02141A K23 141 27C1001 + AB02142A K27 142 27C1001 + + + Another identical board from a different machine contains the following EPROMs.... + 9030001F (known revisions exist up to at least rev M) + 4040001D, 4040002D (known revisions exist up to at least rev I) + A202081G, A202082G + A2020C1G, A2020C2G + A202101G, A202102G + + The complete boot software series is listed below: + + 15TA SOFTWARE SERIES (Single Turret 2 Axis Lathe) + |------+----+---------+---+---+---+---| + |S/W |STEP| CRT |I/O|SER|SER|DNC| + |SERIES| | | | | | | + | |1 2| 9M 14 9C|LNK|SPN|FB |1 2| + +------+----+---------+---+---+---+---+ + |A201 |X | X | | | | | + |A202 |X | X | | | | | + |A211 | X| X | X | X | |X | + |A212 | X| X | X | X | |X | + |A219 | X| X | X | X | X | | + |A220 | X| X | X | X | X | | + |A215 | X| X | X | X | | X| + |A216 | X| X | X | X | | X| + |A217 | X| X | X | X | X | X| + |A218 | X| X | X | X | X | X| + |A221 | X| X | X | X | ? | ?| + |------+----+---------+---+---+---+---| + Notes: + 9M - 9" Monochrome + 9C - 9" Color + 14 - 14" Color + SER SPN - Serial Spindle + SER FB - Serial FB ? + DNC 1/2 - DNC (Direct NC) type 1 or type 2 for Direct PC to CNC program transfer operation + + + 15TTA SOFTWARE SERIES (Twin Turret 4 Axis Lathe) + |------+----+---------+---+---+---+---| + |S/W |STEP| CRT |I/O|SER|SER|DNC| + |SERIES| | | | | | | + | |1 2| 9M 14 9C|LNK|SPN|FB |1 2| + +------+----+---------+---+---+---+---+ + |A401 |X | X | | | | | + |A402 |X | X | | | | | + |A411 | X| X | X | X | |X | + |A412 | X| X | X | X | |X | + |A419 | X| X | X | X | X | | + |A420 | X| X | X | X | X | | + |------+----+---------+---+---+---+---| + + + 15TTF SOFTWARE SERIES (Twin Turret 4 Axis Lathe with FAPT) + |------+----+---------+---+---+---+---| + |S/W |STEP| CRT |I/O|SER|SER|DNC| + |SERIES| | | | | | | + | |1 2| 9M 14 9C|LNK|SPN|FB |1 2| + +------+----+---------+---+---+---+---+ + |A502 |X | X | | | | | + |A512 | X| X | X | X | |X | + |A520 | X| X | X | X | X | | + |------+----+---------+---+---+---+---| + + + 15MA SOFTWARE SERIES (Mill With 3 Axes minimum XYZ) + |------+----+---------+---+---+---+---|---| + |S/W |STEP| CRT |I/O|SER|SER|DNC|SUB| + |SERIES| | | | | | | | + | |1 2| 9M 14 9C|LNK|SPN|FB |1 2|CPU| + +------+----+---------+---+---+---+---+---| + |A001 |X | X | | | | | | + |A002 |X | X | | | | | | + |A00A |X | X | | | | | | + |A00B |X | X | | | | | | + |AA01 |X | X | | | | | X | + |AA02 |X | X | | | | | X | + |A011 | X| X | X | X | |X | | + |A012 | X| X | X | X | |X | | + |AA11 | X| X | X | X | |X | X | + |AA12 | X| X | X | X | |X | X | + |A017 | X| X | X | X | X | X| | + |A018 | X| X | X | X | X | X| | + |A019 | X| X | X | X | X | | | + |A01A | X| X | X | X | |X | | + |A01B | X| X | X | X | |X | | + |A020 | X| X | X | X | X | | | + |A021 | X| X| X | X | X | ?| | + |A027 (NEW STANDARD) | | | | | | + |A028 (NEW STANDARD) | | | | | | + |A041 (FOR OSI ONLY) | | | | | | + |A042 (FOR OSI ONLY) | | | | | | + |AA19 | X| X | X | X | X | | X | + |AA20 | X| X | X | X | X | | X | + |AA13 | X| X | X | X | X | X| X | + |AA14 | X| X | X | X | X | X| X | + |AA23 | X| X | X | X | X | | X | + |AA24 | X| X | X | X | X | | X | + |AA26 | X| X | X | X | X | ?| X | + |AA27 (NEW STD) | | | | | | + |AA28 (NEW STD) | | | | | | + |AA41 (FOR OSI ONLY) | | | | | | + |AA42 (FOR OSI ONLY) | | | | | | + |---------------------+---+---+---+---+---| + + + Optional PCB A16B-1600-0280/02A + ------------------------------- + + |---------------------------| + | 181 182 | + | | + | | + | | + | 1C1 1C2 | + | | + | | + | | + | 201 202 | + | | + | | + | | + | 241 242 | + | | + | | + | | + | 281 282 | + | | + | | + | | + | 2C1 2C2 | + | | + | | + | |---------| | + | |---------| | + | CNM1 | + |---------------------------| + Notes: + The A16B-1600-0280/02A board contains only 12 DIP32 sockets and some logic and + bolts to the back of the BASE 1 board. The board extends the boot software memory + storage space if additional EPROMS are required. Not all sockets are populated. + Connector CNM1 joins with a 40 pin flat cable to the BASE 1 board connector CNM1 + IC locations are not printed on this board. Only the ROM # is printed at each + socket location. + + ROM IC Memory EPROM Used For + Label Location Location Type + --------------------------------------------------------------------------------- + AB02281A N/A 281 27C1001 Boot Software Version AB02 Revision A + AB02282A N/A 282 27C1001 + AB022C1A N/A 2C1 27C1001 + AB022C2A N/A 2C2 27C1001 + + + 15A EPROM population and option type + ----------------+---------+------------------------------------------- + PCB NAME |ROM # | Option Type (Basic, Option A1/A2/A3 etc) + ----------------|---------+------------------------------------------- + BASE 1 main |081, 082 | B + BASE 1 main |0C1, 0C2 | B + BASE 1 main |101, 102 | A1 if step1 software, B if step2 software + BASE 1 main |141, 142 | A2 (only used for foreign language option) + BASE 1 daughter |181, 182 | A3 (if used) + BASE 1 daughter |1C1, 1C2 | not used + BASE 1 daughter |201, 202 | not used + BASE 1 daughter |241, 242 | A6 (if used) + BASE 1 daughter |281, 282 | B when subcpu used + BASE 1 daughter |2C1, 2C2 | B when subcpu used + --------------------------+------------------------------------------- + Note: 2 MEG DRAM is required on BASE2 PCB when A3 or A6 is used + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "cpu/i86/i286.h" + +class fanucs15_state : public driver_device +{ +public: + fanucs15_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") // main 68020 + , m_pmccpu(*this, "pmccpu") // sub 68000-12 + , m_gfxcpu(*this, "gfxcpu") // gfx 68000-10 + , m_convcpu(*this, "convcpu") // conversational 80286-8 + { } + + required_device m_maincpu; + required_device m_pmccpu; + required_device m_gfxcpu; + required_device m_convcpu; + +private: + virtual void machine_reset(); +}; + +static ADDRESS_MAP_START(maincpu_mem, AS_PROGRAM, 32, fanucs15_state) + AM_RANGE(0x00000000, 0x0017ffff) AM_ROM AM_REGION("base1b", 0) + AM_RANGE(0x000f8000, 0x000fffff) AM_RAM // filled with 0x96 on boot + AM_RANGE(0xffff0000, 0xffffffff) AM_RAM // initial stack +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pmccpu_mem, AS_PROGRAM, 16, fanucs15_state) + AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_REGION("base1a", 0) + AM_RANGE(0xfde000, 0xffffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(gfxcpu_mem, AS_PROGRAM, 16, fanucs15_state) + AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("gfxboard", 0) + AM_RANGE(0xfe0000, 0xfeffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(convcpu_mem, AS_PROGRAM, 16, fanucs15_state) + AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_REGION("conversational", 0x40000) + AM_RANGE(0x040000, 0x07ffff) AM_ROM AM_REGION("conversational", 0) + AM_RANGE(0x800000, 0x87ffff) AM_RAM + AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("conversational", 0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( fanucs15 ) +INPUT_PORTS_END + +void fanucs15_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( fanucs15, fanucs15_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68020, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(maincpu_mem) + MCFG_DEVICE_DISABLE() + + MCFG_CPU_ADD("pmccpu", M68000, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(pmccpu_mem) + MCFG_DEVICE_DISABLE() + + MCFG_CPU_ADD("gfxcpu", M68000, XTAL_10MHz) // wants bit 15 of 70500 to be set + MCFG_CPU_PROGRAM_MAP(gfxcpu_mem) + MCFG_DEVICE_DISABLE() + + MCFG_CPU_ADD("convcpu", I80286, XTAL_8MHz) // wants 70500 to return 0x8000 (same as what gfxcpu looks for, basically) + MCFG_CPU_PROGRAM_MAP(convcpu_mem) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( fanucs15 ) + ROM_REGION16_BE( 0x50000, "base1a", 0 ) // 68000 sub CPU code and data on base 1 board (verified) + ROM_LOAD16_BYTE( "4040_001e_001.23m", 0x000001, 0x020000, CRC(2e12109f) SHA1(83ed846d3d59ab0d81b2e2e2231d1a444e462590) ) + ROM_LOAD16_BYTE( "4040_002e_002.27m", 0x000000, 0x020000, CRC(a5469692) SHA1(31c44edb36fb69d3d418a97e32e4a2769d1ec9e7) ) + ROM_LOAD16_BYTE( "9030_001e_381.18j", 0x040001, 0x008000, CRC(9f10a022) SHA1(dc4a242f7611143cc2d9564993fd5fa52f0ac13a) ) + + ROM_REGION32_BE( 0x180000, "base1b", 0 ) // 68020 main CPU code and data on base 1 board (verified) + ROM_LOAD16_BYTE( "ab02_081a_081.23e", 0x000001, 0x020000, CRC(5328b023) SHA1(661f2908f3287f7cd2b215cd29962f2789f7d99a) ) + ROM_LOAD16_BYTE( "ab02_082a_082.27e", 0x000000, 0x020000, CRC(ad37740f) SHA1(e65cc0a8b4e515fcf5fcefde99e95d100d310018) ) + ROM_LOAD16_BYTE( "ab02_0c1a_0c1.23f", 0x040001, 0x020000, CRC(62566569) SHA1(dd85b6e7875d996759b833552b00e1b3a0e3696b) ) + ROM_LOAD16_BYTE( "ab02_0c2a_0c2.27f", 0x040000, 0x020000, CRC(a4ade1fe) SHA1(44ef5358b34d3538fb061f235b8a14bac6b5faa8) ) + ROM_LOAD16_BYTE( "ab02_101a_101.23h", 0x080001, 0x020000, CRC(96f5d00e) SHA1(f5de3621df536435d27a0aac1c9d25e69601bd40) ) + ROM_LOAD16_BYTE( "ab02_102a_102.27h", 0x080000, 0x020000, CRC(e23a5414) SHA1(f6aff51dfd6d976b7cd33399c7aa3d06c7c06919) ) + ROM_LOAD16_BYTE( "ab02_141a_141.23k", 0x0c0001, 0x020000, CRC(3ceb6809) SHA1(7e37b18847b35f81c08b7b2ab62e99fa3a737c32) ) + ROM_LOAD16_BYTE( "ab02_142a_142.27k", 0x0c0000, 0x020000, CRC(1d8a4d7d) SHA1(580322e2927742bbcbf0bb2757730e2817b320e1) ) + // this appears to be a different version of the 081a/0c1a ROM program. it's definitely for a 68020 (32-bit pointers everywhere) + ROM_LOAD16_BYTE( "ab02_281a_281.8a", 0x100001, 0x020000, CRC(cec79742) SHA1(1233ff920d607206a80c8d187745e3d657a8635d) ) + ROM_LOAD16_BYTE( "ab02_282a_282.8d", 0x100000, 0x020000, CRC(63eacc0e) SHA1(1f25b99280112c720d778219b4610f556f33a7f1) ) + ROM_LOAD16_BYTE( "ab02_2c1a_2c1.10a", 0x140001, 0x020000, CRC(66eb74dd) SHA1(f256763cb15b4524c09bd09b88df46a1498846ef) ) + ROM_LOAD16_BYTE( "ab02_2c2a_2c2.10d", 0x140000, 0x020000, CRC(6edf4ff3) SHA1(9cbf7c6555cc27def3b580f5a7b0ff580984206d) ) + + ROM_REGION16_LE( 0x80000, "conversational", 0 ) // 80286 ROMs, 5a00 for Mill + ROM_LOAD16_BYTE( "5a00_041b.041", 0x000000, 0x020000, CRC(bf22c0a3) SHA1(56ab70bfd5794cb4db1d87c8becf7af522687564) ) + ROM_LOAD16_BYTE( "5a00_042b.042", 0x000001, 0x020000, CRC(7abc9d6b) SHA1(5cb6ad08ce93aa99391d1ce46ac8db8ba2e0f94a) ) + ROM_LOAD16_BYTE( "5a00_001b.001", 0x040000, 0x020000, CRC(cd2a2839) SHA1(bc20fd9ae9d071e1df835244aea85648d1bd1dbc) ) + ROM_LOAD16_BYTE( "5a00_002b.002", 0x040001, 0x020000, CRC(d9ebbb4a) SHA1(9c3d96e9b88848472210beacdf9d300ddd42d16e) ) + + ROM_REGION16_BE( 0x50000, "gfxboard", 0 ) // graphics board 68000 code/data. 600a for lathe, 600b for mill, 6082 common to both + ROM_LOAD16_BYTE( "600b_001d_low.3l", 0x000001, 0x010000, CRC(50566c5c) SHA1(966c8d90d09a9c50c5dedebe9c67f1755846b234) ) + ROM_LOAD16_BYTE( "600b_002d_high.3j", 0x000000, 0x010000, CRC(304e1ecb) SHA1(1e4b149b306550750fc03bd80bd399f239f68657) ) + ROM_LOAD16_BYTE( "600a_001c.bin", 0x020001, 0x010000, CRC(63d9fc2f) SHA1(280e825ba7b79e7c38282a4f4b762d2219fd873b) ) + ROM_LOAD16_BYTE( "600a_002c.bin", 0x020000, 0x010000, CRC(4d78e702) SHA1(a89bd07dc1ae030bdee5a541777825eaadbc2307) ) + // font or tilemap data? + ROM_LOAD( "6082_001a_cg.12b", 0x040000, 0x010000, CRC(f3d10cf9) SHA1(bc5bc88dcb5f347e1442aa4a0897747958a53413) ) + + ROM_REGION16_BE( 0x40000, "cassette", 0 ) // "PMC Cassette C", ROM cartridge that plugs into the Base 1 board + ROM_LOAD16_BYTE( "pmc_high.a2", 0x000000, 0x020000, CRC(7b8f9a96) SHA1(08d828b612c45bb3f2f7a56df418cd8e34731bf4) ) + ROM_LOAD16_BYTE( "pmc_low.a1", 0x000001, 0x020000, CRC(3ab261f8) SHA1(20b7eef96deb91a3a867f9ac4165b0c188fbcff3) ) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1990, fanucs15, 0, 0, fanucs15, fanucs15, driver_device, 0, "Fanuc", "System 15", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/fanucspmg.c b/src/mame/drivers/fanucspmg.c new file mode 100644 index 00000000000..9b40227094b --- /dev/null +++ b/src/mame/drivers/fanucspmg.c @@ -0,0 +1,1011 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + +Fanuc System P-Model G +Fanuc 1983 + +2014-03-22 Skeleton driver. +This is a machine from 1983 in a single case +with a lot of ports and a unique keyboard. + +Also known as Fanuc P-G System, this is a dedicated 8085+8086+8087-based computer +system running software for CNC Programming. +The system boots up from on-board EPROM and shows a big ASCII-art boot screen +FANUC SYSTEM P and the ROM software version in the lower right corner. +To initiate booting from the floppy drive hold down the LOAD key for 3-5 seconds. +The system checks for a long LOAD key press so that it doesn't load software +if the LOAD key is accidentally pressed quickly while using the system, which would +erase everything in memory and all data up to that point and re-load the software from +scratch. When loading is activated application software is read from floppies. + +The softwares are not point and click auto-generation type conversational CAD/CAM +applications. The earlier 'non-Symbolic' software requires knowledge of programming in APT +and other languages of the era. The 'Symbolic' software has menus and asks questions and +the blanks must be filled in correctly. The graphics are mostly made of lines but are +sufficient to complete the task easily. Efficient and effective use of this system +requires deep knowledge of CNC Machining techniques (Turning/Milling etc) and a +good understanding of machining processes and procedures. With correct usage this system +can be used to create CNC G-Code programs for any part that can be manufactured on a +CNC Machine. Because the system is made in Japan in the early 80's and the manuals are +very technical it also requires some skill in deciphering Japanese-English translated +technical texts to understand how to use it properly. + +The box housing everything is 20" wide by 20" deep by 12" high and weighs +approximately 40 pounds. Power input is 85VAC to 110VAC. For the non-US and +non-Japanese markets a separate dedicated power supply is provided and is 12" +wide by 8" deep by 10" high and weighs approximately 20 pounds. + +A number of optional peripherals can connect to it including a Fanuc Printer, +Fanuc PPR Unit (Paper tape Puncher/Reader with built-in printer), Fanuc Program +File (containing a 20MB HDD, two 8" floppy drives and two RS232 ports), Fanuc Cassette +Adapter, XY Plotter (A3 or A1), Fanuc Digitizing Tablet (A3 or A0) and Fanuc I/O Selector Box. + +The P-G System has an internal 12" monitor and dual 5 1/4" floppy drives. +The first model had a 12" monochrome green monitor. In 1985 a color version was released. +In 1986 another model was released called the Mark II using dual 3 1/2" floppy drives. + +The screen resolution is 512 x 384 pixels. It can display 64 characters x 24 lines. + +The floppy format is custom. Floppies are double sided double density and +regular PC DSDD 360k floppies can be used after they are formatted using the +P-G System. +The floppy geometry is 40 tracks, 16 sectors per track, 256 bytes per sector +and 2 sides for a total storage capacity of 327680 bytes. +The floppy drives are typical PC-type 5 1/4" 360k drives and were manufactured +by Y-E DATA, model YD-580. + +The 5 1/4" floppy disks can be backed-up and imaged using a DOS program called ImageDisk +which is available here..... +http://www.classiccmp.org/dunfield/img/index.htm +With a 5 1/4" HD floppy drive, in the GUI in settings change the number of +cylinders to 40, translate speed 300 -> 250 (to read a DD disk on a HD drive). +On the main menu press R to Read, type a file-name and press enter, press enter +again to skip the comment. Press enter again and it will read the disk and save +it to the HDD. + +The following is a complete list of software titles available. +The info is taken from a glossy sales brochure printed in July 1985. +Other versions probably exist so this list is not final. +* denotes it is dumped. All other titles are not dumped and are needed. + +Language Input - + + Title Part Number + -------------------------------- + FAPT TURN A08B-0033-J600#E + FAPT CUT A08B-0033-J620#E + FAPT MILL A08B-0033-J640#E + FAPT DIE-II A08B-0033-J660#E + FAPT PUNCH-I A08B-0033-J520#E + FAPT PUNCH-II A08B-0033-J700#E + FAPT HELICAL A08B-0033-J642#E + FAPT POST A08B-0033-H642#E + *FAPT POST A08B-0031-H630 Edition C 85/1/31 + + +Graphic Input - + + Title Part Number + -------------------------------------- + *Symbolic FAPT TURN A08B-0033-J800#E Edition B V02 L03 841116 + Symbolic FAPT MILL A08B-0033-J840#E + Symbolic FAPT DRILL A08B-0033-J860#E + Symbolic FAPT CUT A08B-0033-J820#E + FAPT DIGITIZER A08B-0033-J510#E + ++ Symbolic FAPT TURN was available in English, German, French, Dutch, Finnish, +and Swedish versions. Currently only the English version is archived. + + +Support System - + + Title Part Number + ------------------------------- + *FAPT TRACER A08B-0033-H620#E Edition B V02 L02 841108 + *FAPT TEACHER A08B-0033-J610#E Edition B L02 V01 841101 + *FAPT DOCTOR A08B-0033-J600#E Edition B V01 L03 841108 + + +The software listed above with (*) have been tested on both mono and color versions and works fine. +Note: To initiate booting from the floppy drive hold down the LOAD key for 3-5 seconds. + +The software for the Fanuc System P-Model G is extremely rare now and very difficult to find. +If you do have any of these wanted software titles or any manuals listed below and want to help +please contact me (Guru) via http://mamedev.org/contact.html + +The following is a complete list of manuals available for the first edition of the +Fanuc System P-Model G released in 1983. The info is taken from a glossy sales brochure +printed in July 1985. There were other manuals released later for the Mark II and +updated manuals (each with a different part number). +The manuals were available in Japanese and English. The part numbers listed here +are English versions, denoted by the E at the end of the part number. +* denotes these manuals are secured and available in PDF format. + +Description - + + Title Part Number + --------------------------------------- + FAPT TURN/MILL Description B-54102E + FAPT CUT Description B-54103E + FAPT PUNCH-I Description B-54104E + FAPT TRACER Description B-54106E + FAPT DIGITIZER Description B-54107E + FAPT DIE-II Description B-54121E + Symbolic FAPT Description B-54131E + + +Operator's Manual - + + Title Part Number + ---------------------------------------------------------- + *System P-Model G Operator's Manual B-54111E/03 + System P-Model G Mark II Operator's Manual B-66014E + *System P-Model G Operator's Manual Supplement B-54112E/03-1 + FAPT TURN/MILL Operator's Manual B-54112E + FAPT CUT Operator's Manual B-54113E + FAPT PUNCH-I Operator's Manual B-54114E + FAPT PUNCH-II Operator's Manual B-54115E + *FAPT TRACER Operator's Manual B-54116E/03 + FAPT DIGITIZER Operator's Manual B-54117E + *FAPT Universal POST Operator's Manual B-54118E/02 + FAPT DIE-II Operator's Manual (Volume 1) B-54122E + FAPT DIE-II Operator's Manual (Volume 2) B-54122E-1 + *FAPT TEACHER Operator's Manual B-54126E/01 + 220S FAPT MILL Operator's Manual B-54127E + *Symbolic FAPT TURN Operator's Manual B-54132E/01 + Symbolic FAPT MILL Operator's Manual B-54134E + Symbolic FAPT CUT Operator's Manual B-54136E + Symbolic FAPT DRILL Operator's Manual B-54138E + *Symbolic FAPT TURN Operator's Manual B-66025E/01 (for System P Mark II) + + +Others - + + Title Part Number + ----------------------------------------------------- + *Symbolic FAPT TURN Operator's Handbook B-53034E (for System P Model D) + FANUC CASSETTE Operator's Manual B-53484E + FAPT DIE-II Part program examples B-54123E + FAPT TURN/MILL/CUT Part program examples B-54128E + Symbolic FAPT TURN Operator's Handbook B-54133E + System P-Model G Operator's Handbook B-54158E + *System P-Model G Maintenance Manual B-54159E/01 + *FANUC PPR Operator's Manual B-54584E/01 + +Note the handbooks are pocket-sized 8" long by 3 1/2" wide and approximately 50 pages. + + +The unit has it's own dedicated keyboard with many special keys. +The keyboard clips to the main box and is the top cover when the main box is transported. +The keyboard layout is shown below. + +|------------------------------------------------------------------------------| +| | +| LOAD F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 R0 R1 R2 R3 | +| | +| | +| ! " # $ % & ' ( ) = | +| K0 1 2 3 4 5 6 7 8 9 0 - ^ Y DEL 7 8 9 + | (Y is Japanese Yen sign) +| | +| | +| K1 CAN Q W E R T Y U I O P @ [ NL BS 4 5 6 - | (NL means NEXT LINE, BS is backspace) +| | (NL is equivalent to return or enter and) +| + * | (forces the cursor to move to the next data entry point) +| K2 UC A S D F G H J K L ; : ] UC 1 2 3 x | (UC is uppercase) +| | +| < > ? | +| K3 LC Z X C V B N M , . / - LC 0 , . / | (LC is lowercase) +| | +| | +| _S__P__A__C__E__B__A__R_ _N__L_ | +| | +|------------------------------------------------------------------------------| + +On the numeric keypad there are directional arrows on numbers 1 2 3 4 6 7 8 9 +1 3 7 9 have arrows pointing South West, South East, North West, North East. +2 4 6 8 have arrows pointing down, left, right and up. +5 is the center and has no additional markings on it. +Number 0 has an anti-clockwise 180 degrees arc with an arrow at the end and . has +a clockwise 180 degrees arc with an arrow at the end. +These keys are the 'Symbolic' keys. + +The F-keys and R-keys are programmed by the software that is running on the system. +The F-keys act like SPDT switches and can be toggled either off or on. +When they are on, a LED in the center of the key lights. +For Symbolic FAPT TURN these keys are pre-programmed as follows..... + +F0 - ON: Sets the backwards direction when using the R1 key. + OFF: Sets the forwards direction when using the R1 key. Default is OFF. +F1 - ON: Makes the whole screen the graphic area. + OFF: Auto-calc the graphic area so the graphic does not overlap the text. Default is OFF. +F2 - ON: Shows the parts figure (graphics). Default is ON. + OFF: Does not show the parts figure. +F3 - ON: Display the NC G-Code data on screen. Default is ON. + OFF: Does not display the NC G-Code data on screen. +F4 - ON: Printer ON. + OFF: Printer OFF. The printer can be switched on or off any time. When enabled + everything displayed on the screen will also print on the printer. Default is OFF. +F5 - ON: Stops execution of the NC G-Code data before each process begins. Keyboard input additions + can also be done at this time. To continue press NL. + OFF: Program execution continues to the end. Default is OFF. +F6 - ON: Outputs the NC G-Code data to a separately selected medium (floppy/cassette or paper tape) + OFF: No output to additional medium. Default is OFF. +F7 - ON: Stops each time a line of NC G-Code data is output. This is equivalent to Single Block on a CNC Machine. + To continue press NL. + OFF: Program execution continues to the end. Default is OFF. +F8 - +F9 - +F10- ON: Sends the part figure graphic and NC G-Code data to the XY plotter + OFF: No output to XY plotter +F11- +F12- +F13- +F14- +F15- + +The function of the R-keys changes depending on the application and the menu shown on the screen. +The R-keys are used for tasks within the current screen so the function of the R-keys is always +displayed on screen at all times. +The initial Symbolic FAPT TURN settings for the R-keys are.... +R0 - FAPT Execution +R1 - Family Program +R2 - Setting +R3 - Auxiliary Work + + +Box Layout (top view) +---------- + +A08B-0033-B001 (Color Version from 1985) +A08B-0031-B001 (Mono Version from 1983) +A08B-0031-B002 (Mono Version from 1984) +|--------------------------------------------| +| ------------MAIN PCB---------------------- | +| -----------SUB-PCB----------- | | +| | | +| |-----------------------| | | +| | | | | +| | FANUC 12" COLOR | P | +| | CRT UNIT | O | +| | A61L-0001-0078 | W | +| | | E | +| | | |---------| R | +| | | |FANUC | | | +| | OR | |FDD UNIT | P | +| | | |A87l-0001| C | +| | | |-0026 | B | +| | FANUC 12" MONO | | | | | +| | CRT UNIT | |5 1/4" | | | +| | A61L-0001-0073 | |FLOPPY | | +| | | |DRIVES | | +| | | |x2 | | +| |-----------------------| |---------| | +|--------------------------------------------| +Notes: + The CRT tube in the color version is a Matsushita 320DHB22. Input voltage is 110V AC + The CRT tube in the mono version is a Hitachi 310KEB31. Input voltage is 24V DC and B+ is 11.0V + The mono version does not have a SUB PCB + The power PCB is identical for both color and mono versions + + +Main PCB Layout (for color version) +--------------- + +A20B-1000-0710/03B +|-------------------------------------------| +| CNF CNE CND CNC CNB CNA | +| VR1 ^ | +| JUMPERS XXXXXXXXX| +| % MB15541 XXXXXXXXXXXXXXXXXX| +| XXXXXXXXXXXXXXXXXX| +| 8087-3 D8253 XXXXXXXXXXXXXXXXXX| +| 8086-2 D765 D8253 XXXXXXXXX| +| D8257 | +|15MHz D8259 D8259 D8251 D8251 | +|D8284 040_001A.13A D8251 D8251 | +| 040_002A.15A VR2 CN2 CN1 | +| CN7 CN6 CN5 CN4 CN3 | +|-------------------------------------------| +Notes: + D8086 - Intel 8086-2 CPU. Clock input 5.000MHz [15/3] + D8087 - Intel 8087-3 x87 Floating-Point Co-Processor. Clock input 5.000MHz [15/3] + XXXXXXX - Fujitsu MB8265-15 65536 x1-bit DRAM (72 chips total) + MB15541 - Fujitsu MB15541 Custom Chip + D765 - NEC D765 Single/Double Density Floppy-Disk Controller. Clock input 4.000MHz [16/4] + D8251 - Intel D8251 Programmable Communications Interface (USART) + D8253 - NEC D8253 Programmable Interval Timer. Clock input 1.25MHz [15/12] + D8257 - NEC D8257 Programmable DMA Controller. Clock input 3.000MHz [15/5] + D8259 - NEC D8259 Programmable Interrupt Controller + D8284 - Intel D8284 Clock Generator and Driver for 8086/8088 Processors + A40_00* - Fujitsu MBM2764 8k x8-bit EPROM + VR1 - Potentiometer to adjust pulse width of floppy disk control unit + VR2 - Potentiometer to adjust screen brightness + ^ - 3 chips marked Y-E Data Fujitsu + MB4393 + MB14324 + MB14323 + % - Unknown 20-pin Ceramic DIP chip with heat-sink (likely to be Intel 8288 Bus Controller) + CNA - 50-pin flat cable joining to Sub PCB + CNB - 50-pin flat cable joining to Sub PCB + CNC - 6-pin power cable joining to Sub PCB + CND - 34-pin flat cable joining to FDD Unit + CNE - Fanuc Honda MR-50 50-pin female connector for factory testing (not used) + CNF - Power input connector + CN1 - 25-pin Female D-type connector. (for RS232 external peripherals \ CNC Machine, + CN2 - 25-pin Female D-type connector. (for RS232 external peripherals | PPR Unit, X-Y Plotter, + CN3 - 25-pin Female D-type connector. (for RS232 external peripherals | Tablet, + CN4 - 25-pin Female D-type connector. (for RS232 external peripherals / Cassette Adapter etc (connections in any order) + CN5 - Fanuc Honda MR-50 50-pin female connector (probably for external connection of the Fanuc Program File Unit) + CN6 - Fanuc Honda MR-20 20-pin female connector for the keyboard + CN7 - Fanuc Honda MR-20 20-pin male connector. Specification says 'not used'. Video signals are present on + the connector so it is probably used for an external monitor + JUMPERS - 15 2-pin jumpers labelled S1 to S15. S2, S3 & S4 are open and the others are shorted + + +Sub PCB Layout (for color version) +-------------- + +A20B-1000-0720/02B +|--------------------------------| +| CNA CNB CNC CND | +| | +| MB15542 CNE| +| | +| HD6845S D8085| +| 16MHz | +| | +| X | +| XXXXXXXX | +| XXXXXXXX | +| XXXXXXXX 6264 A41_010B.28B| +| 6264 A41_020A.30B| +|--------------------------------| +Notes: + D8085 - NEC D8085A-2 CPU. Clock input 8.000MHz [16/2] + Note 8085 has internal /2 divider so actual clock speed is 4.000MHz + HD6845S - Hitachi HD6845S / HD46505S CRT Controller. Clock input 2.000MHz [16/8] + 6264 - Hitachi HM6264P-15 8k x 8-bit SRAM + XXXXXXX - Fujitsu MB8265-15 65536 x1-bit DRAM (25 chips total) + MB15542 - Fujitsu MB15542 Custom Chip + A41_010B- Intel D27128 16k x8-bit EPROM + A42_020A- Hitachi 27256G 32k x8-bit EPROM + CNA - 50-pin flat cable joining to Main PCB + CNB - 50-pin flat cable joining to Main PCB + CNC - 6-pin power cable joining to Main PCB + CND - 20-pin flat cable joining to CRT Unit (video output) + CNE - Fanuc Honda MR-50 50-pin male connector for factory testing (not used) + HSync - 22.7273kHz + VSync - 54.6330Hz + + +Main PCB Layout (for mono version) +--------------- + +A20B-1000-0140/09F +|-------------------------------------------| +| CN10 CN9 VR1 CN8 | +| 6116 S3 ^ | +| A22_020B.5G % D765 XXXXXXXXX| +| 16MHz MB15542 MB15541 D8257 XXXXXXXXX| +| S4 15MHz D8284 XXXXXXXXX| +| 8085-2 HD6845S 8087 D8259 XXXXXXXXX| +| CN12 A21_010F.17D 8086 D8253 A25_001A.33E| +| CN11 S2 A25_002A.35E | +| S1 D8251 D8251 D39 | +| D8251 D8251 S5 S6 S7| +| YYYYYYYYY VR2 D8253 CN2 CN1 | +| CN7 CN6 CN5 CN4 CN3 | +|-------------------------------------------| +Notes: + D8086 - Intel 8086-2 CPU. Clock input 5.000MHz [15/3] + D8087 - Intel 8087-3 x87 Floating-Point Co-Processor. Clock input 5.000MHz [15/3] + D8085 - NEC D8085A-2 CPU. Clock input 8.000MHz [16/2] + Note 8085 has internal /2 divider so actual clock speed is 4.000MHz + HD6845S - Hitachi HD6845S / HD46505S CRT Controller. Clock input 2.000MHz [16/8] + XXXXXXX - Fujitsu MB8265-15 65536 x1-bit DRAM (36 chips total) + YYYYYYY - Fujitsu MB8265-15 65536 x1-bit DRAM (9 chips total) + 6116 - Hitachi HM6116P-3 2k x 8-bit SRAM + MB15541 - Fujitsu MB15541 Custom Chip + MB15542 - Fujitsu MB15542 Custom Chip + D765 - NEC D765 Single/Double Density Floppy-Disk Controller. Clock input 4.000MHz [16/4] + D8251 - Intel D8251 Programmable Communications Interface (USART) + D8253 - NEC D8253 Programmable Interval Timer. Clock input 1.25MHz [15/12] + D8257 - NEC D8257 Programmable DMA Controller. Clock input 3.000MHz [15/5] + D8259 - NEC D8259 Programmable Interrupt Controller + D8284 - Intel D8284 Clock Generator and Driver for 8086/8088 Processors + A2* - Hitachi HN482764G 8k x8-bit EPROM + VR1 - Potentiometer to adjust pulse width of floppy disk control unit + VR2 - Potentiometer to adjust screen brightness + ^ - 3 chips marked Y-E Data Fujitsu + MB4393 + MB14324 + MB14323 + % - Unknown 20-pin Ceramic DIP chip with heat-sink (likely to be Intel 8288 Bus Controller) + CN1 - 25-pin Female D-type connector. (for RS232 external peripherals \ CNC Machine, + CN2 - 25-pin Female D-type connector. (for RS232 external peripherals | PPR Unit, X-Y Plotter, + CN3 - 25-pin Female D-type connector. (for RS232 external peripherals | Tablet, + CN4 - 25-pin Female D-type connector. (for RS232 external peripherals / Cassette Adapter etc (connections in any order) + CN5 - Fanuc Honda MR-50 50-pin female connector (probably for external connection of the Fanuc Program File Unit) + CN6 - Fanuc Honda MR-20 20-pin female connector for the keyboard + CN7 - Fanuc Honda MR-20 20-pin male. Specification says 'not used' and no signals are present on the connector + CN8 - 20-pin flat cable joining to CRT Unit (video output) + CN9 - 34-pin flat cable joining to FDD Unit + CN10 - Power input connector + CN11/12 - Fanuc Honda MR-50 50-pin female connector for factory testing (not used) + Sx - 7 2-pin jumpers (S1 to S7). S2, S3 & S4 are open and the others are shorted + D39 - Bank of 8 2-pin jumpers vertically orientated. 2 and 7 are shorted and the others are open + + +Block Diagram +------------- +Below is the block diagram shown in the System P-Model G Maintenance Manual, relating to the mono version. +The arrows denote direction of data flow. + + |-------| |--------| |----------------| + |Sub CPU| |Main CPU|<---->|Math Coprocessor| + |-------| |--------| |----------------| + /\ /\ /\ + | | | + | \/ \/ + |-----| | |------------------| + |EPROM|<--->| /\ + |-----| | |---------------| | |----------------| + | | Common memory |<---------------------------------->|<--->|RS232C interface|---CN1 + |<-------->|===============| | |----------------| + | /-->| Graphic memory|------| | + | | |---------------| | | |----------------| + | | | |--------| |<--->|RS232C interface|---CN2 + | | | | BOOT |<-------->| |----------------| + | | | | EPROM | | + | | |----------------| | |--------| | |----------------| + |<-----|-->|Character memory|--| | |<--->|RS232C interface|---CN3 + | |-->|----------------| | | |--------| | |----------------| + | | | | |Main RAM|<-------->| + | | | | |--------| | |----------------| + | | | | |<--->|RS232C interface|---CN4 + | | | | | |----------------| +|---------| | | \/ \/ | +|Keyboard | \/ \---|---------------------------| | |-----------------| CN9 |--------| +|interface|<->|<-------->| CRT control circuit | |<--->|Floppy controller|---O---|FDD UNIT| +|----|----| |-------------|-------------| | |-----------------| |--------| + | | | + | | \/ + O CN6 O CN8 O CN5 + | | + | | + |---|----| |----|----| + |Keyboard| | Screen | + |--------| |---------| + + TODO: + - Is the VRAM hookup anything like correct? + - Hookup enough keyboard to get it to boot a floppy, the FAPT DOCTOR + program will be invaluable to answering many questions. + - Shared RAM is 8k, but there are 2 6264s on the sub board. Is shared RAM + banked? + + To boot a floppy put "bp fc5fa,1,{ip=c682;g}" and "bp fc6d7,1,{ip=c755;g}" + into the debugger. + + At NMI: f8008 must have bit 7 clear and bit 6 set (e008 on 8085) + f8009 must not equal 0x01 (e009 on 8085) + + 8085 sets f8008 to keyboard row 0 AND 0xf3 + " " f8009 to keyboard row 1 + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "cpu/i8085/i8085.h" +#include "machine/ram.h" +#include "machine/i8251.h" +#include "machine/i8257.h" +#include "machine/upd765.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/upd765.h" +#include "video/mc6845.h" +#include "formats/imd_dsk.h" + +#define MAINCPU_TAG "maincpu" +#define SUBCPU_TAG "subcpu" +#define USART0_TAG "usart0" +#define USART1_TAG "usart1" +#define USART2_TAG "usart2" +#define USART3_TAG "usart3" +#define PIT0_TAG "pit0" +#define PIT1_TAG "pit1" +#define PIC0_TAG "pic0" +#define PIC1_TAG "pic1" +#define DMAC_TAG "dmac" +#define CRTC_TAG "crtc" +#define FDC_TAG "fdc" +#define SCREEN_TAG "screen" +#define SHARED_TAG "shared" +#define CHARGEN_TAG "chargen" + +class fanucspmg_state : public driver_device +{ +public: + fanucspmg_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, MAINCPU_TAG) + , m_subcpu(*this, SUBCPU_TAG) + , m_usart0(*this, USART0_TAG) + , m_usart1(*this, USART1_TAG) + , m_usart2(*this, USART2_TAG) + , m_usart3(*this, USART3_TAG) + , m_pit0(*this, PIT0_TAG) + , m_pit1(*this, PIT1_TAG) + , m_pic0(*this, PIC0_TAG) + , m_pic1(*this, PIC1_TAG) + , m_dmac(*this, DMAC_TAG) + , m_crtc(*this, CRTC_TAG) + , m_fdc(*this, FDC_TAG) + , m_shared(*this, SHARED_TAG) + , m_chargen(*this, CHARGEN_TAG) + { } + + required_device m_maincpu; + required_device m_subcpu; + required_device m_usart0; + required_device m_usart1; + required_device m_usart2; + required_device m_usart3; + required_device m_pit0; + required_device m_pit1; + required_device m_pic0; + required_device m_pic1; + required_device m_dmac; + required_device m_crtc; + required_device m_fdc; + required_shared_ptr m_shared; + required_memory_region m_chargen; + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(shared_r); + DECLARE_WRITE8_MEMBER(shared_w); + DECLARE_READ8_MEMBER(vram1_r); + DECLARE_WRITE8_MEMBER(vram1_w); + DECLARE_READ8_MEMBER(vram2_r); + DECLARE_WRITE8_MEMBER(vram2_w); + DECLARE_WRITE8_MEMBER(vram_bank_w); + DECLARE_READ8_MEMBER(vblank_ack_r); + DECLARE_WRITE8_MEMBER(vbl_ctrl_w); + DECLARE_WRITE8_MEMBER(keyboard_row_w); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(video_ctrl_w); + DECLARE_READ8_MEMBER(fdcdma_r); + DECLARE_WRITE8_MEMBER(fdcdma_w); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE8_MEMBER(dma_page_w); + + DECLARE_READ16_MEMBER(magic_r); + + DECLARE_WRITE_LINE_MEMBER(vsync_w); + DECLARE_WRITE_LINE_MEMBER(tc_w); + DECLARE_WRITE_LINE_MEMBER(hrq_w); + + MC6845_UPDATE_ROW(crtc_update_row); + MC6845_UPDATE_ROW(crtc_update_row_mono); + + DECLARE_DRIVER_INIT(fanucspmg); + + UINT8 m_vram[24576]; + UINT8 m_video_ctrl; + +private: + virtual void machine_reset(); + INT32 m_vram_bank; + UINT8 m_vbl_ctrl; + UINT8 m_keyboard_row; + UINT8 m_vbl_stat; + UINT8 m_dma_page; +}; + +DRIVER_INIT_MEMBER(fanucspmg_state, fanucspmg) +{ + memset(m_vram, 0, sizeof(m_vram)); + + save_item(NAME(m_vram)); + save_item(NAME(m_vram_bank)); + save_item(NAME(m_vbl_ctrl)); + save_item(NAME(m_keyboard_row)); + save_item(NAME(m_video_ctrl)); +} + +READ8_MEMBER(fanucspmg_state::shared_r) +{ + return m_shared[offset]; +} + +WRITE8_MEMBER(fanucspmg_state::shared_w) +{ + m_shared[offset] = data; +} + +READ8_MEMBER(fanucspmg_state::get_slave_ack) +{ + if(offset == 7) + return m_pic1->acknowledge(); + + return 0x00; +} + +WRITE_LINE_MEMBER(fanucspmg_state::tc_w) +{ + m_fdc->tc_w(state); +} + +WRITE_LINE_MEMBER(fanucspmg_state::hrq_w) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state); + m_dmac->hlda_w(state); +} + +READ8_MEMBER(fanucspmg_state::fdcdma_r) +{ + return m_fdc->dma_r(); +} + +WRITE8_MEMBER(fanucspmg_state::fdcdma_w) +{ + m_fdc->dma_w(data); +} + +WRITE8_MEMBER(fanucspmg_state::dma_page_w) +{ + floppy_image_device *floppy0 = m_fdc->subdevice("0")->get_device(); + floppy_image_device *floppy1 = m_fdc->subdevice("1")->get_device(); + // verify + floppy0->mon_w(!(data & 2)); + floppy1->mon_w(!(data & 2)); + + m_dma_page = (data >> 2) & 0xf; +} + +READ16_MEMBER(fanucspmg_state::magic_r) +{ + return 0x0041; // 31 = memory error +} + +static ADDRESS_MAP_START(maincpu_mem, AS_PROGRAM, 16, fanucspmg_state) + AM_RANGE(0x00000, 0x7ffff) AM_RAM // main RAM + + AM_RANGE(0x80000, 0x81fff) AM_RAM // believed to be shared RAM with a CPU inside the Program File + AM_RANGE(0x88000, 0x88001) AM_NOP // Program File "ready" bit + + AM_RANGE(0xf0000, 0xf0003) AM_DEVREADWRITE8(PIC0_TAG, pic8259_device, read, write, 0x00ff) + AM_RANGE(0xf0004, 0xf0007) AM_DEVICE8(FDC_TAG, upd765a_device, map, 0x00ff) + AM_RANGE(0xf0008, 0xf000f) AM_DEVREADWRITE8(PIT0_TAG, pit8253_device, read, write, 0x00ff) + AM_RANGE(0xf0010, 0xf0011) AM_DEVREADWRITE8(USART0_TAG, i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xf0012, 0xf0013) AM_DEVREADWRITE8(USART0_TAG, i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0xf0014, 0xf0015) AM_DEVREADWRITE8(USART1_TAG, i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xf0016, 0xf0017) AM_DEVREADWRITE8(USART1_TAG, i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0xf0018, 0xf0019) AM_DEVREADWRITE8(USART2_TAG, i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xf001a, 0xf001b) AM_DEVREADWRITE8(USART2_TAG, i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0xf001c, 0xf001d) AM_DEVREADWRITE8(USART3_TAG, i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xf001e, 0xf001f) AM_DEVREADWRITE8(USART3_TAG, i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0xf0020, 0xf0029) AM_DEVREADWRITE8(DMAC_TAG, i8257_device, read, write, 0xffff) + AM_RANGE(0xf0042, 0xf0043) AM_READ(magic_r) + AM_RANGE(0xf0046, 0xf0047) AM_WRITE8(dma_page_w, 0x00ff) + AM_RANGE(0xf0048, 0xf004f) AM_DEVREADWRITE8(PIT1_TAG, pit8253_device, read, write, 0x00ff) + AM_RANGE(0xf2000, 0xf2003) AM_DEVREADWRITE8(PIC1_TAG, pic8259_device, read, write, 0x00ff) + + AM_RANGE(0xf8000, 0xf9fff) AM_READWRITE8(shared_r, shared_w, 0xffff) + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION(MAINCPU_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(maincpu_io, AS_IO, 16, fanucspmg_state) +ADDRESS_MAP_END + +WRITE_LINE_MEMBER(fanucspmg_state::vsync_w) +{ + if ((m_vbl_ctrl & 0x08) == 0x08) + { + if (state == ASSERT_LINE) + { + m_subcpu->set_input_line(I8085_RST75_LINE, ASSERT_LINE); + } + } + + m_vbl_stat = (state == ASSERT_LINE) ? 1 : 0; +} + +READ8_MEMBER(fanucspmg_state::vram1_r) +{ + return m_vram[m_vram_bank + offset]; +} + +WRITE8_MEMBER(fanucspmg_state::vram1_w) +{ + m_vram[m_vram_bank + offset] = data; +} + +READ8_MEMBER(fanucspmg_state::vram2_r) +{ + return m_vram[m_vram_bank + offset + 0x600]; +} + +WRITE8_MEMBER(fanucspmg_state::vram2_w) +{ + m_vram[m_vram_bank + offset + 0x600] = data; +} + +WRITE8_MEMBER(fanucspmg_state::vram_bank_w) +{ + m_vram_bank = (data & 7) * 0xc00; +} + +READ8_MEMBER(fanucspmg_state::vblank_ack_r) +{ + m_subcpu->set_input_line(I8085_RST75_LINE, CLEAR_LINE); + + return 0xff; +} + +// bit 1 is unknown +// bit 3 appears to enable vblank IRQs +WRITE8_MEMBER(fanucspmg_state::vbl_ctrl_w) +{ + m_vbl_ctrl = data; +} + +// row 2: raising a bit toggles the corresponding bit at 500a +// row 3: raising a bit toggles the corresponding bit at 500b +WRITE8_MEMBER(fanucspmg_state::keyboard_row_w) +{ + m_keyboard_row = data; +} + +READ8_MEMBER(fanucspmg_state::keyboard_r) +{ + return 0; +} + +// bit 0 is set when clearing VRAM +// bit 1 is display enable +WRITE8_MEMBER(fanucspmg_state::video_ctrl_w) +{ + m_video_ctrl = data; +} + +static ADDRESS_MAP_START(subcpu_mem, AS_PROGRAM, 8, fanucspmg_state) + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION(SUBCPU_TAG, 0) + + AM_RANGE(0x4000, 0x45ff) AM_READWRITE(vram1_r, vram1_w) + AM_RANGE(0x4800, 0x4dff) AM_READWRITE(vram2_r, vram2_w) + + AM_RANGE(0x5000, 0x5000) AM_DEVREADWRITE(CRTC_TAG, mc6845_device, status_r, address_w) + AM_RANGE(0x5001, 0x5001) AM_DEVREADWRITE(CRTC_TAG, mc6845_device, register_r, register_w) + AM_RANGE(0x5008, 0x5008) AM_WRITE(keyboard_row_w) + AM_RANGE(0x5009, 0x5009) AM_READ(keyboard_r) + AM_RANGE(0x500a, 0x500b) AM_WRITENOP // keyboard rows 2 and 3 control what's written here. dip switches? + AM_RANGE(0x500c, 0x500c) AM_WRITE(vbl_ctrl_w) + AM_RANGE(0x500d, 0x500d) AM_WRITE(vram_bank_w) + AM_RANGE(0x500e, 0x500e) AM_READ(vblank_ack_r) + AM_RANGE(0x5018, 0x5018) AM_WRITE(video_ctrl_w) + + AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE(SHARED_TAG) // shared RAM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( fanucspmg ) +INPUT_PORTS_END + +void fanucspmg_state::machine_reset() +{ + m_vbl_ctrl = 0; + m_vram_bank = 0; + m_video_ctrl = 0; + m_dma_page = 0; +} + +READ8_MEMBER(fanucspmg_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset | (m_dma_page << 16)); +} + +WRITE8_MEMBER(fanucspmg_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.write_byte(offset | (m_dma_page << 16), data); +} + +MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) +{ + UINT32 *p = &bitmap.pix32(y); + int i; + UINT8 *chargen = m_chargen->base(); + + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ma + i ); + + if (m_video_ctrl & 0x02) + { + if (offset <= 0x5ff) + { + UINT8 chr = m_vram[offset + 0x600]; + UINT8 attr = m_vram[offset]; + UINT8 data = chargen[ chr + (ra * 256) ]; + UINT32 fg = 0; + UINT32 bg = 0; + + if (attr & 0x20) fg |= 0xff0000; + if (attr & 0x40) fg |= 0x00ff00; + if (attr & 0x80) fg |= 0x0000ff; + + *p++ = ( data & 0x01 ) ? fg : bg; + *p++ = ( data & 0x02 ) ? fg : bg; + *p++ = ( data & 0x04 ) ? fg : bg; + *p++ = ( data & 0x08 ) ? fg : bg; + *p++ = ( data & 0x10 ) ? fg : bg; + *p++ = ( data & 0x20 ) ? fg : bg; + *p++ = ( data & 0x40 ) ? fg : bg; + *p++ = ( data & 0x80 ) ? fg : bg; + } + } + else + { + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + } + } +} + +MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row_mono ) +{ + UINT32 *p = &bitmap.pix32(y); + int i; + UINT8 *chargen = m_chargen->base(); + + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ma + i ); + + if (m_video_ctrl & 0x02) + { + if (offset <= 0x5ff) + { + UINT8 chr = m_vram[offset + 0x600]; +// UINT8 attr = m_vram[offset]; + UINT8 data = chargen[ chr + (ra * 256) ]; + UINT32 fg = 0xff00; + UINT32 bg = 0; + + *p++ = ( data & 0x01 ) ? fg : bg; + *p++ = ( data & 0x02 ) ? fg : bg; + *p++ = ( data & 0x04 ) ? fg : bg; + *p++ = ( data & 0x08 ) ? fg : bg; + *p++ = ( data & 0x10 ) ? fg : bg; + *p++ = ( data & 0x20 ) ? fg : bg; + *p++ = ( data & 0x40 ) ? fg : bg; + *p++ = ( data & 0x80 ) ? fg : bg; + } + } + else + { + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + *p++ = 0; + } + } +} + +static SLOT_INTERFACE_START( fanuc_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( fanucspmg_state::floppy_formats ) + FLOPPY_IMD_FORMAT +FLOPPY_FORMATS_END + +static MACHINE_CONFIG_START( fanucspmg, fanucspmg_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, I8086, XTAL_15MHz/3) + MCFG_CPU_PROGRAM_MAP(maincpu_mem) + MCFG_CPU_IO_MAP(maincpu_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(PIC0_TAG, pic8259_device, inta_cb) + + MCFG_CPU_ADD(SUBCPU_TAG, I8085A, XTAL_16MHz/2/2) + MCFG_CPU_PROGRAM_MAP(subcpu_mem) + + MCFG_DEVICE_ADD(USART0_TAG, I8251, 0) + MCFG_DEVICE_ADD(USART1_TAG, I8251, 0) + MCFG_DEVICE_ADD(USART2_TAG, I8251, 0) + MCFG_DEVICE_ADD(USART3_TAG, I8251, 0) + + MCFG_DEVICE_ADD(PIT0_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_15MHz/12) + MCFG_PIT8253_CLK1(XTAL_15MHz/12) + MCFG_PIT8253_CLK2(XTAL_15MHz/12) + MCFG_DEVICE_ADD(PIT1_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_15MHz/12) + MCFG_PIT8253_CLK1(XTAL_15MHz/12) + MCFG_PIT8253_CLK2(XTAL_15MHz/12) + + MCFG_DEVICE_ADD(DMAC_TAG, I8257, XTAL_15MHz / 5) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(fanucspmg_state, hrq_w)) + MCFG_I8257_OUT_TC_CB(WRITELINE(fanucspmg_state, tc_w)) + MCFG_I8257_IN_MEMR_CB(READ8(fanucspmg_state, memory_read_byte)) + MCFG_I8257_OUT_MEMW_CB(WRITE8(fanucspmg_state, memory_write_byte)) + MCFG_I8257_IN_IOR_0_CB(READ8(fanucspmg_state, fdcdma_r)) + MCFG_I8257_OUT_IOW_0_CB(WRITE8(fanucspmg_state, fdcdma_w)) + + MCFG_PIC8259_ADD(PIC0_TAG, INPUTLINE("maincpu", 0), VCC, READ8(fanucspmg_state, get_slave_ack)) + MCFG_PIC8259_ADD(PIC1_TAG, DEVWRITELINE(PIC0_TAG, pic8259_device, ir7_w), GND, NULL) + + MCFG_UPD765A_ADD(FDC_TAG, true, true) + MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE(PIC0_TAG, pic8259_device, ir3_w)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE(DMAC_TAG, i8257_device, dreq0_w)) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":0", fanuc_floppies, "525dd", fanucspmg_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":1", fanuc_floppies, "525dd", fanucspmg_state::floppy_formats) + + MCFG_SCREEN_ADD( SCREEN_TAG, RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_15MHz, 640, 0, 512, 390, 0, 384 ) + MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, mc6845_device, screen_update ) + + MCFG_MC6845_ADD( CRTC_TAG, HD6845, SCREEN_TAG, XTAL_8MHz/2) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(fanucspmg_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(fanucspmg_state, vsync_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( fanucspmgm, fanucspmg ) + MCFG_DEVICE_REMOVE( CRTC_TAG ) + + MCFG_MC6845_ADD( CRTC_TAG, HD6845, SCREEN_TAG, XTAL_8MHz/2) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(fanucspmg_state, crtc_update_row_mono) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(fanucspmg_state, vsync_w)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( fanucspg ) + ROM_REGION(0x4000, MAINCPU_TAG, 0) + ROM_LOAD16_BYTE( "a40_001a.13a", 0x000000, 0x002000, CRC(1b8ac8ef) SHA1(309c081d25270e082ebf846b4f73cef76b52d991) ) + ROM_LOAD16_BYTE( "a40_002a.15a", 0x000001, 0x002000, CRC(587ae652) SHA1(ebc5a4c3d64ab9d6dd4d5355f85bc894e7294e17) ) + + ROM_REGION(0x4000, SUBCPU_TAG, 0) + ROM_LOAD( "a41_010b.28b", 0x000000, 0x004000, CRC(35a9714f) SHA1(5697b6c4db5adb5702dc1290ecc98758d5fab221) ) + + ROM_REGION(0x8000, CHARGEN_TAG, 0) + ROM_LOAD( "a42_020a.30b", 0x000000, 0x008000, CRC(33eb5962) SHA1(1157a72089ff77e8db9a9a8fcd0f6c32a1374f56) ) +ROM_END + +ROM_START( fanucspgm ) + ROM_REGION(0x4000, MAINCPU_TAG, 0) + ROM_LOAD16_BYTE( "a25_001a.33e", 0x000000, 0x002000, CRC(81159267) SHA1(f5d53cc6e929f57e8c3747f80fc74d4b1643222d) ) + ROM_LOAD16_BYTE( "a25_002a.35e", 0x000001, 0x002000, CRC(4fb82c4d) SHA1(eb75e9a2d3c8e4ad56a74624ee8c52c785bd0da6) ) + + ROM_REGION(0x4000, SUBCPU_TAG, 0) + ROM_LOAD( "a21_010f.17d", 0x000000, 0x002000, CRC(ef192717) SHA1(7fb3f7ca290d2437ae5956700f88c801018ce1cc) ) + + ROM_REGION(0x8000, CHARGEN_TAG, 0) + ROM_LOAD( "a22_020b.5g", 0x000000, 0x002000, CRC(7b5f8e20) SHA1(9de607e541d8aad2d1ea56321270bb8466b16e3d) ) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, fanucspg, 0, 0, fanucspmg, fanucspmg, fanucspmg_state, fanucspmg, "Fanuc", "System P Model G", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1983, fanucspgm, fanucspg, 0, fanucspmgm, fanucspmg, fanucspmg_state, fanucspmg, "Fanuc", "System P Model G (monochrome)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/fb01.c b/src/mame/drivers/fb01.c new file mode 100644 index 00000000000..88353f634f5 --- /dev/null +++ b/src/mame/drivers/fb01.c @@ -0,0 +1,228 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + Yamaha FB-01 + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/2151intf.h" +#include "machine/nvram.h" +#include "video/hd44780.h" +#include "machine/i8251.h" +#include "machine/clock.h" +#include "bus/midi/midi.h" +#include "fb01.lh" + + +class fb01_state : public driver_device +{ +public: + fb01_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_upd71051(*this, "upd71051") + , m_midi_thru(*this, "mdthru") + , m_ym2164_irq(CLEAR_LINE) + , m_upd71051_txrdy(CLEAR_LINE) + , m_upd71051_rxrdy(CLEAR_LINE) + { + } + + DECLARE_WRITE_LINE_MEMBER(write_usart_clock); + DECLARE_WRITE_LINE_MEMBER(midi_in); + DECLARE_WRITE_LINE_MEMBER(ym2164_irq_w); + DECLARE_WRITE_LINE_MEMBER(upd71051_txrdy_w); + DECLARE_WRITE_LINE_MEMBER(upd71051_rxrdy_w); + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_PALETTE_INIT(fb01); + +private: + required_device m_maincpu; + required_device m_upd71051; + required_device m_midi_thru; + int m_ym2164_irq; + int m_upd71051_txrdy; + int m_upd71051_rxrdy; + + void update_int(); +}; + + +static ADDRESS_MAP_START(fb01_mem, AS_PROGRAM, 8, fb01_state) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0xbfff) AM_RAM AM_SHARE("nvram") // 2 * 8KB S-RAM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(fb01_io, AS_IO, 8, fb01_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // 00-01 YM2164 + AM_RANGE(0x00, 0x00) AM_DEVWRITE("ym2164", ym2151_device, register_w) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("ym2164", ym2151_device, status_r, data_w) + + // 10-11 USART uPD71051C 4MHz & 4MHz / 8 + AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("upd71051", i8251_device, data_r, data_w) + AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("upd71051", i8251_device, status_r, control_w) + + // 20 PANEL SWITCH + AM_RANGE(0x20, 0x20) AM_READ_PORT("PANEL") + + // 30-31 HD44780A + AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("hd44780", hd44780_device, control_read, control_write) + AM_RANGE(0x31, 0x31) AM_DEVREADWRITE("hd44780", hd44780_device, data_read, data_write) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( fb01 ) + PORT_START("PANEL") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("System Set Up") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inst Select") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inst Assign") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inst Function") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Voice Function") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Voice Select") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("-1/No") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("+1/Yes") +INPUT_PORTS_END + + +void fb01_state::machine_start() +{ + save_item(NAME(m_ym2164_irq)); + save_item(NAME(m_upd71051_txrdy)); + save_item(NAME(m_upd71051_rxrdy)); +} + + +void fb01_state::machine_reset() +{ + m_upd71051->write_cts(0); + m_upd71051->write_rxd(ASSERT_LINE); +} + + +WRITE_LINE_MEMBER(fb01_state::write_usart_clock) +{ + m_upd71051->write_txc(state); + m_upd71051->write_rxc(state); +} + + +WRITE_LINE_MEMBER(fb01_state::midi_in) +{ + m_midi_thru->write_txd(state); + m_upd71051->write_rxd(state); +} + + +WRITE_LINE_MEMBER(fb01_state::ym2164_irq_w) +{ + m_ym2164_irq = state; + update_int(); +} + + +WRITE_LINE_MEMBER(fb01_state::upd71051_txrdy_w) +{ + m_upd71051_txrdy = state; + update_int(); +} + + +WRITE_LINE_MEMBER(fb01_state::upd71051_rxrdy_w) +{ + m_upd71051_rxrdy = state; + update_int(); +} + + +void fb01_state::update_int() +{ + m_maincpu->set_input_line(0, (m_ym2164_irq || m_upd71051_txrdy || m_upd71051_rxrdy) ? ASSERT_LINE : CLEAR_LINE); +} + + +static HD44780_PIXEL_UPDATE(fb01_pixel_update) +{ + if ( pos < 8 && line < 2 ) + { + bitmap.pix16(y, line*6*8 + pos*6 + x) = state; + } +} + + +PALETTE_INIT_MEMBER(fb01_state, fb01) +{ + palette.set_pen_color(0, rgb_t(30, 0, 0)); + palette.set_pen_color(1, rgb_t(150, 0, 0)); +} + + +static MACHINE_CONFIG_START( fb01, fb01_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) + MCFG_CPU_PROGRAM_MAP(fb01_mem) + MCFG_CPU_IO_MAP(fb01_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(6*16, 9) + MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9-1) + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT( layout_fb01 ) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(fb01_state, fb01) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 8) // 2x8 displayed as 1x16 + MCFG_HD44780_PIXEL_UPDATE_CB(fb01_pixel_update) + + MCFG_DEVICE_ADD("upd71051", I8251, XTAL_4MHz) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(fb01_state, upd71051_rxrdy_w)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(fb01_state, upd71051_txrdy_w)) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) + + MCFG_DEVICE_ADD("usart_clock", CLOCK, XTAL_4MHz / 8) // 500KHz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(fb01_state, write_usart_clock)) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(WRITELINE(fb01_state, midi_in)) + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_MIDI_PORT_ADD("mdthru", midiout_slot, "midiout") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_YM2151_ADD("ym2164", XTAL_4MHz) + MCFG_YM2151_IRQ_HANDLER(WRITELINE(fb01_state, ym2164_irq_w)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) + + MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( fb01 ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD("fb01.ic11", 0, 0x8000, CRC(7357e9a4) SHA1(049c482d6c91b7e2846757dd0f5138e0d8b687f0)) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1986, fb01, 0, 0, fb01, fb01, driver_device, 0, "Yamaha", "FB-01", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/fc100.c b/src/mame/drivers/fc100.c new file mode 100644 index 00000000000..65d7c801bee --- /dev/null +++ b/src/mame/drivers/fc100.c @@ -0,0 +1,578 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Goldstar FC-100 (FC stands for Famicom) + +2014/04/20 Skeleton driver. + +Known chips: M5C6847P, AY-3-8910, 8251. XTALS 7.15909, 4.9152 + +No manuals or schematics available. +Shift-Run to BREAK out of CLOAD. +Cassette uses the uart. +There is an inbuilt Monitor. MON to enter. Commands are D,G,M,R,S,X. + + +Test of semigraphic 6 +10 SCREEN 2:CLS +20 FOR I=0 TO 360 +30 PSET(128+SIN(I)*90,91-COS(I)*90), 1 +40 NEXT +RUN + +TODO: +- Cassette can be 600 or 1200 baud, how is 600 baud selected? +- Hookup Graphics modes and colours +- Unknown i/o ports +- Need cart software (current code is just a guess) + + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6847.h" +#include "machine/i8251.h" +#include "machine/clock.h" +#include "sound/ay8910.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "formats/fc100_cas.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class fc100_state : public driver_device +{ +public: + fc100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_vdg(*this, "vdg") + , m_p_videoram(*this, "videoram") + , m_cass(*this, "cassette") + , m_cart(*this, "cartslot") + , m_uart(*this, "uart") + , m_centronics(*this, "centronics") + , m_keyboard(*this, "KEY") + { } + + DECLARE_READ8_MEMBER(mc6847_videoram_r); + DECLARE_READ8_MEMBER(port00_r); + DECLARE_WRITE8_MEMBER(port31_w); + DECLARE_WRITE8_MEMBER(port33_w); + DECLARE_WRITE8_MEMBER(port43_w); + DECLARE_WRITE8_MEMBER(port60_w); + DECLARE_WRITE8_MEMBER(port70_w); + DECLARE_WRITE_LINE_MEMBER(txdata_callback); + DECLARE_WRITE_LINE_MEMBER(uart_clock_w); + DECLARE_DRIVER_INIT(fc100); + TIMER_DEVICE_CALLBACK_MEMBER(timer_c); + TIMER_DEVICE_CALLBACK_MEMBER(timer_p); + TIMER_DEVICE_CALLBACK_MEMBER(timer_k); + + UINT8 *m_p_chargen; + + MC6847_GET_CHARROM_MEMBER(get_char_rom) + { + return m_p_chargen[ch * 16 + line]; + } +private: + virtual void machine_start(); + virtual void machine_reset(); + + // graphics signals + UINT8 m_ag; + UINT8 m_gm2; + UINT8 m_gm1; + UINT8 m_gm0; + UINT8 m_as; + UINT8 m_css; + UINT8 m_intext; + UINT8 m_inv; + UINT8 m_cass_data[4]; + bool m_cass_state; + bool m_cassold; + UINT8 m_key_pressed; + bool m_banksw_unlocked; + + required_device m_maincpu; + required_device m_vdg; + required_shared_ptr m_p_videoram; + required_device m_cass; + required_device m_cart; + required_device m_uart; + required_device m_centronics; + required_ioport_array<16> m_keyboard; +}; + + +static ADDRESS_MAP_START( fc100_mem, AS_PROGRAM, 8, fc100_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x5fff ) AM_ROM AM_REGION("roms", 0) + //AM_RANGE(0x6000, 0x6fff) // mapped by the cartslot + AM_RANGE( 0x7800, 0x7fff ) AM_READ_BANK("bankr") AM_WRITE_BANK("bankw") // Banked RAM/ROM + AM_RANGE( 0x8000, 0xbfff ) AM_RAM // expansion ram pack - if omitted you get a 'Pages?' prompt at boot + AM_RANGE( 0xc000, 0xffff ) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fc100_io, AS_IO, 8, fc100_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x0F) AM_READ(port00_r) + // AM_RANGE(0x10, 0x10) AM_WRITE(port10_w) // vdg, unknown effects + AM_RANGE(0x21, 0x21) AM_DEVWRITE("psg", ay8910_device, data_w) + AM_RANGE(0x22, 0x22) AM_DEVREAD("psg", ay8910_device, data_r) + AM_RANGE(0x23, 0x23) AM_DEVWRITE("psg", ay8910_device, address_w) + AM_RANGE(0x31, 0x31) AM_WRITE(port31_w) + AM_RANGE(0x33, 0x33) AM_WRITE(port33_w) + AM_RANGE(0x40, 0x40) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x42, 0x42) AM_WRITENOP // bit 0 could be printer select + AM_RANGE(0x43, 0x43) AM_WRITE(port43_w) + AM_RANGE(0x44, 0x44) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE(0x60, 0x61) AM_WRITE(port60_w) + AM_RANGE(0x70, 0x71) AM_WRITE(port70_w) + AM_RANGE(0xb0, 0xb0) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0xb8, 0xb8) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( fc100 ) + PORT_START("KEY.0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_NAME("Graph") // does nothing + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Shift") PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("Ctrl") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_NAME("Caps") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("[") PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("]") PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("KEY.1") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("\\") PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Backspace") PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("=") PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Enter") PORT_CHAR(13) + + PORT_START("KEY.2") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") + + PORT_START("KEY.3") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_NAME("'") PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_NAME("Tab") PORT_CHAR(9) + + PORT_START("KEY.4") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHAR('5') PORT_CHAR('^') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHAR('7') PORT_CHAR('%') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHAR('8') PORT_CHAR('*') + + PORT_START("KEY.5") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHAR('4') PORT_CHAR('$') + + PORT_START("KEY.6") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Space") PORT_CHAR(32) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Run") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHAR('0') PORT_CHAR(')') + + PORT_START("KEY.7") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") + + PORT_START("KEY.8") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("KEY.9") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Home") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("Ins") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Del") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") PORT_CHAR(27) + + PORT_START("KEY.10") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('L') PORT_CHAR('l') + + PORT_START("KEY.11") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('V') PORT_CHAR('v') + + PORT_START("KEY.12") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('K') PORT_CHAR('k') + + PORT_START("KEY.13") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('F') PORT_CHAR('f') + + PORT_START("KEY.14") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('I') PORT_CHAR('i') + + PORT_START("KEY.15") + PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('R') PORT_CHAR('r') + + PORT_START("JOY0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +READ8_MEMBER( fc100_state::port00_r ) +{ + return m_keyboard[offset]->read(); +} + +// The timer frequency controls the auto-repeat delay and speed +// m_key_pressed: +// 0 = no key pressed, nothing to do +// 1 = key pressed, generate IRQ. +// 2 = key released, generate IRQ. +TIMER_DEVICE_CALLBACK_MEMBER( fc100_state::timer_k) +{ + /* scan the keyboard */ + UINT8 i; + + for (i = 0; i < 16; i++) + { + if (m_keyboard[i]->read() < 255) + { + // IRQ if key pressed + m_key_pressed = 1; + m_maincpu->set_input_line(0, HOLD_LINE); + return; + } + } + + if (m_key_pressed == 1) // IRQ for key released + { + m_key_pressed = 2; + m_maincpu->set_input_line(0, HOLD_LINE); + return; + } + else + if (m_key_pressed == 2) // release IRQ + { + m_key_pressed = 0; + m_maincpu->set_input_line(0, CLEAR_LINE); + } +} + + +//********************* AUDIO ********************************** +#if 0 +WRITE8_MEMBER( fc100_state::ay_port_a_w ) +{ + m_ag = BIT(data, 4); + m_gm2 = BIT(data, 6); + m_gm1 = BIT(data, 3); + m_gm0 = BIT(data, 3); + m_css = m_ag; + + m_vdg->ag_w( m_ag ? ASSERT_LINE : CLEAR_LINE ); + m_vdg->gm2_w( m_gm2 ? ASSERT_LINE : CLEAR_LINE ); + m_vdg->gm1_w( m_gm1 ? ASSERT_LINE : CLEAR_LINE ); + m_vdg->gm0_w( m_gm0 ? ASSERT_LINE : CLEAR_LINE ); + m_vdg->css_w( m_css ? ASSERT_LINE : CLEAR_LINE ); + m_vdg->hack_black_becomes_blue( BIT(data, 1) ); +} +#endif + +//******************** VIDEO ********************************** + +READ8_MEMBER( fc100_state::mc6847_videoram_r ) +{ + if (offset == ~0) return 0xff; + + if ( m_ag ) + { + if ( m_gm2 ) + { + // 256 x 192 / 6KB + offset = ( ( offset & 0x1fc0 ) >> 1 ) | ( offset & 0x1f ); + return m_p_videoram[offset % 0xc00]; + } + else + { + // 256 x 96 / 3KB + return m_p_videoram[offset % 0xc00]; + } + } + + // Standard text + UINT8 data = m_p_videoram[offset]; + UINT8 attr = m_p_videoram[offset+0x200]; + + // unknown bits 1,2,4,7 + m_vdg->inv_w( BIT( attr, 0 )); + m_vdg->css_w( BIT( attr, 1)); // guess + m_vdg->as_w( BIT( attr, 6 )); + + return data; +} + +/* F4 Character Displayer */ +static const gfx_layout u53_charlayout = +{ + 7, 15, /* 7 x 15 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( fc100 ) + GFXDECODE_ENTRY( "chargen", 0x0000, u53_charlayout, 0, 1 ) +GFXDECODE_END + +//********************** CENTRONICS PRINTER *********************************** + +WRITE8_MEMBER( fc100_state::port43_w ) +{ + m_centronics->write_strobe(BIT(data, 2)); + m_centronics->write_init(BIT(data, 3)); +} + +//********************** UART/CASSETTE *********************************** + +WRITE8_MEMBER( fc100_state::port31_w ) +{ + if (data == 8) + m_cass->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); +} + +WRITE8_MEMBER( fc100_state::port33_w ) +{ + if (data == 0) + m_cass->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + +WRITE_LINE_MEMBER( fc100_state::txdata_callback ) +{ + m_cass_state = state; +} + +WRITE_LINE_MEMBER( fc100_state::uart_clock_w ) +{ + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + +TIMER_DEVICE_CALLBACK_MEMBER( fc100_state::timer_c ) +{ + m_cass_data[3]++; + + if (m_cass_state != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +TIMER_DEVICE_CALLBACK_MEMBER( fc100_state::timer_p) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_uart->write_rxd((m_cass_data[1] < 12) ? 1 : 0); + m_cass_data[1] = 0; + } +} + +//******************** MACHINE ****************************** + +void fc100_state::machine_start() +{ + m_ag = 0; + m_gm2 = 0; + m_gm1 = 0; + m_gm0 = 0; + m_as = 0; + m_css = 0; + m_intext = 0; + m_inv = 0; + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + save_item(NAME(m_ag)); + save_item(NAME(m_gm2)); + save_item(NAME(m_gm1)); + save_item(NAME(m_gm0)); + save_item(NAME(m_as)); + save_item(NAME(m_css)); + save_item(NAME(m_intext)); + save_item(NAME(m_inv)); +} + +void fc100_state::machine_reset() +{ + m_p_chargen = memregion("chargen")->base(); + m_cass_data[0] = m_cass_data[1] = m_cass_data[2] = m_cass_data[3] = 0; + m_cass_state = 0; + m_cassold = 0; + m_key_pressed = 0; + membank("bankr")->set_entry(0); + membank("bankw")->set_entry(0); +} + +WRITE8_MEMBER( fc100_state::port60_w ) +{ + if (m_banksw_unlocked) + membank("bankr")->set_entry(offset); +} + +WRITE8_MEMBER( fc100_state::port70_w ) +{ + m_banksw_unlocked = (bool)offset; +} + +DRIVER_INIT_MEMBER( fc100_state, fc100 ) +{ + UINT8 *ram = memregion("ram")->base(); + UINT8 *cgen = memregion("chargen")->base()+0x800; + + membank("bankr")->configure_entry(0, &cgen[0]); + membank("bankw")->configure_entry(0, &ram[0]); + membank("bankr")->configure_entry(1, &ram[0]); +} + +static MACHINE_CONFIG_START( fc100, fc100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_7_15909MHz/2) + MCFG_CPU_PROGRAM_MAP(fc100_mem) + MCFG_CPU_IO_MAP(fc100_io) + + /* video hardware */ + MCFG_DEVICE_ADD("vdg", M5C6847P1, XTAL_7_15909MHz/3) // Clock not verified + MCFG_MC6847_INPUT_CALLBACK(READ8(fc100_state, mc6847_videoram_r)) + MCFG_MC6847_CHARROM_CALLBACK(fc100_state, get_char_rom) + MCFG_MC6847_FIXED_MODE(MC6847_MODE_INTEXT) + // other lines not connected + + MCFG_SCREEN_MC6847_NTSC_ADD("screen", "vdg") + MCFG_GFXDECODE_ADD("gfxdecode", "f4palette", fc100) + MCFG_PALETTE_ADD_MONOCHROME_AMBER("f4palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("psg", AY8910, XTAL_7_15909MHz/3/2) /* AY-3-8910 - clock not verified */ + MCFG_AY8910_PORT_A_READ_CB(IOPORT("JOY0")) + MCFG_AY8910_PORT_B_READ_CB(IOPORT("JOY1")) + //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(fc100_state, ay_port_a_w)) + //MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(fc100_state, ay_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50) + + /* Devices */ + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(fc100_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(fc100_state, txdata_callback)) + MCFG_DEVICE_ADD("uart_clock", CLOCK, XTAL_4_9152MHz/16/16) // gives 19200 + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(fc100_state, uart_clock_w)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_c", fc100_state, timer_c, attotime::from_hz(4800)) // cass write + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", fc100_state, timer_p, attotime::from_hz(40000)) // cass read + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", fc100_state, timer_k, attotime::from_hz(300)) // keyb scan + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fc100_cart") + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( fc100 ) + ROM_REGION( 0x6000, "roms", 0 ) + ROM_LOAD( "08-01.u48", 0x0000, 0x2000, CRC(24e78e75) SHA1(13121706544256a702635448ed2950a75c13f491) ) + ROM_LOAD( "08-02.u49", 0x2000, 0x2000, CRC(e14fc7e9) SHA1(9c5821e65c1efe698e25668d24c36929ea4c3ad7) ) + ROM_LOAD( "06-03.u50", 0x4000, 0x2000, CRC(d783c84e) SHA1(6d1bf53995e08724d5ecc24198cdda4442eb2eb9) ) + + ROM_REGION( 0x800, "ram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "cg-04-01.u53", 0x0000, 0x1000, CRC(2de75b7f) SHA1(464369d98cbae92ffa322ebaa4404cf5b26825f1) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +CONS( 1982, fc100, 0, 0, fc100, fc100, fc100_state, fc100, "Goldstar", "FC-100", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/fidelz80.c b/src/mame/drivers/fidelz80.c new file mode 100644 index 00000000000..1d545c8405f --- /dev/null +++ b/src/mame/drivers/fidelz80.c @@ -0,0 +1,1426 @@ +// license:BSD-3-Clause +// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco +/****************************************************************************** +* +* Fidelity Electronics Z80 based board driver +* By Kevin 'kevtris' Horton, Jonathan Gevaryahu AKA Lord Nightmare and Sandro Ronco +* +* All detailed RE work done by Kevin 'kevtris' Horton +* +* TODO: +* * Figure out why it says the first speech line twice; it shouldn't. (It sometimes does this on the sensory chess challenger real hardware) +* * Get rom locations from pcb (done for UVC, VCC is probably similar) +* * correctly hook up 7002/VBRC and 7014/bridgec3 speech so that the z80 is halted while words are being spoken +* +*********************************************************************** + +Talking Chess Challenger (VCC) +Advanced Talking Chess Challenger (UVC) +(which both share the same hardware) +---------------------- + +The CPU is a Z80 running at 4MHz. The TSI chip runs at around 25KHz, using a +470K / 100pf RC network. This system is very very basic, and is composed of just +the Z80, 4 ROMs, the TSI chip, and an 8255. + + +The Z80's interrupt inputs are all pulled to VCC, so no interrupts are used. + +Reset is connected to a power-on reset circuit and a button on the keypad (marked RE). + +The TSI chip connects to a 4K ROM. All of the 'Voiced' Chess Challengers +use this same ROM (three or four). The later chess boards use a slightly different part +number, but the contents are identical. + +Memory map (VCC): +----------- +0000-0FFF: 4K 2332 ROM 101-32103 +1000-1FFF: 4K 2332 ROM VCC2 +2000-2FFF: 4K 2332 ROM VCC3 +4000-5FFF: 1K RAM (2114 SRAM x2) +6000-FFFF: empty + +Memory map (UVC): +----------- +0000-1FFF: 8K 2364 ROM 101-64017 +2000-2FFF: 4K 2332 ROM 101-32010 +4000-5FFF: 1K RAM (2114 SRAM x2) +6000-FFFF: empty + +I/O map: +-------- +00-FF: 8255 port chip [LN edit: 00-03, mirrored over the 00-FF range; program accesses F4-F7] + + +8255 connections: +----------------- + +PA.0 - segment G, TSI A0 (W) +PA.1 - segment F, TSI A1 (W) +PA.2 - segment E, TSI A2 (W) +PA.3 - segment D, TSI A3 (W) +PA.4 - segment C, TSI A4 (W) +PA.5 - segment B, TSI A5 (W) +PA.6 - segment A, language latch Data (W) +PA.7 - TSI START line, language latch clock (W, see below) + +PB.0 - dot commons (W) +PB.1 - NC +PB.2 - digit 0, bottom dot (W) +PB.3 - digit 1, top dot (W) +PB.4 - digit 2 (W) +PB.5 - digit 3 (W) +PB.6 - enable language switches (W, see below) +PB.7 - TSI DONE line (R) + +(button rows pulled up to 5V through 2.2K resistors) +PC.0 - button row 0, German language jumper (R) +PC.1 - button row 1, French language jumper (R) +PC.2 - button row 2, Spanish language jumper (R) +PC.3 - button row 3, special language jumper (R) +PC.4 - button column A (W) +PC.5 - button column B (W) +PC.6 - button column C (W) +PC.7 - button column D (W) + + +language switches: +------------------ + +When PB.6 is pulled low, the language switches can be read. There are four. +They connect to the button rows. When enabled, the row(s) will read low if +the jumper is present. English only VCC's do not have the 367 or any pads stuffed. +The jumpers are labelled: French, German, Spanish, and special. + + +language latch: +--------------- + +There's an unstuffed 7474 on the board that connects to PA.6 and PA.7. It allows +one to latch the state of A12 to the speech ROM. The English version has the chip +missing, and a jumper pulling "A12" to ground. This line is really a negative +enable. + +To make the VCC multi-language, one would install the 74367 (note: it must be a 74367 +or possibly a 74LS367. A 74HC367 would not work since they rely on the input current +to keep the inputs pulled up), solder a piggybacked ROM to the existing English +speech ROM, and finally install a 7474 dual flipflop. + +This way, the game can then detect which secondary language is present, and then it can +automatically select the correct ROM(s). I have to test whether it will do automatic +determination and give you a language option on power up or something. + +*********************************************************************** + +Chess Challenger 3/10 +---------------------- + +This is an earlier hardware upon which the VCC and UVC above were based on; +The hardware is nearly the same; in fact the only significant differences are +the RAM being located in a different place, the lack of a speech chip, and +the connections to ports A and B on the PPI: + +8255 connections: +----------------- + +PA.0 - segment G (W) +PA.1 - segment F (W) +PA.2 - segment E (W) +PA.3 - segment D (W) +PA.4 - segment C (W) +PA.5 - segment B (W) +PA.6 - segment A (W) +PA.7 - 'beeper' direct speaker output (W) + +PB.0 - dot commons (W) +PB.1 - NC +PB.2 - digit 0, bottom dot (W) +PB.3 - digit 1, top dot (W) +PB.4 - digit 2 (W) +PB.5 - digit 3 (W) +PB.6 - NC +PB.7 - Mode select (cc3 vs cc10, R) + +(button rows pulled up to 5V through 2.2K resistors) +PC.0 - button row 0 (R) +PC.1 - button row 1 (R) +PC.2 - button row 2 (R) +PC.3 - button row 3 (R) +PC.4 - button column A (W) +PC.5 - button column B (W) +PC.6 - button column C (W) +PC.7 - button column D (W) + +****************************************************************************** +Voice Bridge Challenger (Model VBRC, later reissued as Model 7002) +and Bridge Challenger 3 (Model 7014) +(which both share the same* hardware) +-------------------------------- +* The Bridge Challenger 3 does not actually have the 8 LEDs nor the +latches which operate them populated and the plastic indicator cap locations +are instead are covered by a piece of plastic, but they do work if manually +added. + +This unit is similar in construction kinda to the chess challengers, however it +has an 8041 which does ALL of the system I/O. The Z80 has NO IO AT ALL other than +what is performed through the 8041! + +The main CPU is a Z80 running at 2.5MHz + +INT connects to VCC (not used) +NMI connects to VCC (not used) +RST connects to power on reset, and reset button + +The 8041 runs at 5MHz. + +Memory Map: +----------- + +0000-1FFF: 8K 101-64108 ROM +2000-3FFF: 8K 101-64109 ROM +4000-5FFF: 8K 101-64110 ROM +6000-7FFF: 1K of RAM (2114 * 2) +8000-DFFF: unused +E000-FFFF: write to TSI chip + +NOTE: when the TSI chip is written to, the CPU IS STOPPED. The CPU will run again +when the word is done being spoken. This is because D0-D5 run to the TSI chip directly. + +The TSI chip's ROM is 4K, and is marked 101-32118. The clock is the same as the Chess +Challengers- 470K/100pf which gives a frequency around 25KHz or so. + +I/O Map: +-------- + +00-FF: 8041 I/O ports (A0 selects between the two) + + + +8041 pinout: +------------ + +(note: columns are pulled up with 10K resistors) + +P10 - column H, RD LED, VFD grid 0 +P11 - column G, DB LED, VFD grid 1 +P12 - column F, <>V LED, VFD grid 2 +P13 - column E, ^V LED, VFD grid 3 +P14 - column D, W LED, VFD grid 4 +P15 - column C, S LED, VFD grid 5 +P16 - column B, E LED, VFD grid 6 +P17 - column A, N LED, VFD grid 7 + +P20 - I/O expander +P21 - I/O expander +P22 - I/O expander +P23 - I/O expander +P24 - row 0 through inverter +P25 - row 1 through inverter +P26 - row 2 through inverter +P27 - row 3 through inverter + +PROG - I/O expander + +T0 - optical card sensor (high = bright/reflective, low = dark/non reflective) +T1 - connects to inverter, then nothing + +D8243C I/O expander: +-------------------- + +P4.0 - segment M +P4.1 - segment L +P4.2 - segment N +P4.3 - segment E + +P5.0 - segment D +P5.1 - segment I +P5.2 - segment K +P5.3 - segment J + +P6.0 - segment A +P6.1 - segment B +P6.2 - segment F +P6.3 - segment G + +P7.0 - LED enable (high = LEDs can be lit. low = LEDs will not light) +P7.1 - goes through inverter, to pads that are not used +P7.2 - segment C +P7.3 - segment H + + +button matrix: +-------------- + +the matrix is composed of 8 columns by 4 rows. + + A B C D E F G H + ------------------------- +0- RE xx CL EN J Q K A +1- BR PB DB SC 7 8 9 10 +2- DL CV VL PL 3 4 5 6 +3- cl di he sp NT P 1 2 + +xx - speaker symbol +cl - clubs symbol +di - diamonds symbol +he - hearts symbol +sp - spades symbol + +NOTE: RE is not wired into the matrix, and is run separately out. + +There are 8 LEDs, and an 8 digit 14 segment VFD with commas and periods. +This display is the same one as can be found on the speak and spell. + + A * comma + *********** * + * *I *J K* * +F* * * * *B + * * * * * + G**** *****H + * * * * * +E* * * * *C + * *N *M L* * + *********** *decimal point + D + +The digits of the display are numbered left to right, 0 through 7 and are controlled +by the grids. hi = grid on, hi = segment on. + +A detailed description of the hardware can be found also in the patent 4,373,719. + +****************************************************************************** + +Sensory Chess Challenger champion (6502 based, needs its own driver .c file) +--------------------------------- + +Memory map: +----------- +0000-07FF: 2K of RAM +0800-0FFF: 1K of RAM (note: mirrored twice) +1000-17FF: PIA 0 (display, TSI speech chip) +1800-1FFF: PIA 1 (keypad, LEDs) +2000-3FFF: 101-64019 ROM (also used on the regular sensory chess challenger) +4000-7FFF: mirror of 0000-3FFF +8000-9FFF: not used +A000-BFFF: 101-1025A03 ROM +C000-DFFF: 101-1025A02 ROM +E000-FDFF: 101-1025A01 ROM +FE00-FFFF: 512 byte 74S474 PROM + + +CPU is a 6502 running at 1.95MHz (3.9MHz resonator, divided by 2) + +NMI is not used. +IRQ is connected to a 600Hz oscillator (38.4KHz divided by 64). +Reset is connected to a power-on reset circuit. + + +PIA port lines: +--------------- + + +PIA 0: +------ + +PA0 - 7seg segments H, TSI A0 +PA1 - 7seg segments G, TSI A1 +PA2 - 7seg segments C, TSI A2 +PA3 - 7seg segments B, TSI A3 +PA4 - 7seg segments A, TSI A4 +PA5 - 7seg segments F, TSI A5 +PA6 - 7seg segments E +PA7 - 7seg segments D + +PB0 - A12 on speech ROM (if used... not used on this model, ROM is 4K) +PB1 - START line on S14001A +PB2 - white wire +PB3 - DONE line from S14001A +PB4 - Tone line (toggle to make a tone in the speaker) +PB5 - button column I +PB6 - selection jumper (resistor to 5V) +PB7 - selection jumper (resistor to ground) + +CA1 - NC +CA2 - violet wire + +CB1 - NC +CB2 - NC (connects to pin 14 of soldered connector) + +PIA 1: +------ + +PA0 - button row 1 +PA1 - button row 2 +PA2 - button row 3 +PA3 - button row 4 +PA4 - button row 5 +PA5 - button row 6 +PA6 - 7442 selector bit 0 +PA7 - 7442 selector bit 1 + +PB0 - LED row 1 +PB1 - LED row 2 +PB2 - LED row 3 +PB3 - LED row 4 +PB4 - LED row 5 +PB5 - LED row 6 +PB6 - LED row 7 +PB7 - LED row 8 + +CA1 - button row 7 +CA2 - selector bit 3 + +CB1 - button row 8 +CB2 - selector bit 2 + +Selector: (attached to PIA 1, outputs 1 of 10 pins low. 7442) +--------- + +output # (selected turns this column on, and all others off) +0 - LED column A, button column A, 7seg digit 1 +1 - LED column B, button column B, 7seg digit 2 +2 - LED column C, button column C, 7seg digit 3 +3 - LED column D, button column D, 7seg digit 4 +4 - LED column E, button column E +5 - LED column F, button column F +6 - LED column G, button column G +7 - LED column H, button column H +8 - button column I +9 - + +The rows/columns are indicated on the game board: + + + ABCDEFGH I +-------------- +| | 8 +| | 7 +| | 6 +| | 5 +| | 4 +| | 3 +| | 2 +| | 1 +-------------- + +The "lone LED" is above the control column. +column I is the "control column" on the right for starting a new game, etc. + +The upper 6 buttons are connected as such: + +column A - speak +column B - RV +column C - TM +column D - LV +column E - DM +column F - ST + +these 6 buttons use row 9 (connects to PIA 0) + +LED display: +------------ + +43 21 (digit number) +----- +88:88 + +The LED display is four 7 segment digits. normal ABCDEFG lettering is used for segments. + +The upper dot is connected to digit 3 common +The lower dot is connected to digit 4 common +The lone LED is connected to digit 1 common + +All three of the above are called "segment H". + + +*********************************************************************** +Sensory Chess Challenger +------------------------ + +The display/button/LED/speech technology is identical to the above product. +Only the CPU board was changed. As such, it works the same but is interfaced +to different port chips this time. + +Hardware: +--------- + +On the board are 13 chips. + +The CPU is a Z80A running at 3.9MHz, with 20K of ROM and 1K of RAM mapped. +I/O is composed of an 8255 triple port adaptor, and a Z80A PIO parallel I/O +interface. + +There's the usual TSI S14001A speech synth with its requisite 4K ROM which is the +same as on the other talking chess boards. The TSI chip is running at 26.37KHz. +It uses a 470K resistor and a 100pf capacitor. + +The "perfect" clock would be 1/RC most likely (actually this will be skewed a tad by +duty cycle of the oscillator) which with those parts values gives 21.27KHz. The +formula is probably more likely to be 1/1.2RC or so. + +Rounding out the hardware are three driver chips for the LEDs, a 7404 inverter to +run the crystal osc, a 555 timer to generate a clock, and a 74138 selector. + +NMI runs to a 555 oscillator that generates a 600Hz clock (measured: 598.9Hz. It has a multiturn pot to adjust). +INT is pulled to 5V +RST connects to a power-on reset circuit + + +Memory map: +----------- + +0000-1FFF: 8K ROM 101-64018 +2000-3FFF: 8K ROM 101-64019 (also used on the sensory champ. chess challenger) +4000-5FFF: 4K ROM 101-32024 +6000-7FFF: 1K of RAM (2114 * 2) +8000-FFFF: not used, maps to open bus + +I/O map: +-------- + +There's only two chips in the I/O map, an 8255 triple port chip, and a Z80A PIO +parallel input/output device. + +Decoding isn't performed using a selector, but instead address lines are used. + +A2 connects to /CE on the 8255 +A3 connects to /CE on the Z80A PIO + +A1 connects to control/data select on PIO & A0 of 8255 +A0 connects to port A/B select on PIO & A1 of 8255 + +So to enable only the 8255, you'd write/read to 08-0Bh for example +To enable only the PIO, you'd write/read to 04-07h for example. + +writing to 00-03h will enable and write to BOTH chips, and reading 00-03h +will return data from BOTH chips (and cause a bus conflict). The code probably +never does either of these things. + +Likewise, writing/reading to 0Ch-0Fh will result in open bus, because neither chip's +enable line will be low. + +This sequence repeats every 16 addresses. So to recap: + +00-03: both chips enabled (probably not used) +04-07: PIO enabled +08-0B: 8255 enabled +0C-0F: neither enabled + +10-FF: mirrors of 00-0F. + + +Refer to the Sensory Champ. Chess Chall. above for explanations of the below +I/O names and labels. It's the same. + +8255: +----- + +PA.0 - segment D, TSI A0 +PA.1 - segment E, TSI A1 +PA.2 - segment F, TSI A2 +PA.3 - segment A, TSI A3 +PA.4 - segment B, TSI A4 +PA.5 - segment C, TSI A5 +PA.6 - segment G +PA.7 - segment H + +PB.0 - LED row 1 +PB.1 - LED row 2 +PB.2 - LED row 3 +PB.3 - LED row 4 +PB.4 - LED row 5 +PB.5 - LED row 6 +PB.6 - LED row 7 +PB.7 - LED row 8 + +PC.0 - LED column A, button column A, 7seg digit 1 +PC.1 - LED column B, button column B, 7seg digit 2 +PC.2 - LED column C, button column C, 7seg digit 3 +PC.3 - LED column D, button column D, 7seg digit 4 +PC.4 - LED column E, button column E +PC.5 - LED column F, button column F +PC.6 - LED column G, button column G +PC.7 - LED column H, button column H + + +Z80A PIO: +--------- + +PA.0 - button row 1 +PA.1 - button row 2 +PA.2 - button row 3 +PA.3 - button row 4 +PA.4 - button row 5 +PA.5 - button row 6 +PA.6 - button row 7 +PA.7 - button row 8 + +PB.0 - button column I +PB.1 - button row 9 +PB.2 - Tone line (toggle to make tone in the speaker) +PB.3 - violet wire +PB.4 - white wire (and TSI done line) +PB.5 - selection jumper input (see below) +PB.6 - TSI start line +PB.7 - TSI ROM D0 line + +selection jumpers: +------------------ + +These act like another row of buttons. It is composed of two diode locations, +so there's up to 4 possible configurations. My board does not have either diode +stuffed, so this most likely is "English". I suspect it selects which language to use +for the speech synth. Of course you need the other speech ROMs for this to function +properly. + +Anyways, the two jumpers are connected to button columns A and B and the common +connects to Z80A PIO PB.5, which basically makes a 10th button row. I would +expect that the software reads these once on startup only. + +******************************************************************************/ + + +/* Core includes */ +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/i8255.h" +#include "machine/i8243.h" +#include "machine/z80pio.h" +#include "sound/beep.h" +#include "sound/s14001a.h" +#include "includes/fidelz80.h" +#include "fidelz80.lh" +#include "vsc.lh" +#include "bridgec3.lh" + +//#include "debugger.h" + +/* Devices */ + +/****************************************************************************** + I8255 Device, for VCC/UVC +******************************************************************************/ + +void fidelz80_state::update_display() +{ + // data for the 4x 7seg leds, bits are 0bxABCDEFG + UINT8 out_digit = BITSWAP8( m_digit_data,7,0,1,2,3,4,5,6 ) & 0x7f; + + if (m_led_selected&0x04) + { + output_set_digit_value(0, out_digit); + + output_set_led_value(1, m_led_data & 0x01); + } + if (m_led_selected&0x08) + { + output_set_digit_value(1, out_digit); + + output_set_led_value(0, m_led_data & 0x01); + } + if (m_led_selected&0x10) + { + output_set_digit_value(2, out_digit); + } + if (m_led_selected&0x20) + { + output_set_digit_value(3, out_digit); + } +} + +READ8_MEMBER( fidelz80_state::fidelz80_portc_r ) +{ + UINT8 data = 0xff; + + if (!(m_kp_matrix&0x10)) + { + data &= ioport("LINE1")->read(); + } + if (!(m_kp_matrix&0x20)) + { + data &= ioport("LINE2")->read(); + } + if (!(m_kp_matrix&0x40)) + { + data &= ioport("LINE3")->read(); + } + if (!(m_kp_matrix&0x80)) + { + data &= ioport("LINE4")->read(); + } + + return data; +} + +WRITE8_MEMBER( fidelz80_state::fidelz80_portb_w ) +{ + if (!(data & 0x80)) + { + m_led_data = (data&0x01); // common for two leds + + m_led_selected = data; + + update_display(); + } + + // ignoring the language switch enable for now, is bit 0x40 +} + +WRITE8_MEMBER( fidelz80_state::fidelz80_portc_w ) +{ + m_kp_matrix = data; +} + +WRITE8_MEMBER( fidelz80_state::cc10_porta_w ) +{ + m_beep->set_state((data & 0x80) ? 0 : 1); + + m_digit_data = data; + + update_display(); +} + +READ8_MEMBER( fidelz80_state::vcc_portb_r ) +{ + return (m_speech->bsy_r() != 0) ? 0x80 : 0x00; +} + +WRITE8_MEMBER( fidelz80_state::vcc_porta_w ) +{ + m_speech->set_volume(15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... + m_speech->reg_w(data & 0x3f); + m_speech->rst_w(BIT(data, 7)); + + m_digit_data = data; + + update_display(); +} + +/****************************************************************************** + I8255 Device, for VSC +******************************************************************************/ + +WRITE8_MEMBER( fidelz80_state::vsc_porta_w ) +{ + UINT8 out_digit = BITSWAP8( data,7,6,2,1,0,5,4,3 ); + + if (m_kp_matrix & 0x01) + { + output_set_digit_value(0, out_digit & 0x7f); + output_set_value("pm_led", BIT(out_digit, 7)); + } + if (m_kp_matrix & 0x02) + { + output_set_digit_value(1, out_digit & 0x7f); + } + if (m_kp_matrix & 0x04) + { + output_set_digit_value(2, out_digit & 0x7f); + output_set_value("up_dot", BIT(out_digit, 7)); + } + if (m_kp_matrix & 0x08) + { + output_set_digit_value(3, out_digit & 0x7f); + output_set_value("low_dot", BIT(out_digit, 7)); + } + + m_speech->reg_w(data & 0x3f); +} + +WRITE8_MEMBER( fidelz80_state::vsc_portb_w ) +{ + for (int row=1; row<=8; row++) + { + if (m_kp_matrix & 0x01) + output_set_indexed_value("led_a", row, BIT(data, 8-row)); + if (m_kp_matrix & 0x02) + output_set_indexed_value("led_b", row, BIT(data, 8-row)); + if (m_kp_matrix & 0x04) + output_set_indexed_value("led_c", row, BIT(data, 8-row)); + if (m_kp_matrix & 0x08) + output_set_indexed_value("led_d", row, BIT(data, 8-row)); + if (m_kp_matrix & 0x10) + output_set_indexed_value("led_e", row, BIT(data, 8-row)); + if (m_kp_matrix & 0x20) + output_set_indexed_value("led_f", row, BIT(data, 8-row)); + if (m_kp_matrix & 0x40) + output_set_indexed_value("led_g", row, BIT(data, 8-row)); + if (m_kp_matrix & 0x80) + output_set_indexed_value("led_h", row, BIT(data, 8-row)); + } +} + +WRITE8_MEMBER( fidelz80_state::vsc_portc_w ) +{ + m_kp_matrix = (m_kp_matrix & 0x300) | data; +} + +/****************************************************************************** + PIO Device, for VSC +******************************************************************************/ + +READ8_MEMBER( fidelz80_state::vsc_pio_porta_r ) +{ + UINT8 data = 0; + + if (m_kp_matrix & 0x01) + data |= (ioport("COL_A")->read()); + if (m_kp_matrix & 0x02) + data |= (ioport("COL_B")->read()); + if (m_kp_matrix & 0x04) + data |= (ioport("COL_C")->read()); + if (m_kp_matrix & 0x08) + data |= (ioport("COL_D")->read()); + if (m_kp_matrix & 0x10) + data |= (ioport("COL_E")->read()); + if (m_kp_matrix & 0x20) + data |= (ioport("COL_F")->read()); + if (m_kp_matrix & 0x40) + data |= (ioport("COL_G")->read()); + if (m_kp_matrix & 0x80) + data |= (ioport("COL_H")->read()); + if (m_kp_matrix & 0x100) + data |= (ioport("COL_I")->read()); + if (m_kp_matrix & 0x200) + data |= (ioport("COL_L")->read()); + + return data & 0xff; +} + +READ8_MEMBER( fidelz80_state::vsc_pio_portb_r ) +{ + UINT8 data = 0x00; + + if (m_speech->bsy_r() == 0) + data |= 0x10; + + return data; +} + +WRITE8_MEMBER( fidelz80_state::vsc_pio_portb_w ) +{ + m_kp_matrix = (m_kp_matrix & 0xff) | ((data & 0x03)<<8); + + m_speech->set_volume(15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... + m_speech->rst_w(BIT(data, 6)); +} + +/****************************************************************************** + I8041 MCU, for VBRC/7002 and bridgec3/7014 +******************************************************************************/ + +WRITE8_MEMBER(fidelz80_state::kp_matrix_w) +{ + UINT16 out_data = BITSWAP16(m_digit_data,12,13,1,6,5,2,0,7,15,11,10,14,4,3,9,8); + UINT16 out_digit = out_data & 0x3fff; + UINT8 out_led = BIT(out_data, 15) ? 0 : 1; + + // output the digit before update the matrix + if (m_kp_matrix & 0x01) + { + output_set_digit_value(1, out_digit); + output_set_led_value(8, out_led); + } + if (m_kp_matrix & 0x02) + { + output_set_digit_value(2, out_digit); + output_set_led_value(7, out_led); + } + if (m_kp_matrix & 0x04) + { + output_set_digit_value(3, out_digit); + output_set_led_value(6, out_led); + } + if (m_kp_matrix & 0x08) + { + output_set_digit_value(4, out_digit); + output_set_led_value(5, out_led); + } + if (m_kp_matrix & 0x10) + { + output_set_digit_value(5, out_digit); + output_set_led_value(4, out_led); + } + if (m_kp_matrix & 0x20) + { + output_set_digit_value(6, out_digit); + output_set_led_value(3, out_led); + } + if (m_kp_matrix & 0x40) + { + output_set_digit_value(7, out_digit); + output_set_led_value(2, out_led); + } + if (m_kp_matrix & 0x80) + { + output_set_digit_value(8, out_digit); + output_set_led_value(1, out_led); + } + + memset(m_digit_line_status, 0, sizeof(m_digit_line_status)); + + m_kp_matrix = data; +} + +READ8_MEMBER(fidelz80_state::exp_i8243_p2_r) +{ + UINT8 data = 0xff; + + if (m_kp_matrix & 0x01) + data &= ioport("LINE1")->read(); + if (m_kp_matrix & 0x02) + data &= ioport("LINE2")->read(); + if (m_kp_matrix & 0x04) + data &= ioport("LINE3")->read(); + if (m_kp_matrix & 0x08) + data &= ioport("LINE4")->read(); + if (m_kp_matrix & 0x10) + data &= ioport("LINE5")->read(); + if (m_kp_matrix & 0x20) + data &= ioport("LINE6")->read(); + if (m_kp_matrix & 0x40) + data &= ioport("LINE7")->read(); + if (m_kp_matrix & 0x80) + data &= ioport("LINE8")->read(); + + return (m_i8243->i8243_p2_r(space, offset)&0x0f) | (data&0xf0); +} + +WRITE8_MEMBER(fidelz80_state::exp_i8243_p2_w) +{ + m_i8243->i8243_p2_w(space, offset, data&0x0f); +} + +// probably related to the card scanner +READ8_MEMBER(fidelz80_state::unknown_r) +{ + return 0; +} + +READ8_MEMBER(fidelz80_state::unknown2_r) +{ + return machine().rand(); +} + +/****************************************************************************** + I8243 expander +******************************************************************************/ + +WRITE8_MEMBER(fidelz80_state::digit_w) +{ + if (m_digit_line_status[offset]) + return; + + m_digit_line_status[offset&3] = 1; + + switch (offset) + { + case 0: + m_digit_data = (m_digit_data&(~0x000f)) | ((data<<0)&0x000f); + break; + case 1: + m_digit_data = (m_digit_data&(~0x00f0)) | ((data<<4)&0x00f0); + break; + case 2: + m_digit_data = (m_digit_data&(~0x0f00)) | ((data<<8)&0x0f00); + break; + case 3: + m_digit_data = (m_digit_data&(~0xf000)) | ((data<<12)&0xf000); + break; + } +} + +/****************************************************************************** + basic machine +******************************************************************************/ + +WRITE8_MEMBER(fidelz80_state::mcu_data_w) +{ + m_i8041->upi41_master_w(space, 0, data); +} + +WRITE8_MEMBER(fidelz80_state::mcu_command_w) +{ + m_i8041->upi41_master_w(space, 1, data); +} + +READ8_MEMBER(fidelz80_state::mcu_data_r) +{ + return m_i8041->upi41_master_r(space, 0); +} + +READ8_MEMBER(fidelz80_state::mcu_status_r) +{ + return m_i8041->upi41_master_r(space, 1); +} + +WRITE8_MEMBER( fidelz80_state::bridgec_speech_w ) +{ + // todo: HALT THE z80 here, and set up a callback to poll the s14001a DONE line to resume z80 + m_speech->set_volume(15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... + m_speech->reg_w(data & 0x3f); + m_speech->rst_w(BIT(data, 7)); +} + +void fidelz80_state::machine_reset() +{ + m_led_selected = 0; + m_kp_matrix = 0; + m_digit_data = 0; + m_led_data = 0; + memset(m_digit_line_status, 0, sizeof(m_digit_line_status)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(fidelz80_state::nmi_timer) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(cc10_z80_mem, AS_PROGRAM, 8, fidelz80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x3000, 0x31ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vcc_z80_mem, AS_PROGRAM, 8, fidelz80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM // 4k rom + AM_RANGE(0x1000, 0x1fff) AM_ROM // 4k rom + AM_RANGE(0x2000, 0x2fff) AM_ROM // 4k rom + AM_RANGE(0x4000, 0x43ff) AM_RAM AM_MIRROR(0x1c00) // 1k ram (2114*2) mirrored 8 times +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vsc_mem, AS_PROGRAM, 8, fidelz80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM // 8k rom + AM_RANGE(0x2000, 0x3fff) AM_ROM // 8k rom + AM_RANGE(0x4000, 0x5fff) AM_ROM // 4k rom + AM_RANGE(0x6000, 0x7fff) AM_RAM AM_MIRROR(0x1c00) // 1k ram (2114*2) mirrored 8 times +ADDRESS_MAP_END + +static ADDRESS_MAP_START(bridgec_z80_mem, AS_PROGRAM, 8, fidelz80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM // 8k rom + AM_RANGE(0x2000, 0x3fff) AM_ROM // 8k rom + AM_RANGE(0x4000, 0x5fff) AM_ROM // 8k rom + AM_RANGE(0x6000, 0x63ff) AM_RAM AM_MIRROR(0x1c00) // 1k ram (2114*2) mirrored 8 times + AM_RANGE(0xE000, 0xE000) AM_WRITE(bridgec_speech_w) AM_MIRROR(0x1FFF) // write to speech chip, halts cpu +ADDRESS_MAP_END + +static ADDRESS_MAP_START(fidel_z80_io, AS_IO, 8, fidelz80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_MIRROR(0xFC) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // 8255 i/o chip +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vsc_io, AS_IO, 8, fidelz80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x04, 0x07) AM_MIRROR(0xf0) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_MIRROR(0xf0) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(bridgec_z80_io, AS_IO, 8, fidelz80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READWRITE(mcu_data_r, mcu_data_w) + AM_RANGE(0x01, 0x01) AM_READWRITE(mcu_status_r, mcu_command_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(bridgec_mcu_io, AS_IO, 8, fidelz80_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kp_matrix_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(exp_i8243_p2_r, exp_i8243_p2_w) + AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w) + + // related to the card scanner, probably clock and data optical + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(unknown_r) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(unknown2_r) +ADDRESS_MAP_END + +/****************************************************************************** + Input Ports +******************************************************************************/ + +INPUT_CHANGED_MEMBER(fidelz80_state::fidelz80_trigger_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER(fidelz80_state::bridgec_trigger_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); + m_i8041->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( fidelz80 ) + PORT_START("LEVEL") // cc10 only + PORT_CONFNAME( 0x80, 0x00, "Number of levels" ) + PORT_CONFSETTING( 0x00, "10" ) + PORT_CONFSETTING( 0x80, "3" ) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, fidelz80_state, fidelz80_trigger_reset, 0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_V) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CB") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PB") PORT_CODE(KEYCODE_P) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("EN") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PV") PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) +INPUT_PORTS_END + +static INPUT_PORTS_START( vsc ) + //chessboard buttons + PORT_START("COL_A") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_START("COL_B") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_START("COL_C") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_START("COL_D") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_START("COL_E") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_START("COL_F") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_START("COL_G") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_START("COL_H") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) + + //buttons on the right + PORT_START("COL_I") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) + + //buttons beside the display + PORT_START("COL_L") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) +INPUT_PORTS_END + +static INPUT_PORTS_START( bridgec ) + PORT_START("LINE1") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("10") PORT_CODE(KEYCODE_0) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + + PORT_START("LINE2") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + + PORT_START("LINE3") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_Z) + + PORT_START("LINE4") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("NT") PORT_CODE(KEYCODE_N) + + PORT_START("LINE5") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("EN") PORT_CODE(KEYCODE_E) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("SC") PORT_CODE(KEYCODE_S) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PL") PORT_CODE(KEYCODE_X) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Spades") PORT_CODE(KEYCODE_1_PAD) + + PORT_START("LINE6") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("DB") PORT_CODE(KEYCODE_D) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("VL") PORT_CODE(KEYCODE_V) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Hearts") PORT_CODE(KEYCODE_2_PAD) + + PORT_START("LINE7") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Beep on/off") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PB") PORT_CODE(KEYCODE_B) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CV") PORT_CODE(KEYCODE_G) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Diamonds") PORT_CODE(KEYCODE_3_PAD) + + PORT_START("LINE8") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, fidelz80_state, bridgec_trigger_reset, 0) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("BR") PORT_CODE(KEYCODE_T) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("DL") PORT_CODE(KEYCODE_L) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Clubs") PORT_CODE(KEYCODE_4_PAD) +INPUT_PORTS_END + +/****************************************************************************** + Machine Drivers +******************************************************************************/ + +static MACHINE_CONFIG_START( cc10, fidelz80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(cc10_z80_mem) + MCFG_CPU_IO_MAP(fidel_z80_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_fidelz80) + + /* other hardware */ + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(fidelz80_state, cc10_porta_w)) + MCFG_I8255_IN_PORTB_CB(IOPORT("LEVEL")) + MCFG_I8255_OUT_PORTB_CB(WRITE8(fidelz80_state, fidelz80_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(fidelz80_state, fidelz80_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(fidelz80_state, fidelz80_portc_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( vcc, fidelz80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(vcc_z80_mem) + MCFG_CPU_IO_MAP(fidel_z80_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_fidelz80) + + /* other hardware */ + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + // Port A Read - NULL : only bit 6 is readable (and only sometimes) and I'm not emulating the language latch unless needed + MCFG_I8255_OUT_PORTA_CB(WRITE8(fidelz80_state, vcc_porta_w)) // display segments and s14001a lines + MCFG_I8255_IN_PORTB_CB(READ8(fidelz80_state, vcc_portb_r)) // bit 7 is readable and is the done line from the s14001a + MCFG_I8255_OUT_PORTB_CB(WRITE8(fidelz80_state, fidelz80_portb_w)) // display digits and led dots + MCFG_I8255_IN_PORTC_CB(READ8(fidelz80_state, fidelz80_portc_r)) // bits 0,1,2,3 are readable, have to do with input + MCFG_I8255_OUT_PORTC_CB(WRITE8(fidelz80_state, fidelz80_portc_w)) // bits 4,5,6,7 are writable, have to do with input + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speech", S14001A, 25000) // around 25khz + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( vsc, fidelz80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(vsc_mem) + MCFG_CPU_IO_MAP(vsc_io) + + MCFG_DEFAULT_LAYOUT(layout_vsc) + + /* other hardware */ + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(fidelz80_state, vsc_porta_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(fidelz80_state, vsc_portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(fidelz80_state, vsc_portb_w)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_IN_PA_CB(READ8(fidelz80_state, vsc_pio_porta_r)) + MCFG_Z80PIO_IN_PB_CB(READ8(fidelz80_state, vsc_pio_portb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(fidelz80_state, vsc_pio_portb_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", fidelz80_state, nmi_timer, attotime::from_hz(600)) + MCFG_TIMER_START_DELAY(attotime::from_hz(600)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speech", S14001A, 25000) // around 25khz + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( bridgec, fidelz80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_5MHz/2) // 2.5MHz + MCFG_CPU_PROGRAM_MAP(bridgec_z80_mem) + MCFG_CPU_IO_MAP(bridgec_z80_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_bridgec3) + + /* other hardware */ + MCFG_CPU_ADD("mcu", I8041, XTAL_5MHz) // 5MHz + MCFG_CPU_IO_MAP(bridgec_mcu_io) + + MCFG_I8243_ADD("i8243", NOOP, WRITE8(fidelz80_state,digit_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD("speech", S14001A, 25000) // around 25khz + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) +MACHINE_CONFIG_END + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START( cc10 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "cc10.bin", 0x0000, 0x1000, CRC(bb9e6055) SHA1(18276e57cf56465a6352239781a828c5f3d5ba63)) +ROM_END + +ROM_START(vcc) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("101-32103.bin", 0x0000, 0x1000, CRC(257bb5ab) SHA1(f7589225bb8e5f3eac55f23e2bd526be780b38b5)) // 32014.VCC??? at location b3? + ROM_LOAD("vcc2.bin", 0x1000, 0x1000, CRC(f33095e7) SHA1(692fcab1b88c910b74d04fe4d0660367aee3f4f0)) // at location a2? + ROM_LOAD("vcc3.bin", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6)) // at location a1? + + ROM_REGION(0x2000, "speech", 0) + ROM_LOAD("vcc-engl.bin", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d)) // at location c4? +ROM_END + +ROM_START(uvc) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("101-64017.b3", 0x0000, 0x2000, CRC(f1133abf) SHA1(09dd85051c4e7d364d43507c1cfea5c2d08d37f4)) // "MOS // 101-64017 // 3880" + ROM_LOAD("101-32010.a1", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6)) // "NEC P9Z021 // D2332C 228 // 101-32010", == vcc3.bin on vcc + + ROM_REGION(0x2000, "speech", 0) + ROM_LOAD("101-32107.c4", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d)) // "NEC P9Y019 // D2332C 229 // 101-32107", == vcc-engl.bin on vcc +ROM_END + +ROM_START(vsc) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("101-64108.bin", 0x0000, 0x2000, CRC(c9c98490) SHA1(e6db883df088d60463e75db51433a4b01a3e7626)) + ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341)) + ROM_LOAD("101-32024.bin", 0x4000, 0x1000, CRC(2a078676) SHA1(db2f0aba7e8ac0f84a17bae7155210cdf0813afb)) + + ROM_REGION(0x2000, "speech", 0) + ROM_LOAD("101-32107.bin", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d)) +ROM_END + +ROM_START(vbrc) // AKA model 7002 + ROM_REGION(0x10000, "maincpu", 0) + // nec 2364 mask roms; pin 27 (PGM, probably NC here due to mask roms) goes to the pcb + ROM_LOAD("101-64108.g3", 0x0000, 0x2000, CRC(08472223) SHA1(859865b13c908dbb474333263dc60f6a32461141)) + ROM_LOAD("101-64109.f3", 0x2000, 0x2000, CRC(320afa0f) SHA1(90edfe0ac19b108d232cda376b03a3a24befad4c)) + ROM_LOAD("101-64110.e3", 0x4000, 0x2000, CRC(3040d0bd) SHA1(caa55fc8d9196e408fb41e7171a68e5099519813)) + + ROM_REGION(0x1000, "mcu", 0) + ROM_LOAD("100-1009.a3", 0x0000, 0x0400, CRC(60eb343f) SHA1(8a63e95ebd62e123bdecc330c0484a47c354bd1a)) + + ROM_REGION(0x2000, "speech", 0) + ROM_LOAD("101-32118.i2", 0x0000, 0x1000, CRC(a0b8bb8f) SHA1(f56852108928d5c6caccfc8166fa347d6760a740)) +ROM_END + +ROM_START(bridgec3) // 510-1016 Rev.1 PCB has neither locations nor ic labels, so I declare the big heatsink is at C1, numbers count on the shorter length of pcb + ROM_REGION(0x10000, "maincpu", 0) + // TMM2764AD-20 EPROMS with tiny hole-punch sized colored stickers (mostly) covering the quartz windows. pin 27 (PGM) is tied to vcc with small rework wires and does not connect to pcb. + ROM_LOAD("7014_white.g3", 0x0000, 0x2000, CRC(eb1620ef) SHA1(987a9abc8c685f1a68678ea4ee65ec4a99419179)) // white sticker + ROM_LOAD("7014_red.f3", 0x2000, 0x2000, CRC(74af0019) SHA1(8dc05950c254ca050b95b93e5d0cf48f913a6d49)) // red sticker + ROM_LOAD("7014_blue.e3", 0x4000, 0x2000, CRC(341d9ca6) SHA1(370876573bb9408e75f4fc797304b6c64af0590a)) // blue sticker + + ROM_REGION(0x1000, "mcu", 0) + ROM_LOAD("100-1009.a3", 0x0000, 0x0400, CRC(60eb343f) SHA1(8a63e95ebd62e123bdecc330c0484a47c354bd1a)) // "NEC P07021-027 || D8041C 563 100-1009" + + ROM_REGION(0x2000, "speech", 0) + ROM_LOAD("101-32118.i2", 0x0000, 0x1000, CRC(a0b8bb8f) SHA1(f56852108928d5c6caccfc8166fa347d6760a740)) // "ea 101-32118 || (C) 1980 || EA 8332A247-4 || 8034" +ROM_END + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, cc10, 0, 0, cc10, fidelz80, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (Model CC10/BCC)", MACHINE_NOT_WORKING ) +COMP( 1979, vcc, 0, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Talking Chess Challenger (model VCC)", MACHINE_NOT_WORKING ) +COMP( 1979, vbrc, 0, 0, bridgec, bridgec, driver_device, 0, "Fidelity Electronics", "Bridge Challenger (model VBRC/7002)", MACHINE_NOT_WORKING ) +COMP( 1980, uvc, vcc, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Advanced Talking Chess Challenger (model UVC)", MACHINE_NOT_WORKING ) +COMP( 1980, bridgec3, vbrc, 0, bridgec, bridgec, driver_device, 0, "Fidelity Electronics", "Bridge Challenger 3 (model 7014)", MACHINE_NOT_WORKING ) +COMP( 1980, vsc, 0, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (model VSC)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/fk1.c b/src/mame/drivers/fk1.c new file mode 100644 index 00000000000..c821864f844 --- /dev/null +++ b/src/mame/drivers/fk1.c @@ -0,0 +1,477 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + FK-1 + + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/i8251.h" +#include "machine/ram.h" + + +class fk1_state : public driver_device +{ +public: + fk1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + + DECLARE_WRITE8_MEMBER(fk1_ppi_1_a_w); + DECLARE_WRITE8_MEMBER(fk1_ppi_1_b_w); + DECLARE_WRITE8_MEMBER(fk1_ppi_1_c_w); + DECLARE_READ8_MEMBER(fk1_ppi_1_a_r); + DECLARE_READ8_MEMBER(fk1_ppi_1_b_r); + DECLARE_READ8_MEMBER(fk1_ppi_1_c_r); + DECLARE_WRITE8_MEMBER(fk1_ppi_2_a_w); + DECLARE_WRITE8_MEMBER(fk1_ppi_2_c_w); + DECLARE_READ8_MEMBER(fk1_ppi_2_b_r); + DECLARE_READ8_MEMBER(fk1_ppi_2_c_r); + DECLARE_WRITE8_MEMBER(fk1_ppi_3_a_w); + DECLARE_WRITE8_MEMBER(fk1_ppi_3_b_w); + DECLARE_WRITE8_MEMBER(fk1_ppi_3_c_w); + DECLARE_READ8_MEMBER(fk1_ppi_3_a_r); + DECLARE_READ8_MEMBER(fk1_ppi_3_b_r); + DECLARE_READ8_MEMBER(fk1_ppi_3_c_r); + DECLARE_WRITE_LINE_MEMBER(fk1_pit_out0); + DECLARE_WRITE_LINE_MEMBER(fk1_pit_out1); + DECLARE_WRITE_LINE_MEMBER(fk1_pit_out2); + DECLARE_WRITE8_MEMBER(fk1_intr_w); + DECLARE_READ8_MEMBER(fk1_bank_ram_r); + DECLARE_READ8_MEMBER(fk1_bank_rom_r); + DECLARE_WRITE8_MEMBER(fk1_disk_w); + DECLARE_READ8_MEMBER(fk1_mouse_r); + DECLARE_WRITE8_MEMBER(fk1_reset_int_w); + UINT8 m_video_rol; + UINT8 m_int_vector; + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); + TIMER_DEVICE_CALLBACK_MEMBER(vsync_callback); + IRQ_CALLBACK_MEMBER(fk1_irq_callback); +}; + + +/* +Port A: + Printer +Port B: + Keyboard +Port C: + READING : + 7 - / OBF(buffer overflow for the printer) + 6 - INTE printer + 5 - ERROR printer + 4 - /PEND, lack of paper + 3 - INTR printer + 2 - INTE keyboard + 1 - IBF (data from the keyboard) + 0 - INTR keyboard + WRITING : + 6 - INTE printer + 2 - INTE keyboard + */ + +WRITE8_MEMBER( fk1_state::fk1_ppi_1_a_w ) +{ +// logerror("fk1_ppi_1_a_w %02x\n",data); +} + +WRITE8_MEMBER( fk1_state::fk1_ppi_1_b_w ) +{ +// logerror("fk1_ppi_1_b_w %02x\n",data); +} + +WRITE8_MEMBER( fk1_state::fk1_ppi_1_c_w ) +{ + //logerror("fk1_ppi_1_c_w %02x\n",data); +} + +READ8_MEMBER( fk1_state::fk1_ppi_1_a_r ) +{ + //logerror("fk1_ppi_1_a_r\n"); + return 0xff; +} + +READ8_MEMBER( fk1_state::fk1_ppi_1_b_r ) +{ +// logerror("fk1_ppi_1_b_r\n"); + return 0; +} + +READ8_MEMBER( fk1_state::fk1_ppi_1_c_r ) +{ +// logerror("fk1_ppi_1_c_r\n"); + return 0; +} + +/* +Port A: + Writing data to disk +Port B: + Reading data from disk +Port C: + READING: + 7 - / OF A data write to disk, + 6 - INTE A, + 5 - Select the drive A, B, + 4 - Not connected + 3 - INTR A + 2 - INTE B read data, + 1 - IBF B read data, + 0 - INTR B + + WRITING: + 6 - INTE A - reading data + 2 - INTE B - writing data +*/ + +WRITE8_MEMBER( fk1_state::fk1_ppi_2_a_w ) +{ +// logerror("write to disk %02x\n",data); +} + +WRITE8_MEMBER( fk1_state::fk1_ppi_2_c_w ) +{ +// logerror("fk1_ppi_2_c_w %02x\n",data); +} + +READ8_MEMBER( fk1_state::fk1_ppi_2_b_r ) +{ +// logerror("read from disk\n"); + return 0; +} + +READ8_MEMBER( fk1_state::fk1_ppi_2_c_r ) +{ +// logerror("fk1_ppi_2_c_r\n"); + return 0; +} + + +/* + +Port A: + 6 - / disk, authorization disk operations, + 3 - INTE MOUSE, permit suspension from mouse, + 2 - INTE RTC from the system clock of 50 Hz, + 1 and 0 - to set the type for hours write to the disk (01 index, 11 address mark, mark the date, 00 other). + +Port B: + Video ROL register +Port C + + READING: + 7 - INDEX ( index mark on the disk) + 6 - I do not know, + 5 - WRITE_PROTECT the protected disk, + 4 - TRAC_00 as a sign of trace + + WRITING: + 3 - HEAD LOAD + 2 - TRACK_43 + 1 - DIRC - direction to set the direction of stepping disk + 0 - STEP, move disk (0 1 .. 0.). + +*/ +WRITE8_MEMBER( fk1_state::fk1_ppi_3_a_w ) +{ +// logerror("fk1_ppi_3_a_w %02x\n",data); +} + +WRITE8_MEMBER( fk1_state::fk1_ppi_3_b_w ) +{ + m_video_rol = data; +} + +WRITE8_MEMBER( fk1_state::fk1_ppi_3_c_w ) +{ +// logerror("fk1_ppi_3_c_w %02x\n",data); +} + +READ8_MEMBER( fk1_state::fk1_ppi_3_a_r ) +{ +// logerror("fk1_ppi_3_a_r\n"); + return 0; +} + +READ8_MEMBER( fk1_state::fk1_ppi_3_b_r ) +{ + return m_video_rol; +} + +READ8_MEMBER( fk1_state::fk1_ppi_3_c_r ) +{ +// logerror("fk1_ppi_3_c_r\n"); + return 0; +} + +WRITE_LINE_MEMBER( fk1_state::fk1_pit_out0 ) +{ + // System time + logerror("WRITE_LINE_MEMBER(fk1_pit_out0)\n"); +} + +WRITE_LINE_MEMBER( fk1_state::fk1_pit_out1 ) +{ + // Timeout for disk operation + logerror("WRITE_LINE_MEMBER(fk1_pit_out1)\n"); +} + +WRITE_LINE_MEMBER( fk1_state::fk1_pit_out2 ) +{ + // Overflow for disk operations + logerror("WRITE_LINE_MEMBER(fk1_pit_out2)\n"); +} + +/* + 0 no interrupt allowed, + 1 allowed INTR-7, + 2 allowed INTR-7 and INTR-6, + 8 any interruption allowed. +*/ + +WRITE8_MEMBER( fk1_state::fk1_intr_w ) +{ + logerror("fk1_intr_w %02x\n",data); +} + +READ8_MEMBER( fk1_state::fk1_bank_ram_r ) +{ + address_space &space_mem = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + space_mem.install_write_bank(0x0000, 0x3fff, "bank1"); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x4000); + return 0; +} + +READ8_MEMBER( fk1_state::fk1_bank_rom_r ) +{ + address_space &space_mem = m_maincpu->space(AS_PROGRAM); + space_mem.unmap_write(0x0000, 0x3fff); + membank("bank1")->set_base(memregion("maincpu")->base()); + membank("bank2")->set_base(m_ram->pointer() + 0x10000); + return 0; +} + +/* + 4 - FORMAT authorization + 3 - READ_ADDRESS_MARK + 2 - READ_DATA_MARK + 1 - WRITE + 0 - READ + Functions are allowed in one. +*/ + +WRITE8_MEMBER( fk1_state::fk1_disk_w ) +{ +// logerror("fk1_disk_w %02x\n",data); +} + +/* +7 and 6 - 1 to connected mouse and 0 if not connected, +5 - / T2, right-click +4 - / T1, left-click +3 - / BY, Y-axis +2 - / AY, Y-axis +1 - / BX, X-axis +0 - / AX, X-axis +*/ + +READ8_MEMBER( fk1_state::fk1_mouse_r ) +{ +// logerror("fk1_mouse_r\n"); + return 0; +} + +/*Write to port 70 resets the interrupt from the system clock of 50 Hz. */ + +WRITE8_MEMBER( fk1_state::fk1_reset_int_w ) +{ + logerror("fk1_reset_int_w\n"); +} + +static ADDRESS_MAP_START(fk1_mem, AS_PROGRAM, 8, fk1_state) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(fk1_io, AS_IO, 8, fk1_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE( 0x10, 0x13 ) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE( 0x20, 0x23 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) + AM_RANGE( 0x30, 0x30 ) AM_READWRITE(fk1_bank_ram_r,fk1_intr_w) + AM_RANGE( 0x40, 0x40 ) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE( 0x41, 0x41 ) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE( 0x50, 0x50 ) AM_READWRITE(fk1_bank_rom_r,fk1_disk_w) + AM_RANGE( 0x60, 0x63 ) AM_DEVREADWRITE("ppi8255_3", i8255_device, read, write) + AM_RANGE( 0x70, 0x70 ) AM_READWRITE(fk1_mouse_r,fk1_reset_int_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( fk1 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') +INPUT_PORTS_END + +TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::keyboard_callback) +{ + if (ioport("LINE0")->read()) + { + m_int_vector = 6; + m_maincpu->set_input_line(0, HOLD_LINE); + } +} + +/* +7 ? DATA_READY +6 ? TIMEOUT +5 ? OVERFLOW +4 ? RTC_50HZ +3 ? MOUSE +2 ? SIO +1 ? KEYBOARD +0 ? PRINTER +*/ + +IRQ_CALLBACK_MEMBER(fk1_state::fk1_irq_callback) +{ + logerror("IRQ %02x\n", m_int_vector*2); + return m_int_vector * 2; +} + +TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::vsync_callback) +{ + m_int_vector = 3; + m_maincpu->set_input_line(0, HOLD_LINE); +} + + +void fk1_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + space.unmap_write(0x0000, 0x3fff); + membank("bank1")->set_base(memregion("maincpu")->base()); // ROM + membank("bank2")->set_base(ram + 0x10000); // VRAM + membank("bank3")->set_base(ram + 0x8000); + membank("bank4")->set_base(ram + 0xc000); +} + +UINT32 fk1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code; + int y, x, b; + UINT8 *ram = m_ram->pointer(); + + for (x = 0; x < 64; x++) + { + for (y = 0; y < 256; y++) + { + code = ram[x * 0x100 + ((y + m_video_rol) & 0xff) + 0x10000]; + for (b = 0; b < 8; b++) + { + bitmap.pix16(y, x*8+b) = ((code << b) & 0x80) ? 1 : 0; + } + } + } + return 0; +} + +static MACHINE_CONFIG_START( fk1, fk1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz / 2) + MCFG_CPU_PROGRAM_MAP(fk1_mem) + MCFG_CPU_IO_MAP(fk1_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fk1_state,fk1_irq_callback) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(fk1_state, screen_update) + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(50) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(fk1_state, fk1_pit_out0)) + MCFG_PIT8253_CLK1(1000000) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(fk1_state, fk1_pit_out1)) + MCFG_PIT8253_CLK2(0) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(fk1_state, fk1_pit_out2)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(fk1_state, fk1_ppi_1_a_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(fk1_state, fk1_ppi_1_a_w)) + MCFG_I8255_IN_PORTB_CB(READ8(fk1_state, fk1_ppi_1_b_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(fk1_state, fk1_ppi_1_b_w)) + MCFG_I8255_IN_PORTC_CB(READ8(fk1_state, fk1_ppi_1_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(fk1_state, fk1_ppi_1_c_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(fk1_state, fk1_ppi_2_a_w)) + MCFG_I8255_IN_PORTB_CB(READ8(fk1_state, fk1_ppi_2_b_r)) + MCFG_I8255_IN_PORTC_CB(READ8(fk1_state, fk1_ppi_2_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(fk1_state, fk1_ppi_2_c_w)) + + MCFG_DEVICE_ADD("ppi8255_3", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(fk1_state, fk1_ppi_3_a_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(fk1_state, fk1_ppi_3_a_w)) + MCFG_I8255_IN_PORTB_CB(READ8(fk1_state, fk1_ppi_3_b_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(fk1_state, fk1_ppi_3_b_w)) + MCFG_I8255_IN_PORTC_CB(READ8(fk1_state, fk1_ppi_3_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(fk1_state, fk1_ppi_3_c_w)) + + /* uart */ + MCFG_DEVICE_ADD("uart", I8251, 0) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("80K") // 64 + 16 + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", fk1_state, keyboard_callback, attotime::from_hz(24000)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("vsync_timer", fk1_state, vsync_callback, attotime::from_hz(50)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( fk1 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "orig", "Original BIOS" ) + ROMX_LOAD( "fk1.u65", 0x0000, 0x0800, CRC(145561f8) SHA1(a4eb17d773e51b34620c508b6cebcb4531ae99c2), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "diag", "Diag BIOS" ) + ROMX_LOAD( "fk1-diag.u65", 0x0000, 0x0800, CRC(e0660ae1) SHA1(6ad609049b28f27126af0a8a6224362351073dee), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, fk1, 0, 0, fk1, fk1, driver_device, 0, "Statni statek Klicany", "FK-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/fm7.c b/src/mame/drivers/fm7.c new file mode 100644 index 00000000000..787e38d4f9b --- /dev/null +++ b/src/mame/drivers/fm7.c @@ -0,0 +1,2539 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/*********************************************************************************************** + + Fujitsu Micro 7 (FM-7) + + 12/05/2009 Skeleton driver. + + Computers in this series: + + | Release | Main CPU | Sub CPU | RAM | + ===================================================================================== + FM-8 | 1981-05 | M68A09 @ 1MHz | M6809 | 64K (main) + 48K (VRAM) | + FM-7 | 1982-11 | M68B09 @ 2MHz | M68B09 | 64K (main) + 48K (VRAM) | + FM-NEW7 | 1984-05 | M68B09 @ 2MHz | M68B09 | 64K (main) + 48K (VRAM) | + FM-77 | 1984-05 | M68B09 @ 2MHz | M68B09E | 64/256K (main) + 48K (VRAM) | + FM-77AV | 1985-10 | M68B09E @ 2MHz | M68B09 | 128/192K (main) + 96K (VRAM) | + FM-77AV20 | 1986-10 | M68B09E @ 2MHz | M68B09 | 128/192K (main) + 96K (VRAM) | + FM-77AV40 | 1986-10 | M68B09E @ 2MHz | M68B09 | 192/448K (main) + 144K (VRAM) | + FM-77AV20EX | 1987-11 | M68B09E @ 2MHz | M68B09 | 128/192K (main) + 96K (VRAM) | + FM-77AV40EX | 1987-11 | M68B09E @ 2MHz | M68B09 | 192/448K (main) + 144K (VRAM) | + FM-77AV40SX | 1988-11 | M68B09E @ 2MHz | M68B09 | 192/448K (main) + 144K (VRAM) | + + Note: FM-77AV dumps probably come from a FM-77AV40SX. Shall we confirm that both computers + used the same BIOS components? + + memory map info from http://www.nausicaa.net/~lgreenf/fm7page.htm + see also http://retropc.net/ryu/xm7/xm7.shtml + + + Known issues: + - Beeper is not implemented + - Keyboard repeat is not implemented + - Optional Kanji ROM use is not implemented + - Other optional hardware is not implemented (RS232, Z80 card...) + - FM-77AV20 and later aren't working (extra features not yet implemented) + +************************************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "cpu/i86/i86.h" +#include "cpu/z80/z80.h" +#include "sound/ay8910.h" +#include "sound/2203intf.h" +#include "sound/wave.h" +#include "sound/beep.h" + +#include "imagedev/cassette.h" +#include "formats/fm7_cas.h" +#include "imagedev/flopdrv.h" +#include "bus/centronics/dsjoy.h" +#include "includes/fm7.h" + +/* key scancode conversion table + * The FM-7 expects different scancodes when shift,ctrl or graph is held, or + * when kana is active. + */ + // TODO: fill in shift,ctrl,graph and kana code +static const UINT16 fm7_key_list[0x60][7] = +{ // norm shift ctrl graph kana sh.kana scan + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x01}, // ESC + {0x31, 0x21, 0xf9, 0xf9, 0xc7, 0x00, 0x02}, // 1 + {0x32, 0x22, 0xfa, 0xfa, 0xcc, 0x00, 0x03}, // 2 + {0x33, 0x23, 0xfb, 0xfb, 0xb1, 0xa7, 0x04}, + {0x34, 0x24, 0xfc, 0xfc, 0xb3, 0xa9, 0x05}, + {0x35, 0x25, 0xf2, 0xf2, 0xb4, 0xaa, 0x06}, + {0x36, 0x26, 0xf3, 0xf3, 0xb5, 0xab, 0x07}, + {0x37, 0x27, 0xf4, 0xf4, 0xd4, 0xac, 0x08}, + {0x38, 0x28, 0xf5, 0xf5, 0xd5, 0xad, 0x09}, + {0x39, 0x29, 0xf6, 0xf6, 0xd6, 0xae, 0x0a}, // 9 + {0x30, 0x00, 0xf7, 0xf7, 0xdc, 0xa6, 0x0b}, // 0 + {0x2d, 0x3d, 0x1e, 0x8c, 0xce, 0x00, 0x0c}, // - + {0x5e, 0x7e, 0x1c, 0x8b, 0xcd, 0x00, 0x0d}, // ^ + {0x5c, 0x7c, 0xf1, 0xf1, 0xb0, 0x00, 0x0e}, // Yen + {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f}, // Backspace + {0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x10}, // Tab + {0x71, 0x51, 0x11, 0xfd, 0xc0, 0x00, 0x11}, // Q + {0x77, 0x57, 0x17, 0xf8, 0xc3, 0x00, 0x12}, // W + {0x65, 0x45, 0x05, 0xe4, 0xb2, 0xa8, 0x13}, // E + {0x72, 0x52, 0x12, 0xe5, 0xbd, 0x00, 0x14}, + {0x74, 0x54, 0x14, 0x9c, 0xb6, 0x00, 0x15}, + {0x79, 0x59, 0x19, 0x9d, 0xdd, 0x00, 0x16}, + {0x75, 0x55, 0x15, 0xf0, 0xc5, 0x00, 0x17}, + {0x69, 0x49, 0x09, 0xe8, 0xc6, 0x00, 0x18}, + {0x6f, 0x4f, 0x0f, 0xe9, 0xd7, 0x00, 0x19}, + {0x70, 0x50, 0x10, 0x8d, 0xbe, 0x00, 0x1a}, // P + {0x40, 0x60, 0x00, 0x8a, 0xde, 0x00, 0x1b}, // @ + {0x5b, 0x7b, 0x1b, 0xed, 0xdf, 0xa2, 0x1c}, // [ + {0x0d, 0x0d, 0x00, 0x0d, 0x0d, 0x0d, 0x1d}, // Return + {0x61, 0x41, 0x01, 0x95, 0xc1, 0x00, 0x1e}, // A + {0x73, 0x53, 0x13, 0x96, 0xc4, 0x00, 0x1f}, // S + + {0x64, 0x44, 0x04, 0xe6, 0xbc, 0x00, 0x20}, // D + {0x66, 0x46, 0x06, 0xe7, 0xca, 0x00, 0x21}, + {0x67, 0x47, 0x07, 0x9e, 0xb7, 0x00, 0x22}, + {0x68, 0x48, 0x08, 0x9f, 0xb8, 0x00, 0x23}, + {0x6a, 0x4a, 0x0a, 0xea, 0xcf, 0x00, 0x24}, + {0x6b, 0x4b, 0x0b, 0xeb, 0xc9, 0x00, 0x25}, + {0x6c, 0x4c, 0x0c, 0x8e, 0xd8, 0x00, 0x26}, // L + {0x3b, 0x2b, 0x00, 0x99, 0xda, 0x00, 0x27}, // ; + {0x3a, 0x2a, 0x00, 0x94, 0xb9, 0x00, 0x28}, // : + {0x5d, 0x7d, 0x1d, 0xec, 0xd1, 0xa3, 0x29}, // ] + {0x7a, 0x5a, 0x1a, 0x80, 0xc2, 0xaf, 0x2a}, // Z + {0x78, 0x58, 0x18, 0x81, 0xbb, 0x00, 0x2b}, // X + {0x63, 0x43, 0x03, 0x82, 0xbf, 0x00, 0x2c}, // C + {0x76, 0x56, 0x16, 0x83, 0xcb, 0x00, 0x2d}, + {0x62, 0x42, 0x02, 0x84, 0xba, 0x00, 0x2e}, + {0x6e, 0x4e, 0x0e, 0x85, 0xd0, 0x00, 0x2f}, + {0x6d, 0x4d, 0x0d, 0x86, 0xd3, 0x00, 0x30}, // M + {0x2c, 0x3c, 0x00, 0x87, 0xc8, 0xa4, 0x31}, // < + {0x2e, 0x3e, 0x00, 0x88, 0xd9, 0xa1, 0x32}, // > + {0x2f, 0x3f, 0x00, 0x97, 0xd2, 0xa5, 0x33}, // / + {0x22, 0x5f, 0x1f, 0xe0, 0xdb, 0x00, 0x34}, // " + {0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x35}, // Space + {0x2a, 0x2a, 0x00, 0x98, 0x2a, 0x2a, 0x36}, // Tenkey + {0x2f, 0x2f, 0x00, 0x91, 0x2f, 0x2f, 0x37}, + {0x2b, 0x2b, 0x00, 0x99, 0x2b, 0x2b, 0x38}, + {0x2d, 0x2d, 0x00, 0xee, 0x2d, 0x2d, 0x39}, + {0x37, 0x37, 0x00, 0xe1, 0x37, 0x37, 0x3a}, + {0x38, 0x38, 0x00, 0xe2, 0x38, 0x38, 0x3b}, + {0x39, 0x39, 0x00, 0xe3, 0x39, 0x39, 0x3c}, + {0x3d, 0x3d, 0x00, 0xef, 0x3d, 0x3d, 0x3d}, // Tenkey = + {0x34, 0x34, 0x00, 0x93, 0x34, 0x34, 0x3e}, + {0x35, 0x35, 0x00, 0x8f, 0x35, 0x35, 0x3f}, + + {0x36, 0x36, 0x00, 0x92, 0x36, 0x36, 0x40}, + {0x2c, 0x2c, 0x00, 0x00, 0x2c, 0x2c, 0x41}, + {0x31, 0x31, 0x00, 0x9a, 0x31, 0x31, 0x42}, + {0x32, 0x32, 0x00, 0x90, 0x32, 0x32, 0x43}, + {0x33, 0x33, 0x00, 0x9b, 0x33, 0x33, 0x44}, + {0x0d, 0x0d, 0x00, 0x0d, 0x0d, 0x0d, 0x45}, + {0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x46}, + {0x2e, 0x2e, 0x00, 0x2e, 0x2e, 0x2e, 0x47}, + {0x12, 0x12, 0x00, 0x12, 0x12, 0x12, 0x48}, // INS + {0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x49}, // EL + {0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x4a}, // CLS + {0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x7f, 0x4b}, // DEL + {0x11, 0x11, 0x00, 0x11, 0x11, 0x11, 0x4c}, // DUP + {0x1e, 0x19, 0x00, 0x1e, 0x1e, 0x19, 0x4d}, // Cursor Up + {0x0b, 0x0b, 0x00, 0x0b, 0x0b, 0x0b, 0x4e}, // HOME + {0x1d, 0x02, 0x00, 0x1d, 0x1d, 0x02, 0x4f}, // Cursor Left + {0x1f, 0x1a, 0x00, 0x1f, 0x1f, 0x1a, 0x50}, // Cursor Down + {0x1c, 0x06, 0x00, 0x1c, 0x1c, 0x16, 0x51}, // Cursor Right + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c}, // BREAK + {0x101, 0x00, 0x101, 0x101, 0x101, 0x00, 0x5d}, // PF1 + {0x102, 0x00, 0x102, 0x102, 0x102, 0x00, 0x5e}, + {0x103, 0x00, 0x103, 0x103, 0x103, 0x00, 0x5f}, + {0x104, 0x00, 0x104, 0x104, 0x104, 0x00, 0x60}, + {0x105, 0x00, 0x105, 0x105, 0x105, 0x00, 0x61}, + {0x106, 0x00, 0x106, 0x106, 0x106, 0x00, 0x62}, + {0x107, 0x00, 0x107, 0x107, 0x107, 0x00, 0x63}, + {0x108, 0x00, 0x108, 0x108, 0x108, 0x00, 0x64}, + {0x109, 0x00, 0x109, 0x109, 0x109, 0x00, 0x65}, + {0x10a, 0x00, 0x10a, 0x10a, 0x10a, 0x00, 0x66}, // PF10 + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} +}; + + +void fm7_state::main_irq_set_flag(UINT8 flag) +{ + m_irq_flags |= flag; + + if(m_irq_flags != 0) + m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE); +} + +void fm7_state::main_irq_clear_flag(UINT8 flag) +{ + m_irq_flags &= ~flag; + + if(m_irq_flags == 0) + m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE); +} + + +void fm7_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_FM7_BEEPER_OFF: + fm7_beeper_off(ptr, param); + break; + case TIMER_FM77AV_ENCODER_ACK: + fm77av_encoder_ack(ptr, param); + break; + case TIMER_FM7_IRQ: + fm7_timer_irq(ptr, param); + break; + case TIMER_FM7_SUBTIMER_IRQ: + fm7_subtimer_irq(ptr, param); + break; + case TIMER_FM7_KEYBOARD_POLL: + fm7_keyboard_poll(ptr, param); + break; + case TIMER_FM77AV_ALU_TASK_END: + fm77av_alu_task_end(ptr, param); + break; + case TIMER_FM77AV_VSYNC: + fm77av_vsync(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in fm7_state::device_timer"); + } +} + + +/* + * Main CPU: I/O port 0xfd02 + * + * On read: returns cassette data (bit 7) and printer status (bits 0-5) + * On write: sets IRQ masks + * bit 0 - keypress + * bit 1 - printer + * bit 2 - timer + * bit 3 - not used + * bit 4 - MFD + * bit 5 - TXRDY + * bit 6 - RXRDY + * bit 7 - SYNDET + * + */ +WRITE8_MEMBER(fm7_state::fm7_irq_mask_w) +{ + m_irq_mask = data; + logerror("IRQ mask set: 0x%02x\n",m_irq_mask); +} + +/* + * Main CPU: I/O port 0xfd03 + * + * On read: returns which IRQ is currently active (typically read by IRQ handler) + * bit 0 - keypress + * bit 1 - printer + * bit 2 - timer + * bit 3 - ??? + * On write: Buzzer/Speaker On/Off + * bit 0 - speaker on/off + * bit 6 - buzzer on for 205ms + * bit 7 - buzzer on/off + */ +READ8_MEMBER(fm7_state::fm7_irq_cause_r) +{ + UINT8 ret = ~m_irq_flags; + + // Timer and Printer IRQ flags are cleared when this port is read + // Keyboard IRQ flag is cleared when the scancode is read from + // either keyboard data port (main CPU 0xfd01 or sub CPU 0xd401) + if(m_irq_flags & 0x04) + main_irq_clear_flag(IRQ_FLAG_TIMER); + if(m_irq_flags & 0x02) + main_irq_clear_flag(IRQ_FLAG_PRINTER); + + logerror("IRQ flags read: 0x%02x\n",ret); + return ret; +} + +TIMER_CALLBACK_MEMBER(fm7_state::fm7_beeper_off) +{ + m_beeper->set_state(0); + logerror("timed beeper off\n"); +} + +WRITE8_MEMBER(fm7_state::fm7_beeper_w) +{ + m_speaker_active = data & 0x01; + + if(!m_speaker_active) // speaker not active, disable all beeper sound + { + m_beeper->set_state(0); + return; + } + + if(data & 0x80) + { + if(m_speaker_active) + m_beeper->set_state(1); + } + else + m_beeper->set_state(0); + + if(data & 0x40) + { + if(m_speaker_active) + { + m_beeper->set_state(1); + logerror("timed beeper on\n"); + timer_set(attotime::from_msec(205), TIMER_FM7_BEEPER_OFF); + } + } + logerror("beeper state: %02x\n",data); +} + + +/* + * Sub CPU: port 0xd403 (read-only) + * On read: timed buzzer sound + */ +READ8_MEMBER(fm7_state::fm7_sub_beeper_r) +{ + if(m_speaker_active) + { + m_beeper->set_state(1); + logerror("timed beeper on\n"); + timer_set(attotime::from_msec(205), TIMER_FM7_BEEPER_OFF); + } + return 0xff; +} + +READ8_MEMBER(fm7_state::vector_r) +{ + UINT8* RAM = memregion("maincpu")->base(); + UINT8* ROM = memregion("init")->base(); + UINT32 init_size = memregion("init")->bytes(); + + if(m_init_rom_en) + return ROM[(init_size-0x10)+offset]; + else + { + if(m_type == SYS_FM7) + return RAM[0xfff0+offset]; + else + return RAM[0x3fff0+offset]; + } +} + +WRITE8_MEMBER(fm7_state::vector_w) +{ + UINT8* RAM = memregion("maincpu")->base(); + + if(m_type == SYS_FM7) + RAM[0xfff0+offset] = data; + else + RAM[0x3fff0+offset] = data; +} + +/* + * Main CPU: I/O port 0xfd04 + * + * bit 0 - attention IRQ active, clears flag when read. + * bit 1 - break key active + */ +READ8_MEMBER(fm7_state::fm7_fd04_r) +{ + UINT8 ret = 0xff; + + if(m_video.attn_irq != 0) + { + ret &= ~0x01; + m_video.attn_irq = 0; + } + if(m_break_flag != 0) + { + ret &= ~0x02; + } + return ret; +} + +/* + * Main CPU: I/O port 0xfd0f + * + * On read, enables BASIC ROM at 0x8000 (default) + * On write, disables BASIC ROM, enables RAM (if more than 32kB) + */ +READ8_MEMBER(fm7_state::fm7_rom_en_r) +{ + if(!space.debugger_access()) + { + UINT8* RAM = memregion("maincpu")->base(); + + m_basic_rom_en = 1; + if(m_type == SYS_FM7) + { + membank("bank1")->set_base(RAM+0x38000); + } + else + fm7_mmr_refresh(space); + logerror("BASIC ROM enabled\n"); + } + return 0x00; +} + +WRITE8_MEMBER(fm7_state::fm7_rom_en_w) +{ + UINT8* RAM = memregion("maincpu")->base(); + + m_basic_rom_en = 0; + if(m_type == SYS_FM7) + { + membank("bank1")->set_base(RAM+0x8000); + } + else + fm7_mmr_refresh(space); + logerror("BASIC ROM disabled\n"); +} + +/* + * Main CPU: port 0xfd10 + * Initiate ROM enable. (FM-77AV and later only) + * Port is write-only. Initiate ROM is on by default. + * + */ +WRITE8_MEMBER(fm7_state::fm7_init_en_w) +{ + if(data & 0x02) + { + m_init_rom_en = 0; + fm7_mmr_refresh(space); + } + else + { + m_init_rom_en = 1; + fm7_mmr_refresh(space); + } +} + +/* + * Main CPU: I/O ports 0xfd18 - 0xfd1f + * Floppy Disk Controller (MB8877A) + */ +WRITE_LINE_MEMBER(fm7_state::fm7_fdc_intrq_w) +{ + m_fdc_irq_flag = state; +} + +WRITE_LINE_MEMBER(fm7_state::fm7_fdc_drq_w) +{ + m_fdc_drq_flag = state; +} + +READ8_MEMBER(fm7_state::fm7_fdc_r) +{ + UINT8 ret = 0; + + switch(offset) + { + case 0: + return m_fdc->status_r(space, offset); + case 1: + return m_fdc->track_r(space, offset); + case 2: + return m_fdc->sector_r(space, offset); + case 3: + return m_fdc->data_r(space, offset); + case 4: + return m_fdc_side | 0xfe; + case 5: + return m_fdc_drive; + case 6: + // FM-7 always returns 0xff for this register + return 0xff; + case 7: + if(m_fdc_irq_flag != 0) + ret |= 0x40; + if(m_fdc_drq_flag != 0) + ret |= 0x80; + return ret; + } + logerror("FDC: read from 0x%04x\n",offset+0xfd18); + + return 0x00; +} + +WRITE8_MEMBER(fm7_state::fm7_fdc_w) +{ + switch(offset) + { + case 0: + m_fdc->cmd_w(space, offset,data); + break; + case 1: + m_fdc->track_w(space, offset,data); + break; + case 2: + m_fdc->sector_w(space, offset,data); + break; + case 3: + m_fdc->data_w(space, offset,data); + break; + case 4: + m_fdc_side = data & 0x01; + if (m_floppy) + m_floppy->ss_w(data & 0x01); + logerror("FDC: wrote %02x to 0x%04x (side)\n",data,offset+0xfd18); + break; + case 5: + m_fdc_drive = data; + if((data & 0x03) > 0x01) + { + m_fdc_drive = 0; + } + else + { + switch (data & 0x01) + { + case 0: m_floppy = m_floppy0->get_device(); break; + case 1: m_floppy = m_floppy1->get_device(); break; + } + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + m_floppy->mon_w(!BIT(data, 7)); + + logerror("FDC: wrote %02x to 0x%04x (drive)\n",data,offset+0xfd18); + } + break; + case 6: + // FM77AV and later only. FM-7 returns 0xff; + // bit 6 = 320k(1)/640k(0) FDD + // bits 2,3 = logical drive + logerror("FDC: mode write - %02x\n",data); + break; + default: + logerror("FDC: wrote %02x to 0x%04x\n",data,offset+0xfd18); + } +} + +/* + * Main CPU: I/O ports 0xfd00-0xfd01 + * Sub CPU: I/O ports 0xd400-0xd401 + * + * The scancode of the last key pressed is stored in fd/d401, with the 9th + * bit (MSB) in bit 7 of fd/d400. 0xfd00 also holds a flag for the main + * CPU clock speed in bit 0 (0 = 1.2MHz, 1 = 2MHz) + * Clears keyboard IRQ flag + */ +READ8_MEMBER(fm7_state::fm7_keyboard_r) +{ + UINT8 ret; + switch(offset) + { + case 0: + ret = (m_current_scancode >> 1) & 0x80; + ret |= 0x01; // 1 = 2MHz, 0 = 1.2MHz + return ret; + case 1: + main_irq_clear_flag(IRQ_FLAG_KEY); + return m_current_scancode & 0xff; + default: + return 0x00; + } +} + +READ8_MEMBER(fm7_state::fm7_sub_keyboard_r) +{ + UINT8 ret; + switch(offset) + { + case 0: + ret = (m_current_scancode >> 1) & 0x80; + return ret; + case 1: + main_irq_clear_flag(IRQ_FLAG_KEY); + return m_current_scancode & 0xff; + default: + return 0x00; + } +} + +/* + * Sub CPU: port 0xd431, 0xd432 + * Keyboard encoder + * + * d431 (R/W): Data register (8 bit) + * d432 (R/O): Status register + * bit 0 - ACK + * bit 7 - LATCH (0 if ready to receive) + * + * Encoder commands: + * 00 xx : Set scancode format (FM-7, FM16B(?), Scan(Make/Break)) + * 01 : Get scancode format + * 02 xx : Set LED status + * 03 : Get LED status + * 04 xx : Enable/Disable key repeat + * 05 xx xx : Set repeat rate and time + * 80 00 : Get RTC + * 80 01 xx xx xx xx xx xx xx : Set RTC + * 81 xx : Video digitise + * 82 xx : Set video mode(?) + * 83 : Get video mode(?) + * 84 xx : Video brightness (monitor?) + * + * ACK is received after 5us. + */ +READ8_MEMBER(fm7_state::fm77av_key_encoder_r) +{ + UINT8 ret = 0xff; + switch(offset) + { + case 0x00: // data register + if(m_encoder.rx_count > 0) + { + ret = m_encoder.buffer[m_encoder.position]; + m_encoder.position++; + m_encoder.rx_count--; + m_encoder.latch = 0; + } + if(m_encoder.rx_count > 0) + m_encoder.latch = 1; // more data to receive + break; + case 0x01: // status register + if(m_encoder.latch != 0) + ret &= ~0x80; + if(m_encoder.ack == 0) + ret &= ~0x01; + break; + } + + return ret; +} + +void fm7_state::fm77av_encoder_setup_command() +{ + switch(m_encoder.buffer[0]) + { + case 0: // set scancode format + m_encoder.tx_count = 2; + break; + case 1: // get scancode format + m_encoder.tx_count = 1; + break; + case 2: // set LED + m_encoder.tx_count = 2; + break; + case 3: // get LED + m_encoder.tx_count = 1; + break; + case 4: // enable repeat + m_encoder.tx_count = 2; + break; + case 5: // set repeat rate + m_encoder.tx_count = 3; + break; + case 0x80: // get/set RTC (at least two bytes, 9 if byte two = 0x01) + m_encoder.tx_count = 2; + break; + case 0x81: // digitise + m_encoder.tx_count = 2; + break; + case 0x82: // set screen mode + m_encoder.tx_count = 2; + break; + case 0x83: // get screen mode + m_encoder.tx_count = 1; + break; + case 0x84: // set monitor brightness + m_encoder.tx_count = 2; + break; + default: + m_encoder.tx_count = 0; + m_encoder.rx_count = 0; + m_encoder.position = 0; + logerror("ENC: Unknown command 0x%02x sent, ignoring\n",m_encoder.buffer[0]); + } +} + +TIMER_CALLBACK_MEMBER(fm7_state::fm77av_encoder_ack) +{ + m_encoder.ack = 1; +} + +void fm7_state::fm77av_encoder_handle_command() +{ + switch(m_encoder.buffer[0]) + { + case 0: // set keyboard scancode mode + m_key_scan_mode = m_encoder.buffer[1]; + m_encoder.rx_count = 0; + logerror("ENC: Keyboard set to mode %i\n",m_encoder.buffer[1]); + break; + case 1: // get keyboard scancode mode + m_encoder.buffer[0] = m_key_scan_mode; + m_encoder.rx_count = 1; + logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); + break; + case 2: // set LEDs + m_encoder.rx_count = 0; + logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); + break; + case 3: // get LEDs + m_encoder.rx_count = 1; + logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); + break; + case 4: // enable key repeat + m_encoder.rx_count = 0; + logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); + break; + case 5: // set key repeat rate + m_key_repeat = m_encoder.buffer[2] * 10; + m_key_delay = m_encoder.buffer[1] * 10; + m_encoder.rx_count = 0; + logerror("ENC: Keyboard repeat rate set to %i/%i\n",m_encoder.buffer[1],m_encoder.buffer[2]); + break; + case 0x80: // get/set RTC + if(m_encoder.buffer[1] == 0x01) + m_encoder.rx_count = 0; + else + m_encoder.rx_count = 7; + logerror("ENC: Command %02x %02x received\n",m_encoder.buffer[0],m_encoder.buffer[1]); + break; + case 0x81: // digitise + m_encoder.rx_count = 0; + logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); + break; + case 0x82: // set screen mode + m_encoder.rx_count = 0; + logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); + break; + case 0x83: // get screen mode + m_encoder.rx_count = 1; + logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); + break; + case 0x84: // set monitor brightness + m_encoder.rx_count = 0; + logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); + break; + } + m_encoder.position = 0; +} + +WRITE8_MEMBER(fm7_state::fm77av_key_encoder_w) +{ + m_encoder.ack = 0; + if(offset == 0) // data register + { + if(m_encoder.position == 0) // first byte + { + fm77av_encoder_setup_command(); + } + if(m_encoder.position == 1) // second byte + { + if(m_encoder.buffer[0] == 0x80 || m_encoder.buffer[1] == 0x01) + { + m_encoder.tx_count = 8; // 80 01 command is 9 bytes + } + } + m_encoder.buffer[m_encoder.position] = data; + m_encoder.position++; + m_encoder.tx_count--; + if(m_encoder.tx_count == 0) // last byte + fm77av_encoder_handle_command(); + + // wait 5us to set ACK flag + timer_set(attotime::from_usec(5), TIMER_FM77AV_ENCODER_ACK); + + //logerror("ENC: write 0x%02x to data register, moved to pos %i\n",data,m_encoder.position); + } +} + +WRITE_LINE_MEMBER(fm7_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER(fm7_state::write_centronics_fault) +{ + m_centronics_fault = state; +} + +WRITE_LINE_MEMBER(fm7_state::write_centronics_ack) +{ + m_centronics_ack = state; +} + +WRITE_LINE_MEMBER(fm7_state::write_centronics_perror) +{ + m_centronics_perror = state; +} + +READ8_MEMBER(fm7_state::fm7_cassette_printer_r) +{ + // bit 7: cassette input + // bit 5: printer DET2 + // bit 4: printer DTT1 + // bit 3: printer PE + // bit 2: printer acknowledge + // bit 1: printer error + // bit 0: printer busy + UINT8 ret = 0; + + if(m_cassette->input() > 0.03) + ret |= 0x80; + + if(m_cassette->get_state() & CASSETTE_MOTOR_DISABLED) + ret |= 0x80; // cassette input is high when not in use. + + ret |= 0x70; + ret |= m_centronics_perror << 3; + ret |= m_centronics_ack << 2; + ret |= m_centronics_fault << 1; + ret |= m_centronics_busy; + + return ret; +} + +WRITE8_MEMBER(fm7_state::fm7_cassette_printer_w) +{ + switch(offset) + { + case 0: + // bit 7: SLCTIN (select?) + // bit 6: printer strobe + // bit 1: cassette motor + // bit 0: cassette output + if((data & 0x01) != (m_cp_prev & 0x01)) + m_cassette->output((data & 0x01) ? +1.0 : -1.0); + if((data & 0x02) != (m_cp_prev & 0x02)) + m_cassette->change_state((data & 0x02) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + + m_centronics->write_strobe(!BIT(data,6)); + m_centronics->write_select_in(!BIT(data,7)); + m_cp_prev = data; + break; + case 1: + // Printer data + m_cent_data_out->write(space, 0, data); + break; + } +} + +/* + * Main CPU: 0xfd0b + * - bit 0: Boot mode: 0=BASIC, 1=DOS + */ +READ8_MEMBER(fm7_state::fm77av_boot_mode_r) +{ + UINT8 ret = 0xff; + + if(m_dsw->read() & 0x02) + ret &= ~0x01; + + return ret; +} + +/* + * Main CPU: I/O ports 0xfd0d-0xfd0e + * PSG AY-3-891x (FM-7), YM2203 - (FM-77AV and later) + * 0xfd0d - function select (bit 1 = BDIR, bit 0 = BC1) + * 0xfd0e - data register + * AY I/O ports are not connected to anything. + */ +void fm7_state::fm7_update_psg() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + if(m_type == SYS_FM7) + { + switch(m_psg_regsel) + { + case 0x00: + // High impedance + break; + case 0x01: + // Data read + m_psg_data = m_psg->data_r(space, 0); + break; + case 0x02: + // Data write + m_psg->data_w(space, 0,m_psg_data); + break; + case 0x03: + // Address latch + m_psg->address_w(space, 0,m_psg_data); + break; + } + } + else + { // FM-77AV and later use a YM2203 + switch(m_psg_regsel) + { + case 0x00: + // High impedance + break; + case 0x01: + // Data read + m_psg_data = m_ym->read(space, 1); + break; + case 0x02: + // Data write + m_ym->write(space, 1,m_psg_data); + logerror("YM: data write 0x%02x\n",m_psg_data); + break; + case 0x03: + // Address latch + m_ym->write(space, 0,m_psg_data); + logerror("YM: address latch 0x%02x\n",m_psg_data); + break; + case 0x04: + // Status register + m_psg_data = m_ym->read(space, 0); + break; + case 0x09: + // Joystick port read + m_psg_data = m_joy1->read(); + break; + } + } +} + +READ8_MEMBER(fm7_state::fm7_psg_select_r) +{ + return 0xff; +} + +WRITE8_MEMBER(fm7_state::fm7_psg_select_w) +{ + m_psg_regsel = data & 0x03; + fm7_update_psg(); +} + +WRITE8_MEMBER(fm7_state::fm77av_ym_select_w) +{ + m_psg_regsel = data & 0x0f; + fm7_update_psg(); +} + +READ8_MEMBER(fm7_state::fm7_psg_data_r) +{ +// fm7_update_psg(); + return m_psg_data; +} + +WRITE8_MEMBER(fm7_state::fm7_psg_data_w) +{ + m_psg_data = data; +// fm7_update_psg(); +} + +WRITE8_MEMBER(fm7_state::fm77av_bootram_w) +{ + if(!(m_mmr.mode & 0x01)) + return; + m_boot_ram[offset] = data; +} + +// Shared RAM is only usable on the main CPU if the sub CPU is halted +READ8_MEMBER(fm7_state::fm7_main_shared_r) +{ + if(m_video.sub_halt != 0) + return m_shared_ram[offset]; + else + return 0xff; +} + +WRITE8_MEMBER(fm7_state::fm7_main_shared_w) +{ + if(m_video.sub_halt != 0) + m_shared_ram[offset] = data; +} + +READ8_MEMBER(fm7_state::fm7_fmirq_r) +{ + UINT8 ret = 0xff; + + if(m_fm77av_ym_irq != 0) + ret &= ~0x08; + + return ret; +} + +READ8_MEMBER(fm7_state::fm77av_joy_1_r) +{ + return m_joy1->read(); +} + +READ8_MEMBER(fm7_state::fm77av_joy_2_r) +{ + return m_joy2->read(); +} + +READ8_MEMBER(fm7_state::fm7_unknown_r) +{ + // Port 0xFDFC is read by Dig Dug. Controller port, perhaps? + // Must return 0xff for it to read the keyboard. + // Mappy uses ports FD15 and FD16. On the FM77AV, this is the YM2203, + // but on the FM-7, this is nothing, so we return 0xff for it to + // read the keyboard correctly. + return 0xff; +} + +/* + * Memory Management Register + * Main CPU: 0xfd80 - 0xfd93 (FM-77L4, FM-77AV and later only) + * + * fd80-fd8f (R/W): RAM bank select for current segment (A19-A12) + * fd90 (W/O): segment select register (3-bit, default = 0) + * fd92 (W/O): window offset register (OA15-OA8) + * fd93 (R/W): mode select register + * - bit 7: MMR enable/disable + * - bit 6: window enable/disable + * - bit 0: boot RAM read-write/read-only + * + */ +READ8_MEMBER(fm7_state::fm7_mmr_r) +{ + if(offset < 0x10) + { + return m_mmr.bank_addr[m_mmr.segment][offset]; + } + if(offset == 0x13) + return m_mmr.mode; + return 0xff; +} + +void fm7_state::fm7_update_bank(address_space & space, int bank, UINT8 physical) +{ + address_map_bank_device* avbank[16] = { m_avbank1, m_avbank2, m_avbank3, m_avbank4, m_avbank5, m_avbank6, m_avbank7 + , m_avbank8, m_avbank9, m_avbank10, m_avbank11, m_avbank12, m_avbank13, m_avbank14, m_avbank15, m_avbank16 }; + + avbank[bank]->set_bank(physical); +/* UINT8* RAM = memregion("maincpu")->base(); + UINT16 size = 0xfff; + char bank_name[10]; + + if(bank == 15) + size = 0xbff; + + sprintf(bank_name,"bank%d",bank+1); + + if(physical >= 0x10 && physical <= 0x1b) + { + switch(physical) + { + case 0x10: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram0_r),this),write8_delegate(FUNC(fm7_state::fm7_vram0_w),this)); + break; + case 0x11: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram1_r),this),write8_delegate(FUNC(fm7_state::fm7_vram1_w),this)); + break; + case 0x12: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram2_r),this),write8_delegate(FUNC(fm7_state::fm7_vram2_w),this)); + break; + case 0x13: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram3_r),this),write8_delegate(FUNC(fm7_state::fm7_vram3_w),this)); + break; + case 0x14: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram4_r),this),write8_delegate(FUNC(fm7_state::fm7_vram4_w),this)); + break; + case 0x15: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram5_r),this),write8_delegate(FUNC(fm7_state::fm7_vram5_w),this)); + break; + case 0x16: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram6_r),this),write8_delegate(FUNC(fm7_state::fm7_vram6_w),this)); + break; + case 0x17: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram7_r),this),write8_delegate(FUNC(fm7_state::fm7_vram7_w),this)); + break; + case 0x18: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram8_r),this),write8_delegate(FUNC(fm7_state::fm7_vram8_w),this)); + break; + case 0x19: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram9_r),this),write8_delegate(FUNC(fm7_state::fm7_vram9_w),this)); + break; + case 0x1a: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vramA_r),this),write8_delegate(FUNC(fm7_state::fm7_vramA_w),this)); + break; + case 0x1b: + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vramB_r),this),write8_delegate(FUNC(fm7_state::fm7_vramB_w),this)); + break; + } +// membank(bank+1)->set_base(RAM+(physical<<12)-0x10000); + return; + } + if(physical == 0x1c) + { + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_console_ram_banked_r),this),write8_delegate(FUNC(fm7_state::fm7_console_ram_banked_w),this)); + return; + } + if(physical == 0x1d) + { + space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_sub_ram_ports_banked_r),this),write8_delegate(FUNC(fm7_state::fm7_sub_ram_ports_banked_w),this)); + return; + } + if(physical == 0x35) + { + if(m_init_rom_en && (m_type == SYS_FM11 || m_type == SYS_FM16)) + { + RAM = memregion("init")->base(); + space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); + space.nop_write(bank*0x1000,(bank*0x1000)+size); + membank(bank_name)->set_base(RAM+(physical<<12)-0x35000); + return; + } + } + if(physical == 0x36 || physical == 0x37) + { + if(m_init_rom_en && (m_type != SYS_FM11 && m_type != SYS_FM16)) + { + RAM = memregion("init")->base(); + space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); + space.nop_write(bank*0x1000,(bank*0x1000)+size); + membank(bank_name)->set_base(RAM+(physical<<12)-0x36000); + return; + } + } + if(physical > 0x37 && physical <= 0x3f) + { + if(m_basic_rom_en && (m_type != SYS_FM11 && m_type != SYS_FM16)) + { + RAM = memregion("fbasic")->base(); + space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); + space.nop_write(bank*0x1000,(bank*0x1000)+size); + membank(bank_name)->set_base(RAM+(physical<<12)-0x38000); + return; + } + } + space.install_readwrite_bank(bank*0x1000,(bank*0x1000)+size,bank_name); + membank(bank_name)->set_base(RAM+(physical<<12)); + */ +} + +void fm7_state::fm7_mmr_refresh(address_space& space) +{ + int x; + UINT16 window_addr; + UINT8* RAM = memregion("maincpu")->base(); + + if(m_mmr.enabled) + { + for(x=0;x<16;x++) + fm7_update_bank(space,x,m_mmr.bank_addr[m_mmr.segment][x]); + } + else + { + // when MMR is disabled, 0x30000-0x3ffff is banked in + for(x=0;x<16;x++) + fm7_update_bank(space,x,0x30+x); + } + + if(m_mmr.mode & 0x40) + { + // Handle window offset - 0x7c00-0x7fff will show the area of extended + // memory (0x00000-0x0ffff) defined by the window address register + // 0x00 = 0x07c00, 0x04 = 0x08000 ... 0xff = 0x07400. + window_addr = ((m_mmr.window_offset << 8) + 0x7c00) & 0xffff; +// if(window_addr < 0xfc00) + { + space.install_readwrite_bank(0x7c00,0x7fff,"bank24"); + membank("bank24")->set_base(RAM+window_addr); + } + } + else + { + space.install_readwrite_handler(0x7000,0x7fff,read8_delegate(FUNC(address_map_bank_device::read8),(address_map_bank_device*)m_avbank8),write8_delegate(FUNC(address_map_bank_device::write8),(address_map_bank_device*)m_avbank8)); + } + if(m_init_rom_en) + { + UINT8* ROM = memregion("init")->base(); + membank("init_bank_r")->set_base(ROM); + } + else + { + membank("init_bank_r")->set_base(RAM+0x36000); + } + if(m_basic_rom_en) + { + UINT8* ROM = memregion("fbasic")->base(); + if(ROM != NULL) + membank("fbasic_bank_r")->set_base(ROM); + } + else + { + membank("fbasic_bank_r")->set_base(RAM+0x38000); + } +} + +WRITE8_MEMBER(fm7_state::fm7_mmr_w) +{ + if(offset < 0x10) + { + m_mmr.bank_addr[m_mmr.segment][offset] = data; + if(m_mmr.enabled) + fm7_update_bank(space,offset,data); + logerror("MMR: Segment %i, bank %i, set to 0x%02x\n",m_mmr.segment,offset,data); + return; + } + switch(offset) + { + case 0x10: + m_mmr.segment = data & 0x07; + fm7_mmr_refresh(space); + logerror("MMR: Active segment set to %i\n",m_mmr.segment); + break; + case 0x12: + m_mmr.window_offset = data; + fm7_mmr_refresh(space); + logerror("MMR: Window offset set to %02x\n",data); + break; + case 0x13: + m_mmr.mode = data; + m_mmr.enabled = data & 0x80; + fm7_mmr_refresh(space); + logerror("MMR: Mode register set to %02x\n",data); + break; + } +} + +/* + * Main CPU: ports 0xfd20-0xfd23 + * Kanji ROM read ports + * FD20 (W/O): ROM address high + * FD21 (W/O): ROM address low + * FD22 (R/O): Kanji data high + * FD23 (R/O): Kanji data low + * + * Kanji ROM is visible at 0x20000 (first half only?) + */ +READ8_MEMBER(fm7_state::fm7_kanji_r) +{ + UINT8* KROM = m_kanji->base(); + UINT32 addr = m_kanji_address << 1; + + switch(offset) + { + case 0: + case 1: + logerror("KANJI: read from invalid register %i\n",offset); + return 0xff; // write-only + case 2: + return KROM[addr]; + case 3: + return KROM[addr+1]; + default: + logerror("KANJI: read from invalid register %i\n",offset); + return 0xff; + } +} + +WRITE8_MEMBER(fm7_state::fm7_kanji_w) +{ + UINT16 addr; + + switch(offset) + { + case 0: + addr = ((data & 0xff) << 8) | (m_kanji_address & 0x00ff); + m_kanji_address = addr; + break; + case 1: + addr = (data & 0xff) | (m_kanji_address & 0xff00); + m_kanji_address = addr; + break; + case 2: + case 3: + default: + logerror("KANJI: write to invalid register %i\n",offset); + } +} + +TIMER_CALLBACK_MEMBER(fm7_state::fm7_timer_irq) +{ + if(m_irq_mask & IRQ_FLAG_TIMER) + { + main_irq_set_flag(IRQ_FLAG_TIMER); + } +} + +TIMER_CALLBACK_MEMBER(fm7_state::fm7_subtimer_irq) +{ + if(m_video.nmi_mask == 0 && m_video.sub_halt == 0) + m_sub->set_input_line(INPUT_LINE_NMI,PULSE_LINE); +} + +// When a key is pressed or released (in scan mode only), an IRQ is generated on the main CPU, +// or an FIRQ on the sub CPU, if masked. Both CPUs have ports to read keyboard data. +// Scancodes are 9 bits in FM-7 mode, 8 bits in scan mode. +void fm7_state::key_press(UINT16 scancode) +{ + m_current_scancode = scancode; + + if(scancode == 0) + return; + + if(m_irq_mask & IRQ_FLAG_KEY) + { + main_irq_set_flag(IRQ_FLAG_KEY); + } + else + { + m_sub->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); + } + logerror("KEY: sent scancode 0x%03x\n",scancode); +} + +void fm7_state::fm7_keyboard_poll_scan() +{ + ioport_port* portnames[3] = { m_key1, m_key2, m_key3 }; + int bit = 0; + int x,y; + UINT32 keys; + UINT32 modifiers = m_keymod->read(); + static const UINT16 modscancodes[6] = { 0x52, 0x53, 0x54, 0x55, 0x56, 0x5a }; + + for(x=0;x<3;x++) + { + keys = portnames[x]->read(); + + for(y=0;y<32;y++) // loop through each bit in the port + { + if((keys & (1<read(); + + if(m_key3->read() & 0x40000) + { + m_break_flag = 1; + m_maincpu->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); + } + else + m_break_flag = 0; + + if(m_key_scan_mode == KEY_MODE_SCAN) + { + // handle scancode mode + fm7_keyboard_poll_scan(); + return; + } + + // check key modifiers (Shift, Ctrl, Kana, etc...) + if(modifiers & 0x02 || modifiers & 0x04) + mod = 1; // shift + if(modifiers & 0x10) + mod = 3; // Graph (shift has no effect with graph) + if(modifiers & 0x01) + mod = 2; // ctrl (overrides shift, if also pressed) + if(modifiers & 0x20) + mod = 4; // kana (overrides all) + if((modifiers & 0x22) == 0x22 || (modifiers & 0x24) == 0x24) + mod = 5; // shifted kana + + for(x=0;x<3;x++) + { + keys = portnames[x]->read(); + + for(y=0;y<32;y++) // loop through each bit in the port + { + if((keys & (1<set_input_line(irqline,CLEAR_LINE); + return -1; +} + +IRQ_CALLBACK_MEMBER(fm7_state::fm7_sub_irq_ack) +{ + m_sub->set_input_line(irqline,CLEAR_LINE); + return -1; +} + +WRITE_LINE_MEMBER(fm7_state::fm77av_fmirq) +{ + if(state == 1) + { + // cannot be masked + main_irq_set_flag(IRQ_FLAG_OTHER); + m_fm77av_ym_irq = 1; + logerror("YM: IRQ on\n"); + } + else + { + main_irq_clear_flag(IRQ_FLAG_OTHER); + m_fm77av_ym_irq = 0; + logerror("YM: IRQ off\n"); + } +} + +/* + 0000 - 7FFF: (RAM) BASIC working area, user's area + 8000 - FBFF: (ROM) F-BASIC ROM, extra user RAM + FC00 - FC7F: more RAM, if 64kB is installed + FC80 - FCFF: Shared RAM between main and sub CPU, available only when sub CPU is halted + FD00 - FDFF: I/O space (6809 uses memory-mapped I/O) + FE00 - FFEF: Boot rom + FFF0 - FFFF: Interrupt vector table +*/ +// The FM-7 has only 64kB RAM, so we'll worry about banking when we do the later models +static ADDRESS_MAP_START( fm7_mem, AS_PROGRAM, 8, fm7_state ) + AM_RANGE(0x0000,0x7fff) AM_RAM + AM_RANGE(0x8000,0xfbff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") // also F-BASIC ROM, when enabled + AM_RANGE(0xfc00,0xfc7f) AM_RAM + AM_RANGE(0xfc80,0xfcff) AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) + // I/O space (FD00-FDFF) + AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) + AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask + AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags + AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) + AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) + AM_RANGE(0xfd06,0xfd0c) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd0d,0xfd0d) AM_READWRITE(fm7_psg_select_r,fm7_psg_select_w) + AM_RANGE(0xfd0e,0xfd0e) AM_READWRITE(fm7_psg_data_r, fm7_psg_data_w) + AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) + AM_RANGE(0xfd10,0xfd17) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) + AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) + AM_RANGE(0xfd24,0xfd36) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) + AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) + AM_RANGE(0xfd40,0xfdff) AM_READ(fm7_unknown_r) + // Boot ROM + AM_RANGE(0xfe00,0xffdf) AM_ROMBANK("bank17") + AM_RANGE(0xffe0,0xffef) AM_RAM + AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm8_mem, AS_PROGRAM, 8, fm7_state ) + AM_RANGE(0x0000,0x7fff) AM_RAM + AM_RANGE(0x8000,0xfbff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") // also F-BASIC ROM, when enabled + AM_RANGE(0xfc00,0xfc7f) AM_RAM + AM_RANGE(0xfc80,0xfcff) AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) + // I/O space (FD00-FDFF) + AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) + AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask + AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags + AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) + AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) + AM_RANGE(0xfd06,0xfd0c) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) + AM_RANGE(0xfd10,0xfd17) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) + AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) + AM_RANGE(0xfd24,0xfd36) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) + AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) + AM_RANGE(0xfd40,0xfdff) AM_READ(fm7_unknown_r) + // Boot ROM + AM_RANGE(0xfe00,0xffdf) AM_ROMBANK("bank17") + AM_RANGE(0xffe0,0xffef) AM_RAM + AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) +ADDRESS_MAP_END + +/* + 0000 - 3FFF: Video RAM bank 0 (Blue plane) + 4000 - 7FFF: Video RAM bank 1 (Red plane) + 8000 - BFFF: Video RAM bank 2 (Green plane) + D000 - D37F: (RAM) working area + D380 - D3FF: Shared RAM between main and sub CPU + D400 - D4FF: I/O ports + D800 - FFDF: (ROM) Graphics command code + FFF0 - FFFF: Interrupt vector table +*/ + +static ADDRESS_MAP_START( fm7_sub_mem, AS_PROGRAM, 8, fm7_state ) + AM_RANGE(0x0000,0xbfff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM + AM_RANGE(0xc000,0xcfff) AM_RAM // Console RAM + AM_RANGE(0xd000,0xd37f) AM_RAM // Work RAM + AM_RANGE(0xd380,0xd3ff) AM_RAM AM_SHARE("shared_ram") + // I/O space (D400-D4FF) + AM_RANGE(0xd400,0xd401) AM_READ(fm7_sub_keyboard_r) + AM_RANGE(0xd402,0xd402) AM_READ(fm7_cancel_ack) + AM_RANGE(0xd403,0xd403) AM_READ(fm7_sub_beeper_r) + AM_RANGE(0xd404,0xd404) AM_READ(fm7_attn_irq_r) + AM_RANGE(0xd408,0xd408) AM_READWRITE(fm7_crt_r,fm7_crt_w) + AM_RANGE(0xd409,0xd409) AM_READWRITE(fm7_vram_access_r,fm7_vram_access_w) + AM_RANGE(0xd40a,0xd40a) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) + AM_RANGE(0xd40e,0xd40f) AM_WRITE(fm7_vram_offset_w) + AM_RANGE(0xd800,0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm11_mem, AS_PROGRAM, 8, fm7_state ) + AM_RANGE(0x0000,0x0fff) AM_DEVREADWRITE("av_bank1", address_map_bank_device, read8, write8) + AM_RANGE(0x1000,0x1fff) AM_DEVREADWRITE("av_bank2", address_map_bank_device, read8, write8) + AM_RANGE(0x2000,0x2fff) AM_DEVREADWRITE("av_bank3", address_map_bank_device, read8, write8) + AM_RANGE(0x3000,0x3fff) AM_DEVREADWRITE("av_bank4", address_map_bank_device, read8, write8) + AM_RANGE(0x4000,0x4fff) AM_DEVREADWRITE("av_bank5", address_map_bank_device, read8, write8) + AM_RANGE(0x5000,0x5fff) AM_DEVREADWRITE("av_bank6", address_map_bank_device, read8, write8) + AM_RANGE(0x6000,0x6fff) AM_DEVREADWRITE("av_bank7", address_map_bank_device, read8, write8) + AM_RANGE(0x7000,0x7fff) AM_DEVREADWRITE("av_bank8", address_map_bank_device, read8, write8) + AM_RANGE(0x8000,0x8fff) AM_DEVREADWRITE("av_bank9", address_map_bank_device, read8, write8) + AM_RANGE(0x9000,0x9fff) AM_DEVREADWRITE("av_bank10", address_map_bank_device, read8, write8) + AM_RANGE(0xa000,0xafff) AM_DEVREADWRITE("av_bank11", address_map_bank_device, read8, write8) + AM_RANGE(0xb000,0xbfff) AM_DEVREADWRITE("av_bank12", address_map_bank_device, read8, write8) + AM_RANGE(0xc000,0xcfff) AM_DEVREADWRITE("av_bank13", address_map_bank_device, read8, write8) + AM_RANGE(0xd000,0xdfff) AM_DEVREADWRITE("av_bank14", address_map_bank_device, read8, write8) + AM_RANGE(0xe000,0xefff) AM_DEVREADWRITE("av_bank15", address_map_bank_device, read8, write8) + AM_RANGE(0xf000,0xfbff) AM_DEVREADWRITE("av_bank16", address_map_bank_device, read8, write8) + AM_RANGE(0xfc00,0xfc7f) AM_RAM + AM_RANGE(0xfc80,0xfcff) AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) + // I/O space (FD00-FDFF) + AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) + AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask + AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags + AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) + AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) + AM_RANGE(0xfd06,0xfd0a) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd0b,0xfd0b) AM_READ(fm77av_boot_mode_r) + AM_RANGE(0xfd0c,0xfd0c) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) + AM_RANGE(0xfd10,0xfd10) AM_WRITE(fm7_init_en_w) + AM_RANGE(0xfd11,0xfd11) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd12,0xfd12) AM_READWRITE(fm77av_sub_modestatus_r,fm77av_sub_modestatus_w) + AM_RANGE(0xfd13,0xfd13) AM_WRITE(fm77av_sub_bank_w) + AM_RANGE(0xfd14,0xfd14) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd17,0xfd17) AM_READ(fm7_fmirq_r) + AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) + AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) + AM_RANGE(0xfd24,0xfd2b) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd30,0xfd34) AM_WRITE(fm77av_analog_palette_w) + AM_RANGE(0xfd35,0xfd36) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) + AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) + AM_RANGE(0xfd40,0xfd7f) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd80,0xfd93) AM_READWRITE(fm7_mmr_r,fm7_mmr_w) + AM_RANGE(0xfd94,0xfdff) AM_READ(fm7_unknown_r) + AM_RANGE(0xfe00,0xffdf) AM_RAM_WRITE(fm77av_bootram_w) AM_SHARE("boot_ram") + AM_RANGE(0xffe0,0xffef) AM_RAM + AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) +ADDRESS_MAP_END + +// Much of this is guesswork at the moment +static ADDRESS_MAP_START( fm11_sub_mem, AS_PROGRAM, 8, fm7_state ) + AM_RANGE(0x0000,0x7fff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM + AM_RANGE(0x8000,0x8fff) AM_RAM // Console RAM(?) + AM_RANGE(0x9000,0x9f7f) AM_RAM // Work RAM(?) + AM_RANGE(0x9f80,0x9fff) AM_RAM AM_SHARE("shared_ram") + AM_RANGE(0xafe0,0xafe3) AM_RAM +// AM_RANGE(0xafe4,0xafe4) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) + AM_RANGE(0xafe6,0xafe6) AM_READWRITE(fm77av_video_flags_r,fm77av_video_flags_w) + AM_RANGE(0xaff0,0xaff0) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) + AM_RANGE(0xc000,0xffff) AM_ROM // sybsystem ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm11_x86_mem, AS_PROGRAM, 8, fm7_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0xfefff) AM_RAM + AM_RANGE(0xff000,0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm11_x86_io, AS_IO, 8, fm7_state ) + AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) + AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask + AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags + AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) + AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) + AM_RANGE(0xfd06,0xfd0c) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) + AM_RANGE(0xfd10,0xfd17) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) + AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) + AM_RANGE(0xfd24,0xfd36) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) + AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) + AM_RANGE(0xfd40,0xfdff) AM_READ(fm7_unknown_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm16_mem, AS_PROGRAM, 16, fm7_state ) + AM_RANGE(0x00000,0xfbfff) AM_RAM + AM_RANGE(0xfc000,0xfffff) AM_ROM // IPL +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm16_io, AS_IO, 16, fm7_state ) + AM_RANGE(0xfd00,0xfd01) AM_READWRITE8(fm7_keyboard_r,fm7_cassette_printer_w,0xffff) + AM_RANGE(0xfd02,0xfd03) AM_READWRITE8(fm7_cassette_printer_r,fm7_irq_mask_w,0x00ff) // IRQ mask + AM_RANGE(0xfd02,0xfd03) AM_READWRITE8(fm7_irq_cause_r,fm7_beeper_w,0xff00) // IRQ flags + AM_RANGE(0xfd04,0xfd05) AM_READ8(fm7_fd04_r,0x00ff) + AM_RANGE(0xfd04,0xfd05) AM_READWRITE8(fm7_subintf_r,fm7_subintf_w,0xff00) +// AM_RANGE(0xfd06,0xfd0c) AM_READ8(fm7_unknown_r,0xffff) + AM_RANGE(0xfd0e,0xfd0f) AM_READWRITE8(fm7_rom_en_r,fm7_rom_en_w,0xff00) +// AM_RANGE(0xfd10,0xfd17) AM_READ8(fm7_unknown_r,0xffff) + AM_RANGE(0xfd18,0xfd1f) AM_READWRITE8(fm7_fdc_r,fm7_fdc_w,0xffff) + AM_RANGE(0xfd20,0xfd23) AM_READWRITE8(fm7_kanji_r,fm7_kanji_w,0xffff) +// AM_RANGE(0xfd24,0xfd36) AM_READ8(fm7_unknown_r,0xffff) + AM_RANGE(0xfd36,0xfd37) AM_WRITE8(fm7_multipage_w,0xff00) + AM_RANGE(0xfd38,0xfd3f) AM_READWRITE8(fm7_palette_r,fm7_palette_w,0xffff) +// AM_RANGE(0xfd40,0xfdff) AM_READ8(fm7_unknown_r,0xffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm16_sub_mem, AS_PROGRAM, 8, fm7_state ) + AM_RANGE(0x0000,0xafff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM + AM_RANGE(0xb000,0xffff) AM_ROM // subsystem ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm77av_mem, AS_PROGRAM, 8, fm7_state ) + AM_RANGE(0x0000,0x0fff) AM_DEVREADWRITE("av_bank1", address_map_bank_device, read8, write8) + AM_RANGE(0x1000,0x1fff) AM_DEVREADWRITE("av_bank2", address_map_bank_device, read8, write8) + AM_RANGE(0x2000,0x2fff) AM_DEVREADWRITE("av_bank3", address_map_bank_device, read8, write8) + AM_RANGE(0x3000,0x3fff) AM_DEVREADWRITE("av_bank4", address_map_bank_device, read8, write8) + AM_RANGE(0x4000,0x4fff) AM_DEVREADWRITE("av_bank5", address_map_bank_device, read8, write8) + AM_RANGE(0x5000,0x5fff) AM_DEVREADWRITE("av_bank6", address_map_bank_device, read8, write8) + AM_RANGE(0x6000,0x6fff) AM_DEVREADWRITE("av_bank7", address_map_bank_device, read8, write8) + AM_RANGE(0x7000,0x7fff) AM_DEVREADWRITE("av_bank8", address_map_bank_device, read8, write8) + AM_RANGE(0x8000,0x8fff) AM_DEVREADWRITE("av_bank9", address_map_bank_device, read8, write8) + AM_RANGE(0x9000,0x9fff) AM_DEVREADWRITE("av_bank10", address_map_bank_device, read8, write8) + AM_RANGE(0xa000,0xafff) AM_DEVREADWRITE("av_bank11", address_map_bank_device, read8, write8) + AM_RANGE(0xb000,0xbfff) AM_DEVREADWRITE("av_bank12", address_map_bank_device, read8, write8) + AM_RANGE(0xc000,0xcfff) AM_DEVREADWRITE("av_bank13", address_map_bank_device, read8, write8) + AM_RANGE(0xd000,0xdfff) AM_DEVREADWRITE("av_bank14", address_map_bank_device, read8, write8) + AM_RANGE(0xe000,0xefff) AM_DEVREADWRITE("av_bank15", address_map_bank_device, read8, write8) + AM_RANGE(0xf000,0xfbff) AM_DEVREADWRITE("av_bank16", address_map_bank_device, read8, write8) + AM_RANGE(0xfc00,0xfc7f) AM_RAM + AM_RANGE(0xfc80,0xfcff) AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) + // I/O space (FD00-FDFF) + AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) + AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask + AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags + AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) + AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) + AM_RANGE(0xfd06,0xfd0a) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd0b,0xfd0b) AM_READ(fm77av_boot_mode_r) + AM_RANGE(0xfd0c,0xfd0c) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd0d,0xfd0d) AM_READWRITE(fm7_psg_select_r,fm7_psg_select_w) + AM_RANGE(0xfd0e,0xfd0e) AM_READWRITE(fm7_psg_data_r, fm7_psg_data_w) + AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) + AM_RANGE(0xfd10,0xfd10) AM_WRITE(fm7_init_en_w) + AM_RANGE(0xfd11,0xfd11) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd12,0xfd12) AM_READWRITE(fm77av_sub_modestatus_r,fm77av_sub_modestatus_w) + AM_RANGE(0xfd13,0xfd13) AM_WRITE(fm77av_sub_bank_w) + AM_RANGE(0xfd14,0xfd14) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd15,0xfd15) AM_READWRITE(fm7_psg_select_r,fm77av_ym_select_w) + AM_RANGE(0xfd16,0xfd16) AM_READWRITE(fm7_psg_data_r,fm7_psg_data_w) + AM_RANGE(0xfd17,0xfd17) AM_READ(fm7_fmirq_r) + AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) + AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) + AM_RANGE(0xfd24,0xfd2b) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd30,0xfd34) AM_WRITE(fm77av_analog_palette_w) + AM_RANGE(0xfd35,0xfd36) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) + AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) + AM_RANGE(0xfd40,0xfd7f) AM_READ(fm7_unknown_r) + AM_RANGE(0xfd80,0xfd93) AM_READWRITE(fm7_mmr_r,fm7_mmr_w) + AM_RANGE(0xfd94,0xfdff) AM_READ(fm7_unknown_r) + // Boot ROM (RAM on FM77AV and later) + AM_RANGE(0xfe00,0xffdf) AM_RAM_WRITE(fm77av_bootram_w) AM_SHARE("boot_ram") + AM_RANGE(0xffe0,0xffef) AM_RAM + AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm77av_sub_mem, AS_PROGRAM, 8, fm7_state ) + AM_RANGE(0x0000,0xbfff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM + AM_RANGE(0xc000,0xcfff) AM_RAM AM_REGION("maincpu",0x1c000) // Console RAM + AM_RANGE(0xd000,0xd37f) AM_RAM AM_REGION("maincpu",0x1d000) // Work RAM + AM_RANGE(0xd380,0xd3ff) AM_RAM AM_SHARE("shared_ram") + // I/O space (D400-D4FF) + AM_RANGE(0xd400,0xd401) AM_READ(fm7_sub_keyboard_r) + AM_RANGE(0xd402,0xd402) AM_READ(fm7_cancel_ack) + AM_RANGE(0xd403,0xd403) AM_READ(fm7_sub_beeper_r) + AM_RANGE(0xd404,0xd404) AM_READ(fm7_attn_irq_r) + AM_RANGE(0xd408,0xd408) AM_READWRITE(fm7_crt_r,fm7_crt_w) + AM_RANGE(0xd409,0xd409) AM_READWRITE(fm7_vram_access_r,fm7_vram_access_w) + AM_RANGE(0xd40a,0xd40a) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) + AM_RANGE(0xd40e,0xd40f) AM_WRITE(fm7_vram_offset_w) + AM_RANGE(0xd410,0xd42b) AM_READWRITE(fm77av_alu_r, fm77av_alu_w) + AM_RANGE(0xd430,0xd430) AM_READWRITE(fm77av_video_flags_r,fm77av_video_flags_w) + AM_RANGE(0xd431,0xd432) AM_READWRITE(fm77av_key_encoder_r,fm77av_key_encoder_w) + AM_RANGE(0xd500,0xd7ff) AM_RAM AM_REGION("maincpu",0x1d500) // Work RAM + AM_RANGE(0xd800,0xdfff) AM_ROMBANK("bank20") + AM_RANGE(0xe000,0xffff) AM_ROMBANK("bank21") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fm7_banked_mem, AS_PROGRAM, 8, fm7_state) + // Extended RAM + AM_RANGE(0x00000,0x0ffff) AM_RAM AM_REGION("maincpu",0x00000) + + // Sub CPU space + AM_RANGE(0x10000,0x1bfff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM + AM_RANGE(0x1c000,0x1cfff) AM_RAM AM_REGION("maincpu",0x1c000) // Console RAM + AM_RANGE(0x1d000,0x1d37f) AM_RAM AM_REGION("maincpu",0x1d000) // Work RAM + AM_RANGE(0x1d380,0x1d3ff) AM_RAM AM_SHARE("shared_ram") + // I/O space (D400-D4FF) + AM_RANGE(0x1d400,0x1d401) AM_READ(fm7_sub_keyboard_r) + AM_RANGE(0x1d402,0x1d402) AM_READ(fm7_cancel_ack) + AM_RANGE(0x1d403,0x1d403) AM_READ(fm7_sub_beeper_r) + AM_RANGE(0x1d404,0x1d404) AM_READ(fm7_attn_irq_r) + AM_RANGE(0x1d408,0x1d408) AM_READWRITE(fm7_crt_r,fm7_crt_w) + AM_RANGE(0x1d409,0x1d409) AM_READWRITE(fm7_vram_access_r,fm7_vram_access_w) + AM_RANGE(0x1d40a,0x1d40a) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) + AM_RANGE(0x1d40e,0x1d40f) AM_WRITE(fm7_vram_offset_w) + AM_RANGE(0x1d410,0x1d42b) AM_READWRITE(fm77av_alu_r, fm77av_alu_w) + AM_RANGE(0x1d430,0x1d430) AM_READWRITE(fm77av_video_flags_r,fm77av_video_flags_w) + AM_RANGE(0x1d431,0x1d432) AM_READWRITE(fm77av_key_encoder_r,fm77av_key_encoder_w) + AM_RANGE(0x1d500,0x1d7ff) AM_RAM AM_REGION("maincpu",0x1d500) // Work RAM + AM_RANGE(0x1d800,0x1dfff) AM_ROMBANK("bank20") + AM_RANGE(0x1e000,0x1ffff) AM_ROMBANK("bank21") + + // more RAM? + AM_RANGE(0x20000,0x2ffff) AM_RAM AM_REGION("maincpu",0x20000) + + // Main CPU space + AM_RANGE(0x30000,0x35fff) AM_RAM AM_REGION("maincpu",0x30000) + AM_RANGE(0x36000,0x37fff) AM_READ_BANK("init_bank_r") AM_WRITE_BANK("init_bank_w") + AM_RANGE(0x38000,0x3fbff) AM_READ_BANK("fbasic_bank_r") AM_WRITE_BANK("fbasic_bank_w") + AM_RANGE(0x3fc00,0x3ffff) AM_RAM AM_REGION("maincpu",0x3fc00) + +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( fm7_keyboard ) + PORT_START("key1") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + + PORT_START("key2") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CHAR('_') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) + + PORT_START("key3") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey ,") + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("EL") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DUP") PORT_CODE(KEYCODE_END) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) + + PORT_START("key_modifiers") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAP") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE + + PORT_START("joy1") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_JOYSTICK_UP) PORT_NAME("1P Joystick Up") PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_JOYSTICK_DOWN) PORT_NAME("1P Joystick Down") PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_JOYSTICK_LEFT) PORT_NAME("1P Joystick Left") PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_JOYSTICK_RIGHT) PORT_NAME("1P Joystick Right") PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_BUTTON2) PORT_NAME("1P Joystick Button 2") PORT_PLAYER(1) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_BUTTON1) PORT_NAME("1P Joystick Button 1") PORT_PLAYER(1) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("joy2") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_JOYSTICK_UP) PORT_NAME("2P Joystick Up") PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_JOYSTICK_DOWN) PORT_NAME("2P Joystick Down") PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_JOYSTICK_LEFT) PORT_NAME("2P Joystick Left") PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_JOYSTICK_RIGHT) PORT_NAME("2P Joystick Right") PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_BUTTON2) PORT_NAME("2P Joystick Button 2") PORT_PLAYER(2) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_BUTTON1) PORT_NAME("2P Joystick Button 1") PORT_PLAYER(2) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( fm7 ) + PORT_INCLUDE( fm7_keyboard ) + + PORT_START("DSW") + PORT_DIPNAME(0x01,0x01,"Switch A") PORT_DIPLOCATION("SWA:1") + PORT_DIPSETTING(0x00,DEF_STR( Off )) + PORT_DIPSETTING(0x01,DEF_STR( On )) + PORT_DIPNAME(0x02,0x02,"Boot mode") PORT_DIPLOCATION("SWA:2") + PORT_DIPSETTING(0x00,"DOS") + PORT_DIPSETTING(0x02,"BASIC") + PORT_DIPNAME(0x04,0x00,"Switch C") PORT_DIPLOCATION("SWA:3") + PORT_DIPSETTING(0x00,DEF_STR( Off )) + PORT_DIPSETTING(0x04,DEF_STR( On )) + PORT_DIPNAME(0x08,0x00,"FM-8 Compatibility mode") PORT_DIPLOCATION("SWA:4") + PORT_DIPSETTING(0x00,DEF_STR( Off )) + PORT_DIPSETTING(0x08,DEF_STR( On )) +INPUT_PORTS_END + +static INPUT_PORTS_START( fm8 ) + PORT_INCLUDE( fm7_keyboard ) + + PORT_START("DSW") + PORT_DIPNAME(0x02,0x02,"Boot mode") PORT_DIPLOCATION("SWA:2") + PORT_DIPSETTING(0x00,"DOS") + PORT_DIPSETTING(0x02,"BASIC") +INPUT_PORTS_END + +DRIVER_INIT_MEMBER(fm7_state,fm7) +{ +// m_shared_ram = auto_alloc_array(machine(),UINT8,0x80); + m_video_ram = auto_alloc_array(machine(),UINT8,0x18000); // 2 pages on some systems + m_timer = timer_alloc(TIMER_FM7_IRQ); + m_subtimer = timer_alloc(TIMER_FM7_SUBTIMER_IRQ); + m_keyboard_timer = timer_alloc(TIMER_FM7_KEYBOARD_POLL); + m_fm77av_vsync_timer = timer_alloc(TIMER_FM77AV_VSYNC); +} + +MACHINE_START_MEMBER(fm7_state,fm7) +{ + // The FM-7 has no initialisation ROM, and no other obvious + // way to set the reset vector, so for now this will have to do. + UINT8* RAM = memregion("maincpu")->base(); + + RAM[0xfffe] = 0xfe; + RAM[0xffff] = 0x00; + + memset(m_shared_ram,0xff,0x80); + m_type = SYS_FM7; + + m_beeper->set_frequency(1200); + m_beeper->set_state(0); +} + +MACHINE_START_MEMBER(fm7_state,fm77av) +{ + UINT8* RAM = memregion("maincpu")->base(); + UINT8* ROM = memregion("init")->base(); + + memset(m_shared_ram,0xff,0x80); + + // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) + memcpy(RAM+0x3fff0,ROM+0x1ff0,16); + + m_video.subrom = 0; // default sub CPU ROM is type C. + RAM = memregion("subsyscg")->base(); + membank("bank20")->set_base(RAM); + RAM = memregion("subsys_c")->base(); + membank("bank21")->set_base(RAM+0x800); + + m_type = SYS_FM77AV; + m_beeper->set_frequency(1200); + m_beeper->set_state(0); +} + +MACHINE_START_MEMBER(fm7_state,fm11) +{ + UINT8* RAM = memregion("maincpu")->base(); + UINT8* ROM = memregion("init")->base(); + + memset(m_shared_ram,0xff,0x80); + m_type = SYS_FM11; + m_beeper->set_frequency(1200); + m_beeper->set_state(0); + // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) + memcpy(RAM+0x3fff0,ROM+0x0ff0,16); +} + +MACHINE_START_MEMBER(fm7_state,fm16) +{ + m_type = SYS_FM16; + m_beeper->set_frequency(1200); + m_beeper->set_state(0); +} + +void fm7_state::machine_reset() +{ + UINT8* RAM = memregion("maincpu")->base(); + UINT8* ROM = memregion("init")->base(); + + m_timer->adjust(attotime::from_nsec(2034500),0,attotime::from_nsec(2034500)); + m_subtimer->adjust(attotime::from_msec(20),0,attotime::from_msec(20)); + m_keyboard_timer->adjust(attotime::zero,0,attotime::from_msec(10)); + if(m_type == SYS_FM77AV || m_type == SYS_FM77AV40EX || m_type == SYS_FM11) + m_fm77av_vsync_timer->adjust(machine().first_screen()->time_until_vblank_end()); + + m_irq_mask = 0x00; + m_irq_flags = 0x00; + m_video.attn_irq = 0; + m_video.sub_busy = 0x80; // busy at reset + m_basic_rom_en = 1; // enabled at reset, if in BASIC mode + if(m_type == SYS_FM11 || m_type == SYS_FM16) + m_basic_rom_en = 0; // all FM11/16 systems have no BASIC ROM except for the FM-11 ST + if(m_type == SYS_FM77AV || m_type == SYS_FM77AV40EX) + { + m_init_rom_en = 1; + // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) + memcpy(RAM+0x3fff0,ROM+0x1ff0,16); + } + else if (m_type == SYS_FM11) + { + m_init_rom_en = 1; + // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) + memcpy(RAM+0x3fff0,ROM+0x0ff0,16); + } + else + m_init_rom_en = 0; + if(m_type == SYS_FM7) + { + if(!(m_dsw->read() & 0x02)) + { + m_basic_rom_en = 0; // disabled for DOS mode + membank("bank1")->set_base(RAM+0x08000); + } + else + membank("bank1")->set_base(RAM+0x38000); + membank("bank2")->set_base(RAM+0x08000); + } + m_key_delay = 700; // 700ms on FM-7 + m_key_repeat = 70; // 70ms on FM-7 + m_break_flag = 0; + m_key_scan_mode = KEY_MODE_FM7; + m_psg_regsel = 0; + m_psg_data = 0; + m_fdc_side = 0; + m_fdc_drive = 0; + m_mmr.mode = 0; + m_mmr.segment = 0; + m_mmr.enabled = 0; + m_fm77av_ym_irq = 0; + m_encoder.latch = 1; + m_encoder.ack = 1; + // set boot mode (FM-7 only, AV and later has boot RAM instead) + if(m_type == SYS_FM7) + { + if(!(m_dsw->read() & 0x02)) + { // DOS mode + membank("bank17")->set_base(memregion("dos")->base()); + } + else + { // BASIC mode + membank("bank17")->set_base(memregion("basic")->base()); + } + } + if(m_type == SYS_FM77AV || m_type == SYS_FM77AV40EX || m_type == SYS_FM11) + { + fm7_mmr_refresh(m_maincpu->space(AS_PROGRAM)); + membank("fbasic_bank_w")->set_base(RAM+0x38000); + membank("init_bank_w")->set_base(RAM+0x36000); + } + if(m_type == SYS_FM11) + { + // Probably best to halt the 8088, I'm pretty sure it and the main 6809 should not be running at the same time + m_x86->set_input_line(INPUT_LINE_HALT,ASSERT_LINE); + } + + memset(m_video_ram, 0, sizeof(UINT8) * 0x18000); +} + + +static SLOT_INTERFACE_START( fm7_floppies ) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + + +#define MCFG_ADDRESS_BANK(tag) \ +MCFG_DEVICE_ADD(tag, ADDRESS_MAP_BANK, 0) \ +MCFG_DEVICE_PROGRAM_MAP(fm7_banked_mem) \ +MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) \ +MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) \ +MCFG_ADDRESS_MAP_BANK_STRIDE(0x1000) + + +static MACHINE_CONFIG_START( fm7, fm7_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(fm7_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_irq_ack) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_CPU_ADD("sub", M6809, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(fm7_sub_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) + MCFG_QUANTUM_PERFECT_CPU("sub") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("psg", AY8910, XTAL_4_9152MHz / 4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 1.00) + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.25) + + MCFG_MACHINE_START_OVERRIDE(fm7_state,fm7) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(fm7_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("fm7_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","fm7_cass") + + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list","fm7_disk") + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_SLOT_OPTION_ADD( "dsjoy", DEMPA_SHINBUNSHA_JOYSTICK ) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( fm8, fm7_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809, 1200000) // 1.2MHz 68A09 + MCFG_CPU_PROGRAM_MAP(fm8_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_irq_ack) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_CPU_ADD("sub", M6809, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(fm7_sub_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) + MCFG_QUANTUM_PERFECT_CPU("sub") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.25) + + MCFG_MACHINE_START_OVERRIDE(fm7_state,fm7) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(fm7_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("fm7_cass") + + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( fm77av, fm7_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809, XTAL_2MHz) // actually MB68B09E, but the 6809E core runs too slowly + MCFG_CPU_PROGRAM_MAP(fm77av_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_irq_ack) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_CPU_ADD("sub", M6809, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(fm77av_sub_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) + MCFG_QUANTUM_PERFECT_CPU("sub") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ym", YM2203, XTAL_4_9152MHz / 4) + MCFG_YM2203_IRQ_HANDLER(WRITELINE(fm7_state, fm77av_fmirq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(fm7_state, fm77av_joy_1_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(fm7_state, fm77av_joy_2_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",1.0) + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.25) + + MCFG_MACHINE_START_OVERRIDE(fm7_state,fm77av) + + MCFG_ADDRESS_BANK("av_bank1") + MCFG_ADDRESS_BANK("av_bank2") + MCFG_ADDRESS_BANK("av_bank3") + MCFG_ADDRESS_BANK("av_bank4") + MCFG_ADDRESS_BANK("av_bank5") + MCFG_ADDRESS_BANK("av_bank6") + MCFG_ADDRESS_BANK("av_bank7") + MCFG_ADDRESS_BANK("av_bank8") + MCFG_ADDRESS_BANK("av_bank9") + MCFG_ADDRESS_BANK("av_bank10") + MCFG_ADDRESS_BANK("av_bank11") + MCFG_ADDRESS_BANK("av_bank12") + MCFG_ADDRESS_BANK("av_bank13") + MCFG_ADDRESS_BANK("av_bank14") + MCFG_ADDRESS_BANK("av_bank15") + MCFG_ADDRESS_BANK("av_bank16") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + MCFG_PALETTE_ADD("av_palette", 4096) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(fm7_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("fm7_cass") + + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_list", "fm7_cass") + + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("av_flop_list", "fm77av") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop_list", "fm7_disk") + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( fm11, fm7_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809, XTAL_2MHz) // 2MHz 68B09E + MCFG_CPU_PROGRAM_MAP(fm11_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_irq_ack) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_CPU_ADD("sub", M6809, XTAL_2MHz) // 2MHz 68B09 + MCFG_CPU_PROGRAM_MAP(fm11_sub_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) + MCFG_QUANTUM_PERFECT_CPU("sub") + + MCFG_CPU_ADD("x86", I8088, XTAL_8MHz) // 8MHz i8088 + MCFG_CPU_PROGRAM_MAP(fm11_x86_mem) + MCFG_CPU_IO_MAP(fm11_x86_io) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.25) + + MCFG_MACHINE_START_OVERRIDE(fm7_state,fm11) + + MCFG_ADDRESS_BANK("av_bank1") + MCFG_ADDRESS_BANK("av_bank2") + MCFG_ADDRESS_BANK("av_bank3") + MCFG_ADDRESS_BANK("av_bank4") + MCFG_ADDRESS_BANK("av_bank5") + MCFG_ADDRESS_BANK("av_bank6") + MCFG_ADDRESS_BANK("av_bank7") + MCFG_ADDRESS_BANK("av_bank8") + MCFG_ADDRESS_BANK("av_bank9") + MCFG_ADDRESS_BANK("av_bank10") + MCFG_ADDRESS_BANK("av_bank11") + MCFG_ADDRESS_BANK("av_bank12") + MCFG_ADDRESS_BANK("av_bank13") + MCFG_ADDRESS_BANK("av_bank14") + MCFG_ADDRESS_BANK("av_bank15") + MCFG_ADDRESS_BANK("av_bank16") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(fm7_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("fm7_cass") + + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( fm16beta, fm7_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_8MHz) // 8MHz i8086 + MCFG_CPU_PROGRAM_MAP(fm16_mem) + MCFG_CPU_IO_MAP(fm16_io) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_CPU_ADD("sub", M6809, XTAL_2MHz) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) + MCFG_CPU_PROGRAM_MAP(fm16_sub_mem) + MCFG_QUANTUM_PERFECT_CPU("sub") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.25) + + MCFG_MACHINE_START_OVERRIDE(fm7_state,fm16) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(fm7_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("fm7_cass") + + MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( fm8 ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_LOAD( "fbasic10.rom", 0x38000, 0x7c00, CRC(e80ed96c) SHA1(f3fa8a6adb07224ad2a1def77d5dae9662de0867) ) + + ROM_REGION( 0x20000, "sub", 0 ) + ROM_LOAD( "subsys_8.rom", 0xd800, 0x2800, CRC(979f9046) SHA1(9c52052087bf3a41b83d437a51d89b9fcfec2515) ) + + // either one of these boot ROMs are selectable via DIP switch + ROM_REGION( 0x200, "basic", 0 ) + ROM_LOAD( "bootbas8.rom", 0x0000, 0x0200, CRC(8260267a) SHA1(fee6fb9c52d22dd7108c68d08c74e2f3ebcb9e4d) ) + + ROM_REGION( 0x200, "dos", 0 ) + ROM_LOAD( "bootdos8.rom", 0x0000, 0x0200, CRC(1ed5a506) SHA1(966538fa92c32fc15034576dc480cfa4a339384d) ) + + // optional Kanji ROM (same as for the FM-7?) + ROM_REGION( 0x20000, "kanji1", 0 ) + ROM_LOAD_OPTIONAL( "kanji.rom", 0x0000, 0x20000, NO_DUMP ) + +ROM_END + + +ROM_START( fmnew7 ) + ROM_REGION( 0x40000, "maincpu", 0 ) // at 0x7ba5 there is the ID string 0302840301, meaning it's v3.02 from 1984/03/01 + ROM_LOAD( "fbasic302.rom", 0x38000, 0x7c00, CRC(a96d19b6) SHA1(8d5f0cfe7e0d39bf2ab7e4c798a13004769c28b2) ) + + ROM_REGION( 0x20000, "sub", 0 ) + ROM_LOAD( "subsys_c.rom", 0xd800, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) + + // either one of these boot ROMs are selectable via DIP switch + ROM_REGION( 0x200, "basic", 0 ) + ROM_LOAD( "boot_bas.rom", 0x0000, 0x0200, CRC(c70f0c74) SHA1(53b63a301cba7e3030e79c59a4d4291eab6e64b0) ) + + ROM_REGION( 0x200, "dos", 0 ) + ROM_LOAD( "boot_dos.rom", 0x0000, 0x0200, CRC(198614ff) SHA1(037e5881bd3fed472a210ee894a6446965a8d2ef) ) + + // optional Kanji ROM + ROM_REGION( 0x20000, "kanji1", 0 ) + ROM_LOAD_OPTIONAL( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) + +ROM_END + +ROM_START( fm7 ) + ROM_REGION( 0x40000, "maincpu", 0 ) // at 0x7ba5 there is the ID string 0300820920, meaning it's v3.00 from 1982/09/20 + ROM_LOAD( "fbasic300.rom", 0x38000, 0x7c00, CRC(87c98494) SHA1(d7e3603b0a2442c7632dad45f9704d9ad71968f5) ) + + ROM_REGION( 0x20000, "sub", 0 ) + ROM_LOAD( "subsys_c.rom", 0xd800, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) + + // either one of these boot ROMs are selectable via DIP switch + ROM_REGION( 0x200, "basic", 0 ) + ROM_LOAD( "boot_bas.rom", 0x0000, 0x0200, CRC(c70f0c74) SHA1(53b63a301cba7e3030e79c59a4d4291eab6e64b0) ) + + ROM_REGION( 0x200, "dos", 0 ) + ROM_LOAD( "boot_dos_a.rom", 0x0000, 0x0200, CRC(bf441864) SHA1(616c17155f84fb0e3731a31ef0eb0cbb664a5600) ) + + // optional Kanji ROM + ROM_REGION( 0x20000, "kanji1", 0 ) + ROM_LOAD_OPTIONAL( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) + +ROM_END + +ROM_START( fm77av ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_FILL(0x0000,0x40000,0xff) + + ROM_REGION( 0x2000, "init", 0 ) + ROM_LOAD( "initiate.rom", 0x0000, 0x2000, CRC(785cb06c) SHA1(b65987e98a9564a82c85eadb86f0204eee5a5c93) ) + + ROM_REGION( 0x7c00, "fbasic", 0 ) + ROM_LOAD( "fbasic30.rom", 0x0000, 0x7c00, CRC(a96d19b6) SHA1(8d5f0cfe7e0d39bf2ab7e4c798a13004769c28b2) ) + + ROM_REGION( 0x10000, "sub", 0 ) + ROM_FILL(0x0000,0x10000,0xff) + + // sub CPU ROMs + ROM_REGION( 0x2800, "subsys_c", 0 ) + ROM_LOAD( "subsys_c.rom", 0x0000, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) + ROM_REGION( 0x2000, "subsys_a", 0 ) + ROM_LOAD( "subsys_a.rom", 0x0000, 0x2000, CRC(e8014fbb) SHA1(038cb0b42aee9e933b20fccd6f19942e2f476c83) ) + ROM_REGION( 0x2000, "subsys_b", 0 ) + ROM_LOAD( "subsys_b.rom", 0x0000, 0x2000, CRC(9be69fac) SHA1(0305bdd44e7d9b7b6a17675aff0a3330a08d21a8) ) + ROM_REGION( 0x2000, "subsyscg", 0 ) + ROM_LOAD( "subsyscg.rom", 0x0000, 0x2000, CRC(e9f16c42) SHA1(8ab466b1546d023ba54987790a79e9815d2b7bb2) ) + + ROM_REGION( 0x20000, "kanji1", 0 ) + ROM_LOAD( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) + + // optional dict rom? +ROM_END + +ROM_START( fm7740sx ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_FILL(0x0000,0x40000,0xff) + + ROM_REGION( 0x2000, "init", 0 ) + ROM_LOAD( "initiate.rom", 0x0000, 0x2000, CRC(785cb06c) SHA1(b65987e98a9564a82c85eadb86f0204eee5a5c93) ) + + ROM_REGION( 0x7c00, "fbasic", 0 ) + ROM_LOAD( "fbasic30.rom", 0x0000, 0x7c00, CRC(a96d19b6) SHA1(8d5f0cfe7e0d39bf2ab7e4c798a13004769c28b2) ) + + ROM_REGION( 0x10000, "sub", 0 ) + ROM_FILL(0x0000,0x10000,0xff) + + // sub CPU ROMs + ROM_REGION( 0x2800, "subsys_c", 0 ) + ROM_LOAD( "subsys_c.rom", 0x0000, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) + ROM_REGION( 0x2000, "subsys_a", 0 ) + ROM_LOAD( "subsys_a.rom", 0x0000, 0x2000, CRC(e8014fbb) SHA1(038cb0b42aee9e933b20fccd6f19942e2f476c83) ) + ROM_REGION( 0x2000, "subsys_b", 0 ) + ROM_LOAD( "subsys_b.rom", 0x0000, 0x2000, CRC(9be69fac) SHA1(0305bdd44e7d9b7b6a17675aff0a3330a08d21a8) ) + ROM_REGION( 0x2000, "subsyscg", 0 ) + ROM_LOAD( "subsyscg.rom", 0x0000, 0x2000, CRC(e9f16c42) SHA1(8ab466b1546d023ba54987790a79e9815d2b7bb2) ) + + ROM_REGION( 0x20000, "kanji1", 0 ) + ROM_LOAD( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) + ROM_LOAD( "kanji2.rom", 0x0000, 0x20000, CRC(38644251) SHA1(ebfdc43c38e1380709ed08575c346b2467ad1592) ) + + /* These should be loaded at 2e000-2ffff of maincpu, but I'm not sure if it is correct */ + ROM_REGION( 0x4c000, "additional", 0 ) + ROM_LOAD( "dicrom.rom", 0x00000, 0x40000, CRC(b142acbc) SHA1(fe9f92a8a2750bcba0a1d2895e75e83858e4f97f) ) + ROM_LOAD( "extsub.rom", 0x40000, 0x0c000, CRC(0f7fcce3) SHA1(a1304457eeb400b4edd3c20af948d66a04df255e) ) + +ROM_END + +ROM_START( fm11 ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_FILL(0x0000,0x40000,0xff) + + ROM_REGION( 0x1000, "init", 0 ) + ROM_LOAD( "boot6809.rom", 0x0000, 0x1000, CRC(447caa6f) SHA1(4aa30314994c256d37ee01d11ec2bf4df3bc8cde) ) + + ROM_REGION( 0x10000, "sub", 0 ) + ROM_LOAD( "subsys.rom", 0xc000, 0x4000, CRC(436c0618) SHA1(cd508e3e8f79737afb4384ea4b278eddf0ce935d) ) + + ROM_REGION( 0x100000, "x86", 0 ) + ROM_LOAD( "boot8088.rom", 0xff000, 0x1000, CRC(d13096a6) SHA1(f9bd95b3b8184d0e04fba9b50f273dbb8823be77) ) + + ROM_REGION( 0x10000, "subsys_e", 0 ) + ROM_LOAD( "subsys_e.rom", 0x00000, 0x1000, CRC(31d838aa) SHA1(86a275c27bc99985bef7a51bdab2e47d68e31c6c) ) + + // optional Kanji ROM + ROM_REGION( 0x20000, "kanji1", 0 ) + ROM_LOAD_OPTIONAL( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) + +ROM_END + +ROM_START( fm16beta ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "ipl.rom", 0xfc000, 0x4000, CRC(25f618ea) SHA1(9c27d6ad283260e071d64a1bfca16f7d3ad61f96) ) + +// ROM_REGION( 0x10000, "subsys", 0 ) + + ROM_REGION( 0x10000, "sub", 0 ) + ROM_LOAD( "sub_cg.rom", 0xa000, 0x0f80, CRC(e7928bed) SHA1(68cf604aa7a5c2ec7bd0d612cf099302c7f8c442) ) + ROM_CONTINUE(0xff80,0x0080) + ROM_LOAD( "subsys.rom", 0xb000, 0x4f80, CRC(1d878514) SHA1(4673879a81e39880655b380250c6b81137028727) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, fm8, 0, 0, fm8, fm8, fm7_state, fm7, "Fujitsu", "FM-8", 0) +COMP( 1982, fm7, 0, 0, fm7, fm7, fm7_state, fm7, "Fujitsu", "FM-7", 0) +COMP( 1984, fmnew7, fm7, 0, fm7, fm7, fm7_state, fm7, "Fujitsu", "FM-NEW7", 0) +COMP( 1985, fm77av, fm7, 0, fm77av, fm7, fm7_state, fm7, "Fujitsu", "FM-77AV", MACHINE_IMPERFECT_GRAPHICS) +COMP( 1985, fm7740sx, fm7, 0, fm77av, fm7, fm7_state, fm7, "Fujitsu", "FM-77AV40SX", MACHINE_NOT_WORKING) + +// These may be separated into a separate driver, depending on how different they are to the FM-8/FM-7 +COMP( 1982, fm11, 0, 0, fm11, fm7, fm7_state, fm7, "Fujitsu", "FM-11 EX", MACHINE_NOT_WORKING) +COMP( 1982, fm16beta, 0, 0, fm16beta, fm7, fm7_state, fm7, "Fujitsu", "FM-16\xCE\xB2", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/fmtowns.c b/src/mame/drivers/fmtowns.c new file mode 100644 index 00000000000..362fed1c7a0 --- /dev/null +++ b/src/mame/drivers/fmtowns.c @@ -0,0 +1,2982 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + + Fujitsu FM-Towns + driver by Barry Rodewald + + Japanese computer system released in 1989. + + CPU: various AMD x86 CPUs, originally 80386DX (80387 available as an add-on). + later models use 80386SX, 80486 and Pentium CPUs + Sound: Yamaha YM3438 + Ricoh RF5c68 + CD-DA + Video: Custom + 16 or 256 colours from a 24-bit palette, or 15-bit high-colour + 1024 sprites (16x16), rendered direct to VRAM + 16 colour text mode, rendered direct to VRAM + + Later models add an unknown single channel 16-bit PCM/ADPCM (FreshTV, SJ, MX), and CL-GD543x Windows accelerator chipsets (SJ) + + + Fujitsu FM-Towns Marty + + Japanese console, based on the FM-Towns computer, using an AMD 80386SX CPU, + released in 1993 + + + Issues: Video emulation is far from complete. + +*/ + +/* I/O port map (incomplete, could well be incorrect too) + * + * 0x0000 : Master 8259 PIC + * 0x0002 : Master 8259 PIC + * 0x0010 : Slave 8259 PIC + * 0x0012 : Slave 8259 PIC + * 0x0020 RW: bit 0 = soft reset (read/write), bit 6 = power off (write), bit 7 = NMI vector protect + * 0x0022 W: bit 7 = power off (write) + * 0x0025 R : returns 0x00? (read) + * 0x0026 R : timer? + * 0x0028 RW: bit 0 = NMI mask (read/write) + * 0x0030 R : Machine ID (low) + * 0x0031 R : Machine ID (high) + * 0x0032 RW: bit 7 = RESET, bit 6 = CLK, bit 0 = data (serial ROM) + * 0x0040 : 8253 PIT counter 0 + * 0x0042 : 8253 PIT counter 1 + * 0x0044 : 8253 PIT counter 2 + * 0x0046 : 8253 PIT mode port + * 0x0060 : 8253 PIT timer control + * 0x006c RW: returns 0x00? (read) timer? (write) + * 0x00a0-af: DMA controller 1 (uPD71071) + * 0x00b0-bf: DMA controller 2 (uPD71071) + * 0x0200-0f: Floppy controller (MB8877A) + * 0x0400 : Video / CRTC (unknown) + * 0x0404 : Disable VRAM, CMOS, memory-mapped I/O (everything in low memory except the BIOS) + * 0x0440-5f: Video / CRTC + * 0x0480 RW: bit 1 = disable BIOS ROM + * 0x048a RW: JEIDA v3/v4(?) IC Memory card status + * 0x0490 RW: JEIDA v4 IC Memory card page select + * 0x0491 RW: JEIDA v4 IC Memory card + * 0x04c0-cf: CD-ROM controller + * 0x04d5 : Sound mute + * 0x04d8 : YM3438 control port A / status + * 0x04da : YM3438 data port A / status + * 0x04dc : YM3438 control port B / status + * 0x04de : YM3438 data port B / status + * 0x04e0-e3: volume ports + * 0x04e9-ec: IRQ masks + * 0x04f0-f8: RF5c68 registers + * 0x05e8 R : RAM size in MB + * 0x05ec RW: bit 0 = compatibility mode? + * 0x0600 RW: Keyboard data port (8042) + * 0x0602 : Keyboard control port (8042) + * 0x0604 : (8042) + * 0x3000 - 0x3fff : CMOS RAM + * 0xfd90-a0: CRTC / Video + * 0xff81: CRTC / Video - returns value in RAM location 0xcff81? + * + * IRQ list + * + * IRQ0 - PIT Timer IRQ + * IRQ1 - Keyboard + * IRQ2 - Serial Port + * IRQ6 - Floppy Disc Drive + * IRQ7 - PIC Cascade IRQ + * IRQ8 - SCSI controller + * IRQ9 - Built-in CD-ROM controller + * IRQ11 - VSync interrupt + * IRQ12 - Printer port + * IRQ13 - Sound (YM3438/RF5c68), Mouse + * IRQ15 - 16-bit PCM (expansion?) + * + * Machine ID list (I/O port 0x31) + * + 1(01h) FM-TOWNS 1/2 + 2(02h) FM-TOWNS 1F/2F/1H/2H + 3(03h) FM-TOWNS 10F/20F/40H/80H + 4(04h) FM-TOWNSII UX + 5(05h) FM-TOWNSII CX + 6(06h) FM-TOWNSII UG + 7(07h) FM-TOWNSII HR + 8(08h) FM-TOWNSII HG + 9(09h) FM-TOWNSII UR + 11(0Bh) FM-TOWNSII MA + 12(0Ch) FM-TOWNSII MX + 13(0Dh) FM-TOWNSII ME + 14(0Eh) TOWNS Application Card (PS/V Vision) + 15(0Fh) FM-TOWNSII MF/Fresh/Fresh???TV + 16(10h) FM-TOWNSII SN + 17(11h) FM-TOWNSII HA/HB/HC + 19(13h) FM-TOWNSII EA/Fresh???T/Fresh???ET/Fresh???FT + 20(14h) FM-TOWNSII Fresh???E/Fresh???ES/Fresh???FS + 22(16h) FMV-TOWNS H/Fresh???GS/Fresh???GT/H2 + 23(17h) FMV-TOWNS H20 + 74(4Ah) FM-TOWNS MARTY + */ + +/* + +Fujitsu FM Towns Marty + +PCB Layout +---------- + +CA20142-B21X + + CN10 CN1 + |-| |-| |-| |----------------------| +|--| |-| |-| |----|-|-------------|----------------------|------------| +|14577 CN11 SW2 |--------| MROM.M37|--------| | +|14576 TMS48C121DZ-80 |FUJITSU | |FUJITSU | | +| TMS48C121DZ-80 |CG24243 | |CS10501 | | +|MB40968 TMS48C121DZ-80 |(QFP208)| MROM.M36|(QFP160)| | +||--------| TMS48C121DZ-80 |--------| |--------| 62256 | +||FUJITSU | HM511664JP8 CN12 FUJITSU | +||CE31755 | 8451 (DIP8) | +||(QFP160)| | +||--------| 4.9152MHz | +|CN13 |--------| 28.63636MHz |-| +| |FUJITSU | |----------------------| +| RTC58323 |CG31553 | | | +|BATTERY |(QFP208)| 32MHz 74LS00 | | +| |--------| |------| | CN2 | +| LC7881 MB84256 |I386SX| | PCMCIA SLOT | +| TL084 CN4 | -16 | | | +||--------| |------| | | +||FUJITSU | MB814400A-70PZ | | +||CS09501 | MB814400A-70PZ |----------------------| +||(QFP120)| MB814400A-70PZ |--------|74LS14 74HC08 |-| +||--------| MB814400A-70PZ | RICOH | 3771 | +| YM3438 |RU6101MF| | +|4560 MB81C78 |(QFP44) | | +| MB88505 |------| |--------| | +| CN3 |YM6063| LED2 LED1 LED3 | +|CN9 CN8 VOL |(QFP80| CN5 CN6 SW1 CN7| +|---------------------|------|----------------------------------------| +Notes: + All IC's shown. + Main CPU Intel 80386SX-16 running at 16.000MHz + CN1 - Multi-pin connector possibly for cartridge or external peripheral connector? + CN2 - PCMCIA slot + CN3 - 24 pin connector for ? + CN4 - CDROM connector? (multi-pin connector with internal slot for a thin cable) + CN5/6 - DB9 connectors (joystick ports?) + CN7 - Power input socket + CN8/9 - Headphone out jacks? + CN10 - Header with left/right RCA audio jacks and composite video output + CN11 - S-VIDEO output + CN12 - 8 pin connector (possibly power related for the CDROM?) + CN13 - 2 pin connector (fan power?) + SW1 - Reset Switch? + SW2 - 2 position slide switch + MROM* - Hitachi HN624116 16MBit SOP44 maskROM + +*/ + +#include "includes/fmtowns.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" + +// CD controller IRQ types +#define TOWNS_CD_IRQ_MPU 1 +#define TOWNS_CD_IRQ_DMA 2 + +enum +{ + MOUSE_START, + MOUSE_SYNC, + MOUSE_X_HIGH, + MOUSE_X_LOW, + MOUSE_Y_HIGH, + MOUSE_Y_LOW +}; + + + + +inline UINT8 towns_state::byte_to_bcd(UINT8 val) +{ + return ((val / 10) << 4) | (val % 10); +} + +inline UINT8 towns_state::bcd_to_byte(UINT8 val) +{ + return (((val & 0xf0) >> 4) * 10) + (val & 0x0f); +} + +inline UINT32 towns_state::msf_to_lbafm(UINT32 val) // because the CDROM core doesn't provide this +{ + UINT8 m,s,f; + f = bcd_to_byte(val & 0x0000ff); + s = (bcd_to_byte((val & 0x00ff00) >> 8)); + m = (bcd_to_byte((val & 0xff0000) >> 16)); + return ((m * (60 * 75)) + (s * 75) + f); +} + +void towns_state::init_serial_rom() +{ + // TODO: init serial ROM contents + int x; + static const UINT8 code[8] = { 0x04,0x65,0x54,0xA4,0x95,0x45,0x35,0x5F }; + UINT8* srom = NULL; + + if(m_serial) + srom = m_serial->base(); + memset(m_towns_serial_rom,0,256/8); + + if(srom) + { + memcpy(m_towns_serial_rom,srom,32); + m_towns_machine_id = (m_towns_serial_rom[0x18] << 8) | m_towns_serial_rom[0x17]; + logerror("Machine ID in serial ROM: %04x\n",m_towns_machine_id); + return; + } + + for(x=8;x<=21;x++) + m_towns_serial_rom[x] = 0xff; + + for(x=0;x<=7;x++) + { + m_towns_serial_rom[x] = code[x]; + } + + // add Machine ID + m_towns_machine_id = 0x0101; + m_towns_serial_rom[0x17] = 0x01; + m_towns_serial_rom[0x18] = 0x01; + + // serial number? + m_towns_serial_rom[29] = 0x10; + m_towns_serial_rom[28] = 0x6e; + m_towns_serial_rom[27] = 0x54; + m_towns_serial_rom[26] = 0x32; + m_towns_serial_rom[25] = 0x10; +} + +void towns_state::init_rtc() +{ + system_time systm; + + machine().base_datetime(systm); + + // seconds + m_towns_rtc_reg[0] = systm.local_time.second % 10; + m_towns_rtc_reg[1] = systm.local_time.second / 10; + // minutes + m_towns_rtc_reg[2] = systm.local_time.minute % 10; + m_towns_rtc_reg[3] = systm.local_time.minute / 10; + // hours + m_towns_rtc_reg[4] = systm.local_time.hour % 10; + m_towns_rtc_reg[5] = systm.local_time.hour / 10; + // weekday + m_towns_rtc_reg[6] = systm.local_time.weekday; + // day + m_towns_rtc_reg[7] = systm.local_time.mday % 10; + m_towns_rtc_reg[8] = systm.local_time.mday / 10; + // month + m_towns_rtc_reg[9] = systm.local_time.month % 10; + m_towns_rtc_reg[10] = systm.local_time.month / 10; + // year + m_towns_rtc_reg[11] = (systm.local_time.year - 2000) % 10; + m_towns_rtc_reg[12] = (systm.local_time.year - 2000) / 10; +} + +READ8_MEMBER(towns_state::towns_system_r) +{ + UINT8 ret = 0; + + switch(offset) + { + case 0x00: + logerror("SYS: port 0x20 read\n"); + return 0x00; + case 0x05: + logerror("SYS: port 0x25 read\n"); + return 0x00; +/* case 0x06: + count = (m_towns_freerun_counter->time_elapsed() * ATTOSECONDS_TO_HZ(ATTOSECONDS_IN_USEC(1))).as_double(); + return count & 0xff; + case 0x07: + count = (m_towns_freerun_counter->time_elapsed() * ATTOSECONDS_TO_HZ(ATTOSECONDS_IN_USEC(1))).as_double(); + return (count >> 8) & 0xff; +*/ case 0x06: + //logerror("SYS: (0x26) timer read\n"); + return m_freerun_timer; + case 0x07: + return m_freerun_timer >> 8; + case 0x08: + //logerror("SYS: (0x28) NMI mask read\n"); + return m_nmi_mask & 0x01; + case 0x10: + logerror("SYS: (0x30) Machine ID read\n"); + return (m_towns_machine_id >> 8) & 0xff; + case 0x11: + logerror("SYS: (0x31) Machine ID read\n"); + return m_towns_machine_id & 0xff; + case 0x12: + /* Bit 0 = data, bit 6 = CLK, bit 7 = RESET, bit 5 is always 1? */ + ret = (m_towns_serial_rom[m_towns_srom_position/8] & (1 << (m_towns_srom_position%8))) ? 1 : 0; + ret |= m_towns_srom_clk; + ret |= m_towns_srom_reset; + //logerror("SYS: (0x32) Serial ROM read [0x%02x, pos=%i]\n",ret,towns_srom_position); + return ret; + default: + //logerror("SYS: Unknown system port read (0x%02x)\n",offset+0x20); + return 0x00; + } +} + +WRITE8_MEMBER(towns_state::towns_system_w) +{ + switch(offset) + { + case 0x00: // bit 7 = NMI vector protect, bit 6 = power off, bit 0 = software reset, bit 3 = A20 line? +// space.m_maincpu->set_input_line(INPUT_LINE_A20,(data & 0x08) ? CLEAR_LINE : ASSERT_LINE); + logerror("SYS: port 0x20 write %02x\n",data); + break; + case 0x02: + logerror("SYS: (0x22) power port write %02x\n",data); + break; + case 0x08: + //logerror("SYS: (0x28) NMI mask write %02x\n",data); + m_nmi_mask = data & 0x01; + break; + case 0x12: + //logerror("SYS: (0x32) Serial ROM write %02x\n",data); + // clocks on low-to-high transition + if((data & 0x40) && m_towns_srom_clk == 0) // CLK + { // advance to next bit + m_towns_srom_position++; + } + if((data & 0x80) && m_towns_srom_reset == 0) // reset + { // reset to beginning + m_towns_srom_position = 0; + } + m_towns_srom_clk = data & 0x40; + m_towns_srom_reset = data & 0x80; + break; + default: + logerror("SYS: Unknown system port write 0x%02x (0x%02x)\n",data,offset); + } +} + +WRITE8_MEMBER(towns_state::towns_intervaltimer2_w) +{ + switch(offset) + { + case 0x00: + m_intervaltimer2_irqmask = data & 0x80; + break; + case 0x02: + m_intervaltimer2_period = (m_intervaltimer2_period & 0xff00) | data; + popmessage("Interval Timer 2 period changed to %04x",m_intervaltimer2_period); + break; + case 0x03: + m_intervaltimer2_period = (data << 8) | (m_intervaltimer2_period & 0x00ff); + popmessage("Interval Timer 2 period changed to %04x",m_intervaltimer2_period); + break; + } +} + +READ8_MEMBER(towns_state::towns_intervaltimer2_r) +{ + UINT8 ret = 0; + + switch(offset) + { + case 0x00: + if(m_intervaltimer2_timeout_flag != 0) + ret |= 0x40; + if(m_intervaltimer2_irqmask != 0) + ret |= 0x80; + m_intervaltimer2_timeout_flag = 0; // flag reset on read + return ret; + case 0x02: + return m_intervaltimer2_period & 0x00ff; + case 0x03: + return m_intervaltimer2_period >> 8; + } + return 0xff; +} + +void towns_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_RTC: + rtc_second(); + break; + case TIMER_FREERUN: + freerun_inc(); + break; + case TIMER_INTERVAL2: + intervaltimer2_timeout(); + break; + case TIMER_KEYBOARD: + poll_keyboard(); + break; + case TIMER_MOUSE: + mouse_timeout(); + break; + case TIMER_WAIT: + wait_end(); + break; + case TIMER_CDSTATUS: + towns_cd_status_ready(); + break; + case TIMER_CDDA: + towns_delay_cdda((cdrom_image_device*)ptr); + break; + } +} +void towns_state::freerun_inc() +{ + m_freerun_timer++; +} + +void towns_state::intervaltimer2_timeout() +{ + m_intervaltimer2_timeout_flag = 1; +} + +void towns_state::wait_end() +{ + m_maincpu->set_input_line(INPUT_LINE_HALT,CLEAR_LINE); +} + +READ8_MEMBER(towns_state::towns_sys6c_r) +{ + logerror("SYS: (0x6c) Timer? read\n"); + return 0x00; +} + +WRITE8_MEMBER(towns_state::towns_sys6c_w) +{ + // halts the CPU for 1 microsecond + m_maincpu->set_input_line(INPUT_LINE_HALT,ASSERT_LINE); + m_towns_wait_timer->adjust(attotime::from_usec(1),0,attotime::never); +} + +READ8_MEMBER(towns_state::towns_dma1_r) +{ +// logerror("DMA#1: read register %i\n",offset); + return m_dma_1->read(space, offset); +} + +WRITE8_MEMBER(towns_state::towns_dma1_w) +{ +// logerror("DMA#1: wrote 0x%02x to register %i\n",data,offset); + m_dma_1->write(space, offset, data); +} + +READ8_MEMBER(towns_state::towns_dma2_r) +{ + logerror("DMA#2: read register %i\n",offset); + return m_dma_2->read(space, offset); +} + +WRITE8_MEMBER(towns_state::towns_dma2_w) +{ + logerror("DMA#2: wrote 0x%02x to register %i\n",data,offset); + m_dma_2->write(space, offset, data); +} + +/* + * Floppy Disc Controller (MB8877A) + */ + +WRITE_LINE_MEMBER( towns_state::mb8877a_irq_w ) +{ + if(m_towns_fdc_irq6mask == 0) + state = 0; + m_pic_master->ir6_w(state); // IRQ6 = FDC + if(IRQ_LOG) logerror("PIC: IRQ6 (FDC) set to %i\n",state); +} + +WRITE_LINE_MEMBER( towns_state::mb8877a_drq_w ) +{ + m_dma_1->dmarq(state, 0); +} + +READ8_MEMBER(towns_state::towns_floppy_r) +{ + UINT8 ret; + + switch(offset) + { + case 0x00: + return m_fdc->status_r(space, 0); + case 0x02: + return m_fdc->track_r(space, 0); + case 0x04: + return m_fdc->sector_r(space, 0); + case 0x06: + return m_fdc->data_r(space, 0); + case 0x08: // selected drive status? + //logerror("FDC: read from offset 0x08\n"); + ret = 0x80; // always set + switch(m_towns_selected_drive) + { + case 1: + ret |= 0x0c; + if(m_flop0->get_device()->exists()) + ret |= 0x03; + break; + case 2: + ret |= 0x0c; + if(m_flop1->get_device()->exists()) + ret |= 0x03; + break; + case 3: + case 4: + case 0: + default: + break; + } + return ret; + case 0x0e: // DRVCHG + logerror("FDC: read from offset 0x0e\n"); + if(m_towns_selected_drive == 1) + return m_flop0->get_device()->dskchg_r(); + if(m_towns_selected_drive == 2) + return m_flop1->get_device()->dskchg_r(); + return 0x00; + default: + logerror("FDC: read from invalid or unimplemented register %02x\n",offset); + } + return 0xff; +} + +WRITE8_MEMBER(towns_state::towns_floppy_w) +{ + floppy_image_device* sel[4] = { m_flop0->get_device(), m_flop1->get_device(), NULL, NULL }; + + switch(offset) + { + case 0x00: + // Commands 0xd0 and 0xfe (Write Track) are apparently ignored? + if(data == 0xd0) + return; + if(data == 0xfe) + return; + m_fdc->cmd_w(space, 0,data); + logerror("FDC: Command %02x\n",data); + break; + case 0x02: + m_fdc->track_w(space, 0,data); + logerror("FDC: Track %02x\n",data); + break; + case 0x04: + m_fdc->sector_w(space, 0,data); + logerror("FDC: Sector %02x\n",data); + break; + case 0x06: + m_fdc->data_w(space, 0,data); + logerror("FDC: Data %02x\n",data); + break; + case 0x08: + // bit 5 - CLKSEL + if(m_towns_selected_drive != 0) + { + if(sel[m_towns_selected_drive-1] != NULL) + { + sel[m_towns_selected_drive-1]->mon_w((~data & 0x10)>>4); + sel[m_towns_selected_drive-1]->ss_w((data & 0x04)>>2); + } + } + m_fdc->dden_w(BIT(~data, 1)); + + m_towns_fdc_irq6mask = data & 0x01; + //logerror("FDC: Config drive%i %02x\n",m_towns_selected_drive-1,data); + + break; + case 0x0c: // drive select + switch(data & 0x0f) + { + case 0x00: + m_towns_selected_drive = 0; // No drive selected + break; + case 0x01: + m_towns_selected_drive = 1; + if(sel[0] != NULL) + m_fdc->set_floppy(sel[0]); + break; + case 0x02: + m_towns_selected_drive = 2; + if(sel[1] != NULL) + m_fdc->set_floppy(sel[1]); + break; + case 0x04: + m_towns_selected_drive = 3; + if(sel[2] != NULL) + m_fdc->set_floppy(sel[2]); + break; + case 0x08: + m_towns_selected_drive = 4; + if(sel[3] != NULL) + m_fdc->set_floppy(sel[3]); + break; + } + //logerror("FDC: drive select %02x\n",data); + break; + default: + logerror("FDC: write %02x to invalid or unimplemented register %02x\n",data,offset); + } +} + +READ16_MEMBER(towns_state::towns_fdc_dma_r) +{ UINT16 data = m_fdc->data_r(generic_space(), 0); + return data; +} + +WRITE16_MEMBER(towns_state::towns_fdc_dma_w) +{ + m_fdc->data_w(generic_space(), 0,data); +} + +/* + * Port 0x600-0x607 - Keyboard controller (8042 MCU) + * + * Sends two-byte code on each key press and release. + * First byte has the MSB set, and contains shift/ctrl/alt/kana flags + * Known bits: + * bit 7 = always 1 + * bit 4 = key release + * bit 3 = ctrl + * bit 2 = shift + * + * Second byte has the MSB reset, and contains the scancode of the key + * pressed or released. + * bit 7 = always 0 + * bits 6-0 = key scancode + */ +void towns_state::kb_sendcode(UINT8 scancode, int release) +{ + switch(release) + { + case 0: // key press + m_towns_kb_output = 0x80; + m_towns_kb_extend = scancode & 0x7f; + if(m_key3->read() & 0x00080000) + m_towns_kb_output |= 0x04; + if(m_key3->read() & 0x00040000) + m_towns_kb_output |= 0x08; + if(m_key3->read() & 0x06400000) + m_towns_kb_output |= 0x20; + break; + case 1: // key release + m_towns_kb_output = 0x90; + m_towns_kb_extend = scancode & 0x7f; + if(m_key3->read() & 0x00080000) + m_towns_kb_output |= 0x04; + if(m_key3->read() & 0x00040000) + m_towns_kb_output |= 0x08; + if(m_key3->read() & 0x06400000) + m_towns_kb_output |= 0x20; + break; + case 2: // extended byte + m_towns_kb_output = scancode; + m_towns_kb_extend = 0xff; + break; + } + m_towns_kb_status |= 0x01; + if(m_towns_kb_irq1_enable) + { + m_pic_master->ir1_w(1); + if(IRQ_LOG) logerror("PIC: IRQ1 (keyboard) set high\n"); + } + //logerror("KB: sending scancode 0x%02x\n",scancode); +} + +void towns_state::poll_keyboard() +{ + ioport_port* kb_ports[4] = { m_key1, m_key2, m_key3, m_key4 }; + int port,bit; + UINT8 scan; + UINT32 portval; + + scan = 0; + for(port=0;port<4;port++) + { + portval = kb_ports[port]->read(); + for(bit=0;bit<32;bit++) + { + if(((portval & (1<ir1_w(0); + if(IRQ_LOG) logerror("PIC: IRQ1 (keyboard) set low\n"); + if(m_towns_kb_extend != 0xff) + { + kb_sendcode(m_towns_kb_extend,2); + } + else + m_towns_kb_status &= ~0x01; + return ret; + case 1: // status + //logerror("KB: read status port, returning %02x\n",m_towns_kb_status); + return m_towns_kb_status; + default: + logerror("KB: read offset %02x\n",offset); + } + return 0x00; +} + +WRITE8_MEMBER(towns_state::towns_keyboard_w) +{ + switch(offset) + { + case 0: // command input + m_towns_kb_status &= ~0x08; + m_towns_kb_status |= 0x01; + break; + case 1: // control + m_towns_kb_status |= 0x08; + break; + case 2: // IRQ1 enable + m_towns_kb_irq1_enable = data & 0x01; + break; + default: + logerror("KB: wrote 0x%02x to offset %02x\n",data,offset); + } +} + +/* + * Port 0x60 - PIT Timer control + * On read: bit 0: Timer 0 output level + * bit 1: Timer 1 output level + * bits 4-2: Timer masks (timer 2 = beeper) + * On write: bits 2-0: Timer mask set + * bit 7: Timer 0 output reset + */ +UINT8 towns_state::speaker_get_spk() +{ + return m_towns_spkrdata & m_pit_out2; +} + + +void towns_state::speaker_set_spkrdata(UINT8 data) +{ + m_towns_spkrdata = data ? 1 : 0; + m_speaker->level_w(speaker_get_spk()); +} + + +READ8_MEMBER(towns_state::towns_port60_r) +{ + UINT8 val = 0x00; + + if (m_pit_out0) + val |= 0x01; + if (m_pit_out1) + val |= 0x02; + + val |= (m_towns_timer_mask & 0x07) << 2; + + //logerror("PIT: port 0x60 read, returning 0x%02x\n",val); + return val; +} + +WRITE8_MEMBER(towns_state::towns_port60_w) +{ + //device_t* dev = m_pic_master; + + if(data & 0x80) + { + //towns_pic_irq(dev,0); + m_timer0 = 0; + m_pic_master->ir0_w(m_timer0 || m_timer1); + } + m_towns_timer_mask = data & 0x07; + + speaker_set_spkrdata(data & 0x04); + + //logerror("PIT: wrote 0x%02x to port 0x60\n",data); +} + +READ8_MEMBER(towns_state::towns_sys5e8_r) +{ + switch(offset) + { + case 0x00: + logerror("SYS: read RAM size port (%i)\n",m_ram->size()); + return m_ram->size()/1048576; + case 0x02: + logerror("SYS: read port 5ec\n"); + return m_compat_mode & 0x01; + } + return 0x00; +} + +WRITE8_MEMBER(towns_state::towns_sys5e8_w) +{ + switch(offset) + { + case 0x00: + logerror("SYS: wrote 0x%02x to port 5e8\n",data); + break; + case 0x02: + logerror("SYS: wrote 0x%02x to port 5ec\n",data); + m_compat_mode = data & 0x01; + break; + } +} + +// Sound/LED control (I/O port 0x4e8-0x4ef) +// R/O -- (0x4e9) FM IRQ flag (bit 0), PCM IRQ flag (bit 3) +// (0x4ea) PCM IRQ mask +// R/W -- (0x4eb) PCM IRQ flag +// W/O -- (0x4ec) LED control +READ8_MEMBER(towns_state::towns_sound_ctrl_r) +{ + UINT8 ret = 0; + + switch(offset) + { + case 0x01: + if(m_towns_fm_irq_flag) + ret |= 0x01; + if(m_towns_pcm_irq_flag) + ret |= 0x08; + break; + case 0x03: + ret = m_towns_pcm_channel_flag; + m_towns_pcm_channel_flag = 0; + m_towns_pcm_irq_flag = 0; + if(m_towns_fm_irq_flag == 0) + { + m_pic_slave->ir5_w(0); + if(IRQ_LOG) logerror("PIC: IRQ13 (PCM) set low\n"); + } + break; +// default: + //logerror("FM: unimplemented port 0x%04x read\n",offset + 0x4e8); + } + return ret; +} + +WRITE8_MEMBER(towns_state::towns_sound_ctrl_w) +{ + switch(offset) + { + case 0x02: // PCM channel interrupt mask + m_towns_pcm_channel_mask = data; + break; + default: + logerror("FM: unimplemented port 0x%04x write %02x\n",offset + 0x4e8,data); + } +} + +// Controller ports +// Joysticks are multiplexed, with fire buttons available when bits 0 and 1 of port 0x4d6 are high. (bits 2 and 3 for second port?) +void towns_state::mouse_timeout() +{ + m_towns_mouse_output = MOUSE_START; // reset mouse data +} + +READ8_MEMBER(towns_state::towns_padport_r) +{ + UINT8 ret = 0x00; + UINT32 porttype = m_ctrltype->read(); + UINT8 extra1; + UINT8 extra2; + UINT32 state; + + if(offset == 0) + { + if((porttype & 0x0f) == 0x01) + { + extra1 = m_joy1_ex->read(); + + if(m_towns_pad_mask & 0x10) + ret |= (m_joy1->read() & 0x3f) | 0x40; + else + ret |= (m_joy1->read() & 0x0f) | 0x30; + + if(extra1 & 0x01) // Run button = left+right + ret &= ~0x0c; + if(extra1 & 0x02) // Select button = up+down + ret &= ~0x03; + + if((extra1 & 0x10) && (m_towns_pad_mask & 0x01)) + ret &= ~0x10; + if((extra1 & 0x20) && (m_towns_pad_mask & 0x02)) + ret &= ~0x20; + } + if((porttype & 0x0f) == 0x04) // 6-button joystick + { + extra1 = m_6b_joy1_ex->read(); + + if(m_towns_pad_mask & 0x10) + ret |= 0x7f; + else + ret |= (m_6b_joy1->read() & 0x0f) | 0x70; + + if(!(m_towns_pad_mask & 0x10)) + { + if(extra1 & 0x01) // Run button = left+right + ret &= ~0x0c; + if(extra1 & 0x02) // Select button = up+down + ret &= ~0x03; + if((extra1 & 0x04) && (m_towns_pad_mask & 0x01)) + ret &= ~0x10; + if((extra1 & 0x08) && (m_towns_pad_mask & 0x02)) + ret &= ~0x20; + } + if(m_towns_pad_mask & 0x10) + { + if(extra1 & 0x10) + ret &= ~0x08; + if(extra1 & 0x20) + ret &= ~0x04; + if(extra1 & 0x40) + ret &= ~0x02; + if(extra1 & 0x80) + ret &= ~0x01; + } + } + if((porttype & 0x0f) == 0x02) // mouse + { + switch(m_towns_mouse_output) + { + case MOUSE_X_HIGH: + ret |= ((m_towns_mouse_x & 0xf0) >> 4); + break; + case MOUSE_X_LOW: + ret |= (m_towns_mouse_x & 0x0f); + break; + case MOUSE_Y_HIGH: + ret |= ((m_towns_mouse_y & 0xf0) >> 4); + break; + case MOUSE_Y_LOW: + ret |= (m_towns_mouse_y & 0x0f); + break; + case MOUSE_START: + case MOUSE_SYNC: + default: + if(m_towns_mouse_output < MOUSE_Y_LOW) + ret |= 0x0f; + } + + // button states are always visible + state = m_mouse1->read(); + if(!(state & 0x01)) + ret |= 0x10; + if(!(state & 0x02)) + ret |= 0x20; + if(m_towns_pad_mask & 0x10) + ret |= 0x40; + } + + } + if(offset == 1) // second joystick port + { + if((porttype & 0xf0) == 0x10) + { + extra2 = m_joy2_ex->read(); + + if(m_towns_pad_mask & 0x20) + ret |= ((m_joy2->read() & 0x3f)) | 0x40; + else + ret |= ((m_joy2->read() & 0x0f)) | 0x30; + + if(extra2 & 0x01) + ret &= ~0x0c; + if(extra2 & 0x02) + ret &= ~0x03; + + if((extra2 & 0x10) && (m_towns_pad_mask & 0x04)) + ret &= ~0x10; + if((extra2 & 0x20) && (m_towns_pad_mask & 0x08)) + ret &= ~0x20; + } + if((porttype & 0xf0) == 0x40) // 6-button joystick + { + extra2 = m_6b_joy2_ex->read(); + + if(m_towns_pad_mask & 0x20) + ret |= 0x7f; + else + ret |= ((m_6b_joy2->read() & 0x0f)) | 0x70; + + if(!(m_towns_pad_mask & 0x10)) + { + if(extra2 & 0x01) + ret &= ~0x0c; + if(extra2 & 0x02) + ret &= ~0x03; + if((extra2 & 0x10) && (m_towns_pad_mask & 0x04)) + ret &= ~0x10; + if((extra2 & 0x20) && (m_towns_pad_mask & 0x08)) + ret &= ~0x20; + } + if(m_towns_pad_mask & 0x20) + { + if(extra2 & 0x10) + ret &= ~0x08; + if(extra2 & 0x20) + ret &= ~0x04; + if(extra2 & 0x40) + ret &= ~0x02; + if(extra2 & 0x80) + ret &= ~0x01; + } + } + if((porttype & 0xf0) == 0x20) // mouse + { + switch(m_towns_mouse_output) + { + case MOUSE_X_HIGH: + ret |= ((m_towns_mouse_x & 0xf0) >> 4); + break; + case MOUSE_X_LOW: + ret |= (m_towns_mouse_x & 0x0f); + break; + case MOUSE_Y_HIGH: + ret |= ((m_towns_mouse_y & 0xf0) >> 4); + break; + case MOUSE_Y_LOW: + ret |= (m_towns_mouse_y & 0x0f); + break; + case MOUSE_START: + case MOUSE_SYNC: + default: + if(m_towns_mouse_output < MOUSE_Y_LOW) + ret |= 0x0f; + } + + // button states are always visible + state = m_mouse1->read(); + if(!(state & 0x01)) + ret |= 0x10; + if(!(state & 0x02)) + ret |= 0x20; + if(m_towns_pad_mask & 0x20) + ret |= 0x40; + } + } + + return ret; +} + +WRITE8_MEMBER(towns_state::towns_pad_mask_w) +{ + UINT8 current_x,current_y; + UINT32 type = m_ctrltype->read(); + + m_towns_pad_mask = (data & 0xff); + if((type & 0x0f) == 0x02) // mouse + { + if((m_towns_pad_mask & 0x10) != 0 && (m_prev_pad_mask & 0x10) == 0) + { + if(m_towns_mouse_output == MOUSE_START) + { + m_towns_mouse_output = MOUSE_X_HIGH; + current_x = m_mouse2->read(); + current_y = m_mouse3->read(); + m_towns_mouse_x = m_prev_x - current_x; + m_towns_mouse_y = m_prev_y - current_y; + m_prev_x = current_x; + m_prev_y = current_y; + } + else + m_towns_mouse_output++; + m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); + } + if((m_towns_pad_mask & 0x10) == 0 && (m_prev_pad_mask & 0x10) != 0) + { + if(m_towns_mouse_output == MOUSE_START) + { + m_towns_mouse_output = MOUSE_SYNC; + current_x = m_mouse2->read(); + current_y = m_mouse3->read(); + m_towns_mouse_x = m_prev_x - current_x; + m_towns_mouse_y = m_prev_y - current_y; + m_prev_x = current_x; + m_prev_y = current_y; + } + else + m_towns_mouse_output++; + m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); + } + m_prev_pad_mask = m_towns_pad_mask; + } + if((type & 0xf0) == 0x20) // mouse + { + if((m_towns_pad_mask & 0x20) != 0 && (m_prev_pad_mask & 0x20) == 0) + { + if(m_towns_mouse_output == MOUSE_START) + { + m_towns_mouse_output = MOUSE_X_HIGH; + current_x = m_mouse2->read(); + current_y = m_mouse3->read(); + m_towns_mouse_x = m_prev_x - current_x; + m_towns_mouse_y = m_prev_y - current_y; + m_prev_x = current_x; + m_prev_y = current_y; + } + else + m_towns_mouse_output++; + m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); + } + if((m_towns_pad_mask & 0x20) == 0 && (m_prev_pad_mask & 0x20) != 0) + { + if(m_towns_mouse_output == MOUSE_START) + { + m_towns_mouse_output = MOUSE_SYNC; + current_x = m_mouse2->read(); + current_y = m_mouse3->read(); + m_towns_mouse_x = m_prev_x - current_x; + m_towns_mouse_y = m_prev_y - current_y; + m_prev_x = current_x; + m_prev_y = current_y; + } + else + m_towns_mouse_output++; + m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); + } + m_prev_pad_mask = m_towns_pad_mask; + } +} + +READ8_MEMBER( towns_state::towns_cmos_low_r ) +{ + if(m_towns_mainmem_enable != 0) + return m_messram->pointer()[offset + 0xd8000]; + + if(m_nvram) + return m_nvram[offset]; + else + return m_nvram16[offset]; +} + +WRITE8_MEMBER( towns_state::towns_cmos_low_w ) +{ + if(m_towns_mainmem_enable != 0) + m_messram->pointer()[offset+0xd8000] = data; + else + if(m_nvram) + m_nvram[offset] = data; + else + m_nvram16[offset] = data; +} + +READ8_MEMBER( towns_state::towns_cmos_r ) +{ + if(m_nvram) + return m_nvram[offset]; + else + return m_nvram16[offset]; +} + +WRITE8_MEMBER( towns_state::towns_cmos_w ) +{ + if(m_nvram) + m_nvram[offset] = data; + else + m_nvram16[offset] = data; +} + +void towns_state::towns_update_video_banks(address_space& space) +{ + UINT8* ROM; + + if(m_towns_mainmem_enable != 0) // first MB is RAM + { + ROM = m_user->base(); + +// membank(1)->set_base(m_messram->pointer()+0xc0000); +// membank(2)->set_base(m_messram->pointer()+0xc8000); +// membank(3)->set_base(m_messram->pointer()+0xc9000); +// membank(4)->set_base(m_messram->pointer()+0xca000); +// membank(5)->set_base(m_messram->pointer()+0xca000); +// membank(10)->set_base(m_messram->pointer()+0xca800); + membank("bank6")->set_base(m_messram->pointer()+0xcb000); + membank("bank7")->set_base(m_messram->pointer()+0xcb000); + if(m_towns_system_port & 0x02) + membank("bank11")->set_base(m_messram->pointer()+0xf8000); + else + membank("bank11")->set_base(ROM+0x238000); + membank("bank12")->set_base(m_messram->pointer()+0xf8000); + return; + } + else // enable I/O ports and VRAM + { + ROM = m_user->base(); + +// membank(1)->set_base(towns_gfxvram+(towns_vram_rplane*0x8000)); +// membank(2)->set_base(towns_txtvram); +// membank(3)->set_base(m_messram->pointer()+0xc9000); +// if(towns_ankcg_enable != 0) +// membank(4)->set_base(ROM+0x180000+0x3d000); // ANK CG 8x8 +// else +// membank(4)->set_base(towns_txtvram+0x2000); +// membank(5)->set_base(towns_txtvram+0x2000); +// membank(10)->set_base(m_messram->pointer()+0xca800); + if(m_towns_ankcg_enable != 0) + membank("bank6")->set_base(ROM+0x180000+0x3d800); // ANK CG 8x16 + else + membank("bank6")->set_base(m_messram->pointer()+0xcb000); + membank("bank7")->set_base(m_messram->pointer()+0xcb000); + if(m_towns_system_port & 0x02) + membank("bank11")->set_base(m_messram->pointer()+0xf8000); + else + membank("bank11")->set_base(ROM+0x238000); + membank("bank12")->set_base(m_messram->pointer()+0xf8000); + return; + } +} + +READ8_MEMBER( towns_state::towns_sys480_r ) +{ + if(m_towns_system_port & 0x02) + return 0x02; + else + return 0x00; +} + +WRITE8_MEMBER( towns_state::towns_sys480_w ) +{ + m_towns_system_port = data; + m_towns_ram_enable = data & 0x02; + towns_update_video_banks(space); +} + +WRITE8_MEMBER( towns_state::towns_video_404_w ) +{ + m_towns_mainmem_enable = data & 0x80; + towns_update_video_banks(space); +} + +READ8_MEMBER( towns_state::towns_video_404_r ) +{ + if(m_towns_mainmem_enable != 0) + return 0x80; + else + return 0x00; +} + +/* + * I/O ports 0x4c0-0x4cf + * CD-ROM driver (custom?) + * + * 0x4c0 - Status port (R/W) + * bit 7 - IRQ from sub MPU (reset when read) + * bit 6 - IRQ from DMA end (reset when read) + * bit 5 - Software transfer + * bit 4 - DMA transfer + * bit 1 - status read request + * bit 0 - ready + * Note: IRQ bits are only set high if the IRQ bit in the command byte is NOT set. + * + * 0x4c2 - Command port (R/W) + * On read, returns status byte (4 in total?) + * On write, performs specified command: + * bit 7 - command type + * bit 6 - IRQ + * bit 5 - status + * bits 4-0 - command + * Type=1: + * 0 = set state + * 1 = set state (CDDASET) + * Type=0: + * 0 = Seek + * 2 = Read (MODE1) + * 5 = TOC Read + * + * 0x4c4 - Parameter port (R/W) + * Inserts a byte into an array of 8 bytes used for command parameters + * Writing to this port puts the byte at the front of the array, and + * pushes the other parameters back. + * + * 0x4c6 (W/O) + * bit 3 - software transfer mode + * bit 4 - DMA transfer mode + * + */ +void towns_state::towns_cdrom_set_irq(int line,int state) +{ + switch(line) + { + case TOWNS_CD_IRQ_MPU: + if(state != 0) + { + if(m_towns_cd.command & 0x40) + { +// if(m_towns_cd.mpu_irq_enable) + { + m_towns_cd.status |= 0x80; + m_pic_slave->ir1_w(1); + if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM) set high\n"); + } + } + else + m_towns_cd.status |= 0x80; + } + else + { + m_towns_cd.status &= ~0x80; + m_pic_slave->ir1_w(0); + if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM) set low\n"); + } + break; + case TOWNS_CD_IRQ_DMA: + if(state != 0) + { + if(m_towns_cd.command & 0x40) + { +// if(m_towns_cd.dma_irq_enable) + { + m_towns_cd.status |= 0x40; + m_pic_slave->ir1_w(1); + if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM DMA) set high\n"); + } + } + else + m_towns_cd.status |= 0x40; + } + else + { + m_towns_cd.status &= ~0x40; + m_pic_slave->ir1_w(0); + if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM DMA) set low\n"); + } + break; + } +} + +void towns_state::towns_cd_status_ready() +{ + m_towns_cd.status |= 0x02; // status read request + m_towns_cd.status |= 0x01; // ready + m_towns_cd.cmd_status_ptr = 0; + towns_cdrom_set_irq(TOWNS_CD_IRQ_MPU,1); +} + +void towns_state::towns_cd_set_status(UINT8 st0, UINT8 st1, UINT8 st2, UINT8 st3) +{ + m_towns_cd.cmd_status[0] = st0; + m_towns_cd.cmd_status[1] = st1; + m_towns_cd.cmd_status[2] = st2; + m_towns_cd.cmd_status[3] = st3; + // wait a bit + m_towns_status_timer->adjust(attotime::from_msec(1),0,attotime::never); +} + +UINT8 towns_state::towns_cd_get_track() +{ + cdrom_image_device* cdrom = m_cdrom; + UINT32 lba = m_cdda->get_audio_lba(); + UINT8 track; + + for(track=1;track<99;track++) + { + if(cdrom_get_track_start(cdrom->get_cdrom_file(),track) > lba) + break; + } + return track; +} + +TIMER_CALLBACK_MEMBER(towns_state::towns_cdrom_read_byte) +{ + upd71071_device* device = (upd71071_device* )ptr; + int masked; + // TODO: support software transfers, for now DMA is assumed. + + if(m_towns_cd.buffer_ptr < 0) // transfer has ended + return; + + masked = device->dmarq(param, 3); // CD-ROM controller uses DMA1 channel 3 +// logerror("DMARQ: param=%i ret=%i bufferptr=%i\n",param,masked,m_towns_cd.buffer_ptr); + if(param != 0) + { + m_towns_cd.read_timer->adjust(attotime::from_hz(300000)); + } + else + { + if(masked != 0) // check if the DMA channel is masked + { + m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); + return; + } + if(m_towns_cd.buffer_ptr < 2048) + m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); + else + { // end of transfer + m_towns_cd.status &= ~0x10; // no longer transferring by DMA + m_towns_cd.status &= ~0x20; // no longer transferring by software + logerror("DMA1: end of transfer (LBA=%08x)\n",m_towns_cd.lba_current); + if(m_towns_cd.lba_current >= m_towns_cd.lba_last) + { + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x06,0x00,0x00,0x00); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); + m_towns_cd.buffer_ptr = -1; + m_towns_cd.status |= 0x01; // ready + } + else + { + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x22,0x00,0x00,0x00); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); + cdrom_read_data(m_cdrom->get_cdrom_file(),++m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); + m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); + m_towns_cd.buffer_ptr = -1; + } + } + } +} + +UINT8 towns_state::towns_cdrom_read_byte_software() +{ + UINT8 ret; + if(m_towns_cd.buffer_ptr < 0) // transfer has ended + return 0x00; + + ret = m_towns_cd.buffer[m_towns_cd.buffer_ptr++]; + + if(m_towns_cd.buffer_ptr >= 2048) + { // end of transfer + m_towns_cd.status &= ~0x10; // no longer transferring by DMA + m_towns_cd.status &= ~0x20; // no longer transferring by software + logerror("CD: end of software transfer (LBA=%08x)\n",m_towns_cd.lba_current); + if(m_towns_cd.lba_current >= m_towns_cd.lba_last) + { + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x06,0x00,0x00,0x00); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); + m_towns_cd.buffer_ptr = -1; + m_towns_cd.status |= 0x01; // ready + } + else + { + cdrom_read_data(m_cdrom->get_cdrom_file(),++m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x21,0x00,0x00,0x00); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); + m_towns_cd.status &= ~0x10; + m_towns_cd.status |= 0x20; + m_towns_cd.buffer_ptr = -1; + } + } + return ret; +} + +void towns_state::towns_cdrom_read(cdrom_image_device* device) +{ + // MODE 1 read + // load data into buffer to be sent via DMA1 channel 3 + // A set of status bytes is sent after each sector, and DMA is paused + // so that the DMA controller than be set up again. + // parameters: + // 3 bytes: MSF of first sector to read + // 3 bytes: MSF of last sector to read + UINT32 lba1,lba2,track; + + lba1 = m_towns_cd.parameter[7] << 16; + lba1 += m_towns_cd.parameter[6] << 8; + lba1 += m_towns_cd.parameter[5]; + lba2 = m_towns_cd.parameter[4] << 16; + lba2 += m_towns_cd.parameter[3] << 8; + lba2 += m_towns_cd.parameter[2]; + m_towns_cd.lba_current = msf_to_lbafm(lba1); + m_towns_cd.lba_last = msf_to_lbafm(lba2); + + // first track starts at 00:02:00 - this is hardcoded in the boot procedure + track = cdrom_get_track(device->get_cdrom_file(),m_towns_cd.lba_current); + if(track < 2) + { // recalculate LBA + m_towns_cd.lba_current -= 150; + m_towns_cd.lba_last -= 150; + } + + // parameter 7 = sector count? + if(m_towns_cd.parameter[1] != 0) + m_towns_cd.lba_last += m_towns_cd.parameter[1]; + + logerror("CD: Mode 1 read from LBA next:%i last:%i track:%i\n",m_towns_cd.lba_current,m_towns_cd.lba_last,track); + + if(m_towns_cd.lba_current > m_towns_cd.lba_last) + { + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x01,0x00,0x00,0x00); + } + else + { + cdrom_read_data(device->get_cdrom_file(),m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); + if(m_towns_cd.software_tx) + { + m_towns_cd.status &= ~0x10; // not a DMA transfer + m_towns_cd.status |= 0x20; // software transfer + } + else + { + m_towns_cd.status |= 0x10; // DMA transfer begin + m_towns_cd.status &= ~0x20; // not a software transfer + } +// m_towns_cd.buffer_ptr = 0; +// m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 2; + towns_cd_set_status(0x00,0x00,0x00,0x00); + } + else + { + m_towns_cd.extra_status = 0; + if(m_towns_cd.software_tx) + towns_cd_set_status(0x21,0x00,0x00,0x00); + else + towns_cd_set_status(0x22,0x00,0x00,0x00); + } + } +} + +void towns_state::towns_cdrom_play_cdda(cdrom_image_device* device) +{ + // PLAY AUDIO + // Plays CD-DA audio from the specified MSF + // Parameters: + // 3 bytes: starting MSF of audio to play + // 3 bytes: ending MSF of audio to play (can span multiple tracks) + UINT32 lba1,lba2; + + lba1 = m_towns_cd.parameter[7] << 16; + lba1 += m_towns_cd.parameter[6] << 8; + lba1 += m_towns_cd.parameter[5]; + lba2 = m_towns_cd.parameter[4] << 16; + lba2 += m_towns_cd.parameter[3] << 8; + lba2 += m_towns_cd.parameter[2]; + m_towns_cd.cdda_current = msf_to_lbafm(lba1); + m_towns_cd.cdda_length = msf_to_lbafm(lba2) - m_towns_cd.cdda_current; + + m_cdda->set_cdrom(device->get_cdrom_file()); + m_cdda->start_audio(m_towns_cd.cdda_current,m_towns_cd.cdda_length); + logerror("CD: CD-DA start from LBA:%i length:%i\n",m_towns_cd.cdda_current,m_towns_cd.cdda_length); + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 1; + towns_cd_set_status(0x00,0x03,0x00,0x00); + } +} + +void towns_state::towns_delay_cdda(cdrom_image_device* dev) +{ + towns_cdrom_play_cdda(dev); +} + +void towns_state::towns_cdrom_execute_command(cdrom_image_device* device) +{ + if(device->get_cdrom_file() == NULL) + { // No CD in drive + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x10,0x00,0x00,0x00); + } + } + else + { + m_towns_cd.status &= ~0x02; + switch(m_towns_cd.command & 0x9f) + { + case 0x00: // Seek + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 1; + towns_cd_set_status(0x00,0x00,0x00,0x00); + } + logerror("CD: Command 0x00: SEEK\n"); + break; + case 0x01: // unknown + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x00,0xff,0xff,0xff); + } + logerror("CD: Command 0x01: unknown\n"); + break; + case 0x02: // Read (MODE1) + logerror("CD: Command 0x02: READ MODE1\n"); + towns_cdrom_read(device); + break; + case 0x04: // Play Audio Track + logerror("CD: Command 0x04: PLAY CD-DA\n"); + m_towns_cdda_timer->set_ptr(device); + m_towns_cdda_timer->adjust(attotime::from_msec(1),0,attotime::never); + break; + case 0x05: // Read TOC + logerror("CD: Command 0x05: READ TOC\n"); + m_towns_cd.extra_status = 1; + towns_cd_set_status(0x00,0x00,0x00,0x00); + break; + case 0x06: // Read CD-DA state? + logerror("CD: Command 0x06: READ CD-DA STATE\n"); + m_towns_cd.extra_status = 1; + towns_cd_set_status(0x00,0x00,0x00,0x00); + break; + case 0x80: // set state + logerror("CD: Command 0x80: set state\n"); + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 0; + if(m_cdda->audio_active() && !m_cdda->audio_paused()) + towns_cd_set_status(0x00,0x03,0x00,0x00); + else + towns_cd_set_status(0x00,0x01,0x00,0x00); + + } + break; + case 0x81: // set state (CDDASET) + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x00,0x00,0x00,0x00); + } + logerror("CD: Command 0x81: set state (CDDASET)\n"); + break; + case 0x84: // Stop CD audio track -- generates no status output? + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 1; + towns_cd_set_status(0x00,0x00,0x00,0x00); + } + m_cdda->pause_audio(1); + logerror("CD: Command 0x84: STOP CD-DA\n"); + break; + case 0x85: // Stop CD audio track (difference from 0x84?) + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 1; + towns_cd_set_status(0x00,0x00,0x00,0x00); + } + m_cdda->pause_audio(1); + logerror("CD: Command 0x85: STOP CD-DA\n"); + break; + case 0x87: // Resume CD-DA playback + if(m_towns_cd.command & 0x20) + { + m_towns_cd.extra_status = 1; + towns_cd_set_status(0x00,0x03,0x00,0x00); + } + m_cdda->pause_audio(0); + logerror("CD: Command 0x87: RESUME CD-DA\n"); + break; + default: + m_towns_cd.extra_status = 0; + towns_cd_set_status(0x10,0x00,0x00,0x00); + logerror("CD: Unknown or unimplemented command %02x\n",m_towns_cd.command); + } + } +} + +READ16_MEMBER(towns_state::towns_cdrom_dma_r) +{ + if(m_towns_cd.buffer_ptr >= 2048) + return 0x00; + return m_towns_cd.buffer[m_towns_cd.buffer_ptr++]; +} + +READ8_MEMBER(towns_state::towns_cdrom_r) +{ + UINT32 addr = 0; + UINT8 ret = 0; + + ret = m_towns_cd.cmd_status[m_towns_cd.cmd_status_ptr]; + + switch(offset) + { + case 0x00: // status + //logerror("CD: status read, returning %02x\n",towns_cd.status); + return m_towns_cd.status; + case 0x01: // command status + if(m_towns_cd.cmd_status_ptr >= 3) + { + m_towns_cd.status &= ~0x02; + // check for more status bytes + if(m_towns_cd.extra_status != 0) + { + switch(m_towns_cd.command & 0x9f) + { + case 0x00: // seek + towns_cd_set_status(0x04,0x00,0x00,0x00); + m_towns_cd.extra_status = 0; + break; + case 0x02: // read + if(m_towns_cd.extra_status == 2) + towns_cd_set_status(0x22,0x00,0x00,0x00); + m_towns_cd.extra_status = 0; + break; + case 0x04: // play cdda + towns_cd_set_status(0x07,0x00,0x00,0x00); + m_towns_cd.extra_status = 0; + break; + case 0x05: // read toc + switch(m_towns_cd.extra_status) + { + case 1: + case 3: + towns_cd_set_status(0x16,0x00,0x00,0x00); + m_towns_cd.extra_status++; + break; + case 2: // st1 = first track number (BCD) + towns_cd_set_status(0x17,0x01,0x00,0x00); + m_towns_cd.extra_status++; + break; + case 4: // st1 = last track number (BCD) + towns_cd_set_status(0x17, + byte_to_bcd(cdrom_get_last_track(m_cdrom->get_cdrom_file())), + 0x00,0x00); + m_towns_cd.extra_status++; + break; + case 5: // st1 = control/adr of track 0xaa? + towns_cd_set_status(0x16, + cdrom_get_adr_control(m_cdrom->get_cdrom_file(),0xaa), + 0xaa,0x00); + m_towns_cd.extra_status++; + break; + case 6: // st1/2/3 = address of track 0xaa? (BCD) + addr = cdrom_get_track_start(m_cdrom->get_cdrom_file(),0xaa); + addr = lba_to_msf(addr); + towns_cd_set_status(0x17, + (addr & 0xff0000) >> 16,(addr & 0x00ff00) >> 8,addr & 0x0000ff); + m_towns_cd.extra_status++; + break; + default: // same as case 5 and 6, but for each individual track + if(m_towns_cd.extra_status & 0x01) + { + towns_cd_set_status(0x16, + ((cdrom_get_adr_control(m_cdrom->get_cdrom_file(),(m_towns_cd.extra_status/2)-3) & 0x0f) << 4) + | ((cdrom_get_adr_control(m_cdrom->get_cdrom_file(),(m_towns_cd.extra_status/2)-3) & 0xf0) >> 4), + (m_towns_cd.extra_status/2)-3,0x00); + m_towns_cd.extra_status++; + } + else + { + addr = cdrom_get_track_start(m_cdrom->get_cdrom_file(),(m_towns_cd.extra_status/2)-4); + addr = lba_to_msf(addr); + towns_cd_set_status(0x17, + (addr & 0xff0000) >> 16,(addr & 0x00ff00) >> 8,addr & 0x0000ff); + if(((m_towns_cd.extra_status/2)-3) >= cdrom_get_last_track(m_cdrom->get_cdrom_file())) + { + m_towns_cd.extra_status = 0; + } + else + m_towns_cd.extra_status++; + } + break; + } + break; + case 0x06: // read CD-DA state + switch(m_towns_cd.extra_status) + { + case 1: // st2 = track number + towns_cd_set_status(0x18, + 0x00,towns_cd_get_track(),0x00); + m_towns_cd.extra_status++; + break; + case 2: // st0/1/2 = MSF from beginning of current track + addr = m_cdda->get_audio_lba(); + addr = lba_to_msf(addr - m_towns_cd.cdda_current); + towns_cd_set_status(0x19, + (addr & 0xff0000) >> 16,(addr & 0x00ff00) >> 8,addr & 0x0000ff); + m_towns_cd.extra_status++; + break; + case 3: // st1/2 = current MSF + addr = m_cdda->get_audio_lba(); + addr = lba_to_msf(addr); // this data is incorrect, but will do until exact meaning is found + towns_cd_set_status(0x19, + 0x00,(addr & 0xff0000) >> 16,(addr & 0x00ff00) >> 8); + m_towns_cd.extra_status++; + break; + case 4: + addr = m_cdda->get_audio_lba(); + addr = lba_to_msf(addr); // this data is incorrect, but will do until exact meaning is found + towns_cd_set_status(0x20, + addr & 0x0000ff,0x00,0x00); + m_towns_cd.extra_status = 0; + break; + } + break; + case 0x84: + towns_cd_set_status(0x11,0x00,0x00,0x00); + m_towns_cd.extra_status = 0; + break; + case 0x85: + towns_cd_set_status(0x12,0x00,0x00,0x00); + m_towns_cd.extra_status = 0; + break; + } + } + } + logerror("CD: reading command status port (%i), returning %02x\n",m_towns_cd.cmd_status_ptr,ret); + m_towns_cd.cmd_status_ptr++; + if(m_towns_cd.cmd_status_ptr > 3) + { + m_towns_cd.cmd_status_ptr = 0; +/* if(m_towns_cd.extra_status != 0) + { + towns_cdrom_set_irq(space.machine(),TOWNS_CD_IRQ_MPU,1); + m_towns_cd.status |= 0x02; + }*/ + } + return ret; + case 0x02: // data transfer (used in software transfers) + if(m_towns_cd.software_tx) + { + return towns_cdrom_read_byte_software(); + } + default: + return 0x00; + } +} + +WRITE8_MEMBER(towns_state::towns_cdrom_w) +{ + int x; + switch(offset) + { + case 0x00: // status + if(data & 0x80) + towns_cdrom_set_irq(TOWNS_CD_IRQ_MPU,0); + if(data & 0x40) + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,0); + if(data & 0x04) + logerror("CD: sub MPU reset\n"); + m_towns_cd.mpu_irq_enable = data & 0x02; + m_towns_cd.dma_irq_enable = data & 0x01; + logerror("CD: status write %02x\n",data); + break; + case 0x01: // command + m_towns_cd.command = data; + towns_cdrom_execute_command(m_cdrom); + logerror("CD: command %02x sent\n",data); + logerror("CD: parameters: %02x %02x %02x %02x %02x %02x %02x %02x\n", + m_towns_cd.parameter[7],m_towns_cd.parameter[6],m_towns_cd.parameter[5], + m_towns_cd.parameter[4],m_towns_cd.parameter[3],m_towns_cd.parameter[2], + m_towns_cd.parameter[1],m_towns_cd.parameter[0]); + break; + case 0x02: // parameter + for(x=7;x>0;x--) + m_towns_cd.parameter[x] = m_towns_cd.parameter[x-1]; + m_towns_cd.parameter[0] = data; + logerror("CD: parameter %02x added\n",data); + break; + case 0x03: + if(data & 0x08) // software transfer + { + m_towns_cd.status &= ~0x10; // no DMA transfer + m_towns_cd.status |= 0x20; + m_towns_cd.software_tx = true; + m_towns_cd.buffer_ptr = 0; + } + if(data & 0x10) + { + m_towns_cd.status |= 0x10; // DMA transfer begin + m_towns_cd.status &= ~0x20; // not a software transfer + m_towns_cd.software_tx = false; + if(m_towns_cd.buffer_ptr < 0) + { + m_towns_cd.buffer_ptr = 0; + m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); + } + } + logerror("CD: transfer mode write %02x\n",data); + break; + default: + logerror("CD: write %02x to port %02x\n",data,offset*2); + } +} + + +/* CMOS RTC + * 0x70: Data port + * 0x80: Register select + */ +READ8_MEMBER(towns_state::towns_rtc_r) +{ + return 0x80 | m_towns_rtc_reg[m_towns_rtc_select]; +} + +WRITE8_MEMBER(towns_state::towns_rtc_w) +{ + m_towns_rtc_data = data; +} + +WRITE8_MEMBER(towns_state::towns_rtc_select_w) +{ + if(data & 0x80) + { + if(data & 0x01) + m_towns_rtc_select = m_towns_rtc_data & 0x0f; + } +} + +void towns_state::rtc_hour() +{ + m_towns_rtc_reg[4]++; + if(m_towns_rtc_reg[4] > 4 && m_towns_rtc_reg[5] == 2) + { + m_towns_rtc_reg[4] = 0; + m_towns_rtc_reg[5] = 0; + } + else if(m_towns_rtc_reg[4] > 9) + { + m_towns_rtc_reg[4] = 0; + m_towns_rtc_reg[5]++; + } +} + +void towns_state::rtc_minute() +{ + m_towns_rtc_reg[2]++; + if(m_towns_rtc_reg[2] > 9) + { + m_towns_rtc_reg[2] = 0; + m_towns_rtc_reg[3]++; + if(m_towns_rtc_reg[3] > 5) + { + m_towns_rtc_reg[3] = 0; + rtc_hour(); + } + } +} + +void towns_state::rtc_second() +{ + // increase RTC time by one second + m_towns_rtc_reg[0]++; + if(m_towns_rtc_reg[0] > 9) + { + m_towns_rtc_reg[0] = 0; + m_towns_rtc_reg[1]++; + if(m_towns_rtc_reg[1] > 5) + { + m_towns_rtc_reg[1] = 0; + rtc_minute(); + } + } +} + +// SCSI controller - I/O ports 0xc30 and 0xc32 +READ16_MEMBER(towns_state::towns_scsi_dma_r) +{ + return m_scsi->fmscsi_data_r(); +} + +WRITE16_MEMBER(towns_state::towns_scsi_dma_w) +{ + m_scsi->fmscsi_data_w(data & 0xff); +} + +WRITE_LINE_MEMBER(towns_state::towns_scsi_irq) +{ + m_pic_slave->ir0_w(state); + if(IRQ_LOG) + logerror("PIC: IRQ8 (SCSI) set to %i\n",state); +} + +WRITE_LINE_MEMBER(towns_state::towns_scsi_drq) +{ + m_dma_1->dmarq(state, 1); // SCSI HDs use channel 1 +} + + +// Volume ports - I/O ports 0x4e0-0x4e3 +// 0x4e0 = input volume level +// 0x4e1 = input channel select +// 4 = Line in, left channel +// 5 = Line in, right channel +// 0x4e2 = output volume level +// 0x4e3 = output channel select +// 2 = MIC +// 3 = MODEM +// 4 = CD-DA left channel +// 5 = CD-DA right channel +READ8_MEMBER(towns_state::towns_volume_r) +{ + switch(offset) + { + case 2: + return(m_towns_volume[m_towns_volume_select]); + case 3: + return m_towns_volume_select; + default: + return 0; + } +} + +WRITE8_MEMBER(towns_state::towns_volume_w) +{ + switch(offset) + { + case 2: + m_towns_volume[m_towns_volume_select] = data; + if(m_towns_volume_select == 4) + m_cdda->set_channel_volume(0,100.0f * (data / 64.0f)); + if(m_towns_volume_select == 5) + m_cdda->set_channel_volume(1,100.0f * (data / 64.0f)); + break; + case 3: // select channel + if(data < 8) + m_towns_volume_select = data; + break; + default: + logerror("SND: Volume port %i set to %02x\n",offset,data); + } +} + +// some unknown ports... +READ8_MEMBER(towns_state::towns_41ff_r) +{ + logerror("I/O port 0x41ff read\n"); + return 0x01; +} + +// YM3438 interrupt (IRQ 13) +WRITE_LINE_MEMBER(towns_state::towns_fm_irq) +{ + if(state) + { + m_towns_fm_irq_flag = 1; + m_pic_slave->ir5_w(1); + if(IRQ_LOG) logerror("PIC: IRQ13 (FM) set high\n"); + } + else + { + m_towns_fm_irq_flag = 0; + if(m_towns_pcm_irq_flag == 0) + { + m_pic_slave->ir5_w(0); + if(IRQ_LOG) logerror("PIC: IRQ13 (FM) set low\n"); + } + } +} + +// PCM interrupt (IRQ 13) +RF5C68_SAMPLE_END_CB_MEMBER(towns_state::towns_pcm_irq) +{ + if (m_towns_pcm_channel_mask & (1 << channel)) + { + m_towns_pcm_irq_flag = 1; + m_towns_pcm_channel_flag |= (1 << channel); + m_pic_slave->ir5_w(1); + if(IRQ_LOG) logerror("PIC: IRQ13 (PCM) set high (channel %i)\n",channel); + } +} + +WRITE_LINE_MEMBER(towns_state::towns_pit_out0_changed) +{ + m_pit_out0 = state; + + if(m_towns_timer_mask & 0x01) + { + m_timer0 = state; + if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer ch0) set to %i\n",state); + } + else + m_timer0 = 0; + + m_pic_master->ir0_w(m_timer0 || m_timer1); +} + +WRITE_LINE_MEMBER(towns_state::towns_pit_out1_changed) +{ + m_pit_out1 = state; + + if(m_towns_timer_mask & 0x02) + { + m_timer1 = state; + if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer ch1) set to %i\n",state); + } + else + m_timer1 = 0; + + m_pic_master->ir0_w(m_timer0 || m_timer1); +} + +WRITE_LINE_MEMBER( towns_state::pit_out2_changed ) +{ + m_pit_out2 = state ? 1 : 0; + m_speaker->level_w(speaker_get_spk()); +} + +static ADDRESS_MAP_START(towns_mem, AS_PROGRAM, 32, towns_state) + // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns) + // may not be (and probably is not) correct + AM_RANGE(0x00000000, 0x000bffff) AM_RAM + AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffffffff) + AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffffffff) + AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") + AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM + AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffffffff) + AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM + AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffffffff) AM_SHARE("nvram") // CMOS? RAM + AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) + AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) + AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") +// AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM + AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM + AM_RANGE(0x81000000, 0x8101ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM + // 0xc0000000 - 0xc0ffffff // IC Memory Card (static, first 16MB only) + // 0xc1000000 - 0xc1ffffff // IC Memory Card (banked, can show any of 4 banks), JEIDA v4 only (UX and later) + AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000) // OS ROM + AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM + AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000) // FONT ROM + AM_RANGE(0xc2140000, 0xc2141fff) AM_READWRITE8(towns_cmos_r,towns_cmos_w,0xffffffff) // CMOS (mirror?) + AM_RANGE(0xc2180000, 0xc21fffff) AM_ROM AM_REGION("user",0x080000) // F20 ROM + AM_RANGE(0xc2200000, 0xc220ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff) // WAVE RAM + AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(marty_mem, AS_PROGRAM, 16, towns_state) + AM_RANGE(0x00000000, 0x000bffff) AM_RAM + AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffff) + AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffff) + AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") + AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM + AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffff) + AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM + AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffff) AM_SHARE("nvram16") // CMOS? RAM + AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) + AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) + AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") +// AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - the Marty has 6MB RAM (not upgradable) + AM_RANGE(0x00600000, 0x0067ffff) AM_ROM AM_REGION("user",0x000000) // OS + AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000) // EX ROM + AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffff) AM_MIRROR(0x180000) // VRAM + AM_RANGE(0x00b00000, 0x00b7ffff) AM_ROM AM_REGION("user",0x180000) // FONT + AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffff) // Sprite RAM + AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card (is this usable on the Marty?) + AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM + AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000) // FONT + AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffff) // WAVE RAM + AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM + AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ux_mem, AS_PROGRAM, 16, towns_state) + AM_RANGE(0x00000000, 0x000bffff) AM_RAM + AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffff) + AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffff) + AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") + AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM + AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffff) + AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM + AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffff) AM_SHARE("nvram16") // CMOS? RAM + AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) + AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) + AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") +// AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000) // EX ROM + AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffff) AM_MIRROR(0x180000) // VRAM + AM_RANGE(0x00b00000, 0x00b7ffff) AM_ROM AM_REGION("user",0x180000) // FONT + AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffff) // Sprite RAM + AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card + AM_RANGE(0x00e00000, 0x00e7ffff) AM_ROM AM_REGION("user",0x000000) // OS + AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM + AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000) // FONT + AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffff) // WAVE RAM + AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM + AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( towns_io , AS_IO, 32, towns_state) + // I/O ports derived from FM Towns/Bochs, these are specific to the FM Towns + // System ports + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff00ff) + AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff00ff) + AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffffffff) + AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8("pit", pit8253_device, read, write, 0x00ff00ff) + AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8("pit2", pit8253_device, read, write, 0x00ff00ff) + AM_RANGE(0x0060,0x0063) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x000000ff) + AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffffffff) + AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff) + // 0x0070/0x0080 - CMOS RTC + AM_RANGE(0x0070,0x0073) AM_READWRITE8(towns_rtc_r,towns_rtc_w,0x000000ff) + AM_RANGE(0x0080,0x0083) AM_WRITE8(towns_rtc_select_w,0x000000ff) + // DMA controllers (uPD71071) + AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff) + AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffffffff) + // Floppy controller + AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffffffff) + // CRTC / Video + AM_RANGE(0x0400,0x0403) AM_READ8(towns_video_unknown_r, 0x000000ff) // R/O (0x400) + AM_RANGE(0x0404,0x0407) AM_READWRITE8(towns_video_404_r, towns_video_404_w, 0x000000ff) // R/W (0x404) + AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffffffff) + // System port + AM_RANGE(0x0480,0x0483) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x000000ff) // R/W (0x480) + // CD-ROM + AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff00ff) + // Joystick / Mouse ports + AM_RANGE(0x04d0,0x04d3) AM_READ8(towns_padport_r, 0x00ff00ff) + AM_RANGE(0x04d4,0x04d7) AM_WRITE8(towns_pad_mask_w, 0x00ff0000) + // Sound (YM3438 [FM], RF5c68 [PCM]) + AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm", ym3438_device, read, write, 0x00ff00ff) + AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffffffff) // R/W -- volume ports + AM_RANGE(0x04e8,0x04ef) AM_READWRITE8(towns_sound_ctrl_r,towns_sound_ctrl_w,0xffffffff) + AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm", rf5c68_device, rf5c68_w, 0xffffffff) + // CRTC / Video + AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffffffff) + // System ports + AM_RANGE(0x05e8,0x05ef) AM_READWRITE8(towns_sys5e8_r, towns_sys5e8_w, 0x00ff00ff) + // Keyboard (8042 MCU) + AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff) + // SCSI controller + AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("fmscsi",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff00ff) + // CMOS + AM_RANGE(0x3000,0x4fff) AM_READWRITE8(towns_cmos_r, towns_cmos_w,0x00ff00ff) + // Something (MS-DOS wants this 0x41ff to be 1) + //AM_RANGE(0x41fc,0x41ff) AM_READ8(towns_41ff_r,0xff000000) + // CRTC / Video (again) + AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff) + AM_RANGE(0xff80,0xffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffffffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( towns16_io , AS_IO, 16, towns_state) // for the 386SX based systems + // System ports + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffff) + AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8("pit", pit8253_device, read, write, 0x00ff) + AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8("pit2", pit8253_device, read, write, 0x00ff) + AM_RANGE(0x0060,0x0061) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x00ff) + AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffff) + AM_RANGE(0x006c,0x006d) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x00ff) + // 0x0070/0x0080 - CMOS RTC + AM_RANGE(0x0070,0x0071) AM_READWRITE8(towns_rtc_r,towns_rtc_w,0x00ff) + AM_RANGE(0x0080,0x0081) AM_WRITE8(towns_rtc_select_w,0x00ff) + // DMA controllers (uPD71071) + AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffff) + AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffff) + // Floppy controller + AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffff) + // CRTC / Video + AM_RANGE(0x0400,0x0401) AM_READ8(towns_video_unknown_r, 0x00ff) // R/O (0x400) + AM_RANGE(0x0404,0x0407) AM_READWRITE8(towns_video_404_r, towns_video_404_w, 0xffff) // R/W (0x404) + AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffff) + // System port + AM_RANGE(0x0480,0x0481) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x00ff) // R/W (0x480) + // CD-ROM + AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff) + // Joystick / Mouse ports + AM_RANGE(0x04d0,0x04d3) AM_READ8(towns_padport_r, 0x00ff) + AM_RANGE(0x04d6,0x04d7) AM_WRITE8(towns_pad_mask_w, 0x00ff) + // Sound (YM3438 [FM], RF5c68 [PCM]) + AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm", ym3438_device, read, write, 0x00ff) + AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffff) // R/W -- volume ports + AM_RANGE(0x04e8,0x04ef) AM_READWRITE8(towns_sound_ctrl_r,towns_sound_ctrl_w,0xffff) + AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm", rf5c68_device, rf5c68_w, 0xffff) + // CRTC / Video + AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffff) + // System ports + AM_RANGE(0x05e8,0x05ef) AM_READWRITE8(towns_sys5e8_r, towns_sys5e8_w, 0x00ff) + // Keyboard (8042 MCU) + AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff) + // SCSI controller + AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("fmscsi",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff) + // CMOS + AM_RANGE(0x3000,0x4fff) AM_READWRITE8(towns_cmos_r, towns_cmos_w,0x00ff) + // Something (MS-DOS wants this 0x41ff to be 1) + //AM_RANGE(0x41fc,0x41ff) AM_READ8(towns_41ff_r,0xff000000) + // CRTC / Video (again) + AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffff) + AM_RANGE(0xff80,0xffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( towns ) + PORT_START("ctrltype") + PORT_CONFNAME(0x0f, 0x01, "Joystick port 1") + PORT_CONFSETTING(0x00, "Nothing") + PORT_CONFSETTING(0x01, "Standard 2-button joystick") + PORT_CONFSETTING(0x02, "Mouse") + PORT_CONFSETTING(0x04, "6-button joystick") + PORT_CONFNAME(0xf0, 0x20, "Joystick port 2") + PORT_CONFSETTING(0x00, "Nothing") + PORT_CONFSETTING(0x10, "Standard 2-button joystick") + PORT_CONFSETTING(0x20, "Mouse") + PORT_CONFSETTING(0x40, "6-button joystick") + +// Keyboard + PORT_START( "key1" ) // scancodes 0x00-0x1f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + + PORT_START( "key2" ) // scancodes 0x20-0x3f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("` _") + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) + + PORT_START("key3") // scancodes 0x40-0x5f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS(?)") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 000") + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL(?)/EL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAP") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE3\x81\xB2\xE3\x82\x89\xE3\x81\x8C\xE3\x81\xAA (Hiragana)") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x57") + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x58") + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana???") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE3\x82\xAB\xE3\x82\xBF\xE3\x82\xAB\xE3\x83\x8A (Katakana)") PORT_CODE(KEYCODE_RWIN) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF12") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) + + PORT_START("key4") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF11") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x6b") + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x6c") + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x6d") + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x6e") + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x70") + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x71") + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x72") + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x73") + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF13") + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF14") + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF15") + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF16") + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF17") + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF18") + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF19") + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF20") + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("COPY") + + PORT_START("joy1") + PORT_BIT(0x00000001,IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000002,IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000010,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000020,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + + PORT_START("joy1_ex") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH, IPT_START) PORT_NAME("1P Run") PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("1P Select") PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + + PORT_START("joy2") + PORT_BIT(0x00000001,IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000002,IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000010,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000020,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + + PORT_START("joy2_ex") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH, IPT_START) PORT_NAME("2P Run") PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("2P Select") PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + + PORT_START("6b_joy1") + PORT_BIT(0x00000001,IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000002,IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000010,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000020,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + + PORT_START("6b_joy1_ex") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH, IPT_START) PORT_NAME("1P Run") PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("1P Select") PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) + + PORT_START("6b_joy2") + PORT_BIT(0x00000001,IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000002,IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000010,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000020,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + + PORT_START("6b_joy2_ex") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH, IPT_START) PORT_NAME("2P Run") PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("2P Select") PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) + + PORT_START("mouse1") // buttons + PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) + PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) + + PORT_START("mouse2") // X-axis + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START("mouse3") // Y-axis + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + +INPUT_PORTS_END + +static INPUT_PORTS_START( marty ) + PORT_INCLUDE(towns) + // Consoles don't have keyboards... + PORT_MODIFY("key1") + PORT_BIT(0xffffffff,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_MODIFY("key2") + PORT_BIT(0xffffffff,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_MODIFY("key3") + PORT_BIT(0xffffffff,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_MODIFY("key4") + PORT_BIT(0xffffffff,IP_ACTIVE_LOW,IPT_UNUSED) +INPUT_PORTS_END + +void towns_state::driver_start() +{ + m_towns_vram = auto_alloc_array(machine(),UINT32,0x20000); + m_towns_gfxvram = auto_alloc_array(machine(),UINT8,0x80000); + m_towns_txtvram = auto_alloc_array(machine(),UINT8,0x20000); + memset(m_towns_txtvram, 0, sizeof(UINT8)*0x20000); + //towns_sprram = auto_alloc_array(machine(),UINT8,0x20000); + m_towns_serial_rom = auto_alloc_array(machine(),UINT8,256/8); + init_serial_rom(); + init_rtc(); + m_towns_rtc_timer = timer_alloc(TIMER_RTC); + m_towns_kb_timer = timer_alloc(TIMER_KEYBOARD); + m_towns_mouse_timer = timer_alloc(TIMER_MOUSE); + m_towns_wait_timer = timer_alloc(TIMER_WAIT); + m_towns_freerun_counter = timer_alloc(TIMER_FREERUN); + m_towns_intervaltimer2 = timer_alloc(TIMER_INTERVAL2); + m_towns_status_timer = timer_alloc(TIMER_CDSTATUS); + m_towns_cdda_timer = timer_alloc(TIMER_CDDA); + + // CD-ROM init + m_towns_cd.read_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(towns_state::towns_cdrom_read_byte),this), (void*)machine().device("dma_1")); + + m_maincpu->space(AS_PROGRAM).install_ram(0x100000,m_ram->size()-1,0xffffffff,0,NULL); +} + +void marty_state::driver_start() +{ + towns_state::driver_start(); + if(m_towns_machine_id == 0x0101) // default if no serial ROM present + m_towns_machine_id = 0x034a; +} + +void towns_state::machine_start() +{ + m_flop0->get_device()->set_rpm(360); + m_flop1->get_device()->set_rpm(360); +} + +void towns_state::machine_reset() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + m_messram = m_ram; + m_cdrom = machine().device("cdrom"); + m_cdda = machine().device("cdda"); + m_scsi = machine().device("fmscsi"); + m_ftimer = 0x00; + m_freerun_timer = 0x00; + m_nmi_mask = 0x00; + m_compat_mode = 0x00; + m_towns_ankcg_enable = 0x00; + m_towns_mainmem_enable = 0x00; + m_towns_system_port = 0x00; + m_towns_ram_enable = 0x00; + towns_update_video_banks(program); + m_towns_kb_status = 0x18; + m_towns_kb_irq1_enable = 0; + m_towns_pad_mask = 0x7f; + m_towns_mouse_output = MOUSE_START; + m_towns_cd.status = 0x01; // CDROM controller ready + m_towns_cd.buffer_ptr = -1; + m_towns_volume_select = 0; + m_intervaltimer2_period = 0; + m_intervaltimer2_timeout_flag = 0; + m_intervaltimer2_timeout_flag2 = 0; + m_intervaltimer2_irqmask = 1; // masked + m_towns_rtc_timer->adjust(attotime::zero,0,attotime::from_hz(1)); + m_towns_kb_timer->adjust(attotime::zero,0,attotime::from_msec(10)); + m_towns_freerun_counter->adjust(attotime::zero,0,attotime::from_usec(1)); +} + +READ8_MEMBER(towns_state::get_slave_ack) +{ + if (offset==7) { // IRQ = 7 + return m_pic_slave->acknowledge(); + } + return 0x00; +} + +FLOPPY_FORMATS_MEMBER( towns_state::floppy_formats ) + FLOPPY_FMTOWNS_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( towns_floppies ) + SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) +SLOT_INTERFACE_END + +static const gfx_layout fnt_chars_16x16 = +{ + 16,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15 }, + { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, + 16*16 +}; + +static const gfx_layout text_chars = +{ + 8,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 ,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 +}; + +static GFXDECODE_START( towns ) + GFXDECODE_ENTRY( "user", 0x180000 + 0x3d800, text_chars, 0, 16 ) + GFXDECODE_ENTRY( "user", 0x180000, fnt_chars_16x16, 0, 16 ) +GFXDECODE_END + +static MACHINE_CONFIG_FRAGMENT( towns_base ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I386, 16000000) + MCFG_CPU_PROGRAM_MAP(towns_mem) + MCFG_CPU_IO_MAP(towns_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + //MCFG_MACHINE_RESET_OVERRIDE(towns_state,towns) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(768,512) + MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 512-1) + MCFG_SCREEN_UPDATE_DRIVER(towns_state, screen_update) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", towns) + MCFG_PALETTE_ADD("palette", 256) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("fm", YM3438, 16000000 / 2) // actual clock speed unknown + MCFG_YM2612_IRQ_HANDLER(WRITELINE(towns_state, towns_fm_irq)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_RF5C68_ADD("pcm", 16000000 / 2) // actual clock speed unknown + MCFG_RF5C68_SAMPLE_END_CB(towns_state, towns_pcm_irq) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50) + MCFG_SOUND_ADD("cdda",CDDA,0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND,0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(307200) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(towns_state, towns_pit_out0_changed)) + MCFG_PIT8253_CLK1(307200) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(towns_state, towns_pit_out1_changed)) + MCFG_PIT8253_CLK2(307200) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(towns_state, pit_out2_changed)) + + MCFG_DEVICE_ADD("pit2", PIT8253, 0) + MCFG_PIT8253_CLK0(307200) // reserved + MCFG_PIT8253_CLK1(307200) // RS-232 + MCFG_PIT8253_CLK2(307200) // reserved + + MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(towns_state,get_slave_ack)) + + MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL) + + MCFG_MB8877_ADD("fdc",XTAL_8MHz/4) // clock unknown + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(towns_state,mb8877a_irq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(towns_state,mb8877a_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", towns_floppies, "35hd", towns_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", towns_floppies, "35hd", towns_state::floppy_formats) + + MCFG_CDROM_ADD("cdrom") + MCFG_CDROM_INTERFACE("fmt_cdrom") + MCFG_SOFTWARE_LIST_ADD("cd_list","fmtowns_cd") + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4) + + MCFG_FMSCSI_ADD("fmscsi") + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_FMSCSI_IRQ_HANDLER(WRITELINE(towns_state, towns_scsi_irq)) + MCFG_FMSCSI_DRQ_HANDLER(WRITELINE(towns_state, towns_scsi_drq)) + + MCFG_DEVICE_ADD("dma_1", UPD71071, 0) + MCFG_UPD71071_CPU("maincpu") + MCFG_UPD71071_CLOCK(4000000) + MCFG_UPD71071_DMA_READ_0_CB(READ16(towns_state, towns_fdc_dma_r)) + MCFG_UPD71071_DMA_READ_1_CB(READ16(towns_state, towns_scsi_dma_r)) + MCFG_UPD71071_DMA_READ_3_CB(READ16(towns_state, towns_cdrom_dma_r)) + MCFG_UPD71071_DMA_WRITE_0_CB(WRITE16(towns_state, towns_fdc_dma_w)) + MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w)) + MCFG_DEVICE_ADD("dma_2", UPD71071, 0) + MCFG_UPD71071_CPU("maincpu") + MCFG_UPD71071_CLOCK(4000000) + MCFG_UPD71071_DMA_READ_0_CB(READ16(towns_state, towns_fdc_dma_r)) + MCFG_UPD71071_DMA_READ_1_CB(READ16(towns_state, towns_scsi_dma_r)) + MCFG_UPD71071_DMA_READ_3_CB(READ16(towns_state, towns_cdrom_dma_r)) + MCFG_UPD71071_DMA_WRITE_0_CB(WRITE16(towns_state, towns_fdc_dma_w)) + MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w)) + + //MCFG_VIDEO_START_OVERRIDE(towns_state,towns) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("6M") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,16M,32M,64M,96M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( towns, towns_state ) + MCFG_FRAGMENT_ADD(towns_base) + MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( townsux, towns16_state ) + MCFG_FRAGMENT_ADD(towns_base) + + MCFG_CPU_REPLACE("maincpu",I386SX, 16000000) + MCFG_CPU_PROGRAM_MAP(ux_mem) + MCFG_CPU_IO_MAP(towns16_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("10M") + + MCFG_NVRAM_ADD_0FILL("nvram16") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( townssj, towns ) + + MCFG_CPU_REPLACE("maincpu",PENTIUM, 66000000) + MCFG_CPU_PROGRAM_MAP(towns_mem) + MCFG_CPU_IO_MAP(towns_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8M") + MCFG_RAM_EXTRA_OPTIONS("40M,72M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( townshr, towns ) + MCFG_CPU_REPLACE("maincpu",I486, 20000000) + MCFG_CPU_PROGRAM_MAP(towns_mem) + MCFG_CPU_IO_MAP(towns_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("12M,20M,28M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( townsftv, towns ) + MCFG_CPU_REPLACE("maincpu",I486, 33000000) + MCFG_CPU_PROGRAM_MAP(towns_mem) + MCFG_CPU_IO_MAP(towns_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("6M") + MCFG_RAM_EXTRA_OPTIONS("32M,68M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( marty, marty_state ) + MCFG_FRAGMENT_ADD(towns_base) + + MCFG_CPU_REPLACE("maincpu",I386SX, 16000000) + MCFG_CPU_PROGRAM_MAP(marty_mem) + MCFG_CPU_IO_MAP(towns16_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("6M") + + MCFG_NVRAM_ADD_0FILL("nvram16") +MACHINE_CONFIG_END + +/* ROM definitions */ +/* It is unknown exactly what model these ROM were dumped from, but it is certainly a newer model, as it won't + * boot without the freerun timer, which was added in the FM-Towns II HG, HR, UG and later. */ +ROM_START( fmtowns ) + ROM_REGION32_LE( 0x280000, "user", 0) + ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) ) + ROM_LOAD("fmt_f20.rom", 0x080000, 0x080000, CRC(9f55a20c) SHA1(1920711cb66340bb741a760de187de2f76040b8c) ) + ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) + ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) + ROM_LOAD("fmt_sys.rom", 0x200000, 0x040000, CRC(afe4ebcf) SHA1(4cd51de4fca9bd7a3d91d09ad636fa6b47a41df5) ) +ROM_END + +/* likely an older set, as it runs without needing the freerun timer. Font ROM appears to be corrupt, though. */ +ROM_START( fmtownsa ) + ROM_REGION32_LE( 0x280000, "user", 0) + ROM_LOAD("fmt_dos_a.rom", 0x000000, 0x080000, CRC(22270e9f) SHA1(a7e97b25ff72b14121146137db8b45d6c66af2ae) ) + ROM_LOAD("fmt_f20_a.rom", 0x080000, 0x080000, CRC(75660aac) SHA1(6a521e1d2a632c26e53b83d2cc4b0edecfc1e68c) ) + ROM_LOAD("fmt_dic_a.rom", 0x100000, 0x080000, CRC(74b1d152) SHA1(f63602a1bd67c2ad63122bfb4ffdaf483510f6a8) ) + ROM_LOAD("fmt_fnt_a.rom", 0x180000, 0x040000, CRC(0108a090) SHA1(1b5dd9d342a96b8e64070a22c3a158ca419894e1) ) + ROM_LOAD("fmt_sys_a.rom", 0x200000, 0x040000, CRC(92f3fa67) SHA1(be21404098b23465d24c4201a81c96ac01aff7ab) ) +ROM_END + +/* 16MHz 80386SX, 2MB RAM expandable up to 10MB (due to the limited 24-bit address space of the CPU), dumped from a UX10 */ +ROM_START( fmtownsux ) + ROM_REGION32_LE( 0x480000, "user", 0) + ROM_LOAD("fmt_dos_a.rom", 0x000000, 0x080000, CRC(22270e9f) SHA1(a7e97b25ff72b14121146137db8b45d6c66af2ae) ) + // no F20 ROM + ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) + ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) + ROM_LOAD("fmt_sys_a.rom", 0x200000, 0x040000, CRC(92f3fa67) SHA1(be21404098b23465d24c4201a81c96ac01aff7ab) ) + ROM_REGION( 0x20, "serial", 0) + ROM_LOAD("mytownsux.rom", 0x00, 0x20, CRC(5cc7e6bc) SHA1(e245f8086df57ce6e48853f0e13525f738e5c4d8) ) +ROM_END + +/* 20MHz 80486SX, 4MB RAM expandable up to 28MB, dumped from an HR20 */ +ROM_START( fmtownshr ) + ROM_REGION32_LE( 0x280000, "user", 0) + ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) ) + // F20 ROM space appears to be all 0xFF on an HR, so it is assumed to be not present +// ROM_LOAD("fmt_f20.rom", 0x080000, 0x080000, CRC(9f55a20c) SHA1(1920711cb66340bb741a760de187de2f76040b8c) ) + ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) + ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) + ROM_LOAD("fmthr_sys.rom",0x200000, 0x040000, CRC(8aeff982) SHA1(a4ebf2e247a8e15a5f1ff003b657bbe3a67203d8) ) + ROM_REGION( 0x20, "serial", 0) + ROM_LOAD("mytownshr.rom", 0x00, 0x20, CRC(c52f0e89) SHA1(634d3965606b18a99507f0a520553005661c41ff) ) +ROM_END + +/* 66MHz 80486DX2, 8MB RAM expandable up to 72MB, dumped from an SJ26 */ +ROM_START( fmtownssj ) + ROM_REGION32_LE( 0x280000, "user", 0) + // Assumed for now, only the serial ROM has been dumped successfully so far + ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) BAD_DUMP ) + ROM_LOAD("fmt_f20.rom", 0x080000, 0x080000, CRC(9f55a20c) SHA1(1920711cb66340bb741a760de187de2f76040b8c) BAD_DUMP ) + ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) BAD_DUMP ) + ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) BAD_DUMP ) + ROM_LOAD("fmt_sys.rom", 0x200000, 0x040000, CRC(afe4ebcf) SHA1(4cd51de4fca9bd7a3d91d09ad636fa6b47a41df5) BAD_DUMP ) + ROM_REGION( 0x20, "serial", 0) + ROM_LOAD("mytownssj.rom", 0x00, 0x20, CRC(d0ed8936) SHA1(bf9eeef25e9a1dc4a9ce1c70f4155ac973cae3f9) ) +ROM_END + +/* 66MHz 80486DX2, dumped from an FM-Towns II MX */ +ROM_START( fmtownsmx ) + ROM_REGION32_LE( 0x280000, "user", 0) + ROM_LOAD("fmtownsiimxbios.m79", 0x000000, 0x080000, CRC(f3fc636e) SHA1(a35a11ab56b1f11e3f69d70b61648ab83699a2df) ) + ROM_CONTINUE(0x180000,0x40000) + ROM_CONTINUE(0x200000,0x40000) + ROM_CONTINUE(0x080000,0x80000) + ROM_CONTINUE(0x100000,0x80000) + ROM_REGION( 0x20, "serial", 0) + ROM_LOAD("mytownsmx.rom", 0x00, 0x20, CRC(16e78766) SHA1(38e8810bee9ee6b54c3999d27f499b89e4a4c33f) ) +ROM_END + +/* 33MHz 80486SX, 6MB RAM expandable up to 68MB, dumped from an FM Towns II Fresh TV */ +ROM_START( fmtownsftv ) + ROM_REGION32_LE( 0x280000, "user", 0) + ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) ) + ROM_LOAD("fmt_f20.rom", 0x080000, 0x080000, CRC(9f55a20c) SHA1(1920711cb66340bb741a760de187de2f76040b8c) ) + ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) + ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) + ROM_LOAD("fmt_sys.rom", 0x200000, 0x040000, CRC(afe4ebcf) SHA1(4cd51de4fca9bd7a3d91d09ad636fa6b47a41df5) ) + ROM_REGION( 0x20, "serial", 0) + ROM_LOAD("mytownsftv.rom", 0x00, 0x20, CRC(a961aae7) SHA1(bba02edafdfaa6fb1b8122f623259a87a555c307) ) +ROM_END + +ROM_START( fmtmarty ) + ROM_REGION32_LE( 0x480000, "user", 0) + ROM_LOAD("mrom.m36", 0x000000, 0x080000, CRC(9c0c060c) SHA1(5721c5f9657c570638352fa9acac57fa8d0b94bd) ) + ROM_CONTINUE(0x280000,0x180000) + ROM_LOAD("mrom.m37", 0x400000, 0x080000, CRC(fb66bb56) SHA1(e273b5fa618373bdf7536495cd53c8aac1cce9a5) ) + ROM_CONTINUE(0x80000,0x100000) + ROM_CONTINUE(0x180000,0x40000) + ROM_CONTINUE(0x200000,0x40000) +ROM_END + +ROM_START( fmtmarty2 ) + ROM_REGION32_LE( 0x480000, "user", 0) + ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(2bc2af96) SHA1(99cd51c5677288ad8ef711b4ac25d981fd586884) ) + ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) + ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) + ROM_LOAD("fmt_sys.rom", 0x200000, 0x040000, CRC(937311f6) SHA1(7b1c97fa778986134104a6964c8fe13e3654f52e) ) + ROM_LOAD("mar_ex0.rom", 0x280000, 0x080000, CRC(f67540f6) SHA1(1611fc4683dab72e56a5d0ee0f757e5878900b31) ) + ROM_LOAD("mar_ex1.rom", 0x300000, 0x080000, CRC(99938a4b) SHA1(167d8ae47312cdaa30b8597144f60f54ce9f74d3) ) + ROM_LOAD("mar_ex2.rom", 0x380000, 0x080000, CRC(c6783422) SHA1(b2ed2ba42b8132d139480484fe116ba7774e1604) ) + ROM_LOAD("mar_ex3.rom", 0x400000, 0x080000, CRC(4aa43e16) SHA1(19b669aa6488bdaf8569e89b1b1067e51246a768) ) + ROM_REGION( 0x20, "serial", 0) + ROM_LOAD("mytownsm2.rom", 0x00, 0x20, CRC(44f2f076) SHA1(e4d3be54e66931c947993ded9ddbae716ad51ca5) ) +ROM_END + +ROM_START( carmarty ) + ROM_REGION32_LE( 0x480000, "user", 0) + ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(2bc2af96) SHA1(99cd51c5677288ad8ef711b4ac25d981fd586884) ) + ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) + ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) + ROM_LOAD("cmar_sys.rom", 0x200000, 0x040000, CRC(e1ff7ce1) SHA1(e6c359177e4e9fb5bbb7989c6bbf6e95c091fd88) ) + ROM_LOAD("cmar_ex0.rom", 0x280000, 0x080000, CRC(e248bfbd) SHA1(0ce89952a7901dd4d256939a6bc8597f87e51ae7) ) + ROM_LOAD("cmar_ex1.rom", 0x300000, 0x080000, CRC(ab2e94f0) SHA1(4b3378c772302622f8e1139ed0caa7da1ab3c780) ) + ROM_LOAD("cmar_ex2.rom", 0x380000, 0x080000, CRC(ce150ec7) SHA1(1cd8c39f3b940e03f9fe999ebcf7fd693f843d04) ) + ROM_LOAD("cmar_ex3.rom", 0x400000, 0x080000, CRC(582fc7fc) SHA1(a77d8014e41e9ff0f321e156c0fe1a45a0c5e58e) ) + ROM_REGION( 0x20, "serial", 0) + ROM_LOAD("mytownscm.rom", 0x00, 0x20, CRC(bc58eba6) SHA1(483087d823c3952cc29bd827e5ef36d12c57ad49) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, fmtowns, 0, 0, towns, towns, driver_device, 0, "Fujitsu", "FM-Towns", MACHINE_NOT_WORKING) +COMP( 1989, fmtownsa, fmtowns, 0, towns, towns, driver_device, 0, "Fujitsu", "FM-Towns (alternate)", MACHINE_NOT_WORKING) +COMP( 1991, fmtownsux,fmtowns, 0, townsux, towns, driver_device, 0, "Fujitsu", "FM-Towns II UX", MACHINE_NOT_WORKING) +COMP( 1992, fmtownshr,fmtowns, 0, townshr, towns, driver_device, 0, "Fujitsu", "FM-Towns II HR", MACHINE_NOT_WORKING) +COMP( 1993, fmtownsmx,fmtowns, 0, townshr, towns, driver_device, 0, "Fujitsu", "FM-Towns II MX", MACHINE_NOT_WORKING) +COMP( 1994, fmtownsftv,fmtowns, 0, townsftv, towns, driver_device, 0, "Fujitsu", "FM-Towns II FreshTV", MACHINE_NOT_WORKING) +COMP( 19??, fmtownssj,fmtowns, 0, townssj, towns, driver_device, 0, "Fujitsu", "FM-Towns II SJ", MACHINE_NOT_WORKING) +CONS( 1993, fmtmarty, 0, 0, marty, marty, driver_device, 0, "Fujitsu", "FM-Towns Marty", MACHINE_NOT_WORKING) +CONS( 1993, fmtmarty2,fmtmarty, 0, marty, marty, driver_device, 0, "Fujitsu", "FM-Towns Marty 2", MACHINE_NOT_WORKING) +CONS( 1994, carmarty, fmtmarty, 0, marty, marty, driver_device, 0, "Fujitsu", "FM-Towns Car Marty", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/force68k.c b/src/mame/drivers/force68k.c new file mode 100644 index 00000000000..d1cf7a46833 --- /dev/null +++ b/src/mame/drivers/force68k.c @@ -0,0 +1,606 @@ +// license:BSD-3-Clause +// copyright-holders:Joakim Larsson Edstrom +/*************************************************************************** + * + * Force SYS68K CPU-1/CPU-6 VME SBC drivers, initially based on the 68ksbc.c + * + * 13/06/2015 + * + * The info found on the links below is for a later revisions of the board I have + * but it is somewhat compatible so I got the system ROM up and running in terminal. + * My CPU-1 board has proms from 1983 and the PCB has no rev markings so probably + * the original or a very early design. The board real estate differs from the later + * CPU-1:s I found pictures of but has the same main chips and functions. + * + * http://bitsavers.trailing-edge.com/pdf/forceComputers/1988_Force_VMEbus_Products.pdf + * http://www.artisantg.com/info/P_wUovN.pdf + * + * Some info from those documents: + * + * Address Map + * ---------------------------------------------------------- + * Address Range Description + * ---------------------------------------------------------- + * 000 000 - 000 007 Initialisation vectors from system EPROM + * 000 008 - 01F FFF Dynamic RAM on CPU-1 B + * 000 008 - 07F FFF Dynamic RAM on CPU-1 D + * 080 008 - 09F FFF SYSTEM EPROM Area + * OAO 000 - OBF FFF USER EPROMArea + * 0C0 041 - 0C0 043 ACIA (P3) Host + * 0C0 080 - 0C0 082 ACIA (P4) Terminal + * 0C0 101 - 0C0 103 ACIA (P5) Remote device (eg serial printer) + * 0C0 401 - 0C0 42F RTC + * OEO 001 - 0E0 035 PI/T (eg centronics printer) + * OEO 200 - 0E0 2FF FPU + * OEO 300 - 0E0 300 Reset Off + * OEO 380 - 0E0 380 Reset On + * 100 000 - FEF FFF VMEbus addresses (A24) + * FFO 000 - FFF FFF VMEbus Short I/O (A16) + * ---------------------------------------------------------- + * + * Interrupt sources + * ---------------------------------------------------------- + * Description Device Lvl IRQ VME board + * /Board Vector Address + * ---------------------------------------------------------- + * On board Sources + * ABORT Switch 7 31 + * Real Time Clock (RTC) 58167A 6 30 + * Parallel/Timer (PI/T) 68230 5 29 + * Terminal ACIA 6850 4 28 + * Remote ACIA 6850 3 27 + * Host ACIA 6850 2 26 + * ACFAIL, SYSFAIL VME 5 29 + * Off board Sources (other VME boards) + * 6 Port Serial I/O board SIO 4 64-75 0xb00000 + * 8 Port Serial I/O board ISIO 4 76-83 0x960000 + * Disk Controller WFC 3 119 0xb01000 + * SCSI Controller ISCSI 4 119 0xa00000 + * Slot 1 Controller Board ASCU 7 31 0xb02000 + * ---------------------------------------------------------- + * + * TODO: + * - Finish 3 x ACIA6850, host and remote interface left, terminal works + * - Finish 1 x 68230 Motorola, Parallel Interface / Timer as required by ROM + * - Configure PIT to the Centronics device printer interface as + * supported by ROM (DONE) + * - Add 1 x Abort Switch + * - Add 1 x Reset Switch + * - Add 1 x Halt LED + * - Add a jumper field device as supported by PCB + * - Add configurable serial connector between ACIA:s and + * - Real terminal emulator, ie rs232 "socket" + * - Debug console + * - Add VME bus driver + * + ****************************************************************************/ + +#include "emu.h" +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "machine/mm58167.h" +#include "machine/68230pit.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "bus/centronics/ctronics.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define LOG(x) x + +#define BAUDGEN_CLOCK XTAL_1_8432MHz +/* + * The baudrate on the Force68k CPU-1 to CPU-6 is generated by a + * Motorola 14411 bitrate generator, the CPU-6 documents matches the circuits + * that I could find on the CPU-1 board. Here how I calculated the clock for + * the factory settings. No need to add selectors until terminal.c supports + * configurable baudrates. Fortunality CPU-1 was shipped with 9600N8! + * + * From the documents: + * + * 3 RS232C interfaces, strap selectable baud rate from 110-9600 or 600-19200 baud + * + * Default Jumper Settings of B7: + * -------------------------------- + * GND 10 - 11 RSA input on 14411 + * F1 on 14411 1 - 20 Baud selector of the terminal port + * F1 on 14411 3 - 18 Baud selector of the host port + * F1 on 14411 5 - 16 Baud selector of the remote port + * + * The RSB input on the 14411 is kept high always so RSA=0, RSB=1 and a 1.8432MHz crystal + * generates 153600 on the F1 output pin which by default strapping is connected to all + * three 6850 acias on the board. These can be strapped separatelly to speedup downloads. + * + * The selectable outputs from 14411, F1-F16: + * X16 RSA=0,RSB=1: 153600, 115200, 76800, 57600, 38400, 28800, 19200, 9600, 4800, 3200, 2153.3, 1758.8, 1200, 921600, 1843000 + * X64 RSA=1,RSB=1: 614400, 460800, 307200, 230400, 153600, 115200, 76800, 57600, 38400, 28800, 19200, 9600, 4800, 921600, 1843000 + * + * However, the datasheet says baudrate is strapable for 110-9600 but the output is 153600 + * so the system rom MUST setup the acia to divide by 16 to generate the correct baudrate. + * + */ +#define ACIA_CLOCK (BAUDGEN_CLOCK / 12) + +class force68k_state : public driver_device +{ +public: +force68k_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device (mconfig, type, tag), + m_maincpu (*this, "maincpu"), + m_rtc (*this, "rtc"), + m_pit (*this, "pit"), + m_aciahost (*this, "aciahost"), + m_aciaterm (*this, "aciaterm"), + m_aciaremt (*this, "aciaremt"), + m_centronics (*this, "centronics") + , m_centronics_ack (0) + , m_centronics_busy (0) + , m_centronics_perror (0) + , m_centronics_select (0) + ,m_cart(*this, "exp_rom1") +{ +} + +DECLARE_READ16_MEMBER (bootvect_r); +DECLARE_READ16_MEMBER (vme_a24_r); +DECLARE_WRITE16_MEMBER (vme_a24_w); +DECLARE_READ16_MEMBER (vme_a16_r); +DECLARE_WRITE16_MEMBER (vme_a16_w); +virtual void machine_start (); +// clocks +DECLARE_WRITE_LINE_MEMBER (write_aciahost_clock); +DECLARE_WRITE_LINE_MEMBER (write_aciaterm_clock); +DECLARE_WRITE_LINE_MEMBER (write_aciaremt_clock); +// centronics printer interface +DECLARE_WRITE_LINE_MEMBER (centronics_ack_w); +DECLARE_WRITE_LINE_MEMBER (centronics_busy_w); +DECLARE_WRITE_LINE_MEMBER (centronics_perror_w); +DECLARE_WRITE_LINE_MEMBER (centronics_select_w); +// User EPROM/SRAM slot(s) +int force68k_load_cart(device_image_interface &image, generic_slot_device *slot); +DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return force68k_load_cart(image, m_cart); } +DECLARE_READ16_MEMBER (read16_rom); + +protected: + +private: +required_device m_maincpu; +required_device m_rtc; +required_device m_pit; +required_device m_aciahost; +required_device m_aciaterm; +required_device m_aciaremt; +optional_device m_centronics; + +INT32 m_centronics_ack; +INT32 m_centronics_busy; +INT32 m_centronics_perror; +INT32 m_centronics_select; + +// Pointer to System ROMs needed by bootvect_r +UINT16 *m_sysrom; +UINT16 *m_usrrom; + +required_device m_cart; + +}; + +static ADDRESS_MAP_START (force68k_mem, AS_PROGRAM, 16, force68k_state) +ADDRESS_MAP_UNMAP_HIGH +AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r) /* Vectors mapped from System EPROM */ +AM_RANGE (0x000008, 0x01ffff) AM_RAM /* DRAM CPU-1B */ +//AM_RANGE (0x020000, 0x07ffff) AM_RAM /* Additional DRAM CPU-1D */ +AM_RANGE (0x080000, 0x083fff) AM_ROM /* System EPROM Area 16Kb DEBUGGER supplied as default on CPU-1B/D */ +AM_RANGE (0x084000, 0x09ffff) AM_ROM /* System EPROM Area 112Kb additional space for System ROM */ +//AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, max 128Kb mapped by a cartslot */ +AM_RANGE (0x0c0040, 0x0c0041) AM_DEVREADWRITE8 ("aciahost", acia6850_device, status_r, control_w, 0x00ff) +AM_RANGE (0x0c0042, 0x0c0043) AM_DEVREADWRITE8 ("aciahost", acia6850_device, data_r, data_w, 0x00ff) +AM_RANGE (0x0c0080, 0x0c0081) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, status_r, control_w, 0xff00) +AM_RANGE (0x0c0082, 0x0c0083) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, data_r, data_w, 0xff00) +AM_RANGE (0x0c0100, 0x0c0101) AM_DEVREADWRITE8 ("aciaremt", acia6850_device, status_r, control_w, 0x00ff) +AM_RANGE (0x0c0102, 0x0c0103) AM_DEVREADWRITE8 ("aciaremt", acia6850_device, data_r, data_w, 0x00ff) +AM_RANGE (0x0c0400, 0x0c042f) AM_DEVREADWRITE8 ("rtc", mm58167_device, read, write, 0x00ff) +AM_RANGE (0x0e0000, 0x0e0035) AM_DEVREADWRITE8 ("pit", pit68230_device, read, write, 0x00ff) +// AM_RANGE(0x0e0200, 0x0e0380) AM_READWRITE(fpu_r, fpu_w) /* optional FPCP 68881 FPU interface */ +AM_RANGE(0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) */ +AM_RANGE(0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) */ +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START (force68k) +INPUT_PORTS_END + +/* + * Centronics support + * + * The system ROMs has support for a parallel printer interface but the signals are just routed to row A + * of the VME P2 connector so no on board Centronics connector is available but assumed to be added on a + * separate I/O board. After some detective work I found that the ROM works as follows: + * + * The 'PA' (Printer Attach) command issues a on Port A and sends a strobe on H2 it then loops over + * the select signal, bit 0 on Port B, and the ack signal on HS1, both to be non zero. The support is really + * flawed as the strobe signal goes high instead of low ( this might assume an inverting driver on the + * P2 board ) and the busy signal is not checked at all. Or I might have assumed it all wrong, but it now + * works with the generic centronics printer driver. Need the printer board documentation to improve further. + * + * When the 'PA' command is successful everything printed to screen is mirrored on the printer. Use the + * 'NOPA' command to stop mirroring. I had no printer ROMs so could not test it with a "real" printer. + * + * Force CPU-1 init sequence for MC68230 PIT + * ----------------------------------------- + * 0801E6 0E0000 W 00 -> PGCR Mode 0 (uni8), H34 dis, H12 dis, H1234 HZ + * 0801E6 0E0002 W 00 -> PSRR PC4, PC5, H1S>H2S>H3S>H4S + * 0801E6 0E0004 W FF -> PADDR Port A all Outputs + * 0801E6 0E0006 W 00 -> PBDDR Port B all Inputs + * 0801EA 0E000C W 60 -> PACR Port A Mode 01, pin def, dbfr H1 data rec, H2 status/int, H2 output neg, H2S clrd + * 0801F0 0E000E W A0 -> PBCR Port B mode 1x, H4 output neg, H4S clrd, H3 int dis, H3 edg input, H3S set by assrt edg + * 0801F6 0E0000 W 30 -> PGCR H34 enable, H12enable + * 0801FC 0E000E W A8 -> PBCR +H4 asserted + * 08020A 0E000E W A0 -> PBCR +H4 negated + * + * Upon PA (Printer Attach) command enabling the Centronics printer mode + * --------------------------------------------------------------------- + * 081DB4 0E0011 W D0 -> PADR Data to Port A + * 081DB8 0E000D W 68 -> PACR H2 output asserted Centronics Strobe + * 081DC0 0E000D W 60 -> PACR H2 output negated + * 081DD0 0E0013 R 00 <- PBDR Port B polled for 01 (data) & 03 (mask) + * + */ + +/* Centronics ACK handler + * The centronics ack signal is expected by the ROM to arrive at H1 input line + */ +WRITE_LINE_MEMBER (force68k_state::centronics_ack_w) +{ +// LOG (logerror ("centronics_ack_w(%d) %lld\n", state, m_maincpu->total_cycles ())); + m_centronics_ack = state; + m_pit->h1_set (state); +} + +/* Centronics BUSY handler + * The centronics busy signal is not used by the ROM driver afaik + */ +WRITE_LINE_MEMBER (force68k_state::centronics_busy_w){ +// LOG (logerror ("centronics_busy_w(%d) %lld\n", state, m_maincpu->total_cycles ())); + m_centronics_busy = state; +} + +/* Centronics PERROR handler + * The centronics perror signal is not used by the ROM driver afaik + */ +WRITE_LINE_MEMBER (force68k_state::centronics_perror_w){ +// LOG (logerror ("centronics_perror_w(%d) %lld\n", state, m_maincpu->total_cycles ())); + m_centronics_perror = state; +} + +/* Centronics SELECT handler + * The centronics select signal is expected by the ROM on Port B bit 0 + */ +WRITE_LINE_MEMBER (force68k_state::centronics_select_w){ +// LOG (logerror ("centronics_select_w(%d) %lld\n", state, m_maincpu->total_cycles ())); + m_centronics_select = state; + m_pit->portb_setbit (0, state); +} + +/* Start it up */ +void force68k_state::machine_start () +{ + LOG (logerror ("machine_start\n")); + + save_item (NAME (m_centronics_busy)); + save_item (NAME (m_centronics_ack)); + save_item (NAME (m_centronics_select)); + save_item (NAME (m_centronics_perror)); + + /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ + m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x080000); + + /* Map user ROM/RAM socket(s) */ + if (m_cart->exists()) + { + m_usrrom = (UINT16*)m_cart->get_rom_base(); +#if 0 // This should be the correct way but produces odd and even bytes swapped + m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(generic_slot_device::read16_rom), (generic_slot_device*)m_cart)); +#else // So we installs a custom very ineffecient handler for now until we understand hwp to solve the problem better + m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(force68k_state::read16_rom), this)); +#endif + } +} + +/* A very ineffecient User cart emulation of two 8 bit sockets (odd and even) */ +READ16_MEMBER (force68k_state::read16_rom){ + offset = offset % m_cart->common_get_size("rom"); // Don't read outside buffer... + return ((m_usrrom [offset] << 8) & 0xff00) | ((m_usrrom [offset] >> 8) & 0x00ff); +} + +/* Boot vector handler, the PCB hardwires the first 8 bytes from 0x80000 to 0x0 */ +READ16_MEMBER (force68k_state::bootvect_r){ + return m_sysrom [offset]; +} + +/* 10. The VMEbus (text from board documentation) + * --------------- + * The implemented VMEbus Interface includes 24 address, 16 data, + * 6 address modifier and the asynchronous control signals. + * A single level bus arbiter is provided to build multi master + * systems. In addition to the bus arbiter, a separate slave bus + * arbitration allows selection of the arbitration level (0-3). + * + * The address modifier range .,Short 110 Access can be selected + * via a jumper for variable system generation. The 7 interrupt + * request levels of the VMEbus are fully supported from the + * SYS68K1CPU-1 B/D. For multi-processing, each IRQ signal can be + * enabled/disabled via a jumper field. + * + * Additionally, the SYS68K1CPU-1 B/D supports the ACFAIL, SYSRESET, + * SYSFAIL and SYSCLK signal (16 MHz). + */ + +/* Dummy VME access methods until the VME bus device is ready for use */ +READ16_MEMBER (force68k_state::vme_a24_r){ + LOG (logerror ("vme_a24_r\n")); + return (UINT16) 0; +} + +WRITE16_MEMBER (force68k_state::vme_a24_w){ + LOG (logerror ("vme_a24_w\n")); +} + +READ16_MEMBER (force68k_state::vme_a16_r){ + LOG (logerror ("vme_16_r\n")); + return (UINT16) 0; +} + +WRITE16_MEMBER (force68k_state::vme_a16_w){ + LOG (logerror ("vme_a16_w\n")); +} + +/* + * Serial port clock sources can all be driven by different outputs of the 14411 + */ +WRITE_LINE_MEMBER (force68k_state::write_aciahost_clock){ + m_aciahost->write_txc (state); + m_aciahost->write_rxc (state); +} + +WRITE_LINE_MEMBER (force68k_state::write_aciaterm_clock){ + m_aciaterm->write_txc (state); + m_aciaterm->write_rxc (state); +} + +WRITE_LINE_MEMBER (force68k_state::write_aciaremt_clock){ + m_aciaremt->write_txc (state); + m_aciaremt->write_rxc (state); +} + +/* + * 4. The USER Area (Text from the board manual) + The USER area contains two 28 pin sockets with JEDEC compatible pin out. + To allow the usage of static RAM's, the access to the USER area is byte + oriented. Table 3. lists the usable device types. + + Bits Bytes EPROM SRAM + -------------------------- + 2Kx16 4 Kbyte 2716 6116 + 4Kx16 8 Kbyte 2732 + 8Kx16 16 Kbyte 2764 6264 + 16Kx16 32 Kbyte 27128 + 32Kx16 64 Kbyte 27256 + -------------------------- +*/ +// Implementation of static 2 x 64K EPROM in sockets J10/J11 as 16 bit wide cartridge for easier +// software handling. TODO: make configurable according to table above. +static MACHINE_CONFIG_FRAGMENT( fccpu1_eprom_sockets ) + MCFG_GENERIC_CARTSLOT_ADD("exp_rom1", generic_plain_slot, "fccpu1_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) + MCFG_GENERIC_LOAD(force68k_state, exp1_load) +// MCFG_SOFTWARE_LIST_ADD("cart_list", "fccpu1_cart") +MACHINE_CONFIG_END + +/*************************** + Rom loading functions +****************************/ +int force68k_state::force68k_load_cart(device_image_interface &image, generic_slot_device *slot) +{ + UINT32 size = slot->common_get_size("rom"); + + if (size > 0x20000) // Max 128Kb + { + LOG( printf("Cartridge size exceeding max size (128Kb): %d\n", size) ); + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (128Kb)"); + return IMAGE_INIT_FAIL; + } + + slot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG); + slot->common_load_rom(slot->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +/* + * Machine configuration + */ +static MACHINE_CONFIG_START (fccpu1, force68k_state) +/* basic machine hardware */ +MCFG_CPU_ADD ("maincpu", M68000, XTAL_16MHz / 2) +MCFG_CPU_PROGRAM_MAP (force68k_mem) + +/* P3/Host Port config + * LO command causes ROM monitor to expect S-records on HOST port by default + * Implementation through nullmodem currently does not support handshakes so + * the ROM momitor is over-run while checking for checksums etc if used with + * UI mount feature. + */ +MCFG_DEVICE_ADD ("aciahost", ACIA6850, 0) + +MCFG_ACIA6850_TXD_HANDLER (DEVWRITELINE ("rs232host", rs232_port_device, write_txd)) +MCFG_ACIA6850_RTS_HANDLER (DEVWRITELINE ("rs232host", rs232_port_device, write_rts)) + +MCFG_RS232_PORT_ADD ("rs232host", default_rs232_devices, "null_modem") +MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("aciahost", acia6850_device, write_rxd)) +MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("aciahost", acia6850_device, write_cts)) + +MCFG_DEVICE_ADD ("aciahost_clock", CLOCK, ACIA_CLOCK) +MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciahost_clock)) + +/* P4/Terminal Port config */ +MCFG_DEVICE_ADD ("aciaterm", ACIA6850, 0) + +MCFG_ACIA6850_TXD_HANDLER (DEVWRITELINE ("rs232trm", rs232_port_device, write_txd)) +MCFG_ACIA6850_RTS_HANDLER (DEVWRITELINE ("rs232trm", rs232_port_device, write_rts)) + +MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal") +MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("aciaterm", acia6850_device, write_rxd)) +MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("aciaterm", acia6850_device, write_cts)) + +MCFG_DEVICE_ADD ("aciaterm_clock", CLOCK, ACIA_CLOCK) +MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciaterm_clock)) + +/* P5/Remote Port config */ +MCFG_DEVICE_ADD ("aciaremt", ACIA6850, 0) + +MCFG_DEVICE_ADD ("aciaremt_clock", CLOCK, ACIA_CLOCK) +MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciaterm_clock)) + +/* RTC Real Time Clock device */ +MCFG_DEVICE_ADD ("rtc", MM58167, XTAL_32_768kHz) + +/* PIT Parallel Interface and Timer device, assuming strapped for on board clock */ +MCFG_DEVICE_ADD ("pit", PIT68230, XTAL_16MHz / 2) +MCFG_PIT68230_PA_OUTPUT_CALLBACK (DEVWRITE8 ("cent_data_out", output_latch_device, write)) +MCFG_PIT68230_H2_CALLBACK (DEVWRITELINE ("centronics", centronics_device, write_strobe)) + +// centronics +MCFG_CENTRONICS_ADD ("centronics", centronics_devices, "printer") +MCFG_CENTRONICS_ACK_HANDLER (WRITELINE (force68k_state, centronics_ack_w)) +MCFG_CENTRONICS_BUSY_HANDLER (WRITELINE (force68k_state, centronics_busy_w)) +MCFG_CENTRONICS_PERROR_HANDLER (WRITELINE (force68k_state, centronics_perror_w)) +MCFG_CENTRONICS_SELECT_HANDLER (WRITELINE (force68k_state, centronics_select_w)) +MCFG_CENTRONICS_OUTPUT_LATCH_ADD ("cent_data_out", "centronics") + +// EPROM sockets +MCFG_FRAGMENT_ADD(fccpu1_eprom_sockets) +MACHINE_CONFIG_END + +#if 0 /* + * CPU-6 family is device and adressmap compatible with CPU-1 but with additions + * such as an optional 68881 FPU + */ +static MACHINE_CONFIG_START (fccpu6, force68k_state) +MCFG_CPU_ADD ("maincpu", M68000, XTAL_8MHz) /* Jumper B10 Mode B */ +MCFG_CPU_PROGRAM_MAP (force68k_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START (fccpu6a, force68k_state) +MCFG_CPU_ADD ("maincpu", M68000, XTAL_12_5MHz) /* Jumper B10 Mode A */ +MCFG_CPU_PROGRAM_MAP (force68k_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START (fccpu6v, force68k_state) +MCFG_CPU_ADD ("maincpu", M68010, XTAL_8MHz) /* Jumper B10 Mode B */ +MCFG_CPU_PROGRAM_MAP (force68k_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START (fccpu6va, force68k_state) +MCFG_CPU_ADD ("maincpu", M68010, XTAL_12_5MHz) /* Jumper B10 Mode A */ +MCFG_CPU_PROGRAM_MAP (force68k_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START (fccpu6vb, force68k_state) +MCFG_CPU_ADD ("maincpu", M68010, XTAL_12_5MHz) /* Jumper B10 Mode A */ +MCFG_CPU_PROGRAM_MAP (force68k_mem) +MACHINE_CONFIG_END +#endif + +/* ROM definitions */ +ROM_START (fccpu1) +ROM_REGION (0x1000000, "maincpu", 0) + +ROM_LOAD16_BYTE ("fccpu1V1.0L.j8.bin", 0x080001, 0x2000, CRC (3ac6f08f) SHA1 (502f6547b508d8732bd68bbbb2402d8c30fefc3b)) +ROM_LOAD16_BYTE ("fccpu1V1.0L.j9.bin", 0x080000, 0x2000, CRC (035315fb) SHA1 (90dc44d9c25d28428233e6846da6edce2d69e440)) + +/* + * System ROM terminal commands + * + * COMMAND SUMMARY DESCRIPTION (From CPU-1B datasheet, ROMs were dumped + * from a CPU-1 board so some features might be missing or different) + * --------------------------------------------------------------------------- + * BF Block Fill memory - from addr1 through addr2 with data + * BM
Block Move - move from addr1 through addr2to addr3 + * BR [
[; ] ... ] Set/display Breakpoint + * BS Block Search - search addr1 through addr2 for data + * BT Block Test of memory + * DC Data Conversion + * DF Display Formatted registers + * DU [n] [] Dump memory to object file + * GO or G [ Execute program. + * GD [ Go Direct + * GT
Exec prog: temporary breakpoint + * HE Help; display monitor commands + * LO [n] [; Load Object file + * MD
[] Memory Display + * MM or M
[] Memory Modify + * MS
< ... Memory Set - starting at addr with data 1. data 2 ... + * NOBR [
... ] Remove Breakpoint + * NOPA Printer Detach (Centronics on PIT/P2) + * OF Offset + * PA Printer Attach (Centronics on PIT/P2) + * PF[n] Set/display Port Format + * RM Register Modify + * TM [] Transparent Mode + * TR OR T [ Trace + * TT
Trace: temporary breakpoint + * VE [n] [ Verify memory/object file + * ---------------------------------------------------------------------------- + * .AO - .A7 [ Display/set address register + * .00 - .07 [ Display/set data register + * .RO - .R6 [ Display/set offset register + * .PC [ Display/set program counter + * .SR [ Display/set status register + * .SS [ Display/set supervisor stack + * .US [ Display/set user stack + * ---------------------------------------------------------------------------- + * MD
[]; DI Disassemble memory location + * MM
; DI Disassemble/Assemble memory location + * ---------------------------------------------------------------------------- + * Undocumented commands found in ROM table at address 0x80308 + * .* No WHAT message displayed, no action seen. + */ +ROM_END + +/* + * CPU-6 ROMs were generally based om VMEPROM which contained the PDOS RTOS from Eyring Research. + * I don't have these but if anyone can dump them and send to me I can verify that they work as expected. + */ +#if 0 +ROM_START (fccpu6) +ROM_REGION (0x1000000, "maincpu", 0) +ROM_END + +ROM_START (fccpu6a) +ROM_REGION (0x1000000, "maincpu", 0) +ROM_END + +ROM_START (fccpu6v) +ROM_REGION (0x1000000, "maincpu", 0) +ROM_END + +ROM_START (fccpu6va) +ROM_REGION (0x1000000, "maincpu", 0) +ROM_END + +ROM_START (fccpu6vb) +ROM_REGION (0x1000000, "maincpu", 0) +ROM_END +#endif + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, fccpu1, 0, 0, fccpu1, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-1", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) +//COMP( 1989, fccpu6, 0, 0, fccpu6, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6", MACHINE_IS_SKELETON ) +//COMP( 1989, fccpu6a, 0, 0, fccpu6a, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6a", MACHINE_IS_SKELETON ) +//COMP( 1989, fccpu6v, 0, 0, fccpu6v, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6v", MACHINE_IS_SKELETON ) +//COMP( 1989, fccpu6va, 0, 0, fccpu6va, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6va", MACHINE_IS_SKELETON ) +//COMP( 1989, fccpu6vb, 0, 0, fccpu6vb, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6vb", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/fp1100.c b/src/mame/drivers/fp1100.c new file mode 100644 index 00000000000..6352049278c --- /dev/null +++ b/src/mame/drivers/fp1100.c @@ -0,0 +1,705 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Casio FP-1100 + + Info found at various sites: + + Casio FP1000 and FP1100 are "pre-PC" personal computers, with Cassette, + Floppy Disk, Printer and 2 cart/expansion slots. They had 32K ROM, 64K + main RAM, 80x25 text display, 320x200, 640x200, 640x400 graphics display. + Floppy disk is 2x 5 1/4. + + The FP1000 had 16K videoram and monochrome only. The monitor had a switch + to invert the display (swap foreground and background colours). + + The FP1100 had 48K videoram and 8 colours. + + Processors: Z80 @ 4MHz, uPD7801G @ 2MHz + + Came with Basic built in, and you could run CP/M 2.2 from the floppy disk. + + The keyboard is a separate unit. It contains a beeper. + + TODO: + - irq sources and communications; + - unimplemented instruction PER triggered (can be ignored) + - Most of this code is guesswork, because although schematics exist, + they are too blurry to read. + - Display can be interlaced or non-interlaced. Interlaced not emulated. + - Cassette Load is quite complex, using 6 pins of the sub-cpu. Not done. + - subcpu is supposed to be in WAIT except in horizontal blanking period. + WAIT is not emulated in our cpu. + - Keyboard not working. + - FDC not done. + + + To get it to boot while in debugger: + - focus 1 + - g + - after a second it will get stuck in a loop at fc2-fc4 + - press enter until it is at fc4 + - pc++ + - g + Now it will start. You will most likely get an error message, although + sometimes you'll get the Casio Basic title. Cursor will be flashing. + - The message will most likely be blue, but it should be white. + - Sometimes it will be in inverse video, and sometimes not. + - Sometimes it will beep, and sometimes not. + - The interrupt timing is quite critical. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/upd7810/upd7810.h" +#include "video/mc6845.h" +#include "sound/beep.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/cassette.h" + +#define MAIN_CLOCK 15974400 +#define LOG 0 + +class fp1100_state : public driver_device +{ +public: + fp1100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "sub") + , m_crtc(*this, "crtc") + , m_p_videoram(*this, "videoram") + , m_keyboard(*this, "KEY") + , m_beep(*this, "beeper") + , m_centronics(*this, "centronics") + , m_cass(*this, "cassette") + { } + + DECLARE_WRITE8_MEMBER(main_bank_w); + DECLARE_WRITE8_MEMBER(irq_mask_w); + DECLARE_WRITE8_MEMBER(main_to_sub_w); + DECLARE_READ8_MEMBER(sub_to_main_r); + DECLARE_WRITE8_MEMBER(slot_bank_w); + DECLARE_READ8_MEMBER(slot_id_r); + DECLARE_READ8_MEMBER(main_to_sub_r); + DECLARE_WRITE8_MEMBER(sub_to_main_w); + DECLARE_WRITE8_MEMBER(colour_control_w); + DECLARE_WRITE8_MEMBER(kbd_row_w); + DECLARE_WRITE8_MEMBER(porta_w); + DECLARE_READ8_MEMBER(portb_r); + DECLARE_READ8_MEMBER(portc_r); + DECLARE_WRITE8_MEMBER(portc_w); + DECLARE_WRITE_LINE_MEMBER(centronics_busy_w); + DECLARE_WRITE_LINE_MEMBER(cass_w); + INTERRUPT_GEN_MEMBER(fp1100_vblank_irq); + DECLARE_DRIVER_INIT(fp1100); + DECLARE_MACHINE_RESET(fp1100); + MC6845_UPDATE_ROW(fp1100_update_row); + TIMER_DEVICE_CALLBACK_MEMBER(timer_c); + required_device m_palette; +private: + UINT8 m_irq_mask; + UINT8 m_main_latch; + UINT8 m_sub_latch; + UINT8 m_slot_num; + UINT8 m_kbd_row; + UINT8 m_col_border; + UINT8 m_col_cursor; + UINT8 m_col_display; + UINT8 m_centronics_busy; + UINT8 m_cass_data[4]; + bool m_cass_state; + bool m_cassold; + + struct { + UINT8 id; + }m_slot[8]; + + struct { + UINT8 porta; + UINT8 portb; + UINT8 portc; + }m_upd7801; + required_device m_maincpu; + required_device m_subcpu; + required_device m_crtc; + required_shared_ptr m_p_videoram; + required_ioport_array<16> m_keyboard; + required_device m_beep; + required_device m_centronics; + required_device m_cass; +}; + +MC6845_UPDATE_ROW( fp1100_state::fp1100_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 r,g,b,col,i; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + if BIT(m_upd7801.porta, 4) + { // green screen + for (x = 0; x < x_count; x++) + { + mem = (((ma+x)<<3) + ra) & 0x3fff; + g = m_p_videoram[mem]; + for (i = 0; i < 8; i++) + { + col = BIT(g, i); + if (x == cursor_x) col ^= 1; + *p++ = palette[col<<1]; + } + } + } + else + { // RGB screen + for (x = 0; x < x_count; x++) + { + mem = (((ma+x)<<3) + ra) & 0x3fff; + b = m_p_videoram[mem]; + r = m_p_videoram[mem+0x4000]; + g = m_p_videoram[mem+0x8000]; + for (i = 0; i < 8; i++) + { + col = BIT(r, i) + (BIT(g, i) << 1) + (BIT(b, i) << 2); + if (x == cursor_x) col = m_col_cursor; + *p++ = palette[col]; + } + } + } +} + +/* +d0 - Package select +d1 - Bank select (at boot time) +other bits not used +*/ +WRITE8_MEMBER( fp1100_state::main_bank_w ) +{ + membank("bankr0")->set_entry( BIT(data,1)); //(1) RAM (0) ROM + m_slot_num = (m_slot_num & 3) | ((data & 1) << 2); //?? +} + +WRITE8_MEMBER( fp1100_state::irq_mask_w ) +{ + machine().scheduler().synchronize(); // force resync + m_irq_mask = data; + m_subcpu->set_input_line(UPD7810_INTF2, BIT(data, 7) ? HOLD_LINE : CLEAR_LINE); + if (LOG) printf("%s: IRQmask=%X\n",machine().describe_context(),data); +} + +WRITE8_MEMBER( fp1100_state::main_to_sub_w ) +{ +// machine().scheduler().synchronize(); // force resync +// m_subcpu->set_input_line(UPD7810_INTF2, ASSERT_LINE); + m_sub_latch = data; + if (LOG) printf("%s: From main:%X\n",machine().describe_context(),data); +} + +READ8_MEMBER( fp1100_state::sub_to_main_r ) +{ +// machine().scheduler().synchronize(); // force resync +// m_maincpu->set_input_line(0, CLEAR_LINE); + if (LOG) printf("%s: To main:%X\n",machine().describe_context(),m_main_latch); + return m_main_latch; +} + +WRITE8_MEMBER( fp1100_state::slot_bank_w ) +{ + m_slot_num = (data & 3) | (m_slot_num & 4); +} + +READ8_MEMBER( fp1100_state::slot_id_r ) +{ + //return 0xff; + return m_slot[m_slot_num & 7].id; +} + +static ADDRESS_MAP_START(fp1100_map, AS_PROGRAM, 8, fp1100_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x9000, 0xffff) AM_RAM AM_REGION("wram", 0x9000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(fp1100_io, AS_IO, 8, fp1100_state ) + ADDRESS_MAP_UNMAP_HIGH + //AM_RANGE(0x0000, 0xfeff) slot memory area + AM_RANGE(0xff00, 0xff7f) AM_READWRITE(slot_id_r,slot_bank_w) + AM_RANGE(0xff80, 0xffff) AM_READ(sub_to_main_r) + AM_RANGE(0xff80, 0xff9f) AM_WRITE(irq_mask_w) + AM_RANGE(0xffa0, 0xffbf) AM_WRITE(main_bank_w) + AM_RANGE(0xffc0, 0xffff) AM_WRITE(main_to_sub_w) +ADDRESS_MAP_END + +READ8_MEMBER( fp1100_state::main_to_sub_r ) +{ +// machine().scheduler().synchronize(); // force resync +// m_subcpu->set_input_line(UPD7810_INTF2, CLEAR_LINE); + if (LOG) printf("%s: To sub:%X\n",machine().describe_context(),m_sub_latch); + return m_sub_latch; +} + +WRITE8_MEMBER( fp1100_state::sub_to_main_w ) +{ +// machine().scheduler().synchronize(); // force resync +// m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xf0); + m_main_latch = data; + if (LOG) printf("%s: From sub:%X\n",machine().describe_context(),data); +} + +/* +d0,1,2 - border colour (B,R,G) +d3 - not used +d4,5,6 - colour of cursor; or display area (B,R,G) (see d7) +d7 - 1=display area; 0=cursor +*/ +WRITE8_MEMBER( fp1100_state::colour_control_w ) +{ + data = BITSWAP8(data, 7, 4, 6, 5, 3, 0, 2, 1); // change BRG to RGB + + m_col_border = data & 7; + + if BIT(data, 7) + m_col_display = (data >> 4) & 7; + else + m_col_cursor = data >> 4; +} + +/* +d0,1,2,3 - keyboard scan row + - if 13, turn on shift-lock LED + - if 14, turn on caps-lock LED + - if 15, turn off both LEDs +d4 - Beeper +d5 - "3state buffer of key data line (1=open, 0=closed)" +d6,7 - not used +*/ +WRITE8_MEMBER( fp1100_state::kbd_row_w ) +{ + m_kbd_row = data & 15; + m_beep->set_state(BIT(data, 4)); +} + +static ADDRESS_MAP_START(fp1100_slave_map, AS_PROGRAM, 8, fp1100_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("sub_ipl",0x0000) + AM_RANGE(0x2000, 0xdfff) AM_RAM AM_SHARE("videoram") //vram B/R/G + AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x3fe) AM_DEVREADWRITE("crtc", mc6845_device, status_r,address_w) + AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x3fe) AM_DEVREADWRITE("crtc", mc6845_device, register_r,register_w) + AM_RANGE(0xe400, 0xe7ff) AM_READ_PORT("DSW") AM_WRITE(kbd_row_w) + AM_RANGE(0xe800, 0xebff) AM_READWRITE(main_to_sub_r,sub_to_main_w) + //AM_RANGE(0xec00, 0xefff) "Acknowledge of INT0" doesn't seem to be used + AM_RANGE(0xf000, 0xf3ff) AM_WRITE(colour_control_w) + AM_RANGE(0xf400, 0xff7f) AM_ROM AM_REGION("sub_ipl",0x2400) + AM_RANGE(0xff80, 0xffff) AM_RAM /* upd7801 internal RAM */ +ADDRESS_MAP_END + +/* +d0,1,2 - enable RGB guns (G,R,B) +d3 - CRTC clock (80 or 40 cols) +d4 - RGB (0) or Green (1) +d5 - clear videoram +d6 - CMT baud rate (1=300; 0=1200) +d7 - CMT load clock +The SO pin is Serial Output to CMT (1=2400Hz; 0=1200Hz) +*/ +WRITE8_MEMBER( fp1100_state::porta_w ) +{ + m_upd7801.porta = data; + + if BIT(data, 5) + memset(m_p_videoram, 0, 0xc000); +} + +READ8_MEMBER( fp1100_state::portb_r ) +{ + UINT8 data = m_keyboard[m_kbd_row]->read() ^ 0xff; + //m_subcpu->set_input_line(UPD7810_INTF0, BIT(data, 7) ? HOLD_LINE : CLEAR_LINE); + return data; +} + +/* +d0 - Centronics busy +d1 - Centronics error +d2 - CMT load input clock +d7 - CMT load serial data +*/ +READ8_MEMBER( fp1100_state::portc_r ) +{ + return (m_upd7801.portc & 0x78) | m_centronics_busy; +} + +/* +d3 - cause INT on main cpu +d4 - Centronics port is used for input or output +d5 - CMT relay +d6 - Centronics strobe +*/ +WRITE8_MEMBER( fp1100_state::portc_w ) +{ + if BIT(m_irq_mask, 4) + m_maincpu->set_input_line_and_vector(0, BIT(data, 3) ? CLEAR_LINE : HOLD_LINE, 0xf0); + if (LOG) printf("%s: PortC:%X\n",machine().describe_context(),data); + m_upd7801.portc = data; + m_cass->change_state(BIT(data, 5) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_centronics->write_strobe(BIT(data, 6)); +} + +static ADDRESS_MAP_START(fp1100_slave_io, AS_IO, 8, fp1100_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_WRITE(porta_w) + AM_RANGE(0x01, 0x01) AM_READ(portb_r) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x02, 0x02) AM_READWRITE(portc_r,portc_w) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( fp1100 ) + PORT_START("KEY.0") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") + PORT_BIT(0x70, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_NAME("Caps") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_NAME("Graph") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("Ctrl") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Shift") PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("KEY.2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("PF0") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("*") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP-") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") PORT_CHAR(27) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('A') PORT_CHAR('a') + + PORT_START("KEY.3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("PF1") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME(",") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("/") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('S') PORT_CHAR('s') + + PORT_START("KEY.4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("PF2") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME(".") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("Del") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('D') PORT_CHAR('d') + + PORT_START("KEY.5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("PF3") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("000") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('F') PORT_CHAR('f') + + PORT_START("KEY.6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("PF4") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Space") PORT_CHAR(32) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Ins") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('G') PORT_CHAR('g') + + PORT_START("KEY.7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("PF5") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHAR('5') PORT_CHAR('^') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('H') PORT_CHAR('h') + + PORT_START("KEY.8") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("PF6") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('J') PORT_CHAR('j') + + PORT_START("KEY.9") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("PF7") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Home") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHAR('7') PORT_CHAR('%') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('K') PORT_CHAR('k') + + PORT_START("KEY.10") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("PF8") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("]") PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('L') PORT_CHAR('l') + + PORT_START("KEY.11") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("PF9") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("[") PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Rubout") PORT_CHAR(8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Return") PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHAR(';') PORT_CHAR('+') + + PORT_START("KEY.12") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop/Cont") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("Yen") PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(c)") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("|") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("^") PORT_CHAR('^') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_NAME(":") PORT_CHAR(':') PORT_CHAR('*') + + PORT_START("KEY.13") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.14") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.15") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x01, "Text width" ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x00, "40 chars/line" ) + PORT_DIPSETTING( 0x01, "80 chars/line" ) + PORT_DIPNAME( 0x02, 0x02, "Screen Mode" ) PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x00, "Screen 0" ) + PORT_DIPSETTING( 0x02, "Screen 1" ) + PORT_DIPNAME( 0x04, 0x04, "FP Mode" ) PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x00, "FP-1000" ) // Green screen + PORT_DIPSETTING( 0x04, "FP-1100" ) // RGB + PORT_DIPNAME( 0x08, 0x08, "CMT Baud Rate" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x00, "1200 Baud" ) + PORT_DIPSETTING( 0x08, "300 Baud" ) + PORT_DIPNAME( 0x10, 0x10, "Printer Type" ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x00, "" ) + PORT_DIPSETTING( 0x10, "FP-1012PR" ) + PORT_DIPNAME( 0x20, 0x20, "Keyboard Type" ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x00, "" ) + PORT_DIPSETTING( 0x20, "Normal" ) + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SLOTS") + PORT_CONFNAME( 0x0003, 0x0002, "Slot #0" ) + PORT_CONFSETTING( 0x0000, "(null)" ) + PORT_CONFSETTING( 0x0001, "ROM" ) + PORT_CONFSETTING( 0x0002, "RAM" ) + PORT_CONFSETTING( 0x0003, "FDC" ) + PORT_CONFNAME( 0x000c, 0x0008, "Slot #1" ) + PORT_CONFSETTING( 0x0000, "(null)" ) + PORT_CONFSETTING( 0x0004, "ROM" ) + PORT_CONFSETTING( 0x0008, "RAM" ) + PORT_CONFSETTING( 0x000c, "FDC" ) + PORT_CONFNAME( 0x0030, 0x0020, "Slot #2" ) + PORT_CONFSETTING( 0x0000, "(null)" ) + PORT_CONFSETTING( 0x0010, "ROM" ) + PORT_CONFSETTING( 0x0020, "RAM" ) + PORT_CONFSETTING( 0x0030, "FDC" ) + PORT_CONFNAME( 0x00c0, 0x0080, "Slot #3" ) + PORT_CONFSETTING( 0x0000, "(null)" ) + PORT_CONFSETTING( 0x0040, "ROM" ) + PORT_CONFSETTING( 0x0080, "RAM" ) + PORT_CONFSETTING( 0x00c0, "FDC" ) + PORT_CONFNAME( 0x0300, 0x0200, "Slot #4" ) + PORT_CONFSETTING( 0x0000, "(null)" ) + PORT_CONFSETTING( 0x0100, "ROM" ) + PORT_CONFSETTING( 0x0200, "RAM" ) + PORT_CONFSETTING( 0x0300, "FDC" ) + PORT_CONFNAME( 0x0c00, 0x0800, "Slot #5" ) + PORT_CONFSETTING( 0x0000, "(null)" ) + PORT_CONFSETTING( 0x0400, "ROM" ) + PORT_CONFSETTING( 0x0800, "RAM" ) + PORT_CONFSETTING( 0x0c00, "FDC" ) + PORT_CONFNAME( 0x3000, 0x2000, "Slot #6" ) + PORT_CONFSETTING( 0x0000, "(null)" ) + PORT_CONFSETTING( 0x1000, "ROM" ) + PORT_CONFSETTING( 0x2000, "RAM" ) + PORT_CONFSETTING( 0x3000, "FDC" ) + PORT_CONFNAME( 0xc000, 0x8000, "Slot #7" ) + PORT_CONFSETTING( 0x0000, "(null)" ) + PORT_CONFSETTING( 0x4000, "ROM" ) + PORT_CONFSETTING( 0x8000, "RAM" ) + PORT_CONFSETTING( 0xc000, "FDC" ) +INPUT_PORTS_END + + +static const gfx_layout fp1100_chars_8x8 = +{ + 8,8, + 256, + 1, + { 0 }, + { 7, 6, 5, 4, 3, 2, 1, 0 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( fp1100 ) + GFXDECODE_ENTRY( "sub_ipl", 0x2400, fp1100_chars_8x8, 0, 1 ) +GFXDECODE_END + +WRITE_LINE_MEMBER( fp1100_state::centronics_busy_w ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( fp1100_state::cass_w ) +{ + m_cass_state = state; +} + +TIMER_DEVICE_CALLBACK_MEMBER( fp1100_state::timer_c ) +{ + m_cass_data[3]++; + + if (m_cass_state != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +INTERRUPT_GEN_MEMBER(fp1100_state::fp1100_vblank_irq) +{ +// if BIT(m_irq_mask, 4) +// m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xf8); +} + +MACHINE_RESET_MEMBER( fp1100_state, fp1100 ) +{ + int i; + UINT8 slot_type; + const UINT8 id_type[4] = { 0xff, 0x00, 0x01, 0x04}; + for(i=0;i<8;i++) + { + slot_type = (ioport("SLOTS")->read() >> i*2) & 3; + m_slot[i].id = id_type[slot_type]; + } + + m_beep->set_frequency(950); /* guess */ + m_beep->set_state(0); + + membank("bankr0")->set_entry(0); // point at rom + membank("bankw0")->set_entry(0); // always write to ram + + m_irq_mask = 0; + m_main_latch = 0; + m_sub_latch = 0; + m_slot_num = 0; + m_kbd_row = 0; + m_col_border = 0; + m_col_cursor = 0; + m_col_display = 0; + m_upd7801.porta = 0; + m_upd7801.portb = 0; + m_upd7801.portc = 0; +} + +DRIVER_INIT_MEMBER( fp1100_state, fp1100 ) +{ + UINT8 *main = memregion("ipl")->base(); + UINT8 *wram = memregion("wram")->base(); + + membank("bankr0")->configure_entry(1, &wram[0x0000]); + membank("bankr0")->configure_entry(0, &main[0x0000]); + membank("bankw0")->configure_entry(0, &wram[0x0000]); +} + +static MACHINE_CONFIG_START( fp1100, fp1100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, MAIN_CLOCK/4) + MCFG_CPU_PROGRAM_MAP(fp1100_map) + MCFG_CPU_IO_MAP(fp1100_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", fp1100_state, fp1100_vblank_irq) + + MCFG_CPU_ADD( "sub", UPD7801, MAIN_CLOCK/4 ) + MCFG_CPU_PROGRAM_MAP( fp1100_slave_map ) + MCFG_CPU_IO_MAP( fp1100_slave_io ) + MCFG_UPD7810_TXD(WRITELINE(fp1100_state, cass_w)) + + MCFG_MACHINE_RESET_OVERRIDE(fp1100_state, fp1100) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", h46505_device, screen_update) + MCFG_PALETTE_ADD("palette", 8) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", fp1100) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) // inside the keyboard + + /* CRTC */ + MCFG_MC6845_ADD("crtc", H46505, "screen", MAIN_CLOCK/8) /* hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(fp1100_state, fp1100_update_row) + + /* Printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fp1100_state, centronics_busy_w)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* Cassette */ + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_c", fp1100_state, timer_c, attotime::from_hz(4800)) // cass write +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( fp1100 ) + ROM_REGION( 0x9000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "basic.rom", 0x0000, 0x9000, BAD_DUMP CRC(7c7dd17c) SHA1(985757b9c62abd17b0bd77db751d7782f2710ec3)) + + ROM_REGION( 0x3000, "sub_ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "sub1.rom", 0x0000, 0x1000, CRC(8feda489) SHA1(917d5b398b9e7b9a6bfa5e2f88c5b99923c3c2a3)) + ROM_LOAD( "sub2.rom", 0x1000, 0x1000, CRC(359f007e) SHA1(0188d5a7b859075cb156ee55318611bd004128d7)) + ROM_LOAD( "sub3.rom", 0x2000, 0xf80, BAD_DUMP CRC(fb2b577a) SHA1(a9ae6b03e06ea2f5db30dfd51ebf5aede01d9672)) + + ROM_REGION( 0x10000, "wram", ROMREGION_ERASE00 ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, fp1100, 0, 0, fp1100, fp1100, fp1100_state, fp1100, "Casio", "FP-1100", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/fp200.c b/src/mame/drivers/fp200.c new file mode 100644 index 00000000000..9e9cc9c47db --- /dev/null +++ b/src/mame/drivers/fp200.c @@ -0,0 +1,626 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + FP-200 (c) 1982 Casio + + preliminary driver by Angelo Salese + + TODO: + - What's the LCDC type? Custom? + - Unless I've missed something in the schems, this one shouldn't have any + sound capability. + - backup RAM. + - Rewrite video emulation from scratch. + + Notes: + - on start-up there's a "memory illegal" warning. Enter "RESET" command + to initialize it (thanks to Takeda Toshiya for pointing this out). + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" + +#define MAIN_CLOCK XTAL_6_144MHz + +class fp200_state : public driver_device +{ +public: + fp200_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + // devices + required_device m_maincpu; + UINT8 m_io_type; + UINT8 *m_chargen; + UINT8 m_keyb_mux; + + struct{ + UINT8 x; + UINT8 y; + UINT8 status; + UINT8 *vram; + UINT8 *attr; + }m_lcd; + UINT8 read_lcd_attr(UINT16 X, UINT16 Y); + UINT8 read_lcd_vram(UINT16 X, UINT16 Y); + void write_lcd_attr(UINT16 X, UINT16 Y,UINT8 data); + void write_lcd_vram(UINT16 X, UINT16 Y,UINT8 data); + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER(fp200_io_r); + DECLARE_WRITE8_MEMBER(fp200_io_w); + DECLARE_READ8_MEMBER(fp200_lcd_r); + DECLARE_WRITE8_MEMBER(fp200_lcd_w); + DECLARE_READ8_MEMBER(fp200_keyb_r); + DECLARE_WRITE8_MEMBER(fp200_keyb_w); + DECLARE_INPUT_CHANGED_MEMBER(keyb_irq); + + DECLARE_WRITE_LINE_MEMBER(sod_w); + DECLARE_READ_LINE_MEMBER(sid_r); + + DECLARE_PALETTE_INIT(fp200); +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); +}; + +void fp200_state::video_start() +{ + m_lcd.vram = auto_alloc_array_clear(machine(), UINT8, 20*64); + m_lcd.attr = auto_alloc_array_clear(machine(), UINT8, 20*64); +} + +/* TODO: Very preliminary, I actually believe that the LCDC writes in a blitter fashion ... */ +UINT32 fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + UINT16 l_offs, r_offs; + + bitmap.fill(0, cliprect); + + l_offs = 0; + r_offs = 0; + for(int y=cliprect.min_y;y= 64) + yoffs -= 64; + + if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) + { + UINT8 vram,pix; + + vram = m_lcd.vram[x/8+yoffs*20]; + pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; + bitmap.pix16(y,x) = pix; + } + /* + else if(m_lcd.attr[x/8+yoffs*20] == 0x40) + { + UINT8 vram,pix; + + vram = m_lcd.vram[x/8+yoffs*20]; + pix = (vram) >> (7-(yoffs & 7)) & 1; + bitmap.pix16(y,x) = pix; + }*/ + } + } + + for(int y=cliprect.min_y;y= 64) + yoffs -= 64; + + if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) + { + UINT8 vram,pix; + + vram = m_lcd.vram[x/8+yoffs*20]; + pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; + bitmap.pix16(y,x) = pix; + } + /*else if(m_lcd.attr[x/8+yoffs*20] == 0x40) + { + UINT8 vram,pix; + + vram = m_lcd.vram[x/8+yoffs*20]; + pix = (vram) >> (7-(yoffs & 7)) & 1; + bitmap.pix16(y,x) = pix; + }*/ + } + } + + return 0; +} + + +/* +[1] DDDD DDDD vram data/attr (left half) +[2] DDDD DDDD vram data/attr (right half) +[8] SSSS --YY Status code (1=vram type/0xb=attr type) / upper part of Y address +[9] YYYY XXXX lower part of Y address / X address +*/ +UINT8 fp200_state::read_lcd_attr(UINT16 X, UINT16 Y) +{ + UINT16 base_offs; + UINT8 res = 0; + + for(int yi=0;yi<8;yi++) + { + base_offs = X+(Y+yi)*20; + + if(base_offs >= 20*64) + return 0xff; + + res = m_lcd.attr[base_offs]; + } + + return res; +} + +UINT8 fp200_state::read_lcd_vram(UINT16 X, UINT16 Y) +{ + UINT16 base_offs; + UINT8 res = 0; + + for(int yi=0;yi<8;yi++) + { + base_offs = X+(Y+yi)*20; + + if(base_offs >= 20*64) + return 0xff; + + res = m_lcd.vram[base_offs]; + } + + return res; +} + +READ8_MEMBER(fp200_state::fp200_lcd_r) +{ + UINT8 res; + + res = 0; + + switch(offset) + { + case 1: + //printf("%d %d -> (L) %02x\n",m_lcd.x,m_lcd.y,m_lcd.status); + if(m_lcd.status == 0xb) + res = read_lcd_attr(m_lcd.x,m_lcd.y); + else if(m_lcd.status == 1) + res = read_lcd_vram(m_lcd.x,m_lcd.y); + break; + case 2: + //printf("%d %d -> (R) %02x\n",m_lcd.x,m_lcd.y,m_lcd.status); + if(m_lcd.status == 0xb) + res = read_lcd_attr(m_lcd.x + 10,m_lcd.y); + else if(m_lcd.status == 1) + res = read_lcd_vram(m_lcd.x + 10,m_lcd.y); + break; + case 8: + res = (m_lcd.status & 0xf) << 4; + res |= (m_lcd.y & 0x30) >> 4; + break; + case 9: + res = (m_lcd.y & 0xf) << 4; + res |= (m_lcd.x & 0xf); + break; + } + + + return res; +} + +void fp200_state::write_lcd_attr(UINT16 X, UINT16 Y,UINT8 data) +{ + UINT16 base_offs; + + for(int yi=0;yi<8;yi++) + { + base_offs = X+(Y+yi)*20; + + if(base_offs >= 20*64) + return; + + //if(data != 0x60) + // printf("%d %d %02x\n",X,Y,data); + + m_lcd.attr[base_offs] = data; + } +} + +void fp200_state::write_lcd_vram(UINT16 X, UINT16 Y,UINT8 data) +{ + UINT16 base_offs; + + for(int yi=0;yi<8;yi++) + { + base_offs = X+(Y+yi)*20; + + if(base_offs >= 20*64) + return; + + m_lcd.vram[base_offs] = data; + } +} + +WRITE8_MEMBER(fp200_state::fp200_lcd_w) +{ + switch(offset) + { + case 1: + //printf("%d %d -> %02x (%c) (L %02x)\n",m_lcd.x,m_lcd.y,data,data,m_lcd.status); + if(m_lcd.status == 0xb) + write_lcd_attr(m_lcd.x,m_lcd.y,data); + else if(m_lcd.status == 1) + write_lcd_vram(m_lcd.x,m_lcd.y,data); + break; + case 2: + //printf("%d %d -> %02x (%c) (R %02x)\n",m_lcd.x + 10,m_lcd.y,data,data,m_lcd.status); + if(m_lcd.status == 0xb) + write_lcd_attr(m_lcd.x + 10,m_lcd.y,data); + else if(m_lcd.status == 1) + write_lcd_vram(m_lcd.x + 10,m_lcd.y,data); + break; + case 8: + m_lcd.status = (data & 0xf0) >> 4; + if(m_lcd.status == 0x0b) + m_lcd.y = (m_lcd.y & 0xf) | ((data & 3) << 4); + break; + case 9: + m_lcd.y = (m_lcd.y & 0x30) | ((data & 0xf0) >> 4); + m_lcd.x = data & 0xf; + break; + } +} + +READ8_MEMBER(fp200_state::fp200_keyb_r) +{ + const char *const keynames[16] = { "KEY0", "KEY1", "KEY2", "KEY3", + "KEY4", "KEY5", "KEY6", "KEY7", + "KEY8", "KEY9", "UNUSED", "UNUSED", + "UNUSED", "UNUSED", "UNUSED", "UNUSED"}; + UINT8 res; + + if(offset == 0) + res = ioport(keynames[m_keyb_mux])->read(); + else + { + printf("Unknown keyboard offset read access %02x\n",offset + 0x20); + res = 0; + } + + return res; +} + +WRITE8_MEMBER(fp200_state::fp200_keyb_w) +{ + if(offset == 1) + m_keyb_mux = data & 0xf; + else if(offset == 0) + { + // ... ? + } + else + printf("Unknown keyboard offset write access %02x %02x\n",offset + 0x20,data); +} + +/* +Annoyingly the i/o map uses the SOD to access different devices, so we need trampolines. +SOD = 0 +0x10 - 0x1f Timer control (RPC05 RTC) +0x20 - 0x2f AUTO-POWER OFF +0x40 - 0x4f FDC Device ID Code (5 for "FP-1021FD") +0x80 - 0xff FDD (unknown type) +SOD = 1 +0x00 - 0x0f LCD control. +0x10 - 0x1f I/O control +0x20 - 0x2f Keyboard +0x40 - 0x4f MT.RS-232C control +0x80 - 0x8f Printer (Centronics) +*/ +READ8_MEMBER(fp200_state::fp200_io_r) +{ + UINT8 res; + + if(m_io_type == 0) + { + res = 0; + logerror("Unemulated I/O read %02x (%02x)\n",offset,m_io_type); + } + else + { + switch(offset & 0xf0) + { + //case 0x00: return; + case 0x00: res = fp200_lcd_r(space, offset & 0xf); break; + case 0x20: res = fp200_keyb_r(space, offset & 0xf); break; + default: res = 0; logerror("Unemulated I/O read %02x (%02x)\n",offset,m_io_type); break; + } + } + + return res; +} + +WRITE8_MEMBER(fp200_state::fp200_io_w) +{ + if(m_io_type == 0) + { + switch(offset & 0xf0) + { + default:logerror("Unemulated I/O write %02x (%02x) <- %02x\n",offset,m_io_type,data); break; + } + } + else + { + switch(offset & 0xf0) + { + case 0x00: fp200_lcd_w(space, offset & 0xf,data); break; + case 0x20: fp200_keyb_w(space, offset & 0xf,data); break; + default:logerror("Unemulated I/O write %02x (%02x) <- %02x\n",offset,m_io_type,data); break; + } + } +} + +static ADDRESS_MAP_START( fp200_map, AS_PROGRAM, 8, fp200_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x9fff) AM_RAM +// 0xa000, 0xffff exp RAM + AM_RANGE(0xa000, 0xbfff) AM_RAM + AM_RANGE(0xc000, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( fp200_io, AS_IO, 8, fp200_state ) + AM_RANGE(0x00, 0xff) AM_READWRITE(fp200_io_r,fp200_io_w) +ADDRESS_MAP_END + +INPUT_CHANGED_MEMBER(fp200_state::keyb_irq) +{ + /* a keyboard stroke causes a rst7.5 */ + m_maincpu->set_input_line(I8085_RST75_LINE, (newval) ? ASSERT_LINE : CLEAR_LINE); + +} + +/* TODO: remote SW? */ +static INPUT_PORTS_START( fp200 ) + PORT_START("KEY0") + PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 / '") PORT_CODE(KEYCODE_7) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY1") + PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 / (") PORT_CODE(KEYCODE_8) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY2") + PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 / )") PORT_CODE(KEYCODE_9) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". / >") PORT_CODE(KEYCODE_STOP) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY3") + PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", / <") PORT_CODE(KEYCODE_COMMA) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; / +") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY4") +// PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) //PORT_TOGGLE PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INS / DEL") PORT_CODE(KEYCODE_INSERT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HOME / CLS") PORT_CODE(KEYCODE_HOME) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF0 / PF5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 / !") PORT_CODE(KEYCODE_1) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("STOP / CONT") PORT_CODE(KEYCODE_RIGHT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ / |") PORT_CODE(KEYCODE_RIGHT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF1 / PF6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 / \"") PORT_CODE(KEYCODE_2) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("^ / ~") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF2 / PF7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 / #") PORT_CODE(KEYCODE_3) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ / '") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- / =") PORT_CODE(KEYCODE_MINUS) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF3 / PF8") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 / $") PORT_CODE(KEYCODE_4) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": / *") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF4 / PF9") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 / %") PORT_CODE(KEYCODE_5) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEY9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] / }") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 / &") PORT_CODE(KEYCODE_6) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) + + PORT_START("KEYMOD") + PORT_BIT( 0x01f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CETL") PORT_TOGGLE + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + + PORT_START("UNUSED") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +static const gfx_layout charlayout = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { RGN_FRAC(0,1) }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + 8*8 +}; + +static GFXDECODE_START( fp200 ) + GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 1 ) +GFXDECODE_END + + +void fp200_state::machine_start() +{ + UINT8 *raw_gfx = memregion("raw_gfx")->base(); + m_chargen = memregion("chargen")->base(); + + for(int i=0;i<0x800;i++) + { + m_chargen[i] = raw_gfx[BITSWAP16(i,15,14,13,12,11,6,5,4,3,10,9,8,7,2,1,0)]; + } +} + +void fp200_state::machine_reset() +{ +} + + +PALETTE_INIT_MEMBER(fp200_state, fp200) +{ + palette.set_pen_color(0, 0xa0, 0xa8, 0xa0); + palette.set_pen_color(1, 0x30, 0x38, 0x10); +} + +WRITE_LINE_MEMBER( fp200_state::sod_w ) +{ + m_io_type = state; +} + +READ_LINE_MEMBER( fp200_state::sid_r ) +{ + return (ioport("KEYMOD")->read() >> m_keyb_mux) & 1; +} + +static MACHINE_CONFIG_START( fp200, fp200_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8085A,MAIN_CLOCK) + MCFG_CPU_PROGRAM_MAP(fp200_map) + MCFG_CPU_IO_MAP(fp200_io) + MCFG_I8085A_SID(READLINE(fp200_state, sid_r)) + MCFG_I8085A_SOD(WRITELINE(fp200_state, sod_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_UPDATE_DRIVER(fp200_state, screen_update) + MCFG_SCREEN_SIZE(20*8, 8*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 8*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", fp200) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(fp200_state, fp200) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( fp200 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "fp200rom.bin", 0x0000, 0x8000, CRC(dba6e41b) SHA1(c694fa19172eb56585a9503997655bcf9d369c34) ) + + ROM_REGION( 0x800, "raw_gfx", ROMREGION_ERASE00 ) + ROM_LOAD( "chr.bin", 0x0000, 0x800, CRC(2e6501a5) SHA1(6186e25feabe6db851ee7d61dad11e182a6d3a4a) ) + + ROM_REGION( 0x800, "chargen", ROMREGION_ERASE00 ) +ROM_END + +COMP( 1982, fp200, 0, 0, fp200, fp200, driver_device, 0, "Casio", "FP-200 (Japan)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/fp6000.c b/src/mame/drivers/fp6000.c new file mode 100644 index 00000000000..9a7866c339e --- /dev/null +++ b/src/mame/drivers/fp6000.c @@ -0,0 +1,330 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Casio FP-6000 + + preliminary driver by Angelo Salese + + TODO: + - keyboard; + - fdc / cmt; + - gvram color pen is a rather crude guess (the layer is monochrome on + BASIC?); + - everything else + + Debug trick for the keyboard: + - bp 0xfc93e, ip+=2 then define al = ASCII code + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "video/mc6845.h" + + +class fp6000_state : public driver_device +{ +public: + fp6000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_gvram(*this, "gvram"), + m_vram(*this, "vram"), + m_maincpu(*this, "maincpu") + , m_crtc(*this, "crtc"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + UINT8 *m_char_rom; + required_shared_ptr m_gvram; + required_shared_ptr m_vram; + UINT8 m_crtc_vreg[0x100],m_crtc_index; + + struct { + UINT16 cmd; + }m_key; + DECLARE_READ8_MEMBER(fp6000_pcg_r); + DECLARE_WRITE8_MEMBER(fp6000_pcg_w); + DECLARE_WRITE8_MEMBER(fp6000_6845_address_w); + DECLARE_WRITE8_MEMBER(fp6000_6845_data_w); + DECLARE_READ8_MEMBER(fp6000_key_r); + DECLARE_WRITE8_MEMBER(fp6000_key_w); + DECLARE_READ16_MEMBER(unk_r); + DECLARE_READ16_MEMBER(ex_board_r); + DECLARE_READ16_MEMBER(pit_r); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_fp6000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + required_devicem_crtc; + required_device m_gfxdecode; + required_device m_palette; +}; + +void fp6000_state::video_start() +{ +} + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + + +UINT32 fp6000_state::screen_update_fp6000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + int xi,yi; + UINT8 *gfx_rom = memregion("pcg")->base(); + UINT32 count; + + count = 0; + + for(y=0;y<400;y++) + { + for(x=0;x<640/4;x++) + { + for(xi=0;xi<4;xi++) + { + int dot = (m_gvram[count] >> (12-xi*4)) & 0xf; + + if(y < 400 && x*4+xi < 640) /* TODO: safety check */ + bitmap.pix16(y, x*4+xi) = m_palette->pen(dot); + } + + count++; + } + } + + for(y=0;y> 8; + int pen; + + for(yi=0;yi> (7-xi) & 1) ? color : -1; + + if(pen != -1) + if(y*mc6845_tile_height < 400 && x*8+xi < 640) /* TODO: safety check */ + bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); + } + } + } + } + + /* quick and dirty way to do the cursor */ + for(yi=0;yipen(7); + } + } + } + + return 0; +} + +READ8_MEMBER(fp6000_state::fp6000_pcg_r) +{ + return m_char_rom[offset]; +} + +WRITE8_MEMBER(fp6000_state::fp6000_pcg_w) +{ + m_char_rom[offset] = data; + m_gfxdecode->gfx(0)->mark_dirty(offset >> 4); +} + +WRITE8_MEMBER(fp6000_state::fp6000_6845_address_w) +{ + m_crtc_index = data; + m_crtc->address_w(space, offset, data); +} + +WRITE8_MEMBER(fp6000_state::fp6000_6845_data_w) +{ + m_crtc_vreg[m_crtc_index] = data; + m_crtc->register_w(space, offset, data); +} + +static ADDRESS_MAP_START(fp6000_map, AS_PROGRAM, 16, fp6000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0xbffff) AM_RAM + AM_RANGE(0xc0000,0xdffff) AM_RAM AM_SHARE("gvram")//gvram + AM_RANGE(0xe0000,0xe0fff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xe7000,0xe7fff) AM_READWRITE8(fp6000_pcg_r,fp6000_pcg_w,0xffff) + AM_RANGE(0xf0000,0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +/* Hack until I understand what UART is this one ... */ +READ8_MEMBER(fp6000_state::fp6000_key_r) +{ + if(offset) + { + switch(m_key.cmd) + { + case 0x7e15: return 3; + case 0x1b15: return 1; + case 0x2415: return 0; + default: printf("%04x\n",m_key.cmd); + } + return 0; + } + + return 0x40; +} + +WRITE8_MEMBER(fp6000_state::fp6000_key_w) +{ + if(offset) + m_key.cmd = (data & 0xff) | (m_key.cmd << 8); + else + m_key.cmd = (data << 8) | (m_key.cmd & 0xff); +} + +READ16_MEMBER(fp6000_state::unk_r) +{ + return 0x40; +} + +READ16_MEMBER(fp6000_state::ex_board_r) +{ + return 0xffff; +} + +READ16_MEMBER(fp6000_state::pit_r) +{ + return machine().rand(); +} + +static ADDRESS_MAP_START(fp6000_io, AS_IO, 16, fp6000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x08, 0x09) AM_READ(ex_board_r) // BIOS of some sort ... + AM_RANGE(0x0a, 0x0b) AM_READ_PORT("DSW") // installed RAM id? + AM_RANGE(0x10, 0x11) AM_READNOP + AM_RANGE(0x20, 0x23) AM_READWRITE8(fp6000_key_r,fp6000_key_w,0x00ff) + AM_RANGE(0x38, 0x39) AM_READ(pit_r) // pit? + AM_RANGE(0x70, 0x71) AM_WRITE8(fp6000_6845_address_w,0x00ff) + AM_RANGE(0x72, 0x73) AM_WRITE8(fp6000_6845_data_w,0x00ff) + AM_RANGE(0x74, 0x75) AM_READ(unk_r) //bit 6 busy flag +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( fp6000 ) + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x00, "DSW" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0xe0, 0x40, "Installed RAM banks" ) + PORT_DIPSETTING( 0xe0, "0" ) + PORT_DIPSETTING( 0xc0, "1" ) + PORT_DIPSETTING( 0xa0, "2" ) + PORT_DIPSETTING( 0x80, "3" ) + PORT_DIPSETTING( 0x60, "4" ) + PORT_DIPSETTING( 0x40, "5" ) + PORT_DIPSETTING( 0x20, "6 (INVALID)" ) //exceeds 768KB limit (writes to gvram et al) + PORT_DIPSETTING( 0x00, "7 (INVALID)" ) +INPUT_PORTS_END + +static const gfx_layout fp6000_charlayout = +{ + 8, 16, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP8(0,1) }, + { STEP16(0,8) }, + 8*16 +}; + +static GFXDECODE_START( fp6000 ) + GFXDECODE_ENTRY( "pcg", 0x0000, fp6000_charlayout, 0, 1 ) +GFXDECODE_END + + +void fp6000_state::machine_start() +{ + m_char_rom = memregion("pcg")->base(); +} + +void fp6000_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( fp6000, fp6000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 16000000/2) + MCFG_CPU_PROGRAM_MAP(fp6000_map) + MCFG_CPU_IO_MAP(fp6000_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(fp6000_state, screen_update_fp6000) + MCFG_SCREEN_PALETTE("palette") + + MCFG_MC6845_ADD("crtc", H46505, "screen", 16000000/5) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_PALETTE_ADD("palette", 8) +// MCFG_PALETTE_INIT(black_and_white) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", fp6000) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( fp6000 ) + ROM_REGION( 0x10000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x10000, CRC(c72fe40a) SHA1(0e4c60dc27f6c7f461c4bc382b81602b3327a7a4)) + + ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) + ROM_LOAD( "mcu", 0x0000, 0x1000, NO_DUMP ) //unknown MCU type + + ROM_REGION( 0x10000, "pcg", ROMREGION_ERASE00 ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, fp6000, 0, 0, fp6000, fp6000, driver_device, 0, "Casio", "FP-6000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/ft68m.c b/src/mame/drivers/ft68m.c new file mode 100644 index 00000000000..a4d5b4da4a6 --- /dev/null +++ b/src/mame/drivers/ft68m.c @@ -0,0 +1,128 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Forward Technology FT-68M Multibus card. + +2013-09-26 Skeleton driver + +Chips: HD68000-10, uPD7201C, AM9513APC. Crystal: 19.6608 MHz + +Interrupts: INT6 is output of Timer 2, INT7 is output of Timer 3 (refresh), + INT5 comes from SIO. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class ft68m_state : public driver_device +{ +public: + ft68m_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_base(*this, "rambase"), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ16_MEMBER(keyin_r); + DECLARE_READ16_MEMBER(status_r); + DECLARE_READ16_MEMBER(switches_r); +private: + UINT8 m_term_data; + virtual void machine_reset(); + required_shared_ptr m_p_base; + required_device m_maincpu; + required_device m_terminal; +}; + +READ16_MEMBER( ft68m_state::keyin_r ) +{ + UINT16 ret = m_term_data; + m_term_data = 0; + return ret << 8; +} + +READ16_MEMBER( ft68m_state::status_r ) +{ + return (m_term_data) ? 0x500 : 0x400; +} + +READ16_MEMBER( ft68m_state::switches_r ) +{ + return 0x7c00; // bypass self test +} + + +static ADDRESS_MAP_START(ft68m_mem, AS_PROGRAM, 16, ft68m_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xffffff) + AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("rambase") + AM_RANGE(0x200000, 0x201fff) AM_ROM AM_REGION("roms", 0x0000) + AM_RANGE(0x400000, 0x401fff) AM_ROM AM_REGION("roms", 0x2000) + AM_RANGE(0x600000, 0x600001) AM_READ(keyin_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff00) + AM_RANGE(0x600002, 0x600003) AM_READ(status_r) + //AM_RANGE(0x600000, 0x600003) AM_MIRROR(0x1ffffc) uPD7201 SIO + //AM_RANGE(0x800000, 0x800003) AM_MIRROR(0x1ffffc) AM9513 Timer + AM_RANGE(0xa00000, 0xbfffff) AM_RAM //Page Map + AM_RANGE(0xc00000, 0xdfffff) AM_RAM //Segment Map + AM_RANGE(0xe00000, 0xffffff) AM_READ(switches_r) //Context Register +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( ft68m ) +INPUT_PORTS_END + + +void ft68m_state::machine_reset() +{ + UINT8* ROM = memregion("roms")->base(); + memcpy(m_p_base, ROM, 8); + m_maincpu->reset(); +} + +WRITE8_MEMBER( ft68m_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( ft68m, ft68m_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_19_6608MHz / 2) + MCFG_CPU_PROGRAM_MAP(ft68m_mem) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ft68m_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ft68m ) + ROM_REGION16_BE(0x4000, "roms", 0) + ROM_LOAD16_BYTE("23-0009-01c.a4", 0x0000, 0x1000, CRC(0d45fc8d) SHA1(59587cb1c151bfd0d69e708716ed3b0a78aa85ea) ) + ROM_LOAD16_BYTE("23-0008-01c.a1", 0x0001, 0x1000, CRC(d1aa1164) SHA1(05e10f1c594e2acd369949b873a524a9cc37829f) ) + ROM_LOAD16_BYTE( "33-01.a6", 0x2000, 0x1000, CRC(53fe3c73) SHA1(ad15c74cd8edef9d9716ad0d16f7a95ff2af901f) ) + ROM_LOAD16_BYTE( "33-00.a3", 0x2001, 0x1000, CRC(06b1cc77) SHA1(12e3314e92f800b3c4ebdf55dcd5351230224788) ) + + ROM_REGION(0x700, "proms", 0) + ROM_LOAD("23-0010-00.a15", 0x000, 0x020, CRC(20eb1183) SHA1(9b268792b28d858d6b6a1b6c4148af88a8d6b735) ) + ROM_LOAD("23-0011-00.a14", 0x100, 0x200, CRC(12d9a6be) SHA1(fca99f9c5afc630ac67cbd4e5ba4e5242b826848) ) + ROM_LOAD("23-0012-00.a16", 0x300, 0x020, CRC(ee1e5a14) SHA1(0d3346cb3b647fa2475bd7b4fa36ea6ecfdaf805) ) + ROM_LOAD("23-0034-00.e4", 0x400, 0x100, CRC(1a573887) SHA1(459bd2d8dc8c4b1c0a529984ae8e38d0c81a084c) ) + ROM_LOAD("23-0037-00.e7", 0x500, 0x100, CRC(9ed4b7f6) SHA1(136a74567094d8462c3a4de1b7e6eb8f30fe71ca) ) + ROM_LOAD("23-0038-00.f1", 0x600, 0x100, CRC(3e56cce5) SHA1(f30a8d5d744bfc25493cd1e92961bbb75f9e0d05) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, ft68m, 0, 0, ft68m, ft68m, driver_device, 0, "Forward Technology", "FT-68M", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/galaxy.c b/src/mame/drivers/galaxy.c new file mode 100644 index 00000000000..a8be2d524e0 --- /dev/null +++ b/src/mame/drivers/galaxy.c @@ -0,0 +1,274 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha, Miodrag Milanovic +/*************************************************************************** +Galaksija driver by Krzysztof Strzecha and Miodrag Milanovic + +22/05/2008 Tape support added (Miodrag Milanovic) +21/05/2008 Galaksija plus initial support (Miodrag Milanovic) +20/05/2008 Added real video implementation (Miodrag Milanovic) +18/04/2005 Possibilty to disable ROM 2. 2k, 22k, 38k and 54k memory + configurations added. +13/03/2005 Memory mapping improved. Palette corrected. Supprort for newer + version of snapshots added. Lot of cleanups. Keyboard mapping + corrected. +19/09/2002 malloc() replaced by image_malloc(). +15/09/2002 Snapshot loading fixed. Code cleanup. +31/01/2001 Snapshot loading corrected. +09/01/2001 Fast mode implemented (many thanks to Kevin Thacker). +07/01/2001 Keyboard corrected (still some keys unknown). + Horizontal screen positioning in video subsystem added. +05/01/2001 Keyboard implemented (some keys unknown). +03/01/2001 Snapshot loading added. +01/01/2001 Preliminary driver. + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/wave.h" +#include "includes/galaxy.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/ay8910.h" +#include "formats/gtp_cas.h" +#include "machine/ram.h" + +static ADDRESS_MAP_START (galaxyp_io, AS_IO, 8, galaxy_state ) + ADDRESS_MAP_GLOBAL_MASK(0x01) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xbe, 0xbe) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0xbf, 0xbf) AM_DEVWRITE("ay8910", ay8910_device, data_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START (galaxy_mem, AS_PROGRAM, 8, galaxy_state ) + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ(galaxy_keyboard_r ) + AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE(galaxy_latch_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START (galaxyp_mem, AS_PROGRAM, 8, galaxy_state ) + AM_RANGE(0x0000, 0x0fff) AM_ROM // ROM A + AM_RANGE(0x1000, 0x1fff) AM_ROM // ROM B + AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ(galaxy_keyboard_r ) + AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE(galaxy_latch_w ) + AM_RANGE(0xe000, 0xefff) AM_ROM // ROM C + AM_RANGE(0xf000, 0xffff) AM_ROM // ROM D +ADDRESS_MAP_END + +/* 2008-05 FP: +Small note about natural keyboard support. Currently: +- "List" is mapped to 'ESC' +- "Break" is mapped to 'F1' +- "Repeat" is mapped to 'F2' */ + +static INPUT_PORTS_START (galaxy_common) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('-') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_PAUSE) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("List") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( galaxy ) + PORT_INCLUDE( galaxy_common ) + PORT_START("ROM2") + PORT_CONFNAME(0x01, 0x01, "ROM 2") + PORT_CONFSETTING(0x01, "Installed") + PORT_CONFSETTING(0x00, "Not installed") +INPUT_PORTS_END + +static INPUT_PORTS_START( galaxyp ) + PORT_INCLUDE( galaxy_common ) +INPUT_PORTS_END + +#define XTAL 6144000 + +/* F4 Character Displayer */ +static const gfx_layout galaxy_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8, 8*128*8, 9*128*8, 10*128*8, 11*128*8, 12*128*8, 13*128*8, 14*128*8, 15*128*8 }, + 8 /* every char takes 1 x 16 bytes */ +}; + +static GFXDECODE_START( galaxy ) + GFXDECODE_ENTRY( "gfx1", 0x0000, galaxy_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( galaxy, galaxy_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL / 2) + MCFG_CPU_PROGRAM_MAP(galaxy_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", galaxy_state, galaxy_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(galaxy_state,galaxy_irq_callback) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_PALETTE("palette") + + MCFG_MACHINE_RESET_OVERRIDE(galaxy_state, galaxy ) + + /* video hardware */ + MCFG_SCREEN_SIZE(384, 212) + MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 208-1) + MCFG_SCREEN_UPDATE_DRIVER(galaxy_state, screen_update_galaxy) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", galaxy) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + /* snapshot */ + MCFG_SNAPSHOT_ADD("snapshot", galaxy_state, galaxy, "gal", 0) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(gtp_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("galaxy_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","galaxy") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("6K") + MCFG_RAM_EXTRA_OPTIONS("2K,22K,38K,54K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( galaxyp, galaxy_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL / 2) + MCFG_CPU_PROGRAM_MAP(galaxyp_mem) + MCFG_CPU_IO_MAP(galaxyp_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", galaxy_state, galaxy_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(galaxy_state,galaxy_irq_callback) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_PALETTE("palette") + + MCFG_MACHINE_RESET_OVERRIDE(galaxy_state, galaxyp ) + + /* video hardware */ + MCFG_SCREEN_SIZE(384, 208) + MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 208-1) + MCFG_SCREEN_UPDATE_DRIVER(galaxy_state, screen_update_galaxy) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + /* snapshot */ + MCFG_SNAPSHOT_ADD("snapshot", galaxy_state, galaxy, "gal", 0) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay8910", AY8910, XTAL/4) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(gtp_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("galaxy_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","galaxy") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("38K") +MACHINE_CONFIG_END + +ROM_START (galaxy) + ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(365f3e24) SHA1(ffc6bf2ec09eabdad76604a63f5dd697c30c4358)) + ROM_LOAD_OPTIONAL ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88)) +ROM_END + +ROM_START (galaxyp) + ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(365f3e24) SHA1(ffc6bf2ec09eabdad76604a63f5dd697c30c4358)) + ROM_LOAD ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1)) + ROM_LOAD ("galplus.bin", 0xe000, 0x1000, CRC(d4cfab14) SHA1(b507b9026844eeb757547679907394aa42055eee)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP(1983, galaxy, 0, 0, galaxy, galaxy, galaxy_state, galaxy, "Elektronika inzenjering", "Galaksija", 0) +COMP(1985, galaxyp, galaxy, 0, galaxyp,galaxyp, galaxy_state,galaxyp,"Elektronika inzenjering", "Galaksija plus", 0) diff --git a/src/mame/drivers/galeb.c b/src/mame/drivers/galeb.c new file mode 100644 index 00000000000..64d24d912e0 --- /dev/null +++ b/src/mame/drivers/galeb.c @@ -0,0 +1,171 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Galeb driver by Miodrag Milanovic + + 01/03/2008 Updated to work with latest SVN code + 23/02/2008 Sound support added. + 22/02/2008 Preliminary driver. + + Driver is based on work of Josip Perusanec + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "sound/dac.h" +#include "includes/galeb.h" + +static GFXDECODE_START( galeb ) + GFXDECODE_ENTRY( "gfx1", 0x0000, galeb_charlayout, 0, 1 ) +GFXDECODE_END + +READ8_MEMBER(galeb_state::galeb_keyboard_r) +{ + static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; + + return ioport(keynames[offset])->read(); +} + +/* Address maps */ +static ADDRESS_MAP_START(galeb_mem, AS_PROGRAM, 8, galeb_state ) + AM_RANGE( 0x0000, 0x1fff ) AM_RAM // RAM + AM_RANGE( 0xbfe0, 0xbfe7 ) AM_READ(galeb_keyboard_r ) + AM_RANGE( 0xbfe0, 0xbfe0 ) AM_DEVWRITE("dac", dac_device, write_unsigned8) + AM_RANGE( 0xb000, 0xb3ff ) AM_RAM AM_SHARE("video_ram") // video ram + AM_RANGE( 0xc000, 0xc7ff ) AM_ROM // BASIC 01 ROM + AM_RANGE( 0xc800, 0xcfff ) AM_ROM // BASIC 02 ROM + AM_RANGE( 0xd000, 0xd7ff ) AM_ROM // BASIC 03 ROM + AM_RANGE( 0xd800, 0xdfff ) AM_ROM // BASIC 04 ROM + AM_RANGE( 0xf000, 0xf7ff ) AM_ROM // Monitor ROM + AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( galeb ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GR") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down - Up") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dj") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left - Right") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sh") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cj") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Zh") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ch") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/* Machine driver */ +static MACHINE_CONFIG_START( galeb, galeb_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 1000000) + MCFG_CPU_PROGRAM_MAP(galeb_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(48*8, 16*8) + MCFG_SCREEN_VISIBLE_AREA(0, 48*8-1, 0, 16*8-1) + MCFG_SCREEN_UPDATE_DRIVER(galeb_state, screen_update_galeb) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", galeb ) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 8.00) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( galeb ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bas01.rom", 0xc000, 0x0800, CRC(9b19ed58) SHA1(ebfc27af8dbabfb233f9888e6a0a0dfc87ae1691) ) + ROM_LOAD( "bas02.rom", 0xc800, 0x0800, CRC(3f320a84) SHA1(4ea082b4269dca6152426b1f720c7508122d3cb7) ) + ROM_LOAD( "bas03.rom", 0xd000, 0x0800, CRC(f122ad10) SHA1(3c7c1dd67268230d179a00b0f8b35be80c2b7035) ) + ROM_LOAD( "bas04.rom", 0xd800, 0x0800, CRC(b5372a83) SHA1(f93b73d98b943c6791f46617418fb5e4238d75bd) ) + ROM_LOAD( "exmd.rom", 0xf000, 0x0800, CRC(1bcb1375) SHA1(fda3361d238720a3d309644093da9832d5aff661) ) + ROM_LOAD( "makbug.rom",0xf800, 0x0800, CRC(91e38e79) SHA1(2b6439a09a470cda9c81b9d453c6380b99716989) ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("chrgen.bin", 0x0000, 0x0800, CRC(409a800e) SHA1(0efe429dd6c0568032636e691d9865a623afeb55)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, galeb, 0, 0, galeb, galeb, driver_device, 0, "PEL Varazdin", "Galeb", 0) diff --git a/src/mame/drivers/gamate.c b/src/mame/drivers/gamate.c new file mode 100644 index 00000000000..ad1e129e60c --- /dev/null +++ b/src/mame/drivers/gamate.c @@ -0,0 +1,408 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + PeT mess@utanet.at 2007, 2014 + Peter Wilhelmsen peter.wilhelmsen@gmail.com + Morten Shearman Kirkegaard morten+gamate@afdelingp.dk + Juan F??lix Mateos vectrex@hackermesh.org + + nmi unknown + bomb blast top status line missing + ******************************************************************************/ + +#include "emu.h" +#include "includes/gamate.h" +#include "ui/ui.h" + +class gamate_state : public driver_device +{ +public: + gamate_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_sound(*this, "custom") + , m_cart(*this, "cartslot") + , m_io_joy(*this, "JOY") + , m_palette(*this, "palette") + , m_bios(*this, "bios") + , m_bank(*this, "bank") + , m_bankmulti(*this, "bankmulti") + { } + + DECLARE_PALETTE_INIT(gamate); + DECLARE_READ8_MEMBER(protection_r); + DECLARE_READ8_MEMBER(newer_protection_set); + DECLARE_WRITE8_MEMBER(protection_reset); + DECLARE_READ8_MEMBER(gamate_cart_protection_r); + DECLARE_WRITE8_MEMBER(gamate_cart_protection_w); + DECLARE_WRITE8_MEMBER(cart_bankswitchmulti_w); + DECLARE_WRITE8_MEMBER(cart_bankswitch_w); + DECLARE_READ8_MEMBER(gamate_video_r); + DECLARE_READ8_MEMBER(gamate_nmi_r); + DECLARE_WRITE8_MEMBER(gamate_video_w); + DECLARE_WRITE8_MEMBER(gamate_bios_w); + DECLARE_DRIVER_INIT(gamate); + UINT32 screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(gamate_interrupt); + TIMER_CALLBACK_MEMBER(gamate_timer); + TIMER_CALLBACK_MEMBER(gamate_timer2); + +private: + virtual void machine_start(); + + struct + { + UINT8 reg[8]; + struct + { + bool page2; // else page1 + UINT8 ypos, xpos/*tennis*/; + UINT8 data[2][0x100][0x20]; + } bitmap; + UINT8 x, y; + bool y_increment; + } video; + + struct + { + bool set; + int bit_shifter; + UINT8 cartridge_byte; + UINT16 address; // in reality something more like short local cartridge address offset + bool unprotected; + bool failed; + } card_protection; + + required_device m_maincpu; + required_device m_sound; + required_device m_cart; + required_ioport m_io_joy; + required_device m_palette; + required_shared_ptr m_bios; + required_memory_bank m_bank; + required_memory_bank m_bankmulti; + emu_timer *timer1; + emu_timer *timer2; + UINT8 bank_multi; + UINT8 *m_cart_ptr; +}; + +WRITE8_MEMBER( gamate_state::gamate_cart_protection_w ) +{ + logerror("%.6f protection write %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, data, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter); + + switch (offset) + { + case 0: + card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0); + card_protection.bit_shifter++; + if (card_protection.bit_shifter>=8) + { + card_protection.cartridge_byte=m_cart_ptr[card_protection.address++]; + card_protection.bit_shifter=0; + } + break; + } +} + +READ8_MEMBER( gamate_state::gamate_cart_protection_r ) +{ + UINT8 ret=1; + if (card_protection.bit_shifter==7 && card_protection.unprotected) + { + ret=m_cart_ptr[bank_multi*0x4000]; + } + else + { + card_protection.bit_shifter++; + if (card_protection.bit_shifter==8) + { + card_protection.bit_shifter=0; + card_protection.cartridge_byte='G'; + card_protection.unprotected=true; + } + ret=(card_protection.cartridge_byte&0x80) ? 2 : 0; + if (card_protection.bit_shifter==7 && !card_protection.failed) + { // now protection chip on cartridge activates cartridge chip select on cpu accesses +// m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); // next time I will try to get this working + } + card_protection.cartridge_byte<<=1; + } + logerror("%.6f protection read %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, ret, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter); + return ret; +} + +READ8_MEMBER( gamate_state::protection_r ) +{ + return card_protection.set? 3: 1; +} // bits 0 and 1 checked + +WRITE8_MEMBER( gamate_state::protection_reset ) +{ +// writes 0x20 + card_protection.address=0x6005-0x6001; + card_protection.bit_shifter=0; + card_protection.cartridge_byte=m_cart_ptr[card_protection.address++]; //m_cart_rom[card_protection.address++]; + card_protection.failed=false; + card_protection.unprotected=false; +} + +READ8_MEMBER( gamate_state::newer_protection_set ) +{ + card_protection.set=true; + return 0; +} + +WRITE8_MEMBER( gamate_state::gamate_video_w ) +{ + video.reg[offset]=data; + switch (offset) + { + case 1: + if (data&0xf) + printf("lcd mode %x\n", data); + video.y_increment=data&0x40; + break; + case 2: + video.bitmap.xpos=data; + break; + case 3: + if (data>=200) + printf("lcd ypos: %x\n", data); + video.bitmap.ypos=data; + break; + case 4: + video.bitmap.page2=data&0x80; + video.x=data&0x1f; + break; + case 5: + video.y=data; + break; + case 7: + video.bitmap.data[video.bitmap.page2][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data; + if (video.y_increment) + video.y++; + else + video.x++; // overruns + } +} + +WRITE8_MEMBER( gamate_state::cart_bankswitchmulti_w ) +{ + bank_multi=data; + m_bankmulti->set_base(m_cart_ptr+0x4000*data+1); +} + +WRITE8_MEMBER( gamate_state::cart_bankswitch_w ) +{ + m_bank->set_base(m_cart_ptr+0x4000*data); +} + +READ8_MEMBER( gamate_state::gamate_video_r ) +{ + if (offset!=6) + return 0; + UINT8 data = video.bitmap.data[video.bitmap.page2][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]; +// if (m_maincpu->pc()<0xf000) +// machine().ui().popup_time(2, "lcd read x:%x y:%x mode:%x data:%x\n", video.x, video.y, video.reg[1], data); + if (video.y_increment) + video.y++; + else + video.x++; // overruns? + + return data; +} + +READ8_MEMBER( gamate_state::gamate_nmi_r ) +{ + UINT8 data=0; + machine().ui().popup_time(2, "nmi/4800 read\n"); + return data; +} + +static ADDRESS_MAP_START( gamate_mem, AS_PROGRAM, 8, gamate_state ) + AM_RANGE(0x0000, 0x03ff) AM_RAM + AM_RANGE(0x4000, 0x400d) AM_DEVREADWRITE("custom", gamate_sound_device, device_r, device_w) + AM_RANGE(0x4400, 0x4400) AM_READ_PORT("JOY") + AM_RANGE(0x4800, 0x4800) AM_READ(gamate_nmi_r) + AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w) + AM_RANGE(0x5800, 0x5800) AM_READ(newer_protection_set) + AM_RANGE(0x5900, 0x5900) AM_WRITE(protection_reset) + AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r) + AM_RANGE(0x6001, 0x9fff) AM_READ_BANK("bankmulti") + AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank") + AM_RANGE(0x6000, 0x6000) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w) + AM_RANGE(0x8000, 0x8000) AM_WRITE(cart_bankswitchmulti_w) + AM_RANGE(0xc000, 0xc000) AM_WRITE(cart_bankswitch_w) + AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios") +ADDRESS_MAP_END + + +static INPUT_PORTS_START( gamate ) + PORT_START("JOY") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("A") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("B") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") +INPUT_PORTS_END + +/* palette in red, green, blue tribles */ +static const unsigned char gamate_colors[4][3] = +{ + { 255,255,255 }, + { 0xa0, 0xa0, 0xa0 }, + { 0x60, 0x60, 0x60 }, + { 0, 0, 0 } +}; + +PALETTE_INIT_MEMBER(gamate_state, gamate) +{ + int i; + + for (i = 0; i < 4; i++) + { + palette.set_pen_color(i, gamate_colors[i][0], gamate_colors[i][1], gamate_colors[i][2]); + } +} + +static void BlitPlane(UINT16* line, UINT8 plane1, UINT8 plane2) +{ + line[3]=(plane1&1)|((plane2<<1)&2); + line[2]=((plane1>>1)&1)|((plane2<<0)&2); + line[1]=((plane1>>2)&1)|((plane2>>1)&2); + line[0]=((plane1>>3)&1)|((plane2>>2)&2); +} + +UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, j; + for (y=0;y<152;y++) + { + for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) + { + UINT8 d1, d2; + if (video.bitmap.ypos<200) + { + d1=video.bitmap.data[0][(y+video.bitmap.ypos)%200][(j+video.bitmap.xpos/8)&0x1f]; + d2=video.bitmap.data[1][(y+video.bitmap.ypos)%200][(j+video.bitmap.xpos/8)&0x1f]; + } + else + if ((video.bitmap.ypos&0xf)<8) + { // lcdtest, of course still some registers not known, my gamate doesn't display bottom lines; most likely problematic 200 warp around hardware! no real usage + int yi=(y+(video.bitmap.ypos&0xf)-8); + if (yi<0) + yi=video.bitmap.ypos+y; // in this case only 2nd plane used!?, source of first plane? + d1=video.bitmap.data[0][yi][(j+video.bitmap.xpos/8)&0x1f]; // value of lines bevor 0 chaos + d2=video.bitmap.data[1][yi][(j+video.bitmap.xpos/8)&0x1f]; + } + else + { + d1=video.bitmap.data[0][y][(j+video.bitmap.xpos/8)&0x1f]; + d2=video.bitmap.data[1][y][(j+video.bitmap.xpos/8)&0x1f]; + } + BlitPlane(&bitmap.pix16(y, x+4), d1, d2); + BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4); + } + } + return 0; +} + +DRIVER_INIT_MEMBER(gamate_state,gamate) +{ + memset(&video, 0, sizeof(video));/* memset(m_ram, 0, sizeof(m_ram));*/ + timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer),this)); + timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer2),this)); +} + + +void gamate_state::machine_start() +{ + m_cart_ptr = memregion("maincpu")->base() + 0x6000; + if (m_cart->exists()) + { +// m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); + m_cart_ptr = m_cart->get_rom_base(); + m_bankmulti->set_base(m_cart->get_rom_base()+1); + m_bank->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset + } +// m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback + card_protection.set=false; + bank_multi=0; + card_protection.unprotected=false; + timer2->enable(TRUE); + timer2->reset(m_maincpu->cycles_to_attotime(1000)); +#if 0 + save_item(NAME(m_video.data)); + save_item(NAME(m_video.index)); + save_item(NAME(m_video.x)); + save_item(NAME(m_video.y)); + save_item(NAME(m_video.mode)); + save_item(NAME(m_video.delayed)); + save_item(NAME(m_video.pixels)); + save_item(NAME(m_ports)); + save_item(NAME(m_ram)); +#endif +} + +TIMER_CALLBACK_MEMBER(gamate_state::gamate_timer) +{ + m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); + timer1->enable(FALSE); +} + +TIMER_CALLBACK_MEMBER(gamate_state::gamate_timer2) +{ + m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + timer1->enable(TRUE); + timer1->reset(m_maincpu->cycles_to_attotime(10/* cycles short enought to clear irq line early enough*/)); + timer2->enable(TRUE); + timer2->reset(m_maincpu->cycles_to_attotime(32768/2)); +} + + +INTERRUPT_GEN_MEMBER(gamate_state::gamate_interrupt) +{ +} + +static MACHINE_CONFIG_START( gamate, gamate_state ) + MCFG_CPU_ADD("maincpu", M6502, 4433000/2) + MCFG_CPU_PROGRAM_MAP(gamate_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", gamate_state, gamate_interrupt) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(160, 152) + MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 152-1) + MCFG_SCREEN_UPDATE_DRIVER(gamate_state, screen_update_gamate) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors)) + MCFG_PALETTE_INIT_OWNER(gamate_state, gamate) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("custom", GAMATE_SND, 4433000/2) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "gamate_cart") + MCFG_SOFTWARE_LIST_ADD("cart_list","gamate") +MACHINE_CONFIG_END + + +ROM_START(gamate) + ROM_REGION(0x10000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "default", "DEFAULT") + ROMX_LOAD("gamate_bios_umc.bin", 0xf000, 0x1000, CRC(07090415) SHA1(ea449dc607601f9a68d855ad6ab53800d2e99297), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "newer", "NEWER") + ROMX_LOAD("gamate_bios_9130__unknown__bit_icasc00001_9130-bs_r32261.bin", 0xf000, 0x1000, CRC(03a5f3a7) SHA1(4e9dfbfe916ca485530ef4221593ab68738e2217), ROM_BIOS(2) ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +CONS( 19??, gamate, 0, 0, gamate, gamate, gamate_state, gamate, "Bit Corp", "Gamate", 0) diff --git a/src/mame/drivers/gamecom.c b/src/mame/drivers/gamecom.c new file mode 100644 index 00000000000..8b843aa55c8 --- /dev/null +++ b/src/mame/drivers/gamecom.c @@ -0,0 +1,299 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Robbbert +/*************************************************************************** + +Driver file to handle emulation of the Tiger Game.com by + Wilbert Pol + +Todo: +- Fix cpu and system problems that prevent the games from working. + +Game Status: +- The DAC sound partially works, sound from ports 1,2,3 not done +- Inbuilt ROM and PDA functions all work +- On the screen where the cart goes into the slot there is video flicker +- Due to an irritating message, the NVRAM is commented out in the machine config +- Most of the cart games have severe video issues such as flickering and nonsense gfx +- Lights Out works +- Centipede works +- Wheel of Fortune 1 & 2 are working. +- Frogger works, but it is difficult to capture the female frog or the insect. +- Quiz Wiz works, but the end-of-round score doesn't show +- Jeopardy, playable with bad gfx +- Tiger Web Link & Internet, they look ok, obviously aren't going to connect to anything +- Williams Arcade Classics, Robotron works, the rest are no use. +- Monopoly is starting to show promise. It's playable but the video is terrible. +- The remaining carts are not functional to any useful degree. + +***************************************************************************/ + +#include "includes/gamecom.h" +#include "gamecom.lh" + +static ADDRESS_MAP_START(gamecom_mem_map, AS_PROGRAM, 8, gamecom_state) + AM_RANGE( 0x0000, 0x0013 ) AM_RAM AM_REGION("maincpu", 0x00) + AM_RANGE( 0x0014, 0x0017 ) AM_READWRITE( gamecom_pio_r, gamecom_pio_w ) // buttons + AM_RANGE( 0x0018, 0x001F ) AM_RAM AM_REGION("maincpu", 0x18) + AM_RANGE( 0x0020, 0x007F ) AM_READWRITE( gamecom_internal_r, gamecom_internal_w )/* CPU internal register file */ + AM_RANGE( 0x0080, 0x03FF ) AM_RAM AM_REGION("maincpu", 0x80) /* RAM */ + AM_RANGE( 0x0400, 0x0FFF ) AM_NOP /* Nothing */ + AM_RANGE( 0x1000, 0x1FFF ) AM_ROM /* Internal ROM (initially), or External ROM/Flash. Controlled by MMU0 (never swapped out in game.com) */ + AM_RANGE( 0x2000, 0x3FFF ) AM_ROMBANK("bank1") /* External ROM/Flash. Controlled by MMU1 */ + AM_RANGE( 0x4000, 0x5FFF ) AM_ROMBANK("bank2") /* External ROM/Flash. Controlled by MMU2 */ + AM_RANGE( 0x6000, 0x7FFF ) AM_ROMBANK("bank3") /* External ROM/Flash. Controlled by MMU3 */ + AM_RANGE( 0x8000, 0x9FFF ) AM_ROMBANK("bank4") /* External ROM/Flash. Controlled by MMU4 */ + AM_RANGE( 0xA000, 0xDFFF ) AM_RAM AM_SHARE("videoram") /* VRAM */ + AM_RANGE( 0xE000, 0xFFFF ) AM_RAM AM_SHARE("nvram") /* Extended I/O, Extended RAM */ +ADDRESS_MAP_END + +static INPUT_PORTS_START( gamecom ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME( "Up" ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME( "Down" ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME( "Left" ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME( "Right" ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Menu" ) PORT_CODE( KEYCODE_M ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( DEF_STR(Pause) ) PORT_CODE( KEYCODE_V ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Sound" ) PORT_CODE( KEYCODE_S ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Button A" ) PORT_CODE( KEYCODE_A ) PORT_CODE( KEYCODE_LCONTROL ) + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Button B" ) PORT_CODE( KEYCODE_B ) PORT_CODE( KEYCODE_LALT ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME( "Button C" ) PORT_CODE( KEYCODE_C ) PORT_CODE( KEYCODE_SPACE ) + + PORT_START("IN2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Reset" ) PORT_CODE( KEYCODE_N ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME( "Button D" ) PORT_CODE( KEYCODE_D ) PORT_CODE( KEYCODE_LSHIFT ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Stylus press" ) PORT_CODE( KEYCODE_Z ) PORT_CODE( MOUSECODE_BUTTON1 ) + + PORT_START("GRID.0") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.1") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.2") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.3") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.4") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.5") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.6") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.7") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.8") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.9") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.10") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.11") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + + PORT_START("GRID.12") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) + INPUT_PORTS_END + +PALETTE_INIT_MEMBER(gamecom_state, gamecom) +{ + palette.set_pen_color(0, 0x00, 0x00, 0x00 ); // Black + palette.set_pen_color(1, 0x0F, 0x4F, 0x2F ); // Gray 1 + palette.set_pen_color(2, 0x6F, 0x8F, 0x4F ); // Gray 2 + palette.set_pen_color(3, 0x8F, 0xCF, 0x8F ); // Grey 3 + palette.set_pen_color(4, 0xDF, 0xFF, 0x8F ); // White +} + +UINT32 gamecom_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + +INTERRUPT_GEN_MEMBER(gamecom_state::gamecom_interrupt) +{ + m_maincpu->set_input_line(sm8500_cpu_device::LCDC_INT, ASSERT_LINE ); +} + +static MACHINE_CONFIG_START( gamecom, gamecom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", SM8500, XTAL_11_0592MHz/2 ) /* actually it's an sm8521 microcontroller containing an sm8500 cpu */ + MCFG_CPU_PROGRAM_MAP( gamecom_mem_map) + MCFG_SM8500_DMA_CB( WRITE8( gamecom_state, gamecom_handle_dma ) ) + MCFG_SM8500_TIMER_CB( WRITE8( gamecom_state, gamecom_update_timers ) ) + MCFG_CPU_VBLANK_INT_DRIVER("screen", gamecom_state, gamecom_interrupt) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + //MCFG_NVRAM_ADD_0FILL("nvram") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE( 59.732155 ) + MCFG_SCREEN_VBLANK_TIME(500) + MCFG_SCREEN_UPDATE_DRIVER(gamecom_state, screen_update) + MCFG_SCREEN_SIZE( 208, 160 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 207, 0, 159 ) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_gamecom) + MCFG_PALETTE_ADD("palette", 5) + MCFG_PALETTE_INIT_OWNER(gamecom_state, gamecom) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO( "lspeaker", "rspeaker" ) + /* TODO: much more complex than this */ + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.00) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.00) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_linear_slot, "gamecom_cart") + MCFG_GENERIC_EXTENSIONS("bin,tgc") + MCFG_GENERIC_LOAD(gamecom_state, gamecom_cart1) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_linear_slot, "gamecom_cart") + MCFG_GENERIC_EXTENSIONS("bin,tgc") + MCFG_GENERIC_LOAD(gamecom_state, gamecom_cart2) + + MCFG_SOFTWARE_LIST_ADD("cart_list","gamecom") +MACHINE_CONFIG_END + +ROM_START( gamecom ) + ROM_REGION( 0x2000, "maincpu", 0 ) + ROM_LOAD( "internal.bin", 0x1000, 0x1000, CRC(a0cec361) SHA1(03368237e8fed4a8724f3b4a1596cf4b17c96d33) ) + + ROM_REGION( 0x40000, "kernel", 0 ) + ROM_LOAD( "external.bin", 0x00000, 0x40000, CRC(e235a589) SHA1(97f782e72d738f4d7b861363266bf46b438d9b50) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +CONS( 1997, gamecom, 0, 0, gamecom, gamecom, gamecom_state, gamecom, "Tiger", "Game.com", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/gameking.c b/src/mame/drivers/gameking.c new file mode 100644 index 00000000000..a05b407f3f1 --- /dev/null +++ b/src/mame/drivers/gameking.c @@ -0,0 +1,195 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/* TimeTop - GameKing */ + +// these are meant to have a 3-in-1 internal ROM, not dumped + +/* +The carridge dumps have something what looks like vectors/pointers to interesting pieces +of code at offsets like $004c, $0050, $0054, $0060, $0064, $0068, and $0070 (some carts). + +At offset $004c there is usually $00 $40, $00, $01; this seems to point to bank #1/offset $4000, +which should get banked in at address $4000. There is valid at offset $4000 in the cartridge +dumps. + +There seem to be some RAM that starts at $1000 in the memomry map. + +A routine at $0f80 seems to be called a lot. It's probably some kind of entry into the +bios to perform several functions. The function to perform seems to be passed through +the A register with pointer to parameters stored at $0080-$0081 (multiple parameters/ +blocks?). + +The reset and irq vectors seem to be the same in most, if not all, cartridge dumps. It +is very likely that they point to code in the internal bios. + +*/ + +#include "emu.h" +#include "cpu/m6502/m65ce02.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class gameking_state : public driver_device +{ +public: + gameking_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_palette(*this, "palette") + { } + + + DECLARE_DRIVER_INIT(gameking); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(gameking); + + UINT32 screen_update_gameking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(gameking_cart); + +protected: + required_device m_maincpu; + required_device m_cart; + required_device m_palette; + + memory_region *m_cart_rom; + memory_bank *m_bank4000; + memory_bank *m_bank8000; + memory_bank *m_bankc000; +}; + +static ADDRESS_MAP_START( gameking_mem , AS_PROGRAM, 8, gameking_state ) + AM_RANGE(0x0000, 0x01ff) AM_RAM + + AM_RANGE(0x0f00, 0x0fff) AM_ROM + + AM_RANGE(0x1000, 0x1fff) AM_RAM // sthero writes to $19xx + + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank4000") + AM_RANGE(0x8000, 0xcfff) AM_ROMBANK("bank8000") + AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bankc000") +ADDRESS_MAP_END + + +static INPUT_PORTS_START( gameking ) +INPUT_PORTS_END + +static const unsigned char gameking_palette[] = +{ + 0, 0, 0, + 63, 63, 63, + 127, 127, 127, + 255, 255, 255 +}; + +PALETTE_INIT_MEMBER(gameking_state, gameking) +{ + for (int i = 0; i < sizeof(gameking_palette) / 3; i++) + palette.set_pen_color(i, gameking_palette[i*3], gameking_palette[i*3+1], gameking_palette[i*3+2]); +} + + +UINT32 gameking_state::screen_update_gameking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +DRIVER_INIT_MEMBER(gameking_state, gameking) +{ +} + + +DEVICE_IMAGE_LOAD_MEMBER( gameking_state, gameking_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size > 0x80000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +void gameking_state::machine_start() +{ + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + if (!m_cart_rom) + { + printf("No Rom\n"); + return; + } + + m_bank4000 = membank("bank4000"); + m_bank8000 = membank("bank8000"); + m_bankc000 = membank("bankc000"); + + // Minor hacking to get things going (should be removed when we have bios dump) + m_cart_rom->base()[0x3ffc] = 0x00; + m_cart_rom->base()[0x3ffd] = 0x40; + + // Some fake code to get bios function calls logged + memory_region *maincpu_rom = memregion("maincpu"); + maincpu_rom->base()[0x0f80] = 0x9d; // STA $0e00,X + maincpu_rom->base()[0x0f81] = 0x00; + maincpu_rom->base()[0x0f82] = 0x0e; + maincpu_rom->base()[0x0f83] = 0x60; // RTS + + m_bank8000->set_base(m_cart_rom->base()); + m_bankc000->set_base(m_cart_rom->base()); + m_bank4000->set_base(m_cart_rom->base() + 0x4000); +} + +void gameking_state::machine_reset() +{ +} + + + +static MACHINE_CONFIG_START( gameking, gameking_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M65CE02, 6000000) + MCFG_CPU_PROGRAM_MAP(gameking_mem) + //MCFG_CPU_VBLANK_INT_DRIVER("screen", gameking_state, gameking_frame_int) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(48, 32) + MCFG_SCREEN_VISIBLE_AREA(0, 48-1, 0, 32-1) + MCFG_SCREEN_UPDATE_DRIVER(gameking_state, screen_update_gameking) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gameking_palette) * 3) + MCFG_PALETTE_INIT_OWNER(gameking_state, gameking ) + + + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "gameking_cart") + MCFG_GENERIC_EXTENSIONS("bin") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(gameking_state, gameking_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "gameking") + MCFG_SOFTWARE_LIST_ADD("cart_list_3", "gameking3") // maybe not compatible with this system (different internal bios?) +MACHINE_CONFIG_END + +ROM_START(gameking) + ROM_REGION(0x8000, "maincpu", ROMREGION_ERASE00) +ROM_END + + + +CONS(2003, gameking, 0, 0, gameking, gameking, gameking_state, gameking, "TimeTop", "GameKing GM-218", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +// the GameKing 2 (GM-219) is probably identical HW diff --git a/src/mame/drivers/gamepock.c b/src/mame/drivers/gamepock.c new file mode 100644 index 00000000000..dbf76dc1bf5 --- /dev/null +++ b/src/mame/drivers/gamepock.c @@ -0,0 +1,83 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol + + +#include "emu.h" +#include "cpu/upd7810/upd7810.h" +#include "sound/speaker.h" +#include "bus/generic/carts.h" +#include "includes/gamepock.h" +#include "rendlay.h" + + +static ADDRESS_MAP_START(gamepock_mem, AS_PROGRAM, 8, gamepock_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0x0fff) AM_ROM + AM_RANGE(0x1000,0x3fff) AM_NOP + //AM_RANGE(0x4000,0xbfff) AM_ROM // mapped by the cartslot + AM_RANGE(0xc000,0xc7ff) AM_MIRROR(0x0800) AM_RAM + AM_RANGE(0xff80,0xffff) AM_RAM /* 128 bytes microcontroller RAM */ +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(gamepock_io, AS_IO, 8, gamepock_state ) + AM_RANGE( 0x00, 0x00 ) AM_WRITE( port_a_w ) + AM_RANGE( 0x01, 0x01 ) AM_READWRITE( port_b_r, port_b_w ) + AM_RANGE( 0x02, 0x02 ) AM_READ( port_c_r ) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( gamepock ) + PORT_START("IN0") + PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) + PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) + + PORT_START("IN1") + PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_START ) + PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( gamepock, gamepock_state ) + MCFG_CPU_ADD("maincpu", UPD78C06, XTAL_6MHz) /* uPD78C06AG */ + MCFG_CPU_PROGRAM_MAP( gamepock_mem) + MCFG_CPU_IO_MAP( gamepock_io) + MCFG_UPD7810_TO(WRITELINE(gamepock_state,gamepock_to_w)) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE( 60 ) + MCFG_SCREEN_SIZE( 75, 64 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 74, 0, 63 ) + MCFG_SCREEN_UPDATE_DRIVER(gamepock_state, screen_update_gamepock) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "gamepock_cart") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","gamepock") +MACHINE_CONFIG_END + + +ROM_START( gamepock ) + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "egpcboot.bin", 0x0000, 0x1000, CRC(ee1ea65d) SHA1(9c7731b5ead721d2cc7f7e2655c5fed9e56db8b0) ) +ROM_END + + +CONS( 1984, gamepock, 0, 0, gamepock, gamepock, driver_device, 0, "Epoch", "Game Pocket Computer", 0 ) diff --git a/src/mame/drivers/gb.c b/src/mame/drivers/gb.c new file mode 100644 index 00000000000..85311e19598 --- /dev/null +++ b/src/mame/drivers/gb.c @@ -0,0 +1,984 @@ +// license:BSD-3-Clause +// copyright-holders:Anthony Kruize,Wilbert Pol +/*************************************************************************** + + gb.c + + Driver file to handle emulation of the Nintendo Game Boy. + By: + + Hans de Goede 1998 + Anthony Kruize 2002 + Wilbert Pol 2004 (Megaduck/Cougar Boy) + + TODO list: + - Do correct lcd stat timing + - Add Game Boy Light (Japan, 1997) - does it differ from gbpocket? + - SGB should be moved to SNES driver + - Emulate OAM corruption bug on 16bit inc/dec in $fe** region + + +Timers +====== + +There seems to be some kind of selectable internal clock divider which is used to drive +the timer increments. This causes the first timer cycle to now always be a full cycle. +For instance in 1024 clock cycle mode, the first timer cycle could easily only take 400 +clock cycles. The next timer cycle will take the full 1024 clock cycles though. + +Writes to the DIV register seem to cause this internal clock divider/register to be +reset in such a way that the next stimulus cause a timer increment (in any mode). + + +Interrupts +========== + +Taking an interrupt seems to take around 20 clock cycles. + + +Stat timing +=========== + +This timing table is accurate within 4 cycles: + | stat = 2 | stat = 3 | stat = 0 | +No sprites | 80 | 172 | 204 | +1 sprite | 80 | 182 | 194 | +2 sprites | 80 | 192 | 184 | +3 sprites | 80 | 202 | 174 | +4 sprites | 80 | 212 | 164 | +5 sprites | 80 | 222 | 154 | +6 sprites | 80 | 232 | 144 | +7 sprites | 80 | 242 | 134 | +8 sprites | 80 | 252 | 124 | +9 sprites | 80 | 262 | 114 | +10 sprites | 80 | 272 | 104 | + +In other words, each sprite on a line makes stat 3 last 10 cycles longer. + + +For lines 1 - 143 when stat changes to 2 the line counter is incremented. + +Line 153 is little odd timing wise. The line counter stays 153 for ~4 clock cycles +and is then rolls over to 0. + +When the line counter is changed it gets checked against the lyc register. + +Here is a detailed run of the STAT and LY register together with LYC set to 3 on a +dmg and mgb. The time between each sample is 4 clock cycles: +STAT: +22222222 22233333 33333333 33333333 33333333 33333333 33333300 00000000 00000000 00000000 +00000000 00000000 00000000 06666666 66666666 66666777 77777777 77777777 77777777 77777777 +77777777 44444444 44444444 44444444 44444444 44444444 44444444 44022222 22222222 + + LY: +33333333 33333333 33333333 33333333 33333333 33333333 33333333 33333333 33333333 33333333 +33333333 33333333 33333333 44444444 44444444 44444444 44444444 44444444 44444444 44444444 +44444444 44444444 44444444 44444444 44444444 44444444 44444444 44555555 55555555 + ^ ^ + +As you can see, it seems as though the LY register is incremented slightly before the STAT +register is changed, resulting in a short period where STAT goes 0 before going to 2. This +bug/feature has been fixed in the CGB and AGB. + + + +Around lines 152-153-0 the picture becomes as follows: +STAT: +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11111111 11111111 15555555 55555555 55555555 55555555 55555555 55555555 55555555 +55555555 55555555 55555555 55555555 55555555 55555555 55555555 55111111 11111111 11111111 +11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 +11111111 11110222 22222222 22222222 23333333 33333333 33333333 33333333 33333333 + + LY: +77777777 77777777 77777777 77777777 77777777 77777777 77777777 77777777 77777777 77777777 +77777777 77777777 77777777 88888888 88888888 88888888 88888888 88888888 88888888 88888888 +88888888 88888888 88888888 88888888 88888888 88888888 88888888 88900000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 + + + +The full STAT/LY value state machine. +===================================== + +The timing information below is with sprites disabled. + +For STAT we only show the lower 3 bits and for LY only the lower 5 bits of the full +register. Each digit stands for 4 clock cycles (the smallest measurable unit on a +dmg or mgb). When the video hardware is switched on the LY register is set 0 and +the STAT mode is 0. The values for STAT and LY will change as follows: + +STAT 000000000000000000003333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 + LY 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 line #0 + ^LY=LYC bit can get set here LY=LYC bit is reset here^ + +STAT 222222222222222222223333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 + LY 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112 line #1 + + : + : + +STAT 222222222222222222223333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 + LY FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0 line #143 + +STAT 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + LY 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 line #144 + + : + : + +STAT 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + LY 888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889 line #152 + +STAT 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110 + LY 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 line #153 + ^ + LY=LYC interrupt for 153 can get triggered here + +STAT 222222222222222222223333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 + LY 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 line #0 + +STAT 222222222222222222223333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 + LY 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112 line #1 + + : + etc + + +Mappers used in the Game Boy +=========================== + +MBC1 Mapper +=========== + +The MBC1 mapper has two modes: 2MB ROM/8KB RAM or 512KB ROM/32KB RAM. +This mode is selected by writing into the 6000-7FFF memory area: +0bXXXXXXXB - B=0 - 2MB ROM/8KB RAM mode + B=1 - 512KB ROM/32KB RAM mode +The default behaviour is to be in 2MB ROM/8KB RAM mode. + +Writing a value ( 0bXXXBBBBB ) into the 2000-3FFF memory area selects the +lower 5 bits of the ROM bank to select for the 4000-7FFF memory area. If a +value of 0bXXX00000 is written then this will autmatically be changed to +0bXXX00001 by the mbc chip. + +Writing a value (0bXXXXXXBB ) into the 4000-5FFF memory area either selects +the RAM bank to use or bits 6 and 7 for the ROM bank to use for the 4000-7FFF +memory area. This behaviour depends on the memory moddel chosen. + +The RAM sections are enabled by writing the value 0bXXX1010 into the 0000-1FFF +memory area. Writing any other value disables the RAM section. + +Some unanswered cases: +#1 - Set mode 0 + - Set lower bank bits to 1F + - Set high bank bits to 01 => bank #3F + - Set mode 1 + - What ROM bank is now at 4000-7FFF, bank #1F or bank #3F? + +#2 - Set mode 1 + - Set ram area #1 + - Set mode 0 + - What ram area is now at A000-BFFF, ram bank 00 or ram bank 01? + + +MBC2 Mapper +=========== + +The MBC2 mapper includes 512x4bits of builtin RAM. + +0000-1FFF - Writing to this area enables (value 0bXXXX1010) or disables (any + other value than 0bXXXX1010) the RAM. In order to perform this + function bit 12 of the address must be reset, so usable areas are + 0000-00FF, 0200-02FF, 0400-04FF, 0600-06FF, ..., 1E00-1EFF. +2000-3FFF - Writing to this area selects the rom bank to appear at 4000-7FFF. + Only bits 3-0 are used to select the bank number. If a value of + 0bXXXX0000 is written then this is automatically changed into + 0bXXXX0001 by the mapper. + In order to perform the rom banking bit 12 of the address must be + set, so usable areas are 2100-21FF, 2300-23FF, 2500-25FF, 2700- + 27FF, ..., 3F00-3FFF. + +Some unanswered cases: +#1 - Set rom bank to 8 for a 4 bank rom image. + - What rom bank appears at 4000-7FFF, bank #0 or bank #1 ? + + +MBC3 Mapper +=========== + +The MBC3 mapper cartridges can include a RTC chip. + +0000-1FFF - Writing to this area enables (value 0x0A) or disables (0x00) the + RAM and RTC registers. +2000-3FFF - Writing to this area selects the rom bank to appear at 4000-7FFF. + Bits 6-0 are used to select the bank number. If a value of + 0bX0000000 is written then this is autmatically changed into + 0bX0000001 by the mapper. +4000-5FFF - Writing to this area selects the RAM bank or the RTC register to + read. + XXXX00bb - Select RAM bank bb. + XXXX1rrr - Select RTC register rrr. Accepted values for rrr are: + 000 - Seconds (0x00-0x3B) + 001 - Minutes (0x00-0x3B) + 010 - Hours (0x00-0x17) + 011 - Bits 7-0 of the day counter + 100 - bit 0 - Bit 8 of the day counter + bit 6 - Halt RTC timer ( 0 = timer active, 1 = halted) + bit 7 - Day counter overflow flag +6000-7FFF - Writing 0x00 followed by 0x01 latches the RTC data. This latching + method is used for reading the RTC registers. + +Some unanswered cases: +#1 - Set rom bank to 8(/16/32/64) for a 4(/8/16/32) bank image. + - What rom bank appears at 4000-7FFF, bank #0 or bank #1 ? + + +MBC4 Mapper +=========== + +Stauts: not supported yet. + + +MBC5 Mapper +=========== + +0000-1FFF - Writing to this area enables (0x0A) or disables (0x00) the RAM area. +2000-2FFF - Writing to this area updates bits 7-0 of the rom bank number to + appear at 4000-7FFF. +3000-3FFF - Writing to this area updates bit 8 of the rom bank number to appear + at 4000-7FFF. +4000-5FFF - Writing to this area select the RAM bank number to use. If the + cartridge includes a Rumble Pack then bit 3 is used to control + rumble motor (0 - disable motor, 1 - enable motor). + + +MBC7 Mapper (Used by Kirby's Tilt n' Tumble, Command Master) +=========== + +Status: Partial support (only ROM banking supported at the moment) + +The MBC7 mapper has 0x0200(?) bytes of RAM built in. + +0000-1FFF - Probably enable/disable RAM + In order to use this area bit 12 of the address be set. + Values written: 00, 0A +2000-2FFF - Writing to this area selects the ROM bank to appear at + 4000-7FFF. + In order to use this area bit 12 of the address be set. + Values written: 01, 07, 01, 1C +3000-3FFF - Unknown + In order to use this area bit 12 of the address be set. + Values written: 00 +4000-4FFF - Unknown + In order to use this area bit 12 of the address be set. + Values written: 00, 40, 3F + + +TAMA5 Mapper (Used by Tamagotchi 3) +============ + +Status: partially supported. + +The TAMA5 mapper includes a special RTC chip which communicates through the +RAM area (0xA000-0xBFFF); most notably addresses 0xA000 and 0xA001 seem to +be used. In this setup 0xA001 acts like a control register and 0xA000 like +a data register. + +Accepted values by the TAMA5 control register: +0x00 - Writing to 0xA000 will set bits 3-0 for rom bank selection. +0x01 - Writing to 0xA000 will set bits (7-?)4 for rom bank selection. + +0x04 - Bits 3-0 of the value to write +0x05 - Bits 4-7 of the value to write +0x06 - Address control hi + bit 0 - Bit 4 for the address + bit 3-1 - 000 - Write a byte to the 32 byte memory. The data to be + written must be set in registers 0x04 (lo nibble) and + 0x05 (hi nibble). + - 001 - Read a byte from the 32 byte memory. The data read + will be available in registers 0x0C (lo nibble) and + 0x0D (hi nibble). + - 010 - Unknown (occurs just after having started a game and + entered a date) (execution at address 1A19) + - 011 - Unknown (not encountered yet) + - 100 - Unknown (occurs during booting a game; appears to be + some kind of read command as it is followed by a read + of the 0x0C register) (execution at address 1B5B) + - 101 - Unknown (not encountered yet) + - 110 - Unknown (not encountered yet) + - 111 - Unknown (not encountered yet) +0x07 - Address control lo + bit 3-0 - bits 3-0 for the address + +0x0A - After writing this the lowest 2 bits of A000 determine whether the + TAMA5 chip is ready to accept the next command. If the lowest 2 bits + hold the value 01 then the TAMA5 chip is ready for the next command. + +0x0C - Reading from A000 will return bits 3-0 of the data +0x0D - Reading from A000 will return bits 7-4 of the data + +0x04 - RTC controls? -> RTC/memory? +0x05 - Write time/memomry? +0x06 - RTC controls? +0x07 - RTC controls? + +Unknown sequences: +During booting a game (1B5B: +04 <- 00, 06 <- 08, 07 <- 01, followed by read 0C +when value read from 0C equals 00 followed by the sequence: +04 <- 01, 06 <- 08, 07 <- 01, followed by read 0C +the value read from 0C is checked for non-zero, don't know the consequences for either +yet. + +Initialization after starting a game: +At address 1A19: +06 <- 05, 07 <- 02, followed by read 0C, if != 0F => OK, otherwise do something. + + +MMM01 mapper +============ + +Used by: Momotarou Collection 2, Taito Pack + +Status: not supported yet. + +Momotarou Collection 2: + +MOMOTARODENGEKI2, 0x00000, blocks 0x00 - 0x1F +0x147: 01 04 00 00 33 00 +MOMOTAROU GAIDEN, 0x80000, blocks 0x20 - 0x3F +0x147: 06 03 00 00 18 00 + +When picking top option: +3FFF <- 20 +5FFF <- 40 +7FFF <- 21 +1FFF <- 3A +1FFF <- 7A + +When picking bottom option: +3FFF <- 00 +5FFF <- 01 +7FFF <- 01 +1FFF <- 3A +1FFF <- 7A + +Taito Pack (MMM01+RAM, 512KB, 64KB RAM): +1st option (BUBBLE BOBBLE, blocks 0x10 - 0x17, MBC1+RAM, 128KB, 8KB RAM): + 2000 <- 70 01110000 => starting block, 10000 + 6000 <- 30 00110000 => 8 blocks + 4000 <- 70 01110000 => ??? + 0000 <- 40 01000000 => upper 3 bits determine lower 3 bits of starting block? + +2nd option (ELEVATOR ACTION, blocks 0x18 - 0x1B, MBC1, 64KB, 2KB RAM): + 2000 <- 78 01111000 => starting block, 11000 + 6000 <- 38 00111000 => 4 blocks + 4000 <- 70 01110000 => ??? + 0000 <- 40 01000000 => upper 3 bits determine lower 3 bits of starting block? + +3rd option (CHASE HQ, blocks 0x08 - 0x0F, MBC1+RAM, 128KB, 8KB RAM): + 2000 <- 68 01101000 => starting block, 01000 + 6000 <- 30 00110000 => 8 blocks + 4000 <- 70 01110000 => ??? + 0000 <- 40 01000000 => upper 3 bits determine lower 3 bits of starting block? + +4th option (SAGAIA, blocks 0x00 - 0x07, MBC1+RAM, 128KB, 8KB RAM): + 2000 <- 60 01100000 => starting block, 00000 + 6000 <- 30 00110000 => 8 blocks + 4000 <- 70 01110000 => ??? + 0000 <- 40 01000000 => upper 3 bits determine lower 3 bits of starting block? + +Known: +The last 2 banks in a MMM01 dump are actually the starting banks for a MMM01 image. + +0000-1FFF => bit6 set => perform mapping + +Possible mapping registers: +1FFF - Enable RAM ??? +3FFF - xxxbbbbb - Bit0-5 of the rom bank to select at 0x4000-0x7FFF ? + + +HuC1 mapper +=========== + +Status: not supported yet. + + +HuC3 mapper +=========== + +Status: not supported yet. + + +Wisdom Tree mapper +================== + +The Wisdom Tree mapper is triggered by writes in the 0x0000-0x3FFF area. The +address written to determines the bank to switch in in the 0x000-0x7FFF address +space. This mapper uses 32KB sized banks. + + +***************************************************************************/ + +#include "emu.h" +#include "rendlay.h" +#include "includes/gb.h" +#include "bus/gameboy/rom.h" +#include "bus/gameboy/mbc.h" + + +READ8_MEMBER(gb_state::gb_cart_r) +{ + if (m_bios_disable && m_cartslot) + return m_cartslot->read_rom(space, offset); + else + { + if (offset < 0x100) + { + UINT8 *ROM = m_region_maincpu->base(); + if (m_bios_hack->read()) + { + // patch out logo and checksum checks + // (useful to run some pirate carts until we implement + // their complete functionalities + to test homebrew) + if (offset == 0xe9 || offset == 0xea) + return 0x00; + if (offset == 0xfa || offset == 0xfb) + return 0x00; + } + return ROM[offset]; + } + else if (m_cartslot) + { + return m_cartslot->read_rom(space, offset); + } + else + return 0xff; + } +} + +READ8_MEMBER(gb_state::gbc_cart_r) +{ + if (m_bios_disable && m_cartslot) + return m_cartslot->read_rom(space, offset); + else + { + if (offset < 0x100) + { + UINT8 *ROM = m_region_maincpu->base(); + if (m_bios_hack->read()) + { + // patch out logo and checksum checks + // (useful to run some pirate carts until we implement + // their complete functionalities + to test homebrew) + if (offset == 0xdb || offset == 0xdc) + return 0x00; + if (offset == 0xed || offset == 0xee) + return 0x00; + } + return ROM[offset]; + } + else if (offset >= 0x200 && offset < 0x900) + { + UINT8 *ROM = m_region_maincpu->base(); + return ROM[offset - 0x100]; + } + else if (m_cartslot) + { + return m_cartslot->read_rom(space, offset); + } + else + return 0xff; + } +} + +WRITE8_MEMBER(gb_state::gb_bank_w) +{ + if (m_cartslot) + m_cartslot->write_bank(space, offset, data); +} + +READ8_MEMBER(gb_state::gb_ram_r) +{ + if (m_cartslot) + return m_cartslot->read_ram(space, offset); + else + return 0xff; +} + +WRITE8_MEMBER(gb_state::gb_ram_w) +{ + if (m_cartslot) + m_cartslot->write_ram(space, offset, data); +} + +READ8_MEMBER(gb_state::gb_echo_r) +{ + return space.read_byte(0xc000 + offset); +} + +WRITE8_MEMBER(gb_state::gb_echo_w) +{ + return space.write_byte(0xc000 + offset, data); +} + +READ8_MEMBER(megaduck_state::cart_r) +{ + if (m_cartslot) + return m_cartslot->read_rom(space, offset); + else + return 0xff; +} + +WRITE8_MEMBER(megaduck_state::bank1_w) +{ + if (m_cartslot) + m_cartslot->write_bank(space, offset, data); +} + +WRITE8_MEMBER(megaduck_state::bank2_w) +{ + if (m_cartslot) + m_cartslot->write_ram(space, offset, data); /* used for bankswitch, but we re-use GB name */ +} + + +static ADDRESS_MAP_START(gameboy_map, AS_PROGRAM, 8, gb_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(gb_cart_r, gb_bank_w) + AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("lcd", gb_lcd_device, vram_r, vram_w) /* 8k VRAM */ + AM_RANGE(0xa000, 0xbfff) AM_READWRITE(gb_ram_r, gb_ram_w) /* 8k switched RAM bank (cartridge) */ + AM_RANGE(0xc000, 0xdfff) AM_RAM /* 8k low RAM */ + AM_RANGE(0xe000, 0xfdff) AM_READWRITE(gb_echo_r, gb_echo_w) /* echo RAM */ + AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("lcd", gb_lcd_device, oam_r, oam_w) /* OAM RAM */ + AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, gb_io_w) /* I/O */ + AM_RANGE(0xff10, 0xff26) AM_DEVREADWRITE("custom", gameboy_sound_device, sound_r, sound_w) /* sound registers */ + AM_RANGE(0xff27, 0xff2f) AM_NOP /* unused */ + AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("custom", gameboy_sound_device, wave_r, wave_w) /* Wave ram */ + AM_RANGE(0xff40, 0xff7f) AM_DEVREAD("lcd", gb_lcd_device, video_r) AM_WRITE(gb_io2_w) /* Video controller & BIOS flip-flop */ + AM_RANGE(0xff80, 0xfffe) AM_RAM /* High RAM */ + AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w) /* Interrupt enable register */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sgb_map, AS_PROGRAM, 8, gb_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(gb_cart_r, gb_bank_w) + AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("lcd", sgb_lcd_device, vram_r, vram_w) /* 8k VRAM */ + AM_RANGE(0xa000, 0xbfff) AM_READWRITE(gb_ram_r, gb_ram_w) /* 8k switched RAM bank (cartridge) */ + AM_RANGE(0xc000, 0xdfff) AM_RAM /* 8k low RAM */ + AM_RANGE(0xe000, 0xfdff) AM_READWRITE(gb_echo_r, gb_echo_w) /* echo RAM */ + AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("lcd", sgb_lcd_device, oam_r, oam_w) /* OAM RAM */ + AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, sgb_io_w) /* I/O */ + AM_RANGE(0xff10, 0xff26) AM_DEVREADWRITE("custom", gameboy_sound_device, sound_r, sound_w) /* sound registers */ + AM_RANGE(0xff27, 0xff2f) AM_NOP /* unused */ + AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("custom", gameboy_sound_device, wave_r, wave_w) /* Wave RAM */ + AM_RANGE(0xff40, 0xff7f) AM_DEVREAD("lcd", sgb_lcd_device, video_r) AM_WRITE(gb_io2_w) /* Video controller & BIOS flip-flop */ + AM_RANGE(0xff80, 0xfffe) AM_RAM /* High RAM */ + AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w) /* Interrupt enable register */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(gbc_map, AS_PROGRAM, 8, gb_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(gbc_cart_r, gb_bank_w) + AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("lcd", cgb_lcd_device, vram_r, vram_w) /* 8k VRAM */ + AM_RANGE(0xa000, 0xbfff) AM_READWRITE(gb_ram_r, gb_ram_w) /* 8k switched RAM bank (cartridge) */ + AM_RANGE(0xc000, 0xcfff) AM_RAM /* 4k fixed RAM bank */ + AM_RANGE(0xd000, 0xdfff) AM_RAMBANK("cgb_ram") /* 4k switched RAM bank */ + AM_RANGE(0xe000, 0xfdff) AM_READWRITE(gb_echo_r, gb_echo_w) /* echo RAM */ + AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("lcd", cgb_lcd_device, oam_r, oam_w) /* OAM RAM */ + AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, gb_io_w) /* I/O */ + AM_RANGE(0xff10, 0xff26) AM_DEVREADWRITE("custom", gameboy_sound_device, sound_r, sound_w) /* sound controller */ + AM_RANGE(0xff27, 0xff2f) AM_NOP /* unused */ + AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("custom", gameboy_sound_device, wave_r, wave_w) /* Wave RAM */ + AM_RANGE(0xff40, 0xff7f) AM_READWRITE(gbc_io2_r, gbc_io2_w) /* Other I/O and video controller */ + AM_RANGE(0xff80, 0xfffe) AM_RAM /* high RAM */ + AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w) /* Interrupt enable register */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(megaduck_map, AS_PROGRAM, 8, megaduck_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(cart_r, bank1_w) + AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("lcd", gb_lcd_device, vram_r, vram_w) /* 8k VRAM */ + AM_RANGE(0xa000, 0xafff) AM_NOP /* unused? */ + AM_RANGE(0xb000, 0xb000) AM_WRITE(bank2_w) + AM_RANGE(0xb001, 0xbfff) AM_NOP /* unused? */ + AM_RANGE(0xc000, 0xfe9f) AM_RAM /* 8k low RAM, echo RAM */ + AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("lcd", gb_lcd_device, oam_r, oam_w) /* OAM RAM */ + AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, gb_io_w) /* I/O */ + AM_RANGE(0xff10, 0xff1f) AM_READWRITE(megaduck_video_r, megaduck_video_w) /* video controller */ + AM_RANGE(0xff20, 0xff2f) AM_READWRITE(megaduck_sound_r1, megaduck_sound_w1) /* sound controller pt1 */ + AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("custom", gameboy_sound_device, wave_r, wave_w) /* wave ram */ + AM_RANGE(0xff40, 0xff46) AM_READWRITE(megaduck_sound_r2, megaduck_sound_w2) /* sound controller pt2 */ + AM_RANGE(0xff47, 0xff7f) AM_NOP /* unused */ + AM_RANGE(0xff80, 0xfffe) AM_RAM /* high RAM */ + AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w) /* interrupt enable register */ +ADDRESS_MAP_END + +static GFXDECODE_START( gb ) +GFXDECODE_END + +static INPUT_PORTS_START( gameboy ) + PORT_START("INPUTS") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button A") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button B") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") + + PORT_START("SKIP_CHECK") + PORT_CONFNAME( 0x01, 0x00, "[HACK] Skip BIOS Logo check" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + +INPUT_PORTS_END + +static SLOT_INTERFACE_START(gb_cart) + SLOT_INTERFACE_INTERNAL("rom", GB_STD_ROM) + SLOT_INTERFACE_INTERNAL("rom_mbc1", GB_ROM_MBC1) + SLOT_INTERFACE_INTERNAL("rom_mbc1col", GB_ROM_MBC1) + SLOT_INTERFACE_INTERNAL("rom_mbc2", GB_ROM_MBC2) + SLOT_INTERFACE_INTERNAL("rom_mbc3", GB_ROM_MBC3) + SLOT_INTERFACE_INTERNAL("rom_huc1", GB_ROM_MBC3) + SLOT_INTERFACE_INTERNAL("rom_huc3", GB_ROM_MBC3) + SLOT_INTERFACE_INTERNAL("rom_mbc5", GB_ROM_MBC5) + SLOT_INTERFACE_INTERNAL("rom_mbc6", GB_ROM_MBC6) + SLOT_INTERFACE_INTERNAL("rom_mbc7", GB_ROM_MBC7) + SLOT_INTERFACE_INTERNAL("rom_tama5", GB_ROM_TAMA5) + SLOT_INTERFACE_INTERNAL("rom_mmm01", GB_ROM_MMM01) + SLOT_INTERFACE_INTERNAL("rom_m161_m12",GB_ROM_M161_M12) + SLOT_INTERFACE_INTERNAL("rom_sachen1", GB_ROM_SACHEN1) + SLOT_INTERFACE_INTERNAL("rom_sachen2", GB_ROM_SACHEN2) + SLOT_INTERFACE_INTERNAL("rom_wisdom", GB_ROM_WISDOM) + SLOT_INTERFACE_INTERNAL("rom_yong", GB_ROM_YONG) + SLOT_INTERFACE_INTERNAL("rom_lasama", GB_ROM_LASAMA) + SLOT_INTERFACE_INTERNAL("rom_atvrac", GB_ROM_ATVRAC) + SLOT_INTERFACE_INTERNAL("rom_camera", GB_STD_ROM) + SLOT_INTERFACE_INTERNAL("rom_188in1", GB_ROM_188IN1) + SLOT_INTERFACE_INTERNAL("rom_sintax", GB_ROM_SINTAX) + SLOT_INTERFACE_INTERNAL("rom_chong", GB_ROM_CHONGWU) + SLOT_INTERFACE_INTERNAL("rom_licheng", GB_ROM_LICHENG) + SLOT_INTERFACE_INTERNAL("rom_digimon", GB_ROM_DIGIMON) + SLOT_INTERFACE_INTERNAL("rom_rock8", GB_ROM_ROCKMAN8) + SLOT_INTERFACE_INTERNAL("rom_sm3sp", GB_ROM_SM3SP) +// SLOT_INTERFACE_INTERNAL("rom_dkong5", GB_ROM_DKONG5) +// SLOT_INTERFACE_INTERNAL("rom_unk01", GB_ROM_UNK01) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(megaduck_cart) + SLOT_INTERFACE_INTERNAL("rom", MEGADUCK_ROM) +SLOT_INTERFACE_END + + + +static const unsigned char palette_gb[] = +{ + /* Simple black and white palette */ + /* 0xFF,0xFF,0xFF, + 0xB0,0xB0,0xB0, + 0x60,0x60,0x60, + 0x00,0x00,0x00 */ + + /* Possibly needs a little more green in it */ + 0xFF,0xFB,0x87, /* Background */ + 0xB1,0xAE,0x4E, /* Light */ + 0x84,0x80,0x4E, /* Medium */ + 0x4E,0x4E,0x4E, /* Dark */ + + /* Palette for Game Boy Pocket/Light */ + 0xC4,0xCF,0xA1, /* Background */ + 0x8B,0x95,0x6D, /* Light */ + 0x6B,0x73,0x53, /* Medium */ + 0x41,0x41,0x41, /* Dark */ +}; + +static const unsigned char palette_megaduck[] = { + 0x6B, 0xA6, 0x4A, 0x43, 0x7A, 0x63, 0x25, 0x59, 0x55, 0x12, 0x42, 0x4C +}; + +/* Initialise the palettes */ +PALETTE_INIT_MEMBER(gb_state, gb) +{ + for (int i = 0; i < 4; i++) + palette.set_pen_color(i, palette_gb[i * 3 + 0], palette_gb[i * 3 + 1], palette_gb[i * 3 + 2]); +} + +PALETTE_INIT_MEMBER(gb_state, gbp) +{ + for (int i = 0; i < 4; i++) + palette.set_pen_color(i, palette_gb[(i + 4) * 3 + 0], palette_gb[(i + 4) * 3 + 1], palette_gb[(i + 4) * 3 + 2]); +} + +PALETTE_INIT_MEMBER(gb_state, sgb) +{ + int r, g, b; + + for (int i = 0; i < 32768; i++) + { + r = (i & 0x1F) << 3; + g = ((i >> 5) & 0x1F) << 3; + b = ((i >> 10) & 0x1F) << 3; + palette.set_pen_color(i, r, g, b); + } +} + +PALETTE_INIT_MEMBER(gb_state, gbc) +{ + int r, g, b; + + for (int i = 0; i < 32768; i++) + { + r = (i & 0x1F) << 3; + g = ((i >> 5) & 0x1F) << 3; + b = ((i >> 10) & 0x1F) << 3; + palette.set_pen_color(i, r, g, b); + } +} + +PALETTE_INIT_MEMBER(megaduck_state, megaduck) +{ + for (int i = 0; i < 4; i++) + palette.set_pen_color(i, palette_megaduck[i * 3 + 0], palette_megaduck[i * 3 + 1], palette_megaduck[i * 3 + 2]); +} + + +static MACHINE_CONFIG_START( gameboy, gb_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", LR35902, XTAL_4_194304Mhz) + MCFG_CPU_PROGRAM_MAP(gameboy_map) + MCFG_LR35902_TIMER_CB( WRITE8( gb_state, gb_timer_callback ) ) + MCFG_LR35902_HALT_BUG + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_SCREEN_UPDATE_DEVICE("lcd", gb_lcd_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) +// MCFG_SCREEN_SIZE(20*8, 18*8) + MCFG_SCREEN_SIZE( 458, 154 ) + MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", gb) + MCFG_PALETTE_ADD("palette", 4) + MCFG_PALETTE_INIT_OWNER(gb_state,gb) + + MCFG_GB_LCD_DMG_ADD("lcd") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("custom", GAMEBOY, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + + /* cartslot */ + MCFG_GB_CARTRIDGE_ADD("gbslot", gb_cart, NULL) + + MCFG_SOFTWARE_LIST_ADD("cart_list","gameboy") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gbc_list","gbcolor") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( supergb, gameboy ) + + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", LR35902, 4295454) /* 4.295454 MHz, derived from SNES xtal */ + MCFG_CPU_PROGRAM_MAP(sgb_map) + + MCFG_CPU_MODIFY("maincpu") + MCFG_LR35902_TIMER_CB( WRITE8(gb_state, gb_timer_callback ) ) + MCFG_LR35902_HALT_BUG + + MCFG_MACHINE_START_OVERRIDE(gb_state, sgb) + MCFG_MACHINE_RESET_OVERRIDE(gb_state, sgb) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_horizont) /* runs on a TV, not an LCD */ + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(32*8, 28*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(32768) + MCFG_PALETTE_INIT_OWNER(gb_state,sgb) + + MCFG_DEVICE_REMOVE("lcd") + MCFG_GB_LCD_SGB_ADD("lcd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( supergb2, gameboy ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sgb_map) + + MCFG_CPU_MODIFY("maincpu") + MCFG_LR35902_TIMER_CB( WRITE8(gb_state, gb_timer_callback ) ) + MCFG_LR35902_HALT_BUG + + MCFG_MACHINE_START_OVERRIDE(gb_state, sgb) + MCFG_MACHINE_RESET_OVERRIDE(gb_state, sgb) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_horizont) /* runs on a TV, not an LCD */ + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(32*8, 28*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(32768) + MCFG_PALETTE_INIT_OWNER(gb_state,sgb) + + MCFG_DEVICE_REMOVE("lcd") + MCFG_GB_LCD_SGB_ADD("lcd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( gbpocket, gameboy ) + + /* video hardware */ + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(gb_state,gbp) + + MCFG_DEVICE_REMOVE("lcd") + MCFG_GB_LCD_MGB_ADD("lcd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( gbcolor, gb_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", LR35902, XTAL_4_194304Mhz) // todo XTAL_8_388MHz + MCFG_CPU_PROGRAM_MAP(gbc_map) + MCFG_LR35902_TIMER_CB( WRITE8(gb_state, gb_timer_callback ) ) + + MCFG_MACHINE_START_OVERRIDE(gb_state,gbc) + MCFG_MACHINE_RESET_OVERRIDE(gb_state,gbc) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_SCREEN_UPDATE_DEVICE("lcd", gb_lcd_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) +// MCFG_SCREEN_SIZE(20*8, 18*8) + MCFG_SCREEN_SIZE( 458, 154 ) + MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", gb) + + MCFG_PALETTE_ADD("palette", 32768) + MCFG_PALETTE_INIT_OWNER(gb_state,gbc) + + MCFG_GB_LCD_CGB_ADD("lcd") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("custom", GAMEBOY, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") /* 2 pages of 8KB VRAM, 8 pages of 4KB RAM */ + + /* cartslot */ + MCFG_GB_CARTRIDGE_ADD("gbslot", gb_cart, NULL) + + MCFG_SOFTWARE_LIST_ADD("cart_list","gbcolor") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gb_list","gameboy") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( megaduck, megaduck_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", LR35902, 4194304) /* 4.194304 MHz */ + MCFG_CPU_PROGRAM_MAP(megaduck_map) + MCFG_LR35902_TIMER_CB( WRITE8(gb_state, gb_timer_callback ) ) + MCFG_LR35902_HALT_BUG + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_SCREEN_PALETTE("palette") + + MCFG_MACHINE_START_OVERRIDE(megaduck_state, megaduck) + MCFG_MACHINE_RESET_OVERRIDE(megaduck_state, megaduck) + + MCFG_SCREEN_UPDATE_DEVICE("lcd", gb_lcd_device, screen_update) + MCFG_SCREEN_SIZE(20*8, 18*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", gb) + + MCFG_PALETTE_ADD("palette", 4) + MCFG_PALETTE_INIT_OWNER(megaduck_state,megaduck) + + MCFG_GB_LCD_DMG_ADD("lcd") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("custom", GAMEBOY, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + + /* cartslot */ + MCFG_MEGADUCK_CARTRIDGE_ADD("duckslot", megaduck_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list", "megaduck") +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( gameboy ) + ROM_REGION( 0x0100, "maincpu", 0 ) + ROM_LOAD( "dmg_boot.bin", 0x0000, 0x0100, CRC(59c8598e) SHA1(4ed31ec6b0b175bb109c0eb5fd3d193da823339f) ) +ROM_END + +ROM_START( supergb ) + ROM_REGION( 0x0100, "maincpu", 0 ) + ROM_LOAD( "sgb_boot.bin", 0x0000, 0x0100, CRC(ec8a83b9) SHA1(aa2f50a77dfb4823da96ba99309085a3c6278515) ) +ROM_END + +ROM_START( supergb2 ) + ROM_REGION( 0x0100, "maincpu", 0 ) + ROM_LOAD( "sgb2_boot.bin", 0x0000, 0x0100, CRC(53d0dd63) SHA1(93407ea10d2f30ab96a314d8eca44fe160aea734) ) +ROM_END + +ROM_START( gbpocket ) + ROM_REGION( 0x0100, "maincpu", 0 ) + ROM_LOAD( "mgb_boot.bin", 0x0000, 0x0100, CRC(e6920754) SHA1(4e68f9da03c310e84c523654b9026e51f26ce7f0) ) +ROM_END + +ROM_START( gbcolor ) + ROM_REGION( 0x800, "maincpu", 0 ) + ROM_LOAD( "gbc_boot.1", 0x0000, 0x0100, CRC(779ea374) SHA1(e4b40c9fd593a97a1618cfb2696f290cf9596a62) ) /* Bootstrap code part 1 */ + ROM_LOAD( "gbc_boot.2", 0x0100, 0x0700, CRC(f741807d) SHA1(f943b1e0b640cf1d371e1d8f0ada69af03ebb396) ) /* Bootstrap code part 2 */ +ROM_END + + +ROM_START( megaduck ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1990, gameboy, 0, 0, gameboy, gameboy, driver_device, 0, "Nintendo", "Game Boy", MACHINE_SUPPORTS_SAVE ) +CONS( 1994, supergb, gameboy, 0, supergb, gameboy, driver_device, 0, "Nintendo", "Super Game Boy", MACHINE_SUPPORTS_SAVE ) +CONS( 1998, supergb2, gameboy, 0, supergb2, gameboy, driver_device, 0, "Nintendo", "Super Game Boy 2", MACHINE_SUPPORTS_SAVE ) +CONS( 1996, gbpocket, gameboy, 0, gbpocket, gameboy, driver_device, 0, "Nintendo", "Game Boy Pocket", MACHINE_SUPPORTS_SAVE ) +CONS( 1998, gbcolor, 0, 0, gbcolor, gameboy, driver_device, 0, "Nintendo", "Game Boy Color", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) + +// Sound is not 100% yet, it generates some sounds which could be ok. Since we're lacking a real system there's no way to verify. +CONS( 1993, megaduck, 0, 0, megaduck, gameboy, driver_device, 0, "Welback Holdings (Timlex International) / Creatronic / Videojet / Cougar USA", "Mega Duck / Cougar Boy", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/gba.c b/src/mame/drivers/gba.c new file mode 100644 index 00000000000..08fc5a6e04f --- /dev/null +++ b/src/mame/drivers/gba.c @@ -0,0 +1,2318 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont,Ryan Holtz +/*************************************************************************** + + gba.c + + Driver file to handle emulation of the Nintendo Game Boy Advance. + + By R. Belmont & Harmony + +***************************************************************************/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "cpu/arm7/arm7core.h" +#include "sound/dac.h" +#include "audio/gb.h" +#include "includes/gba.h" +#include "bus/gba/rom.h" +#include "rendlay.h" + +#define VERBOSE_LEVEL (0) + +INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ...) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%08x: %s", machine.driver_data()->m_maincpu->pc(), buf ); + } +} + +#define GBA_ATTOTIME_NORMALIZE(a) a.normalize() + +static const UINT32 timer_clks[4] = { 16777216, 16777216/64, 16777216/256, 16777216/1024 }; + + +PALETTE_INIT_MEMBER(gba_state, gba) +{ + UINT8 r, g, b; + for( b = 0; b < 32; b++ ) + { + for( g = 0; g < 32; g++ ) + { + for( r = 0; r < 32; r++ ) + { + palette.set_pen_color( ( b << 10 ) | ( g << 5 ) | r, pal5bit(r), pal5bit(g), pal5bit(b) ); + } + } + } +} + +void gba_state::request_irq(UINT32 int_type) +{ + // set flag for later recovery + m_IF |= int_type; + + // is this specific interrupt enabled? + int_type &= m_IE; + if (int_type != 0) + { + // master enable? + if (m_IME & 1) + { + m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + m_maincpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); + } + } +} + +TIMER_CALLBACK_MEMBER(gba_state::dma_complete) +{ + int ctrl; + FPTR ch; + static const UINT32 ch_int[4] = { INT_DMA0, INT_DMA1, INT_DMA2, INT_DMA3 }; + + ch = param; + +// printf("dma complete: ch %d\n", ch); + + m_dma_timer[ch]->adjust(attotime::never); + + ctrl = m_dma_regs[(ch*3)+2] >> 16; + + // IRQ + if (ctrl & 0x4000) + { + request_irq(ch_int[ch]); + } + + // if we're supposed to repeat, don't clear "active" and then the next vbl/hbl will retrigger us + // always clear active for immediate DMAs though + if (!((ctrl>>9) & 1) || ((ctrl & 0x3000) == 0)) + { +// printf("clear active for ch %d\n", ch); + m_dma_regs[(ch*3)+2] &= ~0x80000000; // clear "active" bit + } + else + { + // if repeat, reload the count + if ((ctrl>>9) & 1) + { + m_dma_cnt[ch] = m_dma_regs[(ch*3)+2]&0xffff; + + // if increment & reload mode, reload the destination + if (((ctrl>>5)&3) == 3) + { + m_dma_dst[ch] = m_dma_regs[(ch*3)+1]; + } + } + } +} + +void gba_state::dma_exec(FPTR ch) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT32 src = m_dma_src[ch]; + UINT32 dst = m_dma_dst[ch]; + int ctrl = m_dma_regs[(ch*3)+2] >> 16; + int srcadd = m_dma_srcadd[ch]; + int dstadd = m_dma_dstadd[ch]; + + int cnt = m_dma_cnt[ch]; + if (!cnt) + { + if (ch == 3) + { + cnt = 0x10000; + } + else + { + cnt = 0x4000; + } + } + + // override special parameters + if ((ctrl & 0x3000) == 0x3000) // special xfer mode + { + switch (ch) + { + case 1: // Ch 1&2 are for audio DMA + case 2: + dstadd = 2; // don't increment destination + cnt = 4; // always transfer 4 32-bit words + ctrl |= 0x400; // always 32-bit + break; + + case 3: + printf("Unsupported DMA 3 special mode\n"); + break; + } + } + else + { +// if (dst >= 0x6000000 && dst <= 0x6017fff) +// printf("DMA exec: ch %d from %08x to %08x, mode %04x, count %04x (%s)\n", (int)ch, src, dst, ctrl, cnt, ((ctrl>>10) & 1) ? "32" : "16"); + } + + for (int i = 0; i < cnt; i++) + { + if ((ctrl>>10) & 1) + { + src &= 0xfffffffc; + dst &= 0xfffffffc; + + // 32-bit + space.write_dword(dst, space.read_dword(src)); + switch (dstadd) + { + case 0: // increment + dst += 4; + break; + case 1: // decrement + dst -= 4; + break; + case 2: // don't move + break; + case 3: // increment and reload + dst += 4; + break; + } + switch (srcadd) + { + case 0: // increment + src += 4; + break; + case 1: // decrement + src -= 4; + break; + case 2: // don't move + break; + case 3: // not used ("Metal Max 2 Kai" expects no increment/decrement) + break; + } + } + else + { + src &= 0xfffffffe; + dst &= 0xfffffffe; + + // 16-bit + space.write_word(dst, space.read_word(src)); + switch (dstadd) + { + case 0: // increment + dst += 2; + break; + case 1: // decrement + dst -= 2; + break; + case 2: // don't move + break; + case 3: // increment and reload + dst += 2; + break; + } + switch (srcadd) + { + case 0: // increment + src += 2; + break; + case 1: // decrement + src -= 2; + break; + case 2: // don't move + break; + case 3: // not used (see note in 32-bit version above) + break; + } + } + } + + m_dma_src[ch] = src; + m_dma_dst[ch] = dst; + +// printf("settng DMA timer %d for %d cycs (tmr %x)\n", ch, cnt, (UINT32)m_dma_timer[ch]); +// m_dma_timer[ch]->adjust(ATTOTIME_IN_CYCLES(0, cnt), ch); + dma_complete(NULL, ch); +} + +void gba_state::audio_tick(int ref) +{ + if (!(m_SOUNDCNT_X & 0x80)) + { + return; + } + + if (!ref) + { + if (m_fifo_a_ptr != m_fifo_a_in) + { + if (m_fifo_a_ptr == 17) + { + m_fifo_a_ptr = 0; + } + + if (m_SOUNDCNT_H & 0x200) + { + m_ladac->write_signed8(m_fifo_a[m_fifo_a_ptr]^0x80); + } + if (m_SOUNDCNT_H & 0x100) + { + m_radac->write_signed8(m_fifo_a[m_fifo_a_ptr]^0x80); + } + m_fifo_a_ptr++; + } + + // fifo empty? + if (m_fifo_a_ptr == m_fifo_a_in) + { + // is a DMA set up to feed us? + if ((m_dma_regs[(1*3)+1] == 0x40000a0) && ((m_dma_regs[(1*3)+2] & 0x30000000) == 0x30000000)) + { + // channel 1 it is + dma_exec(1); + } + if ((m_dma_regs[(2*3)+1] == 0x40000a0) && ((m_dma_regs[(2*3)+2] & 0x30000000) == 0x30000000)) + { + // channel 2 it is + dma_exec(2); + } + } + } + else + { + if (m_fifo_b_ptr != m_fifo_b_in) + { + if (m_fifo_b_ptr == 17) + { + m_fifo_b_ptr = 0; + } + + if (m_SOUNDCNT_H & 0x2000) + { + m_lbdac->write_signed8(m_fifo_b[m_fifo_b_ptr]^0x80); + } + if (m_SOUNDCNT_H & 0x1000) + { + m_rbdac->write_signed8(m_fifo_b[m_fifo_b_ptr]^0x80); + } + m_fifo_b_ptr++; + } + + if (m_fifo_b_ptr == m_fifo_b_in) + { + // is a DMA set up to feed us? + if ((m_dma_regs[(1*3)+1] == 0x40000a4) && ((m_dma_regs[(1*3)+2] & 0x30000000) == 0x30000000)) + { + // channel 1 it is + dma_exec(1); + } + if ((m_dma_regs[(2*3)+1] == 0x40000a4) && ((m_dma_regs[(2*3)+2] & 0x30000000) == 0x30000000)) + { + // channel 2 it is + dma_exec(2); + } + } + } +} + +TIMER_CALLBACK_MEMBER(gba_state::timer_expire) +{ + static const UINT32 tmr_ints[4] = { INT_TM0_OVERFLOW, INT_TM1_OVERFLOW, INT_TM2_OVERFLOW, INT_TM3_OVERFLOW }; + FPTR tmr = (FPTR) param; + +// printf("Timer %d expired, SOUNDCNT_H %04x\n", tmr, m_SOUNDCNT_H); + + // "The reload value is copied into the counter only upon following two situations: Automatically upon timer overflows," + // "or when the timer start bit becomes changed from 0 to 1." + if (m_timer_recalc[tmr] != 0) + { + double rate, clocksel, final; + attotime time; + m_timer_recalc[tmr] = 0; + m_timer_regs[tmr] = (m_timer_regs[tmr] & 0xFFFF0000) | (m_timer_reload[tmr] & 0x0000FFFF); + rate = 0x10000 - (m_timer_regs[tmr] & 0xffff); + clocksel = timer_clks[(m_timer_regs[tmr] >> 16) & 3]; + final = clocksel / rate; + m_timer_hz[tmr] = final; + time = attotime::from_hz(final); + GBA_ATTOTIME_NORMALIZE(time); + m_tmr_timer[tmr]->adjust(time, tmr, time); + } + + // check if timers 0 or 1 are feeding directsound + if (tmr == 0) + { + if ((m_SOUNDCNT_H & 0x400) == 0) + { + audio_tick(0); + } + + if ((m_SOUNDCNT_H & 0x4000) == 0) + { + audio_tick(1); + } + } + + if (tmr == 1) + { + if ((m_SOUNDCNT_H & 0x400) == 0x400) + { + audio_tick(0); + } + + if ((m_SOUNDCNT_H & 0x4000) == 0x4000) + { + audio_tick(1); + } + } + + // Handle count-up timing + switch (tmr) + { + case 0: + if (m_timer_regs[1] & 0x40000) + { + m_timer_regs[1] = (( ( m_timer_regs[1] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[1] & 0xffff0000); + if( ( m_timer_regs[1] & 0x0000ffff ) == 0 ) + { + m_timer_regs[1] |= m_timer_reload[1]; + if( ( m_timer_regs[1] & 0x400000 ) && ( m_IME != 0 ) ) + { + request_irq(tmr_ints[1]); + } + if( ( m_timer_regs[2] & 0x40000 ) ) + { + m_timer_regs[2] = (( ( m_timer_regs[2] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[2] & 0xffff0000); + if( ( m_timer_regs[2] & 0x0000ffff ) == 0 ) + { + m_timer_regs[2] |= m_timer_reload[2]; + if( ( m_timer_regs[2] & 0x400000 ) && ( m_IME != 0 ) ) + { + request_irq(tmr_ints[2]); + } + if( ( m_timer_regs[3] & 0x40000 ) ) + { + m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); + if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) + { + m_timer_regs[3] |= m_timer_reload[3]; + if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) + { + request_irq(tmr_ints[3]); + } + } + } + } + } + } + } + break; + case 1: + if (m_timer_regs[2] & 0x40000) + { + m_timer_regs[2] = (( ( m_timer_regs[2] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[2] & 0xffff0000); + if( ( m_timer_regs[2] & 0x0000ffff ) == 0 ) + { + m_timer_regs[2] |= m_timer_reload[2]; + if( ( m_timer_regs[2] & 0x400000 ) && ( m_IME != 0 ) ) + { + request_irq(tmr_ints[2]); + } + if( ( m_timer_regs[3] & 0x40000 ) ) + { + m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); + if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) + { + m_timer_regs[3] |= m_timer_reload[3]; + if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) + { + request_irq(tmr_ints[3]); + } + } + } + } + } + break; + case 2: + if (m_timer_regs[3] & 0x40000) + { + m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); + if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) + { + m_timer_regs[3] |= m_timer_reload[3]; + if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) + { + request_irq(tmr_ints[3]); + } + } + } + break; + } + + // are we supposed to IRQ? + if ((m_timer_regs[tmr] & 0x400000) && (m_IME != 0)) + { + request_irq(tmr_ints[tmr]); + } +} + +TIMER_CALLBACK_MEMBER(gba_state::handle_irq) +{ + request_irq(m_IF); + + m_irq_timer->adjust(attotime::never); +} + +READ32_MEMBER(gba_state::gba_io_r) +{ + UINT32 retval = 0; + + switch( offset ) + { + case 0x0000/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: DISPCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_DISPCNT ); + retval |= m_DISPCNT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: Green Swap (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_GRNSWAP ); + retval |= m_GRNSWAP << 16; + } + break; + case 0x0004/4: + retval = (m_DISPSTAT & 0xffff) | (machine().first_screen()->vpos()<<16); + break; + case 0x0008/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG0CNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_BG0CNT ); + retval |= m_BG0CNT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG1CNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_BG1CNT ); + retval |= m_BG1CNT << 16; + } + break; + case 0x000c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2CNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_BG2CNT ); + retval |= m_BG2CNT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3CNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_BG3CNT ); + retval |= m_BG3CNT << 16; + } + break; + case 0x0010/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG0HOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG0VOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0014/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG1HOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG1VOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0018/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2HOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2VOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x001c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3HOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3VOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0020/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2PA (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2PB (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0024/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2PC (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2PD (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0028/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2X_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2X_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x002c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2Y_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG2Y_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0030/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3PA (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3PB (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0034/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3PC (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3PD (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0038/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3X_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3X_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x003c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3Y_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BG3Y_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0040/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: WIN0H (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: WIN1H (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0044/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: WIN0V (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: WIN1V (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0048/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: WININ (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_WININ ); + retval |= m_WININ; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: WINOUT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_WINOUT ); + retval |= m_WINOUT << 16; + } + break; + case 0x004c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: MOSAIC (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0050/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BLDCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_BLDCNT ); + retval |= m_BLDCNT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: BLDALPHA (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_BLDALPHA ); + retval |= m_BLDALPHA << 16; + } + break; + case 0x0054/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: BLDY (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0058/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x005c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0060/4: + retval = m_gbsound->sound_r(space, 0) | m_gbsound->sound_r(space, 1)<<16 | m_gbsound->sound_r(space, 2)<<24; + break; + case 0x0064/4: + retval = m_gbsound->sound_r(space, 3) | m_gbsound->sound_r(space, 4)<<8; + break; + case 0x0068/4: + retval = m_gbsound->sound_r(space, 6) | m_gbsound->sound_r(space, 7)<<8; + break; + case 0x006c/4: + retval = m_gbsound->sound_r(space, 8) | m_gbsound->sound_r(space, 9)<<8; + break; + case 0x0070/4: + retval = m_gbsound->sound_r(space, 0xa) | m_gbsound->sound_r(space, 0xb)<<16 | m_gbsound->sound_r(space, 0xc)<<24; + break; + case 0x0074/4: + retval = m_gbsound->sound_r(space, 0xd) | m_gbsound->sound_r(space, 0xe)<<8; + break; + case 0x0078/4: + retval = m_gbsound->sound_r(space, 0x10) | m_gbsound->sound_r(space, 0x11)<<8; + break; + case 0x007c/4: + retval = m_gbsound->sound_r(space, 0x12) | m_gbsound->sound_r(space, 0x13)<<8; + break; + case 0x0080/4: + retval = m_gbsound->sound_r(space, 0x14) | m_gbsound->sound_r(space, 0x15)<<8; + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: SOUNDCNT_H (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_SOUNDCNT_H ); + retval |= m_SOUNDCNT_H << 16; + } + break; + case 0x0084/4: + retval = m_gbsound->sound_r(space, 0x16); + break; + case 0x0088/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: SOUNDBIAS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_SOUNDBIAS ); + retval |= m_SOUNDBIAS; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0090/4: + retval = m_gbsound->wave_r(space, 0) | m_gbsound->wave_r(space, 1)<<8 | m_gbsound->wave_r(space, 2)<<16 | m_gbsound->wave_r(space, 3)<<24; + break; + case 0x0094/4: + retval = m_gbsound->wave_r(space, 4) | m_gbsound->wave_r(space, 5)<<8 | m_gbsound->wave_r(space, 6)<<16 | m_gbsound->wave_r(space, 7)<<24; + break; + case 0x0098/4: + retval = m_gbsound->wave_r(space, 8) | m_gbsound->wave_r(space, 9)<<8 | m_gbsound->wave_r(space, 10)<<16 | m_gbsound->wave_r(space, 11)<<24; + break; + case 0x009c/4: + retval = m_gbsound->wave_r(space, 12) | m_gbsound->wave_r(space, 13)<<8 | m_gbsound->wave_r(space, 14)<<16 | m_gbsound->wave_r(space, 15)<<24; + break; + case 0x00a0/4: + case 0x00a4/4: + retval = 0; // (does this actually do anything on real h/w?) + break; + case 0x00b0/4: + case 0x00b4/4: + case 0x00b8/4: + case 0x00bc/4: + case 0x00c0/4: + case 0x00c4/4: + case 0x00c8/4: + case 0x00cc/4: + case 0x00d0/4: + case 0x00d4/4: + case 0x00d8/4: + case 0x00dc/4: + { + // no idea why here, but it matches VBA better + // note: this suspicious piece of code crashes "Buffy The Vampire Slayer" (08008DB4) and "The Ant Bully", so disable it for now + #if 0 + if (((offset-0xb0/4) % 3) == 2) + { + retval = m_dma_regs[offset-(0xb0/4)] & 0xff000000; + } + else + #endif + + retval = m_dma_regs[offset-(0xb0/4)]; + } + break; + case 0x0100/4: + case 0x0104/4: + case 0x0108/4: + case 0x010c/4: + { + UINT32 elapsed; + double time, ticks; + int timer = offset-(0x100/4); + +// printf("Read timer reg %x (PC=%x)\n", timer, space.device().safe_pc()); + + // update times for + if (m_timer_regs[timer] & 0x800000) + { + if (m_timer_regs[timer] & 0x00040000) + { + elapsed = m_timer_regs[timer] & 0xffff; + } + else + { + time = m_tmr_timer[timer]->elapsed().as_double(); + + ticks = (double)(0x10000 - (m_timer_regs[timer] & 0xffff)); + +// printf("time %f ticks %f 1/hz %f\n", time, ticks, 1.0 / m_timer_hz[timer]); + + time *= ticks; + time /= (1.0 / m_timer_hz[timer]); + + elapsed = (UINT32)time; + + } + +// printf("elapsed = %x\n", elapsed); + } + else + { +// printf("Reading inactive timer!\n"); + elapsed = 0; + } + + retval = (m_timer_regs[timer] & 0xffff0000) | (elapsed & 0xffff); + } + break; + case 0x0120/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: SIOMULTI0 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_SIOMULTI0 ); + retval |= m_SIOMULTI0; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: SIOMULTI1 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_SIOMULTI1 ); + retval |= m_SIOMULTI1 << 16; + } + break; + case 0x0124/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: SIOMULTI2 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_SIOMULTI2 ); + retval |= m_SIOMULTI2; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: SIOMULTI3 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_SIOMULTI3 ); + retval |= m_SIOMULTI3 << 16; + } + break; + case 0x0128/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: SIOCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_SIOCNT ); + retval |= m_SIOCNT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: SIODATA8 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_SIODATA8 ); + retval |= m_SIODATA8 << 16; + } + break; + case 0x0130/4: + if( (mem_mask) & 0x0000ffff ) // KEYINPUT + { + retval = m_io_inputs->read(); + } + else if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: KEYCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_KEYCNT ); + retval |= m_KEYCNT << 16; + } + break; + case 0x0134/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: RCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_RCNT ); + retval |= m_RCNT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: IR (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0140/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: JOYCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_JOYCNT ); + retval |= m_JOYCNT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0150/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: JOY_RECV_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_JOY_RECV & 0x0000ffff ); + retval |= m_JOY_RECV & 0x0000ffff; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: JOY_RECV_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, ( m_JOY_RECV & 0xffff0000 ) >> 16 ); + retval |= m_JOY_RECV & 0xffff0000; + } + break; + case 0x0154/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: JOY_TRANS_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_JOY_TRANS & 0x0000ffff ); + retval |= m_JOY_TRANS & 0x0000ffff; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: JOY_TRANS_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, ( m_JOY_TRANS & 0xffff0000 ) >> 16 ); + retval |= m_JOY_TRANS & 0xffff0000; + } + break; + case 0x0158/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: JOYSTAT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_JOYSTAT ); + retval |= m_JOYSTAT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0200/4: + if( (mem_mask) & 0x0000ffff ) + { +// printf("Read: IE (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_IE ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: IF (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_IF ); + } + + retval = m_IE | (m_IF<<16); + break; + case 0x0204/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: WAITCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_WAITCNT ); + retval |= m_WAITCNT; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0208/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Read: IME (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_IME ); + retval |= m_IME; + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); + } + break; + case 0x0300/4: + retval = m_HALTCNT << 8; + break; + default: +// verboselog(machine(), 0, "Unknown GBA I/O register Read: %08x (%08x)\n", 0x04000000 + ( offset << 2 ), ~mem_mask ); + break; + } + return retval; +} + +WRITE32_MEMBER(gba_state::gba_io_w) +{ + switch( offset ) + { + case 0x0000/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: DISPCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_DISPCNT = ( m_DISPCNT & ~mem_mask ) | ( data & mem_mask ); + if(m_DISPCNT & (DISPCNT_WIN0_EN | DISPCNT_WIN1_EN)) + { + m_windowOn = 1; + } + else + { + m_windowOn = 0; + } + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: Green Swap (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_GRNSWAP = ( m_GRNSWAP & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0004/4: + COMBINE_DATA(&m_DISPSTAT); + break; + case 0x0008/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG0CNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG0CNT = ( m_BG0CNT & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG1CNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG1CNT = ( m_BG1CNT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x000c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2CNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG2CNT = ( m_BG2CNT & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3CNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG3CNT = ( m_BG3CNT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0010/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG0HOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG0HOFS = ( m_BG0HOFS & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG0VOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG0VOFS = ( m_BG0VOFS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0014/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG1HOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG1HOFS = ( m_BG1HOFS & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG1VOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG1VOFS = ( m_BG1VOFS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0018/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2HOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG2HOFS = ( m_BG2HOFS & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2VOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG2VOFS = ( m_BG2VOFS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x001c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3HOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG3HOFS = ( m_BG3HOFS & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3VOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG3VOFS = ( m_BG3VOFS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0020/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2PA (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG2PA = ( m_BG2PA & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2PB (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG2PB = ( m_BG2PB & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0024/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2PC (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG2PC = ( m_BG2PC & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2PD (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG2PD = ( m_BG2PD & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0028/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2X_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2X_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + COMBINE_DATA(&m_BG2X); + m_gfxBG2Changed |= 1; + break; + case 0x002c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2Y_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG2Y_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + COMBINE_DATA(&m_BG2Y); + m_gfxBG2Changed |= 2; + break; + case 0x0030/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3PA (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG3PA = ( m_BG3PA & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3PB (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG3PB = ( m_BG3PB & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0034/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3PC (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BG3PC = ( m_BG3PC & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3PD (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BG3PD = ( m_BG3PD & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0038/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3X_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3X_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + COMBINE_DATA(&m_BG3X); + m_gfxBG3Changed |= 1; + break; + case 0x003c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3Y_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BG3Y_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + COMBINE_DATA(&m_BG3Y); + m_gfxBG3Changed |= 2; + break; + case 0x0040/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: WIN0H (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_WIN0H = ( m_WIN0H & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: WIN1H (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_WIN1H = ( m_WIN1H & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0044/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: WIN0V (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_WIN0V = ( m_WIN0V & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: WIN1V (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_WIN1V = ( m_WIN1V & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0048/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: WININ (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_WININ = ( m_WININ & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: WINOUT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_WINOUT = ( m_WINOUT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x004c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: MOSAIC (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_MOSAIC = ( m_MOSAIC & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + break; + case 0x0050/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BLDCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BLDCNT = ( m_BLDCNT & ~mem_mask ) | ( data & mem_mask ); + if(m_BLDCNT & BLDCNT_SFX) + { + m_fxOn = 1; + } + else + { + m_fxOn = 0; + } + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: BLDALPHA (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + m_BLDALPHA = ( m_BLDALPHA & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0054/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: BLDY (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_BLDY = ( m_BLDY & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + break; + case 0x0058/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + break; + case 0x005c/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + break; + case 0x0060/4: + if( (mem_mask) & 0x000000ff ) // SOUNDCNTL + { + m_gbsound->sound_w(space, 0, data); + } + if( (mem_mask) & 0x00ff0000 ) + { + m_gbsound->sound_w(space, 1, data>>16); // SOUND1CNT_H + } + if( (mem_mask) & 0xff000000 ) + { + m_gbsound->sound_w(space, 2, data>>24); + } + break; + case 0x0064/4: + if( (mem_mask) & 0x000000ff ) // SOUNDCNTL + { + m_gbsound->sound_w(space, 3, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->sound_w(space, 4, data>>8); // SOUND1CNT_H + } + break; + case 0x0068/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->sound_w(space, 6, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->sound_w(space, 7, data>>8); + } + break; + case 0x006c/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->sound_w(space, 8, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->sound_w(space, 9, data>>8); + } + break; + case 0x0070/4: //SND3CNTL and H + if( (mem_mask) & 0x000000ff ) // SOUNDCNTL + { + m_gbsound->sound_w(space, 0xa, data); + } + if( (mem_mask) & 0x00ff0000 ) + { + m_gbsound->sound_w(space, 0xb, data>>16); // SOUND1CNT_H + } + if( (mem_mask) & 0xff000000 ) + { + m_gbsound->sound_w(space, 0xc, data>>24); + } + break; + case 0x0074/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->sound_w(space, 0xd, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->sound_w(space, 0xe, data>>8); + } + break; + case 0x0078/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->sound_w(space, 0x10, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->sound_w(space, 0x11, data>>8); + } + break; + case 0x007c/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->sound_w(space, 0x12, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->sound_w(space, 0x13, data>>8); + } + break; + case 0x0080/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->sound_w(space, 0x14, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->sound_w(space, 0x15, data>>8); + } + + if ((mem_mask) & 0xffff0000) + { + data >>= 16; + m_SOUNDCNT_H = data; + + // DAC A reset? + if (data & 0x0800) + { + m_fifo_a_ptr = 17; + m_fifo_a_in = 17; + m_ladac->write_signed8(0x80); + m_radac->write_signed8(0x80); + } + + // DAC B reset? + if (data & 0x8000) + { + m_fifo_b_ptr = 17; + m_fifo_b_in = 17; + m_lbdac->write_signed8(0x80); + m_rbdac->write_signed8(0x80); + } + } + break; + case 0x0084/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->sound_w(space, 0x16, data); + if ((data & 0x80) && !(m_SOUNDCNT_X & 0x80)) + { + m_fifo_a_ptr = m_fifo_a_in = 17; + m_fifo_b_ptr = m_fifo_b_in = 17; + m_ladac->write_signed8(0x80); + m_radac->write_signed8(0x80); + m_lbdac->write_signed8(0x80); + m_rbdac->write_signed8(0x80); + } + m_SOUNDCNT_X = data; + } + break; + case 0x0088/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: SOUNDBIAS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); + m_SOUNDBIAS = ( m_SOUNDBIAS & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + break; + case 0x0090/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->wave_w(space, 0, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->wave_w(space, 1, data>>8); + } + if( (mem_mask) & 0x00ff0000 ) + { + m_gbsound->wave_w(space, 2, data>>16); + } + if( (mem_mask) & 0xff000000 ) + { + m_gbsound->wave_w(space, 3, data>>24); + } + break; + case 0x0094/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->wave_w(space, 4, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->wave_w(space, 5, data>>8); + } + if( (mem_mask) & 0x00ff0000 ) + { + m_gbsound->wave_w(space, 6, data>>16); + } + if( (mem_mask) & 0xff000000 ) + { + m_gbsound->wave_w(space, 7, data>>24); + } + break; + case 0x0098/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->wave_w(space, 8, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->wave_w(space, 9, data>>8); + } + if( (mem_mask) & 0x00ff0000 ) + { + m_gbsound->wave_w(space, 0xa, data>>16); + } + if( (mem_mask) & 0xff000000 ) + { + m_gbsound->wave_w(space, 0xb, data>>24); + } + break; + case 0x009c/4: + if( (mem_mask) & 0x000000ff ) + { + m_gbsound->wave_w(space, 0xc, data); + } + if( (mem_mask) & 0x0000ff00 ) + { + m_gbsound->wave_w(space, 0xd, data>>8); + } + if( (mem_mask) & 0x00ff0000 ) + { + m_gbsound->wave_w(space, 0xe, data>>16); + } + if( (mem_mask) & 0xff000000 ) + { + m_gbsound->wave_w(space, 0xf, data>>24); + } + break; + case 0x00a0/4: + m_fifo_a_in %= 17; + m_fifo_a[m_fifo_a_in++] = (data)&0xff; + m_fifo_a_in %= 17; + m_fifo_a[m_fifo_a_in++] = (data>>8)&0xff; + m_fifo_a_in %= 17; + m_fifo_a[m_fifo_a_in++] = (data>>16)&0xff; + m_fifo_a_in %= 17; + m_fifo_a[m_fifo_a_in++] = (data>>24)&0xff; + break; + case 0x00a4/4: + m_fifo_b_in %= 17; + m_fifo_b[m_fifo_b_in++] = (data)&0xff; + m_fifo_b_in %= 17; + m_fifo_b[m_fifo_b_in++] = (data>>8)&0xff; + m_fifo_b_in %= 17; + m_fifo_b[m_fifo_b_in++] = (data>>16)&0xff; + m_fifo_b_in %= 17; + m_fifo_b[m_fifo_b_in++] = (data>>24)&0xff; + break; + case 0x00b0/4: + case 0x00b4/4: + case 0x00b8/4: + + case 0x00bc/4: + case 0x00c0/4: + case 0x00c4/4: + + case 0x00c8/4: + case 0x00cc/4: + case 0x00d0/4: + + case 0x00d4/4: + case 0x00d8/4: + case 0x00dc/4: + { + int ch; + + offset -= (0xb0/4); + + ch = offset / 3; + +// printf("%08x: DMA(%d): %x to reg %d (mask %08x)\n", space.device().safe_pc(), ch, data, offset%3, ~mem_mask); + + if (((offset % 3) == 2) && ((~mem_mask & 0xffff0000) == 0)) + { + int ctrl = data>>16; + + // Note: Metroid Fusion fails if we enforce the "rising edge" requirement... (who wrote this note?) + + // Note: Caesar's Palace Advance fails if we DO NOT enforce the "rising edge" requirement + // (value @ 0x3003F9C is accidentally incremented because DMA completion interrupt is accidentally triggered @ 08002F2A) + + // retrigger/restart on a rising edge. + // also reload internal regs + if ((ctrl & 0x8000) && !(m_dma_regs[offset] & 0x80000000)) + { + m_dma_src[ch] = m_dma_regs[(ch*3)+0]; + m_dma_dst[ch] = m_dma_regs[(ch*3)+1]; + m_dma_srcadd[ch] = (ctrl>>7)&3; + m_dma_dstadd[ch] = (ctrl>>5)&3; + + COMBINE_DATA(&m_dma_regs[offset]); + m_dma_cnt[ch] = m_dma_regs[(ch*3)+2]&0xffff; + + // immediate start + if ((ctrl & 0x3000) == 0) + { + dma_exec(ch); + return; + } + } + } + + COMBINE_DATA(&m_dma_regs[offset]); + } + break; + case 0x0100/4: + case 0x0104/4: + case 0x0108/4: + case 0x010c/4: + { + double rate, clocksel; + UINT32 old_timer_regs; + + offset -= (0x100/4); + + old_timer_regs = m_timer_regs[offset]; + + m_timer_regs[offset] = (m_timer_regs[offset] & ~(mem_mask & 0xFFFF0000)) | (data & (mem_mask & 0xFFFF0000)); + +// printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, space.device().safe_pc()); + + if (ACCESSING_BITS_0_15) + { + m_timer_reload[offset] = ((m_timer_reload[offset] & ~mem_mask) | (data & mem_mask)) & 0x0000FFFF; + m_timer_recalc[offset] = 1; + } + + // enabling this timer? + if ((ACCESSING_BITS_16_31) && (data & 0x800000)) + { + double final; + + if ((old_timer_regs & 0x00800000) == 0) // start bit 0 -> 1 + { + m_timer_regs[offset] = (m_timer_regs[offset] & 0xFFFF0000) | (m_timer_reload[offset] & 0x0000FFFF); + } + + rate = 0x10000 - (m_timer_regs[offset] & 0xffff); + + clocksel = timer_clks[(m_timer_regs[offset] >> 16) & 3]; + + final = clocksel / rate; + + m_timer_hz[offset] = final; + + m_timer_recalc[offset] = 0; + +// printf("Enabling timer %d @ %f Hz\n", offset, final); + + // enable the timer + if( !(data & 0x40000) ) // if we're not in Count-Up mode + { + attotime time = attotime::from_hz(final); + GBA_ATTOTIME_NORMALIZE(time); + m_tmr_timer[offset]->adjust(time, offset, time); + } + } + } + break; + case 0x0120/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: SIOMULTI0 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_SIOMULTI0 = ( m_SIOMULTI0 & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: SIOMULTI1 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + m_SIOMULTI1 = ( m_SIOMULTI1 & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0124/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: SIOMULTI2 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_SIOMULTI2 = ( m_SIOMULTI2 & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: SIOMULTI3 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + m_SIOMULTI3 = ( m_SIOMULTI3 & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0128/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: SIOCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + // normal mode ? + if (((m_RCNT & 0x8000) == 0) && ((data & 0x2000) == 0)) + { + // start ? + if (((m_SIOCNT & 0x0080) == 0) && ((data & 0x0080) != 0)) + { + data &= ~0x0080; + // request interrupt ? + if (data & 0x4000) + { + request_irq(INT_SIO); + } + } + } + m_SIOCNT = ( m_SIOCNT & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: SIODATA8 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + m_SIODATA8 = ( m_SIODATA8 & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0130/4: + if( (mem_mask) & 0xffff0000 ) + { +// printf("KEYCNT = %04x\n", data>>16); + verboselog(machine(), 2, "GBA IO Register Write: KEYCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + m_KEYCNT = ( m_KEYCNT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0134/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: RCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_RCNT = ( m_RCNT & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: IR (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + m_IR = ( m_IR & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0140/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: JOYCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_JOYCNT = ( m_JOYCNT & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + } + break; + case 0x0150/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: JOY_RECV_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_JOY_RECV = ( m_JOY_RECV & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: JOY_RECV_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + m_JOY_RECV = ( m_JOY_RECV & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0154/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: JOY_TRANS_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_JOY_TRANS = ( m_JOY_TRANS & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: JOY_TRANS_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + m_JOY_TRANS = ( m_JOY_TRANS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); + } + break; + case 0x0158/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: JOYSTAT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_JOYSTAT = ( m_JOYSTAT & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + } + break; + case 0x0200/4: + if( (mem_mask) & 0x0000ffff ) + { +// printf("IE (%08x) = %04x raw %x (%08x) (scan %d PC %x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, data, ~mem_mask, machine.first_screen()->vpos(), space.device().safe_pc()); + m_IE = ( m_IE & ~mem_mask ) | ( data & mem_mask ); +#if 0 + if (m_IE & m_IF) + { + request_irq(m_IF); + } +#endif + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: IF (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ) + 2, ( data & mem_mask ) >> 16, ~mem_mask ); + m_IF &= ~( ( data & mem_mask ) >> 16 ); + + // if we still have interrupts, yank the IRQ line again + if (m_IF) + { + m_irq_timer->adjust(m_maincpu->clocks_to_attotime(120)); + } + } + break; + case 0x0204/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 2, "GBA IO Register Write: WAITCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_WAITCNT = ( m_WAITCNT & ~mem_mask ) | ( data & mem_mask ); + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + } + break; + case 0x0208/4: + if( (mem_mask) & 0x0000ffff ) + { + verboselog(machine(), 3, "GBA IO Register Write: IME (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); + m_IME = ( m_IME & ~mem_mask ) | ( data & mem_mask ); + if (m_IF) + { + m_irq_timer->adjust(attotime::zero); + } + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 3, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); + } + break; + case 0x0300/4: + if( (mem_mask) & 0x0000ffff ) + { + if( (mem_mask) & 0x000000ff ) + { + verboselog(machine(), 2, "GBA IO Register Write: POSTFLG (%08x) = %02x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x000000ff, ~mem_mask ); + m_POSTFLG = data & 0x000000ff; + } + else + { + m_HALTCNT = data & 0x000000ff; + + // either way, wait for an IRQ + m_maincpu->spin_until_interrupt(); + } + } + if( (mem_mask) & 0xffff0000 ) + { + verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); + } + break; + default: +// verboselog(machine, 0, "Unknown GBA I/O register write: %08x = %08x (%08x)\n", 0x04000000 + ( offset << 2 ), data, ~mem_mask ); + break; + } +} + +INLINE UINT32 COMBINE_DATA32_16(UINT32 prev, UINT32 data, UINT32 mem_mask) +{ + COMBINE_DATA(&prev); + switch(mem_mask) + { + case 0x000000ff: + prev &= 0xffff00ff; + prev |= data << 8; + break; + case 0x0000ff00: + prev &= 0xffffff00; + prev |= data >> 8; + break; + case 0x00ff0000: + prev &= 0x00ffffff; + prev |= data << 8; + break; + case 0xff000000: + prev &= 0xff00ffff; + prev |= data >> 8; + break; + default: + break; + } + return prev; +} + +WRITE32_MEMBER(gba_state::gba_pram_w) +{ + m_gba_pram[offset] = COMBINE_DATA32_16(m_gba_pram[offset], data, mem_mask); +} + +WRITE32_MEMBER(gba_state::gba_vram_w) +{ + m_gba_vram[offset] = COMBINE_DATA32_16(m_gba_vram[offset], data, mem_mask); +} + +WRITE32_MEMBER(gba_state::gba_oam_w) +{ + m_gba_oam[offset] = COMBINE_DATA32_16(m_gba_oam[offset], data, mem_mask); +} + +READ32_MEMBER(gba_state::gba_bios_r) +{ + UINT32 *rom = m_region_maincpu; + if (m_bios_hack->read()) + { + // partially patch out logo and checksum checks + // (useful to run some protos + to test homebrew) + if (ACCESSING_BITS_0_15 && (offset == 0x6fc/4)) + return 0; + } + + if (m_bios_protected != 0) + offset = (m_bios_last_address + 8) / 4; + + return rom[offset & 0x3fff]; +} + +READ32_MEMBER(gba_state::gba_10000000_r) +{ + UINT32 data; + UINT32 pc = m_maincpu->state_int(ARM7_PC); + UINT32 cpsr = m_maincpu->state_int(ARM7_CPSR); + if (T_IS_SET( cpsr)) + { + data = space.read_dword(pc + 8); + } + else + { + UINT16 insn = space.read_word(pc + 4); + data = (insn << 16) | (insn << 0); + } + logerror("%s: unmapped program memory read from %08X = %08X & %08X\n", machine().describe_context( ), 0x10000000 + (offset << 2), data, mem_mask); + return data; +} + +static ADDRESS_MAP_START( gba_map, AS_PROGRAM, 32, gba_state ) + ADDRESS_MAP_UNMAP_HIGH // for "Fruit Mura no Doubutsu Tachi" and "Classic NES Series" + AM_RANGE(0x00000000, 0x00003fff) AM_ROM AM_READ(gba_bios_r) + AM_RANGE(0x02000000, 0x0203ffff) AM_RAM AM_MIRROR(0xfc0000) + AM_RANGE(0x03000000, 0x03007fff) AM_RAM AM_MIRROR(0xff8000) + AM_RANGE(0x04000000, 0x040003ff) AM_READWRITE(gba_io_r, gba_io_w) + AM_RANGE(0x05000000, 0x050003ff) AM_RAM_WRITE(gba_pram_w) AM_SHARE("gba_pram") // Palette RAM + AM_RANGE(0x06000000, 0x06017fff) AM_RAM_WRITE(gba_vram_w) AM_SHARE("gba_vram") // VRAM + AM_RANGE(0x07000000, 0x070003ff) AM_RAM_WRITE(gba_oam_w) AM_SHARE("gba_oam") // OAM + //AM_RANGE(0x08000000, 0x0cffffff) // cart ROM + mirrors, mapped here at machine_start if a cart is present + AM_RANGE(0x10000000, 0xffffffff) AM_READ(gba_10000000_r) // for "Justice League Chronicles" (game bug) +ADDRESS_MAP_END + +static INPUT_PORTS_START( gbadv ) + PORT_START("INPUTS") + PORT_BIT( 0xfc00, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_UNUSED + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 L") PORT_PLAYER(1) // L + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 R") PORT_PLAYER(1) // R + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) // START + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_PLAYER(1) // SELECT + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("B") PORT_PLAYER(1) // B + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("A") PORT_PLAYER(1) // A + + PORT_START("SKIP_CHECK") + PORT_CONFNAME( 0x01, 0x00, "[HACK] Skip BIOS Logo check" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) +INPUT_PORTS_END + + +TIMER_CALLBACK_MEMBER(gba_state::perform_hbl) +{ + int ch, ctrl; + int scanline = machine().first_screen()->vpos(); + + // draw only visible scanlines + if (scanline < 160) + { + draw_scanline(scanline); + + for (ch = 0; ch < 4; ch++) + { + ctrl = m_dma_regs[(ch*3)+2]>>16; + + // HBL-triggered DMA? + if ((ctrl & 0x8000) && ((ctrl & 0x3000) == 0x2000)) + { + dma_exec(ch); + } + } + } + + if ((m_DISPSTAT & DISPSTAT_HBL_IRQ_EN ) != 0) + { + request_irq(INT_HBL); + } + + m_DISPSTAT |= DISPSTAT_HBL; + + m_hbl_timer->adjust(attotime::never); +} + +TIMER_CALLBACK_MEMBER(gba_state::perform_scan) +{ + int scanline; + + // clear hblank and raster IRQ flags + m_DISPSTAT &= ~(DISPSTAT_HBL|DISPSTAT_VCNT); + + scanline = machine().first_screen()->vpos(); + + // VBL is set for scanlines 160 through 226 (but not 227, which is the last line) + if (scanline >= 160 && scanline < 227) + { + m_DISPSTAT |= DISPSTAT_VBL; + + // VBL IRQ and DMA on line 160 + if (scanline == 160) + { + int ch, ctrl; + + if (m_DISPSTAT & DISPSTAT_VBL_IRQ_EN) + { + request_irq(INT_VBL); + } + + for (ch = 0; ch < 4; ch++) + { + ctrl = m_dma_regs[(ch*3)+2]>>16; + + // VBL-triggered DMA? + if ((ctrl & 0x8000) && ((ctrl & 0x3000) == 0x1000)) + { + dma_exec(ch); + } + } + } + } + else + { + m_DISPSTAT &= ~DISPSTAT_VBL; + } + + // handle VCNT match interrupt/flag + if (scanline == ((m_DISPSTAT >> 8) & 0xff)) + { + m_DISPSTAT |= DISPSTAT_VCNT; + if (m_DISPSTAT & DISPSTAT_VCNT_IRQ_EN) + { + request_irq(INT_VCNT); + } + } + + m_hbl_timer->adjust(machine().first_screen()->time_until_pos(scanline, 240)); + m_scan_timer->adjust(machine().first_screen()->time_until_pos(( scanline + 1 ) % 228, 0)); +} + +void gba_state::machine_reset() +{ + //memset(this, 0, sizeof(this)); + m_SOUNDBIAS = 0x0200; + m_SIOMULTI0 = 0xffff; + m_SIOMULTI1 = 0xffff; + m_SIOMULTI2 = 0xffff; + m_SIOMULTI3 = 0xffff; + m_KEYCNT = 0x03ff; + m_RCNT = 0x8000; + m_JOYSTAT = 0x0002; + m_gfxBG2Changed = 0; + m_gfxBG3Changed = 0; + m_gfxBG2X = 0; + m_gfxBG2Y = 0; + m_gfxBG3X = 0; + m_gfxBG3Y = 0; + + m_windowOn = 0; + m_fxOn = 0; + + m_bios_protected = 0; + + m_scan_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); + m_hbl_timer->adjust(attotime::never); + m_dma_timer[0]->adjust(attotime::never); + m_dma_timer[1]->adjust(attotime::never, 1); + m_dma_timer[2]->adjust(attotime::never, 2); + m_dma_timer[3]->adjust(attotime::never, 3); + + m_fifo_a_ptr = m_fifo_b_ptr = 17; // indicate empty + m_fifo_a_in = m_fifo_b_in = 17; + + // and clear the DACs + m_ladac->write_signed8(0x80); + m_radac->write_signed8(0x80); + m_lbdac->write_signed8(0x80); + m_rbdac->write_signed8(0x80); +} + +void gba_state::machine_start() +{ + /* create a timer to fire scanline functions */ + m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_scan),this)); + m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_hbl),this)); + m_scan_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); + + /* and one for each DMA channel */ + m_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); + m_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); + m_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); + m_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); + m_dma_timer[0]->adjust(attotime::never); + m_dma_timer[1]->adjust(attotime::never, 1); + m_dma_timer[2]->adjust(attotime::never, 2); + m_dma_timer[3]->adjust(attotime::never, 3); + + /* also one for each timer (heh) */ + m_tmr_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); + m_tmr_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); + m_tmr_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); + m_tmr_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); + m_tmr_timer[0]->adjust(attotime::never); + m_tmr_timer[1]->adjust(attotime::never, 1); + m_tmr_timer[2]->adjust(attotime::never, 2); + m_tmr_timer[3]->adjust(attotime::never, 3); + + /* and an IRQ handling timer */ + m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::handle_irq),this)); + m_irq_timer->adjust(attotime::never); + + // install the cart ROM & SRAM into the address map, if present + if (m_cart->exists()) + { + m_maincpu->space(AS_PROGRAM).install_read_bank(0x08000000, 0x09ffffff, 0, 0, "rom1"); + m_maincpu->space(AS_PROGRAM).install_read_bank(0x0a000000, 0x0bffffff, 0, 0, "rom2"); + m_maincpu->space(AS_PROGRAM).install_read_bank(0x0c000000, 0x0cffffff, 0, 0, "rom3"); + + std::string region_tag; + memory_region *cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GBASLOT_ROM_REGION_TAG).c_str()); + + // install ROM accesses + membank("rom1")->set_base(cart_rom->base()); + membank("rom2")->set_base(cart_rom->base()); + membank("rom3")->set_base(cart_rom->base()); + + // add nvram to save state + m_cart->save_nvram(); + + // install the cart NVRAM handlers if necessary + if (m_cart->get_type() == GBA_SRAM) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0xe000000, 0xe00ffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000000, 0xe00ffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); + } + if (m_cart->get_type() == GBA_EEPROM || m_cart->get_type() == GBA_EEPROM4 || m_cart->get_type() == GBA_EEPROM64) + { + // for games larger than 16MB the actual range is smaller but read_ram/write_ram handles that! + m_maincpu->space(AS_PROGRAM).install_read_handler(0xd000000, 0xdffffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd000000, 0xdffffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); + } + // merge the two flash and mask accesses in read_ram?!? + if (m_cart->get_type() == GBA_FLASH || m_cart->get_type() == GBA_FLASH512) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0xe000000, 0xe00ffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000000, 0xe00ffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); + } + if (m_cart->get_type() == GBA_FLASH1M) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0xe000000, 0xe01ffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000000, 0xe01ffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); + } + } + + save_item(NAME(m_DISPSTAT)); + save_item(NAME(m_BG2X)); + save_item(NAME(m_BG2Y)); + save_item(NAME(m_BG3X)); + save_item(NAME(m_BG3Y)); + save_item(NAME(m_DISPCNT)); + save_item(NAME(m_GRNSWAP)); + save_item(NAME(m_BG0CNT)); + save_item(NAME(m_BG1CNT)); + save_item(NAME(m_BG2CNT)); + save_item(NAME(m_BG3CNT)); + save_item(NAME(m_BG0HOFS)); + save_item(NAME(m_BG0VOFS)); + save_item(NAME(m_BG1HOFS)); + save_item(NAME(m_BG1VOFS)); + save_item(NAME(m_BG2HOFS)); + save_item(NAME(m_BG2VOFS)); + save_item(NAME(m_BG3HOFS)); + save_item(NAME(m_BG3VOFS)); + save_item(NAME(m_BG2PA)); + save_item(NAME(m_BG2PB)); + save_item(NAME(m_BG2PC)); + save_item(NAME(m_BG2PD)); + save_item(NAME(m_BG3PA)); + save_item(NAME(m_BG3PB)); + save_item(NAME(m_BG3PC)); + save_item(NAME(m_BG3PD)); + save_item(NAME(m_WIN0H)); + save_item(NAME(m_WIN1H)); + save_item(NAME(m_WIN0V)); + save_item(NAME(m_WIN1V)); + save_item(NAME(m_WININ)); + save_item(NAME(m_WINOUT)); + save_item(NAME(m_MOSAIC)); + save_item(NAME(m_BLDCNT)); + save_item(NAME(m_BLDALPHA)); + save_item(NAME(m_BLDY)); + save_item(NAME(m_SOUNDCNT_X)); + save_item(NAME(m_SOUNDCNT_H)); + save_item(NAME(m_SOUNDBIAS)); + save_item(NAME(m_SIOMULTI0)); + save_item(NAME(m_SIOMULTI1)); + save_item(NAME(m_SIOMULTI2)); + save_item(NAME(m_SIOMULTI3)); + save_item(NAME(m_SIOCNT)); + save_item(NAME(m_SIODATA8)); + save_item(NAME(m_KEYCNT)); + save_item(NAME(m_RCNT)); + save_item(NAME(m_JOYCNT)); + save_item(NAME(m_JOY_RECV)); + save_item(NAME(m_JOY_TRANS)); + save_item(NAME(m_JOYSTAT)); + save_item(NAME(m_IR)); + save_item(NAME(m_IE)); + save_item(NAME(m_IF)); + save_item(NAME(m_IME)); + save_item(NAME(m_WAITCNT)); + save_item(NAME(m_POSTFLG)); + save_item(NAME(m_HALTCNT)); + save_item(NAME(m_windowOn)); + save_item(NAME(m_fxOn)); + save_item(NAME(m_gfxBG2Changed)); + save_item(NAME(m_gfxBG3Changed)); + save_item(NAME(m_gfxBG2X)); + save_item(NAME(m_gfxBG2Y)); + save_item(NAME(m_gfxBG3X)); + save_item(NAME(m_gfxBG3Y)); + save_item(NAME(m_dma_regs)); + save_item(NAME(m_dma_src)); + save_item(NAME(m_dma_dst)); + save_item(NAME(m_dma_cnt)); + save_item(NAME(m_dma_srcadd)); + save_item(NAME(m_dma_dstadd)); + save_item(NAME(m_timer_regs)); + save_item(NAME(m_timer_reload)); + save_item(NAME(m_timer_recalc)); + save_item(NAME(m_timer_hz)); + save_item(NAME(m_fifo_a_ptr)); + save_item(NAME(m_fifo_b_ptr)); + save_item(NAME(m_fifo_a_in)); + save_item(NAME(m_fifo_b_in)); + save_item(NAME(m_fifo_a)); + save_item(NAME(m_fifo_b)); + save_item(NAME(m_xferscan)); + save_item(NAME(m_bios_last_address)); + save_item(NAME(m_bios_protected)); +} + + + +static SLOT_INTERFACE_START(gba_cart) + SLOT_INTERFACE_INTERNAL("gba_rom", GBA_ROM_STD) + SLOT_INTERFACE_INTERNAL("gba_sram", GBA_ROM_SRAM) + SLOT_INTERFACE_INTERNAL("gba_eeprom", GBA_ROM_EEPROM) + SLOT_INTERFACE_INTERNAL("gba_eeprom_4k", GBA_ROM_EEPROM) + SLOT_INTERFACE_INTERNAL("gba_eeprom_64k", GBA_ROM_EEPROM64) + SLOT_INTERFACE_INTERNAL("gba_flash", GBA_ROM_FLASH) // Panasonic + SLOT_INTERFACE_INTERNAL("gba_flash_512", GBA_ROM_FLASH) // Panasonic + SLOT_INTERFACE_INTERNAL("gba_flash_1m", GBA_ROM_FLASH1M) // Sanyo +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( gbadv, gba_state ) + + MCFG_CPU_ADD("maincpu", ARM7, 16777216) + MCFG_CPU_PROGRAM_MAP(gba_map) + + MCFG_SCREEN_ADD("gbalcd", RASTER) // htot hst vwid vtot vst vis + MCFG_SCREEN_RAW_PARAMS(16777216/4, 308, 0, 240, 228, 0, 160) + MCFG_SCREEN_UPDATE_DRIVER(gba_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 32768) + MCFG_PALETTE_INIT_OWNER(gba_state, gba) + + MCFG_SPEAKER_STANDARD_STEREO("spkleft", "spkright") + MCFG_SOUND_ADD("custom", GAMEBOY, 0) + MCFG_SOUND_ROUTE(0, "spkleft", 0.50) + MCFG_SOUND_ROUTE(1, "spkright", 0.50) + MCFG_SOUND_ADD("direct_a_left", DAC, 0) // GBA direct sound A left + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "spkleft", 0.50) + MCFG_SOUND_ADD("direct_a_right", DAC, 0) // GBA direct sound A right + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "spkright", 0.50) + MCFG_SOUND_ADD("direct_b_left", DAC, 0) // GBA direct sound B left + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "spkleft", 0.50) + MCFG_SOUND_ADD("direct_b_right", DAC, 0) // GBA direct sound B right + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "spkright", 0.50) + + MCFG_GBA_CARTRIDGE_ADD("cartslot", gba_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","gba") +MACHINE_CONFIG_END + + + +ROM_START( gba ) + ROM_REGION( 0x4000, "maincpu", 0 ) + ROM_LOAD( "gba.bin", 0x000000, 0x004000, CRC(81977335) SHA1(300c20df6731a33952ded8c436f7f186d25d3492) ) +ROM_END + + + +// this emulates the GBA's hardware protection: the BIOS returns only zeros when the PC is not in it, +// and some games verify that as a protection check (notably Metroid Fusion) +DIRECT_UPDATE_MEMBER(gba_state::gba_direct) +{ + if (address > 0x4000) + { + m_bios_protected = 1; + } + else + { + m_bios_protected = 0; + m_bios_last_address = address; + } + return address; +} + + +DRIVER_INIT_MEMBER(gba_state,gbadv) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(gba_state::gba_direct), this)); +} + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS(2001, gba, 0, 0, gbadv, gbadv, gba_state, gbadv, "Nintendo", "Game Boy Advance", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/geneve.c b/src/mame/drivers/geneve.c new file mode 100644 index 00000000000..c366b70b2e7 --- /dev/null +++ b/src/mame/drivers/geneve.c @@ -0,0 +1,766 @@ +// license:LGPL-2.1+ +// copyright-holders:Michael Zapf +/****************************************************************************** + MESS Driver for the Myarc Geneve 9640. + + The Geneve has two operation modes. One is compatible with the TI-99/4a, + the other is not. + + + General architecture: + + TMS9995@12MHz (including 256 bytes of on-chip 16-bit RAM and a timer), + V9938, SN76496 (compatible with TMS9919), TMS9901, MM58274 RTC, 512 kbytes + of 1-wait-state CPU RAM (expandable to almost 2 Mbytes), 32 kbytes of + 0-wait-state CPU RAM (expandable to 64 kbytes), 128 kbytes of VRAM + (expandable to 192 kbytes). + + + Memory map: + + 64-kbyte CPU address space is mapped to a 2-Mbyte virtual address space. + 8 8-kbyte pages are available simultaneously, out of a total of 256. + + Page map (regular console): + >00->3f: 512kbytes of CPU RAM (pages >36 and >37 are used to emulate + cartridge CPU ROMs in ti99 mode, and pages >38 through >3f are used to + emulate console and cartridge GROMs in ti99 mode) + >40->7f: optional Memex RAM (except >7a and >7c that are mirrors of >ba and + >bc?) + >80->b7: PE-bus space using spare address lines (AMA-AMC)? Used by RAM + extension (Memex or PE-Bus 512k card). + >b8->bf: PE-bus space (most useful pages are >ba: DSR space and >bc: speech + synthesizer page; other pages are used by RAM extension) + >c0->e7: optional Memex RAM + >e8->ef: 64kbytes of 0-wait-state RAM (with 32kbytes of SRAM installed, + only even pages (>e8, >ea, >ec and >ee) are available) + >f0->f1: boot ROM + >f2->fe: optional Memex RAM? (except >fa and >fc that are mirrors of >ba + and >bc?) + >ff: always empty? + + Page map (genmod console): + >00->39, >40->b9, >bb, >bd->ef, f2->fe: Memex RAM (except >3a, >3c, >7a, + >7c, >fa and >fc that are mirrors of >ba and >bc?) (I don't know if + >e8->ef is on the Memex board or the Geneve motherboard) + >ba: DSR space + >bc: speech synthesizer space + >f0->f1: boot ROM + >ff: always empty? + + >00->3f: switch-selectable(?): 512kbytes of onboard RAM (1-wait-state DRAM) + or first 512kbytes of the Memex Memory board (0-wait-state SRAM). The + latter setting is incompatible with TI mode. + + Note that >bc is actually equivalent to >8000->9fff on the /4a bus, + therefore the speech synthesizer is only available at offsets >1800->1bff + (read port) and >1c00->1fff (write port). OTOH, if you installed a FORTI + sound card, it will be available in the same page at offsets >0400->7ff. + + + Unpaged locations (ti99 mode): + >8000->8007: memory page registers (>8000 for page 0, >8001 for page 1, + etc. register >8003 is ignored (this page is hard-wired to >36->37). + >8008: key buffer + >8009->800f: ??? + >8010->801f: clock chip + >8400->9fff: sound, VDP, speech, and GROM registers (according to one + source, the GROM and sound registers are only available if page >3 + is mapped in at location >c000 (register 6). I am not sure the Speech + registers are implemented, though I guess they are.) + Note that >8020->83ff is mapped to regular CPU RAM according to map + register 4. + + Unpaged locations (native mode): + >f100: VDP data port (read/write) + >f102: VDP address/status port (read/write) + >f104: VDP port 2 + >f106: VDP port 3 + >f108->f10f: VDP mirror (used by Barry Boone's converted Tomy cartridges) + >f110->f117: memory page registers (>f110 for page 0, >f111 for page 1, + etc.) + >f118: key buffer + >f119->f11f: ??? + >f120: sound chip + >f121->f12f: ??? + >f130->f13f: clock chip + + Unpaged locations (tms9995 locations): + >f000->f0fb and >fffc->ffff: tms9995 RAM + >fffa->fffb: tms9995 timer register + Note: accessing tms9995 locations will also read/write corresponding paged + locations. + + + GROM emulator: + + The GPL interface is accessible only in TI99 mode. GPL data is fetched + from pages >38->3f. It uses a straight 16-bit address pointer. The + address pointer is incremented when the read data and write data ports + are accessed, and when the second byte of the GPL address is written. A + weird consequence of this is the fact that GPL data is always off by one + byte, i.e. GPL bytes 0, 1, 2... are stored in bytes 1, 2, 3... of pages + >38->3f (byte 0 of page >38 corresponds to GPL address >ffff). + + I think that I have once read that the geneve GROM emulator does not + emulate wrap-around within a GROM, i.e. address >1fff is followed by >2000 + (instead of >0000 with a real GROM). + + There are two ways to implement GPL address load and store. + One is maintaining 2 flags (one for address read and one for address write) + that tell if you are accessing address LSB: these flags must be cleared + whenever data is read, and the read flag must be cleared when the write + address port is written to. + The other is to shift the register and always read/write the MSByte of the + address pointer. The LSByte is copied to the MSbyte when the address is + read, whereas the former MSByte is copied to the LSByte when the address is + written. The address pointer must be incremented after the address is + written to. It will not harm if it is incremented after the address is + read, provided the LSByte has been cleared. + + + Cartridge emulator: + + The cartridge interface is in the >6000->7fff area. + + If CRU bit @>F7C is set, the cartridge area is always mapped to virtual + page >36. Writes in the >6000->6fff area are ignored if the CRU bit @>F7D + is 0, whereas writes in the >7000->7fff area are ignored if the CRU bit + @>F7E is 0. + + If CRU bit @>F7C is clear, the cartridge area is mapped either to virtual + page >36 or to page >37 according to which page is currently selected. + Writing data to address >6000->7fff will select page >36 if A14 is 0, + >37 if A14 is 1. + + + CRU map: + + Base >0000: tms9901 + tms9901 pin assignment: + int1: external interrupt (INTA on PE-bus) (connected to tms9995 (int4/EC)* + pin as well) + int2: VDP interrupt + int3-int7: joystick port inputs (fire, left, right, down, up) + int8: keyboard interrupt (asserted when key buffer full) + int9/p13: unused + int10/p12: third mouse button + int11/p11: clock interrupt? + int12/p10: INTB from PE-bus + int13/p9: (used as output) + int14/p8: unused + int15/p7: (used as output) + p0: PE-bus reset line + p1: VDP reset line + p2: joystick select (0 for joystick 1, 1 for joystick 2) + p3-p5: unused + p6: keyboard reset line + p7/int15: external mem cycles 0=long, 1=short + p9/int13: vdp wait cycles 1=add 15 cycles, 0=add none + + Base >1EE0 (>0F70): tms9995 flags and geneve mode register + bits 0-1: tms9995 flags + Bits 2-4: tms9995 interrupt state register + Bits 5-15: tms9995 user flags - overlaps geneve mode, but hopefully the + geneve registers are write-only, so no real conflict happens + TMS9995 user flags: + Bit 5: 0 if NTSC, 1 if PAL video + Bit 6: unused??? + Bit 7: some keyboard flag, set to 1 if caps is on + Geneve gate array + TMS9995 user flags: + Bit 8: 1 = allow keyboard clock + Bit 9: 0 = clear keyboard input buffer, 1 = allow keyboard buffer to be + loaded + Bit 10: 1 = geneve mode, 0 = ti99 mode + Bit 11: 1 = ROM mode, 0 = map mode + Bit 12: 0 = Enable cartridge paging + Bit 13: 0 = protect cartridge range >6000->6fff + Bit 14: 0 = protect cartridge range >7000->7fff + bit 15: 1 = add 1 extra wait state when accessing 0-wait-state SRAM??? + + + Keyboard interface: + + The XT keyboard interface is described in various places on the internet, + like (http://www-2.cs.cmu.edu/afs/cs/usr/jmcm/www/info/key2.txt). It is a + synchronous unidirectional serial interface: the data line is driven by the + keyboard to send data to the CPU; the CTS/clock line has a pull up resistor + and can be driven low by both keyboard and CPU. To send data to the CPU, + the keyboard pulses the clock line low 9 times, and the Geneve samples all + 8 bits of data (plus one start bit) on each falling edge of the clock. + When the key code buffer is full, the Geneve gate array asserts the kbdint* + line (connected to 9901 INT8*). The Geneve gate array will hold the + CTS/clock line low as long as the keyboard buffer is full or CRU bit @>F78 + is 0. Writing a 0 to >F79 will clear the Geneve keyboard buffer, and + writing a 1 will resume normal operation: you need to write a 0 to >F78 + before clearing >F79, or the keyboard will be enabled to send data the gate + array when >F79 is is set to 0, and any such incoming data from the + keyboard will be cleared as soon as it is buffered by the gate array. + + Original version 2003 by Raphael Nabet + + Rewritten 2012 by Michael Zapf +******************************************************************************/ + + +#include "emu.h" +#include "cpu/tms9900/tms9995.h" +#include "machine/tms9901.h" +#include "machine/mm58274c.h" +#include "sound/sn76496.h" + +#include "bus/ti99x/genboard.h" +#include "bus/ti99x/videowrp.h" +#include "bus/ti99x/joyport.h" + +#include "bus/ti99_peb/peribox.h" + +#define TRACE_READY 0 +#define TRACE_LINES 0 +#define TRACE_CRU 0 + +#define SRAM_SIZE 384*1024 // maximum SRAM expansion on-board +#define DRAM_SIZE 512*1024 + +class geneve_state : public driver_device +{ +public: + geneve_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cpu(*this, "maincpu"), + m_tms9901(*this, TMS9901_TAG), + m_keyboard(*this, GKEYBOARD_TAG), + m_mapper(*this, GMAPPER_TAG), + m_peribox(*this, PERIBOX_TAG), + m_mouse(*this, GMOUSE_TAG), + m_joyport(*this,JOYPORT_TAG) { } + + // CRU (Communication Register Unit) handling + DECLARE_READ8_MEMBER(cruread); + DECLARE_WRITE8_MEMBER(cruwrite); + + // Connections with the system interface TMS9901 + DECLARE_READ8_MEMBER(read_by_9901); + DECLARE_WRITE_LINE_MEMBER(peripheral_bus_reset); + DECLARE_WRITE_LINE_MEMBER(VDP_reset); + DECLARE_WRITE_LINE_MEMBER(joystick_select); + DECLARE_WRITE_LINE_MEMBER(extbus_wait_states); + DECLARE_WRITE_LINE_MEMBER(video_wait_states); + + DECLARE_WRITE_LINE_MEMBER(clock_out); + DECLARE_WRITE_LINE_MEMBER(dbin_line); + + DECLARE_WRITE8_MEMBER(external_operation); + + DECLARE_WRITE8_MEMBER(tms9901_interrupt); + + DECLARE_WRITE_LINE_MEMBER( keyboard_interrupt ); + + required_device m_cpu; + required_device m_tms9901; + required_device m_keyboard; + required_device m_mapper; + required_device m_peribox; + required_device m_mouse; + required_device m_joyport; + + DECLARE_WRITE_LINE_MEMBER( inta ); + DECLARE_WRITE_LINE_MEMBER( intb ); + DECLARE_WRITE_LINE_MEMBER( ext_ready ); + DECLARE_WRITE_LINE_MEMBER( mapper_ready ); + + DECLARE_DRIVER_INIT(geneve); + virtual void machine_start(); + virtual void machine_reset(); + TIMER_DEVICE_CALLBACK_MEMBER(geneve_hblank_interrupt); + + DECLARE_WRITE_LINE_MEMBER(set_tms9901_INT2_from_v9938); + + line_state m_inta; + line_state m_intb; + line_state m_int2; + line_state m_keyint; + line_state m_video_wait; // reflects the line to the mapper for CRU query + + int m_ready_line, m_ready_line1; +}; + +/* + Memory map +*/ + +static ADDRESS_MAP_START(memmap, AS_PROGRAM, 8, geneve_state) + AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(GMAPPER_TAG, geneve_mapper_device, readm, writem) AM_DEVSETOFFSET(GMAPPER_TAG, geneve_mapper_device, setoffset) +ADDRESS_MAP_END + +/* + CRU map + The TMS9901 is fully decoded, no mirroring, so we have 32 bits for it, + and the rest goes to the board (and from there to the PEB) + TMS9995 has a full 15-bit CRU bit address space (attached to A0-A14) + TODO: Check whether A0-A2 are available for CRU addressing since those + bits are usually routed through the mapper first. +*/ +static ADDRESS_MAP_START(crumap, AS_IO, 8, geneve_state) + AM_RANGE(0x0000, 0x0003) AM_DEVREAD(TMS9901_TAG, tms9901_device, read) + AM_RANGE(0x0000, 0x0fff) AM_READ( cruread ) + + AM_RANGE(0x0000, 0x001f) AM_DEVWRITE(TMS9901_TAG, tms9901_device, write) + AM_RANGE(0x0000, 0x7fff) AM_WRITE( cruwrite ) +ADDRESS_MAP_END + +/* TI joysticks. The keyboard is implemented in genboard.c. */ +static INPUT_PORTS_START(geneve) + + PORT_START( "MODE" ) + PORT_CONFNAME( 0x01, 0x00, "Operating mode" ) PORT_CHANGED_MEMBER(PERIBOX_TAG, peribox_device, genmod_changed, 0) + PORT_CONFSETTING( 0x00, "Standard" ) + PORT_CONFSETTING( GENMOD, "GenMod" ) + + PORT_START( "BOOTROM" ) + PORT_CONFNAME( 0x03, GENEVE_098, "Boot ROM" ) PORT_CHANGED_MEMBER(GMAPPER_TAG, geneve_mapper_device, settings_changed, 3) + PORT_CONFSETTING( GENEVE_098, "Version 0.98" ) + PORT_CONFSETTING( GENEVE_100, "Version 1.00" ) + PORT_CONFSETTING( GENEVE_PFM512, "PFM 512" ) + PORT_CONFSETTING( GENEVE_PFM512A, "PFM 512A" ) + + PORT_START( "SRAM" ) + PORT_CONFNAME( 0x03, 0x01, "Onboard SRAM" ) PORT_CONDITION( "MODE", 0x01, EQUALS, 0x00 ) + PORT_CONFSETTING( 0x00, "32 KiB" ) + PORT_CONFSETTING( 0x01, "64 KiB" ) + PORT_CONFSETTING( 0x02, "384 KiB" ) + + PORT_START( "GENMODDIPS" ) + PORT_DIPNAME( GM_TURBO, 0x00, "Genmod Turbo mode") PORT_CONDITION( "MODE", 0x01, EQUALS, GENMOD ) PORT_CHANGED_MEMBER(GMAPPER_TAG, geneve_mapper_device, settings_changed, 1) + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( GM_TURBO, DEF_STR( On )) + PORT_DIPNAME( GM_TIM, GM_TIM, "Genmod TI mode") PORT_CONDITION( "MODE", 0x01, EQUALS, GENMOD ) PORT_CHANGED_MEMBER(GMAPPER_TAG, geneve_mapper_device, settings_changed, 2) + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( GM_TIM, DEF_STR( On )) + +INPUT_PORTS_END + +/**************************************************************************** + CRU handling +*****************************************************************************/ + +#define CRU_CONTROL_BASE 0x1ee0 +#define CRU_SSTEP_BASE 0x13c0 + +WRITE8_MEMBER ( geneve_state::cruwrite ) +{ + int addroff = offset << 1; + + // Single step + // 13c0 - 13fe: 0001 0011 11xx xxx0 + if ((addroff & 0xffc0) == CRU_SSTEP_BASE) + { + int bit = (addroff & 0x003e)>>1; + logerror("geneve: Single step not implemented; bit %d set to %d\n", bit, data); + return; + } + + if ((addroff & 0xffe0) == CRU_CONTROL_BASE) + { + int bit = (addroff & 0x001e)>>1; + switch (bit) + { + case 5: + // No one really cares... + if (TRACE_CRU) logerror("geneve: Set PAL flag = %02x\n", data); + // m_palvideo = (data!=0); + break; + case 7: + // m_capslock = (data!=0); + if (TRACE_CRU) logerror("geneve: Set capslock flag = %02x\n", data); + break; + case 8: + if (TRACE_CRU) logerror("geneve: Set keyboard clock flag = %02x\n", data); + m_keyboard->clock_control((data!=0)? ASSERT_LINE : CLEAR_LINE); + break; + case 9: + if (TRACE_CRU) logerror("geneve: Set keyboard scan flag = %02x\n", data); + m_keyboard->send_scancodes((data!=0)? ASSERT_LINE : CLEAR_LINE); + break; + case 10: + if (TRACE_CRU) logerror("geneve: Geneve mode = %02x\n", data); + m_mapper->set_geneve_mode(data!=0); + break; + case 11: + if (TRACE_CRU) logerror("geneve: Direct mode = %02x\n", data); + m_mapper->set_direct_mode(data!=0); + break; + case 12: + if (TRACE_CRU) logerror("geneve: Cartridge size 8K = %02x\n", data); + m_mapper->set_cartridge_size((data!=0)? 0x2000 : 0x4000); + break; + case 13: + if (TRACE_CRU) logerror("geneve: Cartridge writable 6000 = %02x\n", data); + m_mapper->set_cartridge_writable(0x6000, (data!=0)); + break; + case 14: + if (TRACE_CRU) logerror("geneve: Cartridge writable 7000 = %02x\n", data); + m_mapper->set_cartridge_writable(0x7000, (data!=0)); + break; + case 15: + if (TRACE_CRU) logerror("geneve: Extra wait states = %02x\n", data==0); + m_mapper->set_extra_waitstates(data==0); // let's use the inverse semantics + break; + default: + logerror("geneve: set CRU address %04x=%02x ignored\n", addroff, data); + break; + } + } + else + { + m_peribox->cruwrite(space, addroff, data); + } +} + +READ8_MEMBER( geneve_state::cruread ) +{ + UINT8 value = 0; + int addroff = offset << 4; + + // Single step + // 13c0 - 13fe: 0001 0011 11xx xxx0 + if ((addroff & 0xffc0) == CRU_SSTEP_BASE) + { + int bit = (addroff & 0x003e)>>1; + logerror("geneve: Single step not implemented; attempting to read bit %d\n", bit); + return value; + } + + // TMS9995-internal CRU locations (1ee0-1efe) are handled within the processor + // so we just don't arrive here + + // Propagate the CRU access to external devices + m_peribox->crureadz(space, addroff, &value); + return value; +} + +/*********************************************************************** + CRU callbacks +***********************************************************************/ + +READ8_MEMBER( geneve_state::read_by_9901 ) +{ + int answer = 0; + + switch (offset & 0x03) + { + case TMS9901_CB_INT7: + // + // Read pins INT3*-INT7* of Geneve's 9901. + // bit 1: INTA status + // bit 2: INT2 status + // bit 3-7: joystick status + // + // |K|K|K|K|K|I2|I1|C| + // negative logic + if (m_inta==CLEAR_LINE) answer |= 0x02; + if (m_int2==CLEAR_LINE) answer |= 0x04; + answer |= m_joyport->read_port()<<3; + break; + + case TMS9901_INT8_INT15: + // Read pins INT8*-INT15* of Geneve 9901. + // + // bit 0: keyboard interrupt + // bit 1: unused + // bit 2: mouse left button + // (bit 3: clock interrupt) + // bit 4: INTB from PE-bus + // bit 5 & 7: used as output + // bit 6: unused + if (m_keyint==CLEAR_LINE) answer |= 0x01; + if (m_mouse->left_button()==CLEAR_LINE) answer |= 0x04; + // TODO: add clock interrupt + if (m_intb==CLEAR_LINE) answer |= 0x10; + if (m_video_wait==ASSERT_LINE) answer |= 0x20; + // TODO: PAL pin 5 + if (TRACE_LINES) logerror("geneve: INT15-8 = %02x\n", answer); + break; + + case TMS9901_P0_P7: + // Read pins P0-P7 of TMS9901. All pins are configured as outputs, so nothing here. + break; + + case TMS9901_P8_P15: + // Read pins P8-P15 of TMS 9901. + // bit 4: mouse left button + // video wait is an output; no input possible here + if (m_intb==CLEAR_LINE) answer |= 0x04; // mirror from above + // TODO: 0x08 = real-time clock int + if (m_mouse->left_button()==CLEAR_LINE) answer |= 0x10; // mirror from above + if (m_keyint==CLEAR_LINE) answer |= 0x40; + + // Joystick up (mirror of bit 7) + if ((m_joyport->read_port() & 0x10)==0) answer |= 0x80; + break; + } + return answer; +} + +/* + Write PE bus reset line +*/ +WRITE_LINE_MEMBER( geneve_state::peripheral_bus_reset ) +{ + logerror("geneve: Peripheral bus reset request; not implemented yet.\n"); +} + +/* + Write VDP reset line +*/ +WRITE_LINE_MEMBER( geneve_state::VDP_reset ) +{ + logerror("geneve: Video reset request; not implemented yet.\n"); +} + +/* + Write joystick select line. 1 selects joystick 1 (pin 7), 0 selects joystick 2 (pin 2) +*/ +WRITE_LINE_MEMBER( geneve_state::joystick_select ) +{ + m_joyport->write_port((state==ASSERT_LINE)? 1:2); +} + +/* + Write external mem cycles (0=long, 1=short) +*/ +WRITE_LINE_MEMBER( geneve_state::extbus_wait_states ) +{ + logerror("geneve: External bus wait states set to %d, not implemented yet.\n", state); +} + +/* + Write vdp wait cycles (1=add 14 cycles, 0=add none) + see above for waitstate handling +*/ +WRITE_LINE_MEMBER( geneve_state::video_wait_states ) +{ + if (TRACE_LINES) logerror("geneve: Video wait states set to %d\n", state); + m_mapper->set_video_waitstates(state==ASSERT_LINE); + m_video_wait = (state!=0)? ASSERT_LINE : CLEAR_LINE; +} + +/* + Called by the 9901 core whenever the state of INTREQ and IC0-3 changes. + As with the TI-99/4A, the interrupt level is delivered as the offset, + but again it is ignored. Anyway, the TMS9995 has only two external inputs + (INT1 and INT4). +*/ +WRITE8_MEMBER( geneve_state::tms9901_interrupt ) +{ + /* INTREQ is connected to INT1. */ + m_cpu->set_input_line(INT_9995_INT1, data); +} + +/******************************************************************* + Signal lines +*******************************************************************/ + +/* + inta is connected to both tms9901 IRQ1 line and to tms9995 INT4/EC line. +*/ +WRITE_LINE_MEMBER( geneve_state::inta ) +{ + m_inta = (state!=0)? ASSERT_LINE : CLEAR_LINE; + m_tms9901->set_single_int(1, state); + m_cpu->set_input_line(INT_9995_INT4, state); +} + +/* + intb is connected to tms9901 IRQ12 line. +*/ +WRITE_LINE_MEMBER( geneve_state::intb ) +{ + m_intb = (state!=0)? ASSERT_LINE : CLEAR_LINE; + m_tms9901->set_single_int(12, state); +} + +WRITE_LINE_MEMBER( geneve_state::ext_ready ) +{ + if (TRACE_READY) logerror("geneve: READY level (ext) = %02x\n", state); + m_ready_line = state; + m_cpu->set_ready((m_ready_line == ASSERT_LINE && m_ready_line1 == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE); +} + +WRITE_LINE_MEMBER( geneve_state::mapper_ready ) +{ + if (TRACE_READY) logerror("geneve: READY level (mapper) = %02x\n", state); + m_ready_line1 = state; + m_cpu->set_ready((m_ready_line == ASSERT_LINE && m_ready_line1 == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE); +} + +/* + set the state of int2 (called by the v9938 core) +*/ +WRITE_LINE_MEMBER(geneve_state::set_tms9901_INT2_from_v9938) +{ + m_int2 = (state!=0)? ASSERT_LINE : CLEAR_LINE; + m_tms9901->set_single_int(2, state); +} + +/* + Interrupt from the keyboard. +*/ +WRITE_LINE_MEMBER( geneve_state::keyboard_interrupt ) +{ + m_keyint = (state!=0)? ASSERT_LINE : CLEAR_LINE; + m_tms9901->set_single_int(8, state); +} + +/* + scanline interrupt +*/ +TIMER_DEVICE_CALLBACK_MEMBER(geneve_state::geneve_hblank_interrupt) +{ + int scanline = param; + + if (scanline == 0) // was 262 + { + // TODO + // The technical docs do not say anything about the way the mouse + // is queried. It sounds plausible that the mouse is sampled once + // per vertical interrupt; however, the mouse sometimes shows jerky + // behaviour. Maybe we should use an autonomous timer with a higher + // rate? -> to be checked + m_mouse->poll(); + } +} + +WRITE8_MEMBER( geneve_state::external_operation ) +{ + static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; + if (offset != IDLE_OP) logerror("geneve: External operation %s not implemented on Geneve board\n", extop[offset]); +} + +/* + Clock line from the CPU. Used to control wait state generation. +*/ +WRITE_LINE_MEMBER( geneve_state::clock_out ) +{ + m_mapper->clock_in(state); +} + +/* + DBIN line from the CPU. Used to control wait state generation. +*/ +WRITE_LINE_MEMBER( geneve_state::dbin_line ) +{ + m_mapper->dbin_in(state); +} + +DRIVER_INIT_MEMBER(geneve_state,geneve) +{ +} + +void geneve_state::machine_start() +{ +} + +/* + Reset the machine. +*/ +void geneve_state::machine_reset() +{ + m_inta = CLEAR_LINE; // flag reflecting the INTA line + m_intb = CLEAR_LINE; // flag reflecting the INTB line + m_int2 = CLEAR_LINE; // flag reflecting the INT2 line + m_keyint = CLEAR_LINE; + + // No automatic wait state (auto wait state is enabled with READY=CLEAR at RESET) + m_cpu->set_ready(ASSERT_LINE); + m_cpu->set_hold(CLEAR_LINE); + + m_ready_line = m_ready_line1 = ASSERT_LINE; + + m_peribox->set_genmod(ioport("MODE")->read()==GENMOD); + + m_joyport->write_port(0x01); // select Joystick 1 +} + +static MACHINE_CONFIG_START( geneve_60hz, geneve_state ) + // basic machine hardware + // TMS9995 CPU @ 12.0 MHz + MCFG_TMS99xx_ADD("maincpu", TMS9995, 12000000, memmap, crumap) + MCFG_TMS9995_EXTOP_HANDLER( WRITE8(geneve_state, external_operation) ) + MCFG_TMS9995_CLKOUT_HANDLER( WRITELINE(geneve_state, clock_out) ) + MCFG_TMS9995_DBIN_HANDLER( WRITELINE(geneve_state, dbin_line) ) + + // video hardware + // Although we should have a 60 Hz screen rate, we have to set it to 30 here. + // The reason is that that the number of screen lines is counted twice for the + // interlace mode, but in non-interlace modes only half of the lines are + // painted. Accordingly, the full set of lines is refreshed at 30 Hz, + // not 60 Hz. This should be fixed in the v9938 emulation. + MCFG_TI_V9938_ADD(VIDEO_SYSTEM_TAG, 30, SCREEN_TAG, 2500, 512+32, (212+28)*2, geneve_state, set_tms9901_INT2_from_v9938) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", geneve_state, geneve_hblank_interrupt, SCREEN_TAG, 0, 1) /* 262.5 in 60Hz, 312.5 in 50Hz */ + + // Main board components + MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) + MCFG_TMS9901_READBLOCK_HANDLER( READ8(geneve_state, read_by_9901) ) + MCFG_TMS9901_P0_HANDLER( WRITELINE( geneve_state, peripheral_bus_reset) ) + MCFG_TMS9901_P1_HANDLER( WRITELINE( geneve_state, VDP_reset) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( geneve_state, joystick_select) ) + MCFG_TMS9901_P4_HANDLER( DEVWRITELINE( GMAPPER_TAG, geneve_mapper_device, pfm_select_lsb) ) // new for PFM + MCFG_TMS9901_P5_HANDLER( DEVWRITELINE( GMAPPER_TAG, geneve_mapper_device, pfm_output_enable) ) // new for PFM + MCFG_TMS9901_P6_HANDLER( DEVWRITELINE( GKEYBOARD_TAG, geneve_keyboard_device, reset_line) ) + MCFG_TMS9901_P7_HANDLER( WRITELINE( geneve_state, extbus_wait_states) ) + MCFG_TMS9901_P9_HANDLER( WRITELINE( geneve_state, video_wait_states) ) + MCFG_TMS9901_P13_HANDLER( DEVWRITELINE( GMAPPER_TAG, geneve_mapper_device, pfm_select_msb) ) // new for PFM + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( geneve_state, tms9901_interrupt) ) + + // Mapper + MCFG_DEVICE_ADD(GMAPPER_TAG, GENEVE_MAPPER, 0) + MCFG_GENEVE_READY_HANDLER( WRITELINE(geneve_state, mapper_ready) ) + + // Clock + MCFG_DEVICE_ADD(GCLOCK_TAG, MM58274C, 0) + MCFG_MM58274C_MODE24(1) // 24 hour + MCFG_MM58274C_DAY1(0) // sunday + + // Peripheral expansion box (Geneve composition) + MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_GEN, 0) + MCFG_PERIBOX_INTA_HANDLER( WRITELINE(geneve_state, inta) ) + MCFG_PERIBOX_INTB_HANDLER( WRITELINE(geneve_state, intb) ) + MCFG_PERIBOX_READY_HANDLER( WRITELINE(geneve_state, ext_ready) ) + + // sound hardware + MCFG_TI_SOUND_76496_ADD( TISOUND_TAG ) + MCFG_TI_SOUND_READY_HANDLER( WRITELINE(geneve_state, ext_ready) ) + + // User interface devices + MCFG_DEVICE_ADD( GKEYBOARD_TAG, GENEVE_KEYBOARD, 0 ) + MCFG_GENEVE_KBINT_HANDLER( WRITELINE(geneve_state, keyboard_interrupt) ) + MCFG_GENEVE_MOUSE_ADD( GMOUSE_TAG ) + MCFG_GENEVE_JOYPORT_ADD( JOYPORT_TAG ) + + // PFM expansion + MCFG_AT29C040_ADD( PFM512_TAG ) + MCFG_AT29C040A_ADD( PFM512A_TAG ) + +MACHINE_CONFIG_END + +/* + ROM loading +*/ + +ROM_START(geneve) + /*CPU memory space*/ + ROM_REGION(0xc000, "maincpu", 0) + ROM_LOAD("genbt100.bin", 0x0000, 0x4000, CRC(8001e386) SHA1(b44618b54dabac3882543e18555d482b299e0109)) /* CPU ROMs v1.0 */ + ROM_LOAD_OPTIONAL("genbt098.bin", 0x4000, 0x4000, CRC(b2e20df9) SHA1(2d5d09177afe97d63ceb3ad59b498b1c9e2153f7)) /* CPU ROMs v0.98 */ + ROM_LOAD_OPTIONAL("gnmbt100.bin", 0x8000, 0x4000, CRC(19b89479) SHA1(6ef297eda78dc705946f6494e9d7e95e5216ec47)) /* CPU ROMs GenMod */ + + ROM_REGION(SRAM_SIZE, SRAM_TAG, 0) + ROM_FILL(0x0000, SRAM_SIZE, 0) + + ROM_REGION(DRAM_SIZE, DRAM_TAG, 0) + ROM_FILL(0x0000, DRAM_SIZE, 0) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1987,geneve, 0, 0, geneve_60hz, geneve, geneve_state, geneve, "Myarc", "Geneve 9640" , 0) diff --git a/src/mame/drivers/geniusiq.c b/src/mame/drivers/geniusiq.c new file mode 100644 index 00000000000..1ca2024e693 --- /dev/null +++ b/src/mame/drivers/geniusiq.c @@ -0,0 +1,900 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** +Video Technology Genius computers: + VTech Genius PC (France) + VTech Genius IQ 512 (Germany) + The French packaging mentions distributions in Switzerland, the Netherlands, + USA, Canada, and UK as well. Looking for more information and ROM dumps. + +System driver: + + Adrien Destugues , May 2012 + - First attempt + +Memory map: + 00000000 System ROM (2MB) + 00200000 RAM (256K) + 00400000 Flash memory (128K) + 00600000 Some memory mapped hardware + 00a00000 Cartridge port + +TODO: + - Sound + - Flash cartridge + - Dump the MCU and rewrites everything using low-level emulation + - Check with different countries ROMs + +Not very much is known about this computer released in 1997. + + + +PCB - German Version: + +----------------------------------+ +-------------------+ + +-----------------+ | | | +-------+ +--------------+ + | +---+ +---+ +---+ | + | | + | | + | | + | | + | | + | | + | | + | ########################### +---------+ +-------+ + | # # | XTAL | +-------+ -------| + | +-------+ # +-------------------+ # |26.601712| | VTECH | -------| + | |LMT324D| # | PALCE20V8H-25PC | # |KDS17H | |LH537- | -------| + | +-------+ # | | # +---------+ | -NWL| -------| + | # +-------------------+ ######## +--------+ | | -------| + | # # | | |1997 | -------| + | # +-------------+ +-------+ # | | |27-5947| -------| + | # |MC74HC4060AN | |MEC/ZTB| # |AM29F010| |-00 | -------| + | # | | | 307D | # |-120PC | | | -------| + | # +-------------+ | | # | | |9741 D | -------| + | #010 +-------+ # | | +-------+ +-------+ + | ################################## |9731MBM | | + | | | | A| | + | | VTECH | | | | + | | 27-05793-0-0 | | | | + | | ZKAL9736 | | | | + | | | | | | + | | | | | | + | | | | | | + | +--------+ | | |1991 AMD| | + | |BH7236AF| | | +--------+ | + | +--------+ +------------------+ | + | +-----+ | + | |XTAL | | + | | | | + | |32.00| | + | |0 | | + | +-----+ 9740 | + | +---------+ GER | + | +----------+ |MC68EC000| 016 | + | |HY534256AL| |FU16 | | + | |J-60 | | | | + | +----------+ | 0G74K| | + | | HHIG9728| | + | +----------+ +---------+ | + | +------+ |HY534256AL| | + | |9727H | |J-60 | | + | |C807U-| +----------+ | + | |1225 | | + | +------+ | + | 35-13300-28 | + | | + | 35-13300-28 702748-E CS | + | +----+ +----+ E403 +----+ | + +------+ +--------------------------------------+ +-----------------------------------+ +----------+ + + + + IQ TV 512 PCB (German version) + +----------------------------------+ +-------------------+ + +-----------------+ | | | +-------+ +--------------+ + | +---+ +---+ +---+ | + | | + | | + | | + | | + | | + | | + | | + | ########################### +---------+ +-------+ + | # # | XTAL | +-------+ -------| + | +-------+ # +-------------------+ # |26.601712| | VTECH | -------| + | |LM324D | # | PALCE20V8H-25PC | # |KDS17H | |LH537- | -------| + | +-------+ # | | # +---------+ | -NUA| -------| + | # +-------------------+ ######## +--------+ | | -------| + | # # | | |1998 | -------| + | # +-------------+ +-------+ # | | |27-0617| -------| + | # |MC74HC4060AN | |MEC/ZTB| # |AM29F040| |1-000 | -------| + | # | | | 307D | # |B-120PC | | | -------| + | # +-------------+ | | # | | |9824 D | -------| + | #010 +-------+ # | | +-------+ +-------+ + | ################################## |9808MBM | | + | | | | A| | + | | VTECH | | | | + | | 27-05793-0-0 | | | | + | | ZKAH9805 | | | | + | | | | | | + | | | | | | + | | | | | | + | +--------+ | | |1993 AMD| | + | |BH7236AF| | | +--------+ | + | +--------+ +------------------+ | + | +-----+ | + | |XTAL | | + | | | | + | |32.00| | + | |0 | | + | +-----+ 9749 | + | +---------+ GER | + | +----------+ |MC68EC000| 023 | + | |HY534256AL| |FU16 | | + | |J-60 | | | | + | +----------+ | 0G74K| | + | | HHIG9728| | + | +----------+ +---------+ | + | +------+ |HY534256AL| | + | |9805HB| |J-60 | | + | |C807U-| +----------+ | + | |1225 | | + | +------+ | + | 35-13300-28 | + | | + | 35-13300-28 702749-E CS | + | +----+ +----+ E493 +----+ | + +------+ +--------------------------------------+ +-----------------------------------+ +----------+ + + +IQ Unlimited - GERMAN: + +------------------------------------------------------------------------------+ + | | ++-----+ | +| | +| | +| | +| +----+ +---+ | +| | A2 | +----+ | | | +| | | | A4 | |A1 | +-+ | +| +----+ +----+ | | | | | +| | | +-+ | +| | | | +| +---+ +--+ +| | +| +-------+ | ++--+ |65C5L5K| +----+ + | | HC374 | | ++--+ +----------+ +-------+ +--+ +| |DragonBall| | +| C +----+ |EZ | +-------+ C | +| A | A3 | | | |65C5L5K| A | +| R +----+ |LSC414328P| | HC374 | R | +| T |U16 IJ75C| +-------+ T | +| R | HHAV984S | R | +| I +----------+ I | +| D CARD 1 +------------+ CARD 0 D | +| G | AM29F0400 | G | +| E | | +------+ +--------+ E | +| +------------+ | LGS | |LHMN5KR7| | +| S | | | | S | +| L |GM71C1| | 1998 | L | +| O GER |8163CJ| | | O | +| T 038 |6 | |27-06126| T | +| | | |-007 | | ++--+ | | | | +--+ + | | | | VTECH | | + | +------+ +--------+ | + | 35-19600-200 703139-G| + +-------------------------------------------------------------------------+ + +A1 = 98AHCLT / 27-05992-0-0 / VTech +A2 = 9932 HBL / C807U-1442 / 35016B / Japan +A3 = ACT139 +A4 = MAX232 + + +Leader 8008 CX (German version) + ++---+-----------+-----+-----------------------+-----+-----+-----+ +| |SERIAL PORT| |PARALLEL PORT (PRINTER)| |MOUSE| | +| +-----------+ +-----------------------+ +-----+ | +| | +| | +| | +| | +| +----+ | +| | A0 | | +| +----+ | +| | +| | +| +--------+ | +| | | | +| CPU | VTECH | +------+ | +| |LHMV5GNS| | | | +| | | |GM76U8| | +| |1999 | |128CLF| | +| |27-6393-| |W85 | | +| +-----------+ |11 | | | | +| |27-6296-0-0| | | | | | +| |47C241M NH7| | | +------+ | +| +-----------+ +--------+ | +| | +| | +| | +| | ++---------------------------------------------------------------+ + +CPU = epoxy blob +GM76U8128CLFW85 = LGS / Hynix 131,072 WORDS x 8 BIT CMOS SRAM +TMP47C241MG = TCLS-47 series 4-bit CPU with 2048x8 internal ROM + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/intelfsh.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define KEYBOARD_QUEUE_SIZE 0x80 + +class geniusiq_state : public driver_device +{ +public: + enum + { + IQ128_ROM_CART = 0x00, + IQ128_ROMLESS1_CART = 0x01, + IQ128_ROMLESS2_CART = 0x02, + IQ128_NO_CART = 0x03 + }; + + geniusiq_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_rom(*this, "maincpu"), + m_vram(*this, "vram"), + m_mouse_gfx(*this, "mouse_gfx"), + m_cart_state(IQ128_NO_CART) + { } + + required_device m_maincpu; + required_device m_cart; + required_region_ptr m_rom; + required_shared_ptr m_vram; + required_shared_ptr m_mouse_gfx; + + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(geniusiq); + virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ16_MEMBER(input_r); + DECLARE_WRITE16_MEMBER(mouse_pos_w); + DECLARE_INPUT_CHANGED_MEMBER(send_input); + DECLARE_INPUT_CHANGED_MEMBER(send_mouse_input); + DECLARE_WRITE16_MEMBER(gfx_base_w); + DECLARE_WRITE16_MEMBER(gfx_dest_w); + DECLARE_WRITE16_MEMBER(gfx_color_w); + DECLARE_WRITE16_MEMBER(gfx_idx_w); + void queue_input(UINT16 data); + DECLARE_READ16_MEMBER(cart_state_r); + + DECLARE_READ16_MEMBER(unk0_r) { return 0; } + DECLARE_READ16_MEMBER(unk_r) { return machine().rand(); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( iq128_cart ); + DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( iq128_cart ); + +private: + UINT16 m_gfx_y; + UINT16 m_gfx_x; + UINT32 m_gfx_base; + UINT8 m_gfx_color[2]; + UINT8 m_mouse_posx; + UINT8 m_mouse_posy; + UINT16 m_mouse_gfx_posx; + UINT16 m_mouse_gfx_posy; + UINT8 m_cart_state; + struct + { + UINT16 buffer[KEYBOARD_QUEUE_SIZE]; + int head; + int tail; + } m_keyboard; +}; + +class gl8008cx_state : public driver_device +{ +public: + gl8008cx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + required_device m_maincpu; + + virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +}; + +PALETTE_INIT_MEMBER(geniusiq_state, geniusiq) +{ + // shades need to be verified + const UINT8 palette_val[] = + { + 0x00, 0x00, 0x00, // Black?? (used in the cursor for transparency) + 0xff, 0xff, 0xff, // White + 0xa0, 0xa0, 0xa0, // Light grey + 0x7f, 0x7f, 0x7f, // Dark grey + 0x00, 0x00, 0x00, // Black + 0x00, 0x60, 0xff, // Sky blue + 0x00, 0x00, 0xff, // Blue + 0xff, 0x00, 0x00, // Red + 0x00, 0xff, 0x00, // Green + 0x00, 0x7f, 0x00, // Dark green + 0xff, 0xff, 0x00, // Yellow + 0xff, 0x7f, 0x00, // Orange + 0x7f, 0x40, 0x00, // Brown + 0x60, 0x40, 0x00, // Dark brown + 0x60, 0x00, 0xff, // Mauve + 0xff, 0x00, 0xff // Pink + }; + + for (int i=0; i>1]; + + for(int b=0; b<4; b++) + { + bitmap.pix16(y, x*2 + b) = (data>>12) & 0x0f; + data <<= 4; + } + } + + // mouse cursor + for (int y=0; y<16; y++) + for (int x=0; x<6; x+=2) + { + UINT16 data = m_mouse_gfx[(y*6 + x)>>1]; + + for(int b=0; b<8; b++) + { + UINT8 pen = (data>>14) & 0x03; + + // I assume color 0 is transparent + if(pen != 0 && screen.visible_area().contains(m_mouse_gfx_posx + x*4 + b, m_mouse_gfx_posy + y)) + bitmap.pix16(m_mouse_gfx_posy + y, m_mouse_gfx_posx + x*4 + b) = pen; + data <<= 2; + } + } + + return 0; +} + +READ16_MEMBER( geniusiq_state::cart_state_r ) +{ + return m_cart_state; +} + +WRITE16_MEMBER( geniusiq_state::mouse_pos_w ) +{ + if (offset) + m_mouse_gfx_posy = data; + else + m_mouse_gfx_posx = data; +} + +WRITE16_MEMBER(geniusiq_state::gfx_color_w) +{ + m_gfx_color[offset & 1] = data & 0x0f; +} + +WRITE16_MEMBER(geniusiq_state::gfx_dest_w) +{ + if (offset) + m_gfx_y = data; + else + m_gfx_x = data; +} + +WRITE16_MEMBER(geniusiq_state::gfx_base_w) +{ + if (offset) + m_gfx_base = (m_gfx_base & 0xffff0000) | (data<<0); + else + m_gfx_base = (m_gfx_base & 0x0000ffff) | (data<<16); +} + +WRITE16_MEMBER(geniusiq_state::gfx_idx_w) +{ + UINT16 *gfx = m_rom + ((m_gfx_base + (data & 0xff)*32)>>1); + + // first 16 bits are used to define the character size + UINT8 gfx_heigh = (gfx[0]>>0) & 0xff; + UINT8 gfx_width = (gfx[0]>>8) & 0xff; + + for(int y=0; y>2] = (m_vram[dst>>2] & ~(0x0f << bit_pos)) | (pen << bit_pos); + } +} + +READ16_MEMBER( geniusiq_state::input_r ) +{ + /* + this is guesswork and may not be correct + + xxxx xxx- ---- ---- unknown + ---- ---x ---- ---- used for indicate if the data read is valid (if not set the other bits are discarded) + ---- ---- x--- ---- if set indicates a KeyUp otherwise a KeyDown + ---- ---- -xxx xxxx this is the scan code + */ + + UINT16 data = 0; + + if(m_keyboard.head != m_keyboard.tail) + { + data = m_keyboard.buffer[m_keyboard.head]; + + m_keyboard.head = (m_keyboard.head+1) % KEYBOARD_QUEUE_SIZE; + + data |= (1<<8); + } + + if(m_keyboard.head == m_keyboard.tail) + m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); + + return data; +} + +void geniusiq_state::queue_input(UINT16 data) +{ + m_keyboard.buffer[m_keyboard.tail] = data; + + m_keyboard.tail = (m_keyboard.tail+1) % KEYBOARD_QUEUE_SIZE; + + // new data in queue + m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER( geniusiq_state::send_mouse_input ) +{ + UINT8 new_mouse_x = ioport("MOUSEX")->read(); + UINT8 new_mouse_y = ioport("MOUSEY")->read(); + UINT8 mouse_buttons = ioport("MOUSE")->read(); + + UINT8 delta_x = (UINT8)(new_mouse_x - m_mouse_posx); + UINT8 delta_y = (UINT8)(new_mouse_y - m_mouse_posy); + m_mouse_posx = new_mouse_x; + m_mouse_posy = new_mouse_y; + + queue_input(0x1000 | 0x40 | mouse_buttons | ((delta_y>>4) & 0x0c) | ((delta_x>>6) & 0x03)); + queue_input(0x1000 | (delta_x & 0x3f)); + queue_input(0x1000 | (delta_y & 0x3f)); +} + +INPUT_CHANGED_MEMBER( geniusiq_state::send_input ) +{ + UINT16 data = (UINT16)(FPTR)param; + + // set bit 7 if the key is released + if (!newval) + data |= 0x80; + + queue_input(data); +} + +static ADDRESS_MAP_START(gl8008cx_mem, AS_PROGRAM, 16, gl8008cx_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1FFFFF) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(geniusiq_mem, AS_PROGRAM, 16, geniusiq_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x1FFFFF) AM_ROM + AM_RANGE(0x200000, 0x23FFFF) AM_RAM + AM_RANGE(0x300000, 0x30FFFF) AM_RAM AM_SHARE("vram") + AM_RANGE(0x310000, 0x31FFFF) AM_RAM + AM_RANGE(0x400000, 0x41ffff) AM_MIRROR(0x0e0000) AM_DEVREADWRITE8("flash", intelfsh8_device, read, write, 0x00ff) + AM_RANGE(0x600300, 0x600301) AM_READ(input_r) + //AM_RANGE(0x600500, 0x60050f) // read during IRQ 5 + //AM_RANGE(0x600600, 0x600605) // sound ?? + AM_RANGE(0x600606, 0x600609) AM_WRITE(gfx_base_w) + AM_RANGE(0x60060a, 0x60060b) AM_WRITE(gfx_idx_w) + AM_RANGE(0x600802, 0x600803) AM_READ(cart_state_r) // cartridge state + AM_RANGE(0x600108, 0x600109) AM_READ(unk0_r) // read before run a BASIC program + AM_RANGE(0x600918, 0x600919) AM_READ(unk0_r) // loop at start if bit 0 is set + AM_RANGE(0x601008, 0x601009) AM_READ(unk_r) // unknown, read at start and expect that bit 2 changes several times before continue + AM_RANGE(0x601010, 0x601011) AM_READ(unk0_r) // loop at start if bit 1 is set + AM_RANGE(0x601018, 0x60101b) AM_WRITE(gfx_dest_w) + AM_RANGE(0x60101c, 0x60101f) AM_WRITE(gfx_color_w) + AM_RANGE(0x601060, 0x601063) AM_WRITE(mouse_pos_w) + AM_RANGE(0x601100, 0x6011ff) AM_RAM AM_SHARE("mouse_gfx") // mouse cursor gfx (24x16) + AM_RANGE(0xa00000, 0xafffff) AM_DEVREAD("cartslot", generic_slot_device, read16_rom) + // 0x600000 : some memory mapped hardware +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( geniusiq ) + PORT_START( "IN0" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x00 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x01 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x02 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x03 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x04 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LALT ) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x05 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x06 ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x07 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x08 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x09 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0d ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0e ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0f ) + + PORT_START( "IN1" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x10 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x11 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x12 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x13 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x14 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x15 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x16 ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHAR('\'') PORT_CHAR('~') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x17 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH ) PORT_CHAR('$') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x18 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_EQUALS ) PORT_CHAR('=') PORT_CHAR('+') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x19 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CLOSEBRACE ) PORT_CHAR(')') PORT_CHAR(0x00b0) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_OPENBRACE ) PORT_CHAR(0x00f9) PORT_CHAR('%') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH ) PORT_CHAR('^') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1d ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_P ) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1e ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_TILDE ) PORT_CHAR('!') PORT_CHAR('*') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1f ) + + PORT_START( "IN2" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHAR(0x00e0) PORT_CHAR('0') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x20 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE( KEYCODE_ENTER ) PORT_CHAR(13) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x21 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE( KEYCODE_BACKSPACE ) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x22 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_L ) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x23 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_O ) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x24 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHAR(0x00e7) PORT_CHAR('9') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x25 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x26 ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Button 2 (keyboard)") PORT_CODE( KEYCODE_F3 ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x27 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x28 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PGDN ) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x29 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PGUP ) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_STOP ) PORT_CHAR(':') PORT_CHAR('/') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COLON ) PORT_CHAR(';') PORT_CHAR('.') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_K ) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2d ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_I ) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2e ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Button 1 (keyboard)") PORT_CODE( KEYCODE_F2 ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2f ) + + PORT_START( "IN3" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHAR('_') PORT_CHAR('8') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x30 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ESC ) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x31 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHAR(',') PORT_CHAR('?') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x32 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_J ) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x33 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_U ) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x34 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHAR(0x00e8) PORT_CHAR('7') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x35 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x36 ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x37 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x38 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PRTSCR ) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x39 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS ) PORT_CHAR('-') PORT_CHAR(0x00a3) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_DEL ) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_N ) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_H ) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3d ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3e ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_NUMLOCK ) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3f ) + + PORT_START( "IN4" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHAR('-') PORT_CHAR('6') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x40 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_TAB ) PORT_CHAR('\t') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x41 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_B ) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x42 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_G ) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x43 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_T ) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x44 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5 ) PORT_CHAR('(') PORT_CHAR('5') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x45 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x46 ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x47 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x48 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x49 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH2 ) /*PORT_CHAR('')*/ PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SPACE ) PORT_CHAR(' ') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_V ) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F ) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4d ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_R ) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4e ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Up Button") PORT_CODE( KEYCODE_UP ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4f ) + + PORT_START( "IN5" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4 ) PORT_CHAR('\'') PORT_CHAR('4') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x50 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_C ) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x51 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_D ) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x52 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_E ) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x53 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3 ) PORT_CHAR('"') PORT_CHAR('3') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x54 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x55 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x56 ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Down Button") PORT_CODE( KEYCODE_DOWN ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x57 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x58 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_X ) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x59 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_S ) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHAR(0x00e9) PORT_CHAR('2') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5d ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5e ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Left Button") PORT_CODE( KEYCODE_LEFT ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5f ) + + PORT_START( "IN6" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE( KEYCODE_F1 ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x60 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x61 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_END ) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x62 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x63 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x64 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x65 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHAR('&') PORT_CHAR('1') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x66 ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Right Button") PORT_CODE( KEYCODE_RIGHT ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x67 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x68 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F4 ) PORT_CHAR(0x00a4) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x69 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_DEL_PAD ) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH_PAD ) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ASTERISK ) PORT_CHAR('*') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS_PAD ) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6d ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PLUS_PAD ) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6e ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ENTER_PAD ) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6f ) + + PORT_START( "IN7" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0_PAD ) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x70 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1_PAD ) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x71 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2_PAD ) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x72 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3_PAD ) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x73 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4_PAD ) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x74 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5_PAD ) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x75 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6_PAD ) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x76 ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7_PAD ) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x77 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8_PAD ) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x78 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9_PAD ) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x79 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7d ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7e ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7f ) + + PORT_START("MOUSEX") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_mouse_input, 0 ) + + PORT_START("MOUSEY") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_mouse_input, 0 ) + + PORT_START("MOUSE") + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_mouse_input, 0 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_mouse_input, 0 ) +INPUT_PORTS_END + + +static INPUT_PORTS_START( geniusiq_de ) + PORT_INCLUDE(geniusiq) + + PORT_MODIFY( "IN1" ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHAR('^') PORT_CHAR(0x00b0) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x17 ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH ) PORT_CHAR('+') PORT_CHAR('*') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x18 ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_EQUALS ) PORT_CHAR('{') PORT_CHAR('}') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x19 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CLOSEBRACE ) PORT_CHAR(0x00b0) PORT_CHAR('?') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1a ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_OPENBRACE ) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH ) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1c ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COLON ) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1d ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_TILDE ) PORT_CHAR('-') PORT_CHAR('_') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1f ) + + PORT_MODIFY( "IN2" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHAR('0') PORT_CHAR('=') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x20 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHAR('9') PORT_CHAR(')') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x25 ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_STOP ) PORT_CHAR('.') PORT_CHAR(':') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHAR(',') PORT_CHAR(';') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2c ) + + PORT_MODIFY( "IN3" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHAR('8') PORT_CHAR('(') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x30 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x32 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHAR('7') PORT_CHAR('/') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x35 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS ) PORT_CHAR('#') PORT_CHAR('\'') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3a ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3e ) + + PORT_MODIFY( "IN4" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHAR('6') PORT_CHAR('&') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x40 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5 ) PORT_CHAR('5') PORT_CHAR('/') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x45 ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH2 ) PORT_CHAR('<') PORT_CHAR('>') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4a ) + + PORT_MODIFY( "IN5" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4 ) PORT_CHAR('4') PORT_CHAR('$') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x50 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3 ) PORT_CHAR('3') PORT_CHAR(0x00a7) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x54 ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5b ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHAR('2') PORT_CHAR('"') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5c ) + + PORT_MODIFY( "IN6" ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x63 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x64 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x65 ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHAR('1') PORT_CHAR('!') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x66 ) +INPUT_PORTS_END + +static INPUT_PORTS_START( gl8008cx ) +INPUT_PORTS_END + +void geniusiq_state::machine_start() +{ +} + +void geniusiq_state::machine_reset() +{ + m_keyboard.head = m_keyboard.tail = 0; + + m_gfx_y = 0; + m_gfx_x = 0; + m_gfx_base = 0; + m_gfx_color[0] = m_gfx_color[1] = 0; + m_mouse_posx = 0; + m_mouse_posy = 0; + m_mouse_gfx_posx = 0; + m_mouse_gfx_posy = 0; +} + +DEVICE_IMAGE_LOAD_MEMBER(geniusiq_state,iq128_cart) +{ + UINT32 size = m_cart->common_get_size("rom"); + + // we always a 0x100000 region, for easier mapping in the memory map + m_cart->rom_alloc(0x100000, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + m_cart_state = IQ128_ROM_CART; + + if (image.software_entry() != NULL) + { + const char *pcb_type = image.get_feature("pcb_type"); + if (pcb_type) + { + if (!core_stricmp(pcb_type, "romless1")) + m_cart_state = IQ128_ROMLESS1_CART; + if (!core_stricmp(pcb_type, "romless2")) + m_cart_state = IQ128_ROMLESS2_CART; + } + } + + return IMAGE_INIT_PASS; +} + +DEVICE_IMAGE_UNLOAD_MEMBER(geniusiq_state,iq128_cart) +{ + m_cart_state = IQ128_NO_CART; +} + + +static MACHINE_CONFIG_START( iq128, geniusiq_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) // The main crystal is at 32MHz, not sure whats the CPU freq + MCFG_CPU_PROGRAM_MAP(geniusiq_mem) + MCFG_CPU_PERIODIC_INT_DRIVER(geniusiq_state, irq6_line_hold, 125) // the internal clock is increased by 1 sec every 125 interrupts + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER( geniusiq_state, screen_update ) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(geniusiq_state, geniusiq) + + /* internal flash */ + MCFG_AMD_29F010_ADD("flash") + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "iq128_cart") + MCFG_GENERIC_LOAD(geniusiq_state, iq128_cart) + MCFG_GENERIC_UNLOAD(geniusiq_state, iq128_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "iq128") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( iqtv512, iq128 ) + /* internal flash */ + MCFG_DEVICE_REMOVE("flash") + MCFG_AMD_29F040_ADD("flash") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( gl8008cx, gl8008cx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) // TODO wrong CPU and frequency + MCFG_CPU_PROGRAM_MAP(gl8008cx_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER( gl8008cx_state, screen_update ) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( iq128 ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "27-5947-00.bin", 0x0000, 0x200000, CRC(a98fc3ff) SHA1(de76a5898182bd0180bd2b3e34c4502f0918a3fa) ) +ROM_END + +ROM_START( iq128_fr ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "geniusiq.bin", 0x0000, 0x200000, CRC(9b06cbf1) SHA1(b9438494a9575f78117c0033761f899e3c14e292) ) +ROM_END + +ROM_START( iqtv512 ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "27-06171-000.bin", 0x0000, 0x200000, CRC(2597af70) SHA1(9db8151a84517407d380424410b6fa0003ceb1eb) ) +ROM_END + +ROM_START( gl8008cx ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "27-6393-11.u1", 0x0000, 0x200000, CRC(fd49db46) SHA1(fc55bb31f42068f9d6cc8e2c2f419c3c4edb4fe6) ) + + ROM_REGION(0x800, "subcpu", 0) + ROM_LOAD( "27-6296-0-0.u3", 0x000, 0x800, NO_DUMP ) +ROM_END + +ROM_START( bs9009cx ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "27-6603-01.u1", 0x0000, 0x200000, CRC(2c299f65) SHA1(44b37007a7c4087d7c2bd8c24907402bfe445ba4) ) + + ROM_REGION(0x800, "subcpu", 0) + ROM_LOAD( "mcu.u5", 0x000, 0x800, NO_DUMP ) +ROM_END + +ROM_START( itunlim ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "27-06124-002.u3", 0x000000, 0x200000, CRC(0c0753ce) SHA1(d22504d583ca8d6a9d2f56fbaa3e1d52c442a1e9) ) +ROM_END + +ROM_START( iqunlim ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD16_WORD_SWAP( "27-06126-007.bin", 0x000000, 0x200000, CRC(af38c743) SHA1(5b91748536905812e6de7145638699acb375865a) ) +ROM_END + +ROM_START( glmmc ) + ROM_REGION(0x200000, "maincpu", 0) + ROM_LOAD( "27-5889-00.bin", 0x000000, 0x080000, CRC(5e2c6359) SHA1(cc01c7bd5c87224b63dd1044db5a36a5cb7824f1) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1997, iq128, 0, 0, iq128, geniusiq_de, driver_device, 0, "Video Technology", "Genius IQ 128 (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1997, iq128_fr, iq128, 0, iq128, geniusiq, driver_device, 0, "Video Technology", "Genius IQ 128 (France)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1998, iqtv512, 0, 0, iqtv512, geniusiq_de, driver_device, 0, "Video Technology", "Genius IQ TV 512 (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1999, gl8008cx, 0, 0, gl8008cx, gl8008cx, driver_device, 0, "Video Technology", "Genius Leader 8008 CX (Germany)", MACHINE_IS_SKELETON) +COMP( 1999, bs9009cx, 0, 0, gl8008cx, gl8008cx, driver_device, 0, "Video Technology", "BrainStation 9009 CXL (Germany)", MACHINE_IS_SKELETON) +COMP( 1998, itunlim, 0, 0, iq128, geniusiq_de, driver_device, 0, "Video Technology", "Vtech IT Unlimited (UK)", MACHINE_NO_SOUND) +COMP( 19??, iqunlim, 0, 0, iq128, geniusiq_de, driver_device, 0, "Video Technology", "Vtech IQ Unlimited (Germany)", MACHINE_IS_SKELETON) +COMP( 19??, glmmc, 0, 0, iq128, geniusiq_de, driver_device, 0, "Video Technology", "Genius Leader Master Mega Color (Germany)", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/genpc.c b/src/mame/drivers/genpc.c new file mode 100644 index 00000000000..a17a2dd9d29 --- /dev/null +++ b/src/mame/drivers/genpc.c @@ -0,0 +1,280 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Miodrag Milanovic +/*************************************************************************** + + drivers/genpc.c + + Driver file for generic PC machines + +***************************************************************************/ + + +#include "emu.h" + +#include "includes/genpc.h" + +#include "cpu/nec/nec.h" +#include "cpu/i86/i86.h" +#include "machine/pc_lpt.h" +#include "bus/pc_kbd/keyboards.h" + +class genpc_state : public driver_device +{ +public: + genpc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + required_device m_maincpu; +}; + +static ADDRESS_MAP_START( pc8_map, AS_PROGRAM, 8, genpc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc16_map, AS_PROGRAM, 16, genpc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(pc8_io, AS_IO, 8, genpc_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pc16_io, AS_IO, 16, genpc_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + + +static INPUT_PORTS_START( pcgen ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START(cga) + DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x20) +DEVICE_INPUT_DEFAULTS_END + +static DEVICE_INPUT_DEFAULTS_START(vga) + DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x00) +DEVICE_INPUT_DEFAULTS_END + + +static MACHINE_CONFIG_START( pcmda, genpc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", V20, 4772720) + MCFG_CPU_PROGRAM_MAP(pc8_map) + MCFG_CPU_IO_MAP(pc8_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "mda", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, "adlib", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( pcherc, genpc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", V20, 4772720) + MCFG_CPU_PROGRAM_MAP(pc8_map) + MCFG_CPU_IO_MAP(pc8_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "hercules", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, "adlib", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( pccga, genpc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 4772720) + MCFG_CPU_PROGRAM_MAP(pc16_map) + MCFG_CPU_IO_MAP(pc16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(cga) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, "sblaster1_0", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( pcega, genpc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 4772720) + MCFG_CPU_PROGRAM_MAP(pc16_map) + MCFG_CPU_IO_MAP(pc16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(vga) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "com", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "hdc", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "sblaster1_0", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, "ega", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( xtvga, genpc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 4772720) + MCFG_CPU_PROGRAM_MAP(pc16_map) + MCFG_CPU_IO_MAP(pc16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(vga) + + MCFG_ISA8_SLOT_ADD("mb:isa","isa1", pc_isa8_cards, "com", false) + MCFG_ISA8_SLOT_ADD("mb:isa","isa2", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa","isa3", pc_isa8_cards, "hdc", false) + MCFG_ISA8_SLOT_ADD("mb:isa","isa4", pc_isa8_cards, "sblaster1_0", false) + MCFG_ISA8_SLOT_ADD("mb:isa","isa5", pc_isa8_cards, "svga_et4k", false) + MCFG_ISA8_SLOT_ADD("mb:isa","isa6", pc_isa8_cards, NULL, false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + + +ROM_START( pcmda ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "anon", "XT Anonymous Generic Turbo BIOS") + ROMX_LOAD("pcxt.rom", 0xfe000, 0x02000, CRC(031aafad) SHA1(a641b505bbac97b8775f91fe9b83d9afdf4d038f),ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "anon2007", "XT Anonymous Generic Turbo BIOS 2007") + ROMX_LOAD( "pcxt2007.bin", 0xfe000, 0x2000, CRC(1d7bd86c) SHA1(33a500f599b4dad2fe6d7a5c3e89b13bd5dd2987),ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "ami", "XT AMI") + ROMX_LOAD( "ami.bin", 0xfe000, 0x2000, CRC(b381eb22) SHA1(9735193de119270c946a17ed58c3ab9554e0852e),ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "award", "XT Award 2.05") + ROMX_LOAD( "award2.05.bin", 0xfe000, 0x2000, CRC(5b3953e5) SHA1(4a36171aa8d993008187f39f732b9296401b7b6c),ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "dtk", "XT DTK Erso bios 2.42") + ROMX_LOAD( "dtk2.42.bin", 0xfe000, 0x2000, CRC(3f2d2a76) SHA1(02fa057f2c22ab199a8d9795ab1ae570f2b13a36),ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "peter", "XT Peter Kohlman 3.75") // V20 Rom only + ROMX_LOAD( "peterv203.75.bin", 0xfe000, 0x2000, CRC(b053a6a4) SHA1(f53218ad3d725f12d9149b22d8afcf6a8869a3bd),ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "pho227", "XT Phoenix Bios 2.27") + ROMX_LOAD( "phoenix2.27.bin", 0xfe000, 0x2000, CRC(168ffef0) SHA1(69465db2f9246a614044d1f433d374506a13a07f),ROM_BIOS(7)) + ROM_SYSTEM_BIOS(7, "pho251", "XT Phoenix Bios 2.51") + ROMX_LOAD( "phoenix2.51.bin", 0xfe000, 0x2000, CRC(9b7e9c40) SHA1(c948a8d3d715e469105c6e2acd8b46ec274b25a8),ROM_BIOS(8)) + ROM_SYSTEM_BIOS(8, "turbo", "XT Turbo Bios 3.10") + ROMX_LOAD( "turbo3.10.bin", 0xfe000, 0x2000, CRC(8aaca1e3) SHA1(9c03da16713e08c0112a04c8bdfa394e7341c1fc),ROM_BIOS(9)) +ROM_END + +#define rom_pcherc rom_pcmda + +#define rom_pcega rom_pcmda + +ROM_START( pc ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "anon", "XT Anonymous Generic Turbo BIOS") + ROMX_LOAD("pcxt.rom", 0xfe000, 0x02000, CRC(031aafad) SHA1(a641b505bbac97b8775f91fe9b83d9afdf4d038f),ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "anon2007", "XT Anonymous Generic Turbo BIOS 2007") + ROMX_LOAD( "pcxt2007.bin", 0xfe000, 0x2000, CRC(1d7bd86c) SHA1(33a500f599b4dad2fe6d7a5c3e89b13bd5dd2987),ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "ami", "XT AMI") + ROMX_LOAD( "ami.bin", 0xfe000, 0x2000, CRC(b381eb22) SHA1(9735193de119270c946a17ed58c3ab9554e0852e),ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "award", "XT Award 2.05") + ROMX_LOAD( "award2.05.bin", 0xfe000, 0x2000, CRC(5b3953e5) SHA1(4a36171aa8d993008187f39f732b9296401b7b6c),ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "dtk", "XT DTK Erso bios 2.42") + ROMX_LOAD( "dtk2.42.bin", 0xfe000, 0x2000, CRC(3f2d2a76) SHA1(02fa057f2c22ab199a8d9795ab1ae570f2b13a36),ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "peter", "XT Peter Kohlman 3.75") + ROMX_LOAD( "peterv203.75.bin", 0xfe000, 0x2000, CRC(b053a6a4) SHA1(f53218ad3d725f12d9149b22d8afcf6a8869a3bd),ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "pho227", "XT Phoenix Bios 2.27") + ROMX_LOAD( "phoenix2.27.bin", 0xfe000, 0x2000, CRC(168ffef0) SHA1(69465db2f9246a614044d1f433d374506a13a07f),ROM_BIOS(7)) + ROM_SYSTEM_BIOS(7, "pho251", "XT Phoenix Bios 2.51") + ROMX_LOAD( "phoenix2.51.bin", 0xfe000, 0x2000, CRC(9b7e9c40) SHA1(c948a8d3d715e469105c6e2acd8b46ec274b25a8),ROM_BIOS(8)) + ROM_SYSTEM_BIOS(8, "turbo", "XT Turbo Bios 3.10") + ROMX_LOAD( "turbo3.10.bin", 0xfe000, 0x2000, CRC(8aaca1e3) SHA1(9c03da16713e08c0112a04c8bdfa394e7341c1fc),ROM_BIOS(9)) + /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ + ROM_REGION(0x2000,"gfx1", 0) + ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ +ROM_END + +#define rom_xtvga rom_pcmda + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1987, pc, ibm5150, 0, pccga, pcgen, driver_device, 0, "", "PC (CGA)" , 0) +COMP( 1987, pcega, ibm5150, 0, pcega, pcgen, driver_device, 0, "", "PC (EGA)" , 0) +COMP ( 1987, pcmda, ibm5150, 0, pcmda, pcgen, driver_device, 0, "", "PC (MDA)" , 0) +COMP ( 1987, pcherc, ibm5150, 0, pcherc, pcgen, driver_device, 0, "", "PC (Hercules)" , 0) +COMP ( 1987, xtvga, ibm5150, 0, xtvga, pcgen, driver_device, 0, "", "PC (VGA)" , MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/gimix.c b/src/mame/drivers/gimix.c new file mode 100644 index 00000000000..2f04b6688d2 --- /dev/null +++ b/src/mame/drivers/gimix.c @@ -0,0 +1,686 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald, Robbbert +/* + Gimix 6809-Based Computers + + Representative group of GIMIX users included: Government Research and Scientific Organizations, Universities, Industrial, Computer Mainframe and + Peripheral Manufacturers and Software Houses. + + This system is most notable for being the development base of the "Vid Kidz", a pair of programmers (Eugene Jarvis and Larry DeMar) who formerly + worked for Williams Electronics on the game, Defender. They left Willams and continued work on other games eventually making a deal with Williams + to continue to design games producing the titles: Stargate, Robotron: 2084 and Blaster. + + Information Link: http://www.backglass.org/duncan/gimix/ + + TODO: Everything + + Usage: + System boots into GMXBUG-09 + To boot Flex, insert the Flex system disk (3.3 or later, must support the DMA disk controller), type U and press enter. + To boot OS-9, insert the OS-9 system disk, type O, and press Enter. + Note that booting OS-9 doesn't currently work without a timer hack. +*/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/mm58167.h" +#include "machine/6840ptm.h" +#include "machine/6821pia.h" +#include "machine/6850acia.h" +#include "bus/rs232/rs232.h" +#include "machine/clock.h" +#include "machine/wd_fdc.h" +#include "machine/terminal.h" +#include "machine/bankdev.h" +#include "machine/ram.h" +#include "formats/flex_dsk.h" + +#define DMA_DRQ (m_dma_status & 0x80) +#define DMA_INTRQ (m_dma_status & 0x40) +#define DMA_MOTOR_DELAY (m_dma_status & 0x20) +#define DMA_ENABLED (m_dma_status & 0x10) +#define DMA_FAULT (m_dma_status & 0x08) +#define DMA_DRIVE_SIZE (m_dma_status & 0x04) +#define DMA_DIP_SENSE (m_dma_status & 0x01) + +#define DMA_CONNECT_SEL (m_dma_drive_select & 0x40) +#define DMA_DENSITY (m_dma_drive_select & 0x20) +#define DMA_WR_PROTECT (m_dma_drive_select & 0x10) +#define DMA_SEL_DRV3 (m_dma_drive_select & 0x08) +#define DMA_SEL_DRV2 (m_dma_drive_select & 0x04) +#define DMA_SEL_DRV1 (m_dma_drive_select & 0x02) +#define DMA_SEL_DRV0 (m_dma_drive_select & 0x01) + +#define DMA_IRQ_ENABLE (m_dma_ctrl & 0x80) +#define DMA_SIDE_SEL (m_dma_ctrl & 0x40) +#define DMA_DIRECTION (m_dma_ctrl & 0x20) +#define DMA_ENABLE (m_dma_ctrl & 0x10) +#define DMA_BANK (m_dma_ctrl & 0x0f) + +#define DMA_START_ADDR (((m_dma_ctrl & 0x0f) << 16) | m_dma_start_addr) + +class gimix_state : public driver_device +{ +public: + gimix_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_ram(*this, RAM_TAG) + , m_rom(*this, "roms") + , m_acia1(*this, "acia1") + , m_acia2(*this, "acia2") + , m_acia3(*this, "acia3") + , m_acia4(*this, "acia4") + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_bank4(*this, "bank4") + , m_bank5(*this, "bank5") + , m_bank6(*this, "bank6") + , m_bank7(*this, "bank7") + , m_bank8(*this, "bank8") + , m_bank9(*this, "bank9") + , m_bank10(*this, "bank10") + , m_bank11(*this, "bank11") + , m_bank12(*this, "bank12") + , m_bank13(*this, "bank13") + , m_bank14(*this, "bank14") + , m_bank15(*this, "bank15") + , m_bank16(*this, "bank16") + , m_rombank1(*this, "rombank1") + , m_rombank2(*this, "rombank2") + , m_fixedrombank(*this, "fixedrombank") + , m_dma_dip(*this, "dma_s2") + {} + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(keyin_r); + DECLARE_READ8_MEMBER(status_r); + DECLARE_WRITE8_MEMBER(system_w); + DECLARE_WRITE_LINE_MEMBER(irq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_READ8_MEMBER(dma_r); + DECLARE_WRITE8_MEMBER(dma_w); + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + DECLARE_READ8_MEMBER(pia_pa_r); + DECLARE_WRITE8_MEMBER(pia_pa_w); + DECLARE_READ8_MEMBER(pia_pb_r); + DECLARE_WRITE8_MEMBER(pia_pb_w); + TIMER_DEVICE_CALLBACK_MEMBER(test_timer_w); + DECLARE_INPUT_CHANGED_MEMBER(drive_size_cb); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + +private: + UINT8 m_term_data; + UINT8 m_dma_status; + UINT8 m_dma_ctrl; + UINT8 m_dma_drive_select; + UINT16 m_dma_start_addr; + UINT32 m_dma_current_addr; + UINT8 m_task; + UINT8 m_task_banks[16][16]; + UINT8 m_selected_drive; + bool m_floppy0_ready; + bool m_floppy1_ready; + + UINT8 m_pia1_pa; + UINT8 m_pia1_pb; + + virtual void machine_reset(); + virtual void machine_start(); + virtual void driver_start(); + + void refresh_memory(); + + required_device m_maincpu; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_ram; + required_memory_region m_rom; + required_device m_acia1; + required_device m_acia2; + required_device m_acia3; + required_device m_acia4; + + required_device m_bank1; + required_device m_bank2; + required_device m_bank3; + required_device m_bank4; + required_device m_bank5; + required_device m_bank6; + required_device m_bank7; + required_device m_bank8; + required_device m_bank9; + required_device m_bank10; + required_device m_bank11; + required_device m_bank12; + required_device m_bank13; + required_device m_bank14; + required_device m_bank15; + required_device m_bank16; + required_memory_bank m_rombank1; + required_memory_bank m_rombank2; + required_memory_bank m_fixedrombank; + + required_ioport m_dma_dip; +}; + +static ADDRESS_MAP_START( gimix_banked_mem, AS_PROGRAM, 8, gimix_state) + AM_RANGE(0x00000, 0x0dfff) AM_RAMBANK("lower_ram") + AM_RANGE(0x0e000, 0x0e000) AM_DEVREADWRITE("acia1",acia6850_device,status_r,control_w) + AM_RANGE(0x0e001, 0x0e001) AM_DEVREADWRITE("acia1",acia6850_device,data_r,data_w) + AM_RANGE(0x0e004, 0x0e004) AM_DEVREADWRITE("acia2",acia6850_device,status_r,control_w) + AM_RANGE(0x0e005, 0x0e005) AM_DEVREADWRITE("acia2",acia6850_device,data_r,data_w) + //AM_RANGE(0x0e018, 0x0e01b) AM_READWRITE(fdc_r, fdc_w) // FD1797 FDC (PIO) + AM_RANGE(0x0e100, 0x0e1ff) AM_RAM + //AM_RANGE(0x0e200, 0x0e20f) // 9511A / 9512 Arithmetic Processor + AM_RANGE(0x0e210, 0x0e21f) AM_DEVREADWRITE("timer",ptm6840_device,read,write) + AM_RANGE(0x0e220, 0x0e23f) AM_DEVREADWRITE("rtc",mm58167_device,read,write) + AM_RANGE(0x0e240, 0x0e3af) AM_RAM + AM_RANGE(0x0e3b0, 0x0e3b3) AM_READWRITE(dma_r, dma_w) // DMA controller (custom?) + AM_RANGE(0x0e3b4, 0x0e3b7) AM_READWRITE(fdc_r, fdc_w) // FD1797 FDC + AM_RANGE(0x0e400, 0x0e7ff) AM_RAM // scratchpad RAM + AM_RANGE(0x0e800, 0x0efff) AM_RAM + AM_RANGE(0x0f000, 0x0f7ff) AM_ROMBANK("rombank2") + AM_RANGE(0x0f800, 0x0ffff) AM_ROMBANK("rombank1") + //AM_RANGE(0x10000, 0x1ffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( gimix_mem, AS_PROGRAM, 8, gimix_state ) + AM_RANGE(0x0000, 0x0fff) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) + AM_RANGE(0x1000, 0x1fff) AM_DEVREADWRITE("bank2", address_map_bank_device, read8, write8) + AM_RANGE(0x2000, 0x2fff) AM_DEVREADWRITE("bank3", address_map_bank_device, read8, write8) + AM_RANGE(0x3000, 0x3fff) AM_DEVREADWRITE("bank4", address_map_bank_device, read8, write8) + AM_RANGE(0x4000, 0x4fff) AM_DEVREADWRITE("bank5", address_map_bank_device, read8, write8) + AM_RANGE(0x5000, 0x5fff) AM_DEVREADWRITE("bank6", address_map_bank_device, read8, write8) + AM_RANGE(0x6000, 0x6fff) AM_DEVREADWRITE("bank7", address_map_bank_device, read8, write8) + AM_RANGE(0x7000, 0x7fff) AM_DEVREADWRITE("bank8", address_map_bank_device, read8, write8) + AM_RANGE(0x8000, 0x8fff) AM_DEVREADWRITE("bank9", address_map_bank_device, read8, write8) + AM_RANGE(0x9000, 0x9fff) AM_DEVREADWRITE("bank10", address_map_bank_device, read8, write8) + AM_RANGE(0xa000, 0xafff) AM_DEVREADWRITE("bank11", address_map_bank_device, read8, write8) + AM_RANGE(0xb000, 0xbfff) AM_DEVREADWRITE("bank12", address_map_bank_device, read8, write8) + AM_RANGE(0xc000, 0xcfff) AM_DEVREADWRITE("bank13", address_map_bank_device, read8, write8) + AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE("bank14", address_map_bank_device, read8, write8) + AM_RANGE(0xe000, 0xefff) AM_DEVREADWRITE("bank15", address_map_bank_device, read8, write8) + AM_RANGE(0xf000, 0xfeff) AM_DEVREADWRITE("bank16", address_map_bank_device, read8, write8) + AM_RANGE(0xff00, 0xffff) AM_ROMBANK("fixedrombank") AM_WRITE(system_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( gimix_io, AS_IO, 8, gimix_state ) +ADDRESS_MAP_END + +static INPUT_PORTS_START( gimix ) + PORT_START("dma_s2") + PORT_DIPNAME(0x00000100,0x00000000,"5.25\" / 8\" floppy drive 0") PORT_DIPLOCATION("S2:9") PORT_CHANGED_MEMBER(DEVICE_SELF,gimix_state,drive_size_cb,NULL) + PORT_DIPSETTING(0x00000000,"5.25\"") + PORT_DIPSETTING(0x00000100,"8\"") + +INPUT_PORTS_END + +READ8_MEMBER( gimix_state::keyin_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( gimix_state::status_r ) +{ + return (m_term_data) ? 3 : 2; +} + +WRITE8_MEMBER( gimix_state::kbd_put ) +{ + m_term_data = data; +} + +void gimix_state::refresh_memory() +{ + int x; + address_map_bank_device* banknum[16] = { m_bank1, m_bank2, m_bank3, m_bank4, m_bank5, m_bank6, m_bank7, m_bank8, + m_bank9, m_bank10, m_bank11, m_bank12, m_bank13, m_bank14, m_bank15, m_bank16}; + + for(x=0;x<16;x++) // for each bank + { + banknum[x]->set_bank(m_task_banks[m_task][x]); + } +} + +WRITE8_MEMBER( gimix_state::system_w ) +{ + if(offset == 0x7f) // task register + { + if(data & 0x20) // FPLA software latch + { + m_rombank1->set_entry(2); + m_rombank2->set_entry(3); + m_fixedrombank->set_entry(2); + logerror("SYS: FPLA software latch set\n"); + } + else + { + m_rombank1->set_entry(0); + m_rombank2->set_entry(1); + m_fixedrombank->set_entry(0); + logerror("SYS: FPLA software latch reset\n"); + } + m_task = data & 0x0f; + refresh_memory(); + logerror("SYS: Task set to %02x\n",data & 0x0f); + } + if(offset >= 0xf0) // Dynamic Address Translation RAM (write only) + { + address_map_bank_device* banknum[16] = { m_bank1, m_bank2, m_bank3, m_bank4, m_bank5, m_bank6, m_bank7, m_bank8, + m_bank9, m_bank10, m_bank11, m_bank12, m_bank13, m_bank14, m_bank15, m_bank16}; + + banknum[offset-0xf0]->set_bank(data & 0x0f); + m_task_banks[m_task][offset-0xf0] = data & 0x0f; + logerror("SYS: Bank %i set to physical bank %02x\n",offset-0xf0,data); + } +} + +READ8_MEMBER(gimix_state::dma_r) +{ + switch(offset) + { + case 0: + if(m_dma_dip->read() & 0x00000100) + m_dma_status |= 0x01; // 8" + else + m_dma_status &= ~0x01; // 5.25" + return m_dma_status; + case 1: + return m_dma_ctrl; + case 2: + return (m_dma_start_addr & 0xff00) >> 8; + case 3: + return (m_dma_start_addr & 0x00ff); + default: + logerror("DMA: Unknown or invalid DMA register %02x read\n",offset); + } + return 0xff; +} + +WRITE8_MEMBER(gimix_state::dma_w) +{ + switch(offset) + { + case 0: + logerror("DMA: Drive select %02x\n",data); + m_dma_drive_select = data; + m_fdc->dden_w(DMA_DENSITY ? 1 : 0); + if(data & 0x40) // 8" / 5.25" connector select + m_dma_status |= 0x04; + else + m_dma_status &= ~0x04; + if(data & 0x01) + { + m_fdc->set_floppy(m_floppy0->get_device()); + m_selected_drive = 1; + m_floppy1->get_device()->mon_w(1); // switch off the motor of other drives... + m_floppy1_ready = false; + logerror("FDC: Floppy drive 1 motor off\n"); + } + if(data & 0x02) + { + m_fdc->set_floppy(m_floppy1->get_device()); + m_selected_drive = 2; + m_floppy0->get_device()->mon_w(1); // switch off the motor of other drives... + m_floppy0_ready = false; + logerror("FDC: Floppy drive 0 motor off\n"); + } + break; + case 1: + logerror("DMA: DMA control %02x\n",data); + m_dma_ctrl = data; + if(data & 0x10) + m_dma_status |= 0x12; + else + m_dma_status &= ~0x12; + if(data & 0x40) + { + if(m_selected_drive == 1) + m_floppy0->get_device()->ss_w(1); + if(m_selected_drive == 2) + m_floppy1->get_device()->ss_w(1); + } + else + { + if(m_selected_drive == 1) + m_floppy0->get_device()->ss_w(0); + if(m_selected_drive == 2) + m_floppy1->get_device()->ss_w(0); + } + break; + case 2: + logerror("DMA: DMA start address MSB %02x\n",data); + m_dma_start_addr = (m_dma_start_addr & 0x00ff) | (data << 8); + m_dma_current_addr = DMA_START_ADDR; + break; + case 3: + logerror("DMA: DMA start address LSB %02x\n",data); + m_dma_start_addr = (m_dma_start_addr & 0xff00) | data; + m_dma_current_addr = DMA_START_ADDR; + break; + default: + logerror("DMA: Unknown or invalid DMA register %02x write %02x\n",offset,data); + } +} + +READ8_MEMBER(gimix_state::fdc_r) +{ + // motors are switched on on FDC access + if(m_selected_drive == 1 && m_floppy0_ready == false) + { + m_floppy0->get_device()->mon_w(0); + m_floppy0_ready = true; + logerror("FDC: Floppy drive 0 motor on\n"); + } + if(m_selected_drive == 2 && m_floppy1_ready == false) + { + m_floppy1->get_device()->mon_w(0); + m_floppy1_ready = true; + logerror("FDC: Floppy drive 1 motor on\n"); + } + return m_fdc->read(space,offset); +} + +WRITE8_MEMBER(gimix_state::fdc_w) +{ + // motors are switched on on FDC access + if(m_selected_drive == 1) + m_floppy0->get_device()->mon_w(0); + if(m_selected_drive == 2) + m_floppy1->get_device()->mon_w(0); + m_fdc->write(space,offset,data); +} + +READ8_MEMBER(gimix_state::pia_pa_r) +{ + return m_pia1_pa; +} + +WRITE8_MEMBER(gimix_state::pia_pa_w) +{ + m_pia1_pa = data; + logerror("PIA: Port A write %02x\n",data); +} + +READ8_MEMBER(gimix_state::pia_pb_r) +{ + return m_pia1_pb; +} + +WRITE8_MEMBER(gimix_state::pia_pb_w) +{ + m_pia1_pb = data; + logerror("PIA: Port B write %02x\n",data); +} + + +WRITE_LINE_MEMBER(gimix_state::irq_w) +{ + m_maincpu->set_input_line(M6809_IRQ_LINE,state ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE_LINE_MEMBER(gimix_state::fdc_irq_w) +{ + if(state) + m_dma_status |= 0x40; + else + m_dma_status &= ~0x40; +} + +WRITE_LINE_MEMBER(gimix_state::fdc_drq_w) +{ + if(state && DMA_ENABLED) + { + m_dma_status |= 0x80; + // do a DMA transfer + if(DMA_DIRECTION) + { + // write to disk + m_fdc->data_w(m_ram->read(m_dma_current_addr)); +// logerror("DMA: read from RAM %05x\n",m_dma_current_addr); + } + else + { + // read from disk + m_ram->write(m_dma_current_addr,m_fdc->data_r()); +// logerror("DMA: write to RAM %05x\n",m_dma_current_addr); + } + m_dma_current_addr++; + } + else + m_dma_status &= ~0x80; +} + +INPUT_CHANGED_MEMBER(gimix_state::drive_size_cb) +{ + // set FDC clock based on DIP Switch S2-9 (5.25"/8" drive select) + if(m_dma_dip->read() & 0x00000100) + m_fdc->set_unscaled_clock(XTAL_8MHz / 4); // 8 inch (2MHz) + else + m_fdc->set_unscaled_clock(XTAL_8MHz / 8); // 5.25 inch (1MHz) +} + +void gimix_state::machine_reset() +{ + m_term_data = 0; + m_rombank1->set_entry(0); // RAM banks are undefined on startup + m_rombank2->set_entry(1); + m_fixedrombank->set_entry(0); + m_dma_status = 0x00; + m_dma_ctrl = 0x00; + m_task = 0x00; + m_selected_drive = 0; + m_floppy0_ready = false; + m_floppy1_ready = false; + membank("lower_ram")->set_base(m_ram->pointer()); + if(m_ram->size() > 65536) + membank("upper_ram")->set_base(m_ram->pointer()+0x10000); + + // initialise FDC clock based on DIP Switch S2-9 (5.25"/8" drive select) + if(m_dma_dip->read() & 0x00000100) + m_fdc->set_unscaled_clock(XTAL_8MHz / 4); // 8 inch (2MHz) + else + m_fdc->set_unscaled_clock(XTAL_8MHz / 8); // 5.25 inch (1MHz) +} + +void gimix_state::machine_start() +{ + UINT8* ROM = m_rom->base(); + m_rombank1->configure_entries(0,4,ROM,0x800); + m_rombank2->configure_entries(0,4,ROM,0x800); + m_fixedrombank->configure_entries(0,4,ROM+0x700,0x800); + m_rombank1->set_entry(0); // RAM banks are undefined on startup + m_rombank2->set_entry(1); + m_fixedrombank->set_entry(0); + // install any extra RAM + if(m_ram->size() > 65536) + { + m_bank1->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank2->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank3->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank4->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank5->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank6->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank7->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank8->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank9->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank10->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank11->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank12->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank13->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank14->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank15->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + m_bank16->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); + } + m_floppy0->get_device()->set_rpm(300); + m_floppy1->get_device()->set_rpm(300); +} + +void gimix_state::driver_start() +{ +} + +WRITE_LINE_MEMBER(gimix_state::write_acia_clock) +{ + m_acia1->write_txc(state); + m_acia1->write_rxc(state); + m_acia2->write_txc(state); + m_acia2->write_rxc(state); +} + +TIMER_DEVICE_CALLBACK_MEMBER(gimix_state::test_timer_w) +{ + static bool prev; + if(!prev) + { + m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE); + prev = true; + } + else + { + m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE); + prev = false; + } +} + +FLOPPY_FORMATS_MEMBER( gimix_state::floppy_formats ) + FLOPPY_FLEX_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( gimix_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) + SLOT_INTERFACE( "8dd", FLOPPY_8_DSDD ) +SLOT_INTERFACE_END + +#define MCFG_ADDRESS_BANK(tag) \ +MCFG_DEVICE_ADD(tag, ADDRESS_MAP_BANK, 0) \ +MCFG_DEVICE_PROGRAM_MAP(gimix_banked_mem) \ +MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) \ +MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) \ +MCFG_ADDRESS_MAP_BANK_STRIDE(0x1000) + +static MACHINE_CONFIG_START( gimix, gimix_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", M6809E, XTAL_8MHz) + MCFG_CPU_PROGRAM_MAP(gimix_mem) + MCFG_CPU_IO_MAP(gimix_io) + + /* rtc */ + MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz) + MCFG_MM58167_IRQ_CALLBACK(WRITELINE(gimix_state,irq_w)) + + /* timer */ + MCFG_DEVICE_ADD("timer", PTM6840, XTAL_2MHz) // clock is a guess + MCFG_PTM6840_IRQ_CB(WRITELINE(gimix_state,irq_w)) // PCB pictures show both the RTC and timer set to generate IRQs (are jumper configurable) + + /* floppy disks */ + MCFG_FD1797_ADD("fdc",XTAL_8MHz / 4) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(gimix_state,fdc_irq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(gimix_state,fdc_drq_w)) + MCFG_WD_FDC_FORCE_READY + MCFG_FLOPPY_DRIVE_ADD("fdc:0", gimix_floppies, "525hd", gimix_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", gimix_floppies, "525hd", gimix_state::floppy_formats) + + /* parallel ports */ + MCFG_DEVICE_ADD("pia1",PIA6821,XTAL_2MHz) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(gimix_state,pia_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(gimix_state,pia_pb_w)) + MCFG_PIA_READPA_HANDLER(READ8(gimix_state,pia_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(gimix_state,pia_pb_r)) + MCFG_DEVICE_ADD("pia2",PIA6821,XTAL_2MHz) + + /* serial ports */ + MCFG_DEVICE_ADD("acia1",ACIA6850,XTAL_2MHz) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("serial1",rs232_port_device,write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("serial1",rs232_port_device,write_rts)) + + MCFG_DEVICE_ADD("acia2",ACIA6850,XTAL_2MHz) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("serial2",rs232_port_device,write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("serial2",rs232_port_device,write_rts)) + + MCFG_DEVICE_ADD("acia3",ACIA6850,XTAL_2MHz) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("serial3",rs232_port_device,write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("serial3",rs232_port_device,write_rts)) + + MCFG_DEVICE_ADD("acia4",ACIA6850,XTAL_2MHz) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("serial4",rs232_port_device,write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("serial4",rs232_port_device,write_rts)) + + MCFG_RS232_PORT_ADD("serial1",default_rs232_devices,NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia1",acia6850_device,write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia1",acia6850_device,write_cts)) + + MCFG_RS232_PORT_ADD("serial2",default_rs232_devices,"terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia2",acia6850_device,write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia2",acia6850_device,write_cts)) + + MCFG_RS232_PORT_ADD("serial3",default_rs232_devices,NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia3",acia6850_device,write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia3",acia6850_device,write_cts)) + + MCFG_RS232_PORT_ADD("serial4",default_rs232_devices,NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia4",acia6850_device,write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia4",acia6850_device,write_cts)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(gimix_state, write_acia_clock)) + + /* banking */ + MCFG_ADDRESS_BANK("bank1") + MCFG_ADDRESS_BANK("bank2") + MCFG_ADDRESS_BANK("bank3") + MCFG_ADDRESS_BANK("bank4") + MCFG_ADDRESS_BANK("bank5") + MCFG_ADDRESS_BANK("bank6") + MCFG_ADDRESS_BANK("bank7") + MCFG_ADDRESS_BANK("bank8") + MCFG_ADDRESS_BANK("bank9") + MCFG_ADDRESS_BANK("bank10") + MCFG_ADDRESS_BANK("bank11") + MCFG_ADDRESS_BANK("bank12") + MCFG_ADDRESS_BANK("bank13") + MCFG_ADDRESS_BANK("bank14") + MCFG_ADDRESS_BANK("bank15") + MCFG_ADDRESS_BANK("bank16") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("56K,256K,512K") + + MCFG_SOFTWARE_LIST_ADD("flop_list","gimix") + + // uncomment this timer to use a hack that generates a regular IRQ, this will get OS-9 to boot + // for some unknown reason, OS-9 does not touch the 6840, and only clears/disables IRQs on the RTC + //MCFG_TIMER_DRIVER_ADD_PERIODIC("test_timer",gimix_state,test_timer_w,attotime::from_msec(100)) +MACHINE_CONFIG_END + +ROM_START( gimix ) + ROM_REGION( 0x10000, "roms", 0) +/* CPU board U4: gimixf8.bin - checksum 68DB - 2716 - GMXBUG09 V2.1 | (c)1981 GIMIX | $F800 I2716 */ + ROM_LOAD( "gimixf8.u4", 0x000000, 0x000800, CRC(7d60f838) SHA1(eb7546e8bbf50d33e181f3e86c3e4c5c9032cab2) ) +/* CPU board U5: gimixv14.bin - checksum 97E2 - 2716 - GIMIX 6809 | AUTOBOOT | V1.4 I2716 */ + ROM_LOAD( "gimixv14.u5", 0x000800, 0x000800, CRC(f795b8b9) SHA1(eda2de51cc298d94b36605437d900ce971b3b276) ) +/* CPU board U6: os9l1v11.bin - checksum 2C84 - 2716 - OS-9tmL1 V1 | GIMIX P1 " (c)1982 MSC + CPU board U7: os9l1v12.bin - checksum 7694 - 2716 - OS-9tmL1 V1 | GIMIX P2-68 | (c)1982 MSC */ + ROM_LOAD( "os9l1v11.u6", 0x001000, 0x000800, CRC(0d6527a0) SHA1(1435a22581c6e9e0ae338071a72eed646f429530) ) + ROM_LOAD( "os9l1v12.u7", 0x001800, 0x000800, CRC(b3c65feb) SHA1(19d1ea1e84473b25c95cbb8449e6b9828567e998) ) + +/* Hard drive controller board 2 (XEBEC board) 11H: gimixhd.bin - checksum 2436 - 2732 - 104521D */ + ROM_REGION( 0x10000, "xebec", 0) + ROM_LOAD( "gimixhd.h11", 0x000000, 0x001000, CRC(35c12201) SHA1(51ac9052f9757d79c7f5bd3aa5d8421e98cfcc37) ) +ROM_END + +COMP( 1980, gimix, 0, 0, gimix, gimix, driver_device, 0, "Gimix", "Gimix 6809 System", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/gizmondo.c b/src/mame/drivers/gizmondo.c new file mode 100644 index 00000000000..c048a9ce672 --- /dev/null +++ b/src/mame/drivers/gizmondo.c @@ -0,0 +1,249 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/******************************************************************************* + + Tiger Telematics Gizmondo + + (c) 2010 Tim Schuerewegen + +*******************************************************************************/ + +/* + +== DiskOnChip G3 - Layout == + +00000020 00000020 00000000 00000000 00000000 00000006 00000025 00000006 12A00000 000000FF 00000000 00000000 00000000 00000000 (BOOT & FTST) +00000140 00000140 00000000 00000000 00000000 00000026 00000165 00000026 12100000 000000FF 00000000 00000000 00000000 00000000 (KRNL) +00000001 00000001 00000000 00000000 00000000 00000166 00000166 00000166 12100000 000000FF 00000000 00000000 00000000 00000000 +00000299 00000264 0000002F 00000003 00000003 0000016A 000003FF 00000167 1C100000 000000FF 00000000 + +== Windows CE - Interrupts == + +SYSINTR_KEYBOARD = INT_EINT1, INT_EINT4_7 (EINT4/EINT5/EINT6/EINT7, INT_EINT8_23 (EINT23) +SYSINTR_SERIAL_1 = INT_UART0 (SUBINT_ERR0, SUBINT_TXD0, SUBINT_RXD0), INT_EINT4_7 (EINT13) +SYSINTR_SERIAL_2 = INT_UART2 (SUBINT_ERR2, SUBINT_TXD2, SUBINT_RXD2) +SYSINTR_SERIAL_3 = INT_EINT8_23 (EINT17), ? +SYSINTR_POWER = INT_EINT8_23 (EINT12) +SYSINTR_SYNTH = INT_EINT8_23 (EINT16) +SYSINTR_GPS = INT_EINT3, INT_EINT8_23 (EINT18) + +*/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "machine/docg3.h" +#include "machine/s3c2440.h" +#include "video/gf4500.h" +#include "rendlay.h" + +#define VERBOSE_LEVEL ( 0 ) + + +#define BIT(x,n) (((x)>>(n))&1) +#define BITS(x,m,n) (((x)>>(n))&(((UINT32)1<<((m)-(n)+1))-1)) + +class gizmondo_state : public driver_device +{ +public: + gizmondo_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_s3c2440(*this, "s3c2440"), + m_maincpu(*this, "maincpu"), + m_gf4500(*this, "gf4500") + { } + + UINT32 m_port[9]; + required_device m_s3c2440; + DECLARE_DRIVER_INIT(gizmondo); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(port_changed); + inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); + required_device m_maincpu; + required_device m_gf4500; + DECLARE_READ32_MEMBER(s3c2440_gpio_port_r); + DECLARE_WRITE32_MEMBER(s3c2440_gpio_port_w); + + bitmap_rgb32 m_bitmap; +}; + + +inline void gizmondo_state::verboselog( int n_level, const char *s_fmt, ...) +{ + if (VERBOSE_LEVEL >= n_level) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt); + vsprintf( buf, s_fmt, v); + va_end( v); + logerror( "%s: %s", machine().describe_context( ), buf); + } +} +/******************************************************************************* + ... +*******************************************************************************/ + +// I/O PORT + +READ32_MEMBER(gizmondo_state::s3c2440_gpio_port_r) +{ + UINT32 data = m_port[offset]; + switch (offset) + { + case S3C2440_GPIO_PORT_D : + { + data = data & ~0x00000010; + data |= (1 << 4); // 1 = "BOOT", 0 = "FTST" + } + break; + case S3C2440_GPIO_PORT_F : + { + UINT32 port_c = m_port[S3C2440_GPIO_PORT_C]; + data = data & ~0x000000F2; + // keys + data |= 0x00F2; + if ((port_c & 0x01) == 0) data &= ~ioport("PORTF-01")->read(); + if ((port_c & 0x02) == 0) data &= ~ioport("PORTF-02")->read(); + if ((port_c & 0x04) == 0) data &= ~ioport("PORTF-04")->read(); + if ((port_c & 0x08) == 0) data &= ~ioport("PORTF-08")->read(); + if ((port_c & 0x10) == 0) data &= ~ioport("PORTF-10")->read(); + data &= ~ioport( "PORTF")->read(); + } + break; + case S3C2440_GPIO_PORT_G : + { + data = data & ~0x00008001; + // keys + data = data | 0x8000; + data &= ~ioport( "PORTG")->read(); + // no sd card inserted + data = data | 0x0001; + } + break; + } + return data; +} + +WRITE32_MEMBER(gizmondo_state::s3c2440_gpio_port_w) +{ + m_port[offset] = data; +} + +INPUT_CHANGED_MEMBER(gizmondo_state::port_changed) +{ + m_s3c2440->s3c2440_request_eint( 4); + //m_s3c2440->s3c2440_request_irq( S3C2440_INT_EINT1); +} + +#if 0 +QUICKLOAD_LOAD_MEMBER( gizmondo_state, gizmondo ) +{ + return gizmondo_quickload( image, file_type, quickload_size, 0x3000E000); // eboot + //return gizmondo_quickload( image, file_type, quickload_size, 0x30400000); // wince +} +#endif + +/******************************************************************************* + MACHINE HARDWARE +*******************************************************************************/ + +void gizmondo_state::machine_start() +{ + m_port[S3C2440_GPIO_PORT_B] = 0x055E; + m_port[S3C2440_GPIO_PORT_C] = 0x5F20; + m_port[S3C2440_GPIO_PORT_D] = 0x4F60; +} + +void gizmondo_state::machine_reset() +{ + m_maincpu->reset(); +} + +/******************************************************************************* + ADDRESS MAPS +*******************************************************************************/ + +static ADDRESS_MAP_START( gizmondo_map, AS_PROGRAM, 32, gizmondo_state ) + AM_RANGE(0x00000000, 0x000007ff) AM_ROM + AM_RANGE(0x00000800, 0x00000fff) AM_DEVREADWRITE16("diskonchip", diskonchip_g3_device, sec_1_r, sec_1_w, 0xffffffff) + AM_RANGE(0x00001000, 0x000017ff) AM_DEVREADWRITE16("diskonchip", diskonchip_g3_device, sec_2_r, sec_2_w, 0xffffffff) + AM_RANGE(0x00001800, 0x00001fff) AM_DEVREADWRITE16("diskonchip", diskonchip_g3_device, sec_3_r, sec_3_w, 0xffffffff) + AM_RANGE(0x30000000, 0x33ffffff) AM_RAM + AM_RANGE(0x34000000, 0x3413ffff) AM_DEVREADWRITE("gf4500", gf4500_device, read, write) +ADDRESS_MAP_END + +/******************************************************************************* + MACHINE DRIVERS +*******************************************************************************/ + +DRIVER_INIT_MEMBER(gizmondo_state,gizmondo) +{ + // do nothing +} + +static MACHINE_CONFIG_START( gizmondo, gizmondo_state ) + MCFG_CPU_ADD("maincpu", ARM9, 40000000) + MCFG_CPU_PROGRAM_MAP(gizmondo_map) + + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(320, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 240 - 1) + MCFG_SCREEN_UPDATE_DEVICE("gf4500", gf4500_device, screen_update) + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_GF4500_ADD("gf4500") + + MCFG_DEVICE_ADD("s3c2440", S3C2440, 12000000) + MCFG_S3C2440_PALETTE("palette") + MCFG_S3C2440_GPIO_PORT_R_CB(READ32(gizmondo_state, s3c2440_gpio_port_r)) + MCFG_S3C2440_GPIO_PORT_W_CB(WRITE32(gizmondo_state, s3c2440_gpio_port_w)) + + MCFG_DISKONCHIP_G3_ADD("diskonchip", 64) + +#if 0 + MCFG_QUICKLOAD_ADD("quickload", gizmondo_state, wince, "bin", 0) +#endif +MACHINE_CONFIG_END + +static INPUT_PORTS_START( gizmondo ) + PORT_START( "PORTF-01" ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("STOP") PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_PLAYER(1) + PORT_START( "PORTF-02" ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F2") PORT_PLAYER(1) PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("FORWARD") PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_PLAYER(1) + PORT_START( "PORTF-04" ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F3") PORT_PLAYER(1) PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("PLAY") PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_PLAYER(1) + PORT_START( "PORTF-08" ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F4") PORT_PLAYER(1) PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("REWIND") PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_PLAYER(1) + PORT_START( "PORTF-10" ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("L") PORT_PLAYER(1) PORT_CODE(KEYCODE_L) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("R") PORT_PLAYER(1) PORT_CODE(KEYCODE_R) + PORT_START( "PORTF" ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON11 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F5") PORT_PLAYER(1) PORT_CODE(KEYCODE_F5) + PORT_START( "PORTG" ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F1") PORT_PLAYER(1) PORT_CODE(KEYCODE_F1) +INPUT_PORTS_END + +/******************************************************************************* + GAME DRIVERS +*******************************************************************************/ + +ROM_START( gizmondo ) + ROM_REGION( 0x800, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "fboot", "fboot" ) + ROMX_LOAD( "fboot.bin", 0, 0x800, CRC(28887c29) SHA1(e625caaa63b9db74cb6d7499dce12ac758c5fe76), ROM_BIOS(1) ) +ROM_END + +CONS(2005, gizmondo, 0, 0, gizmondo, gizmondo, gizmondo_state, gizmondo, "Tiger Telematics", "Gizmondo", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/glasgow.c b/src/mame/drivers/glasgow.c new file mode 100644 index 00000000000..803fd591005 --- /dev/null +++ b/src/mame/drivers/glasgow.c @@ -0,0 +1,509 @@ +// license:??? +// copyright-holders:Dirk Verwiebe, Robbbert, Ralf Schaefer, Cowering +/*************************************************************************** +Mephisto Glasgow 3 S chess computer +Dirk V. +sp_rinter@gmx.de + +68000 CPU +64 KB ROM +16 KB RAM +4 Digit LC Display + +3* 74LS138 Decoder/Multiplexer +1*74LS74 Dual positive edge triggered D Flip Flop +1*74LS139 1of4 Demultiplexer +1*74LS05 HexInverter +1*NE555 R=100K C=10uF +2*74LS04 Hex Inverter +1*74LS164 8 Bit Shift register +1*74121 Monostable Multivibrator with Schmitt Trigger Inputs +1*74LS20 Dual 4 Input NAND GAte +1*74LS367 3 State Hex Buffers + + +Made playable by Robbbert in Nov 2009. + +How to play (quick guide) +1. You are the white player. +2. Click on the piece to move (LED starts flashing), then click where it goes +3. Computer plays black, it will work out its move and beep. +4. Read the move in the display, or look for the flashing LEDs. +5. Move the computer's piece in the same way you moved yours. +6. If a piece is being taken, firstly click on the piece then click the board + edge. This causes the piece to disappear. After that, move the piece that + took the other piece. +7. You'll need to read the official user manual for advanced features, or if + you get messages such as "Err1". + +Note about clickable artwork: You need to be running in windowed mode; + and you need to use newui. + +R.Schaefer Oct 2010 + +1. everything concerning chessboard moved to machine mboard +2. Border pieces added. This allow setting up and repair chess positons +3. chessboard added for Amsterdam, Dallas 16 Bit, Dallas 32 Bit, Roma 32 Bit +4. Save states added. + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "glasgow.lh" +#include "sound/beep.h" +#include "includes/mboard.h" + + +class glasgow_state : public mboard_state +{ +public: + glasgow_state(const machine_config &mconfig, device_type type, const char *tag) + : mboard_state(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_beep(*this, "beeper"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1") + { } + + required_device m_maincpu; + required_device m_beep; + DECLARE_WRITE16_MEMBER(glasgow_lcd_w); + DECLARE_WRITE16_MEMBER(glasgow_lcd_flag_w); + DECLARE_READ16_MEMBER(glasgow_keys_r); + DECLARE_WRITE16_MEMBER(glasgow_keys_w); + DECLARE_WRITE16_MEMBER(write_lcd); + DECLARE_WRITE16_MEMBER(write_lcd_flag); + DECLARE_WRITE16_MEMBER(write_irq_flag); + DECLARE_READ16_MEMBER(read_newkeys16); + DECLARE_WRITE32_MEMBER(write_lcd32); + DECLARE_WRITE32_MEMBER(write_lcd_flag32); + DECLARE_READ32_MEMBER(read_newkeys32); + DECLARE_WRITE32_MEMBER(write_beeper32); + UINT8 m_lcd_shift_counter; + UINT8 m_led7; + UINT8 m_irq_flag; + UINT16 m_beeper; + DECLARE_READ16_MEMBER(read_test); + DECLARE_READ16_MEMBER(read_board_amsterd); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_MACHINE_START(dallas32); + TIMER_DEVICE_CALLBACK_MEMBER(update_nmi); + TIMER_DEVICE_CALLBACK_MEMBER(update_nmi32); + required_ioport m_line0; + required_ioport m_line1; +}; + + + +WRITE16_MEMBER( glasgow_state::glasgow_lcd_w ) +{ + UINT8 lcd_data = data >> 8; + + if (m_led7 == 0) + output_set_digit_value(m_lcd_shift_counter, lcd_data); + + m_lcd_shift_counter--; + m_lcd_shift_counter &= 3; +} + +WRITE16_MEMBER( glasgow_state::glasgow_lcd_flag_w ) +{ + UINT16 lcd_flag = data & 0x8100; + + m_beep->set_state(BIT(lcd_flag, 8)); + + if (lcd_flag) + m_led7 = 255; + else + { + m_led7 = 0; + mboard_key_selector = 1; + } +} + +READ16_MEMBER( glasgow_state::glasgow_keys_r ) +{ + UINT8 data = 0xff; + + /* See if any keys pressed */ + data = 3; + + if (mboard_key_select == m_line0->read()) + data &= 1; + + if (mboard_key_select == m_line1->read()) + data &= 2; + + return data << 8; +} + +WRITE16_MEMBER( glasgow_state::glasgow_keys_w ) +{ + mboard_key_select = data >> 8; +} + +WRITE16_MEMBER( glasgow_state::write_lcd ) +{ + UINT8 lcd_data = data >> 8; + + output_set_digit_value(m_lcd_shift_counter, mboard_lcd_invert & 1 ? lcd_data^0xff : lcd_data); + m_lcd_shift_counter--; + m_lcd_shift_counter &= 3; + logerror("LCD Offset = %d Data low = %x \n", offset, lcd_data); +} + +WRITE16_MEMBER( glasgow_state::write_lcd_flag ) +{ +// UINT8 lcd_flag; + mboard_lcd_invert = 0; +// lcd_flag=data >> 8; + //m_beep->set_state((data >> 8) & 1 ? 1 : 0); + if ((data >> 8) == 0) + { + mboard_key_selector = 1; + m_led7 = 0; + } + else + m_led7 = 0xff; + + +// The key function in the rom expects after writing to +// the a value from the second key row; +// if (lcd_flag != 0) +// m_led7 = 255; +// else +// m_led7 = 0; +// + logerror("LCD Flag 16 = %x \n", data); +} + +WRITE16_MEMBER( glasgow_state::write_irq_flag ) +{ + m_beep->set_state(data & 0x100); + logerror("Write 0x800004 = %x \n", data); + m_irq_flag = 1; + m_beeper = data; +} + +READ16_MEMBER( glasgow_state::read_newkeys16 ) //Amsterdam, Roma +{ + UINT16 data; + + if (mboard_key_selector == 0) + data = m_line0->read(); + else + data = m_line1->read(); + + logerror("read Keyboard Offset = %x Data = %x Select = %x \n", offset, data, mboard_key_selector); + data <<= 8; + return data ; +} + + +#ifdef UNUSED_FUNCTION +READ16_MEMBER(glasgow_state::read_test) +{ + logerror("read test Offset = %x Data = %x\n ",offset,data); + return 0xffff; // Mephisto need it for working +} +#endif + +/* + + ***** 32 Bit Read and write Handler *********** + +*/ + +WRITE32_MEMBER( glasgow_state::write_lcd32 ) +{ + UINT8 lcd_data = data >> 8; + + output_set_digit_value(m_lcd_shift_counter, mboard_lcd_invert & 1 ? lcd_data^0xff : lcd_data); + m_lcd_shift_counter--; + m_lcd_shift_counter &= 3; + //logerror("LCD Offset = %d Data = %x \n ", offset, lcd_data); +} + +WRITE32_MEMBER( glasgow_state::write_lcd_flag32 ) +{ +// UINT8 lcd_flag = data >> 24; + + mboard_lcd_invert = 0; + + if ((data >> 24) == 0) + { + mboard_key_selector = 1; + m_led7 = 0; + } + else + m_led7 = 0xff; + + + //logerror("LCD Flag 32 = %x \n", data >> 24); + //m_beep->set_state((data >> 24) & 1 ? 1 : 0); + +// if (lcd_flag != 0) +// m_led7 = 255; +// else +// m_led7 = 0; +} + +READ32_MEMBER( glasgow_state::read_newkeys32 ) // Dallas 32, Roma 32 +{ + UINT32 data; + + if (mboard_key_selector == 0) + data = m_line0->read(); + else + data = m_line1->read(); + //if (mboard_key_selector == 1) data = m_line0->read(); else data = 0; + if(data) + logerror("read Keyboard Offset = %x Data = %x\n", offset, data); + data <<= 24; + return data ; +} + +#ifdef UNUSED_FUNCTION +READ16_MEMBER(glasgow_state::read_board_amsterd) +{ + logerror("read board amsterdam Offset = %x \n ", offset); + return 0xffff; +} +#endif + +WRITE32_MEMBER( glasgow_state::write_beeper32 ) +{ + m_beep->set_state(data & 0x01000000); + logerror("Write 0x8000004 = %x \n", data); + m_irq_flag = 1; + m_beeper = data; +} + +TIMER_DEVICE_CALLBACK_MEMBER(glasgow_state::update_nmi) +{ + m_maincpu->set_input_line(7, HOLD_LINE); +} + +TIMER_DEVICE_CALLBACK_MEMBER(glasgow_state::update_nmi32) +{ + m_maincpu->set_input_line(6, HOLD_LINE); +} + +void glasgow_state::machine_start() +{ + mboard_key_selector = 0; + m_irq_flag = 0; + m_lcd_shift_counter = 3; + m_beep->set_frequency(44); + + mboard_savestate_register(); +} + + +MACHINE_START_MEMBER(glasgow_state,dallas32) +{ + m_lcd_shift_counter = 3; + m_beep->set_frequency(44); + + mboard_savestate_register(); +} + + +void glasgow_state::machine_reset() +{ + m_lcd_shift_counter = 3; + + mboard_set_border_pieces(); + mboard_set_board(); +} + +static ADDRESS_MAP_START(glasgow_mem, AS_PROGRAM, 16, glasgow_state) + ADDRESS_MAP_GLOBAL_MASK(0x1FFFF) + AM_RANGE(0x00000000, 0x0000ffff) AM_ROM + AM_RANGE(0x00010000, 0x00010001) AM_WRITE(glasgow_lcd_w) + AM_RANGE(0x00010002, 0x00010003) AM_READWRITE(glasgow_keys_r,glasgow_keys_w) + AM_RANGE(0x00010004, 0x00010005) AM_WRITE(glasgow_lcd_flag_w) + AM_RANGE(0x00010006, 0x00010007) AM_READWRITE(mboard_read_board_16,mboard_write_LED_16) + AM_RANGE(0x00010008, 0x00010009) AM_WRITE(mboard_write_board_16) + AM_RANGE(0x0001c000, 0x0001ffff) AM_RAM // 16KB +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(amsterd_mem, AS_PROGRAM, 16, glasgow_state) + // ADDRESS_MAP_GLOBAL_MASK(0x7FFFF) + AM_RANGE(0x00000000, 0x0000ffff) AM_ROM + AM_RANGE(0x00800002, 0x00800003) AM_WRITE(write_lcd) + AM_RANGE(0x00800008, 0x00800009) AM_WRITE(write_lcd_flag) + AM_RANGE(0x00800004, 0x00800005) AM_WRITE(write_irq_flag) + AM_RANGE(0x00800010, 0x00800011) AM_WRITE(mboard_write_board_16) + AM_RANGE(0x00800020, 0x00800021) AM_READ(mboard_read_board_16) + AM_RANGE(0x00800040, 0x00800041) AM_READ(read_newkeys16) + AM_RANGE(0x00800088, 0x00800089) AM_WRITE(mboard_write_LED_16) + AM_RANGE(0x00ffc000, 0x00ffffff) AM_RAM // 16KB +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(dallas32_mem, AS_PROGRAM, 32, glasgow_state) + // ADDRESS_MAP_GLOBAL_MASK(0x1FFFF) + AM_RANGE(0x00000000, 0x0000ffff) AM_ROM + AM_RANGE(0x00010000, 0x0001ffff) AM_RAM // 64KB + AM_RANGE(0x00800000, 0x00800003) AM_WRITE(write_lcd32) + AM_RANGE(0x00800004, 0x00800007) AM_WRITE(write_beeper32) + AM_RANGE(0x00800008, 0x0080000B) AM_WRITE(write_lcd_flag32) + AM_RANGE(0x00800010, 0x00800013) AM_WRITE(mboard_write_board_32) + AM_RANGE(0x00800020, 0x00800023) AM_READ(mboard_read_board_32) + AM_RANGE(0x00800040, 0x00800043) AM_READ(read_newkeys32) + AM_RANGE(0x00800088, 0x0080008b) AM_WRITE(mboard_write_LED_32) +ADDRESS_MAP_END + +static INPUT_PORTS_START( new_keyboard ) //Amsterdam, Dallas 32, Roma, Roma 32 + PORT_START("LINE0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A 1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B 2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C 3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D 4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E 5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F 6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_9) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_0) + + PORT_START("LINE1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INF") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLR") PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G 7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H 8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) +INPUT_PORTS_END + +static INPUT_PORTS_START( old_keyboard ) //Glasgow,Dallas + PORT_START("LINE0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C 3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D 4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A 1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F 6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B 2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) + + PORT_START("LINE1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E 5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INF") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H 8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G 7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4) +INPUT_PORTS_END + + +INPUT_PORTS_EXTERN( chessboard); + +static INPUT_PORTS_START( oldkeys ) + PORT_INCLUDE( old_keyboard ) + PORT_INCLUDE( chessboard ) +INPUT_PORTS_END + +static INPUT_PORTS_START( newkeys ) + PORT_INCLUDE( new_keyboard ) + PORT_INCLUDE( chessboard ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( glasgow, glasgow_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 12000000) + MCFG_CPU_PROGRAM_MAP(glasgow_mem) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", glasgow_state, update_nmi, attotime::from_hz(50)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", glasgow_state, mboard_update_artwork, attotime::from_hz(100)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( amsterd, glasgow ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(amsterd_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dallas32, glasgow ) + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", M68020, 14000000) + MCFG_CPU_PROGRAM_MAP(dallas32_mem) + MCFG_MACHINE_START_OVERRIDE(glasgow_state, dallas32 ) + + MCFG_DEVICE_REMOVE("nmi_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", glasgow_state, update_nmi32, attotime::from_hz(50)) + +MACHINE_CONFIG_END + +/*************************************************************************** + ROM definitions +***************************************************************************/ + +ROM_START( glasgow ) + ROM_REGION( 0x10000, "maincpu", 0 ) + //ROM_LOAD("glasgow.rom", 0x000000, 0x10000, CRC(3e73eff3) ) + ROM_LOAD16_BYTE("me3_3_1u.410",0x00000, 0x04000,CRC(bc8053ba) SHA1(57ea2d5652bfdd77b17d52ab1914de974bd6be12)) + ROM_LOAD16_BYTE("me3_1_1l.410",0x00001, 0x04000,CRC(d5263c39) SHA1(1bef1cf3fd96221eb19faecb6ec921e26ac10ac4)) + ROM_LOAD16_BYTE("me3_4_2u.410",0x08000, 0x04000,CRC(8dba504a) SHA1(6bfab03af835cdb6c98773164d32c76520937efe)) + ROM_LOAD16_BYTE("me3_2_2l.410",0x08001, 0x04000,CRC(b3f27827) SHA1(864ba897d24024592d08c4ae090aa70a2cc5f213)) +ROM_END + +ROM_START( amsterd ) + ROM_REGION16_BE( 0x1000000, "maincpu", 0 ) + //ROM_LOAD16_BYTE("output.bin", 0x000000, 0x10000, CRC(3e73eff3) ) + ROM_LOAD16_BYTE("amsterda-u.bin",0x00000, 0x05a00,CRC(16cefe29) SHA1(9f8c2896e92fbfd47159a59cb5e87706092c86f4)) + ROM_LOAD16_BYTE("amsterda-l.bin",0x00001, 0x05a00,CRC(c859dfde) SHA1(b0bca6a8e698c322a8c597608db6735129d6cdf0)) +ROM_END + + +ROM_START( dallas ) + ROM_REGION16_BE( 0x1000000, "maincpu", 0 ) + ROM_LOAD16_BYTE("dal_g_pr.dat",0x00000, 0x04000,CRC(66deade9) SHA1(07ec6b923f2f053172737f1fc94aec84f3ea8da1)) + ROM_LOAD16_BYTE("dal_g_pl.dat",0x00001, 0x04000,CRC(c5b6171c) SHA1(663167a3839ed7508ecb44fd5a1b2d3d8e466763)) + ROM_LOAD16_BYTE("dal_g_br.dat",0x08000, 0x04000,CRC(e24d7ec7) SHA1(a936f6fcbe9bfa49bf455f2d8a8243d1395768c1)) + ROM_LOAD16_BYTE("dal_g_bl.dat",0x08001, 0x04000,CRC(144a15e2) SHA1(c4fcc23d55fa5262f5e01dbd000644a7feb78f32)) +ROM_END + +ROM_START( dallas16 ) + ROM_REGION16_BE( 0x1000000, "maincpu", 0 ) + ROM_LOAD16_BYTE("dallas-u.bin",0x00000, 0x06f00,CRC(8c1462b4) SHA1(8b5f5a774a835446d08dceacac42357b9e74cfe8)) + ROM_LOAD16_BYTE("dallas-l.bin",0x00001, 0x06f00,CRC(f0d5bc03) SHA1(4b1b9a71663d5321820b4cf7da205e5fe5d3d001)) +ROM_END + +ROM_START( roma ) + ROM_REGION16_BE( 0x1000000, "maincpu", 0 ) + ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd)) +ROM_END + +ROM_START( dallas32 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("dallas32.epr", 0x000000, 0x10000, CRC(83b9ff3f) SHA1(97bf4cb3c61f8ec328735b3c98281bba44b30a28) ) +ROM_END + +ROM_START( roma32 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd) ) +ROM_END + + +/*************************************************************************** + Game drivers +***************************************************************************/ + +/* YEAR, NAME, PARENT, COMPAT, MACHINE, INPUT, INIT, COMPANY, FULLNAME, FLAGS */ +CONS( 1984, glasgow, 0, 0, glasgow, oldkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto III S Glasgow", MACHINE_SUPPORTS_SAVE) +CONS( 1984, amsterd, 0, 0, amsterd, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Amsterdam", MACHINE_SUPPORTS_SAVE) +CONS( 1984, dallas, glasgow, 0, glasgow, oldkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas", MACHINE_SUPPORTS_SAVE) +CONS( 1984, roma, amsterd, 0, glasgow, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Roma", MACHINE_NOT_WORKING) +CONS( 1984, dallas32, amsterd, 0, dallas32, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas 32 Bit", MACHINE_SUPPORTS_SAVE) +CONS( 1984, roma32, amsterd, 0, dallas32, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Roma 32 Bit", MACHINE_SUPPORTS_SAVE) +CONS( 1984, dallas16, amsterd, 0, amsterd, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas 16 Bit", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/drivers/gmaster.c b/src/mame/drivers/gmaster.c new file mode 100644 index 00000000000..aba49b950b3 --- /dev/null +++ b/src/mame/drivers/gmaster.c @@ -0,0 +1,315 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + PeT mess@utanet.at march 2002 +******************************************************************************/ + +#include "emu.h" +#include "cpu/upd7810/upd7810.h" +#include "sound/speaker.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "rendlay.h" + + +class gmaster_state : public driver_device +{ +public: + gmaster_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_speaker(*this, "speaker") + , m_cart(*this, "cartslot") + , m_io_joy(*this, "JOY") + { } + + DECLARE_PALETTE_INIT(gmaster); + DECLARE_READ8_MEMBER(gmaster_io_r); + DECLARE_WRITE8_MEMBER(gmaster_io_w); + DECLARE_READ8_MEMBER(gmaster_port_r); + DECLARE_WRITE8_MEMBER(gmaster_port_w); + DECLARE_DRIVER_INIT(gmaster) { memset(&m_video, 0, sizeof(m_video)); memset(m_ram, 0, sizeof(m_ram)); } + UINT32 screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + virtual void machine_start(); + + struct + { + UINT8 data[8]; + int index; + int x, y; + bool mode; // true read does not increase address + bool delayed; + UINT8 pixels[8][64]; + } m_video; + + UINT8 m_ports[5]; + UINT8 m_ram[0x4000]; + required_device m_maincpu; + required_device m_speaker; + required_device m_cart; + required_ioport m_io_joy; +}; + + +READ8_MEMBER(gmaster_state::gmaster_io_r) +{ + UINT8 data = 0; + + if (m_ports[2] & 1) + { + data = m_ram[offset]; + logerror("%.4x external memory %.4x read %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); + } + else + { + switch (offset) + { + case 1: + data = m_video.pixels[m_video.y][m_video.x]; + logerror("%.4x lcd x:%.2x y:%.2x %.4x read %.2x\n", m_maincpu->pc(), m_video.x, m_video.y, 0x4000 + offset, data); + if (!(m_video.mode) && m_video.delayed) + { + m_video.x++; + } + m_video.delayed = true; + break; + default: + logerror("%.4x memory %.4x read %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); + break; + } + } + return data; +} + +#define BLITTER_Y ((m_ports[2]&4)|(m_video.data[0]&3)) + + +WRITE8_MEMBER(gmaster_state::gmaster_io_w) +{ + if (m_ports[2] & 1) + { + m_ram[offset] = data; + logerror("%.4x external memory %.4x written %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); + } + else + { + switch (offset) + { + case 0: + m_video.delayed = false; + logerror("%.4x lcd %.4x written %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); + // e2 af a4 a0 a9 falling block init for both halves + if ((data & 0xfc) == 0xb8) + { + m_video.index = 0; + m_video.data[m_video.index] = data; + m_video.y = BLITTER_Y; + } + else if ((data & 0xc0) == 0) + { + m_video.x = data; + } + else if ((data & 0xf0) == 0xe0) + { + m_video.mode = (data & 0xe) ? false : true; + } + m_video.data[m_video.index] = data; + m_video.index = (m_video.index + 1) & 7; + break; + case 1: + m_video.delayed = false; + if (m_video.x < ARRAY_LENGTH(m_video.pixels[0])) // continental galaxy flutlicht + { + m_video.pixels[m_video.y][m_video.x] = data; + } + logerror("%.4x lcd x:%.2x y:%.2x %.4x written %.2x\n", m_maincpu->pc(), m_video.x, m_video.y, 0x4000 + offset, data); + m_video.x++; +/* 02 b8 1a + 02 bb 1a + 02 bb 22 + 04 b8 12 + 04 b8 1a + 04 b8 22 + 04 b9 12 + 04 b9 1a + 04 b9 22 + 02 bb 12 + 4000 e0 + rr w rr w rr w rr w rr w rr w rr w rr w + 4000 ee +*/ + break; + default: + logerror("%.4x memory %.4x written %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); + break; + } + } +} + + +READ8_MEMBER(gmaster_state::gmaster_port_r) +{ +// UINT8 data = m_ports[offset]; + UINT8 data = 0xff; + switch (offset) + { + case UPD7810_PORTA: + data = m_io_joy->read(); + break; + default: + logerror("%.4x port %d read %.2x\n", m_maincpu->pc(), offset, data); + break; + } + return data; +} + + +WRITE8_MEMBER(gmaster_state::gmaster_port_w) +{ + m_ports[offset] = data; + logerror("%.4x port %d written %.2x\n", m_maincpu->pc(), offset, data); + switch (offset) + { + case UPD7810_PORTC: + m_video.y = BLITTER_Y; + m_speaker->level_w(BIT(data, 4)); + break; + } +} + + +static ADDRESS_MAP_START( gmaster_mem, AS_PROGRAM, 8, gmaster_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x4000, 0x7fff) AM_READWRITE(gmaster_io_r, gmaster_io_w) + //AM_RANGE(0x8000, 0xfeff) // mapped by the cartslot + AM_RANGE(0xff00, 0xffff) AM_RAM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(gmaster_io, AS_IO, 8, gmaster_state ) + AM_RANGE(UPD7810_PORTA, UPD7810_PORTF) AM_READWRITE(gmaster_port_r, gmaster_port_w ) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( gmaster ) + PORT_START("JOY") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start") +INPUT_PORTS_END + + +/* palette in red, green, blue tribles */ +static const unsigned char gmaster_palette[2][3] = +{ +#if 1 + { 130, 159, 166 }, + { 45,45,43 } +#else + { 255,255,255 }, + { 0, 0, 0 } +#endif +}; + + +PALETTE_INIT_MEMBER(gmaster_state, gmaster) +{ + int i; + + for (i = 0; i < 2; i++) + { + palette.set_pen_color(i, gmaster_palette[i][0], gmaster_palette[i][1], gmaster_palette[i][2]); + } +} + + +UINT32 gmaster_state::screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + for (y = 0; y < ARRAY_LENGTH(m_video.pixels); y++) + { + for (x = 0; x < ARRAY_LENGTH(m_video.pixels[0]); x++) + { + UINT8 d = m_video.pixels[y][x]; + UINT16 *line; + + line = &bitmap.pix16((y * 8), x); + line[0] = BIT(d, 0); + line = &bitmap.pix16((y * 8 + 1), x); + line[0] = BIT(d, 1); + line = &bitmap.pix16((y * 8 + 2), x); + line[0] = BIT(d, 2); + line = &bitmap.pix16((y * 8 + 3), x); + line[0] = BIT(d, 3); + line = &bitmap.pix16((y * 8 + 4), x); + line[0] = BIT(d, 4); + line = &bitmap.pix16((y * 8 + 5), x); + line[0] = BIT(d, 5); + line = &bitmap.pix16((y * 8 + 6), x); + line[0] = BIT(d, 6); + line = &bitmap.pix16((y * 8 + 7), x); + line[0] = BIT(d, 7); + } + } + return 0; +} + + +void gmaster_state::machine_start() +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xfeff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + save_item(NAME(m_video.data)); + save_item(NAME(m_video.index)); + save_item(NAME(m_video.x)); + save_item(NAME(m_video.y)); + save_item(NAME(m_video.mode)); + save_item(NAME(m_video.delayed)); + save_item(NAME(m_video.pixels)); + save_item(NAME(m_ports)); + save_item(NAME(m_ram)); +} + + +static MACHINE_CONFIG_START( gmaster, gmaster_state ) + MCFG_CPU_ADD("maincpu", UPD7810, XTAL_12MHz/2/*?*/) // upd78c11 in the unit + MCFG_CPU_PROGRAM_MAP(gmaster_mem) + MCFG_CPU_IO_MAP( gmaster_io) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(64, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 64-1-3, 0, 64-1) + MCFG_SCREEN_UPDATE_DRIVER(gmaster_state, screen_update_gmaster) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gmaster_palette)) + MCFG_PALETTE_INIT_OWNER(gmaster_state, gmaster) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(0, "mono", 0.50) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "gmaster_cart") + MCFG_GENERIC_MANDATORY + + MCFG_SOFTWARE_LIST_ADD("cart_list","gmaster") +MACHINE_CONFIG_END + + +ROM_START(gmaster) + ROM_REGION(0x10000,"maincpu", 0) + ROM_LOAD("d78c11agf_e19.u1", 0x0000, 0x1000, CRC(05cc45e5) SHA1(05d73638dea9657ccc2791c0202d9074a4782c1e) ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +CONS( 1990, gmaster, 0, 0, gmaster, gmaster, gmaster_state, gmaster, "Hartung", "Game Master", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/gp2x.c b/src/mame/drivers/gp2x.c new file mode 100644 index 00000000000..0865638044e --- /dev/null +++ b/src/mame/drivers/gp2x.c @@ -0,0 +1,393 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/************************************************************************** + * + * gp2x.c - Game Park Holdings GP2X + * Skeleton by R. Belmont + * + * CPU: MagicEyes MP2520F SoC + * MP2520F consists of: + * ARM920T CPU core + MMU + * ARM940T slave CPU w/o MMU + * LCD controller + * DMA controller + * Interrupt controller + * NAND flash interface + * MMC/SD Card interface + * USB controller + * and more. + * + **************************************************************************/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" + + +class gp2x_state : public driver_device +{ +public: + gp2x_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_maincpu_region(*this, "maincpu"), + m_ram(*this, "ram"){ } + + required_device m_maincpu; + required_region_ptr m_maincpu_region; + DECLARE_READ32_MEMBER(gp2x_lcdc_r); + DECLARE_WRITE32_MEMBER(gp2x_lcdc_w); + DECLARE_READ32_MEMBER(nand_r); + DECLARE_WRITE32_MEMBER(nand_w); + DECLARE_READ32_MEMBER(tx_status_r); + DECLARE_WRITE32_MEMBER(tx_xmit_w); + DECLARE_READ32_MEMBER(timer_r); + DECLARE_READ32_MEMBER(nand_ctrl_r); + DECLARE_WRITE32_MEMBER(nand_ctrl_w); + DECLARE_READ32_MEMBER(sdcard_r); + required_shared_ptr m_ram; + UINT16 m_vidregs[0x200/2]; + UINT32 m_nand_ptr; + UINT32 m_nand_cmd; + UINT32 m_nand_subword_stage; + UINT32 m_nand_stage; + UINT32 m_nand_ptr_temp; + UINT32 m_timer; + UINT32 screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +}; + + + +#if 0 +static const char *const gp2x_regnames[0x200] = +{ + "DPC Control", + "PAD Control", + "PAD Polarity Control 1", + "PAD Polarity Control 2", + "PAD Polarity Control 3", + "PAD Enable Control 1", + "PAD Enable Control 2", + "PAD Enable Control 3", + "", + "", + "", + "Active width", + "Active height", + "HSYNC width", + "HSYNC start", + "HSYNC end", + "VSYNC control", // 20 + "VSYNC end", + "", + "DE Control", + "S Control", + "FG Control", + "LP Control", + "CLKV Control", + "CLKV Control 2", // 30 + "POL Control", + "CIS Sync Control", + "", + "", + "Luma blank level", + "Chroma blank level", + "Luma pos sync", + "Luma neg sync", // 40 + "Chroma pos sync", + "Chroma neg sync", + "Interrupt control", + "Clock control", + "", + "", + "", + "", // 50 + "", + "", + "", + "", + "", + "", + "", + "", // 60 + "", + "", + "", + "", + "", + "", + "", + "", // 70 + "", + "", + "", + "", + "", + "", + "", + "Overlay control", // 80 + "Image effect", + "Image control", + "Scale factor A top", + "Scale factor A bottom", + "Scale factor A top 2 H", + "Scale factor A top 2 L", + "Scale factor A bottom 2 H", + "Scale factor A bottom 2 L", // 90 + "Width region A top", + "Width region A bottom", + "H Offset region A", + "H Offset region A 2", + "V Start region A", + "V End region A top", + "V End region A bottom", + "YUV Source region A L", // a0 + "YUV Source region A H", +}; +#endif +UINT32 gp2x_state::screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // display enabled? + if (m_vidregs[0] & 1) + { + // only support RGB still image layer for now + if (m_vidregs[0x80/2] & 4) + { + int x, y; + UINT16 *vram = (UINT16 *)&m_ram[0x2100000/4]; + +/* printf("RGB still image 1 enabled, bpp %d, size is %d %d %d %d\n", + (m_vidregs[(0xda/2)]>>9)&3, + m_vidregs[(0xe2/2)], + m_vidregs[(0xe4/2)], + m_vidregs[(0xe6/2)], + m_vidregs[(0xe8/2)]);*/ + + + for (y = 0; y < 240; y++) + { + UINT32 *scanline = &bitmap.pix32(y); + + for (x = 0; x < 320; x++) + { + UINT16 pixel = vram[(320*y)+x]; + + *scanline++ = rgb_t(0xff, (pixel>>11)<<3, ((pixel>>5)&0x3f)<<2, (pixel&0x1f)<<3); + } + } + } + } + + return 0; +} + +READ32_MEMBER( gp2x_state::gp2x_lcdc_r ) +{ + return m_vidregs[offset*2] | m_vidregs[(offset*2)+1]<<16; +} + +WRITE32_MEMBER( gp2x_state::gp2x_lcdc_w ) +{ + if (mem_mask == 0xffff) + { + m_vidregs[offset*2] = data; +// printf("%x to video reg %x (%s)\n", data, offset*2, gp2x_regnames[offset*2]); + } + else if (mem_mask == 0xffff0000) + { + m_vidregs[(offset*2)+1] = data>>16; +// printf("%x to video reg %x (%s)\n", data>>16, (offset*2)+1, gp2x_regnames[(offset*2)+1]); + } + else + { + logerror("GP2X LCDC: ERROR: write %x to vid reg @ %x mask %08x\n", data, offset, mem_mask); + } +} + +READ32_MEMBER( gp2x_state::nand_r ) +{ + UINT32 *ROM = m_maincpu_region; + UINT32 ret; + + if (offset == 0) + { + switch (m_nand_cmd) + { + case 0: + if (mem_mask == 0xffffffff) + { + return ROM[m_nand_ptr++]; + } + else if (mem_mask == 0x000000ff) // byte-wide reads? + { + switch (m_nand_subword_stage++) + { + case 0: + return ROM[m_nand_ptr]; + case 1: + return ROM[m_nand_ptr]>>8; + case 2: + return ROM[m_nand_ptr]>>16; + case 3: + ret = ROM[m_nand_ptr]>>24; + m_nand_subword_stage = 0; + m_nand_ptr++; + return ret; + default: + logerror("Bad nand_subword_stage = %d\n", m_nand_subword_stage); + break; + } + } + break; + + case 0x50: // read out-of-band data + return 0xff; + + case 0x90: // read ID + switch (m_nand_stage++) + { + case 0: + return 0xec; // Samsung + case 1: + return 0x76; // 64MB + } + break; + + default: + logerror("NAND: read unk command %x (PC %x)\n", m_nand_cmd, m_maincpu->pc()); + break; + } + } + +// printf("Read unknown nand offset %x\n", offset); + + return 0; +} + +WRITE32_MEMBER( gp2x_state::nand_w ) +{ + switch (offset) + { + case 4: // command + m_nand_cmd = data; +// printf("NAND: command %x (PC %x0)\n", data, m_maincpu->pc()); + m_nand_stage = 0; + m_nand_subword_stage = 0; + break; + + case 6: // address + if (m_nand_cmd == 0) + { + switch (m_nand_stage) + { + case 0: + m_nand_ptr_temp &= ~0xff; + m_nand_ptr_temp |= data; + break; + case 1: + m_nand_ptr_temp &= ~0xff00; + m_nand_ptr_temp |= data<<8; + break; + case 2: + m_nand_ptr_temp &= ~0xff0000; + m_nand_ptr_temp |= data<<16; + break; + case 3: + m_nand_ptr_temp &= ~0xff000000; + m_nand_ptr_temp |= data<<24; + +// printf("NAND: ptr now %x, /2 %x, replacing %x\n", m_nand_ptr_temp, m_nand_ptr_temp/2, m_nand_ptr); + m_nand_ptr = m_nand_ptr_temp/2; + break; + } + m_nand_stage++; + } + break; + + default: + logerror("nand_w: %x to unknown offset %x\n", data, offset); + break; + } +} + +READ32_MEMBER( gp2x_state::tx_status_r ) +{ + return 0x6; // tx ready, tx empty +} + +WRITE32_MEMBER( gp2x_state::tx_xmit_w ) +{ + printf("%c", data&0xff); +} + +READ32_MEMBER( gp2x_state::timer_r ) +{ + return m_timer++; +} + +READ32_MEMBER( gp2x_state::nand_ctrl_r ) +{ + return 0x8000<<16; // timed out +} + +WRITE32_MEMBER( gp2x_state::nand_ctrl_w ) +{ +// printf("%08x to nand_ctrl_w\n", data); +} + +READ32_MEMBER( gp2x_state::sdcard_r ) +{ + return 0xffff<<16; // at 3e146b0 - indicate timeout & CRC error +} + +static ADDRESS_MAP_START( gp2x_map, AS_PROGRAM, 32, gp2x_state ) + AM_RANGE(0x00000000, 0x00007fff) AM_ROM + AM_RANGE(0x01000000, 0x04ffffff) AM_RAM AM_SHARE("ram") // 64 MB of RAM + AM_RANGE(0x9c000000, 0x9c00001f) AM_READWRITE(nand_r, nand_w) + AM_RANGE(0xc0000a00, 0xc0000a03) AM_READ(timer_r) + AM_RANGE(0xc0001208, 0xc000120b) AM_READ(tx_status_r) + AM_RANGE(0xc0001210, 0xc0001213) AM_WRITE(tx_xmit_w) + AM_RANGE(0xc0001508, 0xc000150b) AM_READ(sdcard_r) + AM_RANGE(0xc0002800, 0xc00029ff) AM_READWRITE(gp2x_lcdc_r, gp2x_lcdc_w) + AM_RANGE(0xc0003a38, 0xc0003a3b) AM_READWRITE(nand_ctrl_r, nand_ctrl_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( gp2x ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( gp2x, gp2x_state ) + MCFG_CPU_ADD("maincpu", ARM9, 80000000) + MCFG_CPU_PROGRAM_MAP(gp2x_map) + + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(320, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) + MCFG_SCREEN_UPDATE_DRIVER(gp2x_state, screen_update_gp2x) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") +MACHINE_CONFIG_END + +ROM_START(gp2x) + ROM_REGION( 0x600000, "maincpu", 0 ) // contents of NAND flash + ROM_SYSTEM_BIOS(0, "v2", "version 2.0") + ROMX_LOAD( "gp2xboot.img", 0x000000, 0x05b264, CRC(9d82937e) SHA1(9655f04c11f78526b3b8a4613897070df3119ead), ROM_BIOS(1)) + ROMX_LOAD( "gp2xkernel.img", 0x080000, 0x09a899, CRC(e272eac9) SHA1(9d814ad6c27d22812ba3f101a7358698d1b035eb), ROM_BIOS(1)) + ROMX_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "v3", "version 3.0") + ROMX_LOAD( "gp2xboot.v3", 0x000000, 0x05b264, CRC(ab1fc556) SHA1(2ce66fec325b6e8e29f540322aefb435d8e3baf0), ROM_BIOS(2)) + ROMX_LOAD( "gp2xkernel.v3", 0x080000, 0x09f047, CRC(6f8922ae) SHA1(0f44204757f9251c7d68560ff31a1ce72f16698e), ROM_BIOS(2)) + ROMX_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7), ROM_BIOS(2)) + ROMX_LOAD( "gp2xyaffs.v3", 0x300000, 0x2ec4d0, CRC(f81a4a57) SHA1(73bb84798ad3a4e281612a47abb2da4772cbe6cd), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(2, "v4", "version 4.0") + ROMX_LOAD( "gp2xboot.v4", 0x000000, 0x05b264, CRC(160af379) SHA1(0940fc975960fa52f32a9258a9480cc5cb1140e2), ROM_BIOS(3)) + ROMX_LOAD( "gp2xkernel.v4", 0x080000, 0x0a43a8, CRC(77b1cf9c) SHA1(7e759e4581399bfbee982e1b6c3b54a10b0e9c3d), ROM_BIOS(3)) + ROMX_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7), ROM_BIOS(3)) + ROMX_LOAD( "gp2xyaffs.v4", 0x300000, 0x2dfed0, CRC(e77efc53) SHA1(21477ff77aacb84005bc465a03066d71031a6098), ROM_BIOS(3)) +ROM_END + +CONS(2005, gp2x, 0, 0, gp2x, gp2x, driver_device, 0, "Game Park Holdings", "GP2X", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mame/drivers/gp32.c b/src/mame/drivers/gp32.c new file mode 100644 index 00000000000..26dc298a2ff --- /dev/null +++ b/src/mame/drivers/gp32.c @@ -0,0 +1,1726 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/************************************************************************** + * + * gp32.c - Game Park GP32 + * Driver by Tim Schuerewegen + * + * CPU: Samsung S3C2400X01 SoC + * S3C2400X01 consists of: + * ARM920T CPU core + MMU + * LCD controller + * DMA controller + * Interrupt controller + * USB controller + * and more. + * + **************************************************************************/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "cpu/arm7/arm7core.h" +#include "includes/gp32.h" +#include "rendlay.h" + +#define VERBOSE_LEVEL ( 0 ) + +INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ...) +{ + if (VERBOSE_LEVEL >= n_level) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt); + vsprintf( buf, s_fmt, v); + va_end( v); + logerror( "%s: %s", machine.describe_context( ), buf); + } +} + +#define CLOCK_MULTIPLIER 1 + +#define MPLLCON 1 +#define UPLLCON 2 + +#define BIT(x,n) (((x)>>(n))&1) +#define BITS(x,m,n) (((x)>>(n))&((1<<((m)-(n)+1))-1)) + + +// LCD CONTROLLER + + +#define BPPMODE_TFT_01 0x08 +#define BPPMODE_TFT_02 0x09 +#define BPPMODE_TFT_04 0x0A +#define BPPMODE_TFT_08 0x0B +#define BPPMODE_TFT_16 0x0C + +inline rgb_t gp32_state::s3c240x_get_color_5551( UINT16 data) +{ + UINT8 r, g, b, i; + r = BITS( data, 15, 11) << 3; + g = BITS( data, 10, 6) << 3; + b = BITS( data, 5, 1) << 3; + i = BIT( data, 1) << 2; + return rgb_t( r | i, g | i, b | i); +} + +void gp32_state::s3c240x_lcd_dma_reload() +{ + m_s3c240x_lcd.vramaddr_cur = m_s3c240x_lcd_regs[5] << 1; + m_s3c240x_lcd.vramaddr_max = ((m_s3c240x_lcd_regs[5] & 0xFFE00000) | m_s3c240x_lcd_regs[6]) << 1; + m_s3c240x_lcd.offsize = BITS( m_s3c240x_lcd_regs[7], 21, 11); + m_s3c240x_lcd.pagewidth_cur = 0; + m_s3c240x_lcd.pagewidth_max = BITS( m_s3c240x_lcd_regs[7], 10, 0); + verboselog( machine(), 3, "LCD - vramaddr %08X %08X offsize %08X pagewidth %08X\n", m_s3c240x_lcd.vramaddr_cur, m_s3c240x_lcd.vramaddr_max, m_s3c240x_lcd.offsize, m_s3c240x_lcd.pagewidth_max); +} + +void gp32_state::s3c240x_lcd_dma_init() +{ + s3c240x_lcd_dma_reload(); + m_s3c240x_lcd.bppmode = BITS( m_s3c240x_lcd_regs[0], 4, 1); + m_s3c240x_lcd.bswp = BIT( m_s3c240x_lcd_regs[4], 1); + m_s3c240x_lcd.hwswp = BIT( m_s3c240x_lcd_regs[4], 0); + m_s3c240x_lcd.lineval = BITS( m_s3c240x_lcd_regs[1], 23, 14); + m_s3c240x_lcd.hozval = BITS( m_s3c240x_lcd_regs[2], 18, 8); +} + +UINT32 gp32_state::s3c240x_lcd_dma_read( ) +{ + UINT8 *vram, data[4]; + int i; + for (i = 0; i < 2; i++) + { + vram = (UINT8 *)m_s3c240x_ram.target() + m_s3c240x_lcd.vramaddr_cur - 0x0C000000; + data[i*2+0] = vram[0]; + data[i*2+1] = vram[1]; + m_s3c240x_lcd.vramaddr_cur += 2; + m_s3c240x_lcd.pagewidth_cur++; + if (m_s3c240x_lcd.pagewidth_cur >= m_s3c240x_lcd.pagewidth_max) + { + m_s3c240x_lcd.vramaddr_cur += m_s3c240x_lcd.offsize << 1; + m_s3c240x_lcd.pagewidth_cur = 0; + } + } + if (m_s3c240x_lcd.hwswp == 0) + { + if (m_s3c240x_lcd.bswp == 0) + { + return (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | (data[0] << 0); + } + else + { + return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3] << 0); + } + } + else + { + if (m_s3c240x_lcd.bswp == 0) + { + return (data[1] << 24) | (data[0] << 16) | (data[3] << 8) | (data[2] << 0); + } + else + { + return (data[2] << 24) | (data[3] << 16) | (data[0] << 8) | (data[1] << 0); + } + } +} + +void gp32_state::s3c240x_lcd_render_01( ) +{ + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + int i, j; + for (i = 0; i < 4; i++) + { + UINT32 data = s3c240x_lcd_dma_read(); + for (j = 0; j < 32; j++) + { + *scanline++ = m_palette->pen_color((data >> 31) & 0x01); + data = data << 1; + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 4)) + { + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + } + } + } +} + +void gp32_state::s3c240x_lcd_render_02( ) +{ + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + int i, j; + for (i = 0; i < 4; i++) + { + UINT32 data = s3c240x_lcd_dma_read(); + for (j = 0; j < 16; j++) + { + *scanline++ = m_palette->pen_color((data >> 30) & 0x03); + data = data << 2; + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 3)) + { + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + } + } + } +} + +void gp32_state::s3c240x_lcd_render_04( ) +{ + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + int i, j; + for (i = 0; i < 4; i++) + { + UINT32 data = s3c240x_lcd_dma_read( ); + for (j = 0; j < 8; j++) + { + *scanline++ = m_palette->pen_color((data >> 28) & 0x0F); + data = data << 4; + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 2)) + { + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + } + } + } +} + +void gp32_state::s3c240x_lcd_render_08( ) +{ + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + int i, j; + for (i = 0; i < 4; i++) + { + UINT32 data = s3c240x_lcd_dma_read(); + for (j = 0; j < 4; j++) + { + *scanline++ = m_palette->pen_color((data >> 24) & 0xFF); + data = data << 8; + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 1)) + { + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + } + } + } +} + +void gp32_state::s3c240x_lcd_render_16( ) +{ + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + int i, j; + for (i = 0; i < 4; i++) + { + UINT32 data = s3c240x_lcd_dma_read(); + for (j = 0; j < 2; j++) + { + *scanline++ = s3c240x_get_color_5551( (data >> 16) & 0xFFFF); + data = data << 16; + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 0)) + { + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + } + } + } +} + +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_lcd_timer_exp) +{ + screen_device *screen = machine().first_screen(); + verboselog( machine(), 2, "LCD timer callback\n"); + m_s3c240x_lcd.vpos = screen->vpos(); + m_s3c240x_lcd.hpos = screen->hpos(); + verboselog( machine(), 3, "LCD - vpos %d hpos %d\n", m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + if (m_s3c240x_lcd.vramaddr_cur >= m_s3c240x_lcd.vramaddr_max) + { + s3c240x_lcd_dma_reload(); + } + verboselog( machine(), 3, "LCD - vramaddr %08X\n", m_s3c240x_lcd.vramaddr_cur); + while (m_s3c240x_lcd.vramaddr_cur < m_s3c240x_lcd.vramaddr_max) + { + switch (m_s3c240x_lcd.bppmode) + { + case BPPMODE_TFT_01 : s3c240x_lcd_render_01(); break; + case BPPMODE_TFT_02 : s3c240x_lcd_render_02(); break; + case BPPMODE_TFT_04 : s3c240x_lcd_render_04(); break; + case BPPMODE_TFT_08 : s3c240x_lcd_render_08(); break; + case BPPMODE_TFT_16 : s3c240x_lcd_render_16(); break; + default : verboselog( machine(), 0, "s3c240x_lcd_timer_exp: bppmode %d not supported\n", m_s3c240x_lcd.bppmode); break; + } + if ((m_s3c240x_lcd.vpos == 0) && (m_s3c240x_lcd.hpos == 0)) break; + } + m_s3c240x_lcd_timer->adjust( screen->time_until_pos(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos)); +} + +void gp32_state::video_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); +} + +UINT32 gp32_state::screen_update_gp32(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + s3c240x_lcd_dma_init(); + return 0; +} + +READ32_MEMBER(gp32_state::s3c240x_lcd_r) +{ + UINT32 data = m_s3c240x_lcd_regs[offset]; + switch (offset) + { + // LCDCON1 + case 0x00 / 4 : + { + // make sure line counter is going + UINT32 lineval = BITS( m_s3c240x_lcd_regs[1], 23, 14); + data = (data & ~0xFFFC0000) | ((lineval - machine().first_screen()->vpos()) << 18); + } + break; + } + verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +void gp32_state::s3c240x_lcd_configure() +{ + screen_device *screen = machine().first_screen(); + UINT32 vspw, vbpd, lineval, vfpd, hspw, hbpd, hfpd, hozval, clkval, hclk; + double framerate, vclk; + rectangle visarea; + vspw = BITS( m_s3c240x_lcd_regs[1], 5, 0); + vbpd = BITS( m_s3c240x_lcd_regs[1], 31, 24); + lineval = BITS( m_s3c240x_lcd_regs[1], 23, 14); + vfpd = BITS( m_s3c240x_lcd_regs[1], 13, 6); + hspw = BITS( m_s3c240x_lcd_regs[3], 7, 0); + hbpd = BITS( m_s3c240x_lcd_regs[2], 25, 19); + hfpd = BITS( m_s3c240x_lcd_regs[2], 7, 0); + hozval = BITS( m_s3c240x_lcd_regs[2], 18, 8); + clkval = BITS( m_s3c240x_lcd_regs[0], 17, 8); + hclk = s3c240x_get_hclk(MPLLCON); + verboselog( machine(), 3, "LCD - vspw %d vbpd %d lineval %d vfpd %d hspw %d hbpd %d hfpd %d hozval %d clkval %d hclk %d\n", vspw, vbpd, lineval, vfpd, hspw, hbpd, hfpd, hozval, clkval, hclk); + vclk = (double)(hclk / ((clkval + 1) * 2)); + verboselog( machine(), 3, "LCD - vclk %f\n", vclk); + framerate = vclk / (((vspw + 1) + (vbpd + 1) + (lineval + 1) + (vfpd + 1)) * ((hspw + 1) + (hbpd + 1) + (hfpd + 1) + (hozval + 1))); + verboselog( machine(), 3, "LCD - framerate %f\n", framerate); + visarea.set(0, hozval, 0, lineval); + verboselog( machine(), 3, "LCD - visarea min_x %d min_y %d max_x %d max_y %d\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); + screen->configure(hozval + 1, lineval + 1, visarea, HZ_TO_ATTOSECONDS( framerate)); +} + +void gp32_state::s3c240x_lcd_start() +{ + screen_device *screen = machine().first_screen(); + verboselog( machine(), 1, "LCD start\n"); + s3c240x_lcd_configure(); + s3c240x_lcd_dma_init(); + m_s3c240x_lcd_timer->adjust( screen->time_until_pos(0, 0)); +} + +void gp32_state::s3c240x_lcd_stop() +{ + verboselog( machine(), 1, "LCD stop\n"); + m_s3c240x_lcd_timer->adjust( attotime::never); +} + +void gp32_state::s3c240x_lcd_recalc() +{ + if (m_s3c240x_lcd_regs[0] & 1) + { + s3c240x_lcd_start(); + } + else + { + s3c240x_lcd_stop(); + } +} + +WRITE32_MEMBER(gp32_state::s3c240x_lcd_w) +{ + UINT32 old_value = m_s3c240x_lcd_regs[offset]; + verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_lcd_regs[offset]); + switch (offset) + { + // LCDCON1 + case 0x00 / 4 : + { + if ((old_value & 1) != (data & 1)) + { + s3c240x_lcd_recalc(); + } + } + break; + } +} + +// LCD PALETTE + + +READ32_MEMBER(gp32_state::s3c240x_lcd_palette_r) +{ + UINT32 data = m_s3c240x_lcd_palette[offset]; + verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_lcd_palette_w) +{ + verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_lcd_palette[offset]); + if (mem_mask != 0xffffffff) + { + verboselog( machine(), 0, "s3c240x_lcd_palette_w: unknown mask %08x\n", mem_mask); + } + m_palette->set_pen_color( offset, s3c240x_get_color_5551( data & 0xFFFF)); +} + +// CLOCK & POWER MANAGEMENT + + +UINT32 gp32_state::s3c240x_get_fclk(int reg) +{ + UINT32 data, mdiv, pdiv, sdiv; + data = m_s3c240x_clkpow_regs[reg]; // MPLLCON or UPLLCON + mdiv = BITS( data, 19, 12); + pdiv = BITS( data, 9, 4); + sdiv = BITS( data, 1, 0); + return (UINT32)((double)((mdiv + 8) * 12000000) / (double)((pdiv + 2) * (1 << sdiv))); +} + +UINT32 gp32_state::s3c240x_get_hclk(int reg) +{ + switch (m_s3c240x_clkpow_regs[5] & 0x3) // CLKDIVN + { + case 0 : return s3c240x_get_fclk(reg) / 1; + case 1 : return s3c240x_get_fclk(reg) / 1; + case 2 : return s3c240x_get_fclk(reg) / 2; + case 3 : return s3c240x_get_fclk(reg) / 2; + } + return 0; +} + +UINT32 gp32_state::s3c240x_get_pclk(int reg) +{ + switch (m_s3c240x_clkpow_regs[5] & 0x3) // CLKDIVN + { + case 0 : return s3c240x_get_fclk(reg) / 1; + case 1 : return s3c240x_get_fclk(reg) / 2; + case 2 : return s3c240x_get_fclk(reg) / 2; + case 3 : return s3c240x_get_fclk(reg) / 4; + } + return 0; +} + +READ32_MEMBER(gp32_state::s3c240x_clkpow_r) +{ + UINT32 data = m_s3c240x_clkpow_regs[offset]; + verboselog( machine(), 9, "(CLKPOW) %08X -> %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_clkpow_w) +{ + verboselog( machine(), 9, "(CLKPOW) %08X <- %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_clkpow_regs[offset]); + switch (offset) + { + // MPLLCON + case 0x04 / 4 : + { + m_maincpu->set_unscaled_clock(s3c240x_get_fclk(MPLLCON) * CLOCK_MULTIPLIER); + } + break; + } +} + +// INTERRUPT CONTROLLER + + +void gp32_state::s3c240x_check_pending_irq() +{ + if (m_s3c240x_irq_regs[0] != 0) + { + UINT32 int_type = 0, temp; + temp = m_s3c240x_irq_regs[0]; + while (!(temp & 1)) + { + int_type++; + temp = temp >> 1; + } + m_s3c240x_irq_regs[4] |= (1 << int_type); // INTPND + m_s3c240x_irq_regs[5] = int_type; // INTOFFSET + m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + } + else + { + m_maincpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); + } +} + +void gp32_state::s3c240x_request_irq(UINT32 int_type) +{ + verboselog( machine(), 5, "request irq %d\n", int_type); + if (m_s3c240x_irq_regs[0] == 0) + { + m_s3c240x_irq_regs[0] |= (1 << int_type); // SRCPND + m_s3c240x_irq_regs[4] |= (1 << int_type); // INTPND + m_s3c240x_irq_regs[5] = int_type; // INTOFFSET + m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + } + else + { + m_s3c240x_irq_regs[0] |= (1 << int_type); // SRCPND + s3c240x_check_pending_irq(); + } +} + + +READ32_MEMBER(gp32_state::s3c240x_irq_r) +{ + UINT32 data = m_s3c240x_irq_regs[offset]; + verboselog( machine(), 9, "(IRQ) %08X -> %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_irq_w) +{ + UINT32 old_value = m_s3c240x_irq_regs[offset]; + verboselog( machine(), 9, "(IRQ) %08X <- %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_irq_regs[offset]); + switch (offset) + { + // SRCPND + case 0x00 / 4 : + { + m_s3c240x_irq_regs[0] = (old_value & ~data); // clear only the bit positions of SRCPND corresponding to those set to one in the data + s3c240x_check_pending_irq(); + } + break; + // INTPND + case 0x10 / 4 : + { + m_s3c240x_irq_regs[4] = (old_value & ~data); // clear only the bit positions of INTPND corresponding to those set to one in the data + } + break; + } +} + +// PWM TIMER + +#if 0 +static const char *const timer_reg_names[] = +{ + "Timer config 0", + "Timer config 1", + "Timer control", + "Timer count buffer 0", + "Timer compare buffer 0", + "Timer count observation 0", + "Timer count buffer 1", + "Timer compare buffer 1", + "Timer count observation 1", + "Timer count buffer 2", + "Timer compare buffer 2", + "Timer count observation 2", + "Timer count buffer 3", + "Timer compare buffer 3", + "Timer count observation 3", + "Timer count buffer 4", + "Timer compare buffer 4", + "Timer count observation 4", +}; +#endif + + +READ32_MEMBER(gp32_state::s3c240x_pwm_r) +{ + UINT32 data = m_s3c240x_pwm_regs[offset]; + verboselog( machine(), 9, "(PWM) %08X -> %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +void gp32_state::s3c240x_pwm_start(int timer) +{ + static const int mux_table[] = { 2, 4, 8, 16 }; + static const int prescaler_shift[] = { 0, 0, 8, 8, 8 }; + static const int mux_shift[] = { 0, 4, 8, 12, 16 }; + static const int tcon_shift[] = { 0, 8, 12, 16, 20 }; + const UINT32 *regs = &m_s3c240x_pwm_regs[3+timer*3]; + UINT32 prescaler, mux, cnt, cmp, auto_reload; + double freq, hz; + verboselog( machine(), 1, "PWM %d start\n", timer); + prescaler = (m_s3c240x_pwm_regs[0] >> prescaler_shift[timer]) & 0xFF; + mux = (m_s3c240x_pwm_regs[1] >> mux_shift[timer]) & 0x0F; + freq = s3c240x_get_pclk(MPLLCON) / (prescaler + 1) / mux_table[mux]; + cnt = BITS( regs[0], 15, 0); + if (timer != 4) + { + cmp = BITS( regs[1], 15, 0); + auto_reload = BIT( m_s3c240x_pwm_regs[2], tcon_shift[timer] + 3); + } + else + { + cmp = 0; + auto_reload = BIT( m_s3c240x_pwm_regs[2], tcon_shift[timer] + 2); + } + hz = freq / (cnt - cmp + 1); + verboselog( machine(), 5, "PWM %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%f cnt=%d cmp=%d auto_reload=%d hz=%f\n", timer, s3c240x_get_fclk(MPLLCON), s3c240x_get_hclk(MPLLCON), s3c240x_get_pclk(MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, auto_reload, hz); + if (auto_reload) + { + m_s3c240x_pwm_timer[timer]->adjust( attotime::from_hz( hz), timer, attotime::from_hz( hz)); + } + else + { + m_s3c240x_pwm_timer[timer]->adjust( attotime::from_hz( hz), timer); + } +} + +void gp32_state::s3c240x_pwm_stop(int timer) +{ + verboselog( machine(), 1, "PWM %d stop\n", timer); + m_s3c240x_pwm_timer[timer]->adjust( attotime::never); +} + +void gp32_state::s3c240x_pwm_recalc(int timer) +{ + static const int tcon_shift[] = { 0, 8, 12, 16, 20 }; + if (m_s3c240x_pwm_regs[2] & (1 << tcon_shift[timer])) + { + s3c240x_pwm_start(timer); + } + else + { + s3c240x_pwm_stop(timer); + } +} + +WRITE32_MEMBER(gp32_state::s3c240x_pwm_w) +{ + UINT32 old_value = m_s3c240x_pwm_regs[offset]; + verboselog( machine(), 9, "(PWM) %08X <- %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_pwm_regs[offset]); + switch (offset) + { + // TCON + case 0x08 / 4 : + { + if ((data & 1) != (old_value & 1)) + { + s3c240x_pwm_recalc(0); + } + if ((data & 0x100) != (old_value & 0x100)) + { + s3c240x_pwm_recalc(1); + } + if ((data & 0x1000) != (old_value & 0x1000)) + { + s3c240x_pwm_recalc(2); + } + if ((data & 0x10000) != (old_value & 0x10000)) + { + s3c240x_pwm_recalc(3); + } + if ((data & 0x100000) != (old_value & 0x100000)) + { + s3c240x_pwm_recalc(4); + } + } + } +} + +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_pwm_timer_exp) +{ + int ch = param; + static const int ch_int[] = { INT_TIMER0, INT_TIMER1, INT_TIMER2, INT_TIMER3, INT_TIMER4 }; + verboselog( machine(), 2, "PWM %d timer callback\n", ch); + if (BITS( m_s3c240x_pwm_regs[1], 23, 20) == (ch + 1)) + { + s3c240x_dma_request_pwm(); + } + else + { + s3c240x_request_irq(ch_int[ch]); + } +} + +// DMA + + +void gp32_state::s3c240x_dma_reload(int dma) +{ + UINT32 *regs = &m_s3c240x_dma_regs[dma<<3]; + regs[3] = (regs[3] & ~0x000FFFFF) | BITS( regs[2], 19, 0); + regs[4] = (regs[4] & ~0x1FFFFFFF) | BITS( regs[0], 28, 0); + regs[5] = (regs[5] & ~0x1FFFFFFF) | BITS( regs[1], 28, 0); +} + +void gp32_state::s3c240x_dma_trigger(int dma) +{ + UINT32 *regs = &m_s3c240x_dma_regs[dma<<3]; + UINT32 curr_tc, curr_src, curr_dst; + address_space &space = m_maincpu->space( AS_PROGRAM); + int dsz, inc_src, inc_dst, servmode; + static const UINT32 ch_int[] = { INT_DMA0, INT_DMA1, INT_DMA2, INT_DMA3 }; + verboselog( machine(), 5, "DMA %d trigger\n", dma); + curr_tc = BITS( regs[3], 19, 0); + curr_src = BITS( regs[4], 28, 0); + curr_dst = BITS( regs[5], 28, 0); + dsz = BITS( regs[2], 21, 20); + servmode = BIT( regs[2], 26); + inc_src = BIT( regs[0], 29); + inc_dst = BIT( regs[1], 29); + verboselog( machine(), 5, "DMA %d - curr_src %08X curr_dst %08X curr_tc %d dsz %d\n", dma, curr_src, curr_dst, curr_tc, dsz); + while (curr_tc > 0) + { + curr_tc--; + switch (dsz) + { + case 0 : space.write_byte( curr_dst, space.read_byte( curr_src)); break; + case 1 : space.write_word( curr_dst, space.read_word( curr_src)); break; + case 2 : space.write_dword( curr_dst, space.read_dword( curr_src)); break; + } + if (inc_src == 0) curr_src += (1 << dsz); + if (inc_dst == 0) curr_dst += (1 << dsz); + if (servmode == 0) break; + } + // update curr_src + regs[4] = (regs[4] & ~0x1FFFFFFF) | curr_src; + // update curr_dst + regs[5] = (regs[5] & ~0x1FFFFFFF) | curr_dst; + // update curr_tc + regs[3] = (regs[3] & ~0x000FFFFF) | curr_tc; + // ... + if (curr_tc == 0) + { + int _int, reload; + reload = BIT( regs[2], 22); + if (!reload) + { + s3c240x_dma_reload(dma); + } + else + { + regs[6] &= ~(1 << 1); // clear on/off + } + _int = BIT( regs[2], 28); + if (_int) + { + s3c240x_request_irq(ch_int[dma]); + } + } +} + +void gp32_state::s3c240x_dma_request_iis() +{ + UINT32 *regs = &m_s3c240x_dma_regs[2<<3]; + verboselog( machine(), 5, "s3c240x_dma_request_iis\n"); + if ((BIT( regs[6], 1) != 0) && (BIT( regs[2], 23) != 0) && (BITS( regs[2], 25, 24) == 0)) + { + s3c240x_dma_trigger(2); + } +} + +void gp32_state::s3c240x_dma_request_pwm() +{ + int i; + verboselog( machine(), 5, "s3c240x_dma_request_pwm\n"); + for (i = 0; i < 4; i++) + { + if (i != 1) + { + UINT32 *regs = &m_s3c240x_dma_regs[i<<3]; + if ((BIT( regs[6], 1) != 0) && (BIT( regs[2], 23) != 0) && (BITS( regs[2], 25, 24) == 3)) + { + s3c240x_dma_trigger(i); + } + } + } +} + +void gp32_state::s3c240x_dma_start(int dma) +{ + UINT32 addr_src, addr_dst, tc; + UINT32 *regs = &m_s3c240x_dma_regs[dma<<3]; + UINT32 dsz, tsz, reload; + int inc_src, inc_dst, _int, servmode, swhwsel, hwsrcsel; + verboselog( machine(), 1, "DMA %d start\n", dma); + addr_src = BITS( regs[0], 28, 0); + addr_dst = BITS( regs[1], 28, 0); + tc = BITS( regs[2], 19, 0); + inc_src = BIT( regs[0], 29); + inc_dst = BIT( regs[1], 29); + tsz = BIT( regs[2], 27); + _int = BIT( regs[2], 28); + servmode = BIT( regs[2], 26); + hwsrcsel = BITS( regs[2], 25, 24); + swhwsel = BIT( regs[2], 23); + reload = BIT( regs[2], 22); + dsz = BITS( regs[2], 21, 20); + verboselog( machine(), 5, "DMA %d - addr_src %08X inc_src %d addr_dst %08X inc_dst %d int %d tsz %d servmode %d hwsrcsel %d swhwsel %d reload %d dsz %d tc %d\n", dma, addr_src, inc_src, addr_dst, inc_dst, _int, tsz, servmode, hwsrcsel, swhwsel, reload, dsz, tc); + verboselog( machine(), 5, "DMA %d - copy %08X bytes from %08X (%s) to %08X (%s)\n", dma, tc << dsz, addr_src, inc_src ? "fix" : "inc", addr_dst, inc_dst ? "fix" : "inc"); + s3c240x_dma_reload(dma); + if (swhwsel == 0) + { + s3c240x_dma_trigger(dma); + } +} + +void gp32_state::s3c240x_dma_stop(int dma) +{ + verboselog( machine(), 1, "DMA %d stop\n", dma); +} + +void gp32_state::s3c240x_dma_recalc(int dma) +{ + if (m_s3c240x_dma_regs[(dma<<3)+6] & 2) + { + s3c240x_dma_start(dma); + } + else + { + s3c240x_dma_stop(dma); + } +} + +READ32_MEMBER(gp32_state::s3c240x_dma_r) +{ + UINT32 data = m_s3c240x_dma_regs[offset]; + verboselog( machine(), 9, "(DMA) %08X -> %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_dma_w) +{ + UINT32 old_value = m_s3c240x_dma_regs[offset]; + verboselog( machine(), 9, "(DMA) %08X <- %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_dma_regs[offset]); + switch (offset) + { + // DCON0 + case 0x08 / 4 : + { + if (((data >> 22) & 1) != 0) // reload + { + m_s3c240x_dma_regs[0x18/4] &= ~(1 << 1); // clear on/off + } + } + break; + // DMASKTRIG0 + case 0x18 / 4 : + { + if ((old_value & 2) != (data & 2)) s3c240x_dma_recalc(0); + } + break; + // DCON1 + case 0x28 / 4 : + { + if (((data >> 22) & 1) != 0) // reload + { + m_s3c240x_dma_regs[0x38/4] &= ~(1 << 1); // clear on/off + } + } + break; + // DMASKTRIG1 + case 0x38 / 4 : + { + if ((old_value & 2) != (data & 2)) s3c240x_dma_recalc(1); + } + break; + // DCON2 + case 0x48 / 4 : + { + if (((data >> 22) & 1) != 0) // reload + { + m_s3c240x_dma_regs[0x58/4] &= ~(1 << 1); // clear on/off + } + } + break; + // DMASKTRIG2 + case 0x58 / 4 : + { + if ((old_value & 2) != (data & 2)) s3c240x_dma_recalc(2); + } + break; + // DCON3 + case 0x68 / 4 : + { + if (((data >> 22) & 1) != 0) // reload + { + m_s3c240x_dma_regs[0x78/4] &= ~(1 << 1); // clear on/off + } + } + break; + // DMASKTRIG3 + case 0x78 / 4 : + { + if ((old_value & 2) != (data & 2)) s3c240x_dma_recalc(3); + } + break; + } +} + +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_dma_timer_exp) +{ + int ch = param; + verboselog( machine(), 2, "DMA %d timer callback\n", ch); +} + +// SMARTMEDIA + +void gp32_state::smc_reset() +{ + verboselog( machine(), 5, "smc_reset\n"); + m_smc.add_latch = 0; + m_smc.chip = 0; + m_smc.cmd_latch = 0; + m_smc.do_read = 0; + m_smc.do_write = 0; + m_smc.read = 0; + m_smc.wp = 0; + m_smc.busy = 0; +} + +void gp32_state::smc_init() +{ + verboselog( machine(), 5, "smc_init\n"); + smc_reset(); +} + +UINT8 gp32_state::smc_read() +{ + UINT8 data; + data = m_smartmedia->data_r(); + verboselog( machine(), 5, "smc_read %08X\n", data); + return data; +} + +void gp32_state::smc_write(UINT8 data) +{ + verboselog( machine(), 5, "smc_write %08X\n", data); + if ((m_smc.chip) && (!m_smc.read)) + { + if (m_smc.cmd_latch) + { + verboselog( machine(), 5, "smartmedia_command_w %08X\n", data); + m_smartmedia->command_w(data); + } + else if (m_smc.add_latch) + { + verboselog( machine(), 5, "smartmedia_address_w %08X\n", data); + m_smartmedia->address_w(data); + } + else + { + verboselog( machine(), 5, "smartmedia_data_w %08X\n", data); + m_smartmedia->data_w(data); + } + } +} + +void gp32_state::smc_update() +{ + if (!m_smc.chip) + { + smc_reset(); + } + else + { + if ((m_smc.do_write) && (!m_smc.read)) + { + smc_write(m_smc.datatx); + } + else if ((!m_smc.do_write) && (m_smc.do_read) && (m_smc.read) && (!m_smc.cmd_latch) && (!m_smc.add_latch)) + { + m_smc.datarx = smc_read(); + } + } +} + +// I2S + +#define I2S_L3C ( 1 ) +#define I2S_L3M ( 2 ) +#define I2S_L3D ( 3 ) + +void gp32_state::i2s_reset() +{ + verboselog( machine(), 5, "i2s_reset\n"); + m_i2s.l3d = 0; + m_i2s.l3m = 0; + m_i2s.l3c = 0; +} + +void gp32_state::i2s_init() +{ + verboselog( machine(), 5, "i2s_init\n"); + i2s_reset(); +} + +void gp32_state::i2s_write(int line, int data) +{ + switch (line) + { + case I2S_L3C : + { + if (data != m_i2s.l3c) + { + verboselog( machine(), 5, "I2S L3C %d\n", data); + m_i2s.l3c = data; + } + } + break; + case I2S_L3M : + { + if (data != m_i2s.l3m) + { + verboselog( machine(), 5, "I2S L3M %d\n", data); + m_i2s.l3m = data; + } + } + break; + case I2S_L3D : + { + if (data != m_i2s.l3d) + { + verboselog( machine(), 5, "I2S L3D %d\n", data); + m_i2s.l3d = data; + } + } + break; + } +} + +// I/O PORT + + +READ32_MEMBER(gp32_state::s3c240x_gpio_r) +{ + UINT32 data = m_s3c240x_gpio[offset]; + switch (offset) + { + // PBCON + case 0x08 / 4 : + { + // smartmedia + data = (data & ~0x00000001); + if (!m_smc.read) data = data | 0x00000001; + } + break; + // PBDAT + case 0x0C / 4 : + { + // smartmedia + data = (data & ~0x000000FF) | (m_smc.datarx & 0xFF); + // buttons + data = (data & ~0x0000FF00) | (m_io_in0->read() & 0x0000FF00); + } + break; + // PDDAT + case 0x24 / 4 : + { + // smartmedia + data = (data & ~0x000003C0); + if (!m_smc.busy) data = data | 0x00000200; + if (!m_smc.do_read) data = data | 0x00000100; + if (!m_smc.chip) data = data | 0x00000080; + if (!m_smartmedia->is_protected()) data = data | 0x00000040; + } + break; + // PEDAT + case 0x30 / 4 : + { + // smartmedia + data = (data & ~0x0000003C); + if (m_smc.cmd_latch) data = data | 0x00000020; + if (m_smc.add_latch) data = data | 0x00000010; + if (!m_smc.do_write) data = data | 0x00000008; + if (!m_smartmedia->is_present()) data = data | 0x00000004; + // buttons + data = (data & ~0x000000C0) | (m_io_in1->read() & 0x000000C0); + } + break; + } + verboselog( machine(), 9, "(GPIO) %08X -> %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_gpio_w) +{ + COMBINE_DATA(&m_s3c240x_gpio[offset]); + verboselog( machine(), 9, "(GPIO) %08X <- %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, space.device().safe_pc( )); + switch (offset) + { + // PBCON + case 0x08 / 4 : + { + // smartmedia + m_smc.read = ((data & 0x00000001) == 0); + smc_update(); + } + break; + // PBDAT + case 0x0C / 4 : + { + // smartmedia + m_smc.datatx = data & 0xFF; + } + break; + // PDDAT + case 0x24 / 4 : + { + // smartmedia + m_smc.do_read = ((data & 0x00000100) == 0); + m_smc.chip = ((data & 0x00000080) == 0); + m_smc.wp = ((data & 0x00000040) == 0); + smc_update(); + } + break; + // PEDAT + case 0x30 / 4 : + { + // smartmedia + m_smc.cmd_latch = ((data & 0x00000020) != 0); + m_smc.add_latch = ((data & 0x00000010) != 0); + m_smc.do_write = ((data & 0x00000008) == 0); + smc_update(); + // sound + i2s_write(I2S_L3D, (data & 0x00000800) ? 1 : 0); + i2s_write(I2S_L3M, (data & 0x00000400) ? 1 : 0); + i2s_write(I2S_L3C, (data & 0x00000200) ? 1 : 0); + } + break; +#if 0 + // PGDAT + case 0x48 / 4 : + { + int i2ssdo; + i2ssdo = BIT( data, 3); + } + break; +#endif + } +} + +// MEMORY CONTROLLER + + +READ32_MEMBER(gp32_state::s3c240x_memcon_r) +{ + UINT32 data = m_s3c240x_memcon_regs[offset]; + verboselog( machine(), 9, "(MEMCON) %08X -> %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_memcon_w) +{ + verboselog( machine(), 9, "(MEMCON) %08X <- %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_memcon_regs[offset]); +} + +// USB HOST CONTROLLER + + +READ32_MEMBER(gp32_state::s3c240x_usb_host_r) +{ + UINT32 data = m_s3c240x_usb_host_regs[offset]; + verboselog( machine(), 9, "(USB H) %08X -> %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_usb_host_w) +{ + verboselog( machine(), 9, "(USB H) %08X <- %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_usb_host_regs[offset]); +} + +// UART 0 + + +READ32_MEMBER(gp32_state::s3c240x_uart_0_r) +{ + UINT32 data = m_s3c240x_uart_0_regs[offset]; + switch (offset) + { + // UTRSTAT0 + case 0x10 / 4 : + { + data = (data & ~0x00000006) | 0x00000004 | 0x00000002; // [bit 2] Transmitter empty / [bit 1] Transmit buffer empty + } + break; + } + verboselog( machine(), 9, "(UART 0) %08X -> %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_uart_0_w) +{ + verboselog( machine(), 9, "(UART 0) %08X <- %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_uart_0_regs[offset]); +} + +// UART 1 + + +READ32_MEMBER(gp32_state::s3c240x_uart_1_r) +{ + UINT32 data = m_s3c240x_uart_1_regs[offset]; + switch (offset) + { + // UTRSTAT1 + case 0x10 / 4 : + { + data = (data & ~0x00000006) | 0x00000004 | 0x00000002; // [bit 2] Transmitter empty / [bit 1] Transmit buffer empty + } + break; + } + verboselog( machine(), 9, "(UART 1) %08X -> %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_uart_1_w) +{ + verboselog( machine(), 9, "(UART 1) %08X <- %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_uart_1_regs[offset]); +} + +// USB DEVICE + + +READ32_MEMBER(gp32_state::s3c240x_usb_device_r) +{ + UINT32 data = m_s3c240x_usb_device_regs[offset]; + verboselog( machine(), 9, "(USB D) %08X -> %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_usb_device_w) +{ + verboselog( machine(), 9, "(USB D) %08X <- %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_usb_device_regs[offset]); +} + +// WATCHDOG TIMER + + +READ32_MEMBER(gp32_state::s3c240x_watchdog_r) +{ + UINT32 data = m_s3c240x_watchdog_regs[offset]; + verboselog( machine(), 9, "(WDOG) %08X -> %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_watchdog_w) +{ + verboselog( machine(), 9, "(WDOG) %08X <- %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_watchdog_regs[offset]); +} + +// EEPROM + +UINT8 gp32_state::eeprom_read(UINT16 address) +{ + UINT8 data; + data = m_eeprom_data[address]; + verboselog( machine(), 5, "EEPROM %04X -> %02X\n", address, data); + return data; +} + +void gp32_state::eeprom_write(UINT16 address, UINT8 data) +{ + verboselog( machine(), 5, "EEPROM %04X <- %02X\n", address, data); + m_eeprom_data[address] = data; +} + +// IIC + +#if 0 +UINT8 gp32_state::i2cmem_read_byte( int last) +{ + UINT8 data = 0; + int i; + i2cmem_write( machine, 0, I2CMEM_SDA, 1); + for (i = 0; i < 8; i++) + { + i2cmem_write( machine, 0, I2CMEM_SCL, 1); + data = (data << 1) + (i2cmem_read( machine, 0, I2CMEM_SDA) ? 1 : 0); + i2cmem_write( machine, 0, I2CMEM_SCL, 0); + } + i2cmem_write( machine, 0, I2CMEM_SDA, last); + i2cmem_write( machine, 0, I2CMEM_SCL, 1); + i2cmem_write( machine, 0, I2CMEM_SCL, 0); + return data; +} +#endif + +#if 0 +void gp32_state::i2cmem_write_byte( UINT8 data) +{ + int i; + for (i = 0; i < 8; i++) + { + i2cmem_write( machine, 0, I2CMEM_SDA, (data & 0x80) ? 1 : 0); + data = data << 1; + i2cmem_write( machine, 0, I2CMEM_SCL, 1); + i2cmem_write( machine, 0, I2CMEM_SCL, 0); + } + i2cmem_write( machine, 0, I2CMEM_SDA, 1); // ack bit + i2cmem_write( machine, 0, I2CMEM_SCL, 1); + i2cmem_write( machine, 0, I2CMEM_SCL, 0); +} +#endif + +#if 0 +void gp32_state::i2cmem_start( ) +{ + i2cmem_write( machine, 0, I2CMEM_SDA, 1); + i2cmem_write( machine, 0, I2CMEM_SCL, 1); + i2cmem_write( machine, 0, I2CMEM_SDA, 0); + i2cmem_write( machine, 0, I2CMEM_SCL, 0); +} +#endif + +#if 0 +void gp32_state::i2cmem_stop( ) +{ + i2cmem_write( machine, 0, I2CMEM_SDA, 0); + i2cmem_write( machine, 0, I2CMEM_SCL, 1); + i2cmem_write( machine, 0, I2CMEM_SDA, 1); + i2cmem_write( machine, 0, I2CMEM_SCL, 0); +} +#endif + +void gp32_state::iic_start() +{ + verboselog( machine(), 1, "IIC start\n"); + m_s3c240x_iic.data_index = 0; + m_s3c240x_iic_timer->adjust( attotime::from_msec( 1)); +} + +void gp32_state::iic_stop() +{ + verboselog( machine(), 1, "IIC stop\n"); + m_s3c240x_iic_timer->adjust( attotime::never); +} + +void gp32_state::iic_resume() +{ + verboselog( machine(), 1, "IIC resume\n"); + m_s3c240x_iic_timer->adjust( attotime::from_msec( 1)); +} + +READ32_MEMBER(gp32_state::s3c240x_iic_r) +{ + UINT32 data = m_s3c240x_iic_regs[offset]; + switch (offset) + { + // IICSTAT + case 0x04 / 4 : + { + data = data & ~0x0000000F; + } + break; + } + verboselog( machine(), 9, "(IIC) %08X -> %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_iic_w) +{ + verboselog( machine(), 9, "(IIC) %08X <- %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_iic_regs[offset]); + switch (offset) + { + // ADDR_IICCON + case 0x00 / 4 : + { + int interrupt_pending_flag; +#if 0 + static const int div_table[] = { 16, 512 }; + int enable_interrupt, transmit_clock_value, tx_clock_source_selection + double clock; + transmit_clock_value = (data >> 0) & 0xF; + tx_clock_source_selection = (data >> 6) & 1; + enable_interrupt = (data >> 5) & 1; + clock = (double)(s3c240x_get_pclk(MPLLCON) / div_table[tx_clock_source_selection] / (transmit_clock_value + 1)); +#endif + interrupt_pending_flag = BIT( data, 4); + if (interrupt_pending_flag == 0) + { + int start_stop_condition; + start_stop_condition = BIT( m_s3c240x_iic_regs[1], 5); + if (start_stop_condition != 0) + { + iic_resume(); + } + } + } + break; + // IICSTAT + case 0x04 / 4 : + { + int start_stop_condition; + start_stop_condition = BIT( data, 5); + if (start_stop_condition != 0) + { + iic_start(); + } + else + { + iic_stop(); + } + } + break; + } +} + +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_iic_timer_exp) +{ + int enable_interrupt, mode_selection; + verboselog( machine(), 2, "IIC timer callback\n"); + mode_selection = BITS( m_s3c240x_iic_regs[1], 7, 6); + switch (mode_selection) + { + // master receive mode + case 2 : + { + if (m_s3c240x_iic.data_index == 0) + { + UINT8 data_shift = m_s3c240x_iic_regs[3] & 0xFF; + verboselog( machine(), 5, "IIC write %02X\n", data_shift); + } + else + { + UINT8 data_shift = eeprom_read(m_s3c240x_iic.address); + verboselog( machine(), 5, "IIC read %02X\n", data_shift); + m_s3c240x_iic_regs[3] = (m_s3c240x_iic_regs[3] & ~0xFF) | data_shift; + } + m_s3c240x_iic.data_index++; + } + break; + // master transmit mode + case 3 : + { + UINT8 data_shift = m_s3c240x_iic_regs[3] & 0xFF; + verboselog( machine(), 5, "IIC write %02X\n", data_shift); + m_s3c240x_iic.data[m_s3c240x_iic.data_index++] = data_shift; + if (m_s3c240x_iic.data_index == 3) + { + m_s3c240x_iic.address = (m_s3c240x_iic.data[1] << 8) | m_s3c240x_iic.data[2]; + } + if ((m_s3c240x_iic.data_index == 4) && (m_s3c240x_iic.data[0] == 0xA0)) + { + eeprom_write(m_s3c240x_iic.address, data_shift); + } + } + break; + } + enable_interrupt = BIT( m_s3c240x_iic_regs[0], 5); + if (enable_interrupt) + { + s3c240x_request_irq(INT_IIC); + } +} + +// IIS + +void gp32_state::s3c240x_iis_start() +{ + static const UINT32 codeclk_table[] = { 256, 384 }; + double freq; + int prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk; + verboselog( machine(), 1, "IIS start\n"); + prescaler_enable = BIT( m_s3c240x_iis_regs[0], 1); + prescaler_control_a = BITS( m_s3c240x_iis_regs[2], 9, 5); + prescaler_control_b = BITS( m_s3c240x_iis_regs[2], 4, 0); + codeclk = BIT( m_s3c240x_iis_regs[1], 2); + freq = (double)(s3c240x_get_pclk(MPLLCON) / (prescaler_control_a + 1) / codeclk_table[codeclk]) * 2; // why do I have to multiply by two? + verboselog( machine(), 5, "IIS - pclk %d psc_enable %d psc_a %d psc_b %d codeclk %d freq %f\n", s3c240x_get_pclk(MPLLCON), prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk_table[codeclk], freq); + m_s3c240x_iis_timer->adjust( attotime::from_hz( freq), 0, attotime::from_hz( freq)); +} + +void gp32_state::s3c240x_iis_stop() +{ + verboselog( machine(), 1, "IIS stop\n"); + m_s3c240x_iis_timer->adjust( attotime::never); +} + +void gp32_state::s3c240x_iis_recalc() +{ + if (m_s3c240x_iis_regs[0] & 1) + { + s3c240x_iis_start(); + } + else + { + s3c240x_iis_stop(); + } +} + +READ32_MEMBER(gp32_state::s3c240x_iis_r) +{ + UINT32 data = m_s3c240x_iis_regs[offset]; +#if 0 + switch (offset) + { + // IISCON + case 0x00 / 4 : + { + data = data & ~1; // for mp3 player + } + break; + } +#endif + verboselog( machine(), 9, "(IIS) %08X -> %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_iis_w) +{ + UINT32 old_value = m_s3c240x_iis_regs[offset]; + verboselog( machine(), 9, "(IIS) %08X <- %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_iis_regs[offset]); + switch (offset) + { + // IISCON + case 0x00 / 4 : + { + if ((old_value & 1) != (data & 1)) s3c240x_iis_recalc(); + } + break; + // IISFIF + case 0x10 / 4 : + { + if (ACCESSING_BITS_16_31) + { + m_s3c240x_iis.fifo[m_s3c240x_iis.fifo_index++] = BITS( data, 31, 16); + } + if (ACCESSING_BITS_0_15) + { + m_s3c240x_iis.fifo[m_s3c240x_iis.fifo_index++] = BITS( data, 15, 0); + } + if (m_s3c240x_iis.fifo_index == 2) + { + m_s3c240x_iis.fifo_index = 0; + m_dac1->write_signed16(m_s3c240x_iis.fifo[0] + 0x8000); + m_dac2->write_signed16(m_s3c240x_iis.fifo[1] + 0x8000); + } + } + break; + } +} + +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_iis_timer_exp) +{ + verboselog( machine(), 2, "IIS timer callback\n"); + s3c240x_dma_request_iis(); +} + +// RTC + + +READ32_MEMBER(gp32_state::s3c240x_rtc_r) +{ + UINT32 data = m_s3c240x_rtc_regs[offset]; + verboselog( machine(), 9, "(RTC) %08X -> %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_rtc_w) +{ + verboselog( machine(), 9, "(RTC) %08X <- %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_rtc_regs[offset]); +} + +// A/D CONVERTER + + +READ32_MEMBER(gp32_state::s3c240x_adc_r) +{ + UINT32 data = m_s3c240x_adc_regs[offset]; + verboselog( machine(), 9, "(ADC) %08X -> %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_adc_w) +{ + verboselog( machine(), 9, "(ADC) %08X <- %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_adc_regs[offset]); +} + +// SPI + + +READ32_MEMBER(gp32_state::s3c240x_spi_r) +{ + UINT32 data = m_s3c240x_spi_regs[offset]; + verboselog( machine(), 9, "(SPI) %08X -> %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_spi_w) +{ + verboselog( machine(), 9, "(SPI) %08X <- %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_spi_regs[offset]); +} + +// MMC INTERFACE + + +READ32_MEMBER(gp32_state::s3c240x_mmc_r) +{ + UINT32 data = m_s3c240x_mmc_regs[offset]; + verboselog( machine(), 9, "(MMC) %08X -> %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, space.device().safe_pc( )); + return data; +} + +WRITE32_MEMBER(gp32_state::s3c240x_mmc_w) +{ + verboselog( machine(), 9, "(MMC) %08X <- %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, space.device().safe_pc( )); + COMBINE_DATA(&m_s3c240x_mmc_regs[offset]); +} + +// ... + +void gp32_state::s3c240x_machine_start() +{ + m_s3c240x_pwm_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)0); + m_s3c240x_pwm_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)1); + m_s3c240x_pwm_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)2); + m_s3c240x_pwm_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)3); + m_s3c240x_pwm_timer[4] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)4); + m_s3c240x_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)0); + m_s3c240x_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)1); + m_s3c240x_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)2); + m_s3c240x_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)3); + m_s3c240x_iic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iic_timer_exp),this), (void *)(FPTR)0); + m_s3c240x_iis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iis_timer_exp),this), (void *)(FPTR)0); + m_s3c240x_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_lcd_timer_exp),this), (void *)(FPTR)0); + m_eeprom_data = auto_alloc_array( machine(), UINT8, 0x2000); + m_nvram->set_base(m_eeprom_data, 0x2000); + smc_init(); + i2s_init(); +} + +void gp32_state::s3c240x_machine_reset() +{ + smc_reset(); + i2s_reset(); + m_s3c240x_iis.fifo_index = 0; + m_s3c240x_iic.data_index = 0; +} + +static ADDRESS_MAP_START( gp32_map, AS_PROGRAM, 32, gp32_state ) + AM_RANGE(0x00000000, 0x0007ffff) AM_ROM + AM_RANGE(0x0c000000, 0x0c7fffff) AM_RAM AM_SHARE("s3c240x_ram") + AM_RANGE(0x14000000, 0x1400003b) AM_READWRITE(s3c240x_memcon_r, s3c240x_memcon_w) + AM_RANGE(0x14200000, 0x1420005b) AM_READWRITE(s3c240x_usb_host_r, s3c240x_usb_host_w) + AM_RANGE(0x14400000, 0x14400017) AM_READWRITE(s3c240x_irq_r, s3c240x_irq_w) + AM_RANGE(0x14600000, 0x1460007b) AM_READWRITE(s3c240x_dma_r, s3c240x_dma_w) + AM_RANGE(0x14800000, 0x14800017) AM_READWRITE(s3c240x_clkpow_r, s3c240x_clkpow_w) + AM_RANGE(0x14a00000, 0x14a003ff) AM_READWRITE(s3c240x_lcd_r, s3c240x_lcd_w) + AM_RANGE(0x14a00400, 0x14a007ff) AM_READWRITE(s3c240x_lcd_palette_r, s3c240x_lcd_palette_w) + AM_RANGE(0x15000000, 0x1500002b) AM_READWRITE(s3c240x_uart_0_r, s3c240x_uart_0_w) + AM_RANGE(0x15004000, 0x1500402b) AM_READWRITE(s3c240x_uart_1_r, s3c240x_uart_1_w) + AM_RANGE(0x15100000, 0x15100043) AM_READWRITE(s3c240x_pwm_r, s3c240x_pwm_w) + AM_RANGE(0x15200140, 0x152001fb) AM_READWRITE(s3c240x_usb_device_r, s3c240x_usb_device_w) + AM_RANGE(0x15300000, 0x1530000b) AM_READWRITE(s3c240x_watchdog_r, s3c240x_watchdog_w) + AM_RANGE(0x15400000, 0x1540000f) AM_READWRITE(s3c240x_iic_r, s3c240x_iic_w) + AM_RANGE(0x15508000, 0x15508013) AM_READWRITE(s3c240x_iis_r, s3c240x_iis_w) + AM_RANGE(0x15600000, 0x1560005b) AM_READWRITE(s3c240x_gpio_r, s3c240x_gpio_w) + AM_RANGE(0x15700040, 0x1570008b) AM_READWRITE(s3c240x_rtc_r, s3c240x_rtc_w) + AM_RANGE(0x15800000, 0x15800007) AM_READWRITE(s3c240x_adc_r, s3c240x_adc_w) + AM_RANGE(0x15900000, 0x15900017) AM_READWRITE(s3c240x_spi_r, s3c240x_spi_w) + AM_RANGE(0x15a00000, 0x15a0003f) AM_READWRITE(s3c240x_mmc_r, s3c240x_mmc_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( gp32 ) + PORT_START("IN0") + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("R") PORT_PLAYER(1) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("L") PORT_PLAYER(1) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") PORT_PLAYER(1) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") PORT_PLAYER(1) + PORT_START("IN1") + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("SELECT") PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("START") PORT_PLAYER(1) +INPUT_PORTS_END + +void gp32_state::machine_start() +{ + s3c240x_machine_start(); +} + +void gp32_state::machine_reset() +{ + s3c240x_machine_reset(); +} + +static MACHINE_CONFIG_START( gp32, gp32_state ) + MCFG_CPU_ADD("maincpu", ARM9, 40000000) + MCFG_CPU_PROGRAM_MAP(gp32_map) + + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(240, 320) + MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 319) + MCFG_SCREEN_UPDATE_DRIVER(gp32_state, screen_update_gp32) + + /* 320x240 is 4:3 but ROT270 causes an aspect ratio of 3:4 by default */ + MCFG_DEFAULT_LAYOUT(layout_lcd_rot) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("dac1", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) + MCFG_SOUND_ADD("dac2", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + + MCFG_NVRAM_ADD_1FILL("nvram") + + MCFG_DEVICE_ADD("smartmedia", SMARTMEDIA, 0) + + MCFG_SOFTWARE_LIST_ADD("memc_list","gp32") +MACHINE_CONFIG_END + +ROM_START( gp32 ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "157e", "Firmware 1.5.7 (English)" ) + ROMX_LOAD( "gp32157e.bin", 0x000000, 0x080000, CRC(b1e35643) SHA1(1566bc2a27980602e9eb501cf8b2d62939bfd1e5), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "100k", "Firmware 1.0.0 (Korean)" ) + ROMX_LOAD( "gp32100k.bin", 0x000000, 0x080000, CRC(d9925ac9) SHA1(3604d0d7210ed72eddd3e3e0c108f1102508423c), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "156k", "Firmware 1.5.6 (Korean)" ) + ROMX_LOAD( "gp32156k.bin", 0x000000, 0x080000, CRC(667fb1c8) SHA1(d179ab8e96411272b6a1d683e59da752067f9da8), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "166m", "Firmware 1.6.6 (European)" ) + ROMX_LOAD( "gp32166m.bin", 0x000000, 0x080000, CRC(4548a840) SHA1(1ad0cab0af28fb45c182e5e8c87ead2aaa4fffe1), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "mfv2", "Mr. Spiv Multi Firmware V2" ) + ROMX_LOAD( "gp32mfv2.bin", 0x000000, 0x080000, CRC(7ddaaaeb) SHA1(5a85278f721beb3b00125db5c912d1dc552c5897), ROM_BIOS(5) ) +#if 0 + ROM_SYSTEM_BIOS( 5, "test", "test" ) + ROMX_LOAD( "test.bin", 0x000000, 0x080000, CRC(00000000) SHA1(0000000000000000000000000000000000000000), ROM_BIOS(6) ) +#endif +ROM_END + +CONS(2001, gp32, 0, 0, gp32, gp32, driver_device, 0, "Game Park Holdings", "GP32", ROT270|MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mame/drivers/grfd2301.c b/src/mame/drivers/grfd2301.c new file mode 100644 index 00000000000..e03f9312c2d --- /dev/null +++ b/src/mame/drivers/grfd2301.c @@ -0,0 +1,139 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/************************************************************************************************************ + +Genrad Futuredata 2301 Network Control Processor + +2013-08-11 Skeleton + +Has a number of plug-in daughter boards, some of which are: +- CPU board: Mostek Z80 CPU, 24MHz crystal, 2 eproms (U2.PB72.2300.4039 1.0 ; U23.N.C.P.2300.4023 3.0) +- IO board: 5.0688MHz crystal, D8253C, 2x S2651 +- Memory board: 16k static ram consisting of 32x TMS2147H-7 chips, 1 prom? with sticker U36.2300.4035 1.0 +- 2301 board: 2x D8253C, 4x S2651 + +Back panel has a number of DB25 sockets, labelled thus: +- Station 1-4 +- Station 5-8 +- EIA 1 +- EIA 2 +- Printer +- 3 unlabelled ones + +A sticker on the back panel says: GenRad, Culver City CA, Model 2301-9001 + + +- No schematic or documents are available. Everything in this driver is a guess. +- Only one rom has been dumped. The best guess would be U23, as this is adjacent to the Z80. +- Although there's no display device, it has display ram. This has been hooked up with a chargen rom + from another system. + +*************************************************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" + +class grfd2301_state : public driver_device +{ +public: + grfd2301_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_p_videoram(*this, "videoram") + , m_maincpu(*this, "maincpu") + { } + +public: + virtual void machine_reset(); + const UINT8 *m_p_chargen; + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; +private: + required_device m_maincpu; + + +}; + +static ADDRESS_MAP_START( grfd2301_mem, AS_PROGRAM, 8, grfd2301_state ) + AM_RANGE(0xe000, 0xefff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0xf000, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( grfd2301_io, AS_IO, 8, grfd2301_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +static INPUT_PORTS_START( grfd2301 ) +INPUT_PORTS_END + +void grfd2301_state::machine_reset() +{ + m_p_chargen = memregion("chargen")->base(); + m_maincpu->set_pc(0xe000); +} + +UINT32 grfd2301_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 24; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 80; x++) + { + gfx = 0; + if (ra < 9) + { + chr = m_p_videoram[x+ma]; + + gfx = m_p_chargen[(chr<<4) | ra ]; + } + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=80; + } + return 0; +} + +static MACHINE_CONFIG_START( grfd2301, grfd2301_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(grfd2301_mem) + MCFG_CPU_IO_MAP(grfd2301_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(grfd2301_state, screen_update) + MCFG_SCREEN_SIZE(640, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +ROM_START( grfd2301 ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "boot2301", 0x000, 0x1000, CRC(feec0cbd) SHA1(ec8138aca7ed489d86aaf2e07225c8d715440db7) ) + + // Using the chargen from 'c10' for now. + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + +COMP( 198?, grfd2301, 0, 0, grfd2301, grfd2301, driver_device, 0, "Genrad", "Futuredata 2301 Network Processor", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/h19.c b/src/mame/drivers/h19.c new file mode 100644 index 00000000000..4e44801c862 --- /dev/null +++ b/src/mame/drivers/h19.c @@ -0,0 +1,452 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Heathkit H19 + + 12/05/2009 Skeleton driver. + + The keyboard consists of a 9x10 matrix connected to a MM5740N + mask-programmed keyboard controller. The output of this passes + through a rom. The MM5740N may be custom-made, in which case it + will need to be procured and tested. There is a "default" array; + perhaps this is used. The presence of the rom would seem to + indicate that the default is being used. We won't know, of + course, until the device is emulated. + + Keyboard input can also come from the serial port (a 8250). + Either device will signal an interrupt to the CPU when a key + is pressed/sent. + + For the moment, the "ascii keyboard" device is used for the keyboard. + + TODO: + - Create device or HLE of MM5740N keyboard controller + - Make sure correct mask programming is used for it + - Use keyboard rom + - Finish connecting up the 8250 + - Verify beep lengths + - Verify ram size + - When the internal keyboard works, get rid of the "ascii_keyboard". + + Bios 1 (super19) has the videoram at D800. This is not emulated. + However, a keyclick can be heard, to assure you it does in fact work. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "sound/beep.h" +#include "machine/ins8250.h" +#include "machine/keyboard.h" + +#define KEYBOARD_TAG "keyboard" + +#define H19_CLOCK (XTAL_12_288MHz / 6) +#define H19_BEEP_FRQ (H19_CLOCK / 1024) + + +class h19_state : public driver_device +{ +public: + enum + { + TIMER_BEEP_OFF + }; + + h19_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "crtc"), + m_ace(*this, "ins8250"), + m_beep(*this, "beeper"), + m_p_videoram(*this, "videoram"), + m_palette(*this, "palette") + { + } + + required_device m_maincpu; + required_device m_crtc; + required_device m_ace; + required_device m_beep; + DECLARE_READ8_MEMBER(h19_80_r); + DECLARE_READ8_MEMBER(h19_a0_r); + DECLARE_WRITE8_MEMBER(h19_c0_w); + DECLARE_WRITE8_MEMBER(h19_kbd_put); + MC6845_UPDATE_ROW(crtc_update_row); + required_shared_ptr m_p_videoram; + required_device m_palette; + UINT8 *m_p_chargen; + UINT8 m_term_data; + virtual void machine_reset(); + virtual void video_start(); + DECLARE_WRITE_LINE_MEMBER(h19_ace_irq); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +void h19_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BEEP_OFF: + m_beep->set_state(0); + break; + default: + assert_always(FALSE, "Unknown id in h19_state::device_timer"); + } +} + +READ8_MEMBER( h19_state::h19_80_r ) +{ +// keyboard data + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( h19_state::h19_a0_r ) +{ +// keyboard status + m_maincpu->set_input_line(0, CLEAR_LINE); + return 0x7f; // says that a key is ready and no modifier keys are pressed +} + +WRITE8_MEMBER( h19_state::h19_c0_w ) +{ +/* Beeper control - a 96L02 contains 2 oneshots, one for bell and one for keyclick. +- lengths need verifying + offset 00-1F = keyclick + offset 20-3F = terminal bell */ + + UINT8 length = (offset & 0x20) ? 200 : 4; + m_beep->set_state(1); + timer_set(attotime::from_msec(length), TIMER_BEEP_OFF); +} + +static ADDRESS_MAP_START(h19_mem, AS_PROGRAM, 8, h19_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( h19_io, AS_IO, 8, h19_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x1F) AM_READ_PORT("S401") + AM_RANGE(0x20, 0x3F) AM_READ_PORT("S402") + AM_RANGE(0x40, 0x47) AM_MIRROR(0x18) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w ) + AM_RANGE(0x60, 0x60) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0x61, 0x61) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0x80, 0x9F) AM_READ(h19_80_r) + AM_RANGE(0xA0, 0xBF) AM_READ(h19_a0_r) + AM_RANGE(0xC0, 0xFF) AM_WRITE(h19_c0_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( h19 ) +// Port codes are omitted to prevent collision with terminal keys + + PORT_START("MODIFIERS") + // bit 0 connects to B8 of MM5740 - purpose unknown + // bit 7 is low if a key is pressed + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CapsLock") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OffLine") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LeftShift") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Reset") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RightShift") + + PORT_START("X1") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X2") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0-pad") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dot-pad") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter-pad") + + PORT_START("X2") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\'") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("{") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1-pad") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2-pad") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3-pad") + + PORT_START("X3") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LF") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4-pad") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5-pad") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6-pad") + + PORT_START("X4") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("AccentAcute") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X1") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7-pad") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8-pad") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9-pad") + + PORT_START("X5") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Blue") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Red") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gray") + + PORT_START("X6") + PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") + + PORT_START("X7") + PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Scroll") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") + + PORT_START("X8") + PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") + + PORT_START("X9") + PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") + PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") + PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") + PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") + + PORT_START("S401") + PORT_DIPNAME( 0x0f, 0x03, "Baud Rate") + PORT_DIPSETTING( 0x01, "110") + PORT_DIPSETTING( 0x02, "150") + PORT_DIPSETTING( 0x03, "300") + PORT_DIPSETTING( 0x04, "600") + PORT_DIPSETTING( 0x05, "1200") + PORT_DIPSETTING( 0x06, "1800") + PORT_DIPSETTING( 0x07, "2000") + PORT_DIPSETTING( 0x08, "2400") + PORT_DIPSETTING( 0x09, "3600") + PORT_DIPSETTING( 0x0a, "4800") + PORT_DIPSETTING( 0x0b, "7200") + PORT_DIPSETTING( 0x0c, "9600") + PORT_DIPSETTING( 0x0d, "19200") + PORT_DIPNAME( 0x30, 0x00, "Parity") + PORT_DIPSETTING( 0x00, DEF_STR(None)) + PORT_DIPSETTING( 0x10, "Odd") + PORT_DIPSETTING( 0x30, "Even") + PORT_DIPNAME( 0x40, 0x00, "Parity Type") + PORT_DIPSETTING( 0x00, DEF_STR(Normal)) + PORT_DIPSETTING( 0x40, "Stick") + PORT_DIPNAME( 0x80, 0x00, "Duplex") + PORT_DIPSETTING( 0x00, "Half") + PORT_DIPSETTING( 0x80, "Full") + + PORT_START("S402") // stored at 40C8 + PORT_DIPNAME( 0x01, 0x00, "Cursor") + PORT_DIPSETTING( 0x00, "Underline") + PORT_DIPSETTING( 0x01, "Block") + PORT_DIPNAME( 0x02, 0x00, "Keyclick") + PORT_DIPSETTING( 0x02, DEF_STR(No)) + PORT_DIPSETTING( 0x00, DEF_STR(Yes)) + PORT_DIPNAME( 0x04, 0x04, "Wrap at EOL") + PORT_DIPSETTING( 0x00, DEF_STR(No)) + PORT_DIPSETTING( 0x04, DEF_STR(Yes)) + PORT_DIPNAME( 0x08, 0x08, "Auto LF on CR") + PORT_DIPSETTING( 0x00, DEF_STR(No)) + PORT_DIPSETTING( 0x08, DEF_STR(Yes)) + PORT_DIPNAME( 0x10, 0x00, "Auto CR on LF") + PORT_DIPSETTING( 0x00, DEF_STR(No)) + PORT_DIPSETTING( 0x10, DEF_STR(Yes)) + PORT_DIPNAME( 0x20, 0x00, "Mode") + PORT_DIPSETTING( 0x00, "VT52") + PORT_DIPSETTING( 0x20, "ANSI") + PORT_DIPNAME( 0x40, 0x00, "Keypad Shifted") + PORT_DIPSETTING( 0x00, DEF_STR(No)) + PORT_DIPSETTING( 0x40, DEF_STR(Yes)) + PORT_DIPNAME( 0x80, 0x00, "Refresh") + PORT_DIPSETTING( 0x00, "50Hz") + PORT_DIPSETTING( 0x80, "60Hz") +INPUT_PORTS_END + + +void h19_state::machine_reset() +{ + m_beep->set_frequency(H19_BEEP_FRQ); +} + +void h19_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +MC6845_UPDATE_ROW( h19_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + UINT8 inv=0; + if (x == cursor_x) inv=0xff; + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + + if (chr & 0x80) + { + inv ^= 0xff; + chr &= 0x7f; + } + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + + /* Display a scanline of a character (8 pixels) */ + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} + +WRITE_LINE_MEMBER(h19_state::h19_ace_irq) +{ + m_maincpu->set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE)); +} + +/* F4 Character Displayer */ +static const gfx_layout h19_charlayout = +{ + 8, 10, /* 8 x 10 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( h19 ) + GFXDECODE_ENTRY( "chargen", 0x0000, h19_charlayout, 0, 1 ) +GFXDECODE_END + +WRITE8_MEMBER( h19_state::h19_kbd_put ) +{ + m_term_data = data; + m_maincpu->set_input_line(0, HOLD_LINE); +} + +static MACHINE_CONFIG_START( h19, h19_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, H19_CLOCK) // From schematics + MCFG_CPU_PROGRAM_MAP(h19_mem) + MCFG_CPU_IO_MAP(h19_io) + //MCFG_DEVICE_PERIODIC_INT_DRIVER(h19_state, irq0_line_hold, 50) // for testing, causes a keyboard scan + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", h19) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12_288MHz / 8) // clk taken from schematics + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) /*?*/ + MCFG_MC6845_UPDATE_ROW_CB(h19_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) // frame pulse + + MCFG_DEVICE_ADD("ins8250", INS8250, XTAL_12_288MHz / 4) // 3.072mhz clock which gets divided down for the various baud rates + MCFG_INS8250_OUT_INT_CB(WRITELINE(h19_state, h19_ace_irq)) // interrupt + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(h19_state, h19_kbd_put)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( h19 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // Original + ROM_SYSTEM_BIOS(0, "orig", "Original") + ROMX_LOAD( "2732_444-46_h19code.bin", 0x0000, 0x1000, CRC(f4447da0) SHA1(fb4093d5b763be21a9580a0defebed664b1f7a7b), ROM_BIOS(1)) + // Super H19 ROM ( + ROM_SYSTEM_BIOS(1, "super", "Super 19") + ROMX_LOAD( "2732_super19_h447.bin", 0x0000, 0x1000, CRC(6c51aaa6) SHA1(5e368b39fe2f1af44a905dc474663198ab630117), ROM_BIOS(2)) + // Watzman ROM + ROM_SYSTEM_BIOS(2, "watzman", "Watzman") + ROMX_LOAD( "watzman.bin", 0x0000, 0x1000, CRC(8168b6dc) SHA1(bfaebb9d766edbe545d24bc2b6630be4f3aa0ce9), ROM_BIOS(3)) + + ROM_REGION( 0x0800, "chargen", 0 ) + // Original font dump + ROM_LOAD( "2716_444-29_h19font.bin", 0x0000, 0x0800, CRC(d595ac1d) SHA1(130fb4ea8754106340c318592eec2d8a0deaf3d0)) + + ROM_REGION( 0x1000, "keyboard", 0 ) + // Original dump + ROM_LOAD( "2716_444-37_h19keyb.bin", 0x0000, 0x0800, CRC(5c3e6972) SHA1(df49ce64ae48652346a91648c58178a34fb37d3c)) + // Watzman keyboard + ROM_LOAD( "keybd.bin", 0x0800, 0x0800, CRC(58dc8217) SHA1(1b23705290bdf9fc6342065c6a528c04bff67b13)) +ROM_END + +/* Driver (year is either 1978 or 1979) */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, h19, 0, 0, h19, h19, driver_device, 0, "Heath Inc", "Heathkit H-19", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/h8.c b/src/mame/drivers/h8.c new file mode 100644 index 00000000000..9838ad98100 --- /dev/null +++ b/src/mame/drivers/h8.c @@ -0,0 +1,368 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Heathkit H8 + + 2009-05-12 Skeleton driver. + + This system uses Octal rather than the usual hexadecimal. + +STATUS: + It runs, keyboard works, you can enter data. + +Meaning of LEDs: + PWR = power is turned on + MON = controls should work + RUN = CPU is running (not halted) + ION = Interrupts are enabled + +Pasting: + 0-F : as is + + : ^ + - : V + MEM : - + ALTER : = + + Addresses must have all 6 digits entered. + Data must have all 3 digits entered. + System has a short beep for each key, and a slightly longer beep + for each group of 3 digits. The largest number allowed is 377 (=0xFF). + +Test Paste: + -041000=123 245 333 144 255 366 077=-041000 + Now press up-arrow to confirm the data has been entered. + +Official test program from pages 4 to 8 of the operator's manual: + -040100=076 002 062 010 040 006 004 041 170 040 021 013 040 016 011 176 + 022 043 023 015 302 117 040 016 003 076 377 315 053 000 015 302 + 131 040 005 302 112 040 076 062 315 140 002 076 062 315 053 000 + 076 062 315 140 002 303 105 040 377 262 270 272 275 377 222 200 + 377 237 244 377 272 230 377 220 326 302 377 275 272 271 271 373 + 271 240 377 236 376 362 236 376 362 236 376 362 R6=040100=4 + +TODO: + - Cassette (coded but not working) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8251.h" +#include "machine/clock.h" +#include "imagedev/cassette.h" +#include "sound/beep.h" +#include "sound/wave.h" +#include "h8.lh" + + +class h8_state : public driver_device +{ +public: + h8_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_uart(*this, "uart"), + m_cass(*this, "cassette"), + m_beep(*this, "beeper") + { } + + DECLARE_READ8_MEMBER(portf0_r); + DECLARE_WRITE8_MEMBER(portf0_w); + DECLARE_WRITE8_MEMBER(portf1_w); + DECLARE_WRITE8_MEMBER(h8_status_callback); + DECLARE_WRITE_LINE_MEMBER(h8_inte_callback); + DECLARE_WRITE_LINE_MEMBER(txdata_callback); + DECLARE_WRITE_LINE_MEMBER(write_cassette_clock); + TIMER_DEVICE_CALLBACK_MEMBER(h8_irq_pulse); + TIMER_DEVICE_CALLBACK_MEMBER(h8_c); + TIMER_DEVICE_CALLBACK_MEMBER(h8_p); +private: + UINT8 m_digit; + UINT8 m_segment; + UINT8 m_irq_ctl; + bool m_ff_b; + UINT8 m_cass_data[4]; + bool m_cass_state; + bool m_cassold; + virtual void machine_reset(); + required_device m_maincpu; + required_device m_uart; + required_device m_cass; + required_device m_beep; +}; + + +#define H8_CLOCK (XTAL_12_288MHz / 6) +#define H8_BEEP_FRQ (H8_CLOCK / 1024) +#define H8_IRQ_PULSE (H8_BEEP_FRQ / 2) + + +TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_irq_pulse) +{ + if (m_irq_ctl & 1) + m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xcf); +} + +READ8_MEMBER( h8_state::portf0_r ) +{ + // reads the keyboard + + // The following not emulated, can occur any time even if keyboard not being scanned + // - if 0 and RTM pressed, causes int10 + // - if 0 and RST pressed, resets cpu + + UINT8 i,keyin,data = 0xff; + + keyin = ioport("X0")->read(); + if (keyin != 0xff) + { + for (i = 1; i < 8; i++) + if (!BIT(keyin,i)) + data &= ~(i<<1); + data &= 0xfe; + } + + keyin = ioport("X1")->read(); + if (keyin != 0xff) + { + for (i = 1; i < 8; i++) + if (!BIT(keyin,i)) + data &= ~(i<<5); + data &= 0xef; + } + return data; +} + +WRITE8_MEMBER( h8_state::portf0_w ) +{ + // this will always turn off int10 that was set by the timer + // d0-d3 = digit select + // d4 = int20 is allowed + // d5 = mon led + // d6 = int10 is allowed + // d7 = beeper enable + + m_digit = data & 15; + if (m_digit) output_set_digit_value(m_digit, m_segment); + + output_set_value("mon_led", !BIT(data, 5)); + m_beep->set_state(!BIT(data, 7)); + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + m_irq_ctl &= 0xf0; + if (BIT(data, 6)) m_irq_ctl |= 1; + if (!BIT(data, 4)) m_irq_ctl |= 2; +} + +WRITE8_MEMBER( h8_state::portf1_w ) +{ + //d7 segment dot + //d6 segment f + //d5 segment e + //d4 segment d + //d3 segment c + //d2 segment b + //d1 segment a + //d0 segment g + + m_segment = 0xff ^ BITSWAP8(data, 7, 0, 6, 5, 4, 3, 2, 1); + if (m_digit) output_set_digit_value(m_digit, m_segment); +} + +static ADDRESS_MAP_START(h8_mem, AS_PROGRAM, 8, h8_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM // main rom + AM_RANGE(0x1400, 0x17ff) AM_RAM // fdc ram + AM_RANGE(0x1800, 0x1fff) AM_ROM // fdc rom + AM_RANGE(0x2000, 0x9fff) AM_RAM // main ram +ADDRESS_MAP_END + +static ADDRESS_MAP_START( h8_io, AS_IO, 8, h8_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf0, 0xf0) AM_READWRITE(portf0_r,portf0_w) + AM_RANGE(0xf1, 0xf1) AM_WRITE(portf1_w) + AM_RANGE(0xf8, 0xf8) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0xf9, 0xf9) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + // optional connection to a serial terminal @ 600 baud + //AM_RANGE(0xfa, 0xfa) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) + //AM_RANGE(0xfb, 0xfb) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( h8 ) + PORT_START("X0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 SP") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 AF") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 BC") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 DE GO") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 HL IN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 PC OUT") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 SI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 LOAD") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 DUMP") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CANCEL") PORT_CODE(KEYCODE_ESC) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALTER") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') +INPUT_PORTS_END + +void h8_state::machine_reset() +{ + m_beep->set_frequency(H8_BEEP_FRQ); + output_set_value("pwr_led", 0); + m_irq_ctl = 1; + m_cass_state = 1; + m_cass_data[0] = 0; + m_cass_data[1] = 0; + m_uart->write_rxd(0); + m_cass_data[3] = 0; + m_ff_b = 1; +} + +WRITE_LINE_MEMBER( h8_state::h8_inte_callback ) +{ + // operate the ION LED + output_set_value("ion_led", !state); + m_irq_ctl &= 0x7f | ((state) ? 0 : 0x80); +} + +WRITE8_MEMBER( h8_state::h8_status_callback ) +{ +/* This is rather messy, but basically there are 2 D flipflops, one drives the other, +the data is /INTE while the clock is /M1. If the system is in Single Instruction mode, +a int20 (output of 2nd flipflop) will occur after 4 M1 steps, to pause the running program. +But, all of this can only occur if bit 5 of port F0 is low. */ + + bool state = (data & I8085_STATUS_M1) ? 0 : 1; + bool c,a = (m_irq_ctl & 0x80) ? 1 : 0; + + if (m_irq_ctl & 2) + { + if (!state) // rising pulse to push data through flipflops + { + c = !m_ff_b; // from /Q of 2nd flipflop + m_ff_b = a; // from Q of 1st flipflop + if (c) + m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xd7); + } + } + else + { // flipflops are 'set' + c = 0; + m_ff_b = 1; + } + + + // operate the RUN LED + output_set_value("run_led", state); +} + +WRITE_LINE_MEMBER( h8_state::txdata_callback ) +{ + m_cass_state = state; +} + +WRITE_LINE_MEMBER( h8_state::write_cassette_clock ) +{ + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + +TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_c) +{ + m_cass_data[3]++; + + if (m_cass_state != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_p) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_uart->write_rxd((m_cass_data[1] < 12) ? 1 : 0); + m_cass_data[1] = 0; + } +} + +static MACHINE_CONFIG_START( h8, h8_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, H8_CLOCK) + MCFG_CPU_PROGRAM_MAP(h8_mem) + MCFG_CPU_IO_MAP(h8_io) + MCFG_I8085A_STATUS(WRITE8(h8_state, h8_status_callback)) + MCFG_I8085A_INTE(WRITELINE(h8_state, h8_inte_callback)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_h8) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(h8_state, txdata_callback)) + + MCFG_DEVICE_ADD("cassette_clock", CLOCK, 4800) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(h8_state, write_cassette_clock)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("h8_cass") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_c", h8_state, h8_c, attotime::from_hz(4800)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_p", h8_state, h8_p, attotime::from_hz(40000)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_timer", h8_state, h8_irq_pulse, attotime::from_hz(H8_IRQ_PULSE)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( h8 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // H17 fdc bios - needed by bios2&3 + ROM_LOAD( "2716_444-19_h17.rom", 0x1800, 0x0800, CRC(26e80ae3) SHA1(0c0ee95d7cb1a760f924769e10c0db1678f2435c)) + + ROM_SYSTEM_BIOS(0, "bios0", "Standard") + ROMX_LOAD( "2708_444-13_pam8.rom", 0x0000, 0x0400, CRC(e0745513) SHA1(0e170077b6086be4e5cd10c17e012c0647688c39), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS(1, "bios1", "Alternate") + ROMX_LOAD( "2708_444-13_pam8go.rom", 0x0000, 0x0400, CRC(9dbad129) SHA1(72421102b881706877f50537625fc2ab0b507752), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS(2, "bios2", "Disk OS") + ROMX_LOAD( "2716_444-13_pam8at.rom", 0x0000, 0x0800, CRC(fd95ddc1) SHA1(eb1f272439877239f745521139402f654e5403af), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS(3, "bios3", "Disk OS Alt") + ROMX_LOAD( "2732_444-70_xcon8.rom", 0x0000, 0x1000, CRC(b04368f4) SHA1(965244277a3a8039a987e4c3593b52196e39b7e7), ROM_BIOS(4) ) + + // this one runs off into the weeds + ROM_SYSTEM_BIOS(4, "bios4", "not working") + ROMX_LOAD( "2732_444-140_pam37.rom", 0x0000, 0x1000, CRC(53a540db) SHA1(90082d02ffb1d27e8172b11fff465bd24343486e), ROM_BIOS(5) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS, INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, h8, 0, 0, h8, h8, driver_device, 0, "Heath, Inc.", "Heathkit H8", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/h89.c b/src/mame/drivers/h89.c new file mode 100644 index 00000000000..8ad90cede45 --- /dev/null +++ b/src/mame/drivers/h89.c @@ -0,0 +1,151 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Heathkit H89 + + 12/05/2009 Skeleton driver. + + Monitor Commands: + B Boot + C Convert (number) + G Go (address) + I In (address) + O Out (address,data) + R Radix (H/O) + S Substitute (address) + T Test Memory + V View + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "machine/ins8250.h" + +#define RS232_TAG "rs232" + +class h89_state : public driver_device +{ +public: + h89_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { + } + + required_device m_maincpu; + + DECLARE_WRITE8_MEMBER( port_f2_w ); + + UINT8 m_port_f2; + virtual void machine_reset(); + TIMER_DEVICE_CALLBACK_MEMBER(h89_irq_timer); +}; + + +static ADDRESS_MAP_START(h89_mem, AS_PROGRAM, 8, h89_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( h89_io, AS_IO, 8, h89_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +// AM_RANGE(0x78, 0x7b) expansion 1 +// AM_RANGE(0x7c, 0x7f) expansion 2 +// AM_RANGE(0xd0, 0xd7) 8250 UART DCE +// AM_RANGE(0xd8, 0xdf) 8250 UART DTE +// AM_RANGE(0xe0, 0xe7) 8250 UART LP + AM_RANGE(0xe8, 0xef) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w) // 8250 UART console +// AM_RANGE(0xf0, 0xf1) front panel + AM_RANGE(0xf2, 0xf2) AM_WRITE(port_f2_w) AM_READ_PORT("SW501") +// AM_RANGE(0xf8, 0xf9) cassette +// AM_RANGE(0xfa, 0xff) serial I/O +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( h89 ) + PORT_START("SW501") + PORT_DIPNAME( 0x03, 0x00, "Expansion 1" ) PORT_DIPLOCATION("S1:1,S1:2") + PORT_DIPSETTING( 0x00, "H-88-1" ) + PORT_DIPSETTING( 0x01, "H/Z-47" ) + PORT_DIPSETTING( 0x02, "Z-67" ) + PORT_DIPSETTING( 0x03, "Undefined" ) + PORT_DIPNAME( 0x0c, 0x00, "Expansion 2" ) PORT_DIPLOCATION("S1:3,S1:4") + PORT_DIPSETTING( 0x00, "H-89-37" ) + PORT_DIPSETTING( 0x04, "H/Z-47" ) + PORT_DIPSETTING( 0x08, "Z-67" ) + PORT_DIPSETTING( 0x0c, "Undefined" ) + PORT_DIPNAME( 0x10, 0x00, "Boot from" ) PORT_DIPLOCATION("S1:5") + PORT_DIPSETTING( 0x00, "Expansion 1" ) + PORT_DIPSETTING( 0x10, "Expansion 2" ) + PORT_DIPNAME( 0x20, 0x20, "Perform memory test at start" ) PORT_DIPLOCATION("S1:6") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, "Console Baud rate" ) PORT_DIPLOCATION("S1:7") + PORT_DIPSETTING( 0x00, "9600" ) + PORT_DIPSETTING( 0x40, "19200" ) + PORT_DIPNAME( 0x80, 0x00, "Boot mode" ) PORT_DIPLOCATION("S1:8") + PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x80, "Auto" ) +INPUT_PORTS_END + + +void h89_state::machine_reset() +{ +} + +TIMER_DEVICE_CALLBACK_MEMBER(h89_state::h89_irq_timer) +{ + if (m_port_f2 & 0x02) + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); +} + +WRITE8_MEMBER( h89_state::port_f2_w ) +{ + m_port_f2 = data; +} + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + + +static MACHINE_CONFIG_START( h89, h89_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_12_288MHz / 6) + MCFG_CPU_PROGRAM_MAP(h89_mem) + MCFG_CPU_IO_MAP(h89_io) + + MCFG_DEVICE_ADD( "ins8250", INS8250, XTAL_1_8432MHz ) + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, rx_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", h89_state, h89_irq_timer, attotime::from_hz(100)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( h89 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "2732_444-142_mtr90.rom", 0x0000, 0x1000, CRC(c4ff47c5) SHA1(d6f3d71ff270a663003ec18a3ed1fa49f627123a)) + ROM_LOAD( "2716_444-19_h17.rom", 0x1800, 0x0800, CRC(26e80ae3) SHA1(0c0ee95d7cb1a760f924769e10c0db1678f2435c)) + + ROM_REGION( 0x10000, "otherroms", ROMREGION_ERASEFF ) + ROM_LOAD( "2732_444-84_mtr84.rom", 0x0000, 0x1000, CRC(c98e5f4c) SHA1(03347206dca145ff69ca08435db822b70ce106af)) + ROM_LOAD( "2732_mms84a_magnoliamms.bin", 0x0000, 0x1000, CRC(5563f42a) SHA1(1b74cafca8213d5c083f16d8a848933ab56eb43b)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, h89, 0, 0, h89, h89, driver_device, 0, "Heath Inc", "Heathkit H89", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/harriet.c b/src/mame/drivers/harriet.c new file mode 100644 index 00000000000..b359c19daec --- /dev/null +++ b/src/mame/drivers/harriet.c @@ -0,0 +1,225 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese +/*************************************************************************** + + Harriet (c) 1990 Quantel + + TODO: + - PCB pics would be very useful + - "Failed to read NVR" message. + - hook-up keyboard/terminal, shouldn't be too hard by studying the code. + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class harriet_state : public driver_device +{ +public: + harriet_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + // devices + required_device m_maincpu; + required_device m_terminal; + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + UINT8 m_teletype_data; + UINT8 m_teletype_status; + + DECLARE_READ8_MEMBER(unk_r); + DECLARE_WRITE8_MEMBER(unk_w); + DECLARE_WRITE8_MEMBER(serial_w); + DECLARE_READ8_MEMBER(unk2_r); + DECLARE_READ8_MEMBER(unk3_r); + DECLARE_READ8_MEMBER(keyboard_status_r); + DECLARE_WRITE8_MEMBER( kbd_put ); +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); +}; + +void harriet_state::video_start() +{ +} + +UINT32 harriet_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + return 0; +} + +/* tested at POST (PC=0x612), halts the CPU if cmp.b $f1000f.l, d0 for 0x4000 DBRAs */ +READ8_MEMBER(harriet_state::unk_r) +{ + return machine().rand(); +} + +WRITE8_MEMBER(harriet_state::unk_w) +{ +/* if(offset) + printf("%02x\n",data); + else if(data != 0xcf) + printf("$f1001d Control (offset 0) write %02x\n",data);*/ +} + +/* PC=0x676/0x694 */ +READ8_MEMBER(harriet_state::unk2_r) +{ + return machine().rand(); +} + + +WRITE8_MEMBER(harriet_state::serial_w) +{ + m_terminal->write(space, 0, data); +} + +/* tested before putting data to serial port at PC=0x4c78 */ +READ8_MEMBER(harriet_state::unk3_r) +{ + return 0xff;//machine().rand(); +} + +/* 0x314c bit 7: keyboard status */ +READ8_MEMBER(harriet_state::keyboard_status_r) +{ + UINT8 res; + + res = m_teletype_status | m_teletype_data; + m_teletype_status &= ~0x80; + + return res; +} + +static ADDRESS_MAP_START( harriet_map, AS_PROGRAM, 16, harriet_state ) + AM_RANGE(0x000000, 0x007fff) AM_ROM + AM_RANGE(0x040000, 0x040fff) AM_RAM // NVRAM + AM_RANGE(0x7f0000, 0x7fffff) AM_RAM // todo: boundaries, 0x7fe000 - 0x7fffff tested on boot + AM_RANGE(0xf1000e, 0xf1000f) AM_READ8(unk_r,0x00ff) + AM_RANGE(0xf1001c, 0xf1001f) AM_WRITE8(unk_w,0x00ff) + AM_RANGE(0xf20022, 0xf20023) AM_READ8(unk2_r,0x00ff) + AM_RANGE(0xf20024, 0xf20025) AM_READ8(unk2_r,0x00ff) + AM_RANGE(0xf2002c, 0xf2002d) AM_READ8(unk3_r,0x00ff) + AM_RANGE(0xf2002e, 0xf2002f) AM_WRITE8(serial_w,0x00ff) +// AM_RANGE(0xf4001e, 0xf4001f) AM_READ8(keyboard_status_r,0x00ff) +// AM_RANGE(0xf4002e, 0xf4002f) AM_READ8(keyboard_status_r,0x00ff) + AM_RANGE(0xf4003e, 0xf4003f) AM_READ8(keyboard_status_r,0x00ff) +ADDRESS_MAP_END + +static INPUT_PORTS_START( harriet ) + /* dummy active high structure */ + PORT_START("SYSA") + PORT_DIPNAME( 0x01, 0x00, "SYSA" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + /* dummy active low structure */ + PORT_START("DSWA") + PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +WRITE8_MEMBER( harriet_state::kbd_put ) +{ + m_teletype_data = data; + m_teletype_status |= 0x80; +} + +void harriet_state::machine_start() +{ +} + +void harriet_state::machine_reset() +{ +} + + +static MACHINE_CONFIG_START( harriet, harriet_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M68010,XTAL_8MHz) // TODO: clock + MCFG_CPU_PROGRAM_MAP(harriet_map) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(harriet_state, kbd_put)) + + MCFG_PALETTE_ADD("palette", 8) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( harriet ) + ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD16_BYTE( "harriet 36-74c.tfb v5.01 lobyte 533f.bin", 0x0001, 0x4000, CRC(f07fff76) SHA1(8288f7eaa8f4155e0e4746635f63ca2cc3da25d1) ) + ROM_LOAD16_BYTE( "harriet 36-74c.tdb v5.01 hibyte 2a0c.bin", 0x0000, 0x4000, CRC(a61f441d) SHA1(76af6eddd5c042f1b2eef590eb822379944b9b28) ) +ROM_END + +COMP( 1990, harriet, 0, 0, harriet, harriet, driver_device, 0, "Quantel", "Harriet", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/hec2hrp.c b/src/mame/drivers/hec2hrp.c new file mode 100644 index 00000000000..ef9e3cac314 --- /dev/null +++ b/src/mame/drivers/hec2hrp.c @@ -0,0 +1,731 @@ +// license:BSD-3-Clause +// copyright-holders:JJ Stacino +/*************************************************************************** + + Hector 2HR+ + Victor + Hector 2HR + Hector HRX + Hector MX40c + Hector MX80c + Hector 1 + Interact + + These machines can load and run cassettes for the interact / hector1. + hec2hr - press 2 then 1 + hec2hrp - press 2 then 1 + hec2hrx - press 5 then 1 + hec2mx40 - press 5 then 1 + hec2mx80 - not compatible + victor - press R then L + + 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com + 31/06/2009 Video - Robbbert + + 29/10/2009 Update skeleton to functional machine + by yo_fr (jj.stac @ aliceadsl.fr) + + => add Keyboard, + => add color, + => add cassette, + => add sn76477 sound and 1bit sound, + => add joysticks (stick, pot, fire) + => add BR/HR switching + => add bank switch for HRX + => add device MX80c and bank switching for the ROM + Importante note : the keyboard function add been piked from + DChector project : http://dchector.free.fr/ made by DanielCoulom + (thank's Daniel) + 03/01/2010 Update and clean prog by yo_fr (jj.stac@aliceadsl.fr) + => add the port mapping for keyboard + 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M runnig! JJStacino + 11/11/2011 : add the minidisque support -3 pouces 1/2 driver- JJStacino + + don't forget to keep some information about these machine see DChector project : http://dchector.free.fr/ made by DanielCoulom + (and thanks to Daniel!) and Yves site : http://hectorvictor.free.fr/ (thank's too Yves!) + + TODO : Add the cartridge function, + Add diskette support, (done !) + Adjust the one shot and A/D timing (sn76477) +****************************************************************************/ +/* Joystick 1 : + clavier numerique : + (UP)5 + (left)1 (right)3 + (down)2 + + Fire <+> + Pot => home/end */ + + /* Joystick 0 : + arrows + (UP)^ + (left)<- (right)-> + (down)v + + Fire near <1> + Pot => INS /SUPPR + + Cassette : wav file (1 way, 16 bits, 44100hz) + K7 file (For data and games) + FOR file (for forth screen data) +*/ + +#include "emu.h" + +#include "imagedev/cassette.h" +#include "formats/hect_tap.h" +#include "imagedev/printer.h" +#include "sound/wave.h" /* for K7 sound*/ +#include "sound/discrete.h" /* for 1 Bit sound*/ +#include "machine/upd765.h" /* for floppy disc controller */ +#include "cpu/z80/z80.h" +#include "formats/hect_dsk.h" +#include "formats/hector_minidisc.h" +#include "includes/hec2hrp.h" + +/*****************************************************************************/ +static ADDRESS_MAP_START(hecdisc2_mem, AS_PROGRAM, 8, hec2hrp_state ) +/*****************************************************************************/ + ADDRESS_MAP_UNMAP_HIGH + + /* Hardward address mapping*/ + AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank3") /*zone with ROM at start up, RAM later*/ + + AM_RANGE( 0x4000, 0xffff ) AM_RAM + +ADDRESS_MAP_END + +static ADDRESS_MAP_START( hecdisc2_io , AS_IO, 8, hec2hrp_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // ROM Page managing + AM_RANGE(0x000,0x00f) AM_READWRITE(hector_disc2_io00_port_r, hector_disc2_io00_port_w ) + // RS232 - 8251 managing + AM_RANGE(0x020,0x02f) AM_READWRITE(hector_disc2_io20_port_r, hector_disc2_io20_port_w ) + // Hector communication managing + AM_RANGE(0x030,0x03f) AM_READWRITE(hector_disc2_io30_port_r, hector_disc2_io30_port_w ) + AM_RANGE(0x040,0x04f) AM_READWRITE(hector_disc2_io40_port_r, hector_disc2_io40_port_w ) + AM_RANGE(0x050,0x05f) AM_READWRITE(hector_disc2_io50_port_r, hector_disc2_io50_port_w ) + // uPD765 link: + AM_RANGE(0x060,0x061) AM_DEVICE("upd765", upd765a_device, map) + AM_RANGE(0x070,0x07f) AM_DEVREADWRITE("upd765", upd765a_device, mdma_r, mdma_w) +ADDRESS_MAP_END + +/*****************************************************************************/ +static ADDRESS_MAP_START(hec2hrp_mem, AS_PROGRAM, 8, hec2hrp_state ) +/*****************************************************************************/ + ADDRESS_MAP_UNMAP_HIGH + /* Hardware address mapping*/ + AM_RANGE(0x0800,0x0808) AM_WRITE(hector_switch_bank_w)/* Bank management*/ + AM_RANGE(0x1000,0x1000) AM_WRITE(hector_color_a_w) /* Color c0/c1*/ + AM_RANGE(0x1800,0x1800) AM_WRITE(hector_color_b_w) /* Color c2/c3*/ + AM_RANGE(0x2000,0x2003) AM_WRITE(hector_sn_2000_w) /* Sound*/ + AM_RANGE(0x2800,0x2803) AM_WRITE(hector_sn_2800_w) /* Sound*/ + AM_RANGE(0x3000,0x3000) AM_READWRITE(hector_cassette_r, hector_sn_3000_w)/* Write necessary*/ + AM_RANGE(0x3800,0x3807) AM_READWRITE(hector_keyboard_r, hector_keyboard_w) /* Keyboard*/ + + /* Main ROM page*/ + AM_RANGE(0x0000,0x3fff) AM_ROM + + /* Video br mapping*/ + AM_RANGE(0x4000,0x49ff) AM_RAM AM_SHARE("videoram") + /* continous RAM*/ + AM_RANGE(0x4A00,0xbfff) AM_RAM + /* from 0xC000 to 0xFFFF => Bank Ram for video and data !*/ + AM_RANGE(0xc000,0xffff) AM_RAM AM_SHARE("hector_videoram") +ADDRESS_MAP_END + +/*****************************************************************************/ +static ADDRESS_MAP_START(hec2hrx_mem, AS_PROGRAM, 8, hec2hrp_state ) +/*****************************************************************************/ + ADDRESS_MAP_UNMAP_HIGH + /* Hardware address mapping*/ + AM_RANGE(0x0800,0x0808) AM_WRITE(hector_switch_bank_w)/* Bank management*/ + AM_RANGE(0x1000,0x1000) AM_WRITE(hector_color_a_w) /* Color c0/c1*/ + AM_RANGE(0x1800,0x1800) AM_WRITE(hector_color_b_w) /* Color c2/c3*/ + AM_RANGE(0x2000,0x2003) AM_WRITE(hector_sn_2000_w) /* Sound*/ + AM_RANGE(0x2800,0x2803) AM_WRITE(hector_sn_2800_w) /* Sound*/ + AM_RANGE(0x3000,0x3000) AM_READWRITE(hector_cassette_r, hector_sn_3000_w)/* Write necessary*/ + AM_RANGE(0x3800,0x3807) AM_READWRITE(hector_keyboard_r, hector_keyboard_w) /* Keyboard*/ + + /* Main ROM page*/ + AM_RANGE(0x0000,0x3fff) AM_ROMBANK("bank2") + + /* Video br mapping*/ + AM_RANGE(0x4000,0x49ff) AM_RAM AM_SHARE("videoram") + /* continous RAM*/ + AM_RANGE(0x4A00,0xbfff) AM_RAM + /* from 0xC000 to 0xFFFF => Bank Ram for video and data !*/ + AM_RANGE(0xc000,0xffff) AM_RAMBANK("bank1") AM_SHARE("hector_videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( hec2hrp_io , AS_IO, 8, hec2hrp_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x000,0x0ff) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( hec2hrx_io , AS_IO, 8, hec2hrp_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0f0,0x0ff) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( hec2mdhrx_io , AS_IO, 8, hec2hrp_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + + // Minidisc commands and changing the rom page !*/ + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("wd179x", fd1793_t, read, write) + AM_RANGE(0x08, 0x08) AM_WRITE(minidisc_control_w) + AM_RANGE(0x0f0,0x0ff) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( hec2mx40_io , AS_IO, 8, hec2hrp_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x000,0x0ef) AM_WRITE(hector_mx40_io_port_w ) + AM_RANGE(0x0f0,0x0f3) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( hec2mx80_io , AS_IO, 8, hec2hrp_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x000,0x0ef) AM_WRITE(hector_mx80_io_port_w ) + AM_RANGE(0x0f0,0x0f3) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) + + +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( hec2hrp ) + /* keyboard input */ + PORT_START("KEY.0") /* [0] - port 3000 @ 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("KEY.1") /* [1] - port 3000 @ 1 */ /* touches => 2 1 0 / . - , + */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + + PORT_START("KEY.2") /* [1] - port 3000 @ 2 */ /* touches => .. 9 8 7 6 5 4 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 :") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 !") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_START("KEY.3") /* [1] - port 3000 @ 3 */ /* touches => B A .. ? .. = .. ; */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_START("KEY.4") /* [1] - port 3000 @ 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("KEY.5") /* [1] - port 3000 @ 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + + PORT_START("KEY.6") /* [1] - port 3000 @ 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + + PORT_START("KEY.7") /* [1] - port 3000 @ 7 JOYSTICK */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) LEFT") PORT_CODE(KEYCODE_1_PAD) // Joy(1) on numpad + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) RIGHT") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) UP") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) DOWN") PORT_CODE(KEYCODE_2_PAD) + + PORT_START("KEY.8") /* [1] - port 3000 @ 8 not for the real machine, but to emulate the analog signal of the joystick */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) FIRE") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) FIRE") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)+") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)-") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)+") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)-") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/*****************************************************************************/ +MACHINE_START_MEMBER(hec2hrp_state,hec2hrp) +/*****************************************************************************/ +{ + hector_init(); +} + +MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrp) +{ + // Machines init + hector_reset(1, 0); +} +/*****************************************************************************/ +MACHINE_START_MEMBER(hec2hrp_state,hec2hrx) +/*****************************************************************************/ +{ + UINT8 *RAM = memregion("maincpu" )->base(); // pointer to mess ram + //Patch rom possible ! + //RAMD2[0xff6b] = 0x0ff; // force verbose mode hector ! + + // Memory install for bank switching + membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000] ); // Mess ram + membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, m_hector_videoram_hrx); // Video ram + + // Set bank HECTOR_BANK_PROG as basic bank + membank("bank1")->set_entry(HECTOR_BANK_PROG); + +/******************************************************SPECIFIQUE MX ***************************/ + membank("bank2")->configure_entry(HECTORMX_BANK_PAGE0 , &RAM[0x0000] ); // Mess ram + membank("bank2")->configure_entry(HECTORMX_BANK_PAGE1 , memregion("page1")->base() ); // Rom page 1 + membank("bank2")->configure_entry(HECTORMX_BANK_PAGE2 , memregion("page2")->base() ); // Rom page 2 + membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); +/******************************************************SPECIFIQUE MX ***************************/ + +/*************************************************SPECIFIQUE DISK II ***************************/ + membank("bank3")->configure_entry(DISCII_BANK_ROM , memregion("rom_disc2")->base() ); // ROM + membank("bank3")->configure_entry(DISCII_BANK_RAM , memregion("disc2mem" )->base() ); // RAM + membank("bank3")->set_entry(DISCII_BANK_ROM); +/*************************************************SPECIFIQUE DISK II ***************************/ + + // As video HR ram is in bank, use extern memory + m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); + + hector_init(); +} +/*****************************************************************************/ +MACHINE_START_MEMBER(hec2hrp_state,hec2mdhrx) +/*****************************************************************************/ +//minidisc +{ + UINT8 *RAM = memregion("maincpu" )->base(); // pointer to mess ram + + // Memory install for bank switching + membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000] ); // Mess ram + membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, m_hector_videoram_hrx); // Video ram + + // Set bank HECTOR_BANK_PROG as basic bank + membank("bank1")->set_entry(HECTOR_BANK_PROG); + //Here the bank 5 is not used for the language switch but for the floppy ROM..... + /******************************************************SPECIFIQUE Mini disque ***************************/ + membank("bank2")->configure_entry(HECTOR_BANK_BASE , &RAM[0x0000] ); // Rom base page + membank("bank2")->configure_entry(HECTOR_BANK_DISC , memregion("page2")->base() ); // Rom page mini disc + membank("bank2")->set_entry(HECTOR_BANK_BASE); + /******************************************************SPECIFIQUE Mini disque ***************************/ + + // As video HR ram is in bank, use extern memory + m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); + + hector_init(); +} +MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrx) +{ + //Hector Memory + membank("bank1")->set_entry(HECTOR_BANK_PROG); + membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); + //DISK II Memory + membank("bank3")->set_entry(DISCII_BANK_ROM); + + // Machines init + hector_reset(1, 1); + hector_disc2_reset(); +} +//minidisc +MACHINE_RESET_MEMBER(hec2hrp_state,hec2mdhrx) +{ + //Hector Memory + membank("bank1")->set_entry(HECTOR_BANK_PROG); + membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); + + // Machines init + hector_reset(1, 0); +} + +/***********************************************************/ +/********* mini disque interface ***************************/ +/***********************************************************/ + +FLOPPY_FORMATS_MEMBER( hec2hrp_state::minidisc_formats ) + FLOPPY_HMD_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( minidisc_floppies ) + SLOT_INTERFACE("dd", FLOPPY_35_DD) +SLOT_INTERFACE_END + + +/******************************************************************************/ +static MACHINE_CONFIG_START( hec2hr, hec2hrp_state ) +/******************************************************************************/ + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(hec2hrp_mem) + MCFG_CPU_IO_MAP(hec2hrp_io) + MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) /* put on the Z80 irq in Hz*/ + MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrp) + MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrp) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ + MCFG_SCREEN_SIZE(512, 230) + MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) + MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) + + MCFG_FRAGMENT_ADD(hector_audio) + + /* Gestion cassette*/ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(hector_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + +MACHINE_CONFIG_END + +/*****************************************************************************/ +static MACHINE_CONFIG_START( hec2hrp, hec2hrp_state ) +/*****************************************************************************/ + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(hec2hrp_mem) + MCFG_CPU_IO_MAP(hec2hrp_io) + MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) /* put on the Z80 irq in Hz*/ + MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrp) + MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrp) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ + MCFG_SCREEN_SIZE(512, 230) + MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) + MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) + + MCFG_FRAGMENT_ADD(hector_audio) + + /* Gestion cassette*/ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(hector_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + +MACHINE_CONFIG_END + +static SLOT_INTERFACE_START( hector_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +/*****************************************************************************/ +static MACHINE_CONFIG_START( hec2mx40, hec2hrp_state ) +/*****************************************************************************/ + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(hec2hrx_mem) + MCFG_CPU_IO_MAP(hec2mx40_io) + MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz + + /* Disc II unit */ + MCFG_CPU_ADD("disc2cpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(hecdisc2_mem) + MCFG_CPU_IO_MAP(hecdisc2_io) + MCFG_UPD765A_ADD("upd765", false, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_interrupt)) + MCFG_UPD765_DRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_dma_irq)) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) + MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ + MCFG_SCREEN_SIZE(512, 230) + MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) + MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) + + MCFG_FRAGMENT_ADD(hector_audio) + + /* Gestion cassette*/ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(hector_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + +MACHINE_CONFIG_END +/*****************************************************************************/ +static MACHINE_CONFIG_START( hec2hrx, hec2hrp_state ) +/*****************************************************************************/ +/* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(hec2hrx_mem) + MCFG_CPU_IO_MAP(hec2hrx_io) + MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz + MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) + MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) + + /* Disc II unit */ + MCFG_CPU_ADD("disc2cpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(hecdisc2_mem) + MCFG_CPU_IO_MAP(hecdisc2_io) + MCFG_UPD765A_ADD("upd765", false, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_interrupt)) + MCFG_UPD765_DRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_dma_irq)) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ + MCFG_SCREEN_SIZE(512, 230) + MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) + MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) + + MCFG_FRAGMENT_ADD(hector_audio) + + // Gestion cassette + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(hector_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + +MACHINE_CONFIG_END +/*****************************************************************************/ +static MACHINE_CONFIG_START( hec2mdhrx, hec2hrp_state ) +/*****************************************************************************/ +// minidisc +/* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(hec2hrx_mem) + MCFG_CPU_IO_MAP(hec2mdhrx_io) + MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz + MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2mdhrx) + MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2mdhrx) + + /* Mini Disc */ + MCFG_FD1793_ADD("wd179x", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("wd179x:0", minidisc_floppies, "dd", hec2hrp_state::minidisc_formats) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ + MCFG_SCREEN_SIZE(512, 230) + MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) + MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) + MCFG_SCREEN_PALETTE("palette") + + MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) + MCFG_PALETTE_ADD("palette", 16) + MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) + + MCFG_FRAGMENT_ADD(hector_audio) + + // Gestion cassette + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(hector_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + +MACHINE_CONFIG_END + +/*****************************************************************************/ +static MACHINE_CONFIG_START( hec2mx80, hec2hrp_state ) +/*****************************************************************************/ + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(hec2hrx_mem) + MCFG_CPU_IO_MAP(hec2mx80_io) + MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz + MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) + MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) + + /* Disc II unit */ + MCFG_CPU_ADD("disc2cpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(hecdisc2_mem) + MCFG_CPU_IO_MAP(hecdisc2_io) + MCFG_UPD765A_ADD("upd765", false, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_interrupt)) + MCFG_UPD765_DRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_dma_irq)) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ + MCFG_SCREEN_SIZE(512, 230) + MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) + MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) + + MCFG_FRAGMENT_ADD(hector_audio) + + /* Gestion cassette*/ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(hector_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + + MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( hec2hr ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "2hr.bin", 0x0000, 0x1000, CRC(84b9e672) SHA1(8c8b089166122eee565addaed10f84c5ce6d849b)) + ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) + ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( victor ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "victor.rom", 0x0000, 0x1000, CRC(d1e9508f) SHA1(d0f1bdcd39917fafc8859223ab38eee2a7dc85ff)) + ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) + ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( hec2hrp ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hector2hrp.rom", 0x0000, 0x4000, CRC(983f52e4) SHA1(71695941d689827356042ee52ffe55ce7e6b8ecd)) + ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) + ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) + ROM_REGION( 0x10000, "disc2cpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x04000, "rom_disc2", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( hec2hrx ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hector2hrx.rom", 0x0000, 0x4000, CRC(f047c521) SHA1(744336b2acc76acd7c245b562bdc96dca155b066)) + ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) + ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) + ROM_REGION( 0x10000, "disc2cpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x04000, "rom_disc2", ROMREGION_ERASEFF ) + ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) + ROM_REGION( 0x10000, "disc2mem", ROMREGION_ERASE00 ) +ROM_END +// minidisc +ROM_START( hec2mdhrx ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mdic1.bin" , 0x0000,0x2000, CRC(ddda1065) SHA1(e7bba14a72605238d2f8299da029b8320a563254)) + ROM_LOAD( "mdicmb.bin" , 0x2000,0x2000, CRC(d8090747) SHA1(f2925b68002307562e2ea5e36b740e5458f0f0eb)) + + ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) // Page 1 = unused page + ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) // Page 2 = minidisc page + ROM_LOAD( "mdic3.bin" , 0x0000,0x2000, CRC(87801816) SHA1(ddf441f40df014b237cdf17430d1989f3a452d04)) + ROM_LOAD( "mdicmb.bin" , 0x2000,0x2000, CRC(d8090747) SHA1(f2925b68002307562e2ea5e36b740e5458f0f0eb)) +ROM_END + +ROM_START( hec2mx80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mx80c_page0.rom" , 0x0000,0x4000, CRC(a75945cf) SHA1(542391e482271be0997b069cf13c8b5dae28feec)) + ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) + ROM_LOAD( "mx80c_page1.rom", 0x0000, 0x4000, CRC(4615f57c) SHA1(5de291bf3ae0320915133b99f1a088cb56c41658)) + ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) + ROM_LOAD( "mx80c_page2.rom" , 0x0000,0x4000, CRC(2d5d975e) SHA1(48307132e0f3fad0262859bb8142d108f694a436)) + + ROM_REGION( 0x04000, "rom_disc2", ROMREGION_ERASEFF ) + ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) + ROM_REGION( 0x10000, "disc2mem", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( hec2mx40 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mx40c_page0.rom" , 0x0000,0x4000, CRC(9bb5566d) SHA1(0c8c2e396ec8eb995d2b621abe06b6968ca5d0aa)) + ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) + ROM_LOAD( "mx40c_page1.rom", 0x0000, 0x4000, CRC(192a76fa) SHA1(062aa6df0b554b85774d4b5edeea8496a4baca35)) + ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) + ROM_LOAD( "mx40c_page2.rom" , 0x0000,0x4000, CRC(ef1b2654) SHA1(66624ea040cb7ede4720ad2eca0738d0d3bad89a)) + + ROM_REGION( 0x04000, "rom_disc2", ROMREGION_ERASEFF ) +// ROM_LOAD( "d360k.bin" , 0x0000,0x4000, CRC(2454eacb) SHA1(dc0d5a7d5891a7e422d9d142a2419527bb15dfd5)) + ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) +// ROM_LOAD( "d200k.bin" , 0x0000,0x4000, CRC(e2801377) SHA1(0926df5b417ecd8013e35c71b76780c5a25c1cbf)) + ROM_REGION( 0x10000, "disc2mem", ROMREGION_ERASE00 ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP(1983, hec2hrp, 0, interact, hec2hrp, hec2hrp, driver_device,0, "Micronique", "Hector 2HR+", MACHINE_IMPERFECT_SOUND) +COMP(1980, victor, hec2hrp, 0, hec2hrp, hec2hrp, driver_device,0, "Micronique", "Victor", MACHINE_IMPERFECT_SOUND) +COMP(1983, hec2hr, hec2hrp, 0, hec2hr, hec2hrp, driver_device,0, "Micronique", "Hector 2HR", MACHINE_IMPERFECT_SOUND) +COMP(1984, hec2hrx, hec2hrp, 0, hec2hrx, hec2hrp, driver_device,0, "Micronique", "Hector HRX + Disc2", MACHINE_IMPERFECT_SOUND) +COMP(1985, hec2mdhrx, hec2hrp, 0, hec2mdhrx, hec2hrp, driver_device,0, "Micronique", "Hector HRX + mini Disc" , MACHINE_IMPERFECT_SOUND) +COMP(1985, hec2mx80, hec2hrp, 0, hec2mx80, hec2hrp, driver_device,0, "Micronique", "Hector MX 80c + Disc2" , MACHINE_IMPERFECT_SOUND) +COMP(1985, hec2mx40, hec2hrp, 0, hec2mx40, hec2hrp, driver_device,0, "Micronique", "Hector MX 40c + Disc2" , MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/hh_cop400.c b/src/mame/drivers/hh_cop400.c new file mode 100644 index 00000000000..3400b2d9ab5 --- /dev/null +++ b/src/mame/drivers/hh_cop400.c @@ -0,0 +1,841 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Sean Riddle +/*************************************************************************** + + National Semiconductor COP400 MCU handhelds or other simple devices, + mostly LED electronic games/toys. + + TODO: + - non-working games are due to MCU emulation bugs? + - better not start on visually dumped games before other games are working + (due to possible dump errors, hard to distinguish between that or MCU bug) + +***************************************************************************/ + +#include "emu.h" +#include "cpu/cop400/cop400.h" +#include "sound/speaker.h" + +// internal artwork +#include "einvaderc.lh" // test-layout(but still playable) +#include "funjacks.lh" +#include "funrlgl.lh" +#include "lightfgt.lh" // clickable + +//#include "hh_cop400_test.lh" // common test-layout - use external artwork + + +class hh_cop400_state : public driver_device +{ +public: + hh_cop400_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN"), + m_speaker(*this, "speaker"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices + required_device m_maincpu; + optional_ioport_array<5> m_inp_matrix; // max 5 + optional_device m_speaker; + + // misc common + UINT8 m_l; // MCU port L write data + UINT8 m_g; // MCU port G write data + UINT8 m_d; // MCU port D write data + int m_so; // MCU SO line state + int m_sk; // MCU SK line state + UINT16 m_inp_mux; // multiplexed inputs mask + + UINT8 read_inputs(int columns); + + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) + + UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + UINT32 m_display_cache[0x20]; // (internal use) + UINT8 m_display_decay[0x20][0x20]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); + +protected: + virtual void machine_start(); + virtual void machine_reset(); +}; + + +// machine start/reset + +void hh_cop400_state::machine_start() +{ + // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, ~0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + memset(m_display_segmask, 0, sizeof(m_display_segmask)); + + m_l = 0; + m_g = 0; + m_d = 0; + m_so = 0; + m_sk = 0; + m_inp_mux = 0; + + // register for savestates + save_item(NAME(m_display_maxy)); + save_item(NAME(m_display_maxx)); + save_item(NAME(m_display_wait)); + + save_item(NAME(m_display_state)); + /* save_item(NAME(m_display_cache)); */ // don't save! + save_item(NAME(m_display_decay)); + save_item(NAME(m_display_segmask)); + + save_item(NAME(m_l)); + save_item(NAME(m_g)); + save_item(NAME(m_d)); + save_item(NAME(m_so)); + save_item(NAME(m_sk)); + save_item(NAME(m_inp_mux)); +} + +void hh_cop400_state::machine_reset() +{ +} + + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// The device may strobe the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +void hh_cop400_state::display_update() +{ + UINT32 active_state[0x20]; + + for (int y = 0; y < m_display_maxy; y++) + { + active_state[y] = 0; + + for (int x = 0; x <= m_display_maxx; x++) + { + // turn on powered segments + if (m_display_state[y] >> x & 1) + m_display_decay[y][x] = m_display_wait; + + // determine active state + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; + active_state[y] |= (ds << x); + } + } + + // on difference, send to output + for (int y = 0; y < m_display_maxy; y++) + if (m_display_cache[y] != active_state[y]) + { + if (m_display_segmask[y] != 0) + output_set_digit_value(y, active_state[y] & m_display_segmask[y]); + + const int mul = (m_display_maxx <= 10) ? 10 : 100; + for (int x = 0; x <= m_display_maxx; x++) + { + int state = active_state[y] >> x & 1; + char buf1[0x10]; // lampyx + char buf2[0x10]; // y.x + + if (x == m_display_maxx) + { + // always-on if selected + sprintf(buf1, "lamp%da", y); + sprintf(buf2, "%d.a", y); + } + else + { + sprintf(buf1, "lamp%d", y * mul + x); + sprintf(buf2, "%d.%d", y, x); + } + output_set_value(buf1, state); + output_set_value(buf2, state); + } + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(hh_cop400_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int y = 0; y < m_display_maxy; y++) + for (int x = 0; x <= m_display_maxx; x++) + if (m_display_decay[y][x] != 0) + m_display_decay[y][x]--; + + display_update(); +} + +void hh_cop400_state::set_display_size(int maxx, int maxy) +{ + m_display_maxx = maxx; + m_display_maxy = maxy; +} + +void hh_cop400_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) +{ + set_display_size(maxx, maxy); + + // update current state + UINT32 mask = (1 << maxx) - 1; + for (int y = 0; y < maxy; y++) + m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; + + display_update(); +} + + +UINT8 hh_cop400_state::read_inputs(int columns) +{ + // active low + UINT8 ret = 0xff; + + // read selected input rows + for (int i = 0; i < columns; i++) + if (m_inp_mux >> i & 1) + ret &= m_inp_matrix[i]->read(); + + return ret; +} + + + +/*************************************************************************** + + Minidrivers (subclass, I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + Castle Toy Einstein + * COP421 MCU labeled ~/927 COP421-NEZ/N + * 4 lamps, 1bit sound + +***************************************************************************/ + +class ctstein_state : public hh_cop400_state +{ +public: + ctstein_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } +}; + +// handlers + +//.. + + +// config + +static INPUT_PORTS_START( ctstein ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ctstein, ctstein_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP421, 1000000) // approximation - RC osc. R=12K to +6V, C=100pf to GND + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) +// MCFG_DEFAULT_LAYOUT(layout_ctstein) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex Space Invader + * COP444L MCU labeled /B138 COPL444-HRZ/N INV II (die labeled HRZ COP 444L/A) + * 3 7seg LEDs, LED matrix and overlay mask, 1bit sound + + The first version was on TMS1100 (see hh_tms1k.c), this is the reprogrammed + second release with a gray case instead of black. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class einvaderc_state : public hh_cop400_state +{ +public: + einvaderc_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_g); + DECLARE_WRITE_LINE_MEMBER(write_sk); + DECLARE_WRITE_LINE_MEMBER(write_so); + DECLARE_WRITE8_MEMBER(write_l); +}; + +// handlers + +void einvaderc_state::prepare_display() +{ + // D0-D2 are 7segs + for (int y = 0; y < 3; y++) + m_display_segmask[y] = 0x7f; + + // update display + UINT8 l = BITSWAP8(m_l,7,6,0,1,2,3,4,5); + UINT16 grid = (m_d | m_g << 4 | m_sk << 8 | m_so << 9) ^ 0x0ff; + display_matrix(8, 10, l, grid); +} + +WRITE8_MEMBER(einvaderc_state::write_d) +{ + // D: led grid 0-3 + m_d = data; + prepare_display(); +} + +WRITE8_MEMBER(einvaderc_state::write_g) +{ + // G: led grid 4-7 + m_g = data; + prepare_display(); +} + +WRITE_LINE_MEMBER(einvaderc_state::write_sk) +{ + // SK: speaker out + led grid 8 + m_speaker->level_w(state); + m_sk = state; + prepare_display(); +} + +WRITE_LINE_MEMBER(einvaderc_state::write_so) +{ + // SO: led grid 9 + m_so = state; + prepare_display(); +} + +WRITE8_MEMBER(einvaderc_state::write_l) +{ + // L: led state/segment + m_l = data; + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( einvaderc ) + PORT_START("IN.0") // port IN + PORT_CONFNAME( 0x01, 0x01, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x01, "Amateur" ) + PORT_CONFSETTING( 0x00, "Professional" ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( einvaderc, einvaderc_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP444, 1000000) // approximation - RC osc. R=47K to +9V, C=100pf to GND(-9V) + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed + MCFG_COP400_READ_IN_CB(IOPORT("IN.0")) + MCFG_COP400_WRITE_D_CB(WRITE8(einvaderc_state, write_d)) + MCFG_COP400_WRITE_G_CB(WRITE8(einvaderc_state, write_g)) + MCFG_COP400_WRITE_SK_CB(WRITELINE(einvaderc_state, write_sk)) + MCFG_COP400_WRITE_SO_CB(WRITELINE(einvaderc_state, write_so)) + MCFG_COP400_WRITE_L_CB(WRITE8(einvaderc_state, write_l)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_einvaderc) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Mattel Funtronics Jacks + * COP410L MCU bonded directly to PCB (die labeled COP410L/B NGS) + * 8 LEDs, 1bit sound + +***************************************************************************/ + +class funjacks_state : public hh_cop400_state +{ +public: + funjacks_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_l); + DECLARE_WRITE8_MEMBER(write_g); + DECLARE_READ8_MEMBER(read_l); + DECLARE_READ8_MEMBER(read_g); +}; + +// handlers + +WRITE8_MEMBER(funjacks_state::write_d) +{ + // D: led grid + input mux + m_d = m_inp_mux = data ^ 0xf; + display_matrix(2, 4, m_l, m_d); +} + +WRITE8_MEMBER(funjacks_state::write_l) +{ + // L0,L1: led state + m_l = data & 3; + display_matrix(2, 4, m_l, m_d); +} + +WRITE8_MEMBER(funjacks_state::write_g) +{ + // G1: speaker out + m_speaker->level_w(data >> 1 & 1); + m_g = data; +} + +READ8_MEMBER(funjacks_state::read_l) +{ + // L4,L5: multiplexed inputs + return read_inputs(3) & 0x30; +} + +READ8_MEMBER(funjacks_state::read_g) +{ + // G1: speaker out state + // G2,G3: inputs + return m_inp_matrix[3]->read() | (m_g & 2); +} + + +// config + +static INPUT_PORTS_START( funjacks ) + PORT_START("IN.0") // D0 port G + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) + + PORT_START("IN.1") // D1 port G + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) + + PORT_START("IN.2") // D2 port G + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) // positioned at 1 o'clock on panel, increment clockwise + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) + + PORT_START("IN.3") // port G + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) // speaker + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START ) + PORT_CONFNAME( 0x08, 0x00, "Players" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x08, "2" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( funjacks, funjacks_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP410, 2000000) // approximation - RC osc. R=47K, C=56pf + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED) // guessed + MCFG_COP400_WRITE_D_CB(WRITE8(funjacks_state, write_d)) + MCFG_COP400_WRITE_L_CB(WRITE8(funjacks_state, write_l)) + MCFG_COP400_WRITE_G_CB(WRITE8(funjacks_state, write_g)) + MCFG_COP400_READ_L_CB(READ8(funjacks_state, read_l)) + MCFG_COP400_READ_G_CB(READ8(funjacks_state, read_g)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_funjacks) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Mattel Funtronics Red Light Green Light + * COP410L MCU bonded directly to PCB (die labeled COP410L/B NHZ) + * 14 LEDs, 1bit sound + + known releases: + - USA: Funtronics Red Light Green Light + - USA(rerelease): Funtronics Hot Wheels Drag Race + +***************************************************************************/ + +class funrlgl_state : public hh_cop400_state +{ +public: + funrlgl_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_l); + DECLARE_WRITE8_MEMBER(write_g); + DECLARE_READ8_MEMBER(read_g); + + DECLARE_INPUT_CHANGED_MEMBER(reset_button); +}; + +// handlers + +WRITE8_MEMBER(funrlgl_state::write_d) +{ + // D: led grid + m_d = data ^ 0xf; + display_matrix(4, 4, m_l, m_d); +} + +WRITE8_MEMBER(funrlgl_state::write_l) +{ + // L0-L3: led state + // L4-L7: N/C + m_l = data & 0xf; + display_matrix(4, 4, m_l, m_d); +} + +WRITE8_MEMBER(funrlgl_state::write_g) +{ + // G3: speaker out + m_speaker->level_w(data >> 3 & 1); +} + + +// config + +static INPUT_PORTS_START( funrlgl ) + PORT_START("IN.0") // port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_CONFNAME( 0x04, 0x04, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x04, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("IN.1") // fake + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, funrlgl_state, reset_button, NULL) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(funrlgl_state::reset_button) +{ + // middle button is directly tied to MCU reset pin + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); +} + + +static MACHINE_CONFIG_START( funrlgl, funrlgl_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP410, 2000000) // approximation - RC osc. R=51K, C=91pf + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED) // guessed + MCFG_COP400_WRITE_D_CB(WRITE8(funrlgl_state, write_d)) + MCFG_COP400_WRITE_L_CB(WRITE8(funrlgl_state, write_l)) + MCFG_COP400_WRITE_G_CB(WRITE8(funrlgl_state, write_g)) + MCFG_COP400_READ_G_CB(IOPORT("IN.0")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_funrlgl) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Milton Bradley Plus One + * COP410L MCU in 8-pin DIP, labeled ~/029 MM 57405 (die labeled COP410L/B NNE) + * 4 sensors(1 on each die side), 1bit sound + +***************************************************************************/ + +class plus1_state : public hh_cop400_state +{ +public: + plus1_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } +}; + +// handlers + +//.. + + +// config + +static INPUT_PORTS_START( plus1 ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( plus1, plus1_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP410, 1000000) // approximation - RC osc. R=51K to +5V, C=100pf to GND + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED) // guessed + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) +// MCFG_DEFAULT_LAYOUT(layout_plus1) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Milton Bradley (Electronic) Lightfight + * COP421L MCU labeled /B119 COP421L-HLA/N + * LED matrix, 1bit sound + + Xbox-shaped electronic game for 2 or more players, with long diagonal buttons + next to each outer LED. The main object of the game is to pinpoint a light + by pressing 2 buttons. To start, press a skill-level button(P2 button 7/8/9) + after selecting a game mode(P1 button 6-10). + + The game variations are: + 1: LightFight + 2: NightFight + 3: RiteSite + 4: QuiteBrite + 5: RightLight + +***************************************************************************/ + +class lightfgt_state : public hh_cop400_state +{ +public: + lightfgt_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_cop400_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE_LINE_MEMBER(write_so); + DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE8_MEMBER(write_l); + DECLARE_WRITE_LINE_MEMBER(write_sk); + DECLARE_READ8_MEMBER(read_g); +}; + +// handlers + +void lightfgt_state::prepare_display() +{ + UINT8 grid = (m_so | m_d << 1) ^ 0x1f; + display_matrix(5, 5, m_l, grid); +} + +WRITE_LINE_MEMBER(lightfgt_state::write_so) +{ + // SO: led grid 0 (and input mux) + m_so = state; + prepare_display(); +} + +WRITE8_MEMBER(lightfgt_state::write_d) +{ + // D: led grid 1-4 (and input mux) + m_d = data; + prepare_display(); +} + +WRITE8_MEMBER(lightfgt_state::write_l) +{ + // L0-L4: led state + // L5-L7: N/C + m_l = data & 0x1f; + prepare_display(); +} + +WRITE_LINE_MEMBER(lightfgt_state::write_sk) +{ + // SK: speaker out + m_speaker->level_w(state); +} + +READ8_MEMBER(lightfgt_state::read_g) +{ + // G: multiplexed inputs + m_inp_mux = (m_so | m_d << 1) ^ 0x1f; + return read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( lightfgt ) + PORT_START("IN.0") // SO port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) // note: button 1 is on the left side from player perspective + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_COCKTAIL + + PORT_START("IN.1") // D0 port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_COCKTAIL + + PORT_START("IN.2") // D1 port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_COCKTAIL + + PORT_START("IN.3") // D2 port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON9 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_COCKTAIL + + PORT_START("IN.4") // D3 port G + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON10 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_COCKTAIL +INPUT_PORTS_END + +static MACHINE_CONFIG_START( lightfgt, lightfgt_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", COP421, 950000) // approximation - RC osc. R=82K to +6V, C=56pf to GND(-6V) + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed + MCFG_COP400_WRITE_SO_CB(WRITELINE(lightfgt_state, write_so)) + MCFG_COP400_WRITE_D_CB(WRITE8(lightfgt_state, write_d)) + MCFG_COP400_WRITE_L_CB(WRITE8(lightfgt_state, write_l)) + MCFG_COP400_WRITE_SK_CB(WRITELINE(lightfgt_state, write_sk)) + MCFG_COP400_READ_G_CB(READ8(lightfgt_state, read_g)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_lightfgt) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( ctstein ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "cop421-nez_n", 0x0000, 0x0400, CRC(16148e03) SHA1(b2b74891d36813d9a1eefd56a925054997c4b7f7) ) // 2nd half empty +ROM_END + + +ROM_START( einvaderc ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "copl444-hrz_n_inv_ii", 0x0000, 0x0800, CRC(76400f38) SHA1(0e92ab0517f7b7687293b189d30d57110df20fe0) ) +ROM_END + + +ROM_START( funjacks ) + ROM_REGION( 0x0200, "maincpu", 0 ) + ROM_LOAD( "cop410l_b_ngs", 0x0000, 0x0200, CRC(863368ea) SHA1(f116cc27ae721b3a3e178fa13765808bdc275663) ) +ROM_END + + +ROM_START( funrlgl ) + ROM_REGION( 0x0200, "maincpu", 0 ) + ROM_LOAD( "cop410l_b_nhz", 0x0000, 0x0200, CRC(4065c3ce) SHA1(f0bc8125d922949e0d7ab1ba89c805a836d20e09) ) +ROM_END + + +ROM_START( plus1 ) + ROM_REGION( 0x0200, "maincpu", 0 ) + ROM_LOAD( "cop410l_b_nne", 0x0000, 0x0200, BAD_DUMP CRC(8626fdb8) SHA1(fd241b6dde0e4e86b439cb2c5bb3a82fb257d7e1) ) // still need to verify +ROM_END + + +ROM_START( lightfgt ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "cop421l-hla_n", 0x0000, 0x0400, CRC(aceb2d65) SHA1(2328cbb195faf93c575f3afa3a1fe0079180edd7) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +CONS( 1979, ctstein, 0, 0, ctstein, ctstein, driver_device, 0, "Castle Toy", "Einstein (Castle Toy)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) + +CONS( 1981, einvaderc, einvader, 0, einvaderc, einvaderc, driver_device, 0, "Entex", "Space Invader (Entex, COP444)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) + +CONS( 1979, funjacks, 0, 0, funjacks, funjacks, driver_device, 0, "Mattel", "Funtronics Jacks", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +CONS( 1979, funrlgl, 0, 0, funrlgl, funrlgl, driver_device, 0, "Mattel", "Funtronics Red Light Green Light", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) + +CONS( 1980, plus1, 0, 0, plus1, plus1, driver_device, 0, "Milton Bradley", "Plus One", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +CONS( 1981, lightfgt, 0, 0, lightfgt, lightfgt, driver_device, 0, "Milton Bradley", "Lightfight", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/hh_hmcs40.c b/src/mame/drivers/hh_hmcs40.c new file mode 100644 index 00000000000..765c453ce13 --- /dev/null +++ b/src/mame/drivers/hh_hmcs40.c @@ -0,0 +1,4178 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Kevin Horton +/*************************************************************************** + + Hitachi HMCS40 MCU tabletops/handhelds or other simple devices, + most of them are VFD electronic games/toys. + + known chips: + + serial device etc. +---------------------------------------------------------------- + @07 HD38750A 1979, Bambino Knock-Em Out Boxing (ET-06B) + @08 HD38750A 1979, Bambino Dribble Away Basketball (ET-05) + @45 HD38750A 1981, VTech Invaders + *56 HD38750A 1981, Actronics(Hanzawa) Twinvader (small brown version) + *58 HD38750A 1981, Actronics(Hanzawa) Challenge Racer/Ludotronic(Hanzawa) Grand Prix Turbo + *62 HD38750A 1982, Actronics(Hanzawa) Pack'n Maze + + @04 HD38800A 1980, Gakken Heiankyo Alien + @25 HD38800A 1981, Coleco Alien Attack + @27 HD38800A 1981, Bandai Packri Monster + *31 HD38800A 1981, Entex Select-a-Game cartridge: Space Invader 2 (have dump) + *37 HD38800A 1981, Entex Select-a-Game cartridge: Baseball 4 (have dump) + *38 HD38800A 1981, Entex Select-a-Game cartridge: Pinball (have dump) + *41 HD38800A 1982, Gakken Puck Monster + *51 HD38800A 1981, Actronics(Hanzawa) Twinvader (larger white version) + @70 HD38800A 1982, Coleco Galaxian + @73 HD38800A 1982, Bandai(Mattel) Star Hawk (PT-317B) + @77 HD38800A 1982, Bandai Frisky Tom (PT-327A) + @88 HD38800A 1984, Tomy Tron (THN-02) + + @01 HD38800B 1982, Gakken Crazy Kong + @19 HD38800B 1982, Bandai Zaxxon + @23 HD38800B 1982, Tomy Kingman (THF-01II) + *24 HD38800B 1982, Actronics(Hanzawa) Wanted G-Man + *29 HD38800B 1984, Tomy Portable 6000 Bombman + *35 HD38800B 1983, Bandai Gundam vs Gelgoog Zaku + @43 HD38800B 1983, Bandai Dokodemo Dorayaki Doraemon (PT-412) + @52 HD38800B 1983, Bandai Ultra Man (PT-424) + + @09 HD38820A 1980, Mattel World Championship Baseball + @13 HD38820A 1981, Entex Galaxian 2 + @23 HD38820A 1981, Entex Pac Man 2 + @28 HD38820A 1981, Coleco Pac-Man (ver 1) + @29 HD38820A 1981, Coleco Pac-Man (ver 2) + *32 HD38820A 198?, Gakken Super Cobra + *38 HD38820A 1982, Entex Crazy Climber + @42 HD38820A 1982, Entex Stargate + @43 HD38820A 1982, Entex Turtles + @45 HD38820A 1982, Coleco Donkey Kong + @49 HD38820A 1983, Bandai Zackman + @61 HD38820A 1983, Coleco Ms. Pac-Man + @63 HD38820A 1983, Bandai Pengo + @65 HD38820A 1983, Bandai Burger Time (PT-389) + @69 HD38820A 1983, Gakken Dig Dug + @70 HD38820A 1983, Parker Brothers Q*Bert + @85 HD38820A 1984, Bandai Machine Man (PT-438) + @88 HD38820A 1984, Bandai Pair Match (PT-460) (1/2) + @89 HD38820A 1984, Bandai Pair Match (PT-460) (2/2) + + *75 HD44801A 1982, Alpha 8201 protection MCU (have dump) + + *35 HD44801B 1983, Alpha 8302 protection MCU (have dump) + *42 HD44801B 1984, Alpha 8303 protection MCU (have dump) + + (* denotes not yet emulated by MAME, @ denotes it's in this driver) + + + TODO: + - cdkong discrete sound (simple volume decay, simulated for now) + - cgalaxn discrete sound (alien attacking sound effect) + - gckong random lockups (tap the jump button repeatedly): mcu stack overflow, + works ok if stack levels is increased, 38800 B rev. has more stack levels? + Or it could be a race condition: irq happening too late/early. + - epacman booting the game in demo mode, pacman should go straight to the + upper-left power pill: mcu cycle/interrupt timing related + - Though very uncommon when compared to games with LED/lamp display, + some games may manipulate VFD plate brightness by strobing it longer, + eg. cgalaxn when the player ship explodes. + +***************************************************************************/ + +#include "emu.h" +#include "cpu/hmcs40/hmcs40.h" +#include "cpu/cop400/cop400.h" +#include "sound/speaker.h" + +// internal artwork +#include "pairmtch.lh" + +#include "hh_hmcs40_test.lh" // common test-layout - use external artwork + + +class hh_hmcs40_state : public driver_device +{ +public: + hh_hmcs40_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_inp_matrix(*this, "IN"), + m_speaker(*this, "speaker"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices + required_device m_maincpu; + optional_device m_audiocpu; + optional_ioport_array<7> m_inp_matrix; // max 7 + optional_device m_speaker; + + // misc common + UINT8 m_r[8]; // MCU R ports write data (optional) + UINT16 m_d; // MCU D port write data (optional) + UINT8 m_int[2]; // MCU INT0/1 pins state + UINT16 m_inp_mux; // multiplexed inputs mask + + UINT16 read_inputs(int columns); + void refresh_interrupts(void); + void set_interrupt(int line, int state); + DECLARE_INPUT_CHANGED_MEMBER(single_interrupt_line); + + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 47 for now) + + UINT32 m_grid; // VFD current row data + UINT64 m_plate; // VFD current column data + + UINT64 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + UINT64 m_display_cache[0x20]; // (internal use) + UINT8 m_display_decay[0x20][0x40]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety); + +protected: + virtual void machine_start(); + virtual void machine_reset(); +}; + + +// machine start/reset + +void hh_hmcs40_state::machine_start() +{ + // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, ~0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + memset(m_display_segmask, 0, sizeof(m_display_segmask)); + + memset(m_r, 0, sizeof(m_r)); + memset(m_int, 0, sizeof(m_int)); + m_d = 0; + m_inp_mux = 0; + m_grid = 0; + m_plate = 0; + + // register for savestates + save_item(NAME(m_display_maxy)); + save_item(NAME(m_display_maxx)); + save_item(NAME(m_display_wait)); + + save_item(NAME(m_display_state)); + /* save_item(NAME(m_display_cache)); */ // don't save! + save_item(NAME(m_display_decay)); + save_item(NAME(m_display_segmask)); + + save_item(NAME(m_r)); + save_item(NAME(m_int)); + save_item(NAME(m_d)); + save_item(NAME(m_inp_mux)); + save_item(NAME(m_grid)); + save_item(NAME(m_plate)); +} + +void hh_hmcs40_state::machine_reset() +{ + refresh_interrupts(); +} + + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// The device may strobe the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +void hh_hmcs40_state::display_update() +{ + UINT64 active_state[0x20]; + + for (int y = 0; y < m_display_maxy; y++) + { + active_state[y] = 0; + + for (int x = 0; x <= m_display_maxx; x++) + { + // turn on powered segments + if (m_display_state[y] >> x & 1) + m_display_decay[y][x] = m_display_wait; + + // determine active state + UINT64 ds = (m_display_decay[y][x] != 0) ? 1 : 0; + active_state[y] |= (ds << x); + } + } + + // on difference, send to output + for (int y = 0; y < m_display_maxy; y++) + if (m_display_cache[y] != active_state[y]) + { + if (m_display_segmask[y] != 0) + output_set_digit_value(y, active_state[y] & m_display_segmask[y]); + + const int mul = (m_display_maxx <= 10) ? 10 : 100; + for (int x = 0; x <= m_display_maxx; x++) + { + int state = active_state[y] >> x & 1; + char buf1[0x10]; // lampyx + char buf2[0x10]; // y.x + + if (x == m_display_maxx) + { + // always-on if selected + sprintf(buf1, "lamp%da", y); + sprintf(buf2, "%d.a", y); + } + else + { + sprintf(buf1, "lamp%d", y * mul + x); + sprintf(buf2, "%d.%d", y, x); + } + output_set_value(buf1, state); + output_set_value(buf2, state); + } + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(hh_hmcs40_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int y = 0; y < m_display_maxy; y++) + for (int x = 0; x <= m_display_maxx; x++) + if (m_display_decay[y][x] != 0) + m_display_decay[y][x]--; + + display_update(); +} + +void hh_hmcs40_state::set_display_size(int maxx, int maxy) +{ + m_display_maxx = maxx; + m_display_maxy = maxy; +} + +void hh_hmcs40_state::display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety) +{ + set_display_size(maxx, maxy); + + // update current state + UINT64 mask = (U64(1) << maxx) - 1; + for (int y = 0; y < maxy; y++) + m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (U64(1) << maxx)) : 0; + + display_update(); +} + + +UINT16 hh_hmcs40_state::read_inputs(int columns) +{ + UINT16 ret = 0; + + // read selected input rows + for (int i = 0; i < columns; i++) + if (m_inp_mux >> i & 1) + ret |= m_inp_matrix[i]->read(); + + return ret; +} + + +// interrupt handling + +void hh_hmcs40_state::refresh_interrupts() +{ + for (int i = 0; i < 2; i++) + m_maincpu->set_input_line(i, m_int[i] ? ASSERT_LINE : CLEAR_LINE); +} + +void hh_hmcs40_state::set_interrupt(int line, int state) +{ + line = line ? 1 : 0; + state = state ? 1 : 0; + + if (state != m_int[line]) + { + if (machine().phase() >= MACHINE_PHASE_RESET) + m_maincpu->set_input_line(line, state ? ASSERT_LINE : CLEAR_LINE); + m_int[line] = state; + } +} + +INPUT_CHANGED_MEMBER(hh_hmcs40_state::single_interrupt_line) +{ + set_interrupt((int)(FPTR)param, newval); +} + + + +/*************************************************************************** + + Minidrivers (subclass, I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + Bambino Dribble Away Basketball (manufactured in Japan) + * PCBs are labeled Emix Corp. ET-05 + * Hitachi HD38750A08 MCU + * green VFD display Emix-106, with bezel overlay + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bambball_state : public hh_hmcs40_state +{ +public: + bambball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(bambball_state::plate_w) +{ + // R1x-R3x(,D0-D3): vfd matrix plate + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT16 plate = BITSWAP16(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2); + display_matrix(16, 9, plate, m_grid); +} + +WRITE16_MEMBER(bambball_state::grid_w) +{ + // D4: speaker out + m_speaker->level_w(data >> 4 & 1); + + // D7-D10: input mux + m_inp_mux = data >> 7 & 0xf; + + // D7-D15: vfd matrix grid + m_grid = data >> 7 & 0x1ff; + + // D0-D3: more plates (update display there) + plate_w(space, 3 + HMCS40_PORT_R1X, data & 0xf); +} + +READ8_MEMBER(bambball_state::input_r) +{ + // R0x: multiplexed inputs + return read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( bambball ) + PORT_START("IN.0") // D7 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Dribble Low") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Dribble Medium") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Dribble High") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Shoot") + + PORT_START("IN.1") // D8 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // D9 port R0x + PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Display") + + PORT_START("IN.3") // D10 port R0x + PORT_CONFNAME( 0x07, 0x01, "Skill Level") + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + PORT_CONFNAME( 0x08, 0x08, "Players" ) + PORT_CONFSETTING( 0x08, "1" ) + PORT_CONFSETTING( 0x00, "2" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( bambball, bambball_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38750, 400000) // approximation + MCFG_HMCS40_READ_R_CB(0, READ8(bambball_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bambball_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bambball_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bambball_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bambball_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bambino Knock-Em Out Boxing + * PCBs are labeled Emix Corp. ET-06B + * Hitachi HD38750A07 MCU + * cyan VFD display Emix-103, with blue or green color overlay + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bmboxing_state : public hh_hmcs40_state +{ +public: + bmboxing_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +void bmboxing_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); + UINT32 plate = BITSWAP16(m_plate,15,14,13,12,1,2,0,3,11,4,10,7,5,6,9,8); + display_matrix(12, 9, plate, grid); +} + +WRITE8_MEMBER(bmboxing_state::plate_w) +{ + // R1x-R3x: vfd matrix plate + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(bmboxing_state::grid_w) +{ + // D13: speaker out + m_speaker->level_w(data >> 13 & 1); + + // D9-D12: input mux + m_inp_mux = data >> 9 & 0xf; + + // D4-D12: vfd matrix grid + m_grid = data >> 4 & 0x1ff; + prepare_display(); +} + +READ8_MEMBER(bmboxing_state::input_r) +{ + // R0x: multiplexed inputs + return read_inputs(4); +} + + +// config + +/* physical button layout and labels is like this: + + * left = P2 side * * right = P1 side * + + [ BACK ] [ HIGH ] (players sw) [ HIGH ] [ BACK ] + 1<--->2 [START/ + [NORMAL] [MEDIUM] RESET] [MEDIUM] [NORMAL] + 1<---OFF--->2 + [ DUCK ] [ LOW ] (skill lvl sw) [ LOW ] [ DUCK ] +*/ + +static INPUT_PORTS_START( bmboxing ) + PORT_START("IN.0") // D9 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("P1 Punch High") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P1 Punch Medium") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("P1 Punch Low") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // D10 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("P1 Position Normal") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("P1 Position Back") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("P1 Position Ducking") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // D11 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("P2 Punch High") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 Punch Medium") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("P2 Punch Low") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // D12 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 Position Normal") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("P2 Position Back") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("P2 Position Ducking") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // port D + PORT_CONFNAME( 0x0001, 0x0000, "Players" ) + PORT_CONFSETTING( 0x0000, "1" ) + PORT_CONFSETTING( 0x0001, "2" ) + PORT_CONFNAME( 0x0002, 0x0000, "Skill Level" ) + PORT_CONFSETTING( 0x0000, "1" ) + PORT_CONFSETTING( 0x0002, "2" ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0xfff8, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( bmboxing, bmboxing_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38750, 400000) // approximation + MCFG_HMCS40_READ_R_CB(0, READ8(bmboxing_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bmboxing_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bmboxing_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bmboxing_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bmboxing_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.4")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Frisky Tom (manufactured in Japan) + * PCBs are labeled Kaken Corp., PT-327A + * Hitachi HD38800A77 MCU + * cyan/red/green VFD display Futaba DM-43ZK 2E + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bfriskyt_state : public hh_hmcs40_state +{ +public: + bfriskyt_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int1(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +void bfriskyt_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7); + UINT32 plate = BITSWAP24(m_plate,23,22,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21); + display_matrix(22, 8, plate, grid); +} + +WRITE8_MEMBER(bfriskyt_state::plate_w) +{ + // R0x-R3x: vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(bfriskyt_state::grid_w) +{ + // D6: speaker out + m_speaker->level_w(data >> 6 & 1); + + // D11-D15: input mux + UINT8 inp_mux = data >> 11 & 0x1f; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int1(); + } + + // D8-D15: vfd matrix grid + m_grid = data >> 8 & 0xff; + + // D0-D5: more plates + m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x3f0000); + prepare_display(); +} + +void bfriskyt_state::update_int1() +{ + // INT1 on multiplexed inputs + set_interrupt(1, read_inputs(5)); +} + + +// config + +static INPUT_PORTS_START( bfriskyt ) + PORT_START("IN.0") // D11 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) + + PORT_START("IN.1") // D12 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) + + PORT_START("IN.2") // D13 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) + + PORT_START("IN.3") // D14 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) + + PORT_START("IN.4") // D15 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) + + PORT_START("IN.5") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(bfriskyt_state::input_changed) +{ + update_int1(); +} + + +static MACHINE_CONFIG_START( bfriskyt, bfriskyt_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bfriskyt_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bfriskyt_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bfriskyt_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bfriskyt_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bfriskyt_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Packri Monster (manufactured in Japan) + * PCB label DM-21ZA2 + * Hitachi HD38800A27 MCU + * cyan/red/green VFD display Futaba DM-21ZK 2B, with bezel overlay + + known releases: + - Japan: FL Packri Monster + - USA(World?): Packri Monster + - USA/Canada: Hungry Monster, published by Tandy + - other: Gobble Man/Ogre Monster, published by Tandy + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class packmon_state : public hh_hmcs40_state +{ +public: + packmon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ16_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(packmon_state::plate_w) +{ + // R0x-R3x(,D0-D3): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,0,1,2,3,4,5,6,19,18,17,16,15,14,13,12,11,10,9,8,7); + display_matrix(20, 10, plate, grid); +} + +WRITE16_MEMBER(packmon_state::grid_w) +{ + // D4: speaker out + m_speaker->level_w(data >> 4 & 1); + + // D11-D15: input mux + m_inp_mux = data >> 11 & 0x1f; + + // D6-D15: vfd matrix grid + m_grid = data >> 6 & 0x3ff; + + // D0-D3: plate 9-12 (update display there) + plate_w(space, 4, data & 0xf); +} + +READ16_MEMBER(packmon_state::input_r) +{ + // D5: multiplexed inputs + return read_inputs(5) & 0x20; +} + + +// config + +static INPUT_PORTS_START( packmon ) + PORT_START("IN.0") // D11 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START ) + + PORT_START("IN.1") // D12 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + + PORT_START("IN.2") // D13 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + + PORT_START("IN.3") // D14 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + + PORT_START("IN.4") // D15 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( packmon, packmon_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(packmon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(packmon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(packmon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(packmon_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(packmon_state, grid_w)) + MCFG_HMCS40_READ_D_CB(READ16(packmon_state, input_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai/Mattel Star Hawk (manufactured in Japan) + * PCBs are labeled Kaken, PT-317B + * Hitachi HD38800A73 MCU + * cyan/red VFD display Futaba DM-41ZK, with partial color overlay + bezel + + Kaken was a subsidiary of Bandai. The original Japanese release is unknown, + was it canceled and only released in the USA? + + known releases: + - Japan: ? + - USA: Star Hawk, published by Mattel + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class msthawk_state : public hh_hmcs40_state +{ +public: + msthawk_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int0(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +void msthawk_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + UINT32 plate = BITSWAP24(m_plate,23,22,21,19,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); + display_matrix(21, 10, plate, grid); +} + +WRITE8_MEMBER(msthawk_state::plate_w) +{ + // R0x-R3x: vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(msthawk_state::grid_w) +{ + // D5: speaker out + m_speaker->level_w(data >> 5 & 1); + + // D10-D15: input mux + UINT8 inp_mux = data >> 10 & 0x3f; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int0(); + } + + // D6-D15: vfd matrix grid + m_grid = data >> 6 & 0x3ff; + + // D0-D4: more plates + m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x1f0000); + prepare_display(); +} + +void msthawk_state::update_int0() +{ + // INT0 on multiplexed inputs + set_interrupt(0, read_inputs(6)); +} + + +// config + +static INPUT_PORTS_START( msthawk ) + PORT_START("IN.0") // D10 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) PORT_NAME("Score") + + PORT_START("IN.1") // D11 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) PORT_NAME("Land") + + PORT_START("IN.2") // D12 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) + + PORT_START("IN.3") // D13 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) + + PORT_START("IN.4") // D14 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) + + PORT_START("IN.5") // D15 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) + + PORT_START("IN.6") // INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) PORT_NAME("Fire") +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(msthawk_state::input_changed) +{ + update_int0(); +} + + +static MACHINE_CONFIG_START( msthawk, msthawk_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(msthawk_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(msthawk_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(msthawk_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(msthawk_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(msthawk_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Zaxxon (manufactured in Japan, licensed from Sega) + * PCB label FL Zaxxon + * Hitachi HD38800B19 MCU + * cyan/red/blue VFD display NEC FIP11BM24T no. 4-8, half of it reflected + with a one-way mirror to give the illusion of a 3D display + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bzaxxon_state : public hh_hmcs40_state +{ +public: + bzaxxon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int1(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +WRITE8_MEMBER(bzaxxon_state::plate_w) +{ + // R0x-R3x(,D0-D2): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,6,7,8,9,10,5,4,3,2,1,0); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,5,7,0,1,2,3,4,6,19,16,17,18,15,14,13,12,10,8,9,11) | 0x800; + display_matrix(20, 11, plate, grid); +} + +WRITE16_MEMBER(bzaxxon_state::grid_w) +{ + // D4: speaker out + m_speaker->level_w(data >> 4 & 1); + + // D7-D10: input mux + UINT8 inp_mux = data >> 7 & 0xf; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int1(); + } + + // D5-D15: vfd matrix grid + m_grid = data >> 5 & 0x7ff; + + // D0-D2: plate 7-9 (update display there) + plate_w(space, 4, data & 7); +} + +void bzaxxon_state::update_int1() +{ + // INT1 on multiplexed inputs + set_interrupt(1, read_inputs(4)); +} + + +// config + +static INPUT_PORTS_START( bzaxxon ) + PORT_START("IN.0") // D7 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bzaxxon_state, input_changed, NULL) + + PORT_START("IN.1") // D8 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, bzaxxon_state, input_changed, NULL) + + PORT_START("IN.2") // D9 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bzaxxon_state, input_changed, NULL) + + PORT_START("IN.3") // D10 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, bzaxxon_state, input_changed, NULL) + + PORT_START("IN.4") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) + + PORT_START("IN.5") // port D + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SELECT ) + PORT_BIT( 0xfff7, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(bzaxxon_state::input_changed) +{ + update_int1(); +} + + +static MACHINE_CONFIG_START( bzaxxon, bzaxxon_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bzaxxon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bzaxxon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bzaxxon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bzaxxon_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bzaxxon_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.5")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Zackman "The Pit, FL Exploration of Space" (manufactured in Japan) + * Hitachi QFP HD38820A49 MCU + * cyan/red/yellow VFD display Futaba DM-53Z 3E, with color overlay + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class zackman_state : public hh_hmcs40_state +{ +public: + zackman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int0(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +WRITE8_MEMBER(zackman_state::plate_w) +{ + // R0x-R6x(,D0,D1): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + UINT32 plate = BITSWAP32(m_plate,31,30,27,0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12); + display_matrix(29, 8, plate, grid); +} + +WRITE16_MEMBER(zackman_state::grid_w) +{ + // D2: speaker out + m_speaker->level_w(data >> 2 & 1); + + // D11-D14: input mux + UINT8 inp_mux = data >> 11 & 0xf; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int0(); + } + + // D8-D15: vfd matrix grid + m_grid = data >> 8 & 0xff; + + // D0,D1: plate 12,13 (update display there) + plate_w(space, 7, data & 3); +} + +void zackman_state::update_int0() +{ + // INT0 on multiplexed inputs + set_interrupt(0, read_inputs(4)); +} + + +// config + +static INPUT_PORTS_START( zackman ) + PORT_START("IN.0") // D11 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) + + PORT_START("IN.1") // D12 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) + + PORT_START("IN.2") // D13 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) + + PORT_START("IN.3") // D14 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) + + PORT_START("IN.4") // INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(zackman_state::input_changed) +{ + update_int0(); +} + + +static MACHINE_CONFIG_START( zackman, zackman_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(zackman_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Pengo (manufactured in Japan, licensed from Sega) + * PCB label FL Pengo(in katakana) + * Hitachi QFP HD38820A63 MCU + * cyan/red/blue VFD display Futaba DM-68ZK 3D DM-63 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bpengo_state : public hh_hmcs40_state +{ +public: + bpengo_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int0(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +void bpengo_state::prepare_display() +{ + UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + UINT32 plate = BITSWAP32(m_plate,31,30,29,28,23,22,21,16,17,18,19,20,27,26,25,24,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); + display_matrix(25, 8, plate, grid); +} + +WRITE8_MEMBER(bpengo_state::plate_w) +{ + // R0x-R6x: vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(bpengo_state::grid_w) +{ + // D10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // D12-D15: input mux + UINT8 inp_mux = data >> 12 & 0xf; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int0(); + } + + // D0-D7: vfd matrix grid + m_grid = data & 0xff; + prepare_display(); +} + +void bpengo_state::update_int0() +{ + // INT0 on multiplexed inputs + set_interrupt(0, read_inputs(4)); +} + + +// config + +static INPUT_PORTS_START( bpengo ) + PORT_START("IN.0") // D12 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, bpengo_state, input_changed, NULL) + + PORT_START("IN.1") // D13 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, bpengo_state, input_changed, NULL) + + PORT_START("IN.2") // D14 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bpengo_state, input_changed, NULL) + + PORT_START("IN.3") // D15 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bpengo_state, input_changed, NULL) + + PORT_START("IN.4") // INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) + + PORT_START("IN.5") // port D + PORT_CONFNAME( 0x0800, 0x0000, "Factory Test" ) + PORT_CONFSETTING( 0x0000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x0800, DEF_STR( On ) ) + PORT_BIT( 0xf7ff, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(bpengo_state::input_changed) +{ + update_int0(); +} + + +static MACHINE_CONFIG_START( bpengo, bpengo_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bpengo_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bpengo_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bpengo_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bpengo_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(bpengo_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(bpengo_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(bpengo_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bpengo_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.5")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Burger Time (manufactured in Japan, licensed from Data East) + * PCB label Kaken Corp. PT-389 Burger Time + * Hitachi QFP HD38820A65 MCU + * cyan/red/green VFD display NEC FIP6AM25T no. 21-21 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bbtime_state : public hh_hmcs40_state +{ +public: + bbtime_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int0(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +void bbtime_state::prepare_display() +{ + UINT8 grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5); + UINT32 plate = BITSWAP32(m_plate,31,30,29,28,25,24,26,27,22,23,15,14,12,11,10,8,7,6,4,1,5,9,13,3,2,16,17,18,19,20,0,21) | 0x1; + display_matrix(28, 6, plate, grid); +} + +WRITE8_MEMBER(bbtime_state::plate_w) +{ + // R0x-R6x: vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(bbtime_state::grid_w) +{ + // D3: speaker out + m_speaker->level_w(data >> 3 & 1); + + // D10-D14: input mux + UINT8 inp_mux = data >> 10 & 0x1f; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int0(); + } + + // D4-D9: vfd matrix grid + m_grid = data >> 4 & 0x3f; + prepare_display(); +} + +void bbtime_state::update_int0() +{ + // INT0 on multiplexed inputs + set_interrupt(0, read_inputs(5)); +} + + +// config + +static INPUT_PORTS_START( bbtime ) + PORT_START("IN.0") // D10 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) + + PORT_START("IN.1") // D11 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) + + PORT_START("IN.2") // D12 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) + + PORT_START("IN.3") // D13 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) + + PORT_START("IN.4") // D14 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) + + PORT_START("IN.5") // INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(bbtime_state::input_changed) +{ + update_int0(); +} + + +static MACHINE_CONFIG_START( bbtime, bbtime_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bbtime_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bbtime_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bbtime_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bbtime_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(bbtime_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(bbtime_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(bbtime_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bbtime_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Dokodemo Dorayaki Doraemon (FL LSI Game Push Up) (manufactured in Japan) + * PCB label Kaken Corp PT-412 FL-Doreamon(in katakana) + * Hitachi HD38800B43 MCU + * cyan/red/blue VFD display Futaba DM-71 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bdoramon_state : public hh_hmcs40_state +{ +public: + bdoramon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); +}; + +// handlers + +WRITE8_MEMBER(bdoramon_state::plate_w) +{ + // R0x-R3x(,D0-D3): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,7,6); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,11,19,18,17,16,15,14,13,12,10,9,8,7,6,5,4,3,2,1,0); + display_matrix(19, 8, plate, grid); +} + +WRITE16_MEMBER(bdoramon_state::grid_w) +{ + // D7: speaker out + m_speaker->level_w(data >> 7 & 1); + + // D8-D15: vfd matrix grid + m_grid = data >> 8 & 0xff; + + // D0-D3: plate 15-18 (update display there) + plate_w(space, 4, data & 0xf); +} + + +// config + +static INPUT_PORTS_START( bdoramon ) + PORT_START("IN.0") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) + + PORT_START("IN.1") // INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) + + PORT_START("IN.2") // port D + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0xff8f, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // port R2x + PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_CONFNAME( 0x08, 0x00, "Factory Test" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x08, DEF_STR( On ) ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( bdoramon, bdoramon_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bdoramon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bdoramon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bdoramon_state, plate_w)) + MCFG_HMCS40_READ_R_CB(2, IOPORT("IN.3")) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bdoramon_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bdoramon_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.2")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Ultra Man (FL LSI Game Push Up) (manufactured in Japan) + * PCB label Kaken Corp. PT-424 FL Ultra Man + * Hitachi HD38800B52 MCU + * cyan/red/blue VFD display NEC FIP8BM25T no. 21-8 2 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bultrman_state : public hh_hmcs40_state +{ +public: + bultrman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); +}; + +// handlers + +WRITE8_MEMBER(bultrman_state::plate_w) +{ + // R0x-R3x(,D0-D2): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,16,15,14,13,12,11,2,10,9,8,7,6,5,4,3,0,1); + display_matrix(18, 8, plate, grid); +} + +WRITE16_MEMBER(bultrman_state::grid_w) +{ + // D7: speaker out + m_speaker->level_w(data >> 7 & 1); + + // D8-D15: vfd matrix grid + m_grid = data >> 8 & 0xff; + + // D0-D2: plate 15-17 (update display there) + plate_w(space, 4, data & 7); +} + + +// config + +static INPUT_PORTS_START( bultrman ) + PORT_START("IN.0") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) + + PORT_START("IN.1") // port D + PORT_CONFNAME( 0x0010, 0x0000, "Factory Test" ) + PORT_CONFSETTING( 0x0000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x0010, DEF_STR( On ) ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0xff8f, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( bultrman, bultrman_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bultrman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bultrman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bultrman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bultrman_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bultrman_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.1")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Machine Man (FL Flat Type) (manufactured in Japan) + * PCB label Kaken PT-438 + * Hitachi QFP HD38820A85 MCU + * cyan/red/green VFD display NEC FIP5CM33T no. 4 21 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class machiman_state : public hh_hmcs40_state +{ +public: + machiman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); +}; + +// handlers + +void machiman_state::prepare_display() +{ + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); + display_matrix(19, 5, plate, m_grid); +} + +WRITE8_MEMBER(machiman_state::plate_w) +{ + // R0x-R3x,R6012: vfd matrix plate + int shift = (offset == HMCS40_PORT_R6X) ? 16 : offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(machiman_state::grid_w) +{ + // D13: speaker out + m_speaker->level_w(data >> 13 & 1); + + // D0-D4: vfd matrix grid + m_grid = data & 0x1f; + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( machiman ) + PORT_START("IN.0") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) + + PORT_START("IN.1") // port D + PORT_BIT( 0x3fff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY +INPUT_PORTS_END + +static MACHINE_CONFIG_START( machiman, machiman_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(machiman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(machiman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(machiman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(machiman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(machiman_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(machiman_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.1")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Pair Match (manufactured in Japan) + * PCB label Kaken Corp. PT-460 + * Hitachi QFP HD38820A88 MCU(main), HD38820A89(audio) + * cyan/red VFD display + + This is a memory game, the difference is instead of pictures, the player + needs to match sound effects. It has an extra MCU for sound. The case is + shaped like a glossy black pyramid. Star Trek fans will recognize it as + a prop used in TNG Ten Forward. + + note: MAME external artwork is not needed for this game + +***************************************************************************/ + +class pairmtch_state : public hh_hmcs40_state +{ +public: + pairmtch_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); + + DECLARE_WRITE8_MEMBER(sound_w); + DECLARE_WRITE8_MEMBER(sound2_w); + DECLARE_WRITE16_MEMBER(speaker_w); +}; + +// handlers: maincpu side + +WRITE8_MEMBER(pairmtch_state::plate_w) +{ + // R2x,R3x,R6x: vfd matrix plate + int shift = (offset == HMCS40_PORT_R6X) ? 8 : (offset-2) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + display_matrix(12, 6, m_plate, m_grid); +} + +WRITE16_MEMBER(pairmtch_state::grid_w) +{ + // D7: sound reset (to audiocpu reset line) + m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x80) ? ASSERT_LINE : CLEAR_LINE); + + // D9: sound start (to audiocpu INT0) + m_audiocpu->set_input_line(0, (data & 0x200) ? ASSERT_LINE : CLEAR_LINE); + + // D10,D15: input mux + m_inp_mux = (data >> 10 & 1) | (data >> 14 & 2); + + // D0-D5: vfd matrix grid + m_grid = data & 0x3f; + display_matrix(12, 6, m_plate, m_grid); +} + +READ8_MEMBER(pairmtch_state::input_r) +{ + // R4x: multiplexed inputs + return read_inputs(2); +} + +WRITE8_MEMBER(pairmtch_state::sound_w) +{ + // R5x: soundlatch (to audiocpu R2x) + soundlatch_byte_w(space, 0, BITSWAP8(data,7,6,5,4,0,1,2,3)); +} + + +// handlers: audiocpu side + +WRITE8_MEMBER(pairmtch_state::sound2_w) +{ + // R2x: soundlatch (to maincpu R5x) + soundlatch2_byte_w(space, 0, BITSWAP8(data,7,6,5,4,0,1,2,3)); +} + +WRITE16_MEMBER(pairmtch_state::speaker_w) +{ + // D0: speaker out + m_speaker->level_w(data & 1); + + // D1: sound ack (to maincpu INT0) + m_maincpu->set_input_line(0, (data & 2) ? ASSERT_LINE : CLEAR_LINE); +} + + +// config + +static INPUT_PORTS_START( pairmtch ) + PORT_START("IN.0") // D10 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY + + PORT_START("IN.1") // D15 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + + PORT_START("IN.2") // port D + PORT_CONFNAME( 0x0040, 0x0000, "Factory Test" ) + PORT_CONFSETTING( 0x0000, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x0040, DEF_STR( On ) ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_CONFNAME( 0x0800, 0x0800, "Players" ) + PORT_CONFSETTING( 0x0800, "1" ) + PORT_CONFSETTING( 0x0000, "2" ) + PORT_CONFNAME( 0x3000, 0x2000, "Skill Level" ) + PORT_CONFSETTING( 0x2000, "1" ) + PORT_CONFSETTING( 0x1000, "2" ) + PORT_CONFSETTING( 0x0000, "3" ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x86bf, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( pairmtch, pairmtch_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(pairmtch_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(pairmtch_state, plate_w)) + MCFG_HMCS40_READ_R_CB(4, READ8(pairmtch_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(pairmtch_state, sound_w)) + MCFG_HMCS40_READ_R_CB(5, READ8(driver_device, soundlatch2_byte_r)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(pairmtch_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(pairmtch_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.2")) + + MCFG_CPU_ADD("audiocpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(pairmtch_state, sound2_w)) + MCFG_HMCS40_READ_R_CB(2, READ8(driver_device, soundlatch_byte_r)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(pairmtch_state, speaker_w)) + + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_pairmtch) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Alien Attack (manufactured in Taiwan) + * Hitachi HD38800A25 MCU + * cyan/red VFD display Futaba DM-19Z 1J + + It looks like Coleco took Gakken's Heiankyo Alien and turned it into a more + action-oriented game. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class alnattck_state : public hh_hmcs40_state +{ +public: + alnattck_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ16_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(alnattck_state::plate_w) +{ + // R0x-R3x(,D0-D3): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,16,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15); + display_matrix(20, 10, plate, m_grid); +} + +WRITE16_MEMBER(alnattck_state::grid_w) +{ + // D4: speaker out + m_speaker->level_w(data >> 4 & 1); + + // D7-D13: input mux + m_inp_mux = data >> 7 & 0x7f; + + // D6-D15: vfd matrix grid + m_grid = data >> 6 & 0x3ff; + + // D0-D3: plate 16-19 (update display there) + plate_w(space, 4, data & 0xf); +} + +READ16_MEMBER(alnattck_state::input_r) +{ + // D5: multiplexed inputs + return read_inputs(7) & 0x20; +} + + +// config + +static INPUT_PORTS_START( alnattck ) + PORT_START("IN.0") // D7 line D5 + PORT_CONFNAME( 0x20, 0x00, "Skill Level" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x20, "2" ) + + PORT_START("IN.1") // D8 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + + PORT_START("IN.2") // D9 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + + PORT_START("IN.3") // D10 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + + PORT_START("IN.4") // D11 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + + PORT_START("IN.5") // D12 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Move") + + PORT_START("IN.6") // D13 line D5 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Fire") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( alnattck, alnattck_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(alnattck_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(alnattck_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(alnattck_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(alnattck_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(alnattck_state, grid_w)) + MCFG_HMCS40_READ_D_CB(READ16(alnattck_state, input_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Donkey Kong (manufactured in Taiwan, licensed from Nintendo) + * PCB label Coleco Rev C 75790 DK + * Hitachi QFP HD38820A45 MCU + * cyan/red VFD display Futaba DM-47ZK 2K, with color overlay + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class cdkong_state : public hh_hmcs40_state +{ +public: + cdkong_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + int m_speaker_volume; + TIMER_DEVICE_CALLBACK_MEMBER(speaker_decay_sim); + +protected: + virtual void machine_start(); +}; + +// handlers + +// Sound is controlled by two pins: D3 for pitch, and R13 for on/off. When turned +// off, it does not mute instantly, but volume slowly decays. Until we emulate it +// with discrete audio, this crude simulation will do. + +#define CDKONG_SPEAKER_MAX 0x10000 +#define CDKONG_SPEAKER_DECAY 50 + +TIMER_DEVICE_CALLBACK_MEMBER(cdkong_state::speaker_decay_sim) +{ + m_speaker->set_output_gain(0, m_speaker_volume / (double)CDKONG_SPEAKER_MAX); + m_speaker_volume /= 2; +} + + +void cdkong_state::prepare_display() +{ + UINT32 plate = BITSWAP32(m_plate,31,30,29,24,0,16,8,1,23,17,9,2,18,10,25,27,26,3,15,27,11,11,14,22,6,13,21,5,19,12,20,4) | 0x800800; + display_matrix(29, 11, plate, m_grid); +} + +WRITE8_MEMBER(cdkong_state::plate_w) +{ + // R13: speaker on + if (offset == HMCS40_PORT_R1X && data & 8) + m_speaker_volume = CDKONG_SPEAKER_MAX; + + // R0x-R6x: vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(cdkong_state::grid_w) +{ + // D3: speaker out + m_speaker->level_w(data >> 3 & 1); + + // D4-D14: vfd matrix grid + m_grid = data >> 4 & 0x7ff; + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( cdkong ) + PORT_START("IN.0") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) + + PORT_START("IN.1") // port D + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x7ff8, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +void cdkong_state::machine_start() +{ + hh_hmcs40_state::machine_start(); + + // zerofill/init + m_speaker_volume = 0; + save_item(NAME(m_speaker_volume)); +} + +static MACHINE_CONFIG_START( cdkong, cdkong_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(cdkong_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.1")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("speaker_decay", cdkong_state, speaker_decay_sim, attotime::from_msec(CDKONG_SPEAKER_DECAY)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Galaxian (manufactured in Taiwan) + * PCB label Coleco Rev A 75718 + * Hitachi HD38800A70 MCU + * cyan/red VFD display Futaba DM-36Z 2H, with color overlay + + Select game mode on start: + - P1 Left: Galaxian (default game) + - P1 Right: Midway's Attackers + - P2 Left: Head-to-Head Galaxian (2-player mode, short) + - P2 Right: Head-to-Head Galaxian (2-player mode, long) + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class cgalaxn_state : public hh_hmcs40_state +{ +public: + cgalaxn_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE16_MEMBER(plate_w); + DECLARE_READ8_MEMBER(input_r); + + DECLARE_INPUT_CHANGED_MEMBER(player_switch); +}; + +// handlers + +void cgalaxn_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,1,2,0,11,10,9,8,7,6,5,4,3); + UINT16 plate = BITSWAP16(m_plate,15,14,6,5,4,3,2,1,7,8,9,10,11,0,12,13); + display_matrix(15, 12, plate, grid); +} + +WRITE8_MEMBER(cgalaxn_state::grid_w) +{ + // R10,R11: input mux + if (offset == HMCS40_PORT_R1X) + m_inp_mux = data & 3; + + // R1x-R3x: vfd matrix grid + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(cgalaxn_state::plate_w) +{ + // D0: speaker out + m_speaker->level_w(data & 1); + + // D1: start alien attack whine sound effect (edge triggered) + + // D2-D15: vfd matrix plate + m_plate = (m_plate & 0x4000) | (data >> 2 & 0x3fff); + prepare_display(); +} + +READ8_MEMBER(cgalaxn_state::input_r) +{ + // R0x: multiplexed inputs + return read_inputs(2); +} + + +// config + +static INPUT_PORTS_START( cgalaxn ) + PORT_START("IN.0") // R10 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + + PORT_START("IN.1") // R11 port R0x + PORT_CONFNAME( 0x01, 0x01, "Players" ) PORT_CHANGED_MEMBER(DEVICE_SELF, cgalaxn_state, player_switch, NULL) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) + + PORT_START("IN.3") // INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(cgalaxn_state::player_switch) +{ + // 2-player switch directly enables plate 14 + m_plate = (m_plate & 0x3fff) | (newval ? 0 : 0x4000); + prepare_display(); +} + + +static MACHINE_CONFIG_START( cgalaxn, cgalaxn_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_READ_R_CB(0, READ8(cgalaxn_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cgalaxn_state, grid_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cgalaxn_state, grid_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cgalaxn_state, grid_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(cgalaxn_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Pac-Man (manufactured in Taiwan, licensed from Midway) + * PCB label Coleco 75690 + * Hitachi QFP HD38820A28/29 MCU + * cyan/red VFD display Futaba DM-34Z 2A, with color overlay + + known releases: + - USA: Pac-Man, by Coleco (name-license from Midway) + - Japan: Super Puck Monster, published by Gakken + + Select game mode on start: + - P1 Right: Pac-Man (default game) + - P1 Left: Head-to-Head Pac-Man (2-player mode) + - P1 Up: Eat & Run + - P1 Down: Demo + + BTANB note: 1st version doesn't show the whole maze on power-on + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class cpacman_state : public hh_hmcs40_state +{ +public: + cpacman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(cpacman_state::plate_w) +{ + // R1x-R6x(,D1,D2): vfd matrix plate + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); + UINT32 plate = BITSWAP32(m_plate,31,30,29,28,27,0,1,2,3,8,9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12,4,5,6,7); + display_matrix(27, 11, plate, grid); +} + +WRITE16_MEMBER(cpacman_state::grid_w) +{ + // D0: speaker out + m_speaker->level_w(data & 1); + + // D13-D15: input mux + m_inp_mux = data >> 13 & 7; + + // D5-D15: vfd matrix grid + m_grid = data >> 5 & 0x7ff; + + // D1,D2: plate 8,14 (update display there) + plate_w(space, 6 + HMCS40_PORT_R1X, data >> 1 & 3); +} + +READ8_MEMBER(cpacman_state::input_r) +{ + // R0x: multiplexed inputs + return read_inputs(3); +} + + +// config + +static INPUT_PORTS_START( cpacman ) + PORT_START("IN.0") // D13 port R0x + PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // D14 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + + PORT_START("IN.2") // D15 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( cpacman, cpacman_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_READ_R_CB(0, READ8(cpacman_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(cpacman_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Ms. Pac-Man (manufactured in Taiwan, licensed from Midway) + * PCB label Coleco 911171 + * Hitachi QFP HD38820A61 MCU + * cyan/red VFD display Futaba DM-60Z 3I, with color overlay + + Select game mode on start: + - P1 Left: Ms. Pac-Man (default game) + - P1 Down: Head-to-Head Ms. Pac-Man (2-player mode) + - P1 Up: Demo + + BTANB note: in demo-mode, she hardly ever walks to the upper two rows + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class cmspacmn_state : public hh_hmcs40_state +{ +public: + cmspacmn_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(cmspacmn_state::plate_w) +{ + // R1x-R6x(,D0,D1): vfd matrix plate + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT16 grid = BITSWAP16(m_grid,15,14,13,11,10,9,8,7,6,5,4,3,2,1,0,1); + UINT64 plate = BIT(m_plate,15)<<32 | BITSWAP32(m_plate,14,13,12,4,5,6,7,24,23,25,22,21,20,13,24,3,19,14,12,11,24,2,10,8,7,25,0,9,1,18,17,16) | 0x1004080; + display_matrix(33, 12, plate, grid); +} + +WRITE16_MEMBER(cmspacmn_state::grid_w) +{ + // D2: speaker out + m_speaker->level_w(data >> 2 & 1); + + // D13-D15: input mux + m_inp_mux = data >> 13 & 7; + + // D5-D15: vfd matrix grid + m_grid = data >> 5 & 0x7ff; + + // D0,D1: more plates (update display there) + plate_w(space, 6 + HMCS40_PORT_R1X, data & 3); +} + +READ8_MEMBER(cmspacmn_state::input_r) +{ + // R0x: multiplexed inputs + return read_inputs(3); +} + + +// config + +static INPUT_PORTS_START( cmspacmn ) + PORT_START("IN.0") // D13 port R0x + PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // D14 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + + PORT_START("IN.2") // D15 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( cmspacmn, cmspacmn_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_READ_R_CB(0, READ8(cmspacmn_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(cmspacmn_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex Galaxian 2 (manufactured in Japan) + * PCB labels ENTEX GALAXIAN PB-118/116/097 80-210137/135/114 + * Hitachi QFP HD38820A13 MCU + * cyan/red/green VFD display Futaba DM-20 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class egalaxn2_state : public hh_hmcs40_state +{ +public: + egalaxn2_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +void egalaxn2_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,15,14,13,12,7,6,5,4,3,2,1,0,19,18,17,16,11,10,9,8); + display_matrix(24, 15, plate, grid); +} + +WRITE16_MEMBER(egalaxn2_state::grid_w) +{ + // D0: speaker out + m_speaker->level_w(data & 1); + + // D1-D4: input mux + m_inp_mux = data >> 1 & 0xf; + + // D1-D15: vfd matrix grid + m_grid = data >> 1 & 0x7fff; + prepare_display(); +} + +WRITE8_MEMBER(egalaxn2_state::plate_w) +{ + // R1x-R6x: vfd matrix plate + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +READ8_MEMBER(egalaxn2_state::input_r) +{ + // R0x: multiplexed inputs + return read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( egalaxn2 ) + PORT_START("IN.0") // D1 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + + PORT_START("IN.1") // D2 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY + + PORT_START("IN.2") // D3 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // D4 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) + PORT_CONFSETTING( 0x02, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_CONFNAME( 0x0c, 0x00, "Players" ) + PORT_CONFSETTING( 0x08, "0 (Demo)" ) // for Demo mode: need to hold down Fire button at power-on + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x04, "2" ) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( egalaxn2, egalaxn2_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_READ_R_CB(0, READ8(egalaxn2_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(egalaxn2_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex Pac Man 2 (manufactured in Japan) + * PCB labels ENTEX PAC-MAN PB-093/094 80-210149/50/51 + * Hitachi QFP HD38820A23 MCU + * cyan/red VFD display Futaba DM-28Z 1G(cyan Pac-Man) or DM-28 1K(orange Pac-Man) + + 2 VFD revisions are known, the difference is Pac-Man's color: cyan or red. + + NOTE!: MAME external artwork is required + +***************************************************************************/ +#if 0 +class epacman2_state : public egalaxn2_state +{ +public: + epacman2_state(const machine_config &mconfig, device_type type, const char *tag) + : egalaxn2_state(mconfig, type, tag) + { } +}; +#endif +// handlers are identical to Galaxian 2, so we can use those + +// config + +static INPUT_PORTS_START( epacman2 ) + PORT_START("IN.0") // D1 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + + PORT_START("IN.1") // D2 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY + + PORT_START("IN.2") // D3 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Skill Control") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Demo Light Test") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // D4 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFNAME( 0x0c, 0x04, "Players" ) + PORT_CONFSETTING( 0x08, "0 (Demo)" ) + PORT_CONFSETTING( 0x04, "1" ) + PORT_CONFSETTING( 0x00, "2" ) +INPUT_PORTS_END + + + + + +/*************************************************************************** + + Entex Turtles (manufactured in Japan) + * PCB label 560359 + * Hitachi QFP HD38820A43 MCU + * COP411L sub MCU, labeled COP411L-KED/N + * cyan/red/green VFD display NEC FIP15BM32T + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class eturtles_state : public hh_hmcs40_state +{ +public: + eturtles_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag), + m_cop_irq(0) + { } + + virtual void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + UINT8 m_cop_irq; + DECLARE_WRITE_LINE_MEMBER(speaker_w); + DECLARE_WRITE8_MEMBER(cop_irq_w); + DECLARE_READ8_MEMBER(cop_latch_r); + DECLARE_READ8_MEMBER(cop_ack_r); + + void update_int(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); + +protected: + virtual void machine_start(); +}; + +// handlers: maincpu side + +void eturtles_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,1,14,13,12,11,10,9,8,7,6,5,4,3,2,0); + UINT32 plate = BITSWAP32(m_plate,31,30,11,12,18,19,16,17,22,15,20,21,27,26,23,25,24,2,3,1,0,6,4,5,10,9,2,8,7,14,1,13); + display_matrix(30, 15, plate | (grid >> 5 & 8), grid); // grid 8 also forces plate 3 high +} + +WRITE8_MEMBER(eturtles_state::plate_w) +{ + m_r[offset] = data; + + // R0x-R6x: vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(eturtles_state::grid_w) +{ + m_d = data; + + // D1-D6: input mux + UINT8 inp_mux = data >> 1 & 0x3f; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int(); + } + + // D1-D15: vfd matrix grid + m_grid = data >> 1 & 0x7fff; + prepare_display(); +} + +void eturtles_state::update_int() +{ + // INT0/1 on multiplexed inputs, and from COP D0 + UINT8 inp = read_inputs(6); + set_interrupt(0, (inp & 1) | m_cop_irq); + set_interrupt(1, inp & 2); +} + + +// handlers: COP side + +WRITE_LINE_MEMBER(eturtles_state::speaker_w) +{ + // SK: speaker out + m_speaker->level_w(!state); +} + +WRITE8_MEMBER(eturtles_state::cop_irq_w) +{ + // D0: maincpu INT0 (active low) + m_cop_irq = ~data & 1; + update_int(); +} + +READ8_MEMBER(eturtles_state::cop_latch_r) +{ + // L0-L3: soundlatch from maincpu R0x + return m_r[0]; +} + +READ8_MEMBER(eturtles_state::cop_ack_r) +{ + // G0: ack from maincpu D0 + return m_d & 1; +} + + +// config + +static INPUT_PORTS_START( eturtles ) + PORT_START("IN.0") // D1 INT0/1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + + PORT_START("IN.1") // D2 INT0/1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + + PORT_START("IN.2") // D3 INT0/1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + + PORT_START("IN.3") // D4 INT0/1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + + PORT_START("IN.4") // D5 INT0/1 + PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + + PORT_START("IN.5") // D6 INT0/1 + PORT_CONFNAME( 0x03, 0x00, "Players" ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_CONFSETTING( 0x02, "0 (Demo)" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(eturtles_state::input_changed) +{ + update_int(); +} + + +void eturtles_state::machine_start() +{ + hh_hmcs40_state::machine_start(); + + // register for savestates + save_item(NAME(m_cop_irq)); +} + +static MACHINE_CONFIG_START( eturtles, eturtles_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(eturtles_state, grid_w)) + + MCFG_CPU_ADD("audiocpu", COP411, 215000) // approximation + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed + MCFG_COP400_WRITE_SK_CB(WRITELINE(eturtles_state, speaker_w)) + MCFG_COP400_WRITE_D_CB(WRITE8(eturtles_state, cop_irq_w)) + MCFG_COP400_READ_L_CB(READ8(eturtles_state, cop_latch_r)) + MCFG_COP400_READ_G_CB(READ8(eturtles_state, cop_ack_r)) + + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex Stargate (manufactured in Japan) + * PCB label 5603521/31 + * Hitachi QFP HD38820A42 MCU + * COP411L sub MCU, labeled ~/B8236 COP411L-KEC/N + * cyan/red/green VFD display NEC FIP15AM32T (EL628-003) no. 2-421, with partial color overlay + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class estargte_state : public eturtles_state +{ +public: + estargte_state(const machine_config &mconfig, device_type type, const char *tag) + : eturtles_state(mconfig, type, tag) + { } + + virtual void prepare_display(); + DECLARE_READ8_MEMBER(cop_data_r); +}; + +// handlers (most of it is in eturtles_state above) + +void estargte_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,0,14,13,12,11,10,9,8,7,6,5,4,3,2,1); + UINT32 plate = BITSWAP32(m_plate,31,30,29,15,17,19,21,23,25,27,26,24,3,22,20,18,16,14,12,10,8,6,4,2,0,1,3,5,7,9,11,13); + display_matrix(29, 14, plate, grid); +} + +READ8_MEMBER(estargte_state::cop_data_r) +{ + // L0-L3: soundlatch from maincpu R0x + // L7: ack from maincpu D0 + return m_r[0] | (m_d << 7 & 0x80); +} + + +// config + +static INPUT_PORTS_START( estargte ) + PORT_START("IN.0") // D1 INT0/1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Inviso") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Smart Bomb") + + PORT_START("IN.1") // D2 INT0/1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Fire") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Change Direction") + + PORT_START("IN.2") // D3 INT0/1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + + PORT_START("IN.3") // D4 INT0/1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Thrust") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // D5 INT0/1 + PORT_CONFNAME( 0x01, 0x00, "Players" ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_CONFSETTING( 0x00, "0 (Demo)" ) // yes, same value as 1-player, hold the Inviso button at boot to enter demo mode + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) + PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + + PORT_START("IN.5") // D6 INT0/1 + PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( estargte, estargte_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(eturtles_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(eturtles_state, grid_w)) + + MCFG_CPU_ADD("audiocpu", COP411, 190000) // approximation + MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed + MCFG_COP400_WRITE_SK_CB(WRITELINE(eturtles_state, speaker_w)) + MCFG_COP400_WRITE_D_CB(WRITE8(eturtles_state, cop_irq_w)) + MCFG_COP400_READ_L_CB(READ8(estargte_state, cop_data_r)) + + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Gakken Heiankyo Alien (manufactured in Japan) + * Hitachi HD38800A04 MCU + * cyan/red VFD display Futaba DM-11Z 1H + + known releases: + - Japan: Heiankyo Alien + - USA: Earth Invaders, published by CGL + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class ghalien_state : public hh_hmcs40_state +{ +public: + ghalien_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ16_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(ghalien_state::plate_w) +{ + // R0x-R3x(,D10-D13): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,14,12,10,8,9,13,15,2,0,1,3,11,7,5,4,6,19,17,16,18); + display_matrix(20, 10, plate, grid); +} + +WRITE16_MEMBER(ghalien_state::grid_w) +{ + // D14: speaker out + m_speaker->level_w(data >> 14 & 1); + + // D0-D6: input mux + m_inp_mux = data & 0x7f; + + // D0-D9: vfd matrix grid + m_grid = data & 0x3ff; + + // D10-D13: more plates (update display there) + plate_w(space, 4, data >> 10 & 0xf); +} + +READ16_MEMBER(ghalien_state::input_r) +{ + // D15: multiplexed inputs + return read_inputs(7) & 0x8000; +} + + +// config + +static INPUT_PORTS_START( ghalien ) + PORT_START("IN.0") // D0 line D15 + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + + PORT_START("IN.1") // D1 line D15 + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + + PORT_START("IN.2") // D2 line D15 + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + + PORT_START("IN.3") // D3 line D15 + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + + PORT_START("IN.4") // D4 line D15 + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Dig") + + PORT_START("IN.5") // D5 line D15 + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Bury") + + PORT_START("IN.6") // D6 line D15 + PORT_CONFNAME( 0x8000, 0x0000, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x0000, "Amateur" ) + PORT_CONFSETTING( 0x8000, "Professional" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ghalien, ghalien_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(ghalien_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(ghalien_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(ghalien_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(ghalien_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(ghalien_state, grid_w)) + MCFG_HMCS40_READ_D_CB(READ16(ghalien_state, input_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Gakken Crazy Kong (manufactured in Japan) + * PCB label ZENY 5603601 + * Hitachi HD38800B01 MCU + * cyan/red/blue VFD display Futaba DM-54Z 2H, with bezel overlay + + known releases: + - Japan: Crazy Kong + - USA: Super Kong, published by CGL + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class gckong_state : public hh_hmcs40_state +{ +public: + gckong_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int1(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +WRITE8_MEMBER(gckong_state::plate_w) +{ + // R0x-R3x(,D0,D1): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); + UINT32 plate = BITSWAP32(m_plate,31,30,29,28,27,26,25,6,7,8,12,13,14,15,16,17,18,17,16,12,11,10,9,8,7,6,5,4,3,2,1,0) | 0x8000; + display_matrix(32, 11, plate, grid); +} + +WRITE16_MEMBER(gckong_state::grid_w) +{ + // D2: speaker out + m_speaker->level_w(data >> 2 & 1); + + // D5-D8: input mux + UINT8 inp_mux = data >> 5 & 0xf; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int1(); + } + + // D5-D15: vfd matrix grid + m_grid = data >> 5 & 0x7ff; + + // D0,D1: more plates (update display there) + plate_w(space, 4, data & 3); +} + +void gckong_state::update_int1() +{ + // INT1 on multiplexed inputs + set_interrupt(1, read_inputs(4)); +} + + +// config + +static INPUT_PORTS_START( gckong ) + PORT_START("IN.0") // D5 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gckong_state, input_changed, NULL) + + PORT_START("IN.1") // D6 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, gckong_state, input_changed, NULL) + + PORT_START("IN.2") // D7 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gckong_state, input_changed, NULL) + + PORT_START("IN.3") // D8 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, gckong_state, input_changed, NULL) + + PORT_START("IN.4") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) + + PORT_START("IN.5") // port D + PORT_CONFNAME( 0x0010, 0x0000, "Skill Level" ) + PORT_CONFSETTING( 0x0000, "A" ) + PORT_CONFSETTING( 0x0010, "B" ) + PORT_BIT( 0xffef, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(gckong_state::input_changed) +{ + update_int1(); +} + + +static MACHINE_CONFIG_START( gckong, gckong_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(gckong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(gckong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(gckong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(gckong_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(gckong_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.5")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Gakken Dig Dug (manufactured in Japan) + * PCB label Gakken DIG-DAG KS-004283(A/B) + * Hitachi QFP HD38820A69 MCU + * cyan/red/green VFD display Futaba DM-69Z 3F, with color overlay + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class gdigdug_state : public hh_hmcs40_state +{ +public: + gdigdug_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int1(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +WRITE8_MEMBER(gdigdug_state::plate_w) +{ + // R0x-R6x(,D0-D3): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT32 plate = BITSWAP32(m_plate,30,31,0,1,2,3,4,5,6,7,20,21,22,27,26,25,28,29,24,23,15,14,13,12,8,9,10,11,19,18,17,16); + display_matrix(32, 9, plate, m_grid); +} + +WRITE16_MEMBER(gdigdug_state::grid_w) +{ + // D6: speaker out + m_speaker->level_w(data >> 6 & 1); + + // D11-D15: input mux + UINT8 inp_mux = data >> 11 & 0x1f; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int1(); + } + + // D7-D15: vfd matrix grid + m_grid = data >> 7 & 0x1ff; + + // D0-D3: more plates (update display there) + plate_w(space, 7, data & 0xf); +} + +void gdigdug_state::update_int1() +{ + // INT1 on multiplexed inputs + set_interrupt(1, read_inputs(5)); +} + + +// config + +static INPUT_PORTS_START( gdigdug ) + PORT_START("IN.0") // D11 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) + + PORT_START("IN.1") // D12 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) + + PORT_START("IN.2") // D13 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) + + PORT_START("IN.3") // D14 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) + + PORT_START("IN.4") // D15 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) + + PORT_START("IN.5") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(gdigdug_state::input_changed) +{ + update_int1(); +} + + +static MACHINE_CONFIG_START( gdigdug, gdigdug_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(gdigdug_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(gdigdug_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(gdigdug_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(gdigdug_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(gdigdug_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(gdigdug_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(gdigdug_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(gdigdug_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Mattel World Championship Baseball + * PCB label MEL-001 Baseball Rev. B + * Hitachi QFP HD38820A09 MCU + * cyan/red/green VFD display Futaba DM-24ZK 1G, with etched overlay + + To start the game in 2-player mode, simply turn the game on. For 1-player, + turn the game on while holding the 1-key and use the visitor's side keypad + to play offsense. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class mwcbaseb_state : public hh_hmcs40_state +{ +public: + mwcbaseb_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(speaker_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +void mwcbaseb_state::prepare_display() +{ + UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + display_matrix(16, 8, m_plate, grid); +} + +WRITE8_MEMBER(mwcbaseb_state::plate_w) +{ + // R1x-R3x,R6x: vfd matrix plate + int shift = (offset == HMCS40_PORT_R6X) ? 12 : (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(mwcbaseb_state::grid_w) +{ + // D9-D15: input mux + m_inp_mux = data >> 9 & 0x7f; + + // D0-D7: vfd matrix grid + m_grid = data & 0xff; + prepare_display(); +} + +WRITE8_MEMBER(mwcbaseb_state::speaker_w) +{ + // R50,R51+R52(tied together): speaker out + m_speaker->level_w(data & 7); +} + +READ8_MEMBER(mwcbaseb_state::input_r) +{ + // R4x: multiplexed inputs + return read_inputs(7); +} + + +// config + +/* physical button layout and labels is like this: + + (visitor team side) (home team side) + COMP PITCH [SCORE] [INNING] + [1] [2] [3] [1] [2] [3] + NEW PITCHER PINCH HITTER NEW PITCHER PINCH HITTER + + [4] [5] [6] [4] [5] [6] + BACKWARD (pitch) FORWARD BACKWARD (pitch) FORWARD + + [7] [8] [9] [7] [8] [9] + + BUNT NORMAL HR SWING BUNT NORMAL HR SWING + [CLEAR] [0] [ENTER] [CLEAR] [0] [ENTER] + SLOW CURVE FAST SLOW CURVE FAST +*/ + +static INPUT_PORTS_START( mwcbaseb ) + PORT_START("IN.0") // D9 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("P2 4") // note: P1 = left/visitor, P2 = right/home + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_NAME("P2 3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_NAME("P2 2") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_NAME("P2 1") + + PORT_START("IN.1") // D10 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P2 8") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("P2 7") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("P2 6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("P2 5") + + PORT_START("IN.2") // D11 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("P2 Enter") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("P2 Clear") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("P2 0") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("P2 9") + + PORT_START("IN.3") // D12 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Inning") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Score") + + PORT_START("IN.4") // D13 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("P1 Enter") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("P1 Clear") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("P1 0") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("P1 9") + + PORT_START("IN.5") // D14 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("P1 8") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("P1 7") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("P1 6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("P1 5") + + PORT_START("IN.6") // D15 port R4x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("P1 4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("P1 3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("P1 2") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("P1 1") +INPUT_PORTS_END + + +static const INT16 mwcbaseb_speaker_levels[] = { 0, 16384, -16384, 0, -16384, 0, -32768, -16384 }; + +static MACHINE_CONFIG_START( mwcbaseb, mwcbaseb_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(mwcbaseb_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(mwcbaseb_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(mwcbaseb_state, plate_w)) + MCFG_HMCS40_READ_R_CB(4, READ8(mwcbaseb_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(mwcbaseb_state, speaker_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(mwcbaseb_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(mwcbaseb_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(8, mwcbaseb_speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Parker Brothers Q*Bert + * PCB label 13662 REV-4 + * Hitachi QFP HD38820A70 MCU + * cyan/red/green/darkgreen VFD display Itron CP5137 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class pbqbert_state : public hh_hmcs40_state +{ +public: + pbqbert_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); +}; + +// handlers + +WRITE8_MEMBER(pbqbert_state::plate_w) +{ + // R0x-R6x(,D8): vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT32 plate = BITSWAP32(m_plate,31,30,24,25,26,27,28,15,14,29,13,12,11,10,9,8,7,6,5,4,3,2,1,0,16,17,18,19,20,21,22,23) | 0x400000; + display_matrix(30, 8, plate, m_grid); +} + +WRITE16_MEMBER(pbqbert_state::grid_w) +{ + // D14: speaker out + m_speaker->level_w(data >> 14 & 1); + + // D0-D7: vfd matrix grid + m_grid = data & 0xff; + + // D8: plate 25 (update display there) + plate_w(space, 7, data >> 8 & 1); +} + + +// config + +static INPUT_PORTS_START( pbqbert ) + PORT_START("IN.0") // port D + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) // up-left + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) // up-right + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) // down-right + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) // down-left + PORT_BIT( 0xe1ff, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( pbqbert, pbqbert_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(pbqbert_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.0")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy Kingman (manufactured in Japan) + * PCBs are labeled THF-01II 2E138E01/2E128E02 + * Hitachi HD38800B23 MCU + * cyan/red/blue VFD display Futaba DM-65ZK 3A + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class kingman_state : public hh_hmcs40_state +{ +public: + kingman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int0(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +void kingman_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); + UINT32 plate = BITSWAP24(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12); + display_matrix(23, 9, plate, grid); +} + +WRITE8_MEMBER(kingman_state::plate_w) +{ + // R0x-R3x: vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(kingman_state::grid_w) +{ + // D6: speaker out + m_speaker->level_w(data >> 6 & 1); + + // D12-D15: input mux + UINT8 inp_mux = data >> 12 & 0xf; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int0(); + } + + // D7-D15: vfd matrix grid + m_grid = data >> 7 & 0x1ff; + + // D0-D4: more plates + m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x1f0000); + prepare_display(); +} + +void kingman_state::update_int0() +{ + // INT0 on multiplexed inputs + set_interrupt(0, read_inputs(4)); +} + + +// config + +static INPUT_PORTS_START( kingman ) + PORT_START("IN.0") // D12 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) + + PORT_START("IN.1") // D13 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) + + PORT_START("IN.2") // D14 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) + + PORT_START("IN.3") // D15 INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) + + PORT_START("IN.4") // INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(kingman_state::input_changed) +{ + update_int0(); +} + + +static MACHINE_CONFIG_START( kingman, kingman_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(kingman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(kingman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(kingman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(kingman_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(kingman_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy(tronic) Tron (manufactured in Japan) + * PCBs are labeled THN-02 2E114E07 + * Hitachi HD38800A88 MCU + * cyan/red/green VFD display NEC FIP10AM24T no. 2-8 1 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class tmtron_state : public hh_hmcs40_state +{ +public: + tmtron_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int1(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +void tmtron_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0); + UINT32 plate = BITSWAP24(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15); + display_matrix(23, 10, plate, grid); +} + +WRITE8_MEMBER(tmtron_state::plate_w) +{ + // R0x-R3x: vfd matrix plate + int shift = offset * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(tmtron_state::grid_w) +{ + // D4: speaker out + m_speaker->level_w(data >> 4 & 1); + + // D12-D15: input mux + UINT8 inp_mux = data >> 12 & 0xf; + if (inp_mux != m_inp_mux) + { + m_inp_mux = inp_mux; + update_int1(); + } + + // D6-D15: vfd matrix grid + m_grid = data >> 6 & 0x3ff; + + // D0-D3,D5: more plates + m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x2f0000); + prepare_display(); +} + +void tmtron_state::update_int1() +{ + // INT1 on multiplexed inputs + set_interrupt(1, read_inputs(4)); +} + + +// config + +static INPUT_PORTS_START( tmtron ) + PORT_START("IN.0") // D12 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) + + PORT_START("IN.1") // D13 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) + + PORT_START("IN.2") // D14 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) + + PORT_START("IN.3") // D15 INT1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) + + PORT_START("IN.4") // INT0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(tmtron_state::input_changed) +{ + update_int1(); +} + + +static MACHINE_CONFIG_START( tmtron, tmtron_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(tmtron_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(tmtron_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(tmtron_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(tmtron_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(tmtron_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + VTech Invaders (manufactured in Taiwan) + * Hitachi HD38750A45 MCU + * cyan/red VFD display Futaba DM-26Z 1G, with bezel + + known releases: + - USA: Invaders/Sonic Invader + - UK: Cosmic Invader, published by Grandstand + - UK: Galactic Invaders, published by Prinztronic + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class vinvader_state : public hh_hmcs40_state +{ +public: + vinvader_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); +}; + +// handlers + +WRITE8_MEMBER(vinvader_state::plate_w) +{ + // R1x-R3x(,D4-D6): vfd matrix plate + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + UINT16 plate = BITSWAP16(m_plate,15,11,7,3,10,6,14,2,9,5,13,1,8,4,12,0); + display_matrix(12, 9, plate, m_grid); +} + +WRITE16_MEMBER(vinvader_state::grid_w) +{ + // D0: speaker out + m_speaker->level_w(data & 1); + + // D7-D15: vfd matrix grid + m_grid = data >> 7 & 0x1ff; + + // D4-D6: more plates (update display there) + plate_w(space, 3 + HMCS40_PORT_R1X, data >> 4 & 7); +} + + +// config + +static INPUT_PORTS_START( vinvader ) + PORT_START("IN.0") // port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // port D + PORT_CONFNAME( 0x0002, 0x0000, "Skill Level") + PORT_CONFSETTING( 0x0000, "1" ) + PORT_CONFSETTING( 0x0002, "2" ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0xfff5, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( vinvader, vinvader_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD38750, 400000) // approximation + MCFG_HMCS40_READ_R_CB(0, IOPORT("IN.0")) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(vinvader_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(vinvader_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(vinvader_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(vinvader_state, grid_w)) + MCFG_HMCS40_READ_D_CB(IOPORT("IN.1")) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( bambball ) + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38750a08", 0x0000, 0x0800, CRC(907fef18) SHA1(73fe7ca7c6332268a3a9abc5ac88ada2991012fb) ) + ROM_CONTINUE( 0x0f00, 0x0080 ) +ROM_END + + +ROM_START( bmboxing ) + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38750a07", 0x0000, 0x0800, CRC(7f33e259) SHA1(c5fcdd6bf060c96666354f09f0570c754f6ed4e0) ) + ROM_CONTINUE( 0x0f00, 0x0080 ) +ROM_END + + +ROM_START( bfriskyt ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800a77", 0x0000, 0x1000, CRC(a2445c4f) SHA1(0aaccfec90b66d27dae194d4462d88e654c41578) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( packmon ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800a27", 0x0000, 0x1000, CRC(86e09e84) SHA1(ac7d3c43667d5720ca513f8ff51d146d9f2af124) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( msthawk ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800a73", 0x0000, 0x1000, CRC(a4f9a523) SHA1(465f06b02e2e7d2277218fd447830725790a816c) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( bzaxxon ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800b19", 0x0000, 0x1000, CRC(4fecb80d) SHA1(7adf079480ffd3825ad5ae1eaa4d892eecbcc42d) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( zackman ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a49", 0x0000, 0x1000, CRC(b97f5ef6) SHA1(7fe20e8107361caf9ea657e504be1f8b10b8b03f) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( bpengo ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a63", 0x0000, 0x1000, CRC(ebd6bc64) SHA1(0a322c47b9553a2739a85908ce64b9650cf93d49) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( bbtime ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a65", 0x0000, 0x1000, CRC(33611faf) SHA1(29b6a30ed543688d31ec2aa18f7938fa4eef30b0) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( bdoramon ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800b43", 0x0000, 0x1000, CRC(9387ca42) SHA1(8937e208934b34bd9f49700aa50287dfc8bda76c) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( bultrman ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800b52", 0x0000, 0x1000, CRC(88d372dc) SHA1(f2ac3b89be8afe6fb65914ccebe1a56316b9472a) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( machiman ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a85", 0x0000, 0x1000, CRC(894b4954) SHA1(cab49638a326b031aa548301beb16f818759ef62) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( pairmtch ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a88", 0x0000, 0x1000, CRC(ffa35730) SHA1(5a80b9025aaad2ac0ab0b1436a1355ae8cd3f868) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) + + ROM_REGION( 0x2000, "audiocpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a89", 0x0000, 0x1000, CRC(3533ec56) SHA1(556d69e78a0ee1bf766fce16ed58992d7272d57f) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( alnattck ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800a25", 0x0000, 0x1000, CRC(18b50869) SHA1(11e9d5f7b4ae818b077b0ee14a3b43190e20bff3) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( cdkong ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a45", 0x0000, 0x1000, CRC(196b8070) SHA1(da85d1eb4b048b77f3168630662ab94ec9baa262) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( cgalaxn ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800a70", 0x0000, 0x1000, CRC(a4c5ed1d) SHA1(0f647cb78437d7e62411febf7c9ce3c5b6753a80) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( cpacman ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a29", 0x0000, 0x1000, CRC(1082d577) SHA1(0ef73132bd41f6ca1e4c001ae19f7f7c97eaa8d1) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + +ROM_START( cpacmanr1 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a28", 0x0000, 0x1000, CRC(d2ed57e5) SHA1(f56f1341485ac28ea9e6cc4d162fab18d8a4c977) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( cmspacmn ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a61", 0x0000, 0x1000, CRC(76276318) SHA1(9d6ff3f49b4cdaee5c9e238c1ed638bfb9b99aa7) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( egalaxn2 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a13", 0x0000, 0x1000, CRC(112b721b) SHA1(4a185bc57ea03fe64f61f7db4da37b16eeb0cb54) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( epacman2 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a23", 0x0000, 0x1000, CRC(6eab640f) SHA1(509bdd02be915089e13769f22a08e03509f03af4) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( estargte ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a42", 0x0000, 0x1000, CRC(5f6d55a6) SHA1(0da32149790fa5f16097338fc80536b462169e0c) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) + + ROM_REGION( 0x0200, "audiocpu", 0 ) + ROM_LOAD( "cop411l-kec_n", 0x0000, 0x0200, CRC(fbd3c2d3) SHA1(65b8b24d38678c3fa970bfd639e9449a75a28927) ) +ROM_END + + +ROM_START( eturtles ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a43", 0x0000, 0x1000, CRC(446aa4e2) SHA1(d1c0fb14ea7081def53b1174964b39eed1e5d5e6) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) + + ROM_REGION( 0x0200, "audiocpu", 0 ) + ROM_LOAD( "cop411l-ked_n", 0x0000, 0x0200, CRC(503d26e9) SHA1(a53d24d62195bfbceff2e4a43199846e0950aef6) ) +ROM_END + + +ROM_START( ghalien ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800a04", 0x0000, 0x1000, CRC(019c3328) SHA1(9f1029c5c479f78350952c4f18747341ba5ea7a0) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( gckong ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800b01", 0x0000, 0x1000, CRC(d5a2cca3) SHA1(37bb5784383daab672ed1e0e2362c7a40d8d9b3f) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( gdigdug ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a69", 0x0000, 0x1000, CRC(501165a9) SHA1(8a15d00c4aa66e870cadde33148426463560d2e6) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( mwcbaseb ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a09", 0x0000, 0x1000, CRC(25ba7dc0) SHA1(69e0a867fdcf07b454b1faf835e576ae782432c0) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( pbqbert ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38820a70", 0x0000, 0x1000, CRC(be7c80b4) SHA1(0617a80ef7fe188ea221de32e760d45fd4318c67) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( kingman ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800b23", 0x0000, 0x1000, CRC(f8dfe14f) SHA1(660610d92ae7e5f92bddf5a3bcc2296b2ec3946b) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( tmtron ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38800a88", 0x0000, 0x1000, CRC(33db9670) SHA1(d6f747a59356526698784047bcfdbb59e79b9a23) ) + ROM_CONTINUE( 0x1e80, 0x0100 ) +ROM_END + + +ROM_START( vinvader ) + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "hd38750a45", 0x0000, 0x0800, CRC(32de6056) SHA1(70238c6c40c3d513f8eced1cb81bdd4dbe12f16c) ) + ROM_CONTINUE( 0x0f00, 0x0080 ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +CONS( 1979, bambball, 0, 0, bambball, bambball, driver_device, 0, "Bambino", "Dribble Away Basketball", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1979, bmboxing, 0, 0, bmboxing, bmboxing, driver_device, 0, "Bambino", "Knock-Em Out Boxing", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1982, bfriskyt, 0, 0, bfriskyt, bfriskyt, driver_device, 0, "Bandai", "Frisky Tom (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1981, packmon, 0, 0, packmon, packmon, driver_device, 0, "Bandai", "Packri Monster", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, msthawk, 0, 0, msthawk, msthawk, driver_device, 0, "Bandai (Mattel license)", "Star Hawk (Mattel)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, bzaxxon, 0, 0, bzaxxon, bzaxxon, driver_device, 0, "Bandai", "Zaxxon (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +CONS( 1983, zackman, 0, 0, zackman, zackman, driver_device, 0, "Bandai", "Zackman", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1983, bpengo, 0, 0, bpengo, bpengo, driver_device, 0, "Bandai", "Pengo (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +CONS( 1983, bbtime, 0, 0, bbtime, bbtime, driver_device, 0, "Bandai", "Burger Time (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +CONS( 1983, bdoramon, 0, 0, bdoramon, bdoramon, driver_device, 0, "Bandai", "Dokodemo Dorayaki Doraemon", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1983, bultrman, 0, 0, bultrman, bultrman, driver_device, 0, "Bandai", "Ultra Man (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +CONS( 1984, machiman, 0, 0, machiman, machiman, driver_device, 0, "Bandai", "Machine Man", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1984, pairmtch, 0, 0, pairmtch, pairmtch, driver_device, 0, "Bandai", "Pair Match", MACHINE_SUPPORTS_SAVE ) + +CONS( 1981, alnattck, 0, 0, alnattck, alnattck, driver_device, 0, "Coleco", "Alien Attack", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, cdkong, 0, 0, cdkong, cdkong, driver_device, 0, "Coleco", "Donkey Kong (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_SOUND ) +CONS( 1982, cgalaxn, 0, 0, cgalaxn, cgalaxn, driver_device, 0, "Coleco", "Galaxian (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_SOUND ) +CONS( 1981, cpacman, 0, 0, cpacman, cpacman, driver_device, 0, "Coleco", "Pac-Man (Coleco, Rev. 29)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1981, cpacmanr1, cpacman, 0, cpacman, cpacman, driver_device, 0, "Coleco", "Pac-Man (Coleco, Rev. 28)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1983, cmspacmn, 0, 0, cmspacmn, cmspacmn, driver_device, 0, "Coleco", "Ms. Pac-Man (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1981, egalaxn2, 0, 0, egalaxn2, egalaxn2, driver_device, 0, "Entex", "Galaxian 2 (Entex)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1981, epacman2, 0, 0, egalaxn2, epacman2, driver_device, 0, "Entex", "Pac Man 2 (Entex)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, estargte, 0, 0, estargte, estargte, driver_device, 0, "Entex", "Stargate (Entex)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, eturtles, 0, 0, eturtles, eturtles, driver_device, 0, "Entex", "Turtles (Entex)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1980, ghalien, 0, 0, ghalien, ghalien, driver_device, 0, "Gakken", "Heiankyo Alien (Gakken)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, gckong, 0, 0, gckong, gckong, driver_device, 0, "Gakken", "Crazy Kong (Gakken)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +CONS( 1983, gdigdug, 0, 0, gdigdug, gdigdug, driver_device, 0, "Gakken", "Dig Dug (Gakken)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1980, mwcbaseb, 0, 0, mwcbaseb, mwcbaseb, driver_device, 0, "Mattel", "World Championship Baseball", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1983, pbqbert, 0, 0, pbqbert, pbqbert, driver_device, 0, "Parker Brothers", "Q*Bert (Parker Brothers)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1982, kingman, 0, 0, kingman, kingman, driver_device, 0, "Tomy", "Kingman", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1984, tmtron, 0, 0, tmtron, tmtron, driver_device, 0, "Tomy", "Tron (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1981, vinvader, 0, 0, vinvader, vinvader, driver_device, 0, "VTech", "Invaders (VTech)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mame/drivers/hh_melps4.c b/src/mame/drivers/hh_melps4.c new file mode 100644 index 00000000000..92e4bd09228 --- /dev/null +++ b/src/mame/drivers/hh_melps4.c @@ -0,0 +1,473 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Kevin Horton +/*************************************************************************** + + Mitsubishi MELPS 4 MCU tabletops/handhelds or other simple devices, + most of them are VFD electronic games/toys. + +***************************************************************************/ + +#include "emu.h" +#include "cpu/melps4/m58846.h" +#include "sound/speaker.h" + +#include "hh_melps4_test.lh" // common test-layout - use external artwork + + +class hh_melps4_state : public driver_device +{ +public: + hh_melps4_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN"), + m_speaker(*this, "speaker"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices + required_device m_maincpu; + optional_ioport_array<4> m_inp_matrix; // max 4 + optional_device m_speaker; + + // misc common + UINT16 m_inp_mux; // multiplexed inputs mask + + UINT8 read_inputs(int columns); + DECLARE_INPUT_CHANGED_MEMBER(reset_button); + + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) + + UINT32 m_grid; // VFD current row data + UINT32 m_plate; // VFD current column data + + UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + UINT32 m_display_cache[0x20]; // (internal use) + UINT8 m_display_decay[0x20][0x20]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); + +protected: + virtual void machine_start(); + virtual void machine_reset(); +}; + + +// machine start/reset + +void hh_melps4_state::machine_start() +{ + // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, ~0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + memset(m_display_segmask, 0, sizeof(m_display_segmask)); + + m_inp_mux = 0; + m_grid = 0; + m_plate = 0; + + // register for savestates + save_item(NAME(m_display_maxy)); + save_item(NAME(m_display_maxx)); + save_item(NAME(m_display_wait)); + + save_item(NAME(m_display_state)); + /* save_item(NAME(m_display_cache)); */ // don't save! + save_item(NAME(m_display_decay)); + save_item(NAME(m_display_segmask)); + + save_item(NAME(m_inp_mux)); + save_item(NAME(m_grid)); + save_item(NAME(m_plate)); +} + +void hh_melps4_state::machine_reset() +{ +} + + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// The device may strobe the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +void hh_melps4_state::display_update() +{ + UINT32 active_state[0x20]; + + for (int y = 0; y < m_display_maxy; y++) + { + active_state[y] = 0; + + for (int x = 0; x <= m_display_maxx; x++) + { + // turn on powered segments + if (m_display_state[y] >> x & 1) + m_display_decay[y][x] = m_display_wait; + + // determine active state + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; + active_state[y] |= (ds << x); + } + } + + // on difference, send to output + for (int y = 0; y < m_display_maxy; y++) + if (m_display_cache[y] != active_state[y]) + { + if (m_display_segmask[y] != 0) + output_set_digit_value(y, active_state[y] & m_display_segmask[y]); + + const int mul = (m_display_maxx <= 10) ? 10 : 100; + for (int x = 0; x <= m_display_maxx; x++) + { + int state = active_state[y] >> x & 1; + char buf1[0x10]; // lampyx + char buf2[0x10]; // y.x + + if (x == m_display_maxx) + { + // always-on if selected + sprintf(buf1, "lamp%da", y); + sprintf(buf2, "%d.a", y); + } + else + { + sprintf(buf1, "lamp%d", y * mul + x); + sprintf(buf2, "%d.%d", y, x); + } + output_set_value(buf1, state); + output_set_value(buf2, state); + } + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(hh_melps4_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int y = 0; y < m_display_maxy; y++) + for (int x = 0; x <= m_display_maxx; x++) + if (m_display_decay[y][x] != 0) + m_display_decay[y][x]--; + + display_update(); +} + +void hh_melps4_state::set_display_size(int maxx, int maxy) +{ + m_display_maxx = maxx; + m_display_maxy = maxy; +} + +void hh_melps4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) +{ + set_display_size(maxx, maxy); + + // update current state + UINT32 mask = (1 << maxx) - 1; + for (int y = 0; y < maxy; y++) + m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; + + display_update(); +} + + +// generic input handlers + +UINT8 hh_melps4_state::read_inputs(int columns) +{ + UINT8 ret = 0; + + // read selected input rows + for (int i = 0; i < columns; i++) + if (m_inp_mux >> i & 1) + ret |= m_inp_matrix[i]->read(); + + return ret; +} + +INPUT_CHANGED_MEMBER(hh_melps4_state::reset_button) +{ + // for when reset button is directly tied to MCU reset pin + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); +} + + + +/*************************************************************************** + + Minidrivers (subclass, I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + Coleco Frogger (manufactured in Japan, licensed from Sega) + * PCB label Coleco Frogger Code No. 01-81543, KS-003282 Japan + * Mitsubishi M58846-701P MCU + * cyan/red/green VFD display Itron CP5090GLR R1B, with partial color overlay + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class cfrogger_state : public hh_melps4_state +{ +public: + cfrogger_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_melps4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_WRITE_LINE_MEMBER(speaker_w); + DECLARE_READ16_MEMBER(input_r); +}; + +// handlers + +void cfrogger_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,0,1,2,3,4,5,6,7,8,9,10,11); + UINT16 plate = BITSWAP16(m_plate,12,4,13,5,14,6,15,7,3,11,2,10,1,9,0,8); + display_matrix(16, 12, plate, grid); +} + +WRITE8_MEMBER(cfrogger_state::plate_w) +{ + // F0,F1: input mux + if (offset == MELPS4_PORTF) + m_inp_mux = data & 3; + + // Sx,Fx,Gx: vfd matrix plate + int mask = (offset == MELPS4_PORTS) ? 0xff : 0xf; // port S is 8-bit + int shift = (offset == MELPS4_PORTS) ? 0 : (offset + 1) * 4; + m_plate = (m_plate & ~(mask << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(cfrogger_state::grid_w) +{ + // D0-D11: vfd matrix grid + m_grid = data; + prepare_display(); +} + +WRITE_LINE_MEMBER(cfrogger_state::speaker_w) +{ + // T: speaker out + m_speaker->level_w(state); +} + +READ16_MEMBER(cfrogger_state::input_r) +{ + // K0,K1: multiplexed inputs + // K2: N/C + // K3: fixed input + return (m_inp_matrix[2]->read() & 8) | (read_inputs(2) & 3); +} + + +// config + +static INPUT_PORTS_START( cfrogger ) + PORT_START("IN.0") // F0 port K0,K1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + + PORT_START("IN.1") // F1 port K0,K1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + + PORT_START("IN.2") // K3 + PORT_CONFNAME( 0x08, 0x00, "Skill Level" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x08, "2" ) + + PORT_START("IN.3") // fake + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_melps4_state, reset_button, NULL) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( cfrogger, cfrogger_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M58846, XTAL_600kHz) + MCFG_MELPS4_READ_K_CB(READ16(cfrogger_state, input_r)) + MCFG_MELPS4_WRITE_S_CB(WRITE8(cfrogger_state, plate_w)) + MCFG_MELPS4_WRITE_F_CB(WRITE8(cfrogger_state, plate_w)) + MCFG_MELPS4_WRITE_G_CB(WRITE8(cfrogger_state, plate_w)) + MCFG_MELPS4_WRITE_D_CB(WRITE16(cfrogger_state, grid_w)) + MCFG_MELPS4_WRITE_T_CB(WRITELINE(cfrogger_state, speaker_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_melps4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_melps4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Gakken Jungler (manufactured in Japan, licensed from Konami) + * PCB label Konami Gakken GR503 + * Mitsubishi M58846-702P MCU + * cyan/red/green VFD display Itron CP5143GLR SGA, with light-yellow color overlay + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class gjungler_state : public hh_melps4_state +{ +public: + gjungler_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_melps4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_WRITE_LINE_MEMBER(speaker_w); + DECLARE_READ16_MEMBER(input_r); +}; + +// handlers + +void gjungler_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0,1); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,8,9,10,11,17,16,15,14,13,12,0,7,1,6,2,5,3,4) | 0x2000; + display_matrix(18, 12, plate, grid); +} + +WRITE8_MEMBER(gjungler_state::plate_w) +{ + // G0,G1: input mux + if (offset == MELPS4_PORTG) + m_inp_mux = data & 3; + + // Sx,Fx,Gx,U: vfd matrix plate + int mask = (offset == MELPS4_PORTS) ? 0xff : 0xf; // port S is 8-bit + int shift = (offset == MELPS4_PORTS) ? 0 : (offset + 1) * 4; + m_plate = (m_plate & ~(mask << shift)) | (data << shift); + prepare_display(); +} + +WRITE16_MEMBER(gjungler_state::grid_w) +{ + // D0-D11: vfd matrix grid + m_grid = data; + prepare_display(); +} + +WRITE_LINE_MEMBER(gjungler_state::speaker_w) +{ + // T: speaker out + m_speaker->level_w(state); +} + +READ16_MEMBER(gjungler_state::input_r) +{ + // K0,K1: multiplexed inputs + // K2,K3: fixed inputs + return (m_inp_matrix[2]->read() & 0xc) | (read_inputs(2) & 3); +} + + +// config + +static INPUT_PORTS_START( gjungler ) + PORT_START("IN.0") // G0 port K0,K1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + + PORT_START("IN.1") // G1 port K0,K1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + + PORT_START("IN.2") // K2,K3 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_CONFNAME( 0x08, 0x00, "Game Mode" ) + PORT_CONFSETTING( 0x00, "A" ) + PORT_CONFSETTING( 0x08, "B" ) + + PORT_START("IN.3") // fake + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_melps4_state, reset_button, NULL) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( gjungler, gjungler_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M58846, XTAL_600kHz) + MCFG_MELPS4_READ_K_CB(READ16(gjungler_state, input_r)) + MCFG_MELPS4_WRITE_S_CB(WRITE8(gjungler_state, plate_w)) + MCFG_MELPS4_WRITE_F_CB(WRITE8(gjungler_state, plate_w)) + MCFG_MELPS4_WRITE_G_CB(WRITE8(gjungler_state, plate_w)) + MCFG_MELPS4_WRITE_U_CB(WRITE8(gjungler_state, plate_w)) + MCFG_MELPS4_WRITE_D_CB(WRITE16(gjungler_state, grid_w)) + MCFG_MELPS4_WRITE_T_CB(WRITELINE(gjungler_state, speaker_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_melps4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_melps4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( cfrogger ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "m58846-701p", 0x0000, 0x1000, CRC(ba52a242) SHA1(7fa53b617f4bb54be32eb209e9b88131e11cb518) ) +ROM_END + + +ROM_START( gjungler ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "m58846-702p", 0x0000, 0x1000, CRC(94ab7060) SHA1(3389bc115d1df8d01a30611fa9e95a900d32b29b) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +CONS( 1981, cfrogger, 0, 0, cfrogger, cfrogger, driver_device, 0, "Coleco", "Frogger (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1982, gjungler, 0, 0, gjungler, gjungler, driver_device, 0, "Gakken / Konami", "Jungler (Gakken)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/hh_pic16.c b/src/mame/drivers/hh_pic16.c new file mode 100644 index 00000000000..4a6e6088450 --- /dev/null +++ b/src/mame/drivers/hh_pic16.c @@ -0,0 +1,302 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + GI PIC16xx-driven dedicated handhelds or other simple devices. + + known chips: + + serial device etc. +----------------------------------------------------------- + @036 1655A 1979, Ideal Maniac + *061 1655A 1980, Lakeside Le Boom (have dump) + *094 1655A 1980, GAF Melody Madness (have dump) + *110 1650A 1979, Tiger Rocket Pinball + *192 1650 19??, (a phone dialer, have dump) + *255 1655 19??, (a talking clock, have dump) + + (* denotes not yet emulated by MAME, @ denotes it's in this driver) + + + TODO: + - it doesn't work, emu/cpu/pic16c5x needs some love (dev note: hack to make it + playable: remove the TRIS masks) + +***************************************************************************/ + +#include "emu.h" +#include "cpu/pic16c5x/pic16c5x.h" +#include "sound/speaker.h" + +#include "maniac.lh" + + +class hh_pic16_state : public driver_device +{ +public: + hh_pic16_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN"), + m_speaker(*this, "speaker"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices + required_device m_maincpu; + optional_ioport_array<2> m_inp_matrix; // max 2 + optional_device m_speaker; + + // misc common + UINT8 m_b; // MCU port B data + UINT8 m_c; // MCU port C data + + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) + + UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + UINT32 m_display_cache[0x20]; // (internal use) + UINT8 m_display_decay[0x20][0x20]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); + +protected: + virtual void machine_start(); + virtual void machine_reset(); +}; + + +// machine start/reset + +void hh_pic16_state::machine_start() +{ + // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, ~0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + memset(m_display_segmask, 0, sizeof(m_display_segmask)); + + m_b = 0; + m_c = 0; + + // register for savestates + save_item(NAME(m_display_maxy)); + save_item(NAME(m_display_maxx)); + save_item(NAME(m_display_wait)); + + save_item(NAME(m_display_state)); + /* save_item(NAME(m_display_cache)); */ // don't save! + save_item(NAME(m_display_decay)); + save_item(NAME(m_display_segmask)); + + save_item(NAME(m_b)); + save_item(NAME(m_c)); +} + +void hh_pic16_state::machine_reset() +{ +} + + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// The device may strobe the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +void hh_pic16_state::display_update() +{ + UINT32 active_state[0x20]; + + for (int y = 0; y < m_display_maxy; y++) + { + active_state[y] = 0; + + for (int x = 0; x <= m_display_maxx; x++) + { + // turn on powered segments + if (m_display_state[y] >> x & 1) + m_display_decay[y][x] = m_display_wait; + + // determine active state + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; + active_state[y] |= (ds << x); + } + } + + // on difference, send to output + for (int y = 0; y < m_display_maxy; y++) + if (m_display_cache[y] != active_state[y]) + { + if (m_display_segmask[y] != 0) + output_set_digit_value(y, active_state[y] & m_display_segmask[y]); + + const int mul = (m_display_maxx <= 10) ? 10 : 100; + for (int x = 0; x <= m_display_maxx; x++) + { + int state = active_state[y] >> x & 1; + char buf1[0x10]; // lampyx + char buf2[0x10]; // y.x + + if (x == m_display_maxx) + { + // always-on if selected + sprintf(buf1, "lamp%da", y); + sprintf(buf2, "%d.a", y); + } + else + { + sprintf(buf1, "lamp%d", y * mul + x); + sprintf(buf2, "%d.%d", y, x); + } + output_set_value(buf1, state); + output_set_value(buf2, state); + } + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(hh_pic16_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int y = 0; y < m_display_maxy; y++) + for (int x = 0; x <= m_display_maxx; x++) + if (m_display_decay[y][x] != 0) + m_display_decay[y][x]--; + + display_update(); +} + +void hh_pic16_state::set_display_size(int maxx, int maxy) +{ + m_display_maxx = maxx; + m_display_maxy = maxy; +} + +void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) +{ + set_display_size(maxx, maxy); + + // update current state + UINT32 mask = (1 << maxx) - 1; + for (int y = 0; y < maxy; y++) + m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; + + display_update(); +} + + + +/*************************************************************************** + + Minidrivers (subclass, I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + Ideal Maniac, by Ralph Baer + * PIC1655A-036 + + +***************************************************************************/ + +class maniac_state : public hh_pic16_state +{ +public: + maniac_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_pic16_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(output_w); +}; + +// handlers + +WRITE8_MEMBER(maniac_state::output_w) +{ + // B,C: outputs + offset -= PIC16C5x_PORTB; + if (offset) + m_c = data; + else + m_b = data; + + // d7: speaker out + m_speaker->level_w((m_b >> 7 & 1) | (m_c >> 6 & 2)); + + // d0-d6: 7seg + m_display_segmask[offset] = 0x7f; + m_display_state[offset] = ~data & 0x7f; + + set_display_size(7, 2); + display_update(); +} + + +// config + +static INPUT_PORTS_START( maniac ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // bottom-right + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // upper-right + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) // bottom-left + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) // upper-left +INPUT_PORTS_END + + +static const INT16 maniac_speaker_levels[] = { 0, 32767, -32768, 0 }; + +static MACHINE_CONFIG_START( maniac, maniac_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", PIC16C55, 850000) // RC osc. R=13.4K, C=470pf, but unknown RC curve - measured 800-890kHz + MCFG_PIC16C5x_READ_A_CB(IOPORT("IN.0")) + MCFG_PIC16C5x_WRITE_B_CB(WRITE8(maniac_state, output_w)) + MCFG_PIC16C5x_WRITE_C_CB(WRITE8(maniac_state, output_w)) + MCFG_PIC16C5x_SET_CONFIG(0) // ? + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_pic16_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_maniac) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(4, maniac_speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( maniac ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "pic1655a-036", 0x0000, 0x0400, CRC(a96f7011) SHA1(e97ae44d3c1e74c7e1024bb0bdab03eecdc9f827) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +CONS( 1979, maniac, 0, 0, maniac, maniac, driver_device, 0, "Ideal", "Maniac", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/hh_sm510.c b/src/mame/drivers/hh_sm510.c new file mode 100644 index 00000000000..87c42f538bb --- /dev/null +++ b/src/mame/drivers/hh_sm510.c @@ -0,0 +1,402 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Sean Riddle +/*************************************************************************** + + Sharp SM510 MCU x.. + + TODO: + - barnacles + +***************************************************************************/ + +#include "emu.h" +#include "cpu/sm510/sm510.h" +#include "sound/speaker.h" + +#include "hh_sm510_test.lh" // common test-layout - use external artwork + + +class hh_sm510_state : public driver_device +{ +public: + hh_sm510_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN"), + m_speaker(*this, "speaker"), + m_inp_lines(0) + { } + + // devices + required_device m_maincpu; + optional_ioport_array<5> m_inp_matrix; // max 5 + optional_device m_speaker; + + // misc common + UINT16 m_inp_mux; // multiplexed inputs mask + int m_inp_lines; // number of input mux columns + UINT8 m_lcd_output_cache[0x100]; + + UINT8 read_inputs(int columns); + + virtual void update_k_line(); + virtual DECLARE_INPUT_CHANGED_MEMBER(input_changed); + virtual DECLARE_READ8_MEMBER(input_r); + virtual DECLARE_WRITE8_MEMBER(input_w); + virtual DECLARE_WRITE16_MEMBER(lcd_segment_w); + +protected: + virtual void machine_start(); + virtual void machine_reset(); +}; + + +// machine start/reset + +void hh_sm510_state::machine_start() +{ + // zerofill + m_inp_mux = 0; +// m_inp_lines = 0; + memset(m_lcd_output_cache, ~0, sizeof(m_lcd_output_cache)); + + // register for savestates + save_item(NAME(m_inp_mux)); + save_item(NAME(m_inp_lines)); + /* save_item(NAME(m_lcd_output_cache)); */ // don't save! +} + +void hh_sm510_state::machine_reset() +{ +} + + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// lcd panel - on lcd handhelds, usually not a generic x/y screen device + +WRITE16_MEMBER(hh_sm510_state::lcd_segment_w) +{ + for (int seg = 0; seg < 0x10; seg++) + { + int state = data >> seg & 1; + int index = offset << 4 | seg; + + if (state != m_lcd_output_cache[index]) + { + // output to x.y, where x = row a/b/bs/c*4 + H1-4, y = seg1-16 + char buf[0x10]; + sprintf(buf, "%d.%d", offset, seg); + output_set_value(buf, state); + + m_lcd_output_cache[index] = state; + } + } +} + + +// generic input handlers - usually S output is input mux, and K input for buttons + +UINT8 hh_sm510_state::read_inputs(int columns) +{ + UINT8 ret = 0; + + // read selected input rows + for (int i = 0; i < columns; i++) + if (m_inp_mux >> i & 1) + ret |= m_inp_matrix[i]->read(); + + return ret; +} + +void hh_sm510_state::update_k_line() +{ + // this is necessary because the MCU can wake up on K input activity + m_maincpu->set_input_line(SM510_INPUT_LINE_K, read_inputs(m_inp_lines) ? ASSERT_LINE : CLEAR_LINE); +} + +INPUT_CHANGED_MEMBER(hh_sm510_state::input_changed) +{ + update_k_line(); +} + +WRITE8_MEMBER(hh_sm510_state::input_w) +{ + m_inp_mux = data; + update_k_line(); +} + +READ8_MEMBER(hh_sm510_state::input_r) +{ + return read_inputs(m_inp_lines); +} + + + +/*************************************************************************** + + Minidrivers (subclass, I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + Konami Top Gun + * PCB label BH003 + * Sharp SM510 under epoxy (die label CMS54C, KMS598) + + The ROM listing "BH003 Top Gun" from patent US5137277 is identical to the + released version, except for 2 probable bit errors and filler bytes. Unused + pages list data too, of what looks like assembler leftover garbage. + +***************************************************************************/ + +class ktopgun_state : public hh_sm510_state +{ +public: + ktopgun_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_sm510_state(mconfig, type, tag) + { + m_inp_lines = 3; + } + + DECLARE_WRITE8_MEMBER(speaker_w); +}; + +// handlers + +WRITE8_MEMBER(ktopgun_state::speaker_w) +{ + m_speaker->level_w(data >> 0 & 1); +} + + +// config + +static INPUT_PORTS_START( ktopgun ) + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + + PORT_START("IN.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // sel + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // sound on/off + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // off + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // fire + + PORT_START("IN.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // on + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ktopgun, ktopgun_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", SM510, XTAL_32_768kHz) + MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r)) + MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w)) + MCFG_SM510_WRITE_R_CB(WRITE8(ktopgun_state, speaker_w)) + + MCFG_DEFAULT_LAYOUT(layout_hh_sm510_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Konami Teenage Mutant Ninja Turtles + * Sharp SM511 under epoxy (die label KMS 73B, KMS 774) + + The ROM listing "BH005 TMNT" from patent US5150899 is identical to the + released version, excluding filler bytes. + +***************************************************************************/ + +class ktmnt_state : public hh_sm510_state +{ +public: + ktmnt_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_sm510_state(mconfig, type, tag) + { + m_inp_lines = 3; + } + + DECLARE_WRITE8_MEMBER(speaker_w); +}; + +// handlers + +WRITE8_MEMBER(ktmnt_state::speaker_w) +{ + m_speaker->level_w(data >> 0 & 1); +} + + +// config + +static INPUT_PORTS_START( ktmnt ) + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + + PORT_START("IN.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // game select + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // sound on/off + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // off + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // on/start + + PORT_START("IN.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ktmnt, ktmnt_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", SM511, XTAL_32_768kHz) + MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r)) + MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w)) + MCFG_SM510_WRITE_R_CB(WRITE8(ktmnt_state, speaker_w)) + + MCFG_DEFAULT_LAYOUT(layout_hh_sm510_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Nintendo Game & Watch: Mickey & Donald (model DM-53) + * PCB label DM-53 + * Sharp SM510 label DM-53 (die label CMS54C, CMS565) + +***************************************************************************/ + +class gnwmndon_state : public hh_sm510_state +{ +public: + gnwmndon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_sm510_state(mconfig, type, tag) + { + m_inp_lines = 2; + } + + DECLARE_WRITE8_MEMBER(speaker_w); +}; + +// handlers + +WRITE8_MEMBER(gnwmndon_state::speaker_w) +{ + m_speaker->level_w(data >> 1 & 1); +} + + +// config + +static INPUT_PORTS_START( gnwmndon ) + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) + + PORT_START("IN.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // time + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // b + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // a + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // alarm +INPUT_PORTS_END + +static MACHINE_CONFIG_START( gnwmndon, gnwmndon_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", SM510, XTAL_32_768kHz) + MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w)) + MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r)) + MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w)) + MCFG_SM510_WRITE_R_CB(WRITE8(gnwmndon_state, speaker_w)) + + MCFG_DEFAULT_LAYOUT(layout_hh_sm510_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( ktopgun ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "cms54c_kms598", 0x0000, 0x1000, CRC(50870b35) SHA1(cda1260c2e1c180995eced04b7d7ff51616dcef5) ) +ROM_END + + +ROM_START( ktmnt ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "kms_73b_774.prog", 0x0000, 0x1000, CRC(a1064f87) SHA1(92156c35fbbb414007ee6804fe635128a741d5f1) ) + + ROM_REGION( 0x100, "maincpu:music", 0 ) + ROM_LOAD( "kms_73b_774.music", 0x000, 0x100, CRC(8270d626) SHA1(bd91ca1d5cd7e2a62eef05c0033b19dcdbe441ca) ) +ROM_END + + +ROM_START( gnwmndon ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "dm53_cms54c_565", 0x0000, 0x1000, CRC(e21fc0f5) SHA1(3b65ccf9f98813319410414e11a3231b787cdee6) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +CONS( 1989, ktopgun, 0, 0, ktopgun, ktopgun, driver_device, 0, "Konami", "Top Gun (Konami)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +CONS( 1989, ktmnt, 0, 0, ktmnt, ktmnt, driver_device, 0, "Konami", "Teenage Mutant Ninja Turtles (Konami)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) + +CONS( 1982, gnwmndon, 0, 0, gnwmndon, gnwmndon, driver_device, 0, "Nintendo", "Game & Watch: Mickey & Donald", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/hh_tms1k.c b/src/mame/drivers/hh_tms1k.c new file mode 100644 index 00000000000..357d0f496fe --- /dev/null +++ b/src/mame/drivers/hh_tms1k.c @@ -0,0 +1,4636 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Sean Riddle, Kevin Horton +/*************************************************************************** + + This driver is a collection of simple dedicated handheld and tabletop + toys based around the TMS1000 MCU series. Anything more complex or clearly + part of a series is (or will be) in its own driver. + + Let's use this driver for a list of known devices and their serials, + excluding TI's own products (see ticalc1x.c, tispeak.c) + + serial device etc. +-------------------------------------------------------------------- + @CP0904A TMS0970 1977, Milton Bradley Comp IV + @MP0905B TMS0970 1977, Parker Brothers Codename Sector + *MP0168 TMS1000? 1979, Conic Basketball + @MP0914 TMS1000 1979, Entex Baseball 1 + @MP0923 TMS1000 1979, Entex Baseball 2 + @MP1030 TMS1100 1980, APF Mathemagician + @MP1133 TMS1470 1979, Kosmos Astro + @MP1204 TMS1100 1980, Entex Baseball 3 (6007) + @MP1211 TMS1100 1980, Entex Space Invader + @MP1218 TMS1100 1980, Entex Basketball 2 (6010) + @MP1221 TMS1100 1980, Entex Raise The Devil + *MP1296 TMS1100? 1982, Entex Black Knight + *MP1312 TMS1100 198?, Tandy/RadioShack Science Fair Microcomputer Trainer + *MP1359 TMS1100? 1985, Capsela CRC2000 + @MP1525 TMS1170 1980, Coleco Head to Head Baseball + *MP1604 ? 1981, Hanzawa Twinvader III/Tandy Cosmic Fire Away 3000 (? note: VFD-capable) + @MP2105 TMS1370 1979, Gakken Poker + *MP2139 TMS1370? 1982, Gakken Galaxy Invader 1000 + @MP2726 TMS1040 1979, Tomy Break Up + *MP2788 TMS1040? 1980, Bandai Flight Time (? note: VFD-capable) + *MP3208 TMS1000 1977, Milton Bradley Electronic Battleship (1977, model 4750A or B) + @MP3226 TMS1000 1978, Milton Bradley Simon (model 4850) + *MP3232 TMS1000 1979, Fonas 2-Player Baseball (no "MP" on chip label) + *MP3300 TMS1000 1980, Estrela Genius (from Brazil, looks and plays identical to Simon) + @MP3301A TMS1000 1979, Milton Bradley Big Trak + *MP3320A TMS1000 1979, Coleco Head to Head Basketball + *M32001 TMS1000 1981, Coleco Quiz Wiz Challenger (note: MP3398, MP3399, M3200x?) + MP3403 TMS1100 1978, Marx Electronic Bowling -> elecbowl.c + @MP3404 TMS1100 1978, Parker Brothers Merlin + @MP3405 TMS1100 1979, Coleco Amaze-A-Tron + *MP3415 TMS1100 1978, Coleco Electronic Quarterback + @MP3438A TMS1100 1979, Kenner Star Wars Electronic Battle Command + MP3450A TMS1100 1979, MicroVision cartridge: Blockbuster + MP3454 TMS1100 1979, MicroVision cartridge: Star Trek Phaser Strike + MP3455 TMS1100 1980, MicroVision cartridge: Pinball + MP3457 TMS1100 1979, MicroVision cartridge: Mindbuster + @MP3460 TMS1100 1980, Coleco Head to Head Football + MP3474 TMS1100 1979, MicroVision cartridge: Vegas Slots + MP3475 TMS1100 1979, MicroVision cartridge: Bowling + @MP3476 TMS1100 1979, Milton Bradley Super Simon + MP3479 TMS1100 1980, MicroVision cartridge: Baseball + MP3481 TMS1100 1979, MicroVision cartridge: Connect Four + *MP3491 TMS1100 1980, Mattel Horserace Analyzer + MP3496 TMS1100 1980, MicroVision cartridge: Sea Duel + M34009 TMS1100 1981, MicroVision cartridge: Alien Raiders (note: MP3498, MP3499, M3400x..) + M34017 TMS1100 1981, MicroVision cartridge: Cosmic Hunter + M34047 TMS1100 1982, MicroVision cartridge: Super Blockbuster + *M34078A TMS1100 1983, Milton Bradley Arcade Mania + @MP6100A TMS0980 1979, Ideal Electronic Detective + @MP6101B TMS0980 1979, Parker Brothers Stop Thief + *MP6361 ? 1983, Defender Strikes (? note: VFD-capable) + *MP7303 TMS1400? 19??, Tiger 7-in-1 Sports Stadium + @MP7313 TMS1400 1980, Parker Brothers Bank Shot + @MP7314 TMS1400 1980, Parker Brothers Split Second + *MP7324 TMS1400? 1985, Coleco Talking Teacher + MP7332 TMS1400 1981, Milton Bradley Dark Tower -> mbdtower.c + @MP7334 TMS1400 1981, Coleco Total Control 4 + @MP7351 TMS1400CR 1982, Parker Brothers Master Merlin + @MP7551 TMS1670 1980, Entex Color Football 4 (6009) + *MP7573 TMS1670? 1981, Entex Select-a-Game cartridge: Football 4 (? note: 40-pin, VFD-capable) + + inconsistent: + + @MPF553 TMS1670 1980, Gakken Jackpot: Gin Rummy & Black Jack + *M95041 ? 1983, Tsukuda Game Pachinko (? note: 40-pin, VFD-capable) + @CD7282SL TMS1100 1981, Tandy/RadioShack Tandy-12 (serial is similar to TI Speak & Spell series?) + + (* denotes not yet emulated by MAME, @ denotes it's in this driver) + + + TODO: + - verify output PLA and microinstructions PLA for MCUs that have been dumped + electronically (mpla is usually the default, opla is often custom) + - unknown MCU clocks for some: TMS1000 RC curve is documented in the data manual, + but not for newer ones (rev. E or TMS1400 MCUs). TMS0970/0980 osc. is on-die. + - some of the games rely on the fact that faster/longer strobed leds appear + brighter: tc4/h2hfootb(offense), bankshot(cue ball), ... + - add softwarelist for tc4 cartridges? + - stopthiep: unable to start a game (may be intentional?) + - tbreakup: some of the leds flicker (rom and PLAs doublechecked) + +***************************************************************************/ + +#include "includes/hh_tms1k.h" +#include "machine/tms1024.h" +#include "sound/beep.h" + +// internal artwork +#include "amaztron.lh" +#include "astro.lh" +#include "bankshot.lh" +#include "bigtrak.lh" +#include "cnsector.lh" +#include "comp4.lh" +#include "ebball.lh" +#include "ebball2.lh" +#include "ebball3.lh" +#include "ebaskb2.lh" +#include "efootb4.lh" +#include "einvader.lh" // test-layout(but still playable) +#include "elecdet.lh" +#include "gjackpot.lh" +#include "gpoker.lh" +#include "h2hbaseb.lh" +#include "h2hfootb.lh" +#include "mathmagi.lh" +#include "merlin.lh" // clickable +#include "mmerlin.lh" // clickable +#include "simon.lh" // clickable +#include "ssimon.lh" // clickable +#include "splitsec.lh" +#include "starwbc.lh" +#include "stopthie.lh" +#include "tandy12.lh" // clickable +#include "tbreakup.lh" +#include "tc4.lh" + +#include "hh_tms1k_test.lh" // common test-layout - use external artwork + + +// machine_start/reset + +void hh_tms1k_state::machine_start() +{ + // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, ~0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + memset(m_display_segmask, 0, sizeof(m_display_segmask)); + + m_o = 0; + m_r = 0; + m_inp_mux = 0; + m_power_led = false; + m_power_on = false; + m_grid = 0; + m_plate = 0; + + // register for savestates + save_item(NAME(m_display_maxy)); + save_item(NAME(m_display_maxx)); + save_item(NAME(m_display_wait)); + + save_item(NAME(m_display_state)); + /* save_item(NAME(m_display_cache)); */ // don't save! + /* save_item(NAME(m_power_led)); */ // don't save! + save_item(NAME(m_display_decay)); + save_item(NAME(m_display_segmask)); + + save_item(NAME(m_o)); + save_item(NAME(m_r)); + save_item(NAME(m_inp_mux)); + save_item(NAME(m_power_on)); + save_item(NAME(m_grid)); + save_item(NAME(m_plate)); +} + +void hh_tms1k_state::machine_reset() +{ + m_power_on = true; +} + + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// The device may strobe the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +void hh_tms1k_state::display_update() +{ + UINT32 active_state[0x20]; + + for (int y = 0; y < m_display_maxy; y++) + { + active_state[y] = 0; + + for (int x = 0; x <= m_display_maxx; x++) + { + // turn on powered segments + if (m_power_on && m_display_state[y] >> x & 1) + m_display_decay[y][x] = m_display_wait; + + // determine active state + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; + active_state[y] |= (ds << x); + } + } + + // on difference, send to output + for (int y = 0; y < m_display_maxy; y++) + if (m_display_cache[y] != active_state[y]) + { + if (m_display_segmask[y] != 0) + output_set_digit_value(y, active_state[y] & m_display_segmask[y]); + + const int mul = (m_display_maxx <= 10) ? 10 : 100; + for (int x = 0; x <= m_display_maxx; x++) + { + int state = active_state[y] >> x & 1; + char buf1[0x10]; // lampyx + char buf2[0x10]; // y.x + + if (x == m_display_maxx) + { + // always-on if selected + sprintf(buf1, "lamp%da", y); + sprintf(buf2, "%d.a", y); + } + else + { + sprintf(buf1, "lamp%d", y * mul + x); + sprintf(buf2, "%d.%d", y, x); + } + output_set_value(buf1, state); + output_set_value(buf2, state); + } + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); + + // output optional power led + if (m_power_led != m_power_on) + { + m_power_led = m_power_on; + output_set_value("power_led", m_power_led ? 1 : 0); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(hh_tms1k_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int y = 0; y < m_display_maxy; y++) + for (int x = 0; x <= m_display_maxx; x++) + if (m_display_decay[y][x] != 0) + m_display_decay[y][x]--; + + display_update(); +} + +void hh_tms1k_state::set_display_size(int maxx, int maxy) +{ + m_display_maxx = maxx; + m_display_maxy = maxy; +} + +void hh_tms1k_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) +{ + set_display_size(maxx, maxy); + + // update current state + UINT32 mask = (1 << maxx) - 1; + for (int y = 0; y < maxy; y++) + m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; + + display_update(); +} + +void hh_tms1k_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask) +{ + // expects m_display_segmask to be not-0 + for (int y = 0; y < maxy; y++) + m_display_segmask[y] &= segmask; + + display_matrix(maxx, maxy, setx, sety); +} + + +UINT8 hh_tms1k_state::read_inputs(int columns) +{ + UINT8 ret = 0; + + // read selected input rows + for (int i = 0; i < columns; i++) + if (m_inp_mux >> i & 1) + ret |= m_inp_matrix[i]->read(); + + return ret; +} + + +// devices with a TMS0980 can auto power-off + +WRITE_LINE_MEMBER(hh_tms1k_state::auto_power_off) +{ + if (state) + { + m_power_on = false; + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + } +} + +INPUT_CHANGED_MEMBER(hh_tms1k_state::power_button) +{ + m_power_on = (bool)(FPTR)param; + m_maincpu->set_input_line(INPUT_LINE_RESET, m_power_on ? CLEAR_LINE : ASSERT_LINE); +} + + + +/*************************************************************************** + + Minidrivers (subclass, I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + APF Mathemagician + * TMS1100 MCU, labeled MP1030 + * 2 x DS8870N - Hex LED Digit Driver + * 2 x DS8861N - MOS-to-LED 5-Segment Driver + * 10-digit 7seg LED display(2 custom ones) + 4 LEDs, no sound + + This is a tabletop educational calculator. It came with plastic overlays + for playing different kind of games. Refer to the manual on how to use it. + In short, to start from scratch, press [SEL]. By default the device is in + calculator teaching mode. If [SEL] is followed with 1-6 and then [NXT], + one of the games is started. + + 1) Number Machine + 2) Countin' On + 3) Walk The Plank + 4) Gooey Gumdrop + 5) Football + 6) Lunar Lander + +***************************************************************************/ + +class mathmagi_state : public hh_tms1k_state +{ +public: + mathmagi_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void mathmagi_state::prepare_display() +{ + // R0-R7: 7seg leds + for (int y = 0; y < 8; y++) + { + m_display_segmask[y] = 0x7f; + m_display_state[y] = (m_r >> y & 1) ? (m_o >> 1) : 0; + } + + // R8: custom math symbols digit + // R9: custom equals digit + // R10: misc lamps + for (int y = 8; y < 11; y++) + m_display_state[y] = (m_r >> y & 1) ? m_o : 0; + + set_display_size(8, 11); + display_update(); +} + +WRITE16_MEMBER(mathmagi_state::write_r) +{ + // R3,R5-R7,R9,R10: input mux + m_inp_mux = (data >> 3 & 1) | (data >> 4 & 0xe) | (data >> 5 & 0x30); + + // +others: + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(mathmagi_state::write_o) +{ + // O1-O7: digit segments A-G + // O0: N/C + data = (data << 1 & 0xfe) | (data >> 7 & 1); // because opla is unknown + m_o = data; +} + +READ8_MEMBER(mathmagi_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(6); +} + + +// config + +/* physical button layout and labels is like this: + + ON ONE [SEL] [NXT] [?] [/] + | | [7] [8] [9] [x] + OFF TWO [4] [5] [6] [-] + PLAYERS [1] [2] [3] [+] + [0] [_] [r] [=] +*/ + +static INPUT_PORTS_START( mathmagi ) + PORT_START("IN.0") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + + PORT_START("IN.1") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("_") // blank + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("r") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + + PORT_START("IN.2") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + + PORT_START("IN.3") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("SEL") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("NXT") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("?") // check + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + + PORT_START("IN.4") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + + PORT_START("IN.5") // R10 + PORT_CONFNAME( 0x01, 0x00, "Players") + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +// output PLA is not dumped +static const UINT16 mathmagi_output_pla[0x20] = +{ + lA+lB+lC+lD+lE+lF, // 0 + lB+lC, // 1 + lA+lB+lG+lE+lD, // 2 + lA+lB+lG+lC+lD, // 3 + lF+lB+lG+lC, // 4 + lA+lF+lG+lC+lD, // 5 + lA+lF+lG+lC+lD+lE, // 6 + lA+lB+lC, // 7 + lA+lB+lC+lD+lE+lF+lG, // 8 + lA+lB+lG+lF+lC+lD, // 9 + lA+lB+lG+lE, // question mark + lE+lG, // r + lD, // underscore? + lA+lF+lG+lE+lD, // E + lG, // - + 0, // empty + 0, // empty + lG, // lamp 4 or MATH - + lD, // lamp 3 + lF+lE+lD+lC+lG, // b + lB, // lamp 2 + lB+lG, // MATH + + lB+lC, // MATH mul + lF+lG+lB+lC+lD, // y + lA, // lamp 1 + lA+lG, // MATH div + lA+lD, // EQUALS + 0, // ? + 0, // ? + lE+lD+lC+lG, // o + 0, // ? + lA+lF+lE+lD+lC // G +}; + +static MACHINE_CONFIG_START( mathmagi, mathmagi_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 175000) // RC osc. R=68K, C=82pf -> ~175kHz + MCFG_TMS1XXX_OUTPUT_PLA(mathmagi_output_pla) + MCFG_TMS1XXX_READ_K_CB(READ8(mathmagi_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mathmagi_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mathmagi_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_mathmagi) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Amaze-A-Tron, by Ralph Baer + * TMS1100 MCU, labeled MP3405(die label too) + * 2-digit 7seg LED display + 2 LEDs(one red, one green), 1bit sound + * 5x5 pressure-sensitive playing board + + This is an electronic board game with a selection of 8 maze games, + most of them for 2 players. A 5x5 playing grid and four markers are + required to play. Refer to the official manual for more information. + +***************************************************************************/ + +class amaztron_state : public hh_tms1k_state +{ +public: + amaztron_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void amaztron_state::prepare_display() +{ + // R8,R9: select digit + for (int y = 0; y < 2; y++) + { + m_display_segmask[y] = 0x7f; + m_display_state[y] = (m_r >> (y + 8) & 1) ? m_o : 0; + } + + // R6,R7: lamps (-> lamp20,21) + m_display_state[2] = m_r >> 6 & 3; + + set_display_size(8, 3); + display_update(); +} + +WRITE16_MEMBER(amaztron_state::write_r) +{ + // R0-R5: input mux + m_inp_mux = data & 0x3f; + + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // other bits: + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(amaztron_state::write_o) +{ + // O0-O6: digit segments A-G + // O7: N/C + m_o = data & 0x7f; + prepare_display(); +} + +READ8_MEMBER(amaztron_state::read_k) +{ + // K: multiplexed inputs + UINT8 k = read_inputs(6); + + // the 5th column is tied to K4+K8 + if (k & 0x10) k |= 0xc; + return k & 0xf; +} + + +// config + +static INPUT_PORTS_START( amaztron ) + PORT_START("IN.0") // R0 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Grid 1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Grid 6") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Grid 11") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Grid 16") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("Grid 21") + + PORT_START("IN.1") // R1 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Grid 2") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Grid 7") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Grid 12") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Grid 17") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Grid 22") + + PORT_START("IN.2") // R2 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Grid 3") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Grid 8") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Grid 13") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Grid 18") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Grid 23") + + PORT_START("IN.3") // R3 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Grid 4") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_NAME("Grid 9") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Grid 14") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Grid 19") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Grid 24") + + PORT_START("IN.4") // R4 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Grid 5") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_NAME("Grid 10") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Grid 15") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Grid 20") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Grid 25") + + PORT_START("IN.5") // R5 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Game Select") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("Game Start") + PORT_BIT(0x1c, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( amaztron, amaztron_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K?, C=100pf -> ~350kHz + MCFG_TMS1XXX_READ_K_CB(READ8(amaztron_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(amaztron_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(amaztron_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_amaztron) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Head to Head Baseball + * PCB labels Coleco rev C 73891/2 + * TMS1170NLN MP1525-N2 (die labeled MP1525) + * 9-digit cyan VFD display, and other LEDs behind bezel, 1bit sound + + known releases: + - USA: Head to Head Baseball + - Japan: Computer Baseball, published by Tsukuda + +***************************************************************************/ + +class h2hbaseb_state : public hh_tms1k_state +{ +public: + h2hbaseb_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(skill_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +void h2hbaseb_state::prepare_display() +{ + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); + display_matrix_seg(9, 9, (m_r & 0x100) | m_o, (m_r & 0xff) | (m_r >> 1 & 0x100), 0x7f); +} + +WRITE16_MEMBER(h2hbaseb_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R4-R7: input mux + m_inp_mux = data >> 4 & 0xf; + + // R0-R7,R9: select vfd digit/led + // R8: led state + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(h2hbaseb_state::write_o) +{ + // O0-O6: digit segments A-G + // O7: N/C + m_o = data; + prepare_display(); +} + +READ8_MEMBER(h2hbaseb_state::read_k) +{ + // K: multiplexed inputs (note: K8(Vss row) is always on) + return m_inp_matrix[4]->read() | read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( h2hbaseb ) + PORT_START("IN.0") // R4 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("N") + PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("B") + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("S") + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Curve") // these two buttons appear twice on the board + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Fast Pitch") + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // Vss! + PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Swing") + + PORT_START("IN.5") // fake + PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, h2hbaseb_state, skill_switch, NULL) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(h2hbaseb_state::skill_switch) +{ + set_clock(); +} + + +void h2hbaseb_state::set_clock() +{ + // MCU clock is from an RC circuit with C=47pf, and R value is depending on + // skill switch: R=51K(1) or 43K(2) + m_maincpu->set_unscaled_clock((m_inp_matrix[5]->read() & 1) ? 400000 : 350000); +} + +void h2hbaseb_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + set_clock(); +} + +static MACHINE_CONFIG_START( h2hbaseb, h2hbaseb_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1170, 350000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(h2hbaseb_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hbaseb_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hbaseb_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_h2hbaseb) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Head to Head Football + * TMS1100NLLE (rev. E!) MP3460 (die labeled MP3460) + * 2*SN75492N LED display drivers, 9-digit LED grid, 1bit sound + + LED electronic football game. To distinguish between offense and defense, + offense blips (should) appear brighter. + +***************************************************************************/ + +class h2hfootb_state : public hh_tms1k_state +{ +public: + h2hfootb_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void h2hfootb_state::prepare_display() +{ + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); + display_matrix_seg(9, 9, m_o | (m_r >> 1 & 0x100), (m_r & 0x1ff), 0x7f); +} + +WRITE16_MEMBER(h2hfootb_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R0-R8: input mux + m_inp_mux = data & 0x1ff; + + // R0-R8: select led + // R9: led between digits + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(h2hfootb_state::write_o) +{ + // O0-O7: digit segments A-G,A' + m_o = data; + prepare_display(); +} + +READ8_MEMBER(h2hfootb_state::read_k) +{ + // K: multiplexed inputs + UINT8 k = 0; + + // compared to the usual setup, the button matrix is rotated + for (int i = 0; i < 4; i++) + if (m_inp_matrix[i]->read() & m_inp_mux) + k |= 1 << i; + + return k; +} + + +// config + +static INPUT_PORTS_START( h2hfootb ) + PORT_START("IN.0") // K1 + PORT_CONFNAME( 0x03, 0x01, "Players" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + + PORT_START("IN.1") // K2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_TOGGLE PORT_NAME("P1 Play Selector") // pass + PORT_BIT( 0x02, 0x02, IPT_SPECIAL ) PORT_CONDITION("IN.1", 0x01, EQUALS, 0x00) // run/kick + + PORT_START("IN.2") // K4 + PORT_CONFNAME( 0x03, 0x01, "Skill Level" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + + PORT_START("IN.3") // K8 + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("P1 Left/Right") + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Kick/Pass") + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Display") + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY +INPUT_PORTS_END + +static MACHINE_CONFIG_START( h2hfootb, h2hfootb_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 325000) // approximation - RC osc. R=39K, C=100pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(h2hfootb_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hfootb_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hfootb_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_h2hfootb) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Coleco Total Control 4 + * TMS1400NLL MP7334-N2 (die labeled MP7334) + * 2x2-digit 7seg LED display + 4 LEDs, LED grid display, 1bit sound + + This is a head to head electronic tabletop LED-display sports console. + One cartridge(Football) was included with the console, the other three were + sold in a pack. Gameplay has emphasis on strategy, read the official manual + on how to play. Remember that you can rotate the view in MAME: rotate left + for Home(P1) orientation, rotate right for Visitor(P2) orientation. + + Cartridge socket: + 1 N/C + 2 9V+ + 3 power switch + 4 K8 + 5 K4 + 6 K2 + 7 K1 + 8 R9 + + The cartridge connects pin 8 with one of the K-pins. + + Available cartridges: + - Football (K8, confirmed) + - Hockey (K4?) + - Soccer (K2?) + - Basketball (K1?) + +***************************************************************************/ + +class tc4_state : public hh_tms1k_state +{ +public: + tc4_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tc4_state::prepare_display() +{ + // R5,R7-R9 are 7segs + for (int y = 5; y < 10; y++) + if (y != 6) + m_display_segmask[y] = 0x7f; + + // update current state (note: R6 as extra column!) + display_matrix(9, 10, (m_o | (m_r << 2 & 0x100)), m_r); +} + +WRITE16_MEMBER(tc4_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R0-R5: input mux + // R9: to cartridge slot + m_inp_mux = (data & 0x3f) | (data >> 3 & 0x40); + + // R0-R4: select led + // R6: led 8 state + // R5,R7-R9: select digit + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(tc4_state::write_o) +{ + // O0-O7: led state + m_o = data; + prepare_display(); +} + +READ8_MEMBER(tc4_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(7); +} + + +// config + +static INPUT_PORTS_START( tc4 ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Pass/Shoot Button 3") // right + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Pass/Shoot Button 1") // left + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Pass/Shoot Button 2") // middle + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 D/K Button") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(2) + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Pass/Shoot Button 3") // right + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Pass/Shoot Button 1") // left + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Pass/Shoot Button 2") // middle + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 D/K Button") + + PORT_START("IN.6") // R9 + PORT_CONFNAME( 0x0f, 0x08, "Cartridge") + PORT_CONFSETTING( 0x01, "Basketball" ) + PORT_CONFSETTING( 0x02, "Soccer" ) + PORT_CONFSETTING( 0x04, "Hockey" ) + PORT_CONFSETTING( 0x08, "Football" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tc4, tc4_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=27.3K, C=100pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(tc4_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tc4_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tc4_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tc4) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex (Electronic) Baseball (1) + * TMS1000NLP MP0914 (die labeled MP0914A) + * 1 7seg LED, and other LEDs behind bezel, 1bit sound + + This is a handheld LED baseball game. One player controls the batter, the CPU + or other player controls the pitcher. Pitcher throw buttons are on a 'joypad' + obtained from a compartment in the back. Player scores are supposed to be + written down manually, the game doesn't save scores or innings (this annoyance + was resolved in the sequel). For more information, refer to the official manual. + + The overlay graphic is known to have 2 versions: one where the field players + are denoted by words ("left", "center", "short", etc), and an alternate one + with little guys drawn next to the LEDs. + + lamp translation table: led LDzz from game PCB = MAME lampyx: + + LD0 = - LD10 = lamp12 LD20 = lamp42 LD30 = lamp60 + LD1 = lamp23 LD11 = lamp4 LD21 = lamp41 LD31 = lamp61 + LD2 = lamp0 LD12 = lamp15 LD22 = lamp40 LD32 = lamp62 + LD3 = lamp1 LD13 = lamp22 LD23 = lamp43 LD33 = lamp70 + LD4 = lamp2 LD14 = lamp33 LD24 = lamp53 LD34 = lamp71 + LD5 = lamp10 LD15 = lamp32 LD25 = lamp52 + LD6 = lamp13 LD16 = lamp21 LD26 = lamp51 + LD7 = lamp11 LD17 = lamp31 LD27 = lamp50 + LD8 = lamp3 LD18 = lamp30 LD28 = lamp72 + LD9 = lamp14 LD19 = lamp20 LD29 = lamp73 + +***************************************************************************/ + +class ebball_state : public hh_tms1k_state +{ +public: + ebball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void ebball_state::prepare_display() +{ + // R8 is a 7seg + m_display_segmask[8] = 0x7f; + + display_matrix(7, 9, ~m_o, m_r); +} + +WRITE16_MEMBER(ebball_state::write_r) +{ + // R1-R5: input mux + m_inp_mux = data >> 1 & 0x1f; + + // R9: speaker out + m_speaker->level_w(data >> 9 & 1); + + // R0-R8: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(ebball_state::write_o) +{ + // O0-O6: led state + // O7: N/C + m_o = data & 0x7f; + prepare_display(); +} + +READ8_MEMBER(ebball_state::read_k) +{ + // K: multiplexed inputs (note: K8(Vss row) is always on) + return m_inp_matrix[5]->read() | read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( ebball ) + PORT_START("IN.0") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Change Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Change Sides") + PORT_CONFNAME( 0x04, 0x04, "Players" ) + PORT_CONFSETTING( 0x04, "1" ) // Auto + PORT_CONFSETTING( 0x00, "2" ) // Manual + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Fast Ball") + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Knuckler") + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Curve") + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Slider") + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.5") // Vss! + PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Batter") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ebball, ebball_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1000, 375000) // RC osc. R=43K, C=47pf -> ~375kHz + MCFG_TMS1XXX_READ_K_CB(READ8(ebball_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ebball) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex (Electronic) Baseball 2 + * PCBs are labeled: ZENY + * TMS1000 MCU, MP0923 (die labeled MP0923) + * 3 7seg LEDs, and other LEDs behind bezel, 1bit sound + + The Japanese version was published by Gakken, black casing instead of white. + + The sequel to Entex Baseball, this version keeps up with score and innings. + As its predecessor, the pitcher controls are on a separate joypad. + + lamp translation table: led zz from game PCB = MAME lampyx: + + 00 = - 10 = lamp94 20 = lamp74 30 = lamp50 + 01 = lamp53 11 = lamp93 21 = lamp75 31 = lamp51 + 02 = lamp7 12 = lamp92 22 = lamp80 32 = lamp52 + 03 = lamp17 13 = lamp62 23 = lamp81 33 = lamp40 + 04 = lamp27 14 = lamp70 24 = lamp82 34 = lamp41 + 05 = lamp97 15 = lamp71 25 = lamp83 35 = lamp31 + 06 = lamp90 16 = lamp61 26 = lamp84 36 = lamp30 + 07 = lamp95 17 = lamp72 27 = lamp85 37 = lamp33 + 08 = lamp63 18 = lamp73 28 = lamp42 38 = lamp32 + 09 = lamp91 19 = lamp60 29 = lamp43 + +***************************************************************************/ + +class ebball2_state : public hh_tms1k_state +{ +public: + ebball2_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void ebball2_state::prepare_display() +{ + // R0-R2 are 7segs + for (int y = 0; y < 3; y++) + m_display_segmask[y] = 0x7f; + + display_matrix(8, 10, ~m_o, m_r ^ 0x7f); +} + +WRITE16_MEMBER(ebball2_state::write_r) +{ + // R3-R6: input mux + m_inp_mux = data >> 3 & 0xf; + + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R0-R9: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(ebball2_state::write_o) +{ + // O0-O7: led state + m_o = data; + prepare_display(); +} + +READ8_MEMBER(ebball2_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( ebball2 ) + PORT_START("IN.0") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_CONFNAME( 0x02, 0x02, "Players" ) + PORT_CONFSETTING( 0x02, "1" ) // Auto + PORT_CONFSETTING( 0x00, "2" ) // Manual + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Fast Ball") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Batter") + + PORT_START("IN.1") // R4 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Steal") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Change Up") + PORT_BIT( 0x09, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // R5 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Slider") + PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Knuckler") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Curve") + PORT_BIT( 0x0a, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ebball2, ebball2_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=47K, C=47pf -> ~350kHz + MCFG_TMS1XXX_READ_K_CB(READ8(ebball2_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball2_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball2_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ebball2) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex (Electronic) Baseball 3 + * PCBs are labeled: ZENY + * TMS1100NLL 6007 MP1204 (rev. E!) (die labeled MP1204) + * 2*SN75492N LED display driver + * 4 7seg LEDs, and other LEDs behind bezel, 1bit sound + + This is another improvement over Entex Baseball, where gameplay is a bit more + varied. Like the others, the pitcher controls are on a separate joypad. + + lamp translation table: led zz from game PCB = MAME lampyx: + note: unlabeled panel leds are listed here as Sz, Bz, Oz, Iz, z left-to-right + + 00 = - 10 = lamp75 20 = lamp72 + 01 = lamp60 11 = lamp65 21 = lamp84 + 02 = lamp61 12 = lamp55 22 = lamp85 + 03 = lamp62 13 = lamp52 23 = lamp90 + 04 = lamp63 14 = lamp80 24 = lamp92 + 05 = lamp73 15 = lamp81 25 = lamp91 + 06 = lamp53 16 = lamp51 26 = lamp93 + 07 = lamp74 17 = lamp82 27 = lamp95 + 08 = lamp64 18 = lamp83 28 = lamp94 + 09 = lamp54 19 = lamp50 + + S1,S2: lamp40,41 + B1-B3: lamp30-32 + O1,O2: lamp42,43 + I1-I6: lamp20-25, I7-I9: lamp33-35 + +***************************************************************************/ + +class ebball3_state : public hh_tms1k_state +{ +public: + ebball3_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(skill_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +void ebball3_state::prepare_display() +{ + // update current state + for (int y = 0; y < 10; y++) + m_display_state[y] = (m_r >> y & 1) ? m_o : 0; + + // R0,R1 are normal 7segs + m_display_segmask[0] = m_display_segmask[1] = 0x7f; + + // R4,R7 contain segments(only F and B) for the two other digits + m_display_state[10] = (m_display_state[4] & 0x20) | (m_display_state[7] & 0x02); + m_display_state[11] = ((m_display_state[4] & 0x10) | (m_display_state[7] & 0x01)) << 1; + m_display_segmask[10] = m_display_segmask[11] = 0x22; + + set_display_size(7, 10+2); + display_update(); +} + +WRITE16_MEMBER(ebball3_state::write_r) +{ + // R0-R2: input mux + m_inp_mux = data & 7; + + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R0-R9: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(ebball3_state::write_o) +{ + // O0-O6: led state + // O7: N/C + m_o = data & 0x7f; + prepare_display(); +} + +READ8_MEMBER(ebball3_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(3); +} + + +// config + +/* physical button layout and labels is like this: + + main device (batter side): remote pitcher: + + MAN + PRO | [FAST BALL] [CHANGE UP] [CURVE] [SLIDER] + | OFF| + o o [STEAL DEFENSE] [KNUCKLER] + AM AUTO + + [BUNT] [BATTER] [STEAL] +*/ + +static INPUT_PORTS_START( ebball3 ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Fast Ball") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Change Up") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Slider") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Curve") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Knuckler") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Steal") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Batter") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Steal Defense") + + PORT_START("IN.2") // R2 + PORT_CONFNAME( 0x01, 0x01, "Players" ) + PORT_CONFSETTING( 0x01, "1" ) // Auto + PORT_CONFSETTING( 0x00, "2" ) // Manual + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Bunt") + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // fake + PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ebball3_state, skill_switch, NULL) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x01, "Professional" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(ebball3_state::skill_switch) +{ + set_clock(); +} + + +void ebball3_state::set_clock() +{ + // MCU clock is from an RC circuit(R=47K, C=33pf) oscillating by default at ~340kHz, + // but on PRO, the difficulty switch adds an extra 150K resistor to Vdd to speed + // it up to around ~440kHz. + m_maincpu->set_unscaled_clock((m_inp_matrix[3]->read() & 1) ? 440000 : 340000); +} + +void ebball3_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + set_clock(); +} + +static MACHINE_CONFIG_START( ebball3, ebball3_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 340000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(ebball3_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball3_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball3_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ebball3) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex Space Invader + * TMS1100 MP1211 (die labeled MP1211) + * 3 7seg LEDs, LED matrix and overlay mask, 1bit sound + + There are two versions of this game: the first release(this one) is on + TMS1100, the second more widespread release runs on a COP400. There are + also differences with the overlay mask. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class einvader_state : public hh_tms1k_state +{ +public: + einvader_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(skill_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +void einvader_state::prepare_display() +{ + // R7-R9 are 7segs + for (int y = 7; y < 10; y++) + m_display_segmask[y] = 0x7f; + + display_matrix(8, 10, m_o, m_r); +} + +WRITE16_MEMBER(einvader_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R0-R9: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(einvader_state::write_o) +{ + // O0-O7: led state + m_o = data; + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( einvader ) + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_CONFNAME( 0x08, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, einvader_state, skill_switch, NULL) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x08, "Professional" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(einvader_state::skill_switch) +{ + set_clock(); +} + + +void einvader_state::set_clock() +{ + // MCU clock is from an RC circuit(R=47K, C=56pf) oscillating by default at ~320kHz, + // but on PRO, the difficulty switch adds an extra 180K resistor to Vdd to speed + // it up to around ~400kHz. + m_maincpu->set_unscaled_clock((m_inp_matrix[0]->read() & 8) ? 400000 : 320000); +} + +void einvader_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + set_clock(); +} + +static MACHINE_CONFIG_START( einvader, einvader_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 320000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(IOPORT("IN.0")) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(einvader_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(einvader_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_einvader) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex Color Football 4 + * TMS1670 6009 MP7551 (die also labeled MP7551) + * 9-digit cyan VFD display, 60 red and green LEDs behind bezel, 1bit sound + +***************************************************************************/ + +class efootb4_state : public hh_tms1k_state +{ +public: + efootb4_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void efootb4_state::prepare_display() +{ + // R10-R15 are 7segs + for (int y = 10; y < 16; y++) + m_display_segmask[y] = 0x7f; + + display_matrix(7, 16, m_o, m_r); +} + +WRITE16_MEMBER(efootb4_state::write_r) +{ + // R0-R4: input mux + m_inp_mux = data & 0x1f; + + // R0-R9: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(efootb4_state::write_o) +{ + // O7: speaker out + m_speaker->level_w(data >> 7 & 1); + + // O0-O6: led state + m_o = data; + prepare_display(); +} + +READ8_MEMBER(efootb4_state::read_k) +{ + return read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( efootb4 ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY // 1 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY // 2 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY // 3 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY // 4 + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY // 1 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY // 2 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY // 3 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY // 4 + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Run") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Pass") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Kick") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Run") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Pass") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL PORT_NAME("P2 Kick") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // R4 + PORT_CONFNAME( 0x01, 0x01, "Players" ) + PORT_CONFSETTING( 0x01, "1" ) // Auto + PORT_CONFSETTING( 0x00, "2" ) // Manual + PORT_CONFNAME( 0x02, 0x00, "Skill Level" ) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x02, "Professional" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Status") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( efootb4, efootb4_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1670, 475000) // approximation - RC osc. R=42K, C=47pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(efootb4_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(efootb4_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(efootb4_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_efootb4) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex (Electronic) Basketball 2 + * TMS1100 6010 MP1218 (die also labeled MP1218) + * 4 7seg LEDs, and other LEDs behind bezel, 1bit sound + + lamp translation table: led zz from game PCB = MAME lampyx: + + 11 = lamp90 21 = lamp91 31 = lamp92 41 = lamp93 51 = lamp95 + 12 = lamp80 22 = lamp81 32 = lamp82 42 = lamp83 52 = lamp85 + 13 = lamp70 23 = lamp71 33 = lamp72 43 = lamp73 53 = lamp84 + 14 = lamp60 24 = lamp61 34 = lamp62 44 = lamp63 54 = lamp75 + 15 = lamp50 25 = lamp51 35 = lamp52 45 = lamp53 55 = lamp74 + 16 = lamp40 26 = lamp41 36 = lamp42 46 = lamp43 56 = lamp65 + + A = lamp94 + B = lamp64 + +***************************************************************************/ + +class ebaskb2_state : public hh_tms1k_state +{ +public: + ebaskb2_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void ebaskb2_state::prepare_display() +{ + // R0-R3 are 7segs + for (int y = 0; y < 4; y++) + m_display_segmask[y] = 0x7f; + + display_matrix(7, 10, m_o, m_r); +} + +WRITE16_MEMBER(ebaskb2_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R6-R9: input mux + m_inp_mux = data >> 6 & 0xf; + + // R0-R9: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(ebaskb2_state::write_o) +{ + // O0-O6: led state + // O7: N/C + m_o = data; + prepare_display(); +} + +READ8_MEMBER(ebaskb2_state::read_k) +{ + return read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( ebaskb2 ) + PORT_START("IN.0") // R6 + PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) + PORT_CONFSETTING( 0x01, "Amateur" ) + PORT_CONFSETTING( 0x00, "Professional" ) + PORT_CONFNAME( 0x02, 0x02, "Players" ) + PORT_CONFSETTING( 0x02, "1" ) // Auto + PORT_CONFSETTING( 0x00, "2" ) // Manual + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Shoot") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Pass") + + PORT_START("IN.1") // R7 + PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Pass") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Shoot") + + PORT_START("IN.2") // R8 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY + + PORT_START("IN.3") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ebaskb2, ebaskb2_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 360000) // RC osc. R=33K, C=82pf -> ~360kHz + MCFG_TMS1XXX_READ_K_CB(READ8(ebaskb2_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebaskb2_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebaskb2_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ebaskb2) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Entex Raise The Devil + * TMS1100 MP1221 (die labeled MP1221) + * 4 7seg LEDs(rightmost one unused), and other LEDs behind bezel, 1bit sound + + lamp translation table: led zz from game PCB = MAME lampyx: + + 0 = - 10 = lamp44 20 = lamp53 30 = lamp95 40 = lamp92 + 1 = lamp30 11 = lamp45 21 = lamp54 31 = lamp85 41 = lamp93 + 2 = lamp31 12 = - 22 = - 32 = lamp65 42 = lamp90 + 3 = lamp32 13 = lamp50 23 = lamp60 33 = lamp74 43 = lamp91 + 4 = lamp33 14 = lamp51 24 = lamp61 34 = lamp70 + 5 = lamp34 15 = lamp52 25 = lamp62 35 = lamp71 + 6 = lamp40 16 = - 26 = lamp63 36 = lamp80 + 7 = lamp41 17 = lamp72 27 = lamp64 37 = lamp81 + 8 = lamp42 18 = lamp73 28 = lamp84 38 = lamp82 + 9 = lamp43 19 = - 29 = lamp94 39 = lamp83 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class raisedvl_state : public hh_tms1k_state +{ +public: + raisedvl_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(skill_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +void raisedvl_state::prepare_display() +{ + // R0-R2 are 7segs + for (int y = 0; y < 3; y++) + m_display_segmask[y] = 0x7f; + + display_matrix(7, 10, m_o, m_r); +} + +WRITE16_MEMBER(raisedvl_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R0,R1: input mux + m_inp_mux = data & 3; + + // R0-R9: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(raisedvl_state::write_o) +{ + // O0-O6: led state + // O7: N/C + m_o = data & 0x7f; + prepare_display(); +} + +READ8_MEMBER(raisedvl_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(2) & 0xf; +} + + +// config + +static INPUT_PORTS_START( raisedvl ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Shoot") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left Flipper") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right Flipper") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R1 (only bit 0) + PORT_CONFNAME( 0x31, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, raisedvl_state, skill_switch, NULL) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x10, "2" ) + PORT_CONFSETTING( 0x11, "3" ) + PORT_CONFSETTING( 0x21, "4" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(raisedvl_state::skill_switch) +{ + set_clock(); +} + + +void raisedvl_state::set_clock() +{ + // MCU clock is from an RC circuit with C=47pf, R=47K by default. Skills + // 2 and 3 add a 150K resistor in parallel, and skill 4 adds a 100K one. + // 0: R=47K -> ~350kHz + // 2,3: R=35K8 -> ~425kHz (combined) + // 4: R=32K -> ~465kHz (combined) + UINT8 inp = m_inp_matrix[1]->read(); + m_maincpu->set_unscaled_clock((inp & 0x20) ? 465000 : ((inp & 0x10) ? 425000 : 350000)); +} + +void raisedvl_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + set_clock(); +} + +static MACHINE_CONFIG_START( raisedvl, raisedvl_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 350000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(raisedvl_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(raisedvl_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(raisedvl_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_tms1k_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Gakken Poker + * PCB label POKER. gakken + * TMS1370 MP2105 (die labeled MP2105) + * 11-digit cyan VFD display Itron FG1114B, oscillator sound + + known releases: + - Japan: Poker + - USA: Electronic Poker, published by Entex + +***************************************************************************/ + +class gpoker_state : public hh_tms1k_state +{ +public: + gpoker_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag), + m_beeper(*this, "beeper") + { } + + required_device m_beeper; + + void prepare_display(); + virtual DECLARE_WRITE16_MEMBER(write_r); + virtual DECLARE_WRITE16_MEMBER(write_o); + virtual DECLARE_READ8_MEMBER(read_k); + +protected: + virtual void machine_reset(); +}; + +// handlers + +void gpoker_state::prepare_display() +{ + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); + display_matrix_seg(12, 11, m_o | (m_r >> 3 & 0xf00), m_r & 0x7ff, 0x7f); +} + +WRITE16_MEMBER(gpoker_state::write_r) +{ + // R15: enable beeper + m_beeper->set_state(data >> 15 & 1); + + // R0-R6: input mux + m_inp_mux = data & 0x7f; + + // R0-R10: select digit + // R11-R14: card symbols + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(gpoker_state::write_o) +{ + // O0-O7: digit segments A-G,H + m_o = data; + prepare_display(); +} + +READ8_MEMBER(gpoker_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(7); +} + + +// config + +/* physical button layout and labels is like this: + + [7] [8] [9] [DL] | (on/off switch) + [4] [5] [6] [BT] + [1] [2] [3] [CA] [CE] + [0] [GO] [T] [AC] +*/ + +static INPUT_PORTS_START( gpoker ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_D) PORT_NAME("9/Deal") // DL, shares pad with 9 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear Entry") // CE + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear All") // AC + + PORT_START("IN.6") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Call") // CA + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Total") // T + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet") // BT +INPUT_PORTS_END + + +void gpoker_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + m_beeper->set_state(0); +} + +static MACHINE_CONFIG_START( gpoker, gpoker_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1370, 350000) // RC osc. R=47K, C=47pf -> ~350kHz + MCFG_TMS1XXX_READ_K_CB(READ8(gpoker_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(gpoker_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(gpoker_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_gpoker) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 2405) // astable multivibrator - C1 and C2 are 0.003uF, R1 and R4 are 1K, R2 and R3 are 100K + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Gakken Jackpot: Gin Rummy & Black Jack + * PCB label gakken + * TMS1670 MPF553 (die labeled MPF553) + * 11-digit cyan VFD display Itron FG1114B, oscillator sound + + known releases: + - Japan: Jackpot(?) + - USA: Electronic Jackpot: Gin Rummy & Black Jack, published by Entex + +***************************************************************************/ + +class gjackpot_state : public gpoker_state +{ +public: + gjackpot_state(const machine_config &mconfig, device_type type, const char *tag) + : gpoker_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE16_MEMBER(write_r); +}; + +// handlers + +WRITE16_MEMBER(gjackpot_state::write_r) +{ + // same as gpoker, only input mux msb is R10 instead of R6 + gpoker_state::write_r(space, offset, data); + m_inp_mux = (data & 0x3f) | (data >> 4 & 0x40); +} + + +// config + +/* physical button layout and labels is like this: + (note: on dual-function buttons, upper label=Gin, lower label=Black Jack) + + BJ --o GIN + OFF + [7] [8] [9] [DL] + + [4] [5] [6] [ [KN + DB] SP] + [1] [2] [3] [DS] [DR] + BT] HT] + [10/1] [T] [MD [CH [AC] + GO] ST] +*/ + +static INPUT_PORTS_START( gjackpot ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("10/0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("Draw/Hit") // DR/HT + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Deal") // DL + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("Knock/Split") // KN/SP + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Total") // T + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Display/Bet") // DS/BT + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Meld/Go") // MD/GO + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Double") // DB + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Change/Stand") // CH/ST + PORT_BIT( 0x0a, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear Entry") // CE + PORT_BIT( 0x0a, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.6") // R10 + PORT_CONFNAME( 0x06, 0x04, "Game Select" ) + PORT_CONFSETTING( 0x04, "Gin Rummy" ) + PORT_CONFSETTING( 0x02, "Black Jack" ) + PORT_BIT( 0x09, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( gjackpot, gjackpot_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1670, 450000) // approximation - RC osc. R=47K, C=47pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(gpoker_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(gjackpot_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(gpoker_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_gjackpot) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 2405) // see gpoker + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Ideal Electronic Detective + * TMS0980NLL MP6100A (die labeled 0980B-00) + * 10-digit 7seg LED display, 1bit sound + + hardware (and concept) is very similar to Parker Bros Stop Thief + + This is an electronic board game. It requires game cards with suspect info, + and good old pen and paper to record game progress. To start the game, enter + difficulty(1-3), then number of players(1-4), then [ENTER]. Refer to the + manual for more information. + +***************************************************************************/ + +class elecdet_state : public hh_tms1k_state +{ +public: + elecdet_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(elecdet_state::write_r) +{ + // R7,R8: speaker on + m_speaker->level_w((data & 0x180 && m_o & 0x80) ? 1 : 0); + + // R0-R6: select digit + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); + display_matrix_seg(7, 7, BITSWAP8(m_o,7,5,2,1,4,0,6,3), data, 0x7f); +} + +WRITE16_MEMBER(elecdet_state::write_o) +{ + // O0,O1,O4,O6: input mux + m_inp_mux = (data & 3) | (data >> 2 & 4) | (data >> 3 & 8); + + // O0-O6: digit segments A-G + // O7: speaker out -> write_r + m_o = data; +} + +READ8_MEMBER(elecdet_state::read_k) +{ + // K: multiplexed inputs (note: the Vss row is always on) + return m_inp_matrix[4]->read() | read_inputs(4); +} + + +// config + +/* physical button layout and labels is like this: + + [1] [2] [3] [SUSPECT] + [4] [5] [6] [PRIVATE QUESTION] + [7] [8] [9] [I ACCUSE] + [0] [ENTER] + [ON] [OFF] [END TURN] +*/ + +static INPUT_PORTS_START( elecdet ) + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Private Question") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + + PORT_START("IN.1") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // O4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("I Accuse") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + + PORT_START("IN.3") // O6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Suspect") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + + // note: even though power buttons are on the matrix, they are not CPU-controlled + PORT_START("IN.4") // Vss! + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("End Turn") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( elecdet, elecdet_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0980, 425000) // approximation - unknown freq + MCFG_TMS1XXX_READ_K_CB(READ8(elecdet_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecdet_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(elecdet_state, write_o)) + MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_elecdet) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Kenner Star Wars - Electronic Battle Command + * TMS1100 MCU, labeled MP3438A + * 4x4 LED grid display + 2 separate LEDs and 2-digit 7segs, 1bit sound + + This is a small tabletop space-dogfighting game. To start the game, + press BASIC/INTER/ADV and enter P#(number of players), then + START TURN. Refer to the official manual for more information. + +***************************************************************************/ + +class starwbc_state : public hh_tms1k_state +{ +public: + starwbc_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void starwbc_state::prepare_display() +{ + // R6,R8 are 7segs + m_display_segmask[6] = m_display_segmask[8] = 0x7f; + display_matrix(8, 10, m_o, m_r); +} + +WRITE16_MEMBER(starwbc_state::write_r) +{ + // R0,R1,R3,R5,R7: input mux + m_inp_mux = (data & 3) | (data >> 1 & 4) | (data >> 2 & 8) | (data >> 3 & 0x10); + + // R9: speaker out + m_speaker->level_w(data >> 9 & 1); + + // R0,R2,R4,R6,R8: led select + m_r = data & 0x155; + prepare_display(); +} + +WRITE16_MEMBER(starwbc_state::write_o) +{ + // O0-O7: led state + m_o = (data << 4 & 0xf0) | (data >> 4 & 0x0f); + prepare_display(); +} + +READ8_MEMBER(starwbc_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(5); +} + + +// config + +/* physical button layout and labels is like this: + + (reconnnaissance=yellow) (tactical reaction=green) + [MAGNA] [ENEMY] [EM] [BS] [SCR] + + [BASIC] [INTER] [START TURN] [END TURN] [MOVE] [FIRE] + [ADV] [P#] [<] [^] [>] [v] + (game=blue) (maneuvers=red) +*/ + +static INPUT_PORTS_START( starwbc ) + PORT_START("IN.0") // R0 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Basic Game") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Intermediate Game") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Advanced Game") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("Player Number") + + PORT_START("IN.1") // R1 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Start Turn") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("End Turn") + + PORT_START("IN.2") // R3 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Magna Scan") // only used in adv. game + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Enemy Scan") // only used in adv. game + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Screen Up") + + PORT_START("IN.3") // R5 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Evasive Maneuvers") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Move") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Fire") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Battle Stations") + + PORT_START("IN.4") // R7 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( starwbc, starwbc_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 325000) // RC osc. R=51K, C=47pf -> ~325kHz + MCFG_TMS1XXX_READ_K_CB(READ8(starwbc_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(starwbc_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(starwbc_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_starwbc) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Kosmos Astro + * TMS1470NLHL MP1133 (die labeled TMS1400 MP1133) + * 9digit 7seg VFD display + 8 LEDs(4 green, 4 yellow), no sound + + This is an astrological calculator, and also supports 4-function + calculations. Refer to the official manual on how to use this device. + +***************************************************************************/ + +class astro_state : public hh_tms1k_state +{ +public: + astro_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void astro_state::prepare_display() +{ + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); + display_matrix_seg(8, 10, m_o, m_r, 0xff); +} + +WRITE16_MEMBER(astro_state::write_r) +{ + // R0-R7: input mux + m_inp_mux = data & 0xff; + + // R0-R9: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(astro_state::write_o) +{ + // O0-O7: led state + m_o = data; + prepare_display(); +} + +READ8_MEMBER(astro_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(8); +} + + +// config + +static INPUT_PORTS_START( astro ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE"/Sun") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY"/Mercury") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-/Venus") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+/Mars") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=/Astro") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_NAME("B1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("B2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.6") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("C") + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.7") // R7 + PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_CONFNAME( 0x08, 0x08, "Mode" ) + PORT_CONFSETTING( 0x00, "Calculator" ) + PORT_CONFSETTING( 0x08, "Astro" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( astro, astro_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1470, 450000) // approximation - RC osc. R=4.7K, C=33pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(astro_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(astro_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(astro_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_astro) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Milton Bradley Comp IV + * TMC0904NL CP0904A (die labeled 4A0970D-04A) + * 10 LEDs behind bezel, no sound + + This is small tabletop Mastermind game; a code-breaking game where the player + needs to find out the correct sequence of colours (numbers in our case). + It is known as Logic 5 in Europe, and as Pythaligoras in Japan. + + Press the R key to start, followed by a set of unique numbers and E. + Refer to the official manual for more information. + +***************************************************************************/ + +class comp4_state : public hh_tms1k_state +{ +public: + comp4_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(comp4_state::write_r) +{ + // leds: + // R4 R9 + // R10! R8 + // R2 R7 + // R1 R6 + // R0 R5 + m_r = data; + display_matrix(11, 1, m_r, m_o); +} + +WRITE16_MEMBER(comp4_state::write_o) +{ + // O1-O3: input mux + m_inp_mux = data >> 1 & 7; + + // O0: leds common + // other bits: N/C + m_o = data; + display_matrix(11, 1, m_r, m_o); +} + +READ8_MEMBER(comp4_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(3); +} + + +// config + +static INPUT_PORTS_START( comp4 ) + PORT_START("IN.0") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("R") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + + PORT_START("IN.1") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + + PORT_START("IN.2") // O3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("E") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( comp4, comp4_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0970, 250000) // approximation - unknown freq + MCFG_TMS1XXX_READ_K_CB(READ8(comp4_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(comp4_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(comp4_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_comp4) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Milton Bradley Simon, created by Ralph Baer + + Revision A hardware: + * TMS1000 (die labeled MP3226) + * DS75494 Hex digit LED driver, 4 big lamps, 1bit sound + + Newer revisions (also Pocket Simon) have a smaller 16-pin MB4850 chip + instead of the TMS1000. This one has been decapped too, but we couldn't + find an internal ROM. It is possibly a cost-reduced custom ASIC specifically + for Simon. The semi-sequel Super Simon uses a TMS1100 (see next minidriver). + +***************************************************************************/ + +class simon_state : public hh_tms1k_state +{ +public: + simon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(simon_state::write_r) +{ + // R4-R8 go through an 75494 IC first: + // R4 -> 75494 IN6 -> green lamp + // R5 -> 75494 IN3 -> red lamp + // R6 -> 75494 IN5 -> yellow lamp + // R7 -> 75494 IN2 -> blue lamp + display_matrix(4, 1, data >> 4, 1); + + // R8 -> 75494 IN0 -> speaker out + m_speaker->level_w(data >> 8 & 1); + + // R0-R2,R9: input mux + // R3: GND + // other bits: N/C + m_inp_mux = (data & 7) | (data >> 6 & 8); +} + +READ8_MEMBER(simon_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( simon ) + PORT_START("IN.0") // R0 + PORT_CONFNAME( 0x07, 0x02, "Game Select") + PORT_CONFSETTING( 0x02, "1" ) + PORT_CONFSETTING( 0x01, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Green Button") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Red Button") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Yellow Button") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Blue Button") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Last") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Longest") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R9 + PORT_CONFNAME( 0x0f, 0x02, "Skill Level") + PORT_CONFSETTING( 0x02, "1" ) + PORT_CONFSETTING( 0x04, "2" ) + PORT_CONFSETTING( 0x08, "3" ) + PORT_CONFSETTING( 0x01, "4" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( simon, simon_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=33K, C=100pf -> ~350kHz + MCFG_TMS1XXX_READ_K_CB(READ8(simon_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(simon_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_simon) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Milton Bradley Super Simon + * TMS1100 MP3476NLL (die labeled MP3476) + * 8 big lamps(2 turn on at same time), 1bit sound + + The semi-squel to Simon, not as popular. It includes more game variations + and a 2-player head-to-head mode. + +***************************************************************************/ + +class ssimon_state : public hh_tms1k_state +{ +public: + ssimon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(speed_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +WRITE16_MEMBER(ssimon_state::write_r) +{ + // R0-R3,R9,R10: input mux + m_inp_mux = (data & 0xf) | (data >> 5 & 0x30); + + // R4: yellow lamps + // R5: green lamps + // R6: blue lamps + // R7: red lamps + display_matrix(4, 1, data >> 4, 1); + + // R8: speaker out + m_speaker->level_w(data >> 8 & 1); +} + +READ8_MEMBER(ssimon_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(6); +} + + +// config + +static INPUT_PORTS_START( ssimon ) + PORT_START("IN.0") // R0 + PORT_CONFNAME( 0x0f, 0x01, "Game Select") + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + PORT_CONFSETTING( 0x08, "4" ) + PORT_CONFSETTING( 0x00, "5" ) + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Yellow Button") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Green Button") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Blue Button") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Red Button") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Last") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Longest") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Decision") + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 Yellow Button") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Green Button") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Blue Button") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Red Button") + + PORT_START("IN.4") // R9 + PORT_CONFNAME( 0x0f, 0x02, "Skill Level") + PORT_CONFSETTING( 0x00, "Head-to-Head" ) // this sets R10 K2, see below + PORT_CONFSETTING( 0x02, "1" ) + PORT_CONFSETTING( 0x04, "2" ) + PORT_CONFSETTING( 0x08, "3" ) + PORT_CONFSETTING( 0x01, "4" ) + + PORT_START("IN.5") // R10 + PORT_BIT( 0x02, 0x02, IPT_SPECIAL ) PORT_CONDITION("IN.4", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.6") // fake + PORT_CONFNAME( 0x03, 0x01, "Speed" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ssimon_state, speed_switch, NULL) + PORT_CONFSETTING( 0x00, "Simple" ) + PORT_CONFSETTING( 0x01, "Normal" ) + PORT_CONFSETTING( 0x02, "Super" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(ssimon_state::speed_switch) +{ + set_clock(); +} + + +void ssimon_state::set_clock() +{ + // MCU clock is from an RC circuit with C=100pf, R=x depending on speed switch: + // 0 Simple: R=51K -> ~200kHz + // 1 Normal: R=37K -> ~275kHz + // 2 Super: R=22K -> ~400kHz + UINT8 inp = m_inp_matrix[6]->read(); + m_maincpu->set_unscaled_clock((inp & 2) ? 400000 : ((inp & 1) ? 275000 : 200000)); +} + +void ssimon_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + set_clock(); +} + +static MACHINE_CONFIG_START( ssimon, ssimon_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 275000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(ssimon_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ssimon_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ssimon) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Milton Bradley Big Trak + * TMS1000NLL MP3301A or MP3301ANLL E (rev. E!) (die labeled 1000E MP3301) + * SN75494N Hex digit LED driver, 1 lamp, 3-level sound + * gearbox with magnetic clutch, 1 IR led+sensor, 2 motors(middle wheels) + * 24-button keypad, ext in/out ports + + Big Trak is a programmable toy car, up to 16 steps. Supported commands include + driving and turning, firing a photon cannon(hey, have some imagination!), + and I/O ports. The output port was used for powering the dump truck accessory. + + The In command was canceled midst production, it is basically a nop. Newer + releases and the European version removed the button completely. + +***************************************************************************/ + +class bigtrak_state : public hh_tms1k_state +{ +public: + bigtrak_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + int m_gearbox_pos; + bool sensor_state() { return m_gearbox_pos < 0 && m_display_decay[0][0] != 0; } + TIMER_DEVICE_CALLBACK_MEMBER(gearbox_sim_tick); + +protected: + virtual void machine_start(); +}; + +// handlers + +TIMER_DEVICE_CALLBACK_MEMBER(bigtrak_state::gearbox_sim_tick) +{ + // the last gear in the gearbox has 12 evenly spaced holes, it is located + // between an IR emitter and receiver + static const int speed = 17; + if (m_gearbox_pos >= speed) + m_gearbox_pos = -speed; + + if (m_o & 0x1e) + m_gearbox_pos++; +} + +WRITE16_MEMBER(bigtrak_state::write_r) +{ + // R0-R5,R8: input mux (keypad, ext in enable) + m_inp_mux = (data & 0x3f) | (data >> 2 & 0x40); + + // R6: N/C + // R7: IR led on + // R9: lamp on + display_matrix(2, 1, (data >> 7 & 1) | (data >> 8 & 2), 1); + + // (O0,O7,)R10(tied together): speaker out + m_speaker->level_w((m_o & 1) | (m_o >> 6 & 2) | (data >> 8 & 4)); + m_r = data; +} + +WRITE16_MEMBER(bigtrak_state::write_o) +{ + // O1: left motor forward + // O2: left motor reverse + // O3: right motor reverse + // O4: right motor reverse + // O5: ext out + // O6: N/C + output_set_value("left_motor_forward", data >> 1 & 1); + output_set_value("left_motor_reverse", data >> 2 & 1); + output_set_value("right_motor_forward", data >> 3 & 1); + output_set_value("right_motor_reverse", data >> 4 & 1); + output_set_value("ext_out", data >> 5 & 1); + + // O0,O7(,R10)(tied together): speaker out + m_speaker->level_w((data & 1) | (data >> 6 & 2) | (m_r >> 8 & 4)); + m_o = data; +} + +READ8_MEMBER(bigtrak_state::read_k) +{ + // K: multiplexed inputs + // K8: IR sensor + return read_inputs(7) | (sensor_state() ? 8 : 0); +} + + +// config + +/* physical button layout and labels is like this: + + USA version: UK version: + + [^] [CLR] [^] [CM] + [<] [HOLD] [>] [FIRE] [<] [P] [>] [\|/] + [v] [CLS] [v] [CE] + [7] [8] [9] [RPT] [7] [8] [9] [x2] + [4] [5] [6] [TEST] [4] [5] [6] [TEST] + [1] [2] [3] [CK] [1] [2] [3] [checkmark] + [IN] [0] [OUT] [GO] [0] [OUT] [GO] +*/ + +static INPUT_PORTS_START( bigtrak ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("Hold") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_UP) PORT_NAME("Forward") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Fire") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear Memory") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Backward") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear Last Step") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Repeat") + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Test") + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Check") + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("In") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_NAME("Out") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") + + PORT_START("IN.6") // R8 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CODE(KEYCODE_F1) PORT_NAME("Input Port") + PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +void bigtrak_state::machine_start() +{ + hh_tms1k_state::machine_start(); + + // zerofill/register for savestates + m_gearbox_pos = 0; + save_item(NAME(m_gearbox_pos)); +} + +static const INT16 bigtrak_speaker_levels[] = { 0, 32767/3, 32767/3, 32767/3*2, 32767/3, 32767/3*2, 32767/3*2, 32767 }; + +static MACHINE_CONFIG_START( bigtrak, bigtrak_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=83K, C=100pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(bigtrak_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bigtrak_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bigtrak_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("gearbox", bigtrak_state, gearbox_sim_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_bigtrak) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(8, bigtrak_speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Parker Brothers Code Name: Sector, by Bob Doyle + * TMS0970 MCU, MP0905BNL ZA0379 (die labeled 0970F-05B) + * 6-digit 7seg LED display + 4 LEDs for compass, no sound + + This is a tabletop submarine pursuit game. A grid board and small toy + boats are used to remember your locations (a Paint app should be ok too). + Refer to the official manual for more information, it is not a simple game. + +***************************************************************************/ + +class cnsector_state : public hh_tms1k_state +{ +public: + cnsector_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(cnsector_state::write_r) +{ + // R0-R5: select digit (right-to-left) + for (int y = 0; y < 6; y++) + { + m_display_segmask[y] = 0xff; + m_display_state[y] = (data >> y & 1) ? m_o : 0; + } + + // R6-R9: direction leds (-> lamp60-63) + m_display_state[6] = data >> 6 & 0xf; + + set_display_size(8, 7); + display_update(); +} + +WRITE16_MEMBER(cnsector_state::write_o) +{ + // O0-O4: input mux + m_inp_mux = data & 0x1f; + + // O0-O7: digit segments + m_o = data; +} + +READ8_MEMBER(cnsector_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(5); +} + + +// config + +/* physical button layout and labels is like this: + + COMBAT INFORMATION CENTER + [NEXT SHIP] [RECALL] [MOVE SHIP] + + [LEFT] [RIGHT] o [SLOWER] [FASTER] + STEERING EVASIVE SUB SPEED o (on/off switch) + NAVIGATIONAL PROGRAMMING | + + [RANGE] [AIM] [FIRE] o [TEACH MODE] + SONAR CONTROL SUB FINDER +*/ + +static INPUT_PORTS_START( cnsector ) + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Next Ship") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Left") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Range") + + PORT_START("IN.1") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Aim") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Right") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Fire") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("Evasive Sub") // expert button + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Recall") + + PORT_START("IN.3") // O3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Sub Finder") // expert button + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Slower") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // O4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Teach Mode") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Faster") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( cnsector, cnsector_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0970, 250000) // approximation - unknown freq + MCFG_TMS1XXX_READ_K_CB(READ8(cnsector_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnsector_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnsector_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_cnsector) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Parker Bros Merlin handheld game, by Bob Doyle + * TMS1100NLL MP3404A-N2 + * 11 LEDs behind buttons, 3-level sound + + Also published in Japan by Tomy as "Dr. Smith", white case instead of red. + The one with dark-blue case is the rare sequel Master Merlin, see below. + More sequels followed too, but on other hardware. + + To start a game, press NEW GAME, followed by a number: + 1: Tic-Tac-Toe + 2: Music Machine + 3: Echo + 4: Blackjack 13 + 5: Magic Square + 6: Mindbender + + Refer to the official manual for more information on the games. + +***************************************************************************/ + +class merlin_state : public hh_tms1k_state +{ +public: + merlin_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE16_MEMBER(write_r); + virtual DECLARE_WRITE16_MEMBER(write_o); + virtual DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(merlin_state::write_r) +{ + /* leds: + + R0 + R1 R2 R3 + R4 R5 R6 + R7 R8 R9 + R10 + */ + display_matrix(11, 1, data, 1); +} + +WRITE16_MEMBER(merlin_state::write_o) +{ + // O4-O6(tied together): speaker out + m_speaker->level_w(data >> 4 & 7); + + // O0-O3: input mux + // O7: N/C + m_inp_mux = data & 0xf; +} + +READ8_MEMBER(merlin_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( merlin ) + PORT_START("IN.0") // O0 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("Button 0") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Button 1") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Button 3") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Button 2") + + PORT_START("IN.1") // O1 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Button 4") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Button 5") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Button 7") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Button 6") + + PORT_START("IN.2") // O2 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Button 8") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Button 9") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Same Game") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Button 10") + + PORT_START("IN.3") // O3 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Comp Turn") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Hit Me") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("New Game") +INPUT_PORTS_END + + +static const INT16 merlin_speaker_levels[] = { 0, 32767/3, 32767/3, 32767/3*2, 32767/3, 32767/3*2, 32767/3*2, 32767 }; + +static MACHINE_CONFIG_START( merlin, merlin_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K, C=100pf -> ~350kHz + MCFG_TMS1XXX_READ_K_CB(READ8(merlin_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(merlin_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(merlin_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_merlin) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(8, merlin_speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Parker Brothers Master Merlin + * TMS1400 MP7351-N2LL (die labeled 1400CR MP7351) + * 11 LEDs behind buttons, 3-level sound + + The TMS1400CR MCU has the same pinout as a standard TMS1100. The hardware + outside of the MCU is exactly the same as Merlin. + + The included minigames are: + 1: Three Shells + 2: Hi/Lo + 3: Match It + 4: Hit or Miss + 5: Pair Off + 6: Tempo + 7: Musical Ladder + 8: Patterns + 9: Hot Potato + +***************************************************************************/ + +class mmerlin_state : public merlin_state +{ +public: + mmerlin_state(const machine_config &mconfig, device_type type, const char *tag) + : merlin_state(mconfig, type, tag) + { } +}; + +// handlers: uses the ones in merlin_state + + +// config + +static INPUT_PORTS_START( mmerlin ) + PORT_INCLUDE( merlin ) + + PORT_MODIFY("IN.3") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Score") // instead of Hit Me +INPUT_PORTS_END + +static MACHINE_CONFIG_START( mmerlin, mmerlin_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=30K, C=100pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(mmerlin_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mmerlin_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mmerlin_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_mmerlin) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(8, merlin_speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Parker Brothers Stop Thief, by Bob Doyle + * TMS0980NLL MP6101B (die labeled 0980B-01A) + * 3-digit 7seg LED display, 1bit sound + + Stop Thief is actually a board game, the electronic device emulated here + (called Electronic Crime Scanner) is an accessory. To start a game, press + the ON button. Otherwise, it is in test-mode where you can hear all sounds. + +***************************************************************************/ + +class stopthief_state : public hh_tms1k_state +{ +public: + stopthief_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(stopthief_state::write_r) +{ + // R0-R2: select digit + UINT8 o = BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f; + for (int y = 0; y < 3; y++) + { + m_display_segmask[y] = 0x7f; + m_display_state[y] = (data >> y & 1) ? o : 0; + } + + set_display_size(7, 3); + display_update(); + + // R3-R8: speaker on + m_speaker->level_w((data & 0x1f8 && m_o & 8) ? 1 : 0); +} + +WRITE16_MEMBER(stopthief_state::write_o) +{ + // O0,O6: input mux + m_inp_mux = (data & 1) | (data >> 5 & 2); + + // O3: speaker out + // O0-O2,O4-O7: led segments A-G + m_o = data; +} + +READ8_MEMBER(stopthief_state::read_k) +{ + // K: multiplexed inputs (note: the Vss row is always on) + return m_inp_matrix[2]->read() | read_inputs(2); +} + + +// config + +/* physical button layout and labels is like this: + + [1] [2] [OFF] + [3] [4] [ON] + [5] [6] [T, TIP] + [7] [8] [A, ARREST] + [9] [0] [C, CLUE] +*/ + +static INPUT_PORTS_START( stopthief ) + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + + PORT_START("IN.1") // O6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + + // note: even though power buttons are on the matrix, they are not CPU-controlled + PORT_START("IN.2") // Vss! + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Tip") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Arrest") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Clue") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( stopthief, stopthief_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0980, 425000) // approximation - unknown freq + MCFG_TMS1XXX_READ_K_CB(READ8(stopthief_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(stopthief_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(stopthief_state, write_o)) + MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_stopthie) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Parker Brothers Bank Shot (known as Cue Ball in the UK), by Garry Kitchen + * TMS1400NLL MP7313-N2 (die labeled MP7313) + * LED grid display, 1bit sound + + Bank Shot is an electronic pool game. To select a game, repeatedly press + the [SELECT] button, then press [CUE UP] to start. Refer to the official + manual for more information. The game selections are: + 1: Straight Pool (1 player) + 2: Straight Pool (2 players) + 3: Poison Pool + 4: Trick Shots + +***************************************************************************/ + +class bankshot_state : public hh_tms1k_state +{ +public: + bankshot_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(bankshot_state::write_r) +{ + // R0: speaker out + m_speaker->level_w(data & 1); + + // R2,R3: input mux + m_inp_mux = data >> 2 & 3; + + // R2-R10: led select + m_r = data & ~3; + display_matrix(7, 11, m_o, m_r); +} + +WRITE16_MEMBER(bankshot_state::write_o) +{ + // O0-O6: led state + // O7: N/C + m_o = data & 0x7f; + display_matrix(7, 11, m_o, m_r); +} + +READ8_MEMBER(bankshot_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(2); +} + + +// config + +/* physical button layout and labels is like this: + (note: remember that you can rotate the display in MAME) + + [SELECT [BALL UP] [BALL OVER] + SCORE] + + ------ led display ------ + + [ANGLE] [AIM] [CUE UP + SHOOT] +*/ + +static INPUT_PORTS_START( bankshot ) + PORT_START("IN.0") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Angle") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Aim") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Cue Up/Shoot") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Select/Score") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Ball Up") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Ball Over") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( bankshot, bankshot_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(bankshot_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bankshot_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bankshot_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_bankshot) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Parker Brothers Split Second + * TMS1400NLL MP7314-N2 (die labeled MP7314) + * LED grid display(default round LEDs, and rectangular shape ones), 1bit sound + + This is an electronic handheld reflex gaming device, it's straightforward + to use. The included mini-games are: + 1, 2, 3: Mad Maze* + 4, 5: Space Attack* + 6: Auto Cross + 7: Stomp + 8: Speedball + + *: higher number indicates higher difficulty + + display layout, where number xy is lamp R(x),O(y) + + 00 02 04 + 10 01 12 03 14 05 16 + 11 13 15 + 20 21 22 23 24 25 26 + 31 33 35 + 30 41 32 43 34 45 36 + 51 53 55 + 40 61 42 63 44 65 46 + 71 73 75 + 50 60 52 62 54 64 56 + 70 72 74 + +***************************************************************************/ + +class splitsec_state : public hh_tms1k_state +{ +public: + splitsec_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(splitsec_state::write_r) +{ + // R8: speaker out + m_speaker->level_w(data >> 8 & 1); + + // R9,R10: input mux + m_inp_mux = data >> 9 & 3; + + // R0-R7: led select + m_r = data; + display_matrix(7, 8, m_o, m_r); +} + +WRITE16_MEMBER(splitsec_state::write_o) +{ + // O0-O6: led state + // O7: N/C + m_o = data & 0x7f; + display_matrix(7, 8, m_o, m_r); +} + +READ8_MEMBER(splitsec_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(2); +} + + +// config + +static INPUT_PORTS_START( splitsec ) + PORT_START("IN.0") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R10 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( splitsec, splitsec_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(splitsec_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_splitsec) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tandy Radio Shack Computerized Arcade (1981, 1982, 1995) + * TMS1100 MCU, labeled CD7282SL + * 12 lamps behind buttons, 1bit sound + + This handheld contains 12 minigames. It looks and plays like "Fabulous Fred" + by the Japanese company Mego Corp. in 1980, which in turn is a mix of Merlin + and Simon. Unlike Merlin and Simon, spin-offs like these were not successful. + There were releases with and without the prefix "Tandy-12", I don't know + which name was more common. Also not worth noting is that it needed five + batteries; 4 C-cells and a 9-volt. + + Some of the games require accessories included with the toy (eg. the Baseball + game is played with a board representing the playing field). To start a game, + hold the [SELECT] button, then press [START] when the game button lights up. + As always, refer to the official manual for more information. + + See below at the input defs for a list of the games. + +***************************************************************************/ + +class tandy12_state : public hh_tms1k_state +{ +public: + tandy12_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tandy12_state::prepare_display() +{ + // O0-O7: button lamps 1-8, R0-R3: button lamps 9-12 + display_matrix(13, 1, (m_o << 1 & 0x1fe) | (m_r << 9 & 0x1e00), 1); +} + +WRITE16_MEMBER(tandy12_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R5-R9: input mux + m_inp_mux = data >> 5 & 0x1f; + + // other bits: + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(tandy12_state::write_o) +{ + m_o = data; + prepare_display(); +} + +READ8_MEMBER(tandy12_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(5); +} + + +// config + +/* physical button layout and labels is like this: + + REPEAT-2 SPACE-2 + [O] OFF--ON [O] + + [purple]1 [blue]5 [l-green]9 + ORGAN TAG-IT TREASURE HUNT + + [l-orange]2 [turquoise]6 [red]10 + SONG WRITER ROULETTE COMPETE + + [pink]3 [yellow]7 [violet]11 + REPEAT BASEBALL FIRE AWAY + + [green]4 [orange]8 [brown]12 + TORPEDO REPEAT PLUS HIDE 'N SEEK + + [O] [O] [O] + START SELECT PLAY-2/HIT-7 +*/ + +static INPUT_PORTS_START( tandy12 ) + PORT_START("IN.0") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_EQUALS) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("Button 12") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("Button 11") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Button 10") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Button 9") + + PORT_START("IN.1") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Space-2") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Play-2/Hit-7") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Select") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Start") + + PORT_START("IN.2") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Repeat-2") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R8 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Button 4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Button 3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Button 2") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Button 1") + + PORT_START("IN.4") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Button 8") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Button 7") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Button 6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Button 5") +INPUT_PORTS_END + + +static const UINT16 tandy12_output_pla[0x20] = +{ + // these are certain + 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, + 0x80, 0x00, 0x00, 0x00, 0x00, + + // rest is unused? + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static MACHINE_CONFIG_START( tandy12, tandy12_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 400000) // RC osc. R=39K, C=47pf -> ~400kHz + MCFG_TMS1XXX_OUTPUT_PLA(tandy12_output_pla) + MCFG_TMS1XXX_READ_K_CB(READ8(tandy12_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tandy12_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tandy12_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tandy12) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy(tronics) Break Up (manufactured in Japan) + * PCB label TOMY B.O. + * TMS1040 MP2726 TOMY WIPE (die labeled MP2726A) + * TMS1025N2LL I/O expander + * 2-digit 7seg display, 46 other leds, 1bit sound + + known releases: + - USA: Break Up + - Japan: Block Attack + - UK: Break-In + + lamp translation table: led zz from game PCB = MAME lampyx: + + 00 = - 10 = lamp50 20 = lamp42 + 01 = lamp70 11 = lamp51 21 = lamp33 + 02 = lamp71 12 = lamp52 22 = lamp22 + 03 = lamp72 13 = lamp53 + 04 = lamp73 14 = lamp43 + 05 = lamp60 15 = lamp31 + 06 = lamp61 16 = lamp32 + 07 = lamp62 17 = lamp30 + 08 = lamp63 18 = lamp41 + 09 = lamp40 19 = lamp21 + + the 7seg panel is lamp0x and lamp1x(aka digit0/1), and the + 8(2*4) * 3 rectangular leds panel, where x=0,1,2,3: + + lamp9x lamp11x + lamp8x lamp13x + lamp10x lamp12x + +***************************************************************************/ + +class tbreakup_state : public hh_tms1k_state +{ +public: + tbreakup_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag), + m_expander(*this, "expander") + { } + + required_device m_expander; + UINT8 m_exp_port[7]; + DECLARE_WRITE8_MEMBER(expander_w); + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(skill_switch); + +protected: + virtual void machine_reset(); + virtual void machine_start(); +}; + +// handlers + +void tbreakup_state::prepare_display() +{ + // 7seg leds from R0,R1 and O0-O6 + for (int y = 0; y < 2; y++) + { + m_display_segmask[y] = 0x7f; + m_display_state[y] = (m_r >> y & 1) ? (m_o & 0x7f) : 0; + } + + // 22 round leds from O2-O7 and expander port 7 + for (int y = 2; y < 8; y++) + m_display_state[y] = (m_o >> y & 1) ? m_exp_port[6] : 0; + + // 24 rectangular leds from expander ports 1-6 (not strobed) + for (int y = 0; y < 6; y++) + m_display_state[y+8] = m_exp_port[y]; + + set_display_size(8, 14); + display_update(); +} + +WRITE8_MEMBER(tbreakup_state::expander_w) +{ + // TMS1025 port 1-7 data + m_exp_port[offset] = data; +} + +WRITE16_MEMBER(tbreakup_state::write_r) +{ + // R6: speaker out + m_speaker->level_w(data >> 6 & 1); + + // R7,R8: input mux + m_inp_mux = data >> 7 & 3; + + // R3-R5: TMS1025 port S + // R2: TMS1025 STD pin + m_expander->write_s(space, 0, data >> 3 & 7); + m_expander->write_std(data >> 2 & 1); + + // R0,R1: select digit + m_r = ~data; + prepare_display(); +} + +WRITE16_MEMBER(tbreakup_state::write_o) +{ + // O0-O3: TMS1025 port H + m_expander->write_h(space, 0, data & 0xf); + + // O0-O7: led state + m_o = data; + prepare_display(); +} + +READ8_MEMBER(tbreakup_state::read_k) +{ + // K4: fixed input + // K8: multiplexed inputs + return (m_inp_matrix[2]->read() & 4) | (read_inputs(2) & 8); +} + + +// config + +static INPUT_PORTS_START( tbreakup ) + PORT_START("IN.0") // R7 K8 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Ball") + + PORT_START("IN.1") // R8 K8 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Hit") + + PORT_START("IN.2") // K4 + PORT_CONFNAME( 0x04, 0x00, DEF_STR( Lives ) ) + PORT_CONFSETTING( 0x00, "3" ) + PORT_CONFSETTING( 0x04, "5" ) + + PORT_START("IN.3") // fake + PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, tbreakup_state, skill_switch, NULL) + PORT_CONFSETTING( 0x00, "Pro 1" ) + PORT_CONFSETTING( 0x01, "Pro 2" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(tbreakup_state::skill_switch) +{ + set_clock(); +} + + +void tbreakup_state::set_clock() +{ + // MCU clock is from an analog circuit with resistor of 73K, PRO2 adds 100K + m_maincpu->set_unscaled_clock((m_inp_matrix[3]->read() & 1) ? 500000 : 325000); +} + +void tbreakup_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + set_clock(); +} + +void tbreakup_state::machine_start() +{ + hh_tms1k_state::machine_start(); + + // zerofill/register for savestates + memset(m_exp_port, 0, sizeof(m_exp_port)); + save_item(NAME(m_exp_port)); +} + +static MACHINE_CONFIG_START( tbreakup, tbreakup_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1040, 325000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(tbreakup_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tbreakup_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tbreakup_state, write_o)) + + MCFG_DEVICE_ADD("expander", TMS1025, 0) + MCFG_TMS1024_WRITE_PORT_CB(1, WRITE8(tbreakup_state, expander_w)) + MCFG_TMS1024_WRITE_PORT_CB(2, WRITE8(tbreakup_state, expander_w)) + MCFG_TMS1024_WRITE_PORT_CB(3, WRITE8(tbreakup_state, expander_w)) + MCFG_TMS1024_WRITE_PORT_CB(4, WRITE8(tbreakup_state, expander_w)) + MCFG_TMS1024_WRITE_PORT_CB(5, WRITE8(tbreakup_state, expander_w)) + MCFG_TMS1024_WRITE_PORT_CB(6, WRITE8(tbreakup_state, expander_w)) + MCFG_TMS1024_WRITE_PORT_CB(7, WRITE8(tbreakup_state, expander_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tbreakup) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( mathmagi ) + ROM_REGION( 0x800, "maincpu", 0 ) + ROM_LOAD( "mp1030", 0x0000, 0x800, CRC(a81d7ccb) SHA1(4756ce42f1ea28ce5fe6498312f8306f10370969) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_mathmagi_output.pla", 0, 365, NO_DUMP ) +ROM_END + + +ROM_START( amaztron ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp3405", 0x0000, 0x0800, CRC(9cbc0009) SHA1(17772681271b59280687492f37fa0859998f041d) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_amaztron_output.pla", 0, 365, CRC(f3875384) SHA1(3c256a3db4f0aa9d93cf78124db39f4cbdc57e4a) ) +ROM_END + + +ROM_START( h2hbaseb ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp1525", 0x0000, 0x0800, CRC(b5d6bf9b) SHA1(2cc9f35f077c1209c46d16ec853af87e4725c2fd) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_h2hbaseb_output.pla", 0, 365, CRC(cb3d7e38) SHA1(6ab4a7c52e6010b7c7158463cb499973e52ff556) ) +ROM_END + + +ROM_START( h2hfootb ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp3460.u3", 0x0000, 0x0800, CRC(3a4e53a8) SHA1(5052e706f992c6c4bada1fa7769589eec3df6471) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_h2hfootb_output.pla", 0, 365, CRC(c8d85873) SHA1(16bd6fc8e3cd16d5f8fd32d0c74e67de77f5487e) ) +ROM_END + + +ROM_START( tc4 ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp7334", 0x0000, 0x1000, CRC(923f3821) SHA1(a9ae342d7ff8dae1dedcd1e4984bcfae68586581) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_tc4_output.pla", 0, 557, CRC(3b908725) SHA1(f83bf5faa5b3cb51f87adc1639b00d6f9a71ad19) ) +ROM_END + + +ROM_START( ebball ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "mp0914", 0x0000, 0x0400, CRC(3c6fb05b) SHA1(b2fe4b3ca72d6b4c9bfa84d67f64afdc215e7178) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1000_common2_micro.pla", 0, 867, CRC(d33da3cf) SHA1(13c4ebbca227818db75e6db0d45b66ba5e207776) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1000_ebball_output.pla", 0, 365, CRC(062bf5bb) SHA1(8d73ee35444299595961225528b153e3a5fe66bf) ) +ROM_END + + +ROM_START( ebball2 ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "mp0923", 0x0000, 0x0400, CRC(077acfe2) SHA1(a294ce7614b2cdb01c754a7a50d60d807e3f0939) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1000_common2_micro.pla", 0, 867, CRC(d33da3cf) SHA1(13c4ebbca227818db75e6db0d45b66ba5e207776) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1000_ebball2_output.pla", 0, 365, CRC(adcd73d1) SHA1(d69e590d288ef99293d86716498f3971528e30de) ) +ROM_END + + +ROM_START( ebball3 ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "6007_mp1204", 0x0000, 0x0800, CRC(987a29ba) SHA1(9481ae244152187d85349d1a08e439e798182938) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_ebball3_output.pla", 0, 365, CRC(00db663b) SHA1(6eae12503364cfb1f863df0e57970d3e766ec165) ) +ROM_END + + +ROM_START( einvader ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp1211", 0x0000, 0x0800, CRC(b6efbe8e) SHA1(d7d54921dab22bb0c2956c896a5d5b56b6f64969) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_einvader_output.pla", 0, 365, CRC(490158e1) SHA1(61cace1eb09244663de98d8fb04d9459b19668fd) ) +ROM_END + + +ROM_START( efootb4 ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "6009_mp7551", 0x0000, 0x1000, CRC(54fa7244) SHA1(4d16bd825c4a2db76ca8a263c373ade15c20e270) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_efootb4_output.pla", 0, 557, CRC(5c87c753) SHA1(bde9d4aa1e57a718affd969475c0a1edcf60f444) ) +ROM_END + + +ROM_START( ebaskb2 ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "6010_mp1218", 0x0000, 0x0800, CRC(0089ede8) SHA1(c8a79d5aca7e37b637a4d152150acba9f41aad96) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_ebaskb2_output.pla", 0, 365, CRC(c18103ae) SHA1(5a9bb8e1d95a9f6919b05ff9471fa0a8014b8b81) ) +ROM_END + + +ROM_START( raisedvl ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp1221", 0x0000, 0x0800, CRC(782791cc) SHA1(214249406fcaf44efc6350022bd534e59ec69c88) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_raisedvl_output.pla", 0, 365, CRC(00db663b) SHA1(6eae12503364cfb1f863df0e57970d3e766ec165) ) +ROM_END + + +ROM_START( gpoker ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp2105", 0x0000, 0x0800, CRC(95a8f5b4) SHA1(d14f00ba9f57e437264d972baa14a14a28ff8719) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_gpoker_output.pla", 0, 365, CRC(f7e2d812) SHA1(cc3abd89afb1d2145dc47636553ccd0ba7de70d9) ) +ROM_END + + +ROM_START( gjackpot ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mpf553", 0x0000, 0x1000, CRC(f45fd008) SHA1(8d5d6407a8a031a833ceedfb931f5c9d2725ecd0) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_gjackpot_output.pla", 0, 557, CRC(50e471a7) SHA1(9d862cb9f51a563882b62662c5bfe61b52e3df00) ) +ROM_END + + +ROM_START( elecdet ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp6100a", 0x0000, 0x1000, CRC(6f396bb8) SHA1(1f104d4ca9bee0d4572be4779b7551dfe20c4f04) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 1982, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0980_elecdet_output.pla", 0, 352, CRC(652d19c3) SHA1(75550c2b293453b6b9efed88c8cc77195a53161f) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) +ROM_END + + +ROM_START( starwbc ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp3438a", 0x0000, 0x0800, CRC(c12b7069) SHA1(d1f39c69a543c128023ba11cc6228bacdfab04de) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_starwbc_output.pla", 0, 365, CRC(d358a76d) SHA1(06b60b207540e9b726439141acadea9aba718013) ) +ROM_END + +ROM_START( starwbcp ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "us4270755", 0x0000, 0x0800, BAD_DUMP CRC(fb3332f2) SHA1(a79ac81e239983cd699b7cfcc55f89b203b2c9ec) ) // from patent US4270755, may have errors + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_starwbc_output.pla", 0, 365, CRC(d358a76d) SHA1(06b60b207540e9b726439141acadea9aba718013) ) +ROM_END + + +ROM_START( astro ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp1133", 0x0000, 0x1000, CRC(bc21109c) SHA1(05a433cce587d5c0c2d28b5fda5f0853ea6726bf) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_astro_output.pla", 0, 557, CRC(eb08957e) SHA1(62ae0d13a1eaafb34f1b27d7df51441b400ccd56) ) +ROM_END + + +ROM_START( comp4 ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "tmc0904nl_cp0904a", 0x0000, 0x0400, CRC(6233ee1b) SHA1(738e109b38c97804b4ec52bed80b00a8634ad453) ) + + ROM_REGION( 782, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0970_common2_instr.pla", 0, 782, CRC(e038fc44) SHA1(dfc280f6d0a5828d1bb14fcd59ac29caf2c2d981) ) + ROM_REGION( 860, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0970_comp4_micro.pla", 0, 860, CRC(ee9d7d9e) SHA1(25484e18f6a07f7cdb21a07220e2f2a82fadfe7b) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0970_comp4_output.pla", 0, 352, CRC(a0f887d1) SHA1(3c666663d484d5bed81e1014f8715aab8a3d489f) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0970_comp4_segment.pla", 0, 157, CRC(e5bddd90) SHA1(4b1c6512c70e5bcd23c2dbf0c88cd8aa2c632a10) ) +ROM_END + + +ROM_START( simon ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "tms1000.u1", 0x0000, 0x0400, CRC(9961719d) SHA1(35dddb018a8a2b31f377ab49c1f0cb76951b81c0) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1000_simon_micro.pla", 0, 867, CRC(52f7c1f1) SHA1(dbc2634dcb98eac173ad0209df487cad413d08a5) ) + ROM_REGION( 365, "maincpu:opla", 0 ) // unused + ROM_LOAD( "tms1000_simon_output.pla", 0, 365, CRC(2943c71b) SHA1(bd5bb55c57e7ba27e49c645937ec1d4e67506601) ) +ROM_END + + +ROM_START( ssimon ) + ROM_REGION( 0x800, "maincpu", 0 ) + ROM_LOAD( "mp3476", 0x0000, 0x800, CRC(98200571) SHA1(cbd0bcfc11a534aa0be5d011584cdcac58ff437a) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 365, "maincpu:opla", 0 ) // unused + ROM_LOAD( "tms1100_ssimon_output.pla", 0, 365, CRC(0fea09b0) SHA1(27a56fcf2b490e9a7dbbc6ad48cc8aaca4cada94) ) +ROM_END + + +ROM_START( bigtrak ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "mp3301a", 0x0000, 0x0400, CRC(1351bcdd) SHA1(68865389c25b541c09a742be61f8fb6488134d4e) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1000_bigtrak_micro.pla", 0, 867, CRC(80912d0a) SHA1(7ae5293ed4d93f5b7a64d43fe30c3639f39fbe5a) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1000_bigtrak_output.pla", 0, 365, CRC(63be45f6) SHA1(918e38a223152db883c1a6f7acf56e87d7074734) ) +ROM_END + + +ROM_START( cnsector ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "mp0905bnl_za0379", 0x0000, 0x0400, CRC(201036e9) SHA1(b37fef86bb2bceaf0ac8bb3745b4702d17366914) ) + + ROM_REGION( 782, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0970_common2_instr.pla", 0, 782, CRC(e038fc44) SHA1(dfc280f6d0a5828d1bb14fcd59ac29caf2c2d981) ) + ROM_REGION( 860, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0970_cnsector_micro.pla", 0, 860, CRC(059f5bb4) SHA1(2653766f9fd74d41d44013bb6f54c0973a6080c9) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0970_cnsector_output.pla", 0, 352, CRC(7c0bdcd6) SHA1(dade774097e8095dca5deac7b2367d0c701aca51) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0970_common2_segment.pla", 0, 157, CRC(56c37a4f) SHA1(18ecc20d2666e89673739056483aed5a261ae927) ) +ROM_END + + +ROM_START( merlin ) + ROM_REGION( 0x800, "maincpu", 0 ) + ROM_LOAD( "mp3404", 0x0000, 0x800, CRC(7515a75d) SHA1(76ca3605d3fde1df62f79b9bb1f534c2a2ae0229) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_merlin_output.pla", 0, 365, CRC(3921b074) SHA1(12bd58e4d6676eb8c7059ef53598279e4f1a32ea) ) +ROM_END + + +ROM_START( mmerlin ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp7351", 0x0000, 0x1000, CRC(0f7a4c83) SHA1(242c1278ddfe92c28fd7cd87300e48e7a4827831) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_mmerlin_output.pla", 0, 557, CRC(fd3dcd93) SHA1(f2afc52df700daa0eb7356c7876af9b2966f971b) ) +ROM_END + + +ROM_START( stopthie ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp6101b", 0x0000, 0x1000, CRC(8bde5bb4) SHA1(8c318fcce67acc24c7ae361f575f28ec6f94665a) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 1982, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0980_stopthie_output.pla", 0, 352, CRC(50337a48) SHA1(4a9ea62ed797a9ac5190eec3bb6ebebb7814628c) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) +ROM_END + +ROM_START( stopthiep ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD16_WORD( "us4341385", 0x0000, 0x1000, CRC(07aec38a) SHA1(0a3d0956495c0d6d9ea771feae6c14a473a800dc) ) // from patent US4341385, data should be correct (it included checksums) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 1982, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0980_stopthie_output.pla", 0, 352, CRC(50337a48) SHA1(4a9ea62ed797a9ac5190eec3bb6ebebb7814628c) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) +ROM_END + + +ROM_START( bankshot ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp7313", 0x0000, 0x1000, CRC(7a5016a9) SHA1(a8730dc8a282ffaa3d89e675f371d43eb39f39b4) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_bankshot_output.pla", 0, 557, CRC(7539283b) SHA1(f791fa98259fc10c393ff1961d4c93040f1a2932) ) +ROM_END + + +ROM_START( splitsec ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp7314", 0x0000, 0x1000, CRC(e94b2098) SHA1(f0fc1f56a829252185592a2508740354c50bedf8) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_splitsec_output.pla", 0, 557, CRC(7539283b) SHA1(f791fa98259fc10c393ff1961d4c93040f1a2932) ) +ROM_END + + +ROM_START( tandy12 ) + ROM_REGION( 0x800, "maincpu", 0 ) + ROM_LOAD( "cd7282sl", 0x0000, 0x800, CRC(a10013dd) SHA1(42ebd3de3449f371b99937f9df39c240d15ac686) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_tandy12_output.pla", 0, 365, NO_DUMP ) +ROM_END + + +ROM_START( tbreakup ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "mp2726a", 0x0000, 0x0400, CRC(1f7c28e2) SHA1(164cda4eb3f0b1d20955212a197c9aadf8d18a06) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1000_common2_micro.pla", 0, 867, CRC(d33da3cf) SHA1(13c4ebbca227818db75e6db0d45b66ba5e207776) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1000_tbreakup_output.pla", 0, 365, CRC(a1ea035e) SHA1(fcf0b57ed90b41441a8974223a697f530daac0ab) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1980, mathmagi, 0, 0, mathmagi, mathmagi, driver_device, 0, "APF Electronics Inc.", "Mathemagician", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) + +CONS( 1979, amaztron, 0, 0, amaztron, amaztron, driver_device, 0, "Coleco", "Amaze-A-Tron", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, h2hbaseb, 0, 0, h2hbaseb, h2hbaseb, driver_device, 0, "Coleco", "Head to Head Baseball", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, h2hfootb, 0, 0, h2hfootb, h2hfootb, driver_device, 0, "Coleco", "Head to Head Football", MACHINE_SUPPORTS_SAVE ) +CONS( 1981, tc4, 0, 0, tc4, tc4, driver_device, 0, "Coleco", "Total Control 4", MACHINE_SUPPORTS_SAVE ) + +CONS( 1979, ebball, 0, 0, ebball, ebball, driver_device, 0, "Entex", "Electronic Baseball (Entex)", MACHINE_SUPPORTS_SAVE ) +CONS( 1979, ebball2, 0, 0, ebball2, ebball2, driver_device, 0, "Entex", "Electronic Baseball 2 (Entex)", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, ebball3, 0, 0, ebball3, ebball3, driver_device, 0, "Entex", "Electronic Baseball 3 (Entex)", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, einvader, 0, 0, einvader, einvader, driver_device, 0, "Entex", "Space Invader (Entex, TMS1100)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1980, efootb4 , 0, 0, efootb4, efootb4, driver_device, 0, "Entex", "Color Football 4 (Entex)", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, ebaskb2 , 0, 0, ebaskb2, ebaskb2, driver_device, 0, "Entex", "Electronic Basketball 2 (Entex)", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, raisedvl, 0, 0, raisedvl, raisedvl, driver_device, 0, "Entex", "Raise The Devil", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1979, gpoker, 0, 0, gpoker, gpoker, driver_device, 0, "Gakken", "Poker (Gakken, 1979 version)", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, gjackpot, 0, 0, gjackpot, gjackpot, driver_device, 0, "Gakken", "Jackpot: Gin Rummy & Black Jack", MACHINE_SUPPORTS_SAVE ) + +CONS( 1979, elecdet, 0, 0, elecdet, elecdet, driver_device, 0, "Ideal", "Electronic Detective", MACHINE_SUPPORTS_SAVE ) // *** + +CONS( 1979, starwbc, 0, 0, starwbc, starwbc, driver_device, 0, "Kenner", "Star Wars - Electronic Battle Command", MACHINE_SUPPORTS_SAVE ) +CONS( 1979, starwbcp, starwbc, 0, starwbc, starwbc, driver_device, 0, "Kenner", "Star Wars - Electronic Battle Command (patent)", MACHINE_SUPPORTS_SAVE ) + +COMP( 1979, astro, 0, 0, astro, astro, driver_device, 0, "Kosmos", "Astro", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) + +CONS( 1977, comp4, 0, 0, comp4, comp4, driver_device, 0, "Milton Bradley", "Comp IV", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +CONS( 1978, simon, 0, 0, simon, simon, driver_device, 0, "Milton Bradley", "Simon (Rev. A)", MACHINE_SUPPORTS_SAVE ) +CONS( 1979, ssimon, 0, 0, ssimon, ssimon, driver_device, 0, "Milton Bradley", "Super Simon", MACHINE_SUPPORTS_SAVE ) +CONS( 1979, bigtrak, 0, 0, bigtrak, bigtrak, driver_device, 0, "Milton Bradley", "Big Trak", MACHINE_SUPPORTS_SAVE | MACHINE_MECHANICAL ) // *** + +CONS( 1977, cnsector, 0, 0, cnsector, cnsector, driver_device, 0, "Parker Brothers", "Code Name: Sector", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) // *** +CONS( 1978, merlin, 0, 0, merlin, merlin, driver_device, 0, "Parker Brothers", "Merlin - The Electronic Wizard", MACHINE_SUPPORTS_SAVE ) +CONS( 1979, stopthie, 0, 0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner)", MACHINE_SUPPORTS_SAVE ) // *** +CONS( 1979, stopthiep, stopthie, 0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner) (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +CONS( 1980, bankshot, 0, 0, bankshot, bankshot, driver_device, 0, "Parker Brothers", "Bank Shot - Electronic Pool", MACHINE_SUPPORTS_SAVE ) +CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", MACHINE_SUPPORTS_SAVE ) +CONS( 1982, mmerlin, 0, 0, mmerlin, mmerlin, driver_device, 0, "Parker Brothers", "Master Merlin", MACHINE_SUPPORTS_SAVE ) + +CONS( 1981, tandy12, 0, 0, tandy12, tandy12, driver_device, 0, "Tandy Radio Shack", "Tandy-12: Computerized Arcade", MACHINE_SUPPORTS_SAVE ) // some of the minigames: *** + +CONS( 1979, tbreakup, 0, 0, tbreakup, tbreakup, driver_device, 0, "Tomy", "Break Up (Tomy)", MACHINE_SUPPORTS_SAVE ) + +// ***: As far as MAME is concerned, the game is emulated fine. But for it to be playable, it requires interaction +// with other, unemulatable, things eg. game board/pieces, playing cards, pen & paper, etc. diff --git a/src/mame/drivers/hh_ucom4.c b/src/mame/drivers/hh_ucom4.c new file mode 100644 index 00000000000..8aa5836ffe9 --- /dev/null +++ b/src/mame/drivers/hh_ucom4.c @@ -0,0 +1,2552 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Kevin Horton +/*************************************************************************** + + NEC uCOM4 MCU tabletops/handhelds or other simple devices, + most of them (emulated ones) are VFD electronic games/toys. + + Commonly used VFD(vacuum fluorescent display) are by NEC or Futaba. + + NEC FIP9AM20T (example, Epoch Astro Command) + grcss + + FIP = fluorescent indicator panel + g = number of grids + A = revision of the VFD + M = custom display + 20 = unique display part number + + + known chips: + + serial device etc. +---------------------------------------------------------------- + @017 uPD552C 1979, Bambino UFO Master-Blaster Station (ET-02) + @042 uPD552C 1980, Tomy Cosmic Combat (TN-??) + @043 uPD552C 1979, Bambino Kick The Goal Soccer (ET-10) + *044 uPD552C 1979, Bambino Lucky Puck Ice Hockey (ET-08) + @048 uPD552C 1980, Tomy Tennis (TN-04) + @049 uPD552C 1981, Bambino Safari (ET-11) + @054 uPD552C 1980, Epoch Invader From Space + + @031 uPD553C 1979, Bambino Superstar Football (ET-03) + @049 uPD553C 1979, Mego Mini-Vid Break Free + @055 uPD553C 1980, Bambino Space Laser Fight (ET-12) + *073 uPD553C 1980, Sony ST-J75 FM Stereo Tuner + @080 uPD553C 1980, Epoch Electronic Football + *102 uPD553C 1981, Bandai Block Out + @153 uPD553C 1981, Epoch Galaxy II + @160 uPD553C 1982, Tomy Pac Man (TN-08) + @170 uPD553C 1982, Bandai Crazy Climber + @192 uPD553C 1982, Tomy Scramble (TN-10) + @202 uPD553C 1982, Epoch Astro Command + @206 uPD553C 1982, Epoch Dracula + @209 uPD553C 1982, Tomy Caveman (TN-12) + @258 uPD553C 1984, Tomy Alien Chase (TN-16) + + @512 uPD557LC 1980, Castle Toy Tactix + + *060 uPD650C 1979, Mattel Computer Gin + *085 uPD650C 1980, Roland TR-808 + *127 uPD650C 198?, Sony OA-S1100 Typecorder (subcpu, have dump) + *128 uPD650C 1981, Roland TR-606 + 133 uPD650C 1982, Roland TB-303 -> tb303.c + + (* denotes not yet emulated by MAME, @ denotes it's in this driver) + + +TODO: + - games that rely on the fact that faster/longer strobed elements appear brighter: + tactix(player 2) + +***************************************************************************/ + +#include "includes/hh_ucom4.h" + +// internal artwork +#include "efball.lh" +#include "mvbfree.lh" +#include "tactix.lh" // clickable + +#include "hh_ucom4_test.lh" // common test-layout - use external artwork + + +// machine start/reset + +void hh_ucom4_state::machine_start() +{ + // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, ~0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + memset(m_display_segmask, 0, sizeof(m_display_segmask)); + + memset(m_port, 0, sizeof(m_port)); + m_inp_mux = 0; + m_grid = 0; + m_plate = 0; + + // register for savestates + save_item(NAME(m_display_maxy)); + save_item(NAME(m_display_maxx)); + save_item(NAME(m_display_wait)); + + save_item(NAME(m_display_state)); + /* save_item(NAME(m_display_cache)); */ // don't save! + save_item(NAME(m_display_decay)); + save_item(NAME(m_display_segmask)); + + save_item(NAME(m_port)); + save_item(NAME(m_inp_mux)); + save_item(NAME(m_grid)); + save_item(NAME(m_plate)); +} + +void hh_ucom4_state::machine_reset() +{ +} + + + +/*************************************************************************** + + Helper Functions + +***************************************************************************/ + +// The device may strobe the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +void hh_ucom4_state::display_update() +{ + UINT32 active_state[0x20]; + + for (int y = 0; y < m_display_maxy; y++) + { + active_state[y] = 0; + + for (int x = 0; x <= m_display_maxx; x++) + { + // turn on powered segments + if (m_display_state[y] >> x & 1) + m_display_decay[y][x] = m_display_wait; + + // determine active state + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; + active_state[y] |= (ds << x); + } + } + + // on difference, send to output + for (int y = 0; y < m_display_maxy; y++) + if (m_display_cache[y] != active_state[y]) + { + if (m_display_segmask[y] != 0) + output_set_digit_value(y, active_state[y] & m_display_segmask[y]); + + const int mul = (m_display_maxx <= 10) ? 10 : 100; + for (int x = 0; x <= m_display_maxx; x++) + { + int state = active_state[y] >> x & 1; + char buf1[0x10]; // lampyx + char buf2[0x10]; // y.x + + if (x == m_display_maxx) + { + // always-on if selected + sprintf(buf1, "lamp%da", y); + sprintf(buf2, "%d.a", y); + } + else + { + sprintf(buf1, "lamp%d", y * mul + x); + sprintf(buf2, "%d.%d", y, x); + } + output_set_value(buf1, state); + output_set_value(buf2, state); + } + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(hh_ucom4_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int y = 0; y < m_display_maxy; y++) + for (int x = 0; x <= m_display_maxx; x++) + if (m_display_decay[y][x] != 0) + m_display_decay[y][x]--; + + display_update(); +} + +void hh_ucom4_state::set_display_size(int maxx, int maxy) +{ + m_display_maxx = maxx; + m_display_maxy = maxy; +} + +void hh_ucom4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) +{ + set_display_size(maxx, maxy); + + // update current state + UINT32 mask = (1 << maxx) - 1; + for (int y = 0; y < maxy; y++) + m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; + + display_update(); +} + + +UINT8 hh_ucom4_state::read_inputs(int columns) +{ + UINT8 ret = 0; + + // read selected input rows + for (int i = 0; i < columns; i++) + if (m_inp_mux >> i & 1) + ret |= m_inp_matrix[i]->read(); + + return ret; +} + + + +/*************************************************************************** + + Minidrivers (subclass, I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + Bambino UFO Master-Blaster Station (manufactured in Japan) + * PCB label Emix Corp. ET-02 + * NEC uCOM-44 MCU, labeled EMIX D552C 017 + * cyan VFD display Emix-101, with blue color overlay + + This is Bambino's first game, it is not known if ET-01 exists. Emix Corp. + wasn't initially a toy company, the first release was through Tomy. Emix + created the Bambino brand afterwards. It is claimed to be the first + computerized VFD game (true, unless TI Speak & Spell(1978), or even Invicta + Electronic Mastermind(1977) are considered games) + + known releases: + - Japan: "Missile Guerilla Warfare Maneuvers", published by Tomy + - World: UFO Master-Blaster Station + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class ufombs_state : public hh_ucom4_state +{ +public: + ufombs_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE8_MEMBER(speaker_w); +}; + +// handlers + +void ufombs_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,3,2,1,0,4,5,6,7,8); + UINT16 plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,6,9,5,8,4,0,1,2,3); + display_matrix(10, 9, plate, grid); +} + +WRITE8_MEMBER(ufombs_state::grid_w) +{ + // F,G,H0: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTF) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(ufombs_state::plate_w) +{ + // C,D012,I: vfd matrix plate + int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(ufombs_state::speaker_w) +{ + // E01: speaker out + m_speaker->level_w(data & 3); +} + + +// config + +static INPUT_PORTS_START( ufombs ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY + PORT_BIT( 0x04, 0x04, IPT_SPECIAL ) PORT_CONDITION("IN.0", 0x0a, EQUALS, 0x00) // pad in the middle, pressed when joystick is centered + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY + + PORT_START("IN.1") // port B + PORT_CONFNAME( 0x07, 0x01, "Skill Level" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +static const INT16 ufombs_speaker_levels[] = { 0, 32767, -32768, 0 }; + +static MACHINE_CONFIG_START( ufombs, ufombs_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D552, 400000) // approximation + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(ufombs_state, plate_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(ufombs_state, plate_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(ufombs_state, speaker_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(ufombs_state, grid_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(ufombs_state, grid_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(ufombs_state, grid_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(ufombs_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(4, ufombs_speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bambino Superstar Football (manufactured in Japan) + * PCB label Emix Corp. ET-03 + * NEC uCOM-43 MCU, labeled D553C 031 + * cyan VFD display Emix-102, with bezel + + The game was rereleased in 1982 as Classic Football, with an improved VFD. + + Press the Kick button to start the game, an automatic sequence follows. + Then choose a formation(A,B,C) and either pass the ball, and/or start + running. For more information, refer to the official manual. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class ssfball_state : public hh_ucom4_state +{ +public: + ssfball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_READ8_MEMBER(input_b_r); +}; + +// handlers + +void ssfball_state::prepare_display() +{ + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6); + display_matrix(16, 9, plate, m_grid); +} + +WRITE8_MEMBER(ssfball_state::grid_w) +{ + // C,D(,E3): vfd matrix grid 0-7(,8) + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(ssfball_state::plate_w) +{ + m_port[offset] = data; + + // E,F,G,H,I(not all!): vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // F3,G3: input mux + speaker + m_inp_mux = (m_port[NEC_UCOM4_PORTF] >> 3 & 1) | (m_port[NEC_UCOM4_PORTG] >> 2 & 2); + m_speaker->level_w(m_inp_mux); + + // E3: vfd matrix grid 8 + if (offset == NEC_UCOM4_PORTE) + grid_w(space, offset, data >> 3 & 1); + else + prepare_display(); +} + +READ8_MEMBER(ssfball_state::input_b_r) +{ + // B: input port 2, where B3 is multiplexed + return m_inp_matrix[2]->read() | read_inputs(2); +} + + +// config + +/* physical button layout and labels is like this: + + [A] [B] [C] [PASS] [KICK/ + ^FORMATION^ DISPLAY] + + [^] + [<>] + (game lvl sw) [v] + 1<---OFF--->2 +*/ + +static INPUT_PORTS_START( ssfball ) + PORT_START("IN.0") // F3 port B3 + PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Formation A") + + PORT_START("IN.1") // G3 port B3 + PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_CONFNAME( 0x08, 0x00, "Game Level" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x08, "2" ) + + PORT_START("IN.2") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Kick/Display") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Formation C") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Formation B") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) // multiplexed, handled in input_b_r + + PORT_START("IN.3") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY PORT_NAME("Ball-carrier Left/Right") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY PORT_NAME("Ball-carrier Up") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY PORT_NAME("Ball-carrier Down") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Pass") +INPUT_PORTS_END + + +static const INT16 ssfball_speaker_levels[] = { 0, 32767, -32768, 0 }; + +static MACHINE_CONFIG_START( ssfball, ssfball_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, 400000) // approximation + MCFG_UCOM4_READ_A_CB(IOPORT("IN.3")) + MCFG_UCOM4_READ_B_CB(READ8(ssfball_state, input_b_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(ssfball_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(ssfball_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(ssfball_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(ssfball_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(ssfball_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(ssfball_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(ssfball_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(4, ssfball_speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bambino Kick The Goal Soccer + * PCB label Emix Corp. ET-10/08 (PCB is for 2 possible games) + * NEC uCOM-44 MCU, labeled D552C 043 + * cyan VFD display Emix-105, with bezel overlay + + Press the Display button twice to start the game. Action won't start until + player 1 presses one of the directional keys. In 2-player mode, player 2 + controls the goalkeeper, defensive players are still controlled by the CPU. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bmsoccer_state : public hh_ucom4_state +{ +public: + bmsoccer_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_READ8_MEMBER(input_a_r); +}; + +// handlers + +void bmsoccer_state::prepare_display() +{ + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,8,4,0,9,5,1,10,6,2); + display_matrix(16, 9, plate, m_grid); +} + +WRITE8_MEMBER(bmsoccer_state::grid_w) +{ + // C01: input mux + if (offset == NEC_UCOM4_PORTC) + m_inp_mux = data & 3; + + // C,D(,E3): vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(bmsoccer_state::plate_w) +{ + // G3: speaker out + if (offset == NEC_UCOM4_PORTG) + m_speaker->level_w(data >> 3 & 1); + + // E012,F012,G012,H,I: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // E3: grid 8 + if (offset == NEC_UCOM4_PORTE) + grid_w(space, offset, data >> 3 & 1); + else + prepare_display(); +} + +READ8_MEMBER(bmsoccer_state::input_a_r) +{ + // port A: multiplexed inputs + return read_inputs(2); +} + + +// config + +static INPUT_PORTS_START( bmsoccer ) + PORT_START("IN.0") // C0 port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("Ball-carrier Right") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY PORT_NAME("Ball-carrier Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY PORT_NAME("Ball-carrier Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY PORT_NAME("Ball-carrier Up") + + PORT_START("IN.1") // C1 port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY PORT_NAME("Goalkeeper Left") // note: swap buttons if viewed from the same angle as player 1 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY PORT_NAME("Goalkeeper Right") + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // port B + PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) + PORT_CONFNAME( 0x02, 0x00, "Players" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Display/Banana Shoot") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Shoot") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( bmsoccer, bmsoccer_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D552, 400000) // approximation + MCFG_UCOM4_READ_A_CB(READ8(bmsoccer_state, input_a_r)) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.2")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(bmsoccer_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(bmsoccer_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(bmsoccer_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(bmsoccer_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(bmsoccer_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(bmsoccer_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(bmsoccer_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bambino Safari (manufactured in Japan) + * PCB label Emix Corp. ET-11 + * NEC uCOM-44 MCU, labeled EMIX D552C 049 + * cyan VFD display Emix-108 + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bmsafari_state : public hh_ucom4_state +{ +public: + bmsafari_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE8_MEMBER(speaker_w); +}; + +// handlers + +void bmsafari_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); + UINT16 plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,2,9,5,8,4,0,1,6,3); + display_matrix(10, 9, plate, grid); +} + +WRITE8_MEMBER(bmsafari_state::grid_w) +{ + // C,D(,E3): vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(bmsafari_state::plate_w) +{ + // E012,H,I: vfd matrix plate + int shift = (offset == NEC_UCOM4_PORTE) ? 8 : (offset - NEC_UCOM4_PORTH) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // E3: grid 0 + if (offset == NEC_UCOM4_PORTE) + grid_w(space, offset, data >> 3 & 1); + else + prepare_display(); +} + +WRITE8_MEMBER(bmsafari_state::speaker_w) +{ + // G0: speaker out + m_speaker->level_w(data & 1); +} + + +// config + +static INPUT_PORTS_START( bmsafari ) + PORT_START("IN.0") // port A + PORT_CONFNAME( 0x07, 0x04, "Skill Level" ) + PORT_CONFSETTING( 0x04, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x01, "3" ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY +INPUT_PORTS_END + +static MACHINE_CONFIG_START( bmsafari, bmsafari_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D552, 400000) // approximation + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(bmsafari_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(bmsafari_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(bmsafari_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(bmsafari_state, speaker_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(bmsafari_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(bmsafari_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bambino Space Laser Fight (manufactured in Japan) + * PCB label Emix Corp. ET-12 + * NEC uCOM-43 MCU, labeled D553C 055 + * cyan VFD display Emix-104, with blue or green color overlay + + This is basically a revamp of their earlier Boxing game (ET-06), case and + buttons are exactly the same. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class splasfgt_state : public hh_ucom4_state +{ +public: + splasfgt_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_READ8_MEMBER(input_b_r); +}; + +// handlers + +void splasfgt_state::prepare_display() +{ + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3); + display_matrix(16, 9, plate, m_grid); +} + +WRITE8_MEMBER(splasfgt_state::grid_w) +{ + // G,H,I0: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTG) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + + // G(grid 0-3): input mux + m_inp_mux = m_grid & 0xf; + + // I2: vfd matrix plate 6 + if (offset == NEC_UCOM4_PORTI) + plate_w(space, 4 + NEC_UCOM4_PORTC, data >> 2 & 1); + else + prepare_display(); +} + +WRITE8_MEMBER(splasfgt_state::plate_w) +{ + // F01: speaker out + if (offset == NEC_UCOM4_PORTF) + m_speaker->level_w(data & 3); + + // C,D,E,F23(,I2): vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +READ8_MEMBER(splasfgt_state::input_b_r) +{ + // B: multiplexed buttons + return read_inputs(4); +} + + +// config + +/* physical button layout and labels is like this: + + * left = P1 side * * right = P2 side * (note: in 1P mode, switch sides between turns) + + [ JUMP ] [ HIGH ] (players sw) [ HIGH ] [ JUMP ] + 1<--->2 [START/ + [STRAIGHT] [MEDIUM] RESET] [MEDIUM] [STRAIGHT] + 1<---OFF--->2 + [ STOOP ] [ LOW ] (skill lvl sw) [ LOW ] [ STOOP ] +*/ + +static INPUT_PORTS_START( splasfgt ) + PORT_START("IN.0") // G0 port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("P1 Position Straight") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("P1 Position Jump") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("P1 Position Stoop") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // G1 port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("P1 Beam High") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("P1 Beam Medium") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("P1 Beam Low") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // G2 port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("P2 Position Straight") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("P2 Position Jump") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("P2 Position Stoop") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // G3 port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("P2 Beam High") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P2 Beam Medium") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("P2 Beam Low") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // port A + PORT_CONFNAME( 0x01, 0x00, "Players" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x01, "2" ) + PORT_CONFNAME( 0x02, 0x00, "Skill Level" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +static const INT16 splasfgt_speaker_levels[] = { 0, 32767, -32768, 0 }; + +static MACHINE_CONFIG_START( splasfgt, splasfgt_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, 400000) // approximation + MCFG_UCOM4_READ_A_CB(IOPORT("IN.4")) + MCFG_UCOM4_READ_B_CB(READ8(splasfgt_state, input_b_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(splasfgt_state, plate_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(splasfgt_state, plate_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(splasfgt_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(splasfgt_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(splasfgt_state, grid_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(splasfgt_state, grid_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(splasfgt_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(4, splasfgt_speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Bandai Crazy Climber (manufactured in Japan) + * PCB labels SM-020/SM-021 + * NEC uCOM-43 MCU, labeled D553C 170 + * cyan/red/green VFD display NEC FIP6AM2-T no. 1-8 2, with partial color overlay and bezel + + known releases: + - Japan: FL Crazy Climbing + - USA: Crazy Climber + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class bcclimbr_state : public hh_ucom4_state +{ +public: + bcclimbr_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void bcclimbr_state::prepare_display() +{ + UINT8 grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,16,17,18,19,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); + display_matrix(20, 6, plate, grid); +} + +WRITE8_MEMBER(bcclimbr_state::grid_w) +{ + // I2: speaker out + if (offset == NEC_UCOM4_PORTI) + m_speaker->level_w(data >> 2 & 1); + + // H,I01: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTH) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(bcclimbr_state::plate_w) +{ + // C,D,E,F: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( bcclimbr ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( bcclimbr, bcclimbr_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(bcclimbr_state, plate_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(bcclimbr_state, plate_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(bcclimbr_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(bcclimbr_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(bcclimbr_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(bcclimbr_state, grid_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(bcclimbr_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Castle Toy Tactix + * NEC uCOM-43 MCU, labeled D557LC 512 + * 16 LEDs behind buttons + + Tactix is similar to Merlin, for 1 or 2 players. In 2-player mode, simply + don't press the Comp Turn button. The four included minigames are: + 1: Capture (reversi) + 2: Jump-Off (peg solitaire) + 3: Triple Play (3 in a row) + 4: Concentration (memory) + + note: MAME external artwork is not needed for this game + +***************************************************************************/ + +class tactix_state : public hh_ucom4_state +{ +public: + tactix_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(leds_w); + DECLARE_WRITE8_MEMBER(speaker_w); + DECLARE_WRITE8_MEMBER(input_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(tactix_state::leds_w) +{ + // D,F: 4*4 led matrix + m_port[offset] = data; + display_matrix(4, 4, m_port[NEC_UCOM4_PORTD], m_port[NEC_UCOM4_PORTF]); +} + +WRITE8_MEMBER(tactix_state::speaker_w) +{ + // G0: speaker out + m_speaker->level_w(data & 1); +} + +WRITE8_MEMBER(tactix_state::input_w) +{ + // C,E0: input mux + m_port[offset] = data; + m_inp_mux = (m_port[NEC_UCOM4_PORTE] << 4 & 0x10) | m_port[NEC_UCOM4_PORTC]; +} + +READ8_MEMBER(tactix_state::input_r) +{ + // A: multiplexed inputs + return read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( tactix ) + PORT_START("IN.0") // C0 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Button 1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Button 5") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Button 9") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("Button 13") + + PORT_START("IN.1") // C1 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Button 2") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Button 6") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Button 10") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Button 14") + + PORT_START("IN.2") // C2 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Button 3") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Button 7") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Button 11") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Button 15") + + PORT_START("IN.3") // C3 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Button 4") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Button 8") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Button 12") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Button 16") + + PORT_START("IN.4") // E0 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("New Game") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Comp Turn") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tactix, tactix_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D557L, 400000) // approximation + MCFG_UCOM4_READ_A_CB(READ8(tactix_state, input_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tactix_state, input_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tactix_state, leds_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tactix_state, input_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tactix_state, leds_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tactix_state, speaker_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tactix) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Epoch Invader From Space (manufactured in Japan) + * PCB labels 36010(A/B) + * NEC uCOM-44 MCU, labeled D552C 054 + * cyan VFD display NEC FIP9AM18T tube no. 0D, with color overlay + + known releases: + - USA: Invader From Space + - UK: Invader From Space, published by Grandstand + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class invspace_state : public hh_ucom4_state +{ +public: + invspace_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void invspace_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,8,9,7,6,5,4,3,2,1,0); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,9,14,13,8,15,11,10,7,11,3,2,6,10,1,5,9,0,4,8); + display_matrix(19, 9, plate, grid); +} + +WRITE8_MEMBER(invspace_state::grid_w) +{ + // I0: speaker out + if (offset == NEC_UCOM4_PORTI) + m_speaker->level_w(data & 1); + + // C,D,I1: vfd matrix grid + int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(invspace_state::plate_w) +{ + // E,F,G,H123: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( invspace ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( invspace, invspace_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D552, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(invspace_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(invspace_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(invspace_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(invspace_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(invspace_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(invspace_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(invspace_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Epoch Electronic Football (manufactured in Japan) + * PCB labels 36020(A/B/C) + * NEC uCOM-43 MCU, labeled D553C 080 + * cyan VFD display NEC FIP10AM15T tube no. 0F, with bezel overlay + + known releases: + - USA: Electronic Football (aka Pro-Bowl Football) + - Japan: American Football + + note: MAME external artwork is not needed for this game + +***************************************************************************/ + +class efball_state : public hh_ucom4_state +{ +public: + efball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void efball_state::prepare_display() +{ + UINT16 plate = BITSWAP16(m_plate,15,14,13,12,11,4,3,0,2,1,6,10,9,5,8,7); + display_matrix(11, 10, plate, m_grid); +} + +WRITE8_MEMBER(efball_state::grid_w) +{ + // H2: speaker out + if (offset == NEC_UCOM4_PORTH) + m_speaker->level_w(data >> 2 & 1); + + // F,G,H01: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTF) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(efball_state::plate_w) +{ + // D,E,I: vfd matrix plate + int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTD) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( efball ) + PORT_START("IN.0") // port A + PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x01, "Professional" ) + PORT_CONFNAME( 0x02, 0x02, "Players" ) + PORT_CONFSETTING( 0x02, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Down-Field") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P1 Score-Time") + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("P1 Left/Right") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Pass") + + PORT_START("IN.2") // port C + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Kick Return") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Kick") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( efball, efball_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_READ_C_CB(IOPORT("IN.2")) + MCFG_UCOM4_WRITE_D_CB(WRITE8(efball_state, plate_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(efball_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(efball_state, grid_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(efball_state, grid_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(efball_state, grid_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(efball_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_efball) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Epoch Galaxy II (manufactured in Japan) + * PCB labels 19096/96062 + * NEC uCOM-43 MCU, labeled D553C 153 + * cyan/red VFD display NEC FIP10xM20T, with color overlay. x = multiple VFD + revisions exist, with different graphics: rev B no. 1-8, rev. D no. 2-21. + + known releases: + - USA: Galaxy II + - Japan: Astro Wars + - UK: Astro Wars, published by Grandstand + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class galaxy2_state : public hh_ucom4_state +{ +public: + galaxy2_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void galaxy2_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + UINT16 plate = BITSWAP16(m_plate,15,3,2,6,1,5,4,0,11,10,7,12,14,13,8,9); + display_matrix(15, 10, plate, grid); +} + +WRITE8_MEMBER(galaxy2_state::grid_w) +{ + // E3: speaker out + if (offset == NEC_UCOM4_PORTE) + m_speaker->level_w(data >> 3 & 1); + + // C,D,E01: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(galaxy2_state::plate_w) +{ + // F,G,H,I: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTF) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( galaxy2 ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( galaxy2, galaxy2_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(galaxy2_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(galaxy2_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(galaxy2_state, grid_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(galaxy2_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(galaxy2_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(galaxy2_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(galaxy2_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Epoch Astro Command (manufactured in Japan) + * PCB labels 96111/96112 + * NEC uCOM-43 MCU, labeled D553C 202 + * cyan/red VFD display NEC FIP9AM20T no. 42-42, with color overlay + bezel + + known releases: + - Japan: Astro Command + - USA: Astro Command, published by Tandy + - UK: Scramble, published by Grandstand + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class astrocmd_state : public hh_ucom4_state +{ +public: + astrocmd_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void astrocmd_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,4,5,6,7,0,1,2,3); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,3,2,12,13,14,15,16,17,18,0,1,4,8,5,9,7,11,6,10); + display_matrix(17, 9, plate, grid); +} + +WRITE8_MEMBER(astrocmd_state::grid_w) +{ + // C,D(,E3): vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(astrocmd_state::plate_w) +{ + // E01,F,G,H,I: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + if (offset == NEC_UCOM4_PORTE) + { + // E2: speaker out + m_speaker->level_w(data >> 2 & 1); + + // E3: vfd matrix grid 8 + grid_w(space, offset, data >> 3 & 1); + } + else + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( astrocmd ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Missile") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Bomb") + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( astrocmd, astrocmd_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(astrocmd_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(astrocmd_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(astrocmd_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(astrocmd_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(astrocmd_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(astrocmd_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(astrocmd_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Epoch Dracula (manufactured in Japan) + * PCB label 96121 + * NEC uCOM-43 MCU, labeled D553C 206 + * cyan/red/green VFD display NEC FIP8BM20T no. 2-42 + + known releases: + - Japan: Dracula House, yellow case + - USA: Dracula, red case + - Other: Dracula, yellow case, published by Hales + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class edracula_state : public hh_ucom4_state +{ +public: + edracula_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +WRITE8_MEMBER(edracula_state::grid_w) +{ + // C,D: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + display_matrix(18, 8, m_plate, m_grid); +} + +WRITE8_MEMBER(edracula_state::plate_w) +{ + // I2: speaker out + if (offset == NEC_UCOM4_PORTI) + m_speaker->level_w(data >> 2 & 1); + + // E,F,G,H,I01: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + display_matrix(18, 8, m_plate, m_grid); +} + + +// config + +static INPUT_PORTS_START( edracula ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( edracula, edracula_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(edracula_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(edracula_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(edracula_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(edracula_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(edracula_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(edracula_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(edracula_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Mego Mini-Vid Break Free (manufactured in Japan) + * PCB label Mego 79 rev F + * NEC uCOM-43 MCU, labeled D553C 049 + * cyan VFD display Futaba DM-4.5 91 + + note: MAME external artwork is not needed for this game + +***************************************************************************/ + +class mvbfree_state : public hh_ucom4_state +{ +public: + mvbfree_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE8_MEMBER(speaker_w); +}; + +// handlers + +void mvbfree_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); + UINT16 plate = BITSWAP16(m_plate,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); + display_matrix(10, 14, plate, grid); +} + +WRITE8_MEMBER(mvbfree_state::grid_w) +{ + // E23,F,G,H: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + + // E01: plate 0,1 + if (offset == NEC_UCOM4_PORTE) + plate_w(space, 2 + NEC_UCOM4_PORTC, data & 3); + else + prepare_display(); +} + +WRITE8_MEMBER(mvbfree_state::plate_w) +{ + // C,D(,E01): vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(mvbfree_state::speaker_w) +{ + // I0: speaker out + m_speaker->level_w(data & 1); +} + + +// config + +static INPUT_PORTS_START( mvbfree ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + + PORT_START("IN.1") // port B + PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) // unimplemented p1/p2 buttons + PORT_CONFNAME( 0x0c, 0x04, "Game Select") + PORT_CONFSETTING( 0x04, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_CONFSETTING( 0x08, "3" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( mvbfree, mvbfree_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, 400000) // approximation + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(mvbfree_state, plate_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(mvbfree_state, plate_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(mvbfree_state, grid_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(mvbfree_state, grid_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(mvbfree_state, grid_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(mvbfree_state, grid_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(mvbfree_state, speaker_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_mvbfree) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy(tronic) Cosmic Combat (manufactured in Japan) + * PCBs are labeled 2E1019-E01 + * NEC uCOM-44 MCU, labeled D552C 042 + * cyan VFD display NEC FIP32AM18Y tube no. 0E, with color overlay + + known releases: + - USA: Cosmic Combat + - Japan: Space Attack + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class tccombat_state : public hh_ucom4_state +{ +public: + tccombat_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void tccombat_state::prepare_display() +{ + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,3,2,1,0,7,6,5,4); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,11,15,3,10,14,2,9,13,1,0,12,8,15,1,5,0,3,7,2,6); + display_matrix(20, 9, plate, grid); +} + +WRITE8_MEMBER(tccombat_state::grid_w) +{ + // I1: speaker out + if (offset == NEC_UCOM4_PORTI) + m_speaker->level_w(data >> 1 & 1); + + // C,D,I0: vfd matrix grid + int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(tccombat_state::plate_w) +{ + // E,F123,G,H: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( tccombat ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) + PORT_CONFSETTING( 0x02, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tccombat, tccombat_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D552, 400000) // approximation + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tccombat_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tccombat_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tccombat_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tccombat_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tccombat_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(tccombat_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(tccombat_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy(tronic) Tennis (manufactured in Japan) + * PCB labeled TOMY TN-04 TENNIS + * NEC uCOM-44 MCU, labeled D552C 048 + * VFD display NEC FIP11AM15T tube no. 0F, with overlay + + The initial release of this game was in 1979, known as Pro-Tennis, + it has a D553 instead of D552, with just a little over 50% ROM used. + + Press the Serve button to start, then hit the ball by pressing one of the + positional buttons when the ball flies over it. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class tmtennis_state : public hh_ucom4_state +{ +public: + tmtennis_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE8_MEMBER(port_e_w); + DECLARE_READ8_MEMBER(input_r); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(difficulty_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +WRITE8_MEMBER(tmtennis_state::grid_w) +{ + // G,H,I: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTG) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + display_matrix(12, 12, m_plate, m_grid); +} + +WRITE8_MEMBER(tmtennis_state::plate_w) +{ + // C,D,F: vfd matrix plate + int shift = (offset == NEC_UCOM4_PORTF) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + display_matrix(12, 12, m_plate, m_grid); +} + +WRITE8_MEMBER(tmtennis_state::port_e_w) +{ + // E01: input mux + // E2: speaker out + // E3: N/C + m_inp_mux = data & 3; + m_speaker->level_w(data >> 2 & 1); +} + +READ8_MEMBER(tmtennis_state::input_r) +{ + // A,B: multiplexed buttons + return ~read_inputs(2) >> (offset*4); +} + + +// config + +/* Pro-Tennis physical button layout and labels is like this: + + * left = P2/CPU side * * right = P1 side * + + [SERVE] [1] [2] [3] [3] [2] [1] [SERVE] + [4] [5] [6] [6] [5] [4] + + PRACTICE<--PRO1-->PRO2 1PLAYER<--OFF-->2PLAYER +*/ + +static INPUT_PORTS_START( tmtennis ) + PORT_START("IN.0") // E0 port A/B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("P1 Serve") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("P2 Serve") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_NAME("P1 Button 1") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("P1 Button 4") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("P1 Button 2") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("P1 Button 5") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("P1 Button 3") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P1 Button 6") + + PORT_START("IN.1") // E1 port A/B + PORT_CONFNAME( 0x101, 0x100, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, tmtennis_state, difficulty_switch, NULL) + PORT_CONFSETTING( 0x001, "Practice" ) + PORT_CONFSETTING( 0x100, "Pro 1" ) // -> difficulty_switch + PORT_CONFSETTING( 0x000, "Pro 2" ) + PORT_CONFNAME( 0x02, 0x00, "Players" ) + PORT_CONFSETTING( 0x00, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("P2 Button 1") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 Button 4") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("P2 Button 2") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 Button 5") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("P2 Button 3") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("P2 Button 6") +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(tmtennis_state::difficulty_switch) +{ + set_clock(); +} + + +void tmtennis_state::set_clock() +{ + // MCU clock is from an LC circuit oscillating by default at ~360kHz, + // but on PRO1, the difficulty switch puts a capacitor across the LC circuit + // to slow it down to ~260kHz. + m_maincpu->set_unscaled_clock((m_inp_matrix[1]->read() & 0x100) ? 260000 : 360000); +} + +void tmtennis_state::machine_reset() +{ + hh_ucom4_state::machine_reset(); + set_clock(); +} + +static MACHINE_CONFIG_START( tmtennis, tmtennis_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D552, 360000) // see set_clock + MCFG_UCOM4_READ_A_CB(READ8(tmtennis_state, input_r)) + MCFG_UCOM4_READ_B_CB(READ8(tmtennis_state, input_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tmtennis_state, plate_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tmtennis_state, plate_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tmtennis_state, port_e_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tmtennis_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tmtennis_state, grid_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(tmtennis_state, grid_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(tmtennis_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy(tronic) Pac-Man (manufactured in Japan) + * PCBs are labeled TN-08 2E108E01 + * NEC uCOM-43 MCU, labeled D553C 160 + * cyan/red/green VFD display NEC FIP8AM18T no. 2-21 + * bright yellow round casing + + known releases: + - Japan: Puck Man + - USA: Pac Man + - UK: Puckman (Tomy), and also published by Grandstand as Munchman + - Australia: Pac Man-1, published by Futuretronics + + The game will start automatically after turning it on. This Pac Man refuses + to eat dots with his butt, you can only eat them going right-to-left. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class tmpacman_state : public hh_ucom4_state +{ +public: + tmpacman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void tmpacman_state::prepare_display() +{ + UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,16,17,18,11,10,9,8,0,2,3,1,4,5,6,7,12,13,14,15) | 0x100; + display_matrix(19, 8, plate, grid); +} + +WRITE8_MEMBER(tmpacman_state::grid_w) +{ + // C,D: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(tmpacman_state::plate_w) +{ + // E1: speaker out + if (offset == NEC_UCOM4_PORTE) + m_speaker->level_w(data >> 1 & 1); + + // E023,F,G,H,I: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( tmpacman ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY + + PORT_START("IN.1") // port B + PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x01, "Professional" ) + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tmpacman, tmpacman_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_430kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tmpacman_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tmpacman_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tmpacman_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tmpacman_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tmpacman_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(tmpacman_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(tmpacman_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy(tronic) Scramble (manufactured in Japan) + * PCBs are labeled TN-10 2E114E01 + * NEC uCOM-43 MCU, labeled D553C 192 + * cyan/red/green VFD display NEC FIP10CM20T no. 2-41 + + known releases: + - World: Scramble + - USA: Scramble, published by Tandy + - UK: Astro Blaster, published by Hales (Epoch Astro Command was named Scramble) + - Germany: Rambler + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class tmscramb_state : public hh_ucom4_state +{ +public: + tmscramb_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void tmscramb_state::prepare_display() +{ + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,3,15,2,14,1,13,16,0,12,8,4,9,5,10,6,11,7) | 0x400; + display_matrix(17, 10, plate, m_grid); +} + +WRITE8_MEMBER(tmscramb_state::grid_w) +{ + // I2: speaker out + if (offset == NEC_UCOM4_PORTI) + m_speaker->level_w(data >> 2 & 1); + + // C,D,I01: vfd matrix grid + int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(tmscramb_state::plate_w) +{ + // E,F,G,H: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( tmscramb ) + PORT_START("IN.0") // port A + PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x01, "Professional" ) + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + + PORT_START("IN.1") // port B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_2WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_2WAY + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tmscramb, tmscramb_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tmscramb_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tmscramb_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tmscramb_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tmscramb_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tmscramb_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(tmscramb_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(tmscramb_state, grid_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy(tronic) Caveman (manufactured in Japan) + * PCBs are labeled TN-12 2E114E03 + * NEC uCOM-43 MCU, labeled D553C 209 + * cyan/red/green VFD display NEC FIP8AM20T no. 2-42 + + known releases: + - World: Caveman + - USA: Caveman, published by Tandy + - UK: Cave Man - Jr. Caveman vs Dinosaur, published by Grandstand + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class tcaveman_state : public hh_ucom4_state +{ +public: + tcaveman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void tcaveman_state::prepare_display() +{ + UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,10,11,5,6,7,8,0,9,2,18,17,16,3,15,14,13,12,4,1) | 0x40; + display_matrix(19, 8, plate, grid); +} + +WRITE8_MEMBER(tcaveman_state::grid_w) +{ + // C,D: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + +WRITE8_MEMBER(tcaveman_state::plate_w) +{ + // E3: speaker out + if (offset == NEC_UCOM4_PORTE) + m_speaker->level_w(data >> 3 & 1); + + // E012,F,G,H,I: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( tcaveman ) + PORT_START("IN.0") // port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_CONFNAME( 0x08, 0x00, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x08, "Professional" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tcaveman, tcaveman_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tcaveman_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tcaveman_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tcaveman_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tcaveman_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tcaveman_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(tcaveman_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(tcaveman_state, plate_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Tomy Alien Chase (manufactured in Japan) + * PCBs are labeled TN-16 2E121B01 + * NEC uCOM-43 MCU, labeled D553C 258 + * red/green VFD display NEC FIP9AM24T, with color overlay, 2-sided* + + *Player one views the VFD from the front (grid+filament side) while the + opposite player views it from the back side (through the conductive traces), + basically a mirror-image. + + To start the game, simply press [UP]. Hold a joystick direction to move around. + + NOTE!: MAME external artwork is required + +***************************************************************************/ + +class alnchase_state : public hh_ucom4_state +{ +public: + alnchase_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(output_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(alnchase_state::output_w) +{ + if (offset <= NEC_UCOM4_PORTE) + { + // C,D,E0: vfd matrix grid + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_grid = (m_grid & ~(0xf << shift)) | (data << shift); + + // C0(grid 0): input enable PL1 + // D0(grid 4): input enable PL2 + m_inp_mux = (m_grid & 1) | (m_grid >> 3 & 2); + + // E1: speaker out + if (offset == NEC_UCOM4_PORTE) + m_speaker->level_w(data >> 1 & 1); + } + + if (offset >= NEC_UCOM4_PORTE) + { + // E23,F,G,H,I: vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTE) * 4; + m_plate = ((m_plate << 2 & ~(0xf << shift)) | (data << shift)) >> 2; + } + + display_matrix(17, 9, m_plate, m_grid); +} + +READ8_MEMBER(alnchase_state::input_r) +{ + // A: multiplexed buttons + return read_inputs(2); +} + + +// config + +/* physical button layout and labels is like this: + + POWER SOUND LEVEL PLAYER + ON ON PRO TWO START + o o | | + | | | | [joystick] + | | o o + OFF OFF AMA ONE GAME 0,1,2,3 + + 1 PLAYER SIDE + + other player side only has a joystick +*/ + +static INPUT_PORTS_START( alnchase ) + PORT_START("IN.0") // C0 port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + + PORT_START("IN.1") // D0 port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) // on non-mirrored view, swap P2 left/right + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) // " + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + + PORT_START("IN.2") // port B + PORT_CONFNAME( 0x01, 0x01, "Players" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_CONFNAME( 0x02, 0x00, DEF_STR( Difficulty ) ) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x02, "Professional" ) + PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( alnchase, alnchase_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) + MCFG_UCOM4_READ_A_CB(READ8(alnchase_state, input_r)) + MCFG_UCOM4_READ_B_CB(IOPORT("IN.2")) + MCFG_UCOM4_WRITE_C_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(alnchase_state, output_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( ufombs ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "d552c-017", 0x0000, 0x0400, CRC(0e208cb3) SHA1(57db6566916c94325e2b67ccb94b4ea3b233487d) ) +ROM_END + + +ROM_START( ssfball ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-031", 0x0000, 0x0800, CRC(ff5d91d0) SHA1(9b2c0ae45f1e3535108ee5fef8a9010e00c8d5c3) ) +ROM_END + + +ROM_START( bmsoccer ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "d552c-043", 0x0000, 0x0400, CRC(10c2a4ea) SHA1(6ebca7d406e22ff7a8cd529579b55a700da487b4) ) +ROM_END + + +ROM_START( bmsafari ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "d552c-049", 0x0000, 0x0400, CRC(82fa3cbe) SHA1(019e7ec784e977eba09997fc46af253054fb222c) ) +ROM_END + + +ROM_START( splasfgt ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-055", 0x0000, 0x0800, CRC(eb471fbd) SHA1(f06cfe567bf6f9ed4dcdc88acdcfad50cd370a02) ) +ROM_END + + +ROM_START( bcclimbr ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-170", 0x0000, 0x0800, CRC(fc2eabdb) SHA1(0f5cc854be7fdf105d9bd2114659d40c65f9d782) ) +ROM_END + + +ROM_START( tactix ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d557lc-512", 0x0000, 0x0800, CRC(1df738cb) SHA1(15a5de28a3c03e6894d29c56b5b424983569ccf2) ) +ROM_END + + +ROM_START( invspace ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "d552c-054", 0x0000, 0x0400, CRC(913d9c13) SHA1(f20edb5458e54d2f6d4e45e5d59efd87e05a6f3f) ) +ROM_END + + +ROM_START( efball ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-080", 0x0000, 0x0800, CRC(54c1027f) SHA1(6cc98074dae9361fa8c0ed6501b6a57ad325ccbd) ) +ROM_END + + +ROM_START( galaxy2 ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-153.s01", 0x0000, 0x0800, CRC(70d552b3) SHA1(72d50647701cb4bf85ea947a149a317aaec0f52c) ) +ROM_END + + +ROM_START( astrocmd ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-202.s01", 0x0000, 0x0800, CRC(b4b34883) SHA1(6246d561c2df1f2124575d2ca671ef85b1819edd) ) +ROM_END + + +ROM_START( edracula ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-206.s01", 0x0000, 0x0800, CRC(b524857b) SHA1(c1c89ed5dd4bb1e6e98462dc8fa5af2aa48d8ede) ) +ROM_END + + +ROM_START( mvbfree ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-049", 0x0000, 0x0800, CRC(d64a8399) SHA1(97887e486fa29b1fc4a5a40cacf3c960f67aacbf) ) +ROM_END + + +ROM_START( tccombat ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "d552c-042", 0x0000, 0x0400, CRC(d7b5cfeb) SHA1(a267be8e43b7740758eb0881b655b1cc8aec43da) ) +ROM_END + + +ROM_START( tmtennis ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "d552c-048", 0x0000, 0x0400, CRC(78702003) SHA1(4d427d4dbeed901770c682338867f58c7b54eee3) ) +ROM_END + + +ROM_START( tmpacman ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-160", 0x0000, 0x0800, CRC(b21a8af7) SHA1(e3122be1873ce76a4067386bf250802776f0c2f9) ) +ROM_END + + +ROM_START( tmscramb ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-192", 0x0000, 0x0800, CRC(00fcc501) SHA1(a7771e934bf8268c83f38c7ec0acc668836e0939) ) +ROM_END + + +ROM_START( tcaveman ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-209", 0x0000, 0x0800, CRC(d230d4b7) SHA1(2fb12b60410f5567c5e3afab7b8f5aa855d283be) ) +ROM_END + + +ROM_START( alnchase ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d553c-258", 0x0000, 0x0800, CRC(c5284ff5) SHA1(6a20aaacc9748f0e0335958f3cea482e36153704) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +CONS( 1979, ufombs, 0, 0, ufombs, ufombs, driver_device, 0, "Bambino", "UFO Master-Blaster Station", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1979, ssfball, 0, 0, ssfball, ssfball, driver_device, 0, "Bambino", "Superstar Football", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1979, bmsoccer, 0, 0, bmsoccer, bmsoccer, driver_device, 0, "Bambino", "Kick The Goal Soccer", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1981, bmsafari, 0, 0, bmsafari, bmsafari, driver_device, 0, "Bambino", "Safari (Bambino)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1980, splasfgt, 0, 0, splasfgt, splasfgt, driver_device, 0, "Bambino", "Space Laser Fight", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1982, bcclimbr, 0, 0, bcclimbr, bcclimbr, driver_device, 0, "Bandai", "Crazy Climber (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1980, tactix, 0, 0, tactix, tactix, driver_device, 0, "Castle Toy", "Tactix", MACHINE_SUPPORTS_SAVE ) + +CONS( 1980, invspace, 0, 0, invspace, invspace, driver_device, 0, "Epoch", "Invader From Space", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1980, efball, 0, 0, efball, efball, driver_device, 0, "Epoch", "Electronic Football (Epoch)", MACHINE_SUPPORTS_SAVE ) +CONS( 1981, galaxy2, 0, 0, galaxy2, galaxy2, driver_device, 0, "Epoch", "Galaxy II", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, astrocmd, 0, 0, astrocmd, astrocmd, driver_device, 0, "Epoch", "Astro Command", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, edracula, 0, 0, edracula, edracula, driver_device, 0, "Epoch", "Dracula (Epoch)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) + +CONS( 1979, mvbfree, 0, 0, mvbfree, mvbfree, driver_device, 0, "Mego", "Mini-Vid Break Free", MACHINE_SUPPORTS_SAVE ) + +CONS( 1980, tccombat, 0, 0, tccombat, tccombat, driver_device, 0, "Tomy", "Cosmic Combat", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1980, tmtennis, 0, 0, tmtennis, tmtennis, driver_device, 0, "Tomy", "Tennis (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, tmpacman, 0, 0, tmpacman, tmpacman, driver_device, 0, "Tomy", "Pac Man (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, tmscramb, 0, 0, tmscramb, tmscramb, driver_device, 0, "Tomy", "Scramble (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1982, tcaveman, 0, 0, tcaveman, tcaveman, driver_device, 0, "Tomy", "Caveman (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1984, alnchase, 0, 0, alnchase, alnchase, driver_device, 0, "Tomy", "Alien Chase", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mame/drivers/hk68v10.c b/src/mame/drivers/hk68v10.c new file mode 100644 index 00000000000..57ab539c7bd --- /dev/null +++ b/src/mame/drivers/hk68v10.c @@ -0,0 +1,389 @@ +// license:BSD-3-Clause +// copyright-holders:Joakim Larsson Edstrom +/*************************************************************************** + * + * Heurikon HK68/V10 6U SBC driver, initially derived from hk68v10.c + * + * 21/08/2015 + * + * I baught this board from http://www.retrotechnology.com without documentation. + * It has a Motorola 68010 CPU @ 10MHz and two 2764 EPROMS with HBUG firmware + * The board is very populated and suitable to run a real server OS supported by + * FPU,MMU and DMA controller chips. The firmware supports SCSI, Centronics/FPI + * and a serial port. I have not found so much on the FPI interface yet and it is + * possibly Heurikon specific. There is also a Heurikon Multibus board called + * HK68/M10 for which I might add support from specs, however would need a ROM + * to verify. + * + * || + * || || + * ||||--|| + * ||||--|| + * || ||____________________________________________________________ ___ + * || | | | 12 PALs 68/V-... | | | | | |_| | + * || | | 2 x | |74 |74 |74 |74 | | | | + * || | | 74273 | VS4-01 VM4-00 | 244 573 645 645 | | | + * \==||| |SCSI | | VS3-00 VM3-03 | | | | | | | | + * ||| | | | VS2-01 VM2-02 |___|___|___|___| | | | + * || |NCR | | VS1-00 VM1-01 | | | | | | | + * || | 8530| 2 x | VBX-00 VDB-00 |74 |74 |74 | | |VME| + * || | | 74245 | VI1-00 VI2-00 | 244 641 245 | | | + * || | | | (90 deg ccw) | | | | | |P1 | + * SCSI || |_____| |_____________________|___|___|___| | | | + * port || | | _________ _________________________________ | | | + * || | | | || |74 |PAL | | | | | + * || | | | || 5 x | 244 MP2| 2 x | | | | + * || |CIO | | MC68881 || 74373 | | -00| 74646| | | | + * || |paral| | FPU || | | | | | | | + * || |Z8536| |_________||_________________|_ _| | | |_| | + * ||| | | | | | | ------------ |___| + * /==||| | | | | | | | 3 PALs | | + * FSM || | | | MC68010 | MC68451 | MC68450 | | MP1-00 | | + * 1234 || | | | CPU | MMU | DMA | | MX2-00 | | + * LEDs || |-----| |_________|__________|_________|__| MX1-01 |---| + * || | | ____ ____ ---| |__________|74 | + * \==||| | | | | | | |74| 4 x | 3 PALs |145| + * ||| |SCC | | | | | |804 74245 | CS3-00 |___| + * FPI || |seria| |U12 | |U23 | | | | CS2-00 | | + * paralell |Z8530A |HBUG| |HBUG| | | | CS1-00 | |___ + * port || | | | | | | ---_---------------|__________| _| | + * || | | | | | | |MTTLDL|MDLDM| 2 x |___________ | | | + * ||| | | |____|_|____|_|____40|TTL75|74280| | | | | + * /==||| | || |19. | | | | | |_____| | | | | + * \==||| |_____||75 |6608|16 |20 |74|74| ______| 9 x 4 | | | | + * ||| +--------+|173| MHz| MHz | MHz| 74 08| | | RAM chips| | |VME| + * || | ||___|____|_____|____|__|__||74 74 | on SIL | | | | + * || | 2 x || | | |259|257 boards | | |P2 | + * || | SIL || 12 PALs 90 deg ccw|74| -______- | | | | + * || | boards || |240 | | | | | | | + * || | with 2 || BER-00 FPI-01 | | |74 74 | | | | | + * Serial|| | DIP16 || AC4-00 ARB-01 |__|___|138|257 | | | | + * port || | surf || AC3-00 INT-00 |______| | | | | + * || | mounted|| AC2-01 IAK-00 | | | | | | | + * || | chips || AC1-01 PAS-01 |74 |74| | | | | + * || | each || RFS-01 |590|257 | | | | + * ||| | || RCT-01 | | | | |_| | + * /==||| +--------+|__________________________|___|__|__________| |___| + * || ||------------------------------------------------------------+-+ + * ||||--|| + * ||||--|| + * || + * + * History of Heurikon + *--------------------- + * The company was founded 1972 as cellar company. Heurikon was aquired + * 1989 by Computer Products, 1990 by Artesyn and finally in 2005 by Emerson + * Electric who consilidated it fully by 2009 and closed the office. + * + * Misc links about Heurikon and this board: + * http://www.heurikon.com/ + * http://www.nytimes.com/1992/01/07/business/company-news-briefs.html + * http://bitsavers.informatik.uni-stuttgart.de/pdf/heurikon/brochures/HK68_V10_Brochure.pdf + * http://bitsavers.informatik.uni-stuttgart.de/pdf/heurikon/Heurikon_UNIX_System_V_and_V.2_Reference_Guide_Apr87.pdf + * From http://www.iri.tudelft.nl/~sfwww/manuals/OS9/PDF/9OM_30.pdf: + * "In most cases, you will only need to change the device base address. Some hardware implementations of the MC68451 + * (specifically the Heurikon M10/V10 CPU's) use the DMA portion of the Address Space Table (AST) instead of the MPU + * section which is normally used. You should change the offsets for the AST registers to match your hardware. The + * ssmdefs.a file has conditional directives to accommodate either the standard or Heurikon style implementations." + * + * Address Map from the UNIX Ref Guide + * -------------------------------------------------------------------------- + * Address Range Memory Space (physical) Notes + * -------------------------------------------------------------------------- + * 0xffffff (top of memory) + * 0xffc200 0xffc220 Sky FFP 68881 FPU + * 0xff8000 ... MCT Reel-to-reel tape (V10) VME + * 0xff0000 0xff0100 Tapemaster(00B0,00B1) Reel-to-reel tape (M10) Multibus + * Ethernet(0010,0011) + * 0xff0000 (base of bus I/O) + * + * 0xfea000 SCC8530 device + * 0xfe9000 offset 6 seems also to be 2 access registers, ie register offset + data pairs + * 0xfe8000 offset E reading single byte + * 0xfe4000 front LED:s? or move ROM from 0x0 to 0xfc0000... + * 0xfe2000 cleared + * 0xfe0000 HK68 On-card I/O MMU, DMAC, SCC, SCSI + * 0xfc0000 HK68 ROM (128K) Hbug monitor + * 0xf00000 (reserved) + * (shared memory and logical area + * for shared text.) + * 0x800000 (Twilight Zone) (top of /dev/mem) + * 0x7c0000 (reserved) + * 0x780000 8 Chnl serial Expn(1-4) (CDC) + * HK68 (1-15) VRTX + * MLZ-93 (1-4) CP/M Shell + * 0x700000 + * (open) + * 0x*00000 (maxmeml) + * RAM (bus) (optional) + * 0x200000 (top of 2 meg RAM) + * RAM (bus) (optional) + * 0x100000 (top of 1 meg RAM) + * User RAM + * 0x001000 UNIX Kernel + * Exception Vectors + * 0x000000 (bottom of memory) + * -------------------------------------------------------------------------- + * + * Interrupt sources M10/V10 + * ---------------------------------------------------------- + * Description Device Lvl IRQ VME board + * /Board Vector Address + * ---------------------------------------------------------- + * On board Sources M10/V10 + * + * Off board Sources (other VME boards) + * EXOS Ethernet 5 4 + * TapeMaster Reel-to-Reel Tape 3 + * MCT Reel-to-Reel Tape 5 + * CDC MB1031 Serial Expansion 2 2 + * IT 2190 SMD Interface 1 3 + * IT 3200 SMD Interface 3 + * ---------------------------------------------------------- + * + * DMAC Channel Assignments + * ---------------------------------------------------------- + * Channel M10 V10 + * ---------------------------------------------------------- + * 0 SCSI SCSI + * 1 Streamer (P3) n/a + * 2 n/a n/a + * 3 SBX-FDIO n/a + * ---------------------------------------------------------- + * + * TODO: + * - Dump the ROMs (DONE) + * - Setup a working address map (DONE) + * - Fix terminal for HBUG (DONE) + * - Add VME bus driver + * - Add DMA/MMU devices + * - Add CIO port + * - ADD SCSI controller device + * - dump PALs and describe descrete logic + * - Setup BAUD generation correctly, (eg find that x32 divider) + * it is a multilayer PCB so very hard to trace. + * - Add LED:s + * - Add Jumpers and strap areas + * - Find and Boot Heurikon Unix from a SCSI device + * - Support that optional 68881 FPU + * + ****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/z80scc.h" +#include "bus/rs232/rs232.h" +#include "machine/clock.h" + +#define VERBOSE 0 + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +#if VERBOSE == 2 +#define logerror printf +#endif + +#ifdef _MSC_VER +#define FUNCNAME __func__ +#else +#define FUNCNAME __PRETTY_FUNCTION__ +#endif + +#define BAUDGEN_CLOCK XTAL_19_6608MHz /* Raltron */ +/* + */ +#define SCC_CLOCK (BAUDGEN_CLOCK / 128) /* This gives prompt at the RS232 terminal device (9600) */ +//#define SCC_CLOCK (BAUDGEN_CLOCK / 4) /* This is correct giving 4.9152MHz as documentation says */ +class hk68v10_state : public driver_device +{ +public: +hk68v10_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device (mconfig, type, tag), + m_maincpu (*this, "maincpu") + ,m_sccterm(*this, "scc") +// ,m_cart(*this, "exp_rom1") +{ +} + +DECLARE_READ16_MEMBER (bootvect_r); +DECLARE_WRITE16_MEMBER (bootvect_w); +DECLARE_READ16_MEMBER (vme_a24_r); +DECLARE_WRITE16_MEMBER (vme_a24_w); +DECLARE_READ16_MEMBER (vme_a16_r); +DECLARE_WRITE16_MEMBER (vme_a16_w); +virtual void machine_start (); +virtual void machine_reset (); +DECLARE_WRITE_LINE_MEMBER (write_sccterm_clock); + +protected: + +private: +required_device m_maincpu; +required_device m_sccterm; + +// Pointer to System ROMs needed by bootvect_r and masking RAM buffer for post reset accesses + UINT16 *m_sysrom; + UINT16 m_sysram[4]; +}; + +static ADDRESS_MAP_START (hk68v10_mem, AS_PROGRAM, 16, hk68v10_state) +ADDRESS_MAP_UNMAP_HIGH +AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r) /* ROM mirror just durin reset */ +AM_RANGE (0x000000, 0x000007) AM_RAM AM_WRITE (bootvect_w) /* After first write we act as RAM */ +AM_RANGE (0x000008, 0x1fffff) AM_RAM /* 2 Mb RAM */ +AM_RANGE (0xFC0000, 0xFC3fff) AM_ROM /* System EPROM Area 16Kb HBUG */ +AM_RANGE (0xFC4000, 0xFDffff) AM_ROM /* System EPROM Area an additional 112Kb for System ROM */ +AM_RANGE (0xFE9000, 0xFE9009) AM_RAM //AM_DEVREADWRITE8("scc", scc8530_device, ba_cd_r, ba_cd_w, 0xffff) /* Z80-PIO? */ +AM_RANGE (0xFEA000, 0xFEA001) AM_DEVREADWRITE8("scc", scc8530_device, ca_r, ca_w, 0xff00) /* Dual serial port Z80-SCC */ +AM_RANGE (0xFEA002, 0xFEA003) AM_DEVREADWRITE8("scc", scc8530_device, cb_r, cb_w, 0xff00) /* Dual serial port Z80-SCC */ +AM_RANGE (0xFEA004, 0xFEA005) AM_DEVREADWRITE8("scc", scc8530_device, da_r, da_w, 0xff00) /* Dual serial port Z80-SCC */ +AM_RANGE (0xFEA006, 0xFEA007) AM_DEVREADWRITE8("scc", scc8530_device, db_r, db_w, 0xff00) /* Dual serial port Z80-SCC */ +//AM_RANGE(0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ +//AM_RANGE(0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START (hk68v10) +INPUT_PORTS_END + +/* Start it up */ +void hk68v10_state::machine_start () +{ + LOG (("%" I64FMT "d %s\n", m_maincpu->total_cycles(), FUNCNAME)); + + /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ + m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x0fc0000); +} + +/* Support CPU resets + + TODO: Investigate why the user need two 'softreset' commands for the below to work. Eg F3 + F11 + F3 + F11 + If only one 'softreset' is given the reset PC gets the RAM content, not the intended ROM vector. + Race conditions? Wrong call order in memory system? Debugger prefetch accesses? Better way to to this? +*/ +void hk68v10_state::machine_reset () +{ + LOG (("%" I64FMT "d %s\n", m_maincpu->total_cycles(), FUNCNAME)); + + /* Reset pointer to bootvector in ROM for bootvector handler bootvect_r */ + if (m_sysrom == &m_sysram[0]) /* Condition needed because memory map is not setup first time */ + m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x0fc0000); +} + +/* Boot vector handler, the PCB hardwires the first 8 bytes from 0xfc0000 to 0x0 at reset*/ +/* + Right after HBUG reset the bootvector is masked by RAM: + FC001C: move.w #$700, $fe4000.l + FC0024: move.l #$0, $0.l # <- zeroing the reset vector + FC002E: move.l #$0, $4.l # There is for sure some hardware mapping going in here +*/ +READ16_MEMBER (hk68v10_state::bootvect_r){ + //LOG (("bootvect_r %s\n", m_sysrom != &m_sysram[0] ? "as reset" : "as swapped")); + return m_sysrom[offset]; +} + +WRITE16_MEMBER (hk68v10_state::bootvect_w){ + LOG (("bootvect_w offset %08x, mask %08x, data %04x\n", offset, mem_mask, data)); + m_sysram[offset % sizeof(m_sysram)] &= ~mem_mask; + m_sysram[offset % sizeof(m_sysram)] |= (data & mem_mask); + m_sysrom = &m_sysram[0]; // redirect all upcomming accesses to masking RAM until reset. +} + +#if 0 +/* Dummy VME access methods until the VME bus device is ready for use */ +READ16_MEMBER (hk68v10_state::vme_a24_r){ + LOG (("vme_a24_r\n")); + return (UINT16) 0; +} + +WRITE16_MEMBER (hk68v10_state::vme_a24_w){ + LOG (("vme_a24_w\n")); +} + +READ16_MEMBER (hk68v10_state::vme_a16_r){ + LOG (("vme_16_r\n")); + return (UINT16) 0; +} + +WRITE16_MEMBER (hk68v10_state::vme_a16_w){ + LOG (("vme_a16_w\n")); +} +#endif + +/* + * Serial port clock source depends on the CPU clock and divider settings + * HBUG has a control byte that needs to be patched accordingly: + * + * CPU clock SCC clock Baud rate offset 0x0b value + * 10 Mhz 4.9152MHz 9600 15 + * 10 Mhz 4.9152MHz 19200 55 + * 12 Mhz 4.9152MHz 9600 16 + * 12 Mhz 4.9152MHz 19200 56 + * + * Configuration word detail: + * D15-D8 reserved ( = 0 ) + * D7(MSB) = 0 + * D6 = 0 for console default 9600 baud + * D6 = 1 for console default 19,200 baud + * D5,D4,D3,D2 = 0101 for 4.9152 Mhz SCC clock + * D1,DO + * 01 for 10 Mhz MPU clock + * D1,DO = 10 for 12 Mhz MPU clock + * + * Original HBUG configuration word: 0x003D = 0000 0000 0011 1101 + * + */ +WRITE_LINE_MEMBER (hk68v10_state::write_sccterm_clock){ + m_sccterm->txca_w (state); + m_sccterm->rxca_w (state); +} + +/* + * Machine configuration + */ +static MACHINE_CONFIG_START (hk68v10, hk68v10_state) +/* basic machine hardware */ +MCFG_CPU_ADD ("maincpu", M68010, XTAL_10MHz) +MCFG_CPU_PROGRAM_MAP (hk68v10_mem) + +/* Terminal Port config */ +MCFG_SCC8530_ADD("scc", XTAL_4MHz, 0, 0, 0, 0 ) +MCFG_Z80SCC_OUT_TXDA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_txd)) +MCFG_Z80SCC_OUT_DTRA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_dtr)) +MCFG_Z80SCC_OUT_RTSA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_rts)) + +MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal") +MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("scc", scc8530_device, rxa_w)) +MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("scc", scc8530_device, ctsa_w)) + +MCFG_DEVICE_ADD ("sccterm_clock", CLOCK, SCC_CLOCK) +MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (hk68v10_state, write_sccterm_clock)) + +MACHINE_CONFIG_END + +/* ROM definitions */ +ROM_START (hk68v10) +ROM_REGION (0x1000000, "maincpu", 0) + +ROM_LOAD16_BYTE ("hk68kv10U23.bin", 0xFC0001, 0x2000, CRC (632aa026) SHA1 (f2b1ed0cc38dfbeb1602c013e00757015400720d)) +ROM_LOAD16_BYTE ("hk68kv10U12.bin", 0xFC0000, 0x2000, CRC (f2d688e9) SHA1 (e68699965645f0ce53de47625163c3eb02c8b727)) +/* + * System ROM information + * + * The ROMs contains HBUG v1.8, known commands from different sources: + * + * 'uc' Print HK68 Configuration + * 'um' Perform RAM test + * 'dm adrs' Display Memory + * 'sb adrs' Substitute Byte at adrs + * 'c adrs' Call Routine at adrs + * 'bw' Boot from Winchester + * 'bf' Boot from floppy (MIO, SBX-FDIO) + * 'bsf' Boot from floppy (SCSI) + * + */ +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP (1985, hk68v10, 0, 0, hk68v10, hk68v10, driver_device, 0, "Heurikon Corporation", "HK68/V10", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) diff --git a/src/mame/drivers/homelab.c b/src/mame/drivers/homelab.c new file mode 100644 index 00000000000..0d6fc6735f1 --- /dev/null +++ b/src/mame/drivers/homelab.c @@ -0,0 +1,911 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Homelab driver by Miodrag Milanovic + + 31/08/2008 Preliminary driver. + 15/06/2012 Various updates [Robbbert] + + The emulator called HoLa! works fine, but it is closed source. + You can get HoLa! at: http://gaia.atilia.eu + + ToDO: + - HTP files should be a cassette format, not a quickload. + - Quickloads cause the emulated machine to hang or reboot. + - homelab2 - cassette to fix. + Note that rom code 0x40-48 is meaningless garbage, + had to patch to stop it crashing. Need a new dump. + - homelab3/4 - Need a dump of the TM188 prom. + cassette to fix. + up to 64k ram can be fitted. schematic only shows 16k. + Z80PIO - expansion only, doesn't do anything in the + machine. /CE connects to A6, A/B = A0, C/D = A1. + The bios never talks to it. Official port numbers + are 3C-3F. + - Brailab4 - same as homelab3. + - Braiplus - no work has been done. Needs to be developed from scratch. + + +TM188 is (it seems) equivalent to 27S19, TBP18S030N, 6331-1, 74S288, 82S123, +MB7051 - fuse programmed prom. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "audio/mea8000.h" +#include "sound/dac.h" +#include "imagedev/snapquik.h" + + + +class homelab_state : public driver_device +{ +public: + homelab_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cass(*this, "cassette") + { } + + DECLARE_READ8_MEMBER(key_r); + DECLARE_WRITE8_MEMBER(cass_w); + DECLARE_READ8_MEMBER(cass2_r); + DECLARE_READ8_MEMBER(exxx_r); + DECLARE_WRITE8_MEMBER(port7f_w); + DECLARE_WRITE8_MEMBER(portff_w); + DECLARE_WRITE8_MEMBER(brailab4_port7f_w); + DECLARE_WRITE8_MEMBER(brailab4_portff_w); + DECLARE_CUSTOM_INPUT_MEMBER(cass3_r); + const UINT8 *m_p_chargen; + const UINT8 *m_p_videoram; + bool m_nmi; + required_device m_maincpu; + required_device m_speaker; + required_device m_cass; + DECLARE_DRIVER_INIT(brailab4); + DECLARE_VIDEO_START(homelab2); + DECLARE_MACHINE_RESET(homelab3); + DECLARE_VIDEO_START(homelab3); + DECLARE_MACHINE_RESET(brailab4); + DECLARE_VIDEO_START(brailab4); + UINT32 screen_update_homelab2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_homelab3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(homelab_frame); + DECLARE_QUICKLOAD_LOAD_MEMBER(homelab); +}; + +INTERRUPT_GEN_MEMBER(homelab_state::homelab_frame) +{ + if (m_nmi) + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); +} + +READ8_MEMBER( homelab_state::key_r ) // offset 27F-2FE +{ + if (offset == 0x38) // 0x3838 + { + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + return 0; + } + + UINT8 i,data = 0xff; + char kbdrow[8]; + + for (i=0; i<8; i++) + { + if (!BIT(offset, i)) + { + sprintf(kbdrow,"LINE%d", i); + data &= ioport(kbdrow)->read(); + } + } + + return data; +} + +READ8_MEMBER( homelab_state::cass2_r ) +{ + return (m_cass->input() > 0.03) ? 0xff : 0; +} + +WRITE8_MEMBER( homelab_state::cass_w ) +{ + if (offset == 0x73f) // 0x3f3f + m_nmi = true; + else + if (offset == 0x63e) // 0x3e3e + m_nmi = false; + else + if (offset == 0x400) // 0x3c00 + m_cass->output(BIT(data, 0) ? -1.0 : +1.0); // FIXME +} + +MACHINE_RESET_MEMBER(homelab_state,homelab3) +{ +} + +MACHINE_RESET_MEMBER(homelab_state,brailab4) +{ + membank("bank1")->set_entry(0); +} + +WRITE8_MEMBER( homelab_state::port7f_w ) +{ +} + +WRITE8_MEMBER( homelab_state::portff_w ) +{ +} + +WRITE8_MEMBER( homelab_state::brailab4_port7f_w ) +{ + membank("bank1")->set_entry(0); +} + +WRITE8_MEMBER( homelab_state::brailab4_portff_w ) +{ + membank("bank1")->set_entry(1); +} + +CUSTOM_INPUT_MEMBER( homelab_state::cass3_r ) +{ + return (m_cass->input() > 0.03); +} + + +READ8_MEMBER( homelab_state::exxx_r ) +{ +// keys E800-E813 but E810-E813 are not connected +// cassin E883 +// speaker/cass toggle E880, E802 + + + if (offset == 0x83) + return (m_cass->input() > 0.03); + else + if (offset == 0x80) + { + m_speaker->level_w(0); + m_cass->output(-1.0); + } + else + if (offset == 0x02) + { + m_speaker->level_w(1); + m_cass->output(+1.0); + } + + char kbdrow[8]; + UINT8 data = 0xff; + if (offset < 0x10) + { + sprintf(kbdrow,"X%X", offset); + data = ioport(kbdrow)->read(); + } + return data; +} + + +/* Address maps */ +static ADDRESS_MAP_START(homelab2_mem, AS_PROGRAM, 8, homelab_state) + AM_RANGE( 0x0000, 0x07ff ) AM_ROM // ROM 1 + AM_RANGE( 0x0800, 0x0fff ) AM_ROM // ROM 2 + AM_RANGE( 0x1000, 0x17ff ) AM_ROM // ROM 3 + AM_RANGE( 0x1800, 0x1fff ) AM_ROM // ROM 4 + AM_RANGE( 0x2000, 0x27ff ) AM_ROM // ROM 5 + AM_RANGE( 0x2800, 0x2fff ) AM_ROM // ROM 6 + AM_RANGE( 0x3000, 0x37ff ) AM_ROM // Empty + AM_RANGE( 0x3800, 0x3fff ) AM_READWRITE(key_r,cass_w) + AM_RANGE( 0x4000, 0x7fff ) AM_RAM + AM_RANGE( 0xc000, 0xc3ff ) AM_RAM AM_REGION("maincpu",0xc000) + AM_RANGE( 0xe000, 0xe0ff ) AM_READ(cass2_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(homelab3_mem, AS_PROGRAM, 8, homelab_state) + AM_RANGE( 0x0000, 0x3fff ) AM_ROM + AM_RANGE( 0x4000, 0x7fff ) AM_RAM + AM_RANGE( 0xe800, 0xefff ) AM_READ(exxx_r) + AM_RANGE( 0xf800, 0xffff ) AM_RAM AM_REGION("maincpu",0xf800) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(homelab3_io, AS_IO, 8, homelab_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x7f, 0x7f ) AM_WRITE(port7f_w) + AM_RANGE( 0xff, 0xff ) AM_WRITE(portff_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(brailab4_mem, AS_PROGRAM, 8, homelab_state) + AM_RANGE( 0x0000, 0x3fff ) AM_ROM + AM_RANGE( 0x4000, 0xcfff ) AM_RAM + AM_RANGE( 0xd000, 0xdfff ) AM_ROM + AM_RANGE( 0xe800, 0xefff ) AM_READ(exxx_r) + AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(brailab4_io, AS_IO, 8, homelab_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0xf8, 0xf9 ) AM_DEVREADWRITE("mea8000", mea8000_device, read, write) + AM_RANGE( 0x7f, 0x7f ) AM_WRITE(brailab4_port7f_w) + AM_RANGE( 0xff, 0xff ) AM_WRITE(brailab4_portff_w) +ADDRESS_MAP_END + + + +/* Input ports */ +static INPUT_PORTS_START( homelab ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) //PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Run/Brk") PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('<') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR('_') +INPUT_PORTS_END + +static INPUT_PORTS_START( homelab3 ) // F4 to F8 are foreign characters + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // A + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // D + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_VBLANK("screen") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, homelab_state, cass3_r, " ") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XB") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XC") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XD") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XE") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XF") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( brailab4 ) // F4 to F8 are foreign characters + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // A + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // D + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_VBLANK("screen") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, homelab_state, cass3_r, " ") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XB") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XC") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XD") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XE") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("XF") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +VIDEO_START_MEMBER(homelab_state,homelab2) +{ + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("maincpu")->base()+0xc000; +} + +VIDEO_START_MEMBER(homelab_state,homelab3) +{ + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("maincpu")->base()+0xf800; +} + +VIDEO_START_MEMBER(homelab_state,brailab4) +{ + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("maincpu")->base()+0x17800; +} + +UINT32 homelab_state::screen_update_homelab2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for(y = 0; y < 25; y++ ) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 40; x++) + { + chr = m_p_videoram[x]; // get char in videoram + gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=40; + } + return 0; +} + +UINT32 homelab_state::screen_update_homelab3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for(y = 0; y < 32; y++ ) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x++) + { + chr = m_p_videoram[x]; // get char in videoram + gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout homelab_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0, 1*256*8, 2*256*8, 3*256*8, 4*256*8, 5*256*8, 6*256*8, 7*256*8 }, + 8 /* every char takes 8 x 1 bytes */ +}; + +static GFXDECODE_START( homelab ) + GFXDECODE_ENTRY( "chargen", 0x0000, homelab_charlayout, 0, 1 ) +GFXDECODE_END + +QUICKLOAD_LOAD_MEMBER( homelab_state,homelab) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int i=0; + UINT8 ch; + UINT16 quick_addr; + UINT16 quick_length; + UINT16 quick_end; + dynamic_buffer quick_data; + char pgmname[256]; + UINT16 args[2]; + int read_; + + quick_length = image.length(); + quick_data.resize(quick_length); + + read_ = image.fread( &quick_data[0], quick_length); + if (read_ != quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.message(" Cannot read the file"); + return IMAGE_INIT_FAIL; + } + + image.fseek(0x100, SEEK_SET); + ch = image.fgetc(); + if (ch != 0xA5) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.message(" Invalid header"); + return IMAGE_INIT_FAIL; + } + + while((ch = image.fgetc())) + { + if (i >= (ARRAY_LENGTH(pgmname) - 1)) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long"); + image.message(" File name too long"); + return IMAGE_INIT_FAIL; + } + + pgmname[i] = ch; /* build program name */ + i++; + } + + pgmname[i] = '\0'; /* terminate string with a null */ + + if (image.fread(args, sizeof(args)) != sizeof(args)) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size"); + image.message(" Unexpected EOF while getting file size"); + return IMAGE_INIT_FAIL; + } + + quick_addr = LITTLE_ENDIANIZE_INT16(args[0]); + quick_length = LITTLE_ENDIANIZE_INT16(args[1]); + quick_end = quick_addr+quick_length-1; + + if (quick_end > 0x7fff) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too large"); + image.message(" File too large"); + return IMAGE_INIT_FAIL; + } + + /* display a message about the loaded quickload */ + image.message(" %s\nsize=%04X : start=%04X : end=%04X",pgmname,quick_length,quick_addr,quick_end); + + for (i = 0; i < quick_length; i++) + { + int j = (quick_addr + i); + if (image.fread(&ch, 1) != 1) + { + char message[256]; + snprintf(message, ARRAY_LENGTH(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); + image.seterror(IMAGE_ERROR_INVALIDIMAGE, message); + image.message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); + return IMAGE_INIT_FAIL; + } + space.write_byte(j, ch); + } + + return IMAGE_INIT_PASS; +} + +/* Machine driver */ +static MACHINE_CONFIG_START( homelab, homelab_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz / 2) + MCFG_CPU_PROGRAM_MAP(homelab2_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", homelab_state, homelab_frame) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(40*8, 25*8) + MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 25*8-1) + MCFG_VIDEO_START_OVERRIDE(homelab_state,homelab2) + MCFG_SCREEN_UPDATE_DRIVER(homelab_state, screen_update_homelab2) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", homelab) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_QUICKLOAD_ADD("quickload", homelab_state, homelab, "htp", 2) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( homelab3, homelab_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 4) + MCFG_CPU_PROGRAM_MAP(homelab3_mem) + MCFG_CPU_IO_MAP(homelab3_io) + MCFG_MACHINE_RESET_OVERRIDE(homelab_state,homelab3) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) + MCFG_VIDEO_START_OVERRIDE(homelab_state,homelab3) + MCFG_SCREEN_UPDATE_DRIVER(homelab_state, screen_update_homelab3) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", homelab) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_QUICKLOAD_ADD("quickload", homelab_state, homelab, "htp", 2) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( brailab4, homelab_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 4) + MCFG_CPU_PROGRAM_MAP(brailab4_mem) + MCFG_CPU_IO_MAP(brailab4_io) + MCFG_MACHINE_RESET_OVERRIDE(homelab_state,brailab4) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) + MCFG_VIDEO_START_OVERRIDE(homelab_state,brailab4) + MCFG_SCREEN_UPDATE_DRIVER(homelab_state, screen_update_homelab3) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", homelab) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD ( "speech", DAC, 0 ) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_DEVICE_ADD("mea8000", MEA8000, 0) + MCFG_MEA8000_DAC("speech") + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_QUICKLOAD_ADD("quickload", homelab_state, homelab, "htp", 18) +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER(homelab_state,brailab4) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("bank1")->configure_entries(0, 2, &RAM[0xf800], 0x8000); +} + +/* ROM definition */ + +ROM_START( homelab2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hl2_1.rom", 0x0000, 0x0800, BAD_DUMP CRC(205365f7) SHA1(da93b65befd83513dc762663b234227ba804124d)) + ROM_LOAD( "hl2_2.rom", 0x0800, 0x0800, CRC(696af3c1) SHA1(b53bc6ae2b75975618fc90e7181fa5d21409fce1)) + ROM_LOAD( "hl2_3.rom", 0x1000, 0x0800, CRC(69e57e8c) SHA1(e98510abb715dbf513e1b29fb6b09ab54e9483b7)) + ROM_LOAD( "hl2_4.rom", 0x1800, 0x0800, CRC(97cbbe74) SHA1(34f0bad41302b059322018abc3d1c2336ecfbea8)) + ROM_LOAD( "hl2_m.rom", 0x2000, 0x0800, CRC(10040235) SHA1(e121dfb97cc8ea99193a9396a9f7af08585e0ff0) ) + ROM_FILL(0x46, 1, 0x18) // fix bad code + ROM_FILL(0x47, 1, 0x0E) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "hl2.chr", 0x0000, 0x0800, CRC(2e669d40) SHA1(639dd82ed29985dc69830aca3b904b6acc8fe54a)) + // found on net, looks like bad dump + //ROM_LOAD_OPTIONAL( "hl2_ch.rom", 0x0800, 0x1000, CRC(6a5c915a) SHA1(7e4e966358556c6aabae992f4c2b292b6aab59bd) ) +ROM_END + +ROM_START( homelab3 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hl3_1.rom", 0x0000, 0x1000, CRC(6b90a8ea) SHA1(8ac40ca889b8c26cdf74ca309fbafd70dcfdfbec)) + ROM_LOAD( "hl3_2.rom", 0x1000, 0x1000, CRC(bcac3c24) SHA1(aff371d17f61cb60c464998e092f04d5d85c4d52)) + ROM_LOAD( "hl3_3.rom", 0x2000, 0x1000, CRC(ab1b4ab0) SHA1(ad74c7793f5dc22061a88ef31d3407267ad08719)) + ROM_LOAD( "hl3_4.rom", 0x3000, 0x1000, CRC(bf67eff9) SHA1(2ef5d46f359616e7d0e5a124df528de44f0e850b)) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "hl3.chr", 0x0000, 0x0800, CRC(f58ee39b) SHA1(49399c42d60a11b218a225856da86a9f3975a78a)) +ROM_END + +ROM_START( homelab4 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hl4_1.rom", 0x0000, 0x1000, CRC(a549b2d4) SHA1(90fc5595da8431616aee56eb5143b9f04281e798)) + ROM_LOAD( "hl4_2.rom", 0x1000, 0x1000, CRC(151d33e8) SHA1(d32004bc1553f802b9d3266709552f7d5315fe44)) + ROM_LOAD( "hl4_3.rom", 0x2000, 0x1000, CRC(39571ab1) SHA1(8470cff2e3442101e6a0bc655358b3a6fc1ef944)) + ROM_LOAD( "hl4_4.rom", 0x3000, 0x1000, CRC(f4b77ca2) SHA1(ffbdb3c1819c7357e2a0fc6317c111a8a7ecfcd5)) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "hl4.chr", 0x0000, 0x0800, CRC(f58ee39b) SHA1(49399c42d60a11b218a225856da86a9f3975a78a)) +ROM_END + +ROM_START( brailab4 ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "brl1.rom", 0x0000, 0x1000, CRC(02323403) SHA1(3a2e853e0a39e05a04a8db58e1a76de1eda579c9)) + ROM_LOAD( "brl2.rom", 0x1000, 0x1000, CRC(36173fbc) SHA1(1c01398e16a1cbe4103e1be769347ceae873e090)) + ROM_LOAD( "brl3.rom", 0x2000, 0x1000, CRC(d3cdd108) SHA1(1a24e6c5f9c370ff6cb25045cb9d95e664467eb5)) + ROM_LOAD( "brl4.rom", 0x3000, 0x1000, CRC(d4047885) SHA1(00fe40c4c2c64a49bb429fb2b27cc7e0d0025a85)) + ROM_LOAD( "brl5.rom", 0xd000, 0x1000, CRC(8a76be04) SHA1(4b683b9be23b47117901fe874072eb7aa481e4ff)) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "hl4.chr", 0x0000, 0x0800, CRC(f58ee39b) SHA1(49399c42d60a11b218a225856da86a9f3975a78a)) + + // these roms were found on the net, to be investigated + ROM_REGION( 0x5020, "user1", 0 ) + // brl1 to 5 merged, with small changes + // 00BF: 28 18 87 -> 30 30 0c + // 0138: 07 0a 06 0b -> 0c 06 07 0a (keyboard assignments) + ROM_LOAD_OPTIONAL( "brl.rom", 0x0000, 0x5000, CRC(54af5d30) SHA1(d1e7b7f5866acba0503d47f610456f396526240b) ) + // a small prom + ROM_LOAD_OPTIONAL( "brlcpm.rom", 0x5000, 0x0020, CRC(b936d568) SHA1(150330eccbc4b664eba4103f051d6e932038e9e8) ) +ROM_END + +ROM_START( braiplus ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "brailabplus.bin", 0x0000, 0x4000, CRC(521d6952) SHA1(f7405520d86fc7abd2dec51d1d016658472f6fe8) ) + + ROM_REGION(0x0800, "chargen",0) // no idea what chargen it uses + ROM_LOAD( "hl4.chr", 0x0000, 0x0800, CRC(f58ee39b) SHA1(49399c42d60a11b218a225856da86a9f3975a78a)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, homelab2, 0, 0, homelab, homelab, driver_device, 0, "Jozsef and Endre Lukacs", "Homelab 2 / Aircomp 16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP( 1983, homelab3, homelab2, 0, homelab3, homelab3, driver_device, 0, "Jozsef and Endre Lukacs", "Homelab 3", MACHINE_NOT_WORKING ) +COMP( 1984, homelab4, homelab2, 0, homelab3, homelab3, driver_device, 0, "Jozsef and Endre Lukacs", "Homelab 4", MACHINE_NOT_WORKING ) +COMP( 1984, brailab4, homelab2, 0, brailab4, brailab4, homelab_state, brailab4, "Jozsef and Endre Lukacs", "Brailab 4", MACHINE_NOT_WORKING ) +COMP( 1988, braiplus, homelab2, 0, brailab4, brailab4, homelab_state, brailab4, "Jozsef and Endre Lukacs", "Brailab Plus", MACHINE_NOT_WORKING | MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/homez80.c b/src/mame/drivers/homez80.c new file mode 100644 index 00000000000..3d403ba51d7 --- /dev/null +++ b/src/mame/drivers/homez80.c @@ -0,0 +1,315 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Homebrew Z80 Computer by Kun-Szabo Marton + + http://digitarworld.uw.hu/z80.htm + + 31/10/2010 Initial driver by Miodrag Milanovic + + All commands must be entered in uppercase, and since the capslock + doesn't work, you need to hold the shift key down. + + There is next to no error checking, for example the T command + is to set the time. Entering T by itself will set the time to + 99:99:99, while G will cause a jump to 9999 and so forth. Also + the parameter must be right next to the command, spaces will cause + invalid input. Example M1234 will display a byte of memory at 1234, + while M 1234 will display memory at 9123. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + + +class homez80_state : public driver_device +{ +public: + homez80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + , + m_p_videoram(*this, "p_videoram"){ } + + required_device m_maincpu; + DECLARE_READ8_MEMBER( homez80_keyboard_r ); + required_shared_ptr m_p_videoram; + UINT8* m_p_chargen; + bool m_irq; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(homez80_interrupt); +}; + + +READ8_MEMBER( homez80_state::homez80_keyboard_r ) +{ + char kbdrow[8]; + sprintf(kbdrow,"LINE%d",offset); + return ioport(kbdrow)->read(); +} + +static ADDRESS_MAP_START(homez80_mem, AS_PROGRAM, 8, homez80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_ROM // Monitor + AM_RANGE( 0x2000, 0x23ff ) AM_RAM AM_SHARE("p_videoram") // Video RAM + AM_RANGE( 0x7020, 0x702f ) AM_READ(homez80_keyboard_r) + AM_RANGE( 0x8000, 0xffff ) AM_RAM // 32 K RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( homez80_io, AS_IO, 8, homez80_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( homez80 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SCRLOCK) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PAUSE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE10") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) + PORT_START("LINE11") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) + PORT_START("LINE12") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) + PORT_START("LINE13") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) + PORT_START("LINE14") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) + PORT_START("LINE15") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +void homez80_state::machine_reset() +{ + m_irq = 0; +} + +void homez80_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 homez80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 32; y++) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++, 44); + + for (x = ma; x < ma+32; x++) + { + chr = m_p_videoram[x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[ (chr<<3) | ra]; + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=32; + } + return 0; +} + + +const gfx_layout homez80_charlayout = +{ + 8, 8, /* 8x8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {0, 1, 2, 3, 4, 5, 6, 7}, + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, + 8*8 /* size of one char */ +}; + +static GFXDECODE_START( homez80 ) + GFXDECODE_ENTRY( "chargen", 0x0000, homez80_charlayout, 0, 1 ) +GFXDECODE_END + + +INTERRUPT_GEN_MEMBER(homez80_state::homez80_interrupt) +{ + device.execute().set_input_line(0, (m_irq) ? HOLD_LINE : CLEAR_LINE); + m_irq ^= 1; +} + +static MACHINE_CONFIG_START( homez80, homez80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz / 2) + MCFG_CPU_PROGRAM_MAP(homez80_mem) + MCFG_CPU_IO_MAP(homez80_io) + MCFG_CPU_PERIODIC_INT_DRIVER(homez80_state, homez80_interrupt, 50) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(homez80_state, screen_update) + MCFG_SCREEN_SIZE(344, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 344-1, 0, 32*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", homez80 ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( homez80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "sysrom.bin", 0x0000, 0x1000, CRC(37ca7545) SHA1(3f597d7e45b1ab211d5bd4a99abb21915723c357) ) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "chargen.bin", 0x0000, 0x0800, CRC(93243be3) SHA1(718efc06c131843c15383e50af23f3a5cf44dd9b) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 2008, homez80, 0, 0, homez80, homez80, driver_device, 0, "Kun-Szabo Marton", "Homebrew Z80 Computer", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/horizon.c b/src/mame/drivers/horizon.c new file mode 100644 index 00000000000..a888a4a3e0a --- /dev/null +++ b/src/mame/drivers/horizon.c @@ -0,0 +1,221 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + NorthStar Horizon + + 07/12/2009 Skeleton driver. + + It appears these machines say nothing until a floppy disk is + succesfully loaded. The memory range EA00-EB40 appears to be + used by devices, particularly the FDC. + + http://www.hartetechnologies.com/manuals/Northstar/ + +****************************************************************************/ + +/* + + TODO: + + - connect to S-100 bus + - USARTs + - parallel I/O + - motherboard ports + - RTC + - RAM boards + - floppy boards + - floating point board + - SOROC IQ 120 CRT terminal + - NEC 5530-2 SPINWRITER printer + - Anadex DP-8000 printer + +*/ + +#include "bus/rs232/rs232.h" +#include "bus/s100/s100.h" +#include "cpu/z80/z80.h" +#include "machine/i8251.h" + +#define Z80_TAG "z80" +#define I8251_L_TAG "3a" +#define I8251_R_TAG "4a" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" + +class horizon_state : public driver_device +{ +public: + horizon_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_usart_l(*this, I8251_L_TAG), + m_usart_r(*this, I8251_L_TAG) + { } + + required_device m_maincpu; + required_device m_usart_l; + required_device m_usart_r; +}; + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( horizon_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( horizon_mem, AS_PROGRAM, 8, horizon_state ) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( horizon_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( horizon_io, AS_IO, 8, horizon_state ) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( sage2 ) +//------------------------------------------------- + +static INPUT_PORTS_START( horizon ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + + +//------------------------------------------------- +// S100_INTERFACE( s100_intf ) +//------------------------------------------------- + +// slot devices +//#include "bus/s100/dj2db.h" +//#include "bus/s100/djdma.h" +//#include "bus/s100/mm65k16s.h" +#include "bus/s100/nsmdsa.h" +#include "bus/s100/nsmdsad.h" +//#include "bus/s100/wunderbus.h" + +static SLOT_INTERFACE_START( horizon_s100_cards ) + SLOT_INTERFACE("mdsa", S100_MDS_A) + SLOT_INTERFACE("mdsad", S100_MDS_AD) + //SLOT_INTERFACE("hram", S100_HRAM) + //SLOT_INTERFACE("ram32a", S100_RAM32A) + //SLOT_INTERFACE("ram16a", S100_RAM16A) + //SLOT_INTERFACE("fpb", S100_FPB) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( horizon ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( horizon, horizon_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(horizon_mem) + MCFG_CPU_IO_MAP(horizon_io) + + // devices + MCFG_DEVICE_ADD(I8251_L_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_L_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_L_TAG, i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_DEVICE_ADD(I8251_R_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_R_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_R_TAG, i8251_device, write_dsr)) + + // S-100 + MCFG_S100_BUS_ADD() + MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + //MCFG_S100_SLOT_ADD("s100_1", horizon_s100_cards, NULL, NULL) // CPU + MCFG_S100_SLOT_ADD("s100_2", horizon_s100_cards, NULL) // RAM + MCFG_S100_SLOT_ADD("s100_3", horizon_s100_cards, "mdsad") // MDS + MCFG_S100_SLOT_ADD("s100_4", horizon_s100_cards, NULL) // FPB + MCFG_S100_SLOT_ADD("s100_5", horizon_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_6", horizon_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_7", horizon_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_8", horizon_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_9", horizon_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_10", horizon_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_11", horizon_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_12", horizon_s100_cards, NULL) + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "horizon") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( nshrz ) +//------------------------------------------------- + +ROM_START( nshrz ) + ROM_REGION( 0x400, Z80_TAG, 0 ) + ROM_LOAD( "option.prom", 0x000, 0x400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( vector1 ) +//------------------------------------------------- + +ROM_START( vector1 ) // This one have different I/O + ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF ) + ROM_LOAD( "horizon.bin", 0xe800, 0x0100, CRC(7aafa134) SHA1(bf1552c4818f30473798af4f54e65e1957e0db48)) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1976, nshrz, 0, 0, horizon, horizon, driver_device, 0, "North Star Computers", "Horizon (North Star Computers)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP( 1979, vector1, nshrz, 0, horizon, horizon, driver_device, 0, "Vector Graphic", "Vector 1+ (DD drive)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/hp16500.c b/src/mame/drivers/hp16500.c new file mode 100644 index 00000000000..b847da0c19b --- /dev/null +++ b/src/mame/drivers/hp16500.c @@ -0,0 +1,507 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + Hewlett-Packard HP16500a/b/c Logic Analyzer + + These are weird, the "a" has more in common with the older 1650/1651 + than the 16500b. + + 16500a rev 00.00: + MC68000 @ 10 MHz + MC68A45 CRTC + FDC9793 floppy controller (WD1793 type) + TMS9914A GPIB bus interface + SCN2661 DUART/timer + + IRQ1 = VBL, IRQ2 = 20b007, IRQ3 = ?, IRQ4 = 20d000, IRQ5 = 20d007, + IRQ6 = ?, IRQ7 = ? + + 16500a rev 00.02: + MC68000 @ 10 MHz + MC68A45 CRTC + Z0765A08PSC floppy controller (NEC765 type) + TMS9914A GPIB bus interface + SCN2661 DUART/timer + + 16500b: + MC68EC030 @ 25 MHz + + WD37C65C floppy controller (NEC765 type) + Bt475 video RAMDAC + TMS9914A GPIB bus interface + Dallas DS1286 RTC/CMOS RAM + + IRQ 1 = VBL + IRQ 2 = 35b8 + IRQ 3 = 35ce (jump 840120) + IRQ 4 = 17768 + IRQ 5 = 814a + IRQ 6 = 35c8 (jump 840120) + IRQ 7 = 35d4 (jump 840120) + + 16500c: + Same as 16500b, but add: + 53C720 SCSI controller + DP83934 SONIC ethernet + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "video/mc6845.h" +#include "machine/mc68681.h" + +#define MAINCPU_TAG "maincpu" +#define CRTC_TAG "crtc" +#define SCREEN_TAG "screen" +#define DUART_TAG "duart" + +class hp16500_state : public driver_device +{ +public: + hp16500_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, MAINCPU_TAG) + { } + + virtual void video_start(); + UINT32 screen_update_hp16500(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_hp16500a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + required_device m_maincpu; + std::vector m_vram; + + UINT8 m_mask, m_val; + + DECLARE_WRITE32_MEMBER(palette_w); + + DECLARE_WRITE16_MEMBER(vram_w); + DECLARE_READ8_MEMBER (vram_r); + DECLARE_WRITE8_MEMBER (mask_w); + DECLARE_WRITE8_MEMBER (val_w); + DECLARE_READ32_MEMBER(vbl_state_r); + DECLARE_WRITE32_MEMBER(vbl_ack_w); + DECLARE_READ16_MEMBER(vbl_ack16_r); + DECLARE_WRITE16_MEMBER(vbl_ack16_w); + + DECLARE_WRITE8_MEMBER(pal_ctrl_w); + DECLARE_WRITE8_MEMBER(pal_r_w); + DECLARE_WRITE8_MEMBER(pal_g_w); + DECLARE_WRITE8_MEMBER(pal_b_w); + + DECLARE_WRITE16_MEMBER(maskval_w); + + DECLARE_WRITE_LINE_MEMBER(vsync_changed); + MC6845_UPDATE_ROW(crtc_update_row); + MC6845_UPDATE_ROW(crtc_update_row_1650); + + INTERRUPT_GEN_MEMBER(vblank); + +private: + UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs; +}; + +READ32_MEMBER(hp16500_state::vbl_state_r) +{ + return 0x03000000; // bit 0 set means the interrupt handler advances the pSOS tick counter. +} + +WRITE32_MEMBER(hp16500_state::vbl_ack_w) +{ + m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); +} + +READ16_MEMBER(hp16500_state::vbl_ack16_r) +{ + m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); + return 0; +} + +WRITE16_MEMBER(hp16500_state::vbl_ack16_w) +{ + m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); +} + +WRITE_LINE_MEMBER( hp16500_state::vsync_changed ) +{ + if (state) + { + m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); + } +} + +MC6845_UPDATE_ROW( hp16500_state::crtc_update_row ) +{ + UINT32 *p = &bitmap.pix32(y); + int i, pos; + + pos = y * 144; + + for (i = 0; i < x_count; i++) + { + *p++ = m_palette[m_vram[pos+0x00000]]; + *p++ = m_palette[m_vram[pos+0x10000]]; + *p++ = m_palette[m_vram[pos+0x20000]]; + *p++ = m_palette[m_vram[pos+0x30000]]; + pos++; + *p++ = m_palette[m_vram[pos+0x00000]]; + *p++ = m_palette[m_vram[pos+0x10000]]; + *p++ = m_palette[m_vram[pos+0x20000]]; + *p++ = m_palette[m_vram[pos+0x30000]]; + pos++; + } +} + +MC6845_UPDATE_ROW( hp16500_state::crtc_update_row_1650 ) +{ + UINT32 *p = &bitmap.pix32(y); + int i, pos; + + pos = y * 148; + + for (i = 0; i < x_count; i++) + { + *p++ = m_palette[m_vram[pos+0x00000]]; + *p++ = m_palette[m_vram[pos+0x10000]]; + *p++ = m_palette[m_vram[pos+0x20000]]; + *p++ = m_palette[m_vram[pos+0x30000]]; + pos++; + *p++ = m_palette[m_vram[pos+0x00000]]; + *p++ = m_palette[m_vram[pos+0x10000]]; + *p++ = m_palette[m_vram[pos+0x20000]]; + *p++ = m_palette[m_vram[pos+0x30000]]; + pos++; + } +} + +WRITE8_MEMBER(hp16500_state::pal_ctrl_w) +{ + m_clutoffs = data & 0xf; +} + + +WRITE8_MEMBER(hp16500_state::pal_r_w) +{ + m_colors[0] = (data<<4); + m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]); +} + +WRITE8_MEMBER(hp16500_state::pal_g_w) +{ + m_colors[1] = (data<<4); + m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]); +} + +WRITE8_MEMBER(hp16500_state::pal_b_w) +{ + m_colors[2] = (data<<4); + m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]); +} + +WRITE16_MEMBER(hp16500_state::maskval_w) +{ + // by analogy with the string printer code from the 16500b, which + // appears to be a direct port... + m_val = ((data>>8) & 0xff) ^ 0xff; + m_mask = (data & 0xff) ^ 0xff; +} + +static ADDRESS_MAP_START(hp1650_map, AS_PROGRAM, 16, hp16500_state) + AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_REGION("bios", 0) + + AM_RANGE(0x201000, 0x201001) AM_WRITE(maskval_w) + + AM_RANGE(0x204000, 0x204001) AM_WRITE8(pal_ctrl_w, 0x00ff) + AM_RANGE(0x205000, 0x205001) AM_WRITE8(pal_r_w, 0x00ff) + AM_RANGE(0x206000, 0x206001) AM_WRITE8(pal_g_w, 0x00ff) + AM_RANGE(0x207000, 0x207001) AM_WRITE8(pal_b_w, 0x00ff) + + AM_RANGE(0x20c000, 0x20c001) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, status_r, address_w, 0x00ff) + AM_RANGE(0x20c002, 0x20c003) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, register_r, register_w, 0x00ff) + + AM_RANGE(0x20e000, 0x20e001) AM_READWRITE(vbl_ack16_r, vbl_ack16_w) + + AM_RANGE(0x2050fe, 0x2050ff) AM_NOP + AM_RANGE(0x206000, 0x206001) AM_NOP + AM_RANGE(0x20f000, 0x20f001) AM_NOP + + AM_RANGE(0x600000, 0x61ffff) AM_WRITE(vram_w) + AM_RANGE(0x600000, 0x67ffff) AM_READ8(vram_r, 0x00ff) + + AM_RANGE(0x900000, 0x9fffff) AM_RAM +ADDRESS_MAP_END + +// like 1650 but moves main RAM to match 16500a +static ADDRESS_MAP_START(hp1651_map, AS_PROGRAM, 16, hp16500_state) + AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_REGION("bios", 0) + + AM_RANGE(0x201000, 0x201001) AM_WRITE(maskval_w) + + AM_RANGE(0x204000, 0x204001) AM_WRITE8(pal_ctrl_w, 0x00ff) + AM_RANGE(0x205000, 0x205001) AM_WRITE8(pal_r_w, 0x00ff) + AM_RANGE(0x206000, 0x206001) AM_WRITE8(pal_g_w, 0x00ff) + AM_RANGE(0x207000, 0x207001) AM_WRITE8(pal_b_w, 0x00ff) + + AM_RANGE(0x20c000, 0x20c001) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, status_r, address_w, 0x00ff) + AM_RANGE(0x20c002, 0x20c003) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, register_r, register_w, 0x00ff) + + AM_RANGE(0x20e000, 0x20e001) AM_READWRITE(vbl_ack16_r, vbl_ack16_w) + + AM_RANGE(0x2050fe, 0x2050ff) AM_NOP + AM_RANGE(0x206000, 0x206001) AM_NOP + AM_RANGE(0x20f000, 0x20f001) AM_NOP + + AM_RANGE(0x600000, 0x61ffff) AM_WRITE(vram_w) + AM_RANGE(0x600000, 0x67ffff) AM_READ8(vram_r, 0x00ff) + + AM_RANGE(0x980000, 0xa7ffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(hp16500a_map, AS_PROGRAM, 16, hp16500_state) + AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_REGION("bios", 0) + + AM_RANGE(0x201000, 0x201001) AM_WRITE(maskval_w) + + AM_RANGE(0x204000, 0x204001) AM_WRITE8(pal_ctrl_w, 0x00ff) + AM_RANGE(0x205000, 0x205001) AM_WRITE8(pal_r_w, 0x00ff) + AM_RANGE(0x206000, 0x206001) AM_WRITE8(pal_g_w, 0x00ff) + AM_RANGE(0x207000, 0x207001) AM_WRITE8(pal_b_w, 0x00ff) + + AM_RANGE(0x20c000, 0x20c001) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, status_r, address_w, 0x00ff) + AM_RANGE(0x20c002, 0x20c003) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, register_r, register_w, 0x00ff) + + AM_RANGE(0x20e000, 0x20e001) AM_READWRITE(vbl_ack16_r, vbl_ack16_w) + + AM_RANGE(0x600000, 0x61ffff) AM_WRITE(vram_w) + AM_RANGE(0x600000, 0x67ffff) AM_READ8(vram_r, 0x00ff) + + AM_RANGE(0x980000, 0xa7ffff) AM_RAM +ADDRESS_MAP_END + +UINT32 hp16500_state::screen_update_hp16500a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static ADDRESS_MAP_START(hp16500_map, AS_PROGRAM, 32, hp16500_state) + AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("bios", 0) + AM_RANGE(0x0020f000, 0x0020f003) AM_WRITE(palette_w) + + AM_RANGE(0x00202800, 0x00202803) AM_WRITE(vbl_ack_w) + AM_RANGE(0x00203000, 0x00203003) AM_WRITE(vbl_ack_w) + AM_RANGE(0x00209800, 0x00209803) AM_READ(vbl_state_r) + + AM_RANGE(0x0020b800, 0x0020b8ff) AM_RAM // system ram test is really strange. + + AM_RANGE(0x00600000, 0x0061ffff) AM_WRITE16(vram_w, 0xffffffff) + AM_RANGE(0x00600000, 0x0067ffff) AM_READ8 (vram_r, 0x00ff00ff) + AM_RANGE(0x00700000, 0x00700003) AM_WRITE8 (mask_w, 0xff000000) + AM_RANGE(0x00740000, 0x00740003) AM_WRITE8 (val_w, 0xff000000) + AM_RANGE(0x00800000, 0x009fffff) AM_RAM +ADDRESS_MAP_END + +INTERRUPT_GEN_MEMBER(hp16500_state::vblank) +{ + m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); +} + +void hp16500_state::video_start() +{ + m_count = 0; + m_clutoffs = 0; + memset(m_palette, 0, sizeof(m_palette)); + m_vram.resize(0x40000); + m_mask = 0; + m_val = 0; +} + +// The test code is buggy, it writes a byte in the wrong position +// (even instead of odd). It still works because the 68k replicates +// the byte on the word and the hardware doesn't decode UDS/LDS. But +// that is why the handler needs to be 16 bits, or it won't be called +// in the first place. + +WRITE16_MEMBER(hp16500_state::vram_w) +{ + if(!ACCESSING_BITS_0_7) + data = data | (data >> 8); + for(int i=0; i<4; i++) { + int off = offset + i * 0x10000; + if(data & (8 >> i)) + m_vram[off] = (m_vram[off] & ~m_mask) | (m_val & m_mask); + else + m_vram[off] = (m_vram[off] & ~m_mask); + } +} + +READ8_MEMBER (hp16500_state::vram_r) +{ + return m_vram[offset]; +} + +WRITE8_MEMBER(hp16500_state::mask_w) +{ + m_mask = data; +} + +WRITE8_MEMBER(hp16500_state::val_w) +{ + m_val = data; +} + +WRITE32_MEMBER(hp16500_state::palette_w) +{ + if (mem_mask == 0xff000000) + { + m_clutoffs = (data>>24) & 0xff; + } + else if (mem_mask == 0x00ff0000) + { + m_colors[m_count++] = (data>>14) & 0xfc; + + if (m_count == 3) + { + m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]); + m_clutoffs++; + if (m_clutoffs > 255) + { + m_clutoffs = 0; + } + m_count = 0; + } + } +} + +// 4 bpp +// addr = ((Y * 0xfc0) + 0x360) + (X * 4) +UINT32 hp16500_state::screen_update_hp16500(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int pos = 0; + for (int y = 0; y < 384; y++) + { + UINT32 *scanline = &bitmap.pix32(y); + + for (int x = 0; x < 576; x+=4) + { + *scanline++ = m_palette[m_vram[pos+0x00000]]; + *scanline++ = m_palette[m_vram[pos+0x10000]]; + *scanline++ = m_palette[m_vram[pos+0x20000]]; + *scanline++ = m_palette[m_vram[pos+0x30000]]; + pos++; + } + } + + return 0; +} + +static MACHINE_CONFIG_START( hp1650, hp16500_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68000, 10000000) + MCFG_CPU_PROGRAM_MAP(hp1650_map) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_RAW_PARAMS(25000000, 0x330, 0, 0x250, 0x198, 0, 0x180 ) + MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, mc6845_device, screen_update ) + + MCFG_MC6845_ADD(CRTC_TAG, MC6845, SCREEN_TAG, 25000000/9) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(hp16500_state, crtc_update_row_1650) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(hp16500_state, vsync_changed)) + + MCFG_DEVICE_ADD(DUART_TAG, MC68681, 20000000) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp1651, hp16500_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68000, 10000000) + MCFG_CPU_PROGRAM_MAP(hp1651_map) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_RAW_PARAMS(25000000, 0x330, 0, 0x250, 0x198, 0, 0x180 ) + MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, mc6845_device, screen_update ) + + MCFG_MC6845_ADD(CRTC_TAG, MC6845, SCREEN_TAG, 25000000/9) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(hp16500_state, crtc_update_row_1650) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(hp16500_state, vsync_changed)) + + MCFG_DEVICE_ADD(DUART_TAG, MC68681, 20000000) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp16500a, hp16500_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68000, 10000000) + MCFG_CPU_PROGRAM_MAP(hp16500a_map) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_RAW_PARAMS(25000000, 0x320, 0, 0x240, 0x19c, 0, 0x170 ) + MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, mc6845_device, screen_update ) + + MCFG_MC6845_ADD(CRTC_TAG, MC6845, SCREEN_TAG, 25000000/9) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(hp16500_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(hp16500_state, vsync_changed)) + + MCFG_DEVICE_ADD(DUART_TAG, MC68681, 20000000) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp16500, hp16500_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68EC030, 25000000) + MCFG_CPU_PROGRAM_MAP(hp16500_map) + MCFG_CPU_VBLANK_INT_DRIVER(SCREEN_TAG, hp16500_state, vblank) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp16500_state, screen_update_hp16500) + MCFG_SCREEN_SIZE(576,384) + MCFG_SCREEN_VISIBLE_AREA(0, 576-1, 0, 384-1) + MCFG_SCREEN_REFRESH_RATE(60) + + MCFG_DEVICE_ADD(DUART_TAG, MC68681, 20000000) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") +MACHINE_CONFIG_END + +static INPUT_PORTS_START( hp16500 ) +INPUT_PORTS_END + +ROM_START( hp1650b ) + ROM_REGION16_BE(0x20000, "bios", 0) + ROM_LOAD16_BYTE( "la1.bin", 0x000000, 0x008000, CRC(7c60e334) SHA1(c3661e4bb58e0951e9c13208b4991f5d9dda633b) ) + ROM_LOAD16_BYTE( "la2.bin", 0x000001, 0x008000, CRC(b0c6fe60) SHA1(a77b2e7098f26af93b0946abe6e89711b3332210) ) +ROM_END + +ROM_START( hp1651b ) + ROM_REGION16_BE(0x20000, "bios", 0) + ROM_LOAD16_BYTE( "u102.bin", 0x000000, 0x008000, CRC(d7e1b091) SHA1(af813cc7ae748aedf1b1d9d522ee2154961315c2) ) + ROM_LOAD16_BYTE( "u103.bin", 0x000001, 0x008000, CRC(f32a37c7) SHA1(8addda59923f64fd9b7e909eb0e3a17cc02bb70e) ) +ROM_END + +ROM_START( hp165ka0 ) + ROM_REGION16_BE(0x20000, "bios", 0) + ROM_LOAD16_BYTE( "16500-80002.bin", 0x000000, 0x008000, CRC(0324b75a) SHA1(837855fce9288139226c914cc0c43061e25b57d2) ) + ROM_LOAD16_BYTE( "16500-80001.bin", 0x000001, 0x008000, CRC(362c8cbf) SHA1(812b79d1a31d09ec632a6842b11548168d82b5e7) ) +ROM_END + +ROM_START( hp16500b ) + ROM_REGION32_BE(0x20000, "bios", 0) + ROM_LOAD32_BYTE( "16500-80014.bin", 0x000000, 0x008000, CRC(35187716) SHA1(82067737892ecd356a5454a43d9ce9b38ac2397f) ) + ROM_LOAD32_BYTE( "16500-80015.bin", 0x000001, 0x008000, CRC(d8d26c1c) SHA1(b5b956c17c9d6e54519a686b5e4aa733b266bf6f) ) + ROM_LOAD32_BYTE( "16500-80016.bin", 0x000002, 0x008000, CRC(61457b39) SHA1(f209315ec22a8ee9d44a0ec009b1afb47794bece) ) + ROM_LOAD32_BYTE( "16500-80017.bin", 0x000003, 0x008000, CRC(e0b1096b) SHA1(426bb9a4756d8087bded4f6b61365d733ffbb09a) ) +ROM_END + +COMP( 1989, hp1650b, 0, 0, hp1650, hp16500, driver_device, 0, "Hewlett Packard", "HP 1650b", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +COMP( 1989, hp1651b, 0, 0, hp1651, hp16500, driver_device, 0, "Hewlett Packard", "HP 1651b", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +COMP( 1991, hp165ka0, 0, 0, hp16500a, hp16500, driver_device, 0, "Hewlett Packard", "HP 16500a", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) +COMP( 1991, hp16500b, 0, 0, hp16500, hp16500, driver_device, 0, "Hewlett Packard", "HP 16500b", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mame/drivers/hp48.c b/src/mame/drivers/hp48.c new file mode 100644 index 00000000000..2b9e31dfcdc --- /dev/null +++ b/src/mame/drivers/hp48.c @@ -0,0 +1,1373 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2008 + + Hewlett Packard HP48 S/SX & G/GX/G+ and HP49 G + +**********************************************************************/ + +#include "emu.h" +#include "cpu/saturn/saturn.h" +#include "sound/dac.h" +#include "machine/nvram.h" + +#include "includes/hp48.h" + +/* TODO: + - IR I/O port + - HP48 to HP48 serial connection + - set card size when creating a new card image + - some bits I/O RAM not implemented + - printer + - more accurate timing (accurate SATURN cycles, speedup when screen is off) + - save-state: figure what RAM to store & where (currently, when exiting, + base RAM is saved as nvram, RAM in expansion ports is saved as image, + IO RAM is & CPU state are discarded; save-state saves base & IO RAM, + CPU state, but not expansion port RAM) + - more accurate IRQ, NMI, sleep and wake-up handling + - HP49 G flash ROM write + - HP49 xmodem +*/ + + +/* + HP48: graphical calculators by Hewlett Packard. + + Two main series: S series & G series. + Each series is subdivised into an 'expandable' model (SX,GX) and a + cheaper 'non-expandable' model (S,G). + + Timeline: + - 1990-03-06 HP48SX (discontinued in ????) + - 1991-04-02 HP48S (discontinued in 1993) + - 1993-06-01 HP48G (discontinued in 1999) + HP48GX (discontinued in 2003) + - 1998-03-30 HP48G+ (discontinued in 2003) + + Common characteristics: + - HP family name: Charlemagne + - CPU: Saturn, 4-bit processor, chip version: 1LT8 + - BUS: + . 20-bit address bus + . nibble (4-bit) addressable + => 512 KB address space (i.e., 1 Mnibbles) + . daisy-chained modules + - Screen: 131x64 LCD, 2-color, 64 Hz refresh + - Keyboard: 49 keys + - IR I/O port + - 4-wire serial I/O port + - 1-bit beeper + - Power-source: 3 AAA cells + - Continuous memory + + + S series specific: + - Clarke IC + - clock speed: 2 MHz + - 256 KB ROM (various revisions, identical in S and SX) + + - S model specific: + + Codename: Shorty + + 32 KB RAM base, not expandable (in theory) + + no expansion port + + - SX model specific: + + Codename: Charlemagne + + 32 KB base RAM, expandable to 288 KB + + 2 expansion ports (port 1 and port 2) + up to 128 KB RAM per port, can be merged with base RAM + + G series specific: + - Yorke IC + - clock speed: ~4 MHz + - 512 KB ROM (various revisions, identical in G and GX) + + - G model specific: + + Codename: Alcuin + + 32 KB RAM, not expandable (in theory!) + + no expansion port + + - GX model specific: + + Codename: Hammer + + 128 KB base RAM, expandable up to 4 MB (banked) + + 2 expansion ports + . port 1: up to 128 KB RAM, can be merged with base RAM + . port 2: up to 4 MB RAM, in 32 banks of 128 KB, cannot be merged + + - G+ model specific: + + Codename: Plus + + 128 KB RAM, not expandable + + no expansion port + + + + HP49 G: + similar to HP48 G with the following differences: + - 2048 KB flash ROM (re-writtable) + - 512 KB RAM (not expandable) + - Keyboard: 51 keys + - no IR I/O port + - rewritten optimized OS makes the HP49 G much faster than HP48 despite + having the same CPU and clock rate (4 MHz York Saturn) + +*/ + + +/* + More about memory. + + The base RAM is treated as NVRAM: stored in a .nv file in your nvram + directory. + When first starting the emulator, or after nvram file has been deleted, + you'll get a "Try to recover memory?". This is expected. + Answer NO (F key): there is nothing to recover, but it will setup the + system-reserved RAM part correctly. + If the emulator is shut down properly (i.e., when the calculator is + not busy), the message should not appear next time it is run. + All the variables and port 0 should be conserved (in the .nv file), + but not the stack. + Stopping and restarting the emulator loosely corresponds to hitting the + reset button. + + Expansion RAMs are treated as images, not NVRAM. + The -p1 (resp. -p2) image option allows mapping some file to port 1 + (resp. port 2). + The file size should be between 32 KB and 128 KB (or 4 GB for port 2 on GX) + and be a power of two. +*/ + + +/* + More about serial connection. + + Normally, files are exchanged by serial connection to a computer running a + kermit communication program (xmodem is also allowed for the G/GX). + We emulate both the serial link and the communication program. + Thus, the emulated HP48 can directly upload/download image files. + The -k image option corresponds to the kermit protocol (SEND and RECV + commands on the HP48). + The -x image option corresponds to the xmodem protocol (XSEND and XRECV + commands on the HP48). +*/ + + + +/* + + References: + + - Voyage au centre de la HP48 S/SX, by Paul Courbis & S?bastien Lalande + (English version: HP48 machine language - a journey to the center + of the HP48 s/sx) + available at http://www.courbis.com + + - Voyage au centre de la HP48 G/GX, by Paul Courbis + available at http://www.courbis.com + + - Guide to the Saturn Processor (With HP48 Applications) + by Matthew Mastracci + + - Introduction to Saturn Assembly Language + by Gilbert Fernandes + + - http://www.hpcalc.org/ + +*/ + + + + +/**************************** inputs *******************************/ + +/* KEYBOARD + -------- + + keyboard layout for 48 models + + ------------------------------------------------- + | A | B | C | D | E | F | + |-------+-------+-------+-------+-------+-------| + | MTH | PRG | CST | VAR | up | NXT | + |-------+-------+-------+-------+-------+-------| + | ' | STO | EVAL | left | down | right | + |-------+-------+-------+-------+-------+-------| + | SIN | COS | TAN | sqrt | y^x | 1/x | + |---------------+-------+-------+-------+-------| + | ENTER | +/- | EEX | DEL | <= | + |-----------------------------------------------| + | alpha | 7 | 8 | 9 | / | + |---------+--------+--------+---------+---------| + | red | 4 | 5 | 6 | * | + |---------+--------+--------+---------+---------| + | green | 1 | 2 | 3 | - | + |---------+--------+--------+---------+---------| + | ON | 0 | . | SPC | + | + ------------------------------------------------- + + * 49 keys + * including 3 modifier keys: + - a blue/green shift (upper right) + - an orange/red shift (upper left) + - a white alpha key (lower right) + + Difference between G and S series: a few red and blue shifted keys. + +*/ + +/* S/SX */ +static INPUT_PORTS_START( hp48sx_kbd ) + + PORT_START( "LINE0" ) /* OUT = 0x001 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "+ { } : :" ) + PORT_CODE ( KEYCODE_EQUALS ) + PORT_CODE ( KEYCODE_PLUS_PAD ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "SPC \xCF\x80 \xE2\x88\xA1" /* pi, angle */ ) + PORT_CODE ( KEYCODE_SPACE ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( ". , \xE2\x86\xb5" /* return arrow */ ) + PORT_CODE ( KEYCODE_STOP ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "0 = \xE2\x86\x92" /* right arrow */ ) + PORT_CODE ( KEYCODE_0 ) + PORT_CODE ( KEYCODE_0_PAD ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "' M UP HOME" ) + PORT_CODE ( KEYCODE_QUOTE ) + PORT_CODE ( KEYCODE_M ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE1" ) /* OUT = 0x002 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "- << >> \" \"" ) + PORT_CODE ( KEYCODE_MINUS ) + PORT_CODE ( KEYCODE_MINUS_PAD ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "3 CMD MENU" ) + PORT_CODE ( KEYCODE_3 ) + PORT_CODE ( KEYCODE_3_PAD ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "2 STACK ARG" ) + PORT_CODE ( KEYCODE_2 ) + PORT_CODE ( KEYCODE_2_PAD ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "1 RAD POLAR" ) + PORT_CODE ( KEYCODE_1 ) + PORT_CODE ( KEYCODE_1_PAD ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "A" ) + PORT_CODE ( KEYCODE_A ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "right shift" ) + PORT_CODE ( KEYCODE_RSHIFT ) + + PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) + + + PORT_START( "LINE2" ) /* OUT = 0x004 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "* [ ] _" ) + PORT_CODE ( KEYCODE_ASTERISK ) + PORT_CODE ( KEYCODE_CLOSEBRACE ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "6 UNITS" ) + PORT_CODE ( KEYCODE_6_PAD ) + PORT_CODE ( KEYCODE_6 ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "5 STAT" ) + PORT_CODE ( KEYCODE_5_PAD ) + PORT_CODE ( KEYCODE_5 ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "4 TIME" ) + PORT_CODE ( KEYCODE_4_PAD ) + PORT_CODE ( KEYCODE_4 ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "MTH G PRINT") + PORT_CODE ( KEYCODE_G ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "left shift" ) + PORT_CODE ( KEYCODE_LSHIFT ) + + PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) + + + PORT_START( "LINE3" ) /* OUT = 0x008 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "/ ( ) #" ) + PORT_CODE ( KEYCODE_SLASH ) + PORT_CODE ( KEYCODE_SLASH_PAD ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "9 ALGEBRA" ) + PORT_CODE ( KEYCODE_9_PAD ) + PORT_CODE ( KEYCODE_9 ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "8 PLOT" ) + PORT_CODE ( KEYCODE_8_PAD ) + PORT_CODE ( KEYCODE_8 ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "7 SOLVE" ) + PORT_CODE ( KEYCODE_7_PAD ) + PORT_CODE ( KEYCODE_7 ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "SIN S ASIN \xE2\x88\x82" /* delta */ ) + PORT_CODE ( KEYCODE_S ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xCE\xB1 USER ENTRY" /* alpha */ ) + PORT_CODE ( KEYCODE_LALT ) + + PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) + + + PORT_START( "LINE4" ) /* OUT = 0x010 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME (" \xE2\x87\x90 DROP CLR" /* double left arrow */ ) + PORT_CODE ( KEYCODE_BACKSPACE ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "DEL PURGE" ) + PORT_CODE ( KEYCODE_DEL ) + PORT_CODE ( KEYCODE_DEL_PAD ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "EEX Z 2D 3D" ) + PORT_CODE ( KEYCODE_Z ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "+/- Y EDIT VISIT" ) + PORT_CODE ( KEYCODE_Y ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "ENTER EQUATION MATRIX") + PORT_CODE ( KEYCODE_ENTER ) + PORT_CODE ( KEYCODE_ENTER_PAD ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE5" ) /* OUT = 0x020 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "1/x X e^x LN" ) + PORT_CODE ( KEYCODE_X ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "y^x W 10^x LOG" ) + PORT_CODE ( KEYCODE_W ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x88\x9A V x^2 sqrt(x,y)" /* square root */ ) + PORT_CODE ( KEYCODE_V ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "TAN U ATAN \xE2\x88\x91" /* sum */ ) + PORT_CODE ( KEYCODE_U ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "COS T ACOS \xE2\x88\xAB" /* integral */ ) + PORT_CODE ( KEYCODE_T ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE6" ) /* OUT = 0x040 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x92 R SWAP" /* right arrow */ ) + PORT_CODE ( KEYCODE_RIGHT ) + PORT_CODE ( KEYCODE_R ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x93 Q REVIEW" /* down arrow */ ) + PORT_CODE ( KEYCODE_DOWN ) + PORT_CODE ( KEYCODE_Q) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x90 P GRAPH" /* left arrow */ ) + PORT_CODE ( KEYCODE_LEFT ) + PORT_CODE ( KEYCODE_P ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "EVAL O \xE2\x86\x92NUM UNDO" ) + PORT_CODE ( KEYCODE_O ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "STO N DEF RCL" ) + PORT_CODE ( KEYCODE_N ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE7" ) /* OUT = 0x080 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "NXT L PREV" ) + PORT_CODE ( KEYCODE_L ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x91 K LIBRARY" /* up arrow */ ) + PORT_CODE ( KEYCODE_UP ) + PORT_CODE ( KEYCODE_K ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "VAR J MEMORY" ) + PORT_CODE ( KEYCODE_J ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "CST I MODES" ) + PORT_CODE ( KEYCODE_I ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "PRG H I/O" ) + PORT_CODE ( KEYCODE_H ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE8" ) /* OUT = 0x100 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "F" ) + PORT_CODE ( KEYCODE_F ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "E" ) + PORT_CODE ( KEYCODE_E ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "D" ) + PORT_CODE ( KEYCODE_D ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "C" ) + PORT_CODE ( KEYCODE_C ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "B" ) + PORT_CODE ( KEYCODE_B ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "ON" ) /* ON key, appears on all OUT lines */ + + PORT_BIT ( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "ON CANCEL CONT OFF" ) + PORT_CODE ( KEYCODE_ESC ) + PORT_CODE ( KEYCODE_HOME ) + + PORT_BIT ( 0x7fff, 0, IPT_UNUSED ) + +INPUT_PORTS_END + + + +/* G/GX/G+ */ +static INPUT_PORTS_START( hp48gx_kbd ) + + PORT_START( "LINE0" ) /* OUT = 0x001 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "+ { } : :" ) + PORT_CODE ( KEYCODE_EQUALS ) + PORT_CODE ( KEYCODE_PLUS_PAD ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "SPC \xCF\x80 \xE2\x88\xA1" /* pi, angle */ ) + PORT_CODE ( KEYCODE_SPACE ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( ". , \xE2\x86\xb5" /* return arrow */ ) + PORT_CODE ( KEYCODE_STOP ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "0 = \xE2\x86\x92" /* right arrow */ ) + PORT_CODE ( KEYCODE_0 ) + PORT_CODE ( KEYCODE_0_PAD ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "' M UP HOME" ) + PORT_CODE ( KEYCODE_QUOTE ) + PORT_CODE ( KEYCODE_M ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE1" ) /* OUT = 0x002 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "- << >> \" \"" ) + PORT_CODE ( KEYCODE_MINUS ) + PORT_CODE ( KEYCODE_MINUS_PAD ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "3 EQ LIB" ) + PORT_CODE ( KEYCODE_3 ) + PORT_CODE ( KEYCODE_3_PAD ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "2 LIBRARY" ) + PORT_CODE ( KEYCODE_2 ) + PORT_CODE ( KEYCODE_2_PAD ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "1 I/O" ) + PORT_CODE ( KEYCODE_1 ) + PORT_CODE ( KEYCODE_1_PAD ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "A" ) + PORT_CODE ( KEYCODE_A ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "right shift" ) + PORT_CODE ( KEYCODE_RSHIFT ) + + PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) + + + PORT_START( "LINE2" ) /* OUT = 0x004 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "* [ ] _" ) + PORT_CODE ( KEYCODE_ASTERISK ) + PORT_CODE ( KEYCODE_CLOSEBRACE ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "6 UNITS" ) + PORT_CODE ( KEYCODE_6_PAD ) + PORT_CODE ( KEYCODE_6 ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "5 STAT" ) + PORT_CODE ( KEYCODE_5_PAD ) + PORT_CODE ( KEYCODE_5 ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "4 TIME" ) + PORT_CODE ( KEYCODE_4_PAD ) + PORT_CODE ( KEYCODE_4 ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "MTH G RAD POLAR") + PORT_CODE ( KEYCODE_G ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "left shift" ) + PORT_CODE ( KEYCODE_LSHIFT ) + + PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) + + + PORT_START( "LINE3" ) /* OUT = 0x008 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "/ ( ) #" ) + PORT_CODE ( KEYCODE_SLASH ) + PORT_CODE ( KEYCODE_SLASH_PAD ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "9 SYMBOLIC" ) + PORT_CODE ( KEYCODE_9_PAD ) + PORT_CODE ( KEYCODE_9 ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "8 PLOT" ) + PORT_CODE ( KEYCODE_8_PAD ) + PORT_CODE ( KEYCODE_8 ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "7 SOLVE" ) + PORT_CODE ( KEYCODE_7_PAD ) + PORT_CODE ( KEYCODE_7 ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "SIN S ASIN \xE2\x88\x82" /* delta */ ) + PORT_CODE ( KEYCODE_S ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xCE\xB1 USER ENTRY" /* alpha */ ) + PORT_CODE ( KEYCODE_LALT ) + + PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) + + + PORT_START( "LINE4" ) /* OUT = 0x010 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME (" \xE2\x87\x90 DROP" /* double left arrow */ ) + PORT_CODE ( KEYCODE_BACKSPACE ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "DEL CLEAR" ) + PORT_CODE ( KEYCODE_DEL ) + PORT_CODE ( KEYCODE_DEL_PAD ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "EEX Z PURG ARG" ) + PORT_CODE ( KEYCODE_Z ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "+/- Y EDIT CMD" ) + PORT_CODE ( KEYCODE_Y ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "ENTER EQUATION MATRIX") + PORT_CODE ( KEYCODE_ENTER ) + PORT_CODE ( KEYCODE_ENTER_PAD ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE5" ) /* OUT = 0x020 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "1/x X e^x LN" ) + PORT_CODE ( KEYCODE_X ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "y^x W 10^x LOG" ) + PORT_CODE ( KEYCODE_W ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x88\x9A V x^2 sqrt(x,y)" /* square root */ ) + PORT_CODE ( KEYCODE_V ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "TAN U ATAN \xE2\x88\x91" /* sum */ ) + PORT_CODE ( KEYCODE_U ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "COS T ACOS \xE2\x88\xAB" /* integral */ ) + PORT_CODE ( KEYCODE_T ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE6" ) /* OUT = 0x040 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x92 R SWAP" /* right arrow */ ) + PORT_CODE ( KEYCODE_RIGHT ) + PORT_CODE ( KEYCODE_R ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x93 Q VIEW" /* down arrow */ ) + PORT_CODE ( KEYCODE_DOWN ) + PORT_CODE ( KEYCODE_Q) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x90 P PICTURE" /* left arrow */ ) + PORT_CODE ( KEYCODE_LEFT ) + PORT_CODE ( KEYCODE_P ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "EVAL O \xE2\x86\x92NUM UNDO" ) + PORT_CODE ( KEYCODE_O ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "STO N DEF RCL" ) + PORT_CODE ( KEYCODE_N ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE7" ) /* OUT = 0x080 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "NXT L PREV MENU" ) + PORT_CODE ( KEYCODE_L ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x91 K STACK" /* up arrow */ ) + PORT_CODE ( KEYCODE_UP ) + PORT_CODE ( KEYCODE_K ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "VAR J MEMORY" ) + PORT_CODE ( KEYCODE_J ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "CST I MODES" ) + PORT_CODE ( KEYCODE_I ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "PRG H CHARS" ) + PORT_CODE ( KEYCODE_H ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "LINE8" ) /* OUT = 0x100 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "F" ) + PORT_CODE ( KEYCODE_F ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "E" ) + PORT_CODE ( KEYCODE_E ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "D" ) + PORT_CODE ( KEYCODE_D ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "C" ) + PORT_CODE ( KEYCODE_C ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "B" ) + PORT_CODE ( KEYCODE_B ) + + PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) + + + PORT_START( "ON" ) /* ON key, appears on all OUT lines */ + + PORT_BIT ( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "ON CANCEL CONT OFF" ) + PORT_CODE ( KEYCODE_ESC ) + PORT_CODE ( KEYCODE_HOME ) + + PORT_BIT ( 0x7fff, 0, IPT_UNUSED ) + +INPUT_PORTS_END + + + + +/* + keyboard layout for 49 G model + + ------------------------------------------------- + | F1 | F2 | F3 | F4 | F5 | F6 | + |-----------------------------------------------| + | APPS | MODE | TOOL | up | + |---------+--------+--------| left right | + | VAR | STO | NXT | down | + |---------+--------+--------+-------------------| + | HIST | CAT | EQW | SYMB | <= | + |---------+--------+--------+---------+---------| + | y^x | sqrt | SIN | COS | TAN | + |---------+--------+--------+---------+---------| + | EEX | +/- | X | 1/x | / | + |---------+--------+--------+---------+---------| + | alpha | 7 | 8 | 9 | * | + |---------+--------+--------+---------+---------| + | blue | 4 | 5 | 6 | - | + |---------+--------+--------+---------+---------| + | red | 1 | 2 | 3 | + | + |---------+--------+--------+---------+---------| + | ON | 0 | . | SPC | ENTER | + ------------------------------------------------- + + * 51 keys + * including 3 modifier keys: + - a red shift (upper right) + - a blue shift (upper left) + - a cyan alpha key (lower right) +*/ + + +static INPUT_PORTS_START( hp49g_kbd ) + + PORT_START( "LINE0" ) /* OUT = 0x001 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "ENTER ANS NUM") + PORT_CODE ( KEYCODE_ENTER ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "+ { } \xC2\xAB \xC2\xBB") /* << >> */ + PORT_CODE ( KEYCODE_EQUALS ) + PORT_CODE ( KEYCODE_PLUS_PAD ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "- ( ) _") + PORT_CODE ( KEYCODE_MINUS ) + PORT_CODE ( KEYCODE_MINUS_PAD ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "* [ ] \" \"") + PORT_CODE ( KEYCODE_ASTERISK ) + PORT_CODE ( KEYCODE_CLOSEBRACE ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "/ ABS ARG Z") + PORT_CODE ( KEYCODE_SLASH ) + PORT_CODE ( KEYCODE_SLASH_PAD ) + PORT_CODE ( KEYCODE_Z) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "TAN ATAN \xE2\x88\xAB U") /* integral */ + PORT_CODE ( KEYCODE_U ) + + PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x87\x90 DEL CLEAR") /* double left arrow */ + PORT_CODE ( KEYCODE_BACKSPACE ) + PORT_CODE ( KEYCODE_DEL ) + PORT_CODE ( KEYCODE_DEL_PAD ) + + PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "NXT PREV PASTE L") + PORT_CODE ( KEYCODE_L ) + + PORT_BIT ( 0x7f00, 0, IPT_UNUSED ) + + + PORT_START( "LINE1" ) /* OUT = 0x002 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "SPC \xCF\x80 ,") /* pi */ + PORT_CODE ( KEYCODE_SPACE ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "3 # BASE") + PORT_CODE ( KEYCODE_3 ) + PORT_CODE ( KEYCODE_3_PAD ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "6 CONVERT UNITS") + PORT_CODE ( KEYCODE_6 ) + PORT_CODE ( KEYCODE_6_PAD ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "9 FINANCE TIME") + PORT_CODE ( KEYCODE_9 ) + PORT_CODE ( KEYCODE_9_PAD ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "1/x \xE2\x89\xA5 > Y") /* >= */ + PORT_CODE ( KEYCODE_Y ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "COS ACOS \xE2\x88\x82 T") /* delta */ + PORT_CODE ( KEYCODE_T ) + + PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "SYMB MTH EVAL P") + PORT_CODE ( KEYCODE_P ) + + PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "STO\xE2\x8A\xB3 RCL CUT K") + PORT_CODE ( KEYCODE_K ) + + PORT_BIT ( 0x7f00, 0, IPT_UNUSED ) + + + PORT_START( "LINE2" ) /* OUT = 0x004 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( ". : : \xE2\x86\xb5") /* return arrow */ + PORT_CODE ( KEYCODE_STOP ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "2 DEF LIB") + PORT_CODE ( KEYCODE_2 ) + PORT_CODE ( KEYCODE_2_PAD ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "5 MATRICES STAT") + PORT_CODE ( KEYCODE_5 ) + PORT_CODE ( KEYCODE_5_PAD ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "8 EXP&LN TRIG") + PORT_CODE ( KEYCODE_8 ) + PORT_CODE ( KEYCODE_8_PAD ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "X \xE2\x89\xA4 < X") /* <= */ + PORT_CODE ( KEYCODE_X ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "SIN ASIN \xE2\x88\x91 S") /* sum */ + PORT_CODE ( KEYCODE_S ) + + PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "EQW MTRW ' O") + PORT_CODE ( KEYCODE_O ) + + PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "VAR UPDIR COPY J") + PORT_CODE ( KEYCODE_J ) + + PORT_BIT ( 0x7f00, 0, IPT_UNUSED ) + + + PORT_START( "LINE3" ) /* OUT = 0x008 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "0 \xE2\x88\x9E \xE2\x86\x92") /* infinity, right arrow */ + PORT_CODE ( KEYCODE_0 ) + PORT_CODE ( KEYCODE_0_PAD ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "1 ARITH CMPLX") + PORT_CODE ( KEYCODE_1 ) + PORT_CODE ( KEYCODE_1_PAD ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "4 CALC ALG") + PORT_CODE ( KEYCODE_4 ) + PORT_CODE ( KEYCODE_4_PAD ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "7 SSLV NUMSLV") + PORT_CODE ( KEYCODE_7 ) + PORT_CODE ( KEYCODE_7_PAD ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "+/- \xE2\x89\xA0 = W") /* =/ */ + PORT_CODE ( KEYCODE_W ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x88\x9A x^2 sqrt(x,y) R") /* square root */ + PORT_CODE ( KEYCODE_R ) + + PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "CAT PRG CHARS N") + PORT_CODE ( KEYCODE_N ) + + PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "TOOL i | I") + PORT_CODE ( KEYCODE_I ) + + PORT_BIT ( 0x7f00, 0, IPT_UNUSED ) + + + PORT_START( "LINE4" ) /* OUT = 0x010 */ + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "EEX 10^x LOG V") + PORT_CODE ( KEYCODE_V ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "y^x e^x LN Q") + PORT_CODE ( KEYCODE_Q ) + + PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "HIST CMD UNDO M") + PORT_CODE ( KEYCODE_M ) + + PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "MODE CUSTOM END H") + PORT_CODE ( KEYCODE_H ) + + PORT_BIT ( 0x7f0f, 0, IPT_UNUSED ) + + + PORT_START( "LINE5" ) /* OUT = 0x020 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "F1 Y= A") + PORT_CODE ( KEYCODE_A ) + PORT_CODE ( KEYCODE_F1 ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "F2 WIN B") + PORT_CODE ( KEYCODE_B ) + PORT_CODE ( KEYCODE_F2 ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "F3 GRAPH C") + PORT_CODE ( KEYCODE_C ) + PORT_CODE ( KEYCODE_F3 ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "F4 2D/3D D") + PORT_CODE ( KEYCODE_D ) + PORT_CODE ( KEYCODE_F4 ) + + PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "F5 TBLSET E") + PORT_CODE ( KEYCODE_E ) + PORT_CODE ( KEYCODE_F5 ) + + PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "F6 TABLE F") + PORT_CODE ( KEYCODE_F ) + PORT_CODE ( KEYCODE_F6 ) + + PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "APPS FILES BEGIN G") + PORT_CODE ( KEYCODE_G ) + + PORT_BIT ( 0x7f40, 0, IPT_UNUSED ) + + + PORT_START( "LINE6" ) /* OUT = 0x040 */ + + PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x92") /* right arrow */ + PORT_CODE ( KEYCODE_RIGHT ) + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x93") /* down arrow */ + PORT_CODE ( KEYCODE_DOWN ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x90") /* left arrow */ + PORT_CODE ( KEYCODE_LEFT ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xE2\x86\x91") /* up arrow */ + PORT_CODE ( KEYCODE_UP ) + + PORT_BIT ( 0x7ff0, 0, IPT_UNUSED ) + + + PORT_START( "LINE7" ) /* OUT = 0x080 */ + + PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "right shift") + PORT_CODE ( KEYCODE_RSHIFT ) + + PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "left shift") + PORT_CODE ( KEYCODE_LSHIFT ) + + PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "\xCE\xB1 USER ENTRY") /* alpha */ + PORT_CODE ( KEYCODE_LALT ) + + PORT_BIT ( 0x7ff1, 0, IPT_UNUSED ) + + + PORT_START( "LINE8" ) /* OUT = 0x100 */ + + PORT_BIT ( 0xffff, 0, IPT_UNUSED ) + + + PORT_START( "ON" ) /* ON key, appears on all OUT lines */ + + PORT_BIT ( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) + PORT_NAME ( "ON CONT OFF CANCEL" ) + PORT_CODE ( KEYCODE_ESC ) + PORT_CODE ( KEYCODE_HOME ) + + PORT_BIT ( 0x7fff, 0, IPT_UNUSED ) + +INPUT_PORTS_END + + + + +/* BATTERY + ------- + */ + +static INPUT_PORTS_START( hp48_battery ) + PORT_START( "BATTERY" ) + PORT_CONFNAME ( 0x03, 0, "Battery status" ) + PORT_CONFSETTING ( 0x00, DEF_STR( Normal ) ) + PORT_CONFSETTING ( 0x01, DEF_STR( Low ) ) + PORT_CONFSETTING ( 0x02, "Very low" ) +INPUT_PORTS_END + + + +/* MAIN + ----- + */ + +static INPUT_PORTS_START( hp48sx ) + PORT_INCLUDE( hp48sx_kbd ) + PORT_INCLUDE( hp48_battery ) +INPUT_PORTS_END + +static INPUT_PORTS_START( hp48gx ) + PORT_INCLUDE( hp48gx_kbd ) + PORT_INCLUDE( hp48_battery ) +INPUT_PORTS_END + +static INPUT_PORTS_START( hp49g ) + PORT_INCLUDE( hp49g_kbd ) + PORT_INCLUDE( hp48_battery ) +INPUT_PORTS_END + + + +/**************************** I/O **********************************/ + +//static const xmodem_config hp48_xmodem_rs232_conf = { &hp48_rs232_start_recv_byte }; +//static const kermit_config hp48_kermit_rs232_conf = { &hp48_rs232_start_recv_byte }; + + +/**************************** ROMs *********************************/ + +/* In ROMs, nibbles are packed into bytes, the lowest significant nibble in each byte + has the lowest address on the HP. + + Note that some ROMs you can find on the Internet has the reverse the two nibbles. + First byte should read 32 in hexa, not 23. + */ + + +/* These ROMS are common to the G, GX, and G+ models. + The ROM detects whether it runs a G or a GX by simply testing the memory: + if there are 32 KB (i.e., addresses wraps-around at 0x10000), it is a G; if there are + 128 KB, it is a GX. + When a G is detected, some specially optimized routines may be used (they use the fact that + no extension may be physically present). + The G+ model has always revision R. + */ +ROM_START ( hp48gx ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_DEFAULT_BIOS("r") + + /* in chronological order, from first revision, version r is default*/ + ROM_SYSTEM_BIOS( 0, "k", "Version K" ) + ROMX_LOAD( "gxrom-k", 0x00000, 0x80000, CRC(bdd5d2ee) SHA1(afa1498238e991b1e3d07fb8b4c227b115f7bcc1), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "l", "Version L" ) + ROMX_LOAD( "gxrom-l", 0x00000, 0x80000, CRC(70958e6b) SHA1(8eebac69ff804086247b989bf320e57a2d8a59a7), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS( 2, "m", "Version M" ) + ROMX_LOAD( "gxrom-m", 0x00000, 0x80000, CRC(e21a09e4) SHA1(09932d543594e459eeb94a79654168cd15e79a87), ROM_BIOS(3) ) + + /* there does not seem to exist an N revision? */ + + ROM_SYSTEM_BIOS( 3, "p", "Version P" ) + ROMX_LOAD( "gxrom-p", 0x00000, 0x80000, CRC(022d46df) SHA1(877a536865641f096212d1ce7296f580afbd6a2d), ROM_BIOS(4) ) + + ROM_SYSTEM_BIOS( 4, "r", "Version R" ) + ROMX_LOAD( "gxrom-r", 0x00000, 0x80000, CRC(00ee1a62) SHA1(5705fc9ea791916c4456ac35e22275862411db9b), ROM_BIOS(5) ) + +ROM_END + +#define rom_hp48g rom_hp48gx +#define rom_hp48gp rom_hp48gx + + +/* These ROMS are common to the S and SX models. + The only difference is that, the S being later, it was only shipped with revisions + E and later. + + (Note that G/GX revisions start at K, after the S/S revisions ends...) + */ + +ROM_START ( hp48sx ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_DEFAULT_BIOS("j") + + /* in chronological order, from first revision, version j is default*/ + ROM_SYSTEM_BIOS( 0, "a", "Version A" ) + ROMX_LOAD( "sxrom-a", 0x00000, 0x40000, CRC(a87696c7) SHA1(3271b103ad99254d069e20171beb418ace72cc90), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "b", "Version B" ) + ROMX_LOAD( "sxrom-b", 0x00000, 0x40000, CRC(034f6ce4) SHA1(acd256f2efee868ce402008f4131d94b312e60bc), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS( 2, "c", "Version C" ) + ROMX_LOAD( "sxrom-c", 0x00000, 0x40000, CRC(a9a0279d) SHA1(fee852d43ae6941d07a9d0d31f37e68e4f9051b1), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS( 3, "d", "Version D" ) + ROMX_LOAD( "sxrom-d", 0x00000, 0x40000, CRC(f8f5dc58) SHA1(3be5f895f4c731fd4c863237c7342cab4e8c42b1), ROM_BIOS(4) ) + + ROM_SYSTEM_BIOS( 4, "e", "Version E" ) + ROMX_LOAD( "sxrom-e", 0x00000, 0x40000, CRC(704ffa08) SHA1(0d498d135bf729c1d775cce522528837729e2e94), ROM_BIOS(5) ) + + ROM_SYSTEM_BIOS( 5, "j", "Version J" ) + ROMX_LOAD( "sxrom-j", 0x00000, 0x40000, CRC(1a6378ef) SHA1(5235f5379f1fd7edfe9bb6bf466b60d279163e73), ROM_BIOS(6) ) + + /* no F, G, H, I revisions? */ + +ROM_END + +#define rom_hp48s rom_hp48sx + +ROM_START ( hp38g ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD( "hp38g.rom", 0x00000, 0x80000, CRC(31d9affc) SHA1(bab3f5907a16cbb087943fd77230514af8fd5ac0)) +ROM_END + +ROM_START ( hp39g ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "hp39g.rom", 0x00000, 0x100000, CRC(28268fdc) SHA1(57a2b19075fe60307a9affa79d8e7cb550c621c3)) +ROM_END + +ROM_START ( hp49g ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "1.00", "Version C-1.00" ) + ROMX_LOAD( "hp49gv100.rom", 0x00000, 0x200000, CRC(64c9826a) SHA1(da25371b97d439fc0003cb786dba143ee2be9160), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "1.05", "Version C-1.05" ) + ROMX_LOAD( "hp49gv105.rom", 0x00000, 0x200000, CRC(cf777cac) SHA1(b1d063b6e95083799aa990e4a2718214a38a372f), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "1.10", "Version C-1.10" ) + ROMX_LOAD( "hp49gv110.rom", 0x00000, 0x200000, CRC(e391efbd) SHA1(d4abad60f38faf4cb2d2d97804a24f54589dfa10), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "1.16", "Version C-1.16" ) + ROMX_LOAD( "hp49gv116.rom", 0x00000, 0x200000, CRC(dcc0b39c) SHA1(46f64b4731f5964eb114060b733aab2b23b4180c), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "1.18", "Version C-1.18" ) + ROMX_LOAD( "hp49gv118.rom", 0x00000, 0x200000, CRC(73a6a195) SHA1(3f283fe15a64c5cbc8c1b1254e10965957f58a84), ROM_BIOS(5)) + ROM_SYSTEM_BIOS( 5, "1.19", "Version B-1.19-6" ) + ROMX_LOAD( "hp49gv119.rom", 0x00000, 0x200000, CRC(75218a18) SHA1(ec0f661f0aa7158d1f6df61f24410260b5324fa9), ROM_BIOS(6)) +ROM_END + +/**************************** memory *******************************/ + +/* In memory, nibbles are unpacked: one nibble at each address. + This is due to the way the SATURN emulation is done. + As a consequence only the 4 lower bits of each byte is used, the 4 higher + bits being zeros. + Another consequence is that ROMs must be unpacked before use. + + Because of the complex memory manager, actual address mapping is done at + run-time. + */ + +static ADDRESS_MAP_START ( hp48, AS_PROGRAM, 8, hp48_state ) + + AM_RANGE( 0x00000, 0xfffff ) AM_NOP /* configured at run-time */ + +ADDRESS_MAP_END + + + +/*************************** layout ********************************/ + +static const char layout_hp48gx[] = "hp48gx"; +static const char layout_hp48g [] = "hp48g"; +static const char layout_hp48gp[] = "hp48gp"; +static const char layout_hp48sx[] = "hp48sx"; +static const char layout_hp48s [] = "hp48s"; +static const char layout_hp49g [] = "hp49g"; + + +/*************************** driver ********************************/ + + +static MACHINE_CONFIG_START( hp48_common, hp48_state ) + + /* cpu */ + MCFG_CPU_ADD ( "maincpu", SATURN, 3937007 ) /* almost 4 MHz */ + MCFG_CPU_PROGRAM_MAP ( hp48) + MCFG_SATURN_CONFIG( WRITE32(hp48_state, hp48_reg_out), READ32(hp48_state, hp48_reg_in), + WRITELINE(hp48_state, hp48_mem_reset), WRITE32(hp48_state, hp48_mem_config), + WRITE32(hp48_state, hp48_mem_unconfig), READ32(hp48_state, hp48_mem_id), + WRITE32(hp48_state, hp48_mem_crc), WRITELINE(hp48_state, hp48_rsi) ) + + /* memory */ + MCFG_NVRAM_ADD_0FILL("nvram") + + /* video */ + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_REFRESH_RATE( 64 ) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_SCREEN_SIZE ( 131, 64 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 130, 0, 63 ) + MCFG_SCREEN_UPDATE_DRIVER(hp48_state, screen_update_hp48) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD( "palette", 256 ) /* monochrome, but with varying contrast and grayscale */ + MCFG_PALETTE_INIT_OWNER(hp48_state, hp48) + + /* sound */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "dac", DAC, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* 1-bit beeper */ +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( hp48gx, hp48_common ) + MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48gx ) + MCFG_DEFAULT_LAYOUT ( layout_hp48gx ) + + /* expansion ports */ + MCFG_HP48_PORT_ADD ( "port1", 0, HP48_CE2, 128*1024 ) + MCFG_HP48_PORT_ADD ( "port2", 1, HP48_NCE3, 4*1024*1024 ) + + /* serial I/O */ + //MCFG_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) + //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( hp48g, hp48_common ) + MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48g ) + MCFG_DEFAULT_LAYOUT ( layout_hp48g ) + + /* serial I/O */ + //MCFG_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) + //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( hp48gp, hp48_common ) + MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48gp ) + MCFG_DEFAULT_LAYOUT ( layout_hp48gp ) + + /* serial I/O */ + //MCFG_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) + //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( hp48sx, hp48_common ) + MCFG_CPU_MODIFY ( "maincpu" ) + MCFG_CPU_CLOCK ( 2000000 ) + MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48sx ) + MCFG_DEFAULT_LAYOUT ( layout_hp48sx ) + + /* expansion ports */ + MCFG_HP48_PORT_ADD ( "port1", 0, HP48_CE1, 128*1024) + MCFG_HP48_PORT_ADD ( "port2", 1, HP48_CE2, 128*1024) + + /* serial I/O */ + //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( hp48s, hp48_common ) + MCFG_CPU_MODIFY ( "maincpu" ) + MCFG_CPU_CLOCK ( 2000000 ) + MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48s ) + MCFG_DEFAULT_LAYOUT ( layout_hp48s ) + + /* serial I/O */ + //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( hp49g, hp48_common ) + MCFG_CPU_MODIFY ( "maincpu" ) + MCFG_MACHINE_START_OVERRIDE (hp48_state, hp49g ) + MCFG_DEFAULT_LAYOUT ( layout_hp49g ) + + /* serial I/O */ + //MCFG_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) + //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) +MACHINE_CONFIG_END + + +COMP ( 1990, hp48sx, 0 , 0, hp48sx, hp48sx, hp48_state, hp48, "Hewlett Packard", "HP48SX", 0 ) +COMP ( 1991, hp48s , hp48sx, 0, hp48s, hp48sx, hp48_state, hp48, "Hewlett Packard", "HP48S", 0 ) +COMP ( 1993, hp48gx, 0 , 0, hp48gx, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP48GX", 0 ) +COMP ( 1993, hp48g , hp48gx, 0, hp48g, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP48G", 0 ) +COMP ( 1998, hp48gp, hp48gx, 0, hp48gp, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP48G+", 0 ) +COMP ( 1999, hp49g , 0, 0, hp49g, hp49g, hp48_state, hp48, "Hewlett Packard", "HP49G", 0 ) +COMP ( 1995, hp38g , 0, 0, hp48g, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP38G", 0 ) +COMP ( 2000, hp39g , 0, 0, hp48g, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP39G", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/hp49gp.c b/src/mame/drivers/hp49gp.c new file mode 100644 index 00000000000..dafdf563516 --- /dev/null +++ b/src/mame/drivers/hp49gp.c @@ -0,0 +1,337 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/******************************************************************************* + + Hewlett Packard 49G+ Graphing Calculator + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "machine/s3c2410.h" +#include "rendlay.h" + +#define VERBOSE_LEVEL ( 0 ) + +struct lcd_spi_t +{ + int l1; + int data; + int l3; + UINT32 shift, bits; +}; + +class hp49gp_state : public driver_device +{ +public: + hp49gp_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_s3c2410(*this, "s3c2410"), + m_steppingstone(*this, "steppingstone"), + m_maincpu(*this, "maincpu") { } + + UINT32 m_port[9]; + required_device m_s3c2410; + required_shared_ptr m_steppingstone; + lcd_spi_t m_lcd_spi; + DECLARE_DRIVER_INIT(hp49gp); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(port_changed); + DECLARE_READ32_MEMBER(s3c2410_gpio_port_r); + DECLARE_WRITE32_MEMBER(s3c2410_gpio_port_w); + inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); + void lcd_spi_reset( ); + void lcd_spi_init( ); + void lcd_spi_line_w( int line, int data); + int lcd_spi_line_r( int line); + required_device m_maincpu; +}; + +/*************************************************************************** + MACHINE HARDWARE +***************************************************************************/ + +// LCD SPI + +enum +{ + LCD_SPI_LINE_1, + LCD_SPI_LINE_DATA, + LCD_SPI_LINE_3 +}; + +inline void hp49gp_state::verboselog(int n_level, const char *s_fmt, ...) +{ + if (VERBOSE_LEVEL >= n_level) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt); + vsprintf( buf, s_fmt, v); + va_end( v); + logerror( "%s: %s", machine().describe_context( ), buf); + } +} + +void hp49gp_state::lcd_spi_reset( ) +{ + verboselog( 5, "lcd_spi_reset\n"); + m_lcd_spi.l1 = 0; + m_lcd_spi.data = 0; + m_lcd_spi.l3 = 0; +} + +void hp49gp_state::lcd_spi_init( ) +{ + verboselog( 5, "lcd_spi_init\n"); + lcd_spi_reset(); +} + +void hp49gp_state::lcd_spi_line_w( int line, int data) +{ + switch (line) + { + case LCD_SPI_LINE_1 : + { + if (data != m_lcd_spi.l1) + { + if (data == 0) + { + m_lcd_spi.shift = 0; + m_lcd_spi.bits = 0; + } + verboselog( 5, "LCD_SPI_LINE_1 <- %d\n", data); + m_lcd_spi.l1 = data; + } + } + break; + case LCD_SPI_LINE_DATA : + { + if (data != m_lcd_spi.data) + { + verboselog( 5, "LCD_SPI_LINE_DATA <- %d\n", data); + m_lcd_spi.data = data; + } + } + break; + case LCD_SPI_LINE_3 : + { + if (data != m_lcd_spi.l3) + { + if ((data != 0) && (m_lcd_spi.l1 == 0)) + { + verboselog( 5, "LCD SPI write bit %d\n", m_lcd_spi.data ? 1 : 0); + if (m_lcd_spi.bits < 8) + { + m_lcd_spi.shift = (m_lcd_spi.shift << 1) | (m_lcd_spi.data ? 1 : 0); + } + m_lcd_spi.bits++; + if (m_lcd_spi.bits == 8) + { + verboselog( 5, "LCD SPI write byte %02X\n", m_lcd_spi.shift); + } + else if (m_lcd_spi.bits == 9) + { + verboselog( 5, "LCD SPI write ack %d\n", (m_lcd_spi.data ? 1 : 0)); + } + } + verboselog( 5, "LCD_SPI_LINE_3 <- %d\n", data); + m_lcd_spi.l3 = data; + } + } + break; + } +} + +int hp49gp_state::lcd_spi_line_r( int line) +{ + switch (line) + { + case LCD_SPI_LINE_1 : + { + verboselog( 7, "LCD_SPI_LINE_1 -> %d\n", m_lcd_spi.l1); + return m_lcd_spi.l1; + } + case LCD_SPI_LINE_DATA : + { + verboselog( 7, "LCD_SPI_LINE_DATA -> %d\n", m_lcd_spi.data); + return m_lcd_spi.data; + } + case LCD_SPI_LINE_3 : + { + verboselog( 7, "LCD_SPI_LINE_3 -> %d\n", m_lcd_spi.l3); + return m_lcd_spi.l3; + } + } + return 0; +} + +// I/O PORT + +READ32_MEMBER(hp49gp_state::s3c2410_gpio_port_r) +{ + UINT32 data = m_port[offset]; + switch (offset) + { + case S3C2410_GPIO_PORT_C : + { + data = data | 0xF000; + } + break; + case S3C2410_GPIO_PORT_D : + { + data = data | 0x0008; + data = data & ~0x3200; + data |= (lcd_spi_line_r( LCD_SPI_LINE_1) ? 1 : 0) << 9; + data |= (lcd_spi_line_r( LCD_SPI_LINE_DATA) ? 1 : 0) << 12; + data |= (lcd_spi_line_r( LCD_SPI_LINE_3) ? 1 : 0) << 13; + } + break; + case S3C2410_GPIO_PORT_E : + { + data = data | 0xC000; + } + break; + case S3C2410_GPIO_PORT_F : + { + data = data | 0x0008; + } + break; + case S3C2410_GPIO_PORT_G : + { + data = data & ~0xFF00; + if ((data & 0x02) == 0) data |= (ioport( "ROW1")->read() << 8); + if ((data & 0x04) == 0) data |= (ioport( "ROW2")->read() << 8); + if ((data & 0x08) == 0) data |= (ioport( "ROW3")->read() << 8); + if ((data & 0x10) == 0) data |= (ioport( "ROW4")->read() << 8); + if ((data & 0x20) == 0) data |= (ioport( "ROW5")->read() << 8); + if ((data & 0x40) == 0) data |= (ioport( "ROW6")->read() << 8); + if ((data & 0x80) == 0) data |= (ioport( "ROW7")->read() << 8); + } + break; + case S3C2410_GPIO_PORT_H : + { + data = (data | 0x0080) & ~0x0040; + } + break; + } + return data; +} + +WRITE32_MEMBER(hp49gp_state::s3c2410_gpio_port_w) +{ + m_port[offset] = data; + switch (offset) + { + case S3C2410_GPIO_PORT_D : + { + lcd_spi_line_w( LCD_SPI_LINE_1, BIT( data, 9) ? 1 : 0); + lcd_spi_line_w( LCD_SPI_LINE_DATA, BIT( data, 12) ? 1 : 0); + lcd_spi_line_w( LCD_SPI_LINE_3, BIT( data, 13) ? 1 : 0); + } + break; + } +} + +// ... + +INPUT_CHANGED_MEMBER(hp49gp_state::port_changed) +{ + m_s3c2410->s3c2410_request_eint( (FPTR)param + 8); +} + +// ... + +void hp49gp_state::machine_start() +{ +} + +void hp49gp_state::machine_reset() +{ + m_maincpu->reset(); +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( hp49gp_map, AS_PROGRAM, 32, hp49gp_state ) + AM_RANGE(0x00000000, 0x001fffff) AM_ROM + AM_RANGE(0x08000000, 0x0801ffff) AM_RAM + AM_RANGE(0x08020000, 0x0803ffff) AM_RAM + AM_RANGE(0x08040000, 0x0807ffff) AM_RAM + AM_RANGE(0x40000000, 0x40000fff) AM_RAM AM_SHARE("steppingstone") +ADDRESS_MAP_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +DRIVER_INIT_MEMBER(hp49gp_state,hp49gp) +{ + UINT8 *rom = (UINT8 *)memregion( "maincpu")->base(); + memcpy( m_steppingstone, rom, 1024); + lcd_spi_init(); +} + +static MACHINE_CONFIG_START( hp49gp, hp49gp_state ) + MCFG_CPU_ADD("maincpu", ARM9, 400000000) + MCFG_CPU_PROGRAM_MAP(hp49gp_map) + + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(160, 85) + MCFG_SCREEN_VISIBLE_AREA(0, 131 - 1, 0, 80 - 1) + MCFG_SCREEN_UPDATE_DEVICE("s3c2410", s3c2410_device, screen_update) + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + + MCFG_DEVICE_ADD("s3c2410", S3C2410, 12000000) + MCFG_S3C2410_PALETTE("palette") + MCFG_S3C2410_GPIO_PORT_R_CB(READ32(hp49gp_state, s3c2410_gpio_port_r)) + MCFG_S3C2410_GPIO_PORT_W_CB(WRITE32(hp49gp_state, s3c2410_gpio_port_w)) + MCFG_S3C2410_LCD_FLAGS(S3C24XX_INTERFACE_LCD_REVERSE) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( hp49gp ) + PORT_START("ROW1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)1) PORT_NAME("F1 | A | Y=") PORT_CODE(KEYCODE_F1) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("ROW2") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)2) PORT_NAME("F2 | B | WIN") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("ROW3") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)3) PORT_NAME("F3 | C | GRAPH") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("ROW4") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)4) PORT_NAME("F4 | D | 2D/3D") PORT_CODE(KEYCODE_F4) + PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("ROW5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)5) PORT_NAME("F5 | E | TBLSET") PORT_CODE(KEYCODE_F5) + PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("ROW6") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)6) PORT_NAME("F6 | F | TABLE") PORT_CODE(KEYCODE_F6) + PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("ROW7") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)7) PORT_NAME("APPS | G | FILES | BEGIN") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +ROM_START( hp49gp ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "319", "Version 3.19" ) + ROMX_LOAD( "319.bin", 0x0000, 0x4000, CRC(6bb5ebfb) SHA1(089c4e4ee7223b489e2f06c30aab0b89131d1c3c), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "315", "Version 3.15.04" ) + ROMX_LOAD( "31504.bin", 0x0000, 0x4000, CRC(9c71825e) SHA1(0a12b2b70a8573bc90ab5be06e6b2f814b8544ae), ROM_BIOS(2) ) +ROM_END + +COMP(2009, hp49gp, 0, 0, hp49gp, hp49gp, hp49gp_state, hp49gp, "Hewlett Packard", "HP49G+", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/hp64k.c b/src/mame/drivers/hp64k.c new file mode 100644 index 00000000000..e56ce89f62b --- /dev/null +++ b/src/mame/drivers/hp64k.c @@ -0,0 +1,1424 @@ +// license:BSD-3-Clause +// copyright-holders:F. Ulivi +// +// *************************************** +// Driver for HP 64000 development system +// *************************************** +// +// Documentation used for this driver: +// [1] HP, manual 64100-90910, dec 83 rev. - Model 64100A mainframe service manual +// [2] HP, manual 64941-90902, apr 83 rev. - Model 64941A Flexible disc (Floppy) drive +// controller service manual +// +// A 64100A system ("mainframe" in HP docs) is built around a 13 slot card cage. +// The first 4 slots are reserved for specific card types: +// J1 I/O card +// J2 Display and RAM card +// J3 CPU card +// J4 Floppy interface card +// +// The rest of the slots are for CPU emulators, logic analyzers and so on (i.e. those +// cards doing the main functions of a development system). +// This driver emulates the first 4 cards only. +// +// All cards are interconnected by 2 separate buses originating from the CPU: +// memory (16-bit data & 16-bit addresses) and I/O (16-bit data and 6-bit addresses) buses. +// The addresses on I/O bus are split in a 4-bit PA (peripheral address) and a 2-bit IC +// (register address). See also HP_MAKE_IOADDR. +// For the address mapping on the memory bus see [1] pg 229. +// Reading the schematics is complicated by the fact that all data & address +// lines of the buses are inverted. +// +// A brief description of each emulated card follows. +// +// ********** +// CPU card (64100-66521 or 64100-66532) +// +// This board holds the HP custom CPU with its massive heatsink, the BIOS roms and little else. +// U30 5061-3011 HP "hybrid" CPU @ 6.25 MHz +// U8 +// U9 +// U10 +// U11 +// U18 +// U19 +// U20 +// U21 2732 16kw of BIOS EPROMs +// +// ********** +// I/O card (64100-66520) +// +// This board has most of the I/O circuits of the system. +// It interfaces: +// - Keyboard +// - RS232 line +// - IEEE-488/HP-IB bus +// - Miscellaneous peripherals (watchdog, beeper, interrupt registers, option DIP switches) +// +// Emulation of beeper sound is far from correct: it should be a 2500 Hz tone inside an +// exponentially decaying envelope (a bell sound) whereas in the emulation it's inside a +// simple rectangular envelope. +// +//*U20 HP "PHI" Custom HP-IB interface microcontroller +// U28 i8251 RS232 UART +// +// ********** +// Display card (64100-66530) +// +// This card has the main DRAM of the system (64 kw) and the CRT controller that generates +// the video image. +// The framebuffer is stored in the main DRAM starting at a fixed location (0xf9f0) and it is +// fed into the CRTC by a lot of discrete TTL ICs. The transfer of framebuffer from DRAM to +// CRTC is designed to refresh the whole DRAM in parallel. For some mysterious reason the first +// display row is always blanked (its 40 words of RAM are even used for the stack!). +// +// U33 i8275 CRT controller +// U60 2716 Character generator ROM +// U23-U30 +// U38-U45 HM4864 64 kw of DRAM +// +// ********** +// Floppy I/F card (64941-66501) +// +// This card is optional. It interfaces 2 5.25" double-side double-density floppy drives. +// The interfacing between the 16-bit CPU and the 8-bit FDC (WD1791) is quite complex. It is +// based around a FSM that sequences the access of DMA or CPU to FDC. This FSM is implemented +// by 2 small PROMs for which no dump (AFAIK) is available. +// I tried to reverse engineer the FSM by looking at the schematics and applying some sensible +// assumptions. Then I did a sort of "clean room" re-implementation. It appears to work correctly. +// +// U4 FD1791A Floppy disk controller +// +// A brief summary of the reverse-engineered interface of this card follows. +// +// IC Content +// ========== +// 0 DMA transfers, all words in a block but the last one +// 1 Floppy I/F register, detailed below +// 2 DMA transfers, last word in a block +// 3 Diagnostic registers (not emulated) +// +// Floppy I/F register has 2 formats, one for writing and one for reading. +// Reading this register should always be preceded by a write that starts +// the read operation (bit 11 = 0: see below). +// +// Floppy I/F register format when writing: +// Bit Content +// =========== +// 15 Clear interrupts (1) +// 14 Direction of DMA transfers (1 = write to FDC, 0 = read from FDC) +// 13 DMA enable (1) +// 12 Reset FDC (1) +// 11 Direction of access to FDC/drive control (1 = write, 0 = read) +// 10 Access to either FDC (1) or drive control (0): this selects the +// content of lower byte (both when writing and reading) +// 9 ~A1 signal of FDC +// 8 ~A0 signal of FDC +// +// 7-0 FDC data (when bit 10 = 1) +// 7-0 Drive control (when bit 10 = 0) +// +// Floppy I/F register format when reading: +// Bit Content +// =========== +// 15 Interrupt from FDC pending (1) +// 14 Interrupt from DMA pending (1) +// 13 Drive 1 media changed (1) +// 12 Drive 1 write protected (1) +// 11 Drive 1 ready (0) +// 10 Drive 0 media changed (1) +// 9 Drive 0 write protected (1) +// 8 Drive 0 ready (0) +// +// 7-0 FDC data (when bit 10 = 1) +// 7-0 Drive control (when bit 10 = 0) +// +// Drive control register +// Bit Content +// =========== +// 7 Floppy side selection +// 6 N/U +// 5 Reset drive 1 media change (1) +// 4 Enable drive 1 motor (0) +// 3 Enable drive 1 (0) +// 2 Reset drive 0 media change (1) +// 1 Enable drive 0 motor (0) +// 0 Enable drive 0 (0) +// +// +// ICs that are not emulated yet are marked with "*" +// + +#include "emu.h" +#include "cpu/hphybrid/hphybrid.h" +#include "video/i8275.h" +#include "machine/wd_fdc.h" +#include "machine/74123.h" +#include "machine/rescap.h" +#include "sound/beep.h" +#include "machine/com8116.h" +#include "machine/i8251.h" +#include "bus/rs232/rs232.h" + +#define BIT_MASK(n) (1U << (n)) + +// Macros to clear/set single bits +#define BIT_CLR(w , n) ((w) &= ~BIT_MASK(n)) +#define BIT_SET(w , n) ((w) |= BIT_MASK(n)) + +class hp64k_state : public driver_device +{ +public: + hp64k_state(const machine_config &mconfig, device_type type, const char *tag); + + virtual void driver_start(); + //virtual void machine_start(); + virtual void video_start(); + virtual void machine_reset(); + + UINT8 hp64k_crtc_filter(UINT8 data); + DECLARE_WRITE16_MEMBER(hp64k_crtc_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_crtc_drq_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_crtc_vrtc_w); + + I8275_DRAW_CHARACTER_MEMBER(crtc_display_pixels); + + DECLARE_READ16_MEMBER(hp64k_rear_sw_r); + + IRQ_CALLBACK_MEMBER(hp64k_irq_callback); + void hp64k_update_irl(void); + DECLARE_WRITE16_MEMBER(hp64k_irl_mask_w); + + TIMER_DEVICE_CALLBACK_MEMBER(hp64k_kb_scan); + DECLARE_READ16_MEMBER(hp64k_kb_r); + + TIMER_DEVICE_CALLBACK_MEMBER(hp64k_line_sync); + DECLARE_READ16_MEMBER(hp64k_deltat_r); + DECLARE_WRITE16_MEMBER(hp64k_deltat_w); + + DECLARE_READ16_MEMBER(hp64k_slot_r); + DECLARE_WRITE16_MEMBER(hp64k_slot_w); + DECLARE_WRITE16_MEMBER(hp64k_slot_sel_w); + + DECLARE_READ16_MEMBER(hp64k_flp_r); + DECLARE_WRITE16_MEMBER(hp64k_flp_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_flp_drq_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_flp_intrq_w); + void hp64k_update_floppy_dma(void); + void hp64k_update_floppy_irq(void); + void hp64k_update_drv_ctrl(void); + DECLARE_WRITE8_MEMBER(hp64k_floppy0_rdy); + DECLARE_WRITE8_MEMBER(hp64k_floppy1_rdy); + void hp64k_floppy_idx_cb(floppy_image_device *floppy , int state); + void hp64k_floppy_wpt_cb(floppy_image_device *floppy , int state); + + DECLARE_READ16_MEMBER(hp64k_usart_r); + DECLARE_WRITE16_MEMBER(hp64k_usart_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_rxrdy_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_txrdy_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_txd_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_dtr_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_rts_w); + DECLARE_WRITE16_MEMBER(hp64k_loopback_w); + void hp64k_update_loopback(void); + DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_rxd_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_dcd_w); + DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_cts_w); + + DECLARE_WRITE16_MEMBER(hp64k_beep_w); + TIMER_DEVICE_CALLBACK_MEMBER(hp64k_beeper_off); + + DECLARE_WRITE_LINE_MEMBER(hp64k_baud_clk_w); +private: + required_device m_cpu; + required_device m_crtc; + required_device m_palette; + required_ioport m_io_key0; + required_ioport m_io_key1; + required_ioport m_io_key2; + required_ioport m_io_key3; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_ss0; + required_device m_ss1; + required_ioport m_rear_panel_sw; + required_ioport m_rs232_sw; + required_device m_beeper; + required_device m_beep_timer; + required_device m_baud_rate; + required_ioport m_s5_sw; + required_device m_uart; + required_device m_rs232; + + // Character generator + const UINT8 *m_chargen; + + UINT32 m_crtc_ptr; + bool m_crtc_drq; + bool m_vrtc; + + // Interrupt handling + UINT8 m_irl_mask; + UINT8 m_irl_pending; + + // State of keyboard + ioport_value m_kb_state[ 4 ]; + UINT8 m_kb_row_col; + bool m_kb_scan_on; + bool m_kb_pressed; + + // Slot selection + std::vector m_low32k_ram; + UINT8 m_slot_select; + UINT8 m_slot_map; + + // Floppy I/F + UINT8 m_floppy_in_latch_msb; // U23 + UINT8 m_floppy_in_latch_lsb; // U38 + UINT8 m_floppy_out_latch_msb; // U22 + UINT8 m_floppy_out_latch_lsb; // U37 + UINT8 m_floppy_if_ctrl; // U24 + bool m_floppy_dmaen; + bool m_floppy_dmai; + bool m_floppy_mdci; + bool m_floppy_intrq; + bool m_floppy_drq; + bool m_floppy0_wpt; + bool m_floppy1_wpt; + UINT8 m_floppy_drv_ctrl; // U39 + UINT8 m_floppy_status; // U25 + + typedef enum { + HP64K_FLPST_IDLE, + HP64K_FLPST_DMAWR1, + HP64K_FLPST_DMAWR2, + HP64K_FLPST_DMARD1, + HP64K_FLPST_DMARD2 + } floppy_state_t; + + floppy_state_t m_floppy_if_state; + floppy_image_device *m_current_floppy; + + // RS232 I/F + bool m_16x_clk; + bool m_baud_clk; + UINT8 m_16x_div; + bool m_loopback; + bool m_txd_state; + bool m_dtr_state; + bool m_rts_state; +}; + +static ADDRESS_MAP_START(cpu_mem_map , AS_PROGRAM , 16 , hp64k_state) + AM_RANGE(0x0000 , 0x3fff) AM_ROM + AM_RANGE(0x4000 , 0x7fff) AM_READWRITE(hp64k_slot_r , hp64k_slot_w) + AM_RANGE(0x8000 , 0x8001) AM_WRITE(hp64k_crtc_w) + AM_RANGE(0x8002 , 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(cpu_io_map , AS_IO , 16 , hp64k_state) + // PA = 0, IC = [0..3] + // Keyboard input + AM_RANGE(HP_MAKE_IOADDR(0 , 0) , HP_MAKE_IOADDR(0 , 3)) AM_READ(hp64k_kb_r) + // PA = 2, IC = [0..3] + // Line sync interrupt clear/watchdog reset + AM_RANGE(HP_MAKE_IOADDR(2 , 0) , HP_MAKE_IOADDR(2 , 3)) AM_READWRITE(hp64k_deltat_r , hp64k_deltat_w) + // PA = 4, IC = [0..3] + // Floppy I/F + AM_RANGE(HP_MAKE_IOADDR(4 , 0) , HP_MAKE_IOADDR(4 , 3)) AM_READWRITE(hp64k_flp_r , hp64k_flp_w) + // PA = 5, IC = [0..3] + // Write to USART + AM_RANGE(HP_MAKE_IOADDR(5 , 0) , HP_MAKE_IOADDR(5 , 3)) AM_WRITE(hp64k_usart_w) + // PA = 6, IC = [0..3] + // Read from USART + AM_RANGE(HP_MAKE_IOADDR(6 , 0) , HP_MAKE_IOADDR(6 , 3)) AM_READ(hp64k_usart_r) + // PA = 7, IC = 2 + // Rear-panel switches and loopback relay control + AM_RANGE(HP_MAKE_IOADDR(7 , 2) , HP_MAKE_IOADDR(7 , 2)) AM_READWRITE(hp64k_rear_sw_r , hp64k_loopback_w) + // PA = 9, IC = [0..3] + // Beeper control & interrupt status read + AM_RANGE(HP_MAKE_IOADDR(9 , 0) , HP_MAKE_IOADDR(9 , 3)) AM_WRITE(hp64k_beep_w) + // PA = 10, IC = [0..3] + // Slot selection + AM_RANGE(HP_MAKE_IOADDR(10 , 0) , HP_MAKE_IOADDR(10 , 3)) AM_WRITE(hp64k_slot_sel_w) + // PA = 12, IC = [0..3] + // Interrupt mask + AM_RANGE(HP_MAKE_IOADDR(12 , 0) , HP_MAKE_IOADDR(12 , 3)) AM_WRITE(hp64k_irl_mask_w) +ADDRESS_MAP_END + +hp64k_state::hp64k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig , type , tag), + m_cpu(*this , "cpu"), + m_crtc(*this , "crtc"), + m_palette(*this , "palette"), + m_io_key0(*this , "KEY0"), + m_io_key1(*this , "KEY1"), + m_io_key2(*this , "KEY2"), + m_io_key3(*this , "KEY3"), + m_fdc(*this , "fdc"), + m_floppy0(*this , "fdc:0"), + m_floppy1(*this , "fdc:1"), + m_ss0(*this , "fdc_rdy0"), + m_ss1(*this , "fdc_rdy1"), + m_rear_panel_sw(*this , "rear_sw"), + m_rs232_sw(*this , "rs232_sw"), + m_beeper(*this , "beeper"), + m_beep_timer(*this , "beep_timer"), + m_baud_rate(*this , "baud_rate"), + m_s5_sw(*this , "s5_sw"), + m_uart(*this , "uart"), + m_rs232(*this , "rs232") +{ +} + +void hp64k_state::driver_start() +{ + // 32kW for lower RAM + m_low32k_ram.resize(0x8000); +} + +void hp64k_state::video_start() +{ + m_chargen = memregion("chargen")->base(); +} + +void hp64k_state::machine_reset() +{ + m_crtc_drq = false; + m_vrtc = false; + m_crtc_ptr = 0; + m_irl_mask = 0; + m_irl_pending = 0; + memset(&m_kb_state[ 0 ] , 0 , sizeof(m_kb_state)); + m_kb_row_col = 0; + m_kb_scan_on = true; + m_slot_select = 0; + m_slot_map = 3; + m_floppy_if_ctrl = ~0; + m_floppy_dmaen = false; + m_floppy_dmai = false; + m_floppy_mdci = false; + m_floppy_intrq = false; + m_floppy_drv_ctrl = ~0; + m_floppy_if_state = HP64K_FLPST_IDLE; + m_current_floppy = NULL; + m_floppy0_wpt = false; + m_floppy1_wpt = false; + m_beeper->set_state(0); + m_baud_rate->str_w((m_s5_sw->read() >> 1) & 0xf); + m_16x_clk = (m_rs232_sw->read() & 0x02) != 0; + m_loopback = false; + m_txd_state = true; + m_dtr_state = true; + m_rts_state = true; + +} + +UINT8 hp64k_state::hp64k_crtc_filter(UINT8 data) +{ + bool inv = (data & 0xe0) == 0xe0; + + return inv ? (data & 0xf2) : data; +} + +WRITE16_MEMBER(hp64k_state::hp64k_crtc_w) +{ + m_crtc->write(space , offset == 0 , hp64k_crtc_filter((UINT8)data)); +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_drq_w) +{ + bool crtc_drq = state != 0; + bool prev_crtc = m_crtc_drq; + m_crtc_drq = crtc_drq; + + if (!prev_crtc && crtc_drq) { + address_space& prog_space = m_cpu->space(AS_PROGRAM); + + UINT8 data = prog_space.read_byte(m_crtc_ptr); + m_crtc_ptr++; + + m_crtc->dack_w(prog_space , 0 , hp64k_crtc_filter(data)); + } +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_vrtc_w) +{ + bool vrtc = state != 0; + + if (!m_vrtc && vrtc) { + m_crtc_ptr = 0xf9f0 << 1; + } + m_vrtc = vrtc; +} + +I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chargen_byte = m_chargen[ linecount | ((unsigned)charcode << 4) ]; + bool lvid , livid; + UINT16 pixels_lvid , pixels_livid; + unsigned i; + + if (vsp) { + pixels_lvid = pixels_livid = ~0; + } else if (lten) { + pixels_livid = ~0; + if (rvv) { + pixels_lvid = ~0; + } else { + pixels_lvid = 0; + } + } else if (rvv) { + pixels_lvid = ~0; + pixels_livid = (UINT16)chargen_byte << 1; + } else { + pixels_lvid = ~((UINT16)chargen_byte << 1); + pixels_livid = ~0; + } + + for (i = 0; i < 9; i++) { + lvid = (pixels_lvid & (1U << (8 - i))) != 0; + livid = (pixels_livid & (1U << (8 - i))) != 0; + + if (!lvid) { + // Normal brightness + bitmap.pix32(y , x + i) = palette[ 2 ]; + } else if (livid) { + // Black + bitmap.pix32(y , x + i) = palette[ 0 ]; + } else { + // Half brightness + bitmap.pix32(y , x + i) = palette[ 1 ]; + } + } + +} + +READ16_MEMBER(hp64k_state::hp64k_rear_sw_r) +{ + return m_rear_panel_sw->read() | 0x0020; +} + +IRQ_CALLBACK_MEMBER(hp64k_state::hp64k_irq_callback) +{ + if (irqline == HPHYBRID_IRL) { + return 0xff00 | (m_irl_mask & m_irl_pending); + } else { + return ~0; + } +} + +void hp64k_state::hp64k_update_irl(void) +{ + m_cpu->set_input_line(HPHYBRID_IRL , (m_irl_mask & m_irl_pending) != 0); +} + +WRITE16_MEMBER(hp64k_state::hp64k_irl_mask_w) +{ + m_irl_mask = (UINT8)data; + hp64k_update_irl(); +} + +TIMER_DEVICE_CALLBACK_MEMBER(hp64k_state::hp64k_kb_scan) +{ + if (m_kb_scan_on) { + unsigned i; + + ioport_value input[ 4 ]; + input[ 0 ] = m_io_key0->read(); + input[ 1 ] = m_io_key1->read(); + input[ 2 ] = m_io_key2->read(); + input[ 3 ] = m_io_key3->read(); + + for (i = 0; i < 128; i++) { + if (++m_kb_row_col >= 128) { + m_kb_row_col = 0; + } + + ioport_value mask = BIT_MASK(m_kb_row_col & 0x1f); + unsigned idx = m_kb_row_col >> 5; + + if ((input[ idx ] ^ m_kb_state[ idx ]) & mask) { + // key changed state + m_kb_state[ idx ] ^= mask; + m_kb_pressed = (m_kb_state[ idx ] & mask) != 0; + m_kb_scan_on = false; + BIT_SET(m_irl_pending , 0); + hp64k_update_irl(); + break; + } + } + } +} + +READ16_MEMBER(hp64k_state::hp64k_kb_r) +{ + UINT16 ret = 0xff00 | m_kb_row_col; + + if (m_kb_pressed) { + BIT_SET(ret , 7); + } + + m_kb_scan_on = true; + BIT_CLR(m_irl_pending , 0); + hp64k_update_irl(); + + return ret; +} + +TIMER_DEVICE_CALLBACK_MEMBER(hp64k_state::hp64k_line_sync) +{ + BIT_SET(m_irl_pending , 2); + hp64k_update_irl(); +} + +READ16_MEMBER(hp64k_state::hp64k_deltat_r) +{ + BIT_CLR(m_irl_pending , 2); + hp64k_update_irl(); + return 0; +} + +WRITE16_MEMBER(hp64k_state::hp64k_deltat_w) +{ + BIT_CLR(m_irl_pending , 2); + hp64k_update_irl(); +} + +READ16_MEMBER(hp64k_state::hp64k_slot_r) +{ + if (m_slot_select == 0x0a) { + // Slot 10 selected + // On this (fictional) slot is allocated the lower 32KW of RAM + + switch (m_slot_map) { + case 0: + // IDEN + // ID of 32KW RAM expansion + return 0x402; + + case 1: + // MAP1 + // Lower half of RAM + return m_low32k_ram[ offset ]; + + default: + // MAP2&3 + // Upper half of RAM + return m_low32k_ram[ offset + 0x4000 ]; + } + } else { + return 0; + } +} + +WRITE16_MEMBER(hp64k_state::hp64k_slot_w) +{ + if (m_slot_select == 0x0a && m_slot_map != 0) { + if (m_slot_map != 1) { + // MAP2&3 + offset += 0x4000; + } + m_low32k_ram[ offset ] &= ~mem_mask; + m_low32k_ram[ offset ] |= (data & mem_mask); + } +} + +WRITE16_MEMBER(hp64k_state::hp64k_slot_sel_w) +{ + m_slot_map = (UINT8)offset; + m_slot_select = (UINT8)((data >> 8) & 0x3f); +} + +READ16_MEMBER(hp64k_state::hp64k_flp_r) +{ + m_cpu->dmar_w(0); + + switch (offset) { + case 0: + // DMA transfer, not at TC + if (m_floppy_if_state == HP64K_FLPST_DMARD2) { + m_floppy_if_state = HP64K_FLPST_IDLE; + } else { + logerror("Read from IC=0 with floppy state %d\n" , m_floppy_if_state); + } + break; + + case 1: + if (m_floppy_if_state != HP64K_FLPST_IDLE) { + logerror("read from IC=1 with floppy state %d\n" , m_floppy_if_state); + } + break; + + case 2: + // DMA transfer, at TC + if (m_floppy_if_state == HP64K_FLPST_DMARD2) { + m_floppy_if_state = HP64K_FLPST_IDLE; + m_floppy_dmaen = false; + m_floppy_dmai = true; + } else { + logerror("Read from IC=2 with floppy state %d\n" , m_floppy_if_state); + } + break; + + default: + logerror("read from IC=%d\n" , offset); + } + + hp64k_update_floppy_irq(); + + return ((UINT16)m_floppy_out_latch_msb << 8) | (UINT16)m_floppy_out_latch_lsb; +} + +WRITE16_MEMBER(hp64k_state::hp64k_flp_w) +{ + m_cpu->dmar_w(0); + + if (offset == 3) { + return; + } + + m_floppy_in_latch_msb = (UINT8)(data >> 8); + m_floppy_in_latch_lsb = (UINT8)data; + + switch (offset) { + case 0: + // DMA transfer, not at TC + if (m_floppy_if_state == HP64K_FLPST_DMAWR1) { + m_fdc->data_w(~m_floppy_in_latch_msb); + m_floppy_if_state = HP64K_FLPST_DMAWR2; + } else { + logerror("write to IC=0 with floppy state %d\n" , m_floppy_if_state); + } + break; + + case 1: + if (m_floppy_if_state != HP64K_FLPST_IDLE) { + logerror("write to IC=1 with floppy state %d\n" , m_floppy_if_state); + } + // I/F control register + m_floppy_if_ctrl = m_floppy_in_latch_msb; + if (BIT(m_floppy_if_ctrl , 4)) { + // FDC reset + m_fdc->soft_reset(); + } + if (BIT(m_floppy_if_ctrl , 7)) { + // Interrupt reset + m_floppy_dmai = false; + m_floppy_mdci = false; + } + if (BIT(m_floppy_if_ctrl , 3)) { + // Write (to either FDC or drive control) + if (BIT(m_floppy_if_ctrl , 2)) { + // FDC + m_fdc->gen_w(~m_floppy_if_ctrl & 3 , ~m_floppy_in_latch_lsb); + } else { + // Drive control + m_floppy_drv_ctrl = m_floppy_in_latch_lsb; + hp64k_update_drv_ctrl(); + } + } else { + // Read + if (BIT(m_floppy_if_ctrl , 2)) { + // FDC + m_floppy_out_latch_lsb = ~m_fdc->gen_r(~m_floppy_if_ctrl & 3); + } else { + // Drive control + m_floppy_out_latch_lsb = m_floppy_drv_ctrl; + } + } + // MSB of output latch is always filled with status register + m_floppy_out_latch_msb = m_floppy_status; + m_floppy_dmaen = BIT(m_floppy_if_ctrl , 5) != 0; + hp64k_update_floppy_dma(); + break; + + case 2: + // DMA transfer, at TC + if (m_floppy_if_state == HP64K_FLPST_DMAWR1) { + m_fdc->data_w(~m_floppy_in_latch_msb); + m_floppy_if_state = HP64K_FLPST_DMAWR2; + m_floppy_dmaen = false; + m_floppy_dmai = true; + } else { + logerror("write to IC=2 with floppy state %d\n" , m_floppy_if_state); + } + break; + } + + hp64k_update_floppy_irq(); +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_flp_drq_w) +{ + m_floppy_drq = state; + hp64k_update_floppy_dma(); +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_flp_intrq_w) +{ + if (state && !m_floppy_intrq && !BIT(m_floppy_if_ctrl , 7)) { + m_floppy_mdci = true; + hp64k_update_floppy_irq(); + } + m_floppy_intrq = state; +} + +void hp64k_state::hp64k_update_floppy_dma(void) +{ + if (m_floppy_drq && (m_floppy_dmaen || m_floppy_if_state != HP64K_FLPST_IDLE)) { + switch (m_floppy_if_state) { + case HP64K_FLPST_IDLE: + if (BIT(m_floppy_if_ctrl , 6)) { + // DMA writes + m_cpu->dmar_w(1); + m_floppy_if_state = HP64K_FLPST_DMAWR1; + } else { + // DMA reads + m_floppy_out_latch_msb = ~m_fdc->data_r(); + m_floppy_if_state = HP64K_FLPST_DMARD1; + } + break; + + case HP64K_FLPST_DMAWR2: + m_fdc->data_w(~m_floppy_in_latch_lsb); + m_floppy_if_state = HP64K_FLPST_IDLE; + break; + + case HP64K_FLPST_DMARD1: + m_floppy_out_latch_lsb = ~m_fdc->data_r(); + m_cpu->dmar_w(1); + m_floppy_if_state = HP64K_FLPST_DMARD2; + break; + + default: + logerror("DRQ with floppy state %d\n" , m_floppy_if_state); + } + } +} + +void hp64k_state::hp64k_update_floppy_irq(void) +{ + if (m_floppy_dmai) { + BIT_SET(m_floppy_status , 6); + } else { + BIT_CLR(m_floppy_status , 6); + } + if (m_floppy_mdci) { + BIT_SET(m_floppy_status , 7); + } else { + BIT_CLR(m_floppy_status , 7); + } + + bool ir4 = m_floppy_dmai || m_floppy_mdci || + (BIT(m_floppy_status , 2) && !BIT(m_floppy_drv_ctrl , 0)) || + (BIT(m_floppy_status , 5) && !BIT(m_floppy_drv_ctrl , 3)); + + if (ir4) { + BIT_SET(m_irl_pending , 4); + } else { + BIT_CLR(m_irl_pending , 4); + } + + hp64k_update_irl(); +} + +void hp64k_state::hp64k_update_drv_ctrl(void) +{ + floppy_image_device *floppy0 = m_floppy0->get_device(); + floppy_image_device *floppy1 = m_floppy1->get_device(); + + floppy0->mon_w(BIT(m_floppy_drv_ctrl , 1)); + floppy1->mon_w(BIT(m_floppy_drv_ctrl , 4)); + floppy0->ss_w(!BIT(m_floppy_drv_ctrl , 7)); + floppy1->ss_w(!BIT(m_floppy_drv_ctrl , 7)); + + if (BIT(m_floppy_drv_ctrl , 2)) { + BIT_CLR(m_floppy_status , 2); + } + if (BIT(m_floppy_drv_ctrl , 5)) { + BIT_CLR(m_floppy_status , 5); + } + hp64k_update_floppy_irq(); + + // Drive selection logic: + // m_floppy_drv_ctrl + // Bit 3 0 - Drive selected + // ======================== + // 0 0 - Invalid:both drives selected. Signals to/from drive 1 are routed to FDC anyway. + // 0 1 - Drive 1 + // 1 0 - Drive 0 + // 1 1 - None + floppy_image_device *new_drive; + + if (!BIT(m_floppy_drv_ctrl , 3)) { + new_drive = m_floppy1->get_device(); + } else if (!BIT(m_floppy_drv_ctrl , 0)) { + new_drive = m_floppy0->get_device(); + } else { + new_drive = NULL; + } + + if (new_drive != m_current_floppy) { + m_fdc->set_floppy(new_drive); + + floppy0->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(hp64k_state::hp64k_floppy_idx_cb) , this)); + floppy1->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(hp64k_state::hp64k_floppy_idx_cb) , this)); + + floppy0->setup_wpt_cb(floppy_image_device::wpt_cb(FUNC(hp64k_state::hp64k_floppy_wpt_cb) , this)); + floppy1->setup_wpt_cb(floppy_image_device::wpt_cb(FUNC(hp64k_state::hp64k_floppy_wpt_cb) , this)); + + m_current_floppy = new_drive; + } +} + +WRITE8_MEMBER(hp64k_state::hp64k_floppy0_rdy) +{ + if (data) { + BIT_CLR(m_floppy_status , 0); + } else { + BIT_SET(m_floppy_status , 0); + } +} + +WRITE8_MEMBER(hp64k_state::hp64k_floppy1_rdy) +{ + if (data) { + BIT_CLR(m_floppy_status , 3); + } else { + BIT_SET(m_floppy_status , 3); + } +} + +void hp64k_state::hp64k_floppy_idx_cb(floppy_image_device *floppy , int state) +{ + if (floppy == m_floppy0->get_device()) { + m_ss0->a_w(machine().driver_data()->generic_space() , 0 , !state); + } else if (floppy == m_floppy1->get_device()) { + m_ss1->a_w(machine().driver_data()->generic_space() , 0 , !state); + } + + if (floppy == m_current_floppy) { + m_fdc->index_callback(floppy , state); + } +} + +void hp64k_state::hp64k_floppy_wpt_cb(floppy_image_device *floppy , int state) +{ + if (floppy == m_floppy0->get_device()) { + logerror("floppy0_wpt %d\n" , state); + if (m_floppy0_wpt && !state) { + BIT_SET(m_floppy_status , 2); + hp64k_update_floppy_irq(); + } + if (state) { + BIT_SET(m_floppy_status, 1); + } else { + BIT_CLR(m_floppy_status, 1); + } + m_floppy0_wpt = state; + } else if (floppy == m_floppy1->get_device()) { + logerror("floppy1_wpt %d\n" , state); + if (m_floppy1_wpt && !state) { + BIT_SET(m_floppy_status , 5); + hp64k_update_floppy_irq(); + } + if (state) { + BIT_SET(m_floppy_status, 4); + } else { + BIT_CLR(m_floppy_status, 4); + } + m_floppy1_wpt = state; + } +} + +READ16_MEMBER(hp64k_state::hp64k_usart_r) +{ + UINT16 tmp; + + if ((offset & 1) == 0) { + tmp = m_uart->status_r(space , 0); + } else { + tmp = m_uart->data_r(space , 0); + } + + // bit 8 == bit 7 rear panel switches (modem/terminal) ??? + + tmp |= (m_rs232_sw->read() << 8); + + if (BIT(m_rear_panel_sw->read() , 7)) { + BIT_SET(tmp , 8); + } + + return tmp; +} + +WRITE16_MEMBER(hp64k_state::hp64k_usart_w) +{ + if ((offset & 1) == 0) { + m_uart->control_w(space , 0 , (UINT8)(data & 0xff)); + } else { + m_uart->data_w(space , 0 , (UINT8)(data & 0xff)); + } +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_rxrdy_w) +{ + if (state) { + BIT_SET(m_irl_pending , 6); + } else { + BIT_CLR(m_irl_pending , 6); + } + + hp64k_update_irl(); +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_txrdy_w) +{ + if (state) { + BIT_SET(m_irl_pending , 5); + } else { + BIT_CLR(m_irl_pending , 5); + } + + hp64k_update_irl(); +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_txd_w) +{ + m_txd_state = state; + if (m_loopback) { + m_uart->write_rxd(state); + } + m_rs232->write_txd(state); +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_dtr_w) +{ + m_dtr_state = state; + if (m_loopback) { + m_uart->write_dsr(state); + } + m_rs232->write_dtr(state); +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_rts_w) +{ + if (BIT(m_s5_sw->read() , 0)) { + // Full duplex, RTS/ = 0 + state = 0; + } + m_rts_state = state; + if (m_loopback) { + m_uart->write_cts(state); + } + m_rs232->write_rts(state); +} + +WRITE16_MEMBER(hp64k_state::hp64k_loopback_w) +{ + m_loopback = BIT(data , 11); + hp64k_update_loopback(); +} + +void hp64k_state::hp64k_update_loopback(void) +{ + if (m_loopback) { + m_uart->write_rxd(m_txd_state); + m_uart->write_dsr(m_dtr_state); + m_uart->write_cts(m_rts_state); + } else { + m_uart->write_rxd(m_rs232->rxd_r()); + m_uart->write_dsr(m_rs232->dcd_r()); + m_uart->write_cts(m_rs232->cts_r()); + } +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_rxd_w) +{ + if (!m_loopback) { + m_uart->write_rxd(state); + } +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_dcd_w) +{ + if (!m_loopback) { + m_uart->write_dsr(state); + } +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_cts_w) +{ + if (!m_loopback) { + m_uart->write_cts(state); + } +} + +WRITE16_MEMBER(hp64k_state::hp64k_beep_w) +{ + if (!BIT(offset , 0)) { + m_beeper->set_state(1); + // Duration is bogus: in the real hw envelope decays exponentially with RC=~136 ms + m_beep_timer->adjust(attotime::from_msec(130)); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(hp64k_state::hp64k_beeper_off) +{ + m_beeper->set_state(0); +} + +WRITE_LINE_MEMBER(hp64k_state::hp64k_baud_clk_w) +{ + if (!m_16x_clk) { + if (state && !m_baud_clk) { + m_16x_div++; + } + m_baud_clk = !!state; + state = BIT(m_16x_div , 3); + } + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + +static INPUT_PORTS_START(hp64k) + // Keyboard is arranged in a 8 x 16 matrix. Of the 128 possible positions, only 77 are used. + // For key arrangement on the matrix, see [1] pg 334 + // Keys are mapped on bit b of KEYn + // where b = (row & 1) << 4 + column, n = row >> 1 + // column = [0..15] + // row = [0..7] + PORT_START("KEY0") + PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_UNUSED) + + PORT_START("KEY1") + PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("RECALL") + PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("CLRLINE") + PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("CAPS") + PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_NAME("RESET") + PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("SK1") + PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("SK2") + PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("SK3") + PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("SK4") + PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("SK5") + PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("SK6") + PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("SK7") + PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("SK8") + PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_UNUSED) + + PORT_START("KEY2") + PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INSCHAR") + PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DELCHAR") + PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('_') PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("ROLLUP") + PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("NEXTPG") + + PORT_START("KEY3") + PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) + PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("ROLLDN") + PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("PREVPG") + + PORT_START("rear_sw") + PORT_DIPNAME(0x8000 , 0x8000 , "E9-6 jumper") + PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) + PORT_DIPSETTING(0x8000 , DEF_STR(No)) + PORT_DIPNAME(0x4000 , 0x4000 , "E9-5 jumper") + PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) + PORT_DIPSETTING(0x4000 , DEF_STR(No)) + PORT_DIPNAME(0x2000 , 0x2000 , "E9-4 jumper") + PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) + PORT_DIPSETTING(0x2000 , DEF_STR(No)) + PORT_DIPNAME(0x1000 , 0x1000 , "E9-3 jumper") + PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) + PORT_DIPSETTING(0x1000 , DEF_STR(No)) + PORT_DIPNAME(0x0800 , 0x0800 , "E9-2 jumper") + PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) + PORT_DIPSETTING(0x0800 , DEF_STR(No)) + PORT_DIPNAME(0x0400 , 0x0400 , "E9-1 jumper") + PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) + PORT_DIPSETTING(0x0400 , DEF_STR(No)) + PORT_DIPNAME(0x0018 , 0x0000 , "System source") + PORT_DIPLOCATION("S1:!7,!6") + PORT_DIPSETTING(0x0000 , "Sys bus") + PORT_DIPSETTING(0x0008 , "Local storage-talk only") + PORT_DIPSETTING(0x0010 , "Local storage-addressable") + PORT_DIPSETTING(0x0018 , "Performance verification") + PORT_DIPNAME(0x0300 , 0x0000 , "Upper bus address (N/U)") + PORT_DIPLOCATION("S1:!2,!1") + PORT_DIPSETTING(0x0000 , "0") + PORT_DIPSETTING(0x0100 , "1") + PORT_DIPSETTING(0x0200 , "2") + PORT_DIPSETTING(0x0300 , "3") + PORT_DIPNAME(0x0007 , 0x0000 , "System bus address") + PORT_DIPLOCATION("S1:!5,!4,!3") + PORT_DIPSETTING(0x0000 , "0") + PORT_DIPSETTING(0x0001 , "1") + PORT_DIPSETTING(0x0002 , "2") + PORT_DIPSETTING(0x0003 , "3") + PORT_DIPSETTING(0x0004 , "4") + PORT_DIPSETTING(0x0005 , "5") + PORT_DIPSETTING(0x0006 , "6") + PORT_DIPSETTING(0x0007 , "7") + PORT_DIPNAME(0x0080 , 0x0000 , "RS232 mode") + PORT_DIPLOCATION("S4 IO:!8") + PORT_DIPSETTING(0x0000 , "Terminal") + PORT_DIPSETTING(0x0080 , "Modem") + + PORT_START("rs232_sw") + PORT_DIPNAME(0xc0 , 0x00 , "Stop bits") + PORT_DIPLOCATION("S4 IO:!2,!1") + PORT_DIPSETTING(0x00 , "Invalid") + PORT_DIPSETTING(0x40 , "1") + PORT_DIPSETTING(0x80 , "1.5") + PORT_DIPSETTING(0xc0 , "2") + PORT_DIPNAME(0x20 , 0x00 , "Parity") + PORT_DIPLOCATION("S4 IO:!3") + PORT_DIPSETTING(0x00 , "Odd") + PORT_DIPSETTING(0x20 , "Even") + PORT_DIPNAME(0x10 , 0x00 , "Parity enable") + PORT_DIPLOCATION("S4 IO:!4") + PORT_DIPSETTING(0x00 , DEF_STR(No)) + PORT_DIPSETTING(0x10 , DEF_STR(Yes)) + PORT_DIPNAME(0x0c , 0x00 , "Char length") + PORT_DIPLOCATION("S4 IO:!6,!5") + PORT_DIPSETTING(0x00 , "5") + PORT_DIPSETTING(0x04 , "6") + PORT_DIPSETTING(0x08 , "7") + PORT_DIPSETTING(0x0c , "8") + PORT_DIPNAME(0x02 , 0x00 , "Baud rate factor") + PORT_DIPLOCATION("S4 IO:!7") + PORT_DIPSETTING(0x00 , "1x") + PORT_DIPSETTING(0x02 , "16x") + + PORT_START("s5_sw") + PORT_DIPNAME(0x01 , 0x00 , "Duplex") + PORT_DIPLOCATION("S5 IO:!1") + PORT_DIPSETTING(0x00 , "Half duplex") + PORT_DIPSETTING(0x01 , "Full duplex") + PORT_DIPNAME(0x1e , 0x00 , "Baud rate") + PORT_DIPLOCATION("S5 IO:!5,!4,!3,!2") + PORT_DIPSETTING(0x00 , "50") + PORT_DIPSETTING(0x02 , "75") + PORT_DIPSETTING(0x04 , "110") + PORT_DIPSETTING(0x06 , "134.5") + PORT_DIPSETTING(0x08 , "150") + PORT_DIPSETTING(0x0a , "300") + PORT_DIPSETTING(0x0c , "600") + PORT_DIPSETTING(0x0e , "1200") + PORT_DIPSETTING(0x10 , "1800") + PORT_DIPSETTING(0x12 , "2000") + PORT_DIPSETTING(0x14 , "2400") + PORT_DIPSETTING(0x16 , "3600") + PORT_DIPSETTING(0x18 , "4800") + PORT_DIPSETTING(0x1a , "7200") + PORT_DIPSETTING(0x1c , "9600") + PORT_DIPSETTING(0x1e , "19200") + +INPUT_PORTS_END + +static SLOT_INTERFACE_START(hp64k_floppies) + SLOT_INTERFACE("525dd" , FLOPPY_525_DD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START(hp64k , hp64k_state) + MCFG_CPU_ADD("cpu" , HP_5061_3011 , 6250000) + MCFG_CPU_PROGRAM_MAP(cpu_mem_map) + MCFG_CPU_IO_MAP(cpu_io_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(hp64k_state , hp64k_irq_callback) + MCFG_QUANTUM_TIME(attotime::from_hz(100)) + + // Actual keyboard refresh rate should be between 1 and 2 kHz + MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer" , hp64k_state , hp64k_kb_scan , attotime::from_hz(100)) + + // Line sync timer. A line frequency of 50 Hz is assumed. + MCFG_TIMER_DRIVER_ADD_PERIODIC("linesync_timer" , hp64k_state , hp64k_line_sync , attotime::from_hz(50)) + + // Clock = 25 MHz / 9 * (112/114) + MCFG_DEVICE_ADD("crtc" , I8275 , 2729045) + MCFG_VIDEO_SET_SCREEN("screen") + MCFG_I8275_CHARACTER_WIDTH(9) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(hp64k_state , crtc_display_pixels) + MCFG_I8275_DRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_drq_w)) + MCFG_I8275_VRTC_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_vrtc_w)) + + MCFG_SCREEN_ADD("screen" , RASTER) + MCFG_SCREEN_UPDATE_DEVICE("crtc" , i8275_device , screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(720 , 390) + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + MCFG_FD1791_ADD("fdc" , XTAL_4MHz / 4) + MCFG_WD_FDC_FORCE_READY + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_flp_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_flp_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0" , hp64k_floppies , "525dd" , floppy_image_device::default_floppy_formats) + MCFG_SLOT_FIXED(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1" , hp64k_floppies , "525dd" , floppy_image_device::default_floppy_formats) + MCFG_SLOT_FIXED(true) + + MCFG_DEVICE_ADD("fdc_rdy0" , TTL74123 , 0) + MCFG_TTL74123_CONNECTION_TYPE(TTL74123_NOT_GROUNDED_NO_DIODE) + MCFG_TTL74123_RESISTOR_VALUE(RES_K(68.1)) + // Warning! Duration formula is not correct for LS123, actual capacitor is 10 uF + MCFG_TTL74123_CAPACITOR_VALUE(CAP_U(16)) + MCFG_TTL74123_B_PIN_VALUE(1) + MCFG_TTL74123_CLEAR_PIN_VALUE(1) + MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITE8(hp64k_state , hp64k_floppy0_rdy)); + + MCFG_DEVICE_ADD("fdc_rdy1" , TTL74123 , 0) + MCFG_TTL74123_CONNECTION_TYPE(TTL74123_NOT_GROUNDED_NO_DIODE) + MCFG_TTL74123_RESISTOR_VALUE(RES_K(68.1)) + MCFG_TTL74123_CAPACITOR_VALUE(CAP_U(16)) + MCFG_TTL74123_B_PIN_VALUE(1) + MCFG_TTL74123_CLEAR_PIN_VALUE(1) + MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITE8(hp64k_state , hp64k_floppy1_rdy)); + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper" , BEEP , 2500) + MCFG_SOUND_ROUTE(ALL_OUTPUTS , "mono" , 1.00) + + MCFG_TIMER_DRIVER_ADD("beep_timer" , hp64k_state , hp64k_beeper_off); + + MCFG_DEVICE_ADD("baud_rate" , COM8116 , XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(hp64k_state , hp64k_baud_clk_w)); + + MCFG_DEVICE_ADD("uart" , I8251 , 0) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(hp64k_state , hp64k_rxrdy_w)); + MCFG_I8251_TXRDY_HANDLER(WRITELINE(hp64k_state , hp64k_txrdy_w)); + MCFG_I8251_TXD_HANDLER(WRITELINE(hp64k_state , hp64k_txd_w)); + MCFG_I8251_DTR_HANDLER(WRITELINE(hp64k_state , hp64k_dtr_w)); + MCFG_I8251_RTS_HANDLER(WRITELINE(hp64k_state , hp64k_rts_w)); + + MCFG_RS232_PORT_ADD("rs232" , default_rs232_devices , NULL) + MCFG_RS232_RXD_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_rxd_w)) + MCFG_RS232_DCD_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_dcd_w)) + MCFG_RS232_CTS_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_cts_w)) + +MACHINE_CONFIG_END + +ROM_START(hp64k) + ROM_REGION(0x8000 , "cpu" , ROMREGION_16BIT | ROMREGION_BE | ROMREGION_INVERT) + ROM_LOAD16_BYTE("64100_80022.bin" , 0x0000 , 0x1000 , CRC(38b2aae5) SHA1(bfd0f126bfaf3724dc501979ad2d46afc41913aa)) + ROM_LOAD16_BYTE("64100_80020.bin" , 0x0001 , 0x1000 , CRC(ac01b436) SHA1(be1e827ea1393a95abb02a52ab5cc35dc2cd96e4)) + ROM_LOAD16_BYTE("64100_80023.bin" , 0x2000 , 0x1000 , CRC(6b4bc2ce) SHA1(00e6c58ccae9640dc81cb3e92db90a8c69b02a93)) + ROM_LOAD16_BYTE("64100_80021.bin" , 0x2001 , 0x1000 , CRC(74f9d33c) SHA1(543a845a992b0ceac3e0491acdfb178df0adeb1f)) + ROM_LOAD16_BYTE("64100_80026.bin" , 0x4000 , 0x1000 , CRC(a74e834b) SHA1(a2ff9765628985d9bab4cb44ba23257a9b8d0965)) + ROM_LOAD16_BYTE("64100_80024.bin" , 0x4001 , 0x1000 , CRC(2e15a1d2) SHA1(ce4330f8f8015a26c02f0965b95baf7dfd615512)) + ROM_LOAD16_BYTE("64100_80027.bin" , 0x6000 , 0x1000 , CRC(b93c0e7a) SHA1(b239446d3d6e9d3dba6c0278b2771abe1623e1ad)) + ROM_LOAD16_BYTE("64100_80025.bin" , 0x6001 , 0x1000 , CRC(e6353085) SHA1(48d78835c798f2caf6ee539057676d4f3c8a4df9)) + + ROM_REGION(0x800 , "chargen" , 0) + ROM_LOAD("1816_1496_82S191.bin" , 0 , 0x800 , CRC(32a52664) SHA1(8b2a49a32510103ff424e8481d5ed9887f609f2f)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1979, hp64k, 0, 0, hp64k, hp64k, driver_device, 0, "HP", "HP 64000" , 0) diff --git a/src/mame/drivers/hp9845.c b/src/mame/drivers/hp9845.c new file mode 100644 index 00000000000..2d382a2d1a1 --- /dev/null +++ b/src/mame/drivers/hp9845.c @@ -0,0 +1,172 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + HP 9845 + + http://www.hp9845.net/ + +*/ + +#include "emu.h" +#include "cpu/z80/z80.h" + +class hp9845_state : public driver_device +{ +public: + hp9845_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag) + { } + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +}; + +static INPUT_PORTS_START( hp9845 ) +INPUT_PORTS_END + +UINT32 hp9845_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( hp9845a, hp9845_state ) + //MCFG_CPU_ADD("lpu", HP_5061_3010, XTAL_11_4MHz) + //MCFG_CPU_ADD("ppu", HP_5061_3011, XTAL_11_4MHz) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9845_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(560, 455) + MCFG_SCREEN_VISIBLE_AREA(0, 560-1, 0, 455-1) + + MCFG_SOFTWARE_LIST_ADD("optrom_list", "hp9845a_rom") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp9835a, hp9845_state ) + //MCFG_CPU_ADD("lpu", HP_5061_3001, XTAL_11_4MHz) + //MCFG_CPU_ADD("ppu", HP_5061_3001, XTAL_11_4MHz) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9845_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(560, 455) + MCFG_SCREEN_VISIBLE_AREA(0, 560-1, 0, 455-1) + + MCFG_SOFTWARE_LIST_ADD("optrom_list", "hp9835a_rom") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp9845b, hp9845_state ) + //MCFG_CPU_ADD("lpu", HP_5061_3001, XTAL_11_4MHz) + //MCFG_CPU_ADD("ppu", HP_5061_3001, XTAL_11_4MHz) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9845_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(560, 455) + MCFG_SCREEN_VISIBLE_AREA(0, 560-1, 0, 455-1) + + MCFG_SOFTWARE_LIST_ADD("optrom_list", "hp9845b_rom") +MACHINE_CONFIG_END + +ROM_START( hp9845a ) + ROM_REGION( 0200000, "lpu", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "09845-65544-65547-03-system_lpu.bin", 0000000, 0200000, CRC(47beb87f) SHA1(456caefacafcf19435e1e7e68b1c1e4010841664) ) + + ROM_REGION( 0200000, "ppu", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "09845-65540-65543-01-system_ppu.bin", 0000000, 0160000, CRC(bc0a34cc) SHA1(9ff215f4ba32ad85f144845d15f762a71e35588b) ) +ROM_END + +#define rom_hp9845s rom_hp9845a + +ROM_START( hp9835a ) + ROM_REGION( 0200000, "lpu", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "1818-2800-03_00-system-lpu.bin", 0000000, 020000, CRC(e0b0977a) SHA1(5afdc6c725abff70b674e46688d8ab38ccf8f3c1) ) + ROM_LOAD( "1818-2801-03_10-system-lpu.bin", 0020000, 020000, CRC(c51c1e3a) SHA1(798964fa2e7a1fc149ce4400b694630049293119) ) + ROM_LOAD( "1818-2802-03_20-system-lpu.bin", 0040000, 020000, CRC(bba70a7e) SHA1(2d488594493f8dfcd753e462414cc51c24596a2c) ) + ROM_LOAD( "1818-2803-03_30-system-lpu.bin", 0060000, 020000, CRC(65e9eba6) SHA1(a11f5d37e8ed14a428335c43e785d635b02d1129) ) + ROM_LOAD( "1818-2804-03_40-system-lpu.bin", 0100000, 020000, CRC(ef83b695) SHA1(8ca2914609ece2c9c59ebba6ece3fcbc8929aeaf) ) + ROM_LOAD( "1818-2805-03_50-system-lpu.bin", 0120000, 020000, CRC(401d539f) SHA1(00bda59f71632c4d4fc3268c04262bb81ef0eeba) ) + ROM_LOAD( "1818-2806-03_60-system-lpu.bin", 0140000, 020000, CRC(fe353db5) SHA1(0fb52d82d3743008cdebebb20c488e34ce2fca4b) ) + ROM_LOAD( "1818-2807-03_70-system-lpu.bin", 0160000, 020000, CRC(45a3cc5e) SHA1(35c9959331acf7c98ab6a880915b03e3e783a656) ) + + ROM_REGION( 0200000, "ppu", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "1818-2808-05_00-system-ppu.bin", 0000000, 020000, CRC(d0c96276) SHA1(cc578d586c4eda81469f29eb7cab7f667e0d5977) ) + ROM_LOAD( "1818-2809-05_30-system-ppu.bin", 0060000, 020000, CRC(ccdb7171) SHA1(1d24596bc1219983e7cb81f6987af094f2ca7d81) ) + ROM_LOAD( "1818-2810-05_40-system-ppu.bin", 0100000, 020000, CRC(97487d24) SHA1(823cd16671de8e6ff2c245060c99778acb6ff79c) ) + ROM_LOAD( "1818-2811-05_50-system-ppu.bin", 0120000, 020000, CRC(18aee6fd) SHA1(388d3b2a063ea2cfdfe9fb9f864fa5f08af817b0) ) + ROM_LOAD( "1818-2812-05_60-system-ppu.bin", 0140000, 020000, CRC(c0beeeae) SHA1(a5db36a7f7bad84c1013bd3ec4813c355f72427d) ) + ROM_LOAD( "1818-2813-05_70-system-ppu.bin", 0160000, 020000, CRC(75361bbf) SHA1(40f499c597da5c8c9a55a2a891976d946a54926b) ) +ROM_END + +#define rom_hp9835b rom_hp9835a + +ROM_START( hp9845b ) + ROM_REGION( 0200000, "lpu", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "1818-0823-0827-03_00-revb-system_lpu.bin", 0000000, 020000, CRC(7e49c781) SHA1(866c9ebd98d94bb6f99692e29d2d83f55b38c4b6) ) + ROM_LOAD( "1818-0823-0827-03_10-revb-system_lpu.bin", 0020000, 020000, CRC(2f819e3d) SHA1(250886378c3ce2253229997007c7bf0be80a8d1d) ) + ROM_LOAD( "1818-0824-0828-03_20-reva-system_lpu.bin", 0040000, 020000, CRC(834f7063) SHA1(5c390ed74671e4663cc80d899d07b69fd1fb4be6) ) + ROM_LOAD( "1818-0824-0828-03_20-revb-system_lpu.bin", 0040000, 020000, CRC(aa221deb) SHA1(7878643405ee45405dc5269c3b6dc9459f39437b) ) + ROM_LOAD( "1818-0824-0828-03_30-reva-system_lpu.bin", 0060000, 020000, CRC(0ebafdb2) SHA1(80733bfb7026d39a294841221d80ec40eafffe34) ) + ROM_LOAD( "1818-0824-0828-03_30-revb-system_lpu.bin", 0060000, 020000, CRC(0ebafdb2) SHA1(80733bfb7026d39a294841221d80ec40eafffe34) ) + ROM_LOAD( "1818-0825-0829-03_40-revb-system_lpu.bin", 0100000, 020000, CRC(beb09a57) SHA1(b832b995fa21c219673f0c7cf215dee70698f4f1) ) + ROM_LOAD( "1818-0825-0829-03_50-revb-system_lpu.bin", 0120000, 020000, CRC(bbb06222) SHA1(b0bfe1b48fac61eb955e27e0ddfbea020e09e0eb) ) + ROM_LOAD( "1818-0826-0830-03_60-revc-system_lpu.bin", 0140000, 020000, CRC(5c1c3abe) SHA1(fa9f99bf7c8a6df5c71e9fd8c807f0a2ff06640d) ) + ROM_LOAD( "1818-0826-0830-03_70-revc-system_lpu.bin", 0160000, 020000, CRC(0c61a266) SHA1(0cfbf482e7f8e99c87b97c77cf178682cd7af7d6) ) + + ROM_REGION( 0200000, "lpu_fast", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "1818-1506-1502-03_00-reva-system_fast_lpu.bin", 0000000, 020000, CRC(b77194d8) SHA1(6feec8605331783e6f5a2ab6d6cbd9285036e863) ) + ROM_LOAD( "1818-1506-1502-03_10-reva-system_fast_lpu.bin", 0020000, 020000, CRC(bc5557a5) SHA1(282237e561c3f2304cdeb45efa2432748581af45) ) + ROM_LOAD( "1818-1507-1503-03_20-reva-system_fast_lpu.bin", 0040000, 020000, CRC(2ebc71e2) SHA1(a2d39fb24d565465304833dfd0ff87dd5ef26fb3) ) + ROM_LOAD( "1818-1507-1503-03_30-reva-system_fast_lpu.bin", 0060000, 020000, CRC(82e56bc4) SHA1(36201f343382e533c248ddd123507a2e195cca39) ) + ROM_LOAD( "1818-1508-1504-03_40-reva-system_fast_lpu.bin", 0100000, 020000, CRC(70b0fcb0) SHA1(3f7ce60cad0ffec8344f33d584869492c7f73026) ) + ROM_LOAD( "1818-1508-1504-03_50-reva-system_fast_lpu.bin", 0120000, 020000, CRC(935fab96) SHA1(ecb1da2a0bd46e8c0da2875a1af8cf71d8f4bb56) ) + ROM_LOAD( "1818-1509-1505-03_60-reva-system_fast_lpu.bin", 0140000, 020000, CRC(f4119af7) SHA1(72a3e8b8d7d306e55f8adf0e23225bb81bc2b4ba) ) + ROM_LOAD( "1818-1509-1505-03_70-reva-system_fast_lpu.bin", 0160000, 020000, CRC(22fb0864) SHA1(4e1dce32e84ba216dbbd4116f3b22ca7f254f529) ) + + ROM_REGION( 0200000, "ppu", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "1818-0833-0837-05_40-revc-system_ppu.bin", 0100000, 020000, CRC(d790795c) SHA1(7ba1e245a98379a34833a780898a784049e33b86) ) + ROM_LOAD( "1818-0833-0837-05_40-revd-system_ppu.bin", 0100000, 020000, CRC(49897e40) SHA1(780a9973ff26d40f470e2004fccceb1019f8ba7f) ) + ROM_LOAD( "1818-0833-0837-05_50-revc-system_ppu.bin", 0120000, 020000, CRC(ef8acde4) SHA1(e68648543aac2b841b08d7758949ba1339a83701) ) + ROM_LOAD( "1818-0833-0837-05_50-revd-system_ppu.bin", 0120000, 020000, CRC(54f61d07) SHA1(f807fb8a59cd9cd221f63907e6a86948a0bf7c1d) ) + ROM_LOAD( "1818-0834-0838-05_60-revc-system_ppu.bin", 0140000, 020000, CRC(20f2100a) SHA1(9304f0b069de9233d697588328f9657dbeabc254) ) + ROM_LOAD( "1818-0834-0838-05_60-revd-system_ppu.bin", 0140000, 020000, CRC(454af601) SHA1(54b56e67e855fd2d699a0dbef0b4d2e8c150c39b) ) + ROM_LOAD( "1818-0834-0838-05_70-revc-system_ppu.bin", 0160000, 020000, CRC(43f62491) SHA1(a9489b37b3fa8768ca6e503f346bd023833ae3ac) ) + ROM_LOAD( "1818-0834-0838-05_70-revd-system_ppu.bin", 0160000, 020000, CRC(43f62491) SHA1(a9489b37b3fa8768ca6e503f346bd023833ae3ac) ) + ROM_LOAD( "1818-1899-1898-05_60-reva-system_ppu.bin", 0140000, 020000, CRC(454af601) SHA1(54b56e67e855fd2d699a0dbef0b4d2e8c150c39b) ) + ROM_LOAD( "1818-1899-1898-05_70-reva-system_ppu.bin", 0160000, 020000, CRC(049604f2) SHA1(89bfd8e086bc9365f156966b0a62c3ac720fc627) ) + + ROM_REGION( 0200000, "ppu_tops", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "1818-0831-0835-05_00-reva-tops_ppu.bin", 0000000, 020000, CRC(7ddce706) SHA1(746e34d3de52a17372af9a9eb1ed4974a4eae656) ) + ROM_LOAD( "1818-0831-0835-05_10-reva-tops_ppu.bin", 0020000, 020000, CRC(d7fc3d47) SHA1(a3d723fe62f047cb0c17d405d07bb0b08d08e830) ) + ROM_LOAD( "1818-1209-1208-05_00-revb-tops_ppu.bin", 0000000, 020000, CRC(0dc90614) SHA1(94c07553a62b2c86414bc95314601f90eb4e4022) ) + ROM_LOAD( "1818-1209-1208-05_10-revb-tops_ppu.bin", 0020000, 020000, CRC(4e362657) SHA1(b09098c0acd56b11ec3b72ff3e8b5a1e14ef3ae8) ) + ROM_LOAD( "1818-1592-1591-05_00-revb-tops_ppu.bin", 0000000, 020000, CRC(8cfe29a8) SHA1(f1007b6b1d3f2b603653880c44cec48b23701263) ) + ROM_LOAD( "1818-1592-1591-05_10-revb-tops_ppu.bin", 0020000, 020000, CRC(95048264) SHA1(36cfddef9d1289fdaf69596e10d95f88a520feae) ) + + ROM_REGION( 0200000, "ppu_kbd_us", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "1818-0832-0836-05_20-revc-keyboard_us.bin", 0040000, 020000, CRC(3bf6268a) SHA1(65d7dfeaf34c74dbc86ebe5d3bb65c6bd10163cb) ) + ROM_LOAD( "1818-0832-0836-05_30-revc-keyboard_us.bin", 0060000, 020000, CRC(2dfc619c) SHA1(5c54ff502d1344907817210bfdfcab7f8d6b61bd) ) + + ROM_REGION( 0200000, "ppu_kbd_de", ROMREGION_16BIT | ROMREGION_BE ) + ROM_LOAD( "1818-0841-0846-05_20-revc-keyboard_german.bin", 0040000, 020000, CRC(76667eca) SHA1(ac63e5d584d1f2da5668d8a9560f927f48e25e03) ) + ROM_LOAD( "1818-0841-0846-05_20-revd-keyboard_german.bin", 0060000, 020000, CRC(3bf6268a) SHA1(65d7dfeaf34c74dbc86ebe5d3bb65c6bd10163cb) ) + ROM_LOAD( "1818-0841-0846-05_30-revc-keyboard_german.bin", 0040000, 020000, CRC(2b83db22) SHA1(6eda714ce05d2d75f4c041e36b6b6df40697d94a) ) + ROM_LOAD( "1818-0841-0846-05_30-revd-keyboard_german.bin", 0060000, 020000, CRC(b4006959) SHA1(584a85f746a3b0c262fdf9e4be8e696c80cfd429) ) +ROM_END + +#define rom_hp9845t rom_hp9845b +#define rom_hp9845c rom_hp9845b + +COMP( 1978, hp9845a, 0, 0, hp9845a, hp9845, driver_device, 0, "Hewlett-Packard", "9845A", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1978, hp9845s, hp9845a, 0, hp9845a, hp9845, driver_device, 0, "Hewlett-Packard", "9845S", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1979, hp9835a, 0, 0, hp9835a, hp9845, driver_device, 0, "Hewlett-Packard", "9835A", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1979, hp9835b, hp9835a, 0, hp9835a, hp9845, driver_device, 0, "Hewlett-Packard", "9835B", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1980, hp9845b, 0, 0, hp9845b, hp9845, driver_device, 0, "Hewlett-Packard", "9845B", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1980, hp9845t, hp9845b, 0, hp9845b, hp9845, driver_device, 0, "Hewlett-Packard", "9845T", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1981, hp9845c, hp9845b, 0, hp9845b, hp9845, driver_device, 0, "Hewlett-Packard", "9845C", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/hp9k.c b/src/mame/drivers/hp9k.c new file mode 100644 index 00000000000..9fa6ae09513 --- /dev/null +++ b/src/mame/drivers/hp9k.c @@ -0,0 +1,432 @@ +// license:BSD-3-Clause +// copyright-holders:Gabriele D'Antona, F. Ulivi + +/*************************************************************************** + +HP 9816 +1982 +MESS driver by friol (dantonag (at) gmail.com) +System reference mainly from O.De Smet +Driver started on 10/01/2012 + +=== + +Memory map: + +000000-00ffff - system rom +428000-428fff - keyboard +510000-51ffff - videoram +530000-53ffff - graphic memory +5f0000-5f3fff - system PROM +xxxxxx-ffffff - system RAM + +=== + +- 0x408: startup code, 68000 registers test +- 0x1002: bootrom test +- 0x1d18: PROM test +- 0x103C: prints "bootrom failed" +- 0x1150: other boot test +- 0x1164: keyboard test +- 0x1202: post-kbd test +- 0x12c6: "loading memory" test + +=== + +TODO: boot tests fail + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "video/mc6845.h" +#include "machine/terminal.h" +//#include "machine/ins8250.h" + +#define HP9816_CHDIMX 8 +#define HP9816_CHDIMY 16 +#define HP9816_ROWX 80 +#define HP9816_ROWY 25 + +// + +static UINT8 prom16a[256] = { + 0x00,0x00, // checksum + 0x00, // 256 bytes idprom + '2', '0', '1', '0', 'A', '0', '0', '0', '0', '0', '0', // serial in ascii DDDDCSSSSSS date code, country, serial number + '9', '8', '1', '6', 'A', ' ', ' ', // product number + 0xff, // 8 bits processor board config + 0x01, // keyboard 98203B + 0x02, // CRT alpha see crtid for monitor + 0x03, // HP-IB + 0x04, // Graphics + 0xff, // end + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff,0xfe,0x00,0x00, // bottom minimun address for ram size + 0xff,0xff, // 16 required IO cards here not used + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff, + 0xff,0xff,0xff,0xff, // boot msus to try before Boot list scan + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, // Boot file name + 0x00,0x00,0x00,0x00, // delay in millisec before boot scan + 0x00, // owner byte, HP format + 0x00, // id prom revision byte : 0x00 + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, // rest reserved at 0xFF + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff +}; + +// + +class hp9k_state : public driver_device +{ +private: + + int crtc_curreg; + int crtc_addrStartHi; + int crtc_addrStartLow; + + void calc_prom_crc(UINT8* prom); + void putChar(UINT8 thec,int x,int y,bitmap_ind16 &bitmap); + +public: + hp9k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + //m_terminal(*this, TERMINAL_TAG), + m_6845(*this, "mc6845"), + m_gfxdecode(*this, "gfxdecode") + { + kbdBit=0; + crtc_curreg=0; + crtc_addrStartHi=0; + crtc_addrStartLow=0; + calc_prom_crc(prom16a); + } + + UINT8 kbdBit; + + required_device m_maincpu; + //required_device<> m_terminal; + required_device m_6845; + + UINT8 m_videoram[0x4000]; + UINT8 m_screenram[0x800]; + + DECLARE_DRIVER_INIT(hp9k); + + DECLARE_READ16_MEMBER(buserror_r); + DECLARE_WRITE16_MEMBER(buserror_w); + + DECLARE_READ16_MEMBER(hp9k_videoram_r); + DECLARE_WRITE16_MEMBER(hp9k_videoram_w); + + DECLARE_READ16_MEMBER(hp9k_prom_r); + DECLARE_WRITE16_MEMBER(hp9k_prom_w); + + DECLARE_READ16_MEMBER(keyboard_r); + DECLARE_WRITE16_MEMBER(keyboard_w); + + DECLARE_READ16_MEMBER(leds_r); + DECLARE_WRITE16_MEMBER(leds_w); + + DECLARE_WRITE8_MEMBER(kbd_put); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + required_device m_gfxdecode; +}; + +// + +void hp9k_state::calc_prom_crc(UINT8* prom) +{ + int chksum; + int i; + + chksum = 0; + for (i=0; i < 256; i+=2) + { + chksum += ((prom[i] << 8) | prom[i+1]); + if (chksum&0x10000) chksum++; + chksum&=0xffff; + } + + chksum=(chksum+1)&0xffff; + + if (chksum!=0) + { + chksum=(0x10000-chksum); + prom[0]=(UINT8)(chksum>>8); + prom[1]=(UINT8)(chksum&0xff); + } +} + +READ16_MEMBER( hp9k_state::keyboard_r ) +{ + //printf("keyboard read at [%x] mask [%x]\n",offset,mem_mask); + return 0x31; +} + +WRITE16_MEMBER( hp9k_state::keyboard_w ) +{ + //printf("keyboard write of [%x] at [%x]\n",data,offset); +} + +READ16_MEMBER( hp9k_state::leds_r ) +{ + //printf("warning: leds read at [%x] mm [%x]\n",offset,mem_mask); + return 0; +} + +WRITE16_MEMBER( hp9k_state::leds_w ) +{ + //printf("warning: leds write of [%x] at [%x] mm [%x]\n",data,offset,mem_mask); +} + +READ16_MEMBER( hp9k_state::hp9k_prom_r ) +{ + //if (mem_mask!=0xff) printf("read of PROM at [%x] mem_mask [%x]\n",offset,mem_mask); + int k=prom16a[offset&0xff]; + if (mem_mask==0xff00) return (k<<8); + else return k; + //return 0; +} + +WRITE16_MEMBER( hp9k_state::hp9k_prom_w ) +{ + //printf("Error: write to prom\n"); +} + +READ16_MEMBER( hp9k_state::hp9k_videoram_r ) +{ + offset&=0x3fff; + + //printf("videoram read at [%x] mem_mask [%x]\n",offset,mem_mask); + + if (offset==0x0001) + { + //printf("m6845 read at [%x] mem_mask [%x]\n",offset,mem_mask); + return m_6845->register_r(space,0); + } + else + { + if (mem_mask==0xff00) + { + return m_videoram[offset]<<8; + } + else + { + return m_videoram[offset]; + } + } +} + +WRITE16_MEMBER( hp9k_state::hp9k_videoram_w ) +{ + offset&=0x3fff; + + if (offset==0x0000) + { + //printf("6845 address write [%x] at [%x] mask [%x]\n",data,offset,mem_mask); + data&=0x1f; + m_6845->address_w( space, 0, data ); + crtc_curreg=data; + } + else if (offset==0x0001) + { + //printf("6845 register write [%x] at [%x] mask [%x]\n",data,offset,mem_mask); + m_6845->register_w( space, 0, data ); + if (crtc_curreg==0x0c) crtc_addrStartHi=data; + if (crtc_curreg==0x0d) crtc_addrStartLow=data; + } + else + { + //printf("videoram write [%x] at [%x]\n",data,offset); + + if (mem_mask==0xff00) + { + m_screenram[offset&0x7ff]=data>>8; + m_videoram[offset&0x3fff]=data>>8; + + //UINT8 *rom = machine().region("bootrom")->base(); + //rom[0x90B]=0x00; + } + else + { + m_screenram[offset&0x7ff]=data; + m_videoram[offset&0x3fff]=data; + } + } +} + +READ16_MEMBER(hp9k_state::buserror_r) +{ + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + return 0; +} + +WRITE16_MEMBER(hp9k_state::buserror_w) +{ + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); +} + +static ADDRESS_MAP_START(hp9k_mem, AS_PROGRAM, 16, hp9k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x000909) AM_ROM AM_REGION("bootrom",0) + AM_RANGE(0x00090a, 0x00090d) AM_READWRITE(leds_r,leds_w) + AM_RANGE(0x00090e, 0x00ffff) AM_ROM AM_REGION("bootrom",0x90e) + AM_RANGE(0x010000, 0x427fff) AM_READWRITE(buserror_r,buserror_w) + AM_RANGE(0x428000, 0x428fff) AM_READWRITE(keyboard_r,keyboard_w) + AM_RANGE(0x429000, 0x50ffff) AM_READWRITE(buserror_r,buserror_w) + AM_RANGE(0x510000, 0x51ffff) AM_READWRITE(hp9k_videoram_r,hp9k_videoram_w) + AM_RANGE(0x520000, 0x52ffff) AM_READWRITE(buserror_r,buserror_w) + AM_RANGE(0x530000, 0x53ffff) AM_RAM // graphic memory + AM_RANGE(0x540000, 0x5effff) AM_READWRITE(buserror_r,buserror_w) + AM_RANGE(0x5f0000, 0x5f3fff) AM_READWRITE(hp9k_prom_r,hp9k_prom_w) + //AM_RANGE(0x5f0000, 0x5f3fff) AM_READWRITE(buserror_r,buserror_w) + AM_RANGE(0x5f4000, 0xfbffff) AM_READWRITE(buserror_r,buserror_w) + AM_RANGE(0xFC0000, 0xffffff) AM_RAM // system ram +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( hp9k ) +INPUT_PORTS_END + + +DRIVER_INIT_MEMBER(hp9k_state,hp9k) +{ +} + +static const gfx_layout hp9k_charlayout = +{ + HP9816_CHDIMX, HP9816_CHDIMY, + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { STEP8(0,1) }, + /* y offsets */ + { STEP16(0,8) }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( hp9k ) + GFXDECODE_ENTRY( "bootrom", 0x2000, hp9k_charlayout, 0, 1 ) +GFXDECODE_END + +void hp9k_state::putChar(UINT8 thec,int x,int y,bitmap_ind16 &bitmap) +{ + const UINT8* pchar=m_gfxdecode->gfx(0)->get_data(thec); + + for (int py=0;py m_maincpu; + virtual void machine_reset(); + + optional_shared_ptr m_vram16; + optional_shared_ptr m_vram; + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 hp98544_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 hp98544_16_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ16_MEMBER(buserror16_r); + DECLARE_WRITE16_MEMBER(buserror16_w); + DECLARE_READ32_MEMBER(buserror_r); + DECLARE_WRITE32_MEMBER(buserror_w); + +private: + bool m_in_buserr; + UINT32 m_last_buserr_pc; +}; + +UINT32 hp9k3xx_state::hp98544_16_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y; + UINT16 pixels; + UINT32 m_palette[2] = { 0x00000000, 0xffffffff }; + + for (y = 0; y < 768; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 1024/2; x++) + { + pixels = m_vram16[(y * 512) + x]; + + *scanline++ = m_palette[(pixels>>8) & 1]; + *scanline++ = m_palette[(pixels & 1)]; + } + } + + return 0; +} + +UINT32 hp9k3xx_state::hp98544_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y; + UINT32 pixels; + UINT32 m_palette[2] = { 0x00000000, 0xffffffff }; + + for (y = 0; y < 768; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 1024/4; x++) + { + pixels = m_vram[(y * 256) + x]; + + *scanline++ = m_palette[(pixels>>24) & 1]; + *scanline++ = m_palette[(pixels>>16) & 1]; + *scanline++ = m_palette[(pixels>>8) & 1]; + *scanline++ = m_palette[(pixels & 1)]; + } + } + + return 0; +} + +// shared mappings for all 9000/3xx systems +static ADDRESS_MAP_START(hp9k3xx_common, AS_PROGRAM, 32, hp9k3xx_state) + AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP // writes to 1fffc are the LED + + AM_RANGE(0x00500000, 0x0050000f) AM_RAM // this is sufficient to pass the DMA test for now + + AM_RANGE(0x00510000, 0x00510003) AM_READWRITE(buserror_r, buserror_w) // no "Alpha display" + AM_RANGE(0x00538000, 0x00538003) AM_READWRITE(buserror_r, buserror_w) // no "Graphics" + AM_RANGE(0x005c0000, 0x005c0003) AM_READWRITE(buserror_r, buserror_w) // no add-on FP coprocessor + AM_RANGE(0x005f8000, 0x005f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff00ff) +ADDRESS_MAP_END + +// 9000/310 - has onboard video that the graphics card used in other 3xxes conflicts with +static ADDRESS_MAP_START(hp9k310_map, AS_PROGRAM, 16, hp9k3xx_state) + AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP // writes to 1fffc are the LED + + AM_RANGE(0x510000, 0x510003) AM_READWRITE(buserror16_r, buserror16_w) // no "Alpha display" + AM_RANGE(0x538000, 0x538003) AM_READWRITE(buserror16_r, buserror16_w) // no "Graphics" + AM_RANGE(0x5c0000, 0x5c0003) AM_READWRITE(buserror16_r, buserror16_w) // no add-on FP coprocessor + + AM_RANGE(0x5f8000, 0x5f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff) + + AM_RANGE(0x200000, 0x2fffff) AM_RAM AM_SHARE("vram16") // 98544 mono framebuffer + AM_RANGE(0x560000, 0x563fff) AM_ROM AM_REGION("graphics", 0x0000) // 98544 mono ROM + + AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(buserror16_r, buserror16_w) + AM_RANGE(0x800000, 0xffffff) AM_RAM +ADDRESS_MAP_END + +// 9000/320 +static ADDRESS_MAP_START(hp9k320_map, AS_PROGRAM, 32, hp9k3xx_state) + AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram") // 98544 mono framebuffer + AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000) // 98544 mono ROM + + AM_RANGE(0xffe00000, 0xffefffff) AM_READWRITE(buserror_r, buserror_w) + AM_RANGE(0xfff00000, 0xffffffff) AM_RAM + + AM_IMPORT_FROM(hp9k3xx_common) +ADDRESS_MAP_END + +// 9000/330 and 9000/340 +static ADDRESS_MAP_START(hp9k330_map, AS_PROGRAM, 32, hp9k3xx_state) + AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram") // 98544 mono framebuffer + AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000) // 98544 mono ROM + + AM_RANGE(0xffb00000, 0xffbfffff) AM_READWRITE(buserror_r, buserror_w) + AM_RANGE(0xffc00000, 0xffffffff) AM_RAM + + AM_IMPORT_FROM(hp9k3xx_common) +ADDRESS_MAP_END + +// 9000/370 - 8 MB RAM standard +static ADDRESS_MAP_START(hp9k370_map, AS_PROGRAM, 32, hp9k3xx_state) + AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram") // 98544 mono framebuffer + AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000) // 98544 mono ROM + + AM_RANGE(0xff700000, 0xff7fffff) AM_READWRITE(buserror_r, buserror_w) + AM_RANGE(0xff800000, 0xffffffff) AM_RAM + + AM_IMPORT_FROM(hp9k3xx_common) +ADDRESS_MAP_END + +// 9000/382 - onboard VGA compatible video (where?) +static ADDRESS_MAP_START(hp9k382_map, AS_PROGRAM, 32, hp9k3xx_state) + AM_RANGE(0xffb00000, 0xffbfffff) AM_READWRITE(buserror_r, buserror_w) + AM_RANGE(0xffc00000, 0xffffffff) AM_RAM + + AM_IMPORT_FROM(hp9k3xx_common) +ADDRESS_MAP_END + +UINT32 hp9k3xx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +/* Input ports */ +static INPUT_PORTS_START( hp9k330 ) +INPUT_PORTS_END + + +void hp9k3xx_state::machine_reset() +{ + m_in_buserr = false; + m_last_buserr_pc = 0; +} + +READ16_MEMBER(hp9k3xx_state::buserror16_r) +{ + if (m_last_buserr_pc == space.device().safe_pc()) + { + return 0; + } + + if (!m_in_buserr) + { + m_in_buserr = true; + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + m_in_buserr = false; + m_last_buserr_pc = space.device().safe_pc(); + } + return 0; +} + +WRITE16_MEMBER(hp9k3xx_state::buserror16_w) +{ + if (m_last_buserr_pc == space.device().safe_pc()) + { + return; + } + + if (!m_in_buserr) + { + m_in_buserr = true; + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + m_in_buserr = false; + m_last_buserr_pc = space.device().safe_pc(); + } +} + +READ32_MEMBER(hp9k3xx_state::buserror_r) +{ + if (m_last_buserr_pc == space.device().safe_pc()) + { + return 0; + } + + if (!m_in_buserr) + { + m_in_buserr = true; + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + m_in_buserr = false; + m_last_buserr_pc = space.device().safe_pc(); + } + return 0; +} + +WRITE32_MEMBER(hp9k3xx_state::buserror_w) +{ + if (m_last_buserr_pc == space.device().safe_pc()) + { + return; + } + + if (!m_in_buserr) + { + m_in_buserr = true; + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + m_in_buserr = false; + m_last_buserr_pc = space.device().safe_pc(); + } +} + +static MACHINE_CONFIG_START( hp9k310, hp9k3xx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68010, 10000000) + MCFG_CPU_PROGRAM_MAP(hp9k310_map) + + MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 + MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) + + MCFG_SCREEN_ADD( "screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_16_update) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + MCFG_SCREEN_REFRESH_RATE(70) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp9k320, hp9k3xx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68020FPU, 16670000) + MCFG_CPU_PROGRAM_MAP(hp9k320_map) + + MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 + MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) + + MCFG_SCREEN_ADD( "screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + MCFG_SCREEN_REFRESH_RATE(70) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp9k330, hp9k3xx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68020PMMU, 16670000) + MCFG_CPU_PROGRAM_MAP(hp9k330_map) + + MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 + MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) + + MCFG_SCREEN_ADD( "screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + MCFG_SCREEN_REFRESH_RATE(70) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp9k340, hp9k3xx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68030, 16670000) + MCFG_CPU_PROGRAM_MAP(hp9k330_map) + + MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 + MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) + + MCFG_SCREEN_ADD( "screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + MCFG_SCREEN_REFRESH_RATE(70) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp9k370, hp9k3xx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68030, 33000000) + MCFG_CPU_PROGRAM_MAP(hp9k370_map) + + MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 + MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) + + MCFG_SCREEN_ADD( "screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + MCFG_SCREEN_REFRESH_RATE(70) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp9k380, hp9k3xx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz? 33? + MCFG_CPU_PROGRAM_MAP(hp9k330_map) + + MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 + MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) + + MCFG_SCREEN_ADD( "screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + MCFG_SCREEN_REFRESH_RATE(70) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hp9k382, hp9k3xx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz? 33? + MCFG_CPU_PROGRAM_MAP(hp9k382_map) + + MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 + MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) + + MCFG_SCREEN_ADD( "screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, screen_update) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + MCFG_SCREEN_REFRESH_RATE(70) +MACHINE_CONFIG_END + +ROM_START( hp9k310 ) + ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) + ROM_LOAD16_BYTE( "1818-3771.bin", 0x000001, 0x008000, CRC(b9e4e3ad) SHA1(ed6f1fad94a15d95362701dbe124b52877fc3ec4) ) + ROM_LOAD16_BYTE( "1818-3772.bin", 0x000000, 0x008000, CRC(a3665919) SHA1(ec1bc7e5b7990a1b09af947a06401e8ed3cb0516) ) + + ROM_REGION( 0x800, "mcu", 0 ) + ROM_LOAD( "1820-4784_1.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) ) + ROM_LOAD( "1820-4784_2.bin", 0x000000, 0x000800, CRC(8defcf50) SHA1(d3abfea468a43db7c2369500a3e390e77a8e22e6) ) + + ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE ) + ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000000, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) +ROM_END + +ROM_START( hp9k320 ) + ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) + ROM_LOAD16_BYTE( "5061-6538.bin", 0x000001, 0x004000, CRC(d6aafeb1) SHA1(88c6b0b2f504303cbbac0c496c26b85458ac5d63) ) + ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) ) + ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) ) + ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) ) + + ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) + ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) +ROM_END + +ROM_START( hp9k330 ) + ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) + ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) ) + ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) ) + + ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) + ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) +ROM_END + +ROM_START( hp9k340 ) + ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) + ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) ) + ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) ) + + ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) + ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) +ROM_END + +ROM_START( hp9k370 ) + ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) + ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) ) + ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) ) + + ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) + ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) +ROM_END + +ROM_START( hp9k380 ) + ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) + ROM_LOAD16_WORD_SWAP( "1818-5062_98754_9000-380_27c210.bin", 0x000000, 0x020000, CRC(500a0797) SHA1(4c0a3929e45202a2689e353657e5c4b58ff9a1fd) ) + + ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) + ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) +ROM_END + +ROM_START( hp9k382 ) + ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) + ROM_LOAD16_WORD_SWAP( "1818-5468_27c1024.bin", 0x000000, 0x020000, CRC(d1d9ef13) SHA1(6bbb17b9adad402fbc516dc2f3143e9c38ceef8e) ) + + ROM_REGION( 0x2000, "unknown", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) + ROM_LOAD( "1818-5282_8ce61e951207_28c64.bin", 0x000000, 0x002000, CRC(740442f3) SHA1(ab65bd4eec1024afb97fc2dd3bd3f017e90f49ae) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, hp9k310, 0, 0, hp9k310, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/310", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1985, hp9k320, 0, 0, hp9k320, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/320", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1987, hp9k330, 0, 0, hp9k330, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/330", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1989, hp9k340, hp9k330,0, hp9k340, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/340", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1988, hp9k370, hp9k330,0, hp9k370, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/370", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1991, hp9k380, 0, 0, hp9k380, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/380", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1991, hp9k382, 0, 0, hp9k382, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/382", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/hp_ipc.c b/src/mame/drivers/hp_ipc.c new file mode 100644 index 00000000000..1eddffdf46f --- /dev/null +++ b/src/mame/drivers/hp_ipc.c @@ -0,0 +1,358 @@ +// license:BSD-3-Clause +// copyright-holders: +/****************************************************************************** + + +Integral Personal Computer (HP9807A) +Hewlett-Packard, 1985 + +This is a portable mains-powered UNIX workstation computer system produced by Hewlett-Packard and launched in 1985 +Basic hardware specs are.... +- 68000 CPU at 7.96MHz +- 9" amber electro-luminescent display with a resolution of 255*512 pixels or up to 85 characters x 31 lines (default=80*24) with + dedicated 32Kb display memory +- Internal 3.5" floppy disk drive with the following specification.... + Encoding: Double Density HP MFM Format + Rotational speed: 600 RPM + Transfer speed: 62.5kB/second + Capacity: 709Kb (709632 bytes) + Bytes per sector: 512 + Sectors per track: 9 + Total tracks per surface: 80, Available: 77, Spare: 2, Wear: 1 + Surfaces: 2 + Interleave: 1 +- HP ThinkJet ink-jet printer integrated into the top of the case. This is a modified HP2225B Thinkjet printer +- 90-key detachable keyboard +- ROM: up to 512Kb standard and an additional 512Kb of option ROM +- RAM: 512Kb, arranged as 256Kbx16. RAM is expandable externally to 7Mb +- Real Time Clock +- Speaker +- External I/O bus with two I/O ports for interfaces and memory modules. Expandable to maximum 10 ports with two 5-port Bus Expander Modules +- HP-IB (IEEE-488) bus +- Runs the HP-UX Operating System III or System V (in ROM) + + +PCB Layouts +=========== + +CPU/Memory Board (LOGIC A PCA) +---------------- + +HP Part# 00095-60953 + |---------------------------------------------------------------------------------| + | 15.92MHz J1 J2 | + |LS74 | + | |---| | + | |T | | + | |M | | + | |S | | + | |4 | |-------------------------| | +|--------------------| |5 | | 68000 | | +| |0 | | | | +| MB81256 MB81256 |0 | |-------------------------| | +| |A | | +| MB81256 MB81256 |---| | +| |----------------J3-----------------| | +| MB81256 MB81256 | | | +| | | | +| MB81256 MB81256 | | | +| | | | +| MB81256 MB81256 | | | +| | | | +| MB81256 MB81256 | | | +| |----------------J4-----------------| | +| MB81256 MB81256 | +| U58 U60 | +| MB81256 MB81256 555 | +| | +| | +| | +| J5 J6 J7 | +|------------------------------------------------------------------------------------------------------| +Notes: + 68000 - 68000 CPU at U7. Clock input 7.96MHz [15.92/2] (DIP64) + LS74 - 74LS74 at U2 provides system clock dividers /4 /2 + MB81256 - Fujitsu MB81256 256Kx1 DRAM. Total RAM 512Kx8/256Kx16. HP part# 1818-3308. U20-U35 (DIP16) + TMS4500 - Texas Instruments TMS4500A DRAM Controller at U4. Clock input 3.98MHz [15.92/4] (DIP40) + U58 - HP-HIL Keyboard Interface 'Cerberus'. Clock input on pin 24 is unknown (DIP24) + U60 - Unknown IC used as an interrupt encoder. Possibly a logic chip? (DIP20) + 555 - 555 Timer + J1/J2 - Connectors joining to LOGIC B PCA (logic A to logic B bus) + J3/J4 - Connectors for ROM board + J5 - Power input connector from power supply PCB + J6 - 64-pin external I/O bus. This is connected to the I/O backplane PCB mounted at the rear of the case using a ribbon cable + J7 - 10 pin connector. Labelled on schematics as LOOP0 In/Out and LOOP1 In/Out. Connected to 'Cerberus' IC. Possibly for more input devices? + + +Interface & Control Board (LOGIC B PCA) +------------------------- + +HP Part# 00095-60952 +00095-60107 BD REV A +00095-60149 ASSY LOGIC B +|---------------------------------------------------------------------------------| +|SPEAKER NS58167A J11 J10 | +| LM358 32.768kHz | +| | +| 16Kx4 16Kx4 16Kx4 16Kx4 | +| ROM | +| | +| BT1 HP-IL(2) GPU | +| |--------------------| +| 1Kb | +| COP452 | +| | +| | +| WD2797 | +| LM393 HP-IL(1) | +| | +| LS193 | +| | +| | +| | +| LS74 24MHz LS161 | +| J2| +| | +| TMS9914 | +| | +| | +| 75162 75160 | +| | +| J14 J6 J5 J4 J3 J7 J1 J8 J9 J12 | +|------------------------------------------------------------------------------------------------------| +Notes: + GPU - GPU (Graphics Processor) at U1. Clock input 3MHz [24/8]. VSync on pin 45, HSync on pin 46 (DIP48) + 16Kx4 - 16Kx4 DRAM, organised as 32Kx8bit/16Kx16bit at U3, U4, U5 & U6. Chip type unknown, likely Fujitsu MB81416 (DIP18) + WD2797 - Western Digital WD2797 Floppy Disk Controller at U18. Clock input 2MHz [24/2/3/2] (DIP40) + HP-IL(1) - HP-IL 1LJ7-0015 'Saturn' Thinkjet Printer Controller IC at U28. Clock input 3MHz on pin 9 [24/8] (DIP48) + HP-IL(2) - HP-IL Interface IC at U31. Clock input 2MHz on pin 22 [24/2/3/2] (DIP28) + 1Kb - 1Kb RAM at U27 for printer buffer (DIP28, type unknown, very old, with only DATA0,1,2,3, C/D and DIN,DOUT) + ROM - 16Kb (2Kx8?) Some kind of very early DIP28 PROM/ROM? Same pinout as 1Kb RAM above. Holds the character font table for the printer + Four versions of this ROM exist, one each for Japan/Arabic/Hebrew and one for all other regions + NS58167A - National Semiconductor NS58167A Clock Controller RTC at U44. Clock input 32.768kHz (DIP24) + LM358 - National Semiconductor LM358 Operational Amplifier at U40 (DIP8) + LM393 - Texas Instruments LM393 Dual Comparator at U34 (DIP8) + BT1 - 3v lithium battery + COP452 - National Semiconductor COP452 Speaker Controller at U39. Clock input 2MHz [24/2/3/2]. This IC provides programmable square wave output from 100Hz to 5000Hz (DIP14) + TMS9914 - Texas Instruments TMS9914 General Purpose Interface Bus Adapter at U41. Clock input 4MHz [24/2/3] (DIP40) + 75160 - National Semiconductor DS75160A IEEE-488 General Purpose Interface Bus Transceiver at U42 (DIP20) + 75162 - National Semiconductor DS75162A IEEE-488 General Purpose Interface Bus Transceiver at U43 (DIP22) + LS193 - 74LS193 at U9 provides the main system clock dividers /8 /4 /2 (24MHz -> 12MHz, 6MHz, 3MHz). This is also the source of the 6MHz video clock on connector J1 + LS161 - 74LS161 at U46. Takes 12MHz clock input on pin 2 and outputs 4MHz on pin 13 (i.e. /3). This is the clock source for the TMS9914 + LS74 - LS74 at U16. Takes output of 4MHz from LS161 at U46 and outputs 2MHz on pin 5 (i.e. /2). This is the source of the 2MHz clocks + J1 - Connector joining to video display assembly + J2 - Connector joining to floppy drive + J3 - Connector joining to printer front switch panel assembly (ADV/CONT/FF/ATTN) + J4 - Connector joining to printer out of paper switch connected to ATTN + J5 - Connector joining to printer carriage motor + J6 - Connector joining to printer mechanism assembly including paper motor + J7 - Connector joining to printer printhead + J8 - Connector joining to HO?E switch (? ~ M, text unreadable on schems) + J9 - Connector for ? + J10/J11 - Connectors joining to LOGIC A PCA (logic A to logic B bus) + J12 - Power input connector from power supply PCB + J14 - Fan connector + + +ROM board (Operating System ROM PCA. Assembly# HP82991A or HP82995A) +--------- + +|----------------J3-----------------| +| | +| | +| | +|J1 U1 U2 U3 U4 J2| +| | +| | +| | +|----------------J4-----------------| +Notes: + J1/J2 - 20 pin connector joining to 'Option ROM PCA' + J3/J4 - 20 pin connector joining to 'LOGIC A PCA' + U1-U4 - 28 pin EPROM/MASKROM 0L/1L/0H/1H (note 1Mbit: 128Kx8 28 pin) + + +ROM board (Option ROM PCA) +--------- +Note this PCB plugs in upside-down on top of the Operating System ROM PCB + +|----------------J4-----------------| +| | +| | +| | +|J1 U1 U2 U3 U4 J2| +| | +| | +| | +|----------------J3-----------------| +Notes: + J1/J2 - 20 pin connector joining to 'Operating System ROM PCA' + J3/J4 - 20 pin connector joining to 'LOGIC A PCA' + U1-U4 - 28 pin EPROM/MASKROM 0L/1L/0H/1H (note 1Mbit: 128Kx8 28 pin) + + +Physical Memory Map +=================== +000000-07FFFF - Internal ROM (Operating System PCA 512Kb) +080000-0FFFFF - Internal ROM (Option ROM PCA 512Kb) +100000-4FFFFF - External ROM modules (up to 4Mb) +500000-5FFFFF - Reserved 1Mb +600000-6FFFFF - Internal I/O 1Mb + + Address Port Use + ------------------------- + 600000-60FFFF 0 MMU + 610000-61FFFF 1 Disk Drive + 620000-62FFFF 2 Display + 630000-63FFFF 3 HP-IB + 640000-64FFFF 4 RTC + 650000-65FFFF 5 Printer + 660000-66FFFF 6 Keyboard + 670000-67FFFF 7 Speaker + 680000-68FFFF 8 Reserved + 690000-69FFFF 9 Reserved + 6A0000-6AFFFF 10 Reserved + 6B0000-6BFFFF 11 Reserved + 6C0000-6CFFFF 12 Reserved + 6D0000-6DFFFF 13 Reserved + 6E0000-6EFFFF 14 Reserved + 6F0000-6FFFFF 15 Reserved + +700000-7FFFFF - External I/O 1Mb + + Address Port Use + ------------------------- + 700000-70FFFF 16 Mainframe Port A + 710000-71FFFF 17 Mainframe Port B + 720000-72FFFF 18 Bus Expander Port A1 + 730000-73FFFF 19 Bus Expander Port A2 + 740000-74FFFF 20 Bus Expander Port A3 + 750000-75FFFF 21 Bus Expander Port A4 + 760000-76FFFF 22 Bus Expander Port A5 + 770000-77FFFF 23 Reserved + 780000-78FFFF 24 Reserved + 790000-79FFFF 25 Reserved + 7A0000-7AFFFF 26 Bus Expander Port B1 + 7B0000-7BFFFF 27 Bus Expander Port B2 + 7C0000-7CFFFF 28 Bus Expander Port B3 + 7D0000-7DFFFF 29 Bus Expander Port B4 + 7E0000-7EFFFF 30 Bus Expander Port B5 + 7F0000-7FFFFF 31 Reserved + +800000-EFFFFF - External RAM modules (up to 7Mb) +F00000-F7FFFF - Internal RAM 512Kb +F80000-FFFFFF - Reserved 512Kb + +Access to 800000-FFFFFF can be remapped by the MMU registers. + + +Interrupts +---------- +High Priority 7 - Soft reset from keyboard (NMI) + /\ 6 - RTC or NBIR3 (external I/O) + || 5 - Disc Drive or NBIR2 (external I/O) + || 4 - GPU or NBIR1 (external I/O) + || 3 - HP-IB, printer or NBIR0 (external I/O) + \/ 2 - HP-HIL devices (keyboard/mouse) +Low Priority 1 - RTC + +Note external interrupt lines NBIR0 to NBIR3 can be asserted by an interface connected to the external I/O port + + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" + + +class hp_ipc_state : public driver_device +{ +public: + hp_ipc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + + DECLARE_WRITE16_MEMBER(mmu_w); + DECLARE_READ16_MEMBER(ram_r); + DECLARE_WRITE16_MEMBER(ram_w); + +private: + required_device m_maincpu; + + UINT32 m_mmu[4]; + UINT16 m_internal_ram[0x40000]; + + inline UINT32 get_ram_address(offs_t offset) { return (m_mmu[(m_maincpu->get_fc() >> 1) & 3] + offset) & 0x3FFFFF; } +}; + + +static ADDRESS_MAP_START(hp_ipc_mem, AS_PROGRAM, 16, hp_ipc_state) + AM_RANGE(0x000000, 0x07FFFF) AM_ROM + AM_RANGE(0x600000, 0x60FFFF) AM_WRITE(mmu_w) + AM_RANGE(0x800000, 0xFFFFFF) AM_READWRITE(ram_r, ram_w) +ADDRESS_MAP_END + + +static INPUT_PORTS_START(hp_ipc) +INPUT_PORTS_END + + +WRITE16_MEMBER(hp_ipc_state::mmu_w) +{ + logerror("mmu_w: offset = %08x, data = %04x, register = %d, data_to_add = %08x\n", offset, data, offset & 3, (data & 0xFFF) << 10); + m_mmu[offset & 3] = (data & 0xFFF) << 10; +} + + +READ16_MEMBER(hp_ipc_state::ram_r) +{ + UINT32 ram_address = get_ram_address(offset); + + //logerror("RAM read, offset = %08x, ram address = %08X\n", offset, ram_address); + + if (ram_address < 0x380000) + { + // External RAM modules + } + else if (ram_address < 0x3c0000) + { + // Internal RAM + return m_internal_ram[offset & 0x3ffff]; + } + return 0xffff; +} + + +WRITE16_MEMBER(hp_ipc_state::ram_w) +{ + UINT32 ram_address = get_ram_address(offset); + + //logerror("RAM write, offset = %08x, ram address = %08X, data = %04x\n", offset, ram_address, data); + + if (ram_address < 0x380000) + { + // External RAM modules + } + else if (ram_address < 0x3c0000) + { + // Internal RAM + m_internal_ram[offset & 0x3ffff] = data; + } +} + + +static MACHINE_CONFIG_START(hp_ipc, hp_ipc_state) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 15920000 / 2) + MCFG_CPU_PROGRAM_MAP(hp_ipc_mem) +MACHINE_CONFIG_END + + +ROM_START(hp_ipc) + ROM_REGION(0x100000, "maincpu" , 0) + ROM_LOAD("hp ipc os 82991A.bin", 0x00000, 0x80000, BAD_DUMP CRC(df45a37b) SHA1(476af9923bca0d2d0f40aeb81be5145ca76fddf5)) // Should be spread across 4 x 128K ROMs +ROM_END + + +COMP(1985, hp_ipc, 0, 0, hp_ipc, hp_ipc, driver_device, 0, "HP", "Integral Personal Computer", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/hprot1.c b/src/mame/drivers/hprot1.c new file mode 100644 index 00000000000..6cff402b711 --- /dev/null +++ b/src/mame/drivers/hprot1.c @@ -0,0 +1,381 @@ +// license:GPL-2.0+ +// copyright-holders: Felipe Sanches +/*************************************************************************** + + HENRY Prot I/II - brazilian document timestamp printers + http://www.dataponto.com.br/protocoladores-prot1.html + + Driver by Felipe Sanches + Technical info at https://www.garoa.net.br/wiki/HENRY + + Changelog: + + 2014 JUN 13 [Felipe Sanches]: + * new derivative "CARD I PCB rev.08A" + * new derivative "CARD II PCB rev.6" + * fixed LCD rendering (now both lines are displayed properly) + * inverted logic of the inputs so that now we can navigate the menu + + 2014 JAN 03 [Felipe Sanches]: + * Initial driver skeleton + * Address lines bitswaping + * LCD works. We can see boot messages. + * Inputs are not working correctly + +TO-DO list: + +======= hprotr8a =========== +Loops during boot displaying an error message related to low power supply voltage. +We need to emulate the ADM695AN chip (Microprocessor Supervisory Circuits) in order to properly boot the device. + +======= hprot2r6 =========== +There are unhandled memory writes at 0xE000 and 0xA000 + +LCD commands are sent, but nothing shows up on screen. +The commands sent are supposed to display the message: + +"*Pouca Energia*" (LCD cmds range: 80-8F) (cmds logged but not displayed on screen) +"* no Sistema *" (LCD cmds range: C0-CF) (cmds logged but not displayed on screen) + +which means something like "too little energy for the system to operate". +We need to emulate the ADM695AN chip (Microprocessor Supervisory Circuits) in order to properly boot the device. + +Infinite loop is reached at address 0x7699 +======= hprot1 =========== + + There seems to be an eeprom or a realtime clock placed at U2 (DIP8): + pin1 -> 8031 pin 14 (T0: Timer 0 external input) + pin2 -> crystal at X2 (labeled 32.768) + pin3 -> ? + pin4 -> GND + pin5 -> ? + pin6 -> 8031 pin 5 (Port 1 bit 4) + pin7 -> 8031 pin 4 (Port 1 bit 3) + pin8 -> VCC + +****************************************************************************/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "video/hd44780.h" +#include "sound/speaker.h" +#include "rendlay.h" + +class hprot1_state : public driver_device +{ +public: + hprot1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_lcdc(*this, "hd44780") + { } + + //DECLARE_WRITE8_MEMBER(henry_io_w); + DECLARE_READ8_MEMBER(henry_io_r); + DECLARE_DRIVER_INIT(hprot1); + DECLARE_PALETTE_INIT(hprot1); +private: + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_lcdc; +}; + +#define LOG_IO_PORTS 0 + +static ADDRESS_MAP_START(i80c31_prg, AS_PROGRAM, 8, hprot1_state) + AM_RANGE(0x0000, 0xffff) AM_ROM +ADDRESS_MAP_END + +DRIVER_INIT_MEMBER( hprot1_state, hprot1 ) +{ + int i; + UINT8 *ROM = memregion("maincpu")->base(); + UINT8 bitswapped_ROM[0x10000]; + + for(i=0x0000;i<0x10000;i++) + bitswapped_ROM[i] = ROM[i]; + + for(i=0x0000;i<0x10000;i++) + ROM[BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 3, 2, 1, 0, 4, 5, 6, 7)] = bitswapped_ROM[i]; +} + +//A4 = display RS +//A5 = display R/W +//(A11 == 0) && (A10 == 0) => display CS +//(A14 == 1) && (A15 == 1) => enable signal for the mux that selects peripherals +//11?? 00?? ??00 ???? write data +//11?? 00?? ??01 ???? write command +//11?? 00?? ??10 ???? read data +//11?? 00?? ??11 ???? read command +//mirror=0x33cf + +//write: 0xc400 => U12 (74373 - possibly for the dot matrix printhead ?) +//write: 0xc800 => U11 (74373 - possibly for the dot matrix printhead ?) +//read: 0xc020 => display +//write: 0xc000 => display +//write: 0xc010 => display + +//P1.4 => WhatchDog Input (after timeout resets CPU) + +static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, hprot1_state) + AM_RANGE(0x0000,0x7fff) AM_RAM +/*TODO: verify the mirror mask value for the HD44780 device */ + AM_RANGE(0xc000,0xc000) AM_MIRROR(0x13cf) AM_DEVWRITE("hd44780", hd44780_device, control_write) + AM_RANGE(0xc010,0xc010) AM_MIRROR(0x13cf) AM_DEVWRITE("hd44780", hd44780_device, data_write) + AM_RANGE(0xc020,0xc020) AM_MIRROR(0x13cf) AM_DEVREAD("hd44780", hd44780_device, control_read) + AM_RANGE(0xc030,0xc030) AM_MIRROR(0x13cf) AM_DEVREAD("hd44780", hd44780_device, data_read) +/*TODO: attach the watchdog/brownout reset device: + AM_RANGE(0xe000,0xe0??) AM_MIRROR(?) AM_DEVREAD("adm965an", adm965an_device, data_read) */ + + //AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(henry_io_r, henry_io_w) + AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(henry_io_r) +ADDRESS_MAP_END + +static INPUT_PORTS_START( hprot1 ) +/* FIXME: I am still unsure whether all these inputs are Active High or Active Low: */ + PORT_START("inputs") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Upper Black Button") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Lower Black Button") PORT_CODE(KEYCODE_B) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Blue Button") PORT_CODE(KEYCODE_C) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Paper Detector") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("XMIN Endstop") PORT_CODE(KEYCODE_E) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( hprot_jumpers ) +/* +There is a set of 3 jumpers that switch the communications circuitry between a +RS232 chip (U8: MAX232AN) and a differential bus transceiver (U7: SN65176BP) + +It seems that all three jumpers must select the same configuration: +eighter differential bus or RS232. +And I don't see yet how this could affect the emulation of the device, so, for now, I'll +simply leave this note here but not actually include this details in the driver code. + + PORT_START("jumpers") + PORT_DIPNAME( 0x01, 0x01, "TX") + PORT_DIPSETTING( 0x01, "differential bus") + PORT_DIPSETTING( 0x00, "RS232") + PORT_DIPNAME( 0x02, 0x02, "RX") + PORT_DIPSETTING( 0x02, "differential bus") + PORT_DIPSETTING( 0x00, "RS232") + PORT_DIPNAME( 0x04, 0x04, "CPU-TX") + PORT_DIPSETTING( 0x04, "differential bus") + PORT_DIPSETTING( 0x00, "RS232") +*/ +INPUT_PORTS_END + +/* TODO: meanings for the jumpers may be different among machines, + so we may have to have individual declarations for each board. */ +static INPUT_PORTS_START( hprot2r6 ) + PORT_INCLUDE(hprot1) + PORT_INCLUDE(hprot_jumpers) +INPUT_PORTS_END + +static INPUT_PORTS_START( hprotr8a ) + PORT_INCLUDE(hprot1) + PORT_INCLUDE(hprot_jumpers) +INPUT_PORTS_END + +void hprot1_state::machine_start() +{ +} + +void hprot1_state::machine_reset() +{ +} + +READ8_MEMBER(hprot1_state::henry_io_r) +{ + switch (offset) + { + case 0x01: + { + UINT8 value = ioport("inputs")->read(); +#if LOG_IO_PORTS + printf("value:%02X\n", value); +#endif + return value; + } + default: +#if LOG_IO_PORTS + printf("Unhandled I/O Read at offset 0x%02X (return 0)\n", offset); +#endif + return 0; + } +} + +/* +WRITE8_MEMBER(hprot1_state::henry_io_w) +{ + static UINT8 p0=0, p1=0, p2=0, p3=0; + switch (offset) + { + case 0x00: + { + if (data != p0) + { + p0=data; +#if LOG_IO_PORTS + printf("Write to P0: %02X\n", data); +#endif + } + break; + } + case 0x01: + { + if (data != p1) + { + p1=data; + if (data != 0xFF && data != 0xEF) +#if LOG_IO_PORTS + printf("Write to P1: %02X\n", data); +#endif + } + break; + } + case 0x02: + { + if (data != p2) + { + p2=data; +#if LOG_IO_PORTS + printf("Write to P2: %02X\n", data); +#endif + } + break; + } + case 0x03: + { + if (data != p3) + { + p3=data; +#if LOG_IO_PORTS + printf("Write to P3: %02X\n", data); +#endif + } + break; + } + } +} +*/ + +PALETTE_INIT_MEMBER(hprot1_state, hprot1) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static const gfx_layout henry_prot_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( hprot1 ) + GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, henry_prot_charlayout, 0, 1 ) +GFXDECODE_END + +static HD44780_PIXEL_UPDATE(hprot1_pixel_update) +{ + if ( pos < 16 && line==0 ) + { + bitmap.pix16(y, pos*6 + x) = state; + } + + if ( pos >= 64 && pos < 80 && line==0 ) + { + bitmap.pix16(y+9,(pos-64)*6 + x) = state; + } +} + +static MACHINE_CONFIG_START( hprot1, hprot1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80C31, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(i80c31_prg) + MCFG_CPU_IO_MAP(i80c31_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_SIZE(6*16, 9*2) + MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(hprot1_state, hprot1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", hprot1) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 16) + MCFG_HD44780_PIXEL_UPDATE_CB(hprot1_pixel_update) + + /* TODO: figure out which RTC chip is in use. */ + + /* TODO: emulate the ADM695AN chip (watchdog/brownout reset)*/ +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( hprotr8a, hprot1 ) + MCFG_CPU_REPLACE("maincpu", I80C31, 11059200) // value of X1 cristal on the PCB + MCFG_CPU_PROGRAM_MAP(i80c31_prg) + MCFG_CPU_IO_MAP(i80c31_io) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* TODO: add an RS232 interface (emulate MAX232N chip) + (the board has GND/VCC/RX/TX pins available in a connector) */ + + /* TODO: add an I2C interface (the board has GND/VCC/SDA/SCL pins available in a connector) */ +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( hprot2r6, hprot1 ) + MCFG_CPU_REPLACE("maincpu", I80C31, 11059200) // value of X1 cristal on the PCB + MCFG_CPU_PROGRAM_MAP(i80c31_prg) + MCFG_CPU_IO_MAP(i80c31_io) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* TODO: add an RS232 interface (emulate MAX232N chip) */ +MACHINE_CONFIG_END + +ROM_START( hprot1 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "henry_prot1_rev1_v19.bin", 0x00000, 0x10000, CRC(dd7787fd) SHA1(61a37dd406b3440d568bd6da75a9fdc8a0f0e1e3) ) +ROM_END + +ROM_START( hprotr8a ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "hprot_card1_rev08a.u2", 0x00000, 0x10000, CRC(e827480f) SHA1(bd53e6cce9a0832ca01f1a485ddaab43c0baa136) ) +ROM_END + +ROM_START( hprot2r6 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "hprot_card2_rev6.u2", 0x00000, 0x10000, CRC(791f2425) SHA1(70af8911a27921cac6d98a5cd07602a7f59c2848) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 2002, hprot1, 0, 0, hprot1, hprot1, hprot1_state, hprot1, "HENRY", "Henry Prot I v19 (REV.1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) +/* fw version: "R19" Release date: February 1st, 2002. */ + +COMP( 2006, hprotr8a, hprot1, 0, hprotr8a, hprotr8a, hprot1_state, hprot1, "HENRY", "Henry Prot CARD I (REV.08A)", MACHINE_NOT_WORKING) +/* fw version: "V6.5QI I" Release date: September 18th, 2006. */ + +COMP( 2003, hprot2r6, hprot1, 0, hprot2r6, hprot2r6, hprot1_state, hprot1, "HENRY", "Henry Prot CARD II (REV.6)", MACHINE_NOT_WORKING) +/* fw version: "V5.8CF II" Release date: June 23rd, 2003. */ diff --git a/src/mame/drivers/hpz80unk.c b/src/mame/drivers/hpz80unk.c new file mode 100644 index 00000000000..170aaabd55b --- /dev/null +++ b/src/mame/drivers/hpz80unk.c @@ -0,0 +1,159 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +HP Z80-based unknown in a large metal cage + +2012-05-25 Skeleton driver [Robbbert] + +http://www.classiccmp.org/hp/unknown Z80 computer/ + +Looks like roms are in 2 banks in range C000-FFFF. +BASIC is included, if we can find out how to access it. + +Commands: +A disassemble +D +G +H +L +M +P Read Port +R +U +W Punch papertape +X choose Q,V,R,P (Q to quit; others ask for ram and prom ranges) +Y nothing +Z nothing + + ToDo: + - Almost everything; there are a lot of I/O ports used + - Hook up rom banking + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class hpz80unk_state : public driver_device +{ +public: + hpz80unk_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_p_rom(*this, "p_rom") + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(port02_r); + DECLARE_READ8_MEMBER(port03_r); + DECLARE_READ8_MEMBER(port04_r); + DECLARE_READ8_MEMBER(portfc_r); + DECLARE_WRITE8_MEMBER(kbd_put); + required_shared_ptr m_p_rom; + UINT8 m_term_data; + UINT8 m_port02_data; + virtual void machine_reset(); +}; + +READ8_MEMBER( hpz80unk_state::port02_r ) +{ + m_port02_data ^= 1; + return m_port02_data; +} + +READ8_MEMBER( hpz80unk_state::port03_r ) +{ + return (m_term_data) ? 0xff : 0xfd; +} + +READ8_MEMBER( hpz80unk_state::port04_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( hpz80unk_state::portfc_r ) +{ + return 0xfe; // or it halts +} + +static ADDRESS_MAP_START( hpz80unk_mem, AS_PROGRAM, 8, hpz80unk_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xbfff) AM_RAM + AM_RANGE(0xc000, 0xffff) AM_ROM AM_SHARE("p_rom") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( hpz80unk_io, AS_IO, 8, hpz80unk_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x01, 0x01) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x02, 0x02) AM_READ(port02_r) + AM_RANGE(0x03, 0x03) AM_READ(port03_r) + AM_RANGE(0x04, 0x04) AM_READ(port04_r) + AM_RANGE(0xfc, 0xfc) AM_READ(portfc_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( hpz80unk ) +INPUT_PORTS_END + + +void hpz80unk_state::machine_reset() +{ + UINT8* user1 = memregion("user1")->base(); + memcpy((UINT8*)m_p_rom, user1, 0x4000); + + // this should be rom/ram banking +} + +WRITE8_MEMBER( hpz80unk_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( hpz80unk, hpz80unk_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(hpz80unk_mem) + MCFG_CPU_IO_MAP(hpz80unk_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(hpz80unk_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( hpz80unk ) + ROM_REGION( 0x8000, "user1", 0 ) + // 1st bank + ROM_LOAD( "u1", 0x0000, 0x0800, CRC(080cd04a) SHA1(42004af65d44e3507a4e0f343c5bf385b6377c40) ) + ROM_LOAD( "u3", 0x0800, 0x0800, CRC(694075e1) SHA1(3db62645ade6a7f454b2d505aecc1661284c8ce2) ) + ROM_LOAD( "u5", 0x1000, 0x0800, CRC(5573bd05) SHA1(68c8f02b3fe9d77ecb83df407ca78430e118004a) ) + ROM_LOAD( "u7", 0x1800, 0x0800, CRC(d18a304a) SHA1(69dd0486bb6e4c2a22ab9da863bfb962016a321b) ) + ROM_LOAD( "u9", 0x2000, 0x0800, CRC(f7a8665c) SHA1(e39d0ba4ce2dc773622d411a25f40a6a24b45449) ) + ROM_LOAD( "u11", 0x2800, 0x0800, CRC(6c1ac77a) SHA1(50ca04ff0a11bd1c7d96f4731cef50978266ecca) ) + ROM_LOAD( "u13", 0x3000, 0x0800, CRC(8b166911) SHA1(4301dcd6840d37ccfa5bff998a0d88bebe99dc31) ) + ROM_LOAD( "u15", 0x3800, 0x0800, CRC(c6300499) SHA1(1b62d2a85c8f0b6a817e4be73ee34e0d90515c00) ) + // 2nd bank + ROM_LOAD( "u2", 0x4000, 0x0800, CRC(080cd04a) SHA1(42004af65d44e3507a4e0f343c5bf385b6377c40) ) + ROM_LOAD( "u4", 0x4800, 0x0800, CRC(66c3745c) SHA1(d79fe764312a222ac64d325bf5f4abc7ca401d0f) ) + ROM_LOAD( "u6", 0x5000, 0x0800, CRC(80761b4c) SHA1(5f6a12fbba533308b9fe7067c67a836be436a6f0) ) + ROM_LOAD( "u8", 0x5800, 0x0800, CRC(64a2be18) SHA1(b11c08fdc9dc126038559462493f458ecdc78532) ) + ROM_LOAD( "u10", 0x6000, 0x0800, CRC(40244d09) SHA1(106f8f978de36df9f3ebbe1e2c959b60e53273a2) ) + ROM_LOAD( "u12", 0x6800, 0x0800, CRC(6eb01765) SHA1(66f9036a9f86cf3a79493330bbc06fb6932ab771) ) + ROM_LOAD( "u14", 0x7000, 0x0800, CRC(3410e682) SHA1(30d94c0c0b6478dab202a603edaccca943008e35) ) + ROM_LOAD( "u16", 0x7800, 0x0800, CRC(c03fdcab) SHA1(1081d787085add489c6e2a1d450e1a5790d18885) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, hpz80unk, 0, 0, hpz80unk, hpz80unk, driver_device, 0, "Hewlett-Packard", "unknown Z80-based mainframe", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/ht68k.c b/src/mame/drivers/ht68k.c new file mode 100644 index 00000000000..203ec4c8280 --- /dev/null +++ b/src/mame/drivers/ht68k.c @@ -0,0 +1,160 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Hawthorne Technology TinyGiant HT68k + + 29/11/2009 Skeleton driver. + +Monitor commands (from ht68k manual) (must be in Uppercase) +B Load binary file from disk. +C Compare memory. +D Display memory in Hex and ASCII. +E Examine and/or change memory (2 bytes). (. to escape) +F Fill a block of memory with a value. +G Go to an address and execute program. +K Peek. +L Load program from serial port. +M Move memory. +P Poke. +R Read binary file from disk. +S System boot. +T Test printer. +W Write binary file to disk. +X Examine long and/or change memory (4 bytes). (. to escape) + + +Lot of infos available at: http://www.classiccmp.org/cini/ht68k.htm + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "machine/mc68681.h" +#include "machine/wd_fdc.h" + +class ht68k_state : public driver_device +{ +public: + ht68k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_duart(*this, "duart68681"), + m_fdc(*this, "wd1770"), + m_floppy0(*this, "wd1770:0"), + m_floppy1(*this, "wd1770:1"), + m_floppy2(*this, "wd1770:2"), + m_floppy3(*this, "wd1770:3"), + m_floppy(NULL), + m_p_ram(*this, "p_ram") + { + } + + required_device m_maincpu; + required_device m_duart; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + floppy_image_device *m_floppy; + DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); + DECLARE_WRITE_LINE_MEMBER(duart_txb); + DECLARE_WRITE8_MEMBER(duart_output); + required_shared_ptr m_p_ram; + virtual void machine_reset(); +}; + + +static ADDRESS_MAP_START(ht68k_mem, AS_PROGRAM, 16, ht68k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_SHARE("p_ram") // 512 KB RAM / ROM at boot + //AM_RANGE(0x00080000, 0x000fffff) // Expansion + //AM_RANGE(0x00d80000, 0x00d8ffff) // Printer + AM_RANGE(0x00e00000, 0x00e00007) AM_MIRROR(0xfff8) AM_DEVREADWRITE8("wd1770", wd1770_t, read, write, 0x00ff) // FDC WD1770 + AM_RANGE(0x00e80000, 0x00e800ff) AM_MIRROR(0xff00) AM_DEVREADWRITE8("duart68681", mc68681_device, read, write, 0xff ) + AM_RANGE(0x00f00000, 0x00f07fff) AM_ROM AM_MIRROR(0xf8000) AM_REGION("user1",0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ht68k ) +INPUT_PORTS_END + +void ht68k_state::machine_reset() +{ + UINT8* user1 = memregion("user1")->base(); + + memcpy((UINT8*)m_p_ram.target(),user1,0x8000); + + m_maincpu->reset(); + + m_fdc->reset(); + m_fdc->set_floppy(NULL); +} + +WRITE_LINE_MEMBER(ht68k_state::duart_irq_handler) +{ + m_maincpu->set_input_line_and_vector(M68K_IRQ_3, state, M68K_INT_ACK_AUTOVECTOR); +} + +WRITE_LINE_MEMBER(ht68k_state::duart_txb) +{ + //This is the second serial channel named AUX, for modem or other serial devices. +} + +WRITE8_MEMBER(ht68k_state::duart_output) +{ + m_floppy = NULL; + + if ((BIT(data, 7)) == 0) { m_floppy = m_floppy0->get_device(); } + if ((BIT(data, 6)) == 0) { m_floppy = m_floppy1->get_device(); } + if ((BIT(data, 5)) == 0) { m_floppy = m_floppy2->get_device(); } + if ((BIT(data, 4)) == 0) { m_floppy = m_floppy3->get_device(); } + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) {m_floppy->ss_w(BIT(data,3) ? 0 : 1);} +} + +static SLOT_INTERFACE_START( ht68k_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( ht68k, ht68k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M68000, XTAL_8MHz) + MCFG_CPU_PROGRAM_MAP(ht68k_mem) + + /* video hardware */ + MCFG_MC68681_ADD( "duart68681", XTAL_8MHz / 2 ) + MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(ht68k_state, duart_irq_handler)) + MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_MC68681_B_TX_CALLBACK(WRITELINE(ht68k_state, duart_txb)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(ht68k_state, duart_output)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duart68681", mc68681_device, rx_a_w)) + + MCFG_WD1770_ADD("wd1770", XTAL_8MHz ) + + MCFG_FLOPPY_DRIVE_ADD("wd1770:0", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1770:1", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1770:2", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1770:3", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop525_list", "ht68k") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ht68k ) + ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "ht68k-u4.bin", 0x0000, 0x4000, CRC(3fbcdd0a) SHA1(45fcbbf920dc1e9eada3b7b0a55f5720d08ffdd5)) + ROM_LOAD16_BYTE( "ht68k-u3.bin", 0x0001, 0x4000, CRC(1d85d101) SHA1(8ba01e1595b0b3c4fb128a4a50242f3588b89c43)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, ht68k, 0, 0, ht68k, ht68k, driver_device, 0, "Hawthorne Technology", "TinyGiant HT68k", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/huebler.c b/src/mame/drivers/huebler.c new file mode 100644 index 00000000000..c97f5aafefc --- /dev/null +++ b/src/mame/drivers/huebler.c @@ -0,0 +1,398 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Ausbaufaehiger Mikrocomputer mit dem U 880 + electronica Band 227/228 + +****************************************************************************/ + +/* + + TODO: + + - keyboard repeat + - shift lock is not PORT_TOGGLE, instead RS flipflop + - tone generator + - cassette serial clock + - eprom programmer + - power off + +*/ + +#include "includes/huebler.h" + +/* Keyboard */ + +void amu880_state::scan_keyboard() +{ + UINT8 data = m_key_row[m_key_a8 ? m_key_d6 : m_key_d7]->read(); + + int a8 = (data & 0x0f) == 0x0f; + + if (m_key_a8 && !a8) + { + m_key_d7 = m_key_d6; + m_key_a4 = !(BIT(data, 1) && BIT(data, 3)); + m_key_a5 = !(BIT(data, 2) && BIT(data, 3)); + } + + m_key_a8 = a8; + + m_key_d6++; + + if (m_key_d6 == 16) + { + m_key_d6 = 0; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(amu880_state::keyboard_tick) +{ + scan_keyboard(); +} + +/* Read/Write Handlers */ + +READ8_MEMBER( amu880_state::keyboard_r ) +{ + /* + + A0..A3 Y + A4 !(X0&X3) + A5 !(X2&X3) + A6 shift + A7 ctrl + A8 key pressed + A9 AB0 + + */ + + UINT8 special = m_special->read(); + + int ctrl = BIT(special, 0); + int shift = BIT(special, 2) & BIT(special, 1); + int ab0 = BIT(offset, 0); + + UINT16 address = (ab0 << 9) | (m_key_a8 << 8) | (ctrl << 7) | (shift << 6) | (m_key_a5 << 5) | (m_key_a4 << 4) | m_key_d7; + + return m_kb_rom->base()[address]; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( amu880_mem, AS_PROGRAM, 8, amu880_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xe7ff) AM_RAM + AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0xf000, 0xfbff) AM_ROM + AM_RANGE(0xfc00, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( amu880_io, AS_IO, 8, amu880_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +// AM_RANGE(0x00, 0x00) AM_MIRROR(0x03) AM_WRITE(power_off_w) +// AM_RANGE(0x04, 0x04) AM_MIRROR(0x02) AM_WRITE(tone_off_w) +// AM_RANGE(0x05, 0x05) AM_MIRROR(0x02) AM_WRITE(tone_on_w) + AM_RANGE(0x08, 0x09) AM_MIRROR(0x02) AM_READ(keyboard_r) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_device, read_alt, write_alt) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_device, read_alt, write_alt) + AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( amu880 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_END) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('?') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) // <-| + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('@') PORT_CHAR('\\') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y12") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('_') PORT_CHAR('|') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y13") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y14") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y15") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE +INPUT_PORTS_END + +/* Video */ + +UINT32 amu880_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int y, sx, x, line; + const pen_t *pen = m_palette->pens(); + + for (y = 0; y < 240; y++) + { + line = y % 10; + + for (sx = 0; sx < 64; sx++) + { + UINT16 videoram_addr = ((y / 10) * 64) + sx; + UINT8 videoram_data = m_video_ram[videoram_addr & 0x7ff]; + + UINT16 charrom_addr = ((videoram_data & 0x7f) << 3) | line; + UINT8 data = m_char_rom->base()[charrom_addr & 0x3ff]; + + for (x = 0; x < 6; x++) + { + int color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); + + bitmap.pix32(y, (sx * 6) + x) = pen[color]; + + data <<= 1; + } + } + } + + return 0; +} + +/* Z80-CTC Interface */ + +WRITE_LINE_MEMBER(amu880_state::ctc_z0_w) +{ +} + +WRITE_LINE_MEMBER(amu880_state::ctc_z2_w) +{ + /* cassette transmit/receive clock */ +} + +/* Z80-SIO Interface */ + +TIMER_DEVICE_CALLBACK_MEMBER( amu880_state::tape_tick ) +{ + m_z80sio->rxa_w(m_cassette->input() < 0.0); +} + +WRITE_LINE_MEMBER(amu880_state::cassette_w) +{ + m_cassette->output(state ? -1.0 : +1.0); +} + +/* Z80 Daisy Chain */ + +static const z80_daisy_config amu880_daisy_chain[] = +{ + { Z80CTC_TAG }, + { Z80SIO_TAG }, + { Z80PIO1_TAG }, + { Z80PIO2_TAG }, + { NULL } +}; + +/* Machine Initialization */ + +void amu880_state::machine_start() +{ + // find keyboard rows + m_key_row[0] = m_y0; + m_key_row[1] = m_y1; + m_key_row[2] = m_y2; + m_key_row[3] = m_y3; + m_key_row[4] = m_y4; + m_key_row[5] = m_y5; + m_key_row[6] = m_y6; + m_key_row[7] = m_y7; + m_key_row[8] = m_y8; + m_key_row[9] = m_y9; + m_key_row[10] = m_y10; + m_key_row[11] = m_y11; + m_key_row[12] = m_y12; + m_key_row[13] = m_y13; + m_key_row[14] = m_y14; + m_key_row[15] = m_y15; + + /* register for state saving */ + save_item(NAME(m_key_d6)); + save_item(NAME(m_key_d7)); + save_item(NAME(m_key_a4)); + save_item(NAME(m_key_a5)); + save_item(NAME(m_key_a8)); +} + +/* Machine Driver */ + +/* F4 Character Displayer */ +static const gfx_layout amu880_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( amu880 ) + GFXDECODE_ENTRY( "chargen", 0x0000, amu880_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( amu880, amu880_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10MHz/4) // U880D + MCFG_CPU_PROGRAM_MAP(amu880_mem) + MCFG_CPU_IO_MAP(amu880_io) + MCFG_CPU_CONFIG(amu880_daisy_chain) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", amu880_state, keyboard_tick, attotime::from_hz(1500)) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(amu880_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(9000000, 576, 0*6, 64*6, 320, 0*10, 24*10) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", amu880) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* devices */ + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_10MHz/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(amu880_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(amu880_state, ctc_z2_w)) + + MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, XTAL_10MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, XTAL_10MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_10MHz/4, 0, 0, 0, 0) // U856 + MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(amu880_state, cassette_w)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", amu880_state, tape_tick, attotime::from_hz(44100)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( amu880 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "v21" ) + ROM_SYSTEM_BIOS( 0, "v21", "H.MON v2.1" ) + ROMX_LOAD( "mon21a.bin", 0xf000, 0x0400, NO_DUMP, ROM_BIOS(1) ) + ROMX_LOAD( "mon21b.bin", 0xf400, 0x0400, NO_DUMP, ROM_BIOS(1) ) + ROMX_LOAD( "mon21c.bin", 0xf800, 0x0400, NO_DUMP, ROM_BIOS(1) ) + ROMX_LOAD( "mon21.bin", 0xf000, 0x0bdf, BAD_DUMP CRC(ba905563) SHA1(1fa0aeab5428731756bdfa74efa3c664898bf083), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v30", "H.MON v3.0" ) + ROMX_LOAD( "mon30.bin", 0xf000, 0x1000, CRC(033f8112) SHA1(0c6ae7b9d310dec093652db6e8ae84f8ebfdcd29), ROM_BIOS(2) ) + + ROM_REGION( 0x4800, "hbasic", 0 ) + ROM_LOAD( "mon30p_hbasic33p.bin", 0x0000, 0x4800, CRC(c927e7be) SHA1(2d1f3ff4d882c40438a1281872c6037b2f07fdf2) ) + + ROM_REGION( 0x400, "chargen", 0 ) + ROM_LOAD( "hemcfont.bin", 0x0000, 0x0400, CRC(1074d103) SHA1(e558279cff5744acef4eccf30759a9508b7f8750) ) + + ROM_REGION( 0x400, "keyboard", 0 ) + ROM_LOAD( "keyboard.bin", 0x0000, 0x0400, BAD_DUMP CRC(daa06361) SHA1(b0299bd8d1686e05dbeeaed54f6c41ae543be20c) ) // typed in from manual +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, amu880, 0, 0, amu880, amu880, driver_device, 0, "Militaerverlag der DDR", "Ausbaufaehiger Mikrocomputer mit dem U 880", MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/hunter2.c b/src/mame/drivers/hunter2.c new file mode 100644 index 00000000000..75eb60c6115 --- /dev/null +++ b/src/mame/drivers/hunter2.c @@ -0,0 +1,442 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert,Barry Rodewald +/*************************************************************************** + + Skeleton driver for Husky Hunter 2 + + 2014-03-06 Skeleton [Robbbert] + 2014-03-07 Fixed screen [Barry Rodewald] + 2014-03-07 Added more stuff [Robbbert] + + http://www.seasip.info/VintagePC/husky2.html + + No schematics or manuals available. + + TODO: + - Add ports 83 and 85 + - Need software + - Add whatever image devices existed + - Probably lots of other stuff + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/hd61830.h" +#include "machine/mm58274c.h" +#include "rendlay.h" +#include "sound/speaker.h" +#include "machine/nsc810.h" +#include "bus/rs232/rs232.h" +#include "machine/nvram.h" +#include "machine/bankdev.h" + +class hunter2_state : public driver_device +{ +public: + hunter2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_speaker(*this, "speaker") + , m_rs232(*this, "serial") + , m_rom(*this, "roms") + , m_ram(*this, "rams") + , m_nvram(*this, "nvram") + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + { } + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_READ8_MEMBER(serial_dsr_r); + DECLARE_WRITE8_MEMBER(keyboard_w); + DECLARE_READ8_MEMBER(serial_rx_r); + DECLARE_WRITE8_MEMBER(display_ctrl_w); + DECLARE_WRITE8_MEMBER(port80_w); + DECLARE_WRITE8_MEMBER(serial_tx_w); + DECLARE_WRITE8_MEMBER(serial_dtr_w); + DECLARE_WRITE8_MEMBER(serial_rts_w); + DECLARE_WRITE8_MEMBER(speaker_w); + DECLARE_WRITE8_MEMBER(irqctrl_w); + DECLARE_WRITE8_MEMBER(memmap_w); + DECLARE_PALETTE_INIT(hunter2); + DECLARE_DRIVER_INIT(hunter2); + DECLARE_WRITE_LINE_MEMBER(timer0_out); + DECLARE_WRITE_LINE_MEMBER(timer1_out); + DECLARE_WRITE_LINE_MEMBER(cts_w); + DECLARE_WRITE_LINE_MEMBER(rxd_w); + +private: + UINT8 m_keydata; + UINT8 m_irq_mask; + virtual void machine_reset(); + required_device m_maincpu; + required_device m_speaker; + required_device m_rs232; + required_memory_region m_rom; + required_memory_region m_ram; + required_device m_nvram; + required_device m_bank1; + required_device m_bank2; + required_device m_bank3; +}; + +static ADDRESS_MAP_START(hunter2_banked_mem, AS_PROGRAM, 8, hunter2_state) + AM_RANGE(0x00000, 0x2ffff) AM_ROM AM_REGION("roms", 0x0000) + AM_RANGE(0x30000, 0x3ffff) AM_NOP + AM_RANGE(0x40000, 0xfffff) AM_RAM AM_REGION("rams", 0x0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(hunter2_mem, AS_PROGRAM, 8, hunter2_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) + AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("bank2", address_map_bank_device, read8, write8) + AM_RANGE(0x8000, 0xbfff) AM_DEVREADWRITE("bank3", address_map_bank_device, read8, write8) + AM_RANGE(0xc000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(hunter2_io, AS_IO, 8, hunter2_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x1f) AM_DEVREADWRITE("iotimer", nsc810_device, read, write) + AM_RANGE(0x20, 0x20) AM_DEVWRITE("lcdc", hd61830_device, data_w) + AM_RANGE(0x21, 0x21) AM_DEVREADWRITE("lcdc", hd61830_device, status_r, control_w) + AM_RANGE(0x3e, 0x3e) AM_DEVREAD("lcdc", hd61830_device, data_r) + AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("rtc", mm58274c_device, read, write) + AM_RANGE(0x60, 0x60) AM_WRITE(display_ctrl_w) + AM_RANGE(0x80, 0x80) AM_WRITE(port80_w) + AM_RANGE(0x81, 0x81) AM_WRITE(serial_tx_w) + AM_RANGE(0x82, 0x82) AM_WRITE(serial_dtr_w) + AM_RANGE(0x84, 0x84) AM_WRITE(serial_rts_w) + AM_RANGE(0x86, 0x86) AM_WRITE(speaker_w) + AM_RANGE(0xbb, 0xbb) AM_WRITE(irqctrl_w) + AM_RANGE(0xe0, 0xe0) AM_WRITE(memmap_w) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( hunter2 ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc/Brk") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lbl/Ins") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') +INPUT_PORTS_END + +READ8_MEMBER( hunter2_state::keyboard_r ) +{ + UINT8 i,data = 0xff; + for (i = 0; i < 7; i++) + { + if (!BIT(m_keydata, i)) + { + char kbdrow[6]; + sprintf(kbdrow,"X%d", i); + data &= ioport(kbdrow)->read(); + } + } + return data; +} + +READ8_MEMBER( hunter2_state::serial_dsr_r ) +{ + UINT8 res = 0x00; + + if(m_rs232->dsr_r()) + res |= 0x80; + + return res; +} + +WRITE8_MEMBER( hunter2_state::keyboard_w ) +{ + m_keydata = data; + //logerror("Key row select %02x\n",data); +} + +READ8_MEMBER( hunter2_state::serial_rx_r ) +{ + UINT8 res = 0x28; + + if(m_rs232->rxd_r()) + res |= 0x01; + if(m_rs232->dcd_r()) + res |= 0x02; + + return res; +} + +WRITE8_MEMBER( hunter2_state::display_ctrl_w ) +{ +/* according to the website, +Bit 2: Backlight toggle +Bits 1,0,7,6: Contrast level. +00 is being written here +*/ +} + +WRITE8_MEMBER( hunter2_state::port80_w ) +{ +} + +WRITE8_MEMBER( hunter2_state::serial_tx_w ) +{ + m_rs232->write_txd(data & 0x01); +// logerror("TXD write %02x\n",data); +} + +WRITE8_MEMBER( hunter2_state::serial_dtr_w ) +{ + m_rs232->write_dtr(data & 0x01); +// logerror("DTR write %02x\n",data); +} + +WRITE8_MEMBER( hunter2_state::serial_rts_w ) +{ + m_rs232->write_rts(data & 0x01); +// logerror("RTS write %02x\n",data); +} + +WRITE8_MEMBER( hunter2_state::speaker_w ) +{ + m_speaker->level_w(BIT(data, 0)); +} + +/* +Bit 0 = Enable normal interrupts +Bit 1 = Enable RSTC interrupts +Bit 2 = Enable RSTB interrupts +Bit 3 = Enable RSTA interrupts +*/ +WRITE8_MEMBER( hunter2_state::irqctrl_w ) +{ + m_irq_mask = data; + if(!(data & 0x08)) + m_maincpu->set_input_line(NSC800_RSTA, CLEAR_LINE); + if(!(data & 0x04)) + m_maincpu->set_input_line(NSC800_RSTB, CLEAR_LINE); + if(!(data & 0x02)) + m_maincpu->set_input_line(NSC800_RSTC, CLEAR_LINE); +} + +/* +data bank0 bank1 bank2 +00 00 01 02 +01 00 01 03 +02 00 01 04 +.... +09 00 01 11 +80 16 17 18 +.... +8F 61 62 63 +*/ +WRITE8_MEMBER( hunter2_state::memmap_w ) +{ + if (data < 0x0a) + { + m_bank1->set_bank(0); + m_bank2->set_bank(1); + m_bank3->set_bank(2 + data); + } + else + if (data >= 0x80) + { + UINT8 bank = data & 0x0f; + m_bank1->set_bank(16 + (bank*3)); + m_bank2->set_bank(17 + (bank*3)); + m_bank3->set_bank(18 + (bank*3)); + } +} + +void hunter2_state::machine_reset() +{ + m_keydata = 0xff; + m_irq_mask = 0; + m_bank1->set_bank(0); + m_bank2->set_bank(1); + m_bank3->set_bank(2); +} + +// it is presumed that writing to rom will go nowhere +DRIVER_INIT_MEMBER( hunter2_state, hunter2 ) +{ + UINT8 *ram = m_ram->base(); + + m_nvram->set_base(ram,m_ram->bytes()); +} + +PALETTE_INIT_MEMBER(hunter2_state, hunter2) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +WRITE_LINE_MEMBER(hunter2_state::timer0_out) +{ + if(state == ASSERT_LINE) + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + +WRITE_LINE_MEMBER(hunter2_state::timer1_out) +{ + if(m_irq_mask & 0x08) + m_maincpu->set_input_line(NSC800_RSTA, state); +} + +WRITE_LINE_MEMBER(hunter2_state::cts_w) +{ + if(BIT(m_irq_mask, 1)) + { + m_maincpu->set_input_line(NSC800_RSTC, state); + popmessage("CTS: RSTC set %i\n",state); + } +} + +WRITE_LINE_MEMBER(hunter2_state::rxd_w) +{ + if(BIT(m_irq_mask, 2)) + m_maincpu->set_input_line(NSC800_RSTB, ASSERT_LINE); +} + +static MACHINE_CONFIG_START( hunter2, hunter2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NSC800, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(hunter2_mem) + MCFG_CPU_IO_MAP(hunter2_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(80) + MCFG_SCREEN_UPDATE_DEVICE("lcdc", hd61830_device, screen_update) + MCFG_SCREEN_SIZE(240, 128) + MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 63) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(hunter2_state, hunter2) + MCFG_DEVICE_ADD("lcdc", HD61830, XTAL_4_9152MHz/2/2) // unknown clock + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("rtc", MM58274C, 0) + // this is all a guess + MCFG_MM58274C_MODE24(0) // 12 hour + MCFG_MM58274C_DAY1(1) // monday + + MCFG_NSC810_ADD("iotimer",XTAL_4MHz,XTAL_4MHz) + MCFG_NSC810_PORTA_READ(READ8(hunter2_state,keyboard_r)) + MCFG_NSC810_PORTB_READ(READ8(hunter2_state,serial_dsr_r)) + MCFG_NSC810_PORTB_WRITE(WRITE8(hunter2_state,keyboard_w)) + MCFG_NSC810_PORTC_READ(READ8(hunter2_state,serial_rx_r)) + MCFG_NSC810_TIMER0_OUT(WRITELINE(hunter2_state,timer0_out)) + MCFG_NSC810_TIMER1_OUT(WRITELINE(hunter2_state,timer1_out)) + + MCFG_RS232_PORT_ADD("serial",default_rs232_devices,NULL) + MCFG_RS232_CTS_HANDLER(WRITELINE(hunter2_state,cts_w)) + MCFG_RS232_RXD_HANDLER(WRITELINE(hunter2_state,rxd_w)) + + MCFG_NVRAM_ADD_0FILL("nvram") + + MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(hunter2_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_DEVICE_ADD("bank2", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(hunter2_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_DEVICE_ADD("bank3", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(hunter2_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( hunter2 ) + ROM_REGION(0x30000, "roms", ROMREGION_ERASEFF) // board has space for 6 roms, but only 2 are populated normally + ROM_LOAD( "tr032kx8mrom0.ic50", 0x0000, 0x8000, CRC(694d252c) SHA1(b11dbf24faf648596d92b1823e25a8e4fb7f542c) ) + ROM_LOAD( "tr032kx8mrom1.ic51", 0x8000, 0x8000, CRC(82901642) SHA1(d84f2bbd2e9e052bd161a313c240a67918f774ad) ) + + // 48 x 4k blocks plus 1 sinkhole + ROM_REGION(0xc4000, "rams", ROMREGION_ERASEVAL(0xa5)) // board can have up to 736k of ram, but 192k is standard +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, hunter2, 0, 0, hunter2, hunter2, hunter2_state, hunter2, "Husky", "Hunter 2", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/hx20.c b/src/mame/drivers/hx20.c new file mode 100644 index 00000000000..bc39844c973 --- /dev/null +++ b/src/mame/drivers/hx20.c @@ -0,0 +1,922 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Epson HX-20 + + http://fjkraan.home.xs4all.nl/comp/hx20/ + +****************************************************************************/ + +/* + + TODO: + + - m6800.c rewrite + - keyboard interrupt + - LCD controller + - serial + - SW6 read + - RS-232 + - microcassette + - printer + - ROM cartridge + - floppy TF-20 + - barcode reader + +*/ + +#include "includes/hx20.h" + + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// update_interrupt - +//------------------------------------------------- + +void hx20_state::update_interrupt() +{ + int irq = m_rtc_irq || m_kbrequest; + + m_maincpu->set_input_line(M6800_IRQ_LINE, irq); +} + + +//------------------------------------------------- +// ksc_w - +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::ksc_w ) +{ + logerror("KSC %02x\n", data); + + m_ksc = data; +} + + +//------------------------------------------------- +// krtn07_r - +//------------------------------------------------- + +READ8_MEMBER( hx20_state::krtn07_r ) +{ + UINT8 data = 0xff; + + if (!BIT(m_ksc, 0)) data &= m_ksc0->read(); + if (!BIT(m_ksc, 1)) data &= m_ksc1->read(); + if (!BIT(m_ksc, 2)) data &= m_ksc2->read(); + if (!BIT(m_ksc, 3)) data &= m_ksc3->read(); + if (!BIT(m_ksc, 4)) data &= m_ksc4->read(); + if (!BIT(m_ksc, 5)) data &= m_ksc5->read(); + if (!BIT(m_ksc, 6)) data &= m_ksc6->read(); + if (!BIT(m_ksc, 7)) data &= m_ksc7->read(); + + return data; +} + + +//------------------------------------------------- +// krtn89_r - +//------------------------------------------------- + +READ8_MEMBER( hx20_state::krtn89_r ) +{ + /* + + bit description + + 0 KRTN8 + 1 KRTN9 + 2 + 3 + 4 + 5 + 6 _PWSW + 7 _BUSY + + */ + + UINT8 data = 0xff; + + if (!BIT(m_ksc, 0)) data &= m_ksc0->read() >> 8; + if (!BIT(m_ksc, 1)) data &= m_ksc1->read() >> 8; + if (!BIT(m_ksc, 2)) data &= m_ksc2->read() >> 8; + if (!BIT(m_ksc, 3)) data &= m_ksc3->read() >> 8; + if (!BIT(m_ksc, 4)) data &= m_ksc4->read() >> 8; + if (!BIT(m_ksc, 5)) data &= m_ksc5->read() >> 8; + if (!BIT(m_ksc, 6)) data &= m_ksc6->read() >> 8; + if (!BIT(m_ksc, 7)) data &= m_ksc7->read() >> 8; + + return data; +} + + +//------------------------------------------------- +// lcd_cs_w - +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::lcd_cs_w ) +{ + /* + + bit description + + 0 LCD CS bit 0 + 1 LCD CS bit 1 + 2 LCD CS bit 2 + 3 LCD C/_D + 4 KEY INT MASK + 5 SERIAL POUT + 6 MO1 + 7 MO2 + + */ + + logerror("LCD CS %02x\n", data); + + // LCD + m_lcdc0->cs_w(1); + m_lcdc1->cs_w(1); + m_lcdc2->cs_w(1); + m_lcdc3->cs_w(1); + m_lcdc4->cs_w(1); + m_lcdc5->cs_w(1); + + switch (data & 0x07) + { + case 1: m_lcdc0->cs_w(0); break; + case 2: m_lcdc1->cs_w(0); break; + case 3: m_lcdc2->cs_w(0); break; + case 4: m_lcdc3->cs_w(0); break; + case 5: m_lcdc4->cs_w(0); break; + case 6: m_lcdc5->cs_w(0); break; + } + + int cd = BIT(data, 3); + + m_lcdc0->cd_w(cd); + m_lcdc1->cd_w(cd); + m_lcdc2->cd_w(cd); + m_lcdc3->cd_w(cd); + m_lcdc4->cd_w(cd); + m_lcdc5->cd_w(cd); + + // serial + m_sio->pout_w(BIT(data, 5)); +} + + +//------------------------------------------------- +// lcd_data_w - +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::lcd_data_w ) +{ + logerror("LCD DATA %02x\n", data); + + m_lcd_data = data; +} + + +//------------------------------------------------- +// main_p1_r - main CPU port 1 read +//------------------------------------------------- + +READ8_MEMBER( hx20_state::main_p1_r ) +{ + /* + + bit description + + 0 RS-232 DSR + 1 RS-232 CTS + 2 + 3 _INT EX + 4 _PWA + 5 _K.B REQUEST + 6 SERIAL PIN + 7 CARTRIDGE MI1 (0=ROM, 1=microcassette) + + */ + + UINT8 data = 0x98; + + // RS-232 + data |= m_rs232->dsr_r(); + data |= m_rs232->cts_r() << 1; + + // keyboard + data |= m_kbrequest << 5; + + // serial + data |= m_sio_pin << 6; + + return data; +} + + +//------------------------------------------------- +// main_p1_w - main CPU port 1 write +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::main_p1_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ +} + + +//------------------------------------------------- +// main_p2_r - main CPU port 2 read +//------------------------------------------------- + +READ8_MEMBER( hx20_state::main_p2_r ) +{ + /* + + bit description + + 0 bar code reader data + 1 + 2 SLAVE P34 + 3 RX + 4 + 5 + 6 + 7 + + */ + + UINT8 data = M6801_MODE_4; + + // serial + data &= ~(!m_slave_flag << 2); + + if (m_slave_sio) + data |= m_slave_rx << 3; + else + data |= m_sio_rx << 3; + + return data; +} + + +//------------------------------------------------- +// main_p2_w - main CPU port 2 write +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::main_p2_w ) +{ + /* + + bit description + + 0 + 1 RS-232 TXD + 2 serial select (0=peripheral, 1=slave 6301) + 3 + 4 TX + 5 + 6 + 7 + + */ + + // RS-232 + m_rs232->write_txd(BIT(data, 1)); + + // serial + m_slave_sio = BIT(data, 2); + + if (m_slave_sio) + m_slave_tx = BIT(data, 4); + else + m_sio->tx_w(BIT(data, 4)); +} + + +//------------------------------------------------- +// slave_p1_r - slave CPU port 1 read +//------------------------------------------------- + +READ8_MEMBER( hx20_state::slave_p1_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 printer reset pulse + 7 printer timing pulse + + */ + + UINT8 data = 0; + + return data; +} + + +//------------------------------------------------- +// slave_p1_w - slave CPU port 1 write +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::slave_p1_w ) +{ + /* + + bit description + + 0 printer head 1 (1=on) + 1 printer head 2 + 2 printer head 3 + 3 printer head 4 + 4 printer motor (0=on) + 5 speaker (1=on) + 6 + 7 + + */ + + // speaker + m_speaker->level_w(BIT(data, 5)); +} + + +//------------------------------------------------- +// slave_p2_r - slave CPU port 2 read +//------------------------------------------------- + +READ8_MEMBER( hx20_state::slave_p2_r ) +{ + /* + + bit description + + 0 RS-232 RXD / microcassette (0=read, 1=write) + 1 + 2 + 3 TX + 4 + 5 + 6 + 7 + + */ + + UINT8 data = M6801_MODE_7; + + // serial + data |= m_slave_tx << 3; + + return data; +} + + +//------------------------------------------------- +// slave_p2_w - slave CPU port 2 write +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::slave_p2_w ) +{ + /* + + bit description + + 0 + 1 microcassette internal clock, write data + 2 serial select (0=brake, 1=normal) + 3 + 4 RX + 5 + 6 + 7 + + */ + + // serial + m_slave_rx = BIT(data, 4); +} + + +//------------------------------------------------- +// slave_p3_r - slave CPU port 3 read +//------------------------------------------------- + +READ8_MEMBER( hx20_state::slave_p3_r ) +{ + /* + + bit description + + 0 + 1 + 2 external cassette read data + 3 + 4 + 5 + 6 + 7 + + */ + + UINT8 data = 0; + + return data; +} + + +//------------------------------------------------- +// slave_p3_w - slave CPU port 3 write +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::slave_p3_w ) +{ + /* + + bit description + + 0 external cassette remote (0=on) + 1 RS-232 RTS + 2 + 3 external cassette write data + 4 slave status flag + 5 bar code power (1=on) + 6 RS-232 power (1=on) + 7 program power (1=on) + + */ + + // RS-232 + m_rs232->write_rts(BIT(data, 1)); + + // main + m_slave_flag = BIT(data, 4); +} + + +//------------------------------------------------- +// slave_p4_r - slave CPU port 4 read +//------------------------------------------------- + +READ8_MEMBER( hx20_state::slave_p4_r ) +{ + /* + + bit description + + 0 PLUG 2 + 1 + 2 + 3 + 4 + 5 + 6 + 7 RS-232 CD + + */ + + UINT8 data = 0; + + // RS-232 + data |= m_rs232->dcd_r() << 7; + + return data; +} + + +//------------------------------------------------- +// slave_p4_w - slave CPU port 4 write +//------------------------------------------------- + +WRITE8_MEMBER( hx20_state::slave_p4_w ) +{ + /* + + bit description + + 0 + 1 port enable always on / printer motor control (0=open, 1=brake) + 2 clear shift register / microcassette power switch (1=on) + 3 ROM cartridge power switch (1=on) / microcassette command + 4 ROM address counter clear / clock + 5 cassette/RS-232 select (0=RS-232, 1=microcassette) + 6 ROM cartridge select / microcassette clock (0=counter, 1=head switch) + 7 + + */ +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( hx20_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( hx20_mem, AS_PROGRAM, 8, hx20_state ) + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_MAIN_TAG, hd63701_cpu_device, m6801_io_r, m6801_io_w) + AM_RANGE(0x0020, 0x0020) AM_WRITE(ksc_w) + AM_RANGE(0x0022, 0x0022) AM_READ(krtn07_r) + AM_RANGE(0x0026, 0x0026) AM_WRITE(lcd_cs_w) + AM_RANGE(0x0028, 0x0028) AM_READ(krtn89_r) + AM_RANGE(0x002a, 0x002a) AM_WRITE(lcd_data_w) + AM_RANGE(0x002c, 0x002c) // mask interruption by using IC 8E in sleep mode + AM_RANGE(0x0040, 0x007f) AM_DEVREADWRITE(MC146818_TAG, mc146818_device, read, write) + AM_RANGE(0x0080, 0x00ff) AM_RAM + AM_RANGE(0x0100, 0x3fff) AM_RAM + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(HD6301V1_MAIN_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( hx20_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( hx20_io, AS_IO, 8, hx20_state ) + AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READWRITE(main_p1_r, main_p1_w) + AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(main_p2_r, main_p2_w) + AM_RANGE(M6801_PORT3, M6801_PORT3) AM_NOP // A0-A7, D0-D7 + AM_RANGE(M6801_PORT4, M6801_PORT4) AM_NOP // A8-A15 +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( hx20_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( hx20_sub_mem, AS_PROGRAM, 8, hx20_state ) + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_SLAVE_TAG, hd63701_cpu_device, m6801_io_r, m6801_io_w) + AM_RANGE(0x0080, 0x00ff) AM_RAM + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6301V1_SLAVE_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( hx20_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( hx20_sub_io, AS_IO, 8, hx20_state ) + AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READWRITE(slave_p1_r, slave_p1_w) + AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(slave_p2_r, slave_p2_w) + AM_RANGE(M6801_PORT3, M6801_PORT3) AM_READWRITE(slave_p3_r, slave_p3_w) + AM_RANGE(M6801_PORT4, M6801_PORT4) AM_READWRITE(slave_p4_r, slave_p4_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( hx20 ) +//------------------------------------------------- + +static INPUT_PORTS_START( hx20 ) + PORT_START("KSC0") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // SW6:1 + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KSC1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // SW6:2 + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KSC2") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('@') PORT_CHAR('^') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // SW6:3 + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KSC3") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // SW6:4 + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KSC4") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KSC5") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" " UTF8_UP) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT" " UTF8_DOWN) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAPER FEED") + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KSC6") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NUM") + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRPH") + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KSC7") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SCRN") + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE") + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MENU") + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRTR ON/OFF") + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SW6") + PORT_DIPNAME( 0x07, 0x07, "Country" ) PORT_DIPLOCATION("SW6:1,2,3") + PORT_DIPSETTING( 0x00, "Spain" ) + PORT_DIPSETTING( 0x01, "Italy" ) + PORT_DIPSETTING( 0x02, "Sweden" ) + PORT_DIPSETTING( 0x03, "Denmark" ) + PORT_DIPSETTING( 0x04, "England" ) + PORT_DIPSETTING( 0x05, "Germany" ) + PORT_DIPSETTING( 0x06, "France" ) + PORT_DIPSETTING( 0x07, "America" ) + PORT_DIPNAME( 0x08, 0x00, "Floppy Drive TF-20" ) PORT_DIPLOCATION("SW6:4") + PORT_DIPSETTING( 0x00, "Installed" ) + PORT_DIPSETTING( 0x08, "Not Installed" ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( hx20e ) +//------------------------------------------------- + +static INPUT_PORTS_START( hx20e ) + PORT_INCLUDE(hx20) + + PORT_MODIFY("SW6") + PORT_DIPNAME( 0x07, 0x00, "Country" ) PORT_DIPLOCATION("SW6:1,2,3") + PORT_DIPSETTING( 0x00, "Sweden (ASCII)" ) + PORT_DIPSETTING( 0x01, "Germany (ASCII)" ) + PORT_DIPSETTING( 0x02, "France (ASCII)" ) + PORT_DIPSETTING( 0x03, "Denmark" ) + PORT_DIPSETTING( 0x04, "Sweden" ) + PORT_DIPSETTING( 0x05, "Germany" ) + PORT_DIPSETTING( 0x06, "France" ) + PORT_DIPSETTING( 0x07, "Norway" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// mc146818_interface rtc_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( hx20_state::rtc_irq_w ) +{ + m_rtc_irq = state; + + update_interrupt(); +} + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +PALETTE_INIT_MEMBER(hx20_state, hx20) +{ + palette.set_pen_color(0, 0xa5, 0xad, 0xa5); + palette.set_pen_color(1, 0x31, 0x39, 0x10); +} + + +//------------------------------------------------- +// SCREEN_UPDATE( hx20 ) +//------------------------------------------------- + +UINT32 hx20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_lcdc0->screen_update(screen, bitmap, cliprect); + m_lcdc1->screen_update(screen, bitmap, cliprect); + m_lcdc2->screen_update(screen, bitmap, cliprect); + m_lcdc3->screen_update(screen, bitmap, cliprect); + m_lcdc4->screen_update(screen, bitmap, cliprect); + m_lcdc5->screen_update(screen, bitmap, cliprect); + + return 0; +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( hx20 ) +//------------------------------------------------- + +void hx20_state::machine_start() +{ + // state saving + save_item(NAME(m_slave_rx)); + save_item(NAME(m_slave_tx)); + save_item(NAME(m_slave_flag)); + save_item(NAME(m_ksc)); + save_item(NAME(m_kbrequest)); + save_item(NAME(m_lcd_data)); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( hx20 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( hx20, hx20_state ) + // basic machine hardware + MCFG_CPU_ADD(HD6301V1_MAIN_TAG, HD63701, XTAL_2_4576MHz) + MCFG_CPU_PROGRAM_MAP(hx20_mem) + MCFG_CPU_IO_MAP(hx20_io) + + MCFG_CPU_ADD(HD6301V1_SLAVE_TAG, HD63701, XTAL_2_4576MHz) + MCFG_CPU_PROGRAM_MAP(hx20_sub_mem) + MCFG_CPU_IO_MAP(hx20_sub_io) + + // video hardware + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(120, 32) + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 32-1) + MCFG_SCREEN_UPDATE_DRIVER(hx20_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(hx20_state, hx20) + + MCFG_UPD7227_ADD(UPD7227_0_TAG, 0, 0) + MCFG_UPD7227_ADD(UPD7227_1_TAG, 40, 0) + MCFG_UPD7227_ADD(UPD7227_2_TAG, 80, 0) + MCFG_UPD7227_ADD(UPD7227_3_TAG, 0, 16) + MCFG_UPD7227_ADD(UPD7227_4_TAG, 40, 16) + MCFG_UPD7227_ADD(UPD7227_5_TAG, 80, 16) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_MC146818_ADD(MC146818_TAG, XTAL_4_194304Mhz) + MCFG_MC146818_IRQ_HANDLER(WRITELINE(hx20_state, rtc_irq_w)) + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_CASSETTE_ADD(CASSETTE_TAG) + MCFG_EPSON_SIO_ADD("sio", "tf20") + MCFG_EPSON_SIO_RX(WRITELINE(hx20_state, sio_rx_w)) + MCFG_EPSON_SIO_PIN(WRITELINE(hx20_state, sio_pin_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("epson_cpm_list", "epson_cpm") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( hx20 ) +//------------------------------------------------- + +ROM_START( ehx20 ) + ROM_REGION( 0x8000, HD6301V1_MAIN_TAG, ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS( "v11" ) + ROM_SYSTEM_BIOS( 0, "v10", "version 1.0" ) + ROMX_LOAD( "hx20_v10.12e", 0x0000, 0x2000, CRC(ed7482c6) SHA1(8fba63037f2418aee9e933a353b052a5ed816ead), ROM_BIOS(1) ) + ROMX_LOAD( "hx20_v10.13e", 0x2000, 0x2000, CRC(f5cc8868) SHA1(3248a1ddf0d8df7e9f2fe96955385218d760c4ad), ROM_BIOS(1) ) + ROMX_LOAD( "hx20_v10.14e", 0x4000, 0x2000, CRC(27d743ed) SHA1(ebae367b0fa5f42ac78424df2534312296fd6fdc), ROM_BIOS(1) ) + ROMX_LOAD( "hx20_v10.15e", 0x6000, 0x2000, CRC(33fbb1ab) SHA1(292ace94b4dad267aa7786dc64e68ac6f3c98aa7), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v11", "version 1.1" ) + ROMX_LOAD( "hx20_v11.12e", 0x0000, 0x2000, CRC(4de0b4b6) SHA1(f15c537824b7effde9d9b9a21e92a081fb089371), ROM_BIOS(2) ) + ROMX_LOAD( "hx20_v11.13e", 0x2000, 0x2000, CRC(10d6ae76) SHA1(3163954ed9981f70f590ee98bcc8e19e4be6527a), ROM_BIOS(2) ) + ROMX_LOAD( "hx20_v11.14e", 0x4000, 0x2000, CRC(26c203a1) SHA1(b282d7233b2689820fcf718dbe1e93d623b67e4f), ROM_BIOS(2) ) + ROMX_LOAD( "hx20_v11.15e", 0x6000, 0x2000, CRC(101cb3e8) SHA1(e0b5cf107a9387e34a0e46f54328b89696c0bdc5), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, HD6301V1_SLAVE_TAG, 0 ) + ROM_LOAD( "hd6301v1.6d", 0x0000, 0x1000, CRC(b36f5b99) SHA1(c6b54163bb268e4f4f5c79aa2e83ec51f775b16a) ) +ROM_END + + +//------------------------------------------------- +// ROM( hx20e ) +//------------------------------------------------- + +ROM_START( ehx20e ) + ROM_REGION( 0x8000, HD6301V1_MAIN_TAG, ROMREGION_ERASEFF ) + ROMX_LOAD( "hx20_v11e.12e", 0x0000, 0x2000, CRC(4de0b4b6) SHA1(f15c537824b7effde9d9b9a21e92a081fb089371), ROM_BIOS(3) ) + ROMX_LOAD( "hx20_v11e.13e", 0x2000, 0x2000, CRC(10d6ae76) SHA1(3163954ed9981f70f590ee98bcc8e19e4be6527a), ROM_BIOS(3) ) + ROMX_LOAD( "hx20_v11e.14e", 0x4000, 0x2000, CRC(26c203a1) SHA1(b282d7233b2689820fcf718dbe1e93d623b67e4f), ROM_BIOS(3) ) + ROMX_LOAD( "hx20_v11e.15e", 0x6000, 0x2000, CRC(fd339aa5) SHA1(860c3579c45e96c5e6a877f4fbe77abacb0d674e), ROM_BIOS(3) ) + + ROM_REGION( 0x1000, HD6301V1_SLAVE_TAG, 0 ) + ROM_LOAD( "hd6301v1.6d", 0x0000, 0x1000, CRC(b36f5b99) SHA1(c6b54163bb268e4f4f5c79aa2e83ec51f775b16a) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, ehx20, 0, 0, hx20, hx20, driver_device, 0, "Epson", "Epson HX-20", MACHINE_NOT_WORKING ) +COMP( 1983, ehx20e, ehx20, 0, hx20, hx20e, driver_device, 0, "Epson", "Epson HX-20 (Europe)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/hyperscan.c b/src/mame/drivers/hyperscan.c new file mode 100644 index 00000000000..15e1bb8da72 --- /dev/null +++ b/src/mame/drivers/hyperscan.c @@ -0,0 +1,647 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Mattel HyperScan + + 08/17/2013 Skeleton driver by Sandro Ronco + + SPG290 Interrupt: + + Vector Source + 63 SPU FIQ + 62 SPU Beatirq + 61 SPU Envirq + 60 CD servo + 59 ADC gain overflow / ADC recorder / FIFO overflow + 58 General purpose ADC + 57 Timer base + 56 Timer + 55 TV vblanking start + 54 LCD vblanking start + 53 PPU vblanking start + 52 TV + 51 Sensor frame end + 50 Sensor coordinate hit + 49 Sensor motion frame end + 48 Sensor capture done + sensor debug IRQ + 47 TV coordinate hit + 46 PPU coordinate hit + 45 USB host+device + 44 SIO + 43 SPI + 42 Uart (IrDA) + 41 NAND + 40 SD + 39 I2C master + 38 I2S slave + 37 APBDMA CH1 + 36 APBDMA CH2 + 35 LDM_DMA + 34 BLN_DMA + 33 APBDMA CH3 + 32 APBDMA CH4 + 31 Alarm + HMS + 30 MP4 + 29 C3 (ECC module) + 28 GPIO + 27 Bufctl (for debug) + TV/PPU vblanking end (for debug) + 26 RESERVED1 + 25 RESERVED2 + 24 RESERVED3 + +****************************************************************************/ + +#include "emu.h" +#include "cpu/score/score.h" + + +#define LOG_SPG290_REGISTER_ACCESS (1) + + + +class hyperscan_state : public driver_device +{ +public: + hyperscan_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + required_device m_maincpu; + + virtual void machine_start(); + virtual void machine_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + UINT32 spg290_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_READ32_MEMBER(spg290_regs_r); + DECLARE_WRITE32_MEMBER(spg290_regs_w); + void spg290_timers_update(); + void spg290_vblank_irq(screen_device &screen, bool state); + inline UINT32 spg290_read_mem(UINT32 offset); + inline void spg290_write_mem(UINT32 offset, UINT32 data); + void spg290_argb1555(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 posy, UINT16 posx, UINT16 argb); + void spg290_rgb565(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 posy, UINT16 posx, UINT16 rgb, UINT32 transrgb); + void spg290_blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, UINT32 *palettes, UINT32 buf_start); + void spg290_blit_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, int posy, int posx, UINT32 nptr, UINT32 buf_start, UINT32 transrgb); + void spg290_blit_character(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, int posy, int posx, UINT32 nptr, UINT32 buf_start, UINT32 transrgb); + +private: + static const device_timer_id TIMER_SPG290 = 0; + static const device_timer_id TIMER_I2C = 1; + + struct spg290_miu + { + UINT32 status; + }; + + struct spg290_ppu + { + UINT32 control; + UINT32 irq_control; + UINT32 irq_status; + UINT32 sprite_max; + UINT32 sprite_buf_start; + UINT32 frame_buff[3]; + UINT32 palettes[0x200]; + UINT32 tx_hoffset[0x200]; + UINT32 tx_hcomp[0x200]; + UINT32 transrgb; + + struct ppu_spite + { + UINT32 control; + UINT32 attribute; + } sprites[0x200]; + + struct ppu_tx + { + UINT32 control; + UINT32 attribute; + UINT32 posx; + UINT32 posy; + UINT32 nptr; + UINT32 buf_start[3]; + } txs[3]; + }; + + struct spg290_timer + { + UINT32 control; + UINT32 control2; + UINT16 preload; + UINT16 counter; + }; + + struct spg290_i2c + { + UINT32 config; + UINT32 irq_control; + UINT32 clock; + UINT8 count; + UINT32 id; + UINT32 port_addr; + UINT32 wdata; + UINT32 rdata; + }; + + spg290_miu m_miu; + spg290_ppu m_ppu; + spg290_timer m_timers[6]; + spg290_i2c m_i2c; + emu_timer * m_update_timer; + emu_timer * m_i2c_timer; +}; + + + +#if LOG_SPG290_REGISTER_ACCESS +static void log_spg290_regs(UINT8 module, UINT16 reg, UINT32 mem_mask, bool write, UINT32 data=0) +{ + static const char *const modules_name[] = + { + "CSI", "PPU", "JPG", "TV", "LCD", "SPU", "CD", "MIU", "APBDMA", "BUFCTL","IRQCTL", "GPUBUF", "LDMDMA", + "BLNDMA", "TPGBUF", "AHBDEC", "GPIO", "SPI", "SIO", "I2C", "I2S", "UART", "TIMERS/RTC", "WDOG", "SD", + "FLASH", "ADC", "USB device", "USB host", "Reserved", "Reserved", "Reserved", "SFTCFG", "CKG", "MP4", + "MIU2", "ECC" + }; + + if (module < 0x25) + logerror("SPG: %-10s", modules_name[module]); + else + logerror("SPG: mod 0x%02x ", module); + + if (!write) + logerror(" R 0x%04x", reg); + else + logerror(" W 0x%04x = 0x%08x", reg, data); + + if (mem_mask != 0xffffffffu) + logerror(" (0x%08x)\n", mem_mask); + else + logerror("\n"); +} +#endif + + +READ32_MEMBER(hyperscan_state::spg290_regs_r) +{ + UINT32 addr = offset << 2; + UINT32 data = 0; + + if (addr == 0x010000) // PPU Control + { + data = m_ppu.control; + } + else if (addr == 0x010084) // PPU IRQ Status + { + data = m_ppu.irq_status; + } + if (addr == 0x07006c) // MIU Status + { + data = m_miu.status; + } + else if ((addr & 0xff0fff) == 0x160000) // Timer X Status + { + int idx = (offset>>10) & 0x0f; + data = m_timers[idx].control; + } + else if(addr == 0x130024) // I2C interrupt + { + data = m_i2c.irq_control; + } + else if(addr == 0x130034) // I2C write data + { + data = m_i2c.wdata; + } + else if(addr == 0x130038) // I2C data data + { + data = m_i2c.rdata; + } + +#if LOG_SPG290_REGISTER_ACCESS + //else + { + if (!space.debugger_access()) + log_spg290_regs((offset >> 14) & 0xff, (offset<<2) & 0xffff, mem_mask, false); + } +#endif + + return data; +} + +WRITE32_MEMBER(hyperscan_state::spg290_regs_w) +{ + UINT32 addr = offset << 2; + + if (addr == 0x010000) // PPU Control + { + COMBINE_DATA(&m_ppu.control); + } + else if (addr == 0x010008) // PPU Max Sprites + { + COMBINE_DATA(&m_ppu.sprite_max); + } + else if (addr == 0x010010) // PPU Max Sprites + { + COMBINE_DATA(&m_ppu.transrgb); + } + else if (addr == 0x0100d0) // Sprites buffer start + { + COMBINE_DATA(&m_ppu.sprite_buf_start); + } + else if (addr == 0x010020 || addr == 0x01003c || addr == 0x010058) // Text Layers x pos + { + int idx = (((offset>>3) & 3) | ((offset>>4) & 1)) - 1; + COMBINE_DATA(&m_ppu.txs[idx].posx); + } + else if (addr == 0x010024 || addr == 0x010040 || addr == 0x01005c) // Text Layers y pos + { + int idx = (((offset>>3) & 3) | ((offset>>4) & 1)) - 1; + COMBINE_DATA(&m_ppu.txs[idx].posy); + } + else if (addr == 0x010028 || addr == 0x010044 || addr == 0x010060) // Text Layers attribute + { + int idx = ((offset>>3) & 3) - 1; + COMBINE_DATA(&m_ppu.txs[idx].attribute); + } + else if (addr == 0x01002c || addr == 0x010048 || addr == 0x010064) // Text Layers control + { + int idx = ((offset>>3) & 3) - 1; + COMBINE_DATA(&m_ppu.txs[idx].control); + } + else if (addr == 0x010030 || addr == 0x01004c || addr == 0x010068) // Text Layers number ptr + { + int idx = ((offset>>3) & 3) - 1; + COMBINE_DATA(&m_ppu.txs[idx].nptr); + } + else if (addr == 0x010080) // PPU IRQ Control + { + COMBINE_DATA(&m_ppu.irq_control); + } + else if (addr == 0x010084) // PPU IRQ ack + { + if (ACCESSING_BITS_0_7) + m_ppu.irq_status &= ~data; + } + else if (addr >= 0x0100a0 && addr <= 0x0100a8) // Tx1 buffer start + { + COMBINE_DATA(&m_ppu.txs[0].buf_start[offset & 3]); + } + else if (addr >= 0x0100ac && addr <= 0x0100b4) // Tx2 buffer start + { + COMBINE_DATA(&m_ppu.txs[1].buf_start[(offset+1) & 3]); + } + else if (addr >= 0x0100b8 && addr <= 0x0100c0) // Tx3 buffer starts + { + COMBINE_DATA(&m_ppu.txs[2].buf_start[(offset+2) & 3]); + } + else if ((addr & 0xfff000) == 0x011000) // Palettes + { + COMBINE_DATA(&m_ppu.palettes[offset & 0x01ff]); + } + else if ((addr & 0xfff000) == 0x012000) // Tx horizontal offset + { + COMBINE_DATA(&m_ppu.tx_hoffset[offset & 0x01ff]); + } + else if ((addr & 0xfff000) == 0x013000) // Tx horizontal compression + { + COMBINE_DATA(&m_ppu.tx_hcomp[offset & 0x01ff]); + } + else if ((addr & 0xfff000) == 0x014000) // Sprite Control Registers + { + int idx = (offset>>1) & 0x1ff; + if (offset & 1) + COMBINE_DATA(&m_ppu.sprites[idx].attribute); + else + COMBINE_DATA(&m_ppu.sprites[idx].control); + } + else if (addr == 0x07005c) // MIU Status + { + COMBINE_DATA(&m_miu.status); + } + else if ((addr & 0xff0fff) == 0x160000) // Timer X Control 1 + { + int idx = (offset>>10) & 0x07; + COMBINE_DATA(&m_timers[idx].control); + + if (ACCESSING_BITS_24_31) + m_timers[idx].control &= ~(data & 0x04000000); // Timers IRQ ack + } + else if ((addr & 0xff0fff) == 0x160004) // Timer X Control 2 + { + int idx = (offset>>10) & 0x07; + COMBINE_DATA(&m_timers[idx].control2); + } + else if ((addr & 0xff0fff) == 0x160008) // Timer X Preload + { + int idx = (offset>>10) & 0x07; + COMBINE_DATA(&m_timers[idx].preload); + } + else if (addr == 0x2100e4) // Timer Source Clock Selection + { + UINT32 timers_clk = XTAL_27MHz / ((data & 0xff) + 1); + m_update_timer->adjust(attotime::from_hz(timers_clk), 0, attotime::from_hz(timers_clk)); + } + else if(addr == 0x130020) // I2C configuration + { + COMBINE_DATA(&m_i2c.config); + } + else if(addr == 0x130024) // I2C interrupt + { + COMBINE_DATA(&m_i2c.irq_control); + + if (ACCESSING_BITS_0_7) + m_i2c.irq_control &= ~(data & 0x00000001); // I2C IRQ ack + } + else if(addr == 0x130028) // I2C clock setting + { + COMBINE_DATA(&m_i2c.clock); + UINT32 i2c_clk = XTAL_27MHz / ((m_i2c.clock & 0x3ff) + 1); + m_i2c_timer->adjust(attotime::from_hz(i2c_clk), 0, attotime::from_hz(i2c_clk)); + } + else if(addr == 0x13002c) // I2C ID + { + COMBINE_DATA(&m_i2c.id); + } + else if(addr == 0x130030) // I2C port address + { + COMBINE_DATA(&m_i2c.port_addr); + } + else if(addr == 0x130034) // I2C write data + { + COMBINE_DATA(&m_i2c.wdata); + } + else if(addr == 0x130038) // I2C data data + { + COMBINE_DATA(&m_i2c.rdata); + } + else if(addr == 0x150000) // UART data + { + if (ACCESSING_BITS_0_7) + printf("%c", data & 0xff); + } + +#if LOG_SPG290_REGISTER_ACCESS + //else + { + if (!space.debugger_access()) + log_spg290_regs((offset >> 14) & 0xff, (offset<<2) & 0xffff, mem_mask, true, data); + } +#endif +} + +inline UINT32 hyperscan_state::spg290_read_mem(UINT32 offset) +{ + return m_maincpu->space(0).read_dword(offset); +} + +inline void hyperscan_state::spg290_write_mem(UINT32 offset, UINT32 data) +{ + return m_maincpu->space(0).write_dword(offset, data); +} + +void hyperscan_state::spg290_argb1555(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 posy, UINT16 posx, UINT16 argb) +{ + if (!(argb & 0x8000) && cliprect.contains(posx, posy)) + { + rgb_t color = rgb_t(pal5bit(argb >> 10), pal5bit(argb >> 5), pal5bit(argb >> 0)); + bitmap.pix32(posy, posx) = color; + } +} + +void hyperscan_state::spg290_rgb565(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 posy, UINT16 posx, UINT16 rgb, UINT32 transrgb) +{ + if ((!(transrgb & 0x10000) || (transrgb & 0xffff) != rgb) && cliprect.contains(posx, posy)) + { + rgb_t color = rgb_t(pal5bit(rgb >> 11), pal6bit(rgb >> 5), pal5bit(rgb >> 0)); + bitmap.pix32(posy, posx) = color; + } +} + +void hyperscan_state::spg290_blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, UINT32 *palettes, UINT32 buf_start) +{ + UINT32 sprite_base = buf_start + ((control & 0xffff) << 8); + UINT16 sprite_x = (control >> 16) & 0x3ff; + UINT16 sprite_y = (attribute >> 16) & 0x3ff; + UINT8 sprite_hsize = 8 << ((attribute >> 4) & 0x03); + UINT8 sprite_vsize = 8 << ((attribute >> 6) & 0x03); + UINT8 bit_pixel = ((attribute & 3) + 1) << 1; + UINT8 pixel_word = 32 / bit_pixel; + UINT8 word_line = sprite_hsize / pixel_word; + UINT8 sprite_flip = (attribute >> 2) & 0x03; + + for (int y=0; y < sprite_vsize; y++) + for (int x=0; x < word_line; x++) + { + UINT32 data = spg290_read_mem(sprite_base + (y * pixel_word + x) * 4); + + for (int b=0; b < pixel_word; b++) + { + UINT16 pen = ((data >> (b * bit_pixel)) & ((1 << bit_pixel) - 1)); + UINT16 posx; + if (sprite_flip & 0x01) + posx = sprite_x + (sprite_hsize - (x * word_line + b)); + else + posx = sprite_x + x * (word_line) + b; + + UINT16 posy; + if (sprite_flip & 0x02) + posy = sprite_y + (sprite_vsize - y); + else + posy = sprite_y + y; + + spg290_argb1555(bitmap, cliprect, posy, posx, palettes[pen]); + } + } +} + +void hyperscan_state::spg290_blit_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, int posy, int posx, UINT32 nptr, UINT32 buf_start, UINT32 transrgb) +{ + for (int y=0; y<512; y++) + { + int line = (control & 0x04) ? 0 : y; + UINT32 tx_start = spg290_read_mem(nptr + (posy + line) * 4); + + for (int x=0; x < 1024>>1; x++) + { + UINT32 data = spg290_read_mem(buf_start + (tx_start + posx) * 2 + x * 4); + + for (int b=0; b < 2; b++) + { + UINT16 posx = x * 2 + b; + UINT16 posy = y; + UINT16 pix = (data >> (b*16)) & 0xffff; + + if (control & 0x0080) + spg290_argb1555(bitmap, cliprect, posy, posx, pix); + if (control & 0x1000) + spg290_rgb565(bitmap, cliprect, posy, posx, pix, transrgb); + } + } + } +} + +void hyperscan_state::spg290_blit_character(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, int posy, int posx, UINT32 nptr, UINT32 buf_start, UINT32 transrgb) +{ + // TODO +} + + +UINT32 hyperscan_state::spg290_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (m_ppu.control & 0x1000) + { + for (int depth=0; depth<4; depth++) + { + // draw the bitmap/text layers + for (int l=0; l<3; l++) + if ((m_ppu.txs[l].control & 0x08) && ((m_ppu.txs[l].attribute >> 13) & 3) == depth) + { + if (m_ppu.txs[l].control & 0x01) + spg290_blit_bitmap(bitmap, cliprect, m_ppu.txs[l].control, m_ppu.txs[l].attribute, m_ppu.txs[l].posy & 0x1ff, m_ppu.txs[l].posx & 0x1ff, m_ppu.txs[l].nptr, m_ppu.txs[l].buf_start[0], m_ppu.transrgb); + else + spg290_blit_character(bitmap, cliprect, m_ppu.txs[l].control, m_ppu.txs[l].attribute, m_ppu.txs[l].posy & 0x1ff, m_ppu.txs[l].posx & 0x1ff, m_ppu.txs[l].nptr, m_ppu.txs[l].buf_start[0], m_ppu.transrgb); + } + + // draw the sprites + for (int i=0; i<=(m_ppu.sprite_max & 0x1ff); i++) + { + if (((m_ppu.sprites[i].attribute >> 13) & 3) == depth) + spg290_blit_sprite(bitmap, cliprect, m_ppu.sprites[i].control, m_ppu.sprites[i].attribute, m_ppu.palettes, m_ppu.sprite_buf_start); + } + } + } + else + { + bitmap.fill(rgb_t::black, cliprect); + } + + return 0; +} + +void hyperscan_state::spg290_timers_update() +{ + for(int i=0; i<6; i++) + if (m_timers[i].control & 0x80000000) + { + if (((m_timers[i].control2 >> 30) & 0x03) == 0x00) + { + if (m_timers[i].counter == 0xffff) + { + m_timers[i].counter = m_timers[i].preload; + if (m_timers[i].control & 0x08000000) + { + m_timers[i].control |= 0x04000000; + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 56); + } + } + else + m_timers[i].counter++; + } + else + { + // TODO: capture, comparison and PWM mode + + } + } +} + +void hyperscan_state::spg290_vblank_irq(screen_device &screen, bool state) +{ + if (state && m_ppu.irq_control & 0x01) // VBlanking Start IRQ + { + m_ppu.irq_status |= 0x01; + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 53); + } + else if (!state && m_ppu.irq_control & 0x02) // VBlanking End IRQ + { + m_ppu.irq_status |= 0x02; + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 53); + } +} + + +void hyperscan_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SPG290: + spg290_timers_update(); + break; + case TIMER_I2C: + if ((m_i2c.config & 0x40) && (m_i2c.config & 0x01)) + { + // TODO: replace with real I2C emulation + m_i2c.rdata = 0; + + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 39); + } + break; + } +} + +static ADDRESS_MAP_START(spg290_mem, AS_PROGRAM, 32, hyperscan_state) + ADDRESS_MAP_GLOBAL_MASK(0x1fffffff) + AM_RANGE(0x00000000, 0x00ffffff) AM_RAM AM_MIRROR(0x07000000) + AM_RANGE(0x08000000, 0x09ffffff) AM_READWRITE(spg290_regs_r, spg290_regs_w) + AM_RANGE(0x0a000000, 0x0a003fff) AM_RAM // internal SRAM + AM_RANGE(0x0b000000, 0x0b007fff) AM_ROM AM_REGION("spg290", 0) // internal ROM + AM_RANGE(0x1e000000, 0x1e0fffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x0e000000) + AM_RANGE(0x1f000000, 0x1f0fffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x0e000000) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( hyperscan ) +INPUT_PORTS_END + + +void hyperscan_state::machine_start() +{ + m_update_timer = timer_alloc(TIMER_SPG290); + m_i2c_timer = timer_alloc(TIMER_I2C); +} + +void hyperscan_state::machine_reset() +{ + memset(&m_ppu, 0, sizeof(spg290_ppu)); + memset(&m_miu, 0, sizeof(spg290_miu)); + memset(&m_i2c, 0, sizeof(m_i2c)); + m_i2c_timer->adjust(attotime::never, 0, attotime::never); + + // disable JTAG + m_maincpu->set_state_int(SCORE_CR + 29, 0x20000000); +} + + +static MACHINE_CONFIG_START( hyperscan, hyperscan_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", SCORE7, XTAL_27MHz * 4) // 108MHz S+core 7 + MCFG_CPU_PROGRAM_MAP(spg290_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(hyperscan_state, spg290_screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_VBLANK_DRIVER(hyperscan_state, spg290_vblank_irq) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( hs ) + ROM_REGION( 0x100000, "bios", ROMREGION_32BIT | ROMREGION_LE ) + ROM_LOAD32_DWORD("hyperscan.bin", 0x000000, 0x100000, CRC(ce346a14) SHA1(560cb747e7193e6781d4b8b0bd4d7b45d3d28690)) + + ROM_REGION( 0x008000, "spg290", ROMREGION_32BIT | ROMREGION_LE ) + ROM_LOAD32_DWORD("spg290.bin", 0x000000, 0x008000, NO_DUMP) // 256Kbit SPG290 internal ROM +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 2006, hs, 0, 0, hyperscan , hyperscan , driver_device, 0, "Mattel", "HyperScan", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/i7000.c b/src/mame/drivers/i7000.c new file mode 100644 index 00000000000..01c561a5284 --- /dev/null +++ b/src/mame/drivers/i7000.c @@ -0,0 +1,401 @@ +// license:GPL-2.0+ +// copyright-holders: Felipe Sanches +/*************************************************************************** + + Itautec I7000 + + driver by Felipe C. da S. Sanches + with tech info provided by Alexandre Souza (a.k.a. Tabajara). + + The portuguese Wikipedia article available at + http://pt.wikipedia.org/wiki/Itautec_I-7000 + also provides a technical overview of this machine: + + The I-7000 was the first computer manufactured by Itautec + (http://www.itautec.com.br/pt-br/produtos). It was originally an 8 bit CP/M + computer that became an IBM PC-XT clone in later hardware revisions which + took the "I-7000 PC-XT" name. + + * Released in 1982 + * Operating System: SIM/M / BASIC + * CPU: National NSC800 D-4 at 4,00 MHz + * Memory: 64KB to 128KB + * keyboards: 80 keys (with a reduced numerical keypad and function keys) + * display: + - 40 X 25 text + - 80 X 25 text + - 160 X 100 (8 colors) + - 640 X 200 (monochrome, with an expansion board) + - 320 X 200 (16 colors, with an expansion board) + * Expansion slots: + - 1 frontal cart slot + - 4 internal expansion slots + * Ports: + - 1 composite video output for a color monitor + - 2 cassete interfaces + - 1 RS-232C serial port + - 1 parallel interface + * Storage: + - Cassetes recorder + - Up to 4 external floppy drives: 8" (FD/DD, 1,1MB) or 5" 1/4 + - Up to 1 external 10 MB hard-drive + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" //CPU was actually a NSC800 (Z80 compatible) +#include "bus/generic/carts.h" +#include "machine/pit8253.h" +#include "machine/i8279.h" +#include "sound/speaker.h" +#include "video/mc6845.h" + +class i7000_state : public driver_device +{ +public: + i7000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_card(*this, "cardslot"), + m_gfxdecode(*this, "gfxdecode"), + m_videoram(*this, "videoram") + { } + + void video_start(); + void machine_start(); + + required_device m_maincpu; + required_device m_card; + required_device m_gfxdecode; + required_shared_ptr m_videoram; + UINT32 screen_update_i7000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT8 *m_char_rom; + UINT8 m_row; + tilemap_t *m_bg_tilemap; + + TILE_GET_INFO_MEMBER(get_bg_tile_info); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr); + DECLARE_DRIVER_INIT(i7000); + DECLARE_PALETTE_INIT(i7000); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( i7000_card ); + + DECLARE_READ8_MEMBER(i7000_kbd_r); + DECLARE_WRITE8_MEMBER(i7000_scanlines_w); +}; + +WRITE8_MEMBER( i7000_state::i7000_scanlines_w ) +{ + m_row = data; +} + +READ8_MEMBER( i7000_state::i7000_kbd_r ) +{ + UINT8 data = 0xff; + + for (int i=0; i<40*25; i++){ + m_bg_tilemap->mark_tile_dirty(i); + } + + if (m_row < 8) + { + char kbdrow[6]; + sprintf(kbdrow,"X%X",m_row); + data = ioport(kbdrow)->read(); + } + return data; +} + +/* Input ports */ +static INPUT_PORTS_START( i7000 ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("!") PORT_CHAR('!') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0x9D") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0x8F") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^R DC2") //0x12 + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("$ ^") PORT_CHAR('$') PORT_CHAR('^') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0xA0") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("% +") PORT_CHAR('%') PORT_CHAR('+') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0x9C") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CHAR('@') + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 *") PORT_CODE(KEYCODE_5) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^U NAK") //0x15 + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("| <") PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^E ENQ") //0x05 + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^O SI") //0x0F + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("#") PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("{") PORT_CHAR('{') + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^L FF") //0x0C + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^T DC4") //0x14 + + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(">") PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACEBAR") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("}") PORT_CHAR('}') + + PORT_START("DSW") /* DP01 */ + PORT_DIPNAME( 0x80, 0x80, "1") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x40, 0x40, "2") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x20, 0x00, "3") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x10, 0x10, "4") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x08, 0x08, "5") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x04, "6") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x02, 0x00, "7") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x01, 0x01, "8") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) +INPUT_PORTS_END + +DRIVER_INIT_MEMBER(i7000_state, i7000) +{ +} + +void i7000_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + if (m_card->exists()) + { + // 0x4000 - 0xbfff 32KB ROM + program.install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_card)); + } +} + +PALETTE_INIT_MEMBER(i7000_state, i7000) +{ + palette.set_pen_color(0, rgb_t(0x33, 0x33, 0x33)); + palette.set_pen_color(1, rgb_t(0xBB, 0xBB, 0xBB)); +} + +/*FIXME: we still need to figure out the proper memory map + for the maincpu and where the cartridge slot maps to. */ +static ADDRESS_MAP_START(i7000_mem, AS_PROGRAM, 8, i7000_state) + AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("boot", 0) + AM_RANGE(0x2000, 0x2fff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x4000, 0xffff) AM_RAM +// AM_RANGE(0x4000, 0xbfff) AM_ROM AM_REGION("cardslot", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( i7000_io , AS_IO, 8, i7000_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK (0xff) +// AM_RANGE(0x06, 0x06) AM_WRITE(i7000_io_?_w) +// AM_RANGE(0x08, 0x09) AM_WRITE(i7000_io_?_w) //printer perhaps? +// AM_RANGE(0x0c, 0x0c) AM_WRITE(i7000_io_?_w) //0x0C and 0x10 may be related to mem page swapping. (self-test "4. PAG") +// AM_RANGE(0x10, 0x10) AM_WRITE(i7000_io_?_w) +// AM_RANGE(0x14, 0x15) AM_WRITE(i7000_io_?_w) + + AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + +// AM_RANGE(0x1c, 0x1c) AM_WRITE(i7000_io_printer_data_w) //ASCII data + AM_RANGE(0x1d, 0x1d) AM_READ_PORT("DSW") +// AM_RANGE(0x1e, 0x1e) AM_READWRITE(i7000_io_printer_status_r, i7000_io_?_w) +// AM_RANGE(0x1f, 0x1f) AM_WRITE(i7000_io_printer_strobe_w) //self-test routine writes 0x08 and 0x09 (it seems that bit 0 is the strobe and bit 3 is an enable signal) +// AM_RANGE(0x20, 0x21) AM_READWRITE(i7000_io_keyboard_r, i7000_io_keyboard_w) + + AM_RANGE( 0x20, 0x20 ) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w) + AM_RANGE( 0x21, 0x21 ) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) + +// AM_RANGE(0x24, 0x24) AM_READ(i7000_io_?_r) +// AM_RANGE(0x25, 0x25) AM_WRITE(i7000_io_?_w) + +// AM_RANGE(0x28, 0x2d) AM_READWRITE(i7000_io_joystick_r, i7000_io_joystick_w) + +// AM_RANGE(0x3b, 0x3b) AM_WRITE(i7000_io_?_w) +// AM_RANGE(0x66, 0x67) AM_WRITE(i7000_io_?_w) +// AM_RANGE(0xbb, 0xbb) AM_WRITE(i7000_io_?_w) //may be related to page-swapping... +ADDRESS_MAP_END + +DEVICE_IMAGE_LOAD_MEMBER( i7000_state, i7000_card ) +{ + UINT32 size = m_card->common_get_size("rom"); + + m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG); + m_card->common_load_rom(m_card->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +static const gfx_layout i7000_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( i7000 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, i7000_charlayout, 0, 8 ) +GFXDECODE_END + +/**************************** +* Video/Character functions * +****************************/ + +TILE_GET_INFO_MEMBER(i7000_state::get_bg_tile_info) +{ + SET_TILE_INFO_MEMBER(0, /*code:*/ m_videoram[tile_index], /*color:*/ 0, 0); +} + +void i7000_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(i7000_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 40, 25); +} + +UINT32 i7000_state::screen_update_i7000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + +/* ROCKWELL 6545 - Transparent Memory Addressing */ +MC6845_ON_UPDATE_ADDR_CHANGED(i7000_state::crtc_addr) +{ + /* What is this mandatory function meant to do ? */ +} + + +static MACHINE_CONFIG_START( i7000, i7000_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NSC800, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(i7000_mem) + MCFG_CPU_IO_MAP(i7000_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(320, 200) /* 40x25 8x8 chars */ + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + + MCFG_SCREEN_UPDATE_DRIVER(i7000_state, screen_update_i7000) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", i7000) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(i7000_state, i7000) + + MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_20MHz) /* (?) */ + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_ADDR_CHANGED_CB(i7000_state, crtc_addr) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Programmable timer */ + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) +// MCFG_PIT8253_CLK0(XTAL_4MHz / 2) /* TODO: verify on PCB */ +// MCFG_PIT8253_OUT0_HANDLER(WRITELINE(i7000_state,i7000_pit_out0)) +// MCFG_PIT8253_CLK1(XTAL_4MHz / 2) /* TODO: verify on PCB */ +// MCFG_PIT8253_OUT1_HANDLER(WRITELINE(i7000_state,i7000_pit_out1)) + MCFG_PIT8253_CLK2(XTAL_4MHz / 2) /* TODO: verify on PCB */ + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) + + /* Keyboard interface */ + MCFG_DEVICE_ADD("i8279", I8279, 4000000) /* guessed value. TODO: verify on PCB */ + MCFG_I8279_OUT_SL_CB(WRITE8(i7000_state, i7000_scanlines_w)) // scan SL lines + MCFG_I8279_IN_RL_CB(READ8(i7000_state, i7000_kbd_r)) // kbd RL lines + MCFG_I8279_IN_SHIFT_CB(VCC) // TODO: Shift key + MCFG_I8279_IN_CTRL_CB(VCC) // TODO: Ctrl key + + /* Cartridge slot */ + MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_romram_plain_slot, "i7000_card") + MCFG_GENERIC_EXTENSIONS("rom") + MCFG_GENERIC_LOAD(i7000_state, i7000_card) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("card_list", "i7000_card") +MACHINE_CONFIG_END + +ROM_START( i7000 ) + ROM_REGION( 0x1000, "boot", 0 ) + ROM_LOAD( "i7000_boot_v1_4r02_15_10_85_d52d.rom", 0x0000, 0x1000, CRC(622412e5) SHA1(bf187a095600fd46a739c35132a85b5f39b2f867) ) + + ROM_REGION( 0x0800, "gfx1", 0 ) + ROM_LOAD( "i7000_chargen.rom", 0x0000, 0x0800, CRC(7ba75183) SHA1(4af799f4a8bd385e1e4e5ece378df93e1133dc12) ) + + ROM_REGION( 0x1000, "drive", 0 ) + ROM_LOAD( "i7000_drive_ci01.rom", 0x0000, 0x1000, CRC(d8d6e5c1) SHA1(93e7db42fbfaa8243973321c7fc8c51ed80780be) ) + + ROM_REGION( 0x1000, "telex", 0 ) + ROM_LOAD( "i7000_telex_ci09.rom", 0x0000, 0x1000, CRC(c1c8fcc8) SHA1(cbf5fb600e587b998f190a9e3fb398a51d8a5e87) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, i7000, 0, 0, i7000, i7000, i7000_state, i7000, "Itautec", "I-7000", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/ibm6580.c b/src/mame/drivers/ibm6580.c new file mode 100644 index 00000000000..8a10c35a487 --- /dev/null +++ b/src/mame/drivers/ibm6580.c @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +IBM 6580 DisplayWriter. + +2013-08-19 Skeleton driver. + +A green-screen dedicated word-processing workstation. It uses 20cm floppy +disks. It could have up to 224k of ram. + +ToDo: +- Everything! +- The roms need to be loaded properly. +- Chargen rom is not dumped. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" + +class ibm6580_state : public driver_device +{ +public: + ibm6580_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + + const UINT8 *m_p_chargen; + DECLARE_PALETTE_INIT(ibm6580); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +private: + virtual void machine_reset(); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(ibm6580_mem, AS_PROGRAM, 16, ibm6580_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0xfdfff) AM_RAM + AM_RANGE(0xfe000,0xfffff) AM_ROM AM_REGION("user1", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ibm6580_io, AS_IO, 16, ibm6580_state) + //ADDRESS_MAP_UNMAP_HIGH + //ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( ibm6580 ) +INPUT_PORTS_END + +UINT32 ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +PALETTE_INIT_MEMBER( ibm6580_state, ibm6580 ) +{ + palette.set_pen_color(0, 0, 0, 0 ); /* Black */ + palette.set_pen_color(1, 0, 255, 0 ); /* Full */ + palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */ +} + +void ibm6580_state::machine_reset() +{ + m_p_chargen = memregion("chargen")->base(); +} + +static MACHINE_CONFIG_START( ibm6580, ibm6580_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 4000000) // no idea + MCFG_CPU_PROGRAM_MAP(ibm6580_mem) + MCFG_CPU_IO_MAP(ibm6580_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(ibm6580_state, screen_update) + MCFG_SCREEN_SIZE(640, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(ibm6580_state, ibm6580) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ibm6580 ) + ROM_REGION16_LE( 0x2000, "user1", 0 ) + ROM_LOAD16_BYTE("8493823.bin", 0x0001, 0x1000, CRC(0bea066f) SHA1(8a42e24b609df7d9ca9cd52929702a61f7024635)) + ROM_LOAD16_BYTE("8493822.bin", 0x0000, 0x1000, CRC(6e67f41a) SHA1(600fee505efe5cbcc8bdbab91d233378c7be4f12)) + + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "8493383.bin", 0x0000, 0x2000, NO_DUMP ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, ibm6580, 0, 0, ibm6580, ibm6580, driver_device, 0, "IBM", "IBM 6580 DisplayWriter", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/ibmpc.c b/src/mame/drivers/ibmpc.c new file mode 100644 index 00000000000..9f9f73e18a5 --- /dev/null +++ b/src/mame/drivers/ibmpc.c @@ -0,0 +1,577 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Miodrag Milanovic +/*************************************************************************** + + drivers/pc.c + +Driver file for IBM PC, IBM PC XT, and related machines. + + PC-XT memory map + + 00000-9FFFF RAM + A0000-AFFFF NOP or videoram EGA/VGA + B0000-B7FFF videoram MDA, page #0 + B8000-BFFFF videoram CGA and/or MDA page #1, T1T mapped RAM + C0000-C7FFF NOP or ROM EGA/VGA + C8000-C9FFF ROM XT HDC #1 + CA000-CBFFF ROM XT HDC #2 + D0000-EFFFF NOP or 'adapter RAM' + F0000-FDFFF NOP or ROM Basic + other Extensions + FE000-FFFFF ROM + +IBM PC 5150 +=========== + +- Intel 8088 at 4.77 MHz derived from a 14.31818 MHz crystal +- Onboard RAM: Revision A mainboard - min. 16KB, max. 64KB + Revision B mainboard - min. 64KB, max. 256KB +- Total RAM (using 5161 expansion chassis or ISA memory board): 512KB (rev 1 or rev 2 bios) or 640KB (rev 3 bios) +- Graphics: MDA, CGA, or MDA and CGA +- Cassette port +- Five ISA expansion slots (short type) +- PC/XT keyboard 83-key 'IBM Model F' (some early 'IBM Model M' keyboards can produce scancodes compatible with this as well, but it was an undocumented feature unsupported by IBM) +- Optional 8087 co-processor +- Optional up to 4 (2 internal, 2 external) 160KB single-sided or 360KB double-sided 5 1/4" floppy drives +- Optional 10MB hard disk (using 5161 expansion chassis) +- Optional Game port joystick ISA card (two analog joysticks with 2 buttons each) +- Optional Parallel port ISA card, Unidirectional (upgradable to bidirectional (as is on the ps/2) with some minor hacking; IBM had all the circuitry there but it wasn't hooked up properly) +- Optional Serial port ISA card + + +IBM PC-JR +========= + + +IBM PC-XT 5160 +============== + +- Intel 8088 at 4.77 MHz derived from a 14.31818 MHz crystal +- Onboard RAM: Revision A mainboard (P/N 6181655) - min. 64KB, max. 256KB (4x 64KB banks of 9 IMS2600 64kx1 drams plus parity); could be upgraded to 640KB with a hack; may support the weird 256k stacked-chip dram the AT rev 1 uses) + Revision B mainboard - min. 256KB, max 640KB (2x 256KB, 2x 64KB banks) +- Total RAM (using 5161 expansion chassis, ISA memory board, or rev B mainboard): 640KB +- Graphics: MDA, CGA, MDA and CGA, EGA, EGA and MDA, or EGA and CGA +- One internal 360KB double-sided 5 1/4" floppy drive +- PC/XT keyboard 83-key 'IBM Model F' (BIOS revisions 1 and 2) (some early 'IBM Model M' keyboards can produce scancodes compatible with this as well, but it was an undocumented feature unsupported by IBM) +- 84-key 'AT/Enhanced' keyboard or 101-key 'IBM Model M' (BIOS revisions 3 and 4) +- Eight ISA expansion slots (short type) +- Optional 8087 co-processor +- Optional second internal 360KB double-sided 5 1/4" floppy drive, if no internal hard disk +- Optional 'half height' 720KB double density 3 1/2" floppy drive +- Optional 10MB hard disk via 5161 expansion chassis +- Optional 10MB or 20MB Seagate ST-412 hard disk (in place of second floppy drive) +- Optional up to 2 external 360KB double-sided 5 1/4" floppy drive +- Optional Game port joystick ISA card (two analog joysticks with 2 buttons each) +- Optional Parallel port ISA card, Unidirectional (upgradable to bidirectional (as is on the ps/2) with some minor hacking; IBM had all the circuitry there but it wasn't hooked up properly) +- Optional Serial port ISA card + + +IBM PC Jr: + +TODO: Which clock signals are available in a PC Jr? + - What clock is Y1? This eventually gets passed on to the CPU (ZM40?) and some other components by a 8284 (ZM8?). + - Is the clock attached to the Video Gate Array (ZM36?) exactly 14MHz? + +IBM CGA/MDA: +Several different font roms were available, depending on what region the card was purchased in; +Currently known: (probably exist for all the standard codepages) +5788005: US (code page 437) +???????: Greek (code page 737) NOT DUMPED! +???????: Estonian/Lithuanian/Latvian (code page 775) NOT DUMPED! +???????: Icelandic (code page 861, characters 0x8B-0x8D, 0x95, 0x97-0x98, 0x9B, 0x9D, 0xA4-0xA7 differ from cp437) NOT DUMPED! +4733197: Danish/Norwegian (code page 865, characters 0x9B and 0x9D differ from cp437) +???????: Hebrew (code page 862) NOT DUMPED! + +========================= +IBM Roms thanks to Frode +========================= + +1504036.bin: IBM 4860 PC/jr BIOS. visible in memory at F0000-F7FFF. +1504037.bin: IBM 4860 PC/jr BIOS. visible in memory at F8000-FFFFF. + + ROM_LOAD( "1504036.bin", 0xf0000, 0x8000, CRC(de8fa668) SHA1(459341e033be1199c107e56d33680170e144b689)) + ROM_LOAD( "1504037.bin", 0xf8000, 0x8000, CRC(04c05f17) SHA1(319423cb6bb02b399ecf6e0cb82015c16ada68f5)) + +5601JDA.bin: IBM 5511 PC/JX BIOS. visible in memory at F0000-FFFFF. + ROM_LOAD( "5601jda.bin", 0xf0000, 0x10000, CRC(b1e12366) SHA1(751feb16b985aa4f1ec1437493ff77e2ebd5e6a6)) + +7396917.bin: IBM 5140 PC/Convertible BIOS. visible in memory at F0000-F7FFF. +7396918.bin: IBM 5140 PC/Convertible BIOS. visible in memory at F8000-FFFFF. + ROM_LOAD( "7396917.bin", 0xf0000, 0x8000, CRC(95c35652) SHA1(2bdac30715dba114fbe0895b8b4723f8dc26a90d)) + ROM_LOAD( "7396918.bin", 0xf8000, 0x8000, CRC(1b4202b0) SHA1(4797ff853ba1675860f293b6368832d05e2f3ea9)) + +5700019.bin: IBM 5150 PC BASIC 1.0. visible in memory at F6000-F7FFF. +5700027.bin: IBM 5150 PC BASIC 1.0. visible in memory at F8000-F9FFF. +5700035.bin: IBM 5150 PC BASIC 1.0. visible in memory at FA000-FBFFF. +5700043.bin: IBM 5150 PC BASIC 1.0. visible in memory at FC000-FDFFF. + ROM_LOAD( "5700019.bin", 0xf6000, 0x2000, CRC(b59e8f6c) SHA1(7a5db95370194c73b7921f2d69267268c69d2511)) + ROM_LOAD( "5700027.bin", 0xf8000, 0x2000, CRC(bfff99b8) SHA1(ca2f126ba69c1613b7b5a4137d8d8cf1db36a8e6)) + ROM_LOAD( "5700035.bin", 0xfa000, 0x2000, CRC(9fe4ec11) SHA1(89af8138185938c3da3386f97d3b0549a51de5ef)) + ROM_LOAD( "5700043.bin", 0xfc000, 0x2000, CRC(ea2794e6) SHA1(22fe58bc853ffd393d5e2f98defda7456924b04f)) + + +5700051.bin: First early IBM 5150 PC BIOS. visible in memory at FE000-FFFFF. + ROM_LOAD( "5700051.bin", 0xfe000, 0x2000, CRC(12d33fb8) SHA1(f046058faa016ad13aed5a082a45b21dea43d346)) +5700671.bin: Second early IBM 5150 PC BIOS. visible in memory at FE000-FFFFF. + ROM_LOAD( "5700671.bin", 0xfe000, 0x2000, CRC(b7d4ec46) SHA1(bdb06f846c4768f39eeff7e16b6dbff8cd2117d2)) + +5000019.bin: IBM 5150 PC BASIC 1.1. visible in memory at F6000-F7FFF. +5000021.bin: IBM 5150 PC BASIC 1.1. visible in memory at F8000-F9FFF. +5000022.bin: IBM 5150 PC BASIC 1.1. visible in memory at FA000-FBFFF. +5000023.bin: IBM 5150 PC BASIC 1.1. visible in memory at FC000-FDFFF. + ROM_LOAD( "5000019.bin", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) + ROM_LOAD( "5000021.bin", 0xf8000, 0x2000, CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731)) + ROM_LOAD( "5000022.bin", 0xfa000, 0x2000, CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74)) + ROM_LOAD( "5000023.bin", 0xfc000, 0x2000, CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7)) + + +5700476.0.bin: Late IBM 5150 PC BIOS. visible in memory at FE000-FFFFF. (1981 copyright) + ROM_LOAD( "1501476.0.bin", 0xfe000, 0x2000, CRC(9b791d3e) SHA1(0c93f07e62cd27688f7f473e9787ef5308535fa0)) +5700476.1.bin: Late IBM 5150 PC BIOS. visible in memory at FE000-FFFFF. (1982 copyright) + ROM_LOAD( "1501476.1.bin", 0xfe000, 0x2000, CRC(e88792b3) SHA1(40fce6a94dda4328a8b608c7ae2f39d1dc688af4)) + +5000027.bin: Early IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F6000-F7FFF. +5000026.bin: Prototype IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. + ROM_LOAD( "5000027.bin", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) + ROM_LOAD( "5000026.bin", 0xf8000, 0x8000, CRC(3c9b0ac3) SHA1(271c9f4cef5029a1560075550b67c3395db09fef)) + +6359116.bin: Early IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F6000-F7FFF. + ROM_LOAD( "6359116.bin", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) + +1501512.bin: Early IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. + ROM_LOAD( "1501512.bin", 0xf8000, 0x8000, CRC(79522c3d) SHA1(6bac726d8d033491d52507278aa388ec04cf8b7e)) + +62x0854.bin: First late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F0000-F7FFF. (PROM) +62x0851.bin: First late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. (PROM) + ROM_LOAD( "62x0854.bin", 0xf0000, 0x8000, CRC(b5fb0e83) SHA1(937b43759ffd472da4fb0fe775b3842f5fb4c3b3)) + ROM_LOAD( "62x0851.bin", 0xf8000, 0x8000, CRC(1054f7bd) SHA1(e7d0155813e4c650085144327581f05486ed1484)) + +62x0853.bin: First late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F0000-F7FFF. (EPROM) +62x0852.bin: First late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. (EPROM) + ROM_LOAD( "62x0853.bin", 0xf0000, 0x8000, CRC(b5fb0e83) SHA1(937b43759ffd472da4fb0fe775b3842f5fb4c3b3)) + ROM_LOAD( "62x0852.bin", 0xf8000, 0x8000, CRC(1054f7bd) SHA1(e7d0155813e4c650085144327581f05486ed1484)) + +68x4370.bin: Second late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F0000-F7FFF. (PROM) +62x0890.bin: Second late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. (PROM) + ROM_LOAD( "68x4370.bin", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2)) + ROM_LOAD( "62x0890.bin", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb)) + +62x0819.bin: Second late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F0000-F7FFF. (EPROM) +59x7268.bin: Second late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. (EPROM) + ROM_LOAD( "62x0819.bin", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2)) + ROM_LOAD( "59x7268.bin", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb)) + +78x7460.bin: IBM 5162 PC/XT 286 BIOS. visible in even memory at F0000-FFFFF (mirror at E0000-EFFFF). +78x7461.bin: IBM 5162 PC/XT 286 BIOS. visible in odd memory at F0000-FFFFF (mirror at E0000-EFFFF). + ROM_LOAD16_BYTE( "78x7460.bin", 0xf0000, 0x8000, CRC(1db4bd8f) SHA1(7be669fbb998d8b4626fefa7cd1208d3b2a88c31)) + ROM_LOAD16_BYTE( "78x7461.bin", 0xf0001, 0x8000, CRC(be14b453) SHA1(ec7c10087dbd53f9c6d1174e8f14212e2aec1818)) + +6181028.bin: First 6MHz IBM 5170 PC/AT BIOS. visible in even memory at F0000-FFFFF. +6181029.bin: First 6MHz IBM 5170 PC/AT BIOS. visible in odd memory at F0000-FFFFF. + ROM_LOAD16_BYTE( "6181028.bin", 0xf0000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a)) + ROM_LOAD16_BYTE( "6181029.bin", 0xf0001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be)) + +6480090.bin: Second 6MHz IBM 5170 PC/AT BIOS. visible in even memory at F0000-FFFFF. +6480091.bin: Second 6MHz IBM 5170 PC/AT BIOS. visible in odd memory at F0000-FFFFF. + ROM_LOAD16_BYTE( "6480090.bin", 0xf0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e)) + ROM_LOAD16_BYTE( "6480091.bin", 0xf0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16)) + +62x0820.bin: 8MHz IBM 5170 PC/AT BIOS. visible in even memory at F0000-FFFFF. (PROM) +62x0821.bin: 8MHz IBM 5170 PC/AT BIOS. visible in odd memory at F0000-FFFFF. (PROM) + ROM_LOAD( "62x0820.bin", 0xf0000, 0x8000, CRC(e9cc3761) SHA1(ff9373c1a1f34a32fb6acdabc189c61b01acf9aa)) + ROM_LOAD( "62x0821.bin", 0xf0001, 0x8000, CRC(b5978ccb) SHA1(2a1aeb9ae3cd7e60fc4c383ca026208b82156810)) + +61x9266.bin: 8MHz IBM 5170 PC/AT BIOS. visible in even memory at F0000-FFFFF. (EPROM) +61x9265.bin: 8MHz IBM 5170 PC/AT BIOS. visible in odd memory at F0000-FFFFF. (EPROM) + ROM_LOAD( "61x9265.bin", 0xf0001, 0x8000, CRC(c32713e4) SHA1(22ed4e2be9f948682891e2fd056a97dbea01203c)) + ROM_LOAD( "61x9266.bin", 0xf0000, 0x8000, CRC(4995be7a) SHA1(8e8e5c863ae3b8c55fd394e345d8cca48b6e575c)) + + +5788005.bin: IBM MDA/CGA font. Not mapped in PC memory. (American manufacture, otherwise similar to the European manufacture) + ROM_LOAD( "5788005.bin", 0x0000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) + +6359300.bin: IBM MDA/CGA font. Not mapped in PC memory. (European manufacture, otherwise similar to the American manufacture) + ROM_LOAD( "6359300.bin", 0x0000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) + +4733197.bin: IBM MDA/CGA Alternative font. Not mapped in PC memory. + ROM_LOAD( "4733197.bin", 0x0000, 0x2000, CRC(650c0f85) SHA1(0c8ac77248a9856d065b1c64658e712ea55b7507)) + +6277356.bin: IBM EGA ROM. Visible in memory at C3FFF-C0000. + ROM_LOAD( "6277356.bin", 0x0000, 0x4000, CRC(dc146448) SHA1(dc0794499b3e499c5777b3aa39554bbf0f2cc19b)) + +8222554.bin: IBM VGA ROM. Visible in memory at C0000-C5FFF. + ROM_LOAD( "8222554.bin", 0x0000, 0x6000, CRC(6c12d745) SHA1(c0156607100e377c6c9563f23967409dab3ab92b)) + +5000059.bin: First version Hard drive controller ROM. Visible in memory at C8000-C9FFF. + ROM_LOAD( "5000059.bin", 0xc8000, 0x2000, CRC(03e0ee9a) SHA1(6691be4f6a8d690c696ad8b259708d3e7e87ad89)) + +6359121.bin: First version Hard drive controller ROM. Visible in memory at C8000-C9FFF. + ROM_LOAD( "6359121.bin", 0xc8000, 0x2000, CRC(03e0ee9a) SHA1(6691be4f6a8d690c696ad8b259708d3e7e87ad89)) + +59x7291.bin: Second version Hard drive controller ROM. Visible in memory at C8000-C8FFF. + ROM_LOAD( "59x7291.bin", 0xc8000, 0x1000, CRC(25920437) SHA1(de970bcc5c6f1b588fbc4c76617165ce8eb2bf1d)) + +104839e.bin: Hard drive controller Z80 firmware ROM. Not mapped in PC memory. (Mapped in Z80 microcontroller memory at 0000-7FFF) + ROM_LOAD( "104839e.bin", 0x0000, 0x1000, CRC(3ad32fcc) SHA1(0127fa520aaee91285cb46a640ed835b4554e4b3)) + +6323581.bin: 3270 Keyboard adapter ROM. The first 0x800 bytes visible in memory at C0000-C07FF. The later 0x1800 bytes visible in memory at CA000-CB7FF. + ROM_LOAD( "6323581.bin", 0xc0000, 0x2000, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81)) + +1504161.bin: 3270 Character ROM (pixels 0-7). Not mapped in PC memory. +1504162.bin: 3270 Character ROM (pixel 8). Not mapped in PC memory. + ROM_LOAD( "1504161.bin", 0x0000, 0x2000, CRC(d9246cf5) SHA1(2eaed495893a4e6649b04d10dada7b5ef4abd140)) + ROM_LOAD( "1504162.bin", 0x2000, 0x2000, CRC(59e1dc32) SHA1(337b5cced203345a5acfb02532d6b5f526902ee7)) + +6137323.bin: Professional Graphics Controller, first half of x86 firmware. Not mapped in PC memory. (Mapped in 8088-2 microcontroller memory at 00000-07FFF) +6137322.bin: Professional Graphics Controller, second half of x86 firmware. Not mapped in PC memory. (Mapped in 8088-2 microcontroller memory at 08000-0FFFF and any address within (8-F)(0-F)(3/7/B/F)00-(8-F)(0-F)(3/7/B/F)FF) +___MISSING___ 6137560.bin: Professional Graphics Controller, CGA emulation font. Not mapped in PC memory. + ROM_LOAD( "6137322.bin", 0x8000, 0x8000, CRC(5e6cc82f) SHA1(45b3ffb5a9c51986862f8d47b3e03dcaaf4073d5)) + ROM_LOAD( "6137323.bin", 0x0000, 0x8000, CRC(f564f342) SHA1(c5ef17fd1569043cb59f61faf828ea8b0ee95526)) + + +XC215 C 0.bin: IBM Music feature card Z80 firmware ROM. Not mapped in PC memory. (Mapped in Z80 microcontroller memory at 0000-7FFF) + ROM_LOAD( "xc215 c 0.bin", 0x0000, 0x8000, CRC(28c58a4f) SHA1(e7edf28d20e6c146e3144526c89cd6beea64663b)) + +XT U44 IBM.bin: IBM 5160 PC/XT Bank-selection decoding ROM (256x4 bit). Not mapped in PC memory. + ROM_LOAD( "xt u44 ibm.bin",0x0000, 0x0080, CRC(60ebb6e5) SHA1(e96a83b2fd6a231235374272a99353ab362b8e37)) + +1503033.bin: IBM 5170 PC/AT keyboard controller i8042 firmware. Not mapped in PC memory. + ROM_LOAD( "1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729)) + +1503099.bin: IBM AT 84-key Keyboard firmware. Not mapped in PC memory. + ROM_LOAD( "1503099.bin", 0x0000, 0x0400, CRC(1e921f37) SHA1(5f722bdb3b57f5a532c02a5c3f78f30d785796f2)) + +1385001.bin: IBM Terminal 122-key Keyboard firmware. Not mapped in PC memory. + ROM_LOAD( "1385001.bin", 0x0000, 0x0400, CRC(c19767e9) SHA1(a3701e4617383a4de0fd5e2e86c4b74beaf94a7b)) + +30F9580.bin: IBM PS/2 model 30 286 even. +30F9579.bin: IBM PS/2 model 30 286 odd. + ROM_LOAD( "30f9579.bin", 0x0000, 0x10000, CRC(1448d3cb) SHA1(13fa26d895ce084278cd5ab1208fc16c80115ebe)) + ROM_LOAD( "30f9580.bin", 0x0000, 0x10000, CRC(9965a634) SHA1(c237b1760f8a4561ec47dc70fe2e9df664e56596)) + +90X7415.bin: IBM PS/2 model 25/30 external FDD support adapter. visible in memory at C8000-C9FFF. + ROM_LOAD( "90x7415.bin", 0x0000, 0x2000, CRC(02d28556) SHA1(5543a8634f90a9141cf95f6a13c71be7778ee2a1)) + + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "machine/ram.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "machine/pc_lpt.h" +#include "bus/pc_kbd/keyboards.h" +#include "includes/genpc.h" + +class ibmpc_state : public driver_device +{ +public: + ibmpc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + required_device m_maincpu; +}; + +static ADDRESS_MAP_START( pc8_map, AS_PROGRAM, 8, ibmpc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pc8_io, AS_IO, 8, ibmpc_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +static INPUT_PORTS_START( ibm5150 ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START(cga) + DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x20) +DEVICE_INPUT_DEFAULTS_END + +//static DEVICE_INPUT_DEFAULTS_START(ega) +// DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x00) +//DEVICE_INPUT_DEFAULTS_END + + +static MACHINE_CONFIG_START( ibm5150, ibmpc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8088, XTAL_14_31818MHz/3) + MCFG_CPU_PROGRAM_MAP(pc8_map) + MCFG_CPU_IO_MAP(pc8_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5150_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(cga) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") + MCFG_SOFTWARE_LIST_ADD("cass_list","ibm5150_cass") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ibm5140, ibm5150 ) + /* software lists */ + MCFG_DEVICE_REMOVE( "disk_list" ) + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5140") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( ibm5160, ibmpc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8088, XTAL_14_31818MHz/3) + MCFG_CPU_PROGRAM_MAP(pc8_map) + MCFG_CPU_IO_MAP(pc8_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(cga) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa7", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa8", pc_isa8_cards, NULL, false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("pc_disk_list","ibm5150") + MCFG_SOFTWARE_LIST_ADD("xt_disk_list","ibm5160_flop") +MACHINE_CONFIG_END + + +ROM_START( ibm5150 ) + ROM_REGION(0x100000,"maincpu", 0) +// ROM_LOAD("600963.u12", 0xc8000, 0x02000, CRC(f3daf85f) SHA1(3bd29538832d3084cbddeec92593988772755283)) /* Tandon/Western Digital Fixed Disk Adapter 600963-001__TYPE_5.U12.2764.bin - Meant for an IBM PC or XT which lacked bios support for HDDs */ + + /* Xebec 1210 and 1220 Z80-based ST409/ST412 MFM controllers */ +// ROM_LOAD("5000059.12d", 0xc8000, 0x02000, CRC(03e0ee9a) SHA1(6691be4f6a8d690c696ad8b259708d3e7e87ad89)) /* Xebec 1210 IBM OEM Fixed Disk Adapter - Revision 1, supplied with rev1 and rev2 XT, and PC/3270. supports 4 hdd types, selectable by jumpers (which on the older XTs were usually soldered to one setting) */ +// ROM_LOAD("62x0822.12d", 0xc8000, 0x02000, CRC(4cdd2193) SHA1(fe8f88333b5e13e170bf637a9a0090383dee454d)) /* Xebec 1210 IBM OEM Fixed Disk Adapter 62X0822__(M)_AMI_8621MAB__S68B364-P__(C)IBM_CORP_1982,1985__PHILIPPINES.12D.2364.bin - Revision 2, supplied with rev3 and rev4 XT. supports 4 hdd types, selectable by jumpers (which unlike the older XTs, were changeable without requiring soldering )*/ +// ROM_LOAD("unknown.12d", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1210 Non-IBM/Retail Fixed Disk Adapter - supports 4 hdd types, selectable by jumpers (changeable without soldering) */ +// ROM_LOAD("unknown.???", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1220 Non-IBM/Retail Fixed Disk Adapter plus Floppy Disk Adapter - supports 4 hdd types, selectable by jumpers (changeable without soldering) */ + + /* IBM PC 5150 (rev 3: 1501-476 10/27/82) 5-screw case 64-256k MB w/1501981 CGA Card, ROM Basic 1.1 */ + ROM_DEFAULT_BIOS( "rev3" ) + + ROM_SYSTEM_BIOS( 0, "rev3", "IBM PC 5150 1501476 10/27/82" ) + ROMX_LOAD("5000019.u29", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(1)) /* ROM Basic 1.1 F6000-F7FFF; IBM P/N: 5000019, FRU: 6359109 */ + ROMX_LOAD("5000021.u30", 0xf8000, 0x2000, CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(1)) /* ROM Basic 1.1 F8000-F9FFF; IBM P/N: 5000021, FRU: 6359111 */ + ROMX_LOAD("5000022.u31", 0xfa000, 0x2000, CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(1)) /* ROM Basic 1.1 FA000-FBFFF; IBM P/N: 5000022, FRU: 6359112 */ + ROMX_LOAD("5000023.u32", 0xfc000, 0x2000, CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(1)) /* ROM Basic 1.1 FC000-FDFFF; IBM P/N: 5000023, FRU: 6359113 */ + ROMX_LOAD("1501476.u33", 0xfe000, 0x2000, CRC(e88792b3) SHA1(40fce6a94dda4328a8b608c7ae2f39d1dc688af4), ROM_BIOS(1)) + + /* IBM PC 5150 (rev 1: 04/24/81) 2-screw case 16-64k MB w/MDA Card, ROM Basic 1.0 */ + ROM_SYSTEM_BIOS( 1, "rev1", "IBM PC 5150 5700051 04/24/81" ) + ROMX_LOAD("5700019.u29", 0xf6000, 0x2000, CRC(b59e8f6c) SHA1(7a5db95370194c73b7921f2d69267268c69d2511), ROM_BIOS(2)) /* ROM Basic 1.0 F6000-F7FFF */ + ROMX_LOAD("5700027.u30", 0xf8000, 0x2000, CRC(bfff99b8) SHA1(ca2f126ba69c1613b7b5a4137d8d8cf1db36a8e6), ROM_BIOS(2)) /* ROM Basic 1.0 F8000-F9FFF */ + ROMX_LOAD("5700035.u31", 0xfa000, 0x2000, CRC(9fe4ec11) SHA1(89af8138185938c3da3386f97d3b0549a51de5ef), ROM_BIOS(2)) /* ROM Basic 1.0 FA000-FBFFF */ + ROMX_LOAD("5700043.u32", 0xfc000, 0x2000, CRC(ea2794e6) SHA1(22fe58bc853ffd393d5e2f98defda7456924b04f), ROM_BIOS(2)) /* ROM Basic 1.0 FC000-FDFFF */ + ROMX_LOAD("5700051.u33", 0xfe000, 0x2000, CRC(12d33fb8) SHA1(f046058faa016ad13aed5a082a45b21dea43d346), ROM_BIOS(2)) + + /* IBM PC 5150 (rev 2: 10/19/81) 2-screw case, 16-64k MB w/MDA Card, ROM Basic 1.0 */ + ROM_SYSTEM_BIOS( 2, "rev2", "IBM PC 5150 5700671 10/19/81" ) + ROMX_LOAD("5700019.u29", 0xf6000, 0x2000, CRC(b59e8f6c) SHA1(7a5db95370194c73b7921f2d69267268c69d2511), ROM_BIOS(3)) /* ROM Basic 1.0 F6000-F7FFF */ + ROMX_LOAD("5700027.u30", 0xf8000, 0x2000, CRC(bfff99b8) SHA1(ca2f126ba69c1613b7b5a4137d8d8cf1db36a8e6), ROM_BIOS(3)) /* ROM Basic 1.0 F8000-F9FFF */ + ROMX_LOAD("5700035.u31", 0xfa000, 0x2000, CRC(9fe4ec11) SHA1(89af8138185938c3da3386f97d3b0549a51de5ef), ROM_BIOS(3)) /* ROM Basic 1.0 FA000-FBFFF */ + ROMX_LOAD("5700043.u32", 0xfc000, 0x2000, CRC(ea2794e6) SHA1(22fe58bc853ffd393d5e2f98defda7456924b04f), ROM_BIOS(3)) /* ROM Basic 1.0 FC000-FDFFF */ + ROMX_LOAD("5700671.u33", 0xfe000, 0x2000, CRC(b7d4ec46) SHA1(bdb06f846c4768f39eeff7e16b6dbff8cd2117d2), ROM_BIOS(3)) + + /* Z80 on the Xebec 1210 and 1220 Hard Disk Controllers */ +// ROM_REGION(0x10000, "cpu1", 0) +// ROM_LOAD("104839re.12a", 0x0000, 0x1000, CRC(3ad32fcc) SHA1(0127fa520aaee91285cb46a640ed835b4554e4b3)) /* Xebec 1210 IBM OEM Hard Disk Controller, silkscreened "104839RE // COPYRIGHT // XEBEC 1986" - Common for both XEBEC 1210 IBM OEM revisions. Some cards have the rom marked 104839E instead (John Eliott's card is like this), but contents are the same. */ +// /* Other versions probably exist for the non-IBM/Retail 1210 and the 1220 */ + + /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ + ROM_REGION(0x2000,"gfx1", 0) + ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ +ROM_END +ROM_START( ibm5155 ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD("5000027.u19", 0xf0000, 0x8000, CRC(fc982309) SHA1(2aa781a698a21c332398d9bc8503d4f580df0a05)) + ROM_LOAD("1501512.u18", 0xf8000, 0x8000, CRC(79522c3d) SHA1(6bac726d8d033491d52507278aa388ec04cf8b7e)) + /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ + ROM_REGION(0x2000,"gfx1", 0) + ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ +ROM_END +ROM_START( ibm5140 ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD("7396917.bin", 0xf0000, 0x08000, CRC(95c35652) SHA1(2bdac30715dba114fbe0895b8b4723f8dc26a90d)) + ROM_LOAD("7396918.bin", 0xf8000, 0x08000, CRC(1b4202b0) SHA1(4797ff853ba1675860f293b6368832d05e2f3ea9)) + /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ + ROM_REGION(0x2000,"gfx1", 0) + ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ +ROM_END +#ifdef UNUSED_DEFINITION +ROM_START( ibmpca ) + ROM_REGION(0x100000,"maincpu",0) + ROM_LOAD("basicc11.f6", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) + ROM_LOAD("basicc11.f8", 0xf8000, 0x2000, CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731)) + ROM_LOAD("basicc11.fa", 0xfa000, 0x2000, CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74)) + ROM_LOAD("basicc11.fc", 0xfc000, 0x2000, CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7)) + ROM_LOAD("pc081682.bin", 0xfe000, 0x2000, CRC(5c3f0256) SHA1(b42c78abd0a9c630a2f972ad2bae46d83c3a2a09)) + + /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ + ROM_REGION(0x2000,"gfx1", 0) + ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ +ROM_END +#endif + + +ROM_START( ibm5160 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) +// ROM_LOAD("600963.u12", 0xc8000, 0x02000, CRC(f3daf85f) SHA1(3bd29538832d3084cbddeec92593988772755283)) /* Tandon/Western Digital Fixed Disk Adapter 600963-001__TYPE_5.U12.2764.bin */ + + /* PC/3270 has a 3270 keyboard controller card, plus a rom on that card to tell the pc how to run it. + * Unlike the much more complex keyboard controller used in the AT/3270, this one only has one rom, + a motorola made "(M)1503828 // XE // 8434A XM // SC81155P" custom (an MCU?; the more complicated + 3270/AT keyboard card uses this same exact chip), an 8254, and some logic chips. + Thanks to high resolution pictures provided by John Elliott, I can see that the location of the + chips is unlabeled (except for by absolute pin position on the back), and there are no pals or proms. + * The board is stickered "2683114 // 874999 // 8446 SU" on the front. + * The board has a single DE-9 connector where the keyboard dongle connects to. + * The keyboard dongle has two connectors on it: a DIN-5 connector which connects to the Motherboard's + keyboard port, plus an RJ45-lookalike socket which the 3270 keyboard connects to. + * The rom is mapped very strangely to avoid hitting the hard disk controller: + The first 0x800 bytes appear at C0000-C07FF, and the last 0x1800 bytes appear at 0xCA000-CB7FF + */ +// ROM_LOAD("6323581.bin", 0xc0000, 0x00800, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81)) +// ROM_LOAD("6323581.bin", 0xca000, 0x01800, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81) ROM_SKIP(0x800)) + + /* Xebec 1210 and 1220 Z80-based ST409/ST412 MFM controllers */ +// ROM_LOAD("5000059.12d", 0xc8000, 0x02000, CRC(03e0ee9a) SHA1(6691be4f6a8d690c696ad8b259708d3e7e87ad89)) /* Xebec 1210 IBM OEM Fixed Disk Adapter - Revision 1, supplied with rev1 and rev2 XT, and PC/3270. supports 4 hdd types, selectable by jumpers (which on the older XTs were usually soldered to one setting) */ +// ROM_LOAD("62x0822.12d", 0xc8000, 0x02000, CRC(4cdd2193) SHA1(fe8f88333b5e13e170bf637a9a0090383dee454d)) /* Xebec 1210 IBM OEM Fixed Disk Adapter 62X0822__(M)_AMI_8621MAB__S68B364-P__(C)IBM_CORP_1982,1985__PHILIPPINES.12D.2364.bin - Revision 2, supplied with rev3 and rev4 XT. supports 4 hdd types, selectable by jumpers (which unlike the older XTs, were changeable without requiring soldering )*/ +// ROM_LOAD("unknown.12d", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1210 Non-IBM/Retail Fixed Disk Adapter - supports 4 hdd types, selectable by jumpers (changeable without soldering) */ +// ROM_LOAD("unknown.???", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1220 Non-IBM/Retail Fixed Disk Adapter plus Floppy Disk Adapter - supports 4 hdd types, selectable by jumpers (changeable without soldering) */ + + + ROM_DEFAULT_BIOS( "rev4" ) + + ROM_SYSTEM_BIOS( 0, "rev1", "IBM XT 5160 08/16/82" ) /* ROM at u18 marked as BAD_DUMP for now, as current dump, while likely correct, was regenerated from a number of smaller dumps, and needs a proper redump. */ + ROMX_LOAD("5000027.u19", 0xf0000, 0x8000, CRC(fc982309) SHA1(2aa781a698a21c332398d9bc8503d4f580df0a05), ROM_BIOS(1) ) + ROMX_LOAD("5000026.u18", 0xf8000, 0x8000, BAD_DUMP CRC(3c9b0ac3) SHA1(271c9f4cef5029a1560075550b67c3395db09fef), ROM_BIOS(1) ) /* This is probably a good dump, and works fine, but as it was manually regenerated based on a partial dump, it needs to be reverified. It's a very rare rom revision and may have only appeared on XT prototypes. */ + + ROM_SYSTEM_BIOS( 1, "rev2", "IBM XT 5160 11/08/82" ) /* Same as PC 5155 BIOS and PC/3270 BIOS */ + ROMX_LOAD("5000027.u19", 0xf0000, 0x8000, CRC(fc982309) SHA1(2aa781a698a21c332398d9bc8503d4f580df0a05), ROM_BIOS(2) ) /* silkscreen "MK37050N-4 // 5000027" - FRU: 6359116 - Contents repeat 4 times; Alt Silkscreen (from yesterpc.com): "(M) // 5000027 // (C) 1983 IBM CORP // X E // 8425B NM"*/ + ROMX_LOAD("1501512.u18", 0xf8000, 0x8000, CRC(79522c3d) SHA1(6bac726d8d033491d52507278aa388ec04cf8b7e), ROM_BIOS(2) ) /* silkscreen "MK38036N-25 // 1501512 // ZA // (C)IBM CORP // 1981,1983 // D MALAYSIA // 8438 AP"*/ + + ROM_SYSTEM_BIOS( 2, "rev3", "IBM XT 5160 01/10/86" ) /* Has enhanced keyboard support and a 3.5" drive */ + ROMX_LOAD("62x0854.u19", 0xf0000, 0x8000, CRC(b5fb0e83) SHA1(937b43759ffd472da4fb0fe775b3842f5fb4c3b3), ROM_BIOS(3) ) + ROMX_LOAD("62x0851.u18", 0xf8000, 0x8000, CRC(1054f7bd) SHA1(e7d0155813e4c650085144327581f05486ed1484), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS( 3, "rev4", "IBM XT 5160 05/09/86" ) /* Minor bugfixes to keyboard code, supposedly */ + ROMX_LOAD("68x4370.u19", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2), ROM_BIOS(4)) + ROMX_LOAD("62x0890.u18", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb), ROM_BIOS(4)) + +// ROM_SYSTEM_BIOS( 4, "xtdiag", "IBM XT 5160 w/Supersoft Diagnostics" ) /* ROMs marked as BAD_DUMP for now. We expect the data to be in a different ROM chip layout */ +// ROMX_LOAD("basicc11.f6", 0xf6000, 0x2000, BAD_DUMP CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(5) ) +// ROMX_LOAD("basicc11.f8", 0xf8000, 0x2000, BAD_DUMP CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(5) ) +// ROMX_LOAD("basicc11.fa", 0xfa000, 0x2000, BAD_DUMP CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(5) ) +// ROMX_LOAD("basicc11.fc", 0xfc000, 0x2000, BAD_DUMP CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(5) ) +// ROMX_LOAD("xtdiag.bin", 0xfe000, 0x2000, CRC(4e89a4d8) SHA1(39a28fb2fe9f1aeea24ed2c0255cebca76e37ed7), ROM_BIOS(5) ) + + /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ + ROM_REGION(0x2000,"gfx1", 0) + ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ + + /* Z80 ROM on the Xebec 1210 and 1220 Hard Disk Controllers */ +// ROM_REGION(0x10000, "cpu1", 0) +// ROM_LOAD("104839re.12a", 0x0000, 0x1000, CRC(3ad32fcc) SHA1(0127fa520aaee91285cb46a640ed835b4554e4b3)) /* Xebec 1210 IBM OEM Hard Disk Controller, silkscreened "104839RE // COPYRIGHT // XEBEC 1986" - Common for both XEBEC 1210 IBM OEM revisions. Some cards have the rom marked 104839E instead (John Eliott's card is like this), but contents are the same. */ +// /* Other versions probably exist for the non-IBM/Retail 1210 and the 1220 */ + + + /* PC/3270 and AT/3270 have a set of two (optionally 3) 3270PGC programmable graphics controller cards on them which + have 2 extra roms, plus a number of custom chips and at least one MCU. + Information on these three boards plus the keyboard interface can be found at: + http://www.seasip.info/VintagePC/5271.html + *** The descriptions below are based on the cards from the AT/3270, which are slightly + different from the PC/3270 cards. Changes between the PC/3270 and AT/3270 video cards are + listed: + 1. The card lip edge is changed on the APA and PS cards to allow them to be placed + in a 16-bit ISA slot. + 2. The Main Display board is exactly the same PCB (hence cannot be placed in a 16-bit + ISA slot), but the socket to the left of the 8255 is now populated, and has a lot of + rework wires connected to various places on the PCB. + 3. The APA board was completely redone, and no longer has an 8254 (though it does have an + empty socket) and has ?twice as much memory on it? (not sure about this). The APA + board also now connects to both main board connectors 1 and 3, instead of only + connector 1. + 4. The PS board has been minorly redone to allow clearance for a 16-bit ISA connector, + but no other significant chip changes were made. The connector 3 still exists on the + board but is unpopulated. Connector 2 still connects to the Main display board as + before. + + ** The Main Display Board (with one 48-pin custom, 3 40 pin customs at least one of which is + an MCU, four 2016BP-10 srams, an 8254 and an 8255 on it, two crystals (16.257MHz and + 21.676MHz) plus two mask roms ) is stickered "61X6579 // 983623 // 6390 SU" on the front. + * The pcb is trace-marked "6320987" on both the front and back. + * The card has a DE-9 connector on it for a monitor. + * The customs are marked: + "1503192 // TC15G008P-0009 // JAPAN 8549A" (40 pins, at U52) + "1503193 // TC15G008AP-0020 // JAPAN 8610A" (48 pins, at U29) + "(M)1503194 // XE KGA005 // 8616N XM // SC81156P" (40 pins, at U36, likely an MCU) + "S8613 // SCN2672B // C4N40 A // CP3303" (40 pins, at U24, also possibly an MCU) + + ** The All Points Addressable (Frame buffer?) card (with 2 48-pin customs on it which are + probably gate arrays and not MCUs, an empty socket (28 pins, U46), an Intel Id2147H-3, + a bank of twelve 16k*4-bit inmos ims2620p-15 DRAMs (tms4416 equivalent), and an Intel + D2147K 4096*1 byte SRAM) is stickered + "6487836 // A24969 // 6400 SU" on the back. + * The pcb is trace-marked "EC 999040" on the back, and silkscreened "RC 2682819" on the front + * The customs are marked: + "6323259 // TC15G008AP-0028 // JAPAN 8606A" (48 pins, at U67) + "6323260 // TC15G022AP-0018 // JAPAN 8606A" (48 pins, at U45) + + ** The optional Programmable Symbol Card (with an AMD AM9128-10PC, and six tms4416-15NL DRAMS, + and a fleet of discrete logic chips, but no roms, pals, or proms) is stickered + "6347750 // A24866 // 6285 SU" on the front. + * The PCB is trace-marked "PROGAMMABLE SYMBOL P/N 6347751 // ASSY. NO. 6347750" on the front, + and trace-marked "|||CIM0286 ECA2466 // 94V-O" on the back. + */ +// ROM_REGION(0x4000,"gfx2", 0) +// ROM_LOAD("1504161.u11", 0x00000, 0x2000, CRC(d9246cf5) SHA1(2eaed495893a4e6649b04d10dada7b5ef4abd140)) /* silkscreen: "AMI 8613MAJ // 9591-041 // S2364B // 1504161 // PHILIPPINES" - Purpose: Pixels 0 through 7 of built-in 3270 terminal font*/ +// ROM_LOAD("1504162.u26", 0x02000, 0x2000, CRC(59e1dc32) SHA1(337b5cced203345a5acfb02532d6b5f526902ee7)) /* silkscreen: "AMI 8607MAH // 9591-042 // S2364B // 1504162 // PHILIPPINES" - Purpose: Pixel 8 of built-in 3270 terminal font*/ +ROM_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1981, ibm5150, 0, 0, ibm5150, ibm5150, driver_device, 0, "International Business Machines", "IBM PC 5150" , 0) +COMP( 1982, ibm5155, ibm5150, 0, ibm5150, ibm5150, driver_device, 0, "International Business Machines", "IBM PC 5155" , 0) +COMP( 1985, ibm5140, ibm5150, 0, ibm5140, ibm5150, driver_device, 0, "International Business Machines", "IBM PC 5140 Convertible" , MACHINE_NOT_WORKING) + +// xt class (pc but 8086) +COMP( 1982, ibm5160, ibm5150, 0, ibm5160, ibm5150, driver_device, 0, "International Business Machines", "IBM XT 5160" , 0) diff --git a/src/mame/drivers/ibmpcjr.c b/src/mame/drivers/ibmpcjr.c new file mode 100644 index 00000000000..13f421bf12e --- /dev/null +++ b/src/mame/drivers/ibmpcjr.c @@ -0,0 +1,705 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "cpu/i86/i86.h" +#include "sound/sn76496.h" +#include "sound/speaker.h" +#include "video/pc_t1t.h" +#include "machine/ins8250.h" +#include "machine/i8255.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "machine/pckeybrd.h" +#include "machine/pc_lpt.h" +#include "machine/pc_fdc.h" +#include "bus/rs232/rs232.h" +#include "bus/rs232/ser_mouse.h" +#include "bus/pc_joy/pc_joy.h" +#include "bus/isa/fdc.h" +#include "imagedev/cassette.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +class pcjr_state : public driver_device +{ +public: + pcjr_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pic8259(*this, "pic8259"), + m_pit8253(*this, "pit8253"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_cart1(*this, "cartslot1"), + m_cart2(*this, "cartslot2"), + m_ram(*this, RAM_TAG), + m_fdc(*this, "fdc"), + m_keyboard(*this, "pc_keyboard") + { } + + required_device m_maincpu; + required_device m_pic8259; + required_device m_pit8253; + required_device m_speaker; + required_device m_cassette; + required_device m_cart1; + required_device m_cart2; + required_device m_ram; + required_device m_fdc; + required_device m_keyboard; + + DECLARE_WRITE_LINE_MEMBER(out2_changed); + DECLARE_WRITE_LINE_MEMBER(keyb_interrupt); + + DECLARE_WRITE8_MEMBER(pc_nmi_enable_w); + DECLARE_READ8_MEMBER(pcjr_nmi_enable_r); + DECLARE_WRITE_LINE_MEMBER(pic8259_set_int_line); + + DECLARE_WRITE8_MEMBER(pcjr_ppi_portb_w); + DECLARE_READ8_MEMBER(pcjr_ppi_porta_r); + DECLARE_READ8_MEMBER(pcjr_ppi_portc_r); + DECLARE_WRITE8_MEMBER(pcjr_fdc_dor_w); + DECLARE_READ8_MEMBER(pcjx_port_1ff_r); + DECLARE_WRITE8_MEMBER(pcjx_port_1ff_w); + void pcjx_set_bank(int unk1, int unk2, int unk3); + + int load_cart(device_image_interface &image, generic_slot_device *slot); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pcjr_cart1) { return load_cart(image, m_cart1); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pcjr_cart2) { return load_cart(image, m_cart2); } + void pc_speaker_set_spkrdata(UINT8 data); + + UINT8 m_pc_spkrdata; + UINT8 m_pit_out2; + UINT8 m_pcjr_dor; + UINT8 m_pcjx_1ff_count; + UINT8 m_pcjx_1ff_val; + UINT8 m_pcjx_1ff_bankval; + UINT8 m_pcjx_1ff_bank[20][2]; + int m_ppi_portc_switch_high; + UINT8 m_ppi_portb; + + UINT8 m_pc_keyb_data; + UINT8 m_transferring; + UINT8 m_latch; + UINT32 m_raw_keyb_data; + int m_signal_count; + UINT8 m_nmi_enabled; + + void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + emu_timer *m_pc_int_delay_timer; + emu_timer *m_pcjr_watchdog; + emu_timer *m_keyb_signal_timer; + + enum + { + TIMER_IRQ_DELAY, + TIMER_WATCHDOG, + TIMER_KB_SIGNAL + }; + + void machine_reset(); + DECLARE_DRIVER_INIT(pcjr); +}; + +static INPUT_PORTS_START( ibmpcjr ) + PORT_INCLUDE(pc_keyboard) + + PORT_START("IN0") /* IN0 */ + PORT_BIT ( 0xf0, 0xf0, IPT_UNUSED ) + PORT_BIT ( 0x08, 0x08, IPT_CUSTOM ) PORT_VBLANK("pcvideo_pcjr:screen") + PORT_BIT ( 0x07, 0x07, IPT_UNUSED ) +INPUT_PORTS_END + +DRIVER_INIT_MEMBER(pcjr_state, pcjr) +{ + m_pc_int_delay_timer = timer_alloc(TIMER_IRQ_DELAY); + m_pcjr_watchdog = timer_alloc(TIMER_WATCHDOG); + m_keyb_signal_timer = timer_alloc(TIMER_KB_SIGNAL); +} + +void pcjr_state::machine_reset() +{ + m_pc_spkrdata = 0; + m_pit_out2 = 1; + m_ppi_portc_switch_high = 0; + m_ppi_portb = 0; + m_pcjr_dor = 0; + m_speaker->level_w(0); + + m_pcjx_1ff_count = 0; + m_pcjx_1ff_val = 0; + m_pcjx_1ff_bankval = 0; + memset(m_pcjx_1ff_bank, 0, sizeof(m_pcjx_1ff_bank)); + + m_transferring = 0; + m_latch = 0; + m_raw_keyb_data = 0; + m_nmi_enabled = 0x80; +} + +void pcjr_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_IRQ_DELAY: + m_maincpu->set_input_line(0, param ? ASSERT_LINE : CLEAR_LINE); + break; + + case TIMER_WATCHDOG: + if(m_pcjr_dor & 0x20) + m_pic8259->ir6_w(1); + else + m_pic8259->ir6_w(0); + break; + + case TIMER_KB_SIGNAL: + m_raw_keyb_data = m_raw_keyb_data >> 1; + m_signal_count--; + + if ( m_signal_count <= 0 ) + { + m_keyb_signal_timer->adjust( attotime::never, 0, attotime::never ); + m_transferring = 0; + } + break; + } +} + +/************************************************************* + * + * PCJR pic8259 configuration + * + * Part of the PCJR CRT POST test at address F0452/F0454 writes + * to the PIC enabling an IRQ which is then immediately fired, + * however it is expected that the actual IRQ is taken one + * instruction later (the irq bit is reset by the instruction + * at F0454). Delaying taking of an IRQ by one instruction for + * all cases breaks floppy emulation. This seems to be a really + * tight corner case. For now we delay the IRQ by one instruction + * only for the PCJR and only when it's inside the POST checks. + * + *************************************************************/ + +WRITE_LINE_MEMBER(pcjr_state::pic8259_set_int_line) +{ + UINT32 pc = m_maincpu->pc(); + if ( (pc == 0xF0453) || (pc == 0xFF196) ) + { + m_pc_int_delay_timer->adjust( m_maincpu->cycles_to_attotime(20), state ); + } + else + { + m_maincpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); + } +} + +/************************************************************************* + * + * PC Speaker related + * + *************************************************************************/ +void pcjr_state::pc_speaker_set_spkrdata(UINT8 data) +{ + m_pc_spkrdata = data ? 1 : 0; + m_speaker->level_w(m_pc_spkrdata & m_pit_out2); +} + +WRITE_LINE_MEMBER(pcjr_state::out2_changed) +{ + m_pit_out2 = state ? 1 : 0; + m_speaker->level_w(m_pc_spkrdata & m_pit_out2); +} + +/************************************************************* + * + * PCJR NMI and raw keybaord handling + * + * raw signals on the keyboard cable: + * ---_-b0b1b2b3b4b5b6b7pa---------------------- + * | | | | | | | | | | | + * | | | | | | | | | | *--- 11 stop bits ( -- = 1 stop bit ) + * | | | | | | | | | *----- parity bit ( 0 = _-, 1 = -_ ) + * | | | | | | | | *------- bit 7 ( 0 = _-, 1 = -_ ) + * | | | | | | | *--------- bit 6 ( 0 = _-, 1 = -_ ) + * | | | | | | *----------- bit 5 ( 0 = _-, 1 = -_ ) + * | | | | | *------------- bit 4 ( 0 = _-, 1 = -_ ) + * | | | | *--------------- bit 3 ( 0 = _-, 1 = -_ ) + * | | | *----------------- bit 2 ( 0 = _-, 1 = -_ ) + * | | *------------------- bit 1 ( 0 = _-, 1 = -_ ) + * | *--------------------- bit 0 ( 0 = _-, 1 = -_ ) + * *----------------------- start bit (always _- ) + * + * An entire bit lasts for 440 uSec, half bit time is 220 uSec. + * Transferring an entire byte takes 21 x 440uSec. The extra + * time of the stop bits is to allow the CPU to do other things + * besides decoding keyboard signals. + * + * These signals get inverted before going to the PCJR + * handling hardware. The sequence for the start then + * becomes: + * + * __-_b0b1..... + * | + * *---- on the 0->1 transition of the start bit a keyboard + * latch signal is set to 1 and an NMI is generated + * when enabled. + * The keyboard latch is reset by reading from the + * NMI enable port (A0h). + * + *************************************************************/ + +WRITE_LINE_MEMBER(pcjr_state::keyb_interrupt) +{ + int data; + + if(state && (data = m_keyboard->read(machine().driver_data()->generic_space(), 0))) + { + UINT8 parity = 0; + int i; + + m_latch = 1; + + if(m_transferring) + return; + + m_pc_keyb_data = data; + + /* Calculate the raw data */ + for( i = 0; i < 8; i++ ) + { + if ( ( 1 << i ) & data ) + { + parity ^= 1; + } + } + m_raw_keyb_data = 0; + m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | ( parity ? 1 : 2 ); + for( i = 0; i < 8; i++ ) + { + m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | ( ( data & 0x80 ) ? 1 : 2 ); + data <<= 1; + } + /* Insert start bit */ + m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | 1; + m_signal_count = 20 + 22; + + /* we are now transferring a byte of keyboard data */ + m_transferring = 1; + + /* Set timer */ + m_keyb_signal_timer->adjust( attotime::from_usec(220), 0, attotime::from_usec(220) ); + m_maincpu->set_input_line(INPUT_LINE_NMI, m_nmi_enabled && m_latch); + } +} + +READ8_MEMBER(pcjr_state::pcjr_nmi_enable_r) +{ + m_latch = 0; + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + return m_nmi_enabled; +} + +WRITE8_MEMBER(pcjr_state::pc_nmi_enable_w) +{ + m_nmi_enabled = data & 0x80; + m_maincpu->set_input_line(INPUT_LINE_NMI, m_nmi_enabled && m_latch); +} + +WRITE8_MEMBER(pcjr_state::pcjr_ppi_portb_w) +{ + /* KB controller port B */ + m_ppi_portb = data; + m_ppi_portc_switch_high = data & 0x08; + m_pit8253->write_gate2(BIT(data, 0)); + pc_speaker_set_spkrdata( data & 0x02 ); + + m_cassette->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); +} + +/* + * Port C connections on a PCJR (notes from schematics): + * PC0 - KYBD LATCH + * PC1 - MODEM CD INSTALLED + * PC2 - DISKETTE CD INSTALLED + * PC3 - ATR CD IN + * PC4 - cassette audio + * PC5 - OUT2 from 8253 + * PC6 - KYBD IN + * PC7 - (keyboard) CABLE CONNECTED + */ +READ8_MEMBER(pcjr_state::pcjr_ppi_portc_r) +{ + int data=0xff; + + data&=~0x80; + data &= ~0x04; /* floppy drive installed */ + if ( m_ram->size() > 64 * 1024 ) /* more than 64KB ram installed */ + data &= ~0x08; + data = ( data & ~0x01 ) | ( m_latch ? 0x01: 0x00 ); + if ( ! ( m_ppi_portb & 0x08 ) ) + { + double tap_val = m_cassette->input(); + + if ( tap_val < 0 ) + { + data &= ~0x10; + } + else + { + data |= 0x10; + } + } + else + { + if ( m_ppi_portb & 0x01 ) + { + data = ( data & ~0x10 ) | ( m_pit_out2 ? 0x10 : 0x00 ); + } + } + data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); + data = ( data & ~0x40 ) | ( ( m_raw_keyb_data & 0x01 ) ? 0x40 : 0x00 ); + + return data; +} + +WRITE8_MEMBER(pcjr_state::pcjr_fdc_dor_w) +{ + logerror("fdc: dor = %02x\n", data); + UINT8 pdor = m_pcjr_dor; + floppy_image_device *floppy0 = m_fdc->subdevice("0")->get_device(); + floppy_image_device *floppy1 = NULL; + + if(m_fdc->subdevice("1")) + floppy1 = m_fdc->subdevice("1")->get_device(); + m_pcjr_dor = data; + + if(floppy0) + floppy0->mon_w(!(m_pcjr_dor & 1)); + if(floppy1) + floppy1->mon_w(!(m_pcjr_dor & 2)); + + if(m_pcjr_dor & 1) + m_fdc->set_floppy(floppy0); + else if(m_pcjr_dor & 2) + m_fdc->set_floppy(floppy1); + else + m_fdc->set_floppy(NULL); + + if((pdor^m_pcjr_dor) & 0x80) + m_fdc->reset(); + + if(m_pcjr_dor & 0x20) { + if((pdor & 0x40) && !(m_pcjr_dor & 0x40)) + m_pcjr_watchdog->adjust(attotime::from_seconds(3)); + } else { + m_pcjr_watchdog->adjust(attotime::never); + m_pic8259->ir6_w(0); + } +} + +// pcjx port 0x1ff, some info from Toshiya Takeda + +void pcjr_state::pcjx_set_bank(int unk1, int unk2, int unk3) +{ + logerror("pcjx: 0x1ff 0:%02x 1:%02x 2:%02x\n", unk1, unk2, unk3); +} + +WRITE8_MEMBER(pcjr_state::pcjx_port_1ff_w) +{ + switch(m_pcjx_1ff_count) { + case 0: + m_pcjx_1ff_bankval = data; + m_pcjx_1ff_count++; + break; + case 1: + m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][0] = data; + m_pcjx_1ff_count++; + break; + case 2: + m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][1] = data; + m_pcjx_1ff_count = 0; + pcjx_set_bank(m_pcjx_1ff_bankval, m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][0], data); + break; + } +} + +READ8_MEMBER(pcjr_state::pcjx_port_1ff_r) +{ + if(m_pcjx_1ff_count == 2) + pcjx_set_bank(m_pcjx_1ff_bankval, m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][0], m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][1]); + + m_pcjx_1ff_count = 0; + return 0x60; // expansion? +} + +int pcjr_state::load_cart(device_image_interface &image, generic_slot_device *slot) +{ + UINT32 size = slot->common_get_size("rom"); + bool imagic_hack = false; + + if (image.software_entry() == NULL) + { + int header_size = 0; + + // Check for supported header sizes + switch (size & 0x3ff) + { + case 0x80: + header_size = 0x80; + break; + case 0x200: + header_size = 0x200; + break; + default: + image.seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid header size" ); + return IMAGE_INIT_FAIL; + } + if (size - header_size == 0xa000) + { + // alloc 64K for the imagic carts, so to handle the necessary mirroring + size += 0x6000; + imagic_hack = true; + } + + size -= header_size; + image.fseek(header_size, SEEK_SET); + } + + slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + slot->common_load_rom(slot->get_rom_base(), size, "rom"); + + if (imagic_hack) + { + // in this case the image consists of 2x8K chunks + // the first chunk is unique, the second is repeated 4 times up to 0xa000 size + + // mirroring + UINT8 *ROM = slot->get_rom_base(); + memcpy(ROM + 0xe000, ROM + 0x2000, 0x2000); + memcpy(ROM + 0xc000, ROM + 0x2000, 0x2000); + memcpy(ROM + 0xa000, ROM + 0x2000, 0x2000); + memcpy(ROM + 0x8000, ROM + 0x2000, 0x2000); + memcpy(ROM + 0x6000, ROM, 0x2000); + memcpy(ROM + 0x4000, ROM, 0x2000); + memcpy(ROM + 0x2000, ROM, 0x2000); + } + return IMAGE_INIT_PASS; +} + + +static SLOT_INTERFACE_START( pcjr_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(pcjr_com) + SLOT_INTERFACE("microsoft_mouse", MSFT_SERIAL_MOUSE) + SLOT_INTERFACE("mousesys_mouse", MSYSTEM_SERIAL_MOUSE) +SLOT_INTERFACE_END + +static const gfx_layout pc_8_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 512, /* 512 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout kanji_layout = +{ + 16, 16, /* 8 x 8 characters */ + RGN_FRAC(1,1), /* 512 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { STEP16(0,1) }, + /* y offsets */ + { STEP16(0,16) }, + 16*16 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( pcjr ) + GFXDECODE_ENTRY( "gfx1", 0x0000, pc_8_charlayout, 3, 1 ) +GFXDECODE_END + + +static ADDRESS_MAP_START(ibmpcjr_map, AS_PROGRAM, 8, pcjr_state) + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xaffff) AM_RAM + AM_RANGE(0xb0000, 0xb7fff) AM_NOP + AM_RANGE(0xb8000, 0xbffff) AM_RAMBANK("bank14") + AM_RANGE(0xc0000, 0xc7fff) AM_NOP + AM_RANGE(0xc8000, 0xc9fff) AM_ROM + AM_RANGE(0xca000, 0xcffff) AM_NOP + AM_RANGE(0xd0000, 0xdffff) AM_DEVREAD("cartslot2", generic_slot_device, read_rom) + AM_RANGE(0xe0000, 0xeffff) AM_DEVREAD("cartslot1", generic_slot_device, read_rom) + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(ibmpcjr_io, AS_IO, 8, pcjr_state) + AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) + AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) + AM_RANGE(0x00a0, 0x00a0) AM_READWRITE(pcjr_nmi_enable_r, pc_nmi_enable_w ) + AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", sn76496_device, write) + AM_RANGE(0x00f2, 0x00f2) AM_WRITE(pcjr_fdc_dor_w) + AM_RANGE(0x00f4, 0x00f5) AM_DEVICE("fdc", upd765a_device, map) + AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("pc_joy", pc_joy_device, joy_port_r, joy_port_w) + AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w) + AM_RANGE(0x0378, 0x037b) AM_DEVREADWRITE("lpt_0", pc_lpt_device, read, write) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE("pcvideo_pcjr", pcvideo_pcjr_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ibmpcjx_map, AS_PROGRAM, 8, pcjr_state ) + AM_RANGE(0x80000, 0xb7fff) AM_ROM AM_REGION("kanji",0) + AM_IMPORT_FROM( ibmpcjr_map ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ibmpcjx_io, AS_IO, 8, pcjr_state) + AM_RANGE(0x01ff, 0x01ff) AM_READWRITE(pcjx_port_1ff_r, pcjx_port_1ff_w) + AM_IMPORT_FROM( ibmpcjr_io ) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( ibmpcjr, pcjr_state) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8088, 4900000) + MCFG_CPU_PROGRAM_MAP(ibmpcjr_map) + MCFG_CPU_IO_MAP(ibmpcjr_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + +/* + On the PC Jr the input for clock 1 seems to be selectable + based on bit 4(/5?) written to output port A0h. This is not + supported yet. + */ + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_14_31818MHz/12) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_14_31818MHz/12) + MCFG_PIT8253_CLK2(XTAL_14_31818MHz/12) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(pcjr_state, out2_changed)) + + MCFG_PIC8259_ADD( "pic8259", WRITELINE(pcjr_state, pic8259_set_int_line), VCC, NULL ) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(CONSTANT(0xff)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pcjr_state, pcjr_ppi_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pcjr_state, pcjr_ppi_portc_r)) + + MCFG_DEVICE_ADD( "ins8250", INS8250, XTAL_1_8432MHz ) + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport", rs232_port_device, write_txd)) + MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport", rs232_port_device, write_dtr)) + MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport", rs232_port_device, write_rts)) + MCFG_INS8250_OUT_INT_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + + MCFG_RS232_PORT_ADD( "serport", pcjr_com, NULL ) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, dsr_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, ri_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, cts_w)) + + /* video hardware */ + MCFG_PCVIDEO_PCJR_ADD("pcvideo_pcjr") + + MCFG_GFXDECODE_ADD("gfxdecode", "pcvideo_pcjr:palette", pcjr) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MCFG_SOUND_ADD("sn76496", SN76496, XTAL_14_31818MHz/4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + /* printer */ + MCFG_DEVICE_ADD("lpt_0", PC_LPT, 0) + MCFG_PC_LPT_IRQ_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) + + MCFG_PC_JOY_ADD("pc_joy") + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_UPD765A_ADD("fdc", false, false) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcjr_floppies, "525dd", isa8_fdc_device::floppy_formats) + MCFG_SLOT_FIXED(true) + + MCFG_PC_KEYB_ADD("pc_keyboard", WRITELINE(pcjr_state, keyb_interrupt)) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_plain_slot, "ibmpcjr_cart") + MCFG_GENERIC_EXTENSIONS("bin,jrc") + MCFG_GENERIC_LOAD(pcjr_state, pcjr_cart1) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_plain_slot, "ibmpcjr_cart") + MCFG_GENERIC_EXTENSIONS("bin,jrc") + MCFG_GENERIC_LOAD(pcjr_state, pcjr_cart2) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","ibmpcjr_cart") + MCFG_SOFTWARE_LIST_ADD("flop_list","ibmpcjr_flop") +MACHINE_CONFIG_END + +static GFXDECODE_START( ibmpcjx ) + GFXDECODE_ENTRY( "gfx1", 0x0000, pc_8_charlayout, 3, 1 ) + GFXDECODE_ENTRY( "kanji", 0x0000, kanji_layout, 3, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_DERIVED( ibmpcjx, ibmpcjr ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(ibmpcjx_map) + MCFG_CPU_IO_MAP(ibmpcjx_io) + + MCFG_DEVICE_REMOVE("fdc:0"); + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcjr_floppies, "35dd", isa8_fdc_device::floppy_formats) + MCFG_SLOT_FIXED(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", pcjr_floppies, "35dd", isa8_fdc_device::floppy_formats) + MCFG_SLOT_FIXED(true) + + MCFG_GFXDECODE_MODIFY("gfxdecode", ibmpcjx) +MACHINE_CONFIG_END + + + +ROM_START( ibmpcjr ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD("bios.rom", 0xf0000, 0x10000,CRC(31e3a7aa) SHA1(1f5f7013f18c08ff50d7942e76c4fbd782412414)) + + ROM_REGION(0x08100,"gfx1", 0) + ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) // from an unknown clone cga card +ROM_END + +ROM_START( ibmpcjx ) + ROM_REGION(0x100000,"maincpu", ROMREGION_ERASEFF) + ROM_DEFAULT_BIOS("unk") + ROM_SYSTEM_BIOS( 0, "5601jda", "5601jda" ) + ROMX_LOAD("5601jda.bin", 0xf0000, 0x10000, CRC(b1e12366) SHA1(751feb16b985aa4f1ec1437493ff77e2ebd5e6a6), ROM_BIOS(1)) + ROMX_LOAD("basicjx.rom", 0xe8000, 0x08000, NO_DUMP, ROM_BIOS(1)) // boot fails due of this. + ROM_SYSTEM_BIOS( 1, "unk", "unk" ) + ROMX_LOAD("ipljx.rom", 0xe0000, 0x20000, CRC(36a7b2de) SHA1(777db50c617725e149bca9b18cf51ce78f6dc548), ROM_BIOS(2)) + + ROM_REGION(0x08100,"gfx1", 0) //TODO: needs a different charset + ROM_LOAD("cga.chr", 0x00000, 0x01000, BAD_DUMP CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) // from an unknown clone cga card + + ROM_REGION(0x38000,"kanji", 0) + ROM_LOAD("kanji.rom", 0x00000, 0x38000, BAD_DUMP CRC(eaa6e3c3) SHA1(35554587d02d947fae8446964b1886fff5c9d67f)) // hand-made rom +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +// pcjr +COMP( 1983, ibmpcjr, ibm5150, 0, ibmpcjr, ibmpcjr, pcjr_state, pcjr, "International Business Machines", "IBM PC Jr", MACHINE_IMPERFECT_COLORS ) +COMP( 1985, ibmpcjx, ibm5150, 0, ibmpcjx, ibmpcjr, pcjr_state, pcjr, "International Business Machines", "IBM PC JX", MACHINE_IMPERFECT_COLORS | MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/icatel.c b/src/mame/drivers/icatel.c new file mode 100644 index 00000000000..372dafb439a --- /dev/null +++ b/src/mame/drivers/icatel.c @@ -0,0 +1,269 @@ +// license:GPL-2.0+ +// copyright-holders: Felipe Sanches +/*************************************************************************** + + icatel - Brazilian public payphone + manufactured by icatel http://www.icatel.com.br/ + + Partial schematics (drawn based on PCB inspection) available at: + https://github.com/garoa/Icatel/blob/master/doc/icatel.pdf + + Driver by Felipe Sanches + + Changelog: + + 2014 DEC 14 [Felipe Sanches]: + * Initial driver skeleton + +***************************************************************************/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "video/hd44780.h" +//#include "sound/speaker.h" +#include "rendlay.h" +#include "debugger.h" + +class icatel_state : public driver_device +{ +public: + icatel_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_lcdc(*this, "hd44780") + { } + + DECLARE_READ8_MEMBER(magic_string); + + DECLARE_READ8_MEMBER(ioport_r); + DECLARE_WRITE8_MEMBER(ioport_w); + + DECLARE_READ8_MEMBER(cn8_extension_r); + DECLARE_WRITE8_MEMBER(cn8_extension_w); + + DECLARE_READ8_MEMBER(modem_r); + DECLARE_WRITE8_MEMBER(modem_w); + + DECLARE_READ8_MEMBER(ci8_r); + DECLARE_WRITE8_MEMBER(ci8_w); + + DECLARE_READ8_MEMBER(ci15_r); + DECLARE_WRITE8_MEMBER(ci15_w); + + DECLARE_READ8_MEMBER(ci16_r); + DECLARE_WRITE8_MEMBER(ci16_w); + + DECLARE_DRIVER_INIT(icatel); + DECLARE_PALETTE_INIT(icatel); + +private: + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_lcdc; +}; + +static ADDRESS_MAP_START(i80c31_prg, AS_PROGRAM, 8, icatel_state) + AM_RANGE(0x0000, 0x7FFF) AM_MIRROR(0x8000) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, icatel_state) + AM_RANGE(0x0000,0x3FFF) AM_RAM + AM_RANGE(0x8000,0x8002) AM_RAM /* HACK! */ + AM_RANGE(0x8040,0x8040) AM_MIRROR(0x3F1E) AM_DEVWRITE("hd44780", hd44780_device, control_write) // not sure yet. CI12 (73LS273) + AM_RANGE(0x8041,0x8041) AM_MIRROR(0x3F1E) AM_DEVWRITE("hd44780", hd44780_device, data_write) // not sure yet. CI12 + AM_RANGE(0x8060,0x8060) AM_MIRROR(0x3F1F) AM_READWRITE(ci8_r, ci8_w) + AM_RANGE(0x8080,0x8080) AM_MIRROR(0x3F1F) AM_READWRITE(ci16_r, ci16_w) // card reader (?) + AM_RANGE(0x80C0,0x80C0) AM_MIRROR(0x3F1F) AM_READWRITE(ci15_r, ci15_w) // 74LS244 (tristate buffer) + AM_RANGE(0xC000,0xCFFF) AM_READWRITE(cn8_extension_r, cn8_extension_w) + AM_RANGE(0xE000,0xEFFF) AM_READWRITE(modem_r, modem_w) + AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(ioport_r, ioport_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(i80c31_data, AS_DATA, 8, icatel_state) +// AM_RANGE(0x0056,0x005A) AM_READ(magic_string) /* This is a hack! */ +ADDRESS_MAP_END + +DRIVER_INIT_MEMBER( icatel_state, icatel ) +{ +} + +void icatel_state::machine_start() +{ +} + +void icatel_state::machine_reset() +{ +} + +READ8_MEMBER(icatel_state::magic_string) +{ +// logerror("read: magic_string, offset=%04X\n", offset); + char mstr[] = "TP-OK"; + return mstr[offset%5]; +} + +READ8_MEMBER(icatel_state::ioport_r) +{ + switch (offset%4) + { + case 0: return 0xff; + case 1: return 0x7f; + case 2: return 0xff; + case 3: return 0xff; + } + return 0; +} + +WRITE8_MEMBER(icatel_state::ioport_w) +{ +} + +//---------------------------------------- + +READ8_MEMBER(icatel_state::cn8_extension_r) +{ + /* TODO: Implement-me! */ + logerror("read: cn8_extension\n"); + return 0; +} + +WRITE8_MEMBER(icatel_state::cn8_extension_w) +{ + /* TODO: Implement-me! */ + logerror("write: cn8_extension [%02x]\n", data); +} + +//---------------------------------------- + +READ8_MEMBER(icatel_state::modem_r) +{ + /* TODO: Implement-me! */ + logerror("read: modem\n"); + return 0; +} + +WRITE8_MEMBER(icatel_state::modem_w) +{ + /* TODO: Implement-me! */ + logerror("write: modem [%02x]\n", data); +} + +//---------------------------------------- + +READ8_MEMBER(icatel_state::ci8_r) +{ + /* TODO: Implement-me! */ + logerror("read: ci8\n"); + return 0; +} + +WRITE8_MEMBER(icatel_state::ci8_w) +{ + /* TODO: Implement-me! */ + logerror("write: ci8 [%02x]\n", data); +} + +//---------------------------------------- + +READ8_MEMBER(icatel_state::ci15_r) +{ + /* TODO: Implement-me! */ +// debugger_break(machine()); +// logerror("read: ci15\n"); + return (1 << 3) | (1 << 0); +} + +WRITE8_MEMBER(icatel_state::ci15_w) +{ + /* TODO: Implement-me! */ + logerror("write: ci15 [%02x]\n", data); +} + +//---------------------------------------- + +READ8_MEMBER(icatel_state::ci16_r) +{ + /* TODO: Implement-me! */ + // seems to be the card reader. + logerror("read: ci16\n"); + return 0; +} + +WRITE8_MEMBER(icatel_state::ci16_w) +{ + /* TODO: Implement-me! */ + // seems to be the card reader. + logerror("write: ci16 [%02x]\n", data); +} + +//---------------------------------------- + +PALETTE_INIT_MEMBER(icatel_state, icatel) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static const gfx_layout prot_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( icatel ) + GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, prot_charlayout, 0, 1 ) +GFXDECODE_END + +static HD44780_PIXEL_UPDATE(icatel_pixel_update) +{ + if ( pos < 16 && line==0 ) + { + bitmap.pix16(y, pos*6 + x) = state; + } + + if ( pos >= 64 && pos < 80 && line==0 ) + { + bitmap.pix16(y+9,(pos-64)*6 + x) = state; + } +} + +static MACHINE_CONFIG_START( icatel, icatel_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80C31, XTAL_2_097152MHz) + MCFG_CPU_PROGRAM_MAP(i80c31_prg) + MCFG_CPU_DATA_MAP(i80c31_data) + MCFG_CPU_IO_MAP(i80c31_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_SIZE(6*16, 9*2) + MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(icatel_state, icatel) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", icatel) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 16) + MCFG_HD44780_PIXEL_UPDATE_CB(icatel_pixel_update) +MACHINE_CONFIG_END + +ROM_START( icatel ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "icatel_tpci_em._4_v16.05.ci14", 0x00000, 0x8000, CRC(d310586e) SHA1(21736ad5a06cf9695f8cc5ff2dc2d19b101504f5) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1995, icatel, 0, 0, icatel, 0, icatel_state, icatel, "Icatel", "TPCI (Brazilian public payphone)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) +/*The hardware was clearly manufactured in 1995. There's no evindence of the actual date of the firmware.*/ diff --git a/src/mame/drivers/ie15.c b/src/mame/drivers/ie15.c new file mode 100644 index 00000000000..405b33a2b5b --- /dev/null +++ b/src/mame/drivers/ie15.c @@ -0,0 +1,663 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + 15IE-00-013 Terminal + + A serial (RS232 or current loop) green-screen terminal, mostly VT52 + compatible (no Hold Screen mode and no graphics character set). + + Alternate character set (selected by SO/SI chars) is Cyrillic. + +****************************************************************************/ + + +#include "emu.h" + +#include "bus/rs232/rs232.h" +#include "cpu/ie15/ie15.h" +#include "machine/ie15_kbd.h" +#include "sound/beep.h" +#include "ie15.lh" + +#define SCREEN_PAGE (80*48) + +#define IE_TRUE 0x80 +#define IE_FALSE 0 + +#define IE15_TOTAL_HORZ 1000 +#define IE15_DISP_HORZ 800 +#define IE15_HORZ_START 200 + +#define IE15_TOTAL_VERT 28*11 +#define IE15_DISP_VERT 25*11 +#define IE15_VERT_START 2*11 +#define IE15_STATUSLINE 11 + + +#define VERBOSE_DBG 1 /* general debug messages */ + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + + +class ie15_state : public driver_device, + public device_serial_interface +{ +public: + ie15_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + device_serial_interface(mconfig, *this), + m_maincpu(*this, "maincpu"), + m_beeper(*this, "beeper"), + m_rs232(*this, "rs232"), + m_screen(*this, "screen"), + m_io_keyboard(*this, "keyboard") + { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER( scanline_callback ); + DECLARE_WRITE16_MEMBER( kbd_put ); + DECLARE_PALETTE_INIT( ie15 ); + + DECLARE_WRITE_LINE_MEMBER( serial_rx_callback ); + virtual void rcv_complete(); + virtual void tra_callback(); + virtual void tra_complete(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + DECLARE_WRITE8_MEMBER( mem_w ); + DECLARE_READ8_MEMBER( mem_r ); + DECLARE_WRITE8_MEMBER( mem_addr_lo_w ); + DECLARE_WRITE8_MEMBER( mem_addr_hi_w ); + DECLARE_WRITE8_MEMBER( mem_addr_inc_w ); + DECLARE_WRITE8_MEMBER( mem_addr_dec_w ); + DECLARE_READ8_MEMBER( flag_r ); + DECLARE_WRITE8_MEMBER( flag_w ); + DECLARE_WRITE8_MEMBER( beep_w ); + DECLARE_READ8_MEMBER( kb_r ); + DECLARE_READ8_MEMBER( kb_ready_r ); + DECLARE_READ8_MEMBER( kb_s_red_r ); + DECLARE_READ8_MEMBER( kb_s_sdv_r ); + DECLARE_READ8_MEMBER( kb_s_dk_r ); + DECLARE_READ8_MEMBER( kb_s_dupl_r ); + DECLARE_READ8_MEMBER( kb_s_lin_r ); + DECLARE_WRITE8_MEMBER( kb_ready_w ); + DECLARE_READ8_MEMBER( serial_tx_ready_r ); + DECLARE_WRITE8_MEMBER( serial_w ); + DECLARE_READ8_MEMBER( serial_rx_ready_r ); + DECLARE_READ8_MEMBER( serial_r ); + DECLARE_WRITE8_MEMBER( serial_speed_w ); + +private: + TIMER_CALLBACK_MEMBER(ie15_beepoff); + void update_leds(); + UINT32 draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline); + rectangle m_tmpclip; + bitmap_ind16 m_tmpbmp; + bitmap_ind16 m_offbmp; + + const UINT8 *m_p_chargen; + UINT8 *m_p_videoram; + UINT8 m_long_beep; + UINT8 m_kb_control; + UINT8 m_kb_data; + UINT8 m_kb_flag0; + UINT8 m_kb_flag; + UINT8 m_kb_ruslat; + UINT8 m_latch; + struct { + UINT8 cursor; + UINT8 enable; + UINT8 line25; + UINT32 ptr1; + UINT32 ptr2; + } m_video; + + UINT8 m_serial_rx_ready; + UINT8 m_serial_tx_ready; + +protected: + required_device m_maincpu; + required_device m_beeper; + required_device m_rs232; + required_device m_screen; + required_ioport m_io_keyboard; +}; + +READ8_MEMBER( ie15_state::mem_r ) { + UINT8 ret; + + ret = m_p_videoram[m_video.ptr1]; + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && m_video.ptr1 >= SCREEN_PAGE) + { + DBG_LOG(2,"memory",("R @ %03x == %02x\n", m_video.ptr1, ret)); + } + m_video.ptr1++; + m_video.ptr1 &= 0xfff; + m_latch = 0; + return ret; +} + +WRITE8_MEMBER( ie15_state::mem_w ) { + if ((m_latch ^= 1) == 0) { + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && m_video.ptr1 >= SCREEN_PAGE) + { + DBG_LOG(2,"memory",("W @ %03x <- %02x\n", m_video.ptr1, data)); + } + m_p_videoram[m_video.ptr1++] = data; + m_video.ptr1 &= 0xfff; + } +} + +WRITE8_MEMBER( ie15_state::mem_addr_inc_w ) { + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) + { + DBG_LOG(2,"memory",("++ %03x\n", m_video.ptr1)); + } + m_video.ptr1++; + m_video.ptr1 &= 0xfff; + if (m_video.enable) + m_video.ptr2 = m_video.ptr1; +} + +WRITE8_MEMBER( ie15_state::mem_addr_dec_w ) { + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) + { + DBG_LOG(2,"memory",("-- %03x\n", m_video.ptr1)); + } + m_video.ptr1--; + m_video.ptr1 &= 0xfff; + if (m_video.enable) + m_video.ptr2 = m_video.ptr1; +} + +WRITE8_MEMBER( ie15_state::mem_addr_lo_w ) { + UINT16 tmp = m_video.ptr1; + + tmp &= 0xff0; + tmp |= ((data >> 4) & 0xf); + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) + { + DBG_LOG(2,"memory",("lo %03x <- %02x = %03x\n", m_video.ptr1, data, tmp)); + } + m_video.ptr1 = tmp; + if (m_video.enable) + m_video.ptr2 = tmp; +} + +WRITE8_MEMBER( ie15_state::mem_addr_hi_w ) { + UINT16 tmp = m_video.ptr1; + + tmp &= 0xf; + tmp |= (data << 4); + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) + { + DBG_LOG(2,"memory",("hi %03x <- %02x = %03x\n", m_video.ptr1, data, tmp)); + } + m_video.ptr1 = tmp; + if (m_video.enable) + m_video.ptr2 = tmp; +} + +TIMER_CALLBACK_MEMBER(ie15_state::ie15_beepoff) +{ + machine().device("beeper")->set_state(0); +} + +WRITE8_MEMBER( ie15_state::beep_w ) { + UINT16 length = (m_long_beep & IE_TRUE) ? 150 : 400; + + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) + { + DBG_LOG(1,"beep",("(%s)\n", m_long_beep ? "short" : "long")); + } + machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(ie15_state::ie15_beepoff),this)); + machine().device("beeper")->set_state(1); +} + +/* keyboard */ + +// active high +READ8_MEMBER( ie15_state::kb_r ) { + DBG_LOG(2,"keyboard",("R %02X '%c'\n", m_kb_data, m_kb_data < 0x20 ? ' ' : m_kb_data)); + return m_kb_data; +} + +// active low +READ8_MEMBER( ie15_state::kb_ready_r ) { + m_kb_flag &= IE_TRUE; + if (m_kb_flag != m_kb_flag0) { + DBG_LOG(2,"keyboard",("? %c\n", m_kb_flag ? 'n' : 'y')); + m_kb_flag0 = m_kb_flag; + } + return m_kb_flag; +} + +// active low +WRITE8_MEMBER( ie15_state::kb_ready_w ) { + DBG_LOG(2,"keyboard",("clear ready\n")); + m_kb_flag = IE_TRUE | IE_KB_ACK; +} + + +// active high; active = interpret controls, inactive = display controls +READ8_MEMBER( ie15_state::kb_s_red_r ) { + return m_io_keyboard->read() & IE_KB_RED ? IE_TRUE : 0; +} + +// active high; active = setup mode +READ8_MEMBER( ie15_state::kb_s_sdv_r ) { + return m_kb_control & IE_KB_SDV ? IE_TRUE : 0; +} + +// active high; active = keypress detected on aux keypad +READ8_MEMBER( ie15_state::kb_s_dk_r ) { + return m_kb_control & IE_KB_DK ? IE_TRUE : 0; +} + +// active low; active = full duplex, inactive = half duplex +READ8_MEMBER( ie15_state::kb_s_dupl_r ) { + return m_io_keyboard->read() & IE_KB_DUP ? IE_TRUE : 0; +} + +// active high; active = on-line, inactive = local editing +READ8_MEMBER( ie15_state::kb_s_lin_r ) { + return m_io_keyboard->read() & IE_KB_LIN ? IE_TRUE : 0; +} + +/* serial port */ + +void ie15_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + device_serial_interface::device_timer(timer, id, param, ptr); +} + +WRITE_LINE_MEMBER( ie15_state::serial_rx_callback ) +{ + device_serial_interface::rx_w(state); +} + +void ie15_state::rcv_complete() +{ + receive_register_extract(); + m_serial_rx_ready = IE_FALSE; +} + +void ie15_state::tra_callback() +{ + UINT8 bit = transmit_register_get_data_bit(); + m_rs232->write_txd(bit); +} + +void ie15_state::tra_complete() +{ + m_serial_tx_ready = IE_TRUE; +} + +// active low +READ8_MEMBER( ie15_state::serial_rx_ready_r ) { + return m_serial_rx_ready; +} + +// active high +READ8_MEMBER( ie15_state::serial_tx_ready_r ) { + return m_serial_tx_ready; +} + +// not called unless data are ready +READ8_MEMBER( ie15_state::serial_r ) { + UINT8 data; + + data = get_received_char(); + m_serial_rx_ready = IE_TRUE; + DBG_LOG(1,"serial",("R %02X '%c'\n", data, data < 0x20?' ':data)); + return data; +} + +WRITE8_MEMBER( ie15_state::serial_w ) { + DBG_LOG(1,"serial",("W %02X '%c'\n", data, data < 0x20?' ':data)); + + m_serial_tx_ready = IE_FALSE; + transmit_register_setup(data); +} + +WRITE8_MEMBER( ie15_state::serial_speed_w ) { + return; +} + +READ8_MEMBER( ie15_state::flag_r ) { + UINT8 ret = 0; + + switch (offset) + { + case 0: // hsync pulse (not hblank) + ret = m_screen->hpos() < IE15_HORZ_START; + break; + case 1: // marker scanline + ret = (m_screen->vpos() % 11) > 7; + break; + case 2: // vblank + ret = !m_screen->vblank(); + break; + case 4: + ret = m_kb_ruslat; + break; + default: + break; + } + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && ret) + { + DBG_LOG(2,"flag",("read %d: %d\n", offset, ret)); + } + return ret; +} + +WRITE8_MEMBER( ie15_state::flag_w ) { + switch (offset) + { + case 0: + m_video.enable = data; + break; + case 1: + m_video.cursor = data; + break; + case 2: + m_long_beep = data; + break; + case 3: + m_video.line25 = data; + break; + case 4: + m_kb_ruslat = data; + break; + default: + break; + } + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && !offset) + { + DBG_LOG(2,"flag",("%sset %d\n", data?"":"re", offset)); + } +} + +static ADDRESS_MAP_START( ie15_mem, AS_PROGRAM, 8, ie15_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ie15_io, AS_IO, 8, ie15_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(000, 000) AM_READWRITE(mem_r, mem_w) // 00h W: memory request, R: memory data [6.1.2.2] + AM_RANGE(001, 001) AM_READ(serial_rx_ready_r) AM_WRITENOP // 01h W: memory latch [6.1.2.2] + AM_RANGE(002, 002) AM_WRITE(mem_addr_hi_w) // 02h W: memory address high [6.1.2.2] + AM_RANGE(003, 003) AM_WRITE(mem_addr_lo_w) // 03h W: memory address low [6.1.2.2] + AM_RANGE(004, 004) AM_WRITE(mem_addr_inc_w) // 04h W: memory address counter + [6.1.2.2] + AM_RANGE(005, 005) AM_WRITE(mem_addr_dec_w) // 05h W: memory address counter - [6.1.2.2] + AM_RANGE(006, 006) AM_READWRITE(serial_r, serial_w) // 06h W: serial port data [6.1.5.4] +// port 7 is handled in cpu core + AM_RANGE(010, 010) AM_READWRITE(serial_tx_ready_r, beep_w) // 08h W: speaker control [6.1.5.4] + AM_RANGE(011, 011) AM_READ(kb_r) // 09h R: keyboard data [6.1.5.2] + AM_RANGE(012, 012) AM_READ(kb_s_red_r) // 0Ah I: keyboard mode "RED" [6.1.5.2] + AM_RANGE(013, 013) AM_READ(kb_ready_r) // 0Bh R: keyboard data ready [6.1.5.2] + AM_RANGE(014, 014) AM_READWRITE(kb_s_sdv_r, serial_speed_w) // 0Ch W: serial port speed [6.1.3.1], R: keyboard mode "SDV" [6.1.5.2] + AM_RANGE(015, 015) AM_READWRITE(kb_s_dk_r, kb_ready_w) // 0Dh I: keyboard mode "DK" [6.1.5.2] + AM_RANGE(016, 016) AM_READ(kb_s_dupl_r) // 0Eh I: keyboard mode "DUPL" [6.1.5.2] + AM_RANGE(017, 017) AM_READ(kb_s_lin_r) // 0Fh I: keyboard mode "LIN" [6.1.5.2] +// simulation of flag registers + AM_RANGE(020, 027) AM_READWRITE(flag_r, flag_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ie15 ) + PORT_START("keyboard") + PORT_DIPNAME(IE_KB_RED, IE_KB_RED, "RED (Interpret controls)") + PORT_DIPSETTING(0x00, "Off") + PORT_DIPSETTING(IE_KB_RED, "On") + PORT_DIPNAME(IE_KB_DUP, IE_KB_DUP, "DUP (Full duplex)") + PORT_DIPSETTING(0x00, "Off") + PORT_DIPSETTING(IE_KB_DUP, "On") + PORT_DIPNAME(IE_KB_LIN, IE_KB_LIN, "LIN (Online)") + PORT_DIPSETTING(0x00, "Off") + PORT_DIPSETTING(IE_KB_LIN, "On") +INPUT_PORTS_END + +WRITE16_MEMBER( ie15_state::kbd_put ) +{ + DBG_LOG(2,"keyboard",("W %02X<-%02X '%c' %02X (%c)\n", m_kb_data, data, 'x' /* data < 0x20 ? ' ' : (data & 255) */, + m_kb_flag, m_kb_flag ? 'n' : 'y')); + m_kb_control = (data >> 8) & 255; + // send new key only when firmware has processed previous one + if (m_kb_flag == IE_TRUE) { + m_kb_data = data & 255; + m_kb_flag = 0; + } +} + +void ie15_state::machine_reset() +{ + memset(&m_video, 0, sizeof(m_video)); + m_kb_ruslat = m_long_beep = m_kb_control = m_kb_data = m_kb_flag0 = 0; + m_kb_flag = IE_TRUE; + + machine().device("beeper")->set_frequency(2400); + machine().device("beeper")->set_state(0); + + m_serial_tx_ready = m_serial_rx_ready = IE_TRUE; + set_data_frame(1 /* start bits */, 8 /* data bits */, PARITY_NONE, STOP_BITS_1); + // device supports rates from 150 to 9600 baud but null_modem has hardcoded 9600 + set_rate(9600); +} + +void ie15_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("video")->base(); + m_video.ptr1 = m_video.ptr2 = m_latch = 0; + + m_tmpclip = rectangle(0, IE15_DISP_HORZ-1, 0, IE15_DISP_VERT-1); + m_tmpbmp.allocate(IE15_DISP_HORZ, IE15_DISP_VERT); + m_offbmp.allocate(IE15_DISP_HORZ, 1); + if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { + m_offbmp.fill(0); + } +} + +/* + Usable raster is 800 x 275 pixels (80 x 25 characters). 24 lines are + available to the user and 25th (topmost) line is the status line. + Status line, if enabled, displays current serial port speed, 16 setup + bits, and clock. There is no NVRAM, so setup bits are always 0 after + reset and clock starts counting at 0 XXX. + + No character attributes are available, but in 'display controls' mode + control characters stored in memory are shown as blinking chars. + + Character cell is 10 x 11; character generator provides 7 x 8 of that. + 3 extra horizontal pixels are always blank. Blinking cursor may be + displayed on 3 extra scan lines. + + On each scan line, video board draws 80 characters from any location + in video memory; this is used by firmware to provide instant scroll + and cursor, which is a character with code 0x7F stored in XXX. + + Video board output is controlled by + - control flag 0 "disable video": 0 == disable + - control flag 1 "cursor": 0 == if this scan line is one of extra 3, + enable video every 5 frames. + - control flag 3 "status line": 0 == current scan line is part of status line + - keyboard mode 'RED' ('display controls'): if character code is + less than 0x20 and RED is set, enable video every 5 frames; if RED is + unset, disable video. + + XXX 'dotted look' is caused by strobe at 2x pixel clock -- use HLSL for this. +*/ + +UINT32 ie15_state::draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline) +{ + UINT8 gfx, fg, bg, ra, blink, red; + UINT16 x, chr; + + bg = 0; fg = 1; ra = scanline % 8; + blink = (m_screen->frame_number() % 10) > 4; + red = m_io_keyboard->read() & IE_KB_RED; + + for (x = offset; x < offset + 80; x++) + { + chr = m_p_videoram[x] << 3; + gfx = m_p_chargen[chr | ra]; + + if (scanline > 7 && (!m_video.cursor || blink)) + gfx = 0; + else if (chr < (0x20<<3)) { + if (red && blink && m_video.line25) + gfx = m_p_chargen[chr | 0x200 | ra]; + else + gfx = 0; + } + + *p++ = BIT(gfx, 7) ? fg : bg; + *p++ = BIT(gfx, 6) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = bg; + *p++ = bg; + *p++ = bg; + } + return 0; +} + +void ie15_state::update_leds() +{ + UINT8 data = m_io_keyboard->read(); + output_set_value("lat_led", m_kb_ruslat ^ 1); + output_set_value("nr_led", BIT(m_kb_control, IE_KB_NR_BIT) ^ 1); + output_set_value("pch_led", BIT(data, IE_KB_PCH_BIT) ^ 1); + output_set_value("dup_led", BIT(data, IE_KB_DUP_BIT) ^ 1); + output_set_value("lin_led", BIT(data, IE_KB_LIN_BIT) ^ 1); + output_set_value("red_led", BIT(data, IE_KB_RED_BIT) ^ 1); + output_set_value("sdv_led", BIT(m_kb_control, IE_KB_SDV_BIT) ^ 1); + output_set_value("prd_led", 1); // XXX +} + +/* + VBlank is active for 3 topmost on-screen rows and 1 at the bottom; however, control flag 3 overrides VBlank, + allowing status line to be switched on and off. +*/ +TIMER_DEVICE_CALLBACK_MEMBER(ie15_state::scanline_callback) +{ + UINT16 y = m_screen->vpos(); + + DBG_LOG(3,"scanline_cb", + ("addr %03x frame %d x %.4d y %.3d row %.2d e:c:s %d:%d:%d\n", + m_video.ptr2, (int)m_screen->frame_number(), m_screen->hpos(), y, + y%11, m_video.enable, m_video.cursor, m_video.line25)); + + if (y < IE15_VERT_START) return; + y -= IE15_VERT_START; + if (y >= IE15_DISP_VERT) return; + + if (!m_video.enable || (y < IE15_STATUSLINE && m_video.line25)) { + copybitmap(m_tmpbmp, m_offbmp, 0, 0, 0, y, m_tmpclip); + } else { + draw_scanline(&m_tmpbmp.pix16(y), m_video.ptr2, y%11); + } +} + +UINT32 ie15_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + update_leds(); + copybitmap(bitmap, m_tmpbmp, 0, 0, IE15_HORZ_START, IE15_VERT_START, cliprect); + return 0; +} + + +/* F4 Character Displayer */ +static const gfx_layout ie15_charlayout = +{ + 7, 8, /* 7x8 pixels in 10x11 cell */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( ie15 ) + GFXDECODE_ENTRY("chargen", 0x0000, ie15_charlayout, 0, 1) +GFXDECODE_END + +PALETTE_INIT_MEMBER( ie15_state, ie15 ) +{ + palette.set_pen_color(0, rgb_t::black); // black + palette.set_pen_color(1, 0x00, 0xc0, 0x00); // green +} + +static MACHINE_CONFIG_START( ie15, ie15_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD("maincpu", IE15, XTAL_30_8MHz/10) + MCFG_CPU_PROGRAM_MAP(ie15_mem) + MCFG_CPU_IO_MAP(ie15_io) + MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", ie15_state, scanline_callback, attotime::from_hz(50*28*11)) + MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_30_8MHz/(2*IE15_HORZ_START))) + + /* Video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(ie15_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_30_8MHz/2, IE15_TOTAL_HORZ, IE15_HORZ_START, + IE15_HORZ_START+IE15_DISP_HORZ, IE15_TOTAL_VERT, IE15_VERT_START, + IE15_VERT_START+IE15_DISP_VERT); + + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ie15) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_DEFAULT_LAYOUT(layout_ie15) + + /* Devices */ + MCFG_DEVICE_ADD("keyboard", IE15_KEYBOARD, 0) + MCFG_IE15_KEYBOARD_CB(WRITE16(ie15_state, kbd_put)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") + MCFG_RS232_RXD_HANDLER(WRITELINE(ie15_state, serial_rx_callback)) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( ie15 ) + ROM_REGION(0x1000, "maincpu", ROMREGION_ERASE00) + ROM_DEFAULT_BIOS("5chip") + ROM_SYSTEM_BIOS(0, "5chip", "5-chip firmware (newer)") + ROMX_LOAD("dump1.bin", 0x0000, 0x1000, CRC(14b82284) SHA1(5ac4159fbb1c3b81445605e26cd97a713ae12b5f), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "6chip", "6-chip firmware (older)") + ROMX_LOAD("dump5.bin", 0x0000, 0x1000, CRC(01f2e065) SHA1(2b72dc0594e38a528400cd25aed0c47e0c432895), ROM_BIOS(2)) + + ROM_REGION(0x1000, "video", ROMREGION_ERASE00) + + ROM_REGION(0x0800, "chargen", ROMREGION_ERASE00) + ROM_LOAD("chargen-15ie.bin", 0x0000, 0x0800, CRC(ed16bf6b) SHA1(6af9fb75f5375943d5c0ce9ed408e0fb4621b17e)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, ie15, 0, 0, ie15, ie15, driver_device, 0, "USSR", "15IE-00-013", 0) diff --git a/src/mame/drivers/if800.c b/src/mame/drivers/if800.c new file mode 100644 index 00000000000..610269b9642 --- /dev/null +++ b/src/mame/drivers/if800.c @@ -0,0 +1,117 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + if800 + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "machine/pic8259.h" +#include "video/upd7220.h" + + +class if800_state : public driver_device +{ +public: + if800_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_hgdc(*this, "upd7220"), + m_video_ram(*this, "video_ram"), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") { } + + required_device m_hgdc; + + required_shared_ptr m_video_ram; + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_palette; + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); +}; + +UPD7220_DISPLAY_PIXELS_MEMBER( if800_state::hgdc_display_pixels ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + int xi,gfx; + UINT8 pen; + + gfx = m_video_ram[address >> 1]; + + for(xi=0;xi<16;xi++) + { + pen = ((gfx >> xi) & 1) ? 1 : 0; + + bitmap.pix32(y, x + xi) = palette[pen]; + } +} + +static ADDRESS_MAP_START(if800_map, AS_PROGRAM, 16, if800_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0x0ffff) AM_RAM + AM_RANGE(0xfe000,0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(if800_io, AS_IO, 16, if800_state) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x0640, 0x065f) dma? + AM_RANGE(0x0660, 0x0663) AM_DEVREADWRITE8("upd7220", upd7220_device, read, write,0x00ff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( if800 ) +INPUT_PORTS_END + +void if800_state::machine_start() +{ +} + + +void if800_state::machine_reset() +{ +} + +static ADDRESS_MAP_START( upd7220_map, AS_0, 16, if800_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( if800, if800_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 8000000) + MCFG_CPU_PROGRAM_MAP(if800_map) + MCFG_CPU_IO_MAP(if800_io) + + +// MCFG_PIC8259_ADD( "pic8259", if800_pic8259_config ) + MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/4) + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(if800_state, hgdc_display_pixels) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) + + MCFG_PALETTE_ADD("palette", 8) +// MCFG_PALETTE_INIT(black_and_white) + +// MCFG_VIDEO_START_OVERRIDE(if800_state,if800) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( if800 ) + ROM_REGION( 0x2000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(36212491) SHA1(6eaa8885e2dccb6dd86def6c0c9be1870cee957f)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, if800, 0, 0, if800, if800, driver_device, 0, "Oki Electric", "if800 model 60", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/imds.c b/src/mame/drivers/imds.c new file mode 100644 index 00000000000..6e7e3a8d063 --- /dev/null +++ b/src/mame/drivers/imds.c @@ -0,0 +1,116 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Intel Intellec MDS + + 28/06/2011 Skeleton driver. + +This is a prototyping machine, very complex and expensive. + +It does all i/o via uarts, that is TTY, paper-tape puncher, CRT terminal. +It also has proms which can be dynamically programmed to alter the machine +architecture, so internal ports change meaning mid-stream. (e.g. port 80). + +The code below is just a sample; it does not represent any aspect of the +real hardware. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class imds_state : public driver_device +{ +public: + imds_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(term_r); + DECLARE_READ8_MEMBER(term_status_r); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_term_data; + virtual void machine_reset(); +}; + +READ8_MEMBER( imds_state::term_status_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( imds_state::term_r ) +{ + return (m_term_data) ? 0x21 : 0x20; +} + +static ADDRESS_MAP_START(imds_mem, AS_PROGRAM, 8, imds_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(imds_io, AS_IO, 8, imds_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( imds ) +INPUT_PORTS_END + +WRITE8_MEMBER( imds_state::kbd_put ) +{ + m_term_data = data; +} + +void imds_state::machine_reset() +{ + m_term_data = 0; +} + +//static const ins8250_interface imds_com_interface = +//{ +// 1843200, +// DEVCB_NULL, +// NULL, +// NULL, +// NULL +//}; + +static MACHINE_CONFIG_START( imds, imds_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, XTAL_4MHz) // no idea of clock. + MCFG_CPU_PROGRAM_MAP(imds_mem) + MCFG_CPU_IO_MAP(imds_io) + +// MCFG_INS8250_ADD( "ins8250", imds_com_interface ) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(imds_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( imds ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "a62_2716.bin", 0x0000, 0x0800, CRC(86a55b2f) SHA1(21033f7abb2c3e08028613e0c35ffecb703ff4f1)) + ROM_LOAD( "a51_2716.bin", 0x0800, 0x0800, CRC(ee55c448) SHA1(16c2f7e3b5baeb398adcc59603943910813e6a9b)) + ROM_LOAD( "a52_2716.bin", 0x1000, 0x0800, CRC(8db1b33e) SHA1(6fc5e438009636dd6d7185071b152b0491d3baeb)) + ROM_LOAD( "a53_2716.bin", 0x1800, 0x0800, CRC(01690f4f) SHA1(eadef30a3797f41e08d28e7691f8de44c0f3b8ea)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, imds, 0, 0, imds, imds, driver_device, 0, "Intel", "Intellec MDS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/imds2.c b/src/mame/drivers/imds2.c new file mode 100644 index 00000000000..aae8a4506f7 --- /dev/null +++ b/src/mame/drivers/imds2.c @@ -0,0 +1,876 @@ +// license:BSD-3-Clause +// copyright-holders:F. Ulivi +// +// *************************************** +// Driver for Intel Intellec MDS series-II +// *************************************** +// +// Documentation used for this driver: +// [1] Intel, manual 9800554-04 rev. D - Intellec series II MDS - Schematic drawings +// [2] Intel, manual 9800556-02 rev. B - Intellec series II MDS - Hardware reference manual +// [3] Intel, manual 9800555-02 rev. B - Intellec series II MDS - Hardware interface manual +// [4] Intel, manual 9800605-02 rev. B - Intellec series II MDS - Boot/monitor listing +// +// All these manuals are available on http://www.bitsavers.org +// +// An Intellec MDS series-II is composed of the following boards: +// +// ********** +// Integrated Processor Card (IPC) or Integrated Processor Board (IPB) +// +// This is the board where the OS (ISIS-II) and the application software run. +// This driver emulates an IPC. +// IPC is composed as follows: +// A83 8085A-2 CPU @ 4 MHz +// 64k of DRAM +// A82 2732 EPROM with monitor & boot firmware (assembly source of this ROM is in [4]) +// A66 8259A System PIC +// A89 8259A Local PIC +//*A86 8253 PIT +//*A91 8251A Serial channel #0 +//*A90 8251A Serial channel #1 +// +// ********** +// I/O Controller (IOC) +// +// This board acts as a controller for all I/O of the system. +// It is structured as if it were 2 boards in one: +// One part (around 8080) controls Keyboard, CRT & floppy, the other part (around PIO 8041A) controls all parallel I/Os +// (Line printer, Paper tape puncher, Paper tape reader, I/O to PROM programmer). +// Both parts are interfaced to IPC through a bidirectional 8-bit bus. +// IOC is composed of these parts: +// A69 8080A-2 CPU @ 2.448 MHz +// 8k of DRAM +// A50 2716 +// A51 2716 +// A52 2716 +// A53 2716 EPROMs with IOC firmware +// A58 8257 DMA controller +// A35 8253 PIT +// A1 8271 Floppy controller +// A20 8275 CRT controller +// A19 2708 Character generator ROM +// LS1 3.3 kHz beeper +// A72 8041A CPU @ 6 MHz (PIO: parallel I/O) +// +// ********** +// Keyboard controller +// +// Keyboard is controlled by a 8741 CPU that scans the key matrix and sends key codes to IOC through a 8-bit bus. +// +// A3 8741 CPU @ 3.58 MHz +// +// ICs that are not emulated yet are marked with "*" +// +// NOTE: +// Firmware running on PIO is NOT original because a dump is not available at the moment. +// Emulator runs a version of PIO firmware that was specifically developped by me to implement +// line printer output. +// +// TODO: +// - Find a dump of the original PIO firmware +// - Emulate serial channels on IPC +// - Emulate PIT on IPC +// - Adjust speed of processors. Wait states are not accounted for yet. +// +// Huge thanks to Dave Mabry for dumping IOC firmware, KB firmware and character generator. This driver would not +// exist without his dumps. +// (https://web.archive.org/web/20080509062332/http://www.s100-manuals.com/intel/IOC_iMDX_511_Upgrade.zip) +// +// Basic usage / test info: +// To use the system set DIP switches to: +// Floppy present +// IOC mode Diagnostic +// Keyboard present +// and reset the system. The built-in diagnostic mode should start. +// +// Another test is loading ISIS-II (the Intel OS for this system). Floppy image +// 9500007-07_ISIS-II_OPERATING_SYSTEM_DISKETTE_Ver_4.3.IMD +// To load it, the "IOC mode" should be set to "On line", the floppy image +// should be mounted and the system reset. After a few seconds the ISIS-II +// prompt should appear. A command that could be tried is "DIR" that lists +// the content of floppy disk. + +#include "includes/imds2.h" + +// CPU oscillator of IPC board: 8 MHz +#define IPC_XTAL_Y2 XTAL_8MHz + +// Main oscillator of IOC board: 22.032 MHz +#define IOC_XTAL_Y2 22032000 + +// FDC oscillator of IOC board: 8 MHz +#define IOC_XTAL_Y1 XTAL_8MHz + +// PIO oscillator: 6 MHz +#define IOC_XTAL_Y3 XTAL_6MHz + +// Frequency of beeper +#define IOC_BEEP_FREQ 3300 + +static ADDRESS_MAP_START(ipc_mem_map , AS_PROGRAM , 8 , imds2_state) + AM_RANGE(0x0000 , 0xffff) AM_READWRITE(ipc_mem_read, ipc_mem_write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ipc_io_map , AS_IO , 8 , imds2_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0xc0 , 0xc0) AM_READWRITE(imds2_ipc_dbbout_r , imds2_ipc_dbbin_data_w) + AM_RANGE(0xc1 , 0xc1) AM_READWRITE(imds2_ipc_status_r , imds2_ipc_dbbin_cmd_w) + AM_RANGE(0xf8 , 0xf9) AM_DEVREADWRITE("iocpio" , i8041_device , upi41_master_r , upi41_master_w) + AM_RANGE(0xfa , 0xfb) AM_READWRITE(imds2_ipclocpic_r , imds2_ipclocpic_w) + AM_RANGE(0xfc , 0xfd) AM_READWRITE(imds2_ipcsyspic_r , imds2_ipcsyspic_w) + AM_RANGE(0xff , 0xff) AM_WRITE(imds2_ipc_control_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ioc_mem_map , AS_PROGRAM , 8 , imds2_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000 , 0x1fff) AM_ROM + AM_RANGE(0x4000 , 0x5fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ioc_io_map , AS_IO , 8 , imds2_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00 , 0x0f) AM_WRITE(imds2_ioc_dbbout_w) + AM_RANGE(0x20 , 0x2f) AM_WRITE(imds2_ioc_f0_w) + AM_RANGE(0x30 , 0x3f) AM_WRITE(imds2_ioc_set_f1_w) + AM_RANGE(0x40 , 0x4f) AM_WRITE(imds2_ioc_reset_f1_w) + AM_RANGE(0x50 , 0x5f) AM_WRITE(imds2_start_timer_w) + AM_RANGE(0x60 , 0x6f) AM_WRITE(imds2_miscout_w) + AM_RANGE(0x80 , 0x8f) AM_READ(imds2_miscin_r) + AM_RANGE(0x90 , 0x9f) AM_READ(imds2_kb_read) + AM_RANGE(0xa0 , 0xaf) AM_READ(imds2_ioc_status_r) + AM_RANGE(0xb0 , 0xbf) AM_READ(imds2_ioc_dbbin_r) + AM_RANGE(0xc0 , 0xcf) AM_DEVICE("iocfdc" , i8271_device, map) + AM_RANGE(0xd0 , 0xdf) AM_DEVREADWRITE("ioccrtc" , i8275_device , read , write) + AM_RANGE(0xe0 , 0xef) AM_DEVREADWRITE("ioctimer" , pit8253_device , read , write); +// DMA controller range doesn't extend to 0xff because register 0xfd needs to be read as 0xff +// This register is used by IOC firmware to detect DMA controller model (either 8237 or 8257) + AM_RANGE(0xf0 , 0xf8) AM_DEVREADWRITE("iocdma" , i8257_device , read , write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pio_io_map , AS_IO , 8 , imds2_state) + AM_RANGE(MCS48_PORT_P1 , MCS48_PORT_P1) AM_READWRITE(imds2_pio_port_p1_r , imds2_pio_port_p1_w) + AM_RANGE(MCS48_PORT_P2 , MCS48_PORT_P2) AM_READWRITE(imds2_pio_port_p2_r , imds2_pio_port_p2_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(kb_io_map , AS_IO , 8 , imds2_state) + AM_RANGE(MCS48_PORT_P1 , MCS48_PORT_P1) AM_WRITE(imds2_kb_port_p1_w) + AM_RANGE(MCS48_PORT_P2 , MCS48_PORT_P2) AM_READ(imds2_kb_port_p2_r) + AM_RANGE(MCS48_PORT_T0 , MCS48_PORT_T0) AM_READ(imds2_kb_port_t0_r) + AM_RANGE(MCS48_PORT_T1 , MCS48_PORT_T1) AM_READ(imds2_kb_port_t1_r) +ADDRESS_MAP_END + +imds2_state::imds2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig , type , tag), + m_ipccpu(*this , "ipccpu"), + m_ipcsyspic(*this , "ipcsyspic"), + m_ipclocpic(*this , "ipclocpic"), + m_ioccpu(*this , "ioccpu"), + m_iocdma(*this , "iocdma"), + m_ioccrtc(*this , "ioccrtc"), + m_iocbeep(*this , "iocbeep"), + m_ioctimer(*this , "ioctimer"), + m_iocfdc(*this , "iocfdc"), + m_flop0(*this, "iocfdc:0"), + m_flop1(*this, "iocfdc:1"), + m_iocpio(*this , "iocpio"), + m_kbcpu(*this , "kbcpu"), + m_palette(*this , "palette"), + m_gfxdecode(*this, "gfxdecode"), + m_centronics(*this , "centronics"), + m_io_key0(*this , "KEY0"), + m_io_key1(*this , "KEY1"), + m_io_key2(*this , "KEY2"), + m_io_key3(*this , "KEY3"), + m_io_key4(*this , "KEY4"), + m_io_key5(*this , "KEY5"), + m_io_key6(*this , "KEY6"), + m_io_key7(*this , "KEY7"), + m_ioc_options(*this , "IOC_OPTS"), + m_device_status_byte(0xff) +{ +} + +READ8_MEMBER(imds2_state::ipc_mem_read) +{ + if (imds2_in_ipc_rom(offset)) { + return m_ipc_rom[ (offset & 0x07ff) | ((offset & 0x1000) >> 1) ]; + } else { + return m_ipc_ram[ offset ]; + } +} + +WRITE8_MEMBER(imds2_state::ipc_mem_write) +{ + if (!imds2_in_ipc_rom(offset)) { + m_ipc_ram[ offset ] = data; + } +} + +WRITE8_MEMBER(imds2_state::imds2_ipc_control_w) +{ + // See A84, pg 28 of [1] + // b3 is ~(bit to be written) + // b2-b0 is ~(no. of bit to be written) + UINT8 mask = (1U << (~data & 0x07)); + + if (BIT(data , 3)) { + m_ipc_control &= ~mask; + } else { + m_ipc_control |= mask; + } +} + +WRITE_LINE_MEMBER(imds2_state::imds2_ipc_intr) +{ + m_ipccpu->set_input_line(I8085_INTR_LINE , (state != 0) && BIT(m_ipc_control , 2)); +} + +READ8_MEMBER(imds2_state::imds2_ipcsyspic_r) +{ + return m_ipcsyspic->read(space , offset == 0); +} + +READ8_MEMBER(imds2_state::imds2_ipclocpic_r) +{ + return m_ipclocpic->read(space , offset == 0); +} + +WRITE8_MEMBER(imds2_state::imds2_ipcsyspic_w) +{ + m_ipcsyspic->write(space , offset == 0 , data); +} + +WRITE8_MEMBER(imds2_state::imds2_ipclocpic_w) +{ + m_ipclocpic->write(space , offset == 0 , data); +} + +WRITE8_MEMBER(imds2_state::imds2_miscout_w) +{ + m_miscout = data; + imds2_update_beeper(); + // Send INTR to IPC + m_ipclocpic->ir6_w(BIT(m_miscout , 1)); +} + +READ8_MEMBER(imds2_state::imds2_miscin_r) +{ + UINT8 res = m_ioc_options->read(); + return res | ((m_beeper_timer == 0) << 2); +} + +WRITE_LINE_MEMBER(imds2_state::imds2_beep_timer_w) +{ + m_beeper_timer = state; + imds2_update_beeper(); +} + +WRITE8_MEMBER(imds2_state::imds2_start_timer_w) +{ + // Trigger timer 2 of ioctimer + m_ioctimer->write_gate2(0); + m_ioctimer->write_gate2(1); +} + +READ8_MEMBER(imds2_state::imds2_kb_read) +{ + return m_kbcpu->upi41_master_r(space , (offset & 2) >> 1); +} + +READ8_MEMBER(imds2_state::imds2_kb_port_p2_r) +{ + if ((m_kb_p1 & 3) == 0) { + // Row selected + // Row number is encoded on bits P15..P12, they are "backwards" (P15 is LSB) and keyboard rows are encoded starting with value 2 on these bits (see A4, pg 56 of [1]) + unsigned row = (m_kb_p1 >> 2) & 0x0f; + ioport_value data; + + switch (row) { + case 4: + // Row 0 + data = m_io_key0->read(); + break; + + case 12: + // Row 1 + data = m_io_key1->read(); + break; + + case 2: + // Row 2 + data = m_io_key2->read(); + break; + + case 10: + // Row 3 + data = m_io_key3->read(); + break; + + case 6: + // Row 4 + data = m_io_key4->read(); + break; + + case 14: + // Row 5 + data = m_io_key5->read(); + break; + + case 1: + // Row 6 + data = m_io_key6->read(); + break; + + case 9: + // Row 7 + data = m_io_key7->read(); + break; + + default: + data = 0xff; + break; + } + return data & 0xff; + } else { + // No row selected + return 0xff; + } +} + +WRITE8_MEMBER(imds2_state::imds2_kb_port_p1_w) +{ + m_kb_p1 = data; +} + +READ8_MEMBER(imds2_state::imds2_kb_port_t0_r) +{ + // T0 tied low + // It appears to be some kind of strapping option on kb hw + return 0; +} + +READ8_MEMBER(imds2_state::imds2_kb_port_t1_r) +{ + // T1 tied low + // It appears to be some kind of strapping option on kb hw + return 0; +} + +WRITE8_MEMBER(imds2_state::imds2_ioc_dbbout_w) +{ + m_ioc_obf = ~data; + // Set/reset OBF flag (b0) + m_ipc_ioc_status = ((offset & 1) == 0) | (m_ipc_ioc_status & ~0x01); +} + +WRITE8_MEMBER(imds2_state::imds2_ioc_f0_w) +{ + // Set/reset F0 flag (b2) + m_ipc_ioc_status = ((offset & 1) << 2) | (m_ipc_ioc_status & ~0x04); +} + +WRITE8_MEMBER(imds2_state::imds2_ioc_set_f1_w) +{ + // Set F1 flag (b3) + m_ipc_ioc_status |= 0x08; +} + +WRITE8_MEMBER(imds2_state::imds2_ioc_reset_f1_w) +{ + // Reset F1 flag (b3) + m_ipc_ioc_status &= ~0x08; +} + +READ8_MEMBER(imds2_state::imds2_ioc_status_r) +{ + return ~m_ipc_ioc_status; +} + +READ8_MEMBER(imds2_state::imds2_ioc_dbbin_r) +{ + // Reset IBF flag (b1) + m_ipc_ioc_status &= ~0x02; + return ~m_ioc_ibf; +} + +READ8_MEMBER(imds2_state::imds2_ipc_dbbout_r) +{ + // Reset OBF flag (b0) + m_ipc_ioc_status &= ~0x01; + return m_ioc_obf; +} + +READ8_MEMBER(imds2_state::imds2_ipc_status_r) +{ + return m_ipc_ioc_status; +} + +WRITE8_MEMBER(imds2_state::imds2_ipc_dbbin_data_w) +{ + // Set IBF flag (b1) + m_ipc_ioc_status |= 0x02; + // Reset F1 flag (b3) + m_ipc_ioc_status &= ~0x08; + m_ioc_ibf = data; +} + +WRITE8_MEMBER(imds2_state::imds2_ipc_dbbin_cmd_w) +{ + // Set IBF flag (b1) + m_ipc_ioc_status |= 0x02; + // Set F1 flag (b3) + m_ipc_ioc_status |= 0x08; + m_ioc_ibf = data; +} + +WRITE_LINE_MEMBER(imds2_state::imds2_hrq_w) +{ + // Should be propagated to HOLD input of IOC CPU + m_iocdma->hlda_w(state); +} + +READ8_MEMBER(imds2_state::imds2_ioc_mem_r) +{ + address_space& prog_space = m_ioccpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(imds2_state::imds2_ioc_mem_w) +{ + address_space& prog_space = m_ioccpu->space(AS_PROGRAM); + return prog_space.write_byte(offset , data); +} + +READ8_MEMBER(imds2_state::imds2_pio_port_p1_r) +{ + // If STATUS ENABLE/ == 0 return inverted device status byte, else return 0xff + // STATUS ENABLE/ == 0 when P23-P20 == 12 & P24 == 0 & P25 = 1 & P26 = 1 + if ((m_pio_port2 & 0x7f) == 0x6c) { + return ~m_device_status_byte; + } else { + return 0xff; +} +} + +WRITE8_MEMBER(imds2_state::imds2_pio_port_p1_w) +{ + m_pio_port1 = data; + imds2_update_printer(); +} + +READ8_MEMBER(imds2_state::imds2_pio_port_p2_r) +{ + return m_pio_port2; +} + +WRITE8_MEMBER(imds2_state::imds2_pio_port_p2_w) +{ + m_pio_port2 = data; + imds2_update_printer(); + // Send INTR to IPC + m_ipclocpic->ir5_w(BIT(data , 7)); +} + +WRITE_LINE_MEMBER(imds2_state::imds2_pio_lpt_ack_w) +{ + if (state) { + m_device_status_byte |= 0x20; + } else { + m_device_status_byte &= ~0x20; + } +} + +WRITE_LINE_MEMBER(imds2_state::imds2_pio_lpt_busy_w) +{ + // Busy is active high in centronics_device whereas it's active low in MDS + if (!state) { + m_device_status_byte |= 0x10; + } else { + m_device_status_byte &= ~0x10; + } +} + +WRITE_LINE_MEMBER(imds2_state::imds2_pio_lpt_select_w) +{ + if (state) { + m_device_status_byte |= 0x40; + } else { + m_device_status_byte &= ~0x40; + } +} + +I8275_DRAW_CHARACTER_MEMBER(imds2_state::crtc_display_pixels) +{ + unsigned i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; + UINT16 pixels; + + if (lten) { + pixels = ~0; + } else if (vsp != 0 || (linecount & 8) != 0) { + pixels = 0; + } else { + // See [2], pg 58 for the very peculiar way of generating character images + // Here each half-pixel is translated into a full pixel + UINT16 exp_pix_l; + UINT16 exp_pix_r; + + exp_pix_l = (UINT16)chargen_byte; + exp_pix_l = ((exp_pix_l & 0x80) << 5) | + ((exp_pix_l & 0x40) << 4) | + ((exp_pix_l & 0x20) << 3) | + ((exp_pix_l & 0x10) << 2) | + ((exp_pix_l & 0x08) << 1) | + (exp_pix_l & 0x04); + exp_pix_l |= (exp_pix_l << 1); + exp_pix_r = exp_pix_l; + + // Layout of exp_pix_l/r: + // Bit # : F E D C B A 9 8 7 6 5 4 3 2 1 0 + // Bit of chargen_byte: 0 0 b7 b7 b6 b6 b5 b5 b4 b4 b3 b3 b2 b2 0 0 + if ((chargen_byte & 2) == 0) { + exp_pix_l >>= 1; + } + exp_pix_l &= 0x3fc0; + + if ((chargen_byte & 1) == 0) { + exp_pix_r >>= 1; + } + exp_pix_r &= 0x003e; + + pixels = exp_pix_l | exp_pix_r; + } + + if (rvv) { + pixels = ~pixels; + } + + for (i = 0; i < 14; i++) { + bitmap.pix32(y, x + i) = palette[ (pixels & (1U << (13 - i))) != 0 ]; + } +} + +int imds2_state::floppy_load(floppy_image_device *dev) +{ + dev->mon_w(0); + return IMAGE_INIT_PASS; +} + +void imds2_state::floppy_unload(floppy_image_device *dev) +{ + dev->mon_w(1); +} + +void imds2_state::driver_start() +{ + // Allocate 64k for IPC RAM + m_ipc_ram.resize(0x10000); + + memory_region *ipcrom = memregion("ipcrom"); + if (ipcrom == NULL) { + fatalerror("Unable to find IPC ROM region\n"); + } else { + m_ipc_rom = ipcrom->base(); + } +} + +void imds2_state::machine_start() +{ + // As far as I can tell from the schmatic, there's no software motor control + m_flop0->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(imds2_state::floppy_load), this)); + m_flop0->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(imds2_state::floppy_unload), this)); + m_flop1->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(imds2_state::floppy_load), this)); + m_flop1->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(imds2_state::floppy_unload), this)); +} + +void imds2_state::video_start() +{ + m_chargen = memregion("gfx1")->base(); +} + +void imds2_state::machine_reset() +{ + m_iocbeep->set_frequency(IOC_BEEP_FREQ); + m_ipc_control = 0x00; + m_ipc_ioc_status = 0x0f; + m_flop0->get_device()->mon_w(!m_flop0->get_device()->exists()); + m_flop1->get_device()->mon_w(!m_flop1->get_device()->exists()); + + m_iocfdc->set_rate(500000); // The IMD images show a rate of 500kbps +} + +bool imds2_state::imds2_in_ipc_rom(offs_t offset) const +{ + offs_t masked_offset = offset & 0xf800; + + // Region 0000-07ff is in ROM when START_UP/ == 0 && SEL_BOOT/ == 0 + if (masked_offset == 0x0000 && (m_ipc_control & 0x28) == 0) { + return true; + } + + // Region e800-efff is in ROM when SEL_BOOT/ == 0 + if (masked_offset == 0xe800 && (m_ipc_control & 0x08) == 0) { + return true; + } + + // Region f800-ffff is always in ROM + if (masked_offset == 0xf800) { + return true; + } + + return false; +} + +void imds2_state::imds2_update_beeper(void) +{ + m_iocbeep->set_state(m_beeper_timer == 0 && BIT(m_miscout , 0) == 0); +} + +void imds2_state::imds2_update_printer(void) +{ + // Data to printer is ~P1 when STATUS ENABLE/==1, else 0xff (assuming pull-ups on printer) + UINT8 printer_data; + if ((m_pio_port2 & 0x7f) == 0x6c) { + printer_data = 0xff; + } else { + printer_data = ~m_pio_port1; + } + m_centronics->write_data0(BIT(printer_data , 0)); + m_centronics->write_data1(BIT(printer_data , 1)); + m_centronics->write_data2(BIT(printer_data , 2)); + m_centronics->write_data3(BIT(printer_data , 3)); + m_centronics->write_data4(BIT(printer_data , 4)); + m_centronics->write_data5(BIT(printer_data , 5)); + m_centronics->write_data6(BIT(printer_data , 6)); + m_centronics->write_data7(BIT(printer_data , 7)); + + // LPT DATA STROBE/ == 0 when P23-P20 == 9 & P24 == 0 + m_centronics->write_strobe((m_pio_port2 & 0x1f) != 0x09); +} + +static INPUT_PORTS_START(imds2) + // See [1], pg 56 for key matrix layout + // See [1], pg 57 for keyboard layout + PORT_START("KEY0") + PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') // OK + PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('@') PORT_CHAR('`') // OK + PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') // OK + PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // OK + PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // OK + PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(':') PORT_CHAR('*') // OK + PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') // OK + PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // OK + + PORT_START("KEY1") + PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // OK + PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // OK + PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // OK + PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // OK + PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_UNUSED) + PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // OK + PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // OK + PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // OK + + PORT_START("KEY2") + PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('~') // OK + PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') // OK + PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // OK + PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // OK + PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') // OK + PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') // OK + PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // OK + PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') // OK + + PORT_START("KEY3") + PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // OK + PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // OK + PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // OK + PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // OK + PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // OK + PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // OK + PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // OK + PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // OK + + PORT_START("KEY4") + PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // OK + PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // OK + PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // OK + PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // OK + PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // OK + PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // OK + PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // OK + PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // OK + + PORT_START("KEY5") + PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') // OK + PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // OK + PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') // OK + PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // OK + PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') // OK + PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // OK + PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') // OK + PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') // OK + + PORT_START("KEY6") + PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // BS + PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // OK + PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') // OK + PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // OK + PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) // OK + PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // OK + PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') // OK + PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // OK + + PORT_START("KEY7") + PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // OK + PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // OK + PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') PORT_CHAR('^') // OK + PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // OK + PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) // OK + PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_UNUSED) + PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_UNUSED) + + // Options on IOC: see [1], pg 40 + PORT_START("IOC_OPTS") + PORT_DIPNAME(0x80 , 0x80 , "Keyboard present") + PORT_DIPSETTING(0x80 , DEF_STR(Yes)) + PORT_DIPSETTING(0x00 , DEF_STR(No)) + PORT_DIPNAME(0x28 , 0x00 , "IOC mode") + PORT_DIPSETTING(0x00 , "On line") + PORT_DIPSETTING(0x08 , "Local") + PORT_DIPSETTING(0x20 , "Diagnostic") + PORT_DIPNAME(0x02 , 0x00 , "Floppy present") + PORT_DIPSETTING(0x02 , DEF_STR(Yes)) + PORT_DIPSETTING(0x00 , DEF_STR(No)) + PORT_DIPNAME(0x01 , 0x01 , "CRT frame frequency") + PORT_DIPSETTING(0x01 , "50 Hz") + PORT_DIPSETTING(0x00 , "60 Hz") +INPUT_PORTS_END + +static GFXLAYOUT_RAW(imds2_charlayout , 8 , 8 , 8 , 64) + +static GFXDECODE_START(imds2) + GFXDECODE_ENTRY("gfx1" , 0x0000 , imds2_charlayout , 0 , 1) +GFXDECODE_END + +static SLOT_INTERFACE_START( imds2_floppies ) + SLOT_INTERFACE( "8sssd", FLOPPY_8_SSSD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START(imds2 , imds2_state) + MCFG_CPU_ADD("ipccpu" , I8085A , IPC_XTAL_Y2 / 2) // 4 MHz + MCFG_CPU_PROGRAM_MAP(ipc_mem_map) + MCFG_CPU_IO_MAP(ipc_io_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("ipcsyspic" , pic8259_device , inta_cb) + MCFG_QUANTUM_TIME(attotime::from_hz(100)) + + MCFG_PIC8259_ADD("ipcsyspic" , WRITELINE(imds2_state , imds2_ipc_intr) , VCC , NULL) + MCFG_PIC8259_ADD("ipclocpic" , DEVWRITELINE("ipcsyspic" , pic8259_device , ir7_w) , VCC , NULL) + + MCFG_CPU_ADD("ioccpu" , I8080A , IOC_XTAL_Y2 / 9) // 2.448 MHz + MCFG_CPU_PROGRAM_MAP(ioc_mem_map) + MCFG_CPU_IO_MAP(ioc_io_map) + MCFG_QUANTUM_TIME(attotime::from_hz(100)) + + // The IOC CRT hw is a bit complex, as the character clock (CCLK) to i8275 + // is varied according to the part of the video frame being scanned and according to + // the 50/60 Hz option jumper (W8). + // The basic clock (BCLK) runs at 22.032 MHz. + // CCLK = BCLK / 14 when in the active region of video + // CCLK = BCLK / 12 when in horizontal retrace (HRTC=1) + // CCLK = BCLK / 10 when in horizontal retrace of "short scan lines" (50 Hz only) + // + // ***** 50 Hz timings ***** + // 80 chars/row, 26 chars/h. retrace, 11 scan lines/row, 25 active rows, 3 vertical retrace rows + // Scan line: 80 chars * 14 BCLK + 26 chars * 12 BCLK = 1432 BCLK (64.996 usec) + // Scan row: 11 * scan lines = 15752 BCLK (714.960 usec) + // "Short" scan line: 80 chars * 14 BCLK + 26 chars * 10 BCLK = 1380 BCLK (62.636 usec) + // Frame: 28 scan rows (8 scan lines of 27th row are short): 27 * scan row + 3 * scan line + 8 * short scan line: 440640 BCLK (20 msec) + // + // ***** 60 Hz timings ***** + // 80 chars/row, 20 chars/h. retrace, 10 scan lines/row, 25 active rows, 2 vertical retrace rows + // Scan line: 80 chars * 14 BCLK + 20 chars * 12 BCLK = 1360 BCLK (61.728 usec) + // Scan row: 10 * scan lines = 13600 BCLK (617.284 usec) + // Frame: 27 scan rows : 367200 BCLK (16.667 msec) + // + // Clock here is semi-bogus: it gives the correct frame frequency at 50 Hz (with the incorrect + // assumption that CCLK is fixed at BCLK / 14) + MCFG_DEVICE_ADD("ioccrtc" , I8275 , 22853600 / 14) + MCFG_I8275_CHARACTER_WIDTH(14) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(imds2_state , crtc_display_pixels) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("iocdma" , i8257_device , dreq2_w)) + MCFG_I8275_IRQ_CALLBACK(INPUTLINE("ioccpu" , I8085_INTR_LINE)) + + MCFG_SCREEN_ADD("screen" , RASTER) + MCFG_SCREEN_UPDATE_DEVICE("ioccrtc" , i8275_device , screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_GFXDECODE_ADD("gfxdecode" , "palette" , imds2) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("iocbeep" , BEEP , 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS , "mono" , 1.00) + + MCFG_DEVICE_ADD("iocdma" , I8257 , IOC_XTAL_Y2 / 9) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(imds2_state, imds2_hrq_w)) + MCFG_I8257_IN_MEMR_CB(READ8(imds2_state , imds2_ioc_mem_r)) + MCFG_I8257_OUT_MEMW_CB(WRITE8(imds2_state , imds2_ioc_mem_w)) + MCFG_I8257_IN_IOR_1_CB(DEVREAD8("iocfdc" , i8271_device , data_r)) + MCFG_I8257_OUT_IOW_1_CB(DEVWRITE8("iocfdc" , i8271_device , data_w)) + MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("ioccrtc" , i8275_device , dack_w)) + + MCFG_DEVICE_ADD("ioctimer" , PIT8253 , 0) + MCFG_PIT8253_CLK0(IOC_XTAL_Y1 / 4) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("ioctimer" , pit8253_device , write_clk2)); + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(imds2_state , imds2_beep_timer_w)); + + MCFG_DEVICE_ADD("iocfdc" , I8271 , IOC_XTAL_Y1 / 2) + MCFG_I8271_DRQ_CALLBACK(DEVWRITELINE("iocdma" , i8257_device , dreq1_w)) + MCFG_FLOPPY_DRIVE_ADD("iocfdc:0", imds2_floppies, "8sssd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("iocfdc:1", imds2_floppies, "8sssd", floppy_image_device::default_floppy_formats) + + MCFG_CPU_ADD("iocpio" , I8041 , IOC_XTAL_Y3) + MCFG_CPU_IO_MAP(pio_io_map) + MCFG_QUANTUM_TIME(attotime::from_hz(100)) + + MCFG_CPU_ADD("kbcpu", I8741, XTAL_3_579545MHz) /* 3.579545 MHz */ + MCFG_CPU_IO_MAP(kb_io_map) + MCFG_QUANTUM_TIME(attotime::from_hz(100)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(imds2_state , imds2_pio_lpt_ack_w)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(imds2_state , imds2_pio_lpt_busy_w)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(imds2_state , imds2_pio_lpt_select_w)) +MACHINE_CONFIG_END + +ROM_START(imds2) + // ROM definition of IPC cpu (8085A) + ROM_REGION(0x1000 , "ipcrom" , 0) + ROM_LOAD("ipc_a82.bin" , 0x0000 , 0x1000 , CRC(0889394f) SHA1(b7525baf1884a7d67402dea4b5566016a9861ef2)) + + // ROM definition of IOC cpu (8080A) + ROM_REGION(0x2000 , "ioccpu" , 0) + ROM_LOAD("ioc_a50.bin" , 0x0000 , 0x0800 , CRC(d9f926a1) SHA1(bd9d0f7458acc2806120a6dbaab9c48be315b060)) + ROM_LOAD("ioc_a51.bin" , 0x0800 , 0x0800 , CRC(6aa2f86c) SHA1(d3a5314d86e3366545b4c97b29e323dfab383d5f)) + ROM_LOAD("ioc_a52.bin" , 0x1000 , 0x0800 , CRC(b88a38d5) SHA1(934716a1daec852f4d1f846510f42408df0c9584)) + ROM_LOAD("ioc_a53.bin" , 0x1800 , 0x0800 , CRC(c8df4bb9) SHA1(2dfb921e94ae7033a7182457b2f00657674d1b77)) + + // ROM definition of PIO controller (8041A) + // For the time being a specially developped PIO firmware is used until a dump of the original PIO is + // available. + ROM_REGION(0x400 , "iocpio" , 0) + ROM_LOAD("pio_a72.bin" , 0 , 0x400 , BAD_DUMP CRC(8c8e740b)) + + // ROM definition of keyboard controller (8741) + ROM_REGION(0x400 , "kbcpu" , 0) + ROM_LOAD("kbd511.bin" , 0 , 0x400 , CRC(ba7c4303) SHA1(19899af732d0ae1247bfc79979b1ee5f339ee5cf)) + // ROM definition of character generator (2708, A19 on IOC) + ROM_REGION(0x400 , "gfx1" , 0) + ROM_LOAD ("ioc_a19.bin" , 0x0000 , 0x0400 , CRC(47487d0f) SHA1(0ed98f9f06622949ee3cc2ffc572fb9702db0f81)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1979, imds2, 0, 0, imds2, imds2, driver_device, 0, "Intel", "Intellec MDS-II" , 0) diff --git a/src/mame/drivers/imsai.c b/src/mame/drivers/imsai.c new file mode 100644 index 00000000000..60dca210781 --- /dev/null +++ b/src/mame/drivers/imsai.c @@ -0,0 +1,142 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Imsai MPU-B. One of the earliest single-board computers on a S100 card. + + 2013-09-11 Skeleton driver. + + Chips used: i8085, i8251, i8253, 3622 fusable prom. XTAL 6MHz + + Press any key to start the monitor program. + + ToDo: + - Banking + - Dipswitches + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8251.h" +#include "machine/pit8253.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class imsai_state : public driver_device +{ +public: + imsai_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_uart(*this, "uart"), + m_pit(*this, "pit") + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(keyin_r); + DECLARE_READ8_MEMBER(status_r); + DECLARE_WRITE8_MEMBER(control_w); + DECLARE_WRITE_LINE_MEMBER(write_uart_clock); + +private: + UINT8 m_term_data; + virtual void machine_reset(); + required_device m_maincpu; + required_device m_terminal; + required_device m_uart; + required_device m_pit; +}; + + +static ADDRESS_MAP_START(imsai_mem, AS_PROGRAM, 8, imsai_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0xd000, 0xd0ff) AM_RAM + AM_RANGE(0xd100, 0xd103) AM_DEVREADWRITE("pit", pit8253_device, read, write) + AM_RANGE(0xd800, 0xdfff) AM_ROM AM_REGION("roms", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(imsai_io, AS_IO, 8, imsai_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x02, 0x02) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x03, 0x03) AM_READ(status_r) + AM_RANGE(0x04, 0x04) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x05, 0x05) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x12, 0x12) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x13, 0x13) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x14, 0x14) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x15, 0x15) AM_READ(status_r) + AM_RANGE(0xf3, 0xf3) AM_WRITE(control_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( imsai ) +INPUT_PORTS_END + +READ8_MEMBER( imsai_state::keyin_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( imsai_state::status_r ) +{ + return (m_term_data) ? 3 : 1; +} + +WRITE8_MEMBER( imsai_state::kbd_put ) +{ + m_term_data = data; +} + +WRITE_LINE_MEMBER(imsai_state::write_uart_clock) +{ + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + +WRITE8_MEMBER( imsai_state::control_w ) +{ +} + +void imsai_state::machine_reset() +{ + m_term_data = 0; +} + +static MACHINE_CONFIG_START( imsai, imsai_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8085A, XTAL_6MHz) + MCFG_CPU_PROGRAM_MAP(imsai_mem) + MCFG_CPU_IO_MAP(imsai_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(imsai_state, kbd_put)) + + /* Devices */ + MCFG_DEVICE_ADD("uart", I8251, 0) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_6MHz / 3) /* Timer 0: baud rate gen for 8251 */ + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(imsai_state, write_uart_clock)) + MCFG_PIT8253_CLK1(XTAL_6MHz / 3) /* Timer 1: user */ + MCFG_PIT8253_CLK2(XTAL_6MHz / 3) /* Timer 2: user */ +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( imsai ) + ROM_REGION( 0x800, "roms", 0 ) + ROM_LOAD( "vdb-80.rom", 0x0000, 0x0800, CRC(0afc4683) SHA1(a5419aaee00badf339d7c627f50ef8b2538e42e2) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, imsai, 0, 0, imsai, imsai, driver_device, 0, "Imsai", "MPU-B", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/indiana.c b/src/mame/drivers/indiana.c new file mode 100644 index 00000000000..23e08a8bb81 --- /dev/null +++ b/src/mame/drivers/indiana.c @@ -0,0 +1,122 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Indiana University 68030 board + + 08/12/2009 Skeleton driver. + 01/20/2014 Added ISA bus and peripherals + + TODO: Text appears in VGA f/b (0x6B8000), but doesn't display? + + System often reads/writes 6003D4/5, might be a cut-down 6845, + as it only uses registers C,D,E,F. + +****************************************************************************/ + +#include "bus/rs232/keyboard.h" +#include "cpu/m68000/m68000.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "machine/mc68901.h" + +#define M68K_TAG "maincpu" +#define ISABUS_TAG "isa" +#define MFP_TAG "mfp" + +class indiana_state : public driver_device +{ +public: + indiana_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, M68K_TAG) { } + DECLARE_DRIVER_INIT(indiana); + virtual void machine_reset(); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(indiana_mem, AS_PROGRAM, 32, indiana_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x0000ffff) AM_MIRROR(0x7f800000) AM_ROM AM_REGION("user1", 0) // 64Kb of EPROM + AM_RANGE(0x00100000, 0x00107fff) AM_MIRROR(0x7f8f8000) AM_RAM // SRAM 32Kb of SRAM + AM_RANGE(0x00200000, 0x002fffff) AM_DEVREADWRITE8(MFP_TAG, mc68901_device, read, write, 0xffffffff) AM_MIRROR(0x7f800000) // MFP + AM_RANGE(0x00400000, 0x004fffff) AM_DEVREADWRITE16(ISABUS_TAG, isa16_device, io16_swap_r, io16_swap_w, 0xffffffff) AM_MIRROR(0x7f800000) // 16 bit PC IO + AM_RANGE(0x00500000, 0x005fffff) AM_DEVREADWRITE16(ISABUS_TAG, isa16_device, prog16_swap_r, prog16_swap_w, 0xffffffff) AM_MIRROR(0x7f800000) // 16 bit PC MEM + AM_RANGE(0x00600000, 0x006fffff) AM_DEVREADWRITE8(ISABUS_TAG, isa16_device, io_r, io_w, 0xffffffff) AM_MIRROR(0x7f800000) // 8 bit PC IO + AM_RANGE(0x00700000, 0x007fffff) AM_DEVREADWRITE8(ISABUS_TAG, isa16_device, prog_r, prog_w, 0xffffffff) AM_MIRROR(0x7f800000) // 8 bit PC MEM + AM_RANGE(0x80000000, 0x803fffff) AM_RAM // 4 MB RAM + AM_RANGE(0xfffe0000, 0xfffe7fff) AM_RAM // SRAM mirror? +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( indiana ) +INPUT_PORTS_END + + +void indiana_state::machine_reset() +{ +} + +DRIVER_INIT_MEMBER(indiana_state,indiana) +{ +} + +SLOT_INTERFACE_START( indiana_isa_cards ) + // 8-bit + SLOT_INTERFACE("fdc_at", ISA8_FDC_AT) + SLOT_INTERFACE("comat", ISA8_COM_AT) + SLOT_INTERFACE("vga", ISA8_VGA) + + // 16-bit + SLOT_INTERFACE("ide", ISA16_IDE) +SLOT_INTERFACE_END + +static DEVICE_INPUT_DEFAULTS_START( keyboard ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_1200 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +static MACHINE_CONFIG_START( indiana, indiana_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M68K_TAG, M68030, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(indiana_mem) + + MCFG_DEVICE_ADD(ISABUS_TAG, ISA16, 0) + MCFG_ISA16_CPU(":" M68K_TAG) + MCFG_ISA16_BUS_CUSTOM_SPACES() + MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa1", indiana_isa_cards, "vga", false) + MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa2", indiana_isa_cards, "fdc_at", false) + MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa3", indiana_isa_cards, "comat", false) + MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa4", indiana_isa_cards, "ide", false) + + MCFG_DEVICE_ADD(MFP_TAG, MC68901, XTAL_16MHz/4) + MCFG_MC68901_TIMER_CLOCK(XTAL_16MHz/4) + MCFG_MC68901_RX_CLOCK(0) + MCFG_MC68901_TX_CLOCK(0) + MCFG_MC68901_OUT_SO_CB(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD("keyboard", default_rs232_devices, "keyboard") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MFP_TAG, mc68901_device, write_rx)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("keyboard", keyboard) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( indiana ) + ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v9", "ver 0.9" ) + ROMX_LOAD( "prom0_9.bin", 0x0000, 0x10000, CRC(746ad75e) SHA1(7d5c123c8568b1e02ab683e8f3188d0fef78d740), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v8", "ver 0.8" ) + ROMX_LOAD( "prom0_8.bin", 0x0000, 0x10000, CRC(9d8dafee) SHA1(c824e5fe6eec08f51ef287c651a5034fe3c8b718), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v7", "ver 0.7" ) + ROMX_LOAD( "prom0_7.bin", 0x0000, 0x10000, CRC(d6a3b6bc) SHA1(01d8cee989ab29646d9d3f8b7262b10055653d41), ROM_BIOS(3)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1993, indiana, 0, 0, indiana, indiana, indiana_state, indiana, "Indiana University", "Indiana University 68030 board", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/instruct.c b/src/mame/drivers/instruct.c new file mode 100644 index 00000000000..ae806290293 --- /dev/null +++ b/src/mame/drivers/instruct.c @@ -0,0 +1,438 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Signetics Intructor 50 + + 2010-04-08 Skeleton driver. + 2012-05-20 Connected digits, system boots. [Robbbert] + 2012-05-20 Connected keyboard, system mostly usable. [Robbbert] + 2013-10-15 Fixed various regressions. [Robbbert] + + From looking at a blurry picture of it, this is what I can determine: + - Left side: 8 toggle switches, with a round red led above each one. + - Below this is the Port Address Switch with choice of 'Non-Extended', 'Extended' or 'Memory'. + - To the right of this is another toggle switch labelled 'Interrupt', the + choices are 'Direct' and 'Indirect'. + - Above this switch are 2 more round red leds: FLAG and RUN. + - Middle: a 4 down x3 across keypad containing the function keys. The + labels (from left to right, top to bottom) are: + SENS, WCAS, BKPT, INT, RCAS, REG, MON, STEP, MEM, RST, RUN, ENT/NXT. + - Right side: a 4x4 hexadecimal keypad. The keys are: + C, D, E, F, 8, 9, A, B, 4, 5, 6, 7, 0, 1, 2, 3 + - Above, extending from one side to the other is a metal plate with + printed mnemonics. At the right edge are sockets to connect up the + MIC and EAR cords to a cassette player. + - At the back is a S100 interface. + + Quick usage: + - Look at memory: Press minus key. Enter an address. Press UP key to see the next. + - Look at registers: Press R. Press 0. Press UP key to see the next. + - Set PC register: Press R. Press C. Type in new address, Press UP. + - Load a tape: Press L, enter file number (1 digit), press UP. On + completion of a successful load, HELLO will be displayed. + + ToDO: + - Connect round led for Run. + - Last Address Register + - Initial Jump Logic + - Single-step and Breakpoint don't stop execution because of the above. + - The "Port Address Switch" which selects which of the 3 sources will + be used for port_r and port_w. Currently all 3 are selected at once. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/s2650/s2650.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "instruct.lh" + +class instruct_state : public driver_device +{ +public: + instruct_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_p_ram(*this, "mainram") + , m_p_smiram(*this, "smiram") + , m_p_extram(*this, "extram") + , m_cass(*this, "cassette") + { } + + DECLARE_READ8_MEMBER(port_r); + DECLARE_READ8_MEMBER(portfc_r); + DECLARE_READ8_MEMBER(portfd_r); + DECLARE_READ8_MEMBER(portfe_r); + DECLARE_READ8_MEMBER(sense_r); + DECLARE_WRITE_LINE_MEMBER(flag_w); + DECLARE_WRITE8_MEMBER(port_w); + DECLARE_WRITE8_MEMBER(portf8_w); + DECLARE_WRITE8_MEMBER(portf9_w); + DECLARE_WRITE8_MEMBER(portfa_w); + DECLARE_QUICKLOAD_LOAD_MEMBER(instruct); + INTERRUPT_GEN_MEMBER(t2l_int); +private: + virtual void machine_reset(); + UINT16 m_lar; + UINT8 m_digit; + bool m_valid_digit; + bool m_cassin; + bool m_irqstate; + required_device m_maincpu; + required_shared_ptr m_p_ram; + required_shared_ptr m_p_smiram; + required_shared_ptr m_p_extram; + required_device m_cass; +}; + +// flag led +WRITE_LINE_MEMBER( instruct_state::flag_w ) +{ + output_set_value("led8", !state); +} + +// user port +WRITE8_MEMBER( instruct_state::port_w ) +{ + char ledname[8]; + for (int i = 0; i < 8; i++) + { + sprintf(ledname,"led%d",i); + output_set_value(ledname, !BIT(data, i)); + } +} + +// cassette port +WRITE8_MEMBER( instruct_state::portf8_w ) +{ + if BIT(data, 4) + m_cass->output(BIT(data, 3) ? -1.0 : +1.0); + else + m_cass->output(0.0); + + m_cassin = BIT(data, 7); +} + +// segment output +WRITE8_MEMBER( instruct_state::portf9_w ) +{ + if (m_valid_digit) + output_set_digit_value(m_digit, data); + m_valid_digit = false; +} + +// digit & keyrow-scan select +WRITE8_MEMBER( instruct_state::portfa_w ) +{ + m_digit = data; + m_valid_digit = true; +} + +// user switches +READ8_MEMBER( instruct_state::port_r ) +{ + return ioport("USW")->read(); +} + +// last address register A0-7 copied to 17E9 at boot +READ8_MEMBER( instruct_state::portfc_r ) +{ + return m_lar; +} + +// last address register A8-14 copied to 17E8 at boot +READ8_MEMBER( instruct_state::portfd_r ) +{ + return (m_lar >> 8) & 0x7f; +} + +// read keyboard +READ8_MEMBER( instruct_state::portfe_r ) +{ + for (UINT8 i = 0; i < 6; i++) + { + if (BIT(m_digit, i)) + { + char kbdrow[6]; + sprintf(kbdrow,"X%X",i); + return ioport(kbdrow)->read(); + } + } + + return 0xf; +} + + +// Read cassette and SENS key +READ8_MEMBER( instruct_state::sense_r ) +{ + if (m_cassin) + return (m_cass->input() > 0.03) ? 1 : 0; + else + return BIT(ioport("HW")->read(), 0); +} + +INTERRUPT_GEN_MEMBER( instruct_state::t2l_int ) +{ + UINT8 hwkeys = ioport("HW")->read(); + + // check RST key + if BIT(hwkeys, 3) + { + m_maincpu->set_state_int(S2650_PC, 0); + return; + } + else + // check MON key + if BIT(hwkeys, 2) + { + m_maincpu->set_state_int(S2650_PC, 0x1800); + return; + } + else + { + UINT8 switches = ioport("SW")->read(); + + // Set vector from INDIRECT sw + UINT8 vector = BIT(switches, 0) ? 0x87 : 0x07; + + // Check INT sw & key + if BIT(switches, 1) + device.execute().set_input_line_and_vector(0, BIT(hwkeys, 1) ? ASSERT_LINE : CLEAR_LINE, vector); + else + // process ac input + { + m_irqstate ^= 1; + device.execute().set_input_line_and_vector(0, m_irqstate ? ASSERT_LINE : CLEAR_LINE, vector); + } + } +} + +static ADDRESS_MAP_START( instruct_mem, AS_PROGRAM, 8, instruct_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0ffe) AM_RAM AM_SHARE("mainram") + AM_RANGE(0x0fff, 0x0fff) AM_READWRITE(port_r,port_w) + AM_RANGE(0x1780, 0x17ff) AM_RAM AM_SHARE("smiram") + AM_RANGE(0x1800, 0x1fff) AM_ROM AM_REGION("roms",0) + AM_RANGE(0x2000, 0x7fff) AM_RAM AM_SHARE("extram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( instruct_io, AS_IO, 8, instruct_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x07, 0x07) AM_READWRITE(port_r,port_w) + AM_RANGE(0xf8, 0xf8) AM_WRITE(portf8_w) + AM_RANGE(0xf9, 0xf9) AM_WRITE(portf9_w) + AM_RANGE(0xfa, 0xfa) AM_WRITE(portfa_w) + AM_RANGE(0xfc, 0xfc) AM_READ(portfc_r) + AM_RANGE(0xfd, 0xfd) AM_READ(portfd_r) + AM_RANGE(0xfe, 0xfe) AM_READ(portfe_r) + AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(port_r,port_w) + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(sense_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( instruct ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("WCAS") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RCAS") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BKPT") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT/NXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + + PORT_START("HW") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SENS") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MON") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + + PORT_START("SW") + PORT_DIPNAME( 0x01, 0x00, "INT") // Interrupt jumps to 0007 or *0007 + PORT_DIPSETTING( 0x01, "Indirect") + PORT_DIPSETTING( 0x00, "Direct") + PORT_DIPNAME( 0x02, 0x00, "AC/INT") // Interrupt comes from INT key or from power supply + PORT_DIPSETTING( 0x02, "INT") + PORT_DIPSETTING( 0x00, "AC") + + PORT_START("USW") + PORT_DIPNAME( 0x01, 0x00, "Switch A") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x02, 0x02, "Switch B") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x04, 0x04, "Switch C") PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x04, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x08, 0x00, "Switch D") PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x08, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x10, 0x00, "Switch E") PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x10, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x20, 0x20, "Switch F") PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x20, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x40, 0x40, "Switch G") PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x40, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x80, 0x00, "Switch H") PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x80, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) +INPUT_PORTS_END + + +void instruct_state::machine_reset() +{ + m_cassin = 0; + address_space &space = m_maincpu->space(AS_IO); + port_w(space, 0, 0); // turn round leds off + m_maincpu->set_state_int(S2650_PC, 0x1800); +} + +QUICKLOAD_LOAD_MEMBER( instruct_state, instruct ) +{ + UINT16 i, exec_addr, quick_length, read_; + int result = IMAGE_INIT_FAIL; + + quick_length = image.length(); + if (quick_length < 0x0100) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.message(" File too short"); + } + else + if (quick_length > 0x8000) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.message(" File too long"); + } + else + { + dynamic_buffer quick_data(quick_length); + read_ = image.fread( &quick_data[0], quick_length); + if (read_ != quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.message(" Cannot read the file"); + } + else if (quick_data[0] != 0xc5) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.message(" Invalid header"); + } + else + { + exec_addr = quick_data[1] * 256 + quick_data[2]; + + if (exec_addr >= quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.message(" Exec address beyond end of file"); + } + else + { + // load to 0000-0FFE (standard ram + extra) + read_ = 0xfff; + if (quick_length < 0xfff) + read_ = quick_length; + m_p_ram[0] = 0x1f; // add jump for RST key + for (i = 1; i < read_; i++) + m_p_ram[i] = quick_data[i]; + + // load to 1780-17BF (spare ram inside 2656) + read_ = 0x17c0; + if (quick_length < 0x17c0) + read_ = quick_length; + if (quick_length > 0x1780) + for (i = 0x1780; i < read_; i++) + m_p_smiram[i-0x1780] = quick_data[i]; + + // put start address into PC so it can be debugged + m_p_smiram[0x68] = m_p_ram[1]; + m_p_smiram[0x69] = m_p_ram[2]; + + // load to 2000-7FFF (optional extra ram) + if (quick_length > 0x2000) + for (i = 0x2000; i < quick_length; i++) + m_p_extram[i-0x2000] = quick_data[i]; + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); + + // Start the quickload - JP exec_addr + m_maincpu->set_state_int(S2650_PC, 0); + + result = IMAGE_INIT_PASS; + } + } + } + + return result; +} + +static MACHINE_CONFIG_START( instruct, instruct_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_3_579545MHz / 4) + MCFG_CPU_PROGRAM_MAP(instruct_mem) + MCFG_CPU_IO_MAP(instruct_io) + MCFG_CPU_PERIODIC_INT_DRIVER(instruct_state, t2l_int, 120) + MCFG_S2650_FLAG_HANDLER(WRITELINE(instruct_state, flag_w)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_instruct) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", instruct_state, instruct, "pgm", 1) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( instruct ) + ROM_REGION( 0x0800, "roms", 0 ) + ROM_LOAD( "instruct.rom", 0x0000, 0x0800, CRC(131715a6) SHA1(4930b87d09046113ab172ba3fb31f5e455068ec7) ) + + ROM_REGION( 0x8020, "proms", 0 ) + ROM_LOAD( "82s123.33", 0x0000, 0x0020, CRC(b7aecef0) SHA1(b39fb35e8b6ab67b31f8f310fd5d56304bcd4123) ) + ROM_LOAD( "82s103.20", 0x0020, 0x8000, NO_DUMP ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, instruct, 0, 0, instruct, instruct, driver_device, 0, "Signetics", "Signetics Instructor 50", 0 ) diff --git a/src/mame/drivers/interact.c b/src/mame/drivers/interact.c new file mode 100644 index 00000000000..31a7cf195f2 --- /dev/null +++ b/src/mame/drivers/interact.c @@ -0,0 +1,299 @@ +// license:BSD-3-Clause +// copyright-holders:JJ Stacino +/*************************************************************************** + + Interact Family Computer + + 12/05/2009 Skeleton driver - Micko + 31/05/2009 Added notes - Robbbert + + This was made by Interact Company of Ann Arbor, Michigan. However, + just after launch, the company collapsed. The liquidator, Protecto, + sold some and MicroVideo sold the rest. MicroVideo continued to + develop but went under 2 years later. Meanwhile, the French company + Lambda Systems sold a clone called the Victor Lambda. But, like the + Americans, Lambda Systems also collapsed. Another French company, + Micronique, purchased all remaining stock and intellectual rights + from Lambda Systems, Microvideo and Interact, and the computer becomes + wholly French. The computer has a name change, becoming the Hector. + This in turn gets upgraded (2HR, HRX, MX). The line is finally + retired in about 1985. + + Hector 2HR+ + Victor + Hector 2HR + Hector HRX + Hector MX40c + Hector MX80c + Hector 1 + Interact + + 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com + 31/06/2009 Video - Robbbert + + 29/10/2009 Update skeleton to functional machine + by yo_fr (jj.stac @ aliceadsl.fr) + + => add Keyboard, + => add color, + => add cassette, + => add sn76477 sound and 1bit sound, + => add joysticks (stick, pot, fire) + => add BR/HR switching + => add bank switch for HRX + => add device MX80c and bank switching for the ROM + Importante note : the keyboard function add been piked from + DChector project : http://dchector.free.fr/ made by DanielCoulom + (thank's Daniel) + TODO : Add the cartridge function, + Adjust the one shot and A/D timing (sn76477) +****************************************************************************/ +/* Mapping for joystick see hec2hrp.c*/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "formats/hect_tap.h" +#include "imagedev/printer.h" +#include "sound/wave.h" /* for K7 sound*/ +#include "sound/discrete.h" /* for 1 Bit sound*/ +#include "machine/upd765.h" /* for floppy disc controller */ + +#include "includes/hec2hrp.h" + + +class interact_state : public hec2hrp_state +{ +public: + interact_state(const machine_config &mconfig, device_type type, const char *tag) + : hec2hrp_state(mconfig, type, tag), + m_videoram(*this, "videoram") { } + + required_shared_ptr m_videoram; + DECLARE_MACHINE_START(interact); + DECLARE_MACHINE_RESET(interact); + UINT32 screen_update_interact(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + +static ADDRESS_MAP_START(interact_mem, AS_PROGRAM, 8, interact_state ) + ADDRESS_MAP_UNMAP_HIGH + /* Hardware address mapping*/ +/* AM_RANGE(0x0800,0x0808) AM_WRITE(hector_switch_bank_w)// Bank management not udsed in BR machine*/ + AM_RANGE(0x1000,0x1000) AM_WRITE(hector_color_a_w) /* Color c0/c1*/ + AM_RANGE(0x1800,0x1800) AM_WRITE(hector_color_b_w) /* Color c2/c3*/ + AM_RANGE(0x2000,0x2003) AM_WRITE(hector_sn_2000_w) /* Sound*/ + AM_RANGE(0x2800,0x2803) AM_WRITE(hector_sn_2800_w) /* Sound*/ + AM_RANGE(0x3000,0x3000) AM_READWRITE(hector_cassette_r, hector_sn_3000_w)/* Write necessary*/ + AM_RANGE(0x3800,0x3807) AM_READWRITE(hector_keyboard_r, hector_keyboard_w) /* Keyboard*/ + + /* Main ROM page*/ + AM_RANGE(0x0000,0x3fff) AM_ROM /*BANK(2)*/ + /* AM_RANGE(0x1000,0x3fff) AM_RAM*/ + + /* Video br mapping*/ + AM_RANGE(0x4000,0x49ff) AM_RAM AM_SHARE("videoram") + /* continous RAM*/ + AM_RANGE(0x4A00,0xffff) AM_RAM + +ADDRESS_MAP_END + + +MACHINE_RESET_MEMBER(interact_state,interact) +{ + hector_reset(0, 0); +} + +MACHINE_START_MEMBER(interact_state,interact) +{ + hector_init(); +} + +UINT32 interact_state::screen_update_interact(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_videoram; + screen.set_visible_area(0, 113, 0, 75); + hector_hr(bitmap, videoram, 77, 32); + return 0; +} + +static MACHINE_CONFIG_START( interact, interact_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(interact_mem) + MCFG_CPU_PERIODIC_INT_DRIVER(interact_state, irq0_line_hold, 50) /* put on the I8080 irq in Hz*/ + + MCFG_MACHINE_RESET_OVERRIDE(interact_state,interact) + MCFG_MACHINE_START_OVERRIDE(interact_state,interact) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 79) + MCFG_SCREEN_VISIBLE_AREA(0, 112, 0, 77) + MCFG_SCREEN_UPDATE_DRIVER(interact_state, screen_update_interact) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) /* 8 colours, but only 4 at a time*/ + + MCFG_VIDEO_START_OVERRIDE(interact_state,hec2hrp) + + MCFG_FRAGMENT_ADD(hector_audio) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(hector_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MASK_SPEAKER) + MCFG_CASSETTE_INTERFACE("interact_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","interact") + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( hector1, interact_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_1_75MHz) + MCFG_CPU_PROGRAM_MAP(interact_mem) + MCFG_CPU_PERIODIC_INT_DRIVER(interact_state, irq0_line_hold, 50) /* put on the I8080 irq in Hz*/ + + MCFG_MACHINE_RESET_OVERRIDE(interact_state,interact) + MCFG_MACHINE_START_OVERRIDE(interact_state,interact) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 79) + MCFG_SCREEN_VISIBLE_AREA(0, 112, 0, 77) + MCFG_SCREEN_UPDATE_DRIVER(interact_state, screen_update_interact) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) /* 8 colours, but only 4 at a time*/ + + MCFG_VIDEO_START_OVERRIDE(interact_state,hec2hrp) + + MCFG_FRAGMENT_ADD(hector_audio) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(hector_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MASK_SPEAKER) + MCFG_CASSETTE_INTERFACE("interact_cass") + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + +MACHINE_CONFIG_END + +/* Input ports */ +static INPUT_PORTS_START( interact ) + /* keyboard input */ + PORT_START("KEY.0") /* [0] - port 3000 @ 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("KEY.1") /* [1] - port 3000 @ 1 */ /* touches => 2 1 0 / . - , + */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + + PORT_START("KEY.2") /* [1] - port 3000 @ 2 */ /* touches => .. 9 8 7 6 5 4 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 :") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 !") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_START("KEY.3") /* [1] - port 3000 @ 3 */ /* touches => B A .. ? .. = .. ; */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_START("KEY.4") /* [1] - port 3000 @ 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("KEY.5") /* [1] - port 3000 @ 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + + PORT_START("KEY.6") /* [1] - port 3000 @ 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + + PORT_START("KEY.7") /* [1] - port 3000 @ 7 JOYSTICK */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) LEFT") PORT_CODE(KEYCODE_1_PAD) /* Joy(1) on numpad*/ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) RIGHT") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) UP") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) DOWN") PORT_CODE(KEYCODE_2_PAD) + + PORT_START("KEY.8") /* [1] - port 3000 @ 8 not for the real machine, but to emulate the analog signal of the joystick */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) FIRE") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) FIRE") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)+") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)-") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)+") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)-") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/* ROM definition */ +ROM_START( interact ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "interact.rom", 0x0000, 0x0800, CRC(1aa50444) SHA1(405806c97378abcf7c7b0d549430c78c7fc60ba2)) +ROM_END + +ROM_START( hector1 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hector1.rom", 0x0000, 0x1000, CRC(3be6628b) SHA1(1c106d6732bed743d8283d39e5b8248271f18c42)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP(1979, interact, 0, 0, interact, interact, driver_device, 0, "Interact", "Interact Family Computer", MACHINE_IMPERFECT_SOUND) +COMP(1983, hector1, interact, 0, hector1, interact, driver_device, 0, "Micronique", "Hector 1", MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/intv.c b/src/mame/drivers/intv.c new file mode 100644 index 00000000000..023cd6fcc36 --- /dev/null +++ b/src/mame/drivers/intv.c @@ -0,0 +1,752 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,Frank Palazzolo +/************************************************************************ + * Mattel Intellivision + Keyboard Component Drivers + * + * Frank Palazzolo + * Kyle Davis + * + * TBD: + * Add tape support (intvkbd) + * Add runtime tape loading + * Fix memory system workaround + * (memory handler stuff in CP1610, debugger, and shared mem) + * STIC + * reenable dirty support + * Cleanup + * Separate stic & video better, get rid of *2 for kbd comp + * Add better runtime cart loading + * Switch to tilemap system + * Note from kevtris about IntelliVoice Hookup: + the intv uses a special chip + called the SPB640 + it is really cool and lame at the same time + it holds 64 10 bit words, which it simply serializes and sends to the SP0256 + the SP0256-012 just blindly jumps to 02000h or something when you try to play one of the samples + the SPB640 sits at 2000h and when it sees that address come up, it will send out the 640 bits to the '256 + this means you cannot use any gotos/gosubs in your speech data, but that is OK + it's just a single serial stream. the intv simply watches the buffer state and refills it periodically. there's enough buffer to keep it full for 1 frame + that's about it + the samples are stored in the game ROMs, and are easy to extract + +9502, 9503 and 9504 are the chips used in the intv1 (the sears one may use different chips) +9505 is used in some carts +9503 and 9506 are the chips used in the intv2 + +Known roms so far: +RO-3-9502-011 = 4KiB(2Kiw) self-decoding mask rom with decoder & bus, (DIP40 containing 1/2 of EXEC, maps at words 0000-0fff or 1000-1fff [unclear which, guess is 0000], i/o maps at ?), located at U5 on intv1 +RO-3-9503-003 = 2KiB(1Kiw) self-decoding mask rom with decoder & bus, (DIP40 containing GROM, maps at words 0x3000-0x37FF, i/o maps at ?), located at U21 in intv1, U5 in intv2 +RO-3-9504-021 = 4KiB(2Kiw) self-decoding mask rom without decoder or bus, (DIP28 containing 1/2 of EXEC, maps at words 0000-0fff or 1000-1fff [unclear which, guess is 1000]), located at U6 in intv1 +RO-3-9506-010 = 8KiB(4Kiw)+512B(256W) self-decoding mask rom with decoder & bus, (DIP40 containing EXEC2, maps at words 0000-1fff and 0400-04FF, i/o maps at ?) located at U6 in intv2 + +rom types (suspected, not proven yet): +RO-3-9502 = 4KiB (2Kiw) self decoding address mask rom with external address decoder & bus (DIP40) +RO-3-9503 = 2KiB (1Kiw) self decoding address mask rom with external address decoder & bus (DIP40) +RO-3-9504 = 4KiB (2Kiw) self decoding address mask rom without external address decoder or bus (DIP28) +RO-3-9505 = 8KiB (4Kiw) self decoding address mask rom without external address decoder or bus (DIP28) +RO-3-9506 = 8KiB (4Kiw) self decoding address mask rom with external address decoder & bus (DIP40) + + * + ************************************************************************/ + + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "cpu/cp1610/cp1610.h" +#include "includes/intv.h" +#include "sound/ay8910.h" + +#ifndef VERBOSE +#ifdef MAME_DEBUG +#define VERBOSE 1 +#else +#define VERBOSE 0 +#endif +#endif + +static const unsigned char intv_colors[] = +{ + 0x00, 0x00, 0x00, /* BLACK */ + 0x00, 0x2D, 0xFF, /* BLUE */ + 0xFF, 0x3D, 0x10, /* RED */ + 0xC9, 0xCF, 0xAB, /* TAN */ + 0x38, 0x6B, 0x3F, /* DARK GREEN */ + 0x00, 0xA7, 0x56, /* GREEN */ + 0xFA, 0xEA, 0x50, /* YELLOW */ + 0xFF, 0xFC, 0xFF, /* WHITE */ + 0xBD, 0xAC, 0xC8, /* GRAY */ + 0x24, 0xB8, 0xFF, /* CYAN */ + 0xFF, 0xB4, 0x1F, /* ORANGE */ + 0x54, 0x6E, 0x00, /* BROWN */ + 0xFF, 0x4E, 0x57, /* PINK */ + 0xA4, 0x96, 0xFF, /* LIGHT BLUE */ + 0x75, 0xCC, 0x80, /* YELLOW GREEN */ + 0xB5, 0x1A, 0x58 /* PURPLE */ +}; + +PALETTE_INIT_MEMBER(intv_state, intv) +{ + int k = 0; + UINT8 r, g, b; + /* Two copies of everything (why?) */ + + for (int i = 0; i < 16; i++) + { + r = intv_colors[i * 3 + 0]; + g = intv_colors[i * 3 + 1]; + b = intv_colors[i * 3 + 2]; + palette.set_indirect_color(i, rgb_t(r, g, b)); + palette.set_indirect_color(i + 16, rgb_t(r, g, b)); + } + + for (int i = 0; i < 16; i++) + { + for (int j = 0; j < 16; j++) + { + palette.set_pen_indirect(k++, i); + palette.set_pen_indirect(k++, j); + } + } + + for (int i = 0; i < 16; i++) + { + for (int j = 16; j < 32; j++) + { + palette.set_pen_indirect(k++, i); + palette.set_pen_indirect(k++, j); + } + } +} + +/* graphics output */ + +static const gfx_layout intvkbd_charlayout = +{ + 8, 8, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8 * 8 +}; + +static GFXDECODE_START( intvkbd ) + GFXDECODE_ENTRY( "gfx1", 0x0000, intvkbd_charlayout, 0, 256 ) +GFXDECODE_END + +static INPUT_PORTS_START( intv ) + + /* Left Player Controller */ + PORT_START("KEYPAD1") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/Clear") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left/Upper") PORT_PLAYER(1) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Left/Lower-Left") PORT_PLAYER(1) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Left/Lower-Right") PORT_PLAYER(1) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("DISC1") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Left/Up") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Right-Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Left/Right") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Right-Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Left/Down") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Left-Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Left/Left") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Left-Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) + + PORT_START("DISCX1") + PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("Left/X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x01) + + PORT_START("DISCY1") + PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("Left/Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x01) + + /* Right Player Controller */ + PORT_START("KEYPAD2") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/1") + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/2") + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/3") + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/4") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/5") + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/6") + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/7") + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/8") + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/9") + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/Clear") + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/0") + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/Enter") + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Right/Upper") PORT_PLAYER(2) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right/Lower-Left") PORT_PLAYER(2) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Right/Lower-Right") PORT_PLAYER(2) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("DISC2") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Right/Up") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Right-Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Right/Right") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Right-Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Right/Down") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Left-Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Right/Left") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Left-Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) + + PORT_START("DISCX2") + PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("Right/X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x02) + + PORT_START("DISCY2") + PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("Right/Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F) PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x02) + + PORT_START("OPTIONS") + PORT_CONFNAME( 0x01, 0x00, "Left Disc" ) + PORT_CONFSETTING( 0x00, "Digital" ) + PORT_CONFSETTING( 0x01, "Analog" ) + PORT_CONFNAME( 0x02, 0x00, "Right Disc" ) + PORT_CONFSETTING( 0x00, "Digital" ) + PORT_CONFSETTING( 0x02, "Analog" ) +INPUT_PORTS_END + + +/* + Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 + + Row 0 NC NC NC NC NC NC CTRL SHIFT + Row 1 NC NC NC NC NC NC RPT LOCK + Row 2 NC / , N V X NC SPC + Row 3 (right) . M B C Z NC CLS + Row 4 (down) ; K H F S NC TAB + Row 5 ] P I Y R W NC Q + Row 6 (up) - 9 7 5 3 NC 1 + Row 7 = 0 8 6 4 2 NC [ + Row 8 (return)(left) O U T E NC ESC + Row 9 DEL ' L J G D NC A + +2008-05 FP: +The keyboard layout is quite strange, with '[' and ']' at the two ends of the 1st row, +'Esc' in the 2nd row (between 'Tab' and 'Q'), and with Cursor keys and 'Enter' where +you would expect the braces. Moreover, Shift + Cursor keys produce characters. +The emulated layout moves 'Esc', '[' and ']' to their usual position. + +Moreover, a small note on natural keyboard support: currently +- "Clear Screen" is mapped to 'Left Alt' +- "Repeat" is mapped to 'F1' +- "Lock" is mapped to 'F2' +*/ + +static INPUT_PORTS_START( intvkbd ) + PORT_START("ROW0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("ROW1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("ROW2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("ROW3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('>') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clear Screen") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + + PORT_START("ROW4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('\\') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + + PORT_START("ROW5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + + PORT_START("ROW6") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('|') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_CHAR('-') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("ROW7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('O') PORT_CHAR(')') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\xA2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') // this one would be 1st row, 1st key (at 'Esc' position) + + PORT_START("ROW8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // this one would be 2nd row, 2nd key (between 'Tab' and 'Q') + + PORT_START("ROW9") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + + PORT_START("TEST") /* For tape drive testing... */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) + + /* 2008-05 FP: I include here the controller inputs to make happy the read_handler. + Please remove this (and re-tag accordingly the inputs above) if intv_right_control_r + is supposed to scan the keyboard inputs when the Keyboard Component is connected */ + PORT_INCLUDE( intv ) +INPUT_PORTS_END + +static ADDRESS_MAP_START( intv_mem, AS_PROGRAM, 16, intv_state ) + AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) + AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) + AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) + AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) + AM_RANGE(0x0400, 0x04ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom04) + AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000 << 1) // Exec ROM, 10-bits wide + AM_RANGE(0x2000, 0x2fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom20) + AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) // GROM, 8-bits wide + AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM, 8-bits wide + AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM Alias, 8-bits wide + AM_RANGE(0x4000, 0x47ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom40) + AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom48) + AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom50) + AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom60) + AM_RANGE(0x7000, 0x7fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom70) + AM_RANGE(0x8000, 0x8fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom80) + AM_RANGE(0x9000, 0x9fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom90) + AM_RANGE(0xa000, 0xafff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_roma0) + AM_RANGE(0xb000, 0xbfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romb0) + AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romc0) + AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romd0) + AM_RANGE(0xe000, 0xefff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rome0) + AM_RANGE(0xf000, 0xffff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romf0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( intvoice_mem, AS_PROGRAM, 16, intv_state ) + AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) + AM_RANGE(0x0080, 0x0081) AM_DEVREADWRITE("voice", intv_voice_device, read_speech, write_speech) // Intellivoice + AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) + AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) + AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) + AM_RANGE(0x0400, 0x04ff) AM_DEVREAD("voice", intv_voice_device, read_rom04) + AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000 << 1) // Exec ROM, 10-bits wide + AM_RANGE(0x2000, 0x2fff) AM_DEVREAD("voice", intv_voice_device, read_rom20) + AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) // GROM, 8-bits wide + AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM, 8-bits wide + AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM Alias, 8-bits wide + AM_RANGE(0x4000, 0x47ff) AM_DEVREAD("voice", intv_voice_device, read_rom40) + AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("voice", intv_voice_device, read_rom48) + AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("voice", intv_voice_device, read_rom50) + AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("voice", intv_voice_device, read_rom60) + AM_RANGE(0x7000, 0x7fff) AM_DEVREAD("voice", intv_voice_device, read_rom70) + AM_RANGE(0x8000, 0x8fff) AM_DEVREAD("voice", intv_voice_device, read_rom80) + AM_RANGE(0x9000, 0x9fff) AM_DEVREAD("voice", intv_voice_device, read_rom90) + AM_RANGE(0xa000, 0xafff) AM_DEVREAD("voice", intv_voice_device, read_roma0) + AM_RANGE(0xb000, 0xbfff) AM_DEVREAD("voice", intv_voice_device, read_romb0) + AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("voice", intv_voice_device, read_romc0) + AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("voice", intv_voice_device, read_romd0) + AM_RANGE(0xe000, 0xefff) AM_DEVREAD("voice", intv_voice_device, read_rome0) + AM_RANGE(0xf000, 0xffff) AM_DEVREAD("voice", intv_voice_device, read_romf0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( intv2_mem , AS_PROGRAM, 16, intv_state ) + AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) + AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) + AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) + AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) + AM_RANGE(0x0400, 0x04ff) AM_ROM AM_REGION("maincpu", 0x400 << 1) // Exec ROM, 10-bits wide + AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000 << 1) // Exec ROM, 10-bits wide + AM_RANGE(0x2000, 0x2fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom20) + AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) // GROM, 8-bits wide + AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM, 8-bits wide + AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM Alias, 8-bits wide + AM_RANGE(0x4000, 0x47ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom40) + AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom48) + AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom50) + AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom60) + AM_RANGE(0x7000, 0x7fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom70) + AM_RANGE(0x8000, 0x8fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom80) + AM_RANGE(0x9000, 0x9fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom90) + AM_RANGE(0xa000, 0xafff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_roma0) + AM_RANGE(0xb000, 0xbfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romb0) + AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romc0) + AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romd0) + AM_RANGE(0xe000, 0xefff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rome0) + AM_RANGE(0xf000, 0xffff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romf0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( intvecs_mem , AS_PROGRAM, 16, intv_state ) + AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) + AM_RANGE(0x0080, 0x0081) AM_DEVREADWRITE("speech", sp0256_device, spb640_r, spb640_w) /* Intellivoice */ + // AM_RANGE(0x00E0, 0x00E3) AM_READWRITE( intv_ecs_uart_r, intv_ecs_uart_w ) + AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_ay, write_ay) /* ecs psg */ + AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) + AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) + AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) + AM_RANGE(0x0400, 0x04ff) AM_DEVREAD("ecs", intv_ecs_device, read_rom04) + AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000<<1) /* Exec ROM, 10-bits wide */ + AM_RANGE(0x2000, 0x2fff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_rom20, write_rom20) + AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) /* GROM, 8-bits wide */ + AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) /* GRAM, 8-bits wide */ + AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) /* GRAM Alias, 8-bits wide */ + AM_RANGE(0x4000, 0x47ff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_ram, write_ram) + AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom48) + AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom50) + AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom60) + AM_RANGE(0x7000, 0x7fff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_rom70, write_rom70) + AM_RANGE(0x8000, 0x8fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom80) + AM_RANGE(0x9000, 0x9fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom90) + AM_RANGE(0xa000, 0xafff) AM_DEVREAD("ecs", intv_ecs_device, read_roma0) + AM_RANGE(0xb000, 0xbfff) AM_DEVREAD("ecs", intv_ecs_device, read_romb0) + AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("ecs", intv_ecs_device, read_romc0) + AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("ecs", intv_ecs_device, read_romd0) + AM_RANGE(0xe000, 0xefff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_rome0, write_rome0) + AM_RANGE(0xf000, 0xffff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_romf0, write_romf0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( intvkbd_mem , AS_PROGRAM, 16, intv_state ) + AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) + AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) + AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) + AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) + AM_RANGE(0x0400, 0x04ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom04) + AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000<<1) /* Exec ROM, 10-bits wide */ + AM_RANGE(0x2000, 0x2fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom20) + AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) /* GROM, 8-bits wide */ + AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) /* GRAM, 8-bits wide */ + AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) /* GRAM Alias, 8-bits wide */ + AM_RANGE(0x4000, 0x47ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom40) + AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom48) + AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom50) + AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom60) + AM_RANGE(0x7000, 0x7fff) AM_ROM AM_REGION("maincpu", 0x7000<<1) /* Keyboard ROM */ + AM_RANGE(0x8000, 0xbfff) AM_RAM_WRITE(intvkbd_dualport16_w) AM_SHARE("dualport_ram") /* Dual-port RAM */ + AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romc0) + AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romd0) + AM_RANGE(0xe000, 0xefff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rome0) + AM_RANGE(0xf000, 0xffff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romf0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( intvkbd2_mem , AS_PROGRAM, 8, intv_state ) + ADDRESS_MAP_UNMAP_HIGH /* Required because of probing */ + AM_RANGE(0x0000, 0x3fff) AM_READWRITE(intvkbd_dualport8_lsb_r, intvkbd_dualport8_lsb_w) /* Dual-port RAM */ + AM_RANGE(0x4000, 0x7fff) AM_READWRITE(intvkbd_dualport8_msb_r, intvkbd_dualport8_msb_w) /* Dual-port RAM */ + AM_RANGE(0xb7f8, 0xb7ff) AM_RAM /* ??? */ + AM_RANGE(0xb800, 0xbfff) AM_RAM AM_SHARE("videoram") /* Text Display */ + AM_RANGE(0xc000, 0xdfff) AM_ROM + AM_RANGE(0xe000, 0xffff) AM_READ(intvkb_iocart_r) +ADDRESS_MAP_END + +void intv_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_INTV_INTERRUPT2_COMPLETE: + intv_interrupt2_complete(ptr, param); + break; + case TIMER_INTV_INTERRUPT_COMPLETE: + intv_interrupt_complete(ptr, param); + break; + case TIMER_INTV_BTB_FILL: + intv_btb_fill(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in intv_state::device_timer"); + } +} + + +/* This is needed because MAME core does not allow PULSE_LINE. + The time interval is not critical, although it should be below 1000. */ + +TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt2_complete) +{ + m_keyboard->set_input_line(0, CLEAR_LINE); +} + +INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt2) +{ + m_keyboard->set_input_line(0, ASSERT_LINE); + timer_set(m_keyboard->cycles_to_attotime(100), TIMER_INTV_INTERRUPT2_COMPLETE); +} + + +static MACHINE_CONFIG_START( intv, intv_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", CP1610, XTAL_3_579545MHz/4) /* Colorburst/4 */ + MCFG_CPU_PROGRAM_MAP(intv_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", intv_state, intv_interrupt) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_STIC_ADD("stic") + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(59.92) + //MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2400)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(intv_state, screen_update_intv) + MCFG_SCREEN_SIZE((STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTV_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTV_Y_SCALE) + MCFG_SCREEN_VISIBLE_AREA(0, (STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTV_X_SCALE-1, 0, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTV_Y_SCALE-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x400) + MCFG_PALETTE_INDIRECT_ENTRIES(32) + MCFG_PALETTE_INIT_OWNER(intv_state, intv) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay8914", AY8914, XTAL_3_579545MHz/2) + MCFG_AY8910_PORT_A_READ_CB(READ8(intv_state, intv_right_control_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(intv_state, intv_left_control_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) + + /* cartridge */ + MCFG_INTV_CARTRIDGE_ADD("cartslot", intv_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "intv") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ecs_list", "intvecs") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( intv2, intv ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(intv2_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( intvoice, intv ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(intvoice_mem) + + MCFG_DEVICE_REMOVE("cartslot") + MCFG_DEVICE_ADD("voice", INTV_ROM_VOICE, 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( intvecs, intv ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(intvecs_mem) + + MCFG_DEVICE_REMOVE("cartslot") + MCFG_DEVICE_ADD("ecs", INTV_ROM_ECS, 0) + + MCFG_SOUND_ADD("speech", SP0256, 3120000) + /* The Intellivoice uses a speaker with its own volume control so the relative volumes to use are subjective */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* cassette */ + //MCFG_CASSETTE_ADD( "cassette" ) + + /* software lists */ + MCFG_DEVICE_REMOVE("cart_list") + MCFG_DEVICE_REMOVE("ecs_list") + MCFG_SOFTWARE_LIST_ADD("cart_list", "intvecs") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("intv_list", "intv") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( intvkbd, intv ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(intvkbd_mem) + + MCFG_CPU_ADD("keyboard", M6502, XTAL_3_579545MHz/2) /* Colorburst/2 */ + MCFG_CPU_PROGRAM_MAP(intvkbd2_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", intv_state, intv_interrupt2) + + MCFG_QUANTUM_TIME(attotime::from_hz(6000)) + + /* video hardware */ + MCFG_GFXDECODE_ADD("gfxdecode", "palette", intvkbd) + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(intv_state, intv) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE((STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTVKBD_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTVKBD_Y_SCALE) + MCFG_SCREEN_VISIBLE_AREA(0, (STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTVKBD_X_SCALE-1, 0, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTVKBD_Y_SCALE-1) + MCFG_SCREEN_UPDATE_DRIVER(intv_state, screen_update_intvkbd) + + /* I/O cartslots for BASIC */ + MCFG_GENERIC_CARTSLOT_ADD("ioslot1", generic_plain_slot, "intbasic_cart") + MCFG_GENERIC_CARTSLOT_ADD("ioslot2", generic_plain_slot, "intbasic_cart") +MACHINE_CONFIG_END + +ROM_START(intv) // the intv1 exec rom should be two roms: RO-3-9502-011.U5 and RO-3-9504-021.U6 + ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD16_WORD( "exec.bin", (0x1000<<1)+0, 0x2000, CRC(cbce86f7) SHA1(5a65b922b562cb1f57dab51b73151283f0e20c7a)) +ROM_END + +#define rom_intvoice rom_intv + +// the later intellivision 2's exec rom is a single ro-3-9506-010 at location ic6 holding 8k plus 512 bytes; the 1st 512 bytes are at 0x400 and the 8k at 0x1000 +ROM_START(intv2) + ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD16_WORD_SWAP( "ro-3-9506-010.ic6", (0x400<<1)+0, 0x200, CRC(dd7e1237) SHA1(fb821a643b7714ed4c812553cd3f668766fd44ab)) + ROM_CONTINUE( (0x1000<<1)+0, 0x2000 ) +ROM_END + +ROM_START(intvsrs) // the intv1 sears exec rom should be two roms: RO-3-9502-???.U5 and RO-3-9504-???.U6 but the correct names are unknown as of yet + ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD16_WORD( "searsexc.bin", (0x1000<<1)+0, 0x2000, CRC(ea552a22) SHA1(834339de056d42a35571cae7fd5b04d1344001e9)) +ROM_END + +ROM_START(intvecs) // the intv1 exec rom should be two roms: RO-3-9502-011.U5 and RO-3-9504-021.U6 + ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD16_WORD( "exec.bin", (0x1000<<1)+0, 0x2000, CRC(cbce86f7) SHA1(5a65b922b562cb1f57dab51b73151283f0e20c7a)) + + ROM_REGION( 0x10000<<1, "speech", 0 ) + /* SP0256-012 Speech chip w/2KiB mask rom */ + ROM_LOAD( "sp0256-012.bin", 0x1000, 0x0800, CRC(0de7579d) SHA1(618563e512ff5665183664f52270fa9606c9d289) ) +ROM_END + +/* +Intellivision Keyboard Component - Prototype +------------------------------------------------------------- + +GI 9333B-0104 0104.U20 4Kx8 Mask ROM, 6502 code +Intel 2732 "CPU 2D" CPU2D.U21 4Kx8 EPROM, 6502 code + +TI 8S030N 1149-0360 0360.U58 32x8 Timing prom? +TI 8S030N 1149-0370 0370.U74 32x8 Timing prom? + +GI RO-3-9502-024 024.U60 2Kx10 Mask ROM+Addr Decoder, CP1600 code +GI 9316B-4D72 4D72.U62 2Kx8 Mask ROM, CP1600 code (upper) +GI 9316B-4D71 4D71.U63 2Kx8 Mask ROM, CP1600 code (lower) +GI 9316B-4C52 4C52.U34 2Kx8 Mask ROM, Alphanumerics + +Main board also includes: + + 2 2114 DRAMS 1Kx4 Character memory + 10 MM5290J DRAMS 16Kx10 CP1600 memory? + 1 6502 + 1 Mystery 40-pin chip (under heat sink) + (actually a SMC CRT5027 aka TI TMS9927 CRT controller) +*/ + +ROM_START(intvkbd) // the intv1 exec rom should be two roms: RO-3-9502-011.U5 and RO-3-9504-021.U6 + ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD16_WORD( "exec.bin", 0x1000<<1, 0x2000, CRC(cbce86f7) SHA1(5a65b922b562cb1f57dab51b73151283f0e20c7a)) + ROM_LOAD16_WORD( "024.u60", 0x7000<<1, 0x1000, CRC(4f7998ec) SHA1(ec006d0ae9002e9d56d83a71f5f2eddd6a456a40)) + ROM_LOAD16_BYTE( "4d72.u62", 0x7800<<1, 0x0800, CRC(aa57c594) SHA1(741860d489d90f5882ca53daa3169b6abacdf130)) + ROM_LOAD16_BYTE( "4d71.u63", (0x7800<<1)+1, 0x0800, CRC(069b2f0b) SHA1(070850bb32f8474107cc52c5183cfaa32d640f9a)) + + ROM_REGION(0x10000,"keyboard",0) + ROM_LOAD( "0104.u20", 0xc000, 0x1000, CRC(5c6f1256) SHA1(271931fb354dfae6a1a5697ee888924a89a15ca8)) + ROM_RELOAD( 0xe000, 0x1000 ) + ROM_LOAD("cpu2d.u21", 0xd000, 0x1000, CRC(2c2dba33) SHA1(0db5d177fec3f8ae89abeef2e6900ad4f3460266)) + ROM_RELOAD( 0xf000, 0x1000 ) + + ROM_REGION(0x00800,"gfx1",0) + ROM_LOAD( "4c52.u34", 0x0000, 0x0800, CRC(cbeb2e96) SHA1(f0e17adcd278fb376c9f90833c7fbbb60193dbe3)) + + ROM_REGION(0x0100,"proms",0) + ROM_LOAD( "0360.u58", 0x00, 0x20, CRC(1295528a) SHA1(b35e598891f1185e02cbacb4811d2334357abd79)) + ROM_LOAD( "0370.u74", 0x20, 0x20, CRC(19da5096) SHA1(76af50e4fd29649fc4837120c245321a8fc84cd3)) +ROM_END + +DRIVER_INIT_MEMBER(intv_state,intv) +{ + m_stic->set_x_scale(INTV_X_SCALE); + m_stic->set_y_scale(INTV_Y_SCALE); + m_is_keybd = 0; +} + +DRIVER_INIT_MEMBER(intv_state,intvkbd) +{ + m_stic->set_x_scale(INTVKBD_X_SCALE); + m_stic->set_y_scale(INTVKBD_Y_SCALE); + m_is_keybd = 1; +} + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1979, intv, 0, 0, intv, intv, intv_state, intv, "Mattel", "Intellivision", MACHINE_SUPPORTS_SAVE ) +CONS( 1981, intvsrs, intv, 0, intv, intv, intv_state, intv, "Sears", "Super Video Arcade", MACHINE_SUPPORTS_SAVE ) +COMP( 1981, intvkbd, intv, 0, intvkbd, intvkbd, intv_state, intvkbd, "Mattel", "Intellivision Keyboard Component (Unreleased)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +CONS( 1982, intv2, intv, 0, intv2, intv, intv_state, intv, "Mattel", "Intellivision II", MACHINE_SUPPORTS_SAVE ) + +// made up, user friendlier machines with pre-mounted passthu expansions +COMP( 1982, intvoice, intv, 0, intvoice, intv, intv_state, intv, "Mattel", "Intellivision w/IntelliVoice expansion", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, intvecs, intv, 0, intvecs, intv, intv_state, intv, "Mattel", "Intellivision w/Entertainment Computer System + Intellivoice expansions", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/ip20.c b/src/mame/drivers/ip20.c new file mode 100644 index 00000000000..b03fb978c78 --- /dev/null +++ b/src/mame/drivers/ip20.c @@ -0,0 +1,632 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/*********************************************************************\ +* +* SGI IP20 IRIS Indigo workstation +* +* Skeleton Driver +* +* Todo: Everything +* +* Note: Machine uses R4400, not R4600 +* +* Memory map: +* +* 1fa00000 - 1fa02047 Memory Controller +* 1fb80000 - 1fb9a7ff HPC1 CHIP0 +* 1fc00000 - 1fc7ffff BIOS +* +\*********************************************************************/ + +#include "emu.h" +#include "cpu/mips/mips3.h" +#include "machine/8530scc.h" +#include "machine/sgi.h" +#include "machine/eepromser.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsicd.h" +#include "machine/wd33c93.h" + +struct HPC_t +{ + UINT8 nMiscStatus; + UINT32 nParBufPtr; + UINT32 nLocalIOReg0Mask; + UINT32 nLocalIOReg1Mask; + UINT32 nVMEIntMask0; + UINT32 nVMEIntMask1; + UINT32 nSCSI0Descriptor; + UINT32 nSCSI0DMACtrl; +}; + +struct ip20_RTC_t +{ + UINT8 nRAM[32]; + UINT8 nTemp; +}; + +class ip20_state : public driver_device +{ +public: + enum + { + TIMER_RTC + }; + + ip20_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_wd33c93(*this, "wd33c93"), + m_scc(*this, "scc"), + m_eeprom(*this, "eeprom"), + m_maincpu(*this, "maincpu") + { + } + + HPC_t m_HPC; + ip20_RTC_t m_RTC; + DECLARE_READ32_MEMBER(hpc_r); + DECLARE_WRITE32_MEMBER(hpc_w); + DECLARE_READ32_MEMBER(int_r); + DECLARE_WRITE32_MEMBER(int_w); + DECLARE_WRITE_LINE_MEMBER(scsi_irq); + DECLARE_DRIVER_INIT(ip204415); + virtual void machine_start(); + virtual void video_start(); + UINT32 screen_update_ip204415(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(ip20_timer_rtc); + required_device m_wd33c93; + required_device m_scc; + required_device m_eeprom; + inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... ); + required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +#define VERBOSE_LEVEL ( 2 ) + +inline void ATTR_PRINTF(3,4) ip20_state::verboselog(int n_level, const char *s_fmt, ... ) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%08x: %s", m_maincpu->pc(), buf ); + } +} + +void ip20_state::video_start() +{ +} + +UINT32 ip20_state::screen_update_ip204415(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + + +#define RTC_DAYOFWEEK m_RTC.nRAM[0x0e] +#define RTC_YEAR m_RTC.nRAM[0x0b] +#define RTC_MONTH m_RTC.nRAM[0x0a] +#define RTC_DAY m_RTC.nRAM[0x09] +#define RTC_HOUR m_RTC.nRAM[0x08] +#define RTC_MINUTE m_RTC.nRAM[0x07] +#define RTC_SECOND m_RTC.nRAM[0x06] +#define RTC_HUNDREDTH m_RTC.nRAM[0x05] + +READ32_MEMBER(ip20_state::hpc_r) +{ + offset <<= 2; + if( offset >= 0x0e00 && offset <= 0x0e7c ) + { + verboselog(2, "RTC RAM[0x%02x] Read: %02x\n", ( offset - 0xe00 ) >> 2, m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ] ); + return m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ]; + } + switch( offset ) + { + case 0x05c: + verboselog(2, "HPC Unknown Read: %08x (%08x) (returning 0x000000a5 as kludge)\n", 0x1fb80000 + offset, mem_mask ); + return 0x0000a500; + case 0x00ac: + verboselog(2, "HPC Parallel Buffer Pointer Read: %08x (%08x)\n", m_HPC.nParBufPtr, mem_mask ); + return m_HPC.nParBufPtr; + case 0x00c0: + verboselog(2, "HPC Endianness Read: %08x (%08x)\n", 0x0000001f, mem_mask ); + return 0x0000001f; + case 0x0120: + if (ACCESSING_BITS_8_15) + { + return ( m_wd33c93->read( space, 0 ) << 8 ); + } + else + { + return 0; + } + case 0x0124: + if (ACCESSING_BITS_8_15) + { + return ( m_wd33c93->read( space, 1 ) << 8 ); + } + else + { + return 0; + } + case 0x01b0: + verboselog(2, "HPC Misc. Status Read: %08x (%08x)\n", m_HPC.nMiscStatus, mem_mask ); + return m_HPC.nMiscStatus; + case 0x01bc: +// verboselog(machine, 2, "HPC CPU Serial EEPROM Read\n" ); + return m_eeprom->do_read() << 4; + case 0x01c4: + verboselog(2, "HPC Local IO Register 0 Mask Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask ); + return m_HPC.nLocalIOReg0Mask; + case 0x01cc: + verboselog(2, "HPC Local IO Register 1 Mask Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask ); + return m_HPC.nLocalIOReg1Mask; + case 0x01d4: + verboselog(2, "HPC VME Interrupt Mask 0 Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask ); + return m_HPC.nVMEIntMask0; + case 0x01d8: + verboselog(2, "HPC VME Interrupt Mask 1 Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask ); + return m_HPC.nVMEIntMask1; + case 0x0d00: + verboselog(2, "HPC DUART0 Channel B Control Read\n" ); +// return 0x00000004; + return 0x7c; //m_scc->reg_r(space, 0); + case 0x0d04: + verboselog(2, "HPC DUART0 Channel B Data Read\n" ); +// return 0; + return m_scc->reg_r(space, 2); + case 0x0d08: + verboselog(2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask ); +// return 0x40; + return 0x7c; //m_scc->reg_r(space, 1); + case 0x0d0c: + verboselog(2, "HPC DUART0 Channel A Data Read\n" ); +// return 0; + return m_scc->reg_r(space, 3); + case 0x0d10: +// verboselog(machine, 2, "HPC DUART1 Channel B Control Read\n" ); + return 0x00000004; + case 0x0d14: + verboselog(2, "HPC DUART1 Channel B Data Read\n" ); + return 0; + case 0x0d18: + verboselog(2, "HPC DUART1 Channel A Control Read\n" ); + return 0; + case 0x0d1c: + verboselog(2, "HPC DUART1 Channel A Data Read\n" ); + return 0; + case 0x0d20: + verboselog(2, "HPC DUART2 Channel B Control Read\n" ); + return 0x00000004; + case 0x0d24: + verboselog(2, "HPC DUART2 Channel B Data Read\n" ); + return 0; + case 0x0d28: + verboselog(2, "HPC DUART2 Channel A Control Read\n" ); + return 0; + case 0x0d2c: + verboselog(2, "HPC DUART2 Channel A Data Read\n" ); + return 0; + case 0x0d30: + verboselog(2, "HPC DUART3 Channel B Control Read\n" ); + return 0x00000004; + case 0x0d34: + verboselog(2, "HPC DUART3 Channel B Data Read\n" ); + return 0; + case 0x0d38: + verboselog(2, "HPC DUART3 Channel A Control Read\n" ); + return 0; + case 0x0d3c: + verboselog(2, "HPC DUART3 Channel A Data Read\n" ); + return 0; + } + verboselog(0, "Unmapped HPC read: 0x%08x (%08x)\n", 0x1fb80000 + offset, mem_mask ); + return 0; +} + +WRITE32_MEMBER(ip20_state::hpc_w) +{ + offset <<= 2; + if( offset >= 0x0e00 && offset <= 0x0e7c ) + { + verboselog(2, "RTC RAM[0x%02x] Write: %02x\n", ( offset - 0xe00 ) >> 2, data & 0x000000ff ); + m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ] = data & 0x000000ff; + switch( ( offset - 0xe00 ) >> 2 ) + { + case 0: + break; + case 4: + if( !( m_RTC.nRAM[0x00] & 0x80 ) ) + { + if( data & 0x80 ) + { + m_RTC.nRAM[0x19] = m_RTC.nRAM[0x06]; //RTC_SECOND; + m_RTC.nRAM[0x1a] = m_RTC.nRAM[0x07]; //RTC_MINUTE; + m_RTC.nRAM[0x1b] = m_RTC.nRAM[0x08]; //RTC_HOUR; + m_RTC.nRAM[0x1c] = m_RTC.nRAM[0x09]; //RTC_DAY; + m_RTC.nRAM[0x1d] = m_RTC.nRAM[0x0a]; //RTC_MONTH; + } + } + break; + } + return; + } + switch( offset ) + { + case 0x0090: // SCSI0 next descriptor pointer + m_HPC.nSCSI0Descriptor = data; + break; + + case 0x0094: // SCSI0 control flags + m_HPC.nSCSI0DMACtrl = data; + #if 0 + if (data & 0x80) + { + UINT32 next; + + osd_printf_info("DMA activated for SCSI0\n"); + osd_printf_info("Descriptor block:\n"); + osd_printf_info("CTL: %08x BUFPTR: %08x DESCPTR %08x\n", + program_read_dword(m_HPC.nSCSI0Descriptor), program_read_dword(m_HPC.nSCSI0Descriptor+4), + program_read_dword(m_HPC.nSCSI0Descriptor+8)); + + next = program_read_dword(m_HPC.nSCSI0Descriptor+8); + osd_printf_info("CTL: %08x BUFPTR: %08x DESCPTR %08x\n", + program_read_dword(next), program_read_dword(next+4), + program_read_dword(next+8)); + } + #endif + break; + + case 0x00ac: + verboselog(2, "HPC Parallel Buffer Pointer Write: %08x (%08x)\n", data, mem_mask ); + m_HPC.nParBufPtr = data; + break; + case 0x0120: + if (ACCESSING_BITS_8_15) + { + verboselog(2, "HPC SCSI Controller Register Write: %08x\n", ( data >> 8 ) & 0x000000ff ); + m_wd33c93->write( space, 0, ( data >> 8 ) & 0x000000ff ); + } + else + { + return; + } + break; + case 0x0124: + if (ACCESSING_BITS_8_15) + { + verboselog(2, "HPC SCSI Controller Data Write: %08x\n", ( data >> 8 ) & 0x000000ff ); + m_wd33c93->write( space, 1, ( data >> 8 ) & 0x000000ff ); + } + else + { + return; + } + break; + case 0x01b0: + verboselog(2, "HPC Misc. Status Write: %08x (%08x)\n", data, mem_mask ); + if( data & 0x00000001 ) + { + verboselog(2, " Force DSP hard reset\n" ); + } + if( data & 0x00000002 ) + { + verboselog(2, " Force IRQA\n" ); + } + if( data & 0x00000004 ) + { + verboselog(2, " Set IRQA polarity high\n" ); + } + else + { + verboselog(2, " Set IRQA polarity low\n" ); + } + if( data & 0x00000008 ) + { + verboselog(2, " SRAM size: 32K\n" ); + } + else + { + verboselog(2, " SRAM size: 8K\n" ); + } + m_HPC.nMiscStatus = data; + break; + case 0x01bc: +// verboselog(machine, 2, "HPC CPU Serial EEPROM Write: %08x (%08x)\n", data, mem_mask ); + if( data & 0x00000001 ) + { + verboselog(2, " CPU board LED on\n" ); + } + m_eeprom->di_write((data & 0x00000008) ? 1 : 0 ); + m_eeprom->cs_write((data & 0x00000002) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->clk_write((data & 0x00000004) ? CLEAR_LINE : ASSERT_LINE ); + break; + case 0x01c4: + verboselog(2, "HPC Local IO Register 0 Mask Write: %08x (%08x)\n", data, mem_mask ); + m_HPC.nLocalIOReg0Mask = data; + break; + case 0x01cc: + verboselog(2, "HPC Local IO Register 1 Mask Write: %08x (%08x)\n", data, mem_mask ); + m_HPC.nLocalIOReg1Mask = data; + break; + case 0x01d4: + verboselog(2, "HPC VME Interrupt Mask 0 Write: %08x (%08x)\n", data, mem_mask ); + m_HPC.nVMEIntMask0 = data; + break; + case 0x01d8: + verboselog(2, "HPC VME Interrupt Mask 1 Write: %08x (%08x)\n", data, mem_mask ); + m_HPC.nVMEIntMask1 = data; + break; + case 0x0d00: + verboselog(2, "HPC DUART0 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); + m_scc->reg_w(space, 0, data); + break; + case 0x0d04: + verboselog(2, "HPC DUART0 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); + m_scc->reg_w(space, 2, data); + break; + case 0x0d08: + verboselog(2, "HPC DUART0 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); + m_scc->reg_w(space, 1, data); + break; + case 0x0d0c: + verboselog(2, "HPC DUART0 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); + m_scc->reg_w(space, 3, data); + break; + case 0x0d10: + if( ( data & 0x000000ff ) >= 0x00000020 ) + { +// verboselog(2, "HPC DUART1 Channel B Control Write: %08x (%08x) %c\n", data, mem_mask, data & 0x000000ff ); + //osd_printf_info( "%c", data & 0x000000ff ); + } + else + { +// verboselog(2, "HPC DUART1 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); + } + break; + case 0x0d14: + if( ( data & 0x000000ff ) >= 0x00000020 || ( data & 0x000000ff ) == 0x0d || ( data & 0x000000ff ) == 0x0a ) + { + verboselog(2, "HPC DUART1 Channel B Data Write: %08x (%08x) %c\n", data, mem_mask, data & 0x000000ff ); + osd_printf_info( "%c", data & 0x000000ff ); + } + else + { + verboselog(2, "HPC DUART1 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); + } + break; + case 0x0d18: + osd_printf_info("HPC DUART1 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d1c: + verboselog(2, "HPC DUART1 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d20: + osd_printf_info("HPC DUART2 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d24: + verboselog(2, "HPC DUART2 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d28: + osd_printf_info("HPC DUART2 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d2c: + verboselog(2, "HPC DUART2 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d30: + osd_printf_info("HPC DUART3 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d34: + verboselog(2, "HPC DUART3 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d38: + osd_printf_info("HPC DUART3 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); + break; + case 0x0d3c: + verboselog(2, "HPC DUART3 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); + break; + default: + osd_printf_info("Unmapped HPC write: 0x%08x (%08x): %08x\n", 0x1fb80000 + offset, mem_mask, data); + break; + } +} + +// INT/INT2/INT3 interrupt controllers +READ32_MEMBER(ip20_state::int_r) +{ + osd_printf_info("INT: read @ ofs %x (mask %x) (PC=%x)\n", offset, mem_mask, space.device().safe_pc()); + return 0; +} + +WRITE32_MEMBER(ip20_state::int_w) +{ + osd_printf_info("INT: write %x to ofs %x (mask %x) (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); +} + +static ADDRESS_MAP_START( ip204415_map, AS_PROGRAM, 32, ip20_state ) + AM_RANGE( 0x00000000, 0x001fffff ) AM_RAM AM_SHARE("share10") + AM_RANGE( 0x08000000, 0x08ffffff ) AM_RAM AM_SHARE("share5") + AM_RANGE( 0x09000000, 0x097fffff ) AM_RAM AM_SHARE("share6") + AM_RANGE( 0x0a000000, 0x0a7fffff ) AM_RAM AM_SHARE("share7") + AM_RANGE( 0x0c000000, 0x0c7fffff ) AM_RAM AM_SHARE("share8") + AM_RANGE( 0x10000000, 0x107fffff ) AM_RAM AM_SHARE("share9") + AM_RANGE( 0x18000000, 0x187fffff ) AM_RAM AM_SHARE("share1") + AM_RANGE( 0x1fa00000, 0x1fa1ffff ) AM_DEVREADWRITE("sgi_mc", sgi_mc_device, read, write ) + AM_RANGE( 0x1fb80000, 0x1fb8ffff ) AM_READWRITE(hpc_r, hpc_w ) + AM_RANGE( 0x1fbd9000, 0x1fbd903f ) AM_READWRITE(int_r, int_w ) + AM_RANGE( 0x1fc00000, 0x1fc7ffff ) AM_ROM AM_SHARE("share2") AM_REGION( "user1", 0 ) + AM_RANGE( 0x80000000, 0x801fffff ) AM_RAM AM_SHARE("share10") + AM_RANGE( 0x88000000, 0x88ffffff ) AM_RAM AM_SHARE("share5") + AM_RANGE( 0xa0000000, 0xa01fffff ) AM_RAM AM_SHARE("share10") + AM_RANGE( 0xa8000000, 0xa8ffffff ) AM_RAM AM_SHARE("share5") + AM_RANGE( 0xa9000000, 0xa97fffff ) AM_RAM AM_SHARE("share6") + AM_RANGE( 0xaa000000, 0xaa7fffff ) AM_RAM AM_SHARE("share7") + AM_RANGE( 0xac000000, 0xac7fffff ) AM_RAM AM_SHARE("share8") + AM_RANGE( 0xb0000000, 0xb07fffff ) AM_RAM AM_SHARE("share9") + AM_RANGE( 0xb8000000, 0xb87fffff ) AM_RAM AM_SHARE("share1") + AM_RANGE( 0xbfa00000, 0xbfa1ffff ) AM_DEVREADWRITE("sgi_mc", sgi_mc_device, read, write ) + AM_RANGE( 0xbfb80000, 0xbfb8ffff ) AM_READWRITE(hpc_r, hpc_w ) + AM_RANGE( 0xbfbd9000, 0xbfbd903f ) AM_READWRITE(int_r, int_w ) + AM_RANGE( 0xbfc00000, 0xbfc7ffff ) AM_ROM AM_SHARE("share2") /* BIOS Mirror */ +ADDRESS_MAP_END + +WRITE_LINE_MEMBER(ip20_state::scsi_irq) +{ +} + +DRIVER_INIT_MEMBER(ip20_state,ip204415) +{ +} + +void ip20_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_RTC: + ip20_timer_rtc(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in ip20_state::device_timer"); + } +} + +TIMER_CALLBACK_MEMBER(ip20_state::ip20_timer_rtc) +{ + // update RTC every 10 milliseconds + m_RTC.nTemp++; + if (m_RTC.nTemp >= 10) + { + m_RTC.nTemp = 0; + RTC_HUNDREDTH++; + + if( ( RTC_HUNDREDTH & 0x0f ) == 0x0a ) + { + RTC_HUNDREDTH -= 0x0a; + RTC_HUNDREDTH += 0x10; + if( ( RTC_HUNDREDTH & 0xa0 ) == 0xa0 ) + { + RTC_HUNDREDTH = 0; + RTC_SECOND++; + + if( ( RTC_SECOND & 0x0f ) == 0x0a ) + { + RTC_SECOND -= 0x0a; + RTC_SECOND += 0x10; + if( RTC_SECOND == 0x60 ) + { + RTC_SECOND = 0; + RTC_MINUTE++; + + if( ( RTC_MINUTE & 0x0f ) == 0x0a ) + { + RTC_MINUTE -= 0x0a; + RTC_MINUTE += 0x10; + if( RTC_MINUTE == 0x60 ) + { + RTC_MINUTE = 0; + RTC_HOUR++; + + if( ( RTC_HOUR & 0x0f ) == 0x0a ) + { + RTC_HOUR -= 0x0a; + RTC_HOUR += 0x10; + if( RTC_HOUR == 0x24 ) + { + RTC_HOUR = 0; + RTC_DAY++; + } + } + } + } + } + } + } + } + } + + timer_set(attotime::from_msec(1), TIMER_RTC); +} + +void ip20_state::machine_start() +{ + m_HPC.nMiscStatus = 0; + m_HPC.nParBufPtr = 0; + m_HPC.nLocalIOReg0Mask = 0; + m_HPC.nLocalIOReg1Mask = 0; + m_HPC.nVMEIntMask0 = 0; + m_HPC.nVMEIntMask1 = 0; + + m_RTC.nTemp = 0; + + timer_set(attotime::from_msec(1), TIMER_RTC); +} + +static INPUT_PORTS_START( ip204415 ) + PORT_START("unused") + PORT_BIT ( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +#if 0 +static const mips3_config config = +{ + 32768, /* code cache size */ + 32768 /* data cache size */ +}; +#endif + +static MACHINE_CONFIG_FRAGMENT( cdrom_config ) + MCFG_DEVICE_MODIFY( "cdda" ) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "^^^^mono", 1.0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ip204415, ip20_state ) + MCFG_CPU_ADD( "maincpu", R4600BE, 50000000*3 ) + MCFG_CPU_CONFIG( config ) + MCFG_CPU_PROGRAM_MAP( ip204415_map) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE( 60 ) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(800, 600) + MCFG_SCREEN_VISIBLE_AREA(0, 799, 0, 599) + MCFG_SCREEN_UPDATE_DRIVER(ip20_state, screen_update_ip204415) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 65536) + + + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_DEVICE_ADD("scc", SCC8530, 7000000) + + MCFG_DEVICE_ADD("sgi_mc", SGI_MC, 0) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_6) + MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config) + + MCFG_DEVICE_ADD("wd33c93", WD33C93, 0) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_WD33C93_IRQ_CB(WRITELINE(ip20_state, scsi_irq)) /* command completion IRQ */ + + MCFG_EEPROM_SERIAL_93C56_ADD("eeprom") +MACHINE_CONFIG_END + +ROM_START( ip204415 ) + ROM_REGION( 0x80000, "user1", 0 ) + ROM_LOAD( "ip204415.bin", 0x000000, 0x080000, CRC(940d960e) SHA1(596aba530b53a147985ff3f6f853471ce48c866c) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1993, ip204415, 0, 0, ip204415, ip204415, ip20_state, ip204415, "Silicon Graphics Inc", "IRIS Indigo (R4400, 150MHz)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/ip22.c b/src/mame/drivers/ip22.c new file mode 100644 index 00000000000..2ea0ea03fd6 --- /dev/null +++ b/src/mame/drivers/ip22.c @@ -0,0 +1,1675 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/*********************************************************************\ +* +* SGI IP22 Indigo2/Indy workstation +* +* Todo: Fix tod clock set problem +* Fix NVRAM saving +* Fix SCSI DMA to handle chains properly +* Probably many more things +* +* Memory map: +* +* 18000000 - 1effffff RESERVED - Unused +* 1f000000 - 1f3fffff GIO - GFX +* 1f400000 - 1f5fffff GIO - EXP0 +* 1f600000 - 1f9fffff GIO - EXP1 - Unused +* 1fa00000 - 1fa02047 Memory Controller +* 1fb00000 - 1fb1a7ff HPC3 CHIP1 +* 1fb80000 - 1fb9a7ff HPC3 CHIP0 +* 1fc00000 - 1fc7ffff BIOS +* +* References used: +* MipsLinux: http://www.mips-linux.org/ +* linux-2.6.6/include/newport.h +* linux-2.6.6/include/asm-mips/sgi/gio.h +* linux-2.6.6/include/asm-mips/sgi/mc.h +* linux-2.6.6/include/asm-mips/sgi/hpc3.h +* NetBSD: http://www.netbsd.org/ +* gxemul: http://gavare.se/gxemul/ +* +* Gentoo LiveCD r5 boot instructions: +* mess -cdrom gentoor5.chd ip225015 +* enter the command interpreter and type "sashARCS". press enter and +* it'll autoboot. +* +* IRIX boot instructions: +* mess -cdrom irix656inst1.chd ip225015 +* at the menu, choose either "run diagnostics" or "install system software" +* +\*********************************************************************/ + +#include "emu.h" +#include "cpu/mips/mips3.h" +#include "sound/cdda.h" +#include "machine/sgi.h" +#include "machine/pckeybrd.h" +#include "machine/pc_lpt.h" +#include "includes/at.h" +#include "machine/8042kbdc.h" +#include "machine/pit8253.h" +#include "video/newport.h" +#include "sound/dac.h" +#include "machine/nvram.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsicd.h" +#include "bus/scsi/scsihd.h" +#include "machine/wd33c93.h" + +struct RTC_t +{ + UINT8 nRegs[0x80]; + UINT8 nUserRAM[0x200]; + UINT8 nRAM[0x800]; +}; + +struct HPC3_t +{ + UINT32 nenetr_nbdp; + UINT32 nenetr_cbp; + UINT32 nunk0; + UINT32 nunk1; + UINT32 nIC_Unk0; + UINT32 nSCSI0Descriptor; + UINT32 nSCSI0DMACtrl; +}; + +struct HAL2_t +{ + UINT32 nIAR; + UINT32 nIDR[4]; +}; + +struct PBUS_DMA_t +{ + UINT8 nActive; + UINT32 nCurPtr; + UINT32 nDescPtr; + UINT32 nNextPtr; + UINT32 nWordsLeft; +}; + +class ip22_state : public driver_device +{ +public: + enum + { + TIMER_IP22_DMA, + TIMER_IP22_MSEC + }; + + ip22_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_wd33c93(*this, "wd33c93"), + m_unkpbus0(*this, "unkpbus0"), + m_mainram(*this, "mainram"), + m_lpt0(*this, "lpt_0"), + m_pit(*this, "pit8254"), + m_sgi_mc(*this, "sgi_mc"), + m_newport(*this, "newport"), + m_dac(*this, "dac"), + m_kbdc8042(*this, "kbdc") + { + } + + required_device m_maincpu; + required_device m_wd33c93; + required_shared_ptr m_unkpbus0; + required_shared_ptr m_mainram; + required_device m_lpt0; + required_device m_pit; + required_device m_sgi_mc; + required_device m_newport; + required_device m_dac; + required_device m_kbdc8042; + + RTC_t m_RTC; + UINT32 m_int3_regs[64]; + UINT32 m_nIOC_ParReadCnt; + /*UINT8 m_nIOC_ParCntl;*/ + HPC3_t m_HPC3; + HAL2_t m_HAL2; + PBUS_DMA_t m_PBUS_DMA; + UINT32 m_nIntCounter; + UINT8 m_dma_buffer[4096]; + DECLARE_READ32_MEMBER(hpc3_pbus6_r); + DECLARE_WRITE32_MEMBER(hpc3_pbus6_w); + DECLARE_READ32_MEMBER(hpc3_hd_enet_r); + DECLARE_WRITE32_MEMBER(hpc3_hd_enet_w); + DECLARE_READ32_MEMBER(hpc3_hd0_r); + DECLARE_WRITE32_MEMBER(hpc3_hd0_w); + DECLARE_READ32_MEMBER(hpc3_pbus4_r); + DECLARE_WRITE32_MEMBER(hpc3_pbus4_w); + DECLARE_READ32_MEMBER(rtc_r); + DECLARE_WRITE32_MEMBER(rtc_w); + DECLARE_WRITE32_MEMBER(ip22_write_ram); + DECLARE_READ32_MEMBER(hal2_r); + DECLARE_WRITE32_MEMBER(hal2_w); + DECLARE_READ32_MEMBER(hpc3_pbusdma_r); + DECLARE_WRITE32_MEMBER(hpc3_pbusdma_w); + DECLARE_READ32_MEMBER(hpc3_unkpbus0_r); + DECLARE_WRITE32_MEMBER(hpc3_unkpbus0_w); + DECLARE_WRITE_LINE_MEMBER(scsi_irq); + DECLARE_DRIVER_INIT(ip225015); + virtual void machine_start(); + virtual void machine_reset(); + INTERRUPT_GEN_MEMBER(ip22_vbl); + TIMER_CALLBACK_MEMBER(ip22_dma); + TIMER_CALLBACK_MEMBER(ip22_timer); + inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... ); + void int3_raise_local0_irq(UINT8 source_mask); + void int3_lower_local0_irq(UINT8 source_mask); + void int3_raise_local1_irq(UINT8 source_mask); + void int3_lower_local1_irq(UINT8 source_mask); + void dump_chain(address_space &space, UINT32 ch_base); + void rtc_update(); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +#define VERBOSE_LEVEL ( 0 ) + + +inline void ATTR_PRINTF(3,4) ip22_state::verboselog(int n_level, const char *s_fmt, ... ) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror("%08x: %s", m_maincpu->pc(), buf); + } +} + + +#define RTC_DAY m_RTC.nRAM[0x09] +#define RTC_HOUR m_RTC.nRAM[0x08] +#define RTC_MINUTE m_RTC.nRAM[0x07] +#define RTC_SECOND m_RTC.nRAM[0x06] +#define RTC_HUNDREDTH m_RTC.nRAM[0x05] + +// interrupt sources handled by INT3 +#define INT3_LOCAL0_FIFO (0x01) +#define INT3_LOCAL0_SCSI0 (0x02) +#define INT3_LOCAL0_SCSI1 (0x04) +#define INT3_LOCAL0_ETHERNET (0x08) +#define INT3_LOCAL0_MC_DMA (0x10) +#define INT3_LOCAL0_PARALLEL (0x20) +#define INT3_LOCAL0_GRAPHICS (0x40) +#define INT3_LOCAL0_MAPPABLE0 (0x80) + +#define INT3_LOCAL1_GP0 (0x01) +#define INT3_LOCAL1_PANEL (0x02) +#define INT3_LOCAL1_GP2 (0x04) +#define INT3_LOCAL1_MAPPABLE1 (0x08) +#define INT3_LOCAL1_HPC_DMA (0x10) +#define INT3_LOCAL1_AC_FAIL (0x20) +#define INT3_LOCAL1_VSYNC (0x40) +#define INT3_LOCAL1_RETRACE (0x80) + +// raise a local0 interrupt +void ip22_state::int3_raise_local0_irq(UINT8 source_mask) +{ + // signal the interrupt is pending + m_int3_regs[0] |= source_mask; + + // if it's not masked, also assert it now at the CPU + if (m_int3_regs[1] & source_mask) + m_maincpu->set_input_line(MIPS3_IRQ0, ASSERT_LINE); +} + +// lower a local0 interrupt +void ip22_state::int3_lower_local0_irq(UINT8 source_mask) +{ + m_int3_regs[0] &= ~source_mask; +} + +#ifdef UNUSED_FUNCTION +// raise a local1 interrupt +void ip22_state::int3_raise_local1_irq(UINT8 source_mask) +{ + // signal the interrupt is pending + m_int3_regs[2] |= source_mask; + + // if it's not masked, also assert it now at the CPU + if (m_int3_regs[2] & source_mask) + m_maincpu->set_input_line(MIPS3_IRQ1, ASSERT_LINE); +} + +// lower a local1 interrupt +void ip22_state::int3_lower_local1_irq(UINT8 source_mask) +{ + m_int3_regs[2] &= ~source_mask; +} +#endif + +READ32_MEMBER(ip22_state::hpc3_pbus6_r) +{ + UINT8 ret8; + switch( offset ) + { + case 0x004/4: + ret8 = m_lpt0->control_r(space, 0) ^ 0x0d; + //verboselog(0, "Parallel Control Read: %02x\n", ret8 ); + return ret8; + case 0x008/4: + ret8 = m_lpt0->status_r(space, 0) ^ 0x80; + //verboselog(0, "Parallel Status Read: %02x\n", ret8 ); + return ret8; + case 0x030/4: + //verboselog(2, "Serial 1 Command Transfer Read, 0x1fbd9830: %02x\n", 0x04 ); + switch(space.device().safe_pc()) + { + case 0x9fc1d9e4: // interpreter (ip244415) + case 0x9fc1d9e0: // DRC (ip244415) + case 0x9fc1f8e0: // interpreter (ip224613) + case 0x9fc1f8dc: // DRC (ip224613) + case 0x9fc204c8: // interpreter (ip225015) + case 0x9fc204c4: // DRC (ip225015) + return 0x00000005; + } + return 0x00000004; + case 0x038/4: + //verboselog(2, "Serial 2 Command Transfer Read, 0x1fbd9838: %02x\n", 0x04 ); + return 0x00000004; + case 0x40/4: + return m_kbdc8042->data_r(space, 0); + case 0x44/4: + return m_kbdc8042->data_r(space, 4); + case 0x58/4: + return 0x20; // chip rev 1, board rev 0, "Guinness" (Indy) => 0x01 for "Full House" (Indigo2) + case 0x80/4: + case 0x84/4: + case 0x88/4: + case 0x8c/4: + case 0x90/4: + case 0x94/4: + case 0x98/4: + case 0x9c/4: + case 0xa0/4: + case 0xa4/4: + case 0xa8/4: + case 0xac/4: +// osd_printf_info("INT3: r @ %x mask %08x (PC=%x)\n", offset*4, mem_mask, activecpu_get_pc()); + return m_int3_regs[offset-0x80/4]; + case 0xb0/4: + ret8 = m_pit->read(space, 0); + //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); + return ret8; + case 0xb4/4: + ret8 = m_pit->read(space, 1); + //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); + return ret8; + case 0xb8/4: + ret8 = m_pit->read(space, 2); + //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); + return ret8; + case 0xbc/4: + ret8 = m_pit->read(space, 3); + //verboselog(0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); + return ret8; + default: + //verboselog(0, "Unknown HPC PBUS6 Read: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), mem_mask ); + return 0; + } +} + +WRITE32_MEMBER(ip22_state::hpc3_pbus6_w) +{ + char cChar; + + switch( offset ) + { + case 0x004/4: + //verboselog(0, "Parallel Control Write: %08x\n", data ); + m_lpt0->control_w(space, 0, data ^ 0x0d); + //m_nIOC_ParCntl = data; + break; + case 0x030/4: + if( ( data & 0x000000ff ) >= 0x20 ) + { + //verboselog(2, "Serial 1 Command Transfer Write: %02x: %c\n", data & 0x000000ff, data & 0x000000ff ); + } + else + { + //verboselog(2, "Serial 1 Command Transfer Write: %02x\n", data & 0x000000ff ); + } + cChar = data & 0x000000ff; + if( cChar >= 0x20 || cChar == 0x0d || cChar == 0x0a ) + { +// osd_printf_info( "%c", cChar ); + } + break; + case 0x034/4: + if( ( data & 0x000000ff ) >= 0x20 ) + { + //verboselog(2, "Serial 1 Data Transfer Write: %02x: %c\n", data & 0x000000ff, data & 0x000000ff ); + } + else + { + //verboselog(2, "Serial 1 Data Transfer Write: %02x\n", data & 0x000000ff ); + } + cChar = data & 0x000000ff; + if( cChar >= 0x20 || cChar == 0x0d || cChar == 0x0a ) + { +// osd_printf_info( "%c", cChar ); + } + break; + case 0x40/4: + m_kbdc8042->data_w(space, 0, data); + break; + case 0x44/4: + m_kbdc8042->data_w(space, 4, data); + break; + case 0x80/4: + case 0x84/4: + case 0x88/4: + case 0x8c/4: + case 0x90/4: + case 0x94/4: + case 0x98/4: + case 0x9c/4: + case 0xa0/4: + case 0xa4/4: +// osd_printf_info("INT3: w %x to %x (reg %d) mask %08x (PC=%x)\n", data, offset*4, offset-0x80/4, mem_mask, activecpu_get_pc()); + m_int3_regs[offset-0x80/4] = data; + + // if no local0 interrupts now, clear the input to the CPU + if ((m_int3_regs[0] & m_int3_regs[1]) == 0) + m_maincpu->set_input_line(MIPS3_IRQ0, CLEAR_LINE); + else + m_maincpu->set_input_line(MIPS3_IRQ0, ASSERT_LINE); + + // if no local1 interrupts now, clear the input to the CPU + if ((m_int3_regs[2] & m_int3_regs[3]) == 0) + m_maincpu->set_input_line(MIPS3_IRQ1, CLEAR_LINE); + else + m_maincpu->set_input_line(MIPS3_IRQ1, ASSERT_LINE); + + break; + case 0xb0/4: + //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 0 Register Write: 0x%08x (%08x)\n", data, mem_mask ); + m_pit->write(space, 0, data & 0x000000ff); + return; + case 0xb4/4: + //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 1 Register Write: 0x%08x (%08x)\n", data, mem_mask ); + m_pit->write(space, 1, data & 0x000000ff); + return; + case 0xb8/4: + //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 2 Register Write: 0x%08x (%08x)\n", data, mem_mask ); + m_pit->write(space, 2, data & 0x000000ff); + return; + case 0xbc/4: + //verboselog(0, "HPC PBUS6 IOC4 Timer Control Word Register Write: 0x%08x (%08x)\n", data, mem_mask ); + m_pit->write(space, 3, data & 0x000000ff); + return; + default: + //verboselog(0, "Unknown HPC PBUS6 Write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), data, mem_mask ); + break; + } +} + +READ32_MEMBER(ip22_state::hpc3_hd_enet_r) +{ + switch( offset ) + { + case 0x0004/4: + //verboselog((machine, 0, "HPC3 SCSI0DESC Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, m_HPC3.nSCSI0Descriptor ); + return m_HPC3.nSCSI0Descriptor; + case 0x1004/4: + //verboselog((machine, 0, "HPC3 SCSI0DMACTRL Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, m_HPC3.nSCSI0DMACtrl ); + return m_HPC3.nSCSI0DMACtrl; + case 0x4000/4: + //verboselog((machine, 2, "HPC3 ENETR CBP Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, m_HPC3.nenetr_nbdp ); + return m_HPC3.nenetr_cbp; + case 0x4004/4: + //verboselog((machine, 2, "HPC3 ENETR NBDP Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, m_HPC3.nenetr_nbdp ); + return m_HPC3.nenetr_nbdp; + default: + //verboselog((machine, 0, "Unknown HPC3 ENET/HDx Read: %08x (%08x)\n", 0x1fb90000 + ( offset << 2 ), mem_mask ); + return 0; + } +} + +WRITE32_MEMBER(ip22_state::hpc3_hd_enet_w) +{ + switch( offset ) + { + case 0x0004/4: + //verboselog((machine, 2, "HPC3 SCSI0DESC Write: %08x\n", data ); + m_HPC3.nSCSI0Descriptor = data; + break; + case 0x1004/4: + //verboselog((machine, 2, "HPC3 SCSI0DMACTRL Write: %08x\n", data ); + m_HPC3.nSCSI0DMACtrl = data; + break; + case 0x4000/4: + //verboselog((machine, 2, "HPC3 ENETR CBP Write: %08x\n", data ); + m_HPC3.nenetr_cbp = data; + break; + case 0x4004/4: + //verboselog((machine, 2, "HPC3 ENETR NBDP Write: %08x\n", data ); + m_HPC3.nenetr_nbdp = data; + break; + default: + //verboselog((machine, 0, "Unknown HPC3 ENET/HDx write: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2 ), mem_mask, data ); + break; + } +} + +READ32_MEMBER(ip22_state::hpc3_hd0_r) +{ + switch( offset ) + { + case 0x0000/4: + case 0x4000/4: +// //verboselog((machine, 2, "HPC3 HD0 Status Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC3_hd0_regs[0x17] ); + if (ACCESSING_BITS_0_7) + { + return m_wd33c93->read( space, 0 ); + } + else + { + return 0; + } + case 0x0004/4: + case 0x4004/4: +// //verboselog((machine, 2, "HPC3 HD0 Register Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC3_hd0_regs[nHPC3_hd0_register] ); + if (ACCESSING_BITS_0_7) + { + return m_wd33c93->read( space, 1 ); + } + else + { + return 0; + } + default: + //verboselog((machine, 0, "Unknown HPC3 HD0 Read: %08x (%08x) [%x] PC=%x\n", 0x1fbc0000 + ( offset << 2 ), mem_mask, offset, space.device().safe_pc() ); + return 0; + } +} + +WRITE32_MEMBER(ip22_state::hpc3_hd0_w) +{ + switch( offset ) + { + case 0x0000/4: + case 0x4000/4: +// //verboselog((machine, 2, "HPC3 HD0 Register Select Write: %08x\n", data ); + if (ACCESSING_BITS_0_7) + { + m_wd33c93->write( space, 0, data & 0x000000ff ); + } + break; + case 0x0004/4: + case 0x4004/4: +// //verboselog((machine, 2, "HPC3 HD0 Register %d Write: %08x\n", nHPC3_hd0_register, data ); + if (ACCESSING_BITS_0_7) + { + m_wd33c93->write( space, 1, data & 0x000000ff ); + } + break; + default: + //verboselog((machine, 0, "Unknown HPC3 HD0 Write: %08x (%08x): %08x\n", 0x1fbc0000 + ( offset << 2 ), mem_mask, data ); + break; + } +} + + +READ32_MEMBER(ip22_state::hpc3_pbus4_r) +{ + switch( offset ) + { + case 0x0004/4: + //verboselog((machine, 2, "HPC3 PBUS4 Unknown 0 Read: (%08x): %08x\n", mem_mask, m_HPC3.nunk0 ); + return m_HPC3.nunk0; + case 0x000c/4: + //verboselog((machine, 2, "Interrupt Controller(?) Read: (%08x): %08x\n", mem_mask, m_HPC3.nIC_Unk0 ); + return m_HPC3.nIC_Unk0; + case 0x0014/4: + //verboselog((machine, 2, "HPC3 PBUS4 Unknown 1 Read: (%08x): %08x\n", mem_mask, m_HPC3.nunk1 ); + return m_HPC3.nunk1; + default: + //verboselog((machine, 0, "Unknown HPC3 PBUS4 Read: %08x (%08x)\n", 0x1fbd9000 + ( offset << 2 ), mem_mask ); + return 0; + } +} + +WRITE32_MEMBER(ip22_state::hpc3_pbus4_w) +{ + switch( offset ) + { + case 0x0004/4: + //verboselog((machine, 2, "HPC3 PBUS4 Unknown 0 Write: %08x (%08x)\n", data, mem_mask ); + m_HPC3.nunk0 = data; + break; + case 0x000c/4: + //verboselog((machine, 2, "Interrupt Controller(?) Write: (%08x): %08x\n", mem_mask, data ); + m_HPC3.nIC_Unk0 = data; + break; + case 0x0014/4: + //verboselog((machine, 2, "HPC3 PBUS4 Unknown 1 Write: %08x (%08x)\n", data, mem_mask ); + m_HPC3.nunk1 = data; + break; + default: + //verboselog((machine, 0, "Unknown HPC3 PBUS4 Write: %08x (%08x): %08x\n", 0x1fbd9000 + ( offset << 2 ), mem_mask, data ); + break; + } +} + +#define RTC_SECONDS m_RTC.nRegs[0x00] +#define RTC_SECONDS_A m_RTC.nRegs[0x01] +#define RTC_MINUTES m_RTC.nRegs[0x02] +#define RTC_MINUTES_A m_RTC.nRegs[0x03] +#define RTC_HOURS m_RTC.nRegs[0x04] +#define RTC_HOURS_A m_RTC.nRegs[0x05] +#define RTC_DAYOFWEEK m_RTC.nRegs[0x06] +#define RTC_DAYOFMONTH m_RTC.nRegs[0x07] +#define RTC_MONTH m_RTC.nRegs[0x08] +#define RTC_YEAR m_RTC.nRegs[0x09] +#define RTC_REGISTERA m_RTC.nRegs[0x0a] +#define RTC_REGISTERB m_RTC.nRegs[0x0b] +#define RTC_REGISTERC m_RTC.nRegs[0x0c] +#define RTC_REGISTERD m_RTC.nRegs[0x0d] +#define RTC_MODELBYTE m_RTC.nRegs[0x40] +#define RTC_SERBYTE0 m_RTC.nRegs[0x41] +#define RTC_SERBYTE1 m_RTC.nRegs[0x42] +#define RTC_SERBYTE2 m_RTC.nRegs[0x43] +#define RTC_SERBYTE3 m_RTC.nRegs[0x44] +#define RTC_SERBYTE4 m_RTC.nRegs[0x45] +#define RTC_SERBYTE5 m_RTC.nRegs[0x46] +#define RTC_CRC m_RTC.nRegs[0x47] +#define RTC_CENTURY m_RTC.nRegs[0x48] +#define RTC_DAYOFMONTH_A m_RTC.nRegs[0x49] +#define RTC_EXTCTRL0 m_RTC.nRegs[0x4a] +#define RTC_EXTCTRL1 m_RTC.nRegs[0x4b] +#define RTC_RTCADDR2 m_RTC.nRegs[0x4e] +#define RTC_RTCADDR3 m_RTC.nRegs[0x4f] +#define RTC_RAMLSB m_RTC.nRegs[0x50] +#define RTC_RAMMSB m_RTC.nRegs[0x51] +#define RTC_WRITECNT m_RTC.nRegs[0x5e] + +READ32_MEMBER(ip22_state::rtc_r) +{ + if( offset <= 0x0d ) + { + switch( offset ) + { + case 0x0000: +// //verboselog((machine, 2, "RTC Seconds Read: %d \n", RTC_SECONDS ); + return RTC_SECONDS; + case 0x0001: +// //verboselog((machine, 2, "RTC Seconds Alarm Read: %d \n", RTC_SECONDS_A ); + return RTC_SECONDS_A; + case 0x0002: + //verboselog((machine, 3, "RTC Minutes Read: %d \n", RTC_MINUTES ); + return RTC_MINUTES; + case 0x0003: + //verboselog((machine, 3, "RTC Minutes Alarm Read: %d \n", RTC_MINUTES_A ); + return RTC_MINUTES_A; + case 0x0004: + //verboselog((machine, 3, "RTC Hours Read: %d \n", RTC_HOURS ); + return RTC_HOURS; + case 0x0005: + //verboselog((machine, 3, "RTC Hours Alarm Read: %d \n", RTC_HOURS_A ); + return RTC_HOURS_A; + case 0x0006: + //verboselog((machine, 3, "RTC Day of Week Read: %d \n", RTC_DAYOFWEEK ); + return RTC_DAYOFWEEK; + case 0x0007: + //verboselog((machine, 3, "RTC Day of Month Read: %d \n", RTC_DAYOFMONTH ); + return RTC_DAYOFMONTH; + case 0x0008: + //verboselog((machine, 3, "RTC Month Read: %d \n", RTC_MONTH ); + return RTC_MONTH; + case 0x0009: + //verboselog((machine, 3, "RTC Year Read: %d \n", RTC_YEAR ); + return RTC_YEAR; + case 0x000a: + //verboselog((machine, 3, "RTC Register A Read: %02x \n", RTC_REGISTERA ); + return RTC_REGISTERA; + case 0x000b: + //verboselog((machine, 3, "RTC Register B Read: %02x \n", RTC_REGISTERB ); + return RTC_REGISTERB; + case 0x000c: + //verboselog((machine, 3, "RTC Register C Read: %02x \n", RTC_REGISTERC ); + return RTC_REGISTERC; + case 0x000d: + //verboselog((machine, 3, "RTC Register D Read: %02x \n", RTC_REGISTERD ); + return RTC_REGISTERD; + default: + //verboselog((machine, 3, "Unknown RTC Read: %08x (%08x)\n", 0x1fbe0000 + ( offset << 2 ), mem_mask ); + return 0; + } + } + + if( offset >= 0x0e && offset < 0x40 ) + return m_RTC.nRegs[offset]; + + if( offset >= 0x40 && offset < 0x80 && !( RTC_REGISTERA & 0x10 ) ) + return m_RTC.nUserRAM[offset - 0x40]; + + if( offset >= 0x40 && offset < 0x80 && ( RTC_REGISTERA & 0x10 ) ) + { + switch( offset ) + { + case 0x0040: + //verboselog((machine, 3, "RTC Model Byte Read: %02x\n", RTC_MODELBYTE ); + return RTC_MODELBYTE; + case 0x0041: + //verboselog((machine, 3, "RTC Serial Byte 0 Read: %02x\n", RTC_SERBYTE0 ); + return RTC_SERBYTE0; + case 0x0042: + //verboselog((machine, 3, "RTC Serial Byte 1 Read: %02x\n", RTC_SERBYTE1 ); + return RTC_SERBYTE1; + case 0x0043: + //verboselog((machine, 3, "RTC Serial Byte 2 Read: %02x\n", RTC_SERBYTE2 ); + return RTC_SERBYTE2; + case 0x0044: + //verboselog((machine, 3, "RTC Serial Byte 3 Read: %02x\n", RTC_SERBYTE3 ); + return RTC_SERBYTE3; + case 0x0045: + //verboselog((machine, 3, "RTC Serial Byte 4 Read: %02x\n", RTC_SERBYTE4 ); + return RTC_SERBYTE4; + case 0x0046: + //verboselog((machine, 3, "RTC Serial Byte 5 Read: %02x\n", RTC_SERBYTE5 ); + return RTC_SERBYTE5; + case 0x0047: + //verboselog((machine, 3, "RTC CRC Read: %02x\n", RTC_CRC ); + return RTC_CRC; + case 0x0048: + //verboselog((machine, 3, "RTC Century Read: %02x\n", RTC_CENTURY ); + return RTC_CENTURY; + case 0x0049: + //verboselog((machine, 3, "RTC Day of Month Alarm Read: %02x \n", RTC_DAYOFMONTH_A ); + return RTC_DAYOFMONTH_A; + case 0x004a: + //verboselog((machine, 3, "RTC Extended Control 0 Read: %02x \n", RTC_EXTCTRL0 ); + return RTC_EXTCTRL0; + case 0x004b: + //verboselog((machine, 3, "RTC Extended Control 1 Read: %02x \n", RTC_EXTCTRL1 ); + return RTC_EXTCTRL1; + case 0x004e: + //verboselog((machine, 3, "RTC SMI Recovery Address 2 Read: %02x \n", RTC_RTCADDR2 ); + return RTC_RTCADDR2; + case 0x004f: + //verboselog((machine, 3, "RTC SMI Recovery Address 3 Read: %02x \n", RTC_RTCADDR3 ); + return RTC_RTCADDR3; + case 0x0050: + //verboselog((machine, 3, "RTC RAM LSB Read: %02x \n", RTC_RAMLSB ); + return RTC_RAMLSB; + case 0x0051: + //verboselog((machine, 3, "RTC RAM MSB Read: %02x \n", RTC_RAMMSB ); + return RTC_RAMMSB; + case 0x0053: + return m_RTC.nRAM[ (( RTC_RAMMSB << 8 ) | RTC_RAMLSB) & 0x7ff ]; + case 0x005e: + return RTC_WRITECNT; + default: + //verboselog((machine, 3, "Unknown RTC Ext. Reg. Read: %02x\n", offset ); + return 0; + } + } + + if( offset >= 0x80 ) + return m_RTC.nUserRAM[ offset - 0x80 ]; + + return 0; +} + +WRITE32_MEMBER(ip22_state::rtc_w) +{ + RTC_WRITECNT++; + +// osd_printf_info("RTC_W: offset %x => %x (PC=%x)\n", data, offset, space.device().safe_pc()); + + if( offset <= 0x0d ) + { + switch( offset ) + { + case 0x0000: + //verboselog((machine, 3, "RTC Seconds Write: %02x \n", data ); + RTC_SECONDS = data; + break; + case 0x0001: + //verboselog((machine, 3, "RTC Seconds Alarm Write: %02x \n", data ); + RTC_SECONDS_A = data; + break; + case 0x0002: + //verboselog((machine, 3, "RTC Minutes Write: %02x \n", data ); + RTC_MINUTES = data; + break; + case 0x0003: + //verboselog((machine, 3, "RTC Minutes Alarm Write: %02x \n", data ); + RTC_MINUTES_A = data; + break; + case 0x0004: + //verboselog((machine, 3, "RTC Hours Write: %02x \n", data ); + RTC_HOURS = data; + break; + case 0x0005: + //verboselog((machine, 3, "RTC Hours Alarm Write: %02x \n", data ); + RTC_HOURS_A = data; + break; + case 0x0006: + //verboselog((machine, 3, "RTC Day of Week Write: %02x \n", data ); + RTC_DAYOFWEEK = data; + break; + case 0x0007: + //verboselog((machine, 3, "RTC Day of Month Write: %02x \n", data ); + RTC_DAYOFMONTH = data; + break; + case 0x0008: + //verboselog((machine, 3, "RTC Month Write: %02x \n", data ); + RTC_MONTH = data; + break; + case 0x0009: + //verboselog((machine, 3, "RTC Year Write: %02x \n", data ); + RTC_YEAR = data; + break; + case 0x000a: + //verboselog((machine, 3, "RTC Register A Write (Bit 7 Ignored): %02x \n", data ); + RTC_REGISTERA = data & 0x0000007f; + break; + case 0x000b: + //verboselog((machine, 3, "RTC Register B Write: %02x \n", data ); + RTC_REGISTERB = data; + break; + case 0x000c: + //verboselog((machine, 3, "RTC Register C Write (Ignored): %02x \n", data ); + break; + case 0x000d: + //verboselog((machine, 3, "RTC Register D Write (Ignored): %02x \n", data ); + break; + default: + //verboselog((machine, 3, "Unknown RTC Write: %08x (%08x): %08x\n", 0x1fbe0000 + ( offset << 2 ), mem_mask, data ); + break; + } + } + if( offset >= 0x0e && offset < 0x40 ) + { + m_RTC.nRegs[offset] = data; + return; + } + if( offset >= 0x40 && offset < 0x80 && !( RTC_REGISTERA & 0x10 ) ) + { + m_RTC.nUserRAM[offset - 0x40] = data; + return; + } + if( offset >= 0x40 && offset < 0x80 && ( RTC_REGISTERA & 0x10 ) ) + { + switch( offset ) + { + case 0x0040: + case 0x0041: + case 0x0042: + case 0x0043: + case 0x0044: + case 0x0045: + case 0x0046: + //verboselog((machine, 3, "Invalid write to RTC serial number byte %d: %02x\n", offset - 0x0040, data ); + break; + case 0x0047: + //verboselog((machine, 3, "RTC Century Write: %02x \n", data ); + RTC_CENTURY = data; + break; + case 0x0048: + //verboselog((machine, 3, "RTC Century Write: %02x \n", data ); + RTC_CENTURY = data; + break; + case 0x0049: + //verboselog((machine, 3, "RTC Day of Month Alarm Write: %02x \n", data ); + RTC_DAYOFMONTH_A = data; + break; + case 0x004a: + //verboselog((machine, 3, "RTC Extended Control 0 Write: %02x \n", data ); + RTC_EXTCTRL0 = data; + break; + case 0x004b: + //verboselog((machine, 3, "RTC Extended Control 1 Write: %02x \n", data ); + RTC_EXTCTRL1 = data; + break; + case 0x004e: + //verboselog((machine, 3, "RTC SMI Recovery Address 2 Write: %02x \n", data ); + RTC_RTCADDR2 = data; + break; + case 0x004f: + //verboselog((machine, 3, "RTC SMI Recovery Address 3 Write: %02x \n", data ); + RTC_RTCADDR3 = data; + break; + case 0x0050: + //verboselog((machine, 3, "RTC RAM LSB Write: %02x \n", data ); + RTC_RAMLSB = data; + break; + case 0x0051: + //verboselog((machine, 3, "RTC RAM MSB Write: %02x \n", data ); + RTC_RAMMSB = data; + break; + case 0x0053: + m_RTC.nRAM[ (( RTC_RAMMSB << 8 ) | RTC_RAMLSB) & 0x7ff ] = data; + break; + default: + //verboselog((machine, 3, "Unknown RTC Ext. Reg. Write: %02x: %02x\n", offset, data ); + break; + } + } + if( offset >= 0x80 ) + { + m_RTC.nUserRAM[ offset - 0x80 ] = data; + } +} + +// a bit hackish, but makes the memory detection work properly and allows a big cleanup of the mapping +WRITE32_MEMBER(ip22_state::ip22_write_ram) +{ + // if banks 2 or 3 are enabled, do nothing, we don't support that much memory + if (m_sgi_mc->read(space, 0xc8/4, 0xffffffff) & 0x10001000) + { + // a random perturbation so the memory test fails + data ^= 0xffffffff; + } + + // if banks 0 or 1 have 2 membanks, also kill it, we only want 128 MB + if (m_sgi_mc->read(space, 0xc0/4, 0xffffffff) & 0x40004000) + { + // a random perturbation so the memory test fails + data ^= 0xffffffff; + } + COMBINE_DATA(&m_mainram[offset]); +} + + +#define H2_IAR_TYPE 0xf000 +#define H2_IAR_NUM 0x0f00 +#define H2_IAR_ACCESS_SEL 0x0080 +#define H2_IAR_PARAM 0x000c +#define H2_IAR_RB_INDEX 0x0003 + +#define H2_ISR_TSTATUS 0x01 +#define H2_ISR_USTATUS 0x02 +#define H2_ISR_QUAD_MODE 0x04 +#define H2_ISR_GLOBAL_RESET 0x08 +#define H2_ISR_CODEC_RESET 0x10 + +READ32_MEMBER(ip22_state::hal2_r) +{ + switch( offset ) + { + case 0x0010/4: + //verboselog((machine, 0, "HAL2 Status read: 0x0004\n" ); + return 0x0004; + case 0x0020/4: + //verboselog((machine, 0, "HAL2 Revision read: 0x4011\n" ); + return 0x4011; + } + //verboselog((machine, 0, "Unknown HAL2 read: 0x%08x (%08x)\n", 0x1fbd8000 + offset*4, mem_mask ); + return 0; +} + +WRITE32_MEMBER(ip22_state::hal2_w) +{ + switch( offset ) + { + case 0x0010/4: + //verboselog((machine, 0, "HAL2 Status Write: 0x%08x (%08x)\n", data, mem_mask ); + if( data & H2_ISR_GLOBAL_RESET ) + { + //verboselog((machine, 0, " HAL2 Global Reset\n" ); + } + if( data & H2_ISR_CODEC_RESET ) + { + //verboselog((machine, 0, " HAL2 Codec Reset\n" ); + } + break; + case 0x0030/4: + //verboselog((machine, 0, "HAL2 Indirect Address Register Write: 0x%08x (%08x)\n", data, mem_mask ); + m_HAL2.nIAR = data; + switch( data & H2_IAR_TYPE ) + { + case 0x1000: + //verboselog((machine, 0, " DMA Port\n" ); + switch( data & H2_IAR_NUM ) + { + case 0x0100: + //verboselog((machine, 0, " Synth In\n" ); + break; + case 0x0200: + //verboselog((machine, 0, " AES In\n" ); + break; + case 0x0300: + //verboselog((machine, 0, " AES Out\n" ); + break; + case 0x0400: + //verboselog((machine, 0, " DAC Out\n" ); + break; + case 0x0500: + //verboselog((machine, 0, " ADC Out\n" ); + break; + case 0x0600: + //verboselog((machine, 0, " Synth Control\n" ); + break; + } + break; + case 0x2000: + //verboselog((machine, 0, " Bresenham\n" ); + switch( data & H2_IAR_NUM ) + { + case 0x0100: + //verboselog((machine, 0, " Bresenham Clock Gen 1\n" ); + break; + case 0x0200: + //verboselog((machine, 0, " Bresenham Clock Gen 2\n" ); + break; + case 0x0300: + //verboselog((machine, 0, " Bresenham Clock Gen 3\n" ); + break; + } + break; + case 0x3000: + //verboselog((machine, 0, " Unix Timer\n" ); + switch( data & H2_IAR_NUM ) + { + case 0x0100: + //verboselog((machine, 0, " Unix Timer\n" ); + break; + } + break; + case 0x9000: + //verboselog((machine, 0, " Global DMA Control\n" ); + switch( data & H2_IAR_NUM ) + { + case 0x0100: + //verboselog((machine, 0, " DMA Control\n" ); + break; + } + break; + } + switch( data & H2_IAR_ACCESS_SEL ) + { + case 0x0000: + //verboselog((machine, 0, " Write\n" ); + break; + case 0x0080: + //verboselog((machine, 0, " Read\n" ); + break; + } + //verboselog((machine, 0, " Parameter: %01x\n", ( data & H2_IAR_PARAM ) >> 2 ); + return; + /* FIXME: this code is never excuted */ + //verboselog((machine, 0, " Read Back Index: %01x\n", ( data & H2_IAR_RB_INDEX ) ); + //break; + case 0x0040/4: + //verboselog((machine, 0, "HAL2 Indirect Data Register 0 Write: 0x%08x (%08x)\n", data, mem_mask ); + m_HAL2.nIDR[0] = data; + return; + case 0x0050/4: + //verboselog((machine, 0, "HAL2 Indirect Data Register 1 Write: 0x%08x (%08x)\n", data, mem_mask ); + m_HAL2.nIDR[1] = data; + return; + case 0x0060/4: + //verboselog((machine, 0, "HAL2 Indirect Data Register 2 Write: 0x%08x (%08x)\n", data, mem_mask ); + m_HAL2.nIDR[2] = data; + return; + case 0x0070/4: + //verboselog((machine, 0, "HAL2 Indirect Data Register 3 Write: 0x%08x (%08x)\n", data, mem_mask ); + m_HAL2.nIDR[3] = data; + return; + } + //verboselog((machine, 0, "Unknown HAL2 write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd8000 + offset*4, data, mem_mask ); +} + +#define PBUS_CTRL_ENDIAN 0x00000002 +#define PBUS_CTRL_RECV 0x00000004 +#define PBUS_CTRL_FLUSH 0x00000008 +#define PBUS_CTRL_DMASTART 0x00000010 +#define PBUS_CTRL_LOAD_EN 0x00000020 +#define PBUS_CTRL_REALTIME 0x00000040 +#define PBUS_CTRL_HIGHWATER 0x0000ff00 +#define PBUS_CTRL_FIFO_BEG 0x003f0000 +#define PBUS_CTRL_FIFO_END 0x3f000000 + +#define PBUS_DMADESC_EOX 0x80000000 +#define PBUS_DMADESC_EOXP 0x40000000 +#define PBUS_DMADESC_XIE 0x20000000 +#define PBUS_DMADESC_IPG 0x00ff0000 +#define PBUS_DMADESC_TXD 0x00008000 +#define PBUS_DMADESC_BC 0x00003fff + + +void ip22_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_IP22_DMA: + ip22_dma(ptr, param); + break; + case TIMER_IP22_MSEC: + ip22_timer(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in ip22_state::device_timer"); + } +} + +TIMER_CALLBACK_MEMBER(ip22_state::ip22_dma) +{ + timer_set(attotime::never, TIMER_IP22_DMA); +#if 0 + if( m_PBUS_DMA.nActive ) + { + UINT16 temp16 = ( m_mainram[(m_PBUS_DMA.nCurPtr - 0x08000000)/4] & 0xffff0000 ) >> 16; + INT16 stemp16 = (INT16)((temp16 >> 8) | (temp16 << 8)); + + m_dac->write_signed16(stemp16 ^ 0x8000); + + m_PBUS_DMA.nCurPtr += 4; + + m_PBUS_DMA.nWordsLeft -= 4; + if( m_PBUS_DMA.nWordsLeft == 0 ) + { + if( m_PBUS_DMA.nNextPtr != 0 ) + { + m_PBUS_DMA.nDescPtr = m_PBUS_DMA.nNextPtr; + m_PBUS_DMA.nCurPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4]; + m_PBUS_DMA.nWordsLeft = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+1]; + m_PBUS_DMA.nNextPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+2]; + } + else + { + m_PBUS_DMA.nActive = 0; + return; + } + } + timer_set(attotime::from_hz(44100), TIMER_IP22_DMA); + } +#endif +} + +READ32_MEMBER(ip22_state::hpc3_pbusdma_r) +{ + //UINT32 channel = offset / (0x2000/4); + //verboselog((machine(), 0, "PBUS DMA Channel %d Read: 0x%08x (%08x)\n", channel, 0x1fb80000 + offset*4, mem_mask ); + return 0; +} + +WRITE32_MEMBER(ip22_state::hpc3_pbusdma_w) +{ + UINT32 channel = offset / (0x2000/4); + + switch( offset & 0x07ff ) + { + case 0x0000/4: + //verboselog((machine, 0, "PBUS DMA Channel %d Buffer Pointer Write: 0x%08x\n", channel, data ); + return; + case 0x0004/4: + //verboselog((machine, 0, "PBUS DMA Channel %d Descriptor Pointer Write: 0x%08x\n", channel, data ); + if( channel == 1 ) + { + m_PBUS_DMA.nDescPtr = data; + m_PBUS_DMA.nCurPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4]; + m_PBUS_DMA.nWordsLeft = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+1]; + m_PBUS_DMA.nNextPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+2]; + //verboselog((machine, 0, "nPBUS_DMA_DescPtr = %08x\n", m_PBUS_DMA.nDescPtr ); + //verboselog((machine, 0, "nPBUS_DMA_CurPtr = %08x\n", m_PBUS_DMA.nCurPtr ); + //verboselog((machine, 0, "nPBUS_DMA_WordsLeft = %08x\n", m_PBUS_DMA.nWordsLeft ); + //verboselog((machine, 0, "nPBUS_DMA_NextPtr = %08x\n", m_PBUS_DMA.nNextPtr ); + } + return; + case 0x1000/4: + //verboselog((machine, 0, "PBUS DMA Channel %d Control Register Write: 0x%08x\n", channel, data ); + if( data & PBUS_CTRL_ENDIAN ) + { + //verboselog((machine, 0, " Little Endian\n" ); + } + else + { + //verboselog((machine, 0, " Big Endian\n" ); + } + if( data & PBUS_CTRL_RECV ) + { + //verboselog((machine, 0, " RX DMA\n" ); + } + else + { + //verboselog((machine, 0, " TX DMA\n" ); + } + if( data & PBUS_CTRL_FLUSH ) + { + //verboselog((machine, 0, " Flush for RX\n" ); + } + if( data & PBUS_CTRL_DMASTART ) + { + //verboselog((machine, 0, " Start DMA\n" ); + } + if( data & PBUS_CTRL_LOAD_EN ) + { + //verboselog((machine, 0, " Load Enable\n" ); + } + //verboselog((machine, 0, " High Water Mark: %04x bytes\n", ( data & PBUS_CTRL_HIGHWATER ) >> 8 ); + //verboselog((machine, 0, " FIFO Begin: Row %04x\n", ( data & PBUS_CTRL_FIFO_BEG ) >> 16 ); + //verboselog((machine, 0, " FIFO End: Rowe %04x\n", ( data & PBUS_CTRL_FIFO_END ) >> 24 ); + if( ( data & PBUS_CTRL_DMASTART ) || ( data & PBUS_CTRL_LOAD_EN ) ) + { + timer_set(attotime::from_hz(44100), TIMER_IP22_DMA); + m_PBUS_DMA.nActive = 1; + } + return; + } + //verboselog((machine, 0, "Unknown PBUS DMA Channel %d Write: 0x%08x: 0x%08x (%08x)\n", channel, 0x1fb80000 + offset*4, data, mem_mask ); +} + +READ32_MEMBER(ip22_state::hpc3_unkpbus0_r) +{ + return 0; + ////verboselog((machine(), 0, "Unknown PBUS Read: 0x%08x (%08x)\n", 0x1fbc8000 + offset*4, mem_mask ); + //return m_unkpbus0[offset]; +} + +WRITE32_MEMBER(ip22_state::hpc3_unkpbus0_w) +{ + ////verboselog((machine(), 0, "Unknown PBUS Write: 0x%08x = 0x%08x (%08x)\n", 0x1fbc8000 + offset*4, data, mem_mask ); + //COMBINE_DATA(&m_unkpbus0[offset]); +} + +static ADDRESS_MAP_START( ip225015_map, AS_PROGRAM, 32, ip22_state ) + AM_RANGE( 0x00000000, 0x0007ffff ) AM_RAMBANK( "bank1" ) /* mirror of first 512k of main RAM */ + AM_RANGE( 0x08000000, 0x0fffffff ) AM_SHARE("mainram") AM_RAM_WRITE(ip22_write_ram) /* 128 MB of main RAM */ + AM_RANGE( 0x1f0f0000, 0x1f0f1fff ) AM_DEVREADWRITE("newport", newport_video_device, rex3_r, rex3_w ) + AM_RANGE( 0x1fa00000, 0x1fa1ffff ) AM_DEVREADWRITE("sgi_mc", sgi_mc_device, read, write ) + AM_RANGE( 0x1fb90000, 0x1fb9ffff ) AM_READWRITE(hpc3_hd_enet_r, hpc3_hd_enet_w ) + AM_RANGE( 0x1fbb0000, 0x1fbb0003 ) AM_RAM /* unknown, but read a lot and discarded */ + AM_RANGE( 0x1fbc0000, 0x1fbc7fff ) AM_READWRITE(hpc3_hd0_r, hpc3_hd0_w ) + AM_RANGE( 0x1fbc8000, 0x1fbcffff ) AM_READWRITE(hpc3_unkpbus0_r, hpc3_unkpbus0_w ) AM_SHARE("unkpbus0") + AM_RANGE( 0x1fb80000, 0x1fb8ffff ) AM_READWRITE(hpc3_pbusdma_r, hpc3_pbusdma_w ) + AM_RANGE( 0x1fbd8000, 0x1fbd83ff ) AM_READWRITE(hal2_r, hal2_w ) + AM_RANGE( 0x1fbd8400, 0x1fbd87ff ) AM_RAM /* hack */ + AM_RANGE( 0x1fbd9000, 0x1fbd93ff ) AM_READWRITE(hpc3_pbus4_r, hpc3_pbus4_w ) + AM_RANGE( 0x1fbd9800, 0x1fbd9bff ) AM_READWRITE(hpc3_pbus6_r, hpc3_pbus6_w ) + AM_RANGE( 0x1fbdc000, 0x1fbdc7ff ) AM_RAM + AM_RANGE( 0x1fbdd000, 0x1fbdd3ff ) AM_RAM + AM_RANGE( 0x1fbe0000, 0x1fbe04ff ) AM_READWRITE(rtc_r, rtc_w ) + AM_RANGE( 0x1fc00000, 0x1fc7ffff ) AM_ROM AM_REGION( "user1", 0 ) + AM_RANGE( 0x20000000, 0x27ffffff ) AM_SHARE("mainram") AM_RAM_WRITE(ip22_write_ram) +ADDRESS_MAP_END + + +TIMER_CALLBACK_MEMBER(ip22_state::ip22_timer) +{ + timer_set(attotime::from_msec(1), TIMER_IP22_MSEC); +} + +void ip22_state::machine_reset() +{ + m_HPC3.nenetr_nbdp = 0x80000000; + m_HPC3.nenetr_cbp = 0x80000000; + m_nIntCounter = 0; + RTC_REGISTERB = 0x08; + RTC_REGISTERD = 0x80; + + timer_set(attotime::from_msec(1), TIMER_IP22_MSEC); + + // set up low RAM mirror + membank("bank1")->set_base(m_mainram); + + m_PBUS_DMA.nActive = 0; + + m_maincpu->mips3drc_set_options(MIPS3DRC_COMPATIBLE_OPTIONS | MIPS3DRC_CHECK_OVERFLOWS); +} + +void ip22_state::dump_chain(address_space &space, UINT32 ch_base) +{ + printf("node: %08x %08x %08x (len = %x)\n", space.read_dword(ch_base), space.read_dword(ch_base+4), space.read_dword(ch_base+8), space.read_dword(ch_base+4) & 0x3fff); + + if ((space.read_dword(ch_base+8) != 0) && !(space.read_dword(ch_base+4) & 0x80000000)) + { + dump_chain(space, space.read_dword(ch_base+8)); + } +} + +// HPC3 SCSI DMA control register bits +#define HPC3_DMACTRL_IRQ (0x01) +#define HPC3_DMACTRL_ENDIAN (0x02) +#define HPC3_DMACTRL_DIR (0x04) +#define HPC3_DMACTRL_ENABLE (0x10) + + +WRITE_LINE_MEMBER(ip22_state::scsi_irq) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + if (state) + { + if (m_wd33c93->get_dma_count()) + { + printf("m_wd33c93->get_dma_count() is %d\n", m_wd33c93->get_dma_count() ); + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) + { + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_IRQ) logerror("IP22: Unhandled SCSI DMA IRQ\n"); + } + + // HPC3 DMA: host to device + if ((m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_DIR)) + { + UINT32 wptr, tmpword; + int words, dptr, twords; + + words = m_wd33c93->get_dma_count(); + words /= 4; + + wptr = space.read_dword(m_HPC3.nSCSI0Descriptor); + m_HPC3.nSCSI0Descriptor += words*4; + dptr = 0; + + printf("DMA to device: %d words @ %x\n", words, wptr); + + dump_chain(space, m_HPC3.nSCSI0Descriptor); + + if (words <= (512/4)) + { + // one-shot + //m_wd33c93->dma_read_data(m_wd33c93->get_dma_count(), m_dma_buffer); + + while (words) + { + tmpword = space.read_dword(wptr); + + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + { + m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; + m_dma_buffer[dptr] = tmpword&0xff; + } + else + { + m_dma_buffer[dptr] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; + m_dma_buffer[dptr+3] = tmpword&0xff; + } + + wptr += 4; + dptr += 4; + words--; + } + + words = m_wd33c93->get_dma_count(); + m_wd33c93->dma_write_data(words, m_dma_buffer); + } + else + { + while (words) + { + //m_wd33c93->dma_read_data(512, m_dma_buffer); + twords = 512/4; + m_HPC3.nSCSI0Descriptor += 512; + dptr = 0; + + while (twords) + { + tmpword = space.read_dword(wptr); + + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + { + m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; + m_dma_buffer[dptr] = tmpword&0xff; + } + else + { + m_dma_buffer[dptr] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; + m_dma_buffer[dptr+3] = tmpword&0xff; + } + + wptr += 4; + dptr += 4; + twords--; + } + + m_wd33c93->dma_write_data(512, m_dma_buffer); + + words -= (512/4); + } + } + + // clear DMA on the controller too + m_wd33c93->clear_dma(); +#if 0 + UINT32 dptr, tmpword; + UINT32 bc = space.read_dword(m_HPC3.nSCSI0Descriptor + 4); + UINT32 rptr = space.read_dword(m_HPC3.nSCSI0Descriptor); + int length = bc & 0x3fff; + int xie = (bc & 0x20000000) ? 1 : 0; + int eox = (bc & 0x80000000) ? 1 : 0; + + dump_chain(space, m_HPC3.nSCSI0Descriptor); + + printf("PC is %08x\n", machine.device("maincpu")->safe_pc()); + printf("DMA to device: length %x xie %d eox %d\n", length, xie, eox); + + if (length <= 0x4000) + { + dptr = 0; + while (length > 0) + { + tmpword = space.read_dword(rptr); + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + { + m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; + m_dma_buffer[dptr] = tmpword&0xff; + } + else + { + m_dma_buffer[dptr] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; + m_dma_buffer[dptr+3] = tmpword&0xff; + } + + dptr += 4; + rptr += 4; + length -= 4; + } + + length = space.read_dword(m_HPC3.nSCSI0Descriptor+4) & 0x3fff; + m_wd33c93->write_data(length, m_dma_buffer); + + // clear DMA on the controller too + m_wd33c93->clear_dma(); + } + else + { + logerror("IP22: overly large host to device transfer, can't handle!\n"); + } +#endif + } + + // HPC3 DMA: device to host + if ((m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && !(m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_DIR)) + { + UINT32 wptr, tmpword; + int words, sptr, twords; + + words = m_wd33c93->get_dma_count(); + words /= 4; + + wptr = space.read_dword(m_HPC3.nSCSI0Descriptor); + sptr = 0; + +// osd_printf_info("DMA from device: %d words @ %x\n", words, wptr); + + dump_chain(space, m_HPC3.nSCSI0Descriptor); + + if (words <= (1024/4)) + { + // one-shot + m_wd33c93->dma_read_data(m_wd33c93->get_dma_count(), m_dma_buffer); + + while (words) + { + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + { + tmpword = m_dma_buffer[sptr+3]<<24 | m_dma_buffer[sptr+2]<<16 | m_dma_buffer[sptr+1]<<8 | m_dma_buffer[sptr]; + } + else + { + tmpword = m_dma_buffer[sptr]<<24 | m_dma_buffer[sptr+1]<<16 | m_dma_buffer[sptr+2]<<8 | m_dma_buffer[sptr+3]; + } + + space.write_dword(wptr, tmpword); + wptr += 4; + sptr += 4; + words--; + } + } + else + { + while (words) + { + m_wd33c93->dma_read_data(512, m_dma_buffer); + twords = 512/4; + sptr = 0; + + while (twords) + { + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + { + tmpword = m_dma_buffer[sptr+3]<<24 | m_dma_buffer[sptr+2]<<16 | m_dma_buffer[sptr+1]<<8 | m_dma_buffer[sptr]; + } + else + { + tmpword = m_dma_buffer[sptr]<<24 | m_dma_buffer[sptr+1]<<16 | m_dma_buffer[sptr+2]<<8 | m_dma_buffer[sptr+3]; + } + space.write_dword(wptr, tmpword); + + wptr += 4; + sptr += 4; + twords--; + } + + words -= (512/4); + } + } + + // clear DMA on the controller too + m_wd33c93->clear_dma(); + } + } + + // clear HPC3 DMA active flag + m_HPC3.nSCSI0DMACtrl &= ~HPC3_DMACTRL_ENABLE; + + // set the interrupt + int3_raise_local0_irq(INT3_LOCAL0_SCSI0); + } + else + { + int3_lower_local0_irq(INT3_LOCAL0_SCSI0); + } +} + +void ip22_state::machine_start() +{ + // SCSI init + machine().device("nvram_user")->set_base(m_RTC.nUserRAM, 0x200); + machine().device("nvram")->set_base(m_RTC.nRAM, 0x200); +} + +DRIVER_INIT_MEMBER(ip22_state,ip225015) +{ + // IP22 uses 2 pieces of PC-compatible hardware: the 8042 PS/2 keyboard/mouse + // interface and the 8254 PIT. Both are licensed cores embedded in the IOC custom chip. + m_nIOC_ParReadCnt = 0; +} + +static INPUT_PORTS_START( ip225015 ) + PORT_START("IN0") // unused IN0 + PORT_START("DSW0") // unused IN1 + PORT_START("DSW1") // unused IN2 + PORT_START("DSW2") // unused IN3 + PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ +INPUT_PORTS_END + +void ip22_state::rtc_update() +{ + RTC_SECONDS++; + + switch( RTC_REGISTERB & 0x04 ) + { + case 0x00: /* Non-BCD */ + if( RTC_SECONDS == 60 ) + { + RTC_SECONDS = 0; + RTC_MINUTES++; + } + if( RTC_MINUTES == 60 ) + { + RTC_MINUTES = 0; + RTC_HOURS++; + } + if( RTC_HOURS == 24 ) + { + RTC_HOURS = 0; + RTC_DAYOFMONTH++; + } + RTC_SECONDS_A = RTC_SECONDS; + RTC_MINUTES_A = RTC_MINUTES; + RTC_HOURS_A = RTC_HOURS; + break; + case 0x04: /* BCD */ + if( ( RTC_SECONDS & 0x0f ) == 0x0a ) + { + RTC_SECONDS -= 0x0a; + RTC_SECONDS += 0x10; + } + if( ( RTC_SECONDS & 0xf0 ) == 0x60 ) + { + RTC_SECONDS -= 0x60; + RTC_MINUTES++; + } + if( ( RTC_MINUTES & 0x0f ) == 0x0a ) + { + RTC_MINUTES -= 0x0a; + RTC_MINUTES += 0x10; + } + if( ( RTC_MINUTES & 0xf0 ) == 0x60 ) + { + RTC_MINUTES -= 0x60; + RTC_HOURS++; + } + if( ( RTC_HOURS & 0x0f ) == 0x0a ) + { + RTC_HOURS -= 0x0a; + RTC_HOURS += 0x10; + } + if( RTC_HOURS == 0x24 ) + { + RTC_HOURS = 0; + RTC_DAYOFMONTH++; + } + RTC_SECONDS_A = RTC_SECONDS; + RTC_MINUTES_A = RTC_MINUTES; + RTC_HOURS_A = RTC_HOURS; + break; + } +} + +INTERRUPT_GEN_MEMBER(ip22_state::ip22_vbl) +{ + m_nIntCounter++; +// if( m_nIntCounter == 60 ) + { + m_nIntCounter = 0; + rtc_update(); + } +} + +#if 0 +static const mips3_config config = +{ + 32768, /* code cache size */ + 32768 /* data cache size */ +}; +#endif + +static MACHINE_CONFIG_FRAGMENT( cdrom_config ) + MCFG_DEVICE_MODIFY( "cdda" ) + MCFG_SOUND_ROUTE( 0, "^^^^lspeaker", 1.0 ) + MCFG_SOUND_ROUTE( 1, "^^^^rspeaker", 1.0 ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ip225015, ip22_state ) + MCFG_CPU_ADD( "maincpu", R5000BE, 50000000*3 ) + MCFG_CPU_CONFIG( config ) + MCFG_CPU_PROGRAM_MAP( ip225015_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", ip22_state, ip22_vbl) + + + MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_NVRAM_ADD_0FILL("nvram_user") + + MCFG_DEVICE_ADD("pit8254", PIT8254, 0) + MCFG_PIT8253_CLK0(1000000) + MCFG_PIT8253_CLK1(1000000) + MCFG_PIT8253_CLK2(1000000) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("kbdc", kbdc8042_device, write_out2)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE( 60 ) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1280+64, 1024+64) + MCFG_SCREEN_VISIBLE_AREA(0, 1279, 0, 1023) + MCFG_SCREEN_UPDATE_DEVICE("newport", newport_video_device, screen_update) + + MCFG_PALETTE_ADD("palette", 65536) + + MCFG_NEWPORT_ADD("newport") + + MCFG_DEVICE_ADD("sgi_mc", SGI_MC, 0) + + MCFG_DEVICE_ADD("lpt_0", PC_LPT, 0) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_ADD( "dac", DAC, 0 ) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_1) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "cdrom", SCSICD, SCSI_ID_4) + MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config) + + MCFG_DEVICE_ADD("wd33c93", WD33C93, 0) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_WD33C93_IRQ_CB(WRITELINE(ip22_state,scsi_irq)) + + MCFG_DEVICE_ADD("kbdc", KBDC8042, 0) + MCFG_KBDC8042_KEYBOARD_TYPE(KBDC8042_STANDARD) + MCFG_KBDC8042_SYSTEM_RESET_CB(INPUTLINE("maincpu", INPUT_LINE_RESET)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ip224613, ip225015 ) + MCFG_CPU_REPLACE( "maincpu", R4600BE, 133333333 ) + MCFG_CPU_CONFIG( config ) + MCFG_CPU_PROGRAM_MAP( ip225015_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", ip22_state, ip22_vbl) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ip244415, ip225015 ) + MCFG_CPU_REPLACE( "maincpu", R4600BE, 150000000 ) + MCFG_CPU_CONFIG( config ) + MCFG_CPU_PROGRAM_MAP( ip225015_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", ip22_state, ip22_vbl) +MACHINE_CONFIG_END + +ROM_START( ip225015 ) + ROM_REGION( 0x80000, "user1", 0 ) + ROM_LOAD( "ip225015.bin", 0x000000, 0x080000, CRC(aee5502e) SHA1(9243fef0a3508790651e0d6d2705c887629b1280) ) +ROM_END + +ROM_START( ip224613 ) + ROM_REGION( 0x80000, "user1", 0 ) + ROM_LOAD( "ip224613.bin", 0x000000, 0x080000, CRC(f1868b5b) SHA1(0dcbbd776e671785b9b65f3c6dbd609794a40157) ) +ROM_END + +ROM_START( ip244415 ) + ROM_REGION( 0x80000, "user1", 0 ) + ROM_LOAD( "ip244415.bin", 0x000000, 0x080000, CRC(2f37825a) SHA1(0d48c573b53a307478820b85aacb57b868297ca3) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1993, ip225015, 0, 0, ip225015, ip225015, ip22_state, ip225015, "Silicon Graphics Inc", "Indy (R5000, 150MHz)", MACHINE_NOT_WORKING ) +COMP( 1993, ip224613, 0, 0, ip224613, ip225015, ip22_state, ip225015, "Silicon Graphics Inc", "Indy (R4600, 133MHz)", MACHINE_NOT_WORKING ) +COMP( 1994, ip244415, 0, 0, ip244415, ip225015, ip22_state, ip225015, "Silicon Graphics Inc", "Indigo2 (R4400, 150MHz)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/ipc.c b/src/mame/drivers/ipc.c new file mode 100644 index 00000000000..672b3b1c354 --- /dev/null +++ b/src/mame/drivers/ipc.c @@ -0,0 +1,140 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Intel iPB and iPC + + 17/12/2009 Skeleton driver. + + 22/04/2011 Connected to a terminal, it responds. Modernised. + + --> When started, you must press Space, then it will start to work. + + Monitor commands: + A + Dn n - dump memory + E + Fn n n - fill memory + G + Hn n - hex arithmetic + Mn n n - move (copy) memory block + N + Q + R + Sn - modify a byte of memory + W - display memory in Intel? format + X - show and modify registers + + + Preliminary Memory Map + E800-F7FF BIOS ROM area + F800-FFFF Monitor ROM (or other user interface) + + I/O F4/F5 main console input and output + I/O F6/F7 alternate console input + + ToDo: + - Everything! + - iPC - Find missing rom F800-FFFF + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class ipc_state : public driver_device +{ +public: + ipc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER( ipc_f4_r ); + DECLARE_READ8_MEMBER( ipc_f5_r ); + DECLARE_WRITE8_MEMBER( kbd_put ); + UINT8 *m_ram; + UINT8 m_term_data; + virtual void machine_reset(); +}; + +READ8_MEMBER( ipc_state::ipc_f4_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +// bit 0 high = ok to send to terminal; bit 1 high = key is pressed +READ8_MEMBER( ipc_state::ipc_f5_r ) +{ + return (m_term_data) ? 3 : 1; +} + + +static ADDRESS_MAP_START(ipc_mem, AS_PROGRAM, 8, ipc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xdfff) AM_RAM + AM_RANGE(0xe800, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ipc_io, AS_IO, 8, ipc_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf4, 0xf4) AM_READ(ipc_f4_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0xf5, 0xf5) AM_READ(ipc_f5_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ipc ) +INPUT_PORTS_END + + +void ipc_state::machine_reset() +{ + m_maincpu->set_state_int(I8085_PC, 0xE800); +} + +WRITE8_MEMBER( ipc_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( ipc, ipc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8085A, XTAL_19_6608MHz / 4) + MCFG_CPU_PROGRAM_MAP(ipc_mem) + MCFG_CPU_IO_MAP(ipc_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ipc_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ipb ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ipb_e8_v1.3.bin", 0xe800, 0x0800, CRC(fc9d4703) SHA1(2ce078e1bcd8b24217830c54bcf04c5d146d1b76) ) + ROM_LOAD( "ipb_f8_v1.3.bin", 0xf800, 0x0800, CRC(966ba421) SHA1(d6a904c7d992a05ed0f451d7d34c1fc8de9547ee) ) +ROM_END + +ROM_START( ipc ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ipc_u82_v1.3_104584-001.bin", 0xe800, 0x1000, CRC(0889394f) SHA1(b7525baf1884a7d67402dea4b5566016a9861ef2) ) + + // required rom is missing. Using this one from 'ipb' for now. + ROM_LOAD( "ipb_f8_v1.3.bin", 0xf800, 0x0800, BAD_DUMP CRC(966ba421) SHA1(d6a904c7d992a05ed0f451d7d34c1fc8de9547ee) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, ipb, 0, 0, ipc, ipc, driver_device, 0, "Intel", "iPB", MACHINE_NO_SOUND) +COMP( 19??, ipc, ipb, 0, ipc, ipc, driver_device, 0, "Intel", "iPC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/ipds.c b/src/mame/drivers/ipds.c new file mode 100644 index 00000000000..4b25d00bebc --- /dev/null +++ b/src/mame/drivers/ipds.c @@ -0,0 +1,168 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Intel iPDS + + 17/12/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "video/i8275.h" +#include "machine/keyboard.h" + +#define KEYBOARD_TAG "keyboard" + +class ipds_state : public driver_device +{ +public: + ipds_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "i8275"), + m_palette(*this, "palette") + { + } + + required_device m_maincpu; + required_device m_crtc; + required_device m_palette; + DECLARE_READ8_MEMBER(ipds_b0_r); + DECLARE_READ8_MEMBER(ipds_b1_r); + DECLARE_READ8_MEMBER(ipds_c0_r); + DECLARE_WRITE8_MEMBER(ipds_b1_w); + DECLARE_WRITE8_MEMBER(kbd_put); + I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); + UINT8 m_term_data; + virtual void machine_reset(); +}; + +READ8_MEMBER( ipds_state::ipds_b0_r ) +{ + if (m_term_data) + return 0xc0; + else + return 0x80; +} + +READ8_MEMBER( ipds_state::ipds_b1_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( ipds_state::ipds_c0_r ) { return 0x55; } + +WRITE8_MEMBER( ipds_state::ipds_b1_w ) +{ +} + +static ADDRESS_MAP_START(ipds_mem, AS_PROGRAM, 8, ipds_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ipds_io, AS_IO, 8, ipds_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xb0, 0xb0) AM_READ(ipds_b0_r) + AM_RANGE(0xb1, 0xb1) AM_READWRITE(ipds_b1_r,ipds_b1_w) + AM_RANGE(0xc0, 0xc0) AM_READ(ipds_c0_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ipds ) +INPUT_PORTS_END + +void ipds_state::machine_reset() +{ +} + +I8275_DRAW_CHARACTER_MEMBER( ipds_state::crtc_display_pixels ) +{ + int i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 *charmap = memregion("chargen")->base(); + UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; + + if (vsp) + pixels = 0; + + if (lten) + pixels = 0xff; + + if (rvv) + pixels ^= 0xff; + + for(i=0;i<6;i++) + bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; +} + +/* F4 Character Displayer */ +static const gfx_layout ipds_charlayout = +{ + 8, 11, /* 8 x 11 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( ipds ) + GFXDECODE_ENTRY( "chargen", 0x0000, ipds_charlayout, 0, 1 ) +GFXDECODE_END + + +WRITE8_MEMBER( ipds_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( ipds, ipds_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8085A, XTAL_19_6608MHz / 4) + MCFG_CPU_PROGRAM_MAP(ipds_mem) + MCFG_CPU_IO_MAP(ipds_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ipds) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_DEVICE_ADD("i8275", I8275, XTAL_19_6608MHz / 4) + MCFG_I8275_CHARACTER_WIDTH(6) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(ipds_state, crtc_display_pixels) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(ipds_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ipds ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "164180.bin", 0x0000, 0x0800, CRC(10ba23ce) SHA1(67a9d03a08cdd7c70a867fb7e069703c7a0b9094) ) + + ROM_REGION( 0x10000, "slavecpu", ROMREGION_ERASEFF ) + ROM_LOAD( "164196.bin", 0x0000, 0x1000, CRC(d3e18bc6) SHA1(01bc233be154bdfea9e8015839c5885cdaa08f11) ) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "163642.bin", 0x0000, 0x0800, CRC(3d81b2d1) SHA1(262a42920f15f1156ad0717c876cc0b2ed947ec5) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, ipds, 0, 0, ipds, ipds, driver_device, 0, "Intel", "iPDS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/iq151.c b/src/mame/drivers/iq151.c new file mode 100644 index 00000000000..f6acd08bdd4 --- /dev/null +++ b/src/mame/drivers/iq151.c @@ -0,0 +1,476 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + IQ-151 + + 12/05/2009 Skeleton driver. + + 07/June/2011 Added screen & keyboard (by looking at the Z80 code) + + +This computer depends on RAM just happening to be certain values at powerup. +If the conditions are not met, it may crash. + +Monitor Commands: +C Call (address) +D Dump memory, any key to dump more, Return to finish +F Fill memory (start, end, withwhat) +G Goto (address) +L Cassette load +M Move (source start, source end, destination) +R Run +S Edit memory +W Cassette save (start, end, goto (0 for null)) +X Display/Edit registers + + +ToDo: +- Add whatever devices may exist. + +- Line 32 does not scroll, should it show? + (could be reserved for a status line in a terminal mode) + +- Note that the system checks for 3E at C000, if exist, jump to C000; + otherwise then checks for non-FF at C800, if so, jumps to C800. Could be + extra roms or some sort of boot device. + +- Key beep sounds better if clock speed changed to 1MHz, but it is still + highly annoying. Press Ctrl-G to hear the 2-tone bell. + +- Cassette support is tested only in the emulator (monitor, BASIC and AMOS), + needs to be tested with a real cassette dump. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/pic8259.h" +#include "machine/i8255.h" +#include "sound/speaker.h" +#include "imagedev/cassette.h" + +// cartridge slot +#include "bus/iq151/iq151.h" +#include "bus/iq151/rom.h" +#include "bus/iq151/disc2.h" +#include "bus/iq151/minigraf.h" +#include "bus/iq151/ms151a.h" +#include "bus/iq151/staper.h" +#include "bus/iq151/grafik.h" +#include "bus/iq151/video32.h" +#include "bus/iq151/video64.h" + + + +class iq151_state : public driver_device +{ +public: + iq151_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pic(*this, "pic8259"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette") + { } + + required_device m_maincpu; + required_device m_pic; + required_device m_speaker; + required_device m_cassette; + + DECLARE_READ8_MEMBER(keyboard_row_r); + DECLARE_READ8_MEMBER(keyboard_column_r); + DECLARE_READ8_MEMBER(ppi_portc_r); + DECLARE_WRITE8_MEMBER(ppi_portc_w); + DECLARE_WRITE8_MEMBER(boot_bank_w); + DECLARE_READ8_MEMBER(cartslot_r); + DECLARE_WRITE8_MEMBER(cartslot_w); + DECLARE_READ8_MEMBER(cartslot_io_r); + DECLARE_WRITE8_MEMBER(cartslot_io_w); + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + UINT8 m_vblank_irq_state; + UINT8 m_cassette_clk; + UINT8 m_cassette_data; + iq151cart_slot_device * m_carts[5]; + DECLARE_DRIVER_INIT(iq151); + INTERRUPT_GEN_MEMBER(iq151_vblank_interrupt); + DECLARE_INPUT_CHANGED_MEMBER(iq151_break); + TIMER_DEVICE_CALLBACK_MEMBER(cassette_timer); +}; + +READ8_MEMBER(iq151_state::keyboard_row_r) +{ + char kbdrow[6]; + UINT8 data = 0xff; + + for (int i = 0; i < 8; i++) + { + sprintf(kbdrow,"X%X",i); + data &= ioport(kbdrow)->read(); + } + + return data; +} + +READ8_MEMBER(iq151_state::keyboard_column_r) +{ + char kbdrow[6]; + UINT8 data = 0x00; + + for (int i = 0; i < 8; i++) + { + sprintf(kbdrow,"X%X",i); + if (ioport(kbdrow)->read() == 0xff) + data |= (1 << i); + } + + return data; +} + +READ8_MEMBER(iq151_state::ppi_portc_r) +{ + UINT8 data = 0x00; + + if (m_cassette_data & 0x06) + { + // cassette read + data |= ((m_cassette_clk & 1) << 5); + data |= (m_cassette->input() > 0.00 ? 0x80 : 0x00); + } + else + { + // kb read + data = ioport("X8")->read(); + } + + return (data & 0xf0) | (m_cassette_data & 0x0f); +} + + +WRITE8_MEMBER(iq151_state::ppi_portc_w) +{ + m_speaker->level_w(BIT(data, 3)); + m_cassette_data = data; +} + +WRITE8_MEMBER(iq151_state::boot_bank_w) +{ + membank("boot")->set_entry(data & 1); +} + + +//************************************************************************** +// Cartridge slot emulation +//************************************************************************** + +READ8_MEMBER(iq151_state::cartslot_r) +{ + UINT8 data = 0xff; + + for (int i=0; i<5; i++) + m_carts[i]->read(offset, data); + + return data; +} + +WRITE8_MEMBER(iq151_state::cartslot_w) +{ + for (int i=0; i<5; i++) + m_carts[i]->write(offset, data); +} + +READ8_MEMBER(iq151_state::cartslot_io_r) +{ + UINT8 data = 0xff; + + for (int i=0; i<5; i++) + m_carts[i]->io_read(offset, data); + + return data; +} + +WRITE8_MEMBER(iq151_state::cartslot_io_w) +{ + for (int i=0; i<5; i++) + m_carts[i]->io_write(offset, data); +} + +static ADDRESS_MAP_START(iq151_mem, AS_PROGRAM, 8, iq151_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("boot") + AM_RANGE( 0x0800, 0x7fff ) AM_RAM + AM_RANGE( 0xf000, 0xffff ) AM_ROM + + AM_RANGE( 0x0000, 0xffff ) AM_READWRITE(cartslot_r, cartslot_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(iq151_io, AS_IO, 8, iq151_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x80, 0x80 ) AM_WRITE(boot_bank_w) + AM_RANGE( 0x84, 0x87 ) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) + AM_RANGE( 0x88, 0x89 ) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) + + AM_RANGE( 0x00, 0xff ) AM_READWRITE(cartslot_io_r, cartslot_io_w) +ADDRESS_MAP_END + + +INPUT_CHANGED_MEMBER(iq151_state::iq151_break) +{ + m_pic->ir5_w(newval & 1); +} + +/* Input ports */ +static INPUT_PORTS_START( iq151 ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DL") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("IL") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_END) // its actually some sort of graphic character + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("X8") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FA") PORT_CODE(KEYCODE_RSHIFT) // Function A + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FB") PORT_CODE(KEYCODE_RCONTROL) // Function B + + PORT_START("BREAK") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, iq151_state, iq151_break, 0) PORT_CHAR(UCHAR_MAMEKEY(ESC)) +INPUT_PORTS_END + + +INTERRUPT_GEN_MEMBER(iq151_state::iq151_vblank_interrupt) +{ + m_pic->ir6_w(m_vblank_irq_state & 1); + m_vblank_irq_state ^= 1; +} + +TIMER_DEVICE_CALLBACK_MEMBER(iq151_state::cassette_timer) +{ + m_cassette_clk ^= 1; + + m_cassette->output((m_cassette_data & 1) ^ (m_cassette_clk & 1) ? +1 : -1); +} + +DRIVER_INIT_MEMBER(iq151_state,iq151) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entry(0, RAM + 0xf800); + membank("boot")->configure_entry(1, RAM + 0x0000); + + // keep machine pointers to slots + m_carts[0] = machine().device("slot1"); + m_carts[1] = machine().device("slot2"); + m_carts[2] = machine().device("slot3"); + m_carts[3] = machine().device("slot4"); + m_carts[4] = machine().device("slot5"); +} + +void iq151_state::machine_reset() +{ + membank("boot")->set_entry(0); + + m_vblank_irq_state = 0; +} + +// this machine don't have a built-in video controller, but uses external cartridge +UINT32 iq151_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0, cliprect); + + for (int i=0; i<5; i++) + m_carts[i]->video_update(bitmap, cliprect); + + return 0; +} + +static SLOT_INTERFACE_START(iq151_cart) + SLOT_INTERFACE("video32", IQ151_VIDEO32) // video32 + SLOT_INTERFACE("video64", IQ151_VIDEO64) // video64 + SLOT_INTERFACE("grafik" , IQ151_GRAFIK) // Grafik + SLOT_INTERFACE("disc2" , IQ151_DISC2) // Disc 2 + SLOT_INTERFACE("minigraf" , IQ151_MINIGRAF) // Aritma Minigraf 0507 + SLOT_INTERFACE("ms151a" , IQ151_MS151A) // MS151A XY Plotter + SLOT_INTERFACE("staper" , IQ151_STAPER) // STAPER + SLOT_INTERFACE("basic6" , IQ151_BASIC6) // BASIC6 + SLOT_INTERFACE("basicg" , IQ151_BASICG) // BASICG + SLOT_INTERFACE("amos1" , IQ151_AMOS1) // AMOS cart 1 + SLOT_INTERFACE("amos2" , IQ151_AMOS2) // AMOS cart 2 + SLOT_INTERFACE("amos3" , IQ151_AMOS3) // AMOS cart 3 +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( iq151, iq151_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(iq151_mem) + MCFG_CPU_IO_MAP(iq151_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", iq151_state, iq151_vblank_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(iq151_state, screen_update) + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 32*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(iq151_state, keyboard_row_r)) + MCFG_I8255_IN_PORTB_CB(READ8(iq151_state, keyboard_column_r)) + MCFG_I8255_IN_PORTC_CB(READ8(iq151_state, ppi_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(iq151_state, ppi_portc_w)) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) + MCFG_CASSETTE_INTERFACE("iq151_cass") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", iq151_state, cassette_timer, attotime::from_hz(2000)) + + /* cartridge */ + MCFG_DEVICE_ADD("slot1", IQ151CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, NULL, false) + MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) + MCFG_DEVICE_ADD("slot2", IQ151CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, NULL, false) + MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) + MCFG_DEVICE_ADD("slot3", IQ151CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, NULL, false) + MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) + MCFG_DEVICE_ADD("slot4", IQ151CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, NULL, false) + MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) + MCFG_DEVICE_ADD("slot5", IQ151CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, "video32", false) + MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "iq151_cart") + MCFG_SOFTWARE_LIST_ADD("flop_list", "iq151_flop") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( iq151 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE ) + /* A number of bios versions here. The load address is shown for each */ + ROM_SYSTEM_BIOS( 0, "orig", "Original" ) + ROMX_LOAD( "iq151_monitor_orig.rom", 0xf000, 0x1000, CRC(acd10268) SHA1(4d75c73f155ed4dc2ac51a9c22232f869cca95e2),ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "disasm", "Disassembler" ) + ROMX_LOAD( "iq151_monitor_disasm.rom", 0xf000, 0x1000, CRC(45c2174e) SHA1(703e3271a124c3ef9330ae399308afd903316ab9),ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "cpm", "CPM" ) + ROMX_LOAD( "iq151_monitor_cpm.rom", 0xf000, 0x1000, CRC(26f57013) SHA1(4df396edc375dd2dd3c82c4d2affb4f5451066f1),ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "cpmold", "CPM (old)" ) + ROMX_LOAD( "iq151_monitor_cpm_old.rom", 0xf000, 0x1000, CRC(6743e1b7) SHA1(ae4f3b1ba2511a1f91c4e8afdfc0e5aeb0fb3a42),ROM_BIOS(4)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, iq151, 0, 0, iq151, iq151, iq151_state, iq151, "ZPA Novy Bor", "IQ-151", 0 ) diff --git a/src/mame/drivers/irisha.c b/src/mame/drivers/irisha.c new file mode 100644 index 00000000000..be633aa7bce --- /dev/null +++ b/src/mame/drivers/irisha.c @@ -0,0 +1,441 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Irisha driver by Miodrag Milanovic + + 2008-03-27 Preliminary driver. + + Jump addresses: + Option 1: 0800 (Monitor - the only choice that works) + Option 2: 046E + Option 3: 0423 (then jumps to 4000) + Option 4: 0501 + Option 5: 042E + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/i8251.h" +#include "sound/speaker.h" + +class irisha_state : public driver_device +{ +public: + irisha_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_pit(*this, "pit8253"), + m_speaker(*this, "speaker"), + m_uart(*this, "uart") + { + } + + DECLARE_READ8_MEMBER(irisha_keyboard_r); + DECLARE_READ8_MEMBER(irisha_8255_portb_r); + DECLARE_READ8_MEMBER(irisha_8255_portc_r); + DECLARE_WRITE8_MEMBER(irisha_8255_porta_w); + DECLARE_WRITE8_MEMBER(irisha_8255_portb_w); + DECLARE_WRITE8_MEMBER(irisha_8255_portc_w); + DECLARE_WRITE_LINE_MEMBER(speaker_w); + DECLARE_WRITE_LINE_MEMBER(write_uart_clock); + TIMER_CALLBACK_MEMBER(irisha_key); + DECLARE_WRITE_LINE_MEMBER(irisha_pic_set_int_line); + UINT32 screen_update_irisha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; + +private: + bool m_sg1_line; + bool m_keypressed; + UINT8 m_keyboard_cnt; + UINT8 m_ppi_porta; + UINT8 m_ppi_portc; + void update_speaker(); + virtual void machine_start(); + virtual void machine_reset(); + ioport_port *m_io_ports[10]; + required_device m_maincpu; + required_device m_pit; + required_device m_speaker; + required_device m_uart; +}; + + +/* Address maps */ +static ADDRESS_MAP_START(irisha_mem, AS_PROGRAM, 8, irisha_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM // ROM + AM_RANGE(0x4000, 0xdfff) AM_RAM // RAM + AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( irisha_io , AS_IO, 8, irisha_state ) + AM_RANGE(0x04, 0x05) AM_READ(irisha_keyboard_r) + AM_RANGE(0x06, 0x06) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) + AM_RANGE(0x07, 0x07) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x08, 0x0B) AM_DEVREADWRITE("pit8253", pit8253_device, read, write ) + AM_RANGE(0x0C, 0x0F) AM_DEVREADWRITE("pic8259", pic8259_device, read, write ) AM_MASK( 0x01 ) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( irisha ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('\xA6') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) // + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) +INPUT_PORTS_END + +/************************************************* + + Video + +*************************************************/ + +UINT32 irisha_state::screen_update_irisha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 gfx; + UINT16 y,ma=0,x; + UINT16 *p; + + for (y = 0; y < 200; y++) + { + p = &bitmap.pix16(y); + + for (x = ma; x < ma+40; x++) + { + gfx = m_p_videoram[x]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + ma+=40; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout irisha_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( irisha ) + GFXDECODE_ENTRY( "maincpu", 0x3800, irisha_charlayout, 0, 1 ) +GFXDECODE_END + + +/************************************************* + + i8255 + +*************************************************/ + +READ8_MEMBER(irisha_state::irisha_8255_portb_r) +{ + if (m_keypressed==1) + { + m_keypressed = 0; + return 0x80; + } + + return 0x00; +} + +READ8_MEMBER(irisha_state::irisha_8255_portc_r) +{ + logerror("irisha_8255_portc_r\n"); + return 0; +} + +WRITE8_MEMBER(irisha_state::irisha_8255_porta_w) +{ + logerror("irisha_8255_porta_w %02x\n",data); + + m_ppi_porta = data; + + update_speaker(); +} + +WRITE8_MEMBER(irisha_state::irisha_8255_portb_w) +{ + logerror("irisha_8255_portb_w %02x\n",data); +} + +WRITE8_MEMBER(irisha_state::irisha_8255_portc_w) +{ + //logerror("irisha_8255_portc_w %02x\n",data); + + if BIT(data, 6) + m_pit->write_gate2((BIT(m_ppi_porta, 5) && !BIT(data, 5)) ? 1 : 0); + + m_ppi_portc = data; + + update_speaker(); +} + +/************************************************* + + i8259 + +*************************************************/ + +WRITE_LINE_MEMBER(irisha_state::irisha_pic_set_int_line) +{ + m_maincpu->set_input_line(0, state ? HOLD_LINE : CLEAR_LINE); +} + + +/************************************************* + + Sound + +*************************************************/ + +void irisha_state::update_speaker() +{ + int level = ( (BIT(m_ppi_portc, 5)) || (BIT(m_ppi_porta, 4)) || !m_sg1_line) ? 1 : 0; + + m_speaker->level_w(level); +} + + +WRITE_LINE_MEMBER(irisha_state::speaker_w) +{ + m_sg1_line = state; + update_speaker(); +} + + +/************************************************* + + Keyboard + +*************************************************/ + +TIMER_CALLBACK_MEMBER(irisha_state::irisha_key) +{ + m_keypressed = 1; + m_keyboard_cnt = 0; +} + +READ8_MEMBER(irisha_state::irisha_keyboard_r) +{ + UINT8 keycode; + + if (m_keyboard_cnt!=0 && m_keyboard_cnt<11) + keycode = m_io_ports[m_keyboard_cnt-1]->read() ^ 0xff; + else + keycode = 0xff; + + m_keyboard_cnt++; + + return keycode; +} + +WRITE_LINE_MEMBER(irisha_state::write_uart_clock) +{ + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + + +/************************************************* + + Machine + +*************************************************/ + +void irisha_state::machine_start() +{ + static const char *const keynames[] = { + "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", + "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" + }; + + for ( UINT8 i = 0; i < 10; i++ ) + m_io_ports[i] = ioport( keynames[i] ); + + machine().scheduler().timer_pulse(attotime::from_msec(30), timer_expired_delegate(FUNC(irisha_state::irisha_key),this)); +} + +void irisha_state::machine_reset() +{ + m_sg1_line = 0; + m_keypressed = 0; + m_keyboard_cnt = 0; + m_ppi_porta = 0; + m_ppi_portc = 0; +} + +/* Machine driver */ +static MACHINE_CONFIG_START( irisha, irisha_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, XTAL_16MHz / 9) + MCFG_CPU_PROGRAM_MAP(irisha_mem) + MCFG_CPU_IO_MAP(irisha_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(irisha_state, screen_update_irisha) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", irisha) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("uart", I8251, 0) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_16MHz / 9) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_16MHz / 9 / 8 / 8) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(irisha_state, write_uart_clock)) + MCFG_PIT8253_CLK2(XTAL_16MHz / 9) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(irisha_state, speaker_w)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(irisha_state, irisha_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(irisha_state, irisha_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(irisha_state, irisha_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(irisha_state, irisha_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(irisha_state, irisha_8255_portc_w)) + + MCFG_PIC8259_ADD( "pic8259", WRITELINE(irisha_state,irisha_pic_set_int_line), VCC, NULL ) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( irisha ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ir_bootm.bin", 0x0000, 0x2000, CRC(7f9f4f0e) SHA1(05f97e1a1d7a15f4451129dba6c0bddc87ea748e)) + ROM_LOAD( "ir_conou.bin", 0x2000, 0x2000, CRC(bf92beed) SHA1(696c482ba53bc6261db11061ecc7141c67f1d820)) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, irisha, 0, 0, irisha, irisha, driver_device, 0, "MGU", "Irisha", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/isbc.c b/src/mame/drivers/isbc.c new file mode 100644 index 00000000000..d7a9ba149e0 --- /dev/null +++ b/src/mame/drivers/isbc.c @@ -0,0 +1,367 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Intel iSBC series + + 09/12/2009 Skeleton driver. + +Notes: + +isbc86 commands: BYTE WORD REAL EREAL ROMTEST. ROMTEST works, the others hang. + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/i86/i86.h" +#include "cpu/i86/i286.h" +#include "machine/terminal.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "machine/z80dart.h" +#include "bus/centronics/ctronics.h" +#include "bus/isbx/isbx.h" +#include "machine/isbc_215g.h" + +class isbc_state : public driver_device +{ +public: + isbc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_uart8251(*this, "uart8251"), + m_uart8274(*this, "uart8274"), + m_pic_0(*this, "pic_0"), + m_pic_1(*this, "pic_1"), + m_centronics(*this, "centronics"), + m_cent_status_in(*this, "cent_status_in") + { + } + + required_device m_maincpu; + optional_device m_uart8251; + optional_device m_uart8274; + required_device m_pic_0; + optional_device m_pic_1; + optional_device m_centronics; + optional_device m_cent_status_in; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + + DECLARE_WRITE_LINE_MEMBER(isbc86_tmr2_w); + DECLARE_WRITE_LINE_MEMBER(isbc286_tmr2_w); + DECLARE_WRITE_LINE_MEMBER(isbc_uart8274_irq); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE8_MEMBER(ppi_c_w); +}; + +static ADDRESS_MAP_START(rpc86_mem, AS_PROGRAM, 16, isbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x3ffff) AM_RAM + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(rpc86_io, AS_IO, 16, isbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0080, 0x008f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) + AM_RANGE(0x0090, 0x009f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) + AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) + AM_RANGE(0x00b0, 0x00bf) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) + AM_RANGE(0x00c0, 0x00c3) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x00c4, 0x00c7) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x00c8, 0x00cf) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) + AM_RANGE(0x00d0, 0x00d7) AM_DEVREADWRITE8("pit", pit8253_device, read, write, 0x00ff) + AM_RANGE(0x00d8, 0x00d9) AM_DEVREADWRITE8("uart8251", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0x00da, 0x00db) AM_DEVREADWRITE8("uart8251", i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0x00dc, 0x00dd) AM_DEVREADWRITE8("uart8251", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0x00de, 0x00df) AM_DEVREADWRITE8("uart8251", i8251_device, status_r, control_w, 0x00ff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(isbc86_mem, AS_PROGRAM, 16, isbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0xfbfff) AM_RAM + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(isbc_io, AS_IO, 16, isbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00c0, 0x00c3) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x00c4, 0x00c7) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x00c8, 0x00cf) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) + AM_RANGE(0x00d0, 0x00d7) AM_DEVREADWRITE8("pit", pit8253_device, read, write, 0x00ff) + AM_RANGE(0x00d8, 0x00d9) AM_DEVREADWRITE8("uart8251", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0x00da, 0x00db) AM_DEVREADWRITE8("uart8251", i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0x00dc, 0x00dd) AM_DEVREADWRITE8("uart8251", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0x00de, 0x00df) AM_DEVREADWRITE8("uart8251", i8251_device, status_r, control_w, 0x00ff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(isbc286_io, AS_IO, 16, isbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0080, 0x008f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) + AM_RANGE(0x0080, 0x008f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs0_r, mcs0_w, 0xff00) + AM_RANGE(0x0090, 0x009f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) + AM_RANGE(0x0090, 0x009f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs1_r, mcs1_w, 0xff00) + AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) + AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs0_r, mcs0_w, 0xff00) + AM_RANGE(0x00b0, 0x00bf) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) + AM_RANGE(0x00b0, 0x00bf) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs1_r, mcs1_w, 0xff00) + AM_RANGE(0x00c0, 0x00c3) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x00c4, 0x00c7) AM_DEVREADWRITE8("pic_1", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x00c8, 0x00cf) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) + AM_RANGE(0x00d0, 0x00d7) AM_DEVREADWRITE8("pit", pit8254_device, read, write, 0x00ff) + AM_RANGE(0x00d8, 0x00df) AM_DEVREADWRITE8("uart8274", i8274_device, cd_ba_r, cd_ba_w, 0x00ff) + AM_RANGE(0x0100, 0x0101) AM_DEVWRITE8("isbc_215g", isbc_215g_device, write, 0x00ff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(isbc286_mem, AS_PROGRAM, 16, isbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0xdffff) AM_RAM + AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION("user1",0) + AM_RANGE(0xfe0000, 0xffffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(isbc2861_mem, AS_PROGRAM, 16, isbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0xdffff) AM_RAM + AM_RANGE(0xf0000, 0xfffff) AM_ROM AM_REGION("user1",0) + AM_RANGE(0xff0000, 0xffffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( isbc ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START( isbc86_terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_300 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_300 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) +DEVICE_INPUT_DEFAULTS_END + +static DEVICE_INPUT_DEFAULTS_START( isbc286_terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +WRITE_LINE_MEMBER( isbc_state::isbc86_tmr2_w ) +{ + m_uart8251->write_rxc(state); + m_uart8251->write_txc(state); +} + +READ8_MEMBER( isbc_state::get_slave_ack ) +{ + if (offset == 7) + return m_pic_1->acknowledge(); + + return 0x00; +} + +WRITE_LINE_MEMBER( isbc_state::isbc286_tmr2_w ) +{ + m_uart8274->rxca_w(state); + m_uart8274->txca_w(state); +} + +WRITE_LINE_MEMBER( isbc_state::write_centronics_ack ) +{ + m_cent_status_in->write_bit4(state); + + if(state) + m_pic_1->ir7_w(1); +} + +WRITE8_MEMBER( isbc_state::ppi_c_w ) +{ + m_centronics->write_strobe(data & 1); + + if(data & 0x80) + m_pic_1->ir7_w(0); +} + +WRITE_LINE_MEMBER(isbc_state::isbc_uart8274_irq) +{ + m_uart8274->m1_r(); // always set + m_pic_0->ir6_w(state); +} + +static MACHINE_CONFIG_START( isbc86, isbc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(isbc86_mem) + MCFG_CPU_IO_MAP(isbc_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb) + + MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, NULL) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_22_1184MHz/18) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_22_1184MHz/18) + MCFG_PIT8253_CLK2(XTAL_22_1184MHz/18) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(isbc_state, isbc86_tmr2_w)) + + MCFG_DEVICE_ADD("ppi", I8255A, 0) + + MCFG_DEVICE_ADD("uart8251", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir6_w)) + + /* video hardware */ + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_cts)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", isbc86_terminal) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( rpc86, isbc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_5MHz) + MCFG_CPU_PROGRAM_MAP(rpc86_mem) + MCFG_CPU_IO_MAP(rpc86_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb) + + MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, NULL) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_22_1184MHz/18) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir2_w)) + MCFG_PIT8253_CLK1(XTAL_22_1184MHz/144) + MCFG_PIT8253_CLK2(XTAL_22_1184MHz/18) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(isbc_state, isbc86_tmr2_w)) + + MCFG_DEVICE_ADD("ppi", I8255A, 0) + + MCFG_DEVICE_ADD("uart8251", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir6_w)) + + /* video hardware */ + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + + MCFG_ISBX_SLOT_ADD("sbx1", 0, isbx_cards, NULL) + //MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_0", pic8259_device, ir3_w)) + //MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_0", pic8259_device, ir4_w)) + MCFG_ISBX_SLOT_ADD("sbx2", 0, isbx_cards, NULL) + //MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_0", pic8259_device, ir5_w)) + //MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_0", pic8259_device, ir6_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( isbc286, isbc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, XTAL_16MHz/2) + MCFG_CPU_PROGRAM_MAP(isbc286_mem) + MCFG_CPU_IO_MAP(isbc286_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb) + + MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, READ8(isbc_state, get_slave_ack)) + MCFG_PIC8259_ADD("pic_1", DEVWRITELINE("pic_0", pic8259_device, ir7_w), GND, NULL) + + MCFG_DEVICE_ADD("pit", PIT8254, 0) + MCFG_PIT8253_CLK0(XTAL_22_1184MHz/18) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_22_1184MHz/18) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("uart8274", z80dart_device, rxtxcb_w)) + MCFG_PIT8253_CLK2(XTAL_22_1184MHz/18) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(isbc_state, isbc286_tmr2_w)) + + MCFG_DEVICE_ADD("ppi", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_IN_PORTB_CB(DEVREAD8("cent_status_in", input_buffer_device, read)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(isbc_state, ppi_c_w)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(isbc_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) + MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit6)) + + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_I8274_ADD("uart8274", XTAL_16MHz/4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232a", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232a", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232a", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(WRITELINE(isbc_state, isbc_uart8274_irq)) + + MCFG_RS232_PORT_ADD("rs232a", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8274", z80dart_device, ctsa_w)) + + MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, dcdb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8274", z80dart_device, ctsb_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", isbc286_terminal) + + MCFG_ISBX_SLOT_ADD("sbx1", 0, isbx_cards, NULL) + MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir3_w)) + MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir4_w)) + MCFG_ISBX_SLOT_ADD("sbx2", 0, isbx_cards, NULL) + MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir5_w)) + MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir6_w)) + + MCFG_ISBC_215_ADD("isbc_215g", 0x100, "maincpu") + MCFG_ISBC_215_IRQ(DEVWRITELINE("pic_0", pic8259_device, ir5_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( isbc2861, isbc286 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(isbc2861_mem) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( isbc86 ) + ROM_REGION( 0x4000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "8612_2u.bin", 0x0001, 0x1000, CRC(84fa14cf) SHA1(783e1459ab121201fd49368d4bf769c1bab6447a)) + ROM_LOAD16_BYTE( "8612_2l.bin", 0x0000, 0x1000, CRC(922bda5f) SHA1(15743e69f3aba56425fa004d19b82ec20532fd72)) + ROM_LOAD16_BYTE( "8612_3u.bin", 0x2001, 0x1000, CRC(68d47c3e) SHA1(16c17f26b33daffa84d065ff7aefb581544176bd)) + ROM_LOAD16_BYTE( "8612_3l.bin", 0x2000, 0x1000, CRC(17f27ad2) SHA1(c3f379ac7d67dc4a0a7a611a0bc6323b8a3d4840)) +ROM_END + +ROM_START( isbc286 ) + ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "u79.bin", 0x00001, 0x10000, CRC(144182ea) SHA1(4620ca205a6ac98fe2636183eaead7c4bfaf7a72)) + ROM_LOAD16_BYTE( "u36.bin", 0x00000, 0x10000, CRC(22db075f) SHA1(fd29ea77f5fc0697c8f8b66aca549aad5b9db3ea)) +ROM_END + +ROM_START( isbc2861 ) + ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "174894-001.bin", 0x0000, 0x4000, CRC(79e4f7af) SHA1(911a4595d35e6e82b1149e75bb027927cd1c1658)) + ROM_LOAD16_BYTE( "174894-002.bin", 0x0001, 0x4000, CRC(66747d21) SHA1(4094b1f10a8bc7db8d6dd48d7128e14e875776c7)) + ROM_LOAD16_BYTE( "174894-003.bin", 0x8000, 0x4000, CRC(c98c7f17) SHA1(6e9a14aedd630824dccc5eb6052867e73b1d7db6)) + ROM_LOAD16_BYTE( "174894-004.bin", 0x8001, 0x4000, CRC(61bc1dc9) SHA1(feed5a5f0bb4630c8f6fa0d5cca30654a80b4ee5)) +ROM_END + +ROM_START( rpc86 ) + ROM_REGION( 0x4000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "145068-001.bin", 0x0001, 0x1000, CRC(0fa9db83) SHA1(4a44f8683c263c9ef6850cbe05aaa73f4d4d4e06)) + ROM_LOAD16_BYTE( "145069-001.bin", 0x2001, 0x1000, CRC(1692a076) SHA1(0ce3a4a867cb92340871bb8f9c3e91ce2984c77c)) + ROM_LOAD16_BYTE( "145070-001.bin", 0x0000, 0x1000, CRC(8c8303ef) SHA1(60f94daa76ab9dea6e309ac580152eb212b847a0)) + ROM_LOAD16_BYTE( "145071-001.bin", 0x2000, 0x1000, CRC(a49681d8) SHA1(e81f8b092cfa2d1737854b1fa270a4ce07d61a9f)) +ROM_END +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, rpc86, 0, 0, rpc86, isbc, driver_device, 0, "Intel", "RPC 86",MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1978, isbc86, 0, 0, isbc86, isbc, driver_device, 0, "Intel", "iSBC 86/12A",MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 19??, isbc286, 0, 0, isbc286, isbc, driver_device, 0, "Intel", "iSBC 286",MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1983, isbc2861, 0, 0, isbc2861, isbc, driver_device, 0, "Intel", "iSBC 286/10",MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/iskr103x.c b/src/mame/drivers/iskr103x.c new file mode 100644 index 00000000000..31aae050f61 --- /dev/null +++ b/src/mame/drivers/iskr103x.c @@ -0,0 +1,146 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + drivers/iskr103x.c + + Driver file for Iskra-1030, 1031 + + TODO + - fix cyrillic chargen upload for CGA and MDA + - replace DIP switch definition + - keyboard test is not passing (code 301) + - hard disk is connected but untested + +***************************************************************************/ + + +#include "emu.h" + +#include "includes/genpc.h" + +#include "cpu/i86/i86.h" +#include "cpu/nec/nec.h" +#include "bus/isa/xsu_cards.h" +#include "bus/pc_kbd/keyboards.h" +#include "machine/pc_lpt.h" +#include "machine/ram.h" + +#define DBG_LOG(a,b,c) + +class iskr103x_state : public driver_device +{ +public: + iskr103x_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + required_device m_maincpu; +}; + +static ADDRESS_MAP_START( iskr1031_map, AS_PROGRAM, 16, iskr103x_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(iskr1031_io, AS_IO, 16, iskr103x_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + + +static INPUT_PORTS_START( iskr1030m ) +INPUT_PORTS_END + +static INPUT_PORTS_START( iskr1031 ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START(iskr1030m) + DEVICE_INPUT_DEFAULTS("DSW0", 0x31, 0x21) +DEVICE_INPUT_DEFAULTS_END + +static DEVICE_INPUT_DEFAULTS_START(iskr1031) + DEVICE_INPUT_DEFAULTS("DSW0", 0x30, 0x20) +DEVICE_INPUT_DEFAULTS_END + +// XXX +static MACHINE_CONFIG_START( iskr1030m, iskr103x_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 4772720) + MCFG_CPU_PROGRAM_MAP(iskr1031_map) + MCFG_CPU_IO_MAP(iskr1031_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(iskr1030m) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", iskr103x_isa8_cards, "cga_iskr1030m", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", iskr103x_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", iskr103x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", iskr103x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", iskr103x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", iskr103x_isa8_cards, NULL, false) + + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) +// MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_ISKR_1030) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( iskr1031, iskr103x_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 4772720) + MCFG_CPU_PROGRAM_MAP(iskr1031_map) + MCFG_CPU_IO_MAP(iskr1031_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(iskr1031) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", iskr103x_isa8_cards, "cga_iskr1031", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", iskr103x_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", iskr103x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", iskr103x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", iskr103x_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", iskr103x_isa8_cards, NULL, false) + +// MCFG_SOFTWARE_LIST_ADD("flop_list", "iskr1031") + + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) +// MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_ISKR_1030) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + +ROM_START( iskr1030m ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROMX_LOAD( "iskra-1030m_0.rom", 0xfc000, 0x2000, CRC(0d698e19) SHA1(2fe117c9f4f8c4b59085d5a41f919d743c425fdd), ROM_SKIP(1)) + ROMX_LOAD( "iskra-1030m_1.rom", 0xfc001, 0x2000, CRC(fe808337) SHA1(b0b7ebe14324ada8aa9a6926a82b18e80f78a257), ROM_SKIP(1)) +ROM_END + +ROM_START( iskr1031 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "v1", "v1") + ROMX_LOAD( "150-02.bin", 0xfc000, 0x2000, CRC(e33fb974) SHA1(f5f3ece67c025c0033716ff516e1a34fbeb32749), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "150-03.bin", 0xfc001, 0x2000, CRC(8c482258) SHA1(90ef48955e0df556dc06a000a797ef42ccf430c5), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "v2") + ROMX_LOAD( "150-06.bin", 0xfc000, 0x2000, CRC(1adbf969) SHA1(08c0a0fc50a75e6207b1987bae389cca60893eac), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "150-07.bin", 0xfc001, 0x2000, CRC(0dc4b65a) SHA1(c96f066251a7343eac8113ea9dcb2cb12d0334d5), ROM_SKIP(1) | ROM_BIOS(2)) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1989, iskr1030m, ibm5150, 0, iskr1030m, iskr1030m, driver_device, 0, "Schetmash", "Iskra 1030M", MACHINE_NOT_WORKING) +COMP ( 1989, iskr1031, ibm5150, 0, iskr1031, iskr1031, driver_device, 0, "", "Iskra 1031", 0) diff --git a/src/mame/drivers/itt3030.c b/src/mame/drivers/itt3030.c new file mode 100644 index 00000000000..2a006a84259 --- /dev/null +++ b/src/mame/drivers/itt3030.c @@ -0,0 +1,819 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont, Olivier Galibert +/*************************************************************************** + + ITT 3030 + + + ToDo: + - Check Beeper + - finish hooking up keyboard + - According to the manual, the keyboard is based on a 8278 ... it's nowhere to be found. The keyboard / video card has a 8741 instead of which a ROM dump exists + - serial port + - daisy chain + - ... + + + CPU Board, all ICs shown: + + |-----------------------------------------------------------------| + | | + | 74LS640N Z80_Combo 74LS138N | + | 74LS00N | + | 74LS240N 74LS74AN | + | 74LS00N | + |C 74LS240N Z80_CPU 74LS240N C| + |N 74LS74AN N| + |1 74LS241N 74LS240N 2| + | ROM_1 74LS20N 74LS38N | + | 74LS240N 74LS240N | + | 74LS04N 74LS02N | + | 74LS138N 74LS74AN | + | 74LS175N | + | 75154N 74LS156N 74LS00N | + | 74LS123N | + | 75150P 75150P 74LS175N X1 74LS00N 74LS132N | + |-----------------------------------------------------------------| + + Z80_Combo: Mostek MK3886 Z80 Combo Chip, Serial, Timer, 256 bytes RAM, Interrupt Controller + Z80_CPU: Zilog Z80A CPU + ROM_1: NEC D2716D marked "BOOTV1.2" + X1: Crystal 4,194 MHz + CN1: Bus Connector + CN2: Memory Board Connector + +---------------------------------------------------------------------------------- + + Video / Keyboard Combination board, all ICs shown: + + |-----------------------------------------------------------------| + | | + | X1 74276N MCU_1 74LS85N | + | | + | 74LS138N 74LS240 74LS240N | + | 75LS257AN 74LS166AN | + | 74LS08N 74LS85N 74LS241N | + | 75LS257AN ROM_1 C| + | 74LS132N 74LS32N 74LS240N N| + | 75LS257AN 1| + | 74LS10N 74LS08N 74LS240N | + | 75LS257AN RAM_1 | + | 74LS163AN 74LS173AN 74LS374N | + | | + | 74LS86N 74LS240N 74LS640N | + | Video_1 | + | 74LS74AN 74LS240N 74LS640N | + |-----------------------------------------------------------------| + + X1: Crystal 6 MHz + MCU_1: NEC D8741AD marked "V1.1 3030" + ROM_1: MBM 2716 marked "GB 136-0" + RAM_1: NEC D4016D + Video_1 Video-IC SND5027E, compatible with TMS9927 + +---------------------------------------------------------------------------------- + + Floppy Controller board, all ICs shown + + |-----------------------------------------------------------------| + | | + | X1 74LS51N F 74LS74AN 74LS02N MC4044P | + | D 567 | + | 74LS04N C 74LS00N 74LS01N ::: MC4024P | + | | + | 74LS00N 1 74LS74AN 74LS74AN 74LS14N C| + | 7 N| + | 74LS240N 9 74LS161N 74LS393N 74LS74AN 1| + | 1 | + | 74LS132N 74LS14N 74LS14N 74LS374N | + | | + | 74LS123N 74LS04N 74LS163N 74LS14N 74LS241N | + | | + | 74LS393N 74LS138 74LS175N 74LS85N 74LS645N | + | | + |-----------------------------------------------------------------| + + X1: Crystal 8 MHz + FDC: Siemens SAB1791-02P + 567: Jumper Pad (emtpy) + +---------------------------------------------------------------------------------- + + 256K RAM board, all ICs shown: + + |-----------------------------------------------------------------| + | | + | HM4864P HM4864P HM4864P HM4864P 74LS245N | + | | + | HM4864P HM4864P HM4864P HM4864P P 74LS14N | + | R | + | HM4864P HM4864P HM4864P HM4864P M 74LS00N | + | C| + | HM4864P HM4864P HM4864P HM4864P AM A N| + | 29 M 1| + | HM4864P HM4864P HM4864P HM4864P 66 2 | + | PC 9 | + | HM4864P HM4864P HM4864P HM4864P 6 | + | AM 4 | + | HM4864P HM4864P HM4864P HM4864P 29 8 | + | 66 P | + | HM4864P HM4864P HM4864P HM4864P PC C | + | SN7474N | + |-----------------------------------------------------------------| + + PRM: N82S129F 1K Bipolar PROM + AM2966PC: Octal Dynamic Memory Drivers with Three-State Outputs + AM29648PC + CN1: Connector to CN2 of Z80 CPU card + +---------------------------------------------------------------------------------- + + Parallel I/O board, all ICs shown: + + |-------------------------------------| | + | | + | 74 74 | + | LS LS Z80A PIO | + | 00 14 | + | N N | + | | + | | + | 74 74 74 74 D4 74 | + | LS LS LS LS I3 LS | + | 13 14 24 85 P2 64 | + | 2N N 1N N 1 0N | + | | + | CN1 | + | | + | 74LS00N | + |-------------------------------------| + + CN1: Bus connector + DIP: 4x DIP current setting: off-on-on-off, sets the address for the parallel port + +---------------------------------------------------------------------------------- + +Beeper Circuit, all ICs shown: + + |---------------------------| | + | | + | BEEP 74LS132N | + | R1 | + | 74LS14N | + | | + | 74LS132N 74LS193N | + | | + | 74LS74AN 74LS165N | + | CN1 | + |---------------------------| + + CN1: Connector to mainboard + R1: looks like a potentiometer + BEEP: Beeper ... touted in the manual as "Hupe" ... i.e. "horn" :) + +---------------------------------------------------------------------------------- + + Other boards and extensions mentioned in the manual: + - S100 bus adapter board + - IEEE 488 bus adapter board + - 64K memory board + - 8086 CPU board + - external harddisk + - TV adapter B/W (TV, Save/Load from Audio Cassette) with PROM/RAM/BASIC-Module with 16K or 32K RAM + - TV adapter color with connection to Video / Keyboard combination card + - Monitor adapters B/W and color + - Video / Keyboard interface 2 with grayscale, 8 colors, loadable character set, blinking + - Graphics Adapter with 16 colours, hi-res 512x256 pixels + - RTC + - Arithmetics chip + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/wd_fdc.h" +#include "machine/bankdev.h" +#include "machine/ram.h" +#include "formats/itt3030_dsk.h" +#include "video/tms9927.h" //Display hardware +#include "sound/beep.h" +#include "cpu/mcs48/mcs48.h" //Keyboard MCU ... talks to the 8278 on the keyboard circuit + +#define MAIN_CLOCK XTAL_4.194MHz + +class itt3030_state : public driver_device +{ +public: + itt3030_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_kbdmcu(*this, "kbdmcu") + , m_ram(*this, "mainram") + , m_crtc(*this, "crt5027") + , m_48kbank(*this, "lowerbank") + , m_fdc (*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_beep(*this, "beeper") + , m_keyrow1(*this, "ROW1") + , m_keyrow2(*this, "ROW2") + , m_keyrow3(*this, "ROW3") + , m_keyrow4(*this, "ROW4") + , m_keyrow5(*this, "ROW5") + , m_keyrow6(*this, "ROW6") + , m_keyrow7(*this, "ROW7") + , m_keyrow8(*this, "ROW8") + , m_keyrow9(*this, "ROW9") + , m_keyrow10(*this, "ROW10") + , m_keyrow11(*this, "ROW11") + , m_keyrow12(*this, "ROW12") + , m_keyrow13(*this, "ROW13") + , m_keyrow14(*this, "ROW14") + , m_keyrow15(*this, "ROW15") + , m_keyrow16(*this, "ROW16") + , m_vram(*this, "vram"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + // devices + required_device m_maincpu; + required_device m_kbdmcu; + required_device m_ram; + required_device m_crtc; + required_device m_48kbank; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_beep; + + required_ioport m_keyrow1, m_keyrow2, m_keyrow3, m_keyrow4, m_keyrow5, m_keyrow6, m_keyrow7, m_keyrow8, m_keyrow9; + required_ioport m_keyrow10, m_keyrow11, m_keyrow12, m_keyrow13, m_keyrow14, m_keyrow15, m_keyrow16; + + // shared pointers + required_shared_ptr m_vram; + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); +public: + + DECLARE_READ8_MEMBER(vsync_r); + DECLARE_READ8_MEMBER(i8078_r); + DECLARE_WRITE8_MEMBER(i8078_w); + DECLARE_WRITE8_MEMBER( beep_w ); + DECLARE_WRITE8_MEMBER(bank_w); + DECLARE_READ8_MEMBER(bankl_r); + DECLARE_WRITE8_MEMBER(bankl_w); + DECLARE_READ8_MEMBER(bankh_r); + DECLARE_WRITE8_MEMBER(bankh_w); + DECLARE_READ8_MEMBER(kbd_fifo_r); + DECLARE_READ8_MEMBER(kbd_matrix_r); + DECLARE_WRITE8_MEMBER(kbd_matrix_w); + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); + DECLARE_READ8_MEMBER(fdc_stat_r); + DECLARE_WRITE8_MEMBER(fdc_cmd_w); + DECLARE_FLOPPY_FORMATS(itt3030_floppy_formats); + + DECLARE_WRITE_LINE_MEMBER(fdcirq_w); + DECLARE_WRITE_LINE_MEMBER(fdcdrq_w); + DECLARE_WRITE_LINE_MEMBER(fdchld_w); + +private: + UINT8 m_unk; + UINT8 m_bank; + UINT8 m_kbdrow, m_kbdcol, m_kbdclk, m_kbdread; + required_device m_gfxdecode; + required_device m_palette; + floppy_image_device *m_curfloppy; + bool m_fdc_irq, m_fdc_drq, m_fdc_hld; + floppy_connector *m_con1, *m_con2, *m_con3; + bool m_keyskip; +}; + +void itt3030_state::video_start() +{ + m_unk = 0x80; +} + +READ8_MEMBER(itt3030_state::vsync_r) +{ + UINT8 ret = 0; + + if (machine().first_screen()->vblank()) + { + ret |= 0xc0; // set both bits 6 and 7 if vblank + } + + if (machine().first_screen()->hblank()) + { + ret |= 0x80; // set only bit 7 if hblank + } + + return ret; +} + +// TODO: make this a correct device once we figure out how everything goes together in this system +READ8_MEMBER(itt3030_state::i8078_r) +{ + if (offset) + { +// printf("Read 8078 status\n"); + if (!m_keyskip) + { + return 0x10; + } + } + else + { +// printf("Read 8078 data\n"); + if (!m_keyskip) + { + m_keyskip = true; // don't keep reporting the 'b' key, just the once to trick the boot ROM + return 0x0c; + } + } + + return 0; +} + +WRITE8_MEMBER(itt3030_state::i8078_w) +{ + #if 0 + if (offset) + { + printf("%02x to 8078 command\n", data); + } + else + { + printf("%02x to 8078 data\n", data); + } + #endif +} + +WRITE8_MEMBER( itt3030_state::beep_w ) +{ + m_beep->set_state(data&0x32); +} + +WRITE8_MEMBER(itt3030_state::bank_w) +{ + int bank = 0; + m_bank = data>>4; + + if (!(m_bank & 1)) // bank 8 + { + bank = 8; + } + else + { + bank = m_bank >> 1; + } + +// printf("bank_w: new value %02x, m_bank %x, bank %x\n", data, m_bank, bank); + + m_48kbank->set_bank(bank); +} + +READ8_MEMBER(itt3030_state::bankl_r) +{ + return m_ram->read(offset); +} + +WRITE8_MEMBER(itt3030_state::bankl_w) +{ + m_ram->write(offset, data); +} + +READ8_MEMBER(itt3030_state::bankh_r) +{ + return m_ram->read(((m_bank>>1)*0x10000) + offset + 0xc000); +} + +WRITE8_MEMBER(itt3030_state::bankh_w) +{ + m_ram->write(((m_bank>>1)*0x10000) + offset + 0xc000, data); +} + +UINT32 itt3030_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for(int y = 0; y < 24; y++ ) + { + for(int x = 0; x < 80; x++ ) + { + UINT8 code = m_vram[x + y*128]; + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*16); + } + } + + return 0; +} + +WRITE_LINE_MEMBER(itt3030_state::fdcirq_w) +{ + m_fdc_irq = state; +} + +#include "debugger.h" + +WRITE_LINE_MEMBER(itt3030_state::fdcdrq_w) +{ + m_fdc_drq = state; +} + +WRITE_LINE_MEMBER(itt3030_state::fdchld_w) +{ + m_fdc_hld = state; +} + +/* + 7 Data Request (DRQ - inverted 1791-Signal) + 6 Interrupt Request (INTRQ - 1791-Signal) + 5 Head Load (HLD - inverted 1791-Signal) + 4 Ready 3 (Drive 3 ready) + 3 Ready 2 (Drive 2 ready) + 2 Ready l (Drive 1 ready) + 1 Write protect (the disk in the selected drive is write protected) + 0 HLT (Halt signal during head load and track change) +*/ +READ8_MEMBER(itt3030_state::fdc_stat_r) +{ + UINT8 res = 0; + floppy_image_device *floppy1 = m_con1 ? m_con1->get_device() : 0; + floppy_image_device *floppy2 = m_con2 ? m_con2->get_device() : 0; + floppy_image_device *floppy3 = m_con3 ? m_con3->get_device() : 0; + + res = m_fdc_drq ? 0x80 : 0x00; + res |= m_fdc_irq ? 0x40 : 0x00; + res |= m_fdc_hld ? 0x00 : 0x20; + if (floppy3) res |= floppy3->ready_r() ? 0x10 : 0; + if (floppy2) res |= floppy2->ready_r() ? 0x08 : 0; + if (floppy1) res |= floppy1->ready_r() ? 0x04 : 0; + if (m_curfloppy) res |= m_curfloppy->wpt_r() ? 0x02 : 0; + + return res; +} + +/* As far as we can tell, the mess of ttl de-inverts the bus */ +READ8_MEMBER(itt3030_state::fdc_r) +{ + return m_fdc->gen_r(offset) ^ 0xff; +} + +WRITE8_MEMBER(itt3030_state::fdc_w) +{ + m_fdc->gen_w(offset, data ^ 0xff); +} + +/* + 7 SEL1 - Select drive 1 + 6 SEL2 - Select drive 2 + 5 SEL3 - Select drive 3 + 4 MOTOR - Motor on + 3 DOOR - Drive door lock drives 1 + 2 (not possible with all drives) + 2 SIDESEL - Select disk side + 1 KOMP - write comp on/off + 0 RG J - Change separator stage to read +*/ +WRITE8_MEMBER(itt3030_state::fdc_cmd_w) +{ + floppy_image_device *floppy = NULL; + + logerror("%02x to fdc_cmd_w: motor %d side %d\n", data, (data & 0x10)>>4, (data & 4)>>2); + + // select drive + if (data & 0x80) + { + floppy = m_con1 ? m_con1->get_device() : 0; + } + else if (data & 0x40) + { + floppy = m_con2 ? m_con2->get_device() : 0; + } + else if (data & 0x20) + { + floppy = m_con3 ? m_con3->get_device() : 0; + } + + // selecting a new drive? + if (floppy != m_curfloppy) + { + m_fdc->set_floppy(floppy); + m_curfloppy = floppy; + } + + if (floppy != NULL) + { + // side select + floppy->ss_w((data & 4) ? 1 : 0); + + // motor control (active low) + floppy->mon_w((data & 0x10) ? 0 : 1); + } +} + +// The lower 48K is switchable among the first 48K of each of 8 64K banks numbered 0-7 or "bank 8" which is the internal ROM and VRAM +// The upper 16K is always the top 16K of the selected bank 0-7, which allows bank/bank copies and such +// Port F6 bits 7-5 select banks 0-7, bit 4 enables bank 8 + +static ADDRESS_MAP_START( itt3030_map, AS_PROGRAM, 8, itt3030_state ) + AM_RANGE(0x0000, 0xbfff) AM_DEVICE("lowerbank", address_map_bank_device, amap8) + AM_RANGE(0xc000, 0xffff) AM_READWRITE(bankh_r, bankh_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( lower48_map, AS_PROGRAM, 8, itt3030_state ) + AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(bankl_r, bankl_w) // pages 0-7 + AM_RANGE(0x80000, 0x807ff) AM_ROM AM_REGION("maincpu", 0) // begin "page 8" + AM_RANGE(0x80800, 0x80fff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x81000, 0x810ff) AM_RAM AM_MIRROR(0x100) // only 256 bytes, but ROM also clears 11xx? + AM_RANGE(0x83000, 0x83fff) AM_RAM AM_SHARE("vram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( itt3030_io, AS_IO, 8, itt3030_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x20, 0x26) AM_DEVREADWRITE("crt5027", crt5027_device, read, write) + AM_RANGE(0x30, 0x31) AM_READWRITE(i8078_r, i8078_w) + AM_RANGE(0x32, 0x32) AM_WRITE(beep_w) + AM_RANGE(0x35, 0x35) AM_READ(vsync_r) + AM_RANGE(0x40, 0x40) AM_READ(kbd_fifo_r) + AM_RANGE(0x50, 0x53) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0x54, 0x54) AM_READWRITE(fdc_stat_r, fdc_cmd_w) + AM_RANGE(0xf6, 0xf6) AM_WRITE(bank_w) +ADDRESS_MAP_END + +READ8_MEMBER(itt3030_state::kbd_fifo_r) +{ + return m_kbdmcu->upi41_master_r(space, 0); // offset 0 is data, 1 is status +} + +READ8_MEMBER(itt3030_state::kbd_matrix_r) +{ + return m_kbdread; +} + +WRITE8_MEMBER(itt3030_state::kbd_matrix_w) +{ + ioport_port *ports[16] = { m_keyrow1, m_keyrow2, m_keyrow3, m_keyrow4, m_keyrow5, m_keyrow6, m_keyrow7, m_keyrow8, m_keyrow9, + m_keyrow10, m_keyrow11, m_keyrow12, m_keyrow13, m_keyrow14, m_keyrow15, m_keyrow16 }; + int col_masks[8] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80 }; + int tmp_read; + + m_kbdrow = data & 0xf; + m_kbdcol = (data >> 4) & 0x7; + + if ((data & 0x80) && (!m_kbdclk)) + { + tmp_read = ports[m_kbdrow]->read() & col_masks[m_kbdcol]; + m_kbdread = (tmp_read != 0) ? 1 : 0; + } + + m_kbdclk = (data & 0x80) ? 1 : 0; +} + +// Schematics say: +// Port 1 goes to the keyboard matrix. +// bits 0-3 select matrix rows, bits 4-6 choose column to read, bit 7 clocks the process (rising edge strobes the row, falling edge reads the data) +// T0 is the key matrix return +// Port 2 bit 2 is shown as "IRQ" on the schematics, and the code does a lot with it as well (debug?) +static ADDRESS_MAP_START( kbdmcu_io, AS_IO, 8, itt3030_state ) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(kbd_matrix_r) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kbd_matrix_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_NOP AM_WRITENOP +ADDRESS_MAP_END + +static INPUT_PORTS_START( itt3030 ) + PORT_START("ROW1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("ROW2") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("ROW3") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // actually UK pound symbol + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("ROW4") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + + PORT_START("ROW5") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("ROW6") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + + PORT_START("ROW7") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("ROW8") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("ROW9") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + + PORT_START("ROW10") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_F9) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + + PORT_START("ROW11") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_F10) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('@') PORT_CHAR('?') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('`') + + PORT_START("ROW12") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_F11) PORT_CHAR(27) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('/') PORT_CHAR('\\') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + + PORT_START("ROW13") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(R)") PORT_CODE(KEYCODE_F12) PORT_CHAR('=') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('~') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR('^') // PC doesn't have 3 keys to the right of L, so we sub DEL for the 3rd one + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("ROW14") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(CL)") PORT_CODE(KEYCODE_F13) PORT_CHAR(4) // produces control-D always + PORT_BIT(0x001e, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("ROW15") + PORT_BIT(0x001f, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("ROW16") + PORT_BIT(0x001f, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static const gfx_layout charlayout = +{ + 8, 16, /* 8x16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {7, 6, 5, 4, 3, 2, 1, 0}, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* size of one char */ +}; + +static GFXDECODE_START( itt3030 ) + GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) +GFXDECODE_END + + +void itt3030_state::machine_start() +{ + save_item(NAME(m_unk)); + save_item(NAME(m_bank)); + save_item(NAME(m_kbdrow)); + save_item(NAME(m_kbdcol)); + save_item(NAME(m_kbdclk)); + save_item(NAME(m_kbdread)); + + m_kbdclk = 0; // must be initialized here b/c mcs48_reset() causes write of 0xff to all ports +} + +void itt3030_state::machine_reset() +{ + m_bank = 9; + m_48kbank->set_bank(8); + m_kbdread = 1; + m_kbdrow = m_kbdcol = 0; + m_kbdclk = 1; + m_fdc_irq = m_fdc_drq = m_fdc_hld = 0; + m_curfloppy = NULL; + m_keyskip = false; + + // look up floppies in advance + m_con1 = machine().device("fdc:0"); + m_con2 = machine().device("fdc:1"); + m_con3 = machine().device("fdc:2"); +} + +FLOPPY_FORMATS_MEMBER( itt3030_state::itt3030_floppy_formats ) + FLOPPY_ITT3030_FORMAT +FLOPPY_FORMATS_END + + +static SLOT_INTERFACE_START( itt3030_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( itt3030, itt3030_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80,XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(itt3030_map) + MCFG_CPU_IO_MAP(itt3030_io) + + MCFG_CPU_ADD("kbdmcu", I8041, XTAL_6MHz) + MCFG_CPU_IO_MAP(kbdmcu_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) + MCFG_SCREEN_UPDATE_DRIVER(itt3030_state, screen_update) + MCFG_SCREEN_SIZE(80*8, 24*16) + MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*16-1) + MCFG_SCREEN_PALETTE("palette") + + /* devices */ + MCFG_DEVICE_ADD("lowerbank", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(lower48_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x10000) + + MCFG_DEVICE_ADD("crt5027", CRT5027, XTAL_6MHz) + MCFG_TMS9927_CHAR_WIDTH(16) + + MCFG_FD1791_ADD("fdc", XTAL_20MHz / 20) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(itt3030_state, fdcirq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(itt3030_state, fdcdrq_w)) + MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(itt3030_state, fdchld_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", itt3030) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* internal ram */ + MCFG_RAM_ADD("mainram") + MCFG_RAM_DEFAULT_SIZE("512K") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( itt3030 ) + ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "bootv1.2.bin", 0x0000, 0x0800, CRC(90279d45) SHA1(a39a3f31f4f98980b1ef50805870837fbf72261d)) + ROM_REGION( 0x0800, "gfx1", ROMREGION_ERASE00 ) + ROM_LOAD( "gb136-0.bin", 0x0000, 0x0800, CRC(6a3895a8) SHA1(f3b977ffa2f54c346521c9ef034830de8f404621)) + ROM_REGION( 0x0400, "kbdmcu", ROMREGION_ERASE00 ) + ROM_LOAD( "8741ad.bin", 0x0000, 0x0400, CRC(cabf4394) SHA1(e5d1416b568efa32b578ca295a29b7b5d20c0def)) +ROM_END + +COMP( 1982, itt3030, 0, 0, itt3030, itt3030, driver_device, 0, "ITT RFA", "ITT3030", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/jade.c b/src/mame/drivers/jade.c new file mode 100644 index 00000000000..1f554d92ad1 --- /dev/null +++ b/src/mame/drivers/jade.c @@ -0,0 +1,111 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Jade JGZ80 Single board computer on a S100 card. + + 2013-09-12 Skeleton driver. + + No info found as yet. + + It takes about 8 seconds to start up. + Type HE to get a list of commands. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8251.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class jade_state : public driver_device +{ +public: + jade_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_uart(*this, "uart") + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(keyin_r); + DECLARE_READ8_MEMBER(status_r); + DECLARE_READ8_MEMBER(data_r); +private: + UINT8 m_term_data; + virtual void machine_reset(); + required_device m_maincpu; + required_device m_terminal; + required_device m_uart; +}; + + +static ADDRESS_MAP_START(jade_mem, AS_PROGRAM, 8, jade_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0xe000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(jade_io, AS_IO, 8, jade_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + //AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + //AM_RANGE(0x32, 0x32) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x30, 0x30) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x32, 0x32) AM_READ(status_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( jade ) +INPUT_PORTS_END + +READ8_MEMBER( jade_state::keyin_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return (ret) ? ret : 0x13; +} + +READ8_MEMBER( jade_state::status_r ) +{ + return (m_term_data) ? 5 : 4; +} + +WRITE8_MEMBER( jade_state::kbd_put ) +{ + m_term_data = data; +} + +void jade_state::machine_reset() +{ + m_term_data = 0; +} + +static MACHINE_CONFIG_START( jade, jade_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(jade_mem) + MCFG_CPU_IO_MAP(jade_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(jade_state, kbd_put)) + + /* Devices */ + MCFG_DEVICE_ADD("uart", I8251, 0) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( jade ) + ROM_REGION( 0x800, "roms", 0 ) + ROM_LOAD( "jgz80.rom", 0x0000, 0x0800, CRC(90c4a1ef) SHA1(8a93a11051cc27f3edca24f0f4297ebe0099964e) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, jade, 0, 0, jade, jade, driver_device, 0, "Jade", "JGZ80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/jonos.c b/src/mame/drivers/jonos.c new file mode 100644 index 00000000000..4f4a0ad2593 --- /dev/null +++ b/src/mame/drivers/jonos.c @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Jonos Escort + + 2013-09-12 Skeleton driver + + This computer is some sort of portable Z80-based system. + + Haven't found any info. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + + +class jonos_state : public driver_device +{ +public: + jonos_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_p_videoram(*this, "videoram") + , m_maincpu(*this, "maincpu") + { } + + DECLARE_DRIVER_INIT(jonos); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; +private: + const UINT8 *m_p_chargen; + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; +}; + + + +static ADDRESS_MAP_START(jonos_mem, AS_PROGRAM, 8, jonos_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0x1000, 0x17ff) AM_RAM + AM_RANGE(0x1800, 0x1fff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x2000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( jonos_io, AS_IO, 8, jonos_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( jonos ) +INPUT_PORTS_END + +void jonos_state::machine_reset() +{ +} + +void jonos_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 jonos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 12; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 80; x++) + { + chr = m_p_videoram[x]; + + if (ra < 8) + gfx = m_p_chargen[(chr<<3) | ra ]; + else + gfx = m_p_chargen[(chr<<3) | (ra&7) | 0x400]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 0); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 7); + } + } + ma+=80; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout jonos_charlayout = +{ + 8, 12, /* 8 x 12 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 1024*8, 1025*8, 1026*8, 1027*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( jonos ) + GFXDECODE_ENTRY( "chargen", 0x0000, jonos_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( jonos, jonos_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(jonos_mem) + MCFG_CPU_IO_MAP(jonos_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(jonos_state, screen_update) + MCFG_SCREEN_SIZE(640, 300) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 299) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", jonos) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER(jonos_state,jonos) +{ +} + +/* ROM definition */ +ROM_START( jonos ) + ROM_REGION( 0x1000, "roms", 0 ) + ROM_LOAD( "jocrts04.rom", 0x0000, 0x1000, CRC(6a3d4048) SHA1(bdb0bc2c8c4e54261376e4ea3c2827d00d3d89bc) ) + + ROM_REGION( 0x0800, "user1", 0 ) // Z80 code for serial & parallel ports + ROM_LOAD( "joz80.rom", 0x0000, 0x0800, CRC(de1e8998) SHA1(270df08caf30cc8f18e740ef05dc8727a925a5da) ) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "jochset0.rom", 0x0000, 0x0800, CRC(1d8e9640) SHA1(74f3604acc71f9bc1e1f9479f6438feda79293a2) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, jonos, 0, 0, jonos, jonos, jonos_state, jonos, "Jonos", "Escort", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/jr100.c b/src/mame/drivers/jr100.c new file mode 100644 index 00000000000..b8a09453c92 --- /dev/null +++ b/src/mame/drivers/jr100.c @@ -0,0 +1,425 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + JR-100 National / Panasonic + + 23/08/2010 Initial driver version + + TODO: + - beeper doesn't work correctly when a key is pressed (should have + more time but it's quickly shut off), presumably there are M6802 + timing bugs that causes this quirk. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "machine/6522via.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "sound/speaker.h" +#include "sound/beep.h" +#include "imagedev/snapquik.h" + + +class jr100_state : public driver_device +{ +public: + jr100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_ram(*this, "ram"), + m_pcg(*this, "pcg"), + m_vram(*this, "vram"), + m_via(*this, "via"), + m_cassette(*this, "cassette"), + m_beeper(*this, "beeper"), + m_speaker(*this, "speaker"), + m_region_maincpu(*this, "maincpu"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1"), + m_line2(*this, "LINE2"), + m_line3(*this, "LINE3"), + m_line4(*this, "LINE4"), + m_line5(*this, "LINE5"), + m_line6(*this, "LINE6"), + m_line7(*this, "LINE7"), + m_line8(*this, "LINE8") , + m_maincpu(*this, "maincpu") { } + + required_shared_ptr m_ram; + required_shared_ptr m_pcg; + required_shared_ptr m_vram; + UINT8 m_keyboard_line; + bool m_use_pcg; + UINT8 m_speaker_data; + UINT16 m_t1latch; + UINT8 m_beep_en; + DECLARE_WRITE8_MEMBER(jr100_via_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(sound_tick); + DECLARE_READ8_MEMBER(jr100_via_read_b); + DECLARE_WRITE8_MEMBER(jr100_via_write_a); + DECLARE_WRITE8_MEMBER(jr100_via_write_b); + DECLARE_WRITE_LINE_MEMBER(jr100_via_write_cb2); + UINT32 readByLittleEndian(UINT8 *buf,int pos); + DECLARE_QUICKLOAD_LOAD_MEMBER(jr100); + + +protected: + required_device m_via; + required_device m_cassette; + required_device m_beeper; + required_device m_speaker; + required_memory_region m_region_maincpu; + required_ioport m_line0; + required_ioport m_line1; + required_ioport m_line2; + required_ioport m_line3; + required_ioport m_line4; + required_ioport m_line5; + required_ioport m_line6; + required_ioport m_line7; + required_ioport m_line8; + required_device m_maincpu; +}; + + + + +WRITE8_MEMBER(jr100_state::jr100_via_w) +{ + /* ACR: beeper masking */ + if(offset == 0x0b) + { + //printf("BEEP %s\n",((data & 0xe0) == 0xe0) ? "ON" : "OFF"); + m_beep_en = ((data & 0xe0) == 0xe0); + + if(!m_beep_en) + m_beeper->set_state(0); + } + + /* T1L-L */ + if(offset == 0x04) + { + m_t1latch = (m_t1latch & 0xff00) | (data & 0xff); + //printf("BEEP T1CL %02x\n",data); + } + + /* T1L-H */ + if(offset == 0x05) + { + m_t1latch = (m_t1latch & 0xff) | ((data & 0xff) << 8); + //printf("BEEP T1CH %02x\n",data); + + /* writing here actually enables the beeper, if above masking condition is satisfied */ + if(m_beep_en) + { + m_beeper->set_state(1); + m_beeper->set_frequency(894886.25 / (double)(m_t1latch) / 2.0); + } + } + m_via->write(space,offset,data); +} + +static ADDRESS_MAP_START(jr100_mem, AS_PROGRAM, 8, jr100_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("ram") + AM_RANGE(0xc000, 0xc0ff) AM_RAM AM_SHARE("pcg") + AM_RANGE(0xc100, 0xc3ff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xc800, 0xc80f) AM_DEVREAD("via", via6522_device, read) AM_WRITE(jr100_via_w) + AM_RANGE(0xe000, 0xffff) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( jr100 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) // Z + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) // X + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) // C + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) // A + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) // S + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) // D + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) // F + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) // G + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) // Q + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) // W + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) // E + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) // R + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) // T + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) // 1 + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) // 2 + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) // 3 + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) // 4 + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) // 5 + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) // 6 + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) // 7 + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) // 8 + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) // 9 + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) // 0 + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) // Y + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) // U + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) // I + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) // O + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) // P + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) // H + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) // J + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) // K + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) // L + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) // ; + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) // V + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) // B + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) // N + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) // M + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) // , + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) // . + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) // space + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) // : + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) // enter + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) // - + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +void jr100_state::machine_start() +{ + m_beeper->set_frequency(0); + m_beeper->set_state(0); +} + +void jr100_state::machine_reset() +{ +} + +void jr100_state::video_start() +{ +} + +UINT32 jr100_state::screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,xi,yi; + + UINT8 *rom_pcg = m_region_maincpu->base() + 0xe000; + for (y = 0; y < 24; y++) + { + for (x = 0; x < 32; x++) + { + UINT8 tile = m_vram[x + y*32]; + UINT8 attr = tile >> 7; + // ATTR is inverted for normal char or use PCG in case of CMODE1 + UINT8 *gfx_data = rom_pcg; + if (m_use_pcg && attr) { + gfx_data = m_pcg; + attr = 0; // clear attr so bellow code stay same + } + tile &= 0x7f; + for(yi=0;yi<8;yi++) + { + for(xi=0;xi<8;xi++) + { + UINT8 pen = (gfx_data[(tile*8)+yi]>>(7-xi) & 1); + bitmap.pix16(y*8+yi, x*8+xi) = attr ^ pen; + } + } + } + } + + return 0; +} + +static const gfx_layout tiles8x8_layout = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( jr100 ) + GFXDECODE_ENTRY( "maincpu", 0xe000, tiles8x8_layout, 0, 1 ) +GFXDECODE_END + +READ8_MEMBER(jr100_state::jr100_via_read_b) +{ + UINT8 val = 0x1f; + switch ( m_keyboard_line ) + { + case 0: val = m_line0->read(); break; + case 1: val = m_line1->read(); break; + case 2: val = m_line2->read(); break; + case 3: val = m_line3->read(); break; + case 4: val = m_line4->read(); break; + case 5: val = m_line5->read(); break; + case 6: val = m_line6->read(); break; + case 7: val = m_line7->read(); break; + case 8: val = m_line8->read(); break; + } + return val; +} + +WRITE8_MEMBER(jr100_state::jr100_via_write_a) +{ + m_keyboard_line = data & 0x0f; +} + +WRITE8_MEMBER(jr100_state::jr100_via_write_b) +{ + m_use_pcg = (data & 0x20) ? TRUE : FALSE; + m_speaker_data = data>>7; +} + +WRITE_LINE_MEMBER(jr100_state::jr100_via_write_cb2) +{ + m_cassette->output(state ? -1.0 : +1.0); +} + +TIMER_DEVICE_CALLBACK_MEMBER(jr100_state::sound_tick) +{ + m_speaker->level_w(m_speaker_data); + m_speaker_data = 0; + + double level = (m_cassette->input()); + if (level > 0.0) { + m_via->write_ca1(0); + m_via->write_cb1(0); + } else { + m_via->write_ca1(1); + m_via->write_cb1(1); + } +} + +UINT32 jr100_state::readByLittleEndian(UINT8 *buf,int pos) +{ + return buf[pos] + (buf[pos+1] << 8) + (buf[pos+2] << 16) + (buf[pos+3] << 24); +} + +QUICKLOAD_LOAD_MEMBER( jr100_state,jr100) +{ + int quick_length; + UINT8 buf[0x10000]; + int read_; + quick_length = image.length(); + if (quick_length >= 0xffff) + return IMAGE_INIT_FAIL; + read_ = image.fread(buf, quick_length); + if (read_ != quick_length) + return IMAGE_INIT_FAIL; + + if (buf[0]!=0x50 || buf[1]!=0x52 || buf[2]!=0x4F || buf[3]!=0x47) { + // this is not PRG + return IMAGE_INIT_FAIL; + } + int pos = 4; + if (readByLittleEndian(buf,pos)!=1) { + // not version 1 of PRG file + return IMAGE_INIT_FAIL; + } + pos += 4; + UINT32 len =readByLittleEndian(buf,pos); pos+= 4; + pos += len; // skip name + UINT32 start_address = readByLittleEndian(buf,pos); pos+= 4; + UINT32 code_length = readByLittleEndian(buf,pos); pos+= 4; + UINT32 flag = readByLittleEndian(buf,pos); pos+= 4; + + UINT32 end_address = start_address + code_length - 1; + // copy code + memcpy(m_ram + start_address,buf + pos,code_length); + if (flag == 0) { + m_ram[end_address + 1] = 0xdf; + m_ram[end_address + 2] = 0xdf; + m_ram[end_address + 3] = 0xdf; + m_ram[6 ] = (end_address >> 8 & 0xFF); + m_ram[7 ] = (end_address & 0xFF); + m_ram[8 ] = ((end_address + 1) >> 8 & 0xFF); + m_ram[9 ] = ((end_address + 1) & 0xFF); + m_ram[10] = ((end_address + 2) >> 8 & 0xFF); + m_ram[11] = ((end_address + 2) & 0xFF); + m_ram[12] = ((end_address + 3) >> 8 & 0xFF); + m_ram[13] = ((end_address + 3) & 0xFF); + } + + return IMAGE_INIT_PASS; +} + +static MACHINE_CONFIG_START( jr100, jr100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6802, XTAL_14_31818MHz / 4) // clock devided internaly by 4 + MCFG_CPU_PROGRAM_MAP(jr100_mem) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 192) /* border size not accurate */ + MCFG_SCREEN_VISIBLE_AREA(0, 256 - 1, 0, 192 - 1) + MCFG_SCREEN_UPDATE_DRIVER(jr100_state, screen_update_jr100) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", jr100) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_DEVICE_ADD("via", VIA6522, XTAL_14_31818MHz / 16) + MCFG_VIA6522_READPB_HANDLER(READ8(jr100_state,jr100_via_read_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(jr100_state,jr100_via_write_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(jr100_state,jr100_via_write_b)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(jr100_state, jr100_via_write_cb2)) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("sound_tick", jr100_state, sound_tick, attotime::from_hz(XTAL_14_31818MHz / 16)) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", jr100_state, jr100, "prg", 2) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( jr100 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "jr100.rom", 0xe000, 0x2000, CRC(951d08a1) SHA1(edae3daaa94924e444bbe485ac2bcd5cb5b22ca2)) +ROM_END + +ROM_START( jr100u ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "jr100u.rom", 0xe000, 0x2000, CRC(f589dd8d) SHA1(78a51f2ae055bf4dc1b0887a6277f5dbbd8ba512)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, jr100, 0, 0, jr100, jr100, driver_device, 0, "National", "JR-100", 0) +COMP( 1981, jr100u, jr100, 0, jr100, jr100, driver_device, 0, "Panasonic", "JR-100U", 0) diff --git a/src/mame/drivers/jr200.c b/src/mame/drivers/jr200.c new file mode 100644 index 00000000000..8e2fba33614 --- /dev/null +++ b/src/mame/drivers/jr200.c @@ -0,0 +1,601 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese, Roberto Zandona' +/*************************************************************************** + + JR-200 (c) 1982 National / Panasonic + + driver by Roberto Zandona' and Angelo Salese + + http://www.armchairarcade.com/neo/node/1598 + + TODO: + - Timings are basically screwed, it takes too much to load the POST but + then the cursor blink is too fast + - keyboard MCU irq and data polling simulation should be inside a timer + callback + - MN1544 4-bit CPU core and ROM dump + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "sound/beep.h" + + +class jr200_state : public driver_device +{ +public: + jr200_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_vram(*this, "vram"), + m_cram(*this, "cram"), + m_mn1271_ram(*this, "mn1271_ram"), + m_maincpu(*this, "maincpu"), + m_beeper(*this, "beeper"), + m_pcg(*this, "pcg"), + m_gfx_rom(*this, "gfx_rom"), + m_gfx_ram(*this, "gfx_ram"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_row8(*this, "ROW8"), + m_row9(*this, "ROW9"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + required_shared_ptr m_vram; + required_shared_ptr m_cram; + required_shared_ptr m_mn1271_ram; + UINT8 m_border_col; + UINT8 m_old_keydata; + UINT8 m_freq_reg[2]; + emu_timer *m_timer_d; + DECLARE_READ8_MEMBER(jr200_pcg_1_r); + DECLARE_READ8_MEMBER(jr200_pcg_2_r); + DECLARE_WRITE8_MEMBER(jr200_pcg_1_w); + DECLARE_WRITE8_MEMBER(jr200_pcg_2_w); + DECLARE_READ8_MEMBER(jr200_bios_char_r); + DECLARE_WRITE8_MEMBER(jr200_bios_char_w); + DECLARE_READ8_MEMBER(mcu_keyb_r); + DECLARE_WRITE8_MEMBER(jr200_beep_w); + DECLARE_WRITE8_MEMBER(jr200_beep_freq_w); + DECLARE_WRITE8_MEMBER(jr200_border_col_w); + DECLARE_READ8_MEMBER(mn1271_io_r); + DECLARE_WRITE8_MEMBER(mn1271_io_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(timer_d_callback); + +protected: + required_device m_maincpu; + required_device m_beeper; + required_memory_region m_pcg; + required_memory_region m_gfx_rom; + required_memory_region m_gfx_ram; + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + required_ioport m_row3; + required_ioport m_row4; + required_ioport m_row5; + required_ioport m_row6; + required_ioport m_row7; + required_ioport m_row8; + required_ioport m_row9; + required_device m_gfxdecode; + required_device m_palette; +}; + + + +/* TODO: double check this */ +static const UINT8 jr200_keycodes[4][9][8] = +{ + /* unshifted */ + { + { 0x00, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 }, + { 0x38, 0x39, 0x30, 0x2d, 0x5e, 0x08, 0x7f, 0x2d }, + { 0x37, 0x38, 0x39, 0x09, 0x71, 0x77, 0x65, 0x72 }, + { 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x40, 0x5b }, + { 0x1b, 0x2b, 0x34, 0x35, 0x36, 0x61, 0x73, 0x64 }, + { 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27 }, + { 0x0d, 0x0a, 0x1e, 0x31, 0x32, 0x33, 0x7a, 0x78 }, + { 0x63, 0x76, 0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2f }, + { 0x1d, 0x1f, 0x1c, 0x30, 0x2e, 0x20, 0x03, 0x00 } + }, + + /* shifted */ + { + { 0x00, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26 }, + { 0x2a, 0x28, 0x29, 0x3d, 0x10, 0x08, 0x7f, 0x2d }, + { 0x37, 0x38, 0x39, 0x09, 0x51, 0x57, 0x45, 0x52 }, + { 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x40, 0x7b }, + { 0x1b, 0x2b, 0x34, 0x35, 0x36, 0x41, 0x53, 0x44 }, + { 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22 }, + { 0x0d, 0x0a, 0x1e, 0x31, 0x32, 0x33, 0x5a, 0x58 }, + { 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x3c, 0x3e, 0x3f }, + { 0x1d, 0x1f, 0x1c, 0x30, 0x2e, 0x20, 0x00, 0x00 } + }, + + /* graph on */ + { + { 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97 }, + { 0x98, 0x99, 0x90, 0x1f, 0x9a, 0x88, 0xff, 0xad }, + { 0xb7, 0xb8, 0xb9, 0x89, 0x11, 0x17, 0x05, 0x12 }, + { 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d }, + { 0x9b, 0xab, 0xb4, 0xb5, 0xb6, 0x01, 0x13, 0x04 }, + { 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0x7e, 0x60 }, + { 0x8d, 0x8a, 0x81, 0xb1, 0xb2, 0xb3, 0x1a, 0x18 }, + { 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x1c, 0x7c, 0x5c }, + { 0x84, 0x82, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 } + }, + + /* graph on shifted*/ + { + { 0x9e, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97 }, + { 0x98, 0x99, 0x90, 0x1f, 0x9a, 0x88, 0xff, 0xad }, + { 0xb7, 0xb8, 0xb9, 0x89, 0x11, 0x17, 0x05, 0x12 }, + { 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d }, + { 0x9b, 0xab, 0xb4, 0xb5, 0xb6, 0x01, 0x13, 0x04 }, + { 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0x7e, 0x60 }, + { 0x8d, 0x8a, 0x81, 0xb1, 0xb2, 0xb3, 0x1a, 0x18 }, + { 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x1c, 0x7c, 0x5c }, + { 0x84, 0x82, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 } + } +}; + + +void jr200_state::video_start() +{ +} + +UINT32 jr200_state::screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,xi,yi,pen; + + bitmap.fill(m_border_col, cliprect); + + for (y = 0; y < 24; y++) + { + for (x = 0; x < 32; x++) + { + UINT8 tile = m_vram[x + y*32]; + UINT8 attr = m_cram[x + y*32]; + + for(yi=0;yi<8;yi++) + { + for(xi=0;xi<8;xi++) + { + UINT8 *gfx_data; + + if(attr & 0x80) //bitmap mode + { + /* + this mode draws 4 x 4 dot blocks, by combining lower 6 bits of tile and attribute vram + + tile def + 00xx x--- up-right + 00-- -xxx up-left + attr def + 10xx x--- down-right + 10-- -xxx down-left + */ + int step; + + step = ((xi & 4) ? 3 : 0); + step+= ((yi & 4) ? 6 : 0); + + pen = ((((attr & 0x3f) << 6) | (tile & 0x3f)) >> (step)) & 0x07; + } + else // tile mode + { + gfx_data = (attr & 0x40) ? m_pcg->base() : m_gfx_ram->base(); + + pen = (gfx_data[(tile*8)+yi]>>(7-xi) & 1) ? (attr & 0x7) : ((attr & 0x38) >> 3); + } + + bitmap.pix16(y*8+yi+16, x*8+xi+16) = m_palette->pen(pen); + } + } + } + } + + return 0; +} + +READ8_MEMBER(jr200_state::jr200_pcg_1_r) +{ + return m_pcg->base()[offset+0x000]; +} + +READ8_MEMBER(jr200_state::jr200_pcg_2_r) +{ + return m_pcg->base()[offset+0x400]; +} + +WRITE8_MEMBER(jr200_state::jr200_pcg_1_w) +{ + m_pcg->base()[offset+0x000] = data; + m_gfxdecode->gfx(1)->mark_dirty((offset+0x000) >> 3); +} + +WRITE8_MEMBER(jr200_state::jr200_pcg_2_w) +{ + m_pcg->base()[offset+0x400] = data; + m_gfxdecode->gfx(1)->mark_dirty((offset+0x400) >> 3); +} + +READ8_MEMBER(jr200_state::jr200_bios_char_r) +{ + return m_gfx_ram->base()[offset]; +} + + +WRITE8_MEMBER(jr200_state::jr200_bios_char_w) +{ + /* TODO: writing is presumably controlled by an I/O bit */ +// m_gfx_ram->base()[offset] = data; +// m_gfxdecode->gfx(0)->mark_dirty(offset >> 3); +} + +/* + +I/O Device + +*/ + +READ8_MEMBER(jr200_state::mcu_keyb_r) +{ + int row, col, table = 0; + UINT8 keydata = 0; + + if (m_row9->read() & 0x07) + { + /* shift, upper case */ + table = 1; + } + + /* scan keyboard */ + for (row = 0; row < 9; row++) + { + UINT8 data = 0xff; + + switch ( row ) + { + case 0: data = m_row0->read(); break; + case 1: data = m_row1->read(); break; + case 2: data = m_row2->read(); break; + case 3: data = m_row3->read(); break; + case 4: data = m_row4->read(); break; + case 5: data = m_row5->read(); break; + case 6: data = m_row6->read(); break; + case 7: data = m_row7->read(); break; + case 8: data = m_row8->read(); break; + } + + for (col = 0; col < 8; col++) + { + if (!BIT(data, col)) + { + /* latch key data */ + keydata = jr200_keycodes[table][row][col]; + } + } + } + + if(m_old_keydata == keydata) + return 0x00; + + m_old_keydata = keydata; + + return keydata; +} + +WRITE8_MEMBER(jr200_state::jr200_beep_w) +{ + /* writing 0x0e enables the beeper, writing anything else disables it */ + m_beeper->set_state(((data & 0xf) == 0x0e) ? 1 : 0); +} + +WRITE8_MEMBER(jr200_state::jr200_beep_freq_w) +{ + UINT32 beep_freq; + + m_freq_reg[offset] = data; + + beep_freq = ((m_freq_reg[0]<<8) | (m_freq_reg[1] & 0xff)) + 1; + + m_beeper->set_frequency(84000 / beep_freq); +} + +WRITE8_MEMBER(jr200_state::jr200_border_col_w) +{ + m_border_col = data; +} + + +TIMER_CALLBACK_MEMBER(jr200_state::timer_d_callback) +{ + m_maincpu->set_input_line(0, HOLD_LINE); +} + +READ8_MEMBER(jr200_state::mn1271_io_r) +{ + UINT8 retVal = m_mn1271_ram[offset]; + if((offset+0xc800) > 0xca00) + retVal= 0xff; + + switch(offset+0xc800) + { + case 0xc801: retVal= mcu_keyb_r(space,0); break; + case 0xc803: retVal= (m_mn1271_ram[0x03] & 0xcf) | 0x30; break;//---x ---- printer status ready (ACTIVE HIGH) + case 0xc807: retVal= (m_mn1271_ram[0x07] & 0x80) | 0x60; break; + case 0xc80a: retVal= (m_mn1271_ram[0x0a] & 0xfe); break; + case 0xc80c: retVal= (m_mn1271_ram[0x0c] & 0xdf) | 0x20; break; + case 0xc80e: retVal= 0; break; + case 0xc810: retVal= 0; break; + case 0xc816: retVal= 0x4e; break; + case 0xc81c: retVal= (m_mn1271_ram[0x1c] & 0xfe) | 1; break;//bit 0 needs to be high otherwise system refuses to boot + case 0xc81d: retVal= (m_mn1271_ram[0x1d] & 0xed); break; + } + //logerror("mn1271_io_r [%04x] = %02x\n",offset+0xc800,retVal); + return retVal; +} + +WRITE8_MEMBER(jr200_state::mn1271_io_w) +{ + m_mn1271_ram[offset] = data; + switch(offset+0xc800) + { + case 0xc805: break; //LPT printer port W + case 0xc816: if (data!=0) { + m_timer_d->adjust(attotime::zero, 0, attotime::from_hz(XTAL_14_31818MHz) * (m_mn1271_ram[0x17]*0x100 + m_mn1271_ram[0x18])); + } else { + m_timer_d->adjust(attotime::zero, 0, attotime::zero); + } + break; + case 0xc819: jr200_beep_w(space,0,data); break; + case 0xc81a: + case 0xc81b: jr200_beep_freq_w(space,offset-0x1a,data); break; + case 0xca00: jr200_border_col_w(space,0,data); break; + } +} + +static ADDRESS_MAP_START(jr200_mem, AS_PROGRAM, 8, jr200_state ) +/* + 0000-3fff RAM + 4000-4fff RAM ( 4k expansion) + 4000-7fff RAM (16k expansion) + 4000-bfff RAM (32k expansion) +*/ + AM_RANGE(0x0000, 0x7fff) AM_RAM + + AM_RANGE(0xa000, 0xbfff) AM_ROM + + AM_RANGE(0xc000, 0xc0ff) AM_READWRITE(jr200_pcg_1_r,jr200_pcg_1_w) //PCG area (1) + AM_RANGE(0xc100, 0xc3ff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xc400, 0xc4ff) AM_READWRITE(jr200_pcg_2_r,jr200_pcg_2_w) //PCG area (2) + AM_RANGE(0xc500, 0xc7ff) AM_RAM AM_SHARE("cram") + +// 0xc800 - 0xcfff I / O area + AM_RANGE(0xc800, 0xcfff) AM_READWRITE(mn1271_io_r,mn1271_io_w) AM_SHARE("mn1271_ram") + + AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(jr200_bios_char_r,jr200_bios_char_w) //BIOS PCG RAM area + AM_RANGE(0xd800, 0xdfff) AM_ROM // cart space (header 0x7e) + AM_RANGE(0xe000, 0xffff) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( jr200 ) +// PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") + + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_TILDE) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("ROW8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("ROW9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) +INPUT_PORTS_END + +static const gfx_layout tiles8x8_layout = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( jr200 ) + GFXDECODE_ENTRY( "gfx_ram", 0, tiles8x8_layout, 0, 1 ) + GFXDECODE_ENTRY( "pcg", 0, tiles8x8_layout, 0, 1 ) +GFXDECODE_END + +void jr200_state::machine_start() +{ + m_beeper->set_frequency(0); + m_beeper->set_state(0); + m_timer_d = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jr200_state::timer_d_callback),this)); +} + +void jr200_state::machine_reset() +{ + UINT8 *gfx_rom = m_gfx_rom->base(); + UINT8 *gfx_ram = m_gfx_ram->base(); + int i; + memset(m_mn1271_ram,0,0x800); + + for(i=0;i<0x800;i++) + gfx_ram[i] = gfx_rom[i]; + + for(i=0;i<0x800;i+=8) + m_gfxdecode->gfx(0)->mark_dirty(i >> 3); +} + + +static MACHINE_CONFIG_START( jr200, jr200_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6802, XTAL_14_31818MHz / 4) /* MN1800A, ? Mhz assumption that it is same as JR-100*/ + MCFG_CPU_PROGRAM_MAP(jr200_mem) + +// MCFG_CPU_ADD("mn1544", MN1544, ?) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(16 + 256 + 16, 16 + 192 + 16) /* border size not accurate */ + MCFG_SCREEN_VISIBLE_AREA(0, 16 + 256 + 16 - 1, 0, 16 + 192 + 16 - 1) + MCFG_SCREEN_UPDATE_DRIVER(jr200_state, screen_update_jr200) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", jr200) + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + MCFG_SPEAKER_STANDARD_MONO("mono") + + // AY-8910 ? + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) +MACHINE_CONFIG_END + + + +/* ROM definition */ +ROM_START( jr200 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "rom1.bin", 0xa000, 0x2000, CRC(bfed707b) SHA1(551823e7ca63f459eb46eb4c7a3e1e169fba2ca2)) + ROM_LOAD( "rom2.bin", 0xe000, 0x2000, CRC(a1cb5027) SHA1(5da98d4ce9cba8096d98e6f2de60baa1673406d0)) + + ROM_REGION( 0x10000, "mn1544", ROMREGION_ERASEFF ) + ROM_LOAD( "mn1544.bin", 0x0000, 0x0400, NO_DUMP ) + + ROM_REGION( 0x0800, "gfx_rom", ROMREGION_ERASEFF ) + ROM_LOAD( "char.rom", 0x0000, 0x0800, CRC(cb641624) SHA1(6fe890757ebc65bbde67227f9c7c490d8edd84f2) ) + + ROM_REGION( 0x0800, "gfx_ram", ROMREGION_ERASEFF ) + + ROM_REGION( 0x0800, "pcg", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( jr200u ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "basic.rom", 0xa000, 0x2000, CRC(cc53eb52) SHA1(910927b98a8338ba072173d79613422a8cb796da) ) + ROM_LOAD( "jr200u.bin", 0xe000, 0x2000, CRC(37ca3080) SHA1(17d3fdedb4de521da7b10417407fa2b61f01a77a) ) + + ROM_REGION( 0x10000, "mn1544", ROMREGION_ERASEFF ) + ROM_LOAD( "mn1544.bin", 0x0000, 0x0400, NO_DUMP ) + + ROM_REGION( 0x0800, "gfx_rom", ROMREGION_ERASEFF ) + ROM_LOAD( "char.rom", 0x0000, 0x0800, CRC(cb641624) SHA1(6fe890757ebc65bbde67227f9c7c490d8edd84f2) ) + + ROM_REGION( 0x0800, "gfx_ram", ROMREGION_ERASEFF ) + + ROM_REGION( 0x0800, "pcg", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, jr200, 0, 0, jr200, jr200, driver_device, 0, "National", "JR-200", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1982, jr200u, jr200, 0, jr200, jr200, driver_device, 0, "Panasonic", "JR-200U", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/jtc.c b/src/mame/drivers/jtc.c new file mode 100644 index 00000000000..fe1a0a4e140 --- /dev/null +++ b/src/mame/drivers/jtc.c @@ -0,0 +1,851 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Jugend+Technik CompJU+TEr + + 15/07/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z8/z8.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "machine/ram.h" +#include "sound/speaker.h" +#include "sound/wave.h" + +#define SCREEN_TAG "screen" +#define UB8830D_TAG "ub8830d" +#define CENTRONICS_TAG "centronics" + +#define JTC_ES40_VIDEORAM_SIZE 0x2000 + +class jtc_state : public driver_device +{ +public: + jtc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, UB8830D_TAG), + m_cassette(*this, "cassette"), + m_speaker(*this, "speaker"), + m_centronics(*this, CENTRONICS_TAG), + m_video_ram(*this, "video_ram"){ } + + required_device m_maincpu; + required_device m_cassette; + required_device m_speaker; + required_device m_centronics; + + virtual void machine_start(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE8_MEMBER( p2_w ); + DECLARE_READ8_MEMBER( p3_r ); + DECLARE_WRITE8_MEMBER( p3_w ); + DECLARE_PALETTE_INIT(jtc_es40); + optional_shared_ptr m_video_ram; + + int m_centronics_busy; + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); +}; + + +class jtces88_state : public jtc_state +{ +public: + jtces88_state(const machine_config &mconfig, device_type type, const char *tag) + : jtc_state(mconfig, type, tag) + { } +}; + + +class jtces23_state : public jtc_state +{ +public: + jtces23_state(const machine_config &mconfig, device_type type, const char *tag) + : jtc_state(mconfig, type, tag) + { } + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + +class jtces40_state : public jtc_state +{ +public: + jtces40_state(const machine_config &mconfig, device_type type, const char *tag) + : jtc_state(mconfig, type, tag) + { } + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( videoram_r ); + DECLARE_WRITE8_MEMBER( videoram_w ); + DECLARE_WRITE8_MEMBER( banksel_w ); + + UINT8 m_video_bank; + UINT8 *m_color_ram_r; + UINT8 *m_color_ram_g; + UINT8 *m_color_ram_b; +}; + + +/* Read/Write Handlers */ + +WRITE8_MEMBER( jtc_state::p2_w ) +{ + /* + + bit description + + P20 + P21 + P22 + P23 + P24 + P25 centronics strobe output + P26 V4093 pins 1,2 + P27 DL299 pin 18 + + */ + + m_centronics->write_strobe(BIT(data, 5)); +} + +DECLARE_WRITE_LINE_MEMBER( jtc_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +READ8_MEMBER( jtc_state::p3_r ) +{ + /* + + bit description + + P30 tape input + P31 + P32 + P33 centronics busy input + P34 + P35 + P36 tape output + P37 speaker output + + */ + + UINT8 data = 0; + + data |= ((m_cassette)->input() < 0.0) ? 1 : 0; + data |= m_centronics_busy << 3; + + return data; +} + +WRITE8_MEMBER( jtc_state::p3_w ) +{ + /* + + bit description + + P30 tape input + P31 + P32 + P33 centronics busy input + P34 + P35 + P36 tape output + P37 speaker output + + */ + + /* tape */ + m_cassette->output( BIT(data, 6) ? +1.0 : -1.0); + + /* speaker */ + m_speaker->level_w(BIT(data, 7)); +} + +READ8_MEMBER( jtces40_state::videoram_r ) +{ + UINT8 data = 0; + + if (m_video_bank & 0x80) data |= m_color_ram_r[offset]; + if (m_video_bank & 0x40) data |= m_color_ram_g[offset]; + if (m_video_bank & 0x20) data |= m_color_ram_b[offset]; + if (m_video_bank & 0x10) data |= m_video_ram[offset]; + + return data; +} + +WRITE8_MEMBER( jtces40_state::videoram_w ) +{ + if (m_video_bank & 0x80) m_color_ram_r[offset] = data; + if (m_video_bank & 0x40) m_color_ram_g[offset] = data; + if (m_video_bank & 0x20) m_color_ram_b[offset] = data; + if (m_video_bank & 0x10) m_video_ram[offset] = data; +} + +WRITE8_MEMBER( jtces40_state::banksel_w ) +{ + m_video_bank = offset & 0xf0; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( jtc_mem, AS_PROGRAM, 8, jtc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1") + AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2") + AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3") + AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x0ff0) AM_READ_PORT("Y4") + AM_RANGE(0x7005, 0x7005) AM_MIRROR(0x0ff0) AM_READ_PORT("Y5") + AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x0ff0) AM_READ_PORT("Y6") + AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x0ff0) AM_READ_PORT("Y7") + AM_RANGE(0x7008, 0x7008) AM_MIRROR(0x0ff0) AM_READ_PORT("Y8") + AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9") + AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10") + AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11") + AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12") + AM_RANGE(0xe000, 0xfdff) AM_RAM + AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( jtc_es1988_mem, AS_PROGRAM, 8, jtces88_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0800, 0x0fff) AM_ROM + AM_RANGE(0x2000, 0x27ff) AM_ROM + AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1") + AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2") + AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3") + AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x0ff0) AM_READ_PORT("Y4") + AM_RANGE(0x7005, 0x7005) AM_MIRROR(0x0ff0) AM_READ_PORT("Y5") + AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x0ff0) AM_READ_PORT("Y6") + AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x0ff0) AM_READ_PORT("Y7") + AM_RANGE(0x7008, 0x7008) AM_MIRROR(0x0ff0) AM_READ_PORT("Y8") + AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9") + AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10") + AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11") + AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12") + AM_RANGE(0xe000, 0xfdff) AM_RAM + AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( jtc_es23_mem, AS_PROGRAM, 8, jtces23_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0800, 0x17ff) AM_ROM + AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0ff0) AM_READ_PORT("Y0") + AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1") + AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2") + AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3") + AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x0ff0) AM_READ_PORT("Y4") + AM_RANGE(0x7005, 0x7005) AM_MIRROR(0x0ff0) AM_READ_PORT("Y5") + AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x0ff0) AM_READ_PORT("Y6") + AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x0ff0) AM_READ_PORT("Y7") + AM_RANGE(0x7008, 0x7008) AM_MIRROR(0x0ff0) AM_READ_PORT("Y8") + AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9") + AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10") + AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11") + AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12") + AM_RANGE(0x700d, 0x700d) AM_MIRROR(0x0ff0) AM_READ_PORT("Y13") + AM_RANGE(0x700e, 0x700e) AM_MIRROR(0x0ff0) AM_READ_PORT("Y14") + AM_RANGE(0x700f, 0x700f) AM_MIRROR(0x0ff0) AM_READ_PORT("Y15") + AM_RANGE(0xe000, 0xfdff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( jtc_es40_mem, AS_PROGRAM, 8, jtces40_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0800, 0x1fff) AM_ROM + AM_RANGE(0x4000, 0x5fff) AM_READWRITE(videoram_r, videoram_w) + AM_RANGE(0x6000, 0x63ff) AM_WRITE(banksel_w) + AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1") + AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2") + AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3") + AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x0ff0) AM_READ_PORT("Y4") + AM_RANGE(0x7005, 0x7005) AM_MIRROR(0x0ff0) AM_READ_PORT("Y5") + AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x0ff0) AM_READ_PORT("Y6") + AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x0ff0) AM_READ_PORT("Y7") + AM_RANGE(0x7008, 0x7008) AM_MIRROR(0x0ff0) AM_READ_PORT("Y8") + AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9") + AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10") + AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11") + AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12") + AM_RANGE(0x8000, 0xffff) AM_RAM//BANK(1) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( jtc_io, AS_IO, 8, jtc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_NOP // A8-A15 + AM_RANGE(0x01, 0x01) AM_NOP // AD0-AD7 + AM_RANGE(0x02, 0x02) AM_WRITE(p2_w) + AM_RANGE(0x03, 0x03) AM_READWRITE(p3_r, p3_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( jtc ) + PORT_START("Y1") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 \xE2\x86\x93") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90 \xE2\x86\x92") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y2") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Y') + + PORT_START("Y3") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("Y4") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + + PORT_START("Y5") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + + PORT_START("Y6") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + + PORT_START("Y7") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Z') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + + PORT_START("Y8") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(0x2030) // per mille + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + + PORT_START("Y9") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("Y10") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("Y11") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR('*') PORT_CHAR(':') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("Y12") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('+') PORT_CHAR(';') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) +INPUT_PORTS_END + +static INPUT_PORTS_START( jtces23 ) + PORT_START("Y0") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("Y1") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Y') + + PORT_START("Y2") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("Y3") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + + PORT_START("Y4") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + + PORT_START("Y5") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + + PORT_START("Y6") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Z') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + + PORT_START("Y7") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + + PORT_START("Y8") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('[') + + PORT_START("Y9") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(']') + + PORT_START("Y10") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("Y11") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('\\') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RET") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("Y12") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('>') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) //PORT_CODE() PORT_CHAR('=') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) //PORT_CODE() PORT_CHAR('*') PORT_CHAR('^') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y13") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) // DBS + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) // DEL + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SPA + + PORT_START("Y14") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) // INS + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) // HOM + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("Y15") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) // CLS + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SOL + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) // RET +INPUT_PORTS_END + +static INPUT_PORTS_START( jtces40 ) + PORT_START("Y1") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHT3") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHT2") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHT1") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("Y2") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y') + + PORT_START("Y3") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("Y4") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + + PORT_START("Y5") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("Y6") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + + PORT_START("Y7") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("Y8") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("Y9") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('[') PORT_CHAR('{') + + PORT_START("Y10") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("Y11") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('=') PORT_CHAR('_') + + PORT_START("Y12") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('+') PORT_CHAR('-') PORT_CHAR('\\') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('*') PORT_CHAR('/') PORT_CHAR('|') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RET") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR('?') PORT_CHAR('~') +INPUT_PORTS_END + +/* Video */ + +void jtc_state::video_start() +{ +} + +UINT32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, sx; + + for (y = 0; y < 64; y++) + { + for (sx = 0; sx < 8; sx++) + { + UINT8 data = m_video_ram[(y * 8) + sx]; + + for (x = 0; x < 8; x++) + { + int color = BIT(data, x); + bitmap.pix16(y, (sx * 8) + x) = color; + } + } + } + + return 0; +} + +void jtces23_state::video_start() +{ +} + +UINT32 jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, sx; + + for (y = 0; y < 128; y++) + { + for (sx = 0; sx < 16; sx++) + { + UINT8 data = m_video_ram[(y * 16) + sx]; + + for (x = 0; x < 8; x++) + { + int color = BIT(data, x); + bitmap.pix16(y, (sx * 8) + x) = color; + } + } + } + + return 0; +} + +PALETTE_INIT_MEMBER(jtc_state,jtc_es40) +{ +} + +void jtces40_state::video_start() +{ + /* allocate memory */ + m_video_ram.allocate(JTC_ES40_VIDEORAM_SIZE); + m_color_ram_r = auto_alloc_array(machine(), UINT8, JTC_ES40_VIDEORAM_SIZE); + m_color_ram_g = auto_alloc_array(machine(), UINT8, JTC_ES40_VIDEORAM_SIZE); + m_color_ram_b = auto_alloc_array(machine(), UINT8, JTC_ES40_VIDEORAM_SIZE); + + /* register for state saving */ + save_item(NAME(m_video_bank)); + save_pointer(NAME(m_video_ram.target()), JTC_ES40_VIDEORAM_SIZE); + save_pointer(NAME(m_color_ram_r), JTC_ES40_VIDEORAM_SIZE); + save_pointer(NAME(m_color_ram_g), JTC_ES40_VIDEORAM_SIZE); + save_pointer(NAME(m_color_ram_b), JTC_ES40_VIDEORAM_SIZE); + save_item(NAME(m_centronics_busy)); +} + +UINT32 jtces40_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, sx; + + for (y = 0; y < 192; y++) + { + for (sx = 0; sx < 40; sx++) + { + UINT8 data = m_video_ram[(y * 40) + sx]; + UINT8 color_r = m_color_ram_r[(y * 40) + sx]; + UINT8 color_g = m_color_ram_g[(y * 40) + sx]; + UINT8 color_b = m_color_ram_b[(y * 40) + sx]; + + for (x = 0; x < 8; x++) + { + int color = (BIT(color_r, x) << 3) | (BIT(color_g, x) << 2) | (BIT(color_b, x) << 1) | BIT(data, x); + + bitmap.pix16(y, (sx * 8) + x) = color; + } + } + } + + return 0; +} + +/* Machine Initialization */ + +void jtc_state::machine_start() +{ + /* register for state saving */ +} + +/* Machine Driver */ + +/* F4 Character Displayer */ +static const gfx_layout jtces23_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 64, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout jtces40_charlayout = +{ + 8, 8, /* 8 x 16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( jtces23 ) + GFXDECODE_ENTRY( UB8830D_TAG, 0x1000, jtces23_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( jtces40 ) + GFXDECODE_ENTRY( UB8830D_TAG, 0x1000, jtces40_charlayout, 0, 8 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( basic, jtc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(UB8830D_TAG, UB8830D, XTAL_8MHz) + MCFG_CPU_PROGRAM_MAP(jtc_mem) + MCFG_CPU_IO_MAP(jtc_io) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(1, "mono", 0.25) + + /* cassette */ + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + /* printer */ + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(jtc_state, write_centronics_busy)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( jtc, basic ) + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(jtc_state, screen_update) + MCFG_SCREEN_SIZE(64, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 64-1, 0, 64-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( jtces88, jtc, jtces88_state ) + /* basic machine hardware */ + MCFG_CPU_MODIFY(UB8830D_TAG) + MCFG_CPU_PROGRAM_MAP(jtc_es1988_mem) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( jtces23, basic, jtces23_state ) + /* basic machine hardware */ + MCFG_CPU_MODIFY(UB8830D_TAG) + MCFG_CPU_PROGRAM_MAP(jtc_es23_mem) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(jtc_state, screen_update) + MCFG_SCREEN_SIZE(128, 128) + MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 128-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", jtces23) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( jtces40, basic, jtces40_state ) + /* basic machine hardware */ + MCFG_CPU_MODIFY(UB8830D_TAG) + MCFG_CPU_PROGRAM_MAP(jtc_es40_mem) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(jtc_state, screen_update) + MCFG_SCREEN_SIZE(320, 192) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 192-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", jtces40) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(jtc_state,jtc_es40) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8K") + MCFG_RAM_EXTRA_OPTIONS("16K,32K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( jtc ) + ROM_REGION( 0x10000, UB8830D_TAG, 0 ) + ROM_LOAD( "u883rom.bin", 0x0000, 0x0800, CRC(2453c8c1) SHA1(816f5d08f8064b69b1779eb6661fde091aa58ba8) ) + ROM_LOAD( "u2716c1.bin", 0x0800, 0x0800, NO_DUMP ) + ROM_LOAD( "u2716c2.bin", 0x2000, 0x0800, NO_DUMP ) +ROM_END + +ROM_START( jtces88 ) + ROM_REGION( 0x10000, UB8830D_TAG, 0 ) + ROM_LOAD( "u883rom.bin", 0x0000, 0x0800, CRC(2453c8c1) SHA1(816f5d08f8064b69b1779eb6661fde091aa58ba8) ) + ROM_LOAD( "es1988_0800.bin", 0x0800, 0x0800, CRC(af3e882f) SHA1(65af0d0f5f882230221e9552707d93ed32ba794d) ) + ROM_LOAD( "es1988_2000.bin", 0x2000, 0x0800, CRC(5ff87c1e) SHA1(fbd2793127048bd9706970b7bce84af2cb258dc5) ) +ROM_END + +ROM_START( jtces23 ) + ROM_REGION( 0x10000, UB8830D_TAG, 0 ) + ROM_LOAD( "u883rom.bin", 0x0000, 0x0800, CRC(2453c8c1) SHA1(816f5d08f8064b69b1779eb6661fde091aa58ba8) ) + ROM_LOAD( "es23_0800.bin", 0x0800, 0x1000, CRC(16128b64) SHA1(90fb0deeb5660f4a2bb38d51981cc6223d5ddf6b) ) +ROM_END + +ROM_START( jtces40 ) + ROM_REGION( 0x10000, UB8830D_TAG, 0 ) + ROM_LOAD( "u883rom.bin", 0x0000, 0x0800, CRC(2453c8c1) SHA1(816f5d08f8064b69b1779eb6661fde091aa58ba8) ) + ROM_LOAD( "es40_0800.bin", 0x0800, 0x1800, CRC(770c87ce) SHA1(1a5227ba15917f2a572cb6c27642c456f5b32b90) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, jtc, 0, 0, jtc, jtc, driver_device, 0, "Jugend+Technik", "CompJU+TEr", MACHINE_NOT_WORKING ) +COMP( 1988, jtces88, jtc, 0, jtces88,jtc, driver_device, 0, "Jugend+Technik", "CompJU+TEr (EMR-ES 1988)", MACHINE_NOT_WORKING ) +COMP( 1989, jtces23, jtc, 0, jtces23,jtces23, driver_device, 0, "Jugend+Technik", "CompJU+TEr (ES 2.3)", MACHINE_NOT_WORKING ) +COMP( 1990, jtces40, jtc, 0, jtces40,jtces40, driver_device, 0, "Jugend+Technik", "CompJU+TEr (ES 4.0)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/juicebox.c b/src/mame/drivers/juicebox.c new file mode 100644 index 00000000000..0e84e6a1b20 --- /dev/null +++ b/src/mame/drivers/juicebox.c @@ -0,0 +1,362 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/******************************************************************************* + + Mattel Juice Box + + (C) 2011 Tim Schuerewegen + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "machine/s3c44b0.h" +#include "machine/smartmed.h" +#include "sound/dac.h" +#include "rendlay.h" + +//#define JUICEBOX_ENTER_DEBUG_MENU +//#define JUICEBOX_DISPLAY_ROM_ID + +#define VERBOSE_LEVEL ( 0 ) + +struct jb_smc_t +{ + int add_latch; + int cmd_latch; + int busy; +}; + +class juicebox_state : public driver_device +{ +public: + juicebox_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dac(*this, "dac"), + m_s3c44b0(*this, "s3c44b0"), + m_smartmedia(*this, "smartmedia") + { } + + required_device m_maincpu; + required_device m_dac; + required_device m_s3c44b0; + required_device m_smartmedia; + UINT32 port[9]; + jb_smc_t smc; + + #if defined(JUICEBOX_ENTER_DEBUG_MENU) || defined(JUICEBOX_DISPLAY_ROM_ID) + int port_g_read_count; + #endif + DECLARE_READ32_MEMBER(juicebox_nand_r); + DECLARE_WRITE32_MEMBER(juicebox_nand_w); + DECLARE_DRIVER_INIT(juicebox); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(port_changed); + inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); + void smc_reset( ); + void smc_init( ); + UINT8 smc_read( ); + void smc_write( UINT8 data); + DECLARE_READ32_MEMBER(s3c44b0_gpio_port_r); + DECLARE_WRITE32_MEMBER(s3c44b0_gpio_port_w); + DECLARE_WRITE16_MEMBER(s3c44b0_i2s_data_w); +}; + +inline void juicebox_state::verboselog(int n_level, const char *s_fmt, ...) +{ + if (VERBOSE_LEVEL >= n_level) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt); + vsprintf( buf, s_fmt, v); + va_end( v); + logerror( "%s: %s", machine().describe_context(), buf); + } +} + + +/*************************************************************************** + MACHINE HARDWARE +***************************************************************************/ + + +// SMARTMEDIA + +void juicebox_state::smc_reset( ) +{ + verboselog(5, "smc_reset\n"); + smc.add_latch = 0; + smc.cmd_latch = 0; +} + +void juicebox_state::smc_init( ) +{ + verboselog(5, "smc_init\n"); + smc_reset(); +} + +UINT8 juicebox_state::smc_read( ) +{ + UINT8 data; + if (m_smartmedia->is_present()) + { + data = m_smartmedia->data_r(); + } + else + { + data = 0xFF; + } + verboselog(5, "smc_read %08X\n", data); + return data; +} + +void juicebox_state::smc_write( UINT8 data) +{ + verboselog(5, "smc_write %08X\n", data); + if (m_smartmedia->is_present()) + { + if (smc.cmd_latch) + { + verboselog(5, "smartmedia_command_w %08X\n", data); + m_smartmedia->command_w(data); + } + else if (smc.add_latch) + { + verboselog(5, "smartmedia_address_w %08X\n", data); + m_smartmedia->address_w(data); + } + else + { + verboselog(5, "smartmedia_data_w %08X\n", data); + m_smartmedia->data_w(data); + } + } +} + +READ32_MEMBER(juicebox_state::s3c44b0_gpio_port_r) +{ + UINT32 data = port[offset]; + switch (offset) + { + case S3C44B0_GPIO_PORT_A : + { + data = 0x00000210; + } + break; + case S3C44B0_GPIO_PORT_B : + { + data = 0x00000000; + } + break; + case S3C44B0_GPIO_PORT_C : + { + // 0C0062C4 -> bit 8 is turned on + //data |= 1 << 13; + data = 0x0000FF15; + data &= (1 << 2) | (1 << 9) | (1 << 10) | (1 << 11); + data |= (1 << 2) | (1 << 9) | (1 << 10) | (1 << 11); + } + break; + case S3C44B0_GPIO_PORT_D : + { + data = 0x00000010; + } + break; + case S3C44B0_GPIO_PORT_E : + { + data = 0x000000DF; + } + break; + case S3C44B0_GPIO_PORT_F : + { + data = data | (0 << 7); + data = 0x0000009F; + data &= ~0xE0; + if (smc.cmd_latch) data = data | 0x00000020; + if (smc.add_latch) data = data | 0x00000040; + if (!smc.busy) data = data | 0x00000080; + } + break; + case S3C44B0_GPIO_PORT_G : + { + data = 0x0000009F; + data = (data & ~0x1F) | (ioport( "PORTG")->read() & 0x1F); + #if defined(JUICEBOX_ENTER_DEBUG_MENU) + if (port_g_read_count++ < 1) + { + data = 0x00000095; // PLAY + REVERSE + } + #elif defined(JUICEBOX_DISPLAY_ROM_ID) + if (port_g_read_count++ < 3) + { + data = 0x0000008A; // RETURN + FORWARD + STAR + } + #endif + } + break; + } +// data = ((rand() & 0xFF) << 24) | ((rand() & 0xFF) << 16) | ((rand() & 0xFF) << 8) | ((rand() & 0xFF) << 0); + return data; +} + +WRITE32_MEMBER(juicebox_state::s3c44b0_gpio_port_w) +{ + port[offset] = data; + switch (offset) + { + case S3C44B0_GPIO_PORT_F : + { + smc.cmd_latch = ((data & 0x00000020) != 0); + smc.add_latch = ((data & 0x00000040) != 0); + verboselog( 5, "s3c44b0_gpio_port_w - nand cle %d ale %d\n", (data & 0x20) ? 1 : 0, (data & 0x40) ? 1 : 0); + } + break; + } +} + +// ... + +READ32_MEMBER(juicebox_state::juicebox_nand_r) +{ + UINT32 data = 0; + if (mem_mask & 0x000000FF) data = data | (smc_read() << 0); + if (mem_mask & 0x0000FF00) data = data | (smc_read() << 8); + if (mem_mask & 0x00FF0000) data = data | (smc_read() << 16); + if (mem_mask & 0xFF000000) data = data | (smc_read() << 24); + verboselog( 5, "juicebox_nand_r %08X %08X %08X\n", offset, mem_mask, data); + return data; +} + +WRITE32_MEMBER(juicebox_state::juicebox_nand_w) +{ + verboselog( 5, "juicebox_nand_w %08X %08X %08X\n", offset, mem_mask, data); + if (mem_mask & 0x000000FF) smc_write((data >> 0) & 0xFF); + if (mem_mask & 0x0000FF00) smc_write((data >> 8) & 0xFF); + if (mem_mask & 0x00FF0000) smc_write((data >> 16) & 0xFF); + if (mem_mask & 0xFF000000) smc_write((data >> 24) & 0xFF); +} + +// I2S + +WRITE16_MEMBER(juicebox_state::s3c44b0_i2s_data_w ) +{ + m_dac->write_signed16(data ^ 0x8000); +} + +// ... + +INPUT_CHANGED_MEMBER(juicebox_state::port_changed) +{ + m_s3c44b0->request_eint((FPTR)param); +} + +// ... + +void juicebox_state::machine_start() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + smc_init(); + + space.install_readwrite_handler(0x01c00000, 0x01c0000b, 0, 0, read32_delegate(FUNC(s3c44b0_device::cpuwrap_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::cpuwrap_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d00000, 0x01d0002b, 0, 0, read32_delegate(FUNC(s3c44b0_device::uart_0_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::uart_0_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d04000, 0x01d0402b, 0, 0, read32_delegate(FUNC(s3c44b0_device::uart_1_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::uart_1_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d14000, 0x01d14013, 0, 0, read32_delegate(FUNC(s3c44b0_device::sio_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::sio_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d18000, 0x01d18013, 0, 0, read32_delegate(FUNC(s3c44b0_device::iis_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::iis_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d20000, 0x01d20057, 0, 0, read32_delegate(FUNC(s3c44b0_device::gpio_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::gpio_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d30000, 0x01d3000b, 0, 0, read32_delegate(FUNC(s3c44b0_device::wdt_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::wdt_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d40000, 0x01d4000b, 0, 0, read32_delegate(FUNC(s3c44b0_device::adc_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::adc_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d50000, 0x01d5004f, 0, 0, read32_delegate(FUNC(s3c44b0_device::pwm_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::pwm_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d60000, 0x01d6000f, 0, 0, read32_delegate(FUNC(s3c44b0_device::iic_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::iic_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01d80000, 0x01d8000f, 0, 0, read32_delegate(FUNC(s3c44b0_device::clkpow_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::clkpow_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01e00000, 0x01e0003f, 0, 0, read32_delegate(FUNC(s3c44b0_device::irq_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::irq_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01e80000, 0x01e8001b, 0, 0, read32_delegate(FUNC(s3c44b0_device::zdma_0_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::zdma_0_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01e80020, 0x01e8003b, 0, 0, read32_delegate(FUNC(s3c44b0_device::zdma_1_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::zdma_1_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01f00000, 0x01f00047, 0, 0, read32_delegate(FUNC(s3c44b0_device::lcd_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::lcd_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01f80000, 0x01f8001b, 0, 0, read32_delegate(FUNC(s3c44b0_device::bdma_0_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::bdma_0_w), &(*m_s3c44b0))); + space.install_readwrite_handler(0x01f80020, 0x01f8003b, 0, 0, read32_delegate(FUNC(s3c44b0_device::bdma_1_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::bdma_1_w), &(*m_s3c44b0))); +} + +void juicebox_state::machine_reset() +{ + m_maincpu->reset(); + smc_reset(); +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( juicebox_map, AS_PROGRAM, 32, juicebox_state ) + AM_RANGE(0x00000000, 0x007fffff) AM_ROM + AM_RANGE(0x04000000, 0x04ffffff) AM_READWRITE(juicebox_nand_r, juicebox_nand_w ) + AM_RANGE(0x0c000000, 0x0c1fffff) AM_RAM AM_MIRROR(0x00600000) +ADDRESS_MAP_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +DRIVER_INIT_MEMBER(juicebox_state,juicebox) +{ + // do nothing +} + +static MACHINE_CONFIG_START( juicebox, juicebox_state ) + MCFG_CPU_ADD("maincpu", ARM7, 66000000) + MCFG_CPU_PROGRAM_MAP(juicebox_map) + + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(240, 160) + MCFG_SCREEN_VISIBLE_AREA(0, 240 - 1, 0, 160 - 1) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_SCREEN_UPDATE_DEVICE("s3c44b0", s3c44b0_device, video_update) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + + MCFG_DEVICE_ADD("s3c44b0", S3C44B0, 10000000) + MCFG_S3C44B0_GPIO_PORT_R_CB(READ32(juicebox_state, s3c44b0_gpio_port_r)) + MCFG_S3C44B0_GPIO_PORT_W_CB(WRITE32(juicebox_state, s3c44b0_gpio_port_w)) + MCFG_S3C44B0_I2S_DATA_W_CB(WRITE16(juicebox_state, s3c44b0_i2s_data_w)) + + MCFG_DEVICE_ADD("smartmedia", SMARTMEDIA, 0) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","juicebox") +MACHINE_CONFIG_END + +static INPUT_PORTS_START( juicebox ) + PORT_START( "PORTG" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("RETURN") PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("PLAY") PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("FORWARD") PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("REVERSE") PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("STAR") PORT_PLAYER(1) +INPUT_PORTS_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +ROM_START( juicebox ) + ROM_REGION( 0x800000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "juicebox", "Juice Box v.28 08242004" ) + ROMX_LOAD( "juicebox.rom", 0, 0x800000, CRC(ac731197) SHA1(8278891c3531b3b6b5fec2a97a3ef6f0de1ac81d), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "uclinuxp", "uClinux 2.4.24-uc0 (patched)" ) + ROMX_LOAD( "newboot.rom", 0, 0x1A0800, CRC(443f48b7) SHA1(38f0dc07b5cf02b972a851aa9e87f5d93d03f629), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "uclinux", "uClinux 2.4.24-uc0" ) + ROMX_LOAD( "image.rom", 0, 0x19E400, CRC(6c0308bf) SHA1(5fe21a38a4cd0d86bb60920eb100138b0e924d90), ROM_BIOS(3) ) +ROM_END + +COMP(2004, juicebox, 0, 0, juicebox, juicebox, juicebox_state, juicebox, "Mattel", "Juice Box", 0) diff --git a/src/mame/drivers/junior.c b/src/mame/drivers/junior.c new file mode 100644 index 00000000000..d40101213d6 --- /dev/null +++ b/src/mame/drivers/junior.c @@ -0,0 +1,259 @@ +// license:??? +// copyright-holders:Robbbert, Manfred Schneider +/*************************************************************************** + + Elektor Junior + + 17/07/2009 Skeleton driver. + +This is heavily based on the KIM-1, the keycodes and operation being +identical. + +Pasting: + 0-F : as is + + (inc) : ^ + AD : - + DA : = + GO : X + +(note: DA only works when addressing RAM) + +Test Paste: + =11^22^33^44^55^66^77^88^99^-0000 + Now press up-arrow to confirm the data has been entered. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/mos6530n.h" +#include "junior.lh" + + +class junior_state : public driver_device +{ +public: + junior_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_riot(*this, "riot") + , + m_maincpu(*this, "maincpu") { } + + required_device m_riot; + DECLARE_READ8_MEMBER(junior_riot_a_r); + DECLARE_READ8_MEMBER(junior_riot_b_r); + DECLARE_WRITE8_MEMBER(junior_riot_a_w); + DECLARE_WRITE8_MEMBER(junior_riot_b_w); + DECLARE_WRITE_LINE_MEMBER(junior_riot_irq); + UINT8 m_port_a; + UINT8 m_port_b; + UINT8 m_led_time[6]; + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(junior_reset); + TIMER_DEVICE_CALLBACK_MEMBER(junior_update_leds); + required_device m_maincpu; +}; + + + + +static ADDRESS_MAP_START(junior_mem, AS_PROGRAM, 8, junior_state) + ADDRESS_MAP_GLOBAL_MASK(0x1FFF) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x03ff) AM_RAM // 1K RAM + AM_RANGE(0x1a00, 0x1a7f) AM_DEVICE("riot", mos6532_t, ram_map) + AM_RANGE(0x1a80, 0x1a9f) AM_DEVICE("riot", mos6532_t, io_map) + AM_RANGE(0x1c00, 0x1fff) AM_ROM // Monitor +ADDRESS_MAP_END + + +INPUT_CHANGED_MEMBER(junior_state::junior_reset) +{ + if (newval == 0) + m_maincpu->reset(); +} + + +/* Input ports */ +static INPUT_PORTS_START( junior ) +PORT_START("LINE0") /* IN0 keys row 0 */ + PORT_BIT( 0x80, 0x00, IPT_UNUSED ) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + + PORT_START("LINE1") /* IN1 keys row 1 */ + PORT_BIT( 0x80, 0x00, IPT_UNUSED ) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("LINE2") /* IN2 keys row 2 */ + PORT_BIT( 0x80, 0x00, IPT_UNUSED ) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_F6) + + PORT_START("LINE3") /* IN3 STEP and RESET keys, MODE switch */ + PORT_BIT( 0x80, 0x00, IPT_UNUSED ) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("sw1: ST") PORT_CODE(KEYCODE_F7) + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("sw2: RST") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, junior_state, junior_reset, NULL) + PORT_DIPNAME(0x10, 0x10, "sw3: SS (NumLock)") PORT_CODE(KEYCODE_NUMLOCK) PORT_TOGGLE + PORT_DIPSETTING( 0x00, "single step") + PORT_DIPSETTING( 0x10, "run") + PORT_BIT( 0x08, 0x00, IPT_UNUSED ) + PORT_BIT( 0x04, 0x00, IPT_UNUSED ) + PORT_BIT( 0x02, 0x00, IPT_UNUSED ) + PORT_BIT( 0x01, 0x00, IPT_UNUSED ) +INPUT_PORTS_END + + + +READ8_MEMBER( junior_state::junior_riot_a_r ) +{ + UINT8 data = 0xff; + + switch( ( m_port_b >> 1 ) & 0x0f ) + { + case 0: + data = ioport("LINE0")->read(); + break; + case 1: + data = ioport("LINE1")->read(); + break; + case 2: + data = ioport("LINE2")->read(); + break; + } + return data; + +} + + +READ8_MEMBER( junior_state::junior_riot_b_r ) +{ + if ( m_port_b & 0x20 ) + return 0xFF; + + return 0x7F; + +} + + +WRITE8_MEMBER( junior_state::junior_riot_a_w ) +{ + UINT8 idx = ( m_port_b >> 1 ) & 0x0f; + + m_port_a = data; + + if ((idx >= 4 && idx < 10) & ( m_port_a != 0xff )) + { + output_set_digit_value( idx-4, m_port_a ^ 0x7f ); + m_led_time[idx - 4] = 10; + } +} + + +WRITE8_MEMBER( junior_state::junior_riot_b_w ) +{ + UINT8 idx = ( data >> 1 ) & 0x0f; + + m_port_b = data; + + if ((idx >= 4 && idx < 10) & ( m_port_a != 0xff )) + { + output_set_digit_value( idx-4, m_port_a ^ 0x7f ); + m_led_time[idx - 4] = 10; + } +} + + +WRITE_LINE_MEMBER( junior_state::junior_riot_irq ) +{ + m_maincpu->set_input_line(M6502_IRQ_LINE, state ? HOLD_LINE : CLEAR_LINE); +} + + +TIMER_DEVICE_CALLBACK_MEMBER(junior_state::junior_update_leds) +{ + int i; + + for ( i = 0; i < 6; i++ ) + { + if ( m_led_time[i] ) + m_led_time[i]--; + else + output_set_digit_value( i, 0 ); + } +} + + +void junior_state::machine_start() +{ + save_item(NAME(m_port_a)); + save_item(NAME(m_port_b)); +} + + +void junior_state::machine_reset() +{ + int i; + + for ( i = 0; i < 6; i++ ) + m_led_time[i] = 0; +} + + +static MACHINE_CONFIG_START( junior, junior_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6502, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(junior_mem) + MCFG_QUANTUM_TIME(attotime::from_hz(50)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_junior ) + + /* Devices */ + MCFG_DEVICE_ADD("riot", MOS6532n, XTAL_1MHz) + MCFG_MOS6530n_IN_PA_CB(READ8(junior_state, junior_riot_a_r)) + MCFG_MOS6530n_OUT_PA_CB(WRITE8(junior_state, junior_riot_a_w)) + MCFG_MOS6530n_IN_PB_CB(READ8(junior_state, junior_riot_b_r)) + MCFG_MOS6530n_OUT_PB_CB(WRITE8(junior_state, junior_riot_b_w)) + MCFG_MOS6530n_IRQ_CB(WRITELINE(junior_state, junior_riot_irq)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", junior_state, junior_update_leds, attotime::from_hz(50)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( junior ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS("orig") + + ROM_SYSTEM_BIOS( 0, "orig", "Original ESS503" ) + ROMX_LOAD( "ess503.ic2", 0x1c00, 0x0400, CRC(9e804f8c) SHA1(181bdb69fb4711cb008e7966747d4775a5e3ef69), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "mod-orig", "Mod-Original (2708)" ) + ROMX_LOAD( "junior-mod.ic2", 0x1c00, 0x0400, CRC(ee8aa69d) SHA1(a132a51603f1a841c354815e6d868b335ac84364), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS( 2, "2732", "Just monitor (2732)" ) + ROMX_LOAD( "junior27321a.ic2", 0x1c00, 0x0400, CRC(e22f24cc) SHA1(a6edb52a9eea5e99624c128065e748e5a3fb2e4c), ROM_BIOS(3)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, junior, 0, 0, junior, junior, driver_device, 0, "Elektor Electronics", "Junior Computer", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/jupace.c b/src/mame/drivers/jupace.c new file mode 100644 index 00000000000..9a3856bcc1c --- /dev/null +++ b/src/mame/drivers/jupace.c @@ -0,0 +1,835 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Robbbert +/*************************************************************************** +Jupiter Ace memory map + + CPU: Z80 + 0000-1fff ROM + 2000-23ff Mirror of 2400-27FF + 2400-27ff RAM (1K RAM used for screen and edit/cassette buffer) + 2800-2bff Mirror of 2C00-2FFF + 2c00-2fff RAM (1K RAM for char set, write only) + 3000-3bff Mirror of 3C00-3FFF + 3c00-3fff RAM (1K RAM standard) + 4000-7fff RAM (16K Expansion) + 8000-ffff RAM (48K Expansion) + +Interrupts: + + IRQ: + 50Hz vertical sync + +Ports: + + Out 0xfe: + Tape and buzzer + + In 0xfe: + Keyboard input, tape, and buzzer + + http://www.jupiter-ace.co.uk/ + +***************************************************************************/ + +/* + + TODO: + + - Ace Colour Board + - 96K ram expansion + - Deep Thought disc interface (6850, 6821) + +*/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "formats/ace_tap.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8255.h" +#include "machine/ram.h" +#include "machine/z80pio.h" +#include "sound/ay8910.h" +#include "sound/sp0256.h" +#include "sound/speaker.h" +#include "sound/wave.h" + + +#define Z80_TAG "z0" +#define AY8910_TAG "ay8910" +#define I8255_TAG "i8255" +#define SP0256AL2_TAG "ic1" +#define Z80PIO_TAG "z80pio" +#define CENTRONICS_TAG "centronics" +#define SCREEN_TAG "screen" + +class ace_state : public driver_device +{ +public: + ace_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ppi(*this, I8255_TAG), + m_z80pio(*this, Z80PIO_TAG), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_centronics(*this, CENTRONICS_TAG), + m_ram(*this, RAM_TAG), + m_sp0256(*this, SP0256AL2_TAG), + m_video_ram(*this, "video_ram"), + m_char_ram(*this, "char_ram"), + m_a8(*this, "A8"), + m_a9(*this, "A9"), + m_a10(*this, "A10"), + m_a11(*this, "A11"), + m_a12(*this, "A12"), + m_a13(*this, "A13"), + m_a14(*this, "A14"), + m_a15(*this, "A15"), + m_joy(*this, "JOY") + { } + + virtual void machine_start(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + DECLARE_READ8_MEMBER( ppi_pa_r ); + DECLARE_WRITE8_MEMBER( ppi_pa_w ); + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_WRITE8_MEMBER( ppi_pb_w ); + DECLARE_READ8_MEMBER( ppi_pc_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + DECLARE_READ8_MEMBER( ppi_control_r ); + DECLARE_WRITE8_MEMBER( ppi_control_w ); + DECLARE_READ8_MEMBER( pio_pa_r ); + DECLARE_WRITE8_MEMBER( pio_pa_w ); + + UINT32 screen_update_ace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(set_irq); + TIMER_DEVICE_CALLBACK_MEMBER(clear_irq); + DECLARE_READ8_MEMBER(pio_ad_r); + DECLARE_READ8_MEMBER(pio_bd_r); + DECLARE_READ8_MEMBER(pio_ac_r); + DECLARE_READ8_MEMBER(pio_bc_r); + DECLARE_WRITE8_MEMBER(pio_ad_w); + DECLARE_WRITE8_MEMBER(pio_bd_w); + DECLARE_WRITE8_MEMBER(pio_ac_w); + DECLARE_WRITE8_MEMBER(pio_bc_w); + DECLARE_READ8_MEMBER(sby_r); + DECLARE_WRITE8_MEMBER(ald_w); + DECLARE_SNAPSHOT_LOAD_MEMBER( ace ); + +private: + required_device m_maincpu; + required_device m_ppi; + required_device m_z80pio; + required_device m_speaker; + required_device m_cassette; + required_device m_centronics; + required_device m_ram; + required_device m_sp0256; + required_shared_ptr m_video_ram; + required_shared_ptr m_char_ram; + required_ioport m_a8; + required_ioport m_a9; + required_ioport m_a10; + required_ioport m_a11; + required_ioport m_a12; + required_ioport m_a13; + required_ioport m_a14; + required_ioport m_a15; + required_ioport m_joy; +}; + + +/* Load in .ace files. These are memory images of 0x2000 to 0x7fff + and compressed as follows: + + ED 00 : End marker + ED : repeat count times + : +*/ + +/****************************************************************************** + Snapshot Handling +******************************************************************************/ + +SNAPSHOT_LOAD_MEMBER( ace_state, ace ) +{ + cpu_device *cpu = m_maincpu; + UINT8 *RAM = memregion(cpu->tag())->base(); + address_space &space = cpu->space(AS_PROGRAM); + unsigned char ace_repeat, ace_byte, loop; + int done=0, ace_index=0x2000; + + if (m_ram->size() < 16*1024) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "At least 16KB RAM expansion required"); + image.message("At least 16KB RAM expansion required"); + return IMAGE_INIT_FAIL; + } + + logerror("Loading file %s.\r\n", image.filename()); + while (!done && (ace_index < 0x8001)) + { + image.fread( &ace_byte, 1); + if (ace_byte == 0xed) + { + image.fread(&ace_byte, 1); + switch (ace_byte) + { + case 0x00: + logerror("File loaded!\r\n"); + done = 1; + break; + case 0x01: + image.fread(&ace_byte, 1); + RAM[ace_index++] = ace_byte; + break; + default: + image.fread(&ace_repeat, 1); + for (loop = 0; loop < ace_byte; loop++) + RAM[ace_index++] = ace_repeat; + break; + } + } + else + RAM[ace_index++] = ace_byte; + } + + logerror("Decoded %X bytes.\r\n", ace_index-0x2000); + + if (!done) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "EOF marker not found"); + image.message("EOF marker not found"); + return IMAGE_INIT_FAIL; + } + + // patch CPU registers + // Some games do not follow the standard, and have rubbish in the CPU area. So, + // we check that some other bytes are correct. + // 2080 = memory size of original machine, should be 0000 or 8000 or C000. + // 2118 = new stack pointer, do not use if between 8000 and FF00. + + ace_index = RAM[0x2080] | (RAM[0x2081] << 8); + + if ((ace_index & 0x3FFF)==0) + { + cpu->set_state_int(Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8)); + cpu->set_state_int(Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8)); + cpu->set_state_int(Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8)); + cpu->set_state_int(Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8)); + cpu->set_state_int(Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8)); + cpu->set_state_int(Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8)); + cpu->set_pc(RAM[0x211c] | (RAM[0x211d] << 8)); + cpu->set_state_int(Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8)); + cpu->set_state_int(Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8)); + cpu->set_state_int(Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8)); + cpu->set_state_int(Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8)); + cpu->set_state_int(Z80_IM, RAM[0x2130]); + cpu->set_state_int(Z80_IFF1, RAM[0x2134]); + cpu->set_state_int(Z80_IFF2, RAM[0x2138]); + cpu->set_state_int(Z80_I, RAM[0x213c]); + cpu->set_state_int(Z80_R, RAM[0x2140]); + + if ((RAM[0x2119] < 0x80) || !ace_index) + cpu->set_state_int(STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8)); + } + + /* Copy data to the address space */ + for (ace_index = 0x2000; ace_index < 0x8000; ace_index++) + space.write_byte(ace_index, RAM[ace_index]); + + return IMAGE_INIT_PASS; +} + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// io_r - +//------------------------------------------------- + +READ8_MEMBER( ace_state::io_r ) +{ + UINT8 data = 0xff; + + if (!BIT(offset, 8)) data &= m_a8->read(); + if (!BIT(offset, 9)) data &= m_a9->read(); + if (!BIT(offset, 10)) data &= m_a10->read(); + if (!BIT(offset, 11)) data &= m_a11->read(); + if (!BIT(offset, 12)) data &= m_a12->read(); + if (!BIT(offset, 13)) data &= m_a13->read(); + if (!BIT(offset, 14)) data &= m_a14->read(); + + if (!BIT(offset, 15)) + { + data &= m_a15->read(); + + m_cassette->output(-1); + m_speaker->level_w(0); + } + + if (m_cassette->input() > 0) + { + data &= ~0x20; + } + + return data; +} + + +//------------------------------------------------- +// io_w - +//------------------------------------------------- + +WRITE8_MEMBER( ace_state::io_w ) +{ + m_cassette->output(1); + m_speaker->level_w(1); +} + + +//------------------------------------------------- +// ppi_r - +//------------------------------------------------- + +READ8_MEMBER( ace_state::ppi_pa_r ) +{ + return m_ppi->read(space, 0); +} + +READ8_MEMBER( ace_state::ppi_pb_r ) +{ + return m_ppi->read(space, 1); +} + +READ8_MEMBER( ace_state::ppi_pc_r ) +{ + return m_ppi->read(space, 2); +} + +READ8_MEMBER( ace_state::ppi_control_r ) +{ + return m_ppi->read(space, 3); +} + + +//------------------------------------------------- +// ppi_w - +//------------------------------------------------- + +WRITE8_MEMBER( ace_state::ppi_pa_w ) +{ + m_ppi->write(space, 0, data); +} + +WRITE8_MEMBER( ace_state::ppi_pb_w ) +{ + m_ppi->write(space, 1, data); +} + +WRITE8_MEMBER( ace_state::ppi_pc_w ) +{ + m_ppi->write(space, 2, data); +} + +WRITE8_MEMBER( ace_state::ppi_control_w ) +{ + m_ppi->write(space, 3, data); +} + + +//------------------------------------------------- +// pio_r - +//------------------------------------------------- + +READ8_MEMBER(ace_state::pio_ad_r) +{ + return m_z80pio->data_read(0); +} + +READ8_MEMBER(ace_state::pio_bd_r) +{ + return m_z80pio->data_read(1); +} + +READ8_MEMBER(ace_state::pio_ac_r) +{ + return m_z80pio->control_read(); +} + +READ8_MEMBER(ace_state::pio_bc_r) +{ + return m_z80pio->control_read(); +} + + +//------------------------------------------------- +// pio_w - +//------------------------------------------------- + +WRITE8_MEMBER(ace_state::pio_ad_w) +{ + m_z80pio->data_write(0, data); +} + +WRITE8_MEMBER(ace_state::pio_bd_w) +{ + m_z80pio->data_write(1, data); +} + +WRITE8_MEMBER(ace_state::pio_ac_w) +{ + m_z80pio->control_write(0, data); +} + +WRITE8_MEMBER(ace_state::pio_bc_w) +{ + m_z80pio->control_write(1, data); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( ace_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ace_mem, AS_PROGRAM, 8, ace_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0400) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0x2800, 0x2bff) AM_MIRROR(0x0400) AM_RAM AM_SHARE("char_ram") AM_REGION(Z80_TAG, 0xfc00) + AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM + AM_RANGE(0x4000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( ace_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ace_io, AS_IO, 8, ace_state ) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xfffe) AM_MASK(0xff00) AM_READWRITE(io_r, io_w) + AM_RANGE(0x01, 0x01) AM_MIRROR(0xff00) AM_READ_PORT("JOY") + AM_RANGE(0x41, 0x41) AM_MIRROR(0xff80) AM_READWRITE(ppi_pa_r, ppi_pa_w) + AM_RANGE(0x43, 0x43) AM_MIRROR(0xff80) AM_READWRITE(ppi_pb_r, ppi_pb_w) + AM_RANGE(0x45, 0x45) AM_MIRROR(0xff80) AM_READWRITE(ppi_pc_r, ppi_pc_w) + AM_RANGE(0x47, 0x47) AM_MIRROR(0xff80) AM_READWRITE(ppi_control_r, ppi_control_w) + AM_RANGE(0x81, 0x81) AM_MIRROR(0xff38) AM_READWRITE(pio_ad_r, pio_ad_w) + AM_RANGE(0x83, 0x83) AM_MIRROR(0xff38) AM_READWRITE(pio_bd_r, pio_bd_w) + AM_RANGE(0x85, 0x85) AM_MIRROR(0xff38) AM_READWRITE(pio_ac_r, pio_ac_w) + AM_RANGE(0x87, 0x87) AM_MIRROR(0xff38) AM_READWRITE(pio_bc_r, pio_bc_w) + AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w) + AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_DEVREADWRITE(AY8910_TAG, ay8910_device, data_r, data_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( ace ) +//------------------------------------------------- + +static INPUT_PORTS_START( ace ) + PORT_START("A8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Symbol Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(':') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('\xA3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('?') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("A9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR('~') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR('|') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR('\\') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("A10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR('>') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("A11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_LEFT) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("A12") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_DOWN) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_UP) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("A13") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(';') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00A9) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(']') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR('[') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("A14") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR('-') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("h H \xE2\x86\x91") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("A15") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR('.') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(',') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR('/') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("JOY") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +//------------------------------------------------- +// gfx_layout ace_charlayout +//------------------------------------------------- + +static const gfx_layout ace_charlayout = +{ + 8,8, + 128, + 1, + { RGN_FRAC(0,1) }, + { STEP8(0,1) }, + { STEP8(0,8) }, + 8*8 +}; + + +//------------------------------------------------- +// GFXDECODE( ace ) +//------------------------------------------------- + +static GFXDECODE_START( ace ) + GFXDECODE_ENTRY( Z80_TAG, 0xfc00, ace_charlayout, 0, 1 ) +GFXDECODE_END + + +//------------------------------------------------- +// TIMER_DEVICE_CALLBACK_MEMBER( set_irq ) +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(ace_state::set_irq) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); +} + + +//------------------------------------------------- +// TIMER_DEVICE_CALLBACK_MEMBER( clear_irq ) +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(ace_state::clear_irq) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); +} + + +UINT32 ace_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=56,ma=0,x; + + for (y = 0; y < 24; y++) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++, 40); + + for (x = ma; x < ma+32; x++) + { + chr = m_video_ram[x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=32; + } + return 0; +} + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// I8255A interface +//------------------------------------------------- + +READ8_MEMBER(ace_state::sby_r) +{ + /* + + bit description + + PC0 SP0256 SBY + PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 + + */ + + return m_sp0256->sby_r(); +} + +WRITE8_MEMBER(ace_state::ald_w) +{ + /* + + bit description + + PA0 SP0256 A1 + PA1 SP0256 A2 + PA2 SP0256 A3 + PA3 SP0256 A4 + PA4 SP0256 A5 + PA5 SP0256 A6 + PA6 SP0256 _ALD + PA7 + + */ + + if (!BIT(data, 6)) + { + m_sp0256->ald_w(space, 0, data & 0x3f); + } +} + +//------------------------------------------------- +// Z80PIO +//------------------------------------------------- + +READ8_MEMBER( ace_state::pio_pa_r ) +{ + /* + + bit description + + PA0 + PA1 RxD + PA2 + PA3 + PA4 + PA5 + PA6 + PA7 + + */ + + return 0; +} + +WRITE8_MEMBER( ace_state::pio_pa_w ) +{ + /* + + bit description + + PA0 RTS + PA1 + PA2 CTS + PA3 TxD + PA4 + PA5 + PA6 STB + PA7 + + */ + + // centronics strobe + m_centronics->write_strobe(!BIT(data, 6)); +} + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( ace ) +//------------------------------------------------- + +void ace_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* configure RAM */ + switch (m_ram->size()) + { + case 1*1024: + program.unmap_readwrite(0x4000, 0xffff); + break; + + case 16*1024: + program.unmap_readwrite(0x8000, 0xffff); + break; + + case 32*1024: + program.unmap_readwrite(0xc000, 0xffff); + break; + } +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( ace ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ace, ace_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_6_5MHz/2) + MCFG_CPU_PROGRAM_MAP(ace_mem) + MCFG_CPU_IO_MAP(ace_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(ace_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_6_5MHz, 416, 0, 336, 312, 0, 304) + MCFG_SCREEN_PALETTE("palette") + + MCFG_TIMER_DRIVER_ADD_SCANLINE("set_irq", ace_state, set_irq, SCREEN_TAG, 31*8, 264) + MCFG_TIMER_DRIVER_ADD_SCANLINE("clear_irq", ace_state, clear_irq, SCREEN_TAG, 32*8, 264) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ace) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_6_5MHz/2) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_ADD(SP0256AL2_TAG, SP0256, XTAL_3MHz) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(ace_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) + MCFG_CASSETTE_INTERFACE("jupace_cass") + + MCFG_SNAPSHOT_ADD("snapshot", ace_state, ace, "ace", 1) + + MCFG_DEVICE_ADD(I8255_TAG, I8255A, 0) + MCFG_I8255_IN_PORTB_CB(READ8(ace_state, sby_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(ace_state, ald_w)) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_6_5MHz/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(ace_state, pio_pa_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(ace_state, pio_pa_w)) + MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") + MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "jupace_cass") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( ace ) +//------------------------------------------------- + +ROM_START( jupace ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "rom-a.z1", 0x0000, 0x1000, CRC(dc8438a5) SHA1(8fa97eb71e5dd17c7d190c6587ee3840f839347c) ) + ROM_LOAD( "rom-b.z2", 0x1000, 0x1000, CRC(4009f636) SHA1(98c5d4bcd74bcf014268cf4c00b2007ea5cc21f3) ) + + ROM_REGION( 0x1000, "fdc", 0 ) // Deep Thought disc interface + ROM_LOAD( "dos 4.bin", 0x0000, 0x1000, CRC(04c70448) SHA1(53ddcced6ae2feafd687a3b55864726656b71412) ) + + ROM_REGION( 0x10000, SP0256AL2_TAG, 0 ) + ROM_LOAD( "sp0256-al2.ic1", 0x000, 0x800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1981, jupace, 0, 0, ace, ace, driver_device, 0, "Jupiter Cantab", "Jupiter Ace" , 0 ) diff --git a/src/mame/drivers/jupiter.c b/src/mame/drivers/jupiter.c new file mode 100644 index 00000000000..7d0fc11250a --- /dev/null +++ b/src/mame/drivers/jupiter.c @@ -0,0 +1,365 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Robbbert +/************************************************************************** + +Wave Mate Jupiter + + + +Jupiter 3 +********* + +Status: Preliminary +Hangs if your input line starts with 'k'. + +ToDo: +- Connect all devices +- Everything! + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "machine/keyboard.h" +#include "machine/terminal.h" +#include "machine/wd_fdc.h" +#include "includes/jupiter.h" + +#define TERMINAL_TAG "terminal" +#define KEYBOARD_TAG "keyboard" + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( jupiter_m6800_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( jupiter_m6800_mem, AS_PROGRAM, 8, jupiter2_state ) + AM_RANGE(0x0000, 0x7fff) AM_RAM +// AM_RANGE(0xc000, 0xcfff) Video RAM + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(MCM6571AP_TAG, 0) +// AM_RANGE(0xff58, 0xff5c) Cartridge Disk Controller PIA +// AM_RANGE(0xff60, 0xff76) DMA Controller +// AM_RANGE(0xff80, 0xff83) Floppy PIA + AM_RANGE(0xff84, 0xff87) AM_DEVREADWRITE(INS1771N1_TAG, wd_fdc_t, read, write) +// AM_RANGE(0xff90, 0xff93) Hytype Parallel Printer PIA +// AM_RANGE(0xffa0, 0xffa7) Persci Floppy Disk Controller +// AM_RANGE(0xffb0, 0xffb3) Video PIA +// AM_RANGE(0xffc0, 0xffc1) Serial Port 0 ACIA +// AM_RANGE(0xffc4, 0xffc5) Serial Port 1 ACIA +// AM_RANGE(0xffc8, 0xffc9) Serial Port 2 ACIA +// AM_RANGE(0xffcc, 0xffcd) Serial Port 3 ACIA +// AM_RANGE(0xffd0, 0xffd1) Serial Port 4 ACIA / Cassette +// AM_RANGE(0xffd4, 0xffd5) Serial Port 5 ACIA / EPROM Programmer (2704/2708) +// AM_RANGE(0xffd8, 0xffd9) Serial Port 6 ACIA / Hardware Breakpoint Registers +// AM_RANGE(0xffdc, 0xffdd) Serial Port 7 ACIA +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( jupiter_m6800_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( jupiter_m6800_io, AS_IO, 8, jupiter2_state ) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( jupiter3_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( jupiter3_mem, AS_PROGRAM, 8, jupiter3_state ) + AM_RANGE(0x0000, 0xbfff) AM_RAM AM_SHARE("p_ram") + AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("p_videoram") + AM_RANGE(0xe000, 0xefff) AM_ROM AM_REGION(Z80_TAG, 0) + AM_RANGE(0xf000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( jupiter3_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( jupiter3_io, AS_IO, 8, jupiter3_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xa1, 0xa4) AM_READ(ff_r) + AM_RANGE(0xb0, 0xb0) AM_READ(status_r) + AM_RANGE(0xb2, 0xb2) AM_READ(key_r) +ADDRESS_MAP_END + +READ8_MEMBER( jupiter3_state::ff_r ) +{ + return 0xfd; +} + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( jupiter ) +//------------------------------------------------- + +static INPUT_PORTS_START( jupiter ) +INPUT_PORTS_END + +READ8_MEMBER( jupiter3_state::key_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( jupiter3_state::status_r ) +{ + return (m_term_data) ? 0x80 : 0x00; +} + +WRITE8_MEMBER( jupiter3_state::kbd_put ) +{ + if (data) + m_term_data = data ^ 0x80; +} + + +//************************************************************************** +// VIDEO +//************************************************************************** + +void jupiter3_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 jupiter3_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 32; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x++) + { + gfx = 0; + if (ra < 9) + { + chr = m_p_videoram[x]; + gfx = m_p_chargen[(chr<<4) | ra ]; + } + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} + + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +static SLOT_INTERFACE_START( jupiter_floppies ) + SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) +SLOT_INTERFACE_END + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( jupiter ) +//------------------------------------------------- + +void jupiter2_state::machine_start() +{ +} + + +//------------------------------------------------- +// MACHINE_START( jupiter3 ) +//------------------------------------------------- + +void jupiter3_state::machine_reset() +{ + UINT8* ROM = memregion(Z80_TAG)->base(); + memcpy(m_p_ram, ROM, 0x1000); + m_maincpu->set_pc(0xe000); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( jupiter ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( jupiter, jupiter2_state ) + // basic machine hardware + MCFG_CPU_ADD(MCM6571AP_TAG, M6800, 2000000) + MCFG_CPU_PROGRAM_MAP(jupiter_m6800_mem) + MCFG_CPU_IO_MAP(jupiter_m6800_io) + + // devices + MCFG_DEVICE_ADD(INS1771N1_TAG, FD1771, 1000000) + MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":0", jupiter_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":1", jupiter_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( jupiter3 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( jupiter3, jupiter3_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(jupiter3_mem) + MCFG_CPU_IO_MAP(jupiter3_io) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(jupiter3_state, screen_update) + MCFG_SCREEN_SIZE(512, 320) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 320-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + // devices + MCFG_DEVICE_ADD(INS1771N1_TAG, FD1771, 1000000) + MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":0", jupiter_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":1", jupiter_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(jupiter3_state, kbd_put)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( jupiter2 ) +//------------------------------------------------- + +ROM_START( jupiter2 ) + ROM_REGION( 0x1000, MCM6571AP_TAG, ROMREGION_INVERT ) // address and data lines are inverted + ROM_LOAD( "idb v1.1 for 60k jii f000.1c", 0x0000, 0x0400, CRC(50893aae) SHA1(da0222c4cb6188f6cfc657fc33558d0a6a41cd1a) ) + ROM_LOAD( "idb v1.1 for 60k jii f400.6c", 0x0400, 0x0400, CRC(a435344a) SHA1(bc4f4143301b10ec762ecc0cb69e5a9d4c4bef7b) ) + ROM_LOAD( "idb v1.1 for 60k jii f800.1d", 0x0800, 0x0400, CRC(ab82df45) SHA1(be7ea5347ff0582401e26c2fa10e13463cbe57c6) ) + ROM_LOAD( "boot_v2.6_sn5d00000000000003_fc00.6d", 0x0c00, 0x0400, CRC(8f33e4ed) SHA1(fb206e5019c166583ff516de3608ae86d2636d2a) ) + ROM_LOAD( "jupiter ii boot rom v2.6 12_18_82 s_n 5d000...0015.6d", 0x0c00, 0x0400, CRC(f87cefdf) SHA1(229ea961e6036ec39e0ae33abc7f554bf9d8361b) ) +ROM_END + + +//------------------------------------------------- +// ROM( jupiter3 ) +//------------------------------------------------- + +ROM_START( jupiter3 ) + ROM_REGION( 0x1000, Z80_TAG, ROMREGION_INVERT ) // address and data lines are inverted + ROM_LOAD( "jove 2.0 78_034 4v2d000 1.1c", 0x0000, 0x0400, CRC(be92a76c) SHA1(9c7d9b37c2bbf0c2e9465421e3e1bcf3dd9e66a6) ) + ROM_LOAD( "jove 2.0 78_034 4v2d000 2.6c", 0x0400, 0x0400, CRC(ee98dd32) SHA1(0513261c7c0d911225ea957ee67394871a36ada4) ) + ROM_LOAD( "jove 2.0 78_034 4v2d000 3.1d", 0x0800, 0x0400, CRC(51476b1d) SHA1(ab6f4eb244bcf9718aafdae67da086ec81f33fa6) ) + ROM_LOAD( "jove 2.0 78_034 4v2d000 4.6d", 0x0c00, 0x0400, CRC(16a9595d) SHA1(06150278650590497732e1f3f42356de56737921) ) + + // character generator is missing, using one from c10 for now + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + + + +//************************************************************************** +// DRIVER INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// DRIVER_INIT( jupiter ) +//------------------------------------------------- + +DRIVER_INIT_MEMBER(jupiter2_state,jupiter) +{ + UINT8 *rom = memregion(MCM6571AP_TAG)->base(); + UINT8 inverted[0x1000]; + + memcpy(inverted, rom, 0x1000); + + for (offs_t addr = 0; addr < 0x400; addr++) + { + // invert address lines + rom[0x3ff - addr] = inverted[addr]; + rom[0x7ff - addr] = inverted[addr + 0x400]; + rom[0xbff - addr] = inverted[addr + 0x800]; + rom[0xfff - addr] = inverted[addr + 0xc00]; + } +} + + +//------------------------------------------------- +// DRIVER_INIT( jupiter3 ) +//------------------------------------------------- + +DRIVER_INIT_MEMBER(jupiter3_state,jupiter3) +{ + UINT8 *rom = memregion(Z80_TAG)->base(); + UINT8 inverted[0x1000]; + + memcpy(inverted, rom, 0x1000); + + for (offs_t addr = 0; addr < 0x400; addr++) + { + // invert address lines + rom[0x3ff - addr] = inverted[addr]; + rom[0x7ff - addr] = inverted[addr + 0x400]; + rom[0xbff - addr] = inverted[addr + 0x800]; + rom[0xfff - addr] = inverted[addr + 0xc00]; + } +} + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1976, jupiter2, 0, 0, jupiter, jupiter, jupiter2_state, jupiter, "Wave Mate", "Jupiter II", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP( 1976, jupiter3, 0, 0, jupiter3, jupiter, jupiter3_state, jupiter3,"Wave Mate", "Jupiter III", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/k1003.c b/src/mame/drivers/k1003.c new file mode 100644 index 00000000000..3fa0b6d1cd3 --- /dev/null +++ b/src/mame/drivers/k1003.c @@ -0,0 +1,197 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Robotron K1003 + + 20/11/2009 Skeleton driver. + + +'maincpu' (004B): unmapped i/o memory write to 0B = 00 & FF +'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF +'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF +'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF +'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF +'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF +'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF +'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF +'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF +'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF +'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF +'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF +'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF +'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF +'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF +'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF +'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF +'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF +'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF +'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF +'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF +'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF +'maincpu' (02F2): unmapped i/o memory write to 0A = 00 & FF +'maincpu' (02F2): unmapped i/o memory write to 0A = 00 & FF +'maincpu' (02F2): unmapped i/o memory write to 0A = 0C & FF +'maincpu' (02F2): unmapped i/o memory write to 0A = 0C & FF +'maincpu' (02F2): unmapped i/o memory write to 0A = 0C & FF + +The writes to ports 0A, 11 & 13 are continuous. + +- Need a keyboard + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8008/i8008.h" +#include "k1003.lh" + + +class k1003_state : public driver_device +{ +public: + k1003_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_READ8_MEMBER(port2_r); + DECLARE_READ8_MEMBER(key_r); + DECLARE_WRITE8_MEMBER(disp_1_w); + DECLARE_WRITE8_MEMBER(disp_2_w); + DECLARE_WRITE8_MEMBER(disp_w); + UINT8 m_disp_1; + UINT8 m_disp_2; + UINT8 bit_to_dec(UINT8 val); + virtual void machine_reset(); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START( k1003_mem, AS_PROGRAM, 8, k1003_state ) + AM_RANGE(0x0000,0x07ff) AM_ROM + AM_RANGE(0x0800,0x17ff) AM_RAM + AM_RANGE(0x1800,0x1fff) AM_ROM + AM_RANGE(0x2000,0x27ff) AM_ROM + AM_RANGE(0x2800,0x2fff) AM_RAM + AM_RANGE(0x3000,0x3aff) AM_ROM +ADDRESS_MAP_END + +READ8_MEMBER( k1003_state::port2_r ) +{ + return 0x00; +} + +READ8_MEMBER( k1003_state::key_r ) +{ + return 0x00; +} + + +WRITE8_MEMBER( k1003_state::disp_1_w ) +{ + m_disp_1 = data; +} + +WRITE8_MEMBER( k1003_state::disp_2_w ) +{ + m_disp_2 = data; +} + +UINT8 k1003_state::bit_to_dec(UINT8 val) +{ + if (BIT(val,0)) return 0; + if (BIT(val,1)) return 1; + if (BIT(val,2)) return 2; + if (BIT(val,3)) return 3; + if (BIT(val,4)) return 4; + if (BIT(val,5)) return 5; + if (BIT(val,6)) return 6; + if (BIT(val,7)) return 7; + return 0; +} + +WRITE8_MEMBER( k1003_state::disp_w ) +{ + output_set_digit_value(bit_to_dec(data)*2, m_disp_1); + output_set_digit_value(bit_to_dec(data)*2+1, m_disp_2); +} + +static ADDRESS_MAP_START( k1003_io, AS_IO, 8, k1003_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00,0x00) AM_READ(key_r) + AM_RANGE(0x02,0x02) AM_READ(port2_r) + + AM_RANGE(0x08,0x08) AM_WRITE(disp_w) + AM_RANGE(0x09,0x09) AM_WRITE(disp_2_w) + AM_RANGE(0x10,0x10) AM_WRITE(disp_1_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( k1003 ) +INPUT_PORTS_END + + +void k1003_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( k1003, k1003_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8008, 800000) + MCFG_CPU_PROGRAM_MAP(k1003_mem) + MCFG_CPU_IO_MAP(k1003_io) + + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_k1003) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( k1003 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "k1003.01", 0x0000, 0x0100, CRC(9342f67d) SHA1(75d33cad89cf47e8e691a6ddbb86a8c11f454434)) + ROM_LOAD( "k1003.02", 0x0100, 0x0100, CRC(a6846b2b) SHA1(a38b15ae0ac3f216e49aef4618363ea0d262fe52)) + ROM_LOAD( "k1003.03", 0x0200, 0x0100, CRC(3fddd922) SHA1(9c9f28ad8a611d8a0911d2935ffa262976a0272d)) + ROM_LOAD( "k1003.04", 0x0300, 0x0100, CRC(ec3edbe9) SHA1(d58064db7f2d085760088da1899f44f7a5b02923)) + ROM_LOAD( "k1003.05", 0x0400, 0x0100, CRC(93836b34) SHA1(7397c9748c1adb347270529464f1e10d3ac92879)) + ROM_LOAD( "k1003.06", 0x0500, 0x0100, CRC(79e39c8f) SHA1(bffc24a47867834d749d32307dca1053231a1b62)) + ROM_LOAD( "k1003.07", 0x0600, 0x0100, CRC(1f7279e0) SHA1(1e625adf606f87a55b6e8827fc9764d8a777903a)) + ROM_LOAD( "k1003.08", 0x0700, 0x0100, CRC(4b950957) SHA1(268c7dbf52a85bdf4eb5ebbe6d01aae45e853a72)) + + ROM_LOAD( "k1003.09", 0x1800, 0x0100, CRC(f3ec866f) SHA1(0b274be7290c9d469205136851c48595cd4f15e2)) + ROM_LOAD( "k1003.10", 0x1900, 0x0100, CRC(c4af2cf7) SHA1(1815030d08072542fa56c4063b6de1d64b146887)) + ROM_LOAD( "k1003.11", 0x1a00, 0x0100, CRC(473ef6db) SHA1(45372e09babf6fa08875e53d43e90d53f9cc0ec1)) + ROM_LOAD( "k1003.12", 0x1b00, 0x0100, CRC(8af505d4) SHA1(21302f2bb660ddaf5e4526335ec457479f1673d5)) + ROM_LOAD( "k1003.13", 0x1c00, 0x0100, CRC(753166da) SHA1(90b91bac845f5d0ecd3af4d67174d351e478b632)) + ROM_LOAD( "k1003.14", 0x1d00, 0x0100, CRC(a885a676) SHA1(e899ea5b97734360421d2696e0a75d65fa8a031c)) + ROM_LOAD( "k1003.15", 0x1e00, 0x0100, CRC(db63b0cd) SHA1(726d80bb34862301df773b8587acccbeedfcc38d)) + ROM_LOAD( "k1003.16", 0x1f00, 0x0100, CRC(9457f1bd) SHA1(aae0a7c0a63d8213a57850383aaf92927577be7a)) + + // Math pack + ROM_LOAD( "026.bin", 0x2000, 0x0100, CRC(d678e80c) SHA1(bdf696e9704c286ed0ad5ffbdae206580a277c38)) + ROM_LOAD( "027.bin", 0x2100, 0x0100, CRC(dbe2ca8e) SHA1(2060bbb6b6dee87c98ddcf84a49069547749ae9b)) + ROM_LOAD( "028.bin", 0x2200, 0x0100, CRC(2cd742ed) SHA1(ec3f1ba548c64b0fe538af365a383f2341c81988)) + ROM_LOAD( "029.bin", 0x2300, 0x0100, CRC(12165b43) SHA1(7bb2c97893a07196cf245c8ac3a64c0ee49bb75e)) + ROM_LOAD( "030.bin", 0x2400, 0x0100, CRC(545dd7e0) SHA1(ab9f2e8cd4d3d4ba8accf74caec20de2e3094a66)) + ROM_LOAD( "031.bin", 0x2500, 0x0100, CRC(315d27d2) SHA1(26bb39d50781eed8d8be4ad6e1f13bc2b4672ce2)) + ROM_LOAD( "032.bin", 0x2600, 0x0100, CRC(d03f7cc7) SHA1(5a1c0614eed6dfe21d0d1776f409c1c2209a74d1)) + ROM_LOAD( "033.bin", 0x2700, 0x0100, CRC(efaeb541) SHA1(decdbbd3c4084dc18b34577f78ddf7044341764a)) + + ROM_LOAD( "k1003.17", 0x3000, 0x0100, CRC(9031390b) SHA1(6f99a9f643b19770a373242edb0df8f342bbc230)) + ROM_LOAD( "k1003.18", 0x3100, 0x0100, CRC(38435ffe) SHA1(7db78d304fe8a8f71c067babcdcf3c06da908ad3)) + ROM_LOAD( "k1003.19", 0x3200, 0x0100, CRC(3cfddbda) SHA1(7e9d5c6126d0f08fcb7d88d0cc26eb24467f7321)) + ROM_LOAD( "k1003.20", 0x3300, 0x0100, CRC(08707172) SHA1(fef18e407ebec13d34c2bd6925ffae533139551e)) + ROM_LOAD( "k1003.21", 0x3400, 0x0100, CRC(4038b284) SHA1(f6ee7fd8fb06a73a7d1ed71ca7022f1c76c207bd)) + ROM_LOAD( "k1003.22", 0x3500, 0x0100, CRC(04691d40) SHA1(72f96994811f435adecc74585f3dfaa89d0f192a)) + ROM_LOAD( "k1003.23", 0x3600, 0x0100, CRC(a2f7170c) SHA1(2cd9a64019c2cd7f6f6146d1886de6a1aa5ccc88)) + ROM_LOAD( "k1003.24", 0x3700, 0x0100, CRC(c0935c12) SHA1(f3fc7c3fa97b2bcb9ec522002ee760a226eb329a)) + ROM_LOAD( "k1003.25", 0x3800, 0x0100, CRC(a827aec0) SHA1(a8f582a9a6b31581d8a174a0bc2f4588d6b53400)) + ROM_LOAD( "k1003.26", 0x3900, 0x0100, CRC(fc949804) SHA1(088b63b7f8704efb6867be899b81d64a294af6be)) + ROM_LOAD( "k1003.27", 0x3a00, 0x0100, CRC(ddcdd065) SHA1(e29c6f2dd1e4da125d150e28cf51f8c558ec9ee5)) + // 0x3b00 - missing on board - returning 0xff +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, k1003, 0, 0, k1003, k1003, driver_device, 0, "Robotron", "K1003", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/k8915.c b/src/mame/drivers/k8915.c new file mode 100644 index 00000000000..7ec4cde5d0e --- /dev/null +++ b/src/mame/drivers/k8915.c @@ -0,0 +1,187 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Robotron K8915 + + 30/08/2010 Skeleton driver + + When it says DIAGNOSTIC RAZ P, press enter. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/keyboard.h" + +#define KEYBOARD_TAG "keyboard" + +class k8915_state : public driver_device +{ +public: + k8915_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_p_videoram(*this, "p_videoram") + { + } + + required_device m_maincpu; + DECLARE_READ8_MEMBER( k8915_52_r ); + DECLARE_READ8_MEMBER( k8915_53_r ); + DECLARE_WRITE8_MEMBER( k8915_a8_w ); + DECLARE_WRITE8_MEMBER( kbd_put ); + required_shared_ptr m_p_videoram; + UINT8 *m_p_chargen; + UINT8 m_framecnt; + UINT8 m_term_data; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_DRIVER_INIT(k8915); +}; + +READ8_MEMBER( k8915_state::k8915_52_r ) +{ +// get data from ascii keyboard + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( k8915_state::k8915_53_r ) +{ +// keyboard status + return m_term_data ? 1 : 0; +} + +WRITE8_MEMBER( k8915_state::k8915_a8_w ) +{ +// seems to switch ram and rom around. + if (data == 0x87) + membank("boot")->set_entry(0); // ram at 0000 + else + membank("boot")->set_entry(1); // rom at 0000 +} + +static ADDRESS_MAP_START(k8915_mem, AS_PROGRAM, 8, k8915_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot") + AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE("p_videoram") + AM_RANGE(0x1800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(k8915_io, AS_IO, 8, k8915_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x52, 0x52) AM_READ(k8915_52_r) + AM_RANGE(0x53, 0x53) AM_READ(k8915_53_r) + AM_RANGE(0xa8, 0xa8) AM_WRITE(k8915_a8_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( k8915 ) +INPUT_PORTS_END + +void k8915_state::machine_reset() +{ + membank("boot")->set_entry(1); +} + +DRIVER_INIT_MEMBER(k8915_state,k8915) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x10000); +} + +void k8915_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 k8915_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + m_framecnt++; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 80; x++) + { + gfx = 0; + + if (ra < 9) + { + chr = m_p_videoram[x]; + + /* Take care of flashing characters */ + if ((chr & 0x80) && (m_framecnt & 0x08)) + chr = 0x20; + + chr &= 0x7f; + + gfx = m_p_chargen[(chr<<4) | ra ]; + } + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=80; + } + return 0; +} + +WRITE8_MEMBER( k8915_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( k8915, k8915_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(k8915_mem) + MCFG_CPU_IO_MAP(k8915_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(k8915_state, screen_update) + MCFG_SCREEN_SIZE(640, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(k8915_state, kbd_put)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( k8915 ) + ROM_REGION( 0x11000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "k8915.bin", 0x10000, 0x1000, CRC(ca70385f) SHA1(a34c14adae9be821678aed7f9e33932ee1f3e61c)) + + /* character generator not dumped, using the one from 'c10' for now */ + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, k8915, 0, 0, k8915, k8915, k8915_state, k8915, "Robotron", "K8915", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/kaypro.c b/src/mame/drivers/kaypro.c new file mode 100644 index 00000000000..7213db9ebe6 --- /dev/null +++ b/src/mame/drivers/kaypro.c @@ -0,0 +1,461 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/************************************************************************************************* + + + Kaypro 2/83 computer - the very first Kaypro II - 2 full size floppy drives. + Each disk was single sided, and could hold 191k. The computer had 2x pio + and 1x sio. One of the sio ports communicated with the keyboard with a coiled + telephone cord, complete with modular plug on each end. The keyboard carries + its own Intel 87C51 processor and is an intelligent device. + + Kaypro 10 notes: + - This machine comes with a 10MB hard drive, split into 2 5MB partitions. It also + has one floppy drive. The drive letters change depending on what drive it was booted + from. The boot drive is always A:. + If booted from floppy: + A: floppy + B: HD partition 1 + C: HD partition 2 + If booted from HD (presumably partition 1) + A: HD partition 1 + B: HD partition 2 + C: floppy + + ToDo: + + - See about getting keyboard to work as a serial device. + - Need dump of 87C51 cpu in the keyboard. + + - Kaypro 2x, 4a: floppy not working "No operating system present on this disk" + - Kaypro 10: Boots from floppy, but needs hard drive added. + - Kaypro 4p88: works as a normal Kaypro 4, extra hardware not done + - Kaypro Robie: has twin 2.6MB 5.25 floppy drives which we don't support, no software available + + - Hard Disk not emulated. + The controller is a WD1002 (original version, for Winchester drives). + + - RTC type MM58167A to be added. Modem chips TMS99531, TMS99532 to be developed. + + - Once everything works, sort out parent and compat relationships. + +**************************************************************************************************/ + +#include "includes/kaypro.h" +#include "formats/kaypro_dsk.h" + + +READ8_MEMBER( kaypro_state::kaypro2x_87_r ) { return 0x7f; } /* to bypass unemulated HD controller */ + +/*********************************************************** + + Address Maps + +************************************************************/ + +static ADDRESS_MAP_START( kaypro_map, AS_PROGRAM, 8, kaypro_state ) + AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank3") + AM_RANGE(0x4000, 0xffff) AM_RAM AM_REGION("rambank", 0x4000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( kayproii_io, AS_IO, 8, kaypro_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_DEVWRITE("brg", com8116_device, stt_w) + AM_RANGE(0x04, 0x07) AM_READWRITE(kaypro_sio_r, kaypro_sio_w) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_g", z80pio_device, read_alt, write_alt) + AM_RANGE(0x0c, 0x0f) AM_DEVWRITE("brg", com8116_device, str_w) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", fd1793_t, read, write) + AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_s", z80pio_device, read_alt, write_alt) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( kaypro2x_io, AS_IO, 8, kaypro_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_DEVWRITE("brg", com8116_device, str_w) + AM_RANGE(0x04, 0x07) AM_READWRITE(kaypro_sio_r, kaypro_sio_w) + AM_RANGE(0x08, 0x0b) AM_DEVWRITE("brg", com8116_device, stt_w) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80sio_2x", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", fd1793_t, read, write) + AM_RANGE(0x14, 0x17) AM_READWRITE(kaypro2x_system_port_r,kaypro2x_system_port_w) + AM_RANGE(0x18, 0x1b) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x1c, 0x1c) AM_READWRITE(kaypro2x_status_r,kaypro2x_index_w) + AM_RANGE(0x1d, 0x1d) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(kaypro2x_register_w) + AM_RANGE(0x1f, 0x1f) AM_READWRITE(kaypro2x_videoram_r,kaypro2x_videoram_w) + + /* The below are not emulated */ +/* AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80pio", kaypro2x_pio_r, kaypro2x_pio_w) - for RTC and Modem + AM_RANGE(0x24, 0x27) communicate with MM58167A RTC. Modem uses TMS99531 and TMS99532 chips. + AM_RANGE(0x80, 0x80) Hard drive controller card I/O port - 10MB hard drive only fitted to the Kaypro 10 + AM_RANGE(0x81, 0x81) Hard Drive READ error register, WRITE precomp + AM_RANGE(0x82, 0x82) Hard Drive Sector register count I/O + AM_RANGE(0x83, 0x83) Hard Drive Sector register number I/O + AM_RANGE(0x84, 0x84) Hard Drive Cylinder low register I/O + AM_RANGE(0x85, 0x85) Hard Drive Cylinder high register I/O + AM_RANGE(0x86, 0x86) Hard Drive Size / Drive / Head register I/O + AM_RANGE(0x87, 0x87) Hard Drive READ status register, WRITE command register */ + AM_RANGE(0x20, 0x86) AM_NOP + AM_RANGE(0x87, 0x87) AM_READ(kaypro2x_87_r) +ADDRESS_MAP_END + + +/*************************************************************** + + F4 CHARACTER DISPLAYER + +****************************************************************/ +static const gfx_layout kayproii_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout kaypro2x_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( kayproii ) + GFXDECODE_ENTRY( "chargen", 0x0000, kayproii_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( kaypro2x ) + GFXDECODE_ENTRY( "chargen", 0x0000, kaypro2x_charlayout, 0, 1 ) +GFXDECODE_END + +/*************************************************************** + + Interfaces + +****************************************************************/ + +static const z80_daisy_config kayproii_daisy_chain[] = +{ + { "z80sio" }, /* sio */ + { "z80pio_s" }, /* System pio */ + { "z80pio_g" }, /* General purpose pio */ + { NULL } +}; + +static const z80_daisy_config kaypro2x_daisy_chain[] = +{ + { "z80sio" }, /* sio for RS232C and keyboard */ + { "z80sio_2x" }, /* sio for serial printer and inbuilt modem */ + { NULL } +}; + + + +//static WRITE_LINE_DEVICE_HANDLER( rx_tx_w ) +//{ +// downcast(device)->rx_clock_in(); +// downcast(device)->tx_clock_in(); +//} + + + +/*********************************************************** + + Machine Driver + +************************************************************/ + +FLOPPY_FORMATS_MEMBER( kaypro_state::kayproii_floppy_formats ) + FLOPPY_KAYPROII_FORMAT +FLOPPY_FORMATS_END + +FLOPPY_FORMATS_MEMBER( kaypro_state::kaypro2x_floppy_formats ) + FLOPPY_KAYPRO2X_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( kaypro_floppies ) + SLOT_INTERFACE( "drive0", FLOPPY_525_DD ) + SLOT_INTERFACE( "drive1", FLOPPY_525_DD ) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( kayproii, kaypro_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_20MHz / 8) + MCFG_CPU_PROGRAM_MAP(kaypro_map) + MCFG_CPU_IO_MAP(kayproii_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt) /* this doesn't actually exist, it is to run the keyboard */ + MCFG_CPU_CONFIG(kayproii_daisy_chain) + + MCFG_MACHINE_START_OVERRIDE(kaypro_state, kayproii ) + MCFG_MACHINE_RESET_OVERRIDE(kaypro_state, kaypro ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(80*7, 24*10) + MCFG_SCREEN_VISIBLE_AREA(0,80*7-1,0,24*10-1) + MCFG_VIDEO_START_OVERRIDE(kaypro_state, kaypro ) + MCFG_SCREEN_UPDATE_DRIVER(kaypro_state, screen_update_kayproii) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", kayproii) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_QUICKLOAD_ADD("quickload", kaypro_state, kaypro, "com,cpm", 3) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kaypro_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) // WD1943, SMC8116 + + MCFG_DEVICE_ADD("z80pio_g", Z80PIO, XTAL_20MHz / 8) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + + MCFG_DEVICE_ADD("z80pio_s", Z80PIO, XTAL_20MHz / 8) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(kaypro_state, pio_system_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(kaypro_state, kayproii_pio_system_w)) + + MCFG_Z80SIO0_ADD("z80sio", XTAL_20MHz / 8, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_FD1793_ADD("fdc", XTAL_20MHz / 20) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w)) + MCFG_WD_FDC_FORCE_READY + MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "drive0", kaypro_state::kayproii_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "drive1", kaypro_state::kayproii_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_SOFTWARE_LIST_ADD("flop_list","kayproii") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( kaypro4, kayproii ) + MCFG_DEVICE_REMOVE("z80pio_s") + MCFG_DEVICE_ADD("z80pio_s", Z80PIO, 2500000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(kaypro_state, pio_system_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(kaypro_state, kaypro4_pio_system_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( kaypro2x, kaypro_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(kaypro_map) + MCFG_CPU_IO_MAP(kaypro2x_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt) + MCFG_CPU_CONFIG(kaypro2x_daisy_chain) + + MCFG_MACHINE_RESET_OVERRIDE(kaypro_state, kaypro ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(80*8, 25*16) + MCFG_SCREEN_VISIBLE_AREA(0,80*8-1,0,25*16-1) + MCFG_VIDEO_START_OVERRIDE(kaypro_state, kaypro ) + MCFG_SCREEN_UPDATE_DRIVER(kaypro_state, screen_update_kaypro2x) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", kaypro2x) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(kaypro_state, kaypro) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", 2000000) /* comes out of ULA - needs to be measured */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(7) + MCFG_MC6845_UPDATE_ROW_CB(kaypro_state, kaypro2x_update_row) + + MCFG_QUICKLOAD_ADD("quickload", kaypro_state, kaypro, "com,cpm", 3) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kaypro_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_Z80SIO0_ADD("z80sio", XTAL_16MHz / 4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80SIO0_ADD("z80sio_2x", XTAL_16MHz / 4, 0, 0, 0, 0) /* extra sio for modem and printer */ + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) // WD1943, SMC8116 + MCFG_FD1793_ADD("fdc", XTAL_16MHz / 16) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w)) + MCFG_WD_FDC_FORCE_READY + MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "drive0", kaypro_state::kaypro2x_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "drive1", kaypro_state::kaypro2x_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( kaypro10, kaypro2x ) + MCFG_DEVICE_REMOVE("fdc:1") // only has 1 floppy drive + // need to add hard drive & controller +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( omni2, kaypro4 ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(kaypro_state, screen_update_omni2) +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER( kaypro_state, kaypro ) +{ + UINT8 *main = memregion("roms")->base(); + UINT8 *ram = memregion("rambank")->base(); + + membank("bankr0")->configure_entry(1, &main[0x0000]); + membank("bankr0")->configure_entry(0, &ram[0x0000]); + membank("bank3")->configure_entry(1, &main[0x3000]); + membank("bank3")->configure_entry(0, &ram[0x3000]); + membank("bankw0")->configure_entry(0, &ram[0x0000]); +} + + +/*********************************************************** + + Game driver + +************************************************************/ + +/* The detested bios "universal rom" is part number 81-478 */ + +ROM_START(kayproii) + /* The board could take a 2716 or 2732 */ + ROM_REGION(0x4000, "roms",0) + ROM_SYSTEM_BIOS( 0, "149", "149") + ROMX_LOAD("81-149.u47", 0x0000, 0x0800, CRC(28264bc1) SHA1(a12afb11a538fc0217e569bc29633d5270dfa51b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "149b", "149B") + ROMX_LOAD("81-149b.u47", 0x0000, 0x0800, CRC(c008549e) SHA1(b9346a16f5f9ffb6bb0eb1766c348b74056485a8), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "149c", "149C") + ROMX_LOAD("81-149c.u47", 0x0000, 0x0800, CRC(1272aa65) SHA1(027fee2f5f17ba71a4738f00188e132e326536ff), ROM_BIOS(3) ) + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) + + ROM_REGION(0x0800, "chargen", ROMREGION_INVERT) + ROM_LOAD("81-146.u43", 0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) ) +ROM_END + +ROM_START(kaypro4) + ROM_REGION(0x4000, "roms",0) + ROM_LOAD("81-232.u47", 0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2) ) + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) + + ROM_REGION(0x0800, "chargen", ROMREGION_INVERT) + ROM_LOAD("81-146.u43", 0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) ) +ROM_END + +ROM_START(kaypro4p88) // "KAYPRO-88" board has 128k or 256k of its own ram on it + ROM_REGION(0x4000, "roms",0) + ROM_LOAD("81-232.u47", 0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2) ) + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) + + ROM_REGION(0x0800, "chargen", ROMREGION_INVERT) + ROM_LOAD("81-146.u43", 0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) ) + + ROM_REGION(0x1000, "8088cpu",0) + ROM_LOAD("81-356.u29", 0x0000, 0x1000, CRC(948556db) SHA1(6e779866d099cc0dc8c6369bdfb37a923ac448a4) ) +ROM_END + +ROM_START(omni2) + ROM_REGION(0x4000, "roms",0) + ROM_LOAD("omni2.u47", 0x0000, 0x1000, CRC(2883f9e0) SHA1(d98c784e62853582d298bf7ca84c75872847ac9b) ) + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) + + ROM_REGION(0x0800, "chargen", ROMREGION_INVERT) + ROM_LOAD("omni2.u43", 0x0000, 0x0800, CRC(049b3381) SHA1(46f1d4f038747ba9048b075dc617361be088f82a) ) +ROM_END + +ROM_START(kaypro2x) + ROM_REGION(0x4000, "roms",0) + ROM_SYSTEM_BIOS( 0, "292", "292") + ROMX_LOAD("81-292.u34", 0x0000, 0x2000, CRC(5eb69aec) SHA1(525f955ca002976e2e30ac7ee37e4a54f279fe96), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "292a", "292A") + ROMX_LOAD("81-292a.u34", 0x0000, 0x1000, CRC(241f27a5) SHA1(82711289d19e9b165e35324da010466d225e503a), ROM_BIOS(2) ) + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD("81-235.u9", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) +ROM_END + +ROM_START(kaypro4a) // same as kaypro2x ?? + ROM_REGION(0x4000, "roms",0) + ROM_LOAD("81-292.u34", 0x0000, 0x2000, CRC(5eb69aec) SHA1(525f955ca002976e2e30ac7ee37e4a54f279fe96) ) + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD("81-235.u9", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) +ROM_END + +ROM_START(kaypro10) + ROM_REGION(0x4000, "roms",0) + ROM_SYSTEM_BIOS( 0, "302", "V1.9E") + ROMX_LOAD("81-302.u42", 0x0000, 0x1000, CRC(3f9bee20) SHA1(b29114a199e70afe46511119b77a662e97b093a0), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "188", "V1.9") + ROMX_LOAD("81-188.u42", 0x0000, 0x1000, CRC(6cbd6aa0) SHA1(47004f8c6e17407e4f8d613c9520f9316716d9e2), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "277", "V1.9E(F)") + ROMX_LOAD("81-277.u42", 0x0000, 0x1000, CRC(e4e1831f) SHA1(1de31ed532a461ace7a4abad1f6647eeddceb3e7), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "478", "V2.01") + ROMX_LOAD("81-478.u42", 0x0000, 0x2000, CRC(de618380) SHA1(c8d6312e6eeb62a53e741f1ff3b878bdcb7b5aaa), ROM_BIOS(4) ) + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD("81-187.u31", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) +ROM_END + +ROM_START(robie) + ROM_REGION(0x4000, "roms",0) + ROM_SYSTEM_BIOS( 0, "326", "V1.7R") + ROMX_LOAD("81-326.u34", 0x0000, 0x2000, CRC(7f0c3f68) SHA1(54b088a1b2200f9df4b9b347bbefb0115f3a4976), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "u", "V1.4") + ROMX_LOAD("robie_u.u34", 0x0000, 0x2000, CRC(da7248b5) SHA1(1dc053b3e44ead47255cc166b7b4b0adaeb3dd3d), ROM_BIOS(2) ) // rom number unknown + + ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD("81-235.u9", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP( 1982, kayproii, 0, 0, kayproii, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro II - 2/83" , 0 ) +COMP( 1983, kaypro4, kayproii, 0, kaypro4, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 4 - 4/83" , 0 ) // model 81-004 +COMP( 1983, kaypro4p88, kayproii, 0, kaypro4, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 4 plus88 - 4/83" , MACHINE_NOT_WORKING ) // model 81-004 with an added 8088 daughterboard and rom +COMP( 198?, omni2, kayproii, 0, omni2, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Omni II Logic Analyzer" , 0 ) +COMP( 1984, kaypro2x, 0, 0, kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 2x" , MACHINE_NOT_WORKING ) // model 81-025 +COMP( 1984, kaypro4a, kaypro2x, 0, kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 4 - 4/84" , MACHINE_NOT_WORKING ) // model 81-015 +// Kaypro 4/84 plus 88 goes here, model 81-015 with an added 8088 daughterboard and rom +COMP( 1983, kaypro10, 0, 0, kaypro10, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 10" , MACHINE_NOT_WORKING ) // model 81-005 +COMP( 1984, robie, 0, 0, kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro Robie" , MACHINE_NOT_WORKING ) // model 81-005 diff --git a/src/mame/drivers/kc.c b/src/mame/drivers/kc.c new file mode 100644 index 00000000000..b6b21733d69 --- /dev/null +++ b/src/mame/drivers/kc.c @@ -0,0 +1,320 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/****************************************************************************** + + kc.c + system driver + + A big thankyou to Torsten Paul for his great help with this + driver! + + + Kevin Thacker [MESS driver] + + ******************************************************************************/ + + +/* Core includes */ +#include "emu.h" +#include "includes/kc.h" + + +static ADDRESS_MAP_START(kc85_4_io, AS_IO, 8, kc85_4_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0084, 0x0085) AM_MIRROR(0xff00) AM_READWRITE(kc85_4_84_r, kc85_4_84_w) + AM_RANGE(0x0086, 0x0087) AM_MIRROR(0xff00) AM_READWRITE(kc85_4_86_r, kc85_4_86_w) + AM_RANGE(0x0088, 0x008b) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) + AM_RANGE(0x008c, 0x008f) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + + AM_RANGE(0x0000, 0xffff) AM_READWRITE(expansion_io_read, expansion_io_write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(kc85_4_mem, AS_PROGRAM, 8, kc85_4_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_READWRITE_BANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank2") + AM_RANGE(0x8000, 0xa7ff) AM_READWRITE_BANK("bank3") + AM_RANGE(0xa800, 0xbfff) AM_READWRITE_BANK("bank6") + AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank4") + AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bank5") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(kc85_3_mem, AS_PROGRAM, 8, kc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_READWRITE_BANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank3") + AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank4") + AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bank5") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(kc85_3_io, AS_IO, 8, kc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0088, 0x008b) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) + AM_RANGE(0x008c, 0x008f) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + + AM_RANGE(0x0000, 0xffff) AM_READWRITE(expansion_io_read, expansion_io_write) +ADDRESS_MAP_END + +static INPUT_PORTS_START( kc85 ) +INPUT_PORTS_END + + +/* priority derived from schematics */ +static const z80_daisy_config kc85_daisy_chain[] = +{ + { "z80ctc" }, + { "z80pio" }, + { NULL } +}; + +extern SLOT_INTERFACE_START(kc85_cart) + SLOT_INTERFACE("standard", KC_STANDARD) // standard 8KB ROM module + SLOT_INTERFACE("m006", KC_M006) // BASIC + SLOT_INTERFACE("m011", KC_M011) // 64KB RAM + SLOT_INTERFACE("m022", KC_M022) // 16KB RAM + SLOT_INTERFACE("m032", KC_M032) // 256KB segmented RAM + SLOT_INTERFACE("m033", KC_M033) // TypeStar + SLOT_INTERFACE("m034", KC_M034) // 512KB segmented RAM + SLOT_INTERFACE("m035", KC_M035) // 1MB segmented RAM + SLOT_INTERFACE("m036", KC_M036) // 128KB segmented RAM +SLOT_INTERFACE_END + +extern SLOT_INTERFACE_START(kc85_exp) + SLOT_INTERFACE("d002", KC_D002) // D002 Bus Driver + SLOT_INTERFACE("d004", KC_D004) // D004 Floppy Disk Interface + SLOT_INTERFACE("d004gide", KC_D004_GIDE) // D004 Floppy Disk + GIDE Interface +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( kc85_3, kc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, KC85_3_CLOCK) + MCFG_CPU_PROGRAM_MAP(kc85_3_mem) + MCFG_CPU_IO_MAP(kc85_3_io) + MCFG_CPU_CONFIG(kc85_daisy_chain) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, KC85_3_CLOCK) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", 0)) + MCFG_Z80PIO_IN_PA_CB(READ8(kc_state, pio_porta_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(kc_state, pio_porta_w)) + MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(kc_state, pio_ardy_cb)) + MCFG_Z80PIO_IN_PB_CB(READ8(kc_state, pio_portb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(kc_state, pio_portb_w)) + MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(kc_state, pio_brdy_cb)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, KC85_3_CLOCK) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(kc_state, ctc_zc0_callback)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(kc_state, ctc_zc1_callback)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(kc_state, video_toggle_blink_state)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_28_37516MHz/2, 908, 0, 320, 312, 0, 256) + MCFG_SCREEN_UPDATE_DRIVER(kc_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kc_state, kc_scanline, "screen", 0, 1) + + MCFG_PALETTE_ADD("palette", KC85_PALETTE_SIZE) + MCFG_PALETTE_INIT_OWNER(kc_state, kc85 ) + + MCFG_DEVICE_ADD("keyboard", KC_KEYBOARD, XTAL_4MHz) + MCFG_KC_KEYBOARD_OUT_CALLBACK(WRITELINE(kc_state, keyboard_cb)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_QUICKLOAD_ADD("quickload", kc_state, kc, "kcc", 2) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(kc_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("kc_cass") + + /* cartridge slot */ + MCFG_DEVICE_ADD("m8", KCCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, "m011", false) + MCFG_KCCART_SLOT_NEXT_SLOT("mc") + MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) + MCFG_DEVICE_ADD("mc", KCCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, NULL, false) + MCFG_KCCART_SLOT_NEXT_SLOT("exp") + MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) + + /* expansion interface */ + MCFG_DEVICE_ADD("exp", KCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(kc85_exp, NULL, false) + MCFG_KCCART_SLOT_NEXT_SLOT(NULL) + MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "kc_cart") + MCFG_SOFTWARE_LIST_ADD("flop_list", "kc_flop") + MCFG_SOFTWARE_LIST_ADD("cass_list", "kc_cass") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( kc85_4, kc85_4_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, KC85_4_CLOCK) + MCFG_CPU_PROGRAM_MAP(kc85_4_mem) + MCFG_CPU_IO_MAP(kc85_4_io) + MCFG_CPU_CONFIG(kc85_daisy_chain) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, KC85_4_CLOCK) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", 0)) + MCFG_Z80PIO_IN_PA_CB(READ8(kc_state, pio_porta_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(kc_state, pio_porta_w)) + MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(kc_state, pio_ardy_cb)) + MCFG_Z80PIO_IN_PB_CB(READ8(kc_state, pio_portb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(kc_state, pio_portb_w)) + MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(kc_state, pio_brdy_cb)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, KC85_4_CLOCK) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(kc_state, ctc_zc0_callback)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(kc_state, ctc_zc1_callback)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(kc_state, video_toggle_blink_state)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_28_37516MHz/2, 908, 0, 320, 312, 0, 256) + MCFG_SCREEN_UPDATE_DRIVER(kc85_4_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kc85_4_state, kc_scanline, "screen", 0, 1) + + MCFG_PALETTE_ADD("palette", KC85_PALETTE_SIZE) + MCFG_PALETTE_INIT_OWNER(kc85_4_state, kc85 ) + + MCFG_DEVICE_ADD("keyboard", KC_KEYBOARD, XTAL_4MHz) + MCFG_KC_KEYBOARD_OUT_CALLBACK(WRITELINE(kc_state, keyboard_cb)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_QUICKLOAD_ADD("quickload", kc_state, kc, "kcc", 2) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(kc_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("kc_cass") + + /* cartridge slot */ + MCFG_DEVICE_ADD("m8", KCCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, "m011", false) + MCFG_KCCART_SLOT_NEXT_SLOT("mc") + MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) + MCFG_DEVICE_ADD("mc", KCCART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, NULL, false) + MCFG_KCCART_SLOT_NEXT_SLOT("exp") + MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) + + /* expansion interface */ + MCFG_DEVICE_ADD("exp", KCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(kc85_exp, NULL, false) + MCFG_KCCART_SLOT_NEXT_SLOT(NULL) + MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "kc_cart") + MCFG_SOFTWARE_LIST_ADD("flop_list", "kc_flop") + MCFG_SOFTWARE_LIST_ADD("cass_list", "kc_cass") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( kc85_5, kc85_4 ) + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") +MACHINE_CONFIG_END + + +ROM_START(kc85_2) + ROM_REGION(0x4000, "caos", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "hc900", "HC900 CAOS" ) + ROMX_LOAD( "hc900.852", 0x2000, 0x2000, CRC(e6f4c0ab) SHA1(242a777788c774c5f764313361b1e0a65139ab32), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "caos22", "CAOS 2.2" ) + ROMX_LOAD( "caos__e0.852", 0x2000, 0x2000, CRC(48d5624c) SHA1(568dd59bfad4c604ba36bc05b094fc598a642f85), ROM_BIOS(2)) +ROM_END + +ROM_START(kc85_3) + ROM_REGION(0x2000, "basic", 0) + ROM_LOAD( "basic_c0.853", 0x0000, 0x2000, CRC(dfe34b08) SHA1(c2e3af55c79e049e811607364f88c703b0285e2e)) + + ROM_REGION(0x4000, "caos", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "caos31", "CAOS 3.1" ) + ROMX_LOAD( "caos__e0.853", 0x2000, 0x2000, CRC(639e4864) SHA1(efd002fc9146116936e6e6be0366d2afca33c1ab), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "caos33", "CAOS 3.3" ) + ROMX_LOAD( "caos33.853", 0x2000, 0x2000, CRC(ca0fecad) SHA1(20447d27c9aa41a1c7a3d6ad0699edb06a207aa6), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "caos34", "CAOS 3.4" ) + ROMX_LOAD( "caos34.853", 0x2000, 0x2000, CRC(d0245a3e) SHA1(ee9f8e7427b9225ae2cecbcfb625d629ab6a601d), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "pi88ge", "OS PI/88 (yellow/blue)" ) + ROMX_LOAD( "pi88_ge.853", 0x2000, 0x2000, CRC(4bf0cfde) SHA1(b8373a44e4553197e3dd23008168d5214b878837), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "pi88sw", "OS PI/88 (black/white)" ) + ROMX_LOAD( "pi88_sw.853", 0x2000, 0x2000, CRC(f7d2e8fc) SHA1(9b5c068f10ff34bc3253f5b51abad51c8da9dd5d), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "pi88ws", "OS PI/88 (white/blue)" ) + ROMX_LOAD( "pi88_ws.853", 0x2000, 0x2000, CRC(9ef4efbf) SHA1(b8b6f606b76bce9fb7fcd61a14120e5e026b6b6e), ROM_BIOS(6)) +ROM_END + +ROM_START(kc85_4) + ROM_REGION(0x2000, "basic", 0) + ROM_LOAD("basic_c0.854", 0x0000, 0x2000, CRC(dfe34b08) SHA1(c2e3af55c79e049e811607364f88c703b0285e2e)) + ROM_REGION(0x4000, "caos", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "caos42", "CAOS 4.2" ) + ROMX_LOAD("caos__c0.854", 0x0000, 0x1000, CRC(57d9ab02) SHA1(774fc2496a59b77c7c392eb5aa46420e7722797e), ROM_BIOS(1)) + ROMX_LOAD("caos__e0.854", 0x2000, 0x2000, CRC(ee273933) SHA1(4300f7ff813c1fb2d5c928dbbf1c9e1fe52a9577), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "caos41", "CAOS 4.1" ) + ROMX_LOAD( "caos41c.854", 0x0000, 0x1000, CRC(c7e1c011) SHA1(acd998e3d9e8f592cd884aafc8ac4d291e40e097), ROM_BIOS(2)) + ROMX_LOAD( "caos41e.854", 0x2000, 0x2000, CRC(60e045e5) SHA1(e19819fb477dcb742a13729a9bf5943d63abe863), ROM_BIOS(2)) +ROM_END + +ROM_START(kc85_5) + ROM_REGION(0x8000, "basic", 0) + ROM_LOAD("basic_c0.855", 0x0000, 0x8000, CRC(0ed9f8b0) SHA1(be2c68a5b461014c57e33a127c3ffb32b0ff2346)) + + ROM_REGION(0x4000, "caos", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "caos44", "CAOS 4.4" ) + ROMX_LOAD( "caos__c0.855",0x0000, 0x2000, CRC(f56d5c18) SHA1(2cf8023ee71ca50b92f9f151b7519f59727d1c79), ROM_BIOS(1)) + ROMX_LOAD( "caos__e0.855",0x2000, 0x2000, CRC(1dbc2e6d) SHA1(53ba4394d96e287ff8af01322af1e9879d4e77c4), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "caos43", "CAOS 4.3" ) + ROMX_LOAD( "caos43c.855", 0x0000, 0x2000, CRC(2f0f9eaa) SHA1(5342be5104206d15e7471b094c7749a8a3d708ad), ROM_BIOS(2)) + ROMX_LOAD( "caos43e.855", 0x2000, 0x2000, CRC(b66fc6c3) SHA1(521ac2fbded4148220f8af2d5a5ab99634364079), ROM_BIOS(2)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1987, kc85_2, 0, 0, kc85_3, kc85, driver_device, 0, "VEB Mikroelektronik", "HC900 / KC 85/2", MACHINE_NOT_WORKING) +COMP( 1987, kc85_3, kc85_2, 0, kc85_3, kc85, driver_device, 0, "VEB Mikroelektronik", "KC 85/3", MACHINE_NOT_WORKING) +COMP( 1989, kc85_4, kc85_2, 0, kc85_4, kc85, driver_device, 0, "VEB Mikroelektronik", "KC 85/4", MACHINE_NOT_WORKING) +COMP( 1989, kc85_5, kc85_2, 0, kc85_5, kc85, driver_device, 0, "VEB Mikroelektronik", "KC 85/5", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/kim1.c b/src/mame/drivers/kim1.c new file mode 100644 index 00000000000..71a98a96cdf --- /dev/null +++ b/src/mame/drivers/kim1.c @@ -0,0 +1,359 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/****************************************************************************** + KIM-1 + + system driver + + Juergen Buchmueller, Oct 1999 + + KIM-1 memory map + + range short description + 0000-03FF RAM + 1400-16FF ??? + 1700-173F 6530-003 see 6530 + 1740-177F 6530-002 see 6530 + 1780-17BF RAM internal 6530-003 + 17C0-17FF RAM internal 6530-002 + 1800-1BFF ROM internal 6530-003 + 1C00-1FFF ROM internal 6530-002 + + 6530 + offset R/W short purpose + 0 X DRA Data register A + 1 X DDRA Data direction register A + 2 X DRB Data register B + 3 X DDRB Data direction register B + 4 W CNT1T Count down from value, divide by 1, disable IRQ + 5 W CNT8T Count down from value, divide by 8, disable IRQ + 6 W CNT64T Count down from value, divide by 64, disable IRQ + R LATCH Read current counter value, disable IRQ + 7 W CNT1KT Count down from value, divide by 1024, disable IRQ + R STATUS Read counter statzs, bit 7 = 1 means counter overflow + 8 X DRA Data register A + 9 X DDRA Data direction register A + A X DRB Data register B + B X DDRB Data direction register B + C W CNT1I Count down from value, divide by 1, enable IRQ + D W CNT8I Count down from value, divide by 8, enable IRQ + E W CNT64I Count down from value, divide by 64, enable IRQ + R LATCH Read current counter value, enable IRQ + F W CNT1KI Count down from value, divide by 1024, enable IRQ + R STATUS Read counter statzs, bit 7 = 1 means counter overflow + + 6530-002 (U2) + DRA bit write read + --------------------------------------------- + 0-6 segments A-G key columns 1-7 + 7 PTR KBD + + DRB bit write read + --------------------------------------------- + 0 PTR -/- + 1-4 dec 1-3 key row 1-3 + 4 RW3 + 5-9 7-seg 1-6 + 6530-003 (U3) + DRA bit write read + --------------------------------------------- + 0-7 bus PA0-7 bus PA0-7 + + DRB bit write read + --------------------------------------------- + 0-7 bus PB0-7 bus PB0-7 + + +The cassette interface +====================== + +The KIM-1 stores data on cassette using 2 frequencies: ~3700Hz (high) and ~2400Hz +(low). A high tone is output for 9 cycles and a low tone for 6 cycles. A logic bit +is encoded using 3 sequences of high and low tones. It always starts with a high +tone and ends with a low tone. The middle tone is high for a logic 0 and low for +0 logic 1. + +These high and low tone signals are fed to a circuit containing a LM565 PLL and +a 311 comparator. For a high tone a 1 is passed to DB7 of 6530-U2 for a low tone +a 0 is passed. The KIM-1 software measures the time it takes for the signal to +change from 1 to 0. + + + +Pasting: + 0-F : as is + + (inc) : ^ + AD : - + DA : = + GO : X + +(note: DA only works when addressing RAM) + +Test Paste: + =11^22^33^44^55^66^77^88^99^-0000 + Now press up-arrow to confirm the data has been entered. + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "sound/dac.h" +#include "machine/mos6530.h" +#include "imagedev/cassette.h" +#include "formats/kim1_cas.h" +#include "kim1.lh" + + +class kim1_state : public driver_device +{ +public: + kim1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_riot2(*this, "miot_u2"), + m_cass(*this, "cassette"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1"), + m_line2(*this, "LINE2"), + m_line3(*this, "LINE3") { } + + required_device m_maincpu; + required_device m_riot2; + required_device m_cass; + DECLARE_READ8_MEMBER(kim1_u2_read_a); + DECLARE_WRITE8_MEMBER(kim1_u2_write_a); + DECLARE_READ8_MEMBER(kim1_u2_read_b); + DECLARE_WRITE8_MEMBER(kim1_u2_write_b); + UINT8 m_u2_port_b; + UINT8 m_311_output; + UINT32 m_cassette_high_count; + UINT8 m_led_time[6]; + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(kim1_reset); + TIMER_DEVICE_CALLBACK_MEMBER(kim1_cassette_input); + TIMER_DEVICE_CALLBACK_MEMBER(kim1_update_leds); + +protected: + required_ioport m_line0; + required_ioport m_line1; + required_ioport m_line2; + required_ioport m_line3; +}; + + + + + +static ADDRESS_MAP_START(kim1_map, AS_PROGRAM, 8, kim1_state) + AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0xe000) AM_RAM + AM_RANGE(0x1700, 0x173f) AM_MIRROR(0xe000) AM_DEVREADWRITE("miot_u3", mos6530_device, read, write ) + AM_RANGE(0x1740, 0x177f) AM_MIRROR(0xe000) AM_DEVREADWRITE("miot_u2", mos6530_device, read, write ) + AM_RANGE(0x1780, 0x17bf) AM_MIRROR(0xe000) AM_RAM + AM_RANGE(0x17c0, 0x17ff) AM_MIRROR(0xe000) AM_RAM + AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0xe000) AM_ROM + AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0xe000) AM_ROM +ADDRESS_MAP_END + + +INPUT_CHANGED_MEMBER(kim1_state::kim1_reset) +{ + if (newval == 0) + m_maincpu->reset(); +} + + +static INPUT_PORTS_START( kim1 ) + PORT_START("LINE0") /* IN0 keys row 0 */ + PORT_BIT( 0x80, 0x00, IPT_UNUSED ) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + + PORT_START("LINE1") /* IN1 keys row 1 */ + PORT_BIT( 0x80, 0x00, IPT_UNUSED ) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("LINE2") /* IN2 keys row 2 */ + PORT_BIT( 0x80, 0x00, IPT_UNUSED ) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_F6) + + PORT_START("LINE3") /* IN3 STEP and RESET keys, MODE switch */ + PORT_BIT( 0x80, 0x00, IPT_UNUSED ) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("sw1: ST") PORT_CODE(KEYCODE_F7) + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("sw2: RS") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, kim1_state, kim1_reset, NULL) + PORT_DIPNAME(0x10, 0x10, "sw3: SS") PORT_CODE(KEYCODE_NUMLOCK) PORT_TOGGLE + PORT_DIPSETTING( 0x00, "single step") + PORT_DIPSETTING( 0x10, "run") + PORT_BIT( 0x08, 0x00, IPT_UNUSED ) + PORT_BIT( 0x04, 0x00, IPT_UNUSED ) + PORT_BIT( 0x02, 0x00, IPT_UNUSED ) + PORT_BIT( 0x01, 0x00, IPT_UNUSED ) +INPUT_PORTS_END + + +READ8_MEMBER( kim1_state::kim1_u2_read_a ) +{ + UINT8 data = 0xff; + + switch( ( m_u2_port_b >> 1 ) & 0x0f ) + { + case 0: + data = m_line0->read(); + break; + case 1: + data = m_line1->read(); + break; + case 2: + data = m_line2->read(); + break; + } + return data; +} + + +WRITE8_MEMBER( kim1_state::kim1_u2_write_a ) +{ + UINT8 idx = ( m_u2_port_b >> 1 ) & 0x0f; + + if ( idx >= 4 && idx < 10 ) + { + if ( data & 0x80 ) + { + output_set_digit_value( idx-4, data & 0x7f ); + m_led_time[idx - 4] = 15; + } + } +} + +READ8_MEMBER( kim1_state::kim1_u2_read_b ) +{ + if ( m_riot2->portb_out_get() & 0x20 ) + return 0xFF; + + return 0x7F | ( m_311_output ^ 0x80 ); +} + + +WRITE8_MEMBER( kim1_state::kim1_u2_write_b ) +{ + m_u2_port_b = data; + + if ( data & 0x20 ) + /* cassette write/speaker update */ + m_cass->output(( data & 0x80 ) ? -1.0 : 1.0 ); + + /* Set IRQ when bit 7 is cleared */ +} + + +TIMER_DEVICE_CALLBACK_MEMBER(kim1_state::kim1_cassette_input) +{ + double tap_val = m_cass->input(); + + if ( tap_val <= 0 ) + { + if ( m_cassette_high_count ) + { + m_311_output = ( m_cassette_high_count < 8 ) ? 0x80 : 0; + m_cassette_high_count = 0; + } + } + + if ( tap_val > 0 ) + m_cassette_high_count++; +} + + +TIMER_DEVICE_CALLBACK_MEMBER(kim1_state::kim1_update_leds) +{ + UINT8 i; + + for ( i = 0; i < 6; i++ ) + { + if ( m_led_time[i] ) + m_led_time[i]--; + else + output_set_digit_value( i, 0 ); + } +} + + +void kim1_state::machine_start() +{ + save_item(NAME(m_u2_port_b)); + save_item(NAME(m_311_output)); + save_item(NAME(m_cassette_high_count)); +} + + +void kim1_state::machine_reset() +{ + UINT8 i; + + for ( i = 0; i < 6; i++ ) + m_led_time[i] = 0; + + m_311_output = 0; + m_cassette_high_count = 0; +} + + +static MACHINE_CONFIG_START( kim1, kim1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 1000000) /* 1 MHz */ + MCFG_CPU_PROGRAM_MAP(kim1_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + + /* video */ + MCFG_DEFAULT_LAYOUT( layout_kim1 ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_DEVICE_ADD("miot_u2", MOS6530, 1000000) + MCFG_MOS6530_IN_PA_CB(READ8(kim1_state, kim1_u2_read_a)) + MCFG_MOS6530_OUT_PA_CB(WRITE8(kim1_state, kim1_u2_write_a)) + MCFG_MOS6530_IN_PB_CB(READ8(kim1_state, kim1_u2_read_b)) + MCFG_MOS6530_OUT_PB_CB(WRITE8(kim1_state, kim1_u2_write_b)) + + MCFG_DEVICE_ADD("miot_u3", MOS6530, 1000000) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(kim1_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", kim1_state, kim1_update_leds, attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", kim1_state, kim1_cassette_input, attotime::from_hz(44100)) +MACHINE_CONFIG_END + + +ROM_START(kim1) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("6530-003.bin", 0x1800, 0x0400, CRC(a2a56502) SHA1(60b6e48f35fe4899e29166641bac3e81e3b9d220)) + ROM_LOAD("6530-002.bin", 0x1c00, 0x0400, CRC(2b08e923) SHA1(054f7f6989af3a59462ffb0372b6f56f307b5362)) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1975, kim1, 0, 0, kim1, kim1, driver_device, 0, "MOS Technologies", "KIM-1" , MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/drivers/konin.c b/src/mame/drivers/konin.c new file mode 100644 index 00000000000..a9c5022a5ec --- /dev/null +++ b/src/mame/drivers/konin.c @@ -0,0 +1,115 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Mera-Elzab Konin + + It's industrial computer used in Poland + + 29/12/2011 Skeleton driver. + +'maincpu' (0384): unmapped i/o memory write to 00F8 = 56 & FF +'maincpu' (0388): unmapped i/o memory write to 00F8 = B6 & FF +'maincpu' (038C): unmapped i/o memory write to 0024 = 00 & FF +'maincpu' (0A0B): unmapped i/o memory write to 0080 = BE & FF +'maincpu' (0A0F): unmapped i/o memory write to 0080 = 08 & FF +'maincpu' (0A13): unmapped i/o memory write to 0080 = 0C & FF +'maincpu' (0A15): unmapped i/o memory read from 0082 & FF +'maincpu' (0A19): unmapped i/o memory write to 0080 = 05 & FF +'maincpu' (04DE): unmapped i/o memory write to 00F6 = 27 & FF +'maincpu' (04E2): unmapped i/o memory write to 00F6 = 40 & FF +'maincpu' (04E6): unmapped i/o memory write to 00F6 = CE & FF +'maincpu' (04EA): unmapped i/o memory write to 00F6 = 27 & FF +'maincpu' (043B): unmapped i/o memory write to 00F8 = B6 & FF +'maincpu' (043F): unmapped i/o memory write to 00F6 = 27 & FF +'maincpu' (2AA3): unmapped i/o memory write to 00F8 = 14 & FF +'maincpu' (2AA7): unmapped i/o memory write to 00FB = C0 & FF +'maincpu' (2AC2): unmapped i/o memory write to 00F8 = 56 & FF +'maincpu' (2AC6): unmapped i/o memory write to 00FA = 03 & FF +'maincpu' (0082): unmapped i/o memory write to 0024 = 06 & FF + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + +class konin_state : public driver_device +{ +public: + konin_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_konin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START( konin_mem, AS_PROGRAM, 8, konin_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x4fff) AM_ROM + AM_RANGE(0x5000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( konin_io, AS_IO, 8, konin_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( konin ) +INPUT_PORTS_END + + +void konin_state::machine_reset() +{ +} + +void konin_state::video_start() +{ +} + +UINT32 konin_state::screen_update_konin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( konin, konin_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(konin_mem) + MCFG_CPU_IO_MAP(konin_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(konin_state, screen_update_konin) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( konin ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "001.bin", 0x0000, 0x0800, CRC(0b13208a) SHA1(38ea17be591b729158d601c03bfd9954f32e0e67)) + ROM_LOAD( "008.bin", 0x0800, 0x0800, CRC(f003e407) SHA1(11f79ef3b90788cf627ee39705bbbd04dbf45f50)) + ROM_LOAD( "007.bin", 0x1000, 0x0800, CRC(3d390c03) SHA1(ac2fe31c065e8f630381d6cebd2eb58b403c1e02)) + ROM_LOAD( "006.bin", 0x1800, 0x0800, CRC(68c9732e) SHA1(f40a79719dca485a2db29be5c0c781f559c2551c)) + ROM_LOAD( "005.bin", 0x2000, 0x0800, CRC(14548ac4) SHA1(8987e528b3e479c4c5941366628f34f086d06838)) + ROM_LOAD( "004.bin", 0x2800, 0x0800, CRC(8a354cff) SHA1(24d9f1fb15458fc96f5265f79d54e030b68d9fc9)) + ROM_LOAD( "002.bin", 0x3000, 0x0800, CRC(791fb30d) SHA1(8dfbe0edb741e02cfdd138432999f89480b20471)) + ROM_LOAD( "003.bin", 0x3800, 0x0800, CRC(27dc9864) SHA1(0d3da7fd1db895883c106f5133f8c7228333ecc8)) + ROM_LOAD( "009.bin", 0x4000, 0x0800, CRC(80947d15) SHA1(0757fb191913d79f306874684f9fc082ce18a28e)) + ROM_LOAD( "010.bin", 0x4800, 0x0800, CRC(f0157e0c) SHA1(60ace1eaf0ba01a45987c2286e18f3d56441c994)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, konin, 0, 0, konin, konin, driver_device, 0, "Mera-Elzab", "Konin", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/korgm1.c b/src/mame/drivers/korgm1.c new file mode 100644 index 00000000000..99658c0057d --- /dev/null +++ b/src/mame/drivers/korgm1.c @@ -0,0 +1,209 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Korg M1 (c) 1988 + + skeleton driver + + Note: driver isn't yet hooked up to mess.lst / mess.mak, until a ROM + dump is found. + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/nec/nec.h" +//#include "sound/ay8910.h" + +#define MAIN_CLOCK XTAL_16MHz // Unknown clock + +class korgm1_state : public driver_device +{ +public: + korgm1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + // devices + required_device m_maincpu; + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + virtual void palette_init(); +}; + +void korgm1_state::video_start() +{ +} + +UINT32 korgm1_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + return 0; +} + +static ADDRESS_MAP_START( korgm1_map, AS_PROGRAM, 16, korgm1_state ) + AM_RANGE(0x00000, 0x0ffff) AM_RAM // 64 KB +// AM_RANGE(0x50000, 0x57fff) AM_RAM // memory card 32 KB + AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( korgm1_io, AS_IO, 16, korgm1_state ) +// AM_RANGE(0x0000, 0x00ff) internal peripheral (?) +// AM_RANGE(0x0100, 0x01ff) VDF 1 (MB87404) +// AM_RANGE(0x0200, 0x02ff) VDF 2 (MB87404) +// AM_RANGE(0x0500, 0x0503) MDE (MB87405) +// AM_RANGE(0x0600, 0x0601) OPZ 1 (8-bit port) +// AM_RANGE(0x0700, 0x0701) OPZ 2 (8-bit port) +// AM_RANGE(0x0800, 0x0801) SCAN (8-bit port) (keyboard) +// AM_RANGE(0x0900, 0x09??) A/D Converter (M58990P, Joystick, "value" and After Touch routes here) ** +// AM_RANGE(0x0a00, 0x0a03) PPI (CXD1095, presumably i8255 compatible, LCD, LED and SW routes here) * +// AM_RANGE(0x0b00, 0x0b01) LCDC (8-bit port) +// AM_RANGE(0x1000, 0x11ff) TG (MB87402) +// AM_RANGE(0x2000, 0x23ff) SCSI +// AM_RANGE(0x3000, 0x33ff) FDC +// TG 2? +ADDRESS_MAP_END + +// * Rail Chase 2 shares this (iocpu) +// ** Lock-On shares this + +static INPUT_PORTS_START( korgm1 ) + /* dummy active high structure */ + PORT_START("SYSA") + PORT_DIPNAME( 0x01, 0x00, "SYSA" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + /* dummy active low structure */ + PORT_START("DSWA") + PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +#if 0 +static const gfx_layout charlayout = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { RGN_FRAC(0,1) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; +#endif + +static GFXDECODE_START( korgm1 ) +// GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) +GFXDECODE_END + + +void korgm1_state::machine_start() +{ +} + +void korgm1_state::machine_reset() +{ +} + + +PALETTE_INIT_MEMBER(korgm1_state, korgm1) +{ +} + +static MACHINE_CONFIG_START( korgm1, korgm1_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",V30,MAIN_CLOCK) // V50 actually + MCFG_CPU_PROGRAM_MAP(korgm1_map) + MCFG_CPU_IO_MAP(korgm1_io) + + /* video hardware */ + /* TODO: LCD actually */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_UPDATE_DRIVER(korgm1_state, screen_update) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", korgm1) + + MCFG_PALETTE_ADD("palette", 8) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( korgm1 ) + ROM_REGION( 0x20000, "ipl", ROMREGION_ERASE00 ) + ROM_LOAD( "bios.rom", 0x00000, 0x20000, NO_DUMP ) + + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASE00 ) + ROM_LOAD( "pcm.rom", 0x00000, 0x200000, NO_DUMP ) + +// ROM_REGION( 0x10000, "gfx1", ROMREGION_ERASE00 ) +ROM_END + +GAME( 1988, korgm1, 0, korgm1, korgm1, 0, ROT0, "Korg", "M1", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/kramermc.c b/src/mame/drivers/kramermc.c new file mode 100644 index 00000000000..db139591a34 --- /dev/null +++ b/src/mame/drivers/kramermc.c @@ -0,0 +1,151 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Kramer MC driver by Miodrag Milanovic + + 13/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80pio.h" +#include "includes/kramermc.h" + +static GFXDECODE_START( kramermc ) + GFXDECODE_ENTRY( "gfx1", 0x0000, kramermc_charlayout, 0, 1 ) +GFXDECODE_END + +/* Address maps */ +static ADDRESS_MAP_START(kramermc_mem, AS_PROGRAM, 8, kramermc_state ) + AM_RANGE( 0x0000, 0x03ff ) AM_ROM // Monitor + AM_RANGE( 0x0400, 0x07ff ) AM_ROM // Debugger + AM_RANGE( 0x0800, 0x0bff ) AM_ROM // Reassembler + AM_RANGE( 0x0c00, 0x0fff ) AM_RAM // System RAM + AM_RANGE( 0x1000, 0x7fff ) AM_RAM // User RAM + AM_RANGE( 0x8000, 0xafff ) AM_ROM // BASIC + AM_RANGE( 0xc000, 0xc3ff ) AM_ROM // Editor + AM_RANGE( 0xc400, 0xdfff ) AM_ROM // Assembler + AM_RANGE( 0xfc00, 0xffff ) AM_RAM // Video RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( kramermc_io, AS_IO, 8, kramermc_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xfc, 0x0ff) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( kramermc ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(">") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_START("LINE7") + PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/* Machine driver */ +static MACHINE_CONFIG_START( kramermc, kramermc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 1500000) + MCFG_CPU_PROGRAM_MAP(kramermc_mem) + MCFG_CPU_IO_MAP(kramermc_io) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, 1500000) + MCFG_Z80PIO_IN_PA_CB(READ8(kramermc_state, kramermc_port_a_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(kramermc_state, kramermc_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(kramermc_state, kramermc_port_b_r)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*8, 16*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*8-1) + MCFG_SCREEN_UPDATE_DRIVER(kramermc_state, screen_update_kramermc) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", kramermc ) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( kramermc ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "io-mon.kmc", 0x0000, 0x0400, CRC(ba230fc8) SHA1(197d4ede31ee8768dd4a17854ee21c468e98b3d6) ) + ROM_LOAD( "debugger.kmc", 0x0400, 0x0400, CRC(5ea3d9e1) SHA1(42e5ced4f965124ae50ec7ac9861d6b668cfab99) ) + ROM_LOAD( "reass.kmc", 0x0800, 0x0400, CRC(7cc8e605) SHA1(3319a96aad710441af30dace906b9725e07ca92c) ) + ROM_LOAD( "basic.kmc", 0x8000, 0x3000, CRC(7531801e) SHA1(61d055495ffcc4a281ef0abc3e299ea95f42544b) ) + ROM_LOAD( "editor.kmc", 0xc000, 0x0400, CRC(2fd4cb84) SHA1(505615a218865aa8becde13848a23e1241a14b96) ) + ROM_LOAD( "ass.kmc", 0xc400, 0x1c00, CRC(9a09422e) SHA1(a578d2cf0ea6eb35dcd13e4107e15187de906097) ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("chargen.kmc", 0x0000, 0x0800, CRC(1ba52f9f) SHA1(71bbad90dd427d0132c871a4d3848ab3d4d84b8a)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, kramermc, 0, 0, kramermc, kramermc, kramermc_state, kramermc,"Manfred Kramer", "Kramer MC", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/kyocera.c b/src/mame/drivers/kyocera.c new file mode 100644 index 00000000000..af4b466f09b --- /dev/null +++ b/src/mame/drivers/kyocera.c @@ -0,0 +1,1640 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/****************************************************************************************** + + Kyocera Kyotronics 85 (and similar laptop computers) + + 2009/04 Very Preliminary Driver (video emulation courtesy of very old code by + Hamish Coleman) + + Comments about bit usage from Tech References and Virtual T source. + + Supported systems: + - Kyosei Kyotronic 85 + - Olivetti M10 (slightly diff hw, BIOS is shifted by 2 words) + - NEC PC-8201A (slightly diff hw) + - TRS-80 Model 100 + - Tandy Model 102 (slightly diff hw) + - Tandy Model 200 (diff video & rtc) + + To Do: + - Find dumps of systems which could easily be added: + * Olivetti M10 Modem (US) (diff BIOS than the European version) + * NEC PC-8201 (original Japanese version of PC-8201A) + * NEC PC-8300 (similar hardware to PC-8201) + * NEC PC-8300 w/BradyWriter II ROMs + +******************************************************************************************/ + +/* + + TODO: + + - bar code reader (!RxDB -> RST5.5, Hewlett-Packard HREDS-3050 interface) + - un-Y2K-hack tandy200 + - keyboard is unresponsive for couple of seconds after boot + - soft power on/off + - pc8201 48K RAM option + - pc8201 NEC PC-8241A video interface (TMS9918, 16K videoRAM, 8K ROM) + - pc8201 NEC PC-8233 floppy controller + - pc8201 NEC floppy disc drives (PC-8031-1W, PC-8031-2W, PC-80S31) + - trsm100 Tandy Portable Disk Drive (TPDD: 100k 3?", TPDD2: 200k 3?") (undumped HD63A01V1 MCU + full custom uPD65002, serial comms via IM6042) + - trsm100 Chipmunk disk drive (384k 3?") (full custom logic, not going to happen) + - trsm100 RS232/modem select + - tandy200 RTC alarm + - tandy200 TCM5089 DTMF sound + - international keyboard option ROMs + + 10 FOR A=0 TO 255 + 20 PRINT CHR$(A); + 30 NEXT A + +*/ + +/* + + * PC-8201/8300 HARDWARE PORT DEFINITIONS * + + -Port- + Name Hex Dec Notes + -------- --- --- ----------------------------------------- + A8255 070 112 Video interface port A (8255) + B8255 071 113 Video interface port B (8255) + C8255 072 114 Video interface port C (8255) + CW8255 073 115 Video interface command/mode port (8255) + +*/ + + +#include "includes/kyocera.h" + +/* Read/Write Handlers */ + +READ8_MEMBER( pc8201_state::bank_r ) +{ + /* + + bit signal description + + 0 LADR1 select address 0 to 7fff + 1 LADR2 select address 0 to 7fff + 2 HADR1 select address 8000 to ffff + 3 HADR2 select address 8000 to ffff + 4 + 5 + 6 SELB serial interface status bit 1 + 7 SELA serial interface status bit 0 + + */ + + return (m_iosel << 5) | m_bank; +} + +void pc8201_state::bankswitch(UINT8 data) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + int rom_bank = data & 0x03; + int ram_bank = (data >> 2) & 0x03; + + m_bank = data & 0x0f; + + if (rom_bank > 1) + { + /* RAM */ + program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); + } + else + { + /* ROM */ + program.install_read_bank(0x0000, 0x7fff, "bank1"); + program.unmap_write(0x0000, 0x7fff); + } + + membank("bank1")->set_entry(rom_bank); + + switch (ram_bank) + { + case 0: + if (m_ram->size() > 16 * 1024) + { + program.install_readwrite_bank(0x8000, 0xffff, "bank2"); + } + else + { + program.unmap_readwrite(0x8000, 0xbfff); + program.install_readwrite_bank(0xc000, 0xffff, "bank2"); + } + break; + + case 1: + program.unmap_readwrite(0x8000, 0xffff); + break; + + case 2: + if (m_ram->size() > 32 * 1024) + program.install_readwrite_bank(0x8000, 0xffff, "bank2"); + else + program.unmap_readwrite(0x8000, 0xffff); + break; + + case 3: + if (m_ram->size() > 64 * 1024) + program.install_readwrite_bank(0x8000, 0xffff, "bank2"); + else + program.unmap_readwrite(0x8000, 0xffff); + break; + } + + membank("bank2")->set_entry(ram_bank); +} + +WRITE8_MEMBER( pc8201_state::bank_w ) +{ + /* + + bit signal description + + 0 LADR1 select address 0 to 7fff + 1 LADR2 select address 0 to 7fff + 2 HADR1 select address 8000 to ffff + 3 HADR2 select address 8000 to ffff + 4 + 5 + 6 + 7 + + */ +printf("bank %02x\n",data); + bankswitch(data); +} + +WRITE8_MEMBER( pc8201_state::scp_w ) +{ + /* + + bit signal description + + 0 + 1 + 2 + 3 REMOTE cassette motor + 4 TSTB RTC strobe + 5 PSTB printer strobe + 6 SELB serial interface select bit 1 + 7 SELA serial interface select bit 0 + + */ + + /* cassette motor */ + m_cassette->change_state(BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + /* RTC strobe */ + m_rtc->stb_w(BIT(data, 4)); + + /* printer strobe */ + m_centronics->write_strobe(BIT(data, 5)); + + /* serial interface select */ + m_iosel = data >> 5; +} + +WRITE8_MEMBER( kc85_state::uart_ctrl_w ) +{ + /* + + bit signal description + + 0 SBS stop bit select + 1 EPE even parity enable + 2 PI parity inhibit + 3 CLS1 character length select bit 1 + 4 CLS2 character length select bit 2 + 5 + 6 + 7 + + */ + + m_uart->sbs_w(BIT(data, 0)); + m_uart->epe_w(BIT(data, 1)); + m_uart->pi_w(BIT(data, 2)); + m_uart->cls1_w(BIT(data, 3)); + m_uart->cls2_w(BIT(data, 4)); + + m_uart->crl_w(1); +} + +READ8_MEMBER( kc85_state::uart_status_r ) +{ + /* + + bit signal description + + 0 CD carrier detect + 1 OE overrun error + 2 FE framing error + 3 PE parity error + 4 TBRE transmit buffer register empty + 5 RP + 6 +5V + 7 _LPS low power sensor + + */ + + UINT8 data = 0x40; + + // carrier detect + data |= m_rs232->dcd_r(); + + // overrun error + data |= m_uart->oe_r() << 1; + + // framing error + data |= m_uart->fe_r() << 2; + + // parity error + data |= m_uart->pe_r() << 3; + + // transmit buffer register empty + data |= m_uart->tbre_r() << 4; + + // rp TODO + data |= 0x20; + + // low power sensor + data |= BIT(m_battery->read(), 0) << 7; + + return data; +} + +READ8_MEMBER( pc8201_state::uart_status_r ) +{ + /* + + bit signal description + + 0 _DCD/_RD data carrier detect / ring detect + 1 OE overrun error + 2 FE framing error + 3 PE parity error + 4 TBRE transmit buffer register empty + 5 RP + 6 +5V + 7 _LPS low power signal + + */ + + UINT8 data = 0x40; + + // data carrier detect / ring detect + data |= m_rs232->dcd_r(); + + // overrun error + data |= m_uart->oe_r() << 1; + + // framing error + data |= m_uart->fe_r() << 2; + + // parity error + data |= m_uart->pe_r() << 3; + + // transmit buffer register empty + data |= m_uart->tbre_r() << 4; + + // rp TODO + data |= 0x20; + + // low power sensor + data |= BIT(m_battery->read(), 0) << 7; + + return data; +} + +WRITE8_MEMBER( pc8201_state::romah_w ) +{ + /* + + bit signal + + 0 A16 + 1 ROM SEL + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + // ROM address bit 16 + m_rom_addr = (BIT(data, 0) << 16) | (m_rom_addr & 0xffff); + + // ROM select + m_rom_sel = BIT(data, 1); +} + +WRITE8_MEMBER( pc8201_state::romal_w ) +{ + /* + + bit signal + + 0 A0 + 1 A1 + 2 A2 + 3 A3 + 4 A4 + 5 A5 + 6 A6 + 7 A7 + + */ + + m_rom_addr = (m_rom_addr & 0x1ff00) | data; +} + +WRITE8_MEMBER( pc8201_state::romam_w ) +{ + /* + + bit signal + + 0 A8 + 1 A9 + 2 A10 + 3 A11 + 4 A12 + 5 A13 + 6 A14 + 7 A15 + + */ + + m_rom_addr = (m_rom_addr & 0x100ff) | (data << 8); +} + +READ8_MEMBER( pc8201_state::romrd_r ) +{ + UINT8 data = 0xff; + + if (m_rom_sel) + data = m_cas_cart->read_rom(space, m_rom_addr & 0x1ffff); + + return data; +} + +WRITE8_MEMBER( kc85_state::modem_w ) +{ + /* + + bit signal description + + 0 telephone line signal selection relay output + 1 EN MC14412 enable output + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + //m_modem->en_w(BIT(data, 1)); +} + +WRITE8_MEMBER( kc85_state::ctrl_w ) +{ + /* + + bit signal description + + 0 _STROM ROM selection (0=standard, 1=option) + 1 _STROBE printer strobe output + 2 STB RTC strobe output + 3 _REMOTE cassette motor + 4 + 5 + 6 + 7 + + */ + + /* ROM bank selection */ + membank("bank1")->set_entry(BIT(data, 0)); + + /* printer strobe */ + m_centronics->write_strobe(BIT(data, 1)); + + /* RTC strobe */ + m_rtc->stb_w(BIT(data, 2)); + + /* cassette motor */ + m_cassette->change_state(BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + +READ8_MEMBER( kc85_state::keyboard_r ) +{ + UINT8 data = 0xff; + + if (!BIT(m_keylatch, 0)) data &= m_y0->read(); + if (!BIT(m_keylatch, 1)) data &= m_y1->read(); + if (!BIT(m_keylatch, 2)) data &= m_y2->read(); + if (!BIT(m_keylatch, 3)) data &= m_y3->read(); + if (!BIT(m_keylatch, 4)) data &= m_y4->read(); + if (!BIT(m_keylatch, 5)) data &= m_y5->read(); + if (!BIT(m_keylatch, 6)) data &= m_y6->read(); + if (!BIT(m_keylatch, 7)) data &= m_y7->read(); + if (!BIT(m_keylatch, 8)) data &= m_y8->read(); + + return data; +} + +void tandy200_state::bankswitch(UINT8 data) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + int rom_bank = data & 0x03; + int ram_bank = (data >> 2) & 0x03; + + m_bank = data & 0x0f; + + if (rom_bank == 3) + { + /* invalid ROM bank */ + program.unmap_readwrite(0x0000, 0x7fff); + } + else + { + program.install_read_bank(0x0000, 0x7fff, "bank1"); + program.unmap_write(0x0000, 0x7fff); + membank("bank1")->set_entry(rom_bank); + } + + if (m_ram->size() < ((ram_bank + 1) * 24 * 1024)) + { + /* invalid RAM bank */ + program.unmap_readwrite(0xa000, 0xffff); + } + else + { + program.install_readwrite_bank(0xa000, 0xffff, "bank2"); + membank("bank2")->set_entry(ram_bank); + } +} + +READ8_MEMBER( tandy200_state::bank_r ) +{ + return m_bank; +} + +WRITE8_MEMBER( tandy200_state::bank_w ) +{ + bankswitch(data); +} + +READ8_MEMBER( tandy200_state::stbk_r ) +{ + UINT8 data = 0xff; + + if (!BIT(m_keylatch, 0)) data &= m_y0->read(); + if (!BIT(m_keylatch, 1)) data &= m_y1->read(); + if (!BIT(m_keylatch, 2)) data &= m_y2->read(); + if (!BIT(m_keylatch, 3)) data &= m_y3->read(); + if (!BIT(m_keylatch, 4)) data &= m_y4->read(); + if (!BIT(m_keylatch, 5)) data &= m_y5->read(); + if (!BIT(m_keylatch, 6)) data &= m_y6->read(); + if (!BIT(m_keylatch, 7)) data &= m_y7->read(); + if (!BIT(m_keylatch, 8)) data &= m_y8->read(); + + return data; +} + +WRITE8_MEMBER( tandy200_state::stbk_w ) +{ + /* + + bit signal description + + 0 _PSTB printer strobe output + 1 REMOTE cassette motor + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + /* printer strobe */ + m_centronics->write_strobe(BIT(data, 0)); + + /* cassette motor */ + m_cassette->change_state(BIT(data,1) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + +READ8_MEMBER( kc85_state::lcd_r ) +{ + UINT8 data = 0; + + data |= m_lcdc0->read(space, offset); + data |= m_lcdc1->read(space, offset); + data |= m_lcdc2->read(space, offset); + data |= m_lcdc3->read(space, offset); + data |= m_lcdc4->read(space, offset); + data |= m_lcdc5->read(space, offset); + data |= m_lcdc6->read(space, offset); + data |= m_lcdc7->read(space, offset); + data |= m_lcdc8->read(space, offset); + data |= m_lcdc9->read(space, offset); + + return data; +} + +WRITE8_MEMBER( kc85_state::lcd_w ) +{ + m_lcdc0->write(space, offset, data); + m_lcdc1->write(space, offset, data); + m_lcdc2->write(space, offset, data); + m_lcdc3->write(space, offset, data); + m_lcdc4->write(space, offset, data); + m_lcdc5->write(space, offset, data); + m_lcdc6->write(space, offset, data); + m_lcdc7->write(space, offset, data); + m_lcdc8->write(space, offset, data); + m_lcdc9->write(space, offset, data); +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( kc85_mem, AS_PROGRAM, 8, kc85_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8201_mem, AS_PROGRAM, 8, pc8201_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tandy200_mem, AS_PROGRAM, 8, tandy200_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0x9fff) AM_ROM + AM_RANGE(0xa000, 0xffff) AM_RAMBANK("bank2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( kc85_io, AS_IO, 8, kc85_state ) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional RAM unit +// AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional I/O controller unit +// AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) optional answering telephone unit +// AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) optional modem + AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_device, io_r, io_w) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_device, read, write) + AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(uart_status_r, uart_ctrl_w) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(keyboard_r, ctrl_w) + AM_RANGE(0xf0, 0xf1) AM_MIRROR(0x0e) AM_READWRITE(lcd_r, lcd_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( trsm100_io, AS_IO, 8, kc85_state ) + AM_IMPORT_FROM(kc85_io) + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(modem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8201_io, AS_IO, 8, pc8201_state ) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional video interface 8255 + AM_RANGE(0x80, 0x80) AM_MIRROR(0x03) AM_WRITE(romah_w) + AM_RANGE(0x84, 0x84) AM_MIRROR(0x03) AM_WRITE(romal_w) + AM_RANGE(0x88, 0x88) AM_MIRROR(0x03) AM_WRITE(romam_w) + AM_RANGE(0x8c, 0x8c) AM_MIRROR(0x03) AM_READ(romrd_r) + AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) AM_WRITE(scp_w) + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_READWRITE(bank_r, bank_w) + AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_device, io_r, io_w) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_device, read, write) + AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READ(uart_status_r) AM_WRITE(uart_ctrl_w) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READ(keyboard_r) + AM_RANGE(0xf0, 0xf1) AM_MIRROR(0x0e) AM_READWRITE(lcd_r, lcd_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tandy200_io, AS_IO, 8, tandy200_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x90, 0x9f) AM_DEVREADWRITE(RP5C01A_TAG, rp5c01_device, read, write) +// AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_DEVWRITE(TCM5089_TAG, write) + AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_device, io_r, io_w) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) + AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) + AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(bank_r, bank_w) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(stbk_r, stbk_w) + AM_RANGE(0xf0, 0xf0) AM_MIRROR(0x0e) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, data_r, data_w) + AM_RANGE(0xf1, 0xf1) AM_MIRROR(0x0e) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, status_r, control_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( kc85 ) + PORT_START("Y0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("Y1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START("Y2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START("Y3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("Y4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("Y5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + + PORT_START("Y6") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LABEL") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PASTE") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92|") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("Y8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE BREAK") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NUM") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CODE") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) + PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x00, "Low Battery" ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc8201 ) + PORT_INCLUDE( kc85 ) + + PORT_MODIFY("Y3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('^') + + PORT_MODIFY("Y4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + + PORT_MODIFY("Y5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAST INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_MODIFY("Y6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92|") PORT_CODE(KEYCODE_TAB) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_MODIFY("Y7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_MODIFY("Y8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc8201a ) + PORT_INCLUDE( kc85 ) + + PORT_MODIFY("Y3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('^') + + PORT_MODIFY("Y4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + + PORT_MODIFY("Y5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAST INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_MODIFY("Y6") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92|") PORT_CODE(KEYCODE_TAB) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_MODIFY("Y7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_MODIFY("Y8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( olivm10 ) + PORT_START("Y0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START("Y1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + + PORT_START("Y2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("Y3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START("Y4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + + PORT_START("Y5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + + PORT_START("Y6") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PASTE") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92|") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("Y7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("Y8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE BREAK") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NUM") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LABEL") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) + PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x00, "Low Battery" ) +INPUT_PORTS_END + + +/* 8155 Interface */ + +WRITE8_MEMBER( kc85_state::i8155_pa_w ) +{ + /* + + bit description + + 0 LCD chip select 0, key scan 0, RTC C0 + 1 LCD chip select 1, key scan 1, RTC C1 + 2 LCD chip select 2, key scan 2, RTC C2 + 3 LCD chip select 3, key scan 3, RTC CLK + 4 LCD chip select 4, key scan 4, RTC DATA IN + 5 LCD chip select 5, key scan 5 + 6 LCD chip select 6, key scan 6 + 7 LCD chip select 7, key scan 7 + + */ + + /* keyboard */ + m_keylatch = (m_keylatch & 0x100) | data; + + /* LCD */ + m_lcdc0->cs2_w(BIT(data, 0)); + m_lcdc1->cs2_w(BIT(data, 1)); + m_lcdc2->cs2_w(BIT(data, 2)); + m_lcdc3->cs2_w(BIT(data, 3)); + m_lcdc4->cs2_w(BIT(data, 4)); + m_lcdc5->cs2_w(BIT(data, 5)); + m_lcdc6->cs2_w(BIT(data, 6)); + m_lcdc7->cs2_w(BIT(data, 7)); + + /* RTC */ + m_rtc->c0_w(BIT(data, 0)); + m_rtc->c1_w(BIT(data, 1)); + m_rtc->c2_w(BIT(data, 2)); + m_rtc->clk_w(BIT(data, 3)); + m_rtc->data_in_w(BIT(data, 4)); +} + +WRITE8_MEMBER( kc85_state::i8155_pb_w ) +{ + /* + + bit signal description + + 0 LCD chip select 8, key scan 8 + 1 LCD chip select 9 + 2 _MC melody control output + 3 DCD/_RD RS232 DCD/_RD select (0=RS232, 1=modem) + 4 APO auto power off output + 5 BELL buzzer output (0=ring, 1=not ring) + 6 _DTR RS232 data terminal ready output + 7 _RTS RS232 request to send output + + */ + + /* keyboard */ + m_keylatch = (BIT(data, 0) << 8) | (m_keylatch & 0xff); + + /* LCD */ + m_lcdc8->cs2_w(BIT(data, 0)); + m_lcdc9->cs2_w(BIT(data, 1)); + + /* beeper */ + m_buzzer = BIT(data, 2); + m_bell = BIT(data, 5); + + if (m_buzzer) m_speaker->level_w(m_bell); + + // RS-232 + m_rs232->write_dtr(BIT(data, 6)); + m_rs232->write_rts(BIT(data, 7)); +} + +WRITE_LINE_MEMBER( kc85_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( kc85_state::write_centronics_select ) +{ + m_centronics_select = state; +} + +READ8_MEMBER( kc85_state::i8155_pc_r ) +{ + /* + + bit description + + 0 CDI clock data input + 1 SLCT _BUSY signal from printer + 2 BUSY BUSY signal from printer + 3 BCR bar code reader data input + 4 _CTS RS232 clear to send input + 5 _DSR RS232 DSR input + + */ + + UINT8 data = 0; + + // clock data input + data |= m_rtc->data_out_r(); + + // centronics busy + data |= m_centronics_select << 1; + data |= m_centronics_busy << 2; + + // RS-232 + data |= m_rs232->cts_r() << 4; + data |= m_rs232->dsr_r() << 5; + + return data; +} + +WRITE_LINE_MEMBER( kc85_state::i8155_to_w ) +{ + if (!m_buzzer && m_bell) + { + m_speaker->level_w(state); + } + + m_uart->trc_w(state); + m_uart->rrc_w(state); +} + +WRITE8_MEMBER( tandy200_state::i8155_pa_w ) +{ + /* + + bit description + + 0 print data 0, key scan 0 + 1 print data 1, key scan 1 + 2 print data 2, key scan 2 + 3 print data 3, key scan 3 + 4 print data 4, key scan 4 + 5 print data 5, key scan 5 + 6 print data 6, key scan 6 + 7 print data 7, key scan 7 + + */ + + m_cent_data_out->write(space, 0, data); + + m_keylatch = (m_keylatch & 0x100) | data; +} + +WRITE8_MEMBER( tandy200_state::i8155_pb_w ) +{ + /* + + bit signal description + + 0 key scan 8 + 1 ORIG/ANS (1=ORIG, 0=ANS) + 2 _BUZZER (0=data from 8155 TO, 1=data from PB2) + 3 _RS232C (1=modem, 0=RS-232) + 4 PCS power cut signal + 5 BELL buzzer data output + 6 MEN modem enable output + 7 CALL connects and disconnects the phone line + + */ + + /* keyboard */ + m_keylatch = (BIT(data, 0) << 8) | (m_keylatch & 0xff); + + /* beeper */ + m_buzzer = BIT(data, 2); + m_bell = BIT(data, 5); + + if (m_buzzer) m_speaker->level_w(m_bell); +} + +WRITE_LINE_MEMBER( tandy200_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( tandy200_state::write_centronics_select ) +{ + m_centronics_select = state; +} + +READ8_MEMBER( tandy200_state::i8155_pc_r ) +{ + /* + + bit signal description + + 0 _LPS low power sense input + 1 _BUSY not busy input + 2 BUSY busy input + 3 BCR bar code reader data input + 4 CD carrier detect input + 5 CDBD carrier detect break down input + + */ + + UINT8 data = 0x01; + + // centronics + data |= m_centronics_select << 1; + data |= m_centronics_busy << 2; + + // RS-232 + data |= m_rs232->dcd_r() << 4; + + return data; +} + +WRITE_LINE_MEMBER( tandy200_state::i8155_to_w ) +{ + if (!m_buzzer && m_bell) + { + m_speaker->level_w(state); + } +} + +/* Machine Drivers */ + +void kc85_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + std::string region_tag; + m_opt_region = memregion(region_tag.assign(m_opt_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + /* initialize RTC */ + m_rtc->cs_w(1); + m_rtc->oe_w(1); + + /* configure ROM banking */ + program.install_read_bank(0x0000, 0x7fff, "bank1"); + program.unmap_write(0x0000, 0x7fff); + membank("bank1")->configure_entry(0, m_rom->base()); + membank("bank1")->configure_entry(1, m_opt_region ? m_opt_region->base() : m_rom->base()); + membank("bank1")->set_entry(0); + + /* configure RAM banking */ + switch (m_ram->size()) + { + case 16 * 1024: + program.unmap_readwrite(0x8000, 0xbfff); + program.install_readwrite_bank(0xc000, 0xffff, "bank2"); + break; + + case 32 * 1024: + program.install_readwrite_bank(0x8000, 0xffff,"bank2"); + break; + } + + membank("bank2")->configure_entry(0, m_ram->pointer()); + membank("bank2")->set_entry(0); + + /* register for state saving */ + save_item(NAME(m_bank)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_buzzer)); + save_item(NAME(m_bell)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_select)); +} + +void pc8201_state::machine_start() +{ + UINT8 *ram = m_ram->pointer(); + + std::string region_tag; + m_opt_region = memregion(region_tag.assign(m_opt_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + /* initialize RTC */ + m_rtc->cs_w(1); + m_rtc->oe_w(1); + + /* configure ROM banking */ + membank("bank1")->configure_entry(0, m_rom->base()); + membank("bank1")->configure_entry(1, m_opt_region ? m_opt_region->base() : m_rom->base()); + membank("bank1")->configure_entries(2, 2, ram + 0x8000, 0x8000); + membank("bank1")->set_entry(0); + + /* configure RAM banking */ + membank("bank2")->configure_entry(0, ram); + membank("bank2")->configure_entries(2, 2, ram + 0x8000, 0x8000); + membank("bank2")->set_entry(0); + + bankswitch(0); + + /* register for state saving */ + save_item(NAME(m_bank)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_buzzer)); + save_item(NAME(m_bell)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_select)); + save_item(NAME(m_iosel)); +} + +void trsm100_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + std::string region_tag; + m_opt_region = memregion(region_tag.assign(m_opt_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + /* initialize RTC */ + m_rtc->cs_w(1); + m_rtc->oe_w(1); + + /* configure ROM banking */ + program.install_read_bank(0x0000, 0x7fff, "bank1"); + program.unmap_write(0x0000, 0x7fff); + membank("bank1")->configure_entry(0, m_rom->base()); + membank("bank1")->configure_entry(1, m_opt_region ? m_opt_region->base() : m_rom->base()); + membank("bank1")->set_entry(0); + + /* configure RAM banking */ + switch (m_ram->size()) + { + case 8 * 1024: + program.unmap_readwrite(0x8000, 0xcfff); + program.install_readwrite_bank(0xe000, 0xffff, "bank2"); + break; + + case 16 * 1024: + program.unmap_readwrite(0x8000, 0xbfff); + program.install_readwrite_bank(0xc000, 0xffff, "bank2"); + break; + + case 24 * 1024: + program.unmap_readwrite(0x8000, 0x9fff); + program.install_readwrite_bank(0xa000, 0xffff, "bank2"); + break; + + case 32 * 1024: + program.install_readwrite_bank(0x8000, 0xffff, "bank2"); + break; + } + + membank("bank2")->configure_entry(0, m_ram->pointer()); + membank("bank2")->set_entry(0); + + /* register for state saving */ + save_item(NAME(m_bank)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_buzzer)); + save_item(NAME(m_bell)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_select)); +} + +void tandy200_state::machine_start() +{ + std::string region_tag; + m_opt_region = memregion(region_tag.assign(m_opt_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + /* configure ROM banking */ + membank("bank1")->configure_entry(0, m_rom->base()); + membank("bank1")->configure_entry(1, m_rom->base() + 0x10000); + membank("bank1")->configure_entry(2, m_opt_region ? m_opt_region->base() : m_rom->base()); + membank("bank1")->set_entry(0); + + /* configure RAM banking */ + membank("bank2")->configure_entries(0, 3, m_ram->pointer(), 0x6000); + membank("bank2")->set_entry(0); + + /* register for state saving */ + save_item(NAME(m_bank)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_buzzer)); + save_item(NAME(m_bell)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_select)); + save_item(NAME(m_tp)); +} + +WRITE_LINE_MEMBER( kc85_state::kc85_sod_w ) +{ + m_cassette->output(state ? +1.0 : -1.0); +} + +READ_LINE_MEMBER( kc85_state::kc85_sid_r ) +{ + return m_cassette->input() > 0.0; +} + +WRITE_LINE_MEMBER( tandy200_state::kc85_sod_w ) +{ + m_cassette->output(state ? +1.0 : -1.0); +} + +READ_LINE_MEMBER( tandy200_state::kc85_sid_r ) +{ + return m_cassette->input() > 0.0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(tandy200_state::tandy200_tp_tick) +{ + m_maincpu->set_input_line(I8085_RST75_LINE, m_tp); + + m_tp = !m_tp; +} + +static MACHINE_CONFIG_START( kc85, kc85_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I8085_TAG, I8085A, XTAL_4_9152MHz) + MCFG_CPU_PROGRAM_MAP(kc85_mem) + MCFG_CPU_IO_MAP(kc85_io) + MCFG_I8085A_SID(READLINE(kc85_state,kc85_sid_r)) + MCFG_I8085A_SOD(WRITELINE(kc85_state,kc85_sod_w)) + + /* video hardware */ + MCFG_FRAGMENT_ADD(kc85_video) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_4_9152MHz/2) + MCFG_I8155_OUT_PORTA_CB(WRITE8(kc85_state, i8155_pa_w)) + MCFG_I8155_OUT_PORTB_CB(WRITE8(kc85_state, i8155_pb_w)) + MCFG_I8155_IN_PORTC_CB(READ8(kc85_state, i8155_pc_r)) + MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(kc85_state, i8155_to_w)) + + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE)) + + MCFG_IM6402_ADD(IM6402_TAG, 0, 0) + MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kc85_state, write_centronics_busy)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(kc85_state, write_centronics_select)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* option ROM cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("opt_cartslot", generic_linear_slot, "trsm100_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "trsm100") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pc8201, pc8201_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I8085_TAG, I8085A, XTAL_4_9152MHz) + MCFG_CPU_PROGRAM_MAP(pc8201_mem) + MCFG_CPU_IO_MAP(pc8201_io) + MCFG_I8085A_SID(READLINE(kc85_state,kc85_sid_r)) + MCFG_I8085A_SOD(WRITELINE(kc85_state,kc85_sod_w)) + + /* video hardware */ + MCFG_FRAGMENT_ADD(kc85_video) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_4_9152MHz/2) + MCFG_I8155_OUT_PORTA_CB(WRITE8(kc85_state, i8155_pa_w)) + MCFG_I8155_OUT_PORTB_CB(WRITE8(kc85_state, i8155_pb_w)) + MCFG_I8155_IN_PORTC_CB(READ8(kc85_state, i8155_pc_r)) + MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(kc85_state, i8155_to_w)) + + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE)) + + MCFG_IM6402_ADD(IM6402_TAG, 0, 0) + MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kc85_state, write_centronics_busy)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(kc85_state, write_centronics_select)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* option ROM cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("opt_cartslot", generic_linear_slot, "pc8201_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* 128KB ROM cassette */ + MCFG_GENERIC_CARTSLOT_ADD("cas_cartslot", generic_linear_slot, "pc8201_cart2") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "pc8201") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K,64K,96K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc8300, pc8201 ) + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("64K,96K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( trsm100, trsm100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I8085_TAG, I8085A, XTAL_4_9152MHz) + MCFG_CPU_PROGRAM_MAP(kc85_mem) + MCFG_CPU_IO_MAP(trsm100_io) + MCFG_I8085A_SID(READLINE(kc85_state,kc85_sid_r)) + MCFG_I8085A_SOD(WRITELINE(kc85_state,kc85_sod_w)) + + /* video hardware */ + MCFG_FRAGMENT_ADD(kc85_video) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_4_9152MHz/2) + MCFG_I8155_OUT_PORTA_CB(WRITE8(kc85_state, i8155_pa_w)) + MCFG_I8155_OUT_PORTB_CB(WRITE8(kc85_state, i8155_pb_w)) + MCFG_I8155_IN_PORTC_CB(READ8(kc85_state, i8155_pc_r)) + MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(kc85_state, i8155_to_w)) + + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE)) + + MCFG_IM6402_ADD(IM6402_TAG, 0, 0) + MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + +// MCFG_MC14412_ADD(MC14412_TAG, XTAL_1MHz) + + /* option ROM cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("opt_cartslot", generic_linear_slot, "trsm100_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "trsm100") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8K") + MCFG_RAM_EXTRA_OPTIONS("16K,24K,32K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tandy102, trsm100 ) + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("24K") + MCFG_RAM_EXTRA_OPTIONS("32K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( tandy200, tandy200_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I8085_TAG, I8085A, XTAL_4_9152MHz) + MCFG_CPU_PROGRAM_MAP(tandy200_mem) + MCFG_CPU_IO_MAP(tandy200_io) + MCFG_I8085A_SID(READLINE(tandy200_state,kc85_sid_r)) + MCFG_I8085A_SOD(WRITELINE(tandy200_state,kc85_sod_w)) + + /* video hardware */ + MCFG_FRAGMENT_ADD(tandy200_video) + + /* TP timer */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("tp", tandy200_state, tandy200_tp_tick, attotime::from_hz(XTAL_4_9152MHz/2/8192)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +// MCFG_TCM5089_ADD(TCM5089_TAG, XTAL_3_579545MHz) + + /* devices */ + MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_4_9152MHz/2) + MCFG_I8155_OUT_PORTA_CB(WRITE8(tandy200_state, i8155_pa_w)) + MCFG_I8155_OUT_PORTB_CB(WRITE8(tandy200_state, i8155_pb_w)) + MCFG_I8155_IN_PORTC_CB(READ8(tandy200_state, i8155_pc_r)) + MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(tandy200_state, i8155_to_w)) + + MCFG_DEVICE_ADD(RP5C01A_TAG, RP5C01, XTAL_32_768kHz) + + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) /*XTAL_4_9152MHz/2,*/ + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) + +// MCFG_MC14412_ADD(MC14412_TAG, XTAL_1MHz) + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(tandy200_state, write_centronics_busy)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(tandy200_state, write_centronics_select)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* option ROM cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("opt_cartslot", generic_linear_slot, "tandy200_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "tandy200") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("24K") + MCFG_RAM_EXTRA_OPTIONS("48K,72K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( kc85 ) + ROM_REGION( 0x8000, I8085_TAG, 0 ) + ROM_LOAD( "kc85rom.bin", 0x0000, 0x8000, CRC(8a9ddd6b) SHA1(9d18cb525580c9e071e23bc3c472380aa46356c0) ) +ROM_END + +ROM_START( pc8201 ) + ROM_REGION( 0x10000, I8085_TAG, 0 ) + ROM_LOAD( "3256a41-3b1 n 82 basic.rom0", 0x0000, 0x8000, CRC(3dbaa484) SHA1(9886a973faa639ca9e0ba478790bab20e5163495) ) +ROM_END + +ROM_START( pc8201a ) + ROM_REGION( 0x10000, I8085_TAG, 0 ) + ROM_LOAD( "pc8201rom.rom", 0x0000, 0x8000, CRC(30555035) SHA1(96f33ff235db3028bf5296052acedbc94437c596) ) +ROM_END + +ROM_START( npc8300 ) + ROM_REGION( 0x10000, I8085_TAG, 0 ) + ROM_LOAD( "831000-438_n83a_basic_1986_microsoft_8716_z01.bin", 0x0000, 0x8000, CRC(a3c15dcb) SHA1(f0322dfe3f2e951de043bf6d0973e6ffc2c87181)) +ROM_END + +ROM_START( trsm100 ) + /* + Board Code ROM type ROM Code Comment + ------------------------------------------------------------------- + PLX110CH1X custom LH535618 early North America + PLX110EH1X 27C256 compatible 3256C07-3J1/11US late North America + PLX120CH1X 27C256 compatible 3256C05-3E1/11EP European/Italian + */ + ROM_REGION( 0x8000, I8085_TAG, 0 ) + ROM_LOAD( "m100rom.m12", 0x0000, 0x8000, CRC(730a3611) SHA1(094dbc4ac5a4ea5cdf51a1ac581a40a9622bb25d) ) +ROM_END + +ROM_START( m10 ) + // 3256C02-4B3/I Italian + ROM_REGION( 0x8010, I8085_TAG, 0 ) + ROM_LOAD( "m10rom.m12", 0x0000, 0x8000, CRC(f0e8447a) SHA1(d58867276213116a79f7074109b7d7ce02e8a3af) ) +ROM_END + +ROM_START( tandy102 ) + ROM_REGION( 0x8000, I8085_TAG, 0 ) + ROM_LOAD( "m102rom.m12", 0x0000, 0x8000, CRC(08e9f89c) SHA1(b6ede7735a361c80419f4c9c0e36e7d480c36d11) ) +ROM_END + +ROM_START( tandy200 ) + ROM_REGION( 0x18000, I8085_TAG, 0 ) + ROM_LOAD( "rom #1-1.m15", 0x00000, 0x8000, NO_DUMP ) + ROM_LOAD( "rom #1-2.m13", 0x08000, 0x2000, NO_DUMP ) + ROM_LOAD( "rom #2.m14", 0x10000, 0x8000, NO_DUMP ) + ROM_LOAD( "t200rom.bin", 0x0000, 0xa000, BAD_DUMP CRC(e3358b38) SHA1(35d4e6a5fb8fc584419f57ec12b423f6021c0991) ) /* Y2K hacked */ + ROM_CONTINUE( 0x10000, 0x8000 ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1983, kc85, 0, 0, kc85, kc85, driver_device, 0, "Kyosei", "Kyotronic 85 (Japan)", 0 ) +COMP( 1983, m10, kc85, 0, kc85, olivm10, driver_device, 0, "Olivetti", "M-10", 0 ) +//COMP( 1983, m10m, kc85, 0, kc85, olivm10, driver_device, 0, "Olivetti", "M-10 Modem (US)", 0 ) +COMP( 1983, trsm100, 0, 0, trsm100, kc85, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 100", 0 ) +COMP( 1986, tandy102, trsm100,0, tandy102, kc85, driver_device, 0, "Tandy Radio Shack", "Tandy 102", 0 ) +COMP( 1983, pc8201, 0, 0, pc8201, pc8201, driver_device, 0, "Nippon Electronic Company", "PC-8201 (Japan)", MACHINE_NOT_WORKING ) // keyboard layout wrong +COMP( 1983, pc8201a, pc8201, 0, pc8201, pc8201a, driver_device, 0, "Nippon Electronic Company", "PC-8201A", 0 ) +COMP( 1987, npc8300, pc8201, 0, pc8300, pc8201a, driver_device, 0, "Nippon Electronic Company", "PC-8300", MACHINE_NOT_WORKING ) +COMP( 1984, tandy200, 0, 0, tandy200, kc85, driver_device, 0, "Tandy Radio Shack", "Tandy 200", 0 ) diff --git a/src/mame/drivers/laser3k.c b/src/mame/drivers/laser3k.c new file mode 100644 index 00000000000..a7a3fa3bfa3 --- /dev/null +++ b/src/mame/drivers/laser3k.c @@ -0,0 +1,1037 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + laser3k.c + Driver for VTech Laser 3000 / Dick Smith Electronics "The Cat" + + This machine is somewhat similar to a 48K Apple II if you blur your eyes + a lot, but it generally fits in poorly with 100% compatible machines + (no chance of a compatible language card or auxmem) so it gets its own driver. + + An "emulation cartridge" is required to run Apple II software; it's unclear + what that consists of. + + Banking theory: + - 6502 has 4 banking windows, 0000-3FFF, 4000-7FFF, 8000-BFFF, C000-FFFF + - Physical address space is 0x00000-0x3FFFF. ROM and I/O at the top, RAM + up to 0x2FFFF (192k max). + - Each window has a bank number register at physical 3C07C/D/E/F + + Technical manual at: + http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/LASER/LASER%203000/Manuals/The%20Cat%20Technical%20Reference%20Manual.pdf + + TODO: + - Finish keyboard + - RGB graphics mode + - FDC C800 page appears to be inside the FDC cartridge, need a dump :( (can hack to use IWM in the meantime) + - Centronics printer port (data at 3c090, read ack at 3c1c0, read busy at 3c1c2) + - cassette + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/bankdev.h" +#include "machine/ram.h" +#include "machine/kb3600.h" +#include "sound/speaker.h" +#include "sound/sn76496.h" + +enum +{ + TEXT = 0, + HIRES, + RGB, + DHIRES +}; + +#define BLACK 0 +#define DKRED 1 +#define DKBLUE 2 +#define PURPLE 3 +#define DKGREEN 4 +#define DKGRAY 5 +#define BLUE 6 +#define LTBLUE 7 +#define BROWN 8 +#define ORANGE 9 +#define GRAY 10 +#define PINK 11 +#define GREEN 12 +#define YELLOW 13 +#define AQUA 14 +#define WHITE 15 + +class laser3k_state : public driver_device +{ +public: + laser3k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_ram(*this, "mainram") + , m_bank0(*this, "bank0") + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_ay3600(*this, "ay3600") + , m_speaker(*this, "speaker") + , m_sn(*this, "sn76489") + , m_kbspecial(*this, "keyb_special") + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_bank0; + required_device m_bank1; + required_device m_bank2; + required_device m_bank3; + required_device m_ay3600; + required_device m_speaker; + required_device m_sn; + required_ioport m_kbspecial; + + READ8_MEMBER( ram_r ); + WRITE8_MEMBER( ram_w ); + READ8_MEMBER( io_r ); + WRITE8_MEMBER( io_w ); + READ8_MEMBER( io2_r ); + + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(laser3k); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + + DECLARE_READ_LINE_MEMBER(ay3600_shift_r); + DECLARE_READ_LINE_MEMBER(ay3600_control_r); + DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); + +private: + UINT8 m_bank0val, m_bank1val, m_bank2val, m_bank3val; + int m_flash; + int m_speaker_state; + int m_disp_page; + int m_bg_color, m_fg_color, m_border_color; + UINT16 m_lastchar, m_strobe; + UINT8 m_transchar; + bool m_80col; + bool m_mix; + int m_gfxmode; + UINT16 *m_hires_artifact_map; + UINT16 *m_dhires_artifact_map; + + void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen); + void do_io(int offset); +}; + +/*************************************************************************** + ADDRESS MAP +***************************************************************************/ + +static ADDRESS_MAP_START( laser3k_map, AS_PROGRAM, 8, laser3k_state ) + AM_RANGE(0x0000, 0x3fff) AM_DEVICE("bank0", address_map_bank_device, amap8) + AM_RANGE(0x4000, 0x7fff) AM_DEVICE("bank1", address_map_bank_device, amap8) + AM_RANGE(0x8000, 0xbfff) AM_DEVICE("bank2", address_map_bank_device, amap8) + AM_RANGE(0xc000, 0xffff) AM_DEVICE("bank3", address_map_bank_device, amap8) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( banks_map, AS_PROGRAM, 8, laser3k_state ) + AM_RANGE(0x00000, 0x2ffff) AM_READWRITE(ram_r, ram_w) + AM_RANGE(0x38000, 0x3bfff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x3c000, 0x3c0ff) AM_READWRITE(io_r, io_w) + AM_RANGE(0x3c100, 0x3c1ff) AM_READ(io2_r) + AM_RANGE(0x3c200, 0x3ffff) AM_ROM AM_REGION("maincpu", 0x4200) +ADDRESS_MAP_END + +void laser3k_state::machine_start() +{ + static const UINT8 hires_artifact_color_table[] = + { + BLACK, PURPLE, GREEN, WHITE, + BLACK, BLUE, ORANGE, WHITE + }; + + static const UINT8 dhires_artifact_color_table[] = + { + BLACK, DKGREEN, BROWN, GREEN, + DKRED, DKGRAY, ORANGE, YELLOW, + DKBLUE, BLUE, GRAY, AQUA, + PURPLE, LTBLUE, PINK, WHITE + }; + int i, j; + UINT16 c; + + /* 2^3 dependent pixels * 2 color sets * 2 offsets */ + m_hires_artifact_map = auto_alloc_array(machine(), UINT16, 8 * 2 * 2); + + /* 2^4 dependent pixels */ + m_dhires_artifact_map = auto_alloc_array(machine(), UINT16, 16); + + /* build hires artifact map */ + for (i = 0; i < 8; i++) + { + for (j = 0; j < 2; j++) + { + if (i & 0x02) + { + if ((i & 0x05) != 0) + c = 3; + else + c = j ? 2 : 1; + } + else + { + if ((i & 0x05) == 0x05) + c = j ? 1 : 2; + else + c = 0; + } + m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % 8]; + m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % 8]; + } + } + + /* build double hires artifact map */ + for (i = 0; i < 16; i++) + { + m_dhires_artifact_map[i] = dhires_artifact_color_table[i]; + } +} + +void laser3k_state::machine_reset() +{ + m_bank0val = 0; + m_bank1val = 1; + m_bank2val = 2; + m_bank3val = 0xf; + m_bank0->set_bank(m_bank0val); + m_bank1->set_bank(m_bank1val); + m_bank2->set_bank(m_bank2val); + m_bank3->set_bank(m_bank3val); + + // reset the 6502 here with the banking set up so we get the right vector + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + + m_flash = 0; + m_speaker_state = 0; + m_disp_page = 0; + m_bg_color = 0; + m_fg_color = 15; + m_border_color = 0; + m_strobe = 0; + m_transchar = 0; + m_lastchar = 0; + m_80col = 0; + m_mix = false; + m_gfxmode = TEXT; + + UINT8 *rom = (UINT8 *)memregion("maincpu")->base(); + + // patch out disk controller ID for now so it drops right into BASIC + rom[0x4607] = 0; +} + +READ8_MEMBER( laser3k_state::ram_r ) +{ + return m_ram->read(offset); +} + +WRITE8_MEMBER( laser3k_state::ram_w ) +{ + m_ram->write(offset, data); +} + +// most softswitches don't care about read vs write, so handle them here +void laser3k_state::do_io(int offset) +{ + switch (offset) + { + case 0x08: // set border color to black + m_border_color = 0; + break; + case 0x09: // set border color to red + m_border_color = 1; + break; + case 0x0a: // set border color to green + m_border_color = 12; + break; + case 0x0b: // set border color to yellow + m_border_color = 13; + break; + case 0x0c: // set border color to blue + m_border_color = 6; + break; + case 0x0d: // set border color to magenta + m_border_color = 3; + break; + case 0x0e: // set border color to cyan + m_border_color = 14; + break; + case 0x0f: // set border color to white + m_border_color = 15; + break; + + case 0x18: // set bg color to black + m_bg_color = 0; + break; + case 0x19: // set bg color to red + m_bg_color = 1; + break; + case 0x1a: // set bg color to green + m_bg_color = 12; + break; + case 0x1b: // set bg color to yellow + m_bg_color = 13; + break; + case 0x1c: // set bg color to blue + m_bg_color = 6; + break; + case 0x1d: // set bg color to magenta + m_bg_color = 3; + break; + case 0x1e: // set bg color to cyan + m_bg_color = 14; + break; + case 0x1f: // set bg color to white + m_bg_color = 15; + break; + + case 0x28: // set fg color to normal + m_fg_color = 15; + break; + case 0x29: // set fg color to red + m_fg_color = 1; + break; + case 0x2a: // set fg color to green + m_fg_color = 12; + break; + case 0x2b: // set fg color to yellow + m_fg_color = 13; + break; + case 0x2c: // set fg color to blue + m_fg_color = 6; + break; + case 0x2d: // set fg color to magenta + m_fg_color = 3; + break; + case 0x2e: // set fg color to cyan + m_fg_color = 14; + break; + case 0x2f: // set fg color to white + m_fg_color = 15; + break; + + case 0x30: + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + break; + + case 0x4c: // low resolution (40 column) + m_80col = false; + m_maincpu->set_unscaled_clock(1021800); + break; + + case 0x4d: // RGB mode + m_gfxmode = RGB; + break; + + case 0x4e: // double hi-res + m_80col = true; + m_gfxmode = DHIRES; + m_maincpu->set_unscaled_clock(1021800*2); + break; + + case 0x4f: // high resolution (80 column). Yes, the CPU clock also doubles when the pixel clock does (!) + m_80col = true; + m_maincpu->set_unscaled_clock(1021800*2); + break; + + case 0x50: // graphics mode + m_gfxmode = HIRES; + break; + + case 0x51: // text mode + m_gfxmode = TEXT; + break; + + case 0x52: // no mix + m_mix = false; + break; + + case 0x53: // mixed mode + m_mix = true; + break; + + case 0x54: // set page 1 + m_disp_page = 0; + break; + + case 0x55: // set page 2 + m_disp_page = 1; + break; + + case 0x56: // disable emulation (?) + break; + + default: + printf("do_io: unknown softswitch @ %x\n", offset); + break; + } +} + +READ8_MEMBER( laser3k_state::io_r ) +{ + switch (offset) + { + case 0x00: // keyboard latch + return m_transchar | m_strobe; + + case 0x10: // keyboard strobe + { + UINT8 rv = m_transchar | m_strobe; + m_strobe = 0; + return rv; + } + + case 0x7c: + return m_bank0val; + + case 0x7d: + return m_bank1val; + + case 0x7e: + return m_bank2val; + + case 0x7f: + return m_bank3val; + + default: + do_io(offset); + break; + } + + return 0xff; +} + +WRITE8_MEMBER( laser3k_state::io_w ) +{ + switch (offset) + { + case 0x10: // clear keyboard latch + m_strobe = 0; + break; + + case 0x68: // SN76489 sound + m_sn->write(space, 0, data); + break; + + case 0x78: // called "SYSTEM" in the boot ROM listing, but unsure what it does + break; + + case 0x7c: // bank 0 + m_bank0val = data & 0xf; + m_bank0->set_bank(m_bank0val); + break; + + case 0x7d: // bank 1 + m_bank1val = data & 0xf; + m_bank1->set_bank(m_bank1val); + break; + + case 0x7e: // bank 2 + m_bank2val = data & 0xf; + m_bank2->set_bank(m_bank2val); + break; + + case 0x7f: // bank 3 + m_bank3val = data & 0xf; + m_bank3->set_bank(m_bank3val); + break; + + default: + do_io(offset); + break; + } +} + +READ8_MEMBER( laser3k_state::io2_r ) +{ + switch (offset) + { + case 0xc2: // h-blank status + return space.machine().first_screen()->hblank() ? 0x80 : 0x00; + + case 0xc3: // v-blank status + return space.machine().first_screen()->vblank() ? 0x80 : 0x00; + + case 0xc5: // CPU 1/2 MHz status? + return 0x00; + + default: + printf("io2_r @ unknown %x\n", offset); + break; + } + + return 0xff; +} + +void laser3k_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, + const UINT8 *textgfx_data, UINT32 textgfx_datalen) +{ + int x, y, i; + int fg = m_fg_color; + int bg = m_bg_color; + const UINT8 *chardata; + UINT16 color; + + /* look up the character data */ + chardata = &textgfx_data[(code * 8) % textgfx_datalen]; + + if (m_flash && (code >= 0x40) && (code <= 0x7f)) + { + /* we're flashing; swap */ + i = fg; + fg = bg; + bg = i; + } + + for (y = 0; y < 8; y++) + { + for (x = 0; x < 7; x++) + { + color = (chardata[y] & (1 << (6-x))) ? fg : bg; + + for (i = 0; i < xscale; i++) + { + bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + } + } + } +} + +void laser3k_state::text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + int row, col; + UINT32 start_address; + UINT32 address; + UINT8 *m_a2_videoram = m_ram->pointer(); + + if (m_80col) + { + start_address = (m_disp_page == 0) ? 0x1000 : 0x1800; + } + else + { + start_address = (m_disp_page == 0) ? 0x400 : 0x800; + } + + m_flash = ((machine().time() * 4).seconds() & 1) ? 1 : 0; + + beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); + endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + + for (row = beginrow; row <= endrow; row += 8) + { + if (m_80col) + { + for (col = 0; col < 40; col++) + { + /* calculate address */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + + plot_text_character(bitmap, col * 7, row, 1, m_a2_videoram[address], + memregion("gfx1")->base(), memregion("gfx1")->bytes()); + plot_text_character(bitmap, (col + 40) * 7, row, 1, m_a2_videoram[address+0x400], + memregion("gfx1")->base(), memregion("gfx1")->bytes()); + } + } + else + { + for (col = 0; col < 40; col++) + { + /* calculate address */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + plot_text_character(bitmap, col * 14, row, 2, m_a2_videoram[address], + memregion("gfx1")->base(), memregion("gfx1")->bytes()); + } + } + } +} + +void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + const UINT8 *vram; + int row, col, b; + int offset; + UINT8 vram_row[42] ; + UINT16 v; + UINT16 *p; + UINT32 w; + UINT16 *artifact_map_ptr; + + /* sanity checks */ + if (beginrow < cliprect.min_y) + beginrow = cliprect.min_y; + if (endrow > cliprect.max_y) + endrow = cliprect.max_y; + if (endrow < beginrow) + return; + + vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + + vram_row[0] = 0; + vram_row[41] = 0; + + for (row = beginrow; row <= endrow; row++) + { + for (col = 0; col < 40; col++) + { + offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + vram_row[1+col] = vram[offset]; + } + + p = &bitmap.pix16(row); + + for (col = 0; col < 40; col++) + { + w = (((UINT32) vram_row[col+0] & 0x7f) << 0) + | (((UINT32) vram_row[col+1] & 0x7f) << 7) + | (((UINT32) vram_row[col+2] & 0x7f) << 14); + + artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; + for (b = 0; b < 7; b++) + { + v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + *(p++) = v; + *(p++) = v; + } + } + } +} + +void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + const UINT8 *vram; + int row, col, b; + int offset; + UINT8 vram_row[82]; + UINT16 v; + UINT16 *p; + UINT32 w; + + /* sanity checks */ + if (beginrow < cliprect.min_y) + beginrow = cliprect.min_y; + if (endrow > cliprect.max_y) + endrow = cliprect.max_y; + if (endrow < beginrow) + return; + + vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + + vram_row[0] = 0; + vram_row[81] = 0; + + for (row = beginrow; row <= endrow; row++) + { + for (col = 0; col < 40; col++) + { + offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + if (col < 40) + { + vram_row[1+(col*2)+0] = vram[offset]; + vram_row[1+(col*2)+1] = vram[offset+1]; + } + else + { + vram_row[1+(col*2)+0] = vram[offset+0x2000]; + vram_row[1+(col*2)+1] = vram[offset+0x2001]; + } + } + + p = &bitmap.pix16(row); + + for (col = 0; col < 80; col++) + { + w = (((UINT32) vram_row[col+0] & 0x7f) << 0) + | (((UINT32) vram_row[col+1] & 0x7f) << 7) + | (((UINT32) vram_row[col+2] & 0x7f) << 14); + + for (b = 0; b < 7; b++) + { + v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; + *(p++) = v; + } + } + } +} + +UINT32 laser3k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + switch (m_gfxmode) + { + case TEXT: + text_update(screen, bitmap, cliprect, 0, 191); + break; + + case HIRES: + if (m_mix) + { + hgr_update(screen, bitmap, cliprect, 0, 159); + text_update(screen, bitmap, cliprect, 160, 191); + } + else + { + hgr_update(screen, bitmap, cliprect, 0, 191); + } + break; + + case RGB: + break; + + case DHIRES: + if (m_mix) + { + dhgr_update(screen, bitmap, cliprect, 0, 159); + text_update(screen, bitmap, cliprect, 160, 191); + } + else + { + dhgr_update(screen, bitmap, cliprect, 0, 191); + } + break; + } + + return 0; +} + +READ_LINE_MEMBER(laser3k_state::ay3600_shift_r) +{ + // either shift key + if (m_kbspecial->read() & 0x06) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +READ_LINE_MEMBER(laser3k_state::ay3600_control_r) +{ + if (m_kbspecial->read() & 0x08) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +static const UINT8 key_remap[0x32][4] = +{ +/* norm shft ctrl both */ + { 0x33,0x23,0x33,0x23 }, /* 3 # 00 */ + { 0x34,0x24,0x34,0x24 }, /* 4 $ 01 */ + { 0x35,0x25,0x35,0x25 }, /* 5 % 02 */ + { 0x36,0x5e,0x35,0x53 }, /* 6 ^ 03 */ + { 0x37,0x26,0x37,0x26 }, /* 7 & 04 */ + { 0x38,0x2a,0x38,0x2a }, /* 8 * 05 */ + { 0x39,0x28,0x39,0x28 }, /* 9 ( 06 */ + { 0x30,0x29,0x30,0x29 }, /* 0 ) 07 */ + { 0x3b,0x3a,0x3b,0x3a }, /* ; : 08 */ + { 0x2d,0x5f,0x2d,0x1f }, /* - _ 09 */ + { 0x51,0x51,0x11,0x11 }, /* q Q 0a */ + { 0x57,0x57,0x17,0x17 }, /* w W 0b */ + { 0x45,0x45,0x05,0x05 }, /* e E 0c */ + { 0x52,0x52,0x12,0x12 }, /* r R 0d */ + { 0x54,0x54,0x14,0x14 }, /* t T 0e */ + { 0x59,0x59,0x19,0x19 }, /* y Y 0f */ + { 0x55,0x55,0x15,0x15 }, /* u U 10 */ + { 0x49,0x49,0x09,0x09 }, /* i I 11 */ + { 0x4f,0x4f,0x0f,0x0f }, /* o O 12 */ + { 0x50,0x50,0x10,0x10 }, /* p P 13 */ + { 0x44,0x44,0x04,0x04 }, /* d D 14 */ + { 0x46,0x46,0x06,0x06 }, /* f F 15 */ + { 0x47,0x47,0x07,0x07 }, /* g G 16 */ + { 0x48,0x48,0x08,0x08 }, /* h H 17 */ + { 0x4a,0x4a,0x0a,0x0a }, /* j J 18 */ + { 0x4b,0x4b,0x0b,0x0b }, /* k K 19 */ + { 0x4c,0x4c,0x0c,0x0c }, /* l L 1a */ + { 0x3d,0x2b,0x3d,0x2b }, /* = + 1b */ + { 0x08,0x08,0x08,0x08 }, /* Left 1c */ + { 0x15,0x15,0x15,0x15 }, /* Right 1d */ + { 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */ + { 0x58,0x58,0x18,0x18 }, /* x X 1f */ + { 0x43,0x43,0x03,0x03 }, /* c C 20 */ + { 0x56,0x56,0x16,0x16 }, /* v V 21 */ + { 0x42,0x42,0x02,0x02 }, /* b B 22 */ + { 0x4e,0x4e,0x0e,0x0e }, /* n N 23 */ + { 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */ + { 0x2c,0x3c,0x2c,0x3c }, /* , < 25 */ + { 0x2e,0x3e,0x2e,0x3e }, /* . > 26 */ + { 0x2f,0x3f,0x2f,0x3f }, /* / ? 27 */ + { 0x53,0x53,0x13,0x13 }, /* s S 28 */ + { 0x32,0x40,0x32,0x00 }, /* 2 @ 29 */ + { 0x31,0x21,0x31,0x31 }, /* 1 ! 2a */ + { 0x9b,0x9b,0x9b,0x9b }, /* Escape 2b */ + { 0x41,0x41,0x01,0x01 }, /* a A 2c */ + { 0x20,0x20,0x20,0x20 }, /* Space 2d */ + { 0x27,0x22,0x27,0x22 }, /* ' " 2e */ + { 0x00,0x00,0x00,0x00 }, /* 0x2f unused */ + { 0x00,0x00,0x00,0x00 }, /* 0x30 unused */ + { 0x0d,0x0d,0x0d,0x0d }, /* Enter 31 */ +}; + +WRITE_LINE_MEMBER(laser3k_state::ay3600_data_ready_w) +{ + if (state == ASSERT_LINE) + { + int mod = 0; + m_lastchar = m_ay3600->b_r(); + + mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; + mod |= (m_kbspecial->read() & 0x08) ? 0x02 : 0x00; + +// printf("lastchar = %02x\n", m_lastchar & 0x3f); + + m_transchar = key_remap[m_lastchar&0x3f][mod]; + + if (m_transchar != 0) + { + m_strobe = 0x80; +// printf("new char = %04x (%02x)\n", m_lastchar&0x3f, m_transchar); + } + } +} + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( laser3k ) + PORT_START("X0") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + + PORT_START("X1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + + PORT_START("X2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + + PORT_START("X3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("X4") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("X5") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("X6") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("X7") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("X8") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) +INPUT_PORTS_END + +// this is an apple II palette; it seems more likely the +// actual laser3000 has a digital RGB palette... +static const rgb_t laser3k_palette[] = +{ + rgb_t::black, + rgb_t(0xE3, 0x1E, 0x60), /* Dark Red */ + rgb_t(0x60, 0x4E, 0xBD), /* Dark Blue */ + rgb_t(0xFF, 0x44, 0xFD), /* Purple */ + rgb_t(0x00, 0xA3, 0x60), /* Dark Green */ + rgb_t(0x9C, 0x9C, 0x9C), /* Dark Gray */ + rgb_t(0x14, 0xCF, 0xFD), /* Medium Blue */ + rgb_t(0xD0, 0xC3, 0xFF), /* Light Blue */ + rgb_t(0x60, 0x72, 0x03), /* Brown */ + rgb_t(0xFF, 0x6A, 0x3C), /* Orange */ + rgb_t(0x9C, 0x9C, 0x9C), /* Light Grey */ + rgb_t(0xFF, 0xA0, 0xD0), /* Pink */ + rgb_t(0x14, 0xF5, 0x3C), /* Light Green */ + rgb_t(0xD0, 0xDD, 0x8D), /* Yellow */ + rgb_t(0x72, 0xFF, 0xD0), /* Aquamarine */ + rgb_t(0xFF, 0xFF, 0xFF) /* White */ +}; + +/* Initialize the palette */ +PALETTE_INIT_MEMBER(laser3k_state, laser3k) +{ + palette.set_pen_colors(0, laser3k_palette, ARRAY_LENGTH(laser3k_palette)); +} + +static MACHINE_CONFIG_START( laser3k, laser3k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 1021800) + MCFG_CPU_PROGRAM_MAP(laser3k_map) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(300*2, 192) + MCFG_SCREEN_VISIBLE_AREA(0, (280*2)-1,0,192-1) + MCFG_SCREEN_UPDATE_DRIVER(laser3k_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(laser3k_palette)) + MCFG_PALETTE_INIT_OWNER(laser3k_state, laser3k) + + /* memory banking */ + MCFG_DEVICE_ADD("bank0", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(banks_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(banks_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + MCFG_DEVICE_ADD("bank2", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(banks_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + MCFG_DEVICE_ADD("bank3", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(banks_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_RAM_ADD("mainram") + MCFG_RAM_DEFAULT_SIZE("192K") + + /* the 8048 isn't dumped, so substitute modified real Apple II h/w */ + MCFG_DEVICE_ADD("ay3600", AY3600, 0) + MCFG_AY3600_MATRIX_X0(IOPORT("X0")) + MCFG_AY3600_MATRIX_X1(IOPORT("X1")) + MCFG_AY3600_MATRIX_X2(IOPORT("X2")) + MCFG_AY3600_MATRIX_X3(IOPORT("X3")) + MCFG_AY3600_MATRIX_X4(IOPORT("X4")) + MCFG_AY3600_MATRIX_X5(IOPORT("X5")) + MCFG_AY3600_MATRIX_X6(IOPORT("X6")) + MCFG_AY3600_MATRIX_X7(IOPORT("X7")) + MCFG_AY3600_MATRIX_X8(IOPORT("X8")) + MCFG_AY3600_SHIFT_CB(READLINE(laser3k_state, ay3600_shift_r)) + MCFG_AY3600_CONTROL_CB(READLINE(laser3k_state, ay3600_control_r)) + MCFG_AY3600_DATA_READY_CB(WRITELINE(laser3k_state, ay3600_data_ready_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_ADD("sn76489", SN76489, 1020484) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + +ROM_START(las3000) + ROM_REGION(0x0800,"gfx1",0) + ROM_LOAD ( "341-0036.chr", 0x0000, 0x0800, CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) + + ROM_REGION(0x8000, "maincpu", 0) + ROM_LOAD ( "las3000.rom", 0x0000, 0x8000, CRC(9c7aeb09) SHA1(3302adf41e258cf50210c19736948c8fa65e91de)) + + ROM_REGION(0x100, "fdc", 0) + ROM_LOAD ( "l3kdisk.rom", 0x0000, 0x0100, CRC(2d4b1584) SHA1(989780b77e100598124df7b72663e5a31a3339c0)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1983, las3000, 0, 0, laser3k, laser3k, driver_device, 0, "Video Technology", "Laser 3000", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/lc80.c b/src/mame/drivers/lc80.c new file mode 100644 index 00000000000..046bd69af0e --- /dev/null +++ b/src/mame/drivers/lc80.c @@ -0,0 +1,441 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + LC-80 + + 12/05/2009 Skeleton driver. + + When first started, the screen is blank. Wait about 8 seconds for + it to introduce itself, then you may use it or paste to it. + The decimal points indicate which side of the display you will + be updating. + + Pasting: + 0-F : as is + + (inc) : ^ + - (dec) : V + ADR : - + DAT : = + GO : X + + Test Paste: (lc80_2 only) + -2000=11^22^33^44^55^66^77^88^99^-2000 + Now press up-arrow to confirm the data has been entered. + + + ToDo: + - Most characters are lost when pasting (lc80, sc80). + +****************************************************************************/ + +/* + + TODO: + + - HALT led + - KSD11 switch + - banking for ROM 4-5 + - Schachcomputer SC-80 + - CTC clock inputs + +*/ + +#include "includes/lc80.h" +#include "lc80.lh" + +/* Memory Maps */ + +static ADDRESS_MAP_START( lc80_mem, AS_PROGRAM, 8, lc80_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x07ff) AM_ROMBANK("bank1") + AM_RANGE(0x0800, 0x0fff) AM_ROMBANK("bank2") + AM_RANGE(0x1000, 0x17ff) AM_ROMBANK("bank3") + AM_RANGE(0x2000, 0x23ff) AM_RAM + AM_RANGE(0x2400, 0x2fff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +#if 0 +static ADDRESS_MAP_START( sc80_mem, AS_PROGRAM, 8, lc80_state ) + AM_IMPORT_FROM(lc80_mem) + AM_RANGE(0xc000, 0xcfff) AM_ROM +ADDRESS_MAP_END +#endif + +static ADDRESS_MAP_START( lc80_io, AS_IO, 8, lc80_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1f) + AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_device, read, write) + AM_RANGE(0xf8, 0xfb) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_device, read, write) + AM_RANGE(0xec, 0xef) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( lc80_state::trigger_reset ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER( lc80_state::trigger_nmi ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( lc80 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LD") PORT_CODE(KEYCODE_L) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ST") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DAT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EX") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ADR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RES") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, lc80_state, trigger_reset, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NMI") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, lc80_state, trigger_nmi, 0) +INPUT_PORTS_END + +/* Z80-CTC Interface */ + +WRITE_LINE_MEMBER( lc80_state::ctc_z0_w ) +{ +} + +WRITE_LINE_MEMBER( lc80_state::ctc_z1_w ) +{ +} + +WRITE_LINE_MEMBER( lc80_state::ctc_z2_w ) +{ +} + +/* Z80-PIO Interface */ + +void lc80_state::update_display() +{ + int i; + + for (i = 0; i < 6; i++) + { + if (!BIT(m_digit, i)) output_set_digit_value(5 - i, m_segment); + } +} + +WRITE8_MEMBER( lc80_state::pio1_pa_w ) +{ + /* + + bit description + + PA0 VQE23 segment B + PA1 VQE23 segment F + PA2 VQE23 segment A + PA3 VQE23 segment G + PA4 VQE23 segment DP + PA5 VQE23 segment C + PA6 VQE23 segment E + PA7 VQE23 segment D + + */ + + m_segment = BITSWAP8(~data, 4, 3, 1, 6, 7, 5, 0, 2); + + update_display(); +} + +READ8_MEMBER( lc80_state::pio1_pb_r ) +{ + /* + + bit description + + PB0 tape input + PB1 tape output + PB2 digit 0 + PB3 digit 1 + PB4 digit 2 + PB5 digit 3 + PB6 digit 4 + PB7 digit 5 + + */ + + return (m_cassette->input() < +0.0); +} + +WRITE8_MEMBER( lc80_state::pio1_pb_w ) +{ + /* + + bit description + + PB0 tape input + PB1 tape output, speaker output, OUT led + PB2 digit 0 + PB3 digit 1 + PB4 digit 2 + PB5 digit 3 + PB6 digit 4 + PB7 digit 5 + + */ + + /* tape output */ + m_cassette->output( BIT(data, 1) ? +1.0 : -1.0); + + /* speaker */ + m_speaker->level_w(!BIT(data, 1)); + + /* OUT led */ + output_set_led_value(0, !BIT(data, 1)); + + /* keyboard */ + m_digit = data >> 2; + + /* display */ + update_display(); +} + +READ8_MEMBER( lc80_state::pio2_pb_r ) +{ + /* + + bit description + + PB0 + PB1 + PB2 + PB3 + PB4 key row 0 + PB5 key row 1 + PB6 key row 2 + PB7 key row 3 + + */ + + UINT8 data = 0xf0; + int i; + + for (i = 0; i < 6; i++) + { + if (!BIT(m_digit, i)) + { + if (!BIT(m_y0->read(), i)) data &= ~0x10; + if (!BIT(m_y1->read(), i)) data &= ~0x20; + if (!BIT(m_y2->read(), i)) data &= ~0x40; + if (!BIT(m_y3->read(), i)) data &= ~0x80; + } + } + + return data; +} + +#if 0 +/* Z80 Daisy Chain */ + +static const z80_daisy_config lc80_daisy_chain[] = +{ + { Z80CTC_TAG }, + { Z80PIO2_TAG }, + { Z80PIO1_TAG }, + { NULL } +}; +#endif + +/* Machine Initialization */ + +void lc80_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + UINT8 *ROM = memregion(Z80_TAG)->base(); + + /* setup memory banking */ + membank("bank1")->configure_entry(0, &ROM[0]); // TODO + membank("bank1")->configure_entry(1, &ROM[0]); + membank("bank1")->set_entry(1); + + membank("bank2")->configure_entry(0, &ROM[0x800]); // TODO + membank("bank2")->configure_entry(1, &ROM[0x800]); + membank("bank2")->set_entry(1); + + membank("bank3")->configure_entry(0, &ROM[0x1000]); // TODO + membank("bank3")->configure_entry(1, &ROM[0x1000]); + membank("bank3")->set_entry(1); + + membank("bank4")->configure_entry(0, &ROM[0x2000]); + membank("bank4")->set_entry(0); + + program.install_readwrite_bank(0x0000, 0x07ff, "bank1"); + program.install_readwrite_bank(0x0800, 0x0fff, "bank2"); + program.install_readwrite_bank(0x1000, 0x17ff, "bank3"); + + switch (m_ram->size()) + { + case 1*1024: + program.install_readwrite_bank(0x2000, 0x23ff, "bank4"); + program.unmap_readwrite(0x2400, 0x2fff); + break; + + case 2*1024: + program.install_readwrite_bank(0x2000, 0x27ff, "bank4"); + program.unmap_readwrite(0x2800, 0x2fff); + break; + + case 3*1024: + program.install_readwrite_bank(0x2000, 0x2bff, "bank4"); + program.unmap_readwrite(0x2c00, 0x2fff); + break; + + case 4*1024: + program.install_readwrite_bank(0x2000, 0x2fff, "bank4"); + break; + } + + /* register for state saving */ + save_item(NAME(m_digit)); + save_item(NAME(m_segment)); +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( lc80, lc80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 900000) /* UD880D */ + MCFG_CPU_PROGRAM_MAP(lc80_mem) + MCFG_CPU_IO_MAP(lc80_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_lc80 ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 900000) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(lc80_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(lc80_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(lc80_state, ctc_z2_w)) + + MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, 900000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(lc80_state, pio1_pa_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(lc80_state, pio1_pb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(lc80_state, pio1_pb_w)) + + MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, 900000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PB_CB(READ8(lc80_state, pio2_pb_r)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") + MCFG_RAM_EXTRA_OPTIONS("2K,3K,4K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( lc80_2, lc80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 1800000) /* UD880D */ + MCFG_CPU_PROGRAM_MAP(lc80_mem) + MCFG_CPU_IO_MAP(lc80_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_lc80 ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 900000) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(lc80_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(lc80_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(lc80_state, ctc_z2_w)) + + MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, 900000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(lc80_state, pio1_pa_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(lc80_state, pio1_pb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(lc80_state, pio1_pb_w)) + + MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, 900000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PB_CB(READ8(lc80_state, pio2_pb_r)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") +MACHINE_CONFIG_END + +#if 0 +static MACHINE_CONFIG_DERIVED( sc80, lc80_2 ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY(Z80_TAG) + MCFG_CPU_PROGRAM_MAP(sc80_mem) +MACHINE_CONFIG_END +#endif + +/* ROMs */ + +ROM_START( lc80 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "u505", "LC 80 (2x U505)" ) + ROMX_LOAD( "lc80.d202", 0x0000, 0x0400, CRC(e754ef53) SHA1(044440b13e62addbc3f6a77369cfd16f99b39752), ROM_BIOS(1) ) + ROMX_LOAD( "lc80.d203", 0x0800, 0x0400, CRC(2b544da1) SHA1(3a6cbd0c57c38eadb7055dca4b396c348567d1d5), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "2716", "LC 80 (2716)" ) + ROMX_LOAD( "lc80_2716.bin", 0x0000, 0x0800, CRC(b3025934) SHA1(6fff953f0f1eee829fd774366313ab7e8053468c), ROM_BIOS(2)) +ROM_END + +ROM_START( lc80_2 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "lc80_2.bin", 0x0000, 0x1000, CRC(2e06d768) SHA1(d9cddaf847831e4ab21854c0f895348b7fda20b8) ) +ROM_END + +ROM_START( sc80 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "lc80e-0000-schach.rom", 0x0000, 0x1000, CRC(e3cca61d) SHA1(f2be3f2a9d3780d59657e49b3abeffb0fc13db89) ) + ROM_LOAD( "lc80e-1000-schach.rom", 0x1000, 0x1000, CRC(b0323160) SHA1(0ea019b0944736ae5b842bf9aa3537300f259b98) ) + ROM_LOAD( "lc80e-c000-schach.rom", 0xc000, 0x1000, CRC(9c858d9c) SHA1(2f7b3fd046c965185606253f6cd9372da289ca6f) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, lc80, 0, 0, lc80, lc80, driver_device, 0, "VEB Mikroelektronik", "Lerncomputer LC 80", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, lc80_2, lc80, 0, lc80_2, lc80, driver_device, 0, "VEB Mikroelektronik", "Lerncomputer LC 80.2", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, sc80, lc80, 0, lc80_2, lc80, driver_device, 0, "VEB Mikroelektronik", "Schachcomputer SC-80", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/lcmate2.c b/src/mame/drivers/lcmate2.c new file mode 100644 index 00000000000..b4ef3350601 --- /dev/null +++ b/src/mame/drivers/lcmate2.c @@ -0,0 +1,268 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco, Robbbert +/*************************************************************************** + + Laser Compumate2 + + 17/04/2011 Initial driver by Robbbert, using info supplied by + DMEnduro. He owns one of these machines. + 21/04/2011 Hooked up the lcd controller and added keyboard + input. [Sandro Ronco] + 22/04/2011 Small adjustments resulting from team investigations. + + Chips: Z80 CPU, 8K of RAM, 32K ROM, 'VTCL', '8826KX', + RP5C15 RTC. + + Display: 2 lines of 20 characters LCD. + + There are no devices for file saving or loading, is more of + a PDA format with all programs (address book, etc) in the ROM. + + Sound: a piezo speaker. + + ToDo: + - RTC doesn't remember the time + - Alarm doesn't work + - Reset/On button to be added + - The ROM has INT and NMI code; investigate if something uses it. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/rp5c15.h" +#include "machine/nvram.h" +#include "video/hd44780.h" +#include "sound/speaker.h" +#include "rendlay.h" + + +class lcmate2_state : public driver_device +{ +public: + lcmate2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_lcdc(*this, "hd44780"), + m_rtc(*this, "rtc"), + m_speaker(*this, "speaker") + { } + + required_device m_maincpu; + required_device m_lcdc; + required_device m_rtc; + required_device m_speaker; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( key_r ); + DECLARE_WRITE8_MEMBER( speaker_w ); + DECLARE_WRITE8_MEMBER( bankswitch_w ); + DECLARE_PALETTE_INIT(lcmate2); +}; + +WRITE8_MEMBER( lcmate2_state::speaker_w ) +{ + m_speaker->level_w(BIT(data, 6)); +} + +// offsets are FE,FD,FB,F7,EF,DF,BF,7F to scan a particular row, or 00 to check if any key pressed +READ8_MEMBER( lcmate2_state::key_r ) +{ + UINT8 i,data = 0xff; + char kbdrow[8]; + + for (i=0; i<8; i++) + { + if (BIT(offset, i)==0) + { + sprintf(kbdrow,"LINE%d", i); + data &= ioport(kbdrow)->read(); + } + } + + return data; +} + +WRITE8_MEMBER( lcmate2_state::bankswitch_w ) +{ + membank("rombank")->set_entry(data&0x0f); +} + +static ADDRESS_MAP_START(lcmate2_mem, AS_PROGRAM, 8, lcmate2_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x3fff ) AM_ROM + AM_RANGE( 0x4000, 0x7fff ) AM_ROMBANK("rombank") + AM_RANGE( 0x8000, 0x9fff ) AM_RAM AM_MIRROR(0x6000) AM_SHARE("nvram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(lcmate2_io, AS_IO, 8, lcmate2_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("rtc", rp5c15_device, read, write) + AM_RANGE(0x1000, 0x1000) AM_WRITE(speaker_w) + AM_RANGE(0x1fff, 0x1fff) AM_WRITE(bankswitch_w) + + AM_RANGE(0x3000, 0x3000) AM_DEVWRITE("hd44780", hd44780_device, control_write) + AM_RANGE(0x3001, 0x3001) AM_DEVWRITE("hd44780", hd44780_device, data_write) + AM_RANGE(0x3002, 0x3002) AM_DEVREAD("hd44780", hd44780_device, control_read) + AM_RANGE(0x3003, 0x3003) AM_DEVREAD("hd44780", hd44780_device, data_read) + + AM_RANGE(0x5000, 0x50ff) AM_READ(key_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( lcmate2 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('/') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('?') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLOck") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED +INPUT_PORTS_END + +PALETTE_INIT_MEMBER(lcmate2_state, lcmate2) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +void lcmate2_state::machine_start() +{ + membank("rombank")->configure_entries(0, 0x10, (UINT8*)memregion("maincpu")->base(), 0x4000); +} + +static const gfx_layout lcmate2_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( lcmate2 ) + GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, lcmate2_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( lcmate2, lcmate2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz) // confirmed + MCFG_CPU_PROGRAM_MAP(lcmate2_mem) + MCFG_CPU_IO_MAP(lcmate2_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_SIZE(120, 18) + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(lcmate2_state, lcmate2) + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", lcmate2) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 20) + + MCFG_NVRAM_ADD_0FILL("nvram") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("rtc", RP5C15, XTAL_32_768kHz) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( lcmate2 ) + ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "u2.bin", 0x00000, 0x08000, CRC(521931b9) SHA1(743a6e2928c4365fbf5ed9a173e2c1bfe695850f) ) + ROM_LOAD( "u3.bin", 0x20000, 0x20000, CRC(84fe767a) SHA1(8dd306f203e1220f0eab1a284be3095e2642c5b6) ) // spell library +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, lcmate2, 0, 0, lcmate2, lcmate2, driver_device, 0, "Vtech", "Laser Compumate 2", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/leapster.c b/src/mame/drivers/leapster.c new file mode 100644 index 00000000000..3a569ed71d2 --- /dev/null +++ b/src/mame/drivers/leapster.c @@ -0,0 +1,340 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/* + LeapFrog - Leapster + + educational system from 2003, software is all developed in MXFlash + + hwspecs + + + CPU: + Custom ASIC (ARCTangent 5.1 CPU @ 96MHz) + + Memory: + Leapster: 2MB onboard RAM, 256 bytes NVRAM. + Leapster2: 16MB RAM, 128kbytes NVRAM + + Media type: + Cartridges of 4-16MB with between 2 and 512kb NVRAM + + Graphics: + 4Mb ATI chip. + + Audio: + Custom + + Screen: + 160x160 CSTN with touchscreen. + + + The Leapster 2 also has + USB 1.1 (client only) + full-sized SD slot. + +*/ + +/* Cartridge pinout - for games list see hash/leapster.xml + +CARTRIDGE-PINOUT: +----------------- +Look at the Cartridge-Slot: + + B A + ------------ + VCC |01| VCC + NC |02| VSS + D11 |03| D04 + D03 |04| D12 + D10 |05| D05 + VSS |06| D02 + D13 |07| D09 + NC |08| NC + D06 |09| D01 + D14 |10| D08 + ----|--|---- + D07 |11| VSS + D00 |12| D15 + Byte |13| OE + NC |14| A22 + NC |15| A23 + CE |16| A16 + A00 |17| A15 + A01 |18| A14 + A02 |19| A13 + VSS |20| A03 + A12 |21| A04 + A11 |22| A05 + A10 |23| A06 + A09 |24| A07 + A08 |25| A17 + A19 |26| A18 + A20 |27| A21 + WE |28| VSS +PIN7 of 24LC02B <---| |29| |---> PIN7 of 24LC02B + NC |30| |---> PIN6 of 24LC02B + ---------- + + + + +PCB - Handheld-Console: + + +-----------------------------+ + | | + +------------| |------------+ + | | C A R T R I D G E - S L O T | | + | | | | + | +-----------------------------+ | + | | + |ASY 310-10069 +-------------------+ | + | | | | + | | | | + |LEAPSTER MAIN | | | + |Leap Frog | U3| | + |(c) 2004 +-------------------+ +-----+ | + | |ISSI | | + | | | | + | +---------+ |IS42S| | + | | | |16100| | + \ +-+ | EPOXY | |AT-7T| / + \ |A| | BLOCK | | | / + \ +-+ | | | U2| / + \ | U1| +-----+ / + \ +---------+ / + \ / + \ / + \ / + \ / + \ / + \ / + \ / + \ / + \ / + \-------------------------/ + + +A = 24LC02B / SN0429 + + + + +ETCHES ON THE BACK OF THE PCB: + +"FAB-300-10069-C" + +"702800254.01A" +"SW1208 Rev.5" + + + + + + + + +PCB - Cartridge: +FRONT: + ++-------------------------------------+ +| LEAPSTER ROM CARTRIDGE | +| +--+ +---------+ Leap Frog | +| |B1|U2 | | (c) 2003 | ++-+ +--+ |E P O X Y| +-+ + | | U3| | ++-+ +---------+ +-+ +| 20232-003-1020| +| ASY 310-10028 REV:00 | ++-+ +-+ +-+ + |||||||||||||||||||||| |||||||||||| + +--------------------+ +----------+ + A30 A01 + +B1: 24L002B + + + + +24L002B: + + +-----+ + (GND)<- A0-| |-VCC + (GND)<- A1-| |-WP + (GND)<- A2-| |-SCL + VSS-| |-SDA + +-----+ + + + + + +PCB - LEAPSTER-TV: + + + ++-----------------------------------------------------------------------+ +| | +| | +| 20300+003+0015 | + \ REV:06 / + | | + | | + | +----+ +-------+ | + \ | | | EPOXY | / + | +----+ | | | | | + | |EPOX| | | | | | + | |Y | | | | U1| +-+ | + \ +----+ | | +-------+ | | / + | | U2| +-+U4 | + | +----+ | + | +--------------+ ROADRUNNER CONSOLE | + \ | AM29PL160CB | Leap Frog (c) 2006/ + | | -90SF | Asy 310-10378 | + | | U6| | + | +--------------+ | + \ / + | +-----------------------------+ | + | | C A R T R I D G E - S L O T | | + | +-----------------------------+ | + \ / + +-----------------------------------------------+ + + + + + + + +*/ + +#include "emu.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "cpu/arcompact/arcompact.h" + + +class leapster_state : public driver_device +{ +public: + leapster_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot") + { } + + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update_leapster(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(leapster_cart); + DECLARE_DRIVER_INIT(leapster); + + DECLARE_READ32_MEMBER(leapster_random_r) + { + return rand() | (rand()<<16); // there is a loop checking that this is above a certain value + } + + DECLARE_WRITE32_MEMBER(leapster_aux004b_w) + { + printf("leapster_aux004b_w %04x\n", data); + } + +protected: + required_device m_maincpu; + required_device m_cart; + + memory_region *m_cart_rom; +}; + + + + +static INPUT_PORTS_START( leapster ) +INPUT_PORTS_END + + + +UINT32 leapster_state::screen_update_leapster(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +DEVICE_IMAGE_LOAD_MEMBER( leapster_state, leapster_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + m_cart->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +void leapster_state::machine_start() +{ + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + if (m_cart_rom) + { + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.install_readwrite_bank(0x80000000, 0x807fffff, "cartrom"); + membank("cartrom")->set_base(m_cart_rom->base()); + } +} + +void leapster_state::machine_reset() +{ +} + +static ADDRESS_MAP_START( leapster_map, AS_PROGRAM, 32, leapster_state ) + AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_MIRROR(0x40000000) // pointers in the bios region seem to be to the 40xxxxxx region, either we mirror there or something (real bios?) is acutally missing + AM_RANGE(0x0180D800, 0x0180D803) AM_READ(leapster_random_r) + AM_RANGE(0x03000000, 0x030007ff) AM_RAM // puts stack here, writes a pointer @ 0x03000000 on startup + AM_RANGE(0x3c000000, 0x3c1fffff) AM_RAM // really ram, or has our code execution gone wrong? +// AM_RANGE(0x80000000, 0x807fffff) AM_ROMBANK("cartrom") // game ROM pointers are all to the 80xxxxxx region, so I assume it maps here - installed if a cart is present +ADDRESS_MAP_END + +static ADDRESS_MAP_START( leapster_aux, AS_IO, 32, leapster_state ) + AM_RANGE(0x00000012c, 0x00000012f) AM_WRITE(leapster_aux004b_w) // this address isn't used by ARC internal stuff afaik, so probably leapster specific +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( leapster, leapster_state ) + /* basic machine hardware */ + // CPU is ArcTangent-A5 '5.1' (ARCompact core) + MCFG_CPU_ADD("maincpu", ARCA5, 96000000/10) + MCFG_CPU_PROGRAM_MAP(leapster_map) + MCFG_CPU_IO_MAP(leapster_aux) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(160, 160) + MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 160-1) + MCFG_SCREEN_UPDATE_DRIVER(leapster_state, screen_update_leapster) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "leapster_cart") + MCFG_GENERIC_EXTENSIONS("bin") + MCFG_GENERIC_LOAD(leapster_state, leapster_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "leapster") +MACHINE_CONFIG_END + +ROM_START(leapster) + ROM_REGION(0x200000, "maincpu", ROMREGION_ERASE00) + ROM_LOAD( "155-10072-a.bin", 0x00000, 0x200000, CRC(af05e5a0) SHA1(d4468d060543ba7e44785041093bc98bcd9afa07) ) +ROM_END + +ROM_START(leapstertv) + ROM_REGION(0x200000, "maincpu", ROMREGION_ERASE00) + ROM_LOAD( "am29pl160cb-90sf.bin", 0x00000, 0x200000, BAD_DUMP CRC(dc281f1f) SHA1(17588de54ab3bb82801bd5062f3e6aa687412178) ) +ROM_END + +DRIVER_INIT_MEMBER(leapster_state,leapster) +{ +} + +CONS(2003, leapster, 0, 0, leapster, leapster, leapster_state, leapster, "LeapFrog", "Leapster (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IS_SKELETON ) +CONS(2005, leapstertv, leapster, 0, leapster, leapster, leapster_state, leapster, "LeapFrog", "Leapster TV (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/lft.c b/src/mame/drivers/lft.c new file mode 100644 index 00000000000..2034ec9219d --- /dev/null +++ b/src/mame/drivers/lft.c @@ -0,0 +1,117 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +2013-09-09 Skeleton of LFT computer system. A search on the net produces + no finds. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i186.h" +#include "machine/terminal.h" + + +class lft_state : public driver_device +{ +public: + lft_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_terminal(*this, "terminal") + {} + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE16_MEMBER(term_w); + DECLARE_READ16_MEMBER(keyin_r); + DECLARE_READ16_MEMBER(status_r); + +private: + UINT8 m_term_data; + virtual void machine_reset(); + required_device m_maincpu; + required_device m_terminal; +}; + +static ADDRESS_MAP_START(lft_mem, AS_PROGRAM, 16, lft_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x5ffff) AM_RAM + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("roms", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(lft_io, AS_IO, 16, lft_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // screen 1 + AM_RANGE(0x00, 0x01) AM_READNOP + AM_RANGE(0x04, 0x05) AM_READWRITE(keyin_r,term_w) + // screen 2 + AM_RANGE(0x02, 0x03) AM_READNOP + AM_RANGE(0x06, 0x07) AM_WRITENOP +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( lft ) +INPUT_PORTS_END + +READ16_MEMBER( lft_state::keyin_r ) +{ + UINT16 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ16_MEMBER( lft_state::status_r ) +{ + return (m_term_data) ? 5 : 4; +} + +WRITE8_MEMBER( lft_state::kbd_put ) +{ + m_term_data = data; +} + +WRITE16_MEMBER( lft_state::term_w ) +{ + m_terminal->write(space, 0, data & 0x7f); // fix backspace +} + +void lft_state::machine_reset() +{ + m_term_data = 0; +} + +static MACHINE_CONFIG_START( lft, lft_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80186, 4000000) // no idea + MCFG_CPU_PROGRAM_MAP(lft_mem) + MCFG_CPU_IO_MAP(lft_io) + + /* video hardware */ + MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(lft_state, kbd_put)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( lft1230 ) + ROM_REGION(0x4000, "roms", 0) + ROM_LOAD16_BYTE( "1230lf29", 0x0000, 0x2000, CRC(11c87367) SHA1(0879650aa98e19a4e6ca7b6ee7874f81c9c8ccfa) ) + ROM_LOAD16_BYTE( "1230lf42", 0x0001, 0x2000, CRC(ab82b620) SHA1(8c7d93950703f348e5ce0f9e376d157dd6098c6a) ) +ROM_END + +ROM_START( lft1510 ) + ROM_REGION(0x4000, "roms", 0) + ROM_LOAD16_BYTE( "1510lfev", 0x2000, 0x1000, CRC(47dbb290) SHA1(b557e9a54a30d9a16edfdef4a6b12a5393d30bf3) ) + ROM_IGNORE(0x1000) + ROM_LOAD16_BYTE( "1510lfod", 0x2001, 0x1000, CRC(ba8c23fc) SHA1(d4b82f69fccd653b31e7bd05ee884b323ff0007b) ) + ROM_IGNORE(0x1000) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( ????, lft1510, 0, 0, lft, lft, driver_device, 0, "LFT", "LFT 1510", MACHINE_IS_SKELETON) +COMP( ????, lft1230, lft1510, 0, lft, lft, driver_device, 0, "LFT", "LFT 1230", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/lg-dvd.c b/src/mame/drivers/lg-dvd.c new file mode 100644 index 00000000000..0ea3c2ad14a --- /dev/null +++ b/src/mame/drivers/lg-dvd.c @@ -0,0 +1,41 @@ +/* + Rather skeleton driver for a LG GP40NW10 usb dvd writer. + + Main cpu, a MT1839, seems to be a mcs51 variant. +*/ + +#include "emu.h" +#include "debugger.h" +#include "cpu/mcs51/mcs51.h" + +class lg_dvd_state : public driver_device { +public: + lg_dvd_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + maincpu(*this, "maincpu") + { } + + required_device maincpu; +}; + +static INPUT_PORTS_START( lg ) +INPUT_PORTS_END + +static ADDRESS_MAP_START( lg_dvd_map, AS_PROGRAM, 8, lg_dvd_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( lg, lg_dvd_state ) + MCFG_CPU_ADD( "maincpu", I80C52, XTAL_16MHz ) + MCFG_CPU_PROGRAM_MAP( lg_dvd_map ) +MACHINE_CONFIG_END + +ROM_START( lggp40 ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "bios0", "1.00" ) + ROMX_LOAD( "firm-1.00.bin", 0x000000, 0x100000, CRC(c7f24f3b) SHA1(c2ce96c02ab419fb7e0b38703cdaeeccb2b7f34b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "bios1", "1.01" ) + ROMX_LOAD( "firm-1.01.bin", 0x000000, 0x100000, CRC(28820e0c) SHA1(c5f2c1e14e6cff2e57c5196cabcebfaaff7284ce), ROM_BIOS(2) ) +ROM_END + +SYST( 2011, lggp40, 0, 0, lg, lg, driver_device, 0, "LG", "GP40NW10 dvd writer", MACHINE_NOT_WORKING|MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/lisa.c b/src/mame/drivers/lisa.c new file mode 100644 index 00000000000..d496742cd8d --- /dev/null +++ b/src/mame/drivers/lisa.c @@ -0,0 +1,486 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/********************************************************************* + + drivers/lisa.c + + Experimental LISA driver + + Raphael Nabet, 2000 + +*********************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6504.h" +#include "cpu/cop400/cop400.h" +#include "includes/lisa.h" +#include "formats/ap_dsk35.h" + + +/*************************************************************************** + ADDRESS MAP +***************************************************************************/ + +static ADDRESS_MAP_START(lisa_map, AS_PROGRAM, 16, lisa_state ) + AM_RANGE(0x000000, 0xffffff) AM_READWRITE(lisa_r, lisa_w) /* no fixed map, we use an MMU */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(lisa_fdc_map, AS_PROGRAM, 8, lisa_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) // only 8k of address space + AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("fdc_ram") /* RAM (shared with 68000) */ + AM_RANGE(0x0400, 0x07ff) AM_READWRITE(lisa_fdc_io_r, lisa_fdc_io_w) /* disk controller (IWM and TTL logic) */ + AM_RANGE(0x0800, 0x0fff) AM_NOP + AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("fdccpu", 0x1000) AM_SHARE("fdc_rom") /* ROM */ + AM_RANGE(0x2000, 0xffff) AM_READWRITE(lisa_fdc_r, lisa_fdc_w) /* handler for wrap-around */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(lisa210_fdc_map, AS_PROGRAM, 8, lisa_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) // only 8k of address space + AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("fdc_ram") /* RAM (shared with 68000) */ + AM_RANGE(0x0400, 0x07ff) AM_NOP /* nothing, or RAM wrap-around ??? */ + AM_RANGE(0x0800, 0x0bff) AM_READWRITE(lisa_fdc_io_r, lisa_fdc_io_w) /* disk controller (IWM and TTL logic) */ + AM_RANGE(0x0c00, 0x0fff) AM_NOP /* nothing, or IO port wrap-around ??? */ + AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("fdccpu", 0x1000) AM_SHARE("fdc_rom") /* ROM */ + AM_RANGE(0x2000, 0xffff) AM_READWRITE(lisa_fdc_r, lisa_fdc_w) /* handler for wrap-around */ +ADDRESS_MAP_END + + + +/*************************************************************************** + DEVICE CONFIG +***************************************************************************/ + +static void lisa2_set_iwm_enable_lines(device_t *device,int enable_mask) +{ + /* E1 & E2 is connected to the Sony SEL line (?) */ + /*logerror("new sel line state %d\n", (enable_mask) ? 0 : 1);*/ + sony_set_sel_line(device,(enable_mask) ? 0 : 1); +} + +static void lisa210_set_iwm_enable_lines(device_t *device,int enable_mask) +{ + /* E2 is connected to the Sony enable line (?) */ + sony_set_enable_lines(device,enable_mask >> 1); +} + +static const applefdc_interface lisa2_fdc_interface = +{ + sony_set_lines, + lisa2_set_iwm_enable_lines, + + sony_read_data, + sony_write_data, + sony_read_status +}; + +static const applefdc_interface lisa210_fdc_interface = +{ + sony_set_lines, + lisa210_set_iwm_enable_lines, + + sony_read_data, + sony_write_data, + sony_read_status +}; + +static const floppy_interface lisa_floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple35_mac), + "floppy_5_25" +}; + +/*************************************************************************** + MACHINE DRIVER +***************************************************************************/ + +/* Lisa1 and Lisa 2 machine */ +static MACHINE_CONFIG_START( lisa, lisa_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 5093760) /* 20.37504 MHz / 4 */ + MCFG_CPU_PROGRAM_MAP(lisa_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", lisa_state, lisa_interrupt) + + MCFG_CPU_ADD(COP421_TAG, COP421, 3900000) + MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) + + MCFG_CPU_ADD(KB_COP421_TAG, COP421, 3900000) // ? + MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) + + MCFG_CPU_ADD("fdccpu", M6504, 2000000) /* 16.000 MHz / 8 in when DIS asserted, 16.000 MHz / 9 otherwise (?) */ + MCFG_CPU_PROGRAM_MAP(lisa_fdc_map) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(880, 380) + MCFG_SCREEN_VISIBLE_AREA(0, 720-1, 0, 364-1) + MCFG_SCREEN_UPDATE_DRIVER(lisa_state, screen_update_lisa) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* nvram */ + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", lisa_state, nvram_init) + + /* devices */ + MCFG_IWM_ADD("fdc", lisa2_fdc_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(lisa_floppy_interface) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","lisa") + + /* via */ + MCFG_DEVICE_ADD("via6522_0", VIA6522, 500000) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(lisa_state, COPS_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(lisa_state, COPS_via_out_b)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(lisa_state, COPS_via_out_ca2)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(lisa_state, COPS_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(lisa_state, COPS_via_irq_func)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 500000) + + MCFG_DEVICE_ADD("scc", SCC8530, 7833600) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( lisa210, lisa ) + MCFG_CPU_MODIFY( "fdccpu" ) + MCFG_CPU_PROGRAM_MAP(lisa210_fdc_map) + + /* Lisa 2/10 and MacXL had a slightly different FDC interface */ + MCFG_IWM_MODIFY("fdc", lisa210_fdc_interface) + + /* via */ + MCFG_DEVICE_MODIFY("via6522_0") + MCFG_DEVICE_CLOCK(1250000) + MCFG_DEVICE_MODIFY("via6522_1") + MCFG_DEVICE_CLOCK(1250000) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( macxl, lisa210 ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE( 768/* ???? */, 447/* ???? */) + MCFG_SCREEN_VISIBLE_AREA(0, 608-1, 0, 431-1) +MACHINE_CONFIG_END + +/* 2008-05 FP: +Small note about natural keyboard support: currently, +- "Clear" (on the Keypad) is mapped to 'F1' +- "Enter" (different from Return) is mapped to 'F2' +- "Keypad ," is currently unmapped */ + +static INPUT_PORTS_START( lisa ) + PORT_START("MOUSE_X") /* Mouse - X AXIS */ + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START("MOUSE_Y") /* Mouse - Y AXIS */ + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + /* pseudo-input ports with keyboard layout (based on pictures) */ + PORT_START("LINE0") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") + + PORT_START("LINE1") + PORT_BIT(0xFFFF, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE2") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad ,") // this one would be between '+' and 'Enter' on a modern keypad. + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + + PORT_START("LINE3") + PORT_BIT(0xFFFF, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE4") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') // this one would be 2nd row, 3rd key from 'P' +#if 1 + /* US layout */ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNUSED) +#else + /* European layout */ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~ `") PORT_CODE(KEYCODE_BACKSLASH2) + /* 2008-05 FP: Differences in European Layout (based on a couple of pictures found in the web): + - at KEYCODE_ESC, "` ~" is replaced by "? #" + - Shift + 3 gives the pound symbol (\xC2\xA3) + - There is no "\ |" key after "] }" + - There is an additional key at 3rd row, 3rd key from 'L', and it's "` ~" + - Between Left Shift and Z there is another key, but the image is not clear on that key + */ +#endif + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_MENU) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x0C00, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Option") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE5") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('l') PORT_CHAR('M') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('m') PORT_CHAR('L') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("LINE6") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("LINE7") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Option") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) +INPUT_PORTS_END + + /* Note we're missing a whole bunch of lisa bootrom revisions; based on http://www.cs.dartmouth.edu/~woz/bootrom.pdf : + ?A?(10/12/82) ?B?(11/19/82) ?C?(1/28/83) D(5/12/83) 3B(9/8/83) E(10/20/83) F(12/21/83) G(2/8/84) and H(2/24/84) are known to exist. Earlier prototypes existed as well. Only F and H are dumped. */ + /* Based on http://www.cs.dartmouth.edu/~woz/bootrom.pdf and other information, at least the following systems existed: + * Lisa: two 890K twiggy drives, old MB (slow 500khz-clock parallel port via), old i/o board w/io40 disk rom, supports profile hdd, all bootrom revs (practically speaking, it only appeared with bootroms A, B, C, D, E or F) + * Lisa2 (aka Lisa2/5): one 400K SSDD drive, old MB (slow 500khz-clock parallel port via), old i/o board w/ioa8 disk rom, supports profile hdd, bootrom revs "3B", E, F, G, H + * Lisa2/10: one 400K SSDD drive, new MB (fast 1.25MHz-clock parallel port via), new i/o board w/ioa8 disk rom, internal widget 10mb drive (no profile hdd ports), bootrom revs F, G, H + * MacXL: one 400K SSDD drive, new MB (fast 1.25MHz-clock parallel port via), new i/o board w/io88 disk rom, internal widget 10mb drive (no profile hdd ports), bootrom rev 3A, different screen aspect, no serial number in video state rom so lisa office would not run + * Sun-remanufactured MacXL: one 800K DSDD drive, new MB (fast 1.25MHz-clock parallel port via), sun-made custom disk rom (3 revisions exist), internal custom 10mb,20mb, or 40mb drive (?no profile hdd ports?), bootrom rev 3A, different screen aspect, no serial number in video state rom so lisa apps would not run + */ + /* the old i/o board has a battery pack on it which often leaks and destroys the board, and has a socket for an amd 2915 math co-procesor; the new i/o board lacks the battery pack and the socket for the coprocessor, and integrates some of the function of the old twiggy-to-400k drive convertor board (which all lisa2/5s had) on it, requiring a mod to be done to the old convertor if used with a new i/o board.*/ + /* Twiggy disk format notes: twiggy disks seem to have wide '48tpi' heads, but cram 62.5tpi on the media by closely spacing the tracks! Twiggy media is DSHD-grade (needing strong magnetic field to set due to high data rate, see http://www.folklore.org/StoryView.py?project=Macintosh&story=Hide_Under_This_Desk.txt). The twiggy format is *PROBABLY* GCR encoding similar to apple2 and mac800k. The disks are 5.25" disks with TWO holes for the drive heads on both sides of the media, and the write protect notch in an unusual place (the index hole is in its normal position, though). By using variable motor speed similar to the later apple 3.5" disks, double sided disks, and tight track spacing, 871,424 bytes are stored per disk. see http://www.brouhaha.com/~eric/retrocomputing/lisa/twiggy.html + The drives were notoriously unreliable and were replaced by a single SSDD Sony-made varialble speed 400k drive in the lisa2, which was also used on the original macintosh. */ + /* which systems used the 341-0193-A parallel interface card rom? */ + + +ROM_START( lisa ) /* with twiggy drives, io40 i/o rom; technically any of the bootroms will work on this. */ + ROM_REGION16_BE(0x204000,"maincpu",0) /* 68k rom and ram */ + ROM_DEFAULT_BIOS( "revh" ) + + ROM_SYSTEM_BIOS( 0, "revh", "LISA Bootrom Rev H (2/24/84)") + ROMX_LOAD( "341-0175-h", 0x000000, 0x2000, CRC(adfd4516) SHA1(97a89ce1218b8aa38f69f92f6f363f435c887914), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0175-H LISA Bootrom Rev H (2/24/84) (High) */ + ROMX_LOAD( "341-0176-h", 0x000001, 0x2000, CRC(546d6603) SHA1(2a81e4d483f50ae8a2519621daeb7feb440a3e4d), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0176-H LISA Bootrom Rev H (2/24/84) (Low) */ + + ROM_SYSTEM_BIOS( 1, "revg", "LISA Bootrom Rev G (2/08/84)") /* limited test release before release of rom rev H */ + ROMX_LOAD( "341-0175-g", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0175-G LISA Bootrom Rev G (2/08/84) (High) */ + ROMX_LOAD( "341-0176-g", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0176-G LISA Bootrom Rev G (2/08/84) (Low) */ + + ROM_SYSTEM_BIOS( 2, "revf", "LISA Bootrom Rev F (12/21/83)") + ROMX_LOAD( "341-0175-f", 0x000000, 0x2000, CRC(701b9dab) SHA1(b116e5fada7b9a51f1b6e25757b2814d1b2737a5), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0175-F LISA Bootrom Rev F (12/21/83) (High) */ + ROMX_LOAD( "341-0176-f", 0x000001, 0x2000, CRC(036010b6) SHA1(ac93e6dbe4ce59396d7d191ee3e3e79a504e518f), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0176-F LISA Bootrom Rev F (12/21/83) (Low) */ + + ROM_SYSTEM_BIOS( 3, "reve", "LISA Bootrom Rev E (10/20/83)") + ROMX_LOAD( "341-0175-e", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(4)) /* 341-0175-E LISA Bootrom Rev E (10/20/83) (High) */ + ROMX_LOAD( "341-0176-e", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(4)) /* 341-0176-E LISA Bootrom Rev E (10/20/83) (Low) */ + + ROM_SYSTEM_BIOS( 4, "revd", "LISA Bootrom Rev D (5/12/83)") + ROMX_LOAD( "341-0175-d", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(5)) /* 341-0175-D LISA Bootrom Rev D (5/12/83) (High) */ + ROMX_LOAD( "341-0176-d", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(5)) /* 341-0176-D LISA Bootrom Rev D (5/12/83) (Low) */ + + ROM_SYSTEM_BIOS( 5, "revc", "LISA Bootrom Rev C (1/28/83?)") + ROMX_LOAD( "341-0175-c", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(6)) /* 341-0175-C LISA Bootrom Rev C (1/28/83) (High) */ + ROMX_LOAD( "341-0176-c", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(6)) /* 341-0176-C LISA Bootrom Rev C (1/28/83) (Low) */ + + ROM_SYSTEM_BIOS( 6, "revb", "LISA Bootrom Rev B (11/19/82?)") + ROMX_LOAD( "341-0175-b", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(7)) /* 341-0175-B LISA Bootrom Rev B (11/19/82?) (High) */ + ROMX_LOAD( "341-0176-b", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(7)) /* 341-0176-B LISA Bootrom Rev B (11/19/82?) (Low) */ + + ROM_SYSTEM_BIOS( 7, "reva", "LISA Bootrom Rev A (10/12/82?)") /* possibly only prototypes */ + ROMX_LOAD( "341-0175-a", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(8)) /* 341-0175-A LISA Bootrom Rev A (10/12/82?) (High) */ + ROMX_LOAD( "341-0176-a", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(8)) /* 341-0176-A LISA Bootrom Rev A (10/12/82?) (Low) */ + + ROM_REGION( 0x400, COP421_TAG, 0 ) + ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) + + ROM_REGION( 0x400, KB_COP421_TAG, 0 ) + ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) + + ROM_REGION(0x2000,"fdccpu",0) /* 6504 RAM and ROM */ + /* note: other ?prototype? revisions of this rom for the lisa probably exist as well */ + ROM_LOAD( "341-0138f.bin", 0x001000, 0x001000, CRC(edd8d560) SHA1(872211d21386cd9625b3735d7682e2b2ecff05b4) ) + + ROM_REGION(0x4000,"profile", 0) /* Profile/5 HDD */ + ROM_LOAD_OPTIONAL( "341-0080-b", 0x0000, 0x800, CRC(26df0b8d) SHA1(08f6689afb517e0a2bdaa48433003e62a66ae3c7)) /* 341-0080-B z8 mcu piggyback rom */ + + /* TODO: the 341-0193-A parallel interface card rom should be loaded here as well for the lisa 1 and 2/5? */ + + ROM_REGION(0x100,"gfx1",0) /* video ROM (includes S/N) */ + ROM_LOAD( "vidstate.rom", 0x00, 0x100, CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) +ROM_END + +ROM_START( lisa2 ) /* internal apple codename was 'pepsi'; has one SSDD 400K drive, ioa8 i/o rom */ + ROM_REGION16_BE(0x204000,"maincpu",0) /* 68k rom and ram */ + ROM_DEFAULT_BIOS( "revh" ) + + ROM_SYSTEM_BIOS( 0, "revh", "LISA Bootrom Rev H (2/24/84)") + ROMX_LOAD( "341-0175-h", 0x000000, 0x2000, CRC(adfd4516) SHA1(97a89ce1218b8aa38f69f92f6f363f435c887914), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0175-H LISA Bootrom Rev H (2/24/84) (High) */ + ROMX_LOAD( "341-0176-h", 0x000001, 0x2000, CRC(546d6603) SHA1(2a81e4d483f50ae8a2519621daeb7feb440a3e4d), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0176-H LISA Bootrom Rev H (2/24/84) (Low) */ + + ROM_SYSTEM_BIOS( 1, "revg", "LISA Bootrom Rev G (2/08/84)") /* limited test release before release of rom rev H */ + ROMX_LOAD( "341-0175-g", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0175-G LISA Bootrom Rev G (2/08/84) (High) */ + ROMX_LOAD( "341-0176-g", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0176-G LISA Bootrom Rev G (2/08/84) (Low) */ + + ROM_SYSTEM_BIOS( 2, "revf", "LISA Bootrom Rev F (12/21/83)") + ROMX_LOAD( "341-0175-f", 0x000000, 0x2000, CRC(701b9dab) SHA1(b116e5fada7b9a51f1b6e25757b2814d1b2737a5), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0175-F LISA Bootrom Rev F (12/21/83) (High) */ + ROMX_LOAD( "341-0176-f", 0x000001, 0x2000, CRC(036010b6) SHA1(ac93e6dbe4ce59396d7d191ee3e3e79a504e518f), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0176-F LISA Bootrom Rev F (12/21/83) (Low) */ + + ROM_SYSTEM_BIOS( 3, "reve", "LISA Bootrom Rev E (10/20/83)") + ROMX_LOAD( "341-0175-e", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(4)) /* 341-0175-E LISA Bootrom Rev E (10/20/83) (High) */ + ROMX_LOAD( "341-0176-e", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(4)) /* 341-0176-E LISA Bootrom Rev E (10/20/83) (Low) */ + + ROM_SYSTEM_BIOS( 4, "rev3b", "LISA Bootrom Rev 3B (9/8/83)") /* Earliest lisa2 rom, prototype. */ + ROMX_LOAD( "341-0175-3b", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(5)) /* ?label? 341-0175-3b LISA Bootrom Rev 3B (9/8/83) (High) */ + ROMX_LOAD( "341-0176-3b", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(5)) /* ?label? 341-0176-3b LISA Bootrom Rev 3B (9/8/83) (Low) */ + + ROM_REGION( 0x400, COP421_TAG, 0 ) + ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) + + ROM_REGION( 0x400, KB_COP421_TAG, 0 ) + ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) + + ROM_REGION(0x2000,"fdccpu",0) /* 6504 RAM and ROM */ + ROM_LOAD( "341-0290-b", 0x1000, 0x1000, CRC(bc6364f1) SHA1(f3164923330a51366a06d9d8a4a01ec7b0d3a8aa)) /* 341-0290-B LISA 2/5 Disk Rom (ioa8), supports profile on external port */ + + ROM_REGION(0x4000,"profile", 0) /* Profile/5 HDD */ + ROM_LOAD_OPTIONAL( "341-0080-b", 0x0000, 0x800, CRC(26df0b8d) SHA1(08f6689afb517e0a2bdaa48433003e62a66ae3c7)) /* 341-0080-B z8 mcu piggyback rom */ + + /* TODO: the 341-0193-A parallel interface card rom should be loaded here as well for the lisa 1 and 2/5? */ + + ROM_REGION(0x100,"gfx1",0) /* video ROM (includes S/N) */ + ROM_LOAD( "vidstate.rom", 0x00, 0x100, CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) +ROM_END + +ROM_START( lisa210 ) /* newer motherboard and i/o board; has io88 i/o rom, built in widget hdd */ + ROM_REGION16_BE(0x204000,"maincpu", 0) /* 68k rom and ram */ + ROM_DEFAULT_BIOS( "revh" ) + ROM_SYSTEM_BIOS( 0, "revh", "LISA Bootrom Rev H (2/24/84)") + ROMX_LOAD( "341-0175-h", 0x000000, 0x2000, CRC(adfd4516) SHA1(97a89ce1218b8aa38f69f92f6f363f435c887914), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0175-H LISA Bootrom Rev H (2/24/84) (High) */ + ROMX_LOAD( "341-0176-h", 0x000001, 0x2000, CRC(546d6603) SHA1(2a81e4d483f50ae8a2519621daeb7feb440a3e4d), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0176-H LISA Bootrom Rev H (2/24/84) (Low) */ + + ROM_SYSTEM_BIOS( 1, "revg", "LISA Bootrom Rev G (2/08/84)") /* limited test release before release of rom rev H */ + ROMX_LOAD( "341-0175-g", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0175-G LISA Bootrom Rev G (2/08/84) (High) */ + ROMX_LOAD( "341-0176-g", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0176-G LISA Bootrom Rev G (2/08/84) (Low) */ + + ROM_SYSTEM_BIOS( 2, "revf", "LISA Bootrom Rev F (12/21/83)") + ROMX_LOAD( "341-0175-f", 0x000000, 0x2000, CRC(701b9dab) SHA1(b116e5fada7b9a51f1b6e25757b2814d1b2737a5), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0175-F LISA Bootrom Rev F (12/21/83) (High) */ + ROMX_LOAD( "341-0176-f", 0x000001, 0x2000, CRC(036010b6) SHA1(ac93e6dbe4ce59396d7d191ee3e3e79a504e518f), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0176-F LISA Bootrom Rev F (12/21/83) (Low) */ + + ROM_REGION( 0x400, COP421_TAG, 0 ) + ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) + + ROM_REGION( 0x400, KB_COP421_TAG, 0 ) + ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) + +#if 1 + ROM_REGION(0x2000,"fdccpu", 0) /* 6504 RAM and ROM */ + ROM_LOAD( "341-0281-d", 0x1000, 0x1000, CRC(e343fe74) SHA1(a0e484ead2d2315fca261f39fff2f211ff61b0ef)) /* 341-0281-D LISA 2/10 Disk Rom (io88), supports widget on internal port */ +#else + ROM_REGION(0x2000,"fdccpu", 0) /* 6504 RAM and ROM */ + ROM_LOAD( "341-8003-c", 0x1000, 0x1000, CRC(8c67959a) SHA1(aa446b0c4acb4cb6c9d0adfbbea900fb8c04c1e9)) /* 341-8003-C Sun Mac XL Disk rom for 800k drives (Rev C, from Goodwill XL) (io88800k) */ + /* Note: there are two earlier/alternate versions of this rom as well which are dumped */ +#endif + + ROM_REGION(0x4000,"widget", 0) /* Widget HDD controller */ + ROM_LOAD( "341-0288-a", 0x0000, 0x800, CRC(a26ef1c6) SHA1(5aaeb6ff7f7d4f7ce7c70402f75e82533635dda4)) /* 341-0288-A z8 mcu piggyback rom */ + ROM_LOAD( "341-0289-d", 0x2000, 0x2000, CRC(25e86e95) SHA1(72a346c2074d2256adde491b930023ebdcb5f51a)) /* 341-0289-D external rom on widget board */ + + ROM_REGION(0x100,"gfx1", 0) /* video ROM (includes S/N) */ + ROM_LOAD( "vidstate.rom", 0x00, 0x100, CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) +ROM_END + +ROM_START( macxl ) + ROM_REGION16_BE(0x204000,"maincpu", 0) /* 68k rom and ram */ + ROM_LOAD16_BYTE( "341-0347-a", 0x000000, 0x2000, CRC(80add605) SHA1(82215688b778d8c712a8186235f7981e3dc4dd7f)) /* 341-0347-A Mac XL '3A' Bootrom Hi (boot3a.hi)*/ + ROM_LOAD16_BYTE( "341-0346-a", 0x000001, 0x2000, CRC(edf5222f) SHA1(b0388ee8dbbc51a2d628473dc29b65ce913fcd76)) /* 341-0346-A Mac XL '3A' Bootrom Lo (boot3a.lo)*/ + + ROM_REGION( 0x400, COP421_TAG, 0 ) + ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) + + ROM_REGION( 0x400, KB_COP421_TAG, 0 ) + ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) + +#if 1 + ROM_REGION(0x2000,"fdccpu", 0) /* 6504 RAM and ROM */ + ROM_LOAD( "341-0281-d", 0x1000, 0x1000, CRC(e343fe74) SHA1(a0e484ead2d2315fca261f39fff2f211ff61b0ef)) /* 341-0281-D LISA 2/10 Disk Rom (io88), supports widget on internal port */ +#else + ROM_REGION(0x2000,"fdccpu", 0) /* 6504 RAM and ROM */ + ROM_LOAD( "341-8003-c", 0x1000, 0x1000, CRC(8c67959a) SHA1(aa446b0c4acb4cb6c9d0adfbbea900fb8c04c1e9)) /* 341-8003-C Sun Mac XL Disk rom for 800k drives (Rev C, from Goodwill XL) (io88800k) */ + /* Note: there are two earlier/alternate versions of this rom as well which are dumped */ +#endif + + ROM_REGION(0x100,"gfx1", 0) /* video ROM (includes S/N) ; no dump known, although Lisa ROM works fine at our level of emulation */ + ROM_LOAD( "vidstatem.rom", 0x00, 0x100, BAD_DUMP CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) +ROM_END + +/* + Lisa drivers boot MacWorks, but do not boot the Lisa OS, which is why we set + the MACHINE_NOT_WORKING flag... +*/ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1983, lisa, 0, 0, lisa, lisa, lisa_state, lisa2, "Apple Computer", "Lisa", MACHINE_NOT_WORKING ) +COMP( 1984, lisa2, 0, 0, lisa, lisa, lisa_state, lisa2, "Apple Computer", "Lisa2", MACHINE_NOT_WORKING ) +COMP( 1984, lisa210, lisa2, 0, lisa210, lisa, lisa_state, lisa210, "Apple Computer", "Lisa2/10", MACHINE_NOT_WORKING ) +COMP( 1985, macxl, lisa2, 0, macxl, lisa, lisa_state, mac_xl, "Apple Computer", "Macintosh XL", /*MACHINE_NOT_WORKING*/0 ) diff --git a/src/mame/drivers/llc.c b/src/mame/drivers/llc.c new file mode 100644 index 00000000000..45cb0ce5348 --- /dev/null +++ b/src/mame/drivers/llc.c @@ -0,0 +1,311 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/****************************************************************************** + + LLC driver by Miodrag Milanovic + + 17/04/2009 Preliminary driver. + + July 2012, updates by Robbbert + + Very little info available on these computers. + + LLC1: + Handy addresses (set the pc register in the debugger, because the + monitor's Go command has problems): + 0800 = BASIC cold start + 0803 = BASIC warm start + 13BE = display Monitor logo + This machine has an 8-digit LED display with hex keyboard, + and also a 64x16 monochrome screen with full keyboard. + The monitor uses the hex keyboard, while Basic uses the full keyboard. + Monitor output is on the digits, but the single-step command displays + a running register dump on the main screen. + There are no storage facilities, and no sound. + BASIC is integer only (-32768 to 32767), about 6k of space, and all + input is to be in uppercase. It does have minimal string capability, + but there is no $ sign, so how to create a string variable is unknown. + To exit back to the monitor, type BYE. + The user instructions of the monitor (in German) are here: + http://www.jens-mueller.org/jkcemu/llc1.html + + LLC2: + The BEL character plays a short tune. + In the monitor, it is case sensitive, most commands are uppercase, + but some are lowercase. + To start Basic, the command is b. To quit basic, use BYE. + Inside Basic, it is not case-sensitive. + + ToDo: + - LLC1: Get good dump of monitor rom, has a number of bad bytes + - LLC1: In Basic, pressing enter several times causes the start + of the line to be shifted 1 or 2 characters to the right. + - LLC1: Go command crashes + - LLC2: Keyboard is incomplete + - Lots of other things + +*******************************************************************************/ + + +#include "machine/keyboard.h" +#include "includes/llc.h" +#include "llc1.lh" + +#define KEYBOARD_TAG "keyboard" + +/* Address maps */ +static ADDRESS_MAP_START( llc1_mem, AS_PROGRAM, 8, llc_state ) + AM_RANGE(0x0000, 0x07ff) AM_ROM // Monitor ROM + AM_RANGE(0x0800, 0x13ff) AM_ROM // BASIC ROM + AM_RANGE(0x1400, 0x1bff) AM_RAM // RAM + AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_SHARE("videoram") // Video RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( llc1_io, AS_IO, 8, llc_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xEC, 0xEF) AM_DEVREADWRITE("z80pio2", z80pio_device, read, write) + AM_RANGE(0xF4, 0xF7) AM_DEVREADWRITE("z80pio1", z80pio_device, read, write) + AM_RANGE(0xF8, 0xFB) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( llc2_mem, AS_PROGRAM, 8, llc_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x5fff) AM_RAMBANK("bank2") + AM_RANGE(0x6000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( llc2_io, AS_IO, 8, llc_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xE0, 0xE3) AM_WRITE(llc2_rom_disable_w) + AM_RANGE(0xE4, 0xE7) AM_DEVREADWRITE("z80pio2", z80pio_device, read, write) + AM_RANGE(0xE8, 0xEB) AM_DEVREADWRITE("z80pio1", z80pio_device, read, write) + AM_RANGE(0xEC, 0xEC) AM_WRITE(llc2_basic_enable_w) + AM_RANGE(0xF8, 0xFB) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( llc1 ) + PORT_START("X4") // out F4,BF + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_START("X5") // out F4,DF + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M (Mem)") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ST (Start)") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('^') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) // resets + PORT_START("X6") // out F4,EF + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ES (Step)") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DL (Go)") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HP (BP)") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) // does nothing +INPUT_PORTS_END + +static INPUT_PORTS_START( llc2 ) +INPUT_PORTS_END + + +WRITE8_MEMBER( llc_state::kbd_put ) +{ + static UINT8 s1[16]={0x40, 0x1e, 0x12, 0x1b, 0x19, 0x14, 0x15, 0x1d, 0x16, 0x17, 0x1c, 0x3c, 0x3f, 0x3d, 0x3e, 0x10}; // 0x20 to 0x2F + static UINT8 s2[7] ={0x1a, 0x11, 0x7c, 0x13, 0x7b, 0x1f, 0x00}; // 0x3A to 0x40 + static UINT8 s3[6] ={0x5c, 0x00, 0x5b, 0x7e, 0x00, 0x5e}; // 0x5B to 0x60 + + m_term_data = data; + + if ((data >= 0x20) && (data <= 0x2f)) + m_term_data = s1[data-0x20]; + else + if ((data >= 0x3a) && (data <= 0x40)) + m_term_data = s2[data-0x3a]; + else + if ((data >= 0x5b) && (data <= 0x60)) + m_term_data = s3[data-0x5b]; + else + if (data >= 0x7b) + m_term_data = 0; + + if (m_term_data) + m_term_status = 0xff; +} + +static const z80_daisy_config llc1_daisy_chain[] = +{ + { "z80ctc" }, + { NULL } +}; + +static const z80_daisy_config llc2_daisy_chain[] = +{ + { "z80pio1" }, + { "z80ctc" }, + { NULL } +}; + +/* F4 Character Displayer */ +static const gfx_layout llc1_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8 }, + 8 /* every char takes 8 x 1 bytes */ +}; + +static const gfx_layout llc2_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( llc1 ) + GFXDECODE_ENTRY( "chargen", 0x0000, llc1_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( llc2 ) + GFXDECODE_ENTRY( "chargen", 0x0000, llc2_charlayout, 0, 1 ) +GFXDECODE_END + +/* Machine driver */ +static MACHINE_CONFIG_START( llc1, llc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_3MHz) + MCFG_CPU_CONFIG(llc1_daisy_chain) + MCFG_CPU_PROGRAM_MAP(llc1_mem) + MCFG_CPU_IO_MAP(llc1_io) + + MCFG_MACHINE_START_OVERRIDE(llc_state, llc1 ) + MCFG_MACHINE_RESET_OVERRIDE(llc_state, llc1 ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*8, 16*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*8-1) + MCFG_SCREEN_UPDATE_DRIVER(llc_state, screen_update_llc1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", llc1) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_DEFAULT_LAYOUT(layout_llc1) + + MCFG_DEVICE_ADD("z80pio1", Z80PIO, XTAL_3MHz) + MCFG_Z80PIO_IN_PA_CB(READ8(llc_state, llc1_port1_a_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(llc_state, llc1_port1_a_w)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(llc_state, llc1_port1_b_w)) + + MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_3MHz) + MCFG_Z80PIO_IN_PA_CB(READ8(llc_state, llc1_port2_a_r)) + MCFG_Z80PIO_IN_PB_CB(READ8(llc_state, llc1_port2_b_r)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_3MHz) + // timer 0 irq does digit display, and timer 3 irq does scan of the + // monitor keyboard. + // No idea how the CTC is connected, so guessed. + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(llc_state, kbd_put)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( llc2, llc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_3MHz) + MCFG_CPU_CONFIG(llc2_daisy_chain) + MCFG_CPU_PROGRAM_MAP(llc2_mem) + MCFG_CPU_IO_MAP(llc2_io) + + MCFG_MACHINE_RESET_OVERRIDE(llc_state, llc2 ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) + MCFG_SCREEN_UPDATE_DRIVER(llc_state, screen_update_llc2) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", llc2) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) + + MCFG_DEVICE_ADD("z80pio1", Z80PIO, XTAL_3MHz) + MCFG_Z80PIO_IN_PA_CB(DEVREAD8(K7659_KEYBOARD_TAG, k7659_keyboard_device, read)) + MCFG_Z80PIO_IN_PB_CB(READ8(llc_state, llc2_port1_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(llc_state, llc2_port1_b_w)) + + MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_3MHz) + MCFG_Z80PIO_IN_PA_CB(READ8(llc_state, llc2_port2_a_r)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_3MHz) + + MCFG_K7659_KEYBOARD_ADD() + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END +/* ROM definition */ + +ROM_START( llc1 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + //ROM_LOAD( "llc1-monitor.rom", 0x0000, 0x0800, BAD_DUMP CRC(0e81378d) SHA1(0fbb6eca016d0f439ea1c9aa0cb0affb5f49ea69) ) + ROM_LOAD( "llc1mon.bin", 0x0000, 0x0800, BAD_DUMP CRC(e291dd63) SHA1(31a71bef84f7c164a270d0895cb645e078e9c6f2) ) + ROM_LOAD( "llc1_tb1.bin", 0x0800, 0x0400, CRC(0d9d4039) SHA1(b515e385af57f4faf3a9f7b4a1edd59a1c1ea260) ) + ROM_LOAD( "llc1_tb2.bin", 0x0c00, 0x0400, CRC(28bfea2a) SHA1(a68a8b87bfc931627ddd8d124b153e511477fbaf) ) + ROM_LOAD( "llc1_tb3.bin", 0x1000, 0x0400, CRC(fe5e3132) SHA1(cc3b191e41f5772a4b86b8eb0ebe6fce67872df6) ) + ROM_FILL(0x23b, 1, 0x00) // don't reboot when typing into the monitor + ROM_FILL(0x2dc, 1, 0x0f) // fix display of AF in the reg command + ROM_REGION(0x0400, "chargen",0) + ROM_LOAD ("llc1_zg.bin", 0x0000, 0x0400, CRC(fa2cd659) SHA1(1fa5f9992f35929f656c4ce55ed6980c5da1772b) ) +ROM_END + +ROM_START( llc2 ) + ROM_REGION( 0x12000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "scchmon_91.bin", 0x0000, 0x1000, CRC(218d8236) SHA1(b8297272cc79751afc2eb8688d99b40691346dcb) ) + ROM_LOAD( "gsbasic.bin", 0x10000, 0x2000, CRC(78a5f388) SHA1(e7b475b98dce36b24540ad11eb89046ddb4f02af) ) + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD ("llc2font.bin", 0x0000, 0x0800, CRC(ce53e55d) SHA1(da23d93f14a8a1f8d82bb72470a96b0bfd81ed1b) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, llc1, 0, 0, llc1, llc1, llc_state, llc1, "SCCH", "LLC-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1984, llc2, llc1, 0, llc2, llc2, llc_state, llc2, "SCCH", "LLC-2", 0 ) diff --git a/src/mame/drivers/lola8a.c b/src/mame/drivers/lola8a.c new file mode 100644 index 00000000000..c6f2e9a6c4f --- /dev/null +++ b/src/mame/drivers/lola8a.c @@ -0,0 +1,295 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Lola 8A + + Ivo Lola Ribar Institute + + 2013-08-28 Skeleton driver. + + + BASIC commands : + + LET NEXT IF GOTO GOSUB RETURN READ DATA FOR CLS INPUT DIM STOP END RESTORE + REM CLEAR PUSH POKE PRINT OUT ERROR USR CURSOR NORMAL INVERSE PLOT UNPLOT + ELSE WIPE COLOUR CENTRE RANGE DRAW CIRCLE LOAD SAVE VERIFY HLOAD HSAVE HVERIFY + DLOAD DSAVE DVERIFY MERGE CAT RUN NEW ON LIST DEF MON GWIND TWIND UNDER + SPC OFF TAB THEN TO STEP AND OR XOR NOT ABS LEN SQR INT ASC CHR VAL STR MID + ARG CALL RND LEFT RIGHT DOT SGN SIN FREE PI FN TAN COS POP PEEK INP LN EXP ATN +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "video/mc6845.h" +#include "sound/ay8910.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" + +#define AY8910_TAG "g12" +#define HD46505SP_TAG "h45" + + +class lola8a_state : public driver_device +{ +public: + lola8a_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cass(*this, "cassette"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + + virtual void machine_reset() { m_maincpu->set_pc(0x8000); } + + DECLARE_READ8_MEMBER(lola8a_port_a_r); + DECLARE_WRITE8_MEMBER(lola8a_port_b_w); + DECLARE_WRITE_LINE_MEMBER(crtc_vsync); + DECLARE_READ_LINE_MEMBER(cass_r); + DECLARE_WRITE_LINE_MEMBER(cass_w); + + DECLARE_READ8_MEMBER(keyboard_r); + MC6845_UPDATE_ROW(crtc_update_row); + +private: + UINT8 m_portb; + required_device m_cass; +public: + required_device m_palette; +}; + +static ADDRESS_MAP_START(lola8a_mem, AS_PROGRAM, 8, lola8a_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x1fff ) AM_RAM // 6264 at G45 + AM_RANGE( 0x2000, 0x3fff ) AM_RAM // 6264 at F45 + // empty place for 6264 at E45 + // empty place for 6264 at D45 + AM_RANGE( 0x8000, 0x9fff ) AM_ROM // 2764A at B45 + AM_RANGE( 0xa000, 0xbfff ) AM_ROM // 2764A at C45 + AM_RANGE( 0xc000, 0xdfff ) AM_ROM // 2764A at H67 + AM_RANGE( 0xe000, 0xffff ) AM_RAM // 6264 at G67 +ADDRESS_MAP_END + +static ADDRESS_MAP_START(lola8a_io, AS_IO, 8, lola8a_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x80, 0x80) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w) + AM_RANGE(0x84, 0x84) AM_DEVREADWRITE(AY8910_TAG, ay8910_device, data_r, data_w) + AM_RANGE(0x88, 0x88) AM_READ(keyboard_r) + + AM_RANGE(0x90, 0x90) AM_DEVREADWRITE(HD46505SP_TAG, mc6845_device, status_r, address_w) + AM_RANGE(0x92, 0x92) AM_DEVREADWRITE(HD46505SP_TAG, mc6845_device, register_r, register_w) + +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( lola8a ) + PORT_START("line_0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)// Z" + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) // C" + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) // = + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // S" + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) // C' + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // ; + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)// / + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // ???? + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // : + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + + PORT_START("line_9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) // return + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) // ???? + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // ???? + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) // ???? + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)// @ + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) +INPUT_PORTS_END + +MC6845_UPDATE_ROW( lola8a_state::crtc_update_row ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + for (int sx = 0; sx < x_count; sx++) + { + UINT16 addr = 0xa000 + sx*8 + ra + ma * 8; + UINT8 code = program.read_byte(addr); + + for (int x = 0; x <= 8; x++) + { + int color = BIT(code, 7-x) ? 7 : 0; + if (cursor_x==sx) color = 7; + bitmap.pix32(y, x + sx*8) = m_palette->pen_color(color); + } + } +} + +READ8_MEMBER(lola8a_state::lola8a_port_a_r) +{ + logerror("lola8a_port_a_r\n"); + return 0x00; +} + +WRITE8_MEMBER(lola8a_state::lola8a_port_b_w) +{ + m_portb = data; +} + +READ_LINE_MEMBER( lola8a_state::cass_r ) +{ + return (m_cass->input() < 0.03); +} + +WRITE_LINE_MEMBER( lola8a_state::cass_w ) +{ + m_cass->output(state ? -1.0 : +1.0); +} + +READ8_MEMBER(lola8a_state::keyboard_r) +{ + static const char *const keynames[] = + { + "line_0", "line_1", "line_2", "line_3", + "line_4", "line_5", "line_6", "line_7", + "line_8", "line_9", NULL, NULL, + NULL,NULL,NULL,NULL + }; + + if( keynames[m_portb & 0x0f]) + return ioport(keynames[m_portb & 0x0f])->read(); + return 0xff; +} + +WRITE_LINE_MEMBER(lola8a_state::crtc_vsync) +{ + m_maincpu->set_input_line(I8085_RST75_LINE, state? ASSERT_LINE : CLEAR_LINE); +} + +static MACHINE_CONFIG_START( lola8a, lola8a_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8085A, XTAL_4_9152MHz) + MCFG_CPU_PROGRAM_MAP(lola8a_mem) + MCFG_CPU_IO_MAP(lola8a_io) + MCFG_I8085A_SID(READLINE(lola8a_state, cass_r)) + MCFG_I8085A_SOD(WRITELINE(lola8a_state, cass_w)) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_4_9152MHz / 4) + MCFG_AY8910_PORT_A_READ_CB(READ8(lola8a_state, lola8a_port_a_r)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(lola8a_state, lola8a_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",1.0) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE(HD46505SP_TAG, hd6845_device, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + + MCFG_MC6845_ADD(HD46505SP_TAG, HD6845, "screen", XTAL_8MHz / 8) // HD6845 == HD46505S + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(lola8a_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(lola8a_state, crtc_vsync)) + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + /* Cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( lola8a ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "lola 8a r0 w06 22.11.86.b45", 0x8000, 0x2000, CRC(aca1fc08) SHA1(f7076d937bb53b0addcba2a5b7c05ab75d6d0d93)) + ROM_LOAD( "lola 8a r1 w06 22.11.86.c45", 0xa000, 0x2000, CRC(99f8ec9b) SHA1(88eafd09c479f177525fa0039cf04d74bae39dab)) + ROM_LOAD( "lola 8a r2 w06 22.11.86.h67", 0xc000, 0x2000, CRC(1e7cd46b) SHA1(048b2583ee7baeb9621e629b79ed64583ac5d554)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, lola8a, 0, 0, lola8a, lola8a, driver_device, 0, "Institut Ivo Lola Ribar", "Lola 8A", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/lviv.c b/src/mame/drivers/lviv.c new file mode 100644 index 00000000000..1861e026e71 --- /dev/null +++ b/src/mame/drivers/lviv.c @@ -0,0 +1,491 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/******************************************************************************* + +PK-01 Lviv driver by Krzysztof Strzecha + +Big thanks go to: +Anton V. Ignatichev for informations about Lviv hardware. +Dr. Volodimir Mosorov for two Lviv machines. + +What's new: +----------- +28.02.2003 Snapshot veryfing function added. +07.01.2003 Support for .SAV snapshots. Joystick support (there are strange + problems with "Doroga (1991)(-)(Ru).lvt". +21.12.2002 Cassette support rewritten, WAVs saving and loading are working now. +08.12.2002 Comments on emulation status updated. Changed 'lvive' to 'lvivp'. + ADC r instruction in I8080 core fixed (Arkanoid works now). + Orginal keyboard layout added. +20.07.2002 "Reset" key fixed. I8080 core fixed (all BASIC commands works). + now). Unsupported .lvt files versions aren't now loaded. +xx.07.2002 Improved port and memory mapping (Raphael Nabet). + Hardware description updated (Raphael Nabet). +27.03.2002 CPU clock changed to 2.5MHz. + New Lviv driver added for different ROM revision. +24.03.2002 Palette emulation. + Bit 7 of port 0xc1 emulated - speaker enabled/disabled. + Some notes about hardware added. + "Reset" key added. +23.03.2002 Hardware description and notes on emulation status added. + Few changes in keyboard mapping. + +Notes on emulation status and to do list: +----------------------------------------- +1. LIMITATION: Printer is not emulated. +2. LIMITATION: Timings are not implemented, due to it emulated machine runs + twice fast as orginal. +3. LIMITATION: .RSS files are not supported. +4. LIMITATION: Some usage notes and trivia are needed in sysinfo.dat. + +Lviv technical information +========================== + +CPU: +---- + I8080 2.5MHz (2MHz in first machines) + +Memory map: +----------- + start-up map (cleared by the first I/O write operation done by the CPU): + 0000-3fff ROM mirror #1 + 4000-7fff ROM mirror #2 + 8000-bfff ROM mirror #3 + c000-ffff ROM + + normal map with video RAM off: + 0000-3fff RAM + 4000-7fff RAM + 8000-bfff RAM + c000-ffff ROM + + normal map with video RAM on: + 0000-3fff mirrors 8000-bfff + 4000-7fff video RAM + 8000-bfff RAM + c000-ffff ROM + +Interrupts: +----------- + No interrupts in Lviv. + +Ports: +------ + Only A4-A5 are decoded. A2-A3 is ignored in the console, but could be used by extension + devices. + + C0-C3 8255 PPI + Port A: extension slot output, printer data + bits 0-4 joystick scanner output + Port B: palette control, extension slot input or output + sound on/off + bit 7 sound on/off + bits 0-6 palette select + Port C: memory page changing, tape input and output, + printer control, sound + bits 0-3 extension slot input + bits 4-7 extension slot output + bit 7: joystick scanner input + bit 6: printer control AC/busy + bit 5: not used + bit 4: tape in + bit 3: not used + bit 2: printer control SC/strobe + bit 1: memory paging, 0 - video ram, 1 - ram + bit 0: tape out, sound + + D0-D3 8255 PPI + Port A: + keyboard scaning + Port B: + keyboard reading + Port C: + keyboard scaning/reading + +Keyboard: +--------- + Reset - connected to CPU reset line + + Port D0 + --------T-------T-------T-------T-------T-------T-------T-------?? + | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | + +-------+-------+-------+-------+-------+-------+-------+-------+---?? + | Shift | ; | | CLS | Space | R | G | 6 | 0 | + +-------+-------+-------+-------+-------+-------+-------+-------+---+ + | Q |Russian| | (G) | B | O | [ | 7 | 1 | + +-------+-------+-------+-------+-------+-------+-------+-------+---+ + | ^ | Key | J | (B) | @ | L | ] | 8 | 2 | + +-------+-------+-------+-------+-------+-------+-------+-------+---+ + | X | P | N | 5 | Alt | Del | Enter | Ready | 3 | + +-------+-------+-------+-------+-------+-------+-------+-------+---+ Port D1 + | T | A | E | 4 | _ | . | Run | Tab | 4 | + +-------+-------+-------+-------+-------+-------+-------+-------+---+ + | I | W | K | 3 | Latin | \ | : | - | 5 | + +-------+-------+-------+-------+-------+-------+-------+-------+---+ + | M | Y | U | 2 | / | V | H | 0 | 6 | + +-------+-------+-------+-------+-------+-------+-------+-------+---+ + | S | F | C | 1 | , | D | Z | 9 | 7 | + L-------+-------+-------+-------+-------+-------+-------+-------+---- + + Port D2 + --------T-------T-------T-------?? + | 3 | 2 | 1 | 0 | + +-------+-------+-------+-------+-----?? + | Right | Home |ScrPrn |PrnLock| 4 | + +-------+-------+-------+-------+-----+ + | Up | F5 | F0 |ScrLock| 5 | + +-------+-------+-------+-------+-----+ Port D2 + | Left | F4 | F1 | Sound | 6 | + +-------+-------+-------+-------+-----+ + | Down | F3 | F2 | (R) | 7 | + L-------+-------+-------+-------+------ + + Notes: + CLS - clear screen + (G) - clear screen with border and set COLOR 0,0,0 + (B) - clear screen with border and set COLOR 1,0,6 + (R) - clear screen with border and set COLOR 0,7,3 + Sound - sound on/off + ScrLock - screen lock + PrnLock - printer on/off + ScrPrn - screen and printer output mode + Russian - russian keyboard mode + Latin - latin keyboard mode + Right - cursor key + Up - cursor key + Left - cursor key + Down - cursor key + Keyword - BASIC keyword + + +Video: +----- + Screen resolution is 256x256 pixels. 4 colors at once are possible, + but there is a posiibility of palette change. Bits 0..6 of port 0xc1 + are used for palette setting. + + One byte of video-RAM sets 4 pixels. Colors of pixels are corrected + by current palette. Each bits combination (2 bits sets one pixel on + the display), corrected with palette register, sets REAL pixel color. + + PBx - bit of port 0xC1 numbered x + R,G,B - output color components + == - "is equal" + ! - inversion + + 00 R = PB3 == PB4; G = PB5; B = PB2 == PB6; + 01 R = PB4; G = !PB5; B = PB6; + 10 R = PB0 == PB4; G = PB5; B = !PB6; + 11 R = !PB4; G = PB1 == PB5; B = PB6; + + Bit combinations are result of concatenation of appropriate bits of + high and low byte halfs. + + Example: + ~~~~~~~~ + + Some byte of video RAM: 1101 0001 + Value of port 0xC1: x000 1110 + + 1101 + 0001 + ---- + 10 10 00 11 + + 1st pixel (10): R = 1; G = 0; B = 1; + 2nd pixel (10): R = 1; G = 0; B = 1; + 3rd pixel (00): R = 0; G = 0; B = 0; + 4th pixel (11): R = 1; G = 0; B = 0; + + +Sound: +------ + Buzzer connected to port 0xc2 (bit 0). + Bit 7 of port 0xc1 - enable/disable speaker. + + +Timings: +-------- + + The CPU timing is controlled by a KR580GF24 (Sovietic copy of i8224) connected to a 18MHz(?) + oscillator. CPU frequency must be 18MHz/9 = 2MHz. + + Memory timing uses a 8-phase clock, derived from a 20MHz(?) video clock (called VCLK0 here: + in the schematics, it comes from pin 6 of V8, and it is labelled "0'" in the video clock bus). + This clock is divided by G7, G6 and D5 to generate the signals we call VCLK1-VCLK11. The memory + clock phases Phi0-Phi7 are generated in D7, whereas PHI'14 and PHI'15 are generated in D8. + + When the CPU accesses RAM, wait states are inserted until the RAM transfer is complete. + + CPU clock: 18MHz/9 = 2MHz + memory cycle time: 20MHz/8 = 2.5MHz + CPU memory access time: (min) approx. 9/20MHz = 450ns + (max) approx. 25/20MHz = 1250ns + pixel clock: 20MHz/4 = 5MHz + screen size: 256*256 + HBL: 64 pixel clock cycles + VBL: 64 lines + horizontal frequency: 5MHZ/(256+64) = 15.625kHz + vertical frequency: 15.625kHz/(256+64) = 48.83Hz + + |<--------VIDEO WINDOW--------->|<----------CPU WINDOW--------->|<-- + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + VCLK0 |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| | + _ ___ ___ ___ ___ ___ ___ ___ ___ ___ + VCLK1 |___| |___| |___| |___| |___| |___| |___| |___| |___| | + _ _______ _______ _______ _______ + VCLK2 |_______| |_______| |_______| |_______| |______| + _ _______________ _______________ + VCLK3 |_______________| |_______________| |_______ + _ _______________________________ + VCLK4 |_______________________________| |_______ + + _ _ _ + PHI0 _| |_____________________________| |_____________________________| |_____ + _ _ _ + PHI1 _____| |_____________________________| |_____________________________| |_ + _ _ + PHI2 _________| |_____________________________| |_____________________________ + _ _ + PHI3 _____________| |_____________________________| |_________________________ + _ _ + PHI4 _________________| |_____________________________| |_____________________ + _ _ + PHI5 _____________________| |_____________________________| |_________________ + _ _ + PHI6 _________________________| |_____________________________| |_____________ + _ _ + PHI7 _____________________________| |_____________________________| |_________ + _ + PHI'14 _________________________________________________________| |_____________ + _ + PHI'15 _____________________________________________________________| |_________ + __________ __________________________________________________ + RAS* \___________/ \_a_________/ + ______________ __________________________________________ + CAS* \_______________/ \_a_____________/ + _________________________________________________________________________ + WR* \_b_________//////// + _________________________________________________________________________ + WRM* \\\\\\\\\\\\\\\\\\\\\\\\\\_b__________________________________/////////// + _________________________________________________________________________ + RDM* \\\\\\\\\\\\\\\\\\\\\\\\\\_c __________________________________/////////// + _________________________________________________________________________ + RA \\\\\\\\\\\\\\\\\\\\\\\\\\_a__________________________________/ + + DRAM + ADDRESS video row /\ video column /XXX\CPU row (a)/\ CPU column (a) /\ video row + + a: only if the CPU is requesting a RAM read/write + b: only if the CPU is requesting a RAM write + c: only if the CPU is requesting a RAM read + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "machine/i8255.h" +#include "includes/lviv.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "formats/lviv_lvt.h" +#include "machine/ram.h" + +/* I/O ports */ + +static ADDRESS_MAP_START(io_map, AS_IO, 8, lviv_state ) + AM_RANGE(0x00, 0xff) AM_READWRITE(lviv_io_r,lviv_io_w) +ADDRESS_MAP_END + +/* memory w/r functions */ + +static ADDRESS_MAP_START(lviv_mem , AS_PROGRAM, 8, lviv_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + + +/* keyboard input */ +static INPUT_PORTS_START (lviv) + PORT_START("KEY0") /* 2nd PPI port A bit 0 low */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ready") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_START("KEY1") /* 2nd PPI port A bit 1 low */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('G') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('[') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR(']') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Run") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR(':') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('H') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('Z') + PORT_START("KEY2") /* 2nd PPI port A bit 2 low */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('D') + PORT_START("KEY3") /* 2nd PPI port A bit 3 low */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('B') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Latin") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(',') PORT_CHAR('<') + PORT_START("KEY4") /* 2nd PPI port A bit 4 low */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cls") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(G)") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(B)") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_START("KEY5") /* 2nd PPI port A bit 5 low */ + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('E') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('U') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('C') + PORT_START("KEY6") /* 2nd PPI port A bit 6 low */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Russian") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Key") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('Y') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('F') + PORT_START("KEY7") /* 2nd PPI port A bit 7 low */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('^') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('S') + PORT_START("KEY8") /* 2nd PPI port C bit 0 low */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PrnLck") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ScrLck") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sound") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(R)") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_START("KEY9") /* 2nd PPI port C bit 1 low */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ScrPrn") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_START("KEY10") /* 2nd PPI port C bit 2 low */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_START("KEY11") /* 2nd PPI port C bit 3 low */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_START("RESET") /* CPU */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_CHANGED_MEMBER(DEVICE_SELF, lviv_state, lviv_reset, 0) + PORT_START("JOY") /* Joystick */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + + +/* machine definition */ +static MACHINE_CONFIG_START( lviv, lviv_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2500000) + MCFG_CPU_PROGRAM_MAP(lviv_mem) + MCFG_CPU_IO_MAP(io_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(lviv_state, lviv_ppi_0_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(lviv_state, lviv_ppi_0_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(lviv_state, lviv_ppi_0_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(lviv_state, lviv_ppi_0_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(lviv_state, lviv_ppi_0_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(lviv_state, lviv_ppi_0_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(lviv_state, lviv_ppi_1_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(lviv_state, lviv_ppi_1_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(lviv_state, lviv_ppi_1_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(lviv_state, lviv_ppi_1_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(lviv_state, lviv_ppi_1_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(lviv_state, lviv_ppi_1_portc_w)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(0) + + /* video hardware */ + MCFG_SCREEN_SIZE(256, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(lviv_state, screen_update_lviv) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", sizeof (lviv_palette) / 3) + MCFG_PALETTE_INIT_OWNER(lviv_state, lviv) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* snapshot */ + MCFG_SNAPSHOT_ADD("snapshot", lviv_state, lviv, "sav", 0) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(lviv_lvt_format) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("lviv_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","lviv") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + +ROM_START(lviv) + ROM_REGION(0x14000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "lviv", "Lviv/L'vov" ) + ROMX_LOAD("lviv.bin", 0x10000, 0x4000, CRC(44a347d9) SHA1(74e067493b2b7d9ab17333202009a1a4f5e460fd), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "lviva", "Lviv/L'vov (alternate)" ) + ROMX_LOAD("lviva.bin", 0x10000, 0x4000, CRC(551622f5) SHA1(b225f3542b029d767b7db9dce562e8a3f77f92a2), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "lvivp", "Lviv/L'vov (prototype)" ) + ROMX_LOAD("lvivp.bin", 0x10000, 0x4000, CRC(f171c282) SHA1(c7dc2bdb02400e6b5cdcc50040eb06f506a7ed84), ROM_BIOS(3)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, lviv, 0, 0, lviv, lviv, driver_device, 0, "V. I. Lenin", "PK-01 Lviv" , 0 ) diff --git a/src/mame/drivers/lynx.c b/src/mame/drivers/lynx.c new file mode 100644 index 00000000000..5bde2a0cf15 --- /dev/null +++ b/src/mame/drivers/lynx.c @@ -0,0 +1,199 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + PeT peter.trauner@utanet.at 2000,2001 + + info found in bastian schick's bll + and in cc65 for lynx + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m65sc02.h" +#include "audio/lynx.h" +#include "includes/lynx.h" + +#include "lynx.lh" + +static ADDRESS_MAP_START( lynx_mem , AS_PROGRAM, 8, lynx_state ) + AM_RANGE(0x0000, 0xfbff) AM_RAM AM_SHARE("mem_0000") + AM_RANGE(0xfc00, 0xfcff) AM_RAM AM_SHARE("mem_fc00") + AM_RANGE(0xfd00, 0xfdff) AM_RAM AM_SHARE("mem_fd00") + AM_RANGE(0xfe00, 0xfff7) AM_READ_BANK("bank3") AM_WRITEONLY AM_SHARE("mem_fe00") + AM_RANGE(0xfff8, 0xfff8) AM_RAM + AM_RANGE(0xfff9, 0xfff9) AM_READWRITE(lynx_memory_config_r, lynx_memory_config_w) + AM_RANGE(0xfffa, 0xffff) AM_READ_BANK("bank4") AM_WRITEONLY AM_SHARE("mem_fffa") +ADDRESS_MAP_END + +static INPUT_PORTS_START( lynx ) + PORT_START("JOY") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Opt 2") PORT_CODE(KEYCODE_2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Opt 1") PORT_CODE(KEYCODE_1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + + PORT_START("PAUSE") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_3) + // power on and power off buttons +INPUT_PORTS_END + +PALETTE_INIT_MEMBER(lynx_state, lynx) +{ + int i; + + for (i=0; i< 0x1000; i++) + { + palette.set_pen_color(i, + ((i >> 0) & 0x0f) * 0x11, + ((i >> 4) & 0x0f) * 0x11, + ((i >> 8) & 0x0f) * 0x11); + } +} + +void lynx_state::video_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); +} + +UINT32 lynx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + +// callback for Mikey call of shift(3) which shall act on the lynx_timer_count_down +void lynx_state::sound_cb() +{ + lynx_timer_count_down(1); +} + +static MACHINE_CONFIG_START( lynx, lynx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M65SC02, 4000000) /* vti core, integrated in vlsi, stz, but not bbr bbs */ + MCFG_CPU_PROGRAM_MAP(lynx_mem) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(LCD_FRAMES_PER_SECOND) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(lynx_state, screen_update) + MCFG_SCREEN_SIZE(160, 102) + MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 102-1) + MCFG_SCREEN_PALETTE("palette") + MCFG_DEFAULT_LAYOUT(layout_lynx) + + MCFG_PALETTE_ADD("palette", 0x1000) + MCFG_PALETTE_INIT_OWNER(lynx_state, lynx) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("custom", LYNX_SND, 0) + MCFG_LYNX_SND_SET_TIMER(lynx_state, sound_cb) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_QUICKLOAD_ADD("quickload", lynx_state, lynx, "o", 0) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "lynx_cart") + MCFG_GENERIC_EXTENSIONS("lnx,lyx") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(lynx_state, lynx_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","lynx") +MACHINE_CONFIG_END + +#if 0 +static MACHINE_CONFIG_DERIVED( lynx2, lynx ) + + /* sound hardware */ + MCFG_DEVICE_REMOVE("mono") + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_DEVICE_REMOVE("lynx") + MCFG_SOUND_ADD("custom", LYNX2_SND, 0) + MCFG_LYNX_SND_SET_TIMER(lynx_state, sound_cb) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) +MACHINE_CONFIG_END +#endif + +/* these 2 dumps are saved from an running machine, + and therefor the rom byte at 0xfff9 is not readable! + (memory configuration) + these 2 dumps differ only in this byte! +*/ + +ROM_START(lynx) + ROM_REGION(0x200,"maincpu", 0) + ROM_SYSTEM_BIOS( 0, "default", "rom save" ) + ROMX_LOAD( "lynx.bin", 0x00000, 0x200, BAD_DUMP CRC(e1ffecb6) SHA1(de60f2263851bbe10e5801ef8f6c357a4bc077e6), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "a", "alternate rom save" ) + ROMX_LOAD( "lynxa.bin", 0x00000, 0x200, BAD_DUMP CRC(0d973c9d) SHA1(e4ed47fae31693e016b081c6bda48da5b70d7ccb), ROM_BIOS(2)) + + ROM_REGION(0x100,"gfx1", ROMREGION_ERASE00) +ROM_END + +#if 0 +ROM_START(lynx2) + ROM_REGION(0x200,"maincpu", 0) + ROM_LOAD("lynx2.bin", 0, 0x200, NO_DUMP) + + ROM_REGION(0x100,"gfx1", ROMREGION_ERASE00) +ROM_END +#endif + + +QUICKLOAD_LOAD_MEMBER( lynx_state, lynx ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + dynamic_buffer data; + UINT8 *rom = memregion("maincpu")->base(); + UINT8 header[10]; // 80 08 dw Start dw Len B S 9 3 + UINT16 start, length; + int i; + + if (image.fread( header, sizeof(header)) != sizeof(header)) + return IMAGE_INIT_FAIL; + + /* Check the image */ + if (lynx_verify_cart((char*)header, LYNX_QUICKLOAD) == IMAGE_VERIFY_FAIL) + return IMAGE_INIT_FAIL; + + start = header[3] | (header[2]<<8); //! big endian format in file format for little endian cpu + length = header[5] | (header[4]<<8); + length -= 10; + + data.resize(length); + + if (image.fread( &data[0], length) != length) + { + return IMAGE_INIT_FAIL; + } + + for (i = 0; i < length; i++) + space.write_byte(start + i, data[i]); + + rom[0x1fc] = start & 0xff; + rom[0x1fd] = start >> 8; + space.write_byte(0x1fc, start & 0xff); + space.write_byte(0x1fd, start >> 8); + + m_maincpu->set_pc(start); + + return IMAGE_INIT_PASS; +} + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1989, lynx, 0, 0, lynx, lynx, driver_device, 0, "Atari", "Lynx", MACHINE_SUPPORTS_SAVE ) +// CONS( 1991, lynx2, lynx, 0, lynx2, lynx, driver_device, 0, "Atari", "Lynx II", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/m20.c b/src/mame/drivers/m20.c new file mode 100644 index 00000000000..6ff98525238 --- /dev/null +++ b/src/mame/drivers/m20.c @@ -0,0 +1,860 @@ +// license:??? +// copyright-holders:Christian Grossler +/* + + Olivetti M20 skeleton driver, by incog (19/05/2009) + +Needs a proper Z8001 CPU core, check also + +ftp://ftp.groessler.org/pub/chris/olivetti_m20/misc/bios/rom.s + +--- + +APB notes: + +0xfc903 checks for the string TEST at 0x3f4-0x3f6, does an int 0xfe if so, unknown purpose + +Error codes: +Triangle Test CPU registers and instructions +Square Test ROM +4 vertical lines CPU call or trap instructions failed +Diamond Test system RAM +E C0 8255 parallel interface IC test failed +E C1 6845 CRT controller IC test failed +E C2 1797 floppy disk controller chip failed +E C3 8253 timer IC failed +E C4 8251 keyboard interface failed +E C5 8251 keyboard test failed +E C6 8259 PIC IC test failed +E K0 Keyboard did not respond +E K1 Keyboard responds, but self test failed +E D1 Disk drive 1 test failed +E D0 Disk drive 0 test failed +E I0 Non-vectored interrupt error +E I1 Vectored interrupt error + +*************************************************************************************************/ + + +#include "emu.h" +#include "cpu/z8000/z8000.h" +#include "cpu/i86/i86.h" +#include "video/mc6845.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "machine/i8251.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "formats/m20_dsk.h" +#include "formats/pc_dsk.h" +#include "machine/m20_kbd.h" +#include "bus/rs232/rs232.h" +#include "machine/m20_8086.h" + +class m20_state : public driver_device +{ +public: + m20_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_kbdi8251(*this, "i8251_1"), + m_ttyi8251(*this, "i8251_2"), + m_i8255(*this, "ppi8255"), + m_i8259(*this, "i8259"), + m_fd1797(*this, "fd1797"), + m_floppy0(*this, "fd1797:0:5dd"), + m_floppy1(*this, "fd1797:1:5dd"), + m_apb(*this, "apb"), + m_p_videoram(*this, "p_videoram"), + m_palette(*this, "palette") + { + } + + required_device m_maincpu; + required_device m_ram; + required_device m_kbdi8251; + required_device m_ttyi8251; + required_device m_i8255; + required_device m_i8259; + required_device m_fd1797; + required_device m_floppy0; + required_device m_floppy1; + optional_device m_apb; + + required_shared_ptr m_p_videoram; + required_device m_palette; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ16_MEMBER(m20_i8259_r); + DECLARE_WRITE16_MEMBER(m20_i8259_w); + DECLARE_READ16_MEMBER(port21_r); + DECLARE_WRITE16_MEMBER(port21_w); + DECLARE_WRITE_LINE_MEMBER(tty_clock_tick_w); + DECLARE_WRITE_LINE_MEMBER(kbd_clock_tick_w); + DECLARE_WRITE_LINE_MEMBER(timer_tick_w); + DECLARE_WRITE_LINE_MEMBER(halt_apb_w); + DECLARE_WRITE_LINE_MEMBER(int_w); + MC6845_UPDATE_ROW(update_row); + +private: + offs_t m_memsize; + UINT8 m_port21; + void install_memory(); + +public: + DECLARE_FLOPPY_FORMATS( floppy_formats ); + IRQ_CALLBACK_MEMBER(m20_irq_callback); +}; + + +#define MAIN_CLOCK 4000000 /* 4 MHz */ +#define PIXEL_CLOCK XTAL_4_433619MHz + + +MC6845_UPDATE_ROW( m20_state::update_row ) +{ + UINT32 *p = &bitmap.pix32(y); + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int i, j; + + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ((ma | (ra << 1)) << 4) + i; + UINT16 data = m_p_videoram[ offset ]; + + for ( j = 15; j >= 0; j-- ) + { + *p = palette[( data & 1 << j ) ? 1 : 0]; + p++; + } + } +} + +/* +port21 = 0x21 !TTL latch +! (see hw1 document, fig 2-33, pg 2-47) +! Output Input +! ====== ===== +! B0 0 selects floppy 0 +! 1 deselects floppy 0 +! B1 0 selects floppy 1 +! 1 deselects floppy 1 +! B2 Motor On (Not Used) +! B3 0 selects double density 0 => Skip basic tests +! 1 selects single density 1 => Perform basic tests +! Latched copy when B7 is written to Port21 +! B4 Uncommitted output 0 => 128K card(s) present +! 1 => 32K card(s) present +! Cannot mix types! +! B5 Uncommitted output 0 => 8-colour card present +! 1 => 4-colour card present +! B6 Uncommitted output 0 => RAM +! 1 => ROM (???) +! B7 See B3 input 0 => colour card present +*/ + +READ16_MEMBER(m20_state::port21_r) +{ + //printf("port21 read: offset 0x%x\n", offset); + return m_port21; +} + +WRITE16_MEMBER(m20_state::port21_w) +{ + //printf("port21 write: offset 0x%x, data 0x%x\n", offset, data); + m_port21 = (m_port21 & 0xf8) | (data & 0x7); + + // floppy drive select + if (data & 1) { + m_floppy0->mon_w(0); + m_fd1797->set_floppy(m_floppy0); + } + else + m_floppy0->mon_w(1); + + if (data & 2) { + m_floppy1->mon_w(0); + m_fd1797->set_floppy(m_floppy1); + } + else + m_floppy1->mon_w(1); + + if(!(data & 3)) + m_fd1797->set_floppy(NULL); + + // density select 1 - sd, 0 - dd + m_fd1797->dden_w(data & 8); +} + +READ16_MEMBER(m20_state::m20_i8259_r) +{ + return m_i8259->read(space, offset)<<1; +} + +WRITE16_MEMBER(m20_state::m20_i8259_w) +{ + m_i8259->write(space, offset, (data>>1)); +} + +WRITE_LINE_MEMBER( m20_state::tty_clock_tick_w ) +{ + m_ttyi8251->write_txc(state); + m_ttyi8251->write_rxc(state); +} + +WRITE_LINE_MEMBER( m20_state::kbd_clock_tick_w ) +{ + m_kbdi8251->write_txc(state); + m_kbdi8251->write_rxc(state); +} + +WRITE_LINE_MEMBER( m20_state::timer_tick_w ) +{ + /* Using HOLD_LINE is not completely correct: + * The output of the 8253 is connected to a 74LS74 flop chip. + * The output of the flop chip is connected to NVI CPU input. + * The flop is reset by a 1:8 decoder which compares CPU ST0-ST3 + * outputs to detect an interrupt acknowledge transaction. + * 8253 is programmed in square wave mode, not rate + * generator mode. + */ + if(m_apb) + m_apb->nvi_w(state); + m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? HOLD_LINE /*ASSERT_LINE*/ : CLEAR_LINE); +} + + +/* Memory map description (by courtesy of Dwight Elvey) + + DRAM0 = motherboard (128K) + DRAM1 = first slot from keyboard end + DRAM2 = second slot from keyboard end + DRAM3 = third slot from keyboard end + SRAM0 = memory window for expansion slot + ROM0 = ROM + +Expansion cards are either 32K or 128K. They cannot be mixed, all installed +cards need to be the same type. + +B/W, 32K cards, 3 cards => 224K of memory: +<0>0000 D DRAM0 4000 I DRAM0 4000 <8>0000 D DRAM0 18000 I DRAM0 8000 +<0>4000 D DRAM1 4000 I DRAM0 8000 <8>4000 D DRAM0 1C000 I DRAM0 C000 +<0>8000 D DRAM2 0000 I DRAM0 C000 <8>8000 D DRAM2 4000 I DRAM1 4000 +<0>C000 D DRAM2 4000 I DRAM0 10000 <8>C000 D DRAM3 0000 I DRAM2 0000 +<1>0000 D DRAM0 14000 I DRAM0 8000 <9>0000 D DRAM0 18000 I DRAM0 18000 +<1>4000 D DRAM0 18000 I DRAM0 C000 <9>4000 D DRAM0 1C000 I DRAM0 1C000 +<1>8000 D DRAM0 1C000 I DRAM0 10000 <9>8000 D DRAM2 4000 I DRAM2 4000 +<1>C000 D DRAM1 0000 I None <9>C000 D DRAM3 0000 I DRAM3 0000 +<2>0000 D DRAM0 14000 I DRAM0 14000 0000 D DRAM0 8000 I DRAM0 8000 +<2>4000 D DRAM0 18000 I DRAM0 18000 4000 D DRAM0 C000 I DRAM0 C000 +<2>8000 D DRAM0 1C000 I DRAM0 1C000 8000 D DRAM1 4000 I DRAM1 4000 +<2>C000 D DRAM1 0000 I DRAM1 0000 C000 D DRAM2 0000 I DRAM2 0000 +<3>0000 D DRAM0 0000 I DRAM0 0000 0000 D DRAM3 4000 I DRAM3 4000 +<3>4000 D None I None 4000 D None I None +<3>8000 D None I None 8000 D None I None +<3>C000 D None I None C000 D None I None +<4>0000 D ROM0 0000 I ROM0 0000 0000 D DRAM3 4000 I None +<4>4000 D DRAM3 0000 I ROM0 10000 4000 D None I None +<4>8000 D DRAM3 4000 I ROM0 14000 8000 D None I None +<4>C000 D None I ROM0 18000 C000 D None I None +<5>0000 D DRAM0 8000 I ROM0 10000 0000 D None I None +<5>4000 D DRAM0 C000 I ROM0 14000 4000 D None I None +<5>8000 D DRAM0 10000 I ROM0 18000 8000 D None I None +<5>C000 D SRAM0 0000 I SRAM0 0000 C000 D None I None +<6>0000 D DRAM0 8000 I DRAM0 8000 0000 D None I None +<6>4000 D DRAM0 C000 I DRAM0 C000 4000 D None I None +<6>8000 D DRAM0 10000 I DRAM0 10000 8000 D None I None +<6>C000 D None I None C000 D None I None +<7>0000 D ROM0 0000 I ROM0 0000 0000 D None I None +<7>4000 D ROM0 10000 I ROM0 10000 4000 D None I None +<7>8000 D ROM0 14000 I ROM0 14000 8000 D None I None +<7>C000 D ROM0 18000 I ROM0 18000 C000 D None I None + +B/W, 128K cards, 3 cards => 512K of memory: +<0>0000 D DRAM0 4000 I DRAM0 4000 <8>0000 D DRAM0 18000 I DRAM0 8000 +<0>4000 D DRAM1 4000 I DRAM0 8000 <8>4000 D DRAM0 1C000 I DRAM0 C000 +<0>8000 D DRAM2 0000 I DRAM0 C000 <8>8000 D DRAM1 C000 I DRAM1 4000 +<0>C000 D DRAM2 4000 I DRAM0 10000 <8>C000 D DRAM1 10000 I DRAM1 8000 +<1>0000 D DRAM0 14000 I DRAM0 8000 <9>0000 D DRAM0 18000 I DRAM0 18000 +<1>4000 D DRAM0 18000 I DRAM0 C000 <9>4000 D DRAM0 1C000 I DRAM0 1C000 +<1>8000 D DRAM0 1C000 I DRAM0 10000 <9>8000 D DRAM1 C000 I DRAM1 C000 +<1>C000 D DRAM1 0000 I None <9>C000 D DRAM1 10000 I DRAM1 10000 +<2>0000 D DRAM0 14000 I DRAM0 14000 0000 D DRAM0 8000 I DRAM0 8000 +<2>4000 D DRAM0 18000 I DRAM0 18000 4000 D DRAM0 C000 I DRAM0 C000 +<2>8000 D DRAM0 1C000 I DRAM0 1C000 8000 D DRAM1 4000 I DRAM1 4000 +<2>C000 D DRAM1 0000 I DRAM1 0000 C000 D DRAM1 8000 I DRAM1 8000 +<3>0000 D DRAM0 0000 I DRAM0 0000 0000 D DRAM1 14000 I DRAM1 14000 +<3>4000 D None I None 4000 D DRAM1 18000 I DRAM1 18000 +<3>8000 D None I None 8000 D DRAM1 1C000 I DRAM1 1C000 +<3>C000 D None I None C000 D DRAM2 0000 I DRAM2 0000 +<4>0000 D ROM0 0000 I ROM0 0000 0000 D DRAM2 4000 I DRAM2 4000 +<4>4000 D DRAM3 0000 I None 4000 D DRAM2 8000 I DRAM2 8000 +<4>8000 D DRAM3 4000 I None 8000 D DRAM2 C000 I DRAM2 C000 +<4>C000 D None I None C000 D DRAM2 10000 I DRAM2 10000 +<5>0000 D DRAM0 8000 I ROM0 10000 0000 D DRAM2 14000 I DRAM2 14000 +<5>4000 D DRAM0 C000 I ROM0 14000 4000 D DRAM2 18000 I DRAM2 18000 +<5>8000 D DRAM0 10000 I ROM0 18000 8000 D DRAM2 1C000 I DRAM2 1C000 +<5>C000 D SRAM0 0000 I SRAM0 0000 C000 D DRAM3 0000 I DRAM3 0000 +<6>0000 D DRAM0 8000 I DRAM0 8000 0000 D DRAM3 4000 I DRAM3 4000 +<6>4000 D DRAM0 C000 I DRAM0 C000 4000 D DRAM3 8000 I DRAM3 8000 +<6>8000 D DRAM0 10000 I DRAM0 10000 8000 D DRAM3 C000 I DRAM3 C000 +<6>C000 D None I None C000 D DRAM3 10000 I DRAM3 10000 +<7>0000 D ROM0 0000 I ROM0 0000 0000 D DRAM3 14000 I DRAM3 14000 +<7>4000 D ROM0 10000 I ROM0 10000 4000 D DRAM3 18000 I DRAM3 18000 +<7>8000 D ROM0 14000 I ROM0 14000 8000 D DRAM3 1C000 I DRAM3 1C000 +<7>C000 D ROM0 18000 I ROM0 18000 C000 D DRAM3 0000 I DRAM3 0000 +*/ + + +static ADDRESS_MAP_START(m20_program_mem, AS_PROGRAM, 16, m20_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x30000, 0x33fff ) AM_RAM AM_SHARE("p_videoram") + AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu", 0x00000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(m20_data_mem, AS_DATA, 16, m20_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x30000, 0x33fff ) AM_RAM AM_SHARE("p_videoram") + AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu", 0x00000) +ADDRESS_MAP_END + + +void m20_state::install_memory() +{ + m_memsize = m_ram->size(); + UINT8 *memptr = m_ram->pointer(); + address_space& pspace = m_maincpu->space(AS_PROGRAM); + address_space& dspace = m_maincpu->space(AS_DATA); + + /* install mainboard memory (aka DRAM0) */ + + /* <0>0000 */ + pspace.install_readwrite_bank(0x0000, 0x3fff, 0x3fff, 0, "dram0_4000"); + dspace.install_readwrite_bank(0x0000, 0x3fff, 0x3fff, 0, "dram0_4000"); + /* <0>4000 */ + pspace.install_readwrite_bank(0x4000, 0x7fff, 0x3fff, 0, "dram0_8000"); + /* <0>8000 */ + pspace.install_readwrite_bank(0x8000, 0xbfff, 0x3fff, 0, "dram0_c000"); + /* <0>C000 */ + pspace.install_readwrite_bank(0xc000, 0xcfff, 0x3fff, 0, "dram0_10000"); + /* <1>0000 */ + pspace.install_readwrite_bank(0x10000, 0x13fff, 0x3fff, 0, "dram0_8000"); + dspace.install_readwrite_bank(0x10000, 0x13fff, 0x3fff, 0, "dram0_14000"); + /* <1>4000 */ + pspace.install_readwrite_bank(0x14000, 0x17fff, 0x3fff, 0, "dram0_c000"); + dspace.install_readwrite_bank(0x14000, 0x17fff, 0x3fff, 0, "dram0_18000"); + /* <1>8000 */ + pspace.install_readwrite_bank(0x18000, 0x1bfff, 0x3fff, 0, "dram0_10000"); + dspace.install_readwrite_bank(0x18000, 0x1bfff, 0x3fff, 0, "dram0_1c000"); + /* <1>c000 empty*/ + /* <2>0000 */ + pspace.install_readwrite_bank(0x20000, 0x23fff, 0x3fff, 0, "dram0_14000"); + dspace.install_readwrite_bank(0x20000, 0x23fff, 0x3fff, 0, "dram0_14000"); + /* <2>4000 */ + pspace.install_readwrite_bank(0x24000, 0x27fff, 0x3fff, 0, "dram0_18000"); + dspace.install_readwrite_bank(0x24000, 0x27fff, 0x3fff, 0, "dram0_18000"); + /* <2>8000 */ + pspace.install_readwrite_bank(0x28000, 0x2bfff, 0x3fff, 0, "dram0_1c000"); + dspace.install_readwrite_bank(0x28000, 0x2bfff, 0x3fff, 0, "dram0_1c000"); + /* <2>c000 empty*/ + /* <3>0000 (video buffer) + pspace.install_readwrite_bank(0x30000, 0x33fff, 0x3fff, 0, "dram0_0000"); + dspace.install_readwrite_bank(0x30000, 0x33fff, 0x3fff, 0, "dram0_0000"); + */ + + /* <5>0000 */ + dspace.install_readwrite_bank(0x50000, 0x53fff, 0x3fff, 0, "dram0_8000"); + /* <5>4000 */ + dspace.install_readwrite_bank(0x54000, 0x57fff, 0x3fff, 0, "dram0_c000"); + /* <5>8000 */ + dspace.install_readwrite_bank(0x58000, 0x5bfff, 0x3fff, 0, "dram0_10000"); + /* <5>c000 expansion bus */ + /* <6>0000 */ + pspace.install_readwrite_bank(0x60000, 0x63fff, 0x3fff, 0, "dram0_8000"); + dspace.install_readwrite_bank(0x60000, 0x63fff, 0x3fff, 0, "dram0_8000"); + /* <6>4000 */ + pspace.install_readwrite_bank(0x64000, 0x67fff, 0x3fff, 0, "dram0_c000"); + dspace.install_readwrite_bank(0x64000, 0x67fff, 0x3fff, 0, "dram0_c000"); + /* <6>8000 */ + pspace.install_readwrite_bank(0x68000, 0x6bfff, 0x3fff, 0, "dram0_10000"); + dspace.install_readwrite_bank(0x68000, 0x6bfff, 0x3fff, 0, "dram0_10000"); + /* <6>c000 empty*/ + /* segment <7> expansion ROM? */ + /* <8>0000 */ + pspace.install_readwrite_bank(0x80000, 0x83fff, 0x3fff, 0, "dram0_8000"); + dspace.install_readwrite_bank(0x80000, 0x83fff, 0x3fff, 0, "dram0_18000"); + /* <8>4000 */ + pspace.install_readwrite_bank(0x84000, 0x87fff, 0x3fff, 0, "dram0_c000"); + dspace.install_readwrite_bank(0x84000, 0x87fff, 0x3fff, 0, "dram0_1c000"); + /* <9>0000 */ + pspace.install_readwrite_bank(0x90000, 0x93fff, 0x3fff, 0, "dram0_18000"); + dspace.install_readwrite_bank(0x90000, 0x93fff, 0x3fff, 0, "dram0_18000"); + /* <9>4000 */ + pspace.install_readwrite_bank(0x94000, 0x97fff, 0x3fff, 0, "dram0_1c000"); + dspace.install_readwrite_bank(0x94000, 0x97fff, 0x3fff, 0, "dram0_1c000"); + /* 0000 */ + pspace.install_readwrite_bank(0xa0000, 0xa3fff, 0x3fff, 0, "dram0_8000"); + dspace.install_readwrite_bank(0xa0000, 0xa3fff, 0x3fff, 0, "dram0_8000"); + /* 4000 */ + pspace.install_readwrite_bank(0xa4000, 0xa7fff, 0x3fff, 0, "dram0_c000"); + dspace.install_readwrite_bank(0xa4000, 0xa7fff, 0x3fff, 0, "dram0_c000"); + + //membank("dram0_0000")->set_base(memptr); + membank("dram0_4000")->set_base(memptr + 0x4000); + membank("dram0_8000")->set_base(memptr + 0x8000); + membank("dram0_c000")->set_base(memptr + 0xc000); + membank("dram0_10000")->set_base(memptr + 0x10000); + membank("dram0_14000")->set_base(memptr + 0x14000); + membank("dram0_18000")->set_base(memptr + 0x18000); + membank("dram0_1c000")->set_base(memptr + 0x1c000); + + if (m_memsize > 128 * 1024) { + /* install memory expansions (DRAM1..DRAM3) */ + + if (m_memsize < 256 * 1024) { + /* 32K expansion cards */ + + /* DRAM1, 32K */ + + /* prog + AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000") + AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram1_4000") + AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000") + */ + pspace.install_readwrite_bank(0x2c000, 0x2ffff, 0x3fff, 0, "dram1_0000"); + pspace.install_readwrite_bank(0x88000, 0x8bfff, 0x3fff, 0, "dram1_4000"); + pspace.install_readwrite_bank(0xa8000, 0xabfff, 0x3fff, 0, "dram1_4000"); + + /* + data + AM_RANGE( 0x04000, 0x07fff ) AM_RAM AM_SHARE("dram1_4000") + AM_RANGE( 0x1c000, 0x1ffff ) AM_RAM AM_SHARE("dram1_0000") + AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000") + AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000") + */ + dspace.install_readwrite_bank(0x4000, 0x7fff, 0x3fff, 0, "dram1_4000"); + dspace.install_readwrite_bank(0x1c000, 0x1ffff, 0x3fff, 0, "dram1_0000"); + dspace.install_readwrite_bank(0x2c000, 0x2ffff, 0x3fff, 0, "dram1_0000"); + dspace.install_readwrite_bank(0xa8000, 0xabfff, 0x3fff, 0, "dram1_4000"); + + membank("dram1_0000")->set_base(memptr + 0x20000); + membank("dram1_4000")->set_base(memptr + 0x24000); + + if (m_memsize > 128 * 1024 + 32768) { + /* DRAM2, 32K */ + + /* prog + AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram2_0000") + AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram2_4000") + AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram2_0000") + */ + pspace.install_readwrite_bank(0x8c000, 0x8ffff, 0x3fff, 0, "dram2_0000"); + pspace.install_readwrite_bank(0x98000, 0x9bfff, 0x3fff, 0, "dram2_4000"); + pspace.install_readwrite_bank(0xac000, 0xaffff, 0x3fff, 0, "dram2_0000"); + + /* data + AM_RANGE( 0x08000, 0x0bfff ) AM_RAM AM_SHARE("dram2_0000") + AM_RANGE( 0x0c000, 0x0ffff ) AM_RAM AM_SHARE("dram2_4000") + AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram2_4000") + AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram2_4000") + AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram2_0000") + */ + dspace.install_readwrite_bank(0x8000, 0xbfff, 0x3fff, 0, "dram2_0000"); + dspace.install_readwrite_bank(0xc000, 0xffff, 0x3fff, 0, "dram2_4000"); + dspace.install_readwrite_bank(0x88000, 0x8bfff, 0x3fff, 0, "dram2_4000"); + dspace.install_readwrite_bank(0x98000, 0x9bfff, 0x3fff, 0, "dram2_4000"); + dspace.install_readwrite_bank(0xac000, 0xaffff, 0x3fff, 0, "dram2_0000"); + + membank("dram2_0000")->set_base(memptr + 0x28000); + membank("dram2_4000")->set_base(memptr + 0x2c000); + } + if (m_memsize > 128 * 1024 + 2 * 32768) { + /* DRAM3, 32K */ + + /* prog + AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram3_0000") + AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram3_4000") + */ + pspace.install_readwrite_bank(0x9c000, 0x9ffff, 0x3fff, 0, "dram3_0000"); + pspace.install_readwrite_bank(0xb0000, 0xb3fff, 0x3fff, 0, "dram3_4000"); + + /* data + AM_RANGE( 0x44000, 0x47fff ) AM_RAM AM_SHARE("dram3_0000") + AM_RANGE( 0x48000, 0x4bfff ) AM_RAM AM_SHARE("dram3_4000") + AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram3_0000") + AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram3_0000") + AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram3_4000") + AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM AM_SHARE("dram3_4000") + */ + dspace.install_readwrite_bank(0x44000, 0x47fff, 0x3fff, 0, "dram3_0000"); + dspace.install_readwrite_bank(0x48000, 0x4bfff, 0x3fff, 0, "dram3_4000"); + dspace.install_readwrite_bank(0x8c000, 0x8ffff, 0x3fff, 0, "dram3_0000"); + dspace.install_readwrite_bank(0x9c000, 0x9ffff, 0x3fff, 0, "dram3_0000"); + dspace.install_readwrite_bank(0xb0000, 0xb3fff, 0x3fff, 0, "dram3_4000"); + dspace.install_readwrite_bank(0xc0000, 0xc3fff, 0x3fff, 0, "dram3_4000"); + + membank("dram3_0000")->set_base(memptr + 0x30000); + membank("dram3_4000")->set_base(memptr + 0x34000); + } + } + else { + /* 128K expansion cards */ + + /* DRAM1, 128K */ + + /* prog + AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000") + AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram1_4000") + AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram1_8000") + AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram1_c000") + AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram1_10000") + AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000") + AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram1_8000") + AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram1_14000") + AM_RANGE( 0xb4000, 0xb7fff ) AM_RAM AM_SHARE("dram1_18000") + AM_RANGE( 0xb8000, 0xbbfff ) AM_RAM AM_SHARE("dram1_1c000") + */ + pspace.install_readwrite_bank(0x2c000, 0x2ffff, 0x3fff, 0, "dram1_0000"); + pspace.install_readwrite_bank(0x88000, 0x8bfff, 0x3fff, 0, "dram1_4000"); + pspace.install_readwrite_bank(0x8c000, 0x8ffff, 0x3fff, 0, "dram1_8000"); + pspace.install_readwrite_bank(0x98000, 0x9bfff, 0x3fff, 0, "dram1_c000"); + pspace.install_readwrite_bank(0x9c000, 0x9ffff, 0x3fff, 0, "dram1_10000"); + pspace.install_readwrite_bank(0xa8000, 0xabfff, 0x3fff, 0, "dram1_4000"); + pspace.install_readwrite_bank(0xac000, 0xaffff, 0x3fff, 0, "dram1_8000"); + pspace.install_readwrite_bank(0xb0000, 0xb3fff, 0x3fff, 0, "dram1_14000"); + pspace.install_readwrite_bank(0xb4000, 0xb7fff, 0x3fff, 0, "dram1_18000"); + pspace.install_readwrite_bank(0xb8000, 0xbbfff, 0x3fff, 0, "dram1_1c000"); + + /* data + AM_RANGE( 0x04000, 0x07fff ) AM_RAM AM_SHARE("dram1_4000") + AM_RANGE( 0x1c000, 0x1ffff ) AM_RAM AM_SHARE("dram1_0000") + AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000") + AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram1_c000") + AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram1_10000") + AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram1_c000") + AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram1_10000") + AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000") + AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram1_8000") + AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram1_14000") + AM_RANGE( 0xb4000, 0xb7fff ) AM_RAM AM_SHARE("dram1_18000") + AM_RANGE( 0xb8000, 0xbbfff ) AM_RAM AM_SHARE("dram1_1c000") + */ + dspace.install_readwrite_bank(0x4000, 0x7fff, 0x3fff, 0, "dram1_4000"); + dspace.install_readwrite_bank(0x1c000, 0x1ffff, 0x3fff, 0, "dram1_0000"); + dspace.install_readwrite_bank(0x2c000, 0x2ffff, 0x3fff, 0, "dram1_0000"); + dspace.install_readwrite_bank(0x88000, 0x8bfff, 0x3fff, 0, "dram1_c000"); + dspace.install_readwrite_bank(0x8c000, 0x8ffff, 0x3fff, 0, "dram1_10000"); + dspace.install_readwrite_bank(0x98000, 0x9bfff, 0x3fff, 0, "dram1_c000"); + dspace.install_readwrite_bank(0x9c000, 0x9ffff, 0x3fff, 0, "dram1_10000"); + dspace.install_readwrite_bank(0xa8000, 0xabfff, 0x3fff, 0, "dram1_4000"); + dspace.install_readwrite_bank(0xac000, 0xaffff, 0x3fff, 0, "dram1_8000"); + dspace.install_readwrite_bank(0xb0000, 0xb3fff, 0x3fff, 0, "dram1_14000"); + dspace.install_readwrite_bank(0xb4000, 0xb7fff, 0x3fff, 0, "dram1_18000"); + dspace.install_readwrite_bank(0xb8000, 0xbbfff, 0x3fff, 0, "dram1_1c000"); + + membank("dram1_0000")->set_base(memptr + 0x20000); + membank("dram1_4000")->set_base(memptr + 0x24000); + membank("dram1_8000")->set_base(memptr + 0x28000); + membank("dram1_c000")->set_base(memptr + 0x2c000); + membank("dram1_10000")->set_base(memptr + 0x30000); + membank("dram1_14000")->set_base(memptr + 0x34000); + membank("dram1_18000")->set_base(memptr + 0x38000); + membank("dram1_1c000")->set_base(memptr + 0x3c000); + + if (m_memsize > 256 * 1024) { + /* DRAM2, 128K */ + + /* prog + AM_RANGE( 0xbc000, 0xbffff ) AM_RAM AM_SHARE("dram2_0000") + + AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM AM_SHARE("dram2_4000") + AM_RANGE( 0xc4000, 0xc7fff ) AM_RAM AM_SHARE("dram2_8000") + AM_RANGE( 0xc8000, 0xcbfff ) AM_RAM AM_SHARE("dram2_c000") + AM_RANGE( 0xcc000, 0xcffff ) AM_RAM AM_SHARE("dram2_10000") + + AM_RANGE( 0xd0000, 0xd3fff ) AM_RAM AM_SHARE("dram2_14000") + AM_RANGE( 0xd4000, 0xd7fff ) AM_RAM AM_SHARE("dram2_18000") + AM_RANGE( 0xd8000, 0xdbfff ) AM_RAM AM_SHARE("dram2_1c000") + */ + pspace.install_readwrite_bank(0xbc000, 0xbffff, 0x3fff, 0, "dram2_0000"); + pspace.install_readwrite_bank(0xc0000, 0xc3fff, 0x3fff, 0, "dram2_4000"); + pspace.install_readwrite_bank(0xc4000, 0xc7fff, 0x3fff, 0, "dram2_8000"); + pspace.install_readwrite_bank(0xc8000, 0xcbfff, 0x3fff, 0, "dram2_c000"); + pspace.install_readwrite_bank(0xcc000, 0xcffff, 0x3fff, 0, "dram2_10000"); + pspace.install_readwrite_bank(0xd0000, 0xd3fff, 0x3fff, 0, "dram2_14000"); + pspace.install_readwrite_bank(0xd4000, 0xd7fff, 0x3fff, 0, "dram2_18000"); + pspace.install_readwrite_bank(0xd8000, 0xdbfff, 0x3fff, 0, "dram2_1c000"); + + /* data + AM_RANGE( 0x08000, 0x0bfff ) AM_RAM AM_SHARE("dram2_0000") + AM_RANGE( 0x0c000, 0x0ffff ) AM_RAM AM_SHARE("dram2_4000") + + AM_RANGE( 0xbc000, 0xbffff ) AM_RAM AM_SHARE("dram2_0000") + + AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM AM_SHARE("dram2_4000") + AM_RANGE( 0xc4000, 0xc7fff ) AM_RAM AM_SHARE("dram2_8000") + AM_RANGE( 0xc8000, 0xcbfff ) AM_RAM AM_SHARE("dram2_c000") + AM_RANGE( 0xcc000, 0xcffff ) AM_RAM AM_SHARE("dram2_10000") + + AM_RANGE( 0xd0000, 0xd3fff ) AM_RAM AM_SHARE("dram2_14000") + AM_RANGE( 0xd4000, 0xd7fff ) AM_RAM AM_SHARE("dram2_18000") + AM_RANGE( 0xd8000, 0xdbfff ) AM_RAM AM_SHARE("dram2_1c000") + */ + dspace.install_readwrite_bank(0x8000, 0xbfff, 0x3fff, 0, "dram2_0000"); + dspace.install_readwrite_bank(0xc000, 0xffff, 0x3fff, 0, "dram2_4000"); + dspace.install_readwrite_bank(0xbc000, 0xbffff, 0x3fff, 0, "dram2_0000"); + dspace.install_readwrite_bank(0xc0000, 0xc3fff, 0x3fff, 0, "dram2_4000"); + dspace.install_readwrite_bank(0xc4000, 0xc7fff, 0x3fff, 0, "dram2_8000"); + dspace.install_readwrite_bank(0xc8000, 0xcbfff, 0x3fff, 0, "dram2_c000"); + dspace.install_readwrite_bank(0xcc000, 0xcffff, 0x3fff, 0, "dram2_10000"); + dspace.install_readwrite_bank(0xd0000, 0xd3fff, 0x3fff, 0, "dram2_14000"); + dspace.install_readwrite_bank(0xd4000, 0xd7fff, 0x3fff, 0, "dram2_18000"); + dspace.install_readwrite_bank(0xd8000, 0xdbfff, 0x3fff, 0, "dram2_1c000"); + + membank("dram2_0000")->set_base(memptr + 0x40000); + membank("dram2_4000")->set_base(memptr + 0x44000); + membank("dram2_8000")->set_base(memptr + 0x48000); + membank("dram2_c000")->set_base(memptr + 0x4c000); + membank("dram2_10000")->set_base(memptr + 0x50000); + membank("dram2_14000")->set_base(memptr + 0x54000); + membank("dram2_18000")->set_base(memptr + 0x58000); + membank("dram2_1c000")->set_base(memptr + 0x5c000); + } + if (m_memsize > 384 * 1024) { + /* DRAM3, 128K */ + + /* prog + AM_RANGE( 0xdc000, 0xdffff ) AM_RAM AM_SHARE("dram3_0000") + + AM_RANGE( 0xe0000, 0xe3fff ) AM_RAM AM_SHARE("dram3_4000") + AM_RANGE( 0xe4000, 0xe7fff ) AM_RAM AM_SHARE("dram3_8000") + AM_RANGE( 0xe8000, 0xebfff ) AM_RAM AM_SHARE("dram3_c000") + AM_RANGE( 0xec000, 0xeffff ) AM_RAM AM_SHARE("dram3_10000") + + AM_RANGE( 0xf0000, 0xf3fff ) AM_RAM AM_SHARE("dram3_14000") + AM_RANGE( 0xf4000, 0xf7fff ) AM_RAM AM_SHARE("dram3_18000") + AM_RANGE( 0xf8000, 0xfbfff ) AM_RAM AM_SHARE("dram3_1c000") + AM_RANGE( 0xfc000, 0xfffff ) AM_RAM AM_SHARE("dram3_0000") + */ + pspace.install_readwrite_bank(0xdc000, 0xdffff, 0x3fff, 0, "dram3_0000"); + pspace.install_readwrite_bank(0xe0000, 0xe3fff, 0x3fff, 0, "dram3_4000"); + pspace.install_readwrite_bank(0xe4000, 0xe7fff, 0x3fff, 0, "dram3_8000"); + pspace.install_readwrite_bank(0xe8000, 0xebfff, 0x3fff, 0, "dram3_c000"); + pspace.install_readwrite_bank(0xec000, 0xeffff, 0x3fff, 0, "dram3_10000"); + pspace.install_readwrite_bank(0xf0000, 0xf3fff, 0x3fff, 0, "dram3_14000"); + pspace.install_readwrite_bank(0xf4000, 0xf7fff, 0x3fff, 0, "dram3_18000"); + pspace.install_readwrite_bank(0xf8000, 0xfbfff, 0x3fff, 0, "dram3_1c000"); + pspace.install_readwrite_bank(0xfc000, 0xfffff, 0x3fff, 0, "dram3_0000"); + + /* data + AM_RANGE( 0x44000, 0x47fff ) AM_RAM AM_SHARE("dram3_0000") + AM_RANGE( 0x48000, 0x4bfff ) AM_RAM AM_SHARE("dram3_4000") + AM_RANGE( 0xdc000, 0xdffff ) AM_RAM AM_SHARE("dram3_0000") + + AM_RANGE( 0xe0000, 0xe3fff ) AM_RAM AM_SHARE("dram3_4000") + AM_RANGE( 0xe4000, 0xe7fff ) AM_RAM AM_SHARE("dram3_8000") + AM_RANGE( 0xe8000, 0xebfff ) AM_RAM AM_SHARE("dram3_c000") + AM_RANGE( 0xec000, 0xeffff ) AM_RAM AM_SHARE("dram3_10000") + + AM_RANGE( 0xf0000, 0xf3fff ) AM_RAM AM_SHARE("dram3_14000") + AM_RANGE( 0xf4000, 0xf7fff ) AM_RAM AM_SHARE("dram3_18000") + AM_RANGE( 0xf8000, 0xfbfff ) AM_RAM AM_SHARE("dram3_1c000") + AM_RANGE( 0xfc000, 0xfffff ) AM_RAM AM_SHARE("dram3_0000") + */ + dspace.install_readwrite_bank(0x44000, 0x47fff, 0x3fff, 0, "dram3_0000"); + dspace.install_readwrite_bank(0x48000, 0x4bfff, 0x3fff, 0, "dram3_4000"); + dspace.install_readwrite_bank(0xdc000, 0xdffff, 0x3fff, 0, "dram3_0000"); + dspace.install_readwrite_bank(0xe0000, 0xe3fff, 0x3fff, 0, "dram3_4000"); + dspace.install_readwrite_bank(0xe4000, 0xe7fff, 0x3fff, 0, "dram3_8000"); + dspace.install_readwrite_bank(0xe8000, 0xebfff, 0x3fff, 0, "dram3_c000"); + dspace.install_readwrite_bank(0xec000, 0xeffff, 0x3fff, 0, "dram3_10000"); + dspace.install_readwrite_bank(0xf0000, 0xf3fff, 0x3fff, 0, "dram3_14000"); + dspace.install_readwrite_bank(0xf4000, 0xf7fff, 0x3fff, 0, "dram3_18000"); + dspace.install_readwrite_bank(0xf8000, 0xfbfff, 0x3fff, 0, "dram3_1c000"); + dspace.install_readwrite_bank(0xfc000, 0xfffff, 0x3fff, 0, "dram3_0000"); + + membank("dram3_0000")->set_base(memptr + 0x60000); + membank("dram3_4000")->set_base(memptr + 0x64000); + membank("dram3_8000")->set_base(memptr + 0x68000); + membank("dram3_c000")->set_base(memptr + 0x6c000); + membank("dram3_10000")->set_base(memptr + 0x70000); + membank("dram3_14000")->set_base(memptr + 0x74000); + membank("dram3_18000")->set_base(memptr + 0x78000); + membank("dram3_1c000")->set_base(memptr + 0x7c000); + } + } + } +} + +static ADDRESS_MAP_START(m20_io, AS_IO, 16, m20_state) + ADDRESS_MAP_UNMAP_HIGH + + AM_RANGE(0x00, 0x07) AM_DEVREADWRITE8("fd1797", fd1797_t, read, write, 0x00ff) + + AM_RANGE(0x20, 0x21) AM_READWRITE(port21_r, port21_w); + + AM_RANGE(0x60, 0x61) AM_DEVWRITE8("crtc", mc6845_device, address_w, 0x00ff) + AM_RANGE(0x62, 0x63) AM_DEVWRITE8("crtc", mc6845_device, address_w, 0xff00) // FIXME + AM_RANGE(0x62, 0x63) AM_DEVREADWRITE8("crtc", mc6845_device, register_r, register_w, 0x00ff) + AM_RANGE(0x64, 0x65) AM_DEVREADWRITE8("crtc", mc6845_device, register_r, register_w, 0xff00) + + AM_RANGE(0x80, 0x87) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0x00ff) + + AM_RANGE(0xa0, 0xa1) AM_DEVREADWRITE8("i8251_1", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xa2, 0xa3) AM_DEVREADWRITE8("i8251_1", i8251_device, status_r, control_w, 0x00ff) + + AM_RANGE(0xc0, 0xc1) AM_DEVREADWRITE8("i8251_2", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xc2, 0xc3) AM_DEVREADWRITE8("i8251_2", i8251_device, status_r, control_w, 0x00ff) + + AM_RANGE(0x120, 0x127) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0x00ff) + + AM_RANGE(0x140, 0x143) AM_READWRITE(m20_i8259_r, m20_i8259_w) + + AM_RANGE(0x3ffa, 0x3ffd) AM_DEVWRITE("apb", m20_8086_device, handshake_w) +ADDRESS_MAP_END + +IRQ_CALLBACK_MEMBER(m20_state::m20_irq_callback) +{ + if (! irqline) + return 0xff; // NVI, value ignored + else + return m_i8259->acknowledge(); +} + +WRITE_LINE_MEMBER(m20_state::int_w) +{ + if(m_apb && !m_apb->halted()) + m_apb->vi_w(state); + m_maincpu->set_input_line(INPUT_LINE_IRQ1, state ? ASSERT_LINE : CLEAR_LINE); +} + +void m20_state::machine_start() +{ + install_memory(); +} + +void m20_state::machine_reset() +{ + UINT8 *ROM = memregion("maincpu")->base(); + UINT8 *RAM = (UINT8 *)(m_ram->pointer() + 0x4000); + + if (m_memsize >= 256 * 1024) + m_port21 = 0xdf; + else + m_port21 = 0xff; + + if(system_bios() > 0) // bits have different meanings? + m_port21 &= ~8; + + m_fd1797->reset(); + + memcpy(RAM, ROM, 8); // we need only the reset vector + m_maincpu->reset(); // reset the CPU to ensure it picks up the new vector + if(m_apb) + m_apb->m_8086->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); +} + + +static SLOT_INTERFACE_START( m20_floppies ) + SLOT_INTERFACE( "5dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( m20_state::floppy_formats ) + FLOPPY_M20_FORMAT, + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START(keyboard) + SLOT_INTERFACE("m20", M20_KEYBOARD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( m20, m20_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z8001, MAIN_CLOCK) + MCFG_CPU_PROGRAM_MAP(m20_program_mem) + MCFG_CPU_DATA_MAP(m20_data_mem) + MCFG_CPU_IO_MAP(m20_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(m20_state,m20_irq_callback) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("160K") + MCFG_RAM_DEFAULT_VALUE(0) + MCFG_RAM_EXTRA_OPTIONS("128K,192K,224K,256K,384K,512K") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* Devices */ + MCFG_FD1797_ADD("fd1797", 1000000) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("i8259", pic8259_device, ir0_w)) + MCFG_FLOPPY_DRIVE_ADD("fd1797:0", m20_floppies, "5dd", m20_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1797:1", m20_floppies, "5dd", m20_state::floppy_formats) + + MCFG_MC6845_ADD("crtc", MC6845, "screen", PIXEL_CLOCK/8) /* hand tuned to get ~50 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(16) + MCFG_MC6845_UPDATE_ROW_CB(m20_state, update_row) + + MCFG_DEVICE_ADD("ppi8255", I8255A, 0) + + MCFG_DEVICE_ADD("i8251_1", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("kbd", rs232_port_device, write_txd)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("i8259", pic8259_device, ir4_w)) + + MCFG_DEVICE_ADD("i8251_2", I8251, 0) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(1230782) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(m20_state, tty_clock_tick_w)) + MCFG_PIT8253_CLK1(1230782) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m20_state, kbd_clock_tick_w)) + MCFG_PIT8253_CLK2(1230782) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(m20_state, timer_tick_w)) + + MCFG_PIC8259_ADD("i8259", WRITELINE(m20_state, int_w), VCC, NULL) + + MCFG_RS232_PORT_ADD("kbd", keyboard, "m20") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251_1", i8251_device, write_rxd)) + + MCFG_DEVICE_ADD("apb", M20_8086, 0) + + MCFG_SOFTWARE_LIST_ADD("flop_list","m20") +MACHINE_CONFIG_END + +ROM_START(m20) + ROM_REGION(0x2000,"maincpu", 0) + ROM_SYSTEM_BIOS( 0, "m20", "M20 1.0" ) + ROMX_LOAD("m20.bin", 0x0000, 0x2000, CRC(5c93d931) SHA1(d51025e087a94c55529d7ee8fd18ff4c46d93230), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "m20-20d", "M20 2.0d" ) + ROMX_LOAD("m20-20d.bin", 0x0000, 0x2000, CRC(cbe265a6) SHA1(c7cb9d9900b7b5014fcf1ceb2e45a66a91c564d0), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "m20-20f", "M20 2.0f" ) + ROMX_LOAD("m20-20f.bin", 0x0000, 0x2000, CRC(db7198d8) SHA1(149d8513867081d31c73c2965dabb36d5f308041), ROM_BIOS(3)) +ROM_END + +ROM_START(m40) + ROM_REGION(0x14000,"maincpu", 0) + ROM_SYSTEM_BIOS( 0, "m40-81", "M40 15.dec.81" ) + ROMX_LOAD( "m40rom-15-dec-81", 0x0000, 0x2000, CRC(e8e7df84) SHA1(e86018043bf5a23ff63434f9beef7ce2972d8153), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "m40-82", "M40 17.dec.82" ) + ROMX_LOAD( "m40rom-17-dec-82", 0x0000, 0x2000, CRC(cf55681c) SHA1(fe4ae14a6751fef5d7bde49439286f1da3689437), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "m40-41", "M40 4.1" ) + ROMX_LOAD( "m40rom-4.1", 0x0000, 0x2000, CRC(cf55681c) SHA1(fe4ae14a6751fef5d7bde49439286f1da3689437), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "m40-60", "M40 6.0" ) + ROMX_LOAD( "m40rom-6.0", 0x0000, 0x4000, CRC(8114ebec) SHA1(4e2c65b95718c77a87dbee0288f323bd1c8837a3), ROM_BIOS(4)) + + ROM_REGION(0x4000, "apb_bios", ROMREGION_ERASEFF) // Processor board with 8086 +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, m20, 0, 0, m20, 0, driver_device, 0, "Olivetti", "Olivetti L1 M20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1981, m40, m20, 0, m20, 0, driver_device, 0, "Olivetti", "Olivetti L1 M40", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/m24.c b/src/mame/drivers/m24.c new file mode 100644 index 00000000000..c9504ef6eec --- /dev/null +++ b/src/mame/drivers/m24.c @@ -0,0 +1,312 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#include "emu.h" + +#include "cpu/i86/i86.h" +#include "cpu/tms7000/tms7000.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "machine/m24_kbd.h" +#include "machine/m24_z8000.h" +#include "machine/mm58274c.h" +#include "includes/genpc.h" +#include "formats/pc_dsk.h" +#include "formats/naslite_dsk.h" +#include "formats/m20_dsk.h" + +class m24_state : public driver_device +{ +public: + m24_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_mb(*this, "mb"), + m_kbc(*this, "kbc"), + m_keyboard(*this, "keyboard"), + m_z8000_apb(*this, "z8000_apb") + { } + required_device m_maincpu; + required_device m_mb; + required_device m_kbc; + required_device m_keyboard; + optional_device m_z8000_apb; + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(keyboard_w); + DECLARE_READ8_MEMBER(pa_r); + DECLARE_WRITE8_MEMBER(pb_w); + DECLARE_READ8_MEMBER(kbcdata_r); + DECLARE_WRITE8_MEMBER(kbcdata_w); + DECLARE_WRITE_LINE_MEMBER(kbcin_w); + DECLARE_WRITE_LINE_MEMBER(dma_hrq_w); + DECLARE_WRITE_LINE_MEMBER(int_w); + DECLARE_WRITE_LINE_MEMBER(halt_i86_w); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + void machine_reset(); + + UINT8 m_sysctl, m_pa, m_kbcin, m_kbcout; + bool m_kbcibf, m_kbdata, m_i86_halt, m_i86_halt_perm; +}; + +void m24_state::machine_reset() +{ + m_sysctl = 0; + m_pa = 0x40; + m_kbcibf = false; + m_kbdata = true; + m_i86_halt = false; + m_i86_halt_perm = false; + if(m_z8000_apb) + m_z8000_apb->m_z8000->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); +} + +READ8_MEMBER(m24_state::keyboard_r) +{ + switch(offset) + { + case 0: + m_pa |= 0x40; + m_mb->m_pic8259->ir1_w(0); + return m_kbcout; + case 1: + return m_sysctl; + case 2: + return 0; + case 4: + return (m_kbcibf ? 2 : 0) | ((m_pa & 0x40) ? 0 : 1); + } + return 0xff; +} + +WRITE8_MEMBER(m24_state::keyboard_w) +{ + switch(offset) + { + case 0: + m_kbc->set_input_line(TMS7000_INT1_LINE, ASSERT_LINE); + m_kbcibf = true; + m_kbcin = data; + break; + case 1: + m_sysctl = data; + m_mb->m_pit8253->write_gate2(BIT(data, 0)); + m_mb->pc_speaker_set_spkrdata(BIT(data, 1)); + if(BIT(data, 6)) + m_pa |= 4; + else + m_pa &= ~4; + break; + case 5: + m_maincpu->set_input_line(INPUT_LINE_HALT, (data & 0x40) ? ASSERT_LINE : CLEAR_LINE); + m_i86_halt = true; + m_i86_halt_perm = true; + } +} + +READ8_MEMBER(m24_state::pa_r) +{ + return m_pa & (m_kbdata ? 0xff : 0xfd); +} + +WRITE8_MEMBER(m24_state::pb_w) +{ + m_keyboard->clock_w(!BIT(data, 0)); + m_keyboard->data_w(!BIT(data, 1)); + m_pa = (m_pa & ~3) | (~data & 3); +} + +READ8_MEMBER(m24_state::kbcdata_r) +{ + m_kbc->set_input_line(TMS7000_INT1_LINE, CLEAR_LINE); + m_kbcibf = false; + return m_kbcin; +} + +WRITE8_MEMBER(m24_state::kbcdata_w) +{ + m_pa &= ~0x40; + m_mb->m_pic8259->ir1_w(1); + m_kbcout = data; +} + +WRITE_LINE_MEMBER(m24_state::kbcin_w) +{ + m_kbdata = state; +} + +WRITE_LINE_MEMBER(m24_state::dma_hrq_w) +{ + if(!m_i86_halt) + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + if(m_z8000_apb && !m_z8000_apb->halted()) + m_z8000_apb->m_z8000->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + /* Assert HLDA */ + m_mb->m_dma8237->hack_w(state); +} + +WRITE_LINE_MEMBER(m24_state::int_w) +{ + if(!m_i86_halt) + m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); + if(m_z8000_apb && !m_z8000_apb->halted()) + m_z8000_apb->m_z8000->set_input_line(INPUT_LINE_IRQ1, state ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE_LINE_MEMBER(m24_state::halt_i86_w) +{ + if(m_i86_halt_perm) + return; + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + m_i86_halt = state ? true : false; +} + +static ADDRESS_MAP_START( m24_map, AS_PROGRAM, 16, m24_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xeffff) AM_NOP + AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(m24_io, AS_IO, 16, m24_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0060, 0x0065) AM_READWRITE8(keyboard_r, keyboard_w, 0xffff) + AM_RANGE(0x0066, 0x0067) AM_READ_PORT("DSW0") + AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("mm58174an", mm58274c_device, read, write, 0xffff) + AM_RANGE(0x80c0, 0x80c1) AM_DEVREADWRITE8("z8000_apb", m24_z8000_device, handshake_r, handshake_w, 0xff00) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(kbc_map, AS_PROGRAM, 8, m24_state) + AM_RANGE(0x8000, 0x8fff) AM_READ(kbcdata_r) + AM_RANGE(0xa000, 0xafff) AM_WRITE(kbcdata_w) + AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION("kbc", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(kbc_io, AS_IO, 8, m24_state) + AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(pa_r) + AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(pb_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( m24 ) + PORT_START("DSW0") + PORT_DIPNAME( 0x8f, 0x89, "RAM banks") + PORT_DIPSETTING( 0x01, "128K" ) + PORT_DIPSETTING( 0x82, "256K" ) + PORT_DIPSETTING( 0x84, "512K - 256/256" ) + PORT_DIPSETTING( 0x08, "512K - 512/0" ) + PORT_DIPSETTING( 0x85, "640K - 256/384" ) + PORT_DIPSETTING( 0x8d, "640K - 128/512" ) + PORT_DIPSETTING( 0x89, "640K - 512/128" ) + PORT_DIPNAME( 0x10, 0x00, "8087 installed") + PORT_DIPSETTING( 0x00, DEF_STR(No) ) + PORT_DIPSETTING( 0x10, DEF_STR(Yes) ) + PORT_DIPNAME( 0x20, 0x00, "Serial Port") + PORT_DIPSETTING( 0x20, "Z8530 SCC") + PORT_DIPSETTING( 0x00, "INS8250" ) + + //PORT_START("DSW1") + PORT_DIPNAME( 0x0100, 0x0000, "FDD Type") + PORT_DIPSETTING( 0x0000, "360K" ) + PORT_DIPSETTING( 0x0100, "720K" ) + PORT_DIPNAME( 0x0200, 0x0200, "FDD spinup") + PORT_DIPSETTING( 0x0000, "Slow" ) + PORT_DIPSETTING( 0x0200, "Fast" ) + PORT_DIPNAME( 0x0400, 0x0400, "HDD ROM") + PORT_DIPSETTING( 0x0000, "Internal" ) + PORT_DIPSETTING( 0x0400, "External" ) + PORT_DIPNAME( 0x0800, 0x0000, "Scroll rate") + PORT_DIPSETTING( 0x0800, "Slow" ) + PORT_DIPSETTING( 0x0000, "Fast") + PORT_DIPNAME( 0x3000, 0x2000, "Graphics adapter") + PORT_DIPSETTING( 0x0000, "EGA/VGA" ) + PORT_DIPSETTING( 0x1000, "Color 40x25" ) + PORT_DIPSETTING( 0x2000, "Color 80x25" ) + PORT_DIPSETTING( 0x3000, "Monochrome" ) + PORT_DIPNAME( 0xc000, 0x4000, "Number of floppy drives") + PORT_DIPSETTING( 0x0000, "1" ) + PORT_DIPSETTING( 0x4000, "2" ) + PORT_DIPSETTING( 0x8000, "3" ) + PORT_DIPSETTING( 0xc000, "4" ) +INPUT_PORTS_END + +FLOPPY_FORMATS_MEMBER( m24_state::floppy_formats ) + FLOPPY_PC_FORMAT, + FLOPPY_NASLITE_FORMAT, + FLOPPY_M20_FORMAT +FLOPPY_FORMATS_END + +static MACHINE_CONFIG_FRAGMENT( cfg_m20_format ) + MCFG_DEVICE_MODIFY("fdc:0") + static_cast(device)->set_formats(m24_state::floppy_formats); + + MCFG_DEVICE_MODIFY("fdc:1") + static_cast(device)->set_formats(m24_state::floppy_formats); +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( olivetti, m24_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_8MHz) + MCFG_CPU_PROGRAM_MAP(m24_map) + MCFG_CPU_IO_MAP(m24_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") + + MCFG_ISA8_SLOT_ADD("mb:isa", "mb1", pc_isa8_cards, "cga_m24", true) + MCFG_ISA8_SLOT_ADD("mb:isa", "mb2", pc_isa8_cards, "fdc_xt", true) + MCFG_SLOT_OPTION_MACHINE_CONFIG("fdc_xt", cfg_m20_format) + MCFG_ISA8_SLOT_ADD("mb:isa", "mb3", pc_isa8_cards, "lpt", true) + MCFG_ISA8_SLOT_ADD("mb:isa", "mb4", pc_isa8_cards, "com", true) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + MCFG_CPU_ADD("kbc", TMS7000, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(kbc_map) + MCFG_CPU_IO_MAP(kbc_io) + + MCFG_DEVICE_ADD("keyboard", M24_KEYBOARD, 0) + MCFG_M24_KEYBOARD_OUT_DATA_HANDLER(WRITELINE(m24_state, kbcin_w)) + + MCFG_DEVICE_ADD("mm58174an", MM58274C, 0) + MCFG_MM58274C_MODE24(1) // ? + MCFG_MM58274C_DAY1(1) // ? + + MCFG_DEVICE_ADD("z8000_apb", M24_Z8000, 0) + MCFG_M24_Z8000_HALT(WRITELINE(m24_state, halt_i86_w)) + MCFG_DEVICE_MODIFY("mb:dma8237") + MCFG_I8237_OUT_HREQ_CB(DEVWRITELINE(":", m24_state, dma_hrq_w)) + MCFG_DEVICE_MODIFY("mb:pic8259") + devcb = &pic8259_device::static_set_out_int_callback(*device, DEVCB_DEVWRITELINE(":", m24_state, int_w)); + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + +ROM_START( m24 ) + ROM_REGION16_LE(0x8000,"maincpu", 0) + ROMX_LOAD("olivetti_m24_version_1.43_high.bin",0x4001, 0x2000, CRC(04e697ba) SHA1(1066dcc849e6289b5ac6372c84a590e456d497a6), ROM_SKIP(1)) + ROMX_LOAD("olivetti_m24_version_1.43_low.bin", 0x4000, 0x2000, CRC(ff7e0f10) SHA1(13423011a9bae3f3193e8c199f98a496cab48c0f), ROM_SKIP(1)) + + ROM_REGION(0x800, "kbc", 0) + ROM_LOAD("pdbd.tms2516.keyboardmcureplacementdaughterboard_10u", 0x000, 0x800, CRC(b8c4c18a) SHA1(25b4c24e19ff91924c53557c66513ab242d926c6)) +ROM_END + +ROM_START( m240 ) + ROM_REGION16_LE(0x8000,"maincpu", 0) + ROMX_LOAD("olivetti_m240_pch5_2.04_high.bin", 0x0001, 0x4000, CRC(ceb97b59) SHA1(84fabbeab355e0a4c9445910f2b7d1ec98886642), ROM_SKIP(1)) + ROMX_LOAD("olivetti_m240_pch6_2.04_low.bin", 0x0000, 0x4000, CRC(c463aa94) SHA1(a30c763c1ace9f3ff79e7136b252d624108a50ae), ROM_SKIP(1)) + + // is this one the same? + ROM_REGION(0x800, "kbc", 0) + ROM_LOAD("pdbd.tms2516.keyboardmcureplacementdaughterboard_10u", 0x000, 0x800, BAD_DUMP CRC(b8c4c18a) SHA1(25b4c24e19ff91924c53557c66513ab242d926c6)) +ROM_END + +COMP( 1983, m24, ibm5150, 0, olivetti, m24, driver_device, 0, "Olivetti", "M24", MACHINE_NOT_WORKING) +COMP( 1987, m240, ibm5150, 0, olivetti, m24, driver_device, 0, "Olivetti", "M240", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/m5.c b/src/mame/drivers/m5.c new file mode 100644 index 00000000000..9912827631d --- /dev/null +++ b/src/mame/drivers/m5.c @@ -0,0 +1,726 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Sord m.5 + + http://www.retropc.net/mm/m5/ + http://www.museo8bits.es/wiki/index.php/Sord_M5 + http://k5.web.klfree.net/content/view/10/11/ + http://k5.web.klfree.net/images/stories/sord/m5heap.htm + +****************************************************************************/ + +/* + + TODO: + + - floppy + - SI-5 serial interface (8251, ROM) + - 64KB RAM expansions + +*/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "formats/m5_dsk.h" +#include "formats/sord_cas.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8255.h" +#include "machine/ram.h" +#include "machine/upd765.h" +#include "machine/z80ctc.h" +#include "sound/sn76496.h" +#include "video/tms9928a.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "includes/m5.h" + + + +//************************************************************************** +// MEMORY BANKING +//************************************************************************** + +WRITE_LINE_MEMBER( m5_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +//------------------------------------------------- +// sts_r - +//------------------------------------------------- + +READ8_MEMBER( m5_state::sts_r ) +{ + /* + + bit description + + 0 cassette input + 1 busy + 2 + 3 + 4 + 5 + 6 + 7 RESET key + + */ + + UINT8 data = 0; + + // cassette input + data |= m_cassette->input() >= 0 ? 1 : 0; + + // centronics busy + data |= m_centronics_busy << 1; + + // RESET key + data |= m_reset->read(); + + return data; +} + + +//------------------------------------------------- +// com_w - +//------------------------------------------------- + +WRITE8_MEMBER( m5_state::com_w ) +{ + /* + + bit description + + 0 cassette output, centronics strobe + 1 cassette remote + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + // cassette output + m_cassette->output( BIT(data, 0) ? -1.0 : 1.0); + + // centronics strobe + m_centronics->write_strobe(BIT(data, 0)); + + // cassette remote + m_cassette->change_state(BIT(data,1) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + + + +//************************************************************************** +// FD-5 +//************************************************************************** + +//------------------------------------------------- +// fd5_data_r - +//------------------------------------------------- + +READ8_MEMBER( m5_state::fd5_data_r ) +{ + m_ppi->pc6_w(0); + + return m_fd5_data; +} + + +//------------------------------------------------- +// fd5_data_w - +//------------------------------------------------- + +WRITE8_MEMBER( m5_state::fd5_data_w ) +{ + m_fd5_data = data; + + m_ppi->pc4_w(0); +} + + +//------------------------------------------------- +// fd5_com_r - +//------------------------------------------------- + +READ8_MEMBER( m5_state::fd5_com_r ) +{ + /* + + bit description + + 0 ? + 1 1? + 2 IBFA? + 3 OBFA? + 4 + 5 + 6 + 7 + + */ + + return m_obfa << 3 | m_ibfa << 2 | 0x02; +} + + +//------------------------------------------------- +// fd5_com_w - +//------------------------------------------------- + +WRITE8_MEMBER( m5_state::fd5_com_w ) +{ + /* + + bit description + + 0 PPI PC2 + 1 PPI PC0 + 2 PPI PC1 + 3 + 4 + 5 + 6 + 7 + + */ + + m_fd5_com = data; +} + + +//------------------------------------------------- +// fd5_com_w - +//------------------------------------------------- + +WRITE8_MEMBER( m5_state::fd5_ctrl_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + m_floppy0->mon_w(!BIT(data, 0)); +} + + +//------------------------------------------------- +// fd5_com_w - +//------------------------------------------------- + +WRITE8_MEMBER( m5_state::fd5_tc_w ) +{ + m_fdc->tc_w(true); + m_fdc->tc_w(false); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( m5_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( m5_mem, AS_PROGRAM, 8, m5_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM + //AM_RANGE(0x2000, 0x6fff) // mapped by the cartslot + AM_RANGE(0x7000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( m5_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( m5_io, AS_IO, 8, m5_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) + AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) + AM_RANGE(0x20, 0x20) AM_MIRROR(0x0f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) + AM_RANGE(0x30, 0x30) AM_MIRROR(0x08) AM_READ_PORT("Y0") // 64KBF bank select + AM_RANGE(0x31, 0x31) AM_MIRROR(0x08) AM_READ_PORT("Y1") + AM_RANGE(0x32, 0x32) AM_MIRROR(0x08) AM_READ_PORT("Y2") + AM_RANGE(0x33, 0x33) AM_MIRROR(0x08) AM_READ_PORT("Y3") + AM_RANGE(0x34, 0x34) AM_MIRROR(0x08) AM_READ_PORT("Y4") + AM_RANGE(0x35, 0x35) AM_MIRROR(0x08) AM_READ_PORT("Y5") + AM_RANGE(0x36, 0x36) AM_MIRROR(0x08) AM_READ_PORT("Y6") + AM_RANGE(0x37, 0x37) AM_MIRROR(0x08) AM_READ_PORT("JOY") + AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READWRITE(sts_r, com_w) +// AM_RANGE(0x60, 0x63) SIO +// AM_RANGE(0x6c, 0x6c) EM-64/64KBI bank select + AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) +// AM_RANGE(0x7f, 0x7f) 64KRD/64KRX bank select +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( fd5_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( fd5_mem, AS_PROGRAM, 8, m5_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x4000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( fd5_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( fd5_io, AS_IO, 8, m5_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x01) AM_DEVICE(UPD765_TAG, upd765a_device, map) + AM_RANGE(0x10, 0x10) AM_READWRITE(fd5_data_r, fd5_data_w) + AM_RANGE(0x20, 0x20) AM_WRITE(fd5_com_w) + AM_RANGE(0x30, 0x30) AM_READ(fd5_com_r) + AM_RANGE(0x40, 0x40) AM_WRITE(fd5_ctrl_w) + AM_RANGE(0x50, 0x50) AM_WRITE(fd5_tc_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( m5 ) +//------------------------------------------------- + +static INPUT_PORTS_START( m5 ) + PORT_START("Y0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Func") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("Y1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("Y2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + + PORT_START("Y3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("Y4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("Y5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_ Triangle") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') + + PORT_START("Y6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("JOY") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + + PORT_START("RESET") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) /* 1st line, 1st key from right! */ +INPUT_PORTS_END + +//------------------------------------------------- +// TMS9928a_interface vdp_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER(m5_state::sordm5_video_interrupt_callback) +{ + if (state) + { + m_ctc->trg3(1); + m_ctc->trg3(0); + } +} + + +//------------------------------------------------- +// I8255 Interface +//------------------------------------------------- + +READ8_MEMBER( m5_state::ppi_pa_r ) +{ + return m_fd5_data; +} + +READ8_MEMBER( m5_state::ppi_pc_r ) +{ + /* + + bit description + + 0 ? + 1 ? + 2 ? + 3 + 4 STBA + 5 + 6 ACKA + 7 + + */ + + return ( + /* FD5 bit 0-> M5 bit 2 */ + ((m_fd5_com & 0x01)<<2) | + /* FD5 bit 2-> M5 bit 1 */ + ((m_fd5_com & 0x04)>>1) | + /* FD5 bit 1-> M5 bit 0 */ + ((m_fd5_com & 0x02)>>1) + ); +} + +WRITE8_MEMBER( m5_state::ppi_pa_w ) +{ + m_fd5_data = data; +} + +WRITE8_MEMBER( m5_state::ppi_pb_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + if (data == 0xf0) + { + m_fd5cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_fd5cpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } +} + +WRITE8_MEMBER( m5_state::ppi_pc_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 INTRA + 4 + 5 IBFA + 6 + 7 OBFA + + */ + + m_intra = BIT(data, 3); + m_ibfa = BIT(data, 5); + m_obfa = BIT(data, 7); +} + +//------------------------------------------------- +// upd765_interface fdc_intf +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER( m5_state::floppy_formats ) + FLOPPY_M5_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( m5_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +//------------------------------------------------- +// z80_daisy_config m5_daisy_chain +//------------------------------------------------- + +static const z80_daisy_config m5_daisy_chain[] = +{ + { Z80CTC_TAG }, + { NULL } +}; + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( m5 ) +//------------------------------------------------- + +void m5_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + // configure RAM + switch (m_ram->size()) + { + case 4*1024: + program.unmap_readwrite(0x8000, 0xffff); + break; + + case 36*1024: + break; + + case 68*1024: + break; + } + + if (m_cart->exists()) + program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + // register for state saving + save_item(NAME(m_fd5_data)); + save_item(NAME(m_fd5_com)); + save_item(NAME(m_intra)); + save_item(NAME(m_ibfa)); + save_item(NAME(m_obfa)); +} + + +void m5_state::machine_reset() +{ +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( m5 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( m5, m5_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_14_31818MHz/4) + MCFG_CPU_PROGRAM_MAP(m5_mem) + MCFG_CPU_IO_MAP(m5_io) + MCFG_CPU_CONFIG(m5_daisy_chain) + + MCFG_CPU_ADD(Z80_FD5_TAG, Z80, XTAL_14_31818MHz/4) + MCFG_CPU_PROGRAM_MAP(fd5_mem) + MCFG_CPU_IO_MAP(fd5_io) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_14_31818MHz/4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_14_31818MHz/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + // CK0 = EXINT, CK1 = GND, CK2 = TCK, CK3 = VDP INT + // ZC2 = EXCLK + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(m5_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(sordm5_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("m5_cass") + + MCFG_DEVICE_ADD(I8255A_TAG, I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(m5_state, ppi_pa_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(m5_state, ppi_pa_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(m5_state, ppi_pb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(m5_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(m5_state, ppi_pc_w)) + + MCFG_UPD765A_ADD(UPD765_TAG, true, true) + MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE(Z80_FD5_TAG, INPUT_LINE_IRQ0)) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", m5_floppies, "525dd", m5_state::floppy_formats) + + // cartridge + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "m5_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + //MCFG_GENERIC_MANDATORY + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list", "m5_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "m5_cass") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("36K,68K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG_DERIVED( ntsc, m5 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( ntsc, m5 ) + // video hardware + MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(m5_state, sordm5_video_interrupt_callback)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG_DERIVED( pal, m5 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pal, m5 ) + // video hardware + MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(m5_state, sordm5_video_interrupt_callback)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( m5 ) +//------------------------------------------------- + +ROM_START( m5 ) + ROM_REGION( 0x7000, Z80_TAG, ROMREGION_ERASEFF ) + ROM_LOAD( "sordjap.ic21", 0x0000, 0x2000, CRC(92cf9353) SHA1(b0a4b3658fde68cb1f344dfb095bac16a78e9b3e) ) + + ROM_REGION( 0x4000, Z80_FD5_TAG, 0 ) + ROM_LOAD( "sordfd5.rom", 0x0000, 0x4000, CRC(7263bbc5) SHA1(b729500d3d2b2e807d384d44b76ea5ad23996f4a)) +ROM_END + + +//------------------------------------------------- +// ROM( m5p ) +//------------------------------------------------- + +ROM_START( m5p ) + ROM_REGION( 0x7000, Z80_TAG, ROMREGION_ERASEFF ) + ROM_LOAD( "sordint.ic21", 0x0000, 0x2000, CRC(78848d39) SHA1(ac042c4ae8272ad6abe09ae83492ef9a0026d0b2) ) + + ROM_REGION( 0x4000, Z80_FD5_TAG, 0 ) + ROM_LOAD( "sordfd5.rom", 0x0000, 0x4000, CRC(7263bbc5) SHA1(b729500d3d2b2e807d384d44b76ea5ad23996f4a)) +ROM_END + + + +//************************************************************************** +// DRIVER INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// ROM( ntsc ) +//------------------------------------------------- + +DRIVER_INIT_MEMBER(m5_state,ntsc) +{ +} + + +//------------------------------------------------- +// ROM( pal ) +//------------------------------------------------- + +DRIVER_INIT_MEMBER(m5_state,pal) +{ +} + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, m5, 0, 0, ntsc, m5, m5_state, ntsc, "Sord", "m.5 (Japan)", 0 ) +COMP( 1983, m5p, m5, 0, pal, m5, m5_state, pal, "Sord", "m.5 (Europe)", 0 ) diff --git a/src/mame/drivers/m6805evs.c b/src/mame/drivers/m6805evs.c new file mode 100644 index 00000000000..91400aa4a6d --- /dev/null +++ b/src/mame/drivers/m6805evs.c @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/****************************************************************************************************** + +Motorola M68HC05EVS evaluation system + +Chips: +Main board: XC68HC26P, R65C52P2, MS62256l-70PC, MS6264L-70PC, eprom. Xtal = 3.6864MHz +Emulator board: MC68C705P9CP, undumped 28-pin prom. Xtal = 4MHz + +R65C52 = Dual ACIA with inbuilt baud rate divider, uses 8 addresses, uses the 3.6864MHz crystal +XC68HC26P = PPI (3 ports), uses 8 addresses. + +2014-01-12 Skeleton driver + +The rom is larger than the available address space, but not all of it is programmed. The code +ranges are 800-18FF,1FF0-1FFF. There must be a banking scheme in use. + +Memory map guess +000-07F Stack (and user ram?) +080-0FF RAM (or devices?) +100-FFF ROM + +ToDo: +- Everything + +******************************************************************************************************/ + +#include "emu.h" +#include "cpu/m6805/m6805.h" + + +class m6805evs_state : public driver_device +{ +public: + m6805evs_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + +private: + required_device m_maincpu; + virtual void machine_reset(); +}; + + +static ADDRESS_MAP_START( m6805evs_mem, AS_PROGRAM, 8, m6805evs_state ) + AM_RANGE(0x0000, 0x00ff) AM_RAM + AM_RANGE(0x0100, 0x07ff) AM_ROM AM_REGION("roms", 0x1100) + AM_RANGE(0x0800, 0x0fef) AM_ROM AM_REGION("roms", 0x0800) + AM_RANGE(0x0ff0, 0x0fff) AM_ROM AM_REGION("roms", 0x1ff0) +ADDRESS_MAP_END + +static INPUT_PORTS_START( m6805evs ) +INPUT_PORTS_END + +void m6805evs_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( m6805evs, m6805evs_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68705, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(m6805evs_mem) +MACHINE_CONFIG_END + +ROM_START(m6805evs) + ROM_REGION(0x2000, "roms", 0) + ROM_LOAD( "evsbug12.bin", 0x0000, 0x2000, CRC(8b581aef) SHA1(eacf425cc8a042085ccc4097cc61570b633b1e38) ) +ROM_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP( 1990, m6805evs, 0, 0, m6805evs, m6805evs, driver_device, 0, "Motorola", "M68HC05EVS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/m79152pc.c b/src/mame/drivers/m79152pc.c new file mode 100644 index 00000000000..cf8bf82d908 --- /dev/null +++ b/src/mame/drivers/m79152pc.c @@ -0,0 +1,145 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Mera-Elzab 79152pc + + This is terminal + + 29/12/2011 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + +class m79152pc_state : public driver_device +{ +public: + m79152pc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_videoram(*this, "p_videoram"), + m_p_attributes(*this, "p_attributes"), + m_maincpu(*this, "maincpu") { } + + UINT8 *m_p_chargen; + required_shared_ptr m_p_videoram; + required_shared_ptr m_p_attributes; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_m79152pc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(m79152pc_mem, AS_PROGRAM, 8, m79152pc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x4000, 0x47ff) AM_RAM + AM_RANGE(0x8000, 0x8fff) AM_RAM AM_SHARE("p_videoram") + AM_RANGE(0x9000, 0x9fff) AM_RAM AM_SHARE("p_attributes") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( m79152pc_io, AS_IO, 8, m79152pc_state) + //ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( m79152pc ) +INPUT_PORTS_END + + +void m79152pc_state::machine_reset() +{ +} + +void m79152pc_state::video_start() +{ + m_p_chargen = memregion("chargen")->base()+4; +} + +UINT32 m79152pc_state::screen_update_m79152pc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +// Attributes are unknown so are not implemented + UINT8 y,ra,chr,gfx; //,attr; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 12; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 80; x++) + { + chr = m_p_videoram[x]; + //attr = m_p_attributes[x]; + gfx = m_p_chargen[(chr<<4) | ra ]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=80; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout m79152pc_charlayout = +{ + 8, 12, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( m79152pc ) + GFXDECODE_ENTRY( "chargen", 0x0000, m79152pc_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( m79152pc, m79152pc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(m79152pc_mem) + MCFG_CPU_IO_MAP(m79152pc_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 300) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 300-1) + MCFG_SCREEN_UPDATE_DRIVER(m79152pc_state, screen_update_m79152pc) + MCFG_SCREEN_PALETTE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", m79152pc) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( m79152pc ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "left.bin", 0x0000, 0x4000, CRC(8cd677fc) SHA1(7ad28f3ba984383f24a36639ca27fc1eb5a5d002)) + + ROM_REGION( 0x1800, "chargen", ROMREGION_INVERT ) + ROM_LOAD( "right.bin", 0x0000, 0x1000, CRC(93f83fdc) SHA1(e8121b3d175c46c02828f43ec071a7d9c62e7c26)) // chargen + ROM_LOAD( "char.bin", 0x1000, 0x0800, CRC(da3792a5) SHA1(b4a4f0d61d8082b7909a346a5b01494c53cf8d05)) // unknown +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( ????, m79152pc, 0, 0, m79152pc, m79152pc, driver_device, 0, "Mera-Elzab", "MERA 79152 PC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mac.c b/src/mame/drivers/mac.c new file mode 100644 index 00000000000..5ba63ada537 --- /dev/null +++ b/src/mame/drivers/mac.c @@ -0,0 +1,2482 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/**************************************************************************** + + drivers/mac.c + Macintosh family emulation + + Nate Woods, Raphael Nabet, R. Belmont + + 0x000000 - 0x3fffff RAM/ROM (switches based on overlay) + 0x400000 - 0x4fffff ROM + 0x580000 - 0x5fffff 5380 NCR/Symbios SCSI peripherals chip (Mac Plus only) + 0x600000 - 0x6fffff RAM + 0x800000 - 0x9fffff Zilog 8530 SCC (Serial Control Chip) Read + 0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Control Chip) Write + 0xc00000 - 0xdfffff IWM (Integrated Woz Machine; floppy) + 0xe80000 - 0xefffff Rockwell 6522 VIA + 0xf00000 - 0xffffef ??? (the ROM appears to be accessing here) + 0xfffff0 - 0xffffff Auto Vector + + + Interrupts: + M68K: + Level 1 from VIA + Level 2 from SCC + Level 4 : Interrupt switch (not implemented) + + VIA: + CA1 from VBLANK + CA2 from 1 Hz clock (RTC) + CB1 from Keyboard Clock + CB2 from Keyboard Data + SR from Keyboard Data Ready + + SCC: + PB_EXT from mouse Y circuitry + PA_EXT from mouse X circuitry + + NOTES: + - pmac6100: with recent PPC fixes now gets into the 68000 emulator and executes part of the 680x0 startup code. + 'g 6802c73c' to get to the interesting part (wait past the boot chime). PPC register r24 is the 68000 PC. + when the PC hits GetCPUID, the move.l (a2), d0 at PC = 0x10000 will cause an MMU fault (jump to 0xFFF00300). why? + a2 = 0x5ffffffc (the CPU ID register). MMU is unable to resolve this; defect in the MMU emulation probable. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "cpu/powerpc/ppc.h" +#include "cpu/m6805/m6805.h" +#include "machine/6522via.h" +#include "machine/applefdc.h" +#include "machine/swim.h" +#include "machine/sonydriv.h" +#include "formats/ap_dsk35.h" +#include "machine/ram.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" +#include "bus/scsi/scsicd.h" +#include "sound/asc.h" +#include "sound/awacs.h" +#include "sound/cdda.h" + +// NuBus and 030/040 PDS cards +#include "bus/nubus/nubus_48gc.h" +#include "bus/nubus/nubus_cb264.h" +#include "bus/nubus/nubus_vikbw.h" +#include "bus/nubus/nubus_specpdq.h" +#include "bus/nubus/nubus_m2hires.h" +#include "bus/nubus/nubus_spec8.h" +#include "bus/nubus/nubus_radiustpd.h" +#include "bus/nubus/nubus_wsportrait.h" +#include "bus/nubus/nubus_asntmc3b.h" +#include "bus/nubus/nubus_image.h" +#include "bus/nubus/nubus_m2video.h" +#include "bus/nubus/pds30_cb264.h" +#include "bus/nubus/pds30_procolor816.h" +#include "bus/nubus/pds30_sigmalview.h" +#include "bus/nubus/pds30_30hr.h" +#include "bus/nubus/pds30_mc30.h" + +// 68000 PDS cards +#include "bus/macpds/pds_tpdfpd.h" + +#include "includes/mac.h" +#include "mac.lh" + +#define C7M (7833600) +#define C15M (C7M*2) +#define C32M (C15M*2) + +// do this here - screen_update is called each scanline when stepping in the +// debugger, which means you can't escape the VIA2 IRQ handler +// +// RBV/MDU bits in IER/IFR: +// +// CA1: any slot interrupt = 0x02 +// CA2: SCSI interrupt = 0x01 +// CB1: ASC interrupt = 0x10 + +INTERRUPT_GEN_MEMBER(mac_state::mac_rbv_vbl) +{ + m_rbv_regs[2] &= ~0x40; // set vblank signal + m_rbv_vbltime = 10; + +// printf("RBV: raising VBL!\n"); + + if (m_rbv_regs[0x12] & 0x40) + { + rbv_recalc_irqs(); + } +} + +READ32_MEMBER( mac_state::rbv_ramdac_r ) +{ + return 0; +} + +WRITE32_MEMBER( mac_state::rbv_ramdac_w ) +{ + if (!offset) + { + m_rbv_clutoffs = data>>24; + m_rbv_count = 0; + } + else + { + m_rbv_colors[m_rbv_count++] = data>>24; + + if (m_rbv_count == 3) + { + // for portrait display, force monochrome by using the blue channel + if (m_model != MODEL_MAC_CLASSIC_II) + { + // Color Classic has no MONTYPE so the default gets us 512x384, which is right + if ((m_montype ? m_montype->read() : 2) == 1) + { + m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2])); + m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]); + m_rbv_clutoffs++; + m_rbv_count = 0; + } + else + { + m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2])); + m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); + m_rbv_clutoffs++; + m_rbv_count = 0; + } + } + } + } +} + +WRITE32_MEMBER( mac_state::ariel_ramdac_w ) // this is for the "Ariel" style RAMDAC +{ + if (mem_mask == 0xff000000) + { + m_rbv_clutoffs = data>>24; + m_rbv_count = 0; + } + else if (mem_mask == 0x00ff0000) + { + m_rbv_colors[m_rbv_count++] = data>>16; + + if (m_rbv_count == 3) + { + // for portrait display, force monochrome by using the blue channel + if (m_model != MODEL_MAC_CLASSIC_II) + { + // Color Classic has no MONTYPE so the default gets us 512x384, which is right + if ((m_montype ? m_montype->read() : 2) == 1) + { + m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2])); + m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]); + m_rbv_clutoffs++; + m_rbv_count = 0; + } + else + { + m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2])); + m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); + m_rbv_clutoffs++; + m_rbv_count = 0; + } + } + } + } + else if (mem_mask == 0x0000ff00) + { + // config reg +// printf("Ariel: %02x to config\n", (data>>8)&0xff); + } + else // color key reg + { + } +} + +READ8_MEMBER( mac_state::mac_sonora_vctl_r ) +{ + if (offset == 2) + { +// printf("Sonora: read monitor ID at PC=%x\n", m_maincpu->pc()); + return ((m_montype ? m_montype->read() : 6)<<4); + } + + return m_sonora_vctl[offset]; +} + +WRITE8_MEMBER( mac_state::mac_sonora_vctl_w ) +{ +// printf("Sonora: %02x to vctl %x\n", data, offset); + m_sonora_vctl[offset] = data; +} + +void mac_state::rbv_recalc_irqs() +{ + // check slot interrupts and bubble them down to IFR + UINT8 slot_irqs = (~m_rbv_regs[2]) & 0x78; + slot_irqs &= (m_rbv_regs[0x12] & 0x78); + + if (slot_irqs) + { + m_rbv_regs[3] |= 2; // any slot + } + else // no slot irqs, clear the pending bit + { + m_rbv_regs[3] &= ~2; // any slot + } + + UINT8 ifr = (m_rbv_regs[3] & m_rbv_ier) & 0x1b; //m_rbv_regs[0x13]); + +// printf("ifr = %02x (reg3 %02x reg13 %02x)\n", ifr, m_rbv_regs[3], m_rbv_regs[0x13]); + if (ifr != 0) + { + m_rbv_regs[3] = ifr | 0x80; + m_rbv_ifr = ifr | 0x80; + +// printf("VIA2 raise\n"); + set_via2_interrupt(1); + } + else + { +// printf("VIA2 lower\n"); + set_via2_interrupt(0); + } +} + +READ8_MEMBER ( mac_state::mac_rbv_r ) +{ + int data = 0; + + if (offset < 0x100) + { + data = m_rbv_regs[offset]; + + if (offset == 0x10) + { + data &= ~0x38; + data |= ((m_montype ? m_montype->read() : 2)<<3); +// printf("rbv_r montype: %02x (PC %x)\n", data, space.cpu->safe_pc()); + } + + // bit 7 of these registers always reads as 0 on RBV + if ((offset == 0x12) || (offset == 0x13)) + { + data &= ~0x80; + } + } + else + { + offset >>= 9; + + switch (offset) + { + case 13: // IFR +// printf("Read IER = %02x (PC=%x) 2=%02x\n", m_rbv_ier, m_maincpu->pc(), m_rbv_regs[2]); + data = m_rbv_ifr; + break; + + case 14: // IER +// printf("Read IFR = %02x (PC=%x) 2=%02x\n", m_rbv_ifr, m_maincpu->pc(), m_rbv_regs[2]); + data = m_rbv_ier; + break; + + default: + logerror("rbv_r: Unknown extended RBV VIA register %d access\n", offset); + break; + } + } + +// printf("rbv_r: %x = %02x (PC=%x)\n", offset, data, m_maincpu->pc()); + + return data; +} + +WRITE8_MEMBER ( mac_state::mac_rbv_w ) +{ + if (offset < 0x100) + { +// if (offset == 0x10) +// printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, m_maincpu->pc()); + switch (offset) + { + case 0x00: + if (m_model == MODEL_MAC_LC) + { + m68000_base_device *m68k = downcast(m_maincpu.target()); + m68k->set_hmmu_enable((data & 0x8) ? M68K_HMMU_DISABLE : M68K_HMMU_ENABLE_LC); + } + break; + + case 0x01: + if (((data & 0xc0) != (m_rbv_regs[1] & 0xc0)) && (m_rbv_type == RBV_TYPE_V8)) + { + m_rbv_regs[1] = data; + this->v8_resize(); + } + break; + + case 0x02: + data &= 0x40; + m_rbv_regs[offset] &= ~data; + rbv_recalc_irqs(); + break; + + case 0x03: // write here to ack + if (data & 0x80) // 1 bits write 1s + { + m_rbv_regs[offset] |= data & 0x7f; + m_rbv_ifr |= data & 0x7f; + } + else // 1 bits write 0s + { + m_rbv_regs[offset] &= ~(data & 0x7f); + m_rbv_ifr &= ~(data & 0x7f); + } + rbv_recalc_irqs(); + break; + + case 0x10: + if (data != 0) + { + m_rbv_immed10wr = 1; + } + m_rbv_regs[offset] = data; + break; + + case 0x12: + if (data & 0x80) // 1 bits write 1s + { + m_rbv_regs[offset] |= data & 0x7f; + } + else // 1 bits write 0s + { + m_rbv_regs[offset] &= ~(data & 0x7f); + } + rbv_recalc_irqs(); + break; + + case 0x13: + if (data & 0x80) // 1 bits write 1s + { + m_rbv_regs[offset] |= data & 0x7f; + + if (data == 0xff) m_rbv_regs[offset] = 0x1f; // I don't know why this is special, but the IIci ROM's POST demands it + } + else // 1 bits write 0s + { + m_rbv_regs[offset] &= ~(data & 0x7f); + } + break; + + default: + m_rbv_regs[offset] = data; + break; + } + } + else + { + offset >>= 9; + + switch (offset) + { + case 13: // IFR +// printf("%02x to IFR (PC=%x)\n", data, m_maincpu->pc()); + if (data & 0x80) + { + data = 0x7f; + } + rbv_recalc_irqs(); + break; + + case 14: // IER +// printf("%02x to IER (PC=%x)\n", data, m_maincpu->pc()); + if (data & 0x80) // 1 bits write 1s + { + m_rbv_ier |= data & 0x7f; + } + else // 1 bits write 0s + { + m_rbv_ier &= ~(data & 0x7f); + } + rbv_recalc_irqs(); + break; + + default: + logerror("rbv_w: Unknown extended RBV VIA register %d access\n", offset); + break; + } + } +} + +// Portable/PB100 video +VIDEO_START_MEMBER(mac_state,macprtb) +{ +} + +READ16_MEMBER(mac_state::mac_config_r) +{ + return 0xffff; // returns nonzero if no PDS RAM expansion, 0 if present +} + +// IIfx +READ32_MEMBER(mac_state::biu_r) +{ +// printf("biu_r @ %x, mask %08x\n", offset, mem_mask); + return 0; +} + +WRITE32_MEMBER(mac_state::biu_w) +{ +// printf("biu_w %x @ %x, mask %08x\n", data, offset, mem_mask); +} + +READ8_MEMBER(mac_state::oss_r) +{ +// printf("oss_r @ %x\n", offset); +// if (offset <= 0xe) // for interrupt mask registers, we're intended to return something different than is written in the low 3 bits (?) +// { +// return m_oss_regs[offset]<<4; +// } + + return m_oss_regs[offset]; +} + +WRITE8_MEMBER(mac_state::oss_w) +{ +// printf("oss_w %x @ %x\n", data, offset); + m_oss_regs[offset] = data; +} + +READ32_MEMBER(mac_state::buserror_r) +{ + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + return 0; +} + +READ8_MEMBER(mac_state::scciop_r) +{ +// printf("scciop_r @ %x (PC=%x)\n", offset, m_maincpu->pc()); + return 0; +} + +WRITE8_MEMBER(mac_state::scciop_w) +{ +// printf("scciop_w %x @ %x (PC=%x)\n", data, offset, m_maincpu->pc()); +} + +READ8_MEMBER(mac_state::swimiop_r) +{ +// printf("swimiop_r @ %x (PC=%x)\n", offset, m_maincpu->pc()); + return 0; +} + +WRITE8_MEMBER(mac_state::swimiop_w) +{ +// printf("swimiop_w %x @ %x (PC=%x)\n", data, offset, m_maincpu->pc()); +} + +READ8_MEMBER(mac_state::pmac_diag_r) +{ + switch (offset) + { + case 0: // return 0 here to get the 'car crash' sound after the boot bong, 1 otherwise + return 1; + } + + return 0; +} + +READ8_MEMBER(mac_state::amic_dma_r) +{ + return 0; +} + +WRITE8_MEMBER(mac_state::amic_dma_w) +{ +// printf("amic_dma_w: %02x at %x (PC=%x)\n", data, offset+0x1000, m_maincpu->pc()); +} + +// HMC has one register: a 35-bit shift register which is accessed one bit at a time (see pmac6100 code at 4030383c which makes this obvious) +READ8_MEMBER(mac_state::hmc_r) +{ + UINT8 rv = (UINT8)(m_hmc_shiftout&1); + m_hmc_shiftout>>= 1; + return rv; +} + +WRITE8_MEMBER(mac_state::hmc_w) +{ + // writes to xxx8 reset the bit shift position + if ((offset&0x8) == 8) + { + m_hmc_shiftout = m_hmc_reg; + } + else + { + UINT64 temp = (data & 1) ? U64(0x400000000) : U64(0x0); + m_hmc_reg >>= 1; + m_hmc_reg |= temp; + } +} + +READ8_MEMBER(mac_state::mac_gsc_r) +{ + if (offset == 1) + { + return 5; + } + + return 0; +} + +WRITE8_MEMBER(mac_state::mac_gsc_w) +{ +} + +READ8_MEMBER(mac_state::mac_5396_r) +{ + if (offset < 0x100) + { + return m_539x_1->read(space, offset>>4); + } + else // pseudo-DMA: read from the FIFO + { + return m_539x_1->read(space, 2); + } + + // never executed + //return 0; +} + +WRITE8_MEMBER(mac_state::mac_5396_w) +{ + if (offset < 0x100) + { + m_539x_1->write(space, offset>>4, data); + } + else // pseudo-DMA: write to the FIFO + { + m_539x_1->write(space, 2, data); + } +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START(mac512ke_map, AS_PROGRAM, 16, mac_state ) + AM_RANGE(0x800000, 0x9fffff) AM_READ(mac_scc_r) + AM_RANGE(0xa00000, 0xbfffff) AM_WRITE(mac_scc_w) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) + AM_RANGE(0xe80000, 0xefffff) AM_READWRITE(mac_via_r, mac_via_w) + AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(macplus_map, AS_PROGRAM, 16, mac_state ) + AM_RANGE(0x580000, 0x5fffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w) + AM_RANGE(0x800000, 0x9fffff) AM_READ(mac_scc_r) + AM_RANGE(0xa00000, 0xbfffff) AM_WRITE(mac_scc_w) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) + AM_RANGE(0xe80000, 0xefffff) AM_READWRITE(mac_via_r, mac_via_w) + AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(macse_map, AS_PROGRAM, 16, mac_state ) + AM_RANGE(0x580000, 0x5fffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w) + AM_RANGE(0x900000, 0x9fffff) AM_READ(mac_scc_r) + AM_RANGE(0xb00000, 0xbfffff) AM_WRITE(mac_scc_w) + AM_RANGE(0xd00000, 0xdfffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) + AM_RANGE(0xe80000, 0xefffff) AM_READWRITE(mac_via_r, mac_via_w) + AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(macprtb_map, AS_PROGRAM, 16, mac_state ) + AM_RANGE(0x900000, 0x93ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0c0000) + AM_RANGE(0xf60000, 0xf6ffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) + AM_RANGE(0xf70000, 0xf7ffff) AM_READWRITE(mac_via_r, mac_via_w) + AM_RANGE(0xf90000, 0xf9ffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w) + AM_RANGE(0xfa8000, 0xfaffff) AM_RAM AM_SHARE("vram16") // VRAM + AM_RANGE(0xfb0000, 0xfbffff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffff) + AM_RANGE(0xfc0000, 0xfcffff) AM_READ(mac_config_r) + AM_RANGE(0xfd0000, 0xfdffff) AM_READWRITE(mac_scc_r, mac_scc_2_w) + AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(maclc_map, AS_PROGRAM, 32, mac_state ) + ADDRESS_MAP_GLOBAL_MASK(0x80ffffff) // V8 uses bit 31 and 23-0 for address decoding only + + AM_RANGE(0xa00000, 0xafffff) AM_ROM AM_REGION("bootrom", 0) // ROM (in 32-bit mode) + + AM_RANGE(0xf00000, 0xf01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) + AM_RANGE(0xf04000, 0xf05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) + AM_RANGE(0xf06000, 0xf07fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) + AM_RANGE(0xf10000, 0xf11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) + AM_RANGE(0xf12000, 0xf13fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) + AM_RANGE(0xf14000, 0xf15fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) + AM_RANGE(0xf16000, 0xf17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) + AM_RANGE(0xf24000, 0xf24003) AM_READWRITE(rbv_ramdac_r, ariel_ramdac_w) + AM_RANGE(0xf26000, 0xf27fff) AM_READWRITE8(mac_rbv_r, mac_rbv_w, 0xffffffff) // VIA2 (V8) + AM_RANGE(0xf40000, 0xfbffff) AM_RAM AM_SHARE("vram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(maclc3_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) + + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50006000, 0x50007fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x00f00000) + AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50012000, 0x50013fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x00f00000) + AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50024000, 0x50025fff) AM_WRITE( ariel_ramdac_w ) AM_MIRROR(0x00f00000) + AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE8(mac_rbv_r, mac_rbv_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50028000, 0x50028003) AM_READWRITE8(mac_sonora_vctl_r, mac_sonora_vctl_w, 0xffffffff) AM_MIRROR(0x00f00000) + + AM_RANGE(0x5ffffffc, 0x5fffffff) AM_READ(mac_read_id) + + AM_RANGE(0x60000000, 0x600fffff) AM_RAM AM_MIRROR(0x0ff00000) AM_SHARE("vram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(macii_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ffc0000) + + // MMU remaps I/O without the F + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50006000, 0x50006003) AM_WRITE(macii_scsi_drq_w) AM_MIRROR(0x00f00000) + AM_RANGE(0x50006060, 0x50006063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) + AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) + AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(maciici_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x4007ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff80000) + + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50006000, 0x50007fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x00f00000) + AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) + AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50024000, 0x50024007) AM_WRITE( rbv_ramdac_w ) AM_MIRROR(0x00f00000) + AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE8(mac_rbv_r, mac_rbv_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(macse30_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ffc0000) + + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50006000, 0x50007fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x00f00000) + AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) + AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) // mirror + + AM_RANGE(0xfe000000, 0xfe00ffff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xfee00000, 0xfee0ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x000f0000) + AM_RANGE(0xfeffe000, 0xfeffffff) AM_ROM AM_REGION("se30vrom", 0x0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(maciifx_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x4007ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff80000) + + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE8(scciop_r, scciop_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x5000a000, 0x5000bfff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x5000c060, 0x5000c063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) + AM_RANGE(0x5000d000, 0x5000d003) AM_WRITE(macii_scsi_drq_w) AM_MIRROR(0x00f00000) + AM_RANGE(0x5000d060, 0x5000d063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) + AM_RANGE(0x50010000, 0x50011fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50012000, 0x50013fff) AM_READWRITE8(swimiop_r, swimiop_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50018000, 0x50019fff) AM_READWRITE(biu_r, biu_w) AM_MIRROR(0x00f00000) + AM_RANGE(0x5001a000, 0x5001bfff) AM_READWRITE8(oss_r, oss_w, 0xffffffff) AM_MIRROR(0x00f00000) + AM_RANGE(0x50024000, 0x50027fff) AM_READ(buserror_r) AM_MIRROR(0x00f00000) // must bus error on access here so ROM can determine we're an FMC + AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) +ADDRESS_MAP_END + +// ROM detects the "Jaws" ASIC by checking for I/O space mirrored at 0x01000000 boundries +static ADDRESS_MAP_START(macpb140_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) + + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x01f00000) + AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x01f00000) + AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x01f00000) + AM_RANGE(0x50006000, 0x50007fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x01f00000) + AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x01f00000) + AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x01f00000) + AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x01f00000) + AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x01f00000) + AM_RANGE(0x50024000, 0x50027fff) AM_READ(buserror_r) AM_MIRROR(0x01f00000) // bus error here to make sure we aren't mistaken for another decoder + + AM_RANGE(0xfee08000, 0xfeffffff) AM_RAM AM_SHARE("vram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(macpb160_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) + + AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) + AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) + AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) + AM_RANGE(0x50f06000, 0x50f07fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) + AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) + AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r) + AM_RANGE(0x50f14000, 0x50f15fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) + AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) + AM_RANGE(0x50f20000, 0x50f21fff) AM_READWRITE8(mac_gsc_r, mac_gsc_w, 0xffffffff) + AM_RANGE(0x50f24000, 0x50f27fff) AM_READ(buserror_r) // bus error here to make sure we aren't mistaken for another decoder + + AM_RANGE(0x60000000, 0x6001ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x0ffe0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(macpb165c_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) + + AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) + AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) + AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) + AM_RANGE(0x50f06000, 0x50f07fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) + AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) + AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r) + AM_RANGE(0x50f14000, 0x50f15fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) + AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) + AM_RANGE(0x50f20000, 0x50f21fff) AM_READ(buserror_r) // bus error here to detect we're not the grayscale 160/165/180 + AM_RANGE(0x50f24000, 0x50f27fff) AM_READ(buserror_r) // bus error here to make sure we aren't mistaken for another decoder + + // on-board color video on 165c/180c + AM_RANGE(0xfc000000, 0xfc07ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x00380000) // 512k of VRAM + AM_RANGE(0xfc400000, 0xfcefffff) AM_READWRITE(macwd_r, macwd_w) +// fc4003c8 = DAC control, fc4003c9 = DAC data +// fc4003da bit 3 is VBL + AM_RANGE(0xfcff8000, 0xfcffffff) AM_ROM AM_REGION("vrom", 0x0000) +ADDRESS_MAP_END +#if 0 +static ADDRESS_MAP_START(macpd210_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) + + AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) + AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) + AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) + AM_RANGE(0x50f06000, 0x50f07fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) + AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) + AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r) + AM_RANGE(0x50f14000, 0x50f15fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) + AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) + AM_RANGE(0x50f20000, 0x50f21fff) AM_READWRITE8(mac_gsc_r, mac_gsc_w, 0xffffffff) + AM_RANGE(0x50f24000, 0x50f27fff) AM_READ(buserror_r) // bus error here to make sure we aren't mistaken for another decoder + + AM_RANGE(0x5ffffffc, 0x5fffffff) AM_READ(mac_read_id) + + AM_RANGE(0x60000000, 0x6001ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x0ffe0000) +ADDRESS_MAP_END +#endif +static ADDRESS_MAP_START(quadra700_map, AS_PROGRAM, 32, mac_state ) + AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) + + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00fc0000) + AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00fc0000) +// 50008000 = Ethernet MAC ID PROM +// 5000a000 = Sonic (DP83932) ethernet +// 5000f000 = SCSI cf96, 5000f402 = SCSI #2 cf96 + AM_RANGE(0x5000f000, 0x5000f3ff) AM_READWRITE8(mac_5396_r, mac_5396_w, 0xffffffff) AM_MIRROR(0x00fc0000) + AM_RANGE(0x5000c000, 0x5000dfff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00fc0000) + AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00fc0000) + AM_RANGE(0x5001e000, 0x5001ffff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00fc0000) + + AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00fc0000) + // f9800000 = VDAC / DAFB + AM_RANGE(0xf9000000, 0xf91fffff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xf9800000, 0xf98001ff) AM_READWRITE(dafb_r, dafb_w) + AM_RANGE(0xf9800200, 0xf980023f) AM_READWRITE(dafb_dac_r, dafb_dac_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pwrmac_map, AS_PROGRAM, 64, mac_state ) + AM_RANGE(0x00000000, 0x007fffff) AM_RAM // 8 MB standard + + AM_RANGE(0x40000000, 0x403fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0fc00000) + + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + // 50008000 = ethernet ID PROM + // 5000a000 = MACE ethernet controller + AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + // 50014000 = sound registers (AWACS) + AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("awacs", awacs_device, read, write, U64(0xffffffffffffffff)) AM_MIRROR(0x01f00000) + AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x50024000, 0x50025fff) AM_WRITE32( ariel_ramdac_w, U64(0xffffffffffffffff) ) AM_MIRROR(0x00f00000) + AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE16(mac_via2_r, mac_via2_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x50028000, 0x50028007) AM_READWRITE8(mac_sonora_vctl_r, mac_sonora_vctl_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + // 5002a000 = interrupt controller + // 5002c000 = diagnostic registers + AM_RANGE(0x5002c000, 0x5002dfff) AM_READ8(pmac_diag_r, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x50031000, 0x50032fff) AM_READWRITE8(amic_dma_r, amic_dma_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x50040000, 0x5004000f) AM_READWRITE8(hmc_r, hmc_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x5ffffff8, 0x5fffffff) AM_READ32(mac_read_id, U64(0xffffffffffffffff)) + + AM_RANGE(0xffc00000, 0xffffffff) AM_ROM AM_REGION("bootrom", 0) +ADDRESS_MAP_END + +/*************************************************************************** + DEVICE CONFIG +***************************************************************************/ + +static const applefdc_interface mac_iwm_interface = +{ + sony_set_lines, + mac_fdc_set_enable_lines, + + sony_read_data, + sony_write_data, + sony_read_status +}; + +static SLOT_INTERFACE_START(mac_nubus_cards) + SLOT_INTERFACE("m2video", NUBUS_M2VIDEO) /* Apple Macintosh II Video Card */ + SLOT_INTERFACE("48gc", NUBUS_48GC) /* Apple 4*8 Graphics Card */ + SLOT_INTERFACE("824gc", NUBUS_824GC) /* Apple 8*24 Graphics Card */ + SLOT_INTERFACE("cb264", NUBUS_CB264) /* RasterOps ColorBoard 264 */ + SLOT_INTERFACE("vikbw", NUBUS_VIKBW) /* Moniterm Viking board */ + SLOT_INTERFACE("image", NUBUS_IMAGE) /* Disk Image Pseudo-Card */ + SLOT_INTERFACE("specpdq", NUBUS_SPECPDQ) /* SuperMac Spectrum PDQ */ + SLOT_INTERFACE("m2hires", NUBUS_M2HIRES) /* Apple Macintosh II Hi-Resolution Card */ + SLOT_INTERFACE("spec8s3", NUBUS_SPEC8S3) /* SuperMac Spectrum/8 Series III */ +// SLOT_INTERFACE("thundergx", NUBUS_THUNDERGX) /* Radius Thunder GX (not yet) */ + SLOT_INTERFACE("radiustpd", NUBUS_RADIUSTPD) /* Radius Two Page Display */ + SLOT_INTERFACE("asmc3nb", NUBUS_ASNTMC3NB) /* Asante MC3NB Ethernet card */ + SLOT_INTERFACE("portrait", NUBUS_WSPORTRAIT) /* Apple Macintosh II Portrait video card */ + SLOT_INTERFACE("enetnb", NUBUS_APPLEENET) /* Apple NuBus Ethernet */ +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(mac_pds030_cards) + SLOT_INTERFACE("cb264", PDS030_CB264SE30) // RasterOps Colorboard 264/SE30 + SLOT_INTERFACE("pc816", PDS030_PROCOLOR816) // Lapis ProColor Server 8*16 PDS + SLOT_INTERFACE("lview", PDS030_LVIEW) // Sigma Designs L-View + SLOT_INTERFACE("30hr", PDS030_XCEED30HR) // Micron/XCEED Technology Color 30HR + SLOT_INTERFACE("mc30", PDS030_XCEEDMC30) // Micron/XCEED Technology MacroColor 30 +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(mac_sepds_cards) + SLOT_INTERFACE("radiusfpd", PDS_SEDISPLAY) // Radius Full Page Display card for SE +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(mac_lcpds_cards) +SLOT_INTERFACE_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static const floppy_interface mac_floppy_interface = +{ + FLOPPY_STANDARD_3_5_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple35_mac), + "floppy_3_5" +}; + +static MACHINE_CONFIG_START( mac512ke, mac_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, C7M) /* 7.8336 MHz */ + MCFG_CPU_PROGRAM_MAP(mac512ke_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_REFRESH_RATE(60.15) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_SIZE(MAC_H_TOTAL, MAC_V_TOTAL) + MCFG_SCREEN_VISIBLE_AREA(0, MAC_H_VIS-1, 0, MAC_V_VIS-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_mac) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(mac_state,mac) + + MCFG_VIDEO_START_OVERRIDE(mac_state,mac) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("custom", MAC_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) + MCFG_IWM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + MCFG_MACKBD_ADD(MACKBD_TAG) +#ifdef MAC_USE_EMULATED_KBD + MCFG_MACKBD_DATAOUT_HANDLER(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) + MCFG_MACKBD_CLKOUT_HANDLER(WRITELINE(mac_state, mac_kbd_clk_in)) +#endif + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mac128k, mac512ke ) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( macplus, mac512ke ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(macplus_map) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) + + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_MODIFY(mac_floppy_interface) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("1M,2M,2560K,4M") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( macse, macplus ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(macse_map) + + MCFG_DEVICE_REMOVE("via6522_0") + MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("2M,2560K,4M") + + MCFG_MACKBD_REMOVE(MACKBD_TAG) + + MCFG_MACPDS_BUS_ADD("sepds", "maincpu") + MCFG_MACPDS_SLOT_ADD("sepds", "pds", mac_sepds_cards, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( macclasc, macplus ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(macse_map) + + MCFG_DEVICE_REMOVE("via6522_0") + MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("2M,2560K,4M") + + MCFG_MACKBD_REMOVE(MACKBD_TAG) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( macprtb, mac_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, C15M) + MCFG_CPU_PROGRAM_MAP(macprtb_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_REFRESH_RATE(60.15) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_SIZE(700, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macprtb) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(mac_state,mac) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* devices */ + MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) + + MCFG_IWM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a_pmu)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b_pmu)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a_pmu)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_pmu)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1M") + MCFG_RAM_EXTRA_OPTIONS("1M,3M,5M,7M,9M") + + // software list + MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( macii, mac_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68020PMMU, C15M) + MCFG_CPU_PROGRAM_MAP(macii_map) + + MCFG_PALETTE_ADD("palette", 256) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* devices */ + MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) + MCFG_DEVICE_ADD("nubus", NUBUS, 0) + MCFG_NUBUS_CPU("maincpu") + MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) + MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) + MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) + MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) + MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) + MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) + MCFG_NUBUS_SLOT_ADD("nubus","nb9", mac_nubus_cards, "48gc") + MCFG_NUBUS_SLOT_ADD("nubus","nba", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbb", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbc", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "cdrom", SCSICD, SCSI_ID_4) + + MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) + + MCFG_IWM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, C7M/10) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("8M,32M,64M,96M,128M") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maciihmu, macii ) + MCFG_CPU_REPLACE("maincpu", M68020HMMU, C15M) + MCFG_CPU_PROGRAM_MAP(macii_map) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( maciifx, mac_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68030, 40000000) + MCFG_CPU_PROGRAM_MAP(maciifx_map) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* devices */ + MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) + MCFG_DEVICE_ADD("nubus", NUBUS, 0) + MCFG_NUBUS_CPU("maincpu") + MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) + MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) + MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) + MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) + MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) + MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) + MCFG_NUBUS_SLOT_ADD("nubus","nb9", mac_nubus_cards, "48gc") + MCFG_NUBUS_SLOT_ADD("nubus","nba", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbb", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbc", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) + + MCFG_IWM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,64M,96M,128M") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maclc, macii ) + + MCFG_CPU_REPLACE("maincpu", M68020HMMU, C15M) + MCFG_CPU_PROGRAM_MAP(maclc_map) + MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(256) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macv8) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) + + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macv8) + MCFG_DEFAULT_LAYOUT(layout_mac) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("4M,6M,8M,10M") + + MCFG_DEVICE_MODIFY("via6522_0") + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_egadb)) + + MCFG_NUBUS_SLOT_REMOVE("nb9") + MCFG_NUBUS_SLOT_REMOVE("nba") + MCFG_NUBUS_SLOT_REMOVE("nbb") + MCFG_NUBUS_SLOT_REMOVE("nbc") + MCFG_NUBUS_SLOT_REMOVE("nbd") + MCFG_NUBUS_SLOT_REMOVE("nbe") + MCFG_DEVICE_REMOVE("nubus") + + MCFG_DEVICE_ADD("pds", NUBUS, 0) + MCFG_NUBUS_CPU("maincpu") + MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) + MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) + MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) + MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) + MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) + MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) + MCFG_NUBUS_SLOT_ADD("pds","lcpds", mac_lcpds_cards, NULL) + + MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_V8, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_EGRET_ADD(EGRET_341S0850) + MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) + MCFG_QUANTUM_PERFECT_CPU("maincpu") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maclc2, maclc ) + + MCFG_CPU_REPLACE("maincpu", M68030, C15M) + MCFG_CPU_PROGRAM_MAP(maclc_map) + MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("6M,8M,10M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maccclas, maclc2 ) + + MCFG_EGRET_REMOVE() + MCFG_CUDA_ADD(CUDA_341S0788) // should be 0417, but that version won't sync up properly with the '030 right now + MCFG_CUDA_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_CUDA_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_CUDA_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_CUDA_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) + + MCFG_DEVICE_MODIFY("via6522_0") + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_cdadb)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maclc3, maclc ) + + MCFG_CPU_REPLACE("maincpu", M68030, 25000000) + MCFG_CPU_PROGRAM_MAP(maclc3_map) + MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macsonora) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,macsonora) + + MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macsonora) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,48M,64M,80M") + + MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_SONORA, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_EGRET_REPLACE(EGRET_341S0851) + MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maclc520, maclc3 ) + + MCFG_EGRET_REMOVE() + MCFG_CUDA_ADD(CUDA_341S0060) + MCFG_CUDA_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_CUDA_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_CUDA_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_CUDA_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) + + MCFG_DEVICE_MODIFY("via6522_0") + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_cdadb)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maciivx, maclc ) + + MCFG_CPU_REPLACE("maincpu", M68030, C32M) + MCFG_CPU_PROGRAM_MAP(maclc3_map) + MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macv8) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) + + MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbvvram) + + MCFG_DEVICE_ADD("nubus", NUBUS, 0) + MCFG_NUBUS_CPU("maincpu") + MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) + MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) + MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) + MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) + MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) + MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) + MCFG_NUBUS_SLOT_ADD("nubus","nbc", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M,28M,32M,36M,40M,44M,48M,52M,56M,60M,64M") + + MCFG_EGRET_REPLACE(EGRET_341S0851) + MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maciivi, maclc ) + + MCFG_CPU_REPLACE("maincpu", M68030, C15M) + MCFG_CPU_PROGRAM_MAP(maclc3_map) + MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macv8) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) + + MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbvvram) + + MCFG_DEVICE_ADD("nubus", NUBUS, 0) + MCFG_NUBUS_CPU("maincpu") + MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) + MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) + MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) + MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) + MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) + MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) + MCFG_NUBUS_SLOT_ADD("nubus","nbc", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M,28M,32M,36M,40M,44M,48M,52M,56M,60M,64M") + + MCFG_EGRET_REPLACE(EGRET_341S0851) + MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maciix, macii ) + + MCFG_CPU_REPLACE("maincpu", M68030, C15M) + MCFG_CPU_PROGRAM_MAP(macii_map) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("8M,32M,64M,96M,128M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maciicx, maciix ) // IIcx is a IIx with only slots 9/a/b + MCFG_NUBUS_SLOT_REMOVE("nbc") + MCFG_NUBUS_SLOT_REMOVE("nbd") + MCFG_NUBUS_SLOT_REMOVE("nbe") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( macse30, mac_state ) + + MCFG_CPU_ADD("maincpu", M68030, C15M) + MCFG_CPU_PROGRAM_MAP(macse30_map) + + /* video hardware */ + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_REFRESH_RATE(60.15) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) + MCFG_SCREEN_SIZE(MAC_H_TOTAL, MAC_V_TOTAL) + MCFG_SCREEN_VISIBLE_AREA(0, MAC_H_VIS-1, 0, MAC_V_VIS-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macse30) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(mac_state,mac) + + MCFG_VIDEO_START_OVERRIDE(mac_state,mac) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* devices */ + MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) + + MCFG_DEVICE_ADD("pdss", NUBUS, 0) + MCFG_NUBUS_CPU("maincpu") + MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) + MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) + MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) + MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) + MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) + MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) + MCFG_NUBUS_SLOT_ADD("pds","pds030", mac_pds030_cards, NULL) + + MCFG_SWIM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,48M,64M,96M,128M") + + MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( macpb140, mac_state ) + + MCFG_CPU_ADD("maincpu", M68030, C15M) + MCFG_CPU_PROGRAM_MAP(macpb140_map) + + /* video hardware */ + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_REFRESH_RATE(60.15) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) + MCFG_SCREEN_SIZE(700, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macpb140) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(mac_state,mac) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* devices */ + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) + + MCFG_SWIM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b_via2pmu)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_via2pmu)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a_pmu)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b_pmu)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a_pmu)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b_pmu)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("4M,6M,8M") + + MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") +MACHINE_CONFIG_END + +// PowerBook 145 = 140 @ 25 MHz (still 2MB RAM - the 145B upped that to 4MB) +static MACHINE_CONFIG_DERIVED( macpb145, macpb140 ) + MCFG_CPU_REPLACE("maincpu", M68030, 25000000) + MCFG_CPU_PROGRAM_MAP(macpb140_map) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("6M,8M") +MACHINE_CONFIG_END + +// PowerBook 170 = 140 @ 25 MHz with an active-matrix LCD (140/145/145B were passive) +static MACHINE_CONFIG_DERIVED( macpb170, macpb140 ) + MCFG_CPU_REPLACE("maincpu", M68030, 25000000) + MCFG_CPU_PROGRAM_MAP(macpb140_map) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("6M,8M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( macpb160, mac_state ) + + MCFG_CPU_ADD("maincpu", M68030, 25000000) + MCFG_CPU_PROGRAM_MAP(macpb160_map) + + /* video hardware */ + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_REFRESH_RATE(60.15) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) + MCFG_SCREEN_SIZE(700, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macpb160) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(mac_state,macgsc) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* devices */ + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) + + MCFG_SWIM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b_via2pmu)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_via2pmu)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a_pmu)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b_pmu)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a_pmu)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b_pmu)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M") + + MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( macpb180, macpb160 ) + MCFG_CPU_REPLACE("maincpu", M68030, 33000000) + MCFG_CPU_PROGRAM_MAP(macpb160_map) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( macpb180c, macpb160 ) + MCFG_CPU_REPLACE("maincpu", M68030, 33000000) + MCFG_CPU_PROGRAM_MAP(macpb165c_map) + + MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) + MCFG_SCREEN_SIZE(800, 525) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macpbwd) + MCFG_SCREEN_NO_PALETTE + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M") +MACHINE_CONFIG_END +#if 0 +static MACHINE_CONFIG_DERIVED( macpd210, macpb160 ) + MCFG_CPU_REPLACE("maincpu", M68030, 25000000) + MCFG_CPU_PROGRAM_MAP(macpd210_map) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M") +MACHINE_CONFIG_END +#endif +static MACHINE_CONFIG_DERIVED( macclas2, maclc ) + MCFG_CPU_REPLACE("maincpu", M68030, C15M) + MCFG_CPU_PROGRAM_MAP(maclc_map) + MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macv8) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,maceagle) + + MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) + MCFG_SCREEN_SIZE(MAC_H_TOTAL, MAC_V_TOTAL) + MCFG_SCREEN_VISIBLE_AREA(0, MAC_H_VIS-1, 0, MAC_V_VIS-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv) + + MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_EAGLE, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("10M") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,6M,8M,10M") + + MCFG_EGRET_REPLACE(EGRET_341S0851) + MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maciici, macii ) + + MCFG_CPU_REPLACE("maincpu", M68030, 25000000) + MCFG_CPU_PROGRAM_MAP(maciici_map) + MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(256) + + // IIci only has slots c/d/e + MCFG_NUBUS_SLOT_REMOVE("nb9") + MCFG_NUBUS_SLOT_REMOVE("nba") + MCFG_NUBUS_SLOT_REMOVE("nbb") + + MCFG_VIDEO_START_OVERRIDE(mac_state,macrbv) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) + + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) + MCFG_SCREEN_SIZE(640, 870) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv) + MCFG_DEFAULT_LAYOUT(layout_mac) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M,48M,64M,128M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( maciisi, macii ) + + MCFG_CPU_REPLACE("maincpu", M68030, 20000000) + MCFG_CPU_PROGRAM_MAP(maciici_map) + MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(256) + + MCFG_NUBUS_SLOT_REMOVE("nb9") + MCFG_NUBUS_SLOT_REMOVE("nba") + MCFG_NUBUS_SLOT_REMOVE("nbb") + MCFG_NUBUS_SLOT_REMOVE("nbc") + MCFG_NUBUS_SLOT_REMOVE("nbd") + MCFG_NUBUS_SLOT_REMOVE("nbe") + MCFG_DEVICE_REMOVE("nubus") + + MCFG_VIDEO_START_OVERRIDE(mac_state,macrbv) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) + + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) + MCFG_SCREEN_SIZE(640, 870) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv) + MCFG_DEFAULT_LAYOUT(layout_mac) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M,48M,64M,128M") + + MCFG_DEVICE_MODIFY("via6522_0") + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_egadb)) + + MCFG_EGRET_ADD(EGRET_344S0100) + MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) + MCFG_QUANTUM_PERFECT_CPU("maincpu") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pwrmac, mac_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", PPC601, 60000000) + MCFG_CPU_PROGRAM_MAP(pwrmac_map) + + /* video hardware */ + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + // dot clock, htotal, hstart, hend, vtotal, vstart, vend + MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) + MCFG_SCREEN_SIZE(1024, 768) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv) + + MCFG_PALETTE_ADD("palette", 256) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macsonora) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_AWACS_ADD("awacs", 44100) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* devices */ + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) + + MCFG_IWM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_cdadb)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 783360) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8M") + MCFG_RAM_EXTRA_OPTIONS("16M,32M,64M,128M") + + MCFG_CUDA_ADD(CUDA_341S0060) + MCFG_CUDA_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) + MCFG_CUDA_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) + MCFG_CUDA_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_CUDA_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( macqd700, mac_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68040, 25000000) + MCFG_CPU_PROGRAM_MAP(quadra700_map) + + MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) + MCFG_SCREEN_REFRESH_RATE(75.08) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) + MCFG_SCREEN_SIZE(1152, 870) + MCFG_SCREEN_VISIBLE_AREA(0, 1152-1, 0, 870-1) + MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macdafb) + + MCFG_VIDEO_START_OVERRIDE(mac_state,macdafb) + MCFG_VIDEO_RESET_OVERRIDE(mac_state,macdafb) + + MCFG_PALETTE_ADD("palette", 256) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_ASC_ADD("asc", C15M, ASC_TYPE_EASC, WRITELINE(mac_state, mac_asc_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + /* devices */ + MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) + MCFG_DEVICE_ADD("nubus", NUBUS, 0) + MCFG_NUBUS_CPU("maincpu") + MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) + MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) + MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) + MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) + MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) + MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) + MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) + MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) + + MCFG_IWM_ADD("fdc", mac_iwm_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) + + MCFG_DEVICE_ADD("scc", SCC8530, C7M) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) + + MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, C7M/10) + MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD(MAC_539X_1_TAG, NCR539X, C7M) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_NCR539X_OUT_IRQ_CB(WRITELINE(mac_state, irq_539x_1_w)) + MCFG_NCR539X_OUT_DRQ_CB(WRITELINE(mac_state, drq_539x_1_w)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,64M,68M,72M,80M,96M,128M") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") +MACHINE_CONFIG_END + +static INPUT_PORTS_START( macplus ) + PORT_START("MOUSE0") /* Mouse - button */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) + + PORT_START("MOUSE1") /* Mouse - X AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START("MOUSE2") /* Mouse - Y AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + /* R Nabet 000531 : pseudo-input ports with keyboard layout */ + /* we only define US layout for keyboard - international layout is different! */ + /* note : 16 bits at most per port! */ + + /* main keyboard pad */ + + PORT_START("KEY0") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) /* extra key on ISO : */ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + + PORT_START("KEY1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("KEY2") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("KEY3") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) /* keyboard Enter : */ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_UNUSED) /* escape: */ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Option") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_UNUSED) /* Control: */ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_UNUSED) /* keypad pseudo-keycode */ + PORT_BIT(0xE000, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */ + + /* keypad */ + PORT_START("KEY4") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x0038, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad Clear") PORT_CODE(/*KEYCODE_NUMLOCK*/KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad =") PORT_CODE(/*CODE_OTHER*/KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT(0x0E00, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KEY5") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0xE000, IP_ACTIVE_HIGH, IPT_UNUSED) + + /* Arrow keys */ + PORT_START("KEY6") + PORT_BIT(0x0003, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Arrow") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x0038, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Arrow") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down Arrow") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x1E00, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up Arrow") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0xC000, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( macadb ) + PORT_START("MOUSE0") /* Mouse - button */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) + + PORT_START("MOUSE1") /* Mouse - X AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START("MOUSE2") /* Mouse - Y AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + /* This handles the standard (not Extended) Apple ADB keyboard, which is similar to the IIgs's */ + /* main keyboard */ + + PORT_START("KEY0") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) /* extra key on ISO : */ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + + PORT_START("KEY1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("KEY2") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("KEY3") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) /* keyboard Enter : */ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command / Open Apple") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Option / Solid Apple") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Arrow") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Arrow") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down Arrow") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up Arrow") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */ + + /* keypad */ + PORT_START("KEY4") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x40 + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // 0x41 + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x42 + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // 0x43 + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x44 + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // 0x45 + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x46 + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad Clear") PORT_CODE(/*KEYCODE_NUMLOCK*/KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) // 0x47 + PORT_BIT(0x0700, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x48, 49, 4a + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // 0x4b + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // 0x4c + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x4d + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // 0x4e + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x4f + + PORT_START("KEY5") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x50 + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad =") PORT_CODE(/*CODE_OTHER*/KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // 0x51 + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 0x52 + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 0x53 + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 0x54 + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 0x55 + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 0x56 + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 0x57 + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 0x58 + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 0x59 + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x5a + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 0x5b + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 0x5c + PORT_BIT(0xE000, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +INPUT_PORTS_START( maciici ) + PORT_INCLUDE(macadb) + + PORT_START("MONTYPE") + PORT_CONFNAME(0x0f, 0x06, "Connected monitor") + PORT_CONFSETTING( 0x01, "15\" Portrait Display (640x870)") + PORT_CONFSETTING( 0x02, "12\" RGB (512x384)") + PORT_CONFSETTING( 0x06, "13\" RGB (640x480)") +INPUT_PORTS_END + +/*************************************************************************** + + Game driver(s) + + The Mac driver uses a convention of placing the BIOS in "bootrom" + +***************************************************************************/ + +/* +ROM_START( mactw ) + ROM_REGION16_BE(0x20000, "bootrom", 0) + ROM_LOAD( "rom4.3t_07-04-83.bin", 0x0000, 0x10000, CRC(d2c42f18) SHA1(f868c09ca70383a69751c37a5a3110a9597462a4) ) +ROM_END +*/ + +ROM_START( mac128k ) + ROM_REGION16_BE(0x20000, "bootrom", 0) + ROM_LOAD16_WORD( "mac128k.rom", 0x00000, 0x10000, CRC(6d0c8a28) SHA1(9d86c883aa09f7ef5f086d9e32330ef85f1bc93b) ) +ROM_END + +ROM_START( mac512k ) + ROM_REGION16_BE(0x20000, "bootrom", 0) + ROM_LOAD16_WORD( "mac512k.rom", 0x00000, 0x10000, CRC(cf759e0d) SHA1(5b1ced181b74cecd3834c49c2a4aa1d7ffe944d7) ) +ROM_END + +ROM_START( unitron ) + ROM_REGION16_BE(0x20000, "bootrom", 0) + ROM_LOAD16_WORD( "unitron_512.rom", 0x00000, 0x10000, CRC(1eabd37f) SHA1(a3d3696c08feac6805effb7ee07b68c2bf1a8dd7) ) +ROM_END + +ROM_START( mac512ke ) + ROM_REGION16_BE(0x20000, "bootrom", 0) + ROM_LOAD16_WORD( "macplus.rom", 0x00000, 0x20000, CRC(b2102e8e) SHA1(7d2f808a045aa3a1b242764f0e2c7d13e288bf1f)) +ROM_END + + +ROM_START( macplus ) + ROM_REGION16_BE(0x40000, "bootrom", 0) + ROM_SYSTEM_BIOS(0, "v3", "Loud Harmonicas") + ROMX_LOAD( "macplus.rom", 0x00000, 0x20000, CRC(b2102e8e) SHA1(7d2f808a045aa3a1b242764f0e2c7d13e288bf1f), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "v2", "Lonely Heifers") + ROMX_LOAD( "23512-1007__342-0342-a.rom-lo.u7d", 0x000000, 0x010000, CRC(5aaa4a2f) SHA1(5dfbfbe279ddadfae691c95f552fd9db41e3ed90), ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD( "23512-1010__342-0341-b.rom-hi.u6d", 0x000001, 0x010000, CRC(65341487) SHA1(bf43fa4f5a3dcbbac20f1fe1deedee0895454379), ROM_SKIP(1) | ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "v1", "Lonely Hearts") + ROMX_LOAD( "4d1eeee1 - macplus v1.rom", 0x000000, 0x020000, CRC(4fa5b399) SHA1(e0da7165b92dee90d8b1522429c033729fa73fd2), ROM_GROUPWORD | ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "romdisk", "mac68k.info self-boot (1/1/2015)") + ROMX_LOAD( "modplus-harp2.bin", 0x000000, 0x028000, CRC(ba56078d) SHA1(debdf328ac73e1662d274a044d8750224f47edef), ROM_GROUPWORD | ROM_BIOS(4) ) +ROM_END + + +ROM_START( macse ) + ROM_REGION16_BE(0x40000, "bootrom", 0) + ROM_LOAD16_WORD( "macse.rom", 0x00000, 0x40000, CRC(0f7ff80c) SHA1(58532b7d0d49659fd5228ac334a1b094f0241968)) +ROM_END + +ROM_START( macsefd ) + ROM_REGION16_BE(0x40000, "bootrom", 0) + ROM_LOAD( "be06e171.rom", 0x000000, 0x040000, CRC(f530cb10) SHA1(d3670a90273d12e53d86d1228c068cb660b8c9d1) ) +ROM_END + +ROM_START( macclasc ) + ROM_REGION16_BE(0x80000, "bootrom", 0) + ROM_LOAD( "a49f9914.rom", 0x000000, 0x080000, CRC(510d7d38) SHA1(ccd10904ddc0fb6a1d216b2e9effd5ec6cf5a83d) ) +ROM_END + +ROM_START( maclc ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD("350eacf0.rom", 0x000000, 0x080000, CRC(71681726) SHA1(6bef5853ae736f3f06c2b4e79772f65910c3b7d4)) + + ROM_REGION(0x1100, "egret", 0) + ROM_LOAD( "341s0851.bin", 0x000000, 0x001100, CRC(ea9ea6e4) SHA1(8b0dae3ec66cdddbf71567365d2c462688aeb571) ) +ROM_END + +ROM_START( macii ) + ROM_REGION32_BE(0x40000, "bootrom", 0) + ROM_SYSTEM_BIOS(0, "default", "rev. B") + ROMX_LOAD( "9779d2c4.rom", 0x000000, 0x040000, CRC(4df6d054) SHA1(db6b504744281369794e26ba71a6e385cf6227fa), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "original", "rev. A") + ROMX_LOAD( "97851db6.rom", 0x000000, 0x040000, CRC(8c8b9d03) SHA1(5c264fe976f1e8495d364947c932a5e8309b4300), ROM_BIOS(2) ) +ROM_END + +ROM_START( maciihmu ) + ROM_REGION32_BE(0x40000, "bootrom", 0) + ROM_SYSTEM_BIOS(0, "default", "rev. B") + ROMX_LOAD( "9779d2c4.rom", 0x000000, 0x040000, CRC(4df6d054) SHA1(db6b504744281369794e26ba71a6e385cf6227fa), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "original", "rev. A") + ROMX_LOAD( "97851db6.rom", 0x000000, 0x040000, CRC(8c8b9d03) SHA1(5c264fe976f1e8495d364947c932a5e8309b4300), ROM_BIOS(2) ) +ROM_END + +ROM_START( mac2fdhd ) // same ROM for II FDHD, IIx, IIcx, and SE/30 + ROM_REGION32_BE(0x40000, "bootrom", 0) + ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) ) +ROM_END + +ROM_START( maciix ) + ROM_REGION32_BE(0x40000, "bootrom", 0) + ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) ) +ROM_END + +ROM_START( maciicx ) + ROM_REGION32_BE(0x40000, "bootrom", 0) + ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) ) +ROM_END + +ROM_START( macse30 ) + ROM_REGION32_BE(0x40000, "bootrom", 0) + ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) ) + + ROM_REGION32_BE(0x2000, "se30vrom", 0) + ROM_LOAD( "se30vrom.uk6", 0x000000, 0x002000, CRC(b74c3463) SHA1(584201cc67d9452b2488f7aaaf91619ed8ce8f03) ) +ROM_END + +ROM_START( maciifx ) + ROM_REGION32_BE(0x80000, "bootrom", 0) + ROM_LOAD( "4147dd77.rom", 0x000000, 0x080000, CRC(ef441bbd) SHA1(9fba3d4f672a630745d65788b1d1119afa2c6728) ) +ROM_END + +ROM_START( maciici ) + ROM_REGION32_BE(0x80000, "bootrom", 0) + ROM_LOAD( "368cadfe.rom", 0x000000, 0x080000, CRC(46adbf74) SHA1(b54f9d2ed16b63c49ed55adbe4685ebe73eb6e80) ) +ROM_END + +ROM_START( maciisi ) + ROM_REGION32_BE(0x80000, "bootrom", 0) + ROM_LOAD( "36b7fb6c.rom", 0x000000, 0x080000, CRC(f304d973) SHA1(f923de4125aae810796527ff6e25364cf1d54eec) ) +ROM_END + +ROM_START( maciivx ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "4957eb49.rom", 0x000000, 0x100000, CRC(61be06e5) SHA1(560ce203d65178657ad09d03f532f86fa512bb40) ) +ROM_END + +ROM_START( maciivi ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "4957eb49.rom", 0x000000, 0x100000, CRC(61be06e5) SHA1(560ce203d65178657ad09d03f532f86fa512bb40) ) +ROM_END + +ROM_START( macclas2 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "3193670e.rom", 0x000000, 0x080000, CRC(96d2e1fd) SHA1(50df69c1b6e805e12a405dc610bc2a1471b2eac2) ) +ROM_END + +ROM_START( maclc2 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD32_BYTE( "341-0476_ue2-hh.bin", 0x000000, 0x020000, CRC(0c3b0ce4) SHA1(e4e8c883d7f2e002a3f7b7aefaa3840991e57025) ) + ROM_LOAD32_BYTE( "341-0475_ud2-mh.bin", 0x000001, 0x020000, CRC(7b013595) SHA1(0b82d8fac570270db9774f6254017d28611ae756) ) + ROM_LOAD32_BYTE( "341-0474_uc2-ml.bin", 0x000002, 0x020000, CRC(2ff2f52b) SHA1(876850df61d0233c1dd3c00d48d8d6690186b164) ) + ROM_LOAD32_BYTE( "341-0473_ub2-ll.bin", 0x000003, 0x020000, CRC(8843c37c) SHA1(bb5104110507ca543d106f11c6061245fd90c1a7) ) +ROM_END + +ROM_START( maclc3 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "ecbbc41c.rom", 0x000000, 0x100000, CRC(e578f5f3) SHA1(c77df3220c861f37a2c553b6ee9241b202dfdffc) ) +ROM_END + +ROM_START( pmac6100 ) + ROM_REGION64_BE(0x400000, "bootrom", 0) + ROM_LOAD( "9feb69b3.rom", 0x000000, 0x400000, CRC(a43fadbc) SHA1(6fac1c4e920a077c077b03902fef9199d5e8f2c3) ) +ROM_END + +ROM_START( macprtb ) + ROM_REGION16_BE(0x40000, "bootrom", 0) + ROM_LOAD16_WORD( "93ca3846.rom", 0x000000, 0x040000, CRC(497348f8) SHA1(79b468b33fc53f11e87e2e4b195aac981bf0c0a6) ) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv1.bin", 0x000000, 0x001800, CRC(01dae148) SHA1(29d2fca7426c31f2b9334832ed3d257974a61bb1) ) +ROM_END + +ROM_START( macpb100 ) + ROM_REGION16_BE(0x40000, "bootrom", 0) + ROM_LOAD16_WORD( "96645f9c.rom", 0x000000, 0x040000, CRC(29ac7ee9) SHA1(7f3acf40b1f63612de2314a2e9fcfeafca0711fc) ) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv1.bin", 0x000000, 0x001800, CRC(01dae148) SHA1(29d2fca7426c31f2b9334832ed3d257974a61bb1) ) +ROM_END + +ROM_START( macpb140 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) +ROM_END + +ROM_START( macpb145 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) +ROM_END + +ROM_START( macpb145b ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) +ROM_END + +ROM_START( macpb170 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) +ROM_END + +ROM_START( macqd700 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) +ROM_END + +ROM_START( macpb160 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "e33b2724.rom", 0x000000, 0x100000, CRC(536c60f4) SHA1(c0510682ae6d973652d7e17f3c3b27629c47afac) ) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv3.bin", 0x000000, 0x001800, CRC(f2df696c) SHA1(fc312cbfd407c6f0248c6463910e41ad6b5b0daa) ) +ROM_END + +ROM_START( macpb180 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "e33b2724.rom", 0x000000, 0x100000, CRC(536c60f4) SHA1(c0510682ae6d973652d7e17f3c3b27629c47afac) ) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv3.bin", 0x000000, 0x001800, CRC(f2df696c) SHA1(fc312cbfd407c6f0248c6463910e41ad6b5b0daa) ) +ROM_END + +ROM_START( macpb180c ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "e33b2724.rom", 0x000000, 0x100000, CRC(536c60f4) SHA1(c0510682ae6d973652d7e17f3c3b27629c47afac) ) + + ROM_REGION32_BE(0x8000, "vrom", 0) + ROM_LOAD( "pb180cvrom.bin", 0x0000, 0x8000, CRC(810c75ad) SHA1(3a936e97dee5ceeb25e50197ef504e514ae689a4)) + + ROM_REGION(0x1800, "pmu", 0) + ROM_LOAD( "pmuv3.bin", 0x000000, 0x001800, CRC(f2df696c) SHA1(fc312cbfd407c6f0248c6463910e41ad6b5b0daa) ) +ROM_END + +ROM_START( maccclas ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "ecd99dc0.rom", 0x000000, 0x100000, CRC(c84c3aa5) SHA1(fd9e852e2d77fe17287ba678709b9334d4d74f1e) ) +ROM_END +/* +ROM_START( macpd210 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "ecfa989b.rom", 0x000000, 0x100000, CRC(b86ed854) SHA1(ed1371c97117a5884da4a6605ecfc5abed48ae5a) ) +ROM_END +*/ + +ROM_START( maclc520 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "ede66cbd.rom", 0x000000, 0x100000, CRC(a893cb0f) SHA1(c54ee2f45020a4adeb7451adce04cd6e5fb69790) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +//COMP( 1983, mactw, 0, 0, mac128k, macplus, mac_state, mac128k512k, "Apple Computer", "Macintosh (4.3T Prototype)", MACHINE_NOT_WORKING ) +COMP( 1984, mac128k, 0, 0, mac128k, macplus, mac_state, mac128k512k, "Apple Computer", "Macintosh 128k", MACHINE_NOT_WORKING ) +COMP( 1984, mac512k, mac128k, 0, mac512ke, macplus, mac_state, mac128k512k, "Apple Computer", "Macintosh 512k", MACHINE_NOT_WORKING ) +COMP( 1986, mac512ke, macplus, 0, mac512ke, macplus, mac_state, mac512ke, "Apple Computer", "Macintosh 512ke", 0 ) +COMP( 1985, unitron, macplus, 0, mac512ke, macplus, mac_state, mac512ke, "bootleg (Unitron)", "Mac 512", MACHINE_NOT_WORKING ) +COMP( 1986, macplus, 0, 0, macplus, macplus, mac_state, macplus, "Apple Computer", "Macintosh Plus", 0 ) +COMP( 1987, macse, 0, 0, macse, macadb, mac_state, macse, "Apple Computer", "Macintosh SE", 0 ) +COMP( 1987, macsefd, 0, 0, macse, macadb, mac_state, macse, "Apple Computer", "Macintosh SE (FDHD)", 0 ) +COMP( 1987, macii, 0, 0, macii, macadb, mac_state, macii, "Apple Computer", "Macintosh II", 0 ) +COMP( 1987, maciihmu, macii, 0, maciihmu, macadb, mac_state, macii, "Apple Computer", "Macintosh II (w/o 68851 MMU)", 0 ) +COMP( 1988, mac2fdhd, 0, 0, macii, macadb, mac_state, maciifdhd, "Apple Computer", "Macintosh II (FDHD)", 0 ) +COMP( 1988, maciix, mac2fdhd, 0, maciix, macadb, mac_state, maciix, "Apple Computer", "Macintosh IIx", 0 ) +COMP( 1989, macprtb, 0, 0, macprtb, macadb, mac_state, macprtb, "Apple Computer", "Macintosh Portable", MACHINE_NOT_WORKING ) +COMP( 1989, macse30, mac2fdhd, 0, macse30, macadb, mac_state, macse30, "Apple Computer", "Macintosh SE/30", 0 ) +COMP( 1989, maciicx, mac2fdhd, 0, maciicx, macadb, mac_state, maciicx, "Apple Computer", "Macintosh IIcx", 0 ) +COMP( 1989, maciici, 0, 0, maciici, maciici, mac_state, maciici, "Apple Computer", "Macintosh IIci", 0 ) +COMP( 1990, maciifx, 0, 0, maciifx, macadb, mac_state, maciifx, "Apple Computer", "Macintosh IIfx", MACHINE_NOT_WORKING ) +COMP( 1990, macclasc, 0, 0, macclasc, macadb, mac_state, macclassic, "Apple Computer", "Macintosh Classic", 0 ) +COMP( 1990, maclc, 0, 0, maclc, maciici, mac_state, maclc, "Apple Computer", "Macintosh LC", MACHINE_IMPERFECT_SOUND ) +COMP( 1990, maciisi, 0, 0, maciisi, maciici, mac_state, maciisi, "Apple Computer", "Macintosh IIsi", 0 ) +COMP( 1991, macpb100, 0, 0, macprtb, macadb, mac_state, macprtb, "Apple Computer", "Macintosh PowerBook 100", MACHINE_NOT_WORKING ) +COMP( 1991, macpb140, 0, 0, macpb140, macadb, mac_state, macpb140, "Apple Computer", "Macintosh PowerBook 140", MACHINE_NOT_WORKING ) +COMP( 1991, macpb170, macpb140, 0, macpb170, macadb, mac_state, macpb140, "Apple Computer", "Macintosh PowerBook 170", MACHINE_NOT_WORKING ) +COMP( 1991, macqd700, macpb140, 0, macqd700, macadb, mac_state, macquadra700, "Apple Computer", "Macintosh Quadra 700", MACHINE_NOT_WORKING ) +COMP( 1991, macclas2, 0, 0, macclas2, macadb, mac_state, macclassic2, "Apple Computer", "Macintosh Classic II", MACHINE_IMPERFECT_SOUND ) +COMP( 1991, maclc2, 0, 0, maclc2, maciici, mac_state, maclc2, "Apple Computer", "Macintosh LC II", MACHINE_IMPERFECT_SOUND ) +COMP( 1992, macpb145, macpb140, 0, macpb145, macadb, mac_state, macpb140, "Apple Computer", "Macintosh PowerBook 145", MACHINE_NOT_WORKING ) +COMP( 1992, macpb160, 0, 0, macpb160, macadb, mac_state, macpb160, "Apple Computer", "Macintosh PowerBook 160", MACHINE_NOT_WORKING ) +COMP( 1992, macpb180, macpb160, 0, macpb180, macadb, mac_state, macpb160, "Apple Computer", "Macintosh PowerBook 180", MACHINE_NOT_WORKING ) +COMP( 1992, macpb180c,macpb160, 0, macpb180c,macadb, mac_state, macpb160, "Apple Computer", "Macintosh PowerBook 180c", MACHINE_NOT_WORKING ) +//COMP( 1992, macpd210, 0, 0, macpd210, macadb, mac_state, macpd210, "Apple Computer", "Macintosh PowerBook Duo 210", MACHINE_NOT_WORKING ) +COMP( 1993, maccclas, 0, 0, maccclas, macadb, mac_state, maclrcclassic,"Apple Computer", "Macintosh Color Classic", MACHINE_NOT_WORKING ) +COMP( 1992, macpb145b,macpb140, 0, macpb170, macadb, mac_state, macpb140, "Apple Computer", "Macintosh PowerBook 145B", MACHINE_NOT_WORKING ) +COMP( 1993, maclc3, 0, 0, maclc3, maciici, mac_state, maclc3, "Apple Computer", "Macintosh LC III", MACHINE_IMPERFECT_SOUND ) +COMP( 1993, maciivx, 0, 0, maciivx, maciici, mac_state, maciivx, "Apple Computer", "Macintosh IIvx", MACHINE_IMPERFECT_SOUND ) +COMP( 1993, maciivi, maciivx, 0, maciivi, maciici, mac_state, maciivx, "Apple Computer", "Macintosh IIvi", MACHINE_IMPERFECT_SOUND ) +COMP( 1993, maclc520, 0, 0, maclc520, maciici, mac_state, maclc520, "Apple Computer", "Macintosh LC 520", MACHINE_NOT_WORKING ) +COMP( 1994, pmac6100, 0, 0, pwrmac, macadb, mac_state, macpm6100, "Apple Computer", "Power Macintosh 6100/60", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/macpci.c b/src/mame/drivers/macpci.c new file mode 100644 index 00000000000..10f938d108f --- /dev/null +++ b/src/mame/drivers/macpci.c @@ -0,0 +1,166 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + macpci.c: second-generation Old World PowerMacs based on PCI instead of NuBus + + Preliminary driver by R. Belmont (based on pippin.c skeleton by Angelo Salese) + + Pippin: + + Apple ASICs identified: + ----------------------- + 343S1125 Grand Central (SWIM III, Sound, VIA) + 341S0060 Cuda (68HC05 MCU, handles ADB and parameter ("CMOS") RAM) + 343S1146 ??? (likely SCSI due to position on board) + 343S1191(x2) Athens Prime PLL Clock Generator + + Other chips + ----------- + Z8530 SCC + CS4217 audio DAC + Bt856 video DAC + + Pippin-type map + F3000000 : Grand Central DMA/IRQ controller + F3012000 : SCC + F3013000 : Grand Central system controller + F3014000 : AWACS audio + F3015000 : SWIM III + F3016000 : VIA1 + F3018000 : SCSI (53C96) + + NOTE: the PowerPC starts off disabled; the Cuda 68HC05 starts it up once it's booted. + + NOTE 2: goes off into the weeds in the subroutine at fff05010 + +****************************************************************************/ + +#include "emu.h" +#include "includes/macpci.h" +#include "cpu/powerpc/ppc.h" +#include "imagedev/chd_cd.h" +#include "sound/cdda.h" + +READ64_MEMBER( macpci_state::unk1_r ) +{ + m_unk1_test ^= 0x0400; //PC=ff808760 + + return m_unk1_test << 16; +} + +READ64_MEMBER( macpci_state::unk2_r ) +{ + if (ACCESSING_BITS_32_47) + return (UINT64)0xe1 << 32; //PC=fff04810 + + return 0; +} + +static ADDRESS_MAP_START(pippin_mem, AS_PROGRAM, 64, macpci_state) + AM_RANGE(0x00000000, 0x005fffff) AM_RAM + + /* writes at 0x0*c01000 the string "Mr. Kesh" and wants it to be read back, true color VRAMs perhaps? */ + AM_RANGE(0x00c00000, 0x00c01007) AM_RAM + AM_RANGE(0x01c00000, 0x01c01007) AM_RAM + AM_RANGE(0x02c00000, 0x02c01007) AM_RAM + AM_RANGE(0x03c00000, 0x03c01007) AM_RAM + + AM_RANGE(0x40000000, 0x403fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0fc00000) // mirror of ROM for 680x0 emulation + + AM_RANGE(0xf00dfff8, 0xf00dffff) AM_READ(unk2_r) + AM_RANGE(0xf3008800, 0xf3008807) AM_READ(unk1_r) + + AM_RANGE(0xf3016000, 0xf3017fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff)) + + AM_RANGE(0xffc00000, 0xffffffff) AM_ROM AM_REGION("bootrom",0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pippin ) +INPUT_PORTS_END + + +UINT32 macpci_state::screen_update_pippin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( pippin, macpci_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", PPC603, 66000000) + MCFG_CPU_PROGRAM_MAP(pippin_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(macpci_state, screen_update_pippin) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_ADD( "cdda", CDDA, 0 ) + MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) + MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) + + MCFG_CDROM_ADD("cdrom") + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32M") + + MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10) + MCFG_VIA6522_READPA_HANDLER(READ8(macpci_state, mac_via_in_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(macpci_state, mac_via_in_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(macpci_state,mac_via_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(macpci_state,mac_via_out_b)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(macpci_state, mac_adb_via_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(macpci_state,mac_via_irq)) + + //MCFG_DEVICE_ADD("scc", SCC8530, C7M) + //MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(macpci_state, set_scc_interrupt)) + MCFG_CUDA_ADD(CUDA_341S0060) + MCFG_CUDA_RESET_CALLBACK(WRITELINE(macpci_state, cuda_reset_w)) + MCFG_CUDA_LINECHANGE_CALLBACK(WRITELINE(macpci_state, cuda_adb_linechange_w)) + MCFG_CUDA_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) + MCFG_CUDA_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) + MCFG_QUANTUM_PERFECT_CPU("maincpu") +MACHINE_CONFIG_END + +/* ROM definition */ +/* + + BIOS versions + + dev + monitor 341S0241 - 245,247,248,250 + 1.0 341S0251..254 U1-U4 + 1.2 341S0297..300 U15,U20,U31,U35 + 1.3 341S0328..331 U1/U31, U2/U35, U3/U15 and U4/U20 + +*/ + +ROM_START( pippin ) + ROM_REGION( 0x400000, "bootrom", ROMREGION_64BIT | ROMREGION_BE ) + ROM_SYSTEM_BIOS(0, "v1", "Kinka v 1.0") + ROMX_LOAD( "341s0251.u1", 0x000006, 0x100000, CRC(aaea2449) SHA1(2f63e215260a42fb7c5f2364682d5e8c0604646f),ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6) | ROM_BIOS(1)) + ROMX_LOAD( "341s0252.u2", 0x000004, 0x100000, CRC(3d584419) SHA1(e29c764816755662693b25f1fb3c24faef4e9470),ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6) | ROM_BIOS(1)) + ROMX_LOAD( "341s0253.u3", 0x000002, 0x100000, CRC(d8ae5037) SHA1(d46ce4d87ca1120dfe2cf2ba01451f035992b6f6),ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6) | ROM_BIOS(1)) + ROMX_LOAD( "341s0254.u4", 0x000000, 0x100000, CRC(3e2851ba) SHA1(7cbf5d6999e890f5e9ab2bc4b10ca897c4dc2016),ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6) | ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "pre", "Kinka pre-release") + ROMX_LOAD( "kinka-pre.rom", 0x000000, 0x400000, CRC(4ff875e6) SHA1(eb8739cab1807c6c7c51acc7f4a3afc1f9c6ddbb),ROM_BIOS(2)) + + ROM_REGION( 0x10000, "cdrom", 0 ) /* MATSUSHITA CR504-L OEM */ + ROM_LOAD( "504par4.0i.ic7", 0x0000, 0x10000, CRC(25f7dd46) SHA1(ec3b3031742807924c6259af865e701827208fec) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1996, pippin, 0, 0, pippin, pippin, driver_device, 0, "Apple / Bandai", "Pippin @mark", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/mbc200.c b/src/mame/drivers/mbc200.c new file mode 100644 index 00000000000..104b12435e4 --- /dev/null +++ b/src/mame/drivers/mbc200.c @@ -0,0 +1,267 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Sanyo MBC-200 + + Machine MBC-1200 is identical but sold outside of Japan + + 16 x HM6116P-3 2K x 8 SRAM soldered onboard (so 32k ram) + 4 x HM6116P-3 2K x 8 SRAM socketed (so 8k ram) + 4 x MB83256 32K x 8 socketed (128k ram) + Floppy = 5.25" + MBC1200 has one floppy while MBC1250 has 2. The systems + are otherwise identical. + + On back side: + - keyboard DIN connector + - Centronics printer port + - RS-232C 25pin connector + + TODO: + - Keyboard + - Sound + - CP/M display (it runs into the weeds internally) + - Other connections to the various PPI's + - UART connections + - Any other devices? + + 2011-10-31 Skeleton driver. + 2014-05-18 Made rom get copied into ram, boot code from disk + requires that ram is there otherwise you get + a MEMORY ERROR. Now, CP/M loads and is executed, but + nothing shows on the screen. + Tried new wdc code, but the disk couldn't be read at all. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "video/mc6845.h" +#include "machine/wd_fdc.h" + + +class mbc200_state : public driver_device +{ +public: + mbc200_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_crtc(*this, "crtc") + , m_ppi_m(*this, "ppi_m") + , m_vram(*this, "vram") + , m_maincpu(*this, "maincpu") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + { } + + DECLARE_READ8_MEMBER(p2_porta_r); + DECLARE_WRITE8_MEMBER(pm_porta_w); + DECLARE_WRITE8_MEMBER(pm_portb_w); + MC6845_UPDATE_ROW(update_row); + required_device m_palette; + +private: + virtual void machine_start(); + virtual void machine_reset(); + UINT8 m_comm_latch; + required_device m_crtc; + required_device m_ppi_m; + required_shared_ptr m_vram; + required_device m_maincpu; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; +}; + + +static ADDRESS_MAP_START(mbc200_mem, AS_PROGRAM, 8, mbc200_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_RAM AM_REGION("maincpu", 0) + AM_RANGE( 0x1000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +WRITE8_MEMBER( mbc200_state::pm_porta_w ) +{ + machine().scheduler().synchronize(); // force resync + printf("A %02x %c\n",data,data); + m_comm_latch = data; // to slave CPU +} + +WRITE8_MEMBER( mbc200_state::pm_portb_w ) +{ + floppy_image_device *floppy = NULL; + + // to be verified + switch (data & 0x01) + { + case 0: floppy = m_floppy0->get_device(); break; + case 1: floppy = m_floppy1->get_device(); break; + } + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 7)); + } +} + +static ADDRESS_MAP_START( mbc200_io , AS_IO, 8, mbc200_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xe0, 0xe0) AM_DEVREADWRITE("i8251_1", i8251_device, data_r, data_w) + AM_RANGE(0xe1, 0xe1) AM_DEVREADWRITE("i8251_1", i8251_device, status_r, control_w) + AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("fdc", mb8876_t, read, write) + AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("ppi_m", i8255_device, read, write) + AM_RANGE(0xec, 0xec) AM_DEVREADWRITE("i8251_2", i8251_device, data_r, data_w) + AM_RANGE(0xed, 0xed) AM_DEVREADWRITE("i8251_2", i8251_device, status_r, control_w) +ADDRESS_MAP_END + + + +static ADDRESS_MAP_START(mbc200_sub_mem, AS_PROGRAM, 8, mbc200_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x2fff ) AM_ROM + AM_RANGE( 0x3000, 0x7fff ) AM_RAM + AM_RANGE( 0x8000, 0xffff ) AM_RAM AM_SHARE("vram") +ADDRESS_MAP_END + +READ8_MEMBER(mbc200_state::p2_porta_r) +{ + machine().scheduler().synchronize(); // force resync + UINT8 tmp = m_comm_latch; + m_comm_latch = 0; + m_ppi_m->pc6_w(0); // ppi_ack + return tmp; +} + +static ADDRESS_MAP_START( mbc200_sub_io , AS_IO, 8, mbc200_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x70, 0x73) AM_DEVREADWRITE("ppi_1", i8255_device, read, write) + AM_RANGE(0xb0, 0xb0) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0xb1, 0xb1) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("ppi_2", i8255_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mbc200 ) +INPUT_PORTS_END + +void mbc200_state::machine_start() +{ +} + +void mbc200_state::machine_reset() +{ + UINT8* roms = memregion("roms")->base(); + UINT8* main = memregion("maincpu")->base(); + memcpy(main, roms, 0x1000); +} + +static SLOT_INTERFACE_START( mbc200_floppies ) + SLOT_INTERFACE("qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +MC6845_UPDATE_ROW( mbc200_state::update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 gfx; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + mem = (ma+x)*4+ra; + gfx = m_vram[mem]; + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} + +static const gfx_layout mbc200_chars_8x8 = +{ + 8,8, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( mbc200 ) + GFXDECODE_ENTRY( "subcpu", 0x1800, mbc200_chars_8x8, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( mbc200, mbc200_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz/2) // NEC D780C-1 + MCFG_CPU_PROGRAM_MAP(mbc200_mem) + MCFG_CPU_IO_MAP(mbc200_io) + + MCFG_CPU_ADD("subcpu",Z80, XTAL_8MHz/2) // NEC D780C-1 + MCFG_CPU_PROGRAM_MAP(mbc200_sub_mem) + MCFG_CPU_IO_MAP(mbc200_sub_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", h46505_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mbc200) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_8MHz / 4) // HD46505SP + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(mbc200_state, update_row) + + MCFG_DEVICE_ADD("ppi_1", I8255, 0) + + MCFG_DEVICE_ADD("ppi_2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mbc200_state, p2_porta_r)) + + MCFG_DEVICE_ADD("ppi_m", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mbc200_state, pm_porta_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mbc200_state, pm_portb_w)) + + MCFG_DEVICE_ADD("i8251_1", I8251, 0) // INS8251N + MCFG_DEVICE_ADD("i8251_2", I8251, 0) // INS8251A + + MCFG_MB8876_ADD("fdc", XTAL_8MHz / 8) // guess + MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbc200_floppies, "qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbc200_floppies, "qd", floppy_image_device::default_floppy_formats) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("flop_list", "mbc200") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mbc200 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x1000, "roms", 0 ) + ROM_LOAD( "d2732a.bin", 0x0000, 0x1000, CRC(bf364ce8) SHA1(baa3a20a5b01745a390ef16628dc18f8d682d63b)) + ROM_REGION( 0x10000, "subcpu", ROMREGION_ERASEFF ) + ROM_LOAD( "m5l2764.bin", 0x0000, 0x2000, CRC(377300a2) SHA1(8563172f9e7f84330378a8d179f4138be5fda099)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, mbc200, 0, 0, mbc200, mbc200, driver_device, 0, "Sanyo", "MBC-200", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mbc55x.c b/src/mame/drivers/mbc55x.c new file mode 100644 index 00000000000..602eb146c8a --- /dev/null +++ b/src/mame/drivers/mbc55x.c @@ -0,0 +1,316 @@ +// license:BSD-3-Clause +// copyright-holders:Phill Harvey-Smith +/* + drivers/mbc55x.c + + Machine driver for the Sanyo MBC-550 and MBC-555. + + Phill Harvey-Smith + 2011-01-29. + + +ToDo: +- Fix the sound +- Add serial uart + +*/ + + +#include "includes/mbc55x.h" + + +const unsigned char mbc55x_palette[SCREEN_NO_COLOURS][3] = +{ + /*normal brightness */ + { 0x00,0x00,0x00 }, /* black */ + { 0x00,0x00,0x80 }, /* blue */ + { 0x00,0x80,0x00 }, /* green */ + { 0x00,0x80,0x80 }, /* cyan */ + { 0x80,0x00,0x00 }, /* red */ + { 0x80,0x00,0x80 }, /* magenta */ + { 0x80,0x80,0x00 }, /* yellow */ + { 0x80,0x80,0x80 }, /* light grey */ +}; + + +static ADDRESS_MAP_START(mbc55x_mem, AS_PROGRAM, 8, mbc55x_state) + AM_RANGE( 0x00000, 0x0FFFF ) AM_RAMBANK(RAM_BANK00_TAG) + AM_RANGE( 0x10000, 0x1FFFF ) AM_RAMBANK(RAM_BANK01_TAG) + AM_RANGE( 0x20000, 0x2FFFF ) AM_RAMBANK(RAM_BANK02_TAG) + AM_RANGE( 0x30000, 0x3FFFF ) AM_RAMBANK(RAM_BANK03_TAG) + AM_RANGE( 0x40000, 0x4FFFF ) AM_RAMBANK(RAM_BANK04_TAG) + AM_RANGE( 0x50000, 0x5FFFF ) AM_RAMBANK(RAM_BANK05_TAG) + AM_RANGE( 0x60000, 0x6FFFF ) AM_RAMBANK(RAM_BANK06_TAG) + AM_RANGE( 0x70000, 0x7FFFF ) AM_RAMBANK(RAM_BANK07_TAG) + AM_RANGE( 0x80000, 0x8FFFF ) AM_RAMBANK(RAM_BANK08_TAG) + AM_RANGE( 0x90000, 0x9FFFF ) AM_RAMBANK(RAM_BANK09_TAG) + AM_RANGE( 0xA0000, 0xAFFFF ) AM_RAMBANK(RAM_BANK0A_TAG) + AM_RANGE( 0xB0000, 0xBFFFF ) AM_RAMBANK(RAM_BANK0B_TAG) + AM_RANGE( 0xC0000, 0xCFFFF ) AM_RAMBANK(RAM_BANK0C_TAG) + AM_RANGE( 0xD0000, 0xDFFFF ) AM_RAMBANK(RAM_BANK0D_TAG) + AM_RANGE( 0xE0000, 0xEFFFF ) AM_RAMBANK(RAM_BANK0E_TAG) + AM_RANGE( 0xF0000, 0xF3FFF ) AM_RAMBANK(RED_PLANE_TAG) + AM_RANGE( 0xF4000, 0xF7FFF ) AM_RAMBANK(BLUE_PLANE_TAG) + AM_RANGE( 0xF8000, 0xFBFFF ) AM_NOP + AM_RANGE( 0xFC000, 0xFFFFF ) AM_ROM AM_WRITENOP AM_REGION(MAINCPU_TAG, 0x0000) AM_MIRROR(0x002000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbc55x_io, AS_IO, 8, mbc55x_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0X0000, 0X0003) AM_READWRITE(mbcpic8259_r, mbcpic8259_w) + AM_RANGE( 0x0008, 0x000F) AM_READWRITE(mbc55x_disk_r, mbc55x_disk_w) + AM_RANGE( 0X0010, 0X0010) AM_READWRITE( vram_page_r, vram_page_w) + AM_RANGE( 0x0018, 0x001F) AM_READWRITE( ppi8255_r, ppi8255_w) + AM_RANGE( 0X0020, 0X0027) AM_READWRITE(mbcpit8253_r, mbcpit8253_w) + AM_RANGE( 0x0028, 0x002B) AM_READWRITE( mbc55x_usart_r, mbc55x_usart_w) + AM_RANGE( 0x0030, 0x0031) AM_DEVREADWRITE(VID_MC6845_NAME, mc6845_device, status_r, address_w ) + AM_RANGE( 0x0032, 0x0033) AM_DEVREADWRITE(VID_MC6845_NAME, mc6845_device, register_r, register_w ) + AM_RANGE( 0x0038, 0x003B) AM_READWRITE(mbc55x_kb_usart_r, mbc55x_kb_usart_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( mbc55x ) + PORT_START("KEY0") /* Key row 0 scancodes 00..07 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + + PORT_START("KEY1") /* Key row 1 scancodes 08..0F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BSLASH") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + + PORT_START("KEY2") /* Key row 2 scancodes 10..17 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + + + PORT_START("KEY3") /* Key row 3 scancodes 18..1F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + + PORT_START("KEY4") /* Key row 4 scancodes 20..27 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TILDE") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("#") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0D) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + + PORT_START("KEY5") /* Key row 5 scancodes 28..2F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + + PORT_START("KEY6") /* Key row 6 scancodes 30..37 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + +#if 0 + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSLASH") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) // Ether control + + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRSCR") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + + PORT_START("KEY7") /* Key row 7 scancodes 38..3F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + + PORT_START("KEY8") /* Key row 8 scancodes 40..47 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLK") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SCRLK") PORT_CODE(KEYCODE_SCRLOCK) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + + PORT_START("KEY9") /* Key row 9 scancodes 48..4F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP8") PORT_CODE(KEYCODE_8_PAD) //PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP9") PORT_CODE(KEYCODE_9_PAD) //PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP-") PORT_CODE(KEYCODE_MINUS_PAD) //PORT_CHAR('-') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP4") PORT_CODE(KEYCODE_4_PAD) //PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) //PORT_CHAR('5') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) //PORT_CHAR('6') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) //PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) //PORT_CHAR('1') + + PORT_START("KEY10") /* Key row 10 scancodes 50..57 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP2") PORT_CODE(KEYCODE_2_PAD) //PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP3") PORT_CODE(KEYCODE_3_PAD) //PORT_CHAR('3') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP0") PORT_CODE(KEYCODE_0_PAD) //PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP.") PORT_CODE(KEYCODE_DEL_PAD) //PORT_CHAR('.') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + //PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + //PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') +#endif + + PORT_START(KEY_SPECIAL_TAG) + PORT_BIT(KEY_BIT_LSHIFT, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(KEY_BIT_RSHIFT, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(KEY_BIT_CTRL, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) // Ether control + PORT_BIT(KEY_BIT_GRAPH, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + +INPUT_PORTS_END + + +PALETTE_INIT_MEMBER(mbc55x_state, mbc55x) +{ + int colourno; + + logerror("initializing palette\n"); + + for ( colourno = 0; colourno < SCREEN_NO_COLOURS; colourno++ ) + palette.set_pen_color(colourno, mbc55x_palette[colourno][RED], mbc55x_palette[colourno][GREEN], mbc55x_palette[colourno][BLUE]); +} + + +FLOPPY_FORMATS_MEMBER( mbc55x_state::floppy_formats ) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + + +// MBC-550 : 1 x 5.25" disk-drive (160 KB) +// MBC-555 : 2 x 5.25" disk-drive (160 KB) +// MBC-555-2 : 2 x 5.25" disk-drive (360 KB) +// MBC-555-3 : 2 x 5.25" disk-drive (720 KB) + +static SLOT_INTERFACE_START( mbc55x_floppies ) + SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) + SLOT_INTERFACE("dd", FLOPPY_525_DD) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( mbc55x, mbc55x_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, I8088, 3600000) + MCFG_CPU_PROGRAM_MAP(mbc55x_mem) + MCFG_CPU_IO_MAP(mbc55x_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(PIC8259_TAG, pic8259_device, inta_cb) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,896,0,300,262,0,200) + MCFG_SCREEN_UPDATE_DEVICE(VID_MC6845_NAME, mc6845_device, screen_update) + MCFG_SCREEN_VBLANK_DRIVER(mbc55x_state, screen_eof_mbc55x) + + MCFG_PALETTE_ADD("palette", SCREEN_NO_COLOURS * 3) + MCFG_PALETTE_INIT_OWNER(mbc55x_state, mbc55x) +// MCFG_SCREEN_SIZE(650, 260) +// MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("128K,192K,256K,320K,384K,448K,512K,576K,640K") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO(MONO_TAG) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,MONO_TAG, 0.75) + + /* Devices */ + MCFG_DEVICE_ADD(I8251A_KB_TAG, I8251, 0) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(PIC8259_TAG, pic8259_device, ir3_w)) + + MCFG_DEVICE_ADD(PIT8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(PIT_C0_CLOCK) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(PIC8259_TAG, pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(PIT_C1_CLOCK) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE(PIC8259_TAG, pic8259_device, ir1_w)) + MCFG_PIT8253_CLK2(PIT_C2_CLOCK) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mbc55x_state, pit8253_t2)) + + MCFG_PIC8259_ADD( PIC8259_TAG, INPUTLINE(MAINCPU_TAG, INPUT_LINE_IRQ0), VCC, NULL ) + + MCFG_DEVICE_ADD(PPI8255_TAG, I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mbc55x_state, mbc55x_ppi_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mbc55x_state, mbc55x_ppi_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(mbc55x_state, mbc55x_ppi_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mbc55x_state, mbc55x_ppi_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(mbc55x_state, mbc55x_ppi_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mbc55x_state, mbc55x_ppi_portc_w)) + + MCFG_MC6845_ADD(VID_MC6845_NAME, MC6845, SCREEN_TAG, XTAL_14_31818MHz/8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(mbc55x_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(mbc55x_state, vid_hsync_changed)) + MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(mbc55x_state, vid_vsync_changed)) + + /* Backing storage */ + MCFG_FD1793_ADD(FDC_TAG, XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", mbc55x_floppies, "qd", mbc55x_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", mbc55x_floppies, "qd", mbc55x_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":2", mbc55x_floppies, "", mbc55x_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":3", mbc55x_floppies, "", mbc55x_state::floppy_formats) + + /* Software list */ + MCFG_SOFTWARE_LIST_ADD("disk_list","mbc55x") +MACHINE_CONFIG_END + + +ROM_START( mbc55x ) + ROM_REGION( 0x4000, MAINCPU_TAG, 0 ) + + ROM_SYSTEM_BIOS(0, "v120", "mbc55x BIOS v1.20 (1983)") + ROMX_LOAD("mbc55x-v120.rom", 0x0000, 0x2000, CRC(b439b4b8) SHA1(6e8df0f3868e3fd0229a5c2720d6c01e46815cab), ROM_BIOS(1) ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, mbc55x, 0, 0, mbc55x, mbc55x, driver_device, 0, "Sanyo", "MBC-55x", 0 /*MACHINE_NO_SOUND*/) diff --git a/src/mame/drivers/mbdtower.c b/src/mame/drivers/mbdtower.c new file mode 100644 index 00000000000..65d27fb06f4 --- /dev/null +++ b/src/mame/drivers/mbdtower.c @@ -0,0 +1,285 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Sean Riddle +/*************************************************************************** + + ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** + + Milton Bradley Dark Tower + * TMS1400NLL MP7332-N1.U1(Rev. B) or MP7332-N2LL(Rev. C), die labeled MP7332 + (assume same ROM contents between revisions) + * SN75494N MOS-to-LED digit driver + * motorized rotating reel + lightsensor, 1bit-sound + + This is a board game, it obviously requires game pieces and the board. + The emulated part is the centerpiece, a black tower with a rotating card + panel and LED digits for displaying health, amount of gold, etc. As far + as MAME is concerned, the game works fine. + + To start up the game, first press [MOVE], the machine now does a self-test. + Then select level and number of players and the game will start. Read the + official manual on how to play the game. + +***************************************************************************/ + +#include "includes/hh_tms1k.h" +#include "mbdtower.lh" + + +class mbdtower_state : public hh_tms1k_state +{ +public: + mbdtower_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + bool sensor_led_on() { return m_display_decay[0][0] != 0; } + + int m_motor_pos; + int m_motor_pos_prev; + int m_motor_decay; + bool m_motor_on; + bool m_sensor_blind; + + TIMER_DEVICE_CALLBACK_MEMBER(motor_sim_tick); + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + +protected: + virtual void machine_start(); +}; + + +/*************************************************************************** + + Display, Motor + +***************************************************************************/ + +void mbdtower_state::prepare_display() +{ + // declare display matrix size and the 2 7segs + set_display_size(7, 3); + m_display_segmask[1] = m_display_segmask[2] = 0x7f; + + // update current state + if (~m_r & 0x10) + { + UINT8 o = BITSWAP8(m_o,7,0,4,3,2,1,6,5) & 0x7f; + m_display_state[2] = (m_o & 0x80) ? o : 0; + m_display_state[1] = (m_o & 0x80) ? 0 : o; + m_display_state[0] = (m_r >> 8 & 1) | (m_r >> 4 & 0xe); + + display_update(); + } + else + { + // display items turned off + display_matrix(7, 3, 0, 0); + } +} + + +TIMER_DEVICE_CALLBACK_MEMBER(mbdtower_state::motor_sim_tick) +{ + // it rotates counter-clockwise (when viewed from above) + if (m_motor_on) + { + m_motor_pos = (m_motor_pos - 1) & 0x7f; + + // give it some time to spin out when it's turned off + if (m_r & 0x200) + m_motor_decay += (m_motor_decay < 4); + else if (m_motor_decay > 0) + m_motor_decay--; + else + m_motor_on = false; + } + + // 8 evenly spaced holes in the rotation disc for the sensor to 'see' through. + // The first hole is much bigger, enabling the game to determine the position. + if ((m_motor_pos & 0xf) < 4 || m_motor_pos < 0xc) + m_sensor_blind = false; + else + m_sensor_blind = true; + + // on change, output info + if (m_motor_pos != m_motor_pos_prev) + output_set_value("motor_pos", 100 * (m_motor_pos / (float)0x80)); + + /* 3 display cards per hole, like this: + + (0) <---- display increments this way <---- (7) + + CURSED VICTORY WIZARD DRAGON GOLD KEY SCOUT WARRIOR (void) + LOST WARRIORS BAZAAR CLOSED SWORD SILVER KEY HEALER FOOD (void) + PLAGUE BRIGANDS KEY MISSING PEGASUS BRASS KEY GOLD BEAST (void) + */ + int card_pos = m_motor_pos >> 4 & 7; + if (card_pos != (m_motor_pos_prev >> 4 & 7)) + output_set_value("card_pos", card_pos); + + m_motor_pos_prev = m_motor_pos; +} + + + +/*************************************************************************** + + I/O + +***************************************************************************/ + +WRITE16_MEMBER(mbdtower_state::write_r) +{ + // R0-R2: input mux + m_inp_mux = data & 7; + + // R9: motor on + if ((m_r ^ data) & 0x200) + output_set_value("motor_on", data >> 9 & 1); + if (data & 0x200) + m_motor_on = true; + + // R3: N/C + // R4: 75494 /EN (speaker, lamps, digit select go through that IC) + // R5-R7: tower lamps + // R8: rotation sensor led + m_r = data; + prepare_display(); + + // R10: speaker out + m_speaker->level_w(~data >> 4 & data >> 10 & 1); +} + +WRITE16_MEMBER(mbdtower_state::write_o) +{ + // O0-O6: led segments A-G + // O7: digit select + m_o = data; + prepare_display(); +} + +READ8_MEMBER(mbdtower_state::read_k) +{ + // K: multiplexed inputs + // K8: rotation sensor + return read_inputs(3) | ((!m_sensor_blind && sensor_led_on()) ? 8 : 0); +} + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +/* physical button layout and labels is like this: + + (green) (l.blue) (red) + [YES/ [REPEAT] [NO/ + BUY] END] + + (yellow) (blue) (white) + [HAGGLE] [BAZAAR] [CLEAR] + + (blue) (blue) (blue) + [TOMB/ [MOVE] [SANCTUARY/ + RUIN] CITADEL] + + (orange) (blue) (d.yellow) + [DARK [FRONTIER] [INVENTORY] + TOWER] +*/ + +static INPUT_PORTS_START( mbdtower ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Inventory") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("No/End") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Clear") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Sanctuary/Citadel") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Frontier") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("Repeat") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Bazaar") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Move") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Dark Tower") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("Yes/Buy") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Haggle") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Tomb/Ruin") +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +void mbdtower_state::machine_start() +{ + hh_tms1k_state::machine_start(); + + // zerofill + m_motor_pos = 0; + m_motor_pos_prev = -1; + m_motor_decay = 0; + m_motor_on = false; + m_sensor_blind = false; + + // register for savestates + save_item(NAME(m_motor_pos)); + /* save_item(NAME(m_motor_pos_prev)); */ // don't save! + save_item(NAME(m_motor_decay)); + save_item(NAME(m_motor_on)); + save_item(NAME(m_sensor_blind)); +} + + +static MACHINE_CONFIG_START( mbdtower, mbdtower_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=43K, C=56pf, but unknown RC curve + MCFG_TMS1XXX_READ_K_CB(READ8(mbdtower_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mbdtower_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mbdtower_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("tower_motor", mbdtower_state, motor_sim_tick, attotime::from_msec(3500/0x80)) // ~3.5sec for a full rotation + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_mbdtower) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( mbdtower ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "mp7332", 0x0000, 0x1000, CRC(ebeab91a) SHA1(7edbff437da371390fa8f28b3d183f833eaa9be9) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_mbdtower_output.pla", 0, 557, CRC(64c84697) SHA1(72ce6d24cedf9c606f1742cd5620f75907246e87) ) +ROM_END + + +CONS( 1981, mbdtower, 0, 0, mbdtower, mbdtower, driver_device, 0, "Milton Bradley", "Dark Tower (Milton Bradley)", MACHINE_SUPPORTS_SAVE | MACHINE_MECHANICAL ) diff --git a/src/mame/drivers/mbee.c b/src/mame/drivers/mbee.c new file mode 100644 index 00000000000..35cfd694d67 --- /dev/null +++ b/src/mame/drivers/mbee.c @@ -0,0 +1,1164 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Driver completely rewritten by Robbbert, in a process begun on 2009-02-24. +Assistance/advice was gratefully received from: + E.J.Wordsworth (owner of Microbee Systems), nama, ChickenMan, + and the author of the "ubee512" emulator. + +Previous driver was written by Juergen Buchmueller, Jan 2000 with assistance +from Brett Selwood and Andrew Davies. + + + Keyboard notes are in video/microbee.c + + 256tc: The 1.31 rom version which appears to fit the 256TC is actually + part of the Z80 emulation in the Matilda model. If you fit this rom into a real + 256TC, the floppy disk will not be detected. + + The unemulated Matilda is a IBM XT clone fitted with a NEC V40, and has the + ability to emulate the 256TC as mentioned above. + + Floppy formats: + - All disks are the standard CPCEMU 'dsk' format. + - Types are 9/13cm 40/80 track (single or double sided) + - 13cm has been specified as QD to prevent a nasty crash if an 80-track disk was mounted + - The tracks/sector layout is the same regardless of size + - Although certain models came with particular drives as standard, users could add + the other size if they wished. We support both sizes on any model. + + Early machines have 'standard' video (128 hires characters). + Later machines had the option of 'premium' video which + provides thousands of hires characters, enough to simulate + bit-mapped graphics. + + Commands to call up built-in roms (depends on the model): + NET - Jump to E000, usually the Telcom communications program. + This rom can be replaced with the Dreamdisk Chip-8 rom. + Note that Telcom 3.21 is 8k, it uses a rombank switch + (by reading port 0A) to swap between the two halves. + See Telcom notes below. + + EDASM - Jump to C000, usually the Editor/Assembler package. + + MENU - Do a rombank switch to bank 5 and jump to C000 to start the Shell + + PAK n - Do a rombank switch (write to port 0A) to bank "n" and jump to C000. + + These early colour computers have a PROM to create the foreground palette. + + Notes about the printer: + - Older models default to a 1200 baud serial printer, which we do not support. + - You need to change it to parallel by entering OUTL#1 while in Basic. + - After you mount/create a printfile, you can LPRINT and LLIST in Basic, + or by using the printing option in other apps. + + Notes about Telcom: + - On the older models, Telcom is called up by entering NET from within Basic. Models + from the pc85 onwards have it as a menu option. + - To exit, press Enter without any input. Disk versions, enter CPM or press ^C. + - After being used, version 3 and up will enable the use of OUT#7 in Basic, which + changes the screen to 80x24. Enter OUT#0 to revert to normal. + - Most versions of Telcom can have their parameters adjusted directly from Basic, + without needing to enter the Telcom program. + - Most versions of Telcom have an optional clock. In older models firstly select VS + from the MESS config menu, then enter NET CLOCK to enable it. NET TIME hhmm to set + the time (24hour format). NET CLOCKD is supposed to remove the status line, but it + doesn't, although the clock stops updating. NET CLOCK and NET CLOCKD are toggles. + - Telcom 1.2 (used in mbeeic) has a bug. If you enter NET CLOCK, the status line is + filled with inverse K. You can fix this from Basic by doing NET CLOCK 3 times. + + Notes about Disk System + - Ports 44 to 47 are for standard connection to FD2793. + - Port 48 is used for drive/side/density select on write, and intrq/drq on read. + intrq and drq are OR'd together, then gated to bit 7 of the data bus whenever + port 48 is activated on read. There are no interrupts used. + + How to use the config switch for PIO B7: + - Teleterm: Must use RTC. Anything else makes teleterm go crazy. + - 256TC, 128, 128p: Doesn't seem to matter, leave at the default. + - Standard: Has no effect, best left at "Tied High" + - Other rom-based models: "VS" to make the Telcom clock work, or "Tied high". + - 56k: not sure yet, leave as "Tied high" until more is known. + +*************************************************************************** + + TODO/not working: + + - 256tc: Paste ignores shift key + - All others: Paste drops most characters. + + - various fdc issues: + - B drive doesn't work with most disks. + - some disks cause MESS to freeze. + - ENMF pin missing from wd_fdc. + - incorrect timing for track register causes 256tc failure to boot a disk. + + - Simply Write has keyboard problems (in 128k, no keys work). + + - 256tc: At the menu, if F2 pressed to activate the Monitor, the emulated machine + crashes due to a bug in z80pio emulation. + + - 256tc: the Intro disk doesn't work + + - 256tc, Teleterm: Keyboard CPU inbuilt ROM needs to be dumped. + - 128k, 64k: PALs need to be dumped for the bankswitching. + + - Teleterm: keyboard has problems. The schematic shows it using the old-style keyboard, + however it actually uses the new keyboard with interrupts. + + - Mouse: a few programs support the use of a serial mouse which interfaced + directly to the Z80PIO. However there's little info to be found. + PIO B3 to ground activates the mouse pointer in Shell v3.01. + + - Hard drive (10MB) & controller + +*******************************************************************************/ + +#include "includes/mbee.h" +#include "formats/mbee_cas.h" + +#define XTAL_13_5MHz 13500000 + +/********** NOTE !!! *********************************************************** + The microbee uses lots of bankswitching and the memory maps are still + being determined. Please don't merge memory maps !! +********************************************************************************/ + + +static ADDRESS_MAP_START(mbee_mem, AS_PROGRAM, 8, mbee_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) + AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbeeic_mem, AS_PROGRAM, 8, mbee_state) + AM_RANGE(0x0000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") + AM_RANGE(0xe000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) + AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbeepc_mem, AS_PROGRAM, 8, mbee_state) + AM_RANGE(0x0000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") + AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom") + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) + AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbeeppc_mem, AS_PROGRAM, 8, mbee_state) + AM_RANGE(0x0000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("basic") + AM_RANGE(0xa000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") + AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom") + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) + AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbee56_mem, AS_PROGRAM, 8, mbee_state) + AM_RANGE(0x0000, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) + AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbee256_mem, AS_PROGRAM, 8, mbee_state) + AM_RANGE(0x0000, 0x0fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x1000, 0x1fff) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") + AM_RANGE(0x2000, 0x2fff) AM_READ_BANK("bankr2") AM_WRITE_BANK("bankw2") + AM_RANGE(0x3000, 0x3fff) AM_READ_BANK("bankr3") AM_WRITE_BANK("bankw3") + AM_RANGE(0x4000, 0x4fff) AM_READ_BANK("bankr4") AM_WRITE_BANK("bankw4") + AM_RANGE(0x5000, 0x5fff) AM_READ_BANK("bankr5") AM_WRITE_BANK("bankw5") + AM_RANGE(0x6000, 0x6fff) AM_READ_BANK("bankr6") AM_WRITE_BANK("bankw6") + AM_RANGE(0x7000, 0x7fff) AM_READ_BANK("bankr7") AM_WRITE_BANK("bankw7") + AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bankr8") AM_WRITE_BANK("bankw8") + AM_RANGE(0x9000, 0x9fff) AM_READ_BANK("bankr9") AM_WRITE_BANK("bankw9") + AM_RANGE(0xa000, 0xafff) AM_READ_BANK("bankr10") AM_WRITE_BANK("bankw10") + AM_RANGE(0xb000, 0xbfff) AM_READ_BANK("bankr11") AM_WRITE_BANK("bankw11") + AM_RANGE(0xc000, 0xcfff) AM_READ_BANK("bankr12") AM_WRITE_BANK("bankw12") + AM_RANGE(0xd000, 0xdfff) AM_READ_BANK("bankr13") AM_WRITE_BANK("bankw13") + AM_RANGE(0xe000, 0xefff) AM_READ_BANK("bankr14") AM_WRITE_BANK("bankw14") + AM_RANGE(0xf000, 0xffff) AM_READ_BANK("bankr15") AM_WRITE_BANK("bankw15") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbeett_mem, AS_PROGRAM, 8, mbee_state) + AM_RANGE(0x0000, 0x7fff) AM_RAM + AM_RANGE(0x8000, 0x9fff) AM_ROM + AM_RANGE(0xa000, 0xbfff) AM_RAM + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") + AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom") + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) + AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbee_io, AS_IO, 8, mbee_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_MIRROR(0x10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_WRITE(port0b_w) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) + AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbeeic_io, AS_IO, 8, mbee_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_MIRROR(0x10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x08, 0x08) AM_MIRROR(0x10) AM_READWRITE(port08_r, port08_w) + AM_RANGE(0x09, 0x09) AM_WRITENOP /* Listed as "Colour Wait Off" or "USART 2651" but doesn't appear in the schematics */ + AM_RANGE(0x0a, 0x0a) AM_MIRROR(0x10) AM_WRITE(port0a_w) + AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_WRITE(port0b_w) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) + AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbeepc_io, AS_IO, 8, mbee_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(port08_r, port08_w) + AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP + AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_WRITE(port0b_w) + AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) + AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) + AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_low_r, port0a_w) + AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_high_r, port0a_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbeeppc_io, AS_IO, 8, mbee_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(port08_r, port08_w) + AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP + AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_WRITE(port0b_w) + AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) + AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) + AM_RANGE(0x001c, 0x001c) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) + AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_low_r, port0a_w) + AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_high_r, port0a_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbeett_io, AS_IO, 8, mbee_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x0004, 0x0004) AM_MIRROR(0xff00) AM_WRITE(port04_w) + AM_RANGE(0x0006, 0x0006) AM_MIRROR(0xff00) AM_WRITE(port06_w) + AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(port07_r) + AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(port08_r, port08_w) + AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_WRITE(port0b_w) + AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) + AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) + AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(port18_r) + AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) + AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xfe00) AM_READ(speed_low_r) + AM_RANGE(0x0109, 0x0109) AM_MIRROR(0xfe00) AM_READ(speed_high_r) + AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe00) AM_READWRITE(telcom_low_r, port0a_w) + AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe00) AM_READWRITE(telcom_high_r, port0a_w) + AM_RANGE(0x0068, 0x006f) AM_MIRROR(0xff00) AM_DEVREADWRITE("scc", scc8530_t, reg_r, reg_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbee56_io, AS_IO, 8, mbee_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r, port08_w) + AM_RANGE(0x09, 0x09) AM_WRITENOP + AM_RANGE(0x0b, 0x0b) AM_WRITE(port0b_w) + AM_RANGE(0x0c, 0x0c) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) + AM_RANGE(0x0d, 0x0d) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) + AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write) + AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbee128_io, AS_IO, 8, mbee_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x04, 0x04) AM_WRITE(port04_w) + AM_RANGE(0x06, 0x06) AM_WRITE(port06_w) + AM_RANGE(0x07, 0x07) AM_READ(port07_r) + AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r, port08_w) + AM_RANGE(0x09, 0x09) AM_WRITENOP + AM_RANGE(0x0b, 0x0b) AM_WRITE(port0b_w) + AM_RANGE(0x0c, 0x0c) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) + AM_RANGE(0x0d, 0x0d) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) + AM_RANGE(0x1c, 0x1f) AM_READWRITE(port1c_r, port1c_w) + AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write) + AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w) + AM_RANGE(0x50, 0x57) AM_WRITE(mbee128_50_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mbee256_io, AS_IO, 8, mbee_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0x0004, 0x0004) AM_MIRROR(0xff00) AM_WRITE(port04_w) + AM_RANGE(0x0006, 0x0006) AM_MIRROR(0xff00) AM_WRITE(port06_w) + AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(port07_r) + AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(port08_r, port08_w) + AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xfd00) AM_READ(speed_low_r) + AM_RANGE(0x0209, 0x0209) AM_MIRROR(0xfd00) AM_READ(speed_high_r) + AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP + AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_WRITE(port0b_w) + AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) + AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) + // AM_RANGE(0x0010, 0x0013) AM_MIRROR(0xff00) Optional SN76489AN audio chip + AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(port18_r) + AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) + AM_RANGE(0x0044, 0x0047) AM_MIRROR(0xff00) AM_DEVREADWRITE("fdc", wd2793_t, read, write) + AM_RANGE(0x0048, 0x004f) AM_MIRROR(0xff00) AM_READWRITE(fdc_status_r, fdc_motor_w) + AM_RANGE(0x0050, 0x0057) AM_MIRROR(0xff00) AM_WRITE(mbee256_50_w) + // AM_RANGE(0x0058, 0x005f) AM_MIRROR(0xff00) External options: floppy drive, hard drive and keyboard + // AM_RANGE(0x0060, 0x0067) AM_MIRROR(0xff00) Reserved for file server selection (unused) + // AM_RANGE(0x0068, 0x006f) AM_MIRROR(0xff00) Reserved for 8530 SCC (unused) +ADDRESS_MAP_END + +static INPUT_PORTS_START( oldkb ) + PORT_START("X.0") /* IN0 KEY ROW 0 [000] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) + + PORT_START("X.1") /* IN1 KEY ROW 1 [080] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) + + PORT_START("X.2") /* IN2 KEY ROW 2 [100] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) + + PORT_START("X.3") /* IN3 KEY ROW 3 [180] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("^") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) PORT_CHAR(0x5f) PORT_CHAR(0x1f) // port_char not working - hijacked + + PORT_START("X.4") /* IN4 KEY ROW 4 [200] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("X.5") /* IN5 KEY ROW 5 [280] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("X.6") /* IN6 KEY ROW 6 [300] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Linefeed") PORT_CODE(KEYCODE_HOME) PORT_CHAR(10) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_END) PORT_CHAR(3) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("X.7") /* IN7 KEY ROW 7 [380] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + +static INPUT_PORTS_START( mbee ) + + PORT_INCLUDE( oldkb ) + + // Autorun on quickload + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") + PORT_CONFSETTING( 0x00, DEF_STR(No)) + PORT_CONFSETTING( 0x01, DEF_STR(Yes)) + // monochrome monitor could be used + PORT_CONFNAME( 0x30, 0x00, "Monitor type") + PORT_CONFSETTING( 0x00, "Colour") + PORT_CONFSETTING( 0x10, "Green") + PORT_CONFSETTING( 0x20, "Amber") + PORT_CONFSETTING( 0x30, "White") + // Wire links on motherboard + PORT_CONFNAME( 0xc0, 0x00, "PIO B7") + PORT_CONFSETTING( 0x00, "VS") // sync pulse to enable telcom clock + PORT_CONFSETTING( 0x40, "RTC") // optional board usually not fitted + PORT_CONFSETTING( 0x80, "Tied high") // default resistor to vcc + PORT_CONFSETTING( 0xc0, "Reserved for net") +INPUT_PORTS_END + +static INPUT_PORTS_START( mbee128 ) + + PORT_INCLUDE( oldkb ) + + // Autorun on quickload + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") + PORT_CONFSETTING( 0x00, DEF_STR(No)) + PORT_CONFSETTING( 0x01, DEF_STR(Yes)) + // monochrome monitor could be used + PORT_CONFNAME( 0x30, 0x00, "Monitor type") + PORT_CONFSETTING( 0x00, "Colour") + PORT_CONFSETTING( 0x10, "Green") + PORT_CONFSETTING( 0x20, "Amber") + PORT_CONFSETTING( 0x30, "White") + // Wire links on motherboard + PORT_CONFNAME( 0xc0, 0x40, "PIO B7") + PORT_CONFSETTING( 0x00, "VS") // sync pulse to enable telcom clock + PORT_CONFSETTING( 0x40, "RTC") // RTC IRQ for clock + PORT_CONFSETTING( 0x80, "Tied high") // default resistor to vcc + PORT_CONFSETTING( 0xc0, "Reserved for net") +INPUT_PORTS_END + +static INPUT_PORTS_START( mbee256 ) + PORT_START("Y.0") /* IN0 KEY ROW 0 [+00] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_END) PORT_CHAR(3) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 (num)") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL (num)") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y.1") /* IN1 KEY ROW 1 [+08] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Linefeed") PORT_CODE(KEYCODE_HOME) PORT_CHAR(10) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) + + PORT_START("Y.2") /* IN2 KEY ROW 2 [+10] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+ (num)") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 (num)") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 (num)") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) + + PORT_START("Y.3") /* IN3 KEY ROW 3 [+18] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- (num)") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 (num)") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 (num)") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) + + PORT_START("Y.4") /* IN4 KEY ROW 4 [+20] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* (num)") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (num)") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (num)") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) + + PORT_START("Y.5") /* IN5 KEY ROW 5 [+28] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 (num)") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 (num)") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 (num)") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) + + PORT_START("Y.6") /* IN6 KEY ROW 6 [+30] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ (num)") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) + + PORT_START("Y.7") /* IN7 KEY ROW 7 [+38] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) + + PORT_START("Y.8") /* IN0 KEY ROW 0 [+40] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) + + PORT_START("Y.9") /* IN1 KEY ROW 1 [+48] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("Y.10") /* IN2 KEY ROW 2 [+50] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(127) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("Y.11") /* IN3 KEY ROW 3 [+58] */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("Y.12") /* IN4 KEY ROW 4 [+60] */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("Y.13") /* IN5 KEY ROW 5 [+68] */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("Y.14") /* IN6 KEY ROW 6 [+70] */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + + // Autorun on quickload + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") + PORT_CONFSETTING( 0x00, DEF_STR(No)) + PORT_CONFSETTING( 0x01, DEF_STR(Yes)) + // Wire links on motherboard + PORT_CONFNAME( 0xc0, 0x40, "PIO B7") + PORT_CONFSETTING( 0x00, "VS") // sync pulse to enable telcom clock + PORT_CONFSETTING( 0x40, "RTC") // RTC IRQ must be used on teleterm + PORT_CONFSETTING( 0x80, "Tied high") // default resistor to vcc + PORT_CONFSETTING( 0xc0, "Reserved for net") +INPUT_PORTS_END + +static const z80_daisy_config mbee_daisy_chain[] = +{ + { "z80pio" }, + { NULL } +}; + +/**************************** F4 CHARACTER DISPLAYER */ +static const gfx_layout mbee_charlayout = +{ + 8,16, /* 8 x 16 characters */ + RGN_FRAC(1,1), + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( mono ) + GFXDECODE_ENTRY( "gfx", 0x0000, mbee_charlayout, 96, 1 ) +GFXDECODE_END + +static GFXDECODE_START( standard ) + GFXDECODE_ENTRY( "gfx", 0x0000, mbee_charlayout, 0, 48 ) +GFXDECODE_END + +static GFXDECODE_START( premium ) + GFXDECODE_ENTRY( "gfx", 0x0000, mbee_charlayout, 0, 8 ) +GFXDECODE_END + +static SLOT_INTERFACE_START( mbee_floppies ) + SLOT_INTERFACE( "drive3a", FLOPPY_35_DD ) + SLOT_INTERFACE( "drive3b", FLOPPY_35_DD ) + SLOT_INTERFACE( "drive5a", FLOPPY_525_QD ) + SLOT_INTERFACE( "drive5b", FLOPPY_525_QD ) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( mbee, mbee_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 6) /* 2 MHz */ + MCFG_CPU_PROGRAM_MAP(mbee_mem) + MCFG_CPU_IO_MAP(mbee_io) + MCFG_CPU_CONFIG(mbee_daisy_chain) + + MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_12MHz / 6) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(mbee_state, pio_ardy)) + MCFG_Z80PIO_IN_PB_CB(READ8(mbee_state, pio_port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(mbee_state, pio_port_b_w)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) /* not accurate */ + MCFG_SCREEN_SIZE(64*8, 19*16) /* need at least 17 lines for NET */ + MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 19*16-1) + MCFG_SCREEN_UPDATE_DRIVER(mbee_state, screen_update_mbee) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mono) + + MCFG_PALETTE_ADD("palette", 100) + MCFG_PALETTE_INIT_OWNER(mbee_state, standard) + + MCFG_VIDEO_START_OVERRIDE(mbee_state, mono) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_12MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(mbee_state, crtc_update_row) + MCFG_MC6845_ADDR_CHANGED_CB(mbee_state, crtc_update_addr) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(mbee_state, crtc_vs)) + + MCFG_QUICKLOAD_ADD("quickload", mbee_state, mbee, "mwb,com,bee", 3) + MCFG_QUICKLOAD_ADD("quickload2", mbee_state, mbee_z80bin, "bin", 3) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("z80pio", z80pio_device, strobe_a)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(mbee_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( mbeeic, mbee_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_13_5MHz / 4) /* 3.37500 MHz */ + MCFG_CPU_PROGRAM_MAP(mbeeic_mem) + MCFG_CPU_IO_MAP(mbeeic_io) + MCFG_CPU_CONFIG(mbee_daisy_chain) + + MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, 3375000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(mbee_state, pio_ardy)) + MCFG_Z80PIO_IN_PB_CB(READ8(mbee_state, pio_port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(mbee_state, pio_port_b_w)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) /* not accurate */ + MCFG_SCREEN_SIZE(80*8, 310) + MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 19*16-1) + MCFG_SCREEN_UPDATE_DRIVER(mbee_state, screen_update_mbee) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", standard) + + MCFG_PALETTE_ADD("palette", 100) + MCFG_PALETTE_INIT_OWNER(mbee_state, standard) + + MCFG_VIDEO_START_OVERRIDE(mbee_state, standard) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_13_5MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(mbee_state, crtc_update_row) + MCFG_MC6845_ADDR_CHANGED_CB(mbee_state, crtc_update_addr) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(mbee_state, crtc_vs)) + + MCFG_QUICKLOAD_ADD("quickload", mbee_state, mbee, "mwb,com,bee", 2) + MCFG_QUICKLOAD_ADD("quickload2", mbee_state, mbee_z80bin, "bin", 2) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("z80pio", z80pio_device, strobe_a)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(mbee_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mbeepc, mbeeic ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(mbeepc_mem) + MCFG_CPU_IO_MAP(mbeepc_io) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mbeeppc, mbeeic ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(mbeeppc_mem) + MCFG_CPU_IO_MAP(mbeeppc_io) + MCFG_VIDEO_START_OVERRIDE(mbee_state, premium) + MCFG_GFXDECODE_MODIFY("gfxdecode", premium) + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(mbee_state, premium) + MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) + MCFG_MC146818_IRQ_HANDLER(WRITELINE(mbee_state, rtc_irq_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mbee56, mbeeic ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(mbee56_mem) + MCFG_CPU_IO_MAP(mbee56_io) + MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee56) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 2) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(mbee_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(mbee_state, fdc_drq_w)) + MCFG_WD_FDC_ENMF_CALLBACK(GND) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "drive5a", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "drive5b", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mbee128, mbee56 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(mbee256_mem) + MCFG_CPU_IO_MAP(mbee128_io) + MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128) + MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) + MCFG_MC146818_IRQ_HANDLER(WRITELINE(mbee_state, rtc_irq_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mbee128p, mbeeppc ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(mbee256_mem) + MCFG_CPU_IO_MAP(mbee128_io) + MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 2) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(mbee_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(mbee_state, fdc_drq_w)) + MCFG_WD_FDC_ENMF_CALLBACK(GND) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "drive5a", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "drive5b", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mbee256, mbee128p ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(mbee256_mem) + MCFG_CPU_IO_MAP(mbee256_io) + MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee256) + + MCFG_DEVICE_REMOVE("fdc:0") + MCFG_DEVICE_REMOVE("fdc:1") + MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "drive3a", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "drive3b", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mbeett, mbeeppc ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(mbeett_mem) + MCFG_CPU_IO_MAP(mbeett_io) + MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbeett) + MCFG_DEVICE_REMOVE("quickload") + MCFG_DEVICE_REMOVE("quickload2") + MCFG_DEVICE_ADD("scc", SCC8530, 4000000) // clock unknown +MACHINE_CONFIG_END + +/* Unused roms: + ROM_LOAD_OPTIONAL("net.rom", 0xe000, 0x1000, CRC(e14aac4c) SHA1(330902cf47f53c22c85003a620f7d7d3261ebb67) ) + customised for a certain high school. Requires pulsing at bit 3 port 0 before it runs. + + ROM_LOAD_OPTIONAL("chip8_22.rom", 0xe000, 0x1000, CRC(11fbb547) SHA1(7bd9dc4b67b33b8e1be99beb6a0ddff25bdbd3f7) ) + Dreamcards Chip-8 V2.2 rom + + ROM_LOAD_OPTIONAL("telcom11.rom", 0xe000, 0x1000, CRC(15516499) SHA1(2d4953f994b66c5d3b1d457b8c92d9a0a69eb8b8) ) + Telcom 1.1 for the mbeeic (It could have 1.0, 1.1 or 1.2) + +*/ + + +/* gfxram: + 0000 = normal characters in charrom + 0800 = small characters in charrom + 1000 = characters selected + 1800 = pcg */ + +ROM_START( mbee ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD("bas510a.ic25", 0x8000, 0x1000, CRC(2ca47c36) SHA1(f36fd0afb3f1df26edc67919e78000b762b6cbcb) ) + ROM_LOAD("bas510b.ic27", 0x9000, 0x1000, CRC(a07a0c51) SHA1(dcbdd9df78b4b6b2972de2e4050dabb8ae9c3f5a) ) + ROM_LOAD("bas510c.ic28", 0xa000, 0x1000, CRC(906ac00f) SHA1(9b46458e5755e2c16cdb191a6a70df6de9fe0271) ) + ROM_LOAD("bas510d.ic30", 0xb000, 0x1000, CRC(61727323) SHA1(c0fea9fd0e25beb9faa7424db8efd07cf8d26c1b) ) + ROM_LOAD_OPTIONAL("edasma.ic31", 0xc000, 0x1000, CRC(120c3dea) SHA1(32c9bb6e54dd50d5218bb43cc921885a0307161d) ) + ROM_LOAD_OPTIONAL("edasmb.ic33", 0xd000, 0x1000, CRC(a23bf3c8) SHA1(73a57c2800a1c744b527d0440b170b8b03351753) ) + ROM_LOAD_OPTIONAL("telcom10.rom", 0xe000, 0x1000, CRC(cc9ac94d) SHA1(6804b5ff54d16f8e06180751d8681c44f351e0bb) ) + + ROM_REGION(0x2000, "gfx", 0) + ROM_LOAD("charrom.ic13", 0x1000, 0x0800, CRC(b149737b) SHA1(a3cd4f5d0d3c71137cd1f0f650db83333a2e3597) ) + ROM_RELOAD( 0x0000, 0x0800 ) + ROM_RELOAD( 0x0800, 0x0800 ) + + ROM_REGION( 0x0020, "proms", 0 ) + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0000, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( mbeeic ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD("bas522a.rom", 0x8000, 0x2000, CRC(7896a696) SHA1(a158f7803296766160e1f258dfc46134735a9477) ) + ROM_LOAD("bas522b.rom", 0xa000, 0x2000, CRC(b21d9679) SHA1(332844433763331e9483409cd7da3f90ac58259d) ) + ROM_LOAD_OPTIONAL("telcom12.rom", 0xe000, 0x1000, CRC(0231bda3) SHA1(be7b32499034f985cc8f7865f2bc2b78c485585c) ) + + /* PAK option roms */ + ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) + ROM_LOAD_OPTIONAL("edasm.rom", 0x0000, 0x2000, CRC(1af1b3a9) SHA1(d035a997c2dbbb3918b3395a3a5a1076aa203ee5) ) // 0 + ROM_LOAD_OPTIONAL("wbee12.rom", 0x2000, 0x2000, CRC(0fc21cb5) SHA1(33b3995988fc51ddef1568e160dfe699867adbd5) ) // 1 + ROM_LOAD_OPTIONAL("forth11.rom", 0x4000, 0x2000, CRC(f0fc2358) SHA1(b7303b94abe647d5a6ffb2fba5d205412f970c16) ) // 2 + + ROM_REGION(0x2000, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0040, "proms", 0 ) + ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) +ROM_END + +ROM_START( mbeepc ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD("bas522a.rom", 0x8000, 0x2000, CRC(7896a696) SHA1(a158f7803296766160e1f258dfc46134735a9477) ) + ROM_LOAD("bas522b.rom", 0xa000, 0x2000, CRC(b21d9679) SHA1(332844433763331e9483409cd7da3f90ac58259d) ) + + ROM_REGION(0x2000, "telcomrom", 0) + ROM_LOAD_OPTIONAL("telcom31.rom", 0x0000, 0x2000, CRC(5a904a29) SHA1(3120fb65ccefeb180ab80d8d35440c70dc8452c8) ) + + /* PAK option roms */ + ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) + ROM_LOAD_OPTIONAL("edasm.rom", 0x0000, 0x2000, CRC(1af1b3a9) SHA1(d035a997c2dbbb3918b3395a3a5a1076aa203ee5) ) // 0 + ROM_LOAD_OPTIONAL("wbee12.rom", 0x2000, 0x2000, CRC(0fc21cb5) SHA1(33b3995988fc51ddef1568e160dfe699867adbd5) ) // 1 + ROM_LOAD_OPTIONAL("mwbhelp.rom", 0x4000, 0x2000, CRC(d34fae54) SHA1(5ed30636f48e9d208ce2da367ba4425782a5bce3) ) // 2 + + ROM_REGION(0x2000, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0040, "proms", 0 ) + ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) +ROM_END + +ROM_START( mbeepc85 ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("bas525a.rom", 0x8000, 0x2000, CRC(a6e02afe) SHA1(0495308c7e1d84b5989a3af6d3b881f4580b2641) ) + ROM_LOAD("bas525b.rom", 0xa000, 0x2000, CRC(245dd36b) SHA1(dd288f3e6737627f50d3d2a49df3e57c423d3118) ) + + ROM_REGION(0x2000, "telcomrom", 0) + ROM_LOAD_OPTIONAL("telco321.rom", 0x0000, 0x2000, CRC(36852a11) SHA1(c45b8d03629e86231c6b256a7435abd87d8872a4) ) + + /* PAK option roms - Wordbee must be in slot 0 and Shell must be in slot 5. */ + ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) + ROM_LOAD("wbee13.rom", 0x0000, 0x2000, CRC(d7c58b7b) SHA1(5af1b8d21a0f21534ed1833ae919dbbc6ca973e2) ) // 0 + ROM_LOAD_OPTIONAL("cmdhelp.rom", 0x2000, 0x2000, CRC(a4f1fa90) SHA1(1456abc6ed0501a3b15a99b4302750843293ae5f) ) // 1 + ROM_LOAD_OPTIONAL("edasm.rom", 0x4000, 0x2000, CRC(1af1b3a9) SHA1(d035a997c2dbbb3918b3395a3a5a1076aa203ee5) ) // 2 + ROM_LOAD_OPTIONAL("forth.rom", 0x6000, 0x2000, CRC(c0795c2b) SHA1(8faa0a46fbbdb8a1019d706a40cd4431a5063f8c) ) // 3 + ROM_LOAD("shell.rom", 0xa000, 0x2000, CRC(5a2c7cd6) SHA1(8edc086710cb558f2146d660eddc8a18ba6a141c) ) // 5 + ROM_LOAD_OPTIONAL("ozlogo.rom", 0xc000, 0x2000, CRC(47c3ef69) SHA1(8274d27c323ca4a6cc9e7d24946ae9c0531c3112) ) // 6 + ROM_LOAD_OPTIONAL("chess.rom", 0xe000, 0x2000, CRC(fe9ee9d0) SHA1(a316559414e68c0101af5f00755db551e7c5788e) ) // 7 + + ROM_REGION(0x2000, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0040, "proms", 0 ) + ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) +ROM_END + +ROM_START( mbeepc85b ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("bas525a.rom", 0x8000, 0x2000, CRC(a6e02afe) SHA1(0495308c7e1d84b5989a3af6d3b881f4580b2641) ) + ROM_LOAD("bas525b.rom", 0xa000, 0x2000, CRC(245dd36b) SHA1(dd288f3e6737627f50d3d2a49df3e57c423d3118) ) + + ROM_REGION(0x2000, "telcomrom", 0) + ROM_LOAD_OPTIONAL("telco321.rom", 0x0000, 0x2000, CRC(36852a11) SHA1(c45b8d03629e86231c6b256a7435abd87d8872a4) ) + + /* PAK option roms - Wordbee must be in slot 0 and Shell must be in slot 5. */ + ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) + ROM_LOAD("wbee13.rom", 0x0000, 0x2000, CRC(d7c58b7b) SHA1(5af1b8d21a0f21534ed1833ae919dbbc6ca973e2) ) // 0 + ROM_LOAD_OPTIONAL("cmdhelp.rom", 0x2000, 0x2000, CRC(a4f1fa90) SHA1(1456abc6ed0501a3b15a99b4302750843293ae5f) ) // 1 + ROM_LOAD_OPTIONAL("busy.rom", 0x4000, 0x2000, CRC(56255f60) SHA1(fd2e37209fd49290be6875bc460cfc05392938ba) ) // 2 + ROM_CONTINUE( 0x14000, 0x2000 ) + ROM_LOAD_OPTIONAL("graphics.rom", 0x6000, 0x2000, CRC(9e9d327c) SHA1(aebf60ed153004380b9f271f2212376910a6cef9) ) // 3 + ROM_CONTINUE( 0x16000, 0x2000 ) + ROM_LOAD_OPTIONAL("viatel.rom", 0x8000, 0x2000, CRC(2da2411f) SHA1(d3cfa978165feef0a96e28197f6a762aa6604799) ) // 4 + ROM_LOAD("shell-b.rom", 0xa000, 0x2000, CRC(17bf2d58) SHA1(ae22a5fc5783f37066ba5555497e40945272ca3d) ) // 5 + + ROM_REGION(0x2000, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0040, "proms", 0 ) + ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) +ROM_END + +ROM_START( mbeepc85s ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("bas524a.rom", 0x8000, 0x2000, CRC(ec9c7a60) SHA1(a4021bcedc8da8c0eb0bda036a1d457619a175b0) ) + ROM_LOAD("bas524b.rom", 0xa000, 0x2000, CRC(17d3eac7) SHA1(d40d376cc5e751d257d951909a34445e70506c7b) ) + + ROM_REGION(0x2000, "telcomrom", 0) + ROM_LOAD_OPTIONAL("telco321s.rom", 0x0000, 0x2000, CRC(00f8fde1) SHA1(eb881bbab90c85fd6e29540decd25e884c67f738) ) + + /* PAK roms - These are not optional and will only work in the correct slots. */ + ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) + ROM_LOAD("wbee20-s.rom", 0x0000, 0x2000, CRC(6a0fe57f) SHA1(a101b588b1872e19382b9e9ea50fabb0fd060aa6) ) // 0 + ROM_LOAD("db-s.rom", 0x2000, 0x2000, CRC(e2094771) SHA1(62d7fb66c91d2bd24523bc84e4f005cf2c4480bb) ) // 1 + ROM_LOAD("kalk-s.rom", 0x4000, 0x2000, CRC(08dd71ee) SHA1(c9d506d8bb56f602c3481b253d4cac226f545d98) ) // 2 + ROM_LOAD("bg-s.rom", 0x6000, 0x2000, CRC(5aa4813e) SHA1(a8638e9046bfb9d5a98c878322295ce408bd879d) ) // 3 + ROM_LOAD("videotex-s.rom", 0x8000, 0x2000, CRC(67592b3f) SHA1(7f1d23ded34781ccda5f36b4a4fa118a8c0e44ec) ) // 4 + ROM_LOAD("shell-s.rom", 0xa000, 0x2000, CRC(bdf1768f) SHA1(4385351d07288cf94947ac63131eeed98572caa1) ) // 5 + + ROM_REGION(0x2000, "gfx", 0) + ROM_LOAD("charrom-s.bin", 0x1000, 0x1000, CRC(1bcbf083) SHA1(6438649b8b5fc20dd772ec7195e69a5bbe016b09) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0040, "proms", 0 ) + ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) +ROM_END + +ROM_START( mbeett ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD("kernel_106.rom", 0x8000, 0x2000, CRC(5ab9cb1d) SHA1(a1fb971622f85c4d866b91cb4bec6d75757e8c5f) ) + + ROM_REGION(0x2000, "telcomrom", 0) + ROM_LOAD("wm_106.rom", 0x0000, 0x2000, CRC(77e0b355) SHA1(1db6769cd6b12e1c335c83f17f8c139986c87758) ) + + ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) + ROM_LOAD("tv_470311.rom", 0x2000, 0x2000, CRC(2c4c2dcb) SHA1(77cd75166a389cb2d1d8abf00b1ddd077ce98354) ) // 1 + ROM_CONTINUE( 0x12000, 0x2000 ) + ROM_LOAD("tw_103.rom", 0x4000, 0x2000, CRC(881edb4b) SHA1(f6e30a12b1537bd55b69d1319799b150e80a471b) ) // 2 + ROM_CONTINUE( 0x14000, 0x2000 ) + ROM_LOAD("oside_107.rom", 0x6000, 0x2000, CRC(05d99aba) SHA1(4f88d63025f99bcc54d6f2abc20a699c97384f68) ) // 3 + ROM_CONTINUE( 0x16000, 0x1000 ) + ROM_LOAD("test_105.rom", 0x8000, 0x2000, CRC(b69aa618) SHA1(49de8cbad59f549c7ad9f8efc9beee0cfcd901fe) ) // 4 + + ROM_REGION(0x9800, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( mbeeppc ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("bas529b.rom", 0xa000, 0x2000, CRC(a1bd986b) SHA1(5d79f210c9042db5aefc85a0bdf45210cb9e9899) ) + + ROM_REGION(0x4000, "basicrom", 0) + ROM_LOAD("bas529a.rom", 0x0000, 0x4000, CRC(fe8242e1) SHA1(ff790edf4fcc7a134d451dbad7779157b07f6abf) ) + + ROM_REGION(0x2000, "telcomrom", 0) + ROM_LOAD_OPTIONAL("telco321.rom", 0x0000, 0x2000, CRC(36852a11) SHA1(c45b8d03629e86231c6b256a7435abd87d8872a4) ) + + /* PAK option roms - Wordbee must be in slot 0 and Shell must be in slot 5. */ + ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) + ROM_LOAD("wbee13.rom", 0x0000, 0x2000, CRC(d7c58b7b) SHA1(5af1b8d21a0f21534ed1833ae919dbbc6ca973e2) ) // 0 + ROM_LOAD_OPTIONAL("cmdhelp.rom", 0x2000, 0x2000, CRC(a4f1fa90) SHA1(1456abc6ed0501a3b15a99b4302750843293ae5f) ) // 1 + ROM_LOAD_OPTIONAL("busy-p.rom", 0x4000, 0x2000, CRC(f2897427) SHA1(b4c351bdac72d89589980be6d654f9b931bcba6b) ) // 2 + ROM_CONTINUE( 0x14000, 0x2000 ) + ROM_LOAD_OPTIONAL("graphics.rom", 0x6000, 0x2000, CRC(9e9d327c) SHA1(aebf60ed153004380b9f271f2212376910a6cef9) ) // 3 + ROM_CONTINUE( 0x16000, 0x2000 ) + ROM_LOAD_OPTIONAL("vtex235.rom", 0x8000, 0x2000, CRC(8c30ecb2) SHA1(cf068462d7def885bdb5d3a265851b88c727c0d7) ) // 4 + ROM_LOAD("ppcshell.rom", 0xa000, 0x2000, CRC(1e793555) SHA1(ddeaa081ec4408e80e3fb192865d87daa035c701) ) // 5 + + ROM_REGION(0x9800, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) + ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( mbee56 ) + ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) + ROM_LOAD("56kb.rom", 0xe000, 0x1000, CRC(28211224) SHA1(b6056339402a6b2677b0e6c57bd9b78a62d20e4f) ) + + ROM_REGION(0x2000, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0040, "proms", 0 ) + ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) +ROM_END + +ROM_START( mbee128 ) // Standard 128k (CIAB is the same thing with half the ram) + ROM_REGION(0x20000, "rams", ROMREGION_ERASEFF) + + ROM_REGION(0x8000, "roms", 0) + ROM_LOAD("bn54.bin", 0x0000, 0x2000, CRC(995c53db) SHA1(46e1a5cfd5795b8cf528bacf9dc79398ff7d64af) ) + + ROM_REGION(0x2000, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION(0x4000, "pals", 0) // undumped; using prom from 256tc for now + ROM_LOAD( "silver.u39", 0x0000, 0x4000, BAD_DUMP CRC(c34aab64) SHA1(781fe648488dec90185760f8e081e488b73b68bf) ) + + ROM_REGION( 0x0040, "proms", 0 ) + ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) +ROM_END + +ROM_START( mbee128p ) // Premium 128K + ROM_REGION(0x20000, "rams", ROMREGION_ERASEFF) + + ROM_REGION(0x8000, "roms", 0) // rom plus optional undumped roms plus dummy area + ROM_SYSTEM_BIOS( 0, "bn56", "bn56" ) + ROMX_LOAD("bn56.rom", 0x0000, 0x2000, CRC(3f76769d) SHA1(cfae2069d739c26fe39f734d9f705a3c965d1e6f), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "bn59", "Version 2.02" ) + ROMX_LOAD("bn59.rom", 0x0000, 0x2000, CRC(97384116) SHA1(87f2c4ab1a1f2964ba4f2bb60e62dc9c163831ba), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "bn60", "Version 2.03" ) + ROMX_LOAD("bn60.rom", 0x0000, 0x2000, CRC(ed15d4ee) SHA1(3ea42b63d42b9a4c5402676dee8912ad1f906bda), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "bn55", "bn55" ) + ROMX_LOAD("bn55.rom", 0x0000, 0x2000, CRC(ca2c1073) SHA1(355d90d181de899cc7af892df96305fead9c81b4), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "bn54", "bn54" ) + ROMX_LOAD("bn54.rom", 0x0000, 0x2000, CRC(995c53db) SHA1(46e1a5cfd5795b8cf528bacf9dc79398ff7d64af), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "hd18", "Hard Disk System" ) + ROMX_LOAD("hd18.rom", 0x0000, 0x2000, CRC(ed53ace7) SHA1(534e2e00cc527197c76b3c106b3c9ff7f1328487), ROM_BIOS(6) ) + + ROM_REGION(0x4000, "pals", 0) // undumped; using prom from 256tc for now + ROM_LOAD( "silver.u39", 0x0000, 0x4000, BAD_DUMP CRC(c34aab64) SHA1(781fe648488dec90185760f8e081e488b73b68bf) ) + + ROM_REGION(0x9800, "gfx", 0) + ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) + ROM_RELOAD( 0x0000, 0x1000 ) + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) + ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( mbee256 ) // 256tc + ROM_REGION(0x40000, "rams", ROMREGION_ERASEFF) + + ROM_REGION(0x5000, "roms", 0) // rom plus dummy area + ROM_SYSTEM_BIOS( 0, "1.20", "Version 1.20" ) + ROMX_LOAD("256tc_boot_1.20.u38", 0x0000, 0x4000, CRC(fe8d6a84) SHA1(a037a1b90b18a2180e9f5f216b829fcd480449a4), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "1.15", "Version 1.15" ) + ROMX_LOAD("256tc_boot_1.15.u38", 0x0000, 0x4000, CRC(1902062d) SHA1(e4a1c0b3f4996e313da0bac0edb6d34e3270723e), ROM_BIOS(2) ) + + ROM_REGION(0x4000, "pals", 0) + ROM_LOAD( "silver.u39", 0x0000, 0x4000, CRC(c34aab64) SHA1(781fe648488dec90185760f8e081e488b73b68bf) ) + + ROM_REGION(0x9800, "gfx", 0) + ROM_LOAD("char256.u53", 0x1000, 0x1000, CRC(9372af3c) SHA1(a63591822c0504de2fed52e88d64e1dbd6124b74) ) + ROM_IGNORE( 0x1000 ) // throw away swedish characters for now + ROM_COPY( "gfx", 0x1000, 0x0000, 0x1000 ) + + ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) + ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) + ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP( 1982, mbee, 0, 0, mbee, mbee, mbee_state, mbee, "Applied Technology", "Microbee 16 Standard" , 0 ) +COMP( 1982, mbeeic, mbee, 0, mbeeic, mbee, mbee_state, mbeeic, "Applied Technology", "Microbee 32 IC" , 0 ) +COMP( 1982, mbeepc, mbee, 0, mbeepc, mbee, mbee_state, mbeepc, "Applied Technology", "Microbee Personal Communicator" , 0 ) +COMP( 1985, mbeepc85, mbee, 0, mbeepc, mbee, mbee_state, mbeepc85, "Applied Technology", "Microbee PC85" , 0 ) +COMP( 1985, mbeepc85b,mbee, 0, mbeepc, mbee, mbee_state, mbeepc85, "Applied Technology", "Microbee PC85 (New version)" , 0 ) +COMP( 1985, mbeepc85s,mbee, 0, mbeepc, mbee, mbee_state, mbeepc85, "Applied Technology", "Microbee PC85 (Swedish)" , 0 ) +COMP( 1986, mbeeppc, mbee, 0, mbeeppc, mbee, mbee_state, mbeeppc, "Applied Technology", "Microbee Premium PC85" , 0 ) +COMP( 1986, mbeett, mbee, 0, mbeett, mbee256, mbee_state, mbeett, "Applied Technology", "Microbee Teleterm" , MACHINE_NOT_WORKING ) +COMP( 1986, mbee56, mbee, 0, mbee56, mbee, mbee_state, mbee56, "Applied Technology", "Microbee 56k" , MACHINE_NOT_WORKING ) +COMP( 1986, mbee128, mbee, 0, mbee128, mbee128, mbee_state, mbee128, "Applied Technology", "Microbee 128k Standard" , MACHINE_NOT_WORKING ) +COMP( 1986, mbee128p, mbee, 0, mbee128p, mbee128, mbee_state, mbee128, "Applied Technology", "Microbee 128k Premium" , MACHINE_NOT_WORKING ) +COMP( 1987, mbee256, mbee, 0, mbee256, mbee256, mbee_state, mbee256, "Applied Technology", "Microbee 256TC" , MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/mc10.c b/src/mame/drivers/mc10.c new file mode 100644 index 00000000000..af38ba6cc63 --- /dev/null +++ b/src/mame/drivers/mc10.c @@ -0,0 +1,608 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Dirk Best +/*************************************************************************** + + TRS-80 Radio Shack MicroColor Computer + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "sound/dac.h" +#include "video/mc6847.h" +#include "video/ef9345.h" +#include "imagedev/cassette.h" +#include "imagedev/printer.h" +#include "formats/coco_cas.h" +#include "machine/ram.h" + + +//printer state +enum +{ + PRINTER_WAIT, + PRINTER_REC, + PRINTER_DONE +}; + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +class mc10_state : public driver_device +{ +public: + mc10_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_mc6847(*this, "mc6847"), + m_ef9345(*this, "ef9345"), + m_dac(*this, "dac"), + m_ram(*this, RAM_TAG), + m_cassette(*this, "cassette"), + m_printer(*this, "printer") + { } + + required_device m_maincpu; + optional_device m_mc6847; + optional_device m_ef9345; + required_device m_dac; + required_device m_ram; + required_device m_cassette; + required_device m_printer; + + UINT8 *m_ram_base; + UINT32 m_ram_size; + UINT8 m_keyboard_strobe; + UINT8 m_port2; + + // printer + UINT8 m_pr_buffer; + UINT8 m_pr_counter; + UINT8 m_pr_state; + + DECLARE_READ8_MEMBER( mc10_bfff_r ); + DECLARE_WRITE8_MEMBER( mc10_bfff_w ); + DECLARE_READ8_MEMBER( alice90_bfff_r ); + DECLARE_WRITE8_MEMBER( alice32_bfff_w ); + DECLARE_READ8_MEMBER( mc10_port1_r ); + DECLARE_WRITE8_MEMBER( mc10_port1_w ); + DECLARE_READ8_MEMBER( mc10_port2_r ); + DECLARE_WRITE8_MEMBER( mc10_port2_w ); + DECLARE_READ8_MEMBER( mc6847_videoram_r ); + DECLARE_DRIVER_INIT(mc10); + TIMER_DEVICE_CALLBACK_MEMBER(alice32_scanline); +}; + + +/*************************************************************************** + MEMORY MAPPED I/O +***************************************************************************/ + +READ8_MEMBER( mc10_state::mc10_bfff_r ) +{ + UINT8 result = 0xff; + + if (!BIT(m_keyboard_strobe, 0)) result &= ioport("pb0")->read(); + if (!BIT(m_keyboard_strobe, 1)) result &= ioport("pb1")->read(); + if (!BIT(m_keyboard_strobe, 2)) result &= ioport("pb2")->read(); + if (!BIT(m_keyboard_strobe, 3)) result &= ioport("pb3")->read(); + if (!BIT(m_keyboard_strobe, 4)) result &= ioport("pb4")->read(); + if (!BIT(m_keyboard_strobe, 5)) result &= ioport("pb5")->read(); + if (!BIT(m_keyboard_strobe, 6)) result &= ioport("pb6")->read(); + if (!BIT(m_keyboard_strobe, 7)) result &= ioport("pb7")->read(); + + return result; +} + +READ8_MEMBER( mc10_state::alice90_bfff_r ) +{ + UINT8 result = 0xff; + + if (!BIT(m_keyboard_strobe, 7)) result &= ioport("pb7")->read(); + else + if (!BIT(m_keyboard_strobe, 6)) result &= ioport("pb6")->read(); + else + if (!BIT(m_keyboard_strobe, 5)) result &= ioport("pb5")->read(); + else + if (!BIT(m_keyboard_strobe, 4)) result &= ioport("pb4")->read(); + else + if (!BIT(m_keyboard_strobe, 3)) result &= ioport("pb3")->read(); + else + if (!BIT(m_keyboard_strobe, 2)) result &= ioport("pb2")->read(); + else + if (!BIT(m_keyboard_strobe, 1)) result &= ioport("pb1")->read(); + else + if (!BIT(m_keyboard_strobe, 0)) result &= ioport("pb0")->read(); + + return result; +} + +WRITE8_MEMBER( mc10_state::mc10_bfff_w ) +{ + /* bit 2 to 6, mc6847 mode lines */ + m_mc6847->gm2_w(BIT(data, 2)); + m_mc6847->intext_w(BIT(data, 2)); + m_mc6847->gm1_w(BIT(data, 3)); + m_mc6847->gm0_w(BIT(data, 4)); + m_mc6847->ag_w(BIT(data, 5)); + m_mc6847->css_w(BIT(data, 6)); + + /* bit 7, dac output */ + m_dac->write_unsigned8(BIT(data, 7)); +} + +WRITE8_MEMBER( mc10_state::alice32_bfff_w ) +{ + /* bit 7, dac output */ + m_dac->write_unsigned8(BIT(data, 7)); +} + + +/*************************************************************************** + MC6803 I/O +***************************************************************************/ + +/* keyboard strobe */ +READ8_MEMBER( mc10_state::mc10_port1_r ) +{ + return m_keyboard_strobe; +} + +/* keyboard strobe */ +WRITE8_MEMBER( mc10_state::mc10_port1_w ) +{ + m_keyboard_strobe = data; +} + +READ8_MEMBER( mc10_state::mc10_port2_r ) +{ + UINT8 result = 0xeb; + + /* bit 1, keyboard line pa6 */ + if (!BIT(m_keyboard_strobe, 0)) result &= ioport("pb0")->read() >> 5; + if (!BIT(m_keyboard_strobe, 2)) result &= ioport("pb2")->read() >> 5; + if (!BIT(m_keyboard_strobe, 7)) result &= ioport("pb7")->read() >> 5; + + /* bit 2, printer ots input */ + result |= (m_printer->is_ready() ? 0 : 4); + + /* bit 3, rs232 input */ + + /* bit 4, cassette input */ + result |= ((m_cassette)->input() >= 0 ? 1 : 0) << 4; + + return result; +} + +WRITE8_MEMBER( mc10_state::mc10_port2_w ) +{ + /* bit 0, cassette & printer output */ + m_cassette->output( BIT(data, 0) ? +1.0 : -1.0); + + switch (m_pr_state) + { + case PRINTER_WAIT: + if (BIT(m_port2, 0) && !BIT(data, 0)) + { + m_pr_state = PRINTER_REC; + m_pr_counter = 8; + m_pr_buffer = 0; + } + break; + case PRINTER_REC: + if (m_pr_counter--) + m_pr_buffer |= (BIT(data,0)<<(7-m_pr_counter)); + else + m_pr_state = PRINTER_DONE; + break; + case PRINTER_DONE: + if (BIT(data,0)) + m_printer->output(m_pr_buffer); + m_pr_state = PRINTER_WAIT; + break; + } + + m_port2 = data; +} + + +/*************************************************************************** + VIDEO EMULATION +***************************************************************************/ + +READ8_MEMBER( mc10_state::mc6847_videoram_r ) +{ + if (offset == ~0) return 0xff; + m_mc6847->inv_w(BIT(m_ram_base[offset], 6)); + m_mc6847->as_w(BIT(m_ram_base[offset], 7)); + + return m_ram_base[offset]; +} + +TIMER_DEVICE_CALLBACK_MEMBER(mc10_state::alice32_scanline) +{ + m_ef9345->update_scanline((UINT16)param); +} + +/*************************************************************************** + DRIVER INIT +***************************************************************************/ + +DRIVER_INIT_MEMBER(mc10_state,mc10) +{ + address_space &prg = m_maincpu->space(AS_PROGRAM); + + /* initialize keyboard strobe */ + m_keyboard_strobe = 0x00; + + /* initialize memory */ + m_ram_base = m_ram->pointer(); + m_ram_size = m_ram->size(); + m_pr_state = PRINTER_WAIT; + + membank("bank1")->set_base(m_ram_base); + + /* initialize memory expansion */ + if (m_ram_size == 20*1024) + membank("bank2")->set_base(m_ram_base + 0x1000); + else if (m_ram_size == 24*1024) + membank("bank2")->set_base(m_ram_base + 0x2000); + else if (m_ram_size != 32*1024) //ensure that is not alice90 + prg.nop_readwrite(0x5000, 0x8fff); + + /* register for state saving */ + save_item(NAME(m_keyboard_strobe)); + + //for alice32 force port4 DDR to 0xff at startup + if (!strcmp(machine().system().name, "alice32") || !strcmp(machine().system().name, "alice90")) + m_maincpu->m6801_io_w(prg, 0x05, 0xff); +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( mc10_mem, AS_PROGRAM, 8 , mc10_state) + AM_RANGE(0x0100, 0x3fff) AM_NOP /* unused */ + AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank1") /* 4k internal ram */ + AM_RANGE(0x5000, 0x8fff) AM_RAMBANK("bank2") /* 16k memory expansion */ + AM_RANGE(0x9000, 0xbffe) AM_NOP /* unused */ + AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(mc10_bfff_r, mc10_bfff_w) + AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) /* ROM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mc10_io, AS_IO, 8 , mc10_state) + AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READWRITE(mc10_port1_r, mc10_port1_w) + AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(mc10_port2_r, mc10_port2_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( alice32_mem, AS_PROGRAM, 8 , mc10_state) + AM_RANGE(0x0100, 0x2fff) AM_NOP /* unused */ + AM_RANGE(0x3000, 0x4fff) AM_RAMBANK("bank1") /* 8k internal ram */ + AM_RANGE(0x5000, 0x8fff) AM_RAMBANK("bank2") /* 16k memory expansion */ + AM_RANGE(0x9000, 0xafff) AM_NOP /* unused */ + AM_RANGE(0xbf20, 0xbf29) AM_DEVREADWRITE("ef9345", ef9345_device, data_r, data_w) + AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(mc10_bfff_r, alice32_bfff_w) + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) /* ROM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( alice90_mem, AS_PROGRAM, 8 , mc10_state) + AM_RANGE(0x0100, 0x2fff) AM_NOP /* unused */ + AM_RANGE(0x3000, 0xafff) AM_RAMBANK("bank1") /* 32k internal ram */ + AM_RANGE(0xbf20, 0xbf29) AM_DEVREADWRITE("ef9345", ef9345_device, data_r, data_w) + AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(alice90_bfff_r, alice32_bfff_w) + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) /* ROM */ +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/* MC-10 keyboard + + PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 + PA6: Ctl N/c Brk N/c N/c N/c N/c Shift + PA5: 8 9 : ; , - . / + PA4: 0 1 2 3 4 5 6 7 + PA3: X Y Z N/c N/c N/c Ent Space + PA2: P Q R S T U V W + PA1: H I J K L M N O + PA0: @ A B C D E F G + */ + +/* Port Key description Emulated key Natural key Shift 1 Shift 2 (Ctrl) */ +static INPUT_PORTS_START( mc10 ) + PORT_START("pb0") /* KEY ROW 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ INPUT") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H THEN") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P INKEY$") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X SQN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 ( CLS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb1") /* KEY ROW 1 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A \xE2\x86\x90") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I NEXT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q L.DEL") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y RESTORE") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! RUN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ) PRINT") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb2") /* KEY ROW 2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ABS") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J GOTO") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R RESET") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z \xE2\x86\x93") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \" CONT") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": * END") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb3") /* KEY ROW 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C INT") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K SOUND") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S \xE2\x86\x92") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # CSAVE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; + POKE") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb4") /* KEY ROW 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D GOSUB") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L PEEK") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T READ") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLOAD") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", < TAN") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb5") /* KEY ROW 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E SET") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M COS") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U FOR") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % NEW") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- = STOP") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb6") /* KEY ROW 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F RETURN") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N SIN") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V RND") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 & LIST") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". > LOG") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb7") /* KEY ROW 7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G IF") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O STEP") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W \xE2\x86\x91") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ' CLEAR") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ? SQR") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/* Alice uses an AZERTY keyboard */ +/* Port Key description Emulated key Natural key Shift 1 Shift 2 (Ctrl) */ +static INPUT_PORTS_START( alice ) + PORT_START("pb0") /* KEY ROW 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ INPUT") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H THEN") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P INKEY$") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X SQN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 ( CLS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb1") /* KEY ROW 1 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q L.DEL") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I NEXT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A \xE2\x86\x90") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y RESTORE") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! RUN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ) PRINT") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb2") /* KEY ROW 2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ABS") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J GOTO") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R RESET") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W \xE2\x86\x91") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \" CONT") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": * END") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb3") /* KEY ROW 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C INT") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K SOUND") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S \xE2\x86\x92") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # CSAVE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M COS") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb4") /* KEY ROW 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D GOSUB") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L PEEK") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T READ") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLOAD") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", < TAN") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb5") /* KEY ROW 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E SET") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ? SQR") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U FOR") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % NEW") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- = STOP") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb6") /* KEY ROW 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F RETURN") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N SIN") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V RND") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 & LIST") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". > LOG") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("pb7") /* KEY ROW 7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G IF") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O STEP") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z \xE2\x86\x93") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ' CLEAR") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; + POKE") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static MACHINE_CONFIG_START( mc10, mc10_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6803, XTAL_3_579545MHz) /* 0,894886 MHz */ + MCFG_CPU_PROGRAM_MAP(mc10_mem) + MCFG_CPU_IO_MAP(mc10_io) + + /* video hardware */ + MCFG_SCREEN_MC6847_NTSC_ADD("screen", "mc6847") + + MCFG_DEVICE_ADD("mc6847", MC6847_NTSC, XTAL_3_579545MHz) + MCFG_MC6847_INPUT_CALLBACK(READ8(mc10_state, mc6847_videoram_r)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(coco_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("mc10_cass") + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("20K") + MCFG_RAM_EXTRA_OPTIONS("4K") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list", "mc10") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( alice32, mc10_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6803, XTAL_3_579545MHz) + MCFG_CPU_PROGRAM_MAP(alice32_mem) + MCFG_CPU_IO_MAP(mc10_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DEVICE("ef9345", ef9345_device, screen_update) + MCFG_SCREEN_SIZE(336, 270) + MCFG_SCREEN_VISIBLE_AREA(00, 336-1, 00, 270-1) + MCFG_PALETTE_ADD("palette", 8) + + MCFG_DEVICE_ADD("ef9345", EF9345, 0) + MCFG_EF9345_PALETTE("palette") + MCFG_TIMER_DRIVER_ADD_SCANLINE("alice32_sl", mc10_state, alice32_scanline, "screen", 0, 10) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(alice32_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("mc10_cass") + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("24K") + MCFG_RAM_EXTRA_OPTIONS("8K") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list", "alice32") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("mc10_cass", "mc10") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( alice90, alice32 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(alice90_mem) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + + /* Software lists */ + MCFG_SOFTWARE_LIST_MODIFY("cass_list", "alice90") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("alice32_cass", "alice32") + MCFG_DEVICE_REMOVE("mc10_cass") +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( mc10 ) + ROM_REGION(0x2000, "maincpu", 0) + ROM_LOAD("mc10.rom", 0x0000, 0x2000, CRC(11fda97e) SHA1(4afff2b4c120334481aab7b02c3552bf76f1bc43)) +ROM_END + +ROM_START( alice ) + ROM_REGION(0x2000, "maincpu", 0) + ROM_LOAD("alice.rom", 0x0000, 0x2000, CRC(f876abe9) SHA1(c2166b91e6396a311f486832012aa43e0d2b19f8)) +ROM_END + +ROM_START( alice32 ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_LOAD("alice32.rom", 0x0000, 0x4000, CRC(c3854ddf) SHA1(f34e61c3cf711fb59ff4f1d4c0d2863dab0ab5d1)) + + ROM_REGION( 0x2000, "ef9345", 0 ) + ROM_LOAD( "charset.rom", 0x0000, 0x2000, BAD_DUMP CRC(b2f49eb3) SHA1(d0ef530be33bfc296314e7152302d95fdf9520fc) ) // from dcvg5k +ROM_END + +ROM_START( alice90 ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_LOAD("alice90.rom", 0x0000, 0x4000, CRC(d0a874bb) SHA1(a65c7be2d516bed2584c51c1ef78b045b91faef6)) + + ROM_REGION( 0x2000, "ef9345", 0 ) + ROM_LOAD( "charset.rom", 0x0000, 0x2000, BAD_DUMP CRC(b2f49eb3) SHA1(d0ef530be33bfc296314e7152302d95fdf9520fc) ) // from dcvg5k +ROM_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, mc10, 0, 0, mc10, mc10, mc10_state, mc10, "Tandy Radio Shack", "MC-10", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, alice, mc10, 0, mc10, alice, mc10_state, mc10, "Matra & Hachette", "Alice", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, alice32, 0, 0, alice32, alice, mc10_state, mc10, "Matra & Hachette", "Alice 32", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +COMP( 1985, alice90, alice32, 0, alice90, alice, mc10_state, mc10, "Matra & Hachette", "Alice 90", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/mc1000.c b/src/mame/drivers/mc1000.c new file mode 100644 index 00000000000..defef2a94c0 --- /dev/null +++ b/src/mame/drivers/mc1000.c @@ -0,0 +1,502 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + MC 1000 + + 12/05/2009 Skeleton driver. + + http://ensjo.wikispaces.com/MC-1000+on+JEMU + http://ensjo.blogspot.com/2006/11/color-artifacting-no-mc-1000.html + +****************************************************************************/ + +/* + + TODO: + + - xtal frequency? + - Z80 wait at 0x0000-0x1fff when !hsync & !vsync + - 80-column card (MC6845) character generator ROM + - Charlemagne / GEM-1000 / Junior Computer ROMs + +*/ + +#include "includes/mc1000.h" + +/* Memory Banking */ + +void mc1000_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* MC6845 video RAM */ + membank("bank2")->set_entry(m_mc6845_bank); + + /* extended RAM */ + if (m_ram->size() > 16*1024) + { + program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); + } + else + { + program.unmap_readwrite(0x4000, 0x7fff); + } + + /* MC6847 video RAM */ + if (m_mc6847_bank) + { + if (m_ram->size() > 16*1024) + { + program.install_readwrite_bank(0x8000, 0x97ff, "bank4"); + } + else + { + program.unmap_readwrite(0x8000, 0x97ff); + } + } + else + { + program.install_readwrite_bank(0x8000, 0x97ff, "bank4"); + } + + membank("bank4")->set_entry(m_mc6847_bank); + + /* extended RAM */ + if (m_ram->size() > 16*1024) + { + program.install_readwrite_bank(0x9800, 0xbfff, "bank5"); + } + else + { + program.unmap_readwrite(0x9800, 0xbfff); + } +} + +/* Read/Write Handlers */ + +WRITE_LINE_MEMBER( mc1000_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +READ8_MEMBER( mc1000_state::printer_r ) +{ + return m_centronics_busy; +} + +WRITE8_MEMBER( mc1000_state::printer_w ) +{ + m_centronics->write_strobe(BIT(data, 0)); +} + +WRITE8_MEMBER( mc1000_state::mc6845_ctrl_w ) +{ + m_mc6845_bank = BIT(data, 0); + + bankswitch(); +} + +WRITE8_MEMBER( mc1000_state::mc6847_attr_w ) +{ + /* + + bit description + + 0 enable CPU video RAM access + 1 CSS + 2 GM0 + 3 GM1 + 4 GM2 + 5 _INT/EXT + 6 _A/S + 7 _A/G + + */ + + m_mc6847_bank = BIT(data, 0); + m_vdg->css_w(BIT(data, 1)); + m_vdg->gm0_w(BIT(data, 2)); + m_vdg->gm1_w(BIT(data, 3)); + m_vdg->gm2_w(BIT(data, 4)); + m_vdg->intext_w(BIT(data, 5)); + m_vdg->as_w(BIT(data, 6)); + m_vdg->ag_w(BIT(data, 7)); + + bankswitch(); +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( mc1000_mem, AS_PROGRAM, 8, mc1000_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") + AM_RANGE(0x2000, 0x27ff) AM_RAMBANK("bank2") AM_SHARE("mc6845_vram") + AM_RANGE(0x2800, 0x3fff) AM_RAM + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank3") + AM_RANGE(0x8000, 0x97ff) AM_RAMBANK("bank4") AM_SHARE("mc6847_vram") + AM_RANGE(0x9800, 0xbfff) AM_RAMBANK("bank5") + AM_RANGE(0xc000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mc1000_io, AS_IO, 8, mc1000_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x04, 0x04) AM_READWRITE(printer_r, printer_w) + AM_RANGE(0x05, 0x05) AM_DEVWRITE("cent_data_out", output_latch_device, write) +// AM_RANGE(0x10, 0x10) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) +// AM_RANGE(0x11, 0x11) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r, register_w) + AM_RANGE(0x12, 0x12) AM_WRITE(mc6845_ctrl_w) + AM_RANGE(0x20, 0x20) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w) + AM_RANGE(0x40, 0x40) AM_DEVREAD(AY8910_TAG, ay8910_device, data_r) + AM_RANGE(0x60, 0x60) AM_DEVWRITE(AY8910_TAG, ay8910_device, data_w) + AM_RANGE(0x80, 0x80) AM_WRITE(mc6847_attr_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( mc1000 ) + PORT_START("JOYA") /* Player 1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) /* = 'I' */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) /* = 'Q' */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) /* = 'Y' */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) /* = '1' */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* = '9' */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("JOYB") /* Player 2 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* = '@' */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) /* = 'H' */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) /* = 'P' */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) /* = 'X' */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) /* = '0' */ + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUBOUT") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("MODIFIERS") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + + PORT_START("JOYAKEYMAP") + PORT_CONFNAME( 0x01, 0x00, "JOYSTICK A (P1) keyboard mapping" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + + PORT_START("JOYBKEYMAP") + PORT_CONFNAME( 0x01, 0x00, "JOYSTICK B (P2) keyboard mapping" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) +INPUT_PORTS_END + +/* Video */ + +WRITE_LINE_MEMBER( mc1000_state::fs_w ) +{ + m_vsync = state; +} + +WRITE_LINE_MEMBER( mc1000_state::hs_w ) +{ + m_hsync = state; +} + +READ8_MEMBER( mc1000_state::videoram_r ) +{ + if (offset == ~0) return 0xff; + + m_vdg->inv_w(BIT(m_mc6847_video_ram[offset], 7)); + + return m_mc6847_video_ram[offset]; +} + +/* AY-3-8910 Interface */ + +WRITE8_MEMBER( mc1000_state::keylatch_w ) +{ + m_keylatch = data; + + m_cassette->output(BIT(data, 7) ? -1.0 : +1.0); +} + +READ8_MEMBER( mc1000_state::keydata_r ) +{ + UINT8 data = 0xff; + + if (!BIT(m_keylatch, 0)) + { + data &= m_y0->read(); + if (m_joybkeymap->read()) data &= m_joyb->read(); + } + if (!BIT(m_keylatch, 1)) + { + data &= m_y1->read(); + if (m_joyakeymap->read()) data &= m_joya->read(); + } + if (!BIT(m_keylatch, 2)) data &= m_y2->read(); + if (!BIT(m_keylatch, 3)) data &= m_y3->read(); + if (!BIT(m_keylatch, 4)) data &= m_y4->read(); + if (!BIT(m_keylatch, 5)) data &= m_y5->read(); + if (!BIT(m_keylatch, 6)) data &= m_y6->read(); + if (!BIT(m_keylatch, 7)) data &= m_y7->read(); + + data = (m_modifiers->read() & 0xc0) | (data & 0x3f); + + if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) + { + if (m_cassette->input() >= +0.0) data &= 0x7f; + } + + return data; +} + +/* Machine Initialization */ + +void mc1000_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* setup memory banking */ + UINT8 *rom = m_rom->base(); + + program.install_readwrite_bank(0x0000, 0x1fff, "bank1"); + membank("bank1")->configure_entry(0, rom); + membank("bank1")->configure_entry(1, rom + 0xc000); + membank("bank1")->set_entry(1); + + m_rom0000 = 1; + + program.install_readwrite_bank(0x2000, 0x27ff, "bank2"); + membank("bank2")->configure_entry(0, rom + 0x2000); + membank("bank2")->configure_entry(1, m_mc6845_video_ram); + membank("bank2")->set_entry(0); + + membank("bank3")->configure_entry(0, rom + 0x4000); + membank("bank3")->set_entry(0); + + membank("bank4")->configure_entry(0, m_mc6847_video_ram); + membank("bank4")->configure_entry(1, rom + 0x8000); + membank("bank4")->set_entry(0); + + membank("bank5")->configure_entry(0, rom + 0x9800); + membank("bank5")->set_entry(0); + + bankswitch(); + + /* register for state saving */ + save_item(NAME(m_rom0000)); + save_item(NAME(m_mc6845_bank)); + save_item(NAME(m_mc6847_bank)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_hsync)); + save_item(NAME(m_vsync)); +} + +void mc1000_state::machine_reset() +{ + membank("bank1")->set_entry(1); + + m_rom0000 = 1; +} + +/* Machine Driver */ + +/* + + Interrupt generator: + NE555 chip in astable circuit. + + +---------*---*---o V+ + | | | + +-+ | | + | |390K | | + | |R17 |8 |4 + +-+ +-------+ + | 7| |3 + *-------| |-------> /INT (Z80) + | | | + | | | + +-+R16 2| IC 28 | + | |1K +--| | + | | | | 555 | + +-+ | | | + | | 6| |5 + *----*--| |---+ + | | | | + ---C30 +-------+ ---C29 + ---10n |1 ---10n + _|_ _|_ _|_ + /// /// /// + + Calculated properties: + + * 99.74489795918367 Duty Cycle Percentage + * 367.3469387755102 Frequency in Hertz + * 0.00000693 Seconds Low + * 0.00270963 Seconds High + + */ + +#define MC1000_NE555_FREQ (367) /* Hz */ +#define MC1000_NE555_DUTY_CYCLE (99.745) /* % */ + +TIMER_DEVICE_CALLBACK_MEMBER(mc1000_state::ne555_tick) +{ + // (m_ne555_int not needed anymore and can be done with?) + m_ne555_int = param; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, param); +} + +static MACHINE_CONFIG_START( mc1000, mc1000_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 3579545) + MCFG_CPU_PROGRAM_MAP(mc1000_mem) + MCFG_CPU_IO_MAP(mc1000_io) + + /* timers */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("ne555clear", mc1000_state, ne555_tick, attotime::from_hz(MC1000_NE555_FREQ)) + MCFG_TIMER_PARAM(CLEAR_LINE) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ne555assert", mc1000_state, ne555_tick, attotime::from_hz(MC1000_NE555_FREQ)) + MCFG_TIMER_START_DELAY(attotime::from_hz(MC1000_NE555_FREQ * 100 / MC1000_NE555_DUTY_CYCLE)) + MCFG_TIMER_PARAM(ASSERT_LINE) + + /* video hardware */ + MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, MC6847_TAG) + + MCFG_DEVICE_ADD(MC6847_TAG, MC6847_NTSC, XTAL_3_579545MHz) + MCFG_MC6847_HSYNC_CALLBACK(WRITELINE(mc1000_state, hs_w)) + MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(mc1000_state, fs_w)) + MCFG_MC6847_INPUT_CALLBACK(READ8(mc1000_state, videoram_r)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(AY8910_TAG, AY8910, 3579545/2) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_RES_LOADS(RES_K(2.2), 0, 0) + MCFG_AY8910_PORT_B_READ_CB(READ8(mc1000_state, keydata_r)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(mc1000_state, keylatch_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_SOFTWARE_LIST_ADD("cass_list", "mc1000_cass") + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(mc1000_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("48K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( mc1000 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "mc1000.ic17", 0xc000, 0x2000, CRC(8e78d80d) SHA1(9480270e67a5db2e7de8bc5c8b9e0bb210d4142b) ) + ROM_LOAD( "mc1000.ic12", 0xe000, 0x2000, CRC(750c95f0) SHA1(fd766f5ea4481ef7fd4df92cf7d8397cc2b5a6c4) ) +ROM_END + + +/* Driver Initialization */ + +DIRECT_UPDATE_MEMBER(mc1000_state::mc1000_direct_update_handler) +{ + if (m_rom0000) + { + if (address >= 0xc000) + { + membank("bank1")->set_entry(0); + m_rom0000 = 0; + } + } + + return address; +} + +DRIVER_INIT_MEMBER(mc1000_state,mc1000) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mc1000_state::mc1000_direct_update_handler), this)); +} + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, mc1000, 0, 0, mc1000, mc1000, mc1000_state, mc1000, "CCE", "MC-1000", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/mc1502.c b/src/mame/drivers/mc1502.c new file mode 100644 index 00000000000..12134cbc3ab --- /dev/null +++ b/src/mame/drivers/mc1502.c @@ -0,0 +1,410 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + drivers/mc1502.c + + Driver file for Electronika MC 1502 + +***************************************************************************/ + +#include "emu.h" +#include "includes/mc1502.h" +#include "bus/rs232/rs232.h" + +#include "cpu/i86/i86.h" +#include "machine/kb_7007_3.h" +#include "sound/speaker.h" +#include "sound/wave.h" + +#define VERBOSE_DBG 0 + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + +/* + * onboard devices: + */ + +// Timer + +/* check if any keys are pressed, raise IRQ1 if so */ + +TIMER_CALLBACK_MEMBER(mc1502_state::keyb_signal_callback) +{ + UINT8 key = 0; + + key |= ioport("Y1")->read(); + key |= ioport("Y2")->read(); + key |= ioport("Y3")->read(); + key |= ioport("Y4")->read(); + key |= ioport("Y5")->read(); + key |= ioport("Y6")->read(); + key |= ioport("Y7")->read(); + key |= ioport("Y8")->read(); + key |= ioport("Y9")->read(); + key |= ioport("Y10")->read(); + key |= ioport("Y11")->read(); + key |= ioport("Y12")->read(); +// DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, m_kbd.pulsing, +// (key || m_kbd.pulsing) ? " will IRQ" : "")); + + /* + If a key is pressed and we're not pulsing yet, start pulsing the IRQ1; + keep pulsing while any key is pressed, and pulse one time after all keys + are released. + */ + if (key) { + if (m_kbd.pulsing < 2) { + m_kbd.pulsing += 2; + } + } + + if (m_kbd.pulsing) { + m_pic8259->ir1_w(m_kbd.pulsing & 1); + m_kbd.pulsing--; + } +} + +WRITE8_MEMBER(mc1502_state::mc1502_ppi_portb_w) +{ +// DBG_LOG(2,"mc1502_ppi_portb_w",("( %02X )\n", data)); + m_ppi_portb = data; + m_pit8253->write_gate2(BIT(data, 0)); + mc1502_speaker_set_spkrdata(BIT(data, 1)); + m_centronics->write_strobe(BIT(data, 2)); + m_centronics->write_autofd(BIT(data, 3)); + m_centronics->write_init(BIT(data, 4)); +} + +// bit 0: parallel port data transfer direction (default = 0 = out) +// bits 1-2: CGA_FONT (default = 01) +// bit 3: i8251 SYNDET pin triggers NMI (default = 1 = no) +WRITE8_MEMBER(mc1502_state::mc1502_ppi_portc_w) +{ +// DBG_LOG(2,"mc1502_ppi_portc_w",("( %02X )\n", data)); + m_ppi_portc = data & 15; +} + +// 0x80 -- serial RxD +// 0x40 -- CASS IN, also loops back T2OUT (gated by CASWR) +// 0x20 -- T2OUT +// 0x10 -- SNDOUT +READ8_MEMBER(mc1502_state::mc1502_ppi_portc_r) +{ + int data = 0xff; + double tap_val = m_cassette->input(); + + data = ( data & ~0x40 ) | ( tap_val < 0 ? 0x40 : 0x00 ) | ( (BIT(m_ppi_portb, 7) && m_pit_out2) ? 0x40 : 0x00 ); + data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); + data = ( data & ~0x10 ) | ( (BIT(m_ppi_portb, 1) && m_pit_out2) ? 0x10 : 0x00 ); + +// DBG_LOG(2,"mc1502_ppi_portc_r",("= %02X (tap_val %f t2out %d) at %s\n", +// data, tap_val, m_pit_out2, machine().describe_context())); + return data; +} + +READ8_MEMBER(mc1502_state::mc1502_kppi_porta_r) +{ + UINT8 key = 0; + + if (m_kbd.mask & 0x0001) { key |= ioport("Y1")->read(); } + if (m_kbd.mask & 0x0002) { key |= ioport("Y2")->read(); } + if (m_kbd.mask & 0x0004) { key |= ioport("Y3")->read(); } + if (m_kbd.mask & 0x0008) { key |= ioport("Y4")->read(); } + if (m_kbd.mask & 0x0010) { key |= ioport("Y5")->read(); } + if (m_kbd.mask & 0x0020) { key |= ioport("Y6")->read(); } + if (m_kbd.mask & 0x0040) { key |= ioport("Y7")->read(); } + if (m_kbd.mask & 0x0080) { key |= ioport("Y8")->read(); } + if (m_kbd.mask & 0x0100) { key |= ioport("Y9")->read(); } + if (m_kbd.mask & 0x0200) { key |= ioport("Y10")->read(); } + if (m_kbd.mask & 0x0400) { key |= ioport("Y11")->read(); } + if (m_kbd.mask & 0x0800) { key |= ioport("Y12")->read(); } + key ^= 0xff; +// DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key)); + return key; +} + +WRITE8_MEMBER(mc1502_state::mc1502_kppi_portb_w) +{ + m_kbd.mask &= ~255; + m_kbd.mask |= data ^ 255; + if (!BIT(data, 0)) + m_kbd.mask |= 1 << 11; + else + m_kbd.mask &= ~(1 << 11); +// DBG_LOG(2,"mc1502_kppi_portb_w",("( %02X -> %04X )\n", data, m_kbd.mask)); +} + +WRITE8_MEMBER(mc1502_state::mc1502_kppi_portc_w) +{ + m_kbd.mask &= ~(7 << 8); + m_kbd.mask |= ((data ^ 7) & 7) << 8; +// DBG_LOG(2,"mc1502_kppi_portc_w",("( %02X -> %04X )\n", data, m_kbd.mask)); +} + +WRITE_LINE_MEMBER(mc1502_state::mc1502_i8251_syndet) +{ + if (!BIT(m_ppi_portc,3)) + m_maincpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE_LINE_MEMBER(mc1502_state::mc1502_pit8253_out1_changed) +{ + m_upd8251->write_txc(state); + m_upd8251->write_rxc(state); +} + +WRITE_LINE_MEMBER(mc1502_state::mc1502_pit8253_out2_changed) +{ + m_pit_out2 = state; + m_speaker->level_w(m_spkrdata & m_pit_out2); + m_cassette->output(state ? 1 : -1); +} + +WRITE_LINE_MEMBER(mc1502_state::mc1502_speaker_set_spkrdata) +{ + m_spkrdata = state ? 1 : 0; + m_speaker->level_w(m_spkrdata & m_pit_out2); +} + +DRIVER_INIT_MEMBER( mc1502_state, mc1502 ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + DBG_LOG(0,"init",("driver_init()\n")); + + program.unmap_readwrite(0, 0x7ffff); + program.install_readwrite_bank(0, m_ram->size()-1, "bank10"); + membank( "bank10" )->set_base( m_ram->pointer() ); +} + +MACHINE_START_MEMBER( mc1502_state, mc1502 ) +{ + DBG_LOG(0,"init",("machine_start()\n")); + + /* + Keyboard polling circuit holds IRQ1 high until a key is + pressed, then it starts a timer that pulses IRQ1 low each + 40ms (check) for 20ms (check) until all keys are released. + Last pulse causes BIOS to write a 'break' scancode into port 60h. + */ + m_pic8259->ir1_w(1); + memset(&m_kbd, 0, sizeof(m_kbd)); + m_kbd.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc1502_state::keyb_signal_callback),this)); + m_kbd.keyb_signal_timer->adjust( attotime::from_msec(20), 0, attotime::from_msec(20) ); +} + +MACHINE_RESET_MEMBER( mc1502_state, mc1502 ) +{ + DBG_LOG(0,"init",("machine_reset()\n")); + + m_spkrdata = 0; + m_pit_out2 = 1; + m_ppi_portb = 0; + m_ppi_portc = 0; + m_speaker->level_w(0); +} + +/* + * macros + */ + +static ADDRESS_MAP_START( mc1502_map, AS_PROGRAM, 8, mc1502_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x97fff) AM_RAM /* 96K on mainboard + 512K on extension card */ + AM_RANGE(0xc0000, 0xfbfff) AM_NOP + AM_RANGE(0xfc000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pk88_map, AS_PROGRAM, 8, mc1502_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x1ffff) AM_RAMBANK("bank10") /* 96K on mainboard */ + AM_RANGE(0xf0000, 0xf7fff) AM_ROM /* BASIC */ + AM_RANGE(0xfc000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mc1502_io, AS_IO, 8, mc1502_state ) + AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) + AM_RANGE(0x0028, 0x0028) AM_DEVREADWRITE("upd8251", i8251_device, data_r, data_w) + AM_RANGE(0x0029, 0x0029) AM_DEVREADWRITE("upd8251", i8251_device, status_r, control_w) + AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255n1", i8255_device, read, write) + AM_RANGE(0x0068, 0x006B) AM_DEVREADWRITE("ppi8255n2", i8255_device, read, write) // keyboard poll +ADDRESS_MAP_END + +static INPUT_PORTS_START( mc1502 ) + PORT_INCLUDE( mc7007_3_keyboard ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( mc1502, mc1502_state ) + MCFG_CPU_ADD("maincpu", I8088, XTAL_16MHz/3) + MCFG_CPU_PROGRAM_MAP(mc1502_map) + MCFG_CPU_IO_MAP(mc1502_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + MCFG_MACHINE_START_OVERRIDE( mc1502_state, mc1502 ) + MCFG_MACHINE_RESET_OVERRIDE( mc1502_state, mc1502 ) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_16MHz/12) /* heartbeat IRQ */ + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_16MHz/12) /* serial port */ + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(mc1502_state, mc1502_pit8253_out1_changed)) + MCFG_PIT8253_CLK2(XTAL_16MHz/12) /* pio port c pin 4, and speaker polling enough */ + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mc1502_state, mc1502_pit8253_out2_changed)) + + MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), VCC, NULL ) + + MCFG_DEVICE_ADD("ppi8255n1", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mc1502_state, mc1502_ppi_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(mc1502_state, mc1502_ppi_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mc1502_state, mc1502_ppi_portc_w)) + + MCFG_DEVICE_ADD("ppi8255n2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mc1502_state, mc1502_kppi_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mc1502_state, mc1502_kppi_portb_w)) + MCFG_I8255_IN_PORTC_CB(DEVREAD8("cent_status_in", input_buffer_device, read)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mc1502_state, mc1502_kppi_portc_w)) + + MCFG_DEVICE_ADD( "upd8251", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("irps", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("irps", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("irps", rs232_port_device, write_rts)) + /* XXX RxD data are accessible via PPI port C, bit 7 */ + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) /* default handler does nothing */ + MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) + MCFG_I8251_SYNDET_HANDLER(WRITELINE(mc1502_state, mc1502_i8251_syndet)) + + MCFG_RS232_PORT_ADD("irps", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd8251", i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("upd8251", i8251_device, write_dsr)) + + MCFG_DEVICE_ADD("isa", ISA8, 0) + MCFG_ISA8_CPU(":maincpu") + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("pic8259", pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("pic8259", pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) + + MCFG_ISA8_SLOT_ADD("isa", "board0", mc1502_isa8_cards, "cga_mc1502", true) + MCFG_ISA8_SLOT_ADD("isa", "isa1", mc1502_isa8_cards, "fdc", false) + MCFG_ISA8_SLOT_ADD("isa", "isa2", mc1502_isa8_cards, "rom", false) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit6)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) + MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) + MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) + + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_SOFTWARE_LIST_ADD("flop_list","mc1502_flop") +// MCFG_SOFTWARE_LIST_ADD("cass_list","mc1502_cass") + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("608K") /* 96 base + 512 on expansion card */ + MCFG_RAM_EXTRA_OPTIONS("96K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pk88, mc1502 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pk88_map) +MACHINE_CONFIG_END + + +/* + Apparently there was a hardware revision with built-in floppy + controller mapped to alternate set of ports; v531 and v533 + support this revision. v533 is possibly not an original BIOS, it + supports autoboot which none of others do. v521h is a version + with support for 3rd party hard disk controller (not emulated). + v51 is designed for a different keyboard layout (JCUKEN, not + QWERTY). +*/ +ROM_START( mc1502 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + + ROM_DEFAULT_BIOS("v52") + ROM_SYSTEM_BIOS(0, "v50", "v5.0 10/05/89") + ROMX_LOAD( "monitor_5_0.rom", 0xfc000, 0x4000, CRC(9e97c6a0) SHA1(16a304e8de69ec4d8b92acda6bf28454c361a24f),ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v52", "v5.2 22/03/91") + ROMX_LOAD( "monitor_5_2.rom", 0xfc000, 0x4000, CRC(0e65491e) SHA1(8a4d556473b5e0e59b05fab77c79c29f4d562412),ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v521", "v5.21 12/10/92") + ROMX_LOAD( "monitor_5_21.rom", 0xfc000, 0x4000, CRC(28c8f653) SHA1(04b0b09e0b86d9648a83352cc1590eb8963833e0),ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v531", "v5.31 12/10/92") + ROMX_LOAD( "monitor_5_31.rom", 0xfc000, 0x4000, CRC(a48295d5) SHA1(6f38977c22f9cc6c2bc6f6e53edc4048ca6b6721),ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v533", "v5.33 01/08/93") + ROMX_LOAD( "0_(cbc0).bin", 0xfc000, 0x2000, CRC(9a55bc4f) SHA1(81da44eec2e52cf04b1fc7053502270f51270590),ROM_BIOS(5)) + ROMX_LOAD( "1_(dfe2).bin", 0xfe000, 0x2000, CRC(8dec077a) SHA1(d6f6d7cc2183abc77fbd9cd59132de5766f7c458),ROM_BIOS(5)) + + // 5.21 + 3rd party HDC support. fails checksum test so marked BAD_DUMP. + ROM_SYSTEM_BIOS(5, "v521h", "v5.21h 22/09/93") + ROMX_LOAD( "mshbios0.pgm", 0xfc000, 0x2000, BAD_DUMP CRC(be447261) SHA1(b93c597c17dfa4b678f72c20a3f7119b73e6ba1c),ROM_BIOS(6)) + ROMX_LOAD( "mshbios1.pgm", 0xfe000, 0x2000, BAD_DUMP CRC(89e2eaf2) SHA1(37d6b225b5e35574fdac81219589407d925225be),ROM_BIOS(6)) + + // 5.3 + ROM_SYSTEM_BIOS(6, "v53", "v5.3 10/11/91") + ROMX_LOAD( "1502~3b0.pgm", 0xfc000, 0x2000, CRC(dc148763) SHA1(7a5e66438007b2de328ac680614f9c4ff60f6a75),ROM_BIOS(7)) + ROMX_LOAD( "1502~3b1.pgm", 0xfe000, 0x2000, CRC(17fc2af2) SHA1(a060d7b7302dfa639025f025106b50412cf26953),ROM_BIOS(7)) + // 5.1 -- JCUKEN keyboard + ROM_SYSTEM_BIOS(7, "v51", "v5.1 10/12/90") + ROMX_LOAD( "ms1502b0.pgm", 0xfc000, 0x2000, CRC(92fcc29a) SHA1(930a4cffcd6ec6110dd9a18bd389b78f0ccb110a),ROM_BIOS(8)) + ROMX_LOAD( "ms1502b1.pgm", 0xfe000, 0x2000, CRC(fe355a58) SHA1(b4ef7775045c6f2095e2b487fe19824986a4892c),ROM_BIOS(8)) + // 5.31 + ROM_SYSTEM_BIOS(8, "v531_92", "v5.31 12/10/92") + ROMX_LOAD( "ms531b0.pgm", 0xfc000, 0x2000, CRC(d97157d1) SHA1(cb1a1e0e2d9a0fcc78f9b09bfb4814d408ee4fae),ROM_BIOS(9)) + ROMX_LOAD( "ms531b1.pgm", 0xfe000, 0x2000, CRC(b1368e1a) SHA1(286496d25dc0ac2d8fe1802caffc6c37b236d105),ROM_BIOS(9)) + // 5.2 + ROM_SYSTEM_BIOS(9, "v52_91", "v5.2 10/11/91") + ROMX_LOAD( "msv5~2b0.pgm", 0xfc000, 0x2000, CRC(f7f370e9) SHA1(e069a35005581a02856853b57dd511ab8e10054b),ROM_BIOS(10)) + ROMX_LOAD( "msv5~2b1.pgm", 0xfe000, 0x2000, CRC(d50e1c43) SHA1(22724dec0052ee9e52f44f5914f2f5f3fae14612),ROM_BIOS(10)) + + ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) + ROM_LOAD( "symgen.rom", 0x0000, 0x2000, CRC(b2747a52) SHA1(6766d275467672436e91ac2997ac6b77700eba1e)) +ROM_END + +/* + Predecessor of MC1502, same keyboard attachment but + different video subsystem (not emulated). +*/ +ROM_START( pk88 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + + ROM_LOAD( "b0.064", 0xf0000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) + ROM_LOAD( "b1.064", 0xf2000, 0x2000, CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731)) + ROM_LOAD( "b2.064", 0xf4000, 0x2000, CRC(1ee66152) SHA1(7ed8c4c6c582487e802beabeca5b86702e5083e8)) + ROM_LOAD( "b3.064", 0xf6000, 0x2000, CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7)) + ROM_LOAD( "pk88-0.064", 0xfc000, 0x2000, CRC(1e4666cf) SHA1(6364c5241f2792909ff318194161eb2c29737546)) + ROM_LOAD( "pk88-1.064", 0xfe000, 0x2000, CRC(6fa7e7ef) SHA1(d68bc273baa46ba733ac6ad4df7569dd70cf60dd)) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1989, mc1502, ibm5150, 0, mc1502, mc1502, mc1502_state, mc1502, "NPO Microprocessor", "Elektronika MC-1502", 0) +COMP ( 1988, pk88, ibm5150, 0, pk88, mc1502, mc1502_state, mc1502, "NPO Microprocessor", "Elektronika PK-88", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mc80.c b/src/mame/drivers/mc80.c new file mode 100644 index 00000000000..ee2ae44bfee --- /dev/null +++ b/src/mame/drivers/mc80.c @@ -0,0 +1,304 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + MC-80.xx driver by Miodrag Milanovic + + 15/05/2009 Initial implementation + 12/05/2009 Skeleton driver. + 01/09/2011 Modernised, added a keyboard to mc8020 + +Real workings of mc8020 keyboard need to be understood and implemented. + +mc8030: very little info available. The area from FFD8-FFFF is meant for +interrupt vectors and so on, but most of it is zeroes. Appears the keyboard +is an ascii keyboard with built-in beeper. It communicates via the SIO, +which needs a rewrite to become useful. The asp ctc needs at least 2 +triggers. The purpose of the zve pio is unknown. The system uses interrupts +for various things, but none of that is working. + +****************************************************************************/ + +#include "includes/mc80.h" + +static ADDRESS_MAP_START(mc8020_mem, AS_PROGRAM, 8, mc80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0bff) AM_ROM + AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("videoram")// 1KB RAM ZRE + AM_RANGE(0x2000, 0x5fff) AM_ROM + AM_RANGE(0x6000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mc8020_io, AS_IO, 8, mc80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mc8030_mem, AS_PROGRAM, 8, mc80_state) + ADDRESS_MAP_UNMAP_HIGH + // ZRE 4 * 2KB + AM_RANGE(0x0000, 0x1fff) AM_ROM // ZRE ROM's 4 * 2716 + AM_RANGE(0x2000, 0x27ff) AM_ROM // SPE ROM's 2 * 2708 + AM_RANGE(0x2800, 0x3fff) AM_ROM // For extension + AM_RANGE(0x4000, 0xbfff) AM_RAM // SPE RAM + AM_RANGE(0xc000, 0xffff) AM_RAM // ZRE RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mc8030_io, AS_IO, 8, mc80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x30, 0x3f) AM_MIRROR(0xff00) AM_NOP //"mass storage" + AM_RANGE(0x80, 0x83) AM_MIRROR(0xff00) AM_DEVREADWRITE("zve_ctc", z80ctc_device, read, write) // user CTC + AM_RANGE(0x84, 0x87) AM_MIRROR(0xff00) AM_DEVREADWRITE("zve_pio", z80pio_device, read, write) // PIO unknown usage + AM_RANGE(0x88, 0x8f) AM_MIRROR(0xff00) AM_WRITE(mc8030_zve_write_protect_w) + AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_WRITE(mc8030_vis_w) AM_MASK(0xffff) + AM_RANGE(0xd0, 0xd3) AM_MIRROR(0xff00) AM_DEVREADWRITE("asp_sio", z80sio0_device, cd_ba_r, cd_ba_w) // keyboard & IFSS? + AM_RANGE(0xd4, 0xd7) AM_MIRROR(0xff00) AM_DEVREADWRITE("asp_ctc", z80ctc_device, read, write) // sio bauds, KMBG? and kbd + AM_RANGE(0xd8, 0xdb) AM_MIRROR(0xff00) AM_DEVREADWRITE("asp_pio", z80pio_device, read, write) // external bus + AM_RANGE(0xe0, 0xef) AM_MIRROR(0xff00) AM_WRITE(mc8030_eprom_prog_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mc8020 ) + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('#') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('&') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('(') + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR('\"') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('^') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('/') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("X3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("X4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("X5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("X6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('?') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_START("X7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) +INPUT_PORTS_END + +static INPUT_PORTS_START( mc8030 ) +INPUT_PORTS_END + + +TIMER_DEVICE_CALLBACK_MEMBER(mc80_state::mc8020_kbd) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + char kbdrow[6]; + UINT8 i; + for (i = 1; i < 8; i++) + { + sprintf(kbdrow,"X%X", i); + mem.write_word(0xd20+i, ioport(kbdrow)->read()); + } +} + +// this is a guess there is no information available +static const z80_daisy_config mc8030_daisy_chain[] = +{ + { "asp_ctc" }, /* System ctc */ + { "asp_pio" }, /* System pio */ + { "asp_sio" }, /* sio */ + { "zve_pio" }, /* User pio */ + { "zve_ctc" }, /* User ctc */ + { NULL } +}; + +static MACHINE_CONFIG_START( mc8020, mc80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) + MCFG_CPU_PROGRAM_MAP(mc8020_mem) + MCFG_CPU_IO_MAP(mc8020_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(mc80_state,mc8020_irq_callback) + + MCFG_MACHINE_RESET_OVERRIDE(mc80_state,mc8020) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(32*6, 16*8) + MCFG_SCREEN_VISIBLE_AREA(0, 32*6-1, 0, 16*8-1) + MCFG_VIDEO_START_OVERRIDE(mc80_state,mc8020) + MCFG_SCREEN_UPDATE_DRIVER(mc80_state, screen_update_mc8020) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* devices */ + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_2_4576MHz) + MCFG_Z80PIO_IN_PA_CB(READ8(mc80_state, mc80_port_a_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(mc80_state, mc80_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(mc80_state, mc80_port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(mc80_state, mc80_port_b_w)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_2_4576MHz / 100) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(mc80_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(mc80_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(mc80_state, ctc_z2_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("mc8020_kbd", mc80_state, mc8020_kbd, attotime::from_hz(50)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( mc8030, mc80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) + MCFG_CPU_PROGRAM_MAP(mc8030_mem) + MCFG_CPU_IO_MAP(mc8030_io) + MCFG_CPU_CONFIG(mc8030_daisy_chain) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(mc80_state,mc8030_irq_callback) + + MCFG_MACHINE_RESET_OVERRIDE(mc80_state,mc8030) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_VIDEO_START_OVERRIDE(mc80_state,mc8030) + MCFG_SCREEN_UPDATE_DRIVER(mc80_state, screen_update_mc8030) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* Devices */ + MCFG_DEVICE_ADD("zve_pio", Z80PIO, XTAL_2_4576MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(mc80_state, zve_port_a_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(mc80_state, zve_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(mc80_state, zve_port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(mc80_state, zve_port_b_w)) + + MCFG_DEVICE_ADD("zve_ctc", Z80CTC, XTAL_2_4576MHz) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + // ZC0, ZC1, ZC2 for user + + MCFG_DEVICE_ADD("asp_pio", Z80PIO, XTAL_2_4576MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(mc80_state, asp_port_a_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(mc80_state, asp_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(mc80_state, asp_port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(mc80_state, asp_port_b_w)) + + MCFG_DEVICE_ADD("asp_ctc", Z80CTC, XTAL_2_4576MHz) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + // ZC0: to SIO CLK CH A + // ZC1: to SIO CLK CH B + // ZC2: KMBG (??) + + MCFG_Z80SIO0_ADD("asp_sio", 4800, 0, 0, 0, 0 ) + // SIO CH A in = keyboard; out = beeper; CH B = IFSS (??) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mc8020 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "ver1", "Version 1") + ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(1)) + ROMX_LOAD( "s02.rom", 0x0400, 0x0400, CRC(93b5811c) SHA1(8559d24072c9b5908a2627ff986d818308f51d59), ROM_BIOS(1)) + ROMX_LOAD( "s03.rom", 0x0800, 0x0400, CRC(3d32c334) SHA1(56d3012595540d03054ad3c6795ed5d929581a04), ROM_BIOS(1)) + ROMX_LOAD( "mo01_v2.rom", 0x2000, 0x0400, CRC(7e47201c) SHA1(db49afdc5c1fe4065a979c56cbdbd3c58f5d942f), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "ver2", "Version 2") + ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(2)) + ROMX_LOAD( "s02_v2.rom", 0x0400, 0x0400, CRC(dd26c90a) SHA1(1108c11362fa63d21110a3b17868c1854a318c09), ROM_BIOS(2)) + ROMX_LOAD( "s03_v2.rom", 0x0800, 0x0400, CRC(5b64ee7b) SHA1(3b4cbfcb8e2dedcfd4a3680c81fe6ceb2211b275), ROM_BIOS(2)) + ROMX_LOAD( "mo01.rom", 0x2000, 0x0400, CRC(c65a470f) SHA1(71325fed1a342149b5efc2234ecfc8adfff0a42d), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(2, "ver3", "Version 3") + ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(3)) + ROMX_LOAD( "s02_v3.rom", 0x0400, 0x0400, CRC(40c7a694) SHA1(bcdf382e8dad9bb6e06d23ec018e9df55c8d8d0c), ROM_BIOS(3)) + ROMX_LOAD( "s03.rom", 0x0800, 0x0400, CRC(3d32c334) SHA1(56d3012595540d03054ad3c6795ed5d929581a04), ROM_BIOS(3)) + ROMX_LOAD( "mo01_v2.rom",0x2000, 0x0400, CRC(7e47201c) SHA1(db49afdc5c1fe4065a979c56cbdbd3c58f5d942f), ROM_BIOS(3)) + + // m02 doesn't exist on board + ROM_LOAD( "mo03.rom", 0x2800, 0x0400, CRC(29685056) SHA1(39e77658fb7af5a28112341f0893e007d73c1b7a)) + ROM_LOAD( "mo04.rom", 0x2c00, 0x0400, CRC(fd315b73) SHA1(cfb943ec8c884a9b92562d05f92faf06fe42ad68)) + ROM_LOAD( "mo05.rom", 0x3000, 0x0400, CRC(453d6370) SHA1(d96f0849a2da958d7e92a31667178ad140719477)) + ROM_LOAD( "mo06.rom", 0x3400, 0x0400, CRC(6357aba5) SHA1(a4867766f6e14e9fe66f22a6839f17c01058c8af)) + ROM_LOAD( "mo07.rom", 0x3800, 0x0400, CRC(a1eb6021) SHA1(b05b63f02de89f065f337bbe54c5b48244e3a4ba)) + ROM_LOAD( "mo08.rom", 0x3c00, 0x0400, CRC(8221cc32) SHA1(65e0ee4241d39d138205c88374b3bcd127e21511)) + ROM_LOAD( "mo09.rom", 0x4000, 0x0400, CRC(7ad5944d) SHA1(ef2781b114277a09ce0cf2e7decfdb7c48a693e3)) + ROM_LOAD( "mo10.rom", 0x4400, 0x0400, CRC(11de8c76) SHA1(b384d22506ff7e3e28bd2dcc33b7a69617eeb52a)) + ROM_LOAD( "mo11.rom", 0x4800, 0x0400, CRC(370cc672) SHA1(133f6e8bfd4e1ca2e9e0a8e2342084419f895e3c)) + ROM_LOAD( "mo12.rom", 0x4c00, 0x0400, CRC(a3838f2b) SHA1(e3602943700bf5068117946bf86f052f5c587169)) + ROM_LOAD( "mo13.rom", 0x5000, 0x0400, CRC(88b61d12) SHA1(00dd4452b4d4191e589ab58ba924ed21b10f323b)) + ROM_LOAD( "mo14.rom", 0x5400, 0x0400, CRC(2168da19) SHA1(c1ce1263167067d8be0a90604d9c29b7379a0545)) + ROM_LOAD( "mo15.rom", 0x5800, 0x0400, CRC(e32f54c4) SHA1(c3d9ca2204e7adbc625cf96031acb8c1df0447c7)) + ROM_LOAD( "mo16.rom", 0x5c00, 0x0400, CRC(403be935) SHA1(4e74355a78ab090ce180437156fed8e4a1d1c787)) +ROM_END + +ROM_START( mc8030 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "zve_1.rom", 0x0000, 0x0800, CRC(31ec0159) SHA1(a97ea9eb733c462e77d625a7942134e45d911c0a)) + ROM_LOAD( "zve_2.rom", 0x0800, 0x0800, CRC(5104983d) SHA1(7516274904042f4fc6813aa8b2a75c0a64f9b937)) + ROM_LOAD( "zve_3.rom", 0x1000, 0x0800, CRC(4bcfd727) SHA1(d296e587098e70270ad60db8edaa685af368b849)) + ROM_LOAD( "zve_4.rom", 0x1800, 0x0800, CRC(f949ae43) SHA1(68c324cf5578497db7ae65da5695fcb30493f612)) + ROM_LOAD( "spe_1.rom", 0x2000, 0x0400, CRC(826f609c) SHA1(e77ff6c180f5a6d7756d076173ae264a0e26f066)) + ROM_LOAD( "spe_2.rom", 0x2400, 0x0400, CRC(98320040) SHA1(6baf87e196f1ccdf44912deafa6042becbfb0679)) + + ROM_REGION( 0x4000, "vram", ROMREGION_ERASE00 ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, mc8020, 0, 0, mc8020, mc8020, driver_device, 0, "VEB Elektronik Gera", "MC-80.21/22", MACHINE_NO_SOUND) +COMP( 198?, mc8030, mc8020, 0, mc8030, mc8030, driver_device, 0, "VEB Elektronik Gera", "MC-80.30/31", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | ORIENTATION_FLIP_X) diff --git a/src/mame/drivers/mcb216.c b/src/mame/drivers/mcb216.c new file mode 100644 index 00000000000..05aaf8960f8 --- /dev/null +++ b/src/mame/drivers/mcb216.c @@ -0,0 +1,161 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + 2013-12-01 Driver for Cromemco MCB-216 SCC (Single Card Computer), + and also the earlier CB-308. + + The driver is working, just missing some hardware info (see ToDo). + + TODO: + - Find out cpu clock speed + - Find out what UART type is used + + Memory allocation + - 0000 to 0FFF - standard roms + - 1000 to 1FFF - optional roms or ram (expect roms) + - 2000 to 23FF - standard ram + - 2400 to FFFF - optional whatever the user wants (expect ram) + + MCB-216: + Press Enter twice. You will see the Basic OK prompt. To get into the + monitor, use the QUIT command, and to return use the B command. + + The mcb216 can use an optional floppy-disk-drive unit. The only other + storage is paper-tape, which is expected to be attached to the terminal. + + CB-308: + Press Enter twice. You will see the Monitor logo. To get into the BASIC, + enter GE400. To return to the monitor, use the QUIT command followed by + pressing Enter twice. All monitor commands must be in uppercase. The + only storage is paper-tape. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class mcb216_state : public driver_device +{ +public: + mcb216_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(keyin_r); + DECLARE_READ8_MEMBER(status_r); + DECLARE_MACHINE_RESET(mcb216); + DECLARE_MACHINE_RESET(cb308); + +private: + UINT8 m_term_data; + required_device m_maincpu; + required_device m_terminal; +}; + +static ADDRESS_MAP_START(mcb216_mem, AS_PROGRAM, 8, mcb216_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0x2000, 0x23ff) AM_RAM + AM_RANGE(0x2400, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mcb216_io, AS_IO, 8, mcb216_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READ(status_r) + AM_RANGE(0x01, 0x01) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(cb308_mem, AS_PROGRAM, 8, mcb216_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_RAM + AM_RANGE(0xe000, 0xefff) AM_ROM AM_REGION("roms", 0) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( mcb216 ) +INPUT_PORTS_END + + +READ8_MEMBER( mcb216_state::keyin_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +// 0x40 - a keystroke is available +// 0x80 - ok to send to terminal +READ8_MEMBER( mcb216_state::status_r ) +{ + return (m_term_data) ? 0xc0 : 0x80; +} + +WRITE8_MEMBER( mcb216_state::kbd_put ) +{ + m_term_data = data; +} + +MACHINE_RESET_MEMBER( mcb216_state, mcb216 ) +{ + m_term_data = 0; +} + +MACHINE_RESET_MEMBER( mcb216_state, cb308 ) +{ + m_term_data = 0; + m_maincpu->set_state_int(Z80_PC, 0xe000); +} + +static MACHINE_CONFIG_START( mcb216, mcb216_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(mcb216_mem) + MCFG_CPU_IO_MAP(mcb216_io) + MCFG_MACHINE_RESET_OVERRIDE(mcb216_state, mcb216) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mcb216_state, kbd_put)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( cb308, mcb216_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(cb308_mem) + MCFG_CPU_IO_MAP(mcb216_io) + MCFG_MACHINE_RESET_OVERRIDE(mcb216_state, cb308) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mcb216_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mcb216 ) + ROM_REGION(0x1000, "roms", 0) + ROM_LOAD( "mcb216r0", 0x0000, 0x0800, CRC(86d20cea) SHA1(9fb8fdbcb8d31bd3304a0b3339c7f423188e9d37) ) + ROM_LOAD( "mcb216r1", 0x0800, 0x0800, CRC(68a25b2c) SHA1(3eadd4a5d65726f767742deb4b51a97df813f37d) ) +ROM_END + +ROM_START( cb308 ) + ROM_REGION(0x1000, "roms", 0) + ROM_LOAD( "cb308r0", 0x0000, 0x0400, CRC(62f50531) SHA1(3071e2ab7fc6b2ca889e4fb5cf7cc9ee8fbe53d3) ) + ROM_LOAD( "cb308r1", 0x0400, 0x0400, CRC(03191ac1) SHA1(84665dfc797c9f51bb659291b18399986ed846fb) ) + ROM_LOAD( "cb308r2", 0x0800, 0x0400, CRC(695ea521) SHA1(efe36a712e2a038ee804e556c5ebe05443cf798e) ) + ROM_LOAD( "cb308r3", 0x0c00, 0x0400, CRC(e3e4a778) SHA1(a7c14458f8636d860ae25b10387fa6f7f2ef6ef9) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, mcb216, 0, 0, mcb216, mcb216, driver_device, 0, "Cromemco", "MCB-216", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP( 1977, cb308, mcb216, 0, cb308, mcb216, driver_device, 0, "Cromemco", "CB-308", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/mccpm.c b/src/mame/drivers/mccpm.c new file mode 100644 index 00000000000..7821bd59c3e --- /dev/null +++ b/src/mame/drivers/mccpm.c @@ -0,0 +1,152 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + mc-CP/M-Computer + + 31/08/2010 Skeleton driver. + 18/11/2010 Connected to a terminal + 28/09/2011 Added more bioses + +Some Monitor commands (varies between versions): + +B - boot a floppy (^N to regain control) +E - prints a number +I - Select boot drive/set parameters +K,O - display version header +N - newline +Z - print 'EFFF' + +URL for v3.4: http://www.hanshehl.de/mc-prog.htm (German language) + +I/O ports (my guess) +30 - fdc (1st drive) +40 - fdc (2nd drive) +F0 - terminal in/out +F1 - terminal status + +SIO? - F0 to F3 +PIO A-Data 0F4h, A-Command 0F5h, B-Data 0F6h, B-Command 0F7h + +'maincpu' (F59C): unmapped i/o memory write to 00F1 = 01 & FF +'maincpu' (F59C): unmapped i/o memory write to 00F1 = 00 & FF +'maincpu' (F59C): unmapped i/o memory write to 00F1 = 03 & FF +'maincpu' (F59C): unmapped i/o memory write to 00F1 = E1 & FF +'maincpu' (F59C): unmapped i/o memory write to 00F1 = 04 & FF +'maincpu' (F59C): unmapped i/o memory write to 00F1 = 4C & FF +'maincpu' (F59C): unmapped i/o memory write to 00F1 = 05 & FF +'maincpu' (F59C): unmapped i/o memory write to 00F1 = EA & FF +'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 01 & FF +'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 00 & FF +'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 03 & FF +'maincpu' (F5A5): unmapped i/o memory write to 00F3 = E1 & FF +'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 04 & FF +'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 4C & FF +'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 05 & FF +'maincpu' (F5A5): unmapped i/o memory write to 00F3 = EA & FF +'maincpu' (F5A9): unmapped i/o memory write to 00F5 = CF & FF +'maincpu' (F5AD): unmapped i/o memory write to 00F5 = 7F & FF +'maincpu' (F5B1): unmapped i/o memory write to 00F7 = CF & FF +'maincpu' (F5B4): unmapped i/o memory write to 00F7 = 00 & FF +'maincpu' (F149): unmapped i/o memory write to 0040 = D0 & FF +'maincpu' (F14B): unmapped i/o memory write to 0030 = D0 & FF + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class mccpm_state : public driver_device +{ +public: + mccpm_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_p_ram(*this, "p_ram") + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(mccpm_f0_r); + DECLARE_READ8_MEMBER(mccpm_f1_r); + DECLARE_WRITE8_MEMBER(kbd_put); + required_shared_ptr m_p_ram; + UINT8 m_term_data; + virtual void machine_reset(); +}; + + + +READ8_MEMBER( mccpm_state::mccpm_f0_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +// bit 0 - key pressed +// bit 2 - ready to send to terminal +READ8_MEMBER( mccpm_state::mccpm_f1_r ) +{ + return (m_term_data) ? 5 : 4; +} + +static ADDRESS_MAP_START(mccpm_mem, AS_PROGRAM, 8, mccpm_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_RAM AM_SHARE("p_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mccpm_io, AS_IO, 8, mccpm_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf0, 0xf0) AM_READ(mccpm_f0_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0xf1, 0xf1) AM_READ(mccpm_f1_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mccpm ) +INPUT_PORTS_END + + +void mccpm_state::machine_reset() +{ + UINT8* bios = memregion("maincpu")->base(); + memcpy(m_p_ram, bios, 0x1000); +} + +WRITE8_MEMBER( mccpm_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( mccpm, mccpm_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(mccpm_mem) + MCFG_CPU_IO_MAP(mccpm_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mccpm_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mccpm ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v36", "V3.6") + ROMX_LOAD( "mon36.j15", 0x0000, 0x1000, CRC(9c441537) SHA1(f95bad52d9392b8fc9d9b8779b7b861672a0022b), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v34", "V3.4") + ROMX_LOAD( "monhemc.bin", 0x0000, 0x1000, CRC(cae7b56e) SHA1(1f40be9491a595e6705099a452743cc0d49bfce8), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v34a", "V3.4 (alt)") + ROMX_LOAD( "mc01mon.bin", 0x0000, 0x0d00, CRC(d1c89043) SHA1(f52a0ed3793dde0de74596be7339233b6a1770af), ROM_BIOS(3)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, mccpm, 0, 0, mccpm, mccpm, driver_device, 0, "GRAF Elektronik Systeme GmbH", "mc-CP/M-Computer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c new file mode 100644 index 00000000000..63164a11d0f --- /dev/null +++ b/src/mame/drivers/megadriv.c @@ -0,0 +1,939 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +#include "emu.h" +#include "includes/md_cons.h" +#include "sound/sn76496.h" + +#include "imagedev/chd_cd.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#include "formats/imageutl.h" + + +/************************************* + * + * Input handlers + * + *************************************/ + +/* These overwrite the MAME ones in DRIVER_INIT */ +/* They're needed to give the users the choice between different controllers */ +READ8_MEMBER(md_cons_state::mess_md_io_read_data_port) +{ + int portnum = offset; + + UINT8 retdata; + int controller; + UINT8 helper_6b = (m_megadrive_io_ctrl_regs[portnum] & 0x3f) | 0xc0; // bits 6 & 7 always come from megadrive_io_data_regs + UINT8 helper_3b = (m_megadrive_io_ctrl_regs[portnum] & 0x7f) | 0x80; // bit 7 always comes from megadrive_io_data_regs + + switch (portnum) + { + case 0: + controller = (m_io_ctrlr->read() & 0x0f); + break; + + case 1: + controller = (m_io_ctrlr->read() & 0xf0); + break; + + default: + controller = 0; + break; + } + + /* Are we using a 6 buttons Joypad? */ + if (controller) + { + if (m_megadrive_io_data_regs[portnum] & 0x40) + { + if (m_io_stage[portnum] == 2) + { + /* here we read B, C & the additional buttons */ + retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | + ((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x30) | + ((m_io_pad6b[1][portnum] ? m_io_pad6b[1][portnum]->read() : 0) & 0x0f)) & ~helper_6b); + } + else + { + /* here we read B, C & the directional buttons */ + retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | + (((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x3f) & ~helper_6b); + } + } + else + { + if (m_io_stage[portnum] == 1) + { + /* here we read ((Start & A) >> 2) | 0x00 */ + retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | + ((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) & ~helper_6b); + } + else if (m_io_stage[portnum]==2) + { + /* here we read ((Start & A) >> 2) | 0x0f */ + retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | + (((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) | 0x0f) & ~helper_6b); + } + else + { + /* here we read ((Start & A) >> 2) | Up and Down */ + retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | + (((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) | + ((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x03)) & ~helper_6b); + } + } + + // osd_printf_debug("read io data port stage %d port %d %02x\n",mess_io_stage[portnum],portnum,retdata); + + retdata |= (retdata << 8); + } + /* Otherwise it's a 3 buttons Joypad */ + else + { + UINT8 svp_test = 0; + if (m_cart) + svp_test = m_cart->read_test(); + + // handle test input for SVP test + if (portnum == 0 && svp_test) + { + retdata = (m_megadrive_io_data_regs[0] & 0xc0); + } + else if (m_megadrive_io_data_regs[portnum] & 0x40) + { + /* here we read B, C & the directional buttons */ + retdata = (m_megadrive_io_data_regs[portnum] & helper_3b) | + ((((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0x3f) | 0x40) & ~helper_3b); + } + else + { + /* here we read ((Start & A) >> 2) | Up and Down */ + retdata = (m_megadrive_io_data_regs[portnum] & helper_3b) | + (((((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0xc0) >> 2) | + ((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0x03) | 0x40) & ~helper_3b); + } + } + + return retdata; +} + + +WRITE16_MEMBER(md_cons_state::mess_md_io_write_data_port) +{ + int portnum = offset; + int controller; + + switch (portnum) + { + case 0: + controller = (m_io_ctrlr->read() & 0x0f); + break; + + case 1: + controller = (m_io_ctrlr->read() & 0xf0); + break; + + default: + controller = 0; + break; + } + + if (controller) + { + if (m_megadrive_io_ctrl_regs[portnum] & 0x40) + { + if (((m_megadrive_io_data_regs[portnum] & 0x40) == 0x00) && ((data & 0x40) == 0x40)) + { + m_io_stage[portnum]++; + m_io_timeout[portnum]->adjust(m_maincpu->cycles_to_attotime(8192)); + } + + } + } + m_megadrive_io_data_regs[portnum] = data; + //osd_printf_debug("Writing IO Data Register #%d data %04x\n",portnum,data); +} + + +/************************************* + * + * Input ports + * + *************************************/ + + +static INPUT_PORTS_START( md ) + PORT_START("CTRLSEL") /* Controller selection */ + PORT_CONFNAME( 0x0f, 0x00, "Player 1 Controller" ) + PORT_CONFSETTING( 0x00, "Joystick 3 Buttons" ) + PORT_CONFSETTING( 0x01, "Joystick 6 Buttons" ) +// PORT_CONFSETTING( 0x02, "Sega Mouse" ) +/* there exists both a 2 buttons version of the Mouse (Jpn ver, to be used with RPGs, it + can aslo be used as trackball) and a 3 buttons version (US ver, no trackball feats.) */ +// PORT_CONFSETTING( 0x03, "Sega Menacer" ) +// PORT_CONFSETTING( 0x04, "Konami Justifier" ) +// PORT_CONFSETTING( 0x05, "Team Player (Sega Multitap)" ) +// PORT_CONFSETTING( 0x06, "4-Play (EA Multitap)" ) +// PORT_CONFSETTING( 0x07, "J-Cart" ) + PORT_CONFNAME( 0xf0, 0x00, "Player 2 Controller" ) + PORT_CONFSETTING( 0x00, "Joystick 3 Buttons" ) + PORT_CONFSETTING( 0x10, "Joystick 6 Buttons" ) + + PORT_START("PAD1_3B") /* Joypad 1 (3 button + start) NOT READ DIRECTLY */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) + + PORT_START("PAD2_3B") /* Joypad 2 (3 button + start) NOT READ DIRECTLY */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) + + PORT_START("PAD1_6B") /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + + PORT_START("EXTRA1") /* Extra buttons for Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Z") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Y") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 X") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Mode") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + + PORT_START("PAD2_6B") /* Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + + PORT_START("EXTRA2") /* Extra buttons for Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Z") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Y") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 X") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Mode") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + + PORT_START("RESET") /* Buttons on Genesis Console */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?) +INPUT_PORTS_END + + + +/************************************* + * + * Machine driver + * + *************************************/ + +MACHINE_START_MEMBER(md_cons_state, md_common) +{ + static const char *const pad6names[2][4] = { + { "PAD1_6B", "PAD2_6B", "UNUSED", "UNUSED" }, + { "EXTRA1", "EXTRA2", "UNUSED", "UNUSED" } + }; + static const char *const pad3names[4] = { "PAD1_3B", "PAD2_3B", "UNUSED", "UNUSED" }; + + m_io_ctrlr = ioport("CTRLSEL"); + + for (int i = 0; i < 4; i++) + { + m_io_pad3b[i] = ioport(pad3names[i]); + m_io_pad6b[0][i] = ioport(pad6names[0][i]); + m_io_pad6b[1][i] = ioport(pad6names[1][i]); + } + + // setup timers for 6 button pads + for (int i = 0; i < 3; i++) + m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this), (void*)(FPTR)i); + + m_vdp->stop_timers(); + + if (m_cart) + m_cart->save_nvram(); +} + +MACHINE_START_MEMBER(md_cons_state, ms_megadriv) +{ + MACHINE_START_CALL_MEMBER( md_common ); + + // the SVP introduces some kind of DMA 'lag', which we have to compensate for, this is obvious even on gfx DMAd from ROM (the Speedometer) + if (m_cart->get_type() == SEGA_SVP) + m_vdp->set_dma_delay(2); + + // for now m_cartslot is only in MD and not 32x and SegaCD + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_cart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_cart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_cart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)m_cart)); +} + +MACHINE_START_MEMBER(md_cons_state, ms_megacd) +{ + MACHINE_START_CALL_MEMBER( md_common ); + + // the segaCD introduces some kind of DMA 'lag', which we have to compensate for, + // at least when reading wordram? we might need to check what mode we're in the DMA... + m_vdp->set_dma_delay(2); +} + +MACHINE_RESET_MEMBER(md_cons_state, ms_megadriv) +{ + m_maincpu->reset(); + MACHINE_RESET_CALL_MEMBER( megadriv ); + + // if the system has a 32x, pause the extra CPUs until they are actually turned on + if (m_32x) + m_32x->pause_cpu(); +} + +// same as screen_eof_megadriv but with addition of 32x and SegaCD/MegaCD pieces +void md_cons_state::screen_eof_console(screen_device &screen, bool state) +{ + if (m_io_reset && (m_io_reset->read() & 0x01)) + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + + // rising edge + if (state) + { + if (!m_vdp->m_use_alt_timing) + { + bool mode3 = (m_vdp->get_imode() == 3); + m_vdp->vdp_handle_eof(); + m_vdp->m_megadriv_scanline_timer->adjust(attotime::zero); + + if (m_32x) + { + m_32x->m_32x_vblank_flag = 0; + m_32x->m_32x_hcount_compare_val = -1; + m_32x->update_total_scanlines(mode3); + } + if (m_segacd) + m_segacd->update_total_scanlines(mode3); + } + } +} + +static MACHINE_CONFIG_START( ms_megadriv, md_cons_state ) + MCFG_FRAGMENT_ADD( md_ntsc ) + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megadriv) + MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) + + MCFG_SCREEN_MODIFY("megadriv") + MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) + + MCFG_MD_CARTRIDGE_ADD("mdslot", md_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","megadriv") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ms_megadpal, md_cons_state ) + MCFG_FRAGMENT_ADD( md_pal ) + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megadriv) + MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) + + MCFG_SCREEN_MODIFY("megadriv") + MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) + + MCFG_MD_CARTRIDGE_ADD("mdslot", md_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","megadriv") +MACHINE_CONFIG_END + + + + +/************************************* + * + * ROM definition(s) + * + *************************************/ + + +/* we don't use the bios rom (it's not needed and only provides security on early models) */ + +ROM_START(genesis) + ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) + ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) +ROM_END + +ROM_START(megadriv) + ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) + ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) +ROM_END + +ROM_START(megadrij) + ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) + ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) +ROM_END + + +/************************************* + * + * Driver initialization + * + *************************************/ + +DRIVER_INIT_MEMBER(md_cons_state, mess_md_common) +{ + m_megadrive_io_read_data_port_ptr = read8_delegate(FUNC(md_cons_state::mess_md_io_read_data_port),this); + m_megadrive_io_write_data_port_ptr = write16_delegate(FUNC(md_cons_state::mess_md_io_write_data_port),this); +} + +DRIVER_INIT_MEMBER(md_cons_state, genesis) +{ + DRIVER_INIT_CALL(megadriv); + DRIVER_INIT_CALL(mess_md_common); + + if (m_32x) + { + m_32x->set_32x_pal(FALSE); + m_32x->set_framerate(60); + m_32x->set_total_scanlines(262); + } + if (m_segacd) + { + m_segacd->set_framerate(60); + m_segacd->set_total_scanlines(262); + } + + m_version_hi_nibble = 0x80; // Export NTSC + if (!m_segacd) + m_version_hi_nibble |= 0x20; +} + +DRIVER_INIT_MEMBER(md_cons_state, md_eur) +{ + DRIVER_INIT_CALL(megadrie); + DRIVER_INIT_CALL(mess_md_common); + + if (m_32x) + { + m_32x->set_32x_pal(TRUE); + m_32x->set_framerate(50); + m_32x->set_total_scanlines(313); + } + if (m_segacd) + { + m_segacd->set_framerate(50); + m_segacd->set_total_scanlines(313); + } + + m_version_hi_nibble = 0xc0; // Export PAL + if (!m_segacd) + m_version_hi_nibble |= 0x20; +} + +DRIVER_INIT_MEMBER(md_cons_state, md_jpn) +{ + DRIVER_INIT_CALL(megadrij); + DRIVER_INIT_CALL(mess_md_common); + + if (m_32x) + { + m_32x->set_32x_pal(FALSE); + m_32x->set_framerate(60); + m_32x->set_total_scanlines(262); + } + if (m_segacd) + { + m_segacd->set_framerate(60); + m_segacd->set_total_scanlines(262); + } + + m_version_hi_nibble = 0x00; // JPN NTSC + if (!m_segacd) + m_version_hi_nibble |= 0x20; +} + +/****************************************** 32X emulation ****************************************/ + +DEVICE_IMAGE_LOAD_MEMBER( md_cons_state, _32x_cart ) +{ + UINT32 length; + dynamic_buffer temp_copy; + UINT16 *ROM16; + UINT32 *ROM32; + int i; + + if (image.software_entry() == NULL) + { + length = image.length(); + temp_copy.resize(length); + image.fread(&temp_copy[0], length); + } + else + { + length = image.get_software_region_length("rom"); + temp_copy.resize(length); + memcpy(&temp_copy[0], image.get_software_region("rom"), length); + } + + /* Copy the cart image in the locations the driver expects */ + // Notice that, by using pick_integer, we are sure the code works on both LE and BE machines + ROM16 = (UINT16 *) memregion("gamecart")->base(); + for (i = 0; i < length; i += 2) + ROM16[i / 2] = pick_integer_be(&temp_copy[0], i, 2); + + ROM32 = (UINT32 *) memregion("gamecart_sh2")->base(); + for (i = 0; i < length; i += 4) + ROM32[i / 4] = pick_integer_be(&temp_copy[0], i, 4); + + ROM16 = (UINT16 *) memregion("maincpu")->base(); + for (i = 0x00; i < length; i += 2) + ROM16[i / 2] = pick_integer_be(&temp_copy[0], i, 2); + + return IMAGE_INIT_PASS; +} + + +void md_cons_state::_32x_scanline_callback(int x, UINT32 priority, UINT16 &lineptr) +{ + if (m_32x) + m_32x->_32x_render_videobuffer_to_screenbuffer(x, priority, lineptr); +} + +void md_cons_state::_32x_interrupt_callback(int scanline, int irq6) +{ + if (m_32x) + m_32x->_32x_interrupt_cb(scanline, irq6); +} + +void md_cons_state::_32x_scanline_helper_callback(int scanline) +{ + if (m_32x) + m_32x->_32x_render_videobuffer_to_screenbuffer_helper(scanline); +} + +static MACHINE_CONFIG_START( genesis_32x, md_cons_state ) + MCFG_FRAGMENT_ADD( md_ntsc ) + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, md_common) + MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) + + MCFG_DEVICE_MODIFY("gen_vdp") + MCFG_SEGA315_5313_32X_SCANLINE_CB(md_cons_state, _32x_scanline_callback); + MCFG_SEGA315_5313_32X_SCANLINE_HELPER_CB(md_cons_state, _32x_scanline_helper_callback); + MCFG_SEGA315_5313_32X_INTERRUPT_CB(md_cons_state, _32x_interrupt_callback); + + MCFG_DEVICE_ADD("sega32x", SEGA_32X_NTSC, 0) + MCFG_SEGA_32X_PALETTE("gen_vdp:palette") + + MCFG_SCREEN_MODIFY("megadriv") + MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) + + // we need to remove and re-add the sound system because the balance is different + // due to MAME / MESS having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is slient?!) + MCFG_DEVICE_REMOVE("ymsnd") + MCFG_DEVICE_REMOVE("snsnd") + + MCFG_SOUND_ADD("ymsnd", YM2612, MASTER_CLOCK_NTSC/7) + MCFG_SOUND_ROUTE(0, "lspeaker", (0.50)/2) + MCFG_SOUND_ROUTE(1, "rspeaker", (0.50)/2) + + /* sound hardware */ + MCFG_SOUND_ADD("snsnd", SEGAPSG, MASTER_CLOCK_NTSC/15) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart") + MCFG_GENERIC_EXTENSIONS("32x,bin") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(md_cons_state, _32x_cart) + + MCFG_SOFTWARE_LIST_ADD("cart_list","32x") + MCFG_SOFTWARE_LIST_FILTER("cart_list","NTSC-U") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( mdj_32x, md_cons_state ) + MCFG_FRAGMENT_ADD( md_ntsc ) + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, md_common) + MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) + + MCFG_DEVICE_MODIFY("gen_vdp") + MCFG_SEGA315_5313_32X_SCANLINE_CB(md_cons_state, _32x_scanline_callback); + MCFG_SEGA315_5313_32X_SCANLINE_HELPER_CB(md_cons_state, _32x_scanline_helper_callback); + MCFG_SEGA315_5313_32X_INTERRUPT_CB(md_cons_state, _32x_interrupt_callback); + + MCFG_DEVICE_ADD("sega32x", SEGA_32X_NTSC, 0) + MCFG_SEGA_32X_PALETTE("gen_vdp:palette") + + MCFG_SCREEN_MODIFY("megadriv") + MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) + + // we need to remove and re-add the sound system because the balance is different + // due to MAME / MESS having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is slient?!) + MCFG_DEVICE_REMOVE("ymsnd") + MCFG_DEVICE_REMOVE("snsnd") + + MCFG_SOUND_ADD("ymsnd", YM2612, MASTER_CLOCK_NTSC/7) + MCFG_SOUND_ROUTE(0, "lspeaker", (0.50)/2) + MCFG_SOUND_ROUTE(1, "rspeaker", (0.50)/2) + + /* sound hardware */ + MCFG_SOUND_ADD("snsnd", SEGAPSG, MASTER_CLOCK_NTSC/15) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart") + MCFG_GENERIC_EXTENSIONS("32x,bin") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(md_cons_state, _32x_cart) + + MCFG_SOFTWARE_LIST_ADD("cart_list","32x") + MCFG_SOFTWARE_LIST_FILTER("cart_list","NTSC-J") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( md_32x, md_cons_state ) + MCFG_FRAGMENT_ADD( md_pal ) + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, md_common) + MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) + + MCFG_DEVICE_MODIFY("gen_vdp") + MCFG_SEGA315_5313_32X_SCANLINE_CB(md_cons_state, _32x_scanline_callback); + MCFG_SEGA315_5313_32X_SCANLINE_HELPER_CB(md_cons_state, _32x_scanline_helper_callback); + MCFG_SEGA315_5313_32X_INTERRUPT_CB(md_cons_state, _32x_interrupt_callback); + + MCFG_DEVICE_ADD("sega32x", SEGA_32X_PAL, 0) + MCFG_SEGA_32X_PALETTE("gen_vdp:palette") + + MCFG_SCREEN_MODIFY("megadriv") + MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) + + // we need to remove and re-add the sound system because the balance is different + // due to MAME / MESS having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is slient?!) + MCFG_DEVICE_REMOVE("ymsnd") + MCFG_DEVICE_REMOVE("snsnd") + + MCFG_SOUND_ADD("ymsnd", YM2612, MASTER_CLOCK_NTSC/7) + MCFG_SOUND_ROUTE(0, "lspeaker", (0.50)/2) + MCFG_SOUND_ROUTE(1, "rspeaker", (0.50)/2) + + /* sound hardware */ + MCFG_SOUND_ADD("snsnd", SEGAPSG, MASTER_CLOCK_NTSC/15) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart") + MCFG_GENERIC_EXTENSIONS("32x,bin") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(md_cons_state, _32x_cart) + + MCFG_SOFTWARE_LIST_ADD("cart_list","32x") + MCFG_SOFTWARE_LIST_FILTER("cart_list","PAL") +MACHINE_CONFIG_END + + + +#define _32X_ROMS \ + ROM_REGION16_BE( 0x400000, "gamecart", ROMREGION_ERASE00 ) /* 68000 Code */ \ + ROM_REGION32_BE( 0x400000, "gamecart_sh2", ROMREGION_ERASE00 ) /* Copy for the SH2 */ \ + ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */ \ + ROM_LOAD( "32x_g_bios.bin", 0x000000, 0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) ) \ + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) \ + /* temp, rom should only be visible here when one of the regs is set, tempo needs it */ \ + ROM_COPY( "32x_68k_bios", 0x0, 0x0, 0x100) \ + ROM_REGION32_BE( 0x400000, "master", 0 ) /* SH2 Code */ \ + ROM_SYSTEM_BIOS( 0, "retail", "Mars Version 1.0 (retail)" ) \ + ROMX_LOAD( "32x_m_bios.bin", 0x000000, 0x000800, CRC(dd9c46b8) SHA1(1e5b0b2441a4979b6966d942b20cc76c413b8c5e), ROM_BIOS(1) ) \ + ROM_SYSTEM_BIOS( 1, "sdk", "Mars Version 1.0 (early sdk)" ) \ + ROMX_LOAD( "32x_m_bios_sdk.bin", 0x000000, 0x000800, BAD_DUMP CRC(c7102c53) SHA1(ed73a47f186b373b8eff765f84ef26c3d9ef6cb0), ROM_BIOS(2) ) \ + ROM_REGION32_BE( 0x400000, "slave", 0 ) /* SH2 Code */ \ + ROM_LOAD( "32x_s_bios.bin", 0x000000, 0x000400, CRC(bfda1fe5) SHA1(4103668c1bbd66c5e24558e73d4f3f92061a109a) ) + +ROM_START( 32x ) + _32X_ROMS +ROM_END + +ROM_START( 32xe ) + _32X_ROMS +ROM_END + +ROM_START( 32xj ) + _32X_ROMS +ROM_END + + +/****************************************** SegaCD emulation ****************************************/ + +static MACHINE_CONFIG_START( genesis_scd, md_cons_state ) + MCFG_FRAGMENT_ADD( md_ntsc ) + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd) + MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) + + MCFG_SCREEN_MODIFY("megadriv") + MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) + + MCFG_DEVICE_ADD("segacd", SEGA_SEGACD_US, 0) + MCFG_GFX_PALETTE("gen_vdp:palette") + + MCFG_CDROM_ADD( "cdrom" ) + MCFG_CDROM_INTERFACE("scd_cdrom") + + MCFG_SOFTWARE_LIST_ADD("cd_list","segacd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( md_scd, md_cons_state ) + MCFG_FRAGMENT_ADD( md_pal ) + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd) + MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) + + MCFG_SCREEN_MODIFY("megadriv") + MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) + + MCFG_DEVICE_ADD("segacd", SEGA_SEGACD_EUROPE, 0) + MCFG_GFX_PALETTE("gen_vdp:palette") + + MCFG_CDROM_ADD( "cdrom" ) + MCFG_CDROM_INTERFACE("scd_cdrom") + + MCFG_SOFTWARE_LIST_ADD("cd_list","megacd") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( mdj_scd, md_cons_state ) + MCFG_FRAGMENT_ADD( md_ntsc ) + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd) + MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) + + MCFG_SCREEN_MODIFY("megadriv") + MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) + + MCFG_DEVICE_ADD("segacd", SEGA_SEGACD_JAPAN, 0) + MCFG_GFX_PALETTE("gen_vdp:palette") + + MCFG_CDROM_ADD( "cdrom" ) + MCFG_CDROM_INTERFACE("scd_cdrom") + + MCFG_SOFTWARE_LIST_ADD("cd_list","megacdj") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( genesis_32x_scd, genesis_32x ) + + MCFG_DEVICE_ADD("segacd", SEGA_SEGACD_US, 0) + MCFG_GFX_PALETTE("gen_vdp:palette") + + MCFG_CDROM_ADD( "cdrom" ) + MCFG_CDROM_INTERFACE("scd_cdrom") + + MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd) + + MCFG_DEVICE_REMOVE("cartslot") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart") + MCFG_GENERIC_EXTENSIONS("32x,bin") + MCFG_GENERIC_LOAD(md_cons_state, _32x_cart) + + //MCFG_QUANTUM_PERFECT_CPU("32x_master_sh2") +MACHINE_CONFIG_END + + + +/* We need proper names for most of these BIOS ROMs! */ +ROM_START( segacd ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + /* v1.10 confirmed dump by dead_screem */ + ROM_LOAD( "mpr-15045b.bin", 0x000000, 0x020000, CRC(c6d10268) SHA1(f4f315adcef9b8feb0364c21ab7f0eaf5457f3ed) ) +ROM_END + +ROM_START( megacd ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + /* v1.00, confirmed good dump */ + ROM_LOAD( "megacd_model1_bios_1_00_e.bin", 0x000000, 0x020000, CRC(529ac15a) SHA1(f891e0ea651e2232af0c5c4cb46a0cae2ee8f356) ) +ROM_END + +ROM_START( megacdj ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + ROM_DEFAULT_BIOS("v100g") // this seems the only revision where the cursor in CD menu works, allowing to boot games + /* Confirmed by ElBarto */ + ROM_SYSTEM_BIOS(0, "v100s", "v1.00S") + ROMX_LOAD( "mpr-14088h.bin", 0x000000, 0x020000, CRC(3773d5aa) SHA1(bbf729a1aaa1667b783749299e1ad932aaf5f253), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE) + /* Confirmed by ElBarto */ + ROM_SYSTEM_BIOS(1, "v100g", "v1.00G") + ROMX_LOAD( "epr-14088b.bin", 0x000000, 0x020000, CRC(69ed6ccd) SHA1(27d11c3836506f01ee81cd142c0cd8b51abebbd2), ROM_BIOS(2) | ROM_GROUPWORD | ROM_REVERSE) + /* Confirmed by ElBarto */ + ROM_SYSTEM_BIOS(2, "v100l", "v1.00L") + ROMX_LOAD( "mpr-14088c.bin", 0x000000, 0x020000, CRC(03134289) SHA1(d60cb5a53f26d6b13e354bc149217587f2301718), ROM_BIOS(3) | ROM_GROUPWORD | ROM_REVERSE) + /* Confirmed by ElBarto */ + ROM_SYSTEM_BIOS(3, "v100o", "v1.00O") + ROMX_LOAD( "epr-14088d.bin", 0x000000, 0x020000, CRC(dfa95ee9) SHA1(e13666c76fa0a2e94e2f651b26b0fd625bf55f07), ROM_BIOS(4) | ROM_GROUPWORD | ROM_REVERSE) + ROM_SYSTEM_BIOS(4, "v100p", "v1.00P") // CRC: e2e70bc8 when byteswapped + ROMX_LOAD( "epr-14088e.bin", 0x000000, 0x020000, CRC(9d2da8f2) SHA1(4846f448160059a7da0215a5df12ca160f26dd69), ROM_BIOS(5) ) +ROM_END + +/* Asia bios, when run in USA region will show : +ERROR! +THIS IS A PAL-COMPATIBLE MEGA CD +FOR EXCLUSIVE USE IN SOUTHEAST ASIA. + +Confirmed by Jakovasaur +*/ +ROM_START( megacda ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "epr-14536h.bin", 0x000000, 0x020000, CRC(550f30bb) SHA1(e4193c6ae44c3cea002707d2a88f1fbcced664de)) +ROM_END + +ROM_START( segacd2 ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + ROM_SYSTEM_BIOS(0, "v211x", "Model 2 v2.11X") + ROMX_LOAD( "mpr-15764-t.bin", 0x000000, 0x020000, CRC(2e49d72c) SHA1(328a3228c29fba244b9db2055adc1ec4f7a87e6b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "v200", "Model 2 v2.00") /* verified dump */ + ROMX_LOAD( "us_scd2_930314.bin", 0x000000, 0x020000, CRC(8af65f58) SHA1(5a8c4b91d3034c1448aac4b5dc9a6484fce51636), ROM_BIOS(2) ) + /* this is reportedly a bad dump, it has many differences from the verified dump and does not boot in Kega */ + /* ROMX_LOAD( "segacd_model2_bios_2_00_u.bin", 0x000000, 0x020000, CRC(340b4be4) SHA1(bd3ee0c8ab732468748bf98953603ce772612704), ROM_BIOS(2) ) */ + ROM_SYSTEM_BIOS(2, "v200w", "Model 2 v2.00W") + ROMX_LOAD( "segacd_model2_bios_2_00w_u.bin", 0x000000, 0x020000, CRC(9f6f6276) SHA1(5adb6c3af218c60868e6b723ec47e36bbdf5e6f0), ROM_BIOS(3) ) +ROM_END + +/* All confirmed good dump by ElBarto */ +ROM_START( megacd2 ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + ROM_SYSTEM_BIOS(0, "v200w", "v2.00W") + ROMX_LOAD( "mpr-15512a.bin", 0x000000, 0x020000, CRC(53f1757c) SHA1(67bf3970ca5a05fd5ce3d6c446789c5d971b98a4), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE ) + ROM_SYSTEM_BIOS(1, "v200", "v2.00") + ROMX_LOAD( "mpr-15512.bin", 0x000000, 0x020000, CRC(cb76f114) SHA1(939f173cadc41e996a3c34498da1bf55e7e18ff8), ROM_BIOS(2) | ROM_GROUPWORD | ROM_REVERSE ) +ROM_END + +/* Confirmed good dump by ElBarto */ +ROM_START( megacd2j ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + ROM_SYSTEM_BIOS(0, "v200c", "v2.00C") + ROMX_LOAD( "mpr-15398.bin", 0x000000, 0x020000, CRC(1e4344e6) SHA1(4d1251a6973d932e734ae5e8c6b9b55eb40e4143), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE ) +ROM_END + +ROM_START( aiwamcd ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + /* v2.11 */ + ROM_LOAD( "mpr-15768-t.bin", 0x000000, 0x020000, CRC(8052c7a0) SHA1(219d284dcf63ce366a4dc6d1ff767a0d2eea283d) ) +ROM_END + +ROM_START( laseract ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + ROM_SYSTEM_BIOS(0, "v104", "v1.04") + ROMX_LOAD( "laseractive_bios_1_04_u.bin", 0x000000, 0x020000, CRC(50cd3d23) SHA1(aa811861f8874775075bd3f53008c8aaf59b07db), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "v102", "v1.02") + ROMX_LOAD( "laseractive_bios_1_02_u.bin", 0x000000, 0x020000, CRC(3b10cf41) SHA1(8af162223bb12fc19b414f126022910372790103), ROM_BIOS(2) ) +ROM_END + +ROM_START( laseractj ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + ROM_SYSTEM_BIOS(0, "v105", "v1.05") + ROMX_LOAD( "mega-ld 1.05 bios.bin", 0x000000, 0x020000, CRC(474aaa44) SHA1(b3b1d880e288b6dc79eec0ff1b0480c229ec141d), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "v102", "v1.02") + ROMX_LOAD( "laseractive_bios_1_02_j.bin", 0x000000, 0x020000, CRC(00eedb3a) SHA1(26237b333db4a4c6770297fa5e655ea95840d5d9), ROM_BIOS(2) ) +ROM_END + +ROM_START( xeye ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + /* v2.00 (US), confirmed good with a chip dump */ + ROM_LOAD( "g304.bin", 0x000000, 0x020000, CRC(290f8e33) SHA1(651f14d5a5e0ecb974a60c0f43b1d2006323fb09) ) +ROM_END + +ROM_START( wmega ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + /* v1.00 (Japan NTSC) Sega BIOS, chip-dumped */ + ROM_LOAD( "g301.bin", 0x000000, 0x020000, CRC(d21fe71d) SHA1(3fc9358072f74bd24e3e297ea11b2bf15a7af891) ) +ROM_END + +ROM_START( wmegam2 ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + /* v2.00 */ + ROM_LOAD( "wondermega_m2_bios_2_00_j.bin", 0x000000, 0x020000, CRC(2b19972f) SHA1(b3f32e409bd5508c89ed8be33d41a58d791d0e5d) ) +ROM_END + +ROM_START( cdx ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + /* v2.21X */ + ROM_LOAD( "segacdx_bios_2_21_u.bin", 0x000000, 0x020000, CRC(d48c44b5) SHA1(2b125c0545afa089b617f2558e686ea723bdc06e) ) +ROM_END + +ROM_START( multmega ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + /* v2.21X */ + ROM_LOAD( "opr-16140.bin", 0x000000, 0x020000, CRC(aacb851e) SHA1(75548ac9aaa6e81224499f9a1403b2b42433f5b7) ) + /* the below was marked "confirmed good dump", but 0x72 and 0x73 are 0xFF, indicating a bad dump made from memory */ + /* ROM_LOAD( "multimega_bios_2_21_e.bin", 0x000000, 0x020000, CRC(34d3cce1) SHA1(73fc9c014ad803e9e7d8076b3642a8a5224b3e51) ) */ +ROM_END + +/* some games use the 32x and SegaCD together to give better quality FMV */ +ROM_START( 32x_scd ) + ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) + + ROM_REGION16_BE( 0x400000, "gamecart", 0 ) /* 68000 Code */ + ROM_LOAD( "mpr-15764-t.bin", 0x000000, 0x020000, CRC(2e49d72c) SHA1(328a3228c29fba244b9db2055adc1ec4f7a87e6b) ) + + ROM_REGION32_BE( 0x400000, "gamecart_sh2", 0 ) /* Copy for the SH2 */ + ROM_COPY( "gamecart", 0x0, 0x0, 0x400000) + + ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */ + ROM_LOAD( "32x_g_bios.bin", 0x000000, 0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) ) + + ROM_REGION32_BE( 0x400000, "master", 0 ) /* SH2 Code */ + ROM_LOAD( "32x_m_bios.bin", 0x000000, 0x000800, CRC(dd9c46b8) SHA1(1e5b0b2441a4979b6966d942b20cc76c413b8c5e) ) + + ROM_REGION32_BE( 0x400000, "slave", 0 ) /* SH2 Code */ + ROM_LOAD( "32x_s_bios.bin", 0x000000, 0x000400, CRC(bfda1fe5) SHA1(4103668c1bbd66c5e24558e73d4f3f92061a109a) ) +ROM_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1989, genesis, 0, 0, ms_megadriv, md, md_cons_state, genesis, "Sega", "Genesis (USA, NTSC)", MACHINE_SUPPORTS_SAVE ) +CONS( 1990, megadriv, genesis, 0, ms_megadpal, md, md_cons_state, md_eur, "Sega", "Mega Drive (Europe, PAL)", MACHINE_SUPPORTS_SAVE ) +CONS( 1988, megadrij, genesis, 0, ms_megadriv, md, md_cons_state, md_jpn, "Sega", "Mega Drive (Japan, NTSC)", MACHINE_SUPPORTS_SAVE ) + +// the 32X plugged in the cart slot, games plugged into the 32x. Maybe it should be handled as an expansion device? +CONS( 1994, 32x, 0, 0, genesis_32x, md, md_cons_state, genesis, "Sega", "Genesis with 32X (USA, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1994, 32xe, 32x, 0, md_32x, md, md_cons_state, md_eur, "Sega", "Mega Drive with 32X (Europe, PAL)", MACHINE_NOT_WORKING ) +CONS( 1994, 32xj, 32x, 0, mdj_32x, md, md_cons_state, md_jpn, "Sega", "Mega Drive with 32X (Japan, NTSC)", MACHINE_NOT_WORKING ) + +// the SegaCD plugged into the expansion port.. +CONS( 1992, segacd, 0, 0, genesis_scd, md, md_cons_state, genesis, "Sega", "Sega CD (USA, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1993, megacd, segacd, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Mega-CD (Europe, PAL)", MACHINE_NOT_WORKING ) +CONS( 1991, megacdj, segacd, 0, mdj_scd, md, md_cons_state, md_jpn, "Sega", "Mega-CD (Japan, NTSC)", MACHINE_NOT_WORKING ) // this bios doesn't work with our ram interleave needed by a few games?! +CONS( 1991, megacda, segacd, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Mega-CD (Asia, PAL)", MACHINE_NOT_WORKING ) +CONS( 1993, segacd2, 0, 0, genesis_scd, md, md_cons_state, genesis, "Sega", "Sega CD 2 (USA, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1993, megacd2, segacd2, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Mega-CD 2 (Europe, PAL)", MACHINE_NOT_WORKING ) +CONS( 1993, megacd2j, segacd2, 0, mdj_scd, md, md_cons_state, md_jpn, "Sega", "Mega-CD 2 (Japan, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1994, aiwamcd, segacd2, 0, mdj_scd, md, md_cons_state, md_jpn, "AIWA", "Mega-CD CSD-G1M (Japan, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1993, laseract, 0, 0, genesis_scd, md, md_cons_state, genesis, "Pioneer","LaserActive (USA, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1993, laseractj, laseract, 0, mdj_scd, md, md_cons_state, md_jpn, "Pioneer","LaserActive (Japan, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1993, xeye, 0, 0, genesis_scd, md, md_cons_state, genesis, "JVC", "X'eye (USA, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1992, wmega, xeye, 0, mdj_scd, md, md_cons_state, md_jpn, "Sega", "Wondermega (Japan, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1993, wmegam2, xeye, 0, mdj_scd, md, md_cons_state, md_jpn, "Victor", "Wondermega M2 (Japan, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1994, cdx, 0, 0, genesis_scd, md, md_cons_state, genesis, "Sega", "CDX (USA, NTSC)", MACHINE_NOT_WORKING ) +CONS( 1994, multmega, cdx, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Multi-Mega (Europe, PAL)", MACHINE_NOT_WORKING ) +CONS( 1994, 32x_scd, 0, 0, genesis_32x_scd, md, md_cons_state, genesis, "Sega", "Sega CD (USA, NTSC, w/32X)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/mekd2.c b/src/mame/drivers/mekd2.c new file mode 100644 index 00000000000..8bac598dea0 --- /dev/null +++ b/src/mame/drivers/mekd2.c @@ -0,0 +1,426 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Robbbert +/****************************************************************************** + Motorola Evaluation Kit 6800 D2 + MEK6800D2 + + system driver + + Juergen Buchmueller, Jan 2000 + 2013-06-16 Working driver [Robbbert] + + memory map + + range short description + 0000-00ff RAM 256 bytes RAM + 0100-01ff RAM optional 256 bytes RAM + 6000-63ff PROM optional PROM + or + 6000-67ff ROM optional ROM + 8004-8007 PIA expansion port + 8008-8009 ACIA cassette interface + 8020-8023 PIA keyboard interface + a000-a07f RAM 128 bytes RAM (JBUG scratch) + c000-c3ff PROM optional PROM + or + c000-c7ff ROM optional ROM + e000-e3ff ROM JBUG monitor program + e400-ffff -/- mirrors of monitor rom + + +Enter the 4 digit address then the command key: + + - M : Examine and Change Memory (example: E000M, then G to skip to next, ESC to exit) + - E : Escape (abort) operation (ESC key in our emulation) + - R : Examine Registers + - G : Begin execution at specified address + - P : Punch data from memory to magnetic tape + - L : Load memory from magnetic tape + - N : Trace one instruction + - V : Set (and remove) breakpoints + +The keys are laid out as: + + P L N V + + 7 8 9 A M + 4 5 6 B E + 1 2 3 C R + 0 F E D G + + +Pasting: + 0-F : as is + NEXT : ^ + MEM : = + GO : ^ + +Test Paste: + HA030=11^22^33^44^55^66^77^88^99^HA030= + Now press up-arrow to confirm the data has been entered. + + If you wish to follow the tutorial in the manual, here is the test + program that you need to enter in step 1: + H0020=8E^00^FF^4F^C6^04^CE^00^10^AB^00^08^5A^26^FA^97^15^3F^H + + Save the above program to tape: + HA002=00^20^00^32^HP (A002 has start address, A004 has end address, big endian) + +TODO + Display should go blank during cassette operations + + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "machine/6821pia.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "sound/wave.h" +#include "mekd2.lh" + +#define XTAL_MEKD2 1228800 + +class mekd2_state : public driver_device +{ +public: + enum + { + TIMER_TRACE + }; + + mekd2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pia_s(*this, "pia_s"), + m_pia_u(*this, "pia_u"), + m_acia(*this, "acia"), + m_cass(*this, "cassette") + { } + + DECLARE_READ_LINE_MEMBER(mekd2_key40_r); + DECLARE_READ8_MEMBER(mekd2_key_r); + DECLARE_WRITE_LINE_MEMBER(mekd2_nmi_w); + DECLARE_WRITE8_MEMBER(mekd2_digit_w); + DECLARE_WRITE8_MEMBER(mekd2_segment_w); + DECLARE_QUICKLOAD_LOAD_MEMBER(mekd2_quik); + DECLARE_WRITE_LINE_MEMBER(cass_w); + TIMER_DEVICE_CALLBACK_MEMBER(mekd2_c); + TIMER_DEVICE_CALLBACK_MEMBER(mekd2_p); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + UINT8 m_cass_data[4]; + UINT8 m_segment; + UINT8 m_digit; + UINT8 m_keydata; + bool m_cass_state; + bool m_cassold; + required_device m_maincpu; + required_device m_pia_s; + required_device m_pia_u; + required_device m_acia; + required_device m_cass; +}; + + + +/*********************************************************** + + Address Map + +************************************************************/ + +static ADDRESS_MAP_START( mekd2_mem , AS_PROGRAM, 8, mekd2_state) + AM_RANGE(0x0000, 0x00ff) AM_RAM // user ram + AM_RANGE(0x8004, 0x8007) AM_DEVREADWRITE("pia_u", pia6821_device, read, write) + AM_RANGE(0x8008, 0x8008) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) + AM_RANGE(0x8009, 0x8009) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) + AM_RANGE(0x8020, 0x8023) AM_DEVREADWRITE("pia_s", pia6821_device, read, write) + AM_RANGE(0xa000, 0xa07f) AM_RAM // system ram + AM_RANGE(0xe000, 0xe3ff) AM_ROM AM_MIRROR(0x1c00) /* JBUG ROM */ +ADDRESS_MAP_END + +/*********************************************************** + + Keys + +************************************************************/ + +static INPUT_PORTS_START( mekd2 ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E (hex)") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') // save tape + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') // load tape + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') // trace (step) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') // breakpoint + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('=') // memory + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E (escape)") PORT_CODE(KEYCODE_ESC) PORT_CHAR('H') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') // regs + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') // go, next +INPUT_PORTS_END + + +/*********************************************************** + + Trace hardware (what happens when N is pressed) + +************************************************************/ + +void mekd2_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_TRACE: + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + break; + default: + assert_always(FALSE, "Unknown id in mekd2_state::device_timer"); + } +} + + +WRITE_LINE_MEMBER( mekd2_state::mekd2_nmi_w ) +{ + if (state) + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + else + timer_set(attotime::from_usec(18), TIMER_TRACE); +} + + + +/*********************************************************** + + Keyboard + +************************************************************/ + +READ_LINE_MEMBER( mekd2_state::mekd2_key40_r ) +{ + return BIT(m_keydata, 6); +} + +READ8_MEMBER( mekd2_state::mekd2_key_r ) +{ + char kbdrow[4]; + UINT8 i; + m_keydata = 0xff; + + for (i = 0; i < 6; i++) + { + if (BIT(m_digit, i)) + { + sprintf(kbdrow,"X%d",i); + m_keydata &= ioport(kbdrow)->read(); + } + } + + i = 0x80; + if (m_digit < 0x40) + i = BIT(m_keydata, 0) ? 0x80 : 0; + else + if (m_digit < 0x80) + i = BIT(m_keydata, 1) ? 0x80 : 0; + else + if (m_digit < 0xc0) + i = BIT(m_keydata, 2) ? 0x80 : 0; + else + i = BIT(m_keydata, 3) ? 0x80 : 0; + + return i | m_segment; +} + + + +/*********************************************************** + + LED display + +************************************************************/ + +WRITE8_MEMBER( mekd2_state::mekd2_segment_w ) +{ + m_segment = data & 0x7f; +} + +WRITE8_MEMBER( mekd2_state::mekd2_digit_w ) +{ + UINT8 i; + if (data < 0x3f) + { + for (i = 0; i < 6; i++) + { + if (BIT(data, i)) + output_set_digit_value(i, ~m_segment & 0x7f); + } + } + m_digit = data; +} + + + +/*********************************************************** + + Interfaces + +************************************************************/ + +WRITE_LINE_MEMBER( mekd2_state::cass_w ) +{ + m_cass_state = state; +} + +QUICKLOAD_LOAD_MEMBER( mekd2_state, mekd2_quik ) +{ + static const char magic[] = "MEK6800D2"; + char buff[9]; + UINT16 addr, size; + UINT8 ident, *RAM = memregion("maincpu")->base(); + + image.fread(buff, sizeof (buff)); + if (memcmp(buff, magic, sizeof (buff))) + { + logerror("mekd2 rom load: magic '%s' not found\n", magic); + return IMAGE_INIT_FAIL; + } + image.fread(&addr, 2); + addr = LITTLE_ENDIANIZE_INT16(addr); + image.fread(&size, 2); + size = LITTLE_ENDIANIZE_INT16(size); + image.fread(&ident, 1); + logerror("mekd2 rom load: $%04X $%04X $%02X\n", addr, size, ident); + while (size-- > 0) + image.fread(&RAM[addr++], 1); + + return IMAGE_INIT_PASS; +} + +TIMER_DEVICE_CALLBACK_MEMBER(mekd2_state::mekd2_c) +{ + m_cass_data[3]++; + + if (m_cass_state != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +TIMER_DEVICE_CALLBACK_MEMBER(mekd2_state::mekd2_p) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_acia->write_rxd((m_cass_data[1] < 12) ? 1 : 0); + m_cass_data[1] = 0; + } +} + +/*********************************************************** + + Machine + +************************************************************/ + +static MACHINE_CONFIG_START( mekd2, mekd2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6800, XTAL_MEKD2 / 2) /* 614.4 kHz */ + MCFG_CPU_PROGRAM_MAP(mekd2_mem) + + MCFG_DEFAULT_LAYOUT(layout_mekd2) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD("cassette") + + /* Devices */ + MCFG_DEVICE_ADD("pia_s", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(mekd2_state, mekd2_key_r)) + MCFG_PIA_READCB1_HANDLER(READLINE(mekd2_state, mekd2_key40_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(mekd2_state, mekd2_segment_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(mekd2_state, mekd2_digit_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(mekd2_state, mekd2_nmi_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, nmi_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, nmi_line)) + + MCFG_DEVICE_ADD("pia_u", PIA6821, 0) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) + + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(mekd2_state, cass_w)) + + MCFG_DEVICE_ADD("acia_tx_clock", CLOCK, XTAL_MEKD2 / 256) // 4800Hz + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("acia", acia6850_device, write_txc)) + + MCFG_DEVICE_ADD("acia_rx_clock", CLOCK, 300) // toggled by cassette circuit + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxc)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("mekd2_c", mekd2_state, mekd2_c, attotime::from_hz(4800)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("mekd2_p", mekd2_state, mekd2_p, attotime::from_hz(40000)) + + MCFG_QUICKLOAD_ADD("quickload", mekd2_state, mekd2_quik, "d2", 1) +MACHINE_CONFIG_END + +/*********************************************************** + + ROMS + +************************************************************/ + +ROM_START(mekd2) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("jbug.rom", 0xe000, 0x0400, CRC(5ed08792) SHA1(b06e74652a4c4e67c4a12ddc191ffb8c07f3332e) ) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, mekd2, 0, 0, mekd2, mekd2, driver_device, 0, "Motorola", "MEK6800D2" , 0 ) diff --git a/src/mame/drivers/mephisto.c b/src/mame/drivers/mephisto.c new file mode 100644 index 00000000000..faf3cd69797 --- /dev/null +++ b/src/mame/drivers/mephisto.c @@ -0,0 +1,470 @@ +// license:LGPL-2.1+ +// copyright-holders:Dirk Verwiebe, Cowering +/****************************************************************************** + Mephisto 4 + 5 Chess Computer + 2007 Dirk V. + +CPU 65C02 P4 +Clock 4.9152 MHz +NMI CLK 600 Hz +IRQ Line is set to VSS +8 KByte SRAM Sony CXK5864-15l + +1-CD74HC4060E 14 Bit Counter +1-CD74HC166E +1-CD74HC251E +1-SN74HC138N TI +1-SN74HC139N TI +1-74HC14AP Toshiba +1-74HC02AP Toshiba +1-74HC00AP Toshiba +1-CD74HC259E + + +$0000-$1fff S-RAM +$2000 LCD 4 Byte Shift Register writeonly right to left +every 2nd char xor'd by $FF + +2c00-2c07 Keyboard (8to1 Multiplexer) 74HCT251 +2*8 Matrix +Adr. 0x3407 +==0 !=0 +2c00 CL E5 +2c01 POS F6 +2c02 MEMO G7 +2c03 INFO A1 +2c04 LEV H8 +2c05 ENT B2 +2c06 >0 C3 +2c07 <9 D4 + +$3400-$3407 LED 1-6, Buzzer, Keyboard select + +$2400 // Chess Board +$2800 // Chess Board +$3000 // Chess Board + +$4000-7FFF Opening Modul HG550 +$8000-$FFF ROM + +Mephisto 4 Turbo Kit 18mhz - (mm4tk) + This is a replacement rom combining the turbo kit initial rom with the original MM IV. + The Turbo Kit powers up to it's tiny rom, copies itself to ram, banks in normal rom, + copies that to faster SRAM, then patches the checksum and the LED blink delays. + If someone else wants to code up the power up banking, feel free + + There is an undumped MM V Turbo Kit, which will be the exact same except for location of + the patches. The mm5tk just needs the normal mm5 ROM swapped out for that one to + blinks the LEDs a little slower. + + -- Cowering (2011) + +***********************************************************************************************/ + + +#include "emu.h" +#include "cpu/m6502/m65c02.h" +#include "sound/beep.h" +//#include "mephisto.lh" + +#include "includes/mboard.h" + + +class mephisto_state : public mboard_state +{ +public: + mephisto_state(const machine_config &mconfig, device_type type, const char *tag) + : mboard_state(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_beep(*this, "beeper") + , m_key1_0(*this, "KEY1_0") + , m_key1_1(*this, "KEY1_1") + , m_key1_2(*this, "KEY1_2") + , m_key1_3(*this, "KEY1_3") + , m_key1_4(*this, "KEY1_4") + , m_key1_5(*this, "KEY1_5") + , m_key1_6(*this, "KEY1_6") + , m_key1_7(*this, "KEY1_7") + , m_key2_0(*this, "KEY2_0") + , m_key2_1(*this, "KEY2_1") + , m_key2_2(*this, "KEY2_2") + , m_key2_3(*this, "KEY2_3") + , m_key2_4(*this, "KEY2_4") + , m_key2_5(*this, "KEY2_5") + , m_key2_6(*this, "KEY2_6") + , m_key2_7(*this, "KEY2_7") + { } + + required_device m_maincpu; + required_device m_beep; + DECLARE_WRITE8_MEMBER(write_lcd); + DECLARE_WRITE8_MEMBER(mephisto_NMI); + DECLARE_READ8_MEMBER(read_keys); + DECLARE_WRITE8_MEMBER(write_led); + DECLARE_WRITE8_MEMBER(write_led_mm2); + UINT8 m_lcd_shift_counter; + UINT8 m_led_status; + //UINT8 *m_p_ram; + UINT8 m_led7; + UINT8 m_allowNMI; + DECLARE_DRIVER_INIT(mephisto); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_MACHINE_START(mm2); + TIMER_DEVICE_CALLBACK_MEMBER(update_nmi); + TIMER_DEVICE_CALLBACK_MEMBER(update_nmi_r5); + TIMER_DEVICE_CALLBACK_MEMBER(update_irq); + +protected: + required_ioport m_key1_0; + required_ioport m_key1_1; + required_ioport m_key1_2; + required_ioport m_key1_3; + required_ioport m_key1_4; + required_ioport m_key1_5; + required_ioport m_key1_6; + required_ioport m_key1_7; + required_ioport m_key2_0; + required_ioport m_key2_1; + required_ioport m_key2_2; + required_ioport m_key2_3; + required_ioport m_key2_4; + required_ioport m_key2_5; + required_ioport m_key2_6; + required_ioport m_key2_7; +}; + + +WRITE8_MEMBER( mephisto_state::write_lcd ) +{ + if (m_led7 == 0) output_set_digit_value(m_lcd_shift_counter,data); // 0x109 MM IV // 0x040 MM V + + //output_set_digit_value(m_lcd_shift_counter,data ^ m_p_ram[0x165]); // 0x109 MM IV // 0x040 MM V + m_lcd_shift_counter--; + m_lcd_shift_counter &= 3; +} + +WRITE8_MEMBER( mephisto_state::mephisto_NMI ) +{ + m_allowNMI = 1; +} + +READ8_MEMBER( mephisto_state::read_keys ) +{ + UINT8 data = 0; + + if (((m_led_status & 0x80) == 0x00)) + { + switch ( offset ) + { + case 0: data = m_key1_0->read(); break; + case 1: data = m_key1_1->read(); break; + case 2: data = m_key1_2->read(); break; + case 3: data = m_key1_3->read(); break; + case 4: data = m_key1_4->read(); break; + case 5: data = m_key1_5->read(); break; + case 6: data = m_key1_6->read(); break; + case 7: data = m_key1_7->read(); break; + } + } + else + { + switch ( offset ) + { + case 0: data = m_key2_0->read(); break; + case 1: data = m_key2_1->read(); break; + case 2: data = m_key2_2->read(); break; + case 3: data = m_key2_3->read(); break; + case 4: data = m_key2_4->read(); break; + case 5: data = m_key2_5->read(); break; + case 6: data = m_key2_6->read(); break; + case 7: data = m_key2_7->read(); break; + } + } + + logerror("Keyboard Port = %d-%d Data = %d\n ", ((m_led_status & 0x80) == 0x00) ? 0 : 1, offset, data); + return data | 0x7f; +} + +WRITE8_MEMBER( mephisto_state::write_led ) +{ + UINT8 LED_offset=100; + data &= 0x80; + + if (data==0)m_led_status &= 255-(1<set_input_line(INPUT_LINE_NMI,PULSE_LINE); + } + m_beep->set_state(m_led_status&64?1:0); +} + +TIMER_DEVICE_CALLBACK_MEMBER(mephisto_state::update_nmi_r5) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); + m_beep->set_state(m_led_status&64?1:0); +} + +TIMER_DEVICE_CALLBACK_MEMBER(mephisto_state::update_irq)//only mm2 +{ + m_maincpu->set_input_line(M65C02_IRQ_LINE, HOLD_LINE); + + m_beep->set_state(m_led_status&64?1:0); +} + +void mephisto_state::machine_start() +{ + m_lcd_shift_counter = 3; + m_allowNMI = 1; + mboard_savestate_register(); +} + +MACHINE_START_MEMBER(mephisto_state,mm2) +{ + m_lcd_shift_counter = 3; + m_led7=0xff; + + mboard_savestate_register(); +} + + +void mephisto_state::machine_reset() +{ + m_lcd_shift_counter = 3; + m_allowNMI = 1; + mboard_set_border_pieces(); + mboard_set_board(); + +/* adjust artwork depending on current emulation*/ + + if (!strcmp(machine().system().name,"mm2") ) + output_set_value("MM",1); + else if (!strcmp(machine().system().name,"mm4") ) + output_set_value("MM",2); + else if (!strcmp(machine().system().name,"mm4tk") ) + output_set_value("MM",5); + else if (!strcmp(machine().system().name,"mm5tk") ) + output_set_value("MM",5); + else if (!strcmp(machine().system().name,"mm5") ) + output_set_value("MM",3); + else if (!strcmp(machine().system().name,"mm50") ) + output_set_value("MM",3); + else if (!strcmp(machine().system().name,"rebel5") ) + output_set_value("MM",4); +} + + +static MACHINE_CONFIG_START( mephisto, mephisto_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M65C02,4915200) /* 65C02 */ + MCFG_CPU_PROGRAM_MAP(mephisto_mem) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", mephisto_state, update_nmi, attotime::from_hz(600)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", mephisto_state, mboard_update_artwork, attotime::from_hz(100)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( rebel5, mephisto ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(rebel5_mem) + MCFG_DEVICE_REMOVE("nmi_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer_r5", mephisto_state, update_nmi_r5, attotime::from_hz(600)) + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mm2, mephisto ) + MCFG_CPU_REPLACE("maincpu", M65C02, 3700000) + MCFG_CPU_PROGRAM_MAP(mm2_mem) + MCFG_MACHINE_START_OVERRIDE(mephisto_state, mm2 ) + + MCFG_DEVICE_REMOVE("nmi_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", mephisto_state, update_irq, attotime::from_hz(450)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mm4tk, mephisto ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_REPLACE("maincpu", M65C02, 18000000) + MCFG_CPU_PROGRAM_MAP(mephisto_mem) +MACHINE_CONFIG_END + +ROM_START(rebel5) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("rebel5.rom", 0x8000, 0x8000, CRC(8d02e1ef) SHA1(9972c75936613bd68cfd3fe62bd222e90e8b1083)) +ROM_END + +ROM_START(mm2) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("mm2_1.bin", 0x8000, 0x4000, CRC(e2daac82) SHA1(c9fa59ca92362f8ee770733073bfa2ab8c7904ad)) + ROM_LOAD("mm2_2.bin", 0xc000, 0x4000, CRC(5e296939) SHA1(badd2a377259cf738cd076d8fb245c3dc284c24d)) +ROM_END + +ROM_START(mm4) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("mephisto4.rom", 0x8000, 0x8000, CRC(f68a4124) SHA1(d1d03a9aacc291d5cb720d2ee2a209eeba13a36c)) + ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) + ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" ) + ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(2)) +ROM_END + +ROM_START(mm4tk) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("mm4tk.rom", 0x8000, 0x8000, CRC(51cb36a4) SHA1(9e184b4e85bb721e794b88d8657ae8d2ff5a24af)) + ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) + ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" ) + ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(0)) +ROM_END + +ROM_START(mm5tk) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, BAD_DUMP CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048)) + ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) + ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) + ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(0)) +ROM_END + +ROM_START(mm5) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048)) + ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) + ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) + ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2)) +ROM_END + +ROM_START(mm50) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("mm50.rom", 0x8000, 0x8000, CRC(fcfa7e6e) SHA1(afeac3a8c957ba58cefaa27b11df974f6f2066da)) + ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) + ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) + ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2)) +ROM_END + + +DRIVER_INIT_MEMBER(mephisto_state,mephisto) +{ + m_lcd_shift_counter = 3; +} + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ + +CONS( 1984, mm2, mm4, 0, mm2, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto MM2 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1986, rebel5, mm4, 0, rebel5, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto Rebell 5,0 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1987, mm4, 0, 0, mephisto, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 4 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1987, mm4tk, mm4, 0, mm4tk, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 4 Schachcomputer Turbo Kit + HG440", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1990, mm5, mm4, 0, mephisto, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 5.1 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1990, mm50, mm4, 0, mephisto, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 5.0 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1990, mm5tk, mm4, 0, mm4tk, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 5.1 Schachcomputer Turbo Kit + HG550", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/mes.c b/src/mame/drivers/mes.c new file mode 100644 index 00000000000..80e710ee471 --- /dev/null +++ b/src/mame/drivers/mes.c @@ -0,0 +1,141 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Schleicher MES + + 30/08/2010 Skeleton driver + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + + +class mes_state : public driver_device +{ +public: + mes_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_p_videoram(*this, "p_videoram"){ } + + required_device m_maincpu; + const UINT8 *m_p_chargen; + required_shared_ptr m_p_videoram; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + + +static ADDRESS_MAP_START(mes_mem, AS_PROGRAM, 8, mes_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("p_videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mes_io, AS_IO, 8, mes_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mes ) +INPUT_PORTS_END + +void mes_state::machine_reset() +{ +} + +void mes_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +/* This system appears to have 2 screens. Not implemented. + Also the screen dimensions are a guess. */ +UINT32 mes_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + //static UINT8 framecnt=0; + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x,xx; + + //framecnt++; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + xx = ma; + for (x = ma; x < ma + 80; x++) + { + gfx = 0; + if (ra < 9) + { + chr = m_p_videoram[xx++]; + + // /* Take care of flashing characters */ + // if ((chr < 0x80) && (framecnt & 0x08)) + // chr |= 0x80; + + if (chr & 0x80) // ignore attribute bytes + x--; + else + gfx = m_p_chargen[(chr<<4) | ra ]; + } + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=80; + } + return 0; +} + +static MACHINE_CONFIG_START( mes, mes_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(mes_mem) + MCFG_CPU_IO_MAP(mes_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(mes_state, screen_update) + MCFG_SCREEN_SIZE(640, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( mes ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mescpu.bin", 0x0000, 0x1000, CRC(b6d90cf4) SHA1(19e608af5bdaabb00a134e1106b151b00e2a0b04)) + + ROM_REGION( 0x10000, "xebec", ROMREGION_ERASEFF ) + ROM_LOAD( "mesxebec.bin", 0x0000, 0x2000, CRC(061b7212) SHA1(c5d600116fb7563c69ebd909eb9613269b2ada0f)) + + /* character generator not dumped, using the one from 'c10' for now */ + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, mes, 0, 0, mes, mes, driver_device, 0, "Schleicher", "MES", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mice.c b/src/mame/drivers/mice.c new file mode 100644 index 00000000000..3e5662dd50d --- /dev/null +++ b/src/mame/drivers/mice.c @@ -0,0 +1,121 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + +Microtek International Inc MICE + +2013-08-27 Skeleton driver. + +This is a CPU emulator for development work. + +Each CPU has a plugin card with various chips. The usual complement is + the selected CPU, a 8085, 8255/8251/8155/6116, eproms and crystals. + +The connection to the outside world is via RS232 to a terminal. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class mice_state : public driver_device +{ +public: + mice_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(port50_r); + DECLARE_READ8_MEMBER(port51_r); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_term_data; + virtual void machine_reset(); +}; + + +READ8_MEMBER( mice_state::port50_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( mice_state::port51_r ) +{ + return (m_term_data) ? 5 : 1; +} + +static ADDRESS_MAP_START(mice_mem, AS_PROGRAM, 8, mice_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x5fff ) AM_ROM AM_REGION("mice_6502", 0) + AM_RANGE( 0x6000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mice_io, AS_IO, 8, mice_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x50, 0x50) AM_READ(port50_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x51, 0x51) AM_READ(port51_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mice ) +INPUT_PORTS_END + + +void mice_state::machine_reset() +{ +} + +WRITE8_MEMBER( mice_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( mice, mice_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8085A, XTAL_6_144MHz) + MCFG_CPU_PROGRAM_MAP(mice_mem) + MCFG_CPU_IO_MAP(mice_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mice_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mice ) + ROM_REGION( 0x10000, "mice2_z80b", 0 ) + ROM_LOAD( "z80_u2_v.3.0", 0x4000, 0x2000, CRC(992b1b53) SHA1(f7b66c49ab26a9f97b2e6ebe45d162daa66d8a67) ) + ROM_LOAD( "z80_u3_v.3.0", 0x2000, 0x2000, CRC(48d0be9b) SHA1(602af21868b1b5e6d488706a831259d78fefad6f) ) + ROM_LOAD( "z80_u4_v.3.0", 0x0000, 0x2000, CRC(4fe2d08d) SHA1(902b98357b8f2e61f68dd171478368a3ac47af6e) ) + ROM_REGION( 0x10000, "mice2_6502", 0 ) + ROM_LOAD( "6502_u1_v.3.2", 0x6000, 0x2000, CRC(0ba10943) SHA1(e7590e2c1d9d2b1ff8cca0f5da366650ea4d50e3) ) + ROM_LOAD( "6502_u2_v.3.2", 0x4000, 0x2000, CRC(f3169423) SHA1(a588a2e1894f523cf11c34d036beadbfe5b10538) ) + ROM_LOAD( "6502_u3_v.3.2", 0x2000, 0x2000, CRC(d5c77c3f) SHA1(71439735ed62db07bee713775ee2189120d1a1e7) ) + ROM_LOAD( "6502_u4_v.3.2", 0x0000, 0x2000, CRC(6acfc3a1) SHA1(3572a4798873c21a247a43da8419e7b9a181c67d) ) + ROM_REGION( 0x10000, "mice2_8085", 0 ) + ROM_LOAD( "8085_u2_v.3.1", 0x4000, 0x2000, CRC(2fce00a5) SHA1(0611f928be663a9279781d9f496fc950fd4ee7e2) ) + ROM_LOAD( "8085_u3_v.3.1", 0x2000, 0x2000, CRC(16ee3018) SHA1(9e215504bcea2c5ebfb7578ecf371eec45cbe5d7) ) + ROM_LOAD( "8085_u4_v.3.1", 0x0000, 0x2000, CRC(5798f2b5) SHA1(e0fe9411394bded8a77bc6a0f71519aad7800125) ) + ROM_REGION( 0x10000, "mice2_6809", 0 ) + ROM_LOAD( "6809_u1_v.3.4", 0x0000, 0x8000, CRC(b94d043d) SHA1(822697485f064286155f2a66cdbdcb0bd66ddb8c) ) + ROM_REGION( 0x10000, "mice_6502", 0 ) + ROM_LOAD( "6502_u10_v.2.0", 0x2000, 0x1000, CRC(496c53a7) SHA1(f28cddef18ab3e0eca1fea125dd678a54817c9df) ) + ROM_LOAD( "6502_u11_v.2.0", 0x1000, 0x1000, CRC(8d655bd2) SHA1(94936553f1692ede0934e3c7b599f3ad6adb6aec) ) + ROM_LOAD( "6502_u12_v.2.0", 0x0000, 0x1000, CRC(cee810ee) SHA1(ab642cda73f4b3f715ddc2909ba2b48cbd474d4d) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, mice, 0, 0, mice, mice, driver_device, 0, "Microtek International Inc", "Mice", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/microdec.c b/src/mame/drivers/microdec.c new file mode 100644 index 00000000000..8f2494087da --- /dev/null +++ b/src/mame/drivers/microdec.c @@ -0,0 +1,142 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Morrow Designs Micro Decision + + 2009-12-10 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/upd765.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class microdec_state : public driver_device +{ +public: + microdec_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_terminal(*this, TERMINAL_TAG), + m_maincpu(*this, "maincpu") + { + } + + DECLARE_READ8_MEMBER(status_r); + DECLARE_READ8_MEMBER(keyin_r); + DECLARE_WRITE8_MEMBER(kbd_put); +private: + UINT8 m_term_data; + virtual void machine_reset(); + virtual void machine_start(); + required_device m_terminal; + required_device m_maincpu; +}; + + +READ8_MEMBER( microdec_state::status_r ) +{ + return (m_term_data) ? 3 : 1; +} + +READ8_MEMBER( microdec_state::keyin_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +static ADDRESS_MAP_START(microdec_mem, AS_PROGRAM, 8, microdec_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_ROM + AM_RANGE( 0x1000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(microdec_io, AS_IO, 8, microdec_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xfa, 0xfb) AM_DEVICE("upd765", upd765a_device, map) + AM_RANGE(0xfc, 0xfc) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0xfd, 0xfd) AM_READ(status_r) + // AM_RANGE(0xf0, 0xf3) 8253 PIT (md3 only) used as a baud rate generator for serial ports + // AM_RANGE(0xf4, 0xf4) Centronics data + // AM_RANGE(0xf5, 0xf5) motor check (md1/2) + // AM_RANGE(0xf5, 0xf5) Centronics status (md3) read bit 3 (ack=1); read bit 4 (busy=1); write bit 7 (stb=0) + // AM_RANGE(0xf6, 0xf6) rom enable (w=enable; r=disable) + // AM_RANGE(0xf7, 0xf7) VFO Count set + // AM_RANGE(0xf8, 0xf8) Motor and SHift control + // AM_RANGE(0xfa, 0xfb) uPD765C fdc FA=status; FB=data + // AM_RANGE(0xfc, 0xfd) Serial Port 1 FC=data FD=status + // AM_RANGE(0xfe, 0xff) Serial Port 2 FE=data FF=status +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( microdec ) +INPUT_PORTS_END + +void microdec_state::machine_start() +{ +} + +void microdec_state::machine_reset() +{ + m_term_data = 0; +} + +WRITE8_MEMBER( microdec_state::kbd_put ) +{ + m_term_data = data; +} + +static SLOT_INTERFACE_START( microdec_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( microdec, microdec_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(microdec_mem) + MCFG_CPU_IO_MAP(microdec_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(microdec_state, kbd_put)) + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", microdec_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", microdec_floppies, "525hd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( md2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v13", "v1.3" ) + ROMX_LOAD( "md2-13.bin", 0x0000, 0x0800, CRC(43f4c9ab) SHA1(48a35cbee4f341310e9cba5178c3fd6e74ef9748), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v13a", "v1.3a" ) + ROMX_LOAD( "md2-13a.bin", 0x0000, 0x0800, CRC(d7fcddfd) SHA1(cae29232b737ebb36a27b8ad17bc69e9968f1309), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v13b", "v1.3b" ) + ROMX_LOAD( "md2-13b.bin", 0x0000, 0x1000, CRC(a8b96835) SHA1(c6b111939aa7e725da507da1915604656540b24e), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "v20", "v2.0" ) + ROMX_LOAD( "md2-20.bin", 0x0000, 0x1000, CRC(a604735c) SHA1(db6e6e82a803f5cbf4f628f5778a93ae3e211fe1), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "v23", "v2.3" ) + ROMX_LOAD( "md2-23.bin", 0x0000, 0x1000, CRC(49bae273) SHA1(00381a226fe250aa3636b0b740df0af63efb0d18), ROM_BIOS(5)) +ROM_END + +ROM_START( md3 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v23a", "v2.3a" ) + ROMX_LOAD( "md3-23a.bin", 0x0000, 0x1000, CRC(95d59980) SHA1(ae65a8e8e2823cf4cf6b1d74c0996248e290e9f1), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v25", "v2.5" ) + ROMX_LOAD( "md3-25.bin", 0x0000, 0x1000, CRC(14f86bc5) SHA1(82fe022c85f678744bb0340ca3f88b18901fdfcb), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v31", "v3.1" ) + ROMX_LOAD( "md3-31.bin", 0x0000, 0x1000, CRC(bd4014f6) SHA1(5b33220af34c64676756177db4915f97840b2996), ROM_BIOS(3)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, md2, 0, 0, microdec, microdec, driver_device, 0, "Morrow Designs", "Micro Decision MD-2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1982, md3, md2, 0, microdec, microdec, driver_device, 0, "Morrow Designs", "Micro Decision MD-3", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/microkit.c b/src/mame/drivers/microkit.c new file mode 100644 index 00000000000..9082931f21f --- /dev/null +++ b/src/mame/drivers/microkit.c @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + RCA COSMAC Microkit + + http://www.vintagecomputer.net/browse_thread.cfm?id=511 + +*/ + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" + +class microkit_state : public driver_device +{ +public: + microkit_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + { } +}; + +static ADDRESS_MAP_START( microkit_mem, AS_PROGRAM, 8, microkit_state ) + AM_RANGE(0x0000, 0x01ff) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( microkit_io, AS_IO, 8, microkit_state ) +ADDRESS_MAP_END + +static INPUT_PORTS_START( microkit ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( microkit, microkit_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", CDP1801, 2000000) + MCFG_CPU_PROGRAM_MAP(microkit_mem) + MCFG_CPU_IO_MAP(microkit_io) + MCFG_COSMAC_WAIT_CALLBACK(VCC) +MACHINE_CONFIG_END + +ROM_START( microkit ) + ROM_REGION( 0x200, "maincpu", ROMREGION_INVERT ) + ROM_LOAD( "3.2b", 0x000, 0x100, CRC(6799357e) SHA1(c46e3322b8b1b6534a7da04806be29fa265951b7) ) + ROM_LOAD( "4.2a", 0x100, 0x100, CRC(27267bad) SHA1(838df9be2dc175584a1a6ee1770039118e49482e) ) +ROM_END + +COMP( 1975, microkit, 0, 0, microkit, microkit, driver_device, 0, "RCA", "COSMAC Microkit", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/micronic.c b/src/mame/drivers/micronic.c new file mode 100644 index 00000000000..90a898854ef --- /dev/null +++ b/src/mame/drivers/micronic.c @@ -0,0 +1,399 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Micronics 1000 + + 06/2010 (Sandro Ronco) + - ROM/RAM banking + - keypad input + - Periodic IRQ (RTC-146818) + - NVRAM + + TODO: + - IR I/O port + - LCD contrast and backlight + + NOTE: + The display shows "TESTING..." for about 2 min before showing the information screen + + More info: + http://www.philpem.me.uk/elec/micronic/ + http://members.lycos.co.uk/leeedavison/z80/micronic/index.html + http://reocities.com/SiliconValley/Port/8052/ + +****************************************************************************/ + +/* + + KBD_R: EQU 00h ; key matrix read port + KBD_W: EQU 02h ; key matrix write port + LCD_D: EQU 03h ; LCD data port + Port_04: EQU 04h ; IRQ hardware mask + ; .... ...0 = keyboard interrupt enable + ; .... ..0. = RTC interrupt enable + ; .... .0.. = IR port interrupt enable + ; .... 0... = main battery interrupt enable + ; ...0 .... = backup battery interrupt enable + Port_05: EQU 05h ; interrupt flag byte + ; .... ...1 = keyboard interrupt + ; .... ..1. = RTC interrupt + ; .... .1.. = IR port interrupt ?? + ; .... 1... = main battery interrupt + ; ...1 .... = backup battery interrupt + Port_07: EQU 07h ; + ; .... ...x + ; .... ..x. + RTC_A: EQU 08h ; RTC address port + LCD_C: EQU 23h ; LCD command port + RTC_D: EQU 28h ; RTC data port + Port_2A: EQU 2Ah ; + ; .... ...x + ; .... ..x. + ; ...x .... + ; ..x. .... + Port_2B: EQU 2Bh ; .... xxxx = beep tone + ; .... 0000 = off + ; .... 0001 = 0.25mS = 4.000kHz + ; .... 0010 = 0.50mS = 2.000kHz + ; .... 0011 = 0.75mS = 1.333kHz + ; .... 0100 = 1.00mS = 1.000kHz + ; .... 0101 = 1.25mS = 0.800kHz + ; .... 0110 = 1.50mS = 0.667kHz + ; .... 0111 = 1.75mS = 0.571kHz + ; .... 1000 = 2.00mS = 0.500kHz + ; .... 1001 = 2.25mS = 0.444kHz + ; .... 1010 = 2.50mS = 0.400kHz + ; .... 1011 = 2.75mS = 0.364kHz + ; .... 1100 = 3.00mS = 0.333kHz + ; .... 1101 = 3.25mS = 0.308kHz + ; .... 1110 = 3.50mS = 0.286kHz + ; .... 1111 = 3.75mS = 0.267kHz + Port_2C: EQU 2Ch ; + ; .... ...x V24_ADAPTER IR port clock + ; .... ..x. V24_ADAPTER IR port data + ; ...1 .... = backlight on + ; ..xx ..xx + Port_2D: EQU 2Dh ; + ; .... ...x + ; .... ..x. + Port_33: EQU 33h ; + Port_46: EQU 46h ; LCD contrast port + MEM_P: EQU 47h ; memory page + Port_48: EQU 48h ; + ; .... ...x + ; .... ..x. + Port_49: EQU 49h ; + ; .... ...x + ; .... ..x. + Port_4A: EQU 4Ah ; end IR port output + ; .... ...x + ; .... ..x. + ; ...x .... + ; ..x. .... + ; .x.. .... + ; x... .... + Port_4B: EQU 4Bh ; IR port status byte + ; .... ...1 RX buffer full + ; ...x .... + ; .x.. .... + ; 1... .... TX buffer empty + Port_4C: EQU 4Ch ; + ; .... ...x + ; x... .... + Port_4D: EQU 4Dh ; IR transmit byte + Port_4E: EQU 4Eh ; IR receive byte + Port_4F: EQU 4Fh ; + ; .... ...x + ; .... ..x. + ; .... .x.. + ; .... x... + ; ...x .... + +*/ + + +#include "emu.h" +#include "includes/micronic.h" +#include "rendlay.h" + +READ8_MEMBER( micronic_state::keypad_r ) +{ + UINT8 data = 0; + + for (UINT8 bit = 0; bit < 8; bit++) + { + if (m_kp_matrix & (1 << bit)) + { + data |= m_bit0->read() & (0x01 << bit) ? 0x01 : 0x00; + data |= m_bit1->read() & (0x01 << bit) ? 0x02 : 0x00; + data |= m_bit2->read() & (0x01 << bit) ? 0x04 : 0x00; + data |= m_bit3->read() & (0x01 << bit) ? 0x08 : 0x00; + data |= m_bit4->read() & (0x01 << bit) ? 0x10 : 0x00; + data |= m_bit5->read() & (0x01 << bit) ? 0x20 : 0x00; + } + } + return data; +} + +READ8_MEMBER( micronic_state::status_flag_r ) +{ + return m_status_flag; +} + +WRITE8_MEMBER( micronic_state::status_flag_w ) +{ + m_status_flag = data; +} + +WRITE8_MEMBER( micronic_state::kp_matrix_w ) +{ + m_kp_matrix = data; +} + +WRITE8_MEMBER( micronic_state::beep_w ) +{ + UINT16 frequency[16] = + { + 0, 4000, 2000, 1333, 1000, 800, 667, 571, + 500, 444, 400, 364, 333, 308, 286, 267 + }; + + m_beep->set_frequency(frequency[data & 0x0f]); + m_beep->set_state((data & 0x0f) ? 1 : 0); +} + +READ8_MEMBER( micronic_state::irq_flag_r ) +{ + return (m_backbattery->read()<<4) | (m_mainbattery->read()<<3) | (keypad_r(space, offset) ? 0 : 1); +} + +WRITE8_MEMBER( micronic_state::bank_select_w ) +{ + if (data < 2) + { + m_bank1->set_entry(data); + m_maincpu->space(AS_PROGRAM).unmap_write(0x0000, 0x7fff); + } + else + { + m_bank1->set_entry((data <= m_banks_num) ? data : m_banks_num); + m_maincpu->space(AS_PROGRAM).install_write_bank(0x0000, 0x7fff, "bank1"); + } +} + +WRITE8_MEMBER( micronic_state::lcd_contrast_w ) +{ + m_lcd_contrast = data; +} + +WRITE8_MEMBER( micronic_state::port_2c_w ) +{ + m_lcd_backlight = BIT(data, 4); +} + + +/*************************************************************************** + RTC-146818 +***************************************************************************/ + +WRITE8_MEMBER( micronic_state::rtc_address_w ) +{ + m_rtc->write(space, 0, data); +} + +READ8_MEMBER( micronic_state::rtc_data_r ) +{ + return m_rtc->read(space, 1); +} + +WRITE8_MEMBER( micronic_state::rtc_data_w ) +{ + m_rtc->write(space, 1, data); +} + +/*************************************************************************** + Machine +***************************************************************************/ + +static ADDRESS_MAP_START(micronic_mem, AS_PROGRAM, 8, micronic_state) + AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram_base") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(micronic_io, AS_IO, 8, micronic_state) + ADDRESS_MAP_GLOBAL_MASK (0xff) + + /* keypad */ + AM_RANGE(0x00, 0x00) AM_READ(keypad_r) + AM_RANGE(0x02, 0x02) AM_WRITE(kp_matrix_w) + + /* hd61830 */ + AM_RANGE(0x03, 0x03) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, data_r, data_w) + AM_RANGE(0x23, 0x23) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, status_r, control_w) + + /* rtc-146818 */ + AM_RANGE(0x08, 0x08) AM_WRITE(rtc_address_w) + AM_RANGE(0x28, 0x28) AM_READWRITE(rtc_data_r, rtc_data_w) + + /* sound */ + AM_RANGE(0x2b, 0x2b) AM_WRITE(beep_w) + + /* basic machine */ + AM_RANGE(0x05, 0x05) AM_READ(irq_flag_r) + AM_RANGE(0x2c, 0x2c) AM_WRITE(port_2c_w) + AM_RANGE(0x47, 0x47) AM_WRITE(bank_select_w) + AM_RANGE(0x46, 0x46) AM_WRITE(lcd_contrast_w) + AM_RANGE(0x48, 0x48) AM_WRITE(status_flag_w) + AM_RANGE(0x49, 0x49) AM_READ(status_flag_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( micronic ) + PORT_START("MAINBATTERY") + PORT_CONFNAME( 0x01, 0x01, "Main Battery Status" ) + PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x00, "Low Battery" ) + PORT_START("BACKBATTERY") + PORT_CONFNAME( 0x01, 0x01, "Backup Battery Status" ) + PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x00, "Low Battery" ) + + PORT_START("BIT0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MODE") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A (") PORT_CODE(KEYCODE_A) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B )") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("U 1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) + PORT_START("BIT1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D DEL") PORT_CODE(KEYCODE_D) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F &") PORT_CODE(KEYCODE_F) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("V 2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("SPACE 0") PORT_CODE(KEYCODE_0) + PORT_START("BIT2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G +") PORT_CODE(KEYCODE_G) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H /") PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("I ,") PORT_CODE(KEYCODE_I) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("J ?") PORT_CODE(KEYCODE_J) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("W 3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("NO") PORT_CODE(KEYCODE_PGUP) + PORT_START("BIT3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K -") PORT_CODE(KEYCODE_K) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L *") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("M .") PORT_CODE(KEYCODE_M) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("N Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("YES") PORT_CODE(KEYCODE_PGDN) + PORT_START("BIT4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("O 7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P 8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Q 9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DEPT") PORT_CODE(KEYCODE_R) + PORT_START("BIT5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R 4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("S 5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T 6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("END") PORT_CODE(KEYCODE_END) +INPUT_PORTS_END + + +void micronic_state::nvram_init(nvram_device &nvram, void *data, size_t size) +{ + m_status_flag = 0; +} + + +PALETTE_INIT_MEMBER(micronic_state, micronic) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +void micronic_state::machine_start() +{ + /* ROM banks */ + m_bank1->configure_entries(0x00, 0x02, memregion(Z80_TAG)->base(), 0x10000); + + /* RAM banks */ + m_banks_num = (m_ram->size() >> 15) + 1; + m_bank1->configure_entries(0x02, m_banks_num - 1, m_ram->pointer(), 0x8000); + + m_nvram1->set_base(m_ram_base, 0x8000); + m_nvram2->set_base(m_ram->pointer(), m_ram->size()); + + /* register for state saving */ + save_item(NAME(m_banks_num)); + save_item(NAME(m_kp_matrix)); + save_item(NAME(m_lcd_contrast)); + save_item(NAME(m_lcd_backlight)); + save_item(NAME(m_status_flag)); + // TODO: restore RAM bank at state load... +} + +void micronic_state::machine_reset() +{ + m_bank1->set_entry(0); + m_maincpu->space(AS_PROGRAM).unmap_write(0x0000, 0x7fff); +} + + +WRITE_LINE_MEMBER( micronic_state::mc146818_irq ) +{ + m_maincpu->set_input_line(0, !state ? HOLD_LINE : CLEAR_LINE); +} + + +static MACHINE_CONFIG_START( micronic, micronic_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_3_579545MHz) + MCFG_CPU_PROGRAM_MAP(micronic_mem) + MCFG_CPU_IO_MAP(micronic_io) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(80) + MCFG_SCREEN_UPDATE_DEVICE(HD61830_TAG, hd61830_device, screen_update) + MCFG_SCREEN_SIZE(120, 64) //6x20, 8x8 + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 64-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(micronic_state, micronic) + + MCFG_DEVICE_ADD(HD61830_TAG, HD61830, XTAL_4_9152MHz/2/2) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + /* ram banks */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("224K") + + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram1", micronic_state, nvram_init) // base ram + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram2", micronic_state, nvram_init) // additional ram banks + + MCFG_MC146818_ADD( MC146818_TAG, XTAL_32_768kHz ) + MCFG_MC146818_IRQ_HANDLER(WRITELINE(micronic_state, mc146818_irq)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( micronic ) + ROM_REGION( 0x18000, Z80_TAG, 0 ) + ROM_SYSTEM_BIOS(0, "v228", "Micronic 1000") + ROMX_LOAD( "micron1.bin", 0x0000, 0x8000, CRC(5632c8b7) SHA1(d1c9cf691848e9125f9ea352e4ffa41c288f3e29), ROM_BIOS(1)) + ROMX_LOAD( "micron2.bin", 0x10000, 0x8000, CRC(dc8e7341) SHA1(927dddb3914a50bb051256d126a047a29eff7c65), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "test", "Micronic 1000 LCD monitor") + ROMX_LOAD( "monitor2.bin", 0x0000, 0x8000, CRC(c6ae2bbf) SHA1(1f2e3a3d4720a8e1bb38b37f4ab9e0e32676d030), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, micronic, 0, 0, micronic, micronic, driver_device, 0, "Victor Micronic", "Micronic 1000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/microtan.c b/src/mame/drivers/microtan.c new file mode 100644 index 00000000000..5503e3285e8 --- /dev/null +++ b/src/mame/drivers/microtan.c @@ -0,0 +1,288 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/****************************************************************************** + * Microtan 65 + * + * system driver + * + * Juergen Buchmueller , Jul 2000 + * + * Thanks go to Geoff Macdonald + * for his site http:://www.geo255.redhotant.com + * and to Fabrice Frances + * for his site http://www.ifrance.com/oric/microtan.html + * + * Microtan65 memory map + * + * range short description + * 0000-01FF SYSRAM system ram + * 0000-003f variables + * 0040-00ff basic + * 0100-01ff stack + * 0200-03ff VIDEORAM display + * 0400-afff RAM main memory + * bc00-bc01 AY8912-0 sound chip #0 + * bc02-bc03 AY8912-1 sound chip #1 + * bc04 SPACEINV space invasion sound (?) + * bfc0-bfcf VIA6522-0 VIA 6522 #0 + * bfd0-bfd3 SIO serial i/o + * bfe0-bfef VIA6522-1 VIA 6522 #0 + * bff0 GFX_KBD R: chunky graphics on W: reset KBD interrupt + * bff1 NMI W: start delayed NMI + * bff2 HEX W: hex. keypad column + * bff3 KBD_GFX R: ASCII KBD / hex. keypad row W: chunky graphics off + * c000-e7ff BASIC BASIC Interpreter ROM + * f000-f7ff XBUG XBUG ROM + * f800-ffff TANBUG TANBUG ROM + * + *****************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "includes/microtan.h" + +/* Components */ +#include "sound/ay8910.h" +#include "sound/dac.h" +#include "sound/wave.h" +#include "machine/6522via.h" +#include "machine/mos6551.h" + +/* Devices */ +#include "imagedev/cassette.h" + + +static ADDRESS_MAP_START( microtan_map, AS_PROGRAM, 8, microtan_state ) + AM_RANGE(0x0000, 0x01ff) AM_RAM + AM_RANGE(0x0200, 0x03ff) AM_RAM_WRITE(microtan_videoram_w) AM_SHARE("videoram") + AM_RANGE(0xbc00, 0xbc00) AM_DEVWRITE("ay8910.1", ay8910_device, address_w) + AM_RANGE(0xbc01, 0xbc01) AM_DEVREADWRITE("ay8910.1", ay8910_device, data_r, data_w) + AM_RANGE(0xbc02, 0xbc02) AM_DEVWRITE("ay8910.2", ay8910_device, address_w) + AM_RANGE(0xbc03, 0xbc03) AM_DEVREADWRITE("ay8910.2", ay8910_device, data_r, data_w) + AM_RANGE(0xbfc0, 0xbfcf) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) + AM_RANGE(0xbfd0, 0xbfd3) AM_DEVREADWRITE("acia", mos6551_device, read, write) + AM_RANGE(0xbfe0, 0xbfef) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) + AM_RANGE(0xbff0, 0xbfff) AM_READWRITE(microtan_bffx_r, microtan_bffx_w) + AM_RANGE(0xc000, 0xe7ff) AM_ROM + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static INPUT_PORTS_START( microtan ) + PORT_START("DSW") + PORT_DIPNAME( 0x03, 0x00, "Memory size" ) + PORT_DIPSETTING( 0x00, "1K" ) + PORT_DIPSETTING( 0x01, "1K + 7K TANEX" ) + PORT_DIPSETTING( 0x02, "1K + 7K TANEX + 40K TANRAM" ) + PORT_BIT( 0xfc, 0xfc, IPT_UNUSED ) + + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (L)") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (R)") PORT_CODE(KEYCODE_RSHIFT) + + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LINE FEED") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER (KP)") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". (KP)") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 (KP)") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 (KP)") PORT_CODE(KEYCODE_1_PAD) + + PORT_START("ROW8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 (KP)") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 (KP)") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 (KP)") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 (KP)") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 (KP)") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 (KP)") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD) + + PORT_START("JOY") // VIA #1 PORT A + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY +INPUT_PORTS_END + +static const gfx_layout char_layout = +{ + 8, 16, /* 8 x 16 graphics */ + 128, /* 128 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 8*8, 9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, + 8 * 16 /* code takes 8 times 16 bits */ +}; + +static const gfx_layout chunky_layout = +{ + 8, 16, /* 8 x 16 graphics */ + 256, /* 256 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 8*8, 9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, + 8 * 16 /* code takes 8 times 16 bits */ +}; + +static GFXDECODE_START( microtan ) + GFXDECODE_ENTRY( "gfx1", 0, char_layout, 0, 1 ) + GFXDECODE_ENTRY( "gfx2", 0, chunky_layout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( microtan, microtan_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 750000) // 750 kHz + MCFG_CPU_PROGRAM_MAP(microtan_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", microtan_state, microtan_interrupt) + + + /* video hardware - include overscan */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(32*8, 16*16) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*16, 16*16-1) + MCFG_SCREEN_UPDATE_DRIVER(microtan_state, screen_update_microtan) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", microtan) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8910.1", AY8910, 1000000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("ay8910.2", AY8910, 1000000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* snapshot/quickload */ + MCFG_SNAPSHOT_ADD("snapshot", microtan_state, microtan, "m65", 0.5) + MCFG_QUICKLOAD_ADD("quickload", microtan_state, microtan, "hex", 0.5) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + + /* acia */ + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + + /* via */ + MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) + MCFG_VIA6522_READPA_HANDLER(READ8(microtan_state, via_0_in_a)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(microtan_state, via_0_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(microtan_state, via_0_out_b)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(microtan_state, via_0_out_ca2)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(microtan_state, via_0_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(microtan_state, via_0_irq)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 0) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(microtan_state, via_1_out_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(microtan_state, via_1_out_b)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(microtan_state, via_1_out_ca2)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(microtan_state, via_1_out_cb2)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(microtan_state, via_1_irq)) +MACHINE_CONFIG_END + +ROM_START( microtan ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "tanex_j2.rom", 0xc000, 0x1000, CRC(3e09d384) SHA1(15a98941a672ff16242cc73f1dcf1d81fccd8910) ) + ROM_LOAD( "tanex_h2.rom", 0xd000, 0x1000, CRC(75105113) SHA1(c6fea4d65b7c52f43aa1589cace9467349a0f290) ) + ROM_LOAD( "tanex_d3.rom", 0xe000, 0x0800, CRC(ee6e8412) SHA1(7e1bca84bab79d94a4ab8554d23e2bc28ccd0384) ) + ROM_LOAD( "tanex_e2.rom", 0xe800, 0x0800, CRC(bd87fd34) SHA1(f41895df4a733dddfaf1c89ecff5040addcab804) ) + ROM_LOAD( "tanex_g2.rom", 0xf000, 0x0800, CRC(9fd233ee) SHA1(7b0be2d0402229ec80b062f7a0bed793686bcbf9) ) + ROM_LOAD( "tanbug_2.rom", 0xf800, 0x0400, CRC(7e215313) SHA1(c8fb3d33ce2beaf624dc75ec57d34c216b086274) ) + ROM_LOAD( "tanbug.rom", 0xfc00, 0x0400, CRC(c8221d9e) SHA1(c7fe4c174523aaaab30be7a8c9baf2bc08b33968) ) + + ROM_REGION( 0x00800, "gfx1", 0 ) + ROM_LOAD( "charset.rom", 0x0000, 0x0800, CRC(3b3c5360) SHA1(a3a2f74149107f8b8f35b15069c71f3aa843d12f) ) + + ROM_REGION( 0x01000, "gfx2", ROMREGION_ERASEFF ) + // initialized in init_microtan +ROM_END + + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME +COMP( 1979, microtan, 0, 0, microtan, microtan, microtan_state, microtan, "Tangerine", "Microtan 65" , 0) diff --git a/src/mame/drivers/microvsn.c b/src/mame/drivers/microvsn.c new file mode 100644 index 00000000000..e322bf47615 --- /dev/null +++ b/src/mame/drivers/microvsn.c @@ -0,0 +1,707 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + Milton Bradley MicroVision + + To Do: + * Add support for the paddle control + * Finish support for i8021 based cartridges + +Since the microcontrollers were on the cartridges it was possible to have +different clocks on different games. +The Connect Four I8021 game is clocked at around 2MHz. The TMS1100 versions +of the games were clocked at around 500KHz, 550KHz, or 300KHz. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "cpu/tms0980/tms0980.h" +#include "sound/dac.h" +#include "rendlay.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +#define LOG 0 + + +class microvision_state : public driver_device +{ +public: + microvision_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_dac( *this, "dac" ), + m_i8021( *this, "maincpu1" ), + m_tms1100( *this, "maincpu2" ), + m_cart(*this, "cartslot") + { } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_PALETTE_INIT(microvision); + DECLARE_MACHINE_START(microvision); + DECLARE_MACHINE_RESET(microvision); + + void screen_vblank(screen_device &screen, bool state); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( microvsn_cart ); + + // i8021 interface + DECLARE_WRITE8_MEMBER(i8021_p0_write); + DECLARE_WRITE8_MEMBER(i8021_p1_write); + DECLARE_WRITE8_MEMBER(i8021_p2_write); + DECLARE_READ8_MEMBER(i8021_t1_read); + DECLARE_READ8_MEMBER(i8021_bus_read); + + // TMS1100 interface + DECLARE_READ8_MEMBER(tms1100_read_k); + DECLARE_WRITE16_MEMBER(tms1100_write_o); + DECLARE_WRITE16_MEMBER(tms1100_write_r); + + // enums + enum cpu_type + { + CPU_TYPE_I8021, + CPU_TYPE_TMS1100 + }; + + enum pcb_type + { + PCB_TYPE_4952_REV_A, + PCB_TYPE_4952_9_REV_B, + PCB_TYPE_4971_REV_C, + PCB_TYPE_7924952D02, + PCB_TYPE_UNKNOWN + }; + + enum rc_type + { + RC_TYPE_100PF_21_0K, + RC_TYPE_100PF_23_2K, + RC_TYPE_100PF_39_4K, + RC_TYPE_UNKNOWN + }; + + cpu_type m_cpu_type; + pcb_type m_pcb_type; + rc_type m_rc_type; + +protected: + required_device m_dac; + required_device m_i8021; + required_device m_tms1100; + required_device m_cart; + + // Timers + static const device_timer_id TIMER_PADDLE = 0; + emu_timer *m_paddle_timer; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // i8021 variables + UINT8 m_p0; + UINT8 m_p2; + UINT8 m_t1; + + // tms1100 variables + UINT16 m_r; + UINT16 m_o; + + // generic variables + void update_lcd(); + void lcd_write(UINT8 control, UINT8 data); + void speaker_write(UINT8 speaker); + bool m_pla; + + UINT8 m_lcd_latch[8]; + UINT8 m_lcd_holding_latch[8]; + UINT8 m_lcd_latch_index; + UINT8 m_lcd[16][16]; + UINT8 m_lcd_control_old; +}; + + +PALETTE_INIT_MEMBER(microvision_state,microvision) +{ + palette.set_pen_color( 15, 0x00, 0x00, 0x00 ); + palette.set_pen_color( 14, 0x11, 0x11, 0x11 ); + palette.set_pen_color( 13, 0x22, 0x22, 0x22 ); + palette.set_pen_color( 12, 0x33, 0x33, 0x33 ); + palette.set_pen_color( 11, 0x44, 0x44, 0x44 ); + palette.set_pen_color( 10, 0x55, 0x55, 0x55 ); + palette.set_pen_color( 9, 0x66, 0x66, 0x66 ); + palette.set_pen_color( 8, 0x77, 0x77, 0x77 ); + palette.set_pen_color( 7, 0x88, 0x88, 0x88 ); + palette.set_pen_color( 6, 0x99, 0x99, 0x99 ); + palette.set_pen_color( 5, 0xaa, 0xaa, 0xaa ); + palette.set_pen_color( 4, 0xbb, 0xbb, 0xbb ); + palette.set_pen_color( 3, 0xcc, 0xcc, 0xcc ); + palette.set_pen_color( 2, 0xdd, 0xdd, 0xdd ); + palette.set_pen_color( 1, 0xee, 0xee, 0xee ); + palette.set_pen_color( 0, 0xff, 0xff, 0xff ); +} + + +MACHINE_START_MEMBER(microvision_state, microvision) +{ + m_paddle_timer = timer_alloc(TIMER_PADDLE); + + save_item(NAME(m_p0)); + save_item(NAME(m_p2)); + save_item(NAME(m_t1)); + save_item(NAME(m_r)); + save_item(NAME(m_o)); + save_item(NAME(m_lcd_latch)); + save_item(NAME(m_lcd_latch_index)); + save_item(NAME(m_lcd)); + save_item(NAME(m_lcd_control_old)); + save_item(NAME(m_pla)); + save_item(NAME(m_lcd_holding_latch)); +} + + +MACHINE_RESET_MEMBER(microvision_state, microvision) +{ + for( int i = 0; i < 8; i++ ) + { + m_lcd_latch[i] = 0; + } + + for( int i = 0; i < 16; i++ ) + { + for ( int j = 0; j < 16; j++ ) + { + m_lcd[i][j] = 0; + } + } + + m_o = 0; + m_r = 0; + m_p0 = 0; + m_p2 = 0; + m_t1 = 0; + + m_paddle_timer->adjust( attotime::never ); + + switch ( m_cpu_type ) + { + case CPU_TYPE_I8021: + m_i8021->resume( SUSPEND_REASON_DISABLE ); + m_tms1100->suspend( SUSPEND_REASON_DISABLE, 0 ); + break; + + case CPU_TYPE_TMS1100: + m_i8021->suspend( SUSPEND_REASON_DISABLE, 0 ); + m_tms1100->resume( SUSPEND_REASON_DISABLE ); + + switch ( m_rc_type ) + { + case RC_TYPE_100PF_21_0K: + static_set_clock( m_tms1100, 550000 ); + break; + + case RC_TYPE_100PF_23_2K: + case RC_TYPE_UNKNOWN: // Default to most occurring setting + static_set_clock( m_tms1100, 500000 ); + break; + + case RC_TYPE_100PF_39_4K: + static_set_clock( m_tms1100, 300000 ); + break; + } + break; + } +} + + +void microvision_state::update_lcd() +{ + UINT16 row = ( m_lcd_holding_latch[0] << 12 ) | ( m_lcd_holding_latch[1] << 8 ) | ( m_lcd_holding_latch[2] << 4 ) | m_lcd_holding_latch[3]; + UINT16 col = ( m_lcd_holding_latch[4] << 12 ) | ( m_lcd_holding_latch[5] << 8 ) | ( m_lcd_holding_latch[6] << 4 ) | m_lcd_holding_latch[7]; + + if (LOG) logerror("row = %04x, col = %04x\n", row, col ); + for ( int i = 0; i < 16; i++ ) + { + UINT16 temp = row; + + for ( int j = 0; j < 16; j++ ) + { + if ( ( temp & col ) & 0x8000 ) + { + m_lcd[j][i] = 15; + } + temp <<= 1; + } + col <<= 1; + } +} + + +UINT32 microvision_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for ( UINT8 i = 0; i < 16; i++ ) + { + for ( UINT8 j = 0; j < 16; j++ ) + { + bitmap.pix16(i,j) = m_lcd [i] [j]; + } + } + + return 0; +} + + +void microvision_state::screen_vblank(screen_device &screen, bool state) +{ + if ( state ) + { + for ( int i = 0; i < 16; i++ ) + { + for ( int j= 0; j < 16; j++ ) + { + if ( m_lcd[i][j] ) + { + m_lcd[i][j]--; + } + } + } + update_lcd(); + } +} + + +/* +control is signals LCD5 LCD4 + LCD5 = -Data Clk on 0488 + LCD4 = Latch pulse on 0488 + LCD3 = Data 0 + LCD2 = Data 1 + LCD1 = Data 2 + LCD0 = Data 3 +data is signals LCD3 LCD2 LCD1 LCD0 +*/ +void microvision_state::lcd_write(UINT8 control, UINT8 data) +{ + // Latch pulse, when high, resets the %8 latch address counter + if ( control & 0x01 ) { + m_lcd_latch_index = 0; + } + + // The addressed latches load when -Data Clk is low + if ( ! ( control & 0x02 ) ) { + m_lcd_latch[ m_lcd_latch_index & 0x07 ] = data & 0x0f; + } + + // The latch address counter is incremented on rising edges of -Data Clk + if ( ( ! ( m_lcd_control_old & 0x02 ) ) && ( control & 0x02 ) ) { + // Check if Latch pule is low + if ( ! ( control & 0x01 ) ) { + m_lcd_latch_index++; + } + } + + // A parallel transfer of data from the addressed latches to the holding latches occurs + // whenever Latch Pulse is high and -Data Clk is high + if ( control == 3 ) { + for ( int i = 0; i < 8; i++ ) { + m_lcd_holding_latch[i] = m_lcd_latch[i]; + } + update_lcd(); + } + + m_lcd_control_old = control; +} + + +/* +speaker is SPKR1 SPKR0 +*/ +void microvision_state::speaker_write(UINT8 speaker) +{ + const INT8 speaker_level[4] = { 0, 127, -128, 0 }; + + m_dac->write_signed8( speaker_level[ speaker & 0x03 ] ); +} + + +void microvision_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch ( id ) + { + case TIMER_PADDLE: + m_t1 = 0; + break; + } +} + + +/* + x--- ---- KEY3 + -x-- ---- KEY4 + --x- ---- KEY5 + ---x ---- KEY6 + ---- x--- + ---- -x-- KEY0 + ---- --x- KEY1 + ---- ---x KEY2 +*/ +WRITE8_MEMBER( microvision_state::i8021_p0_write ) +{ + if (LOG) logerror( "p0_write: %02x\n", data ); + + m_p0 = data; +} + + +/* + x--- ---- LCD3 + -x-- ---- LCD2 + --x- ---- LCD1 + ---x ---- LCD0 + ---- --x- LCD5 + ---- ---x LCD4 +*/ +WRITE8_MEMBER( microvision_state::i8021_p1_write ) +{ + if (LOG) logerror( "p1_write: %02x\n", data ); + + lcd_write( data & 0x03, data >> 4 ); +} + + +/* +---- xx-- CAP2 (paddle) +---- --x- SPKR1 +---- ---x SPKR0 +*/ +WRITE8_MEMBER( microvision_state::i8021_p2_write ) +{ + if (LOG) logerror( "p2_write: %02x\n", data ); + + m_p2 = data; + + speaker_write( m_p2 & 0x03 ); + + if ( m_p2 & 0x0c ) + { + m_t1 = 1; + // Stop paddle timer + m_paddle_timer->adjust( attotime::never ); + } + else + { + // Start paddle timer (min is 160uS, max is 678uS) + UINT8 paddle = 255 - ioport("PADDLE")->read(); + m_paddle_timer->adjust( attotime::from_usec(160 + ( 518 * paddle ) / 255 ) ); + } +} + + +READ8_MEMBER( microvision_state::i8021_t1_read ) +{ + return m_t1; +} + + +READ8_MEMBER( microvision_state::i8021_bus_read ) +{ + UINT8 data = m_p0; + + UINT8 col0 = ioport("COL0")->read(); + UINT8 col1 = ioport("COL1")->read(); + UINT8 col2 = ioport("COL2")->read(); + + // Row scanning + if ( ! ( m_p0 & 0x80 ) ) + { + UINT8 t = ( ( col0 & 0x01 ) << 2 ) | ( ( col1 & 0x01 ) << 1 ) | ( col2 & 0x01 ); + + data &= ( t ^ 0xFF ); + } + if ( ! ( m_p0 & 0x40 ) ) + { + UINT8 t = ( ( col0 & 0x02 ) << 1 ) | ( col1 & 0x02 ) | ( ( col2 & 0x02 ) >> 1 ); + + data &= ( t ^ 0xFF ); + } + if ( ! ( m_p0 & 0x20 ) ) + { + UINT8 t = ( col0 & 0x04 ) | ( ( col1 & 0x04 ) >> 1 ) | ( ( col2 & 0x04 ) >> 2 ); + + data &= ( t ^ 0xFF ); + } + if ( ! ( m_p0 & 0x10 ) ) + { + UINT8 t = ( ( col0 & 0x08 ) >> 1 ) | ( ( col1 & 0x08 ) >> 2 ) | ( ( col2 & 0x08 ) >> 3 ); + + data &= ( t ^ 0xFF ); + } + return data; +} + + +READ8_MEMBER( microvision_state::tms1100_read_k ) +{ + UINT8 data = 0; + + if (LOG) logerror("read_k\n"); + + if ( m_r & 0x100 ) + { + data |= ioport("COL0")->read(); + } + if ( m_r & 0x200 ) + { + data |= ioport("COL1")->read(); + } + if ( m_r & 0x400 ) + { + data |= ioport("COL2")->read(); + } + return data; +} + + +WRITE16_MEMBER( microvision_state::tms1100_write_o ) +{ + if (LOG) logerror("write_o: %04x\n", data); + + m_o = data; + + lcd_write( ( m_r >> 6 ) & 0x03, m_o & 0x0f ); +} + + +/* +x-- ---- ---- KEY2 +-x- ---- ---- KEY1 +--x ---- ---- KEY0 +--- x--- ---- LCD5 +--- -x-- ---- LCD4 +--- ---- --x- SPKR0 +--- ---- ---x SPKR1 +*/ +WRITE16_MEMBER( microvision_state::tms1100_write_r ) +{ + if (LOG) logerror("write_r: %04x\n", data); + + m_r = data; + + speaker_write( ( ( m_r & 0x01 ) << 1 ) | ( ( m_r & 0x02 ) >> 1 ) ); + lcd_write( ( m_r >> 6 ) & 0x03, m_o & 0x0f ); +} + + +static const UINT16 microvision_output_pla_0[0x20] = +{ + /* O output PLA configuration currently unknown */ + 0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E, + 0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + + +static const UINT16 microvision_output_pla_1[0x20] = +{ + /* O output PLA configuration currently unknown */ + /* Reversed bit order */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + + +DEVICE_IMAGE_LOAD_MEMBER(microvision_state, microvsn_cart) +{ + UINT8 *rom1 = memregion("maincpu1")->base(); + UINT8 *rom2 = memregion("maincpu2")->base(); + UINT32 file_size = m_cart->common_get_size("rom"); + m_pla = 0; + + if ( file_size != 1024 && file_size != 2048 ) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid rom file size"); + return IMAGE_INIT_FAIL; + } + + /* Read cartridge */ + if (image.software_entry() == NULL) + { + if (image.fread(rom1, file_size) != file_size) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file"); + return IMAGE_INIT_FAIL; + } + } + else + { + // Copy rom contents + memcpy(rom1, image.get_software_region("rom"), file_size); + + // Get PLA type + const char *pla = image.get_feature("pla"); + + if (pla) + m_pla = 1; + + tms1xxx_cpu_device::set_output_pla(m_tms1100, m_pla ? microvision_output_pla_1 : microvision_output_pla_0); + + // Set default setting for PCB type and RC type + m_pcb_type = microvision_state::PCB_TYPE_UNKNOWN; + m_rc_type = microvision_state::RC_TYPE_UNKNOWN; + + // Detect settings for PCB type + const char *pcb = image.get_feature("pcb"); + + if (pcb) + { + static const struct { const char *pcb_name; microvision_state::pcb_type pcbtype; } pcb_types[] = + { + { "4952 REV-A", microvision_state::PCB_TYPE_4952_REV_A }, + { "4952-79 REV-B", microvision_state::PCB_TYPE_4952_9_REV_B }, + { "4971-REV-C", microvision_state::PCB_TYPE_4971_REV_C }, + { "7924952D02", microvision_state::PCB_TYPE_7924952D02 } + }; + + for (int i = 0; i < ARRAY_LENGTH(pcb_types) && m_pcb_type == microvision_state::PCB_TYPE_UNKNOWN; i++) + { + if (!core_stricmp(pcb, pcb_types[i].pcb_name)) + { + m_pcb_type = pcb_types[i].pcbtype; + } + } + } + + // Detect settings for RC types + const char *rc = image.get_feature("rc"); + + if (rc) + { + static const struct { const char *rc_name; microvision_state::rc_type rctype; } rc_types[] = + { + { "100pf/21.0K", microvision_state::RC_TYPE_100PF_21_0K }, + { "100pf/23.2K", microvision_state::RC_TYPE_100PF_23_2K }, + { "100pf/39.4K", microvision_state::RC_TYPE_100PF_39_4K } + }; + + for (int i = 0; i < ARRAY_LENGTH(rc_types) && m_rc_type == microvision_state::RC_TYPE_UNKNOWN; i++) + { + if (!core_stricmp(rc, rc_types[i].rc_name)) + { + m_rc_type = rc_types[i].rctype; + } + } + } + } + + // Mirror rom data to maincpu2 region + memcpy(rom2, rom1, file_size); + + // Based on file size select cpu: + // - 1024 -> I8021 + // - 2048 -> TI TMS1100 + + switch (file_size) + { + case 1024: + m_cpu_type = microvision_state::CPU_TYPE_I8021; + break; + + case 2048: + m_cpu_type = microvision_state::CPU_TYPE_TMS1100; + break; + } + return IMAGE_INIT_PASS; +} + + +static INPUT_PORTS_START( microvision ) + PORT_START("COL0") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CODE(KEYCODE_3) PORT_NAME("B01") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_CODE(KEYCODE_E) PORT_NAME("B04") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_CODE(KEYCODE_D) PORT_NAME("B07") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_CODE(KEYCODE_C) PORT_NAME("B10") + + PORT_START("COL1") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_CODE(KEYCODE_4) PORT_NAME("B02") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_CODE(KEYCODE_R) PORT_NAME("B05") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON8) PORT_CODE(KEYCODE_F) PORT_NAME("B08") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON11) PORT_CODE(KEYCODE_V) PORT_NAME("B11") + + PORT_START("COL2") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_CODE(KEYCODE_5) PORT_NAME("B03") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_CODE(KEYCODE_T) PORT_NAME("B06") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_CODE(KEYCODE_G) PORT_NAME("B09") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON12) PORT_CODE(KEYCODE_B) PORT_NAME("B12") + + PORT_START("PADDLE") + PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(1) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) +INPUT_PORTS_END + + +static ADDRESS_MAP_START( microvision_8021_io, AS_IO, 8, microvision_state ) + AM_RANGE( 0x00, 0xFF ) AM_WRITE( i8021_p0_write ) + AM_RANGE( MCS48_PORT_P0, MCS48_PORT_P0 ) AM_WRITE( i8021_p0_write ) + AM_RANGE( MCS48_PORT_P1, MCS48_PORT_P1 ) AM_WRITE( i8021_p1_write ) + AM_RANGE( MCS48_PORT_P2, MCS48_PORT_P2 ) AM_WRITE( i8021_p2_write ) + AM_RANGE( MCS48_PORT_T1, MCS48_PORT_T1 ) AM_READ( i8021_t1_read ) + AM_RANGE( MCS48_PORT_BUS, MCS48_PORT_BUS ) AM_READ( i8021_bus_read ) +ADDRESS_MAP_END + + +static MACHINE_CONFIG_START( microvision, microvision_state ) + MCFG_CPU_ADD("maincpu1", I8021, 2000000) // approximately + MCFG_CPU_IO_MAP( microvision_8021_io ) + MCFG_CPU_ADD("maincpu2", TMS1100, 500000) // most games seem to be running at approximately this speed + MCFG_TMS1XXX_OUTPUT_PLA( microvision_output_pla_0 ) + MCFG_TMS1XXX_READ_K_CB( READ8( microvision_state, tms1100_read_k ) ) + MCFG_TMS1XXX_WRITE_O_CB( WRITE16( microvision_state, tms1100_write_o ) ) + MCFG_TMS1XXX_WRITE_R_CB( WRITE16( microvision_state, tms1100_write_r ) ) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(microvision_state, microvision ) + MCFG_MACHINE_RESET_OVERRIDE(microvision_state, microvision ) + + MCFG_SCREEN_UPDATE_DRIVER(microvision_state, screen_update) + MCFG_SCREEN_VBLANK_DRIVER(microvision_state, screen_vblank) + MCFG_SCREEN_SIZE(16, 16) + MCFG_SCREEN_VISIBLE_AREA(0, 15, 0, 15) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(microvision_state,microvision) + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "microvision_cart") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(microvision_state, microvsn_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","microvision") +MACHINE_CONFIG_END + + +ROM_START( microvsn ) + ROM_REGION( 0x800, "maincpu1", ROMREGION_ERASE00 ) + ROM_REGION( 0x800, "maincpu2", ROMREGION_ERASE00 ) + ROM_REGION( 867, "maincpu2:mpla", 0 ) + ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // verified for: pinball, blockbuster, bowling + + ROM_REGION( 365, "maincpu2:opla", ROMREGION_ERASE00 ) +ROM_END + + +CONS( 1979, microvsn, 0, 0, microvision, microvision, driver_device, 0, "Milton Bradley", "MicroVision", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/mikro80.c b/src/mame/drivers/mikro80.c new file mode 100644 index 00000000000..178be26ce25 --- /dev/null +++ b/src/mame/drivers/mikro80.c @@ -0,0 +1,239 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + MIKRO80 driver by Miodrag Milanovic + + 10/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/wave.h" +#include "includes/mikro80.h" +#include "formats/rk_cas.h" +#include "sound/dac.h" + +/* Address maps */ +static ADDRESS_MAP_START(mikro80_mem, AS_PROGRAM, 8, mikro80_state ) + AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x0800, 0xdfff ) AM_RAM // RAM + AM_RANGE( 0xe000, 0xe7ff ) AM_RAM AM_SHARE("cursor_ram")// Video RAM + AM_RANGE( 0xe800, 0xefff ) AM_RAM AM_SHARE("video_ram") // Video RAM + AM_RANGE( 0xd000, 0xf7ff ) AM_RAM // RAM + AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mikro80_io , AS_IO, 8, mikro80_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x01, 0x01) AM_READWRITE(mikro80_tape_r, mikro80_tape_w ) + AM_RANGE( 0x04, 0x07) AM_READWRITE(mikro80_keyboard_r, mikro80_keyboard_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( kristall_io , AS_IO, 8, mikro80_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( radio99_io , AS_IO, 8, mikro80_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x01, 0x01) AM_READWRITE(mikro80_tape_r, mikro80_tape_w ) + AM_RANGE( 0x04, 0x04) AM_DEVWRITE("dac", dac_device, write_unsigned8) + AM_RANGE( 0x05, 0x05) AM_READWRITE(mikro80_8255_portc_r, mikro80_8255_portc_w ) + AM_RANGE( 0x06, 0x06) AM_READ(mikro80_8255_portb_r) + AM_RANGE( 0x07, 0x07) AM_WRITE(mikro80_8255_porta_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mikro80 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/* F4 Character Displayer */ +static const gfx_layout mikro80_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( mikro80 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, mikro80_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( mikro80, mikro80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(mikro80_mem) + MCFG_CPU_IO_MAP(mikro80_io) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mikro80_state, mikro80_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(mikro80_state, mikro80_8255_portb_r)) + MCFG_I8255_IN_PORTC_CB(READ8(mikro80_state, mikro80_8255_portc_r)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) + MCFG_SCREEN_UPDATE_DRIVER(mikro80_state, screen_update_mikro80) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mikro80) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rk8_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("mikro80_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "mikro80") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( radio99, mikro80 ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(radio99_io) + + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 16.00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( kristall, mikro80 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(kristall_io) +MACHINE_CONFIG_END + + +/* ROM definition */ + +ROM_START( mikro80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mikro80.rom", 0xf800, 0x0800, CRC(63a4b72a) SHA1(6bd3e396539a15e2ccffa7486cae06ef6ddd1d03)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("mikro80.fnt", 0x0000, 0x0800, CRC(43eb72bb) SHA1(761319cc6747661b33e84aa449cec83800543b5b) ) +ROM_END + +ROM_START( radio99 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "monrk88.bin", 0xf800, 0x0800, CRC(5415d847) SHA1(c8233c72548bc79846b9d998766a10df349c5bda)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("mikro80.fnt", 0x0000, 0x0800, CRC(43eb72bb) SHA1(761319cc6747661b33e84aa449cec83800543b5b) ) +ROM_END + +ROM_START( kristall2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "kristall-2.rom", 0xf800, 0x0800, CRC(e1b5c60f) SHA1(8ce5158def7fca91ec7e11efbb10aa5d70b7c36d)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD( "kristall-2.fnt", 0x0000, 0x0800, CRC(9661c9f5) SHA1(830c38735dcb1c8a271fa0027f94b4e034848fc8)) +ROM_END + + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, mikro80, 0, 0, mikro80, mikro80, mikro80_state, mikro80, "", "Mikro-80", 0) +COMP( 1993, radio99, mikro80, 0, radio99, mikro80, mikro80_state, radio99, "", "Radio-99DM", 0) +COMP( 1987, kristall2, mikro80, 0, kristall, mikro80, mikro80_state, mikro80, "", "Kristall-2", 0) diff --git a/src/mame/drivers/mikromik.c b/src/mame/drivers/mikromik.c new file mode 100644 index 00000000000..c802478f6ad --- /dev/null +++ b/src/mame/drivers/mikromik.c @@ -0,0 +1,578 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Nokia Elektroniikka pj + + Controller ILC 9534 + FDC-Interface ILC 9530 + + Parts: + + 6,144 MHz xtal (CPU clock) + 18,720 MHz xtal (pixel clock) + 16 MHz xtal (FDC clock) + Intel I8085AP (CPU) + Intel 8253-5P (PIT) + Intel 8275P (CRTC) + Intel 8212P (I/OP) + Intel 8237A-5P (DMAC) + NEC uPD7220C (GDC) + NEC uPD7201P (MPSC=uart) + NEC uPD765 (FDC) + TMS4116-15 (16Kx4 DRAM)*4 = 32KB Video RAM for 7220 + 2164-6P (64Kx1 DRAM)*8 = 64KB Work RAM + + DMA channels: + + 0 CRT + 1 MPSC transmit + 2 MPSC receive + 3 FDC + + Interrupts: + + INTR MPSC INT + RST5.5 FDC IRQ + RST6.5 8212 INT + RST7.5 DMA EOP + +*/ + +/* + + TODO: + + - NEC uPD7220 GDC + - accurate video timing + - floppy DRQ during RECALL = 0 + - PCB layout + - NEC uPD7201 MPSC + - model M7 5MB hard disk + +*/ + +#include "includes/mikromik.h" + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + +#define MMU_IOEN 0x01 +#define MMU_RAMEN 0x02 +#define MMU_CE4 0x08 +#define MMU_CE0 0x10 +#define MMU_CE1 0x20 +#define MMU_CE2 0x40 +#define MMU_CE3 0x80 + + + +//************************************************************************** +// MEMORY MANAGEMENT UNIT +//************************************************************************** + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( mm1_state::read ) +{ + UINT8 data = 0; + UINT8 mmu = m_mmu_rom->base()[(m_a8 << 8) | (offset >> 8)]; + + if (mmu & MMU_IOEN) + { + switch ((offset >> 4) & 0x07) + { + case 0: + data = m_dmac->read(space, offset & 0x0f); + break; + + case 1: + data = m_mpsc->cd_ba_r(space, offset & 0x03); + break; + + case 2: + data = m_crtc->read(space, offset & 0x01); + break; + + case 3: + data = m_pit->read(space, offset & 0x03); + break; + + case 4: + data = m_iop->read(space, 0); + break; + + case 5: + if (BIT(offset, 0)) + { + data = m_fdc->fifo_r(space, 0, 0xff); + } + else + { + data = m_fdc->msr_r(space, 0, 0xff); + } + break; + + case 7: + data = m_hgdc->read(space, offset & 0x01); + break; + } + } + else + { + if (mmu & MMU_RAMEN) + { + data = m_ram->pointer()[offset]; + } + else if (!(mmu & MMU_CE0)) + { + data = m_rom->base()[offset & 0x1fff]; + } + else if (!(mmu & MMU_CE1)) + { + data = m_rom->base()[0x2000 + (offset & 0x1fff)]; + } + } + + return data; +} + + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( mm1_state::write ) +{ + UINT8 mmu = m_mmu_rom->base()[(m_a8 << 8) | (offset >> 8)]; + + if (mmu & MMU_IOEN) + { + switch ((offset >> 4) & 0x07) + { + case 0: + m_dmac->write(space, offset & 0x0f, data); + break; + + case 1: + m_mpsc->cd_ba_w(space, offset & 0x03, data); + break; + + case 2: + m_crtc->write(space, offset & 0x01, data); + break; + + case 3: + m_pit->write(space, offset & 0x03, data); + break; + + case 4: + m_iop->write(space, 0, data); + break; + + case 5: + if (BIT(offset, 0)) + { + m_fdc->fifo_w(space, 0, data, 0xff); + } + break; + + case 6: + ls259_w(space, offset & 0x07, data); + break; + + case 7: + m_hgdc->write(space, offset & 0x01, data); + break; + } + } + else + { + if (mmu & MMU_RAMEN) + { + m_ram->pointer()[offset] = data; + } + } +} + + +//------------------------------------------------- +// ls259_w - +//------------------------------------------------- + +WRITE8_MEMBER( mm1_state::ls259_w ) +{ + int d = BIT(data, 0); + + switch (offset) + { + case 0: // IC24 A8 + if (LOG) logerror("IC24 A8 %u\n", d); + m_a8 = d; + break; + + case 1: // RECALL + if (LOG) logerror("RECALL %u\n", d); + m_recall = d; + if (d) m_fdc->soft_reset(); + break; + + case 2: // _RV28/RX21 + m_rx21 = d; + break; + + case 3: // _TX21 + m_tx21 = d; + break; + + case 4: // _RCL + m_rcl = d; + break; + + case 5: // _INTC + m_intc = d; + break; + + case 6: // LLEN + if (LOG) logerror("LLEN %u\n", d); + m_llen = d; + break; + + case 7: // MOTOR ON + if (LOG) logerror("MOTOR %u\n", d); + m_floppy0->mon_w(!d); + m_floppy1->mon_w(!d); + break; + } +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( mm1_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( mm1_map, AS_PROGRAM, 8, mm1_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( mm1 ) +//------------------------------------------------- + +static INPUT_PORTS_START( mm1 ) + // defined in machine/mm1kb.h + + PORT_START("T5") + PORT_CONFNAME( 0x01, 0x00, "Floppy Drive Type") + PORT_CONFSETTING( 0x00, "640 KB" ) + PORT_CONFSETTING( 0x01, "160/320 KB" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// I8237_INTERFACE( dmac_intf ) +//------------------------------------------------- + +void mm1_state::update_tc() +{ + int fdc_tc = m_tc && !m_dack3; + + if (m_fdc_tc != fdc_tc) + { + m_fdc_tc = fdc_tc; + m_fdc->tc_w(m_fdc_tc); + } +} + +WRITE_LINE_MEMBER( mm1_state::dma_hrq_w ) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + // Assert HLDA + m_dmac->hack_w(state); +} + +READ8_MEMBER( mm1_state::mpsc_dack_r ) +{ + // clear data request + m_dmac->dreq2_w(CLEAR_LINE); + + return 1;//m_mpsc->dtra_r(); +} + +WRITE8_MEMBER( mm1_state::mpsc_dack_w ) +{ + //m_mpsc->hai_w(data); + + // clear data request + m_dmac->dreq1_w(CLEAR_LINE); +} + +WRITE_LINE_MEMBER( mm1_state::dma_eop_w ) +{ + m_maincpu->set_input_line(I8085_RST75_LINE, state); + + m_tc = state; + update_tc(); +} + +WRITE_LINE_MEMBER( mm1_state::dack3_w ) +{ + m_dack3 = state; + update_tc(); +} + +WRITE_LINE_MEMBER( mm1_state::itxc_w ) +{ + if (!m_intc) + { + m_mpsc->txca_w(state); + } +} + +WRITE_LINE_MEMBER( mm1_state::irxc_w ) +{ + if (!m_intc) + { + m_mpsc->rxca_w(state); + } +} + +WRITE_LINE_MEMBER( mm1_state::auxc_w ) +{ + m_mpsc->txcb_w(state); + m_mpsc->rxcb_w(state); +} + +//------------------------------------------------- +// UPD7201 +//------------------------------------------------- + +WRITE_LINE_MEMBER( mm1_state::drq2_w ) +{ + if (state) + { + m_dmac->dreq2_w(ASSERT_LINE); + } +} + +WRITE_LINE_MEMBER( mm1_state::drq1_w ) +{ + if (state) + { + m_dmac->dreq1_w(ASSERT_LINE); + } +} + +READ_LINE_MEMBER( mm1_state::dsra_r ) +{ + return 1; +} + + +//------------------------------------------------- +// upd765_interface fdc_intf +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER( mm1_state::floppy_formats ) + FLOPPY_MM1_FORMAT +FLOPPY_FORMATS_END +/* +FLOPPY_FORMATS_MEMBER( mm2_state::floppy_formats ) + FLOPPY_MM2_FORMAT +FLOPPY_FORMATS_END +*/ +static SLOT_INTERFACE_START( mm1_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( mm1 ) +//------------------------------------------------- + +void mm1_state::machine_start() +{ + // register for state saving + save_item(NAME(m_llen)); + save_item(NAME(m_intc)); + save_item(NAME(m_rx21)); + save_item(NAME(m_tx21)); + save_item(NAME(m_rcl)); + save_item(NAME(m_recall)); +} + + +void mm1_state::machine_reset() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + // reset LS259 + for (int i = 0; i < 8; i++) + { + ls259_w(program, i, 0); + } + + // reset FDC + m_fdc->reset(); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( mm1 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( mm1, mm1_state ) + // basic system hardware + MCFG_CPU_ADD(I8085A_TAG, I8085A, XTAL_6_144MHz) + MCFG_CPU_PROGRAM_MAP(mm1_map) + MCFG_I8085A_SID(READLINE(mm1_state, dsra_r)) + MCFG_I8085A_SOD(DEVWRITELINE(KB_TAG, mm1_keyboard_t, bell_w)) + MCFG_QUANTUM_PERFECT_CPU(I8085A_TAG) + + // peripheral hardware + MCFG_DEVICE_ADD(I8212_TAG, I8212, 0) + MCFG_I8212_IRQ_CALLBACK(INPUTLINE(I8085A_TAG, I8085_RST65_LINE)) + MCFG_I8212_DI_CALLBACK(DEVREAD8(KB_TAG, mm1_keyboard_t, read)) + + MCFG_DEVICE_ADD(I8237_TAG, AM9517A, XTAL_6_144MHz/2) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(mm1_state, dma_hrq_w)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(mm1_state, dma_eop_w)) + MCFG_I8237_IN_MEMR_CB(READ8(mm1_state, read)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(mm1_state, write)) + MCFG_I8237_IN_IOR_2_CB(READ8(mm1_state, mpsc_dack_r)) + MCFG_I8237_IN_IOR_3_CB(DEVREAD8(UPD765_TAG, upd765_family_device, mdma_r)) + MCFG_I8237_OUT_IOW_0_CB(DEVWRITE8(I8275_TAG, i8275_device, dack_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(mm1_state, mpsc_dack_w)) + MCFG_I8237_OUT_IOW_3_CB(DEVWRITE8(UPD765_TAG, upd765_family_device, mdma_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(mm1_state, dack3_w)) + + MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_6_144MHz/2/2) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(mm1_state, itxc_w)) + MCFG_PIT8253_CLK1(XTAL_6_144MHz/2/2) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(mm1_state, irxc_w)) + MCFG_PIT8253_CLK2(XTAL_6_144MHz/2/2) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mm1_state, auxc_w)) + + MCFG_UPD765A_ADD(UPD765_TAG, /* XTAL_16MHz/2/2 */ true, true) + MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE(I8085A_TAG, I8085_RST55_LINE)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq3_w)) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", mm1_floppies, "525qd", mm1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", mm1_floppies, "525qd", mm1_state::floppy_formats) + + MCFG_UPD7201_ADD(UPD7201_TAG, XTAL_6_144MHz/2, 0, 0, 0, 0) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_RXDRQA_CB(WRITELINE(mm1_state, drq2_w)) + MCFG_Z80DART_OUT_TXDRQA_CB(WRITELINE(mm1_state, drq1_w)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, rxa_w)) + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_PORT_ADD(RS232_C_TAG, default_rs232_devices, NULL) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, ctsb_w)) + + MCFG_DEVICE_ADD(KB_TAG, MM1_KEYBOARD, 2500) // actual KBCLK is XTAL_6_144MHz/2/16 + MCFG_MM1_KEYBOARD_KBST_CALLBACK(DEVWRITELINE(I8212_TAG, i8212_device, stb_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "mm1_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( mm1m6 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( mm1m6, mm1 ) + // video hardware + MCFG_FRAGMENT_ADD(mm1m6_video) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( mm1m7 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( mm1m7, mm1 ) + // video hardware + MCFG_FRAGMENT_ADD(mm1m6_video) + + // TODO hard disk +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( mm1m6 ) +//------------------------------------------------- + +ROM_START( mm1m6 ) + ROM_REGION( 0x4000, I8085A_TAG, 0 ) // BIOS + ROM_LOAD( "9081b.ic2", 0x0000, 0x2000, CRC(2955feb3) SHA1(946a6b0b8fb898be3f480c04da33d7aaa781152b) ) + + ROM_REGION( 0x200, "address", 0 ) // address decoder + ROM_LOAD( "720793a.ic24", 0x0000, 0x0200, CRC(deea87a6) SHA1(8f19e43252c9a0b1befd02fc9d34fe1437477f3a) ) + + ROM_REGION( 0x1000, "chargen", 0 ) // character generator + ROM_LOAD( "6807b.ic61", 0x0000, 0x1000, CRC(32b36220) SHA1(8fe7a181badea3f7e656dfaea21ee9e4c9baf0f1) ) +ROM_END + + +//------------------------------------------------- +// ROM( mm1m7 ) +//------------------------------------------------- + +#define rom_mm1m7 rom_mm1m6 + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1981, mm1m6, 0, 0, mm1m6, mm1, driver_device, 0, "Nokia Data", "MikroMikko 1 M6", MACHINE_SUPPORTS_SAVE ) +COMP( 1981, mm1m7, mm1m6, 0, mm1m7, mm1, driver_device, 0, "Nokia Data", "MikroMikko 1 M7", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/mikrosha.c b/src/mame/drivers/mikrosha.c new file mode 100644 index 00000000000..8320400b4de --- /dev/null +++ b/src/mame/drivers/mikrosha.c @@ -0,0 +1,281 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Mikrosha driver by Miodrag Milanovic + + 05/06/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/wave.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "imagedev/cassette.h" +#include "formats/rk_cas.h" +#include "includes/radio86.h" + + +class mikrosha_state : public radio86_state +{ +public: + mikrosha_state(const machine_config &mconfig, device_type type, const char *tag) + : radio86_state(mconfig, type, tag), + m_cart(*this, "cartslot") + { } + DECLARE_WRITE_LINE_MEMBER(mikrosha_pit_out2); + I8275_DRAW_CHARACTER_MEMBER(display_pixels); + DECLARE_MACHINE_RESET(mikrosha); + +protected: + required_device m_cart; +}; + +MACHINE_RESET_MEMBER(mikrosha_state,mikrosha) +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0x8000+m_cart->get_rom_size()-1, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + MACHINE_RESET_CALL_MEMBER(radio86); +} + +/* Address maps */ +static ADDRESS_MAP_START(mikrosha_mem, AS_PROGRAM, 8, mikrosha_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM + AM_RANGE( 0xc000, 0xc003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x07fc) + AM_RANGE( 0xc800, 0xc803 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x07fc) + AM_RANGE( 0xd000, 0xd001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x07fe) // video + AM_RANGE( 0xd800, 0xd803 ) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) AM_MIRROR(0x07fc) // Timer + AM_RANGE( 0xe000, 0xf7ff ) AM_READ(radio_cpu_state_r) // Not connected + AM_RANGE( 0xf800, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mikrosha_io , AS_IO, 8, mikrosha_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00, 0xff ) AM_READWRITE(radio_io_r,radio_io_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mikrosha ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\\') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Center") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('~') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgDn") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + +WRITE_LINE_MEMBER(mikrosha_state::mikrosha_pit_out2) +{ +} + +I8275_DRAW_CHARACTER_MEMBER(mikrosha_state::display_pixels) +{ + int i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + const UINT8 *charmap = m_charmap + (m_mikrosha_font_page & 1) * 0x400; + UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; + if(linecount == 8) + pixels = 0; + if (vsp) { + pixels = 0; + } + if (lten) { + pixels = 0xff; + } + if (rvv) { + pixels ^= 0xff; + } + for(i=0;i<6;i++) { + bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + } +} + +/* F4 Character Displayer */ +static const gfx_layout mikrosha_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( mikrosha ) + GFXDECODE_ENTRY( "gfx1", 0x0000, mikrosha_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( mikrosha, mikrosha_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, XTAL_16MHz / 9) + MCFG_CPU_PROGRAM_MAP(mikrosha_mem) + MCFG_CPU_IO_MAP(mikrosha_io) + + MCFG_MACHINE_RESET_OVERRIDE(mikrosha_state, mikrosha) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_OUT_PORTB_CB(WRITE8(radio86_state, mikrosha_8255_font_page_w)) + + MCFG_DEVICE_ADD("i8275", I8275, XTAL_16MHz / 12) + MCFG_I8275_CHARACTER_WIDTH(6) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(mikrosha_state, display_pixels) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma8257",i8257_device, dreq2_w)) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(0) + MCFG_PIT8253_CLK1(0) + MCFG_PIT8253_CLK2(2000000) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mikrosha_state, mikrosha_pit_out2)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(78*6, 30*10) + MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mikrosha) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(mikrosha_state,radio86) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(radio86_state, hrq_w)) + MCFG_I8257_IN_MEMR_CB(READ8(radio86_state, memory_read_byte)) + MCFG_I8257_OUT_MEMW_CB(WRITE8(radio86_state, memory_write_byte)) + MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("i8275", i8275_device, dack_w)) + MCFG_I8257_REVERSE_RW_MODE(1) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rkm_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("mikrosha_cass") + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mikrosha_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "mikrosha_cass") + MCFG_SOFTWARE_LIST_ADD("cart_list", "mikrosha_cart") +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( mikrosha ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mikrosha.rom", 0xf800, 0x0800, CRC(86a83556) SHA1(94b1baad0a419145939a891ff51f4324e8e4ddd2)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("mikrosha.fnt", 0x0000, 0x0800, CRC(b315da1c) SHA1(b5bf9abc0fff75b1aba709a7f08b23d4a89bb04b)) +ROM_END + +ROM_START( m86rk ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "m86rk.bin", 0xf800, 0x0800, CRC(a898d77a) SHA1(c2497bf8434b5028fe0a9fc09be311465d5553a5)) + ROM_REGION(0x0800, "gfx1",0) + /* here should probably be different rom */ + ROM_LOAD ("mikrosha.fnt", 0x0000, 0x0800, CRC(b315da1c) SHA1(b5bf9abc0fff75b1aba709a7f08b23d4a89bb04b)) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, mikrosha, radio86,0, mikrosha, mikrosha, radio86_state, radio86, "Lianozovo Electromechanical Factory", "Mikrosha", 0) +COMP( 1987, m86rk, radio86,0, mikrosha, mikrosha, radio86_state, radio86, "", "Mikrosha-86RK", 0) diff --git a/src/mame/drivers/mini2440.c b/src/mame/drivers/mini2440.c new file mode 100644 index 00000000000..c9402e57a9c --- /dev/null +++ b/src/mame/drivers/mini2440.c @@ -0,0 +1,275 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/******************************************************************************* + + FriendlyARM Mini2440 + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "machine/s3c2440.h" +#include "machine/smartmed.h" +#include "sound/dac.h" +#include "rendlay.h" + +#define VERBOSE_LEVEL ( 0 ) + +class mini2440_state : public driver_device +{ +public: + mini2440_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_s3c2440(*this, "s3c2440"), + m_nand(*this, "nand"), + m_dac1(*this, "dac1"), + m_dac2(*this, "dac2"), + m_penx(*this, "PENX"), + m_peny(*this, "PENY") { } + + required_device m_maincpu; + required_device m_s3c2440; + required_device m_nand; + required_device m_dac1; + required_device m_dac2; + required_ioport m_penx; + required_ioport m_peny; + + UINT32 m_port[9]; + DECLARE_DRIVER_INIT(mini2440); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(mini2440_input_changed); + inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); + DECLARE_READ32_MEMBER(s3c2440_gpio_port_r); + DECLARE_WRITE32_MEMBER(s3c2440_gpio_port_w); + DECLARE_READ32_MEMBER(s3c2440_core_pin_r); + DECLARE_WRITE8_MEMBER(s3c2440_nand_command_w ); + DECLARE_WRITE8_MEMBER(s3c2440_nand_address_w ); + DECLARE_READ8_MEMBER(s3c2440_nand_data_r ); + DECLARE_WRITE8_MEMBER(s3c2440_nand_data_w ); + DECLARE_WRITE16_MEMBER(s3c2440_i2s_data_w ); + DECLARE_READ32_MEMBER(s3c2440_adc_data_r ); + +}; + +inline void mini2440_state::verboselog(int n_level, const char *s_fmt, ...) +{ + if (VERBOSE_LEVEL >= n_level) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt); + vsprintf( buf, s_fmt, v); + va_end( v); + logerror( "%s: %s", machine().describe_context(), buf); + } +} + +/*************************************************************************** + MACHINE HARDWARE +***************************************************************************/ + +// GPIO + +READ32_MEMBER(mini2440_state::s3c2440_gpio_port_r) +{ + UINT32 data = m_port[offset]; + switch (offset) + { + case S3C2440_GPIO_PORT_G : + { + data = (data & ~(1 << 13)) | (1 << 13); // [nand] 1 = 2048 byte page (if ncon = 1) + data = (data & ~(1 << 14)) | (1 << 14); // [nand] 1 = 5 address cycle (if ncon = 1) + data = (data & ~(1 << 15)) | (0 << 15); // [nand] 0 = 8-bit bus width (if ncon = 1) + data = data | 0x8E9; // for "load Image of Linux..." + } + break; + } + return data; +} + +WRITE32_MEMBER(mini2440_state::s3c2440_gpio_port_w) +{ + m_port[offset] = data; + switch (offset) + { + case S3C2440_GPIO_PORT_B : + { + verboselog(5, "LED %d %d %d %d\n", BIT( data, 5), BIT( data, 6), BIT( data, 7), BIT( data, 8)); + } + break; + } +} + +// CORE + +/* + +OM[1:0] = 00: Enable NAND flash memory boot + +NCON: NAND flash memory selection (Normal / Advance) +0: Normal NAND flash (256Words/512Bytes page size, 3/4 address cycle) +1: Advance NAND flash (1KWords/2KBytes page size, 4/5 address cycle) + +*/ + +READ32_MEMBER(mini2440_state::s3c2440_core_pin_r) +{ + int data = 0; + switch (offset) + { + case S3C2440_CORE_PIN_NCON : data = 1; break; + case S3C2440_CORE_PIN_OM0 : data = 0; break; + case S3C2440_CORE_PIN_OM1 : data = 0; break; + } + return data; +} + +// NAND + +WRITE8_MEMBER(mini2440_state::s3c2440_nand_command_w ) +{ + m_nand->command_w(data); +} + +WRITE8_MEMBER(mini2440_state::s3c2440_nand_address_w ) +{ + m_nand->address_w(data); +} + +READ8_MEMBER(mini2440_state::s3c2440_nand_data_r ) +{ + return m_nand->data_r(); +} + +WRITE8_MEMBER(mini2440_state::s3c2440_nand_data_w ) +{ + m_nand->data_w(data); +} + +// I2S + +WRITE16_MEMBER(mini2440_state::s3c2440_i2s_data_w ) +{ + if ( offset ) + m_dac1->write_signed16(data + 0x8000); + else + m_dac2->write_signed16(data + 0x8000); +} + +// ADC + +READ32_MEMBER(mini2440_state::s3c2440_adc_data_r ) +{ + UINT32 data = 0; + switch (offset) + { + case 2 + 0 : data = m_penx->read(); break; + case 2 + 1 : data = 915 - m_peny->read() + 90; break; + } + verboselog(5, "s3c2440_adc_data_r %08X\n", data); + return data; +} + +// TOUCH + +INPUT_CHANGED_MEMBER(mini2440_state::mini2440_input_changed) +{ + m_s3c2440->s3c2440_touch_screen( (newval & 0x01) ? 1 : 0); +} + +// ... + +void mini2440_state::machine_start() +{ + m_nand->set_data_ptr(memregion("nand")->base()); +} + +void mini2440_state::machine_reset() +{ + m_maincpu->reset(); + memset( m_port, 0, sizeof( m_port)); +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( mini2440_map, AS_PROGRAM, 32, mini2440_state ) +// AM_RANGE(0x00000000, 0x001fffff) AM_ROM + AM_RANGE(0x30000000, 0x37ffffff) AM_RAM +ADDRESS_MAP_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +DRIVER_INIT_MEMBER(mini2440_state,mini2440) +{ + // do nothing +} + +static MACHINE_CONFIG_START( mini2440, mini2440_state ) + MCFG_CPU_ADD("maincpu", ARM920T, 400000000) + MCFG_CPU_PROGRAM_MAP(mini2440_map) + + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1024, 768) + MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 319) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_SCREEN_UPDATE_DEVICE("s3c2440", s3c2440_device, screen_update) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("dac1", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) + MCFG_SOUND_ADD("dac2", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + + MCFG_DEVICE_ADD("s3c2440", S3C2440, 12000000) + MCFG_S3C2440_PALETTE("palette") + MCFG_S3C2440_CORE_PIN_R_CB(READ32(mini2440_state, s3c2440_core_pin_r)) + MCFG_S3C2440_GPIO_PORT_R_CB(READ32(mini2440_state, s3c2440_gpio_port_r)) + MCFG_S3C2440_GPIO_PORT_W_CB(WRITE32(mini2440_state, s3c2440_gpio_port_w)) + MCFG_S3C2440_ADC_DATA_R_CB(READ32(mini2440_state, s3c2440_adc_data_r)) + MCFG_S3C2440_I2S_DATA_W_CB(WRITE16(mini2440_state, s3c2440_i2s_data_w)) + MCFG_S3C2440_NAND_COMMAND_W_CB(WRITE8(mini2440_state, s3c2440_nand_command_w)) + MCFG_S3C2440_NAND_ADDRESS_W_CB(WRITE8(mini2440_state, s3c2440_nand_address_w)) + MCFG_S3C2440_NAND_DATA_R_CB(READ8(mini2440_state, s3c2440_nand_data_r)) + MCFG_S3C2440_NAND_DATA_W_CB(WRITE8(mini2440_state, s3c2440_nand_data_w)) + + MCFG_DEVICE_ADD("nand", NAND, 0) + MCFG_NAND_TYPE(NAND_CHIP_K9F1G08U0B) + MCFG_NAND_RNB_CALLBACK(DEVWRITELINE("s3c2440", s3c2440_device, frnb_w)) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( mini2440 ) + PORT_START( "PENB" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Pen Button") PORT_CHANGED_MEMBER(DEVICE_SELF, mini2440_state, mini2440_input_changed, NULL) PORT_PLAYER(1) + PORT_START( "PENX" ) + PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_X ) PORT_NAME("Pen X") PORT_MINMAX(80, 950) PORT_SENSITIVITY(50) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_KEYDELTA(30) PORT_PLAYER(1) + PORT_START( "PENY" ) + PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_Y ) PORT_NAME("Pen Y") PORT_MINMAX(90, 915) PORT_SENSITIVITY(50) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_KEYDELTA(30) PORT_PLAYER(1) +INPUT_PORTS_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +ROM_START( mini2440 ) + ROM_REGION( 0x8400000, "nand", 0 ) + ROM_SYSTEM_BIOS( 0, "linux", "Linux 2.6.29.4-FriendlyARM + Qtopia 2.2.0 (2009/07/08)" ) + ROMX_LOAD( "linux.bin", 0, 0x8400000, CRC(7c98b249) SHA1(7c2e76edcbbcbfc3f3b0e53fb42d3e5c96e9a9fb), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "wince", "Windows Embedded CE 6.00 (2011/03/14)" ) + ROMX_LOAD( "wince.bin", 0, 0x8400000, CRC(6acd56b8) SHA1(d039968820348fb1169827fa12b38b94e80a076f), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "android", "Android 1.5 (2009/05/13)" ) + ROMX_LOAD( "android.bin", 0, 0x8400000, CRC(4721837d) SHA1(88fcf553b106d9fc624c9615d9c1da9c705ccb46), ROM_BIOS(3) ) +ROM_END + +COMP(2009, mini2440, 0, 0, mini2440, mini2440, mini2440_state, mini2440, "FriendlyARM", "Mini2440", 0) diff --git a/src/mame/drivers/minicom.c b/src/mame/drivers/minicom.c new file mode 100644 index 00000000000..f5ac1f0aed4 --- /dev/null +++ b/src/mame/drivers/minicom.c @@ -0,0 +1,254 @@ +// license:GPL-2.0+ +// copyright-holders: Felipe Sanches +/*************************************************************************** + + Ultratec Minicom IV + http://www.ultratec.com/ttys/non-printing/minicom.php + + Driver by Felipe Sanches + +There messages are displayed in a 20 digit 14 segment VFD. + + *********** + * * * * * + * * * * * + * * * * * + ***** ***** + * * * * * + * * * * * + * * * * * + *********** * + +Digits seem to be selected by a mux fed by a counter that is incremented by pulses in P1.2 +There may be a bit connected to the counter reset signal... + +Segment data is sent to each 14seg digit by first writing half of the data to port P0 and + toggling T0 and then the other half of data is written to P0 again but toggling T1 afterwards. + + Changelog: + + 2014 JUL 22 [Felipe Sanches]: + * Fixing alignment of 14-seg display multiplexation + + 2014 JUL 19 [Felipe Sanches]: + * Got the display working except for a few glitches + + 2014 JUL 16 [Felipe Sanches]: + * Initial driver skeleton +*/ + +#define LOG_IO_PORTS 0 +#define PRINTER_ATTACHED 1 + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "minicom.lh" + +class minicom_state : public driver_device +{ +public: + minicom_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + + DECLARE_WRITE8_MEMBER(minicom_io_w); + DECLARE_READ8_MEMBER(minicom_io_r); + DECLARE_DRIVER_INIT(minicom); +private: + UINT8 m_p[4]; + UINT16 m_display_data; + int m_digit_index; + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(i87c52_io, AS_IO, 8, minicom_state) + AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(minicom_io_r, minicom_io_w) +ADDRESS_MAP_END + +void minicom_state::machine_start() +{ + // zerofill + memset(m_p, 0, 4); + m_digit_index = 0; + m_display_data = 0; + + // register for savestates + save_item(NAME(m_p)); + save_item(NAME(m_digit_index)); + save_item(NAME(m_display_data)); +} + +void minicom_state::machine_reset() +{ + m_digit_index = 19; + m_display_data = 0; + + for (int i=0; i<20; i++) + output_set_digit_value(i, 0); +} + +READ8_MEMBER(minicom_state::minicom_io_r) +{ + switch (offset) + { + case 1: + //P1.3 seems to be an indicator of whether or not we have a printer device attached. + // at address 0xABF the code checks this flag in order to decide which string to display: + // "MINIPRINT IS RESET" or "MINICOM IS RESET" + return PRINTER_ATTACHED << 3; + case 2: +// return 0; //para a palestra no Garoa... :-) + return 1; //to skip the "NO POWER" warning. I'm not sure why. + default: +#if LOG_IO_PORTS + printf("Unhandled I/O Read at offset 0x%02X (return 0)\n", offset); +#endif + return 0; + } +} + +#if LOG_IO_PORTS +static void printbits(UINT8 v) { + int i; + for(i = 7; i >= 0; i--) putchar('0' + ((v >> i) & 1)); +} +#endif + +#define FALLING_EDGE(old_data, new_data, bit) (BIT(old_data ^ new_data, bit) && !BIT(new_data, bit)) +#define RISING_EDGE(old_data, new_data, bit) (BIT(old_data ^ new_data, bit) && BIT(new_data, bit)) + +#define P1_UNKNOWN_BITS (0xFF & ~(1 << 2)) +#define P2_UNKNOWN_BITS 0xFF +#define P3_UNKNOWN_BITS (0xFF & ~((1 << 4)|(1 << 5))) +WRITE8_MEMBER(minicom_state::minicom_io_w) +{ + switch (offset) + { + case 0x00: + { + if (data != m_p[offset]) + { + m_p[offset]=data; + + //Bit P0.1 is the serial-input of a 20-bit shift register (made of a couple of chained UCN5810AF chips) + //We are emulating the display based on the assumption that the firmware will multiplex it by defining one digit at a given time + //It would be better (in terms of being closer to the actual hardware) to emulate the 20 bit shift register and update all digits + //for which a bit is TTL high. It seems to me that in the real hardware that would result in dimmer brightness in the display and it + //does not seem trivial to me to implement this using our current layout system. I'm leaving this note to whoever finds it exciting + //to explore these possibilities (perhaps myself in the future?). + if (BIT(data,1)){ + m_digit_index = 0; + } + } + break; + } + case 0x01: + { + if (data != m_p[offset]) + { +#if LOG_IO_PORTS + UINT8 changed = m_p[offset] ^ data; + if (changed ^ P1_UNKNOWN_BITS) + { + printf("Write to P1: %02X changed: ( ) (", data); + printbits(changed); + printf(") ( ) ( )\n"); + } +#endif + if (FALLING_EDGE(m_p[offset], data, 2)) + { + m_digit_index--; + if (m_digit_index<0) m_digit_index = 19; + } + m_p[offset]=data; + } + break; + } + case 0x02: + { + if (data != m_p[offset]) + { +#if LOG_IO_PORTS + UINT8 changed = m_p[offset] ^ data; + if (changed ^ P2_UNKNOWN_BITS) + { + printf("Write to P2: %02X changed: ( ) ( ) (", data); + printbits(changed); + printf(") ( )\n"); + } +#endif + m_p[offset]=data; + } + break; + } + case 0x03: + { + if (data != m_p[offset]) + { + UINT8 changed = m_p[offset] ^ data; +#if LOG_IO_PORTS + if (changed ^ P3_UNKNOWN_BITS) + { + printf("Write to P3: %02X changed: ( ) ( ) ( ) (", data); + printbits(changed); + printf(")\n"); + } +#endif + + if (FALLING_EDGE(m_p[offset], data, 4)) //P3.4 = T0 + { + m_display_data &= 0xFF00; + m_display_data |= m_p[0]; + } + + if (FALLING_EDGE(m_p[offset], data, 5)) //P3.5 = T1 + { + m_display_data &= 0xFF; + m_display_data |= (m_p[0] << 8); + } + + if (BIT(changed,4) || BIT(changed,5)) + { + output_set_digit_value(m_digit_index, BITSWAP16(m_display_data, 9, 1, 3, 11, 12, 4, 2, 10, 14, 6, 7, 5, 0, 15, 13, 8) & 0x3FFF); + } + m_p[offset]=data; + } + break; + } + } +} + +DRIVER_INIT_MEMBER( minicom_state, minicom ) +{ +} + +static MACHINE_CONFIG_START( minicom, minicom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I87C52, XTAL_10MHz) /*FIX-ME: verify the correct clock frequency */ + MCFG_CPU_IO_MAP(i87c52_io) + + /* video hardware */ + /* fluorescent 14-segment display forming a row of 20 characters */ + MCFG_DEFAULT_LAYOUT(layout_minicom) + +/* TODO: Map the keyboard rows/cols inputs (43-key, 4-row keyboard) */ + +/* TODO: Treat the modem as a sound device. That may be an interesting challenge... :-) */ +MACHINE_CONFIG_END + +ROM_START( minicom ) + ROM_REGION( 0x2000, "maincpu", 0 ) + ROM_LOAD( "ultratec_minicom_iv.rom", 0x0000, 0x2000, CRC(22881366) SHA1(fc3faea5ecc1476e5bcb7999638f3150d06c9a81) ) +ROM_END + +ROM_START( mcom4_02 ) + ROM_REGION( 0x2000, "maincpu", 0 ) + ROM_LOAD( "ultratec_minicom_iv_20020419.rom", 0x0000, 0x2000, CRC(99b6cc35) SHA1(32577005bf02042f893c8880f8ce5b3d8a5f55f9) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1997, minicom, 0, 0, minicom, 0, minicom_state, minicom, "Ultratec", "Minicom IV (1997-08-11)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) /* fw release data: 11th Aug 1997 */ +COMP( 2002, mcom4_02, 0, 0, minicom, 0, minicom_state, minicom, "Ultratec", "Minicom IV (2002-04-19)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) /* fw release data: 19th Apr 2002 */ diff --git a/src/mame/drivers/mits680b.c b/src/mame/drivers/mits680b.c new file mode 100644 index 00000000000..f0f0d24ed15 --- /dev/null +++ b/src/mame/drivers/mits680b.c @@ -0,0 +1,117 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + MITS Altair 680b + + 03/12/2009 Skeleton driver. + + 08/June/2011 connected to a terminal + +Monitor Commands: +J +L switch to terminal mode +M +N modify memory in a limited way +P this does a rti and causes a momentary crash. Weird. + + +ToDo: +- Hook ACIA back up, when there is some way to use it. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "machine/mos6551.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class mits680b_state : public driver_device +{ +public: + mits680b_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(terminal_status_r); + DECLARE_READ8_MEMBER(terminal_r); + DECLARE_READ8_MEMBER(status_check_r); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_term_data; + virtual void machine_reset(); +}; + +READ8_MEMBER( mits680b_state::status_check_r ) +{ + return 0; // crashes at start if bit 7 high +} + +READ8_MEMBER( mits680b_state::terminal_status_r ) +{ + return (m_term_data) ? 3 : 2; +} + +READ8_MEMBER( mits680b_state::terminal_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + + +static ADDRESS_MAP_START(mits680b_mem, AS_PROGRAM, 8, mits680b_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x03ff ) AM_RAM // 1024 bytes RAM + //AM_RANGE( 0xf000, 0xf003 ) AM_DEVREADWRITE("acia", mos6551_device, read, write ) + AM_RANGE( 0xf000, 0xf000 ) AM_READ(terminal_status_r) + AM_RANGE( 0xf001, 0xf001 ) AM_READ(terminal_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE( 0xf002, 0xf002 ) AM_READ(status_check_r) + AM_RANGE( 0xff00, 0xffff ) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mits680b ) +INPUT_PORTS_END + + +void mits680b_state::machine_reset() +{ + m_term_data = 0; +} + +WRITE8_MEMBER( mits680b_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( mits680b, mits680b_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6800, XTAL_1MHz / 2) + MCFG_CPU_PROGRAM_MAP(mits680b_mem) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mits680b_state, kbd_put)) + + /* acia */ + //MCFG_ACIA6551_ADD("acia") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mits680b ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mits680b.bin", 0xff00, 0x0100, CRC(397e717f) SHA1(257d3eb1343b8611dc05455aeed33615d581f29c)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1976, mits680b, 0, 0, mits680b, mits680b, driver_device, 0, "MITS", "Altair 680b", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mk1.c b/src/mame/drivers/mk1.c new file mode 100644 index 00000000000..22d18396d2c --- /dev/null +++ b/src/mame/drivers/mk1.c @@ -0,0 +1,209 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + + mk1.c + +Driver file to handle emulation of the Novag/Videomaster Chess Champion MK 1 +by PeT mess@utanet.at 2000,2001. + +Minor updates by Wilbert Pol - 2007 + +Hardware descriptions: +- An F8 3850 CPU accompanied by a 3853 memory interface + Variations seen: + - MOSTEK MK 3853N 7915 Philippines ( static memory interface for f8) + - MOSTEK MK 3850N-3 7917 Philipines (fairchild f8 cpu) + - 3850PK F7901 SINGAPORE (Fairchild F8 CPU) + - 3853PK F7851 SINGAPORE (static memory interface for F8) +- 2KB 2316 compatible ROM + Variations seen: + - Signetics 7916E C48091 82S210-1 COPYRIGHT + - RO-3-8316A 8316A-4480 7904 TAIWAN +- 2 x 2111 256x4 SRAM to provide 256 bytes of RAM + Variations seen: + - AM9111 BPC / P2111A-4 7851 +- 16 keys placed in a 4 x 4 matrix +- Power on switch +- L/S switch. This switch is directly tied to the RESET pin of the F8 CPU. + This allows the user to reset the CPU without destroying the RAM contents. +- A 4 character 11 segment digit display using a 15 pin interface. Of the 15 + pins 3 pins are not connected, so three segments are never used and this + leaves a standard 7 segments display with a dot in the lower right. +- The digit display is driven by two other components: + - SN75492N MALAYSIA 7840B + - ULN2033A 7847 +- Hardware addressing is controlled by a NBF4001AE. +- Unknown if there is a speaker. + +TODO: +- Figure out exact clock frequency + +******************************************************************************/ + +#include "emu.h" +#include "cpu/f8/f8.h" +#include "machine/f3853.h" +#include "mk1.lh" + + +class mk1_state : public driver_device +{ +public: + mk1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_READ8_MEMBER(mk1_f8_r); + DECLARE_WRITE8_MEMBER(mk1_f8_w); + UINT8 m_f8[2]; + UINT8 m_led[4]; + virtual void machine_start(); + TIMER_DEVICE_CALLBACK_MEMBER(mk1_update_leds); + F3853_INTERRUPT_REQ_CB(mk1_interrupt); + required_device m_maincpu; +}; + + +#define MAIN_CLOCK 1000000 + + +READ8_MEMBER( mk1_state::mk1_f8_r ) +{ + UINT8 i, data = m_f8[offset]; + + if ( offset == 0 ) + { + if (BIT(data, 0)) data |= ioport("LINE1")->read(); + if (BIT(data, 1)) data |= ioport("LINE2")->read(); + if (BIT(data, 2)) data |= ioport("LINE3")->read(); + if (BIT(data, 3)) data |= ioport("LINE4")->read(); + + for (i = 4; i < 8; i++) + { + if (BIT(data, i)) + { + if (BIT(ioport("LINE1")->read(), i)) data |= 1; + if (BIT(ioport("LINE2")->read(), i)) data |= 2; + if (BIT(ioport("LINE3")->read(), i)) data |= 4; + if (BIT(ioport("LINE4")->read(), i)) data |= 8; + } + } + } + return data; +} + +WRITE8_MEMBER( mk1_state::mk1_f8_w ) +{ + /* 0 is high and allows also input */ + m_f8[offset] = data; + + if ( ! ( m_f8[1] & 1 ) ) m_led[0] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 2 ) ) m_led[1] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 4 ) ) m_led[2] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 8 ) ) m_led[3] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 ); +} + +static ADDRESS_MAP_START( mk1_mem, AS_PROGRAM, 8, mk1_state ) + AM_RANGE( 0x0000, 0x07ff ) AM_ROM + AM_RANGE( 0x1800, 0x18ff ) AM_RAM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( mk1_io, AS_IO, 8, mk1_state ) + AM_RANGE( 0x0, 0x1 ) AM_READWRITE( mk1_f8_r, mk1_f8_w ) + AM_RANGE( 0xc, 0xf ) AM_DEVREADWRITE("f3853", f3853_device, read, write ) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( mk1 ) + PORT_START("RESET") /* 0 */ + PORT_DIPNAME ( 0x01, 0x01, "Switch") + PORT_DIPSETTING( 0, "L" ) + PORT_DIPSETTING( 1, "S" ) + + PORT_START("LINE1") /* 1 */ + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White A King") PORT_CODE(KEYCODE_A) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White B Queen") PORT_CODE(KEYCODE_B) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White C Bishop") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White D PLAY") PORT_CODE(KEYCODE_D) + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("LINE2") /* 2 */ + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White E Knight") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White F Castle") PORT_CODE(KEYCODE_F) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White G Pawn") PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White H md") PORT_CODE(KEYCODE_H) + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("LINE3") /* 3 */ + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 1 King") PORT_CODE(KEYCODE_1) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 2 Queen") PORT_CODE(KEYCODE_2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 3 Bishop") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 4 fp") PORT_CODE(KEYCODE_4) + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("LINE4") /* 4 */ + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 5 Knight") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 6 Castle") PORT_CODE(KEYCODE_6) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 7 Pawn") PORT_CODE(KEYCODE_7) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 8 ep") PORT_CODE(KEYCODE_8) + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +TIMER_DEVICE_CALLBACK_MEMBER(mk1_state::mk1_update_leds) +{ + for (int i = 0; i < 4; i++) + { + output_set_digit_value(i, m_led[i] >> 1); + output_set_led_value(i, m_led[i] & 0x01); + m_led[i] = 0; + } +} + + +void mk1_state::machine_start() +{ +} + + +F3853_INTERRUPT_REQ_CB(mk1_state::mk1_interrupt) +{ + m_maincpu->set_input_line_vector(F8_INPUT_LINE_INT_REQ, addr); + m_maincpu->set_input_line(F8_INPUT_LINE_INT_REQ, level ? ASSERT_LINE : CLEAR_LINE); +} + +static MACHINE_CONFIG_START( mk1, mk1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", F8, MAIN_CLOCK ) /* MK3850 */ + MCFG_CPU_PROGRAM_MAP(mk1_mem) + MCFG_CPU_IO_MAP(mk1_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + + MCFG_DEVICE_ADD("f3853", F3853, MAIN_CLOCK) + MCFG_F3853_EXT_INPUT_CB(mk1_state, mk1_interrupt) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mk1) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", mk1_state, mk1_update_leds, attotime::from_hz(30)) +MACHINE_CONFIG_END + + +ROM_START( ccmk1 ) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("82c210-1", 0x0000, 0x800, CRC(278f7bf3) SHA1(b384c95ba691d52dfdddd35987a71e9746a46170)) +ROM_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +// seams to be developed by mostek (MK) +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1979, ccmk1, 0, 0, mk1, mk1, driver_device, 0, "Computer Electronic", "Chess Champion MK I", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/mk14.c b/src/mame/drivers/mk14.c new file mode 100644 index 00000000000..ba30757020b --- /dev/null +++ b/src/mame/drivers/mk14.c @@ -0,0 +1,163 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Science of Cambridge MK-14 + + 20/11/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/scmp/scmp.h" +#include "machine/ins8154.h" +#include "mk14.lh" + + +class mk14_state : public driver_device +{ +public: + mk14_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(display_w); + virtual void machine_reset(); + required_device m_maincpu; +}; + +/* +000-1FF 512 byte SCIOS ROM Decoded by 0xxx +200-3FF ROM Shadow / Expansion RAM +400-5FF ROM Shadow / Expansion RAM +600-7FF ROM Shadow / Expansion RAM +800-87F 128 bytes I/O chip RAM Decoded by 1xx0 +880-8FF I/O Ports Decoded by 1xx0 +900-9FF Keyboard & Display Decoded by 1x01 +A00-AFF I/O Port & RAM Shadow +B00-BFF 256 bytes RAM (Extended) / VDU RAM Decoded by 1011 +C00-CFF I/O Port & RAM Shadow +D00-DFF Keyboard & Display Shadow +E00-EFF I/O Port & RAM Shadow +F00-FFF 256 bytes RAM (Standard) / VDU RAM Decoded by 1111 + +*/ + + +READ8_MEMBER( mk14_state::keyboard_r ) +{ + if (offset < 8) + { + char kbdrow[6]; + sprintf(kbdrow,"X%X",offset); + return ioport(kbdrow)->read(); + } + else + return 0xff; +} + +WRITE8_MEMBER( mk14_state::display_w ) +{ + if (offset < 8 ) + output_set_digit_value(offset, data); + else + { + //logerror("write %02x to %02x\n",data,offset); + } +} + +static ADDRESS_MAP_START(mk14_mem, AS_PROGRAM, 8, mk14_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x0fff) + AM_RANGE(0x000, 0x1ff) AM_ROM AM_MIRROR(0x600) // ROM + AM_RANGE(0x800, 0x87f) AM_RAM AM_MIRROR(0x600) // 128 I/O chip RAM + AM_RANGE(0x880, 0x8ff) AM_DEVREADWRITE("ic8", ins8154_device, ins8154_r, ins8154_w) AM_MIRROR(0x600) // I/O + AM_RANGE(0x900, 0x9ff) AM_READWRITE(keyboard_r, display_w) AM_MIRROR(0x400) + AM_RANGE(0xb00, 0xbff) AM_RAM // VDU RAM + AM_RANGE(0xf00, 0xfff) AM_RAM // Standard RAM +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( mk14 ) + PORT_START("X0") + PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_START("X1") + PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_START("X2") + PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_START("X3") + PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_START("X4") + PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("AB") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_START("X5") + PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_START("X6") + PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_START("X7") + PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TERM") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) +INPUT_PORTS_END + + +void mk14_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( mk14, mk14_state ) + /* basic machine hardware */ + // IC1 1SP-8A/600 (8060) SC/MP Microprocessor + MCFG_CPU_ADD("maincpu", INS8060, XTAL_4_433619MHz) + MCFG_CPU_PROGRAM_MAP(mk14_mem) + + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mk14) + + /* devices */ + MCFG_DEVICE_ADD("ic8", INS8154, 0) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mk14 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // IC2,3 74S571 512 x 4 bit ROM + ROM_LOAD( "scios.bin", 0x0000, 0x0200, CRC(8b667daa) SHA1(802dc637ce5391a2a6627f76f919b12a869b56ef)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, mk14, 0, 0, mk14, mk14, driver_device, 0, "Science of Cambridge", "MK-14", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mk2.c b/src/mame/drivers/mk2.c new file mode 100644 index 00000000000..cd929668fed --- /dev/null +++ b/src/mame/drivers/mk2.c @@ -0,0 +1,225 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + PeT mess@utanet.at September 2000 + +chess champion mk II + +MOS MPS 6504 2179 +MOS MPS 6530 024 1879 + layout of 6530 dumped with my adapter + 0x1300-0x133f io + 0x1380-0x13bf ram + 0x1400-0x17ff rom + +2x2111 ram (256x4?) +MOS MPS 6332 005 2179 +74145 bcd to decimal encoder (10 low active select lines) +(7400) + +4x 7 segment led display (each with dot) +4 single leds +21 keys + + +83, 84 contains display variables + + +port a + 0..7 led output + 0..6 keyboard input + +port b + 0..5 outputs + 0 speaker out + 6 as chipselect used!? + 7 interrupt out? + + c4, c5, keyboard polling + c0, c1, c2, c3 led output + +Usage: + + under the black keys are operations to be added as first sign + black and white box are only changing the player + + for the computer to start as white + switch to black (h enter) + swap players (g enter) + +******************************************************************************/ + +#include "emu.h" +#include "machine/mos6530.h" +#include "cpu/m6502/m6504.h" +#include "sound/speaker.h" +#include "mk2.lh" + + +class mk2_state : public driver_device +{ +public: + mk2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_miot(*this, "miot") + { } + + required_device m_maincpu; + required_device m_speaker; + required_device m_miot; + DECLARE_READ8_MEMBER(mk2_read_a); + DECLARE_WRITE8_MEMBER(mk2_write_a); + DECLARE_READ8_MEMBER(mk2_read_b); + DECLARE_WRITE8_MEMBER(mk2_write_b); + UINT8 m_led[5]; + virtual void machine_start(); + TIMER_DEVICE_CALLBACK_MEMBER(update_leds); +}; + + +// only lower 12 address bits on bus! +static ADDRESS_MAP_START(mk2_mem , AS_PROGRAM, 8, mk2_state) + AM_RANGE( 0x0000, 0x01ff) AM_RAM // 2 2111, should be mirrored + AM_RANGE( 0x0b00, 0x0b0f) AM_DEVREADWRITE("miot", mos6530_device, read, write) + AM_RANGE( 0x0b80, 0x0bbf) AM_RAM // rriot ram + AM_RANGE( 0x0c00, 0x0fff) AM_ROM // rriot rom + AM_RANGE( 0x1000, 0x1fff) AM_ROM +ADDRESS_MAP_END + +static INPUT_PORTS_START( mk2 ) + PORT_START("EXTRA") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW GAME") PORT_CODE(KEYCODE_F3) // seems to be direct wired to reset + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_START("BLACK") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black A Black") PORT_CODE(KEYCODE_A) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black B Field") PORT_CODE(KEYCODE_B) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black C Time?") PORT_CODE(KEYCODE_C) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black D Time?") PORT_CODE(KEYCODE_D) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black E Time off?") PORT_CODE(KEYCODE_E) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black F LEVEL") PORT_CODE(KEYCODE_F) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black G Swap") PORT_CODE(KEYCODE_G) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black H White") PORT_CODE(KEYCODE_H) + PORT_START("WHITE") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 8") PORT_CODE(KEYCODE_8) +INPUT_PORTS_END + + +TIMER_DEVICE_CALLBACK_MEMBER(mk2_state::update_leds) +{ + int i; + + for (i=0; i<4; i++) + output_set_digit_value(i, m_led[i]); + + output_set_led_value(0, BIT(m_led[4], 3)); + output_set_led_value(1, BIT(m_led[4], 5)); + output_set_led_value(2, BIT(m_led[4], 4)); + output_set_led_value(3, BIT(m_led[4], 4) ? 0 : 1); + + m_led[0]= m_led[1]= m_led[2]= m_led[3]= m_led[4]= 0; +} + +void mk2_state::machine_start() +{ +} + +READ8_MEMBER( mk2_state::mk2_read_a ) +{ + int data=0xff; + int help=ioport("BLACK")->read() | ioport("WHITE")->read(); // looks like white and black keys are the same! + + switch (m_miot->portb_out_get()&0x7) + { + case 4: + if (BIT(help, 5)) data&=~0x1; //F + if (BIT(help, 4)) data&=~0x2; //E + if (BIT(help, 3)) data&=~0x4; //D + if (BIT(help, 2)) data&=~0x8; // C + if (BIT(help, 1)) data&=~0x10; // B + if (BIT(help, 0)) data&=~0x20; // A + break; + case 5: + if (BIT(ioport("EXTRA")->read(), 2)) data&=~0x8; // Enter + if (BIT(ioport("EXTRA")->read(), 1)) data&=~0x10; // Clear + if (BIT(help, 7)) data&=~0x20; // H + if (BIT(help, 6)) data&=~0x40; // G + break; + } + return data; +} + +WRITE8_MEMBER( mk2_state::mk2_write_a ) +{ + UINT8 temp = m_miot->portb_out_get(); + + m_led[temp & 3] |= data; +} + + +READ8_MEMBER( mk2_state::mk2_read_b ) +{ + return 0xff&~0x40; // chip select mapped to pb6 +} + + +WRITE8_MEMBER( mk2_state::mk2_write_b ) +{ + if ((data & 0x06) == 0x06) + m_speaker->level_w(BIT(data, 0)); + + m_led[4]|=data; + + m_maincpu->set_input_line(M6502_IRQ_LINE, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE ); +} + + +static MACHINE_CONFIG_START( mk2, mk2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6504, 1000000) + MCFG_CPU_PROGRAM_MAP(mk2_mem) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mk2) + + MCFG_DEVICE_ADD("miot", MOS6530, 1000000) + MCFG_MOS6530_IN_PA_CB(READ8(mk2_state, mk2_read_a)) + MCFG_MOS6530_OUT_PA_CB(WRITE8(mk2_state, mk2_write_a)) + MCFG_MOS6530_IN_PB_CB(READ8(mk2_state, mk2_read_b)) + MCFG_MOS6530_OUT_PB_CB(WRITE8(mk2_state, mk2_write_b)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", mk2_state, update_leds, attotime::from_hz(60)) +MACHINE_CONFIG_END + + +ROM_START(ccmk2) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("024_1879", 0x0c00, 0x0400, CRC(4f28c443) SHA1(e33f8b7f38e54d7a6e0f0763f2328cc12cb0eade)) + ROM_LOAD("005_2179", 0x1000, 0x1000, CRC(6f10991b) SHA1(90cdc5a15d9ad813ad20410f21081c6e3e481812)) // chess mate 7.5 +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +CONS( 1979, ccmk2, 0, 0, mk2, mk2, driver_device, 0, "Quelle International", "Chess Champion MK II", 0) +// second design sold (same computer/program?) diff --git a/src/mame/drivers/mk85.c b/src/mame/drivers/mk85.c new file mode 100644 index 00000000000..c84df818ed9 --- /dev/null +++ b/src/mame/drivers/mk85.c @@ -0,0 +1,92 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Elektronika MK-85 + + 12/05/2009 Skeleton driver. + + http://www.taswegian.com/MOSCOW/mk-85.html + +This is a Soviet computer-calculator, very similar in looks to the Sharp. +It has a LCD display. + +Models: + MK-85: 2K of RAM + MK-85M: 6K of RAM + MK-85C: Military cryptographic device. Typing text into it produces + a string of numbers. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/t11/t11.h" + + +class mk85_state : public driver_device +{ +public: + mk85_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_mk85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(mk85_mem, AS_PROGRAM, 16, mk85_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x3fff ) AM_ROM AM_MIRROR(0x4000) + AM_RANGE( 0x8000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mk85 ) +INPUT_PORTS_END + + +void mk85_state::machine_reset() +{ +} + +void mk85_state::video_start() +{ +} + +UINT32 mk85_state::screen_update_mk85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( mk85, mk85_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_4MHz) + MCFG_T11_INITIAL_MODE(0) + MCFG_CPU_PROGRAM_MAP(mk85_mem) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(mk85_state, screen_update_mk85) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mk85 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mk85.rom", 0x0000, 0x4000, CRC(398e4fd1) SHA1(5e2f877d0f451b46840f01190004552bad5248c8)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, mk85, 0, 0, mk85, mk85, driver_device, 0, "Elektronika", "MK-85", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mk90.c b/src/mame/drivers/mk90.c new file mode 100644 index 00000000000..3f9249a899f --- /dev/null +++ b/src/mame/drivers/mk90.c @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Elektronika MK-90 + + 12/05/2009 Skeleton driver. + + + http://www.pisi.com.pl/piotr433/index.htm#mk90 + http://www.taswegian.com/MOSCOW/mk-90.html + +This is a Soviet computer-calculator, very similar in looks to the Sharp. +It has a LCD display. It cost about 1500 roubles, which is the wages for 6 +months for an average citizen. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/t11/t11.h" + + +class mk90_state : public driver_device +{ +public: + mk90_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_mk90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(mk90_mem, AS_PROGRAM, 16, mk90_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_RAM // RAM + AM_RANGE(0x4000, 0x7fff) AM_ROM // Extension ROM + AM_RANGE(0x8000, 0xffff) AM_ROM // Main ROM +// AM_RANGE(0xe800, 0xe801) LCD address +// AM_RANGE(0xe802, 0xe803) LCD data +// AM_RANGE(0xe810, 0xe810) serial bus controller data +// AM_RANGE(0xe812, 0xe813) serial bus controller transfer rate +// AM_RANGE(0xe814, 0xe814) serial bus controller control/status +// AM_RANGE(0xe816, 0xe816) serial bus controller command +// AM_RANGE(0xea00, 0xea7e) RTC +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mk90 ) +INPUT_PORTS_END + + +void mk90_state::machine_reset() +{ +} + +void mk90_state::video_start() +{ +} + +UINT32 mk90_state::screen_update_mk90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( mk90, mk90_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_4MHz) + MCFG_T11_INITIAL_MODE(0x8000) + MCFG_CPU_PROGRAM_MAP(mk90_mem) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(mk90_state, screen_update_mk90) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mk90 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "bas1", "Basic 1") + ROMX_LOAD( "mk90ro10.bin", 0x8000, 0x8000, CRC(fac18038) SHA1(639f09a1be5f781f897603d0f799f7c6efd1b67f), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "bas2", "Basic 2") + ROMX_LOAD( "mk90ro20.bin", 0x8000, 0x8000, CRC(d8b3a5f5) SHA1(8f7ab2d97c7466392b6354c0ea7017531c2133ae), ROM_BIOS(2)) + ROMX_LOAD( "mk90ro20t.bin", 0x4000, 0x4000, CRC(0f4b9434) SHA1(c74bbde6d201913c9e67ef8e2abe14b784187f8d), ROM_BIOS(2)) // Expansion ROM +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1988, mk90, 0, 0, mk90, mk90, driver_device, 0, "Elektronika", "MK-90", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mkit09.c b/src/mame/drivers/mkit09.c new file mode 100644 index 00000000000..1e39600ecd1 --- /dev/null +++ b/src/mame/drivers/mkit09.c @@ -0,0 +1,212 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Multitech Microkit09 + + 2013-12-08 Mostly working driver. + + The only documentation is in French, so the operation of the system + is a bit of a mystery. + +ToDo: + - Fix Cassette + - Need software to test with + +Pasting: + 0-F : as is + (inc) : ^ + (dec) : V + M (memory) : - + G (Go) : X + +Test Paste: + -0000 00^11^22^33^44^55^66^77^88^99^--0000 + Now press up-arrow to confirm the data has been entered. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/6821pia.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "mkit09.lh" + + +class mkit09_state : public driver_device +{ +public: + mkit09_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_pia(*this, "pia") + , m_cass(*this, "cassette") + , m_maincpu(*this, "maincpu") + { } + + DECLARE_READ8_MEMBER(pa_r); + DECLARE_READ8_MEMBER(pb_r); + DECLARE_WRITE8_MEMBER(pa_w); + DECLARE_WRITE8_MEMBER(pb_w); + DECLARE_INPUT_CHANGED_MEMBER(trigger_reset); + DECLARE_INPUT_CHANGED_MEMBER(trigger_nmi); +private: + UINT8 m_keydata; + virtual void machine_reset(); + required_device m_pia; + required_device m_cass; + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(mkit09_mem, AS_PROGRAM, 8, mkit09_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0x07ff) AM_MIRROR(0x1800) AM_RAM + AM_RANGE(0xa004,0xa007) AM_MIRROR(0x1ff8) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) + AM_RANGE(0xe000,0xe7ff) AM_MIRROR(0x1800) AM_ROM AM_REGION("roms", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mkit09_io, AS_IO, 8, mkit09_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mkit09 ) + PORT_START("X0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Inc") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Dec") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_M) PORT_CHAR('-') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BP") PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("cnt") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ofs") PORT_CODE(KEYCODE_O) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, mkit09_state, trigger_reset, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NMI") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, mkit09_state, trigger_nmi, 0) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER( mkit09_state::trigger_reset ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER( mkit09_state::trigger_nmi ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + + +void mkit09_state::machine_reset() +{ + m_keydata = 0; +} + +// read keyboard +READ8_MEMBER( mkit09_state::pa_r ) +{ + if (m_keydata < 4) + { + char kbdrow[4]; + sprintf(kbdrow,"X%d",m_keydata); + return ioport(kbdrow)->read(); + } + + return 0xff; +} + +// read cassette +READ8_MEMBER( mkit09_state::pb_r ) +{ + return m_keydata | ((m_cass->input() > +0.03) ? 0x80 : 0); +} + +// write display segments +WRITE8_MEMBER( mkit09_state::pa_w ) +{ + data ^= 0xff; + if (m_keydata > 3) + { + output_set_digit_value(m_keydata, BITSWAP8(data, 7, 0, 5, 6, 4, 2, 1, 3)); + m_keydata = 0; + } + + return; +} + +// write cassette, select keyboard row, select a digit +WRITE8_MEMBER( mkit09_state::pb_w ) +{ + m_cass->output(BIT(data, 6) ? -1.0 : +1.0); + m_keydata = data & 15; + return; +} + + +static MACHINE_CONFIG_START( mkit09, mkit09_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6809E, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(mkit09_mem) + MCFG_CPU_IO_MAP(mkit09_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mkit09) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_DEVICE_ADD("pia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(mkit09_state, pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(mkit09_state, pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(mkit09_state, pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(mkit09_state, pb_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mkit09 ) + ROM_REGION( 0x800, "roms", 0 ) + ROM_LOAD( "micromon.bin", 0x0000, 0x0800, CRC(c993c7c2) SHA1(2f54a2b423b925798f669f8a6d2cadeb8a82e968) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, mkit09, 0, 0, mkit09, mkit09, driver_device, 0, "Multitech", "Microkit09", 0 ) diff --git a/src/mame/drivers/mmd1.c b/src/mame/drivers/mmd1.c new file mode 100644 index 00000000000..99c4f4569b0 --- /dev/null +++ b/src/mame/drivers/mmd1.c @@ -0,0 +1,531 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + MMD-1 & MMD-2 driver by Miodrag Milanovic + + 12/05/2009 Initial version + + 2011-JAN-12 MMD2 working {Robbbert] + +MMD-1 +***** + + It appears that you enter an 3 digit octal number and then hit a function key. + H - puts the number in the H register + L - puts the number in the L register + S - puts the number into memory pointed to by HL and then increments HL. + G - Loads the program counter with the contents of HL + +1) There is a 'working byte' which you can enter using the octal digits +(just press them in order), and which is displayed on the port 2 LEDs +when KEX is running. + +2) 'R' is a hardware reset + +3) 'H' and 'L' are used to load the address (high and low parts, and it +really is the HL register of the 8080). So to enter a particular address, +you type in the high half (in octal), press H. Then type in the low half +and press L. The address is displayed on the port 0 and port 1 LEDs when +KEX is running. + +4) 'S' is 'Step' or 'Store'. It stores the working byte at the current +address (in HL), and then increments the address. It's used to enter +bytes into memory + +5) 'G' is 'go'. It loads the 8080 PC with the address in HL, and thus +executes a program at that address. + +OK, this is what I would try. + +1) Press 'R' to reset the 8080 and start KEX running. + +2) Type 004 H 000 L to load the start address of your program. The bytes +should appear on the rightmost 8 LEDs as you enter them and should then +also appear on the left and middle sets of LEDs when you press H and L. + +3) Enter the program + +076 S 123 S 323 S 000 S 166S + +As you type each byte it should appear on the rightmost LEDs. When you +press S, the address on the rest of the LEDs should increment by 1. + +4) Re-enter the start address +004 H 000 L + +5) Press G to run the program. The left most LEDs should change to +.*.*..** (. = off, * = on), I think. The keys will then do nothing (as +the CPU is halted) until you press R again to re-run KEX. + +When is keyboard LINE3 scanned? it isn't - it's a reset button. + +MMD-2 +***** + +http://www.cs.unc.edu/~yakowenk/classiccmp/mmd2/ +Memory map: + + * 4K RAM addresses $0000..$0FFF + * ROM addresses $D800..$E7FF + * 256 bytes of RAM, ($FC00..$FCFF?) + +DIP switches: + + * WE 0 - Write enable for addresses $0000..$03FF + * WE 1 - Write enable for addresses $0400..$07FF + * WE 2 - Write enable for addresses $0800..$0BFF + * WE 3 - Write enable for addresses $0C00..$0FFF + * SPARE - ??? + * HEX OCT - choose display and entry to be in Hexadecimal or Octal + * PUP RESET - ??? + * EXEC USER - update binary LED's with data entry? Or not? + (in either setting, outputs to ports 0,1,2 still show) + +Operation: + + * Enter bytes on the keypad of hex digits + * Set MSByte of address by entering it on the keypad & pressing "HIGH". + * ... LSByte ... "LOW" + * Change contents of memory at the selected address by entering the new value & pressing "STORE". + * Look at adjacent memory locations with "NEXT" and "PREV". + * Execute the program at the selected address by pressing "GO". + +AUX functions: + + * BRL HI # - OFF disables BRL LO + * BRL LO # + * STEP # + * SRC HI # - source for COPY/DUMP - OFF disables "DUMP" function + * DES HI # - destination for COPY/DUMP + * LEN HI # - length for COPY/DUMP + * CLR TST ON - test if PROM is empty + * POP PRM ON - program a PROM + * DUP TST ON - test if PROM duplicated okay + * PROM 2708/2716 + * MEM MAP RAM/ROM + * BAUD 110/150/300/600/1200 + +The memory map can be rearranged by the system by using IN5, IN6, IN7. +A pair of undumped proms control what goes where on each map. +Each set of ROMs also has its own pair of PROMs. + + +I/O ports: +IN0: user expansion +IN1: 0-TTYIN, 1-CASSIN, 3-SW8(binary/ports), 4-SW7(reset/pup), 5-SW6(hex/oct), 6-(pup signal) +IN3: 8279 status +IN4: 8279 key +IN5: set MAP1 +IN6: set MAP2 +IN7: set MAP3 +IN8: read eprom (in the eprom programmer) +OUT0: PORT0 LEDs +OUT1: PORT1 LEDs +OUT2: PORT2 LEDs +OUT3: 8279 control +OUT4: 8279 7-segment LED data +OUT5: TTYOUT, CASSOUT +OUT9: turn pup signal off +OUTA: programming pulse on/off (eprom programmer) + +Dips: +SW1-4 hardware control of RAM being writable +SW5 not used +SW6 Control if the 7-segment displays show Octal (low) or Hex (high). +SW7 Reset only causes the cpu to perform a warm start. PUP does a cold start (Power-UP). +SW8 Control if the PORT displays echo the 7-segment displays (high), or just act as normal output ports (low). + + +ToDo +- Hook up reset key and dipswitch +- Add interrupt module (INTE LED is always on atm) +- Lots of other things + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8279.h" +#include "mmd1.lh" +#include "mmd2.lh" + + +class mmd1_state : public driver_device +{ +public: + mmd1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_WRITE8_MEMBER(mmd1_port0_w); + DECLARE_WRITE8_MEMBER(mmd1_port1_w); + DECLARE_WRITE8_MEMBER(mmd1_port2_w); + DECLARE_READ8_MEMBER(mmd1_keyboard_r); + DECLARE_READ8_MEMBER(mmd2_01_r); + DECLARE_READ8_MEMBER(mmd2_bank_r); + DECLARE_READ8_MEMBER(mmd2_kbd_r); + DECLARE_WRITE8_MEMBER(mmd2_scanlines_w); + DECLARE_WRITE8_MEMBER(mmd2_digit_w); + DECLARE_WRITE8_MEMBER(mmd2_status_callback); + DECLARE_WRITE_LINE_MEMBER(mmd2_inte_callback); + UINT8 m_return_code; + UINT8 m_digit; + DECLARE_DRIVER_INIT(mmd2); + DECLARE_MACHINE_RESET(mmd1); + DECLARE_MACHINE_RESET(mmd2); + required_device m_maincpu; +}; + + +WRITE8_MEMBER( mmd1_state::mmd1_port0_w ) +{ + output_set_value("p0_7", BIT(data,7) ? 0 : 1); + output_set_value("p0_6", BIT(data,6) ? 0 : 1); + output_set_value("p0_5", BIT(data,5) ? 0 : 1); + output_set_value("p0_4", BIT(data,4) ? 0 : 1); + output_set_value("p0_3", BIT(data,3) ? 0 : 1); + output_set_value("p0_2", BIT(data,2) ? 0 : 1); + output_set_value("p0_1", BIT(data,1) ? 0 : 1); + output_set_value("p0_0", BIT(data,0) ? 0 : 1); +} + +WRITE8_MEMBER( mmd1_state::mmd1_port1_w ) +{ + output_set_value("p1_7", BIT(data,7) ? 0 : 1); + output_set_value("p1_6", BIT(data,6) ? 0 : 1); + output_set_value("p1_5", BIT(data,5) ? 0 : 1); + output_set_value("p1_4", BIT(data,4) ? 0 : 1); + output_set_value("p1_3", BIT(data,3) ? 0 : 1); + output_set_value("p1_2", BIT(data,2) ? 0 : 1); + output_set_value("p1_1", BIT(data,1) ? 0 : 1); + output_set_value("p1_0", BIT(data,0) ? 0 : 1); +} + +WRITE8_MEMBER( mmd1_state::mmd1_port2_w ) +{ + output_set_value("p2_7", BIT(data,7) ? 0 : 1); + output_set_value("p2_6", BIT(data,6) ? 0 : 1); + output_set_value("p2_5", BIT(data,5) ? 0 : 1); + output_set_value("p2_4", BIT(data,4) ? 0 : 1); + output_set_value("p2_3", BIT(data,3) ? 0 : 1); + output_set_value("p2_2", BIT(data,2) ? 0 : 1); + output_set_value("p2_1", BIT(data,1) ? 0 : 1); + output_set_value("p2_0", BIT(data,0) ? 0 : 1); +} + +// keyboard has a keydown and a keyup code. Keyup = last keydown + bit 7 set +READ8_MEMBER( mmd1_state::mmd1_keyboard_r ) +{ + UINT8 line1 = ioport("LINE1")->read(); + UINT8 line2 = ioport("LINE2")->read(); + UINT8 i, data = 0xff; + + + for (i = 0; i < 8; i++) + { + if (!BIT(line1, i)) + data = i; + } + + for (i = 0; i < 8; i++) + { + if (!BIT(line2, i)) + data = i+8; + } + + if (data < 0x10) + { + m_return_code = data | 0x80; + return data; + } + else + return m_return_code; +} + +static ADDRESS_MAP_START(mmd1_mem, AS_PROGRAM, 8, mmd1_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x00ff ) AM_ROM // Main ROM + AM_RANGE( 0x0100, 0x01ff ) AM_ROM // Expansion slot + AM_RANGE( 0x0200, 0x02ff ) AM_RAM + AM_RANGE( 0x0300, 0x03ff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mmd1_io, AS_IO, 8, mmd1_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x07) + AM_RANGE( 0x00, 0x00 ) AM_READWRITE(mmd1_keyboard_r, mmd1_port0_w) + AM_RANGE( 0x01, 0x01 ) AM_WRITE(mmd1_port1_w) + AM_RANGE( 0x02, 0x02 ) AM_WRITE(mmd1_port2_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mmd2_mem, AS_PROGRAM, 8, mmd1_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x03ff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") + AM_RANGE(0x0400, 0x0fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4") + AM_RANGE(0xd800, 0xe3ff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank6") + AM_RANGE(0xe400, 0xe7ff) AM_READ_BANK("bank7") AM_WRITE_BANK("bank8") + AM_RANGE(0xfc00, 0xfcff) AM_RAM // Scratchpad +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mmd2_io, AS_IO, 8, mmd1_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00, 0x00 ) AM_WRITE(mmd1_port0_w) + AM_RANGE( 0x01, 0x01 ) AM_READWRITE(mmd2_01_r,mmd1_port1_w) + AM_RANGE( 0x02, 0x02 ) AM_WRITE(mmd1_port2_w) + AM_RANGE( 0x03, 0x03 ) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) + AM_RANGE( 0x04, 0x04 ) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w) + AM_RANGE( 0x05, 0x07 ) AM_READ(mmd2_bank_r) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( mmd1 ) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) +INPUT_PORTS_END + +static INPUT_PORTS_START( mmd2 ) + PORT_START("DSW") + PORT_BIT( 0x87, 0x00, IPT_UNUSED ) + PORT_DIPNAME( 0x20, 0x00, "Sw6") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x20, "Hex") + PORT_DIPSETTING( 0x00, "Octal") + PORT_DIPNAME( 0x10, 0x00, "Sw7") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x10, "PUP") + PORT_DIPSETTING( 0x00, "Reset") + PORT_DIPNAME( 0x08, 0x08, "Sw8") PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x08, "Exec") + PORT_DIPSETTING( 0x00, "User") + + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CANCEL") PORT_CODE(KEYCODE_X) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("AUX") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REGS") PORT_CODE(KEYCODE_R) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_MINUS) + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PROM") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DUMP") PORT_CODE(KEYCODE_I) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOAD") PORT_CODE(KEYCODE_O) + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OPTION") PORT_CODE(KEYCODE_S) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_G) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOW") PORT_CODE(KEYCODE_L) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HIGH") PORT_CODE(KEYCODE_H) + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PREV") PORT_CODE(KEYCODE_DOWN) + PORT_START("RESET") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F1) +INPUT_PORTS_END + +/* +Keyboard +0 1 2 3 PREV STORE NEXT STEP +4 5 6 7 HIGH LOW GO OPTION +8 9 A B LOAD DUMP PROM COPY +C D E F MEM REGS AUX CANCEL + +*/ + +READ8_MEMBER( mmd1_state::mmd2_bank_r ) +{ + membank("bank1")->set_entry(offset); + membank("bank2")->set_entry(offset); + membank("bank3")->set_entry(offset); + membank("bank4")->set_entry(offset); + membank("bank5")->set_entry(offset); + membank("bank6")->set_entry(offset); + membank("bank7")->set_entry(offset); + membank("bank8")->set_entry(offset); + return 0xff; +} + +READ8_MEMBER( mmd1_state::mmd2_01_r ) +{ + // need to add cassin, ttyin bits + UINT8 data = 0x87; + data |= ioport("DSW")->read(); + return data; +} + +WRITE8_MEMBER( mmd1_state::mmd2_scanlines_w ) +{ + m_digit = data; +} + +WRITE8_MEMBER( mmd1_state::mmd2_digit_w ) +{ + if (m_digit < 9) + output_set_digit_value(m_digit, data); +} + +READ8_MEMBER( mmd1_state::mmd2_kbd_r ) +{ + UINT8 data = 0xff; + + if (m_digit < 4) + { + char kbdrow[6]; + sprintf(kbdrow,"X%X",m_digit); + data = ioport(kbdrow)->read(); + } + return data; +} + +WRITE8_MEMBER( mmd1_state::mmd2_status_callback ) +{ + // operate the HALT LED + output_set_value("led_halt", ~data & I8085_STATUS_HLTA); + // operate the HOLD LED - this should connect to the HLDA pin, + // but it isn't emulated, using WO instead (whatever that does). + output_set_value("led_hold", data & I8085_STATUS_WO); +} + +WRITE_LINE_MEMBER( mmd1_state::mmd2_inte_callback ) +{ + // operate the INTE LED + output_set_value("led_inte", state); +} + +MACHINE_RESET_MEMBER(mmd1_state,mmd1) +{ + m_return_code = 0xff; +} + +MACHINE_RESET_MEMBER(mmd1_state,mmd2) +{ + membank("bank1")->set_entry(0); + membank("bank2")->set_entry(0); + membank("bank3")->set_entry(0); + membank("bank4")->set_entry(0); + membank("bank5")->set_entry(0); + membank("bank6")->set_entry(0); + membank("bank7")->set_entry(0); + membank("bank8")->set_entry(0); +} + +DRIVER_INIT_MEMBER(mmd1_state,mmd2) +{ +/* +We preset all banks here, so that bankswitching will incur no speed penalty. +0000/0400 indicate ROMs, D800/DC00/E400 indicate RAM, 8000 is a dummy write area for ROM banks. +*/ + UINT8 *p_ram = memregion("maincpu")->base(); + membank("bank1")->configure_entry(0, &p_ram[0x0000]); + membank("bank1")->configure_entry(1, &p_ram[0xd800]); + membank("bank1")->configure_entry(2, &p_ram[0x0c00]); + membank("bank2")->configure_entry(0, &p_ram[0x8000]); + membank("bank2")->configure_entry(1, &p_ram[0xd800]); + membank("bank2")->configure_entry(2, &p_ram[0x8000]); + membank("bank3")->configure_entry(0, &p_ram[0x0400]); + membank("bank3")->configure_entry(1, &p_ram[0xdc00]); + membank("bank3")->configure_entry(2, &p_ram[0xdc00]); + membank("bank4")->configure_entry(0, &p_ram[0x8000]); + membank("bank4")->configure_entry(1, &p_ram[0xdc00]); + membank("bank4")->configure_entry(2, &p_ram[0xdc00]); + membank("bank5")->configure_entry(0, &p_ram[0xd800]); + membank("bank5")->configure_entry(1, &p_ram[0x0000]); + membank("bank5")->configure_entry(2, &p_ram[0x0000]); + membank("bank6")->configure_entry(0, &p_ram[0xd800]); + membank("bank6")->configure_entry(1, &p_ram[0x8000]); + membank("bank6")->configure_entry(2, &p_ram[0x8000]); + membank("bank7")->configure_entry(0, &p_ram[0xe400]); + membank("bank7")->configure_entry(1, &p_ram[0x0c00]); + membank("bank7")->configure_entry(2, &p_ram[0xd800]); + membank("bank8")->configure_entry(0, &p_ram[0xe400]); + membank("bank8")->configure_entry(1, &p_ram[0x8000]); + membank("bank8")->configure_entry(2, &p_ram[0xd800]); +} + +static MACHINE_CONFIG_START( mmd1, mmd1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, 6750000 / 9) + MCFG_CPU_PROGRAM_MAP(mmd1_mem) + MCFG_CPU_IO_MAP(mmd1_io) + + MCFG_MACHINE_RESET_OVERRIDE(mmd1_state,mmd1) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mmd1) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( mmd2, mmd1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, 6750000 / 9) + MCFG_CPU_PROGRAM_MAP(mmd2_mem) + MCFG_CPU_IO_MAP(mmd2_io) + MCFG_I8085A_STATUS(WRITE8(mmd1_state, mmd2_status_callback)) + MCFG_I8085A_INTE(WRITELINE(mmd1_state, mmd2_inte_callback)) + + MCFG_MACHINE_RESET_OVERRIDE(mmd1_state,mmd2) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mmd2) + + /* Devices */ + MCFG_DEVICE_ADD("i8279", I8279, 400000) // based on divider + MCFG_I8279_OUT_SL_CB(WRITE8(mmd1_state, mmd2_scanlines_w)) // scan SL lines + MCFG_I8279_OUT_DISP_CB(WRITE8(mmd1_state, mmd2_digit_w)) // display A&B + MCFG_I8279_IN_RL_CB(READ8(mmd1_state, mmd2_kbd_r)) // kbd RL lines + MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key + MCFG_I8279_IN_CTRL_CB(VCC) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mmd1 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "kex.ic15", 0x0000, 0x0100, CRC(434f6923) SHA1(a2af60deda54c8d3f175b894b47ff554eb37e9cb)) +ROM_END + +ROM_START( mmd2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mmd2330.bin", 0x0000, 0x0800, CRC(69a77199) SHA1(6c83093b2c32a558c969f4fe8474b234023cc348)) + ROM_LOAD( "mmd2340.bin", 0x0800, 0x0800, CRC(70681bd6) SHA1(c37e3cf34a75e8538471030bb49b8aed45d00ec3)) + ROM_LOAD( "mmd2350.bin", 0x1000, 0x0800, CRC(359f577c) SHA1(9405ca0c1977721e4540a4017907c06dab08d398)) + ROM_LOAD( "mmd2360.bin", 0x1800, 0x0800, CRC(967e69b8) SHA1(c21ec8bef955806a2c6e1b1c8e9068662fb88038)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1976, mmd1, 0, 0, mmd1, mmd1, driver_device, 0, "E&L Instruments Inc", "MMD-1", MACHINE_NO_SOUND_HW) +COMP( 1976, mmd2, mmd1, 0, mmd2, mmd2, mmd1_state, mmd2, "E&L Instruments Inc", "MMD-2", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/mmodular.c b/src/mame/drivers/mmodular.c new file mode 100644 index 00000000000..17c2d2c3499 --- /dev/null +++ b/src/mame/drivers/mmodular.c @@ -0,0 +1,1911 @@ +// license:??? +// copyright-holders:Dirk Verwiebe, Ralf Schaefer, Cowering +/****************************************************************************** + Mephisto Chess Computers using plugin modules + + Vancouver Chess Computer 68000 (driver recalled) by R. Schaefer (2010) + + (most of the magnetic sensor versions with 680x0 family modules) + + Almeria 68000 12Mhz + Almeria 68020 12Mhz + Lyon 68000 12Mhz + Lyon 68020 12Mhz + Vancouver 68000 12Mhz + Vancouver 68020 12Mhz + Genius 68030 V4.00 33.333 Mhz + Genius 68030 V4.01 33.333 Mhz + Genius 68030 V4.01 33.333x2 Mhz (custom MESS overclocked version for higher ELO) + Berlin Pro 68020 24.576 Mhz (not modular board, but otherwise close to milano) + Berlin Pro (London) 68020 24.576 Mhz (not modular board, but otherwise close to milano) + London 68030 V5.00k 33.333 Mhz (probably the Genius 3/4 update ROM) + + note: The Almeria 68000 is the 'parent' of all these, but Vancouver 68000 is used as parent in the driver. + It was the first to have 'Bavaria' sensors, and will make the other drivers easier when inheriting this + feature later + + + misc non-modular/non-68K boards + + RISC 2500 (Skeleton, does not work, and not sure the same internal chessboard connections are used) + Academy 65C02 4.9152mhz + Monte Carlo IV, Mega IV and any others not listed above have correct ROM/RAM and maybe LCD, not much else for now + + Novag boards: (should go in different .c eventually) + Super Forte and Super Expert are the same, except one is touch board, other is magnetic. + The Diablo 68000 is Super Expert board but 68K based + + Notes by Cowering (2011) + + TODO: add Bavaria sensor support (unknown1,2,3 handlers in current driver) + proper 'bezel' for all games/cpuspeeds so 'Vancouver' does not say 'Almeria', etc + custom handler to read/write the Battery RAM so 68000 can share files with 020/030 (real modular machine can do this) + find a timing to let the player see the flashing LEDs on the 68030 versions (might be fixed with waitstates in core) + add the missing machines.. including all Portorose and the very rare overclocked 'TM' Tournament Machines + match I/S= diag speed test with real hardware (good test for proper waitstates) + load LCD rom inside the LCD driver + + TODO2: (these worked before .140 core) + LCD off by a couple of pixels in artwork now + no longer see the custom white hand when selecting chess pieces + parent/clone for artwork so there are not multiple copies of chessboard+pieces + + + TODO3: Oct 2011 - commented out all ACIA functions until they are ported to new device + + Undocumented buttons: holding ENTER and LEFT cursor on cold boot runs diagnostics on modular 680x0 boards + holding UP and RIGHT cursor will clear the Battery Backed RAM on modular 680x0 boards + holding CLEAR clears Battery Backed RAM on the Berlin (Pro) 68020 +******************************************************************************/ + +/****************************************************************************** + Mephisto Polgar & Milano + 2010 Dirk V., Ralf Schafer, Cowering + +******************************************************************************/ + +/* + +CPU 65C02 P4 4.9152 MHz + +// lese Tastatur von 2c00 - 2c07, +2c00 Trn +2c01 Info +2c02 Mem +2c03 Pos +2c04 Lev +2c05 Fct +2c06 Ent +2c07 CL + +$1ff0 +Bit 0 LCD Command/Data 0/1 +Bit 1 LCD Enable (signals Data is valid) +Bit 2 Beeper +Bit 3 Beeper +Bit 4+7 LED A-H enable +Bit 5+6 LED 1-8 enable +*/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "cpu/m6502/m65c02.h" +#include "cpu/arm/arm.h" +#include "sound/beep.h" +//#include "machine/mos6551.h" +#include "video/hd44780.h" + +#include "rendlay.h" + +#include "includes/mboard.h" +#include "machine/nvram.h" + +//static UINT16 unknown2_data = 0; +// Berlin Pro 68020 +static UINT32 BPL32latch_data = 0; + + +// Mephisto Academy +static UINT8 academyallowNMI = 0; + +//Monte Carlo IV key/board selects + +static UINT8 monteciv_select[2] = { 0xff,0xff }; +static UINT8 montecivtop = 0, montecivbot = 0; +static UINT8 montecivtopnew = 0, montecivbotnew = 0; + +//Mephisto Mega IV latch +UINT8 latch2400 = 0; + +UINT8 diablo68_3c0000 = 0; + +UINT8 sfortea_latch = 0; + + +INPUT_PORTS_EXTERN( chessboard ); + +UINT8 lcd32_char; + +class polgar_state : public mboard_state +{ +public: + polgar_state(const machine_config &mconfig, device_type type, const char *tag) + : mboard_state(mconfig, type, tag), + m_lcdc(*this, "hd44780"), + m_beeper(*this, "beeper") + { } + + optional_device m_lcdc; + optional_device m_beeper; + + UINT8 led_status; + UINT8 lcd_char; + //UINT8 led7; + UINT8 latch_data; + DECLARE_WRITE8_MEMBER(write_polgar_IO); + DECLARE_WRITE8_MEMBER(write_LCD_polgar); + DECLARE_READ8_MEMBER(read_1ff1_sfortea); + DECLARE_READ8_MEMBER(read_1ff0_sfortea); + DECLARE_WRITE8_MEMBER(write_latch_sfortea); + DECLARE_WRITE8_MEMBER(write_lcd_IO_sfortea); + DECLARE_WRITE8_MEMBER(write_LCD_academy); +// DECLARE_WRITE16_MEMBER(diablo68_aciawrite); +// DECLARE_READ16_MEMBER(diablo68_aciaread); + DECLARE_WRITE16_MEMBER(diablo68_reg_select); + DECLARE_WRITE16_MEMBER(diablo68_write_LCD); + DECLARE_WRITE8_MEMBER(milano_write_LED); + DECLARE_WRITE8_MEMBER(megaiv_write_LED); + DECLARE_WRITE8_MEMBER(academy_write_LED); + DECLARE_WRITE8_MEMBER(academy_inhibitNMI); + DECLARE_WRITE32_MEMBER(write_LED_BPL32); + DECLARE_WRITE8_MEMBER(polgar_write_LED); + DECLARE_WRITE8_MEMBER(monteciv_write_LCD); + DECLARE_WRITE8_MEMBER(monteciv_3007); + DECLARE_WRITE8_MEMBER(monteciv_3005); + DECLARE_WRITE8_MEMBER(monteciv_3006); + DECLARE_WRITE8_MEMBER(academy_write_board); + DECLARE_WRITE8_MEMBER(milano_write_board); + DECLARE_READ8_MEMBER(milano_read_board); + DECLARE_READ8_MEMBER(read_keys); + DECLARE_READ8_MEMBER(read_keys_megaiv); + DECLARE_READ32_MEMBER(read_keys_BPL32); + DECLARE_WRITE8_MEMBER(beep_academy); + DECLARE_WRITE8_MEMBER(megaiv_IO); + DECLARE_WRITE8_MEMBER(monteciv_select_line); + DECLARE_READ8_MEMBER(read_keys_board_monteciv); + DECLARE_READ8_MEMBER(read_keys_board_academy); + DECLARE_WRITE32_MEMBER(write_board_BPL32); + DECLARE_READ32_MEMBER(read_buttons_gen32); + DECLARE_READ32_MEMBER(read_buttons_van32); + DECLARE_READ16_MEMBER(read_buttons_van16); + DECLARE_WRITE32_MEMBER(write_LCD_data_32); + DECLARE_WRITE16_MEMBER(write_LCD_data); + DECLARE_WRITE32_MEMBER(write_IOenables_32); + DECLARE_WRITE16_MEMBER(write_IOenables); + DECLARE_READ32_MEMBER(read_unknown1_32); + DECLARE_READ16_MEMBER(read_unknown1); + DECLARE_WRITE32_MEMBER(write_unknown2_32); + DECLARE_WRITE16_MEMBER(write_unknown2); + DECLARE_READ32_MEMBER(read_unknown3_32); + DECLARE_READ16_MEMBER(read_unknown3); + DECLARE_READ32_MEMBER(read_1800000); + DECLARE_WRITE32_MEMBER(write_1000000); + DECLARE_DRIVER_INIT(polgar); + DECLARE_MACHINE_START(polgar); + DECLARE_MACHINE_RESET(polgar); + DECLARE_MACHINE_START(sfortea); + DECLARE_MACHINE_RESET(sfortea); + DECLARE_MACHINE_START(van32); + DECLARE_MACHINE_RESET(van16); + DECLARE_MACHINE_RESET(monteciv); + DECLARE_MACHINE_START(diablo68); + DECLARE_MACHINE_START(van16); + DECLARE_MACHINE_START(risc); + DECLARE_MACHINE_RESET(academy); + DECLARE_PALETTE_INIT(chess_lcd); + TIMER_DEVICE_CALLBACK_MEMBER(cause_nmi); + TIMER_DEVICE_CALLBACK_MEMBER(cause_M6502_irq); + TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq6); + TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq2); + TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq_academy); + void common_chess_start(); + UINT8 convert_imputmask(UINT8 input); + UINT8 convertMCIV2LED(UINT8 codedchar); + void write_IOenable(unsigned char data,address_space &space); +}; + +UINT8 polgar_state::convert_imputmask(UINT8 input) +{ + input^=0xff; + switch (input) { + case 0x01: + return 0x80; + case 0x02: + return 0x40; + case 0x04: + return 0x20; + case 0x08: + return 0x10; + case 0x10: + return 0x08; + case 0x20: + return 0x04; + case 0x40: + return 0x02; + case 0x80: + return 0x01; + default: + return 0x00; + } +} + +WRITE8_MEMBER(polgar_state::write_polgar_IO) +{ + int i; + + if (BIT(data,1)) { + m_lcdc->write(space, BIT(data,0), lcd_char); + } + + if (BIT(data,2) || BIT(data,3)) + m_beeper->set_state(1); + else + m_beeper->set_state(0); + + if (BIT(data,7) && BIT(data, 4)) { + for (i = 0;i < 8;i++) + output_set_led_value(i,!BIT(latch_data,i)); + } + else if (BIT(data,6) && BIT(data,5)) { + for (i = 0;i < 8;i++) + output_set_led_value(10+i,!BIT(latch_data,7-i)); + } + else if (!data && (!strcmp(machine().system().name,"milano"))) { + for (i=0;i<8;i++) { + output_set_led_value(i,!BIT(latch_data,i)); + output_set_led_value(10+i,!BIT(latch_data,7-i)); + } + } + + + //logerror("LCD Status Data = %d\n",data); + +} + + +WRITE8_MEMBER(polgar_state::write_LCD_polgar) +{ + lcd_char = data; + + logerror("LCD Data = %d %02x [%c]\n",data,data,(data&0xff)); + +} + +READ8_MEMBER(polgar_state::read_1ff1_sfortea) +{ + UINT8 data; + data = ioport("BUTTONS_SFOR1")->read(); + logerror("1ff0 data %02x\n",data); + return 0; +// return data; +} + +READ8_MEMBER(polgar_state::read_1ff0_sfortea) +{ + UINT8 data; + data = ioport("BUTTONS_SFOR2")->read(); + logerror("1ff0 data %02x\n",data); + return 0; +// return data; + +// static UINT8 temp = 0; +// temp++; +// logerror("read 1ff0 %02x\n",temp); +// printf("read 1ff0 %02x\n",temp); + +// return (0x00); +} + + + +WRITE8_MEMBER(polgar_state::write_latch_sfortea) +{ + sfortea_latch = data; + logerror("latch data %02x\n",data); +// printf("latch data %02x\n",data); + +} + +WRITE8_MEMBER(polgar_state::write_lcd_IO_sfortea) +{ +/* bits +7 +6 paired with 5 +5 +4 +3 irq on off? +2 select HD44780 +1 +0 LCD command/data select +*/ + + + if (BIT(sfortea_latch,2)) + { + if(BIT(sfortea_latch,0)) { + m_lcdc->data_write(space, 0, data); + logerror("LCD DTA = %02x\n",data); + } else { + if (BIT(data,7)) { + if ((data & 0x7f) >= 0x40) data -= 56; // adjust for 16x1 display as 2 sets of 8 + } + m_lcdc->control_write(space, 0, data); + logerror("LCD CMD = %02x\n",data); + } + } +} + +WRITE8_MEMBER(polgar_state::write_LCD_academy) +{ + m_lcdc->write(space, offset & 1, data); +} + +// AM_RANGE( 0x3a0000,0x3a0000 ) AM_READ(diablo68_write_LCD) +// AM_RANGE( 0x3c0000,0x3c0000 ) AM_READ(diablo68_reg_select) + +/*WRITE16_MEMBER(polgar_state::diablo68_aciawrite) +{ +// device_t *acia = machine().device("acia65c51"); +// acia_6551_w(acia, offset & 0x03, data >> 8); +// printf("ACIA write data %04x offset %02x\n",data,offset); + logerror("ACIA write data %04x offset %02x\n",data,offset); +} + +READ16_MEMBER(polgar_state::diablo68_aciaread) +{ +// device_t *acia = machine().device("acia65c51"); + UINT16 result; +// result = acia_6551_r(acia, offset & 0x03); +// logerror("ACIA read offset %02x\n",offset); +// printf("ACIA read offset %02x\n",offset); + + result <<= 8; + + return result; +} +*/ + +WRITE16_MEMBER(polgar_state::diablo68_reg_select) +{ + diablo68_3c0000 = data >> 8; + //printf("3c0000 = %04x\n",data>>8); + logerror("3c0000 = %04x\n",data>>8); + +} + + +WRITE16_MEMBER(polgar_state::diablo68_write_LCD) +{ + data >>= 8; + if (!(diablo68_3c0000 & 0x02)) { + if (BIT(data,7)) { + if ((data & 0x7f) >= 0x40) data -= 56; // adjust for 16x1 display as 2 sets of 8 + } + m_lcdc->control_write(space, 0, data); +// logerror("Control %02x\n", data); +// printf("Control %02x\n", data); + } else { + m_lcdc->data_write(space, 0, data); +// printf("LCDdata %04x [%c]\n", data,data); +// logerror("LCDdata %04x [%c]\n", data,data); + } + + //logerror("LCD Status Data = %d\n",data); + +} + +WRITE8_MEMBER(polgar_state::milano_write_LED) +{ + UINT8 LED_offset = 100; + if (data == 0xff) output_set_led_value(LED_offset+offset,1); + else output_set_led_value(LED_offset+offset,0); + + //logerror("LEDs Offset = %d Data = %d\n",offset,data); +} + +WRITE8_MEMBER(polgar_state::megaiv_write_LED) +{ + if (BIT(data,7)) + m_beeper->set_state(1); + else + m_beeper->set_state(0); + output_set_led_value(102,BIT(data,1)?1:0); + output_set_led_value(107,BIT(data,6)?1:0); + +// logerror("LEDs FUNC = %02x found = %d\n",data,found); + logerror("LED mask %d\n",data); +// printf("LED mask %d\n",data); + +} + + +WRITE8_MEMBER(polgar_state::academy_write_LED) +{ +int found = 0; + +// LED mask debugging, please don't delete +/*static int r[4] = { 0,0,0,0 }; +static int pr[4] = { -1,-1,-1,-1 }; +static int new1 = 0,start = 0,z = 0,i2; +if (data == 0xf8) { + if (start == 0) { + start = 1; + z = 0; + } +} +if (start == 1) { + new1 = 0; + pr[z] = r[z]; + r[z] = data; + for (i2 = 0; i2 < 4; i2++) if(pr[i2] != r[i2]) new1 = 1; + z++; + if(z == 4) z = 0; + if (new1) printf("[%02x] [%02x] [%02x] [%02x]\n",r[0],r[1],r[2],r[3]); +} +*/ + +if ((data & 0x68) == 0x68) { + output_set_led_value(103,BIT(data,4)?0:1); // POS + output_set_led_value(107,BIT(data,7)?0:1); // white + found = 1; +} + +if ((data & 0x64) == 0x64) { + output_set_led_value(102,BIT(data,4)?0:1); // MEM + output_set_led_value(106,BIT(data,7)?0:1); // black + found = 1; +} + +if ((data & 0xa2) == 0xa2) { + output_set_led_value(101,BIT(data,4)?0:1); // INFO + output_set_led_value(105,BIT(data,6)?0:1); // FUNC + found = 1; +} + +if ((data & 0xa1) == 0xa1) { + output_set_led_value(100,BIT(data,4)?0:1); // TRN + output_set_led_value(104,BIT(data,6)?0:1); // LVL + found = 1; +} + +if (BIT(data,7)) + m_beeper->set_state(1); +else + m_beeper->set_state(0); +if (BIT(data,1)) + m_beeper->set_state(1); +else + m_beeper->set_state(0); +// logerror("LEDs FUNC = %02x found = %d\n",data,found); + if (!found) { + logerror("unknown LED mask %d\n",data); +// printf("unknown LED mask %d\n",data); + } +} + + +WRITE8_MEMBER(polgar_state::academy_inhibitNMI) +{ + academyallowNMI = data; + +} + + +WRITE32_MEMBER(polgar_state::write_LED_BPL32) +{ + int i; + + data >>= 24; + for (i=0;i<8;i++) { + output_set_led_value(i,BIT(data,i)); + output_set_led_value(10+i,!BIT(BPL32latch_data,7-i)); + } + + logerror("LEDs Offset = %d Data = %08x Latch = %08x\n",offset,data,BPL32latch_data); + +} + + +WRITE8_MEMBER(polgar_state::polgar_write_LED) +{ +#define LED_offset 100 + + data &= 0x80; + + if (data == 0) { + led_status &= 255-(1<read(); + + if (tmp != 0xff) + data = convert_imputmask(tmp); + + } + + return data; + +} + +READ8_MEMBER(polgar_state::read_keys) +{ + UINT8 data; + static const char *const keynames[1][8] = + { + { "KEY1_0", "KEY1_1", "KEY1_2", "KEY1_3", "KEY1_4", "KEY1_5", "KEY1_6", "KEY1_7" } + }; + + data = ioport(keynames[0][offset])->read(); + // logerror("Keyboard Port = %s Data = %d\n ", ((led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data); + return data | 0x7f; +} + +READ8_MEMBER(polgar_state::read_keys_megaiv) +{ + UINT8 data; + static const char *const keynames[1][8] = + { + { "KEY1_0", "KEY1_1", "KEY1_2", "KEY1_3", "KEY1_4", "KEY1_5", "KEY1_6", "KEY1_7" } + }; + + data = ioport(keynames[0][offset])->read(); + logerror("Keyboard Port = %s Data = %d\n ", keynames[0][offset] , data); + return data | 0x7f; +} + + +READ32_MEMBER(polgar_state::read_keys_BPL32) +{ + UINT32 data = 0; + UINT8 tmp = 0xff, line = 0; + static const char *const board_lines[8] = + { "LINE.0", "LINE.1", "LINE.2", "LINE.3", "LINE.4", "LINE.5", "LINE.6", "LINE.7" }; + + if (BPL32latch_data == 0xff) { + tmp = ioport("BUTTONS_BPL")->read(); + logerror("Keyboard Port Offset = %d tmp %d\n", offset,tmp); + + data = tmp << 24; + } else { + if (BPL32latch_data & 0x7f) { + logerror("ReadingBoard %02x\n",BPL32latch_data); + line = get_first_cleared_bit(BPL32latch_data); + tmp = ioport(board_lines[line])->read(); + + if (tmp != 0xff) + data = convert_imputmask(tmp) << 24; + } + } + +// logerror("Keyboard Port = %s Data = %d Offset = %d tmp %d line %02x\n", keynames[0][line], data, offset,tmp,line); + return data; +} + +WRITE8_MEMBER(polgar_state::beep_academy) +{ + if (!BIT(data,7)) + m_beeper->set_state(1); + else + m_beeper->set_state(0); +} + +WRITE8_MEMBER(polgar_state::megaiv_IO) +{ +// if (BIT(data,0)) beep_set_state(machine->device("beeper"),1); else beep_set_state(machine->device("beeper"),0); + logerror("$2400 = %02x\n",data); + latch2400 = data; +} + + +WRITE8_MEMBER(polgar_state::monteciv_select_line) +{ + monteciv_select[offset] = data; +} + +// FIXME : unlike polgar, academy shares port IO for keys and board, and i just can't seem to get the board latched right (H7 and H8 are always flashing) -- Cow +READ8_MEMBER(polgar_state::read_keys_board_monteciv) +{ + UINT8 data = 0; + + if (monteciv_select[0] == 0xff && monteciv_select[1] == 0xff) { + data = mboard_read_board_8(space,0); + } else { + if (monteciv_select[0] == 0x0) { + data = ioport("BUTTONS_MONTE2")->read(); +#if 0 + if (data) { + output_set_digit_value(0,64); + output_set_digit_value(1,113+128); + output_set_digit_value(2,190); + output_set_digit_value(3,64); + + output_set_digit_value(4,246-128); + output_set_digit_value(5,247-128); + output_set_digit_value(6,219-128); + output_set_digit_value(7,249-128); + } +#endif + } else { + data = ioport("BUTTONS_MONTE1")->read(); + } + } + return data; +} + + +// FIXME : unlike polgar, academy shares port IO for keys and board, and I just can't seem to get the board latched right (H7 and H8 are always flashing) -- Cow +READ8_MEMBER(polgar_state::read_keys_board_academy) +{ +// static int startup = 0; + UINT8 data = 0; +// UINT8 tmp = 0xff, line = 0; +// static const char *const board_lines[8] = +// { "LINE.0", "LINE.1", "LINE.2", "LINE.3", "LINE.4", "LINE.5", "LINE.6", "LINE.7" }; + + if (latch_data == 0xff) { + data = ioport("BUTTONS_ACAD")->read(); + } else { +// if (latch_data & 0x7f) { + data = mboard_read_board_8(space,0); +// data = milano_read_board(space,0); + +// logerror("ReadingBoard %02x\n",latch_data); +// line = get_first_cleared_bit(latch_data); +// tmp = machine.root_device().ioport(board_lines[line])->read(); +// mboard_write_board_8(space,0, latch_data); +// data = mboard_read_board_8(space,0); +// logerror("BoardRead Port Offset = %d data %02x Latch %02x\n", offset,data,latch_data); +// printf ("BoardRead Port Offset = %d data %02x Latch %02x\n", offset,data,latch_data); +// } else { +// logerror("no keys or board\n"); +// } + } +// logerror("Keyboard Port Offset = %d tmp %d Latch %d\n", offset,tmp,latch_data); +// logerror("Keyboard Port = %s Data = %d Offset = %d tmp %d line %02x\n", keynames[0][line], data, offset,tmp,line); + return data; +} + +TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::cause_nmi) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); +} + +TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::cause_M6502_irq) +{ + m_maincpu->set_input_line(M65C02_IRQ_LINE, HOLD_LINE); +} + + +WRITE32_MEMBER(polgar_state::write_board_BPL32) +{ + BPL32latch_data = data >> 24; + logerror("Write BPL32 board Data Latch %08x Offset: %08x\n",BPL32latch_data,offset); + +} + +READ32_MEMBER(polgar_state::read_buttons_gen32) +{ + UINT32 data; + static const char *const keynames[4] = { "BUTTON_1", "BUTTON_2", "", "BUTTON_3" }; + + data = ioport(keynames[offset])->read(); + + data = data|data<<8|data<<16|data<<24; // this might not be needed if MAME does handle odd alignment over 32bit boundaries right + logerror("Read from Buttons: %08x %08x\n",offset,data); + return data; +} + +READ32_MEMBER(polgar_state::read_buttons_van32) +{ + UINT32 data; + static const char *const keynames[4] = { "BUTTON_1", "", "BUTTON_2", "BUTTON_3" }; + + + data = ioport(keynames[offset])->read(); + + data = data << 8; + logerror("Read from Buttons: %08x %08x\n",offset,data); + return data; +} + +READ16_MEMBER(polgar_state::read_buttons_van16) +{ + UINT16 data; + static const char *const keynames[3] = { "BUTTON_1", "BUTTON_2", "BUTTON_3" }; + + + data = ioport(keynames[offset>>1])->read() << 8; + + logerror("Read from %06x offset: %x %04x\n",0xf00000,offset,data); + return data; +} + +WRITE32_MEMBER(polgar_state::write_LCD_data_32) +{ +// printf("Write LCD Data Latch %08x o: %08x\n",data,offset); + logerror("Write LCD Data Latch %08x o: %08x\n",data,offset); + lcd32_char = data>>24; +// cpu_adjust_icount(cpu,-5000); + +} + +WRITE16_MEMBER(polgar_state::write_LCD_data) +{ + lcd32_char = data>>8; + +} + +void polgar_state::write_IOenable(unsigned char data,address_space &space) +{ + hd44780_device * hd44780 = space.machine().device("hd44780"); + + if (BIT(data,5) && BIT(data,4)) { + if (BIT(data,1)) { + // delay until LCD is ready + // (this is now patched on a per ROM basis) + // ROMs have a very specific delay loop to avoid a busy spin while checking moves in the background + // 48 tst.l (a4)+ instuctions need to be > ~42us (for 33.33mhz 030) (a4 is pointing at ROM) + // MAME core does not appear to have this opcode timed right. + // This also allows 'fake' clocks to test ELO at impossibly high speeds on real hardware + // The original programmer says RAM is 2x as fast as the ROM on the 030 machines, maybe waitstates can be put in MAME core someday +// cpu_spinuntil_time(space.cpu, ATTOTIME_IN_USEC(50)); + if (BIT(data,0)) { + logerror("Write LCD_DATA [%02x] [%c]\n",lcd32_char,lcd32_char); +// printf("Write LCD_DATA [%02x] [%c]\n",lcd32_char,lcd32_char); + } else { + logerror("Write LCD_CTRL [%02x] [%c]\n",lcd32_char,lcd32_char); +// printf("Write LCD_CTRL [%02x] [%c]\n",lcd32_char,lcd32_char); + } + + hd44780->write(space, BIT(data,0), lcd32_char); + } + + logerror("Write to IOENBL data: %08x\n",data); + + if (BIT(data,2) || BIT(data,3)) + m_beeper->set_state(1); + else + m_beeper->set_state(0); + } + +} + +WRITE32_MEMBER(polgar_state::write_IOenables_32){ + write_IOenable(data>>24,space); +} + +WRITE16_MEMBER(polgar_state::write_IOenables) +{ + write_IOenable(data>>8,space); +} + +/* Unknown read/write */ + +READ32_MEMBER(polgar_state::read_unknown1_32) +{ + logerror("Read from unknown1 offset: %x\n",offset); + return 0xff00ff00; +} + +READ16_MEMBER(polgar_state::read_unknown1) +{ + logerror("Read from %06x offset: %x\n",0xe80002,offset); + return 0xff00; +} + +WRITE32_MEMBER(polgar_state::write_unknown2_32) +{ + //unknown2_data = data; + logerror("Write to unknown2 data: %04x\n",data); +} + +WRITE16_MEMBER(polgar_state::write_unknown2) +{ + //unknown2_data = data; + logerror("Write from %06x data: %04x\n",0xe80004,data); +} + +READ32_MEMBER(polgar_state::read_unknown3_32) +{ + logerror("Read from unknown3 offset: %x %08x\n",offset,(unsigned int) m_maincpu->state_int(M68K_PC)); + return 0xffffffff; + //return unknown2_data|unknown2_data<<24; + +} + +READ16_MEMBER(polgar_state::read_unknown3) +{ + logerror("Read from %06x offset: %x\n",0xe80006,offset); + return 0xffff; + //return unknown2_data; + +} + +READ32_MEMBER(polgar_state::read_1800000) +{ + logerror("Read from RISC2500 1800000\n"); + return 0; +} + +WRITE32_MEMBER(polgar_state::write_1000000) +{ + logerror("Write to RISC2500 1000000\n"); +} + +TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq6) +{ + m_maincpu->set_input_line(6, HOLD_LINE); +} + +TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq2) +{ + m_maincpu->set_input_line(2, HOLD_LINE); +} + + +TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq_academy) +{ + if (academyallowNMI) { + m_maincpu->set_input_line(6, HOLD_LINE); + } +} + + +MACHINE_START_MEMBER(polgar_state,van32) +{ +// patch LCD delay loop on the 68030 machines until waitstates and/or opcode timings are fixed in MAME core +// patches gen32 gen32_41 gen32_oc lond030 + + UINT8 *rom = memregion("maincpu")->base(); + + if(rom[0x870] == 0x0c && rom[0x871] == 0x78) { + if (!strcmp(machine().system().name,"gen32_oc")) { + rom[0x870] = 0x6c; + } else { + rom[0x870] = 0x38; + } + } +} + + +MACHINE_START_MEMBER(polgar_state,risc) +{ +} + + +void polgar_state::common_chess_start() +{ + mboard_set_border_pieces(); + mboard_set_board(); +} + +MACHINE_START_MEMBER(polgar_state,polgar) +{ + common_chess_start(); + mboard_savestate_register(); +} + +MACHINE_START_MEMBER(polgar_state,sfortea) +{ + common_chess_start(); + mboard_savestate_register(); +} + +MACHINE_START_MEMBER(polgar_state,diablo68) +{ + common_chess_start(); +} + +MACHINE_START_MEMBER(polgar_state,van16) +{ + mboard_savestate_register(); +} + +MACHINE_RESET_MEMBER(polgar_state,van16) +{ + common_chess_start(); +} + +MACHINE_RESET_MEMBER(polgar_state,polgar) +{ + common_chess_start(); +} + +MACHINE_RESET_MEMBER(polgar_state,sfortea) +{ + common_chess_start(); +} + +MACHINE_RESET_MEMBER(polgar_state,monteciv) +{ + montecivtop = 0; + montecivbot = 0; + monteciv_select[0] = 0; + monteciv_select[1] = 0; + academyallowNMI = 0; + common_chess_start(); +} + + +MACHINE_RESET_MEMBER(polgar_state,academy) +{ + academyallowNMI = 0; + common_chess_start(); +} + +PALETTE_INIT_MEMBER(polgar_state,chess_lcd) +{ + // palette.set_pen_color(0, rgb_t(138, 146, 148)); // some think this is closer, but slightly less readable + palette.set_pen_color(0, rgb_t(255, 255, 255)); + palette.set_pen_color(1, rgb_t(0, 0, 0)); +} + +static const gfx_layout chess_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 224, /* 224 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( chess_lcd ) + GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, chess_charlayout, 0, 1 ) +GFXDECODE_END + +static ADDRESS_MAP_START(polgar_mem , AS_PROGRAM, 8, polgar_state ) + AM_RANGE( 0x0000, 0x1fff ) AM_RAM + AM_RANGE( 0x2400, 0x2400 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard + AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(mboard_write_board_8) // Chessboard + AM_RANGE( 0x3000, 0x3000 ) AM_READ(mboard_read_board_8 ) // Chessboard + AM_RANGE( 0x3400, 0x3405 ) AM_WRITE(polgar_write_LED) // Function LEDs + AM_RANGE( 0x2c00, 0x2c07 ) AM_READ(read_keys) + AM_RANGE( 0x2004, 0x2004 ) AM_WRITE(write_polgar_IO ) // LCD Instr. Reg + Beeper + AM_RANGE( 0x2000, 0x2000 ) AM_WRITE(write_LCD_polgar ) // LCD Char Reg. + AM_RANGE( 0x4000, 0xffff ) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sfortea_mem , AS_PROGRAM, 8, polgar_state ) + AM_RANGE( 0x0000, 0x1fef ) AM_RAM + AM_RANGE( 0x1ff6, 0x1ff6 ) AM_WRITE(write_latch_sfortea) // IO control + AM_RANGE( 0x1ff7, 0x1ff7 ) AM_WRITE(write_lcd_IO_sfortea) // LCD Char Reg. +// AM_RANGE( 0x1ffc, 0x1fff ) AM_DEVREADWRITE_LEGACY("acia65c51", acia_6551_r,acia_6551_w) + AM_RANGE( 0x1ff1, 0x1ff1 ) AM_READ(read_1ff1_sfortea ) + AM_RANGE( 0x1ff0, 0x1ff0 ) AM_READ(read_1ff0_sfortea ) + AM_RANGE( 0x2000, 0xffff ) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(gen32_mem, AS_PROGRAM, 32, polgar_state ) + + AM_RANGE( 0x00000000, 0x0003ffff ) AM_ROM + + AM_RANGE( 0xc0000000 , 0xc0000003 ) AM_READ(mboard_read_board_32 ) + AM_RANGE( 0xc8000000 , 0xc8000003 ) AM_WRITE(mboard_write_board_32 ) + AM_RANGE( 0xc8000004 , 0xc8000007 ) AM_WRITE(mboard_write_board_32 ) + AM_RANGE( 0xd0000000 , 0xd0000003 ) AM_WRITE(mboard_write_LED_32 ) + AM_RANGE( 0xd0000004 , 0xd0000007 ) AM_WRITE(mboard_write_LED_32 ) + AM_RANGE( 0xf0000004 , 0xf0000013 ) AM_READ(read_buttons_gen32 ) + AM_RANGE( 0xe0000000 , 0xe0000003 ) AM_WRITE(write_LCD_data_32 ) + AM_RANGE( 0xe0000010 , 0xe0000013 ) AM_WRITE(write_IOenables_32 ) + AM_RANGE( 0xd8000008 , 0xd800000b ) AM_WRITE(write_unknown2_32 ) + AM_RANGE( 0xd8000004 , 0xd8000007 ) AM_READ(read_unknown1_32 ) + AM_RANGE( 0xd800000c , 0xd800000f ) AM_READ(read_unknown3_32 ) + + AM_RANGE( 0x40000000, 0x4007ffff ) AM_RAM /* 512KB */ + AM_RANGE( 0x80000000, 0x8003ffff ) AM_RAM /* 256KB */ + AM_RANGE( 0xe8000000, 0xe8007fff ) AM_RAM AM_SHARE("nvram") + + ADDRESS_MAP_END + +static ADDRESS_MAP_START(bpl32_mem, AS_PROGRAM, 32, polgar_state ) + + AM_RANGE( 0x000000, 0x03ffff ) AM_ROM + AM_RANGE( 0x800000 , 0x800003 ) AM_READ(read_keys_BPL32 ) + AM_RANGE( 0x900000 , 0x900003 ) AM_WRITE(write_board_BPL32 ) + AM_RANGE( 0xa00000 , 0xa00003 ) AM_WRITE(write_LED_BPL32 ) + AM_RANGE( 0xc00000 , 0xc00003 ) AM_WRITE(write_LCD_data_32 ) + AM_RANGE( 0xb00000 , 0xb00003 ) AM_WRITE(write_IOenables_32 ) + AM_RANGE( 0x400000 , 0x4fffff ) AM_RAM /* 1024KB */ + AM_RANGE( 0xd00000 , 0xd07fff ) AM_RAM AM_SHARE("nvram") + + ADDRESS_MAP_END + +static ADDRESS_MAP_START(van32_mem, AS_PROGRAM, 32, polgar_state ) + + AM_RANGE( 0x00000000, 0x0003ffff ) AM_ROM + + AM_RANGE( 0x800000fc , 0x800000ff ) AM_READ(mboard_read_board_32 ) + AM_RANGE( 0x88000000 , 0x88000007 ) AM_WRITE(mboard_write_board_32 ) + AM_RANGE( 0x90000000 , 0x90000007 ) AM_WRITE(mboard_write_LED_32 ) + AM_RANGE( 0x800000ec , 0x800000ff ) AM_READ(read_buttons_van32 ) + AM_RANGE( 0xa0000000 , 0xa0000003 ) AM_WRITE(write_LCD_data_32 ) + AM_RANGE( 0xa0000010 , 0xa0000013 ) AM_WRITE(write_IOenables_32 ) + AM_RANGE( 0x98000008 , 0x9800000b ) AM_WRITE(write_unknown2_32 ) + AM_RANGE( 0x98000004 , 0x98000007 ) AM_READ(read_unknown1_32 ) + AM_RANGE( 0x9800000c , 0x9800000f ) AM_READ(read_unknown3_32 ) + + AM_RANGE( 0x40000000, 0x400fffff ) AM_RAM /* 1024KB */ + AM_RANGE( 0xa8000000, 0xa8007fff ) AM_RAM AM_SHARE("nvram") + + ADDRESS_MAP_END + + +static ADDRESS_MAP_START(alm32_mem, AS_PROGRAM, 32, polgar_state ) + + AM_RANGE( 0x00000000, 0x0001ffff ) AM_ROM + + AM_RANGE( 0x800000fc , 0x800000ff ) AM_READ(mboard_read_board_32 ) + AM_RANGE( 0x88000000 , 0x88000007 ) AM_WRITE(mboard_write_board_32 ) + AM_RANGE( 0x90000000 , 0x90000007 ) AM_WRITE(mboard_write_LED_32 ) + AM_RANGE( 0x800000ec , 0x800000ff ) AM_READ(read_buttons_van32 ) + AM_RANGE( 0xa0000000 , 0xa0000003 ) AM_WRITE(write_LCD_data_32 ) + AM_RANGE( 0xa0000010 , 0xa0000013 ) AM_WRITE(write_IOenables_32 ) + AM_RANGE( 0x98000008 , 0x9800000b ) AM_WRITE(write_unknown2_32 ) + AM_RANGE( 0x98000004 , 0x98000007 ) AM_READ(read_unknown1_32 ) + AM_RANGE( 0x9800000c , 0x9800000f ) AM_READ(read_unknown3_32 ) + + AM_RANGE( 0x40000000, 0x400fffff ) AM_RAM + AM_RANGE( 0xa8000000, 0xa8007fff ) AM_RAM AM_SHARE("nvram") + + ADDRESS_MAP_END + +static ADDRESS_MAP_START(risc_mem, AS_PROGRAM, 32, polgar_state ) + + AM_RANGE( 0x02000000, 0x0201ffff ) AM_ROM AM_REGION("maincpu", 0) // AM_MIRROR(0x2000000) + AM_RANGE( 0x01000000, 0x01000003 ) AM_WRITE(write_1000000 ) + AM_RANGE( 0x01800000, 0x01800003 ) AM_READ(read_1800000 ) + AM_RANGE( 0x00000000, 0x0001ffff ) AM_RAM + + ADDRESS_MAP_END + +static ADDRESS_MAP_START(van16_mem, AS_PROGRAM, 16, polgar_state ) + + AM_RANGE( 0x000000, 0x03ffff ) AM_ROM + + AM_RANGE( 0xc00000 , 0xc00001 ) AM_READ(mboard_read_board_16 ) + AM_RANGE( 0xc80000 , 0xc80001 ) AM_WRITE(mboard_write_board_16 ) + AM_RANGE( 0xd00000 , 0xd00001 ) AM_WRITE(mboard_write_LED_16 ) + AM_RANGE( 0xf00000 , 0xf00009 ) AM_READ(read_buttons_van16 ) + AM_RANGE( 0xd80000 , 0xd80001 ) AM_WRITE(write_LCD_data ) + AM_RANGE( 0xd80008 , 0xd80009 ) AM_WRITE(write_IOenables ) + AM_RANGE( 0xe80004 , 0xe80005 ) AM_WRITE(write_unknown2 ) + AM_RANGE( 0xe80002 , 0xe80003 ) AM_READ(read_unknown1 ) + AM_RANGE( 0xe80006 , 0xe80007 ) AM_READ(read_unknown3 ) + + AM_RANGE( 0x400000, 0x47ffff ) AM_RAM /* 512KB */ + AM_RANGE( 0x800000, 0x803fff ) AM_RAM AM_SHARE("nvram") + + ADDRESS_MAP_END + +static ADDRESS_MAP_START(alm16_mem, AS_PROGRAM, 16, polgar_state ) + + AM_RANGE( 0x000000, 0x01ffff ) AM_ROM + + AM_RANGE( 0xc00000 , 0xc00001 ) AM_READ(mboard_read_board_16 ) + AM_RANGE( 0xc80000 , 0xc80001 ) AM_WRITE(mboard_write_board_16 ) + AM_RANGE( 0xd00000 , 0xd00001 ) AM_WRITE(mboard_write_LED_16 ) + AM_RANGE( 0xf00000 , 0xf00009 ) AM_READ(read_buttons_van16 ) + AM_RANGE( 0xd80000 , 0xd80001 ) AM_WRITE(write_LCD_data ) + AM_RANGE( 0xd80008 , 0xd80009 ) AM_WRITE(write_IOenables ) +// AM_RANGE( 0xe80004 , 0xe80005 ) AM_WRITE(write_unknown2 ) +// AM_RANGE( 0xe80002 , 0xe80003 ) AM_READ(read_unknown1 ) +// AM_RANGE( 0xe80006 , 0xe80007 ) AM_READ(read_unknown3 ) + + + AM_RANGE( 0x400000, 0x47ffff ) AM_RAM /* 512KB */ + AM_RANGE( 0x800000, 0x803fff ) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(milano_mem , AS_PROGRAM, 8, polgar_state ) + AM_RANGE( 0x0000, 0x1f9f ) AM_RAM + AM_RANGE( 0x1fd0, 0x1fd0 ) AM_WRITE(milano_write_board ) // Chessboard + AM_RANGE( 0x1fe0, 0x1fe0 ) AM_READ(milano_read_board ) // Chessboard + AM_RANGE( 0x1fe8, 0x1fed ) AM_WRITE(milano_write_LED ) // Function LEDs + AM_RANGE( 0x1fd8, 0x1fdf ) AM_READ(read_keys) + AM_RANGE( 0x1ff0, 0x1ff0 ) AM_WRITE(write_polgar_IO) // IO control + AM_RANGE( 0x1fc0, 0x1fc0 ) AM_WRITE(write_LCD_polgar) // LCD Char Reg. (latched) + AM_RANGE( 0x2000, 0xffff ) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(academy_mem , AS_PROGRAM, 8, polgar_state ) + AM_RANGE( 0x0000, 0x1fff ) AM_RAM + AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_academy ) + AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(academy_write_board ) // Chessboard + AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard + AM_RANGE( 0x3002, 0x3002 ) AM_WRITE(beep_academy ) + AM_RANGE( 0x3001, 0x3001 ) AM_WRITE(academy_inhibitNMI ) + AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED ) + AM_RANGE( 0x3800, 0x3801 ) AM_WRITE(write_LCD_academy ) + AM_RANGE( 0x4000, 0xffff ) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(monteciv_mem , AS_PROGRAM, 8, polgar_state ) + AM_RANGE( 0x0000, 0x1fff ) AM_RAM + AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_monteciv ) + AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(academy_write_board ) // Chessboard + AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard + AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED ) // Status LEDs + AM_RANGE( 0x3000, 0x3001 ) AM_WRITE(monteciv_select_line ) // Select Keyline + AM_RANGE( 0x3002, 0x3002 ) AM_WRITE(beep_academy ) + AM_RANGE( 0x3004, 0x3004 ) AM_WRITE(monteciv_write_LCD ) + AM_RANGE( 0x3005, 0x3005 ) AM_WRITE(monteciv_3005 ) + AM_RANGE( 0x3007, 0x3007 ) AM_WRITE(monteciv_3007 ) + AM_RANGE( 0x3006, 0x3006 ) AM_WRITE(monteciv_3006 ) + AM_RANGE( 0x2000, 0x2000 ) AM_WRITE(academy_inhibitNMI ) + AM_RANGE( 0x8000, 0xffff ) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(megaiv_mem , AS_PROGRAM, 8, polgar_state ) + AM_RANGE( 0x0000, 0x1fff ) AM_RAM +/// AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_monteciv ) + AM_RANGE( 0x6800, 0x6800 ) AM_WRITE(academy_write_board ) // 2800 // Chessboard +/// AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard +/// AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED ) // Status LEDs + AM_RANGE( 0x4400, 0x4400 ) AM_WRITE(megaiv_write_LED ) // 2400 // Select Keyline + AM_RANGE( 0x7000, 0x7001 ) AM_WRITE(megaiv_IO ) // Select Keyline +/// AM_RANGE( 0x3002, 0x3002 ) AM_WRITE(beep_academy ) + AM_RANGE( 0x4000, 0x4007 ) AM_READ(read_keys_megaiv ) // 3000-7 fixio + AM_RANGE( 0x2c04, 0x2c04 ) AM_WRITE(monteciv_write_LCD ) // 2c04 + AM_RANGE( 0x2c05, 0x2c05 ) AM_WRITE(monteciv_3005 ) // 2c05 + AM_RANGE( 0x2c07, 0x2c07 ) AM_WRITE(monteciv_3007 ) // 2c07 + AM_RANGE( 0x2c06, 0x2c06 ) AM_WRITE(monteciv_3006 ) // 2c06 +/// AM_RANGE( 0x2000, 0x2000 ) AM_WRITE(academy_inhibitNMI ) + AM_RANGE( 0x8000, 0xffff ) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(diablo68_mem , AS_PROGRAM, 16, polgar_state ) + AM_RANGE( 0x00000000, 0x0000ffff ) AM_ROM // OS +// AM_RANGE( 0x00200000, 0x0020ffff ) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE( 0x00ff0000, 0x00ff7fff ) AM_ROM AM_REGION("maincpu",10000) // Opening Book +// AM_RANGE( 0x00300000, 0x00300007 ) AM_READ(diablo68_aciaread) +// AM_RANGE( 0x00300000, 0x00300007 ) AM_READ(diablo68_aciawrite) +// AM_RANGE( 0x00300002, 0x00300003 ) AM_READ(diablo68_flags) + AM_RANGE( 0x003a0000, 0x003a0001 ) AM_WRITE(diablo68_write_LCD) + AM_RANGE( 0x003c0000, 0x003c0001 ) AM_WRITE(diablo68_reg_select) + AM_RANGE( 0x00280000, 0x0028ffff ) AM_RAM // hash tables + AM_RANGE( 0x00ff8000, 0x00ffffff ) AM_RAM +ADDRESS_MAP_END + + +/* Input ports */ + +static INPUT_PORTS_START( polgar ) + + PORT_START("KEY1_0") //Port $2c00 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Trn") PORT_CODE(KEYCODE_F1) + PORT_START("KEY1_1") //Port $2c01 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Info") PORT_CODE(KEYCODE_F2) + PORT_START("KEY1_2") //Port $2c02 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Mem") PORT_CODE(KEYCODE_F3) + PORT_START("KEY1_3") //Port $2c03 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Pos") PORT_CODE(KEYCODE_F4) + PORT_START("KEY1_4") //Port $2c04 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" LEV") PORT_CODE(KEYCODE_F5) + PORT_START("KEY1_5") //Port $2c05 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" FCT") PORT_CODE(KEYCODE_F6) + PORT_START("KEY1_6") //Port $2c06 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" ENT") PORT_CODE(KEYCODE_F7) + PORT_START("KEY1_7") //Port $2c07 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" CL") PORT_CODE(KEYCODE_F8) +// PORT_START("KEY1_8") +// PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" A") PORT_CODE(KEYCODE_1) + + PORT_INCLUDE( chessboard ) + +INPUT_PORTS_END + +static INPUT_PORTS_START( sfortea ) + PORT_START("BUTTONS_SFOR1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_7) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_8) + + PORT_START("BUTTONS_SFOR2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_F8) + +/* PORT_START("BUTTONS_SFOR3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_7) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_8) +*/ + + PORT_INCLUDE( chessboard ) +INPUT_PORTS_END + +static INPUT_PORTS_START( academy ) + PORT_START("BUTTONS_ACAD") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Trn") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Info") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Mem") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Pos") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" LEV") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" FCT") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" ENT") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" CL") PORT_CODE(KEYCODE_F8) + + PORT_INCLUDE( chessboard ) +INPUT_PORTS_END + +static INPUT_PORTS_START( megaiv ) + + PORT_START("KEY1_0") //Port $2c00 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Trn") PORT_CODE(KEYCODE_F1) + PORT_START("KEY1_1") //Port $2c01 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Info") PORT_CODE(KEYCODE_F2) // mem + PORT_START("KEY1_2") //Port $2c02 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Mem") PORT_CODE(KEYCODE_F3) + PORT_START("KEY1_3") //Port $2c03 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Pos") PORT_CODE(KEYCODE_F4) + PORT_START("KEY1_4") //Port $2c04 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" LEV") PORT_CODE(KEYCODE_F5) + PORT_START("KEY1_5") //Port $2c05 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" FCT") PORT_CODE(KEYCODE_F6) + PORT_START("KEY1_6") //Port $2c06 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" ENT") PORT_CODE(KEYCODE_F7) + PORT_START("KEY1_7") //Port $2c07 + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" CL") PORT_CODE(KEYCODE_F8) +// PORT_START("KEY1_8") +// PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" A") PORT_CODE(KEYCODE_1) + + PORT_INCLUDE( chessboard ) + +INPUT_PORTS_END + + +static INPUT_PORTS_START( monteciv ) + PORT_START("BUTTONS_MONTE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 1 Pawn") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 2 Knight") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 3 Bishop") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 4 Rook") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 5 Queen") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 6 King") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 7 Black") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 8 White") PORT_CODE(KEYCODE_F8) + + PORT_START("BUTTONS_MONTE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 Book") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 Pos") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mem") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Info") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Level") PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_7) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_8) + + + PORT_INCLUDE( chessboard ) +INPUT_PORTS_END + + +static INPUT_PORTS_START( gen32 ) + + PORT_START("BUTTON_1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) + + PORT_START("BUTTON_2") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + + PORT_START("BUTTON_3") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_BACKSLASH) + + PORT_INCLUDE( chessboard ) + +INPUT_PORTS_END + +static INPUT_PORTS_START( bpl32 ) + PORT_START("BUTTONS_BPL") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_7) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_6) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_BACKSLASH) + + PORT_INCLUDE( chessboard ) +INPUT_PORTS_END + + + +static INPUT_PORTS_START( van32 ) + + PORT_START("BUTTON_3") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) + + PORT_START("BUTTON_2") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + + PORT_START("BUTTON_1") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_BACKSLASH) + + PORT_INCLUDE( chessboard ) + + INPUT_PORTS_END + +static INPUT_PORTS_START( van16 ) + + PORT_START("BUTTON_1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) + + PORT_START("BUTTON_2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + + PORT_START("BUTTON_3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_BACKSLASH) + + PORT_INCLUDE( chessboard ) + +INPUT_PORTS_END + +static MACHINE_CONFIG_FRAGMENT ( chess_common ) + + /* video hardware */ + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(100, 22) + MCFG_SCREEN_VISIBLE_AREA(0, 100-1, 0, 22-3) + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(polgar_state,chess_lcd) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", chess_lcd) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 16) + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( polgar, polgar_state ) + MCFG_CPU_ADD("maincpu",M65C02,4915200) + MCFG_CPU_PROGRAM_MAP(polgar_mem) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + MCFG_MACHINE_START_OVERRIDE(polgar_state, polgar ) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state, polgar ) + MCFG_FRAGMENT_ADD( chess_common ) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_nmi, attotime::from_hz(600)) + MCFG_TIMER_START_DELAY(attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100)) + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( sfortea, polgar_state ) + MCFG_CPU_ADD("maincpu",M65C02,5000000) + MCFG_CPU_PROGRAM_MAP(sfortea_mem) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + MCFG_MACHINE_START_OVERRIDE(polgar_state, sfortea ) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state, sfortea ) + MCFG_FRAGMENT_ADD( chess_common ) + + /* acia */ +// MCFG_MOS6551_ADD("acia65c51", XTAL_1_8432MHz, NULL) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_M6502_irq, attotime::from_hz(600)) + MCFG_TIMER_START_DELAY(attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( alm32, polgar_state ) + MCFG_CPU_ADD("maincpu", M68020, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(alm32_mem) + MCFG_MACHINE_START_OVERRIDE(polgar_state,van32) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) + MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) + + MCFG_FRAGMENT_ADD( chess_common ) + MCFG_NVRAM_ADD_0FILL("nvram") + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( academy, polgar ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(academy_mem) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state, academy ) + //MCFG_DEVICE_REMOVE("int_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq_academy, attotime::from_hz(600)) + +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( milano, polgar ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(milano_mem) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( monteciv, polgar_state ) + MCFG_CPU_ADD("maincpu",M65C02,8000000) + MCFG_CPU_PROGRAM_MAP( monteciv_mem ) + MCFG_MACHINE_START_OVERRIDE(polgar_state, polgar ) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state, monteciv ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_nmi, attotime::from_hz(600)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100)) + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( megaiv, monteciv ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK( 4915200 ) + MCFG_CPU_PROGRAM_MAP(megaiv_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( diablo68, polgar_state ) + MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(diablo68_mem) + MCFG_MACHINE_START_OVERRIDE(polgar_state,diablo68) + MCFG_FRAGMENT_ADD( chess_common ) + + /* acia */ +// MCFG_MOS6551_ADD("acia65c51", XTAL_1_8432MHz, NULL) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq2, attotime::from_hz(60)) + MCFG_TIMER_START_DELAY(attotime::from_hz(30)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) + + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( van16, polgar_state ) + MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(van16_mem) + MCFG_MACHINE_START_OVERRIDE(polgar_state,van16) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) + MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(600)) + //MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(587)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) + MCFG_FRAGMENT_ADD( chess_common ) + MCFG_NVRAM_ADD_0FILL("nvram") + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( alm16, van16 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(alm16_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( van32, polgar_state ) + MCFG_CPU_ADD("maincpu", M68020, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(van32_mem) + MCFG_MACHINE_START_OVERRIDE(polgar_state,van32) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) + MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) + + MCFG_FRAGMENT_ADD( chess_common ) + MCFG_NVRAM_ADD_0FILL("nvram") + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( risc, polgar_state ) + MCFG_CPU_ADD("maincpu", ARM, 14000000) + MCFG_CPU_PROGRAM_MAP(risc_mem) + MCFG_MACHINE_START_OVERRIDE(polgar_state,risc) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) + + MCFG_FRAGMENT_ADD( chess_common ) +// MCFG_NVRAM_ADD_0FILL("nvram") + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( gen32, polgar_state ) + MCFG_CPU_ADD("maincpu", M68030, XTAL_33_333MHz) + MCFG_CPU_PROGRAM_MAP(gen32_mem) + MCFG_MACHINE_START_OVERRIDE(polgar_state,van32) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) + MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(375)) + //MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(368.64)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) + + MCFG_FRAGMENT_ADD( chess_common ) + MCFG_NVRAM_ADD_0FILL("nvram") + + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( gen32_oc, gen32 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK( XTAL_33_333MHz * 2 ) + MCFG_DEVICE_REMOVE("int_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(500)) + + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( bpl32, polgar_state ) + MCFG_CPU_ADD("maincpu", M68020, XTAL_24_576MHz) + MCFG_CPU_PROGRAM_MAP(bpl32_mem) + MCFG_MACHINE_START_OVERRIDE(polgar_state,van32) + MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) + MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100)) + + MCFG_FRAGMENT_ADD( chess_common ) + MCFG_NVRAM_ADD_0FILL("nvram") + +MACHINE_CONFIG_END + + +/* ROM definitions */ + + + +ROM_START(polgar) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("polgar.bin", 0x0000, 0x10000, CRC(88d55c0f) SHA1(e86d088ec3ac68deaf90f6b3b97e3e31b1515913)) +ROM_END + +ROM_START(sfortea) + ROM_REGION(0x18000,"maincpu",0) + ROM_LOAD("sfalo.bin", 0x0000, 0x8000, CRC(86e0230a) SHA1(0d6e18a17e636b8c7292c8f331349d361892d1a8)) + ROM_LOAD("sfahi.bin", 0x8000, 0x8000, CRC(81c02746) SHA1(0bf68b68ade5a3263bead88da0a8965fc71483c1)) + ROM_LOAD("sfabook.bin", 0x10000, 0x8000, CRC(3e42cf7c) SHA1(b2faa36a127e08e5755167a25ed4a07f12d62957)) +ROM_END + +ROM_START( alm16 ) + ROM_REGION16_BE( 0x20000, "maincpu", 0 ) + ROM_LOAD16_BYTE("alm16eve.bin", 0x00000, 0x10000,CRC(EE5B6EC4) SHA1(30920C1B9E16FFAE576DA5AFA0B56DA59ADA3DBB)) + ROM_LOAD16_BYTE("alm16odd.bin" , 0x00001, 0x10000,CRC(D0BE4EE4) SHA1(D36C074802D2C9099CD44E75F9DE3FC7D1FD9908)) +ROM_END + +ROM_START( alm32 ) + ROM_REGION32_BE( 0x20000, "maincpu", 0 ) + ROM_LOAD("alm32.bin", 0x00000, 0x20000,CRC(38F4B305) SHA1(43459A057FF29248C74D656A036AC325202B9C15)) +ROM_END + +ROM_START(sforteb) + ROM_REGION(0x18000,"maincpu",0) + ROM_LOAD("forte_b.lo", 0x0000, 0x8000, CRC(48bfe5d6) SHA1(323642686b6d2fb8db2b7d50c6cd431058078ce1)) + ROM_LOAD("forte_b.hi1", 0x8000, 0x8000, CRC(9778ca2c) SHA1(d8b88b9768a1a9171c68cbb0892b817d68d78351)) + ROM_LOAD("forte_b.hi0", 0x10000, 0x8000, CRC(bb07ad52) SHA1(30cf9005021ab2d7b03facdf2d3588bc94dc68a6)) +ROM_END + +ROM_START(sforteba) + ROM_REGION(0x18000,"maincpu",0) + ROM_LOAD("forte b_l.bin", 0x0000, 0x8000, CRC(e3d194a1) SHA1(80457580d7c57e07895fd14bfdaf14b30952afca)) + ROM_LOAD("forte b_h.bin", 0x8000, 0x8000, CRC(dd824be8) SHA1(cd8666b6b525887f9fc48a730b71ceabcf07f3b9)) + ROM_LOAD("forte_b.hi0", 0x10000, 0x8000, BAD_DUMP CRC(bb07ad52) SHA1(30cf9005021ab2d7b03facdf2d3588bc94dc68a6)) +ROM_END + +ROM_START(sexpertb) + ROM_REGION(0x18000,"maincpu",0) + ROM_LOAD("seb69u3.bin", 0x0000, 0x8000, CRC(92002eb6) SHA1(ed8ca16701e00b48fa55c856fa4a8c6613079c02)) + ROM_LOAD("seb69u1.bin", 0x8000, 0x8000, CRC(814b4420) SHA1(c553e6a8c048dcc1cf48d410111a86e06b99d356)) + ROM_LOAD("seb605u2.bin", 0x10000, 0x8000, CRC(bb07ad52) SHA1(30cf9005021ab2d7b03facdf2d3588bc94dc68a6)) +ROM_END + +ROM_START(academy) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("acad8000.bin", 0x8000, 0x8000, CRC(a967922b) SHA1(1327903ff89bf96d72c930c400f367ae19e3ec68)) + ROM_LOAD("acad4000.bin", 0x4000, 0x4000, CRC(ee1222b5) SHA1(98541d87755a7186b69b9723cc4adbd07f20f0e2)) +ROM_END + +ROM_START(megaiv) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("megaiv.bin", 0x8000, 0x8000, CRC(dee355d2) SHA1(6bc79c0fb169020f017412f5f9696b9ecafbf99f)) + +ROM_END + +ROM_START(milano) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("milano.bin", 0x0000, 0x10000, CRC(0e9c8fe1) SHA1(e9176f42d86fe57e382185c703c7eff7e63ca711)) +ROM_END + + +ROM_START(sfortec) + ROM_REGION(0x18000,"maincpu",0) + ROM_LOAD("sfclow.bin", 0x0000, 0x8000, CRC(f040cf30) SHA1(1fc1220b8ed67cdffa3866d230ce001721cf684f)) + ROM_LOAD("sfchi.bin", 0x8000, 0x8000, CRC(0f926b32) SHA1(9c7270ecb3f41dd9172a9a7928e6e04e64b2a340)) + ROM_LOAD("sfcbook.bin", 0x10000, 0x8000, CRC(c6a1419a) SHA1(017a0ffa9aa59438c879624a7ddea2071d1524b8)) +ROM_END + + +ROM_START(sexpertc) + ROM_REGION(0x18000,"maincpu",0) // Version 3.6 of firmware + ROM_LOAD("seclow.bin", 0x0000, 0x8000, CRC(5a29105e) SHA1(be37bb29b530dbba847a5e8d27d81b36525e47f7)) + ROM_LOAD("sechi.bin", 0x8000, 0x8000, CRC(0085c2c4) SHA1(d84bf4afb022575db09dd9dc12e9b330acce35fa)) + ROM_LOAD("secbook.bin", 0x10000, 0x8000, CRC(2d085064) SHA1(76162322aa7d23a5c07e8356d0bbbb33816419af)) +ROM_END + +ROM_START( lyon16 ) + ROM_REGION16_BE( 0x20000, "maincpu", 0 ) + ROM_LOAD16_BYTE("lyon16ev.bin", 0x00000, 0x10000,CRC(497BD41A) SHA1(3FFEFEEAC694F49997C10D248EC6A7AA932898A4)) + ROM_LOAD16_BYTE("lyon16od.bin" , 0x00001, 0x10000,CRC(F9DE3F54) SHA1(4060E29566D2F40122CCDE3C1F84C94A9C1ED54F)) +ROM_END + +ROM_START( lyon32 ) + ROM_REGION32_BE( 0x20000, "maincpu", 0 ) + ROM_LOAD("lyon32.bin", 0x00000, 0x20000, CRC(5c128b06) SHA1(954c8f0d3fae29900cb1e9c14a41a9a07a8e185f)) +ROM_END + + +ROM_START(monteciv) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("mciv.bin", 0x8000, 0x8000, CRC(c4887694) SHA1(7f482d2a40fcb3125266e7a5407da315b4f9b49c)) + +ROM_END + +ROM_START( diablo68 ) + ROM_REGION16_BE( 0x20000, "maincpu", 0 ) + ROM_LOAD16_BYTE("evenurom.bin", 0x00000, 0x8000,CRC(03477746) SHA1(8bffcb159a61e59bfc45411e319aea6501ebe2f9)) + ROM_LOAD16_BYTE("oddlrom.bin", 0x00001, 0x8000,CRC(e182dbdd) SHA1(24dacbef2173fa737636e4729ff22ec1e6623ca5)) + ROM_LOAD16_BYTE("book.bin", 0x10000, 0x8000,CRC(553a5c8c) SHA1(ccb5460ff10766a5ca8008ae2cffcff794318108)) +ROM_END + +ROM_START( van16 ) + ROM_REGION16_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD16_BYTE("va16even.bin", 0x00000, 0x20000,CRC(E87602D5) SHA1(90CB2767B4AE9E1B265951EB2569B9956B9F7F44)) + ROM_LOAD16_BYTE("va16odd.bin" , 0x00001, 0x20000,CRC(585F3BDD) SHA1(90BB94A12D3153A91E3760020E1EA2A9EAA7EC0A)) +ROM_END + + +ROM_START( van32 ) + ROM_REGION32_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD("vanc32.bin", 0x00000, 0x40000,CRC(F872BEB5) SHA1(9919F207264F74E2B634B723B048AE9CA2CEFBC7)) +ROM_END + + +ROM_START( risc ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD("s2500.bin", 0x000000, 0x20000, CRC(7a707e82) SHA1(87187fa58117a442f3abd30092cfcc2a4d7c7efc)) +ROM_END + +ROM_START( gen32 ) + ROM_REGION32_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD("gen32_4.bin", 0x00000, 0x40000,CRC(6CC4DA88) SHA1(EA72ACF9C67ED17C6AC8DE56A165784AA629C4A1)) +ROM_END + +ROM_START( gen32_41 ) + ROM_REGION32_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD("gen32_41.bin", 0x00000, 0x40000,CRC(ea9938c0) SHA1(645cf0b5b831b48104ad6cec8d78c63dbb6a588c)) +ROM_END + +ROM_START( gen32_oc ) + ROM_REGION32_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD("gen32_41.bin", 0x00000, 0x40000,CRC(ea9938c0) SHA1(645cf0b5b831b48104ad6cec8d78c63dbb6a588c)) +ROM_END + +ROM_START( berlinp ) + ROM_REGION32_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD("berlinp.bin", 0x00000, 0x40000,CRC(82FBAF6E) SHA1(729B7CEF3DFAECC4594A6178FC4BA6015AFA6202)) +ROM_END + +ROM_START( bpl32 ) + ROM_REGION32_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD("bpl32.bin", 0x00000, 0x40000,CRC(D75E170F) SHA1(AC0EBDAA114ABD4FEF87361A03DF56928768B1AE)) +ROM_END + +ROM_START( lond020 ) + ROM_REGION32_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD("lond020.bin", 0x00000, 0x40000,CRC(3225B8DA) SHA1(FD8F6F4E9C03B6CDC86D8405E856C26041BFAD12)) +ROM_END + +ROM_START( lond030 ) + ROM_REGION32_BE( 0x40000, "maincpu", 0 ) + ROM_LOAD("lond030.bin", 0x00000, 0x40000,CRC(853BAA4E) SHA1(946951081D4E91E5BDD9E93D0769568A7FE79BAD)) +ROM_END + +DRIVER_INIT_MEMBER(polgar_state,polgar) +{ + led_status=0; +} + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ + CONS( 1986, polgar, 0, 0, polgar, polgar, polgar_state, polgar, "Hegener & Glaser", "Mephisto Polgar Schachcomputer", MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK) + CONS( 1987, sfortea, 0, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version A)", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1988, alm16, van16, 0, alm16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Almeria 68000", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1988, alm32, van16, 0, alm32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Alimera 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1988, sforteb, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version B)", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1988, sforteba, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version B, alt)", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1988, sexpertb, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Expert B Chess Computer", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1989, academy, 0, 0, academy, academy, driver_device, 0, "Hegener & Glaser", "Mephisto Academy Schachcomputer", MACHINE_REQUIRES_ARTWORK|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1989, megaiv, 0, 0, megaiv, megaiv, driver_device, 0, "Hegener & Glaser", "Mephisto Mega IV Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1989, milano, polgar, 0, milano, polgar, polgar_state, polgar, "Hegener & Glaser", "Mephisto Milano Schachcomputer", MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) +//CONS( 1989, montec4, 0, 0, monteciv, monteciv, driver_device, 0, "Hegener & Glaser", "Mephisto Monte Carlo IV", MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1989, sfortec, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version C)", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1989, sexpertc, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Expert C Chess Computer", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1990, lyon16, van16, 0, alm16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Lyon 68000", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1990, lyon32, van16, 0, alm32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Lyon 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1990, monteciv, 0, 0, monteciv, monteciv, driver_device, 0, "Hegener & Glaser", "Mephisto Monte Carlo IV LE Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1991, diablo68, 0, 0, diablo68, sfortea, driver_device, 0, "Novag", "Novag Diablo 68000 Chess Computer", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1991, van16, 0, 0, van16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Vancouver 68000", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1991, van32, van16, 0, van32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Vancouver 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1992, risc, 0, 0, risc, van16, driver_device, 0, "Saitek", "RISC2500", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1993, gen32, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.00", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1993, gen32_41, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.01", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1993, gen32_oc, van16, 0, gen32_oc, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.01OC", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK|MACHINE_UNOFFICIAL | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1994, berlinp, van16, 0, bpl32, bpl32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Berlin Pro 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1996, bpl32, van16, 0, bpl32, bpl32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Berlin Pro London Upgrade V5.00", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1996, lond020, van16, 0, van32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto London 68020 32 Bit", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) + CONS( 1996, lond030, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 London Upgrade V5.00", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/drivers/mod8.c b/src/mame/drivers/mod8.c new file mode 100644 index 00000000000..48574a94df9 --- /dev/null +++ b/src/mame/drivers/mod8.c @@ -0,0 +1,171 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + +Microsystems International Limited MOD-8 + +M.I.L. was formed in 1968 from a joint venture between the Canadian +Government and Northern Telecom. It produced a variety of computer +chips, eproms, etc, plus parts for the telephone company. It folded +in 1975. +(Info from http://www.cse.yorku.ca/museum/v_tour/artifacts/artifacts.htm) + + + 2009-11-18 Skeleton driver. + 2009-12-02 Working driver [Miodrag Milanovic] + 2011-06-14 Modernised & above notes added. + +Commands: +All commands consist of 3 uppercase letters. If further info is required +then a * prompt is printed on a new line, where you will enter the data. +All numbers are OCTAL (3/6 digits with leading zeros). Since a teletypewriter +is being used, there is no cursor. Do NOT press Enter except after these +commands, otherwise things get confusing. + +LOC - set current location pointer (the CLP) +DLP - display CLP +DPS - dump symbolic +LDO - load octal +DPO - dump octal +LBF - load BNPF format +DBF - dump BNPF format +EDT - enter Edit Mode +XQT - initiate program execution +CPY - copy routine +TRN - translate routine +SBP - set breakpoint +CBP - clear breakpoint +PRG - program PROM + +Pressing Ctrl-A will escape back to the monitor. You will see 8 dashes. + +Commands in the Edit Mode: +When you enter the Edit Mode it displays the CLP followed by a slash. + +nnn - enter a new value into this memory location and increment the CLP +` (tic) - decrement CLP +@ - same as XQT +R - return to monitor +*nnnnnn - change CLP to this value +space - display current contents of memory + +While in 'space' mode, press a letter to increment CLP, or shift-delete +(underscore character) followed by a new byte for this location. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8008/i8008.h" +#include "machine/teleprinter.h" + +class mod8_state : public driver_device +{ +public: + mod8_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_teleprinter(*this, TELEPRINTER_TAG) + , m_maincpu(*this, "maincpu") + { } + + DECLARE_WRITE8_MEMBER(out_w); + DECLARE_WRITE8_MEMBER(tty_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(tty_r); + IRQ_CALLBACK_MEMBER(mod8_irq_callback); +private: + UINT16 m_tty_data; + UINT8 m_tty_key_data; + int m_tty_cnt; + virtual void machine_reset(); + required_device m_teleprinter; + required_device m_maincpu; +}; + +WRITE8_MEMBER( mod8_state::out_w ) +{ + m_tty_data >>= 1; + m_tty_data |= BIT(data, 0) ? 0x8000 : 0; + m_tty_cnt++; + + if (m_tty_cnt == 10) + { + m_teleprinter->write(space, 0, (m_tty_data >> 7) & 0x7f); + m_tty_cnt = 0; + } +} + +WRITE8_MEMBER( mod8_state::tty_w ) +{ + m_tty_data = 0; + m_tty_cnt = 0; +} + +READ8_MEMBER( mod8_state::tty_r ) +{ + UINT8 d = m_tty_key_data & 1; + m_tty_key_data >>= 1; + return d; +} + +static ADDRESS_MAP_START(mod8_mem, AS_PROGRAM, 8, mod8_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000,0x6ff) AM_ROM + AM_RANGE(0x700,0xfff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mod8_io, AS_IO, 8, mod8_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00,0x00) AM_READ(tty_r) + AM_RANGE(0x0a,0x0a) AM_WRITE(out_w) + AM_RANGE(0x0b,0x0b) AM_WRITE(tty_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mod8 ) +INPUT_PORTS_END + +IRQ_CALLBACK_MEMBER(mod8_state::mod8_irq_callback) +{ + return 0xC0; // LAA - NOP equivalent +} + +void mod8_state::machine_reset() +{ +} + +WRITE8_MEMBER( mod8_state::kbd_put ) +{ + m_tty_key_data = data ^ 0xff; + m_maincpu->set_input_line(0, HOLD_LINE); +} + +static MACHINE_CONFIG_START( mod8, mod8_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8008, 800000) + MCFG_CPU_PROGRAM_MAP(mod8_mem) + MCFG_CPU_IO_MAP(mod8_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(mod8_state,mod8_irq_callback) + + /* video hardware */ + MCFG_DEVICE_ADD(TELEPRINTER_TAG, TELEPRINTER, 0) + MCFG_GENERIC_TELEPRINTER_KEYBOARD_CB(WRITE8(mod8_state, kbd_put)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( mod8 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mon8.001", 0x0000, 0x0100, CRC(b82ac6b8) SHA1(fbea5a6dd4c779ca1671d84089f857a3f548ffcb)) + ROM_LOAD( "mon8.002", 0x0100, 0x0100, CRC(8b82bc3c) SHA1(66222511527b27e56a5a1f9656d424d407eac7d3)) + ROM_LOAD( "mon8.003", 0x0200, 0x0100, CRC(679ae913) SHA1(22423efcb9051c9812fcbac9a27af70415d0dd81)) + ROM_LOAD( "mon8.004", 0x0300, 0x0100, CRC(2a4e580f) SHA1(8b0cb9660fde3cacd299faaa31724e4f3262d77f)) + ROM_LOAD( "mon8.005", 0x0400, 0x0100, CRC(e281bb1a) SHA1(cc7c2746e075512dbf5eed88ae3aea009558dbd0)) + ROM_LOAD( "mon8.006", 0x0500, 0x0100, CRC(b7e2f585) SHA1(5408adabc3df6e6ea8dcfb2327b2883b435ab85e)) + ROM_LOAD( "mon8.007", 0x0600, 0x0100, CRC(49a5c626) SHA1(66c1865db9151818d3b20ec3c68dd793cb98a221)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1974, mod8, 0, 0, mod8, mod8, driver_device, 0, "Microsystems International Ltd", "MOD-8", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/modellot.c b/src/mame/drivers/modellot.c new file mode 100644 index 00000000000..9c2421bddd0 --- /dev/null +++ b/src/mame/drivers/modellot.c @@ -0,0 +1,189 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/********************************************************************************** + + General Processor Modello T + + 2012-12-10 Skeleton driver. + 2013-09-27 Added keyboard and cursor. + + Made in Italy, a single board with numerous small daughter boards. + The 3 units (keyboard, disk drives, main unit) had wooden cabinets. + It had an inbuilt small green-screen CRT, like a Kaypro, and the RAM could + be 16, 32, or 48k. The FDC is a FD1791. + + All the articles and doco (what there is of it) is all in Italian. + +***********************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/keyboard.h" + +#define KEYBOARD_TAG "keyboard" + +class modellot_state : public driver_device +{ +public: + modellot_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu") + { + } + + DECLARE_READ8_MEMBER(port77_r); + DECLARE_READ8_MEMBER(portff_r); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT32 screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; +private: + UINT8 m_term_data; + const UINT8 *m_p_chargen; + virtual void machine_reset(); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(modellot_mem, AS_PROGRAM, 8, modellot_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xbfff) AM_RAM // 48k ram + AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0xe000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(modellot_io, AS_IO, 8, modellot_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x77, 0x77) AM_READ(port77_r) + AM_RANGE(0xff, 0xff) AM_READ(portff_r) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( modellot ) +INPUT_PORTS_END + +READ8_MEMBER( modellot_state::port77_r) +{ + return 4; +} + +READ8_MEMBER( modellot_state::portff_r) +{ + UINT8 data = (m_term_data) ? m_term_data ^ 0x7f : 0xff; + m_term_data = 0; + return data; +} + +WRITE8_MEMBER( modellot_state::kbd_put ) +{ + m_term_data = data; +} + +void modellot_state::machine_reset() +{ + m_term_data = 1; + m_p_chargen = memregion("chargen")->base(); + m_maincpu->set_state_int(Z80_PC, 0xe000); +} + +const gfx_layout modellot_charlayout = +{ + 8, 16, /* 8x16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {0,1,2,3,4,5,6,7}, + {0, 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, + 0x400*8, 0x401*8, 0x402*8, 0x403*8, 0x404*8, 0x405*8, 0x406*8, 0x407*8}, + 8*8 /* space between characters */ +}; + +static GFXDECODE_START( modellot ) + GFXDECODE_ENTRY( "chargen", 0x0000, modellot_charlayout, 0, 1 ) +GFXDECODE_END + + +UINT32 modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,inv; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 16; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 64; x++) + { + inv = 0; + + chr = m_p_videoram[x+ma]; + + if BIT(chr, 7) inv = 0xff; + + chr &= 0x7f; // cursor + + if (ra < 8) + gfx = m_p_chargen[(chr<<3) | ra ]; + else + gfx = m_p_chargen[(chr<<3) | (ra-8) | 0x400]; + + gfx ^= inv; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} + +static MACHINE_CONFIG_START( modellot, modellot_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(modellot_mem) + MCFG_CPU_IO_MAP(modellot_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*8, 16*16) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) + MCFG_SCREEN_UPDATE_DRIVER(modellot_state, screen_update_modellot) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", modellot ) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* Devices */ + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(modellot_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( modellot ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + //ROM_LOAD( "fdc8119.u3", 0x0000, 0x0400, CRC(a8aee944) SHA1(f2cc598ed2e7a1a620e2f3f53c1a573965f6af26)) + ROM_LOAD( "dt49-48.u1", 0xe000, 0x0400, CRC(2441c438) SHA1(832994a4214a744b7e19e5f74000c95ae65e3759)) + ROM_LOAD( "ht20.u2", 0xe400, 0x0400, CRC(497c0495) SHA1(d03beebc4c31284729f6eac3bdf1fbf44adf7fff)) + + ROM_REGION( 0x0800, "chargen", ROMREGION_INVERT ) + ROM_LOAD( "gcem1.u3", 0x0000, 0x0200, CRC(e7739268) SHA1(091ef69282abe657d5f38c70a572964f5200a1d5)) + ROM_CONTINUE(0x400, 0x200) + ROM_LOAD( "gcem2.u4", 0x0200, 0x0200, CRC(6614330e) SHA1(880a541fb0ef6f37ac89439f9ea75a313c3e53d6)) + ROM_CONTINUE(0x600, 0x200) +ROM_END + +/* Driver */ +COMP( 1979, modellot, 0, 0, modellot, modellot, driver_device, 0, "General Processor", "Modello T", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/molecular.c b/src/mame/drivers/molecular.c new file mode 100644 index 00000000000..d976f124fe3 --- /dev/null +++ b/src/mame/drivers/molecular.c @@ -0,0 +1,356 @@ +// license:BSD-3-Clause +// copyright-holders: Angelo Salese +/*********************************************************************************** + +MOLECULAR Computer + +Notes: + +File Processor i/os +0x00 DMA +0x10-0x13 CTC +0x20-0x23 CTC (Serial A Clock, Serial B Clock, Parity Error IRQ, Bus IRQ) +0x40-0x43 SIO (Serial A Data, Serial A Control, Serial B Data, Serial B Control) +0x60-0x63 FDC (Control, Cylinder, Sector, Data) +0x70 PLOW Lower Parallel i/o +0x71 PHI Upper Parallel i/o +0x80-0x87 HDD (Status, Data, Result 0-5) + +Application Processor i/os +0x00-0x03 PIO (Parallel A Data, Parallel A Control, Parallel B Data, Parallel B Control) +0x20 DMA +0x30-0x33 CTC (Serial A Clock, Serial B Clock, Parity Error IRQ, Bus IRQ) +0x60-0x63 SIO (Serial A Data, Serial A Control, Serial B Data, Serial B Control) + +File Processor irqs: +0xf80c PIO Ch A +0xf80e PIO Ch B +0xf810-0xf81e SIO Vector N +0xf820-0xf826 CTC A, Channel N +0xf828-0xf82e CTC B, Channel N (do not use) +0xf830 DMA (do not use) + +Application Processor irqs: +0xf80c PIO Ch A +0xf80e PIO Ch B +0xf810 DMA (do not use) +0xf820-0xf82e SIO Vector N + +App Processor puts on sio port: +"??250 INITIALIZING..." + +File Processor puts on sio port: +"??FP RESTART" + +TODO: +- Info on HW ports is pretty scarse, other than a trim i/o documentation and schematics + +***********************************************************************************/ + + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "cpu/z80/z80.h" +//#include "sound/ay8910.h" + +#define I86_CLOCK XTAL_24MHz +#define Z80_CLOCK XTAL_16MHz + +class molecula_state : public driver_device +{ +public: + molecula_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_filecpu(*this, "filecpu") + { } + + // devices + required_device m_filecpu; + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + UINT8 *m_file_rom; + UINT8 *m_app_rom; + UINT8 *m_file_ram; + UINT8 *m_app_ram; + DECLARE_READ8_MEMBER(file_r); + DECLARE_WRITE8_MEMBER(file_w); + + DECLARE_READ8_MEMBER(app_r); + DECLARE_WRITE8_MEMBER(app_w); + + DECLARE_WRITE8_MEMBER(file_output_w); + DECLARE_WRITE8_MEMBER(app_output_w); + + DECLARE_READ8_MEMBER( sio_r ); + DECLARE_WRITE8_MEMBER( sio_w ); + + UINT8 app_ram_enable; + UINT8 file_ram_enable; + + DECLARE_PALETTE_INIT(molecula); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); +}; + +void molecula_state::video_start() +{ +} + +UINT32 molecula_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + return 0; +} + +READ8_MEMBER(molecula_state::file_r) +{ + if(file_ram_enable) + return m_file_ram[offset]; + + return m_file_rom[offset & 0x7ff]; +} + + +WRITE8_MEMBER(molecula_state::file_w) +{ + m_file_ram[offset] = data; +} + +READ8_MEMBER(molecula_state::app_r) +{ + if(app_ram_enable) + return m_app_ram[offset]; + + return m_app_rom[offset & 0x7ff]; +} + + +WRITE8_MEMBER(molecula_state::app_w) +{ + m_app_ram[offset] = data; +} + +WRITE8_MEMBER(molecula_state::file_output_w) +{ + if(offset == 0) + file_ram_enable = (data & 0x80) >> 7; + + if(data & 0x7f || offset) + printf("FILE output -> %02x %02x\n",data,offset); +} + + +WRITE8_MEMBER(molecula_state::app_output_w) +{ + app_ram_enable = (data & 0x80) >> 7; + + if(data & 0x7f) + printf("APP 0x10 -> %02x\n",data); +} + +READ8_MEMBER( molecula_state::sio_r) +{ + if(offset == 1) + return 4; + + return 0; +} + +WRITE8_MEMBER( molecula_state::sio_w) +{ + if(offset == 0) + printf("%c",data); +} + +static ADDRESS_MAP_START( molecula_file_map, AS_PROGRAM, 8, molecula_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(file_r,file_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( molecula_file_io, AS_IO, 8, molecula_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) +// AM_RANGE(0x40, 0x43) AM_READWRITE(sio_r,sio_w) + AM_RANGE(0x72, 0x73) AM_WRITE(file_output_w) // unknown +ADDRESS_MAP_END + +static ADDRESS_MAP_START( molecula_app_map, AS_PROGRAM, 8, molecula_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(app_r,app_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( molecula_app_io, AS_IO, 8, molecula_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x10, 0x10) AM_WRITE(app_output_w) + AM_RANGE(0x60, 0x63) AM_READWRITE(sio_r,sio_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( molecula ) + /* dummy active high structure */ + PORT_START("SYSA") + PORT_DIPNAME( 0x01, 0x00, "SYSA" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + /* dummy active low structure */ + PORT_START("DSWA") + PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +#if 0 +static const gfx_layout charlayout = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { RGN_FRAC(0,1) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; +#endif + +static GFXDECODE_START( molecula ) +// GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) +GFXDECODE_END + + +void molecula_state::machine_start() +{ + m_file_rom = memregion("fileipl")->base(); + m_app_rom = memregion("appipl")->base(); + + m_file_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); + m_app_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); +} + +void molecula_state::machine_reset() +{ + app_ram_enable = 0; + file_ram_enable = 0; +} + + +PALETTE_INIT_MEMBER(molecula_state, molecula) +{ +} + +static MACHINE_CONFIG_START( molecula, molecula_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("filecpu",Z80,Z80_CLOCK/2) + MCFG_CPU_PROGRAM_MAP(molecula_file_map) + MCFG_CPU_IO_MAP(molecula_file_io) + MCFG_DEVICE_DISABLE() + + MCFG_CPU_ADD("appcpu",Z80,Z80_CLOCK/2) + MCFG_CPU_PROGRAM_MAP(molecula_app_map) + MCFG_CPU_IO_MAP(molecula_app_io) + +// MCFG_CPU_ADD("sub",I8086,I86_CLOCK/2) +// MCFG_CPU_PROGRAM_MAP(molecula_map) +// MCFG_CPU_IO_MAP(molecula_io) +// MCFG_DEVICE_DISABLE() + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_UPDATE_DRIVER(molecula_state, screen_update) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", molecula) + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(molecula_state, molecula) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( molecula ) + ROM_REGION( 0x10000, "fileipl", ROMREGION_ERASE00 ) + ROM_LOAD( "sm32-111782-255-ff.bin", 0x000000, 0x000800, CRC(818f5f5a) SHA1(829b8fef99e6667d04d1944112823f3ea6a1a7e8) ) + + ROM_REGION( 0x10000, "appipl", ROMREGION_ERASE00 ) + ROM_LOAD( "ap-111181-fa.bin", 0x000000, 0x000800, CRC(c289fc90) SHA1(2c0a17808971400e0289d65a11ef09e1f5eb90a0) ) + + ROM_REGION( 0x1000, "x86ipl", ROMREGION_ERASE00 ) + ROM_LOAD16_BYTE( "ap86eve_2716.bin", 0x000000, 0x000800, CRC(d6484a11) SHA1(19cfea72afbc796e5b59c47095529d6d6350dd98) ) + ROM_LOAD16_BYTE( "ap86odd_2716.bin", 0x000001, 0x000800, CRC(a4403c13) SHA1(2aeb07ad1f3381cbd1ec901e1f095ae737ded538) ) + + /* same as ap-111181-fa.bin, with a different & bad byte at [3]*/ + ROM_REGION( 0x10000, "user2", ROMREGION_ERASE00 ) + ROM_LOAD( "ap-111181-253-fd.bin", 0x000000, 0x000800, CRC(10f16080) SHA1(10f13a04c525cd4b67e2b6e1a3eed46c619a439c) ) + + /* proms */ + ROM_REGION( 0x10000, "user3", ROMREGION_ERASE00 ) + ROM_LOAD( "ms01_82s131.bin", 0x000000, 0x000200, CRC(433b139c) SHA1(32c1e853faacf85b11506a6903789ef129dd6adc) ) + ROM_LOAD( "ms11_82s131.bin", 0x000200, 0x000200, CRC(cff86fed) SHA1(554ec15799afc6305c8cae0f9d55b32004479cdb) ) + + ROM_REGION( 0x10000, "misc", ROMREGION_ERASE00 ) + ROM_LOAD( "mem_16r4.jed", 0x000000, 0x00caef, CRC(a8cfbdfe) SHA1(92be58ab3299e0d3ac37bd1e258054c881b9ad7f) ) + ROM_LOAD( "rx_16r8.jed", 0x000000, 0x00caef, CRC(76f11ea8) SHA1(3ec41e5af04a89659f1b30270ee00e1fdf302ad6) ) + ROM_LOAD( "tx_16r8.jed", 0x000000, 0x00caef, CRC(a91dcf0b) SHA1(16d261f064a4af29c3da58f3ae8a867bdc953ce6) ) + ROM_LOAD( "wait_16r4.jed", 0x000000, 0x00caef, CRC(3aacfeb4) SHA1(1af1a8046e5a8a0337c85b55adceaef6e45702b7) ) +ROM_END + +COMP( 1982, molecula, 0, 0, molecula, molecula, driver_device, 0, "MOLECULAR", "MOLECULAR Computer", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/monty.c b/src/mame/drivers/monty.c new file mode 100644 index 00000000000..3ac595f9691 --- /dev/null +++ b/src/mame/drivers/monty.c @@ -0,0 +1,288 @@ +// license:BSD-3-Clause +// copyright-holders:Andrew Gardner +/*************************************************************************** + + 2015-05-08 Skeleton driver for Ritam Monty Plays Scrabble BRAND crossword game + + Scrabble computer that allows you play a game of Scrabble by yourself (or you + can play with up to 3 players). Has a built-in 12,000 vocabulary, expandable + to 44,000 by way of 2 expansion modules each containing 16,000 more obscure words. + You can use the included 'score cards' (which look like little Scrabble boards), + or you can use a real Scrabble board and tiles to play. Also note, Monty + apparently originally came with a little pen. + + This game was later upgraded by Ritam to Master Monty which had 24,000 words + built-in (expandable to a total of 56,000 with the same 2 expansion modules). + Two variations on Master Monty have been seen: one looks exactly the same as the + Monty but the electronics on the inside have been upgraded. The later version + is blue and says Master Monty at the top. Both of these versions are hand-upgraded + by adding chips and wires to the inside of the game. + + TODO: + - Need instructions + - Proper SED1503F emulation (it's simulated in-driver for now) + - After each keypress it hits a HALT instruction. I guess the controller's + sync pin is involved somehow. + - When it wants tiles, put 64 into FD1B (monty), 7D1B (mmonty) and press + Enter. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/sed1520.h" +#include "sound/speaker.h" + + +class monty_state : public driver_device +{ +public: + monty_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_speaker(*this, "speaker") + , m_sed0(*this, "sed1520_0") + , m_writeUpper(false) + { + for (int i = 0; i < 42*32; i++) + m_pixels[i] = 0xff000000; + } + + DECLARE_WRITE8_MEMBER(sound_w); + DECLARE_WRITE8_MEMBER(ioDisplayWrite_w); + DECLARE_WRITE8_MEMBER(ioCommandWrite0_w); + DECLARE_WRITE8_MEMBER(ioCommandWrite1_w); + + // screen updates + UINT32 lcd_update(screen_device& screen, bitmap_rgb32& bitmap, const rectangle& cliprect); + +private: + required_device m_maincpu; + required_device m_speaker; + required_device m_sed0; // TODO: This isn't actually a SED1520, it's a SED1503F + //required_device m_sed1; // TODO: Also, there are 2 SED1503Fs on the board - one is flipped upside down + + // Test + UINT8 m_writeUpper; + UINT32 m_pixels[42*32]; + bool m_sound_sw; + bool m_dirty; +}; + + +static ADDRESS_MAP_START( monty_mem, AS_PROGRAM, 8, monty_state ) + AM_RANGE(0x0000, 0xbfff) AM_ROM + //AM_RANGE(0x4000, 0x4000) // The main rom checks to see if another program is here on startup + AM_RANGE(0xf800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mmonty_mem, AS_PROGRAM, 8, monty_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM + //AM_RANGE(0xc000, 0xc000) // The main rom checks to see if another program is here on startup + AM_RANGE(0x8000, 0xffff) AM_ROM + AM_RANGE(0x7800, 0x7fff) AM_RAM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( monty_io, AS_IO, 8, monty_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(ioCommandWrite0_w) + AM_RANGE(0x01, 0x01) AM_WRITE(sound_w) + AM_RANGE(0x02, 0x02) AM_WRITE(ioCommandWrite1_w) + AM_RANGE(0x80, 0xff) AM_WRITE(ioDisplayWrite_w) + + // 7 reads from a bit shifted IO port + AM_RANGE(0x01, 0x01) AM_READ_PORT("X1") + AM_RANGE(0x02, 0x02) AM_READ_PORT("X2") + AM_RANGE(0x04, 0x04) AM_READ_PORT("X3") + AM_RANGE(0x08, 0x08) AM_READ_PORT("X4") + AM_RANGE(0x10, 0x10) AM_READ_PORT("X5") + AM_RANGE(0x20, 0x20) AM_READ_PORT("X6") + AM_RANGE(0x40, 0x40) AM_READ_PORT("X7") +ADDRESS_MAP_END + + +// Input ports +static INPUT_PORTS_START( monty ) + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X7") + PORT_BIT( 0xFF, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +WRITE8_MEMBER( monty_state::sound_w ) +{ + m_sound_sw ^= 1; + m_speaker->level_w(m_sound_sw); +} + + +WRITE8_MEMBER( monty_state::ioCommandWrite0_w ) +{ + //printf("(%04x) Command Port 0 write : %02x\n", m_maincpu->pc(), data); + m_writeUpper = false; +} + + +WRITE8_MEMBER( monty_state::ioCommandWrite1_w ) +{ + //if (data == 0xfe) + // printf("---\n"); + + //printf("(%04x) Command Port 1 write : %02x\n", m_maincpu->pc(), data); + m_writeUpper = true; +} + + +WRITE8_MEMBER( monty_state::ioDisplayWrite_w ) +{ + m_dirty = true; + // Offset directly corresponds to sed1503, DD RAM address (offset 0x7f may be special?) + //printf("(%04x) %02x %02x\n", m_maincpu->pc(), offset, data); + + UINT8 x = offset & 0x3f; + UINT8 y = (BIT(offset, 6) + (m_writeUpper ? 2 : 0)) << 3; + + // Skip the controller and write straight to the LCD (pc=134f) + for (int i = 0; i < 8; i++) + { + // Pixel color + if (x < 42) + m_pixels[(y*42) + x] = BIT(data, i) ? 0xffffffff : 0xff000000; + + y++; + } +} + + +UINT32 monty_state::lcd_update(screen_device& screen, bitmap_rgb32& bitmap, const rectangle& cliprect) +{ + if (!m_dirty) + return 1; + + UINT8 x,y,z; + m_dirty = false; + for (y = 0; y < 32; y++) + { + for (z = 0; z < 8; z++) + { + for (x = 0; x < 5; x++) + { + bitmap.pix32(y, x+z*6) = m_pixels[y*42 + z*5 + x]; + } + bitmap.pix32(y, 5+z*6) = 0; // space between letters + } + bitmap.pix32(y, 48) = m_pixels[y*42 + 40]; + bitmap.pix32(y, 49) = m_pixels[y*42 + 41]; + } + + return 0; +} + + +SED1520_UPDATE_CB(monty_screen_update) +{ + // TODO: Not really a SED1520 - there are two SED1503s + return 0x00; +} + + +// TODO: Additional machine definition - Master Monty has a different memory layout +static MACHINE_CONFIG_START( monty, monty_state ) + // Basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, 3580000) // Ceramic resonator labeled 3.58MT + MCFG_CPU_PROGRAM_MAP(monty_mem) + MCFG_CPU_IO_MAP(monty_io) + + // Video hardware + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // Not accurate + MCFG_SCREEN_SIZE(50, 32) // Two SED1503s (42x16 pixels) control the top and bottom halves + MCFG_SCREEN_VISIBLE_AREA(0, 50-1, 0, 32-1) + MCFG_SCREEN_UPDATE_DRIVER(monty_state, lcd_update) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + // LCD controller interfaces + MCFG_SED1520_ADD("sed1520_0", monty_screen_update) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mmonty, monty ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(mmonty_mem) +MACHINE_CONFIG_END + + +// ROM definitions +ROM_START( monty ) + ROM_REGION(0xc000, "maincpu", 0) + ROM_LOAD( "monty_main.bin", 0x0000, 0x4000, CRC(720b4f55) SHA1(0106eb88d3fbbf25a745b9b6ee785ba13689d095) ) // 27128 + ROM_LOAD( "monty_module1.bin", 0x4000, 0x4000, CRC(2725d8c3) SHA1(8273b9779c0915f9c7c43ea4fb460f43ce036358) ) // 27128 + ROM_LOAD( "monty_module2.bin", 0x8000, 0x4000, CRC(db672e47) SHA1(bb14fe86df06cfa4b19625ba417d1a5bc8eae155) ) // 27128 + ROM_FILL(0x1193,1,0) // patch out HALT so we can type in our names +ROM_END + +ROM_START( mmonty ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "master_monty_main.bin", 0x0000, 0x8000, CRC(bb5ef4d4) SHA1(ba2c759e429f8740df419f9abb60832eddfba8ab) ) // 27C256 + ROM_LOAD( "monty_module1.bin", 0x8000, 0x4000, CRC(2725d8c3) SHA1(8273b9779c0915f9c7c43ea4fb460f43ce036358) ) // 27128 + ROM_LOAD( "monty_module2.bin", 0xc000, 0x4000, CRC(db672e47) SHA1(bb14fe86df06cfa4b19625ba417d1a5bc8eae155) ) // 27128 + ROM_FILL(0x1487,1,0) // patch out HALT so we can type in our names +ROM_END + + +// Drivers +// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS +COMP( 1980, monty, 0, 0, monty, monty, driver_device, 0, "Ritam", "Monty Plays Scrabble", MACHINE_NOT_WORKING ) +COMP( 1982, mmonty, 0, 0, mmonty, monty, driver_device, 0, "Ritam", "Master Monty", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/mpf1.c b/src/mame/drivers/mpf1.c new file mode 100644 index 00000000000..b8ed818e0e8 --- /dev/null +++ b/src/mame/drivers/mpf1.c @@ -0,0 +1,483 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Curt Coder +/************************************************\ +* Multitech Micro Professor 1 * +* * +* CPU: Z80 @ 1.79 MHz * +* ROM: 4-kilobyte ROM monitor * +* RAM: 4 kilobytes * +* Input: Hex keypad * +* Storage: Cassette tape * +* Video: 6x 7-segment LED display * +* Sound: Speaker * +\************************************************/ + +/* + + Keys: + 0-9,A-F : hexadecimal numbers + ADR : enter an address to work with. After the 4 digits are entered, + the data at that address shows, and you can modify the data. + + : Enter the data into memory, and increment the address by 1. + GO : execute the program located at the current address. + + Pasting: + 0-F : as is + + : ^ + - : V + ADDR : - + DATA : = + GO : X + PC : P + + Test Paste: + -1800=11^22^33^44^55^66^77^88^99^-1800 + Now press up-arrow to confirm the data has been entered. + + TODO: + + - remove halt callback + - crt board + - speech board + - printers + - clickable artwork + - video board (has 6845) + - mpf1p has 49-key keyboard + - computer can't keep up with paste + - paste only set up for mpf1 + +*/ + +#include "includes/mpf1.h" +#include "mpf1.lh" +#include "mpf1b.lh" +#include "mpf1p.lh" + +/* Address Maps */ + +static ADDRESS_MAP_START( mpf1_map, AS_PROGRAM, 8, mpf1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1800, 0x1fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mpf1b_map, AS_PROGRAM, 8, mpf1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1800, 0x1fff) AM_RAM + AM_RANGE(0x2000, 0x2fff) AM_ROM + AM_RANGE(0x5000, 0x6fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mpf1p_map, AS_PROGRAM, 8, mpf1_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x6000, 0x6fff) AM_ROM + AM_RANGE(0xf000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mpf1_io_map, AS_IO, 8, mpf1_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_MIRROR(0x3c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) + AM_RANGE(0x40, 0x43) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mpf1b_io_map, AS_IO, 8, mpf1_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_MIRROR(0x3c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) + AM_RANGE(0x40, 0x43) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) + AM_RANGE(0xfe, 0xfe) AM_MIRROR(0x01) AM_DEVREADWRITE(TMS5220_TAG, tms5220_device, status_r, data_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mpf1p_io_map, AS_IO, 8, mpf1_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_MIRROR(0x3c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) + AM_RANGE(0x40, 0x43) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( mpf1_state::trigger_nmi ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER( mpf1_state::trigger_irq ) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER( mpf1_state::trigger_res ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( mpf1 ) + PORT_START("PC0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 HL") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 HL'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B I*IF") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F *PNC'") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 DE") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 DE'") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A SP") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E SZ*H'") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 BC") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 BC'") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 IY") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D *PNC") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STEP") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAPE RD") PORT_CODE(KEYCODE_F5) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 AF") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 AF'") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 IX") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C SZ*H") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAPE WR") PORT_CODE(KEYCODE_F6) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBR") PORT_CODE(KEYCODE_N) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_COMMA) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ADDR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_SLASH) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RELA") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SBR") PORT_CODE(KEYCODE_H) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DATA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_COLON) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MOVE") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("USER KEY") PORT_CODE(KEYCODE_U) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MONI") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_nmi, 0) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INTR") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_irq, 0) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_res, 0) +INPUT_PORTS_END + +static INPUT_PORTS_START( mpf1b ) + PORT_START("PC0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 >") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B STOP") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F LET") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 *") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 <") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A CALL") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E INPUT") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 -") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 =") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 P") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D PRINT") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CONT") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOAD") PORT_CODE(KEYCODE_F5) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 +") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 * *") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 M") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C NEXT") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SAVE") PORT_CODE(KEYCODE_F6) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("IF/\xE2\x88\xA7") PORT_CODE(KEYCODE_PGUP) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TO/\xE2\x86\x93") PORT_CODE(KEYCODE_T) PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("THEN/\xE2\x88\xA8") PORT_CODE(KEYCODE_PGDN) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GOTO") PORT_CODE(KEYCODE_G) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RET/\xE2\x89\x81") PORT_CODE(KEYCODE_R) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GOSUB") PORT_CODE(KEYCODE_O) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PC5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FOR/\xE2\x86\x91") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LIST") PORT_CODE(KEYCODE_L) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NEW") PORT_CODE(KEYCODE_N) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR/\xE2\x86\x92") PORT_CODE(KEYCODE_INSERT) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL/\xE2\x86\x90") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MONI") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_nmi, 0) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INTR") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_irq, 0) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_res, 0) +INPUT_PORTS_END + +/* Intel 8255A Interface */ + +TIMER_CALLBACK_MEMBER(mpf1_state::led_refresh) +{ + if (BIT(m_lednum, 5)) output_set_digit_value(0, param); + if (BIT(m_lednum, 4)) output_set_digit_value(1, param); + if (BIT(m_lednum, 3)) output_set_digit_value(2, param); + if (BIT(m_lednum, 2)) output_set_digit_value(3, param); + if (BIT(m_lednum, 1)) output_set_digit_value(4, param); + if (BIT(m_lednum, 0)) output_set_digit_value(5, param); +} + +READ8_MEMBER( mpf1_state::ppi_pa_r ) +{ + UINT8 data = 0x7f; + + /* bit 0 to 5, keyboard rows 0 to 5 */ + if (!BIT(m_lednum, 0)) data &= m_pc0->read(); + if (!BIT(m_lednum, 1)) data &= m_pc1->read(); + if (!BIT(m_lednum, 2)) data &= m_pc2->read(); + if (!BIT(m_lednum, 3)) data &= m_pc3->read(); + if (!BIT(m_lednum, 4)) data &= m_pc4->read(); + if (!BIT(m_lednum, 5)) data &= m_pc5->read(); + + /* bit 6, user key */ + data &= m_special->read() & 1 ? 0xff : 0xbf; + + /* bit 7, tape input */ + data |= ((m_cassette)->input() > 0) ? 0x80 : 0; + + return data; +} + +WRITE8_MEMBER( mpf1_state::ppi_pb_w ) +{ + /* swap bits around for the mame 7-segment emulation */ + UINT8 led_data = BITSWAP8(data, 6, 1, 2, 0, 7, 5, 4, 3); + + /* timer to update segments */ + m_led_refresh_timer->adjust(attotime::from_usec(70), led_data); +} + +WRITE8_MEMBER( mpf1_state::ppi_pc_w ) +{ + /* bits 0-5, led select and keyboard latch */ + m_lednum = data & 0x3f; + m_led_refresh_timer->adjust(attotime::never); + + /* bit 6, monitor break control */ + m_break = BIT(data, 6); + + if (m_break) + { + m_m1 = 0; + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + } + + /* bit 7, tape output, tone and led */ + set_led_status(machine(), 0, !BIT(data, 7)); + m_speaker->level_w(BIT(data, 7)); + m_cassette->output( BIT(data, 7) ? 1.0 : -1.0); +} + +/* Z80 Daisy Chain */ + +static const z80_daisy_config mpf1_daisy_chain[] = +{ + { Z80CTC_TAG }, + { Z80PIO_TAG }, + { NULL } +}; + +/* Machine Initialization */ + +TIMER_DEVICE_CALLBACK_MEMBER(mpf1_state::check_halt_callback) +{ + // halt-LED; the red one, is turned on when the processor is halted + // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix + INT64 led_halt = m_maincpu->state_int(Z80_HALT); + set_led_status(machine(), 1, led_halt); +} + +void mpf1_state::machine_start() +{ + m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mpf1_state::led_refresh),this)); + + /* register for state saving */ + save_item(NAME(m_break)); + save_item(NAME(m_m1)); + save_item(NAME(m_lednum)); +} + +void mpf1_state::machine_reset() +{ + m_lednum = 0; +} + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( mpf1, mpf1_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_3_579545MHz/2) + MCFG_CPU_PROGRAM_MAP(mpf1_map) + MCFG_CPU_IO_MAP(mpf1_io_map) + MCFG_CPU_CONFIG(mpf1_daisy_chain) + + /* devices */ + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_3_579545MHz/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_3_579545MHz/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mpf1_state, ppi_pa_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mpf1_state, ppi_pb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mpf1_state, ppi_pc_w)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mpf1) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( mpf1b, mpf1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_3_579545MHz/2) + MCFG_CPU_PROGRAM_MAP(mpf1b_map) + MCFG_CPU_IO_MAP(mpf1b_io_map) + MCFG_CPU_CONFIG(mpf1_daisy_chain) + + /* devices */ + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_3_579545MHz/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_3_579545MHz/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mpf1_state, ppi_pa_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mpf1_state, ppi_pb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mpf1_state, ppi_pc_w)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mpf1b) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_ADD(TMS5220_TAG, TMS5220, 680000L) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( mpf1p, mpf1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 2500000) + MCFG_CPU_PROGRAM_MAP(mpf1p_map) + MCFG_CPU_IO_MAP(mpf1p_io_map) + MCFG_CPU_CONFIG(mpf1_daisy_chain) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_mpf1p) + + /* devices */ + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, 2500000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 2500000) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mpf1_state, ppi_pa_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mpf1_state, ppi_pb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mpf1_state, ppi_pc_w)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( mpf1 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "mpf.u6", 0x0000, 0x1000, CRC(b60249ce) SHA1(78e0e8874d1497fabfdd6378266d041175e3797f) ) +ROM_END + +ROM_START( mpf1b ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "c55167.u6", 0x0000, 0x1000, CRC(28b06dac) SHA1(99cfbab739d71a914c39302d384d77bddc4b705b) ) + ROM_LOAD( "basic.u7", 0x2000, 0x1000, CRC(d276ed6b) SHA1(a45fb98961be5e5396988498c6ed589a35398dcf) ) + ROM_LOAD( "ssb-mpf.u", 0x5000, 0x1000, CRC(f926334f) SHA1(35847f8164eed4c0794a8b74e5d7fa972b10eb90) ) + ROM_LOAD( "prt-mpf.u5", 0x6000, 0x1000, CRC(730f2fb0) SHA1(f31536ee9dbb9babb9ce16a7490db654ca0b5749) ) +ROM_END + +ROM_START( mpf1p ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "mpf1pmon.bin", 0x0000, 0x2000, BAD_DUMP CRC(91ace7d3) SHA1(22e3c16a81ac09f37741ad1b526a4456b2ba9493) ) // A9 stuck low when dumped + ROM_LOAD( "prt-mpf-ip.u5", 0x6000, 0x1000, CRC(4dd2a4eb) SHA1(6a3e7daa7834d67fd572261ed4a9a62c4594fe3f) ) +ROM_END + +/* System Drivers */ + +DIRECT_UPDATE_MEMBER(mpf1_state::mpf1_direct_update_handler) +{ + if (!m_break) + { + m_m1++; + + if (m_m1 == 5) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + } + } + + return address; +} + +DRIVER_INIT_MEMBER(mpf1_state,mpf1) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mpf1_state::mpf1_direct_update_handler), this)); +} + +COMP( 1979, mpf1, 0, 0, mpf1, mpf1, mpf1_state, mpf1, "Multitech", "Micro Professor 1", 0) +COMP( 1979, mpf1b, mpf1, 0, mpf1b,mpf1b, mpf1_state, mpf1, "Multitech", "Micro Professor 1B", 0) +COMP( 1982, mpf1p, mpf1, 0, mpf1p,mpf1b, mpf1_state, mpf1, "Multitech", "Micro Professor 1 Plus", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/mps1230.c b/src/mame/drivers/mps1230.c new file mode 100644 index 00000000000..9537036fd2a --- /dev/null +++ b/src/mame/drivers/mps1230.c @@ -0,0 +1,154 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + mps1230.c - Commodore MPS-1230 dot-matrix printer + + Skeleton made September, 2015 by R. Belmont + +------------------------------------- + +Commodore MPS-1230 Dot Matrix Printer +Commodore 1988/89 + +This is a 9-pin dot matrix printer manufactured by Commodore (possibly under license from Olivetti) +The printer is based on the Olivetti DM100 9-pin dot matrix printer with an added Commodore +serial port and other Commodore modifications. The service manual shows the PCB as 'DM10XC2', +however the actual PCB does not exactly match that shown in the service manual. +The firmware is modified by Commodore to support the CBM ASCII character and command set. + +The printer comes standard with Centronics Parallel and Commodore Serial ports, sheet feed +and tractor feed and can be used with Commodore 64, 128/D, Amiga and IBM compatibles. + +The ink ribbons are compatible with, and used in the following printers.... +Commodore MPS 1230 printer +Olivetti DM 100, DM 90-1, DM 95, DM 99 & PR 98 printers +Birch BR-600 POS/cash register +Facit E 440 printer +Philips NMS 1016 & NMS 1432 printers +Senor Science K-700 & K-750 POS/cash register +Triumph Adler MPR 7120 printer + + +PCB Layout +---------- + +BA235 +OLIVETTI OPE MADE IN HONGKONG +750746Y00-A-B9 + + CENTRONICS SERIAL +|-|------------|--------|---|----------| +|J899 J369 9306 7407 J02G L387A| +| J169| +| D7810 6264 27512 | +|J708 MB624207 | +|-----| | + | 11.06MHz J532 | + | | + | 555 L293 L6210 2803 2803 | + |J404 74LS14 J477 2803 J821| + |--------------------------------| +Notes: (all IC's shown) + D7810 - NEC D7810HG ROM-less Microcontroller, clock input 11.06MHz (64 pin 'spider' package) + MB624207 - Fujitsu MB624207U MB62XXXX UHB Series 1.5um CMOS Gate Array marked 'OPE 200' (SDIP64) + 6264 - 8k x8 SRAM (DIP28) + 27512 - TMS27C512 64k x8 EPROM (DIP28) + S/W revisions dumped: + 'Release R - 1.1D 10/NOV/1988' with label 'PDL2' + 'Release R - 2.1E 09/AUG/1989' with label 'PEEK' + L387A - ST L387A 5V @ 0.5A Voltage Regulator + 2803 - ULN2803A 8-Channel Darlinton Driver (DIP18) + L6210 - ST L6210R Dual Schottky Diode Bridge (DIP16) + L293 - ST L293ER Quad Push-Pull Driver (DIP20) + 74LS14 - National DM74LS14N Hex Inverter with Schmitt Trigger (DIP14) + 555 - Texas Instruments NE555P Timer (DIP8) + 9306 - National NMC9306N 32bytes Serial EEPROM (DIP8) + 7407 - Texas Instruments ON7404N Hex Buffer with High Voltage Open-Collector Outputs (DIP14) + J169 - 3-pin 9v power input connector (from built-in transformer) + J821 - 6-pin connector for paper feed motor + J532 - 12-pin connector for print head + J477 - 2-pin print head transport motor connector + J404 - 4-pin connector for paper-out photosensor + J708 - 6-pin connector for transport motor encoder + J899 - 15-pin connector for ribbon cable for console buttons and leds (feed, online etc) + J369 - 36-pin centronics parallel connector + J02G - 6-pin Commodore serial bus connector + +************************************************************************/ + +#include "emu.h" + +#include "cpu/upd7810/upd7810.h" + +#define CPU_TAG "maincpu" + +class mps1230_state : public driver_device +{ +public: + mps1230_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CPU_TAG) + { } + + required_device m_maincpu; + + virtual void machine_start(); + virtual void machine_reset(); + +private: +}; + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +/*************************************************************************** + START/RESET +***************************************************************************/ + +void mps1230_state::machine_start() +{ +} + +void mps1230_state::machine_reset() +{ +} + +/*************************************************************************** + ADDRESS MAP +***************************************************************************/ + +static ADDRESS_MAP_START( mps1230_map, AS_PROGRAM, 8, mps1230_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("mps1230", 0) + AM_RANGE(0xc000, 0xdfff) AM_RAM // as per the service manual + AM_RANGE(0xff00, 0xffff) AM_RAM // tested at PC=77, then used for the 7810's stack +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( mps1230 ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( mps1230, mps1230_state ) + MCFG_CPU_ADD(CPU_TAG, UPD7810, 11060000) + MCFG_CPU_PROGRAM_MAP(mps1230_map) +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(mps1230) + ROM_REGION(0x10000, "mps1230", 0) + ROM_LOAD( "pdl2.f03ee", 0x000000, 0x010000, CRC(f8a9f45c) SHA1(4e7bb0d382c55432665f5576b6a5cd3c4c33bd8e) ) // ver 1.1D, 10/NOV/1988 + ROM_LOAD( "peek.f03ee", 0x000000, 0x010000, CRC(b5215f25) SHA1(dcfdd16942652447c472301392d9b39514547af1) ) // ver 2.1E, 09/AUG/1989 + +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1988, mps1230, 0, 0, mps1230, mps1230, driver_device, 0, "Commodore Business Machines", "MPS-1230 NLQ Printer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_TYPE_OTHER ) diff --git a/src/mame/drivers/mpz80.c b/src/mame/drivers/mpz80.c new file mode 100644 index 00000000000..b8a947a4903 --- /dev/null +++ b/src/mame/drivers/mpz80.c @@ -0,0 +1,807 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Morrow MPZ80 "Decision" + + Skeleton driver + +*/ + +/* + + TODO: + + - trap logic + - trap stop + - trap aux + - trap halt + - trap int + - trap void + - in/out trap + - read/write trap + - exec trap + - front panel LEDs + - keyboard + - I/O + - Mult I/O (8259A PIC, 3x 8250 ACE, uPD1990C RTC, 4K ROM/RAM) + - floppy + - DJ/DMA controller (Z80, 1K RAM, 2/4K ROM, TTL floppy control logic) for 5.25" floppy drives + - DJ2D/B controller for 8" floppy drives + - hard disk + - HDC/DMA controller (Seagate ST-506/Shugart SA1000) + - HDCA controller (Shugart SA4000/Fujitsu M2301B/Winchester M2320B) + - AM9512 FPU + - models + - Decision I Desk Top Model D1 (MPZ80, MM65KS, Wunderbus) + - Decision I Desk Top Model D2 (MPZ80, MM65KS, Wunderbus, DJDMA, 2x DSDD 5.25") + - Decision I Desk Top Model D2A (MPZ80, MM65KS, Wunderbus, DJDMA, 2x DSDD 5.25", HDCDMA, 5 or 16 MB hard disk?) + - Decision I Desk Top Model D3A (MPZ80, MM65KS, Wunderbus, DJDMA, 2x DSDD 5.25", HDCDMA, 5 or 16 MB hard disk?) + - Decision I Desk Top Model D3C (MPZ80, MM65KS, Wunderbus, DJDMA, 2x DSDD 5.25", HDCDMA, 5 or 16 MB hard disk?) + +*/ + +#include "includes/mpz80.h" + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +enum +{ + NO_ACCESS = 0, + READ_ONLY, + EXECUTE_ONLY, + FULL_ACCESS +}; + +#define TASK0 ((m_task & 0x0f) == 0) + +#define R10 0x04 + + +// mask register +#define MASK_STOP_ENBL 0x01 +#define MASK_AUX_ENBL 0x02 +#define MASK_TINT_ENBL 0x04 +#define MASK_RUN_ENBL 0x08 +#define MASK_HALT_ENBL 0x10 +#define MASK_SINT_ENBL 0x20 +#define MASK_IOENBL 0x40 +#define MASK_ZIO_MODE 0x80 + + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// check_traps - +//------------------------------------------------- + +inline void mpz80_state::check_traps() +{ + m_pretrap = !(m_trap_int & m_trap_halt & m_trap_stop & m_trap_aux); + + if (m_pretrap) + { + // latch trap condition + m_status = m_trap_void; + m_status |= m_trap_halt << 2; + m_status |= m_trap_int << 3; + m_status |= m_trap_stop << 4; + m_status |= m_trap_aux << 5; + + // latch trap address + m_pretrap_addr = ((m_addr >> 8) & 0xf0) | (m_pretrap_addr >> 4); + + // set M1 trap region start address + m_trap_start = m_addr; + } +} + + +//------------------------------------------------- +// check_interrupt - +//------------------------------------------------- + +inline void mpz80_state::check_interrupt() +{ + int tint_enbl = (m_mask & MASK_TINT_ENBL) ? 1 : 0; + int sint_enbl = (m_mask & MASK_SINT_ENBL) ? 0 : 1; + + m_int_pend = !(m_nmi & m_pint); + m_trap_int = !(m_int_pend & tint_enbl); + + int z80irq = CLEAR_LINE; + int z80nmi = CLEAR_LINE; + + if (TASK0) + { + if (!m_pint && !sint_enbl) z80irq = ASSERT_LINE; + if (!m_nmi && !sint_enbl) z80nmi = ASSERT_LINE; + } + else + { + if (!m_pint && !tint_enbl) z80irq = ASSERT_LINE; + if (!m_nmi && !tint_enbl) z80nmi = ASSERT_LINE; + } + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, z80irq); + m_maincpu->set_input_line(INPUT_LINE_NMI, z80nmi); + + check_traps(); +} + + + +//************************************************************************** +// MEMORY MANAGEMENT +//************************************************************************** + +//------------------------------------------------- +// get_address - +//------------------------------------------------- + +inline offs_t mpz80_state::get_address(offs_t offset) +{ + UINT16 map_addr = ((m_task & 0x0f) << 5) | ((offset & 0xf000) >> 11); + UINT8 map = m_map_ram[map_addr]; + //UINT8 attr = m_map_ram[map_addr + 1]; + + //logerror("task %02x map_addr %03x map %02x attr %02x address %06x\n", m_task, map_addr, map, attr, offset); + + // T7 T6 T5 T4 M7 M6 M5 M4 M3 M2 M1 M0 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 + return ((m_task & 0xf0) << 16) | (map << 12) | (offset & 0xfff); +} + + +//------------------------------------------------- +// mmu_r - +//------------------------------------------------- + +READ8_MEMBER( mpz80_state::mmu_r ) +{ + m_addr = get_address(offset); + UINT8 data = 0; + + if (m_pretrap) + { + m_pretrap = 0; + m_trap = 1; + + // latch trap address + m_pretrap_addr = ((m_addr >> 8) & 0xf0) | (m_pretrap_addr >> 4); + m_trap_addr = m_pretrap_addr; + } + + if (TASK0 && (offset < 0x1000)) + { + if (offset < 0x400) + { + data = m_ram->pointer()[offset & 0x3ff]; + } + else if (offset == 0x400) + { + data = trap_addr_r(space, 0); + } + else if (offset == 0x401) + { + data = keyboard_r(space, 0); + } + else if (offset == 0x402) + { + data = switch_r(space, 0); + } + else if (offset == 0x403) + { + data = status_r(space, 0); + } + else if (offset >= 0x600 && offset < 0x800) + { + // TODO this might change the map RAM contents + } + else if (offset < 0xc00) + { + UINT16 rom_addr = (m_trap_reset << 10) | (offset & 0x3ff); + data = m_rom->base()[rom_addr]; + } + else + { + logerror("Unmapped LOCAL read at %06x\n", offset); + } + } + else + { + data = m_s100->smemr_r(space, m_addr); + } + + return data; +} + + +//------------------------------------------------- +// mmu_w - +//------------------------------------------------- + +WRITE8_MEMBER( mpz80_state::mmu_w ) +{ + m_addr = get_address(offset); + + if (TASK0 && (offset < 0x1000)) + { + if (offset < 0x400) + { + m_ram->pointer()[offset & 0x3ff] = data; + } + else if (offset == 0x400) + { + disp_seg_w(space, 0, data); + } + else if (offset == 0x401) + { + disp_col_w(space, 0, data); + } + else if (offset == 0x402) + { + task_w(space, 0, data); + } + else if (offset == 0x403) + { + mask_w(space, 0, data); + } + else if (offset >= 0x600 && offset < 0x800) + { + m_map_ram[offset - 0x600] = data; + } + else + { + logerror("Unmapped LOCAL write at %06x\n", offset); + } + } + else + { + m_s100->mwrt_w(space, m_addr, data); + } +} + + +//------------------------------------------------- +// get_io_address - +//------------------------------------------------- + +inline offs_t mpz80_state::get_io_address(offs_t offset) +{ + if (m_mask & MASK_ZIO_MODE) + { + // echo port address onto upper address lines (8080 emulation) + offset = ((offset << 8) & 0xff00) | (offset & 0xff); + } + + return offset; +} + + +//------------------------------------------------- +// mmu_io_r - +//------------------------------------------------- + +READ8_MEMBER( mpz80_state::mmu_io_r ) +{ + return m_s100->sinp_r(space, get_io_address(offset)); +} + + +//------------------------------------------------- +// mmu_io_w - +//------------------------------------------------- + +WRITE8_MEMBER( mpz80_state::mmu_io_w ) +{ + m_s100->sout_w(space, get_io_address(offset), data); +} + + +//------------------------------------------------- +// trap_addr_r - trap address register +//------------------------------------------------- + +READ8_MEMBER( mpz80_state::trap_addr_r ) +{ + /* + + bit description + + 0 DADDR 12 + 1 DADDR 13 + 2 DADDR 14 + 3 DADDR 15 + 4 I-ADDR 12 + 5 I-ADDR 13 + 6 I-ADDR 14 + 7 I-ADDR 15 + + */ + + return m_trap_addr; +} + + +//------------------------------------------------- +// status_r - trap status register +//------------------------------------------------- + +READ8_MEMBER( mpz80_state::status_r ) +{ + /* + + bit description + + 0 _TRAP VOID + 1 _IORQ + 2 _TRAP HALT + 3 _TRAP INT + 4 _TRAP STOP + 5 _TRAP AUX + 6 R10 + 7 _RD STB + + */ + + return m_status; +} + + +//------------------------------------------------- +// task_w - task register +//------------------------------------------------- + +WRITE8_MEMBER( mpz80_state::task_w ) +{ + /* + + bit description + + 0 T0, A16 + 1 T1, A17 + 2 T2, A18 + 3 T3, A19 + 4 T4, S-100 A20 + 5 T5, S-100 A21 + 6 T6, S-100 A22 + 7 T7, S-100 A23 + + */ + + m_task = data; + + m_trap_reset = 1; + check_traps(); +} + + +//------------------------------------------------- +// mask_w - mask register +//------------------------------------------------- + +WRITE8_MEMBER( mpz80_state::mask_w ) +{ + /* + + bit description + + 0 _STOP ENBL + 1 AUX ENBL + 2 _TINT ENBL + 3 RUN ENBL + 4 _HALT ENBL + 5 SINT ENBL + 6 _IOENBL + 7 _ZIO MODE + + */ + + m_mask = data; +} + + + +//************************************************************************** +// FRONT PANEL +//************************************************************************** + +//------------------------------------------------- +// keyboard_r - front panel keyboard +//------------------------------------------------- + +READ8_MEMBER( mpz80_state::keyboard_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + return 0; +} + + +//------------------------------------------------- +// switch_r - switch register +//------------------------------------------------- + +READ8_MEMBER( mpz80_state::switch_r ) +{ + /* + + bit description + + 0 _TRAP RESET + 1 INT PEND + 2 16C S6 + 3 16C S5 + 4 16C S4 + 5 16C S3 + 6 16C S2 + 7 16C S1 + + */ + + UINT8 data = 0; + + // trap reset + data |= m_trap_reset; + + // interrupt pending + data |= m_int_pend << 1; + + // boot address + data |= m_16c->read() & 0xfc; + + return data; +} + + +//------------------------------------------------- +// disp_seg_w - front panel segment +//------------------------------------------------- + +WRITE8_MEMBER( mpz80_state::disp_seg_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ +} + + +//------------------------------------------------- +// disp_col_w - front panel column +//------------------------------------------------- + +WRITE8_MEMBER( mpz80_state::disp_col_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( mpz80_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( mpz80_mem, AS_PROGRAM, 8, mpz80_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(mmu_r, mmu_w) +/* + Task 0 Segment 0 map: + + AM_RANGE(0x0000, 0x03ff) AM_RAM + AM_RANGE(0x0400, 0x0400) AM_READWRITE(trap_addr_r, disp_seg_w) + AM_RANGE(0x0401, 0x0401) AM_READWRITE(keyboard_r, disp_col_w) + AM_RANGE(0x0402, 0x0402) AM_READWRITE(switch_r, task_w) + AM_RANGE(0x0403, 0x0403) AM_READWRITE(status_r, mask_w) + AM_RANGE(0x0600, 0x07ff) AM_RAM AM_SHARE("map_ram") + AM_RANGE(0x0800, 0x0bff) AM_ROM AM_REGION(Z80_TAG, 0) + AM_RANGE(0x0c00, 0x0c00) AM_DEVREADWRITE(AM9512_TAG, am9512_device, read, write) +*/ +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( mpz80_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( mpz80_io, AS_IO, 8, mpz80_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(mmu_io_r, mmu_io_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( mpz80 ) +//------------------------------------------------- + +static INPUT_PORTS_START( mpz80 ) + PORT_START("16C") + PORT_DIPNAME( 0xf8, 0xf8, "Power-On-Jump Address" ) PORT_DIPLOCATION("16C:1,2,3,4,5") PORT_CONDITION("12C", 0x02, EQUALS, 0x02) + PORT_DIPSETTING( 0xf8, "F800H" ) + PORT_DIPSETTING( 0xf0, "F000H" ) + PORT_DIPSETTING( 0xe8, "E800H" ) + PORT_DIPSETTING( 0xe0, "E000H" ) + PORT_DIPSETTING( 0xd8, "D800H" ) + PORT_DIPSETTING( 0xd0, "D000H" ) + PORT_DIPSETTING( 0xc8, "C800H" ) + PORT_DIPSETTING( 0xc0, "C000H" ) + PORT_DIPSETTING( 0xb8, "B800H" ) + PORT_DIPSETTING( 0xb0, "B000H" ) + PORT_DIPSETTING( 0xa8, "A800H" ) + PORT_DIPSETTING( 0xa0, "A000H" ) + PORT_DIPSETTING( 0x98, "9800H" ) + PORT_DIPSETTING( 0x90, "9000H" ) + PORT_DIPSETTING( 0x88, "8800H" ) + PORT_DIPSETTING( 0x80, "8000H" ) + PORT_DIPSETTING( 0x78, "7800H" ) + PORT_DIPSETTING( 0x70, "7000H" ) + PORT_DIPSETTING( 0x68, "6800H" ) + PORT_DIPSETTING( 0x60, "6000H" ) + PORT_DIPSETTING( 0x58, "5800H" ) + PORT_DIPSETTING( 0x50, "5000H" ) + PORT_DIPSETTING( 0x48, "4800H" ) + PORT_DIPSETTING( 0x40, "4000H" ) + PORT_DIPSETTING( 0x38, "3800H" ) + PORT_DIPSETTING( 0x30, "3000H" ) + PORT_DIPSETTING( 0x28, "2800H" ) + PORT_DIPSETTING( 0x20, "2000H" ) + PORT_DIPSETTING( 0x18, "1800H" ) + PORT_DIPSETTING( 0x10, "Boot DJ/DMA" ) + PORT_DIPSETTING( 0x08, "Boot HD/DMA" ) + PORT_DIPSETTING( 0x00, "Boot HDCA" ) + PORT_DIPNAME( 0x70, 0x00, "Diagnostics" ) PORT_DIPLOCATION("16C:2,3,4") PORT_CONDITION("12C", 0x02, EQUALS, 0x00) + PORT_DIPSETTING( 0x00, "Read Registers" ) + PORT_DIPSETTING( 0x10, "Write Registers" ) + PORT_DIPSETTING( 0x20, "Write Map RAMs" ) + PORT_DIPSETTING( 0x30, "Write R/W RAMs" ) + PORT_DIPSETTING( 0x40, "R/W FPP" ) + PORT_DIPSETTING( 0x50, "R/W S-100 Bus (High/Low)" ) + PORT_DIPSETTING( 0x60, "R/W S-100 Bus (Alternating)" ) + PORT_DIPSETTING( 0x70, "Read Switches" ) + PORT_DIPNAME( 0x04, 0x00, "Power Up" ) PORT_DIPLOCATION("16C:6") + PORT_DIPSETTING( 0x04, "Boot Address" ) + PORT_DIPSETTING( 0x00, "Monitor" ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("16C:7") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x01, 0x00, "S-100 MWRITE" ) PORT_DIPLOCATION("16C:8") + PORT_DIPSETTING( 0x01, "Disabled" ) + PORT_DIPSETTING( 0x00, "Enabled" ) + + PORT_START("12C") + PORT_DIPNAME( 0x02, 0x02, "Operation Mode" ) + PORT_DIPSETTING( 0x02, "Monitor" ) + PORT_DIPSETTING( 0x00, "Diagnostic" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// S100_INTERFACE( s100_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( mpz80_state::s100_pint_w ) +{ + m_pint = (state == ASSERT_LINE) ? 0 : 1; + + check_interrupt(); +} + +WRITE_LINE_MEMBER( mpz80_state::s100_nmi_w ) +{ + if (state == ASSERT_LINE) + { + m_nmi = 0; + } + + check_interrupt(); +} + +// slot devices +#include "bus/s100/dj2db.h" +#include "bus/s100/djdma.h" +#include "bus/s100/mm65k16s.h" +//#include "bus/s100/nsmdsa.h" +//#include "bus/s100/nsmdsad.h" +#include "bus/s100/wunderbus.h" + +static SLOT_INTERFACE_START( mpz80_s100_cards ) + SLOT_INTERFACE("mm65k16s", S100_MM65K16S) + SLOT_INTERFACE("wunderbus", S100_WUNDERBUS) + SLOT_INTERFACE("dj2db", S100_DJ2DB) + SLOT_INTERFACE("djdma", S100_DJDMA) +// SLOT_INTERFACE("multio", S100_MULTIO) +// SLOT_INTERFACE("hdcdma", S100_HDCDMA) +// SLOT_INTERFACE("hdca", S100_HDCA) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( mpz80 ) +//------------------------------------------------- + +void mpz80_state::machine_start() +{ + m_map_ram.allocate(0x200); +} + + +void mpz80_state::machine_reset() +{ + m_trap_reset = 0; + m_trap = 1; + m_trap_start = 0; + + m_nmi = 1; + + check_interrupt(); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( mpz80 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( mpz80, mpz80_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(mpz80_mem) + MCFG_CPU_IO_MAP(mpz80_io) + + // S-100 + MCFG_S100_BUS_ADD() + MCFG_S100_IRQ_CALLBACK(WRITELINE(mpz80_state, s100_pint_w)) + MCFG_S100_NMI_CALLBACK(WRITELINE(mpz80_state, s100_nmi_w)) + MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + MCFG_S100_SLOT_ADD("s100_1", mpz80_s100_cards, "mm65k16s") + MCFG_S100_SLOT_ADD("s100_2", mpz80_s100_cards, "wunderbus") + MCFG_S100_SLOT_ADD("s100_3", mpz80_s100_cards, "dj2db") + MCFG_S100_SLOT_ADD("s100_4", mpz80_s100_cards, NULL)//"hdcdma") + MCFG_S100_SLOT_ADD("s100_5", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_6", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_7", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_8", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_9", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_10", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_11", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_12", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_13", mpz80_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_14", mpz80_s100_cards, NULL) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("65K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "mpz80") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( mpz80 ) +//------------------------------------------------- + +ROM_START( mpz80 ) + ROM_REGION( 0x1000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS("447") + ROM_SYSTEM_BIOS( 0, "373", "3.73" ) + ROMX_LOAD( "mpz80 mon3.73 fb34.17c", 0x0000, 0x1000, CRC(0bbffaec) SHA1(005ba726fc071f06cb1c969d170960438a3fc1a8), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "375", "3.75" ) + ROMX_LOAD( "mpz80 mon3.75 0706.17c", 0x0000, 0x1000, CRC(1118a592) SHA1(d70f94c09602cd0bdc4fbaeb14989e8cc1540960), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "447", "4.47" ) + ROMX_LOAD( "mon 4.47 f4f6.17c", 0x0000, 0x1000, CRC(b99c5d7f) SHA1(11181432ee524c7e5a68ead0671fc945256f5d1b), ROM_BIOS(3) ) + + ROM_REGION( 0x20, "s100rev2", 0 ) + ROM_LOAD( "z80-2 15a.15a", 0x00, 0x20, CRC(8a84249d) SHA1(dfbc49c5944f110f48419fd893fa84f4f0e113b8) ) // 82S123 or 6331 + + ROM_REGION( 0xeb, "s100rev3", 0 ) + ROM_LOAD( "z80-15a-a.15a", 0x00, 0xeb, CRC(713243cd) SHA1(802b318cc9795d87f03622e878d9a4d5d7dea7d4) ) // 82S153 + + ROM_REGION( 0x104, "mm1", 0 ) + ROM_LOAD( "z80-2 5c.5c", 0x000, 0x104, CRC(732be0cd) SHA1(545a37e5a871fcd1bb59b30056b837f03889b4d5) ) // PAL16R4 +ROM_END + + + +//************************************************************************** +// DRIVER INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// DRIVER_INIT( mpz80 ) +//------------------------------------------------- + +DIRECT_UPDATE_MEMBER(mpz80_state::mpz80_direct_update_handler) +{ + if (m_trap && address >= m_trap_start && address <= m_trap_start + 0xf) + { + direct.explicit_configure(m_trap_start, m_trap_start + 0xf, 0xf, m_rom->base() + ((m_trap_reset << 10) | 0x3f0)); + return ~0; + } + + return address; +} + +DRIVER_INIT_MEMBER(mpz80_state,mpz80) +{ + address_space &program = machine().device(Z80_TAG)->space(AS_PROGRAM); + program.set_direct_update_handler(direct_update_delegate(FUNC(mpz80_state::mpz80_direct_update_handler), this)); +} + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1980, mpz80, 0, 0, mpz80, mpz80, mpz80_state, mpz80, "Morrow Designs", "MPZ80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/ms0515.c b/src/mame/drivers/ms0515.c new file mode 100644 index 00000000000..9f72a325764 --- /dev/null +++ b/src/mame/drivers/ms0515.c @@ -0,0 +1,258 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Elektronika MS-0515 + + 06/08/2012 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/t11/t11.h" +#include "machine/wd_fdc.h" +#include "machine/ram.h" +#include "machine/i8255.h" + +class ms0515_state : public driver_device +{ +public: + ms0515_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_floppy(*this, "vg93:0:525qd") + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_floppy; + + DECLARE_WRITE16_MEMBER(ms0515_bank_w); + DECLARE_WRITE8_MEMBER(ms0515_sys_w); + + virtual void machine_reset(); + + UINT8 *m_video_ram; + UINT8 m_sysreg; + int m_blink; + DECLARE_PALETTE_INIT(ms0515); + UINT32 screen_update_ms0515(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE8_MEMBER(ms0515_portc_w); +}; + +static ADDRESS_MAP_START(ms0515_mem, AS_PROGRAM, 16, ms0515_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0000000, 0017777) AM_RAMBANK("bank0") // RAM + AM_RANGE(0020000, 0037777) AM_RAMBANK("bank1") // RAM + AM_RANGE(0040000, 0057777) AM_RAMBANK("bank2") // RAM + AM_RANGE(0060000, 0077777) AM_RAMBANK("bank3") // RAM + AM_RANGE(0100000, 0117777) AM_RAMBANK("bank4") // RAM + AM_RANGE(0120000, 0137777) AM_RAMBANK("bank5") // RAM + AM_RANGE(0140000, 0157777) AM_RAMBANK("bank6") // RAM + + AM_RANGE(0160000, 0177377) AM_ROM + + AM_RANGE(0177400, 0177437) AM_WRITE(ms0515_bank_w) // Register for RAM expansion + + //AM_RANGE(0177440, 0177441) // read data + //AM_RANGE(0177460, 0177461) // write data Elektronika MS-7004 Keyboard + //AM_RANGE(0177442, 0177443) // read + //AM_RANGE(0177462, 0177463) // write + + //AM_RANGE(0177500, 0177501) + //AM_RANGE(0177502, 0177503) + //AM_RANGE(0177504, 0177505) // i8253 + //AM_RANGE(0177506, 0177507) + + //AM_RANGE(0177540, 0177541) + //AM_RANGE(0177542, 0177543) + //AM_RANGE(0177544, 0177545) // i8255 for MS-7007 Keyboard + //AM_RANGE(0177546, 0177547) + + AM_RANGE(0177600, 0177607) AM_DEVREADWRITE8("ppi8255_1", i8255_device, read, write, 0x00ff) + + AM_RANGE(0177640, 0177641) AM_DEVREADWRITE8("vg93", fd1793_t, status_r, cmd_w,0x00ff) + AM_RANGE(0177642, 0177643) AM_DEVREADWRITE8("vg93", fd1793_t, track_r, track_w,0x00ff) + AM_RANGE(0177644, 0177645) AM_DEVREADWRITE8("vg93", fd1793_t, sector_r, sector_w,0x00ff) + AM_RANGE(0177646, 0177647) AM_DEVREADWRITE8("vg93", fd1793_t, data_r, data_w,0x00ff) + + //AM_RANGE(0177700, 0177701) // read data + //AM_RANGE(0177720, 0177721) // write data // protocol S2 + //AM_RANGE(0177702, 0177703) // read status + //AM_RANGE(0177722, 0177723) // write control + + //AM_RANGE(0177770, 0177771) // read/write +ADDRESS_MAP_END + +WRITE16_MEMBER(ms0515_state::ms0515_bank_w) +{ + UINT8 *ram = m_ram->pointer(); + membank("bank0")->set_base(ram + 0000000 + BIT(data,0) * 0160000); + membank("bank1")->set_base(ram + 0020000 + BIT(data,1) * 0160000); + membank("bank2")->set_base(ram + 0040000 + BIT(data,2) * 0160000); + membank("bank3")->set_base(ram + 0060000 + BIT(data,3) * 0160000); + membank("bank4")->set_base(ram + 0100000 + BIT(data,4) * 0160000); + membank("bank5")->set_base(ram + 0120000 + BIT(data,5) * 0160000); + membank("bank6")->set_base(ram + 0140000 + BIT(data,6) * 0160000); + if (BIT(data,7)) { + switch((data >> 10) % 3) + { + case 0: // 000000 - 037777 + membank("bank0")->set_base(ram + 0000000 + 0340000); + membank("bank1")->set_base(ram + 0020000 + 0340000); + break; + case 1: // 040000 - 077777 + membank("bank2")->set_base(ram + 0000000 + 0340000); + membank("bank3")->set_base(ram + 0020000 + 0340000); + break; + case 2: + case 3: // 100000 - 137777 + membank("bank4")->set_base(ram + 0000000 + 0340000); + membank("bank5")->set_base(ram + 0020000 + 0340000); + break; + } + } +} + +WRITE8_MEMBER(ms0515_state::ms0515_sys_w) +{ + m_sysreg = data; +} + +void ms0515_state::machine_reset() +{ + UINT8 *ram = m_ram->pointer(); + ms0515_bank_w(machine().driver_data()->generic_space(),0,0); + + m_video_ram = ram + 0000000 + 0340000; + m_blink = 0; + + m_floppy->mon_w(0); // turn it on +} + +/* Input ports */ +static INPUT_PORTS_START( ms0515 ) +INPUT_PORTS_END + +// disk format: 80 tracks, 1 head, 10 sectors, 512 bytes sector length, first sector id 0 + +static SLOT_INTERFACE_START( ms0515_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // 720 KB +SLOT_INTERFACE_END + +UINT32 ms0515_state::screen_update_ms0515(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int y, x, b; + int addr = 0; + if (BIT(m_sysreg,3)) { + for (y = 0; y < 200; y++) + { + int horpos = 0; + for (x = 0; x < 40; x++) + { + UINT16 code = (m_video_ram[addr++] << 8); + code += m_video_ram[addr++]; + for (b = 0; b < 16; b++) + { + // In lower res mode we will just double pixels + bitmap.pix16(y, horpos++) = ((code >> (15-b)) & 0x01) ? 0 : 7; + } + } + } + } else { + for (y = 0; y < 200; y++) + { + int horpos = 0; + for (x = 0; x < 40; x++) + { + UINT8 code = m_video_ram[addr++]; + UINT8 attr = m_video_ram[addr++]; + UINT8 fg = (attr & 7) + BIT(attr,6)*8; + UINT8 bg = ((attr >> 3) & 7) + BIT(attr,6)*8; + if (BIT(attr,7) && (m_blink == 20)) { + UINT8 tmp = fg; + fg = bg; bg = tmp; + m_blink = -1; + } + for (b = 0; b < 8; b++) + { + // In lower res mode we will just double pixels + bitmap.pix16(y, horpos++) = ((code >> (7-b)) & 0x01) ? fg : bg; + bitmap.pix16(y, horpos++) = ((code >> (7-b)) & 0x01) ? fg : bg; + } + } + } + } + m_blink++; + return 0; +} + +PALETTE_INIT_MEMBER(ms0515_state, ms0515) +{ + palette.set_pen_color(0, rgb_t(0, 0, 0)); + palette.set_pen_color(1, rgb_t(0, 0, 127)); + palette.set_pen_color(2, rgb_t(127, 0, 0)); + palette.set_pen_color(3, rgb_t(127, 0, 127)); + palette.set_pen_color(4, rgb_t(0, 127, 0)); + palette.set_pen_color(5, rgb_t(0, 127, 127)); + palette.set_pen_color(6, rgb_t(127, 127, 0)); + palette.set_pen_color(7, rgb_t(127, 127, 127)); + + palette.set_pen_color(8, rgb_t(127, 127, 127)); + palette.set_pen_color(9, rgb_t(127, 127, 255)); + palette.set_pen_color(10, rgb_t(255, 127, 127)); + palette.set_pen_color(11, rgb_t(255, 127, 255)); + palette.set_pen_color(12, rgb_t(127, 255, 127)); + palette.set_pen_color(13, rgb_t(127, 255, 255)); + palette.set_pen_color(14, rgb_t(255, 255, 127)); + palette.set_pen_color(15, rgb_t(255, 255, 255)); +} + +WRITE8_MEMBER(ms0515_state::ms0515_portc_w) +{ + m_sysreg = data; +} + +static MACHINE_CONFIG_START( ms0515, ms0515_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) // Need proper CPU here + MCFG_T11_INITIAL_MODE(0xf2ff) + MCFG_CPU_PROGRAM_MAP(ms0515_mem) + + MCFG_DEVICE_ADD("vg93", FD1793, 1000000) + MCFG_FLOPPY_DRIVE_ADD("vg93:0", ms0515_floppies, "525qd", floppy_image_device::default_floppy_formats) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(ms0515_state, screen_update_ms0515) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(ms0515_state, ms0515) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_OUT_PORTC_CB(WRITE8(ms0515_state, ms0515_portc_w)) + + //MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ms0515 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "7004l.bin", 0xc000, 0x2000, CRC(b08b3b73) SHA1(c12fd4672598cdf499656dcbb4118d787769d589)) + ROM_LOAD16_BYTE( "7004h.bin", 0xc001, 0x2000, CRC(515dcf99) SHA1(edd34300fd642c89ce321321e1b12493cd16b7a5)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( ????, ms0515, 0, 0, ms0515, ms0515, driver_device, 0, "Elektronika", "MS-0515", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/ms9540.c b/src/mame/drivers/ms9540.c new file mode 100644 index 00000000000..16f48730c50 --- /dev/null +++ b/src/mame/drivers/ms9540.c @@ -0,0 +1,106 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Millennium Systems 9520 and 9540 Software Development systems. + +2013-08-30 Skeleton driver + +The only roms known to be dumped are the main roms of the 9540, and the disk +controller roms of the 9520. + +There's no known documents for the 9540, so everything in here is a guess. + +The 9520 is Z80-based, but is currently not emulated. +The 9540 is 68000-based. + +Chips: +- Main board: MC68000L8, 2x SCN2661C, uPD8253C. Crystals: 5.0688, 16MHz + ROMS: 0950-0131-01, 0950-0132-01, 0954-0133-01, 0954-0134-01, + 0954-0135-01, 0954-0135-02 +- Disk board: FD1797A-02, AM9517A, 0954-0039-01 +- Serial board: 6x SCN2661C, 2x AM9517A, 0954-0029-01. Crystal: 5.0688MHz + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class ms9540_state : public driver_device +{ +public: + ms9540_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_base(*this, "rambase"), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + +private: + UINT8 m_term_data; + virtual void machine_reset(); + required_shared_ptr m_p_base; + required_device m_maincpu; + required_device m_terminal; +}; + + +static ADDRESS_MAP_START(ms9540_mem, AS_PROGRAM, 16, ms9540_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xffffff) + AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_SHARE("rambase") + AM_RANGE(0x010000, 0x013fff) AM_ROM AM_REGION("9540", 0) + AM_RANGE(0x018000, 0x018fff) AM_RAM +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( ms9540 ) +INPUT_PORTS_END + + +void ms9540_state::machine_reset() +{ + UINT8* ROM = memregion("9540")->base(); + memcpy(m_p_base, ROM, 8); + m_maincpu->reset(); +} + +WRITE8_MEMBER( ms9540_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( ms9540, ms9540_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 8000000) // unknown clock + MCFG_CPU_PROGRAM_MAP(ms9540_mem) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ms9540_state, kbd_put)) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ms9540 ) + ROM_REGION16_BE(0x4000, "9540", 0) + ROM_LOAD16_BYTE("0954-0135-01.20n", 0x00000, 0x2000, CRC(93ee9363) SHA1(73bc09e0379e06e0da96279cb5cc1581a0f0bf77) ) + ROM_LOAD16_BYTE("0954-0135-02.16n", 0x00001, 0x2000, CRC(a21077c5) SHA1(51dcbe543317d2042fb1acb1885461ba1790721e) ) + + ROM_REGION(0x1800, "9520", 0) + ROM_LOAD( "z80-hd.bin", 0x0000, 0x1000, CRC(b1c37286) SHA1(36b38fec9ef46e3e594423bbd1c64c5e9a4bc74d) ) + ROM_LOAD( "z80-flp.bin", 0x1000, 0x0800, CRC(f256b8c3) SHA1(780b444e999c3149eb0f137733703682d65746b4) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, ms9540, 0, 0, ms9540, ms9540, driver_device, 0, "Millennium Systems", "ms9540", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/msbc1.c b/src/mame/drivers/msbc1.c new file mode 100644 index 00000000000..08178eaec02 --- /dev/null +++ b/src/mame/drivers/msbc1.c @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Curt Coder +/* + +Omnibyte MSBC-1 + +PCB Layout +---------- + +REV B + +|-----------------------------------------------------------| +| CN1 CN2 CN3 CN4 SW1 CN5 | +| | +| 3.6864MHz 3.6864MHz ROM1 | +| ROM0 | +| SIO SIO SW3 SW2 | +| PIT | +| 12.5MHz 41256 41256 41256 | +| 41256 41256 41256 | +| 8MHz CPU 41245 41256 | +| | +| 8419 | +| SW4 | +|-|-------------CN6----------------|----|-------CN7-------|-| + |--------------------------------| |-----------------| + +Notes: + Relevant IC's shown. + + CPU - Motorola MC68000R12 + SIO - Mostek MK68564N-5A Serial Input/Output + PIT - Motorola MC68230L10 Parallel Interface/Timer + 8419 - National Semiconductor DP8419N DRAM Controller + 41256 - Fujitsu MB81256-12 256Kx1 RAM + ROM0 - AMD AM27128ADC 16Kx8 ROM "47-2818-36G1" + ROM1 - AMD AM27128ADC 16Kx8 ROM "47-2818-36G2" + SW1 - push button + SW2 - rotary hex DIP + SW3 - rotary hex DIP + SW4 - DIP8 + CN1 - + CN2 - + CN3 - + CN4 - + CN5 - + CN6 - + CN7 - + +*/ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/terminal.h" +#include "includes/msbc1.h" + +#define TERMINAL_TAG "terminal" + +static ADDRESS_MAP_START( msbc1_mem, AS_PROGRAM, 16, msbc1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x03ffff) AM_RAM + AM_RANGE(0xf80000, 0xf87fff) AM_ROM AM_REGION(MC68000R12_TAG, 0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( msbc1 ) +INPUT_PORTS_END + +void msbc1_state::machine_reset() +{ + void *ram = m_maincpu->space(AS_PROGRAM).get_write_ptr(0); + UINT8 *rom = memregion(MC68000R12_TAG)->base(); + + memcpy(ram, rom, 8); + + m_maincpu->reset(); +} + +static MACHINE_CONFIG_START( msbc1, msbc1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MC68000R12_TAG, M68000, XTAL_12_5MHz) + MCFG_CPU_PROGRAM_MAP(msbc1_mem) + + // devices + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( msbc1 ) + ROM_REGION16_BE( 0x8000, MC68000R12_TAG, 0 ) + ROM_LOAD16_BYTE( "47-2818-36g1.u18", 0x0000, 0x4000, CRC(14f25d47) SHA1(964bc49c1dd9e9680c0d3d89ff3794c5044bea62) ) + ROM_LOAD16_BYTE( "47-2818-36g2.u19", 0x0001, 0x4000, CRC(4814b9e1) SHA1(d96cf75084c6588cb33513830c6beeeffc2de853) ) + + ROM_REGION( 0x100, "plds", 0 ) + ROM_LOAD( "p21.1.u22", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p22.0.u37", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p23.0.u38", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p24.0.u43", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p25.0.u44", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p26.0.u45", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p27.0.u46", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p28.1.u49", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p29.0.u58", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p30.0.u60", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p31.0.u61", 0x000, 0x100, NO_DUMP ) + ROM_LOAD( "p32.0.u76", 0x000, 0x100, NO_DUMP ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, msbc1, 0, 0, msbc1, msbc1, driver_device, 0, "Omnibyte", "MSBC-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mstation.c b/src/mame/drivers/mstation.c new file mode 100644 index 00000000000..d49478f0b56 --- /dev/null +++ b/src/mame/drivers/mstation.c @@ -0,0 +1,560 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + CIDCO MailStation + + 22/10/2011 Preliminary driver by Sandro Ronco + + Hardware: + - Z80 CPU + - 29f080 8 Mbit flash + - 28SF040 4 Mbit flash (for user data) + - 128kb RAM + - 320x128 LCD + - RCV336ACFW 33.6kbps modem + + TODO: + - RCV336ACFW modem + - Add similar models (Mivo 100/150/200/250/350) + - New Mail led + - NVRAM + + More info: + http://www.fybertech.net/mailstation/info.php + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/intelfsh.h" +#include "machine/rp5c01.h" +#include "machine/ram.h" +#include "rendlay.h" + +class mstation_state : public driver_device +{ +public: + mstation_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + + intelfsh8_device *m_flashes[2]; + UINT8 m_bank1[2]; + UINT8 m_bank2[2]; + UINT8 *m_ram_base; + int m_flash_at_0x4000; + int m_flash_at_0x8000; + UINT8 *m_vram; + UINT8 m_screen_column; + UINT8 m_port2; + UINT8 m_irq; + UINT16 m_kb_matrix; + + DECLARE_READ8_MEMBER( flash_0x0000_read_handler ); + DECLARE_WRITE8_MEMBER( flash_0x0000_write_handler ); + DECLARE_READ8_MEMBER( flash_0x4000_read_handler ); + DECLARE_WRITE8_MEMBER( flash_0x4000_write_handler ); + DECLARE_READ8_MEMBER( flash_0x8000_read_handler ); + DECLARE_WRITE8_MEMBER( flash_0x8000_write_handler ); + DECLARE_READ8_MEMBER( modem_r ); + DECLARE_WRITE8_MEMBER( modem_w ); + + void lcd_w(UINT16 offset, int column, UINT8 data); + UINT8 lcd_r(UINT16 offset, int column); + DECLARE_READ8_MEMBER( lcd_right_r ); + DECLARE_WRITE8_MEMBER( lcd_right_w ); + DECLARE_READ8_MEMBER( lcd_left_r ); + DECLARE_WRITE8_MEMBER( lcd_left_w ); + + void refresh_memory(UINT8 bank, UINT8 chip_select); + DECLARE_READ8_MEMBER( bank1_r ); + DECLARE_WRITE8_MEMBER( bank1_w ); + DECLARE_READ8_MEMBER( bank2_r ); + DECLARE_WRITE8_MEMBER( bank2_w ); + + DECLARE_READ8_MEMBER( battery_status_r ); + DECLARE_WRITE8_MEMBER( port2_w ); + DECLARE_READ8_MEMBER( kb_r ); + DECLARE_WRITE8_MEMBER( kb_w ); + DECLARE_READ8_MEMBER( irq_r ); + DECLARE_WRITE8_MEMBER( irq_w ); + void refresh_ints(); + + DECLARE_WRITE_LINE_MEMBER( rtc_irq ); + + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_PALETTE_INIT(mstation); + TIMER_DEVICE_CALLBACK_MEMBER(mstation_1hz_timer); + TIMER_DEVICE_CALLBACK_MEMBER(mstation_kb_timer); +}; + +READ8_MEMBER( mstation_state::flash_0x0000_read_handler ) +{ + return m_flashes[0]->read(offset); +} + +WRITE8_MEMBER( mstation_state::flash_0x0000_write_handler ) +{ + m_flashes[0]->write(offset, data); +} + +READ8_MEMBER( mstation_state::flash_0x4000_read_handler ) +{ + return m_flashes[m_flash_at_0x4000]->read(((m_bank1[0] & 0x3f)<<14) | offset); +} + +WRITE8_MEMBER( mstation_state::flash_0x4000_write_handler ) +{ + m_flashes[m_flash_at_0x4000]->write(((m_bank1[0] & 0x3f)<<14) | offset, data); +} + +READ8_MEMBER( mstation_state::flash_0x8000_read_handler ) +{ + return m_flashes[m_flash_at_0x8000]->read(((m_bank2[0] & 0x3f)<<14) | offset); +} + +WRITE8_MEMBER( mstation_state::flash_0x8000_write_handler ) +{ + m_flashes[m_flash_at_0x8000]->write(((m_bank2[0] & 0x3f)<<14) | offset, data); +} + +READ8_MEMBER( mstation_state::modem_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( mstation_state::modem_w ) +{ +} + + +//*************************************************************************** +// video hardware emulation +//***************************************************************************/ + +void mstation_state::lcd_w(UINT16 offset, int column, UINT8 data) +{ + if (m_port2 & 0x08) + m_vram[(column * 240) + (offset % 240)] = data; + else + m_screen_column = data % 20; +} + +UINT8 mstation_state::lcd_r(UINT16 offset, int column) +{ + if (m_port2 & 0x08) + return m_vram[(column * 240) + (offset % 240)]; + else + return m_screen_column % 20; +} + +READ8_MEMBER ( mstation_state::lcd_left_r ) { return lcd_r(offset, m_screen_column); } +WRITE8_MEMBER( mstation_state::lcd_left_w ) { lcd_w(offset, m_screen_column, data); } +READ8_MEMBER ( mstation_state::lcd_right_r ) { return lcd_r(offset, m_screen_column + 20); } +WRITE8_MEMBER( mstation_state::lcd_right_w ) { lcd_w(offset, m_screen_column + 20, data); } + +UINT32 mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int x=0; x<40; x++) + for (int y=0; y<128; y++) + { + UINT8 data = m_vram[56 + y + x * 240]; + + for (int b=0; b<8; b++) + { + // columns are inverted (right to left) + int col = ((x < 20) ? 19 : 59) - x; + + bitmap.pix16(y, col*8 + b)= BIT(data, 0); + data >>= 1; + } + } + return 0; +} + +//*************************************************************************** +// Bankswitch +//***************************************************************************/ + +void mstation_state::refresh_memory(UINT8 bank, UINT8 chip_select) +{ + address_space& program = m_maincpu->space(AS_PROGRAM); + int &active_flash = (bank == 1 ? m_flash_at_0x4000 : m_flash_at_0x8000); + char bank_tag[6]; + + switch (chip_select) + { + case 0: // flash 0 + case 3: // flash 1 + if (active_flash < 0) + { + if (bank == 1) + program.install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x4000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x4000_write_handler), this)); + else + program.install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x8000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x8000_write_handler), this)); + } + + active_flash = chip_select ? 1 : 0; + break; + case 1: // banked RAM + sprintf(bank_tag,"bank%d", bank); + membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1[0] : m_bank2[0]) & 0x07)<<14)); + program.install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag); + active_flash = -1; + break; + case 2: // left LCD panel + program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_left_r), this), write8_delegate(FUNC(mstation_state::lcd_left_w), this)); + active_flash = -1; + break; + case 4: // right LCD panel + program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_right_r), this), write8_delegate(FUNC(mstation_state::lcd_right_w), this)); + active_flash = -1; + break; + case 5: // modem + program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0x07, 0, read8_delegate(FUNC(mstation_state::modem_r), this), write8_delegate(FUNC(mstation_state::modem_w), this)); + active_flash = -1; + break; + + default: + logerror("Unknown chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff); + program.unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff); + active_flash = -1; + break; + } +} + +READ8_MEMBER( mstation_state::bank1_r ) +{ + return m_bank1[offset]; +} + +READ8_MEMBER( mstation_state::bank2_r ) +{ + return m_bank2[offset]; +} + +WRITE8_MEMBER( mstation_state::bank1_w ) +{ + m_bank1[offset] = data; + + refresh_memory(1, m_bank1[1] & 0x07); +} + +WRITE8_MEMBER( mstation_state::bank2_w ) +{ + m_bank2[offset] = data; + + refresh_memory(2, m_bank2[1] & 0x07); +} + + + +WRITE8_MEMBER( mstation_state::port2_w ) +{ + m_port2 = data; + + m_kb_matrix = (m_kb_matrix & 0xff) | ((data & 0x03)<<8); +} + +/* + IRQ bits (port 3) ordered by priority: + + bit 7: power down request + bit 5: real time clock + bit 6: modem + bit 4: 1 sec int + bit 3: unknown + bit 0: unknown + bit 1: keyboard int + bit 2: unknown +*/ + +void mstation_state::refresh_ints() +{ + if (m_irq != 0) + m_maincpu->set_input_line(0, HOLD_LINE); + else + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +READ8_MEMBER( mstation_state::irq_r ) +{ + return m_irq; +} + +WRITE8_MEMBER( mstation_state::irq_w ) +{ + m_irq &= data; + + refresh_ints(); +} + +READ8_MEMBER( mstation_state::battery_status_r ) +{ + /* + bit 0-3 - unknown + bit 4-7 - battery status + */ + return 0xf0; +} + +WRITE8_MEMBER( mstation_state::kb_w ) +{ + m_kb_matrix = (m_kb_matrix & 0x300) | data; +} + +READ8_MEMBER( mstation_state::kb_r ) +{ + static const char *const bitnames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", + "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; + UINT8 data = 0xff; + + for (int i=0; i<10; i++) + { + if (!(m_kb_matrix & (1<read(); + } + + return data; +} + + +static ADDRESS_MAP_START(mstation_mem, AS_PROGRAM, 8, mstation_state) + AM_RANGE(0x0000, 0x3fff) AM_READWRITE(flash_0x0000_read_handler, flash_0x0000_write_handler) + AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank1") // bank 1 + AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank2") // bank 2 + AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("sysram") // system ram always first RAM bank +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mstation_io , AS_IO, 8, mstation_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x01, 0x01 ) AM_READWRITE(kb_r, kb_w) + AM_RANGE( 0x02, 0x02 ) AM_WRITE(port2_w) + AM_RANGE( 0x03, 0x03 ) AM_READWRITE(irq_r, irq_w) + AM_RANGE( 0x05, 0x06 ) AM_READWRITE(bank1_r, bank1_w) + AM_RANGE( 0x07, 0x08 ) AM_READWRITE(bank2_r, bank2_w) + AM_RANGE( 0x09, 0x09 ) AM_READ(battery_status_r) + AM_RANGE( 0x10, 0x1f ) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) + //AM_RANGE( 0x2c, 0x2c ) printer +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( mstation ) + PORT_START( "LINE0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Main Menu") PORT_CODE( KEYCODE_HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Back") PORT_CODE( KEYCODE_DEL ) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Print") PORT_CODE( KEYCODE_F6 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE( KEYCODE_F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE( KEYCODE_F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE( KEYCODE_F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE( KEYCODE_F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE( KEYCODE_F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START( "LINE1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_END ) PORT_CHAR('@') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A-A Size") PORT_CODE( KEYCODE_F7 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Check Spelling") PORT_CODE( KEYCODE_F8 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Get E-Mail") PORT_CODE( KEYCODE_F9 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PG Up") PORT_CODE( KEYCODE_PGUP ) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + + PORT_START( "LINE2" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xb4") PORT_CODE( KEYCODE_0_PAD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3 ) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4 ) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5 ) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHAR('7') PORT_CHAR('&') + + PORT_START( "LINE3" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS ) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_EQUALS ) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE( KEYCODE_BACKSPACE ) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH ) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PG Down") PORT_CODE( KEYCODE_PGDN ) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + + PORT_START( "LINE4" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE( KEYCODE_TAB ) PORT_CHAR(9) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_E ) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_R ) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_T ) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_U ) PORT_CHAR('u') PORT_CHAR('U') + + PORT_START( "LINE5" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_I ) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_O ) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_P ) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_OPENBRACE ) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CLOSEBRACE ) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COLON ) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE( KEYCODE_ENTER ) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) + + PORT_START( "LINE6" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CapsLock") PORT_CODE( KEYCODE_CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_S ) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_D ) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F ) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_G ) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_H ) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_J ) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START( "LINE7" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_K ) PORT_CHAR('K') PORT_CHAR('K') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_L ) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_STOP ) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH ) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Up") PORT_CODE( KEYCODE_UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE( KEYCODE_DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE( KEYCODE_RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START( "LINE8" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE( KEYCODE_LSHIFT ) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_X ) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_C ) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_V ) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_B ) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_N ) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START( "LINE9" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Function") PORT_CODE( KEYCODE_LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE( KEYCODE_SPACE ) PORT_CHAR(' ') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE( KEYCODE_LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) +INPUT_PORTS_END + +void mstation_state::machine_start() +{ + m_flashes[0] = machine().device("flash0"); + m_flashes[1] = machine().device("flash1"); + + // allocate the videoram + m_vram = (UINT8*)machine().memory().region_alloc( "vram", 9600, 1, ENDIANNESS_LITTLE )->base(); + m_ram_base = (UINT8*)m_ram->pointer(); + + // map firsh RAM bank at 0xc000-0xffff + membank("sysram")->set_base(m_ram_base); +} + + +void mstation_state::machine_reset() +{ + m_flash_at_0x4000 = 0; + m_flash_at_0x8000 = 0; + m_bank1[0] = m_bank1[1] = 0; + m_bank2[0] = m_bank2[1] = 0; + memset(m_vram, 0, 9600); + + // reset banks + refresh_memory(1, m_bank1[1]); + refresh_memory(2, m_bank2[1]); +} + +WRITE_LINE_MEMBER( mstation_state::rtc_irq ) +{ + if (state) + m_irq |= (1<<5); + else + m_irq &=~(1<<5); + + refresh_ints(); +} + +TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_1hz_timer) +{ + m_irq |= (1<<4); + + refresh_ints(); +} + +TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_kb_timer) +{ + m_irq |= (1<<1); + + refresh_ints(); +} + +PALETTE_INIT_MEMBER(mstation_state, mstation) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + + +static MACHINE_CONFIG_START( mstation, mstation_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) //unknown clock + MCFG_CPU_PROGRAM_MAP(mstation_mem) + MCFG_CPU_IO_MAP(mstation_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(mstation_state, screen_update) + MCFG_SCREEN_SIZE(320, 128) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 128-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(mstation_state, mstation) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_AMD_29F080_ADD("flash0") + MCFG_SST_28SF040_ADD("flash1") + + // IRQ 4 is generated every second, used for auto power off + MCFG_TIMER_DRIVER_ADD_PERIODIC("1hz_timer", mstation_state, mstation_1hz_timer, attotime::from_hz(1)) + + // IRQ 1 is used for scan the kb and for cursor blinking + MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer", mstation_state, mstation_kb_timer, attotime::from_hz(50)) + + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) + MCFG_RP5C01_OUT_ALARM_CB(WRITELINE(mstation_state, rtc_irq)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mstation ) + ROM_REGION( 0x100000, "flash0", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v303a", "v3.03a" ) + ROMX_LOAD( "ms303a.bin", 0x000000, 0x100000, CRC(7a5cf752) SHA1(15629ccaecd8094dd883987bed94c16eee6de7c2), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v253", "v2.53" ) + ROMX_LOAD( "ms253.bin", 0x000000, 0x0fc000, BAD_DUMP CRC(a27e7f8b) SHA1(ae5a0aa0f1e23f3b183c5c0bcf4d4c1ae54b1798), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1999, mstation, 0, 0, mstation, mstation, driver_device, 0, "CIDCO", "MailStation", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/msx.c b/src/mame/drivers/msx.c new file mode 100644 index 00000000000..3dfd67a935a --- /dev/null +++ b/src/mame/drivers/msx.c @@ -0,0 +1,8494 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/* +** msx.c : driver for MSX +** +** cpc300: +** To get out of the MSX Tutor press the SELECT key. Entering SET SYSTEM 1 should +** disable the MSX Tutor on next boot and SET SYSTEM 0 should enable. +** +** tpp311: +** This machine is supposed to boot into logo; it was made to only run logo. +** +** tps312: +** - To get into MSX-WRITE type: CALL WRITE +** - To get into MSX-PLAN type: CALL MSXPLAN +** +** +** There really were a lot of different MSX systems released by quite a few +** manufacturers. Until we have identified all the unique characteristics of +** each machine the machines will stay listed separately. After that +** de-duplication of machine descriptions and rom sets may happen. +** +** +** Todo/known issues: +** - piopx7/piopx7uk/piopxv60: Pioneer System Remote (home entertainment/Laserdisc control) not implemented +** - piopx7: Dump is from a PAL (EU/AU) machine, we have no known good dumps from JP or US NTSC machines +** - spc800: Haven't been able to test operation of the han rom yet +** - svi728: Expansion slot not emulated +** - svi738: v9938 not emulated +** - svi738: rs232c not emulated +** - hx10: Expansion slot not emulated (hx10s also??) +** - y503iir: Keyboard not responding correctly +** - y503iir, y503iir2: RTC not emulated +** - y503iir, y503iir2: Net not emulated +** - y503iir, y503iir2: Floppy support broken +** - cpc300: Config for MSX Tutor ON/OFF is not saved +** - fs4600: Kanji12 not emulated; how to trigger usage of kanji12?? +** - fsa1fm: Firmware not emulated +** - fsa1fm: kanji12 not emulated +** - fsa1fm: Modem not emulated +** - nms8280, nms8280g: Digitizer functionality not emulated +** - vg8230j: Floppy support broken? +** - hbf1: Does not boot. This seems to be caused by a race condition between setting the VBlank bit in the +** VDP status register and the z80 taking the interrupt. Currently the interrupt gets taken before the +** bit can be read, so the code goes into an infinite loop. +** - hbf12: Does not boot; see hbf1. +** - tpc310: Floppy support broken +** 7fbb <- c7 => seek 199??? +** - hx23f: The builtin word processor displays white squares instead of text +** - expert3i: IDE not emulated +** - expert3t: Turbo not emulated +** - expertac: Does not boot +** - fsa1gt: Add Turbo-R support +** - fsa1st: Add Turbo-R support +** - canonv20e/f/g/s: Investigate different keyboard layouts +** - canonv30: Mapper RAM size unknown +** - mx101: External antenna not emulated +** - pv7: Add support for KB-7 (8KB ram + 2 cartslots) +** - cpc50a/cpc50b: Remove keyboard; and add an external keyboard?? +** - cpc51/cpc61: Remove keyboard and add a keyboard connector +** - cpc50a/cpc50b/cpc51: Boot to a black screen, is this correct? +** - mbh2: speed controller not implemented +** - mbh70: Verify firmware operation +** - kmc5000: Floppy supprt broken +** - mlg3: rs232c not emulated +** - perfect1: Firmware broken +** - mpc2500f: Fix keyboard layout? +** - nms8260: HDD not emulated +** - mpc27: Light pen not emulated +** - phc77: firmware not emulated +** - phc77: printer not emulated +** - hx21, hx22: Hook up kanji rom +** - hx21, hx22: Does not start firmware +** - victhc90/95/95a: Turbo/2nd cpu not supported. +** - victhc90/95/95a: Firmware not working. +** - y503iiir/e: Fix keyboard support +** - y503iiir/e: Floppy support broken +** - y805*: Floppy support broken +** - y8805128r2/e: Firmware not working +** - cpg120: Remove ports +** - cpg120: Add V9958 +** +** TODO: +** - Add T6950 support. T6950 is selectable between pal and ntsc by a pin. +** +** Possibly missing machines: +** - Sanyo MPC-1 (T6950) +** - Toshibo HX-51i (T7937) +** - Sony HB-101 (TMS9118) +************************************************************************ + +This following list is probably incomplete. Corrections are welcome. +Entries marked with * still need to be processed. + +Al Alamiah AX-150 - MSX1 - ax150 +Al Alamiah AX-170 - MSX1 - ax170 +Al Alamiah AX-350II - MSX2 - ax350 +Al Alamiah AX-370 - MSX2 - ax370 +*Ascii MSXPLAYer 2003 +*Ascii One Chip MSX +Canon V-8 - MSX1 - canonv8 +Canon V-10 - MSX1 - canonv10 +Canon V-20 - MSX1 - canonv20 +Canon V-20E - MSX1 - canonv20e +Canon V-20F - MSX1 - canonv20f +Canon V-20G - MSX1 - canonv20g +Canon V-20S - MSX1 - canonv20s +Canon V-25 - MSX2 - canonv25 +Canon V-30 - MSX2 - canonv30 +Canon V-30F - MSX2 - canonv30f +Casio MX-10 - MSX1 - mx10 +Casio MX-15 - MSX1 - mx15 +Casio MX-101 - MSX1 - mx101 +Casio PV-7 - MSX1 - pv7 +*Casio PV-7 + KB-7 +Casio PV-16 - MSX1 - pv16 +Ciel Expert 3 IDE - MSX2+ - expert3i +Ciel Expert 3 Turbo = MSX2+ - expert3t +====================================== +This one is a full motherboard by CIEL (not an upgrade kit), created to replace the motherboard of a Gradiente Expert (which means that only the case, the analog boards and the keyboard remains Gradiente). This new motherboard has the following built-in features: + +1) MSX2+ +2) Support either 3.57MHz or 7.14MHz natively, switched either by software (*1) or by a hardware-switch on the front panel. Turbo-led included. +3) Up to 4MB of Memory Mapper (1MB is the most common configuration) +4) MSX-Music +5) 4 expansion slots (two external on the front panel, two internal) +6) Stereo sound (YM2413 channels 0-6 on right, PSG+YM2413 channels 7-9 on left) +7) Support the V9938 instead of the V9958 by switching some jumpers +8) The main-ram can be placed on slot 2 or slot 3, using jumpers (slot 2 is the default) + + +*1: A routine hidden inside the BIOS frame-0 is used to switch the turbo. + +Daewoo CPC-88 - MSX1 - cpc88 +Daewoo CPC-300 - MSX2 - cpc300 +Daewoo CPC-300E - MSX2 - cpc300e +Daewoo CPC-330K - MSX2 - cpc330k +Daewoo CPC-400 - MSX2 - cpc400 +Daewoo CPC-400S - MSX2 cpc400s +Daewoo DPC-100 - MSX1 - dpc100 +Daewoo DPC-180 - MSX1 - dpc180 +Daewoo DPC-200 - MSX1 - dpc200 +Daewoo DPC-200E - MSX1 - dpc200e +Daewoo Zemmix CPC-50A - MSX1 - cpc50a +Daewoo Zemmix CPC-50B - MSX1 - cpc50b +Daewoo Zemmix CPC-51 - MSX1 - cpc51 +Daewoo Zemmix CPC-61 - MSX2 - cpc61 +Daewoo Zemmix CPG-120 Normal (no clock chip, no printer port) - MSX2 - cpg120 +*Daewoo Zemmix CPG-120 Turbo - MSX2 - cpg120t +Fenner DPC-200 - MSX1 - fdpc200 +Fenner FPC-500 - MSX1 - fpc500 +Fenner FPC-900 - MSX2 - fpc900 +Fenner SPC-800 - MSX1 - fspc800 +Frael Bruc 100-1 - MSX1 - bruc100 +Fujitsu FM-X - MSX1 - fmx +Goldstar FC-80U - MSX1 - gsfc80u +Goldstar FC-200 - MSX1 - gsfc200 +Goldstar GFC-1080 - MSX1 - gfc1080 +Goldstar GFC-1080A - MSX1 - gfc1080a +Gradiente Expert 1.0 - MSX1 - expert10 +Gradiente Expert 1.1 - MSX1 - expert11 +Gradiente Expert 1.3 - MSX1 - expert13 +Gradiente Expert 2.0 - MSX2 - expert20 +Gradiente Expert AC88+ - MSX2+ - expertac +Gradiente Expert DDPlus - MSX1 - expertdp +Gradiente Expert DDX+ - MSX2+ - expertdx +Gradiente Expert Plus - MSX1 - expertpl +*Haesung Virtual Console +*Hitachi MB-H1 +*Hitachi MB-H1E +Hitachi MB-H2 - MSX1 - mbh2 +*Hitachi MB-H3 - MSX2 (64KB VRAM) +*Hitachi MB-H21 - MSX1 +Hitachi MB-H25 - MSX1 - mbh25 +Hitachi MB-H50 - MSX1 - mbh50 +Hitachi MB-H70 - MSX2 - mbh70 +*Hitachi MB-H80 - MSX1 +JVC HC-7GB - MSX1 -jvchc7gb +Kawai KMC-5000 - MSX2 - kmc5000 +Mitsubishi ML-F48 - MSX1 - mlf48 +Mitsubishi ML-F80 - MSX1 - mlf80 +Mitsubishi ML-F110 - MSX1 - mlf110 +Mitsubishi ML-F120 - MSX1 - mlf120 +Mitsubishi ML-FX1 - MSX1 - mlfx1 +Mitsubishi ML-G1 - MSX2 - mlg1 +Mitsubishi ML-G3 - MSX2 - mlg3 +Mitsubishi ML-G10 - MSX2 - mlg10 +Mitsubishi ML-G30 Model 1 - MSX2 - mlg30 +Mitsubishi ML-G30 Model 2 - MSX2 - See Mitsubishi ML-G30 Model 1 +National CF-1200 - MSX1 - cf1200 +National CF-2000 - MSX1 - cf2000 +National CF-2700 - MSX1 - cf2700 +National CF-3000 - MSX1 - cf3000 +National CF-3300 - MSX1 - cf3300 +National FS-1300 - MSX1 - fs1300 +National FS-4000 - MSX1 - fs4000 +Matioanl FS-4000 (alt) - MSX1 - fs4000a +National FS-4500 - MSX2 - fs4500 +National FS-4600 - MSX2 - fs4600 +National FS-4700 - MSX2 - fs4700 +National FS-5000F2 - MSX2 - fs5000 +National FS-5500F1 - MSX2 - fs5500 +National FS-5500F2 - MSX2 - fs5500 +Olympia PHC-2 - MSX1 - phc2 +Olympia PHC-28 - MSX1 - phc28 +Panasonic CF-2700G - MSX1 - cf2700g +Panasonic FS-A1 - MSX2 - fsa1 / fsa1a +Panasonic FS-A1 MK2 - MSX2 - fsa1mk2 +Panasonic FS-A1F - MSX2 - fsa1f +Panasonic FS-A1FM - MSX2 - fsa1fm +Panasonic FS-A1FX - MSX2+ - fsa1fx +Panasonic FS-A1GT - MSX Turbo-R - fsa1gt +Panasonic FS-A1ST - MSX Turbo-R - fsa1st +Panasonic FS-A1WSX - MSX2+ - fsa1wsx +Panasonic FS-A1WX - MSX2+ - fsa1wx / fsa1wxa +Perfect Perfect1 - MSX1 - perfect1 +*Perfect Perfect2 - MSX2 +Philips NMS-801 - MSX1 - nms801 +Philips NMS-8220 - MSX2 - nms8220 / nms8220a +Philips NMS-8245 - MSX2 - nms8245 +Philips NMS-8245F - MSX2 - nms8245f +Philips NMS-8250 - MSX2 - nms8250 +Philips NMS-8250F - MSX2 - nms8250f +Philips NMS-8250J - MSX2 - nms8250j +Philips NMS-8255 - MSX2 - nms8255 +Philips NMS-8255F - MSX2 - nms8255f +Philips NMS-8260 - MSX2 - nms8260 +Philips NMS-8270 - MSX2 - nms8270 - not confirmed to exist yet +Philips NMS-8280 - MSX2 - nms8280 +Philips NMS-8280F - MSX2 - nms8280f +Philips NMS-8280G - MSX2 - nms8280g +*Philips PTC MSX PC +Philips VG-8000 - MSX1 - vg8000 +Philips VG-8010 - MSX1 - vg8010 +Philips VG-8010F - MSX1 - vg8010f +Philips VG-8020-00 - MSX1 - vg802000 +Philips VG-8020-20 - MSX1 - vg802020 +*Philips VG-8020-40 - MSX1 - +Philips VG-8020F - MSX1 - vg8020f +Philips VG-8230 - MSX2 - vg8230 +Philips VG-8230J - MSX2 - vg8230j +Philips VG-8235 - MSX2 - vg8235 +Philips VG-8235F - MSX2 - vg8235f +Philips VG-8240 - MSX2 - vg8240 +=============================== + +PCB Layout missing + + +Pioneer PX-7 - MSX1 - piopx7 +============================ + +|---------------------------------------| +| CN1 CN2 | +| | +| | +| IC33 |---------------------------------| +| CN3 | +| IC32 IC34 IC38 IC40 | +| IC20 | +| IC15 IC18 IC43 IC8 IC35 IC6 |----IC3---| | +| |----------| IC21 | +| IC16 IC19 |---IC13---| IC7 IC10 | +| |----------| IC36 IC29 --- | +| IC17 IC14 X2 | | | +| |--IC12---| |----IC1-----| IC37 |I| | +| IC28 IC11 |---------| |------------| X1 |C| | +| |2| | +| |----IC4----| |----IC5----| IC39 IC9 IC42 IC44 | | | +| |-----------| |-----------| --- | +| | +| IC45 IC31 IC30 IC41 | +| | +| CN4 CN5 CN6 CN7 CN8 | +|-------------------------------------------------------------------------| + +Notes: + X1 - 3.579MHz + X2 - 500kHz + IC1 - Sharp LH0080A Z80A-CPU-D + IC2 - TMS91289NL + IC3 - MB111S112 Z10 (500kHz) + IC4 - M5L8255AP-5 + IC5 - YM2149F + IC6,IC7,IC8,IC10,IC45 - SN74LS367AN + IC9 - SN74LS245N + IC11,IC34 - SN74LS139N + IC12 - YM2301-23908 / 53 18 85 A (might indicate a version) + IC13 - Pioneer PD5031 2364-213 514100 (M5L2764-213) + IC14,IC17,IC30,IC31 - SN74LS157N + IC15-IC19 - MB81416-12 + IC20,IC21 - TMS4416-I5NL + IC28 - SN74LS153N + IC29 - SN74LS02N + IC32 - SN74LS374N + IC33 - M5218P + IC35 - SN74LS74AN + IC36 - SN74LS30N + IC37-IC39 - SN74LS04N + IC40,IC41 - SN74LS05N + IC42 - SN74LS08N + IC43,IC44 - SN74LS32N + CN1 - Printer + CN2 - Cassette recorder + CN3 - Expansion slot + CN4 - Keyboard + CN5 - Keyboard + CN6 - Controller #1 + CN7 - Controller #2 + CN8 - Expansion slot + + +Pioneer PX-7UK - MSX1 - piopx7uk +Pioneer PX-V60 - MSX1 - piopxv60 +Samsung SPC-800 MSX1 - spc800 +Sanyo MPC-64 - MSX1 - mpc64 +Sanyo MPC-100 - MSX1 - mpc100 +Sanyo MPC-200 - MSX1 - mpc200 +Sanyo MPC-200SP - MSX1 - mpc200sp +Sanyo MPC-2300 - MSX2 - mpc2300 +Sanyo MPC-2500FD - MSX2 - mpc2500f +Sanyo PHC-28L - MSX1 - phc28l +Sanyo PHC-28S - MSX1 - phc28s +Sanyo Wavy MPC-10 - MSX1 - mpc10 +Sanyo Wavy MPC-25FD - MSX2 - mpc25fd +Sanyo Wavy MPC-27 - MSX2 - mpc27 +Sanyo Wavy PHC-23 - MSX2 - phc23 +Sanyo Wavy PHC-35J - MSX2+ - phc35j +Sanyo Wavy PHC-55FD2 - MSX2 - phc55fd2 +Sanyo Wavy PHC-70FD1 - MSX2+ - phc70fd +Sanyo Wavy PHC-70FD2 - MSX2+ - phc70fd2 +Sanyo Wavy PHC-77 - MSX2 - phc77 +Sharp Epcom HotBit 1.1 - MSX1 - hotbit11 +Sharp Epcom HotBit 1.2 - MSX1 - hotbit12 +Sharp Epcom HotBit 1.3b - MSX1 - hotbi13b +Sharp Epcom HotBit 1.3p - MSX1 - hotbi13p +Sharp Epcom HotBit 2.0 - MSX2 - hotbit20 +Sony HB-10 - MSX1 - hb10 +*Sony HB-10D - MSX1 +Sony HB-10P - MSX1 - hb10p +Sony HB-20P - MSX1 - hb20p +Sony HB-55 Version 1 - MSX1 - hb55 +Sony HB-55D - MSX1 - hb55d +Sony HB-55P - MSX1 - hb55p +Sony HB-75D - MSX1 - hb75d +Sony HB-75P - MSX1 - hb75p +*Sony HB-101 - MSX1 +Sony HB-101P - MSX1 - hb101p +Sony HB-201 - MSX1 - hp201 +Sony HB-201P - MSX1 - hb201p +Sony HB-501P - MSX1 - hb501p +Sony HB-701FD - MSX1 - hb701fd +Sony HB-F1 - MSX2 - hbf1 +Sony HB-F1II - MSX2 - hbf12 +Sony HB-F1XD - MSX2 - hbf1xd +Sony HB-F1XD MK2 - MSX2 - hbf1xdm2 +Sony HB-F1XDJ - MSX2+ - hbf1xdj +Sony HB-F1XV - MSX2+ - hbf1xv +Sony HB-F5 - MSX2 - hbf5 +Sony HB-F500 - MSX2 - hbf500 +Sony HB-F500F - MSX2 - hbf500f +Sony HB-F500P - MSX2 - hbf500p +Sony HB-F700D - MSX2 - hbf700d +Sony HB-F700F - MSX2 - hbf700f +Sony HB-F700P - MSX2 - hbf700p +Sony HB-F700S - MSX2 - hbf700s +*Sony HB-F750+ +Sony HB-F900 - MSX2 - hbf900 / hbf900a +Sony HB-F9P - MSX2 - hbf9p +Sony HB-F9P Russian - MSX2 - hbf9pr +Sony HB-F9S - MSX2 - hbf9s +Sony HB-F9S+ - MSX2+ - hbf9sp +Sony HB-G900AP - MSX2 - hbg900ap +Sony HB-G900P - MSX2 - hbg900p +*Sony HB-T7 +Spectravideo SVI-728 - MSX1 - svi728 +Spectravideo SVI-738 - MSX1 - svi738 +Spectravideo SVI-738 Arabic - MSX1 - svi738ar +Spectravideo SVI-738 Danish - MSX1 - svi738dk +Spectravideo SVI-738 Polish - MSX1 - svi738pl +Spectravideo SVI-738 Spanish - MSX1 - svi738sp +Spectravideo SVI-738 Swedish - MSX1 - svi738sw +Talent DPC-200 - MSX1 - tadpc200 +Talent DPC-200A - MSX1 - tadpc20a +Talent TPC-310 - MSX2 - tpc310 +Talent TPP-311 - MSX2 - tpp311 +Talent TPS-312 - MSX2 - tps312 +============================== + +PCB Layouts missing + + +Toshiba HX-10 - MSX1 - hx10 +=========================== + +Code on PCB: MSX TUK + |---------------------------|-------------------|-------------| + | CN1 CN2 CN3 CN4 CN5 | + | |---------------------------| | + | |---------------------------| | + | CN6 | + | IC40 | + | CN7 | + | IC38 IC32 IC33 IC37 | + | | + | Q2 IC31 IC34 IC35 | + | Q1 CN8 | + | IC39 | + | |--IC15------| |--IC2----| |----IC1-----| | + | |------------| |---------| |------------| | + | IC30 | + | IC3 IC4 CN9 | + | |-----IC15-------| | + | IC17 IC18 IC7 IC8 |----------------| | + | IC27 | + | IC19 IC20 IC9 IC10 |----IC25------| | +|----| | |--------------| IC26 | +| Q | | IC21 IC22 IC11 IC12 | +| | | | +| S | | IC23 IC24 IC13 IC14 IC29 IC28 | +| L | | | +| | | CN11 CN10 | +|----| |-------------------------------------------------------------| + +Notes: + Mainboard components: + IC1 - Sharp LH0080A Z80A-CPU-D + IC2 - MB83256 + IC3,IC4,IC27,IC28 - Texas Instruments SN74LS157N + IC7-IC14 - HM4864AP + IC15 - Toshiba TCX-1007 (64pin custom chip) + IC16 - 40pin chip covered with some kind of heatsink(?), probably TMS9929A + IC17-IC24 - 4116-3 + IC25 - AY-3-8910A + IC26 - SN74LS09N + IC29 - HD74LS145P + IC30-IC34 - M74LS367AP + IC35 - MB74LS74A + IC37 - HD74LS373P + IC38 - Toshiba TC74HCU04P + IC39 - HD74LS08P + IC40 - TA75559P + Q1 - 10687.5 + Q2 - 3579545 + CN1 - Cassette connecter + CN2 - RF connector + CN3 - Audio connector + CN4 - Video connector + CN5 - Expansion connector + CN6 - Cartridge connector + CN7 - Printer connector + CN8 - Joystick 2 connector + CN9 - Joystick 1 connector + CN10 - Keyboard connector 1 + CN11 - Keyboard connector 2 + + Extra pcb (video related?) components:: + Q - 4.433619 + S - 74LS04 + L - LVA510 + + +Toshiba HX-10D - MSX1 - hx10d +Toshiba HX-10DP - MSX1 - hx10dp +Toshiba HX-10E - MSX1 - hx10e +Toshiba HX-10F - MSX1 - hx10f +Toshiba HX-10S - MSX1 - hx10s +Toshiba HX-10SA - MSX1 - hx10sa +Toshiba HX-20 - MSX1 - hx20 +Toshiba HX-20I - MSX1 - hx20i +Toshiba HX-21 - MXS1 - -hx21 +Toshiba HX-21I - MSX1 - hx21i +Toshiba HX-22 - MSX1 - hx22 +Toshiba HX-22I - MSX1 - hx22i +Toshiba HX-23 - MSX2 - hx23 +Toshiba HX-23F - MSX2 - hx23f +Toshiba HX-23I - HSX2 - hx23i +Toshiba HX-33 - MSX2 - hx33 +Toshiba HX-34 - MSX2 - hx34 +Toshiba HX-34I - MSX2 - hx34i +Toshiba FS-TM1 - MSX2 - fstm1 +Victor HC-5 - MSX1 - hc5 +Victor HC-6 - MSX1 - hc6 +*Victor HC-6AV - MSX1 +Victor HC-7 - MSX1 - hc7 +*Victor HC-7E - MSX1 +*Victor HC-7GB - MSX1 +*Victor HC-9S - MSX2 +*Victor HC-80 - MSX2 +Victor HC-90 - MSX2 - victhc90 +Victor HC-95 - MSX2 - victhc95 +Victor HC-95A - MSX2 - victhc95a +*Victor HC-95T - MSX2 +*Victor HC-95V - MSX2 +Yamaha CX5F-1 - MSX1 - cx5f1 +Yamaha CX5F-2 - MSX1 - cx5f +Yamaha CX5M - MSX1 - cx5m +Yamaha CX5MII-128 - MSX1 - cx5m128 +Yamaha CX5MII - MSX1 - cx5m2 +Yamaha CX7M - MSX2 - cx7m +Yamaha CX7M/128 - MSX2 - cx7m128 +Yamaha YIS-303 - MSX1 - yis303 +Yamaha YIS-503 - MSX1 - yis503 +Yamaha YIS-503F - MSX1 - yis503f +Yamaha YIS-503II - MSX1 - yis503ii +Yamaha YIS-503IIR (Russian) - MSX1 - y503iir +Yamaha YIS-503IIR (Estonian) - MSX1 - y503iir2 +Yamaha YIS-503M - MSX1 - yis503m +Yamaha YIS-503IIIR - MSX2 - y503iiir +Yamaha YIS-503IIIR Estonion - MSX2 - y503iiire +Ymaha YIS604 - MSX2 - yis60464 +Yamaha YIS604-128 - MSX2 - yis604 +Yamaha YIS805-128 - MSX2 - y805128 +Yamaha YIS805-128R2 - MSX2 - y805128r2 +Yamaha YIS805-128R2 Estonian - MSX2 - y805128r2e +Yamaha YIS805-256 - MSX2 - y805256 +*Yamaha YIS805-256 2+ - MSX2+ - was this a real machine? +Yashica YC-64 - MSX1 - yc64 +Yeno DPC-64 (same bios as Olympia PHC-2) +Yeno MX64 - MSX1 - mx64 +============= + +PCB Layouts missing + + +*/ + + +#include "includes/msx.h" +#include "formats/dsk_dsk.h" +#include "formats/dmk_dsk.h" +#include "machine/msx_matsushita.h" +#include "machine/msx_s1985.h" +#include "machine/msx_systemflags.h" + + +static ADDRESS_MAP_START ( msx_memory_map, AS_PROGRAM, 8, msx_state ) + AM_RANGE(0x0000, 0xfffe) AM_READWRITE(msx_mem_read, msx_mem_write) + AM_RANGE(0xffff, 0xffff) AM_READWRITE(msx_sec_slot_r, msx_sec_slot_w) +ADDRESS_MAP_END + + +WRITE8_MEMBER(msx_state::msx_ay8910_w) +{ + if ( offset & 1 ) + m_ay8910->data_w( space, offset, data ); + else + m_ay8910->address_w( space, offset, data ); +} + + +static ADDRESS_MAP_START ( msx_io_map, AS_IO, 8, msx_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // 0x7c - 0x7d : MSX-MUSIC/FM-PAC write port. Handlers will be installed if MSX-MUSIC is present in a system + AM_RANGE( 0x90, 0x90) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE( 0x90, 0x90) AM_DEVWRITE("cent_ctrl_out", output_latch_device, write) + AM_RANGE( 0x91, 0x91) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE( 0xa0, 0xa7) AM_DEVREAD("ay8910", ay8910_device, data_r) AM_WRITE(msx_ay8910_w) + AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) + AM_RANGE( 0x98, 0x98) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) + AM_RANGE( 0x99, 0x99) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) + AM_RANGE( 0xd8, 0xd9) AM_READWRITE(msx_kanji_r, msx_kanji_w) + // 0xfc - 0xff : Memory mapper I/O ports. I/O handlers will be installed if a memory mapper is present in a system +ADDRESS_MAP_END + + +static ADDRESS_MAP_START ( msx2_io_map, AS_IO, 8, msx_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x40, 0x4f) AM_READWRITE(msx_switched_r, msx_switched_w) + // 0x7c - 0x7d : MSX-MUSIC/FM-PAC write port. Handlers will be installed if MSX-MUSIC is present in a system + AM_RANGE( 0x90, 0x90) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE( 0x90, 0x90) AM_DEVWRITE("cent_ctrl_out", output_latch_device, write) + AM_RANGE( 0x91, 0x91) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE( 0xa0, 0xa7) AM_DEVREAD("ay8910", ay8910_device, data_r) AM_WRITE(msx_ay8910_w) + AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) + AM_RANGE( 0x98, 0x9b) AM_DEVREADWRITE("v9938", v9938_device, read, write) + AM_RANGE( 0xb4, 0xb4) AM_WRITE(msx_rtc_latch_w) + AM_RANGE( 0xb5, 0xb5) AM_READWRITE(msx_rtc_reg_r, msx_rtc_reg_w) + AM_RANGE( 0xd8, 0xd9) AM_READWRITE(msx_kanji_r, msx_kanji_w) + // 0xfc - 0xff : Memory mapper I/O ports. I/O handlers will be installed if a memory mapper is present in a system +ADDRESS_MAP_END + + +static ADDRESS_MAP_START ( msx2p_io_map, AS_IO, 8, msx_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x40, 0x4f) AM_READWRITE(msx_switched_r, msx_switched_w) + // 0x7c - 0x7d : MSX-MUSIC/FM-PAC write port. Handlers will be installed if MSX-MUSIC is present in a system + AM_RANGE( 0x90, 0x90) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE( 0x90, 0x90) AM_DEVWRITE("cent_ctrl_out", output_latch_device, write) + AM_RANGE( 0x91, 0x91) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE( 0xa0, 0xa7) AM_DEVREAD("ay8910", ay8910_device, data_r) AM_WRITE(msx_ay8910_w) + AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) + AM_RANGE( 0x98, 0x9b) AM_DEVREADWRITE("v9958", v9958_device, read, write) + AM_RANGE( 0xb4, 0xb4) AM_WRITE(msx_rtc_latch_w) + AM_RANGE( 0xb5, 0xb5) AM_READWRITE(msx_rtc_reg_r, msx_rtc_reg_w) + AM_RANGE( 0xd8, 0xd9) AM_READWRITE(msx_kanji_r, msx_kanji_w) + // 0xfc - 0xff : Memory mapper I/O ports. I/O handlers will be installed if a memory mapper is present in a system +ADDRESS_MAP_END + + +DEVICE_ADDRESS_MAP_START( switched_device_map, 8, msx_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + + +static INPUT_PORTS_START( msx_dips ) + PORT_START("JOY0") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON1) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_BUTTON2) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_DIPNAME( 0x80, 0, "Game port 1") + PORT_DIPSETTING( 0x00, DEF_STR( Joystick )) + PORT_DIPSETTING( 0x80, "Mouse") + + PORT_START("JOY1") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_DIPNAME( 0x80, 0, "Game port 2") + PORT_DIPSETTING( 0x00, DEF_STR( Joystick )) + PORT_DIPSETTING( 0x80, "Mouse") + + PORT_START("DSW") + PORT_DIPNAME( 0x40, 0, "Swap game port 1 and 2") + PORT_DIPSETTING( 0, DEF_STR( No ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) + + PORT_START("MOUSE0") + PORT_BIT( 0xff00, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + PORT_BIT( 0x00ff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START("MOUSE1") + PORT_BIT( 0xff00, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2) + PORT_BIT( 0x00ff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2) +INPUT_PORTS_END + + +/* 2008-05 FP: About keyboards + +Even if some later Philips (and maybe others) models started to use a layout similar to current +PC keyboards, common MSX keyboards have a couple of keys which do not fit usual mapping +- the key in the 1st row before 'Backspace', 3rd key from '0', here re-mapped to KEYCODE_BACKSLASH2 +- the last key in the 4th row, 4th key from 'M' (not counting Shift), here re-mapped to KEYCODE_TILDE + +These keys corresponds to the following symbols + + input_port | msx | msxuk | msxjp | msxkr |hotbit |expert | + ------------------------------------------------------------- + BACKSLASH2 | \ | | \ | | ? | | won | | \ ^ | { } | + ------------------------------------------------------------- + TILDE | DK* | DK* | _ | _ | < > | / ? | + +* DK = "Dead Key" +Notice that 'expert' input_ports covers both versions 1.0 and 1.1. +msx2 input_ports have the same symbols as their msx counterparts. + +TO DO: +- check Expert 1.0 layout with the real thing +- check Korean layout +- fix natural support in systems using msx inputs but with different mapping +(these systems could have different uses for keys mapped at the following +locations: COLON, QUOTE, BACKSLASH, OPENBRACE, CLOSEBRACE, BACKSLASH2, TILDE. +The corresponding symbols would not work properly in -natural mode). + +Additional note about natural keyboard support: currently, +- "Keypad ," is not mapped +- "Graph" is mapped to 'F6' (this key could be labeled "L Graph") +- "Code" is mapped to 'F7' (this key could be labeled "R Graph", "Kana" or "Hangul") +- "Stop" is mapped to 'F8' +- "Select" is mapped to 'F9' +*/ + +#define KEYB_ROW0 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + +#define KEYB_EXPERT11_ROW0 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + +#define KEYB_HOTBIT_ROW0 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('"') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + +#define KEYB_ROW1 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') \ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + +#define KEYB_HOTBIT_ROW1 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('^') \ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\'') PORT_CHAR('`') \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('"') PORT_CHAR('`') \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('\xC7') PORT_CHAR('\xE7') + +#define KEYB_EXPERT11_ROW1 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('\'') \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('{') PORT_CHAR('}') \ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\'') PORT_CHAR('`') \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR(']') \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') PORT_CHAR('^') + +#define KEYB_ROW2 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('`') PORT_CHAR('~') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dead Key") PORT_CODE(KEYCODE_TILDE) \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + +#define KEYB_HOTBIT_ROW2 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') PORT_CHAR('^') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR(']') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('<') PORT_CHAR('>') \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + +#define KEYB_EXPERT10_ROW2 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xC7') PORT_CHAR('\xE7') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dead Key") PORT_CODE(KEYCODE_TILDE) \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + +#define KEYB_EXPERT11_ROW2 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('@') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('\xC7') PORT_CHAR('\xE7') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('/') PORT_CHAR('?') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(';') PORT_CHAR(':') \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + +#define KEYB_ROW3 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') \ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + +#define KEYB_ROW4 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + +#define KEYB_ROW5 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') \ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + +#define KEYB_ROW6 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CODE") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + +#define KEYB_EXPERT11_ROW6 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L GRA") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R GRA") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + +#define KEYB_ROW7 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4 F9") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F10") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F8)) \ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SELECT") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F9)) \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + +#define KEYB_ROW8 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))\ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + +#define KEYB_ROW9 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) \ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + +#define KEYB_ROW10 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_ENTER_PAD) \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + +static INPUT_PORTS_START( msx ) + PORT_START("KEY0") + KEYB_ROW0 + KEYB_ROW1 + + PORT_START("KEY1") + KEYB_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + KEYB_ROW6 + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY5") + PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + +#ifdef UNREFERENCED_CODE +static INPUT_PORTS_START( msxuk ) + PORT_START("KEY0") + KEYB_ROW0 + KEYB_ROW1 + + PORT_START("KEY1") + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xA3') PORT_CHAR('~') + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dead Key") PORT_CODE(KEYCODE_TILDE) + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + KEYB_ROW6 + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY5") + PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END +#endif + +#define KEYB_JAP_ROW0 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + +#define KEYB_JAP_ROW1 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA5') PORT_CHAR('|')\ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + +#define KEYB_KOR_ROW1 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') \ + PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x82\xA9 |") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0xffe6) PORT_CHAR('|') \ + PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') \ + PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') \ + PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + +#define KEYB_JAP_ROW2 \ + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') \ + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') \ + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') \ + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') \ + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') \ + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') \ + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + +static INPUT_PORTS_START( msxjp ) + PORT_START("KEY0") + KEYB_JAP_ROW0 + KEYB_JAP_ROW1 + + PORT_START("KEY1") + KEYB_JAP_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY5") + PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + +static INPUT_PORTS_START( msxkr ) + PORT_START("KEY0") + KEYB_JAP_ROW0 + KEYB_KOR_ROW1 + + PORT_START("KEY1") + KEYB_JAP_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Hangul") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY5") + PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + +static INPUT_PORTS_START( hotbit ) + PORT_START("KEY0") + KEYB_HOTBIT_ROW0 + KEYB_HOTBIT_ROW1 + + PORT_START("KEY1") + KEYB_HOTBIT_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + KEYB_ROW6 + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY5") + PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + +/* 2008-05 FP: I guess these belong to the keypad */ +#define KEYB_EXPERT11_ROW9 \ + PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) \ + PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) \ + PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) \ + PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) \ + PORT_BIT (0xf000, IP_ACTIVE_LOW, IPT_UNUSED) +static INPUT_PORTS_START( expert11 ) + PORT_START("KEY0") + KEYB_EXPERT11_ROW0 + KEYB_EXPERT11_ROW1 + + PORT_START("KEY1") + KEYB_EXPERT11_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + KEYB_EXPERT11_ROW6 + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + KEYB_EXPERT11_ROW9 + + PORT_START("KEY5") + PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + +static INPUT_PORTS_START( expert10 ) + PORT_START("KEY0") + KEYB_ROW0 + KEYB_ROW1 + + PORT_START("KEY1") + KEYB_EXPERT10_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + KEYB_EXPERT11_ROW6 + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + KEYB_EXPERT11_ROW9 + + PORT_START("KEY5") + PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + +static INPUT_PORTS_START( msx2 ) + PORT_START("KEY0") + KEYB_ROW0 + KEYB_ROW1 + + PORT_START("KEY1") + KEYB_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + KEYB_ROW6 + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + KEYB_ROW9 + + PORT_START("KEY5") + KEYB_ROW10 + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + +static INPUT_PORTS_START( msx2jp ) + PORT_START("KEY0") + KEYB_JAP_ROW0 + KEYB_JAP_ROW1 + + PORT_START("KEY1") + KEYB_JAP_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + KEYB_ROW9 + + PORT_START("KEY5") + KEYB_ROW10 + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + +static INPUT_PORTS_START( msx2kr ) + PORT_START("KEY0") + KEYB_JAP_ROW0 + KEYB_KOR_ROW1 + + PORT_START("KEY1") + KEYB_JAP_ROW2 + KEYB_ROW3 + + PORT_START("KEY2") + KEYB_ROW4 + KEYB_ROW5 + + PORT_START("KEY3") + PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Hangul") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + KEYB_ROW7 + + PORT_START("KEY4") + KEYB_ROW8 + PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY5") + PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( msx_dips ) +INPUT_PORTS_END + + +// Some MSX2+ can switch the z80 clock between 3.5 and 5.3 MHz +WRITE_LINE_MEMBER(msx_state::turbo_w) +{ + // 0 - 5.369317 MHz + // 1 - 3.579545 MHz + m_maincpu->set_unscaled_clock(state ? XTAL_21_4772MHz/6 : XTAL_21_4772MHz/4); +} + + +#define MSX_XBORDER_PIXELS 15 +#define MSX_YBORDER_PIXELS 27 +#define MSX_TOTAL_XRES_PIXELS 256 + (MSX_XBORDER_PIXELS * 2) +#define MSX_TOTAL_YRES_PIXELS 192 + (MSX_YBORDER_PIXELS * 2) +#define MSX_VISIBLE_XBORDER_PIXELS 8 +#define MSX_VISIBLE_YBORDER_PIXELS 24 + + +static MACHINE_CONFIG_FRAGMENT( msx1_cartlist ) + MCFG_SOFTWARE_LIST_ADD("cart_list", "msx1_cart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx1_floplist ) + MCFG_SOFTWARE_LIST_ADD("flop_list", "msx1_flop") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx2_cartlist ) + MCFG_SOFTWARE_LIST_ADD("cart_list", "msx2_cart") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_crt_l", "msx1_cart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx2_floplist ) + MCFG_SOFTWARE_LIST_ADD("flop_list", "msx2_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flp_l", "msx1_flop") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx2p_floplist ) + MCFG_SOFTWARE_LIST_ADD("flop_list", "msx2p_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx2_flp_l", "msx2_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flp_l", "msx1_flop") // maybe not? +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msxr_floplist ) + MCFG_SOFTWARE_LIST_ADD("flop_list", "msxr_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx2p_flp_l", "msx2p_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx2_flp_l", "msx2_flop") // maybe not? + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flp_l", "msx1_flop") // maybe not? +MACHINE_CONFIG_END + +FLOPPY_FORMATS_MEMBER( msx_state::floppy_formats ) + FLOPPY_MSX_FORMAT, + FLOPPY_DMK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( msx_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) + SLOT_INTERFACE( "35ssdd", FLOPPY_35_SSDD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_FRAGMENT( msx_fd1793 ) + MCFG_FD1793_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD_FDC_FORCE_READY +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_wd2793_force_ready ) + // From NMS8245 schematics: + // READY + HLT - pulled high + // SSO/-ENMF + -DDEN + ENP + -5/8 - pulled low + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD_FDC_FORCE_READY +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_wd2793 ) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_mb8877a ) + // From CF-3300 FDC schematic: + // READY + HLT - pulled high + // -DDEN - pulled low + MCFG_MB8877_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD_FDC_FORCE_READY +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_tc8566af ) + MCFG_TC8566AF_ADD("fdc") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_microsol ) + MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) + MCFG_WD_FDC_FORCE_READY +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_1_35_ssdd_drive ) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35ssdd", msx_state::floppy_formats) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_1_35_dd_drive ) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_state::floppy_formats) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_2_35_dd_drive ) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", msx_floppies, "35dd", msx_state::floppy_formats) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx_ym2413 ) + MCFG_SOUND_ADD("ym2413", YM2413, XTAL_21_4772MHz/6) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( msx2_64kb_vram ) + MCFG_DEVICE_MODIFY("v9938") + v9938_device::static_set_vram_size(*device, 0x10000); +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( msx, msx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_10_738635MHz/3) /* 3.579545 MHz */ + MCFG_CPU_PROGRAM_MAP(msx_memory_map) + MCFG_CPU_IO_MAP(msx_io_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", msx_state, msx_interrupt) /* Needed for mouse updates */ + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(msx_state, msx_ppi_port_a_w)) + MCFG_I8255_IN_PORTB_CB(READ8(msx_state, msx_ppi_port_b_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(msx_state, msx_ppi_port_c_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_10_738635MHz/3/2) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_PORT_A_READ_CB(READ8(msx_state, msx_psg_port_a_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(msx_state, msx_psg_port_b_r)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(msx_state, msx_psg_port_a_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(msx_state, msx_psg_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) + MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(fmsx_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("msx_cass") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list","msx1_cass") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_ntsc, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_tms9118, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9118, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_tms9128, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9128, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_tms9918, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9918, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_tms9918a, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9918A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_tms9928, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_pal, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_tms9129, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9129, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx_tms9929, msx ) + /* Video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( msx2, msx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_21_4772MHz/6) /* 3.579545 MHz */ + MCFG_CPU_PROGRAM_MAP(msx_memory_map) + MCFG_CPU_IO_MAP(msx2_io_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(msx_state, msx_ppi_port_a_w)) + MCFG_I8255_IN_PORTB_CB(READ8(msx_state, msx_ppi_port_b_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(msx_state, msx_ppi_port_c_w)) + + /* video hardware */ + MCFG_V9938_ADD("v9938", "screen", 0x20000, XTAL_21_4772MHz) + MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(msx_state,msx_irq_source0)) + MCFG_V99X8_SCREEN_ADD_NTSC("screen", "v9938", XTAL_21_4772MHz) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_21_4772MHz/6/2) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_PORT_A_READ_CB(READ8(msx_state, msx_psg_port_a_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(msx_state, msx_psg_port_b_r)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(msx_state, msx_psg_port_a_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(msx_state, msx_psg_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) + MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(fmsx_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("msx_cass") + + /* real time clock */ + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list", "msx2_cass") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_cas_l", "msx1_cass") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( msx2p, msx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_21_4772MHz/6) /* 3.579545 MHz */ + MCFG_CPU_PROGRAM_MAP(msx_memory_map) + MCFG_CPU_IO_MAP(msx2p_io_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(msx_state, msx_ppi_port_a_w)) + MCFG_I8255_IN_PORTB_CB(READ8(msx_state, msx_ppi_port_b_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(msx_state, msx_ppi_port_c_w)) + + /* video hardware */ + MCFG_V9958_ADD("v9958", "screen", 0x20000, XTAL_21_4772MHz) + MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(msx_state,msx_irq_source0)) + MCFG_V99X8_SCREEN_ADD_NTSC("screen", "v9958", XTAL_21_4772MHz) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_21_4772MHz/6/2) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_PORT_A_READ_CB(READ8(msx_state, msx_psg_port_a_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(msx_state, msx_psg_port_b_r)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(msx_state, msx_psg_port_a_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(msx_state, msx_psg_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) + MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(fmsx_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("msx_cass") + + /* real time clock */ + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list", "msx2_cass") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_cas_l", "msx1_cass") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( msx2_pal, msx2 ) + MCFG_DEVICE_REMOVE("screen") + MCFG_V99X8_SCREEN_ADD_PAL("screen", "v9938", XTAL_21_4772MHz) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/******************************** MSX 1 **********************************/ + +/* MSX - Al Alamiah AX-150 */ + +ROM_START(ax150) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("ax150bios.rom", 0x0000, 0x8000, CRC(bd95c436) SHA1(5e094fca95ab8e91873ee372a3f1239b9a48a48d)) + ROM_LOAD ("ax150arab.rom", 0x8000, 0x8000, CRC(339cd1aa) SHA1(0287b2ec897b9196788cd9f10c99e1487d7adbbb)) +ROM_END + +static MACHINE_CONFIG_DERIVED( ax150, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("arab", 1, 0, 1, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 2, 2) /* 32KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Al Alamiah AX-170 */ + +ROM_START (ax170) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("ax170bios.rom", 0x0000, 0x8000, CRC(bd95c436) SHA1(5e094fca95ab8e91873ee372a3f1239b9a48a48d)) + ROM_LOAD ("ax170arab.rom", 0x8000, 0x8000, CRC(339cd1aa) SHA1(0287b2ec897b9196788cd9f10c99e1487d7adbbb)) +ROM_END + + +static MACHINE_CONFIG_DERIVED( ax170, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // T7937 (in ax170mk2) + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("arab", 1, 0, 1, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Canon V-8 */ + +ROM_START (canonv8) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("v8bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( canonv8, msx_ntsc ) + // AY8910/YM2149?? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 8KB RAM */ + MCFG_MSX_SLOT_RAM_8KB + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot12", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Canon V-10 */ + +ROM_START (canonv10) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("v10bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( canonv10, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot12", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Canon V-20 */ + +ROM_START (canonv20) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("v20bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( canonv20, msx_tms9929 ) + // YM2149 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Canon V-20E */ + +ROM_START (canonv20e) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("v20ebios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +/* MSX - Canon V-20F */ + +ROM_START (canonv20f) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("v20fbios.rom", 0x0000, 0x8000, CRC(e0e894b7) SHA1(d99eebded5db5fce1e072d08e642c0909bc7efdd)) +ROM_END + +/* MSX - Canon V-20G */ + +ROM_START (canonv20g) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("v20gbios.rom", 0x0000, 0x8000, CRC(d6e704ad) SHA1(d67be6d7d56d7229418f4e122f2ec27990db7d19)) +ROM_END + +/* MSX - Canon V-20S */ + +ROM_START (canonv20s) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("v20sbios.rom", 0x0000, 0x8000, CRC(c72b186e) SHA1(9fb289ea5c11d497ee00703f64e82575d1c59923)) +ROM_END + +/* MSX - Casio MX-10 */ + +ROM_START (mx10) + ROM_REGION(0x8000, "maincpu", 0) + ROM_LOAD( "mx10bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mx10, msx_tms9118 ) + // FDC: None, 0 drives + // 2? Cartridge slots + // Z80: uPD780C-1 + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) // 16KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Casio MX-15 */ + +ROM_START (mx15) + ROM_REGION(0x8000, "maincpu", 0) + ROM_LOAD( "mx15bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mx15, msx_ntsc ) + // FDC: None, 0 drives + // 3 Cartridge slots + // T6950 + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) // 16KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot3", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Casio MX-101 */ + +ROM_START (mx101) + ROM_REGION(0x8000, "maincpu", 0) + ROM_LOAD( "mx101bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mx101, msx_ntsc ) + // FDC: None, 0 drives + // 2? Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) // 16KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Casio PV-7 */ + +ROM_START (pv7) + ROM_REGION(0x8000, "maincpu", 0) + ROM_LOAD("pv7bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( pv7, msx_tms9118 ) + // AY8910? + // FDC: None, 0 drives + // 1 Cartridge slot + expansion slot, or 2 cartridge slots? + // By adding a Casio KB-7 2 additional cartridge slots become available and 8KB extra RAM? + // No cassette port + // No printer port + // Z80: uPD780C-1 + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 8KB RAM */ + MCFG_MSX_SLOT_RAM_8KB + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Casio PV-16 */ + +ROM_START (pv16) + ROM_REGION(0x8000, "maincpu", 0) + ROM_LOAD("pv16.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( pv16, msx_tms9118 ) + // AY8910 + // FDC: None, 0 drives + // 1 Cartridge slot + // No printer port + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Daewoo CPC-88 */ + +ROM_START (cpc88) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("88bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) + ROM_LOAD ("88han.rom", 0x8000, 0x2000, CRC(938db440) SHA1(d41676fde0a3047792f93c4a41509b8749e55e74)) + ROM_RELOAD (0xa000, 0x2000) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc88, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2? Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Daewoo DPC-100 */ + +ROM_START (dpc100) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("100bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) + ROM_LOAD ("100han.rom", 0x8000, 0x4000, CRC(97478efb) SHA1(4421fa2504cbce18f7c84b5ea97f04e017007f07)) +ROM_END + +static MACHINE_CONFIG_DERIVED( dpc100, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Daewoo DPC-180 */ + +ROM_START (dpc180) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("180bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) + ROM_LOAD ("180han.rom", 0x8000, 0x4000, CRC(97478efb) SHA1(4421fa2504cbce18f7c84b5ea97f04e017007f07)) +ROM_END + +static MACHINE_CONFIG_DERIVED( dpc180, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Daewoo DPC-200 */ + +ROM_START (dpc200) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("200bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) + ROM_LOAD ("200han.rom", 0x8000, 0x4000, CRC(97478efb) SHA1(4421fa2504cbce18f7c84b5ea97f04e017007f07)) +ROM_END + +static MACHINE_CONFIG_DERIVED( dpc200, msx_tms9918 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Daewoo DPC-200E */ + +ROM_START (dpc200e) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("dpc200ebios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) +ROM_END + +static MACHINE_CONFIG_DERIVED( dpc200e, msx_pal ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Daewoo Zemmix CPC-50A */ + +ROM_START (cpc50a) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("50abios.rom", 0x0000, 0x8000, CRC(c3a868ef) SHA1(a08a940aa87313509e00bc5ac7494d53d8e03492)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc50a, msx_tms9918 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 1? Cartridge slot + // No keyboard? + // No cassette port? + // No printer port? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 8KB RAM */ + MCFG_MSX_SLOT_RAM_8KB + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Daewoo Zemmix CPC-50B */ + +ROM_START (cpc50b) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("50bbios.rom", 0x0000, 0x8000, CRC(c3a868ef) SHA1(a08a940aa87313509e00bc5ac7494d53d8e03492)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc50b, msx_tms9118 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 1? Cartridge slot + // No keyboard? + // No cassette port? + // No printer port? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Daewoo Zemmix CPC-51 */ + +ROM_START (cpc51) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("51bios.rom", 0x0000, 0x8000, CRC(c3a868ef) SHA1(a08a940aa87313509e00bc5ac7494d53d8e03492)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc51, msx_tms9118 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 1 Cartridge slot + // No keyboard, just a keyboard connector + // No cassette port + // No printer port + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Fenner DPC-200 */ + +ROM_START (fdpc200) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("dpc200bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fdpc200, msx_pal ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Fenner FPC-500 */ + +ROM_START (fpc500) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("fpc500bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fpc500, msx_pal ) + // AY8910? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Fenner SPC-800 */ + +ROM_START (fspc800) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("spc800bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fspc800, msx_tms9929 ) + // AY8910? + // FDC: None, 0 drives + // 2 Cartridge slots + // Z80: GSS Z8400APS + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Frael Bruc 100-1 */ + +ROM_START (bruc100) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD("bruc100-1bios.rom", 0x0000, 0x8000, CRC(c7bc4298) SHA1(3abca440cba16ac5e162b602557d30169f77adab)) +ROM_END + +static MACHINE_CONFIG_DERIVED( bruc100, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Fujitsu FM-X */ + +ROM_START (fmx) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("fmxbios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fmx, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 1 Cartridge slot, 2 "Fujistu expansion slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) // 16KB RAM + // Fujitsu expansion slot #1 in slot 1 + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + // Fijutsu expansion slot #2 in slot 3 + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Goldstar FC-80U */ + +ROM_START (gsfc80u) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("fc80ubios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) + ROM_LOAD ("fc80uhan.rom", 0x8000, 0x2000, CRC(0cdb8501) SHA1(58dbe73ae80c2c409e766c3ace730ecd7bec89d0)) + ROM_RELOAD (0xa000, 0x2000) +ROM_END + +static MACHINE_CONFIG_DERIVED( gsfc80u, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Goldstar FC-200 */ + +ROM_START (gsfc200) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("fc200bios.rom.u5a", 0x0000, 0x4000, CRC(61f473fb) SHA1(c425750bbb2ae1d278216b45029d303e37d8df2f)) + ROM_LOAD ("fc200bios.rom.u5b", 0x4000, 0x4000, CRC(1a99b1a1) SHA1(e18f72271b64693a2a2bc226e1b9ebd0448e07c0)) +ROM_END + +static MACHINE_CONFIG_DERIVED( gsfc200, msx_tms9129 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Goldstar GFC-1080 */ + +ROM_START (gfc1080) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("gfc1080bios.rom", 0x0000, 0x8000, CRC(d9cdd4a6) SHA1(6b0be712b9c95c1e912252ab5703e1c0bc457d9e)) + ROM_LOAD ("gfc1080han.rom", 0x8000, 0x4000, CRC(f209448c) SHA1(141b44212ba28e7d03e0b54126fedd9e0807dc42)) + ROM_LOAD ("gfc1080pasocalc.rom", 0xC000, 0x4000, CRC(4014f7ea) SHA1(a5581fa3ce10f90f15ba3dc53d57b02d6e4af172)) +ROM_END + +static MACHINE_CONFIG_DERIVED( gfc1080, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 4, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) // 64KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Goldstar GFC-1080A */ + +ROM_START (gfc1080a) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("gfc1080abios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) + ROM_LOAD ("gfc1080ahan.rom", 0x8000, 0x2000, CRC(0cdb8501) SHA1(58dbe73ae80c2c409e766c3ace730ecd7bec89d0)) + ROM_RELOAD (0xa000, 0x2000) +ROM_END + +static MACHINE_CONFIG_DERIVED( gfc1080a, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 3, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) // 64KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Gradiente Expert 1.0 */ + +ROM_START (expert10) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("expbios.rom", 0x0000, 0x8000, CRC(07610d77) SHA1(ef3e010eb57e4476700a3bbff9d2119ab3acdf62)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expert10, msx_tms9128 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Gradiente Expert 1.1 */ +ROM_START (expert11) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("expbios11.rom", 0x0000, 0x8000, CRC(efb4b972) SHA1(d6720845928ee848cfa88a86accb067397685f02)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expert11, msx_tms9128 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Gradiente Expert 1.3 */ +ROM_START (expert13) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("expbios13.rom", 0x0000, 0x8000, CRC(5638bc38) SHA1(605f5af3f358c6811f54e0173bad908614a198c0)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expert13, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Gradiente Expert DDPlus */ +ROM_START (expertdp) + ROM_REGION (0xc000, "maincpu",0) + ROM_LOAD ("eddpbios.rom", 0x0000, 0x8000, CRC(efb4b972) SHA1(d6720845928ee848cfa88a86accb067397685f02)) + ROM_LOAD ("eddpdisk.rom", 0x8000, 0x4000, CRC(549f1d90) SHA1(f1525de4e0b60a6687156c2a96f8a8b2044b6c56)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expertdp, msx_ntsc ) + // AY8910/YM2149? + // FDC: mb8877a, 1 3.5" DSDD drive + // 2 Cartridge slots + // MSX Engine T7937A (also VDP) + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Gradiente Expert Plus */ + +ROM_START (expertpl) + ROM_REGION (0xc000, "maincpu",0) + ROM_LOAD ("exppbios.rom", 0x0000, 0x8000, CRC(efb4b972) SHA1(d6720845928ee848cfa88a86accb067397685f02)) + ROM_LOAD ("exppdemo.rom", 0x8000, 0x4000, CRC(a9bbef64) SHA1(d4cea8c815f3eeabe0c6a1c845f902ec4318bf6b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expertpl, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // MSX Engine T7937A + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_ROM("demo", 3, 3, 2, 1, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Hitachi MB-H2 */ + +ROM_START (mbh2) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("mbh2bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) + ROM_LOAD ("mbh2firm.rom", 0x8000, 0x4000, CRC(4f03c947) SHA1(e2140fa2e8e59090ecccf55b62323ea9dcc66d0b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mbh2, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // Builtin cassette player + // Speed controller (normal, slow 1, slow 2) + + MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 3, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) // 64KB RAM + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Hitachi MB-H25 */ + +ROM_START (mbh25) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mbh25bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mbh25, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) // 32KB RAM + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Hitachi MB-H50 */ + +ROM_START (mbh50) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mbh50bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mbh50, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // T6950 + + MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) // 64KB RAM + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - JVC HC-7GB */ + +ROM_START (jvchc7gb) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("hc7gbbios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( jvchc7gb, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Mitsubishi ML-F48 */ + +ROM_START (mlf48) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mlf48bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlf48, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 2, 2) // 32KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Mitsubishi ML-F80 */ + +ROM_START (mlf80) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mlf80bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlf80, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Mitsubishi ML-F110 */ + +ROM_START (mlf110) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mlf110bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlf110, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 3, 1) // 16KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Mitsubishi ML-F120 */ + +ROM_START (mlf120) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("mlf120bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) + ROM_LOAD ("mlf120firm.rom", 0x8000, 0x4000, CRC(4b5f3173) SHA1(21a9f60cb6370d0617ce54c42bb7d8e40a4ab560)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlf120, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2? Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("firm", 1, 0, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 2, 2) // 32KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Mitsubishi ML-FX1 */ + +ROM_START (mlfx1) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mlfx1bios.rom", 0x0000, 0x8000, CRC(62867dce) SHA1(0cbe0df4af45e8f531e9c761403ac9e71808f20c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlfx1, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - National CF-1200 */ + +ROM_START (cf1200) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("1200bios.rom", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cf1200, msx_tms9918a ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - National CF-2000 */ + +ROM_START (cf2000) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("2000bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cf2000, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - National CF-2700 */ +ROM_START (cf2700) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("2700bios.rom.ic32", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cf2700, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - National CF-3000 */ + +ROM_START (cf3000) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("3000bios.rom", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cf3000, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - National CF-3300 */ +ROM_START (cf3300) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("3300bios.rom", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) + ROM_LOAD ("3300disk.rom", 0x8000, 0x4000, CRC(549f1d90) SHA1(f1525de4e0b60a6687156c2a96f8a8b2044b6c56)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cf3300, msx_ntsc ) + // AY8910/YM2149? + // FDC: mb8877a, 1 3.5" SSDD drive + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - National FS-1300 */ + +ROM_START (fs1300) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("1300bios.rom", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs1300, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - National FS-4000 */ + +ROM_START (fs4000) + ROM_REGION (0x18000 ,"maincpu", 0) + ROM_LOAD ("4000bios.rom", 0x0000, 0x8000, CRC(071135e0) SHA1(df48902f5f12af8867ae1a87f255145f0e5e0774)) + ROM_LOAD ("4000word.rom", 0x8000, 0x8000, CRC(950b6c87) SHA1(931d6318774bd495a32ec3dabf8d0edfc9913324)) + ROM_LOAD ("4000kdr.rom", 0x10000, 0x8000, CRC(ebaa5a1e) SHA1(77bd67d5d10d459d343e79eafcd8e17eb0f209dd)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("4000kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs4000, msx_tms9128 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("word", 3, 0, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - National FS-4000 (Alt) */ + +ROM_START (fs4000a) + ROM_REGION (0x18000 ,"maincpu", 0) + ROM_LOAD ("4000bios.rom", 0x0000, 0x8000, CRC(071135e0) SHA1(df48902f5f12af8867ae1a87f255145f0e5e0774)) + ROM_LOAD ("4000wora.rom", 0x8000, 0x8000, CRC(52f4cdf7) SHA1(acbac3cb5b700254bed2cacc19fa54f1950f371d)) + ROM_LOAD ("4000kdra.rom", 0x10000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("4000kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs4000a, msx_tms9128 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("word", 3, 0, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/*MSX - Olympia PHC-2*/ + +ROM_START (phc2) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("phc2bios.rom", 0x0000, 0x8000, CRC(4f7bb04b) SHA1(ab0177624d46dd77ab4f50ffcb983c3ba88223f4)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc2, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Olympia PHC-28 */ + +ROM_START (phc28) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("phc28bios.rom", 0x0000, 0x8000, CRC(eceb2802) SHA1(195950173701abeb460a1a070d83466f3f53b337)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc28, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Panasonic CF-2700G */ + +ROM_START (cf2700g) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("cf2700g.rom", 0x0000, 0x8000, CRC(4aa194f4) SHA1(69bf27b610e11437dad1f7a1c37a63179a293d12)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cf2700g, msx_tms9929 ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB?? RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Perfect Perfect1 */ + +ROM_START (perfect1) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("perfect1bios.rom", 0x0000, 0x8000, CRC(a317e6b4) SHA1(e998f0c441f4f1800ef44e42cd1659150206cf79)) + ROM_LOAD ("perfect1arab.rom", 0x8000, 0x8000, CRC(6db04a4d) SHA1(01012a0e2738708861f66b6921b2e2108f2edb54)) + ROM_RELOAD (0x10000, 0x8000) +ROM_END + +static MACHINE_CONFIG_DERIVED( perfect1, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 dribes + // 1 Cartridge slot + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("arab", 0, 1, 0, 4, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 2, 0, 4) // 64KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Philips NMS-801 */ + +ROM_START (nms801) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("801bios.rom", 0x0000, 0x8000, CRC(fa089461) SHA1(21329398c0f350e330b353f45f21aa7ba338fc8d)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms801, msx_pal ) + // AY8910 + // FDC: None, 0 drives + // 0 Cartridge slots + // No printer port + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ +MACHINE_CONFIG_END + +/* MSX - Philips VG-8000 */ + +ROM_START (vg8000) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("8000bios.rom", 0x0000, 0x8000, CRC(efd970b0) SHA1(42252cf87deeb58181a7bfec7c874190a1351779)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8000, msx_tms9129 ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots + // No printer port + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 3, 1) /* 16KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Philips VG-8010 */ + +ROM_START (vg8010) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("8010bios.rom", 0x0000, 0x8000, CRC(efd970b0) SHA1(42252cf87deeb58181a7bfec7c874190a1351779)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8010, msx_tms9129 ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots + // No printer port + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Philips VG-8010F */ + +ROM_START (vg8010f) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("8010fbios.rom", 0x0000, 0x8000, CRC(df57c9ca) SHA1(898630ad1497dc9a329580c682ee55c4bcb9c30c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8010f, msx_tms9129 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // No printer port + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Philips VG-8020-00 */ + +ROM_START (vg802000) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("8020-00bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg802000, msx_tms9929 ) + // YM2149 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Philips VG-8020-20 */ + +ROM_START (vg802020) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("8020-20bios.rom", 0x0000, 0x8000, CRC(a317e6b4) SHA1(e998f0c441f4f1800ef44e42cd1659150206cf79)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg802020, msx_tms9129 ) + // YM2149 (in S-3527 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Philips VG-8020F */ + +ROM_START (vg8020f) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("vg8020f.rom", 0x0000, 0x8000, CRC(6e692fa1) SHA1(9eaad185efc8e224368d1db4949eb9659c26fb2c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8020f, msx_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB?? RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Pioneer PX-7 */ + +ROM_START (piopx7) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("ym2301.ic12", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) + ROM_LOAD ("pd5031.ic13", 0x8000, 0x2000, CRC(91e0df72) SHA1(4f0102cdc27216fd9bcdb9663db728d2ccd8ca6d)) + ROM_FILL( 0xa000, 0x2000, 0x6E ) +ROM_END + +static MACHINE_CONFIG_DERIVED( piopx7, msx_pal ) + // TMS9129NL VDP with sync/overlay interface + // AY-3-8910 PSG + // Pioneer System Remote (SR) system control interface + // FDC: None, 0 drives + // 2 Cartridge slots + + // Line-level stereo audio input can be mixed with sound output, balance controlled with slider on front panel + // Front-panel switch allows audio input to be passed through bypassing the mixing circuit + // Line input can be muted under software control, e.g. when loading data from Laserdisc + // Right channel of line input is additionally routed via some signal processing to the cassette input for loading data from Laserdisc + + // PSG port B bits 0-5 can be used to drive controller pins 1-6, 1-7, 2-6, 2-7, 1-8 and 2-8 low if 0 is written + + // Slot #2 7FFE is the SR control register LCON + // Bit 7 R = /ACK (significant with acknowledge 1->0 with respect to remote control signal transmission) + // Bit 0 R = RMCLK (clock produced by dividing CLK1/CLK2 frequency by 128) + // Bit 0 W = /REM (high output with bit serial data output generated in synchronisation with RMCLK) + + // Slot #2 7FFF is the video overlay control register VCON + // Bit 7 R = /EXTV (low when external video input available; high when not available) + // Bit 7 W = Mute (line input signal muting) + // Bit 0 R = INTEXV (interrupt available when external video signal OFF, reset on read) + // Bit 0 W = /OVERLAY (0 = superimpose, 1 = non-superimpose) + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("rom2", 2, 0, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Pioneer PX-7UK */ + +ROM_START (piopx7uk) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("px7ukbios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) + ROM_LOAD ("px7ukpbasic.rom", 0x8000, 0x2000, CRC(91e0df72) SHA1(4f0102cdc27216fd9bcdb9663db728d2ccd8ca6d)) + ROM_FILL( 0xa000, 0x2000, 0x6E ) + ROM_LOAD ("videoart.rom", 0xc000, 0x8000, CRC(0ba148dc) SHA1(b7b4e4cd40a856bb071976e6cf0f5e546fc86a78)) +ROM_END + +static MACHINE_CONFIG_DERIVED( piopx7uk, msx_tms9129 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("rom2", 2, 0, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Pioneer PX-V60 */ + +ROM_START (piopxv60) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("pxv60bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) + ROM_LOAD ("pxv60pbasic.rom", 0x8000, 0x2000, CRC(91e0df72) SHA1(4f0102cdc27216fd9bcdb9663db728d2ccd8ca6d)) + ROM_FILL( 0xa000, 0x2000, 0x6E ) +ROM_END + +static MACHINE_CONFIG_DERIVED( piopxv60, msx_tms9128 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("rom2", 2, 0, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Samsung SPC-800 */ + +ROM_START (spc800) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("spc800bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) + ROM_LOAD ("spc800han.rom", 0x8000, 0x4000, CRC(5ae2b013) SHA1(1e7616261a203580c1044205ad8766d104f1d874)) +ROM_END + +static MACHINE_CONFIG_DERIVED( spc800, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 0, 4, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB?? RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sanyo MPC-64 */ + +ROM_START (mpc64) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mpc64bios.rom", 0x0000, 0x8000, CRC(d6e704ad) SHA1(d67be6d7d56d7229418f4e122f2ec27990db7d19)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc64, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sanyo MPC-100 */ + +ROM_START (mpc100) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mpc100bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc100, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sanyo MPC-200 */ + +ROM_START (mpc200) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mpc200bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc200, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2? Cartridge slots + // T6950 + // T7775 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) // 64KB RAM + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sanyo MPC-200SP */ + +ROM_START (mpc200sp) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mpcsp200bios.rom", 0x0000, 0x8000, CRC(bcd79900) SHA1(fc8c2b69351e60dc902add232032c2d69f00e41e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc200sp, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2? Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) // 64KB RAM + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sanyo PHC-28L */ + +ROM_START (phc28l) + ROM_REGION( 0x8000, "maincpu", 0) + ROM_LOAD ("28lbios.rom", 0x0000, 0x8000, CRC(d2110d66) SHA1(d3af963e2529662eae63f04a2530454685a1989f)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc28l, msx_tms9929 ) + // YM2149 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sanyo PHC-28S */ + +ROM_START (phc28s) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("28sbios.rom", 0x0000, 0x8000, CRC(e5cf6b3c) SHA1(b1cce60ef61c058f5e42ef7ac635018d1a431168)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc28s, msx_tms9929 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sanyo Wavy MPC-10 */ + +ROM_START (mpc10) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("mpc10.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc10, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sharp Epcom HotBit 1.1 */ + +ROM_START (hotbit11) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hotbit11.rom", 0x0000, 0x8000, CRC(b6942694) SHA1(663f8c512d04d213fa616b0db5eefe3774012a4b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hotbit11, msx_tms9128 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sharp Epcom HotBit 1.2 */ + +ROM_START (hotbit12) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hotbit12.rom", 0x0000, 0x8000, CRC(f59a4a0c) SHA1(9425815446d468058705bae545ffa13646744a87)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hotbit12, msx_tms9128 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sharp Epcom HotBit 1.3b */ + +ROM_START (hotbi13b) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hotbit13b.rom", 0x0000, 0x8000, CRC(7a19820e) SHA1(e0c2bfb078562d15acabc5831020a2370ea87052)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hotbi13b, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sharp Epcom HotBit 1.3p */ + +ROM_START (hotbi13p) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hotbit13p.rom", 0x0000, 0x8000, CRC(150e239c) SHA1(942f9507d206cd8156f15601fe8032fcf0e3875b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hotbi13p, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-10 */ + +ROM_START (hb10) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("hb10bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb10, msx_ntsc ) + // YM2149 (in S-1985 MSX-Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX-Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 3, 1) /* 16KB? RAM */ + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-10P */ + +ROM_START (hb10p) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("10pbios.rom", 0x0000, 0x8000, CRC(0f488dd8) SHA1(5e7c8eab238712d1e18b0219c0f4d4dae180420d)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb10p, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // T6950 + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-20P */ + +ROM_START (hb20p) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("20pbios.rom", 0x0000, 0x8000, CRC(21af423f) SHA1(365c93d7652c9f727221689bcc348652832a7b7a)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb20p, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // T6950 + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-201 */ + +ROM_START (hb201) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("201bios.rom.ic9", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) + ROM_LOAD ("201note.rom.ic8", 0x8000, 0x4000, CRC(74567244) SHA1(0f4f09f1a6ef7535b243afabfb44a3a0eb0498d9)) + ROM_FILL( 0xc000, 0x4000, 0xff ) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb201, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-201P */ + +ROM_START (hb201p) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("201pbios.rom.ic9", 0x0000, 0x8000, CRC(0f488dd8) SHA1(5e7c8eab238712d1e18b0219c0f4d4dae180420d)) + ROM_LOAD ("201pnote.rom.ic8", 0x8000, 0x4000, CRC(1ff9b6ec) SHA1(e84d3ec7a595ee36b50e979683c84105c1871857)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb201p, msx_pal ) + // YM2149 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-501P */ + +ROM_START (hb501p) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("501pbios.rom", 0x0000, 0x8000, CRC(0f488dd8) SHA1(5e7c8eab238712d1e18b0219c0f4d4dae180420d)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb501p, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-55 (Version 1) */ + +ROM_START (hb55) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("hb55bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) + ROM_LOAD ("hb55note.rom", 0x8000, 0x2000, CRC(5743ab55) SHA1(b9179db93608c4da649532e704f072e0a3ea1b22)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb55, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-55D */ + +ROM_START (hb55d) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("55dbios.rom", 0x0000, 0x8000, CRC(7e2b32dd) SHA1(38a645febd0e0fe86d594f27c2d14be995acc730)) + ROM_LOAD ("55dnote.rom", 0x8000, 0x4000, CRC(8aae0494) SHA1(97ce59892573cac3c440efff6d74c8a1c29a5ad3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb55d, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-55P */ + +ROM_START (hb55p) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("55pbios.ic42", 0x0000, 0x4000, CRC(24c198be) SHA1(7f8c94cb8913db32a696dec80ffc78e46693f1b7)) + ROM_LOAD ("55pbios.ic43", 0x4000, 0x4000, CRC(e516e7e5) SHA1(05fedd4b9bfcf4949020c79d32c4c3f03a54fb62)) + ROM_LOAD ("55pnote.ic44", 0x8000, 0x4000, CRC(492b12f8) SHA1(b262aedc71b445303f84efe5e865cbb71fd7d952)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb55p, msx_pal ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-75D */ + +ROM_START (hb75d) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("75dbios.rom", 0x0000, 0x8000, CRC(7e2b32dd) SHA1(38a645febd0e0fe86d594f27c2d14be995acc730)) + ROM_LOAD ("75dnote.rom", 0x8000, 0x4000, CRC(8aae0494) SHA1(97ce59892573cac3c440efff6d74c8a1c29a5ad3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb75d, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-75P */ + +ROM_START (hb75p) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("75pbios.ic42", 0x0000, 0x4000, CRC(24c198be) SHA1(7f8c94cb8913db32a696dec80ffc78e46693f1b7)) + ROM_LOAD ("75pbios.ic43", 0x4000, 0x4000, CRC(e516e7e5) SHA1(05fedd4b9bfcf4949020c79d32c4c3f03a54fb62)) + ROM_LOAD ("75pnote.ic44", 0x8000, 0x4000, CRC(492b12f8) SHA1(b262aedc71b445303f84efe5e865cbb71fd7d952)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb75p, msx_tms9929 ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-101P */ + +ROM_START (hb101p) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("101pbios.rom", 0x0000, 0x8000, CRC(0f488dd8) SHA1(5e7c8eab238712d1e18b0219c0f4d4dae180420d)) + ROM_LOAD ("101pnote.rom", 0x8000, 0x4000, CRC(525017c2) SHA1(8ffc24677fd9d2606a79718764261cdf02434f0a)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb101p, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("note", 3, 0, 1, 1, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Sony HB-701FD */ + +ROM_START (hb701fd) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("hb701fdbios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) + ROM_LOAD ("hb701fddisk.rom", 0x8000, 0x4000, CRC(71961d9d) SHA1(2144036d6573d666143e890e5413956bfe8f66c5)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hb701fd, msx_tms9928 ) + // YM2149 (in S-1985) + // FDC: WD2793?, 1 3.5" SSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0x8000) // Is this correct?? + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Spectravideo SVI-728 */ + +ROM_START (svi728) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("728bios.rom", 0x0000, 0x8000, CRC(1ce9246c) SHA1(ea6a82cf8c6e65eb30b98755c8577cde8d9186c0)) +// ROM_LOAD ("707disk.rom", 0x8000, 0x4000, CRC(f9978853) SHA1(6aa856cc56eb98863c9da7a566571605682b5c6b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( svi728, msx_tms9129 ) + // AY8910 + // FDC: None, 0 drives + // 1 Cartridge slots, 1 Expansion slot (eg for SVI-707) + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 2, 0) +// MSX_LAYOUT_SLOT (3, 0, 1, 1, DISK_ROM2, 0x4000, 0x8000) +// MSX_LAYOUT_SLOT (3, 1, 0, 4, CARTRIDGE2, 0x0000, 0x0000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Spectravideo SVI-738 */ + +ROM_START (svi738) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("738bios.rom", 0x0000, 0x8000, CRC(ad007d62) SHA1(c53b3f2c00f31683914f7452f3f4d94ae2929c0d)) + ROM_LOAD ("738disk.rom", 0x8000, 0x4000, CRC(acd27a36) SHA1(99a40266bc296cef1d432cb0caa8df1a7e570be4)) + ROM_LOAD ("738232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) + ROM_FILL (0xe000, 0x2000, 0xff) +ROM_END + +static MACHINE_CONFIG_DERIVED( svi738, msx_pal ) + // AY8910 + // FDC: wd1793, 1 3.5" SSDD drive + // 2 Cartridge slots + // builtin 80 columns card (V9938) + // RS-232C interface + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) + + MCFG_FRAGMENT_ADD( msx_fd1793 ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Spectravideo SVI-738 Arabic */ + +ROM_START (svi738ar) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("738arbios.rom", 0x0000, 0x8000, CRC(ad007d62) SHA1(c53b3f2c00f31683914f7452f3f4d94ae2929c0d)) + ROM_LOAD ("738ardisk.rom", 0x8000, 0x4000, CRC(acd27a36) SHA1(99a40266bc296cef1d432cb0caa8df1a7e570be4)) + ROM_LOAD ("738ar232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) + ROM_FILL (0xe000, 0x2000, 0xff) + ROM_LOAD ("738arab.rom", 0x10000, 0x8000, CRC(339cd1aa) SHA1(0287b2ec897b9196788cd9f10c99e1487d7adbbb)) +ROM_END + +static MACHINE_CONFIG_DERIVED( svi738ar, msx_pal ) + // AY8910 + // FDC: wd2793, 1 3.5" SSDD drive + // 2 Cartridge slots + // builtin 80 columns card (V9938) + // RS-232C interface + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) + MCFG_MSX_LAYOUT_ROM("arab", 3, 3, 1, 2, "maincpu", 0x10000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Spectravideo SVI-738 Danish */ + +ROM_START (svi738dk) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("738dkbios.rom", 0x0000, 0x8000, CRC(88720320) SHA1(1bda5af20cb86565bdc1ebd1e59a691fed7f9256)) + ROM_LOAD ("738dkdisk.rom", 0x8000, 0x4000, CRC(fb884df4) SHA1(6d3a530ae822ec91f6444c681c9b08b9efadc7e7)) + ROM_LOAD ("738dk232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) + ROM_FILL (0xe000, 0x2000, 0xff) +ROM_END + +static MACHINE_CONFIG_DERIVED( svi738dk, msx_pal ) + // AY8910 + // FDC: wd2793, 1 3.5" SSDD drive + // 2 Cartridge slots + // builtin 80 columns card (V9938) + // RS-232C interface + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Spectravideo SVI-738 Spanish */ + +ROM_START (svi738sp) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("738spbios.rom", 0x0000, 0x8000, CRC(f0c0cbb9) SHA1(5f04d5799ed72ea4993e7c4302a1dd55ac1ea8cd)) + ROM_LOAD ("738spdisk.rom", 0x8000, 0x4000, CRC(fb884df4) SHA1(6d3a530ae822ec91f6444c681c9b08b9efadc7e7)) + ROM_LOAD ("738sp232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) + ROM_FILL (0xe000, 0x2000, 0xff) +ROM_END + +static MACHINE_CONFIG_DERIVED( svi738sp, msx_pal ) + // AY8910 + // FDC: wd2793, 1 3.5" SSDD drive + // 2 Cartridge slots + // builtin 80 columns card (V9938) + // RS-232C interface + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Spectravideo SVI-738 Swedish */ + +ROM_START (svi738sw) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("738sebios.rom", 0x0000, 0x8000, CRC(c8ccdaa0) SHA1(87f4d0fa58cfe9cef818a3185df2735e6da6168c)) + ROM_LOAD ("738sedisk.rom", 0x8000, 0x4000, CRC(fb884df4) SHA1(6d3a530ae822ec91f6444c681c9b08b9efadc7e7)) + ROM_LOAD ("738se232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) + ROM_FILL (0xe000, 0x2000, 0xff) +ROM_END + +static MACHINE_CONFIG_DERIVED( svi738sw, msx_pal ) + // AY8910 + // FDC: wd2793, 1 3.5" SSDD drive + // 2 Cartridge slots + // builtin 80 columns card (V9938) + // RS-232C interface + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Spectravideo SVI-738 Poland*/ + +ROM_START (svi738pl) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("738plbios.rom", 0x0000, 0x8000, CRC(431b8bf5) SHA1(c90077ed84133a947841e07856e71133ba779da6)) // IC51 on board + ROM_LOAD ("738disk.rom", 0x8000, 0x4000, CRC(acd27a36) SHA1(99a40266bc296cef1d432cb0caa8df1a7e570be4)) + ROM_LOAD ("738232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) + ROM_FILL (0xe000, 0x2000, 0xff) +ROM_END + +static MACHINE_CONFIG_DERIVED( svi738pl, msx_pal ) + // AY8910 + // FDC: wd2793, 1 3.5" SSDD drive + // 2 Cartridge slots + // builtin 80 columns card (V9938) + // RS-232C interface + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Talent DPC-200 */ + +ROM_START (tadpc200) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("dpc200bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) +ROM_END + +static MACHINE_CONFIG_DERIVED( tadpc200, msx_tms9129 ) + // AY8910 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Talent DPC-200A */ + +ROM_START (tadpc20a) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("dpc200abios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) +ROM_END + +static MACHINE_CONFIG_DERIVED( tadpc20a, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-10 */ +/* The BIOS on the Toshiba HX-10 is inside a big 64pin Toshiba chip label TCX-1007 */ + +ROM_START (hx10) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("tcx-1007.ic15", 0x0000, 0x8000, CRC(5486b711) SHA1(4dad9de7c28b452351cc12910849b51bd9a37ab3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx10, msx_pal ) + // AY8910 + // FDC: None, 0 drives + // 1 Cartridge slot, 1 Toshiba Expension slot + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + //MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) // Expansion slot + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-10D */ + +ROM_START (hx10d) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hx10dbios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx10d, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-10DP */ + +ROM_START (hx10dp) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hx10dpbios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx10dp, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-10E */ + +ROM_START (hx10e) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hx10ebios.rom", 0x0000, 0x8000, CRC(5486b711) SHA1(4dad9de7c28b452351cc12910849b51bd9a37ab3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx10e, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-10F */ + +ROM_START (hx10f) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hx10fbios.rom", 0x0000, 0x8000, CRC(e0e894b7) SHA1(d99eebded5db5fce1e072d08e642c0909bc7efdd)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx10f, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-10S */ + +ROM_START (hx10s) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hx10sbios.rom", 0x0000, 0x8000, CRC(5486b711) SHA1(4dad9de7c28b452351cc12910849b51bd9a37ab3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx10s, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-10SA */ + +ROM_START (hx10sa) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("hx10sabios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx10sa, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-20 */ + +ROM_START (hx20) + ROM_REGION (0x10000, "maincpu",0) + ROM_LOAD ("hx20bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) + ROM_LOAD ("hx20word.rom", 0x8000, 0x8000, CRC(39b3e1c0) SHA1(9f7cfa932bd7dfd0d9ecaadc51655fb557c2e125)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx20, msx_tms9129 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // T6950 + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-20I */ + +ROM_START (hx20i) + ROM_REGION (0x10000, "maincpu",0) + ROM_LOAD ("hx20ibios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) + ROM_LOAD ("hx20iword.rom", 0x8000, 0x8000, CRC(39b3e1c0) SHA1(9f7cfa932bd7dfd0d9ecaadc51655fb557c2e125)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx20i, msx_tms9129 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // T6950 VDP instead of TMS9928A + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-21 */ + +ROM_START (hx21) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("hx21bios.rom", 0x0000, 0x8000, CRC(83ba6fde) SHA1(01600d06d83072d4e757b29728555efde2c79705)) + ROM_LOAD ("hx21word.rom", 0x8000, 0x8000, CRC(87508e78) SHA1(4e2ec9c0294a18a3ab463f182f9333d2af68cdca)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("hx21kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx21, msx_tms9928 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-21I */ + +ROM_START (hx21i) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("hx21ibios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) + ROM_LOAD ("hx21iword.rom", 0x8000, 0x8000, CRC(f9e29c66) SHA1(3289336b2c12161fd926a7e5ce865770ae7038af)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx21i, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-22 */ + +ROM_START (hx22) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("hx22bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) + ROM_LOAD ("hx22word.rom", 0x8000, 0x8000, CRC(87508e78) SHA1(4e2ec9c0294a18a3ab463f182f9333d2af68cdca)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("hx22kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx22, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // RS232C builtin? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Toshiba HX-22I */ + +ROM_START (hx22i) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("hx22ibios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) + ROM_LOAD ("hx22iword.rom", 0x8000, 0x8000, CRC(f9e29c66) SHA1(3289336b2c12161fd926a7e5ce865770ae7038af)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx22i, msx_tms9929 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + // RS232C builtin? + // Z80: LH0080A + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Victor HC-5 */ + +ROM_START (hc5) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("hc5bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hc5, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives, + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) // 16KB or 32KB RAM ? + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Victor HC-6 */ + +ROM_START (hc6) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("hc6bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hc6, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives, + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 2, 2) // 32KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Victor HC-7 */ + +ROM_START (hc7) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("hc7bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hc7, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives, + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) // 64KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha CX5F (with SFG01) */ + +ROM_START (cx5f1) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("cx5fbios.rom", 0x0000, 0x8000, CRC(dc662057) SHA1(36d77d357a5fd15af2ab266ee66e5091ba4770a3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cx5f1, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 1 Cartridge slot? + // 1 Yamaha expansion slot? + // S-5327 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) // 32KB RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 2, 0, "sfg01") + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha CX5F (with SFG05) */ + +ROM_START (cx5f) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("cx5fbios.rom", 0x0000, 0x8000, CRC(dc662057) SHA1(36d77d357a5fd15af2ab266ee66e5091ba4770a3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cx5f, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 1 Cartridge slot? + // 1 Yamaha expansion slot? + // S-5327 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 0, "sfg05") + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) // 32KB RAM + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha CX5M / Yamaha CX5M-2 */ + +ROM_START (cx5m) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("cx5mbios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cx5m, msx_tms9929 ) + // YM2149 + // FDC: None, 0 drives + // 2 Cartridge slots + // 1 Expansion slot (60 pins interface instead of regular 50 pin cartridge interface) + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 0, "sfg01") + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha CX5M-128 */ + +ROM_START (cx5m128) + ROM_REGION (0x18000, "maincpu",0) + ROM_LOAD ("cx5m128bios.rom", 0x0000, 0x8000, CRC(507b2caa) SHA1(0dde59e8d98fa524961cd37b0e100dbfb42cf576)) + ROM_LOAD ("cx5m128ext.rom", 0x8000, 0x4000, CRC(feada82e) SHA1(48b0c2ff1f1e407cc44394219f7b3878efaa919f)) + ROM_LOAD ("yrm502.rom", 0x14000, 0x4000, CRC(5330fe21) SHA1(7b1798561ee1844a7d6432924fbee9b4fc591c19)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cx5m128, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("yrm", 3, 1, 1, 1, "maincpu", 0x14000) /* YRM-502 */ + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha CX5MII */ + +ROM_START (cx5m2) + ROM_REGION (0x14000, "maincpu",0) + ROM_LOAD ("cx5m2bios.rom", 0x0000, 0x8000, CRC(507b2caa) SHA1(0dde59e8d98fa524961cd37b0e100dbfb42cf576)) + ROM_LOAD ("cx5m2ext.rom", 0x8000, 0x4000, CRC(feada82e) SHA1(48b0c2ff1f1e407cc44394219f7b3878efaa919f)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cx5m2, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha YIS303 */ + +ROM_START (yis303) + ROM_REGION (0x14000, "maincpu",0) + ROM_LOAD ("yis303bios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) + ROM_FILL( 0x8000, 0xc000, 0xff ) +ROM_END + +static MACHINE_CONFIG_DERIVED( yis303, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("fillff", 3, 0, 0, 3, "maincpu", 0x0000) /* Fill FF */ + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 3, 1) /* 16KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha YIS503 */ + +ROM_START (yis503) + ROM_REGION (0x14000, "maincpu",0) + ROM_LOAD ("yis503bios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) + ROM_FILL( 0x8000, 0xc000, 0xff ) +ROM_END + +static MACHINE_CONFIG_DERIVED( yis503, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("fillff", 3, 0, 0, 3, "maincpu", 0x0000) /* Fill FF */ + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha YIS503F */ + +ROM_START (yis503f) + ROM_REGION (0x8000, "maincpu", 0) + ROM_LOAD ("yis503f.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( yis503f, msx_pal ) + // YM2149 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB?? RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha YIS503II */ + +ROM_START (yis503ii) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("yis503iibios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( yis503ii, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha YIS503IIR Russian */ + +ROM_START (y503iir) + ROM_REGION (0x10000, "maincpu",0) + ROM_LOAD ("yis503iirbios.rom", 0x0000, 0x8000, CRC(225a4f9e) SHA1(5173ac403e26c462f904f85c9ef5e7b1e19253e7)) + ROM_LOAD ("yis503iirdisk.rom", 0x8000, 0x4000, CRC(9eb7e24d) SHA1(3a481c7b7e4f0406a55952bc5b9f8cf9d699376c)) + ROM_LOAD ("yis503iirnet.rom", 0xc000, 0x2000, CRC(0731db3f) SHA1(264fbb2de69fdb03f87dc5413428f6aa19511a7f)) +ROM_END + +static MACHINE_CONFIG_DERIVED( y503iir, msx_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793/mb8877?, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + // RTC + // V9938 VDP + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) /* National disk */ + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_ROM("net", 3, 3, 1, 1, "maincpu", 0xc000) /* Net */ + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha YIS503IIR Estonian */ + +ROM_START (y503iir2) + ROM_REGION (0x10000, "maincpu",0) + ROM_LOAD ("yis503ii2bios.rom", 0x0000, 0x8000, CRC(1548cee3) SHA1(42c7fff25b1bd90776ac0aea971241aedce8947d)) + ROM_LOAD ("yis503iirdisk.rom", 0x8000, 0x4000, CRC(9eb7e24d) SHA1(3a481c7b7e4f0406a55952bc5b9f8cf9d699376c)) + ROM_LOAD ("yis503iirnet.rom", 0xc000, 0x2000, CRC(0731db3f) SHA1(264fbb2de69fdb03f87dc5413428f6aa19511a7f)) +ROM_END + +static MACHINE_CONFIG_DERIVED( y503iir2, msx_pal ) + // AY8910/YM2149? + // FDC: wd2793/mb8877?, 1 3.5" DSDD drive? + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) /* National disk */ + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_ROM("net", 3, 3, 1, 1, "maincpu", 0xc000) /* Net */ + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx1_floplist ) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yamaha YIS503M */ + +ROM_START (yis503m) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("yis503mbios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) +ROM_END + +static MACHINE_CONFIG_DERIVED( yis503m, msx_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 0, "sfg05") + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yashica YC-64 */ + +ROM_START (yc64) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("yc64bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) +ROM_END + +static MACHINE_CONFIG_DERIVED( yc64, msx_pal ) + // YM2149 + // FDC: None, 0 drives + // 1 Cartridge slot (slot 1) + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + +/* MSX - Yeno MX64 */ + +ROM_START (mx64) + ROM_REGION (0x8000, "maincpu",0) + ROM_LOAD ("mx64bios.rom", 0x0000, 0x8000, CRC(e0e894b7) SHA1(d99eebded5db5fce1e072d08e642c0909bc7efdd)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mx64, msx_ntsc ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx1_cartlist ) +MACHINE_CONFIG_END + + +/******************************** MSX 2 **********************************/ + +/* MSX2 - Al Alamiah AX-350 */ + +ROM_START (ax350) + ROM_REGION (0x30000, "maincpu", 0) + ROM_LOAD ("ax350bios.rom", 0x00000, 0x8000, CRC(ea306155) SHA1(35195ab67c289a0b470883464df66bc6ea5b00d3)) + ROM_LOAD ("ax350ext.rom", 0x08000, 0x4000, CRC(7c7540b7) SHA1(ebb76f9061e875365023523607db610f2eda1d26)) + ROM_LOAD ("ax350arab.rom", 0x0c000, 0x8000, CRC(c0d8fc85) SHA1(2c9600c6e0025fee10d249e97448ecaa37e38c42)) + ROM_LOAD ("ax350swp.rom", 0x14000, 0x8000, CRC(076f40fc) SHA1(4b4508131dca6d811694ae6379f41364c477de58)) + ROM_LOAD ("ax350paint.rom",0x1c000, 0x10000, CRC(18956e3a) SHA1(ace202e87337fbc54fea21e22c0b3af0abe6f4ae)) + ROM_LOAD ("ax350disk.rom", 0x2c000, 0x4000, CRC(1e7d6512) SHA1(78cd7f847e77fd8cd51a647efb2725ba93f4c471)) +ROM_END + +static MACHINE_CONFIG_DERIVED( ax350, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793/tc8566af?, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) /* Bios */ + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) /* Ext */ + MCFG_MSX_LAYOUT_ROM("arab", 0, 1, 1, 2, "maincpu", 0xc000) /* Arab */ + MCFG_MSX_LAYOUT_ROM("swp", 0, 2, 1, 2, "maincpu", 0x14000) /* SWP */ + MCFG_MSX_LAYOUT_ROM("paint", 0, 3, 0, 4, "maincpu", 0x1c000) /* Paint */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x2c000) /* Disk */ + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Al Alamiah AX-370 */ + +ROM_START (ax370) + ROM_REGION (0x30000, "maincpu", 0) + ROM_LOAD ("ax370bios.rom", 0x0000, 0x8000, CRC(ea306155) SHA1(35195ab67c289a0b470883464df66bc6ea5b00d3)) + ROM_LOAD ("ax370ext.rom", 0x8000, 0x4000, CRC(7c7540b7) SHA1(ebb76f9061e875365023523607db610f2eda1d26)) + ROM_LOAD ("ax370arab.rom", 0xc000, 0x8000, CRC(c0d8fc85) SHA1(2c9600c6e0025fee10d249e97448ecaa37e38c42)) + ROM_LOAD ("ax370swp.rom", 0x14000, 0x8000, CRC(076f40fc) SHA1(4b4508131dca6d811694ae6379f41364c477de58)) + ROM_LOAD ("ax370paint.rom",0x1c000, 0x10000, CRC(18956e3a) SHA1(ace202e87337fbc54fea21e22c0b3af0abe6f4ae)) + ROM_LOAD ("ax370disk.rom", 0x2c000, 0x4000, CRC(60f8baba) SHA1(95de8809d2758fc0a743390ea5085b602e59e101)) +ROM_END + +static MACHINE_CONFIG_DERIVED( ax370, msx2_pal ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) /* Bios */ + MCFG_MSX_LAYOUT_ROM("swp", 0, 2, 1, 2, "maincpu", 0x14000) /* SWP */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) /* Ext */ + MCFG_MSX_LAYOUT_ROM("arab", 3, 1, 1, 2, "maincpu", 0xc000) /* Arab */ + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0x2c000) + MCFG_MSX_LAYOUT_ROM("paint", 3, 3, 0, 4, "maincpu", 0x1c000) /* Paint */ + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Canon V-25 */ + +ROM_START (canonv25) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("v25bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("v25ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) +ROM_END + +static MACHINE_CONFIG_DERIVED( canonv25, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + // 64KB VRAM + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) // BIOS + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) // EXT + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) // 64KB Mapper RAM + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_64kb_vram ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Canon V-30 */ + +ROM_START (canonv30) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("v30bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("v30ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("v30disk.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) +ROM_END + +static MACHINE_CONFIG_DERIVED( canonv30, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: ??, 2 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) // BIOS + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) // EXT + MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) // DISK + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) // 64KB?? Mapper RAM + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Canon V-30F */ + +ROM_START (canonv30f) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("v30fbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("v30fext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("v30fdisk.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) +ROM_END + +static MACHINE_CONFIG_DERIVED( canonv30f, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: ??, 2 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) // BIOS + MCFG_MSX_LAYOUT_CARTRIDGE("cartridge1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartridge2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) // EXT + MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) // DISK + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Daewoo CPC-300 */ + +ROM_START (cpc300) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("300bios.rom", 0x0000, 0x8000, CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) + ROM_LOAD ("300ext.rom", 0x8000, 0x8000, CRC(d64da39c) SHA1(fb51c505adfbc174df94289fa894ef969f5357bc)) + ROM_LOAD ("300han.rom", 0x10000, 0x8000, CRC(e78cd87f) SHA1(47a9d9a24e4fc6f9467c6e7d61a02d45f5a753ef)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc300, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Daewoo CPC-300E */ + +// These roms apparently came from a hacked set, see: http://www.vik.cc/bluemsx/blueforum/viewtopic.php?t=1569&start=75 +ROM_START (cpc300e) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("300ebios.rom", 0x0000, 0x8000, BAD_DUMP CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) + ROM_LOAD ("300eext.rom", 0x8000, 0x8000, BAD_DUMP CRC(d64da39c) SHA1(fb51c505adfbc174df94289fa894ef969f5357bc)) + ROM_LOAD ("300ehan.rom", 0x10000, 0x4000, BAD_DUMP CRC(5afea78d) SHA1(f08c91f8c78d681e1f02eaaaaafb87ad81112b60)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc300e, msx2 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + // No clockchip + // No joystick port?? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Daewoo CPC-330K */ + +ROM_START (cpc330k) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("330kbios.rom", 0x0000, 0x8000, CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) + ROM_LOAD ("330kext.rom", 0x8000, 0x8000, CRC(5d685cca) SHA1(97afbadd8fe34ab658cce8222a27cdbe19bcef39)) + ROM_LOAD ("330khan.rom", 0x10000, 0x4000, CRC(3d6dd335) SHA1(d2b058989a700ca772b9591f42c01ed0f45f74d6)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc330k, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + // Ergonomic keyboard, 2 builtin game controllers + // builtin FM?? builtin SCC?? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Daewoo CPC-400 */ + +ROM_START (cpc400) + ROM_REGION (0x1c000, "maincpu", 0) + ROM_LOAD ("400bios.rom", 0x0000, 0x8000, CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) + ROM_LOAD ("400disk.rom", 0x8000, 0x4000, CRC(5fa517df) SHA1(914f6ccb25d78621186001f2f5e2aaa2d628cd0c)) + ROM_LOAD ("400ext.rom", 0xc000, 0x8000, CRC(2ba104a3) SHA1(b6d3649a6647fa9f6bd61efc317485a20901128f)) + ROM_LOAD ("400han.rom", 0x14000, 0x8000, CRC(a8ead5e3) SHA1(87936f808423dddfd00629056d6807b4be1dc63e)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("400kfn.rom", 0, 0x20000, CRC(b663c605) SHA1(965f4982790f1817bcbabbb38c8777183b231a55)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc400, msx2 ) + // AY8910/YM2149? + // FDC: mb8877a, 1 3.5" DS?DD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 2, "maincpu", 0x14000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_DISK2("disk", 2, 0, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Daewoo CPC-400S */ + +ROM_START (cpc400s) + ROM_REGION (0x1c000, "maincpu", 0) + ROM_LOAD ("400sbios.rom", 0x0000, 0x8000, CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) + ROM_LOAD ("400sdisk.rom", 0x8000, 0x4000, CRC(5fa517df) SHA1(914f6ccb25d78621186001f2f5e2aaa2d628cd0c)) + ROM_LOAD ("400sext.rom", 0xc000, 0x8000, CRC(2ba104a3) SHA1(b6d3649a6647fa9f6bd61efc317485a20901128f)) + ROM_LOAD ("400shan.rom", 0x14000, 0x8000, CRC(975e7a31) SHA1(6a50295ea35e720ba6f4ba5616c3441128b384ed)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("400skfn.rom", 0, 0x20000, CRC(fa85368c) SHA1(30fff22e3e3d464993707488442721a5e56a9707)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc400s, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: mb8877a, 1 3.5" DS?DD drive + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 2, "maincpu", 0x14000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_DISK2("disk", 2, 0, 1, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Daewoo Zemmix CPC-61 */ + +ROM_START (cpc61) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("61bios.rom", 0x0000, 0x8000, CRC(b80c8e45) SHA1(310a02a9746bc062834e0cf2fabf7f3e0f7e829e)) + ROM_LOAD ("61ext.rom", 0x8000, 0x8000, CRC(b3d740b4) SHA1(7121c3c5ee6e4931fceda14a06f4c0e3b8eda437)) + + ROM_REGION(0x40000, "kanji", 0) + ROM_LOAD ("61kfn.rom", 0x00000, 0x40000, CRC(9a3cf67c) SHA1(22d5f4e522250dc5eb17e15b68f4a51bb752cba1)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpc61, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 1 Cartridge slot + // S-1985 MSX Engine + // No clock chip + // No keyboard, but a keyboard connector + // No printer port + // No cassette port? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x10000) // 64KB Mapper RAM? + MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Daewoo Zemmix CPG-120 Normal */ + +ROM_START (cpg120) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("cpg120bios.rom", 0x0000, 0x8000, CRC(b80c8e45) SHA1(310a02a9746bc062834e0cf2fabf7f3e0f7e829e)) + ROM_LOAD ("cpg120ext.rom", 0x8000, 0x8000, CRC(b3d740b4) SHA1(7121c3c5ee6e4931fceda14a06f4c0e3b8eda437)) + ROM_LOAD ("cpg128music.rom", 0x10000, 0x4000, CRC(73491999) SHA1(b9ee4f30a36e283a2b1b9a28a70ab9b9831570c6)) + + ROM_REGION (0x40000, "kanji", 0) + ROM_LOAD ("cpg120kfn.rom", 0x0000, 0x40000, CRC(9a3cf67c) SHA1(22d5f4e522250dc5eb17e15b68f4a51bb752cba1)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cpg120, msx2 ) + // YM2149 (in S1985) + // FDC: None, 0 drives + // 2 Cartridge slots? + // S-1985 MSX Engine + // V9958 VDP + // FM built in + // No keyboard, bot a keyboard connector? + // No clock chip + // No printer port + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) // 128KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_MUSIC("mus", 2, 0, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Daewoo Zemmic CPG-120 Turbo */ +/* Same as normal CPG-120 but with CPU running at 5.369317 MHz */ + +/* MSX2 - Fenner FPC-900 */ + +ROM_START (fpc900) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("fpc900bios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("fpc900ext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) + ROM_LOAD ("fpc900disk.rom", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fpc900, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: WD2793?, 1 3.5" DSDD drive + // 2? Cartridge slots + // S-3527 MSX Engine + // 256KB?? VRAM + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x40000) // 256KB? Mapper RAM + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Gradiente Expert 2.0 */ + +ROM_START (expert20) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("exp20bios.rom", 0x0000, 0x8000, CRC(6bacdce4) SHA1(9c43106dba3ae2829e9a11dffa9d000ed6d6454c)) + ROM_LOAD ("exp20ext.rom", 0x8000, 0x4000, CRC(08ced880) SHA1(4f2a7e0172f0214f025f23845f6e053d0ffd28e8)) + ROM_LOAD ("xbasic2.rom", 0xc000, 0x4000, CRC(2825b1a0) SHA1(47370bec7ca1f0615a54eda548b07fbc0c7ef398)) + ROM_LOAD ("microsoldisk.rom", 0x10000, 0x4000, CRC(6704ef81) SHA1(a3028515ed829e900cc8deb403e17b09a38bf9b0)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expert20, msx2_pal ) + // AY8910/YM2149? + // FDC: microsol, 1? 3.5"? DS?DD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) /* EXT */ + MCFG_MSX_LAYOUT_ROM("xbasic", 1, 1, 1, 1, "maincpu", 0xc000) /* XBASIC */ + MCFG_MSX_LAYOUT_DISK5("disk", 1, 3, 1, 1, "maincpu", 0x10000) /* Microsol controller */ + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx_microsol ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Hitachi MB-H70 */ + +ROM_START (mbh70) + ROM_REGION (0x110000, "maincpu", 0) + ROM_LOAD ("mbh70bios.rom" , 0x0000, 0x8000, CRC(a27c563d) SHA1(c1e46c00f1e38fc9e0ab487bf0513bd93ce61f3f)) + ROM_LOAD ("mbh70ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("mbh70disk.rom", 0xc000, 0x4000, CRC(05661a3f) SHA1(e695fc0c917577a3183901a08ca9e5f9c60b8317)) + ROM_LOAD ("mbh70halnote.rom", 0x10000, 0x100000, CRC(40313fec) SHA1(1af617bfd11b10a71936c606174a80019762ea71)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("mbh70kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mbh70, msx2 ) + // YM2149 (in S-1985) + // FDC: WD2793?, 1? 3.5" DSDD drive + // S-1985 MSX Engine + // 2? Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_SONY08("firm", 0, 3, 0, 4, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Kawai KMC-5000 */ + +ROM_START (kmc5000) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("kmc5000bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("kmc5000ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("kmc5000disk.rom", 0xc000, 0x4000, CRC(e25cacca) SHA1(607cfca605eaf82e3efa33459d6583efb7ecc13b)) + ROM_LOAD ("kmc5000kdr.rom", 0x10000, 0x8000, CRC(2dbea5ec) SHA1(ea35cc2cad9cfdf56cae224d8ee41579de37f000)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("kmc5000kfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( kmc5000, msx2 ) + // YM2149 (in S-1985) + // FDC: TC8566AF?, 1? 3.5" DSDD drive + // S-1985 MSX Engine + // 2? Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Mitsubishi ML-G1 */ + +ROM_START (mlg1) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("mlg1bios.rom", 0x0000, 0x8000, CRC(0cc7f817) SHA1(e4fdf518a8b9c8ab4290c21b83be2c347965fc24)) + ROM_LOAD ("mlg1ext.rom", 0x8000, 0x4000, CRC(dc0951bd) SHA1(1e9a955943aeea9b1807ddf1250ba6436d8dd276)) + ROM_LOAD ("mlg1paint.rom", 0xc000, 0x8000, CRC(64df1750) SHA1(5cf0abca6dbcf940bc33c433ecb4e4ada02fbfe6)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlg1, msx2_pal ) + // YM2149 (in S-1985) + // FDC: None, 0 drives + // S-1985 MSX Engine + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 64KB or 128KB Mapper RAM ? + MCFG_MSX_LAYOUT_ROM("paint", 3, 3, 0, 2, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Mitsubishi ML-G3 */ + +ROM_START (mlg3) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("mlg3bios.rom", 0x0000, 0x8000, CRC(0cc7f817) SHA1(e4fdf518a8b9c8ab4290c21b83be2c347965fc24)) + ROM_LOAD ("mlg3ext.rom", 0x8000, 0x4000, CRC(dc0951bd) SHA1(1e9a955943aeea9b1807ddf1250ba6436d8dd276)) + ROM_LOAD ("mlg3disk.rom", 0xc000, 0x4000, CRC(b94ebc7a) SHA1(30ba1144c872a0bb1c91768e75a2c28ab1f4e3c6)) + ROM_LOAD ("mlg3rs232c.rom", 0x10000, 0x4000, CRC(90b8a114) SHA1(dc50f2c9db233e505b0981c244ff3de553ac9d68)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlg3, msx2_pal ) + // YM2149 (in S-1985) + // FDC: wd2793?, 1 3.5" DSDD drive + // S-1985 MSX Engine + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 64KB or 128KB Mapper RAM? + //MCFG_MSX_LAYOUT_ROM("rs232c", 3, 3, 1, 1, "maincpu", 0x10000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Mitsubishi ML-G10 */ + +ROM_START (mlg10) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("mlg10bios.rom", 0x0000, 0x8000, CRC(a27c563d) SHA1(c1e46c00f1e38fc9e0ab487bf0513bd93ce61f3f)) + ROM_LOAD ("mlg10ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("mlg10kfn.rom", 0, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlg10, msx2 ) + // YM2149 (in S-1985) + // FDC: None, 0 drives + // S-1985 MSX Engine + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 64KB or 128KB Mapper RAM? + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Mitsubishi ML-G30 Model 1/Model 2 */ + +ROM_START (mlg30) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("g30bios.rom", 0x0000, 0x8000, CRC(a27c563d) SHA1(c1e46c00f1e38fc9e0ab487bf0513bd93ce61f3f)) + ROM_LOAD ("g30ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("g30disk.rom", 0xc000, 0x4000, CRC(05661a3f) SHA1(e695fc0c917577a3183901a08ca9e5f9c60b8317)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("g30kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mlg30, msx2 ) + // AY8910/YM2149? + // FDC: wd2793/tc8566af?, 1 or 2? 3.5" DSDD drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) /* Slot 2 subslot 0 */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - National FS-4500 */ + +ROM_START (fs4500) + ROM_REGION (0x40000, "maincpu",0) + ROM_LOAD ("4500bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("4500ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("4500font.rom", 0xc000, 0x4000, CRC(4bd54f95) SHA1(3ce8e35790eb4689b21e14c7ecdd4b63943ee158)) + ROM_LOAD ("4500buns.rom", 0x10000, 0x8000, CRC(c9398e11) SHA1(e89ea1e8e583392e2dd9debb8a4b6a162f58ba91)) + ROM_LOAD ("4500jush.rom", 0x18000, 0x8000, CRC(4debfd2d) SHA1(6442c1c5cece64c6dae90cc6ae3675f070d93e06)) + ROM_LOAD ("4500wor1.rom", 0x20000, 0xc000, CRC(0c8b5cfb) SHA1(3f047469b62d93904005a0ea29092e892724ce0b)) + ROM_LOAD ("4500wor2.rom", 0x2c000, 0xc000, CRC(d9909451) SHA1(4c8ea05c09b40c41888fa18db065575a317fda16)) + ROM_LOAD ("4500kdr1.rom", 0x38000, 0x4000, CRC(f8c7f0db) SHA1(df07e89fa0b1c7874f9cdf184c136f964fea4ff4)) + ROM_LOAD ("4500kdr2.rom", 0x3c000, 0x4000, CRC(69e87c31) SHA1(c63db26660da96af56f8a7d3ea18544b9ae5a37c)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("4500kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) + + /* Matsushita Bunsetsu Henkan ROM must be emulated */ + ROM_REGION(0x20000, "bunsetsu", 0) + ROM_LOAD ("4500budi.rom", 0, 0x20000, CRC(f94590f8) SHA1(1ebb06062428fcdc66808a03761818db2bba3c73)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs4500, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + // Matsushita switched device + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("font", 0, 2, 0, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_BUNSETSU("buns", 0, 2, 1, 2, "maincpu", 0x10000, "bunsetsu") + MCFG_MSX_LAYOUT_ROM("jush", 0, 3, 1, 2, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("wor1", 3, 0, 0, 3, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_ROM("kdr1", 3, 0, 3, 1, "maincpu", 0x38000) + MCFG_MSX_LAYOUT_ROM("wor2", 3, 1, 0, 3, "maincpu", 0x2c000) + MCFG_MSX_LAYOUT_ROM("kdr2", 3, 1, 3, 1, "maincpu", 0x3c000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - National FS-4600 */ + +ROM_START (fs4600) + ROM_REGION (0x120000, "maincpu",0) + ROM_LOAD ("4600bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("4600ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("4600disk.rom", 0xc000, 0x4000, CRC(ae4e65b7) SHA1(073feb8bb645d935e099afaf61e6f04f52adee42)) + ROM_LOAD ("4600fon1.rom", 0x10000, 0x4000, CRC(7391389b) SHA1(31292b9ca9fe7d1d8833530f44c0a5671bfefe4e)) + ROM_LOAD ("4600fon2.rom", 0x14000, 0x4000, CRC(c3a6b445) SHA1(02155fc25c9bd23e1654fe81c74486351e1ecc28)) + ROM_LOAD ("4600kdr.rom", 0x18000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) + ROM_LOAD ("4600firm.rom", 0x20000, 0x100000, CRC(1df57472) SHA1(005794c10a4237de3907ba4a44d436078d3c06c2)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("4600kfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) + + /* Matsushita 12 dots Kanji ROM must be emulated */ + ROM_REGION(0x20000, "kanji12", 0) + ROM_LOAD ("4600kf12.rom", 0, 0x20000, CRC(340d1ef7) SHA1(a7a23dc01314e88381eee88b4878b39931ab4818)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs4600, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: mb8877a, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("fon1", 0, 2, 0, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_ROM("kdr", 0, 2, 1, 2, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_ROM("fon2", 0, 3, 0, 1, "maincpu", 0x14000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_FS4600("firm", 3, 1, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - National FS-4700 */ + +ROM_START (fs4700) + ROM_REGION (0x44000, "maincpu",0) + ROM_LOAD ("4700bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("4700ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("4700disk.rom", 0xc000, 0x4000, CRC(1e7d6512) SHA1(78cd7f847e77fd8cd51a647efb2725ba93f4c471)) + ROM_LOAD ("4700font.rom", 0x10000, 0x4000, CRC(4bd54f95) SHA1(3ce8e35790eb4689b21e14c7ecdd4b63943ee158)) + ROM_LOAD ("4700buns.rom", 0x14000, 0x8000, CRC(c9398e11) SHA1(e89ea1e8e583392e2dd9debb8a4b6a162f58ba91)) + ROM_LOAD ("4700jush.rom", 0x1c000, 0x8000, CRC(4debfd2d) SHA1(6442c1c5cece64c6dae90cc6ae3675f070d93e06)) + ROM_LOAD ("4700wor1.rom", 0x24000, 0xc000, CRC(5f39a727) SHA1(f5af1d2a8bcf247f78847e1a9d995e581df87e8e)) + ROM_LOAD ("4700wor2.rom", 0x30000, 0xc000, CRC(d9909451) SHA1(4c8ea05c09b40c41888fa18db065575a317fda16)) + ROM_LOAD ("4700kdr1.rom", 0x3c000, 0x4000, CRC(f8c7f0db) SHA1(df07e89fa0b1c7874f9cdf184c136f964fea4ff4)) + ROM_LOAD ("4700kdr2.rom", 0x40000, 0x4000, CRC(69e87c31) SHA1(c63db26660da96af56f8a7d3ea18544b9ae5a37c)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("4700kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) + + /* Matsushita Bunsetsu Henkan ROM must be emulated */ + ROM_REGION(0x20000, "bunsetsu", 0) + ROM_LOAD ("4700budi.rom", 0, 0x20000, CRC(f94590f8) SHA1(1ebb06062428fcdc66808a03761818db2bba3c73)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs4700, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: mb8877a, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + // Matsushita switched device + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("font", 0, 2, 0, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_BUNSETSU("buns", 0, 2, 1, 2, "maincpu", 0x14000, "bunsetsu") + MCFG_MSX_LAYOUT_ROM("jush", 0, 3, 1, 2, "maincpu", 0x1c000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("wor1", 3, 0, 0, 3, "maincpu", 0x24000) + MCFG_MSX_LAYOUT_ROM("kdr1", 3, 0, 3, 1, "maincpu", 0x3c000) + MCFG_MSX_LAYOUT_ROM("wor2", 3, 1, 0, 3, "maincpu", 0x30000) + MCFG_MSX_LAYOUT_ROM("kdr2", 3, 1, 3, 1, "maincpu", 0x40000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - National FS-5000 */ + +ROM_START (fs5000) + ROM_REGION (0x30000, "maincpu",0) + ROM_LOAD ("5000bios.rom", 0x0000, 0x8000, CRC(a44ea707) SHA1(59967765d6e9328909dee4dac1cbe4cf9d47d315)) + ROM_LOAD ("5000ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("5000disk.rom", 0xc000, 0x4000, CRC(ae4e65b7) SHA1(073feb8bb645d935e099afaf61e6f04f52adee42)) + ROM_LOAD ("5000rtc.rom", 0x10000, 0x8000, CRC(03351598) SHA1(98bbfa3ab07b7a5cad55d7ddf7cbd9440caa2a86)) + ROM_LOAD ("5000kdr.rom", 0x18000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) + ROM_FILL (0x20000, 0x10000, 0xff) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("5000kfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs5000, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: wd2793, 2 3.5" DSDD drives + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("empty1", 0, 1, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_ROM("empty2", 0, 2, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_ROM("empty3", 0, 3, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 0, 1, 2, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_ROM("rtcrom", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - National FS-5500F2*/ +/* The National FS-5500 had two versions: */ +/* F1 has 1 floppy drive */ +/* F2 has 2 floppy drives */ + +ROM_START (fs5500f1) + ROM_REGION (0x30000, "maincpu",0) + ROM_LOAD ("5500bios.rom", 0x0000, 0x8000, CRC(5bf38e13) SHA1(44e0dd215b2a9f0770dd76fb49187c05b083eed9)) + ROM_LOAD ("5500ext.rom", 0x8000, 0x4000, CRC(3c42c367) SHA1(4be8371f3b03e70ddaca495958345f3c4f8e2d36)) + ROM_LOAD ("5500disk.rom", 0xc000, 0x4000, CRC(1e7d6512) SHA1(78cd7f847e77fd8cd51a647efb2725ba93f4c471)) + ROM_LOAD ("5500imp.rom", 0x10000, 0x8000, CRC(6173a88c) SHA1(b677a861b67e8763a11d5dcf52416b42493ade57)) + ROM_LOAD ("5500kdr.rom", 0x18000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) + ROM_FILL (0x20000, 0x10000, 0xff) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("5500kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs5500f1, msx2 ) + // YM2149 in (S-1985 MSX Engine) + // FDC: mb8877a, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + // Matsushita switched device + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("empty1", 0, 1, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_ROM("empty2", 0, 2, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_ROM("empty3", 0, 3, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 0, 1, 2, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_ROM("imp", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - National FS-5500F2*/ +/* The National FS-5500 had two versions: */ +/* F1 has 1 floppy drive */ +/* F2 has 2 floppy drives */ + +ROM_START (fs5500f2) + ROM_REGION (0x30000, "maincpu",0) + ROM_LOAD ("5500bios.rom", 0x0000, 0x8000, CRC(5bf38e13) SHA1(44e0dd215b2a9f0770dd76fb49187c05b083eed9)) + ROM_LOAD ("5500ext.rom", 0x8000, 0x4000, CRC(3c42c367) SHA1(4be8371f3b03e70ddaca495958345f3c4f8e2d36)) + ROM_LOAD ("5500disk.rom", 0xc000, 0x4000, CRC(1e7d6512) SHA1(78cd7f847e77fd8cd51a647efb2725ba93f4c471)) + ROM_LOAD ("5500imp.rom", 0x10000, 0x8000, CRC(6173a88c) SHA1(b677a861b67e8763a11d5dcf52416b42493ade57)) + ROM_LOAD ("5500kdr.rom", 0x18000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) + ROM_FILL (0x20000, 0x10000, 0xff) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("5500kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fs5500f2, msx2 ) + // YM2149 in (S-1985 MSX Engine) + // FDC: mb8877a, 2 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + // Matsushita switched device + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("empty1", 0, 1, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_ROM("empty2", 0, 2, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_ROM("empty3", 0, 3, 0, 4, "maincpu", 0x20000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 0, 1, 2, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_ROM("imp", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Panasonic FS-A1 */ + +ROM_START (fsa1) + ROM_REGION (0x20000, "maincpu",0) + ROM_LOAD ("a1bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("a1ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("a1desk1.rom", 0x10000, 0x8000, CRC(99c48147) SHA1(63098f27beac9eca6b39d837d2a552395df33fe1)) + ROM_LOAD ("a1desk2.rom", 0x18000, 0x8000, CRC(7f6f4aa1) SHA1(7f5b76605e3d898cc4b5aacf1d7682b82fe84353)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1, msx2 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64 KB RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("desk1", 3, 2, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_ROM("desk2", 3, 3, 1, 2, "maincpu", 0x18000) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Panasonic FS-A1 (a) */ + +ROM_START (fsa1a) + ROM_REGION (0x1c000, "maincpu",0) + ROM_LOAD ("a1bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("a1ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("a1desk1a.rom", 0xc000, 0x8000, CRC(25b5b170) SHA1(d9307bfdaab1312d25e38af7c0d3a7671a9f716b)) + ROM_LOAD ("a1desk2.rom", 0x14000, 0x8000, CRC(7f6f4aa1) SHA1(7f5b76605e3d898cc4b5aacf1d7682b82fe84353)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1a, msx2 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("desk1", 3, 2, 1, 2, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("desk2", 3, 3, 1, 2, "maincpu", 0x14000) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Panasonic FS-A1F */ + +ROM_START (fsa1f) + ROM_REGION (0x20000, "maincpu",0) + ROM_LOAD ("a1fbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("a1fext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("a1fdisk.rom", 0xc000, 0x4000, CRC(e25cacca) SHA1(607cfca605eaf82e3efa33459d6583efb7ecc13b)) + ROM_LOAD ("a1fkdr.rom", 0x10000, 0x8000, CRC(2dbea5ec) SHA1(ea35cc2cad9cfdf56cae224d8ee41579de37f000)) + ROM_LOAD ("a1fcock.rom", 0x18000, 0x8000, CRC(5c2948cd) SHA1(4a99f2444f29c2b642efd6f084081d6fd96bfa9b)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("a1fkfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1f, msx2 ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("fkdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("fcock", 3, 3, 1, 2, "maincpu", 0x18000) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Panasonic FS-A1FM */ + +ROM_START (fsa1fm) + ROM_REGION (0x110000, "maincpu",0) + ROM_LOAD ("a1fmbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("a1fmext.rom", 0x8000, 0x4000, CRC(ad295b5d) SHA1(d552319a19814494e3016de4b8f010e8f7b97e02)) + ROM_LOAD ("a1fmdisk.rom", 0xc000, 0x4000, CRC(e25cacca) SHA1(607cfca605eaf82e3efa33459d6583efb7ecc13b)) + ROM_LOAD ("a1fmfirm.rom", 0x10000, 0x100000, CRC(8ce0ece7) SHA1(f89e3d8f3b6855c29d71d3149cc762e0f6918ad5)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("a1fmkfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) + + /* Matsushita 12 dots Kanji ROM must be emulated */ + ROM_REGION(0x20000, "kanji12", 0) + ROM_LOAD ("a1fmkf12.rom", 0, 0x20000, CRC(340d1ef7) SHA1(a7a23dc01314e88381eee88b4878b39931ab4818)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1fm, msx2 ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots + // Integrated 1200baud modem + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) +/* MSX_LAYOUT_SLOT (3, 1, 1, 4, MODEM_ROM, 0x20000, 0x10000) */ /* Modem Mapper of FS-CM1/A1FM must be emulated */ + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) +/* MSX_LAYOUT_SLOT (3, 3, 0, 4, FSA1FM_ROM, 0x100000, 0x10000) */ /* Panasonic FS-A1FM Mapper must be emulated */ + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Panasonic FS-A1MK2 */ + +ROM_START (fsa1mk2) + ROM_REGION (0x20000, "maincpu",0) + ROM_LOAD ("a1mkbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("a1mk2ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("a1mkcoc1.rom", 0xc000, 0x8000, CRC(0eda3f57) SHA1(2752cd89754c05abdf7c23cba132d38e3ef0f27d)) + ROM_LOAD ("a1mkcoc2.rom", 0x14000, 0x4000, CRC(756d7128) SHA1(e194d290ebfa4595ce0349ea2fc15442508485b0)) + ROM_LOAD ("a1mkcoc3.rom", 0x18000, 0x8000, CRC(c1945676) SHA1(a3f4e2e4934074925d775afe30ac72f150ede543)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1mk2, msx2 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64 KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("coc1", 3, 1, 1, 2, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("coc2", 3, 2, 1, 1, "maincpu", 0x14000) + MCFG_MSX_LAYOUT_ROM("coc3", 3, 3, 1, 2, "maincpu", 0x18000) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8220 - 2 possible sets (/00 /16) */ + +ROM_START (nms8220) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8220bios.rom.u14", 0x0000, 0x8000, BAD_DUMP CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("8220ext.rom.u14", 0x8000, 0x4000, BAD_DUMP CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) + ROM_LOAD ("8220pen.rom.u13", 0xc000, 0x4000, CRC(3d38c53e) SHA1(cb754aed85b3e97a7d3c5894310df7ca18f89f41)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8220, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_ROM("pen", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8220 (a) */ + +ROM_START (nms8220a) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8220bios.rom.u14", 0x0000, 0x8000, BAD_DUMP CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("8220ext.rom.u14", 0x8000, 0x4000, BAD_DUMP CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) + ROM_LOAD ("8220pena.rom.u13", 0xc000, 0x4000, CRC(17817b5a) SHA1(5df95d033ae70b107697b69470126ce1b7ae9eb5)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8220a, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_ROM("pen", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8245 - 2 possible sets (/00 /16) */ +/* /00 - A16 = 0 */ +/* /16 - A16 = 1 */ +/* /19 - Azerty keyboard */ + +ROM_START (nms8245) + ROM_REGION (0x20000, "maincpu", 0) + ROM_LOAD ("nms8245.u7", 0x0000, 0x20000, BAD_DUMP CRC(0c827d5f) SHA1(064e706cb1f12b99b329944ceeedc0efc3b2d9be)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8245, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext",3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8245F */ +/* NMS-8245/19? */ + +ROM_START (nms8245f) + ROM_REGION (0x20000, "maincpu", 0) + ROM_LOAD ("nms8245.u7", 0x0000, 0x20000, BAD_DUMP CRC(0c827d5f) SHA1(064e706cb1f12b99b329944ceeedc0efc3b2d9be)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8245f, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0x1c000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8250 */ +/* Labels taken from an NMS-8250/00 */ + +ROM_START (nms8250) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("d23c256eac.ic119", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("d23128ec.ic118", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) + ROM_LOAD ("jq00014.ic117", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8250, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8250F */ + +ROM_START (nms8250f) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("nms8250fbios.rom", 0x0000, 0x8000, CRC(5cd35ced) SHA1(b034764e6a8978db60b1d652917f5e24a66a7925)) + ROM_LOAD ("nms8250fext.rom", 0x8000, 0x4000, CRC(781ba055) SHA1(fd4bcc81a8160a1dea06036c5f79d200f948f4d6)) + ROM_LOAD ("nms8250fdisk.rom", 0xc000, 0x4000, CRC(13b60725) SHA1(58ba1887e8fd21c912b6859cae6514bd874ffcca)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8250f, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8250J */ + +ROM_START (nms8250j) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8250jbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("8250jext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("8250jdisk.rom", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("8250jkfn.rom", 0x00000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8250j, msx2 ) + // AY8910/YM2149? + // FDC: wd2793?, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8255 */ + +ROM_START (nms8255) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8255bios.rom.ic119", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("8255ext.rom.ic118", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) + ROM_LOAD ("8255disk.rom.ic117", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8255, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 2 3.5" DSDD drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8255F */ + +ROM_START (nms8255f) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("nms8255fbios.rom", 0x0000, 0x8000, CRC(5cd35ced) SHA1(b034764e6a8978db60b1d652917f5e24a66a7925)) + ROM_LOAD ("nms8255fext.rom", 0x8000, 0x4000, CRC(781ba055) SHA1(fd4bcc81a8160a1dea06036c5f79d200f948f4d6)) + ROM_LOAD ("nms8255fdisk.rom", 0xc000, 0x4000, CRC(13b60725) SHA1(58ba1887e8fd21c912b6859cae6514bd874ffcca)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8255f, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 2 3.5" DSDD drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8260 */ +/* Prototype created by JVC for Philips. Based on an NMS-8250 with the floppy drive removed and replaced with a 20MB JVC harddisk */ + +ROM_START (nms8260) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("nms8260bios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("nms8260ext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) + ROM_LOAD ("nms8260disk.rom", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) + ROM_LOAD ("nms8260hdd.rom", 0x10000, 0x4000, CRC(0051afc3) SHA1(77f9fe964f6d8cb8c4af3b5fe63ce6591d5288e6)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8260, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("hdd", 2, 0, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + // There is actually only an FDC inside the real thing. With a floppy controller to attach an external floppy drive + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8270 - Not confirmed to exist yet */ + +/* MSX2 - Philips NMS-8280 - 2 possible sets (/00 /16) */ + +ROM_START (nms8280) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8280bios.rom.ic119", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("8280ext.rom.ic118", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) + ROM_LOAD ("8280disk.rom.ic117", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8280, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 2 3.5" DSDD drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8280F */ + +ROM_START (nms8280f) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8280fbios.rom", 0x0000, 0x8000, CRC(5cd35ced) SHA1(b034764e6a8978db60b1d652917f5e24a66a7925)) + ROM_LOAD ("8280fext.rom", 0x8000, 0x4000, CRC(781ba055) SHA1(fd4bcc81a8160a1dea06036c5f79d200f948f4d6)) + ROM_LOAD ("8280fdisk.rom", 0xc000, 0x4000, CRC(13b60725) SHA1(58ba1887e8fd21c912b6859cae6514bd874ffcca)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8280f, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 2 3.5" DSDD drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips NMS-8280G */ + +ROM_START (nms8280g) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8280gbios.rom.ic119", 0x0000, 0x8000, CRC(8fa060e2) SHA1(b17d9bea0eb16a1aa2d0ccbd7c9488da9f57698e)) + ROM_LOAD ("8280gext.rom.ic118", 0x8000, 0x4000, CRC(41e36d03) SHA1(4ab7b2030d022f5486abaab22aaeaf8aa23e05f3)) + ROM_LOAD ("8280gdisk.rom.ic117", 0xc000, 0x4000, CRC(d0beebb8) SHA1(d1001f93c87ff7fb389e418e33bf7bc81bdbb65f)) +ROM_END + +static MACHINE_CONFIG_DERIVED( nms8280g, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 2 3.5" DSDD drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips VG-8230 (u11 - exp, u12 - basic, u13 - disk */ + +ROM_START (vg8230) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8230bios.rom.u12", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) + ROM_LOAD ("8230ext.rom.u11", 0x8000, 0x4000, CRC(8f84f783) SHA1(3288894e1be6af705871499b23c85732dbc40993)) + ROM_LOAD ("8230disk.rom.u13", 0xc000, 0x4000, CRC(77c4e5bc) SHA1(849f93867ff7846b27f84d0be418569faf058ac2)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8230, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 3.5" SSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips VG-8230J */ + +ROM_START (vg8230j) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8230jbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("8230jext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("8230jdisk.rom", 0xc000, 0x4000, CRC(7639758a) SHA1(0f5798850d11b316a4254b222ca08cc4ad6d4da2)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("8230jkfn.rom", 0x00000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8230j, msx2 ) + // AY8910/YM2149? + // FDC: wd2793?, 1 3.5" SSDD drive? + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips VG-8235 3 psosible basic and ext roms (/00 /02 /19) */ + +ROM_START (vg8235) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8235bios.rom.u48", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("8235ext.rom.u49", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) + ROM_LOAD ("8235disk.rom.u50", 0xc000, 0x4000, CRC(51daeb25) SHA1(8954e59aa79310c7b719ecf0cde1e82fb731dcd1)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8235, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 3.5" SSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips VG-8235F */ + +ROM_START (vg8235f) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8235fbios.rom.u48", 0x0000, 0x8000, CRC(c0577a50) SHA1(3926cdd91fa89657a811463e48cfbdb350676e51)) + ROM_LOAD ("8235fext.rom.u49", 0x8000, 0x4000, CRC(e235d5c8) SHA1(792e6b2814ab783d06c7576c1e3ccd6a9bbac34a)) + ROM_LOAD ("8235fdisk.rom.u50", 0xc000, 0x4000, CRC(77c4e5bc) SHA1(849f93867ff7846b27f84d0be418569faf058ac2)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8235f, msx2_pal ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 3.5" SSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Philips VG-8240 */ + +ROM_START (vg8240) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("8240bios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("8240ext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) + ROM_LOAD ("8240disk.rom", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) +ROM_END + +static MACHINE_CONFIG_DERIVED( vg8240, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0xf8) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sanyo MPC-2300 */ + +ROM_START (mpc2300) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("2300bios.rom", 0x0000, 0x8000, CRC(e7d08e29) SHA1(0f851ee7a1cf79819f61cc89e9948ee72a413802)) + ROM_LOAD ("2300ext.rom", 0x8000, 0x4000, CRC(3d7dc718) SHA1(e1f834b28c3ee7c9f79fe6fbf2b23c8a0617892b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc2300, msx2 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB?? Mapper RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sanyo MPC-2500FD */ + +ROM_START (mpc2500f) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("mpc2500fdbios.rom", 0x0000, 0x8000, CRC(e7d08e29) SHA1(0f851ee7a1cf79819f61cc89e9948ee72a413802)) + ROM_LOAD ("mpc2500fdext.rom", 0x8000, 0x4000, CRC(3d7dc718) SHA1(e1f834b28c3ee7c9f79fe6fbf2b23c8a0617892b)) + ROM_LOAD ("mpc2500fddisk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc2500f, msx2 ) + // YM2149 + // FDC: wd2793?, 1? 3.5" DSDD drive? + // 2 Cartridge slots? + // S-3527 MSX Eninge + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 2, 3, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xC000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB?? Mapper RAM */ + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sanyo Wavy MPC-25FD */ + +ROM_START (mpc25fd) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("25fdbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("25fdext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("25fddisk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc25fd, msx2 ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793, 1 drive + // 1 Cartridge slot (slot 1) + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) + MCFG_MSX_LAYOUT_ROM("ext", 2, 3, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB?? RAM */ + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sanyo Wavy MPC-27 */ + +ROM_START (mpc27) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("mpc27bios.rom", 0x0000, 0x8000, CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) + ROM_LOAD ("mpc27ext.rom", 0x8000, 0x4000, CRC(90ca25b5) SHA1(fd9fa78bac25aa3c0792425b21d14e364cf7eea4)) + ROM_LOAD ("mpc27disk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) + ROM_LOAD ("mlp27.rom", 0x10000, 0x2000, CRC(8f9e6ba0) SHA1(c3a47480c9dd2235f40f9a53dab68e3c48adca01)) + ROM_RELOAD (0x12000, 0x2000) +ROM_END + +static MACHINE_CONFIG_DERIVED( mpc27, msx2 ) + // YM2149 (in S-3527 MSX Engine) + // FDC: wd2793?, 1 drive + // 2 Cartridge slots? + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB?? RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("lpen", 3, 3, 1, 1, "maincpu", 0x10000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sanyo Wavy PHC-23 = PHC-23J(B)*/ + +ROM_START (phc23) + ROM_REGION (0xc000, "maincpu",0) + ROM_LOAD ("23bios.rom", 0x0000, 0x8000, CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) + ROM_LOAD ("23ext.rom", 0x8000, 0x4000, CRC(90ca25b5) SHA1(fd9fa78bac25aa3c0792425b21d14e364cf7eea4)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc23, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sanyo Wavy PHC-55FD2 */ + +ROM_START (phc55fd2) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("phc55fd2bios.rom", 0x0000, 0x8000, CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) + ROM_LOAD ("phc55fd2ext.rom", 0x8000, 0x4000, CRC(90ca25b5) SHA1(fd9fa78bac25aa3c0792425b21d14e364cf7eea4)) + ROM_LOAD ("phc55fd2disk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc55fd2, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: wd2793?, 2 3.5" DSDD drives + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sanyo Wavy PHC-77 */ + +ROM_START (phc77) + ROM_REGION (0x90000, "maincpu", 0) + ROM_LOAD ("phc77bios.rom", 0x0000, 0x8000, CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) + ROM_LOAD ("phc77ext.rom", 0x8000, 0x4000, CRC(90ca25b5) SHA1(fd9fa78bac25aa3c0792425b21d14e364cf7eea4)) + ROM_LOAD ("phc77disk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) + ROM_LOAD ("phc77msxwrite.rom", 0x10000, 0x80000, CRC(ef02e4f3) SHA1(4180544158a57c99162269e33e4f2c77c9fce84e)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("phc77kfn.rom", 0x0000, 0x20000, CRC(3b8fdf44) SHA1(fc71561a64f73da0e0043d256f67fd18d7fc3a7f)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc77, msx2 ) + // YM2149 (in S-1985 MSX Engine) + // FDC: wd2793?, 1 drive + // 2 Cartridge slots + // S-1985 MSX Engine + // Builtin printer + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("write", 3, 3, 1, 2, "maincpu", 0x10000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sharp Epcom HotBit 2.0 */ + +ROM_START (hotbit20) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("hb2bios.rom", 0x0000, 0x8000, CRC(0160e8c9) SHA1(d0cfc35f22b150a1cb10decae4841dfe63b78251)) + ROM_LOAD ("hb2ext.rom", 0x8000, 0x4000, CRC(08ced880) SHA1(4f2a7e0172f0214f025f23845f6e053d0ffd28e8)) + ROM_LOAD ("xbasic2.rom", 0xc000, 0x4000, CRC(2825b1a0) SHA1(47370bec7ca1f0615a54eda548b07fbc0c7ef398)) + ROM_LOAD ("microsoldisk.rom", 0x10000, 0x4000, CRC(6704ef81) SHA1(a3028515ed829e900cc8deb403e17b09a38bf9b0)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hotbit20, msx2_pal ) + // AY8910/YM2149? + // FDC: microsol, 1 or 2 drives? + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) /* EXT */ + MCFG_MSX_LAYOUT_ROM("xbasic", 1, 1, 1, 1, "maincpu", 0xc000) /* XBASIC */ + MCFG_MSX_LAYOUT_DISK5("disk", 1, 3, 1, 1, "maincpu", 0x10000) /* Microsol controller */ + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx_microsol ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F1 */ + +ROM_START (hbf1) + ROM_REGION (0x20000, "maincpu",0) + ROM_LOAD ("f1bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("f1ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("f1note1.rom", 0xc000, 0x4000, CRC(84810ea8) SHA1(9db72bb78792595a12499c821048504dc96ef848)) + ROM_LOAD ("f1note2.rom", 0x10000, 0x8000, CRC(e32e5ee0) SHA1(aa78fc9bcd2343f84cf790310a768ee47f90c841)) + ROM_LOAD ("f1note3.rom", 0x18000, 0x8000, CRC(73eb9329) SHA1(58accf41a90693874b86ce98d8d43c27beb8b6dc)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf1, msx2 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("note1", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("note2", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_ROM("note3", 3, 2, 1, 2, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_RAM("ram", 3, 3, 0, 4) /* 64KB RAM */ + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F1II */ + +ROM_START (hbf12) + ROM_REGION (0x20000, "maincpu",0) + ROM_LOAD ("f12bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("f12ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("f12note1.rom", 0xc000, 0x4000, CRC(dcacf970) SHA1(30d914cda2180889a40a3328e0a0c1327f4eaa10)) + ROM_LOAD ("f12note2.rom", 0x10000, 0x8000, CRC(b0241a61) SHA1(ed2fea5c2a3c2e58d4f69f9d636e08574486a2b1)) + ROM_LOAD ("f12note3.rom", 0x18000, 0x8000, CRC(44a10e6a) SHA1(917d1c079e03c4a44de864f123d03c4e32c8daae)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf12, msx2 ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("note1", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("note2", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_ROM("note3", 3, 2, 1, 2, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F1XD */ + +ROM_START (hbf1xd) + ROM_REGION (0x10000, "maincpu",0) + ROM_LOAD ("f1xdbios.rom.ic27", 0x0000, 0x8000, BAD_DUMP CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) + ROM_LOAD ("f1xdext.rom.ic27", 0x8000, 0x4000, BAD_DUMP CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("f1xddisk.rom.ic27", 0xc000, 0x4000, BAD_DUMP CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf1xd, msx2 ) + // YM2149 (in S-1895 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F1XDMK2 */ + +ROM_START (hbf1xdm2) + ROM_REGION (0x10000, "maincpu",0) + ROM_LOAD ("f1m2bios.rom.ic27", 0x0000, 0x8000, BAD_DUMP CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) + ROM_LOAD ("f1m2ext.rom.ic27", 0x8000, 0x4000, BAD_DUMP CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("f1m2disk.rom.ic27", 0xc000, 0x4000, BAD_DUMP CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf1xdm2, msx2 ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F5 */ + +ROM_START (hbf5) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("hbf5bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("hbf5ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("hbf5note.rom", 0xc000, 0x4000, CRC(0cdc0777) SHA1(06ba91d6732ee8a2ecd5dcc38b0ce42403d86708)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf5, msx2_pal ) + // YM2149 + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("note", 0, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x10000) /* 64KB?? Mapper RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F500 */ + +ROM_START (hbf500) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("f500bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("f500ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("f500disk.rom", 0xc000, 0x4000, CRC(f7f5b0ea) SHA1(e93b8da1e8dddbb3742292b0e5e58731b90e9313)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("f500kfn.rom", 0, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf500, msx2 ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM("ram2", 0, 2, 0, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F500F */ + +ROM_START (hbf500f) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("hbf500fbios.rom", 0x0000, 0x8000, CRC(440dae3c) SHA1(fedd9b682d056ddd1e9b3d281723e12f859b2e69)) + ROM_LOAD ("hbf500fext.rom", 0x8000, 0x4000, CRC(e235d5c8) SHA1(792e6b2814ab783d06c7576c1e3ccd6a9bbac34a)) + ROM_LOAD ("hbf500fdisk.rom", 0xc000, 0x4000, CRC(6e718f5c) SHA1(0e081572f84555dc13bdb0c7044a19d6c164d985)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf500f, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 3 Cartridge slots or 2 Cartridge slots and 1 expansion slot ? + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM("ram2", 0, 2, 0, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F500P */ + +ROM_START (hbf500p) + ROM_REGION (0x1c000, "maincpu", 0) + ROM_LOAD ("500pbios.rom.ic41", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) + ROM_LOAD ("500pext.ic47", 0x8000, 0x8000, CRC(cdd4824a) SHA1(505031f1e8396a6e0cb11c1540e6e7f6999d1191)) + ROM_FILL (0x10000, 0xc000, 0xFF) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf500p, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 3 Cartridge slots or 2 Cartridge slots and 1 expansion slot ? + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM("ram2", 0, 2, 0, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("empty", 3, 0, 0, 4, "maincpu", 0xc000) // Empty? or is this the 3rd cartridge/expansion slot ? + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F700D */ + +ROM_START (hbf700d) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("700dbios.rom.ic5", 0x0000, 0x8000, CRC(e975aa79) SHA1(cef16eb95502ba6ab2265fcafcedde470a101541)) + ROM_LOAD ("700dext.ic6", 0x8000, 0x8000, CRC(100cf756) SHA1(317722fa36c2ed31c07c5218b43490fd5badf1f8)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf700d, msx2_pal ) + // YM2149 (in S-1985 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x40000) /* 256KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F700F */ + +ROM_START (hbf700f) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("700fbios.ic5", 0x0000, 0x8000, CRC(440dae3c) SHA1(fedd9b682d056ddd1e9b3d281723e12f859b2e69)) + ROM_LOAD ("700fext.ic6", 0x8000, 0x8000, CRC(7c8b07b1) SHA1(ecacb20ba0a9bbd25e8c0f128d64dd66f8cd8bee)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf700f, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x40000) /* 256KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F700P */ + +ROM_START (hbf700p) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("700pbios.rom.ic5", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) + ROM_LOAD ("700pext.ic6", 0x8000, 0x8000, CRC(63e1bffc) SHA1(496698a60432490dc1306c8cc1d4a6ded275261a)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf700p, msx2_pal ) + // YM2149 (in S-1985 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x40000) /* 256KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F700S */ + +ROM_START (hbf700s) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("700sbios.rom.ic5", 0x0000, 0x8000, CRC(c2b889a5) SHA1(4811956f878c3e03da46317f787cdc4bebc86f47)) + ROM_LOAD ("700sext.ic6", 0x8000, 0x8000, CRC(28d1badf) SHA1(ae3ed88a2d7034178e08f7bdf5409f462bf67fc9)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf700s, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x40000) /* 256KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F900 */ +ROM_START (hbf900) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("f900bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("f900ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("f900disk.rom", 0xc000, 0x4000, CRC(f83d0ea6) SHA1(fc760d1d7b16370abc7eea39955f230b95b37df6)) + ROM_LOAD ("f900util.rom", 0x10000, 0x4000, CRC(bc6c7c66) SHA1(558b7383544542cf7333700ff90c3efbf93ba2a3)) + ROM_FILL (0x14000, 0x4000, 0) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("f900kfn.rom", 0, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf900, msx2 ) + // AY8910/YM2149? + // FDC: wd2793, 2 3.5" DSDD drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 1, 0x40000) /* 256KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("empty", 3, 3, 1, 1, "maincpu", 0x14000) // Empty/unknown, optional fmpac rom used to be loaded here, or should the util rom be loaded? + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F900 (a) */ +ROM_START (hbf900a) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("f900bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("f900ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("f900disa.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) + ROM_LOAD ("f900util.rom", 0x10000, 0x4000, CRC(bc6c7c66) SHA1(558b7383544542cf7333700ff90c3efbf93ba2a3)) + ROM_FILL (0x14000, 0x4000, 0) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("f900kfn.rom", 0, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf900a, msx2 ) + // AY8910/YM2149? + // FDC: wd2793, 2 3.5" DSDD drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 1, 0x40000) /* 256KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("empty", 3, 3, 1, 1, "maincpu", 0x14000) // Empty/unknown, optional fmpac rom used to be loaded here, or should the util rom be loaded? + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F9P */ + +ROM_START (hbf9p) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("f9pbios.rom.ic11", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) + ROM_LOAD ("f9pfirm1.ic12", 0x8000, 0x8000, CRC(524f67aa) SHA1(41a186afced50ca6312cb5b6c4adb684faca6232)) + ROM_LOAD ("f9pfirm2.rom.ic13", 0x10000, 0x8000, CRC(ea97069f) SHA1(2d1880d1f5a6944fcb1b198b997a3d90ecd1903d)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf9p, msx2_pal ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("firm1", 3, 0, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("firm2", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F9P Russian */ + +ROM_START (hbf9pr) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("f9prbios.rom", 0x0000, 0x8000, CRC(39d7674a) SHA1(47642bb0a2c46a82100543dc3970d0a49fc53b69)) + ROM_LOAD ("f9prext.rom", 0x8000, 0x4000, CRC(8b966f50) SHA1(65253cb38ab11084f355a2d4ad78fa6c64cbe660)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf9pr, msx2_pal ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-F9S */ + +ROM_START (hbf9s) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("f9sbios.ic11", 0x0000, 0x8000, CRC(c2b889a5) SHA1(4811956f878c3e03da46317f787cdc4bebc86f47)) + ROM_LOAD ("f9sfirm1.ic12", 0x8000, 0x8000, CRC(cf39620b) SHA1(1166a93d7185ba024bdf2bfa9a30e1c447fb6db1)) + ROM_LOAD ("f9sfirm2.ic13", 0x10000, 0x8000, CRC(ea97069f) SHA1(2d1880d1f5a6944fcb1b198b997a3d90ecd1903d)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf9s, msx2_pal ) + // YM2149 (in S-1985 MSX Engine) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("firm1", 3, 0, 0, 2, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("firm2", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-G900AP */ + +/* IC109 - 32KB Basic ROM SLOT#00 0000-7FFF */ +/* IC112 - 16KB Basic ROM SLOT#01 0000-3FFF */ +/* IC117 - 16KB Disk ROM SLOT#01 4000-7FFF */ +/* IC123 - 32KB ROM RS232C ROM SLOT#02 4000-7FFF / Video Utility ROM SLOT#03 4000-7FFF */ + +/* MSX2 - Sony HB-G900AP */ +ROM_START (hbg900ap) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("g900bios.rom", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) + ROM_LOAD ("g900ext.rom", 0x8000, 0x4000, CRC(8f84f783) SHA1(3288894e1be6af705871499b23c85732dbc40993)) + ROM_LOAD ("g900disk.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) + ROM_LOAD ("g900232c.rom", 0x10000, 0x4000, CRC(06cf1da6) SHA1(373aa82d0426830880a7344ef98f7309d93814c7)) + ROM_LOAD ("g900util.rom", 0x14000, 0x4000, CRC(d0417c20) SHA1(8779b004e7605a3c419825f0373a5d8fa84e1d5b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbg900ap, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) +/* MSX_LAYOUT_SLOT ("rs232c", 0, 2, 1, 1, "maincpu", 0x10000) */ /* RS232C must be emulated */ + MCFG_MSX_LAYOUT_ROM("util", 0, 3, 1, 1, "maincpu", 0x14000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x80000) /* 512KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Sony HB-G900P - 3x 32KB ROMs */ + +ROM_START (hbg900p) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("g900bios.rom", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) + ROM_LOAD ("g900ext.rom", 0x8000, 0x4000, CRC(8f84f783) SHA1(3288894e1be6af705871499b23c85732dbc40993)) + ROM_LOAD ("g900disk.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) + ROM_LOAD ("g900232c.rom", 0x10000, 0x4000, CRC(06cf1da6) SHA1(373aa82d0426830880a7344ef98f7309d93814c7)) + ROM_LOAD ("g900util.rom", 0x14000, 0x4000, CRC(d0417c20) SHA1(8779b004e7605a3c419825f0373a5d8fa84e1d5b)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbg900p, msx2_pal ) + // AY8910/YM2149? + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) +/* MSX_LAYOUT_SLOT ("rs232c", 0, 2, 1, 1, "maincpu", 0x10000) */ /* RS232C must be emulated */ + MCFG_MSX_LAYOUT_ROM("util", 0, 3, 1, 1, "maincpu", 0x14000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Talent TPC-310 */ +ROM_START (tpc310) + ROM_REGION (0x1c000, "maincpu", 0) + ROM_LOAD ("tpc310bios.rom", 0x0000, 0x8000, CRC(8cd3e845) SHA1(7bba23669b7abfb6a142f9e1735b847d6e4e8267)) + ROM_LOAD ("tpc310ext.rom", 0x8000, 0x4000, CRC(094a9e7a) SHA1(39dfc46260f99b670916b1e55f67a5d4136e6e54)) + ROM_LOAD ("dpf550disk.rom", 0xc000, 0x4000, CRC(347b1b44) SHA1(c1d83c559e1e6a6da961eafa55aab105681c634c)) + ROM_LOAD ("tpc310turbo.rom", 0x10000, 0x4000, CRC(0ea62a4d) SHA1(181bf58da7184e128cd419da3109b93344a543cf)) + ROM_LOAD ("tpc310acc.rom", 0x14000, 0x8000, CRC(4fb8fab3) SHA1(cdeb0ed8adecaaadb78d5a5364fd603238591685)) +ROM_END + +static MACHINE_CONFIG_DERIVED( tpc310, msx2_pal ) + // YM2149 (in S-1985 MSX Engine) + // FDC: mb8877a?, 1 3.5" DSDD drive + // 1 Cartridge slot (slot 2) + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 1, 0, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("turbo", 3, 0, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_ROM("acc", 3, 1, 1, 2, "maincpu", 0x14000) + MCFG_MSX_LAYOUT_DISK2("disk", 3, 2, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_mb8877a ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Talent TPP-311 */ + +ROM_START (tpp311) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("311bios.rom", 0x0000, 0x8000, CRC(8cd3e845) SHA1(7bba23669b7abfb6a142f9e1735b847d6e4e8267)) + ROM_LOAD ("311ext.rom", 0x8000, 0x4000, CRC(094a9e7a) SHA1(39dfc46260f99b670916b1e55f67a5d4136e6e54)) + ROM_LOAD ("311logo.rom", 0xc000, 0x8000, CRC(0e6ecb9f) SHA1(e45ddc5bf1a1e63756d11fb43fc50276ca35cab0)) +ROM_END + +static MACHINE_CONFIG_DERIVED( tpp311, msx2_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 0 Cartridge slots? + // 64KB VRAM + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 1, 0, 0x10000) /* 64KB?? Mapper RAM */ + MCFG_MSX_LAYOUT_ROM("logo", 2, 0, 1, 2, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + + MCFG_FRAGMENT_ADD( msx2_64kb_vram ) +MACHINE_CONFIG_END + +/* MSX2 - Talent TPS-312 */ + +ROM_START (tps312) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("312bios.rom", 0x0000, 0x8000, CRC(8cd3e845) SHA1(7bba23669b7abfb6a142f9e1735b847d6e4e8267)) + ROM_LOAD ("312ext.rom", 0x8000, 0x4000, CRC(094a9e7a) SHA1(39dfc46260f99b670916b1e55f67a5d4136e6e54)) + ROM_LOAD ("312plan.rom", 0xc000, 0x8000, CRC(b3a6aaf6) SHA1(6de80e863cdd7856ab7aac4c238224a5352bda3b)) + ROM_LOAD ("312write.rom", 0x14000, 0x4000, CRC(63c6992f) SHA1(93682f5baba7697c40088e26f99ee065c78e83b8)) +ROM_END + +static MACHINE_CONFIG_DERIVED( tps312, msx2_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + // 64KB VRAM + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 1, 0, 0x20000) /* 128KB?? Mapper RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("write", 3, 1, 1, 1, "maincpu", 0x14000) + MCFG_MSX_LAYOUT_ROM("plan", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("planlow", 3, 2, 0, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 3) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) + + MCFG_FRAGMENT_ADD( msx2_64kb_vram ) +MACHINE_CONFIG_END + +/* MSX2 - Toshiba HX-23 */ + +ROM_START (hx23) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("hx23bios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("hx23ext.rom", 0x8000, 0x4000, CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) + ROM_LOAD ("hx23word.rom", 0xc000, 0x8000, CRC(39b3e1c0) SHA1(9f7cfa932bd7dfd0d9ecaadc51655fb557c2e125)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx23, msx2_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + // 64KB VRAM + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 0, 2) /* 32KB RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) + + MCFG_FRAGMENT_ADD( msx2_64kb_vram ) +MACHINE_CONFIG_END + +/* MSX2 - Toshiba HX-23F */ + +ROM_START (hx23f) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("hx23fbios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("hx23fext.rom", 0x8000, 0x4000, CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) + ROM_LOAD ("hx23fword.rom", 0xc000, 0x8000, CRC(39b3e1c0) SHA1(9f7cfa932bd7dfd0d9ecaadc51655fb557c2e125)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx23f, msx2_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0xc000) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Toshiba HX-23I */ + +ROM_START (hx23i) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("hx23ibios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("hx23iext.rom", 0x8000, 0x4000, CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) + ROM_LOAD ("hx23iword.rom", 0xc000, 0x8000, CRC(d50db5b4) SHA1(64cf27a6be1393b1da9f8d5d43df617c9f22fbd2)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx23i, msx2_pal ) + // YM2149 (in S-1985) + // FDC: None, 0 drives + // 2 Cartridge slots? + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX@ - Toshiba HX-33 */ + +ROM_START (hx33) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("hx33bios.rom", 0x0000, 0x8000, CRC(3891e0f7) SHA1(7dfb18262d48e559fffb4199acbe29d9b4bee9db)) + ROM_LOAD ("hx33ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("hx33firm.rom", 0xc000, 0x8000, CRC(d05b5ca6) SHA1(7eea205044af48cfde9b7fff277d961704c4d45c)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("hx33kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx33, msx2 ) + // YM2149 (in S-1985) + // FDC: None, 0, drives + // 2 Cartridge slots? + // RS232C builtin? + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) // 64KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("firm", 3, 2, 1, 2, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_64kb_vram ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX@ - Toshiba HX-34 */ + +ROM_START (hx34) +ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("hx34bios.rom", 0x0000, 0x8000, CRC(3891e0f7) SHA1(7dfb18262d48e559fffb4199acbe29d9b4bee9db)) + ROM_LOAD ("hx34ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + // hx34disk.rom has contents of floppy registers at offset 3ff0-3ff7 and mirrored at 3ff8-3fff + ROM_LOAD ("hx34disk.rom", 0xc000, 0x4000, BAD_DUMP CRC(b6203bc8) SHA1(d31236e8b2491bca678d905546b365e9d365b072)) + ROM_LOAD ("hx34firm.rom", 0x10000, 0x8000, CRC(d05b5ca6) SHA1(7eea205044af48cfde9b7fff277d961704c4d45c)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("hx34kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx34, msx2 ) + // YM2149 (in S-1985) + // FDC: wd2793??, 1 3.5" DSDD drive + // 2 Cartridge slots? + // RS232C builtin? + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) // 64KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK6("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("firm", 3, 3, 1, 2, "maincpu", 0x10000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX@ - Toshiba HX-34I */ + +ROM_START (hx34i) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("hx34ibios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("hx34iext.rom", 0x8000, 0x4000, CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) + // hx34idisk.rom has contents of floppy registers at offset 3ff0-3ff7 and mirrored at 3ff8-3fff + ROM_LOAD ("hx34idisk.rom", 0xc000, 0x4000, BAD_DUMP CRC(b6203bc8) SHA1(d31236e8b2491bca678d905546b365e9d365b072)) + ROM_LOAD ("hx34ifirm.rom", 0x10000, 0x8000, CRC(f9e29c66) SHA1(3289336b2c12161fd926a7e5ce865770ae7038af)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hx34i, msx2_pal ) + // YM2149 (in S-1985) + // FDC: wd2793??, 1 3.5" DSDD drive + // 2 Cartridge slots? + // RS232C builtin? + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) // 64KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK6("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("firm", 3, 3, 1, 2, "maincpu", 0x10000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Toshiba FS-TM1 */ + +ROM_START (fstm1) + ROM_REGION (0x1c000, "maincpu", 0) + ROM_LOAD ("fstm1bios.rom", 0x0000, 0x8000, CRC(d1e11d52) SHA1(7a69e9b9595f3b0060155f4b419c915d4d9d8ca1)) + ROM_LOAD ("fstm1ext.rom", 0x8000, 0x4000, CRC(4eebe9b1) SHA1(a4bdbdb20bf9fd3c492a890fbf541bf092eaa8e1)) + ROM_LOAD ("fstm1desk1.rom", 0xc000, 0x8000, CRC(8b802086) SHA1(30737040d90c136d34dd409fe579bc4cca11c469)) + ROM_LOAD ("fstm1desk2.rom", 0x14000, 0x8000, CRC(304820ea) SHA1(ff6e07d3976b0874164fae680ae028d598752049)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fstm1, msx2_pal ) + // YM2149 (in S-1985) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) // 64KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("desk1", 3, 2, 1, 2, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("desk2", 3, 3, 1, 2, "maincpu", 0x14000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Victor HC-90 */ + +ROM_START (victhc90) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("hc90bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("hc90ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("hc90disk.rom", 0xc000, 0x4000, CRC(11bca2ed) SHA1(a7a34671bddb48fa6c74182e2977f9129558ec32)) + ROM_LOAD ("hc90firm.rom", 0x10000, 0x4000, CRC(53791d91) SHA1(caeffdd654394726c8c0824b21af7ff51c0b1031)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("hc90kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( victhc90, msx2 ) + // YM2149 (in S-1985) + // FDC: wd2793?, 1 3.5" DSDD drive + // RS232C builtin + // 2nd CPU HD-64B180 @ 6.144 MHz + // 1 Cartridge slot (slot 1 or 2?) + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("firm", 0, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x10000) // 64KB Mapper RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Victor HC-95 */ + +ROM_START (victhc95) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("hc95bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("hc95ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("hc95disk.rom", 0xc000, 0x4000, CRC(11bca2ed) SHA1(a7a34671bddb48fa6c74182e2977f9129558ec32)) + ROM_LOAD ("hc95firm.rom", 0x10000, 0x4000, CRC(53791d91) SHA1(caeffdd654394726c8c0824b21af7ff51c0b1031)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("hc95kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( victhc95, msx2 ) + // YM2149 (in S-1985) + // FDC: wd2793?, 2 3.5" DSDD drive + // RS232C builtin + // 2nd CPU HD-64B180 @ 6.144 MHz + // 1 Cartridge slot (slot 1 or 2?) + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("firm", 0, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x10000) // 64KB Mapper RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Victor HC-95A */ + +ROM_START (victhc95a) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("hc95abios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("hc95aext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) + ROM_LOAD ("hc95adisk.rom", 0xc000, 0x4000, CRC(11bca2ed) SHA1(a7a34671bddb48fa6c74182e2977f9129558ec32)) + ROM_LOAD ("hc95afirm.rom", 0x10000, 0x4000, CRC(53791d91) SHA1(caeffdd654394726c8c0824b21af7ff51c0b1031)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("hc95akfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) +ROM_END + +static MACHINE_CONFIG_DERIVED( victhc95a, msx2 ) + // YM2149 (in S-1985) + // FDC: wd2793?, 2 3.5" DSDD drive + // RS232C builtin + // 2nd CPU HD-64B180 @ 6.144 MHz + // 1 Cartridge slot (slot 1 or 2?) + // S-1985 MSX Engine + // V9958 VDP + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("firm", 0, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x40000) // 256KB Mapper RAM + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha CX7M */ + +ROM_START (cx7m) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("cx7mbios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("cx7mext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cx7m, msx2_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha CX7M/128 */ + +ROM_START (cx7m128) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("cx7mbios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) + ROM_LOAD ("cx7mext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) + ROM_LOAD ("yrm502.rom", 0xc000, 0x4000, CRC(51f7ddd1) SHA1(2a4b4a4657e3077df8a88f98210b76883d3702b1)) +ROM_END + +static MACHINE_CONFIG_DERIVED( cx7m128, msx2_pal ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("yrm502", 3, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha YIS-503 III R */ + +ROM_START (y503iiir) + ROM_REGION (0x1c000, "maincpu", 0) + ROM_LOAD ("yis503iiirbios.rom", 0x0000, 0x8000, CRC(e7d08e29) SHA1(0f851ee7a1cf79819f61cc89e9948ee72a413802)) + ROM_LOAD ("yis503iiirext.rom", 0x8000, 0x4000, CRC(34d21778) SHA1(03bf6d2ac86f5c9ab618e155442787c700f99fed)) + ROM_LOAD ("yis503iiircpm.rom", 0xc000, 0x4000, CRC(417bf00e) SHA1(f4f7a54cdf5a9dd6c59f7cb219c2c5eb0a00fa8a)) + ROM_LOAD ("yis503iiirnet.rom", 0x10000, 33121, CRC(b10fb61c) SHA1(af2b7004a8888d7a72eee937783fccaca0f38621)) // Very odd size for a rom... +ROM_END + +static MACHINE_CONFIG_DERIVED( y503iiir, msx2_pal ) + // YM2149 (in S-3527) + // FDC: wd2793?, 1 3.5" DSDD drive + // 2 Cartridge slots + // Networking builtin + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("cpm", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("net", 3, 3, 0, 3, "maincpu", 0x10000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha YIS-503 III R Estonian */ + +ROM_START (y503iiire) + ROM_REGION (0x1c000, "maincpu", 0) + ROM_LOAD ("yis503iiirebios.rom", 0x0000, 0x8000, CRC(d0c20f54) SHA1(ebb7eb540a390509edfd36c84288ba85e63f2d1f)) + ROM_LOAD ("yis503iiireext.rom", 0x8000, 0x4000, CRC(34d21778) SHA1(03bf6d2ac86f5c9ab618e155442787c700f99fed)) + ROM_LOAD ("yis503iiirecpm.rom", 0xc000, 0x4000, CRC(417bf00e) SHA1(f4f7a54cdf5a9dd6c59f7cb219c2c5eb0a00fa8a)) + ROM_LOAD ("yis503iiirenet.rom", 0x10000, 33121, CRC(b10fb61c) SHA1(af2b7004a8888d7a72eee937783fccaca0f38621)) // Very odd size for a rom... +ROM_END + +static MACHINE_CONFIG_DERIVED( y503iiire, msx2_pal ) + // YM2149 (in S-3527) + // FDC: wd2793?, 1 3.5" DSDD drive + // 2 Cartridge slots + // Networking builtin + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("cpm", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("net", 3, 3, 0, 3, "maincpu", 0x10000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha YIS604 */ + +ROM_START (yis60464) + ROM_REGION (0xc000, "maincpu", 0) + ROM_LOAD ("yis604bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("yis604ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("yis604kfn.rom", 0x0000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( yis60464, msx2 ) + // YM2149 (in S-3527) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) // 64KB Mapper RAM + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha YIS604/128 */ + +ROM_START (yis604) + ROM_REGION (0x10000, "maincpu", 0) + ROM_LOAD ("yis604bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("yis604ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("yrm502.rom", 0xc000, 0x4000, CRC(51f7ddd1) SHA1(2a4b4a4657e3077df8a88f98210b76883d3702b1)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("yis604kfn.rom", 0x0000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( yis604, msx2 ) + // YM2149 (in S-3527) + // FDC: None, 0 drives + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("yrm502", 3, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) // 64KB Mapper RAM + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha YIS-805/128 */ + +ROM_START (y805128) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("yis805128bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("yis805128ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("yis805128disk.rom", 0xc000, 0x4000, CRC(ab94a273) SHA1(4b08a057e5863ade179dcf8bc9377e90940e6d61)) + ROM_LOAD ("yrm502.rom", 0x10000, 0x4000, CRC(51f7ddd1) SHA1(2a4b4a4657e3077df8a88f98210b76883d3702b1)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("yis805128kfn.rom", 0x0000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( y805128, msx2 ) + // YM2149 (in S-3527) + // FDC: wd2793?, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("yrm502", 3, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha YIS-805R2/128 */ + +ROM_START (y805128r2) + ROM_REGION (0x28000, "maincpu", 0) + ROM_LOAD ("yis805128r2bios.rom", 0x0000, 0x8000, CRC(e7d08e29) SHA1(0f851ee7a1cf79819f61cc89e9948ee72a413802)) + ROM_LOAD ("yis805128r2ext.rom", 0x8000, 0x4000, CRC(34d21778) SHA1(03bf6d2ac86f5c9ab618e155442787c700f99fed)) + ROM_LOAD ("yis805128r2disk.rom", 0xc000, 0x4000, CRC(9eb7e24d) SHA1(3a481c7b7e4f0406a55952bc5b9f8cf9d699376c)) + ROM_LOAD ("yis805128r2net.rom", 0x10000, 0x8000, CRC(0e345b43) SHA1(e8fd2bbc1bdab12c73a0fec178a190f9063547bb)) + ROM_LOAD ("yis805128r2paint.rom", 0x18000, 0x10000, CRC(1bda68a3) SHA1(7fd2a28c4fdaeb140f3c8c8fb90271b1472c97b9)) +ROM_END + +static MACHINE_CONFIG_DERIVED( y805128r2, msx2_pal ) + // YM2149 (in S-3527) + // FDC: wd2793?, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + // Networking built in + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("paint", 3, 0, 0, 4, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("net", 3, 3, 0, 2, "maincpu", 0x10000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha YIS-805R2/128 Estonian */ + +ROM_START (y805128r2e) + ROM_REGION (0x28000, "maincpu", 0) + ROM_LOAD ("yis805128r2ebios.rom", 0x0000, 0x8000, CRC(d0c20f54) SHA1(ebb7eb540a390509edfd36c84288ba85e63f2d1f)) + ROM_LOAD ("yis805128r2eext.rom", 0x8000, 0x4000, CRC(34d21778) SHA1(03bf6d2ac86f5c9ab618e155442787c700f99fed)) + ROM_LOAD ("yis805128r2edisk.rom", 0xc000, 0x4000, CRC(9eb7e24d) SHA1(3a481c7b7e4f0406a55952bc5b9f8cf9d699376c)) + ROM_LOAD ("yis805128r2enet.rom", 0x10000, 0x8000, CRC(0e345b43) SHA1(e8fd2bbc1bdab12c73a0fec178a190f9063547bb)) + ROM_LOAD ("yis805128r2epaint.rom", 0x18000, 0x10000, CRC(1bda68a3) SHA1(7fd2a28c4fdaeb140f3c8c8fb90271b1472c97b9)) +ROM_END + +static MACHINE_CONFIG_DERIVED( y805128r2e, msx2_pal ) + // YM2149 (in S-3527) + // FDC: wd2793?, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + // Networking built in + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("paint", 3, 0, 0, 4, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM + MCFG_MSX_LAYOUT_ROM("net", 3, 3, 0, 2, "maincpu", 0x10000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2 - Yamaha YIS-805/256 */ + +ROM_START (y805256) + ROM_REGION (0x14000, "maincpu", 0) + ROM_LOAD ("yis805256bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) + ROM_LOAD ("yis805256ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) + ROM_LOAD ("yis805256disk.rom", 0xc000, 0x4000, CRC(ab94a273) SHA1(4b08a057e5863ade179dcf8bc9377e90940e6d61)) + ROM_LOAD ("yrm502.rom", 0x10000, 0x4000, CRC(51f7ddd1) SHA1(2a4b4a4657e3077df8a88f98210b76883d3702b1)) + + ROM_REGION (0x20000, "kanji", 0) + ROM_LOAD ("yis805256kfn.rom", 0x0000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) +ROM_END + +static MACHINE_CONFIG_DERIVED( y805256, msx2 ) + // YM2149 (in S-3527) + // FDC: wd2793?, 1 3.5" DSDD drive + // 2 Cartridge slots + // S-3527 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("yrm502", 3, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x40000) // 256KB Mapper RAM + MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/******************************** MSX 2+ **********************************/ + +/* MSX2+ - Ciel Expert 3 IDE */ + +ROM_START (expert3i ) + ROM_REGION (0x24000, "maincpu", 0) + ROM_LOAD ("exp30bios.rom", 0x0000, 0x8000, CRC(a10bb1ce) SHA1(5029cf47031b22bd5d1f68ebfd3be6d6da56dfe9)) + ROM_LOAD ("exp30ext.rom", 0x8000, 0x4000, CRC(6bcf4100) SHA1(cc1744c6c513d6409a142b4fb42fbe70a95d9b7f)) + ROM_LOAD ("cieldisk.rom", 0xc000, 0x4000, CRC(bb550b09) SHA1(0274dd9b5096065a7f4ed019101124c9bd1d56b8)) + ROM_LOAD ("exp30mus.rom", 0x10000, 0x4000, CRC(9881b3fd) SHA1(befebc916bfdb5e8057040f0ae82b5517a7750db)) + ROM_LOAD ("ide240a.rom", 0x14000, 0x10000, CRC(7adf857f) SHA1(8a919dbeed92db8c06a611279efaed8552810239)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expert3i, msx2p ) + // AY8910/YM2149? + // FDC: wd2793, 1 or 2? drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_MUSIC("mus", 1, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK1("disk", 1, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("ide", 1, 3, 0, 4, "maincpu", 0x14000) /* IDE hardware needs to be emulated */ + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x40000) /* 256KB?? Mapper RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Ciel Expert 3 Turbo */ + +/* Uses a Z84C0010 - CMOS processor working at 7 MHz */ +ROM_START (expert3t ) + ROM_REGION (0x18000, "maincpu",0) + ROM_LOAD ("exp30bios.rom", 0x0000, 0x8000, CRC(a10bb1ce) SHA1(5029cf47031b22bd5d1f68ebfd3be6d6da56dfe9)) + ROM_LOAD ("exp30ext.rom", 0x8000, 0x4000, CRC(6bcf4100) SHA1(cc1744c6c513d6409a142b4fb42fbe70a95d9b7f)) + ROM_LOAD ("cieldisk.rom", 0xc000, 0x4000, CRC(bb550b09) SHA1(0274dd9b5096065a7f4ed019101124c9bd1d56b8)) + ROM_LOAD ("exp30mus.rom", 0x10000, 0x4000, CRC(9881b3fd) SHA1(befebc916bfdb5e8057040f0ae82b5517a7750db)) + ROM_LOAD ("turbo.rom", 0x14000, 0x4000, CRC(ab528416) SHA1(d468604269ae7664ac739ea9f922a05e14ffa3d1)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expert3t, msx2p ) + // AY8910 + // FDC: wd2793?, 1 or 2? drives + // 4 Cartridge/Expansion slots? + // FM/YM2413 built-in + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_MUSIC("mus", 1, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_ROM("turbo", 1, 2, 1, 1, "maincpu", 0x14000) /* Turbo hardware needs to be emulated */ + MCFG_MSX_LAYOUT_DISK1("disk", 1, 3, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x40000) /* 256KB Mapper RAM */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Gradiente Expert AC88+ */ + +ROM_START (expertac) + ROM_REGION(0x18000, "maincpu", 0) + ROM_LOAD ("ac88bios.rom", 0x0000, 0x8000, CRC(9ce0da44) SHA1(1fc2306911ab6e1ebdf7cb8c3c34a7f116414e88)) + ROM_LOAD ("ac88ext.rom", 0x8000, 0x4000, CRC(c74c005c) SHA1(d5528825c7eea2cfeadd64db1dbdbe1344478fc6)) + ROM_LOAD ("panadisk.rom", 0xc000, 0x4000, CRC(17fa392b) SHA1(7ed7c55e0359737ac5e68d38cb6903f9e5d7c2b6)) + ROM_LOAD ("ac88asm.rom", 0x10000, 0x4000, CRC(a8a955ae) SHA1(91e522473a8470511584df3ee5b325ea5e2b81ef)) + ROM_LOAD ("xbasic2.rom", 0x14000, 0x4000, CRC(2825b1a0) SHA1(47370bec7ca1f0615a54eda548b07fbc0c7ef398)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expertac, msx2p ) + // AY8910/YM2149? + // FDC: wd2793?, 1 or 2? drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM?? */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("asm", 3, 1, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("xbasic", 3, 3, 1, 1, "maincpu", 0x14000) + + MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Gradiente Expert DDX+ */ + +ROM_START (expertdx) + ROM_REGION(0x1c000, "maincpu", 0) + ROM_LOAD ("ddxbios.rom", 0x0000, 0x8000, CRC(e00af3dc) SHA1(5c463dd990582e677c8206f61035a7c54d8c67f0)) + ROM_LOAD ("ddxext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("panadisk.rom", 0xc000, 0x4000, CRC(17fa392b) SHA1(7ed7c55e0359737ac5e68d38cb6903f9e5d7c2b6)) + ROM_LOAD ("xbasic2.rom", 0x10000, 0x4000, CRC(2825b1a0) SHA1(47370bec7ca1f0615a54eda548b07fbc0c7ef398)) + ROM_LOAD ("kanji.rom", 0x14000, 0x8000, CRC(b4fc574d) SHA1(dcc3a67732aa01c4f2ee8d1ad886444a4dbafe06)) +ROM_END + +static MACHINE_CONFIG_DERIVED( expertdx, msx2p ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive? + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("xbasic", 1, 2, 1, 1, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 1, 3, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x10000) /* 64KB Mapper RAM?? */ + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) + /* Kanji? */ + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Panasonic FS-A1FX */ + +ROM_START (fsa1fx) + ROM_REGION (0x20000, "maincpu",0) + ROM_LOAD ("a1fxbios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) + ROM_LOAD ("a1fxext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("a1fxdisk.rom", 0xc000, 0x4000, CRC(2bda0184) SHA1(2a0d228afde36ac7c5d3c2aac9c7c664dd071a8c)) + ROM_LOAD ("a1fxkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) + ROM_LOAD ("a1fxcock.rom", 0x18000, 0x8000, CRC(f662e6eb) SHA1(9d67fab55b85f4ac4f5924323a70020eb8589057)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("a1fxkfn.rom", 0, 0x20000, CRC(b244f6cf) SHA1(e0e99cd91e88ce2676445663f832c835d74d6fd4)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1fx, msx2p ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("cock", 3, 3, 1, 2, "maincpu", 0x18000) + + MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) + MCFG_MSX_MATSUSHITA_TURBO_CB(WRITELINE(msx_state, turbo_w)) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Panasonic FS-A1WSX */ + +ROM_START (fsa1wsx) + ROM_REGION (0x21c000, "maincpu",0) + ROM_LOAD ("a1wsbios.rom", 0x0000, 0x8000, CRC(358ec547) SHA1(f4433752d3bf876bfefb363c749d4d2e08a218b6)) + ROM_LOAD ("a1wsext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("a1wsdisk.rom", 0xc000, 0x4000, CRC(ac7d92b4) SHA1(b7068e2aab02072852ca249596b7550ac632c4c2)) + ROM_LOAD ("a1wskdr.rom", 0x10000, 0x8000, CRC(b4fc574d) SHA1(dcc3a67732aa01c4f2ee8d1ad886444a4dbafe06)) + ROM_LOAD ("a1wsmusp.rom", 0x18000, 0x4000, CRC(456e494e) SHA1(6354ccc5c100b1c558c9395fa8c00784d2e9b0a3)) + ROM_LOAD ("a1wsfirm.rom", 0x1c000, 0x200000, CRC(e363595d) SHA1(3330d9b6b76e3c4ccb7cf252496ed15d08b95d3f)) + + ROM_REGION(0x40000, "kanji", 0) + ROM_LOAD ("a1wskfn.rom", 0, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1wsx, msx2p ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots + // FM built-in + // No cassette port + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_PANASONIC08("firm", 3, 3, 0, 4, "maincpu", 0x1c000) + + MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) + MCFG_MSX_MATSUSHITA_TURBO_CB(WRITELINE(msx_state, turbo_w)) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Panasonic FS-A1WX */ + +ROM_START (fsa1wx) + ROM_REGION (0x21c000, "maincpu",0) + ROM_LOAD ("a1wxbios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) + ROM_LOAD ("a1wxext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("a1wxdisk.rom", 0xc000, 0x4000, CRC(2bda0184) SHA1(2a0d228afde36ac7c5d3c2aac9c7c664dd071a8c)) + ROM_LOAD ("a1wxkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) + ROM_LOAD ("a1wxmusp.rom", 0x18000, 0x4000, CRC(456e494e) SHA1(6354ccc5c100b1c558c9395fa8c00784d2e9b0a3)) + ROM_LOAD ("a1wxfirm.rom", 0x1c000, 0x200000, CRC(283f3250) SHA1(d37ab4bd2bfddd8c97476cbe7347ae581a6f2972)) + + ROM_REGION(0x40000, "kanji", 0) + ROM_LOAD ("a1wxkfn.rom", 0, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1wx, msx2p ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots + // FM built-in + // MSX Engine T9769A + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_PANASONIC08("firm", 3, 3, 0, 4, "maincpu", 0x1c000) + + MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) + MCFG_MSX_MATSUSHITA_TURBO_CB(WRITELINE(msx_state, turbo_w)) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Panasonic FS-A1WX (a) */ +ROM_START (fsa1wxa) + ROM_REGION (0x21c000, "maincpu",0) + ROM_LOAD ("a1wxbios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) + ROM_LOAD ("a1wxext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("a1wxdisk.rom", 0xc000, 0x4000, CRC(2bda0184) SHA1(2a0d228afde36ac7c5d3c2aac9c7c664dd071a8c)) + ROM_LOAD ("a1wxkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) + ROM_LOAD ("a1wxmusp.rom", 0x18000, 0x4000, CRC(456e494e) SHA1(6354ccc5c100b1c558c9395fa8c00784d2e9b0a3)) + ROM_LOAD ("a1wxfira.rom", 0x1c000, 0x200000, CRC(58440a8e) SHA1(8e0d4a77e7d5736e8225c2df4701509363eb230f)) + + ROM_REGION(0x40000, "kanji", 0) + ROM_LOAD ("a1wxkfn.rom", 0, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1wxa, msx2p ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots? + // FM built-in + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_PANASONIC08("firm", 3, 3, 0, 4, "maincpu", 0x1c000) + + MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) + MCFG_MSX_MATSUSHITA_TURBO_CB(WRITELINE(msx_state, turbo_w)) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Sanyo Wavy PHC-35J */ + +ROM_START (phc35j) + ROM_REGION (0x14000, "maincpu",0) + ROM_LOAD ("35jbios.rom", 0x0000, 0x8000, CRC(358ec547) SHA1(f4433752d3bf876bfefb363c749d4d2e08a218b6)) + ROM_LOAD ("35jext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("35jkdr.rom", 0xc000, 0x8000, CRC(b4fc574d) SHA1(dcc3a67732aa01c4f2ee8d1ad886444a4dbafe06)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("35jkfn.rom", 0, 0x20000, CRC(c9651b32) SHA1(84a645becec0a25d3ab7a909cde1b242699a8662)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc35j, msx2p ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0xc000) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Sanyo Wavy PHC-70FD1 */ + +ROM_START (phc70fd) + ROM_REGION (0x20000, "maincpu",0) + ROM_LOAD ("70fdbios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) + ROM_LOAD ("70fdext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("70fddisk.rom", 0xc000, 0x4000, CRC(db7f1125) SHA1(9efa744be8355675e7bfdd3976bbbfaf85d62e1d)) + ROM_LOAD ("70fdkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) + ROM_LOAD ("70fdmus.rom", 0x18000, 0x4000, CRC(5c32eb29) SHA1(aad42ba4289b33d8eed225d42cea930b7fc5c228)) + ROM_LOAD ("70fdbas.rom", 0x1c000, 0x4000, CRC(da7be246) SHA1(22b3191d865010264001b9d896186a9818478a6b)) + + ROM_REGION(0x20000, "kanji", 0) + ROM_LOAD ("70fdkfn.rom", 0, 0x20000, CRC(c9651b32) SHA1(84a645becec0a25d3ab7a909cde1b242699a8662)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc70fd, msx2p ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots + // FM built-in + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_MUSIC("mus", 3, 3, 1, 1, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_ROM("bas", 3, 3, 2, 1, "maincpu", 0x1c000) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Sanyo Wavy PHC-70FD2 */ +ROM_START (phc70fd2) + ROM_REGION (0x20000, "maincpu",0) + ROM_LOAD ("70f2bios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) + ROM_LOAD ("70f2ext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("70f2disk.rom", 0xc000, 0x4000, CRC(db7f1125) SHA1(9efa744be8355675e7bfdd3976bbbfaf85d62e1d)) + ROM_LOAD ("70f2kdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) + ROM_LOAD ("70f2mus.rom", 0x18000, 0x4000, CRC(5c32eb29) SHA1(aad42ba4289b33d8eed225d42cea930b7fc5c228)) + ROM_LOAD ("70f2bas.rom", 0x1c000, 0x4000, CRC(da7be246) SHA1(22b3191d865010264001b9d896186a9818478a6b)) + + ROM_REGION(0x40000, "kanji", 0) + ROM_LOAD ("70f2kfn.rom", 0, 0x40000, CRC(9a850db9) SHA1(bcdb4dae303dfe5234f372d70a5e0271d3202c36)) +ROM_END + +static MACHINE_CONFIG_DERIVED( phc70fd2, msx2p ) + // AY8910/YM2149? + // FDC: tc8566af, 2 3.5" DSDD drives + // 2 Cartridge slots + // FM built-in + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_MUSIC("mus", 3, 3, 1, 1, "maincpu", 0x18000) + MCFG_MSX_LAYOUT_ROM("bas", 3, 3, 2, 1, "maincpu", 0x1c000) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Sony HB-F1XDJ */ + +ROM_START (hbf1xdj) + ROM_REGION (0x11c000, "maincpu",0) + ROM_LOAD ("f1xjbios.rom", 0x0000, 0x8000, CRC(00870134) SHA1(e2fbd56e42da637609d23ae9df9efd1b4241b18a)) + ROM_LOAD ("f1xjext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("f1xjdisk.rom", 0xc000, 0x4000, CRC(a21f5266) SHA1(c1bb307a570ab833e3bfcc4a58a4f4e12dc1df0f)) + ROM_LOAD ("f1xjkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) + ROM_LOAD ("f1xjmus.rom", 0x18000, 0x4000, CRC(5c32eb29) SHA1(aad42ba4289b33d8eed225d42cea930b7fc5c228)) + ROM_LOAD ("f1xjfirm.rom", 0x1c000, 0x100000, CRC(77be583f) SHA1(ade0c5ba5574f8114d7079050317099b4519e88f)) + + ROM_REGION(0x40000, "kanji", 0) + ROM_LOAD ("f1xjkfn.rom", 0, 0x40000, CRC(7016dfd0) SHA1(218d91eb6df2823c924d3774a9f455492a10aecb)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf1xdj, msx2p ) + // YM2149 (in S-1985 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drive + // 2 Cartridge slots + // FM built-in + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_SONY08("firm", 0, 3, 0, 4, "maincpu", 0x1c000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_MUSIC("mus", 3, 3, 1, 1, "maincpu", 0x18000) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Sony HB-F1XV */ + +ROM_START (hbf1xv) + ROM_REGION (0x11c000, "maincpu",0) + ROM_LOAD ("f1xvbios.rom", 0x0000, 0x8000, CRC(2c7ed27b) SHA1(174c9254f09d99361ff7607630248ff9d7d8d4d6)) + ROM_LOAD ("f1xvext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("f1xvdisk.rom", 0xc000, 0x4000, CRC(04e4e533) SHA1(5a4e7dbbfb759109c7d2a3b38bda9c60bf6ffef5)) + ROM_LOAD ("f1xvkdr.rom", 0x10000, 0x8000, CRC(b4fc574d) SHA1(dcc3a67732aa01c4f2ee8d1ad886444a4dbafe06)) + ROM_LOAD ("f1xvmus.rom", 0x18000, 0x4000, CRC(5c32eb29) SHA1(aad42ba4289b33d8eed225d42cea930b7fc5c228)) + ROM_LOAD ("f1xvfirm.rom", 0x1c000, 0x100000, CRC(77be583f) SHA1(ade0c5ba5574f8114d7079050317099b4519e88f)) + + ROM_REGION(0x40000, "kanji", 0) + ROM_LOAD ("f1xvkfn.rom", 0, 0x40000, CRC(7016dfd0) SHA1(218d91eb6df2823c924d3774a9f455492a10aecb)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf1xv, msx2p ) + // YM2149 (in S-1985 MSX Engine) + // FDC: wd2793, 1 3.5" DSDD drives + // 2 Cartridge slots + // FM built-in + // S-1985 MSX Engine + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_SONY08("firm", 0, 3, 0, 4, "maincpu", 0x1c000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ + MCFG_MSX_RAMIO_SET_BITS(0x80) + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_MUSIC("mus", 3, 3, 1, 1, "maincpu", 0x18000) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) + + MCFG_MSX_S1985_ADD("s1985") + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_wd2793 ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msx2p_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX2+ - Sony HB-F9S+ */ + +ROM_START (hbf9sp) + ROM_REGION (0x18000, "maincpu", 0) + ROM_LOAD ("f9spbios.rom", 0x0000, 0x8000, CRC(994d3a80) SHA1(03556d380a9bd413faf1b9e3cbd7da47c7238775)) + ROM_LOAD ("f9spext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) + ROM_LOAD ("f9psfrm1.rom", 0xc000, 0x4000, CRC(43d4cef1) SHA1(8948704bad9ff27873fa9ccd0ef89868e2bd6479)) + ROM_LOAD ("f9spfrm2.rom", 0x10000, 0x8000, CRC(ea97069f) SHA1(2d1880d1f5a6944fcb1b198b997a3d90ecd1903d)) +ROM_END + +static MACHINE_CONFIG_DERIVED( hbf9sp, msx2p ) + // AY8910/YM2149? + // FDC: None, 0 drives + // 2 Cartridge slots? + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("firm1", 3, 0, 1, 1, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("firm2", 3, 1, 1, 2, "maincpu", 0x10000) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB?? Mapper RAM */ + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX Turbo-R - Panasonic FS-A1GT */ + +ROM_START (fsa1gt) + ROM_REGION (0x46c000, "maincpu", 0) + ROM_LOAD ("a1gtbios.rom", 0x0000, 0x8000, CRC(937c8dbb) SHA1(242e73d8284a012b275c0a266844ebbc4269d787)) + ROM_LOAD ("a1gtext.rom", 0x8000, 0x4000, CRC(70aea0fe) SHA1(018d7a5222f28514908fb1b1513286a6558a6d05)) + ROM_LOAD ("a1gtdos.rom", 0xc000, 0x10000, CRC(bb2a0eae) SHA1(4880bf34f1c86fff5456ec2b4cf70d02339e2caa)) + ROM_LOAD ("a1gtkdr.rom", 0x1c000, 0x8000, CRC(eaf0d125) SHA1(5b39c1ccd3a213b78e02927f56a9abc72cd8c28d)) + ROM_LOAD ("a1gtmus.rom", 0x24000, 0x4000, CRC(f5f93437) SHA1(6aea1aef5ec31c1826c22edf580525f93baad425)) + ROM_LOAD ("a1gtopt.rom", 0x28000, 0x4000, CRC(50d11f60) SHA1(b4433a3975c57dd440d6bf12dbd28b2ac1b90ef4)) + ROM_LOAD ("a1gtkfn.rom", 0x2c000, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) + ROM_LOAD ("a1gtfirm.rom", 0x6c000, 0x400000, CRC(feefeadc) SHA1(e779c338eb91a7dea3ff75f3fde76b8af22c4a3a)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1gt, msx2 ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots + // FM built-in + // MIDI + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x24000) + MCFG_MSX_LAYOUT_ROM("opt", 0, 3, 1, 1, "maincpu", 0x28000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB?? Mapper RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x1c000) + MCFG_MSX_LAYOUT_DISK4("dos", 3, 2, 1, 3, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("firm", 3, 3, 0, 4, "maincpu", 0x6c000) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msxr_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + +/* MSX Turbo-R - Panasonic FS-A1ST */ + +ROM_START (fsa1st) + ROM_REGION (0x46c000, "maincpu", 0) + ROM_LOAD ("a1stbios.rom", 0x0000, 0x8000, CRC(77b94ae0) SHA1(f078b5ec56884bfb81481d45c7151418770bff5a)) + ROM_LOAD ("a1stext.rom", 0x8000, 0x4000, CRC(2c2c77a4) SHA1(373412f9c32762de1c3a7e27fc3d80614e0a0c8e)) + ROM_LOAD ("a1stdos.rom", 0xc000, 0x10000, CRC(1fc71407) SHA1(5d2186658adcf4ce0c2d3232384b5712341108e5)) + ROM_LOAD ("a1stkdr.rom", 0x1c000, 0x8000, CRC(eaf0d125) SHA1(5b39c1ccd3a213b78e02927f56a9abc72cd8c28d)) + ROM_LOAD ("a1stmus.rom", 0x24000, 0x4000, CRC(fd7dec41) SHA1(e002a9b426732e6c2d31e548c40cf7c122348ce3)) + ROM_LOAD ("a1stopt.rom", 0x28000, 0x4000, CRC(c6a4a2a1) SHA1(cb06dea7b025745f9d2b87dcf03ded615287ead3)) + ROM_LOAD ("a1stkfn.rom", 0x2c000, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) + ROM_LOAD ("a1stfirm.rom", 0x6c000, 0x400000, CRC(139ac99c) SHA1(c212b11fda13f83dafed688c54d098e7e47ab225)) +ROM_END + +static MACHINE_CONFIG_DERIVED( fsa1st, msx2 ) + // AY8910/YM2149? + // FDC: tc8566af, 1 3.5" DSDD drive + // 2 Cartridge slots + // FM built-in + + MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) + MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x24000) + MCFG_MSX_LAYOUT_ROM("opt", 0, 3, 1, 1, "maincpu", 0x28000) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) + MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) + MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB?? Mapper RAM */ + MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) + MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x1c000) + MCFG_MSX_LAYOUT_DISK4("dos", 3, 2, 1, 3, "maincpu", 0xc000) + MCFG_MSX_LAYOUT_ROM("firm", 3, 3, 0, 4, "maincpu", 0x6c000) + + MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) + + MCFG_FRAGMENT_ADD( msx_ym2413 ) + + MCFG_FRAGMENT_ADD( msx_tc8566af ) + MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) + MCFG_FRAGMENT_ADD( msxr_floplist ) + + MCFG_FRAGMENT_ADD( msx2_cartlist ) +MACHINE_CONFIG_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +/* MSX1 */ +COMP(1986, ax150, 0, 0, ax150, msx, driver_device, 0, "Al Alamiah", "AX-150 (Arabic) (MSX1)", 0) +COMP(1986, ax170, 0, 0, ax170, msx, driver_device, 0, "Al Alamiah", "AX-170 (Arabic) (MSX1)", 0) +COMP(1983, canonv8, 0, 0, canonv8, msx, driver_device, 0, "Canon", "V-8 (MSX1)", 0) +COMP(1983, canonv10, canonv20, 0, canonv10, msx, driver_device, 0, "Canon", "V-10 (MSX1)", 0) +COMP(1983, canonv20, 0, 0, canonv20, msx, driver_device, 0, "Canon", "V-20 (MSX1)", 0) +COMP(1983, canonv20e, canonv20, 0, canonv20, msx, driver_device, 0, "Canon", "V-20E (MSX1)", 0) // Different Euro keyboard layout? +COMP(1983, canonv20f, canonv20, 0, canonv20, msx, driver_device, 0, "Canon", "V-20F (MSX1)", 0) // Different French keyboard layout? +COMP(1983, canonv20g, canonv20, 0, canonv20, msx, driver_device, 0, "Canon", "V-20G (MSX1)", 0) // Different German keyboard layout? +COMP(1983, canonv20s, canonv20, 0, canonv20, msx, driver_device, 0, "Canon", "V-20S (MSX1)", 0) // Different Spanish keyboard layout? +COMP(1984, mx10, 0, 0, mx10, msx, driver_device, 0, "Casio", "MX-10 (MSX1)", 0) +COMP(1984, mx101, mx10, 0, mx101, msx, driver_device, 0, "Casio", "MX-101 (MSX1)", 0) +COMP(1984, mx15, mx10, 0, mx15, msx, driver_device, 0, "Casio", "MX-15 (MSX1)", 0) +COMP(1984, pv7, 0, 0, pv7, msx, driver_device, 0, "Casio", "PV-7 (MSX1)", 0) +COMP(1984, pv16, 0, 0, pv16, msx, driver_device, 0, "Casio", "PV-16 (MSX1)", 0) +COMP(198?, cpc88, 0, 0, cpc88, msxkr, driver_device, 0, "Daewoo", "CPC-88 (Korea) (MSX1)", 0) +COMP(1984, dpc100, dpc200, 0, dpc100, msxkr, driver_device, 0, "Daewoo", "IQ-1000 DPC-100 (Korea) (MSX1)", 0) +COMP(1984, dpc180, dpc200, 0, dpc180, msxkr, driver_device, 0, "Daewoo", "IQ-1000 DPC-180 (Korea) (MSX1)", 0) +COMP(1984, dpc200, 0, 0, dpc200, msxkr, driver_device, 0, "Daewoo", "IQ-1000 DPC-200 (Korea) (MSX1)", 0) +COMP(1985, dpc200e, 0, 0, dpc200e, msx, driver_device, 0, "Daewoo", "DPC-200E (MSX1)", 0) +COMP(1983, cpc50a, cpc51, 0, cpc50a, msxkr, driver_device, 0, "Daewoo", "Zemmix CPC-50A (Korea) (MSX1)", 0) +COMP(1983, cpc50b, cpc51, 0, cpc50b, msxkr, driver_device, 0, "Daewoo", "Zemmix CPC-50B (Korea) (MSX1)", 0) +COMP(1986, cpc51, 0, 0, cpc51, msxkr, driver_device, 0, "Daewoo", "Zemmix CPC-51 (Korea) (MSX1)", 0) +COMP(1983, fdpc200, 0, 0, fdpc200, msx, driver_device, 0, "Fenner", "DPC-200 (MSX1) ", 0) +COMP(1984, fpc500, 0, 0, fpc500, msx, driver_device, 0, "Fenner", "FPC-500 (MSX1)", 0) +COMP(1986, fspc800, 0, 0, fspc800, msx, driver_device, 0, "Fenner", "SPC-800 (MSX1) ", 0) +COMP(1984, bruc100, 0, 0, bruc100, msx, driver_device, 0, "Frael", "Bruc 100-1 (MSX1)", 0) +COMP(1983, fmx, 0, 0, fmx, msxjp, driver_device, 0, "Fujitsu", "FM-X (MSX1)", 0) +COMP(1984, gsfc80u, 0, 0, gsfc80u, msxkr, driver_device, 0, "Goldstar", "FC-80U (MSX1)", 0) +COMP(1983, gsfc200, 0, 0, gsfc200, msx, driver_device, 0, "Goldstar", "FC-200 (MSX1)", 0) +COMP(198?, gfc1080, 0, 0, gfc1080, msxkr, driver_device, 0, "Goldstar", "GFC-1080 (MSX1)", 0) +COMP(198?, gfc1080a, 0, 0, gfc1080a, msxkr, driver_device, 0, "Goldstar", "GFC-1080A (MSX1)", 0) +COMP(1983, expert10, expert13, 0, expert10, expert10, driver_device, 0, "Gradiente", "Expert 1.0 (Brazil) (MSX1)", 0) +COMP(1984, expert11, expert13, 0, expert11, expert11, driver_device, 0, "Gradiente", "Expert 1.1 (Brazil) (MSX1)", 0) +COMP(1984, expert13, 0, 0, expert13, expert11, driver_device, 0, "Gradiente", "Expert 1.3 (Brazil) (MSX1)", 0) +COMP(1985, expertdp, 0, 0, expertdp, expert11, driver_device, 0, "Gradiente", "Expert DDPlus (Brazil) (MSX1)", 0) +COMP(1984, expertpl, 0, 0, expertpl, expert11, driver_device, 0, "Gradiente", "Expert Plus (Brazil) (MSX1)", 0) +COMP(1984, mbh2, 0, 0, mbh2, msxjp, driver_device, 0, "Hitachi", "MB-H2 (MSX1)", 0) +COMP(1984, mbh25, 0, 0, mbh25, msxjp, driver_device, 0, "Hitachi", "MB-H25 (MSX1)", 0) +COMP(1983, mbh50, 0, 0, mbh50, msxjp, driver_device, 0, "Hitachi", "MB-H50 (MSX1)", 0) +COMP(1983, jvchc7gb, 0, 0, jvchc7gb, msx, driver_device, 0, "JVC", "HC-7GB (MSX1)", 0) +COMP(198?, mlf48, 0, 0, mlf48, msx, driver_device, 0, "Mitsubishi", "ML-F48 (MSX1)", 0) +COMP(1983, mlf80, 0, 0, mlf80, msx, driver_device, 0, "Mitsubishi", "ML-F80 (MSX1)", 0) +COMP(1984, mlf110, 0, 0, mlf110, msxjp, driver_device, 0, "Mitsubishi", "ML-F110 (MSX1)", 0) +COMP(1984, mlf120, 0, 0, mlf120, msxjp, driver_device, 0, "Mitsubishi", "ML-F120 (MSX1)", 0) +COMP(1983, mlfx1, 0, 0, mlfx1, msx, driver_device, 0, "Mitsubishi", "ML-FX1 (MSX1)", 0) +COMP(1984, cf1200, 0, 0, cf1200, msxjp, driver_device, 0, "National / Matsushita", "CF-1200 (Japan) (MSX1)", 0) +COMP(1983, cf2000, 0, 0, cf2000, msxjp, driver_device, 0, "National / Matsushita", "CF-2000 (Japan) (MSX1)", 0) +COMP(1984, cf2700, 0, 0, cf2700, msxjp, driver_device, 0, "National / Matsushita", "CF-2700 (Japan) (MSX1)", 0) +COMP(1984, cf3000, 0, 0, cf3000, msxjp, driver_device, 0, "National / Matsushita", "CF-3000 (Japan) (MSX1)", 0) +COMP(1985, cf3300, 0, 0, cf3300, msxjp, driver_device, 0, "National / Matsushita", "CF-3300 (Japan) (MSX1)", 0) +COMP(1985, fs1300, 0, 0, fs1300, msxjp, driver_device, 0, "National / Matsushita", "FS-1300 (Japan) (MSX1)", 0) +COMP(1985, fs4000, 0, 0, fs4000, msxjp, driver_device, 0, "National / Matsushita", "FS-4000 (Japan) (MSX1)", 0) +COMP(1985, fs4000a, fs4000, 0, fs4000a, msxjp, driver_device, 0, "National / Matsushita", "FS-4000 (alt) (Japan) (MSX1)", 0) +COMP(1983, phc2, 0, 0, phc2, msx, driver_device, 0, "Olympia", "PHC-2 (MSX1)" , 0) +COMP(19??, phc28, 0, 0, phc28, msx, driver_device, 0, "Olympia", "PHC-28 (MSX1)", 0) +COMP(1984, cf2700g, 0, 0, cf2700g, msx, driver_device, 0, "Panasonic", "CF-2700G (Germany) (MSX1)", 0) +COMP(198?, perfect1, 0, 0, perfect1, msx, driver_device, 0, "Perfect", "Perfect1 (MSX1)", MACHINE_NOT_WORKING) +COMP(1983, nms801, 0, 0, nms801, msx, driver_device, 0, "Philips", "NMS-801 (MSX1)", 0) +COMP(1984, vg8000, vg8010, 0, vg8000, msx, driver_device, 0, "Philips", "VG-8000 (MSX1)", 0) +COMP(1984, vg8010, 0, 0, vg8010, msx, driver_device, 0, "Philips", "VG-8010 (MSX1)", 0) +COMP(1984, vg8010f, vg8010, 0, vg8010f, msx, driver_device, 0, "Philips", "VG-8010F (MSX1)" , 0) +COMP(1985, vg802000, vg802020, 0, vg802000, msx, driver_device, 0, "Philips", "VG-8020-00 (MSX1)", 0) +COMP(1985, vg802020, 0, 0, vg802020, msx, driver_device, 0, "Philips", "VG-8020-20 (MSX1)", 0) +COMP(19??, vg8020f, vg802020, 0, vg8020f, msx, driver_device, 0, "Philips", "VG-8020F (MSX1)", 0) +COMP(1985, piopx7, 0, 0, piopx7, msx, driver_device, 0, "Pioneer", "PX-07 Palcom (MSX1)", 0) +COMP(1985, piopx7uk, piopx7, 0, piopx7uk, msx, driver_device, 0, "Pioneer", "PX-07UK Palcom (MSX1)", 0) +COMP(1984, piopxv60, piopx7, 0, piopxv60, msxjp, driver_device, 0, "Pioneer", "PX-V60 (MSX1)", 0) +COMP(19??, spc800, 0, 0, spc800, msx, driver_device, 0, "Samsung", "SPC-800 (MSX1)", 0) +COMP(1985, mpc64, 0, 0, mpc64, msxjp, driver_device, 0, "Sanyo", "MPC-64 (MSX1)", 0) +COMP(1985, mpc100, 0, 0, mpc100, msx, driver_device, 0, "Sanyo", "MPC-100 (MSX1)", 0) +COMP(1983, mpc200, 0, 0, mpc200, msx, driver_device, 0, "Sanyo", "MPC-200 (MSX1)", 0) +COMP(1983, mpc200sp, mpc200, 0, mpc200sp, msx, driver_device, 0, "Sanyo", "MPC-200SP (MSX1)", 0) // Spanish keyboard? +COMP(1983, phc28l, 0, 0, phc28l, msx, driver_device, 0, "Sanyo", "PHC-28L (MSX1)", 0) +COMP(1983, phc28s, 0, 0, phc28s, msx, driver_device, 0, "Sanyo", "PHC-28S (MSX1)", 0) +COMP(19??, mpc10, 0, 0, mpc10, msx, driver_device, 0, "Sanyo", "Wavy MPC-10 (MSX1)", 0) +COMP(1985, hotbit11, hotbi13p, 0, hotbit11, hotbit, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 1.1 (MSX1)", 0) +COMP(1985, hotbit12, hotbi13p, 0, hotbit12, hotbit, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 1.2 (MSX1)", 0) +COMP(1985, hotbi13b, hotbi13p, 0, hotbi13b, hotbit, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 1.3b (MSX1)", 0) +COMP(1985, hotbi13p, 0, 0, hotbi13p, hotbit, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 1.3p (MSX1)", 0) +COMP(198?, hb10, hb10p, 0, hb10, msxjp, driver_device, 0, "Sony", "HB-10 (MSX1)", 0) +COMP(1985, hb10p, 0, 0, hb10p, msx, driver_device, 0, "Sony", "HB-10P (MSX1)", 0) +COMP(1984, hb101p, 0, 0, hb101p, msx, driver_device, 0, "Sony", "HB-101P (MSX1)", 0) +COMP(1985, hb20p, 0, 0, hb20p, msx, driver_device, 0, "Sony", "HB-20P (Spanish) (MSX1)", 0) +COMP(1985, hb201, hb201p, 0, hb201, msxjp, driver_device, 0, "Sony", "HB-201 (Japan) (MSX1)", 0) +COMP(1985, hb201p, 0, 0, hb201p, msx, driver_device, 0, "Sony", "HB-201P (MSX1)", 0) +COMP(1984, hb501p, 0, 0, hb501p, msx, driver_device, 0, "Sony", "HB-501P (MSX1)", 0) +COMP(1983, hb55, hb55p, 0, hb55, msxjp, driver_device, 0, "Sony", "HB-55 (MSX1)", 0) +COMP(1983, hb55d, hb55p, 0, hb55d, msx, driver_device, 0, "Sony", "HB-55D (Germany) (MSX1)", 0) +COMP(1983, hb55p, 0, 0, hb55p, msx, driver_device, 0, "Sony", "HB-55P (MSX1)", 0) +COMP(1984, hb701fd, 0, 0, hb701fd, msxjp, driver_device, 0, "Sony", "HB-701FD (MSX1)", 0) +COMP(1983, hb75d, hb75p, 0, hb75d, msx, driver_device, 0, "Sony", "HB-75D (Germany) (MSX1)", 0) +COMP(1983, hb75p, 0, 0, hb75p, msx, driver_device, 0, "Sony", "HB-75P (MSX1)", 0) +COMP(1985, svi728, 0, 0, svi728, msx, driver_device, 0, "Spectravideo", "SVI-728 (MSX1)", 0) +COMP(1985, svi738, 0, 0, svi738, msx, driver_device, 0, "Spectravideo", "SVI-738 (MSX1)", 0) +COMP(1983, svi738ar, svi738, 0, svi738ar, msx, driver_device, 0, "Spectravideo", "SVI-738 (Arabic) (MSX1)", 0) +COMP(1983, svi738dk, svi738, 0, svi738dk, msx, driver_device, 0, "Spectravideo", "SVI-738 (Denmark) (MSX1)", 0) +COMP(1983, svi738sp, svi738, 0, svi738sp, msx, driver_device, 0, "Spectravideo", "SVI-738 (Spain) (MSX1)", 0) +COMP(1983, svi738sw, svi738, 0, svi738sw, msx, driver_device, 0, "Spectravideo", "SVI-738 (Swedish) (MSX1)", 0) +COMP(1983, svi738pl, svi738, 0, svi738pl, msx, driver_device, 0, "Spectravideo", "SVI-738 (Poland) (MSX1)", 0) +COMP(1983, tadpc200, dpc200, 0, tadpc200, msx, driver_device, 0, "Talent", "DPC-200 (MSX1)", 0) +COMP(1983, tadpc20a, dpc200, 0, tadpc20a, msx, driver_device, 0, "Talent", "DPC-200A (MSX1)", 0) +COMP(1984, hx10, 0, 0, hx10, msx, driver_device, 0, "Toshiba", "HX-10 (MSX1)", 0) +COMP(1984, hx10d, hx10, 0, hx10d, msxjp, driver_device, 0, "Toshiba", "HX-10D (MSX1)", 0) +COMP(1984, hx10dp, hx10, 0, hx10dp, msxjp, driver_device, 0, "Toshiba", "HX-10DP (MSX1)", 0) +COMP(1984, hx10e, hx10, 0, hx10e, msx, driver_device, 0, "Toshiba", "HX-10E (MSX1)", 0) +COMP(1984, hx10f, hx10, 0, hx10f, msx, driver_device, 0, "Toshiba", "HX-10F (MSX1)", 0) +COMP(1984, hx10s, hx10, 0, hx10s, msx, driver_device, 0, "Toshiba", "HX-10S (MSX1)", 0) +COMP(1984, hx10sa, hx10, 0, hx10sa, msxjp, driver_device, 0, "Toshiba", "HX-10SA (MSX1)", 0) +COMP(1984, hx20, 0, 0, hx20, msx, driver_device, 0, "Toshiba", "HX-20 (MSX1)", 0) +COMP(1984, hx20i, hx20, 0, hx20i, msx, driver_device, 0, "Toshiba", "HX-20I (MSX1)", 0) +COMP(1984, hx21, 0, 0, hx21, msxjp, driver_device, 0, "Toshiba", "HX-21 (MSX1)", MACHINE_NOT_WORKING) // Does not go into firmware +COMP(1984, hx21i, hx21, 0, hx21i, msx, driver_device, 0, "Toshiba", "HX-21I (MSX1)", 0) +COMP(1984, hx22, 0, 0, hx22, msxjp, driver_device, 0, "Toshiba", "HX-22 (MSX1)", MACHINE_NOT_WORKING) // Does not go into firmware +COMP(1984, hx22i, hx22, 0, hx22i, msx, driver_device, 0, "Toshiba", "HX-22I (MSX1)", 0) +COMP(198?, hc5, hc7, 0, hc5, msxjp, driver_device, 0, "Victor", "HC-5 (MSX1)", 0) +COMP(198?, hc6, hc7, 0, hc6, msxjp, driver_device, 0, "Victor", "HC-6 (MSX1)", 0) +COMP(198?, hc7, 0, 0, hc7, msxjp, driver_device, 0, "Victor", "HC-7 (MSX1)", 0) +COMP(1984, cx5f1, cx5f, 0, cx5f1, msxjp, driver_device, 0, "Yamaha", "CX5F (w/SFG01) (MSX1)", 0) +COMP(1984, cx5f, 0, 0, cx5f, msxjp, driver_device, 0, "Yamaha", "CX5F (w/SFG05) (MSX1)", 0) +COMP(1984, cx5m, cx5m128, 0, cx5m, msx, driver_device, 0, "Yamaha", "CX5M (MSX1)", 0) +COMP(1984, cx5m128, 0, 0, cx5m128, msx, driver_device, 0, "Yamaha", "CX5M-128 (MSX1)", 0) +COMP(1984, cx5m2, cx5m128, 0, cx5m2, msx, driver_device, 0, "Yamaha", "CX5MII (MSX1)", 0) +COMP(1984, yis303, 0, 0, yis303, msx, driver_device, 0, "Yamaha", "YIS303 (MSX1)", 0) +COMP(1984, yis503, 0, 0, yis503, msx, driver_device, 0, "Yamaha", "YIS503 (MSX1)", 0) +COMP(19??, yis503f, yis503, 0, yis503f, msx, driver_device, 0, "Yamaha", "YIS503F (MSX1)", 0) +COMP(1984, yis503ii, yis503, 0, yis503ii, msx, driver_device, 0, "Yamaha", "YIS503II (MSX1)", 0) +COMP(1986, y503iir, yis503, 0, y503iir, msx, driver_device, 0, "Yamaha", "YIS503IIR (Russian) (MSX1)", 0) +COMP(1986, y503iir2, yis503, 0, y503iir2, msx, driver_device, 0, "Yamaha", "YIS503IIR (Estonian) (MSX1)", 0) +COMP(1984, yis503m, yis503, 0, yis503m, msx, driver_device, 0, "Yamaha", "YIS503M (MSX1)", 0) +COMP(1984, yc64, 0, 0, yc64, msx, driver_device, 0, "Yashica", "YC-64 (MSX1)", 0) +COMP(1984, mx64, 0, 0, mx64, msxkr, driver_device, 0, "Yeno", "MX64 (MSX1)", 0) + +/* MSX2 */ +COMP(1986, ax350, 0, 0, ax350, msx2, driver_device, 0, "Al Alamiah", "AX-350 (Arabic) (MSX2)", 0) +COMP(1986, ax370, 0, 0, ax370, msx2, driver_device, 0, "Al Alamiah", "AX-370 (Arabic) (MSX2)", 0) +COMP(1985, canonv25, 0, 0, canonv25, msx2, driver_device, 0, "Canon", "V-25 (MSX2)", 0) +COMP(1985, canonv30, 0, 0, canonv30, msx2, driver_device, 0, "Canon", "V-30 (MSX2)", 0) +COMP(1985, canonv30f, canonv30, 0, canonv30f, msx2, driver_device, 0, "Canon", "V-30F (MSX2)", 0) +COMP(1986, cpc300, 0, 0, cpc300, msx2kr, driver_device, 0, "Daewoo", "IQ-2000 CPC-300 (Korea) (MSX2)", 0) +COMP(1986, cpc300e, 0, 0, cpc300e, msx2kr, driver_device, 0, "Daewoo", "IQ-2000 CPC-300E (Korea) (MSX2)", 0) +COMP(1985, cpc330k, 0, 0, cpc330k, msx2kr, driver_device, 0, "Daewoo", "CPC-330K KOBO (Korea) (MSX2)", 0) +COMP(1988, cpc400, 0, 0, cpc400, msx2kr, driver_device, 0, "Daewoo", "X-II CPC-400 (Korea) (MSX2)", 0) +COMP(1988, cpc400s, 0, 0, cpc400s, msx2kr, driver_device, 0, "Daewoo", "X-II CPC-400S (Korea) (MSX2)", 0) +COMP(1990, cpc61, 0, 0, cpc61, msx2kr, driver_device, 0, "Daewoo", "Zemmix CPC-61 (Korea) (MSX2)", 0) +COMP(1991, cpg120, 0, 0, cpg120, msx2kr, driver_device, 0, "Daewoo", "Zemmix CPG-120 Normal (Korea) (MSX2)", MACHINE_NOT_WORKING) // v9958 not added +COMP(198?, fpc900, 0, 0, fpc900, msx2, driver_device, 0, "Fenner", "FPC-900 (MSX2)", 0) +COMP(1986, expert20, 0, 0, expert20, msx2, driver_device, 0, "Gradiente", "Expert 2.0 (Brazil) (MSX2)", 0) +COMP(198?, mbh70, 0, 0, mbh70, msx2jp, driver_device, 0, "Hitachi", "MB-H70 (MSX2)", MACHINE_NOT_WORKING) // Firmware not working +COMP(1987, kmc5000, 0, 0, kmc5000, msx2jp, driver_device, 0, "Kawai", "KMC-5000 (MSX2)", 0) +COMP(1985, mlg1, 0, 0, mlg1, msx2, driver_device, 0, "Mitsubishi", "ML-G1 (MSX2)", 0) +COMP(198?, mlg3, 0, 0, mlg3, msx2, driver_device, 0, "Mitsubishi", "ML-G3 (MSX2)", 0) +COMP(1985, mlg10, 0, 0, mlg10, msx2jp, driver_device, 0, "Mitsubishi", "ML-G10 (MSX2)", 0) +COMP(1983, mlg30, 0, 0, mlg30, msx2, driver_device, 0, "Mitsubishi", "ML-G30 (MSX2)", 0) +COMP(1985, fs5500f1, fs5500f2, 0, fs5500f1, msx2jp, driver_device, 0, "National / Matsushita", "FS-5500F1 (Japan) (MSX2)", 0) +COMP(1985, fs5500f2, 0, 0, fs5500f2, msx2jp, driver_device, 0, "National / Matsushita", "FS-5500F2 (Japan) (MSX2)", 0) +COMP(1986, fs4500, 0, 0, fs4500, msx2jp, driver_device, 0, "National / Matsushita", "FS-4500 (Japan) (MSX2)", 0) +COMP(1986, fs4700, 0, 0, fs4700, msx2jp, driver_device, 0, "National / Matsushita", "FS-4700 (Japan) (MSX2)", 0) +COMP(1986, fs5000, 0, 0, fs5000, msx2jp, driver_device, 0, "National / Matsushita", "FS-5000F2 (Japan) (MSX2)", 0) +COMP(1986, fs4600, 0, 0, fs4600, msx2jp, driver_device, 0, "National / Matsushita", "FS-4600 (Japan) (MSX2)", 0) +COMP(1986, fsa1, fsa1a, 0, fsa1, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1 / 1st released version (Japan) (MSX2)", 0) +COMP(1986, fsa1a, 0, 0, fsa1a, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1 / 2nd released version (Japan) (MSX2)", 0) +COMP(1987, fsa1mk2, 0, 0, fsa1mk2, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1MK2 (Japan) (MSX2)", 0) +COMP(1987, fsa1f, 0, 0, fsa1f, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1F (Japan) (MSX2)", 0) +COMP(1987, fsa1fm, 0, 0, fsa1fm, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1FM (Japan) (MSX2)", 0) +COMP(1986, nms8220, nms8220a, 0, nms8220, msx2, driver_device, 0, "Philips", "NMS-8220 (12-jun-1986) (MSX2)", 0) +COMP(1986, nms8220a, 0, 0, nms8220a, msx2, driver_device, 0, "Philips", "NMS-8220 (13-aug-1986) (MSX2)", 0) +COMP(1986, vg8230, 0, 0, vg8230, msx2, driver_device, 0, "Philips", "VG-8230 (MSX2)", 0) +COMP(19??, vg8230j, vg8230, 0, vg8230j, msx2jp, driver_device, 0, "Philips", "VG-8230J (MSX2)", MACHINE_NOT_WORKING) // Screen flashes a few times before going into basic +COMP(1986, vg8235, 0, 0, vg8235, msx2, driver_device, 0, "Philips", "VG-8235 (MSX2)", 0) +COMP(1986, vg8235f, vg8235, 0, vg8235f, msx2, driver_device, 0, "Philips", "VG-8235F (MSX2)", 0) +COMP(1986, vg8240, 0, 0, vg8240, msx2, driver_device, 0, "Philips", "VG-8240 (MSX2)", 0) +COMP(1986, nms8245, 0, 0, nms8245, msx2, driver_device, 0, "Philips", "NMS-8245 (MSX2)", 0) +COMP(1986, nms8245f, nms8245, 0, nms8245f, msx2, driver_device, 0, "Philips", "NMS-8245F (MSX2)", 0) +COMP(1986, nms8250, nms8255, 0, nms8250, msx2, driver_device, 0, "Philips", "NMS-8250 (MSX2)", 0) +COMP(1986, nms8250f, nms8255, 0, nms8250f, msx2, driver_device, 0, "Philips", "NMS-8250F (MSX2)", 0) // French keyboard +COMP(19??, nms8250j, nms8255, 0, nms8250j, msx2jp, driver_device, 0, "Philips", "NMS-8250J (MSX2)", 0) +COMP(1986, nms8255, 0, 0, nms8255, msx2, driver_device, 0, "Philips", "NMS-8255 (MSX2)", 0) +COMP(1986, nms8255f, nms8255, 0, nms8255f, msx2, driver_device, 0, "Philips", "NMS-8255F (MSX2)", 0) // French keyboard +COMP(1986, nms8260, 0, 0, nms8260, msx2, driver_device, 0, "Philips", "NMS-8260 (Prototype) (MSX2)", MACHINE_NOT_WORKING) +COMP(1986, nms8280, 0, 0, nms8280, msx2, driver_device, 0, "Philips", "NMS-8280 (MSX2)", 0) +COMP(1986, nms8280f, nms8280, 0, nms8280f, msx2, driver_device, 0, "Philips", "NMS-8280F (MSX2)", 0) // French keyboard +COMP(1986, nms8280g, nms8280, 0, nms8280g, msx2, driver_device, 0, "Philips", "NMS-8280G (MSX2)", 0) +COMP(19??, mpc2300, 0, 0, mpc2300, msx2, driver_device, 0, "Sanyo", "MPC-2300 (MSX2)", MACHINE_NOT_WORKING) // Keyboard responds differently +COMP(198?, mpc2500f, 0, 0, mpc2500f, msx2, driver_device, 0, "Sanyo", "MPC-2500FD (MSX2)", MACHINE_NOT_WORKING) // Russian keyboard? +COMP(19??, mpc25fd, 0, 0, mpc25fd, msx2, driver_device, 0, "Sanyo", "Wavy MPC-25FD (MSX2)", 0) +COMP(198?, mpc27, 0, 0, mpc27, msx2jp, driver_device, 0, "Sanyo", "Wavy MPC-27 (MSX2)", MACHINE_NOT_WORKING) // Light pen not emulated +COMP(1988, phc23, 0, 0, phc23, msx2jp, driver_device, 0, "Sanyo", "Wavy PHC-23 (Japan) (MSX2)", 0) +COMP(198?, phc55fd2, 0, 0, phc55fd2, msx2jp, driver_device, 0, "Sanyo", "Wavy PHC-55FD2 (MSX2)", 0) +COMP(198?, phc77, 0, 0, phc77, msx2jp, driver_device, 0, "Sanyo", "Wavy PHC-77 (MSX2)", MACHINE_NOT_WORKING) // Firmware not emulated +COMP(1986, hbf1, 0, 0, hbf1, msx2jp, driver_device, 0, "Sony", "HB-F1 (Japan) (MSX2)", MACHINE_NOT_WORKING ) // Screen stays a single color after a while +COMP(1987, hbf12, 0, 0, hbf12, msx2jp, driver_device, 0, "Sony", "HB-F1II (Japan) (MSX2)", MACHINE_NOT_WORKING ) // Screen stays a single color after a while +COMP(1987, hbf1xd, 0, 0, hbf1xd, msx2jp, driver_device, 0, "Sony", "HB-F1XD (Japan) (MSX2)", 0) +COMP(1988, hbf1xdm2, 0, 0, hbf1xdm2, msx2jp, driver_device, 0, "Sony", "HB-F1XDMK2 (Japan) (MSX2)", 0) +COMP(19??, hbf5, 0, 0, hbf5, msx2, driver_device, 0, "Sony", "HB-F5 (MSX2)", 0) +COMP(1985, hbf9p, 0, 0, hbf9p, msx2, driver_device, 0, "Sony", "HB-F9P (MSX2)", 0) +COMP(19??, hbf9pr, hbf9p, 0, hbf9pr, msx2, driver_device, 0, "Sony", "HB-F9P Russion (MSX2)", MACHINE_NOT_WORKING) // Keyboard responds differently +COMP(1985, hbf9s, hbf9p, 0, hbf9s, msx2, driver_device, 0, "Sony", "HB-F9S (MSX2)", 0) +COMP(1986, hbf500, hbf500p, 0, hbf500, msx2jp, driver_device, 0, "Sony", "HB-F500 (Japan) (MSX2)", 0) +COMP(198?, hbf500f, hbf500p, 0, hbf500f, msx2, driver_device, 0, "Sony", "HB-F500F (MSX2)", 0) // French keyboard? +COMP(1985, hbf500p, 0, 0, hbf500p, msx2, driver_device, 0, "Sony", "HB-F500P (MSX2)", 0) +COMP(1985, hbf700d, hbf700p, 0, hbf700d, msx2, driver_device, 0, "Sony", "HB-F700D (Germany) (MSX2)", 0) +COMP(1985, hbf700f, hbf700p, 0, hbf700f, msx2, driver_device, 0, "Sony", "HB-F700F (MSX2)", 0) +COMP(1985, hbf700p, 0, 0, hbf700p, msx2, driver_device, 0, "Sony", "HB-F700P (MSX2)", 0) +COMP(1985, hbf700s, hbf700p, 0, hbf700s, msx2, driver_device, 0, "Sony", "HB-F700S (Spain) (MSX2)", 0) +COMP(1986, hbf900, hbf900a, 0, hbf900, msx2jp, driver_device, 0, "Sony", "HB-F900 / 1st released version (Japan) (MSX2)", 0) +COMP(1986, hbf900a, 0, 0, hbf900a, msx2jp, driver_device, 0, "Sony", "HB-F900 / 2nd released version (Japan) (MSX2)", 0) +COMP(1986, hbg900ap, hbg900p, 0, hbg900ap, msx2, driver_device, 0, "Sony", "HB-G900AP (MSX2)", 0 ) +COMP(1986, hbg900p, 0, 0, hbg900p, msx2, driver_device, 0, "Sony", "HB-G900P (MSX2)", 0 ) +COMP(1986, hotbit20, 0, 0, hotbit20, msx2, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 2.0 (MSX2)", 0) // Black screen +COMP(1986, tpc310, 0, 0, tpc310, msx2, driver_device, 0, "Talent", "TPC-310 (MSX2)", 0) +COMP(19??, tpp311, 0, 0, tpp311, msx2, driver_device, 0, "Talent", "TPP-311 (MSX2)", 0) +COMP(19??, tps312, 0, 0, tps312, msx2, driver_device, 0, "Talent", "TPS-312 (MSX2)", 0) +COMP(1986, hx23, hx23i, 0, hx23, msx2, driver_device, 0, "Toshiba", "HX-23 (MSX2)", 0) +COMP(1986, hx23f, hx23i, 0, hx23f, msx2, driver_device, 0, "Toshiba", "HX-23F (MSX2)", 0) +COMP(190?, hx23i, 0, 0, hx23i, msx2, driver_device, 0, "Toshiba", "HX-23I (MSX2)", 0) +COMP(1985, hx33, 0, 0, hx33, msx2jp, driver_device, 0, "Toshiba", "HX-33 (MSX2)", 0) +COMP(1985, hx34, hx34i, 0, hx34, msx2jp, driver_device, 0, "Toshiba", "HX-34 (MSX2)", 0) +COMP(1985, hx34i, 0, 0, hx34i, msx, driver_device, 0, "Toshiba", "HX-34I (MSX2)", 0) +COMP(1985, fstm1, 0, 0, fstm1, msx, driver_device, 0, "Toshiba", "FS-TM1 (MSX2)", 0) +COMP(198?, victhc90, victhc95, 0, victhc90, msxjp, driver_device, 0, "Victor", "HC-90 (MSX2)", MACHINE_NOT_WORKING) // 2nd cpu/turbo not emulated, firmware won't start +COMP(1986, victhc95, 0, 0, victhc95, msxjp, driver_device, 0, "Victor", "HC-95 (MSX2)", MACHINE_NOT_WORKING) // 2nd cpu/turbo not emulated, firmware won't start +COMP(1986, victhc95a, victhc95, 0, victhc95a, msxjp, driver_device, 0, "Victor", "HC-95A (MSX2)", MACHINE_NOT_WORKING) // 2nd cpu/turbo not emulated, firmware won't start +COMP(1986, cx7m, cx7m128, 0, cx7m, msx2, driver_device, 0, "Yamaha", "CX7M (MSX2)", 0) +COMP(1986, cx7m128, 0, 0, cx7m128, msx2, driver_device, 0, "Yamaha", "CX7M/128 (MSX2)", 0) +COMP(198?, y503iiir, 0, 0, y503iiir, msx2, driver_device, 0, "Yamaha", "YIS-503 III R (Russian) (MSX2)", MACHINE_NOT_WORKING) // Russian keyboard, floppy support broken +COMP(198?, y503iiire, y503iiir, 0, y503iiire, msx2, driver_device, 0, "Yamaha", "YIS-503 III R (Estonian) (MSX2)", MACHINE_NOT_WORKING) // Russian/Estonian keyboard, floppy support broken +COMP(1985, yis60464, yis604, 0, yis60464, msx2jp, driver_device, 0, "Yamaha", "YIS604 (64KB) (MSX2)", 0) +COMP(1985, yis604, 0, 0, yis604, msx2jp, driver_device, 0, "Yamaha", "YIS604 (128KB) (MSX2)", 0) +COMP(198?, y805128, y805256, 0, y805128, msx2jp, driver_device, 0, "Yamaha", "YIS805/128 (Russian) (MSX2)", MACHINE_NOT_WORKING) // Floppy support broken +COMP(198?, y805128r2, y805256, 0, y805128r2, msx2jp, driver_device, 0, "Yamaha", "YIS805R2/128 (Russian) (MSX2)", MACHINE_NOT_WORKING) // Floppy support broken +COMP(198?, y805128r2e, y805256, 0, y805128r2e, msx2jp, driver_device, 0, "Yamaha", "YIS805R2/128 (Estonian) (MSX2)", MACHINE_NOT_WORKING) // Floppy support broken +COMP(198?, y805256, 0, 0, y805256, msx2jp, driver_device, 0, "Yamaha", "YIS805/256 (Russian) (MSX2)", MACHINE_NOT_WORKING) // Floppy support broken + +/* MSX2+ */ +COMP(19??, expert3i, 0, 0, expert3i, msx2, driver_device, 0, "Ciel", "Expert 3 IDE (MSX2+)", MACHINE_NOT_WORKING ) // Some hardware not emulated +COMP(1996, expert3t, 0, 0, expert3t, msx2, driver_device, 0, "Ciel", "Expert 3 Turbo (MSX2+)", MACHINE_NOT_WORKING ) // Some hardware not emulated +COMP(19??, expertac, 0, 0, expertac, msx2, driver_device, 0, "Gradiente", "Expert AC88+ (MSX2+)", MACHINE_NOT_WORKING ) // Some hardware not emulated +COMP(19??, expertdx, 0, 0, expertdx, msx2, driver_device, 0, "Gradiente", "Expert DDX+ (MSX2+)", MACHINE_NOT_WORKING ) // Some hardware not emulated +COMP(1988, fsa1fx, 0, 0, fsa1fx, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1FX (Japan) (MSX2+)", 0 ) +COMP(1988, fsa1wx, fsa1wxa, 0, fsa1wx, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1WX / 1st released version (Japan) (MSX2+)", 0 ) +COMP(1988, fsa1wxa, 0, 0, fsa1wxa, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1WX / 2nd released version (Japan) (MSX2+)", 0 ) +COMP(1989, fsa1wsx, 0, 0, fsa1wsx, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1WSX (Japan) (MSX2+)", 0 ) +COMP(1988, hbf1xdj, 0, 0, hbf1xdj, msx2jp, driver_device, 0, "Sony", "HB-F1XDJ (Japan) (MSX2+)", 0 ) +COMP(1989, hbf1xv, 0, 0, hbf1xv, msx2jp, driver_device, 0, "Sony", "HB-F1XV (Japan) (MSX2+)", 0 ) +COMP(1988, phc70fd, phc70fd2, 0, phc70fd, msx2jp, driver_device, 0, "Sanyo", "WAVY PHC-70FD (Japan) (MSX2+)", 0 ) +COMP(1988, phc70fd2, 0, 0, phc70fd2, msx2jp, driver_device, 0, "Sanyo", "WAVY PHC-70FD2 (Japan) (MSX2+)", 0 ) +COMP(1989, phc35j, 0, 0, phc35j, msx2jp, driver_device, 0, "Sanyo", "WAVY PHC-35J (Japan) (MSX2+)", 0) +COMP(19??, hbf9sp, 0, 0, hbf9sp, msx2jp, driver_device, 0, "Sony", "HB-F9S+ (MSX2+)", 0) + +/* MSX Turbo-R */ +/* Temporary placeholders, Turbo-R hardware is not supported yet */ +COMP(19??, fsa1gt, 0, 0, fsa1gt, msx2jp, driver_device, 0, "Panasonic", "FS-A1GT (MSX Turbo-R)", MACHINE_NOT_WORKING) +COMP(19??, fsa1st, 0, 0, fsa1st, msx2jp, driver_device, 0, "Panasonic", "FS-A1ST (MSX Turbo-R)", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/mt735.c b/src/mame/drivers/mt735.c new file mode 100644 index 00000000000..569f612d875 --- /dev/null +++ b/src/mame/drivers/mt735.c @@ -0,0 +1,71 @@ +/* + Brother MT735 thermal printer +*/ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" + +class mt735_state : public driver_device +{ +public: + mt735_state(const machine_config &mconfig, device_type type, const char *tag); + + required_device m_cpu; + + DECLARE_READ8_MEMBER(p4_r); + DECLARE_READ8_MEMBER(p5_r); + + virtual void machine_start(); + virtual void machine_reset(); +}; + +mt735_state::mt735_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_cpu(*this, "maincpu") +{ +} + +void mt735_state::machine_start() +{ +} + +void mt735_state::machine_reset() +{ +} + +READ8_MEMBER(mt735_state::p4_r) +{ + logerror("p4_r (%06x)\n", space.device().safe_pc()); + return 0xe0; +} + +READ8_MEMBER(mt735_state::p5_r) +{ + logerror("p5_r (%06x)\n", space.device().safe_pc()); + return 0x00; +} + +static ADDRESS_MAP_START( mt735_map, AS_PROGRAM, 16, mt735_state ) + AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x278000, 0x287fff) AM_RAM + AM_RANGE(0x400000, 0x4fffff) AM_RAM + AM_RANGE(0xff8004, 0xff8005) AM_READ8(p4_r, 0xff00) + AM_RANGE(0xff8004, 0xff8005) AM_READ8(p5_r, 0x00ff) +ADDRESS_MAP_END + +static INPUT_PORTS_START( mt735 ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( mt735, mt735_state ) + MCFG_CPU_ADD("maincpu", M68000, XTAL_48MHz/6) + MCFG_CPU_PROGRAM_MAP(mt735_map) +MACHINE_CONFIG_END + +ROM_START( mt735 ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "spg_m_e_ic103.bin", 0, 0x20000, CRC(1ab58bc9) SHA1(c10d50f38819c037d28435b77e09f2b6923e8369) ) + ROM_LOAD16_BYTE( "spg_m_o_ic102.bin", 1, 0x20000, CRC(84d8446b) SHA1(b1cedd8b09556eb8118f79b012aeec5b61e3ff32) ) +ROM_END + +COMP( ????, mt735, 0, 0, mt735, mt735, driver_device, 0, "Brother", "MT735", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/mtx.c b/src/mame/drivers/mtx.c new file mode 100644 index 00000000000..f6839299480 --- /dev/null +++ b/src/mame/drivers/mtx.c @@ -0,0 +1,444 @@ +// license:BSD-3-Clause +// copyright-holders:Lee Ward, Dirk Best, Curt Coder +/************************************************************************* + + Memotech MTX 500, MTX 512 and RS 128 + +**************************************************************************/ + +/* + + TODO: + + - cassette + - cartridges + - SDX/FDX floppy + - HDX hard disk + - HRX high resolution graphics + - CBM (all RAM) mode + - "Silicon" disks + - Multi Effect Video Wall + + */ + +#include "emu.h" +#include "includes/mtx.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "imagedev/snapquik.h" +#include "bus/centronics/ctronics.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "video/tms9928a.h" +#include "sound/sn76496.h" + +/*************************************************************************** + MEMORY MAPS +***************************************************************************/ + +/*------------------------------------------------- + ADDRESS_MAP( mtx_mem ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( mtx_mem, AS_PROGRAM, 8, mtx_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1") + AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank2") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank3") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank4") + AM_RANGE(0xc000, 0xffff) AM_RAM +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( mtx_io ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( mtx_io, AS_IO, 8, mtx_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READWRITE(mtx_strobe_r, mtx_bankswitch_w) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("tms9929a", tms9929a_device, vram_read, vram_write) + AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("tms9929a", tms9929a_device, register_read, register_write) + AM_RANGE(0x03, 0x03) AM_READWRITE(mtx_sound_strobe_r, mtx_cst_w) + AM_RANGE(0x04, 0x04) AM_READ(mtx_prt_r) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x05, 0x05) AM_READWRITE(mtx_key_lo_r, mtx_sense_w) + AM_RANGE(0x06, 0x06) AM_READWRITE(mtx_key_hi_r, mtx_sound_latch_w) +// AM_RANGE(0x07, 0x07) PIO + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x30, 0x31) AM_WRITE(hrx_address_w) + AM_RANGE(0x32, 0x32) AM_READWRITE(hrx_data_r, hrx_data_w) + AM_RANGE(0x33, 0x33) AM_READWRITE(hrx_attr_r, hrx_attr_w) +// AM_RANGE(0x38, 0x38) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) +// AM_RANGE(0x39, 0x39) AM_DEVWRITE(MC6845_TAG, mc6845_device, register_r, register_w) +/* AM_RANGE(0x40, 0x43) AM_DEVREADWRITE_LEGACY(FD1791_TAG, wd17xx_r, wd17xx_w) + AM_RANGE(0x44, 0x44) AM_READWRITE(fdx_status_r, fdx_control_w) + AM_RANGE(0x45, 0x45) AM_WRITE(fdx_drv_sel_w) + AM_RANGE(0x46, 0x46) AM_WRITE(fdx_dma_lo_w) + AM_RANGE(0x47, 0x47) AM_WRITE(fdx_dma_hi_w)*/ +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( rs128_io ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( rs128_io, AS_IO, 8, mtx_state ) + AM_IMPORT_FROM(mtx_io) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, cd_ba_r, cd_ba_w) +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/*------------------------------------------------- + INPUT_PORTS( mtx512 ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( mtx512 ) + PORT_START("ROW0") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Page") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("ROW1") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 EOL") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("ROW2") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('\t') PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("ROW3") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Linefeed") PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("ROW4") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AlphaLock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("ROW5") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("ROW6") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + + PORT_START("ROW7") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter CLS") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("country_code") + PORT_DIPNAME(0x04, 0x00, "Country Code Switch 1") + PORT_DIPSETTING(0x04, DEF_STR(Off) ) + PORT_DIPSETTING(0x00, DEF_STR(On) ) + PORT_DIPNAME(0x08, 0x00, "Country Code Switch 0") + PORT_DIPSETTING(0x08, DEF_STR(Off) ) + PORT_DIPSETTING(0x00, DEF_STR(On) ) + PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/*************************************************************************** + DEVICE CONFIGURATION +***************************************************************************/ + +/*------------------------------------------------- + Z80CTC +-------------------------------------------------*/ + +TIMER_DEVICE_CALLBACK_MEMBER(mtx_state::ctc_tick) +{ + m_z80ctc->trg1(1); + m_z80ctc->trg1(0); + m_z80ctc->trg2(1); + m_z80ctc->trg2(0); +} + +WRITE_LINE_MEMBER(mtx_state::ctc_trg1_w) +{ + if (m_z80dart) + { + m_z80dart->rxca_w(state); + m_z80dart->txca_w(state); + } +} + +WRITE_LINE_MEMBER(mtx_state::ctc_trg2_w) +{ + if (m_z80dart) + { + m_z80dart->rxtxcb_w(state); + } +} + +/*------------------------------------------------- + z80_daisy_config mtx_daisy_chain +-------------------------------------------------*/ + +static const z80_daisy_config mtx_daisy_chain[] = +{ + { Z80CTC_TAG }, + { NULL } +}; + +/*------------------------------------------------- + z80_daisy_config rs128_daisy_chain +-------------------------------------------------*/ + +static const z80_daisy_config rs128_daisy_chain[] = +{ + { Z80CTC_TAG }, + { Z80DART_TAG }, + { NULL } +}; + + +TIMER_DEVICE_CALLBACK_MEMBER(mtx_state::cassette_tick) +{ + int data = ((m_cassette)->input() > +0.0) ? 0 : 1; + + m_z80ctc->trg3(data); +} + +/*------------------------------------------------- + mtx_tms9928a_interface +-------------------------------------------------*/ + +WRITE_LINE_MEMBER(mtx_state::mtx_tms9929a_interrupt) +{ + m_z80ctc->trg0(state ? 0 : 1); +} + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +/*------------------------------------------------- + MACHINE_CONFIG_START( mtx512, mtx_state ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( mtx512, mtx_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(mtx_mem) + MCFG_CPU_IO_MAP(mtx_io) + MCFG_CPU_CONFIG(mtx_daisy_chain) + + MCFG_MACHINE_START_OVERRIDE(mtx_state,mtx512) + MCFG_MACHINE_RESET_OVERRIDE(mtx_state,mtx512) + + /* video hardware */ + MCFG_DEVICE_ADD( "tms9929a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(mtx_state, mtx_tms9929a_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9929a", tms9929a_device, screen_update ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SN76489A_TAG, SN76489A, XTAL_4MHz) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_4MHz) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(mtx_state, ctc_trg1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(mtx_state, ctc_trg2_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_timer", mtx_state, ctc_tick, attotime::from_hz(XTAL_4MHz/13)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(mtx_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(mtx_state, write_centronics_fault)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(mtx_state, write_centronics_perror)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(mtx_state, write_centronics_select)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_SNAPSHOT_ADD("snapshot", mtx_state, mtx, "mtx", 1) + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + MCFG_CASSETTE_INTERFACE("mtx_cass") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", mtx_state, cassette_tick, attotime::from_hz(44100)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("96K,128K,160K,192K,224K,256K,288K,320K,352K,384K,416K,448K,480K,512K") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "mtx_cass") +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_CONFIG_DERIVED( mtx500, mtx512 ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_DERIVED( mtx500, mtx512 ) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("64K,96K,128K,160K,192K,224K,256K,288K,320K,352K,384K,416K,448K,480K,512K") +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_CONFIG_DERIVED( rs128, mtx512 ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_DERIVED( rs128, mtx512 ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY(Z80_TAG) + MCFG_CPU_IO_MAP(rs128_io) + MCFG_CPU_CONFIG(rs128_daisy_chain) + + /* devices */ + MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_4MHz, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("160K,192K,224K,256K,288K,320K,352K,384K,416K,448K,480K,512K") +MACHINE_CONFIG_END + +/*************************************************************************** + ROMS +***************************************************************************/ + +ROM_START( mtx512 ) + ROM_REGION( 0x02000, "user1", 0 ) + ROM_LOAD( "osrom", 0x0000, 0x2000, CRC(9ca858cc) SHA1(3804503a58f0bcdea96bb6488833782ebd03976d) ) + + ROM_REGION( 0x10000, "user2", 0 ) + ROM_LOAD( "basicrom", 0x0000, 0x2000, CRC(87b4e59c) SHA1(c49782a82a7f068c1195cd967882ba9edd546eaf) ) + ROM_LOAD( "assemrom", 0x2000, 0x2000, CRC(9d7538c3) SHA1(d1882c4ea61a68b1715bd634ded5603e18a99c5f) ) + ROM_LOAD( "newword0", 0x4000, 0x2000, CRC(5433bd01) SHA1(56897f385476864337b7b994c1b46f50eaa57128) ) + ROM_LOAD( "newword1", 0x6000, 0x2000, CRC(10980c03) SHA1(8245c42fb1eda43b67fa483e50e4ee3bc5f3f29f) ) + ROM_LOAD( "newword2", 0x8000, 0x2000, CRC(cbff7130) SHA1(b4ab27def6020ba8e32959a1b988fce77bcc1d7f) ) + ROM_LOAD( "newword3", 0xa000, 0x2000, CRC(e6bbc33b) SHA1(26faa4a8d952c4659f610e94608b630456ab89aa) ) + + ROM_REGION( 0x2000, "sdx", 0 ) + ROM_LOAD( "sdx", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x2000, "mtx", 0 ) + ROM_LOAD( "sm2 fdcx1 v03", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x1000, MC6845_TAG, 0 ) + ROM_LOAD( "80z.bin", 0x0000, 0x1000, CRC(ea6fe865) SHA1(f84883f79bed34501e5828336894fad929bddbb5) ) + + /* Device GAL16V8 converted from PAL14L4 JEDEC map */ + ROM_REGION( 0x117, "plds", 0 ) + ROM_LOAD( "memotech-mtx512.bin", 0x0000, 0x0117, CRC(31f88133) SHA1(5bef3ce764121b3510b538824b2768f082b422bb) ) +ROM_END + +#define rom_mtx500 rom_mtx512 +#define rom_rs128 rom_mtx512 + +/*************************************************************************** + SYSTEM DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, mtx512, 0, 0, mtx512, mtx512, driver_device, 0, "Memotech Ltd", "MTX 512", 0 ) +COMP( 1983, mtx500, mtx512, 0, mtx500, mtx512, driver_device, 0, "Memotech Ltd", "MTX 500", 0 ) +COMP( 1984, rs128, mtx512, 0, rs128, mtx512, driver_device, 0, "Memotech Ltd", "RS 128", 0 ) + + +/* +The following roms are available should they be considered useful: + +ROM_START( mtx_roms ) + ROM_LOAD( "assem.rom", CRC(599d5b6b) SHA1(3ec1f7f476a21ca3206012ded22198c020b47f7d) ) + ROM_LOAD( "basic.rom", CRC(d1e9ff36) SHA1(e89ae3a627716e6cee7e35054be8a2472bdd49d4) ) + ROM_LOAD( "boot.rom", CRC(ed98d6dd) SHA1(4671ee49bb96262b0468f7122a49bf2588170903) ) + ROM_LOAD( "mtx3-an.rom", CRC(54c9eca2) SHA1(3e628beaa360e635264c8c2c3a5b8312951a220b) ) + ROM_LOAD( "nboot.rom", CRC(9caea81c) SHA1(93fca6e7ffbc7ae3283b8bda9f01c36b2bed1c54) ) +ROM_END + +BASIC.ROM this contains the monitor ROM plus the BASIC ROM. + It's good to view them as one, because the monitor + ROM contains a good deal of BASIC code and the machine + code just runs from the monitor ROM into the BASIC ROM. + It's also handy if you want to disassemble it (which + you don't need because it's already done). + +MTX3-AN.ROM the monitor ROM, but slightly modified + While detecting memory size, the startup code destroys + RAM content. When you have a lot of RAM it is convenient + to have a ramdisk for CP/M, but it is a nuisance if the + ramdisk is trashed at each reset. The modification simply + prevents RAM trashing. + +ASSEM.ROM assembler ROM + +BOOT.ROM FDX floppy boot ROM + +NBOOT.ROM replacement FDX boot ROM written by M. Kessler (supports + booting from different disk formats and different drives) +*/ diff --git a/src/mame/drivers/multi16.c b/src/mame/drivers/multi16.c new file mode 100644 index 00000000000..3e9722b990e --- /dev/null +++ b/src/mame/drivers/multi16.c @@ -0,0 +1,167 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Mitsubishi Multi 16 + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "video/mc6845.h" +#include "machine/pic8259.h" + + +class multi16_state : public driver_device +{ +public: + multi16_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pic(*this, "pic8259"), + m_crtc(*this, "crtc"), + m_palette(*this, "palette") + , + m_p_vram(*this, "p_vram"){ } + + required_device m_maincpu; + required_device m_pic; + required_device m_crtc; + required_device m_palette; + DECLARE_WRITE8_MEMBER(multi16_6845_address_w); + DECLARE_WRITE8_MEMBER(multi16_6845_data_w); + required_shared_ptr m_p_vram; + UINT8 m_crtc_vreg[0x100],m_crtc_index; + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_multi16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + +void multi16_state::video_start() +{ +} + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + + +UINT32 multi16_state::screen_update_multi16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + int count; + int xi; + + count = 0; + + for(y=0;y> (15-xi)) & 0x1; + + if(screen.visible_area().contains(x*16+xi, y)) + bitmap.pix16(y, x*16+xi) = m_palette->pen(dot); + } + + count++; + } + } + + return 0; +} + +static ADDRESS_MAP_START(multi16_map, AS_PROGRAM, 16, multi16_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0x7ffff) AM_RAM + AM_RANGE(0xd8000,0xdffff) AM_RAM AM_SHARE("p_vram") + AM_RANGE(0xe0000,0xeffff) AM_RAM + AM_RANGE(0xf0000,0xf3fff) AM_MIRROR(0xc000) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +WRITE8_MEMBER( multi16_state::multi16_6845_address_w ) +{ + m_crtc_index = data; + m_crtc->address_w(space, offset, data); +} + +WRITE8_MEMBER( multi16_state::multi16_6845_data_w ) +{ + m_crtc_vreg[m_crtc_index] = data; + m_crtc->register_w(space, offset, data); +} + +static ADDRESS_MAP_START(multi16_io, AS_IO, 16, multi16_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x02, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff) // i8259 + AM_RANGE(0x40, 0x41) AM_WRITE8(multi16_6845_address_w, 0x00ff) + AM_RANGE(0x40, 0x41) AM_WRITE8(multi16_6845_data_w, 0xff00) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( multi16 ) +INPUT_PORTS_END + +void multi16_state::machine_start() +{ +} + + +void multi16_state::machine_reset() +{ +} + + +static MACHINE_CONFIG_START( multi16, multi16_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 8000000) + MCFG_CPU_PROGRAM_MAP(multi16_map) + MCFG_CPU_IO_MAP(multi16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(multi16_state, screen_update_multi16) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + + /* devices */ + MCFG_MC6845_ADD("crtc", H46505, "screen", 16000000/5) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), GND, NULL ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( multi16 ) + ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x4000, CRC(5beb5e94) SHA1(d3b9dc9a08995a0f26af9671893417e795370306)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, multi16, 0, 0, multi16, multi16, driver_device, 0, "Mitsubishi", "Multi 16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/multi8.c b/src/mame/drivers/multi8.c new file mode 100644 index 00000000000..d10ea348ea8 --- /dev/null +++ b/src/mame/drivers/multi8.c @@ -0,0 +1,681 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Multi 8 (c) 1983 Mitsubishi + + preliminary driver by Angelo Salese + + TODO: + - dunno how to trigger the text color mode in BASIC, I just modify + $f0b1 to 1 for now + - bitmap B/W mode is untested + - keyboard + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/2203intf.h" +#include "video/mc6845.h" +#include "machine/i8255.h" +#include "sound/beep.h" + + +class multi8_state : public driver_device +{ +public: + multi8_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ppi(*this, "ppi8255_0"), + m_crtc(*this, "crtc"), + m_beeper(*this, "beeper") + { } + + required_device m_maincpu; + required_device m_ppi; + required_device m_crtc; + required_device m_beeper; + DECLARE_WRITE8_MEMBER(multi8_6845_w); + DECLARE_READ8_MEMBER(key_input_r); + DECLARE_READ8_MEMBER(key_status_r); + DECLARE_READ8_MEMBER(multi8_vram_r); + DECLARE_WRITE8_MEMBER(multi8_vram_w); + DECLARE_READ8_MEMBER(pal_r); + DECLARE_WRITE8_MEMBER(pal_w); + DECLARE_READ8_MEMBER(multi8_kanji_r); + DECLARE_WRITE8_MEMBER(multi8_kanji_w); + DECLARE_READ8_MEMBER(porta_r); + DECLARE_WRITE8_MEMBER(portb_w); + DECLARE_WRITE8_MEMBER(portc_w); + DECLARE_WRITE8_MEMBER(ym2203_porta_w); + UINT8 *m_p_vram; + UINT8 *m_p_wram; + UINT8 *m_p_kanji; + UINT8 *m_p_chargen; + UINT8 m_mcu_init; + UINT8 m_keyb_press; + UINT8 m_keyb_press_flag; + UINT8 m_shift_press_flag; + UINT8 m_display_reg; + UINT8 m_crtc_vreg[0x100],m_crtc_index; + UINT8 m_vram_bank; + UINT8 m_pen_clut[8]; + UINT8 m_bw_mode; + UINT16 m_knj_addr; + DECLARE_READ8_MEMBER(ay8912_0_r); + DECLARE_READ8_MEMBER(ay8912_1_r); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_multi8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); + void multi8_draw_pixel(bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width); +}; + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + +void multi8_state::video_start() +{ + m_keyb_press = m_keyb_press_flag = m_shift_press_flag = m_display_reg = 0; + + for (m_bw_mode = 0; m_bw_mode < 8; m_bw_mode++) + m_pen_clut[m_bw_mode]=0; + + m_vram_bank = 8; + m_bw_mode = 0; + m_p_chargen = memregion("chargen")->base(); +} + +void multi8_state::multi8_draw_pixel(bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width) +{ + if(!machine().first_screen()->visible_area().contains(x, y)) + return; + + if(width) + { + bitmap.pix16(y, x*2+0) = pen; + bitmap.pix16(y, x*2+1) = pen; + } + else + bitmap.pix16(y, x) = pen; +} + +UINT32 multi8_state::screen_update_multi8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,count; + UINT8 x_width; + UINT8 xi,yi; + + count = 0x0000; + + x_width = (m_display_reg & 0x40) ? 80 : 40; + + for(y=0; y<200; y++) + { + for(x=0; x<80; x++) + { + for(xi=0; xi<8; xi++) + { + int pen_r,pen_g,pen_b,color; + + pen_b = (m_p_vram[count | 0x0000] >> (7-xi)) & 1; + pen_r = (m_p_vram[count | 0x4000] >> (7-xi)) & 1; + pen_g = (m_p_vram[count | 0x8000] >> (7-xi)) & 1; + + if (m_bw_mode) + { + pen_b = (m_display_reg & 1) ? pen_b : 0; + pen_r = (m_display_reg & 2) ? pen_r : 0; + pen_g = (m_display_reg & 4) ? pen_g : 0; + + color = ((pen_b) | (pen_r) | (pen_g)) ? 7 : 0; + } + else + color = (pen_b) | (pen_r << 1) | (pen_g << 2); + + multi8_draw_pixel(bitmap, y, x*8+xi,m_pen_clut[color], 0); + } + count++; + } + } + + count = 0xc000; + + for(y=0;y<25;y++) + { + for(x=0; x> (7-xi) & 1) ? 0 : color; + else + pen = (m_p_chargen[tile*8+yi] >> (7-xi) & 1) ? color : 0; + + if(pen) + multi8_draw_pixel(bitmap, y*mc6845_tile_height+yi, x*8+xi, pen, (m_display_reg & 0x40) == 0x00); + } + } + + // m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile,color >> 5, 0, 0, x*8, y*8); + + // draw cursor + if(mc6845_cursor_addr+0xc000 == count) + { + int xc,yc,cursor_on; + + cursor_on = 0; + switch(mc6845_cursor_y_start & 0x60) + { + case 0x00: cursor_on = 1; break; //always on + case 0x20: cursor_on = 0; break; //always off + case 0x40: if(machine().first_screen()->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink + case 0x60: if(machine().first_screen()->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink + } + + if(cursor_on) + { + for (yc=0; yc<(mc6845_tile_height-(mc6845_cursor_y_start & 7)); yc++) + { + for (xc=0; xc<8; xc++) + multi8_draw_pixel(bitmap, y*mc6845_tile_height+yc, x*8+xc,0x07,(m_display_reg & 0x40) == 0x00); + + } + } + } + + (m_display_reg & 0x40) ? count++ : count+=2; + } + } + return 0; +} + +WRITE8_MEMBER( multi8_state::multi8_6845_w ) +{ + if (!offset) + { + m_crtc_index = data; + m_crtc->address_w(space, offset, data); + } + else + { + m_crtc_vreg[m_crtc_index] = data; + m_crtc->register_w(space, offset, data); + } +} + +READ8_MEMBER( multi8_state::key_input_r ) +{ + if (m_mcu_init == 0) + { + m_mcu_init++; + return 3; + } + + m_keyb_press_flag &= 0xfe; + + return m_keyb_press; +} + +READ8_MEMBER( multi8_state::key_status_r ) +{ + if (m_mcu_init == 0) + return 1; + else + if (m_mcu_init == 1) + { + m_mcu_init++; + return 1; + } + else + if (m_mcu_init == 2) + { + m_mcu_init++; + return 0; + } + + return m_keyb_press_flag | (m_shift_press_flag << 7); +} + +READ8_MEMBER( multi8_state::multi8_vram_r ) +{ + UINT8 res; + + if (!BIT(m_vram_bank, 4)) //select plain work ram + return m_p_wram[offset]; + + res = 0xff; + + if (!BIT(m_vram_bank, 0)) + res &= m_p_vram[offset | 0x0000]; + + if (!BIT(m_vram_bank, 1)) + res &= m_p_vram[offset | 0x4000]; + + if (!BIT(m_vram_bank, 2)) + res &= m_p_vram[offset | 0x8000]; + + if (!BIT(m_vram_bank, 3)) + res &= m_p_vram[offset | 0xc000]; + + return res; +} + +WRITE8_MEMBER( multi8_state::multi8_vram_w ) +{ + if (!BIT(m_vram_bank, 4)) //select plain work ram + { + m_p_wram[offset] = data; + return; + } + + if (!BIT(m_vram_bank, 0)) + m_p_vram[offset | 0x0000] = data; + + if (!BIT(m_vram_bank, 1)) + m_p_vram[offset | 0x4000] = data; + + if (!BIT(m_vram_bank, 2)) + m_p_vram[offset | 0x8000] = data; + + if (!BIT(m_vram_bank, 3)) + m_p_vram[offset | 0xc000] = data; +} + +READ8_MEMBER( multi8_state::pal_r ) +{ + return m_pen_clut[offset]; +} + +WRITE8_MEMBER( multi8_state::pal_w ) +{ + m_pen_clut[offset] = data; + + UINT8 i; + for(i=0;i<8;i++) + { + if (m_pen_clut[i]) + { + m_bw_mode = 0; + return; + } + m_bw_mode = 1; + } +} + +READ8_MEMBER(multi8_state::ay8912_0_r){ return machine().device("aysnd")->data_r(space, 0); } +READ8_MEMBER(multi8_state::ay8912_1_r){ return machine().device("aysnd")->data_r(space, 1); } + +READ8_MEMBER( multi8_state::multi8_kanji_r ) +{ + return m_p_kanji[(m_knj_addr << 1) | (offset & 1)]; +} + +WRITE8_MEMBER( multi8_state::multi8_kanji_w ) +{ + m_knj_addr = (offset == 0) ? (m_knj_addr & 0xff00) | (data & 0xff) : (m_knj_addr & 0x00ff) | (data << 8); +} + +static ADDRESS_MAP_START(multi8_mem, AS_PROGRAM, 8, multi8_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0xbfff) AM_READWRITE( multi8_vram_r, multi8_vram_w ) + AM_RANGE(0xc000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(multi8_io, AS_IO, 8, multi8_state) +// ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READ(key_input_r) AM_WRITENOP//keyboard + AM_RANGE(0x01, 0x01) AM_READ(key_status_r) AM_WRITENOP//keyboard + AM_RANGE(0x18, 0x19) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) + AM_RANGE(0x18, 0x18) AM_READ(ay8912_0_r) + AM_RANGE(0x1a, 0x1a) AM_READ(ay8912_1_r) + AM_RANGE(0x1c, 0x1d) AM_WRITE(multi8_6845_w) +// AM_RANGE(0x20, 0x21) //sio, cmt +// AM_RANGE(0x24, 0x27) //pit + AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) +// AM_RANGE(0x2c, 0x2d) //i8259 + AM_RANGE(0x30, 0x37) AM_READWRITE(pal_r,pal_w) + AM_RANGE(0x40, 0x41) AM_READWRITE(multi8_kanji_r,multi8_kanji_w) //kanji regs +// AM_RANGE(0x70, 0x74) //upd765a fdc +// AM_RANGE(0x78, 0x78) //memory banking +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( multi8 ) + PORT_START("VBLANK") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") + + PORT_START("key1") //0x00-0x1f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x01 soh + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x02 stx + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x03 etx + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x04 etx + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x05 eot + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x06 enq + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x07 ack + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0a + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0b lf + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0c vt + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e cr + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f so + + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x10 si + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x11 dle + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x12 dc1 + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x13 dc2 + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x15 dc4 + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x17 syn + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x18 etb + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1a em + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1c ??? + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1d fs + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1e gs + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1f us + + PORT_START("key2") //0x20-0x3f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2e . + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2f / + + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? + + PORT_START("key3") //0x40-0x5f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") + + PORT_START("key_modifiers") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) +INPUT_PORTS_END + +TIMER_DEVICE_CALLBACK_MEMBER(multi8_state::keyboard_callback) +{ + static const char *const portnames[3] = { "key1","key2","key3" }; + int i,port_i,scancode; + UINT8 keymod = ioport("key_modifiers")->read() & 0x1f; + scancode = 0; + + m_shift_press_flag = ((keymod & 0x02) >> 1); + + for(port_i=0;port_i<3;port_i++) + { + for(i=0;i<32;i++) + { + if((ioport(portnames[port_i])->read()>>i) & 1) + { + //key_flag = 1; + if(!m_shift_press_flag) // shift not pressed + { + if(scancode >= 0x41 && scancode < 0x5b) + scancode += 0x20; // lowercase + } + else + { + if(scancode >= 0x31 && scancode < 0x3a) + scancode -= 0x10; + if(scancode == 0x30) + scancode = 0x3d; + + if(scancode == 0x3b) + scancode = 0x2c; + + if(scancode == 0x3a) + scancode = 0x2e; + if(scancode == 0x5b) + scancode = 0x2b; + if(scancode == 0x3c) + scancode = 0x3e; + } + m_keyb_press = scancode; + m_keyb_press_flag = 1; + return; + } + scancode++; + } + } +} + +static const gfx_layout multi8_charlayout = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP8(0,1) }, + { STEP8(0,8) }, + 8*8 +}; + +static const gfx_layout multi8_kanjilayout = +{ + 16,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP16(0,1) }, + { STEP16(0,16) }, + 16*16 +}; + +static GFXDECODE_START( multi8 ) + GFXDECODE_ENTRY( "chargen", 0x0000, multi8_charlayout, 0, 1 ) + GFXDECODE_ENTRY( "kanji", 0x0000, multi8_kanjilayout, 0, 1 ) +GFXDECODE_END + + +READ8_MEMBER( multi8_state::porta_r ) +{ + int vsync = (ioport("VBLANK")->read() & 0x1) << 5; + /* + -x-- ---- kanji rom is present (0) yes + --x- ---- vsync + ---- --x- fdc rom is present (0) yes + */ + + return 0x9f | vsync | 0x00; +} + + +WRITE8_MEMBER( multi8_state::portb_w ) +{ + /* + x--- ---- color mode + -x-- ---- screen width (80 / 40) + ---- x--- memory bank status + ---- -xxx page screen graphics in B/W mode + */ + + m_display_reg = data; +} + +WRITE8_MEMBER( multi8_state::portc_w ) +{ +// printf("Port C w = %02x\n",data); + m_vram_bank = data & 0x1f; + + if (data & 0x20 && data != 0xff) + printf("Work RAM bank selected!\n"); +// fatalerror("Work RAM bank selected\n"); +} + + +WRITE8_MEMBER( multi8_state::ym2203_porta_w ) +{ + m_beeper->set_state((data & 0x08)); +} + +void multi8_state::machine_start() +{ + m_p_vram = memregion("vram")->base(); + m_p_wram = memregion("wram")->base(); + m_p_kanji = memregion("kanji")->base(); +} + +void multi8_state::machine_reset() +{ + m_beeper->set_frequency(1200); //guesswork + m_beeper->set_state(0); + m_mcu_init = 0; +} + +static MACHINE_CONFIG_START( multi8, multi8_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(multi8_mem) + MCFG_CPU_IO_MAP(multi8_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(multi8_state, screen_update_multi8) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", multi8) + + /* Audio */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("aysnd", AY8912, 1500000) //unknown clock / divider + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(multi8_state, ym2203_porta_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) + + /* devices */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", multi8_state, keyboard_callback, attotime::from_hz(240/32)) + + MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_3_579545MHz/2) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(multi8_state, porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(multi8_state, portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(multi8_state, portc_w)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( multi8 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "basic.rom", 0x0000, 0x8000, CRC(2131a3a8) SHA1(0f5a565ecfbf79237badbf9011dcb374abe74a57)) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(08f9ed0e) SHA1(57480510fb30af1372df5a44b23066ca61c6f0d9)) + + ROM_REGION( 0x20000, "kanji", 0 ) + ROM_LOAD( "kanji.rom", 0x0000, 0x20000, BAD_DUMP CRC(c3cb3ff9) SHA1(7173cc5053a281d73cfecfacd31442e21ee7474a)) + + ROM_REGION( 0x0100, "mcu", ROMREGION_ERASEFF ) + ROM_LOAD( "kbd.rom", 0x0000, 0x0100, NO_DUMP ) + + ROM_REGION( 0x1000, "fdc_bios", 0 ) + ROM_LOAD( "disk.rom", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x10000, "vram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x4000, "wram", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, multi8, 0, 0, multi8, multi8, driver_device, 0, "Mitsubishi", "Multi 8", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mvme350.c b/src/mame/drivers/mvme350.c new file mode 100644 index 00000000000..62bf38926d3 --- /dev/null +++ b/src/mame/drivers/mvme350.c @@ -0,0 +1,257 @@ +// license:BSD-3-Clause +// copyright-holders:Joakim Larsson Edstrom +/*************************************************************************** + * + * Motorola MVME-350 6U Intelligent Tape Controller driver, initially derived + * from hk68v10.c + * + * 31/08/2015 + * + * I baught this board from http://www.retrotechnology.com without documentation. + * It has a Motorola 68010 CPU @ 10MHz, 128 Mb RAM and two 2764 EPROMS with + * QIC-02 tape controller firmware. The board also populates a 68230 PIT and loads + * of descrete TTL components. + * + * + * || + * || || + * ||||--|| + * ||||--|| + * || ||__________________________________________________________ ___ + * ||_______________________________________________________ |_| | + * || |74F74 | xxxxx | xxxxx | 74LS245 | 74ALS645| | | | + * || |______|________|_________|___________| ________| | | | + * || |74F74 | xxxxx | xxxxx | 74LS245 | 74ALS645| | | | + * || |______|________|_________|___________| ________| | | | + * || |74LS02| 74LS08||Am25LS251| 74S38 |74LS20|Jumpers | | | + * || |______|_______||_________|_______|______|______| | |VME| + * || |74F04 | 74LS32||74LS374 | 74LS374 |74S244 | | | | + * ||+---+ |______|_______||_________|___________|_________| | |P1 | + * |||CON| |74F04 | 74LS85||74S244 | 74S240 |PAL | | | | + * ||| | |______|_______||_________|___________|_________| | | | + * ||| | |74LS04| | |74S244 | | | | + * ||| | |______| | PIT |_________| | | | + * ||| | |74LS125 | MC68230L10 |74LS145 | | | | + * ||| | |______| __|_______________________|---------| | | | + * ||| | |74LS74| |25LS251 | | RAM |74S244 | |_| | + * ||+---+ ---------- |---------- | HM6264P-12 |---------| |___| + * || | PAL | | 74245 | |______________|74S244 | | + * || +--------- |_________| | U40 27128 |---------| | + * || | 74F32 | | || System ROM |74LS682 | | + * Red || +-------- | CPU || |-+-------| | + * FAIL ||LED | 74F138| | MC68010 |+--------------+ |DIPSW__| | + * Red || +-------- | || RAM | |74S38 | | + * HALT ||LED | 74F32 | |__________|| HM6264P-12 | |______ | | + * Green || +-------+ |74245 |+--------------+ |74F08 | | + * RUN ||LED |XTAL | |__________|| U47 27128 | |______ | |___ + * ||+---+|20MHz | |74244 || System ROM | |74F00 | _| | + * |||CON|--------+___|__________|+--------------+_|_______| | | | + * ||| |74LS08 |74F74 |74LS148| |PAL | | PAL | | | | + * ||| |________|________|_______| |________|_|_________| | | | + * ||| | 74LS138|74F32 | PAL | |74F74 |Am29823 | | | | + * ||| |________|________|_______| |________|-+---------| | |VME| + * ||| | 74LS11 |74F04 |74LS374| |74LS374 | |74S240 | | | | + * ||| |________|________|_______| |________|_|---------| | |P2 | + * ||| | 74F138 |BLANK |74LS374| |74LS374 |74S240 | | | | + * ||| |________|________|_______| +----------+---------| | | | + * ||| | 74LS08 |74F32 |74LS11|74LS393|74LS393|resistors | | | + * ||| |________|________|______|______ |_______|________| | | | + * ||| |DM2585 |74F74 |DM2230| 74LS00| 74F02 |74F32 | | | | + * ||+---+--------+--------+------+-------+---------+------| | | | + * || |74LS74 |74F20 |74S260| 74S74 | 74F08 |74LS02| | | | + * || +------------------------------------------+------| | | | + * || |DM2353 |74F10 |74F32 | 74LS32| 74F08 |DM2353| |_| | + * || +------------------------------------------+------+-+ |___| + * || ||------------------------------------------------------------+-+ + * ||||--|| + * ||||--|| + * || + * + * History of Motorola VME division (https://en.wikipedia.org/wiki/VMEbus) + *--------------------------------- + * When Motorola released the 68000 processor 1979 the ambition of the deisgners + * was also to standardize a versatile CPU bus to be able to build computer + * systems without constructing PCB:s from scratch. This become VersaBus but the + * boards was really too big and the computer world already saw the systems shrink + * in size. Motorola's design center in Munich proposed to use the smaller and + * already used Euroboard form factor and call it Versabus-E. This later became + * VME which was standardized in the VITA organization 1981 + * + * Misc links about Motorola VME division and this board: + * http://bitsavers.trailing-edge.com/pdf/motorola/_dataBooks/1987_Microcomputer_Systems_and_Components.pdf + * + * Description + * ------------ + * Streaming Tape Controller released 1984 with the following feature set + * + * - Double High (6U) VMEmodule + * - QIC-02 Streaming Tape Interface + * - Supports One 01C-02 compatible 1/4-inch Streaming Tape Drive + * - Standard VMEbus Interface + * - Supports 24- or 32-bit DMA Addressing/16-bit Data + * - Generates Seven Levels of VMEbus Interrupts with Programmable Interrupt Vector + * - 10 MHz MC68010 Microprocessor + * - 90Kb/s Continuous Transfer Rate for QIC-02 Interface, 200Kb/s Burst rate + * - Controls Tape Cartridges Offering 20Mb, 45Mb and 60Mb of Formatted Data Storage + * - MC68230 PIT-based Timer + * - 16Kb of Static RAM Provides Buffer Storage and CPU Workspace + * - Multitasking Kernel-based Firmware Package + * - Buffered Pipe Communication Protocol Allows Multiple Hosts to Oueue Commands Without Interlock + * - High Level Command/Status Packets offer efficient Operating System Support + * - Permits Chaining of Host Command + * + * Address Map + * -------------------------------------------------------------------------- + * Local to VME Decscription + * -------------------------------------------------------------------------- + * 0x000000 Up to 128Kb System ROM with RESET vector + * 0x020000 RAM with vectors + * 0x020500 RAM Top of stack + * 0x040000 PIT device? + * 0x060000 RAM? + * 0x080000 PIT device? + * -------------------------------------------------------------------------- + * + * Interrupt sources MVME + * ---------------------------------------------------------- + * Description Device Lvl IRQ VME board + * /Board Vector Address + * ---------------------------------------------------------- + * On board Sources + * + * Off board Sources (other VME boards) + * + * ---------------------------------------------------------- + * + * DMAC Channel Assignments + * ---------------------------------------------------------- + * Channel M10 V10 + * ---------------------------------------------------------- + * + * + * TODO: + * - Dump the ROMs (DONE) + * - Setup a working address map (STARTED) + * - Get documentation for VME interface + * - Add VME bus driver + * - Hook up a CPU board that supports boot from tape (ie MVME-162, MVME 147) + * - Get a tape file with a bootable data on it. + * + ****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/68230pit.h" + +#define LOG(x) x + +class mvme350_state : public driver_device +{ +public: +mvme350_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device (mconfig, type, tag), + m_maincpu (*this, "maincpu"), + m_pit(*this, "pit") +{ +} + +DECLARE_READ16_MEMBER (vme_a24_r); +DECLARE_WRITE16_MEMBER (vme_a24_w); +DECLARE_READ16_MEMBER (vme_a16_r); +DECLARE_WRITE16_MEMBER (vme_a16_w); +virtual void machine_start (); +virtual void machine_reset (); +protected: + +private: + required_device m_maincpu; + required_device m_pit; + +}; + +static ADDRESS_MAP_START (mvme350_mem, AS_PROGRAM, 16, mvme350_state) +ADDRESS_MAP_UNMAP_HIGH + AM_RANGE (0x000000, 0x01ffff) AM_ROM /* 128 Mb ROM */ + AM_RANGE (0x020000, 0x03ffff) AM_RAM /* 128 Mb RAM */ +#if 1 + AM_RANGE(0x040000, 0x040035) AM_DEVREADWRITE8("pit", pit68230_device, read, write, 0x00ff) /* PIT ?*/ + AM_RANGE(0x060000, 0x06001f) AM_RAM /* Area is cleared on start */ + AM_RANGE(0x080000, 0x080035) AM_DEVREADWRITE8("pit", pit68230_device, read, write, 0x00ff) /* PIT ?*/ +#endif +//AM_RANGE(0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ +//AM_RANGE(0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START (mvme350) +INPUT_PORTS_END + +/* Start it up */ +void mvme350_state::machine_start () +{ + LOG (logerror ("machine_start\n")); +} + +void mvme350_state::machine_reset () +{ + LOG (logerror ("machine_reset\n")); +} + +#if 0 +/* Dummy VME access methods until the VME bus device is ready for use */ +READ16_MEMBER (mvme350_state::vme_a24_r){ + LOG (logerror ("vme_a24_r\n")); + return (UINT16) 0; +} + +WRITE16_MEMBER (mvme350_state::vme_a24_w){ + LOG (logerror ("vme_a24_w\n")); +} + +READ16_MEMBER (mvme350_state::vme_a16_r){ + LOG (logerror ("vme_16_r\n")); + return (UINT16) 0; +} + +WRITE16_MEMBER (mvme350_state::vme_a16_w){ + LOG (logerror ("vme_a16_w\n")); +} +#endif + +/* + * Machine configuration + */ +static MACHINE_CONFIG_START (mvme350, mvme350_state) + /* basic machine hardware */ + MCFG_CPU_ADD ("maincpu", M68010, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP (mvme350_mem) + /* PIT Parallel Interface and Timer device, assuming strapped for on board clock */ + MCFG_DEVICE_ADD("pit", PIT68230, XTAL_16MHz / 2) + +MACHINE_CONFIG_END + +/* ROM definitions */ +ROM_START (mvme350) +ROM_REGION (0x1000000, "maincpu", 0) + +ROM_LOAD16_BYTE ("mvme350U40v2.3.bin", 0x0000, 0x4000, CRC (bcef82ef) SHA1 (e6fdf26e4714cbaeb3e97d7b5acf02d64d8ad744)) +ROM_LOAD16_BYTE ("mvme350U47v2.3.bin", 0x0001, 0x4000, CRC (582ce095) SHA1 (d0929dbfeb0cfda63df6b5bc29ee27fbf665def7)) + +/* + * System ROM information + * + * The ROMs known commands from different sources: + * + * It communicates with the master through data buffers in shared memory and VME bus interrupts + * as desribed in + * http://bitsavers.trailing-edge.com/pdf/motorola/_dataBooks/1987_Microcomputer_Systems_and_Components.pdf + * + * The board is pretty boring as stand alone, it initializes everything and then executes a STOP instruction + * awaiting a CPU on the VME bus to request its services. However, it enables boot from tape devices, we just + * need a MVME-131 and a dump of a VersaDOS or Motorola UNIX System V system tape and some work. + */ +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP (1984, mvme350, 0, 0, mvme350, mvme350, driver_device, 0, "Motorola", "MVME-350", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) diff --git a/src/mame/drivers/mx2178.c b/src/mame/drivers/mx2178.c new file mode 100644 index 00000000000..a1fc4fb1a22 --- /dev/null +++ b/src/mame/drivers/mx2178.c @@ -0,0 +1,204 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************************************** + + Skeleton driver for Memorex 2178 + + Chips: Z80A, N8X305N, 2x B8452A, 4x D4016C-3, 2x HD468A50P, HD46505SP-1 + Crystal: 18.8696MHz + There is a large piezo-beeper. + + TODO: + - Connect up the beeper + - RS232 not working (6850 parameters are /64, 8 bit, 2 stop bit, IRQ when key pressed) + - Unknown port i/o 80 + - Unknown memory i/o C000, 4000 + - Need schematic / tech manual + - Gets stuck waiting for E011 to become zero somehow. If you skip that, a status line appears. + - Doesn't seem to be any dips, looks like all settings and modes are controlled by keystrokes. + +***************************************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "machine/keyboard.h" + +#define KEYBOARD_TAG "keyboard" + +class mx2178_state : public driver_device +{ +public: + mx2178_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_acia(*this, "acia"), + m_palette(*this, "palette") + { + } + + DECLARE_READ8_MEMBER(keyin_r); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + MC6845_UPDATE_ROW(crtc_update_row); + + const UINT8 *m_p_chargen; + required_shared_ptr m_p_videoram; + +protected: + virtual void machine_reset(); + +private: + UINT8 m_term_data; + required_device m_maincpu; + required_device m_acia; +public: + required_device m_palette; +}; + +static ADDRESS_MAP_START(mx2178_mem, AS_PROGRAM, 8, mx2178_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0x2000, 0x27ff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x6000, 0x6fff) AM_RAM + AM_RANGE(0xe000, 0xe7ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mx2178_io, AS_IO, 8, mx2178_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + //AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) + //AM_RANGE(0xa1, 0xa1) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) + AM_RANGE(0xa0, 0xa1) AM_READ(keyin_r) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( mx2178 ) +INPUT_PORTS_END + +READ8_MEMBER( mx2178_state::keyin_r ) +{ + if (offset) + { + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; + } + else + return (m_term_data) ? 0x83 : 0x82; +} + +WRITE8_MEMBER( mx2178_state::kbd_put ) +{ + m_term_data = data; + m_maincpu->set_input_line(0, HOLD_LINE); +} + +MC6845_UPDATE_ROW( mx2178_state::crtc_update_row ) +{ + const rgb_t *pens = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + + /* Display a scanline of a character (8 pixels) */ + *p++ = pens[BIT(gfx, 7)]; + *p++ = pens[BIT(gfx, 6)]; + *p++ = pens[BIT(gfx, 5)]; + *p++ = pens[BIT(gfx, 4)]; + *p++ = pens[BIT(gfx, 3)]; + *p++ = pens[BIT(gfx, 2)]; + *p++ = pens[BIT(gfx, 1)]; + *p++ = pens[BIT(gfx, 0)]; + } +} + +/* F4 Character Displayer */ +static const gfx_layout mx2178_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8 }, + 8*16 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( mx2178 ) + GFXDECODE_ENTRY( "chargen", 0x0000, mx2178_charlayout, 0, 1 ) +GFXDECODE_END + +void mx2178_state::machine_reset() +{ + m_p_chargen = memregion("chargen")->base(); +} + +WRITE_LINE_MEMBER(mx2178_state::write_acia_clock) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + +static MACHINE_CONFIG_START( mx2178, mx2178_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 18869600/5) // guess + MCFG_CPU_PROGRAM_MAP(mx2178_mem) + MCFG_CPU_IO_MAP(mx2178_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not correct + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mx2178) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* Devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", 18869600 / 8) // clk unknown + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(mx2178_state, crtc_update_row) + + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + + /// TODO: hook up acia to keyboard and memory map + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(mx2178_state, kbd_put)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 614400) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(mx2178_state, write_acia_clock)) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mx2178 ) + ROM_REGION(0x2000, "roms", 0) + ROM_LOAD( "96274139.bin", 0x000000, 0x002000, CRC(eb471a27) SHA1(433abefd1a72653d0bf35bcaaeccf9943b96260b) ) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "96273883.bin", 0x000000, 0x001000, CRC(8311fadd) SHA1(573bbad23e893ad9374edc929642dc1cba3452d2) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, mx2178, 0, 0, mx2178, mx2178, driver_device, 0, "Memorex", "Memorex 2178", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/myb3k.c b/src/mame/drivers/myb3k.c new file mode 100644 index 00000000000..96677868c1e --- /dev/null +++ b/src/mame/drivers/myb3k.c @@ -0,0 +1,286 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Matsushita / Panasonic My Brain 3000 / JB-3000 + + preliminary driver by Angelo Salese + + TODO: + - needs a working floppy image, fdc probably needs IRQ / DRQ lines + hooked up. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "video/mc6845.h" +#include "machine/wd_fdc.h" + +class myb3k_state : public driver_device +{ +public: + myb3k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_fdc(*this, "fdc"), + m_crtc(*this, "crtc"), + m_floppy0(*this, "fdc:0:8dsdd"), + m_floppy1(*this, "fdc:1:8dsdd"), + m_p_vram(*this, "p_vram"), + m_palette(*this, "palette") { } + + required_device m_maincpu; + required_device m_fdc; + required_device m_crtc; + required_device m_floppy0; + required_device m_floppy1; + DECLARE_WRITE8_MEMBER(myb3k_6845_address_w); + DECLARE_WRITE8_MEMBER(myb3k_6845_data_w); + DECLARE_WRITE8_MEMBER(myb3k_video_mode_w); + DECLARE_WRITE8_MEMBER(myb3k_fdc_output_w); + required_shared_ptr m_p_vram; + required_device m_palette; + UINT8 m_crtc_vreg[0x100],m_crtc_index; + UINT8 m_vmode; + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_myb3k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + +void myb3k_state::video_start() +{ +} + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + + +UINT32 myb3k_state::screen_update_myb3k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + int xi,yi; + int dot; + int h_step; + + h_step = 64 >> (m_vmode & 3); + + //popmessage("%02x %d",m_vmode,h_step); + + for(y=0;y> (7-xi)) & 1; + if((yi & ~7 && (!(m_vmode & 4))) || (yi & ~0xf && (m_vmode & 4))) + dot = 0; + + if(y*mc6845_tile_height+yi < 200 && x*8+xi < 320) /* TODO: safety check */ + bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(dot); + } + } + } + } + + return 0; +} + +WRITE8_MEMBER( myb3k_state::myb3k_6845_address_w ) +{ + m_crtc_index = data; + m_crtc->address_w(space, offset, data); +} + +WRITE8_MEMBER( myb3k_state::myb3k_6845_data_w ) +{ + m_crtc_vreg[m_crtc_index] = data; + m_crtc->register_w(space, offset, data); +} + +WRITE8_MEMBER( myb3k_state::myb3k_video_mode_w ) +{ + /* ---- -x-- interlace mode */ + /* ---- --xx horizontal step count (number of offsets of vram RAM data to skip, 64 >> n) */ + + m_vmode = data; + +} +WRITE8_MEMBER( myb3k_state::myb3k_fdc_output_w ) +{ + /* TODO: complete guesswork! (it just does a 0x24 -> 0x20 in there) */ + floppy_image_device *floppy = NULL; + + if (data & 1) floppy = m_floppy0; + if (data & 2) floppy = m_floppy1; + + if (floppy) + { + floppy->mon_w(!(data & 4) ? 1: 0); + floppy->ss_w((data & 0x10)>>4); + } +} + +static ADDRESS_MAP_START(myb3k_map, AS_PROGRAM, 8, myb3k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0x7ffff) AM_RAM + AM_RANGE(0x80000,0x8ffff) AM_NOP + AM_RANGE(0xd0000,0xdffff) AM_RAM AM_SHARE("p_vram") +// AM_RANGE(0xe0000,0xexxxx) option ROM board + AM_RANGE(0xfc000,0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(myb3k_io, AS_IO, 8, myb3k_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0x01, 0x01) AM_READ_PORT("DSW1") + AM_RANGE(0x03, 0x03) AM_WRITENOP + AM_RANGE(0x04, 0x04) AM_WRITE(myb3k_video_mode_w) + AM_RANGE(0x06, 0x06) AM_READ_PORT("DSW2") + AM_RANGE(0x1c, 0x1c) AM_WRITE(myb3k_6845_address_w) + AM_RANGE(0x1d, 0x1d) AM_WRITE(myb3k_6845_data_w) + AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("fdc", mb8877_t, read, write) //FDC, almost likely wd17xx + AM_RANGE(0x24, 0x24) AM_WRITE(myb3k_fdc_output_w) +// AM_RANGE(0x520,0x524) mirror of above +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( myb3k ) + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) // - these two plays with the video modes + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) // / + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, "FDC mapping" ) + PORT_DIPSETTING( 0x80, "0x520-0x524 range" ) + PORT_DIPSETTING( 0x00, "0x20-0x24 range" ) + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, "ROM information" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + + +void myb3k_state::machine_start() +{ +} + +void myb3k_state::machine_reset() +{ +} + + +static const gfx_layout myb3k_charlayout = +{ + 8, 8, + 0x400, + 1, + { 0 }, + { STEP8(0,1) }, + { STEP8(0,8) }, + 8*8 +}; + +static GFXDECODE_START( myb3k ) + GFXDECODE_ENTRY( "ipl", 0x0000, myb3k_charlayout, 0, 1 ) +GFXDECODE_END + +static SLOT_INTERFACE_START( myb3k_floppies ) + SLOT_INTERFACE( "525sssd", FLOPPY_525_SSSD ) + SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( myb3k, myb3k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8088, 4000000) /* unknown clock*/ + MCFG_CPU_PROGRAM_MAP(myb3k_map) + MCFG_CPU_IO_MAP(myb3k_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(myb3k_state, screen_update_myb3k) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", myb3k) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* devices */ + MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_3_579545MHz/4) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_DEVICE_ADD("fdc", MB8877, 2000000) // unknown type + MCFG_FLOPPY_DRIVE_ADD("fdc:0", myb3k_floppies, "8dsdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", myb3k_floppies, "8dsdd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( myb3k ) + ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x4000, CRC(64a864a1) SHA1(d3ccfd28f2938e71a26ae5a0085439a3265f60bf)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, myb3k, 0, 0, myb3k, myb3k, driver_device, 0, "Panasonic", "MyBrain 3000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mycom.c b/src/mame/drivers/mycom.c new file mode 100644 index 00000000000..be3978d2ddf --- /dev/null +++ b/src/mame/drivers/mycom.c @@ -0,0 +1,585 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese, Robbbert +/****************************************************************************** + + MYCOMZ-80A (c) 1981 Japan Electronics College + + preliminary driver by Angelo Salese + additions by Robbbert + + THE KEYBOARD + - Uses a 4MO1003A custom mcu. + - Every combination is documented in the manual, including the unused ones. + - All commands must be in uppercase - lowercase will produce errors. + - There are 5 special keys which do crude editing functions. These are in + the range 0x61 to 0x75. Kana characters occupy the range 0xa0 to 0xff. + Graphics characters are found in 0x00 to 0x1f, and 0x80 to 0x9f. + - Editing characters (hold down shift to get them): + a - shiftlock (toggle). You can then enter any lowercase character. + c - clear screen and home cursor + d - insert + f - vertical tab (cursor up) You can scroll backwards with this, + and you can reuse old input lines. + u - cursor right + - There are switches on the right-hand side which are connected directly + to one of the PIAs. The switches (not emulated): + s2 - ?unknown + s3 - ?unknown but must be high for the keyboard to function + s4 - cassette motor on/off + s5 - ?unknown + - There is also switch s1 which it is not known what it connects to. + - Please note: The Takeda 80-column monitor expects the enter key to be the + line feed key. This is the numpad-enter in our emulation. Strangely, the + standard monitor, and Basic, will also respond to this key. + - The keyboard has a "English" key on the left, and a "Japan" key on the + right. Pressing the appropriate key toggles the input language mode. + Internally, this turns the Kana bit off/on. On our keyboard, the ALT key + toggles between English and Kana. + + TODO/info: + - Sound not working. The info makes its way to the audio chip but for + some unknown reason, nothing is heard. + - FDC, little info, guessing (143kb, single sided, 525sd) + - Cassette doesn't load + - Printer + - Keyboard lookup table for Kana and Shifted Kana + - Keyboard autorepeat + - Need software + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "machine/i8255.h" +#include "sound/sn76496.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "machine/msm5832.h" +#include "machine/wd_fdc.h" + + +class mycom_state : public driver_device +{ +public: + mycom_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_ppi0(*this, "ppi8255_0") + , m_ppi1(*this, "ppi8255_1") + , m_ppi2(*this, "ppi8255_2") + , m_cass(*this, "cassette") + , m_wave(*this, WAVE_TAG) + , m_crtc(*this, "crtc") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_audio(*this, "sn1") + , m_rtc(*this, "rtc"), + m_palette(*this, "palette") + { } + + DECLARE_READ8_MEMBER(mycom_upper_r); + DECLARE_WRITE8_MEMBER(mycom_upper_w); + DECLARE_READ8_MEMBER(vram_data_r); + DECLARE_WRITE8_MEMBER(vram_data_w); + DECLARE_WRITE8_MEMBER(mycom_00_w); + DECLARE_WRITE8_MEMBER(mycom_04_w); + DECLARE_WRITE8_MEMBER(mycom_06_w); + DECLARE_WRITE8_MEMBER(mycom_0a_w); + DECLARE_READ8_MEMBER(mycom_05_r); + DECLARE_READ8_MEMBER(mycom_06_r); + DECLARE_READ8_MEMBER(mycom_08_r); + DECLARE_DRIVER_INIT(mycom); + TIMER_DEVICE_CALLBACK_MEMBER(mycom_kbd); + DECLARE_WRITE8_MEMBER(mycom_rtc_w); + MC6845_UPDATE_ROW(crtc_update_row); + UINT8 *m_p_videoram; + UINT8 *m_p_chargen; + UINT8 m_0a; +private: + UINT16 m_i_videoram; + UINT8 m_keyb_press; + UINT8 m_keyb_press_flag; + UINT8 m_sn_we; + UINT32 m_upper_sw; + UINT8 *m_p_ram; + virtual void machine_reset(); + virtual void machine_start(); + virtual void video_start(); + required_device m_maincpu; + required_device m_ppi0; + required_device m_ppi1; + required_device m_ppi2; + required_device m_cass; + required_device m_wave; + required_device m_crtc; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_audio; + required_device m_rtc; +public: + required_device m_palette; +}; + + + +void mycom_state::video_start() +{ + m_p_videoram = memregion("vram")->base(); + m_p_chargen = memregion("chargen")->base(); +} + +MC6845_UPDATE_ROW( mycom_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx=0,z; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + if (m_0a & 0x40) + { + for (x = 0; x < x_count; x++) // lores pixels + { + UINT8 dbit=1; + if (x == cursor_x) dbit=0; + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + z = ra / 3; + *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; + *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; + *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; + *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; + z += 4; + *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; + *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; + *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; + *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; + } + } + else + { + for (x = 0; x < x_count; x++) // text + { + UINT8 inv=0; + if (x == cursor_x) inv=0xff; + mem = (ma + x) & 0x7ff; + if (ra > 7) + gfx = inv; // some blank spacing lines + else + { + chr = m_p_videoram[mem]; + gfx = m_p_chargen[(chr<<3) | ra] ^ inv; + } + + /* Display a scanline of a character */ + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } + } +} + +WRITE8_MEMBER( mycom_state::mycom_00_w ) +{ + switch(data) + { + case 0x00: membank("boot")->set_entry(1); break; + case 0x01: membank("boot")->set_entry(0); break; + case 0x02: m_upper_sw = 0x10000; break; + case 0x03: m_upper_sw = 0x0c000; break; + } +} + +READ8_MEMBER( mycom_state::mycom_upper_r ) +{ + return m_p_ram[offset | m_upper_sw]; +} + +WRITE8_MEMBER( mycom_state::mycom_upper_w ) +{ + m_p_ram[offset | 0xc000] = data; +} + +READ8_MEMBER( mycom_state::vram_data_r ) +{ + return m_p_videoram[m_i_videoram]; +} + +WRITE8_MEMBER( mycom_state::vram_data_w ) +{ + m_p_videoram[m_i_videoram] = data; +} + +static ADDRESS_MAP_START(mycom_map, AS_PROGRAM, 8, mycom_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot") + AM_RANGE(0x1000, 0xbfff) AM_RAM + AM_RANGE(0xc000, 0xffff) AM_READWRITE(mycom_upper_r,mycom_upper_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mycom_io, AS_IO, 8, mycom_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(mycom_00_w) + AM_RANGE(0x01, 0x01) AM_READWRITE(vram_data_r,vram_data_w) + AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0x03, 0x03) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", fd1771_t, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mycom ) + PORT_START("X0") + PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) + PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("X1") + PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("X2") + PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(17) + PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(23) + PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(5) + PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(18) + PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(20) + PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(25) + PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(21) + PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(9) + PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(15) + + PORT_START("X3") + PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(1) + PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(19) + PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(4) + PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(6) + PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(7) + PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(8) + PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(10) + PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(11) + PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(12) + + PORT_START("X4") + PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(26) + PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(24) + PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(3) + PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(22) + PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(2) + PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(14) + PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(13) + PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("< ,") PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') + PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("> .") PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') + + PORT_START("X5") + PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(u)") PORT_CHAR('u') + PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(c)") PORT_CHAR('c') + + PORT_START("X6") + PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(30) + PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ _") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('_') PORT_CHAR(28) + PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(d)") PORT_CHAR('d') + PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(f)") PORT_CHAR('f') + + PORT_START("X7") + PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(16) + PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(0) + PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(27) + PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LineFeed") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(10) + PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(a)") PORT_CHAR('a') + + PORT_START("X8") + PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(29) + PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("XX") + PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_TOGGLE +INPUT_PORTS_END + + +/* F4 Character Displayer */ +static const gfx_layout mycom_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( mycom ) + GFXDECODE_ENTRY( "chargen", 0x0000, mycom_charlayout, 0, 1 ) +GFXDECODE_END + +WRITE8_MEMBER( mycom_state::mycom_04_w ) +{ + m_i_videoram = (m_i_videoram & 0x700) | data; + + m_sn_we = data; +} + +WRITE8_MEMBER( mycom_state::mycom_06_w ) +{ + m_i_videoram = (m_i_videoram & 0x0ff) | ((data & 0x007) << 8); +} + +READ8_MEMBER( mycom_state::mycom_08_r ) +{ + /* + x--- ---- display flag + ---- --x- keyboard shift + ---- ---x keyboard strobe + */ + UINT8 data = 0; + + data = m_keyb_press_flag; //~m_keyb_press_flag & 1; + + if ((m_cass)->input() > 0.03) // not working + data+=4; + + return data; +} + +READ8_MEMBER( mycom_state::mycom_06_r ) +{ + /* + x--- ---- keyboard s5 + -x-- ---- keyboard s4 (motor on/off) + --x- ---- keyboard s3 (must be high) + ---x ---- keyboard s2 + */ + return 0xff; +} + +READ8_MEMBER( mycom_state::mycom_05_r ) +{ + return m_keyb_press; +} + +WRITE8_MEMBER( mycom_state::mycom_0a_w ) +{ + /* + x--- ---- width 80/40 (0 = 80, 1 = 40) + -x-- ---- video mode (0= tile, 1 = bitmap) + --x- ---- PSG Chip Select bit + ---x ---- PSG Write Enable bit + ---- x--- cmt remote (defaults to on) + ---- -x-- cmt output + ---- --x- printer reset + ---- ---x printer strobe + */ + + if ( (BIT(m_0a, 3)) != (BIT(data, 3)) ) + m_cass->change_state( + BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + if (BIT(data, 3)) // motor on + m_cass->output( BIT(data, 2) ? -1.0 : +1.0); + + if ( (BIT(data, 7)) != (BIT(m_0a, 7)) ) + m_crtc->set_clock(BIT(data, 7) ? 1008000 : 2016000); + + m_0a = data; + + // if WE & CE are low, pass sound command to audio chip + if ((data & 0x30)==0) + m_audio->write(space, 0, m_sn_we); +} + +WRITE8_MEMBER(mycom_state::mycom_rtc_w) +{ + m_rtc->address_w(data & 0x0f); + + m_rtc->hold_w(BIT(data, 4)); + m_rtc->read_w(BIT(data, 5)); + m_rtc->write_w(BIT(data, 6)); + m_rtc->cs_w(BIT(data, 7)); +} + +static const UINT8 mycom_keyval[] = { 0, +0x1b,0x1b,0x7c,0x7c,0x18,0x18,0x0f,0x0f,0x09,0x09,0x1c,0x1c,0x30,0x00,0x50,0x70,0x3b,0x2b, +0x00,0x00,0x31,0x21,0x51,0x71,0x41,0x61,0x5a,0x7a,0x17,0x17,0x2d,0x3d,0x40,0x60,0x3a,0x2a, +0x0b,0x0b,0x32,0x22,0x57,0x77,0x53,0x73,0x58,0x78,0x03,0x03,0x5e,0x7e,0x5b,0x7b,0x5d,0x7d, +0x1f,0x1f,0x33,0x23,0x45,0x65,0x44,0x64,0x43,0x63,0x0c,0x0c,0x5c,0x7c,0x0a,0x0a,0x00,0x00, +0x01,0x01,0x34,0x24,0x52,0x72,0x46,0x66,0x56,0x76,0x04,0x04,0x7f,0x7f,0x08,0x08,0x0e,0x0e, +0x02,0x02,0x35,0x25,0x54,0x74,0x47,0x67,0x42,0x62,0x75,0x75,0x64,0x64,0x00,0x00,0x20,0x20, +0x1e,0x1e,0x36,0x26,0x59,0x79,0x48,0x68,0x4e,0x6e,0x37,0x37,0x34,0x34,0x31,0x31,0x30,0x30, +0x1d,0x1d,0x37,0x27,0x55,0x75,0x4a,0x6a,0x4d,0x6d,0x38,0x38,0x35,0x35,0x32,0x32,0x11,0x11, +0x0d,0x0d,0x38,0x28,0x49,0x69,0x4b,0x6b,0x2c,0x3c,0x39,0x39,0x36,0x36,0x33,0x33,0x12,0x12, +0x07,0x07,0x39,0x29,0x4f,0x6f,0x4c,0x6c,0x2e,0x3e,0x63,0x63,0x66,0x66,0x61,0x61,0x2f,0x3f }; + +TIMER_DEVICE_CALLBACK_MEMBER(mycom_state::mycom_kbd) +{ + UINT8 x, y, scancode = 0; + UINT16 pressed[9]; + char kbdrow[3]; + UINT8 modifiers = ioport("XX")->read(); + UINT8 shift_pressed = (modifiers & 2) >> 1; + m_keyb_press_flag = 0; + + /* see what is pressed */ + for (x = 0; x < 9; x++) + { + sprintf(kbdrow,"X%d",x); + pressed[x] = (ioport(kbdrow)->read()); + } + + /* find what has changed */ + for (x = 0; x < 9; x++) + { + if (pressed[x]) + { + /* get scankey value */ + for (y = 0; y < 10; y++) + { + if (BIT(pressed[x], y)) + { + scancode = ((x + y * 9) << 1) + shift_pressed + 1; + m_keyb_press_flag = 1; + m_keyb_press = mycom_keyval[scancode]; + } + } + } + } + + if (m_keyb_press_flag) + { + if (modifiers & 1) m_keyb_press &= 0xbf; + if (modifiers & 4) m_keyb_press |= 0x80; + } +} + + + +static SLOT_INTERFACE_START( mycom_floppies ) + SLOT_INTERFACE( "525sd", FLOPPY_525_SD ) +SLOT_INTERFACE_END + +void mycom_state::machine_start() +{ + m_p_ram = memregion("maincpu")->base(); +} + +void mycom_state::machine_reset() +{ + membank("boot")->set_entry(1); + m_upper_sw = 0x10000; + m_0a = 0; +} + +DRIVER_INIT_MEMBER(mycom_state,mycom) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x10000); +} + +static MACHINE_CONFIG_START( mycom, mycom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_10MHz / 4) + MCFG_CPU_PROGRAM_MAP(mycom_map) + MCFG_CPU_IO_MAP(mycom_io) + + MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mycom_state, mycom_04_w)) + MCFG_I8255_IN_PORTB_CB(READ8(mycom_state, mycom_05_r)) + MCFG_I8255_IN_PORTC_CB(READ8(mycom_state, mycom_06_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mycom_state, mycom_06_w)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mycom_state, mycom_08_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mycom_state, mycom_0a_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_IN_PORTB_CB(DEVREAD8("rtc", msm5832_device, data_r)) + MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("rtc", msm5832_device, data_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mycom_state, mycom_rtc_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 192-1) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mycom) + + /* Manual states clock is 1.008mhz for 40 cols, and 2.016 mhz for 80 cols. + The CRTC is a HD46505S - same as a 6845. The start registers need to be readable. */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", 1008000) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(mycom_state, crtc_update_row) + + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_ADD("sn1", SN76489, XTAL_10MHz / 4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50) + + /* Devices */ + MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_FD1771_ADD("fdc", XTAL_16MHz / 16) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", mycom_floppies, "525sd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", mycom_floppies, "525sd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", mycom_state, mycom_kbd, attotime::from_hz(20)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mycom ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS("mycom") + ROM_SYSTEM_BIOS(0, "mycom", "40 column") + ROMX_LOAD( "bios0.rom", 0x10000, 0x3000, CRC(e6f50355) SHA1(5d3acea360c0a8ab547db03a43e1bae5125f9c2a), ROM_BIOS(1)) + ROMX_LOAD( "basic0.rom",0x13000, 0x1000, CRC(3b077465) SHA1(777427182627f371542c5e0521ed3ca1466a90e1), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "Takeda", "80 column") + ROMX_LOAD( "bios1.rom", 0x10000, 0x3000, CRC(c51d7fcb) SHA1(31d39db43b77cca4d49ff9814d531e056924e716), ROM_BIOS(2)) + ROMX_LOAD( "basic1.rom",0x13000, 0x1000, CRC(30a573f1) SHA1(e3fe2e73644e831b52e2789dc7c181989cc30b82), ROM_BIOS(2)) + /* Takeda bios has no cursor. Use the next lines to turn on cursor, but you must comment out when done. */ + //ROM_FILL( 0x11eb6, 1, 0x47 ) + //ROM_FILL( 0x11eb7, 1, 0x07 ) + + ROM_REGION( 0x0800, "vram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(4039bb6f) SHA1(086ad303bf4bcf983fd6472577acbf744875fea8) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, mycom, 0, 0, mycom, mycom, mycom_state, mycom, "Japan Electronics College", "MYCOMZ-80A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/myvision.c b/src/mame/drivers/myvision.c new file mode 100644 index 00000000000..5881ebf8389 --- /dev/null +++ b/src/mame/drivers/myvision.c @@ -0,0 +1,250 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + Nichibutsu My Vision + driver by Wilbert Pol + + 2013/12/01 Skeleton driver. + 2013/12/02 Working driver. + + Known issues: + - The inputs sometimes feel a bit unresponsive. Was the real unit like + that? Or is it just because we have incorrect clocks? + + TODO: + - Review software list + - Add clickable artwork + - Verify sound chip model + - Verify exact TMS9918 model + - Verify clock crystal(s) + - Verify size of vram + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/tms9928a.h" +#include "sound/ay8910.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class myvision_state : public driver_device +{ +public: + myvision_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cart(*this, "cartslot") + , m_io_row0(*this, "ROW0") + , m_io_row1(*this, "ROW1") + , m_io_row2(*this, "ROW2") + , m_io_row3(*this, "ROW3") + { } + + DECLARE_WRITE_LINE_MEMBER( vdp_interrupt ); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( cart ); + DECLARE_READ8_MEMBER( ay_port_a_r ); + DECLARE_READ8_MEMBER( ay_port_b_r ); + DECLARE_WRITE8_MEMBER( ay_port_a_w ); + DECLARE_WRITE8_MEMBER( ay_port_b_w ); + +private: + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_cart; + UINT8 m_column; + required_ioport m_io_row0; + required_ioport m_io_row1; + required_ioport m_io_row2; + required_ioport m_io_row3; +}; + + +static ADDRESS_MAP_START(myvision_mem, AS_PROGRAM, 8, myvision_state) + ADDRESS_MAP_UNMAP_HIGH + //AM_RANGE(0x0000, 0x5fff) // mapped by the cartslot + AM_RANGE(0xa000, 0xa7ff) AM_RAM + AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE("tms9918", tms9918a_device, vram_read, vram_write) + AM_RANGE(0xe002, 0xe002) AM_DEVREADWRITE("tms9918", tms9918a_device, register_read, register_write) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(myvision_io, AS_IO, 8, myvision_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0x01, 0x01) AM_DEVWRITE("ay8910", ay8910_device, data_w) + AM_RANGE(0x02, 0x02) AM_DEVREAD("ay8910", ay8910_device, data_r) +ADDRESS_MAP_END + + +/* Input ports */ +/* + Keyboard layout is something like: + B + A D E + C + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + */ +static INPUT_PORTS_START( myvision ) + PORT_START("ROW0") + PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M) PORT_NAME("13") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("C/Down") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_I) PORT_NAME("9") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_MAHJONG_E) PORT_NAME("5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_MAHJONG_A) PORT_NAME("1") + + PORT_START("ROW1") + PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("B/Up") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_L) PORT_NAME("12") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_MAHJONG_H) PORT_NAME("8") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_MAHJONG_D) PORT_NAME("4") + + PORT_START("ROW2") + PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N) PORT_NAME("14/Start") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("D/Right") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_J) PORT_NAME("10") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_MAHJONG_F) PORT_NAME("6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_MAHJONG_B) PORT_NAME("2") + + PORT_START("ROW3") + PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("A/Left") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("E") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_K) PORT_NAME("11") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_MAHJONG_G) PORT_NAME("7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_MAHJONG_C) PORT_NAME("3") + +INPUT_PORTS_END + + +void myvision_state::machine_start() +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + save_item(NAME(m_column)); +} + + +void myvision_state::machine_reset() +{ + m_column = 0xff; +} + + +DEVICE_IMAGE_LOAD_MEMBER( myvision_state, cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size != 0x4000 && size != 0x6000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + +WRITE_LINE_MEMBER(myvision_state::vdp_interrupt) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); +} + +READ8_MEMBER( myvision_state::ay_port_a_r ) +{ + UINT8 data = 0xFF; + + if ( ! ( m_column & 0x80 ) ) + { + data &= m_io_row0->read(); + } + + if ( ! ( m_column & 0x40 ) ) + { + data &= m_io_row1->read(); + } + + if ( ! ( m_column & 0x20 ) ) + { + data &= m_io_row2->read(); + } + + if ( ! ( m_column & 0x10 ) ) + { + data &= m_io_row3->read(); + } + + return data; +} + + +READ8_MEMBER( myvision_state::ay_port_b_r ) +{ + return 0xff; +} + + +WRITE8_MEMBER( myvision_state::ay_port_a_w ) +{ +} + + +// Upper 4 bits select column +WRITE8_MEMBER( myvision_state::ay_port_b_w ) +{ + m_column = data; +} + +static MACHINE_CONFIG_START( myvision, myvision_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_10_738635MHz/3) /* Not verified */ + MCFG_CPU_PROGRAM_MAP(myvision_mem) + MCFG_CPU_IO_MAP(myvision_io) + + /* video hardware */ + MCFG_DEVICE_ADD( "tms9918", TMS9918A, XTAL_10_738635MHz / 2 ) /* Exact model not verified */ + MCFG_TMS9928A_VRAM_SIZE(0x4000) /* Not verified */ + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(myvision_state, vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9918", tms9918a_device, screen_update ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_10_738635MHz/3/2) /* Exact model and clock not verified */ + MCFG_AY8910_PORT_A_READ_CB(READ8(myvision_state, ay_port_a_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(myvision_state, ay_port_b_r)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(myvision_state, ay_port_a_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(myvision_state, ay_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "myvision_cart") + MCFG_GENERIC_LOAD(myvision_state, cart) + //MCFG_GENERIC_MANDATORY + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","myvision") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( myvision ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1983, myvision, 0, 0, myvision, myvision, driver_device, 0, "Nichibutsu", "My Vision (KH-1000)", 0 ) diff --git a/src/mame/drivers/mz2000.c b/src/mame/drivers/mz2000.c new file mode 100644 index 00000000000..1fa43c6fcd6 --- /dev/null +++ b/src/mame/drivers/mz2000.c @@ -0,0 +1,908 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Sharp MZ-2000 + + driver by Angelo Salese + font conversion by Tomasz Slanina + + Basically a simpler version of Sharp MZ-2500 + + TODO: + - cassette interface, basically any program that's bigger than 8kb fails to load; + - implement remaining video capabilities + - add 80b compatibility support; + - Vosque (color): keyboard doesn't work properly; + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80pio.h" +#include "machine/i8255.h" +#include "machine/wd_fdc.h" +#include "machine/pit8253.h" +#include "sound/beep.h" +#include "sound/wave.h" +#include "machine/rp5c15.h" +#include "imagedev/cassette.h" +#include "imagedev/flopdrv.h" +#include "formats/2d_dsk.h" +#include "formats/mz_cas.h" + +#define MASTER_CLOCK XTAL_17_73447MHz/5 /* TODO: was 4 MHz, but otherwise cassette won't work due of a bug with MZF support ... */ + + +class mz2000_state : public driver_device +{ +public: + mz2000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cass(*this, "cassette"), + m_floppy(NULL), + m_maincpu(*this, "maincpu"), + m_mb8877a(*this, "mb8877a"), + m_floppy0(*this, "mb8877a:0"), + m_floppy1(*this, "mb8877a:1"), + m_floppy2(*this, "mb8877a:2"), + m_floppy3(*this, "mb8877a:3"), + m_pit8253(*this, "pit"), + m_beeper(*this, "beeper"), + m_region_tvram(*this, "tvram"), + m_region_gvram(*this, "gvram"), + m_region_chargen(*this, "chargen"), + m_region_ipl(*this, "ipl"), + m_region_wram(*this, "wram"), + m_io_key0(*this, "KEY0"), + m_io_key1(*this, "KEY1"), + m_io_key2(*this, "KEY2"), + m_io_key3(*this, "KEY3"), + m_io_key4(*this, "KEY4"), + m_io_key5(*this, "KEY5"), + m_io_key6(*this, "KEY6"), + m_io_key7(*this, "KEY7"), + m_io_key8(*this, "KEY8"), + m_io_key9(*this, "KEY9"), + m_io_keya(*this, "KEYA"), + m_io_keyb(*this, "KEYB"), + m_io_keyc(*this, "KEYC"), + m_io_keyd(*this, "KEYD"), + m_io_unused(*this, "UNUSED"), + m_io_config(*this, "CONFIG"), + m_palette(*this, "palette") { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_cass; + + floppy_image_device *m_floppy; + + UINT8 m_ipl_enable; + UINT8 m_tvram_enable; + UINT8 m_gvram_enable; + UINT8 m_gvram_bank; + + UINT8 m_key_mux; + + UINT8 m_old_portc; + UINT8 m_width80; + UINT8 m_tvram_attr; + UINT8 m_gvram_mask; + + UINT8 m_color_mode; + UINT8 m_has_fdc; + UINT8 m_hi_mode; + + UINT8 m_porta_latch; + UINT8 m_tape_ctrl; + DECLARE_READ8_MEMBER(mz2000_ipl_r); + DECLARE_READ8_MEMBER(mz2000_wram_r); + DECLARE_WRITE8_MEMBER(mz2000_wram_w); + DECLARE_READ8_MEMBER(mz2000_tvram_r); + DECLARE_WRITE8_MEMBER(mz2000_tvram_w); + DECLARE_READ8_MEMBER(mz2000_gvram_r); + DECLARE_WRITE8_MEMBER(mz2000_gvram_w); + DECLARE_READ8_MEMBER(mz2000_mem_r); + DECLARE_WRITE8_MEMBER(mz2000_mem_w); + DECLARE_WRITE8_MEMBER(mz2000_gvram_bank_w); + DECLARE_WRITE8_MEMBER(floppy_select_w); + DECLARE_WRITE8_MEMBER(floppy_side_w); + DECLARE_WRITE8_MEMBER(timer_w); + DECLARE_WRITE8_MEMBER(mz2000_tvram_attr_w); + DECLARE_WRITE8_MEMBER(mz2000_gvram_mask_w); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_mz2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); + DECLARE_READ8_MEMBER(mz2000_porta_r); + DECLARE_READ8_MEMBER(mz2000_portb_r); + DECLARE_READ8_MEMBER(mz2000_portc_r); + DECLARE_WRITE8_MEMBER(mz2000_porta_w); + DECLARE_WRITE8_MEMBER(mz2000_portb_w); + DECLARE_WRITE8_MEMBER(mz2000_portc_w); + DECLARE_WRITE8_MEMBER(mz2000_pio1_porta_w); + DECLARE_READ8_MEMBER(mz2000_pio1_portb_r); + DECLARE_READ8_MEMBER(mz2000_pio1_porta_r); + +protected: + required_device m_maincpu; + required_device m_mb8877a; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_device m_pit8253; + required_device m_beeper; + required_memory_region m_region_tvram; + required_memory_region m_region_gvram; + required_memory_region m_region_chargen; + required_memory_region m_region_ipl; + required_memory_region m_region_wram; + required_ioport m_io_key0; + required_ioport m_io_key1; + required_ioport m_io_key2; + required_ioport m_io_key3; + required_ioport m_io_key4; + required_ioport m_io_key5; + required_ioport m_io_key6; + required_ioport m_io_key7; + required_ioport m_io_key8; + required_ioport m_io_key9; + required_ioport m_io_keya; + required_ioport m_io_keyb; + required_ioport m_io_keyc; + required_ioport m_io_keyd; + required_ioport m_io_unused; + required_ioport m_io_config; + required_device m_palette; +}; + +void mz2000_state::video_start() +{ +} + +UINT32 mz2000_state::screen_update_mz2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *tvram = m_region_tvram->base(); + UINT8 *gvram = m_region_gvram->base(); + UINT8 *gfx_data = m_region_chargen->base(); + int x,y,xi,yi; + UINT8 x_size; + UINT32 count; + + count = 0; + + for(y=0;y<200;y++) + { + for(x=0;x<640;x+=8) + { + for(xi=0;xi<8;xi++) + { + int pen; + pen = ((gvram[count+0x4000] >> (xi)) & 1) ? 1 : 0; //B + pen |= ((gvram[count+0x8000] >> (xi)) & 1) ? 2 : 0; //R + pen |= ((gvram[count+0xc000] >> (xi)) & 1) ? 4 : 0; //G + pen &= m_gvram_mask; + + bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen); + bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen); + } + count++; + } + } + + x_size = (m_width80+1)*40; + + for(y=0;y<25;y++) + { + for(x=0;x 640-1 || res_y > (200*(m_hi_mode+1))-1) + continue; + + tile_offset = tile*(8*(m_hi_mode+1))+yi + (m_hi_mode * 0x800); + + pen = ((gfx_data[tile_offset] >> (7-xi)) & 1) ? color : -1; + + /* TODO: clean this up */ + if(pen != -1) + { + if(m_hi_mode) + { + if(m_width80 == 0) + { + bitmap.pix16(res_y, res_x*2+0) = m_palette->pen(pen); + bitmap.pix16(res_y, res_x*2+1) = m_palette->pen(pen); + } + else + { + bitmap.pix16(res_y, res_x) = m_palette->pen(pen); + } + } + else + { + if(m_width80 == 0) + { + bitmap.pix16(res_y*2+0, res_x*2+0) = m_palette->pen(pen); + bitmap.pix16(res_y*2+0, res_x*2+1) = m_palette->pen(pen); + bitmap.pix16(res_y*2+1, res_x*2+0) = m_palette->pen(pen); + bitmap.pix16(res_y*2+1, res_x*2+1) = m_palette->pen(pen); + } + else + { + bitmap.pix16(res_y*2+0, res_x) = m_palette->pen(pen); + bitmap.pix16(res_y*2+1, res_x) = m_palette->pen(pen); + } + } + } + } + } + } + } + + return 0; +} + +READ8_MEMBER(mz2000_state::mz2000_ipl_r) +{ + return m_region_ipl->base()[offset]; +} + +READ8_MEMBER(mz2000_state::mz2000_wram_r) +{ + return m_region_wram->base()[offset]; +} + +WRITE8_MEMBER(mz2000_state::mz2000_wram_w) +{ + m_region_wram->base()[offset] = data; +} + +READ8_MEMBER(mz2000_state::mz2000_tvram_r) +{ + return m_region_tvram->base()[offset]; +} + +WRITE8_MEMBER(mz2000_state::mz2000_tvram_w) +{ + m_region_tvram->base()[offset] = data; +} + +READ8_MEMBER(mz2000_state::mz2000_gvram_r) +{ + return m_region_gvram->base()[offset+m_gvram_bank*0x4000]; +} + +WRITE8_MEMBER(mz2000_state::mz2000_gvram_w) +{ + m_region_gvram->base()[offset+m_gvram_bank*0x4000] = data; +} + + +READ8_MEMBER(mz2000_state::mz2000_mem_r) +{ + UINT8 page_mem; + + page_mem = (offset & 0xf000) >> 12; + + if(page_mem == 0 && m_ipl_enable) + return mz2000_ipl_r(space,offset & 0xfff); + + if(((page_mem & 8) == 0) && m_ipl_enable == 0) // if ipl is enabled, 0x1000 - 0x7fff accesses to dummy region + return mz2000_wram_r(space,offset); + + if(page_mem & 8) + { + if(page_mem == 0xd && m_tvram_enable) + return mz2000_tvram_r(space,offset & 0xfff); + else if(page_mem >= 0xc && m_gvram_enable) + return mz2000_gvram_r(space,offset & 0x3fff); + else + { + UINT16 wram_mask = (m_ipl_enable) ? 0x7fff : 0xffff; + return mz2000_wram_r(space,offset & wram_mask); + } + } + + return 0xff; +} + +WRITE8_MEMBER(mz2000_state::mz2000_mem_w) +{ + UINT8 page_mem; + + page_mem = (offset & 0xf000) >> 12; + + if((page_mem & 8) == 0 && m_ipl_enable == 0) + mz2000_wram_w(space,offset,data); + + if(page_mem & 8) + { + if(page_mem == 0xd && m_tvram_enable) + mz2000_tvram_w(space,offset & 0xfff,data); + else if(page_mem >= 0xc && m_gvram_enable) + mz2000_gvram_w(space,offset & 0x3fff,data); + else + { + UINT16 wram_mask = (m_ipl_enable) ? 0x7fff : 0xffff; + + mz2000_wram_w(space,offset & wram_mask,data); + } + } +} + +WRITE8_MEMBER(mz2000_state::mz2000_gvram_bank_w) +{ + m_gvram_bank = data & 3; +} + +READ8_MEMBER(mz2000_state::fdc_r) +{ + if(m_has_fdc) + return m_mb8877a->read(space, offset) ^ 0xff; + + return 0xff; +} + +WRITE8_MEMBER(mz2000_state::fdc_w) +{ + if(m_has_fdc) + m_mb8877a->write(space, offset, data ^ 0xff); +} + +WRITE8_MEMBER(mz2000_state::floppy_select_w) +{ + switch (data & 0x03) + { + case 0: m_floppy = m_floppy0->get_device(); break; + case 1: m_floppy = m_floppy1->get_device(); break; + case 2: m_floppy = m_floppy2->get_device(); break; + case 3: m_floppy = m_floppy3->get_device(); break; + } + + m_mb8877a->set_floppy(m_floppy); + + // todo: bit 2 is connected to something too... + + if (m_floppy) + m_floppy->mon_w(!BIT(data, 7)); +} + +WRITE8_MEMBER(mz2000_state::floppy_side_w) +{ + if (m_floppy) + m_floppy->ss_w(BIT(data, 0)); +} + +WRITE8_MEMBER(mz2000_state::timer_w) +{ + m_pit8253->write_gate0(1); + m_pit8253->write_gate1(1); + m_pit8253->write_gate0(0); + m_pit8253->write_gate1(0); + m_pit8253->write_gate0(1); + m_pit8253->write_gate1(1); +} + +WRITE8_MEMBER(mz2000_state::mz2000_tvram_attr_w) +{ + m_tvram_attr = data; +} + +WRITE8_MEMBER(mz2000_state::mz2000_gvram_mask_w) +{ + m_gvram_mask = data; +} + +static ADDRESS_MAP_START(mz2000_map, AS_PROGRAM, 8, mz2000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xffff ) AM_READWRITE(mz2000_mem_r,mz2000_mem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mz2000_io, AS_IO, 8, mz2000_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xd8, 0xdb) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0xdc, 0xdc) AM_WRITE(floppy_select_w) + AM_RANGE(0xdd, 0xdd) AM_WRITE(floppy_side_w) + AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("i8255_0", i8255_device, read, write) + AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("pit", pit8253_device, read, write) + AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) + AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w) +// AM_RANGE(0xf4, 0xf7) CRTC + AM_RANGE(0xf5, 0xf5) AM_WRITE(mz2000_tvram_attr_w) + AM_RANGE(0xf6, 0xf6) AM_WRITE(mz2000_gvram_mask_w) + AM_RANGE(0xf7, 0xf7) AM_WRITE(mz2000_gvram_bank_w) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( mz2000 ) + PORT_START("KEY0") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + + PORT_START("KEY1") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("00 (PAD)") //PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) + + PORT_START("KEY2") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) + + PORT_START("KEY3") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BREAK") //PORT_CODE(KEYCODE_ESC) + + PORT_START("KEY4") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") //PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("KEY5") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("KEY6") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("KEY7") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("\\") + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("_") + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(".") + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(",") + + PORT_START("KEY8") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("KEY9") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(":") + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(";") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@") + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[") + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYA") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYB") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SLOCK") + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RVS") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_UNUSED) + PORT_BIT(0xe0,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYC") + PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYD") + PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("UNUSED") + PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED ) + + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Video Board" ) + PORT_CONFSETTING( 0x00, "Monochrome" ) + PORT_CONFSETTING( 0x01, "Color" ) + PORT_CONFNAME( 0x02, 0x02, "Floppy Device" ) + PORT_CONFSETTING( 0x00, DEF_STR( No ) ) + PORT_CONFSETTING( 0x02, DEF_STR( Yes ) ) + PORT_CONFNAME( 0x04, 0x04, "High Resolution" ) + PORT_CONFSETTING( 0x00, DEF_STR( No ) ) + PORT_CONFSETTING( 0x04, DEF_STR( Yes ) ) +INPUT_PORTS_END + + +void mz2000_state::machine_reset() +{ + m_ipl_enable = 1; + m_tvram_enable = 0; + m_gvram_enable = 0; + + m_beeper->set_frequency(4096); + m_beeper->set_state(0); + + m_color_mode = m_io_config->read() & 1; + m_has_fdc = (m_io_config->read() & 2) >> 1; + m_hi_mode = (m_io_config->read() & 4) >> 2; +} + + +static const gfx_layout mz2000_charlayout_8 = +{ + 8, 8, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout mz2000_charlayout_16 = +{ + 8, 16, + 256, + 1, + { 0 }, + { STEP8(0,1) }, + { STEP16(0,8) }, + 8*16 +}; + +static GFXDECODE_START( mz2000 ) + GFXDECODE_ENTRY( "chargen", 0x0000, mz2000_charlayout_8, 0, 1 ) + GFXDECODE_ENTRY( "chargen", 0x0800, mz2000_charlayout_16, 0, 1 ) +GFXDECODE_END + +READ8_MEMBER(mz2000_state::mz2000_porta_r) +{ + printf("A R\n"); + return 0xff; +} + +READ8_MEMBER(mz2000_state::mz2000_portb_r) +{ + /* + x--- ---- break key + -x-- ---- read tape data + --x- ---- no tape signal + ---x ---- no tape write signal + ---- x--- end of tape reached + ---- ---x "blank" control + */ + UINT8 res = 0x80; + + if(m_cass->get_image() != NULL) + { + res |= (m_cass->input() > 0.0038) ? 0x40 : 0x00; + res |= ((m_cass->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) ? 0x00 : 0x20; + res |= (m_cass->get_position() >= m_cass->get_length()) ? 0x08 : 0x00; + } + else + res |= 0x20; + + res |= (machine().first_screen()->vblank()) ? 0x00 : 0x01; + + return res; +} + +READ8_MEMBER(mz2000_state::mz2000_portc_r) +{ + printf("C R\n"); + return 0xff; +} + +WRITE8_MEMBER(mz2000_state::mz2000_porta_w) +{ + /* + These are enabled thru a 0->1 transition + x--- ---- tape "APSS" + -x-- ---- tape "APLAY" + --x- ---- tape "AREW" + ---x ---- reverse video + ---- x--- tape stop + ---- -x-- tape play + ---- --x- tape ff + ---- ---x tape rewind + */ + + if((m_tape_ctrl & 0x80) == 0 && data & 0x80) + { + //printf("Tape APSS control\n"); + } + + if((m_tape_ctrl & 0x40) == 0 && data & 0x40) + { + //printf("Tape APLAY control\n"); + } + + if((m_tape_ctrl & 0x20) == 0 && data & 0x20) + { + //printf("Tape AREW control\n"); + } + + if((m_tape_ctrl & 0x10) == 0 && data & 0x10) + { + //printf("reverse video control\n"); + } + + if((m_tape_ctrl & 0x08) == 0 && data & 0x08) // stop + { + m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cass->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + } + + if((m_tape_ctrl & 0x04) == 0 && data & 0x04) // play + { + m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + m_cass->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); + } + + if((m_tape_ctrl & 0x02) == 0 && data & 0x02) + { + //printf("Tape FF control\n"); + } + + if((m_tape_ctrl & 0x01) == 0 && data & 0x01) + { + //printf("Tape Rewind control\n"); + } + + m_tape_ctrl = data; +} + +WRITE8_MEMBER(mz2000_state::mz2000_portb_w) +{ + //printf("B W %02x\n",data); + + // ... +} + +WRITE8_MEMBER(mz2000_state::mz2000_portc_w) +{ + /* + x--- ---- tape data write + -x-- ---- tape rec + --x- ---- tape ? + ---x ---- tape open + ---- x--- 0->1 transition = IPL reset + ---- -x-- beeper state + ---- --x- 0->1 transition = Work RAM reset + */ + //printf("C W %02x\n",data); + + if(((m_old_portc & 8) == 0) && data & 8) + m_ipl_enable = 1; + + if(((m_old_portc & 2) == 0) && data & 2) + { + m_ipl_enable = 0; + /* correct? */ + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + } + + m_beeper->set_state(data & 0x04); + + m_old_portc = data; +} + +WRITE8_MEMBER(mz2000_state::mz2000_pio1_porta_w) +{ + m_tvram_enable = ((data & 0xc0) == 0xc0); + m_gvram_enable = ((data & 0xc0) == 0x80); + m_width80 = ((data & 0x20) >> 5); + m_key_mux = data & 0x1f; + + m_porta_latch = data; +} + +READ8_MEMBER(mz2000_state::mz2000_pio1_portb_r) +{ + ioport_port* keynames[] = { m_io_key0, m_io_key1, m_io_key2, m_io_key3, + m_io_key4, m_io_key5, m_io_key6, m_io_key7, + m_io_key8, m_io_key9, m_io_keya, m_io_keyb, + m_io_keyc, m_io_keyd, m_io_unused, m_io_unused }; + + if(((m_key_mux & 0x10) == 0x00) || ((m_key_mux & 0x0f) == 0x0f)) //status read + { + int res,i; + + res = 0xff; + for(i=0;i<0xe;i++) + res &= keynames[i]->read(); + + return res; + } + + return keynames[m_key_mux & 0xf]->read(); +} + +READ8_MEMBER(mz2000_state::mz2000_pio1_porta_r) +{ + return m_porta_latch; +} + + +FLOPPY_FORMATS_MEMBER( mz2000_state::floppy_formats ) + FLOPPY_2D_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( mz2000_floppies ) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( mz2000, mz2000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, MASTER_CLOCK) + MCFG_CPU_PROGRAM_MAP(mz2000_map) + MCFG_CPU_IO_MAP(mz2000_io) + + MCFG_DEVICE_ADD("i8255_0", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mz2000_state, mz2000_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mz2000_state, mz2000_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(mz2000_state, mz2000_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mz2000_state, mz2000_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(mz2000_state, mz2000_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mz2000_state, mz2000_portc_w)) + + MCFG_DEVICE_ADD("z80pio_1", Z80PIO, MASTER_CLOCK) + MCFG_Z80PIO_IN_PA_CB(READ8(mz2000_state, mz2000_pio1_porta_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(mz2000_state, mz2000_pio1_porta_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(mz2000_state, mz2000_pio1_portb_r)) + + /* TODO: clocks aren't known */ + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(31250) + MCFG_PIT8253_CLK1(31250) /* needed by "Art Magic" to boot */ + MCFG_PIT8253_CLK2(31250) + + MCFG_MB8877_ADD("mb8877a", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("mb8877a:0", mz2000_floppies, "dd", mz2000_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:1", mz2000_floppies, "dd", mz2000_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:2", mz2000_floppies, "dd", mz2000_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:3", mz2000_floppies, "dd", mz2000_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "mz2000_flop") + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(mz700_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("mz_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","mz2000_cass") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) + MCFG_SCREEN_UPDATE_DRIVER(mz2000_state, screen_update_mz2000) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz2000) + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15) +MACHINE_CONFIG_END + + + +ROM_START( mz2000 ) + ROM_REGION( 0x1000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "mz20ipl.bin",0x0000, 0x0800, CRC(d7ccf37f) SHA1(692814ffc2cf50fa8bf9e30c96ebe4a9ee536a86)) + + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x10000, "wram", ROMREGION_ERASE00 ) + //ROM_LOAD( "vosque2000.mzt",0x0000, 0x80, CRC(1) SHA1(1)) + //ROM_CONTINUE( 0x0000, 0x7f80 ) + + ROM_REGION( 0x1000, "tvram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x10000, "gvram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x1800, "chargen", 0 ) +// ROM_LOAD( "mzfont.rom", 0x0000, 0x0800, BAD_DUMP CRC(0631efc3) SHA1(99b206af5c9845995733d877e9e93e9681b982a8) ) //original has JP characters + /* these are hand-crafted roms, converted from bmps floating around the net */ + ROM_LOAD( "font.bin", 0x0000, 0x0800, BAD_DUMP CRC(6ae6ce8e) SHA1(6adcdab9e4647429dd8deb73146264746b5eccda) ) + ROM_LOAD( "font400.bin", 0x0800, 0x1000, BAD_DUMP CRC(56c5d2bc) SHA1(fea655ff5eedacf8978fa3c185485db44376e24d) ) +ROM_END + +ROM_START( mz2200 ) + ROM_REGION( 0x10000, "ipl", 0 ) + ROM_LOAD( "mz2200ipl.bin", 0x0000, 0x0800, CRC(476801e8) SHA1(6b1f0620945c5492475ea1694bd09a3fcf88549d) ) + + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x10000, "wram", ROMREGION_ERASE00 ) + //ROM_LOAD( "vosque2000.mzt",0x0000, 0x80, CRC(1) SHA1(1)) + //ROM_CONTINUE( 0x0000, 0x7f80 ) + + ROM_REGION( 0x1000, "tvram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x10000, "gvram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x1800, "chargen", 0 ) +// ROM_LOAD( "mzfont.rom", 0x0000, 0x0800, BAD_DUMP CRC(0631efc3) SHA1(99b206af5c9845995733d877e9e93e9681b982a8) ) //original has JP characters + /* these are hand-crafted roms, converted from bmps floating around the net */ + ROM_LOAD( "font.bin", 0x0000, 0x0800, BAD_DUMP CRC(6ae6ce8e) SHA1(6adcdab9e4647429dd8deb73146264746b5eccda) ) + ROM_LOAD( "font400.bin", 0x0800, 0x1000, BAD_DUMP CRC(56c5d2bc) SHA1(fea655ff5eedacf8978fa3c185485db44376e24d) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, mz2000, mz80b, 0, mz2000, mz2000, driver_device, 0, "Sharp", "MZ-2000", MACHINE_NOT_WORKING ) +COMP( 1982, mz2200, mz80b, 0, mz2000, mz2000, driver_device, 0, "Sharp", "MZ-2200", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/mz2500.c b/src/mame/drivers/mz2500.c new file mode 100644 index 00000000000..9e30a8c2ac5 --- /dev/null +++ b/src/mame/drivers/mz2500.c @@ -0,0 +1,2201 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/******************************************************************************************************************************** + + Sharp MZ-2500 (c) 1985 Sharp Corporation + + driver by Angelo Salese + + TODO: + - Kanji text is cutted in half when font_size is 1 / interlace is disabled, different ROM used? (check Back to the Future); + - Implement external ROM hook-up; + - Add remaining missing peripherals, SIO, HDD and w1300a network; + - FDC loading without the IPLPRO doesn't work at all, why? + - reverse / blanking tvram attributes; + - clean-ups! ^^' + + per-game/program specific TODO: + - Dust Box vol. 1-3: they die with text garbage, might be bad dumps; + - Dust Box vol. 4: window effect transition is bugged; + - Dust Box vol. n: three items returns "purple" text, presumably HW failures (DFJustin: joystick "digital", mouse "not installed", HDD "not installed"); + - LayDock: hangs at title screen due of a PIT bug (timer irq dies for whatever reason); + - Moon Child: needs mixed 3+3bpp tvram supported, kludged for now (not a real test case); + - Moon Child: window masking doesn't mask bottom part of the screen? + - Moon Child: appears to be a network / system link game, obviously doesn't work with current MAME / MESS framework; + - Marchen Veil I: doesn't load if you try to run it directly, it does if you load another game first (for example Mappy) then do a soft reset; + - Mugen no Shinzou II - The Prince of Darkness: dies on IPLPRO loading, presumably a wd17xx core bug; + - Multiplan: random hangs/crashes after you set the RTC, sometimes it loads properly; + - Murder Club: has lots of CG artifacts, FDC issue? + - Orrbit 3: floppy issue makes it to throw a game over as soon as you start a game; + - Penguin Kun Wars: has a bug with window effects ("Push space or trigger" msg on the bottom"), needs investigation; + - Sound Gal Music Editor: wants a "master disk", that apparently isn't available; + - Yukar K2 (normal version): moans about something, DFJustin: "please put the system disk back to normal", disk write-protected? + + memory map: + 0x00000-0x3ffff Work RAM + 0x40000-0x5ffff CG RAM + 0x60000-0x67fff "Read modify write" area (related to the CG RAM) (0x30-0x33) + 0x68000-0x6ffff IPL ROM (0x34-0x37) + 0x70000-0x71fff TVRAM (0x38) + 0x72000-0x73fff Kanji ROM / PCG RAM (banked) (0x39) + 0x74000-0x75fff Dictionary ROM (banked) (0x3a) + 0x76000-0x77fff NOP (0x3b) + 0x78000-0x7ffff Phone ROM (0x3c-0x3f) + +********************************************************************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/i8255.h" +#include "machine/wd_fdc.h" +#include "machine/pit8253.h" +#include "sound/2203intf.h" +#include "sound/beep.h" +#include "machine/rp5c15.h" + +//#include "imagedev/cassette.h" +#include "imagedev/flopdrv.h" + +#define RP5C15_TAG "rp5c15" + +class mz2500_state : public driver_device +{ +public: + mz2500_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_rtc(*this, RP5C15_TAG), + m_pit(*this, "pit"), + m_beeper(*this, "beeper"), + m_gfxdecode(*this, "gfxdecode"), + m_fdc(*this, "mb8877a"), + m_floppy0(*this, "mb8877a:0"), + m_floppy1(*this, "mb8877a:1"), + m_floppy2(*this, "mb8877a:2"), + m_floppy3(*this, "mb8877a:3"), + m_floppy(NULL), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_rtc; + required_device m_pit; + required_device m_beeper; + required_device m_gfxdecode; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + + floppy_image_device *m_floppy; + + UINT8 *m_main_ram; + UINT8 *m_ipl_rom; + UINT8 *m_kanji_rom; + UINT8 *m_kanji2_rom; + UINT8 *m_pcg_ram; + UINT8 *m_emm_ram; + UINT8 *m_dic_rom; + UINT8 *m_phone_rom; + UINT8 *m_iplpro_rom; + + UINT8 m_bank_val[8]; + UINT8 m_bank_addr; + UINT8 m_irq_sel; + UINT8 m_irq_vector[4]; + UINT8 m_irq_mask[4]; + UINT8 m_irq_pending[4]; + UINT8 m_kanji_bank; + UINT8 m_dic_bank; + UINT8 m_fdc_reverse; + UINT8 m_key_mux; + UINT8 m_monitor_type; + UINT8 m_text_reg[0x100]; + UINT8 m_text_reg_index; + UINT8 m_text_col_size; + UINT8 m_text_font_reg; + UINT8 m_pal_select; + UINT16 m_cg_vs; + UINT16 m_cg_ve; + UINT16 m_cg_hs; + UINT16 m_cg_he; + INT16 m_tv_vs; + INT16 m_tv_ve; + INT16 m_tv_hs; + INT16 m_tv_he; + UINT8 m_cg_latch[4]; + UINT8 m_cg_reg_index; + UINT8 m_cg_reg[0x20]; + UINT8 m_clut16[0x10]; + UINT16 m_clut256[0x100]; + UINT8 m_cg_mask; + int m_scr_x_size; + int m_scr_y_size; + UINT8 m_cg_clear_flag; + UINT32 m_rom_index; + UINT8 m_hrom_index; + UINT8 m_lrom_index; + struct { UINT8 r,g,b; } m_pal[16]; + UINT8 m_joy_mode; + UINT16 m_kanji_index; + UINT32 m_emm_offset; + UINT8 m_old_portc; + UINT8 m_prev_col_val; + UINT8 m_pio_latchb; + UINT8 m_ym_porta; + UINT8 m_screen_enable; + DECLARE_READ8_MEMBER(bank0_r); + DECLARE_READ8_MEMBER(bank1_r); + DECLARE_READ8_MEMBER(bank2_r); + DECLARE_READ8_MEMBER(bank3_r); + DECLARE_READ8_MEMBER(bank4_r); + DECLARE_READ8_MEMBER(bank5_r); + DECLARE_READ8_MEMBER(bank6_r); + DECLARE_READ8_MEMBER(bank7_r); + DECLARE_WRITE8_MEMBER(bank0_w); + DECLARE_WRITE8_MEMBER(bank1_w); + DECLARE_WRITE8_MEMBER(bank2_w); + DECLARE_WRITE8_MEMBER(bank3_w); + DECLARE_WRITE8_MEMBER(bank4_w); + DECLARE_WRITE8_MEMBER(bank5_w); + DECLARE_WRITE8_MEMBER(bank6_w); + DECLARE_WRITE8_MEMBER(bank7_w); + DECLARE_READ8_MEMBER(mz2500_bank_addr_r); + DECLARE_WRITE8_MEMBER(mz2500_bank_addr_w); + DECLARE_READ8_MEMBER(mz2500_bank_data_r); + DECLARE_WRITE8_MEMBER(mz2500_bank_data_w); + DECLARE_WRITE8_MEMBER(mz2500_kanji_bank_w); + DECLARE_WRITE8_MEMBER(mz2500_dictionary_bank_w); + DECLARE_READ8_MEMBER(mz2500_crtc_hvblank_r); + DECLARE_WRITE8_MEMBER(mz2500_tv_crtc_w); + DECLARE_WRITE8_MEMBER(mz2500_irq_sel_w); + DECLARE_WRITE8_MEMBER(mz2500_irq_data_w); + DECLARE_READ8_MEMBER(mz2500_rom_r); + DECLARE_WRITE8_MEMBER(mz2500_rom_w); + DECLARE_WRITE8_MEMBER(palette4096_io_w); + DECLARE_READ8_MEMBER(mz2500_bplane_latch_r); + DECLARE_READ8_MEMBER(mz2500_rplane_latch_r); + DECLARE_READ8_MEMBER(mz2500_gplane_latch_r); + DECLARE_READ8_MEMBER(mz2500_iplane_latch_r); + DECLARE_WRITE8_MEMBER(mz2500_cg_addr_w); + DECLARE_WRITE8_MEMBER(mz2500_cg_data_w); + DECLARE_WRITE8_MEMBER(timer_w); + DECLARE_READ8_MEMBER(mz2500_joystick_r); + DECLARE_WRITE8_MEMBER(mz2500_joystick_w); + DECLARE_READ8_MEMBER(mz2500_kanji_r); + DECLARE_WRITE8_MEMBER(mz2500_kanji_w); + DECLARE_READ8_MEMBER(rp5c15_8_r); + DECLARE_WRITE8_MEMBER(rp5c15_8_w); + DECLARE_READ8_MEMBER(mz2500_emm_data_r); + DECLARE_WRITE8_MEMBER(mz2500_emm_addr_w); + DECLARE_WRITE8_MEMBER(mz2500_emm_data_w); + UINT8 mz2500_cg_latch_compare(); + UINT8 mz2500_ram_read(UINT16 offset, UINT8 bank_num); + void mz2500_ram_write(UINT16 offset, UINT8 data, UINT8 bank_num); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(mz2500); + UINT32 screen_update_mz2500(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(mz2500_vbl); + + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); + DECLARE_WRITE8_MEMBER(floppy_select_w); + DECLARE_WRITE8_MEMBER(floppy_side_w); + + DECLARE_READ8_MEMBER(mz2500_porta_r); + DECLARE_READ8_MEMBER(mz2500_portb_r); + DECLARE_READ8_MEMBER(mz2500_portc_r); + DECLARE_WRITE8_MEMBER(mz2500_porta_w); + DECLARE_WRITE8_MEMBER(mz2500_portb_w); + DECLARE_WRITE8_MEMBER(mz2500_portc_w); + DECLARE_WRITE8_MEMBER(mz2500_pio1_porta_w); + DECLARE_READ8_MEMBER(mz2500_pio1_porta_r); + DECLARE_READ8_MEMBER(mz2500_pio1_portb_r); + DECLARE_READ8_MEMBER(opn_porta_r); + DECLARE_WRITE8_MEMBER(opn_porta_w); + DECLARE_WRITE_LINE_MEMBER(pit8253_clk0_irq); + DECLARE_WRITE_LINE_MEMBER(mz2500_rtc_alarm_irq); + IRQ_CALLBACK_MEMBER( mz2500_irq_ack ); + + void draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr); + void draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr); + void draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri); + void draw_cg16_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri); + void draw_cg256_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri); + void draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect); + void draw_cg_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri); + + void mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,UINT16 pen,UINT8 width,UINT8 height); + void mz2500_reconfigure_screen(); + UINT8 pal_256_param(int index, int param); + void mz2500_reset(mz2500_state *state, UINT8 type); + required_device m_palette; +}; + + +/* machine stuff */ + +#define WRAM_RESET 0 +#define IPL_RESET 1 + +static const UINT8 bank_reset_val[2][8] = +{ + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }, + { 0x34, 0x35, 0x36, 0x37, 0x04, 0x05, 0x06, 0x07 } +}; + +/* video stuff*/ + +void mz2500_state::video_start() +{ +} + +/* +[0] xxxx xxxx tile +[1] ---- -xxx color offset +[1] ---- x--- PCG combine mode +[1] --xx ---- PCG select +[1] xx-- ---- reverse / blink attributes +[2] --xx xxxx tile bank (for kanji ROMs) +[2] xx-- ---- kanji select +*/ + +/* helper function, to draw stuff without getting crazy with height / width conditions :) */ +void mz2500_state::mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,UINT16 pen,UINT8 width,UINT8 height) +{ + if(width && height) + { + bitmap.pix16(y*2+0, x*2+0) = m_palette->pen(pen); + bitmap.pix16(y*2+0, x*2+1) = m_palette->pen(pen); + bitmap.pix16(y*2+1, x*2+0) = m_palette->pen(pen); + bitmap.pix16(y*2+1, x*2+1) = m_palette->pen(pen); + } + else if(width) + { + bitmap.pix16(y, x*2+0) = m_palette->pen(pen); + bitmap.pix16(y, x*2+1) = m_palette->pen(pen); + } + else if(height) + { + bitmap.pix16(y*2+0, x) = m_palette->pen(pen); + bitmap.pix16(y*2+1, x) = m_palette->pen(pen); + } + else + bitmap.pix16(y, x) = m_palette->pen(pen); +} + +void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr) +{ + UINT8 *vram = m_main_ram; // TODO + int x,y,count,xi,yi; + UINT8 *gfx_data; + UINT8 y_step; + UINT8 s_y; + UINT8 y_height; + + count = (map_addr & 0x7ff); + + y_step = (m_text_font_reg) ? 1 : 2; + y_height = (m_text_reg[0] & 0x10) ? 10 : 8; + s_y = m_text_reg[9] & 0xf; + + for (y=0;y<26*y_step;y+=y_step) + { + for (x=0;x<80;x++) + { + int tile = vram[0x70000+count+0x0000] & 0xff; + int attr = vram[0x70000+count+0x0800]; + int tile_bank = vram[0x70000+count+0x1000] & 0x3f; + int gfx_sel = (attr & 0x38) | (vram[0x70000+count+0x1000] & 0xc0); + int color = attr & 7; + int inv_col = (attr & 0x40) >> 6; + + if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms + gfx_data = m_pcg_ram; + else if(gfx_sel == 0x80) + { + gfx_data = m_kanji_rom; + tile|= tile_bank << 8; + if(y_step == 2) + tile &= 0x3ffe; + } + else if(gfx_sel == 0xc0) + { + gfx_data = m_kanji_rom; + tile|= (tile_bank << 8); + if(y_step == 2) + tile &= 0x3ffe; + tile|=0x4000; + } + else + { + gfx_data = m_pcg_ram; + } + + for(yi=0;yi<8*y_step;yi++) + { + for(xi=0;xi<8;xi++) + { + UINT8 pen_bit[3],pen; + int res_x,res_y; + + res_x = x*8+xi; + res_y = y*y_height+yi-s_y; + + /* check TV window boundaries */ + if(res_x < m_tv_hs || res_x >= m_tv_he || res_y < m_tv_vs || res_y >= m_tv_ve) + continue; + + if(gfx_sel & 0x8) + { + pen_bit[0] = ((gfx_data[tile*8+yi+0x1800]>>(7-xi)) & 1) ? (4+8) : 0; //G + pen_bit[1] = ((gfx_data[tile*8+yi+0x1000]>>(7-xi)) & 1) ? (2+8) : 0; //R + pen_bit[2] = ((gfx_data[tile*8+yi+0x0800]>>(7-xi)) & 1) ? (1+8) : 0; //B + + pen = (pen_bit[0]|pen_bit[1]|pen_bit[2]); + + //if(inv_col) { pen ^= 7; } breaks Mappy + } + else + pen = (((gfx_data[tile*8+yi+((gfx_sel & 0x30)<<7)]>>(7-xi)) & 1) ^ inv_col) ? (color+8) : 0; + + if(pen) + { + if((res_y) >= 0 && (res_y) < 200*y_step) + mz2500_draw_pixel(bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),0,0); + } + } + } + + count++; + count&=0x7ff; + } + } +} + +void mz2500_state::draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr) +{ + UINT8 *vram = m_main_ram; // TODO + int x,y,count,xi,yi; + UINT8 *gfx_data; + UINT8 y_step; + UINT8 s_y; + UINT8 y_height; + + count = (((plane * 0x400) + map_addr) & 0x7ff); + + y_step = (m_text_font_reg) ? 1 : 2; + y_height = (m_text_reg[0] & 0x10) ? 10 : 8; + s_y = m_text_reg[9] & 0xf; + + for (y=0;y<26*y_step;y+=y_step) + { + for (x=0;x<40;x++) + { + int tile = vram[0x70000+count+0x0000] & 0xff; + int attr = vram[0x70000+count+0x0800]; + int tile_bank = vram[0x70000+count+0x1000] & 0x3f; + int gfx_sel = (attr & 0x38) | (vram[0x70000+count+0x1000] & 0xc0); + //int gfx_num; + int color = attr & 7; + int inv_col = (attr & 0x40) >> 6; + + if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms + gfx_data = m_pcg_ram; + else if(gfx_sel == 0x80) + { + gfx_data = m_kanji_rom; + tile|= tile_bank << 8; + if(y_step == 2) + tile &= 0x3ffe; + } + else if(gfx_sel == 0xc0) + { + gfx_data = m_kanji_rom; + tile|= (tile_bank << 8); + if(y_step == 2) + tile &= 0x3ffe; + tile|=0x4000; + } + else + { + gfx_data = m_pcg_ram; + } + + for(yi=0;yi<8*y_step;yi++) + { + for(xi=0;xi<8;xi++) + { + UINT8 pen_bit[3],pen; + int res_x,res_y; + + res_x = x*8+xi; + res_y = y*y_height+yi-s_y; + + /* check TV window boundaries */ + if(res_x < m_tv_hs || res_x >= m_tv_he || res_y < m_tv_vs || res_y >= m_tv_ve) + continue; + + if(gfx_sel & 0x8) + { + pen_bit[0] = ((gfx_data[tile*8+yi+0x1800]>>(7-xi)) & 1) ? (4+8) : 0; //G + pen_bit[1] = ((gfx_data[tile*8+yi+0x1000]>>(7-xi)) & 1) ? (2+8) : 0; //R + pen_bit[2] = ((gfx_data[tile*8+yi+0x0800]>>(7-xi)) & 1) ? (1+8) : 0; //B + + pen = (pen_bit[0]|pen_bit[1]|pen_bit[2]); + + //if(inv_col) { pen ^= 7; } breaks Mappy + } + else + pen = (((gfx_data[tile*8+yi+((gfx_sel & 0x30)<<7)]>>(7-xi)) & 1) ^ inv_col) ? (color+8) : 0; + + if(pen) + { + if((res_y) >= 0 && (res_y) < 200*y_step) + mz2500_draw_pixel(bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),m_scr_x_size == 640,0); + } + } + } + + count++; + count&=0x7ff; + } + } +} + +void mz2500_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) +{ + UINT32 count; + UINT8 *vram = m_main_ram; // TODO + UINT8 pen,pen_bit[2]; + int x,y,xi,pen_i; + int res_x,res_y; + + count = 0x40000; + + for(y=0;y<400;y++) + { + for(x=0;x<640;x+=8) + { + for(xi=0;xi<8;xi++) + { + res_x = x+xi; + res_y = y; + + /* check window boundaries */ + //if(res_x < m_cg_hs || res_x >= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) + // continue; + + /* TODO: very preliminary, just Yukar K2 uses this so far*/ + pen_bit[0] = (vram[count + 0x00000]>>(xi)) & 1 ? 7 : 0; // B + pen_bit[1] = (vram[count + 0x0c000]>>(xi)) & 1 ? 7 : 0; // R + + pen = 0; + for(pen_i=0;pen_i<2;pen_i++) + pen |= pen_bit[pen_i]; + + { + //if(pri == ((m_clut256[pen] & 0x100) >> 8)) + mz2500_draw_pixel(bitmap,res_x,res_y,pen,0,0); + } + } + count++; + } + } +} + +void mz2500_state::draw_cg16_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri) +{ + UINT32 count; + UINT8 *vram = m_main_ram; //TODO + UINT8 pen,pen_bit[4]; + int x,y,xi,pen_i; + UINT32 wa_reg; + UINT8 s_x; + UINT8 base_mask; + int res_x,res_y; + UINT8 cg_interlace; + UINT8 pen_mask; + + base_mask = (x_size == 640) ? 0x3f : 0x1f; + + count = (m_cg_reg[0x10]) | ((m_cg_reg[0x11] & base_mask) << 8); + wa_reg = (m_cg_reg[0x12]) | ((m_cg_reg[0x13] & base_mask) << 8); + /* TODO: layer 2 scrolling */ + s_x = (m_cg_reg[0x0f] & 0xf); + cg_interlace = m_text_font_reg ? 1 : 2; + pen_mask = (m_cg_reg[0x18] >> ((plane & 1) * 4)) & 0x0f; + +// popmessage("%d %d %d %d",m_cg_hs,m_cg_he,m_cg_vs,m_cg_ve); + + for(y=0;y<200;y++) + { + for(x=0;x= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) + continue; + + pen_bit[0] = (vram[count+0x40000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x01) : 0; //B + pen_bit[1] = (vram[count+0x44000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x02) : 0; //R + pen_bit[2] = (vram[count+0x48000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x04) : 0; //G + pen_bit[3] = (vram[count+0x4c000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x08) : 0; //I + + pen = 0; + for(pen_i=0;pen_i<4;pen_i++) + pen |= pen_bit[pen_i]; + + if(pri == ((m_clut16[pen] & 0x10) >> 4) && m_clut16[pen] != 0x00 && pen_mask) //correct? + mz2500_draw_pixel(bitmap,res_x,res_y,(m_clut16[pen] & 0x0f)+0x10,(x_size == 320 && m_scr_x_size == 640),cg_interlace == 2); + } + count++; + count&=((base_mask<<8) | 0xff); + if(count > wa_reg) + count = 0; + } + } +} + +void mz2500_state::draw_cg256_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri) +{ + UINT32 count; + UINT8 *vram = m_main_ram; + UINT8 pen,pen_bit[8]; + int x,y,xi,pen_i; + UINT32 wa_reg; + UINT8 s_x; + UINT8 base_mask; + int res_x,res_y; + UINT8 cg_interlace; + + base_mask = 0x3f; //no x_size == 640 + + count = (m_cg_reg[0x10]) | ((m_cg_reg[0x11] & base_mask) << 8); + wa_reg = (m_cg_reg[0x12]) | ((m_cg_reg[0x13] & base_mask) << 8); + /* TODO: layer 2 scrolling */ + s_x = (m_cg_reg[0x0f] & 0xf); + cg_interlace = m_text_font_reg ? 1 : 2; + + for(y=0;y<200;y++) + { + for(x=0;x<320;x+=8) + { + for(xi=0;xi<8;xi++) + { + res_x = x+xi+s_x; + res_y = y; + + /* check window boundaries */ + if(res_x < m_cg_hs || res_x >= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) + continue; + + pen_bit[0] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x2000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x10) : 0; // B1 + pen_bit[1] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x0000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x01) : 0; // B0 + pen_bit[2] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x6000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x20) : 0; // R1 + pen_bit[3] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x4000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x02) : 0; // R0 + pen_bit[4] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xa000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x40) : 0; // G1 + pen_bit[5] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x8000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x04) : 0; // G0 + pen_bit[6] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xe000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x80) : 0; // I1 + pen_bit[7] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xc000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x08) : 0; // I0 + + pen = 0; + for(pen_i=0;pen_i<8;pen_i++) + pen |= pen_bit[pen_i]; + + if(pri == ((m_clut256[pen] & 0x100) >> 8)) + mz2500_draw_pixel(bitmap,res_x,res_y,(m_clut256[pen] & 0xff)+0x100,m_scr_x_size == 640,cg_interlace == 2); + } + count++; + count&=((base_mask<<8) | 0xff); + if(count > wa_reg) + count = 0; + } + } +} + +void mz2500_state::draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect) +{ + UINT16 base_addr; + + base_addr = m_text_reg[1] | ((m_text_reg[2] & 0x7) << 8); + +// popmessage("%02x",m_clut16[0]); +// popmessage("%d %d %d %d",m_tv_hs,(m_tv_he),m_tv_vs,(m_tv_ve)); + + if(m_text_col_size) + draw_80x25(bitmap,cliprect,base_addr); + else + { + int tv_mode; + + tv_mode = m_text_reg[0] >> 2; + + switch(tv_mode & 3) + { + case 0: //mixed 6bpp mode, TODO + draw_40x25(bitmap,cliprect,0,base_addr); + break; + case 1: + draw_40x25(bitmap,cliprect,0,base_addr); + break; + case 2: + draw_40x25(bitmap,cliprect,1,base_addr); + break; + case 3: + draw_40x25(bitmap,cliprect,1,base_addr); + draw_40x25(bitmap,cliprect,0,base_addr); + break; + //default: popmessage("%02x %02x %02x",tv_mode & 3,m_text_reg[1],m_text_reg[2]); break; + } + } +} + +void mz2500_state::draw_cg_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) +{ + //popmessage("%02x %02x",m_cg_reg[0x0e],m_cg_reg[0x18]); + + switch(m_cg_reg[0x0e]) + { + case 0x00: + break; + case 0x03: + draw_cg4_screen(bitmap,cliprect,0); + break; + case 0x14: + draw_cg16_screen(bitmap,cliprect,0,320,pri); + draw_cg16_screen(bitmap,cliprect,1,320,pri); + break; + case 0x15: + draw_cg16_screen(bitmap,cliprect,1,320,pri); + draw_cg16_screen(bitmap,cliprect,0,320,pri); + break; + case 0x17: + draw_cg16_screen(bitmap,cliprect,0,640,pri); + break; + case 0x1d: + draw_cg256_screen(bitmap,cliprect,0,pri); + break; + case 0x97: + draw_cg16_screen(bitmap,cliprect,2,640,pri); + break; + default: + popmessage("Unsupported CG mode %02x, contact MESS dev",m_cg_reg[0x0e]); + break; + } +} + +UINT32 mz2500_state::screen_update_mz2500(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(m_palette->pen(0), cliprect); //TODO: correct? + + if(m_screen_enable) + return 0; + + draw_cg_screen(bitmap,cliprect,0); + draw_tv_screen(bitmap,cliprect); + draw_cg_screen(bitmap,cliprect,1); + // popmessage("%02x (%02x %02x) (%02x %02x) (%02x %02x) (%02x %02x)",m_cg_reg[0x0f],m_cg_reg[0x10],m_cg_reg[0x11],m_cg_reg[0x12],m_cg_reg[0x13],m_cg_reg[0x14],m_cg_reg[0x15],m_cg_reg[0x16],m_cg_reg[0x17]); + // popmessage("%02x",m_text_reg[0x0f]); + + + return 0; +} + +void mz2500_state::mz2500_reconfigure_screen() +{ + rectangle visarea; + + if((m_cg_reg[0x0e] & 0x1f) == 0x17 || (m_cg_reg[0x0e] & 0x1f) == 0x03 || m_text_col_size) + m_scr_x_size = 640; + else + m_scr_x_size = 320; + + if((m_cg_reg[0x0e] & 0x1f) == 0x03) + m_scr_y_size = 400; + else + m_scr_y_size = 200 * ((m_text_font_reg) ? 1 : 2); + + visarea.set(0, m_scr_x_size - 1, 0, m_scr_y_size - 1); + + //popmessage("%d %d %d %d %02x",vs,ve,hs,he,m_cg_reg[0x0e]); + + machine().first_screen()->configure(720, 480, visarea, machine().first_screen()->frame_period().attoseconds()); + + /* calculate CG window parameters here */ + m_cg_vs = (m_cg_reg[0x08]) | ((m_cg_reg[0x09]<<8) & 1); + m_cg_ve = (m_cg_reg[0x0a]) | ((m_cg_reg[0x0b]<<8) & 1); + m_cg_hs = ((m_cg_reg[0x0c] & 0x7f)*8); + m_cg_he = ((m_cg_reg[0x0d] & 0x7f)*8); + + if(m_scr_x_size == 320) + { + m_cg_hs /= 2; + m_cg_he /= 2; + } + + /* calculate TV window parameters here */ + { + int x_offs,y_offs; + + m_monitor_type = ((m_text_reg[0x0f] & 0x08) >> 3); + + switch((m_monitor_type|m_text_col_size<<1) & 3) + { + default: + case 0: x_offs = 64; break; + case 1: x_offs = 80; break; + case 2: x_offs = 72; break; + case 3: x_offs = 88; break; + } + //printf("%d %d %d\n",x_offs,(m_text_reg[7] & 0x7f) * 8,(m_text_reg[8] & 0x7f)* 8); + + y_offs = (m_monitor_type) ? 76 : 34; + + m_tv_hs = ((m_text_reg[7] & 0x7f)*8) - x_offs; + m_tv_he = ((m_text_reg[8] & 0x7f)*8) - x_offs; + m_tv_vs = (m_text_reg[3]*2) - y_offs; + m_tv_ve = (m_text_reg[5]*2) - y_offs; + + if(m_scr_x_size == 320) + { + m_tv_hs /= 2; + m_tv_he /= 2; + } + + if(m_scr_y_size == 200) + { + m_tv_vs /= 2; + m_tv_ve /= 2; + } + } +} + +UINT8 mz2500_state::mz2500_cg_latch_compare() +{ + UINT8 compare_val = m_cg_reg[0x07] & 0xf; + UINT8 pix_val; + UINT8 res; + UINT16 i; + res = 0; + + for(i=1;i<0x100;i<<=1) + { + pix_val = ((m_cg_latch[0] & i) ? 1 : 0) | ((m_cg_latch[1] & i) ? 2 : 0) | ((m_cg_latch[2] & i) ? 4 : 0) | ((m_cg_latch[3] & i) ? 8 : 0); + if(pix_val == compare_val) + res|=i; + } + + return res; +} + +UINT8 mz2500_state::mz2500_ram_read(UINT16 offset, UINT8 bank_num) +{ + UINT8 *ram = m_main_ram; // TODO + UINT8 cur_bank = m_bank_val[bank_num]; + + switch(cur_bank) + { + case 0x30: + case 0x31: + case 0x32: + case 0x33: + { + // READ MODIFY WRITE + if(m_cg_reg[0x0e] == 0x3) + { + // ... + } + else + { + int plane; + m_cg_latch[0] = ram[offset+((cur_bank & 3)*0x2000)+0x40000]; //B + m_cg_latch[1] = ram[offset+((cur_bank & 3)*0x2000)+0x44000]; //R + m_cg_latch[2] = ram[offset+((cur_bank & 3)*0x2000)+0x48000]; //G + m_cg_latch[3] = ram[offset+((cur_bank & 3)*0x2000)+0x4c000]; //I + plane = m_cg_reg[0x07] & 3; + + if(m_cg_reg[0x07] & 0x10) + return mz2500_cg_latch_compare(); + else + return m_cg_latch[plane]; + } + } + break; + case 0x39: + { + if(m_kanji_bank & 0x80) //kanji ROM + return m_kanji_rom[(offset & 0x7ff)+((m_kanji_bank & 0x7f)*0x800)]; + else //PCG RAM + return m_pcg_ram[offset]; + } + case 0x3a: + { + return m_dic_rom[(offset & 0x1fff) + ((m_dic_bank & 0x1f)*0x2000)]; + } + case 0x3c: + case 0x3d: + case 0x3e: + case 0x3f: + { + return m_phone_rom[offset+(cur_bank & 3)*0x2000]; + } + default: return ram[offset+cur_bank*0x2000]; + } + + // never executed + return 0xff; +} + +void mz2500_state::mz2500_ram_write(UINT16 offset, UINT8 data, UINT8 bank_num) +{ + UINT8 *ram = m_main_ram; // TODO + UINT8 cur_bank = m_bank_val[bank_num]; + +// if(cur_bank >= 0x30 && cur_bank <= 0x33) +// printf("CG REG = %02x %02x %02x %02x | offset = %04x | data = %02x\n",m_cg_reg[0],m_cg_reg[1],m_cg_reg[2],m_cg_reg[3],offset,data); + + switch(cur_bank) + { + case 0x30: + case 0x31: + case 0x32: + case 0x33: + { + // READ MODIFY WRITE + if(m_cg_reg[0x0e] == 0x3) + { + // ... + } + else + { + if((m_cg_reg[0x05] & 0xc0) == 0x00) //replace + { + if(m_cg_reg[5] & 1) //B + { + ram[offset+((cur_bank & 3)*0x2000)+0x40000] &= ~m_cg_reg[6]; + ram[offset+((cur_bank & 3)*0x2000)+0x40000] |= (m_cg_reg[4] & 1) ? (data & m_cg_reg[0] & m_cg_reg[6]) : 0; + } + if(m_cg_reg[5] & 2) //R + { + ram[offset+((cur_bank & 3)*0x2000)+0x44000] &= ~m_cg_reg[6]; + ram[offset+((cur_bank & 3)*0x2000)+0x44000] |= (m_cg_reg[4] & 2) ? (data & m_cg_reg[1] & m_cg_reg[6]) : 0; + } + if(m_cg_reg[5] & 4) //G + { + ram[offset+((cur_bank & 3)*0x2000)+0x48000] &= ~m_cg_reg[6]; + ram[offset+((cur_bank & 3)*0x2000)+0x48000] |= (m_cg_reg[4] & 4) ? (data & m_cg_reg[2] & m_cg_reg[6]) : 0; + } + if(m_cg_reg[5] & 8) //I + { + ram[offset+((cur_bank & 3)*0x2000)+0x4c000] &= ~m_cg_reg[6]; + ram[offset+((cur_bank & 3)*0x2000)+0x4c000] |= (m_cg_reg[4] & 8) ? (data & m_cg_reg[3] & m_cg_reg[6]) : 0; + } + } + else if((m_cg_reg[0x05] & 0xc0) == 0x40) //pset + { + if(m_cg_reg[5] & 1) //B + { + ram[offset+((cur_bank & 3)*0x2000)+0x40000] &= ~data; + ram[offset+((cur_bank & 3)*0x2000)+0x40000] |= (m_cg_reg[4] & 1) ? (data & m_cg_reg[0]) : 0; + } + if(m_cg_reg[5] & 2) //R + { + ram[offset+((cur_bank & 3)*0x2000)+0x44000] &= ~data; + ram[offset+((cur_bank & 3)*0x2000)+0x44000] |= (m_cg_reg[4] & 2) ? (data & m_cg_reg[1]) : 0; + } + if(m_cg_reg[5] & 4) //G + { + ram[offset+((cur_bank & 3)*0x2000)+0x48000] &= ~data; + ram[offset+((cur_bank & 3)*0x2000)+0x48000] |= (m_cg_reg[4] & 4) ? (data & m_cg_reg[2]) : 0; + } + if(m_cg_reg[5] & 8) //I + { + ram[offset+((cur_bank & 3)*0x2000)+0x4c000] &= ~data; + ram[offset+((cur_bank & 3)*0x2000)+0x4c000] |= (m_cg_reg[4] & 8) ? (data & m_cg_reg[3]) : 0; + } + } + } + break; + } + case 0x34: + case 0x35: + case 0x36: + case 0x37: + { + // IPL ROM, WRITENOP + //printf("%04x %02x\n",offset+bank_num*0x2000,data); + break; + } + case 0x38: + { + // TVRAM + ram[offset+cur_bank*0x2000] = data; + break; + } + case 0x39: + { + ram[offset+cur_bank*0x2000] = data; + if(m_kanji_bank & 0x80) //kanji ROM + { + //NOP + } + else //PCG RAM + { + m_pcg_ram[offset] = data; + if((offset & 0x1800) == 0x0000) + m_gfxdecode->gfx(3)->mark_dirty((offset) >> 3); + else + m_gfxdecode->gfx(4)->mark_dirty((offset & 0x7ff) >> 3); + } + break; + } + case 0x3a: + { + // DIC ROM, WRITENOP + break; + } + case 0x3c: + case 0x3d: + case 0x3e: + case 0x3f: + { + // PHONE ROM, WRITENOP + break; + } + default: ram[offset+cur_bank*0x2000] = data; break; + } +} + +READ8_MEMBER(mz2500_state::bank0_r){ return mz2500_ram_read(offset, 0); } +READ8_MEMBER(mz2500_state::bank1_r){ return mz2500_ram_read(offset, 1); } +READ8_MEMBER(mz2500_state::bank2_r){ return mz2500_ram_read(offset, 2); } +READ8_MEMBER(mz2500_state::bank3_r){ return mz2500_ram_read(offset, 3); } +READ8_MEMBER(mz2500_state::bank4_r){ return mz2500_ram_read(offset, 4); } +READ8_MEMBER(mz2500_state::bank5_r){ return mz2500_ram_read(offset, 5); } +READ8_MEMBER(mz2500_state::bank6_r){ return mz2500_ram_read(offset, 6); } +READ8_MEMBER(mz2500_state::bank7_r){ return mz2500_ram_read(offset, 7); } +WRITE8_MEMBER(mz2500_state::bank0_w){ mz2500_ram_write(offset, data, 0); } +WRITE8_MEMBER(mz2500_state::bank1_w){ mz2500_ram_write(offset, data, 1); } +WRITE8_MEMBER(mz2500_state::bank2_w){ mz2500_ram_write(offset, data, 2); } +WRITE8_MEMBER(mz2500_state::bank3_w){ mz2500_ram_write(offset, data, 3); } +WRITE8_MEMBER(mz2500_state::bank4_w){ mz2500_ram_write(offset, data, 4); } +WRITE8_MEMBER(mz2500_state::bank5_w){ mz2500_ram_write(offset, data, 5); } +WRITE8_MEMBER(mz2500_state::bank6_w){ mz2500_ram_write(offset, data, 6); } +WRITE8_MEMBER(mz2500_state::bank7_w){ mz2500_ram_write(offset, data, 7); } + + +READ8_MEMBER(mz2500_state::mz2500_bank_addr_r) +{ + return m_bank_addr; +} + +WRITE8_MEMBER(mz2500_state::mz2500_bank_addr_w) +{ +// printf("%02x\n",data); + m_bank_addr = data & 7; +} + +READ8_MEMBER(mz2500_state::mz2500_bank_data_r) +{ + UINT8 res; + + res = m_bank_val[m_bank_addr]; + + m_bank_addr++; + m_bank_addr&=7; + + return res; +} + +WRITE8_MEMBER(mz2500_state::mz2500_bank_data_w) +{ +// static const char *const bank_name[] = { "bank0", "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7" }; + + m_bank_val[m_bank_addr] = data & 0x3f; + +// if((data*2) >= 0x70) +// printf("%s %02x\n",bank_name[m_bank_addr],m_bank_val[m_bank_addr]*2); + +// membank(bank_name[m_bank_addr])->set_base(&m_main_ram[m_bank_val[m_bank_addr]*0x2000]); + + m_bank_addr++; + m_bank_addr&=7; +} + +WRITE8_MEMBER(mz2500_state::mz2500_kanji_bank_w) +{ + m_kanji_bank = data; +} + +WRITE8_MEMBER(mz2500_state::mz2500_dictionary_bank_w) +{ + m_dic_bank = data; +} + +/* 0xf4 - 0xf7 all returns vblank / hblank states */ +READ8_MEMBER(mz2500_state::mz2500_crtc_hvblank_r) +{ + UINT8 vblank_bit, hblank_bit; + + vblank_bit = machine().first_screen()->vblank() ? 0 : 1; + hblank_bit = machine().first_screen()->hblank() ? 0 : 2; + + return vblank_bit | hblank_bit; +} + +/* +TVRAM / CRTC registers + +[0x00] ---x ---- line height (0) 16 (1) 20 +[0x00] ---- xx-- 40 column mode (0) 64 colors (1) screen 1 (2) screen 2 (3) screen 1 + screen 2 +[0x00] ---- --x- (related to the transparent pen) +[0x01] xxxx xxxx TV map offset low address value +[0x02] ---- -xxx TV map offset high address value +[0x03] xxxx xxxx CRTC vertical start register + +[0x05] xxxx xxxx CRTC vertical end register + +[0x07] -xxx xxxx CRTC horizontal start register +[0x08] -xxx xxxx CRTC horizontal end register +[0x09] ---- xxxx vertical scrolling shift position +[0x0a] --GG RRBB 256 color mode +[0x0b] -r-- ---- Back plane red gradient +[0x0b] ---- -b-- Back plane blue gradient +[0x0b] ---- ---i Back plane i gradient +[0x0c] ---- ---g Back plane green gradient + +[0x0f] ---- x--- sets monitor type interlace / progressive +*/ + +UINT8 mz2500_state::pal_256_param(int index, int param) +{ + UINT8 val = 0; + + switch(param & 3) + { + case 0: val = index & 0x80 ? 1 : 0; break; + case 1: val = index & 0x08 ? 1 : 0; break; + case 2: val = 1; break; + case 3: val = 0; break; + } + + return val; +} + +WRITE8_MEMBER(mz2500_state::mz2500_tv_crtc_w) +{ + switch(offset) + { + case 0: m_text_reg_index = data; break; + case 1: + m_text_reg[m_text_reg_index] = data; + + #if 0 + //printf("[%02x] <- %02x\n",m_text_reg_index,data); + popmessage("(%02x %02x) (%02x %02x %02x %02x) (%02x %02x %02x) (%02x %02x %02x %02x)" + ,m_text_reg[0] & ~0x1e,m_text_reg[3] + ,m_text_reg[4],m_text_reg[5],m_text_reg[6],m_text_reg[7] + ,m_text_reg[8],m_text_reg[10],m_text_reg[11] + ,m_text_reg[12],m_text_reg[13],m_text_reg[14],m_text_reg[15]); + + #endif + //popmessage("%d %02x %d %02x %d %d",m_text_reg[3],m_text_reg[4],m_text_reg[5],m_text_reg[6],m_text_reg[7]*8,m_text_reg[8]*8); + + mz2500_reconfigure_screen(); + + if(m_text_reg_index == 0x0a) // set 256 color palette + { + int i,r,g,b; + UINT8 b_param,r_param,g_param; + + b_param = (data & 0x03) >> 0; + r_param = (data & 0x0c) >> 2; + g_param = (data & 0x30) >> 4; + + for(i = 0;i < 0x100;i++) + { + int bit0,bit1,bit2; + + bit0 = pal_256_param(i,b_param) ? 1 : 0; + bit1 = i & 0x01 ? 2 : 0; + bit2 = i & 0x10 ? 4 : 0; + b = bit0|bit1|bit2; + bit0 = pal_256_param(i,r_param) ? 1 : 0; + bit1 = i & 0x02 ? 2 : 0; + bit2 = i & 0x20 ? 4 : 0; + r = bit0|bit1|bit2; + bit0 = pal_256_param(i,g_param) ? 1 : 0; + bit1 = i & 0x04 ? 2 : 0; + bit2 = i & 0x40 ? 4 : 0; + g = bit0|bit1|bit2; + + m_palette->set_pen_color(i+0x100,pal3bit(r),pal3bit(g),pal3bit(b)); + } + } + if(m_text_reg_index >= 0x80 && m_text_reg_index <= 0x8f) //Bitmap 16 clut registers + { + /* + ---x ---- priority + ---- xxxx clut number + */ + m_clut16[m_text_reg_index & 0xf] = data & 0x1f; + //printf("%02x -> [%02x]\n",m_text_reg[m_text_reg_index],m_text_reg_index); + + { + int i; + + for(i=0;i<0x10;i++) + { + m_clut256[(m_text_reg_index & 0xf) | (i << 4)] = (((data & 0x1f) << 4) | i); + } + } + } + break; + case 2: /* CG Mask reg (priority mixer) */ + m_cg_mask = data; + break; + case 3: + /* Font size reg */ + m_text_font_reg = data & 1; + mz2500_reconfigure_screen(); + break; + } +} + +WRITE8_MEMBER(mz2500_state::mz2500_irq_sel_w) +{ + m_irq_sel = data; + //printf("%02x\n",m_irq_sel); + // activeness is trusted, see Tower of Druaga + m_irq_mask[0] = (data & 0x08); //CRTC + m_irq_mask[1] = (data & 0x04); //i8253 + m_irq_mask[2] = (data & 0x02); //printer + m_irq_mask[3] = (data & 0x01); //RP5c15 +} + +WRITE8_MEMBER(mz2500_state::mz2500_irq_data_w) +{ + if(m_irq_sel & 0x80) + m_irq_vector[0] = data; //CRTC + if(m_irq_sel & 0x40) + m_irq_vector[1] = data; //i8253 + if(m_irq_sel & 0x20) + m_irq_vector[2] = data; //printer + if(m_irq_sel & 0x10) + m_irq_vector[3] = data; //RP5c15 + +// popmessage("%02x %02x %02x %02x",m_irq_vector[0],m_irq_vector[1],m_irq_vector[2],m_irq_vector[3]); +} + +WRITE8_MEMBER(mz2500_state::floppy_select_w) +{ + switch ((data & 0x03) ^ m_fdc_reverse) + { + case 0: m_floppy = m_floppy0->get_device(); break; + case 1: m_floppy = m_floppy1->get_device(); break; + case 2: m_floppy = m_floppy2->get_device(); break; + case 3: m_floppy = m_floppy3->get_device(); break; + } + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + m_floppy->mon_w(!BIT(data, 7)); +} + +WRITE8_MEMBER(mz2500_state::floppy_side_w) +{ + if (m_floppy) + m_floppy->ss_w(BIT(data, 0)); +} + + +static ADDRESS_MAP_START(mz2500_map, AS_PROGRAM, 8, mz2500_state ) + AM_RANGE(0x0000, 0x1fff) AM_READWRITE(bank0_r,bank0_w) + AM_RANGE(0x2000, 0x3fff) AM_READWRITE(bank1_r,bank1_w) + AM_RANGE(0x4000, 0x5fff) AM_READWRITE(bank2_r,bank2_w) + AM_RANGE(0x6000, 0x7fff) AM_READWRITE(bank3_r,bank3_w) + AM_RANGE(0x8000, 0x9fff) AM_READWRITE(bank4_r,bank4_w) + AM_RANGE(0xa000, 0xbfff) AM_READWRITE(bank5_r,bank5_w) + AM_RANGE(0xc000, 0xdfff) AM_READWRITE(bank6_r,bank6_w) + AM_RANGE(0xe000, 0xffff) AM_READWRITE(bank7_r,bank7_w) +ADDRESS_MAP_END + + +READ8_MEMBER(mz2500_state::mz2500_rom_r) +{ + m_lrom_index = (m_maincpu->state_int(Z80_B)); + + m_rom_index = (m_rom_index & 0xffff00) | (m_lrom_index & 0xff); + + return m_iplpro_rom[m_rom_index]; +} + +WRITE8_MEMBER(mz2500_state::mz2500_rom_w) +{ + m_hrom_index = (m_maincpu->state_int(Z80_B)); + + m_rom_index = (data << 8) | (m_rom_index & 0x0000ff) | ((m_hrom_index & 0xff)<<16); + //printf("%02x\n",data); +} + +/* sets 16 color entries out of 4096 possible combinations */ +WRITE8_MEMBER(mz2500_state::palette4096_io_w) +{ + UINT8 pal_index; + UINT8 pal_entry; + + pal_index = m_maincpu->state_int(Z80_B); + pal_entry = (pal_index & 0x1e) >> 1; + + if(pal_index & 1) + m_pal[pal_entry].g = (data & 0x0f); + else + { + m_pal[pal_entry].r = (data & 0xf0) >> 4; + m_pal[pal_entry].b = data & 0x0f; + } + + m_palette->set_pen_color(pal_entry+0x10, pal4bit(m_pal[pal_entry].r), pal4bit(m_pal[pal_entry].g), pal4bit(m_pal[pal_entry].b)); +} + +READ8_MEMBER(mz2500_state::fdc_r) +{ + return m_fdc->read(space, offset) ^ 0xff; +} + +WRITE8_MEMBER(mz2500_state::fdc_w) +{ + m_fdc->write(space, offset, data ^ 0xff); +} + +READ8_MEMBER(mz2500_state::mz2500_bplane_latch_r) +{ + if(m_cg_reg[7] & 0x10) + return mz2500_cg_latch_compare(); + else + return m_cg_latch[0]; +} + + +READ8_MEMBER(mz2500_state::mz2500_rplane_latch_r) +{ + if(m_cg_reg[0x07] & 0x10) + { + UINT8 vblank_bit; + + vblank_bit = machine().first_screen()->vblank() ? 0 : 0x80 | m_cg_clear_flag; + + return vblank_bit; + } + else + return m_cg_latch[1]; +} + +READ8_MEMBER(mz2500_state::mz2500_gplane_latch_r) +{ + return m_cg_latch[2]; +} + +READ8_MEMBER(mz2500_state::mz2500_iplane_latch_r) +{ + return m_cg_latch[3]; +} + +/* +"GDE" CRTC registers + +0x00: CG B - Replace / Pset register data mask +0x01: CG R - Replace / Pset register data mask +0x02: CG G - Replace / Pset register data mask +0x03: CG I - Replace / Pset register data mask +0x04: CG Replace / Pset active pixel +0x05: CG Replace / Pset mode register +0x06: CG Replace data register +0x07: compare CG buffer register +0x08: CG window vertical start lo reg +0x09: CG window vertical start hi reg (upper 1 bit) +0x0a: CG window vertical end lo reg +0x0b: CG window vertical end hi reg (upper 1 bit) +0x0c: CG window horizontal start reg (7 bits, val x 8) +0x0d: CG window horizontal end reg (7 bits, val x 8) +0x0e: CG mode +0x0f: vertical scroll shift (---- xxxx) +0x10: CG map base lo reg +0x11: CG map base hi reg +0x12: CG layer 0 end address lo reg +0x13: CG layer 0 end address hi reg +0x14: CG layer 1 start address lo reg +0x15: CG layer 1 start address hi reg +0x16: CG layer 1 y pixel start lo reg +0x17: CG layer 1 y pixel start hi reg +0x18: CG color masking +*/ + +WRITE8_MEMBER(mz2500_state::mz2500_cg_addr_w) +{ + m_cg_reg_index = data; +} + +WRITE8_MEMBER(mz2500_state::mz2500_cg_data_w) +{ + m_cg_reg[m_cg_reg_index & 0x1f] = data; + + if((m_cg_reg_index & 0x1f) == 0x08) //accessing VS LO reg clears VS HI reg + m_cg_reg[0x09] = 0; + + if((m_cg_reg_index & 0x1f) == 0x0a) //accessing VE LO reg clears VE HI reg + m_cg_reg[0x0b] = 0; + + if((m_cg_reg_index & 0x1f) == 0x05 && (m_cg_reg[0x05] & 0xc0) == 0x80) //clear bitmap buffer + { + UINT32 i; + UINT8 *vram = m_main_ram; // TODO + UINT32 layer_bank; + + layer_bank = (m_cg_reg[0x0e] & 0x80) ? 0x10000 : 0x00000; + + /* TODO: this isn't yet 100% accurate */ + if(m_cg_reg[0x05] & 1) + { + for(i=0;i<0x4000;i++) + vram[i+0x40000+layer_bank] = 0x00; //clear B + } + if(m_cg_reg[0x05] & 2) + { + for(i=0;i<0x4000;i++) + vram[i+0x44000+layer_bank] = 0x00; //clear R + } + if(m_cg_reg[0x05] & 4) + { + for(i=0;i<0x4000;i++) + vram[i+0x48000+layer_bank] = 0x00; //clear G + } + if(m_cg_reg[0x05] & 8) + { + for(i=0;i<0x4000;i++) + vram[i+0x4c000+layer_bank] = 0x00; //clear I + } + m_cg_clear_flag = 1; + } + + { + mz2500_reconfigure_screen(); + } + + if(m_cg_reg_index & 0x80) //enable auto-inc + m_cg_reg_index = (m_cg_reg_index & 0xfc) | ((m_cg_reg_index + 1) & 0x03); +} + +WRITE8_MEMBER(mz2500_state::timer_w) +{ + m_pit->write_gate0(1); + m_pit->write_gate1(1); + m_pit->write_gate0(0); + m_pit->write_gate1(0); + m_pit->write_gate0(1); + m_pit->write_gate1(1); +} + + +READ8_MEMBER(mz2500_state::mz2500_joystick_r) +{ + UINT8 res,dir_en,in_r; + + res = 0xff; + in_r = ~ioport(m_joy_mode & 0x40 ? "JOY_2P" : "JOY_1P")->read(); + + if(m_joy_mode & 0x40) + { + if(!(m_joy_mode & 0x04)) res &= ~0x20; + if(!(m_joy_mode & 0x08)) res &= ~0x10; + dir_en = (m_joy_mode & 0x20) ? 0 : 1; + } + else + { + if(!(m_joy_mode & 0x01)) res &= ~0x20; + if(!(m_joy_mode & 0x02)) res &= ~0x10; + dir_en = (m_joy_mode & 0x10) ? 0 : 1; + } + + if(dir_en) + res &= (~((in_r) & 0x0f)); + + res &= (~((in_r) & 0x30)); + + return res; +} + +WRITE8_MEMBER(mz2500_state::mz2500_joystick_w) +{ + m_joy_mode = data; +} + + +READ8_MEMBER(mz2500_state::mz2500_kanji_r) +{ + printf("Read from kanji 2 ROM\n"); + + return m_kanji2_rom[(m_kanji_index << 1) | (offset & 1)]; +} + +WRITE8_MEMBER(mz2500_state::mz2500_kanji_w) +{ + (offset & 1) ? (m_kanji_index = (data << 8) | (m_kanji_index & 0xff)) : (m_kanji_index = (data & 0xff) | (m_kanji_index & 0xff00)); +} + +READ8_MEMBER(mz2500_state::rp5c15_8_r) +{ + UINT8 rtc_index = (m_maincpu->state_int(Z80_B)); + + return m_rtc->read(space, rtc_index); +} + +WRITE8_MEMBER(mz2500_state::rp5c15_8_w) +{ + UINT8 rtc_index = (m_maincpu->state_int(Z80_B)); + + m_rtc->write(space, rtc_index, data); +} + + +READ8_MEMBER(mz2500_state::mz2500_emm_data_r) +{ + UINT8 emm_lo_index; + + emm_lo_index = (m_maincpu->state_int(Z80_B)); + + m_emm_offset = (m_emm_offset & 0xffff00) | (emm_lo_index & 0xff); + + if(m_emm_offset < 0x100000) //emm max size + return m_emm_ram[m_emm_offset]; + + return 0xff; +} + +WRITE8_MEMBER(mz2500_state::mz2500_emm_addr_w) +{ + UINT8 emm_hi_index; + + emm_hi_index = (m_maincpu->state_int(Z80_B)); + + m_emm_offset = ((emm_hi_index & 0xff) << 16) | ((data & 0xff) << 8) | (m_emm_offset & 0xff); +} + +WRITE8_MEMBER(mz2500_state::mz2500_emm_data_w) +{ + UINT8 emm_lo_index; + + emm_lo_index = (m_maincpu->state_int(Z80_B)); + + m_emm_offset = (m_emm_offset & 0xffff00) | (emm_lo_index & 0xff); + + if(m_emm_offset < 0x100000) //emm max size + m_emm_ram[m_emm_offset] = data; +} + +static ADDRESS_MAP_START(mz2500_io, AS_IO, 8, mz2500_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) +// AM_RANGE(0x60, 0x63) AM_WRITE(w3100a_w) +// AM_RANGE(0x63, 0x63) AM_READ(w3100a_r) +// AM_RANGE(0x98, 0x99) ADPCM, unknown type, custom? + AM_RANGE(0xa0, 0xa3) AM_DEVREADWRITE("z80sio",z80sio0_device, ba_cd_r, ba_cd_w) +// AM_RANGE(0xa4, 0xa5) AM_READWRITE(sasi_r, sasi_w) + AM_RANGE(0xa8, 0xa8) AM_WRITE(mz2500_rom_w) + AM_RANGE(0xa9, 0xa9) AM_READ(mz2500_rom_r) + AM_RANGE(0xac, 0xac) AM_WRITE(mz2500_emm_addr_w) + AM_RANGE(0xad, 0xad) AM_READ(mz2500_emm_data_r) AM_WRITE(mz2500_emm_data_w) + AM_RANGE(0xae, 0xae) AM_WRITE(palette4096_io_w) +// AM_RANGE(0xb0, 0xb3) AM_READWRITE(sio_r,sio_w) + AM_RANGE(0xb4, 0xb4) AM_READWRITE(mz2500_bank_addr_r,mz2500_bank_addr_w) + AM_RANGE(0xb5, 0xb5) AM_READWRITE(mz2500_bank_data_r,mz2500_bank_data_w) + AM_RANGE(0xb7, 0xb7) AM_WRITENOP + AM_RANGE(0xb8, 0xb9) AM_READWRITE(mz2500_kanji_r,mz2500_kanji_w) + AM_RANGE(0xbc, 0xbc) AM_READ(mz2500_bplane_latch_r) AM_WRITE(mz2500_cg_addr_w) + AM_RANGE(0xbd, 0xbd) AM_READ(mz2500_rplane_latch_r) AM_WRITE(mz2500_cg_data_w) + AM_RANGE(0xbe, 0xbe) AM_READ(mz2500_gplane_latch_r) + AM_RANGE(0xbf, 0xbf) AM_READ(mz2500_iplane_latch_r) + AM_RANGE(0xc6, 0xc6) AM_WRITE(mz2500_irq_sel_w) + AM_RANGE(0xc7, 0xc7) AM_WRITE(mz2500_irq_data_w) + AM_RANGE(0xc8, 0xc9) AM_DEVREADWRITE("ym", ym2203_device, read, write) +// AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w) + AM_RANGE(0xcc, 0xcc) AM_READWRITE(rp5c15_8_r, rp5c15_8_w) + AM_RANGE(0xce, 0xce) AM_WRITE(mz2500_dictionary_bank_w) + AM_RANGE(0xcf, 0xcf) AM_WRITE(mz2500_kanji_bank_w) + AM_RANGE(0xd8, 0xdb) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0xdc, 0xdc) AM_WRITE(floppy_select_w) + AM_RANGE(0xdd, 0xdd) AM_WRITE(floppy_side_w) + AM_RANGE(0xde, 0xde) AM_WRITENOP + AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("i8255_0", i8255_device, read, write) + AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("pit", pit8253_device, read, write) + AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) + AM_RANGE(0xef, 0xef) AM_READWRITE(mz2500_joystick_r,mz2500_joystick_w) + AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w) + AM_RANGE(0xf4, 0xf7) AM_READ(mz2500_crtc_hvblank_r) AM_WRITE(mz2500_tv_crtc_w) +// AM_RANGE(0xf8, 0xf9) AM_READWRITE(extrom_r,extrom_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mz2500 ) + PORT_START("KEY0") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + + PORT_START("KEY1") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", (PAD)") //PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) + + PORT_START("KEY2") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) + + PORT_START("KEY3") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BREAK") //PORT_CODE(KEYCODE_ESC) + + PORT_START("KEY4") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") //PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("KEY5") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("KEY6") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("KEY7") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) //Yen symbol + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("_") + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(".") + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(",") + + PORT_START("KEY8") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("KEY9") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(":") + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(";") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@") + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[") + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYA") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("COPY") + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CLR") + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("INST") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("ESC") + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) + + PORT_START("KEYB") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SLOCK") + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") + PORT_BIT(0xe0,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYC") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KJ1") + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KJ2") + PORT_BIT(0xfc,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYD") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("LOGO KEY") + PORT_BIT(0xfe,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("UNUSED") + PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED ) + + /* this enables HD-loader */ + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, "DSW1" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x30, 0x30, "IPLPRO" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x30, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "Monitor Interlace" ) //not all games support this + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + PORT_START("JOY_1P") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("JOY_2P") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +void mz2500_state::mz2500_reset(mz2500_state *state, UINT8 type) +{ + int i; + + for(i=0;i<8;i++) + m_bank_val[i] = bank_reset_val[type][i]; +} + +static const gfx_layout mz2500_pcg_layout_1bpp = +{ + 8, 8, + 0x100, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8 * 8 +}; + +static const gfx_layout mz2500_pcg_layout_3bpp = +{ + 8, 8, + 0x100, + 3, + { 0x1800*8, 0x1000*8, 0x800*8 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8 * 8 +}; + +void mz2500_state::machine_start() +{ + /* TODO: main RAM actually needs to be splitted */ + m_main_ram = auto_alloc_array_clear(machine(), UINT8, 0x80000); + m_pcg_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000); + m_ipl_rom = memregion("ipl")->base(); + m_kanji_rom = memregion("kanji")->base(); + m_kanji2_rom = memregion("kanji2")->base(); + m_emm_ram = auto_alloc_array_clear(machine(), UINT8, 0x100000); + m_dic_rom = memregion("dictionary")->base(); + m_phone_rom = memregion("phone")->base(); + m_iplpro_rom = memregion("iplpro")->base(); + + save_pointer(NAME(m_main_ram), 0x80000); + save_pointer(NAME(m_pcg_ram), 0x2000); + save_pointer(NAME(m_emm_ram), 0x100000); + + /* TODO: gfx[4] crashes as per now */ + m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_1bpp, (UINT8 *)m_pcg_ram, 0, 0x10, 0))); + m_gfxdecode->set_gfx(4, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_3bpp, (UINT8 *)m_pcg_ram, 0, 4, 0))); +} + +void mz2500_state::machine_reset() +{ + UINT32 i; + + mz2500_reset(this, IPL_RESET); + + //m_irq_vector[0] = 0xef; /* RST 28h - vblank */ + + m_text_col_size = 0; + m_text_font_reg = 0; + + /* copy IPL to its natural bank ROM/RAM position */ + for(i=0;i<0x8000;i++) + { + //m_main_ram[i] = IPL[i]; + m_main_ram[i+0x68000] = m_ipl_rom[i]; + } + + /* clear CG RAM */ + for(i=0;i<0x20000;i++) + m_main_ram[i+0x40000] = 0x00; + + /* disable IRQ */ + for(i=0;i<4;i++) + { + m_irq_mask[i] = 0; + m_irq_pending[i] = 0; + } + m_kanji_bank = 0; + + m_cg_clear_flag = 0; + + m_beeper->set_frequency(4096); + m_beeper->set_state(0); + +// m_monitor_type = ioport("DSW1")->read() & 0x40 ? 1 : 0; +} + +static const gfx_layout mz2500_cg_layout = +{ + 8, 8, /* 8 x 8 graphics */ + RGN_FRAC(1,1), /* 512 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8 * 8 /* code takes 8 times 8 bits */ +}; + +/* gfx1 is mostly 16x16, but there are some 8x8 characters */ +static const gfx_layout mz2500_8_layout = +{ + 8, 8, /* 8 x 8 graphics */ + 1920, /* 1920 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8 * 8 /* code takes 8 times 8 bits */ +}; + +static const gfx_layout mz2500_16_layout = +{ + 16, 16, /* 16 x 16 graphics */ + RGN_FRAC(1,1), /* 8192 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 16 * 16 /* code takes 16 times 16 bits */ +}; + +/* these are just for viewer sake, actually they aren't used in drawing routines */ +static GFXDECODE_START( mz2500 ) + GFXDECODE_ENTRY("kanji", 0, mz2500_cg_layout, 0, 256) + GFXDECODE_ENTRY("kanji", 0x4400, mz2500_8_layout, 0, 256) + GFXDECODE_ENTRY("kanji", 0, mz2500_16_layout, 0, 256) +// GFXDECODE_ENTRY("pcg", 0, mz2500_pcg_layout_1bpp, 0, 0x10) +// GFXDECODE_ENTRY("pcg", 0, mz2500_pcg_layout_3bpp, 0, 4) +GFXDECODE_END + +INTERRUPT_GEN_MEMBER(mz2500_state::mz2500_vbl) +{ + if(m_irq_mask[0]) + { + m_irq_pending[0] = 1; + m_maincpu->set_input_line(0, ASSERT_LINE); + } + m_cg_clear_flag = 0; +} + +IRQ_CALLBACK_MEMBER(mz2500_state::mz2500_irq_ack) +{ + int i; + for(i=0;i<4;i++) + { + if(m_irq_mask[i] && m_irq_pending[i]) + { + m_irq_pending[i] = 0; + m_maincpu->set_input_line(0, CLEAR_LINE); + return m_irq_vector[i]; + } + } + return 0; +} + +READ8_MEMBER(mz2500_state::mz2500_porta_r) +{ + logerror("PPI PORTA R\n"); + + return 0xff; +} + +READ8_MEMBER(mz2500_state::mz2500_portb_r) +{ + UINT8 vblank_bit; + + vblank_bit = machine().first_screen()->vblank() ? 0 : 1; //Guess: NOBO wants this bit to be high/low + + return 0xfe | vblank_bit; +} + +READ8_MEMBER(mz2500_state::mz2500_portc_r) +{ + logerror("PPI PORTC R\n"); + + return 0xff; +} + +WRITE8_MEMBER(mz2500_state::mz2500_porta_w) +{ + logerror("PPI PORTA W %02x\n",data); +} + +WRITE8_MEMBER(mz2500_state::mz2500_portb_w) +{ + logerror("PPI PORTB W %02x\n",data); +} + +WRITE8_MEMBER(mz2500_state::mz2500_portc_w) +{ + /* + ---- x--- 0->1 transition = IPL reset + ---- -x-- beeper state + ---- --x- 0->1 transition = Work RAM reset + ---- ---x screen mask + */ + + /* work RAM reset */ + if((m_old_portc & 0x02) == 0x00 && (data & 0x02)) + { + mz2500_reset(this, WRAM_RESET); + /* correct? */ + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + } + + /* bit 2 is speaker */ + + /* IPL reset */ + if((m_old_portc & 0x08) == 0x00 && (data & 0x08)) + mz2500_reset(this, IPL_RESET); + + m_old_portc = data; + + m_beeper->set_state(data & 0x04); + + m_screen_enable = data & 1; + + if(data & ~0x0f) + logerror("PPI PORTC W %02x\n",data & ~0x0f); +} + +WRITE8_MEMBER(mz2500_state::mz2500_pio1_porta_w) +{ +// printf("%02x\n",data); + + if(m_prev_col_val != ((data & 0x20) >> 5)) + { + m_text_col_size = ((data & 0x20) >> 5); + m_prev_col_val = m_text_col_size; + mz2500_reconfigure_screen(); + } + m_key_mux = data & 0x1f; +} + + +READ8_MEMBER(mz2500_state::mz2500_pio1_porta_r) +{ + static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", + "KEY4", "KEY5", "KEY6", "KEY7", + "KEY8", "KEY9", "KEYA", "KEYB", + "KEYC", "KEYD", "UNUSED", "UNUSED" }; + + if(((m_key_mux & 0x10) == 0x00) || ((m_key_mux & 0x0f) == 0x0f)) //status read + { + int res,i; + + res = 0xff; + for(i=0;i<0xe;i++) + res &= ioport(keynames[i])->read(); + + m_pio_latchb = res; + + return res; + } + + m_pio_latchb = ioport(keynames[m_key_mux & 0xf])->read(); + + return ioport(keynames[m_key_mux & 0xf])->read(); +} + +#if 0 +READ8_MEMBER(mz2500_state::mz2500_pio1_portb_r) +{ + return m_pio_latchb; +} +#endif + +READ8_MEMBER(mz2500_state::opn_porta_r) +{ + return m_ym_porta; +} + +WRITE8_MEMBER(mz2500_state::opn_porta_w) +{ + /* + ---- x--- mouse select + ---- -x-- palette bit (16/4096 colors) + ---- --x- floppy reverse bit (controls wd17xx bits in command registers) + */ + + m_fdc_reverse = data & 2; + m_pal_select = (data & 4) ? 1 : 0; + + m_ym_porta = data; +} + +PALETTE_INIT_MEMBER(mz2500_state, mz2500) +{ + int i; + + for(i=0;i<0x200;i++) + palette.set_pen_color(i,pal1bit(0),pal1bit(0),pal1bit(0)); + + /* set up 8 colors (PCG) */ + for(i=0;i<8;i++) + m_palette->set_pen_color(i+8,pal1bit((i & 2)>>1),pal1bit((i & 4)>>2),pal1bit((i & 1)>>0)); + + /* set up 16 colors (PCG / CG) */ + + /* set up 256 colors (CG) */ + { + int r,g,b; + + for(i = 0;i < 0x100;i++) + { + int bit0,bit1,bit2; + + bit0 = pal_256_param(i,0) ? 1 : 0; + bit1 = i & 0x01 ? 2 : 0; + bit2 = i & 0x10 ? 4 : 0; + b = bit0|bit1|bit2; + bit0 = pal_256_param(i,0) ? 1 : 0; + bit1 = i & 0x02 ? 2 : 0; + bit2 = i & 0x20 ? 4 : 0; + r = bit0|bit1|bit2; + bit0 = pal_256_param(i,0) ? 1 : 0; + bit1 = i & 0x04 ? 2 : 0; + bit2 = i & 0x40 ? 4 : 0; + g = bit0|bit1|bit2; + + m_palette->set_pen_color(i+0x100,pal3bit(r),pal3bit(g),pal3bit(b)); + } + } +} + +/* PIT8253 Interface */ + +WRITE_LINE_MEMBER(mz2500_state::pit8253_clk0_irq) +{ + if(m_irq_mask[1] && state & 1) + { + m_irq_pending[1] = 1; + m_maincpu->set_input_line(0, ASSERT_LINE); + } +} + +WRITE_LINE_MEMBER(mz2500_state::mz2500_rtc_alarm_irq) +{ + /* TODO: doesn't work yet */ +// if(m_irq_mask[3] && state & 1) +// m_maincpu->set_input_line_and_vector(0, HOLD_LINE,drvm_irq_vector[3]); +} + + +static SLOT_INTERFACE_START( mz2500_floppies ) + SLOT_INTERFACE("dd", FLOPPY_35_DD) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( mz2500, mz2500_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 6000000) + MCFG_CPU_PROGRAM_MAP(mz2500_map) + MCFG_CPU_IO_MAP(mz2500_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", mz2500_state, mz2500_vbl) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(mz2500_state,mz2500_irq_ack) + + MCFG_DEVICE_ADD("i8255_0", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(mz2500_state, mz2500_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mz2500_state, mz2500_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(mz2500_state, mz2500_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mz2500_state, mz2500_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(mz2500_state, mz2500_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mz2500_state, mz2500_portc_w)) + + MCFG_DEVICE_ADD("z80pio_1", Z80PIO, 6000000) + MCFG_Z80PIO_IN_PA_CB(READ8(mz2500_state, mz2500_pio1_porta_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(mz2500_state, mz2500_pio1_porta_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(mz2500_state, mz2500_pio1_porta_r)) + + MCFG_Z80SIO0_ADD("z80sio", 6000000, 0, 0, 0, 0) + + MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) + MCFG_RP5C15_OUT_ALARM_CB(WRITELINE(mz2500_state, mz2500_rtc_alarm_irq)) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(31250) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(mz2500_state, pit8253_clk0_irq)) + // TODO: is this really right? + MCFG_PIT8253_CLK1(0) + MCFG_PIT8253_CLK2(16) //CH2, used by Super MZ demo / The Black Onyx and a few others (TODO: timing of this) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pit", pit8253_device, write_clk1)) + + MCFG_MB8877_ADD("mb8877a", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("mb8877a:0", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:1", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:2", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877a:3", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "mz2500") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_21_4772MHz, 640+108, 0, 640, 480, 0, 200) //unknown clock / divider + MCFG_SCREEN_UPDATE_DRIVER(mz2500_state, screen_update_mz2500) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x200) + MCFG_PALETTE_INIT_OWNER(mz2500_state, mz2500) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz2500) + + + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("ym", YM2203, 2000000) //unknown clock / divider + MCFG_AY8910_PORT_A_READ_CB(READ8(mz2500_state, opn_porta_r)) // read A + MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1")) // read B + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(mz2500_state, opn_porta_w)) // write A + MCFG_SOUND_ROUTE(0, "mono", 0.25) + MCFG_SOUND_ROUTE(1, "mono", 0.25) + MCFG_SOUND_ROUTE(2, "mono", 0.50) + MCFG_SOUND_ROUTE(3, "mono", 0.50) + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) +MACHINE_CONFIG_END + + + +/* ROM definition */ +ROM_START( mz2500 ) + ROM_REGION( 0x08000, "ipl", 0 ) + ROM_LOAD( "ipl.rom", 0x00000, 0x8000, CRC(7a659f20) SHA1(ccb3cfdf461feea9db8d8d3a8815f7e345d274f7) ) + + /* this is probably an hand made ROM, will be removed in the end ...*/ + ROM_REGION( 0x1000, "cgrom", 0 ) + ROM_LOAD( "cg.rom", 0x0000, 0x0800, CRC(a082326f) SHA1(dfa1a797b2159838d078650801c7291fa746ad81) ) + + ROM_REGION( 0x40000, "kanji", 0 ) + ROM_LOAD( "kanji.rom", 0x0000, 0x40000, CRC(dd426767) SHA1(cc8fae0cd1736bc11c110e1c84d3f620c5e35b80) ) + + ROM_REGION( 0x20000, "kanji2", 0 ) + ROM_LOAD( "kanji2.rom", 0x0000, 0x20000, CRC(eaaf20c9) SHA1(771c4d559b5241390215edee798f3bce169d418c) ) + + ROM_REGION( 0x40000, "dictionary", 0 ) + ROM_LOAD( "dict.rom", 0x00000, 0x40000, CRC(aa957c2b) SHA1(19a5ba85055f048a84ed4e8d471aaff70fcf0374) ) + + ROM_REGION( 0x8000, "iplpro", ROMREGION_ERASEFF ) + ROM_LOAD( "sasi.rom", 0x00000, 0x8000, CRC(a7bf39ce) SHA1(3f4a237fc4f34bac6fe2bbda4ce4d16d42400081) ) + + ROM_REGION( 0x8000, "phone", ROMREGION_ERASEFF ) + ROM_LOAD( "phone.rom", 0x00000, 0x4000, CRC(8e49e4dc) SHA1(2589f0c95028037a41ca32a8fd799c5f085dab51) ) +ROM_END + +ROM_START( mz2520 ) + ROM_REGION( 0x08000, "ipl", 0 ) + ROM_LOAD( "ipl2520.rom", 0x00000, 0x8000, CRC(0a126eb2) SHA1(faf71236b3ad82d30184adea951d43d10ced663d) ) + + /* this is probably an hand made ROM, will be removed in the end ...*/ + ROM_REGION( 0x1000, "cgrom", 0 ) + ROM_LOAD( "cg.rom", 0x0000, 0x0800, CRC(a082326f) SHA1(dfa1a797b2159838d078650801c7291fa746ad81) ) + + ROM_REGION( 0x40000, "kanji", 0 ) + ROM_LOAD( "kanji.rom", 0x0000, 0x40000, CRC(dd426767) SHA1(cc8fae0cd1736bc11c110e1c84d3f620c5e35b80) ) + + ROM_REGION( 0x20000, "kanji2", 0 ) + ROM_LOAD( "kanji2.rom", 0x0000, 0x20000, CRC(eaaf20c9) SHA1(771c4d559b5241390215edee798f3bce169d418c) ) + + ROM_REGION( 0x40000, "dictionary", 0 ) + ROM_LOAD( "dict.rom", 0x00000, 0x40000, CRC(aa957c2b) SHA1(19a5ba85055f048a84ed4e8d471aaff70fcf0374) ) + + ROM_REGION( 0x8000, "iplpro", ROMREGION_ERASEFF ) + ROM_LOAD( "sasi.rom", 0x00000, 0x8000, CRC(a7bf39ce) SHA1(3f4a237fc4f34bac6fe2bbda4ce4d16d42400081) ) + + ROM_REGION( 0x8000, "phone", ROMREGION_ERASEFF ) + ROM_LOAD( "phone.rom", 0x00000, 0x4000, CRC(8e49e4dc) SHA1(2589f0c95028037a41ca32a8fd799c5f085dab51) ) +ROM_END + +/* Driver */ + +COMP( 1985, mz2500, 0, 0, mz2500, mz2500, driver_device, 0, "Sharp", "MZ-2500", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1985, mz2520, mz2500, 0, mz2500, mz2500, driver_device, 0, "Sharp", "MZ-2520", MACHINE_IMPERFECT_GRAPHICS ) // looks a stripped down version of the regular MZ-2500, with only two floppies drives and no cassette interface diff --git a/src/mame/drivers/mz3500.c b/src/mame/drivers/mz3500.c new file mode 100644 index 00000000000..8a5828e0401 --- /dev/null +++ b/src/mame/drivers/mz3500.c @@ -0,0 +1,873 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + MZ-3500 (c) 198? Sharp + + preliminary driver by Angelo Salese + + TODO: + - BUSREQ / BUSACK signals. + - master/slave comms aren't perfect (especially noticeable if you change the video DIP) + + Notes: + Sub-CPU test meanings: + * RA (tests RAM, first is work RAM, other two are shared RAM banks) + * VR (tests VRAM) + * CRT interface test: + - 40x20 + - 80x25 + - monochrome attribute test + - 80x25 color test (text B-R-G-W, border: black, blue, red, green, black) + - 40x20 color test (text B-R-G-W, border: black, blue, red, green, black) + * Speaker test + * PR (Printer interface test) + * LP (Light pen test) + * RS (RS-232C interface test) + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/upd765.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "sound/beep.h" +#include "video/upd7220.h" + +#define MAIN_CLOCK XTAL_8MHz + +class mz3500_state : public driver_device +{ +public: + mz3500_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_master(*this, "master"), + m_slave(*this, "slave"), + m_hgdc1(*this, "upd7220_chr"), + m_hgdc2(*this, "upd7220_gfx"), + m_fdc(*this, "upd765a"), + m_video_ram(*this, "video_ram"), + m_beeper(*this, "beeper"), + m_palette(*this, "palette"), + m_system_dsw(*this, "SYSTEM_DSW"), + m_fd_dsw(*this, "FD_DSW") + { } + + // devices + required_device m_master; + required_device m_slave; + required_device m_hgdc1; + required_device m_hgdc2; + required_device m_fdc; + required_shared_ptr m_video_ram; + required_device m_beeper; + required_device m_palette; + + UINT8 *m_ipl_rom; + UINT8 *m_basic_rom; + UINT8 *m_work_ram; + UINT8 *m_shared_ram; + UINT8 *m_char_rom; + + UINT8 m_ma,m_mo,m_ms,m_me2,m_me1; + UINT8 m_crtc[0x10]; + + UINT8 m_srdy; + + UINT8 m_fdd_sel; + + DECLARE_READ8_MEMBER(mz3500_master_mem_r); + DECLARE_WRITE8_MEMBER(mz3500_master_mem_w); + DECLARE_READ8_MEMBER(mz3500_ipl_r); + DECLARE_READ8_MEMBER(mz3500_basic_r); + DECLARE_READ8_MEMBER(mz3500_work_ram_r); + DECLARE_WRITE8_MEMBER(mz3500_work_ram_w); + DECLARE_READ8_MEMBER(mz3500_shared_ram_r); + DECLARE_WRITE8_MEMBER(mz3500_shared_ram_w); + DECLARE_READ8_MEMBER(mz3500_io_r); + DECLARE_WRITE8_MEMBER(mz3500_io_w); + DECLARE_WRITE8_MEMBER(mz3500_crtc_w); + DECLARE_READ8_MEMBER(mz3500_fdc_r); + DECLARE_WRITE8_MEMBER(mz3500_fdc_w); + DECLARE_READ8_MEMBER(mz3500_fdc_dma_r); + DECLARE_WRITE8_MEMBER(mz3500_pa_w); + DECLARE_WRITE8_MEMBER(mz3500_pb_w); + DECLARE_WRITE8_MEMBER(mz3500_pc_w); + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); + UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + +private: + required_ioport m_system_dsw; + required_ioport m_fd_dsw; + floppy_connector *m_floppy_connector[4]; +}; + +void mz3500_state::video_start() +{ +} + +/* +CRTC regs +[0] +---- -x-- "Choice of whether attribute or cursor be put on the frame that displayed on CRT2" (whatever that means ...) +---- --x- CRT2 output +---- ---x CRT1 output +[1] +---- -GRB CRT1 color output +[2] +---- -GRB CRT2 color output +[3] +---- -GRB background color output +[4] +---- --x- border color mode in effect +---- ---x color mode +[5] +---- --x- width setting (0: 40 chars, 1: 80 chars) +---- ---x data size for graphics RAM (0: 8 bits, 1: 16 bits) +[6] +---- -x-- "Connection of graphic GDC" +---- --x- "Connection of the 96K bytes VRAM" +---- ---x "Connection of a 400 raster CRT" +[7] +---- ---x 0: 25 lines, 1: 20 lines display +[d] +(mirror of [5]?) +*/ + +UPD7220_DISPLAY_PIXELS_MEMBER( mz3500_state::hgdc_display_pixels ) +{ + // ... +} + +UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int x; + int xi,yi; + int tile; + int attr; + UINT8 tile_data; + UINT8 width80; + UINT8 char_size; + UINT8 hires; + UINT8 color_mode; + +// popmessage("%02x",m_crtc[6]); + + color_mode = m_crtc[4] & 1; + width80 = (m_crtc[5] & 2) >> 1; + hires = (m_crtc[6] & 1); + char_size = (hires) ? 16 : 8; + + for( x = 0; x < pitch; x++ ) + { + tile = (m_video_ram[(((addr+x)*2) & 0x1fff) >> 1] & 0xff); + attr = ((m_video_ram[(((addr+x)*2+1) & 0x3ffff) >> 1] >> 8) & 0x0f); + + //if(hires) + // tile <<= 1; + + for( yi = 0; yi < lr; yi++) + { + tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)]; + + for( xi = 0; xi < 8; xi++) + { + int res_x,res_y; + int pen; + + if(yi >= char_size) + pen = -1; + else + { + if(color_mode) + pen = (tile_data >> (7-xi)) & 1 ? (attr ^ 7) : -1; + else + { + /* TODO: "highlight" */ + //if(attr & 4) + // tile_data ^= 0xff; + + if(attr & 1) // VL + tile_data |= 8; + + /* TODO: correct position of HL */ + if(attr & 2 && yi == char_size/2) // HL + tile_data |= 0xff; + + /* TODO: blink (bit 3) */ + + pen = (tile_data >> (7-xi)) & 1 ? 7 : -1; + } + } + + res_x = x * 8 + xi; + res_y = y + yi; + + if(pen != -1) + { + if(!width80) + { + bitmap.pix32(res_y, res_x*2+0) = palette[pen]; + bitmap.pix32(res_y, res_x*2+1) = palette[pen]; + } + else + bitmap.pix32(res_y, res_x) = palette[pen]; + } + } + } + } + +} + +UINT32 mz3500_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) +{ + bitmap.fill(m_palette->pen((m_crtc[4] & 2) ? m_crtc[3] & 7 : 0), cliprect); + + /* graphics */ + m_hgdc2->screen_update(screen, bitmap, cliprect); + m_hgdc1->screen_update(screen, bitmap, cliprect); + return 0; +} + +READ8_MEMBER(mz3500_state::mz3500_ipl_r) +{ + return m_ipl_rom[offset]; +} + +READ8_MEMBER(mz3500_state::mz3500_basic_r) +{ + return m_basic_rom[offset]; +} + +READ8_MEMBER(mz3500_state::mz3500_work_ram_r) +{ + return m_work_ram[offset]; +} + +WRITE8_MEMBER(mz3500_state::mz3500_work_ram_w) +{ + m_work_ram[offset] = data; +} + + +READ8_MEMBER(mz3500_state::mz3500_master_mem_r) +{ + if(m_ms == 0) + { + if((offset & 0xe000) == 0x0000) { return mz3500_ipl_r(space,(offset & 0xfff) | 0x1000); } + if((offset & 0xe000) == 0x2000) { return mz3500_basic_r(space,(offset & 0x1fff) | 0x2000); } + if((offset & 0xc000) == 0x4000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x4000); } + if((offset & 0xc000) == 0x8000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x8000); } + if((offset & 0xc000) == 0xc000) + { + if(m_ma == 0x0) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0xc000); } + if(m_ma == 0x1) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x0000); } + if(m_ma == 0xf) { return mz3500_shared_ram_r(space,(offset & 0x7ff)); } + } + + printf("Read with unmapped memory bank offset %04x MS %02x MA %02x\n",offset,m_ms,m_ma); + } + else if(m_ms == 1) + { + return ((offset & 0xf800) == 0xf800) ? mz3500_shared_ram_r(space,(offset & 0x7ff)) : mz3500_work_ram_r(space,offset); + } + else if(m_ms == 2) // ROM based BASIC + { + if((offset & 0xe000) == 0x0000) { return mz3500_basic_r(space,offset & 0x1fff); } + if((offset & 0xe000) == 0x2000) + { + switch(m_mo) + { + case 0x0: return mz3500_basic_r(space,(offset & 0x1fff) | 0x2000); + case 0x1: return mz3500_basic_r(space,(offset & 0x1fff) | 0x4000); + case 0x2: return mz3500_basic_r(space,(offset & 0x1fff) | 0x6000); + } + } + if((offset & 0xc000) == 0x4000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x4000); } + if((offset & 0xc000) == 0x8000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x8000); } + if((offset & 0xc000) == 0xc000) + { + switch(m_ma) + { + case 0x0: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x0c000); + case 0x1: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x00000); + case 0x2: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x10000); + case 0x3: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x14000); + case 0x4: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x18000); + case 0x5: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x1c000); + case 0x6: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x20000); + case 0x7: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x24000); + case 0x8: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x28000); + case 0x9: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x2c000); + case 0xa: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x30000); + case 0xb: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x34000); + case 0xc: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x38000); + case 0xd: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x3c000); + case 0xf: return mz3500_shared_ram_r(space,(offset & 0x7ff)); + } + } + + printf("Read with unmapped memory bank offset %04x MS %02x MA %02x MO %02x\n",offset,m_ms,m_ma,m_mo); + } + else if (m_ms == 3) // RAM based BASIC + { + if((offset & 0xe000) == 0x0000) { return mz3500_work_ram_r(space,offset & 0x1fff); } + if((offset & 0xe000) == 0x2000) + { + switch(m_mo) + { + case 0x0: return mz3500_work_ram_r(space,(offset & 0x1fff) | 0x2000); + case 0x1: return mz3500_work_ram_r(space,(offset & 0x1fff) | 0xc000); + case 0x2: return mz3500_work_ram_r(space,(offset & 0x1fff) | 0xe000); + } + + printf("Read with unmapped memory bank offset %04x MS %02x MO %02x\n",offset,m_ms,m_mo); + } + if((offset & 0xc000) == 0x4000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x4000); } + if((offset & 0xc000) == 0x8000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x8000); } + if((offset & 0xc000) == 0xc000) + { + switch(m_ma) + { + case 0x0: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x10000); + case 0x1: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x14000); + case 0x2: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x18000); + case 0x3: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x1c000); + case 0x4: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x20000); + case 0x5: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x24000); + case 0x6: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x28000); + case 0x7: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x2c000); + case 0x8: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x30000); + case 0x9: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x34000); + case 0xa: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x38000); + case 0xb: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x3c000); + case 0xf: return mz3500_shared_ram_r(space,(offset & 0x7ff)); + } + } + } + + + return 0xff; // shouldn't happen +} + +WRITE8_MEMBER(mz3500_state::mz3500_master_mem_w) +{ + if(m_ms == 0) // Initialize State + { + if((offset & 0xc000) == 0x4000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x4000,data); return; } + if((offset & 0xc000) == 0x8000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x8000,data); return; } + if((offset & 0xc000) == 0xc000) + { + if(m_ma == 0x0) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0xc000,data); return; } + if(m_ma == 0x1) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x0000,data); return; } + if(m_ma == 0xf) { mz3500_shared_ram_w(space,(offset & 0x7ff),data); return; } + } + + printf("Write with unmapped memory bank offset %04x data %02x MS %02x MA %02x\n",offset,data,m_ms,m_ma); + } + else if(m_ms == 1) // System Loading & CP/M + { + if((offset & 0xf800) == 0xf800) + mz3500_shared_ram_w(space,(offset & 0x7ff),data); + else + mz3500_work_ram_w(space,offset,data); + + return; + } + else if(m_ms == 2) // ROM based BASIC + { + if((offset & 0xc000) == 0x4000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x4000,data); return; } + if((offset & 0xc000) == 0x8000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x8000,data); return; } + if((offset & 0xc000) == 0xc000) + { + switch(m_ma) + { + case 0x0: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x0c000,data); return; + case 0x1: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x00000,data); return; + case 0x2: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x10000,data); return; + case 0x3: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x14000,data); return; + case 0x4: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x18000,data); return; + case 0x5: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x1c000,data); return; + case 0x6: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x20000,data); return; + case 0x7: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x24000,data); return; + case 0x8: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x28000,data); return; + case 0x9: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x2c000,data); return; + case 0xa: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x30000,data); return; + case 0xb: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x34000,data); return; + case 0xc: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x38000,data); return; + case 0xd: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x3c000,data); return; + case 0xf: mz3500_shared_ram_w(space,(offset & 0x7ff),data); return; + } + } + + printf("Write with unmapped memory bank offset %04x data %02x MS %02x MA %02x\n",offset,data,m_ms,m_ma); + } + else if (m_ms == 3) // RAM based BASIC + { + if((offset & 0xe000) == 0x0000) { mz3500_work_ram_w(space,offset & 0x1fff,data); return; } + if((offset & 0xe000) == 0x2000) + { + switch(m_mo) + { + case 0x0: mz3500_work_ram_w(space,(offset & 0x1fff) | 0x2000,data); return; + case 0x1: mz3500_work_ram_w(space,(offset & 0x1fff) | 0xc000,data); return; + case 0x2: mz3500_work_ram_w(space,(offset & 0x1fff) | 0xe000,data); return; + } + + printf("Read with unmapped memory bank offset %04x MS %02x MO %02x\n",offset,m_ms,m_mo); + } + if((offset & 0xc000) == 0x4000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x4000,data); return; } + if((offset & 0xc000) == 0x8000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x8000,data); return; } + if((offset & 0xc000) == 0xc000) + { + switch(m_ma) + { + case 0x0: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x10000,data); return; + case 0x1: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x14000,data); return; + case 0x2: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x18000,data); return; + case 0x3: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x1c000,data); return; + case 0x4: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x20000,data); return; + case 0x5: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x24000,data); return; + case 0x6: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x28000,data); return; + case 0x7: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x2c000,data); return; + case 0x8: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x30000,data); return; + case 0x9: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x34000,data); return; + case 0xa: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x38000,data); return; + case 0xb: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x3c000,data); return; + case 0xf: mz3500_shared_ram_w(space,(offset & 0x7ff),data); return; + } + } + } +} + +READ8_MEMBER(mz3500_state::mz3500_shared_ram_r) +{ + return m_shared_ram[offset]; +} + +WRITE8_MEMBER(mz3500_state::mz3500_shared_ram_w) +{ + m_shared_ram[offset] = data; +} + +READ8_MEMBER(mz3500_state::mz3500_io_r) +{ + /* + [2] + ---x xxx- system assign switch + ---- ---x "SEC" FD assign + [3] + xxx- ---- FD assign + ---x ---- slave CPU Ready signal + ---- x--- slave CPU ack signal + ---- -xxx interrupt status + */ + + switch(offset) + { + case 2: + return ((m_system_dsw->read() & 0x0f) << 1) | ((m_fd_dsw->read() & 0x8) >> 3); + case 3: + return ((m_fd_dsw->read() & 0x7)<<5) | (m_srdy << 4); + } + + return 0; +} + +WRITE8_MEMBER(mz3500_state::mz3500_io_w) +{ + /* + [0] + ---- --x- SRQ bus request from master to slave + ---- ---x E1 + [1] + x--- ---- slave reset signal + ---- --xx memory system define + [2] + xxxx ---- ma bank (memory 0xc000-0xffff) + ---- -xxx mo bank (memory 0x2000-0x3fff) + [3] + x--- ---- me2 bank (memory 0x8000-0xbfff) + -x-- ---- me1 bank (memory 0x4000-0x7fff) + */ + + switch(offset) + { + case 0: + /* HACK: actually busreq */ + m_slave->set_input_line(INPUT_LINE_HALT, data & 2 ? ASSERT_LINE : CLEAR_LINE); + + break; + case 1: + m_ms = data & 3; + break; + case 2: + m_ma = (data & 0xf0) >> 4; + m_mo = (data & 0x07); + break; + case 3: + m_me2 = (data & 0x80) >> 7; + m_me1 = (data & 0x40) >> 6; + break; + } +} + +WRITE8_MEMBER(mz3500_state::mz3500_crtc_w) +{ + if(offset & 8) + { + if(offset == 0xd) + m_crtc[offset & 7] = data; + else + printf("CRTC register access %02x\n",offset); // probably just a mirror, but who knows ... + } + else + m_crtc[offset] = data; +} + +READ8_MEMBER(mz3500_state::mz3500_fdc_r) +{ + /* + ---- -x-- Motor + ---- --x- Index + ---- ---x Drq + */ + + floppy_image_device *floppy = m_floppy_connector[m_fdd_sel]->get_device(); + + return (floppy->mon_r() << 2) | (floppy->idx_r() << 1) | (m_fdc->get_drq() & 1); +} + +WRITE8_MEMBER(mz3500_state::mz3500_fdc_w) +{ + /* + x--- ---- FDC int enable + -x-- ---- FDD select signal + --x- ---- FDC TC + ---x ---- motor on signal + ---- xxxx Select FDD 0-3 (bit-wise) + */ + + if(data & 0x40) + { + for(int i=0;i<4;i++) + { + if(data & 1 << i) + { + m_fdd_sel = i; + break; + } + } + } + + m_floppy_connector[m_fdd_sel]->get_device()->mon_w(data & 0x10 ? CLEAR_LINE : ASSERT_LINE); + +} + +READ8_MEMBER(mz3500_state::mz3500_fdc_dma_r) +{ + return m_fdc->dma_r(); +} + +static ADDRESS_MAP_START( mz3500_master_map, AS_PROGRAM, 8, mz3500_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(mz3500_master_mem_r,mz3500_master_mem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mz3500_master_io, AS_IO, 8, mz3500_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) +// ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0xe4, 0xe7) SFD upd765 +// AM_RANGE(0xe8, 0xeb) SFD I/O port and DMAC chip select +// AM_RANGE(0xec, 0xef) irq signal from slave to master CPU + AM_RANGE(0xf4, 0xf5) AM_DEVICE("upd765a", upd765a_device, map) // MFD upd765 +// AM_RANGE(0xf8, 0xfb) MFD I/O port + AM_RANGE(0xf8, 0xf8) AM_READWRITE(mz3500_fdc_r,mz3500_fdc_w) + AM_RANGE(0xf9, 0xf9) AM_READ(mz3500_fdc_dma_r) + AM_RANGE(0xfc, 0xff) AM_READWRITE(mz3500_io_r,mz3500_io_w) // memory mapper +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mz3500_slave_map, AS_PROGRAM, 8, mz3500_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("ipl", 0) + AM_RANGE(0x2000, 0x27ff) AM_READWRITE(mz3500_shared_ram_r, mz3500_shared_ram_w) + AM_RANGE(0x4000, 0x5fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mz3500_slave_io, AS_IO, 8, mz3500_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x00, 0x0f) f/f and irq to master CPU +// AM_RANGE(0x10, 0x1f) i8251 +// AM_RANGE(0x20, 0x2f) pit8253 + AM_RANGE(0x30, 0x33) AM_DEVREADWRITE("i8255", i8255_device, read, write) + AM_RANGE(0x40, 0x40) AM_READ_PORT("DSW") + AM_RANGE(0x50, 0x5f) AM_RAM_WRITE(mz3500_crtc_w) + AM_RANGE(0x60, 0x61) AM_DEVREADWRITE("upd7220_gfx", upd7220_device, read, write) + AM_RANGE(0x70, 0x71) AM_DEVREADWRITE("upd7220_chr", upd7220_device, read, write) +ADDRESS_MAP_END + +WRITE8_MEMBER(mz3500_state::mz3500_pa_w) +{ + // printer data +} + +WRITE8_MEMBER(mz3500_state::mz3500_pb_w) +{ + /* + x--- ---- CG select (ROM and/or upd7220 clock?) + -x-- ---- SRDY signal (to master) + --xx xxxx upd1990 RTC (CLK, Din, C2, C1, C0, STRB) + + */ + //printf("%02x PB\n",data); + + m_srdy = (data & 0x40) >> 6; +} + +WRITE8_MEMBER(mz3500_state::mz3500_pc_w) +{ + /* + x--- ---- printer OBF output + -x-- ---- printer ACK input + --x- ---- printer STROBE + ---x ---- buzzer + ---- -xxx Keyboard (ACKC, STC, DC) + */ + //printf("%02x PC\n",data); + + m_beeper->set_state(data & 0x10); + +} + +static INPUT_PORTS_START( mz3500 ) + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x00, "SYSA" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Sub-CPU Test" ) /* hack */ + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("FD_DSW") + PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("SYSTEM_DSW") + PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, "CRT Select" ) + PORT_DIPSETTING( 0x04, "Normal Display (MZ1D01, MZ1D06)" ) + PORT_DIPSETTING( 0x00, "Hi-Res Display (MZ1D02, MZ1D03)" ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +static const gfx_layout charlayout_8x8 = +{ + 8,8, + 0x100, + 1, + { RGN_FRAC(0,1) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*16 +}; + + +static const gfx_layout charlayout_8x16 = +{ + 8,16, + 0x100, + 1, + { RGN_FRAC(0,1) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { STEP16(0,8) }, + 8*16 +}; + +static GFXDECODE_START( mz3500 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout_8x8, 0, 1 ) + GFXDECODE_ENTRY( "gfx1", 0x0008, charlayout_8x8, 0, 1 ) + GFXDECODE_ENTRY( "gfx1", 0x1000, charlayout_8x16, 0, 1 ) +GFXDECODE_END + +void mz3500_state::machine_start() +{ + m_ipl_rom = memregion("ipl")->base(); + m_basic_rom = memregion("basic")->base(); + m_char_rom = memregion("gfx1")->base(); + m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x40000); + m_shared_ram = auto_alloc_array_clear(machine(), UINT8, 0x800); + + static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"}; + + for (int i = 0; i < 4; i++) + { + m_floppy_connector[i] = machine().device(m_fddnames[i]); + } +} + +void mz3500_state::machine_reset() +{ + /* init memory bank states */ + m_ms = 0; + m_ma = 0; + m_mo = 0; + m_me1 = 0; + m_me2 = 0; + //m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_srdy = 0; + + upd765a_device *fdc; + fdc = machine().device(":upd765a"); + + if (fdc) + { + m_fdd_sel = 0; + { + for(int i=0;i<4;i++) + { + m_floppy_connector[i]->get_device()->mon_w(ASSERT_LINE); + m_floppy_connector[i]->get_device()->set_rpm(300); + } + + machine().device("upd765a")->set_rate(250000); + } + } + + m_beeper->set_frequency(2400); + m_beeper->set_state(0); +} + + +static ADDRESS_MAP_START( upd7220_1_map, AS_0, 16, mz3500_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + AM_RANGE(0x00000, 0x00fff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( upd7220_2_map, AS_0, 16, mz3500_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM // AM_SHARE("video_ram_2") +ADDRESS_MAP_END + +static SLOT_INTERFACE_START( mz3500_floppies ) + SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) +SLOT_INTERFACE_END + +/* TODO: clocks */ +static MACHINE_CONFIG_START( mz3500, mz3500_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("master",Z80,MAIN_CLOCK/2) + MCFG_CPU_PROGRAM_MAP(mz3500_master_map) + MCFG_CPU_IO_MAP(mz3500_master_io) + + MCFG_CPU_ADD("slave",Z80,MAIN_CLOCK/2) + MCFG_CPU_PROGRAM_MAP(mz3500_slave_map) + MCFG_CPU_IO_MAP(mz3500_slave_io) + + MCFG_QUANTUM_PERFECT_CPU("master") + + MCFG_DEVICE_ADD("i8255", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mz3500_state, mz3500_pa_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(mz3500_state, mz3500_pb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mz3500_state, mz3500_pc_w)) + + MCFG_UPD765A_ADD("upd765a", true, true) + MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE("master", INPUT_LINE_IRQ0)) + MCFG_FLOPPY_DRIVE_ADD("upd765a:0", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765a:1", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765a:2", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765a:3", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD("upd7220_chr", UPD7220, MAIN_CLOCK/5) + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map) + MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(mz3500_state, hgdc_draw_text) + MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_gfx", upd7220_device, ext_sync_w)) + + MCFG_DEVICE_ADD("upd7220_gfx", UPD7220, MAIN_CLOCK/5) + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz3500_state, hgdc_display_pixels) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_UPDATE_DRIVER(mz3500_state, screen_update) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz3500) + + MCFG_PALETTE_ADD_3BIT_BRG("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( mz3500 ) + ROM_REGION( 0x2000, "ipl", ROMREGION_ERASE00 ) + ROM_LOAD( "mz-3500_ipl-rom_2-0a_m5l2764k.bin", 0x000000, 0x002000, CRC(119708b9) SHA1(de81979608ba6ab76f09088a92bfd1a5bc42530e) ) + + ROM_REGION( 0x8000, "basic", ROMREGION_ERASE00 ) + ROM_LOAD( "basic.rom", 0x00000, 0x8000, NO_DUMP ) + + ROM_REGION( 0x2000, "gfx1", ROMREGION_ERASE00 ) + ROM_LOAD( "mz-3500_cg-rom_2-b_m5l2764k.bin", 0x000000, 0x002000, CRC(29f2f80a) SHA1(64b307cd9de5a3327e3ec9f3d0d6b3485706f436) ) +ROM_END + +COMP( 198?, mz3500, 0, 0, mz3500, mz3500, driver_device, 0, "Sharp", "MZ-3500", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/mz6500.c b/src/mame/drivers/mz6500.c new file mode 100644 index 00000000000..31e9a2ee917 --- /dev/null +++ b/src/mame/drivers/mz6500.c @@ -0,0 +1,180 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Sharp MZ-6500 + + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "machine/upd765.h" +#include "video/upd7220.h" + +class mz6500_state : public driver_device +{ +public: + mz6500_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_hgdc(*this, "upd7220"), + m_fdc(*this, "upd765"), + m_video_ram(*this, "video_ram"), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") { } + + required_device m_hgdc; + required_device m_fdc; + DECLARE_READ8_MEMBER(mz6500_vram_r); + DECLARE_WRITE8_MEMBER(mz6500_vram_w); + void fdc_irq(bool state); + void fdc_drq(bool state); + required_shared_ptr m_video_ram; + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; + required_device m_palette; + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); +}; + +UPD7220_DISPLAY_PIXELS_MEMBER( mz6500_state::hgdc_display_pixels ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int gfx[3]; + UINT8 i,pen; + + gfx[0] = m_video_ram[(address + 0x00000) >> 1]; + gfx[1] = m_video_ram[(address + 0x10000) >> 1]; + gfx[2] = m_video_ram[(address + 0x20000) >> 1]; + + for(i=0; i<16; i++) + { + pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); + + bitmap.pix32(y, x + i) = palette[pen]; + } +} + + +void mz6500_state::video_start() +{ +} + + +READ8_MEMBER( mz6500_state::mz6500_vram_r ) +{ + return m_video_ram[offset >> 1] >> ((offset & 1) ? 8 : 0); +} + +WRITE8_MEMBER( mz6500_state::mz6500_vram_w ) +{ + int mask = (offset & 1) ? 8 : 0; + offset >>= 1; + m_video_ram[offset] &= 0xff00 >> mask; + m_video_ram[offset] |= data << mask; +} + +static ADDRESS_MAP_START(mz6500_map, AS_PROGRAM, 16, mz6500_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0x9ffff) AM_RAM +// AM_RANGE(0xa0000,0xbffff) kanji/dictionary ROM + AM_RANGE(0xc0000,0xeffff) AM_READWRITE8(mz6500_vram_r,mz6500_vram_w,0xffff) + AM_RANGE(0xfc000,0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mz6500_io, AS_IO, 16, mz6500_state) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x0000, 0x000f) i8237 dma +// AM_RANGE(0x0010, 0x001f) i8255 + AM_RANGE(0x0020, 0x0021) AM_MIRROR(0xe) AM_DEVICE8("upd765", upd765a_device, map, 0xffff) +// AM_RANGE(0x0030, 0x003f) i8259 master +// AM_RANGE(0x0040, 0x004f) i8259 slave +// AM_RANGE(0x0050, 0x0050) segment byte for DMA +// AM_RANGE(0x0060, 0x0060) system port A +// AM_RANGE(0x0070, 0x0070) system port C +// AM_RANGE(0x00cd, 0x00cd) MZ-1R32 + AM_RANGE(0x0100, 0x0103) AM_MIRROR(0xc) AM_DEVREADWRITE8("upd7220", upd7220_device, read, write, 0x00ff) +// AM_RANGE(0x0110, 0x011f) video address / data registers (priority) +// AM_RANGE(0x0120, 0x012f) video registers +// AM_RANGE(0x0130, 0x013f) video register +// AM_RANGE(0x0140, 0x015f) palette pens +// AM_RANGE(0x0200, 0x020f) z80sio +// AM_RANGE(0x0210, 0x021f) z80ctc +// AM_RANGE(0x0220, 0x022f) rp5c01 +// AM_RANGE(0x0230, 0x023f) ay-3-8912 +// AM_RANGE(0x0240, 0x0240) z80ctc vector ack +// AM_RANGE(0x0250, 0x0250) z80sio vector ack +// AM_RANGE(0x0270, 0x0270) system port B +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( mz6500 ) +INPUT_PORTS_END + + +void mz6500_state::machine_reset() +{ +} + +void mz6500_state::fdc_irq(bool state) +{ + //printf("%02x IRQ\n",state); +} + +void mz6500_state::fdc_drq(bool state) +{ + //printf("%02x DRQ\n",state); +} + +static SLOT_INTERFACE_START( mz6500_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +static ADDRESS_MAP_START( upd7220_map, AS_0, 16, mz6500_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + + +static MACHINE_CONFIG_START( mz6500, mz6500_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 8000000) //unk clock + MCFG_CPU_PROGRAM_MAP(mz6500_map) + MCFG_CPU_IO_MAP(mz6500_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_PALETTE_ADD("palette", 8) + + /* Devices */ + MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/6) // unk clock + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz6500_state, hgdc_display_pixels) + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mz6500 ) + ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x4000,CRC(6c978ac4) SHA1(7872d7e6d9cda2ed9f47ed4833a5caa4dfe0e55c)) + + ROM_REGION( 0x40000, "dictionary", ROMREGION_ERASEFF ) + ROM_LOAD( "dict.rom", 0x0000, 0x40000, CRC(2df3cfd3) SHA1(d420ede09658c2626b0bb650a063d88b1783e554)) + + ROM_REGION( 0x40000, "kanji", ROMREGION_ERASEFF ) + ROM_LOAD( "kanji.rom", 0x0000, 0x40000, CRC(b618e25d) SHA1(1da93337fecde6c0f8a5bd68f3f0b3222a38d63e)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, mz6500, 0, 0, mz6500, mz6500, driver_device, 0, "Sharp", "MZ-6500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/mz700.c b/src/mame/drivers/mz700.c new file mode 100644 index 00000000000..4039da71e14 --- /dev/null +++ b/src/mame/drivers/mz700.c @@ -0,0 +1,456 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Dirk Best +/****************************************************************************** + * Sharp MZ700 + * + * Reference: http://sharpmz.computingmuseum.com + * + * MZ700 memory map + * + * 0000-0FFF 1Z-013A ROM or RAM + * 1000-CFFF RAM + * D000-D7FF videoram or RAM + * D800-DFFF colorram or RAM + * E000-FFFF memory mapped IO or RAM + * + * xxx0 PPI8255 port A (output) + * bit 7 556RST (reset NE556) + * bit 6-4 unused + * bit 3-0 keyboard row demux (LS145) + * + * xxx1 PPI8255 port B (input) + * bit 7-0 keyboard matrix code + * + * xxx2 PPI8255 port C (input/output) + * bit 7 R -VBLANK input + * bit 6 R 556OUT (1.5Hz) + * bit 5 R RDATA from cassette + * bit 4 R MOTOR from cassette + * bit 3 W M-ON control + * bit 2 W INTMASK 1=enable 0=disabel clock interrupt + * bit 1 W WDATA to cassette + * bit 0 W unused + * + * xxx3 PPI8255 control + * + * xxx4 PIT8253 timer 0 (clock input 1,108800 MHz) + * xxx5 PIT8253 timer 1 (clock input 15,611 kHz) + * xxx6 PIT8253 timer 2 (clock input OUT1 1Hz (default)) + * xxx7 PIT8253 control/status + * + * xxx8 bit 7 R -HBLANK + * bit 6 R unused + * bit 5 R unused + * bit 4 R joystick JB2 + * bit 3 R joystick JB1 + * bit 2 R joystick JA2 + * bit 1 R joystick JA1 + * bit 0 R NE556 OUT (32Hz IC BJ) + * W gate0 of PIT8253 (sound enable) + * + * MZ800 memory map + * + * 0000-0FFF ROM or RAM + * 1000-1FFF PCG ROM or RAM + * 2000-7FFF RAM + * 8000-9FFF videoram or RAM + * A000-BFFF videoram or RAM + * C000-CFFF PCG RAM or RAM + * D000-DFFF videoram or RAM + * E000-FFFF memory mapped IO or RAM + * + *****************************************************************************/ + +#include "emu.h" +#include "includes/mz700.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/z80pio.h" +#include "machine/74145.h" +#include "bus/centronics/ctronics.h" +#include "sound/sn76496.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "formats/mz_cas.h" + + +/*************************************************************************** + TIMER DEVICE CALLBACKS +***************************************************************************/ + +TIMER_DEVICE_CALLBACK_MEMBER(mz_state::ne556_cursor_callback) +{ + m_cursor_timer ^= 1; +} + +TIMER_DEVICE_CALLBACK_MEMBER(mz_state::ne556_other_callback) +{ + m_other_timer ^= 1; +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( mz700_mem, AS_PROGRAM, 8, mz_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mz700_io, AS_IO, 8, mz_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xe0, 0xe0) AM_WRITE(mz700_bank_0_w) + AM_RANGE(0xe1, 0xe1) AM_WRITE(mz700_bank_1_w) + AM_RANGE(0xe2, 0xe2) AM_WRITE(mz700_bank_2_w) + AM_RANGE(0xe3, 0xe3) AM_WRITE(mz700_bank_3_w) + AM_RANGE(0xe4, 0xe4) AM_WRITE(mz700_bank_4_w) + AM_RANGE(0xe5, 0xe5) AM_WRITE(mz700_bank_5_w) + AM_RANGE(0xe6, 0xe6) AM_WRITE(mz700_bank_6_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mz800_mem, AS_PROGRAM, 8, mz_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mz800_io, AS_IO, 8, mz_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xcc, 0xcc) AM_WRITE(mz800_write_format_w ) + AM_RANGE(0xcd, 0xcd) AM_WRITE(mz800_read_format_w ) + AM_RANGE(0xce, 0xce) AM_READWRITE(mz800_crtc_r, mz800_display_mode_w ) + AM_RANGE(0xcf, 0xcf) AM_WRITE(mz800_scroll_border_w ) + AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) + AM_RANGE(0xd4, 0xd7) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE(0xe0, 0xe0) AM_READWRITE(mz800_bank_0_r, mz800_bank_0_w) + AM_RANGE(0xe1, 0xe1) AM_READWRITE(mz800_bank_1_r, mz700_bank_1_w) + AM_RANGE(0xe2, 0xe2) AM_WRITE(mz700_bank_2_w) + AM_RANGE(0xe3, 0xe3) AM_WRITE(mz700_bank_3_w) + AM_RANGE(0xe4, 0xe4) AM_WRITE(mz700_bank_4_w) + AM_RANGE(0xe5, 0xe5) AM_WRITE(mz700_bank_5_w) + AM_RANGE(0xe6, 0xe6) AM_WRITE(mz700_bank_6_w) + AM_RANGE(0xea, 0xea) AM_READWRITE(mz800_ramdisk_r, mz800_ramdisk_w ) + AM_RANGE(0xeb, 0xeb) AM_WRITE(mz800_ramaddr_w ) + AM_RANGE(0xf0, 0xf0) AM_READ_PORT("atari_joy1") AM_WRITE(mz800_palette_w) + AM_RANGE(0xf1, 0xf1) AM_READ_PORT("atari_joy2") + AM_RANGE(0xf2, 0xf2) AM_DEVWRITE("sn76489n", sn76489_device, write) + AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/* 2008-05 FP: +Notice that there is no Backspace key, only a 'Del' one. + +Small note about natural keyboard support: currently, +- "Alpha" is mapped to 'F6' +- "Graph" is mapped to 'F7' +- "Break" is mapped to 'F8' */ + +static INPUT_PORTS_START( mz700 ) + PORT_START("ROW0") + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, 0x08, IPT_UNUSED ) + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_NAME("Alpha") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93 \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\xA3') // this one would be 2nd row, 3rd key after 'P' + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_CHAR('_') // this one would be 2nd row, 4th key after 'P' + + PORT_START("ROW1") + PORT_BIT(0x07, 0x07, IPT_UNUSED ) + PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + + PORT_START("ROW2") + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START("ROW3") + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + + PORT_START("ROW4") + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START("ROW5") + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("ROW6") + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_NAME("0 Pi") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('~') + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_CHAR('\\') PORT_CHAR('|') // this one would be 1st row, 3rd key after '0' + + PORT_START("ROW7") + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("/ \xE2\x86\x90") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("? \xE2\x86\x92") PORT_CODE(KEYCODE_END) PORT_CHAR('?') // this one would be 4th row, 4th key after 'M' + PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("INST") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("ROW8") + PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x3e, 0x3e, IPT_UNUSED) + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F8)) // this one would be at Backspace position + + PORT_START("ROW9") + PORT_BIT(0x07, 0x07, IPT_UNUSED) + PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("JOY") + PORT_BIT(0x01, 0x00, IPT_UNUSED) + PORT_BIT(0x02, 0x00, IPT_JOYSTICK_UP) PORT_8WAY + PORT_BIT(0x04, 0x00, IPT_JOYSTICK_DOWN) PORT_8WAY + PORT_BIT(0x08, 0x00, IPT_JOYSTICK_LEFT) PORT_8WAY + PORT_BIT(0x10, 0x00, IPT_JOYSTICK_RIGHT) PORT_8WAY +INPUT_PORTS_END + +static INPUT_PORTS_START( mz800 ) + PORT_INCLUDE(mz700) + + PORT_MODIFY("JOY") + PORT_BIT(0x1f, 0x00, IPT_UNUSED) + + PORT_START("atari_joy1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) + + PORT_START("atari_joy2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) + + PORT_START("system_settings") + PORT_DIPNAME(0x01, 0x00, "Mode selection") + PORT_DIPLOCATION("SW:4") + PORT_DIPSETTING(0x01, "MZ-700") + PORT_DIPSETTING(0x00, "MZ-800") + PORT_DIPNAME(0x06, 0x06, "Printer selection") + PORT_DIPLOCATION("SW:3,2") + PORT_DIPSETTING(0x06, "MZ printer") + PORT_DIPSETTING(0x00, "Centronics printer") + PORT_DIPNAME(0x08, 0x08, "Cassette polarity") + PORT_DIPLOCATION("SW:1") + PORT_DIPSETTING(0x08, DEF_STR(Unknown)) + PORT_DIPSETTING(0x00, DEF_STR(Unknown)) +INPUT_PORTS_END + + +/*************************************************************************** + GFX LAYOUT +***************************************************************************/ + +static const gfx_layout mz700_layout = +{ + 8, 8, /* 8 x 8 graphics */ + 512, /* 512 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8 * 8 /* code takes 8 times 8 bits */ +}; + +static GFXDECODE_START( mz700 ) + GFXDECODE_ENTRY("cgrom", 0, mz700_layout, 0, 256) +GFXDECODE_END + +static GFXDECODE_START( mz800 ) + GFXDECODE_ENTRY(NULL, 0, mz700_layout, 0, 256) + GFXDECODE_ENTRY("monitor", 0x1000, mz700_layout, 0, 256) // for mz800 viewer only +GFXDECODE_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static MACHINE_CONFIG_START( mz700, mz_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_17_73447MHz/5) + MCFG_CPU_PROGRAM_MAP(mz700_mem) + MCFG_CPU_IO_MAP(mz700_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_17_73447MHz/2, 568, 0, 40*8, 312, 0, 25*8) + MCFG_SCREEN_UPDATE_DRIVER(mz_state, screen_update_mz700) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz700) + MCFG_PALETTE_ADD("palette", 256*2) + MCFG_PALETTE_INDIRECT_ENTRIES(8) + MCFG_PALETTE_INIT_OWNER(mz_state, mz) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* ne556 timers */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("cursor", mz_state, ne556_cursor_callback, attotime::from_hz(1.5)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("other", mz_state, ne556_other_callback, attotime::from_hz(34.5)) + + /* devices */ + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_17_73447MHz/20) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(mz_state, pit_out0_changed)) + MCFG_PIT8253_CLK1(15611.0) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pit8253", pit8253_device, write_clk2)) + MCFG_PIT8253_CLK2(0) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mz_state, pit_irq_2)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mz_state, pio_port_a_w)) + MCFG_I8255_IN_PORTB_CB(READ8(mz_state, pio_port_b_r)) + MCFG_I8255_IN_PORTC_CB(READ8(mz_state, pio_port_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mz_state, pio_port_c_w)) + + MCFG_DEVICE_ADD("ls145", TTL74145, 0) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(mz700_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("mz_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","mz700_cass") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( mz800, mz700 ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(mz800_mem) + MCFG_CPU_IO_MAP(mz800_io) + + MCFG_GFXDECODE_MODIFY("gfxdecode",mz800) + + MCFG_VIDEO_START_OVERRIDE(mz_state,mz800) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(mz_state, screen_update_mz800) + + MCFG_SOUND_ADD("sn76489n", SN76489, XTAL_17_73447MHz/5) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_DEVICE_REMOVE("cass_list") + MCFG_SOFTWARE_LIST_ADD("cass_list","mz800_cass") + + /* devices */ + MCFG_DEVICE_MODIFY("pit8253") + MCFG_PIT8253_CLK0(XTAL_17_73447MHz/16) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_17_73447MHz/5) + MCFG_Z80PIO_OUT_INT_CB(WRITELINE(mz_state, mz800_z80pio_irq)) + MCFG_Z80PIO_IN_PA_CB(READ8(mz_state, mz800_z80pio_port_a_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(mz_state, mz800_z80pio_port_a_w)) + MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( mz700 ) + ROM_REGION( 0x1000, "monitor", 0 ) + ROM_LOAD( "1z-013a.rom", 0x0000, 0x1000, CRC(4c6c6b7b) SHA1(ef8f7399e86c1dc638a5cb83efdb73369c2b5735) ) + + ROM_REGION( 0x1000, "cgrom", 0 ) + ROM_LOAD( "mz700fon.int", 0x0000, 0x1000, CRC(42b9e8fb) SHA1(5128ad179a702f8e0bd9910a58bad8fbe4c20167) ) +ROM_END + +ROM_START( mz700j ) + ROM_REGION( 0x1000, "monitor", 0 ) + ROM_LOAD( "1z-009b.rom", 0x0000, 0x1000, CRC(ab1fbe6f) SHA1(7b10d7965c541393e33a265bcf71a00314d2db7a)) + + ROM_REGION( 0x1000, "cgrom", 0 ) + //ROM_LOAD( "mz700fon.jp", 0x0000, 0x1000, CRC(697ec121) SHA1(5eb1d42d273b1fd2cab120486279ab8ff6c85dc7)) + ROM_LOAD( "mz700fon.jpn", 0x0000, 0x1000, CRC(425eedf5) SHA1(bd2cc750f2d2f63e50a59786668509e81a276e32) ) +ROM_END + +ROM_START( mz800 ) + ROM_REGION( 0x4000, "monitor", 0 ) + ROM_LOAD( "mz800.rom", 0x0000, 0x4000, CRC(600d17e1) SHA1(950ce4b51429916f8036e41ba6130fac149b36e4) ) +ROM_END + +ROM_START( mz1500 ) + ROM_REGION( 0x4000, "monitor", 0 ) + ROM_LOAD( "9z-502m.rom", 0x0000, 0x2800, CRC(643db428) SHA1(c2ad8af2ef00db32afde54d5741b07de5d4da16a)) + ROM_REGION( 0x1000, "cgrom", 0 ) + //ROM_LOAD( "mz700fon.jp", 0x0000, 0x1000, CRC(697ec121) SHA1(5eb1d42d273b1fd2cab120486279ab8ff6c85dc7)) + ROM_LOAD( "mz700fon.jpn", 0x0000, 0x1000, CRC(425eedf5) SHA1(bd2cc750f2d2f63e50a59786668509e81a276e32) ) +ROM_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1982, mz700, 0, 0, mz700, mz700, mz_state, mz700, "Sharp", "MZ-700", 0 ) +COMP( 1982, mz700j, mz700, 0, mz700, mz700, mz_state, mz700, "Sharp", "MZ-700 (Japan)", 0 ) +COMP( 1984, mz800, 0, 0, mz800, mz800, mz_state, mz800, "Sharp", "MZ-800", MACHINE_NOT_WORKING ) +COMP( 1984, mz1500, 0, 0, mz800, mz800, mz_state, mz800, "Sharp", "MZ-1500", MACHINE_NOT_WORKING ) // Japanese version of the MZ-800 diff --git a/src/mame/drivers/mz80.c b/src/mame/drivers/mz80.c new file mode 100644 index 00000000000..0bd1f92b71a --- /dev/null +++ b/src/mame/drivers/mz80.c @@ -0,0 +1,380 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + MZ80 driver by Miodrag Milanovic + + 22/11/2008 Preliminary driver. + +MZ80K Monitor - no commands seem to do anything + +MZ80A Monitor Commands: +B - turn key beep on/off +F - boot from Floppy (press enter at the question) +L - load a cassette +could be more + +MZ80A ToDo: +- System writes CF to D800-DFFF +- System uses E200-E2FF (contents are read then discarded) +- SYstem uses E800 +- Disk uses ports D8-DC +- Keyboard issues listed below + +MZ80B +- Makes extensive use of io ports +- D000-FFFF is banked ram + +****************************************************************************/ + +#include "includes/mz80.h" + + +/* Note about natural keyboard support: + - Keys G1 -> G25 are not mapped in natural mode, switch to emulated mode to use them + */ +static INPUT_PORTS_START( mz80k ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G4") PORT_CODE(KEYCODE_4_PAD) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(0x03C0) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G5") PORT_CODE(KEYCODE_5_PAD) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G9") PORT_CODE(KEYCODE_9_PAD) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G10") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\xA3') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G12") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G14") PORT_CODE(KEYCODE_F4) + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G11") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G13") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G15") PORT_CODE(KEYCODE_F5) + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SML CAP") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G17") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G19") PORT_CODE(KEYCODE_F9) + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G16") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G18") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G20") PORT_CODE(KEYCODE_F10) + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Left") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G22") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G24") PORT_CODE(KEYCODE_PGDN) + + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G21") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G23") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G25") PORT_CODE(KEYCODE_TILDE) +INPUT_PORTS_END + +// One of the keys labeled as 'Unused' in Line0 should be the Graph key; another one is the Spacebar. Also, PORT_NAMEs need to be verified +static INPUT_PORTS_START( mz80a ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') // Left Arrow + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('?') // Up Arrow + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Left") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("00") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) +INPUT_PORTS_END + +static ADDRESS_MAP_START( mz80k_mem, AS_PROGRAM, 8, mz80_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0xcfff) AM_RAM AM_SHARE("p_ram") // 48 KB of RAM + AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("p_videoram") // Video RAM + AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) /* PPIA 8255 */ + AM_RANGE(0xe004, 0xe007) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) /* PIT 8253 */ + AM_RANGE(0xe008, 0xe00b) AM_READWRITE( mz80k_strobe_r, mz80k_strobe_w) + AM_RANGE(0xf000, 0xf3ff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mz80k_io, AS_IO, 8, mz80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +static GFXDECODE_START( mz80k ) + GFXDECODE_ENTRY( "chargen", 0x0000, mz80k_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( mz80kj ) + GFXDECODE_ENTRY( "chargen", 0x0000, mz80kj_charlayout, 0, 1 ) +GFXDECODE_END + +TIMER_DEVICE_CALLBACK_MEMBER(mz80_state::ne555_tempo_callback) +{ + m_mz80k_tempo_strobe ^= 1; +} + +static MACHINE_CONFIG_START( mz80k, mz80_state ) + /* basic machine hardware */ + + /* main CPU */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz / 4) /* 2 MHz */ + MCFG_CPU_PROGRAM_MAP(mz80k_mem) + MCFG_CPU_IO_MAP(mz80k_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 199) + MCFG_SCREEN_UPDATE_DRIVER(mz80_state, screen_update_mz80k) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz80k) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* Audio */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(mz80_state, mz80k_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(mz80_state, mz80k_8255_portb_r)) + MCFG_I8255_IN_PORTC_CB(READ8(mz80_state, mz80k_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(mz80_state, mz80k_8255_portc_w)) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_8MHz/4) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(mz80_state, pit_out0_changed)) + MCFG_PIT8253_CLK1(XTAL_8MHz/256) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pit8253", pit8253_device, write_clk2)) + MCFG_PIT8253_CLK2(0) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mz80_state, pit_out2_changed)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("tempo", mz80_state, ne555_tempo_callback, attotime::from_hz(34)) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mz80kj, mz80k ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(mz80_state, screen_update_mz80kj) + MCFG_GFXDECODE_MODIFY("gfxdecode", mz80kj) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mz80a, mz80k ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(mz80_state, screen_update_mz80a) +MACHINE_CONFIG_END + + +ROM_START( mz80k ) + ROM_REGION( 0x10000, "maincpu", 0) + ROM_SYSTEM_BIOS( 0, "sp1002", "sp1002" ) + ROMX_LOAD( "sp1002.rom", 0x0000, 0x1000, CRC(2223e677) SHA1(518ffbe2333582ab36e6d76d1e03879a246ffa1c), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "tc", "tc" ) + ROMX_LOAD( "80ktc.rom", 0x0000, 0x1000, CRC(19ed6546) SHA1(2bbeff916c2fa8991e718070ca4195beb45e0848), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v44", "v44" ) + ROMX_LOAD( "80kv44.rom", 0x0000, 0x1000, CRC(d66af028) SHA1(718904c011dfcfcfabbb7dbdaaa35b9f3ac41baf), ROM_BIOS(3) ) + ROM_LOAD( "mz80kfdif.rom", 0xf000, 0x0400, CRC(d36505e0) SHA1(1f60027e8739313962a37edbf98172df7062df49) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "80kcg.rom", 0x0000, 0x0800, CRC(9b2fb88b) SHA1(6d4d120bd0e3a8c781c581e3c379a39db610a4d2) ) + // This is listed as "fixed" English + ROM_LOAD( "80kcgf.rom", 0x0800, 0x0800, CRC(be952852) SHA1(e8273de9cce88b10630187841f81aa9be22520b7) ) +ROM_END + +ROM_START( mz80kj ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "sp1002.rom", 0x0000, 0x1000, CRC(2223e677) SHA1(518ffbe2333582ab36e6d76d1e03879a246ffa1c) ) + // TC monitor not possible to be used on japanese version since chargen doesn't have upcase/lowecase, but japanese letters + ROM_LOAD( "mz80kfdif.rom", 0xf000, 0x0400, CRC(d36505e0) SHA1(1f60027e8739313962a37edbf98172df7062df49) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "mz80k.jpn", 0x0000, 0x0800, CRC(bffe3312) SHA1(7058e565f338f5ec2bba85c19c9671e5c4fe258e) ) + // This has a different Japanese set + ROM_LOAD( "80kcgj.rom", 0x0800, 0x0800, CRC(7767f11e) SHA1(8dc88d088b2e7d3198bf856bd44d364fb6e5cfa4) ) +ROM_END + +ROM_START( mz80a ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "sa1510.rom", 0x0000, 0x1000, CRC(ae63ab39) SHA1(3c2180c52fc470131ba668a6c16e77656adeccf8) ) + ROM_LOAD( "mz80afi.rom", 0xf000, 0x0800, CRC(e3b3ddfb) SHA1(ec94cc3d236716f53e747f0c8ac9186d72bf9c10) ) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "mz80acg.rom", 0x0000, 0x0800, CRC(a87c2e2b) SHA1(e8aefbdb48a63e5f96692af868c353ca7e1bfcd2) ) +ROM_END + +ROM_START( mz80b ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "ipl.rom", 0x0000, 0x0800, CRC(80beeec0) SHA1(d2b8167cc77ad023a807198993cb5e7a94c9e19e) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "mzfont.rom", 0x0000, 0x0800, CRC(0631efc3) SHA1(99b206af5c9845995733d877e9e93e9681b982a8) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1979, mz80kj, 0, 0, mz80kj, mz80k, mz80_state, mz80k, "Sharp", "MZ-80K (Japanese)", 0 ) +COMP( 1979, mz80k, mz80kj, 0, mz80k, mz80k, mz80_state, mz80k, "Sharp", "MZ-80K", 0 ) + +// These may need a separate driver! +COMP( 1982, mz80a, 0, 0, mz80a, mz80a, mz80_state, mz80k, "Sharp", "MZ-80A", 0 ) +COMP( 1981, mz80b, 0, 0, mz80k, mz80k, mz80_state, mz80k, "Sharp", "MZ-80B", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/mzr8105.c b/src/mame/drivers/mzr8105.c new file mode 100644 index 00000000000..e1679e2a146 --- /dev/null +++ b/src/mame/drivers/mzr8105.c @@ -0,0 +1,369 @@ +// license:BSD-3-Clause +// copyright-holders:Joakim Larsson Edstrom +/*************************************************************************** + * + * Mizar VME8105 rev D 3U SBC driver, initially derived from force68k.c + * + * 19/08/2015 + * + * I baught this board from http://www.retrotechnology.com without documentation. + * It has a Motorola 68000 CPU @ 10MHz and two 27128 EPROMS with OS9 DEBUG labels + * and not much more except 16 or so TTLs, 2 PALs and a VME P1 connector. It is a + * 2 sided design so it shold be possible to trace the schematics quite easily. + * There is a date on the P1 Connector: "Feb 20 1987" + * + * || + * || + * || + * || + * ||____________________________________________________________ ___ + * || --------------K2|U6-7432|U7-7474|U14-7405|U21-74645 | |_| | + * || | 2764 - low |-+-------+-------+--------+-----------+ | | | + * || | OS9 DEBUG U4| +---------+ +--------+---------+ | | | + * || -------------- | | |U13-7474|U20-74645| | | | + * || ______________ | | +--------+---------+ | | | + * || | | | | ______________K4____ | | | + * || | U3| | | |U12-7438|U19-74244| | |VME| + * || -------------- | |+------K6---------K3---+ | | | + * || ______________ | ||U11-PAL20L10|U18-74244| | |P1 | + * || | 2764 - high | | |+-----021102-+---------+ | | | + * || | OS9 DEBUG U2| |MC68000L10+------------+---------+ | | | + * || |______________| | ||U10-PAL14L4 |U17-74244| | | | + * || | |+-----021001-+---------+ | | | + * || -------------- | |+----+_______|U16-74244|+--+| | | + * || | | | |XTAL |U9-7410+---------+| || | | + * ||K1 | U1| | |FOX100-------+---------+|K5||_| | + * || -------------- |_________|10MHz|U8-7404|U15-74148|| || |___| + * ||--||--------------------------------+----+-------+---------++--+ + * ||--|| + * || + * + * PAL:s + *------ + * The board has two PAL:s, a PAL20L10 and a PAL14L4. + * + * _____ _____ + * OD/CLK 1 |* \_/ | 20 VCC + * CPU A13 I0 2 | | 19 O0/LR A23 + * U9 7410p12 I1 3 | | 18 O1/A0 A22 + * CPU *AS I2 4 | | 17 02/A1 U2/U4 2764p22 *OE + * GND I3 5 | | 16 03/A2 U11 PAL20L10p6 I4 + * CPU A14 I4 6 | U10 | 15 A0/O0 U11 PAL20L10p7 I5 + * CPU A15 I5 7 | PAL14L4 | 14 A1/O1 U19 74LS244p11 I0b + * CPU A16 I6 8 | | 13 A2/O2 A18 + * CPU A17 I7 9 | | 12 LR/O3 A20 + * GND 10 |_____________| 11 CLK/OD A21 + * + * _____ _____ + * OD/CLK 1 |* \_/ | 24 VCC + * I0 2 | | 23 O0/LR + * CPU *AS I1 3 | | 22 O1/A0 + * U10 PAL14L4p3 I2 4 | | 21 02/A1 + * I3 5 | | 20 03/A2 + * U10 PAL14L4p16 I4 6 | U10 | 19 04/NC + * U10 PAL14L4p15 I5 7 | PAL20L10 | 18 NC/O0 + * I6 8 | | 17 A2/O1 + * I7 9 | | 16 A1/O2 + * I8 10 | | 15 A0/O3 + * I9 11 | | 14 LR/O4 + * GND 12 |_____________| 13 CLK/OD + * + * Trace is not fully completed and validated. + * + * History of Mizar + *------------------- + * Mizar was one of the first companies that released VME boards in 1982-3 together with + * Force Computers and Motorola. Their systems was often supported by OS9/68000 from Microware. + * In 1993 Mizar discontinued their OS9/CPU board product range and focused entirely on DSP + * boards. RTSI was founded by Mizar employees preserving the knowledge in OS9 as consultants. + * In 1998 Blue Wave resulted from the merger of Mizar and Loughborough Sound Images. + * Not much tech information availabe but I found some quotes about Mizar on the internet: + * + * From http://archive.org/stream/68micro-vol-11-num-02/V11N02_Feb1989_djvu.txt : + *-------------------------------------------------------------------------------- + * " Mizar provides complete OS-9 solutions for the VMEbus. Mizar's VME CPUs + * offer (he functions and performance your application demands. Our single + * height (3U) VME processors are uniquely configurable computing engines, + * Through Mizar's unique MXbus expansion interface, standard and custom side + * modules can be added to basic processors to create double-height (6U) boards + * tor specific applications, 3U CPU options include 68010, 66020, and 63030 + * microprocessors, up to one MB of DRAM, serial I/O, real-time clock, and + * mailbox interrupt support. Standard MXbus side modules include additional DRAM. + * SRAM, and I/O. + * + * Mizar's standard double- height (6U) processors provide additional features such + * as a high-speed cache to enhance 68030 performance, floating, point coprocessor + * support, up to four MB dual ported DRAM, VSB memory interface, Ethernet, and SCSI. + * + * Mizar also supports OS-9 with completely configured OS9 development systems and + * OS-9 application server systems. For more information, call Mizar today + * + * 800-635-0200 MIZAR 1419 Dunn Drive CarrolHon, TX 75006 214-446-2664" + * + * Known boards from Mizar: + * + *-Comp.Os.Vxworks diguest mailing list May 1992: VxWorks Drivers Available from Mizar: + * EMX 7320 Serial I/O Board + * EMX 7550 Ethernet Controller Board (AMD 7990 Lance) MAC: 00:80:F8 MIZAR, INC. + * MZ 7300 Serial I/O Board (Z8530) + * MZ 7400 Disk Controller Board (WD 2010; WD 1772) + * MZ 7500 IEEE-488 (GPIB) Interface Board + * MZ 7810 I/O Expansion Module (6681 DUART) + * MZ 7831 SCSI Expansion Module (WD 33C93A) + * MZ 7850 Ethernet Expansion Module (WD 83C690) + * MZ 8505 IEEE-488 (GPIB) Interface Board" + *- Other sources: + * MZ 8000 ?? + * MZ 8105 3U 68000 CPU board + * MZ 8300 3U serial board, 2 NEC 7201 (Z80 DART) and 1 AMD CTS9513 5 x 16 bit Counter/Timer + * + * From http://www.megalextoria.com/forum2/index.php?t=msg&goto=73945& + *-------------------------------------------------------------------- + * Aug 20 1984 a report by James Jones from the OS/9 conferance in Des Moines: + * "... + * Mizar: is selling VME bus 68010 boards, running OS-9/68000; they also make + * various memory and I/O boards, disk controller boards, and and a NEC 7220-based + * graphics controller board...." + * + * Misc links about Mizar: + * http://www.vita.com/History + * http://www.verycomputer.com/154_e272024804bbe203_1.htm + * https://www.aihitdata.com/company/00814595/RTSI/overview + * + * Address Map + * -------------------------------------------------------------------------- + * Address Range Description/Assumption + * -------------------------------------------------------------------------- + * 0x000000 0x01ffff ROM because of fixed vectors + * 0x020000 0x03ffff RAM because bootvector stack starts at 0x21000 + * -- VME adresses--- + * 0xff0000 0xff0003 Bootstrap expects to find a UPD7201 serial device here + * -------------------------------------------------------------------------- + * + * Interrupt sources + * ---------------------------------------------------------- + * Description Device Lvl IRQ VME board + * /Board Vector Address + * ---------------------------------------------------------- + * On board Sources + * TBD + * Off board Sources (other VME boards) + * TBD + * ---------------------------------------------------------- + * + * TODO: + * - Dump the ROMs (DONE) + * - Setup a working address map (DONE) + * - Add VME bus driver (Faked one) + * + ****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/z80dart.h" +#include "bus/rs232/rs232.h" +#include "machine/clock.h" + +#define CARDSLOT 0 + +#if CARDSLOT // Awaiting info on how to boot the user eproms +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#endif + +#define LOG(x) x + + +/* These values are borrowed just to get the terminal going and should be replaced + * once a proper serial board hardware (ie MZ 8300) is found and emulated. */ +#define BAUDGEN_CLOCK XTAL_19_6608MHz /* fake */ +#define UPD_CLOCK (BAUDGEN_CLOCK / 128) /* This will give prompt */ + +class mzr8105_state : public driver_device +{ +public: +mzr8105_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device (mconfig, type, tag), + m_maincpu (*this, "maincpu") + ,m_updterm(*this, "upd") +// ,m_cart(*this, "exp_rom1") +{ +} + +DECLARE_READ16_MEMBER (vme_a24_r); +DECLARE_WRITE16_MEMBER (vme_a24_w); +DECLARE_READ16_MEMBER (vme_a16_r); +DECLARE_WRITE16_MEMBER (vme_a16_w); +virtual void machine_start (); +DECLARE_WRITE_LINE_MEMBER (write_updterm_clock); + +#if CARDSLOT +// User EPROM/SRAM slot(s) +int mzr8105_load_cart(device_image_interface &image, generic_slot_device *slot); +DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return mzr8105_load_cart(image, m_cart); } +DECLARE_READ16_MEMBER (read16_rom); +#endif + +protected: + +private: +required_device m_maincpu; +required_device m_updterm; + +// Pointer to System ROMs needed by bootvect_r +// UINT16 *m_sysrom; + +#if CARDSLOT +UINT16 *m_usrrom; +required_device m_cart; +#endif +}; + +static ADDRESS_MAP_START (mzr8105_mem, AS_PROGRAM, 16, mzr8105_state) +ADDRESS_MAP_UNMAP_HIGH +//AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r) /* Not verified */ +AM_RANGE (0x000000, 0x003fff) AM_ROM /* System EPROM Area 16Kb OS9 DEBUG - not verified */ +AM_RANGE (0x004000, 0x01ffff) AM_ROM /* System EPROM Area 112Kb for System ROM - not verified */ +AM_RANGE (0x020000, 0x03ffff) AM_RAM /* Not verified */ +//AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, max 128Kb mapped by a cartslot */ +//AM_RANGE (0x0c0080, 0x0c0081) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, status_r, control_w, 0xff00) +//AM_RANGE (0x0c0082, 0x0c0083) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, data_r, data_w, 0xff00) +AM_RANGE(0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ +//AM_RANGE(0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ +// Faking a Mizar 8300 SIO BOARD in VME A16 adress space + AM_RANGE (0xFF0000, 0xFF0001) AM_DEVREADWRITE8("upd", upd7201_device, da_r, da_w, 0x00ff) /* Dual serial port NEC uPD7201 */ + AM_RANGE (0xFF0002, 0xFF0003) AM_DEVREADWRITE8("upd", upd7201_device, ca_r, ca_w, 0x00ff) /* Dual serial port NEC uPD7201 */ + AM_RANGE (0xFF0004, 0xFF0005) AM_DEVREADWRITE8("upd", upd7201_device, db_r, db_w, 0x00ff) /* Dual serial port NEC uPD7201 */ + AM_RANGE (0xFF0006, 0xFF0007) AM_DEVREADWRITE8("upd", upd7201_device, cb_r, cb_w, 0x00ff) /* Dual serial port NEC uPD7201 */ + +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START (mzr8105) +INPUT_PORTS_END + +/* Start it up */ +void mzr8105_state::machine_start () +{ + LOG (logerror ("machine_start\n")); + +#if CARDSLOT + /* Map user ROM/RAM socket(s) */ + if (m_cart->exists()) + { + m_usrrom = (UINT16*)m_cart->get_rom_base(); + m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(generic_slot_device::read16_rom), (generic_slot_device*)m_cart)); + } +#endif +} + +/* Dummy VME access methods until the VME bus device is ready for use */ +READ16_MEMBER (mzr8105_state::vme_a24_r){ + LOG (logerror ("vme_a24_r\n")); + return (UINT16) 0; +} + +WRITE16_MEMBER (mzr8105_state::vme_a24_w){ + LOG (logerror ("vme_a24_w\n")); +} + +READ16_MEMBER (mzr8105_state::vme_a16_r){ + LOG (logerror ("vme_16_r\n")); + return (UINT16) 0; +} + +WRITE16_MEMBER (mzr8105_state::vme_a16_w){ + LOG (logerror ("vme_a16_w\n")); +} + +#if CARDSLOT +/* + * 4. The USER EPROM Area + */ +// Implementation of static 2 x 64K EPROM in sockets U1/U3 as 16 bit wide cartridge for easier +// software handling. TODO: make configurable according to table above. +static MACHINE_CONFIG_FRAGMENT( mzr8105_eprom_sockets ) + MCFG_GENERIC_CARTSLOT_ADD("exp_rom1", generic_plain_slot, "mzr8105_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) + MCFG_GENERIC_LOAD(mzr8105_state, exp1_load) +// MCFG_SOFTWARE_LIST_ADD("cart_list", "mzr8105_cart") +MACHINE_CONFIG_END + +/*************************** + Rom loading functions +****************************/ +int mzr8105_state::mzr8105_load_cart(device_image_interface &image, generic_slot_device *slot) +{ + UINT32 size = slot->common_get_size("rom"); + + if (size > 0x20000) // Max 128Kb - not verified + { + LOG( printf("Cartridge size exceeding max size (128Kb): %d\n", size) ); + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (128Kb)"); + return IMAGE_INIT_FAIL; + } + + slot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG); + slot->common_load_rom(slot->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} +#endif + +WRITE_LINE_MEMBER (mzr8105_state::write_updterm_clock){ + m_updterm->txca_w (state); + m_updterm->rxca_w (state); +} + +/* + * Machine configuration + */ +static MACHINE_CONFIG_START (mzr8105, mzr8105_state) +/* basic machine hardware */ +MCFG_CPU_ADD ("maincpu", M68000, XTAL_10MHz) +MCFG_CPU_PROGRAM_MAP (mzr8105_mem) + + +/* Terminal Port config */ +MCFG_UPD7201_ADD("upd", XTAL_4MHz, 0, 0, 0, 0 ) +MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_txd)) +MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_dtr)) +MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_rts)) + +MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal") +MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("upd", upd7201_device, rxa_w)) +MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("upd", upd7201_device, ctsa_w)) + +MCFG_DEVICE_ADD ("updterm_clock", CLOCK, UPD_CLOCK) +MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (mzr8105_state, write_updterm_clock)) + +#if CARDSLOT + +// EPROM sockets +MCFG_FRAGMENT_ADD(mzr8105_eprom_sockets) +#endif + +MACHINE_CONFIG_END + +/* ROM definitions */ +ROM_START (mzr8105) +ROM_REGION (0x1000000, "maincpu", 0) + +ROM_LOAD16_BYTE ("mzros9LB.bin", 0x000001, 0x2000, CRC (7c6a354d) SHA1 (2721eb649c8046dbcb517a36a97dc0816cd133f2)) +ROM_LOAD16_BYTE ("mzros9HB.bin", 0x000000, 0x2000, CRC (d18e69a6) SHA1 (a00b68f4d649bcc09a29361f8692e52be12b3792)) + +/* + * System ROM information + * + * The ROMs contains an OS9 bootloader. It is position independent but reset vector suggests that it sits flat on adress 0 (zero) + * + * We got a prompt but the command reportoair are very sparse to non OS9 users so investigation needed. + * + */ +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP (1987, mzr8105, 0, 0, mzr8105, mzr8105, driver_device, 0, "Mizar Inc", "Mizar VME8105", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/n64.c b/src/mame/drivers/n64.c new file mode 100644 index 00000000000..a5c2e3c7499 --- /dev/null +++ b/src/mame/drivers/n64.c @@ -0,0 +1,499 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/* + Nintendo 64 + + Driver by Ville Linde + Reformatted to share hardware by R. Belmont + Additional work by Ryan Holtz + Porting from Mupen64 by Harmony +*/ + +#include "emu.h" +#include "cpu/rsp/rsp.h" +#include "cpu/mips/mips3.h" +#include "sound/dmadac.h" +#include "includes/n64.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "imagedev/snapquik.h" + +class n64_mess_state : public n64_state +{ +public: + n64_mess_state(const machine_config &mconfig, device_type type, const char *tag) + : n64_state(mconfig, type, tag) + { } + + DECLARE_READ32_MEMBER(dd_null_r); + DECLARE_MACHINE_START(n64dd); + INTERRUPT_GEN_MEMBER(n64_reset_poll); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(n64_cart); + void mempak_format(UINT8* pak); + int quickload(device_image_interface &image, const char *file_type, int quickload_size); + DECLARE_QUICKLOAD_LOAD_MEMBER( n64dd ); +}; + +READ32_MEMBER(n64_mess_state::dd_null_r) +{ + return 0xffffffff; +} + +static ADDRESS_MAP_START( n64_map, AS_PROGRAM, 32, n64_mess_state ) + AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("rdram") // RDRAM + AM_RANGE(0x03f00000, 0x03f00027) AM_DEVREADWRITE("rcp", n64_periphs, rdram_reg_r, rdram_reg_w) + AM_RANGE(0x04000000, 0x04000fff) AM_RAM AM_SHARE("rsp_dmem") // RSP DMEM + AM_RANGE(0x04001000, 0x04001fff) AM_RAM AM_SHARE("rsp_imem") // RSP IMEM + AM_RANGE(0x04040000, 0x040fffff) AM_DEVREADWRITE("rcp", n64_periphs, sp_reg_r, sp_reg_w) // RSP + AM_RANGE(0x04100000, 0x041fffff) AM_DEVREADWRITE("rcp", n64_periphs, dp_reg_r, dp_reg_w) // RDP + AM_RANGE(0x04300000, 0x043fffff) AM_DEVREADWRITE("rcp", n64_periphs, mi_reg_r, mi_reg_w) // MIPS Interface + AM_RANGE(0x04400000, 0x044fffff) AM_DEVREADWRITE("rcp", n64_periphs, vi_reg_r, vi_reg_w) // Video Interface + AM_RANGE(0x04500000, 0x045fffff) AM_DEVREADWRITE("rcp", n64_periphs, ai_reg_r, ai_reg_w) // Audio Interface + AM_RANGE(0x04600000, 0x046fffff) AM_DEVREADWRITE("rcp", n64_periphs, pi_reg_r, pi_reg_w) // Peripheral Interface + AM_RANGE(0x04700000, 0x047fffff) AM_DEVREADWRITE("rcp", n64_periphs, ri_reg_r, ri_reg_w) // RDRAM Interface + AM_RANGE(0x04800000, 0x048fffff) AM_DEVREADWRITE("rcp", n64_periphs, si_reg_r, si_reg_w) // Serial Interface + AM_RANGE(0x05000508, 0x0500050b) AM_READ(dd_null_r); + AM_RANGE(0x08000000, 0x0801ffff) AM_RAM AM_SHARE("sram") // Cartridge SRAM + AM_RANGE(0x10000000, 0x13ffffff) AM_ROM AM_REGION("user2", 0) // Cartridge + AM_RANGE(0x1fc00000, 0x1fc007bf) AM_ROM AM_REGION("user1", 0) // PIF ROM + AM_RANGE(0x1fc007c0, 0x1fc007ff) AM_DEVREADWRITE("rcp", n64_periphs, pif_ram_r, pif_ram_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( n64dd_map, AS_PROGRAM, 32, n64_mess_state ) + AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("rdram") // RDRAM + AM_RANGE(0x03f00000, 0x03f00027) AM_DEVREADWRITE("rcp", n64_periphs, rdram_reg_r, rdram_reg_w) + AM_RANGE(0x04000000, 0x04000fff) AM_RAM AM_SHARE("rsp_dmem") // RSP DMEM + AM_RANGE(0x04001000, 0x04001fff) AM_RAM AM_SHARE("rsp_imem") // RSP IMEM + AM_RANGE(0x04040000, 0x040fffff) AM_DEVREADWRITE("rcp", n64_periphs, sp_reg_r, sp_reg_w) // RSP + AM_RANGE(0x04100000, 0x041fffff) AM_DEVREADWRITE("rcp", n64_periphs, dp_reg_r, dp_reg_w) // RDP + AM_RANGE(0x04300000, 0x043fffff) AM_DEVREADWRITE("rcp", n64_periphs, mi_reg_r, mi_reg_w) // MIPS Interface + AM_RANGE(0x04400000, 0x044fffff) AM_DEVREADWRITE("rcp", n64_periphs, vi_reg_r, vi_reg_w) // Video Interface + AM_RANGE(0x04500000, 0x045fffff) AM_DEVREADWRITE("rcp", n64_periphs, ai_reg_r, ai_reg_w) // Audio Interface + AM_RANGE(0x04600000, 0x046fffff) AM_DEVREADWRITE("rcp", n64_periphs, pi_reg_r, pi_reg_w) // Peripheral Interface + AM_RANGE(0x04700000, 0x047fffff) AM_DEVREADWRITE("rcp", n64_periphs, ri_reg_r, ri_reg_w) // RDRAM Interface + AM_RANGE(0x04800000, 0x048fffff) AM_DEVREADWRITE("rcp", n64_periphs, si_reg_r, si_reg_w) // Serial Interface + AM_RANGE(0x05000000, 0x05ffffff) AM_DEVREADWRITE("rcp", n64_periphs, dd_reg_r, dd_reg_w) // 64DD Interface + AM_RANGE(0x06000000, 0x063fffff) AM_ROM AM_REGION("ddipl", 0) // 64DD IPL ROM + AM_RANGE(0x08000000, 0x0801ffff) AM_RAM AM_SHARE("sram") // Cartridge SRAM + AM_RANGE(0x10000000, 0x13ffffff) AM_ROM AM_REGION("user2", 0) // Cartridge + AM_RANGE(0x1fc00000, 0x1fc007bf) AM_ROM AM_REGION("user1", 0) // PIF ROM + AM_RANGE(0x1fc007c0, 0x1fc007ff) AM_DEVREADWRITE("rcp", n64_periphs, pif_ram_r, pif_ram_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( rsp_map, AS_PROGRAM, 32, n64_mess_state ) + AM_RANGE(0x00000000, 0x00000fff) AM_RAM AM_SHARE("rsp_dmem") + AM_RANGE(0x00001000, 0x00001fff) AM_RAM AM_SHARE("rsp_imem") + AM_RANGE(0x04000000, 0x04000fff) AM_RAM AM_SHARE("rsp_dmem") + AM_RANGE(0x04001000, 0x04001fff) AM_RAM AM_SHARE("rsp_imem") +ADDRESS_MAP_END + +static INPUT_PORTS_START( n64 ) + PORT_START("input") + PORT_CONFNAME(0x0003, 0x0001, "Controller Port 0 Device") + PORT_CONFSETTING(0x00, "None") + PORT_CONFSETTING(0x01, "Joypad") + PORT_CONFSETTING(0x02, "Mouse") + PORT_CONFNAME(0x000C, 0x0000, "Controller Port 1 Device") + PORT_CONFSETTING(0x00, "None") + PORT_CONFSETTING(0x04, "Joypad") + PORT_CONFSETTING(0x08, "Mouse") + PORT_CONFNAME(0x0030, 0x0000, "Controller Port 2 Device") + PORT_CONFSETTING(0x00, "None") + PORT_CONFSETTING(0x10, "Joypad") + PORT_CONFSETTING(0x20, "Mouse") + PORT_CONFNAME(0x00C0, 0x0000, "Controller Port 3 Device") + PORT_CONFSETTING(0x00, "None") + PORT_CONFSETTING(0x40, "Joypad") + PORT_CONFSETTING(0x80, "Mouse") + + PORT_CONFNAME(0x0100, 0x0000, "Disk Drive") + PORT_CONFSETTING(0x0000, "Retail") + PORT_CONFSETTING(0x0100, "Development") + + //Player 1 + PORT_START("P1") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Button A / Left Click") + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Button B / Right Click") + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Button Z") + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1) PORT_NAME("P1 Start") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("P1 Joypad \xE2\x86\x91") /* Up */ + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 Joypad \xE2\x86\x93") /* Down */ + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad \xE2\x86\x90") /* Left */ + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad \xE2\x86\x92") /* Right */ + PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Button L") + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Button R") + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Button C \xE2\x86\x91") /* Up */ + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Button C \xE2\x86\x93") /* Down */ + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(1) PORT_NAME("P1 Button C \xE2\x86\x90") /* Left */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_PLAYER(1) PORT_NAME("P1 Button C \xE2\x86\x92") /* Right */ + + PORT_START("P1_ANALOG_X") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) + + PORT_START("P1_ANALOG_Y") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) PORT_REVERSE + + PORT_START("P1_MOUSE_X") + PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_X ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START("P1_MOUSE_Y") + PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_Y ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_REVERSE + + //Player 2 + PORT_START("P2") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Button A / Left Click") + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Button B / Right Click") + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Button Z") + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(2) PORT_NAME("P2 Start") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_NAME("P2 Joypad \xE2\x86\x91") /* Up */ + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 Joypad \xE2\x86\x93") /* Down */ + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad \xE2\x86\x90") /* Left */ + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad \xE2\x86\x92") /* Right */ + PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Button L") + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Button R") + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Button C \xE2\x86\x91") /* Up */ + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Button C \xE2\x86\x93") /* Down */ + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(2) PORT_NAME("P2 Button C \xE2\x86\x90") /* Left */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_PLAYER(2) PORT_NAME("P2 Button C \xE2\x86\x92") /* Right */ + + PORT_START("P2_ANALOG_X") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(2) + + PORT_START("P2_ANALOG_Y") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(2) PORT_REVERSE + + PORT_START("P2_MOUSE_X") + PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_X ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2) + + PORT_START("P2_MOUSE_Y") + PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_Y ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2) PORT_REVERSE + + //Player 3 + PORT_START("P3") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 Button A / Left Click") + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 Button B / Right Click") + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 Button Z") + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(3) PORT_NAME("P3 Start") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_NAME("P3 Joypad \xE2\x86\x91") /* Up */ + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_NAME("P3 Joypad \xE2\x86\x93") /* Down */ + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad \xE2\x86\x90") /* Left */ + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad \xE2\x86\x92") /* Right */ + PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(3) PORT_NAME("P3 Button L") + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(3) PORT_NAME("P3 Button R") + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(3) PORT_NAME("P3 Button C \xE2\x86\x91") /* Up */ + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(3) PORT_NAME("P3 Button C \xE2\x86\x93") /* Down */ + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(3) PORT_NAME("P3 Button C \xE2\x86\x90") /* Left */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_PLAYER(3) PORT_NAME("P3 Button C \xE2\x86\x92") /* Right */ + + PORT_START("P3_ANALOG_X") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(3) + + PORT_START("P3_ANALOG_Y") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(3) PORT_REVERSE + + PORT_START("P3_MOUSE_X") + PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_X ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(3) + + PORT_START("P3_MOUSE_Y") + PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_Y ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(3) PORT_REVERSE + + //Player 4 + PORT_START("P4") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 Button A / Left Click") + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 Button B / Right Click") + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 Button Z") + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(4) PORT_NAME("P4 Start") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_NAME("P4 Joypad \xE2\x86\x91") /* Up */ + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_NAME("P4 Joypad \xE2\x86\x93") /* Down */ + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad \xE2\x86\x90") /* Left */ + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad \xE2\x86\x92") /* Right */ + PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(4) PORT_NAME("P4 Button L") + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(4) PORT_NAME("P4 Button R") + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(4) PORT_NAME("P4 Button C \xE2\x86\x91") /* Up */ + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(4) PORT_NAME("P4 Button C \xE2\x86\x93") /* Down */ + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(4) PORT_NAME("P4 Button C \xE2\x86\x90") /* Left */ + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_PLAYER(4) PORT_NAME("P4 Button C \xE2\x86\x92") /* Right */ + + PORT_START("P4_ANALOG_X") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(4) + + PORT_START("P4_ANALOG_Y") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(4) PORT_REVERSE + + PORT_START("P4_MOUSE_X") + PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_X ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(4) + + PORT_START("P4_MOUSE_Y") + PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_Y ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(4) PORT_REVERSE + + PORT_START("RESET") + PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Warm Reset") PORT_CODE(KEYCODE_3) + +INPUT_PORTS_END + +#if 0 +/* ?? */ +static const mips3_config config = +{ + 16384, /* code cache size */ + 8192, /* data cache size */ + 62500000 /* system clock */ +}; +#endif + +void n64_mess_state::mempak_format(UINT8* pak) +{ + unsigned char pak_header[] = + { + 0x81,0x01,0x02,0x03, 0x04,0x05,0x06,0x07, 0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f, + 0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17, 0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f, + 0xff,0xff,0xff,0xff, 0x05,0x1a,0x5f,0x13, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x01,0xff, 0x66,0x25,0x99,0xcd, + 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0xff,0xff,0xff,0xff, 0x05,0x1a,0x5f,0x13, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x01,0xff, 0x66,0x25,0x99,0xcd, + 0xff,0xff,0xff,0xff, 0x05,0x1a,0x5f,0x13, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x01,0xff, 0x66,0x25,0x99,0xcd, + 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0xff,0xff,0xff,0xff, 0x05,0x1a,0x5f,0x13, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x01,0xff, 0x66,0x25,0x99,0xcd, + 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x00,0x71,0x00,0x03, 0x00,0x03,0x00,0x03, 0x00,0x03,0x00,0x03, 0x00,0x03,0x00,0x03 + }; + + for (int i = 0; i < 0x8000; i += 2) + { + pak[i+0] = 0x00; + pak[i+1] = 0x03; + } + memcpy(pak, pak_header, 272); +} + +DEVICE_IMAGE_LOAD_MEMBER(n64_mess_state,n64_cart) +{ + int i, length; + n64_periphs *periphs = machine().device("rcp"); + UINT8 *cart = memregion("user2")->base(); + + if (image.software_entry() == NULL) + { + length = image.fread(cart, 0x4000000); + } + else + { + length = image.get_software_region_length("rom"); + memcpy(cart, image.get_software_region("rom"), length); + } + periphs->cart_length = length; + + if (cart[0] == 0x37 && cart[1] == 0x80) + { + for (i = 0; i < length; i += 4) + { + UINT8 b1 = cart[i + 0]; + UINT8 b2 = cart[i + 1]; + UINT8 b3 = cart[i + 2]; + UINT8 b4 = cart[i + 3]; + cart[i + 0] = b3; + cart[i + 1] = b4; + cart[i + 2] = b1; + cart[i + 3] = b2; + } + } + else + { + for (i = 0; i < length; i += 4) + { + UINT8 b1 = cart[i + 0]; + UINT8 b2 = cart[i + 1]; + UINT8 b3 = cart[i + 2]; + UINT8 b4 = cart[i + 3]; + cart[i + 0] = b4; + cart[i + 1] = b3; + cart[i + 2] = b2; + cart[i + 3] = b1; + } + } + + periphs->m_nvram_image = image; + + logerror("cart length = %d\n", length); + + device_image_interface *battery_image = dynamic_cast(periphs->m_nvram_image); + if(battery_image) + { + //printf("Loading\n"); + UINT8 data[0x30800]; + battery_image->battery_load(data, 0x30800, 0x00); + //memcpy(n64_sram, data, 0x20000); + memcpy(memshare("sram")->ptr(), data, 0x20000); + memcpy(periphs->m_save_data.eeprom, data + 0x20000, 0x800); + memcpy(periphs->m_save_data.mempak[0], data + 0x20800, 0x8000); + memcpy(periphs->m_save_data.mempak[1], data + 0x28800, 0x8000); + } + + if(periphs->m_save_data.mempak[0][0] == 0) // Init if new + { + memset(periphs->m_save_data.eeprom, 0, 0x800); + mempak_format(periphs->m_save_data.mempak[0]); + mempak_format(periphs->m_save_data.mempak[1]); + } + + return IMAGE_INIT_PASS; +} + +MACHINE_START_MEMBER(n64_mess_state,n64dd) +{ + machine_start(); + machine().device("rcp")->dd_present = true; + UINT8 *ipl = memregion("ddipl")->base(); + + for (int i = 0; i < 0x400000; i += 4) + { + UINT8 b1 = ipl[i + 0]; + UINT8 b2 = ipl[i + 1]; + UINT8 b3 = ipl[i + 2]; + UINT8 b4 = ipl[i + 3]; + ipl[i + 0] = b1; + ipl[i + 1] = b2; + ipl[i + 2] = b3; + ipl[i + 3] = b4; + } +} + +QUICKLOAD_LOAD_MEMBER(n64_mess_state,n64dd) +{ + return quickload(image, file_type, quickload_size); +} + +int n64_mess_state::quickload(device_image_interface &image, const char *file_type, int quickload_size) +{ + image.fseek(0, SEEK_SET); + image.fread(memregion("disk")->base(), quickload_size); + machine().device("rcp")->disk_present = true; + return IMAGE_INIT_PASS; +} + + +INTERRUPT_GEN_MEMBER(n64_mess_state::n64_reset_poll) +{ + n64_periphs *periphs = machine().device("rcp"); + periphs->poll_reset_button((ioport("RESET")->read() & 1) ? true : false); +} + +static MACHINE_CONFIG_START( n64, n64_mess_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", VR4300BE, 93750000) + MCFG_FORCE_NO_DRC() + MCFG_CPU_CONFIG(config) + MCFG_CPU_PROGRAM_MAP(n64_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", n64_mess_state, n64_reset_poll) + + MCFG_CPU_ADD("rsp", RSP, 62500000) + MCFG_RSP_DP_REG_R_CB(DEVREAD32("rcp",n64_periphs, dp_reg_r)) + MCFG_RSP_DP_REG_W_CB(DEVWRITE32("rcp",n64_periphs, dp_reg_w)) + MCFG_RSP_SP_REG_R_CB(DEVREAD32("rcp",n64_periphs, sp_reg_r)) + MCFG_RSP_SP_REG_W_CB(DEVWRITE32("rcp",n64_periphs, sp_reg_w)) + MCFG_RSP_SP_SET_STATUS_CB(DEVWRITE32("rcp",n64_periphs, sp_set_status)) + MCFG_CPU_PROGRAM_MAP(rsp_map) + + MCFG_QUANTUM_TIME(attotime::from_hz(500000)) + //MCFG_QUANTUM_TIME(attotime::from_hz(1200)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + /* Video DACRATE is for quarter pixels, so the horizontal is also given in quarter pixels. However, the horizontal and vertical timing and sizing is adjustable by register and will be reset when the registers are written. */ + MCFG_SCREEN_RAW_PARAMS(DACRATE_NTSC*2,3093,0,3093,525,0,525) + //MCFG_SCREEN_REFRESH_RATE(60) + //MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + //MCFG_SCREEN_SIZE(640, 525) + //MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) + MCFG_SCREEN_UPDATE_DRIVER(n64_state, screen_update_n64) + MCFG_SCREEN_VBLANK_DRIVER(n64_state, screen_eof_n64) + + MCFG_PALETTE_ADD("palette", 0x1000) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_ADD("dac2", DMADAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) + MCFG_SOUND_ADD("dac1", DMADAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + + MCFG_N64_PERIPHS_ADD("rcp"); + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "n64_cart") + MCFG_GENERIC_EXTENSIONS("v64,z64,rom,n64,bin") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(n64_mess_state, n64_cart) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "n64") + + MCFG_FORCE_NO_DRC() +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( n64dd, n64 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(n64dd_map) + + MCFG_MACHINE_START_OVERRIDE(n64_mess_state, n64dd) + + MCFG_DEVICE_REMOVE("cartslot") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "n64_cart") + MCFG_GENERIC_EXTENSIONS("v64,z64,rom,n64,bin") + MCFG_GENERIC_LOAD(n64_mess_state, n64_cart) + + MCFG_QUICKLOAD_ADD("quickload", n64_mess_state, n64dd, "bin,dsk", 0) + MCFG_QUICKLOAD_INTERFACE("n64dd_disk") + + MCFG_SOFTWARE_LIST_ADD("dd_list", "n64dd") +MACHINE_CONFIG_END + +ROM_START( n64 ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for R4300 */ + + ROM_REGION32_BE( 0x800, "user1", 0 ) + ROM_LOAD( "pifdata.bin", 0x0000, 0x0800, CRC(5ec82be9) SHA1(9174eadc0f0ea2654c95fd941406ab46b9dc9bdd) ) + + ROM_REGION32_BE( 0x4000000, "user2", ROMREGION_ERASEFF) + + ROM_REGION16_BE( 0x80, "normpoint", 0 ) + ROM_LOAD( "normpnt.rom", 0x00, 0x80, CRC(e7f2a005) SHA1(c27b4a364a24daeee6e99fd286753fd6216362b4) ) + + ROM_REGION16_BE( 0x80, "normslope", 0 ) + ROM_LOAD( "normslp.rom", 0x00, 0x80, CRC(4f2ae525) SHA1(eab43f8cc52c8551d9cff6fced18ef80eaba6f05) ) +ROM_END + +ROM_START( n64dd ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for R4300 */ + + ROM_REGION32_BE( 0x800, "user1", 0 ) + ROM_LOAD( "pifdata.bin", 0x0000, 0x0800, CRC(5ec82be9) SHA1(9174eadc0f0ea2654c95fd941406ab46b9dc9bdd) ) + + ROM_REGION32_BE( 0x4000000, "user2", ROMREGION_ERASEFF) + + ROM_REGION32_BE( 0x400000, "ddipl", ROMREGION_ERASEFF) + ROM_LOAD( "64ddipl.bin", 0x000000, 0x400000, CRC(7f933ce2) SHA1(bf861922dcb78c316360e3e742f4f70ff63c9bc3) ) + + ROM_REGION32_LE( 0x4400000, "disk", ROMREGION_ERASEFF) + + ROM_REGION16_BE( 0x80, "normpoint", 0 ) + ROM_LOAD( "normpnt.rom", 0x00, 0x80, CRC(e7f2a005) SHA1(c27b4a364a24daeee6e99fd286753fd6216362b4) ) + + ROM_REGION16_BE( 0x80, "normslope", 0 ) + ROM_LOAD( "normslp.rom", 0x00, 0x80, CRC(4f2ae525) SHA1(eab43f8cc52c8551d9cff6fced18ef80eaba6f05) ) +ROM_END + +CONS(1996, n64, 0, 0, n64, n64, driver_device, 0, "Nintendo", "Nintendo 64", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +CONS(1996, n64dd, n64, 0, n64dd, n64, driver_device, 0, "Nintendo", "Nintendo 64DD", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/nakajies.c b/src/mame/drivers/nakajies.c new file mode 100644 index 00000000000..29b2ba35af8 --- /dev/null +++ b/src/mame/drivers/nakajies.c @@ -0,0 +1,835 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol,Sandro Ronco +/****************************************************************************** + + Driver for the ES-2xx series electronic typewriters made by Nakajima. + +Nakajima was the OEM manufacturer for a series of typewriters which were +sold by different brands around the world. The PCB layouts for these +machines are the same. The models differed in the amount of (static) RAM: +128KB or 256KB; and in the system rom (mainly only different language +support). + + +Model | SRAM | Language | Branded model +--------+-------+----------+---------------------- +ES-210N | 128KB | German | Walther ES-210 +ES-220 | 128KB | English | NTS DreamWriter T100 +ES-220 | 256KB | English | NTS DreamWriter T400 +ES-210N | 128KB | Spanish | Dator 3000 +ES-210N | 128KB | English | NTS DreamWriter 325 +ES-250 | xxxKB | English | NTS DreamWriter T200 + + +The LCD is driven by 6x Sanyo LC7940 and 1x Sanyo LC7942. + + +The keyboard matrix: + + | | | | | | | | | + | | | | | | | | | +-- LSHIFT -- ----- LEFT --- ENTER -- -- -- -- RSHIFT -- --- + | | | | | | | | | +-- 3 ------- Q ----- W ------ E ------ S -- D -- -- 2 ------- --- + | | | | | | | | | +-- 4 ------- Z ----- X ------ A ------ R -- F -- -- ------- --- + | | | | | | | | | +-- ------- B ----- V ------ T ------ G -- C -- Y -- ------- --- + | | | | | | | | | +-- CTRL ---- 1 ----- TAB ---- ------ -- -- -- CAPS ---- --- + | | | | | | | | | +-- ALT ----- CAN --- SPACE -- ------ 5 -- -- -- ` ------- --- + | | | | | | | | | +-- ------- INS --- RIGHT -- \ ------ H -- N -- / -- DOWN ---- 6 --- + | | | | | | | | | +-- ------- ORGN -- UP ----- WP ----- M -- K -- U -- 7 ------- = --- + | | | | | | | | | +-- ------- ] ----- [ ------ ' ------ J -- , -- I -- - ------- 8 --- + | | | | | | | | | +-- ------- BACK -- P ------ ; ------ O -- . -- L -- 9 ------- 0 --- + | | | | | | | | | + | | | | | | | | | + + + +NTS information from http://web.archive.org/web/19980205154137/nts.dreamwriter.com/dreamwt4.html: + +File Management & Memory: + +- Uniquely name up to 128 files +- Recall, rename or delete files +- Copy files to and from PCMCIA Memory card +- PCMCIA Memory expansion cards available for 60 or 250 pages of text +- Working memory allows up to 20 pages of text (50KB) to be displayed +- Storage memory allows up to 80 pages of text (128KB) in total +- DreamLink software exports and imports documents in RTF retaining all + formatting to Macintosh or Windows PC to all commonly used Word Processing programs +- Transfer cable provided compatible to both Macintosh and Windows PC's. +- T400 is field upgradeable to IR with the optional Infrared module. + +Hardware: + +- LCD Screen displays 8 lines by 80 characters raised and tilted 30 degrees +- Contrast Dial and feet adjust to user preference +- Parallel and Serial ports( IR Upgrade Optional) for connectivity to printers, Macintosh and Windows PC's +- Full size 64 key keyboard with color coded keys and quick reference menu bar +- NiCad rechargeable batteries for up to 8 hours of continuous use prior to recharging +- AC adapter for recharging batteries is lightweight and compact design +- NEC V20HL 9.83 MHz processor for fast response time +- Durable solid state construction weighing 2.2 lbs including battery pack +- Dimensions approximately 11" wide by 8" long by 1" deep +- FCC and CSA approved + + +I/O Map: + +0000 - unknown + 0x00 written during boot sequence + +0010 - unknown + 0x17 written during boot sequence + +0011 - unknown + 0x1e written during boot sequence + +0012 - unknown + 0x1f written during boot sequence + +0013 - unknown + 0x1e written during boot sequence + +0014 - unknown + 0x1d written during boot sequence + +0015 - unknown + 0x1c written during boot sequence + +0012-0015 - banking? +T200: +Time: 15 - 02; call ADxxx +Database: 15 - 02; call B3xxx +Spreadsheet: 15 - 02; call B9xxx + +T450: +Regular boot: 12 - 1f; 13 - 1e; 14 - 1d; 15 - 1c +Typing game: 15 - 02; call B100:0; +Edit Text: 12 - 07; 13 - 06; 14 - 05; 15 - 04; call 4000:0000 +c000:0000 - ffff:ffff = not banked? + +T400, wales210: +Regular boot: 12 - 1f; 13 - 1e; 14 - 1d; 15 - 1c +Next step during boot: 12 - 17; 13 - 3; 14 - 2; jump to 3000:0000 +writing 17 to port 12 maps rom offset 30000 to 3000:0000? + +1f, 1e, 1d, 1c is banked RAM ?? + +banking possibility: +0010-0017 - control banking: +0010 - 00000 - 1ffff +0011 - 20000 - 3ffff +0012 - 40000 - 5ffff +0013 - 60000 - 7ffff +0014 - 80000 - 9ffff +0015 - a0000 - bffff +0016 - c0000 - dffff +0017 - e0000 - fffff + +values 00-0f select a rom bank + 00 - selects last 20000h region of rom + 01 - 20000h region before last + 02 - etc + +values 10-1f select a ram bank + +on reset 0017 is set to 0, pointing to last 20000h bytes of ROM containing the boot setup code + + +0016 - unknown + 0x01 written during boot sequence + +0017 - unknown + 0x00 written during boot sequence + +0020 - unknown + 0x00 written during boot sequence + +0030 - unknown + Looking at code at C0769 bit 5 this seems to be used + as some kind of clock for data that was written to + I/O port 0040h. + +0040 - unknown + 0xff written during boot sequence + +Sounds related? +On boot: 50 = 98, 51 = 06, 52 = 7f + 52 = ff + 50 - 26, 51 = 01, 52 = 7f + 52 = ff + (mem check) + 50 = 98, 51 = 06, 52 = 7f + 52 = ff + 50 = 74, 51 = 04, 52 = 7f + 52 = ff + 50 = 98, 51 = 06, 52 = 7f + 52 = ff + (menu) + (type 1 - medium frequency sound ) + 50 = 5d, 51 = 01, 52 = 7f + 52 = ff + 52 = ff + 52 = ff + 50 = 00, 51 = 01, 52 = 7f + 52 = ff + (type 2 - simple lower sound) + 50 = ba, 51 = 02, 52 = 7f + 52 = ff + (type 3 - highest frequency sound) + 50 = 26, 51 = 01, 52 = 7f + 52 = ff + 50 = 06, 51 = 01, 52 = 7f + 52 = ff + 50 = e9, 51 = 00, 52 = 7f + 52 = ff + 50 = dc, 51 = 00, 52 = 7f + 52 = ff + 50 = c4, 51 = 00, 52 = 7f + 52 = ff +0050 - counter low? +0051 - counter high? +0052 - counter enable/disable? + +0060 - Irq enable/disable (?) + 0xff written at start of boot sequence + 0x7e written just before enabling interrupts + +0061 - unknown + 0xFE written in irq 0xFB handler + +0070 - uknown 0x01 is written when going to terminal mode (enable rs232 receive?) + +0090 - Interrupt source clear + b7 - 1 = clear interrupt source for irq vector 0xf8 + b6 - 1 = clear interrupt source for irq vector 0xf9 + b5 - 1 = clear interrupt source for irq vector 0xfa + b4 - 1 = clear interrupt source for irq vector 0xfb + b3 - 1 = clear interrupt source for irq vector 0xfc + b2 - 1 = clear interrupt source for irq vector 0xfd + b1 - 1 = clear interrupt source for irq vector 0xfe + b0 - 1 = clear interrupt source for irq vector 0xff + +00A0 - unknown + Read during initial boot sequence, expects to have bit 3 set at least once durnig the boot sequence + +00D0 - 00DC - Keyboard?? + +00DD - unknown + 0xf8 written during boot sequence + +00DE - unknown + 0xf0 written during boot sequence + + +IRQ 0xF8: +The handler clears the irq active bit and copies a word from 6D79 to 6D85 and +from 6D7B to 6D87 then enters an endless loop (with interrupts disabled). +Perhaps power on/off related?? + + +IRQ 0xF9: (T400: C049A) +Purpose unknown. IRQ handler clear bit 0 of 6DA9. + + +IRQ 0xFA: (T400: C04AE) +Purpose unknown. Expects 6D4F to be set up properly. Enables irq 0xFD. Reads +from input port 0xB0 and resets and sets bit 0 of output port 0x61. + + +IRQ 0xFB: (T400: C04D1) +Purpose unknown. Reads from input port 0xB0, sets bit 7 of 6D28 when +non-zero data was read. + + +IRQ 0xFC: (T400: C0550) +Purpose unknown. Reads from input port 0xC1 and 0xC0 and possibly outputs +something to output port 0xC1 depending on data read from 0xC1. + + +IRQ 0xFD: (T400: C0724) +Purpose unknown. Clears bit 3 of 70A5. + + +IRQ 0xFE: (T400: C0738) +Purpose unknown. Expects 6D4F to be set up properly. Enables irq 0xf9 or outputs +a byte to ports 0x40 and 0x30. No endless loop. + + +IRQ 0xFF: +This does some simple processing and then enters an endless loop (with interrupts +disabled). Perhaps power on/off related?? + +******************************************************************************/ + + +#include "emu.h" +#include "cpu/nec/nec.h" +#include "machine/rp5c01.h" +#include "sound/speaker.h" +#include "rendlay.h" + + +#define LOG 0 + + +class nakajies_state : public driver_device +{ +public: + nakajies_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "v20hl") + {} + + required_device m_maincpu; + + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void nakajies_update_irqs(); + DECLARE_READ8_MEMBER( irq_clear_r ); + DECLARE_WRITE8_MEMBER( irq_clear_w ); + DECLARE_READ8_MEMBER( irq_enable_r ); + DECLARE_WRITE8_MEMBER( irq_enable_w ); + DECLARE_READ8_MEMBER( unk_a0_r ); + DECLARE_WRITE8_MEMBER( lcd_memory_start_w ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_WRITE8_MEMBER( banking_w ); + void update_banks(); + void bank_w(UINT8 banknr, offs_t offset, UINT8 data); + DECLARE_WRITE8_MEMBER( bank0_w ); + DECLARE_WRITE8_MEMBER( bank1_w ); + DECLARE_WRITE8_MEMBER( bank2_w ); + DECLARE_WRITE8_MEMBER( bank3_w ); + DECLARE_WRITE8_MEMBER( bank4_w ); + DECLARE_WRITE8_MEMBER( bank5_w ); + DECLARE_WRITE8_MEMBER( bank6_w ); + DECLARE_WRITE8_MEMBER( bank7_w ); + + /* IRQ handling */ + UINT8 m_irq_enabled; + UINT8 m_irq_active; + + UINT8 m_lcd_memory_start; + UINT8* m_ram_base1; + + UINT8 m_matrix; + + /* ROM */ + UINT8 *m_rom_base; + UINT32 m_rom_size; + + /* RAM */ + UINT8 *m_ram_base; + UINT32 m_ram_size; + + /* Banking */ + UINT8 m_bank[8]; + UINT8 *m_bank_base[8]; + DECLARE_PALETTE_INIT(nakajies); + DECLARE_INPUT_CHANGED_MEMBER(trigger_irq); + TIMER_DEVICE_CALLBACK_MEMBER(kb_timer); +}; + + +#define X301 19660000 + + +void nakajies_state::update_banks() +{ + for( int i = 0; i < 8; i++ ) + { + if ( m_bank[i] & 0x10 ) + { + /* RAM banking */ + /* Not entirely sure if bank 0x1f refers to first or second ram bank ... */ + m_bank_base[i] = m_ram_base + ( ( ( ( m_bank[i] & 0x0f ) ^ 0xf ) << 17 ) % m_ram_size ); + } + else + { + /* ROM banking */ + /* 0 is last bank, 1 bank before last, etc */ + m_bank_base[i] = m_rom_base + ( ( ( ( m_bank[i] & 0x0f ) ^ 0xf ) << 17 ) % m_rom_size ); + } + } + membank( "bank0" )->set_base( m_bank_base[0] ); + membank( "bank1" )->set_base( m_bank_base[1] ); + membank( "bank2" )->set_base( m_bank_base[2] ); + membank( "bank3" )->set_base( m_bank_base[3] ); + membank( "bank4" )->set_base( m_bank_base[4] ); + membank( "bank5" )->set_base( m_bank_base[5] ); + membank( "bank6" )->set_base( m_bank_base[6] ); + membank( "bank7" )->set_base( m_bank_base[7] ); +} + +void nakajies_state::bank_w( UINT8 banknr, offs_t offset, UINT8 data ) +{ + if ( m_bank[banknr] & 0x10 ) + { + m_bank_base[banknr][offset] = data; + } +} + +WRITE8_MEMBER( nakajies_state::bank0_w ) { bank_w( 0, offset, data ); } +WRITE8_MEMBER( nakajies_state::bank1_w ) { bank_w( 1, offset, data ); } +WRITE8_MEMBER( nakajies_state::bank2_w ) { bank_w( 2, offset, data ); } +WRITE8_MEMBER( nakajies_state::bank3_w ) { bank_w( 3, offset, data ); } +WRITE8_MEMBER( nakajies_state::bank4_w ) { bank_w( 4, offset, data ); } +WRITE8_MEMBER( nakajies_state::bank5_w ) { bank_w( 5, offset, data ); } +WRITE8_MEMBER( nakajies_state::bank6_w ) { bank_w( 6, offset, data ); } +WRITE8_MEMBER( nakajies_state::bank7_w ) { bank_w( 7, offset, data ); } + + +static ADDRESS_MAP_START( nakajies_map, AS_PROGRAM, 8, nakajies_state ) + AM_RANGE( 0x00000, 0x1ffff ) AM_READ_BANK( "bank0" ) AM_WRITE( bank0_w ) + AM_RANGE( 0x20000, 0x3ffff ) AM_READ_BANK( "bank1" ) AM_WRITE( bank1_w ) + AM_RANGE( 0x40000, 0x5ffff ) AM_READ_BANK( "bank2" ) AM_WRITE( bank2_w ) + AM_RANGE( 0x60000, 0x7ffff ) AM_READ_BANK( "bank3" ) AM_WRITE( bank3_w ) + AM_RANGE( 0x80000, 0x9ffff ) AM_READ_BANK( "bank4" ) AM_WRITE( bank4_w ) + AM_RANGE( 0xa0000, 0xbffff ) AM_READ_BANK( "bank5" ) AM_WRITE( bank5_w ) + AM_RANGE( 0xc0000, 0xdffff ) AM_READ_BANK( "bank6" ) AM_WRITE( bank6_w ) + AM_RANGE( 0xe0000, 0xfffff ) AM_READ_BANK( "bank7" ) AM_WRITE( bank7_w ) +ADDRESS_MAP_END + + +/********************************************* + IRQ Handling +*********************************************/ + +void nakajies_state::nakajies_update_irqs() +{ + // Hack: IRQ mask is temporarily disabled because doesn't allow the IRQ vector 0xFA + // and 0xFB that are used for scan the kb, this need further investigation. + UINT8 irq = m_irq_active; // & m_irq_enabled; + UINT8 vector = 0xff; + + if (LOG) + logerror("nakajies_update_irqs: irq_enabled = %02x, irq_active = %02x\n", m_irq_enabled, m_irq_active ); + + /* Assuming irq 0xFF has the highest priority and 0xF8 the lowest */ + while( vector >= 0xf8 && ! ( irq & 0x01 ) ) + { + irq >>= 1; + vector -= 1; + } + + if ( vector >= 0xf8 ) + { + m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, vector ); + } + else + { + m_maincpu->set_input_line(0, CLEAR_LINE ); + } +} + + +READ8_MEMBER( nakajies_state::irq_clear_r ) +{ + return 0x00; +} + + +WRITE8_MEMBER( nakajies_state::irq_clear_w ) +{ + m_irq_active &= ~data; + nakajies_update_irqs(); +} + + +READ8_MEMBER( nakajies_state::irq_enable_r ) +{ + return m_irq_enabled; +} + + +WRITE8_MEMBER( nakajies_state::irq_enable_w ) +{ + m_irq_enabled = data; + nakajies_update_irqs(); +} + + +/* + I/O Port a0: + bit 7-4 - unknown + bit 3 - battery low (when set) + bit 2-0 - unknown +*/ +READ8_MEMBER( nakajies_state::unk_a0_r ) +{ + return 0xf7; +} + +WRITE8_MEMBER( nakajies_state::lcd_memory_start_w ) +{ + m_lcd_memory_start = data; +} + + +WRITE8_MEMBER( nakajies_state::banking_w ) +{ + m_bank[offset] = data; + update_banks(); +} + + +READ8_MEMBER( nakajies_state::keyboard_r ) +{ + static const char *const bitnames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", + "ROW5", "ROW6", "ROW7", "ROW8", "ROW9" }; + + return (m_matrix > 0x00) ? ioport(bitnames[m_matrix - 1])->read() : 0; +} + + +static ADDRESS_MAP_START( nakajies_io_map, AS_IO, 8, nakajies_state ) + AM_RANGE( 0x0000, 0x0000 ) AM_WRITE( lcd_memory_start_w ) + AM_RANGE( 0x0010, 0x0017 ) AM_WRITE( banking_w ) + AM_RANGE( 0x0060, 0x0060 ) AM_READWRITE( irq_enable_r, irq_enable_w ) + AM_RANGE( 0x0090, 0x0090 ) AM_READWRITE( irq_clear_r, irq_clear_w ) + AM_RANGE( 0x00a0, 0x00a0 ) AM_READ( unk_a0_r ) + AM_RANGE( 0x00b0, 0x00b0 ) AM_READ( keyboard_r ) + AM_RANGE( 0x00d0, 0x00df ) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) +ADDRESS_MAP_END + + +INPUT_CHANGED_MEMBER(nakajies_state::trigger_irq) +{ + UINT8 irqs = ioport( "debug" )->read(); + + m_irq_active |= irqs; + nakajies_update_irqs(); +} + + +static INPUT_PORTS_START( nakajies ) + PORT_START( "debug" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F1 ) PORT_NAME( "irq 0xff" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F2 ) PORT_NAME( "irq 0xfe" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F3 ) PORT_NAME( "irq 0xfd" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F4 ) PORT_NAME( "irq 0xfc" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F5 ) PORT_NAME( "irq 0xfb" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F6 ) PORT_NAME( "irq 0xfa" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F7 ) PORT_NAME( "irq 0xf9" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F8 ) PORT_NAME( "irq 0xf8" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) + + PORT_START( "ROW0" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE( KEYCODE_LSHIFT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE( KEYCODE_RSHIFT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT") PORT_CODE( KEYCODE_LEFT ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE( KEYCODE_ENTER ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "ROW1" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE( KEYCODE_LALT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("`") PORT_CODE( KEYCODE_BACKSLASH2 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAN") PORT_CODE( KEYCODE_ESC ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE( KEYCODE_SPACE ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE( KEYCODE_5 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "ROW2" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE( KEYCODE_LCONTROL ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPSLOCK") PORT_CODE( KEYCODE_CAPSLOCK ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE( KEYCODE_1 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE( KEYCODE_TAB ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "ROW3" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE( KEYCODE_3 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE( KEYCODE_2 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE( KEYCODE_Q ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE( KEYCODE_W ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE( KEYCODE_E ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE( KEYCODE_S ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE( KEYCODE_D ) + + PORT_START( "ROW4" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE( KEYCODE_4 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE( KEYCODE_Z ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE( KEYCODE_X ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE( KEYCODE_A ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE( KEYCODE_R ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE( KEYCODE_F ) + + PORT_START( "ROW5" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE( KEYCODE_B ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE( KEYCODE_V ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE( KEYCODE_T ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE( KEYCODE_Y ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE( KEYCODE_G ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE( KEYCODE_C ) + + PORT_START( "ROW6" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE( KEYCODE_6 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE( KEYCODE_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INSERT") PORT_CODE( KEYCODE_INSERT ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE( KEYCODE_RIGHT ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\") PORT_CODE( KEYCODE_BACKSLASH ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE( KEYCODE_SLASH ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE( KEYCODE_H ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE( KEYCODE_N ) + + PORT_START( "ROW7" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("=") PORT_CODE( KEYCODE_EQUALS ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE( KEYCODE_7 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ORGN") PORT_CODE( KEYCODE_PGUP ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE( KEYCODE_UP ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("WP") PORT_CODE( KEYCODE_PGDN ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE( KEYCODE_U ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE( KEYCODE_M ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE( KEYCODE_K ) + + PORT_START( "ROW8" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE( KEYCODE_8 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE( KEYCODE_MINUS ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE( KEYCODE_CLOSEBRACE ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE( KEYCODE_OPENBRACE ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\'") PORT_CODE( KEYCODE_QUOTE ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE( KEYCODE_I ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE( KEYCODE_J ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE( KEYCODE_COMMA ) + + PORT_START( "ROW9" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE( KEYCODE_0 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE( KEYCODE_9 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BACK") PORT_CODE( KEYCODE_BACKSPACE ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE( KEYCODE_P ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE( KEYCODE_COLON ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE( KEYCODE_L ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE( KEYCODE_O ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE( KEYCODE_STOP ) +INPUT_PORTS_END + + +void nakajies_state::machine_start() +{ + m_rom_base = memregion("bios")->base(); + m_rom_size = memregion("bios")->bytes(); + + const char *gamename = machine().system().name; + + m_ram_size = 128 * 1024; + if ( strcmp( gamename, "drwrt400" ) == 0 || strcmp( gamename, "drwrt200" ) == 0 ) + { + m_ram_size = 256 * 1024; + } + m_ram_base = machine().memory().region_alloc( "mainram", m_ram_size, 1, ENDIANNESS_LITTLE )->base(); +} + + +void nakajies_state::machine_reset() +{ + m_irq_enabled = 0; + m_irq_active = 0; + m_lcd_memory_start = 0; + m_matrix = 0; + + /* Initialize banks */ + for ( int i = 0; i < 8; i++ ) + { + m_bank[i] = 0; + } + memset(m_ram_base, 0, m_ram_size); + update_banks(); +} + +UINT32 nakajies_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8* lcd_memory_start = m_ram_base + (m_lcd_memory_start<<9); + int height = screen.height(); + + for (int y=0; y 0x09) + { + // reset the keyboard scan + m_matrix = 0; + m_irq_active |= 0x20; + } + else + { + // next row + m_matrix++; + m_irq_active |= 0x10; + } + + nakajies_update_irqs(); +} + + +PALETTE_INIT_MEMBER(nakajies_state, nakajies) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + + +/* F4 Character Displayer */ +static const gfx_layout nakajies_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 2331, /* 2331 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( wales210 ) + GFXDECODE_ENTRY( "bios", 0x55043, nakajies_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( dator3k ) + GFXDECODE_ENTRY( "bios", 0x54fb1, nakajies_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( drwrt200 ) + GFXDECODE_ENTRY( "bios", 0xdbbeb, nakajies_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( drwrt400 ) + GFXDECODE_ENTRY( "bios", 0x580b6, nakajies_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( nakajies210, nakajies_state ) + MCFG_CPU_ADD( "v20hl", V20, X301 / 2 ) + MCFG_CPU_PROGRAM_MAP( nakajies_map) + MCFG_CPU_IO_MAP( nakajies_io_map) + + MCFG_SCREEN_ADD( "screen", LCD ) + MCFG_SCREEN_REFRESH_RATE( 50 ) /* Wild guess */ + MCFG_SCREEN_UPDATE_DRIVER( nakajies_state, screen_update ) + MCFG_SCREEN_SIZE( 80 * 6, 8 * 8 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 6 * 80 - 1, 0, 8 * 8 - 1 ) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", wales210) + MCFG_PALETTE_ADD( "palette", 2 ) + MCFG_PALETTE_INIT_OWNER(nakajies_state, nakajies) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* sound */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "speaker", SPEAKER_SOUND, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + /* rtc */ + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer", nakajies_state, kb_timer, attotime::from_hz(250)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dator3k, nakajies210 ) + MCFG_GFXDECODE_MODIFY("gfxdecode", dator3k) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nakajies220, nakajies210 ) + MCFG_GFXDECODE_MODIFY("gfxdecode", drwrt400) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nakajies250, nakajies210 ) + MCFG_SCREEN_MODIFY( "screen" ) + MCFG_SCREEN_SIZE( 80 * 6, 16 * 8 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 6 * 80 - 1, 0, 16 * 8 - 1 ) + MCFG_GFXDECODE_MODIFY("gfxdecode", drwrt200) +MACHINE_CONFIG_END + + +ROM_START(wales210) + ROM_REGION( 0x80000, "bios", 0 ) + + ROM_SYSTEM_BIOS( 0, "wales210", "Walther ES-210" ) + ROMX_LOAD("wales210.ic303", 0x00000, 0x80000, CRC(a8e8d991) SHA1(9a133b37b2fbf689ae1c7ab5c7f4e97cd33fd596), ROM_BIOS(1)) /* 27c4001 */ + + ROM_SYSTEM_BIOS( 1, "drwrtr325", "NTS DreamWriter 325" ) + ROMX_LOAD("dr3_1_02uk.ic303", 0x00000, 0x80000, CRC(027db9fe) SHA1(eb52a30510f2e2924c6dae9bc4348cd3572f4997), ROM_BIOS(2)) +ROM_END + + +ROM_START(dator3k) + ROM_REGION( 0x80000, "bios", 0 ) + ROM_LOAD("dator3000.ic303", 0x00000, 0x80000, CRC(b67fffeb) SHA1(e48270d15bef9453bcb6ba8aa949fd2ab3feceed)) +ROM_END + + +ROM_START(drwrt100) + ROM_REGION( 0x80000, "bios", 0 ) + ROM_LOAD("t100_2.3.ic303", 0x00000, 0x80000, CRC(8a16f12f) SHA1(0a907186db3d1756566d767ee847a7ecf694e74b)) /* Checksum 01F5 on label */ +ROM_END + + +ROM_START(drwrt200) + ROM_REGION( 0x100000, "bios", 0 ) + ROM_LOAD("drwrt200.bin", 0x000000, 0x100000, CRC(3c39483c) SHA1(48293e6bdb7e7322d76da7174b716243c0ab7c2c) ) +ROM_END + + +ROM_START(drwrt400) + ROM_REGION( 0x80000, "bios", 0 ) + ROM_LOAD("t4_ir_2.1.ic303", 0x00000, 0x80000, CRC(f0f45fd2) SHA1(3b4d5722b3e32e202551a1be8ae36f34ad705ddd)) +ROM_END + + +ROM_START(drwrt450) + ROM_REGION( 0x100000, "bios", 0 ) + ROM_LOAD("t4_ir_35ba308.ic303", 0x00000, 0x100000, CRC(3b5a580d) SHA1(72df34ece1e6d70adf953025d1c458e22ce819e1)) +ROM_END + + +ROM_START( es210_es ) + ROM_REGION( 0x80000, "bios", 0 ) + ROM_LOAD("nakajima_es.ic303", 0x00000, 0x80000, CRC(214d73ce) SHA1(ce9967c5b2d122ebebe9401278d8ea374e8fb289)) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 199?, wales210, 0, 0, nakajies210, nakajies, driver_device, 0, "Walther", "ES-210", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* German, 128KB RAM */ +COMP( 199?, dator3k, wales210, 0, dator3k, nakajies, driver_device, 0, "Dator", "Dator 3000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* Spanish, 128KB RAM */ +COMP( 199?, es210_es, wales210, 0, nakajies210, nakajies, driver_device, 0, "Nakajima","ES-210 (Spain)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* Spanish, 128KB RAM */ +COMP( 199?, drwrt100, wales210, 0, nakajies220, nakajies, driver_device, 0, "NTS", "DreamWriter T100", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* English, 128KB RAM */ +COMP( 1996, drwrt400, wales210, 0, nakajies220, nakajies, driver_device, 0, "NTS", "DreamWriter T400", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* English, 256KB RAM */ +COMP( 199?, drwrt450, wales210, 0, nakajies220, nakajies, driver_device, 0, "NTS", "DreamWriter 450", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* English, 128KB RAM */ +COMP( 199?, drwrt200, wales210, 0, nakajies250, nakajies, driver_device, 0, "NTS", "DreamWriter T200", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* English, 256KB? RAM */ diff --git a/src/mame/drivers/nanos.c b/src/mame/drivers/nanos.c new file mode 100644 index 00000000000..6552b696a98 --- /dev/null +++ b/src/mame/drivers/nanos.c @@ -0,0 +1,544 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Nanos + + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/z80ctc.h" +#include "machine/upd765.h" +#include "formats/nanos_dsk.h" +#include "machine/ram.h" + + +class nanos_state : public driver_device +{ +public: + nanos_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pio(*this, "z80pio"), + m_pio_0(*this, "z80pio_0"), + m_pio_1(*this, "z80pio_1"), + m_sio_0(*this, "z80sio_0"), + m_sio_1(*this, "z80sio_1"), + m_ctc_0(*this, "z80ctc_0"), + m_ctc_1(*this, "z80ctc_1"), + m_fdc(*this, "upd765"), + m_key_t(*this, "keyboard_timer"), + m_ram(*this, RAM_TAG), + m_region_maincpu(*this, "maincpu"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1"), + m_line2(*this, "LINE2"), + m_line3(*this, "LINE3"), + m_line4(*this, "LINE4"), + m_line5(*this, "LINE5"), + m_line6(*this, "LINE6"), + m_linec(*this, "LINEC") + { } + + required_device m_maincpu; + required_device m_pio; + required_device m_pio_0; + required_device m_pio_1; + required_device m_sio_0; + required_device m_sio_1; + required_device m_ctc_0; + required_device m_ctc_1; + required_device m_fdc; + required_device m_key_t; + required_device m_ram; + const UINT8 *m_p_chargen; + UINT8 m_key_command; + UINT8 m_last_code; + UINT8 m_key_pressed; + DECLARE_WRITE8_MEMBER( nanos_tc_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); + virtual void machine_reset(); + virtual void machine_start(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); + DECLARE_WRITE_LINE_MEMBER(z80daisy_interrupt); + DECLARE_READ8_MEMBER(nanos_port_a_r); + DECLARE_READ8_MEMBER(nanos_port_b_r); + DECLARE_WRITE8_MEMBER(nanos_port_b_w); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + +protected: + required_memory_region m_region_maincpu; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_ioport m_line0; + required_ioport m_line1; + required_ioport m_line2; + required_ioport m_line3; + required_ioport m_line4; + required_ioport m_line5; + required_ioport m_line6; + required_ioport m_linec; + UINT8 row_number(UINT8 code); +}; + + + +static ADDRESS_MAP_START(nanos_mem, AS_PROGRAM, 8, nanos_state) + AM_RANGE( 0x0000, 0x0fff ) AM_READ_BANK("bank1") AM_WRITE_BANK("bank3") + AM_RANGE( 0x1000, 0xffff ) AM_RAMBANK("bank2") +ADDRESS_MAP_END + +WRITE8_MEMBER(nanos_state::nanos_tc_w) +{ + m_fdc->tc_w(BIT(data,1)); +} + + +/* Z80-CTC Interface */ + +WRITE_LINE_MEMBER( nanos_state::ctc_z0_w ) +{ +} + +WRITE_LINE_MEMBER( nanos_state::ctc_z1_w ) +{ +} + +WRITE_LINE_MEMBER( nanos_state::ctc_z2_w ) +{ +} + +/* Z80-SIO Interface */ + +WRITE_LINE_MEMBER(nanos_state::z80daisy_interrupt) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); +} + +/* Z80 Daisy Chain */ + +static const z80_daisy_config nanos_daisy_chain[] = +{ + { "z80pio" }, + { "z80pio_0" }, + { "z80pio_1" }, + { "z80sio_0" }, + { "z80ctc_0" }, + { "z80sio_1" }, + { "z80ctc_1" }, + { NULL } +}; + +static ADDRESS_MAP_START( nanos_io , AS_IO, 8, nanos_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + /* CPU card */ + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) + + /* I/O card */ + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80pio_0", z80pio_device, read, write) + AM_RANGE(0x84, 0x87) AM_DEVREADWRITE("z80sio_0", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x88, 0x8B) AM_DEVREADWRITE("z80pio_1", z80pio_device, read, write) + AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE("z80ctc_0", z80ctc_device, read, write) + + /* FDC card */ + AM_RANGE(0x92, 0x92) AM_WRITE(nanos_tc_w) + AM_RANGE(0x94, 0x95) AM_DEVICE("upd765", upd765a_device, map) + /* V24+IFSS card */ + AM_RANGE(0xA0, 0xA3) AM_DEVREADWRITE("z80sio_0", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0xA4, 0xA7) AM_DEVREADWRITE("z80ctc_1", z80ctc_device, read, write) + + /* 256-k RAM card I - 64k OS-Memory + 192k-RAM-Floppy */ + //AM_RANGE(0xC0, 0xC7) + + /* 256-k RAM card II - 64k OS-Memory + 192k-RAM-Floppy */ + //AM_RANGE(0xC8, 0xCF) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( nanos ) + PORT_START("LINEC") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_END) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL")PORT_CODE(KEYCODE_BACKSPACE) + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) +INPUT_PORTS_END + + +void nanos_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +// static UINT8 framecnt=0; + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + +// framecnt++; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 80; x++) + { + if (ra < 8) + { + chr = m_ram->pointer()[0xf800+ x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<3) | ra ]; + } + else + gfx = 0; + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=80; + } + return 0; +} + +READ8_MEMBER(nanos_state::nanos_port_a_r) +{ + UINT8 retVal; + if (m_key_command==0) { + return m_key_pressed; + } else { + retVal = m_last_code; + m_last_code = 0; + return retVal; + } +} + +READ8_MEMBER(nanos_state::nanos_port_b_r) +{ + return 0xff; +} + + +WRITE8_MEMBER(nanos_state::nanos_port_b_w) +{ + m_key_command = BIT(data,1); + if (BIT(data,7)) { + m_bank1->set_base(m_region_maincpu->base()); + } else { + m_bank1->set_base(m_ram->pointer()); + } +} + +UINT8 nanos_state::row_number(UINT8 code) +{ + if BIT(code,0) return 0; + if BIT(code,1) return 1; + if BIT(code,2) return 2; + if BIT(code,3) return 3; + if BIT(code,4) return 4; + if BIT(code,5) return 5; + if BIT(code,6) return 6; + if BIT(code,7) return 7; + return 0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(nanos_state::keyboard_callback) +{ + ioport_port *io_ports[] = { m_line0, m_line1, m_line2, m_line3, m_line4, m_line5, m_line6 }; + + int i; + UINT8 code; + UINT8 key_code = 0; + UINT8 shift = m_linec->read() & 0x02 ? 1 : 0; + UINT8 ctrl = m_linec->read() & 0x01 ? 1 : 0; + m_key_pressed = 0xff; + for(i = 0; i < 7; i++) + { + code = io_ports[i]->read(); + if (code != 0) + { + if (i==0 && shift==0) { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } + if (i==0 && shift==1) { + key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers + } + if (i==1 && shift==0) { + if (row_number(code) < 4) { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } else { + key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs + } + } + if (i==1 && shift==1) { + if (row_number(code) < 4) { + key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs + } else { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } + } + if (i>=2 && i<=4 && shift==1 && ctrl==0) { + key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters + } + if (i>=2 && i<=4 && shift==0 && ctrl==0) { + key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters + } + if (i>=2 && i<=4 && ctrl==1) { + key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters + } + if (i==5 && shift==1 && ctrl==0) { + if (row_number(code)<7) { + key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters + } else { + key_code = 0x40 + row_number(code) + (i-2)*8; // for signs it is switched + } + } + if (i==5 && shift==0 && ctrl==0) { + if (row_number(code)<7) { + key_code = 0x40 + row_number(code) + (i-2)*8; // for small letters + } else { + key_code = 0x60 + row_number(code) + (i-2)*8; // for signs it is switched + } + } + if (i==5 && shift==0 && ctrl==1) { + key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl + } + if (i==6) { + switch(row_number(code)) + { + case 0: key_code = 0x11; break; + case 1: key_code = 0x12; break; + case 2: key_code = 0x13; break; + case 3: key_code = 0x14; break; + case 4: key_code = 0x20; break; // Space + case 5: key_code = 0x0D; break; // Enter + case 6: key_code = 0x09; break; // TAB + case 7: key_code = 0x0A; break; // LF + } + } + m_last_code = key_code; + } + } + if (key_code==0){ + m_key_pressed = 0xf7; + } +} + +void nanos_state::machine_start() +{ + m_key_pressed = 0xff; +} + +void nanos_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.install_write_bank(0x0000, 0x0fff, "bank3"); + space.install_write_bank(0x1000, 0xffff, "bank2"); + + m_bank1->set_base(m_region_maincpu->base()); + m_bank2->set_base(m_ram->pointer() + 0x1000); + m_bank3->set_base(m_ram->pointer()); + + machine().device("upd765:0")->get_device()->mon_w(false); +} + +FLOPPY_FORMATS_MEMBER( nanos_state::floppy_formats ) + FLOPPY_NANOS_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( nanos_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +/* F4 Character Displayer */ +static const gfx_layout nanos_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( nanos ) + GFXDECODE_ENTRY( "chargen", 0x0000, nanos_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( nanos, nanos_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(nanos_mem) + MCFG_CPU_IO_MAP(nanos_io) + MCFG_CPU_CONFIG(nanos_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(nanos_state, screen_update) + MCFG_SCREEN_SIZE(80*8, 25*10) + MCFG_SCREEN_VISIBLE_AREA(0,80*8-1,0,25*10-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", nanos) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* devices */ + MCFG_DEVICE_ADD("z80ctc_0", Z80CTC, XTAL_4MHz) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(nanos_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(nanos_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(nanos_state, ctc_z2_w)) + + MCFG_DEVICE_ADD("z80ctc_1", Z80CTC, XTAL_4MHz) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(nanos_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(nanos_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(nanos_state, ctc_z2_w)) + + MCFG_DEVICE_ADD("z80pio_0", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80pio_1", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_Z80SIO0_ADD("z80sio_0", XTAL_4MHz, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(WRITELINE(nanos_state, z80daisy_interrupt)) + + MCFG_Z80SIO0_ADD("z80sio_1", XTAL_4MHz, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(WRITELINE(nanos_state, z80daisy_interrupt)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_IN_PA_CB(READ8(nanos_state, nanos_port_a_r)) + MCFG_Z80PIO_IN_PB_CB(READ8(nanos_state, nanos_port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(nanos_state, nanos_port_b_w)) + + /* UPD765 */ + MCFG_UPD765A_ADD("upd765", false, true) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", nanos_floppies, "525hd", nanos_state::floppy_formats) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", nanos_state, keyboard_callback, attotime::from_hz(24000)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( nanos ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "k7634_1.rom", 0x0000, 0x0800, CRC(8e34e6ac) SHA1(fd342f6effe991823c2a310737fbfcba213c4fe3)) + ROM_LOAD( "k7634_2.rom", 0x0800, 0x0180, CRC(4e01b02b) SHA1(8a279da886555c7470a1afcbb3a99693ea13c237)) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "zg_nanos.rom", 0x0000, 0x0800, CRC(5682d3f9) SHA1(5b738972c815757821c050ee38b002654f8da163)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, nanos, 0, 0, nanos, nanos, driver_device, 0, "Ingenieurhochschule fur Seefahrt Warnemunde/Wustrow", "NANOS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/nascom1.c b/src/mame/drivers/nascom1.c new file mode 100644 index 00000000000..216d9de8e64 --- /dev/null +++ b/src/mame/drivers/nascom1.c @@ -0,0 +1,776 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Nascom 1/2/3 + + Single board computer + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "machine/z80pio.h" +#include "machine/ay31015.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "bus/nasbus/nasbus.h" + + +//************************************************************************** +// CONSTANTS/MACROS +//************************************************************************** + +#define NASCOM1_KEY_RESET 0x02 +#define NASCOM1_KEY_INCR 0x01 + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +struct nascom1_portstat_t +{ + UINT8 stat_flags; + UINT8 stat_count; +}; + +class nascom_state : public driver_device +{ +public: + nascom_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_hd6402(*this, "hd6402"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_videoram(*this, "videoram"), + m_keyboard(*this, "KEY") + { } + + required_device m_maincpu; + required_device m_hd6402; + required_device m_cassette; + required_device m_ram; + required_device m_gfxdecode; + required_device m_palette; + required_shared_ptr m_videoram; + required_ioport_array<9> m_keyboard; + + int m_tape_size; + UINT8 *m_tape_image; + int m_tape_index; + nascom1_portstat_t m_portstat; + + DECLARE_READ8_MEMBER(nascom1_port_00_r); + DECLARE_WRITE8_MEMBER(nascom1_port_00_w); + DECLARE_READ8_MEMBER(nascom1_port_01_r); + DECLARE_WRITE8_MEMBER(nascom1_port_01_w); + DECLARE_READ8_MEMBER(nascom1_port_02_r); + DECLARE_DRIVER_INIT(nascom); + void screen_update(bitmap_ind16 &bitmap, const rectangle &cliprect, int char_height); + DECLARE_READ8_MEMBER(nascom1_hd6402_si); + DECLARE_WRITE8_MEMBER(nascom1_hd6402_so); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( nascom1_cassette ); + DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( nascom1_cassette ); + DECLARE_SNAPSHOT_LOAD_MEMBER( nascom1 ); + +protected: + virtual void machine_reset(); + +private: + +}; + +class nascom1_state : public nascom_state +{ +public: + nascom1_state(const machine_config &mconfig, device_type type, const char *tag) : + nascom_state(mconfig, type, tag) + {} + + UINT32 screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: +}; + +class nascom2_state : public nascom_state +{ +public: + nascom2_state(const machine_config &mconfig, device_type type, const char *tag) : + nascom_state(mconfig, type, tag), + m_nasbus(*this, "nasbus"), + m_socket1(*this, "socket1"), + m_socket2(*this, "socket2"), + m_lsw1(*this, "lsw1") + {} + + DECLARE_WRITE_LINE_MEMBER(ram_disable_w); + DECLARE_WRITE_LINE_MEMBER(ram_disable_cpm_w); + DECLARE_DRIVER_INIT(nascom2); + DECLARE_DRIVER_INIT(nascom2c); + UINT32 screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + int load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(socket1_load) { return load_cart(image, m_socket1, 1); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(socket2_load) { return load_cart(image, m_socket2, 2); } + +protected: + virtual void machine_reset(); + +private: + required_device m_nasbus; + required_device m_socket1; + required_device m_socket2; + required_ioport m_lsw1; +}; + + +//************************************************************************** +// KEYBOARD +//************************************************************************** + +READ8_MEMBER( nascom_state::nascom1_port_00_r ) +{ + if (m_portstat.stat_count < 9) + return ((m_keyboard[m_portstat.stat_count])->read() | ~0x7f); + + return 0xff; +} + +WRITE8_MEMBER( nascom_state::nascom1_port_00_w ) +{ + m_cassette->change_state( + (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + if (!(data & NASCOM1_KEY_RESET)) + { + if (m_portstat.stat_flags & NASCOM1_KEY_RESET) + m_portstat.stat_count = 0; + } + else + m_portstat.stat_flags = NASCOM1_KEY_RESET; + + if (!(data & NASCOM1_KEY_INCR)) + { + if (m_portstat.stat_flags & NASCOM1_KEY_INCR) + m_portstat.stat_count++; + } + else + m_portstat.stat_flags = NASCOM1_KEY_INCR; +} + + +//************************************************************************** +// CASSETTE +//************************************************************************** + +READ8_MEMBER( nascom_state::nascom1_port_01_r ) +{ + return m_hd6402->get_received_data(); +} + + +WRITE8_MEMBER( nascom_state::nascom1_port_01_w ) +{ + m_hd6402->set_transmit_data(data); +} + +READ8_MEMBER( nascom_state::nascom1_port_02_r ) +{ + UINT8 data = 0x31; + + m_hd6402->set_input_pin(AY31015_SWE, 0); + data |= m_hd6402->get_output_pin(AY31015_OR ) ? 0x02 : 0; + data |= m_hd6402->get_output_pin(AY31015_PE ) ? 0x04 : 0; + data |= m_hd6402->get_output_pin(AY31015_FE ) ? 0x08 : 0; + data |= m_hd6402->get_output_pin(AY31015_TBMT) ? 0x40 : 0; + data |= m_hd6402->get_output_pin(AY31015_DAV ) ? 0x80 : 0; + m_hd6402->set_input_pin(AY31015_SWE, 1); + + return data; +} + +READ8_MEMBER( nascom_state::nascom1_hd6402_si ) +{ + return 1; +} + +WRITE8_MEMBER( nascom_state::nascom1_hd6402_so ) +{ +} + +DEVICE_IMAGE_LOAD_MEMBER( nascom_state, nascom1_cassette ) +{ + m_tape_size = image.length(); + m_tape_image = (UINT8*)image.ptr(); + + if (!m_tape_image) + return IMAGE_INIT_FAIL; + + m_tape_index = 0; + return IMAGE_INIT_PASS; +} + +DEVICE_IMAGE_UNLOAD_MEMBER( nascom_state, nascom1_cassette ) +{ + m_tape_image = NULL; + m_tape_size = m_tape_index = 0; +} + + +//************************************************************************** +// SNAPSHOTS +//************************************************************************** + +SNAPSHOT_LOAD_MEMBER( nascom_state, nascom1 ) +{ + UINT8 line[35]; + + while (image.fread( &line, sizeof(line)) == sizeof(line)) + { + unsigned int addr, b0, b1, b2, b3, b4, b5, b6, b7, dummy; + + if (sscanf((char *)line, "%x %x %x %x %x %x %x %x %x %x\010\010\n", + &addr, &b0, &b1, &b2, &b3, &b4, &b5, &b6, &b7, &dummy) == 10) + { + m_maincpu->space(AS_PROGRAM).write_byte(addr++, b0); + m_maincpu->space(AS_PROGRAM).write_byte(addr++, b1); + m_maincpu->space(AS_PROGRAM).write_byte(addr++, b2); + m_maincpu->space(AS_PROGRAM).write_byte(addr++, b3); + m_maincpu->space(AS_PROGRAM).write_byte(addr++, b4); + m_maincpu->space(AS_PROGRAM).write_byte(addr++, b5); + m_maincpu->space(AS_PROGRAM).write_byte(addr++, b6); + m_maincpu->space(AS_PROGRAM).write_byte(addr++, b7); + } + } + + return IMAGE_INIT_PASS; +} + + +//************************************************************************** +// SOCKETS +//************************************************************************** + +int nascom2_state::load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id) +{ + // loading directly from file + if (image.software_entry() == NULL) + { + if (slot->length() > 0x1000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported file size"); + return IMAGE_INIT_FAIL; + } + + slot->rom_alloc(slot->length(), GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + slot->fread(slot->get_rom_base(), slot->length()); + + // we just assume that socket1 should be loaded to 0xc000 and socket2 to 0xd000 + switch (slot_id) + { + case 1: + m_maincpu->space(AS_PROGRAM).install_rom(0xc000, 0xc000 + slot->length() - 1, slot->get_rom_base()); + break; + case 2: + m_maincpu->space(AS_PROGRAM).install_rom(0xd000, 0xd000 + slot->length() - 1, slot->get_rom_base()); + break; + } + } + + // loading from software list. this supports multiple regions to load to + else + { + UINT8 *region_b000 = image.get_software_region("b000"); + UINT8 *region_c000 = image.get_software_region("c000"); + UINT8 *region_d000 = image.get_software_region("d000"); + + if (region_b000 != NULL) + { + UINT32 size = image.get_software_region_length("b000"); + m_maincpu->space(AS_PROGRAM).install_rom(0xb000, 0xb000 + size - 1, region_b000); + } + + if (region_c000 != NULL) + { + UINT32 size = image.get_software_region_length("c000"); + m_maincpu->space(AS_PROGRAM).install_rom(0xc000, 0xc000 + size - 1, region_c000); + } + + if (region_d000 != NULL) + { + UINT32 size = image.get_software_region_length("d000"); + m_maincpu->space(AS_PROGRAM).install_rom(0xd000, 0xd000 + size - 1, region_d000); + } + } + + return IMAGE_INIT_PASS; +} + + +//************************************************************************** +// DRIVER INIT +//************************************************************************** + +void nascom_state::machine_reset() +{ + // Set up hd6402 pins + m_hd6402->set_input_pin(AY31015_SWE, 1); + + m_hd6402->set_input_pin(AY31015_CS, 0); + m_hd6402->set_input_pin(AY31015_NP, 1); + m_hd6402->set_input_pin(AY31015_NB1, 1); + m_hd6402->set_input_pin(AY31015_NB2, 1); + m_hd6402->set_input_pin(AY31015_EPS, 1); + m_hd6402->set_input_pin(AY31015_TSB, 1); + m_hd6402->set_input_pin(AY31015_CS, 1); +} + +DRIVER_INIT_MEMBER( nascom_state, nascom ) +{ + // install extra memory + if (m_ram->size() > 0) + { + m_maincpu->space(AS_PROGRAM).install_ram(0x1000, 0x1000 + m_ram->size() - 1, m_ram->pointer()); + } +} + +void nascom2_state::machine_reset() +{ + // base machine reset + nascom_state::machine_reset(); + + // restart address (on the real system, a12 to a15 are forced to 1 for one memory cycle) + m_maincpu->set_state_int(Z80_PC, m_lsw1->read() << 12); +} + +DRIVER_INIT_MEMBER( nascom2_state, nascom2 ) +{ + DRIVER_INIT_CALL(nascom); + + // setup nasbus + m_nasbus->set_program_space(&m_maincpu->space(AS_PROGRAM)); + m_nasbus->set_io_space(&m_maincpu->space(AS_IO)); +} + +// since we don't know for which regions we should disable ram, we just let other devices +// overwrite the region they need, and re-install our ram when they are disabled +WRITE_LINE_MEMBER( nascom2_state::ram_disable_w ) +{ + if (state) + { + // enable ram again + m_maincpu->space(AS_PROGRAM).install_ram(0x1000, 0x1000 + m_ram->size() - 1, m_ram->pointer()); + } +} + +DRIVER_INIT_MEMBER( nascom2_state, nascom2c ) +{ + // install memory + m_maincpu->space(AS_PROGRAM).install_ram(0x0000, 0x0000 + m_ram->size() - 1, m_ram->pointer()); + + // setup nasbus + m_nasbus->set_program_space(&m_maincpu->space(AS_PROGRAM)); + m_nasbus->set_io_space(&m_maincpu->space(AS_IO)); +} + +WRITE_LINE_MEMBER( nascom2_state::ram_disable_cpm_w ) +{ + if (state) + { + // enable ram again + m_maincpu->space(AS_PROGRAM).install_ram(0x0000, 0x0000 + m_ram->size() - 1, m_ram->pointer()); + } +} + + +//************************************************************************** +// VIDEO +//************************************************************************** + +static const gfx_layout nascom1_charlayout = +{ + 8, 16, + 128, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 8*8, 9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, + 8 * 16 +}; + +static GFXDECODE_START( nascom1 ) + GFXDECODE_ENTRY("gfx1", 0x0000, nascom1_charlayout, 0, 1) +GFXDECODE_END + +UINT32 nascom1_state::screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + screen_update(bitmap, cliprect, 16); + return 0; +} + +static const gfx_layout nascom2_charlayout = +{ + 8, 14, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, + 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8 }, + 8 * 16 +}; + +static GFXDECODE_START( nascom2 ) + GFXDECODE_ENTRY("gfx1", 0x0000, nascom2_charlayout, 0, 1) +GFXDECODE_END + +UINT32 nascom2_state::screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + screen_update(bitmap, cliprect, 14); + return 0; +} + +void nascom_state::screen_update(bitmap_ind16 &bitmap, const rectangle &cliprect, int char_height) +{ + for (int sx = 0; sx < 48; sx++) + { + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[0x03ca + sx], 1, 0, 0, sx * 8, 0); + } + + for (int sy = 0; sy < 15; sy++) + { + for (int sx = 0; sx < 48; sx++) + { + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[0x000a + (sy * 64) + sx], 1, 0, 0, sx * 8, (sy + 1) * char_height); + } + } +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( nascom1_mem, AS_PROGRAM, 8, nascom1_state ) + AM_RANGE(0x0000, 0x07ff) AM_ROM // MONITOR + AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x0c00, 0x0fff) AM_RAM // WRAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( nascom1_io, AS_IO, 8, nascom1_state ) + ADDRESS_MAP_GLOBAL_MASK(0x0f) + AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w) + AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w) + AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( nascom2_mem, AS_PROGRAM, 8, nascom2_state ) + AM_RANGE(0x0000, 0x07ff) AM_ROM // MONITOR + AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x0c00, 0x0fff) AM_RAM // WRAM + AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("basic", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( nascom2_io, AS_IO, 8, nascom2_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w) + AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w) + AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( nascom2c_mem, AS_PROGRAM, 8, nascom2_state ) + AM_RANGE(0xf000, 0xf7ff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0xfc00, 0xffff) AM_RAM // WRAM +ADDRESS_MAP_END + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +static INPUT_PORTS_START( nascom1 ) + PORT_START("KEY.0") + PORT_BIT(0x6f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("KEY.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("KEY.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("KEY.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("KEY.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace ClearScreen") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("New Line") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x58, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_SHIFT_2) PORT_CHAR('@') +INPUT_PORTS_END + +static INPUT_PORTS_START( nascom2 ) + PORT_INCLUDE(nascom1) + + PORT_MODIFY("KEY.6") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('[') PORT_CHAR('\\') + + PORT_MODIFY("KEY.7") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(']') PORT_CHAR('_') + + PORT_MODIFY("KEY.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back CS") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter Escape") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR(27) + + // link switch on board + PORT_START("lsw1") + PORT_DIPNAME(0x0f, 0x00, "Restart address") + PORT_DIPLOCATION("LSW1:2,3,4,5") + PORT_DIPSETTING(0x00, "0000H") + PORT_DIPSETTING(0x01, "1000H") + PORT_DIPSETTING(0x02, "2000H") + PORT_DIPSETTING(0x03, "3000H") + PORT_DIPSETTING(0x04, "4000H") + PORT_DIPSETTING(0x05, "5000H") + PORT_DIPSETTING(0x06, "6000H") + PORT_DIPSETTING(0x07, "7000H") + PORT_DIPSETTING(0x08, "8000H") + PORT_DIPSETTING(0x09, "9000H") + PORT_DIPSETTING(0x0a, "A000H") + PORT_DIPSETTING(0x0b, "B000H") + PORT_DIPSETTING(0x0c, "C000H") + PORT_DIPSETTING(0x0d, "D000H") + PORT_DIPSETTING(0x0e, "E000H") + PORT_DIPSETTING(0x0f, "F000H") +INPUT_PORTS_END + +static INPUT_PORTS_START( nascom2c ) + PORT_INCLUDE(nascom2) + + PORT_MODIFY("lsw1") + PORT_DIPNAME(0x0f, 0x0f, "Restart address") + PORT_DIPLOCATION("LSW1:2,3,4,5") + PORT_DIPSETTING(0x00, "0000H") + PORT_DIPSETTING(0x01, "1000H") + PORT_DIPSETTING(0x02, "2000H") + PORT_DIPSETTING(0x03, "3000H") + PORT_DIPSETTING(0x04, "4000H") + PORT_DIPSETTING(0x05, "5000H") + PORT_DIPSETTING(0x06, "6000H") + PORT_DIPSETTING(0x07, "7000H") + PORT_DIPSETTING(0x08, "8000H") + PORT_DIPSETTING(0x09, "9000H") + PORT_DIPSETTING(0x0a, "A000H") + PORT_DIPSETTING(0x0b, "B000H") + PORT_DIPSETTING(0x0c, "C000H") + PORT_DIPSETTING(0x0d, "D000H") + PORT_DIPSETTING(0x0e, "E000H") + PORT_DIPSETTING(0x0f, "F000H") +INPUT_PORTS_END + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static MACHINE_CONFIG_START( nascom1, nascom1_state ) + // main cpu + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 8) + MCFG_CPU_PROGRAM_MAP(nascom1_mem) + MCFG_CPU_IO_MAP(nascom1_io) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(48 * 8, 16 * 16) + MCFG_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 16 - 1) + MCFG_SCREEN_UPDATE_DRIVER(nascom1_state, screen_update_nascom) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", nascom1) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + // uart + MCFG_DEVICE_ADD( "hd6402", AY31015, 0 ) + MCFG_AY31015_TX_CLOCK(( XTAL_16MHz / 16 ) / 256) + MCFG_AY31015_RX_CLOCK(( XTAL_16MHz / 16 ) / 256) + MCFG_AY51013_READ_SI_CB(READ8(nascom_state, nascom1_hd6402_si)) + MCFG_AY51013_WRITE_SO_CB(WRITE8(nascom_state, nascom1_hd6402_so)) + + // cassette is connected to the uart + MCFG_CASSETTE_ADD("cassette") + + // pio + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_16MHz/8) + + // internal extra ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") + MCFG_RAM_EXTRA_OPTIONS("8K,16K,32K") + + // devices + MCFG_SNAPSHOT_ADD("snapshot", nascom_state, nascom1, "nas", 0.5) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( nascom2, nascom1, nascom2_state ) + MCFG_CPU_REPLACE("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(nascom2_mem) + MCFG_CPU_IO_MAP(nascom2_io) + + // video hardware + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(48 * 8, 16 * 14) + MCFG_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 14 - 1) + MCFG_SCREEN_UPDATE_DRIVER(nascom2_state, screen_update_nascom) + + MCFG_GFXDECODE_MODIFY("gfxdecode", nascom2) + + // generic sockets for ram/rom (todo: support ram here) + MCFG_GENERIC_SOCKET_ADD("socket1", generic_plain_slot, "nascom_socket") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(nascom2_state, socket1_load) + MCFG_GENERIC_SOCKET_ADD("socket2", generic_plain_slot, "nascom_socket") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(nascom2_state, socket2_load) + + MCFG_SOFTWARE_LIST_ADD("socket_list", "nascom_socket") + + // nasbus expansion bus + MCFG_NASBUS_ADD(NASBUS_TAG) + MCFG_NASBUS_RAM_DISABLE_HANDLER(WRITELINE(nascom2_state, ram_disable_w)) + MCFG_NASBUS_SLOT_ADD("nasbus1", nasbus_slot_cards, NULL) + MCFG_NASBUS_SLOT_ADD("nasbus2", nasbus_slot_cards, NULL) + MCFG_NASBUS_SLOT_ADD("nasbus3", nasbus_slot_cards, NULL) + MCFG_NASBUS_SLOT_ADD("nasbus4", nasbus_slot_cards, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( nascom2c, nascom2, nascom2_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(nascom2c_mem) + + MCFG_DEVICE_REMOVE(RAM_TAG) + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("60K") + + MCFG_DEVICE_MODIFY(NASBUS_TAG) + MCFG_NASBUS_RAM_DISABLE_HANDLER(WRITELINE(nascom2_state, ram_disable_cpm_w)) +MACHINE_CONFIG_END + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( nascom1 ) + ROM_REGION(0x0800, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "T4", "NasBug T4") + ROMX_LOAD("nasbugt4.rom", 0x0000, 0x0800, CRC(f391df68) SHA1(00218652927afc6360c57e77d6a4fd32d4e34566), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "T1", "NasBug T1") + ROMX_LOAD("nasbugt1.rom", 0x0000, 0x0400, CRC(8ea07054) SHA1(3f9a8632826003d6ea59d2418674d0fb09b83a4c), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "T2", "NasBug T2") + ROMX_LOAD("nasbugt2.rom", 0x0000, 0x0400, CRC(e371b58a) SHA1(485b20a560b587cf9bb4208ba203b12b3841689b), ROM_BIOS(3)) + + ROM_REGION(0x0800, "gfx1", 0) + ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52)) +ROM_END + +ROM_START( nascom2 ) + ROM_REGION(0x0800, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "NS3", "NasSys 3") + ROMX_LOAD("nassys3.rom", 0x0000, 0x0800, CRC(3da17373) SHA1(5fbda15765f04e4cd08cf95c8d82ce217889f240), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "NS1", "NasSys 1") + ROMX_LOAD("nassys1.rom", 0x0000, 0x0800, CRC(b6300716) SHA1(29da7d462ba3f569f70ed3ecd93b981f81c7adfa), ROM_BIOS(2)) + + ROM_REGION(0x2000, "basic", 0) + ROM_LOAD("basic.rom", 0x0000, 0x2000, CRC(5cb5197b) SHA1(c41669c2b6d6dea808741a2738426d97bccc9b07)) + + ROM_REGION(0x1000, "gfx1", 0) + ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52)) + ROM_LOAD("nasgra.chr", 0x0800, 0x0800, CRC(2bc09d32) SHA1(d384297e9b02cbcb283c020da51b3032ff62b1ae)) +ROM_END + +ROM_START( nascom2c ) + ROM_REGION(0x0800, "maincpu", 0) + ROM_LOAD("cpmboot.rom", 0x0000, 0x0800, CRC(44b67ffc) SHA1(60c8335f24798f8de7ad48a4cd03e56a60d87b63)) + + ROM_REGION(0x1000, "gfx1", 0) + ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52)) + ROM_LOAD("nasgra.chr", 0x0800, 0x0800, CRC(2bc09d32) SHA1(d384297e9b02cbcb283c020da51b3032ff62b1ae)) +ROM_END + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, nascom1, 0, 0, nascom1, nascom1, nascom_state, nascom, "Nascom Microcomputers", "Nascom 1", MACHINE_NO_SOUND_HW ) +COMP( 1979, nascom2, 0, 0, nascom2, nascom2, nascom2_state, nascom2, "Nascom Microcomputers", "Nascom 2", MACHINE_NO_SOUND_HW ) +COMP( 1980, nascom2c, nascom2, 0, nascom2c, nascom2c, nascom2_state, nascom2c, "Nascom Microcomputers", "Nascom 2 (CP/M)", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/nc.c b/src/mame/drivers/nc.c new file mode 100644 index 00000000000..7bf13f6d188 --- /dev/null +++ b/src/mame/drivers/nc.c @@ -0,0 +1,1556 @@ +// license:GPL-2.0+ +// copyright-holders:Wilbert Pol, Kevin Thacker +/****************************************************************************** + + nc.c + + NC100/NC150/NC200 Notepad computer + + system driver + + + Thankyou to: + Cliff Lawson, Russell Marks and Tim Surtel + + Documentation: + + NC100: + NC100 I/O Specification by Cliff Lawson, + NC100EM by Russell Marks + NC200: + Dissassembly of the NC200 ROM + e-mail + exchange with Russell Marks + + + NC100: + + Hardware: + - Z80 CPU, 6 MHz + - memory powered by lithium batterys! + - 2 channel tone (programmable frequency beep's) + - LCD screen + - laptop/portable computer + - qwerty keyboard + - serial/parallel connection + - Amstrad custom ASIC chip + - tc8521 real time clock + - intel 8251 compatible uart + - PCMCIA Memory cards supported, up to 1mb! + + NC200: + + Hardware: + - Z80 CPU + - Intel 8251 compatible uart + - upd765 compatible floppy disc controller + - mc146818 real time clock? + - 720k floppy disc drive (compatible with MS-DOS) + (disc drive can be not ready). + - PCMCIA Memory cards supported, up to 1mb! + + TODO: + - find out what the unused key bits are for + (checked all unused bits on nc200! - do not seem to have any use!) + - complete serial (xmodem protocol!) + - overlay would be nice! + - finish NC200 disc drive emulation (closer!) + - add NC150 driver - ROM needed!!! + - on/off control + - check values read from other ports that are not described! + - what is read from unmapped ports? + - what is read from uart when it is off? + - check if uart ints are generated when it is off? + - are ints cancelled if uart is turned off after int has been caused? + - check keyboard ints - are these regular or what?? + + PCMCIA memory cards are stored as a direct dump of the contents. There is no header + information. No distinction is made between RAM and ROM cards. + + Memory card sizes are a power of 2 in size (e.g. 1mb, 512k, 256k etc), + however the code allows any size, but it limits access to power of 2 sizes, with + minimum access being 16k. If a file which is less than 16k is used, no memory card + will be present. If a file which is greater than 1mb is used, only 1mb will be accessed. + + Interrupt system of NC100: + + The IRQ mask is used to control the interrupt sources that can interrupt. + + The IRQ status can be read to determine which devices are interrupting. + Some devices, e.g. serial, cannot be cleared by writing to the irq status + register. These can only be cleared by performing an operation on the + device (e.g. reading a data register). + + Self Test: + + - requires memory save and real time clock save to be working! + (i.e. for MESS nc100 driver, nc100.nv can be created) + - turn off nc (use NMI button) + - reset+FUNCTION+SYMBOL must be pressed together. + + Note: NC200 Self test does not test disc hardware :( + + + + Kevin Thacker [MESS driver] + + ******************************************************************************/ + +#include "emu.h" +#include "emuopts.h" +#include "cpu/z80/z80.h" +#include "includes/nc.h" +#include "machine/mc146818.h" /* for NC200 real time clock */ +#include "machine/rp5c01.h" /* for NC100 real time clock */ +#include "machine/upd765.h" /* for NC200 disk drive interface */ +#include "formats/pc_dsk.h" /* for NC200 disk image */ +#include "sound/beep.h" +#include "machine/ram.h" +#include "rendlay.h" + + +#define VERBOSE 0 +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +#define NC200_DEBUG 1 +#define LOG_DEBUG(x) do { if (NC200_DEBUG) logerror x; } while (0) + + +/* the serial clock is generated by the nc hardware and connected to the i8251 +receive clock and transmit clock inputs */ + +/* + Port 0x00: + ========== + + Display memory start: + + NC100: + bit 7 A15 + bit 6 A14 + bit 5 A13 + bit 4 A12 + bits 3-0 Not Used + NC200: + bit 7 A15 + bit 6 A14 + bit 5 A13 + bits 4-0 Not Used + + Port 0x010-0x013: + ================= + + Memory management control: + + NC100 & NC200: + + 10 controls 0000-3FFF + 11 controls 4000-7FFF + 12 controls 8000-BFFF + 13 controls C000-FFFF + + Port 0x030: + =========== + + NC100: + bit 7 select card register 1=common, 0=attribute + bit 6 parallel interface Strobe signal + bit 5 Not Used + bit 4 uPD4711 line driver, 1=off, 0=on + bit 3 UART clock and reset, 1=off, 0=on + + bits 2-0 set the baud rate as follows + + 000 = 150 + 001 = 300 + 010 = 600 + 011 = 1200 + 100 = 2400 + 101 = 4800 + 110 = 9600 + 111 = 19200 + NC200: + bit 7 select card register 1=common, 0=attribute + bit 6 parallel interface Strobe signal + + bit 5 used in disc interface; (set to 0) + + bit 4 uPD4711 line driver, 1=off, 0=on + bit 3 UART clock and reset, 1=off, 0=on + + bits 2-0 set the baud rate as follows + + 000 = 150 + 001 = 300 + 010 = 600 + 011 = 1200 + 100 = 2400 + 101 = 4800 + 110 = 9600 + 111 = 19200 + + + Port 0x0a0: + =========== + + NC100: + bit 7: memory card present 0 = yes, 1 = no + bit 6: memory card write protected 1 = yes, 0 = no + bit 5: input voltage = 1, if >= to 4 volts + bit 4: mem card battery: 0 = battery low + bit 3: alkaline batteries. 0 if >=3.2 volts + bit 2: lithium battery 0 if >= 2.7 volts + bit 1: parallel interface busy (0 if busy) + bit 0: parallel interface ack (1 if ack) + + NC200: + + bit 7: memory card present 0 = yes, 1 = no + bit 6: memory card write protected 1 = yes, 0 = no + bit 5: lithium battery 0 if >= 2.7 volts + bit 4: input voltage = 1, if >= to 4 volts + bit 3: ?? + bit 2: alkaline batteries. 0 if >=3.2 volts + bit 1: ?? + bit 0: battery power: if 1: batteries are too low for disk usage, if 0: batteries ok for disc usage + + + Port 0x060 (IRQ MASK), Port 0x090 (IRQ STATUS): + =============================================== + + NC100: + bit 7: not used + bit 6: not used + bit 5: not used + bit 4: not used + Bit 3: Key scan interrupt (10ms) + Bit 2: ACK from parallel interface + Bit 1: Tx Ready + Bit 0: Rx Ready + + NC200: + bit 7: ??? + bit 6: RTC alarm? + bit 5: FDC interrupt + bit 4: Power off interrupt + Bit 3: Key scan interrupt (10ms) + Bit 2: serial interrupt (tx ready/rx ready combined) + Bit 1: not used + Bit 0: ACK from parallel interface + + Port 0x070: On/off control + + NC200: + bit 7: nc200 power on/off: 1 = on, 0=off + bit 2: backlight: 1=off, 0=on + bit 1: disk motor: 1=off, 0=disk motor??? + bit 0: upd765 terminal count input +*/ + + + +/* latched interrupts are interrupts that cannot be cleared by writing to the irq +mask. latched interrupts can only be cleared by accessing the interrupting +device e.g. serial chip, fdc */ +/* this is a mask of irqs that are latched, and it is different for nc100 and +nc200 */ + +void nc_state::nc_update_interrupts() +{ + m_irq_status &= ~m_irq_latch_mask; + m_irq_status |= m_irq_latch; + + /* any ints set and they are not masked? */ + if ( + (((m_irq_status & m_irq_mask) & 0x3f)!=0) + ) + { + logerror("int set %02x\n", m_irq_status & m_irq_mask); + /* set int */ + m_maincpu->set_input_line(0, HOLD_LINE); + } + else + { + /* clear int */ + m_maincpu->set_input_line(0, CLEAR_LINE); + } +} + +TIMER_CALLBACK_MEMBER(nc_state::nc_keyboard_timer_callback) +{ + LOG(("keyboard int\n")); + + /* set int */ + m_irq_status |= (1<<3); + + /* update ints */ + nc_update_interrupts(); + + /* don't trigger again, but don't free it */ + m_keyboard_timer->reset(); +} + + +static const char *const nc_bankhandler_r[]={ +"bank1", "bank2", "bank3", "bank4"}; + +static const char *const nc_bankhandler_w[]={ +"bank5", "bank6", "bank7", "bank8"}; + +void nc_state::nc_refresh_memory_bank_config(int bank) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *ptr; + int mem_type; + int mem_bank; + char bank1[10]; + char bank5[10]; + sprintf(bank1,"bank%d",bank+1); + sprintf(bank5,"bank%d",bank+5); + + mem_type = (m_memory_config[bank]>>6) & 0x03; + mem_bank = m_memory_config[bank] & 0x03f; + + space.install_read_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_r[bank]); + + switch (mem_type) + { + /* ROM */ + case 3: + case 0: + { + mem_bank &= m_membank_rom_mask; + ptr = (memregion("maincpu")->base() + 0x010000) + (mem_bank << 14); + + membank(bank1)->set_base(ptr); + + space.nop_write((bank * 0x4000), (bank * 0x4000) + 0x3fff); + LOG(("BANK %d: ROM %d\n",bank,mem_bank)); + } + break; + + /* internal RAM */ + case 1: + { + mem_bank &= m_membank_internal_ram_mask; + ptr = m_ram->pointer() + (mem_bank << 14); + + membank(bank1)->set_base(ptr); + membank(bank5)->set_base(ptr); + + space.install_write_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_w[bank]); + LOG(("BANK %d: RAM\n",bank)); + } + break; + + /* card RAM */ + case 2: + { + /* card connected? */ + if (m_card_status && m_card_ram) + { + mem_bank &= m_membank_card_ram_mask; + ptr = m_card_ram->base() + (mem_bank << 14); + + membank(bank1)->set_base(ptr); + + /* write enabled? */ + if (ioport("EXTRA")->read() & 0x02) + { + /* yes */ + membank(bank5)->set_base(ptr); + space.install_write_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_w[bank]); + } + else + { + /* no */ + space.nop_write((bank * 0x4000), (bank * 0x4000) + 0x3fff); + } + + LOG(("BANK %d: CARD-RAM\n",bank)); + } + else + { + /* if no card connected, then writes fail */ + space.nop_readwrite((bank * 0x4000), (bank * 0x4000) + 0x3fff); + } + } + break; + } +} + +void nc_state::nc_refresh_memory_config() +{ + nc_refresh_memory_bank_config(0); + nc_refresh_memory_bank_config(1); + nc_refresh_memory_bank_config(2); + nc_refresh_memory_bank_config(3); +} + + +TIMER_DEVICE_CALLBACK_MEMBER(nc_state::dummy_timer_callback) +{ + int inputport_10_state; + int changed_bits; + + inputport_10_state = ioport("EXTRA")->read(); + + changed_bits = inputport_10_state^m_previous_inputport_10_state; + + /* on/off button changed state? */ + if (changed_bits & 0x01) + { + if (inputport_10_state & 0x01) + { + /* on NC100 on/off button causes a nmi, on + nc200 on/off button causes an int */ + switch (m_type) + { + case NC_TYPE_1xx: + { + LOG(("nmi triggered\n")); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } + break; + + case NC_TYPE_200: + { + m_irq_status |= (1 << 4); + nc_update_interrupts(); + } + break; + } + } + } + + /* memory card write enable/disable state changed? */ + if (changed_bits & 0x02) + { + /* yes refresh memory config */ + nc_refresh_memory_config(); + } + + m_previous_inputport_10_state = inputport_10_state; +} + + + +void nc_state::nc_common_init_machine() +{ + /* setup reset state */ + m_display_memory_start = 0; + + /* setup reset state */ + m_memory_config[0] = 0; + m_memory_config[1] = 0; + m_memory_config[2] = 0; + m_memory_config[3] = 0; + + m_previous_inputport_10_state = ioport("EXTRA")->read(); + + /* setup reset state ints are masked */ + m_irq_mask = 0; + /* setup reset state no ints wanting servicing */ + m_irq_status = 0; + /* at reset set to 0x0ffff */ + + m_irq_latch = 0; + m_irq_latch_mask = 0; + + /* setup reset state */ + m_sound_channel_periods[0] = (m_sound_channel_periods[1] = 0x0ffff); + + /* at reset set to 1 */ + m_poweroff_control = 1; + + nc_refresh_memory_config(); + nc_update_interrupts(); + + /* at reset set to 0x0ff */ + m_uart_control = 0x0ff; +} + +static ADDRESS_MAP_START(nc_map, AS_PROGRAM, 8, nc_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank5") + AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank6") + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank7") + AM_RANGE(0xc000, 0xffff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank8") +ADDRESS_MAP_END + + +READ8_MEMBER(nc_state::nc_memory_management_r) +{ + return m_memory_config[offset]; +} + +WRITE8_MEMBER(nc_state::nc_memory_management_w) +{ + LOG(("Memory management W: %02x %02x\n",offset,data)); + m_memory_config[offset] = data; + + nc_refresh_memory_config(); +} + +WRITE8_MEMBER(nc_state::nc_irq_mask_w) +{ + LOG(("irq mask w: %02x\n", data)); + LOG_DEBUG(("irq mask nc200 w: %02x\n",data & ((1<<4) | (1<<5) | (1<<6) | (1<<7)))); + + /* writing mask clears ints that are to be masked? */ + m_irq_mask = data; + + nc_update_interrupts(); +} + +WRITE8_MEMBER(nc_state::nc_irq_status_w) +{ + LOG(("irq status w: %02x\n", data)); + data = data^0x0ff; + + if (m_type == NC_TYPE_200) + { + /* Russell Marks confirms that on the NC200, the key scan interrupt must be explicitly + cleared. It is not automatically cleared when reading 0x0b9 */ + if ((data & (1<<3))!=0) + { + /* set timer to occur again */ + m_keyboard_timer->reset(attotime::from_msec(10)); + + nc_update_interrupts(); + } + } + + +/* writing to status will clear int, will this re-start the key-scan? */ +#if 0 + if ( + /* clearing keyboard int? */ + ((data & (1<<3))!=0) && + /* keyboard int request? */ + ((m_irq_status & (1<<3))!=0) + ) + { + /* set timer to occur again */ + m_keyboard_timer->reset(attotime::from_msec(10)); + } +#endif + m_irq_status &=~data; + + nc_update_interrupts(); +} + +READ8_MEMBER(nc_state::nc_irq_status_r) +{ + return ~((m_irq_status & (~m_irq_latch_mask)) | m_irq_latch); +} + + +READ8_MEMBER(nc_state::nc_key_data_in_r) +{ + static const char *const keynames[] = { + "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", + "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" + }; + + if (offset==9) + { + /* reading 0x0b9 will clear int and re-start scan procedure! */ + m_irq_status &= ~(1<<3); + + /* set timer to occur again */ + m_keyboard_timer->reset(attotime::from_msec(10)); + + nc_update_interrupts(); + } + + return ioport(keynames[offset])->read(); +} + + +void nc_state::nc_sound_update(int channel) +{ + int on; + int frequency; + int period; + beep_device *beeper_device = NULL; + + switch(channel) + { + case 0: + beeper_device = m_beeper1; + break; + case 1: + beeper_device = m_beeper2; + break; + } + + period = m_sound_channel_periods[channel]; + + /* if top bit is 0, sound is on */ + on = ((period & (1<<15))==0); + + /* calculate frequency from period */ + frequency = (int)(1000000.0f/((float)((period & 0x07fff)<<1) * 1.6276f)); + + /* set state */ + beeper_device->set_state(on); + /* set frequency */ + beeper_device->set_frequency(frequency); +} + +WRITE8_MEMBER(nc_state::nc_sound_w) +{ + LOG(("sound w: %04x %02x\n", offset, data)); + + switch (offset) + { + case 0x0: + { + /* update period value */ + m_sound_channel_periods[0] = + (m_sound_channel_periods[0] & 0x0ff00) | (data & 0x0ff); + + nc_sound_update(0); + } + break; + + case 0x01: + { + m_sound_channel_periods[0] = + (m_sound_channel_periods[0] & 0x0ff) | ((data & 0x0ff)<<8); + + nc_sound_update(0); + } + break; + + case 0x02: + { + /* update period value */ + m_sound_channel_periods[1] = + (m_sound_channel_periods[1] & 0x0ff00) | (data & 0x0ff); + + nc_sound_update(1); + } + break; + + case 0x03: + { + m_sound_channel_periods[1] = + (m_sound_channel_periods[1] & 0x0ff) | ((data & 0x0ff)<<8); + + nc_sound_update(1); + } + break; + + default: + break; + } +} + +static const int baud_rate_table[]= +{ + 128, //150 + 64, //300 + 32, //600 + 16, //1200 + 8, //2400 + 4, //4800 + 2, //9600 + 1, //19200 +}; + +WRITE_LINE_MEMBER(nc_state::write_uart_clock) +{ + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + +WRITE8_MEMBER(nc_state::nc_uart_control_w) +{ + /* same for nc100 and nc200 */ + m_centronics->write_strobe(BIT(data, 6)); + + /* on/off changed state? */ + if (((m_uart_control ^ data) & (1<<3))!=0) + { + /* changed uart from off to on */ + if ((data & (1<<3))==0) + { + machine().device("uart")->reset(); + } + } + + m_uart_clock->set_clock_scale((double)1 / baud_rate_table[(data & 0x07)]); + + m_uart_control = data; +} + +/* NC100 printer emulation */ +/* port 0x040 (write only) = 8-bit printer data */ +/* port 0x030 bit 6 = printer strobe */ + + + +/********************************************************************************************************/ +/* NC100 hardware */ + + + +WRITE8_MEMBER(nc_state::nc100_display_memory_start_w) +{ + /* bit 7: A15 */ + /* bit 6: A14 */ + /* bit 5: A13 */ + /* bit 4: A12 */ + /* bit 3-0: not used */ + m_display_memory_start = (data & 0x0f0)<<(12-4); + + LOG(("disp memory w: %04x\n", (int) m_display_memory_start)); +} + + +WRITE8_MEMBER(nc_state::nc100_uart_control_w) +{ + nc_uart_control_w(space, offset,data); + +// /* is this correct?? */ +// if (data & (1<<3)) +// { +// /* clear latched irq's */ +// m_irq_latch &= ~3; +// nc_update_interrupts(machine); +// } +} + + +WRITE_LINE_MEMBER(nc_state::nc100_tc8521_alarm_callback) +{ + // TODO +} + +WRITE_LINE_MEMBER(nc_state::nc100_txrdy_callback) +{ + m_irq_latch &= ~(1 << 1); + + /* uart on? */ + if ((m_uart_control & (1 << 3)) == 0) + { + if (state) + { + logerror("tx ready\n"); + m_irq_latch |= (1 << 1); + } + } + + nc_update_interrupts(); +} + +WRITE_LINE_MEMBER(nc_state::nc100_rxrdy_callback) +{ + m_irq_latch &= ~(1<<0); + + if ((m_uart_control & (1<<3))==0) + { + if (state) + { + logerror("rx ready\n"); + m_irq_latch |= (1<<0); + } + } + + nc_update_interrupts(); +} + +WRITE_LINE_MEMBER(nc_state::write_nc100_centronics_ack) +{ + m_centronics_ack = state; + + if (state) + m_irq_status |= 0x04; + else + m_irq_status &= ~0x04; + + /* trigger an int if the irq is set */ + nc_update_interrupts(); +} + +WRITE_LINE_MEMBER(nc_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +void nc_state::machine_reset() +{ + /* 256k of rom */ + m_membank_rom_mask = 0x0f; + + m_membank_internal_ram_mask = 3; + + m_membank_card_ram_mask = 0x03f; + + nc_common_init_machine(); + + /* serial */ + m_irq_latch_mask = (1<<0) | (1<<1); +} + +void nc_state::machine_start() +{ + m_type = NC_TYPE_1xx; + + std::string region_tag; + m_card_ram = memregion(region_tag.assign(m_card->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + if (m_card_ram) + m_card_size = m_card_ram->bytes(); + else + m_card_size = 0; + + /* keyboard timer */ + m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this)); + m_keyboard_timer->adjust(attotime::from_msec(10)); + + m_nvram->set_base(m_ram->pointer(), m_ram->size()); +} + + +WRITE8_MEMBER(nc_state::nc100_poweroff_control_w) +{ + /* bits 7-1: not used */ + /* bit 0: 1 = no effect, 0 = power off */ + m_poweroff_control = data; + LOG(("nc poweroff control: %02x\n",data)); +} + + +/* nc100 version of card/battery status */ +READ8_MEMBER(nc_state::nc100_card_battery_status_r) +{ + int nc_card_battery_status = 0x0fc; + + /* printer */ + nc_card_battery_status |= m_centronics_ack; + nc_card_battery_status |= m_centronics_busy << 1; + + if (m_card_status) + { + /* card present */ + nc_card_battery_status &=~(1<<7); + } + + if (ioport("EXTRA")->read() & 0x02) + { + /* card write enable */ + nc_card_battery_status &=~(1<<6); + } + + /* enough power - see bit assignments where + nc card battery status is defined */ + nc_card_battery_status |= (1<<5); + nc_card_battery_status &= ~((1<<2) | (1<<3)); + + return nc_card_battery_status; +} + +WRITE8_MEMBER(nc_state::nc100_memory_card_wait_state_w) +{ + LOG(("nc100 memory card wait state: %02x\n",data)); +} + + + +static ADDRESS_MAP_START(nc100_io, AS_IO, 8, nc_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x0f) AM_WRITE(nc100_display_memory_start_w) + AM_RANGE(0x10, 0x13) AM_READWRITE(nc_memory_management_r, nc_memory_management_w) + AM_RANGE(0x20, 0x20) AM_WRITE(nc100_memory_card_wait_state_w) + AM_RANGE(0x30, 0x30) AM_WRITE(nc100_uart_control_w) + AM_RANGE(0x40, 0x40) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x50, 0x53) AM_WRITE(nc_sound_w) + AM_RANGE(0x60, 0x60) AM_WRITE(nc_irq_mask_w) + AM_RANGE(0x70, 0x70) AM_WRITE(nc100_poweroff_control_w) + AM_RANGE(0x90, 0x90) AM_READWRITE(nc_irq_status_r, nc_irq_status_w) + AM_RANGE(0x91, 0x9f) AM_READ(nc_irq_status_r) + AM_RANGE(0xa0, 0xaf) AM_READ(nc100_card_battery_status_r) + AM_RANGE(0xb0, 0xb9) AM_READ(nc_key_data_in_r) + AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) + AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0xd0, 0xdf) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) +ADDRESS_MAP_END + + +/* 2008-05 FP: +Small note about natural keyboard support (both for nc100 and nc200): currently, +- "Shift" (both L & R) and "Caps Lock" do not work in natural mode (to be investigated) +- "Function" is mapped to 'Left Control' +- "Control" is mapped to 'Right Control' +- "Caps Lock" is mapped to 'Right Alt' +- "On" is mapped to 'F1' +- "Stop" is mapped to 'F2' +- "Symbol" is mapped to 'F3' +- "Menu" is mapped to 'F4' +*/ + +static INPUT_PORTS_START(nc100) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT(0x04, 0x00, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Left (Red)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, 0x00, IPT_UNUSED) + PORT_BIT(0x80, 0x00, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Function (Yellow)") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 5th row, 1st key on left (where 'fn' is on mac keyboards) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10, 0x00, IPT_UNUSED) + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, 0x00, IPT_UNUSED) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Symbol") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F3)) // 5th row, 3rd key (where 'Alt' usually stays) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x10, 0x00, IPT_UNUSED) + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, 0x00, IPT_UNUSED) + PORT_BIT(0x80, 0x00, IPT_UNUSED) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, 0x00, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + + PORT_START("LINE5") + PORT_BIT(0x01, 0x00, IPT_UNUSED) + PORT_BIT(0x02, 0x00, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Down (Blue)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del>") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Right (Green)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('~') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('@') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del<") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('8') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + /* these are not part of the nc100 keyboard */ + /* extra */ + PORT_START("EXTRA") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("On Button") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F1)) + /* pcmcia memory card setting */ + PORT_DIPNAME( 0x02, 0x002, "PCMCIA Memory card write enable") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) +INPUT_PORTS_END + +/**********************************************************************************************************/ +/* NC150 hardware */ +/* to be completed! */ + +#if 0 +void nc_state::nc150_init_machine() +{ + m_membank_internal_ram_mask = 7; + + m_membank_card_ram_mask = 0x03f; + + nc_common_init_machine(machine); +} +#endif + + + +/**********************************************************************************************************/ +/* NC200 hardware */ + +#ifdef UNUSED_FUNCTION +WRITE8_MEMBER(nc_state::nc200_display_memory_start_w) +{ + /* bit 7: A15 */ + /* bit 6: A14 */ + /* bit 5: A13 */ + /* bit 4-0: not used */ + m_display_memory_start = (data & 0x0e0)<<(12-4); + + LOG(("disp memory w: %04x\n", (int) m_display_memory_start)); +} +#endif + + +WRITE_LINE_MEMBER(nc_state::write_nc200_centronics_ack) +{ + if (state) + m_irq_status |= 0x01; + else + m_irq_status &= ~0x01; + + /* trigger an int if the irq is set */ + nc_update_interrupts(); +} + +/* assumption. nc200 uses the same uart chip. The rxrdy and txrdy are combined +together with a or to generate a single interrupt */ + +void nc_state::nc200_refresh_uart_interrupt() +{ + m_irq_latch &=~(1<<2); + + /* uart enabled? */ + if ((m_uart_control & (1<<3))==0) + { + if ((m_nc200_uart_interrupt_irq & 0x03)!=0) + { + m_irq_latch |= (1<<2); + } + } + nc_update_interrupts(); +} + +WRITE_LINE_MEMBER(nc_state::nc200_txrdy_callback) +{ +// m_nc200_uart_interrupt_irq &=~(1<<0); +// +// if (state) +// { +// m_nc200_uart_interrupt_irq |=(1<<0); +// } +// +// nc200_refresh_uart_interrupt(); +} + +WRITE_LINE_MEMBER(nc_state::nc200_rxrdy_callback) +{ + m_nc200_uart_interrupt_irq &=~(1<<1); + + if (state) + { + m_nc200_uart_interrupt_irq |=(1<<1); + } + + nc200_refresh_uart_interrupt(); +} + +WRITE_LINE_MEMBER( nc_state::nc200_fdc_interrupt ) +{ +#if 0 + m_irq_latch &=~(1<<5); + + if (state) + { + m_irq_latch |=(1<<5); + } +#endif + m_irq_status &=~(1<<5); + + if (state) + { + m_irq_status |=(1<<5); + } + + nc_update_interrupts(); +} + +#ifdef UNUSED_FUNCTION +void nc_state::nc200_floppy_drive_index_callback(int drive_id) +{ + LOG_DEBUG(("nc200 index pulse\n")); +// m_irq_status |= (1<<4); + +// nc_update_interrupts(Machine); +} +#endif + +MACHINE_RESET_MEMBER(nc_state, nc200) +{ + /* 512k of rom */ + m_membank_rom_mask = 0x1f; + + m_membank_internal_ram_mask = 7; + + m_membank_card_ram_mask = 0x03f; + + nc_common_init_machine(); + + m_nc200_uart_interrupt_irq = 0; + + /* fdc, serial */ + m_irq_latch_mask = /*(1<<5) |*/ (1<<2); + + nc200_video_set_backlight(0); +} + +MACHINE_START_MEMBER(nc_state, nc200) +{ + m_type = NC_TYPE_200; + + std::string region_tag; + m_card_ram = memregion(region_tag.assign(m_card->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + if (m_card_ram) + m_card_size = m_card_ram->bytes(); + else + m_card_size = 0; + + /* keyboard timer */ + m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this)); + m_keyboard_timer->adjust(attotime::from_msec(10)); + + m_nvram->set_base(m_ram->pointer(), m_ram->size()); +} + +/* +NC200: + + bit 7: memory card present 0 = yes, 1 = no + bit 6: memory card write protected 1=yes 0=no + bit 5: lithium battery 0 if >= 2.7 volts + bit 4: input voltage = 1, if >= to 4 volts + bit 3: ?? + bit 2: alkaline batteries. 0 if >=3.2 volts + bit 1: ?? + bit 0: battery power: if 1: batteries are too low for disk usage, if 0: batteries ok for disc usage +*/ + + +/* nc200 version of card/battery status */ +READ8_MEMBER(nc_state::nc200_card_battery_status_r) +{ + int nc_card_battery_status = 0x0ff; + + /* enough power */ + + /* input voltage ok */ + nc_card_battery_status |=(1<<4); + /* lithium batteries and alkaline batteries have enough power, + and there is enough power for disk usage */ + nc_card_battery_status &=~((1<<5) | (1<<2) | (1<<0)); + + if (m_card_status) + { + /* card present */ + nc_card_battery_status&=~(1<<7); + } + + if (ioport("EXTRA")->read() & 0x02) + { + /* card write enable */ + nc_card_battery_status &=~(1<<6); + } + + return nc_card_battery_status; +} + + +/* port &80: + + bit 0: Parallel interface BUSY + */ + +READ8_MEMBER(nc_state::nc200_printer_status_r) +{ + UINT8 result = 0; + + result |= m_centronics_busy; + + return result; +} + + +WRITE8_MEMBER(nc_state::nc200_uart_control_w) +{ + /* int reset_fdc = (m_uart_control^data) & (1<<5); */ + + nc_uart_control_w(space, offset,data); + + if (data & (1<<3)) + { + m_nc200_uart_interrupt_irq &=~3; + + nc200_refresh_uart_interrupt(); + } + + /* bit 5 is used in disk interface */ + LOG_DEBUG(("bit 5: PC: %04x %02x\n", m_maincpu->pc(), data & (1 << 5))); +} + + +/* bit 7: same as nc100 */ +/* bit 2: ?? */ +/* bit 1: ?? */ +/* %10000110 = 0x086 */ +/* %10000010 = 0x082 */ +/* %10000011 = 0x083 */ +/* writes 86,82 */ + +/* bit 7: nc200 power control: 1=on, 0=off */ +/* bit 1: disk motor?? */ +/* bit 0: UPD765 Terminal Count input */ + +WRITE8_MEMBER(nc_state::nc200_memory_card_wait_state_w) +{ + upd765a_device *fdc = machine().device("upd765"); + LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n", m_maincpu->pc(), data)); +#if 0 + floppy_drive_set_motor_state(0, 1); + floppy_drive_set_ready_state(0, 1, 1); +#endif + fdc->tc_w(data & 0x01); +} + +/* bit 2: backlight: 1=off, 0=on */ +/* bit 1 cleared to zero in disk code */ +/* bit 0 seems to be the same as nc100 */ +WRITE8_MEMBER(nc_state::nc200_poweroff_control_w) +{ + LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", m_maincpu->pc(), data)); + + nc200_video_set_backlight(((data ^ (1 << 2)) >> 2) & 0x01); +} + +static ADDRESS_MAP_START(nc200_io, AS_IO, 8, nc_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x0f) AM_WRITE(nc100_display_memory_start_w) + AM_RANGE(0x10, 0x13) AM_READWRITE(nc_memory_management_r, nc_memory_management_w) + AM_RANGE(0x20, 0x20) AM_WRITE(nc200_memory_card_wait_state_w) + AM_RANGE(0x30, 0x30) AM_WRITE(nc200_uart_control_w) + AM_RANGE(0x40, 0x40) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x50, 0x53) AM_WRITE(nc_sound_w) + AM_RANGE(0x60, 0x60) AM_WRITE(nc_irq_mask_w) + AM_RANGE(0x70, 0x70) AM_WRITE(nc200_poweroff_control_w) + AM_RANGE(0x80, 0x80) AM_READ(nc200_printer_status_r) + AM_RANGE(0x90, 0x90) AM_READWRITE(nc_irq_status_r, nc_irq_status_w) + AM_RANGE(0xa0, 0xa0) AM_READ(nc200_card_battery_status_r) + AM_RANGE(0xb0, 0xb9) AM_READ(nc_key_data_in_r) + AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) + AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0xd0, 0xd1) AM_DEVREADWRITE("mc", mc146818_device, read, write) + AM_RANGE(0xe0, 0xe1) AM_DEVICE("upd765", upd765a_device, map) +ADDRESS_MAP_END + +static INPUT_PORTS_START(nc200) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Left (Red)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, 0x00, IPT_UNUSED) + PORT_BIT(0x80, 0x00, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Function (Yellow)") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 5th row, 1st key on left (where 'fn' is on mac keyboards) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10, 0x00, IPT_UNUSED) + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, 0x00, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Symbol") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F3)) // 5th row, 3rd key (where 'Alt' usually stays) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x80, 0x00, IPT_UNUSED) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x20, 0x00, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + + PORT_START("LINE5") + PORT_BIT(0x01, 0x00, IPT_UNUSED) + PORT_BIT(0x02, 0x00, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("LINE6") + PORT_BIT(0x01, 0x00, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Down (Blue)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del>") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Right (Green)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('~') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("LINE7") + PORT_BIT(0x01, 0x00, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Up (White)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("LINE8") + PORT_BIT(0x01, 0x00, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('@') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("LINE9") + PORT_BIT(0x01, 0x00, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del<") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('8') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + /* not part of the nc200 keyboard */ + PORT_START("EXTRA") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("On Button") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F1)) + /* pcmcia memory card setting */ + PORT_DIPNAME( 0x02, 0x002, "PCMCIA Memory card write enable") + PORT_DIPSETTING( 0x00, DEF_STR( Off) ) + PORT_DIPSETTING( 0x02, DEF_STR( On) ) +INPUT_PORTS_END + +/**********************************************************************************************************/ + +static MACHINE_CONFIG_START( nc100, nc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, /*6000000*/ 4606000) /* Russell Marks says this is more accurate */ + MCFG_CPU_PROGRAM_MAP(nc_map) + MCFG_CPU_IO_MAP(nc100_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(480, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 64-1) + MCFG_SCREEN_UPDATE_DRIVER(nc_state, screen_update_nc) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", NC_NUM_COLOURS) + MCFG_PALETTE_INIT_OWNER(nc_state, nc) + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beep.1", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("beep.2", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(nc_state, write_nc100_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(nc_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* uart */ + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(nc_state,nc100_rxrdy_callback)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(nc_state,nc100_txrdy_callback)) + + MCFG_DEVICE_ADD("uart_clock", CLOCK, 19200) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(nc_state, write_uart_clock)) + + /* rtc */ + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) + MCFG_RP5C01_OUT_ALARM_CB(WRITELINE(nc_state, nc100_tc8521_alarm_callback)) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_plain_slot, NULL) + MCFG_GENERIC_LOAD(nc_state, nc_pcmcia_card) + MCFG_GENERIC_UNLOAD(nc_state, nc_pcmcia_card) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_NVRAM_ADD_NO_FILL("nvram") + + /* dummy timer */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("dummy_timer", nc_state, dummy_timer_callback, attotime::from_hz(50)) +MACHINE_CONFIG_END + +static const floppy_format_type ibmpc_floppy_formats[] = { + FLOPPY_PC_FORMAT, + FLOPPY_MFI_FORMAT, + NULL +}; + +static SLOT_INTERFACE_START( ibmpc_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_DERIVED( nc200, nc100 ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_IO_MAP(nc200_io) + + MCFG_MACHINE_START_OVERRIDE(nc_state, nc200) + MCFG_MACHINE_RESET_OVERRIDE(nc_state, nc200) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(NC200_SCREEN_WIDTH, NC200_SCREEN_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, NC200_SCREEN_WIDTH-1, 0, NC200_SCREEN_HEIGHT-1) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(NC200_NUM_COLOURS) + MCFG_PALETTE_INIT_OWNER(nc_state, nc) + + /* printer */ + MCFG_DEVICE_MODIFY("centronics") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(nc_state, write_nc200_centronics_ack)) + + /* uart */ + MCFG_DEVICE_MODIFY("uart") + MCFG_I8251_RXRDY_HANDLER(WRITELINE(nc_state,nc200_rxrdy_callback)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(nc_state,nc200_txrdy_callback)) + + /* no rtc */ + MCFG_DEVICE_REMOVE("rtc") + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(nc_state, nc200_fdc_interrupt)) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", ibmpc_floppies, "525dd", ibmpc_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", ibmpc_floppies, "525dd", ibmpc_floppy_formats) + + MCFG_MC146818_ADD( "mc", XTAL_4_194304Mhz ) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(nc100) + ROM_REGION(((64*1024)+(256*1024)), "maincpu",0) + ROM_SYSTEM_BIOS(0, "106", "ROM v1.06") + ROMX_LOAD("nc100a.rom", 0x010000, 0x040000, CRC(849884f9) SHA1(ff030dd334ca867d620ee4a94b142ef0d93b69b6), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "102dk", "ROM v1.02 Danish") + ROMX_LOAD("nc100_dk_a1.rom", 0x010000, 0x040000, CRC(ebb54923) SHA1(30321011384c5e10204b9a837430c36fc63580d2), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "102de", "ROM v1.02 German") + ROMX_LOAD("nc100_de_a1.rom", 0x010000, 0x040000, CRC(bd9ce223) SHA1(2efb26911832bf1456d76d2508e24c0733dc216d), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "100", "ROM v1.00") + ROMX_LOAD("nc100.rom", 0x010000, 0x040000, CRC(a699eca3) SHA1(ce217d5a298b959ccc3d7bc5c93b1dba043f1339), ROM_BIOS(4)) +ROM_END + + +ROM_START(dw225) + ROM_REGION(((64*1024)+(512*1024)), "maincpu",0) + ROM_LOAD("dr (1.06).ic303", 0x010000, 0x080000, CRC(fcf2f7bd) SHA1(a69951618b24e97154cb4284d215cbf4aa9fb34f)) +ROM_END + + +ROM_START(nc150) + ROM_REGION(((64*1024)+(512*1024)), "maincpu",0) + ROM_SYSTEM_BIOS(0, "b2", "French B2") + ROMX_LOAD("nc150_fr_b2.rom", 0x010000, 0x080000, CRC(be442d14) SHA1(f141d409dc72dc1e6662c21a147231c4df3be6b8), ROM_BIOS(1)) /* French */ + ROM_SYSTEM_BIOS(1, "b1", "Italian B1") + ROMX_LOAD("nc150_it_b1.rom", 0x010000, 0x080000, CRC(1b2fe2fd) SHA1(67eb6bce0b0d4668401d9c8f5a900dc6bd135c21), ROM_BIOS(2)) /* Italian */ +ROM_END + + +ROM_START(nc200) + ROM_REGION(((64*1024)+(512*1024)), "maincpu",0) + ROM_LOAD("nc200.rom", 0x010000, 0x080000, CRC(bb8180e7) SHA1(fb5c93b0a3e199202c6a12548d2617f7a09bae47)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1992, nc100, 0, 0, nc100, nc100, nc_state, nc, "Amstrad plc", "NC100", 0 ) +COMP( 1992, dw225, nc100, 0, nc100, nc100, nc_state, nc, "NTS Computer Systems", "DreamWriter 225", 0 ) +COMP( 1992, nc150, nc100, 0, nc100, nc100, nc_state, nc, "Amstrad plc", "NC150", 0 ) +COMP( 1993, nc200, 0, 0, nc200, nc200, nc_state, nc, "Amstrad plc", "NC200", MACHINE_NOT_WORKING ) // boot hangs while checking the MC146818 UIP (update in progress) bit diff --git a/src/mame/drivers/nes.c b/src/mame/drivers/nes.c new file mode 100644 index 00000000000..124749f07b0 --- /dev/null +++ b/src/mame/drivers/nes.c @@ -0,0 +1,347 @@ +// license:BSD-3-Clause +// copyright-holders:Brad Oliver,Fabio Priuli +/*************************************************************************** + + nes.c + + Driver file to handle emulation of the Nintendo Entertainment System (Famicom). + + MESS driver by Brad Oliver (bradman@pobox.com), NES sound code by Matt Conte. + Based in part on the old xNes code, by Nicolas Hamel, Chuck Mason, Brad Oliver, + Richard Bannister and Jeff Mitchell. + +***************************************************************************/ + +#include "emu.h" +#include "includes/nes.h" +#include "cpu/m6502/n2a03.h" + +READ8_MEMBER(nes_state::psg_4015_r) +{ + return m_sound->read(space, 0x15); +} + +WRITE8_MEMBER(nes_state::psg_4015_w) +{ + m_sound->write(space, 0x15, data); +} + +WRITE8_MEMBER(nes_state::psg_4017_w) +{ + m_sound->write(space, 0x17, data); +} + +WRITE8_MEMBER(nes_state::nes_vh_sprite_dma_w) +{ + m_ppu->spriteram_dma(space, data); +} + +static ADDRESS_MAP_START( nes_map, AS_PROGRAM, 8, nes_state ) + AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) /* RAM */ + AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write) /* PPU registers */ + AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nessound", nesapu_device, read, write) /* PSG primary registers */ + AM_RANGE(0x4014, 0x4014) AM_WRITE(nes_vh_sprite_dma_w) /* stupid address space hole */ + AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */ + AM_RANGE(0x4016, 0x4016) AM_READWRITE(nes_in0_r, nes_in0_w) /* IN0 - input port 1 */ + AM_RANGE(0x4017, 0x4017) AM_READ(nes_in1_r) /* IN1 - input port 2 */ + AM_RANGE(0x4017, 0x4017) AM_WRITE(psg_4017_w) /* PSG second control register */ + // 0x4100-0x5fff -> LOW HANDLER defined on a pcb base + // 0x6000-0x7fff -> MID HANDLER defined on a pcb base + // 0x8000-0xffff -> HIGH HANDLER defined on a pcb base +ADDRESS_MAP_END + +static INPUT_PORTS_START( nes ) + // input devices go through slot options + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x00, "Draw Top/Bottom 8 Lines") + PORT_CONFSETTING( 0x01, DEF_STR(No) ) + PORT_CONFSETTING( 0x00, DEF_STR(Yes) ) + PORT_CONFNAME( 0x02, 0x00, "Enforce 8 Sprites/line") + PORT_CONFSETTING( 0x02, DEF_STR(No) ) + PORT_CONFSETTING( 0x00, DEF_STR(Yes) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( famicom ) + // input devices go through slot options + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x00, "Draw Top/Bottom 8 Lines") + PORT_CONFSETTING( 0x01, DEF_STR(No) ) + PORT_CONFSETTING( 0x00, DEF_STR(Yes) ) + PORT_CONFNAME( 0x02, 0x00, "Enforce 8 Sprites/line") + PORT_CONFSETTING( 0x02, DEF_STR(No) ) + PORT_CONFSETTING( 0x00, DEF_STR(Yes) ) + + PORT_START("FLIPDISK") /* fake key */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Change Disk Side") PORT_CODE(KEYCODE_SPACE) +INPUT_PORTS_END + + +void nes_state::ppu_nmi(int *ppu_regs) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + + +static MACHINE_CONFIG_START( nes, nes_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", N2A03, NTSC_CLOCK) + MCFG_CPU_PROGRAM_MAP(nes_map) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60.098) + // This isn't used so much to calulate the vblank duration (the PPU code tracks that manually) but to determine + // the number of cycles in each scanline for the PPU scanline timer. Since the PPU has 20 vblank scanlines + 2 + // non-rendering scanlines, we compensate. This ends up being 2500 cycles for the non-rendering portion, 2273 + // cycles for the actual vblank period. + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((113.66/(NTSC_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_NTSC-PPU_VBLANK_FIRST_SCANLINE+1+2))) + MCFG_SCREEN_SIZE(32*8, 262) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) + MCFG_SCREEN_UPDATE_DRIVER(nes_state, screen_update_nes) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 4*16*8) + MCFG_PALETTE_INIT_OWNER(nes_state, nes) + + MCFG_PPU2C02_ADD("ppu") + MCFG_PPU2C0X_CPU("maincpu") + MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("nessound", NES_APU, NTSC_CLOCK) + MCFG_NES_APU_CPU("maincpu") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) + + MCFG_NES_CONTROL_PORT_ADD("ctrl1", nes_control_port1_devices, "joypad") + MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel) + MCFG_NES_CONTROL_PORT_ADD("ctrl2", nes_control_port2_devices, "joypad") + MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel) + + MCFG_NES_CARTRIDGE_ADD("nes_slot", nes_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list", "nes") + MCFG_SOFTWARE_LIST_ADD("ade_list", "nes_ade") // Camerica/Codemasters Aladdin Deck Enhancer mini-carts + MCFG_SOFTWARE_LIST_ADD("ntb_list", "nes_ntbrom") // Sunsoft Nantettate! Baseball mini-carts + MCFG_SOFTWARE_LIST_ADD("kstudio_list", "nes_kstudio") // Bandai Karaoke Studio expansion carts + MCFG_SOFTWARE_LIST_ADD("datach_list", "nes_datach") // Bandai Datach Joint ROM System mini-carts +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nespal, nes ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(PAL_CLOCK) + + MCFG_DEVICE_REMOVE("ppu") + MCFG_PPU2C07_ADD("ppu") + MCFG_PPU2C0X_CPU("maincpu") + MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(53.355) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((106.53/(PAL_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE+1+2))) + MCFG_SCREEN_SIZE(32*8, 312) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) + + /* sound hardware */ + MCFG_SOUND_REPLACE("nessound", NES_APU, PAL_CLOCK) + MCFG_NES_APU_CPU("maincpu") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dendy, nes ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_CLOCK( 26601712/15 ) /* 26.601712MHz / 15 == 1.77344746666... MHz */ + + MCFG_DEVICE_REMOVE("ppu") + MCFG_PPU2C07_ADD("ppu") + MCFG_PPU2C0X_CPU("maincpu") + MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(50.00697796827) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((106.53/(PAL_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE+1+2))) + + /* sound hardware */ + MCFG_SOUND_REPLACE("nessound", NES_APU, 26601712/15) /* 26.601712MHz / 15 == 1.77344746666... MHz */ + MCFG_NES_APU_CPU("maincpu") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( famicom, nes ) + MCFG_DEVICE_REMOVE("ctrl1") + MCFG_DEVICE_REMOVE("ctrl2") + MCFG_NES_CONTROL_PORT_ADD("ctrl1", fc_control_port1_devices, "joypad") + MCFG_NES_CONTROL_PORT_ADD("ctrl2", fc_control_port2_devices, "joypad") + MCFG_FC_EXPANSION_PORT_ADD("exp", fc_expansion_devices, NULL) + MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "famicom_flop") + MCFG_SOFTWARE_LIST_ADD("cass_list", "famicom_cass") +MACHINE_CONFIG_END + +void nes_state::setup_disk(nes_disksys_device *slot) +{ + if (slot) + { + address_space &space = m_maincpu->space(AS_PROGRAM); + + // Set up memory handlers + space.install_read_handler(0x4020, 0x40ff, read8_delegate(FUNC(nes_disksys_device::read_ex), (nes_disksys_device *)slot)); + space.install_write_handler(0x4020, 0x40ff, write8_delegate(FUNC(nes_disksys_device::write_ex), (nes_disksys_device *)slot)); + space.install_read_handler(0x4100, 0x5fff, read8_delegate(FUNC(device_nes_cart_interface::read_l), (device_nes_cart_interface *)slot)); + space.install_write_handler(0x4100, 0x5fff, write8_delegate(FUNC(device_nes_cart_interface::write_l), (device_nes_cart_interface *)slot)); + space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(nes_disksys_device::read_m), (nes_disksys_device *)slot)); + space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(nes_disksys_device::write_m), (nes_disksys_device *)slot)); + space.install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(nes_disksys_device::read_h), (nes_disksys_device *)slot)); + space.install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(nes_disksys_device::write_h), (nes_disksys_device *)slot)); + + slot->vram_alloc(0x2000); + slot->prgram_alloc(0x8000); + + slot->pcb_start(machine(), m_ciram, FALSE); + m_ppu->space(AS_PROGRAM).install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(device_nes_cart_interface::chr_r),(device_nes_cart_interface *)slot), write8_delegate(FUNC(device_nes_cart_interface::chr_w),(device_nes_cart_interface *)slot)); + m_ppu->space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(device_nes_cart_interface::nt_r),(device_nes_cart_interface *)slot), write8_delegate(FUNC(device_nes_cart_interface::nt_w),(device_nes_cart_interface *)slot)); + m_ppu->set_scanline_callback(ppu2c0x_scanline_delegate(FUNC(device_nes_cart_interface::scanline_irq),(device_nes_cart_interface *)slot)); + m_ppu->set_hblank_callback(ppu2c0x_hblank_delegate(FUNC(nes_disksys_device::hblank_irq),(nes_disksys_device *)slot)); + m_ppu->set_latch(ppu2c0x_latch_delegate(FUNC(device_nes_cart_interface::ppu_latch),(device_nes_cart_interface *)slot)); + } +} + + +MACHINE_START_MEMBER( nes_state, fds ) +{ + m_ciram = auto_alloc_array(machine(), UINT8, 0x800); + m_io_disksel = ioport("FLIPDISK"); + setup_disk(m_disk); + + // register saves + save_item(NAME(m_last_frame_flip)); + save_pointer(NAME(m_ciram), 0x800); +} + +MACHINE_RESET_MEMBER( nes_state, fds ) +{ + // Reset the mapper variables + m_disk->pcb_reset(); + + // the rest is the same as for nes/famicom/dendy + m_maincpu->reset(); +} + +static MACHINE_CONFIG_DERIVED( fds, famicom ) + MCFG_MACHINE_START_OVERRIDE( nes_state, fds ) + MCFG_MACHINE_RESET_OVERRIDE( nes_state, fds ) + + MCFG_DEVICE_REMOVE("nes_slot") + MCFG_DEVICE_ADD("disk", NES_DISKSYS, 0) + + MCFG_DEVICE_REMOVE("cart_list") + MCFG_DEVICE_REMOVE("cass_list") +MACHINE_CONFIG_END + + +MACHINE_START_MEMBER( nes_state, famitwin ) +{ + // start the base nes stuff + machine_start(); + + // if there is no cart inserted, setup the disk expansion instead + if (!m_cartslot->exists()) + { + setup_disk(m_disk); + + // replace the famicom disk ROM with the famicom twin one (until we modernize the floppy drive) + m_maincpu->space(AS_PROGRAM).install_read_bank(0xe000, 0xffff, "ftbios"); + membank("ftbios")->set_base(machine().root_device().memregion("maincpu")->base() + 0xe000); + } +} + +MACHINE_RESET_MEMBER( nes_state, famitwin ) +{ + // Reset the mapper variables. Will also mark the char-gen ram as dirty + m_cartslot->pcb_reset(); + // if there is no cart inserted, initialize the disk expansion instead + if (!m_cartslot->exists()) + m_disk->pcb_reset(); + + // the rest is the same as for nes/famicom/dendy + m_maincpu->reset(); +} + +static MACHINE_CONFIG_DERIVED( famitwin, famicom ) + + MCFG_MACHINE_START_OVERRIDE( nes_state, famitwin ) + MCFG_MACHINE_RESET_OVERRIDE( nes_state, famitwin ) + + MCFG_DEVICE_MODIFY("nes_slot") + MCFG_NES_CARTRIDGE_NOT_MANDATORY + + MCFG_DEVICE_ADD("disk", NES_DISKSYS, 0) +MACHINE_CONFIG_END + + + +ROM_START( nes ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + +ROM_START( nespal ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + +ROM_START( famicom ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + +#define rom_fds rom_famicom + +ROM_START( famitwin ) + ROM_REGION( 0x10000, "maincpu", 0 ) /* Main RAM */ + ROM_LOAD( "rp2c33a-02.bin", 0xe000, 0x2000, CRC(4df24a6c) SHA1(e4e41472c454f928e53eb10e0509bf7d1146ecc1) ) // "Famicom" logo instead of Nintendo logo +ROM_END + +ROM_START( m82 ) + ROM_REGION( 0x14000, "maincpu", 0 ) /* Main RAM + program banks */ + /* Banks to be mapped at 0xe000? More investigations needed... */ + ROM_LOAD( "m82_v1_0.bin", 0x10000, 0x4000, CRC(7d56840a) SHA1(cbd2d14fa073273ba58367758f40d67fd8a9106d) ) +ROM_END + +// see http://www.disgruntleddesigner.com/chrisc/drpcjr/index.html +// and http://www.disgruntleddesigner.com/chrisc/drpcjr/DrPCJrMemMap.txt +ROM_START( drpcjr ) + ROM_REGION( 0x18000, "maincpu", 0 ) /* Main RAM + program banks */ + /* 4 banks to be mapped in 0xe000-0xffff (or 8 banks to be mapped in 0xe000-0xefff & 0xf000-0xffff). + Banks selected by writing at 0x4180 */ + ROM_LOAD("drpcjr_bios.bin", 0x10000, 0x8000, CRC(c8fbef89) SHA1(2cb0a817b31400cdf27817d09bae7e69f41b062b) ) // bios vers. 1.0a + // Not sure if we should support this: hacked version 1.5a by Chris Covell with bugfixes and GameGenie support +// ROM_LOAD("drpcjr_v1_5_gg.bin", 0x10000, 0x8000, CRC(98f2033b) SHA1(93c114da787a19279d1a46667c2f69b49e25d4f1) ) +ROM_END + +ROM_START( dendy ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + +ROM_START( gchinatv ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1985, nes, 0, 0, nes, nes, driver_device, 0, "Nintendo", "Nintendo Entertainment System / Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1987, nespal, nes, 0, nespal, nes, driver_device, 0, "Nintendo", "Nintendo Entertainment System (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1983, famicom, nes, 0, famicom, famicom, nes_state, famicom, "Nintendo", "Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1983, fds, nes, 0, fds, famicom, nes_state, famicom, "Nintendo", "Famicom (w/ Disk System add-on)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1986, famitwin, nes, 0, famitwin, famicom, nes_state, famicom, "Sharp", "Famicom Twin", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 198?, m82, nes, 0, nes, nes, driver_device, 0, "Nintendo", "M82 Display Unit", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +CONS( 1996, drpcjr, nes, 0, famicom, famicom, nes_state, famicom, "Bung", "Doctor PC Jr", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1992, dendy, nes, 0, dendy, nes, driver_device, 0, "Steepler", "Dendy Classic", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 198?, gchinatv, nes, 0, nespal, nes, driver_device, 0, "Golden China", "Golden China TV Game", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/newbrain.c b/src/mame/drivers/newbrain.c new file mode 100644 index 00000000000..84699034a75 --- /dev/null +++ b/src/mame/drivers/newbrain.c @@ -0,0 +1,1493 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "includes/newbrain.h" +#include "formats/mfi_dsk.h" + +/* + + NewBrain + Grundy Business Systems Ltd. + + 32K RAM + 28K ROM + + Z80 @ 2MHz + COP420 @ 2MHz + + Z80 @ 4MHz (416): INT/NMI=+5V, WAIT=EXTBUSRQ|BUSAKD, RESET=_FDC RESET, + NEC 765AC @ 4 MHz (418) + MC6850 ACIA (459) + Z80CTC (458) + ADC0809 (427) + DAC0808 (461) + + Models according to the Software Technical Manual: + + Model M: 'Page Register', Expansion Port onto Z80 bus, Video, ACIA/CTC, User Port + Model A: Expansion Port, Video, no User Port but has software driver serial port - s/w Printer, s/w V24 + Model V: ACIA/CTC, User Port + +*/ + +/* + + TODO: + + - bitmapped graphics mode + - COP420 microbus access + - escape key is missing + - CP/M 2.2 ROMs + - floppy disc controller + - convert FDC into a device + - convert EIM into a device + + - Micropage ROM/RAM card + - Z80 PIO board + - peripheral (PI) box + - sound card + +*/ + +void newbrain_state::check_interrupt() +{ + int level = (!m_clkint || !m_copint) ? ASSERT_LINE : CLEAR_LINE; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, level); +} + +/* Bank Switching */ + +#define memory_install_unmapped(program, bank, bank_start, bank_end) \ + program.unmap_readwrite(bank_start, bank_end); + +#define memory_install_rom_helper(program, bank, bank_start, bank_end) \ + program.install_read_bank(bank_start, bank_end, bank); \ + program.unmap_write(bank_start, bank_end); + +#define memory_install_ram_helper(program, bank, bank_start, bank_end) \ + program.install_readwrite_bank(bank_start, bank_end, bank); + +void newbrain_eim_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + int bank; + + for (bank = 1; bank < 9; bank++) + { + int page = (m_a16 << 3) | bank; + UINT8 data = ~m_pr[page]; + int ch = (data >> 3) & 0x03; + int eim_bank = data & 0x07; + + UINT16 eim_bank_start = eim_bank * 0x2000; + UINT16 bank_start = (bank - 1) * 0x2000; + UINT16 bank_end = bank_start + 0x1fff; + char bank_name[10]; + sprintf(bank_name,"bank%d",bank); + switch (ch) + { + case 0: + /* ROM */ + memory_install_rom_helper(program, bank_name, bank_start, bank_end); + membank(bank_name)->configure_entry(0, m_eim_rom->base() + eim_bank_start); + break; + + case 2: + /* RAM */ + memory_install_ram_helper(program, bank_name, bank_start, bank_end); + membank(bank_name)->configure_entry(0, m_eim_ram + eim_bank_start); + break; + + default: + logerror("Invalid memory channel %u!\n", ch); + break; + } + } +} + +void newbrain_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + int bank; + + for (bank = 1; bank < 9; bank++) + { + UINT16 bank_start = (bank - 1) * 0x2000; + UINT16 bank_end = bank_start + 0x1fff; + char bank_name[10]; + sprintf(bank_name,"bank%d",bank); + + if (m_pwrup) + { + /* all banks point to ROM at 0xe000 */ + memory_install_rom_helper(program, bank_name, bank_start, bank_end); + membank(bank_name)->configure_entry(0, m_rom->base() + 0xe000); + } + else + { + membank(bank_name)->configure_entry(0, m_rom->base() + bank_start); + + if (bank < 5) + { + /* bank is RAM */ + memory_install_ram_helper(program, bank_name, bank_start, bank_end); + } + else if (bank == 5) + { + /* 0x8000-0x9fff */ + if (m_eim_rom) + { + /* expansion interface ROM */ + memory_install_rom_helper(program, bank_name, bank_start, bank_end); + membank(bank_name)->configure_entry(0, m_eim_rom->base() + 0x4000); + } + else + { + /* mirror of 0xa000-0xbfff */ + if (m_rom->base()[0xa001] == 0) + { + /* unmapped on the M model */ + memory_install_unmapped(program, bank_name, bank_start, bank_end); + } + else + { + /* bank is ROM on the A model */ + memory_install_rom_helper(program, bank_name, bank_start, bank_end); + } + + membank(bank_name)->configure_entry(0, m_rom->base() + 0xa000); + } + } + else if (bank == 6) + { + /* 0xa000-0xbfff */ + if (m_rom->base()[0xa001] == 0) + { + /* unmapped on the M model */ + memory_install_unmapped(program, bank_name, bank_start, bank_end); + } + else + { + /* bank is ROM on the A model */ + memory_install_rom_helper(program, bank_name, bank_start, bank_end); + } + } + else + { + /* bank is ROM */ + memory_install_rom_helper(program, bank_name, bank_start, bank_end); + } + } + + membank(bank_name)->set_entry(0); + } +} + +/* Enable/Status */ + +WRITE8_MEMBER( newbrain_state::enrg1_w ) +{ + /* + + bit signal description + + 0 _CLK enable frame frequency clock interrupts + 1 enable user interrupt + 2 TVP enable video display + 3 enable V24 + 4 V24 Select Receive Bit 0 + 5 V24 Select Receive Bit 1 + 6 V24 Select Transmit Bit 0 + 7 V24 Select Transmit Bit 1 + + */ + + m_enrg1 = data; +} + +WRITE8_MEMBER( newbrain_state::a_enrg1_w ) +{ + /* + + bit signal description + + 0 _CLK Clock Enable + 1 + 2 TVP TV Enable + 3 IOPOWER + 4 _CTS Clear to Send V24 + 5 DO Transmit Data V24 + 6 + 7 PO Transmit Data Printer + + */ + + m_enrg1 = data; +} + +READ8_MEMBER( newbrain_state::ust_r ) +{ + /* + + bit signal description + + 0 variable + 1 variable + 2 MNS mains present + 3 _USRINT0 user status + 4 _USRINT user interrupt + 5 _CLKINT clock interrupt + 6 _ACINT ACIA interrupt + 7 _COPINT COP interrupt + + */ + + UINT8 data = (m_copint << 7) | (m_aciaint << 6) | (m_clkint << 5) | (m_userint << 4) | 0x04; + + switch ((m_enrg1 & NEWBRAIN_ENRG1_UST_BIT_0_MASK) >> 6) + { + case 0: + // excess, 1=24, 0=4 + if (m_tvctl & NEWBRAIN_VIDEO_32_40) + { + data |= 0x01; + } + break; + + case 1: + // characters per line, 1=40, 0=80 + if (m_tvctl & NEWBRAIN_VIDEO_80L) + { + data |= 0x01; + } + break; + + case 2: + // tape in + break; + + case 3: + // calling indicator + break; + } + + switch ((m_enrg1 & NEWBRAIN_ENRG1_UST_BIT_1_MASK) >> 4) + { + case 0: + // PWRUP, if set indicates that power is supplied to Z80 and memory + if (m_pwrup) + { + data |= 0x02; + } + break; + + case 1: + // TVCNSL, if set then processor has video device as primary console output + if (m_tvcnsl) + { + data |= 0x02; + } + break; + + case 2: + // _BEE, if set then processor is Model A type + if (m_bee) + { + data |= 0x02; + } + break; + + case 3: + // _CALLIND, calling indicator + data |= 0x02; + break; + } + + return data; +} + +READ8_MEMBER( newbrain_state::a_ust_r ) +{ + /* + + bit signal description + + 0 +5V + 1 PWRUP + 2 + 3 + 4 + 5 _CLKINT clock interrupt + 6 + 7 _COPINT COP interrupt + + */ + + return (m_copint << 7) | (m_clkint << 5) | (m_pwrup << 1) | 0x01; +} + +READ8_MEMBER( newbrain_state::user_r ) +{ + /* + + bit signal description + + 0 RDDK Received Data V24 + 1 _CTSD _Clear to Send V24 + 2 + 3 + 4 + 5 TPIN Tape in + 6 + 7 _CTSP _Clear to Send Printer + + */ + + m_user = 0; + + return 0xff; +} + +WRITE8_MEMBER( newbrain_state::user_w ) +{ + m_user = data; +} + +/* Interrupts */ + +READ8_MEMBER( newbrain_state::clclk_r ) +{ + m_clkint = 1; + check_interrupt(); + + return 0xff; +} + +WRITE8_MEMBER( newbrain_state::clclk_w ) +{ + m_clkint = 1; + check_interrupt(); +} + +READ8_MEMBER( newbrain_state::clusr_r ) +{ + m_userint = 1; + + return 0xff; +} + +WRITE8_MEMBER( newbrain_state::clusr_w ) +{ + m_userint = 1; +} + +/* COP420 */ + +READ8_MEMBER( newbrain_state::cop_l_r ) +{ + // connected to the Z80 data bus + return m_cop_bus; +} + +WRITE8_MEMBER( newbrain_state::cop_l_w ) +{ + // connected to the Z80 data bus + m_cop_bus = data; +} + +WRITE8_MEMBER( newbrain_state::cop_g_w ) +{ + /* + + bit description + + G0 _COPINT + G1 _TM1 + G2 not connected + G3 _TM2 + + */ + + m_copint = BIT(data, 0); + check_interrupt(); + + /* tape motor enable */ + + m_cassette1->change_state(BIT(data,1) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_cassette2->change_state(BIT(data,3) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); +} + +READ8_MEMBER( newbrain_state::cop_g_r ) +{ + /* + + bit description + + G0 not connected + G1 K9 + G2 K7 + G3 K3 + + */ + + return (BIT(m_keydata, 3) << 3) | (BIT(m_keydata, 0) << 2) | (BIT(m_keydata, 1) << 1); +} + +WRITE8_MEMBER( newbrain_state::cop_d_w ) +{ + /* + bit description + + D0 inverted to K4 -> CD4024 pin 2 (reset) + D1 TDO + D2 inverted to K6 -> CD4024 pin 1 (clock), CD4076 pin 7 (clock), inverted to DS8881 pin 3 (enable) + D3 not connected + + */ + + /* keyboard row reset */ + + if (!BIT(data, 0)) + { + m_keylatch = 0; + } + + /* tape data output */ + + m_cop_tdo = BIT(data, 1); + + m_cassette1->output(m_cop_tdo ? -1.0 : +1.0); + m_cassette2->output(m_cop_tdo ? -1.0 : +1.0); + + /* keyboard and display clock */ + + if (!BIT(data, 2)) + { + m_keylatch++; + + if (m_keylatch == 16) + { + m_keylatch = 0; + } + + m_keydata = m_key_row[m_keylatch]->read(); + + output_set_digit_value(m_keylatch, m_segment_data[m_keylatch]); + } +} + +READ8_MEMBER( newbrain_state::cop_in_r ) +{ + /* + + bit description + + IN0 K8 + IN1 _RD + IN2 _COP + IN3 _WR + + */ + + return (m_cop_wr << 3) | (m_cop_access << 2) | (m_cop_rd << 1) | BIT(m_keydata, 2); +} + +WRITE_LINE_MEMBER( newbrain_state::cop_so_w ) +{ + // connected to K1 + m_cop_so = state; +} + +WRITE_LINE_MEMBER( newbrain_state::cop_sk_w ) +{ + // connected to K2 + m_segment_data[m_keylatch] >>= 1; + m_segment_data[m_keylatch] = (m_cop_so << 15) | (m_segment_data[m_keylatch] & 0x7fff); +} + +READ_LINE_MEMBER( newbrain_state::cop_si_r ) +{ + // connected to TDI + m_cop_tdi = (((m_cassette1)->input() > +1.0) || ((m_cassette2)->input() > +1.0)) ^ m_cop_tdo; + + return m_cop_tdi; +} + +/* Video */ + +void newbrain_state::tvram_w(UINT8 data, int a6) +{ + /* latch video address counter bits A5-A0 */ + m_tvram = (m_tvctl & NEWBRAIN_VIDEO_80L) ? 0x04 : 0x02; + + /* latch video address counter bit A6 */ + m_tvram |= a6 << 6; + + /* latch data to video address counter bits A14-A7 */ + m_tvram = (data << 7); +} + +READ8_MEMBER( newbrain_state::tvl_r ) +{ + UINT8 data = 0xff; + + tvram_w(data, !offset); + + return data; +} + +WRITE8_MEMBER( newbrain_state::tvl_w ) +{ + tvram_w(data, !offset); +} + +WRITE8_MEMBER( newbrain_state::tvctl_w ) +{ + /* + + bit signal description + + 0 RV 1 reverses video over entire field, ie. black on white + 1 FS 0 generates 128 characters and 128 reverse field characters from 8 bit character code. 1 generates 256 characters from 8 bit character code + 2 32/_40 0 generates 320 or 640 horizontal dots in pixel graphics mode. 1 generates 256 or 512 horizontal dots in pixel graphics mode + 3 UCR 0 selects 256 characters expressed in an 8x10 matrix, and 25 lines (max) displayed. 1 selects 256 characters in an 8x8 matrix, and 31 lines (max) displayed + 4 + 5 + 6 80L 0 selects 40 character line length. 1 selects 80 character line length + 7 + + */ + + m_tvctl = data; +} + +/* Disc Controller */ + +WRITE8_MEMBER( newbrain_eim_state::fdc_auxiliary_w ) +{ + /* + + bit description + + 0 MOTON + 1 765 RESET + 2 TC + 3 + 4 + 5 PA15 + 6 + 7 + + */ + + m_floppy->mon_w(!BIT(data, 0)); + + if(BIT(data, 1)) + m_fdc->reset(); + + m_fdc->tc_w(BIT(data, 2)); +} + +READ8_MEMBER( newbrain_eim_state::fdc_control_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 FDC INT + 6 PAGING + 7 FDC ATT + + */ + + return (m_fdc_att << 7) | (m_paging << 6) | (m_fdc_int << 5); +} + +READ8_MEMBER( newbrain_eim_state::ust2_r ) +{ + /* + + bit description + + 0 RDDK (V24 RxD) + 1 _CTSD (V24 Clear to Send) + 2 + 3 + 4 + 5 TPIN + 6 + 7 _CTSP (Printer Clear to Send) + + */ + + return 0; +} + +#define NEWBRAIN_COPCMD_NULLCOM 0xd0 +#define NEWBRAIN_COPCMD_DISPCOM 0xa0 +//#define NEWBRAIN_COPCMD_TIMCOM 0x +#define NEWBRAIN_COPCMD_PDNCOM 0xb8 +#define NEWBRAIN_COPCMD_TAPECOM 0x80 + +#define NEWBRAIN_COP_TAPE_RECORD 0x00 +#define NEWBRAIN_COP_TAPE_PLAYBK 0x04 +#define NEWBRAIN_COP_TAPE_MOTOR1 0x08 +#define NEWBRAIN_COP_TAPE_MOTOR2 0x02 + +#define NEWBRAIN_COP_TIMER0 0x01 + +#define NEWBRAIN_COP_NO_DATA 0x01 +#define NEWBRAIN_COP_BREAK_PRESSED 0x02 + +#define NEWBRAIN_COP_REGINT 0x00 +/*#define NEWBRAIN_COP_CASSERR 0x +#define NEWBRAIN_COP_CASSIN 0x +#define NEWBRAIN_COP_KBD 0x +#define NEWBRAIN_COP_CASSOUT 0x*/ + +enum +{ + NEWBRAIN_COP_STATE_COMMAND = 0, + NEWBRAIN_COP_STATE_DATA +}; + + +READ8_MEMBER( newbrain_state::cop_r ) +{ + m_copint = 1; + check_interrupt(); + + return m_copdata; +} + +WRITE8_MEMBER( newbrain_state::cop_w ) +{ + m_copdata = data; + + switch (m_copstate) + { + case NEWBRAIN_COP_STATE_COMMAND: + logerror("COP command %02x\n", data); + + switch (data) + { + case NEWBRAIN_COPCMD_NULLCOM: + break; + + case NEWBRAIN_COPCMD_DISPCOM: + m_copregint = 0; + m_copbytes = 18; + m_copstate = NEWBRAIN_COP_STATE_DATA; + + m_copdata = NEWBRAIN_COP_NO_DATA; + m_copint = 0; + check_interrupt(); + + break; + +#if 0 + case NEWBRAIN_COPCMD_TIMCOM: + m_copregint = 0; + m_copbytes = 6; + m_copstate = NEWBRAIN_COP_STATE_DATA; + break; +#endif + case NEWBRAIN_COPCMD_PDNCOM: + /* power down */ + m_copregint = 0; + break; + + default: + if (data & NEWBRAIN_COPCMD_TAPECOM) + { + m_copregint = 0; + } + } + break; + + case NEWBRAIN_COP_STATE_DATA: + logerror("COP data %02x\n", data); + m_copbytes--; + + if (m_copbytes == 0) + { + m_copstate = NEWBRAIN_COP_STATE_COMMAND; + m_copregint = 1; + } + + m_copdata = NEWBRAIN_COP_NO_DATA; + m_copint = 0; + check_interrupt(); + + break; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(newbrain_state::cop_regint_tick) +{ + if (m_copregint) + { + logerror("COP REGINT\n"); + m_copint = 0; + check_interrupt(); + } +} + +/* Expansion Interface Module */ + +WRITE8_MEMBER( newbrain_eim_state::enrg2_w ) +{ + /* + + bit signal description + + 0 _USERP 0 enables user data bus interrupt and also parallel latched data output (or centronics printer) interrupt + 1 ANP 1 enables ADC conversion complete interrupt and also calling indicator interrupt + 2 MLTMD 1 enables serial receive clock into multiplier input of DAC and signals data terminal not ready + 3 MSPD 1 enables 50K Baud serial data rate to be obtained ie. CTC input clock of 800 kHz. 0 selects xxx.692 kHz + 4 ENOR 1 enables serial receive clock to sound output summer, and also selects serial input from the printer port. 0 selects serial input from the comms port + 5 ANSW 1 enables second bank of 4 analogue inputs (voltage, non-ratiometric), ie. ch4-7, and enabled sound output, 0 selects ch03 + 6 ENOT 1 enables serial transmit clock to sound ouput summer, and also selects serial output to the printer port. 0 selects serial output to the comms port + 7 9th output bit for centronics printer port + + */ + + m_enrg2 = data; +} + +WRITE8_MEMBER( newbrain_eim_state::pr_w ) +{ + /* + + bit signal description + + 0 HP0 + 1 HP1 + 2 HP2 + 3 HP3 + 4 HP4 + 5 HP5 + 6 HP6 + 7 HP11 + + HP0-HP2 are decoded to _ROM0..._ROM7 signals + HP3-HP4 are decoded to _CH0..._CH3 signals + + */ + + int page = (BIT(offset, 12) >> 9) | (BIT(offset, 15) >> 13) | (BIT(offset, 14) >> 13) | (BIT(offset, 13) >> 13); + int bank = (BIT(offset, 11) >> 3) | (data & 0x7f); + + m_pr[page] = bank; + + bankswitch(); +} + +READ8_MEMBER( newbrain_eim_state::user_r ) +{ + m_user = 0xff; + + return 0xff; +} + +WRITE8_MEMBER( newbrain_eim_state::user_w ) +{ + m_user = data; +} + +READ8_MEMBER( newbrain_eim_state::anout_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( newbrain_eim_state::anout_w ) +{ +} + +READ8_MEMBER( newbrain_eim_state::anin_r ) +{ +// int channel = offset & 0x03; + + return 0; +} + +WRITE8_MEMBER( newbrain_eim_state::anio_w ) +{ +// int channel = offset & 0x03; +} + +READ8_MEMBER( newbrain_eim_state::st0_r ) +{ + /* + + bit signal description + + 0 fixed at 1 - indicates excess of 24 or 48, obsolete + 1 PWRUP 1 indicates power up from 'cold' - necessary in battery machines with power switching + 2 1 indicates analogue or calling indicator interrupts + 3 _USRINT0 0 indicates centronics printer (latched output data) port interrupt + 4 _USRINT 0 indicates parallel data bus port interrupt + 5 _CLKINT 0 indicates frame frequency clock interrupt + 6 _ACINT 0 indicates ACIA interrupt + 7 _COPINT 0 indicates interrupt from micro-controller COP420M + + */ + + return (m_copint << 7) | (m_aciaint << 6) | (m_clkint << 5) | (m_userint << 4) | (m_userint0 << 3) | (m_pwrup) << 1 | 0x01; +} + +READ8_MEMBER( newbrain_eim_state::st1_r ) +{ + /* + + bit signal description + + 0 + 1 + 2 N/_RV 1 selects normal video on power up (white on black), 0 selects reversed video (appears as D0 on the first 200 EI's) + 3 ANCH 1 indicates power is being taken from the mains supply + 4 40/_80 1 indicates that 40 column video is selected on power up. 0 selects 80 column video + 5 + 6 TVCNSL 1 indicates that a video display is required on power up + 7 + + */ + + return (m_tvcnsl << 6) | 0x10 | 0x08 | 0x04; +} + +READ8_MEMBER( newbrain_eim_state::st2_r ) +{ + /* + + bit signal description + + 0 received serial data from communications port + 1 0 indicates 'clear-to-send' condition at communications port + 2 + 3 + 4 + 5 logic level tape input + 6 + 7 0 indicates 'clear-to-send' condition at printer port + + */ + + return 0; +} + +READ8_MEMBER( newbrain_eim_state::usbs_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( newbrain_eim_state::usbs_w ) +{ +} + +WRITE8_MEMBER( newbrain_eim_state::paging_w ) +{ + if (BIT(offset, 8)) + { + // expansion interface module + + /* + + bit signal description + + 0 PG 1 enables paging circuits + 1 WPL unused + 2 A16 1 sets local A16 to 1 (ie. causes second set of 8 page registers to select addressed memory) + 3 _MPM 0 selects multi-processing mode. among other effects this extends the page registers from 8 to 12 bits in length + 4 HISLT 1 isolates the local machine. this is used in multi-processing mode + 5 + 6 + 7 + + */ + + m_paging = BIT(data, 0); + m_a16 = BIT(data, 2); + m_mpm = BIT(data, 3); + } + else if (BIT(offset, 9)) + { + // disc controller + + /* + + bit signal description + + 0 PAGING 1 enables paging circuits + 1 + 2 HA16 1 sets local A16 to 1 (ie. causes second set of 8 page registers to select addressed memory) + 3 MPM 0 selects multi-processing mode. among other effects this extends the page registers from 8 to 12 bits in length + 4 + 5 _FDC RESET + 6 + 7 FDC ATT + + */ + + m_fdccpu->set_input_line(INPUT_LINE_RESET, BIT(data, 5) ? HOLD_LINE : CLEAR_LINE); + + m_paging = BIT(data, 0); + m_a16 = BIT(data, 2); + m_mpm = BIT(data, 3); + m_fdc_att = BIT(data, 7); + } + else if (BIT(offset, 10)) + { + // network controller + } +} + +/* A/D Converter */ + +WRITE_LINE_MEMBER( newbrain_eim_state::adc_eoc_w ) +{ + m_anint = state; +} + +ADC0808_ANALOG_READ_CB( newbrain_eim_state::adc_vref_pos_r ) +{ + return 5.0; +} + +ADC0808_ANALOG_READ_CB( newbrain_eim_state::adc_vref_neg_r ) +{ + return 0.0; +} + +ADC0808_ANALOG_READ_CB( newbrain_eim_state::adc_input_r ) +{ + return 0.0; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( newbrain_map, AS_PROGRAM, 8, newbrain_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") + AM_RANGE(0x2000, 0x3fff) AM_RAMBANK("bank2") + AM_RANGE(0x4000, 0x5fff) AM_RAMBANK("bank3") + AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("bank4") + AM_RANGE(0x8000, 0x9fff) AM_RAMBANK("bank5") + AM_RANGE(0xa000, 0xbfff) AM_RAMBANK("bank6") + AM_RANGE(0xc000, 0xdfff) AM_RAMBANK("bank7") + AM_RANGE(0xe000, 0xffff) AM_RAMBANK("bank8") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( newbrain_ei_io_map, AS_IO, 8, newbrain_eim_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(clusr_r, clusr_w) + AM_RANGE(0x01, 0x01) AM_MIRROR(0xff00) AM_WRITE(enrg2_w) + AM_RANGE(0x02, 0x02) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE(pr_w) + AM_RANGE(0x03, 0x03) AM_MIRROR(0xff00) AM_READWRITE(user_r, user_w) + AM_RANGE(0x04, 0x04) AM_MIRROR(0xff00) AM_READWRITE(clclk_r, clclk_w) + AM_RANGE(0x05, 0x05) AM_MIRROR(0xff00) AM_READWRITE(anout_r, anout_w) + AM_RANGE(0x06, 0x06) AM_MIRROR(0xff00) AM_READWRITE(cop_r, cop_w) + AM_RANGE(0x07, 0x07) AM_MIRROR(0xff00) AM_WRITE(enrg1_w) + AM_RANGE(0x08, 0x09) AM_MIRROR(0xff02) AM_READWRITE(tvl_r, tvl_w) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff03) AM_WRITE(tvctl_w) + AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_READWRITE(anin_r, anio_w) + AM_RANGE(0x14, 0x14) AM_MIRROR(0xff00) AM_READ(st0_r) + AM_RANGE(0x15, 0x15) AM_MIRROR(0xff00) AM_READ(st1_r) + AM_RANGE(0x16, 0x16) AM_MIRROR(0xff00) AM_READ(st2_r) + AM_RANGE(0x17, 0x17) AM_MIRROR(0xff00) AM_READWRITE(usbs_r, usbs_w) + AM_RANGE(0x18, 0x18) AM_MIRROR(0xff00) AM_DEVREADWRITE(MC6850_TAG, acia6850_device, status_r, control_w) + AM_RANGE(0x19, 0x19) AM_MIRROR(0xff00) AM_DEVREADWRITE(MC6850_TAG, acia6850_device, data_r, data_w) + AM_RANGE(0x1c, 0x1f) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE(paging_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( newbrain_a_io_map, AS_IO, 8, newbrain_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_MIRROR(0xffc0) AM_READWRITE(clusr_r, clusr_w) + AM_RANGE(0x03, 0x03) AM_MIRROR(0xffc0) AM_WRITE(user_w) + AM_RANGE(0x04, 0x04) AM_MIRROR(0xffc0) AM_READWRITE(clclk_r, clclk_w) + AM_RANGE(0x06, 0x06) AM_MIRROR(0xffc0) AM_READWRITE(cop_r, cop_w) + AM_RANGE(0x07, 0x07) AM_MIRROR(0xffc0) AM_WRITE(a_enrg1_w) + AM_RANGE(0x08, 0x09) AM_MIRROR(0xffc2) AM_READWRITE(tvl_r, tvl_w) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xffc3) AM_WRITE(tvctl_w) + AM_RANGE(0x14, 0x14) AM_MIRROR(0xffc3) AM_READ(a_ust_r) + AM_RANGE(0x16, 0x16) AM_MIRROR(0xffc0) AM_READ(user_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( newbrain_fdc_map, AS_PROGRAM, 8, newbrain_eim_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( newbrain_fdc_io_map, AS_IO, 8, newbrain_eim_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x01) AM_DEVICE(UPD765_TAG, upd765a_device, map) + AM_RANGE(0x20, 0x20) AM_WRITE(fdc_auxiliary_w) + AM_RANGE(0x40, 0x40) AM_READ(fdc_control_r) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( newbrain ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('(') PORT_CHAR('[') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(')') PORT_CHAR(']') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* \xC2\xA3") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR(0x00A3) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("VIDEO TEXT") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) // Vd + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + + PORT_START("Y10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("Y11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') PORT_CHAR('\\') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("Y12") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('^') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("Y13") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NEW LINE") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // NL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("Y14") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // CH + + PORT_START("Y15") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // SH + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) // GR + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPEAT") // RPT + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // GL +INPUT_PORTS_END + +/* Machine Initialization */ + +WRITE_LINE_MEMBER( newbrain_eim_state::acia_tx ) +{ + m_acia_txd = state; +} + +WRITE_LINE_MEMBER( newbrain_eim_state::acia_interrupt ) +{ + m_aciaint = state; +} + +WRITE_LINE_MEMBER( newbrain_eim_state::fdc_interrupt ) +{ + m_fdc_int = state; +} + +WRITE_LINE_MEMBER( newbrain_eim_state::ctc_z2_w ) +{ + /* connected to CTC channel 0/1 clock inputs */ + m_ctc->trg0(state); + m_ctc->trg1(state); +} + +TIMER_DEVICE_CALLBACK_MEMBER(newbrain_eim_state::ctc_c2_tick) +{ + m_ctc->trg2(1); + m_ctc->trg2(0); +} + +inline int newbrain_state::get_reset_t() +{ + return RES_K(220) * CAP_U(10) * 1000; // t = R128 * C125 = 2.2s +} + +inline int newbrain_state::get_pwrup_t() +{ + return RES_K(560) * CAP_U(10) * 1000; // t = R129 * C127 = 5.6s +} + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void newbrain_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_ID_RESET: + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + m_copcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + break; + + case TIMER_ID_PWRUP: + m_pwrup = 0; + bankswitch(); + break; + } +} + +void newbrain_state::machine_start() +{ + m_copregint = 1; + + /* set power up timer */ + timer_set(attotime::from_usec(get_pwrup_t()), TIMER_ID_PWRUP); + + /* initialize variables */ + m_pwrup = 1; + m_userint = 1; + m_userint0 = 1; + m_clkint = 1; + m_aciaint = 1; + m_copint = 1; + m_bee = 1; + m_tvcnsl = 1; + + /* set up memory banking */ + bankswitch(); + + // find keyboard rows + m_key_row[0] = m_y0; + m_key_row[1] = m_y1; + m_key_row[2] = m_y2; + m_key_row[3] = m_y3; + m_key_row[4] = m_y4; + m_key_row[5] = m_y5; + m_key_row[6] = m_y6; + m_key_row[7] = m_y7; + m_key_row[8] = m_y8; + m_key_row[9] = m_y9; + m_key_row[10] = m_y10; + m_key_row[11] = m_y11; + m_key_row[12] = m_y12; + m_key_row[13] = m_y13; + m_key_row[14] = m_y14; + m_key_row[15] = m_y15; + + /* register for state saving */ + save_item(NAME(m_pwrup)); + save_item(NAME(m_userint)); + save_item(NAME(m_userint0)); + save_item(NAME(m_clkint)); + save_item(NAME(m_aciaint)); + save_item(NAME(m_copint)); + save_item(NAME(m_anint)); + save_item(NAME(m_bee)); + save_item(NAME(m_enrg1)); + save_item(NAME(m_enrg2)); + save_item(NAME(m_cop_bus)); + save_item(NAME(m_cop_so)); + save_item(NAME(m_cop_tdo)); + save_item(NAME(m_cop_tdi)); + save_item(NAME(m_cop_rd)); + save_item(NAME(m_cop_wr)); + save_item(NAME(m_cop_access)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_keydata)); + save_item(NAME(m_user)); +} + +void newbrain_eim_state::machine_start() +{ + newbrain_state::machine_start(); + + /* allocate expansion RAM */ + m_eim_ram.allocate(NEWBRAIN_EIM_RAM_SIZE); + + /* register for state saving */ + save_item(NAME(m_mpm)); + save_item(NAME(m_a16)); + save_item(NAME(m_pr)); + save_item(NAME(m_fdc_int)); + save_item(NAME(m_fdc_att)); + save_item(NAME(m_paging)); +} + +void newbrain_state::machine_reset() +{ + timer_set(attotime::from_usec(get_reset_t()), TIMER_ID_RESET); +} + +INTERRUPT_GEN_MEMBER(newbrain_state::newbrain_interrupt) +{ + if (!(m_enrg1 & NEWBRAIN_ENRG1_CLK)) + { + m_clkint = 0; + check_interrupt(); + } +} + +/* Machine Drivers */ + +/* F4 Character Displayer */ +static const gfx_layout newbrain_charlayout = +{ + 8, 10, /* 8 x 10 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*256*8, 1*256*8, 2*256*8, 3*256*8, 4*256*8, 5*256*8, 6*256*8, 7*256*8, 8*256*8, 9*256*8, 10*256*8, 11*256*8, 12*256*8, 13*256*8, 14*256*8, 15*256*8 }, + 8 /* every char takes 16 x 1 bytes */ +}; + +static GFXDECODE_START( newbrain ) + GFXDECODE_ENTRY( "chargen", 0x0000, newbrain_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( newbrain_a, newbrain_state ) + // basic system hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/8) + MCFG_CPU_PROGRAM_MAP(newbrain_map) + MCFG_CPU_IO_MAP(newbrain_a_io_map) + MCFG_CPU_VBLANK_INT_DRIVER(SCREEN_TAG, newbrain_state, newbrain_interrupt) + + MCFG_CPU_ADD(COP420_TAG, COP420, XTAL_16MHz/8) // COP420-GUW/N + MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) + MCFG_COP400_READ_L_CB(READ8(newbrain_state, cop_l_r)) + MCFG_COP400_WRITE_L_CB(WRITE8(newbrain_state, cop_l_w)) + MCFG_COP400_READ_G_CB(READ8(newbrain_state, cop_g_r)) + MCFG_COP400_WRITE_G_CB(WRITE8(newbrain_state, cop_g_w)) + MCFG_COP400_WRITE_D_CB(WRITE8(newbrain_state, cop_d_w)) + MCFG_COP400_READ_IN_CB(READ8(newbrain_state, cop_in_r)) + MCFG_COP400_WRITE_SK_CB(WRITELINE(newbrain_state, cop_sk_w)) + MCFG_COP400_READ_SI_CB(READLINE(newbrain_state, cop_si_r)) + MCFG_COP400_WRITE_SO_CB(WRITELINE(newbrain_state, cop_so_w)) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", newbrain) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("cop_regint", newbrain_state, cop_regint_tick, attotime::from_usec(12500)) + + // video hardware + MCFG_FRAGMENT_ADD(newbrain_video) + + // devices + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_CASSETTE_ADD("cassette2") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") +MACHINE_CONFIG_END + +static SLOT_INTERFACE_START( newbrain_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_DERIVED_CLASS( newbrain_eim, newbrain_a, newbrain_eim_state ) + // basic system hardware + MCFG_CPU_MODIFY(Z80_TAG) + MCFG_CPU_IO_MAP(newbrain_ei_io_map) + + MCFG_CPU_ADD(FDC_Z80_TAG, Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(newbrain_fdc_map) + MCFG_CPU_IO_MAP(newbrain_fdc_io_map) + + // devices + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/8) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(MC6850_TAG, acia6850_device, write_rxc)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(MC6850_TAG, acia6850_device, write_txc)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(newbrain_eim_state, ctc_z2_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_c2", newbrain_eim_state, ctc_c2_tick, attotime::from_hz(XTAL_16MHz/4/13)) + MCFG_DEVICE_ADD(ADC0809_TAG, ADC0808, 500000) + MCFG_ADC0808_OUT_EOC_CB(WRITELINE(newbrain_eim_state, adc_eoc_w)) + MCFG_ADC0808_IN_VREF_POS_CB(newbrain_eim_state, adc_vref_pos_r) + MCFG_ADC0808_IN_VREF_NEG_CB(newbrain_eim_state, adc_vref_neg_r) + MCFG_ADC0808_IN_IN_0_CB(newbrain_eim_state, adc_input_r) + MCFG_ADC0808_IN_IN_1_CB(newbrain_eim_state, adc_input_r) + MCFG_ADC0808_IN_IN_2_CB(newbrain_eim_state, adc_input_r) + MCFG_ADC0808_IN_IN_3_CB(newbrain_eim_state, adc_input_r) + MCFG_ADC0808_IN_IN_4_CB(newbrain_eim_state, adc_input_r) + MCFG_ADC0808_IN_IN_5_CB(newbrain_eim_state, adc_input_r) + MCFG_ADC0808_IN_IN_6_CB(newbrain_eim_state, adc_input_r) + MCFG_ADC0808_IN_IN_7_CB(newbrain_eim_state, adc_input_r) + + MCFG_DEVICE_ADD(MC6850_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(newbrain_eim_state, acia_tx)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(newbrain_eim_state, acia_interrupt)) + + MCFG_UPD765A_ADD(UPD765_TAG, false, true) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) + + // internal ram + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("96K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( newbrain ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "rom20" ) + + ROM_SYSTEM_BIOS( 0, "issue1", "Issue 1 (v?)" ) + ROMX_LOAD( "aben.ic6", 0xa000, 0x2000, CRC(308f1f72) SHA1(a6fd9945a3dca47636887da2125fde3f9b1d4e25), ROM_BIOS(1) ) + ROMX_LOAD( "cd iss 1.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(1) ) + ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "issue2", "Issue 2 (v1.9)" ) + ROMX_LOAD( "aben19.ic6", 0xa000, 0x2000, CRC(d0283eb1) SHA1(351d248e69a77fa552c2584049006911fb381ff0), ROM_BIOS(2) ) + ROMX_LOAD( "cdi2.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(2) ) + ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS( 2, "issue3", "Issue 3 (v1.91)" ) + ROMX_LOAD( "aben191.ic6", 0xa000, 0x2000, CRC(b7be8d89) SHA1(cce8d0ae7aa40245907ea38b7956c62d039d45b7), ROM_BIOS(3) ) + ROMX_LOAD( "cdi3.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(3) ) + ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS( 3, "series2", "Series 2 (v?)" ) + ROMX_LOAD( "abs2.ic6", 0xa000, 0x2000, CRC(9a042acb) SHA1(80d83a2ea3089504aa68b6cf978d80d296cd9bda), ROM_BIOS(4) ) + ROMX_LOAD( "cds2.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(4) ) + ROMX_LOAD( "efs2.ic8", 0xe000, 0x2000, CRC(b222d798) SHA1(c0c816b4d4135b762f2c5f1b24209d0096f22e56), ROM_BIOS(4) ) + + ROM_SYSTEM_BIOS( 4, "rom20", "? (v2.0)" ) + ROMX_LOAD( "aben20.rom", 0xa000, 0x2000, CRC(3d76d0c8) SHA1(753b4530a518ad832e4b81c4e5430355ba3f62e0), ROM_BIOS(5) ) + ROMX_LOAD( "cd20tci.rom", 0xc000, 0x4000, CRC(f65b2350) SHA1(1ada7fbf207809537ec1ffb69808524300622ada), ROM_BIOS(5) ) + + ROM_REGION( 0x400, COP420_TAG, 0 ) + ROM_LOAD( "cop420.419", 0x000, 0x400, NO_DUMP ) + + ROM_REGION( 0x1000, "chargen", ROMREGION_ERASE00 ) + ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x0a01, BAD_DUMP CRC(46ecbc65) SHA1(3fe064d49a4de5e3b7383752e98ad35a674e26dd) ) // 8248R7 +ROM_END + +#define rom_newbraina rom_newbrain + +ROM_START( newbraineim ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "rom20" ) + + ROM_SYSTEM_BIOS( 0, "issue1", "Issue 1 (v?)" ) + ROMX_LOAD( "aben.ic6", 0xa000, 0x2000, CRC(308f1f72) SHA1(a6fd9945a3dca47636887da2125fde3f9b1d4e25), ROM_BIOS(1) ) + ROMX_LOAD( "cd iss 1.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(1) ) + ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "issue2", "Issue 2 (v1.9)" ) + ROMX_LOAD( "aben19.ic6", 0xa000, 0x2000, CRC(d0283eb1) SHA1(351d248e69a77fa552c2584049006911fb381ff0), ROM_BIOS(2) ) + ROMX_LOAD( "cdi2.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(2) ) + ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS( 2, "issue3", "Issue 3 (v1.91)" ) + ROMX_LOAD( "aben191.ic6", 0xa000, 0x2000, CRC(b7be8d89) SHA1(cce8d0ae7aa40245907ea38b7956c62d039d45b7), ROM_BIOS(3) ) + ROMX_LOAD( "cdi3.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(3) ) + ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS( 3, "series2", "Series 2 (v?)" ) + ROMX_LOAD( "abs2.ic6", 0xa000, 0x2000, CRC(9a042acb) SHA1(80d83a2ea3089504aa68b6cf978d80d296cd9bda), ROM_BIOS(4) ) + ROMX_LOAD( "cds2.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(4) ) + ROMX_LOAD( "efs2.ic8", 0xe000, 0x2000, CRC(b222d798) SHA1(c0c816b4d4135b762f2c5f1b24209d0096f22e56), ROM_BIOS(4) ) + + ROM_SYSTEM_BIOS( 4, "rom20", "? (v2.0)" ) + ROMX_LOAD( "aben20.rom", 0xa000, 0x2000, CRC(3d76d0c8) SHA1(753b4530a518ad832e4b81c4e5430355ba3f62e0), ROM_BIOS(5) ) + ROMX_LOAD( "cd20tci.rom", 0xc000, 0x4000, CRC(f65b2350) SHA1(1ada7fbf207809537ec1ffb69808524300622ada), ROM_BIOS(5) ) + + ROM_REGION( 0x400, COP420_TAG, 0 ) + ROM_LOAD( "cop420.419", 0x000, 0x400, NO_DUMP ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x0a01, BAD_DUMP CRC(46ecbc65) SHA1(3fe064d49a4de5e3b7383752e98ad35a674e26dd) ) // 8248R7 + + ROM_REGION( 0x10000, "eim", 0 ) // Expansion Interface Module + ROM_LOAD( "e415-2.rom", 0x4000, 0x2000, CRC(5b0e390c) SHA1(0f99cae57af2e64f3f6b02e5325138d6ba015e72) ) + ROM_LOAD( "e415-3.rom", 0x4000, 0x2000, CRC(2f88bae5) SHA1(04e03f230f4b368027442a7c2084dae877f53713) ) // 18/8/83.aci + ROM_LOAD( "e416-3.rom", 0x6000, 0x2000, CRC(8b5099d8) SHA1(19b0cfce4c8b220eb1648b467f94113bafcb14e0) ) // 10/8/83.mtv + ROM_LOAD( "e417-2.rom", 0x8000, 0x2000, CRC(6a7afa20) SHA1(f90db4f8318777313a862b3d5bab83c2fd260010) ) + + ROM_REGION( 0x10000, FDC_Z80_TAG, 0 ) // Floppy Disk Controller + ROM_LOAD( "d413-2.rom", 0x0000, 0x2000, CRC(097591f1) SHA1(c2aa1d27d4f3a24ab0c8135df746a4a44201a7f4) ) + ROM_LOAD( "d417-1.rom", 0x0000, 0x2000, CRC(40fad31c) SHA1(5137be4cc026972c0ffd4fa6990e8583bdfce163) ) + ROM_LOAD( "d417-2.rom", 0x0000, 0x2000, CRC(e8bda8b9) SHA1(c85a76a5ff7054f4ef4a472ce99ebaed1abd269c) ) +ROM_END + +ROM_START( newbrainmd ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "cdmd.rom", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a) ) + ROM_LOAD( "efmd.rom", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6) ) + + ROM_REGION( 0x400, COP420_TAG, 0 ) + ROM_LOAD( "cop420.419", 0x000, 0x400, NO_DUMP ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x0a01, BAD_DUMP CRC(46ecbc65) SHA1(3fe064d49a4de5e3b7383752e98ad35a674e26dd) ) // 8248R7 +ROM_END + +/* System Drivers */ + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1981, newbrain, 0, 0, newbrain_a, newbrain, driver_device, 0, "Grundy Business Systems Ltd", "NewBrain AD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1981, newbraineim,newbrain, 0, newbrain_eim, newbrain, driver_device, 0, "Grundy Business Systems Ltd", "NewBrain AD with Expansion Interface", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1981, newbraina, newbrain, 0, newbrain_a, newbrain, driver_device, 0, "Grundy Business Systems Ltd", "NewBrain A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1981, newbrainmd, newbrain, 0, newbrain_a, newbrain, driver_device, 0, "Grundy Business Systems Ltd", "NewBrain MD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/next.c b/src/mame/drivers/next.c new file mode 100644 index 00000000000..90901333a35 --- /dev/null +++ b/src/mame/drivers/next.c @@ -0,0 +1,1225 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + NeXT + + TODO: + + - Hook up the sound output, it is shared with the keyboard port + + - Implement more of the scc and its dma interactions so that the + start up test passes, but not before sound out is done (if the scc + test passes all the other test pass up to sound out which + infloops) + + - Really implement the MO, it's only faking it for the startup test right now + + - Fix the networking + + - Find out why netbsd goes to hell even before loading the kernel + + Memory map and other bits can be found here: + http://fxr.watson.org/fxr/source/arch/next68k/include/cpu.h?v=NETBSD5#L366 + +****************************************************************************/ + + +#include "includes/next.h" +#include "formats/pc_dsk.h" +#include "formats/mfi_dsk.h" +#include "machine/nscsi_cd.h" +#include "machine/nscsi_hd.h" + +UINT32 next_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // We don't handle partial updates, but we don't generate them either :-) + if(cliprect.min_x || cliprect.min_y || cliprect.max_x+1 != screen_sx || cliprect.max_y+1 != screen_sy) + return 0; + + // 0,1,2,4=0b000000, 3=2c000000, 5,8,9=0c000000 + // 1152x832 (0,1,2,3c,4) + // 1120x832 (8) + // 832x624 (5c,9c) + if(screen_color) { + const UINT32 *vr = vram; + for(int y=0; y(bitmap.raw_pixptr(y)); + for(int x=0; x> (16-(xi*16))) & 0xffff; + UINT32 r = (pen & 0xf000) >> 12; + UINT32 g = (pen & 0x0f00) >> 8; + UINT32 b = (pen & 0x00f0) >> 4; + UINT32 col = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b; + *pix++ = col; + } + } + vr += screen_skip; + } + } else { + static UINT32 colors[4] = { 0xffffff, 0xaaaaaa, 0x555555, 0x000000 }; + const UINT32 *vr = vram; + for(int y=0; y(bitmap.raw_pixptr(y)); + for(int x=0; x> (30-(xi*2))) & 0x3]; + } + vr += screen_skip; + } + } + + return 0; +} + +/* Dummy catcher for any unknown r/w */ +READ8_MEMBER( next_state::io_r ) +{ + if(!space.debugger_access()) + printf("io_r %08x (%08x)\n",offset+0x02000000, space.device().safe_pc()); + + if(offset == 0xc0) + return 0; + + return 0xff; +} + +WRITE8_MEMBER( next_state::io_w ) +{ + if(!space.debugger_access()) + printf("io_w %08x, %02x (%08x)\n",offset+0x02000000,data, space.device().safe_pc()); +} + +/* map ROM at 0x01000000-0x0101ffff? */ +READ32_MEMBER( next_state::rom_map_r ) +{ + if(0 && !space.debugger_access()) + printf("%08x ROM MAP?\n",space.device().safe_pc()); + return 0x01000000; +} + +READ32_MEMBER( next_state::scr2_r ) +{ + if(0 && !space.debugger_access()) + printf("%08x\n",space.device().safe_pc()); + /* + x--- ---- ---- ---- ---- ---- ---- ---- dsp reset + -x-- ---- ---- ---- ---- ---- ---- ---- dsp block end + --x- ---- ---- ---- ---- ---- ---- ---- dsp unpacked + ---x ---- ---- ---- ---- ---- ---- ---- dsp mode b + ---- x--- ---- ---- ---- ---- ---- ---- dsp mode a + ---- -x-- ---- ---- ---- ---- ---- ---- remote int + ---- ---x ---- ---- ---- ---- ---- ---- local int + ---- ---- ---x ---- ---- ---- ---- ---- dram 256k + ---- ---- ---- ---x ---- ---- ---- ---- dram 1m + ---- ---- ---- ---- x--- ---- ---- ---- "timer on ipl7" + ---- ---- ---- ---- -xxx ---- ---- ---- rom waitstates + ---- ---- ---- ---- ---- x--- ---- ---- ROM 1M + ---- ---- ---- ---- ---- -x-- ---- ---- MCS1850 rtdata + ---- ---- ---- ---- ---- --x- ---- ---- MCS1850 rtclk + ---- ---- ---- ---- ---- ---x ---- ---- MCS1850 rtce + ---- ---- ---- ---- ---- ---- x--- ---- rom overlay + ---- ---- ---- ---- ---- ---- -x-- ---- dsp ie + ---- ---- ---- ---- ---- ---- --x- ---- mem en + ---- ---- ---- ---- ---- ---- ---- ---x led + + 68040-25, 100ns, 32M: 00000c80 + 68040-25, 100ns, 20M: 00ff0c80 + + */ + + UINT32 data = scr2 & 0xfffffbff; + + data |= rtc->sdo_r() << 10; + + return data; +} + +WRITE32_MEMBER( next_state::scr2_w ) +{ + if(0 && !space.debugger_access()) + printf("scr2_w %08x (%08x)\n", data, space.device().safe_pc()); + COMBINE_DATA(&scr2); + + rtc->ce_w(BIT(scr2, 8)); + rtc->sdi_w(BIT(scr2, 10)); + rtc->sck_w(BIT(scr2, 9)); + irq_set(0, scr2 & 0x01000000); + irq_set(1, scr2 & 0x02000000); +} + +READ32_MEMBER( next_state::scr1_r ) +{ + /* + xxxx ---- ---- ---- ---- ---- ---- ---- slot ID + ---- ---- xxxx xxxx ---- ---- ---- ---- DMA type + ---- ---- ---- ---- xxxx ---- ---- ---- machine type + ---- ---- ---- ---- ---- xxxx ---- ---- board revision + ---- ---- ---- ---- ---- ---- -xx- ---- video mem speed + ---- ---- ---- ---- ---- ---- ---x x--- mem speed + ---- ---- ---- ---- ---- ---- ---- -xxx cpu speed 16/20/25/33/40/50/66/80 + + machine types: + 0 NeXT_CUBE + 1 NeXT_WARP9 + 2 NeXT_X15 + 3 NeXT_WARP9C + 4 NeXT_Turbo + 5 NeXT_TurboC + 6 Unknown + 7 Unknown + 8 NeXT_TurboCube + 9 NeXT_TurboCubeC + + 68040-25: 00011102 + 68040-25: 00013002 (non-turbo, color) + */ + + return scr1; +} + +// Interrupt subsystem +// source bit level +// nmi 31 7 * +// pfail 30 7 +// timer 29 6 * +// enetxdma 28 6 * +// enetrdma 27 6 * +// scsidma 26 6 * +// diskdma 25 6 +// prndma 24 6 * +// sndoutdma 23 6 +// sndindma 22 6 +// sccdma 21 6 +// dspdma 20 6 +// m2rdma 19 6 +// r2mdma 18 6 +// scc 17 5 +// remote 16 5 * +// bus 15 5 * +// dsp4 14 4 +// disk/cvid 13 3 +// scsi 12 3 * +// printer 11 3 +// enetx 10 3 * +// enetr 9 3 +// soundovr 8 3 * +// phone 7 3 * -- floppy +// dsp3 6 3 +// video 5 3 +// monitor 4 3 +// kbdmouse 3 3 * +// power 2 3 * +// softint1 1 2 * +// softint0 0 1 * + +void next_state::irq_set(int id, bool raise) +{ + UINT32 mask = 1U << id; + UINT32 old_status = irq_status; + if(raise) + irq_status |= mask; + else + irq_status &= ~mask; + if(old_status != irq_status) + irq_check(); +} + + +READ32_MEMBER( next_state::irq_status_r ) +{ + return irq_status; +} + +READ32_MEMBER( next_state::irq_mask_r ) +{ + return irq_mask; +} + +WRITE32_MEMBER( next_state::irq_mask_w ) +{ + COMBINE_DATA(&irq_mask); + irq_check(); +} + +void next_state::irq_check() +{ + UINT32 act = irq_status & (irq_mask | 0x80000000); + int bit; + for(bit=31; bit >= 0 && !(act & (1U << bit)); bit--); + + int level; + if (bit < 0) level = 0; + else if(bit < 1) level = 1; + else if(bit < 2) level = 2; + else if(bit < 14) level = 3; + else if(bit < 15) level = 4; + else if(bit < 18) level = 5; + else if(bit < 30) level = 6; + else level = 7; + + logerror("IRQ info %08x/%08x - %d\n", irq_status, irq_mask, level); + + if(level != irq_level) { + maincpu->set_input_line(irq_level, CLEAR_LINE); + maincpu->set_input_line_and_vector(level, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + irq_level = level; + } +} + +const char *next_state::dma_targets[0x20] = { + 0, "scsi", 0, 0, "soundout", "disk", 0, 0, + "soundin", "printer", 0, 0, "scc", "dsp", 0, 0, + "s-enetx", "enetx", 0, 0, "s-enetr", "enetr", 0, 0, + "video", 0, 0, 0, "r2m", "m2r", 0, 0 +}; + +const int next_state::dma_irqs[0x20] = { + -1, 26, -1, -1, 23, 25, -1, -1, 22, 24, -1, -1, 21, 20, -1, -1, + -1, 28, -1, -1, -1, 27, -1, -1, 5, -1, -1, -1, 18, 19, -1, -1 +}; + +const bool next_state::dma_has_saved[0x20] = { + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, false, true, false, false, + false, false, false, false, false, false, false, false, +}; + +const char *next_state::dma_name(int slot) +{ + static char buf[32]; + if(dma_targets[slot]) + return dma_targets[slot]; + sprintf(buf, "<%02x>", slot); + return buf; +} + +void next_state::dma_drq_w(int slot, bool state) +{ + // fprintf(stderr, "DMA drq_w %d, %d\n", slot, state); + dma_slot &ds = dma_slots[slot]; + ds.drq = state; + if(state && (ds.state & DMA_ENABLE)) { + address_space &space = maincpu->space(AS_PROGRAM); + if(ds.state & DMA_READ) { + while(ds.drq) { + dma_check_update(slot); + UINT8 val; + bool eof; + bool err; + dma_read(slot, val, eof, err); + if(err) { + ds.state = (ds.state & ~DMA_ENABLE) | DMA_BUSEXC; + logerror("DMA: bus error on read slot %d\n", slot); + return; + } + space.write_byte(ds.current++, val); + dma_check_end(slot, eof); + if(!(ds.state & DMA_ENABLE)) + return; + } + } else { + while(ds.drq) { + dma_check_update(slot); + UINT8 val = space.read_byte(ds.current++); + bool eof = ds.current == (ds.limit & 0x7fffffff) && (ds.limit & 0x80000000); + bool err; + dma_write(slot, val, eof, err); + if(err) { + ds.state = (ds.state & ~DMA_ENABLE) | DMA_BUSEXC; + logerror("DMA: bus error on write slot %d\n", slot); + return; + } + dma_check_end(slot, false); + if(!(ds.state & DMA_ENABLE)) + return; + } + } + } +} + +void next_state::dma_read(int slot, UINT8 &val, bool &eof, bool &err) +{ + err = false; + eof = false; + switch(slot) { + case 1: + if(fdc && fdc->get_drq()) { + val = fdc->dma_r(); + if(eof) { + fdc->tc_w(true); + fdc->tc_w(false); + } + } else + val = scsi->dma_r(); + break; + + case 5: + val = mo->dma_r(); + break; + + case 21: + net->rx_dma_r(val, eof); + logerror("dma read net %02x %s\n", val, eof ? "eof" : ""); + break; + + default: + err = true; + val = 0; + break; + } +} + +void next_state::dma_write(int slot, UINT8 data, bool eof, bool &err) +{ + err = false; + switch(slot) { + case 1: + if(fdc && fdc->get_drq()) { + fdc->dma_w(data); + if(eof) { + fdc->tc_w(true); + fdc->tc_w(false); + } + } else + scsi->dma_w(data); + break; + + case 4: + break; + + case 5: + mo->dma_w(data); + break; + + case 17: + net->tx_dma_w(data, eof); + break; + + default: + err = true; + break; + } +} + +void next_state::dma_check_update(int slot) +{ + dma_slot &ds = dma_slots[slot]; + if(ds.restart) { + ds.current = ds.start; + ds.restart = false; + } +} + +void next_state::dma_end(int slot) +{ + dma_slot &ds = dma_slots[slot]; + if(dma_has_saved[slot]) { + dma_slot &ds1 = dma_slots[(slot-1) & 31]; + ds1.current = ds.start; + ds1.limit = ds.current; + } + + if(!ds.supdate) + ds.state &= ~DMA_ENABLE; + else { + ds.start = ds.chain_start; + ds.limit = ds.chain_limit; + ds.restart = true; + ds.supdate = false; + ds.state &= ~DMA_SUPDATE; + } + ds.state |= DMA_COMPLETE; + logerror("dma end slot %d irq %d\n", slot, dma_irqs[slot]); + if(dma_irqs[slot] >= 0) + irq_set(dma_irqs[slot], true); +} + +void next_state::dma_check_end(int slot, bool eof) +{ + dma_slot &ds = dma_slots[slot]; + if(eof || ds.current == (ds.limit & 0x7fffffff)) + dma_end(slot); +} + +READ32_MEMBER( next_state::dma_regs_r) +{ + int slot = offset >> 2; + int reg = offset & 3; + + UINT32 res; + + switch(reg) { + case 0: + res = dma_slots[slot].current; + break; + case 1: + res = dma_slots[slot].limit; + break; + case 2: + res = dma_slots[slot].chain_start; + break; + case 3: default: + res = dma_slots[slot].chain_limit; + break; + } + + const char *name = dma_name(slot); + logerror("dma_regs_r %s:%d %08x (%08x)\n", name, reg, res, space.device().safe_pc()); + + return res; +} + +WRITE32_MEMBER( next_state::dma_regs_w) +{ + int slot = offset >> 2; + int reg = offset & 3; + + const char *name = dma_name(slot); + + logerror("dma_regs_w %s:%d %08x (%08x)\n", name, reg, data, space.device().safe_pc()); + switch(reg) { + case 0: + dma_slots[slot].start = data; + dma_slots[slot].current = data; + break; + case 1: + dma_slots[slot].limit = data; + break; + case 2: + dma_slots[slot].chain_start = data; + break; + case 3: + dma_slots[slot].chain_limit = data; + break; + } +} + +READ32_MEMBER( next_state::dma_ctrl_r) +{ + int slot = offset >> 2; + int reg = offset & 3; + + const char *name = dma_name(slot); + + if(space.device().safe_pc() != 0x409bb4e) + logerror("dma_ctrl_r %s:%d %02x (%08x)\n", name, reg, dma_slots[slot].state, space.device().safe_pc()); + + return reg ? 0 : dma_slots[slot].state << 24; +} + +WRITE32_MEMBER( next_state::dma_ctrl_w) +{ + int slot = offset >> 2; + int reg = offset & 3; + const char *name = dma_name(slot); + logerror("dma_ctrl_w %s:%d %08x @ %08x (%08x)\n", name, reg, data, mem_mask, space.device().safe_pc()); + if(!reg) { + if(ACCESSING_BITS_16_23) + dma_do_ctrl_w(slot, data >> 16); + else if(ACCESSING_BITS_24_31) + dma_do_ctrl_w(slot, data >> 24); + } +} + +void next_state::dma_do_ctrl_w(int slot, UINT8 data) +{ + const char *name = dma_name(slot); +#if 0 + fprintf(stderr, "dma_ctrl_w %s %02x (%08x)\n", name, data, maincpu->pc()); + + fprintf(stderr, " ->%s%s%s%s%s%s%s\n", + data & DMA_SETENABLE ? " enable" : "", + data & DMA_SETSUPDATE ? " supdate" : "", + data & DMA_SETREAD ? " read" : "", + data & DMA_CLRCOMPLETE ? " complete" : "", + data & DMA_RESET ? " reset" : "", + data & DMA_INITBUF ? " initbuf" : "", + data & DMA_INITBUFTURBO ? " initbufturbo" : ""); +#endif + if(data & DMA_SETENABLE) + logerror("dma enable %s %s %08x (%08x)\n", name, data & DMA_SETREAD ? "read" : "write", (dma_slots[slot].limit-dma_slots[slot].start) & 0x7fffffff, maincpu->pc()); + + dma_slot &ds = dma_slots[slot]; + if(data & (DMA_RESET|DMA_INITBUF|DMA_INITBUFTURBO)) { + ds.state = 0; + if(dma_irqs[slot] >= 0) + irq_set(dma_irqs[slot], false); + } + if(data & DMA_SETSUPDATE) { + ds.state |= DMA_SUPDATE; + ds.supdate = true; + } + if(data & DMA_SETREAD) + ds.state |= DMA_READ; + if(data & DMA_CLRCOMPLETE) { + ds.state &= ~DMA_COMPLETE; + if(dma_irqs[slot] >= 0) + irq_set(dma_irqs[slot], false); + } + if(data & DMA_SETENABLE) { + ds.state |= DMA_ENABLE; + // fprintf(stderr, "dma slot %d drq=%s\n", slot, ds.drq ? "on" : "off"); + if(ds.drq) + dma_drq_w(slot, ds.drq); + } +} + +const int next_state::scsi_clocks[4] = { 10000000, 12000000, 20000000, 16000000 }; + +READ32_MEMBER( next_state::scsictrl_r ) +{ + UINT32 res = (scsictrl << 24) | (scsistat << 16); + logerror("scsictrl_read %08x @ %08x (%08x)\n", res, mem_mask, space.device().safe_pc()); + return res; +} + +WRITE32_MEMBER( next_state::scsictrl_w ) +{ + if(ACCESSING_BITS_24_31) { + scsictrl = data >> 24; + if(scsictrl & 0x02) + scsi->reset(); + device_t::static_set_clock(*scsi, scsi_clocks[scsictrl >> 6]); + + logerror("SCSIctrl %dMHz int=%s dma=%s dmadir=%s%s%s dest=%s (%08x)\n", + scsi_clocks[scsictrl >> 6]/1000000, + scsictrl & 0x20 ? "on" : "off", + scsictrl & 0x10 ? "on" : "off", + scsictrl & 0x08 ? "read" : "write", + scsictrl & 0x04 ? " flush" : "", + scsictrl & 0x02 ? " reset" : "", + scsictrl & 0x01 ? "wd3392" : "ncr5390", + space.device().safe_pc()); + } + if(ACCESSING_BITS_16_23) { + scsistat = data >> 16; + logerror("SCSIstat %02x (%08x)\n", data, space.device().safe_pc()); + } +} + +READ32_MEMBER( next_state::event_counter_r) +{ + // Event counters, around that time, are usually fixed-frequency counters. + // This one being 1MHz seems to make sense + + // The v74 rom seems pretty convinced that it's 20 bits only. + + if(ACCESSING_BITS_24_31) + eventc_latch = machine().time().as_ticks(1000000) & 0xfffff; + return eventc_latch; +} + +READ32_MEMBER( next_state::dsp_r) +{ + return 0x7fffffff; +} + +WRITE32_MEMBER( next_state::fdc_control_w ) +{ + logerror("FDC write %02x (%08x)\n", data >> 24, space.device().safe_pc()); +} + +READ32_MEMBER( next_state::fdc_control_r ) +{ + // Type of floppy present + // 0 = no floppy in drive + // 1 = ed + // 2 = hd + // 3 = dd + + // The rom strangely can't boot on anything else than ED, it has + // code for the other densities but forces ED for some mysterious + // reason. The kernel otoh behaves as expected. + + if(fdc) { + floppy_image_device *fdev = machine().device(":fdc:0")->get_device(); + if(fdev->exists()) { + UINT32 variant = fdev->get_variant(); + switch(variant) { + case floppy_image::SSSD: + case floppy_image::SSDD: + case floppy_image::DSDD: + return 3 << 24; + + case floppy_image::DSHD: + return 2 << 24; + + case floppy_image::DSED: + return 1 << 24; + } + } + } + + return 0 << 24; +} + +READ32_MEMBER( next_state::phy_r ) +{ + logerror("phy_r %d %08x (%08x)\n", offset, phy[offset], space.device().safe_pc()); + return phy[offset] | (0 << 24); +} + +WRITE32_MEMBER( next_state::phy_w ) +{ + COMBINE_DATA(phy+offset); + logerror("phy_w %d %08x (%08x)\n", offset, phy[offset], space.device().safe_pc()); +} + +void next_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + irq_set(29, true); + timer_data = timer_next_data; + if(timer_ctrl & 0x40000000) + timer_start(); + else + timer_ctrl &= 0x7fffffff; +} + +READ32_MEMBER( next_state::timer_data_r ) +{ + if(timer_ctrl & 0x80000000) + timer_update(); + return timer_data; +} + +WRITE32_MEMBER( next_state::timer_data_w ) +{ + if(timer_ctrl & 0x80000000) { + COMBINE_DATA(&timer_next_data); + timer_next_data &= 0xffff0000; + } else { + COMBINE_DATA(&timer_data); + timer_data &= 0xffff0000; + } +} + +READ32_MEMBER( next_state::timer_ctrl_r ) +{ + irq_set(29, false); + return timer_ctrl; +} + +WRITE32_MEMBER( next_state::timer_ctrl_w ) +{ + bool oldact = timer_ctrl & 0x80000000; + COMBINE_DATA(&timer_ctrl); + bool newact = timer_ctrl & 0x80000000; + if(oldact != newact) { + if(oldact) { + timer_update(); + irq_set(29, false); + } else { + timer_next_data = timer_data; + timer_start(); + } + } +} + +void next_state::timer_update() +{ + int delta = timer_vbase - (machine().time() - timer_tbase).as_ticks(1000000); + if(delta < 0) + delta = 0; + timer_data = delta << 16; +} + +void next_state::timer_start() +{ + timer_tbase = machine().time(); + timer_vbase = timer_data >> 16; + timer_tm->adjust(attotime::from_usec(timer_vbase)); +} + +WRITE_LINE_MEMBER(next_state::scc_irq) +{ + irq_set(17, state); +} + +WRITE_LINE_MEMBER(next_state::keyboard_irq) +{ + irq_set(3, state); +} + +WRITE_LINE_MEMBER(next_state::power_irq) +{ + irq_set(2, state); +} + +WRITE_LINE_MEMBER(next_state::nmi_irq) +{ + irq_set(31, state); +} + +WRITE_LINE_MEMBER(next_state::fdc_irq) +{ + irq_set(7, state); +} + +WRITE_LINE_MEMBER(next_state::fdc_drq) +{ + dma_drq_w(1, state); +} + +WRITE_LINE_MEMBER(next_state::net_tx_irq) +{ + irq_set(10, state); +} + +WRITE_LINE_MEMBER(next_state::net_rx_irq) +{ + irq_set(9, state); +} + +WRITE_LINE_MEMBER(next_state::net_tx_drq) +{ + dma_drq_w(17, state); +} + +WRITE_LINE_MEMBER(next_state::net_rx_drq) +{ + dma_drq_w(21, state); +} + +WRITE_LINE_MEMBER(next_state::mo_irq) +{ + irq_set(13, state); +} + +WRITE_LINE_MEMBER(next_state::mo_drq) +{ + dma_drq_w(5, state); +} + +WRITE_LINE_MEMBER(next_state::scsi_irq) +{ + irq_set(12, state); +} + +WRITE_LINE_MEMBER(next_state::scsi_drq) +{ + dma_drq_w(1, state); +} + +WRITE8_MEMBER(next_state::ramdac_w) +{ + switch(offset) { + case 0: + switch(data) { + case 0x05: + if(screen_color) + irq_set(13, false); + else + irq_set(5, false); + vbl_enabled = false; + break; + + case 0x06: + vbl_enabled = true; + break; + + default: + fprintf(stderr, "ramdac_w %d, %02x\n", offset, data); + break; + } + break; + + default: + fprintf(stderr, "ramdac_w %d, %02x\n", offset, data); + break; + } +} + +void next_state::setup(UINT32 _scr1, int size_x, int size_y, int skip, bool color) +{ + scr1 = _scr1; + screen_sx = size_x; + screen_sy = size_y; + screen_skip = skip; + screen_color = color; +} + +void next_state::machine_start() +{ + save_item(NAME(scr2)); + save_item(NAME(irq_status)); + save_item(NAME(irq_mask)); + save_item(NAME(irq_level)); + save_item(NAME(phy)); + save_item(NAME(scsictrl)); + save_item(NAME(scsistat)); + save_item(NAME(timer_tbase)); + save_item(NAME(timer_vbase)); + save_item(NAME(timer_data)); + save_item(NAME(timer_next_data)); + save_item(NAME(timer_ctrl)); + save_item(NAME(eventc_latch)); + save_item(NAME(esp)); + + for(int i=0; i<0x20; i++) { + save_item(NAME(dma_slots[i].start), i); + save_item(NAME(dma_slots[i].limit), i); + save_item(NAME(dma_slots[i].chain_start), i); + save_item(NAME(dma_slots[i].chain_limit), i); + save_item(NAME(dma_slots[i].current), i); + save_item(NAME(dma_slots[i].state), i); + save_item(NAME(dma_slots[i].supdate), i); + save_item(NAME(dma_slots[i].restart), i); + save_item(NAME(dma_slots[i].drq), i); + } + + timer_tm = timer_alloc(0); + + system_time systime; + machine().base_datetime(systime); + rtc->set_counter(systime.time); +} + +void next_state::machine_reset() +{ + scr2 = 0; + irq_status = 0; + irq_mask = 0; + irq_level = 0; + esp = 0; + scsictrl = 0; + scsistat = 0; + phy[0] = phy[1] = 0; + eventc_latch = 0; + timer_vbase = 0; + timer_data = 0; + timer_next_data = 0; + timer_ctrl = 0; + vbl_enabled = true; + dma_drq_w(4, true); // soundout +} + +void next_state::vblank_w(screen_device &screen, bool vblank_state) +{ + if(vbl_enabled) { + if(screen_color) + irq_set(13, vblank_state); + else + irq_set(5, vblank_state); + } +} + +static ADDRESS_MAP_START( next_mem, AS_PROGRAM, 32, next_state ) + AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("user1", 0) + AM_RANGE(0x01000000, 0x0101ffff) AM_ROM AM_REGION("user1", 0) + AM_RANGE(0x02000000, 0x020001ff) AM_MIRROR(0x300200) AM_READWRITE(dma_ctrl_r, dma_ctrl_w) + AM_RANGE(0x02004000, 0x020041ff) AM_MIRROR(0x300200) AM_READWRITE(dma_regs_r, dma_regs_w) + AM_RANGE(0x02006000, 0x0200600f) AM_MIRROR(0x300000) AM_DEVICE8("net", mb8795_device, map, 0xffffffff) +// AM_RANGE(0x02006010, 0x02006013) AM_MIRROR(0x300000) memory timing + AM_RANGE(0x02007000, 0x02007003) AM_MIRROR(0x300000) AM_READ(irq_status_r) + AM_RANGE(0x02007800, 0x02007803) AM_MIRROR(0x300000) AM_READWRITE(irq_mask_r,irq_mask_w) + AM_RANGE(0x02008000, 0x02008003) AM_MIRROR(0x300000) AM_READ(dsp_r) + AM_RANGE(0x0200c000, 0x0200c003) AM_MIRROR(0x300000) AM_READ(scr1_r) + AM_RANGE(0x0200c800, 0x0200c803) AM_MIRROR(0x300000) AM_READ(rom_map_r) + AM_RANGE(0x0200d000, 0x0200d003) AM_MIRROR(0x300000) AM_READWRITE(scr2_r,scr2_w) +// AM_RANGE(0x0200d800, 0x0200d803) AM_MIRROR(0x300000) RMTINT + AM_RANGE(0x0200e000, 0x0200e00b) AM_MIRROR(0x300000) AM_DEVICE("keyboard", nextkbd_device, amap) +// AM_RANGE(0x0200f000, 0x0200f003) AM_MIRROR(0x300000) printer +// AM_RANGE(0x02010000, 0x02010003) AM_MIRROR(0x300000) brightness + AM_RANGE(0x02012000, 0x0201201f) AM_MIRROR(0x300000) AM_DEVICE8("mo", nextmo_device, map, 0xffffffff) + AM_RANGE(0x02014000, 0x0201400f) AM_MIRROR(0x300000) AM_DEVICE8("scsibus:7:ncr5390", ncr5390_device, map, 0xffffffff) + AM_RANGE(0x02014020, 0x02014023) AM_MIRROR(0x300000) AM_READWRITE(scsictrl_r, scsictrl_w) + AM_RANGE(0x02016000, 0x02016003) AM_MIRROR(0x300000) AM_READWRITE(timer_data_r, timer_data_w) + AM_RANGE(0x02016004, 0x02016007) AM_MIRROR(0x300000) AM_READWRITE(timer_ctrl_r, timer_ctrl_w) + AM_RANGE(0x02018000, 0x02018003) AM_MIRROR(0x300000) AM_DEVREADWRITE8("scc", scc8530_t, reg_r, reg_w, 0xffffffff) +// AM_RANGE(0x02018004, 0x02018007) AM_MIRROR(0x300000) SCC CLK +// AM_RANGE(0x02018190, 0x02018197) AM_MIRROR(0x300000) warp 9c DRAM timing +// AM_RANGE(0x02018198, 0x0201819f) AM_MIRROR(0x300000) warp 9c VRAM timing + AM_RANGE(0x0201a000, 0x0201a003) AM_MIRROR(0x300000) AM_READ(event_counter_r) // EVENTC +// AM_RANGE(0x020c0000, 0x020c0004) AM_MIRROR(0x300000) BMAP + AM_RANGE(0x020c0030, 0x020c0037) AM_MIRROR(0x300000) AM_READWRITE(phy_r, phy_w) + AM_RANGE(0x04000000, 0x07ffffff) AM_RAM //work ram +// AM_RANGE(0x0c000000, 0x0c03ffff) video RAM w A+B-AB function +// AM_RANGE(0x0d000000, 0x0d03ffff) video RAM w (1-A)B function +// AM_RANGE(0x0e000000, 0x0e03ffff) video RAM w ceil(A+B) function +// AM_RANGE(0x0f000000, 0x0f03ffff) video RAM w AB function +// AM_RANGE(0x10000000, 0x1003ffff) main RAM w A+B-AB function +// AM_RANGE(0x14000000, 0x1403ffff) main RAM w (1-A)B function +// AM_RANGE(0x18000000, 0x1803ffff) main RAM w ceil(A+B) function +// AM_RANGE(0x1c000000, 0x1c03ffff) main RAM w AB function +ADDRESS_MAP_END + +static ADDRESS_MAP_START( next_0b_m_nofdc_mem, AS_PROGRAM, 32, next_state ) + AM_RANGE(0x0b000000, 0x0b03ffff) AM_RAM AM_SHARE("vram") + + AM_IMPORT_FROM(next_mem) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( next_fdc_mem, AS_PROGRAM, 32, next_state ) + AM_RANGE(0x02014100, 0x02014107) AM_MIRROR(0x300000) AM_DEVICE8("fdc", n82077aa_device, map, 0xffffffff) + AM_RANGE(0x02014108, 0x0201410b) AM_MIRROR(0x300000) AM_READWRITE(fdc_control_r, fdc_control_w) + + AM_IMPORT_FROM(next_mem) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( next_0b_m_mem, AS_PROGRAM, 32, next_state ) + AM_RANGE(0x0b000000, 0x0b03ffff) AM_RAM AM_SHARE("vram") + + AM_IMPORT_FROM(next_fdc_mem) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( next_0c_m_mem, AS_PROGRAM, 32, next_state ) + AM_RANGE(0x0c000000, 0x0c1fffff) AM_RAM AM_SHARE("vram") + + AM_IMPORT_FROM(next_fdc_mem) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( next_0c_c_mem, AS_PROGRAM, 32, next_state ) + AM_RANGE(0x0c000000, 0x0c1fffff) AM_RAM AM_SHARE("vram") + AM_RANGE(0x02018180, 0x02018183) AM_MIRROR(0x300000) AM_WRITE8(ramdac_w, 0xffffffff) + + AM_IMPORT_FROM(next_fdc_mem) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( next_2c_c_mem, AS_PROGRAM, 32, next_state ) + AM_RANGE(0x2c000000, 0x2c1fffff) AM_RAM AM_SHARE("vram") + AM_RANGE(0x02018180, 0x02018183) AM_MIRROR(0x300000) AM_WRITE8(ramdac_w, 0xffffffff) + + AM_IMPORT_FROM(next_fdc_mem) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( next ) +INPUT_PORTS_END + +FLOPPY_FORMATS_MEMBER( next_state::floppy_formats ) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( next_floppies ) + SLOT_INTERFACE( "35ed", FLOPPY_35_ED ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( next_scsi_devices ) + SLOT_INTERFACE("cdrom", NSCSI_CDROM) + SLOT_INTERFACE("harddisk", NSCSI_HARDDISK) + SLOT_INTERFACE_INTERNAL("ncr5390", NCR5390) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_FRAGMENT( ncr5390 ) + MCFG_DEVICE_CLOCK(10000000) + MCFG_NCR5390_IRQ_HANDLER(DEVWRITELINE(":", next_state, scsi_irq)) + MCFG_NCR5390_DRQ_HANDLER(DEVWRITELINE(":", next_state, scsi_drq)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( next_base, next_state ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(next_state, screen_update) + MCFG_SCREEN_SIZE(1120, 900) + MCFG_SCREEN_VISIBLE_AREA(0, 1120-1, 0, 832-1) + MCFG_SCREEN_VBLANK_DRIVER(next_state, vblank_w) + + // devices + MCFG_NSCSI_BUS_ADD("scsibus") + MCFG_DEVICE_ADD("rtc", MCCS1850, XTAL_32_768kHz) + MCFG_DEVICE_ADD("scc", SCC8530, XTAL_25MHz) + MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(next_state, scc_irq)) + MCFG_DEVICE_ADD("keyboard", NEXTKBD, 0) + MCFG_NEXTKBD_INT_CHANGE_CALLBACK(WRITELINE(next_state, keyboard_irq)) + MCFG_NEXTKBD_INT_POWER_CALLBACK(WRITELINE(next_state, power_irq)) + MCFG_NEXTKBD_INT_NMI_CALLBACK(WRITELINE(next_state, nmi_irq)) + MCFG_NSCSI_ADD("scsibus:0", next_scsi_devices, "harddisk", false) + MCFG_NSCSI_ADD("scsibus:1", next_scsi_devices, "cdrom", false) + MCFG_NSCSI_ADD("scsibus:2", next_scsi_devices, 0, false) + MCFG_NSCSI_ADD("scsibus:3", next_scsi_devices, 0, false) + MCFG_NSCSI_ADD("scsibus:4", next_scsi_devices, 0, false) + MCFG_NSCSI_ADD("scsibus:5", next_scsi_devices, 0, false) + MCFG_NSCSI_ADD("scsibus:6", next_scsi_devices, 0, false) + MCFG_NSCSI_ADD("scsibus:7", next_scsi_devices, "ncr5390", true) + MCFG_DEVICE_CARD_MACHINE_CONFIG("ncr5390", ncr5390) + + MCFG_DEVICE_ADD("net", MB8795, 0) + MCFG_MB8795_TX_IRQ_CALLBACK(WRITELINE(next_state, net_tx_irq)) + MCFG_MB8795_RX_IRQ_CALLBACK(WRITELINE(next_state, net_rx_irq)) + MCFG_MB8795_TX_DRQ_CALLBACK(WRITELINE(next_state, net_tx_drq)) + MCFG_MB8795_RX_DRQ_CALLBACK(WRITELINE(next_state, net_rx_drq)) + + MCFG_DEVICE_ADD("mo", NEXTMO, 0) + MCFG_NEXTMO_IRQ_CALLBACK(WRITELINE(next_state, mo_irq)) + MCFG_NEXTMO_DRQ_CALLBACK(WRITELINE(next_state, mo_drq)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( next, next_base ) + MCFG_CPU_ADD("maincpu", M68030, XTAL_25MHz) + MCFG_CPU_PROGRAM_MAP(next_0b_m_nofdc_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( next_fdc_base, next_base ) + MCFG_N82077AA_ADD("fdc", n82077aa_device::MODE_PS2) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(next_state, fdc_irq)) + MCFG_UPD765_DRQ_CALLBACK(WRITELINE(next_state, fdc_drq)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", next_floppies, "35ed", next_state::floppy_formats) + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "next") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nexts, next_fdc_base ) + MCFG_CPU_ADD("maincpu", M68040, XTAL_25MHz) + MCFG_CPU_PROGRAM_MAP(next_0b_m_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nexts2, next_fdc_base ) + MCFG_CPU_ADD("maincpu", M68040, XTAL_25MHz) + MCFG_CPU_PROGRAM_MAP(next_0b_m_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nextsc, next_fdc_base ) + MCFG_CPU_ADD("maincpu", M68040, XTAL_25MHz) + MCFG_CPU_PROGRAM_MAP(next_2c_c_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nextst, next_fdc_base ) + MCFG_CPU_ADD("maincpu", M68040, XTAL_33MHz) + MCFG_CPU_PROGRAM_MAP(next_0b_m_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nextstc, next_fdc_base ) + MCFG_CPU_ADD("maincpu", M68040, XTAL_33MHz) + MCFG_CPU_PROGRAM_MAP(next_0c_c_mem) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_VISIBLE_AREA(0, 832-1, 0, 624-1) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nextct, next_fdc_base ) + MCFG_CPU_ADD("maincpu", M68040, XTAL_33MHz) + MCFG_CPU_PROGRAM_MAP(next_0c_m_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nextctc, next_fdc_base ) + MCFG_CPU_ADD("maincpu", M68040, XTAL_33MHz) + MCFG_CPU_PROGRAM_MAP(next_0c_c_mem) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_VISIBLE_AREA(0, 832-1, 0, 624-1) +MACHINE_CONFIG_END + +/* ROM definition */ +#define ROM_NEXT_V1 \ + ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) \ + ROM_SYSTEM_BIOS( 0, "v12", "v1.2" ) /* MAC address/serial number word at 0xC: 005AD0 */ \ + ROMX_LOAD( "rev_1.2.bin", 0x0000, 0x10000, CRC(7070bd78) SHA1(e34418423da61545157e36b084e2068ad41c9e24), ROM_BIOS(1)) /* Label: "(C) 1990 NeXT, Inc. // All Rights Reserved. // Release 1.2 // 1142.02", underlabel exists but unknown */ \ + ROM_SYSTEM_BIOS( 1, "v10", "v1.0 v41" ) /* MAC address/serial number word at 0xC: 003090 */ \ + ROMX_LOAD( "rev_1.0_v41.bin", 0x0000, 0x10000, CRC(54df32b9) SHA1(06e3ecf09ab67a571186efd870e6b44028612371), ROM_BIOS(2)) /* Label: "(C) 1989 NeXT, Inc. // All Rights Reserved. // Release 1.0 // 1142.00", underlabel: "MYF // 1.0.41 // 0D5C" */ \ + ROM_SYSTEM_BIOS( 2, "v10p", "v1.0 v41 alternate" ) /* MAC address/serial number word at 0xC: 0023D9 */ \ + ROMX_LOAD( "rev_1.0_proto.bin", 0x0000, 0x10000, CRC(f44974f9) SHA1(09eaf9f5d47e379cfa0e4dc377758a97d2869ddc), ROM_BIOS(3)) /* Label: "(C) 1989 NeXT, Inc. // All Rights Reserved. // Release 1.0 // 1142.00", no underlabel */ + +#define ROM_NEXT_V2 \ + ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) \ + ROM_SYSTEM_BIOS( 0, "v25", "v2.5 v66" ) /* MAC address/serial number word at 0xC: 00F302 */ \ + ROMX_LOAD( "rev_2.5_v66.bin", 0x0000, 0x20000, CRC(f47e0bfe) SHA1(b3534796abae238a0111299fc406a9349f7fee24), ROM_BIOS(1)) \ + ROM_SYSTEM_BIOS( 1, "v24", "v2.4 v65" ) /* MAC address/serial number word at 0xC: 00A634 */ \ + ROMX_LOAD( "rev_2.4_v65.bin", 0x0000, 0x20000, CRC(74e9e541) SHA1(67d195351288e90818336c3a84d55e6a070960d2), ROM_BIOS(2)) \ + ROM_SYSTEM_BIOS( 2, "v22", "v2.2 v63" ) /* MAC address/serial number word at 0xC: 00894C */ \ + ROMX_LOAD( "rev_2.2_v63.bin", 0x0000, 0x20000, CRC(739d7c07) SHA1(48ffe54cf2038782a92a0850337c5c6213c98571), ROM_BIOS(3)) /* Label: "(C) 1990 NeXT Computer, Inc. // All Rights Reserved. // Release 2.1 // 2918.AB" */ \ + ROM_SYSTEM_BIOS( 3, "v21", "v2.1 v59" ) /* MAC address/serial number word at 0xC: 0072FE */ \ + ROMX_LOAD( "rev_2.1_v59.bin", 0x0000, 0x20000, CRC(f20ef956) SHA1(09586c6de1ca73995f8c9b99870ee3cc9990933a), ROM_BIOS(4)) \ + ROM_SYSTEM_BIOS( 4, "v12", "v1.2 v58" ) /* MAC address/serial number word at 0xC: 006372 */ \ + ROMX_LOAD( "rev_1.2_v58.bin", 0x0000, 0x20000, CRC(b815b6a4) SHA1(97d8b09d03616e1487e69d26609487486db28090), ROM_BIOS(5)) /* Label: "V58 // (C) 1990 NeXT, Inc. // All Rights Reserved // Release 1.2 // 1142.02" */ + +#define ROM_NEXT_V3 \ + ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) \ + ROM_SYSTEM_BIOS( 0, "v33", "v3.3 v74" ) /* MAC address/serial number word at 0xC: 123456 */ \ + ROMX_LOAD( "rev_3.3_v74.bin", 0x0000, 0x20000, CRC(fbc3a2cd) SHA1(a9bef655f26f97562de366e4a33bb462e764c929), ROM_BIOS(1)) \ + ROM_SYSTEM_BIOS( 1, "v32", "v3.2 v72" ) /* MAC address/serial number word at 0xC: 012f31 */ \ + ROMX_LOAD( "rev_3.2_v72.bin", 0x0000, 0x20000, CRC(e750184f) SHA1(ccebf03ed090a79c36f761265ead6cd66fb04329), ROM_BIOS(2)) \ + ROM_SYSTEM_BIOS( 2, "v30", "v3.0 v70" ) /* MAC address/serial number word at 0xC: 0106e8 */ \ + ROMX_LOAD( "rev_3.0_v70.bin", 0x0000, 0x20000, CRC(37250453) SHA1(a7e42bd6a25c61903c8ca113d0b9a624325ee6cf), ROM_BIOS(3)) + + +ROM_START(next) + ROM_NEXT_V1 +ROM_END + +ROM_START(nexts) + ROM_NEXT_V2 +ROM_END + +ROM_START(nexts2) + ROM_NEXT_V2 +ROM_END + +ROM_START(nextsc) + ROM_NEXT_V2 +ROM_END + +ROM_START(nextst) + ROM_NEXT_V3 +ROM_END + +ROM_START(nextstc) + ROM_NEXT_V3 +ROM_END + +ROM_START(nextct) + ROM_NEXT_V3 +ROM_END + +ROM_START(nextctc) + ROM_NEXT_V3 +ROM_END + +DRIVER_INIT_MEMBER(next_state,next) +{ + setup(0x00010002, 1120, 832, 2, false); +} + +DRIVER_INIT_MEMBER(next_state,nexts) +{ + setup(0x00011002, 1120, 832, 2, false); +} + +DRIVER_INIT_MEMBER(next_state,nexts2) +{ + setup(0x00012102, 1120, 832, 2, false); +} + +DRIVER_INIT_MEMBER(next_state,nextsc) +{ + setup(0x00013102, 1120, 832, 16, true); +} + +DRIVER_INIT_MEMBER(next_state,nextst) +{ + setup(0x00014103, 1120, 832, 2, false); +} + +DRIVER_INIT_MEMBER(next_state,nextstc) +{ + setup(0x00015103, 832, 624, 0, true); +} + +DRIVER_INIT_MEMBER(next_state,nextct) +{ + setup(0x00018103, 1120, 832, 0, false); +} + +DRIVER_INIT_MEMBER(next_state,nextctc) +{ + setup(0x00019103, 832, 624, 0, true); +} + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, next, 0, 0, next, next, next_state, next, "Next Software Inc", "NeXT Cube", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1990, nexts, 0, 0, nexts, next, next_state, nexts, "Next Software Inc", "NeXTstation", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1990, nexts2, nexts, 0, nexts2, next, next_state, nexts2, "Next Software Inc", "NeXTstation (X15 variant)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1990, nextsc, nexts, 0, nextsc, next, next_state, nextsc, "Next Software Inc", "NeXTstation color", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1990, nextst, 0, 0, nextst, next, next_state, nextst, "Next Software Inc", "NeXTstation turbo", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1990, nextstc, nextst, 0, nextstc, next, next_state, nextstc, "Next Software Inc", "NeXTstation turbo color", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( ????, nextct, nextst, 0, nextct, next, next_state, nextct, "Next Software Inc", "NeXT Cube turbo", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( ????, nextctc, nextst, 0, nextctc, next, next_state, nextctc, "Next Software Inc", "NeXT Cube turbo color", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/ng_aes.c b/src/mame/drivers/ng_aes.c new file mode 100644 index 00000000000..63f49e0823a --- /dev/null +++ b/src/mame/drivers/ng_aes.c @@ -0,0 +1,1641 @@ +// license:??? +// copyright-holders:Bryan McPhail,Fuzz,Ernesto Corvi,Andrew Prime,Zsolt Vasvari +/*************************************************************************** + + Neo-Geo AES hardware + + Credits (from MAME neogeo.c, since this is just a minor edit of that driver): + * This driver was made possible by the research done by + Charles MacDonald. For a detailed description of the Neo-Geo + hardware, please visit his page at: + http://cgfm2.emuviews.com/temp/mvstech.txt + * Presented to you by the Shin Emu Keikaku team. + * The following people have all spent probably far + too much time on this: + AVDB + Bryan McPhail + Fuzz + Ernesto Corvi + Andrew Prime + Zsolt Vasvari + + MESS cartridge support by R. Belmont based on work by Michael Zapf + + Current status: + - Cartridges run. + - Riding Hero runs in slow-mo due to the unemulated comm link MCU in the cartridge. + In MAME if dip SW6 is set to ON to enable link play, it runs the same way! + On AES there are no dipswitches, and so it always tries to talk to the MCU. + + + Neo-Geo CD hardware + + Thanks to: + * The FBA team (Barry Harris) for much of the CDC / CDD code and system details. + ( http://www.barryharris.me.uk/ ) + * Mirko Buffoni for a commented disassembly of the NeoCD bios rom. + + Current status: + - NeoCDZ runs, the original NeoCD does not + - Might think the tray is open? (check) + - Some unknown / unhandled CD commands, code is still a bit messy + - CDDA continues to play during loading, should stop it + - Games using Raster Effects are broken without a kludge + - CPU gets overloaded with IRQs from the timer callback... + - Double Dragon doesn't load, it erases the IRQ table + - might need better handling of the Vector Table Mapping, or better interrupts (see point above) + - Softlist are based on an old Tosec set and should be updated to the TruRip set once we can convert CCD + without throwing away gap data etc. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "includes/neogeo.h" +#include "machine/nvram.h" +#include "cpu/z80/z80.h" +#include "sound/2610intf.h" +#include "imagedev/chd_cd.h" +#include "sound/cdda.h" +#include "machine/megacdcd.h" + + +extern const char layout_neogeo[]; + + + + + +/* Stubs for various functions called by the FBA code, replace with MAME specifics later */ + +UINT8 *NeoSpriteRAM, *NeoTextRAM; +//UINT8* NeoSpriteROM; +//UINT8* NeoTextROM; +UINT8* YM2610ADPCMAROM; +UINT8* NeoZ80ROMActive; + +// was it actually released in eu / asia? +#define NEOCD_REGION_ASIA 3 // IronClad runs with a darkened screen (MVS has the same issue) +#define NEOCD_REGION_EUROPE 2 // ^ +#define NEOCD_REGION_US 1 +#define NEOCD_REGION_JAPAN 0 + + +UINT8 NeoSystem = NEOCD_REGION_JAPAN; + + + + + + + + +class ng_aes_state : public neogeo_state +{ +public: + ng_aes_state(const machine_config &mconfig, device_type type, const char *tag) + : neogeo_state(mconfig, type, tag) + , m_tempcdc(*this,"tempcdc") + , m_io_in2(*this, "IN2") + , m_io_in0(*this, "IN0") + , m_io_in1(*this, "IN1") + , m_io_mj01_p1(*this, "MJ01_P1") + , m_io_mj02_p1(*this, "MJ02_P1") + , m_io_mj03_p1(*this, "MJ03_P1") + , m_io_mj04_p1(*this, "MJ04_P1") + , m_io_mj01_p2(*this, "MJ01_P2") + , m_io_mj02_p2(*this, "MJ02_P2") + , m_io_mj03_p2(*this, "MJ03_P2") + , m_io_mj04_p2(*this, "MJ04_P2") + , m_io_ctrlsel(*this, "CTRLSEL") + { + NeoCDDMAAddress1 = 0; + NeoCDDMAAddress2 = 0; + NeoCDDMAValue1 = 0; + NeoCDDMAValue2 = 0; + NeoCDDMACount = 0; + NeoCDDMAMode = 0; + nIRQAcknowledge = ~0; + nNeoCDIRQVectorAck = 0; + nNeoCDIRQVector = 0; + m_has_sprite_bus = true; + m_has_text_bus = true; + m_has_ymrom_bus = true; + m_has_z80_bus = true; + } + + optional_device m_tempcdc; + + + + void NeoCDDoDMA(address_space& curr_space); + void set_DMA_regs(int offset, UINT16 wordValue); + + DECLARE_READ16_MEMBER(neocd_memcard_r); + DECLARE_WRITE16_MEMBER(neocd_memcard_w); + DECLARE_READ16_MEMBER(neocd_control_r); + DECLARE_WRITE16_MEMBER(neocd_control_w); + DECLARE_READ8_MEMBER(neocd_transfer_r); + DECLARE_WRITE8_MEMBER(neocd_transfer_w); + DECLARE_READ16_MEMBER(aes_in0_r); + DECLARE_READ16_MEMBER(aes_in1_r); + DECLARE_READ16_MEMBER(aes_in2_r); + + DECLARE_INPUT_CHANGED_MEMBER(aes_jp1); + + DECLARE_MACHINE_START(neocd); + DECLARE_MACHINE_START(neogeo); + DECLARE_MACHINE_RESET(neogeo); + DECLARE_MACHINE_RESET(neocd); + + // neoCD + + UINT8 neogeoReadTransfer(UINT32 sekAddress, int is_byte_transfer); + void neogeoWriteTransfer(UINT32 sekAddress, UINT8 byteValue, int is_byte_transfer); + + INT32 nActiveTransferArea; + INT32 nSpriteTransferBank; + INT32 nADPCMTransferBank; + INT32 NeoCDDMAAddress1; + INT32 NeoCDDMAAddress2; + INT32 NeoCDDMAValue1; + INT32 NeoCDDMAValue2; + INT32 NeoCDDMACount; + INT32 NeoCDDMAMode; + INT32 nIRQAcknowledge; + int nNeoCDIRQVectorAck; + int nNeoCDIRQVector; + + bool m_has_sprite_bus; + bool m_has_text_bus; + bool m_has_ymrom_bus; + bool m_has_z80_bus; + + int get_nNeoCDIRQVectorAck(void) { return nNeoCDIRQVectorAck; } + void set_nNeoCDIRQVectorAck(int val) { nNeoCDIRQVectorAck = val; } + int get_nNeoCDIRQVector(void) { return nNeoCDIRQVector; } + void NeoCDIRQUpdate(UINT8 byteValue); + + // from the CDC + void interrupt_callback_type1(void); + void interrupt_callback_type2(void); + void interrupt_callback_type3(void); + + UINT8 nTransferWriteEnable; + + bool prohibit_cdc_irq; // hack? + + UINT32 screen_update_neocd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_DRIVER_INIT(neogeo); + + DECLARE_DRIVER_INIT(neocdz); + DECLARE_DRIVER_INIT(neocdzj); + + IRQ_CALLBACK_MEMBER(neocd_int_callback); + + UINT8 *m_meminternal_data; +protected: + required_ioport m_io_in2; + required_ioport m_io_in0; + required_ioport m_io_in1; + required_ioport m_io_mj01_p1; + required_ioport m_io_mj02_p1; + required_ioport m_io_mj03_p1; + required_ioport m_io_mj04_p1; + required_ioport m_io_mj01_p2; + required_ioport m_io_mj02_p2; + required_ioport m_io_mj03_p2; + required_ioport m_io_mj04_p2; + required_ioport m_io_ctrlsel; + + void common_machine_start(); + INT32 SekIdle(INT32 nCycles); +}; + + + + + + +/************************************* + * + * Memory card + * + *************************************/ + +#define MEMCARD_SIZE 0x0800 + + +/* The NeoCD has an 8kB internal memory card, instead of memcard slots like the MVS and AES */ +READ16_MEMBER(ng_aes_state::neocd_memcard_r) +{ + return m_meminternal_data[offset] | 0xff00; +} + + +WRITE16_MEMBER(ng_aes_state::neocd_memcard_w) +{ + if (ACCESSING_BITS_0_7) + { + m_meminternal_data[offset] = data; + } +} + + + + + + +/************************************* + * + * System control register + * + *************************************/ + + + +READ16_MEMBER(ng_aes_state::neocd_control_r) +{ + UINT32 sekAddress = 0xff0000+ (offset*2); + + switch (sekAddress & 0xFFFF) { + case 0x0016: + return m_tempcdc->nff0016_r(); + + // LC8951 registers + case 0x0100: + return m_tempcdc->segacd_cdc_mode_address_r(space, 0, 0xffff); + case 0x0102: + return m_tempcdc->CDC_Reg_r(); + + // CD mechanism communication + case 0x0160: + return m_tempcdc->neocd_cdd_rx_r(); + + case 0x011C: // region + return ~((0x10 | (NeoSystem & 3)) << 8); + } + + +// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); + + return ~0; +} + + +WRITE16_MEMBER(ng_aes_state::neocd_control_w) +{ + UINT32 sekAddress = 0xff0000+ (offset*2); + UINT16 wordValue = data; + +// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); + int byteValue = wordValue & 0xff; + + switch (sekAddress & 0xFFFE) { + case 0x0002: + + m_tempcdc->nff0002_set(wordValue); + + break; + + case 0x000E: + NeoCDIRQUpdate(wordValue); // irqack + break; + + case 0x0016: + m_tempcdc->nff0016_set(byteValue); + break; + + // DMA controller + case 0x0060: + if (byteValue & 0x40) { + NeoCDDoDMA(space); + } + break; + + case 0x0064: + case 0x0066: + case 0x0068: + case 0x006A: + case 0x006C: + case 0x006E: + case 0x0070: + case 0x0072: + case 0x007E: + set_DMA_regs(sekAddress & 0xFFFE, wordValue); + break; + + // upload DMA controller program + + case 0x0080: + case 0x0082: + case 0x0084: + case 0x0086: + case 0x0088: + case 0x008A: + case 0x008C: + case 0x008E: +// bprintf(PRINT_NORMAL, _T(" - DMA controller program[%02i] -> 0x%04X (PC: 0x%06X)\n"), sekAddress & 0x0F, wordValue, SekGetPC(-1)); + break; + + // LC8951 registers + case 0x0100: + m_tempcdc->segacd_cdc_mode_address_w(space, 0, byteValue, 0xffff); + break; + case 0x0102: + m_tempcdc->CDC_Reg_w(byteValue); + break; + + case 0x0104: +// bprintf(PRINT_NORMAL, _T(" - NGCD 0xE00000 area -> 0x%02X (PC: 0x%06X)\n"), byteValue, SekGetPC(-1)); + if (ACCESSING_BITS_0_7) + { + nActiveTransferArea = byteValue; + } + break; + + case 0x0120: +// bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); + m_has_sprite_bus = false; + break; + case 0x0122: +// bprintf(PRINT_NORMAL, _T(" - NGCD PCM BUSREQ -> 1 (PC: 0x%06X) %x\n"), SekGetPC(-1), byteValue); + m_has_ymrom_bus = false; + break; + case 0x0126: +// bprintf(PRINT_NORMAL, _T(" - NGCD Z80 BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); + m_has_z80_bus = false; + space.machine().scheduler().synchronize(); + m_audiocpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + break; + case 0x0128: +// bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); + m_has_text_bus = false; + break; + case 0x0140: +// bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); + m_has_sprite_bus = true; + m_sprgen->optimize_sprite_data(); + break; + case 0x0142: +// bprintf(PRINT_NORMAL, _T(" - NGCD PCM BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); + m_has_ymrom_bus = true; + break; + case 0x0146: +// bprintf(PRINT_NORMAL, _T(" - NGCD Z80 BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); + m_has_z80_bus = true; + space.machine().scheduler().synchronize(); + m_audiocpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + break; + case 0x0148: +// bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); + m_has_text_bus = true; + break; + + // CD mechanism communication + case 0x0162: + m_tempcdc->neocd_cdd_tx_w(byteValue); + break; + case 0x0164: + m_tempcdc->NeoCDCommsControl(byteValue & 1, byteValue & 2); + break; + + case 0x016c: +// bprintf(PRINT_ERROR, _T(" - NGCD port 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); + //MapVectorTable(!(byteValue == 0xFF)); + if (ACCESSING_BITS_0_7) + { + // even like this doubledr ends up mapping vectors in, then erasing them causing the loading to crash?? + // is there some way to enable write protection on the RAM vector area or is it some IRQ masking issue? + // the games still write to the normal address for this too? + // writes 00 / 01 / ff + printf("MapVectorTable? %04x %04x\n",data,mem_mask); + + //m_bank_vectors->set_entry(data == 0 ? 0 : 1); + m_use_cart_vectors = (data == 0 ? 0 : 1); + } + +//extern INT32 bRunPause; +//bRunPause = 1; + break; + + case 0x016e: +// bprintf(PRINT_IMPORTANT, _T(" - NGCD 0xE00000 area write access %s (0x%02X, PC: 0x%06X)\n"), byteValue ? _T("enabled") : _T("disabled"), byteValue, SekGetPC(-1)); + + nTransferWriteEnable = byteValue; + break; + + case 0x0180: { + // 1 during CD access, 0 otherwise, written frequently + //printf("reset cdc %04x %04x\n",data, mem_mask); + + if (ACCESSING_BITS_0_7) + { + if (data==0x00) + { + // not a good idea, causes hangs + // m_tempcdc->NeoCDCommsReset(); + + // I doubt this is correct either, but we need something to stop + // the interrupts during gameplay and I'm not sure what... + prohibit_cdc_irq = true; + } + else + { + prohibit_cdc_irq = false; + } + } + break; + } + case 0x0182: { + // printf("blah %02x\n", byteValue); + if (byteValue == 0x00) + { + machine().device("ymsnd")->reset(); + m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + } + else m_audiocpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + + break; + } + case 0x01A0: + nSpriteTransferBank = (byteValue & 3) << 20; + break; + case 0x01A2: + nADPCMTransferBank = (byteValue & 1) << 19; + break; + + + default: { +// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); + } + } + +} + + + + +/* + * Handling NeoCD banked RAM + * When the Z80 space is banked in to 0xe00000, only the low byte of each word is used + */ + + +READ8_MEMBER(ng_aes_state::neocd_transfer_r) +{ + UINT32 sekAddress = 0xe00000+ (offset); + int address; + sekAddress ^= 1; + + switch (nActiveTransferArea) { + case 0: // Sprites + address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF)); + + // address is swizzled a bit due to out sprite decoding + if ((address&3)==0) return NeoSpriteRAM[address]; + if ((address&3)==1) return NeoSpriteRAM[address^3]; + if ((address&3)==2) return NeoSpriteRAM[address^3]; + if ((address&3)==3) return NeoSpriteRAM[address]; + + return NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)]; + case 1: // ADPCM + return YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)]; + case 4: // Z80 + if ((sekAddress & 0xfffff) >= 0x20000) return ~0; + return NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1]; + case 5: // Text + return NeoTextRAM[(sekAddress & 0x3FFFF) >> 1]; + } + + return ~0; + +} + +WRITE8_MEMBER(ng_aes_state::neocd_transfer_w) +{ + UINT8 byteValue = data; + UINT32 sekAddress = 0xe00000+ (offset); + + if (!nTransferWriteEnable) { +// return; + } + int address; + + sekAddress ^= 1; + + switch (nActiveTransferArea) { + case 0: // Sprites + address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF)); + + // address is swizzled a bit due to out sprite decoding + if ((address&3)==0) NeoSpriteRAM[address] = byteValue; + if ((address&3)==1) NeoSpriteRAM[address^3] = byteValue; + if ((address&3)==2) NeoSpriteRAM[address^3] = byteValue; + if ((address&3)==3) NeoSpriteRAM[address] = byteValue; + + break; + case 1: // ADPCM + YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue; + break; + case 4: // Z80 + + // kof98 and lresort attempt to write here when the system still has the z80 bank + // it seems they attempt to write regular samples (not even deltat) maybe there is + // some kind of fall-through behavior, or it shouldn't be allowed to select a + // transfer area without the bus? - this should really be checked on hw + if (m_has_z80_bus) + { + YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue; + } + else + { + // printf("sekAddress %08x %02x\n", sekAddress, data); + if ((sekAddress & 0xfffff) >= 0x20000) break; + NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1] = byteValue; + } + break; + case 5: // Text + NeoTextRAM[(sekAddress & 0x3FFFF) >> 1] = byteValue; + break; + } +} + + + +void ng_aes_state::set_DMA_regs(int offset, UINT16 wordValue) +{ + switch (offset) + { + case 0x0064: + NeoCDDMAAddress1 &= 0x0000FFFF; + NeoCDDMAAddress1 |= wordValue << 16; + break; + case 0x0066: + NeoCDDMAAddress1 &= 0xFFFF0000; + NeoCDDMAAddress1 |= wordValue; + break; + case 0x0068: + NeoCDDMAAddress2 &= 0x0000FFFF; + NeoCDDMAAddress2 |= wordValue << 16; + break; + case 0x006A: + NeoCDDMAAddress2 &= 0xFFFF0000; + NeoCDDMAAddress2 |= wordValue; + break; + case 0x006C: + NeoCDDMAValue1 = wordValue; + break; + case 0x006E: + NeoCDDMAValue2 = wordValue; + break; + case 0x0070: + NeoCDDMACount &= 0x0000FFFF; + NeoCDDMACount |= wordValue << 16; + break; + case 0x0072: + NeoCDDMACount &= 0xFFFF0000; + NeoCDDMACount |= wordValue; + break; + + case 0x007E: + NeoCDDMAMode = wordValue; +// bprintf(PRINT_NORMAL, _T(" - DMA controller 0x%2X -> 0x%04X (PC: 0x%06X)\n"), sekAddress & 0xFF, wordValue, SekGetPC(-1)); + break; + + } +} + + + +INT32 ng_aes_state::SekIdle(INT32 nCycles) +{ + return nCycles; +} + + + +/* + * CD-ROM / DMA control + * + * DMA + + FF0061 Write 0x40 means start DMA transfer + FF0064 Source address (in copy mode), Target address (in filll mode) + FF0068 Target address (in copy mode) + FF006C Fill word + FF0070 Words count + FF007E \ + ...... | DMA programming words? NeoGeoCD uses Sanyo Puppet LC8359 chip to + FF008E / interface with CD, and do DMA transfers + + Memory access control + + FF011C DIP SWITCH (Region code) + FF0105 Area Selector (5 = FIX, 0 = SPR, 4 = Z80, 1 = PCM) + FF01A1 Sprite bank selector + FF01A3 PCM bank selector + FF0120 Prepare sprite area for transfer + FF0122 Prepare PCM area for transfer + FF0126 Prepare Z80 area for transfer + FF0128 Prepare Fix area for transfer + FF0140 Terminate work on Spr Area (Sprites must be decoded here) + FF0142 Terminate work on Pcm Area + FF0146 Terminate work on Z80 Area (Z80 needs to be reset) + FF0148 Terminate work on Fix Area + + CD-ROM: + 0xff0102 == 0xF0 start cd transfer + int m=bcd(fast_r8(0x10f6c8)); + int s=bcd(fast_r8(0x10f6c9)); + int f=bcd(fast_r8(0x10f6ca)); + int seccount=fast_r16(0x10f688); + + inisec=((m*60)+s)*75+f; + inisec-=150; + dstaddr=0x111204; // this must come from somewhere + + the value @ 0x10f688 is decremented each time a sector is read until it's 0. + + * + */ + + +void ng_aes_state::NeoCDDoDMA(address_space& curr_space) +{ + // The LC8953 chip has a programmable DMA controller, which is not properly emulated. + // Since the software only uses it in a limited way, we can apply a simple heuristic + // to determnine the requested operation. + + // Additionally, we don't know how many cycles DMA operations take. + // Here, only bus access is used to get a rough approximation -- + // each read/write takes a single cycle, setup and everything else is ignored. + +// bprintf(PRINT_IMPORTANT, _T(" - DMA controller transfer started (PC: 0x%06X)\n"), SekGetPC(-1)); + + switch (NeoCDDMAMode) { + case 0xCFFD: { +// bprintf(PRINT_NORMAL, _T(" adr : 0x%08X - 0x%08X <- address, skip odd bytes\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 8); + + // - DMA controller 0x7E -> 0xCFFD (PC: 0xC07CE2) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) + // - DMA controller program[02] -> 0xE8DA (PC: 0xC07CEE) + // - DMA controller program[04] -> 0x92DA (PC: 0xC07CF4) + // - DMA controller program[06] -> 0x92DB (PC: 0xC07CFA) + // - DMA controller program[08] -> 0x96DB (PC: 0xC07D00) + // - DMA controller program[10] -> 0x96F6 (PC: 0xC07D06) + // - DMA controller program[12] -> 0x2E02 (PC: 0xC07D0C) + // - DMA controller program[14] -> 0xFDFF (PC: 0xC07D12) + + SekIdle(NeoCDDMACount * 4); + + while (NeoCDDMACount--) { + curr_space.write_word(NeoCDDMAAddress1 + 0, NeoCDDMAAddress1 >> 24); + curr_space.write_word(NeoCDDMAAddress1 + 2, NeoCDDMAAddress1 >> 16); + curr_space.write_word(NeoCDDMAAddress1 + 4, NeoCDDMAAddress1 >> 8); + curr_space.write_word(NeoCDDMAAddress1 + 6, NeoCDDMAAddress1 >> 0); + NeoCDDMAAddress1 += 8; + } + + break; + } + + case 0xE2DD: { +// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- 0x%08X - 0x%08X, skip odd bytes\n"), NeoCDDMAAddress2, NeoCDDMAAddress2 + NeoCDDMACount * 2, NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); + + // - DMA controller 0x7E -> 0xE2DD (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0x82BE (PC: 0xC0A194) + // - DMA controller program[04] -> 0x93DA (PC: 0xC0A196) + // - DMA controller program[06] -> 0xBE93 (PC: 0xC0A198) + // - DMA controller program[08] -> 0xDABE (PC: 0xC0A19A) + // - DMA controller program[10] -> 0xF62D (PC: 0xC0A19C) + // - DMA controller program[12] -> 0x02FD (PC: 0xC0A19E) + // - DMA controller program[14] -> 0xFFFF (PC: 0xC0A1A0) + + SekIdle(NeoCDDMACount * 1); + + while (NeoCDDMACount--) { + curr_space.write_word(NeoCDDMAAddress2 + 0, curr_space.read_byte(NeoCDDMAAddress1 + 0)); + curr_space.write_word(NeoCDDMAAddress2 + 2, curr_space.read_byte(NeoCDDMAAddress1 + 1)); + NeoCDDMAAddress1 += 2; + NeoCDDMAAddress2 += 4; + } + + break; + } + + case 0xFC2D: { +// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- LC8951 external buffer, skip odd bytes\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); + + // - DMA controller 0x7E -> 0xFC2D (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0x8492 (PC: 0xC0A194) + // - DMA controller program[04] -> 0xDA92 (PC: 0xC0A196) + // - DMA controller program[06] -> 0xDAF6 (PC: 0xC0A198) + // - DMA controller program[08] -> 0x2A02 (PC: 0xC0A19A) + // - DMA controller program[10] -> 0xFDFF (PC: 0xC0A19C) + // - DMA controller program[12] -> 0x48E7 (PC: 0xC0A19E) + // - DMA controller program[14] -> 0xFFFE (PC: 0xC0A1A0) + + char* data = m_tempcdc->LC8915InitTransfer(NeoCDDMACount); + if (data == NULL) { + break; + } + + SekIdle(NeoCDDMACount * 4); + + while (NeoCDDMACount--) { + curr_space.write_byte(NeoCDDMAAddress1 + 0, data[0]); + curr_space.write_byte(NeoCDDMAAddress1 + 2, data[1]); + NeoCDDMAAddress1 += 4; + data += 2; + } + + m_tempcdc->LC8915EndTransfer(); + + break; + } + + case 0xFE3D: + + // - DMA controller 0x7E -> 0xFE3D (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0x82BF (PC: 0xC0A194) + // - DMA controller program[04] -> 0x93BF (PC: 0xC0A196) + // - DMA controller program[06] -> 0xF629 (PC: 0xC0A198) + // - DMA controller program[08] -> 0x02FD (PC: 0xC0A19A) + // - DMA controller program[10] -> 0xFFFF (PC: 0xC0A19C) + // - DMA controller program[12] -> 0xF17D (PC: 0xC0A19E) + // - DMA controller program[14] -> 0xFCF5 (PC: 0xC0A1A0) + + case 0xFE6D: { +// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- 0x%08X - 0x%08X\n"), NeoCDDMAAddress2, NeoCDDMAAddress2 + NeoCDDMACount * 2, NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2); + + // - DMA controller 0x7E -> 0xFE6D (PC: 0xC0FD7A) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0FD7C) + // - DMA controller program[02] -> 0x82BF (PC: 0xC0FD7E) + // - DMA controller program[04] -> 0xF693 (PC: 0xC0FD80) + // - DMA controller program[06] -> 0xBF29 (PC: 0xC0FD82) + // - DMA controller program[08] -> 0x02FD (PC: 0xC0FD84) + // - DMA controller program[10] -> 0xFFFF (PC: 0xC0FD86) + // - DMA controller program[12] -> 0xC515 (PC: 0xC0FD88) + // - DMA controller program[14] -> 0xFCF5 (PC: 0xC0FD8A) + + SekIdle(NeoCDDMACount * 1); + + while (NeoCDDMACount--) { + curr_space.write_word(NeoCDDMAAddress2, curr_space.read_word(NeoCDDMAAddress1)); + NeoCDDMAAddress1 += 2; + NeoCDDMAAddress2 += 2; + } + +if (NeoCDDMAAddress2 == 0x0800) { +// MapVectorTable(false); +// bprintf(PRINT_ERROR, _T(" RAM vectors mapped (PC = 0x%08X\n"), SekGetPC(0)); +// extern INT32 bRunPause; +// bRunPause = 1; +} + break; + } + + case 0xFEF5: { +// bprintf(PRINT_NORMAL, _T(" adr : 0x%08X - 0x%08X <- address\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); + + // - DMA controller 0x7E -> 0xFEF5 (PC: 0xC07CE2) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) + // - DMA controller program[02] -> 0x92E8 (PC: 0xC07CEE) + // - DMA controller program[04] -> 0xBE96 (PC: 0xC07CF4) + // - DMA controller program[06] -> 0xF629 (PC: 0xC07CFA) + // - DMA controller program[08] -> 0x02FD (PC: 0xC07D00) + // - DMA controller program[10] -> 0xFFFF (PC: 0xC07D06) + // - DMA controller program[12] -> 0xFC3D (PC: 0xC07D0C) + // - DMA controller program[14] -> 0xFCF5 (PC: 0xC07D12) + + SekIdle(NeoCDDMACount * 2); + + while (NeoCDDMACount--) { + curr_space.write_word(NeoCDDMAAddress1 + 0, NeoCDDMAAddress1 >> 16); + curr_space.write_word(NeoCDDMAAddress1 + 2, NeoCDDMAAddress1 >> 0); + NeoCDDMAAddress1 += 4; + } + + break; + } + + case 0xFFC5: { +// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- LC8951 external buffer\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2); + + // - DMA controller 0x7E -> 0xFFC5 (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0xA6F6 (PC: 0xC0A194) + // - DMA controller program[04] -> 0x2602 (PC: 0xC0A196) + // - DMA controller program[06] -> 0xFDFF (PC: 0xC0A198) + // - DMA controller program[08] -> 0xFC2D (PC: 0xC0A19A) + // - DMA controller program[10] -> 0xFCF5 (PC: 0xC0A19C) + // - DMA controller program[12] -> 0x8492 (PC: 0xC0A19E) + // - DMA controller program[14] -> 0xDA92 (PC: 0xC0A1A0) + + char* data = m_tempcdc->LC8915InitTransfer(NeoCDDMACount); + if (data == NULL) { + break; + } + + SekIdle(NeoCDDMACount * 4); + + while (NeoCDDMACount--) { + curr_space.write_byte(NeoCDDMAAddress1 + 0, data[0]); + curr_space.write_byte(NeoCDDMAAddress1 + 1, data[1]); + NeoCDDMAAddress1 += 2; + data += 2; + } + + m_tempcdc->LC8915EndTransfer(); + + break; + } + + case 0xFFCD: + + // - DMA controller 0x7E -> 0xFFCD (PC: 0xC0A190) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) + // - DMA controller program[02] -> 0x92F6 (PC: 0xC0A194) + // - DMA controller program[04] -> 0x2602 (PC: 0xC0A196) + // - DMA controller program[06] -> 0xFDFF (PC: 0xC0A198) + // - DMA controller program[08] -> 0x7006 (PC: 0xC0A19A) + // - DMA controller program[10] -> 0x6100 (PC: 0xC0A19C) + // - DMA controller program[12] -> 0x2412 (PC: 0xC0A19E) + // - DMA controller program[14] -> 0x13FC (PC: 0xC0A1A0) + + case 0xFFDD: { +// bprintf(PRINT_NORMAL, _T(" Fill: 0x%08X - 0x%08X <- 0x%04X\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2, NeoCDDMAValue1); + + // - DMA controller 0x7E -> 0xFFDD (PC: 0xC07CE2) + // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) + // - DMA controller program[02] -> 0x92F6 (PC: 0xC07CEE) + // - DMA controller program[04] -> 0x2602 (PC: 0xC07CF4) + // - DMA controller program[06] -> 0xFDFF (PC: 0xC07CFA) + // - DMA controller program[08] -> 0xFFFF (PC: 0xC07D00) + // - DMA controller program[10] -> 0xFCF5 (PC: 0xC07D06) + // - DMA controller program[12] -> 0x8AF0 (PC: 0xC07D0C) + // - DMA controller program[14] -> 0x1609 (PC: 0xC07D12) + + SekIdle(NeoCDDMACount * 1); + + while (NeoCDDMACount--) { + curr_space.write_word(NeoCDDMAAddress1, NeoCDDMAValue1); + NeoCDDMAAddress1 += 2; + } + + break; + } + default: { + //bprintf(PRINT_ERROR, _T(" Unknown transfer type 0x%04X (PC: 0x%06X)\n"), NeoCDDMAMode, SekGetPC(-1)); + //bprintf(PRINT_NORMAL, _T(" ??? : 0x%08X 0x%08X 0x%04X 0x%04X 0x%08X\n"), NeoCDDMAAddress1, NeoCDDMAAddress2, NeoCDDMAValue1, NeoCDDMAValue2, NeoCDDMACount); + +//extern INT32 bRunPause; +//bRunPause = 1; + + } + } +} + + +/* + * Handling selectable controller types + */ + +READ16_MEMBER(ng_aes_state::aes_in0_r) +{ + UINT32 ret = 0xffff; + UINT32 ctrl = m_io_ctrlsel->read(); + + switch(ctrl & 0x0f) + { + case 0x00: + ret = 0xffff; + break; + case 0x01: + ret = m_io_in0->read(); + break; + case 0x02: + switch (m_controller_select) + { + case 0x09: ret = m_io_mj01_p1->read(); break; + case 0x12: ret = m_io_mj02_p1->read(); break; + case 0x1b: ret = m_io_mj03_p1->read(); break; /* player 1 normal inputs? */ + case 0x24: ret = m_io_mj04_p1->read(); break; + default: + ret = m_io_in0->read(); + break; + } + break; + } + + return ret; +} + +READ16_MEMBER(ng_aes_state::aes_in1_r) +{ + UINT32 ret = 0xffff; + UINT32 ctrl = m_io_ctrlsel->read(); + + switch(ctrl & 0xf0) + { + case 0x00: + ret = 0xffff; + break; + case 0x10: + ret = m_io_in1->read(); + break; + case 0x20: + switch (m_controller_select) + { + case 0x09: ret = m_io_mj01_p2->read(); break; + case 0x12: ret = m_io_mj02_p2->read(); break; + case 0x1b: ret = m_io_mj03_p2->read(); break; /* player 2 normal inputs? */ + case 0x24: ret = m_io_mj04_p2->read(); break; + default: + ret = m_io_in1->read(); + break; + } + break; + } + + return ret; +} + + +READ16_MEMBER(ng_aes_state::aes_in2_r) +{ + UINT32 in2 = m_io_in2->read(); + UINT32 ret = in2; + UINT32 sel = m_io_ctrlsel->read(); + + if((sel & 0x02) && (m_controller_select == 0x24)) + ret ^= 0x0200; + + if((sel & 0x20) && (m_controller_select == 0x24)) + ret ^= 0x0800; + + return ret; +} + + +/************************************* + * + * Machine initialization + * + *************************************/ + + +void ng_aes_state::common_machine_start() +{ + /* set the initial main CPU bank */ + neogeo_main_cpu_banking_init(); + + /* set the initial audio CPU ROM banks */ + neogeo_audio_cpu_banking_init(1); + + create_interrupt_timers(); + + /* irq levels for MVS / AES */ + m_vblank_level = 1; + m_raster_level = 2; + + /* start with an IRQ3 - but NOT on a reset */ + m_irq3_pending = 1; + + /* register state save */ + save_item(NAME(m_display_position_interrupt_control)); + save_item(NAME(m_display_counter)); + save_item(NAME(m_vblank_interrupt_pending)); + save_item(NAME(m_display_position_interrupt_pending)); + save_item(NAME(m_irq3_pending)); + save_item(NAME(m_audio_cpu_nmi_enabled)); + save_item(NAME(m_audio_cpu_nmi_pending)); + save_item(NAME(m_controller_select)); + save_item(NAME(m_use_cart_vectors)); + save_item(NAME(m_use_cart_audio)); + //save_item(NAME(m_main_cpu_bank_address)); + + machine().save().register_postload(save_prepost_delegate(FUNC(ng_aes_state::neogeo_postload), this)); + + + m_cartslots[0] = m_cartslot1; + m_cartslots[1] = m_cartslot2; + m_cartslots[2] = m_cartslot3; + m_cartslots[3] = m_cartslot4; + m_cartslots[4] = m_cartslot5; + m_cartslots[5] = m_cartslot6; + + m_sprgen->set_screen(m_screen); + + m_sprgen->set_sprite_region(m_region_sprites->base(), m_region_sprites->bytes()); + m_sprgen->set_fixed_regions(m_region_fixed->base(), m_region_fixed->bytes(), m_region_fixedbios); + +} + +MACHINE_START_MEMBER(ng_aes_state,neogeo) +{ + m_type = NEOGEO_AES; + common_machine_start(); +} + +MACHINE_START_MEMBER(ng_aes_state,neocd) +{ + m_type = NEOGEO_CD; + common_machine_start(); + + /* irq levels for NEOCD (swapped compared to MVS / AES) */ + m_vblank_level = 2; + m_raster_level = 1; + + /* initialize the memcard data structure */ + /* NeoCD doesn't have memcard slots, rather, it has a larger internal memory which works the same */ + m_meminternal_data = auto_alloc_array_clear(machine(), UINT8, 0x2000); + machine().device("saveram")->set_base(m_meminternal_data, 0x2000); + save_pointer(NAME(m_meminternal_data), 0x2000); + + //m_bank_vectors->set_entry(0); // default to the BIOS vectors + m_use_cart_vectors = 0; + + m_tempcdc->reset_cd(); +} + + +/************************************* + * + * Machine reset + * + *************************************/ + +MACHINE_RESET_MEMBER(ng_aes_state,neogeo) +{ + offs_t offs; + address_space &space = m_maincpu->space(AS_PROGRAM); + + /* reset system control registers */ + for (offs = 0; offs < 8; offs++) + system_control_w(space, offs, 0); + + // disable audiocpu nmi + m_audio_cpu_nmi_enabled = false; + m_audio_cpu_nmi_pending = false; + audio_cpu_check_nmi(); + + m_maincpu->reset(); + + start_interrupt_timers(); + + /* trigger the IRQ3 that was set by MACHINE_START */ + update_interrupts(); + + m_recurse = false; + + /* AES has no SFIX ROM and always uses the cartridge's */ + m_sprgen->neogeo_set_fixed_layer_source(1); + + if (m_cartslots[0]) // if thie system has cart slots then do some extra initialization + { + set_slot_number(0); + } + + NeoSpriteRAM = memregion("sprites")->base(); + YM2610ADPCMAROM = memregion("ymsnd")->base(); + NeoZ80ROMActive = memregion("audiocpu")->base(); + NeoTextRAM = memregion("fixed")->base(); +} + +MACHINE_RESET_MEMBER(ng_aes_state,neocd) +{ + MACHINE_RESET_CALL_MEMBER( neogeo ); + + m_tempcdc->NeoCDCommsReset(); + + m_audiocpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + + nTransferWriteEnable = 0; +} + + +/************************************* + * + * Main CPU memory handlers + * + *************************************/ + +static ADDRESS_MAP_START( aes_main_map, AS_PROGRAM, 16, ng_aes_state ) +// AM_RANGE(0x000000, 0x00007f) AM_ROMBANK("vectors") + AM_RANGE(0x000000, 0x00007f) AM_READ(neogeo_slot_rom_low_bectors_r) + AM_RANGE(0x000080, 0x0fffff) AM_ROM + AM_RANGE(0x100000, 0x10ffff) AM_MIRROR(0x0f0000) AM_RAM + /* some games have protection devices in the 0x200000 region, it appears to map to cart space, not surprising, the ROM is read here too */ + //AM_RANGE(0x200000, 0x2fffff) AM_ROMBANK("cartridge") + //AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w) + AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_READ(aes_in0_r) + AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("AUDIO") AM_WRITE8(audio_command_w, 0xff00) + AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ(aes_in1_r) + AM_RANGE(0x360000, 0x37ffff) AM_READ(neogeo_unmapped_r) + AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r) + AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff) + AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(neogeo_unmapped_r) AM_WRITE8(system_control_w, 0x00ff) + AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(neogeo_video_register_r) + AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE(neogeo_video_register_w) + AM_RANGE(0x3e0000, 0x3fffff) AM_READ(neogeo_unmapped_r) + AM_RANGE(0x400000, 0x401fff) AM_MIRROR(0x3fe000) AM_READWRITE(neogeo_paletteram_r, neogeo_paletteram_w) + AM_RANGE(0x800000, 0x800fff) AM_READWRITE(memcard_r, memcard_w) + AM_RANGE(0xc00000, 0xc1ffff) AM_MIRROR(0x0e0000) AM_ROM AM_REGION("mainbios", 0) + AM_RANGE(0xd00000, 0xffffff) AM_READ(neogeo_unmapped_r) +ADDRESS_MAP_END + + + + +static ADDRESS_MAP_START( neocd_main_map, AS_PROGRAM, 16, ng_aes_state ) +// AM_RANGE(0x000000, 0x00007f) AM_READ_BANK("vectors") // writes will fall through to area below + AM_RANGE(0x000000, 0x00007f) AM_READ(banked_vectors_r) + AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_REGION("maincpu", 0x00000) + + AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_READ(aes_in0_r) + AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("AUDIO") AM_WRITE8(audio_command_w, 0xff00) + AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ(aes_in1_r) + AM_RANGE(0x360000, 0x37ffff) AM_READ(neogeo_unmapped_r) + AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r) + AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff) + AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(neogeo_unmapped_r) AM_WRITE8(system_control_w, 0x00ff) + AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(neogeo_video_register_r) + AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE(neogeo_video_register_w) + AM_RANGE(0x3e0000, 0x3fffff) AM_READ(neogeo_unmapped_r) + AM_RANGE(0x400000, 0x401fff) AM_MIRROR(0x3fe000) AM_READWRITE(neogeo_paletteram_r, neogeo_paletteram_w) + AM_RANGE(0x800000, 0x803fff) AM_READWRITE(neocd_memcard_r, neocd_memcard_w) + AM_RANGE(0xc00000, 0xc7ffff) AM_MIRROR(0x080000) AM_ROM AM_REGION("mainbios", 0) + AM_RANGE(0xd00000, 0xdfffff) AM_READ(neogeo_unmapped_r) + AM_RANGE(0xe00000, 0xefffff) AM_READWRITE8(neocd_transfer_r,neocd_transfer_w, 0xffff) + AM_RANGE(0xf00000, 0xfeffff) AM_READ(neogeo_unmapped_r) + AM_RANGE(0xff0000, 0xff01ff) AM_READWRITE(neocd_control_r, neocd_control_w) // CDROM / DMA + AM_RANGE(0xff0200, 0xffffff) AM_READ(neogeo_unmapped_r) +ADDRESS_MAP_END + + + + + +/************************************* + * + * Audio CPU port handlers + * + *************************************/ + + +static ADDRESS_MAP_START( neocd_audio_map, AS_PROGRAM, 8, ng_aes_state ) + AM_RANGE(0x0000, 0xffff) AM_RAM AM_REGION("audiocpu", 0x00000) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( neocd_audio_io_map, AS_IO, 8, ng_aes_state ) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(audio_command_r, soundlatch_clear_byte_w) + AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) + AM_RANGE(0x08, 0x08) AM_MIRROR(0xff10) AM_MASK(0x0010) AM_WRITE(audio_cpu_enable_nmi_w) + // banking reads are actually NOP on NeoCD? but some games still access them +// AM_RANGE(0x08, 0x0b) AM_MIRROR(0xfff0) AM_MASK(0xff03) AM_READ(audio_cpu_bank_select_r) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_WRITE(soundlatch2_byte_w) + + // ?? + AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_WRITENOP + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0xff00) AM_WRITENOP + AM_RANGE(0xc1, 0xc1) AM_MIRROR(0xff00) AM_WRITENOP +ADDRESS_MAP_END + + +/************************************* + * + * Input port definitions + * + *************************************/ + + +static INPUT_PORTS_START( controller ) + PORT_START("IN0") + PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) + + + PORT_START("IN1") + PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) +INPUT_PORTS_END + +static INPUT_PORTS_START( mjpanel ) + PORT_START("MJ01_P1") + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("MJ02_P1") + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + + PORT_START("MJ03_P1") + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + + PORT_START("MJ04_P1") + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("MJ01_P2") + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("MJ02_P2") + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("MJ03_P2") + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + + PORT_START("MJ04_P2") + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) +INPUT_PORTS_END + +static INPUT_PORTS_START( aes ) + PORT_START("CTRLSEL") /* Select Controller Type */ + PORT_CONFNAME( 0x0f, 0x01, "P1 Controller") + PORT_CONFSETTING( 0x00, "Unconnected" ) + PORT_CONFSETTING( 0x01, "NeoGeo Controller" ) + PORT_CONFSETTING( 0x02, "NeoGeo Mahjong Panel" ) + PORT_CONFNAME( 0xf0, 0x10, "P2 Controller") + PORT_CONFSETTING( 0x00, "Unconnected" ) + PORT_CONFSETTING( 0x10, "NeoGeo Controller" ) + PORT_CONFSETTING( 0x20, "NeoGeo Mahjong Panel" ) + + PORT_INCLUDE( controller ) + + PORT_INCLUDE( mjpanel ) + + PORT_START("IN2") + PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SELECT ) PORT_PLAYER(1) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SELECT ) PORT_PLAYER(2) + PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state, get_memcard_status, NULL) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* Hardware type (AES=0, MVS=1) Some games check this and show a piracy warning screen if the hardware and BIOS don't match */ + + PORT_START("AUDIO") + PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_UNUSED ) /* AES has no coin slots, it's a console */ + PORT_BIT( 0x0018, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* what is this? Universe BIOS uses these bits to detect MVS or AES hardware */ + PORT_BIT( 0x00e0, IP_ACTIVE_HIGH, IPT_UNUSED ) /* AES has no upd4990a */ + PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state, get_audio_result, NULL) + + PORT_START("JP") // JP1 and JP2 are jumpers or solderpads depending on AES board revision, intended for use on the Development BIOS + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Short JP1 (Debug Monitor)") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, ng_aes_state, aes_jp1, 0) +// PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) // what is JP2 for? somehow related to system reset, disable watchdog? +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(ng_aes_state::aes_jp1) +{ + // Shorting JP1 causes a 68000 /BERR (Bus Error). On Dev Bios, this pops up the debug monitor. + if (newval) + m_maincpu->set_input_line(M68K_LINE_BUSERROR, HOLD_LINE); +} + + +static INPUT_PORTS_START( neocd ) + PORT_INCLUDE( aes ) + + PORT_MODIFY("IN2") + PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_UNUSED ) // the NeoCD memcard is internal +INPUT_PORTS_END + + +/************************************* + * + * Machine driver + * + *************************************/ + + +static MACHINE_CONFIG_DERIVED_CLASS( aes, neogeo_base, ng_aes_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(aes_main_map) + + MCFG_NEOGEO_MEMCARD_ADD("memcard") + + MCFG_MACHINE_START_OVERRIDE(ng_aes_state, neogeo) + MCFG_MACHINE_RESET_OVERRIDE(ng_aes_state, neogeo) + + MCFG_NEOGEO_CARTRIDGE_ADD("cartslot1", neogeo_cart, NULL) + + MCFG_SOFTWARE_LIST_ADD("cart_list","neogeo") + MCFG_SOFTWARE_LIST_FILTER("cart_list","AES") +MACHINE_CONFIG_END + + +/* NeoCD uses custom vectors on IRQ4 to handle various events from the CDC */ + +IRQ_CALLBACK_MEMBER(ng_aes_state::neocd_int_callback) +{ + if (irqline==4) + { + if (get_nNeoCDIRQVectorAck()) { + set_nNeoCDIRQVectorAck(0); + return get_nNeoCDIRQVector(); + } + } + + return (0x60+irqline*4)/4; +} + +void ng_aes_state::interrupt_callback_type1(void) +{ + nIRQAcknowledge &= ~0x20; + NeoCDIRQUpdate(0); +} + +void ng_aes_state::interrupt_callback_type2(void) +{ + nIRQAcknowledge &= ~0x10; + NeoCDIRQUpdate(0); +} + +void ng_aes_state::interrupt_callback_type3(void) +{ + nIRQAcknowledge &= ~0x08; + NeoCDIRQUpdate(0); +} + + +void ng_aes_state::NeoCDIRQUpdate(UINT8 byteValue) +{ + // do we also need to check the regular interrupts like FBA? + + nIRQAcknowledge |= (byteValue & 0x38); + + if (!prohibit_cdc_irq) + { + if ((nIRQAcknowledge & 0x08) == 0) { + nNeoCDIRQVector = 0x17; + nNeoCDIRQVectorAck = 1; + m_maincpu->set_input_line(4, HOLD_LINE); + return; + } + if ((nIRQAcknowledge & 0x10) == 0) { + nNeoCDIRQVector = 0x16; + nNeoCDIRQVectorAck = 1; + m_maincpu->set_input_line(4, HOLD_LINE); + return; + } + if ((nIRQAcknowledge & 0x20) == 0) { + nNeoCDIRQVector = 0x15; + nNeoCDIRQVectorAck = 1; + m_maincpu->set_input_line(4, HOLD_LINE); + return; + } + } +} + + +UINT32 ng_aes_state::screen_update_neocd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // fill with background color first + bitmap.fill(*m_bg_pen, cliprect); + + if (m_has_sprite_bus) m_sprgen->draw_sprites(bitmap, cliprect.min_y); + + if (m_has_text_bus) m_sprgen->draw_fixed_layer(bitmap, cliprect.min_y); + + return 0; +} + + +static MACHINE_CONFIG_DERIVED_CLASS( neocd, neogeo_base, ng_aes_state ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(neocd_main_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(ng_aes_state,neocd_int_callback) + + MCFG_CPU_MODIFY("audiocpu") + MCFG_CPU_PROGRAM_MAP(neocd_audio_map) + MCFG_CPU_IO_MAP(neocd_audio_io_map) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(ng_aes_state, screen_update_neocd) + + // temporary until things are cleaned up + MCFG_DEVICE_ADD("tempcdc", LC89510_TEMP, 0) // cd controller + MCFG_SEGACD_HACK_SET_NEOCD + MCFG_SET_TYPE1_INTERRUPT_CALLBACK( ng_aes_state, interrupt_callback_type1 ) + MCFG_SET_TYPE2_INTERRUPT_CALLBACK( ng_aes_state, interrupt_callback_type2 ) + MCFG_SET_TYPE3_INTERRUPT_CALLBACK( ng_aes_state, interrupt_callback_type3 ) + + MCFG_NVRAM_ADD_0FILL("saveram") + + MCFG_MACHINE_START_OVERRIDE(ng_aes_state,neocd) + MCFG_MACHINE_RESET_OVERRIDE(ng_aes_state,neocd) + + MCFG_CDROM_ADD( "cdrom" ) + MCFG_CDROM_INTERFACE("neocd_cdrom") + MCFG_SOFTWARE_LIST_ADD("cd_list","neocd") +MACHINE_CONFIG_END + +/************************************* + * + * Driver initalization + * + *************************************/ + +#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \ + ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios+1)) /* Note '+1' */ + +ROM_START( aes ) + ROM_REGION16_BE( 0x20000, "mainbios", 0 ) + ROM_SYSTEM_BIOS( 0, "asia", "Asia AES" ) + ROM_LOAD16_WORD_SWAP_BIOS( 0, "neo-epo.bin", 0x00000, 0x020000, CRC(d27a71f1) SHA1(1b3b22092f30c4d1b2c15f04d1670eb1e9fbea07) ) /* AES Console (Asia?) Bios */ + ROM_SYSTEM_BIOS( 1, "japan", "Japan AES" ) + ROM_LOAD16_WORD_SWAP_BIOS( 1, "neo-po.bin", 0x00000, 0x020000, CRC(16d0c132) SHA1(4e4a440cae46f3889d20234aebd7f8d5f522e22c) ) /* AES Console (Japan) Bios */ + ROM_SYSTEM_BIOS( 2, "devel", "Development System ROM" ) + ROM_LOAD16_WORD_SWAP_BIOS( 2, "neodebug.rom", 0x00000, 0x020000, CRC(698ebb7d) SHA1(081c49aa8cc7dad5939833dc1b18338321ea0a07) ) /* Official debug (development) ROM, for home-use base board */ + ROM_SYSTEM_BIOS( 3, "unibios31", "Universe Bios (Hack, Ver. 3.1)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 3, "uni-bios_3_1.rom", 0x00000, 0x020000, CRC(0c58093f) SHA1(29329a3448c2505e1ff45ffa75e61e9693165153) ) /* Universe Bios v3.1 (hack) */ + ROM_SYSTEM_BIOS( 4, "unibios30", "Universe Bios (Hack, Ver. 3.0)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 4, "uni-bios_3_0.rom", 0x00000, 0x020000, CRC(a97c89a9) SHA1(97a5eff3b119062f10e31ad6f04fe4b90d366e7f) ) /* Universe Bios v3.0 (hack) */ + ROM_SYSTEM_BIOS( 5, "unibios23", "Universe Bios (Hack, Ver. 2.3)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 5, "uni-bios_2_3.rom", 0x00000, 0x020000, CRC(27664eb5) SHA1(5b02900a3ccf3df168bdcfc98458136fd2b92ac0) ) /* Universe Bios v2.3 (hack) */ + ROM_SYSTEM_BIOS( 6, "unibios23o", "Universe Bios (Hack, Ver. 2.3, older?)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 6, "uni-bios_2_3o.rom", 0x00000, 0x020000, CRC(601720ae) SHA1(1b8a72c720cdb5ee3f1d735bbcf447b09204b8d9) ) /* Universe Bios v2.3 (hack) alt version, withdrawn? */ + ROM_SYSTEM_BIOS( 7, "unibios22", "Universe Bios (Hack, Ver. 2.2)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 7, "uni-bios_2_2.rom", 0x00000, 0x020000, CRC(2d50996a) SHA1(5241a4fb0c63b1a23fd1da8efa9c9a9bd3b4279c) ) /* Universe Bios v2.2 (hack) */ + ROM_SYSTEM_BIOS( 8, "unibios21", "Universe Bios (Hack, Ver. 2.1)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 8, "uni-bios_2_1.rom", 0x00000, 0x020000, CRC(8dabf76b) SHA1(c23732c4491d966cf0373c65c83c7a4e88f0082c) ) /* Universe Bios v2.1 (hack) */ + ROM_SYSTEM_BIOS( 9, "unibios20", "Universe Bios (Hack, Ver. 2.0)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 9, "uni-bios_2_0.rom", 0x00000, 0x020000, CRC(0c12c2ad) SHA1(37bcd4d30f3892078b46841d895a6eff16dc921e) ) /* Universe Bios v2.0 (hack) */ + ROM_SYSTEM_BIOS(10, "unibios13", "Universe Bios (Hack, Ver. 1.3)" ) + ROM_LOAD16_WORD_SWAP_BIOS(10, "uni-bios_1_3.rom", 0x00000, 0x020000, CRC(b24b44a0) SHA1(eca8851d30557b97c309a0d9f4a9d20e5b14af4e) ) /* Universe Bios v1.3 (hack) - note: versions older than 1.3 don't support AES hardware */ + + ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x20000, "zoomy", 0 ) + ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) ) + + ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF ) + + ROM_REGION( 0x1000000, "ymsnd", ROMREGION_ERASEFF ) + + ROM_REGION( 0x1000000, "ymsnd.deltat", ROMREGION_ERASEFF ) + + ROM_REGION( 0x900000, "sprites", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( neocd ) + ROM_REGION16_BE( 0x80000, "mainbios", 0 ) + ROM_SYSTEM_BIOS( 0, "top", "Top loading NeoGeo CD" ) + ROMX_LOAD( "top-sp1.bin", 0x00000, 0x80000, CRC(c36a47c0) SHA1(235f4d1d74364415910f73c10ae5482d90b4274f), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "front", "Front loading NeoGeo CD" ) + ROMX_LOAD( "front-sp1.bin", 0x00000, 0x80000, CRC(cac62307) SHA1(53bc1f283cdf00fa2efbb79f2e36d4c8038d743a), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(2)) + + ROM_REGION( 0x100000, "ymsnd", ROMREGION_ERASEFF ) + /* 1MB of Sound RAM */ + + ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) + /* 64KB of Z80 RAM */ + + ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASE00 ) + /* 2MB of 68K RAM */ + + ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF ) + /* 4MB of Sprite Tile RAM */ + + ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF ) + /* 128KB of Text Tile RAM */ + + ROM_REGION( 0x20000, "zoomy", 0 ) + ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) ) +ROM_END + +ROM_START( neocdz ) + ROM_REGION16_BE( 0x80000, "mainbios", 0 ) + ROM_LOAD16_WORD_SWAP( "neocd.bin", 0x00000, 0x80000, CRC(df9de490) SHA1(7bb26d1e5d1e930515219cb18bcde5b7b23e2eda) ) + + ROM_REGION( 0x100000, "ymsnd", ROMREGION_ERASEFF ) + /* 1MB of Sound RAM */ + + ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) + /* 64KB of Z80 RAM */ + + ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASE00 ) + /* 2MB of 68K RAM */ + + ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF ) + /* 4MB of Sprite Tile RAM */ + + ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF ) + /* 128KB of Text Tile RAM */ + + ROM_REGION( 0x20000, "zoomy", 0 ) + ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) ) +ROM_END + +#define rom_neocdzj rom_neocdz + +DRIVER_INIT_MEMBER(ng_aes_state,neogeo) +{ + if (!m_cartslots[0]) m_banked_cart->install_banks(machine(), m_maincpu, m_region_maincpu->base(), m_region_maincpu->bytes()); +} + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1990, aes, 0, 0, aes, aes, ng_aes_state, neogeo, "SNK", "Neo-Geo AES", MACHINE_SUPPORTS_SAVE ) + +DRIVER_INIT_MEMBER(ng_aes_state,neocdz) +{ + NeoSystem = NEOCD_REGION_US; +} + +DRIVER_INIT_MEMBER(ng_aes_state,neocdzj) +{ + NeoSystem = NEOCD_REGION_JAPAN; +} + + +CONS( 1996, neocdz, 0, 0, neocd, neocd, ng_aes_state, neocdz, "SNK", "Neo-Geo CDZ (US)", 0 ) // the CDZ is the newer model +CONS( 1996, neocdzj, neocdz, 0, neocd, neocd, ng_aes_state, neocdzj, "SNK", "Neo-Geo CDZ (Japan)", 0 ) + + +CONS( 1994, neocd, neocdz, 0, neocd, neocd, ng_aes_state, neogeo, "SNK", "Neo-Geo CD", MACHINE_NOT_WORKING ) // older model, ignores disc protections? diff --git a/src/mame/drivers/ngen.c b/src/mame/drivers/ngen.c new file mode 100644 index 00000000000..29f492e5f30 --- /dev/null +++ b/src/mame/drivers/ngen.c @@ -0,0 +1,1179 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + + Convergent NGen series + + 10-11-14 - Skeleton driver + + Interrupts based on patents: + level 1 - SIO + level 3 - timer (from PIT, presumably channel 0? Patent says "channel 3") + level 4 - "interrupt detector" - keyboard, printer, RTC + level 7 - floppy/hard disk + + DMA channels: + channel 0 - communications (RS-232) + channel 1 - X-Bus expansion modules (except disk and graphics) + channel 2 - graphics? + channel 3 - hard disk + On the CP-001/B26 channels 4 on are handled by the 80186. + channel 4 - floppy disk + + To get to "menu mode", press Space quickly after reset (might need good timing) + The bootstrap ROM version number is displayed, along with "B,D,L,M,P,T:" + You can press one of these keys for the following tests: + B: Bootstrap + Loads the system image file (from disk or master workstation) + D: Dump + RAM contents are dumped to a local disk drive or master workstation + L: Load + Loads the system image file, then enters the Panel Debugger. Exiting the Panel + Debugger will continue execution of the system image + M: Memory Test + Continuously performs the Memory Test until the system is reset. + P: Panel Debugger + Enters the Panel Debugger + T: Type of Operating System + Gives an "OS:" prompt, at which you can enter the number of the system image to + load at the master workstation. + + Panel Debugger: + - Open/Modify RAM + Enter an address (seg:off) followed by a forward-slash, the contents of this word will + appear, you can enter a value to set it to, or just press Next (default: Enter) to leave + it as is. It will then go on to the next word. Pressing Return (scan code unknown + currently) will return to the debugger prompt. + - Open/Modify Register + Enter the register only, and the contents will appear, you can leave it or alter it (you + must enter all digits (eg: 0A03 if you're modifying DX) then press Return. + - I/O to or from a port + Input: Address (segment is ignored, and not required) followed by I, a byte is read from + the port defined by the offset, and the byte is displayed. + Output: Address followed by O, you are now prompted with an '='. Enter the byte to send + to the port, and press Return. + - Set Haltpoint: + Enter an address (seg:off) followed by H. Sets a haltpoint at the specified address. Does + not work for ROM addresses. Only one allowed at a time. Haltpoint info is stored at + 0000:01F0. Uses a software interrupt (INT 7C), rather than INT 3. + + To start or continue from the current address, enter P. + To start from a specific address, enter the address (seg:off) followed by a G. +*/ + +#include "emu.h" +#include "cpu/i86/i186.h" +#include "cpu/i386/i386.h" +#include "video/mc6845.h" +#include "machine/i8251.h" +#include "machine/am9517a.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/z80dart.h" +#include "machine/wd_fdc.h" +#include "machine/wd2010.h" +#include "bus/rs232/rs232.h" +#include "machine/ngen_kb.h" +#include "machine/clock.h" +#include "imagedev/harddriv.h" + +class ngen_state : public driver_device +{ +public: + ngen_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this,"maincpu"), + m_i386cpu(*this,"i386cpu"), + m_crtc(*this,"crtc"), + m_viduart(*this,"videouart"), + m_iouart(*this,"iouart"), + m_dmac(*this,"dmac"), + m_pic(*this,"pic"), + m_pit(*this,"pit"), + m_disk_rom(*this,"disk"), + m_fdc(*this,"fdc"), + m_fd0(*this,"fdc:0"), + m_fdc_timer(*this,"fdc_timer"), + m_hdc(*this,"hdc"), + m_hdc_timer(*this,"hdc_timer"), + m_hd_buffer(*this,"hd_buffer_ram") + {} + + DECLARE_WRITE_LINE_MEMBER(pit_out0_w); + DECLARE_WRITE_LINE_MEMBER(pit_out1_w); + DECLARE_WRITE_LINE_MEMBER(pit_out2_w); + DECLARE_WRITE_LINE_MEMBER(cpu_timer_w); + DECLARE_WRITE_LINE_MEMBER(timer_clk_out); + DECLARE_WRITE16_MEMBER(cpu_peripheral_cb); + DECLARE_WRITE16_MEMBER(peripheral_w); + DECLARE_READ16_MEMBER(peripheral_r); + DECLARE_WRITE16_MEMBER(xbus_w); + DECLARE_READ16_MEMBER(xbus_r); + DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); + DECLARE_WRITE_LINE_MEMBER(dma_eop_changed); + DECLARE_WRITE_LINE_MEMBER(dack0_w); + DECLARE_WRITE_LINE_MEMBER(dack1_w); + DECLARE_WRITE_LINE_MEMBER(dack2_w); + DECLARE_WRITE_LINE_MEMBER(dack3_w); + DECLARE_READ8_MEMBER(dma_read_word); + DECLARE_WRITE8_MEMBER(dma_write_word); + MC6845_UPDATE_ROW(crtc_update_row); + // TODO: sort out what devices use which channels + DECLARE_READ8_MEMBER( dma_0_dack_r ) { UINT16 ret = 0xffff; m_dma_high_byte = ret & 0xff00; return ret; } + DECLARE_READ8_MEMBER( dma_1_dack_r ) { UINT16 ret = 0xffff; m_dma_high_byte = ret & 0xff00; return ret; } + DECLARE_READ8_MEMBER( dma_2_dack_r ) { UINT16 ret = 0xffff; m_dma_high_byte = ret & 0xff00; return ret; } + DECLARE_READ8_MEMBER( dma_3_dack_r ); + DECLARE_WRITE8_MEMBER( dma_0_dack_w ){ popmessage("IOW0: data %02x",data); } + DECLARE_WRITE8_MEMBER( dma_1_dack_w ){ } + DECLARE_WRITE8_MEMBER( dma_2_dack_w ){ } + DECLARE_WRITE8_MEMBER( dma_3_dack_w ){ popmessage("IOW3: data %02x",data); } + + DECLARE_WRITE16_MEMBER(hfd_w); + DECLARE_READ16_MEMBER(hfd_r); + DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_WRITE8_MEMBER(fdc_control_w); + DECLARE_READ8_MEMBER(irq_cb); + DECLARE_WRITE8_MEMBER(hdc_control_w); + DECLARE_WRITE8_MEMBER(disk_addr_ext); + DECLARE_READ8_MEMBER(hd_buffer_r); + DECLARE_WRITE8_MEMBER(hd_buffer_w); + + DECLARE_READ16_MEMBER(b38_keyboard_r); + DECLARE_WRITE16_MEMBER(b38_keyboard_w); + DECLARE_READ16_MEMBER(b38_crtc_r); + DECLARE_WRITE16_MEMBER(b38_crtc_w); +protected: + virtual void machine_reset(); + virtual void machine_start(); + +private: + optional_device m_maincpu; + optional_device m_i386cpu; + required_device m_crtc; + required_device m_viduart; + required_device m_iouart; + required_device m_dmac; + required_device m_pic; + required_device m_pit; + optional_memory_region m_disk_rom; + memory_array m_vram; + memory_array m_fontram; + optional_device m_fdc; + optional_device m_fd0; + optional_device m_fdc_timer; + optional_device m_hdc; + optional_device m_hdc_timer; + optional_shared_ptr m_hd_buffer; + + void set_dma_channel(int channel, int state); + + UINT8 m_xbus_current; // currently selected X-Bus module + UINT16 m_peripheral; + UINT16 m_upper; + UINT16 m_middle; + UINT16 m_port00; + UINT16 m_periph141; + UINT8 m_dma_offset[4]; + INT8 m_dma_channel; + UINT16 m_dma_high_byte; + UINT16 m_control; + UINT16 m_disk_rom_ptr; + UINT8 m_hdc_control; + UINT8 m_disk_page; +}; + +class ngen386_state : public ngen_state +{ +public: + ngen386_state(const machine_config &mconfig, device_type type, const char *tag) + : ngen_state(mconfig, type, tag) + {} +private: +}; + +WRITE_LINE_MEMBER(ngen_state::pit_out0_w) +{ + m_pic->ir3_w(state); // Timer interrupt + popmessage("PIT Timer 0 state %i\n",state); +} + +WRITE_LINE_MEMBER(ngen_state::pit_out1_w) +{ + popmessage("PIT Timer 1 state %i\n",state); + m_iouart->rxcb_w(state); + m_iouart->txcb_w(state); // channels in the correct order? +} + +WRITE_LINE_MEMBER(ngen_state::pit_out2_w) +{ + m_iouart->rxca_w(state); + m_iouart->txca_w(state); + popmessage("PIT Timer 2 state %i\n",state); +} + +WRITE_LINE_MEMBER(ngen_state::cpu_timer_w) +{ + if(state != 0) + popmessage("80186 Timer 0 state %i\n",state); + m_pic->ir5_w(state); +} + +WRITE_LINE_MEMBER(ngen_state::timer_clk_out) +{ + m_viduart->write_rxc(state); // Keyboard UART Rx/Tx clocks + m_viduart->write_txc(state); + // 80186 timer pins also? EXT bit is enabled for BTOS PIT test. + if(m_maincpu) + { + m_maincpu->tmrin0_w(state); + //m_maincpu->tmrin1_w(state); + } +} + +WRITE16_MEMBER(ngen_state::cpu_peripheral_cb) +{ + UINT32 addr; + + switch(offset) + { + case 0: // upper memory + m_upper = data; + break; + case 2: // peripheral + m_peripheral = data; + addr = (m_peripheral & 0xffc0) << 4; + if(m_middle & 0x0040) + { + m_maincpu->device_t::memory().space(AS_PROGRAM).install_readwrite_handler(addr, addr + 0x3ff, read16_delegate(FUNC(ngen_state::peripheral_r), this), write16_delegate(FUNC(ngen_state::peripheral_w), this)); + logerror("Mapped peripherals to memory 0x%08x\n",addr); + } + else + { + addr &= 0xffff; + m_maincpu->device_t::memory().space(AS_IO).install_readwrite_handler(addr, addr + 0x3ff, read16_delegate(FUNC(ngen_state::peripheral_r), this), write16_delegate(FUNC(ngen_state::peripheral_w), this)); + logerror("Mapped peripherals to I/O 0x%04x\n",addr); + } + break; + case 4: + m_middle = data; + break; + } +} + +// 80186 peripheral space +// Largely guesswork at this stage +WRITE16_MEMBER(ngen_state::peripheral_w) +{ + switch(offset) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + if(mem_mask & 0x00ff) + m_dmac->write(space,offset,data & 0xff); + break; + case 0x80: // DMA page offset? + case 0x81: + case 0x82: + case 0x83: + if(mem_mask & 0x00ff) + m_dma_offset[offset-0x80] = data & 0xff; + break; + case 0xc0: // X-Bus modules reset + m_xbus_current = 0; + break; + case 0x10c: + if(mem_mask & 0x00ff) + m_pic->write(space,0,data & 0xff); + break; + case 0x10d: + if(mem_mask & 0x00ff) + m_pic->write(space,1,data & 0xff); + break; + case 0x110: + case 0x111: + case 0x112: + case 0x113: + if(mem_mask & 0x00ff) + m_pit->write(space,offset-0x110,data & 0xff); + break; + case 0x141: + // bit 1 enables speaker? + COMBINE_DATA(&m_periph141); + break; + case 0x144: + if(mem_mask & 0x00ff) + m_crtc->address_w(space,0,data & 0xff); + break; + case 0x145: + if(mem_mask & 0x00ff) + m_crtc->register_w(space,0,data & 0xff); + break; + case 0x146: + if(mem_mask & 0x00ff) + m_viduart->data_w(space,0,data & 0xff); + break; + case 0x147: + if(mem_mask & 0x00ff) + m_viduart->control_w(space,0,data & 0xff); + break; + case 0x1a0: // serial? + logerror("Serial(?) 0x1a0 write offset %04x data %04x mask %04x\n",offset,data,mem_mask); + break; + default: + logerror("Unknown 80186 peripheral write offset %04x data %04x mask %04x\n",offset,data,mem_mask); + } +} + +READ16_MEMBER(ngen_state::peripheral_r) +{ + UINT16 ret = 0xffff; + switch(offset) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + if(mem_mask & 0x00ff) + ret = m_dmac->read(space,offset); + logerror("DMA read offset %04x mask %04x returning %04x\n",offset,mem_mask,ret); + break; + case 0x80: // DMA page offset? + case 0x81: + case 0x82: + case 0x83: + if(mem_mask & 0x00ff) + ret = m_dma_offset[offset-0x80] & 0xff; + break; + case 0x10c: + if(mem_mask & 0x00ff) + ret = m_pic->read(space,0); + break; + case 0x10d: + if(mem_mask & 0x00ff) + ret = m_pic->read(space,1); + break; + case 0x110: + case 0x111: + case 0x112: + case 0x113: + if(mem_mask & 0x00ff) + ret = m_pit->read(space,offset-0x110); + break; + case 0x141: + ret = m_periph141; + break; + case 0x144: + if(mem_mask & 0x00ff) + ret = m_crtc->status_r(space,0); + break; + case 0x145: + if(mem_mask & 0x00ff) + ret = m_crtc->register_r(space,0); + break; + case 0x146: + if(mem_mask & 0x00ff) + ret = m_viduart->data_r(space,0); + break; + case 0x147: // keyboard UART + // expects bit 0 to be set (UART transmit ready) + if(mem_mask & 0x00ff) + ret = m_viduart->status_r(space,0); + break; + case 0x1a0: // I/O control register? + ret = m_control; // end of DMA transfer? (maybe a per-channel EOP?) Bit 6 is set during a transfer? + break; +// default: +// logerror("Unknown 80186 peripheral read offset %04x mask %04x returning %04x\n",offset,mem_mask,ret); + } + return ret; +} + +// X-bus module select +// The bootstrap ROM creates a table at 0:FC9h, with a count, followed by the module IDs of each +// expansion module. The base I/O address for the currently selected module is set by writing to +// this register (bits 0-7 are ignored) +// TODO: make expansion modules slot devices +WRITE16_MEMBER(ngen_state::xbus_w) +{ + UINT16 addr = (data & 0x00ff) << 8; + cpu_device* cpu; + + if(m_maincpu) + cpu = m_maincpu; + else + cpu = m_i386cpu; + address_space& io = cpu->device_t::memory().space(AS_IO); + switch(m_xbus_current) + { + case 0x00: // Floppy/Hard disk module + io.install_readwrite_handler(addr,addr+0xff,read16_delegate(FUNC(ngen_state::hfd_r),this),write16_delegate(FUNC(ngen_state::hfd_w),this),0xffffffff); + break; + default: + cpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); // reached end of the modules + break; + } + if(addr != 0) + logerror("SYS: X-Bus module %i address set %04x\n",m_xbus_current+1,addr); + m_xbus_current++; +} + +// returns X-bus module ID and info in the low byte (can indicate if the device is bootable, has a boot ROM (needs to be written to RAM via DMA), or if it supports a non-80186 CPU) +// bit 6, I think, indicates a bootable device +// Known module IDs: +// 0x1070 - Floppy/Hard disk module +// 0x3141 - QIC Tape module +READ16_MEMBER(ngen_state::xbus_r) +{ + UINT16 ret = 0xffff; + + switch(m_xbus_current) + { + case 0x00: + ret = 0x1070; // Floppy/Hard disk module + break; + default: + if(m_maincpu) + m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); // reached the end of the modules + else + m_i386cpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); + ret = 0x0080; + break; + } + return ret; +} + + +// Floppy/Hard disk module +WRITE16_MEMBER(ngen_state::hfd_w) +{ + switch(offset) + { + case 0x00: + case 0x01: + case 0x02: + if(mem_mask & 0x00ff) + m_fdc->write(space,offset,data & 0xff); + break; + case 0x03: + if(mem_mask & 0x00ff) + { + m_fdc->write(space,offset,data & 0xff); + m_fdc_timer->write_clk0(1); + m_fdc_timer->write_clk0(0); // Data register access clocks the FDC's PIT channel 0 + } + break; + case 0x04: + if(mem_mask & 0x00ff) + fdc_control_w(space,0,data & 0xff); + break; + case 0x05: + if(mem_mask & 0x00ff) + hdc_control_w(space,0,data & 0xff); + break; + case 0x07: + if(mem_mask & 0x00ff) + disk_addr_ext(space,0,data & 0xff); + break; + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + if(mem_mask & 0x00ff) + m_fdc_timer->write(space,offset-0x08,data & 0xff); + break; + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + if(mem_mask & 0x00ff) + m_hdc->write(space,offset-0x10,data & 0xff); + logerror("WD1010 register %i write %02x mask %04x\n",offset-0x10,data & 0xff,mem_mask); + break; + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + if(mem_mask & 0x00ff) + m_hdc_timer->write(space,offset-0x18,data & 0xff); + break; + } +} + +READ16_MEMBER(ngen_state::hfd_r) +{ + UINT16 ret = 0xffff; + + switch(offset) + { + case 0x00: + case 0x01: + case 0x02: + if(mem_mask & 0x00ff) + ret = m_fdc->read(space,offset); + break; + case 0x03: + if(mem_mask & 0x00ff) + { + ret = m_fdc->read(space,offset); + m_fdc_timer->write_clk0(1); + m_fdc_timer->write_clk0(0); // Data register access clocks the FDC's PIT channel 0 + } + break; + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + if(mem_mask & 0x00ff) + ret = m_fdc_timer->read(space,offset-0x08); + break; + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + if(mem_mask & 0x00ff) + ret = m_hdc->read(space,offset-0x10); + logerror("WD1010 register %i read, mask %04x\n",offset-0x10,mem_mask); + break; + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + if(mem_mask & 0x00ff) + ret = m_hdc_timer->read(space,offset-0x18); + break; + } + + return ret; +} + +WRITE_LINE_MEMBER(ngen_state::fdc_irq_w) +{ + m_pic->ir7_w(state); +} + +WRITE_LINE_MEMBER(ngen_state::fdc_drq_w) +{ + m_dmac->dreq3_w(state); +} + +// Floppy disk control register +// Bit 0 - enable drive and LED +// Bit 2 - floppy motor +// Bit 5 - side select +// Bit 6 - 1 = 2Mhz for seek, 0 = 1MHz for read/write +// Bit 7 - FDC reset +WRITE8_MEMBER(ngen_state::fdc_control_w) +{ + m_fdc->set_floppy(m_fd0->get_device()); + m_fd0->get_device()->mon_w(~data & 0x04); + m_fd0->get_device()->ss_w(data & 0x20); + if(~data & 0x80) + m_fdc->soft_reset(); +} + +// Hard disk control register +// bit 0 - Drive select 0 - selects module hard disk +// bit 1 - Drive select 1 - selects expansion module hard disk (if available) +// bit 2 - enable DMA transfer of module ROM contents to X-Bus master memory +// bits 3-5 - select head / expansion module head +// bit 6 - write enable, must be set to write to a hard disk +// bit 7 - HDC reset +WRITE8_MEMBER(ngen_state::hdc_control_w) +{ + m_hdc_control = data; + if(m_hdc_control & 0x04) + { + m_disk_rom_ptr = 0; + popmessage("HDD: DMA ROM transfer start\n"); + m_dmac->dreq3_w(1); + //m_dmac->dreq3_w(0); + } +} + +// page of system RAM to access +// bit 7 = disables read/write signals to the WD1010 +WRITE8_MEMBER(ngen_state::disk_addr_ext) +{ + m_disk_page = data & 0x7f; +} + +READ8_MEMBER(ngen_state::hd_buffer_r) +{ + return m_hd_buffer[offset]; +} + +WRITE8_MEMBER(ngen_state::hd_buffer_w) +{ + m_hd_buffer[offset] = data; +} + +WRITE_LINE_MEMBER( ngen_state::dma_hrq_changed ) +{ + if(m_maincpu) + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + else + m_i386cpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE_LINE_MEMBER( ngen_state::dma_eop_changed ) +{ + if(m_dma_channel == 0) + { + if(state) + m_control |= 0x02; + else + m_control &= ~0x02; + } + if(m_dma_channel == 3) + { + if(state) + { + if(m_hdc_control & 0x04) // ROM transfer + m_hdc_control &= ~0x04; // switch it off when done + } + } +} + +void ngen_state::set_dma_channel(int channel, int state) +{ + if(!state) + m_dma_channel = channel; + else if(m_dma_channel == channel) + m_dma_channel = -1; +} + +WRITE_LINE_MEMBER( ngen_state::dack0_w ) { set_dma_channel(0, state); } +WRITE_LINE_MEMBER( ngen_state::dack1_w ) { set_dma_channel(1, state); } +WRITE_LINE_MEMBER( ngen_state::dack2_w ) { set_dma_channel(2, state); } +WRITE_LINE_MEMBER( ngen_state::dack3_w ) { set_dma_channel(3, state); } + +READ8_MEMBER(ngen_state::dma_3_dack_r) +{ + UINT16 ret = 0xffff; + + if((m_hdc_control & 0x04) && m_disk_rom) + { + ret = m_disk_rom->base()[m_disk_rom_ptr++] << 8; + printf("DMA3 DACK: returning %02x\n",ret); + if(m_disk_rom_ptr < 0x1000) + { + m_dmac->dreq3_w(1); + //m_dmac->dreq3_w(0); + } + } + m_dma_high_byte = ret & 0xff00; + return ret; +} + +READ8_MEMBER(ngen_state::dma_read_word) +{ + cpu_device* cpu; + UINT16 result; + + if(m_maincpu) + cpu = m_maincpu; + else + cpu = m_i386cpu; + address_space& prog_space = cpu->space(AS_PROGRAM); // get the right address space + + if(m_dma_channel == -1) + return 0xff; + offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0xFE0000; + + result = prog_space.read_word(page_offset + (offset << 1)); + m_dma_high_byte = result & 0xFF00; + popmessage("DMA byte address %06x read %04x\n",page_offset+(offset<<1),result); + return result & 0xff; +} + + +WRITE8_MEMBER(ngen_state::dma_write_word) +{ + cpu_device* cpu; + + if(m_maincpu) + cpu = m_maincpu; + else + cpu = m_i386cpu; + address_space& prog_space = cpu->space(AS_PROGRAM); // get the right address space + + if(m_dma_channel == -1) + return; + offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0xFE0000; + + prog_space.write_word(page_offset + (offset << 1), data); + popmessage("DMA byte address %06x write %04x\n",page_offset+(offset<<1), m_dma_high_byte | data); +} + + +MC6845_UPDATE_ROW( ngen_state::crtc_update_row ) +{ + UINT16 addr = ma; + + for(int x=0;xacknowledge(); +} + +READ16_MEMBER( ngen_state::b38_keyboard_r ) +{ + UINT8 ret = 0; + switch(offset) + { + case 0: + if(mem_mask & 0x00ff) + ret = m_viduart->data_r(space,0); + break; + case 1: // keyboard UART + // expects bit 0 to be set (UART transmit ready) + if(mem_mask & 0x00ff) + ret = m_viduart->status_r(space,0); + break; + } + return ret; +} + +WRITE16_MEMBER( ngen_state::b38_keyboard_w ) +{ + switch(offset) + { + case 0: + if(mem_mask & 0x00ff) + m_viduart->data_w(space,0,data & 0xff); + break; + case 1: + if(mem_mask & 0x00ff) + m_viduart->control_w(space,0,data & 0xff); + break; + } +} + +READ16_MEMBER( ngen_state::b38_crtc_r ) +{ + UINT8 ret = 0; + switch(offset) + { + case 0: + if(mem_mask & 0x00ff) + ret = m_crtc->register_r(space,0); + break; + case 1: + if(mem_mask & 0x00ff) + ret = m_viduart->data_r(space,0); + break; + } + return ret; +} + +WRITE16_MEMBER( ngen_state::b38_crtc_w ) +{ + switch(offset) + { + case 0: + if(mem_mask & 0x00ff) + m_crtc->address_w(space,0,data & 0xff); + break; + case 1: + if(mem_mask & 0x00ff) + m_crtc->register_w(space,0,data & 0xff); + break; + } +} + +void ngen_state::machine_start() +{ + memory_share* vidshare = memshare("vram"); + memory_share* fontshare = memshare("fontram"); + m_hd_buffer.allocate(1024*8); // 8kB buffer RAM for HD controller + if(vidshare == NULL || fontshare == NULL) + fatalerror("Error: VRAM not found"); + m_vram.set(*vidshare,2); + m_fontram.set(*fontshare,2); +} + +void ngen_state::machine_reset() +{ + m_port00 = 0; + m_control = 0; + m_xbus_current = 0; + m_viduart->write_dsr(0); + m_viduart->write_cts(0); + m_fd0->get_device()->set_rpm(300); +} + +// boot ROMs from modules are not mapped anywhere, instead, they have to send the code from the boot ROM via DMA +static ADDRESS_MAP_START( ngen_mem, AS_PROGRAM, 16, ngen_state ) + AM_RANGE(0x00000, 0xf7fff) AM_RAM + AM_RANGE(0xf8000, 0xf9fff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xfa000, 0xfbfff) AM_RAM AM_SHARE("fontram") + AM_RANGE(0xfc000, 0xfcfff) AM_RAM + AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("bios",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ngen_io, AS_IO, 16, ngen_state ) + AM_RANGE(0x0000, 0x0001) AM_READWRITE(xbus_r,xbus_w) + + // Floppy/Hard disk module +// AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff) // a guess for now +// AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff) +// AM_RANGE(0x010a, 0x010b) AM_WRITE8(hdc_control_w,0x00ff) +// AM_RANGE(0x010e, 0x010f) AM_WRITE8(disk_addr_ext,0x00ff) // X-Bus extended address register +// AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff) + // 0x0120-0x012f - WD1010 Winchester disk controller (unemulated) +// AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff) + +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ngen386_mem, AS_PROGRAM, 32, ngen_state ) + AM_RANGE(0x00000000, 0x000f7fff) AM_RAM + AM_RANGE(0x000f8000, 0x000f9fff) AM_RAM AM_SHARE("vram") + AM_RANGE(0x000fa000, 0x000fbfff) AM_RAM AM_SHARE("fontram") + AM_RANGE(0x000fc000, 0x000fcfff) AM_RAM + AM_RANGE(0x000fe000, 0x000fffff) AM_ROM AM_REGION("bios",0) + AM_RANGE(0x00100000, 0x00ffffff) AM_RAM // some extra RAM + AM_RANGE(0xffffe000, 0xffffffff) AM_ROM AM_REGION("bios",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ngen386i_mem, AS_PROGRAM, 32, ngen_state ) + AM_RANGE(0x00000000, 0x000f7fff) AM_RAM + AM_RANGE(0x000f8000, 0x000f9fff) AM_RAM AM_SHARE("vram") + AM_RANGE(0x000fa000, 0x000fbfff) AM_RAM AM_SHARE("fontram") + AM_RANGE(0x000fc000, 0x000fffff) AM_ROM AM_REGION("bios",0) + AM_RANGE(0x00100000, 0x00ffffff) AM_RAM // some extra RAM + AM_RANGE(0xffffc000, 0xffffffff) AM_ROM AM_REGION("bios",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ngen386_io, AS_IO, 32, ngen_state ) + AM_RANGE(0x0000, 0x0003) AM_READWRITE16(xbus_r, xbus_w, 0x0000ffff) +// AM_RANGE(0xf800, 0xfeff) AM_READWRITE16(peripheral_r, peripheral_w,0xffffffff) + AM_RANGE(0xfd08, 0xfd0b) AM_READWRITE16(b38_crtc_r, b38_crtc_w,0xffffffff) + AM_RANGE(0xfd0c, 0xfd0f) AM_READWRITE16(b38_keyboard_r, b38_keyboard_w,0xffffffff) +ADDRESS_MAP_END + +static INPUT_PORTS_START( ngen ) +INPUT_PORTS_END + +static SLOT_INTERFACE_START(keyboard) + SLOT_INTERFACE("ngen", NGEN_KEYBOARD) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( ngen_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( ngen, ngen_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", I80186, XTAL_16MHz / 2) + MCFG_CPU_PROGRAM_MAP(ngen_mem) + MCFG_CPU_IO_MAP(ngen_io) + MCFG_80186_CHIP_SELECT_CB(WRITE16(ngen_state, cpu_peripheral_cb)) + MCFG_80186_TMROUT0_HANDLER(WRITELINE(ngen_state, cpu_timer_w)) + MCFG_80186_IRQ_SLAVE_ACK(READ8(ngen_state, irq_cb)) + + MCFG_PIC8259_ADD( "pic", DEVWRITELINE("maincpu",i80186_cpu_device,int0_w), VCC, NULL ) + + MCFG_DEVICE_ADD("pit", PIT8254, 0) + MCFG_PIT8253_CLK0(78120/4) // 19.53kHz, /4 of the CPU timer output? + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(ngen_state, pit_out0_w)) // RS232 channel B baud rate + MCFG_PIT8253_CLK1(XTAL_14_7456MHz/12) // correct? - based on patent + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(ngen_state, pit_out1_w)) // RS232 channel A baud rate + MCFG_PIT8253_CLK2(XTAL_14_7456MHz/12) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(ngen_state, pit_out2_w)) + + MCFG_DEVICE_ADD("dmac", AM9517A, XTAL_14_7456MHz / 3) // NEC D8237A, divisor unknown + MCFG_I8237_OUT_HREQ_CB(WRITELINE(ngen_state, dma_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(ngen_state, dma_eop_changed)) + MCFG_I8237_IN_MEMR_CB(READ8(ngen_state, dma_read_word)) // DMA is always 16-bit + MCFG_I8237_OUT_MEMW_CB(WRITE8(ngen_state, dma_write_word)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(ngen_state, dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(ngen_state, dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(ngen_state, dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(ngen_state, dack3_w)) + MCFG_I8237_IN_IOR_0_CB(READ8(ngen_state, dma_0_dack_r)) + MCFG_I8237_IN_IOR_1_CB(READ8(ngen_state, dma_1_dack_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(ngen_state, dma_2_dack_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(ngen_state, dma_3_dack_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(ngen_state, dma_0_dack_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(ngen_state, dma_1_dack_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(ngen_state, dma_2_dack_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(ngen_state, dma_3_dack_w)) + + // I/O board + MCFG_UPD7201_ADD("iouart",0,0,0,0,0) // clocked by PIT channel 2? + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232_a", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("iouart", upd7201_device, rxa_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("iouart", upd7201_device, ctsa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("iouart", upd7201_device, dcda_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("iouart", upd7201_device, ria_w)) + + MCFG_RS232_PORT_ADD("rs232_b", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("iouart", upd7201_device, rxb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("iouart", upd7201_device, ctsb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("iouart", upd7201_device, dcdb_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("iouart", upd7201_device, rib_w)) + + // TODO: SCN2652 MPCC (not implemented), used for RS-422 cluster communications? + + // video board + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_SIZE(720,348) + MCFG_SCREEN_VISIBLE_AREA(0,719,0,347) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DEVICE("crtc",mc6845_device, screen_update) + + MCFG_MC6845_ADD("crtc", MC6845, NULL, 19980000 / 9) // divisor unknown -- /9 gives 60Hz output, so likely correct + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(9) + MCFG_MC6845_UPDATE_ROW_CB(ngen_state, crtc_update_row) + MCFG_VIDEO_SET_SCREEN("screen") + + // keyboard UART (patent says i8251 is used for keyboard communications, it is located on the video board) + MCFG_DEVICE_ADD("videouart", I8251, 0) // main clock unknown, Rx/Tx clocks are 19.53kHz +// MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w)) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) + MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd)) + + MCFG_DEVICE_ADD("refresh_clock", CLOCK, 19200*16) // should be 19530Hz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ngen_state,timer_clk_out)) + + // floppy disk / hard disk module (WD2797 FDC, WD1010 HDC, plus an 8253 timer for each) + MCFG_WD2797_ADD("fdc", XTAL_20MHz / 20) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ngen_state,fdc_irq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu",i80186_cpu_device,drq1_w)) + MCFG_WD_FDC_FORCE_READY + MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0) + MCFG_PIT8253_CLK0(0) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) // clocked on FDC data register access + MCFG_PIT8253_CLK1(XTAL_20MHz / 20) +// MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) // 1MHz + MCFG_PIT8253_CLK2(XTAL_20MHz / 20) +// MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) + + // TODO: WD1010 HDC (not implemented), use WD2010 for now + MCFG_DEVICE_ADD("hdc", WD2010, XTAL_20MHz / 4) + MCFG_WD2010_OUT_INTRQ_CB(DEVWRITELINE("pic",pic8259_device,ir2_w)) + MCFG_WD2010_IN_BCS_CB(READ8(ngen_state,hd_buffer_r)) + MCFG_WD2010_OUT_BCS_CB(WRITE8(ngen_state,hd_buffer_w)) + MCFG_WD2010_IN_DRDY_CB(VCC) + MCFG_WD2010_IN_INDEX_CB(VCC) + MCFG_WD2010_IN_WF_CB(VCC) + MCFG_WD2010_IN_TK000_CB(VCC) + MCFG_WD2010_IN_SC_CB(VCC) + MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0) + MCFG_PIT8253_CLK2(XTAL_20MHz / 10) // 2MHz + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_HARDDISK_ADD("hard0") + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ngen386, ngen386_state ) + MCFG_CPU_ADD("i386cpu", I386, XTAL_50MHz / 2) + MCFG_CPU_PROGRAM_MAP(ngen386_mem) + MCFG_CPU_IO_MAP(ngen386_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic", pic8259_device, inta_cb) + + MCFG_PIC8259_ADD( "pic", INPUTLINE("i386cpu",0), VCC, NULL ) + + MCFG_DEVICE_ADD("pit", PIT8254, 0) + MCFG_PIT8253_CLK0(78120/4) // 19.53kHz, /4 of the CPU timer output? + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(ngen_state, pit_out0_w)) // RS232 channel B baud rate + MCFG_PIT8253_CLK1(XTAL_14_7456MHz/12) // correct? - based on patent + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(ngen_state, pit_out1_w)) // RS232 channel A baud rate + MCFG_PIT8253_CLK2(XTAL_14_7456MHz/12) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(ngen_state, pit_out2_w)) + + MCFG_DEVICE_ADD("dmac", AM9517A, XTAL_14_7456MHz / 3) // NEC D8237A, divisor unknown + MCFG_I8237_OUT_HREQ_CB(WRITELINE(ngen_state, dma_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(ngen_state, dma_eop_changed)) + MCFG_I8237_IN_MEMR_CB(READ8(ngen_state, dma_read_word)) // DMA is always 16-bit + MCFG_I8237_OUT_MEMW_CB(WRITE8(ngen_state, dma_write_word)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(ngen_state, dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(ngen_state, dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(ngen_state, dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(ngen_state, dack3_w)) + MCFG_I8237_IN_IOR_0_CB(READ8(ngen_state, dma_0_dack_r)) + MCFG_I8237_IN_IOR_1_CB(READ8(ngen_state, dma_1_dack_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(ngen_state, dma_2_dack_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(ngen_state, dma_3_dack_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(ngen_state, dma_0_dack_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(ngen_state, dma_1_dack_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(ngen_state, dma_2_dack_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(ngen_state, dma_3_dack_w)) + + // I/O board + MCFG_UPD7201_ADD("iouart",0,0,0,0,0) // clocked by PIT channel 2? + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232_a", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("iouart", upd7201_device, rxa_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("iouart", upd7201_device, ctsa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("iouart", upd7201_device, dcda_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("iouart", upd7201_device, ria_w)) + + MCFG_RS232_PORT_ADD("rs232_b", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("iouart", upd7201_device, rxb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("iouart", upd7201_device, ctsb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("iouart", upd7201_device, dcdb_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("iouart", upd7201_device, rib_w)) + + // TODO: SCN2652 MPCC (not implemented), used for RS-422 cluster communications? + + // video board + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_SIZE(720,348) + MCFG_SCREEN_VISIBLE_AREA(0,719,0,347) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DEVICE("crtc",mc6845_device, screen_update) + + MCFG_MC6845_ADD("crtc", MC6845, NULL, 19980000 / 9) // divisor unknown -- /9 gives 60Hz output, so likely correct + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(9) + MCFG_MC6845_UPDATE_ROW_CB(ngen_state, crtc_update_row) + MCFG_VIDEO_SET_SCREEN("screen") + + // keyboard UART (patent says i8251 is used for keyboard communications, it is located on the video board) + MCFG_DEVICE_ADD("videouart", I8251, 0) // main clock unknown, Rx/Tx clocks are 19.53kHz +// MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w)) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) + MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd)) + + MCFG_DEVICE_ADD("refresh_clock", CLOCK, 19200*16) // should be 19530Hz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ngen_state,timer_clk_out)) + + // floppy disk / hard disk module (WD2797 FDC, WD1010 HDC, plus an 8253 timer for each) + MCFG_WD2797_ADD("fdc", XTAL_20MHz / 20) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ngen_state,fdc_irq_w)) +// MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("i386cpu",i80186_cpu_device,drq1_w)) + MCFG_WD_FDC_FORCE_READY + MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0) + MCFG_PIT8253_CLK0(0) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) // clocked on FDC data register access + MCFG_PIT8253_CLK1(XTAL_20MHz / 20) +// MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) // 1MHz + MCFG_PIT8253_CLK2(XTAL_20MHz / 20) +// MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) + + // TODO: WD1010 HDC (not implemented), use WD2010 for now + MCFG_DEVICE_ADD("hdc", WD2010, XTAL_20MHz / 4) + MCFG_WD2010_OUT_INTRQ_CB(DEVWRITELINE("pic",pic8259_device,ir2_w)) + MCFG_WD2010_IN_BCS_CB(READ8(ngen_state,hd_buffer_r)) + MCFG_WD2010_OUT_BCS_CB(WRITE8(ngen_state,hd_buffer_w)) + MCFG_WD2010_IN_DRDY_CB(VCC) + MCFG_WD2010_IN_INDEX_CB(VCC) + MCFG_WD2010_IN_WF_CB(VCC) + MCFG_WD2010_IN_TK000_CB(VCC) + MCFG_WD2010_IN_SC_CB(VCC) + MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0) + MCFG_PIT8253_CLK2(XTAL_20MHz / 10) // 2MHz + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_HARDDISK_ADD("hard0") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( 386i, ngen386 ) + MCFG_CPU_MODIFY("i386cpu") + MCFG_CPU_PROGRAM_MAP(ngen386i_mem) +MACHINE_CONFIG_END + +ROM_START( ngen ) + ROM_REGION( 0x2000, "bios", 0) + ROM_LOAD16_BYTE( "72-00414_80186_cpu.bin", 0x000000, 0x001000, CRC(e1387a03) SHA1(ddca4eba67fbf8b731a8009c14f6b40edcbc3279) ) // bootstrap ROM v8.4 + ROM_LOAD16_BYTE( "72-00415_80186_cpu.bin", 0x000001, 0x001000, CRC(a6dde7d9) SHA1(b4d15c1bce31460ab5b92ff43a68c15ac5485816) ) + + ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) + ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x1000, "disk", 0) + ROM_LOAD( "72-00422_10mb_disk.bin", 0x000000, 0x001000, CRC(f5b046b6) SHA1(b303c6f6aa40504016de9826879bc316e44389aa) ) + + ROM_REGION( 0x20, "disk_prom", 0) + ROM_LOAD( "72-00422_10mb_disk_15d.bin", 0x000000, 0x000020, CRC(121ee494) SHA1(9a8d3c336cc7378a71f9d48c99f88515eb236fbf) ) +ROM_END + +// not sure just how similar these systems are to the 80186 model, but are here at the moment to document the dumps +ROM_START( ngenb38 ) + ROM_REGION( 0x2000, "bios", 0) + ROM_LOAD16_BYTE( "72-168_fpc_386_cpu.bin", 0x000000, 0x001000, CRC(250a3b68) SHA1(49c070514bac264fa4892f284f7d2c852ae6605d) ) + ROM_LOAD16_BYTE( "72-167_fpc_386_cpu.bin", 0x000001, 0x001000, CRC(4010cc4e) SHA1(74a3024d605569056484d08b63f19fbf8eaf31c6) ) + + ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) + ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( 386i ) + ROM_REGION( 0x4000, "bios", 0) + ROM_LOAD16_BYTE( "72-1561o_386i_cpu.bin", 0x000000, 0x002000, CRC(b5efd768) SHA1(8b250d47d9c6eb82e1afaeb2244d8c4134ecbc47) ) + ROM_LOAD16_BYTE( "72-1562e_386i_cpu.bin", 0x000001, 0x002000, CRC(002d0d3a) SHA1(31de8592999377db9251acbeff348390a2d2602a) ) + + ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) + ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x2000, "video", 0) + ROM_LOAD( "72-1630_gc-104_vga.bin", 0x000000, 0x002000, CRC(4e4d8ebe) SHA1(50c96ccb4d0bd1beb2d1aee0d18b2c462d25fc8f) ) +ROM_END + + +COMP( 1983, ngen, 0, 0, ngen, ngen, driver_device, 0, "Convergent Technologies", "NGEN CP-001", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1991, ngenb38, ngen, 0, ngen386, ngen, driver_device, 0, "Financial Products Corp.", "B28/38", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1990, 386i, ngen, 0, 386i, ngen, driver_device, 0, "Convergent Technologies", "386i", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/ngp.c b/src/mame/drivers/ngp.c new file mode 100644 index 00000000000..1443d671c19 --- /dev/null +++ b/src/mame/drivers/ngp.c @@ -0,0 +1,895 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/****************************************************************************** + +SNK NeoGeo Pocket driver + +The NeoGeo Pocket (Color) contains one big chip which contains the following +components: +- Toshiba TLCS-900/H cpu core with 64KB ROM +- Z80 cpu core +- K1GE (mono)/K2GE (color) graphics chip + lcd controller +- SN76489A compatible sound chip +- DAC for additional sound +- RTC +- RAM + + +The following TLCS-900/H input sources are known: +- INT0 - Alarm/RTC irq +- INT4 - VBlank irq +- INT5 - Interrupt from Z80 +- AN0 - Analog input which is used to determine the battery level +- NMI - Triggered by power button +- TIO - HBlank signal + + +The following TLCS-900/H output destination are known: +- TO3 - connected to Z80 INT pin + + +The cartridges +============== + +The cartridges used flash chips produced by Toshiba, Sharp or Samsung. These +are the only 3 manufacturers supported by the NeoGeo pocket bios. The device +IDs supported appear to be SNK exclusive. Most likely because of the factory +blocked game data areas on these chip. + +These manufacturer IDs are supported: 0x98, 0xec, 0xb0 +These device IDs are supported: 0xab, 0x2c, 0x2f + +There is support for 3 different sizes of flash roms: 4Mbit, 8Mbit 16Mbit. The +32Mbit games appear to be 2 16Mbit flash chips in 2 different memory regions (?). + +The flash chips have a couple of different sized blocks. When writing to a +cartridge the neogeo pocket bios will erase the proper block and write the data +to the block. + +The relation between block number and flash chip is as follows: + + # | 16Mbit (2f) | 8Mbit (2c) | 4Mbit (ab) +---+---------------+-------------+------------- + 0 | 000000-00ffff | 00000-0ffff | 00000-0ffff + 1 | 010000-01ffff | 10000-1ffff | 10000-1ffff + 2 | 020000-02ffff | 20000-2ffff | 20000-2ffff + 3 | 030000-03ffff | 30000-3ffff | 30000-3ffff + 4 | 040000-01ffff | 40000-4ffff | 40000-4ffff + 5 | 050000-01ffff | 50000-5ffff | 50000-5ffff + 6 | 060000-01ffff | 60000-6ffff | 60000-6ffff + 7 | 070000-01ffff | 70000-7ffff | 70000-77fff + 8 | 080000-01ffff | 80000-8ffff | 78000-79fff + 9 | 090000-01ffff | 90000-9ffff | 7a000-7bfff +10 | 0a0000-01ffff | a0000-affff | 7c000-7ffff +11 | 0b0000-01ffff | b0000-bffff | +12 | 0c0000-01ffff | c0000-cffff | +13 | 0d0000-01ffff | d0000-dffff | +14 | 0e0000-01ffff | e0000-effff | +15 | 0f0000-01ffff | f0000-f7fff | +16 | 100000-10ffff | f8000-f9fff | +17 | 110000-11ffff | fa000-fbfff | +18 | 120000-12ffff | fc000-fffff | +19 | 130000-13ffff | | +20 | 140000-14ffff | | +21 | 150000-15ffff | | +22 | 160000-16ffff | | +23 | 170000-17ffff | | +24 | 180000-18ffff | | +25 | 190000-19ffff | | +26 | 1a0000-1affff | | +27 | 1b0000-1bffff | | +28 | 1c0000-1cffff | | +29 | 1d0000-1dffff | | +30 | 1e0000-1effff | | +31 | 1f0000-1f7fff | | +32 | 1f8000-1f9fff | | +33 | 1fa000-1fbfff | | +34 | 1fc000-1fffff | | + +The last block is always reserved for use by the system. The Neogeo Pocket Color +bios does some tests on this last block to see if the flash functionality is +working. It does this on every boot! + +The Toshiba TC58FVT004 seems to have an interface similar to what is used in +the Neogeo Pocket. + + +******************************************************************************/ + + +#include "emu.h" +#include "cpu/tlcs900/tlcs900.h" +#include "cpu/z80/z80.h" +#include "sound/t6w28.h" +#include "sound/dac.h" +#include "video/k1ge.h" +#include "rendlay.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +enum flash_state +{ + F_READ, /* xxxx F0 or 5555 AA 2AAA 55 5555 F0 */ + F_PROG1, + F_PROG2, + F_COMMAND, + F_ID_READ, /* 5555 AA 2AAA 55 5555 90 */ + F_AUTO_PROGRAM, /* 5555 AA 2AAA 55 5555 A0 address data */ + F_AUTO_CHIP_ERASE, /* 5555 AA 2AAA 55 5555 80 5555 AA 2AAA 55 5555 10 */ + F_AUTO_BLOCK_ERASE, /* 5555 AA 2AAA 55 5555 80 5555 AA 2AAA 55 block_address 30 */ + F_BLOCK_PROTECT /* 5555 AA 2AAA 55 5555 9A 5555 AA 2AAA 55 5555 9A */ +}; + + +class ngp_state : public driver_device, public device_nvram_interface +{ +public: + ngp_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + device_nvram_interface(mconfig, *this), + m_tlcs900(*this, "maincpu"), + m_z80(*this, "soundcpu"), + m_t6w28(*this, "t6w28"), + m_dac_l(*this, "dac_l"), + m_dac_r(*this, "dac_r"), + m_cart(*this, "cartslot"), + m_mainram(*this, "mainram"), + m_k1ge(*this, "k1ge"), + m_io_controls(*this, "Controls"), + m_io_power(*this, "Power") , + m_maincpu(*this, "maincpu") + { + m_flash_chip[0].present = 0; + m_flash_chip[0].state = F_READ; + m_flash_chip[0].data = NULL; + + m_flash_chip[1].present = 0; + m_flash_chip[1].state = F_READ; + m_flash_chip[1].data = NULL; + + m_nvram_loaded = false; + } + + virtual void machine_start(); + virtual void machine_reset(); + + UINT8 m_io_reg[0x40]; + UINT8 m_old_to3; + emu_timer* m_seconds_timer; + + struct { + int present; + UINT8 manufacturer_id; + UINT8 device_id; + UINT8 *data; + UINT8 org_data[16]; + int state; + UINT8 command[2]; + } m_flash_chip[2]; + + required_device m_tlcs900; + required_device m_z80; + required_device m_t6w28; + required_device m_dac_l; + required_device m_dac_r; + required_device m_cart; + required_shared_ptr m_mainram; + required_device m_k1ge; + + DECLARE_READ8_MEMBER( ngp_io_r ); + DECLARE_WRITE8_MEMBER( ngp_io_w ); + + void flash_w( int which, offs_t offset, UINT8 data ); + DECLARE_WRITE8_MEMBER( flash0_w ); + DECLARE_WRITE8_MEMBER( flash1_w ); + + DECLARE_READ8_MEMBER( ngp_z80_comm_r ); + DECLARE_WRITE8_MEMBER( ngp_z80_comm_w ); + DECLARE_WRITE8_MEMBER( ngp_z80_signal_main_w ); + + DECLARE_WRITE8_MEMBER( ngp_z80_clear_irq ); + + DECLARE_WRITE_LINE_MEMBER( ngp_vblank_pin_w ); + DECLARE_WRITE_LINE_MEMBER( ngp_hblank_pin_w ); + DECLARE_WRITE8_MEMBER( ngp_tlcs900_porta ); + UINT32 screen_update_ngp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_INPUT_CHANGED_MEMBER(power_callback); + TIMER_CALLBACK_MEMBER(ngp_seconds_callback); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( ngp_cart); + DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( ngp_cart ); + +protected: + bool m_nvram_loaded; + required_ioport m_io_controls; + required_ioport m_io_power; + + virtual void nvram_default(); + virtual void nvram_read(emu_file &file); + virtual void nvram_write(emu_file &file); + required_device m_maincpu; +}; + + +TIMER_CALLBACK_MEMBER(ngp_state::ngp_seconds_callback) +{ + m_io_reg[0x16] += 1; + if ( ( m_io_reg[0x16] & 0x0f ) == 0x0a ) + { + m_io_reg[0x16] += 0x06; + } + + if ( m_io_reg[0x16] >= 0x60 ) + { + m_io_reg[0x16] = 0; + m_io_reg[0x15] += 1; + if ( ( m_io_reg[0x15] & 0x0f ) == 0x0a ) { + m_io_reg[0x15] += 0x06; + } + + if ( m_io_reg[0x15] >= 0x60 ) + { + m_io_reg[0x15] = 0; + m_io_reg[0x14] += 1; + if ( ( m_io_reg[0x14] & 0x0f ) == 0x0a ) { + m_io_reg[0x14] += 0x06; + } + + if ( m_io_reg[0x14] == 0x24 ) + { + m_io_reg[0x14] = 0; + } + } + } +} + + +READ8_MEMBER( ngp_state::ngp_io_r ) +{ + UINT8 data = m_io_reg[offset]; + + switch( offset ) + { + case 0x30: /* Read controls */ + data = m_io_controls->read(); + break; + case 0x31: + data = m_io_power->read() & 0x01; + /* Sub-batttery OK */ + data |= 0x02; + break; + } + return data; +} + + +WRITE8_MEMBER( ngp_state::ngp_io_w ) +{ + switch( offset ) + { + case 0x20: /* t6w28 "right" */ + case 0x21: /* t6w28 "left" */ + if ( m_io_reg[0x38] == 0x55 && m_io_reg[0x39] == 0xAA ) + { + m_t6w28->write( space, 0, data ); + } + break; + + case 0x22: /* DAC right */ + m_dac_r->write_unsigned8(data ); + break; + case 0x23: /* DAC left */ + m_dac_l->write_unsigned8(data ); + break; + + /* Internal eeprom related? */ + case 0x36: + case 0x37: + break; + case 0x38: /* Sound enable/disable. */ + switch( data ) + { + case 0x55: /* Enabled sound */ + m_t6w28->set_enable( true ); + break; + case 0xAA: /* Disable sound */ + m_t6w28->set_enable( false ); + break; + } + break; + + case 0x39: /* Z80 enable/disable. */ + switch( data ) + { + case 0x55: /* Enable Z80 */ + m_z80->resume(SUSPEND_REASON_HALT ); + m_z80->reset(); + m_z80->set_input_line(0, CLEAR_LINE ); + break; + case 0xAA: /* Disable Z80 */ + m_z80->suspend(SUSPEND_REASON_HALT, 1 ); + break; + } + break; + + case 0x3a: /* Trigger Z80 NMI */ + m_z80->set_input_line(INPUT_LINE_NMI, PULSE_LINE ); + break; + } + m_io_reg[offset] = data; +} + + +void ngp_state::flash_w( int which, offs_t offset, UINT8 data ) +{ + if ( ! m_flash_chip[which].present ) + return; + + switch( m_flash_chip[which].state ) + { + case F_READ: + if ( offset == 0x5555 && data == 0xaa ) + m_flash_chip[which].state = F_PROG1; + m_flash_chip[which].command[0] = 0; + break; + case F_PROG1: + if ( offset == 0x2aaa && data == 0x55 ) + m_flash_chip[which].state = F_PROG2; + else + m_flash_chip[which].state = F_READ; + break; + case F_PROG2: + if ( data == 0x30 ) + { + if ( m_flash_chip[which].command[0] == 0x80 ) + { + int size = 0x10000; + UINT8 *block = m_flash_chip[which].data; + + m_flash_chip[which].state = F_AUTO_BLOCK_ERASE; + switch( m_flash_chip[which].device_id ) + { + case 0xab: + if ( offset < 0x70000 ) + block = m_flash_chip[which].data + ( offset & 0x70000 ); + else + { + if ( offset & 0x8000 ) + { + if ( offset & 0x4000 ) + { + block = m_flash_chip[which].data + ( offset & 0x7c000 ); + size = 0x4000; + } + else + { + block = m_flash_chip[which].data + ( offset & 0x7e000 ); + size = 0x2000; + } + } + else + { + block = m_flash_chip[which].data + ( offset & 0x78000 ); + size = 0x8000; + } + } + break; + case 0x2c: + if ( offset < 0xf0000 ) + block = m_flash_chip[which].data + ( offset & 0xf0000 ); + else + { + if ( offset & 0x8000 ) + { + if ( offset & 0x4000 ) + { + block = m_flash_chip[which].data + ( offset & 0xfc000 ); + size = 0x4000; + } + else + { + block = m_flash_chip[which].data + ( offset & 0xfe000 ); + size = 0x2000; + } + } + else + { + block = m_flash_chip[which].data + ( offset & 0xf8000 ); + size = 0x8000; + } + } + break; + case 0x2f: + if ( offset < 0x1f0000 ) + block = m_flash_chip[which].data + ( offset & 0x1f0000 ); + else + { + if ( offset & 0x8000 ) + { + if ( offset & 0x4000 ) + { + block = m_flash_chip[which].data + ( offset & 0x1fc000 ); + size = 0x4000; + } + else + { + block = m_flash_chip[which].data + ( offset & 0x1fe000 ); + size = 0x2000; + } + } + else + { + block = m_flash_chip[which].data + ( offset & 0x1f8000 ); + size = 0x8000; + } + } + break; + } + memset( block, 0xFF, size ); + } + else + m_flash_chip[which].state = F_READ; + } + else if ( offset == 0x5555 ) + { + switch( data ) + { + case 0x80: + m_flash_chip[which].command[0] = 0x80; + m_flash_chip[which].state = F_COMMAND; + break; + case 0x90: + m_flash_chip[which].data[0x1fc000] = m_flash_chip[which].manufacturer_id; + m_flash_chip[which].data[0xfc000] = m_flash_chip[which].manufacturer_id; + m_flash_chip[which].data[0x7c000] = m_flash_chip[which].manufacturer_id; + m_flash_chip[which].data[0] = m_flash_chip[which].manufacturer_id; + m_flash_chip[which].data[0x1fc001] = m_flash_chip[which].device_id; + m_flash_chip[which].data[0xfc001] = m_flash_chip[which].device_id; + m_flash_chip[which].data[0x7c001] = m_flash_chip[which].device_id; + m_flash_chip[which].data[1] = m_flash_chip[which].device_id; + m_flash_chip[which].data[0x1fc002] = 0x02; + m_flash_chip[which].data[0xfc002] = 0x02; + m_flash_chip[which].data[0x7c002] = 0x02; + m_flash_chip[which].data[2] = 0x02; + m_flash_chip[which].data[0x1fc003] = 0x80; + m_flash_chip[which].data[0xfc003] = 0x80; + m_flash_chip[which].data[0x7c003] = 0x80; + m_flash_chip[which].data[3] = 0x80; + m_flash_chip[which].state = F_ID_READ; + break; + case 0x9a: + if ( m_flash_chip[which].command[0] == 0x9a ) + m_flash_chip[which].state = F_BLOCK_PROTECT; + else + { + m_flash_chip[which].command[0] = 0x9a; + m_flash_chip[which].state = F_COMMAND; + } + break; + case 0xa0: + m_flash_chip[which].state = F_AUTO_PROGRAM; + break; + case 0xf0: + default: + m_flash_chip[which].state = F_READ; + break; + } + } + else + m_flash_chip[which].state = F_READ; + break; + case F_COMMAND: + if ( offset == 0x5555 && data == 0xaa ) + m_flash_chip[which].state = F_PROG1; + else + m_flash_chip[which].state = F_READ; + break; + case F_ID_READ: + if ( offset == 0x5555 && data == 0xaa ) + m_flash_chip[which].state = F_PROG1; + else + m_flash_chip[which].state = F_READ; + m_flash_chip[which].command[0] = 0; + break; + case F_AUTO_PROGRAM: + /* Only 1 -> 0 changes can be programmed */ + m_flash_chip[which].data[offset] = m_flash_chip[which].data[offset] & data; + m_flash_chip[which].state = F_READ; + break; + case F_AUTO_CHIP_ERASE: + m_flash_chip[which].state = F_READ; + break; + case F_AUTO_BLOCK_ERASE: + m_flash_chip[which].state = F_READ; + break; + case F_BLOCK_PROTECT: + m_flash_chip[which].state = F_READ; + break; + } + + if ( m_flash_chip[which].state == F_READ ) + { + /* Exit command/back to normal operation*/ + m_flash_chip[which].data[0] = m_flash_chip[which].org_data[0]; + m_flash_chip[which].data[1] = m_flash_chip[which].org_data[1]; + m_flash_chip[which].data[2] = m_flash_chip[which].org_data[2]; + m_flash_chip[which].data[3] = m_flash_chip[which].org_data[3]; + m_flash_chip[which].data[0x7c000] = m_flash_chip[which].org_data[4]; + m_flash_chip[which].data[0x7c001] = m_flash_chip[which].org_data[5]; + m_flash_chip[which].data[0x7c002] = m_flash_chip[which].org_data[6]; + m_flash_chip[which].data[0x7c003] = m_flash_chip[which].org_data[7]; + m_flash_chip[which].data[0xfc000] = m_flash_chip[which].org_data[8]; + m_flash_chip[which].data[0xfc001] = m_flash_chip[which].org_data[9]; + m_flash_chip[which].data[0xfc002] = m_flash_chip[which].org_data[10]; + m_flash_chip[which].data[0xfc003] = m_flash_chip[which].org_data[11]; + m_flash_chip[which].data[0x1fc000] = m_flash_chip[which].org_data[12]; + m_flash_chip[which].data[0x1fc001] = m_flash_chip[which].org_data[13]; + m_flash_chip[which].data[0x1fc002] = m_flash_chip[which].org_data[14]; + m_flash_chip[which].data[0x1fc003] = m_flash_chip[which].org_data[15]; + m_flash_chip[which].command[0] = 0; + } +} + + +WRITE8_MEMBER( ngp_state::flash0_w ) +{ + flash_w( 0, offset, data ); +} + + +WRITE8_MEMBER( ngp_state::flash1_w ) +{ + flash_w( 1, offset, data ); +} + + +static ADDRESS_MAP_START( ngp_mem, AS_PROGRAM, 8, ngp_state ) + AM_RANGE( 0x000080, 0x0000bf ) AM_READWRITE(ngp_io_r, ngp_io_w) /* ngp/c specific i/o */ + AM_RANGE( 0x004000, 0x006fff ) AM_RAM AM_SHARE("mainram") /* work ram */ + AM_RANGE( 0x007000, 0x007fff ) AM_RAM AM_SHARE("share1") /* shared with sound cpu */ + AM_RANGE( 0x008000, 0x00bfff ) AM_DEVREADWRITE("k1ge", k1ge_device, read, write) /* video chip */ + AM_RANGE( 0x200000, 0x3fffff ) AM_WRITE(flash0_w) /* cart area #1 */ + AM_RANGE( 0x800000, 0x9fffff ) AM_WRITE(flash1_w) /* cart area #2 */ + AM_RANGE( 0xff0000, 0xffffff ) AM_ROM AM_REGION("maincpu", 0) /* system rom */ +ADDRESS_MAP_END + + +READ8_MEMBER( ngp_state::ngp_z80_comm_r ) +{ + return m_io_reg[0x3c]; +} + + +WRITE8_MEMBER( ngp_state::ngp_z80_comm_w ) +{ + m_io_reg[0x3c] = data; +} + + +WRITE8_MEMBER( ngp_state::ngp_z80_signal_main_w ) +{ + m_tlcs900->set_input_line(TLCS900_INT5, ASSERT_LINE ); +} + + +static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, ngp_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_RAM AM_SHARE("share1") /* shared with tlcs900 */ + AM_RANGE( 0x4000, 0x4001 ) AM_DEVWRITE("t6w28", t6w28_device, write ) /* sound chip (right, left) */ + AM_RANGE( 0x8000, 0x8000 ) AM_READWRITE( ngp_z80_comm_r, ngp_z80_comm_w ) /* main-sound communication */ + AM_RANGE( 0xc000, 0xc000 ) AM_WRITE( ngp_z80_signal_main_w ) /* signal irq to main cpu */ +ADDRESS_MAP_END + + +WRITE8_MEMBER( ngp_state::ngp_z80_clear_irq ) +{ + m_z80->set_input_line(0, CLEAR_LINE ); + + /* I am not exactly sure what causes the maincpu INT5 signal to be cleared. This will do for now. */ + m_tlcs900->set_input_line(TLCS900_INT5, CLEAR_LINE ); +} + + +static ADDRESS_MAP_START( z80_io, AS_IO, 8, ngp_state ) + AM_RANGE( 0x0000, 0xffff ) AM_WRITE( ngp_z80_clear_irq ) +ADDRESS_MAP_END + + +INPUT_CHANGED_MEMBER(ngp_state::power_callback) +{ + if ( m_io_reg[0x33] & 0x04 ) + { + m_tlcs900->set_input_line(TLCS900_NMI, (m_io_power->read() & 0x01 ) ? CLEAR_LINE : ASSERT_LINE ); + } +} + + +static INPUT_PORTS_START( ngp ) + PORT_START("Controls") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Button A") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Button B") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SELECT) PORT_NAME("Option") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("Power") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_Q) PORT_NAME("Power") PORT_CHANGED_MEMBER(DEVICE_SELF, ngp_state, power_callback, NULL) +INPUT_PORTS_END + + +WRITE_LINE_MEMBER( ngp_state::ngp_vblank_pin_w ) +{ + m_tlcs900->set_input_line(TLCS900_INT4, state ? ASSERT_LINE : CLEAR_LINE ); +} + + +WRITE_LINE_MEMBER( ngp_state::ngp_hblank_pin_w ) +{ + m_tlcs900->set_input_line(TLCS900_TIO, state ? ASSERT_LINE : CLEAR_LINE ); +} + + +WRITE8_MEMBER( ngp_state::ngp_tlcs900_porta ) +{ + int to3 = BIT(data,3); + if ( to3 && ! m_old_to3 ) + m_z80->set_input_line(0, ASSERT_LINE ); + + m_old_to3 = to3; +} + + +void ngp_state::machine_start() +{ + if (m_cart->exists()) + { + std::string region_tag; + UINT8 *cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(); + + m_maincpu->space(AS_PROGRAM).install_read_bank(0x200000, 0x3fffff, "flash0"); + m_maincpu->space(AS_PROGRAM).install_read_bank(0x800000, 0x9fffff, "flash1"); + membank("flash0")->set_base(cart); + membank("flash1")->set_base(cart + 0x200000); + + m_flash_chip[0].data = cart; + m_flash_chip[0].org_data[0] = m_flash_chip[0].data[0]; + m_flash_chip[0].org_data[1] = m_flash_chip[0].data[1]; + m_flash_chip[0].org_data[2] = m_flash_chip[0].data[2]; + m_flash_chip[0].org_data[3] = m_flash_chip[0].data[3]; + m_flash_chip[0].org_data[4] = m_flash_chip[0].data[0x7c000]; + m_flash_chip[0].org_data[5] = m_flash_chip[0].data[0x7c001]; + m_flash_chip[0].org_data[6] = m_flash_chip[0].data[0x7c002]; + m_flash_chip[0].org_data[7] = m_flash_chip[0].data[0x7c003]; + m_flash_chip[0].org_data[8] = m_flash_chip[0].data[0xfc000]; + m_flash_chip[0].org_data[9] = m_flash_chip[0].data[0xfc001]; + m_flash_chip[0].org_data[10] = m_flash_chip[0].data[0xfc002]; + m_flash_chip[0].org_data[11] = m_flash_chip[0].data[0xfc003]; + m_flash_chip[0].org_data[12] = m_flash_chip[0].data[0x1fc000]; + m_flash_chip[0].org_data[13] = m_flash_chip[0].data[0x1fc001]; + m_flash_chip[0].org_data[14] = m_flash_chip[0].data[0x1fc002]; + m_flash_chip[0].org_data[15] = m_flash_chip[0].data[0x1fc003]; + + m_flash_chip[1].data = cart + 0x200000; + m_flash_chip[1].org_data[0] = m_flash_chip[1].data[0]; + m_flash_chip[1].org_data[1] = m_flash_chip[1].data[1]; + m_flash_chip[1].org_data[2] = m_flash_chip[1].data[2]; + m_flash_chip[1].org_data[3] = m_flash_chip[1].data[3]; + m_flash_chip[1].org_data[4] = m_flash_chip[1].data[0x7c000]; + m_flash_chip[1].org_data[5] = m_flash_chip[1].data[0x7c001]; + m_flash_chip[1].org_data[6] = m_flash_chip[1].data[0x7c002]; + m_flash_chip[1].org_data[7] = m_flash_chip[1].data[0x7c003]; + m_flash_chip[1].org_data[8] = m_flash_chip[1].data[0xfc000]; + m_flash_chip[1].org_data[9] = m_flash_chip[1].data[0xfc001]; + m_flash_chip[1].org_data[10] = m_flash_chip[1].data[0xfc002]; + m_flash_chip[1].org_data[11] = m_flash_chip[1].data[0xfc003]; + m_flash_chip[1].org_data[12] = m_flash_chip[1].data[0x1fc000]; + m_flash_chip[1].org_data[13] = m_flash_chip[1].data[0x1fc001]; + m_flash_chip[1].org_data[14] = m_flash_chip[1].data[0x1fc002]; + m_flash_chip[1].org_data[15] = m_flash_chip[1].data[0x1fc003]; + } + else + { + m_maincpu->space(AS_PROGRAM).unmap_read(0x200000, 0x3fffff); + m_maincpu->space(AS_PROGRAM).unmap_read(0x800000, 0x9fffff); + } + + m_seconds_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ngp_state::ngp_seconds_callback),this)); + m_seconds_timer->adjust( attotime::from_seconds(1), 0, attotime::from_seconds(1) ); + + save_item(NAME(m_io_reg)); + save_item(NAME(m_old_to3)); + // TODO: check if these are handled correctly... + save_item(NAME(m_flash_chip[0].present)); + save_item(NAME(m_flash_chip[0].manufacturer_id)); + save_item(NAME(m_flash_chip[0].device_id)); + save_item(NAME(m_flash_chip[0].org_data)); + save_item(NAME(m_flash_chip[0].state)); + save_item(NAME(m_flash_chip[0].command)); + save_item(NAME(m_flash_chip[1].present)); + save_item(NAME(m_flash_chip[1].manufacturer_id)); + save_item(NAME(m_flash_chip[1].device_id)); + save_item(NAME(m_flash_chip[1].org_data)); + save_item(NAME(m_flash_chip[1].state)); + save_item(NAME(m_flash_chip[1].command)); +} + + +void ngp_state::machine_reset() +{ + m_old_to3 = 0; + + m_z80->suspend(SUSPEND_REASON_HALT, 1); + m_z80->set_input_line(0, CLEAR_LINE); + + if ( m_nvram_loaded ) + { + m_tlcs900->set_state_int(TLCS900_PC, 0xFF1800); + } +} + + +UINT32 ngp_state::screen_update_ngp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_k1ge->update( bitmap, cliprect ); + return 0; +} + + +DEVICE_IMAGE_LOAD_MEMBER( ngp_state, ngp_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size != 0x8000 && size != 0x80000 && size != 0x100000 && size != 0x200000 && size != 0x400000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + // alloc 0x400000 ROM to simplify mapping in the address map + m_cart->rom_alloc(0x400000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + //printf("%2x%2x - %x - %x\n", (unsigned int) memregion("cart")->u8(0x20), (unsigned int) memregion("cart")->u8(0x21), + // (unsigned int) memregion("cart")->u8(0x22), (unsigned int) memregion("cart")->u8(0x23)); + m_flash_chip[0].manufacturer_id = 0x98; + m_flash_chip[0].present = 1; + m_flash_chip[0].state = F_READ; + + switch (size) + { + case 0x8000: + case 0x80000: + m_flash_chip[0].device_id = 0xab; + break; + case 0x100000: + m_flash_chip[0].device_id = 0x2c; + break; + case 0x200000: + case 0x400000: + m_flash_chip[0].device_id = 0x2f; + break; + } + + if (size == 0x400000) + { + m_flash_chip[1].manufacturer_id = 0x98; + m_flash_chip[1].device_id = 0x2f; + m_flash_chip[1].present = 1; + m_flash_chip[1].state = F_READ; + } + + return IMAGE_INIT_PASS; +} + + +DEVICE_IMAGE_UNLOAD_MEMBER( ngp_state, ngp_cart ) +{ + m_flash_chip[0].present = 0; + m_flash_chip[0].state = F_READ; + + m_flash_chip[1].present = 0; + m_flash_chip[1].state = F_READ; +} + + +void ngp_state::nvram_default() +{ +} + + +void ngp_state::nvram_read(emu_file &file) +{ + file.read(m_mainram, 0x3000); + m_nvram_loaded = true; +} + + +void ngp_state::nvram_write(emu_file &file) +{ + file.write(m_mainram, 0x3000); +} + + +static MACHINE_CONFIG_START( ngp_common, ngp_state ) + + MCFG_CPU_ADD( "maincpu", TMP95C061, XTAL_6_144MHz ) + MCFG_TLCS900H_AM8_16(1) + MCFG_CPU_PROGRAM_MAP( ngp_mem) + MCFG_TMP95C061_PORTA_WRITE(WRITE8(ngp_state,ngp_tlcs900_porta)) + + MCFG_CPU_ADD( "soundcpu", Z80, XTAL_6_144MHz/2 ) + MCFG_CPU_PROGRAM_MAP( z80_mem) + MCFG_CPU_IO_MAP( z80_io) + + MCFG_SCREEN_ADD( "screen", LCD ) + MCFG_SCREEN_RAW_PARAMS( XTAL_6_144MHz, 515, 0, 160 /*480*/, 199, 0, 152 ) + MCFG_SCREEN_UPDATE_DRIVER(ngp_state, screen_update_ngp) + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO( "lspeaker","rspeaker" ) + + MCFG_SOUND_ADD( "t6w28", T6W28, XTAL_6_144MHz/2 ) + MCFG_SOUND_ROUTE( 0, "lspeaker", 0.50 ) + MCFG_SOUND_ROUTE( 1, "rspeaker", 0.50 ) + + MCFG_SOUND_ADD( "dac_l", DAC, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "lspeaker", 0.50 ) + MCFG_SOUND_ADD( "dac_r", DAC, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "rspeaker", 0.50 ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ngp, ngp_common ) + + MCFG_K1GE_ADD( "k1ge", XTAL_6_144MHz, "screen", WRITELINE( ngp_state, ngp_vblank_pin_w ), WRITELINE( ngp_state, ngp_hblank_pin_w ) ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_PALETTE("k1ge:palette") + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ngp_cart") + MCFG_GENERIC_EXTENSIONS("bin,ngp,npc,ngc") + MCFG_GENERIC_LOAD(ngp_state, ngp_cart) + MCFG_GENERIC_UNLOAD(ngp_state, ngp_cart) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","ngp") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ngpc_list","ngpc") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ngpc, ngp_common ) + MCFG_K2GE_ADD( "k1ge", XTAL_6_144MHz, "screen", WRITELINE( ngp_state, ngp_vblank_pin_w ), WRITELINE( ngp_state, ngp_hblank_pin_w ) ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_PALETTE("k1ge:palette") + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ngp_cart") + MCFG_GENERIC_EXTENSIONS("bin,ngp,npc,ngc") + MCFG_GENERIC_LOAD(ngp_state, ngp_cart) + MCFG_GENERIC_UNLOAD(ngp_state, ngp_cart) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","ngpc") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ngp_list","ngp") +MACHINE_CONFIG_END + + +ROM_START( ngp ) + ROM_REGION( 0x10000, "maincpu" , 0 ) + ROM_LOAD( "ngp_bios.ngp", 0x0000, 0x10000, CRC(6232df8d) SHA1(2f6429b68446536d8b03f35d02f1e98beb6460a0) ) +ROM_END + + +ROM_START( ngpc ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "ngpcbios.rom", 0x0000, 0x10000, CRC(6eeb6f40) SHA1(edc13192054a59be49c6d55f83b70e2510968e86) ) +ROM_END + + +CONS( 1998, ngp, 0, 0, ngp, ngp, driver_device, 0, "SNK", "NeoGeo Pocket", MACHINE_SUPPORTS_SAVE ) +CONS( 1999, ngpc, ngp, 0, ngpc, ngp, driver_device, 0, "SNK", "NeoGeo Pocket Color", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/ob68k1a.c b/src/mame/drivers/ob68k1a.c new file mode 100644 index 00000000000..e28b6234825 --- /dev/null +++ b/src/mame/drivers/ob68k1a.c @@ -0,0 +1,292 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Omnibyte OB68K1A + +PCB Layout +---------- + +REV-B + +|-----------------------------------------------------------| +| 555 CN3 CN4 CN5 8116 SW5 10MHz | +| 5.0688MHz | +| PIA PIA | +| ACIA ROM1 ROM0 | +| ACIA PTM ROM3 ROM2 | +| SW1 ROM5 ROM4 | +| CPU | +| SW2 4164 4164 4164 4164 | +| 4164 4164 4164 4164 | +| SW3 4164 4164 4164 4164 | +| 555 4164 4164 4164 4164 | +| SW4 8409 | +|-|-------------CN1----------------|----|-------CN2-------|-| + |--------------------------------| |-----------------| + +Notes: + Relevant IC's shown. + + CPU - Motorola MC68000L10 + PIA - Motorola MC6821P + ACIA - Motorola MC6850P + PTM - Motorola MC6840P + 8116 - SMC COM8116 + 8409 - National Semiconductor DP8409N DRAM Controller + 4164 - Fujitsu MB8264A-12 64Kx1 RAM + 555 - NE555N + SW1 - RAM address DIP8 + SW2 - I/O address DIP8 + SW3 - ROM address DIP8 + SW4 - external RAM access address DIP8 + SW5 - push button + CN1 - 2x43 PCB edge, IEEE 796 (Multibus) + CN2 - 2x30 PCB edge, IEEE 796 (Multibus) + CN3 - 2x25 header, ACIA 0 + CN4 - 2x25 header, ACIA 1 + CN5 - 2x50 header, PIA + +*/ + +/* + + TODO: + + - interrupts + - configuration switches + - PIA odd/even byte access + +*/ + + +#include "includes/ob68k1a.h" + + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// com8116_w - baud rate selection +//------------------------------------------------- + +WRITE8_MEMBER( ob68k1a_state::com8116_w ) +{ + m_dbrg->stt_w(data & 0x0f); + m_dbrg->str_w(data >> 4); +} + + +//------------------------------------------------- +// pia_r - trampoline for PIA odd/even access +//------------------------------------------------- + +READ8_MEMBER( ob68k1a_state::pia_r ) +{ + if (offset) { + return m_pia1->read(space,0); + } else { + return m_pia0->read(space,0); + } +} + + +//------------------------------------------------- +// pia_w - trampoline for PIA odd/even access +//------------------------------------------------- + +WRITE8_MEMBER( ob68k1a_state::pia_w ) +{ + if (offset) { + m_pia1->write(space,0,data); + } else { + m_pia0->write(space,0,data); + } +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( ob68k1a_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ob68k1a_mem, AS_PROGRAM, 16, ob68k1a_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x01ffff) AM_RAM + AM_RANGE(0xfe0000, 0xfeffff) AM_ROM AM_REGION(MC68000L10_TAG, 0) + AM_RANGE(0xffff00, 0xffff01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, status_r, control_w, 0x00ff) + AM_RANGE(0xffff02, 0xffff03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, data_r, data_w, 0x00ff) + AM_RANGE(0xffff10, 0xffff11) AM_WRITE8(com8116_w, 0xff00) + AM_RANGE(0xffff20, 0xffff21) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, status_r, control_w, 0x00ff) + AM_RANGE(0xffff22, 0xffff23) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, data_r, data_w, 0x00ff) +// AM_RANGE(0xffff40, 0xffff47) AM_DEVREADWRITE8(MC6821_0_TAG, pia6821_device, read, write, 0x00ff) +// AM_RANGE(0xffff40, 0xffff47) AM_DEVREADWRITE8(MC6821_1_TAG, pia6821_device, read, write, 0xff00) + AM_RANGE(0xffff40, 0xffff47) AM_READWRITE8(pia_r, pia_w, 0xffff) + AM_RANGE(0xffff60, 0xffff6f) AM_DEVREADWRITE8(MC6840_TAG, ptm6840_device, read, write, 0x00ff) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( ob68k1a ) +//------------------------------------------------- + +INPUT_PORTS_START( ob68k1a ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + + +//------------------------------------------------- +// COM8116_INTERFACE( dbrg_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( ob68k1a_state::rx_tx_0_w ) +{ + m_acia0->write_txc(state); + m_acia0->write_rxc(state); +} + +WRITE_LINE_MEMBER( ob68k1a_state::rx_tx_1_w ) +{ + m_acia1->write_txc(state); + m_acia1->write_rxc(state); +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( ob68k1a ) +//------------------------------------------------- + +void ob68k1a_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + // configure RAM + switch (m_ram->size()) + { + case 32*1024: + program.unmap_readwrite(0x008000, 0x01ffff); + break; + } +} + + +void ob68k1a_state::machine_reset() +{ + // initialize COM8116 + m_dbrg->stt_w(0x0e); + m_dbrg->str_w(0x0e); + + // set reset vector + void *ram = m_maincpu->space(AS_PROGRAM).get_write_ptr(0); + UINT8 *rom = memregion(MC68000L10_TAG)->base(); + + memcpy(ram, rom, 8); + + m_maincpu->reset(); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( ob68k1a ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ob68k1a, ob68k1a_state ) + // basic machine hardware + MCFG_CPU_ADD(MC68000L10_TAG, M68000, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(ob68k1a_mem) + + // devices + MCFG_DEVICE_ADD(MC6821_0_TAG, PIA6821, 0) + MCFG_DEVICE_ADD(MC6821_1_TAG, PIA6821, 0) + MCFG_DEVICE_ADD(MC6840_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(XTAL_10MHz/10) + MCFG_PTM6840_EXTERNAL_CLOCKS(0, 0, 0) + + MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC6850_0_TAG, acia6850_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC6850_0_TAG, acia6850_device, write_dcd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC6850_0_TAG, acia6850_device, write_cts)) + + MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_dcd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_cts)) + + MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(ob68k1a_state, rx_tx_0_w)) + MCFG_COM8116_FT_HANDLER(WRITELINE(ob68k1a_state, rx_tx_1_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("128K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( ob68k1a ) +//------------------------------------------------- + +ROM_START( ob68k1a ) + ROM_REGION16_BE( 0x10000, MC68000L10_TAG, 0 ) + ROM_LOAD16_BYTE( "macsbug.u60", 0x0000, 0x2000, CRC(7c8905ff) SHA1(eba6c70f6b5b40d60e2885c2bd33dd93ec2aae48) ) + ROM_LOAD16_BYTE( "macsbug.u61", 0x0001, 0x2000, CRC(b5069252) SHA1(b310465d8ece944bd694cc9726d03fed0f4b2c0f) ) + ROM_LOAD16_BYTE( "idris_boot.u62", 0x4000, 0x2000, CRC(091e900e) SHA1(ea0c9f3ad5179eab2e743459c8afb707c059f0e2) ) + ROM_LOAD16_BYTE( "idris_boot.u63", 0x4001, 0x2000, CRC(a132259f) SHA1(34216bf1d22ff0f0af29699a1e4e0e57631f775d) ) + + ROM_REGION( 0x100, "plds", 0 ) + ROM_LOAD( "1.0.u18", 0x000, 0x100, NO_DUMP ) // PAL16L8 + ROM_LOAD( "2.5.u20", 0x000, 0x100, NO_DUMP ) // PAL16L8 + ROM_LOAD( "3.2.u21", 0x000, 0x100, NO_DUMP ) // PAL16R4 + ROM_LOAD( "4.3.u49", 0x000, 0x100, NO_DUMP ) // PAL16R4 + ROM_LOAD( "5.1.u51", 0x000, 0x100, NO_DUMP ) // PAL16L8 + ROM_LOAD( "6.2.u55", 0x000, 0x100, NO_DUMP ) // PAL16L8 +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1982, ob68k1a, 0, 0, ob68k1a, ob68k1a, driver_device, 0, "Omnibyte", "OB68K1A", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/octopus.c b/src/mame/drivers/octopus.c new file mode 100644 index 00000000000..7e9ce91967e --- /dev/null +++ b/src/mame/drivers/octopus.c @@ -0,0 +1,198 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Hilger Analytical AB6089 Mk. 1 (LSI Octopus) + +2013-07-26 Skeleton driver. + +http://computers.mcbx.netne.net/8bit/hilger/index.htm + +Below is an extract from the page: + +The computer has 2 CPUs: Z80 and 8088. Most circuits are dated 1985-1986, display circuitry is made by Signetics. +Mainboard was manufactured by LSI Computers Ltd. under part numbers: 15000SS100 and 15000P4100. All steel parts +of casing are grounded by wires. It's graphics card works in pass-through mode: It takes picture from mainboard's +TTL output and adds image to it, then it puts it to monitor. Its ROM is prepared for hard disk and some type of +network, yet no HDD controller nor network interfaces are present inside - it seems that they were added as +expansion cards. + +UPDATE: It's re-branded LSI Octopus computer, a very well-expandable machine which was designed to "grow with a +company". First stage was a computer which could be used even with TV set. As requirements increased, Octopus +could be equipped with hard disk controller, network adapter, multi-terminal serial port card to act as a terminal +server or even CPU cards to run concurrent systems. There were even tape backup devices for it. Octopus could run +CP/M, MP/M (concurrent - multitasking-like OS, even with terminals), or even MS-DOS - CP/M or MP/M could be used +with Z80 or 8080. There was also LSI ELSIE system, a concurrent DOS. Last British LSI machines were 386 computers +which could be used as servers for Octopus computers. + +Manufacturer Hilger Analytical / LSI Computers Ltd. + +Origin UK +Year of unit 1986? +Year of introduction 1985 +End of production ? +CPU Z80, 8088 +Speed ?? +RAM 256kB +ROM 16kB (Basic) +Colors: ?? +Sound: Speaker. Beeps :) +OS: CP/M 80 or 86 +MP/M 80 o 86 +Concurrent CP/M +LSI ELSIE +MS-DOS +Display modes: Text: ?? +Graphics: ?? + +Media: Two internal 5.25" floppy disk drives, DS DD, 96tpi. +Probably hard disk + +Power supply: +Built-in switching power supply. + +I/O: Serial port +2 parallel ports + +Video TTL Output +Composite video output + +Possible upgrades: Many + +Software accessibility: +Dedicated: Impossible. +CP/M - Good +DOS - Good. + +It won't take XT nor AT keyboard, but pinout is quite similar. UPDATE: I saw a few photos of keyboard. +It's another Z80 computer! It has an EPROM, simple memory and CPU. + +After powering on, it should perform POST writing: + +TESTING... + Main Processor + PROM + DMA Controllers + RAM + Interrupts + Floppy Discs + Hard Disc Controller (optionally - if installed) + +Waiting for hard Disc... (Optionally - if installed) + +Firmware versions: + +SYSTEM 18B (or other) +GRAPHICS 4 (if graphic card installed) + +And probably it should boot or display: + +Insert System Disk. + +Or maybe: + +Nowhere to boot from. + +Load options: + Floppy + Pro Network + Winchester +Enter selection: + +This information was gained by studying boot ROM of the machine. + +It's a very rare computer. It has 2 processors, Z80 and 8088, so it seems that it may run CP/M and DOS. +Its BIOS performs POST and halts as there's no keyboard. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" + + +class octopus_state : public driver_device +{ +public: + octopus_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + DECLARE_WRITE8_MEMBER(port_c9); + UINT32 screen_update_octopus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START( octopus_mem, AS_PROGRAM, 8, octopus_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x1ffff) AM_RAM + AM_RANGE(0xe4000, 0xe4fff) AM_RAM // character definitions + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( octopus_io, AS_IO, 8, octopus_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xc5, 0xc9) AM_WRITE(port_c9) +ADDRESS_MAP_END + +WRITE8_MEMBER( octopus_state::port_c9 ) +{ + if (offset == 0) + printf("\n"); + if (offset == 4) + printf("%c",data); +} + + +/* Input ports */ +static INPUT_PORTS_START( octopus ) +INPUT_PORTS_END + + +void octopus_state::machine_reset() +{ +} + +void octopus_state::video_start() +{ +} + +UINT32 octopus_state::screen_update_octopus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( octopus, octopus_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8088, XTAL_9_8304MHz) // absolutely no idea what frequency + MCFG_CPU_PROGRAM_MAP(octopus_mem) + MCFG_CPU_IO_MAP(octopus_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(octopus_state, screen_update_octopus) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( octopus ) + ROM_REGION( 0x4000, "user1", 0 ) + ROM_LOAD( "octopus_main_prom", 0x0000, 0x4000, CRC(b5b4518d) SHA1(41b8729c4c9074914fd4ea181c8b6d4805ee2b93) ) + + // This rom was on the graphics card (yes, it has slots) + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "octopus_gfx_card", 0x0000, 0x2000, CRC(b2386534) SHA1(5e3c4682afb4eb222e48a7203269a16d26911836) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, octopus, 0, 0, octopus, octopus, driver_device, 0, "Digital Microsystems", "LSI Octopus", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/odyssey2.c b/src/mame/drivers/odyssey2.c new file mode 100644 index 00000000000..fdd98f3b815 --- /dev/null +++ b/src/mame/drivers/odyssey2.c @@ -0,0 +1,833 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + /drivers/odyssey2.c + + Driver file to handle emulation of the Odyssey2. + + Minor update to "the voice" rom names, and add comment about + the older revision of "the voice" - LN, 10/03/08 + +***************************************************************************/ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "video/i8244.h" +#include "machine/i8243.h" +#include "video/ef9340_1.h" + +#include "bus/odyssey2/slot.h" + + +class odyssey2_state : public driver_device +{ +public: + odyssey2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_i8244(*this, "i8244"), + m_cart(*this, "cartslot"), + m_keyboard(*this, "KEY"), + m_joysticks(*this, "JOY") { } + + required_device m_maincpu; + required_device m_i8244; + required_device m_cart; + + UINT8 m_ram[256]; + UINT8 m_p1; + UINT8 m_p2; + UINT8 m_lum; + DECLARE_READ8_MEMBER(io_read); + DECLARE_WRITE8_MEMBER(io_write); + DECLARE_READ8_MEMBER(bus_read); + DECLARE_WRITE8_MEMBER(bus_write); + DECLARE_READ8_MEMBER(p1_read); + DECLARE_WRITE8_MEMBER(p1_write); + DECLARE_READ8_MEMBER(p2_read); + DECLARE_WRITE8_MEMBER(p2_write); + DECLARE_READ8_MEMBER(t1_read); + DECLARE_DRIVER_INIT(odyssey2); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(odyssey2); + UINT32 screen_update_odyssey2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(irq_callback); + + DECLARE_WRITE16_MEMBER(scanline_postprocess); + +protected: + /* constants */ + static const UINT8 P1_BANK_LO_BIT = 0x01; + static const UINT8 P1_BANK_HI_BIT = 0x02; + static const UINT8 P1_KEYBOARD_SCAN_ENABLE = 0x04; /* active low */ + static const UINT8 P1_VDC_ENABLE = 0x08; /* active low */ + static const UINT8 P1_EXT_RAM_ENABLE = 0x10; /* active low */ + static const UINT8 P1_VPP_ENABLE = 0x20; /* active low */ + static const UINT8 P1_VDC_COPY_MODE_ENABLE = 0x40; + static const UINT8 P2_KEYBOARD_SELECT_MASK = 0x07; /* select row to scan */ + + required_ioport_array<6> m_keyboard; + required_ioport_array<2> m_joysticks; +}; + +class g7400_state : public odyssey2_state +{ +public: + g7400_state(const machine_config &mconfig, device_type type, const char *tag) + : odyssey2_state(mconfig, type, tag) + , m_i8243(*this, "i8243") + , m_ef9340_1(*this, "ef9340_1") + { } + + required_device m_i8243; + required_device m_ef9340_1; + + DECLARE_PALETTE_INIT(g7400); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_WRITE8_MEMBER(p2_write); + DECLARE_READ8_MEMBER(io_read); + DECLARE_WRITE8_MEMBER(io_write); + DECLARE_WRITE8_MEMBER(i8243_port_w); + DECLARE_WRITE16_MEMBER(scanline_postprocess); + +protected: + UINT8 m_ic674_decode[8]; + UINT8 m_ic678_decode[8]; +}; + + +static ADDRESS_MAP_START( odyssey2_mem , AS_PROGRAM, 8, odyssey2_state ) + AM_RANGE(0x0000, 0x03ff) AM_ROM + AM_RANGE(0x0400, 0x0bff) AM_DEVREAD("cartslot", o2_cart_slot_device, read_rom04) + AM_RANGE(0x0c00, 0x0fff) AM_DEVREAD("cartslot", o2_cart_slot_device, read_rom0c) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( odyssey2_io , AS_IO, 8, odyssey2_state ) + AM_RANGE(0x00, 0xff) AM_READWRITE(io_read, io_write) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_read, p1_write) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_read, p2_write) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_read, bus_write) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_DEVREAD("cartslot", o2_cart_slot_device, t0_read) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_read) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( g7400_io , AS_IO, 8, g7400_state ) + AM_RANGE(0x00, 0xff) AM_READWRITE(io_read, io_write) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_read, p1_write) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_read, p2_write) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_read, bus_write) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_DEVREAD("cartslot", o2_cart_slot_device, t0_read) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_read) + AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w); +ADDRESS_MAP_END + + +static INPUT_PORTS_START( odyssey2 ) + PORT_START("KEY.0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("KEY.1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?? :") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?? $") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + + PORT_START("KEY.2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("KEY.3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + + PORT_START("KEY.4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + + PORT_START("KEY.5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(DEF_STR( Yes )) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(DEF_STR( No )) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + + PORT_START("JOY.0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT( 0xe0, 0xe0, IPT_UNUSED ) + + PORT_START("JOY.1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT( 0xe0, 0xe0, IPT_UNUSED ) +INPUT_PORTS_END + + +/* character sprite colors + dark grey, red, green, yellow, blue, violet, light grey, white + dark back / grid colors + black, dark blue, dark green, light green, red, violet, yellow, light grey + light back / grid colors + black, blue, green, light green, red, violet, yellow, light grey */ + +const UINT8 odyssey2_colors[] = +{ + /* Background,Grid Dim */ + 0x00,0x00,0x00, /* Black */ // i r g b + 0x1A,0x37,0xBE, /* Blue - Calibrated To Real VideoPac */ // i r g B + 0x00,0x6D,0x07, /* Green - Calibrated To Real VideoPac */ // i r G b + 0x2A,0xAA,0xBE, /* Blue-Green - Calibrated To Real VideoPac */ // i r G B + 0x79,0x00,0x00, /* Red - Calibrated To Real VideoPac */ // i R g b + 0x94,0x30,0x9F, /* Violet - Calibrated To Real VideoPac */ // i R g B + 0x77,0x67,0x0B, /* Khaki - Calibrated To Real VideoPac */ // i R g B + 0xCE,0xCE,0xCE, /* Lt Grey */ // i R G B + + /* Background,Grid Bright */ + 0x67,0x67,0x67, /* Grey - Calibrated To Real VideoPac */ // I R g B + 0x5C,0x80,0xF6, /* Lt Blue - Calibrated To Real VideoPac */ // I R g B + 0x56,0xC4,0x69, /* Lt Green - Calibrated To Real VideoPac */ // I R g B + 0x77,0xE6,0xEB, /* Lt Blue-Green - Calibrated To Real VideoPac */ // I R g b + 0xC7,0x51,0x51, /* Lt Red - Calibrated To Real VideoPac */ // I R g b + 0xDC,0x84,0xE8, /* Lt Violet - Calibrated To Real VideoPac */ // I R g B + 0xC6,0xB8,0x6A, /* Lt Yellow - Calibrated To Real VideoPac */ // I R G b + 0xFF,0xFF,0xFF, /* White */ // I R G B +}; + + +PALETTE_INIT_MEMBER(odyssey2_state, odyssey2) +{ + for ( int i = 0; i < 16; i++ ) + { + palette.set_pen_color( i, odyssey2_colors[i*3], odyssey2_colors[i*3+1], odyssey2_colors[i*3+2] ); + } +} + + +PALETTE_INIT_MEMBER(g7400_state, g7400) +{ + const UINT8 g7400_colors[] = + { + 0x00,0x00,0x00, // Black + 0x1A,0x37,0xBE, // Blue + 0x00,0x6D,0x07, // Green + 0x2A,0xAA,0xBE, // Blue-Green + 0x79,0x00,0x00, // Red + 0x94,0x30,0x9F, // Violet + 0x77,0x67,0x0B, // Khaki + 0xCE,0xCE,0xCE, // Lt Grey + + 0x67,0x67,0x67, // Grey + 0x5C,0x80,0xF6, // Lt Blue + 0x56,0xC4,0x69, // Lt Green + 0x77,0xE6,0xEB, // Lt Blue-Green + 0xC7,0x51,0x51, // Lt Red + 0xDC,0x84,0xE8, // Lt Violet + 0xC6,0xB8,0x6A, // Lt Yellow + 0xff,0xff,0xff // White + + }; + + for ( int i = 0; i < 16; i++ ) + { + palette.set_pen_color( i, g7400_colors[i*3], g7400_colors[i*3+1], g7400_colors[i*3+2] ); + } +} + + +WRITE_LINE_MEMBER(odyssey2_state::irq_callback) +{ + m_maincpu->set_input_line(0, state); +} + + +DRIVER_INIT_MEMBER(odyssey2_state,odyssey2) +{ + UINT8 *gfx = memregion("gfx1")->base(); + + for (int i = 0; i < 256; i++) + { + gfx[i] = i; /* TODO: Why i and not 0? */ + m_ram[i] = 0; + } +} + + +void odyssey2_state::machine_start() +{ + save_pointer(NAME(m_ram),256); + save_item(NAME(m_p1)); + save_item(NAME(m_p2)); + save_item(NAME(m_lum)); +} + + +void odyssey2_state::machine_reset() +{ + m_lum = 0; + + /* jump to "last" bank, will work for all sizes due to being mirrored */ + m_p1 = 0xff; + m_p2 = 0xff; + m_cart->write_bank(m_p1); +} + + +void g7400_state::machine_start() +{ + odyssey2_state::machine_start(); + + save_pointer(NAME(m_ic674_decode),8); + save_pointer(NAME(m_ic678_decode),8); +} + + +void g7400_state::machine_reset() +{ + odyssey2_state::machine_reset(); + + for ( int i = 0; i < 8; i++ ) + { + m_ic674_decode[i] = 0; + m_ic678_decode[i] = 0; + } +} + +/****** External RAM ******************************/ + +READ8_MEMBER(odyssey2_state::io_read) +{ + if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0) + { + return m_i8244->read(space, offset); + } + if (!(m_p1 & P1_EXT_RAM_ENABLE)) + { + return m_ram[offset]; + } + + return 0; +} + + +WRITE8_MEMBER(odyssey2_state::io_write) +{ + if ((m_p1 & (P1_EXT_RAM_ENABLE | P1_VDC_COPY_MODE_ENABLE)) == 0x00) + { + m_ram[offset] = data; + if (offset & 0x80) + { + logerror("voice write %02X, data = %02X (p1 = %02X)\n", offset, data, m_p1); + m_cart->io_write(space, offset, data); + } + } + else if (!(m_p1 & P1_VDC_ENABLE)) + { + m_i8244->write(space, offset, data); + } +} + + +READ8_MEMBER(g7400_state::io_read) +{ + if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0) + { + return m_i8244->read(space, offset); + } + else if (!(m_p1 & P1_EXT_RAM_ENABLE)) + { + return m_ram[offset]; + } + else if (!(m_p1 & P1_VPP_ENABLE)) + { + return m_ef9340_1->ef9341_read( offset & 0x02, offset & 0x01 ); + } + + return 0; +} + + +WRITE8_MEMBER(g7400_state::io_write) +{ + if ((m_p1 & (P1_EXT_RAM_ENABLE | P1_VDC_COPY_MODE_ENABLE)) == 0x00) + { + m_ram[offset] = data; + if (offset & 0x80) + { + logerror("voice write %02X, data = %02X (p1 = %02X)\n", offset, data, m_p1); + m_cart->io_write(space, offset, data); + } + } + else if (!(m_p1 & P1_VDC_ENABLE)) + { + m_i8244->write(space, offset, data); + } + else if (!(m_p1 & P1_VPP_ENABLE)) + { + m_ef9340_1->ef9341_write( offset & 0x02, offset & 0x01, data ); + } +} + + +WRITE16_MEMBER(odyssey2_state::scanline_postprocess) +{ + int vpos = data; + bitmap_ind16 *bitmap = m_i8244->get_bitmap(); + + if ( vpos < i8244_device::START_Y || vpos >= i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) + { + return; + } + + // apply external LUM setting + for ( int x = i8244_device::START_ACTIVE_SCAN; x < i8244_device::END_ACTIVE_SCAN; x++ ) + { + bitmap->pix16( vpos, x ) |= ( m_lum ^ 0x08 ); + } +} + + +WRITE16_MEMBER(g7400_state::scanline_postprocess) +{ + int vpos = data; + int y = vpos - i8244_device::START_Y - 5; + bitmap_ind16 *bitmap = m_i8244->get_bitmap(); + bitmap_ind16 *ef934x_bitmap = m_ef9340_1->get_bitmap(); + + if ( vpos < i8244_device::START_Y || vpos >= i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) + { + return; + } + + // apply external LUM setting + int x_real_start = i8244_device::START_ACTIVE_SCAN + i8244_device::BORDER_SIZE + 5; + int x_real_end = i8244_device::END_ACTIVE_SCAN - i8244_device::BORDER_SIZE + 5; + for ( int x = i8244_device::START_ACTIVE_SCAN; x < i8244_device::END_ACTIVE_SCAN; x++ ) + { + UINT16 d = bitmap->pix16( vpos, x ); + + if ( ( ! m_ic678_decode[ d & 0x07 ] ) && x >= x_real_start && x < x_real_end && y >= 0 && y < 240 ) + { + // Use EF934x input + d = ef934x_bitmap->pix16( y, x - x_real_start ) & 0x07; + + if ( ! m_ic674_decode[ d & 0x07 ] ) + { + d |= 0x08; + } + } + else + { + // Use i8245 input + d |= ( m_lum ^ 0x08 ); + } + bitmap->pix16( vpos, x ) = d; + } +} + + +UINT32 odyssey2_state::screen_update_odyssey2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return m_i8244->screen_update(screen, bitmap, cliprect); +} + + +READ8_MEMBER(odyssey2_state::t1_read) +{ + if ( m_i8244->vblank() || m_i8244->hblank() ) + { + return 1; + } + return 0; +} + + +READ8_MEMBER(odyssey2_state::p1_read) +{ + UINT8 data = m_p1; + + return data; +} + + +WRITE8_MEMBER(odyssey2_state::p1_write) +{ + m_p1 = data; + m_lum = ( data & 0x80 ) >> 4; + m_cart->write_bank(m_p1); +} + + +READ8_MEMBER(odyssey2_state::p2_read) +{ + UINT8 h = 0xFF; + int i, j; + + if (!(m_p1 & P1_KEYBOARD_SCAN_ENABLE)) + { + if ((m_p2 & P2_KEYBOARD_SELECT_MASK) <= 5) /* read keyboard */ + { + h &= m_keyboard[m_p2 & P2_KEYBOARD_SELECT_MASK]->read(); + } + + for (i= 0x80, j = 0; i > 0; i >>= 1, j++) + { + if (!(h & i)) + { + m_p2 &= ~0x10; /* set key was pressed indicator */ + m_p2 = (m_p2 & ~0xE0) | (j << 5); /* column that was pressed */ + + break; + } + } + + if (h == 0xFF) /* active low inputs, so no keypresses */ + { + m_p2 = m_p2 | 0xF0; + } + } + else + { + m_p2 = m_p2 | 0xF0; + } + + return m_p2; +} + + +WRITE8_MEMBER(odyssey2_state::p2_write) +{ + m_p2 = data; +} + + +WRITE8_MEMBER(g7400_state::p2_write) +{ + m_p2 = data; + m_i8243->i8243_p2_w( space, 0, m_p2 & 0x0f ); +} + + +READ8_MEMBER(odyssey2_state::bus_read) +{ + UINT8 data = 0xff; + + if ((m_p2 & P2_KEYBOARD_SELECT_MASK) == 1) + { + data &= m_joysticks[0]->read(); + } + + if ((m_p2 & P2_KEYBOARD_SELECT_MASK) == 0) + { + data &= m_joysticks[1]->read(); + } + + return data; +} + + +WRITE8_MEMBER(odyssey2_state::bus_write) +{ + logerror("%.6f bus written %.2x\n", machine().time().as_double(), data); +} + + +/* + i8243 in the g7400 +*/ + +WRITE8_MEMBER(g7400_state::i8243_port_w) +{ + switch ( offset & 3 ) + { + case 0: // "port 4" +logerror("setting ef-port4 to %02x\n", data); + m_ic674_decode[4] = BIT(data,0); + m_ic674_decode[5] = BIT(data,1); + m_ic674_decode[6] = BIT(data,2); + m_ic674_decode[7] = BIT(data,3); + break; + + case 1: // "port 5" +logerror("setting ef-port5 to %02x\n", data); + m_ic674_decode[0] = BIT(data,0); + m_ic674_decode[1] = BIT(data,1); + m_ic674_decode[2] = BIT(data,2); + m_ic674_decode[3] = BIT(data,3); + break; + + case 2: // "port 6" +logerror("setting vdc-port6 to %02x\n", data); + m_ic678_decode[4] = BIT(data,0); + m_ic678_decode[5] = BIT(data,1); + m_ic678_decode[6] = BIT(data,2); + m_ic678_decode[7] = BIT(data,3); + break; + + case 3: // "port 7" +logerror("setting vdc-port7 to %02x\n", data); + m_ic678_decode[0] = BIT(data,0); + m_ic678_decode[1] = BIT(data,1); + m_ic678_decode[2] = BIT(data,2); + m_ic678_decode[3] = BIT(data,3); + break; + + } +} + + +static const gfx_layout odyssey2_graphicslayout = +{ + 8,1, + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + /* x offsets */ + { + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + }, + /* y offsets */ + { 0 }, + 1*8 +}; + + +static const gfx_layout odyssey2_spritelayout = +{ + 8,1, + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + /* x offsets */ + { + 7,6,5,4,3,2,1,0 + }, + /* y offsets */ + { 0 }, + 1*8 +}; + + +static GFXDECODE_START( odyssey2 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, odyssey2_graphicslayout, 0, 2 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, odyssey2_spritelayout, 0, 2 ) +GFXDECODE_END + + + +static MACHINE_CONFIG_FRAGMENT( odyssey2_cartslot ) + MCFG_O2_CARTRIDGE_ADD("cartslot", o2_cart, NULL) + + MCFG_SOFTWARE_LIST_ADD("cart_list","odyssey2") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( odyssey2, odyssey2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8048, ( ( XTAL_7_15909MHz * 3 ) / 4 ) ) + MCFG_CPU_PROGRAM_MAP(odyssey2_mem) + MCFG_CPU_IO_MAP(odyssey2_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( XTAL_7_15909MHz/2 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8244_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) + MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", odyssey2 ) + MCFG_PALETTE_ADD("palette", 32) + MCFG_PALETTE_INIT_OWNER(odyssey2_state, odyssey2) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_I8244_ADD( "i8244", XTAL_7_15909MHz/2 * 2, "screen", WRITELINE( odyssey2_state, irq_callback ), WRITE16( odyssey2_state, scanline_postprocess ) ) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + + MCFG_FRAGMENT_ADD(odyssey2_cartslot) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( videopac, odyssey2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8048, ( XTAL_17_73447MHz / 3 ) ) + MCFG_CPU_PROGRAM_MAP(odyssey2_mem) + MCFG_CPU_IO_MAP(odyssey2_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( XTAL_17_73447MHz/5 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8245_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) + MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", odyssey2 ) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(odyssey2_state, odyssey2) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_I8245_ADD( "i8244", XTAL_17_73447MHz/5 * 2, "screen", WRITELINE( odyssey2_state, irq_callback ), WRITE16( odyssey2_state, scanline_postprocess ) ) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + + MCFG_FRAGMENT_ADD(odyssey2_cartslot) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( g7400, g7400_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8048, XTAL_5_911MHz ) + MCFG_CPU_PROGRAM_MAP(odyssey2_mem) + MCFG_CPU_IO_MAP(g7400_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( 3540000 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8245_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) + MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", odyssey2 ) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(g7400_state, g7400) + + MCFG_I8243_ADD( "i8243", NOOP, WRITE8(g7400_state,i8243_port_w)) + + MCFG_EF9340_1_ADD( "ef9340_1", 3540000, "screen" ) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_I8245_ADD( "i8244", 3540000 * 2, "screen", WRITELINE( odyssey2_state, irq_callback ), WRITE16( g7400_state, scanline_postprocess ) ) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + + MCFG_FRAGMENT_ADD(odyssey2_cartslot) + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list","g7400") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ody2_list","odyssey2") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( odyssey3, g7400_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8048, XTAL_5_911MHz ) + MCFG_CPU_PROGRAM_MAP(odyssey2_mem) + MCFG_CPU_IO_MAP(g7400_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( 3540000 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8244_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) + MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", odyssey2 ) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(g7400_state, g7400) + + MCFG_I8243_ADD( "i8243", NOOP, WRITE8(g7400_state,i8243_port_w)) + + MCFG_EF9340_1_ADD( "ef9340_1", 3540000, "screen" ) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_I8244_ADD( "i8244", 3540000 * 2, "screen", WRITELINE( odyssey2_state, irq_callback ), WRITE16( g7400_state, scanline_postprocess ) ) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + + MCFG_FRAGMENT_ADD(odyssey2_cartslot) + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list","g7400") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ody2_list","odyssey2") +MACHINE_CONFIG_END + + +ROM_START (odyssey2) + ROM_REGION(0x10000,"maincpu",0) /* safer for the memory handler/bankswitching??? */ + ROM_LOAD ("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) + ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) +ROM_END + + +ROM_START (videopac) + ROM_REGION(0x10000,"maincpu",0) /* safer for the memory handler/bankswitching??? */ + ROM_SYSTEM_BIOS( 0, "g7000", "g7000" ) + ROMX_LOAD ("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "c52", "c52" ) + ROMX_LOAD ("c52.bin", 0x0000, 0x0400, CRC(a318e8d6) SHA1(a6120aed50831c9c0d95dbdf707820f601d9452e), ROM_BIOS(2)) + ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) +ROM_END + + +ROM_START (g7400) + ROM_REGION(0x10000,"maincpu",0) /* safer for the memory handler/bankswitching??? */ + ROM_LOAD ("g7400.bin", 0x0000, 0x0400, CRC(e20a9f41) SHA1(5130243429b40b01a14e1304d0394b8459a6fbae)) + ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) +ROM_END + + +ROM_START (jopac) + ROM_REGION(0x10000,"maincpu",0) /* safer for the memory handler/bankswitching??? */ + ROM_LOAD ("jopac.bin", 0x0000, 0x0400, CRC(11647ca5) SHA1(54b8d2c1317628de51a85fc1c424423a986775e4)) + ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) +ROM_END + + +ROM_START (odyssey3) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD ("odyssey3.bin", 0x0000, 0x0400, CRC(e2b23324) SHA1(0a38c5f2cea929d2fe0a23e5e1a60de9155815dc)) + + ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, odyssey2, 0, 0, odyssey2, odyssey2, odyssey2_state, odyssey2, "Magnavox", "Odyssey 2", 0 ) +COMP( 1979, videopac, odyssey2, 0, videopac, odyssey2, odyssey2_state, odyssey2, "Philips", "Videopac G7000/C52", 0 ) +COMP( 1983, g7400, odyssey2, 0, g7400, odyssey2, odyssey2_state, odyssey2, "Philips", "Videopac Plus G7400", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1983, jopac, odyssey2, 0, g7400, odyssey2, odyssey2_state, odyssey2, "Brandt", "Jopac JO7400", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1983, odyssey3, odyssey2, 0, odyssey3, odyssey2, odyssey2_state, odyssey2, "Magnavox", "Odyssey 3 Command Center (prototype)", MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/okean240.c b/src/mame/drivers/okean240.c new file mode 100644 index 00000000000..8fc87a52848 --- /dev/null +++ b/src/mame/drivers/okean240.c @@ -0,0 +1,538 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Okeah-240 (Ocean-240) + + 28/12/2011 Skeleton driver. + + Info from EMU80: + +intctl : K580wn59 + irq[0]=kbd.irq2 + irq[1]=kbd.irq + irq[4]=tim.out[0] + +ppa40 : K580ww55 + portA=kbd.pressed.mask + portB[2]=cas.playback + portB[5]=kbd.key[58] + portB[6]=kbd.key[59] + portC[0-3]=kbd.pressed.row + portC[4]=kbd.ack + +ppaC0 : K580ww55 + portA=vid.scroll.y + portB[0-3]=mem.frame[0].page + portB[1-3]=mem.frame[1].page + portB[4-5]=mm.page + portC=vid.scroll.x + + +NOTE ABOUT THE TEST ROM (okean240t): +- You need to press a key every so often. + + +ToDo: +- Add devices +- Find out if any unconnected keyboard entries are real keys +- Colours? +- Sound? (perhaps port E4 bit 3) +- Add disks +- Cassette? +- Add memory banking (perhaps port C1) + +Usage of terminal: +- okean240 - the keyboard +- okean240a - not used +- okean240t - the keyboard & screen + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/keyboard.h" +#include "machine/terminal.h" + +#define KEYBOARD_TAG "keyboard" +#define TERMINAL_TAG "terminal" + +class okean240_state : public driver_device +{ +public: + enum + { + TIMER_OKEAN_BOOT + }; + + okean240_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_term_data(0), + m_j(0), + m_scroll(0), + m_p_videoram(*this, "p_videoram"), + m_io_modifiers(*this, "MODIFIERS"), + m_maincpu(*this, "maincpu") + { + } + + DECLARE_READ8_MEMBER(okean240_kbd_status_r); + DECLARE_READ8_MEMBER(okean240a_kbd_status_r); + DECLARE_READ8_MEMBER(term_status_r); + DECLARE_READ8_MEMBER(term_r); + DECLARE_READ8_MEMBER(okean240_keyboard_r); + DECLARE_WRITE8_MEMBER(okean240_keyboard_w); + DECLARE_READ8_MEMBER(okean240a_keyboard_r); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE8_MEMBER(scroll_w); + UINT8 m_term_data; + UINT8 m_j; + UINT8 m_scroll; + required_shared_ptr m_p_videoram; + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_DRIVER_INIT(okean240); + UINT32 screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + optional_ioport m_io_modifiers; + ioport_port *m_io_port[11]; + required_device m_maincpu; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +// okean240 requires bit 4 to change +READ8_MEMBER( okean240_state::okean240_kbd_status_r ) +{ + if (m_term_data) + return (machine().rand() & 0x10) | 2; + else + return machine().rand() & 0x10; +} + +// see if a key is pressed and indicate status +READ8_MEMBER( okean240_state::okean240a_kbd_status_r ) +{ + UINT8 i,j; + + for (i = 0; i < 11; i++) + { + j = m_io_port[i]->read(); + if (j) + return (machine().rand() & 0x10) | 2; + } + m_j = 0; + return machine().rand() & 0x10; +} + +// for test rom +READ8_MEMBER( okean240_state::term_status_r ) +{ + return (m_term_data) ? 3 : 1; +} + +READ8_MEMBER( okean240_state::okean240_keyboard_r ) +{ + if (offset == 0) // port 40 (get ascii key value) + return term_r(space, offset); + else + if (offset == 1) // port 41 bit 1 (test rom status bit) + { + return (machine().rand() & 2); + } + else // port 42 (not used) + return 0; +} + +READ8_MEMBER( okean240_state::okean240a_keyboard_r ) +{ + UINT8 i,j; + + if (offset == 0) // port 40 (get a column) + { + for (i = 0; i < 11; i++) + { + j = m_io_port[i]->read(); + if (j) + { + if (j==m_j) return 0; + m_j=j; + return j; + } + } + m_j=0; + return 0; + } + else + if (offset == 1) // port 41 bits 6&7 (modifier keys), and bit 1 (test rom status bit) + { + return (machine().rand() & 2) | m_io_modifiers->read(); + } + else // port 42 (get a row) + { + for (i = 0; i < 11; i++) + { + if (m_io_port[i]->read() ) + return i; + } + } + return 0; +} + +// This is a keyboard acknowledge pulse, it goes high then +// straightaway low, if reading port 40 indicates a key is pressed. +WRITE8_MEMBER( okean240_state::okean240_keyboard_w ) +{ +// okean240: port 42 bit 7 +// okean240a: port 42 bit 4 +} + +// for test rom +READ8_MEMBER( okean240_state::term_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( okean240_state::scroll_w ) +{ + m_scroll = data; +} + +static ADDRESS_MAP_START(okean240_mem, AS_PROGRAM, 8, okean240_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") + AM_RANGE(0x0800, 0x3fff) AM_RAM + AM_RANGE(0x4000, 0x7fff) AM_RAM AM_SHARE("p_videoram") + AM_RANGE(0x8000, 0xbfff) AM_RAM + AM_RANGE(0xc000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(okean240_io, AS_IO, 8, okean240_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x42) AM_READWRITE(okean240_keyboard_r,okean240_keyboard_w) + AM_RANGE(0x80, 0x80) AM_READ(okean240_kbd_status_r) + AM_RANGE(0xa0, 0xa0) AM_READ(term_r) + AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r) + AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(okean240a_io, AS_IO, 8, okean240_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x42) AM_READWRITE(okean240a_keyboard_r,okean240_keyboard_w) + AM_RANGE(0x80, 0x80) AM_READ(okean240a_kbd_status_r) + AM_RANGE(0xa0, 0xa0) AM_READ(term_r) + AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r) + AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w) + // AM_RANGE(0x00, 0x1f)=ppa00.data + // AM_RANGE(0x20, 0x23)=dsk.data + // AM_RANGE(0x24, 0x24)=dsk.wait + // AM_RANGE(0x25, 0x25)=dskctl.data + // AM_RANGE(0x40, 0x5f)=ppa40.data + // AM_RANGE(0x60, 0x7f)=tim.data + // AM_RANGE(0x80, 0x81)=intctl.data + // AM_RANGE(0xa0, 0xa1)=comport.data + // AM_RANGE(0xc0, 0xdf)=ppaC0.data + // AM_RANGE(0xe0, 0xff)=ppaE0.data +ADDRESS_MAP_END + +static ADDRESS_MAP_START(okean240t_io, AS_IO, 8, okean240_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x42) AM_READWRITE(okean240_keyboard_r,okean240_keyboard_w) + AM_RANGE(0x80, 0x80) AM_READ(okean240_kbd_status_r) + AM_RANGE(0xa0, 0xa0) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0xa0, 0xa0) AM_READ(term_r) + AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r) + AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( okean240 ) +INPUT_PORTS_END + + +static INPUT_PORTS_START( okean240a ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) // comma + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) // minus + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) // null + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) // null + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) // null + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num9") PORT_CODE(KEYCODE_9_PAD) + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) // null + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) // null + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) // null + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("numdel") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("numenter") PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) // null + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num3") PORT_CODE(KEYCODE_3_PAD) + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //9E + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num6") PORT_CODE(KEYCODE_6_PAD) + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //81 + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) // plus + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) //7F + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) //03 + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //86 + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) //99 + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) //8B + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) //84 + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //92 prints # and line feed + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) //98 + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) //85 cr and line feed + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_END) + + PORT_START("X8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //83 cancel input + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + + PORT_START("X9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) //93 + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_START("XA") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("MODIFIERS") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + + +void okean240_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_OKEAN_BOOT: + /* after the first 6 bytes have been read from ROM, switch the ram back in */ + membank("boot")->set_entry(0); + break; + default: + assert_always(FALSE, "Unknown id in okean240_state::device_timer"); + } +} + + +void okean240_state::machine_start() +{ + char kbdrow[6]; + + for (int i = 0; i < 11; i++) + { + sprintf(kbdrow,"X%X",i); + m_io_port[i] = ioport(kbdrow); + } +} + + +void okean240_state::machine_reset() +{ + timer_set(attotime::from_usec(10), TIMER_OKEAN_BOOT); + membank("boot")->set_entry(1); + m_term_data = 0; + m_j = 0; + m_scroll = 0; +} + +WRITE8_MEMBER( okean240_state::kbd_put ) +{ + m_term_data = data; +} + +DRIVER_INIT_MEMBER(okean240_state,okean240) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000); +} + +void okean240_state::video_start() +{ +} + +UINT32 okean240_state::screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 gfx,ma; // ma must be 8bit + UINT16 x,y; + + for (y = 0; y < 256; y++) + { + ma = y + m_scroll; + UINT16 *p = &bitmap.pix16(y); + + for (x = 0; x < 0x4000; x+=0x200) + { + gfx = m_p_videoram[x|ma] | m_p_videoram[x|ma|0x100]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 0); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 7); + } + } + return 0; +} + + +/* F4 Character Displayer */ +static const gfx_layout okean240_charlayout = +{ + 8, 7, /* 8 x 7 characters */ + 160, /* 160 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8 }, + 8*7 /* every char takes 7 bytes */ +}; + +static GFXDECODE_START( okean240 ) + GFXDECODE_ENTRY( "maincpu", 0xec08, okean240_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( okean240a ) + GFXDECODE_ENTRY( "maincpu", 0xef63, okean240_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( okean240t, okean240_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_12MHz / 6) + MCFG_CPU_PROGRAM_MAP(okean240_mem) + MCFG_CPU_IO_MAP(okean240t_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 255) + MCFG_SCREEN_UPDATE_DRIVER(okean240_state, screen_update_okean240) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(okean240_state, kbd_put)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( okean240a, okean240t ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(okean240a_io) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", okean240a) + MCFG_DEVICE_REMOVE(TERMINAL_TAG) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(okean240_state, kbd_put)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( okean240, okean240t ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(okean240_io) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", okean240) + MCFG_DEVICE_REMOVE(TERMINAL_TAG) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(okean240_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( okean240 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "monitor.bin", 0xe000, 0x2000, CRC(587799bc) SHA1(1f677afa96722ca4ed2643eaca243548845fc854) ) + ROM_LOAD( "cpm80.bin", 0xc000, 0x2000, CRC(7378e4f9) SHA1(c3c06c6f2e953546452ca6f82140a79d0e4953b4) ) +ROM_END + +ROM_START( okean240a ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "fddmonitor.bin", 0xe000, 0x2000, CRC(bcac5ca0) SHA1(602ab824704d3d5d07b3787f6227ff903c33c9d5) ) + ROM_LOAD( "fddcpm80.bin", 0xc000, 0x2000, CRC(b89a7e16) SHA1(b8f937c04f430be18e48f296ed3ef37194171204) ) +ROM_END + +ROM_START( okean240t ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "test.bin", 0xe000, 0x0800, CRC(e9e2b7b9) SHA1(e4e0b6984a2514b6ba3e97500d487ea1a68b7577) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, okean240, 0, 0, okean240, okean240, okean240_state, okean240, "", "Okeah-240", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1986, okean240a, okean240,0, okean240a, okean240a, okean240_state, okean240, "", "Ocean-240 with fdd", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1986, okean240t, okean240,0, okean240t, okean240, okean240_state, okean240, "", "Ocean-240 Test Rom", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/ondra.c b/src/mame/drivers/ondra.c new file mode 100644 index 00000000000..7631a89b702 --- /dev/null +++ b/src/mame/drivers/ondra.c @@ -0,0 +1,183 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Ondra driver by Miodrag Milanovic + + 08/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "includes/ondra.h" + +/* Address maps */ +static ADDRESS_MAP_START(ondra_mem, AS_PROGRAM, 8, ondra_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0xdfff) AM_RAMBANK("bank2") + AM_RANGE(0xe000, 0xffff) AM_RAMBANK("bank3") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ondra_io, AS_IO, 8, ondra_state ) + ADDRESS_MAP_GLOBAL_MASK(0x0b) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x03, 0x03) AM_WRITE(ondra_port_03_w) + //AM_RANGE(0x09, 0x09) AM_WRITE(ondra_port_09_w) + //AM_RANGE(0x0a, 0x0a) AM_WRITE(ondra_port_0a_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ondra ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0-9") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CS") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UpCase") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT)PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) + PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("NMI") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_ESC) +INPUT_PORTS_END + +INTERRUPT_GEN_MEMBER(ondra_state::ondra_interrupt) +{ + device.execute().set_input_line(0, HOLD_LINE); +} + +/* Machine driver */ +static MACHINE_CONFIG_START( ondra, ondra_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 2000000) + MCFG_CPU_PROGRAM_MAP(ondra_mem) + MCFG_CPU_IO_MAP(ondra_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", ondra_state, ondra_interrupt) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(320, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(ondra_state, screen_update_ondra) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("ondra_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","ondra") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( ondrat ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "tesla_a.rom", 0x10000, 0x0800, CRC(6d56b815) SHA1(7feb4071d5142e4c2f891747b75fa4d48ccad262) ) + ROM_COPY( "maincpu", 0x10000, 0x10800, 0x0800 ) + ROM_COPY( "maincpu", 0x10000, 0x11000, 0x0800 ) + ROM_COPY( "maincpu", 0x10000, 0x11800, 0x0800 ) + ROM_LOAD( "tesla_b.rom", 0x12000, 0x0800, CRC(5f145eaa) SHA1(c1eac68b13fedc4d0d6f98b15e2a5397f0139dc3) ) + ROM_COPY( "maincpu", 0x10000, 0x12800, 0x0800 ) + ROM_COPY( "maincpu", 0x10000, 0x13000, 0x0800 ) + ROM_COPY( "maincpu", 0x10000, 0x13800, 0x0800 ) +ROM_END + +ROM_START( ondrav ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "vili_a.rom", 0x10000, 0x0800, CRC(76932657) SHA1(1f3700f670f158e4bed256aed751e2c1331a28e8) ) + ROM_COPY( "maincpu", 0x10000, 0x10800, 0x0800 ) + ROM_COPY( "maincpu", 0x10000, 0x11000, 0x0800 ) + ROM_COPY( "maincpu", 0x10000, 0x11800, 0x0800 ) + ROM_LOAD( "vili_b.rom", 0x12000, 0x0800, CRC(03a6073f) SHA1(66f198e63f473e09350bcdbb10fe0cf440111bec) ) + ROM_COPY( "maincpu", 0x10000, 0x12800, 0x0800 ) + ROM_COPY( "maincpu", 0x10000, 0x13000, 0x0800 ) + ROM_COPY( "maincpu", 0x10000, 0x13800, 0x0800 ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, ondrat, 0, 0, ondra, ondra, driver_device, 0, "Tesla", "Ondra", 0) +COMP( 1989, ondrav, ondrat, 0, ondra, ondra, driver_device, 0, "ViLi", "Ondra ViLi", 0) diff --git a/src/mame/drivers/onyx.c b/src/mame/drivers/onyx.c new file mode 100644 index 00000000000..85d02013975 --- /dev/null +++ b/src/mame/drivers/onyx.c @@ -0,0 +1,169 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*********************************************************************************************** + +Onyx C8002 + +2013-08-18 Skeleton Driver + +Copied from p8k.c + +The C8002 is one of the earliest minicomputers to use Unix as an operating system. + +The system consists of a main CPU (Z8002), and a slave CPU for Mass Storage control (Z80) + +The Z80 board contains a 19.6608 and 16 MHz crystals; 2x Z80CTC; 3x Z80SIO/0; Z80DMA; 3x Z80PIO; +2 eproms marked 459-3 and 460-3, plus 2 proms. + +The Z8002 board contains a 16 MHz crystal; 3x Z80CTC; 5x Z80SIO/0; 3x Z80PIO; 2 eproms marked +466-E and 467E, plus the remaining 7 small proms. + +The system can handle 8 RS232 terminals, 7 hard drives, a tape cartridge drive, parallel i/o, +and be connected to a RS422 network. + +*************************************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z8000/z8000.h" +//#include "cpu/z80/z80daisy.h" +//#include "machine/z80ctc.h" +//#include "machine/z80pio.h" +//#include "machine/z80dart.h" +//#include "machine/z80dma.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class onyx_state : public driver_device +{ +public: + onyx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_MACHINE_RESET(c8002); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(portff05_r); + +private: + UINT8 m_term_data; + required_device m_maincpu; + required_device m_terminal; +}; + + +READ8_MEMBER( onyx_state::portff05_r ) +{ + //return m_term_data; + + return 4; +} + +WRITE8_MEMBER( onyx_state::kbd_put ) +{ + m_term_data = data; +} + + +/* Input ports */ +static INPUT_PORTS_START( c8002 ) +INPUT_PORTS_END + + +MACHINE_RESET_MEMBER(onyx_state, c8002) +{ +} + +static ADDRESS_MAP_START(c8002_mem, AS_PROGRAM, 16, onyx_state) + AM_RANGE(0x00000, 0x00fff) AM_ROM AM_SHARE("share0") + AM_RANGE(0x01000, 0x07fff) AM_RAM AM_SHARE("share1") + AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2") +ADDRESS_MAP_END + +//static ADDRESS_MAP_START(c8002_data, AS_DATA, 16, onyx_state) +// AM_RANGE(0x00000, 0x00fff) AM_ROM AM_SHARE("share0") +// AM_RANGE(0x01000, 0x07fff) AM_RAM AM_SHARE("share1") +// AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2") +//ADDRESS_MAP_END + +static ADDRESS_MAP_START(c8002_io, AS_IO, 8, onyx_state) + AM_RANGE(0xff00, 0xff01) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0xff04, 0xff05) AM_READ(portff05_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(submem, AS_PROGRAM, 8, onyx_state) + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(subio, AS_IO, 8, onyx_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + + +/*************************************************************************** + + Machine Drivers + +****************************************************************************/ + +static MACHINE_CONFIG_START( c8002, onyx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z8002, XTAL_4MHz ) + //MCFG_CPU_CONFIG(main_daisy_chain) + MCFG_CPU_PROGRAM_MAP(c8002_mem) + //MCFG_CPU_DATA_MAP(c8002_data) + MCFG_CPU_IO_MAP(c8002_io) + + MCFG_CPU_ADD("subcpu", Z80, XTAL_4MHz ) + //MCFG_CPU_CONFIG(sub_daisy_chain) + MCFG_CPU_PROGRAM_MAP(submem) + MCFG_CPU_IO_MAP(subio) + MCFG_MACHINE_RESET_OVERRIDE(onyx_state, c8002) + + /* peripheral hardware */ + //MCFG_DEVICE_ADD("z80ctc_0", Z80CTC, XTAL_4MHz) + //MCFG_DEVICE_ADD("z80ctc_1", Z80CTC, XTAL_4MHz) + //MCFG_Z80SIO0_ADD("z80sio_0", 9600, 0, 0, 0, 0) + //MCFG_Z80SIO0_ADD("z80sio_1", 9600, 0, 0, 0, 0) + //MCFG_DEVICE_ADD("z80pio_0", Z80CTC, XTAL_4MHz) + //MCFG_DEVICE_ADD("z80pio_1", Z80CTC, XTAL_4MHz) + //MCFG_DEVICE_ADD("z80pio_2", Z80CTC, XTAL_4MHz) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(onyx_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( c8002 ) + ROM_REGION16_BE( 0x100000, "maincpu", 0 ) + ROM_LOAD16_BYTE("466-e", 0x0001, 0x0800, CRC(13534bcb) SHA1(976c76c69af40b0c0a5038e428a10b39a619a036)) + ROM_LOAD16_BYTE("467-e", 0x0000, 0x0800, CRC(0d5b557f) SHA1(0802bc6c2774f4e7de38a9c92e8558d710eed287)) + + ROM_REGION( 0x10000, "subcpu", 0 ) + ROM_LOAD("459-3", 0x0000, 0x0800, CRC(c8906653) SHA1(7dea9fffa974479ef5926df567261f2aaa7a3283)) + ROM_LOAD("460-3", 0x0800, 0x0800, CRC(ce6c0214) SHA1(f69ee4c6c0d1e72574a9cf828dbb3e08f06d029a)) + + ROM_REGION( 0x900, "proms", 0 ) + // for main cpu + ROM_LOAD("468-a", 0x000, 0x100, CRC(89781491) SHA1(f874d0cf42a733eb2b92b15647aeac7178d7b9b1)) + ROM_LOAD("469-a", 0x100, 0x100, CRC(45e439de) SHA1(4f1af44332ae709d92e919c9e48433f29df5e632)) + ROM_LOAD("470a-3", 0x200, 0x100, CRC(c50622a9) SHA1(deda0df93fc4e4b5f4be313e4bfe0c5fc669a024)) + ROM_LOAD("471-a", 0x300, 0x100, CRC(c09ca06b) SHA1(cb99172f5342427c68a109ee108a0c49b44e7010)) + ROM_LOAD("472-a", 0x400, 0x100, CRC(e1316fed) SHA1(41ed2d822c74da4e1ce06eb229629576e7f5035f)) + ROM_LOAD("473-a", 0x500, 0x100, CRC(5e8efd7f) SHA1(647064e0c3b0d795a333febc57228472b1b32345)) + ROM_LOAD("474-a", 0x600, 0x100, CRC(0052edfd) SHA1(b5d18c9a6adce7a6d627ece40a60aab8c55a6597)) + // for sub cpu + ROM_LOAD("453-a", 0x700, 0x100, CRC(7bc3871e) SHA1(6f75eb04911fa1ff66714276b8a88be62438a1b0)) + ROM_LOAD("454-a", 0x800, 0x100, CRC(aa2233cd) SHA1(4ec3a8c06cccda02f080e89831ecd8a9c96d3650)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, c8002, 0, 0, c8002, c8002, driver_device, 0, "Onyx", "C8002", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/orao.c b/src/mame/drivers/orao.c new file mode 100644 index 00000000000..04090619ef8 --- /dev/null +++ b/src/mame/drivers/orao.c @@ -0,0 +1,215 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Orao driver by Miodrag Milanovic + + 01/03/2008 Updated to work with latest SVN code + 23/02/2008 Sound support added. + 22/02/2008 Preliminary driver. + + Driver is based on work of Josip Perusanec + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "includes/orao.h" +#include "imagedev/cassette.h" +#include "formats/orao_cas.h" + +/* Address maps */ +static ADDRESS_MAP_START(orao_mem, AS_PROGRAM, 8, orao_state ) + AM_RANGE( 0x0000, 0x5fff ) AM_RAM AM_SHARE("memory") + AM_RANGE( 0x6000, 0x7fff ) AM_RAM AM_SHARE("video_ram") // video ram + AM_RANGE( 0x8000, 0x9fff ) AM_READWRITE(orao_io_r, orao_io_w ) + AM_RANGE( 0xa000, 0xafff ) AM_RAM // extension + AM_RANGE( 0xb000, 0xbfff ) AM_RAM // DOS + AM_RANGE( 0xc000, 0xdfff ) AM_ROM + AM_RANGE( 0xe000, 0xffff ) AM_ROM +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( orao ) + PORT_START("LINE.0") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("LINE.1") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.2") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("LINE.3") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.4") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + + PORT_START("LINE.5") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.6") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE.7") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.8") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("LINE.9") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.10") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + + PORT_START("LINE.11") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.12") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + + PORT_START("LINE.13") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.14") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + + PORT_START("LINE.15") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.16") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ch") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cj") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Zh") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') + + PORT_START("LINE.17") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('^') PORT_CHAR('@') + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.18") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dj") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sh") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(';') PORT_CHAR('+') + + PORT_START("LINE.19") + PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/* Machine driver */ +static MACHINE_CONFIG_START( orao, orao_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 1000000) + MCFG_CPU_PROGRAM_MAP(orao_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(orao_state, screen_update_orao) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette") + MCFG_CASSETTE_FORMATS(orao_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("orao_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","orao") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( orao ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bas12.rom", 0xc000, 0x2000, CRC(42ae6f69) SHA1(b9d4a544fae13a9c492af027545178addd557111) ) + ROM_LOAD( "crt12.rom", 0xe000, 0x2000, CRC(94ebdc94) SHA1(3959d717f96558823ccc806c842d2fb5ab0c3890) ) +ROM_END + +ROM_START( orao103 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bas13.rom", 0xc000, 0x2000, CRC(35daf5da) SHA1(499c5a4bd930c26ec6226623c2793b4c7f771658) ) + ROM_LOAD( "crt13.rom", 0xe000, 0x2000, CRC(e7076014) SHA1(0e213287b0b520440af6a2a6297788a9356818c2) ) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, orao, 0, 0, orao, orao, orao_state, orao, "PEL Varazdin", "Orao 102", 0) +COMP( 1985, orao103, orao, 0, orao, orao, orao_state, orao103, "PEL Varazdin", "Orao 103", 0) diff --git a/src/mame/drivers/oric.c b/src/mame/drivers/oric.c new file mode 100644 index 00000000000..5748b412c0b --- /dev/null +++ b/src/mame/drivers/oric.c @@ -0,0 +1,951 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/********************************************************************* + + drivers/oric.c + + Systems supported by this driver: + + Oric 1, + Oric Atmos, + Oric Telestrat, + Pravetz 8D + + Pravetz is a Bulgarian copy of the Oric Atmos and uses + Apple 2 disc drives for storage. + + This driver originally by Paul Cook, rewritten by Kevin Thacker, + re-rewritten by Olivier Galibert. + +*********************************************************************/ + +#include "emu.h" +#include "bus/oricext/oricext.h" +#include "cpu/m6502/m6502.h" +#include "sound/ay8910.h" +#include "sound/wave.h" +#include "machine/6522via.h" +#include "machine/mos6551.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/floppy.h" +#include "imagedev/cassette.h" +#include "machine/wd_fdc.h" +#include "formats/oric_dsk.h" +#include "formats/oric_tap.h" + +class oric_state : public driver_device +{ +public: + // Permanent attributes (kept from one line to the other) and line + // attributes (reset at start of line) + enum { + PATTR_50HZ = 0x02, + PATTR_HIRES = 0x04, + LATTR_ALT = 0x01, + LATTR_DSIZE = 0x02, + LATTR_BLINK = 0x04 + }; + + oric_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette"), + m_psg(*this, "ay8912"), + m_centronics(*this, "centronics"), + m_cent_data_out(*this, "cent_data_out"), + m_cassette(*this, "cassette"), + m_via(*this, "via6522"), + m_ram(*this, "ram"), + m_rom(*this, "maincpu"), + m_bank_c000_r(*this, "bank_c000_r"), + m_bank_e000_r(*this, "bank_e000_r"), + m_bank_f800_r(*this, "bank_f800_r"), + m_bank_c000_w(*this, "bank_c000_w"), + m_bank_e000_w(*this, "bank_e000_w"), + m_bank_f800_w(*this, "bank_f800_w"), + m_config(*this, "CONFIG") { } + + DECLARE_INPUT_CHANGED_MEMBER(nmi_pressed); + DECLARE_WRITE8_MEMBER(via_a_w); + DECLARE_WRITE8_MEMBER(via_b_w); + DECLARE_WRITE_LINE_MEMBER(via_ca2_w); + DECLARE_WRITE_LINE_MEMBER(via_cb2_w); + DECLARE_WRITE_LINE_MEMBER(via_irq_w); + DECLARE_WRITE_LINE_MEMBER(ext_irq_w); + DECLARE_WRITE8_MEMBER(psg_a_w); + TIMER_DEVICE_CALLBACK_MEMBER(update_tape); + + virtual void machine_start(); + virtual void video_start(); + UINT32 screen_update_oric(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void vblank_w(screen_device &screen, bool state); + +protected: + required_device m_maincpu; + required_device m_palette; + required_device m_psg; + required_device m_centronics; + required_device m_cent_data_out; + required_device m_cassette; + required_device m_via; + required_shared_ptr m_ram; + optional_memory_region m_rom; + required_memory_bank m_bank_c000_r; + optional_memory_bank m_bank_e000_r; + optional_memory_bank m_bank_f800_r; + required_memory_bank m_bank_c000_w; + optional_memory_bank m_bank_e000_w; + optional_memory_bank m_bank_f800_w; + required_ioport m_config; + ioport_port *m_kbd_row[8]; + + int m_blink_counter; + UINT8 m_pattr; + UINT8 m_via_a, m_via_b, m_psg_a; + bool m_via_ca2, m_via_cb2, m_via_irq; + bool m_ext_irq; + + virtual void update_irq(); + void update_psg(address_space &space); + void update_keyboard(); + void machine_start_common(); +}; + +class telestrat_state : public oric_state +{ +public: + telestrat_state(const machine_config &mconfig, device_type type, const char *tag) : + oric_state(mconfig, type, tag), + m_via2(*this, "via6522_2"), + m_fdc(*this, "fdc"), + m_telmatic(*this, "telmatic"), + m_teleass(*this, "teleass"), + m_hyperbas(*this, "hyperbas"), + m_telmon24(*this, "telmon24"), + m_joy1(*this, "JOY1"), + m_joy2(*this, "JOY2") + { } + + DECLARE_WRITE8_MEMBER(via2_a_w); + DECLARE_WRITE8_MEMBER(via2_b_w); + DECLARE_WRITE_LINE_MEMBER(via2_ca2_w); + DECLARE_WRITE_LINE_MEMBER(via2_cb2_w); + DECLARE_WRITE_LINE_MEMBER(via2_irq_w); + DECLARE_WRITE8_MEMBER(port_314_w); + DECLARE_READ8_MEMBER(port_314_r); + DECLARE_READ8_MEMBER(port_318_r); + + DECLARE_WRITE_LINE_MEMBER(acia_irq_w); + + DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_hld_w); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + virtual void machine_start(); + virtual void machine_reset(); + +protected: + enum { + P_IRQEN = 0x01, + P_DDS = 0x04, + P_DDEN = 0x08, + P_SS = 0x10, + P_DRIVE = 0x60 + }; + + required_device m_via2; + required_device m_fdc; + required_memory_region m_telmatic; + required_memory_region m_teleass; + required_memory_region m_hyperbas; + required_memory_region m_telmon24; + required_ioport m_joy1; + required_ioport m_joy2; + + floppy_image_device *m_floppies[4]; + UINT8 m_port_314; + UINT8 m_via2_a, m_via2_b; + bool m_via2_ca2, m_via2_cb2, m_via2_irq; + bool m_acia_irq; + bool m_fdc_irq, m_fdc_drq, m_fdc_hld; + + UINT8 m_junk_read[0x4000], m_junk_write[0x4000]; + + virtual void update_irq(); + void remap(); +}; + +/* Ram is 64K, with 16K hidden by the rom. The 300-3ff is also hidden by the i/o */ +static ADDRESS_MAP_START(oric_mem, AS_PROGRAM, 8, oric_state ) + AM_RANGE( 0x0300, 0x030f) AM_DEVREADWRITE("via6522", via6522_device, read, write) AM_MIRROR(0xf0) + AM_RANGE( 0xc000, 0xdfff) AM_READ_BANK("bank_c000_r") AM_WRITE_BANK("bank_c000_w") + AM_RANGE( 0xe000, 0xf7ff) AM_READ_BANK("bank_e000_r") AM_WRITE_BANK("bank_e000_w") + AM_RANGE( 0xf800, 0xffff) AM_READ_BANK("bank_f800_r") AM_WRITE_BANK("bank_f800_w") + AM_RANGE( 0x0000, 0xffff) AM_RAM AM_SHARE("ram") +ADDRESS_MAP_END + +/* +The telestrat has the memory regions split into 16k blocks. +Memory region &c000-&ffff can be ram or rom. */ +static ADDRESS_MAP_START(telestrat_mem, AS_PROGRAM, 8, telestrat_state ) + AM_RANGE( 0x0300, 0x030f) AM_DEVREADWRITE("via6522", via6522_device, read, write) + AM_RANGE( 0x0310, 0x0313) AM_DEVREADWRITE("fdc", fd1793_t, read, write) + AM_RANGE( 0x0314, 0x0314) AM_READWRITE(port_314_r, port_314_w) + AM_RANGE( 0x0318, 0x0318) AM_READ(port_318_r) + AM_RANGE( 0x031c, 0x031f) AM_DEVREADWRITE("acia", mos6551_device, read, write) + AM_RANGE( 0x0320, 0x032f) AM_DEVREADWRITE("via6522_2", via6522_device, read, write) + AM_RANGE( 0xc000, 0xffff) AM_READ_BANK("bank_c000_r") AM_WRITE_BANK("bank_c000_w") + AM_RANGE( 0x0000, 0xffff) AM_RAM AM_SHARE("ram") +ADDRESS_MAP_END + +UINT32 oric_state::screen_update_oric(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bool blink_state = m_blink_counter & 0x20; + m_blink_counter = (m_blink_counter + 1) & 0x3f; + + UINT8 pattr = m_pattr; + + for(int y=0; y<224; y++) { + // Line attributes and current colors + UINT8 lattr = 0; + UINT32 fgcol = m_palette->pen_color(7); + UINT32 bgcol = m_palette->pen_color(0); + + UINT32 *p = &bitmap.pix32(y); + + for(int x=0; x<40; x++) { + // Lookup the byte and, if needed, the pattern data + UINT8 ch, pat; + if((pattr & PATTR_HIRES) && y < 200) + ch = pat = m_ram[0xa000 + y*40 + x]; + + else { + ch = m_ram[0xbb80 + (y>>3)*40 + x]; + int off = (lattr & LATTR_DSIZE ? y >> 1 : y ) & 7; + const UINT8 *base; + if(pattr & PATTR_HIRES) + if(lattr & LATTR_ALT) + base = m_ram + 0x9c00; + else + base = m_ram + 0x9800; + else + if(lattr & LATTR_ALT) + base = m_ram + 0xb800; + else + base = m_ram + 0xb400; + pat = base[((ch & 0x7f) << 3) | off]; + } + + // Handle state-chaging attributes + if(!(ch & 0x60)) { + pat = 0x00; + switch(ch & 0x18) { + case 0x00: fgcol = m_palette->pen_color(ch & 7); break; + case 0x08: lattr = ch & 7; break; + case 0x10: bgcol = m_palette->pen_color(ch & 7); break; + case 0x18: pattr = ch & 7; break; + } + } + + // Pick up the colors for the pattern + UINT32 c_fgcol = fgcol; + UINT32 c_bgcol = bgcol; + + // inverse video + if(ch & 0x80) { + c_bgcol = c_bgcol ^ 0xffffff; + c_fgcol = c_fgcol ^ 0xffffff; + } + // blink + if((lattr & LATTR_BLINK) && blink_state) + c_fgcol = c_bgcol; + + // Draw the pattern + *p++ = pat & 0x20 ? c_fgcol : c_bgcol; + *p++ = pat & 0x10 ? c_fgcol : c_bgcol; + *p++ = pat & 0x08 ? c_fgcol : c_bgcol; + *p++ = pat & 0x04 ? c_fgcol : c_bgcol; + *p++ = pat & 0x02 ? c_fgcol : c_bgcol; + *p++ = pat & 0x01 ? c_fgcol : c_bgcol; + } + } + + m_pattr = pattr; + + return 0; +} + +void oric_state::update_keyboard() +{ + m_via->write_pb3((m_kbd_row[m_via_b & 7]->read() | m_psg_a) != 0xff); +} + +void oric_state::update_psg(address_space &space) +{ + if(m_via_ca2) + if(m_via_cb2) + m_psg->address_w(space, 0, m_via_a); + else + m_via->write_pa(space, 0, m_psg->data_r(space, 0)); + else if(m_via_cb2) + m_psg->data_w(space, 0, m_via_a); +} + +void oric_state::update_irq() +{ + m_maincpu->set_input_line(m6502_device::IRQ_LINE, m_via_irq || m_ext_irq ? ASSERT_LINE : CLEAR_LINE); +} + +INPUT_CHANGED_MEMBER(oric_state::nmi_pressed) +{ + m_maincpu->set_input_line(m6502_device::NMI_LINE, newval ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE8_MEMBER(oric_state::via_a_w) +{ + m_via_a = data; + m_cent_data_out->write(space, 0, m_via_a); + update_psg(space); +} + +WRITE8_MEMBER(oric_state::via_b_w) +{ + m_via_b = data; + update_keyboard(); + m_centronics->write_strobe(data & 0x10 ? 1 : 0); + m_cassette->change_state(data & 0x40 ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, + CASSETTE_MOTOR_DISABLED); + m_cassette->output(data & 0x80 ? -1.0 : +1.0); +} + +WRITE_LINE_MEMBER(oric_state::via_ca2_w) +{ + m_via_ca2 = state; + update_psg(m_maincpu->space(AS_PROGRAM)); +} + +WRITE_LINE_MEMBER(oric_state::via_cb2_w) +{ + m_via_cb2 = state; + update_psg(m_maincpu->space(AS_PROGRAM)); +} + +WRITE_LINE_MEMBER(oric_state::via_irq_w) +{ + m_via_irq = state; + update_irq(); +} + +WRITE_LINE_MEMBER(oric_state::ext_irq_w) +{ + m_ext_irq = state; + update_irq(); +} + +WRITE8_MEMBER(oric_state::psg_a_w) +{ + m_psg_a = data; + update_keyboard(); +} + +TIMER_DEVICE_CALLBACK_MEMBER(oric_state::update_tape) +{ + if(!m_config->read()) + m_via->write_cb1(m_cassette->input() > 0.0038); +} + +void oric_state::vblank_w(screen_device &screen, bool state) +{ + if(m_config->read()) + m_via->write_cb1(state); +} + +void oric_state::video_start() +{ + m_blink_counter = 0; + m_pattr = 0; +} + +void oric_state::machine_start_common() +{ + m_via_a = 0xff; + m_via_b = 0xff; + m_psg_a = 0x00; + m_via_ca2 = false; + m_via_cb2 = false; + m_via_irq = false; + m_ext_irq = false; + + for(int i=0; i<8; i++) { + char name[10]; + sprintf(name, "ROW%d", i); + m_kbd_row[i] = machine().root_device().ioport(name); + } +} + +void oric_state::machine_start() +{ + machine_start_common(); + m_bank_c000_r->set_base(m_rom->base()); + m_bank_e000_r->set_base(m_rom->base() + 0x2000); + m_bank_f800_r->set_base(m_rom->base() + 0x3800); +} + + +void telestrat_state::machine_start() +{ + machine_start_common(); + for(int i=0; i<4; i++) { + char name[32]; + sprintf(name, "fdc:%d", i); + m_floppies[i] = subdevice(name)->get_device(); + } + m_fdc_irq = m_fdc_drq = m_fdc_hld = false; + m_acia_irq = false; + + memset(m_junk_read, 0x00, sizeof(m_junk_read)); + memset(m_junk_write, 0x00, sizeof(m_junk_write)); +} + +void telestrat_state::machine_reset() +{ + m_port_314 = 0x00; + m_via2_a = 0xff; + remap(); +} + +void telestrat_state::update_irq() +{ + m_maincpu->set_input_line(m6502_device::IRQ_LINE, + m_via_irq || + m_ext_irq || + (m_fdc_irq && (m_port_314 & P_IRQEN)) || + m_via2_irq || + m_acia_irq ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE8_MEMBER(telestrat_state::via2_a_w) +{ + m_via2_a = data; + remap(); +} + +WRITE8_MEMBER(telestrat_state::via2_b_w) +{ + m_via2_b = data; + UINT8 port = 0xff; + if(!(m_via2_b & 0x40)) + port &= m_joy1->read(); + if(!(m_via2_b & 0x80)) + port &= m_joy2->read(); + + m_via2->write_pb(space, 0, port); +} + +WRITE_LINE_MEMBER(telestrat_state::via2_ca2_w) +{ + m_via2_ca2 = state; +} + +WRITE_LINE_MEMBER(telestrat_state::via2_cb2_w) +{ + m_via2_cb2 = state; +} + +WRITE_LINE_MEMBER(telestrat_state::via2_irq_w) +{ + m_via2_irq = state; + update_irq(); +} + +WRITE8_MEMBER(telestrat_state::port_314_w) +{ + m_port_314 = data; + floppy_image_device *floppy = m_floppies[(m_port_314 >> 5) & 3]; + m_fdc->set_floppy(floppy); + m_fdc->dden_w(m_port_314 & P_DDEN); + if(floppy) { + floppy->ss_w(m_port_314 & P_SS ? 1 : 0); + floppy->mon_w(0); + } + update_irq(); +} + +READ8_MEMBER(telestrat_state::port_314_r) +{ + return (m_fdc_irq && (m_port_314 & P_IRQEN)) ? 0x7f : 0xff; +} + +READ8_MEMBER(telestrat_state::port_318_r) +{ + return m_fdc_drq ? 0x7f : 0xff; +} + + +WRITE_LINE_MEMBER(telestrat_state::acia_irq_w) +{ + m_acia_irq = state; + update_irq(); +} + +WRITE_LINE_MEMBER(telestrat_state::fdc_irq_w) +{ + m_fdc_irq = state; + update_irq(); +} + +WRITE_LINE_MEMBER(telestrat_state::fdc_drq_w) +{ + m_fdc_drq = state; +} + +WRITE_LINE_MEMBER(telestrat_state::fdc_hld_w) +{ + m_fdc_hld = state; +} + +void telestrat_state::remap() +{ + // Theorically, these are cartridges. There's no real point to + // making them configurable, when only 4 existed and there are 7 + // slots. + + switch(m_via2_a & 7) { + case 0: + m_bank_c000_r->set_base(m_ram+0xc000); + m_bank_c000_w->set_base(m_ram+0xc000); + break; + case 1: + case 2: + case 3: + m_bank_c000_r->set_base(m_junk_read); + m_bank_c000_w->set_base(m_junk_write); + break; + case 4: + m_bank_c000_r->set_base(m_telmatic->base()); + m_bank_c000_w->set_base(m_junk_write); + break; + case 5: + m_bank_c000_r->set_base(m_teleass->base()); + m_bank_c000_w->set_base(m_junk_write); + break; + case 6: + m_bank_c000_r->set_base(m_hyperbas->base()); + m_bank_c000_w->set_base(m_junk_write); + break; + case 7: + m_bank_c000_r->set_base(m_telmon24->base()); + m_bank_c000_w->set_base(m_junk_write); + break; + } +} + + + +static INPUT_PORTS_START(oric) + PORT_START("ROW0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_START("ROW1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START("ROW2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("ROW3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('\xA3') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("ROW4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("ROW5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + + PORT_START("ROW6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + + PORT_START("ROW7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + + PORT_START("NMI") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NMI") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHANGED_MEMBER(DEVICE_SELF, oric_state, nmi_pressed, 0) + + /* vsync cable hardware. This is a simple cable connected to the video output + to the monitor/television. The sync signal is connected to the cassette input + allowing interrupts to be generated from the vsync signal. */ + PORT_START("CONFIG") + PORT_CONFNAME(0x01, 0x00, "Tape input") + PORT_CONFSETTING( 0x00, "Tape") + PORT_CONFSETTING( 0x01, "VSync cable") +INPUT_PORTS_END + +static INPUT_PORTS_START(orica) + PORT_INCLUDE( oric ) + + PORT_MODIFY("ROW5") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Funct") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) +INPUT_PORTS_END + +static INPUT_PORTS_START(prav8d) + PORT_START("ROW0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X \xd0\xac") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V \xd0\x96") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N \xd0\x9d") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("ROW1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D \xd0\x94") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q \xd0\xaf") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F \xd0\xa4") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R \xd0\xa0") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T \xd0\xa2") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J \xd0\x99") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + + PORT_START("ROW2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C \xd0\xa6") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z \xd0\x97") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MK") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B \xd0\x91") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M \xd0\x9c") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + + PORT_START("ROW3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] \xd0\xa9") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C/L") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // this one is 5th line, 1st key from right + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ \xd0\xa8") PORT_CODE(KEYCODE_COLON) PORT_CHAR('[') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K \xd0\x9a") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + + PORT_START("ROW4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("ROW5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xd0\xae") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ \xd0\xad") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // this one is 5th line, 1st key from left + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P \xd0\x9f") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O \xd0\x9e") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I \xd0\x98") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U \xd0\xa3") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + + PORT_START("ROW6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W \xd0\x92") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S \xd0\xa1") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A \xd0\x90") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E \xd0\x95") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G \xd0\x93") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H \xd0\xa5") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y \xd0\xaa") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + + PORT_START("ROW7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ \xd0\xa7") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('^') // this one would be on 2nd line, 3rd key from 'P' + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L \xd0\x9b") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("NMI") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NMI") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHANGED_MEMBER(DEVICE_SELF, oric_state, nmi_pressed, 0) + + /* vsync cable hardware. This is a simple cable connected to the video output + to the monitor/television. The sync signal is connected to the cassette input + allowing interrupts to be generated from the vsync signal. */ + PORT_START("CONFIG") + PORT_CONFNAME(0x01, 0x00, "Tape input") + PORT_CONFSETTING( 0x00, "Tape") + PORT_CONFSETTING( 0x01, "VSync cable") +INPUT_PORTS_END + +static INPUT_PORTS_START(telstrat) + PORT_INCLUDE( orica ) + +// The telestrat does not have the NMI button + PORT_MODIFY("NMI") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("JOY1") /* left joystick port */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(1) + + PORT_START("JOY2") /* right joystick port */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(2) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( oric, oric_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, XTAL_12MHz/12) + MCFG_CPU_PROGRAM_MAP(oric_mem) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(40*6, 28*8) + MCFG_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 28*8-1) + MCFG_SCREEN_UPDATE_DRIVER(oric_state, screen_update_oric) + MCFG_SCREEN_VBLANK_DRIVER(oric_state, vblank_w) + + MCFG_PALETTE_ADD_3BIT_RGB("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8912", AY8912, XTAL_12MHz/12) + MCFG_AY8910_OUTPUT_TYPE(AY8910_DISCRETE_OUTPUT) + MCFG_AY8910_RES_LOADS(4700, 4700, 4700) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(oric_state, psg_a_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522", via6522_device, write_ca1)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(oric_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("tape_timer", oric_state, update_tape, attotime::from_hz(4800)) + + /* via */ + MCFG_DEVICE_ADD( "via6522", VIA6522, XTAL_12MHz/12 ) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(oric_state, via_a_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(oric_state, via_b_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(oric_state, via_ca2_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(oric_state, via_cb2_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(oric_state, via_irq_w)) + + /* extension port */ + MCFG_ORICEXT_ADD( "ext", oricext_intf, NULL, "maincpu", WRITELINE(oric_state, ext_irq_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( prav8d, oric ) +MACHINE_CONFIG_END + +FLOPPY_FORMATS_MEMBER( telestrat_state::floppy_formats ) + FLOPPY_ORIC_DSK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( telestrat_floppies ) + SLOT_INTERFACE( "3dsdd", FLOPPY_3_DSDD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_DERIVED_CLASS( telstrat, oric, telestrat_state ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(telestrat_mem) + + /* acia */ + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_IRQ_HANDLER(WRITELINE(telestrat_state, acia_irq_w)) + + /* via */ + MCFG_DEVICE_ADD( "via6522_2", VIA6522, XTAL_12MHz/12 ) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(telestrat_state, via2_a_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(telestrat_state, via2_b_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(telestrat_state, via2_ca2_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(telestrat_state, via2_cb2_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(telestrat_state, via2_irq_w)) + + /* microdisc */ + MCFG_FD1793_ADD("fdc", XTAL_8MHz/8) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(telestrat_state, fdc_irq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(telestrat_state, fdc_drq_w)) + MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(telestrat_state, fdc_hld_w)) + MCFG_WD_FDC_FORCE_READY + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", telestrat_floppies, "3dsdd", telestrat_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", telestrat_floppies, NULL, telestrat_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", telestrat_floppies, NULL, telestrat_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", telestrat_floppies, NULL, telestrat_state::floppy_formats) +MACHINE_CONFIG_END + + +ROM_START(oric1) + ROM_REGION(0x4000, "maincpu", 0) + ROM_LOAD ("basic10.rom", 0, 0x04000, CRC(f18710b4) SHA1(333116e6884d85aaa4dfc7578a91cceeea66d016)) +ROM_END + +ROM_START(orica) + ROM_REGION(0x4000, "maincpu", 0) + ROM_SYSTEM_BIOS( 0, "ver11", "Basic 1.1") + ROMX_LOAD ("basic11b.rom", 0, 0x04000, CRC(c3a92bef) SHA1(9451a1a09d8f75944dbd6f91193fc360f1de80ac), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "ver12", "Basic 1.2 (Pascal Leclerc)") // 1987/1999 - various enhancements and bugfixes + ROMX_LOAD ("basic12.rom", 0, 0x04000, CRC(dc4f22dc) SHA1(845e1a893de3dc0f856fdf2f69c3b73770b4094f), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "ver121", "Basic 1.21 (Pascal Leclerc)") // 07.1999 - DRAW enhancement + ROMX_LOAD ("basic121.rom", 0, 0x04000, CRC(0a2860b1) SHA1(b727d5c3bbc8cb1d510f224eb1e0d90d609e8506), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "ver122", "Basic 1.22 (Pascal Leclerc)") // 08.2001 - added EUR symbol + ROMX_LOAD ("basic122.rom", 0, 0x04000, CRC(5ef2a861) SHA1(9ab6dc47b6e9dc65a4137ce0f0f12fc2b6ca8442), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "ver11de", "Basic 1.1 DE") + ROMX_LOAD( "bas11_de.rom", 0, 0x04000, CRC(65233b2d) SHA1(b01cabb1a21980a6785a2fe37a8f8572c892123f), ROM_BIOS(5)) + ROM_SYSTEM_BIOS( 5, "ver11es", "Basic 1.1 ES") + ROMX_LOAD( "bas11_es.rom", 0, 0x04000, CRC(47bf26c7) SHA1(4fdbadd68db9ab8ad1cd56b4e5cbe51a9c3f11ae), ROM_BIOS(6)) + ROM_SYSTEM_BIOS( 6, "ver11fr", "Basic 1.1 FR") + ROMX_LOAD( "bas11_fr.rom", 0, 0x04000, CRC(603b1fbf) SHA1(2a4583df3b59ca454d67d5631f242c96ec4cf99a), ROM_BIOS(7)) + ROM_SYSTEM_BIOS( 7, "ver11se", "Basic 1.1 SE") + ROMX_LOAD( "bas11_se.rom", 0, 0x04000, CRC(a71523ac) SHA1(ce53acf84baec6ab5cbac9f9cefa71b3efeb2ead), ROM_BIOS(8)) + ROM_SYSTEM_BIOS( 8, "ver11uk", "Basic 1.1 UK") + ROMX_LOAD( "bas11_uk.rom", 0, 0x04000, CRC(303370d1) SHA1(589ff66fac8e06d65af3369491faa67a71f1322a), ROM_BIOS(9)) + ROM_SYSTEM_BIOS( 9, "ver12es", "Basic 1.2 ES") + ROMX_LOAD( "bas12es_le.rom", 0, 0x04000, CRC(70de4aeb) SHA1(b327418aa7d8a5a03c135e3d8acdd511df625893), ROM_BIOS(10)) + ROM_SYSTEM_BIOS( 10, "ver12fr", "Basic 1.2 FR") + ROMX_LOAD( "bas12fr_le.rom", 0, 0x04000, CRC(47a437fc) SHA1(70271bc3ed5c3bf4d339d6f5de3de8c3c50ff573), ROM_BIOS(11)) + ROM_SYSTEM_BIOS( 11, "ver12ge", "Basic 1.2 GE") + ROMX_LOAD( "bas12ge_le.rom", 0, 0x04000, CRC(f5f0dd52) SHA1(75359302452ee7b19537698f124aaefd333688d0), ROM_BIOS(12)) + ROM_SYSTEM_BIOS( 12, "ver12sw", "Basic 1.2 SW") + ROMX_LOAD( "bas12sw_le.rom", 0, 0x04000, CRC(100abe68) SHA1(6211d5969c4d7a6acb86ed19c5e51a33a3bef431), ROM_BIOS(13)) + ROM_SYSTEM_BIOS( 13, "ver12uk", "Basic 1.2 UK") + ROMX_LOAD( "bas12uk_le.rom", 0, 0x04000, CRC(00fce8a6) SHA1(d40558bdf61b8aba6260293c9424fd463be7fad8), ROM_BIOS(14)) + ROM_SYSTEM_BIOS( 14, "ver121es", "Basic 1.211 ES") + ROMX_LOAD( "bas121es_le.rom", 0, 0x04000, CRC(87ec679b) SHA1(5de6a5f5121f69069c9b93d678046e814b5b64e9), ROM_BIOS(15)) + ROM_SYSTEM_BIOS( 15, "ver121fr", "Basic 1.211 FR") + ROMX_LOAD( "bas121fr_le.rom", 0, 0x04000, CRC(e683dec2) SHA1(20df7ebc0f13aa835f286d50137f1a7ff7430c29), ROM_BIOS(16)) + ROM_SYSTEM_BIOS( 16, "ver121ge", "Basic 1.211 GE") + ROMX_LOAD( "bas121ge_le.rom", 0, 0x04000, CRC(94fe32bf) SHA1(1024776d20030d602e432e50014502524658643a), ROM_BIOS(17)) + ROM_SYSTEM_BIOS( 17, "ver121sw", "Basic 1.211 SW") + ROMX_LOAD( "bas121sw_le.rom", 0, 0x04000, CRC(e6ad11c7) SHA1(309c94a9861fcb770636dcde1801a5c68ca819b4), ROM_BIOS(18)) + ROM_SYSTEM_BIOS( 18, "ver121uk", "Basic 1.211 UK") + ROMX_LOAD( "bas121uk_le.rom", 0, 0x04000, CRC(75aa1aa9) SHA1(ca99e244d9cbef625344c2054023504a4f9dcfe4), ROM_BIOS(19)) + ROM_SYSTEM_BIOS( 19, "ver122es", "Basic 1.22 ES") + ROMX_LOAD( "bas122es_le.rom", 0, 0x04000, CRC(9144f9e0) SHA1(acf2094078af057e74a31d90d7010be51b9033fa), ROM_BIOS(20)) + ROM_SYSTEM_BIOS( 20, "ver122fr", "Basic 1.22 FR") + ROMX_LOAD( "bas122fr_le.rom", 0, 0x04000, CRC(370cfda4) SHA1(fad9a0661256e59bcc2915578647573e4128e1bb), ROM_BIOS(21)) + ROM_SYSTEM_BIOS( 21, "ver122ge", "Basic 1.22 GE") + ROMX_LOAD( "bas122ge_le.rom", 0, 0x04000, CRC(9a42bd62) SHA1(8a9c80f314daf4e5e64fa202e583b8a65796db8b), ROM_BIOS(22)) + ROM_SYSTEM_BIOS( 22, "ver122sw", "Basic 1.22 SW") + ROMX_LOAD( "bas122sw_le.rom", 0, 0x04000, CRC(e7fd57a4) SHA1(c75cbf7cfafaa02712dc7ca2f972220aef86fb8d), ROM_BIOS(23)) + ROM_SYSTEM_BIOS( 23, "ver122uk", "Basic 1.22 UK") + ROMX_LOAD( "bas122uk_le.rom", 0, 0x04000, CRC(9865bcd7) SHA1(2a92e2d119463e682bf10647e3880e26656d65b5), ROM_BIOS(24)) +ROM_END + +ROM_START(telstrat) + ROM_REGION(0x4000, "telmatic", 0) + ROM_LOAD ("telmatic.rom", 0, 0x2000, CRC(94358dc6) SHA1(35f92a0477a88f5cf564971125047ffcfa02ec10) ) + ROM_RELOAD (0x2000, 0x2000) + + ROM_REGION(0x4000, "teleass", 0) + ROM_LOAD ("teleass.rom", 0, 0x4000, CRC(68b0fde6) SHA1(9e9af51dae3199cccf49ab3f0d47e2b9be4ba97d) ) + + ROM_REGION(0x4000, "hyperbas", 0) + ROM_LOAD ("hyperbas.rom", 0, 0x4000, CRC(1d96ab50) SHA1(f5f70a0eb59f8cd6c261e179ae78ef906f68ed63) ) + + ROM_REGION(0x4000, "telmon24", 0) + ROM_LOAD ("telmon24.rom", 0, 0x4000, CRC(aa727c5d) SHA1(86fc8dc0932f983efa199e31ae05a4424772f959) ) +ROM_END + +ROM_START(prav8d) + ROM_REGION(0x4000, "maincpu", 0) /* 0x10000 + 0x04000 + 0x00100 + 0x00200 */ + ROM_LOAD( "pravetzt.rom", 0, 0x4000, CRC(58079502) SHA1(7afc276cb118adff72e4f16698f94bf3b2c64146) ) +// ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) ) +// ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) ) +ROM_END + +ROM_START(prav8dd) + ROM_REGION(0x4000, "maincpu", 0) /* 0x10000 + 0x04000 + 0x00100 + 0x00200 */ + ROM_SYSTEM_BIOS( 0, "default", "Disk ROM, 1989") + ROMX_LOAD( "8d.rom", 0, 0x4000, CRC(b48973ef) SHA1(fd47c977fc215a3b577596a7483df53e8a1e9c83), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "radosoft", "RadoSoft Disk ROM, 1992") + ROMX_LOAD( "pravetzd.rom", 0, 0x4000, CRC(f8d23821) SHA1(f87ad3c5832773b6e0614905552a80c98dc8e2a5), ROM_BIOS(2) ) +// ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) ) +// ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1983, oric1, 0, 0, oric, oric, driver_device, 0, "Tangerine", "Oric 1" , 0) +COMP( 1984, orica, oric1, 0, oric, orica, driver_device, 0, "Tangerine", "Oric Atmos" , 0) +COMP( 1985, prav8d, oric1, 0, prav8d, prav8d, driver_device, 0, "Pravetz", "Pravetz 8D", 0) +COMP( 1989, prav8dd, oric1, 0, prav8d, prav8d, driver_device, 0, "Pravetz", "Pravetz 8D (Disk ROM)", MACHINE_UNOFFICIAL) +COMP( 1986, telstrat, oric1, 0, telstrat, telstrat, driver_device, 0, "Tangerine", "Oric Telestrat", 0 ) diff --git a/src/mame/drivers/orion.c b/src/mame/drivers/orion.c new file mode 100644 index 00000000000..ac3d9ab8430 --- /dev/null +++ b/src/mame/drivers/orion.c @@ -0,0 +1,372 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Orion driver by Miodrag Milanovic + + 22/04/2008 Orion Pro added + 02/04/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/orion.h" +#include "imagedev/cassette.h" +#include "formats/smx_dsk.h" +#include "formats/rk_cas.h" + +/* Address maps */ + +/* Orion 128 */ +static ADDRESS_MAP_START(orion128_mem, AS_PROGRAM, 8, orion_state ) + AM_RANGE( 0x0000, 0xefff ) AM_RAMBANK("bank1") + AM_RANGE( 0xf000, 0xf3ff ) AM_RAMBANK("bank2") + AM_RANGE( 0xf400, 0xf4ff ) AM_READWRITE(orion128_system_r,orion128_system_w) // Keyboard and cassette + AM_RANGE( 0xf500, 0xf5ff ) AM_READWRITE(orion128_romdisk_r,orion128_romdisk_w) + AM_RANGE( 0xf700, 0xf7ff ) AM_READWRITE(orion128_floppy_r,orion128_floppy_w) + AM_RANGE( 0xf800, 0xffff ) AM_ROM + AM_RANGE( 0xf800, 0xf8ff ) AM_WRITE(orion128_video_mode_w) + AM_RANGE( 0xf900, 0xf9ff ) AM_WRITE(orion128_memory_page_w) + AM_RANGE( 0xfa00, 0xfaff ) AM_WRITE(orion128_video_page_w) +ADDRESS_MAP_END + +/* Orion Z80 Card II */ +static ADDRESS_MAP_START( orion128_io , AS_IO, 8, orion_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0xf8, 0xf8) AM_WRITE(orion128_video_mode_w ) + AM_RANGE( 0xf9, 0xf9) AM_WRITE(orion128_memory_page_w ) + AM_RANGE( 0xfa, 0xfa) AM_WRITE(orion128_video_page_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(orionz80_mem, AS_PROGRAM, 8, orion_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x4000, 0xefff ) AM_RAMBANK("bank2") + AM_RANGE( 0xf000, 0xf3ff ) AM_RAMBANK("bank3") + AM_RANGE( 0xf400, 0xf7ff ) AM_RAMBANK("bank4") + AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank5") +ADDRESS_MAP_END + +/* Orion Pro */ +static ADDRESS_MAP_START( orionz80_io , AS_IO, 8, orion_state ) + AM_RANGE( 0x0000, 0xffff) AM_READWRITE(orionz80_io_r, orionz80_io_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(orionpro_mem, AS_PROGRAM, 8, orion_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x1fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x2000, 0x3fff ) AM_RAMBANK("bank2") + AM_RANGE( 0x4000, 0x7fff ) AM_RAMBANK("bank3") + AM_RANGE( 0x8000, 0xbfff ) AM_RAMBANK("bank4") + AM_RANGE( 0xc000, 0xefff ) AM_RAMBANK("bank5") + AM_RANGE( 0xf000, 0xf3ff ) AM_RAMBANK("bank6") + AM_RANGE( 0xf400, 0xf7ff ) AM_RAMBANK("bank7") + AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank8") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( orionpro_io , AS_IO, 8, orion_state ) + AM_RANGE( 0x0000, 0xffff) AM_READWRITE(orionpro_io_r, orionpro_io_w ) +ADDRESS_MAP_END + +FLOPPY_FORMATS_MEMBER( orion_state::orion_floppy_formats ) + FLOPPY_SMX_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( orion_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +/* Machine driver */ +static MACHINE_CONFIG_START( orion128, orion_state ) + MCFG_CPU_ADD("maincpu", I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(orion128_mem) + MCFG_CPU_IO_MAP(orion128_io) + + MCFG_MACHINE_START_OVERRIDE(orion_state, orion128 ) + MCFG_MACHINE_RESET_OVERRIDE(orion_state, orion128 ) + + MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(orion_state, orion_romdisk_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(orion_state, orion_romdisk_portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(orion_state, orion_romdisk_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(384, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(orion_state, screen_update_orion128) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 18) + MCFG_PALETTE_INIT_OWNER(orion_state, orion128 ) + + MCFG_VIDEO_START_OVERRIDE(orion_state,orion128) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rko_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("orion_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") + + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) + + MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd2", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd3", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","orion_flop") + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "orion_cart") + + MCFG_SOFTWARE_LIST_ADD("cart_list", "orion_cart") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( orion128ms, orion128 ) + MCFG_DEVICE_REMOVE("ppi8255_2") + MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, rk7007_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( orionz80, orion_state ) + MCFG_CPU_ADD("maincpu", Z80, 2500000) + MCFG_CPU_PROGRAM_MAP(orionz80_mem) + MCFG_CPU_IO_MAP(orionz80_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", orion_state, orionz80_interrupt) + + MCFG_MACHINE_START_OVERRIDE(orion_state, orionz80 ) + MCFG_MACHINE_RESET_OVERRIDE(orion_state, orionz80 ) + + MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(orion_state, orion_romdisk_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(orion_state, orion_romdisk_portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(orion_state, orion_romdisk_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(384, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(orion_state, screen_update_orion128) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 18) + MCFG_PALETTE_INIT_OWNER(orion_state, orion128 ) + + MCFG_VIDEO_START_OVERRIDE(orion_state,orion128) + + MCFG_MC146818_ADD( "rtc", XTAL_4_194304Mhz ) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8912", AY8912, 1773400) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rko_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("orion_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") + + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) + + MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd2", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd3", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","orion_flop") + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "orion_cart") + + MCFG_SOFTWARE_LIST_ADD("cart_list", "orion_cart") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( orionz80ms, orionz80 ) + + MCFG_DEVICE_REMOVE("ppi8255_2") + MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, rk7007_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( orionpro, orion_state ) + MCFG_CPU_ADD("maincpu", Z80, 5000000) + MCFG_CPU_PROGRAM_MAP(orionpro_mem) + MCFG_CPU_IO_MAP(orionpro_io) + + MCFG_MACHINE_RESET_OVERRIDE(orion_state, orionpro ) + + MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(orion_state, orion_romdisk_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(orion_state, orion_romdisk_portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(orion_state, orion_romdisk_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(384, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(orion_state, screen_update_orion128) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 18) + MCFG_PALETTE_INIT_OWNER(orion_state, orion128 ) + + MCFG_VIDEO_START_OVERRIDE(orion_state,orion128) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8912", AY8912, 1773400) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rko_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("orion_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") + + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) + + MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd2", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd3", orion_floppies, "525qd", orion_state::orion_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","orionpro_flop") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop128_list","orion_flop") + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "orion_cart") + + MCFG_SOFTWARE_LIST_ADD("cart_list", "orion_cart") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( orion128 ) + ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "m2rk", "Version 3.2 rk" ) + ROMX_LOAD( "m2rk.bin", 0x0f800, 0x0800, CRC(2025c234) SHA1(caf86918629be951fe698cddcdf4589f07e2fb96), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "m2_2rk", "Version 3.2.2 rk" ) + ROMX_LOAD( "m2_2rk.bin", 0x0f800, 0x0800, CRC(fc662351) SHA1(7c6de67127fae5869281449de1c503597c0c058e), ROM_BIOS(2) ) +ROM_END + +ROM_START( orionms ) + ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ms7007.bin", 0x0f800, 0x0800, CRC(c6174ba3) SHA1(8f9a42c3e09684718fe4121a8408e7860129d26f) ) +ROM_END + +ROM_START( orionz80 ) + ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "m31", "Version 3.1" ) + ROMX_LOAD( "m31.bin", 0x0f800, 0x0800, CRC(007c6dc6) SHA1(338ff95497c820338f7f79c75f65bc540a5541c4), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "m32zrk", "Version 3.2 zrk" ) + ROMX_LOAD( "m32zrk.bin", 0x0f800, 0x0800, CRC(4ec3f012) SHA1(6b0b2bfc515a80e7caf72c3c33cf2dcf192d4711), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "m33zrkd", "Version 3.3 zrkd" ) + ROMX_LOAD( "m33zrkd.bin", 0x0f800, 0x0800, CRC(f404032d) SHA1(088cd9ed05f0dda4fa0a005c609208d9f57ad3d9), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "m34zrk", "Version 3.4 zrk" ) + ROMX_LOAD( "m34zrk.bin", 0x0f800, 0x0800, CRC(787c3903) SHA1(476c1c0b88e5efb582292eebec15e24d054c8851), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "m35zrkd", "Version 3.5 zrkd" ) + ROMX_LOAD( "m35zrkd.bin", 0x0f800, 0x0800, CRC(9368b38f) SHA1(64a77f22119d40c9b18b64d78ad12acc6fff9efb), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "peter", "Peterburg '91" ) + ROMX_LOAD( "peter.bin", 0x0f800, 0x0800, CRC(df9b1d8c) SHA1(c7f1e074e58ad1c1799cf522161b4f4cffa5aefa), ROM_BIOS(6) ) +ROM_END + +ROM_START( orionide ) + ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "m35zrkh.bin", 0x0f800, 0x0800, CRC(b7745f28) SHA1(c3bd3e662db7ec56ecbab54bf6b3a4c26200d0bb) ) +ROM_END + +ROM_START( orionzms ) + ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "m32zms", "Version 3.2 zms" ) + ROMX_LOAD( "m32zms.bin", 0x0f800, 0x0800, CRC(44cfd2ae) SHA1(84d53fbc249938c56be76ee4e6ab297f0461835b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "m34zms", "Version 3.4 zms" ) + ROMX_LOAD( "m34zms.bin", 0x0f800, 0x0800, CRC(0f87a80b) SHA1(ab1121092e61268d8162ed8a7d4fd081016a409a), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "m35zmsd", "Version 3.5 zmsd" ) + ROMX_LOAD( "m35zmsd.bin", 0x0f800, 0x0800, CRC(f714ff37) SHA1(fbe9514adb3384aff146cbedd4fede37ce9591e1), ROM_BIOS(3) ) +ROM_END + +ROM_START( orionidm ) + ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "m35zmsh.bin", 0x0f800, 0x0800, CRC(01e66df4) SHA1(8c785a3c32fe3eacda73ec79157b41a6e4b63ba8) ) +ROM_END + +ROM_START( orionpro ) + ROM_REGION( 0x32000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "ver21", "Version 2.1" ) + ROMX_LOAD( "rom1-210.bin", 0x20000, 0x2000, CRC(8e1a0c78) SHA1(61c8a5ed596ce7e3fd32da920dcc80dc5375b421), ROM_BIOS(1) ) + ROMX_LOAD( "rom2-210.bin", 0x22000, 0x10000, CRC(7cb7a49b) SHA1(601f3dd61db323407c4874fd7f23c10dccac0209), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "ver20", "Version 2.0" ) + ROMX_LOAD( "rom1-200.bin", 0x20000, 0x2000, CRC(4fbe83cc) SHA1(9884d43770b4c0fbeb519b96618b01957c0b8511), ROM_BIOS(2) ) + ROMX_LOAD( "rom2-200.bin", 0x22000, 0x10000, CRC(618aaeb7) SHA1(3e7e5d3ff9d2c683708928558e69aa62db877811), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "ver10", "Version 1.0" ) + ROMX_LOAD( "rom1-100.bin", 0x20000, 0x2000, CRC(4fd6c408) SHA1(b0c2e4fb5be5a74a7efa9bba14b746865122af1d), ROM_BIOS(3) ) + ROMX_LOAD( "rom2-100.bin", 0x22000, 0x8000, CRC(370ffdca) SHA1(169e2acac2d0b382e2d0a144da0af18bfa38db5c), ROM_BIOS(3) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1990, orion128, 0, 0, orion128, radio86, driver_device, 0, "", "Orion 128", 0) +COMP( 1990, orionms, orion128, 0, orion128ms, ms7007, driver_device, 0, "", "Orion 128 (MS7007)", 0) +COMP( 1990, orionz80, orion128, 0, orionz80, radio86, driver_device, 0, "", "Orion 128 + Z80 Card II", 0) +COMP( 1990, orionide, orion128, 0, orionz80, radio86, driver_device, 0, "", "Orion 128 + Z80 Card II + IDE", 0) +COMP( 1990, orionzms, orion128, 0, orionz80ms, ms7007, driver_device, 0, "", "Orion 128 + Z80 Card II (MS7007)", 0) +COMP( 1990, orionidm, orion128, 0, orionz80ms, ms7007, driver_device, 0, "", "Orion 128 + Z80 Card II + IDE (MS7007)", 0) +COMP( 1994, orionpro, orion128, 0, orionpro, radio86, driver_device, 0, "", "Orion Pro", 0) diff --git a/src/mame/drivers/osbexec.c b/src/mame/drivers/osbexec.c new file mode 100644 index 00000000000..0318dfa31a0 --- /dev/null +++ b/src/mame/drivers/osbexec.c @@ -0,0 +1,581 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + Osborne Executive driver file + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "sound/speaker.h" +#include "machine/wd_fdc.h" +#include "machine/6821pia.h" +#include "machine/z80dart.h" +#include "machine/pit8253.h" +#include "machine/ram.h" + + +#define MAIN_CLOCK 23961600 + + +class osbexec_state : public driver_device +{ +public: + osbexec_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu( *this, "maincpu" ), + m_mb8877( *this, "mb8877" ), + m_messram( *this, RAM_TAG ), + m_pia_0( *this, "pia_0" ), + m_pia_1( *this, "pia_1" ), + m_sio( *this, "sio" ), + m_speaker( *this, "speaker" ), + m_floppy0( *this, "mb8877:0:525ssdd" ), + m_floppy1( *this, "mb8877:1:525ssdd" ) + { } + + required_device m_maincpu; + required_device m_mb8877; + required_device m_messram; + required_device m_pia_0; + required_device m_pia_1; + required_device m_sio; + required_device m_speaker; + required_device m_floppy0; + required_device m_floppy1; + + virtual void video_start(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + bitmap_ind16 m_bitmap; + + memory_region *m_fontram_region; + memory_region *m_vram_region; + UINT8 *m_fontram; + UINT8 *m_vram; + UINT8 *m_ram_0000; + UINT8 *m_ram_c000; + UINT8 m_temp_attr; + emu_timer *m_video_timer; + + /* PIA 0 (UD12) */ + UINT8 m_pia0_porta; + UINT8 m_pia0_portb; + int m_pia0_irq_state; + int m_pia0_cb2; /* 60/50 */ + + /* PIA 1 (UD8) */ + int m_pia1_irq_state; + + /* Vblank counter ("RTC") */ + UINT8 m_rtc; + + void set_banks() + { + UINT8 *ram_ptr = m_messram->pointer(); + + m_ram_0000 = ram_ptr; + + if ( m_pia0_porta & 0x01 ) + m_ram_0000 += 0x10000; + + membank( "0000" )->set_base( m_ram_0000 + 0x0000 ); + membank( "2000" )->set_base( m_ram_0000 + 0x2000 ); + membank( "4000" )->set_base( m_ram_0000 + 0x4000 ); + m_ram_c000 = m_ram_0000 + 0xc000; + membank( "e000" )->set_base( m_ram_0000 + 0xe000 ); + + if ( m_pia0_porta & 0x80 ) + { + membank( "0000" )->set_base( memregion("maincpu")->base()); + /* When BIOS is enabled 2000-3FFF is set to the "ROM RAM" */ + membank( "2000" )->set_base( ram_ptr + 0x20000 ); + } + + if ( m_pia0_porta & 0x40 ) + m_ram_c000 = m_vram_region->base(); + } + + void update_irq_state() + { + if ( m_pia0_irq_state || m_pia1_irq_state ) + m_maincpu->set_input_line(0, ASSERT_LINE ); + else + m_maincpu->set_input_line(0, CLEAR_LINE ); + } + DECLARE_WRITE8_MEMBER(osbexec_0000_w); + DECLARE_READ8_MEMBER(osbexec_c000_r); + DECLARE_WRITE8_MEMBER(osbexec_c000_w); + DECLARE_READ8_MEMBER(osbexec_kbd_r); + DECLARE_READ8_MEMBER(osbexec_rtc_r); + DECLARE_DRIVER_INIT(osbexec); + virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(osbexec_video_callback); + DECLARE_READ8_MEMBER(osbexec_pia0_a_r); + DECLARE_WRITE8_MEMBER(osbexec_pia0_a_w); + DECLARE_READ8_MEMBER(osbexec_pia0_b_r); + DECLARE_WRITE8_MEMBER(osbexec_pia0_b_w); + DECLARE_WRITE_LINE_MEMBER(osbexec_pia0_ca2_w); + DECLARE_WRITE_LINE_MEMBER(osbexec_pia0_cb2_w); + DECLARE_WRITE_LINE_MEMBER(osbexec_pia0_irq); + DECLARE_WRITE_LINE_MEMBER(osbexec_pia1_irq); +}; + + +WRITE8_MEMBER(osbexec_state::osbexec_0000_w) +{ + /* Font RAM writing is enabled when ROM bank is enabled */ + if ( m_pia0_porta & 0x80 ) + { + if ( offset < 0x1000 ) + m_fontram[ offset ] = data; + } + else + { + m_ram_0000[ offset ] = data; + } +} + + +READ8_MEMBER(osbexec_state::osbexec_c000_r) +{ + UINT8 data = m_ram_c000[offset]; + + if ( ( m_pia0_porta & 0x40 ) && offset < 0x1000 ) + { + m_temp_attr = m_ram_c000[ 0x1000 + offset ]; + } + + return data; +} + + +WRITE8_MEMBER(osbexec_state::osbexec_c000_w) +{ + m_ram_c000[offset] = data; + + if ( ( m_pia0_porta & 0x40 ) && offset < 0x1000 ) + { + m_ram_c000[ 0x1000 + offset ] = m_temp_attr; + } +} + + +READ8_MEMBER(osbexec_state::osbexec_kbd_r) +{ + UINT8 data = 0xFF; + + if ( offset & 0x0100 ) + data &= ioport( "ROW0" )->read(); + + if ( offset & 0x0200 ) + data &= ioport( "ROW1" )->read(); + + if ( offset & 0x0400 ) + data &= ioport( "ROW2" )->read(); + + if ( offset & 0x0800 ) + data &= ioport( "ROW3" )->read(); + + if ( offset & 0x1000 ) + data &= ioport( "ROW4" )->read(); + + if ( offset & 0x2000 ) + data &= ioport( "ROW5" )->read(); + + if ( offset & 0x4000 ) + data &= ioport( "ROW6" )->read(); + + if ( offset & 0x8000 ) + data &= ioport( "ROW7" )->read(); + + return data; +} + + +READ8_MEMBER(osbexec_state::osbexec_rtc_r) +{ + return m_rtc; +} + + +static ADDRESS_MAP_START( osbexec_mem, AS_PROGRAM, 8, osbexec_state ) + AM_RANGE( 0x0000, 0x1FFF ) AM_READ_BANK("0000") AM_WRITE(osbexec_0000_w ) /* ROM and maybe also banked ram */ + AM_RANGE( 0x2000, 0x3FFF ) AM_RAMBANK("2000") /* Banked RAM */ + AM_RANGE( 0x4000, 0xBFFF ) AM_RAMBANK("4000") /* Banked RAM */ + AM_RANGE( 0xC000, 0xDFFF ) AM_READWRITE(osbexec_c000_r, osbexec_c000_w ) /* Video ram / Banked RAM */ + AM_RANGE( 0xE000, 0xEFFF ) AM_RAMBANK("e000") /* Banked RAM */ + AM_RANGE( 0xF000, 0xFFFF ) AM_RAM /* 4KB of non-banked RAM for system stack etc */ +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( osbexec_io, AS_IO, 8, osbexec_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00, 0x03 ) AM_MIRROR( 0xff00 ) AM_DEVREADWRITE( "pia_0", pia6821_device, read, write) /* 6821 PIA @ UD12 */ + /* 0x04 - 0x07 - 8253 @UD1 */ + AM_RANGE( 0x08, 0x0B ) AM_MIRROR( 0xff00 ) AM_DEVREADWRITE("mb8877", wd_fdc_t, read, write ) /* MB8877 @ UB17 input clock = 1MHz */ + AM_RANGE( 0x0C, 0x0F ) AM_MIRROR( 0xff00 ) AM_DEVREADWRITE("sio", z80sio2_device, ba_cd_r, ba_cd_w ) /* SIO @ UD4 */ + AM_RANGE( 0x10, 0x13 ) AM_MIRROR( 0xff00 ) AM_DEVREADWRITE( "pia_1", pia6821_device, read, write) /* 6821 PIA @ UD8 */ + AM_RANGE( 0x14, 0x17 ) AM_MIRROR( 0xff00 ) AM_MASK( 0xff00 ) AM_READ(osbexec_kbd_r ) /* KBD */ + AM_RANGE( 0x18, 0x1b ) AM_MIRROR( 0xff00 ) AM_READ(osbexec_rtc_r ) /* "RTC" @ UE13/UF13 */ + /* ?? - vid ? */ +ADDRESS_MAP_END + + +static INPUT_PORTS_START( osbexec ) + PORT_START("ROW0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("ROW1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("ROW2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START("ROW3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START("ROW4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("ROW5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("ROW6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("ROW7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_DIPNAME( 0x08, 0, "Alpha Lock" ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +void osbexec_state::video_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); +} + +UINT32 osbexec_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + +/* + UD12 - 6821 PIA + + Port A: + PA7 - ROM BANK ENA + PA6 - VRAM BANK ENA + PA5 - BANK6ENA + PA4 - BANK5ENA + PA3 - BANK4ENA + PA2 - BANK3ENA + PA1 - BANK2ENA + PA0 - BANK1ENA + CA1 - DMA IRQ + CA2 - KBD STB (i/o) + + Port B: + PB7 - MODEM RI (input) + PB6 - MODEM DSR (input) + PB5 - TXC SEL + PB4 - RXC SEL + PB3 - speaker + PB2 - DSEL2 + PB1 - DSEL1 + PB0 - DDEN + CB1 - VBlank (input) + CB2 - 60/50 (?) +*/ + +READ8_MEMBER(osbexec_state::osbexec_pia0_a_r) +{ + return m_pia0_porta; +} + + +WRITE8_MEMBER(osbexec_state::osbexec_pia0_a_w) +{ + logerror("osbexec_pia0_a_w: %02x\n", data ); + + m_pia0_porta = data; + + set_banks(); +} + + +READ8_MEMBER(osbexec_state::osbexec_pia0_b_r) +{ + return m_pia0_portb; +} + + +WRITE8_MEMBER(osbexec_state::osbexec_pia0_b_w) +{ + m_pia0_portb = data; + + m_speaker->level_w(!BIT(data, 3)); + + switch ( data & 0x06 ) + { + case 0x02: + m_mb8877->set_floppy(m_floppy1); + m_floppy1->mon_w(0); + break; + case 0x04: + m_mb8877->set_floppy(m_floppy0); + m_floppy0->mon_w(0); + break; + default: + m_mb8877->set_floppy(NULL); + break; + } + + m_mb8877->dden_w(( data & 0x01 ) ? 1 : 0 ); +} + + +WRITE_LINE_MEMBER(osbexec_state::osbexec_pia0_ca2_w) +{ + logerror("osbexec_pia0_ca2_w: state = %d\n", state); +} + + +WRITE_LINE_MEMBER(osbexec_state::osbexec_pia0_cb2_w) +{ + m_pia0_cb2 = state; +} + + +WRITE_LINE_MEMBER(osbexec_state::osbexec_pia0_irq) +{ + m_pia0_irq_state = state; + update_irq_state(); +} + + +WRITE_LINE_MEMBER(osbexec_state::osbexec_pia1_irq) +{ + m_pia1_irq_state = state; + update_irq_state(); +} + + +/* + * The Osborne Executive supports the following disc formats: (TODO: Verify) + * - Osborne single density: 40 tracks, 10 sectors per track, 256-byte sectors (100 KByte) + * - Osborne double density: 40 tracks, 5 sectors per track, 1024-byte sectors (200 KByte) + * - IBM Personal Computer: 40 tracks, 8 sectors per track, 512-byte sectors (160 KByte) + * - Xerox 820 Computer: 40 tracks, 18 sectors per track, 128-byte sectors (90 KByte) + * - DEC 1820 double density: 40 tracks, 9 sectors per track, 512-byte sectors (180 KByte) + * + */ + +static SLOT_INTERFACE_START( osborne2_floppies ) + SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) +SLOT_INTERFACE_END + + +TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) +{ + int y = machine().first_screen()->vpos(); + + /* Start of frame */ + if ( y == 0 ) + { + /* Clear CB1 on PIA @ UD12 */ + m_pia_0->cb1_w(0); + } + else if ( y == 240 ) + { + /* Set CB1 on PIA @ UD12 */ + m_pia_0->cb1_w(1); + m_rtc++; + } + if ( y < 240 ) + { + UINT16 row_addr = ( y / 10 ) * 128; + UINT16 *p = &m_bitmap.pix16(y); + UINT8 char_line = y % 10; + + for ( int x = 0; x < 80; x++ ) + { + UINT8 ch = m_vram[ row_addr + x ]; + UINT8 attr = m_vram[ 0x1000 + row_addr + x ]; + UINT8 fg_col = ( attr & 0x80 ) ? 2 : 1; + UINT8 font_bits = m_fontram[ ( ( attr & 0x10 ) ? 0x800 : 0 ) + ( ch & 0x7f ) * 16 + char_line ]; + + /* Check for underline */ + if ( ( attr & 0x40 ) && char_line == 9 ) + font_bits = 0xFF; + + /* Check for blink */ + if ( ( attr & 0x20 ) && ( m_rtc & 0x10 ) ) + font_bits = 0; + + /* Check for inverse video */ + if ( ( ch & 0x80 ) && ! ( attr & 0x10 ) ) + font_bits ^= 0xFF; + + for ( int b = 0; b < 8; b++ ) + { + p[ x * 8 + b ] = ( font_bits & 0x80 ) ? fg_col : 0; + font_bits <<= 1; + } + } + } + + m_video_timer->adjust( machine().first_screen()->time_until_pos( y + 1, 0 ) ); +} + + +DRIVER_INIT_MEMBER(osbexec_state,osbexec) +{ + m_fontram_region = machine().memory().region_alloc( "fontram", 0x1000, 1, ENDIANNESS_LITTLE); + m_vram_region = machine().memory().region_alloc( "vram", 0x2000, 1, ENDIANNESS_LITTLE ); + m_vram = m_vram_region->base(); + m_fontram = m_fontram_region->base(); + + + memset( m_fontram, 0x00, 0x1000 ); + memset( m_vram, 0x00, 0x2000 ); + + m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osbexec_state::osbexec_video_callback),this)); +} + + +void osbexec_state::machine_reset() +{ + m_pia0_porta = 0xC0; /* Enable ROM and VRAM on reset */ + + set_banks(); + + m_video_timer->adjust( machine().first_screen()->time_until_pos( 0, 0 ) ); + + m_rtc = 0; +} + + +static const z80_daisy_config osbexec_daisy_config[] = +{ + { "sio" }, + { NULL } +}; + + +static MACHINE_CONFIG_START( osbexec, osbexec_state ) + MCFG_CPU_ADD( "maincpu", Z80, MAIN_CLOCK/6 ) + MCFG_CPU_PROGRAM_MAP( osbexec_mem) + MCFG_CPU_IO_MAP( osbexec_io) + MCFG_CPU_CONFIG( osbexec_daisy_config ) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(osbexec_state, screen_update) + MCFG_SCREEN_RAW_PARAMS( MAIN_CLOCK/2, 768, 0, 640, 260, 0, 240 ) /* May not be correct */ + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + +// MCFG_PIT8253_ADD("pit", osbexec_pit_config) + + MCFG_DEVICE_ADD("pia_0", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(osbexec_state, osbexec_pia0_a_r)) + MCFG_PIA_READPB_HANDLER(READ8(osbexec_state, osbexec_pia0_b_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(osbexec_state, osbexec_pia0_a_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(osbexec_state, osbexec_pia0_b_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(osbexec_state, osbexec_pia0_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(osbexec_state, osbexec_pia0_cb2_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(osbexec_state, osbexec_pia0_irq)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(osbexec_state, osbexec_pia0_irq)) + + MCFG_DEVICE_ADD("pia_1", PIA6821, 0) + MCFG_PIA_IRQA_HANDLER(WRITELINE(osbexec_state, osbexec_pia1_irq)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(osbexec_state, osbexec_pia1_irq)) + + MCFG_Z80SIO2_ADD("sio", MAIN_CLOCK/6, 0, 0, 0, 0) + + MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/24) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pia_1", pia6821_device, cb1_w)) + MCFG_FLOPPY_DRIVE_ADD("mb8877:0", osborne2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877:1", osborne2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("136K") /* 128KB Main RAM + RAM in ROM bank (8) */ + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("flop_list", "osborne2") +MACHINE_CONFIG_END + + +ROM_START( osbexec ) + ROM_REGION(0x2000, "maincpu", 0) + ROM_LOAD( "execv12.ud18", 0x0000, 0x2000, CRC(70798c2f) SHA1(2145a72da563bed1d6d455c77e48cc011a5f1153) ) /* Checksum C6B2 */ +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, osbexec, 0, 0, osbexec, osbexec, osbexec_state, osbexec, "Osborne", "Executive", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/osborne1.c b/src/mame/drivers/osborne1.c new file mode 100644 index 00000000000..4910ee5e0cc --- /dev/null +++ b/src/mame/drivers/osborne1.c @@ -0,0 +1,262 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + Osborne-1 driver file + +The Osborne-1 memory is divided into 3 "banks". + +Bank 1 simply consists of 64KB of RAM. The upper 4KB is used for the lower 8 +bit of video RAM entries. + +Bank 2 holds the BIOS ROM and I/O area. Only addresses 0000-3FFF are used +by bank 2. Bank 2 is divided as follows: +3000-3FFF Unused +2C00-2C03 Video PIA +2A00-2A01 Serial interface +2900-2903 488 PIA +2201-2280 Keyboard +2100-2103 Floppy +1000-1FFF Unused +0000-0FFF BIOS ROM + +Bank 3 has the ninth bit needed to complete the full Video RAM. These bits +are stored at F000-FFFF. Only the highest bit is used. + +On bootup bank 2 is active. + +The actual banking is done through I/O ports 00-03. +00 - Have both bank 2 and bank 1 active. This seems to be the power up default. +01 - Only have bank 1 active. +02 - Have both bank 2 and bank 3 active. (Not 100% sure, also bank 1 from 4000-EFFF?) +03 - Have both bank 2 and bank 1 active. + +TODO: + - Verify frequency of the beep/audio alarm. + +***************************************************************************/ + +#include "includes/osborne1.h" + + +#define MAIN_CLOCK 15974400 + + +static ADDRESS_MAP_START( osborne1_mem, AS_PROGRAM, 8, osborne1_state ) + AM_RANGE( 0x0000, 0x0FFF ) AM_READ_BANK("bank1") AM_WRITE( osborne1_0000_w ) + AM_RANGE( 0x1000, 0x1FFF ) AM_READ_BANK("bank2") AM_WRITE( osborne1_1000_w ) + AM_RANGE( 0x2000, 0x2FFF ) AM_READWRITE( osborne1_2000_r, osborne1_2000_w ) + AM_RANGE( 0x3000, 0x3FFF ) AM_READ_BANK("bank3") AM_WRITE( osborne1_3000_w ) + AM_RANGE( 0x4000, 0xEFFF ) AM_RAM + AM_RANGE( 0xF000, 0xFFFF ) AM_READ_BANK("bank4") AM_WRITE( osborne1_videoram_w ) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( osborne1_io, AS_IO, 8, osborne1_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x00, 0x03 ) AM_WRITE( osborne1_bankswitch_w ) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( osborne1 ) + PORT_START("ROW0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("ROW1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("ROW2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("ROW3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START("ROW4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START("ROW5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("ROW6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("ROW7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_DIPNAME( 0x08, 0, "Alpha Lock" ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +static const z80_daisy_config osborne1_daisy_chain[] = +{ +/* { osborne1_z80_reset, osborne1_z80_irq_state, osborne1_z80_irq_ack, osborne1_z80_irq_reti, 0 }, */ + { "osborne1_daisy" }, + { NULL } +}; + + +/* + * The Osborne-1 supports the following disc formats: + * - Osborne single density: 40 tracks, 10 sectors per track, 256-byte sectors (100 KByte) + * - Osborne double density: 40 tracks, 5 sectors per track, 1024-byte sectors (200 KByte) + * - IBM Personal Computer: 40 tracks, 8 sectors per track, 512-byte sectors (160 KByte) + * - Xerox 820 Computer: 40 tracks, 18 sectors per track, 128-byte sectors (90 KByte) + * - DEC 1820 double density: 40 tracks, 9 sectors per track, 512-byte sectors (180 KByte) + * + */ + +static SLOT_INTERFACE_START( osborne1_floppies ) + SLOT_INTERFACE( "525sssd", FLOPPY_525_SSSD ) // Siemens FDD 100-5, custom Osborne electronics + SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) // MPI 52(?), custom Osborne electronics +SLOT_INTERFACE_END + + +/* F4 Character Displayer */ +static const gfx_layout osborne1_charlayout = +{ + 8, 10, /* 8 x 10 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*128*8, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8, 8*128*8, 9*128*8 }, + 8 /* every char takes 16 x 1 bytes */ +}; + +static GFXDECODE_START( osborne1 ) + GFXDECODE_ENTRY( "chargen", 0x0000, osborne1_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( osborne1, osborne1_state ) + MCFG_CPU_ADD( "maincpu", Z80, MAIN_CLOCK/4 ) + MCFG_CPU_PROGRAM_MAP( osborne1_mem) + MCFG_CPU_IO_MAP( osborne1_io) + MCFG_CPU_CONFIG( osborne1_daisy_chain ) + + MCFG_DEVICE_ADD( "osborne1_daisy", OSBORNE1_DAISY, 0 ) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(osborne1_state, screen_update) + MCFG_SCREEN_RAW_PARAMS( MAIN_CLOCK/2, 512, 0, 416, 260, 0, 240 ) + MCFG_SCREEN_PALETTE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", osborne1) + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + MCFG_DEVICE_ADD("pia_0", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) + MCFG_PIA_READPB_HANDLER(READ8(osborne1_state, ieee_pia_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(osborne1_state, ieee_pia_pb_w)) + MCFG_PIA_CA2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(osborne1_state, ieee_pia_irq_a_func)) + + MCFG_DEVICE_ADD( "pia_1", PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(osborne1_state, video_pia_port_a_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(osborne1_state, video_pia_port_b_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(osborne1_state, video_pia_out_cb2_dummy)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(osborne1_state, video_pia_irq_a_func)) + + MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/16) + MCFG_WD_FDC_FORCE_READY + MCFG_FLOPPY_DRIVE_ADD("mb8877:0", osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("mb8877:1", osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + + MCFG_IEEE488_BUS_ADD() + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE("pia_0", pia6821_device, ca2_w)) + MCFG_SOFTWARE_LIST_ADD("flop_list","osborne1") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("68K") /* 64KB Main RAM and 4Kbit video attribute RAM */ +MACHINE_CONFIG_END + + +ROM_START( osborne1 ) + ROM_REGION(0x1000, "maincpu", 0) + ROM_SYSTEM_BIOS( 0, "ver144", "BIOS version 1.44" ) + ROMX_LOAD( "3a10082-00rev-e.ud11", 0x0000, 0x1000, CRC(c0596b14) SHA1(ee6a9cc9be3ddc5949d3379351c1d58a175ce9ac), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "verA", "BIOS version A" ) + ROMX_LOAD( "osba.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "ver12", "BIOS version 1.2" ) + ROMX_LOAD( "osb12.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "ver121", "BIOS version 1.2.1" ) + ROMX_LOAD( "osb121.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "ver13", "BIOS version 1.3" ) + ROMX_LOAD( "osb13.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "ver14", "BISO version 1.4" ) + ROMX_LOAD( "rev1.40.ud11", 0x0000, 0x1000, CRC(3d966335) SHA1(0c60b97a3154a75868efc6370d26995eadc7d927), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 6, "ver143", "BIOS version 1.43" ) + ROMX_LOAD( "rev1.43.ud11", 0x0000, 0x1000, CRC(91a48e3c) SHA1(c37b83f278d21e6e92d80f9c057b11f7f22d88d4), ROM_BIOS(7) ) + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "7a3007-00.ud15", 0x0000, 0x800, CRC(6c1eab0d) SHA1(b04459d377a70abc9155a5486003cb795342c801) ) + //ROM_LOAD( "char.ua15", 0x0000, 0x800, CRC(5297C109) SHA1(e1a59d87edd66e6c226102cb0688e9cb74dbb594) ) // this is CHRROM from v1.4 BIOS MB. I don't know how to hook up diff CHR to ROM_BIOS(6) + +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, osborne1, 0, 0, osborne1, osborne1, osborne1_state, osborne1, "Osborne", "Osborne-1", 0 ) diff --git a/src/mame/drivers/osi.c b/src/mame/drivers/osi.c new file mode 100644 index 00000000000..01e59360901 --- /dev/null +++ b/src/mame/drivers/osi.c @@ -0,0 +1,908 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Robbbert, Wilbert Pol +/* + +Ohio Scientific Superboard II Model 600 + +PCB Layout +---------- + +OHIO SCIENTIFIC MODEL 600 REV D + +|-------------------------------------------------------------------------------------------| +| 2114 2114 | +| LS138 CN1 | +| IC1 2114 2114 | +| LS04 LS75 LS75 | +| 2114 2114 | +| LS138 | +| 2114 2114 LS125 LS125 | +| LS138 | +| - 2114 2114 8T28 8T28 | +| | | +|C| 2114 2114 | +|N| | +|3| 2114 2114 6502 | +| | | +| - 2114 2114 | +| | +| 2114 8T28 ROM0 | +| LS163 LS157 LS174 | +| 2114 8T28 ROM1 | +| CA3130 LS163 LS157 LS02 | +| 2114 8T28 ROM2 | +| LS14 LS163 LS157 LS04 | +| SW1 ROM3 | +| 7417 7404 LS20 ROM5 7408 LS139 | +| ROM4 | +| - 74123 7474 LS163 LS165 7474 | +|C| | +|N| 7476 7400 LS157 LS93 LS04 6850 | +|2| | +| - 7403 74123 3.7MHz LS86 LS163 LS20 CN4 | +|-------------------------------------------------------------------------------------------| + +Notes: + All IC's shown. + + ROM0-5 - + 6502 - + 6850 - Asynchronous Communications Interface Adapter + 8T28 - 4-Bit Bidirectional Bus Transceiver + CA3130 - Operational Amplifier + CN1 - OSI-48 bus connector + CN2 - + CN3 - + CN4 - sound connector + SW1 - + +*/ + +/* + +Compukit UK101 + +PCB Layout +---------- + +|-------------------------------------------------------------------------------------------| +| 2114 2114 | +| LS138 CN1 | +| IC1 2114 2114 | +| 7404 LS75 LS75 | +| 2114 2114 | +| LS138 | +| 2114 2114 LS125 LS125 | +| LS138 | +| - 2114* 2114* 8T28* 8T28* | +| | | +|C| 2114* 2114* | +|N| CN4 | +|3| 2114* 2114* 6502 | +| | | +| - 2114* 2114* | +| | +| 2114 8T28 ROM0 | +| 74163 LS157 | +| 2114 8T28 ROM1 | +| IC66' 74163 LS157 7402 | +| ROM2 | +| IC67' 74163 LS157 7404 | +| ROM3 | +| IC68' 7404 7420 ROM5 LS139 | +| ROM4 | +| - LS123 7474 74163 74165 LS123 | +|C| | +|N| 7476 7400 7493 7404 6850 | +|2| | +| - 7403 LS123 8MHz 74163 LS20 | +|-------------------------------------------------------------------------------------------| + +Notes: + All IC's shown. + + ROM0-5 - + 6502 - + 6850 - Asynchronous Communications Interface Adapter + 8T28 - 4-Bit Bidirectional Bus Transceiver + CN1 - OSI-48 Bus Connector + CN2 - + CN3 - + CN4 - UHF Modulator Output + * - present when 8KB of RAM installed + ' - present when cassette option installed + +*/ + +/* + +Ohio Scientific Single Sided Floppy Interface + +PCB Layout +---------- + +OSI 470 REV B + +|-------------------------------------------------------------------| +| | +| 8T26 8T26 | +| | +| 7417 | +| | +| 6820 6850 7400 U2C | +| 7417 | +| | +| | +| 7417 7404 | +| | +| | +| 7417 | +| | +| 7400 7404 74123 74123 7410 | +| 4MHz | +| | +| | +| 7400 7493 74390 74390 74390 7404 7430 7404 | +| | +| | +| U6A | +| | +|-------------------------------------------------------------------| + +Notes: + All IC's shown. + + 6850 - Asynchronous Communications Interface Adapter + 6820 - Peripheral Interface Adapter + 8T26 - 4-Bit Bidirectional Bus Transceiver + U2C - PROTO? + U6A - PROTO? + +*/ + +/* + + TODO: + + - fix uk101 video to 64x16 + - floppy PIA is actually a 6820 + - break key + - power on reset + - Superboard II revisions A/C/D + - uk101 medium resolution graphics + - uk101 ay-3-8910 sound + - cassette + - faster cassette + - floppy + - wemon? + +*/ + +/* Notes added 2012-05-11 [Robbbert] + General + - Added F1 key to toggle the sound on 'sb2m600b', to silence the awful screech. + - Added F3 key to simulate the RESET / BREAK key on the real keyboard. + - These machines only uses uppercase input. Shift-Lock must be on at all times. + - At boot you get a screen DCWM or similar: + D = boot from floppy + C = Cold boot & start BASIC + W = Warm boot (don't use after turning on the machine) jump to 0000. + M = Monitor (only options are to read/modify memory, Go, Load a tape). + - The corrupt error messages in Basic are normal and are documented in the user + manual. It's not a bug. + + Compukit UK101 + - The Monitor ROM that had always been there is for a 32x32 screen. I assume it + was the prototype referred to in the first Practical Electronics construction + article. Also, the keyboard doesn't work in Basic. + - I found a working rom in another emulator, this runs fine on the 64x16 screen. + - But, the proper rom that came with the kit needs to be found. + - The proper rom (and the prototype) allow you to boot from floppy, but this is + not normally fitted. It appears that it would work the same as in the other + systems in this driver. + +*/ + +/* Notes added 2013-01-20 + Added a modified basic rom, which fixes the garbage collection problem. + Try the following program with -bios 0 and -bios 1. It will work only + with bios 1. You can copy/paste this code, but make sure you include the + trailing blank line. + +10 DIM A$(3) +RUN +PRINT FRE(0) + +*/ + + +#include "includes/osi.h" +#include "machine/clock.h" + +/* Sound */ + +static const discrete_dac_r1_ladder osi600_dac = +{ + 4, // size of ladder + { 180, 180, 180, 180, 0, 0, 0, 0 }, // R68, R69, R70, R71 + 5, // 5V + RES_K(1), // R67 + 0, // no rGnd + 0 // no cFilter +}; + +static DISCRETE_SOUND_START( osi600_discrete_interface ) + DISCRETE_INPUT_DATA(NODE_01) + + DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &osi600_dac) + DISCRETE_CRFILTER(NODE_03, NODE_02, (int)(1.0/(1.0/RES_K(1)+1.0/180+1.0/180+1.0/180+1.0/180)), CAP_U(0.1)) + DISCRETE_OUTPUT(NODE_03, 100) + DISCRETE_GAIN(NODE_04, NODE_03, 32767.0/5) + DISCRETE_OUTPUT(NODE_04, 100) +DISCRETE_SOUND_END + +#if 0 +static const discrete_dac_r1_ladder osi600c_dac = +{ + 8, // size of ladder + { RES_K(68), RES_K(33), RES_K(16), RES_K(8.2), RES_K(3.9), RES_K(2), RES_K(1), 510 }, // R73, R71, R70, R67, R68, R69, R75, R74 + 5, // 5V + 510, // R86 + 0, // no rGnd + CAP_U(33) // C63 +}; +#endif + +static DISCRETE_SOUND_START( osi600c_discrete_interface ) + DISCRETE_INPUT_DATA(NODE_01) + DISCRETE_INPUT_LOGIC(NODE_10) + + DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &osi600_dac) + DISCRETE_ONOFF(NODE_03, NODE_10, NODE_02) + DISCRETE_OUTPUT(NODE_03, 100) +DISCRETE_SOUND_END + +/* Keyboard */ + +READ8_MEMBER( sb2m600_state::keyboard_r ) +{ + if (m_io_reset->read()) + m_maincpu->reset(); + + UINT8 data = 0xff; + + if (!BIT(m_keylatch, 0)) + data &= m_io_row0->read(); + if (!BIT(m_keylatch, 1)) + data &= m_io_row1->read(); + if (!BIT(m_keylatch, 2)) + data &= m_io_row2->read(); + if (!BIT(m_keylatch, 3)) + data &= m_io_row3->read(); + if (!BIT(m_keylatch, 4)) + data &= m_io_row4->read(); + if (!BIT(m_keylatch, 5)) + data &= m_io_row5->read(); + if (!BIT(m_keylatch, 6)) + data &= m_io_row6->read(); + if (!BIT(m_keylatch, 7)) + data &= m_io_row7->read(); + + return data; +} + +WRITE8_MEMBER( sb2m600_state::keyboard_w ) +{ + m_keylatch = data; + + if (m_io_sound->read()) + m_discrete->write(space, NODE_01, (data >> 2) & 0x0f); +} + +WRITE8_MEMBER( uk101_state::keyboard_w ) +{ + m_keylatch = data; +} + +WRITE8_MEMBER( sb2m600_state::ctrl_w ) +{ + /* + + bit signal description + + 0 _32 screen size (0=32x32, 1=64x16) + 1 COLOR EN color enable + 2 BK0 + 3 BK1 + 4 DAC DISABLE DAC sound enable + 5 + 6 + 7 + + */ + + m_32 = BIT(data, 0); + m_coloren = BIT(data, 1); + + m_discrete->write(space, NODE_10, BIT(data, 4)); +} + +WRITE8_MEMBER( c1p_state::osi630_ctrl_w ) +{ + /* + + bit description + + 0 AC control enable + 1 tone generator enable + 2 modem select (0 = printer, 1 = modem) + 3 + 4 + 5 + 6 + 7 + + */ + + m_beep->set_state(BIT(data, 1)); +} + +WRITE8_MEMBER( c1p_state::osi630_sound_w ) +{ + if (data) m_beep->set_frequency(49152 / data); +} + +/* Disk Drive */ + +/* + C000 FLOPIN FLOPPY DISK STATUS PORT + + BIT FUNCTION + 0 DRIVE 0 READY (0 IF READY) + 1 TRACK 0 (0 IF AT TRACK 0) + 2 FAULT (0 IF FAULT) + 3 + 4 DRIVE 1 READY (0 IF READY) + 5 WRITE PROTECT (0 IF WRITE PROTECT) + 6 DRIVE SELECT (1 = A OR C, 0 = B OR D) + 7 INDEX (0 IF AT INDEX HOLE) + + C002 FLOPOT FLOPPY DISK CONTROL PORT + + BIT FUNCTION + 0 WRITE ENABLE (0 ALLOWS WRITING) + 1 ERASE ENABLE (0 ALLOWS ERASING) + ERASE ENABLE IS ON 200us AFTER WRITE IS ON + ERASE ENABLE IS OFF 530us AFTER WRITE IS OFF + 2 STEP BIT : INDICATES DIRECTION OF STEP (WAIT 10us FIRST) + 0 INDICATES STEP TOWARD 76 + 1 INDICATES STEP TOWARD 0 + 3 STEP (TRANSITION FROM 1 TO 0) + MUST HOLD AT LEAST 10us, MIN 8us BETWEEN + 4 FAULT RESET (0 RESETS) + 5 SIDE SELECT (1 = A OR B, 0 = C OR D) + 6 LOW CURRENT (0 FOR TRKS 43-76, 1 FOR TRKS 0-42) + 7 HEAD LOAD (0 TO LOAD : MUST WAIT 40ms AFTER) + + C010 ACIA DISK CONTROLLER ACIA STATUS PORT + C011 ACIAIO DISK CONTROLLER ACIA I/O PORT +*/ + +void sb2m600_state::floppy_index_callback(floppy_image_device *floppy, int state) +{ + m_fdc_index = state; +} + +READ8_MEMBER( c1pmf_state::osi470_pia_pa_r ) +{ + /* + + bit description + + 0 _READY DRIVE 1 + 1 _TRACK 00 + 2 _FAULT + 3 _SECTOR + 4 _READY DRIVE 2 + 5 _WRITE PROTECT + 6 + 7 _INDEX + + */ + + return (m_fdc_index << 7); +} + +WRITE8_MEMBER( c1pmf_state::osi470_pia_pa_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 drive select + 7 + + */ +} + +WRITE8_MEMBER( c1pmf_state::osi470_pia_pb_w ) +{ + /* + + bit description + + 0 _WRITE ENABLE + 1 _ERASE ENABLE + 2 _STEP IN + 3 _STEP + 4 _FAULT RESET + 5 side select + 6 _LOW CURRENT + 7 _HEAD LOAD + + */ +} + +WRITE_LINE_MEMBER( c1pmf_state::osi470_pia_cb2_w ) +{ +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( osi600_mem, AS_PROGRAM, 8, sb2m600_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") + AM_RANGE(0xa000, 0xbfff) AM_ROM + AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0xdf00, 0xdf00) AM_READWRITE(keyboard_r, keyboard_w) + AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("acia_0", acia6850_device, status_r, control_w) + AM_RANGE(0xf001, 0xf001) AM_DEVREADWRITE("acia_0", acia6850_device, data_r, data_w) + AM_RANGE(0xf800, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( uk101_mem, AS_PROGRAM, 8, uk101_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") + AM_RANGE(0xa000, 0xbfff) AM_ROM + AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0xd400, 0xd7ff) AM_NOP // bios sets this to spaces at boot + AM_RANGE(0xdc00, 0xdfff) AM_READ(keyboard_r) AM_WRITE(keyboard_w) + AM_RANGE(0xf000, 0xf000) AM_MIRROR(0x00fe) AM_DEVREADWRITE("acia_0", acia6850_device, status_r, control_w) + AM_RANGE(0xf001, 0xf001) AM_MIRROR(0x00fe) AM_DEVREADWRITE("acia_0", acia6850_device, data_r, data_w) + AM_RANGE(0xf800, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c1p_mem, AS_PROGRAM, 8, c1p_state ) + AM_RANGE(0x0000, 0x4fff) AM_RAMBANK("bank1") + AM_RANGE(0xa000, 0xbfff) AM_ROM + AM_RANGE(0xc704, 0xc707) AM_DEVREADWRITE("pia_1", pia6821_device, read, write) + AM_RANGE(0xc708, 0xc70b) AM_DEVREADWRITE("pia_2", pia6821_device, read, write) + AM_RANGE(0xc70c, 0xc70f) AM_DEVREADWRITE("pia_3", pia6821_device, read, write) + AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_SHARE("color_ram") + AM_RANGE(0xd800, 0xd800) AM_WRITE(ctrl_w) + AM_RANGE(0xdf00, 0xdf00) AM_READWRITE(keyboard_r, keyboard_w) + AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("acia_0", acia6850_device, status_r, control_w) + AM_RANGE(0xf001, 0xf001) AM_DEVREADWRITE("acia_0", acia6850_device, data_r, data_w) + AM_RANGE(0xf7c0, 0xf7c0) AM_WRITE(osi630_sound_w) + AM_RANGE(0xf7e0, 0xf7e0) AM_WRITE(osi630_ctrl_w) + AM_RANGE(0xf800, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c1pmf_mem, AS_PROGRAM, 8, c1pmf_state ) + AM_RANGE(0x0000, 0x4fff) AM_RAMBANK("bank1") + AM_RANGE(0xa000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xc003) AM_DEVREADWRITE("pia_0", pia6821_device, read, write) // FDC + AM_RANGE(0xc010, 0xc010) AM_DEVREADWRITE("acia_1", acia6850_device, status_r, control_w) + AM_RANGE(0xc011, 0xc011) AM_DEVREADWRITE("acia_1", acia6850_device, data_r, data_w) + AM_RANGE(0xc704, 0xc707) AM_DEVREADWRITE("pia_1", pia6821_device, read, write) + AM_RANGE(0xc708, 0xc70b) AM_DEVREADWRITE("pia_2", pia6821_device, read, write) + AM_RANGE(0xc70c, 0xc70f) AM_DEVREADWRITE("pia_3", pia6821_device, read, write) + AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_SHARE("color_ram") + AM_RANGE(0xd800, 0xd800) AM_WRITE(ctrl_w) + AM_RANGE(0xdf00, 0xdf00) AM_READWRITE(keyboard_r, keyboard_w) + AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("acia_0", acia6850_device, status_r, control_w) + AM_RANGE(0xf001, 0xf001) AM_DEVREADWRITE("acia_0", acia6850_device, data_r, data_w) + AM_RANGE(0xf7c0, 0xf7c0) AM_WRITE(osi630_sound_w) + AM_RANGE(0xf7e0, 0xf7e0) AM_WRITE(osi630_ctrl_w) + AM_RANGE(0xf800, 0xffff) AM_ROM +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( osi600 ) + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TAB) PORT_CHAR(27) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(10) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUB OUT") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("Sound") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_TOGGLE + + PORT_START("Reset") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) +INPUT_PORTS_END + +static INPUT_PORTS_START( uk101 ) + PORT_INCLUDE(osi600) + + PORT_MODIFY("ROW0") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') + + PORT_MODIFY("ROW5") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') +INPUT_PORTS_END + +/* Machine Start */ + +WRITE_LINE_MEMBER( sb2m600_state::write_cassette_clock ) +{ + m_acia_0->write_rxd((m_cassette->input() > 0.0) ? 1 : 0); + + m_acia_0->write_txc(state); + m_acia_0->write_rxc(state); +} + +WRITE_LINE_MEMBER( sb2m600_state::cassette_tx ) +{ + m_cassette->output(state ? +1.0 : -1.0); +} + +void sb2m600_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* configure RAM banking */ + membank("bank1")->configure_entry(0, memregion(M6502_TAG)->base()); + membank("bank1")->set_entry(0); + + switch (m_ram->size()) + { + case 4*1024: + program.install_readwrite_bank(0x0000, 0x0fff, "bank1"); + program.unmap_readwrite(0x1000, 0x1fff); + break; + + case 8*1024: + program.install_readwrite_bank(0x0000, 0x1fff, "bank1"); + break; + } + + /* register for state saving */ + save_item(NAME(m_keylatch)); + save_pointer(NAME(m_video_ram.target()), OSI600_VIDEORAM_SIZE); +} + +void c1p_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* configure RAM banking */ + membank("bank1")->configure_entry(0, memregion(M6502_TAG)->base()); + membank("bank1")->set_entry(0); + + switch (m_ram->size()) + { + case 8*1024: + program.install_readwrite_bank(0x0000, 0x1fff, "bank1"); + program.unmap_readwrite(0x2000, 0x4fff); + break; + + case 20*1024: + program.install_readwrite_bank(0x0000, 0x4fff, "bank1"); + break; + } + + /* register for state saving */ + save_item(NAME(m_keylatch)); + save_item(NAME(m_32)); + save_item(NAME(m_coloren)); + save_pointer(NAME(m_video_ram.target()), OSI600_VIDEORAM_SIZE); + save_pointer(NAME(m_color_ram.target()), OSI630_COLORRAM_SIZE); +} + +void c1pmf_state::machine_start() +{ + c1p_state::machine_start(); + + // drive select logic missing + if (m_floppy0->get_device()) + m_floppy0->get_device()->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(sb2m600_state::floppy_index_callback), this)); +} + +// disk format: 1 head, 36 tracks (? - manual displays a directory listing with 40 tracks), +// 10 sectors, 256 byte sector length, first sector id 0 +static SLOT_INTERFACE_START( osi_floppies ) + SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) +SLOT_INTERFACE_END + +/* F4 Character Displayer */ +static const gfx_layout osi_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( osi ) + GFXDECODE_ENTRY( "chargen", 0x0000, osi_charlayout, 0, 1 ) +GFXDECODE_END + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( osi600, sb2m600_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M6502_TAG, M6502, X1/4) // .98304 MHz + MCFG_CPU_PROGRAM_MAP(osi600_mem) + + /* video hardware */ + MCFG_FRAGMENT_ADD(osi600_video) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", osi) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(osi600_discrete_interface) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* cassette ACIA */ + MCFG_DEVICE_ADD("acia_0", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(sb2m600_state, cassette_tx)) + + MCFG_DEVICE_ADD("cassette_clock", CLOCK, X1/32) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sb2m600_state, write_cassette_clock)) + + /* cassette */ + MCFG_CASSETTE_ADD("cassette") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("8K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( uk101, uk101_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M6502_TAG, M6502, UK101_X1/8) // 1 MHz + MCFG_CPU_PROGRAM_MAP(uk101_mem) + + /* video hardware */ + MCFG_FRAGMENT_ADD(uk101_video) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", osi) + + /* cassette ACIA */ + MCFG_DEVICE_ADD("acia_0", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(sb2m600_state, cassette_tx)) + + MCFG_DEVICE_ADD("cassette_clock", CLOCK, 500000) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sb2m600_state, write_cassette_clock)) + + /* cassette */ + MCFG_CASSETTE_ADD("cassette") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("8K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( c1p, c1p_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M6502_TAG, M6502, X1/4) // .98304 MHz + MCFG_CPU_PROGRAM_MAP(c1p_mem) + + /* video hardware */ + MCFG_FRAGMENT_ADD(osi630_video) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", osi) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(osi600c_discrete_interface) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_DEVICE_ADD("pia_1", PIA6821, 0) + MCFG_DEVICE_ADD("pia_2", PIA6821, 0) + MCFG_DEVICE_ADD("pia_3", PIA6821, 0) + + /* cassette ACIA */ + MCFG_DEVICE_ADD("acia_0", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(sb2m600_state, cassette_tx)) + + MCFG_DEVICE_ADD("cassette_clock", CLOCK, X1/32) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sb2m600_state, write_cassette_clock)) + + /* cassette */ + MCFG_CASSETTE_ADD("cassette") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8K") + MCFG_RAM_EXTRA_OPTIONS("20K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( c1pmf, c1p, c1pmf_state ) + MCFG_CPU_MODIFY(M6502_TAG) + MCFG_CPU_PROGRAM_MAP(c1pmf_mem) + + MCFG_DEVICE_ADD("pia_0", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(c1pmf_state, osi470_pia_pa_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(c1pmf_state, osi470_pia_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(c1pmf_state, osi470_pia_pb_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(c1pmf_state, osi470_pia_cb2_w)) + + /* floppy ACIA */ + MCFG_DEVICE_ADD("acia_1", ACIA6850, 0) + + MCFG_DEVICE_ADD("floppy_clock", CLOCK, XTAL_4MHz/8) // 250 kHz + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("acia_1", acia6850_device, write_txc)) + + MCFG_FLOPPY_DRIVE_ADD("floppy0", osi_floppies, "ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("floppy1", osi_floppies, NULL, floppy_image_device::default_floppy_formats) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("20K") +MACHINE_CONFIG_END + +/* ROMs */ + + + +ROM_START( sb2m600b ) + ROM_REGION( 0x10000, M6502_TAG, 0 ) + ROM_LOAD( "basus01.u9", 0xa000, 0x0800, CRC(f4f5dec0) SHA1(b41bf24b4470b6e969d32fe48d604637276f846e) ) + ROM_LOAD( "basus02.u10", 0xa800, 0x0800, CRC(0039ef6a) SHA1(1397f0dc170c16c8e0c7d02e63099e986e86385b) ) + ROM_LOAD( "basus04.u12", 0xb800, 0x0800, CRC(8ee6030e) SHA1(71f210163e4268cba2dd78a97c4d8f5dcebf980e) ) + ROM_LOAD( "monde01.u13", 0xf800, 0x0800, CRC(95a44d2e) SHA1(4a0241c4015b94c436d0f0f58b3dd9d5207cd847) ) // also known as syn600.rom + ROM_SYSTEM_BIOS(0, "original", "Original") + ROMX_LOAD("basus03.u11", 0xb000, 0x0800, CRC(ca25f8c1) SHA1(f5e8ee93a5e0656657d0cc60ef44e8a24b8b0a80), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "fixed", "Fixed") + ROMX_LOAD( "basic3.rom", 0xb000, 0x0800, CRC(ac37d575) SHA1(11407eb24d1ba7afb889b7677c987e8be1a61aab), ROM_BIOS(2) ) + + ROM_REGION( 0x0800, "chargen",0) + ROM_LOAD( "chgsup2.u41", 0x0000, 0x0800, CRC(735f5e0a) SHA1(87c6271497c5b00a974d905766e91bb965180594) ) + + ROM_REGION( 0x0800, "user1",0) + // Another bios rom + ROM_LOAD( "c2 c4 synmon.rom", 0x0000, 0x0800, CRC(03cdbcc5) SHA1(5426ae14522ef485b6089472011db0ae1d192630) ) +ROM_END + +// same roms are used in Challenger 2P and 4P +#define rom_c1p rom_sb2m600b +#define rom_c1pmf rom_sb2m600b + +ROM_START( uk101 ) + ROM_REGION( 0x10000, M6502_TAG, 0 ) + ROM_LOAD( "basuk01.ic9", 0xa000, 0x0800, CRC(9d3caa92) SHA1(b2c3d1af0c4f3cead1dbd44aaf5a11680880f772) ) + ROM_LOAD( "basus02.ic10", 0xa800, 0x0800, CRC(0039ef6a) SHA1(1397f0dc170c16c8e0c7d02e63099e986e86385b) ) + ROM_LOAD( "basuk03.ic11", 0xb000, 0x0800, CRC(0d011242) SHA1(54bd33522a5d1991086eeeff3a4f73c026be45b6) ) + ROM_LOAD( "basuk04.ic12", 0xb800, 0x0800, CRC(667223e8) SHA1(dca78be4b98317413376d69119942d692e39575a) ) + // This monitor came from another emulator and works well on the 64x16 screen + ROM_LOAD( "monuk02.ic13", 0xf800, 0x0800, CRC(e5b7028d) SHA1(74f0934014fdf83d33c8d3579e562b53c0683270) ) + // This monitor is for a 32x32 screen, and could be the prototype referred to in Practical Electronics + //ROM_LOAD( "monuk02.ic13", 0xf800, 0x0800, CRC(04ac5822) SHA1(2bbbcd0ca18103fd68afcf64a7483653b925d83e) ) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "chguk101.ic41", 0x0000, 0x0800, CRC(fce2c84a) SHA1(baa66a7a48e4d62282671ef53abfaf450b888b70) ) +ROM_END + +/* Driver Initialization */ + +void sb2m600_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SETUP_BEEP: + m_beeper->set_state(0); + m_beeper->set_frequency(300); + break; + default: + assert_always(FALSE, "Unknown id in sb2m600_state::device_timer"); + } +} + +DRIVER_INIT_MEMBER(c1p_state,c1p) +{ + timer_set(attotime::zero, TIMER_SETUP_BEEP); +} + + +/* System Drivers */ + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME +COMP( 1978, sb2m600b, 0, 0, osi600, osi600, driver_device, 0, "Ohio Scientific", "Superboard II Model 600 (Rev. B)", MACHINE_NOT_WORKING) +//COMP( 1980, sb2m600c, 0, 0, osi600c, osi600, driver_device, 0, "Ohio Scientific", "Superboard II Model 600 (Rev. C)", MACHINE_NOT_WORKING) +COMP( 1980, c1p, sb2m600b, 0, c1p, osi600, c1p_state, c1p, "Ohio Scientific", "Challenger 1P Series 2", MACHINE_NOT_WORKING) +COMP( 1980, c1pmf, sb2m600b, 0, c1pmf, osi600, c1p_state, c1p, "Ohio Scientific", "Challenger 1P MF Series 2", MACHINE_NOT_WORKING) +COMP( 1979, uk101, sb2m600b, 0, uk101, uk101, driver_device, 0, "Compukit", "UK101", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/p112.c b/src/mame/drivers/p112.c new file mode 100644 index 00000000000..30b81997663 --- /dev/null +++ b/src/mame/drivers/p112.c @@ -0,0 +1,128 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + P112 Single Board Computer + + 30/08/2010 Skeleton driver + +The P112 is a stand-alone 8-bit CPU board. Typically running CP/M (tm) or a +similar operating system, it provides a Z80182 (Z-80 upgrade) CPU with up to +1MB of memory, serial, parallel and diskette IO, and realtime clock, in a +3.5-inch drive form factor. Powered solely from 5V, it draws 150mA (nominal: +not including disk drives) with a 16MHz CPU clock. Clock speeds up to 24.576MHz +are possible. + +http://members.iinet.net.au/~daveb/p112/p112.html + +Some of the parts: + 32kHz crystal 1 Y2 (RTC crystal) + 16MHz crystal 1 Y1 Parallel resonant (CPU clock) + 24MHz crystal 1 Y3 Parallel resonant (IO chip clock) + 28F256A 1 U4 (Intel Flash ROM, programmed) + 74HCT00 1 U5 + 74ACT02 1 U8 + 74ACT139 1 U11 + 62256 2 U2 U3 (Static RAM, 32kB) + DS1202 1 U6 (Dallas RTC chip) + FDC37C665IR 1 U9 (SMC Super-IO chip) + LT1133 2 U7 U10 (Linear Technology RS232 Tx/Rx) + NMF0512S 1 U12 (Newport Components Flash ROM power) + TL7705ACP 1 U15 (Texas Insts. Reset genr.) + Z8018216 1 U1 (Zilog CPU chip) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z180/z180.h" + + +class p112_state : public driver_device +{ +public: + p112_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_p112(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(p112_mem, AS_PROGRAM, 8, p112_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x07fff) AM_ROM + AM_RANGE(0x08000, 0xfffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(p112_io, AS_IO, 8, p112_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( p112 ) +INPUT_PORTS_END + + +void p112_state::machine_reset() +{ +} + +void p112_state::video_start() +{ +} + +UINT32 p112_state::screen_update_p112(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( p112, p112_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z180, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(p112_mem) + MCFG_CPU_IO_MAP(p112_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(240, 320) + MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 320-1) + MCFG_SCREEN_UPDATE_DRIVER(p112_state, screen_update_p112) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( p112 ) + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "960513", "ver 13-05-1996" ) + ROMX_LOAD( "960513.bin", 0x00000, 0x8000, CRC(077c1c40) SHA1(c1e6b4b0de50bba90f0d4667f9344815bb578b9b), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "970308", "ver 08-03-1997" ) + ROMX_LOAD( "970308.bin", 0x00000, 0x8000, CRC(15e61f0d) SHA1(66ba1af7da0450b69650086ab20230390ba23e17), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "4b1", "ver 4b1" ) + ROMX_LOAD( "romv4b1.bin", 0x00000, 0x8000, CRC(15d79beb) SHA1(f971f75a717e3f6d59b257eb3af369d4d2e0f301), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "4b2", "ver 4b2" ) + ROMX_LOAD( "romv4b2.bin", 0x00000, 0x8000, CRC(9b9a8a5e) SHA1(c40151ee654008b9f803d6a05d692a5a3619a726), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "4b3", "ver 4b3" ) + ROMX_LOAD( "romv4b3.bin", 0x00000, 0x8000, CRC(734031ea) SHA1(2e5e5ac6bd17d15cab24a36bc3da42ca49cbde92), ROM_BIOS(5)) + ROM_SYSTEM_BIOS( 5, "4b4", "ver 4b4" ) + ROMX_LOAD( "romv4b4.bin", 0x00000, 0x8000, CRC(cd419c40) SHA1(6002130d874387c9ec23b4363fe9f0ca78208878), ROM_BIOS(6)) + ROM_SYSTEM_BIOS( 6, "5", "ver 5" ) + ROMX_LOAD( "051103.bin", 0x00000, 0x8000, CRC(6c47ec13) SHA1(24f5bf1524425186fe10e1d29d05f6efbd3366d9), ROM_BIOS(7)) + ROM_SYSTEM_BIOS( 7, "5b1", "ver 5b1" ) + ROMX_LOAD( "romv5b1.bin", 0x00000, 0x8000, CRC(047296f7) SHA1(380f8e4237525636c605b7e37d989ace8437beb4), ROM_BIOS(8)) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1996, p112, 0, 0, p112, p112, driver_device, 0, "Dave Brooks", "P112", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/p2000t.c b/src/mame/drivers/p2000t.c new file mode 100644 index 00000000000..303092f96a1 --- /dev/null +++ b/src/mame/drivers/p2000t.c @@ -0,0 +1,291 @@ +// license:??? +// copyright-holders:Paul Daniels +/************************************************************************ +Philips P2000 1 Memory map + + CPU: Z80 + 0000-0fff ROM + 1000-4fff ROM (appl) + 5000-57ff RAM (Screen T ver) + 5000-5fff RAM (Screen M ver) + 6000-9fff RAM (system) + a000-ffff RAM (extension) + + Interrupts: + + Ports: + 00-09 Keyboard input + 10-1f Output ports + 20-2f Input ports + 30-3f Scroll reg (T ver) + 50-5f Beeper + 70-7f DISAS (M ver) + 88-8B CTC + 8C-90 Floppy ctrl + 94 RAM Bank select + + Display: SAA5050 + +************************************************************************/ + +#include "includes/p2000t.h" + + +/* port i/o functions */ +static ADDRESS_MAP_START( p2000t_io, AS_IO, 8, p2000t_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x0f) AM_READ(p2000t_port_000f_r) + AM_RANGE(0x10, 0x1f) AM_WRITE(p2000t_port_101f_w) + AM_RANGE(0x20, 0x2f) AM_READ(p2000t_port_202f_r) + AM_RANGE(0x30, 0x3f) AM_WRITE(p2000t_port_303f_w) + AM_RANGE(0x50, 0x5f) AM_WRITE(p2000t_port_505f_w) + AM_RANGE(0x70, 0x7f) AM_WRITE(p2000t_port_707f_w) + AM_RANGE(0x88, 0x8b) AM_WRITE(p2000t_port_888b_w) + AM_RANGE(0x8c, 0x90) AM_WRITE(p2000t_port_8c90_w) + AM_RANGE(0x94, 0x94) AM_WRITE(p2000t_port_9494_w) +ADDRESS_MAP_END + +/* Memory w/r functions */ +static ADDRESS_MAP_START( p2000t_mem, AS_PROGRAM, 8, p2000t_state ) + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0x4fff) AM_ROM + AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x5800, 0x9fff) AM_RAM + AM_RANGE(0xa000, 0xffff) AM_NOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START( p2000m_mem, AS_PROGRAM, 8, p2000t_state ) + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0x4fff) AM_ROM + AM_RANGE(0x5000, 0x5fff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x6000, 0x9fff) AM_RAM + AM_RANGE(0xa000, 0xffff) AM_NOP +ADDRESS_MAP_END + +/* graphics output */ + +static const gfx_layout p2000m_charlayout = +{ + 6, 10, + 256, + 1, + { 0 }, + { 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, + 5*8, 6*8, 7*8, 8*8, 9*8 }, + 8 * 10 +}; + +PALETTE_INIT_MEMBER(p2000t_state,p2000m) +{ + palette.set_pen_color(0,rgb_t::white); /* white */ + palette.set_pen_color(1,rgb_t::black); /* black */ + palette.set_pen_color(2,rgb_t::black); /* black */ + palette.set_pen_color(3,rgb_t::white); /* white */ +} + +static GFXDECODE_START( p2000m ) + GFXDECODE_ENTRY( "gfx1", 0x0000, p2000m_charlayout, 0, 2 ) +GFXDECODE_END + +/* Keyboard input */ + +/* 2008-05 FP: +TO DO: verify position of the following keys: '1/4 3/4', '-> <-', '@ up', 'Clrln' +Also, notice that pictures of p2000 units shows slightly different key mappings, suggesting +many different .chr roms could exist + +Small note about natural keyboard support: currently, +- "Keypad 00" and "Keypad ," are not mapped +- "Code" is mapped to 'F1' +- "Clrln" is mapped to 'F2' +*/ + +static INPUT_PORTS_START (p2000t) + PORT_START("KEY.0") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + + PORT_START("KEY.1") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + + PORT_START("KEY.2") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("# \xE2\x96\xAA") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("KEY.3") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("KEY.4") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Code") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + + PORT_START("KEY.5") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clrln") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0xFF0D) + + PORT_START("KEY.6") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xE2\x86\x91") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + + PORT_START("KEY.7") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92 \xE2\x86\x90") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + + PORT_START("KEY.8") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00BC) PORT_CHAR(0x00BE) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + + PORT_START("KEY.9") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + + +INTERRUPT_GEN_MEMBER(p2000t_state::p2000_interrupt) +{ + m_maincpu->set_input_line(0, HOLD_LINE); +} + +READ8_MEMBER( p2000t_state::videoram_r ) +{ + return m_videoram[offset]; +} + +/* Machine definition */ +static MACHINE_CONFIG_START( p2000t, p2000t_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 2500000) + MCFG_CPU_PROGRAM_MAP(p2000t_mem) + MCFG_CPU_IO_MAP(p2000t_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", p2000t_state, p2000_interrupt) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(40 * 12, 24 * 20) + MCFG_SCREEN_VISIBLE_AREA(0, 40 * 12 - 1, 0, 24 * 20 - 1) + MCFG_SCREEN_UPDATE_DEVICE("saa5050", saa5050_device, screen_update) + + MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000) + MCFG_SAA5050_D_CALLBACK(READ8(p2000t_state, videoram_r)) + MCFG_SAA5050_SCREEN_SIZE(40, 24, 80) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + +/* Machine definition */ +static MACHINE_CONFIG_START( p2000m, p2000t_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 2500000) + MCFG_CPU_PROGRAM_MAP(p2000m_mem) + MCFG_CPU_IO_MAP(p2000t_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", p2000t_state, p2000_interrupt) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(80 * 12, 24 * 20) + MCFG_SCREEN_VISIBLE_AREA(0, 80 * 12 - 1, 0, 24 * 20 - 1) + MCFG_VIDEO_START_OVERRIDE(p2000t_state,p2000m) + MCFG_SCREEN_UPDATE_DRIVER(p2000t_state, screen_update_p2000m) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", p2000m ) + MCFG_PALETTE_ADD("palette", 4) + MCFG_PALETTE_INIT_OWNER(p2000t_state,p2000m) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + +ROM_START(p2000t) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("p2000.rom", 0x0000, 0x1000, CRC(650784a3) SHA1(4dbb28adad30587f2ea536ba116898d459faccac)) + ROM_LOAD("basic.rom", 0x1000, 0x4000, CRC(9d9d38f9) SHA1(fb5100436c99634a2592a10dff867f85bcff7aec)) +ROM_END + +ROM_START(p2000m) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("p2000.rom", 0x0000, 0x1000, CRC(650784a3) SHA1(4dbb28adad30587f2ea536ba116898d459faccac)) + ROM_LOAD("basic.rom", 0x1000, 0x4000, CRC(9d9d38f9) SHA1(fb5100436c99634a2592a10dff867f85bcff7aec)) + + ROM_REGION(0x01000, "gfx1",0) + ROM_LOAD("p2000.chr", 0x0140, 0x08c0, BAD_DUMP CRC(78c17e3e) SHA1(4e1c59dc484505de1dc0b1ba7e5f70a54b0d4ccc)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1980, p2000t, 0, 0, p2000t, p2000t, driver_device, 0, "Philips", "Philips P2000T", 0) +COMP ( 1980, p2000m, p2000t, 0, p2000m, p2000t, driver_device, 0, "Philips", "Philips P2000M", 0) diff --git a/src/mame/drivers/p8k.c b/src/mame/drivers/p8k.c new file mode 100644 index 00000000000..c4f326f76c7 --- /dev/null +++ b/src/mame/drivers/p8k.c @@ -0,0 +1,595 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +/*************************************************************************** + + P8000 + + 09/2009 Skeleton driver based on Matt Knoth's emulator. + P8000emu (http://knothusa.net/Home.php) has been a great source of info. + Other info from + * http://www.pofo.de/P8000/notes/books/ + * http://www.pofo.de/P8000/ + + P8000 memory layout + * divided into 3 banks of 64k + * bank A is for roms, only 0000-1FFF is populated + * bank B is for static ram, only 2000-2FFF exists + * bank C is for dynamic ram, all 64k is available. + * selection is done with OUT(c), code + * code = 0 for do nothing; 1 = bank A; 2 = bank B; 4 = bank C. + * Reg C = 0; Reg B = start address of memory that is being switched, + for example B = 20 indicates "bank2" in memory map, and also the + corresponding address in bank A/B/C. + + P8000 monitor commands + * B : ? + * D : display and modify memory + * F : fill memory + * G : go to + * M : move (copy) memory + * N : dump registers + * O : boot from floppy + * P : ? + * Q : ? + * R : dump registers + * S : boot from floppy + * T : jump to ROM at CEF0 + * X : jump to ROM at DB00 + * return : boot from floppy disk + + P8000_16 : All input must be in uppercase. + + TODO: + * properly implement Z80 daisy chain in 16 bit board + * Find out how to enter hardware check on 16 bit board + * hook the sio back up when it becomes usable + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z8000/z8000.h" +#include "cpu/z80/z80daisy.h" +#include "machine/upd765.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/z80dma.h" +#include "sound/beep.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class p8k_state : public driver_device +{ +public: + p8k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_READ8_MEMBER(p8k_port0_r); + DECLARE_WRITE8_MEMBER(p8k_port0_w); + DECLARE_READ8_MEMBER(p8k_port24_r); + DECLARE_WRITE8_MEMBER(p8k_port24_w); + DECLARE_READ16_MEMBER(portff82_r); + DECLARE_WRITE16_MEMBER(portff82_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE8_MEMBER(kbd_put_16); + UINT8 m_term_data; + required_device m_maincpu; + required_device m_terminal; + DECLARE_DRIVER_INIT(p8k); + DECLARE_MACHINE_RESET(p8k); + DECLARE_MACHINE_RESET(p8k_16); + + DECLARE_WRITE_LINE_MEMBER(fdc_irq); + + virtual void machine_start(); + + DECLARE_WRITE_LINE_MEMBER( p8k_daisy_interrupt ); + DECLARE_WRITE_LINE_MEMBER( p8k_dma_irq_w ); + DECLARE_WRITE_LINE_MEMBER( p8k_16_daisy_interrupt ); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); +}; + +/*************************************************************************** + + P8000 8bit + +****************************************************************************/ + +static ADDRESS_MAP_START(p8k_memmap, AS_PROGRAM, 8, p8k_state) + AM_RANGE(0x0000, 0x0FFF) AM_RAMBANK("bank0") + AM_RANGE(0x1000, 0x1FFF) AM_RAMBANK("bank1") + AM_RANGE(0x2000, 0x2FFF) AM_RAMBANK("bank2") + AM_RANGE(0x3000, 0x3FFF) AM_RAMBANK("bank3") + AM_RANGE(0x4000, 0x4FFF) AM_RAMBANK("bank4") + AM_RANGE(0x5000, 0x5FFF) AM_RAMBANK("bank5") + AM_RANGE(0x6000, 0x6FFF) AM_RAMBANK("bank6") + AM_RANGE(0x7000, 0x7FFF) AM_RAMBANK("bank7") + AM_RANGE(0x8000, 0x8FFF) AM_RAMBANK("bank8") + AM_RANGE(0x9000, 0x9FFF) AM_RAMBANK("bank9") + AM_RANGE(0xA000, 0xAFFF) AM_RAMBANK("bank10") + AM_RANGE(0xB000, 0xBFFF) AM_RAMBANK("bank11") + AM_RANGE(0xC000, 0xCFFF) AM_RAMBANK("bank12") + AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK("bank13") + AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK("bank14") + AM_RANGE(0xF000, 0xFFFF) AM_RAMBANK("bank15") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(p8k_iomap, AS_IO, 8, p8k_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x07) AM_READWRITE(p8k_port0_r,p8k_port0_w) // MH7489 + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80ctc_0", z80ctc_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80pio_0", z80pio_device, read_alt, write_alt) + AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) + AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_2", z80pio_device, read_alt, write_alt) + AM_RANGE(0x20, 0x21) AM_DEVICE("i8272", i8272a_device, map) + //AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("z80sio_0", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x24, 0x27) AM_READWRITE(p8k_port24_r,p8k_port24_w) + AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("z80sio_1", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80ctc_1", z80ctc_device, read, write) + AM_RANGE(0x3c, 0x3c) AM_DEVREADWRITE("z80dma", z80dma_device, read, write) +ADDRESS_MAP_END + + + +READ8_MEMBER( p8k_state::p8k_port0_r ) +{ + return 0; +} + +// see memory explanation above +WRITE8_MEMBER( p8k_state::p8k_port0_w ) +{ + UINT8 breg = m_maincpu->state_int(Z80_B) >> 4; + if ((data==1) || (data==2) || (data==4)) + { + char banknum[8]; + sprintf(banknum,"bank%d", breg); + + offset = 0; + if (data==2) + offset = 16; + else + if (data==4) + offset = 32; + + offset += breg; + + membank(banknum)->set_entry(offset); + } + else + if (data) + printf("Invalid data %X for bank %d\n",data,breg); +} + +READ8_MEMBER( p8k_state::p8k_port24_r ) +{ + if (offset == 3) + return 0xff; + if (offset == 2) + return m_term_data; + + return 0; +} + +WRITE8_MEMBER( p8k_state::p8k_port24_w ) +{ + if (offset == 2) + m_terminal->write(space, 0, data); +} + +WRITE8_MEMBER( p8k_state::kbd_put ) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + m_term_data = data; + // This is a dreadful hack.. + // simulate interrupt by saving current pc on + // the stack and jumping to interrupt handler. + UINT16 spreg = m_maincpu->state_int(Z80_SP); + UINT16 pcreg = m_maincpu->state_int(Z80_PC); + spreg--; + mem.write_byte(spreg, pcreg >> 8); + spreg--; + mem.write_byte(spreg, pcreg); + m_maincpu->set_state_int(Z80_SP, spreg); + m_maincpu->set_state_int(Z80_PC, 0x078A); +} + +/*************************************************************************** + + P8000 8bit Peripherals + +****************************************************************************/ + +WRITE_LINE_MEMBER( p8k_state::p8k_daisy_interrupt ) +{ + m_maincpu->set_input_line(0, state); +} + +/* Z80 DMA */ + +WRITE_LINE_MEMBER( p8k_state::p8k_dma_irq_w ) +{ + i8272a_device *i8272 = machine().device("i8272"); + i8272->tc_w(state); + + p8k_daisy_interrupt(state); +} + +READ8_MEMBER(p8k_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(p8k_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset, data); +} + +READ8_MEMBER(p8k_state::io_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(p8k_state::io_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + prog_space.write_byte(offset, data); +} + + +/* Z80 Daisy Chain */ + +static const z80_daisy_config p8k_daisy_chain[] = +{ + { "z80dma" }, /* FDC related */ + { "z80pio_2" }, + { "z80ctc_0" }, + { "z80sio_0" }, + { "z80sio_1" }, + { "z80pio_0" }, + { "z80pio_1" }, + { "z80ctc_1" }, + { NULL } +}; + +/* Intel 8272 Interface */ + +DECLARE_WRITE_LINE_MEMBER( p8k_state::fdc_irq ) +{ + z80pio_device *z80pio = machine().device("z80pio_2"); + + z80pio->port_b_write(state ? 0x10 : 0x00); +} + +void p8k_state::machine_start() +{ +} + +static SLOT_INTERFACE_START( p8k_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +/* Input ports */ +static INPUT_PORTS_START( p8k ) + PORT_START("DSW") + PORT_BIT( 0x7f, 0x7f, IPT_UNUSED ) + PORT_DIPNAME( 0x80, 0x00, "Hardware Test") + PORT_DIPSETTING( 0x00, DEF_STR(Off)) + PORT_DIPSETTING( 0x80, DEF_STR(On)) +INPUT_PORTS_END + + +MACHINE_RESET_MEMBER(p8k_state,p8k) +{ + membank("bank0")->set_entry(0); + membank("bank1")->set_entry(0); + membank("bank2")->set_entry(0); + membank("bank3")->set_entry(0); + membank("bank4")->set_entry(0); + membank("bank5")->set_entry(0); + membank("bank6")->set_entry(0); + membank("bank7")->set_entry(0); + membank("bank8")->set_entry(0); + membank("bank9")->set_entry(0); + membank("bank10")->set_entry(0); + membank("bank11")->set_entry(0); + membank("bank12")->set_entry(0); + membank("bank13")->set_entry(0); + membank("bank14")->set_entry(0); + membank("bank15")->set_entry(0); +} + +DRIVER_INIT_MEMBER(p8k_state,p8k) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("bank0")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank1")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank2")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank3")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank4")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank5")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank6")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank7")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank8")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank9")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank10")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank11")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank12")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank13")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank14")->configure_entries(0, 48, &RAM[0x0000], 0x1000); + membank("bank15")->configure_entries(0, 48, &RAM[0x0000], 0x1000); +} + + +/*************************************************************************** + + P8000 16bit + +****************************************************************************/ + +WRITE8_MEMBER( p8k_state::kbd_put_16 ) +{ + address_space &mem = m_maincpu->space(AS_DATA); + // keyboard int handler is at 0x0700 + m_term_data = data; + // This is another dire hack.. + UINT8 offs = mem.read_byte(0x43a5); + UINT16 addr = 0x41b0 + (UINT16) offs; + mem.write_byte(addr, data); + mem.write_byte(0x43a0, 1); +} + +MACHINE_RESET_MEMBER(p8k_state,p8k_16) +{ +} + +READ16_MEMBER( p8k_state::portff82_r ) +{ + if (offset == 3) // FF87 + return 0xff; + else + if (offset == 1) // FF83 + return m_term_data; + return 0; +} + +WRITE16_MEMBER( p8k_state::portff82_w ) +{ + if (offset == 1) // FF83 + { + address_space &mem = m_maincpu->space(AS_PROGRAM); + m_terminal->write(mem, 0, data); + } +} + +static ADDRESS_MAP_START(p8k_16_memmap, AS_PROGRAM, 16, p8k_state) + AM_RANGE(0x00000, 0x03fff) AM_ROM AM_SHARE("share0") + AM_RANGE(0x04000, 0x07fff) AM_RAM AM_SHARE("share1") + AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(p8k_16_datamap, AS_DATA, 16, p8k_state) + AM_RANGE(0x00000, 0x03fff) AM_ROM AM_SHARE("share0") + AM_RANGE(0x04000, 0x07fff) AM_RAM AM_SHARE("share1") + AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2") +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(p8k_16_iomap, AS_IO, 16, p8k_state) +// AM_RANGE(0x0fef0, 0x0feff) // clock + //AM_RANGE(0x0ff80, 0x0ff87) AM_DEVREADWRITE8("z80sio_0", z80sio0_device, ba_cd_r, ba_cd_w, 0xff) + AM_RANGE(0x0ff80, 0x0ff87) AM_READWRITE(portff82_r,portff82_w) + AM_RANGE(0x0ff88, 0x0ff8f) AM_DEVREADWRITE8("z80sio_1", z80sio0_device, ba_cd_r, ba_cd_w, 0xff) //"z80sio_1", + AM_RANGE(0x0ff90, 0x0ff97) AM_DEVREADWRITE8("z80pio_0", z80pio_device, read_alt, write_alt, 0xff) //"z80pio_0", + AM_RANGE(0x0ff98, 0x0ff9f) AM_DEVREADWRITE8("z80pio_1", z80pio_device, read_alt, write_alt, 0xff) //"z80pio_1", + AM_RANGE(0x0ffa0, 0x0ffa7) AM_DEVREADWRITE8("z80pio_2", z80pio_device, read_alt, write_alt, 0xff) //"z80pio_2", + AM_RANGE(0x0ffa8, 0x0ffaf) AM_DEVREADWRITE8("z80ctc_0", z80ctc_device, read, write, 0xff) //"z80ctc_0", + AM_RANGE(0x0ffb0, 0x0ffb7) AM_DEVREADWRITE8("z80ctc_1", z80ctc_device, read, write, 0xff) //"z80ctc_1", +// AM_RANGE(0x0ffc0, 0x0ffc1) // SCR +// AM_RANGE(0x0ffc8, 0x0ffc9) // SBR +// AM_RANGE(0x0ffd0, 0x0ffd1) // NBR +// AM_RANGE(0x0ffd8, 0x0ffd9) // SNVR +// AM_RANGE(0x0ffe0, 0x0ffe1) // RETI +// AM_RANGE(0x0fff0, 0x0fff1) // TRPL +// AM_RANGE(0x0fff8, 0x0fff9) // IF1L +ADDRESS_MAP_END + + +/*************************************************************************** + + P8000 16bit Peripherals + +****************************************************************************/ + +WRITE_LINE_MEMBER( p8k_state::p8k_16_daisy_interrupt ) +{ + // this must be studied a little bit more :-) +} + + +/* Z80 Daisy Chain */ + +static const z80_daisy_config p8k_16_daisy_chain[] = +{ + { "z80ctc_0" }, + { "z80ctc_1" }, + { "z80sio_0" }, + { "z80sio_1" }, + { "z80pio_0" }, + { "z80pio_1" }, + { "z80pio_2" }, + { NULL } +}; + + + +#if 0 +/* F4 Character Displayer */ +static const gfx_layout p8k_charlayout = +{ + 8, 12, /* 8 x 12 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( p8k ) + GFXDECODE_ENTRY( "chargen", 0x0000, p8k_charlayout, 0, 1 ) +GFXDECODE_END +#endif + + +/*************************************************************************** + + Machine Drivers + +****************************************************************************/ + +static MACHINE_CONFIG_START( p8k, p8k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz ) + MCFG_CPU_CONFIG(p8k_daisy_chain) + MCFG_CPU_PROGRAM_MAP(p8k_memmap) + MCFG_CPU_IO_MAP(p8k_iomap) + MCFG_MACHINE_RESET_OVERRIDE(p8k_state,p8k) + + /* peripheral hardware */ + MCFG_DEVICE_ADD("z80dma", Z80DMA, XTAL_4MHz) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(p8k_state, p8k_dma_irq_w)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(p8k_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(p8k_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(p8k_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(p8k_state, io_write_byte)) + + MCFG_DEVICE_ADD("z80ctc_0", Z80CTC, 1229000) /* 1.22MHz clock */ + // to implement: callbacks! + // manual states the callbacks should go to + // Baud Gen 3, FDC, System-Kanal + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80ctc_1", Z80CTC, 1229000) /* 1.22MHz clock */ + // to implement: callbacks! + // manual states the callbacks should go to + // Baud Gen 0, Baud Gen 1, Baud Gen 2, + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_Z80SIO0_ADD("z80sio_0", XTAL_4MHz, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80SIO0_ADD("z80sio_1", XTAL_4MHz, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80pio_0", Z80PIO, 1229000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80pio_1", Z80PIO, 1229000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80pio_2", Z80PIO, 1229000) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(IOPORT("DSW")) + + MCFG_I8272A_ADD("i8272", true) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("z80dma", z80dma_device, rdy_w)) + MCFG_FLOPPY_DRIVE_ADD("i8272:0", p8k_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("i8272:1", p8k_floppies, "525hd", floppy_image_device::default_floppy_formats) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(p8k_state, kbd_put)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( p8k_16, p8k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z8001, XTAL_4MHz ) + MCFG_CPU_CONFIG(p8k_16_daisy_chain) + MCFG_CPU_PROGRAM_MAP(p8k_16_memmap) + MCFG_CPU_DATA_MAP(p8k_16_datamap) + MCFG_CPU_IO_MAP(p8k_16_iomap) + MCFG_MACHINE_RESET_OVERRIDE(p8k_state,p8k_16) + + /* peripheral hardware */ + MCFG_DEVICE_ADD("z80ctc_0", Z80CTC, XTAL_4MHz) + MCFG_Z80CTC_INTR_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) + + MCFG_DEVICE_ADD("z80ctc_1", Z80CTC, XTAL_4MHz) + MCFG_Z80CTC_INTR_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) + + MCFG_Z80SIO0_ADD("z80sio_0", XTAL_4MHz, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80SIO0_ADD("z80sio_1", XTAL_4MHz, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80pio_0", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) + + MCFG_DEVICE_ADD("z80pio_1", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) + + MCFG_DEVICE_ADD("z80pio_2", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(p8k_state, kbd_put_16)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( p8000 ) + ROM_REGION( 0x30000, "maincpu", 0 ) + ROM_LOAD("mon8_1_3.1", 0x0000, 0x1000, CRC(ad1bb118) SHA1(2332963acd74d5d1a009d9bce8a2b108de01d2a5)) + ROM_LOAD("mon8_2_3.1", 0x1000, 0x1000, CRC(daced7c2) SHA1(f1f778e72568961b448020fc543ed6e81bbe81b1)) + + // this is for the p8000's terminal, not the p8000 itself + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD("p8t_zs", 0x0000, 0x0800, CRC(f9321251) SHA1(a6a796b58d50ec4a416f2accc34bd76bc83f18ea)) + ROM_LOAD("p8tdzs.2", 0x0800, 0x0800, CRC(32736503) SHA1(6a1d7c55dddc64a7d601dfdbf917ce1afaefbb0a)) +ROM_END + +ROM_START( p8000_16 ) + ROM_REGION16_BE( 0x4000, "maincpu", 0 ) + ROM_LOAD16_BYTE("mon16_1h_3.1_udos", 0x0000, 0x1000, CRC(0c3c28da) SHA1(0cd35444c615b404ebb9cf80da788593e573ddb5)) + ROM_LOAD16_BYTE("mon16_1l_3.1_udos", 0x0001, 0x1000, CRC(e8857bdc) SHA1(f89c65cbc479101130c71806fd3ddc28e6383f12)) + ROM_LOAD16_BYTE("mon16_2h_3.1_udos", 0x2000, 0x1000, CRC(cddf58d5) SHA1(588bad8df75b99580459c7a8e898a3396907e3a4)) + ROM_LOAD16_BYTE("mon16_2l_3.1_udos", 0x2001, 0x1000, CRC(395ee7aa) SHA1(d72fadb1608cd0915cd5ce6440897303ac5a12a6)) + + // this is for the p8000's terminal, not the p8000 itself + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD("p8t_zs", 0x0000, 0x0800, CRC(f9321251) SHA1(a6a796b58d50ec4a416f2accc34bd76bc83f18ea)) + ROM_LOAD("p8tdzs.2", 0x0800, 0x0800, CRC(32736503) SHA1(6a1d7c55dddc64a7d601dfdbf917ce1afaefbb0a)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, p8000, 0, 0, p8k, p8k, p8k_state, p8k, "EAW electronic Treptow", "P8000 (8bit Board)", MACHINE_NOT_WORKING) +COMP( 1989, p8000_16, p8000, 0, p8k_16, p8k, driver_device, 0, "EAW electronic Treptow", "P8000 (16bit Board)", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/palm.c b/src/mame/drivers/palm.c new file mode 100644 index 00000000000..4d593a0b071 --- /dev/null +++ b/src/mame/drivers/palm.c @@ -0,0 +1,504 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz, R. Belmont +/**************************************************************************** + + drivers/palm.c + Palm (MC68328) emulation + + Driver by MooglyGuy + + Additional bug fixing by R. Belmont + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/mc68328.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "debugger.h" +#include "rendlay.h" + +#define MC68328_TAG "dragonball" + +class palm_state : public driver_device +{ +public: + palm_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_lsi(*this, MC68328_TAG), + m_dac(*this, "dac"), + m_ram(*this, RAM_TAG), + m_io_penx(*this, "PENX"), + m_io_peny(*this, "PENY"), + m_io_penb(*this, "PENB"), + m_io_portd(*this, "PORTD") { } + + required_device m_maincpu; + required_device m_lsi; + required_device m_dac; + required_device m_ram; + //DECLARE_WRITE8_MEMBER(palm_dac_transition); + //DECLARE_WRITE8_MEMBER(palm_port_f_out); + //DECLARE_READ8_MEMBER(palm_port_c_in); + //DECLARE_READ8_MEMBER(palm_port_f_in); + //DECLARE_WRITE16_MEMBER(palm_spim_out); + //DECLARE_READ16_MEMBER(palm_spim_in); + UINT8 m_port_f_latch; + UINT16 m_spim_data; + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(pen_check); + DECLARE_INPUT_CHANGED_MEMBER(button_check); + DECLARE_WRITE8_MEMBER(palm_port_f_out); + DECLARE_READ8_MEMBER(palm_port_c_in); + DECLARE_READ8_MEMBER(palm_port_f_in); + DECLARE_WRITE16_MEMBER(palm_spim_out); + DECLARE_READ16_MEMBER(palm_spim_in); + DECLARE_WRITE8_MEMBER(palm_dac_transition); + DECLARE_WRITE_LINE_MEMBER(palm_spim_exchange); + DECLARE_PALETTE_INIT(palm); + + required_ioport m_io_penx; + required_ioport m_io_peny; + required_ioport m_io_penb; + required_ioport m_io_portd; +}; + +static offs_t palm_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); + + +/*************************************************************************** + MACHINE HARDWARE +***************************************************************************/ + +INPUT_CHANGED_MEMBER(palm_state::pen_check) +{ + UINT8 button = m_io_penb->read(); + + if(button) + m_lsi->set_penirq_line(1); + else + m_lsi->set_penirq_line(0); +} + +INPUT_CHANGED_MEMBER(palm_state::button_check) +{ + UINT8 button_state = m_io_portd->read(); + m_lsi->set_port_d_lines(button_state, (int)(FPTR)param); +} + +WRITE8_MEMBER(palm_state::palm_port_f_out) +{ + m_port_f_latch = data; +} + +READ8_MEMBER(palm_state::palm_port_c_in) +{ + return 0x10; +} + +READ8_MEMBER(palm_state::palm_port_f_in) +{ + return m_port_f_latch; +} + +WRITE16_MEMBER(palm_state::palm_spim_out) +{ + m_spim_data = data; +} + +READ16_MEMBER(palm_state::palm_spim_in) +{ + return m_spim_data; +} + +WRITE_LINE_MEMBER(palm_state::palm_spim_exchange) +{ + UINT8 x = m_io_penx->read(); + UINT8 y = m_io_peny->read(); + + switch (m_port_f_latch & 0x0f) + { + case 0x06: + m_spim_data = (0xff - x) * 2; + break; + + case 0x09: + m_spim_data = (0xff - y) * 2; + break; + } +} + +void palm_state::machine_start() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + space.install_read_bank (0x000000, m_ram->size() - 1, m_ram->size() - 1, 0, "bank1"); + space.install_write_bank(0x000000, m_ram->size() - 1, m_ram->size() - 1, 0, "bank1"); + membank("bank1")->set_base(m_ram->pointer()); + + save_item(NAME(m_port_f_latch)); + save_item(NAME(m_spim_data)); + + if (m_maincpu->debug()) + m_maincpu->debug()->set_dasm_override(palm_dasm_override); +} + +void palm_state::machine_reset() +{ + // Copy boot ROM + UINT8* bios = memregion("bios")->base(); + memset(m_ram->pointer(), 0, m_ram->size()); + memcpy(m_ram->pointer(), bios, 0x20000); + + m_maincpu->reset(); +} + +/* THIS IS PRETTY MUCH TOTALLY WRONG AND DOESN'T REFLECT THE MC68328'S INTERNAL FUNCTIONALITY AT ALL! */ +PALETTE_INIT_MEMBER(palm_state, palm) +{ + palette.set_pen_color(0, 0x7b, 0x8c, 0x5a); + palette.set_pen_color(1, 0x00, 0x00, 0x00); +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START(palm_map, AS_PROGRAM, 16, palm_state) + AM_RANGE(0xc00000, 0xe07fff) AM_ROM AM_REGION("bios", 0) + AM_RANGE(0xfff000, 0xffffff) AM_DEVREADWRITE(MC68328_TAG, mc68328_device, read, write) +ADDRESS_MAP_END + + +/*************************************************************************** + AUDIO HARDWARE +***************************************************************************/ + +WRITE8_MEMBER(palm_state::palm_dac_transition) +{ + m_dac->write_unsigned8(0x7f * data ); +} + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static MACHINE_CONFIG_START( palm, palm_state ) + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", M68000, 32768*506 ) /* 16.580608 MHz */ + MCFG_CPU_PROGRAM_MAP( palm_map) + + MCFG_QUANTUM_TIME( attotime::from_hz(60) ) + + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_REFRESH_RATE( 60 ) + MCFG_SCREEN_VBLANK_TIME( ATTOSECONDS_IN_USEC(1260) ) + /* video hardware */ + MCFG_SCREEN_VIDEO_ATTRIBUTES( VIDEO_UPDATE_BEFORE_VBLANK ) + MCFG_SCREEN_SIZE( 160, 220 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 159, 0, 219 ) + MCFG_SCREEN_UPDATE_DEVICE(MC68328_TAG, mc68328_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD( "palette", 2 ) + MCFG_PALETTE_INIT_OWNER(palm_state, palm) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_DEVICE_ADD( MC68328_TAG, MC68328, 0 ) // lsi device + MCFG_MC68328_CPU("maincpu") + MCFG_MC68328_OUT_PORT_F_CB(WRITE8(palm_state, palm_port_f_out)) // Port F Output + MCFG_MC68328_IN_PORT_C_CB(READ8(palm_state, palm_port_c_in)) // Port C Input + MCFG_MC68328_IN_PORT_F_CB(READ8(palm_state, palm_port_f_in)) // Port F Input + MCFG_MC68328_OUT_PWM_CB(WRITE8(palm_state, palm_dac_transition)) + MCFG_MC68328_OUT_SPIM_CB(WRITE16(palm_state, palm_spim_out)) + MCFG_MC68328_IN_SPIM_CB(READ16(palm_state, palm_spim_in)) + MCFG_MC68328_SPIM_XCH_TRIGGER_CB(WRITELINE(palm_state, palm_spim_exchange)) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( palm ) + PORT_START( "PENX" ) + PORT_BIT( 0xff, 0x50, IPT_LIGHTGUN_X ) PORT_NAME("Pen X") PORT_MINMAX(0, 0xa0) PORT_SENSITIVITY(50) PORT_CROSSHAIR(X, 1.0, 0.0, 0) + + PORT_START( "PENY" ) + PORT_BIT( 0xff, 0x50, IPT_LIGHTGUN_Y ) PORT_NAME("Pen Y") PORT_MINMAX(0, 0xa0) PORT_SENSITIVITY(50) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) + + PORT_START( "PENB" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Pen Button") PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, pen_check, NULL) + + PORT_START( "PORTD" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Power") PORT_CODE(KEYCODE_D) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Up") PORT_CODE(KEYCODE_Y) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Down") PORT_CODE(KEYCODE_H) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Button 1") PORT_CODE(KEYCODE_F) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)3) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Button 2") PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)4) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Button 3") PORT_CODE(KEYCODE_J) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)5) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Button 4") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)6) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +#define PALM_68328_BIOS \ + ROM_REGION16_BE( 0x208000, "bios", 0 ) \ + ROM_SYSTEM_BIOS( 0, "1.0e", "Palm OS 1.0 (English)" ) \ + ROMX_LOAD( "palmos10-en.rom", 0x000000, 0x080000, CRC(82030062) SHA1(00d85c6a0588133cc4651555e9605a61fc1901fc), ROM_GROUPWORD | ROM_BIOS(1) ) \ + ROM_SYSTEM_BIOS( 1, "2.0eper", "Palm OS 2.0 Personal (English)" ) \ + ROMX_LOAD( "palmos20-en-pers.rom", 0x000000, 0x100000, CRC(40ea8baa) SHA1(8e26e213de42da1317c375fb1f394bb945b9d178), ROM_GROUPWORD | ROM_BIOS(2) ) \ + ROM_SYSTEM_BIOS( 2, "2.0epro", "Palm OS 2.0 Professional (English)" ) \ + ROMX_LOAD( "palmos20-en-pro.rom", 0x000000, 0x100000, CRC(baa5b36a) SHA1(535bd9548365d300f85f514f318460443a021476), ROM_GROUPWORD | ROM_BIOS(3) ) \ + ROM_SYSTEM_BIOS( 3, "2.0eprod", "Palm OS 2.0 Professional (English, Debug)" ) \ + ROMX_LOAD( "palmis20-en-pro-dbg.rom", 0x000000, 0x100000, CRC(0d1d3a3b) SHA1(f18a80baa306d4d46b490589ee9a2a5091f6081c), ROM_GROUPWORD | ROM_BIOS(4) ) \ + ROM_SYSTEM_BIOS( 4, "3.0e", "Palm OS 3.0 (English)" ) \ + ROMX_LOAD( "palmos30-en.rom", 0x008000, 0x200000, CRC(6f461f3d) SHA1(7fbf592b4dc8c222be510f6cfda21d48ebe22413), ROM_GROUPWORD | ROM_BIOS(5) ) \ + ROM_RELOAD(0x000000, 0x004000) \ + ROM_SYSTEM_BIOS( 5, "3.0ed", "Palm OS 3.0 (English, Debug)" ) \ + ROMX_LOAD( "palmos30-en-dbg.rom", 0x008000, 0x200000, CRC(4deda226) SHA1(1c67d6fee2b6a4acd51cda6ef3490305730357ad), ROM_GROUPWORD | ROM_BIOS(6) ) \ + ROM_RELOAD(0x000000, 0x004000) \ + ROM_SYSTEM_BIOS( 6, "3.0g", "Palm OS 3.0 (German)" ) \ + ROMX_LOAD( "palmos30-de.rom", 0x008000, 0x200000, CRC(b991d6c3) SHA1(73e7539517b0d931e9fa99d6f6914ad46fb857b4), ROM_GROUPWORD | ROM_BIOS(7) ) \ + ROM_RELOAD(0x000000, 0x004000) \ + ROM_SYSTEM_BIOS( 7, "3.0f", "Palm OS 3.0 (French)" ) \ + ROMX_LOAD( "palmos30-fr.rom", 0x008000, 0x200000, CRC(a2a9ff6c) SHA1(7cb119f896017e76e4680510bee96207d9d28e44), ROM_GROUPWORD | ROM_BIOS(8) ) \ + ROM_RELOAD(0x000000, 0x004000) \ + ROM_SYSTEM_BIOS( 8, "3.0s", "Palm OS 3.0 (Spanish)" ) \ + ROMX_LOAD( "palmos30-sp.rom", 0x008000, 0x200000, CRC(63a595be) SHA1(f6e03a2fedf0cbe6228613f50f8e8717e797877d), ROM_GROUPWORD | ROM_BIOS(9) ) \ + ROM_RELOAD(0x000000, 0x004000) \ + ROM_SYSTEM_BIOS( 9, "3.3e", "Palm OS 3.3 (English)" ) \ + ROMX_LOAD( "palmos33-en-iii.rom", 0x008000, 0x200000, CRC(1eae0253) SHA1(e4626f1d33eca8368284d906b2152dcd28b71bbd), ROM_GROUPWORD | ROM_BIOS(10) ) \ + ROM_RELOAD(0x000000, 0x004000) \ + ROM_SYSTEM_BIOS( 10, "3.3f", "Palm OS 3.3 (French)" ) \ + ROMX_LOAD( "palmos33-fr-iii.rom", 0x008000, 0x200000, CRC(d7894f5f) SHA1(c7c90df814d4f97958194e0bc28c595e967a4529), ROM_GROUPWORD | ROM_BIOS(11) ) \ + ROM_RELOAD(0x000000, 0x004000) \ + ROM_SYSTEM_BIOS( 11, "3.3g", "Palm OS 3.3 (German)" ) \ + ROMX_LOAD( "palmos33-de-iii.rom", 0x008000, 0x200000, CRC(a5a99c45) SHA1(209b0154942dab80b56d5e6e68fa20b9eb75f5fe), ROM_GROUPWORD | ROM_BIOS(12) ) \ + ROM_RELOAD(0x000000, 0x004000) + +ROM_START( pilot1k ) + PALM_68328_BIOS + ROM_DEFAULT_BIOS( "1.0e" ) +ROM_END + +ROM_START( pilot5k ) + PALM_68328_BIOS + ROM_DEFAULT_BIOS( "1.0e" ) +ROM_END + +ROM_START( palmpers ) + PALM_68328_BIOS + ROM_DEFAULT_BIOS( "2.0eper" ) +ROM_END + +ROM_START( palmpro ) + PALM_68328_BIOS + ROM_DEFAULT_BIOS( "2.0epro" ) +ROM_END + +ROM_START( palmiii ) + PALM_68328_BIOS + ROM_DEFAULT_BIOS( "3.0e" ) +ROM_END + +ROM_START( palmv ) + ROM_REGION16_BE( 0x208000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "3.1e", "Palm OS 3.1 (English)" ) + ROMX_LOAD( "palmv31-en.rom", 0x008000, 0x200000, CRC(4656b2ae) SHA1(ec66a93441fbccfd8e0c946baa5d79c478c83e85), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 1, "3.1g", "Palm OS 3.1 (German)" ) + ROMX_LOAD( "palmv31-de.rom", 0x008000, 0x200000, CRC(a9631dcf) SHA1(63b44d4d3fc2f2196c96d3b9b95da526df0fac77), ROM_GROUPWORD | ROM_BIOS(2) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 2, "3.1f", "Palm OS 3.1 (French)" ) + ROMX_LOAD( "palmv31-fr.rom", 0x008000, 0x200000, CRC(0d933a1c) SHA1(d0454f1159705d0886f8a68e1b8a5e96d2ca48f6), ROM_GROUPWORD | ROM_BIOS(3) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 3, "3.1s", "Palm OS 3.1 (Spanish)" ) + ROMX_LOAD( "palmv31-sp.rom", 0x008000, 0x200000, CRC(cc46ca1f) SHA1(93bc78ca84d34916d7e122b745adec1068230fcd), ROM_GROUPWORD | ROM_BIOS(4) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 4, "3.1j", "Palm OS 3.1 (Japanese)" ) + ROMX_LOAD( "palmv31-jp.rom", 0x008000, 0x200000, CRC(c786db12) SHA1(4975ff2af76892370c5d4d7d6fa87a84480e79d6), ROM_GROUPWORD | ROM_BIOS(5) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 5, "3.1e2", "Palm OS 3.1 (English) v2" ) + ROMX_LOAD( "palmv31-en-2.rom", 0x008000, 0x200000, CRC(caced2bd) SHA1(95970080601f72a77a4c338203ed8809fab17abf), ROM_GROUPWORD | ROM_BIOS(6) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_DEFAULT_BIOS( "3.1e2" ) +ROM_END + +ROM_START( palmvx ) + ROM_REGION16_BE( 0x208000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "3.3e", "Palm OS 3.3 (English)" ) + ROMX_LOAD( "palmvx33-en.rom", 0x000000, 0x200000, CRC(3fc0cc6d) SHA1(6873d5fa99ac372f9587c769940c9b3ac1745a0a), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "4.0e", "Palm OS 4.0 (English)" ) + ROMX_LOAD( "palmvx40-en.rom", 0x000000, 0x200000, CRC(488e4638) SHA1(10a10fc8617743ebd5df19c1e99ca040ac1da4f5), ROM_GROUPWORD | ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "4.1e", "Palm OS 4.1 (English)" ) + ROMX_LOAD( "palmvx41-en.rom", 0x000000, 0x200000, CRC(e59f4dff) SHA1(5e3000db318eeb8cd1f4d9729d0c9ebca560fa4a), ROM_GROUPWORD | ROM_BIOS(3) ) + ROM_DEFAULT_BIOS( "4.1e" ) +ROM_END + +ROM_START( palmiiic ) + ROM_REGION16_BE( 0x208000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "3.5eb", "Palm OS 3.5 (English) beta" ) + ROMX_LOAD( "palmiiic350-en-beta.rom", 0x008000, 0x200000, CRC(d58521a4) SHA1(508742ea1e078737666abd4283cf5e6985401c9e), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 1, "3.5c", "Palm OS 3.5 (Chinese)" ) + ROMX_LOAD( "palmiiic350-ch.rom", 0x008000, 0x200000, CRC(a9779f3a) SHA1(1541102cd5234665233072afe8f0e052134a5334), ROM_GROUPWORD | ROM_BIOS(2) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 2, "4.0e", "Palm OS 4.0 (English)" ) + ROMX_LOAD( "palmiiic40-en.rom", 0x008000, 0x200000, CRC(6b2a5ad2) SHA1(54321dcaedcc80de57a819cfd599d8d1b2e26eeb), ROM_GROUPWORD | ROM_BIOS(3) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_DEFAULT_BIOS( "4.0e" ) +ROM_END + +ROM_START( palmm100 ) + ROM_REGION16_BE( 0x208000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "3.51e", "Palm OS 3.5.1 (English)" ) + ROMX_LOAD( "palmm100-351-en.rom", 0x008000, 0x200000, CRC(ae8dda60) SHA1(c46248d6f05cb2f4337985610cedfbdc12ac47cf), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_DEFAULT_BIOS( "3.51e" ) +ROM_END + +ROM_START( palmm130 ) + ROM_REGION16_BE( 0x408000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "4.0e", "Palm OS 4.0 (English)" ) + ROMX_LOAD( "palmm130-40-en.rom", 0x008000, 0x400000, CRC(58046b7e) SHA1(986057010d62d5881fba4dede2aba0d4d5008b16), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_DEFAULT_BIOS( "4.0e" ) +ROM_END + +ROM_START( palmm505 ) + ROM_REGION16_BE( 0x408000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "4.0e", "Palm OS 4.0 (English)" ) + ROMX_LOAD( "palmos40-en-m505.rom", 0x008000, 0x400000, CRC(822a4679) SHA1(a4f5e9f7edb1926647ea07969200c5c5e1521bdf), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 1, "4.1e", "Palm OS 4.1 (English)" ) + ROMX_LOAD( "palmos41-en-m505.rom", 0x008000, 0x400000, CRC(d248202a) SHA1(65e1bd08b244c589b4cd10fe573e0376aba90e5f), ROM_GROUPWORD | ROM_BIOS(2) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_DEFAULT_BIOS( "4.1e" ) +ROM_END + +ROM_START( palmm515 ) + ROM_REGION16_BE( 0x408000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "4.1e", "Palm OS 4.1 (English)" ) + ROMX_LOAD( "palmos41-en-m515.rom", 0x008000, 0x400000, CRC(6e143436) SHA1(a0767ea26cc493a3f687525d173903fef89f1acb), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_DEFAULT_BIOS( "4.0e" ) +ROM_END + +ROM_START( visor ) + ROM_REGION16_BE( 0x208000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "3.52e", "Palm OS 3.5.2 (English)" ) + ROMX_LOAD( "visor-352-en.rom", 0x008000, 0x200000, CRC(c9e55271) SHA1(749e9142f4480114c5e0d7f21ea354df7273ac5b), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_DEFAULT_BIOS( "3.52e" ) +ROM_END + +ROM_START( spt1500 ) + ROM_REGION16_BE( 0x208000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "4.1pim", "Version 4.1 (pim)" ) + ROMX_LOAD( "spt1500v41-pim.rom", 0x008000, 0x200000, CRC(29e50eaf) SHA1(3e920887bdf74f8f83935977b02f22d5217723eb), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 1, "4.1pimn", "Version 4.1 (pimnoft)" ) + ROMX_LOAD( "spt1500v41-pimnoft.rom", 0x008000, 0x200000, CRC(4b44f284) SHA1(4412e946444706628b94d2303b02580817e1d370), ROM_GROUPWORD | ROM_BIOS(2) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 2, "4.1nopimn", "Version 4.1 (nopimnoft)" ) + ROMX_LOAD( "spt1500v41-nopimnoft.rom",0x008000, 0x200000, CRC(4ba19190) SHA1(d713c1390b82eb4e5fbb39aa10433757c5c49e02), ROM_GROUPWORD | ROM_BIOS(3) ) + ROM_RELOAD(0x000000, 0x004000) +ROM_END + +ROM_START( spt1700 ) + ROM_REGION16_BE( 0x208000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "1.03pim", "Version 1.03 (pim)" ) + ROMX_LOAD( "spt1700v103-pim.rom", 0x008000, 0x200000, CRC(9df4ee50) SHA1(243a19796f15219cbd73e116f7dfb236b3d238cd), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) +ROM_END + +ROM_START( spt1740 ) + ROM_REGION16_BE( 0x208000, "bios", 0 ) + ROM_SYSTEM_BIOS( 0, "1.03pim", "Version 1.03 (pim)" ) + ROMX_LOAD( "spt1740v103-pim.rom", 0x008000, 0x200000, CRC(c29f341c) SHA1(b56d7f8a0c15b1105972e24ed52c846b5e27b195), ROM_GROUPWORD | ROM_BIOS(1) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 1, "1.03pimn", "Version 1.03 (pimnoft)" ) + ROMX_LOAD( "spt1740v103-pimnoft.rom", 0x008000, 0x200000, CRC(b2d49d5c) SHA1(c133dc021b6797cdb93b666c5b315b00b5bb0917), ROM_GROUPWORD | ROM_BIOS(2) ) + ROM_RELOAD(0x000000, 0x004000) + ROM_SYSTEM_BIOS( 2, "1.03nopim", "Version 1.03 (nopim)" ) + ROMX_LOAD( "spt1740v103-nopim.rom", 0x008000, 0x200000, CRC(8ea7e652) SHA1(2a4b5d6a426e627b3cb82c47109cfe2497eba29a), ROM_GROUPWORD | ROM_BIOS(3) ) + ROM_RELOAD(0x000000, 0x004000) +ROM_END + +static MACHINE_CONFIG_DERIVED( pilot1k, palm ) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("512K,1M,2M,4M,8M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pilot5k, palm ) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_EXTRA_OPTIONS("1M,2M,4M,8M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( palmpro, palm ) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1M") + MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( palmiii, palm ) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("4M,8M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( palmv, palm ) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_RAM_EXTRA_OPTIONS("4M,8M") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( palmvx, palm ) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8M") +MACHINE_CONFIG_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1996, pilot1k, 0, 0, pilot1k, palm, driver_device, 0, "U.S. Robotics", "Pilot 1000", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) +COMP( 1996, pilot5k, pilot1k, 0, pilot5k, palm, driver_device, 0, "U.S. Robotics", "Pilot 5000", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) +COMP( 1997, palmpers, pilot1k, 0, pilot5k, palm, driver_device, 0, "U.S. Robotics", "Palm Pilot Personal", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) +COMP( 1997, palmpro, pilot1k, 0, palmpro, palm, driver_device, 0, "U.S. Robotics", "Palm Pilot Pro", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) +COMP( 1998, palmiii, pilot1k, 0, palmiii, palm, driver_device, 0, "3Com", "Palm III", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) +COMP( 1998, palmiiic, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm IIIc", MACHINE_NOT_WORKING ) +COMP( 2000, palmm100, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm m100", MACHINE_NOT_WORKING ) +COMP( 2000, palmm130, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm m130", MACHINE_NOT_WORKING ) +COMP( 2001, palmm505, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm m505", MACHINE_NOT_WORKING ) +COMP( 2001, palmm515, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm m515", MACHINE_NOT_WORKING ) +COMP( 1999, palmv, pilot1k, 0, palmv, palm, driver_device, 0, "3Com", "Palm V", MACHINE_NOT_WORKING ) +COMP( 1999, palmvx, pilot1k, 0, palmvx, palm, driver_device, 0, "Palm Inc", "Palm Vx", MACHINE_NOT_WORKING ) +COMP( 2001, visor, pilot1k, 0, palmvx, palm, driver_device, 0, "Handspring", "Visor Edge", MACHINE_NOT_WORKING ) +COMP( 19??, spt1500, pilot1k, 0, palmvx, palm, driver_device, 0, "Symbol", "SPT 1500", MACHINE_NOT_WORKING ) +COMP( 19??, spt1700, pilot1k, 0, palmvx, palm, driver_device, 0, "Symbol", "SPT 1700", MACHINE_NOT_WORKING ) +COMP( 19??, spt1740, pilot1k, 0, palmvx, palm, driver_device, 0, "Symbol", "SPT 1740", MACHINE_NOT_WORKING ) + +#include "palm_dbg.inc" diff --git a/src/mame/drivers/palm_dbg.inc b/src/mame/drivers/palm_dbg.inc new file mode 100644 index 00000000000..d02f6117574 --- /dev/null +++ b/src/mame/drivers/palm_dbg.inc @@ -0,0 +1,1194 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz, R. Belmont +static const char *lookup_trap(UINT16 opcode) +{ + static const struct + { + const char *name; + UINT16 trap; + } traps[] = + { + { "sysTrapMemInit", 0xA000 }, + { "sysTrapMemInitHeapTable", 0xA001 }, + { "sysTrapMemStoreInit", 0xA002 }, + { "sysTrapMemCardFormat", 0xA003 }, + { "sysTrapMemCardInfo", 0xA004 }, + { "sysTrapMemStoreInfo", 0xA005 }, + { "sysTrapMemStoreSetInfo", 0xA006 }, + { "sysTrapMemNumHeaps", 0xA007 }, + { "sysTrapMemNumRAMHeaps", 0xA008 }, + { "sysTrapMemHeapID", 0xA009 }, + { "sysTrapMemHeapPtr", 0xA00A }, + { "sysTrapMemHeapFreeBytes", 0xA00B }, + { "sysTrapMemHeapSize", 0xA00C }, + { "sysTrapMemHeapFlags", 0xA00D }, + { "sysTrapMemHeapCompact", 0xA00E }, + { "sysTrapMemHeapInit", 0xA00F }, + { "sysTrapMemHeapFreeByOwnerID", 0xA010 }, + { "sysTrapMemChunkNew", 0xA011 }, + { "sysTrapMemChunkFree", 0xA012 }, + { "sysTrapMemPtrNew", 0xA013 }, + { "sysTrapMemPtrRecoverHandle", 0xA014 }, + { "sysTrapMemPtrFlags", 0xA015 }, + { "sysTrapMemPtrSize", 0xA016 }, + { "sysTrapMemPtrOwner", 0xA017 }, + { "sysTrapMemPtrHeapID", 0xA018 }, + { "sysTrapMemPtrCardNo", 0xA019 }, + { "sysTrapMemPtrToLocalID", 0xA01A }, + { "sysTrapMemPtrSetOwner", 0xA01B }, + { "sysTrapMemPtrResize", 0xA01C }, + { "sysTrapMemPtrResetLock", 0xA01D }, + { "sysTrapMemHandleNew", 0xA01E }, + { "sysTrapMemHandleLockCount", 0xA01F }, + { "sysTrapMemHandleToLocalID", 0xA020 }, + { "sysTrapMemHandleLock", 0xA021 }, + { "sysTrapMemHandleUnlock", 0xA022 }, + { "sysTrapMemLocalIDToGlobal", 0xA023 }, + { "sysTrapMemLocalIDKind", 0xA024 }, + { "sysTrapMemLocalIDToPtr", 0xA025 }, + { "sysTrapMemMove", 0xA026 }, + { "sysTrapMemSet", 0xA027 }, + { "sysTrapMemStoreSearch", 0xA028 }, + { "sysTrapSysReserved10Trap1", 0xA029 }, + { "sysTrapMemKernelInit", 0xA02A }, + { "sysTrapMemHandleFree", 0xA02B }, + { "sysTrapMemHandleFlags", 0xA02C }, + { "sysTrapMemHandleSize", 0xA02D }, + { "sysTrapMemHandleOwner", 0xA02E }, + { "sysTrapMemHandleHeapID", 0xA02F }, + { "sysTrapMemHandleDataStorage", 0xA030 }, + { "sysTrapMemHandleCardNo", 0xA031 }, + { "sysTrapMemHandleSetOwner", 0xA032 }, + { "sysTrapMemHandleResize", 0xA033 }, + { "sysTrapMemHandleResetLock", 0xA034 }, + { "sysTrapMemPtrUnlock", 0xA035 }, + { "sysTrapMemLocalIDToLockedPtr", 0xA036 }, + { "sysTrapMemSetDebugMode", 0xA037 }, + { "sysTrapMemHeapScramble", 0xA038 }, + { "sysTrapMemHeapCheck", 0xA039 }, + { "sysTrapMemNumCards", 0xA03A }, + { "sysTrapMemDebugMode", 0xA03B }, + { "sysTrapMemSemaphoreReserve", 0xA03C }, + { "sysTrapMemSemaphoreRelease", 0xA03D }, + { "sysTrapMemHeapDynamic", 0xA03E }, + { "sysTrapMemNVParams", 0xA03F }, + { "sysTrapDmInit", 0xA040 }, + { "sysTrapDmCreateDatabase", 0xA041 }, + { "sysTrapDmDeleteDatabase", 0xA042 }, + { "sysTrapDmNumDatabases", 0xA043 }, + { "sysTrapDmGetDatabase", 0xA044 }, + { "sysTrapDmFindDatabase", 0xA045 }, + { "sysTrapDmDatabaseInfo", 0xA046 }, + { "sysTrapDmSetDatabaseInfo", 0xA047 }, + { "sysTrapDmDatabaseSize", 0xA048 }, + { "sysTrapDmOpenDatabase", 0xA049 }, + { "sysTrapDmCloseDatabase", 0xA04A }, + { "sysTrapDmNextOpenDatabase", 0xA04B }, + { "sysTrapDmOpenDatabaseInfo", 0xA04C }, + { "sysTrapDmResetRecordStates", 0xA04D }, + { "sysTrapDmGetLastErr", 0xA04E }, + { "sysTrapDmNumRecords", 0xA04F }, + { "sysTrapDmRecordInfo", 0xA050 }, + { "sysTrapDmSetRecordInfo", 0xA051 }, + { "sysTrapDmAttachRecord", 0xA052 }, + { "sysTrapDmDetachRecord", 0xA053 }, + { "sysTrapDmMoveRecord", 0xA054 }, + { "sysTrapDmNewRecord", 0xA055 }, + { "sysTrapDmRemoveRecord", 0xA056 }, + { "sysTrapDmDeleteRecord", 0xA057 }, + { "sysTrapDmArchiveRecord", 0xA058 }, + { "sysTrapDmNewHandle", 0xA059 }, + { "sysTrapDmRemoveSecretRecords", 0xA05A }, + { "sysTrapDmQueryRecord", 0xA05B }, + { "sysTrapDmGetRecord", 0xA05C }, + { "sysTrapDmResizeRecord", 0xA05D }, + { "sysTrapDmReleaseRecord", 0xA05E }, + { "sysTrapDmGetResource", 0xA05F }, + { "sysTrapDmGet1Resource", 0xA060 }, + { "sysTrapDmReleaseResource", 0xA061 }, + { "sysTrapDmResizeResource", 0xA062 }, + { "sysTrapDmNextOpenResDatabase", 0xA063 }, + { "sysTrapDmFindResourceType", 0xA064 }, + { "sysTrapDmFindResource", 0xA065 }, + { "sysTrapDmSearchResource", 0xA066 }, + { "sysTrapDmNumResources", 0xA067 }, + { "sysTrapDmResourceInfo", 0xA068 }, + { "sysTrapDmSetResourceInfo", 0xA069 }, + { "sysTrapDmAttachResource", 0xA06A }, + { "sysTrapDmDetachResource", 0xA06B }, + { "sysTrapDmNewResource", 0xA06C }, + { "sysTrapDmRemoveResource", 0xA06D }, + { "sysTrapDmGetResourceIndex", 0xA06E }, + { "sysTrapDmQuickSort", 0xA06F }, + { "sysTrapDmQueryNextInCategory", 0xA070 }, + { "sysTrapDmNumRecordsInCategory", 0xA071 }, + { "sysTrapDmPositionInCategory", 0xA072 }, + { "sysTrapDmSeekRecordInCategory", 0xA073 }, + { "sysTrapDmMoveCategory", 0xA074 }, + { "sysTrapDmOpenDatabaseByTypeCreator", 0xA075 }, + { "sysTrapDmWrite", 0xA076 }, + { "sysTrapDmStrCopy", 0xA077 }, + { "sysTrapDmGetNextDatabaseByTypeCreator", 0xA078 }, + { "sysTrapDmWriteCheck", 0xA079 }, + { "sysTrapDmMoveOpenDBContext", 0xA07A }, + { "sysTrapDmFindRecordByID", 0xA07B }, + { "sysTrapDmGetAppInfoID", 0xA07C }, + { "sysTrapDmFindSortPositionV10", 0xA07D }, + { "sysTrapDmSet", 0xA07E }, + { "sysTrapDmCreateDatabaseFromImage", 0xA07F }, + { "sysTrapDbgSrcMessage", 0xA080 }, + { "sysTrapDbgMessage", 0xA081 }, + { "sysTrapDbgGetMessage", 0xA082 }, + { "sysTrapDbgCommSettings", 0xA083 }, + { "sysTrapErrDisplayFileLineMsg", 0xA084 }, + { "sysTrapErrSetJump", 0xA085 }, + { "sysTrapErrLongJump", 0xA086 }, + { "sysTrapErrThrow", 0xA087 }, + { "sysTrapErrExceptionList", 0xA088 }, + { "sysTrapSysBroadcastActionCode", 0xA089 }, + { "sysTrapSysUnimplemented", 0xA08A }, + { "sysTrapSysColdBoot", 0xA08B }, + { "sysTrapSysReset", 0xA08C }, + { "sysTrapSysDoze", 0xA08D }, + { "sysTrapSysAppLaunch", 0xA08E }, + { "sysTrapSysAppStartup", 0xA08F }, + { "sysTrapSysAppExit", 0xA090 }, + { "sysTrapSysSetA5", 0xA091 }, + { "sysTrapSysSetTrapAddress", 0xA092 }, + { "sysTrapSysGetTrapAddress", 0xA093 }, + { "sysTrapSysTranslateKernelErr", 0xA094 }, + { "sysTrapSysSemaphoreCreate", 0xA095 }, + { "sysTrapSysSemaphoreDelete", 0xA096 }, + { "sysTrapSysSemaphoreWait", 0xA097 }, + { "sysTrapSysSemaphoreSignal", 0xA098 }, + { "sysTrapSysTimerCreate", 0xA099 }, + { "sysTrapSysTimerWrite", 0xA09A }, + { "sysTrapSysTaskCreate", 0xA09B }, + { "sysTrapSysTaskDelete", 0xA09C }, + { "sysTrapSysTaskTrigger", 0xA09D }, + { "sysTrapSysTaskID", 0xA09E }, + { "sysTrapSysTaskUserInfoPtr", 0xA09F }, + { "sysTrapSysTaskDelay", 0xA0A0 }, + { "sysTrapSysTaskSetTermProc", 0xA0A1 }, + { "sysTrapSysUILaunch", 0xA0A2 }, + { "sysTrapSysNewOwnerID", 0xA0A3 }, + { "sysTrapSysSemaphoreSet", 0xA0A4 }, + { "sysTrapSysDisableInts", 0xA0A5 }, + { "sysTrapSysRestoreStatus", 0xA0A6 }, + { "sysTrapSysUIAppSwitch", 0xA0A7 }, + { "sysTrapSysCurAppInfoPV20", 0xA0A8 }, + { "sysTrapSysHandleEvent", 0xA0A9 }, + { "sysTrapSysInit", 0xA0AA }, + { "sysTrapSysQSort", 0xA0AB }, + { "sysTrapSysCurAppDatabase", 0xA0AC }, + { "sysTrapSysFatalAlert", 0xA0AD }, + { "sysTrapSysResSemaphoreCreate", 0xA0AE }, + { "sysTrapSysResSemaphoreDelete", 0xA0AF }, + { "sysTrapSysResSemaphoreReserve", 0xA0B0 }, + { "sysTrapSysResSemaphoreRelease", 0xA0B1 }, + { "sysTrapSysSleep", 0xA0B2 }, + { "sysTrapSysKeyboardDialogV10", 0xA0B3 }, + { "sysTrapSysAppLauncherDialog", 0xA0B4 }, + { "sysTrapSysSetPerformance", 0xA0B5 }, + { "sysTrapSysBatteryInfoV20", 0xA0B6 }, + { "sysTrapSysLibInstall", 0xA0B7 }, + { "sysTrapSysLibRemove", 0xA0B8 }, + { "sysTrapSysLibTblEntry", 0xA0B9 }, + { "sysTrapSysLibFind", 0xA0BA }, + { "sysTrapSysBatteryDialog", 0xA0BB }, + { "sysTrapSysCopyStringResource", 0xA0BC }, + { "sysTrapSysKernelInfo", 0xA0BD }, + { "sysTrapSysLaunchConsole", 0xA0BE }, + { "sysTrapSysTimerDelete", 0xA0BF }, + { "sysTrapSysSetAutoOffTime", 0xA0C0 }, + { "sysTrapSysFormPointerArrayToStrings", 0xA0C1 }, + { "sysTrapSysRandom", 0xA0C2 }, + { "sysTrapSysTaskSwitching", 0xA0C3 }, + { "sysTrapSysTimerRead", 0xA0C4 }, + { "sysTrapStrCopy", 0xA0C5 }, + { "sysTrapStrCat", 0xA0C6 }, + { "sysTrapStrLen", 0xA0C7 }, + { "sysTrapStrCompare", 0xA0C8 }, + { "sysTrapStrIToA", 0xA0C9 }, + { "sysTrapStrCaselessCompare", 0xA0CA }, + { "sysTrapStrIToH", 0xA0CB }, + { "sysTrapStrChr", 0xA0CC }, + { "sysTrapStrStr", 0xA0CD }, + { "sysTrapStrAToI", 0xA0CE }, + { "sysTrapStrToLower", 0xA0CF }, + { "sysTrapSerReceiveISP", 0xA0D0 }, + { "sysTrapSlkOpen", 0xA0D1 }, + { "sysTrapSlkClose", 0xA0D2 }, + { "sysTrapSlkOpenSocket", 0xA0D3 }, + { "sysTrapSlkCloseSocket", 0xA0D4 }, + { "sysTrapSlkSocketRefNum", 0xA0D5 }, + { "sysTrapSlkSocketSetTimeout", 0xA0D6 }, + { "sysTrapSlkFlushSocket", 0xA0D7 }, + { "sysTrapSlkSetSocketListener", 0xA0D8 }, + { "sysTrapSlkSendPacket", 0xA0D9 }, + { "sysTrapSlkReceivePacket", 0xA0DA }, + { "sysTrapSlkSysPktDefaultResponse", 0xA0DB }, + { "sysTrapSlkProcessRPC", 0xA0DC }, + { "sysTrapConPutS", 0xA0DD }, + { "sysTrapConGetS", 0xA0DE }, + { "sysTrapFplInit", 0xA0DF }, + { "sysTrapFplFree", 0xA0E0 }, + { "sysTrapFplFToA", 0xA0E1 }, + { "sysTrapFplAToF", 0xA0E2 }, + { "sysTrapFplBase10Info", 0xA0E3 }, + { "sysTrapFplLongToFloat", 0xA0E4 }, + { "sysTrapFplFloatToLong", 0xA0E5 }, + { "sysTrapFplFloatToULong", 0xA0E6 }, + { "sysTrapFplMul", 0xA0E7 }, + { "sysTrapFplAdd", 0xA0E8 }, + { "sysTrapFplSub", 0xA0E9 }, + { "sysTrapFplDiv", 0xA0EA }, + { "sysTrapWinScreenInit", 0xA0EB }, + { "sysTrapScrCopyRectangle", 0xA0EC }, + { "sysTrapScrDrawChars", 0xA0ED }, + { "sysTrapScrLineRoutine", 0xA0EE }, + { "sysTrapScrRectangleRoutine", 0xA0EF }, + { "sysTrapScrScreenInfo", 0xA0F0 }, + { "sysTrapScrDrawNotify", 0xA0F1 }, + { "sysTrapScrSendUpdateArea", 0xA0F2 }, + { "sysTrapScrCompressScanLine", 0xA0F3 }, + { "sysTrapScrDeCompressScanLine", 0xA0F4 }, + { "sysTrapTimGetSeconds", 0xA0F5 }, + { "sysTrapTimSetSeconds", 0xA0F6 }, + { "sysTrapTimGetTicks", 0xA0F7 }, + { "sysTrapTimInit", 0xA0F8 }, + { "sysTrapTimSetAlarm", 0xA0F9 }, + { "sysTrapTimGetAlarm", 0xA0FA }, + { "sysTrapTimHandleInterrupt", 0xA0FB }, + { "sysTrapTimSecondsToDateTime", 0xA0FC }, + { "sysTrapTimDateTimeToSeconds", 0xA0FD }, + { "sysTrapTimAdjust", 0xA0FE }, + { "sysTrapTimSleep", 0xA0FF }, + { "sysTrapTimWake", 0xA100 }, + { "sysTrapCategoryCreateListV10", 0xA101 }, + { "sysTrapCategoryFreeListV10", 0xA102 }, + { "sysTrapCategoryFind", 0xA103 }, + { "sysTrapCategoryGetName", 0xA104 }, + { "sysTrapCategoryEditV10", 0xA105 }, + { "sysTrapCategorySelectV10", 0xA106 }, + { "sysTrapCategoryGetNext", 0xA107 }, + { "sysTrapCategorySetTriggerLabel", 0xA108 }, + { "sysTrapCategoryTruncateName", 0xA109 }, + { "sysTrapClipboardAddItem", 0xA10A }, + { "sysTrapClipboardCheckIfItemExist", 0xA10B }, + { "sysTrapClipboardGetItem", 0xA10C }, + { "sysTrapCtlDrawControl", 0xA10D }, + { "sysTrapCtlEraseControl", 0xA10E }, + { "sysTrapCtlHideControl", 0xA10F }, + { "sysTrapCtlShowControl", 0xA110 }, + { "sysTrapCtlGetValue", 0xA111 }, + { "sysTrapCtlSetValue", 0xA112 }, + { "sysTrapCtlGetLabel", 0xA113 }, + { "sysTrapCtlSetLabel", 0xA114 }, + { "sysTrapCtlHandleEvent", 0xA115 }, + { "sysTrapCtlHitControl", 0xA116 }, + { "sysTrapCtlSetEnabled", 0xA117 }, + { "sysTrapCtlSetUsable", 0xA118 }, + { "sysTrapCtlEnabled", 0xA119 }, + { "sysTrapEvtInitialize", 0xA11A }, + { "sysTrapEvtAddEventToQueue", 0xA11B }, + { "sysTrapEvtCopyEvent", 0xA11C }, + { "sysTrapEvtGetEvent", 0xA11D }, + { "sysTrapEvtGetPen", 0xA11E }, + { "sysTrapEvtSysInit", 0xA11F }, + { "sysTrapEvtGetSysEvent", 0xA120 }, + { "sysTrapEvtProcessSoftKeyStroke", 0xA121 }, + { "sysTrapEvtGetPenBtnList", 0xA122 }, + { "sysTrapEvtSetPenQueuePtr", 0xA123 }, + { "sysTrapEvtPenQueueSize", 0xA124 }, + { "sysTrapEvtFlushPenQueue", 0xA125 }, + { "sysTrapEvtEnqueuePenPoint", 0xA126 }, + { "sysTrapEvtDequeuePenStrokeInfo", 0xA127 }, + { "sysTrapEvtDequeuePenPoint", 0xA128 }, + { "sysTrapEvtFlushNextPenStroke", 0xA129 }, + { "sysTrapEvtSetKeyQueuePtr", 0xA12A }, + { "sysTrapEvtKeyQueueSize", 0xA12B }, + { "sysTrapEvtFlushKeyQueue", 0xA12C }, + { "sysTrapEvtEnqueueKey", 0xA12D }, + { "sysTrapEvtDequeueKeyEvent", 0xA12E }, + { "sysTrapEvtWakeup", 0xA12F }, + { "sysTrapEvtResetAutoOffTimer", 0xA130 }, + { "sysTrapEvtKeyQueueEmpty", 0xA131 }, + { "sysTrapEvtEnableGraffiti", 0xA132 }, + { "sysTrapFldCopy", 0xA133 }, + { "sysTrapFldCut", 0xA134 }, + { "sysTrapFldDrawField", 0xA135 }, + { "sysTrapFldEraseField", 0xA136 }, + { "sysTrapFldFreeMemory", 0xA137 }, + { "sysTrapFldGetBounds", 0xA138 }, + { "sysTrapFldGetTextPtr", 0xA139 }, + { "sysTrapFldGetSelection", 0xA13A }, + { "sysTrapFldHandleEvent", 0xA13B }, + { "sysTrapFldPaste", 0xA13C }, + { "sysTrapFldRecalculateField", 0xA13D }, + { "sysTrapFldSetBounds", 0xA13E }, + { "sysTrapFldSetText", 0xA13F }, + { "sysTrapFldGetFont", 0xA140 }, + { "sysTrapFldSetFont", 0xA141 }, + { "sysTrapFldSetSelection", 0xA142 }, + { "sysTrapFldGrabFocus", 0xA143 }, + { "sysTrapFldReleaseFocus", 0xA144 }, + { "sysTrapFldGetInsPtPosition", 0xA145 }, + { "sysTrapFldSetInsPtPosition", 0xA146 }, + { "sysTrapFldSetScrollPosition", 0xA147 }, + { "sysTrapFldGetScrollPosition", 0xA148 }, + { "sysTrapFldGetTextHeight", 0xA149 }, + { "sysTrapFldGetTextAllocatedSize", 0xA14A }, + { "sysTrapFldGetTextLength", 0xA14B }, + { "sysTrapFldScrollField", 0xA14C }, + { "sysTrapFldScrollable", 0xA14D }, + { "sysTrapFldGetVisibleLines", 0xA14E }, + { "sysTrapFldGetAttributes", 0xA14F }, + { "sysTrapFldSetAttributes", 0xA150 }, + { "sysTrapFldSendChangeNotification", 0xA151 }, + { "sysTrapFldCalcFieldHeight", 0xA152 }, + { "sysTrapFldGetTextHandle", 0xA153 }, + { "sysTrapFldCompactText", 0xA154 }, + { "sysTrapFldDirty", 0xA155 }, + { "sysTrapFldWordWrap", 0xA156 }, + { "sysTrapFldSetTextAllocatedSize", 0xA157 }, + { "sysTrapFldSetTextHandle", 0xA158 }, + { "sysTrapFldSetTextPtr", 0xA159 }, + { "sysTrapFldGetMaxChars", 0xA15A }, + { "sysTrapFldSetMaxChars", 0xA15B }, + { "sysTrapFldSetUsable", 0xA15C }, + { "sysTrapFldInsert", 0xA15D }, + { "sysTrapFldDelete", 0xA15E }, + { "sysTrapFldUndo", 0xA15F }, + { "sysTrapFldSetDirty", 0xA160 }, + { "sysTrapFldSendHeightChangeNotification", 0xA161 }, + { "sysTrapFldMakeFullyVisible", 0xA162 }, + { "sysTrapFntGetFont", 0xA163 }, + { "sysTrapFntSetFont", 0xA164 }, + { "sysTrapFntGetFontPtr", 0xA165 }, + { "sysTrapFntBaseLine", 0xA166 }, + { "sysTrapFntCharHeight", 0xA167 }, + { "sysTrapFntLineHeight", 0xA168 }, + { "sysTrapFntAverageCharWidth", 0xA169 }, + { "sysTrapFntCharWidth", 0xA16A }, + { "sysTrapFntCharsWidth", 0xA16B }, + { "sysTrapFntDescenderHeight", 0xA16C }, + { "sysTrapFntCharsInWidth", 0xA16D }, + { "sysTrapFntLineWidth", 0xA16E }, + { "sysTrapFrmInitForm", 0xA16F }, + { "sysTrapFrmDeleteForm", 0xA170 }, + { "sysTrapFrmDrawForm", 0xA171 }, + { "sysTrapFrmEraseForm", 0xA172 }, + { "sysTrapFrmGetActiveForm", 0xA173 }, + { "sysTrapFrmSetActiveForm", 0xA174 }, + { "sysTrapFrmGetActiveFormID", 0xA175 }, + { "sysTrapFrmGetUserModifiedState", 0xA176 }, + { "sysTrapFrmSetNotUserModified", 0xA177 }, + { "sysTrapFrmGetFocus", 0xA178 }, + { "sysTrapFrmSetFocus", 0xA179 }, + { "sysTrapFrmHandleEvent", 0xA17A }, + { "sysTrapFrmGetFormBounds", 0xA17B }, + { "sysTrapFrmGetWindowHandle", 0xA17C }, + { "sysTrapFrmGetFormId", 0xA17D }, + { "sysTrapFrmGetFormPtr", 0xA17E }, + { "sysTrapFrmGetNumberOfObjects", 0xA17F }, + { "sysTrapFrmGetObjectIndex", 0xA180 }, + { "sysTrapFrmGetObjectId", 0xA181 }, + { "sysTrapFrmGetObjectType", 0xA182 }, + { "sysTrapFrmGetObjectPtr", 0xA183 }, + { "sysTrapFrmHideObject", 0xA184 }, + { "sysTrapFrmShowObject", 0xA185 }, + { "sysTrapFrmGetObjectPosition", 0xA186 }, + { "sysTrapFrmSetObjectPosition", 0xA187 }, + { "sysTrapFrmGetControlValue", 0xA188 }, + { "sysTrapFrmSetControlValue", 0xA189 }, + { "sysTrapFrmGetControlGroupSelection", 0xA18A }, + { "sysTrapFrmSetControlGroupSelection", 0xA18B }, + { "sysTrapFrmCopyLabel", 0xA18C }, + { "sysTrapFrmSetLabel", 0xA18D }, + { "sysTrapFrmGetLabel", 0xA18E }, + { "sysTrapFrmSetCategoryLabel", 0xA18F }, + { "sysTrapFrmGetTitle", 0xA190 }, + { "sysTrapFrmSetTitle", 0xA191 }, + { "sysTrapFrmAlert", 0xA192 }, + { "sysTrapFrmDoDialog", 0xA193 }, + { "sysTrapFrmCustomAlert", 0xA194 }, + { "sysTrapFrmHelp", 0xA195 }, + { "sysTrapFrmUpdateScrollers", 0xA196 }, + { "sysTrapFrmGetFirstForm", 0xA197 }, + { "sysTrapFrmVisible", 0xA198 }, + { "sysTrapFrmGetObjectBounds", 0xA199 }, + { "sysTrapFrmCopyTitle", 0xA19A }, + { "sysTrapFrmGotoForm", 0xA19B }, + { "sysTrapFrmPopupForm", 0xA19C }, + { "sysTrapFrmUpdateForm", 0xA19D }, + { "sysTrapFrmReturnToForm", 0xA19E }, + { "sysTrapFrmSetEventHandler", 0xA19F }, + { "sysTrapFrmDispatchEvent", 0xA1A0 }, + { "sysTrapFrmCloseAllForms", 0xA1A1 }, + { "sysTrapFrmSaveAllForms", 0xA1A2 }, + { "sysTrapFrmGetGadgetData", 0xA1A3 }, + { "sysTrapFrmSetGadgetData", 0xA1A4 }, + { "sysTrapFrmSetCategoryTrigger", 0xA1A5 }, + { "sysTrapUIInitialize", 0xA1A6 }, + { "sysTrapUIReset", 0xA1A7 }, + { "sysTrapInsPtInitialize", 0xA1A8 }, + { "sysTrapInsPtSetLocation", 0xA1A9 }, + { "sysTrapInsPtGetLocation", 0xA1AA }, + { "sysTrapInsPtEnable", 0xA1AB }, + { "sysTrapInsPtEnabled", 0xA1AC }, + { "sysTrapInsPtSetHeight", 0xA1AD }, + { "sysTrapInsPtGetHeight", 0xA1AE }, + { "sysTrapInsPtCheckBlink", 0xA1AF }, + { "sysTrapLstSetDrawFunction", 0xA1B0 }, + { "sysTrapLstDrawList", 0xA1B1 }, + { "sysTrapLstEraseList", 0xA1B2 }, + { "sysTrapLstGetSelection", 0xA1B3 }, + { "sysTrapLstGetSelectionText", 0xA1B4 }, + { "sysTrapLstHandleEvent", 0xA1B5 }, + { "sysTrapLstSetHeight", 0xA1B6 }, + { "sysTrapLstSetSelection", 0xA1B7 }, + { "sysTrapLstSetListChoices", 0xA1B8 }, + { "sysTrapLstMakeItemVisible", 0xA1B9 }, + { "sysTrapLstGetNumberOfItems", 0xA1BA }, + { "sysTrapLstPopupList", 0xA1BB }, + { "sysTrapLstSetPosition", 0xA1BC }, + { "sysTrapMenuInit", 0xA1BD }, + { "sysTrapMenuDispose", 0xA1BE }, + { "sysTrapMenuHandleEvent", 0xA1BF }, + { "sysTrapMenuDrawMenu", 0xA1C0 }, + { "sysTrapMenuEraseStatus", 0xA1C1 }, + { "sysTrapMenuGetActiveMenu", 0xA1C2 }, + { "sysTrapMenuSetActiveMenu", 0xA1C3 }, + { "sysTrapRctSetRectangle", 0xA1C4 }, + { "sysTrapRctCopyRectangle", 0xA1C5 }, + { "sysTrapRctInsetRectangle", 0xA1C6 }, + { "sysTrapRctOffsetRectangle", 0xA1C7 }, + { "sysTrapRctPtInRectangle", 0xA1C8 }, + { "sysTrapRctGetIntersection", 0xA1C9 }, + { "sysTrapTblDrawTable", 0xA1CA }, + { "sysTrapTblEraseTable", 0xA1CB }, + { "sysTrapTblHandleEvent", 0xA1CC }, + { "sysTrapTblGetItemBounds", 0xA1CD }, + { "sysTrapTblSelectItem", 0xA1CE }, + { "sysTrapTblGetItemInt", 0xA1CF }, + { "sysTrapTblSetItemInt", 0xA1D0 }, + { "sysTrapTblSetItemStyle", 0xA1D1 }, + { "sysTrapTblUnhighlightSelection", 0xA1D2 }, + { "sysTrapTblSetRowUsable", 0xA1D3 }, + { "sysTrapTblGetNumberOfRows", 0xA1D4 }, + { "sysTrapTblSetCustomDrawProcedure", 0xA1D5 }, + { "sysTrapTblSetRowSelectable", 0xA1D6 }, + { "sysTrapTblRowSelectable", 0xA1D7 }, + { "sysTrapTblSetLoadDataProcedure", 0xA1D8 }, + { "sysTrapTblSetSaveDataProcedure", 0xA1D9 }, + { "sysTrapTblGetBounds", 0xA1DA }, + { "sysTrapTblSetRowHeight", 0xA1DB }, + { "sysTrapTblGetColumnWidth", 0xA1DC }, + { "sysTrapTblGetRowID", 0xA1DD }, + { "sysTrapTblSetRowID", 0xA1DE }, + { "sysTrapTblMarkRowInvalid", 0xA1DF }, + { "sysTrapTblMarkTableInvalid", 0xA1E0 }, + { "sysTrapTblGetSelection", 0xA1E1 }, + { "sysTrapTblInsertRow", 0xA1E2 }, + { "sysTrapTblRemoveRow", 0xA1E3 }, + { "sysTrapTblRowInvalid", 0xA1E4 }, + { "sysTrapTblRedrawTable", 0xA1E5 }, + { "sysTrapTblRowUsable", 0xA1E6 }, + { "sysTrapTblReleaseFocus", 0xA1E7 }, + { "sysTrapTblEditing", 0xA1E8 }, + { "sysTrapTblGetCurrentField", 0xA1E9 }, + { "sysTrapTblSetColumnUsable", 0xA1EA }, + { "sysTrapTblGetRowHeight", 0xA1EB }, + { "sysTrapTblSetColumnWidth", 0xA1EC }, + { "sysTrapTblGrabFocus", 0xA1ED }, + { "sysTrapTblSetItemPtr", 0xA1EE }, + { "sysTrapTblFindRowID", 0xA1EF }, + { "sysTrapTblGetLastUsableRow", 0xA1F0 }, + { "sysTrapTblGetColumnSpacing", 0xA1F1 }, + { "sysTrapTblFindRowData", 0xA1F2 }, + { "sysTrapTblGetRowData", 0xA1F3 }, + { "sysTrapTblSetRowData", 0xA1F4 }, + { "sysTrapTblSetColumnSpacing", 0xA1F5 }, + { "sysTrapWinCreateWindow", 0xA1F6 }, + { "sysTrapWinCreateOffscreenWindow", 0xA1F7 }, + { "sysTrapWinDeleteWindow", 0xA1F8 }, + { "sysTrapWinInitializeWindow", 0xA1F9 }, + { "sysTrapWinAddWindow", 0xA1FA }, + { "sysTrapWinRemoveWindow", 0xA1FB }, + { "sysTrapWinSetActiveWindow", 0xA1FC }, + { "sysTrapWinSetDrawWindow", 0xA1FD }, + { "sysTrapWinGetDrawWindow", 0xA1FE }, + { "sysTrapWinGetActiveWindow", 0xA1FF }, + { "sysTrapWinGetDisplayWindow", 0xA200 }, + { "sysTrapWinGetFirstWindow", 0xA201 }, + { "sysTrapWinEnableWindow", 0xA202 }, + { "sysTrapWinDisableWindow", 0xA203 }, + { "sysTrapWinGetWindowFrameRect", 0xA204 }, + { "sysTrapWinDrawWindowFrame", 0xA205 }, + { "sysTrapWinEraseWindow", 0xA206 }, + { "sysTrapWinSaveBits", 0xA207 }, + { "sysTrapWinRestoreBits", 0xA208 }, + { "sysTrapWinCopyRectangle", 0xA209 }, + { "sysTrapWinScrollRectangle", 0xA20A }, + { "sysTrapWinGetDisplayExtent", 0xA20B }, + { "sysTrapWinGetWindowExtent", 0xA20C }, + { "sysTrapWinDisplayToWindowPt", 0xA20D }, + { "sysTrapWinWindowToDisplayPt", 0xA20E }, + { "sysTrapWinGetClip", 0xA20F }, + { "sysTrapWinSetClip", 0xA210 }, + { "sysTrapWinResetClip", 0xA211 }, + { "sysTrapWinClipRectangle", 0xA212 }, + { "sysTrapWinDrawLine", 0xA213 }, + { "sysTrapWinDrawGrayLine", 0xA214 }, + { "sysTrapWinEraseLine", 0xA215 }, + { "sysTrapWinInvertLine", 0xA216 }, + { "sysTrapWinFillLine", 0xA217 }, + { "sysTrapWinDrawRectangle", 0xA218 }, + { "sysTrapWinEraseRectangle", 0xA219 }, + { "sysTrapWinInvertRectangle", 0xA21A }, + { "sysTrapWinDrawRectangleFrame", 0xA21B }, + { "sysTrapWinDrawGrayRectangleFrame", 0xA21C }, + { "sysTrapWinEraseRectangleFrame", 0xA21D }, + { "sysTrapWinInvertRectangleFrame", 0xA21E }, + { "sysTrapWinGetFramesRectangle", 0xA21F }, + { "sysTrapWinDrawChars", 0xA220 }, + { "sysTrapWinEraseChars", 0xA221 }, + { "sysTrapWinInvertChars", 0xA222 }, + { "sysTrapWinGetPattern", 0xA223 }, + { "sysTrapWinSetPattern", 0xA224 }, + { "sysTrapWinSetUnderlineMode", 0xA225 }, + { "sysTrapWinDrawBitmap", 0xA226 }, + { "sysTrapWinModal", 0xA227 }, + { "sysTrapWinGetDrawWindowBounds", 0xA228 }, + { "sysTrapWinFillRectangle", 0xA229 }, + { "sysTrapWinDrawInvertedChars", 0xA22A }, + { "sysTrapPrefOpenPreferenceDBV10", 0xA22B }, + { "sysTrapPrefGetPreferences", 0xA22C }, + { "sysTrapPrefSetPreferences", 0xA22D }, + { "sysTrapPrefGetAppPreferencesV10", 0xA22E }, + { "sysTrapPrefSetAppPreferencesV10", 0xA22F }, + { "sysTrapSndInit", 0xA230 }, + { "sysTrapSndSetDefaultVolume", 0xA231 }, + { "sysTrapSndGetDefaultVolume", 0xA232 }, + { "sysTrapSndDoCmd", 0xA233 }, + { "sysTrapSndPlaySystemSound", 0xA234 }, + { "sysTrapAlmInit", 0xA235 }, + { "sysTrapAlmCancelAll", 0xA236 }, + { "sysTrapAlmAlarmCallback", 0xA237 }, + { "sysTrapAlmSetAlarm", 0xA238 }, + { "sysTrapAlmGetAlarm", 0xA239 }, + { "sysTrapAlmDisplayAlarm", 0xA23A }, + { "sysTrapAlmEnableNotification", 0xA23B }, + { "sysTrapHwrGetRAMMapping", 0xA23C }, + { "sysTrapHwrMemWritable", 0xA23D }, + { "sysTrapHwrMemReadable", 0xA23E }, + { "sysTrapHwrDoze", 0xA23F }, + { "sysTrapHwrSleep", 0xA240 }, + { "sysTrapHwrWake", 0xA241 }, + { "sysTrapHwrSetSystemClock", 0xA242 }, + { "sysTrapHwrSetCPUDutyCycle", 0xA243 }, + { "sysTrapHwrDisplayInit", 0xA244 }, + { "sysTrapHwrDisplaySleep", 0xA245 }, + { "sysTrapHwrTimerInit", 0xA246 }, + { "sysTrapHwrCursorV33", 0xA247 }, + { "sysTrapHwrBatteryLevel", 0xA248 }, + { "sysTrapHwrDelay", 0xA249 }, + { "sysTrapHwrEnableDataWrites", 0xA24A }, + { "sysTrapHwrDisableDataWrites", 0xA24B }, + { "sysTrapHwrLCDBaseAddrV33", 0xA24C }, + { "sysTrapHwrDisplayDrawBootScreen", 0xA24D }, + { "sysTrapHwrTimerSleep", 0xA24E }, + { "sysTrapHwrTimerWake", 0xA24F }, + { "sysTrapHwrDisplayWake", 0xA250 }, + { "sysTrapHwrIRQ1Handler", 0xA251 }, + { "sysTrapHwrIRQ2Handler", 0xA252 }, + { "sysTrapHwrIRQ3Handler", 0xA253 }, + { "sysTrapHwrIRQ4Handler", 0xA254 }, + { "sysTrapHwrIRQ5Handler", 0xA255 }, + { "sysTrapHwrIRQ6Handler", 0xA256 }, + { "sysTrapHwrDockSignals", 0xA257 }, + { "sysTrapHwrPluggedIn", 0xA258 }, + { "sysTrapCrc16CalcBlock", 0xA259 }, + { "sysTrapSelectDayV10", 0xA25A }, + { "sysTrapSelectTimeV33", 0xA25B }, + { "sysTrapDayDrawDaySelector", 0xA25C }, + { "sysTrapDayHandleEvent", 0xA25D }, + { "sysTrapDayDrawDays", 0xA25E }, + { "sysTrapDayOfWeek", 0xA25F }, + { "sysTrapDaysInMonth", 0xA260 }, + { "sysTrapDayOfMonth", 0xA261 }, + { "sysTrapDateDaysToDate", 0xA262 }, + { "sysTrapDateToDays", 0xA263 }, + { "sysTrapDateAdjust", 0xA264 }, + { "sysTrapDateSecondsToDate", 0xA265 }, + { "sysTrapDateToAscii", 0xA266 }, + { "sysTrapDateToDOWDMFormat", 0xA267 }, + { "sysTrapTimeToAscii", 0xA268 }, + { "sysTrapFind", 0xA269 }, + { "sysTrapFindStrInStr", 0xA26A }, + { "sysTrapFindSaveMatch", 0xA26B }, + { "sysTrapFindGetLineBounds", 0xA26C }, + { "sysTrapFindDrawHeader", 0xA26D }, + { "sysTrapPenOpen", 0xA26E }, + { "sysTrapPenClose", 0xA26F }, + { "sysTrapPenGetRawPen", 0xA270 }, + { "sysTrapPenCalibrate", 0xA271 }, + { "sysTrapPenRawToScreen", 0xA272 }, + { "sysTrapPenScreenToRaw", 0xA273 }, + { "sysTrapPenResetCalibration", 0xA274 }, + { "sysTrapPenSleep", 0xA275 }, + { "sysTrapPenWake", 0xA276 }, + { "sysTrapResLoadForm", 0xA277 }, + { "sysTrapResLoadMenu", 0xA278 }, + { "sysTrapFtrInit", 0xA279 }, + { "sysTrapFtrUnregister", 0xA27A }, + { "sysTrapFtrGet", 0xA27B }, + { "sysTrapFtrSet", 0xA27C }, + { "sysTrapFtrGetByIndex", 0xA27D }, + { "sysTrapGrfInit", 0xA27E }, + { "sysTrapGrfFree", 0xA27F }, + { "sysTrapGrfGetState", 0xA280 }, + { "sysTrapGrfSetState", 0xA281 }, + { "sysTrapGrfFlushPoints", 0xA282 }, + { "sysTrapGrfAddPoint", 0xA283 }, + { "sysTrapGrfInitState", 0xA284 }, + { "sysTrapGrfCleanState", 0xA285 }, + { "sysTrapGrfMatch", 0xA286 }, + { "sysTrapGrfGetMacro", 0xA287 }, + { "sysTrapGrfFilterPoints", 0xA288 }, + { "sysTrapGrfGetNumPoints", 0xA289 }, + { "sysTrapGrfGetPoint", 0xA28A }, + { "sysTrapGrfFindBranch", 0xA28B }, + { "sysTrapGrfMatchGlyph", 0xA28C }, + { "sysTrapGrfGetGlyphMapping", 0xA28D }, + { "sysTrapGrfGetMacroName", 0xA28E }, + { "sysTrapGrfDeleteMacro", 0xA28F }, + { "sysTrapGrfAddMacro", 0xA290 }, + { "sysTrapGrfGetAndExpandMacro", 0xA291 }, + { "sysTrapGrfProcessStroke", 0xA292 }, + { "sysTrapGrfFieldChange", 0xA293 }, + { "sysTrapGetCharSortValue", 0xA294 }, + { "sysTrapGetCharAttr", 0xA295 }, + { "sysTrapGetCharCaselessValue", 0xA296 }, + { "sysTrapPwdExists", 0xA297 }, + { "sysTrapPwdVerify", 0xA298 }, + { "sysTrapPwdSet", 0xA299 }, + { "sysTrapPwdRemove", 0xA29A }, + { "sysTrapGsiInitialize", 0xA29B }, + { "sysTrapGsiSetLocation", 0xA29C }, + { "sysTrapGsiEnable", 0xA29D }, + { "sysTrapGsiEnabled", 0xA29E }, + { "sysTrapGsiSetShiftState", 0xA29F }, + { "sysTrapKeyInit", 0xA2A0 }, + { "sysTrapKeyHandleInterrupt", 0xA2A1 }, + { "sysTrapKeyCurrentState", 0xA2A2 }, + { "sysTrapKeyResetDoubleTap", 0xA2A3 }, + { "sysTrapKeyRates", 0xA2A4 }, + { "sysTrapKeySleep", 0xA2A5 }, + { "sysTrapKeyWake", 0xA2A6 }, + { "sysTrapDlkControl", 0xA2A7 }, + { "sysTrapDlkStartServer", 0xA2A8 }, + { "sysTrapDlkGetSyncInfo", 0xA2A9 }, + { "sysTrapDlkSetLogEntry", 0xA2AA }, + { "sysTrapIntlDispatch", 0xA2AB }, + { "sysTrapSysLibLoad", 0xA2AC }, + { "sysTrapSndPlaySmf", 0xA2AD }, + { "sysTrapSndCreateMidiList", 0xA2AE }, + { "sysTrapAbtShowAbout", 0xA2AF }, + { "sysTrapMdmDial", 0xA2B0 }, + { "sysTrapMdmHangUp", 0xA2B1 }, + { "sysTrapDmSearchRecord", 0xA2B2 }, + { "sysTrapSysInsertionSort", 0xA2B3 }, + { "sysTrapDmInsertionSort", 0xA2B4 }, + { "sysTrapLstSetTopItem", 0xA2B5 }, + { "sysTrapSclSetScrollBar", 0xA2B6 }, + { "sysTrapSclDrawScrollBar", 0xA2B7 }, + { "sysTrapSclHandleEvent", 0xA2B8 }, + { "sysTrapSysMailboxCreate", 0xA2B9 }, + { "sysTrapSysMailboxDelete", 0xA2BA }, + { "sysTrapSysMailboxFlush", 0xA2BB }, + { "sysTrapSysMailboxSend", 0xA2BC }, + { "sysTrapSysMailboxWait", 0xA2BD }, + { "sysTrapSysTaskWait", 0xA2BE }, + { "sysTrapSysTaskWake", 0xA2BF }, + { "sysTrapSysTaskWaitClr", 0xA2C0 }, + { "sysTrapSysTaskSuspend", 0xA2C1 }, + { "sysTrapSysTaskResume", 0xA2C2 }, + { "sysTrapCategoryCreateList", 0xA2C3 }, + { "sysTrapCategoryFreeList", 0xA2C4 }, + { "sysTrapCategoryEditV20", 0xA2C5 }, + { "sysTrapCategorySelect", 0xA2C6 }, + { "sysTrapDmDeleteCategory", 0xA2C7 }, + { "sysTrapSysEvGroupCreate", 0xA2C8 }, + { "sysTrapSysEvGroupSignal", 0xA2C9 }, + { "sysTrapSysEvGroupRead", 0xA2CA }, + { "sysTrapSysEvGroupWait", 0xA2CB }, + { "sysTrapEvtEventAvail", 0xA2CC }, + { "sysTrapEvtSysEventAvail", 0xA2CD }, + { "sysTrapStrNCopy", 0xA2CE }, + { "sysTrapKeySetMask", 0xA2CF }, + { "sysTrapSelectDay", 0xA2D0 }, + { "sysTrapPrefGetPreference", 0xA2D1 }, + { "sysTrapPrefSetPreference", 0xA2D2 }, + { "sysTrapPrefGetAppPreferences", 0xA2D3 }, + { "sysTrapPrefSetAppPreferences", 0xA2D4 }, + { "sysTrapFrmPointInTitle", 0xA2D5 }, + { "sysTrapStrNCat", 0xA2D6 }, + { "sysTrapMemCmp", 0xA2D7 }, + { "sysTrapTblSetColumnEditIndicator", 0xA2D8 }, + { "sysTrapFntWordWrap", 0xA2D9 }, + { "sysTrapFldGetScrollValues", 0xA2DA }, + { "sysTrapSysCreateDataBaseList", 0xA2DB }, + { "sysTrapSysCreatePanelList", 0xA2DC }, + { "sysTrapDlkDispatchRequest", 0xA2DD }, + { "sysTrapStrPrintF", 0xA2DE }, + { "sysTrapStrVPrintF", 0xA2DF }, + { "sysTrapPrefOpenPreferenceDB", 0xA2E0 }, + { "sysTrapSysGraffitiReferenceDialog", 0xA2E1 }, + { "sysTrapSysKeyboardDialog", 0xA2E2 }, + { "sysTrapFntWordWrapReverseNLines", 0xA2E3 }, + { "sysTrapFntGetScrollValues", 0xA2E4 }, + { "sysTrapTblSetRowStaticHeight", 0xA2E5 }, + { "sysTrapTblHasScrollBar", 0xA2E6 }, + { "sysTrapSclGetScrollBar", 0xA2E7 }, + { "sysTrapFldGetNumberOfBlankLines", 0xA2E8 }, + { "sysTrapSysTicksPerSecond", 0xA2E9 }, + { "sysTrapHwrBacklightV33", 0xA2EA }, + { "sysTrapDmDatabaseProtect", 0xA2EB }, + { "sysTrapTblSetBounds", 0xA2EC }, + { "sysTrapStrNCompare", 0xA2ED }, + { "sysTrapStrNCaselessCompare", 0xA2EE }, + { "sysTrapPhoneNumberLookup", 0xA2EF }, + { "sysTrapFrmSetMenu", 0xA2F0 }, + { "sysTrapEncDigestMD5", 0xA2F1 }, + { "sysTrapDmFindSortPosition", 0xA2F2 }, + { "sysTrapSysBinarySearch", 0xA2F3 }, + { "sysTrapSysErrString", 0xA2F4 }, + { "sysTrapSysStringByIndex", 0xA2F5 }, + { "sysTrapEvtAddUniqueEventToQueue", 0xA2F6 }, + { "sysTrapStrLocalizeNumber", 0xA2F7 }, + { "sysTrapStrDelocalizeNumber", 0xA2F8 }, + { "sysTrapLocGetNumberSeparators", 0xA2F9 }, + { "sysTrapMenuSetActiveMenuRscID", 0xA2FA }, + { "sysTrapLstScrollList", 0xA2FB }, + { "sysTrapCategoryInitialize", 0xA2FC }, + { "sysTrapEncDigestMD4", 0xA2FD }, + { "sysTrapEncDES", 0xA2FE }, + { "sysTrapLstGetVisibleItems", 0xA2FF }, + { "sysTrapWinSetBounds", 0xA300 }, + { "sysTrapCategorySetName", 0xA301 }, + { "sysTrapFldSetInsertionPoint", 0xA302 }, + { "sysTrapFrmSetObjectBounds", 0xA303 }, + { "sysTrapWinSetColors", 0xA304 }, + { "sysTrapFlpDispatch", 0xA305 }, + { "sysTrapFlpEmDispatch", 0xA306 }, + { "sysTrapExgInit", 0xA307 }, + { "sysTrapExgConnect", 0xA308 }, + { "sysTrapExgPut", 0xA309 }, + { "sysTrapExgGet", 0xA30A }, + { "sysTrapExgAccept", 0xA30B }, + { "sysTrapExgDisconnect", 0xA30C }, + { "sysTrapExgSend", 0xA30D }, + { "sysTrapExgReceive", 0xA30E }, + { "sysTrapExgRegisterData", 0xA30F }, + { "sysTrapExgNotifyReceiveV35", 0xA310 }, + { "sysTrapSysReserved30Trap2", 0xA311 }, + { "sysTrapPrgStartDialogV31", 0xA312 }, + { "sysTrapPrgStopDialog", 0xA313 }, + { "sysTrapPrgUpdateDialog", 0xA314 }, + { "sysTrapPrgHandleEvent", 0xA315 }, + { "sysTrapImcReadFieldNoSemicolon", 0xA316 }, + { "sysTrapImcReadFieldQuotablePrintable", 0xA317 }, + { "sysTrapImcReadPropertyParameter", 0xA318 }, + { "sysTrapImcSkipAllPropertyParameters", 0xA319 }, + { "sysTrapImcReadWhiteSpace", 0xA31A }, + { "sysTrapImcWriteQuotedPrintable", 0xA31B }, + { "sysTrapImcWriteNoSemicolon", 0xA31C }, + { "sysTrapImcStringIsAscii", 0xA31D }, + { "sysTrapTblGetItemFont", 0xA31E }, + { "sysTrapTblSetItemFont", 0xA31F }, + { "sysTrapFontSelect", 0xA320 }, + { "sysTrapFntDefineFont", 0xA321 }, + { "sysTrapCategoryEdit", 0xA322 }, + { "sysTrapSysGetOSVersionString", 0xA323 }, + { "sysTrapSysBatteryInfo", 0xA324 }, + { "sysTrapSysUIBusy", 0xA325 }, + { "sysTrapWinValidateHandle", 0xA326 }, + { "sysTrapFrmValidatePtr", 0xA327 }, + { "sysTrapCtlValidatePointer", 0xA328 }, + { "sysTrapWinMoveWindowAddr", 0xA329 }, + { "sysTrapFrmAddSpaceForObject", 0xA32A }, + { "sysTrapFrmNewForm", 0xA32B }, + { "sysTrapCtlNewControl", 0xA32C }, + { "sysTrapFldNewField", 0xA32D }, + { "sysTrapLstNewList", 0xA32E }, + { "sysTrapFrmNewLabel", 0xA32F }, + { "sysTrapFrmNewBitmap", 0xA330 }, + { "sysTrapFrmNewGadget", 0xA331 }, + { "sysTrapFileOpen", 0xA332 }, + { "sysTrapFileClose", 0xA333 }, + { "sysTrapFileDelete", 0xA334 }, + { "sysTrapFileReadLow", 0xA335 }, + { "sysTrapFileWrite", 0xA336 }, + { "sysTrapFileSeek", 0xA337 }, + { "sysTrapFileTell", 0xA338 }, + { "sysTrapFileTruncate", 0xA339 }, + { "sysTrapFileControl", 0xA33A }, + { "sysTrapFrmActiveState", 0xA33B }, + { "sysTrapSysGetAppInfo", 0xA33C }, + { "sysTrapSysGetStackInfo", 0xA33D }, + { "sysTrapWinScreenMode", 0xA33E }, + { "sysTrapHwrLCDGetDepthV33", 0xA33F }, + { "sysTrapHwrGetROMToken", 0xA340 }, + { "sysTrapDbgControl", 0xA341 }, + { "sysTrapExgDBRead", 0xA342 }, + { "sysTrapExgDBWrite", 0xA343 }, + { "sysTrapHostControl", 0xA344 }, + { "sysTrapFrmRemoveObject", 0xA345 }, + { "sysTrapSysReserved30Trap1", 0xA346 }, + { "sysTrapExpansionDispatch", 0xA347 }, + { "sysTrapFileSystemDispatch", 0xA348 }, + { "sysTrapOEMDispatch", 0xA349 }, + { "sysTrapHwrLCDContrastV33", 0xA34A }, + { "sysTrapSysLCDContrast", 0xA34B }, + { "sysTrapUIContrastAdjust", 0xA34C }, + { "sysTrapHwrDockStatus", 0xA34D }, + { "sysTrapFntWidthToOffset", 0xA34E }, + { "sysTrapSelectOneTime", 0xA34F }, + { "sysTrapWinDrawChar", 0xA350 }, + { "sysTrapWinDrawTruncChars", 0xA351 }, + { "sysTrapSysNotifyInit", 0xA352 }, + { "sysTrapSysNotifyRegister", 0xA353 }, + { "sysTrapSysNotifyUnregister", 0xA354 }, + { "sysTrapSysNotifyBroadcast", 0xA355 }, + { "sysTrapSysNotifyBroadcastDeferred", 0xA356 }, + { "sysTrapSysNotifyDatabaseAdded", 0xA357 }, + { "sysTrapSysNotifyDatabaseRemoved", 0xA358 }, + { "sysTrapSysWantEvent", 0xA359 }, + { "sysTrapFtrPtrNew", 0xA35A }, + { "sysTrapFtrPtrFree", 0xA35B }, + { "sysTrapFtrPtrResize", 0xA35C }, + { "sysTrapSysReserved31Trap1", 0xA35D }, + { "sysTrapHwrNVPrefSet", 0xA35E }, + { "sysTrapHwrNVPrefGet", 0xA35F }, + { "sysTrapFlashInit", 0xA360 }, + { "sysTrapFlashCompress", 0xA361 }, + { "sysTrapFlashErase", 0xA362 }, + { "sysTrapFlashProgram", 0xA363 }, + { "sysTrapAlmTimeChange", 0xA364 }, + { "sysTrapErrAlertCustom", 0xA365 }, + { "sysTrapPrgStartDialog", 0xA366 }, + { "sysTrapSerialDispatch", 0xA367 }, + { "sysTrapHwrBattery", 0xA368 }, + { "sysTrapDmGetDatabaseLockState", 0xA369 }, + { "sysTrapCncGetProfileList", 0xA36A }, + { "sysTrapCncGetProfileInfo", 0xA36B }, + { "sysTrapCncAddProfile", 0xA36C }, + { "sysTrapCncDeleteProfile", 0xA36D }, + { "sysTrapSndPlaySmfResource", 0xA36E }, + { "sysTrapMemPtrDataStorage", 0xA36F }, + { "sysTrapClipboardAppendItem", 0xA370 }, + { "sysTrapWiCmdV32", 0xA371 }, + { "sysTrapHwrDisplayAttributes", 0xA372 }, + { "sysTrapHwrDisplayDoze", 0xA373 }, + { "sysTrapHwrDisplayPalette", 0xA374 }, + { "sysTrapBltFindIndexes", 0xA375 }, + { "sysTrapBmpGetBits", 0xA376 }, + { "sysTrapBltCopyRectangle", 0xA377 }, + { "sysTrapBltDrawChars", 0xA378 }, + { "sysTrapBltLineRoutine", 0xA379 }, + { "sysTrapBltRectangleRoutine", 0xA37A }, + { "sysTrapScrCompress", 0xA37B }, + { "sysTrapScrDecompress", 0xA37C }, + { "sysTrapSysLCDBrightness", 0xA37D }, + { "sysTrapWinPaintChar", 0xA37E }, + { "sysTrapWinPaintChars", 0xA37F }, + { "sysTrapWinPaintBitmap", 0xA380 }, + { "sysTrapWinGetPixel", 0xA381 }, + { "sysTrapWinPaintPixel", 0xA382 }, + { "sysTrapWinDrawPixel", 0xA383 }, + { "sysTrapWinErasePixel", 0xA384 }, + { "sysTrapWinInvertPixel", 0xA385 }, + { "sysTrapWinPaintPixels", 0xA386 }, + { "sysTrapWinPaintLines", 0xA387 }, + { "sysTrapWinPaintLine", 0xA388 }, + { "sysTrapWinPaintRectangle", 0xA389 }, + { "sysTrapWinPaintRectangleFrame", 0xA38A }, + { "sysTrapWinPaintPolygon", 0xA38B }, + { "sysTrapWinDrawPolygon", 0xA38C }, + { "sysTrapWinErasePolygon", 0xA38D }, + { "sysTrapWinInvertPolygon", 0xA38E }, + { "sysTrapWinFillPolygon", 0xA38F }, + { "sysTrapWinPaintArc", 0xA390 }, + { "sysTrapWinDrawArc", 0xA391 }, + { "sysTrapWinEraseArc", 0xA392 }, + { "sysTrapWinInvertArc", 0xA393 }, + { "sysTrapWinFillArc", 0xA394 }, + { "sysTrapWinPushDrawState", 0xA395 }, + { "sysTrapWinPopDrawState", 0xA396 }, + { "sysTrapWinSetDrawMode", 0xA397 }, + { "sysTrapWinSetForeColor", 0xA398 }, + { "sysTrapWinSetBackColor", 0xA399 }, + { "sysTrapWinSetTextColor", 0xA39A }, + { "sysTrapWinGetPatternType", 0xA39B }, + { "sysTrapWinSetPatternType", 0xA39C }, + { "sysTrapWinPalette", 0xA39D }, + { "sysTrapWinRGBToIndex", 0xA39E }, + { "sysTrapWinIndexToRGB", 0xA39F }, + { "sysTrapWinScreenLock", 0xA3A0 }, + { "sysTrapWinScreenUnlock", 0xA3A1 }, + { "sysTrapWinGetBitmap", 0xA3A2 }, + { "sysTrapUIColorInit", 0xA3A3 }, + { "sysTrapUIColorGetTableEntryIndex", 0xA3A4 }, + { "sysTrapUIColorGetTableEntryRGB", 0xA3A5 }, + { "sysTrapUIColorSetTableEntry", 0xA3A6 }, + { "sysTrapUIColorPushTable", 0xA3A7 }, + { "sysTrapUIColorPopTable", 0xA3A8 }, + { "sysTrapCtlNewGraphicControl", 0xA3A9 }, + { "sysTrapTblGetItemPtr", 0xA3AA }, + { "sysTrapUIBrightnessAdjust", 0xA3AB }, + { "sysTrapUIPickColor", 0xA3AC }, + { "sysTrapEvtSetAutoOffTimer", 0xA3AD }, + { "sysTrapTsmDispatch", 0xA3AE }, + { "sysTrapOmDispatch", 0xA3AF }, + { "sysTrapDmOpenDBNoOverlay", 0xA3B0 }, + { "sysTrapDmOpenDBWithLocale", 0xA3B1 }, + { "sysTrapResLoadConstant", 0xA3B2 }, + { "sysTrapHwrPreDebugInit", 0xA3B3 }, + { "sysTrapHwrResetNMI", 0xA3B4 }, + { "sysTrapHwrResetPWM", 0xA3B5 }, + { "sysTrapKeyBootKeys", 0xA3B6 }, + { "sysTrapDbgSerDrvOpen", 0xA3B7 }, + { "sysTrapDbgSerDrvClose", 0xA3B8 }, + { "sysTrapDbgSerDrvControl", 0xA3B9 }, + { "sysTrapDbgSerDrvStatus", 0xA3BA }, + { "sysTrapDbgSerDrvWriteChar", 0xA3BB }, + { "sysTrapDbgSerDrvReadChar", 0xA3BC }, + { "sysTrapHwrPostDebugInit", 0xA3BD }, + { "sysTrapHwrIdentifyFeatures", 0xA3BE }, + { "sysTrapHwrModelSpecificInit", 0xA3BF }, + { "sysTrapHwrModelInitStage2", 0xA3C0 }, + { "sysTrapHwrInterruptsInit", 0xA3C1 }, + { "sysTrapHwrSoundOn", 0xA3C2 }, + { "sysTrapHwrSoundOff", 0xA3C3 }, + { "sysTrapSysKernelClockTick", 0xA3C4 }, + { "sysTrapMenuEraseMenu", 0xA3C5 }, + { "sysTrapSelectTime", 0xA3C6 }, + { "sysTrapMenuCmdBarAddButton", 0xA3C7 }, + { "sysTrapMenuCmdBarGetButtonData", 0xA3C8 }, + { "sysTrapMenuCmdBarDisplay", 0xA3C9 }, + { "sysTrapHwrGetSilkscreenID", 0xA3CA }, + { "sysTrapEvtGetSilkscreenAreaList", 0xA3CB }, + { "sysTrapSysFatalAlertInit", 0xA3CC }, + { "sysTrapDateTemplateToAscii", 0xA3CD }, + { "sysTrapSecVerifyPW", 0xA3CE }, + { "sysTrapSecSelectViewStatus", 0xA3CF }, + { "sysTrapTblSetColumnMasked", 0xA3D0 }, + { "sysTrapTblSetRowMasked", 0xA3D1 }, + { "sysTrapTblRowMasked", 0xA3D2 }, + { "sysTrapFrmCustomResponseAlert", 0xA3D3 }, + { "sysTrapFrmNewGsi", 0xA3D4 }, + { "sysTrapMenuShowItem", 0xA3D5 }, + { "sysTrapMenuHideItem", 0xA3D6 }, + { "sysTrapMenuAddItem", 0xA3D7 }, + { "sysTrapFrmSetGadgetHandler", 0xA3D8 }, + { "sysTrapCtlSetGraphics", 0xA3D9 }, + { "sysTrapCtlGetSliderValues", 0xA3DA }, + { "sysTrapCtlSetSliderValues", 0xA3DB }, + { "sysTrapCtlNewSliderControl", 0xA3DC }, + { "sysTrapBmpCreate", 0xA3DD }, + { "sysTrapBmpDelete", 0xA3DE }, + { "sysTrapBmpCompress", 0xA3DF }, + { "sysTrapBmpGetColortable", 0xA3E0 }, + { "sysTrapBmpSize", 0xA3E1 }, + { "sysTrapBmpBitsSize", 0xA3E2 }, + { "sysTrapBmpColortableSize", 0xA3E3 }, + { "sysTrapWinCreateBitmapWindow", 0xA3E4 }, + { "sysTrapEvtSetNullEventTick", 0xA3E5 }, + { "sysTrapExgDoDialog", 0xA3E6 }, + { "sysTrapSysUICleanup", 0xA3E7 }, + { "sysTrapWinSetForeColorRGB", 0xA3E8 }, + { "sysTrapWinSetBackColorRGB", 0xA3E9 }, + { "sysTrapWinSetTextColorRGB", 0xA3EA }, + { "sysTrapWinGetPixelRGB", 0xA3EB }, + { "sysTrapHighDensityDispatch", 0xA3EC }, + { "sysTrapSysReserved40Trap2", 0xA3ED }, + { "sysTrapSysReserved40Trap3", 0xA3EE }, + { "sysTrapSysReserved40Trap4", 0xA3EF }, + { "sysTrapCncMgrDispatch", 0xA3F0 }, + { "sysTrapSysNotifyBroadcastFromInterrupt", 0xA3F1 }, + { "sysTrapEvtWakeupWithoutNilEvent", 0xA3F2 }, + { "sysTrapStrCompareAscii", 0xA3F3 }, + { "sysTrapAccessorDispatch", 0xA3F4 }, + { "sysTrapBltGetPixel", 0xA3F5 }, + { "sysTrapBltPaintPixel", 0xA3F6 }, + { "sysTrapScrScreenInit", 0xA3F7 }, + { "sysTrapScrUpdateScreenBitmap", 0xA3F8 }, + { "sysTrapScrPalette", 0xA3F9 }, + { "sysTrapScrGetColortable", 0xA3FA }, + { "sysTrapScrGetGrayPat", 0xA3FB }, + { "sysTrapScrScreenLock", 0xA3FC }, + { "sysTrapScrScreenUnlock", 0xA3FD }, + { "sysTrapFntPrvGetFontList", 0xA3FE }, + { "sysTrapExgRegisterDatatype", 0xA3FF }, + { "sysTrapExgNotifyReceive", 0xA400 }, + { "sysTrapExgNotifyGoto", 0xA401 }, + { "sysTrapExgRequest", 0xA402 }, + { "sysTrapExgSetDefaultApplication", 0xA403 }, + { "sysTrapExgGetDefaultApplication", 0xA404 }, + { "sysTrapExgGetTargetApplication", 0xA405 }, + { "sysTrapExgGetRegisteredApplications", 0xA406 }, + { "sysTrapExgGetRegisteredTypes", 0xA407 }, + { "sysTrapExgNotifyPreview", 0xA408 }, + { "sysTrapExgControl", 0xA409 }, + { "sysTrapLmDispatch", 0xA40A }, + { "sysTrapMemGetRomNVParams", 0xA40B }, + { "sysTrapFntWCharWidth", 0xA40C }, + { "sysTrapDmFindDatabaseWithTypeCreator", 0xA40D }, + { "sysTrapSelectTimeZone", 0xA40E }, + { "sysTrapTimeZoneToAscii", 0xA40F }, + { "sysTrapStrNCompareAscii", 0xA410 }, + { "sysTrapTimTimeZoneToUTC", 0xA411 }, + { "sysTrapTimUTCToTimeZone", 0xA412 }, + { "sysTrapPhoneNumberLookupCustom", 0xA413 }, + { "sysTrapHwrDebugSelect", 0xA414 }, + { "sysTrapBltRoundedRectangle", 0xA415 }, + { "sysTrapBltRoundedRectangleFill", 0xA416 }, + { "sysTrapWinPrvInitCanvas", 0xA417 }, + { "sysTrapHwrCalcDynamicHeapSize", 0xA418 }, + { "sysTrapHwrDebuggerEnter", 0xA419 }, + { "sysTrapHwrDebuggerExit", 0xA41A }, + { "sysTrapLstGetTopItem", 0xA41B }, + { "sysTrapHwrModelInitStage3", 0xA41C }, + { "sysTrapAttnIndicatorAllow", 0xA41D }, + { "sysTrapAttnIndicatorAllowed", 0xA41E }, + { "sysTrapAttnIndicatorEnable", 0xA41F }, + { "sysTrapAttnIndicatorEnabled", 0xA420 }, + { "sysTrapAttnIndicatorSetBlinkPattern", 0xA421 }, + { "sysTrapAttnIndicatorGetBlinkPattern", 0xA422 }, + { "sysTrapAttnIndicatorTicksTillNextBlink", 0xA423 }, + { "sysTrapAttnIndicatorCheckBlink", 0xA424 }, + { "sysTrapAttnInitialize", 0xA425 }, + { "sysTrapAttnGetAttention", 0xA426 }, + { "sysTrapAttnUpdate", 0xA427 }, + { "sysTrapAttnForgetIt", 0xA428 }, + { "sysTrapAttnGetCounts", 0xA429 }, + { "sysTrapAttnListOpen", 0xA42A }, + { "sysTrapAttnHandleEvent", 0xA42B }, + { "sysTrapAttnEffectOfEvent", 0xA42C }, + { "sysTrapAttnIterate", 0xA42D }, + { "sysTrapAttnDoSpecialEffects", 0xA42E }, + { "sysTrapAttnDoEmergencySpecialEffects", 0xA42F }, + { "sysTrapAttnAllowClose", 0xA430 }, + { "sysTrapAttnReopen", 0xA431 }, + { "sysTrapAttnEnableNotification", 0xA432 }, + { "sysTrapHwrLEDAttributes", 0xA433 }, + { "sysTrapHwrVibrateAttributes", 0xA434 }, + { "sysTrapSecGetPwdHint", 0xA435 }, + { "sysTrapSecSetPwdHint", 0xA436 }, + { "sysTrapHwrFlashWrite", 0xA437 }, + { "sysTrapKeyboardStatusNew", 0xA438 }, + { "sysTrapKeyboardStatusFree", 0xA439 }, + { "sysTrapKbdSetLayout", 0xA43A }, + { "sysTrapKbdGetLayout", 0xA43B }, + { "sysTrapKbdSetPosition", 0xA43C }, + { "sysTrapKbdGetPosition", 0xA43D }, + { "sysTrapKbdSetShiftState", 0xA43E }, + { "sysTrapKbdGetShiftState", 0xA43F }, + { "sysTrapKbdDraw", 0xA440 }, + { "sysTrapKbdErase", 0xA441 }, + { "sysTrapKbdHandleEvent", 0xA442 }, + { "sysTrapOEMDispatch2", 0xA443 }, + { "sysTrapHwrCustom", 0xA444 }, + { "sysTrapFrmGetActiveField", 0xA445 }, + { "sysTrapSndPlaySmfIrregardless", 0xA446 }, + { "sysTrapSndPlaySmfResourceIrregardless", 0xA447 }, + { "sysTrapSndInterruptSmfIrregardless", 0xA448 }, + { "sysTrapUdaMgrDispatch", 0xA449 }, + { "sysTrapPalmPrivate1", 0xA44A }, + { "sysTrapPalmPrivate2", 0xA44B }, + { "sysTrapPalmPrivate3", 0xA44C }, + { "sysTrapPalmPrivate4", 0xA44D }, + { "sysTrapBmpGetDimensions", 0xA44E }, + { "sysTrapBmpGetBitDepth", 0xA44F }, + { "sysTrapBmpGetNextBitmap", 0xA450 }, + { "sysTrapTblGetNumberOfColumns", 0xA451 }, + { "sysTrapTblGetTopRow", 0xA452 }, + { "sysTrapTblSetSelection", 0xA453 }, + { "sysTrapFrmGetObjectIndexFromPtr", 0xA454 }, + { "sysTrapBmpGetSizes", 0xA455 }, + { "sysTrapWinGetBounds", 0xA456 }, + { "sysTrapBltPaintPixels", 0xA457 }, + { "sysTrapFldSetMaxVisibleLines", 0xA458 }, + { "sysTrapScrDefaultPaletteState", 0xA459 }, + { "sysTrapPceNativeCall", 0xA45A }, + { "sysTrapSndStreamCreate", 0xA45B }, + { "sysTrapSndStreamDelete", 0xA45C }, + { "sysTrapSndStreamStart", 0xA45D }, + { "sysTrapSndStreamPause", 0xA45E }, + { "sysTrapSndStreamStop", 0xA45F }, + { "sysTrapSndStreamSetVolume", 0xA460 }, + { "sysTrapSndStreamGetVolume", 0xA461 }, + { "sysTrapSndPlayResource", 0xA462 }, + { "sysTrapSndStreamSetPan", 0xA463 }, + { "sysTrapSndStreamGetPan", 0xA464 }, + { "sysTrapMultimediaDispatch", 0xA465 }, + { "sysTrapSndStreamCreateExtended", 0xa466 }, + { "sysTrapSndStreamDeviceControl", 0xa467 }, + { "sysTrapBmpCreateVersion3", 0xA468 }, + { "sysTrapECFixedMul", 0xA469 }, + { "sysTrapECFixedDiv", 0xA46A }, + { "sysTrapHALDrawGetSupportedDensity", 0xA46B }, + { "sysTrapHALRedrawInputArea", 0xA46C }, + { "sysTrapGrfBeginStroke", 0xA46D }, + { "sysTrapBmpPrvConvertBitmap", 0xA46E }, + { "sysTrapSysReservedTrap5", 0xA46F }, + { "sysTrapPinsDispatch", 0xA470 }, + { "sysTrapSysReservedTrap1", 0xA471 }, + { "sysTrapSysReservedTrap2", 0xA472 }, + { "sysTrapSysReservedTrap3", 0xA473 }, + { "sysTrapSysReservedTrap4", 0xA474 }, + { "sysTrapLastTrapNumber", 0xA475 } + }; + + int i; + + for (i = 0; i < ARRAY_LENGTH(traps); i++) + { + if (traps[i].trap == opcode) + return traps[i].name; + } + return NULL; +} + +static offs_t palm_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) +{ + UINT16 opcode; + unsigned result = 0; + const char *trap; + + opcode = *((UINT16 *) oprom); + opcode = ((opcode >> 8) & 0x00ff) | ((opcode << 8) & 0xff00); + if (opcode == 0x4E4F) + { + UINT16 callnum = *((UINT16 *) (oprom + 2)); + callnum = ((callnum >> 8) & 0x00ff) | ((callnum << 8) & 0xff00); + trap = lookup_trap(callnum); + result = 2; + if (trap) + { + strcpy(buffer, trap); + } + else + { + sprintf(buffer, "trap #$f"); + } + } + else if ((opcode & 0xF000) == 0xA000) + { + sprintf(buffer, "Call Index: %04x", opcode); + result = 2; + } + return result; +} diff --git a/src/mame/drivers/palmz22.c b/src/mame/drivers/palmz22.c new file mode 100644 index 00000000000..7228d55d288 --- /dev/null +++ b/src/mame/drivers/palmz22.c @@ -0,0 +1,338 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/******************************************************************************* + + Palm Z22 + + (C) 2011 Tim Schuerewegen + +*******************************************************************************/ + +/* + +Hardware ... + +Samsung OCEAN-L-20 (SoC) +Samsung K9F5608U0D-JIB0 (NAND) +Samsung K4S2816321-UL75 (RAM) + +The following reads are harmless ... + +'maincpu' (3060017C): (GPIO) 56000080 -> 00010020 +'maincpu' (30600960): unmapped program memory read from A0000000 & FFFFFFFF +'maincpu' (30600960): unmapped program memory read from A0000020 & FFFFFFFF +'maincpu' (30600960): unmapped program memory read from A0000040 & FFFFFFFF +... +'maincpu' (306411D4): (GPIO) 56000000 -> 005E03FF +'maincpu' (306411E0): (GPIO) 56000004 -> 0041F000 +'maincpu' (30641258): (GPIO) 56000010 -> 00000015 +'maincpu' (30641264): (GPIO) 56000010 -> 00000005 +'maincpu' (306412C4): (GPIO) 56000040 -> 00155400 +'maincpu' (306412D0): (GPIO) 56000040 -> 00155000 +'maincpu' (306412DC): (GPIO) 56000044 -> 00000442 +'maincpu' (306412F0): (GPIO) 56000000 -> 005E03FF +'maincpu' (306412FC): (GPIO) 56000000 -> 001E03FF +'maincpu' (30641308): (GPIO) 56000004 -> 0041F000 +'maincpu' (30641320): (GPIO) 56000010 -> 00000025 +'maincpu' (30641330): (GPIO) 56000010 -> 00000024 + +The following reads are NOT harmless ... + +'maincpu' (3060022C): (GPIO) 56000044 -> 00000400 ... bits 2..1 is tested + +if bits 2..1 = 0 then + 'maincpu' (30600240): (GPIO) 56000040 <- 00154400 + 'maincpu' (3060024C): (GPIO) 56000044 <- 00000000 + 'maincpu' (30600258): (GPIO) 56000048 <- 000007A0 +else + 'maincpu' (30600268): (GPIO) 56000040 <- 00155400 + 'maincpu' (30600274): (GPIO) 56000044 <- 00000440 + 'maincpu' (30600280): (GPIO) 56000048 <- 000007E6 +end + +'maincpu' (3060004C): (GPIO) 56000054 -> 000000FF +'maincpu' (30600060): (GPIO) 56000054 -> 000000FF +'maincpu' (30600074): (GPIO) 56000054 -> 000000FF +'maincpu' (30600088): (GPIO) 56000054 -> 000000FF +'maincpu' (3060009C): (GPIO) 56000054 -> 000000FF +'maincpu' (306000B0): (GPIO) 56000054 -> 000000FF +'maincpu' (306000C4): (GPIO) 56000054 -> 000000FF +'maincpu' (306000D8): (GPIO) 56000054 -> 000000FF ... check if keys are pressed? (8 bits) + +'maincpu' (3064116C): unmapped program memory read from 4D000068 & FFFFFFFF ... should read 0 or else stuck in a loop? + +*/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "machine/s3c2410.h" +#include "machine/smartmed.h" +#include "rendlay.h" + +#define PALM_Z22_BATTERY_LEVEL 75 + +#define VERBOSE_LEVEL ( 0 ) + +class palmz22_state : public driver_device +{ +public: + palmz22_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_s3c2410(*this, "s3c2410") + { } + + required_device m_maincpu; + + required_device m_s3c2410; + nand_device *m_nand; + + UINT32 m_port[8]; + DECLARE_DRIVER_INIT(palmz22); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_INPUT_CHANGED_MEMBER(palmz22_input_changed); + inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); + DECLARE_WRITE8_MEMBER( s3c2410_nand_command_w ); + DECLARE_WRITE8_MEMBER( s3c2410_nand_address_w ); + DECLARE_READ8_MEMBER( s3c2410_nand_data_r ); + DECLARE_WRITE8_MEMBER( s3c2410_nand_data_w ); + DECLARE_READ32_MEMBER(s3c2410_gpio_port_r); + DECLARE_WRITE32_MEMBER(s3c2410_gpio_port_w); + DECLARE_READ32_MEMBER(s3c2410_core_pin_r); + DECLARE_READ32_MEMBER(s3c2410_adc_data_r ); + +}; + + +inline void palmz22_state::verboselog(int n_level, const char *s_fmt, ...) +{ + if (VERBOSE_LEVEL >= n_level) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt); + vsprintf( buf, s_fmt, v); + va_end( v); + logerror( "%s: %s", machine().describe_context(), buf); + } +} + +/*************************************************************************** + MACHINE HARDWARE +***************************************************************************/ + +// NAND + +WRITE8_MEMBER( palmz22_state::s3c2410_nand_command_w ) +{ + verboselog(9, "s3c2410_nand_command_w %02X\n", data); + m_nand->command_w(data); +} + +WRITE8_MEMBER( palmz22_state::s3c2410_nand_address_w ) +{ + verboselog(9, "s3c2410_nand_address_w %02X\n", data); + m_nand->address_w(data); +} + +READ8_MEMBER( palmz22_state::s3c2410_nand_data_r ) +{ + UINT8 data = m_nand->data_r(); + verboselog(9, "s3c2410_nand_data_r %02X\n", data); + return data; +} + +WRITE8_MEMBER( palmz22_state::s3c2410_nand_data_w ) +{ + verboselog(9, "s3c2410_nand_data_w %02X\n", data); + m_nand->data_w(data); +} + +/* +READ8_MEMBER( palmz22_state::s3c2410_nand_busy_r ) +{ + UINT8 data = m_nand->is_busy(); + verboselog(9, "s3c2410_nand_busy_r %02X\n", data); + return data; +} +*/ + +// GPIO + +READ32_MEMBER(palmz22_state::s3c2410_gpio_port_r) +{ + UINT32 data = m_port[offset]; + switch (offset) + { + case S3C2410_GPIO_PORT_E : + { + data = (data & ~(3 << 1)) | (0 << 1); // bits 2..1 = LCD related? (0 = clear 4D000010 bit 3, 1 = clear 560000000 bit 22) + //data = 0x1F4; + } + break; + case S3C2410_GPIO_PORT_F : + { + data = (data & ~0xFF) | (ioport( "PORT-F")->read() & 0xFF); + } + break; + case S3C2410_GPIO_PORT_G : + { + data = (data & ~(1 << 1)) | (0 << 1); // bit 1 | 'maincpu' (200B56C0): (GPIO) 56000064 -> 00000000 + data = (data & ~(1 << 2)) | (0 << 2); // bit 2 | 'maincpu' (200B3EC4): (GPIO) 56000064 -> 00000000 + } + break; + } + return data; +} + +WRITE32_MEMBER(palmz22_state::s3c2410_gpio_port_w) +{ + m_port[offset] = data; +} + +// CORE + +/* + +OM[1:0] = 00b : Enable NAND flash controller auto boot mode + +NAND flash memory page size should be 512Bytes. + +NCON : NAND flash memory address step selection +0 : 3 Step addressing +1 : 4 Step addressing + +*/ + +READ32_MEMBER(palmz22_state::s3c2410_core_pin_r) +{ + int data = 0; + switch (offset) + { + case S3C2410_CORE_PIN_NCON : data = 0; break; + case S3C2410_CORE_PIN_OM0 : data = 0; break; + case S3C2410_CORE_PIN_OM1 : data = 0; break; + } + return data; +} + +// ADC + +READ32_MEMBER(palmz22_state::s3c2410_adc_data_r ) +{ + UINT32 data = 0; + switch (offset) + { + case 0 + 0 : data = 0x2EE + (PALM_Z22_BATTERY_LEVEL * 0xFF / 100); break; + case 0 + 1 : data = 0; break; + case 2 + 0 : data = ioport( "PENX")->read(); break; + case 2 + 1 : data = 0x3FF - ioport( "PENY")->read(); break; + } + verboselog(5, "s3c2410_adc_data_r %08X\n", data); + return data; +} + +// INPUT + +INPUT_CHANGED_MEMBER(palmz22_state::palmz22_input_changed) +{ + if (param == 0) + { + m_s3c2410->s3c2410_touch_screen( (newval & 0x01) ? 1 : 0); + } + else + { + m_s3c2410->s3c2410_request_eint( (FPTR)param - 1); + } +} + +// MACHINE + +void palmz22_state::machine_start() +{ + m_nand = machine().device("nand"); + m_nand->set_data_ptr( memregion("nand")->base()); +} + +void palmz22_state::machine_reset() +{ + m_maincpu->reset(); + memset( m_port, 0, sizeof( m_port)); +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( palmz22_map, AS_PROGRAM, 32, palmz22_state ) + AM_RANGE(0x30000000, 0x31ffffff) AM_RAM +ADDRESS_MAP_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +DRIVER_INIT_MEMBER(palmz22_state,palmz22) +{ +} + +static MACHINE_CONFIG_START( palmz22, palmz22_state ) + MCFG_CPU_ADD("maincpu", ARM920T, 266000000) + MCFG_CPU_PROGRAM_MAP(palmz22_map) + + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(160, 160) + MCFG_SCREEN_VISIBLE_AREA(0, 160 - 1, 0, 160 - 1) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_SCREEN_UPDATE_DEVICE("s3c2410", s3c2410_device, screen_update) + + MCFG_DEVICE_ADD("s3c2410", S3C2410, 12000000) + MCFG_S3C2410_PALETTE("palette") + MCFG_S3C2410_CORE_PIN_R_CB(READ32(palmz22_state, s3c2410_core_pin_r)) + MCFG_S3C2410_GPIO_PORT_R_CB(READ32(palmz22_state, s3c2410_gpio_port_r)) + MCFG_S3C2410_GPIO_PORT_W_CB(WRITE32(palmz22_state, s3c2410_gpio_port_w)) + MCFG_S3C2410_ADC_DATA_R_CB(READ32(palmz22_state, s3c2410_adc_data_r)) + MCFG_S3C2410_NAND_COMMAND_W_CB(WRITE8(palmz22_state, s3c2410_nand_command_w)) + MCFG_S3C2410_NAND_ADDRESS_W_CB(WRITE8(palmz22_state, s3c2410_nand_address_w)) + MCFG_S3C2410_NAND_DATA_R_CB(READ8(palmz22_state, s3c2410_nand_data_r)) + MCFG_S3C2410_NAND_DATA_W_CB(WRITE8(palmz22_state, s3c2410_nand_data_w)) + + MCFG_DEVICE_ADD("nand", NAND, 0) + MCFG_NAND_TYPE(NAND_CHIP_K9F5608U0D_J) + MCFG_NAND_RNB_CALLBACK(DEVWRITELINE("s3c2410", s3c2410_device, frnb_w)) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( palmz22 ) + PORT_START( "PENB" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Pen Button") PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)0) PORT_PLAYER(2) + PORT_START( "PENX" ) + PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_X ) PORT_NAME("Pen X") PORT_SENSITIVITY(50) PORT_CROSSHAIR(X, 1, 0, 0) PORT_KEYDELTA(30) PORT_PLAYER(2) + PORT_START( "PENY" ) + PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_Y ) PORT_NAME("Pen Y") PORT_SENSITIVITY(50) PORT_CROSSHAIR(Y, 1, 0, 0) PORT_KEYDELTA(30) PORT_PLAYER(2) + PORT_START( "PORT-F" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) PORT_NAME("Power") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) PORT_NAME("Contacts") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) PORT_NAME("Calendar") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) PORT_NAME("Center") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) +INPUT_PORTS_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +ROM_START( palmz22 ) + ROM_REGION( 0x2100000, "nand", 0 ) + ROM_LOAD( "palmz22.bin", 0, 0x2100000, CRC(6d0320b3) SHA1(99297975fdad44faf69cc6eaf0fa2560d5579a4d) ) +ROM_END + +COMP(2005, palmz22, 0, 0, palmz22, palmz22, palmz22_state, palmz22, "Palm", "Palm Z22", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/partner.c b/src/mame/drivers/partner.c new file mode 100644 index 00000000000..942b7ddc9ec --- /dev/null +++ b/src/mame/drivers/partner.c @@ -0,0 +1,242 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Partner driver by Miodrag Milanovic + + 09/06/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/wave.h" +#include "machine/i8255.h" +#include "imagedev/cassette.h" +#include "formats/smx_dsk.h" +#include "formats/rk_cas.h" +#include "includes/radio86.h" +#include "machine/ram.h" +#include "includes/partner.h" + +/* Address maps */ +static ADDRESS_MAP_START(partner_mem, AS_PROGRAM, 8, partner_state ) + AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("bank1") + AM_RANGE( 0x0800, 0x3fff ) AM_RAMBANK("bank2") + AM_RANGE( 0x4000, 0x5fff ) AM_RAMBANK("bank3") + AM_RANGE( 0x6000, 0x7fff ) AM_RAMBANK("bank4") + AM_RANGE( 0x8000, 0x9fff ) AM_RAMBANK("bank5") + AM_RANGE( 0xa000, 0xb7ff ) AM_RAMBANK("bank6") + AM_RANGE( 0xb800, 0xbfff ) AM_RAMBANK("bank7") + AM_RANGE( 0xc000, 0xc7ff ) AM_RAMBANK("bank8") + AM_RANGE( 0xc800, 0xcfff ) AM_RAMBANK("bank9") + AM_RANGE( 0xd000, 0xd7ff ) AM_RAMBANK("bank10") + AM_RANGE( 0xd800, 0xd8ff ) AM_DEVREADWRITE("i8275", i8275_device, read, write) // video + AM_RANGE( 0xd900, 0xd9ff ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE( 0xda00, 0xdaff ) AM_WRITE(partner_mem_page_w) + AM_RANGE( 0xdb00, 0xdbff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xdc00, 0xddff ) AM_RAMBANK("bank11") + AM_RANGE( 0xde00, 0xdeff ) AM_WRITE(partner_win_memory_page_w) + AM_RANGE( 0xe000, 0xe7ff ) AM_RAMBANK("bank12") + AM_RANGE( 0xe800, 0xffff ) AM_RAMBANK("bank13") +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( partner ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(' ') PORT_CHAR('@') // without shift, this should be a Russian character, but we don't have yet these characters... + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) // Apparently in partner is Shift to switch between Latin and Russian Keyboard! + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/* Machine driver */ +FLOPPY_FORMATS_MEMBER( partner_state::floppy_formats ) + FLOPPY_SMX_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( partner_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +/* F4 Character Displayer */ +static const gfx_layout partner_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 512, /* 512 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( partner ) + GFXDECODE_ENTRY( "gfx1", 0x0000, partner_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( partner, partner_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, XTAL_16MHz / 9) + MCFG_CPU_PROGRAM_MAP(partner_mem) + + MCFG_MACHINE_RESET_OVERRIDE(partner_state, partner ) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) + + MCFG_DEVICE_ADD("i8275", I8275, XTAL_16MHz / 12) + MCFG_I8275_CHARACTER_WIDTH(6) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(partner_state, display_pixels) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma8257",i8257_device, dreq2_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(78*6, 30*10) + MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", partner) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(partner_state,radio86) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(partner_state, hrq_w)) + MCFG_I8257_IN_MEMR_CB(READ8(radio86_state, memory_read_byte)) + MCFG_I8257_OUT_MEMW_CB(WRITE8(radio86_state, memory_write_byte)) + MCFG_I8257_IN_IOR_0_CB(DEVREAD8("wd1793", fd1793_t, data_r)) + MCFG_I8257_OUT_IOW_0_CB(DEVWRITE8("wd1793", fd1793_t, data_w)) + MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("i8275", i8275_device, dack_w)) + MCFG_I8257_REVERSE_RW_MODE(1) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rkp_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("partner_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","partner_cass") + + MCFG_FD1793_ADD("wd1793", XTAL_16MHz / 16) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma8257", i8257_device, dreq0_w)) + MCFG_FLOPPY_DRIVE_ADD("wd1793:0", partner_floppies, "525qd", partner_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:1", partner_floppies, "525qd", partner_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list","partner_flop") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( partner ) + ROM_REGION( 0x1A000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "partner.rom", 0x10000, 0x2000, CRC(be1eaa10) SHA1(f9658d8055bf434240ec020d7892ea98cb5cbb76)) + ROM_LOAD( "basic.rom", 0x12000, 0x2000, CRC(1e9be0ec) SHA1(2c431f487cffddaac8413efddfc0527ad595f03b)) + ROM_LOAD( "mcpg.rom", 0x14000, 0x0800, CRC(3401225c) SHA1(6c252393ee73ed1a53d3e583547d86ab6718a533)) + ROM_LOAD( "fdd.rom", 0x16000, 0x0800, CRC(8ca350b5) SHA1(76fc92298726fb2840f4c19d7edc860d1ed86356)) + ROM_LOAD( "font.rom", 0x18000, 0x2000, CRC(dc4f1723) SHA1(6b8d5efb403cf0aeb3fd3197a0529d23c8e2f93c)) + ROM_REGION(0x2000, "gfx1",0) + ROM_LOAD ("partner.fnt", 0x0000, 0x2000, CRC(2705f726) SHA1(3d7b33901ef098a405d7ddad924ba9677f6a9b15)) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, partner, radio86, 0, partner, partner, partner_state,partner, "SAM SKB VM", "Partner-01.01", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/paso1600.c b/src/mame/drivers/paso1600.c new file mode 100644 index 00000000000..91fa7f170ae --- /dev/null +++ b/src/mame/drivers/paso1600.c @@ -0,0 +1,350 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Toshiba Pasopia 1600 + + TODO: + - charset ROM is WRONG! (needs a 8x16 or even a 16x16 one) + - identify fdc type (needs a working floppy image) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "video/mc6845.h" +#include "machine/pic8259.h" +#include "machine/am9517a.h" + + +class paso1600_state : public driver_device +{ +public: + paso1600_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pic(*this, "pic8259"), + m_dma(*this, "8237dma"), + m_crtc(*this, "crtc"), + m_p_vram(*this, "vram"), + m_p_gvram(*this, "gvram"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + required_device m_maincpu; + required_device m_pic; + required_device m_dma; + required_device m_crtc; + DECLARE_READ8_MEMBER(paso1600_pcg_r); + DECLARE_WRITE8_MEMBER(paso1600_pcg_w); + DECLARE_WRITE8_MEMBER(paso1600_6845_address_w); + DECLARE_WRITE8_MEMBER(paso1600_6845_data_w); + DECLARE_READ8_MEMBER(paso1600_6845_data_r); + DECLARE_READ8_MEMBER(paso1600_6845_status_r); + DECLARE_READ8_MEMBER(test_r); + DECLARE_READ8_MEMBER(key_r); + DECLARE_WRITE8_MEMBER(key_w); + DECLARE_READ16_MEMBER(test_hi_r); + DECLARE_WRITE_LINE_MEMBER(paso1600_set_int_line); + UINT8 m_crtc_vreg[0x100],m_crtc_index; + UINT8 *m_p_chargen; + UINT8 *m_p_pcg; + required_shared_ptr m_p_vram; + required_shared_ptr m_p_gvram; + required_device m_gfxdecode; + required_device m_palette; + struct{ + UINT8 portb; + }m_keyb; + DECLARE_READ8_MEMBER(pc_dma_read_byte); + DECLARE_WRITE8_MEMBER(pc_dma_write_byte); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_paso1600(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + IRQ_CALLBACK_MEMBER(paso1600_irq_callback); +}; + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + + +void paso1600_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); + m_p_pcg = memregion("pcg")->base(); +} + +UINT32 paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + int xi,yi; + #if 0 + UINT32 count; + static int test_x; + + if(machine().input().code_pressed(KEYCODE_Z)) + test_x++; + + if(machine().input().code_pressed(KEYCODE_X)) + test_x--; + + popmessage("%d",test_x); + + count = 0; + + for(y=0;y<475;y++) + { + count &= 0xffff; + + for(x=0;x> xi) & 1; + + if(y < 475 && x*16+xi < 640) /* TODO: safety check */ + bitmap.pix16(y, x*16+xi) = m_palette->pen(pen); + } + + count++; + } + } + #endif + +// popmessage("%d %d %d",mc6845_h_display,mc6845_v_display,mc6845_tile_height); + + for(y=0;y> 8; + int pen; + + for(yi=0;yi<19;yi++) + { + for(xi=0;xi<8;xi++) + { + pen = (m_p_chargen[tile*8+(yi >> 1)] >> (7-xi) & 1) ? color : -1; + + if(yi & 0x10) + pen = -1; + + if(pen != -1) + if(y*19 < 475 && x*8+xi < 640) /* TODO: safety check */ + bitmap.pix16(y*19+yi, x*8+xi) = m_palette->pen(pen); + } + } + } + } + + /* quick and dirty way to do the cursor */ + if(0) + for(yi=0;yipen(7); + } + } + } + + return 0; +} + +READ8_MEMBER( paso1600_state::paso1600_pcg_r ) +{ + return m_p_pcg[offset]; +} + +WRITE8_MEMBER( paso1600_state::paso1600_pcg_w ) +{ + m_p_pcg[offset] = data; + m_gfxdecode->gfx(0)->mark_dirty(offset >> 3); +} + +WRITE8_MEMBER( paso1600_state::paso1600_6845_address_w ) +{ + m_crtc_index = data; + m_crtc->address_w(space, offset, data); +} + +WRITE8_MEMBER( paso1600_state::paso1600_6845_data_w ) +{ + m_crtc_vreg[m_crtc_index] = data; + m_crtc->register_w(space, offset, data); +} + +READ8_MEMBER( paso1600_state::paso1600_6845_data_r ) +{ + return m_crtc->register_r(space, offset); +} + +READ8_MEMBER( paso1600_state::paso1600_6845_status_r ) +{ + return m_crtc->status_r(space, offset); +} + +READ8_MEMBER( paso1600_state::key_r ) +{ + switch(offset) + { + case 3: + if(m_keyb.portb == 1) + return 0; + } + + return 0xff; +} + +WRITE8_MEMBER( paso1600_state::key_w ) +{ + switch(offset) + { + case 3: m_keyb.portb = data; break; + } +} + +READ16_MEMBER( paso1600_state::test_hi_r ) +{ + return 0xffff; +} + +static ADDRESS_MAP_START(paso1600_map, AS_PROGRAM, 16, paso1600_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0x7ffff) AM_RAM + AM_RANGE(0xb0000,0xb0fff) AM_RAM AM_SHARE("vram") // tvram + AM_RANGE(0xbfff0,0xbffff) AM_READWRITE8(paso1600_pcg_r,paso1600_pcg_w,0xffff) + AM_RANGE(0xc0000,0xdffff) AM_RAM AM_SHARE("gvram")// gvram + AM_RANGE(0xe0000,0xeffff) AM_ROM AM_REGION("kanji",0)// kanji rom, banked via port 0x93 + AM_RANGE(0xfe000,0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(paso1600_io, AS_IO, 16, paso1600_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0x0000,0x000f) AM_DEVREADWRITE8("8237dma", am9517a_device, read, write, 0xffff) + AM_RANGE(0x0010,0x0011) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff) // i8259 + AM_RANGE(0x001a,0x001b) AM_READ(test_hi_r) // causes RAM error otherwise? + AM_RANGE(0x0030,0x0033) AM_READWRITE8(key_r,key_w,0xffff) //UART keyboard? + AM_RANGE(0x0048,0x0049) AM_READ(test_hi_r) + AM_RANGE(0x0090,0x0091) AM_READWRITE8(paso1600_6845_status_r,paso1600_6845_address_w,0x00ff) + AM_RANGE(0x0090,0x0091) AM_READWRITE8(paso1600_6845_data_r,paso1600_6845_data_w,0xff00) +// AM_RANGE(0x00d8,0x00df) //fdc, unknown type +// other undefined ports: 18, 1C, 92 +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( paso1600 ) +INPUT_PORTS_END + +static const gfx_layout paso1600_charlayout = +{ + 8, 8, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP8(0,1) }, + { STEP8(0,8) }, + 8*8 +}; + +static GFXDECODE_START( paso1600 ) + GFXDECODE_ENTRY( "pcg", 0x0000, paso1600_charlayout, 0, 4 ) + GFXDECODE_ENTRY( "chargen", 0x0000, paso1600_charlayout, 0, 4 ) +GFXDECODE_END + + +void paso1600_state::machine_start() +{ +} + + +void paso1600_state::machine_reset() +{ +} + +READ8_MEMBER(paso1600_state::pc_dma_read_byte) +{ + //offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) + // & 0xFF0000; + + return space.read_byte(offset); +} + + +WRITE8_MEMBER(paso1600_state::pc_dma_write_byte) +{ + //offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) + // & 0xFF0000; + + space.write_byte(offset, data); +} + +static MACHINE_CONFIG_START( paso1600, paso1600_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 16000000/2) + MCFG_CPU_PROGRAM_MAP(paso1600_map) + MCFG_CPU_IO_MAP(paso1600_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(paso1600_state, screen_update_paso1600) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", paso1600) + MCFG_PALETTE_ADD("palette", 8) +// MCFG_PALETTE_INIT(black_and_white) + + /* Devices */ + MCFG_MC6845_ADD("crtc", H46505, "screen", 16000000/4) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), GND, NULL ) + + MCFG_DEVICE_ADD("8237dma", AM9517A, 16000000/4) + MCFG_I8237_IN_MEMR_CB(READ8(paso1600_state, pc_dma_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(paso1600_state, pc_dma_write_byte)) +MACHINE_CONFIG_END + +ROM_START( paso1600 ) + ROM_REGION16_LE(0x2000,"ipl", 0) + ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(cee4ebb7) SHA1(c23b30f8dc51f96c1c00e28aab61e77b50d261f0)) + + ROM_REGION(0x2000,"pcg", ROMREGION_ERASE00) + + ROM_REGION( 0x800, "chargen", ROMREGION_ERASEFF ) + ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(a91c45a9) SHA1(a472adf791b9bac3dfa6437662e1a9e94a88b412)) //stolen from pasopia7 + + ROM_REGION( 0x20000, "kanji", ROMREGION_ERASEFF ) + ROM_LOAD( "kanji.rom", 0x0000, 0x20000, NO_DUMP) + +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP ( 198?,paso1600, 0, 0, paso1600, paso1600, driver_device, 0, "Toshiba", "Pasopia 1600" , MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mame/drivers/pasogo.c b/src/mame/drivers/pasogo.c new file mode 100644 index 00000000000..14bb688d280 --- /dev/null +++ b/src/mame/drivers/pasogo.c @@ -0,0 +1,576 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + +Pasogo Handheld Console +Koei 1996 + +This is a handheld console made by Koei in 1996. All of the games available on +this console are variations of the game 'Go' + + +Main PCB Layout +--------------- +PT-GMAIN01D +|--------------|------------|| +|POWER VOL | || +| LM2937*| CART || +|CE-0702 | SLOT || +| | CN1 || +| |MC14071B* || +| | || +| PIEZO_SPKR |------------|| +|CN5 74HC04* | +| X2 | +| |-------| CN4| +| |VADEM | | +| |VG230 | | +| | | HM514800* | +| | | CN3| +| |-------| HM514800* | +|CN2* X1 | +|----------------------------| +Notes: (all ICs shown) + + VG230 - Vadem VG230 single-chip PC platform. Contains 16 MHz NEC uPD70116H V30HL CPU + (which is a high-speed low-power 8086 variation), IBM PC/XT-compatible core + logic, LCD controller (CGA/AT&T640x400), keyboard matrix scanner, dual PCMCIA + 2.1 card controller, EMS 4.0 hardware support for up to 64MB, built-in timer + PIC/DMA/UART/RTC controllers. The clock input is 32.2200MHz. An internal divider + creates a 16.11MHz clock for the V30HL CPU. + HM514800 - Hitachi HM514800 512k x8-bit DRAM + MC14071 - Motorola MC14071 Quad 2-input OR gate + 74HC04 - 74HC04 Hex inverter + LM2937 - Texas Instruments LM2937ES-5 voltage regulator (Max 26V input, 5V output at 500mA) + CE-0702 - TDK CE-0702 DC-DC converter for LCD in SIP9 package (5V input, -24V output at 25mA) + POWER - 9V DC power input from AC/DC adapter + VOL - Volume pot + CN5 - 5 pin connector for 4-way control pad (up/down/left/right/ground) + CN4 - 5 pin connector for on/off switch and 2 buttons + CN3 - 2 pin power input from 6x AA-battery compartment (input voltage is 9V DC) + CN2 - Flat cable connector for video out to LCD panel. When the LCD is powered on the pixels + are blue. The LCD panel PCB has part number 97-44264-8 LMG6912RPFC LMG6910RPGR + and contains the following parts..... + Matsushita 53008HEB-8 + Sanyo LA6324N quad operational amplifier + Hitachi BD66285BFC LCD controller IC (x3) + Hitachi BD66284BFC LCD controller IC (x4) + The LCD flat cable has several wires but 2 of them have frequencies which measure + 69.9161Hz and 16.7798kHz. These are assumed to be VSync and HSync + CN1 - Cart slot + X1 - Marked 322. Measures 32.21732MHz so this is a common 32.22MHz OSC. + X2 - No markings. Measures 32.768kHz and used for the RTC + * - These parts are on the other side of the PCB + + +Carts +----- +All of the carts are identical. Most have only one surface mounted mask ROM. Either a +MX23C8100 (8M) or YRM0442 (4M). Some are populated with additional parts including a 62256 +32kx8 SRAM, a 3v coin battery and a MM1081N reset chip plus a few resistors/capacitors and +a transistor. All parts are surface mounted. + +PT-GMEM01B +PT-GMEM01C +|---------------| +|-- CR2016 | +|-- MM1081 | +|-- | +|-- | +|-- 62256 | +|-- | +|-- | +|-- MX23C8100| +|-- or YRM0442 | +|---------------| +Notes: + Carts containing just one mask ROM are KS-1002, KS-1003, KS1004 and KS-1009 + Carts containing RAM, battery and reset chip are KS-1001 and KS1010 + Carts KS-1005, KS-1006, KS-1007 and KS-1008 probably exist but are unknown. + +=========================================================================================== + + PeT mess@utanet.at march 2008 + +although it is very related to standard pc hardware, it is different enough +to make the standard pc driver one level more complex, so own driver + +TODO: +- Make a separate device of the Vadem VG230 core (it is also used in the HP + OmniGo 100 and 120). + +******************************************************************************/ + +#include "emu.h" +#include "cpu/nec/nec.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "machine/bankdev.h" +#include "includes/genpc.h" + + +/* + rtc interrupt irq 2 + */ + + +class pasogo_state : public driver_device +{ +public: + pasogo_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cart(*this, "cartslot") + , m_ems(*this, "ems") + , m_vram(*this, "vram") + , m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_cart; + required_device m_ems; + required_shared_ptr m_vram; + required_device m_palette; + + DECLARE_READ16_MEMBER(ems_r); + DECLARE_WRITE16_MEMBER(ems_w); + DECLARE_READ16_MEMBER(emsram_r); + DECLARE_WRITE16_MEMBER(emsram_w); + DECLARE_READ8_MEMBER(vg230_io_r); + DECLARE_WRITE8_MEMBER(vg230_io_w); + + struct + { + UINT8 index; + UINT8 data[0x100]; + struct { + UINT16 data; + } bios_timer; // 1.19 MHz tclk signal + struct { + int seconds, minutes, hours, days; + int alarm_seconds, alarm_minutes, alarm_hours, alarm_days; + + int onehertz_interrupt_on; + int onehertz_interrupt_request; + int alarm_interrupt_on; + int alarm_interrupt_request; + } rtc; + struct { + int write_protected; + } pmu; + } m_vg230; + + void machine_reset(); + void machine_start(); + + UINT32 screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(pasogo_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(vg230_timer); + DECLARE_INPUT_CHANGED_MEMBER(contrast); + + memory_region *m_cart_rom; + UINT8 m_ems_index; + UINT16 m_ems_bank[28]; +}; + + +TIMER_DEVICE_CALLBACK_MEMBER(pasogo_state::vg230_timer) +{ + m_vg230.rtc.seconds += 1; + if (m_vg230.rtc.seconds >= 60) + { + m_vg230.rtc.seconds = 0; + m_vg230.rtc.minutes += 1; + if (m_vg230.rtc.minutes >= 60) + { + m_vg230.rtc.minutes = 0; + m_vg230.rtc.hours += 1; + if (m_vg230.rtc.hours >= 24) + { + m_vg230.rtc.hours = 0; + m_vg230.rtc.days = (m_vg230.rtc.days + 1) & 0xfff; + } + } + } + + if (m_vg230.rtc.seconds == m_vg230.rtc.alarm_seconds + && m_vg230.rtc.minutes == m_vg230.rtc.alarm_minutes + && m_vg230.rtc.hours == m_vg230.rtc.alarm_hours + && (m_vg230.rtc.days & 0x1f) == m_vg230.rtc.alarm_hours) + { + // generate alarm + } +} + +void pasogo_state::machine_start() +{ + system_time systime; + + memset(&m_vg230, 0, sizeof(m_vg230)); + m_vg230.pmu.write_protected = TRUE; + machine().base_datetime(systime); + + m_vg230.rtc.seconds = systime.local_time.second; + m_vg230.rtc.minutes = systime.local_time.minute; + m_vg230.rtc.hours = systime.local_time.hour; + m_vg230.rtc.days = 0; + + m_vg230.bios_timer.data=0x7200; // HACK +} + +READ8_MEMBER( pasogo_state::vg230_io_r ) +{ + int log = TRUE; + UINT8 data = 0; + + m_vg230.bios_timer.data += 0x100; //HACK + if (offset&1) + { + data = m_vg230.data[m_vg230.index]; + switch (m_vg230.index) + { + case 0x09: + break; + + case 0x0a: + if (m_vg230.data[9] & 1) + data=ioport("JOY")->read(); + else + data = 0xff; + break; + + case 0x30: + data = m_vg230.bios_timer.data & 0xff; + break; + + case 0x31: + data = m_vg230.bios_timer.data >> 8; + log = FALSE; + break; + + case 0x70: + data = m_vg230.rtc.seconds; + log = FALSE; + break; + + case 0x71: + data = m_vg230.rtc.minutes; + log = FALSE; + break; + + case 0x72: + data = m_vg230.rtc.hours; + log = FALSE; + break; + + case 0x73: + data = m_vg230.rtc.days; + break; + + case 0x74: + data = m_vg230.rtc.days >> 8; + break; + + case 0x79: + /*rtc status*/ + log = FALSE; + break; + + case 0x7a: + data &= ~3; + if (m_vg230.rtc.alarm_interrupt_request) + data |= 1<<1; + if (m_vg230.rtc.onehertz_interrupt_request) + data |= 1<<0; + break; + + case 0xc1: + data &= ~1; + if (m_vg230.pmu.write_protected) + data |= 1; + m_vg230.pmu.write_protected = FALSE; + log = FALSE; + break; + } + + if (log) + logerror("%.5x vg230 %02x read %.2x\n",(int) m_maincpu->pc(), m_vg230.index, data); + // data=machine.root_device().memregion("maincpu")->base()[0x4000+offset]; + } + else + data = m_vg230.index; + + return data; +} + + +WRITE8_MEMBER( pasogo_state::vg230_io_w ) +{ + int log = TRUE; + + if (offset & 1) + { + // machine.root_device().memregion("maincpu")->base()[0x4000+offset]=data; + m_vg230.data[m_vg230.index] = data; + switch (m_vg230.index) + { + case 0x09: + break; + + case 0x70: + m_vg230.rtc.seconds = data & 0x3f; + break; + + case 0x71: + m_vg230.rtc.minutes = data & 0x3f; + break; + + case 0x72: + m_vg230.rtc.hours = data & 0x1f; + break; + + case 0x73: + m_vg230.rtc.days = (m_vg230.rtc.days & ~0xff) | data; + break; + + case 0x74: + m_vg230.rtc.days = (m_vg230.rtc.days & 0xff) | ((data & 0xf) << 8); + break; + + case 0x75: + m_vg230.rtc.alarm_seconds = data & 0x3f; + break; + + case 0x76: + m_vg230.rtc.alarm_minutes = data & 0x3f; + break; + + case 0x77: + m_vg230.rtc.alarm_hours = data & 0x1f; + break; + + case 0x78: + m_vg230.rtc.days = data & 0x1f; + break; + + case 0x79: + m_vg230.rtc.onehertz_interrupt_on = data & 1; + m_vg230.rtc.alarm_interrupt_on = data & 2; + log = FALSE; + break; + + case 0x7a: + if (data & 2) + { + m_vg230.rtc.alarm_interrupt_request = FALSE; + m_vg230.rtc.onehertz_interrupt_request = FALSE; /* update interrupt */ + } + break; + } + + if (log) + logerror("%.5x vg230 %02x write %.2x\n", (int)m_maincpu->pc(), m_vg230.index, data); + } + else + m_vg230.index = data; +} + + +READ16_MEMBER( pasogo_state::ems_r ) +{ + UINT8 data = 0; + UINT8 index; + + switch (offset) + { + case 0: + data = m_ems_index; + break; + + case 1: + index = (m_ems_index >> 2) & 0x1f; + data = m_ems_bank[index]; + break; + } + return data; +} + + +WRITE16_MEMBER( pasogo_state::ems_w ) +{ + UINT8 index; + + switch (offset) + { + case 0: + m_ems_index = data; + break; + + case 1: + index = (m_ems_index >> 2) & 0x1f; + if((index & ~1) == 10) + { + logerror("EMS mapping of CGA framebuffer\n"); + break; + } + else if(index >= 28) + { + logerror("EMS index out of range\n"); + break; + } + COMBINE_DATA(&m_ems_bank[index]); + break; + } +} + +READ16_MEMBER( pasogo_state::emsram_r ) +{ + m_ems->set_bank(m_ems_bank[(offset >> 13) & 0x1f] & 0x7fff); + return m_ems->read16(space, offset & 0x1fff, mem_mask); +} + +WRITE16_MEMBER( pasogo_state::emsram_w ) +{ + m_ems->set_bank(m_ems_bank[(offset >> 13) & 0x1f] & 0x7fff); + m_ems->write16(space, offset & 0x1fff, data, mem_mask); +} + +static ADDRESS_MAP_START(emsbank_map, AS_PROGRAM, 16, pasogo_state) + AM_RANGE(0x04080000, 0x040fffff) AM_RAM + AM_RANGE(0x08000000, 0x080fffff) AM_ROMBANK("bank27") + AM_RANGE(0x10000000, 0x1000ffff) AM_RAM // cart ram? +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pasogo_mem, AS_PROGRAM, 16, pasogo_state) + AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") + AM_RANGE(0xb8000, 0xbffff) AM_RAM AM_SHARE("vram") + AM_RANGE(0x80000, 0xeffff) AM_READWRITE(emsram_r, emsram_w) + AM_RANGE(0xf0000, 0xfffff) AM_ROMBANK("bank27") +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(pasogo_io, AS_IO, 16, pasogo_state) + AM_RANGE(0x0026, 0x0027) AM_READWRITE8(vg230_io_r, vg230_io_w, 0xffff) + AM_RANGE(0x006c, 0x006f) AM_READWRITE(ems_r, ems_w) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( pasogo ) + PORT_START("JOY") +// PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("select") +// PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("start") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("O") /*?*/ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("X") /*?*/ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("a") PORT_CODE(KEYCODE_A) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("b") PORT_CODE(KEYCODE_B) + PORT_START("COLOR") + PORT_CONFNAME(0x01, 0x01, "Contrast") PORT_CHANGED_MEMBER(DEVICE_SELF, pasogo_state, contrast, 0) + PORT_CONFSETTING(0x00, "Actual") + PORT_CONFSETTING(0x01, "Enhanced") +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(pasogo_state::contrast) +{ + if(newval) + { + m_palette->set_pen_color(0, rgb_t(80, 130, 130)); + m_palette->set_pen_color(1, rgb_t(40, 60, 140)); + } + else + { + m_palette->set_pen_color(0, rgb_t(100, 110, 100)); + m_palette->set_pen_color(1, rgb_t(90, 80, 110)); + } +} + +UINT32 pasogo_state::screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *vram = (UINT8 *)m_vram.target(); + int x, y; + for (y=0; y<240; y++) + { + for (x=0; x<(320/8); x++) + { + int a = (y & 3) * 0x2000; + UINT8 d1 = vram[a + (y >> 2) * 80 + x]; + UINT16 *line = &bitmap.pix16(y, x << 3); + *line++ = ((d1 >> 7) & 1); + *line++ = ((d1 >> 6) & 1); + *line++ = ((d1 >> 5) & 1); + *line++ = ((d1 >> 4) & 1); + *line++ = ((d1 >> 3) & 1); + *line++ = ((d1 >> 2) & 1); + *line++ = ((d1 >> 1) & 1); + *line++ = ((d1 >> 0) & 1); + } + } + return 0; +} + +INTERRUPT_GEN_MEMBER(pasogo_state::pasogo_interrupt) +{ +// m_maincpu->set_input_line(UPD7810_INTFE1, PULSE_LINE); +} + +void pasogo_state::machine_reset() +{ + std::string region_tag; + ioport_port *color = ioport("COLOR"); + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + if (!m_cart_rom) // this should never happen, since we make carts mandatory! + m_cart_rom = memregion("maincpu"); + + membank("bank27")->set_base(m_cart_rom->base()); + m_ems_index = 0; + memset(m_ems_bank, 0, sizeof(m_ems_bank)); + contrast(*color->first_field(), NULL, 0, color->read()); +} + +static MACHINE_CONFIG_START( pasogo, pasogo_state ) + + MCFG_CPU_ADD("maincpu", V30, XTAL_32_22MHz/2) + MCFG_CPU_PROGRAM_MAP(pasogo_mem) + MCFG_CPU_IO_MAP(pasogo_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pasogo_state, pasogo_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_DEVICE_ADD("ems", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(emsbank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + + // It's a CGA device right so lets use isa_cga! Well, not so much. + // The carts use vg230 specific registers and mostly ignore the mc6845. + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(320, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) + MCFG_SCREEN_UPDATE_DRIVER(pasogo_state, screen_update_pasogo) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD("palette", 2) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pasogo_cart") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_MANDATORY + + MCFG_SOFTWARE_LIST_ADD("cart_list","pasogo") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("vg230_timer", pasogo_state, vg230_timer, attotime::from_hz(1)) +MACHINE_CONFIG_END + +ROM_START( pasogo ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) +ROM_END + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +CONS( 1996, pasogo, 0, 0, pasogo, pasogo, driver_device, 0, "KOEI", "PasoGo", MACHINE_NO_SOUND|MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/pasopia.c b/src/mame/drivers/pasopia.c new file mode 100644 index 00000000000..03a27a2d2fb --- /dev/null +++ b/src/mame/drivers/pasopia.c @@ -0,0 +1,359 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Toshiba Pasopia + + TODO: + - machine emulation needs merging with Pasopia 7 (video emulation is + completely different tho) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "video/mc6845.h" +#include "includes/pasopia.h" + +class pasopia_state : public driver_device +{ +public: + pasopia_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ppi0(*this, "ppi8255_0"), + m_ppi1(*this, "ppi8255_1"), + m_ppi2(*this, "ppi8255_2"), + m_ctc(*this, "z80ctc"), + m_pio(*this, "z80pio"), + m_crtc(*this, "crtc"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_ppi0; + required_device m_ppi1; + required_device m_ppi2; + required_device m_ctc; + required_device m_pio; + required_device m_crtc; + required_device m_palette; + + DECLARE_READ8_MEMBER(pasopia_romram_r); + DECLARE_WRITE8_MEMBER(pasopia_ram_w); + DECLARE_WRITE8_MEMBER(pasopia_ctrl_w); + DECLARE_WRITE8_MEMBER(vram_addr_lo_w); + DECLARE_WRITE8_MEMBER(vram_latch_w); + DECLARE_READ8_MEMBER(vram_latch_r); + DECLARE_READ8_MEMBER(portb_1_r); + DECLARE_WRITE8_MEMBER(vram_addr_hi_w); + DECLARE_WRITE8_MEMBER(screen_mode_w); + DECLARE_READ8_MEMBER(rombank_r); + DECLARE_READ8_MEMBER(testa_r); + DECLARE_READ8_MEMBER(testb_r); + DECLARE_WRITE_LINE_MEMBER(testa_w); + DECLARE_WRITE_LINE_MEMBER(testb_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(mux_r); + DECLARE_READ8_MEMBER(keyb_r); + DECLARE_WRITE8_MEMBER(mux_w); + MC6845_UPDATE_ROW(crtc_update_row); + + UINT8 m_hblank; + UINT16 m_vram_addr; + UINT8 m_vram_latch; + UINT8 m_attr_latch; +// UINT8 m_gfx_mode; + UINT8 m_mux_data; + bool m_video_wl; + bool m_ram_bank; + UINT8 *m_p_vram; + DECLARE_DRIVER_INIT(pasopia); + TIMER_CALLBACK_MEMBER(pio_timer); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); +}; + +// needed to scan the keyboard, as the pio emulation doesn't do it. +TIMER_CALLBACK_MEMBER(pasopia_state::pio_timer) +{ + m_pio->port_b_write(keyb_r(generic_space(),0,0xff)); +} + +void pasopia_state::video_start() +{ +} + +MC6845_UPDATE_ROW( pasopia_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 *m_p_chargen = memregion("chargen")->base(); + UINT8 chr,gfx,fg=7,bg=0; // colours need to be determined + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + UINT8 inv=0; + if (x == cursor_x) inv=0xff; + mem = (ma + x) & 0xfff; + chr = m_p_vram[mem]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<3) | ra] ^ inv; + + /* Display a scanline of a character */ + *p++ = palette[BIT(gfx, 7) ? fg : bg]; + *p++ = palette[BIT(gfx, 6) ? fg : bg]; + *p++ = palette[BIT(gfx, 5) ? fg : bg]; + *p++ = palette[BIT(gfx, 4) ? fg : bg]; + *p++ = palette[BIT(gfx, 3) ? fg : bg]; + *p++ = palette[BIT(gfx, 2) ? fg : bg]; + *p++ = palette[BIT(gfx, 1) ? fg : bg]; + *p++ = palette[BIT(gfx, 0) ? fg : bg]; + } +} + +WRITE8_MEMBER( pasopia_state::pasopia_ctrl_w ) +{ + m_ram_bank = BIT(data, 1); + membank("bank1")->set_entry(m_ram_bank); +} + +static ADDRESS_MAP_START(pasopia_map, AS_PROGRAM, 8, pasopia_state) + AM_RANGE(0x0000,0x7fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") + AM_RANGE(0x8000,0xffff) AM_RAM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(pasopia_io, AS_IO, 8, pasopia_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00,0x03) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0x08,0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE(0x10,0x10) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0x11,0x11) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) +// 0x18 - 0x1b pac2 +// 0x1c - 0x1f something + AM_RANGE(0x20,0x23) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) + AM_RANGE(0x28,0x2b) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + AM_RANGE(0x30,0x33) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) +// 0x38 printer + AM_RANGE(0x3c,0x3c) AM_WRITE(pasopia_ctrl_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pasopia ) + PASOPIA_KEYBOARD +INPUT_PORTS_END + +void pasopia_state::machine_start() +{ + m_p_vram = memregion("vram")->base(); + m_hblank = 0; + membank("bank1")->set_entry(0); + membank("bank2")->set_entry(0); +} + +void pasopia_state::machine_reset() +{ +} + +WRITE8_MEMBER( pasopia_state::vram_addr_lo_w ) +{ + m_vram_addr = (m_vram_addr & 0x3f00) | data; +} + +WRITE8_MEMBER( pasopia_state::vram_latch_w ) +{ + m_vram_latch = data; +} + +READ8_MEMBER( pasopia_state::vram_latch_r ) +{ + return m_p_vram[m_vram_addr]; +} + +READ8_MEMBER( pasopia_state::portb_1_r ) +{ + /* + x--- ---- attribute latch + -x-- ---- hblank + --x- ---- vblank + ---x ---- LCD system mode, active low + */ + UINT8 grph_latch,lcd_mode; + + m_hblank ^= 0x40; //TODO + grph_latch = (m_p_vram[m_vram_addr | 0x4000] & 0x80); + lcd_mode = 0x10; + + return m_hblank | lcd_mode | grph_latch; //bit 4: LCD mode +} + + +WRITE8_MEMBER( pasopia_state::vram_addr_hi_w ) +{ + m_attr_latch = (data & 0x80) | (m_attr_latch & 0x7f); + if ( BIT(data, 6) && !m_video_wl ) + { + m_p_vram[m_vram_addr] = m_vram_latch; + m_p_vram[m_vram_addr | 0x4000] = m_attr_latch; + } + + m_video_wl = BIT(data, 6); + m_vram_addr = (m_vram_addr & 0xff) | ((data & 0x3f) << 8); +} + +WRITE8_MEMBER( pasopia_state::screen_mode_w ) +{ + //m_gfx_mode = (data & 0xe0) >> 5; unused variable + m_attr_latch = (m_attr_latch & 0x80) | (data & 7); + printf("Screen Mode=%02x\n",data); +} + +READ8_MEMBER( pasopia_state::rombank_r ) +{ + return (m_ram_bank) ? 4 : 0; +} + +READ8_MEMBER( pasopia_state::mux_r ) +{ + return m_mux_data; +} + +READ8_MEMBER( pasopia_state::keyb_r ) +{ + const char *const keynames[3][4] = { { "KEY0", "KEY1", "KEY2", "KEY3" }, + { "KEY4", "KEY5", "KEY6", "KEY7" }, + { "KEY8", "KEY9", "KEYA", "KEYB" } }; + int i,j; + UINT8 res; + + res = 0; + for(j=0;j<3;j++) + { + if(m_mux_data & 0x10 << j) + { + for(i=0;i<4;i++) + { + if(m_mux_data & 1 << i) + res |= ioport(keynames[j][i])->read(); + } + } + } + + return res ^ 0xff; +} + +WRITE8_MEMBER( pasopia_state::mux_w ) +{ + m_mux_data = data; +} + +static const gfx_layout p7_chars_8x8 = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( pasopia ) + GFXDECODE_ENTRY( "chargen", 0x0000, p7_chars_8x8, 0, 4 ) +GFXDECODE_END + +static const z80_daisy_config pasopia_daisy[] = +{ + { "z80ctc" }, + { "z80pio" }, +// { "upd765" }, /* TODO */ + { NULL } +}; + + + +DRIVER_INIT_MEMBER(pasopia_state,pasopia) +{ +/* +We preset all banks here, so that bankswitching will incur no speed penalty. +0000 indicates ROMs, 10000 indicates RAM. +*/ + UINT8 *p_ram = memregion("maincpu")->base(); + membank("bank1")->configure_entries(0, 2, &p_ram[0x00000], 0x10000); + membank("bank2")->configure_entry(0, &p_ram[0x10000]); + + machine().scheduler().timer_pulse(attotime::from_hz(500), timer_expired_delegate(FUNC(pasopia_state::pio_timer),this)); +} + +static MACHINE_CONFIG_START( pasopia, pasopia_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(pasopia_map) + MCFG_CPU_IO_MAP(pasopia_io) + MCFG_CPU_CONFIG(pasopia_daisy) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", h46505_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pasopia) + MCFG_PALETTE_ADD("palette", 8) + + /* Devices */ + MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_4MHz/4) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(pasopia_state, crtc_update_row) + + MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia_state, vram_addr_lo_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pasopia_state, vram_latch_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pasopia_state, vram_latch_r)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia_state, screen_mode_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pasopia_state, portb_1_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pasopia_state, vram_addr_hi_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) + MCFG_I8255_IN_PORTC_CB(READ8(pasopia_state, rombank_r)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_4MHz) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg2)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(pasopia_state, mux_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(pasopia_state, mux_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(pasopia_state, keyb_r)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pasopia ) + ROM_REGION( 0x18000, "maincpu", 0 ) + ROM_LOAD( "tbasic.rom", 0x0000, 0x8000, CRC(f53774ff) SHA1(bbec45a3bad8d184505cc6fe1f6e2e60a7fb53f2)) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(a91c45a9) SHA1(a472adf791b9bac3dfa6437662e1a9e94a88b412)) //stolen from pasopia7 + + ROM_REGION( 0x8000, "vram", ROMREGION_ERASE00 ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, pasopia, 0, 0, pasopia, pasopia, pasopia_state, pasopia, "Toshiba", "Pasopia", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/pasopia7.c b/src/mame/drivers/pasopia7.c new file mode 100644 index 00000000000..926b4401a1a --- /dev/null +++ b/src/mame/drivers/pasopia7.c @@ -0,0 +1,1066 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/************************************************************************************************** + + Toshiba Pasopia 7 (c) 1983 Toshiba + + preliminary driver by Angelo Salese + + TODO: + - floppy support (but floppy images are unobtainable at current time) + - cassette device; + - beeper + - LCD version has gfx bugs, it must use a different ROM charset for instance (apparently a 8 x 4 + one, 40/80 x 8 tilemap); + + Reading fdc has been commented out, until the code can be modified to + work with new upd765 (was causing a hang at boot). + +***************************************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80ctc.h" +#include "machine/i8255.h" +#include "machine/z80pio.h" +#include "machine/upd765.h" +#include "sound/sn76496.h" +#include "video/mc6845.h" +#include "rendlay.h" +#include "includes/pasopia.h" + +class pasopia7_state : public driver_device +{ +public: + pasopia7_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ppi0(*this, "ppi8255_0"), + m_ppi1(*this, "ppi8255_1"), + m_ppi2(*this, "ppi8255_2"), + m_ctc(*this, "z80ctc"), + m_pio(*this, "z80pio"), + m_crtc(*this, "crtc"), + m_fdc(*this, "fdc"), + m_floppy(*this, "fdc:0:525hd"), + m_sn1(*this, "sn1"), + m_sn2(*this, "sn2"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_ppi0; + required_device m_ppi1; + required_device m_ppi2; + required_device m_ctc; + required_device m_pio; + required_device m_crtc; + required_device m_fdc; + required_device m_floppy; + required_device m_sn1; + required_device m_sn2; + required_device m_palette; + + DECLARE_READ8_MEMBER(vram_r); + DECLARE_WRITE8_MEMBER(vram_w); + DECLARE_WRITE8_MEMBER(pasopia7_memory_ctrl_w); + DECLARE_WRITE8_MEMBER(pac2_w); + DECLARE_READ8_MEMBER(pac2_r); + DECLARE_WRITE8_MEMBER(ram_bank_w); + DECLARE_WRITE8_MEMBER(pasopia7_6845_w); + DECLARE_READ8_MEMBER(pasopia7_io_r); + DECLARE_WRITE8_MEMBER(pasopia7_io_w); + DECLARE_READ8_MEMBER(pasopia7_fdc_r); + DECLARE_WRITE8_MEMBER(pasopia7_fdc_w); + DECLARE_READ8_MEMBER(mux_r); + DECLARE_READ8_MEMBER(keyb_r); + DECLARE_WRITE8_MEMBER(mux_w); + DECLARE_READ8_MEMBER(crtc_portb_r); + DECLARE_WRITE8_MEMBER(screen_mode_w); + DECLARE_WRITE8_MEMBER(plane_reg_w); + DECLARE_WRITE8_MEMBER(video_attr_w); + DECLARE_WRITE8_MEMBER(video_misc_w); + DECLARE_WRITE8_MEMBER(nmi_mask_w); + DECLARE_READ8_MEMBER(unk_r); + DECLARE_READ8_MEMBER(nmi_reg_r); + DECLARE_WRITE8_MEMBER(nmi_reg_w); + DECLARE_READ8_MEMBER(nmi_porta_r); + DECLARE_READ8_MEMBER(nmi_portb_r); + UINT8 m_vram_sel; + UINT8 m_mio_sel; + UINT8 *m_p7_pal; + UINT8 m_bank_reg; + UINT16 m_cursor_addr; + UINT8 m_cursor_blink; + UINT8 m_cursor_raster; + UINT8 m_plane_reg; + UINT8 m_attr_data; + UINT8 m_attr_wrap; + UINT8 m_attr_latch; + UINT8 m_pal_sel; + UINT8 m_x_width; + UINT8 m_gfx_mode; + UINT8 m_nmi_mask; + UINT8 m_nmi_enable_reg; + UINT8 m_nmi_trap; + UINT8 m_nmi_reset; + UINT16 m_pac2_index[2]; + UINT32 m_kanji_index; + UINT8 m_pac2_bank_select; + UINT8 m_screen_type; + int m_addr_latch; + void pasopia_nmi_trap(); + UINT8 m_mux_data; + DECLARE_DRIVER_INIT(p7_lcd); + DECLARE_DRIVER_INIT(p7_raster); + virtual void machine_reset(); + DECLARE_VIDEO_START(pasopia7); + DECLARE_PALETTE_INIT(p7_lcd); + UINT32 screen_update_pasopia7(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void fdc_irq(bool state); + TIMER_CALLBACK_MEMBER(pio_timer); + void draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width); + void draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width); + void draw_mixed_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width); +}; + +#define VDP_CLOCK XTAL_3_579545MHz/4 +#define LCD_CLOCK VDP_CLOCK/10 + +// needed to scan the keyboard, as the pio emulation doesn't do it. +TIMER_CALLBACK_MEMBER(pasopia7_state::pio_timer) +{ + m_pio->port_b_write(keyb_r(generic_space(),0,0xff)); +} + +VIDEO_START_MEMBER(pasopia7_state,pasopia7) +{ + m_p7_pal = auto_alloc_array(machine(), UINT8, 0x10); +} + +void pasopia7_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) +{ + UINT8 *vram = memregion("vram")->base(); + int x,y,xi,yi; + int count; + + for(yi=0;yi<8;yi++) + { + count = yi; + for(y=0;y<200;y+=8) + { + for(x=0;x<8*width;x+=8) + { + for(xi=0;xi<8;xi++) + { + int pen_b,pen_r,pen_g,color; + + pen_b = (vram[count+0x0000]>>(7-xi)) & 1; + pen_r = (vram[count+0x4000]>>(7-xi)) & 1; + pen_g = 0;//(p7_vram[count+0x8000]>>(7-xi)) & 1; + + color = pen_g<<2 | pen_r<<1 | pen_b<<0; + + bitmap.pix16(y+yi, x+xi) = m_palette->pen(color); + } + count+=8; + } + } + } +} + +void pasopia7_state::draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) +{ + UINT8 *vram = memregion("vram")->base(); + UINT8 *gfx_data = memregion("font")->base(); + int x,y,xi,yi; + int count; + + count = 0x0000; + + for(y=0;y<25;y++) + { + for(x=0;x>(7-xi)) & 1) ? color : 0; + + bitmap.pix16(y*8+yi, x*8+xi) = m_palette->pen(pen); + } + } + + // draw cursor + if(m_cursor_addr*8 == count) + { + int xc,yc,cursor_on; + + cursor_on = 0; + switch(m_cursor_raster & 0x60) + { + case 0x00: cursor_on = 1; break; //always on + case 0x20: cursor_on = 0; break; //always off + case 0x40: if(machine().first_screen()->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink + case 0x60: if(machine().first_screen()->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink + } + + if(cursor_on) + { + for(yc=0;yc<(8-(m_cursor_raster & 7));yc++) + { + for(xc=0;xc<8;xc++) + { + bitmap.pix16(y*8-yc+7, x*8+xc) = m_palette->pen(7); + } + } + } + } + count+=8; + } + } +} + +void pasopia7_state::draw_mixed_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) +{ + UINT8 *vram = memregion("vram")->base(); + UINT8 *gfx_data = memregion("font")->base(); + int x,y,xi,yi; + int count; + + count = 0x0000; + + for(y=0;y<25;y++) + { + for(x=0;x>(7-xi)) & 1; + pen_r = (vram[count+yi+0x4000]>>(7-xi)) & 1; + pen_g = (vram[count+yi+0x8000]>>(7-xi)) & 1; + + pen = pen_g<<2 | pen_r<<1 | pen_b<<0; + + bitmap.pix16(y*8+yi, x*8+xi) = m_palette->pen(pen); + } + } + else + { + int color = attr & 7; + + for(xi=0;xi<8;xi++) + { + int pen; + pen = ((gfx_data[tile*8+yi]>>(7-xi)) & 1) ? color : 0; + + bitmap.pix16(y*8+yi, x*8+xi) = m_palette->pen(pen); + } + } + } + + // draw cursor + if(m_cursor_addr*8 == count) + { + int xc,yc,cursor_on; + + cursor_on = 0; + switch(m_cursor_raster & 0x60) + { + case 0x00: cursor_on = 1; break; //always on + case 0x20: cursor_on = 0; break; //always off + case 0x40: if(machine().first_screen()->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink + case 0x60: if(machine().first_screen()->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink + } + + if(cursor_on) + { + for(yc=0;yc<(8-(m_cursor_raster & 7));yc++) + { + for(xc=0;xc<8;xc++) + { + bitmap.pix16(y*8-yc+7, x*8+xc) = m_palette->pen(7); + } + } + } + } + + count+=8; + } + } +} + +UINT32 pasopia7_state::screen_update_pasopia7(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int width; + + bitmap.fill(m_palette->pen(0), cliprect); + + width = m_x_width ? 80 : 40; + + if(m_gfx_mode) + draw_mixed_screen(bitmap,cliprect,width); + else + { + draw_cg4_screen(bitmap,cliprect,width); + draw_tv_screen(bitmap,cliprect,width); + } + + return 0; +} + +READ8_MEMBER( pasopia7_state::vram_r ) +{ + UINT8 *vram = memregion("vram")->base(); + UINT8 res; + + if (m_vram_sel == 0) + { + UINT8 *work_ram = memregion("maincpu")->base(); + + return work_ram[offset+0x8000]; + } + + if (m_pal_sel && (m_plane_reg & 0x70) == 0x00) + return m_p7_pal[offset & 0xf]; + + res = 0xff; + + if ((m_plane_reg & 0x11) == 0x11) + res &= vram[offset | 0x0000]; + if ((m_plane_reg & 0x22) == 0x22) + res &= vram[offset | 0x4000]; + if ((m_plane_reg & 0x44) == 0x44) + { + res &= vram[offset | 0x8000]; + m_attr_latch = vram[offset | 0xc000] & 0x87; + } + + return res; +} + +WRITE8_MEMBER( pasopia7_state::vram_w ) +{ + UINT8 *vram = memregion("vram")->base(); + + if (m_vram_sel) + { + if (m_pal_sel && (m_plane_reg & 0x70) == 0x00) + { + m_p7_pal[offset & 0xf] = data & 0xf; + return; + } + + if (m_plane_reg & 0x10) + vram[(offset & 0x3fff) | 0x0000] = (m_plane_reg & 1) ? data : 0xff; + if (m_plane_reg & 0x20) + vram[(offset & 0x3fff) | 0x4000] = (m_plane_reg & 2) ? data : 0xff; + if (m_plane_reg & 0x40) + { + vram[(offset & 0x3fff) | 0x8000] = (m_plane_reg & 4) ? data : 0xff; + m_attr_latch = m_attr_wrap ? m_attr_latch : m_attr_data; + vram[(offset & 0x3fff) | 0xc000] = m_attr_latch; + } + } + else + { + UINT8 *work_ram = memregion("maincpu")->base(); + + work_ram[offset+0x8000] = data; + } +} + +WRITE8_MEMBER( pasopia7_state::pasopia7_memory_ctrl_w ) +{ + UINT8 *work_ram = memregion("maincpu")->base(); + UINT8 *basic = memregion("basic")->base(); + + switch(data & 3) + { + case 0: + case 3: //select Basic ROM + membank("bank1")->set_base(basic + 0x00000); + membank("bank2")->set_base(basic + 0x04000); + break; + case 1: //select Basic ROM + BIOS ROM + membank("bank1")->set_base(basic + 0x00000); + membank("bank2")->set_base(work_ram + 0x10000); + break; + case 2: //select Work RAM + membank("bank1")->set_base(work_ram + 0x00000); + membank("bank2")->set_base(work_ram + 0x04000); + break; + } + + m_bank_reg = data & 3; + m_vram_sel = data & 4; + m_mio_sel = data & 8; + + // bank4 is always RAM + +// printf("%02x\n",m_vram_sel); +} + +#if 0 +READ8_MEMBER( pasopia7_state::fdc_r ) +{ + return machine().rand(); +} +#endif + + +WRITE8_MEMBER( pasopia7_state::pac2_w ) +{ + /* + select register: + 4 = ram1; + 3 = ram2; + 2 = kanji ROM; + 1 = joy; + anything else is nop + */ + + if(m_pac2_bank_select == 3 || m_pac2_bank_select == 4) + { + switch(offset) + { + case 0: m_pac2_index[(m_pac2_bank_select-3) & 1] = (m_pac2_index[(m_pac2_bank_select-3) & 1] & 0x7f00) | (data & 0xff); break; + case 1: m_pac2_index[(m_pac2_bank_select-3) & 1] = (m_pac2_index[(m_pac2_bank_select-3) & 1] & 0xff) | ((data & 0x7f) << 8); break; + case 2: // PAC2 RAM write + { + UINT8 *pac2_ram; + + pac2_ram = memregion(((m_pac2_bank_select-3) & 1) ? "rampac2" : "rampac1")->base(); + + pac2_ram[m_pac2_index[(m_pac2_bank_select-3) & 1]] = data; + } + } + } + else if(m_pac2_bank_select == 2) // kanji ROM + { + switch(offset) + { + case 0: m_kanji_index = (m_kanji_index & 0x1ff00) | ((data & 0xff) << 0); break; + case 1: m_kanji_index = (m_kanji_index & 0x100ff) | ((data & 0xff) << 8); break; + case 2: m_kanji_index = (m_kanji_index & 0x0ffff) | ((data & 0x01) << 16); break; + } + } + + if(offset == 3) + { + if(data & 0x80) + { + // ... + } + else + m_pac2_bank_select = data & 7; + } +} + +READ8_MEMBER( pasopia7_state::pac2_r ) +{ + if(offset == 2) + { + if(m_pac2_bank_select == 3 || m_pac2_bank_select == 4) + { + UINT8 *pac2_ram; + + pac2_ram = memregion(((m_pac2_bank_select-3) & 1) ? "rampac2" : "rampac1")->base(); + + return pac2_ram[m_pac2_index[(m_pac2_bank_select-3) & 1]]; + } + else if(m_pac2_bank_select == 2) + { + UINT8 *kanji_rom = memregion("kanji")->base(); + + return kanji_rom[m_kanji_index]; + } + else + { + printf("%02x\n",m_pac2_bank_select); + } + } + + return 0xff; +} + +/* writes always occurs to the RAM banks, even if the ROMs are selected. */ +WRITE8_MEMBER( pasopia7_state::ram_bank_w ) +{ + UINT8 *work_ram = memregion("maincpu")->base(); + + work_ram[offset] = data; +} + +WRITE8_MEMBER( pasopia7_state::pasopia7_6845_w ) +{ + if(offset == 0) + { + m_addr_latch = data; + m_crtc->address_w(space, offset, data); + } + else + { + /* FIXME: this should be inside the MC6845 core! */ + if(m_addr_latch == 0x0a) + m_cursor_raster = data; + if(m_addr_latch == 0x0e) + m_cursor_addr = ((data<<8) & 0x3f00) | (m_cursor_addr & 0xff); + else if(m_addr_latch == 0x0f) + m_cursor_addr = (m_cursor_addr & 0x3f00) | (data & 0xff); + + m_crtc->register_w(space, offset, data); + + /* double pump the pixel clock if we are in 640 x 200 mode */ + if(m_screen_type == 1) // raster + m_crtc->set_clock( (m_x_width) ? VDP_CLOCK*2 : VDP_CLOCK); + else // lcd + m_crtc->set_clock( (m_x_width) ? LCD_CLOCK*2 : LCD_CLOCK); + } +} + +void pasopia7_state::pasopia_nmi_trap() +{ + if(m_nmi_enable_reg) + { + m_nmi_trap |= 2; + + if(m_nmi_mask == 0) + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + } +} + +READ8_MEMBER( pasopia7_state::pasopia7_fdc_r ) +{ + switch(offset) + { + case 4: return m_fdc->msr_r(space, 0, 0xff); + case 5: return m_fdc->fifo_r(space, 0, 0xff); + //case 6: bit 7 interrupt bit + } + + return 0xff; +} + +WRITE8_MEMBER( pasopia7_state::pasopia7_fdc_w ) +{ + switch(offset) + { + case 0: m_fdc->tc_w(false); break; + case 2: m_fdc->tc_w(true); break; + case 5: m_fdc->fifo_w(space, 0, data, 0xff); break; + case 6: + if(data & 0x80) + m_fdc->reset(); + /* TODO */ + m_floppy->mon_w(data & 0x40 ? CLEAR_LINE : ASSERT_LINE); + break; + } +} + + +READ8_MEMBER( pasopia7_state::pasopia7_io_r ) +{ + UINT16 io_port; + + if(m_mio_sel) + { + address_space &ram_space = m_maincpu->space(AS_PROGRAM); + + m_mio_sel = 0; + //printf("%08x\n",offset); + //return 0x0d; // hack: this is used for reading the keyboard data, we can fake it a little ... (modify fda4) + return ram_space.read_byte(offset); + } + + io_port = offset & 0xff; //trim down to 8-bit bus + + if(io_port >= 0x08 && io_port <= 0x0b) + return m_ppi0->read(space, io_port & 3); + else + if(io_port >= 0x0c && io_port <= 0x0f) + return m_ppi1->read(space, io_port & 3); +// else if(io_port == 0x10 || io_port == 0x11) { M6845 read } + else + if(io_port >= 0x18 && io_port <= 0x1b) + return pac2_r(space, io_port & 3); + else + if(io_port >= 0x20 && io_port <= 0x23) + { + pasopia_nmi_trap(); + return m_ppi2->read(space, io_port & 3); + } + else + if(io_port >= 0x28 && io_port <= 0x2b) + return m_ctc->read(space,io_port & 3); + else + if(io_port >= 0x30 && io_port <= 0x33) + return m_pio->read(space, io_port & 3); +// else if(io_port == 0x3a) { SN1 } +// else if(io_port == 0x3b) { SN2 } +// else if(io_port == 0x3c) { bankswitch } + else +// if(io_port >= 0xe0 && io_port <= 0xe6) +// return pasopia7_fdc_r(space, offset & 7); +// else + { + logerror("(PC=%06x) Read i/o address %02x\n",m_maincpu->pc(),io_port); + } + + return 0xff; +} + +WRITE8_MEMBER( pasopia7_state::pasopia7_io_w ) +{ + UINT16 io_port; + + if(m_mio_sel) + { + address_space &ram_space = m_maincpu->space(AS_PROGRAM); + m_mio_sel = 0; + ram_space.write_byte(offset, data); + return; + } + + io_port = offset & 0xff; //trim down to 8-bit bus + + if(io_port >= 0x08 && io_port <= 0x0b) + m_ppi0->write(space, io_port & 3, data); + else + if(io_port >= 0x0c && io_port <= 0x0f) + m_ppi1->write(space, io_port & 3, data); + else + if(io_port >= 0x10 && io_port <= 0x11) + pasopia7_6845_w(space, io_port-0x10, data); + else + if(io_port >= 0x18 && io_port <= 0x1b) + pac2_w(space, io_port & 3, data); + else + if(io_port >= 0x20 && io_port <= 0x23) + { + m_ppi2->write(space, io_port & 3, data); + pasopia_nmi_trap(); + } + else + if(io_port >= 0x28 && io_port <= 0x2b) + m_ctc->write(space, io_port & 3, data); + else + if(io_port >= 0x30 && io_port <= 0x33) + m_pio->write(space, io_port & 3, data); + else + if(io_port == 0x3a) + m_sn1->write(space, 0, data); + else + if(io_port == 0x3b) + m_sn2->write(space, 0, data); + else + if(io_port == 0x3c) + pasopia7_memory_ctrl_w(space,0, data); + else + if(io_port >= 0xe0 && io_port <= 0xe6) + pasopia7_fdc_w(space, offset & 7, data); + else + { + logerror("(PC=%06x) Write i/o address %02x = %02x\n",m_maincpu->pc(),offset,data); + } +} + +static ADDRESS_MAP_START(pasopia7_mem, AS_PROGRAM, 8, pasopia7_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x7fff ) AM_WRITE( ram_bank_w ) + AM_RANGE( 0x0000, 0x3fff ) AM_ROMBANK("bank1") + AM_RANGE( 0x4000, 0x7fff ) AM_ROMBANK("bank2") + AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(vram_r, vram_w ) + AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pasopia7_io, AS_IO, 8, pasopia7_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xffff) AM_READWRITE( pasopia7_io_r, pasopia7_io_w ) +ADDRESS_MAP_END + +/* TODO: where are SPACE and RETURN keys? */ +static INPUT_PORTS_START( pasopia7 ) + PASOPIA_KEYBOARD +INPUT_PORTS_END + +static const gfx_layout p7_chars_8x8 = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout p7_chars_16x16 = +{ + 16,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, + 16*16 +}; + +static GFXDECODE_START( pasopia7 ) + GFXDECODE_ENTRY( "font", 0x00000, p7_chars_8x8, 0, 0x10 ) + GFXDECODE_ENTRY( "kanji", 0x00000, p7_chars_16x16, 0, 0x10 ) +GFXDECODE_END + +READ8_MEMBER( pasopia7_state::mux_r ) +{ + return m_mux_data; +} + +READ8_MEMBER( pasopia7_state::keyb_r ) +{ + const char *const keynames[3][4] = { { "KEY0", "KEY1", "KEY2", "KEY3" }, + { "KEY4", "KEY5", "KEY6", "KEY7" }, + { "KEY8", "KEY9", "KEYA", "KEYB" } }; + int i,j; + UINT8 res; + + res = 0; + for(j=0;j<3;j++) + { + if(m_mux_data & 0x10 << j) + { + for(i=0;i<4;i++) + { + if(m_mux_data & 1 << i) + res |= ioport(keynames[j][i])->read(); + } + } + } + + return res ^ 0xff; +} + +WRITE8_MEMBER( pasopia7_state::mux_w ) +{ + m_mux_data = data; +} + +static const z80_daisy_config p7_daisy[] = +{ + { "z80ctc" }, + { "z80pio" }, +// { "fdc" }, /* TODO */ + { NULL } +}; + +READ8_MEMBER( pasopia7_state::crtc_portb_r ) +{ + // --x- ---- vsync bit + // ---x ---- hardcoded bit, defines if the system screen is raster (1) or LCD (0) + // ---- x--- disp bit + UINT8 vdisp = (machine().first_screen()->vpos() < (m_screen_type ? 200 : 28)) ? 0x08 : 0x00; //TODO: check LCD vpos trigger + UINT8 vsync = vdisp ? 0x00 : 0x20; + + return 0x40 | (m_attr_latch & 0x87) | vsync | vdisp | (m_screen_type << 4); +} + +WRITE8_MEMBER( pasopia7_state::screen_mode_w ) +{ + if(data & 0x5f) + printf("GFX MODE %02x\n",data); + + m_x_width = data & 0x20; + m_gfx_mode = data & 0x80; + +// printf("%02x\n",m_gfx_mode); +} + +WRITE8_MEMBER( pasopia7_state::plane_reg_w ) +{ + //if(data & 0x11) + //printf("PLANE %02x\n",data); + m_plane_reg = data; +} + +WRITE8_MEMBER( pasopia7_state::video_attr_w ) +{ + //printf("VIDEO ATTR %02x | TEXT_PAGE %02x\n",data & 0xf,data & 0x70); + m_attr_data = (data & 0x7) | ((data & 0x8)<<4); +} + +//#include "debugger.h" + +WRITE8_MEMBER( pasopia7_state::video_misc_w ) +{ + /* + --x- ---- blinking + ---x ---- attribute wrap + ---- x--- pal disable + ---- xx-- palette selector (both bits enables this, odd hook-up) + */ +// if(data & 2) +// { +// printf("VIDEO MISC %02x\n",data); +// debugger_break(device->machine()); +// } + m_cursor_blink = data & 0x20; + m_attr_wrap = data & 0x10; +// m_pal_sel = data & 0x02; +} + +WRITE8_MEMBER( pasopia7_state::nmi_mask_w ) +{ + /* + --x- ---- (related to the data rec) + ---x ---- data rec out + ---- --x- sound off + ---- ---x reset NMI & trap + */ +// printf("SYSTEM MISC %02x\n",data); + + if(data & 1) + { + m_nmi_reset &= ~4; + m_nmi_trap &= ~2; + //m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); //guess + } + +} + +/* TODO: investigate on these. */ +READ8_MEMBER( pasopia7_state::unk_r ) +{ + return 0xff;//machine().rand(); +} + +READ8_MEMBER( pasopia7_state::nmi_reg_r ) +{ + //printf("C\n"); + return 0xfc | m_bank_reg;//machine().rand(); +} + +WRITE8_MEMBER( pasopia7_state::nmi_reg_w ) +{ + /* + x--- ---- NMI mask + -x-- ---- NMI enable trap on PPI8255 2 r/w + */ + m_nmi_mask = data & 0x80; + m_nmi_enable_reg = data & 0x40; +} + +READ8_MEMBER( pasopia7_state::nmi_porta_r ) +{ + return 0xff; +} + +READ8_MEMBER( pasopia7_state::nmi_portb_r ) +{ + return 0xf9 | m_nmi_trap | m_nmi_reset; +} + +void pasopia7_state::machine_reset() +{ + UINT8 *bios = memregion("maincpu")->base(); + + membank("bank1")->set_base(bios + 0x10000); + membank("bank2")->set_base(bios + 0x10000); +// membank("bank3")->set_base(bios + 0x10000); +// membank("bank4")->set_base(bios + 0x10000); + + m_nmi_reset |= 4; +} + +/* TODO: palette values are mostly likely to be wrong in there */ +PALETTE_INIT_MEMBER(pasopia7_state,p7_lcd) +{ + int i; + + palette.set_pen_color(0, 0xa0, 0xa8, 0xa0); + + for( i = 1; i < 8; i++) + palette.set_pen_color(i, 0x30, 0x38, 0x10); +} + +void pasopia7_state::fdc_irq(bool state) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); +} + +static SLOT_INTERFACE_START( pasopia7_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( p7_base, pasopia7_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(pasopia7_mem) + MCFG_CPU_IO_MAP(pasopia7_io) + MCFG_CPU_CONFIG(p7_daisy) + + + /* Audio */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("sn1", SN76489A, 1996800) // unknown clock / divider + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_SOUND_ADD("sn2", SN76489A, 1996800) // unknown clock / divider + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_4MHz) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg2)) // beep interface + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(pasopia7_state, mux_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(pasopia7_state, mux_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(pasopia7_state, keyb_r)) + + MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pasopia7_state, unk_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia7_state, screen_mode_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pasopia7_state, crtc_portb_r)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia7_state, plane_reg_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pasopia7_state, video_attr_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pasopia7_state, video_misc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pasopia7_state, nmi_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia7_state, nmi_mask_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pasopia7_state, nmi_portb_r)) + MCFG_I8255_IN_PORTC_CB(READ8(pasopia7_state, nmi_reg_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pasopia7_state, nmi_reg_w)) + + MCFG_UPD765A_ADD("fdc", true, true) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pasopia7_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", pasopia7_floppies, "525hd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( p7_raster, p7_base ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 32-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_VIDEO_START_OVERRIDE(pasopia7_state,pasopia7) + MCFG_SCREEN_UPDATE_DRIVER(pasopia7_state, screen_update_pasopia7) + MCFG_PALETTE_ADD_3BIT_BRG("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pasopia7 ) + + MCFG_MC6845_ADD("crtc", H46505, "screen", VDP_CLOCK) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( p7_lcd, p7_base ) + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_VIDEO_START_OVERRIDE(pasopia7_state,pasopia7) + MCFG_SCREEN_UPDATE_DRIVER(pasopia7_state, screen_update_pasopia7) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(pasopia7_state,p7_lcd) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pasopia7 ) + + MCFG_MC6845_ADD("crtc", H46505, "screen", LCD_CLOCK) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_DEFAULT_LAYOUT( layout_lcd ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pasopia7 ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bios.rom", 0x10000, 0x4000, CRC(b8111407) SHA1(ac93ae62db4c67de815f45de98c79cfa1313857d)) + + ROM_REGION( 0x8000, "basic", ROMREGION_ERASEFF ) + ROM_LOAD( "basic.rom", 0x0000, 0x8000, CRC(8a58fab6) SHA1(5e1a91dfb293bca5cf145b0a0c63217f04003ed1)) + + ROM_REGION( 0x800, "font", ROMREGION_ERASEFF ) + ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(a91c45a9) SHA1(a472adf791b9bac3dfa6437662e1a9e94a88b412)) + + ROM_REGION( 0x20000, "kanji", ROMREGION_ERASEFF ) + ROM_LOAD( "kanji.rom", 0x0000, 0x20000, CRC(6109e308) SHA1(5c21cf1f241ef1fa0b41009ea41e81771729785f)) + + ROM_REGION( 0x8000, "rampac1", ROMREGION_ERASEFF ) +// ROM_LOAD( "rampac1.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) + + ROM_REGION( 0x8000, "rampac2", ROMREGION_ERASEFF ) +// ROM_LOAD( "rampac2.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) + + ROM_REGION( 0x10000, "vram", ROMREGION_ERASE00 ) +ROM_END + +/* using an identical ROMset from now, but the screen type is different */ +ROM_START( pasopia7lcd ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bios.rom", 0x10000, 0x4000, CRC(b8111407) SHA1(ac93ae62db4c67de815f45de98c79cfa1313857d)) + + ROM_REGION( 0x8000, "basic", ROMREGION_ERASEFF ) + ROM_LOAD( "basic.rom", 0x0000, 0x8000, CRC(8a58fab6) SHA1(5e1a91dfb293bca5cf145b0a0c63217f04003ed1)) + + ROM_REGION( 0x800, "font", ROMREGION_ERASEFF ) + ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(a91c45a9) SHA1(a472adf791b9bac3dfa6437662e1a9e94a88b412)) + + ROM_REGION( 0x20000, "kanji", ROMREGION_ERASEFF ) + ROM_LOAD( "kanji.rom", 0x0000, 0x20000, CRC(6109e308) SHA1(5c21cf1f241ef1fa0b41009ea41e81771729785f)) + + ROM_REGION( 0x8000, "rampac1", ROMREGION_ERASEFF ) +// ROM_LOAD( "rampac1.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) + + ROM_REGION( 0x8000, "rampac2", ROMREGION_ERASEFF ) +// ROM_LOAD( "rampac2.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) + + ROM_REGION( 0x10000, "vram", ROMREGION_ERASE00 ) +ROM_END + + +DRIVER_INIT_MEMBER(pasopia7_state,p7_raster) +{ + m_screen_type = 1; + machine().scheduler().timer_pulse(attotime::from_hz(500), timer_expired_delegate(FUNC(pasopia7_state::pio_timer),this)); +} + +DRIVER_INIT_MEMBER(pasopia7_state,p7_lcd) +{ + m_screen_type = 0; + machine().scheduler().timer_pulse(attotime::from_hz(500), timer_expired_delegate(FUNC(pasopia7_state::pio_timer),this)); +} + + +/* Driver */ + +COMP( 1983, pasopia7, 0, 0, p7_raster, pasopia7, pasopia7_state, p7_raster, "Toshiba", "Pasopia 7 (Raster)", MACHINE_NOT_WORKING ) +COMP( 1983, pasopia7lcd, pasopia7, 0, p7_lcd, pasopia7, pasopia7_state, p7_lcd, "Toshiba", "Pasopia 7 (LCD)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/pb1000.c b/src/mame/drivers/pb1000.c new file mode 100644 index 00000000000..44cbb6f0d73 --- /dev/null +++ b/src/mame/drivers/pb1000.c @@ -0,0 +1,571 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Casio PB-1000 / PB-2000c driver + + Driver by Sandro Ronco + + TODO: + - improve the pb2000c gate array emulation + - i/o port + + Known issues: + - the second memory card is not recognized by the HW + + More info: + http://www.itkp.uni-bonn.de/~wichmann/pb1000-wrobel.html + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/hd61700/hd61700.h" +#include "video/hd44352.h" +#include "machine/nvram.h" +#include "sound/beep.h" +#include "rendlay.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class pb1000_state : public driver_device +{ +public: + pb1000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_beeper(*this, "beeper"), + m_hd44352(*this, "hd44352"), + m_card1(*this, "cardslot1"), + m_card2(*this, "cardslot2") + { } + + required_device m_maincpu; + required_device m_beeper; + required_device m_hd44352; + optional_device m_card1; + optional_device m_card2; + + emu_timer *m_kb_timer; + UINT8 m_kb_matrix; + UINT8 m_gatearray[2]; + + memory_region *m_rom_reg; + memory_region *m_card1_reg; + memory_region *m_card2_reg; + + virtual void machine_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE16_MEMBER( gatearray_w ); + DECLARE_WRITE8_MEMBER( lcd_control ); + DECLARE_READ8_MEMBER( lcd_data_r ); + DECLARE_WRITE8_MEMBER( lcd_data_w ); + DECLARE_READ16_MEMBER( pb1000_kb_r ); + DECLARE_READ16_MEMBER( pb2000c_kb_r ); + DECLARE_WRITE8_MEMBER( kb_matrix_w ); + DECLARE_READ8_MEMBER( pb1000_port_r ); + DECLARE_READ8_MEMBER( pb2000c_port_r ); + DECLARE_WRITE8_MEMBER( port_w ); + UINT16 read_touchscreen(UINT8 line); + DECLARE_PALETTE_INIT(pb1000); + TIMER_CALLBACK_MEMBER(keyboard_timer); +}; + +static ADDRESS_MAP_START(pb1000_mem, AS_PROGRAM, 16, pb1000_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE( 0x00000, 0x00bff ) AM_ROM + //AM_RANGE( 0x00c00, 0x00c0f ) AM_NOP //I/O + AM_RANGE( 0x06000, 0x07fff ) AM_RAM AM_SHARE("nvram1") + AM_RANGE( 0x08000, 0x0ffff ) AM_ROMBANK("bank1") + AM_RANGE( 0x18000, 0x1ffff ) AM_RAM AM_SHARE("nvram2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pb2000c_mem, AS_PROGRAM, 16, pb1000_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE( 0x00000, 0x00bff ) AM_ROM + //AM_RANGE( 0x00c00, 0x00c0f ) AM_NOP //I/O + AM_RANGE( 0x00c10, 0x00c11 ) AM_WRITE(gatearray_w) + AM_RANGE( 0x00000, 0x0ffff ) AM_ROMBANK("bank1") + AM_RANGE( 0x10000, 0x1ffff ) AM_RAM AM_SHARE("nvram1") + AM_RANGE( 0x20000, 0x27fff ) AM_DEVREAD("cardslot1", generic_slot_device, read16_rom) + AM_RANGE( 0x28000, 0x2ffff ) AM_RAM AM_SHARE("nvram2") +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( pb1000 ) + PORT_START("KO1") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_7_PAD) + PORT_START("KO2") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("IN") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEMO IN") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('"') PORT_CHAR('!') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("$") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('$') PORT_CHAR('#') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("&") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('&') PORT_CHAR('%') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('\'') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('<') + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('>') + PORT_START("KO3") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OUT") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEMO") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_START("KO4") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CALC") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAL") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_START("KO5") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MENU") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_START("KO6") + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LCKEY") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CONTR") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(')') PORT_CHAR(']') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW ALL") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_DEL) + PORT_START("KO7") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('^') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('}') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_PGUP) PORT_CHAR('(') PORT_CHAR('[') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('\'') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('_') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('@') + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENG") PORT_CODE(KEYCODE_F6) + PORT_START("KO8") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') PORT_CHAR('{') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\\') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('~') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('|') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_START("KO9") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_START("KO10") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ANS") PORT_CODE(KEYCODE_END) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_5_PAD) + PORT_START("KO11") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("KO12") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_LALT) + PORT_START("NULL") + PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED) + + //touchscreen + PORT_START("POSX") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_CROSSHAIR(X, 1, 0, 0) PORT_SENSITIVITY(20) PORT_KEYDELTA(0) + PORT_START("POSY") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_CROSSHAIR(Y, 1, 0, 0) PORT_SENSITIVITY(120) PORT_KEYDELTA(0) + PORT_START("TOUCH") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Touchscreen") +INPUT_PORTS_END + +static INPUT_PORTS_START( pb2000c ) + PORT_START("KO1") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_7_PAD) + PORT_START("KO2") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_START("KO3") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_START("KO4") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_START("KO5") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("|") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEMO") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_START("KO6") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("IN") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OUT") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_START("KO7") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CALC") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ETC") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SS") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ANS") PORT_CODE(KEYCODE_END) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_BACKSLASH2) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_START("KO8") + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW ALL") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_START("KO9") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_START("KO10") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MENU") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAL") PORT_CODE(KEYCODE_F9) + PORT_START("KO11") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_START("KO12") + PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("NULL") + PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +PALETTE_INIT_MEMBER(pb1000_state, pb1000) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + + +static const gfx_layout pb1000_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + { 0, 1, 2, 3, 4, 5, 6, 7}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( pb1000 ) + GFXDECODE_ENTRY( "hd44352", 0x0000, pb1000_charlayout, 0, 1 ) +GFXDECODE_END + +WRITE16_MEMBER( pb1000_state::gatearray_w ) +{ + m_gatearray[offset] = data&0xff; + + if (m_gatearray[0] && m_card1 && m_card1_reg) + membank("bank1")->set_base(m_card1_reg->base()); + else if (m_gatearray[1] && m_card2 && m_card2_reg) + membank("bank1")->set_base(m_card2_reg->base()); + else + membank("bank1")->set_base(m_rom_reg->base()); +} + +WRITE8_MEMBER( pb1000_state::lcd_control ) +{ + m_hd44352->control_write(data); +} + + +READ8_MEMBER( pb1000_state::lcd_data_r ) +{ + return m_hd44352->data_read(); +} + + +WRITE8_MEMBER( pb1000_state::lcd_data_w ) +{ + m_hd44352->data_write(data); +} + + +UINT16 pb1000_state::read_touchscreen(UINT8 line) +{ + UINT8 x = ioport("POSX")->read()/0x40; + UINT8 y = ioport("POSY")->read()/0x40; + + if (ioport("TOUCH")->read()) + { + if (x == line-7) + return (0x1000<read(); + data |= read_touchscreen(line); + } + + } + else + { + data = ioport(bitnames[m_kb_matrix & 0x0f])->read(); + data |= read_touchscreen(m_kb_matrix & 0x0f); + } + + return data; +} + +READ16_MEMBER( pb1000_state::pb2000c_kb_r ) +{ + static const char *const bitnames[] = {"NULL", "KO1", "KO2", "KO3", "KO4", "KO5", "KO6", "KO7", "KO8", "KO9", "KO10", "KO11", "KO12", "NULL", "NULL", "NULL"}; + UINT16 data = 0; + + if ((m_kb_matrix & 0x0f) == 0x0d) + { + //Read all the input lines + for (int line = 1; line <= 12; line++) + { + data |= ioport(bitnames[line])->read(); + } + + } + else + { + data = ioport(bitnames[m_kb_matrix & 0x0f])->read(); + } + + return data; +} + +WRITE8_MEMBER( pb1000_state::kb_matrix_w ) +{ + if (data & 0x80) + { + if ((m_kb_matrix & 0x80) != (data & 0x80)) + m_kb_timer->adjust(attotime::never, 0, attotime::never); + } + else + { + if ((m_kb_matrix & 0x40) != (data & 0x40)) + { + if (data & 0x40) + m_kb_timer->adjust(attotime::from_hz(32), 0, attotime::from_hz(32)); + else + m_kb_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); + } + } + + m_kb_matrix = data; +} + +READ8_MEMBER( pb1000_state::pb1000_port_r ) +{ + //TODO + return 0x00; +} + +READ8_MEMBER( pb1000_state::pb2000c_port_r ) +{ + //TODO + return 0xfc; +} + +WRITE8_MEMBER( pb1000_state::port_w ) +{ + m_beeper->set_state((BIT(data,7) ^ BIT(data,6))); + //printf("%x\n", data); +} + + +TIMER_CALLBACK_MEMBER(pb1000_state::keyboard_timer) +{ + m_maincpu->set_input_line(HD61700_KEY_INT, ASSERT_LINE); + m_maincpu->set_input_line(HD61700_KEY_INT, CLEAR_LINE); +} + +void pb1000_state::machine_start() +{ + std::string region_tag; + m_rom_reg = memregion("rom"); + if (m_card1) + m_card1_reg = memregion(region_tag.assign(m_card1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + if (m_card2) + m_card2_reg = memregion(region_tag.assign(m_card2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + membank("bank1")->set_base(m_rom_reg->base()); + + m_kb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pb1000_state::keyboard_timer),this)); + m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192)); +} + +static MACHINE_CONFIG_START( pb1000, pb1000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD61700, 910000) + MCFG_CPU_PROGRAM_MAP(pb1000_mem) + MCFG_HD61700_LCD_CTRL_CB(WRITE8(pb1000_state, lcd_control)) + MCFG_HD61700_LCD_READ_CB(READ8(pb1000_state, lcd_data_r)) + MCFG_HD61700_LCD_WRITE_CB(WRITE8(pb1000_state, lcd_data_w)) + MCFG_HD61700_KB_READ_CB(READ16(pb1000_state, pb1000_kb_r)) + MCFG_HD61700_KB_WRITE_CB(WRITE8(pb1000_state, kb_matrix_w)) + MCFG_HD61700_PORT_READ_CB(READ8(pb1000_state, pb1000_port_r)) + MCFG_HD61700_PORT_WRITE_CB(WRITE8(pb1000_state, port_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("hd44352", hd44352_device, screen_update) + MCFG_SCREEN_SIZE(192, 32) + MCFG_SCREEN_VISIBLE_AREA(0, 192-1, 0, 32-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(pb1000_state, pb1000) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pb1000 ) + + MCFG_DEVICE_ADD("hd44352", HD44352, 910000) + MCFG_HD44352_ON_CB(INPUTLINE("maincpu", HD61700_ON_INT)) + + MCFG_NVRAM_ADD_0FILL("nvram1") + MCFG_NVRAM_ADD_0FILL("nvram2") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pb2000c, pb1000 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pb2000c_mem) + MCFG_HD61700_KB_READ_CB(READ16(pb1000_state, pb2000c_kb_r)) + MCFG_HD61700_PORT_READ_CB(READ8(pb1000_state, pb2000c_port_r)) + + MCFG_GENERIC_CARTSLOT_ADD("cardslot1", generic_plain_slot, "pb2000c_card") + MCFG_GENERIC_CARTSLOT_ADD("cardslot2", generic_plain_slot, "pb2000c_card") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("card_list", "pb2000c") +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( pb1000 ) + ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hd61700.bin", 0x0000, 0x1800, CRC(b28c21a3) SHA1(be7ea62a15ff0c612f6efb2c95e6c2a11a738423)) + + ROM_REGION( 0x10000, "rom", ROMREGION_ERASE ) + ROM_SYSTEM_BIOS(0, "basic", "BASIC") + ROMX_LOAD( "pb1000.bin", 0x0000, 0x8000, CRC(8127a090) SHA1(067c1c2e7efb5249e95afa7805bb98543b30b630), ROM_BIOS(1) | ROM_SKIP(1)) + ROM_SYSTEM_BIOS(1, "basicj", "BASIC Jap") + ROMX_LOAD( "pb1000j.bin", 0x0000, 0x8000, CRC(14a0df57) SHA1(ab47bb54eb2a24dcd9d2663462e9272d974fa7da), ROM_BIOS(2) | ROM_SKIP(1)) + + ROM_REGION( 0x0800, "hd44352", 0 ) + ROM_LOAD( "charset.bin", 0x0000, 0x0800, CRC(7f144716) SHA1(a02f1ecc6dc0ac55b94f00931d8f5cb6b9ffb7b4)) +ROM_END + + +ROM_START( pb2000c ) + ROM_REGION( 0x1800, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hd61700.bin", 0x0000, 0x1800, CRC(25f9540c) SHA1(ecf98efadbdd4d1a74bc183eaf23f7113f2a12b1)) + + ROM_REGION( 0x20000, "rom", ROMREGION_ERASE ) + ROMX_LOAD( "pb2000c.bin", 0x0000, 0x10000, CRC(41933631) SHA1(70b654dc375b647afa042baf8b0a139e7fa604e8), ROM_SKIP(1)) + + ROM_REGION( 0x0800, "hd44352", 0 ) + ROM_LOAD( "charset.bin", 0x0000, 0x0800, CRC(7f144716) SHA1(a02f1ecc6dc0ac55b94f00931d8f5cb6b9ffb7b4)) +ROM_END + + +ROM_START( ai1000 ) + ROM_REGION( 0x1800, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hd61700.bin", 0x0000, 0x1800, CRC(25f9540c) SHA1(ecf98efadbdd4d1a74bc183eaf23f7113f2a12b1)) + + ROM_REGION( 0x20000, "rom", ROMREGION_ERASE ) + ROMX_LOAD( "ai1000.bin", 0x0000, 0x10000, CRC(72aa3ee3) SHA1(ed1d0bc470902ea73bc4588147a589b1793afb40), ROM_SKIP(1)) + + ROM_REGION( 0x0800, "hd44352", 0 ) + ROM_LOAD( "charset.bin", 0x0000, 0x0800, CRC(7f144716) SHA1(a02f1ecc6dc0ac55b94f00931d8f5cb6b9ffb7b4)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, pb1000 , 0, 0, pb1000 , pb1000 , driver_device, 0, "Casio", "PB-1000", MACHINE_NOT_WORKING) +COMP( 1989, pb2000c, 0, 0, pb2000c, pb2000c, driver_device, 0, "Casio", "PB-2000c", MACHINE_NOT_WORKING) +COMP( 1989, ai1000, pb2000c, 0, pb2000c, pb2000c, driver_device, 0, "Casio", "AI-1000", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/pc.c b/src/mame/drivers/pc.c new file mode 100644 index 00000000000..e362880ef0c --- /dev/null +++ b/src/mame/drivers/pc.c @@ -0,0 +1,475 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Miodrag Milanovic +/*************************************************************************** + + drivers/pc.c + +Driver file for IBM PC, IBM PC XT, and related machines. + + PC-XT memory map + + 00000-9FFFF RAM + A0000-AFFFF NOP or videoram EGA/VGA + B0000-B7FFF videoram MDA, page #0 + B8000-BFFFF videoram CGA and/or MDA page #1, T1T mapped RAM + C0000-C7FFF NOP or ROM EGA/VGA + C8000-C9FFF ROM XT HDC #1 + CA000-CBFFF ROM XT HDC #2 + D0000-EFFFF NOP or 'adapter RAM' + F0000-FDFFF NOP or ROM Basic + other Extensions + FE000-FFFFF ROM + +IBM5550 +======= +Information can be found at http://homepage3.nifty.com/ibm5550/index-e.html +It's an heavily modified IBM PC-XT machine, with a completely different +video HW too. + +***************************************************************************/ + +#include "emu.h" + +#include "cpu/i86/i86.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "bus/pc_kbd/keyboards.h" +#include "includes/genpc.h" + +class pc_state : public driver_device +{ +public: + pc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + required_device m_maincpu; + + DECLARE_READ8_MEMBER(unk_r); + + DECLARE_DRIVER_INIT(bondwell); + + DECLARE_INPUT_CHANGED_MEMBER(pc_turbo_callback); + + double m_turbo_off_speed; +}; + +static ADDRESS_MAP_START( pc8_map, AS_PROGRAM, 8, pc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( zenith_map, AS_PROGRAM, 8, pc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xf7fff) AM_RAM + AM_RANGE(0xf8000, 0xfffff) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( pc16_map, AS_PROGRAM, 16, pc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xbffff) AM_NOP + AM_RANGE(0xc0000, 0xc7fff) AM_ROM + AM_RANGE(0xc8000, 0xcffff) AM_ROM + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ibm5550_map, AS_PROGRAM, 16, pc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xeffff) AM_RAM + AM_RANGE(0xfc000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pc8_io, AS_IO, 8, pc_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pc16_io, AS_IO, 16, pc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0070, 0x007f) AM_RAM // needed for Poisk-2 +ADDRESS_MAP_END + +READ8_MEMBER(pc_state::unk_r) +{ + return 0; +} + +static ADDRESS_MAP_START(ibm5550_io, AS_IO, 16, pc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00a0, 0x00a1) AM_READ8(unk_r, 0x00ff ) +ADDRESS_MAP_END + +INPUT_CHANGED_MEMBER(pc_state::pc_turbo_callback) +{ + m_maincpu->set_clock_scale((newval & 2) ? 1 : m_turbo_off_speed); +} + +DRIVER_INIT_MEMBER(pc_state,bondwell) +{ + m_turbo_off_speed = 4.77/12; +} + +static INPUT_PORTS_START( pccga ) + PORT_START("DSW1") /* IN2 */ + PORT_DIPNAME( 0x80, 0x80, "COM1: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x40, 0x40, "COM2: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x20, 0x00, "COM3: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x10, 0x00, "COM4: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x00, "LPT2: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x02, 0x00, "LPT3: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x01, 0x00, "Game port enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) + + PORT_START("DSW2") /* IN3 */ + PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) + PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ + PORT_BIT( 0x01, 0x01, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( bondwell ) + PORT_INCLUDE(pccga) + + PORT_MODIFY("DSW2") /* IN3 */ + PORT_DIPNAME( 0x02, 0x02, "Turbo Switch" ) PORT_CHANGED_MEMBER(DEVICE_SELF, pc_state, pc_turbo_callback, 0) + PORT_DIPSETTING( 0x00, "Off (4.77 MHz)" ) + PORT_DIPSETTING( 0x02, "On (12 MHz)" ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START( pccga ) + DEVICE_INPUT_DEFAULTS("DSW0", 0x30, 0x20) +DEVICE_INPUT_DEFAULTS_END + +#define MCFG_CPU_PC(mem, port, type, clock) \ + MCFG_CPU_ADD("maincpu", type, clock) \ + MCFG_CPU_PROGRAM_MAP(mem##_map) \ + MCFG_CPU_IO_MAP(port##_io) \ + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + +static MACHINE_CONFIG_START( pccga, pc_state ) + /* basic machine hardware */ + MCFG_CPU_PC(pc8, pc8, I8088, 4772720) /* 4,77 MHz */ + + MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(pccga) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + +static DEVICE_INPUT_DEFAULTS_START( iskr3104 ) + DEVICE_INPUT_DEFAULTS("DSW0", 0x30, 0x00) +DEVICE_INPUT_DEFAULTS_END + +static MACHINE_CONFIG_START( iskr3104, pc_state ) + /* basic machine hardware */ + MCFG_CPU_PC(pc16, pc16, I8086, 4772720) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(iskr3104) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "ega", false) + MCFG_SLOT_OPTION_DEFAULT_BIOS("ega", "iskr3104") + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( poisk2, pc_state ) + /* basic machine hardware */ + MCFG_CPU_PC(pc16, pc16, I8086, 4772720) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(pccga) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga_poisk2", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( zenith, pc_state ) + /* basic machine hardware */ + MCFG_CPU_PC(zenith, pc8, I8088, XTAL_14_31818MHz/3) /* 4,77 MHz */ + + MCFG_IBM5150_MOTHERBOARD_ADD("mb", "maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(pccga) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ibm5550, pc_state ) + /* basic machine hardware */ + MCFG_CPU_PC(ibm5550, ibm5550, I8086, 8000000) + + MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") + MCFG_DEVICE_INPUT_DEFAULTS(pccga) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) + + /* keyboard */ + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(bondwell, pccga) + MCFG_DEVICE_REMOVE("maincpu") + MCFG_CPU_PC(pc8, pc8, I8088, 4772720) // turbo? +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(mk88, poisk2) + MCFG_DEVICE_MODIFY("isa1") + MCFG_SLOT_DEFAULT_OPTION("cga_ec1841") +MACHINE_CONFIG_END + +ROM_START( bw230 ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD("bondwell.bin", 0xfe000, 0x2000, CRC(d435a405) SHA1(a57c705d1144c7b61940b6f5c05d785c272fc9bb)) +ROM_END + +ROM_START( zdsupers ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_SYSTEM_BIOS( 0, "v31d", "v3.1d" ) + ROMX_LOAD( "z184m v3.1d.10d", 0xf8000, 0x8000, CRC(44012c3b) SHA1(f2f28979798874386ca8ba3dd3ead24ae7c2aeb4), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v29e", "v2.9e" ) + ROMX_LOAD( "z184m v2.9e.10d", 0xf8000, 0x8000, CRC(de2f200b) SHA1(ad5ce601669a82351e412fc6c1c70c47779a1e55), ROM_BIOS(2)) +ROM_END + + +ROM_START( dgone ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD( "dgone.bin", 0xf8000, 0x08000, CRC(2c38c86e) SHA1(c0f85a000d1d13cd354965689e925d677822549e)) +ROM_END + +ROM_START( ssam88s ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD( "samsung_samtron_88s_vers_2.0a.bin", 0xf8000, 0x08000, CRC(d1252a91) SHA1(469d15b6ecd7b70234975dc12c6bda4212a66652)) +ROM_END + +ROM_START( mk88 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_DEFAULT_BIOS("v392") + ROM_SYSTEM_BIOS(0, "v290", "v2.90") + ROMX_LOAD( "mk88m.bin", 0xfc000, 0x2000, CRC(09c9da3b) SHA1(d1e7ad23b5f5b3576ad128c1198294129754f39f), ROM_BIOS(1)) + ROMX_LOAD( "mk88b.bin", 0xfe000, 0x2000, CRC(8a922476) SHA1(c19c3644ab92fd12e13f32b410cd26e3c844a03b), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v391", "v3.91") + ROMX_LOAD( "mkm.bin", 0xfc000, 0x2000, CRC(65f979e8) SHA1(13e85be9bc8ceb5ab9e559e7d0089e26fbbb84fc), ROM_BIOS(2)) + ROMX_LOAD( "mkb.bin", 0xfe000, 0x2000, CRC(830a0447) SHA1(11bc200fdbcfbbe335f4c282020750c0b5ca4167), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v392", "v3.92") + ROMX_LOAD( "m88.bin", 0xfc000, 0x2000, CRC(fe1b4e36) SHA1(fcb420af0ff09a7d43fcb9b7d0b0233a2071c159), ROM_BIOS(3)) + ROMX_LOAD( "b88.bin", 0xfe000, 0x2000, CRC(58a418df) SHA1(216398d4e4302ee7efcc2c8f9ff9d8a1161229ea), ROM_BIOS(3)) +ROM_END + +ROM_START( iskr3104 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROMX_LOAD( "198.bin", 0xfc000, 0x2000, CRC(bcfd8e41) SHA1(e21ddf78839aa51fa5feb23f511ff5e2da31b433),ROM_SKIP(1)) + ROMX_LOAD( "199.bin", 0xfc001, 0x2000, CRC(2da5fe79) SHA1(14d5dccc141a0b3367f7f8a7188306fdf03c2b6c),ROM_SKIP(1)) + // EGA card from Iskra-3104 + //ROMX_LOAD( "143-03.bin", 0xc0001, 0x2000, CRC(d0706345) SHA1(e04bb40d944426a4ae2e3a614d3f4953d7132ede),ROM_SKIP(1)) + //ROMX_LOAD( "143-02.bin", 0xc0000, 0x2000, CRC(c8c18ebb) SHA1(fd6dac76d43ab8b582e70f1d5cc931d679036fb9),ROM_SKIP(1)) +ROM_END + +ROM_START( poisk2 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "v20", "v2.0") + ROMX_LOAD( "b_p2_20h.rf4", 0xfc001, 0x2000, CRC(d53189b7) SHA1(ace40f1a40642b51fe5d2874acef81e48768b23b), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "b_p2_20l.rf4", 0xfc000, 0x2000, CRC(2d61fcc9) SHA1(11873c8741ba37d6c2fe1f482296aece514b7618), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v21", "v2.1") + ROMX_LOAD( "b_p2_21h.rf4", 0xfc001, 0x2000, CRC(22197297) SHA1(506c7e63027f734d62ef537f484024548546011f), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "b_p2_21l.rf4", 0xfc000, 0x2000, CRC(0eb2ea7f) SHA1(67bb5fec53ebfa2a5cad2a3d3d595678d6023024), ROM_SKIP(1) | ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v24", "v2.4") + ROMX_LOAD( "b_p2_24h.rf4", 0xfc001, 0x2000, CRC(ea842c9e) SHA1(dcdbf27374149dae0ef76d410cc6c615d9b99372), ROM_SKIP(1) | ROM_BIOS(3)) + ROMX_LOAD( "b_p2_24l.rf4", 0xfc000, 0x2000, CRC(02f21250) SHA1(f0b133fb4470bddf2f7bf59688cf68198ed8ce55), ROM_SKIP(1) | ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v21d", "v2.1d") + ROMX_LOAD( "opp2_1h.rf4", 0xfc001, 0x2000, CRC(b7cd7f4f) SHA1(ac473822fb44d7b898d628732cf0a27fcb4d26d6), ROM_SKIP(1) | ROM_BIOS(4)) + ROMX_LOAD( "opp2_1l.rf4", 0xfc000, 0x2000, CRC(1971dca3) SHA1(ecd61cc7952af834d8abc11db372c3e70775489d), ROM_SKIP(1) | ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v22d", "v2.2d") + ROMX_LOAD( "opp2_2h.rf4", 0xfc001, 0x2000, CRC(b9e3a5cc) SHA1(0a28afbff612471ee81d69a98789e75253c57a30), ROM_SKIP(1) | ROM_BIOS(5)) + ROMX_LOAD( "opp2_2l.rf4", 0xfc000, 0x2000, CRC(6877aad6) SHA1(1d0031d044beb4f9f321e3c8fdedf57467958900), ROM_SKIP(1) | ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "v23d", "v2.3d") + ROMX_LOAD( "opp2_3h.rf4", 0xfc001, 0x2000, CRC(ac7d4f06) SHA1(858d6e084a38814280b3e29fb54971f4f532e484), ROM_SKIP(1) | ROM_BIOS(6)) + ROMX_LOAD( "opp2_3l.rf4", 0xfc000, 0x2000, CRC(3c877ea1) SHA1(0753168659653538311c0ad1df851cbbdba426f4), ROM_SKIP(1) | ROM_BIOS(6)) +ROM_END + +ROM_START( mc1702 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_LOAD16_BYTE( "2764_2_(573rf4).rom", 0xfc000, 0x2000, CRC(34a0c8fb) SHA1(88dc247f2e417c2848a2fd3e9b52258ad22a2c07)) + ROM_LOAD16_BYTE( "2764_3_(573rf4).rom", 0xfc001, 0x2000, CRC(68ab212b) SHA1(f3313f77392877d28ce290ffa3432f0a32fc4619)) + ROM_LOAD( "ba1m_(573rf5).rom", 0x0000, 0x0800, CRC(08d938e8) SHA1(957b6c691dbef75c1c735e8e4e81669d056971e4)) +ROM_END + +ROM_START( ibm5550 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROM_LOAD( "ipl5550.rom", 0xfc000, 0x4000, CRC(40cf34c9) SHA1(d41f77fdfa787b0e97ed311e1c084b8699a5b197)) +ROM_END + +ROM_START( pc7000 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + ROMX_LOAD( "mitsubishi-m5l27128k-1.bin", 0xf8000, 0x4000, CRC(9683957f) SHA1(4569eab6d88eb1bba0d553d1358e593c326978aa), ROM_SKIP(1)) + ROMX_LOAD( "mitsubishi-m5l27128k-2.bin", 0xf8001, 0x4000, CRC(99b229a4) SHA1(5800c8bafed26873d8cfcc79a05f93a780a31c91), ROM_SKIP(1)) +ROM_END + +ROM_START( olivm15 ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD( "oliv_m15.bin",0xfc000, 0x04000, CRC(bf2ef795) SHA1(02d497131f5ca2c78f2accd38ab0eab6813e3ebf)) +ROM_END + +ROM_START( sx16 ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD( "tmm27128ad.bin",0xfc000, 0x4000, CRC(f8543362) SHA1(fef625e260ca89ba02174584bdc12db609f0780e)) +ROM_END + +ROM_START( compc1 ) + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD("380270-01.bin", 0xfc000, 0x4000, BAD_DUMP CRC(75135d37) SHA1(177283642240fee191ba2d87e1d0c2a377c78ccb)) + ROM_REGION(0x8000, "gfx1", 0) + ROM_LOAD("pc1_char.bin", 0x0000, 0x8000, CRC(4773a945) SHA1(bcc38abecc75d3f641d42987cb0d2ed71d71bc4c)) +ROM_END + +// Note: Commodore PC20-III, PC10-III and COLT share the same BIOS +ROM_START( pc10iii ) + ROM_REGION(0x100000, "maincpu", 0) + ROM_DEFAULT_BIOS("v441") + ROM_SYSTEM_BIOS(0, "v435", "v4.35") + ROMX_LOAD("318085-01.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v436", "v4.36") + ROMX_LOAD("318085-02.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v436c", "v4.36c") + ROMX_LOAD("318085-04.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v438", "v4.38") + ROMX_LOAD("318085-05.u201", 0xf8000, 0x8000, CRC(ae9e6a31) SHA1(853ee251cf230818c407a8d13ef060a21c90a8c1), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v439", "v4.39") + ROMX_LOAD("318085-06.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "v440", "v4.40") + ROMX_LOAD("318085-07.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "v441", "v4.41") + ROMX_LOAD("318085-08.u201", 0xf8000, 0x8000, CRC(7e228dc8) SHA1(958dfdd637bd31c01b949fac729d6973a7e630bc), ROM_BIOS(7)) + ROM_REGION(0x8000, "gfx1", 0) + ROM_LOAD("318086-02.u607", 0x0000, 0x8000, CRC(b406651c) SHA1(856f58353391a74a06ebb8ec9f8333d7d69e5fd6)) + //ROM_LOAD("5788005.u33", 0x00000, 0x2000, BAD_DUMP CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* temp so you can read the text */ +ROM_END + +ROM_START( mbc16 ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD( "mbc16.bin", 0xfc000, 0x4000, CRC(f3e0934a) SHA1(e4b91c3d395be0414e20f23ad4919b8ac52639b2)) + ROM_REGION(0x2000,"gfx1", 0) + //ATI Graphics Solution SR (graphics card, need to make it ISA card) + ROM_LOAD( "atigssr.bin", 0x0000, 0x2000, CRC(aca81498) SHA1(0d84c89487ee7a6ac4c9e73fdb30c5fd8aa595f8)) +ROM_END + +ROM_START( ataripc3 ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD( "c101701-004 308.u61",0xf8000, 0x8000, CRC(929a2443) SHA1(8e98f3c9180c55b1f5521727779c016083d27960)) + + ROM_REGION(0x8000,"gfx1", 0) + ROM_LOAD("5788005.u33", 0x00000, 0x2000, BAD_DUMP CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) // not the real character ROM + + ROM_REGION(0x8000,"plds", 0) + ROM_LOAD( "c101681 6ffb.u60",0x000, 0x100, NO_DUMP ) // PAL20L10NC +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1984, dgone, ibm5150, 0, pccga, pccga, driver_device, 0, "Data General", "Data General/One" , MACHINE_NOT_WORKING)/* CGA, 2x 3.5" disk drives */ +COMP( 1985, bw230, ibm5150, 0, bondwell, bondwell, pc_state, bondwell, "Bondwell Holding", "BW230 (PRO28 Series)", 0 ) +COMP( 1984, compc1, ibm5150, 0, pccga, pccga, driver_device, 0, "Commodore Business Machines", "Commodore PC-1" , MACHINE_NOT_WORKING) +COMP( 1987, pc10iii, ibm5150, 0, pccga, pccga, driver_device, 0, "Commodore Business Machines", "Commodore PC-10 III" , MACHINE_NOT_WORKING) + +COMP( 1992, iskr3104, ibm5150, 0, iskr3104, pccga, driver_device, 0, "Schetmash", "Iskra 3104", MACHINE_NOT_WORKING) +COMP( 1989, mk88, ibm5150, 0, mk88, pccga, driver_device, 0, "", "MK-88", MACHINE_NOT_WORKING) +COMP( 1991, poisk2, ibm5150, 0, poisk2, pccga, driver_device, 0, "", "Poisk-2", MACHINE_NOT_WORKING) +COMP( 1990, mc1702, ibm5150, 0, pccga, pccga, driver_device, 0, "", "Elektronika MC-1702", MACHINE_NOT_WORKING) + +COMP( 1987, zdsupers, ibm5150, 0, zenith, pccga, driver_device, 0, "Zenith Data Systems", "SuperSport", 0) + +COMP( 198?, olivm15, ibm5150, 0, pccga, pccga, driver_device, 0, "Olivetti", "M15", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // is this a pc clone or not? + +COMP( 1983, ibm5550, ibm5150, 0, ibm5550, pccga, driver_device, 0, "International Business Machines", "IBM 5550", MACHINE_NOT_WORKING) + +COMP( 1985, pc7000, ibm5150, 0, pccga, pccga, driver_device, 0, "Sharp", "PC-7000", MACHINE_NOT_WORKING) + +COMP( 1988, sx16, ibm5150, 0, pccga, pccga, driver_device, 0, "Sanyo", "SX-16", MACHINE_NOT_WORKING) +COMP( 198?, mbc16, ibm5150, 0, pccga, pccga, driver_device, 0, "Sanyo", "MBC-16" , MACHINE_NOT_WORKING) + +COMP( 198?, ataripc3, ibm5150, 0, pccga, pccga, driver_device, 0, "Atari", "PC-3" , MACHINE_NOT_WORKING) +COMP( 1989, ssam88s, ibm5150, 0, pccga, pccga, driver_device, 0, "Samsung", "Samtron 88S" , MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/pc100.c b/src/mame/drivers/pc100.c new file mode 100644 index 00000000000..5c23a8f1934 --- /dev/null +++ b/src/mame/drivers/pc100.c @@ -0,0 +1,520 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-100 + + preliminary driver by Angelo Salese + Thanks to Carl for the i8259 tip; + + TODO: + - floppy support (no images available right now); + - i8259 works in edge triggering mode, kludged to work somehow. + + Notes: + - First two POST checks are for the irqs, first one checks the timer irq: + F8209: B8 FB 00 mov ax,0FBh + F820C: E6 02 out 2h,al + F820E: B9 00 00 mov cx,0h + F8211: FB sti + F8212: 0A E4 or ah,ah <- irq fires here + F8214: E1 FC loopz 0F8212h + F8216: FA cli + F8217: 0A E9 or ch,cl + F8219: 74 15 je 0F8230h + - Second one is for the vblank irq timing: + F8238: 8B D3 mov dx,bx + F823A: 8B D9 mov bx,cx + F823C: CF iret + F824D: E4 02 in al,2h + F824F: 8A E0 mov ah,al + F8251: B0 EF mov al,0EFh + F8253: E6 02 out 2h,al + F8255: BB 00 00 mov bx,0h + F8258: BA 00 00 mov dx,0h + F825B: B9 20 4E mov cx,4E20h + F825E: FB sti + F825F: E2 FE loop 0F825Fh ;calculates the vblank here + F8261: FA cli + F8262: 8A C4 mov al,ah + F8264: E6 02 out 2h,al + F8266: 2B D3 sub dx,bx + F8268: 81 FA 58 1B cmp dx,1B58h + F826C: 78 06 js 0F8274h ;error if DX is smaller than 0x1b58 + F826E: 81 FA 40 1F cmp dx,1F40h + F8272: 78 0A js 0F827Eh ;error if DX is greater than 0x1f40 + F8274: B1 05 mov cl,5h + F8276: E8 CB 03 call 0F8644h + F8279: E8 79 FF call 0F81F5h + F827C: EB FE jmp 0F827Ch + F827E: B0 FF mov al,0FFh + fwiw with current timings, we get DX=0x1f09, enough for passing the test; + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "imagedev/flopdrv.h" +#include "formats/mfi_dsk.h" +#include "formats/d88_dsk.h" +#include "machine/i8255.h" +#include "machine/pic8259.h" +#include "machine/upd765.h" +#include "machine/msm58321.h" +#include "sound/beep.h" + +class pc100_state : public driver_device +{ +public: + pc100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_beeper(*this, "beeper"), + m_rtc(*this, "rtc"), + m_palette(*this, "palette"), + m_kanji_rom(*this, "kanji"), + m_vram(*this, "vram"), + m_rtc_portc(0) + { + } + + required_device m_maincpu; + required_device m_beeper; + required_device m_rtc; + required_device m_palette; + required_region_ptr m_kanji_rom; + required_region_ptr m_vram; + + DECLARE_READ16_MEMBER(pc100_vram_r); + DECLARE_WRITE16_MEMBER(pc100_vram_w); + DECLARE_READ16_MEMBER(pc100_kanji_r); + DECLARE_WRITE16_MEMBER(pc100_kanji_w); + DECLARE_READ8_MEMBER(pc100_key_r); + DECLARE_WRITE8_MEMBER(pc100_output_w); + DECLARE_WRITE8_MEMBER(pc100_tc_w); + DECLARE_READ8_MEMBER(pc100_shift_r); + DECLARE_WRITE8_MEMBER(pc100_shift_w); + DECLARE_READ8_MEMBER(pc100_vs_vreg_r); + DECLARE_WRITE8_MEMBER(pc100_vs_vreg_w); + DECLARE_WRITE8_MEMBER(pc100_crtc_addr_w); + DECLARE_WRITE8_MEMBER(pc100_crtc_data_w); + DECLARE_WRITE8_MEMBER(lower_mask_w); + DECLARE_WRITE8_MEMBER(upper_mask_w); + DECLARE_WRITE8_MEMBER(crtc_bank_w); + DECLARE_WRITE8_MEMBER(rtc_porta_w); + DECLARE_READ8_MEMBER(rtc_portc_r); + DECLARE_WRITE8_MEMBER(rtc_portc_w); + UINT16 m_kanji_addr; + UINT8 m_timer_mode; + + UINT8 m_bank_r,m_bank_w; + + struct{ + UINT8 shift; + UINT16 mask; + UINT16 vstart; + UINT8 addr; + UINT8 reg[8]; + }m_crtc; + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_pc100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(pc100_vblank_irq); + TIMER_DEVICE_CALLBACK_MEMBER(pc100_600hz_irq); + TIMER_DEVICE_CALLBACK_MEMBER(pc100_100hz_irq); + TIMER_DEVICE_CALLBACK_MEMBER(pc100_50hz_irq); + TIMER_DEVICE_CALLBACK_MEMBER(pc100_10hz_irq); + + + WRITE_LINE_MEMBER(rtc_portc_0_w) { m_rtc_portc = (m_rtc_portc & ~(1 << 0)) | ((state & 1) << 0); } + WRITE_LINE_MEMBER(rtc_portc_1_w) { m_rtc_portc = (m_rtc_portc & ~(1 << 1)) | ((state & 1) << 1); } + WRITE_LINE_MEMBER(rtc_portc_2_w) { m_rtc_portc = (m_rtc_portc & ~(1 << 2)) | ((state & 1) << 2); } + WRITE_LINE_MEMBER(rtc_portc_3_w) { m_rtc_portc = (m_rtc_portc & ~(1 << 3)) | ((state & 1) << 3); } + UINT8 m_rtc_portc; +}; + +void pc100_state::video_start() +{ +} + +UINT32 pc100_state::screen_update_pc100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + int count; + int xi; + int dot; + int pen[4],pen_i; + + count = ((m_crtc.vstart + 0x20) * 0x40); + + for(y=0;y<512;y++) + { + count &= 0xffff; + + for(x=0;x<1024/16;x++) + { + for(xi=0;xi<16;xi++) + { + for(pen_i=0;pen_i<4;pen_i++) + pen[pen_i] = (m_vram[count+pen_i*0x10000] >> xi) & 1; + + dot = 0; + for(pen_i=0;pen_i<4;pen_i++) + dot |= pen[pen_i]<pen(dot); + } + + count++; + } + } + + return 0; +} + +READ16_MEMBER( pc100_state::pc100_vram_r ) +{ + return m_vram[offset+m_bank_r*0x10000]; +} + +WRITE16_MEMBER( pc100_state::pc100_vram_w ) +{ + UINT16 old_vram; + int i; + + for(i=0;i<4;i++) + { + if((m_bank_w >> i) & 1) + { + old_vram = m_vram[offset+i*0x10000]; + COMBINE_DATA(&m_vram[offset+i*0x10000]); + m_vram[offset+i*0x10000] = ((m_vram[offset+i*0x10000]|(m_vram[offset+i*0x10000]<<16)) >> m_crtc.shift); + if(ACCESSING_BITS_0_15) + m_vram[offset+i*0x10000] = (m_vram[offset+i*0x10000] & ~m_crtc.mask) | (old_vram & m_crtc.mask); + else if(ACCESSING_BITS_8_15) + m_vram[offset+i*0x10000] = (m_vram[offset+i*0x10000] & ((~m_crtc.mask) & 0xff00)) | (old_vram & (m_crtc.mask|0xff)); + else if(ACCESSING_BITS_0_7) + m_vram[offset+i*0x10000] = (m_vram[offset+i*0x10000] & ((~m_crtc.mask) & 0xff)) | (old_vram & (m_crtc.mask|0xff00)); + + } + } +} + +static ADDRESS_MAP_START(pc100_map, AS_PROGRAM, 16, pc100_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0xbffff) AM_RAM // work ram + AM_RANGE(0xc0000,0xdffff) AM_READWRITE(pc100_vram_r,pc100_vram_w) // vram, blitter based! + AM_RANGE(0xf8000,0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +READ16_MEMBER( pc100_state::pc100_kanji_r ) +{ + return m_kanji_rom[m_kanji_addr]; +} + + +WRITE16_MEMBER( pc100_state::pc100_kanji_w ) +{ + COMBINE_DATA(&m_kanji_addr); +} + +READ8_MEMBER( pc100_state::pc100_key_r ) +{ + if(offset) + return ioport("DSW")->read(); // bit 5: horizontal/vertical monitor dsw + + return 0; +} + +WRITE8_MEMBER( pc100_state::pc100_output_w ) +{ + if(offset == 0) + { + m_timer_mode = (data & 0x18) >> 3; + m_beeper->set_state(((data & 0x40) >> 6) ^ 1); + printf("%02x\n",data & 0xc0); + } +} + +WRITE8_MEMBER( pc100_state::pc100_tc_w ) +{ + machine().device("upd765")->tc_w(data & 0x40); +} + +READ8_MEMBER( pc100_state::pc100_shift_r ) +{ + return m_crtc.shift; +} + +WRITE8_MEMBER( pc100_state::pc100_shift_w ) +{ + m_crtc.shift = data & 0xf; +} + +READ8_MEMBER( pc100_state::pc100_vs_vreg_r ) +{ + if(offset) + return m_crtc.vstart >> 8; + + return m_crtc.vstart & 0xff; +} + +WRITE8_MEMBER( pc100_state::pc100_vs_vreg_w ) +{ + if(offset) + m_crtc.vstart = (m_crtc.vstart & 0xff) | (data << 8); + else + m_crtc.vstart = (m_crtc.vstart & 0xff00) | (data & 0xff); +} + +WRITE8_MEMBER( pc100_state::pc100_crtc_addr_w ) +{ + m_crtc.addr = data & 7; +} + +WRITE8_MEMBER( pc100_state::pc100_crtc_data_w ) +{ + m_crtc.reg[m_crtc.addr] = data; + printf("%02x %02x\n",m_crtc.addr,data); +} + + +/* everything is 8-bit bus wide */ +static ADDRESS_MAP_START(pc100_io, AS_IO, 16, pc100_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) // i8259 +// AM_RANGE(0x04, 0x07) i8237? + AM_RANGE(0x08, 0x0b) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff ) // upd765 + AM_RANGE(0x10, 0x17) AM_DEVREADWRITE8("ppi8255_1", i8255_device, read, write,0x00ff) // i8255 #1 + AM_RANGE(0x18, 0x1f) AM_DEVREADWRITE8("ppi8255_2", i8255_device, read, write,0x00ff) // i8255 #2 + AM_RANGE(0x20, 0x23) AM_READ8(pc100_key_r,0x00ff) //i/o, keyboard, mouse + AM_RANGE(0x22, 0x23) AM_WRITE8(pc100_output_w,0x00ff) //i/o, keyboard, mouse + AM_RANGE(0x24, 0x25) AM_WRITE8(pc100_tc_w,0x00ff) //i/o, keyboard, mouse +// AM_RANGE(0x28, 0x2b) i8251 + AM_RANGE(0x30, 0x31) AM_READWRITE8(pc100_shift_r,pc100_shift_w,0x00ff) // crtc shift + AM_RANGE(0x38, 0x39) AM_WRITE8(pc100_crtc_addr_w,0x00ff) //crtc address reg + AM_RANGE(0x3a, 0x3b) AM_WRITE8(pc100_crtc_data_w,0x00ff) //crtc data reg + AM_RANGE(0x3c, 0x3f) AM_READWRITE8(pc100_vs_vreg_r,pc100_vs_vreg_w,0x00ff) //crtc vertical start position + AM_RANGE(0x40, 0x5f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") +// AM_RANGE(0x60, 0x61) crtc command (16-bit wide) + AM_RANGE(0x80, 0x81) AM_READWRITE(pc100_kanji_r,pc100_kanji_w) + AM_RANGE(0x82, 0x83) AM_WRITENOP //kanji-related? + AM_RANGE(0x84, 0x87) AM_WRITENOP //kanji "strobe" signal 0/1 +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( pc100 ) + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x01, "DSW" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "Monitor" ) + PORT_DIPSETTING( 0x20, "Horizontal" ) + PORT_DIPSETTING( 0x00, "Vertical" ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +static const gfx_layout kanji_layout = +{ + 16, 16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8 }, + { STEP16(0,16) }, + 16*16 +}; + +static GFXDECODE_START( pc100 ) + GFXDECODE_ENTRY( "kanji", 0x0000, kanji_layout, 8, 1 ) +GFXDECODE_END + +/* TODO: untested */ +WRITE8_MEMBER( pc100_state::rtc_porta_w ) +{ +/* + ---- -x-- chip select + ---- --x- read + ---- ---x write +*/ + + m_rtc->write_w((data >> 0) & 1); + m_rtc->read_w((data >> 1) & 1); + m_rtc->cs1_w((data >> 2) & 1); +} + +WRITE8_MEMBER( pc100_state::rtc_portc_w ) +{ + m_rtc->d0_w((data >> 0) & 1); + m_rtc->d1_w((data >> 1) & 1); + m_rtc->d2_w((data >> 2) & 1); + m_rtc->d3_w((data >> 3) & 1); +} + +READ8_MEMBER( pc100_state::rtc_portc_r ) +{ + return m_rtc_portc; +} + +WRITE8_MEMBER( pc100_state::lower_mask_w ) +{ + m_crtc.mask = (m_crtc.mask & 0xff00) | data; +} + +WRITE8_MEMBER( pc100_state::upper_mask_w ) +{ + m_crtc.mask = (m_crtc.mask & 0xff) | (data << 8); +} + +WRITE8_MEMBER( pc100_state::crtc_bank_w ) +{ + m_bank_w = data & 0xf; + m_bank_r = (data & 0x30) >> 4; +} + +void pc100_state::machine_start() +{ +} + +void pc100_state::machine_reset() +{ + m_beeper->set_frequency(2400); + m_beeper->set_state(0); +} + +INTERRUPT_GEN_MEMBER(pc100_state::pc100_vblank_irq) +{ + machine().device("pic8259")->ir4_w(0); + machine().device("pic8259")->ir4_w(1); +} + +TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_600hz_irq) +{ + if(m_timer_mode == 0) + { + machine().device("pic8259")->ir2_w(0); + machine().device("pic8259")->ir2_w(1); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_100hz_irq) +{ + if(m_timer_mode == 1) + { + machine().device("pic8259")->ir2_w(0); + machine().device("pic8259")->ir2_w(1); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_50hz_irq) +{ + if(m_timer_mode == 2) + { + machine().device("pic8259")->ir2_w(0); + machine().device("pic8259")->ir2_w(1); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_10hz_irq) +{ + if(m_timer_mode == 3) + { + machine().device("pic8259")->ir2_w(0); + machine().device("pic8259")->ir2_w(1); + } +} + +static SLOT_INTERFACE_START( pc100_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +#define MASTER_CLOCK 6988800 + +static MACHINE_CONFIG_START( pc100, pc100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, MASTER_CLOCK) + MCFG_CPU_PROGRAM_MAP(pc100_map) + MCFG_CPU_IO_MAP(pc100_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc100_state, pc100_vblank_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("600hz", pc100_state, pc100_600hz_irq, attotime::from_hz(MASTER_CLOCK/600)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("100hz", pc100_state, pc100_100hz_irq, attotime::from_hz(MASTER_CLOCK/100)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("50hz", pc100_state, pc100_50hz_irq, attotime::from_hz(MASTER_CLOCK/50)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("10hz", pc100_state, pc100_10hz_irq, attotime::from_hz(MASTER_CLOCK/10)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pc100_state, rtc_porta_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pc100_state, rtc_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc100_state, rtc_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pc100_state, lower_mask_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pc100_state, upper_mask_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc100_state, crtc_bank_w)) + + MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), GND, NULL ) + + MCFG_UPD765A_ADD("upd765", true, true) + + MCFG_DEVICE_ADD("rtc", MSM58321, XTAL_32_768kHz) + MCFG_MSM58321_D0_HANDLER(WRITELINE(pc100_state, rtc_portc_0_w)) + MCFG_MSM58321_D1_HANDLER(WRITELINE(pc100_state, rtc_portc_1_w)) + MCFG_MSM58321_D2_HANDLER(WRITELINE(pc100_state, rtc_portc_2_w)) + MCFG_MSM58321_D3_HANDLER(WRITELINE(pc100_state, rtc_portc_3_w)) + + MCFG_FLOPPY_DRIVE_ADD("upd765:0", pc100_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", pc100_floppies, "525hd", floppy_image_device::default_floppy_formats) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + /* TODO: Unknown Pixel Clock and CRTC is dynamic */ + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK*4, 1024, 0, 768, 264*2, 0, 512) + MCFG_SCREEN_UPDATE_DRIVER(pc100_state, screen_update_pc100) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc100) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_FORMAT(xxxxxxxBBBGGGRRR) + + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pc100 ) + ROM_REGION16_LE( 0x8000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x8000, CRC(fd54a80e) SHA1(605a1b598e623ba2908a14a82454b9d32ea3c331)) + + ROM_REGION16_LE( 0x20000, "kanji", ROMREGION_ERASEFF ) + ROM_LOAD( "kanji.rom", 0x0000, 0x20000, BAD_DUMP CRC(29298591) SHA1(d10174553ceea556fc53fc4e685d939524a4f64b)) + + ROM_REGION16_LE( 0x20000*4, "vram", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, pc100, 0, 0, pc100, pc100, driver_device, 0, "NEC", "PC-100", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/pc1500.c b/src/mame/drivers/pc1500.c new file mode 100644 index 00000000000..6f91939c9c5 --- /dev/null +++ b/src/mame/drivers/pc1500.c @@ -0,0 +1,298 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Sharp pocket computers 1500 + + Driver by Sandro Ronco + + More info: + http://www.pc1500.com/ + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/lh5801/lh5801.h" +#include "machine/lh5810.h" +#include "machine/upd1990a.h" +#include "pc1500.lh" + + +class pc1500_state : public driver_device +{ +public: + pc1500_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_rtc(*this, "upd1990a"), + m_lcd_data(*this, "lcd_data"), + m_keyboard(*this, "KEY"), + m_io_on(*this, "ON") { } + + required_device m_maincpu; + required_device m_rtc; + + required_shared_ptr m_lcd_data; + required_ioport_array<8> m_keyboard; + required_ioport m_io_on; + + UINT8 m_kb_matrix; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( kb_matrix_w ); + DECLARE_READ8_MEMBER( port_a_r ); + DECLARE_READ8_MEMBER( port_b_r ); + DECLARE_WRITE8_MEMBER( port_c_w ); + + DECLARE_READ8_MEMBER( pc1500_kb_r ); + DECLARE_PALETTE_INIT(pc1500); +}; + +static ADDRESS_MAP_START( pc1500_mem , AS_PROGRAM, 8, pc1500_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x3fff) AM_ROM //module ROM/RAM + AM_RANGE( 0x4000, 0x47ff) AM_RAM //user RAM + AM_RANGE( 0x4800, 0x6fff) AM_RAM //expansion RAM + AM_RANGE( 0x7000, 0x71ff) AM_RAM AM_MIRROR(0x0600) AM_SHARE("lcd_data") + AM_RANGE( 0x7800, 0x7bff) AM_RAM AM_REGION("maincpu", 0x7800) AM_MIRROR(0x0400) + AM_RANGE( 0xa000, 0xbfff) AM_ROM //expansion ROM + AM_RANGE( 0xc000, 0xffff) AM_ROM //system ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1500_mem_io , AS_IO, 8, pc1500_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0xf000, 0xf00f) AM_DEVREADWRITE("lh5810", lh5810_device, data_r, data_w) +ADDRESS_MAP_END + +READ8_MEMBER( pc1500_state::pc1500_kb_r ) +{ + UINT8 data = 0xff; + + if (!started()) return 0; + + for (int i = 0; i < 8; i++) + { + if (!BIT(m_kb_matrix, i)) + data &= m_keyboard[i]->read(); + } + + return data; +} + +UINT32 pc1500_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0, cliprect); + + for (int p=0; p<=1; p++) + for (int a=0; a<0x4e; a++) + { + UINT8 data = m_lcd_data[a + (p<<8)]; + for (int b=0; b<8; b++) + { + if(b<4) + bitmap.pix16(b + 4 * (BIT( a, 0)), (a>>1) + 0x00 + 0x27*p) = BIT(data, b); + else + bitmap.pix16(b - 4 * (BIT(~a, 0)), (a>>1) + 0x4e + 0x27*p) = BIT(data, b); + } + } + + output_set_value("BUSY", BIT(m_lcd_data[0x4e], 0)); + output_set_value("SHIFT", BIT(m_lcd_data[0x4e], 1)); + output_set_value("SML", BIT(m_lcd_data[0x4e], 2)); + output_set_value("SMALL", BIT(m_lcd_data[0x4e], 3)); + output_set_value("III", BIT(m_lcd_data[0x4e], 4)); + output_set_value("II", BIT(m_lcd_data[0x4e], 5)); + output_set_value("I", BIT(m_lcd_data[0x4e], 6)); + output_set_value("DEF", BIT(m_lcd_data[0x4e], 7)); + output_set_value("DE", BIT(m_lcd_data[0x4f], 0)); + output_set_value("G", BIT(m_lcd_data[0x4f], 1)); + output_set_value("RAD", BIT(m_lcd_data[0x4f], 2)); + output_set_value("RESERVE", BIT(m_lcd_data[0x4f], 4)); + output_set_value("PRO", BIT(m_lcd_data[0x4f], 5)); + output_set_value("RUN", BIT(m_lcd_data[0x4f], 6)); + + return 0; +} + +void pc1500_state::machine_reset() +{ + m_kb_matrix = 0xff; + m_rtc->cs_w(1); +} + +static INPUT_PORTS_START( pc1500 ) + + PORT_START("ON") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) + + PORT_START("KEY.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + + PORT_START("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_X) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ST") PORT_CODE(KEYCODE_F8) + + PORT_START("KEY.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + + PORT_START("KEY.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + + PORT_START("KEY.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RCL") PORT_CODE(KEYCODE_F7) + + PORT_START("KEY.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) + + PORT_START("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SML") PORT_CODE(KEYCODE_PGDN) + + PORT_START("KEY.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) +INPUT_PORTS_END + + +WRITE8_MEMBER( pc1500_state::kb_matrix_w ) +{ + m_kb_matrix = data; +} + +WRITE8_MEMBER( pc1500_state::port_c_w ) +{ + m_rtc->data_in_w(BIT(data, 0)); + m_rtc->stb_w(BIT(data, 1)); + m_rtc->clk_w(BIT(data, 2)); + m_rtc->oe_w(BIT(data, 3)); + m_rtc->c0_w(BIT(data, 3)); + m_rtc->c1_w(BIT(data, 4)); + m_rtc->c2_w(BIT(data, 5)); +} + +READ8_MEMBER( pc1500_state::port_b_r ) +{ + /* + x--- ---- ON/Break key + -xx- ---- upd1990ac + ---x ---- GND + ---- x--- Japan: GND, export: VCC + ---- -x-- cassette in + ---- --xx connector + */ + UINT8 data = 0; + + data |= 0x08; + + data |= (m_rtc->tp_r()<<5); + data |= (m_rtc->data_out_r()<<6); + data |= (m_io_on->read()<<7); + + return data; +} + +READ8_MEMBER( pc1500_state::port_a_r ) +{ + return 0xff; +} + +PALETTE_INIT_MEMBER(pc1500_state, pc1500) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static MACHINE_CONFIG_START( pc1500, pc1500_state ) + MCFG_CPU_ADD("maincpu", LH5801, 1300000) //1.3 MHz + MCFG_CPU_PROGRAM_MAP( pc1500_mem ) + MCFG_CPU_IO_MAP( pc1500_mem_io ) + MCFG_LH5801_IN(READ8(pc1500_state,pc1500_kb_r)) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate + MCFG_SCREEN_UPDATE_DRIVER(pc1500_state, screen_update) + MCFG_SCREEN_SIZE(156, 8) + MCFG_SCREEN_VISIBLE_AREA(0, 156-1, 0, 7-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_pc1500) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(pc1500_state, pc1500) + + MCFG_DEVICE_ADD("lh5810", LH5810, 0) + MCFG_LH5810_PORTA_R_CB(READ8(pc1500_state, port_a_r)) + MCFG_LH5810_PORTA_W_CB(WRITE8(pc1500_state, kb_matrix_w)) + MCFG_LH5810_PORTB_R_CB(READ8(pc1500_state, port_b_r)) + MCFG_LH5810_PORTC_W_CB(WRITE8(pc1500_state, port_c_w)) + MCFG_LH5810_OUT_INT_CB(INPUTLINE("maincpu", LH5801_LINE_MI)) + + MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL) +MACHINE_CONFIG_END + + +ROM_START( pc1500 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "sys1500.rom", 0xc000, 0x4000, CRC(d480b50d) SHA1(4bf748ba4d7c2b7cd7da7f3fdefcdd2e4cd41c4e)) + ROM_REGION( 0x10000, "ce150", ROMREGION_ERASEFF ) + ROM_LOAD( "ce-150.rom", 0x0000, 0x2000, CRC(8fa1df6d) SHA1(a3aa02a641a46c27c0d4c0dc025b0dbe9b5b79c8)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 198?, pc1500, 0, 0, pc1500, pc1500, driver_device, 0, "Sharp", "Pocket Computer 1500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/pc1512.c b/src/mame/drivers/pc1512.c new file mode 100644 index 00000000000..3c8ba9d2bb9 --- /dev/null +++ b/src/mame/drivers/pc1512.c @@ -0,0 +1,1514 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Amstrad PC1512 + + http://www.seasip.info/AmstradXT + http://stason.org/TULARC/pc/hard-drives-hdd/tandon/TM262-21MB-5-25-HH-MFM-ST506.html + +*/ + +/* + + TODO: + + - adjust mouse speed + - pc1512 V3 VDU check fails + - Amstrad SM2400 internal modem + - Amstrad RP4 diagnostic ISA card (PC1512) + - Amstrad RP5-2 diagnostic ISA card (PC1640) + - 40291/8908 B ROM on PC1640 HD30 controller card + +*/ + +/* +HARD DISC INSTALLATION INSTRUCTIONS + +Applies to both ten and twenty megabyte versions. + +1. Turn on machine +2. Insert disc 1 (the red disc) and press a key. +3. Type fdisk (RETURN) +4. At each prompt press the RETURN key (another three times). +5. The A> will now appear so now type format c:/s (RETURN). +6. Now push the Y key (RETURN). +7. The hard disc will now begin to format, if you have a 10Mb machine then it will count up to 305 + cylinders. If you have a 20 Mb machine then 610 cylinders will be counted. +8. Once this is done, take out disc 1 and insert disc 5 (the maroon disc). +9. Now type config(RETURN). This procedure will copy all five discs (order 5,1,2,3,4) onto the hard disc. + Once finished the screen will show some information about the size of the disc and the number of files and + directories present. +10. To now use the hard disc remove the floppy disc from the drive and store in a safe place with the other + four discs then restart the computer by pushing Alt Ctrl and Del. +11. After a short while the AMSTRAD PC info will come up and tell you when the machine was last used + and then after a little longer the screen will clear and will display this message, + +F1=DOSPLUS.SYS +F2=DOS.SYS + +Select operating system: + +If you choose F1 then DOS Plus and GEM will be booted, or if you press F2 then MS-DOS will be booted. +*/ + +/* +HARD DISC INSTALLATION ON PC1640 + +PC1640 hard disc comes ready installed with the necessary software. That is discs 1 to 4 that are +supplied ready with the machine. + +Howevere in the case of a disc failure it may be necessary to reinstall the supplied software. + +This is done in the following way: +1. Put disc one into drive A: and boot up the system +2. Put disc four into drive A: and type CD\SUPPLEME and press return. +3. Type HDFORMAT and press return. +4. Answer YES to the screen prompt. +5. When HDFORMAT is completed remove disc four and replace with disc one. +6. Type CD\ and press return. +7. Type FDISC and press return. +8. Press return key every time you are asked a question. +9. With disc one still in drive A: type FORMAT C:/S and press return. +10. When formatting is finished replace disc one with disc four. +11. Type CD\SUPPLEME and press return. +12. Type CONFIG and press return. + +After typing CONFIG the machine will proceed to copy the four system discs to the hard disc. +After copying each disc you will be prompted to insert the next disc. +You do not noeed to know in which order to insert the discs because the machine will tell you which disc is +needed next. + +The system is now installed and should be tested by rebooting the machine. + +It should be noted that if the hard disc is ok but the software has been corrupted or deleted you can +reinstall the software without reformatting. +This is done by following steps 11 and 12. +*/ + +#include "includes/pc1512.h" +#include "bus/rs232/rs232.h" +#include "bus/isa/ega.h" + + + +//************************************************************************** +// SYSTEM STATUS REGISTER +//************************************************************************** + +//------------------------------------------------- +// system_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_state::system_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0: + if (BIT(m_port61, 7)) + { + /* + + bit description + + 0 1 + 1 8087 NDP installed + 2 1 + 3 1 + 4 DDM0 + 5 DDM1 + 6 second floppy disk drive installed + 7 0 + + */ + + data = m_status1; + } + else + { + data = m_kbd; + m_kb_bits = 0; + m_kb->data_w(1); + m_pic->ir1_w(CLEAR_LINE); + } + break; + + case 1: + data = m_port61; + break; + + case 2: + /* + + bit description + + 0 RAM0 / RAM4 + 1 RAM1 + 2 RAM2 + 3 RAM3 + 4 undefined + 5 8253 PIT OUT2 output + 6 external parity error (I/OCHCK from expansion bus) + 7 on-board system RAM parity error + + */ + + if (BIT(m_port61, 2)) + data = m_status2 & 0x0f; + else + data = m_status2 >> 4; + + data |= m_pit2 << 5; + break; + } + + return data; +} + + +//------------------------------------------------- +// system_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_state::system_w ) +{ + switch (offset) + { + case 1: + /* + + bit description + + 0 8253 GATE 2 (speaker modulate) + 1 speaker drive + 2 enable port C LSB / disable MSB + 3 undefined + 4 disable parity checking of on-board RAM + 5 prevent external parity errors from causing NMI + 6 enable incoming Keyboard Clock + 7 enable Status-1/Disable Keyboard Code on Port A + + */ + + m_port61 = data; + + m_pit->write_gate2(BIT(data, 0)); + + m_speaker_drive = BIT(data, 1); + update_speaker(); + + m_kb->clock_w(BIT(data, 6)); + break; + + case 4: + /* + + bit description + + 0 + 1 PA1 - 8087 NDP installed + 2 + 3 + 4 PA4 - DDM0 + 5 PA5 - DDM1 + 6 PA6 - Second Floppy disk drive installed + 7 + + */ + + if (BIT(data, 7)) + m_status1 = data ^ 0x8d; + else + m_status1 = data; + break; + + case 5: + /* + + bit description + + 0 PC0 (LSB) - RAM0 + 1 PC1 (LSB) - RAM1 + 2 PC2 (LSB) - RAM2 + 3 PC3 (LSB) - RAM3 + 4 PC0 (MSB) - RAM4 + 5 PC1 (MSB) - Undefined + 6 PC2 (MSB) - Undefined + 7 PC3 (MSB) - Undefined + + */ + + m_status2 = data; + break; + + case 6: + machine_reset(); + break; + } +} + + + +//************************************************************************** +// MOUSE +//************************************************************************** + +//------------------------------------------------- +// mouse_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_state::mouse_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0: + data = m_mouse_x; + break; + + case 2: + data = m_mouse_y; + break; + } + + return data; +} + + +//------------------------------------------------- +// mouse_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_state::mouse_w ) +{ + switch (offset) + { + case 0: + m_mouse_x = 0; + break; + + case 2: + m_mouse_y = 0; + break; + } +} + + + +//************************************************************************** +// DIRECT MEMORY ACCESS +//************************************************************************** + +//------------------------------------------------- +// dma_page_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_state::dma_page_w ) +{ + /* + + bit description + + 0 Address bit A16 + 1 Address bit A17 + 2 Address bit A18 + 3 Address bit A19 + 4 + 5 + 6 + 7 + + */ + + switch (offset) + { + case 1: + m_dma_page[2] = data & 0x0f; + break; + + case 2: + m_dma_page[3] = data & 0x0f; + break; + + case 3: + m_dma_page[0] = m_dma_page[1] = data & 0x0f; + break; + } +} + + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// nmi_mask_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_state::nmi_mask_w ) +{ + m_nmi_enable = BIT(data, 7); +} + + + +//************************************************************************** +// PRINTER +//************************************************************************** + +//------------------------------------------------- +// printer_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_state::printer_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0: + data = m_printer_data; + break; + + case 1: + /* + + bit description + + 0 LK1 fitted + 1 LK2 fitted + 2 LK3 fitted + 3 printer error + 4 printer selected + 5 paper out + 6 printer acknowledge + 7 printer busy + + */ + + data |= m_lk->read() & 0x07; + + data |= m_centronics_fault << 3; + data |= m_centronics_select << 4; + data |= m_centronics_perror << 5; + data |= m_centronics_ack << 6; + data |= m_centronics_busy << 7; + break; + + case 2: + /* + + bit description + + 0 Data Strobe + 1 Select Auto Feed + 2 Reset Printer + 3 Select Printer + 4 Enable Int on ACK + 5 1 + 6 + 7 + + */ + + data = m_printer_control | 0x20; + break; + } + + return data; +} + + +//------------------------------------------------- +// printer_r - +//------------------------------------------------- + +READ8_MEMBER( pc1640_state::printer_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 2: + /* + + bit description + + 0 Data Strobe + 1 Select Auto Feed + 2 Reset Printer + 3 Select Printer + 4 Enable Int on ACK + 5 OPT + 6 SW6 + 7 SW7 + + */ + + /* + Bit D5 is the option (OPT) bit and can return one of three different pieces of + information. Although not documented as such on the PC1512, Bit D5 was always a + "1", however on the PC1640 it will always be a zero if immediately prior to the + read of channel 037Ah the software performs an I/O read of an I/O channel + implemented on the PC1512 main board, having address line A7 high (for example, + the CGA channels). This is a simple test for software to detect whether it is + running on a PC1512 or a PC1640. A PC1512 will give a 1, whereas a PC1640 will + give a 0. + + In addition to being a test of machine type the OPT bit, D5, can also reflect + the state of either SW9 or SW10. The OPT bit will reflect the state of switch + SW9 by an I/O read operation to an I/O channel not implemented on the main + board and having address lines A14 and A7 both low (for example channel 0278h) + immediately prior to the reading of channel 037Ah. The OPT bit is set to the + state of switch SW10 by an I/O read operation to an I/O channel not implemented + on the main board having address lines A14 high and A7 low (for example channel + 4278h). Software testing OPT bit should disable interrupts before the initial + (dummy) channel read and the I/O read of channel 037A in order to avoid + additional (interrupt based) I/O operations between the setting and the testing + of the information read back in the OPT bit. For switches SW9 and SW10, a logic + "1" is returned when the switch is on the "on" position and a logic "0" if the + switch is in the "off" position. + */ + data = m_printer_control; + data |= m_opt << 5; + data |= (m_sw->read() & 0x60) << 1; + break; + + default: + data = pc1512_state::printer_r(space, offset); + break; + } + + return data; +} + + +//------------------------------------------------- +// printer_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_state::printer_w ) +{ + switch (offset) + { + case 0: + m_printer_data = data; + m_cent_data_out->write(space, 0, data); + break; + + case 2: + /* + + bit description + + 0 Data Strobe + 1 Select Auto Feed + 2 Reset Printer + 3 Select Printer + 4 Enable Int on ACK + 5 + 6 + 7 + + */ + + m_printer_control = data & 0x1f; + + m_centronics->write_strobe(BIT(data, 0)); + m_centronics->write_autofd(BIT(data, 1)); + m_centronics->write_init(BIT(data, 2)); + + m_ack_int_enable = BIT(data, 4); + update_ack(); + break; + } +} + + +//************************************************************************** +// PC1640 I/O ACCESS +//************************************************************************** + +//------------------------------------------------- +// io_r - +//------------------------------------------------- + +READ8_MEMBER( pc1640_state::io_r ) +{ + UINT8 data = 0; + offs_t addr = offset & 0x3ff; + bool decoded = false; + + if ( addr <= 0x00f) { data = m_dmac->read(space, offset & 0x0f); decoded = true; } + else if (addr >= 0x020 && addr <= 0x021) { data = m_pic->read(space, offset & 0x01); decoded = true; } + else if (addr >= 0x040 && addr <= 0x043) { data = m_pit->read(space, offset & 0x03); decoded = true; } + else if (addr >= 0x060 && addr <= 0x06f) { data = system_r(space, offset & 0x0f); decoded = true; } + else if (addr >= 0x070 && addr <= 0x073) { data = m_rtc->read(space, offset & 0x01); decoded = true; } + else if (addr >= 0x078 && addr <= 0x07f) { data = mouse_r(space, offset & 0x07); decoded = true; } + else if (addr >= 0x378 && addr <= 0x37b) { data = printer_r(space, offset & 0x03); decoded = true; } + else if (addr >= 0x3b0 && addr <= 0x3df) { decoded = true; } + else if (addr >= 0x3f4 && addr <= 0x3f4) { data = m_fdc->fdc->msr_r(space, offset & 0x01); decoded = true; } + else if (addr >= 0x3f5 && addr <= 0x3f5) { data = m_fdc->fdc->fifo_r(space, offset & 0x01); decoded = true; } + else if (addr >= 0x3f8 && addr <= 0x3ff) { data = m_uart->ins8250_r(space, offset & 0x07); decoded = true; } + + if (decoded) + { + if (BIT(offset, 7)) + { + m_opt = 0; + //logerror("OPT 0\n"); + } + } + else if (!BIT(offset, 7)) + { + UINT16 sw = m_sw->read(); + + if (!BIT(offset, 14)) + { + m_opt = BIT(sw, 8); + logerror("OPT SW9 %u\n", m_opt); + } + else + { + m_opt = BIT(sw, 9); + logerror("OPT SW10 %u\n", m_opt); + } + } + + return data; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( pc1512_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( pc1512_mem, AS_PROGRAM, 16, pc1512_state ) + AM_RANGE(0x00000, 0x9ffff) AM_RAM + AM_RANGE(0xb8000, 0xbbfff) AM_READWRITE8(video_ram_r, video_ram_w, 0xffff) + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( pc1512_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( pc1512_io, AS_IO, 16, pc1512_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3ff) + AM_RANGE(0x000, 0x00f) AM_DEVREADWRITE8(I8237A5_TAG, am9517a_device, read, write, 0xffff) + AM_RANGE(0x020, 0x021) AM_DEVREADWRITE8(I8259A2_TAG, pic8259_device, read, write, 0xffff) + AM_RANGE(0x040, 0x043) AM_DEVREADWRITE8(I8253_TAG, pit8253_device, read, write, 0xffff) + AM_RANGE(0x060, 0x06f) AM_READWRITE8(system_r, system_w, 0xffff) + AM_RANGE(0x070, 0x071) AM_MIRROR(0x02) AM_DEVREADWRITE8(MC146818_TAG, mc146818_device, read, write, 0xffff) + AM_RANGE(0x078, 0x07f) AM_READWRITE8(mouse_r, mouse_w, 0xffff) + AM_RANGE(0x080, 0x083) AM_WRITE8(dma_page_w, 0xffff) + AM_RANGE(0x0a0, 0x0a1) AM_WRITE8(nmi_mask_w, 0xff00) + AM_RANGE(0x378, 0x37b) AM_READWRITE8(printer_r, printer_w, 0xffff) + AM_RANGE(0x3d0, 0x3df) AM_READWRITE8(vdu_r, vdu_w, 0xffff) + AM_RANGE(0x3f0, 0x3f7) AM_DEVICE8(PC_FDC_XT_TAG, pc_fdc_xt_device, map, 0xffff) + AM_RANGE(0x3f8, 0x3ff) AM_DEVREADWRITE8(INS8250_TAG, ins8250_device, ins8250_r, ins8250_w, 0xffff) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( pc1640_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( pc1640_mem, AS_PROGRAM, 16, pc1640_state ) + AM_RANGE(0x00000, 0x9ffff) AM_RAM + AM_RANGE(0xf0000, 0xf3fff) AM_MIRROR(0xc000) AM_ROM AM_REGION(I8086_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( pc1640_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( pc1640_io, AS_IO, 16, pc1640_state ) + AM_RANGE(0x0000, 0xffff) AM_READ8(io_r, 0xffff) + + AM_RANGE(0x000, 0x00f) AM_DEVWRITE8(I8237A5_TAG, am9517a_device, write, 0xffff) + AM_RANGE(0x020, 0x021) AM_DEVWRITE8(I8259A2_TAG, pic8259_device, write, 0xffff) + AM_RANGE(0x040, 0x043) AM_DEVWRITE8(I8253_TAG, pit8253_device, write, 0xffff) + AM_RANGE(0x060, 0x06f) AM_WRITE8(system_w, 0xffff) + AM_RANGE(0x070, 0x071) AM_MIRROR(0x02) AM_DEVWRITE8(MC146818_TAG, mc146818_device, write, 0xffff) + AM_RANGE(0x078, 0x07f) AM_WRITE8(mouse_w, 0xffff) + AM_RANGE(0x080, 0x083) AM_WRITE8(dma_page_w, 0xffff) + AM_RANGE(0x0a0, 0x0a1) AM_WRITE8(nmi_mask_w, 0xff00) + AM_RANGE(0x378, 0x37b) AM_WRITE8(printer_w, 0xffff) + AM_RANGE(0x3f2, 0x3f3) AM_DEVWRITE8(PC_FDC_XT_TAG, pc_fdc_xt_device, dor_w, 0x00ff) + AM_RANGE(0x3f4, 0x3f5) AM_DEVWRITE8(PC_FDC_XT_TAG ":upd765", upd765_family_device, fifo_w, 0xff00) + AM_RANGE(0x3f8, 0x3ff) AM_DEVWRITE8(INS8250_TAG, ins8250_device, ins8250_w, 0xffff) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_CHANGED_MEMBER( mouse_button_1_changed ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( pc1512_state::mouse_button_1_changed ) +{ + m_kb->m1_w(newval); +} + + +//------------------------------------------------- +// INPUT_CHANGED_MEMBER( mouse_button_2_changed ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( pc1512_state::mouse_button_2_changed ) +{ + m_kb->m2_w(newval); +} + + +//------------------------------------------------- +// INPUT_CHANGED_MEMBER( mouse_x_changed ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( pc1512_state::mouse_x_changed ) +{ + if (newval > oldval) + m_mouse_x++; + else + m_mouse_x--; +} + + +//------------------------------------------------- +// INPUT_CHANGED_MEMBER( mouse_y_changed ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( pc1512_state::mouse_y_changed ) +{ + if (newval > oldval) + m_mouse_y--; + else + m_mouse_y++; +} + + +//------------------------------------------------- +// INPUT_PORTS( mouse ) +//------------------------------------------------- + +static INPUT_PORTS_START( mouse ) + PORT_START("MOUSEB") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("Left Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF, pc1512_state, mouse_button_1_changed, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("Right Mouse Button") PORT_CODE(MOUSECODE_BUTTON2) PORT_CHANGED_MEMBER(DEVICE_SELF, pc1512_state, mouse_button_2_changed, 0) + + PORT_START("MOUSEX") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, pc1512_state, mouse_x_changed, 0) + + PORT_START("MOUSEY") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, pc1512_state, mouse_y_changed, 0) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( pc1512 ) +//------------------------------------------------- + +static INPUT_PORTS_START( pc1512 ) + PORT_INCLUDE( mouse ) + + PORT_START("LK") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Language ) ) + PORT_DIPSETTING( 0x07, DEF_STR( English ) ) + PORT_DIPSETTING( 0x06, DEF_STR( German ) ) + PORT_DIPSETTING( 0x05, DEF_STR( French ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Spanish ) ) + PORT_DIPSETTING( 0x03, "Danish" ) + PORT_DIPSETTING( 0x02, "Swedish" ) + PORT_DIPSETTING( 0x01, DEF_STR( Italian ) ) + PORT_DIPSETTING( 0x00, "Diagnostic Mode" ) + PORT_DIPNAME( 0x08, 0x08, "Memory Size") + PORT_DIPSETTING( 0x08, "512 KB" ) + PORT_DIPSETTING( 0x00, "640 KB" ) + PORT_DIPNAME( 0x10, 0x10, "ROM Size") + PORT_DIPSETTING( 0x10, "16 KB" ) + PORT_DIPSETTING( 0x00, "32 KB" ) + PORT_DIPNAME( 0x60, 0x60, "Character Set") + PORT_DIPSETTING( 0x60, "Default (Codepage 437)" ) + PORT_DIPSETTING( 0x40, "Portugese (Codepage 865)" ) + PORT_DIPSETTING( 0x20, "Norwegian (Codepage 860)" ) + PORT_DIPSETTING( 0x00, "Greek") + PORT_DIPNAME( 0x80, 0x80, "Floppy Ready Line") + PORT_DIPSETTING( 0x80, "Connected" ) + PORT_DIPSETTING( 0x00, "Not connected" ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( pc1640 ) +//------------------------------------------------- + +static INPUT_PORTS_START( pc1640 ) + PORT_INCLUDE( mouse ) + + PORT_START("LK") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Language ) ) + PORT_DIPSETTING( 0x07, DEF_STR( English ) ) + PORT_DIPSETTING( 0x06, DEF_STR( German ) ) + PORT_DIPSETTING( 0x05, DEF_STR( French ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Spanish ) ) + PORT_DIPSETTING( 0x03, "Danish" ) + PORT_DIPSETTING( 0x02, "Swedish" ) + PORT_DIPSETTING( 0x01, DEF_STR( Italian ) ) + PORT_DIPSETTING( 0x00, "Diagnostic Mode" ) + + PORT_START("SW") + PORT_DIPNAME( 0x0f, 0x09, "Initial Display Mode" ) PORT_DIPLOCATION("SW:1,2,3,4") PORT_CONDITION("SW", 0x200, EQUALS, 0x200) + PORT_DIPSETTING( 0x0b, "Internal MD, External CGA80" ) + PORT_DIPSETTING( 0x0a, "Internal MD, External CGA40" ) + PORT_DIPSETTING( 0x09, "Internal ECD350, External MDA/HERC" ) + PORT_DIPSETTING( 0x08, "Internal ECD200, External MDA/HERC" ) + PORT_DIPSETTING( 0x07, "Internal CD80, External MDA/HERC" ) + PORT_DIPSETTING( 0x06, "Internal CD40, External MDA/HERC" ) + PORT_DIPSETTING( 0x05, "External CGA80, Internal MD" ) + PORT_DIPSETTING( 0x04, "External CGA40, Internal MD" ) + PORT_DIPSETTING( 0x03, "External MDA/HERC, Internal ECD350" ) + PORT_DIPSETTING( 0x02, "External MDA/HERC, Internal ECD200" ) + PORT_DIPSETTING( 0x01, "External MDA/HERC, Internal CD80" ) + PORT_DIPSETTING( 0x00, "External MDA/HERC, Internal CD40" ) + PORT_DIPNAME( 0x10, 0x10, "MC6845 Mode" ) PORT_DIPLOCATION("SW:5") PORT_CONDITION("SW", 0x200, EQUALS, 0x200) + PORT_DIPSETTING( 0x10, "EGA" ) + PORT_DIPSETTING( 0x00, "CGA/MDA/HERC" ) + PORT_DIPNAME( 0x60, 0x00, "Font" ) PORT_DIPLOCATION("SW:6,7") PORT_CONDITION("SW", 0x300, EQUALS, 0x300) + PORT_DIPSETTING( 0x00, DEF_STR( English ) ) + PORT_DIPSETTING( 0x60, "Danish" ) + PORT_DIPSETTING( 0x40, "Portuguese" ) + PORT_DIPSETTING( 0x20, "Greek" ) + PORT_DIPNAME( 0x60, 0x60, "Default Display Mode" ) PORT_DIPLOCATION("SW:6,7") PORT_CONDITION("SW", 0x200, EQUALS, 0x000) + PORT_DIPSETTING( 0x60, "External EGA" ) + PORT_DIPSETTING( 0x40, "External CGA in 40 Column Mode" ) + PORT_DIPSETTING( 0x20, "External CGA in 80 Column Mode" ) + PORT_DIPSETTING( 0x00, "External Monochrome Adapter" ) + PORT_DIPNAME( 0x80, 0x00, "Monitor" ) PORT_DIPLOCATION("SW:8") PORT_CONDITION("SW", 0x200, EQUALS, 0x200) + PORT_DIPSETTING( 0x80, "CD (Standard RGB)" ) + PORT_DIPSETTING( 0x00, "ECD (Enhanced RGB)" ) + PORT_DIPNAME( 0x100, 0x100, "Foreign Fonts" ) PORT_DIPLOCATION("SW:9") PORT_CONDITION("SW", 0x200, EQUALS, 0x200) + PORT_DIPSETTING( 0x100, "Enabled" ) + PORT_DIPSETTING( 0x000, "Disabled" ) + PORT_DIPNAME( 0x200, 0x200, "Internal Graphics Adapter" ) PORT_DIPLOCATION("SW:10") + PORT_DIPSETTING( 0x200, "Enabled" ) + PORT_DIPSETTING( 0x000, "Disabled" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// PC1512_KEYBOARD_INTERFACE( kb_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( pc1512_state::kbdata_w ) +{ + m_kbdata = state; +} + +WRITE_LINE_MEMBER( pc1512_state::kbclk_w ) +{ + if (!BIT(m_port61, 7) && m_kbclk && !state) + { + m_kbd <<= 1; + m_kbd |= m_kbdata; + m_kb_bits++; + + if (m_kb_bits == 8) + { + m_kb->data_w(0); + m_pic->ir1_w(ASSERT_LINE); + } + } + + m_kbclk = state; +} + + +//------------------------------------------------- +// I8237_INTERFACE( dmac_intf ) +//------------------------------------------------- + +void pc1512_state::update_fdc_tc() +{ + if (m_nden) + m_fdc->tc_w(m_neop); + else + m_fdc->tc_w(false); +} + +WRITE_LINE_MEMBER( pc1512_state::hrq_w ) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + m_dmac->hack_w(state); +} + +WRITE_LINE_MEMBER( pc1512_state::eop_w ) +{ + if (m_dma_channel == 2) + { + m_neop = !state; + update_fdc_tc(); + } +} + +READ8_MEMBER( pc1512_state::memr_r ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + offs_t page_offset = m_dma_page[m_dma_channel] << 16; + + return program.read_byte(page_offset + offset); +} + +WRITE8_MEMBER( pc1512_state::memw_w ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + offs_t page_offset = m_dma_page[m_dma_channel] << 16; + + program.write_byte(page_offset + offset, data); +} + +READ8_MEMBER( pc1512_state::ior1_r ) +{ + return m_bus->dack_r(1); +} + +READ8_MEMBER( pc1512_state::ior2_r ) +{ + if (m_nden) + return m_fdc->dma_r(); + else + return m_bus->dack_r(2); +} + +READ8_MEMBER( pc1512_state::ior3_r ) +{ + return m_bus->dack_r(3); +} + +WRITE8_MEMBER( pc1512_state::iow0_w ) +{ + m_dreq0 = 0; + m_dmac->dreq0_w(m_dreq0); +} + +WRITE8_MEMBER( pc1512_state::iow1_w ) +{ + m_bus->dack_w(1, data); +} + +WRITE8_MEMBER( pc1512_state::iow2_w ) +{ + if (m_nden) + m_fdc->dma_w(data); + else + m_bus->dack_w(2, data); +} + +WRITE8_MEMBER( pc1512_state::iow3_w ) +{ + m_bus->dack_w(3, data); +} + +WRITE_LINE_MEMBER( pc1512_state::dack0_w ) +{ + if (!state) m_dma_channel = 0; +} + +WRITE_LINE_MEMBER( pc1512_state::dack1_w ) +{ + if (!state) m_dma_channel = 1; +} + +WRITE_LINE_MEMBER( pc1512_state::dack2_w ) +{ + if (!state) m_dma_channel = 2; +} + +WRITE_LINE_MEMBER( pc1512_state::dack3_w ) +{ + if (!state) m_dma_channel = 3; +} + +//------------------------------------------------- +// pit8253_config pit_intf +//------------------------------------------------- + +void pc1512_state::update_speaker() +{ + m_speaker->level_w(m_speaker_drive & m_pit2); +} + +WRITE_LINE_MEMBER( pc1512_state::pit1_w ) +{ + if (!m_pit1 && state && !m_dreq0) + { + m_dreq0 = 1; + m_dmac->dreq0_w(m_dreq0); + } + + m_pit1 = state; +} + +WRITE_LINE_MEMBER( pc1512_state::pit2_w ) +{ + m_pit2 = state; + update_speaker(); +} + +//------------------------------------------------- +// upd765_interface fdc_intf +//------------------------------------------------- + +void pc1512_state::update_fdc_int() +{ + if (m_nden) + m_pic->ir6_w(m_dint); + else + m_pic->ir6_w(CLEAR_LINE); +} + +void pc1512_state::update_fdc_drq() +{ + if (m_nden) + m_dmac->dreq2_w(m_ddrq); + else + m_dmac->dreq2_w(0); +} + +WRITE_LINE_MEMBER( pc1512_state::fdc_int_w ) +{ + m_dint = state; + update_fdc_int(); +} + +WRITE_LINE_MEMBER( pc1512_state::fdc_drq_w ) +{ + m_ddrq = state; + update_fdc_drq(); +} + +//------------------------------------------------- +// centronics_interface centronics_intf +//------------------------------------------------- + +void pc1512_state::update_ack() +{ + if (m_ack_int_enable) + m_pic->ir7_w(m_centronics_ack); + else + m_pic->ir7_w(CLEAR_LINE); +} + +WRITE_LINE_MEMBER( pc1512_state::write_centronics_ack ) +{ + m_centronics_ack = state; + update_ack(); +} + +WRITE_LINE_MEMBER( pc1512_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( pc1512_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +WRITE_LINE_MEMBER( pc1512_state::write_centronics_select ) +{ + m_centronics_select = state; +} + +WRITE_LINE_MEMBER( pc1512_state::write_centronics_fault ) +{ + m_centronics_fault = state; +} + + +//------------------------------------------------- +// isa8bus_interface isabus_intf +//------------------------------------------------- + +SLOT_INTERFACE_START( pc1640_isa8_cards ) + SLOT_INTERFACE_INTERNAL("iga", ISA8_PC1640_IGA) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( pc1512_state::floppy_formats ) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( pc1512_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) // Tandon TM65-2L +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( pc1512 ) +//------------------------------------------------- + +void pc1512_state::machine_start() +{ + // set RAM size + size_t ram_size = m_ram->size(); + + if (ram_size < 640 * 1024) + { + address_space &program = m_maincpu->space(AS_PROGRAM); + program.unmap_readwrite(ram_size, 0x9ffff); + } + + // state saving + save_item(NAME(m_pit1)); + save_item(NAME(m_pit2)); + save_item(NAME(m_status1)); + save_item(NAME(m_status2)); + save_item(NAME(m_port61)); + save_item(NAME(m_nmi_enable)); + save_item(NAME(m_kbd)); + save_item(NAME(m_kb_bits)); + save_item(NAME(m_kbclk)); + save_item(NAME(m_kbdata)); + save_item(NAME(m_mouse_x)); + save_item(NAME(m_mouse_y)); + save_item(NAME(m_dma_page)); + save_item(NAME(m_dma_channel)); + save_item(NAME(m_dreq0)); + save_item(NAME(m_nden)); + save_item(NAME(m_dint)); + save_item(NAME(m_ddrq)); + save_item(NAME(m_neop)); + save_item(NAME(m_ack_int_enable)); + save_item(NAME(m_centronics_ack)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_perror)); + save_item(NAME(m_centronics_select)); + save_item(NAME(m_centronics_fault)); + save_item(NAME(m_printer_data)); + save_item(NAME(m_printer_control)); + save_item(NAME(m_toggle)); + save_item(NAME(m_lpen)); + save_item(NAME(m_blink)); + save_item(NAME(m_cursor)); + save_item(NAME(m_blink_ctr)); + save_item(NAME(m_vdu_mode)); + save_item(NAME(m_vdu_color)); + save_item(NAME(m_vdu_plane)); + save_item(NAME(m_vdu_rdsel)); + save_item(NAME(m_vdu_border)); + save_item(NAME(m_speaker_drive)); +} + + +void pc1512_state::machine_reset() +{ + m_nmi_enable = 0; + m_toggle = 0; + m_kb_bits = 0; + m_pit2 = 1; + + m_lpen = 0; + m_blink = 0; + m_cursor = 0; + m_blink_ctr = 0; + m_vdu_mode = 0; + m_vdu_color = 0; + m_vdu_rdsel = 0; + m_vdu_plane = 0x0f; + m_vdu_border = 0; + + m_kb->clock_w(0); +} + + +//------------------------------------------------- +// MACHINE_START( pc1640 ) +//------------------------------------------------- + +void pc1640_state::machine_start() +{ + // state saving + save_item(NAME(m_pit1)); + save_item(NAME(m_pit2)); + save_item(NAME(m_status1)); + save_item(NAME(m_status2)); + save_item(NAME(m_port61)); + save_item(NAME(m_nmi_enable)); + save_item(NAME(m_kbd)); + save_item(NAME(m_kb_bits)); + save_item(NAME(m_kbclk)); + save_item(NAME(m_kbdata)); + save_item(NAME(m_mouse_x)); + save_item(NAME(m_mouse_y)); + save_item(NAME(m_dma_page)); + save_item(NAME(m_dma_channel)); + save_item(NAME(m_dreq0)); + save_item(NAME(m_nden)); + save_item(NAME(m_dint)); + save_item(NAME(m_ddrq)); + save_item(NAME(m_neop)); + save_item(NAME(m_ack_int_enable)); + save_item(NAME(m_centronics_ack)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_perror)); + save_item(NAME(m_centronics_select)); + save_item(NAME(m_centronics_fault)); + save_item(NAME(m_printer_data)); + save_item(NAME(m_printer_control)); + save_item(NAME(m_speaker_drive)); + save_item(NAME(m_opt)); +} + + +void pc1640_state::machine_reset() +{ + m_nmi_enable = 0; + m_kb_bits = 0; + m_kb->clock_w(0); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( pc1512 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pc1512, pc1512_state ) + MCFG_CPU_ADD(I8086_TAG, I8086, XTAL_24MHz/3) + MCFG_CPU_PROGRAM_MAP(pc1512_mem) + MCFG_CPU_IO_MAP(pc1512_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A2_TAG, pic8259_device, inta_cb) + + // video + MCFG_FRAGMENT_ADD(pc1512_video) + + // sound + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + // devices + MCFG_DEVICE_ADD(PC1512_KEYBOARD_TAG, PC1512_KEYBOARD, 0) + MCFG_PC1512_KEYBOARD_CLOCK_CALLBACK(WRITELINE(pc1512_state, kbclk_w)) + MCFG_PC1512_KEYBOARD_DATA_CALLBACK(WRITELINE(pc1512_state, kbdata_w)) + MCFG_DEVICE_ADD(I8237A5_TAG, AM9517A, XTAL_24MHz/6) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(pc1512_state, hrq_w)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(pc1512_state, eop_w)) + MCFG_I8237_IN_MEMR_CB(READ8(pc1512_state, memr_r)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(pc1512_state, memw_w)) + MCFG_I8237_IN_IOR_1_CB(READ8(pc1512_state, ior1_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(pc1512_state, ior2_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(pc1512_state, ior3_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc1512_state, iow0_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(pc1512_state, iow1_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(pc1512_state, iow2_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(pc1512_state, iow3_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(pc1512_state, dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(pc1512_state, dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(pc1512_state, dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(pc1512_state, dack3_w)) + MCFG_PIC8259_ADD(I8259A2_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL) + + MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_28_63636MHz/24) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_28_63636MHz/24) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(pc1512_state, pit1_w)) + MCFG_PIT8253_CLK2(XTAL_28_63636MHz/24) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(pc1512_state, pit2_w)) + + MCFG_MC146818_ADD(MC146818_TAG, XTAL_32_768kHz) + MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) + MCFG_PC_FDC_XT_ADD(PC_FDC_XT_TAG) + MCFG_PC_FDC_INTRQ_CALLBACK(WRITELINE(pc1512_state, fdc_int_w)) + MCFG_PC_FDC_DRQ_CALLBACK(WRITELINE(pc1512_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(PC_FDC_XT_TAG ":0", pc1512_floppies, "525dd", pc1512_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(PC_FDC_XT_TAG ":1", pc1512_floppies, NULL, pc1512_state::floppy_formats) + MCFG_DEVICE_ADD(INS8250_TAG, INS8250, XTAL_1_8432MHz) + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_INS8250_OUT_INT_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pc1512_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pc1512_state, write_centronics_busy)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(pc1512_state, write_centronics_perror)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(pc1512_state, write_centronics_select)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(pc1512_state, write_centronics_fault)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, dsr_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, ri_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, cts_w)) + + // ISA8 bus + MCFG_DEVICE_ADD(ISA_BUS_TAG, ISA8, 0) + MCFG_ISA8_CPU(":" I8086_TAG) + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir7_w)) + MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq3_w)) + MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa1", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa2", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa3", pc_isa8_cards, NULL, false) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_EXTRA_OPTIONS("544K,576K,608K,640K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "pc1512") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pc1512dd ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pc1512dd, pc1512 ) + MCFG_DEVICE_MODIFY(PC_FDC_XT_TAG ":1") + MCFG_SLOT_DEFAULT_OPTION("525dd") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pc1512hd ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pc1512hd, pc1512 ) + MCFG_DEVICE_MODIFY("isa1") + MCFG_SLOT_DEFAULT_OPTION("wdxt_gen") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pc1640 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pc1640, pc1640_state ) + MCFG_CPU_ADD(I8086_TAG, I8086, XTAL_24MHz/3) + MCFG_CPU_PROGRAM_MAP(pc1640_mem) + MCFG_CPU_IO_MAP(pc1640_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A2_TAG, pic8259_device, inta_cb) + + // sound + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + // devices + MCFG_DEVICE_ADD(PC1512_KEYBOARD_TAG, PC1512_KEYBOARD, 0) + MCFG_PC1512_KEYBOARD_CLOCK_CALLBACK(WRITELINE(pc1512_state, kbclk_w)) + MCFG_PC1512_KEYBOARD_DATA_CALLBACK(WRITELINE(pc1512_state, kbdata_w)) + MCFG_DEVICE_ADD(I8237A5_TAG, AM9517A, XTAL_24MHz/6) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(pc1512_state, hrq_w)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(pc1512_state, eop_w)) + MCFG_I8237_IN_MEMR_CB(READ8(pc1512_state, memr_r)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(pc1512_state, memw_w)) + MCFG_I8237_IN_IOR_1_CB(READ8(pc1512_state, ior1_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(pc1512_state, ior2_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(pc1512_state, ior3_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc1512_state, iow0_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(pc1512_state, iow1_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(pc1512_state, iow2_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(pc1512_state, iow3_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(pc1512_state, dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(pc1512_state, dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(pc1512_state, dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(pc1512_state, dack3_w)) + MCFG_PIC8259_ADD(I8259A2_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL) + + MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_28_63636MHz/24) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_28_63636MHz/24) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(pc1512_state, pit1_w)) + MCFG_PIT8253_CLK2(XTAL_28_63636MHz/24) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(pc1512_state, pit2_w)) + + MCFG_MC146818_ADD(MC146818_TAG, XTAL_32_768kHz) + MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) + MCFG_PC_FDC_XT_ADD(PC_FDC_XT_TAG) + MCFG_PC_FDC_INTRQ_CALLBACK(WRITELINE(pc1512_state, fdc_int_w)) + MCFG_PC_FDC_DRQ_CALLBACK(WRITELINE(pc1512_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(PC_FDC_XT_TAG ":0", pc1512_floppies, "525dd", pc1512_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(PC_FDC_XT_TAG ":1", pc1512_floppies, NULL, pc1512_state::floppy_formats) + MCFG_DEVICE_ADD(INS8250_TAG, INS8250, XTAL_1_8432MHz) + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_INS8250_OUT_INT_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) + + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pc1512_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pc1512_state, write_centronics_busy)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(pc1512_state, write_centronics_perror)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(pc1512_state, write_centronics_select)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(pc1512_state, write_centronics_fault)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, dsr_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, ri_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, cts_w)) + + // ISA8 bus + MCFG_DEVICE_ADD(ISA_BUS_TAG, ISA8, 0) + MCFG_ISA8_CPU(":" I8086_TAG) + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir7_w)) + MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq3_w)) + MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa1", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa2", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa3", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa4", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa5", pc1640_isa8_cards, "iga", false) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "pc1640") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pc1640dd ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pc1640dd, pc1640 ) + MCFG_DEVICE_MODIFY(PC_FDC_XT_TAG ":1") + MCFG_SLOT_DEFAULT_OPTION("525dd") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pc1640hd ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pc1640hd, pc1640 ) + MCFG_DEVICE_MODIFY("isa1") + MCFG_SLOT_DEFAULT_OPTION("wdxt_gen") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( pc1512 ) +//------------------------------------------------- + +ROM_START( pc1512 ) + ROM_REGION16_LE( 0x4000, I8086_TAG, 0) + ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) + ROMX_LOAD( "40044.ic132", 0x0000, 0x2000, CRC(f72f1582) SHA1(7781d4717917262805d514b331ba113b1e05a247), ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD( "40043.ic129", 0x0001, 0x2000, CRC(668fcc94) SHA1(74002f5cc542df442eec9e2e7a18db3598d8c482), ROM_SKIP(1) | ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) + ROMX_LOAD( "40044v2.ic132", 0x0000, 0x2000, CRC(1aec54fa) SHA1(b12fd73cfc35a240ed6da4dcc4b6c9910be611e0), ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD( "40043v2.ic129", 0x0001, 0x2000, CRC(d2d4d2de) SHA1(c376fd1ad23025081ae16c7949e88eea7f56e1bb), ROM_SKIP(1) | ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v3", "Version 3" ) + ROMX_LOAD( "40044-2.ic132", 0x0000, 0x2000, CRC(ea527e6e) SHA1(b77fa44767a71a0b321a88bb0a394f1125b7c220), ROM_SKIP(1) | ROM_BIOS(3) ) + ROMX_LOAD( "40043-2.ic129", 0x0001, 0x2000, CRC(532c3854) SHA1(18a17b710f9eb079d9d7216d07807030f904ceda), ROM_SKIP(1) | ROM_BIOS(3) ) + + ROM_REGION( 0x2000, AMS40041_TAG, 0 ) + ROMX_LOAD( "40045.ic127", 0x0000, 0x2000, CRC(dd5e030f) SHA1(7d858bbb2e8d6143aa67ab712edf5f753c2788a7), ROM_BIOS(1) ) + ROMX_LOAD( "40078.ic127", 0x0000, 0x2000, CRC(ae9c0d04) SHA1(bc8dc4dcedeea5bc1c04986b1f105ad93cb2ebcd), ROM_BIOS(2) ) + ROMX_LOAD( "40078.ic127", 0x0000, 0x2000, CRC(ae9c0d04) SHA1(bc8dc4dcedeea5bc1c04986b1f105ad93cb2ebcd), ROM_BIOS(3) ) +ROM_END + +#define rom_pc1512dd rom_pc1512 +#define rom_pc1512hd10 rom_pc1512 +#define rom_pc1512hd20 rom_pc1512 + + +//------------------------------------------------- +// ROM( pc1640 ) +//------------------------------------------------- + +ROM_START( pc1640 ) + ROM_REGION16_LE( 0x4000, I8086_TAG, 0) + ROM_SYSTEM_BIOS( 0, "8809", "Week 9/1988" ) + ROMX_LOAD( "40044-1 8809.ic132", 0x0000, 0x2000, CRC(f1c074f3) SHA1(a055ea7e933d137623c22fe24004e870653c7952), ROM_SKIP(1) | ROM_BIOS(1) ) // 8809 B + ROMX_LOAD( "40043-1 8809.ic129", 0x0001, 0x2000, CRC(e40a1513) SHA1(447eff2057e682e51b1c7593cb6fad0e53879fa8), ROM_SKIP(1) | ROM_BIOS(1) ) // 8809 B + ROM_SYSTEM_BIOS( 1, "8738", "Week 38/1987" ) + ROMX_LOAD( "40044 8738.ic132", 0x0000, 0x2000, CRC(43832ea7) SHA1(eea4a8836f966940a88c88de6c5cc14852545f7d), ROM_SKIP(1) | ROM_BIOS(2) ) // 8738 D F + ROMX_LOAD( "40043 8738.ic129", 0x0001, 0x2000, CRC(768498f9) SHA1(ac48cb892417d7998d604f3b79756140c554f476), ROM_SKIP(1) | ROM_BIOS(2) ) // 8738 D F + ROM_SYSTEM_BIOS( 2, "88xx", "Week ?/1988" ) + ROMX_LOAD( "40044 88xx.ic132", 0x0000, 0x2000, CRC(6090f782) SHA1(e21ae524d5b4d00696d293dbd4fe4d7bca22e277), ROM_SKIP(1) | ROM_BIOS(3) ) + ROMX_LOAD( "40043 88xx.ic129", 0x0001, 0x2000, CRC(9219d0aa) SHA1(dde1a46c8f83e413d7070f1356fc91b9f595a8b6), ROM_SKIP(1) | ROM_BIOS(3) ) +ROM_END + +#define rom_pc1640dd rom_pc1640 +#define rom_pc1640hd20 rom_pc1640 +#define rom_pc1640hd30 rom_pc1640 + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1986, pc1512, 0, 0, pc1512, pc1512, driver_device, 0, "Amstrad plc", "PC1512 SD", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, pc1512dd, pc1512, 0, pc1512dd, pc1512, driver_device, 0, "Amstrad plc", "PC1512 DD", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, pc1512hd10, pc1512, 0, pc1512hd, pc1512, driver_device, 0, "Amstrad plc", "PC1512 HD10", MACHINE_SUPPORTS_SAVE ) +COMP( 1986, pc1512hd20, pc1512, 0, pc1512hd, pc1512, driver_device, 0, "Amstrad plc", "PC1512 HD20", MACHINE_SUPPORTS_SAVE ) +COMP( 1987, pc1640, 0, 0, pc1640, pc1640, driver_device, 0, "Amstrad plc", "PC1640 SD", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +COMP( 1987, pc1640dd, pc1640, 0, pc1640dd, pc1640, driver_device, 0, "Amstrad plc", "PC1640 DD", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +COMP( 1987, pc1640hd20, pc1640, 0, pc1640hd, pc1640, driver_device, 0, "Amstrad plc", "PC1640 HD20", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +COMP( 1987, pc1640hd30, pc1640, 0, pc1640hd, pc1640, driver_device, 0, "Amstrad plc", "PC1640 HD30", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pc2000.c b/src/mame/drivers/pc2000.c new file mode 100644 index 00000000000..e52336577f0 --- /dev/null +++ b/src/mame/drivers/pc2000.c @@ -0,0 +1,1031 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + VTech PreComputer 1000 / 2000 + + 04/12/2009 Skeleton driver. + + TODO: + - fix MisterX LCD + - MisterX bankswitch + - dump the chargen + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/hd44780.h" +#include "video/sed1520.h" +#include "sound/beep.h" +#include "rendlay.h" +#include "gl3000s.lh" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class pc2000_state : public driver_device +{ +public: + pc2000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_lcdc(*this, "hd44780"), + m_beep(*this, "beeper"), + m_cart(*this, "cartslot"), + m_bank0(*this, "bank0"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2") + { } + + required_device m_maincpu; + optional_device m_lcdc; + required_device m_beep; + required_device m_cart; + optional_memory_bank m_bank0; + required_memory_bank m_bank1; + optional_memory_bank m_bank2; + + UINT8 m_mux_data; + UINT8 m_beep_state; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( key_matrix_r ); + DECLARE_WRITE8_MEMBER( key_matrix_w ); + DECLARE_WRITE8_MEMBER( rombank0_w ); + DECLARE_WRITE8_MEMBER( rombank1_w ); + DECLARE_WRITE8_MEMBER( rombank2_w ); + DECLARE_READ8_MEMBER( beep_r ); + DECLARE_WRITE8_MEMBER( beep_w ); + DECLARE_PALETTE_INIT(pc2000); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pc2000_cart); +}; + +class gl3000s_state : public pc2000_state +{ +public: + gl3000s_state(const machine_config &mconfig, device_type type, const char *tag) + : pc2000_state(mconfig, type, tag), + m_lcdc_r(*this, "sed1520_r"), + m_lcdc_l(*this, "sed1520_l") + { } + + required_device m_lcdc_r; + required_device m_lcdc_l; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + +class gl4004_state : public pc2000_state +{ +public: + gl4004_state(const machine_config &mconfig, device_type type, const char *tag) + : pc2000_state(mconfig, type, tag) + { } + + virtual void machine_start(); +}; + +class pc1000_state : public pc2000_state +{ +public: + pc1000_state(const machine_config &mconfig, device_type type, const char *tag) + : pc2000_state(mconfig, type, tag) + { } + + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( kb_r ); + DECLARE_READ8_MEMBER( lcdc_data_r ); + DECLARE_WRITE8_MEMBER( lcdc_data_w ); + DECLARE_READ8_MEMBER( lcdc_control_r ); + DECLARE_WRITE8_MEMBER( lcdc_control_w ); +}; + + +/* TODO: put a breakpoint at 1625 and test the inputs, writes at dce4 are the scancode values */ +READ8_MEMBER( pc2000_state::key_matrix_r ) +{ + static const char *const bitnames[2][8] = + { + {"IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7"}, + {"IN8", "IN9", "INA", "INB", "INC", "IND", "INE", "INF"} + }; + + UINT8 data = 0xff; + + for (int line=0; line<8; line++) + if (m_mux_data & (1<read(); + + return data; +} + +WRITE8_MEMBER( pc2000_state::key_matrix_w ) +{ + m_mux_data = data; +} + +WRITE8_MEMBER( pc2000_state::rombank0_w ) +{ + m_bank0->set_entry(data & 0x1f); +} + +WRITE8_MEMBER( pc2000_state::rombank1_w ) +{ + m_bank1->set_entry(data & 0x1f); +} + +WRITE8_MEMBER( pc2000_state::rombank2_w ) +{ + if (data & 0x80) + m_bank2->set_entry(data & 0x8f); //cartridge + else + m_bank2->set_entry(data & 0x1f); +} + +READ8_MEMBER( pc2000_state::beep_r ) +{ + return m_beep_state; +} + +WRITE8_MEMBER( pc2000_state::beep_w ) +{ + m_beep->set_state(BIT(data, 3)); + m_beep_state = data; +} + +static ADDRESS_MAP_START(pc2000_mem, AS_PROGRAM, 8, pc2000_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank0") + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") //0x8000 - 0xbfff tests a cartridge, header is 0x55 0xaa 0x59 0x45, if it succeeds a jump at 0x8004 occurs + AM_RANGE(0xc000, 0xdfff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc2000_io , AS_IO, 8, pc2000_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(rombank0_w) + AM_RANGE(0x01, 0x01) AM_WRITE(rombank1_w) + AM_RANGE(0x03, 0x03) AM_WRITE(rombank2_w) + AM_RANGE(0x0a, 0x0b) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) + AM_RANGE(0x10, 0x11) AM_READWRITE(key_matrix_r, key_matrix_w) + AM_RANGE(0x12, 0x12) AM_READWRITE(beep_r, beep_w) +ADDRESS_MAP_END + + +UINT32 gl3000s_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0); + m_lcdc_l->screen_update(screen, bitmap, cliprect); + m_lcdc_r->screen_update(screen, bitmap, cliprect); + return 0; +} + +int gl3000s_sed1520_screen_update(device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *vram, int start_line, int adc, int start_x) +{ + for (int y=0; y<2; y++) + { + int row_pos = 0; + for (int x=0; x<61; x++) + { + int addr = (y + (start_line >> 3)) * 80 + row_pos; + for (int yi=0; yi<8; yi++) + { + int px = start_x - (adc ? (80 - x) : x); + int py = 8 + y*8 + yi; + + if (cliprect.contains(px, py)) + bitmap.pix16(py, px) = (vram[addr % 0x140] >> yi) & 1; + } + + row_pos++; + } + } + return 0; +} + +SED1520_UPDATE_CB(gl3000s_screen_update_right) +{ + return gl3000s_sed1520_screen_update(device, bitmap, cliprect, vram, start_line, adc, 119); +} + +SED1520_UPDATE_CB(gl3000s_screen_update_left) +{ + UINT8 sec[3]; + UINT8 points[2][3]; + memset(sec, 0, sizeof(sec)); + memset(points, 0, sizeof(points)); + + for (int y=0; y<2; y++) + for (int x=59; x<85; x++) + { + UINT8 data = vram[(y*0x50 + x) % 0x140]; + int dpos = (x - 74) / 2; + + for (int yi=0; yi<8; yi++) + { + int state = (data >> yi) & 1; + + if (y == 0 && (x == 74 || x == 76 || x == 78) && yi == 7) sec[dpos] |= (state << 0); + else if (y == 0 && (x == 74 || x == 76 || x == 78) && yi == 0) sec[dpos] |= (state << 2); + else if (y == 0 && (x == 75 || x == 77 || x == 79) && yi == 7) sec[dpos] |= (state << 5); + else if (y == 0 && (x == 75 || x == 77 || x == 79) && yi == 0) sec[dpos] |= (state << 4); + else if (y == 0 && (x == 75 || x == 77 || x == 79) && yi == 1) sec[dpos] |= (state << 3); + else if (y == 1 && (x == 74 || x == 76 || x == 78) && yi == 7) sec[dpos] |= (state << 1); + else if (y == 1 && (x == 75 || x == 77 || x == 79) && yi == 7) sec[dpos] |= (state << 6); + + else if ((x == 74 || x == 76 || x == 78) && yi == 3) points[y][dpos] |= (state << 0); + else if ((x == 74 || x == 76 || x == 78) && yi == 4) points[y][dpos] |= (state << 1); + else if ((x == 74 || x == 76 || x == 78) && yi == 5) points[y][dpos] |= (state << 2); + else if ((x == 75 || x == 77 || x == 79) && yi == 3) points[y][dpos] |= (state << 5); + else if ((x == 75 || x == 77 || x == 79) && yi == 4) points[y][dpos] |= (state << 6); + else if ((x == 75 || x == 77 || x == 79) && yi == 5) points[y][dpos] |= (state << 4); + else if ((x == 75 || x == 77 || x == 79) && yi == 6) points[y][dpos] |= (state << 3); + + else if (y == 1 && x >= 65 && x <= 68 && yi == 7) output_set_indexed_value("LEV", x - 64, state); + else if (x >= 59 && x <= 60 && yi == 7) output_set_indexed_value("TRY", x - 58 + (y ? 0 : 1), state); + else if (y == 1 && x >= 61 && x <= 64 && yi == 7) output_set_indexed_value("TICK", x - 59, state); + else if (y == 0 && x >= 61 && x <= 64 && yi == 7) output_set_indexed_value("TICK", 62 - x + (x >= 63 ? 8 : 0), state); + + else if (x < 74 && yi < 7) + { + int cx = x - 59; + bitmap.pix16(yi, (y ? 0 : 89) + (16 - (cx + cx / 5))) = state; + } + } + } + + for(int i=0; i<3; i++) + { + output_set_indexed_value("TIME", i, sec[i]); + output_set_indexed_value("P1", i, points[1][i]); + output_set_indexed_value("P2", i, points[0][i]); + } + + return gl3000s_sed1520_screen_update(device, bitmap, cliprect, vram, start_line, adc, 58); +} + + +static ADDRESS_MAP_START( gl3000s_io , AS_IO, 8, gl3000s_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x01, 0x01) AM_WRITE(rombank1_w) + AM_RANGE(0x03, 0x03) AM_WRITE(rombank2_w) + AM_RANGE(0x08, 0x09) AM_DEVREADWRITE("sed1520_r", sed1520_device, read, write) + AM_RANGE(0x0a, 0x0b) AM_DEVREADWRITE("sed1520_l", sed1520_device, read, write) + AM_RANGE(0x10, 0x11) AM_READWRITE(key_matrix_r, key_matrix_w) +ADDRESS_MAP_END + +READ8_MEMBER( pc1000_state::kb_r ) +{ + static const char *const bitnames[9] = + { + "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7", "IN8" + }; + + UINT8 data = 0xff; + + for (int line=0; line<9; line++) + if (!(offset & (1<read(); + + return data; +} + +READ8_MEMBER( pc1000_state::lcdc_data_r ) +{ + //logerror("lcdc data r\n"); + return m_lcdc->data_read(space, 0)>>4; +} + +WRITE8_MEMBER( pc1000_state::lcdc_data_w ) +{ + //popmessage("%s", (char*)m_maincpu->space(AS_PROGRAM).get_read_ptr(0x4290)); + + //logerror("lcdc data w %x\n", data); + m_lcdc->data_write(space, 0, data<<4); +} + +READ8_MEMBER( pc1000_state::lcdc_control_r ) +{ + //logerror("lcdc control r\n"); + return m_lcdc->control_read(space, 0)>>4; +} + +WRITE8_MEMBER( pc1000_state::lcdc_control_w ) +{ + //logerror("lcdc control w %x\n", data); + m_lcdc->control_write(space, 0, data<<4); +} + +static HD44780_PIXEL_UPDATE(pc1000_pixel_update) +{ + UINT8 layout[] = { 0x00, 0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48, 0x47, 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37 }; + //UINT8 layout[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49 }; + + for(int i=0; i<20; i++) + if (pos == layout[i]) + { + bitmap.pix16(line*9 + y, i*6 + x) = state; + break; + } +} + +static ADDRESS_MAP_START(pc1000_mem, AS_PROGRAM, 8, pc1000_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("bios", 0x00000) + AM_RANGE(0x4000, 0x47ff) AM_RAM + AM_RANGE(0x8000, 0xbfff) AM_DEVREAD("cartslot", generic_slot_device, read_rom) //0x8000 - 0xbfff tests a cartridge, header is 0x55 0xaa 0x33, if it succeeds a jump at 0x8010 occurs + AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1000_io , AS_IO, 8, pc1000_state) + AM_RANGE(0x0000, 0x01ff) AM_READ(kb_r) + AM_RANGE(0x4000, 0x4000) AM_MIRROR(0xfe) AM_READWRITE(lcdc_control_r, lcdc_control_w) + AM_RANGE(0x4100, 0x4100) AM_MIRROR(0xfe) AM_READWRITE(lcdc_data_r, lcdc_data_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pc2000 ) + PORT_START("IN0") + PORT_DIPNAME( 0x01, 0x01, "IN0" ) //0x83 + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("IN1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("IN2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("IN3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + + PORT_START("IN4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + + PORT_START("IN5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + + PORT_START("IN6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + + PORT_START("IN7") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("IN8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Scramble") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Guess Rork") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Missing Letter") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Letter Hunt") PORT_CODE(KEYCODE_F4) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("IN9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Letter Zapper") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Letter Switch") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sentence Jumble") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Grammar Challenge") PORT_CODE(KEYCODE_F8) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Plurals") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Past Tense") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Synonyms") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Antonyms") PORT_CODE(KEYCODE_F12) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INB") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Basic Math") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Advanced Math") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Math Riddles") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Number Challenge") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INC") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ecology") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("History") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Geography") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Super Power") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("IND") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Typing Game") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alpha Jumble") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Word Flash") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sign Search") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INE") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PC2000 Basic") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Spell Checker") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Calculator") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Load Cartridge") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INF") + PORT_DIPNAME( 0x01, 0x01, "INF" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(DEF_STR( Level_Select )) PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Players") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc1000 ) + PORT_START("IN0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SCHREIBMASCHINENKURS") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COMPUTER-UBUNGEN") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALLGEMEINWISSEN") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MATHE") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GESCHICHTE") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GEOGRAPHIE") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NATURWISSENSCHAFTEN") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPIELE") PORT_CODE(KEYCODE_F8) + + PORT_START("IN1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KASSETTE") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("AUS") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ELEKRONIK-RECHNER") PORT_CODE(KEYCODE_F10) + + PORT_START("IN2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb6") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa4") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xbc") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + + PORT_START("IN3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + + PORT_START("IN4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + + PORT_START("IN5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + + PORT_START("IN6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("IN7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) + + PORT_START("IN8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( gl3000s ) + PORT_START("IN0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Einstellen Antwort") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + + PORT_START("IN1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Hilfe") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + + PORT_START("IN2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Druck Symbol") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_START("IN3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("\xc3\x84") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) + + PORT_START("IN4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + + PORT_START("IN5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("\xc3\x9f") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("\xc3\x96") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + + PORT_START("IN6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("\xc3\x9c") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + + PORT_START("IN7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + + PORT_START("IN8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Off") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BASIC") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Logische Folgen") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bruch / Dezimalrechnen") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Addition") + PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("IN9") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Textverarbeitung") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Buchstabenschl" "\xc3\xbc" "ssel") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bruch / Prozentrechnen") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Subtraktion") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INA") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Taschenrechner") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gleitpfeile") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Algebra") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Multiplikation") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INB") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ZusatzKassette") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stufe") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Spieler") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Zeichensuche") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Division") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INC") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Pr" "\xc3\xa4" "teritum") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Synonyme") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tipp Dich Fit") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Super Schlau-Quiz") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("IND") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Silbentrennung") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Knifflige Grammatik") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Textaufgaben") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Geographie-Quiz") PORT_CODE(KEYCODE_F9) + PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INE") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Wortr" "\xc3\xa4" "tsel") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Verdrehte S" "\xc3\xa4" "tze") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Blitz-S" "\xc3\xa4" "tze") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Geschichte-Quiz") PORT_CODE(KEYCODE_F5) + PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("INF") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Verr" "\xc3\xbc" "ckte R" "\xc3\xa4" "tsel") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Wortarten") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Wortschlange") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Naturwissenschaften-Quiz") PORT_CODE(KEYCODE_F1) + PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +void pc2000_state::machine_start() +{ + std::string region_tag; + UINT8 *bios = memregion("bios")->base(); + UINT8 *cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(); + if (!cart) + cart = memregion("bios")->base(); + + m_bank0->configure_entries(0, 0x10, bios, 0x4000); + m_bank1->configure_entries(0, 0x10, bios, 0x4000); + m_bank2->configure_entries(0, 0x10, bios, 0x4000); + m_bank2->configure_entries(0x80, 0x10, cart, 0x4000); +} + +void gl4004_state::machine_start() +{ + std::string region_tag; + UINT8 *bios = memregion("bios")->base(); + UINT8 *cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(); + if (!cart) + cart = memregion("bios")->base(); + + m_bank0->configure_entries(0, 0x20, bios, 0x4000); + m_bank1->configure_entries(0, 0x20, bios, 0x4000); + m_bank2->configure_entries(0, 0x20, bios, 0x4000); + m_bank2->configure_entries(0x80, 0x10, cart, 0x4000); +} + +void pc2000_state::machine_reset() +{ + //set the initial bank + m_bank0->set_entry(0); + m_bank1->set_entry(0); + m_bank2->set_entry(0); +} + +void pc1000_state::machine_start() +{ + UINT8 *bios = memregion("bios")->base(); + m_bank1->configure_entries(0, 0x08, bios, 0x4000); +} + +void pc1000_state::machine_reset() +{ + m_bank1->set_entry(0); +} + +PALETTE_INIT_MEMBER(pc2000_state, pc2000) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static const gfx_layout hd44780_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( pc2000 ) + GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, hd44780_charlayout, 0, 1 ) +GFXDECODE_END + + +DEVICE_IMAGE_LOAD_MEMBER( pc2000_state, pc2000_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + // we always allocate a 0x40000 region, even if most carts span only 0x20000, + // because the bankswitch code accesses up to 16 x 16K banks... + m_cart->rom_alloc(0x40000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +static MACHINE_CONFIG_START( pc2000, pc2000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) /* probably not accurate */ + MCFG_CPU_PROGRAM_MAP(pc2000_mem) + MCFG_CPU_IO_MAP(pc2000_io) + MCFG_CPU_PERIODIC_INT_DRIVER(pc2000_state, irq0_line_hold, 50) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_SIZE(120, 18) //2x20 chars + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(pc2000_state, pc2000) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc2000) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 20) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "genius_cart") + MCFG_GENERIC_LOAD(pc2000_state, pc2000_cart) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( gl2000, pc2000 ) + MCFG_SOFTWARE_LIST_ADD("cart_list", "gl2000") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") +MACHINE_CONFIG_END + +static HD44780_PIXEL_UPDATE(gl4000_pixel_update) +{ + if (pos < 40) + { + static const UINT8 gl4000_display_layout[] = + { + 0x00, 0x01, 0x02, 0x03, 0x28, 0x29, 0x2a, 0x2b, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, + 0x14, 0x15, 0x16, 0x17, 0x3c, 0x3d, 0x3e, 0x3f, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x40, 0x41, 0x42, 0x43, + 0x44, 0x45, 0x46, 0x47, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f + }; + + UINT8 char_pos = gl4000_display_layout[line*40 + pos]; + bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; + } +} + +static MACHINE_CONFIG_DERIVED_CLASS( gl3000s, pc2000, gl3000s_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(gl3000s_io) + + MCFG_DEVICE_REMOVE("hd44780") + MCFG_SED1520_ADD("sed1520_l", gl3000s_screen_update_left) // left panel is 59 pixels (0-58) + MCFG_SED1520_ADD("sed1520_r", gl3000s_screen_update_right) // right panel is 61 pixels (59-119) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(120, 24) + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 24-1) + MCFG_SCREEN_UPDATE_DRIVER( gl3000s_state, screen_update ) + + MCFG_DEFAULT_LAYOUT(layout_gl3000s) + + MCFG_DEVICE_REMOVE("gfxdecode") + + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( gl4000, pc2000, gl4004_state ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(120, 36) // 4x20 chars + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 36-1) + + MCFG_DEVICE_MODIFY("hd44780") + MCFG_HD44780_LCD_SIZE(4, 20) + MCFG_HD44780_PIXEL_UPDATE_CB(gl4000_pixel_update) + + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( misterx, pc2000, pc1000_state ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pc1000_mem) + MCFG_CPU_IO_MAP(pc1000_io) + MCFG_CPU_PERIODIC_INT_DRIVER(pc1000_state, irq0_line_hold, 10) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(120, 9) //1x20 chars + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 9-1) + + MCFG_DEVICE_MODIFY("hd44780") + MCFG_HD44780_LCD_SIZE(1, 20) + MCFG_HD44780_PIXEL_UPDATE_CB(pc1000_pixel_update) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "misterx") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pc2000 ) + ROM_REGION( 0x40000, "bios", 0 ) + ROM_LOAD( "lh532hee_9344_d.u4", 0x000000, 0x040000, CRC(0b03bf33) SHA1(cb344b94b14975c685041d3e669f386e8a21909f)) +ROM_END + +ROM_START( gl2000 ) + ROM_REGION( 0x40000, "bios", 0 ) + ROM_LOAD( "lh532hez_9416_d.bin", 0x000000, 0x040000, CRC(532f219e) SHA1(4044f0cf098087af4cc9d1b2a80c3c9ec06f154e)) +ROM_END + +ROM_START( gl2000c ) + ROM_REGION( 0x40000, "bios", 0 ) + ROM_LOAD( "27-5491-00", 0x000000, 0x020000, CRC(cbb9fe90) SHA1(a2a7a8afb027fe764a5998e3b35e87f291c24df1)) +ROM_END + +ROM_START( gl2000p ) + ROM_REGION( 0x40000, "bios", 0 ) + ROM_LOAD( "27-5615-00_9534_d.bin", 0x000000, 0x040000, CRC(481c1000) SHA1(da6f60e5bb25145ec5239310296bedaabeeaee28)) +ROM_END + +ROM_START( gl3000s ) + ROM_REGION(0x40000, "bios", 0) + ROM_LOAD( "27-5713-00", 0x000000, 0x040000, CRC(18b113e0) SHA1(27a12893c38068efa35a99fa97a260dbfbd497e3) ) +ROM_END + +ROM_START( gl4000 ) + ROM_REGION(0x80000, "bios", 0) + ROM_LOAD( "27-5480-00", 0x000000, 0x040000, CRC(8de047d3) SHA1(bb1d869954773bb7b8b51caa54531015d6b751ec) ) +ROM_END + +ROM_START( gl4004 ) + ROM_REGION(0x80000, "bios", 0) + ROM_LOAD( "27-5762-00.u2", 0x000000, 0x080000, CRC(fb242f0f) SHA1(aae1beeb94873e29920726ad35475641d9f1e94e) ) +ROM_END + +ROM_START( gl5000 ) + ROM_REGION(0x80000, "bios", 0) + ROM_LOAD( "27-5912-00.u1", 0x000000, 0x080000, CRC(9fe4c04a) SHA1(823d1d46e49e21f921260296874bc3ee5f718a5f) ) +ROM_END + +ROM_START( gl5005x ) + ROM_REGION(0x200000, "bios", 0) + ROM_LOAD( "27-6426-00.u1", 0x000000, 0x200000, CRC(adde3581) SHA1(80f2bde7c5c339534614f24a9ca6ea362ee2f816) ) +ROM_END + +ROM_START( glpn ) + ROM_REGION( 0x200000, "bios", 0 ) + ROM_LOAD( "27-5755-01.u1", 0x00000, 0x80000, CRC(dc28346b) SHA1(148fe664bef5b2f68c6702c74462802b76900ca0) ) +ROM_END + +ROM_START( gmtt ) + ROM_REGION(0x100000, "bios", 0) + ROM_LOAD( "27-6154-00.u4", 0x000000, 0x100000, CRC(e908262d) SHA1(a7964c9f9d304b6b2cce61822e8c6151b50388be) ) +ROM_END + +ROM_START( gbs5505x ) + ROM_REGION(0x200000, "bios", 0) + ROM_LOAD( "27-7006-00.u5", 0x000000, 0x200000, CRC(28af3ca7) SHA1(5df7063c7327263c23d5ac2aac3aa66f7e0821c5) ) +ROM_END + +ROM_START( gln ) // not Z80 code + ROM_REGION( 0x80000, "bios", 0 ) + ROM_LOAD( "27-5308-00_9524_d.bin", 0x000000, 0x080000, CRC(d1b994ee) SHA1(b5cf0810df0676712e4f30e279cc46c19b4277dd)) +ROM_END + +ROM_START( pc1000 ) + ROM_REGION( 0x20000, "bios", 0 ) + ROM_LOAD( "27-00780-002-002.u4", 0x000000, 0x020000, CRC(705170ae) SHA1(825ce0ff2c7d0a7b1e2577d1465a37f7e8da383b)) +ROM_END + +ROM_START( misterx ) + ROM_REGION( 0x20000, "bios", 0 ) + ROM_LOAD( "27-00882-001.bin", 0x000000, 0x020000, CRC(30e0dc94) SHA1(2f4675746a41399b3d9e3e8001a9b4a0dcc5b620)) +ROM_END + +ROM_START( lexipcm ) + ROM_REGION( 0x200000, "bios", 0 ) + ROM_LOAD( "epoxy.u3", 0x00000, 0x100000, CRC(0a410790) SHA1(be04d5f74208a2f3b200daed75e04e966f64b545) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1988, pc1000, 0, 0, misterx, pc1000, driver_device, 0, "Video Technology", "PreComputer 1000", MACHINE_NOT_WORKING) +COMP( 1988, misterx, 0, 0, misterx, pc1000, driver_device, 0, "Video Technology / Yeno", "MisterX", MACHINE_NOT_WORKING) +COMP( 1993, pc2000, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "PreComputer 2000", MACHINE_NOT_WORKING) +COMP( 1993, gl2000, 0, 0, gl2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 2000", MACHINE_NOT_WORKING) +COMP( 1994, gl2000c, gl2000, 0, gl2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 2000 Compact", MACHINE_NOT_WORKING) +COMP( 1995, gl2000p, gl2000, 0, gl2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 2000 Plus", MACHINE_NOT_WORKING) +COMP( 1996, gl3000s, 0, 0, gl3000s, gl3000s,driver_device, 0, "Video Technology", "Genius Leader 3000S (Germany)", MACHINE_NOT_WORKING) +COMP( 1994, gl4000, 0, 0, gl4000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 4000 Quadro (Germany)", MACHINE_NOT_WORKING) +COMP( 1996, gl4004, 0, 0, gl4000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 4004 Quadro L (Germany)", MACHINE_NOT_WORKING) +COMP( 1997, gl5000, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 5000 (Germany)", MACHINE_IS_SKELETON) +COMP( 1997, gl5005x, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 5005X (Germany)", MACHINE_IS_SKELETON) +COMP( 1997, glpn, 0, 0, gl4000, pc2000, driver_device, 0, "Video Technology", "Genius Leader Power Notebook (Germany)", MACHINE_IS_SKELETON) +COMP( 1998, gmtt , 0, 0, gl4000, pc2000, driver_device, 0, "Video Technology", "Genius Master Table Top (Germany)", MACHINE_IS_SKELETON) +COMP( 2001, gbs5505x, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "Genius BrainStation 5505X (Germany)", MACHINE_IS_SKELETON) +COMP( 1993, gln, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader Notebook", MACHINE_IS_SKELETON) +COMP( 1999, lexipcm, 0, 0, pc2000, pc2000, driver_device, 0, "Lexibook", "LexiPC Mega 2000 (Germany)", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/pc4.c b/src/mame/drivers/pc4.c new file mode 100644 index 00000000000..014feebe6cb --- /dev/null +++ b/src/mame/drivers/pc4.c @@ -0,0 +1,250 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + VTech Laser PC4 + + Driver by Sandro Ronco + + I found no documentations about this, if you have documentation or schematic + please let me know. + + Notes: + - the LCD controller seems similar to a HD44780, but with more ddram and + uses the bit 0 and 2 of the "Function Set" (0x2?) that are unused in + the specifications of the HD44780 datasheet. + - INT and NMI interrupt lines cause "LOW BATTERY" signal + - chargen are taken from other driver, a real dump is required + + More info: + http://www.8bit-micro.com/laser.htm + http://www.euskalnet.net/ingepal/images/Vtech_Laser_PC4_1988.jpg + http://www.oldcomputermuseum.com/laser_pc4.html + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/rp5c01.h" +#include "rendlay.h" +#include "includes/pc4.h" + + +READ8_MEMBER( pc4_state::kb_r ) +{ + UINT8 data = 0xff; + + for (int line=0; line<8; line++) + { + if (!(offset & (1<read(); + } + } + + return data; +} + +WRITE8_MEMBER( pc4_state::bank_w ) +{ + //printf("set bank %x\n", data); + m_rombank->set_entry(data&0x07); +} + +WRITE8_MEMBER( pc4_state::beep_w ) +{ + m_beep->set_state(data&0x40); +} + +static ADDRESS_MAP_START(pc4_mem, AS_PROGRAM, 8, pc4_state) + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("rombank") + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pc4_io, AS_IO, 8, pc4_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) + AM_RANGE(0x1000, 0x1000) AM_WRITE(beep_w) + AM_RANGE(0x1fff, 0x1fff) AM_WRITE(bank_w) + + AM_RANGE(0x3000, 0x3000) AM_WRITE(lcd_control_w) + AM_RANGE(0x3001, 0x3001) AM_WRITE(lcd_data_w) + AM_RANGE(0x3002, 0x3002) AM_READ(lcd_control_r) + AM_RANGE(0x3003, 0x3003) AM_READ(lcd_data_r) + AM_RANGE(0x3005, 0x3005) AM_WRITE(lcd_offset_w) + + //keyboard read, offset used as matrix + AM_RANGE(0x5000, 0x50ff) AM_READ(kb_r) +ADDRESS_MAP_END + +static INPUT_PORTS_START( pc4 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('/') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('?') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLOck") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED +INPUT_PORTS_END + +PALETTE_INIT_MEMBER(pc4_state, pc4) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static const gfx_layout pc4_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( pc4 ) + GFXDECODE_ENTRY( "charset", 0x0000, pc4_charlayout, 0, 1 ) +GFXDECODE_END + +void pc4_state::machine_start() +{ + static const char *const bitnames[] = {"LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7"}; + UINT8* rom_base = (UINT8 *)memregion("maincpu")->base(); + + m_rombank->configure_entries(0, 8, rom_base, 0x4000); + m_rombank->set_entry(0); + + m_busy_timer = timer_alloc(BUSY_TIMER); + m_blink_timer = timer_alloc(BLINKING_TIMER); + m_blink_timer->adjust(attotime::from_msec(409), 0, attotime::from_msec(409)); + + for (int i=0; i<8; i++) + { + io_port[i] = ioport(bitnames[i]); + } + + m_ac = 0; + m_ac_mode = 0; + m_data_bus_flag = 0; + m_cursor_pos = 0; + m_display_on = 0; + m_cursor_on = 0; + m_shift_on = 0; + m_blink_on = 0; + m_direction = 1; + m_disp_shift = 0; + m_blink = 0; +} + +static MACHINE_CONFIG_START( pc4, pc4_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(pc4_mem) + MCFG_CPU_IO_MAP(pc4_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(72) + MCFG_SCREEN_UPDATE_DRIVER(pc4_state, screen_update) + MCFG_SCREEN_SIZE(240, 36) + MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 36-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(pc4_state, pc4) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc4) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) +MACHINE_CONFIG_END + +ROM_START( pc4 ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "laser pc4 v4.14a.u2", 0x00000, 0x20000, CRC(f8dabf5d) SHA1(6988517b3ccb42df2b8d6e1517ff04b24458d146) ) + ROM_REGION( 0x0860, "charset", ROMREGION_ERASE ) + ROM_LOAD( "44780a00.bin", 0x0000, 0x0860, BAD_DUMP CRC(3a89024c) SHA1(5a87b68422a916d1b37b5be1f7ad0b3fb3af5a8d)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1990, pc4, 0, 0, pc4, pc4, driver_device, 0, "Laser Computer", "Laser PC4", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pc6001.c b/src/mame/drivers/pc6001.c new file mode 100644 index 00000000000..aadd261c5b0 --- /dev/null +++ b/src/mame/drivers/pc6001.c @@ -0,0 +1,2476 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/******************************************************************************************************************************************************* + + PC-6001 series (c) 1981 NEC + + driver by Angelo Salese + + TODO: + - Hook up tape loading, images that are floating around the net are already + ADC'ed, so they should be easy to implement (but not exactly faithful) + - cassette handling requires a decap of the MCU. It could be possible to + do some tight synch between the master CPU and a code simulation,but I think + it's not worth the effort... + - Identify and hook-up the FDC device, apparently PC-6001 and PC-6601 doesn't even use the same thing; + - PC-6601: mon r-0 type games doesn't seem to work at all on this system? + - PC-6001SR: get it to boot, also implement MK-2 compatibility mode (it changes the memory map to behave like the older versions) + - Currently rewriting the video part without the MC6847 for two reasons: + A) the later models have a custom video chip in the place of the MC6847, + so this implementation will be used in the end. + B) It's easier to me to see what the attribute vram does since I don't + have any docs atm. + + TODO (game specific): + - (several AX* games, namely Galaxy Mission Part 1/2 and others): inputs doesn't work + - AX6 - Demo: When AY-based speech talks, other emus emulates the screen drawing to be a solid green (plain PC-6001) or solid white (Mk2 version), + but, according to an original video reference that I've seen, that screen should actually some kind of weird garbage on it ... + - AX6 - Powered Knight: doesn't work too well, according to the asm code it asks the player to press either 'B' or 'C' then a number but + nothing is shown on screen, other emus behaves the same, bad dump? + - Dawn Patrol (cart): presumably too slow; + (Mk2 mode 5 games) + - 3D Golf Simulation Super Version: gameplay / inputs seems broken + - American Truck: Screen is offset at the loading screen, loading bug? + - Castle Excellent: copyright text drawing is quite bogus, scans text in vertical instead of horizontal? + - Dezeni Land (ALL versions) / Hurry Fox 1/2: asks you to "load something", can't do it with current cassette kludge, also, for Dezeni Land(s) keyboard irqs + doesn't seem to work too well with halt opcode execution? + - Dezeni Land 1/4: dies after loading of main program + - Dezeni Land 2: dies at the "load something" screen with presumably wrong stack opcodes + - (MyCom BASIC games with multiple files): most of them refuses to run ... how to load them? + - Grobda: when "get ready" speech plays, screen should be full white but instead it's all black, same issue as AX-6 Demo? + - Pac-Man / Tiny Xevious 2: gameplay is too fast + - Salad no Kunino Tomato-Hime: can't start a play + - Space Harrier: inputs doesn't work properly + - The Black Onyx: dies when it attempts to save the character, that obviously means saving on the tape + - Yakyukyo / Punchball Mario: waits for an irq, check which one; + +======================================================================================================================================================== + + PC-6001 (1981-09): + + * CPU: Z80A @ 4 MHz + * ROM: 16KB + 4KB (chargen) - no kanji + * RAM: 16KB, it can be expanded to 32KB + * Text Mode: 32x16 and 2 colors + * Graphic Modes: 64x48 (9 colors), 128x192 (4 colors), 256x192 (2 colors) + * Sound: BEEP + PSG - Optional Voice Synth Cart + * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, + HOME/CLR key, INS key, DEL key, GRAPH key, Japanese syllabary + key, page key, STOP key, and cursor key (4 directions) + * 1 cartslot, optional floppy drive, optional serial 232 port, 2 + joystick ports + + + PC-6001 mkII (1983-07): + + * CPU: Z80A @ 4 MHz + * ROM: 32KB + 16KB (chargen) + 32KB (kanji) + 16KB (Voice Synth) + * RAM: 64KB + * Text Mode: same as PC-6001 with N60-BASIC; 40x20 and 15 colors with + N60M-BASIC + * Graphic Modes: same as PC-6001 with N60-BASIC; 80x40 (15 colors), + 160x200 (15 colors), 320x200 (4 colors) with N60M-BASIC + * Sound: BEEP + PSG + * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, + HOME/CLR key, INS key, DEL key, CAPS key, GRAPH key, Japanese + syllabary key, page key, mode key, STOP key, and cursor key (4 + directions) + * 1 cartslot, floppy drive, optional serial 232 port, 2 joystick ports + + + PC-6001 mkIISR (1984-12): + + * CPU: Z80A @ 3.58 MHz + * ROM: 64KB + 16KB (chargen) + 32KB (kanji) + 32KB (Voice Synth) + * RAM: 64KB + * Text Mode: same as PC-6001/PC-6001mkII with N60-BASIC; 40x20, 40x25, + 80x20, 80x25 and 15 colors with N66SR-BASIC + * Graphic Modes: same as PC-6001/PC-6001mkII with N60-BASIC; 80x40 (15 colors), + 320x200 (15 colors), 640x200 (15 colors) with N66SR-BASIC + * Sound: BEEP + PSG + FM + * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, + HOME/CLR key, INS key, DEL key, CAPS key, GRAPH key, Japanese + syllabary key, page key, mode key, STOP key, and cursor key (4 + directions) + * 1 cartslot, floppy drive, optional serial 232 port, 2 joystick ports + + + info from http://www.geocities.jp/retro_zzz/machines/nec/6001/spc60.html + +================================================================================== + +PC-6001 irq table: +irq vector 0x00: writes 0x00 to [$fa19] ;(unused) +irq vector 0x02: (A = 0, B = 0) tests ppi port c, does something with ay ports (plus more?) ;keyboard data ready, no kanji lock, no caps lock +irq vector 0x04: ;uart irq +irq vector 0x06: operates with $fa28, $fa2e, $fd1b ;timer irq +irq vector 0x08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19] ;tape data ready +irq vector 0x0a: writes 0x00 to [$fa19] ;(unused) +irq vector 0x0c: writes 0x00 to [$fa19] ;(unused) +irq vector 0x0e: same as 2, (A = 0x03, B = 0x00) ;keyboard data ready, unknown type +irq vector 0x10: same as 2, (A = 0x03, B = 0x00) ;(unused) +irq vector 0x12: writes 0x10 to [$fa19] ;end of tape reached +irq vector 0x14: same as 2, (A = 0x00, B = 0x01) ;kanji lock enabled +irq vector 0x16: tests ppi port c, writes the result to $feca. ;joystick +irq vector 0x18: ;TVR (?) +irq vector 0x1a: ;Date +irq vector 0x1c: ;(unused) +irq vector 0x1e: ;(unused) +irq vector 0x20: ;voice +irq vector 0x22: ;VRTC (?) +irq vector 0x24: ;(unused) +irq vector 0x26: ;(unused) + + +*******************************************************************************************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "video/mc6847.h" +#include "sound/ay8910.h" +#include "sound/upd7752.h" +#include "sound/wave.h" + +#include "imagedev/cassette.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "formats/p6001_cas.h" + + +class pc6001_state : public driver_device +{ +public: + pc6001_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_ppi(*this, "ppi8255"), + m_ram(*this, "ram"), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_cas_hack(*this, "cas_hack"), + m_cart(*this, "cartslot"), + m_region_maincpu(*this, "maincpu"), + m_region_gfx1(*this, "gfx1"), + m_io_mode4_dsw(*this, "MODE4_DSW"), + m_io_p1(*this, "P1"), + m_io_p2(*this, "P2"), + m_io_key1(*this, "key1"), + m_io_key2(*this, "key2"), + m_io_key3(*this, "key3"), + m_io_key_modifiers(*this, "key_modifiers"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_bank5(*this, "bank5"), + m_bank6(*this, "bank6"), + m_bank7(*this, "bank7"), + m_bank8(*this, "bank8"), + m_palette(*this, "palette") { } + + required_device m_ppi; + + optional_shared_ptr m_ram; + UINT8 *m_video_ram; + UINT8 m_irq_vector; + UINT8 m_cas_switch; + UINT8 m_sys_latch; + UINT8 m_timer_irq_mask; + UINT32 m_cas_offset; + UINT32 m_cas_maxsize; + emu_timer *m_timer_irq_timer; + UINT16 m_timer_hz_div; + UINT8 m_ex_vram_bank; + UINT8 m_bgcol_bank; + UINT8 m_exgfx_text_mode; + UINT8 m_exgfx_bitmap_mode; + UINT8 m_exgfx_2bpp_mode; + UINT8 m_bank_r0; + UINT8 m_bank_r1; + UINT8 m_gfx_bank_on; + UINT8 m_bank_w; + UINT8 m_bank_opt; + UINT8 m_timer_irq_mask2; + UINT8 m_timer_irq_vector; + UINT32 m_cgrom_bank_addr; + UINT8 m_sr_video_mode; + UINT8 m_port_c_8255; + UINT8 m_cur_keycode; + UINT8 m_sr_bank_r[8]; + UINT8 m_sr_bank_w[8]; + UINT8 m_kludge; + UINT32 m_old_key1; + UINT32 m_old_key2; + UINT32 m_old_key3; + DECLARE_WRITE8_MEMBER(pc6001_system_latch_w); + DECLARE_READ8_MEMBER(nec_ppi8255_r); + DECLARE_WRITE8_MEMBER(nec_ppi8255_w); + DECLARE_WRITE8_MEMBER(pc6001m2_bank_r0_w); + DECLARE_WRITE8_MEMBER(pc6001m2_bank_r1_w); + DECLARE_WRITE8_MEMBER(pc6001m2_bank_w0_w); + DECLARE_WRITE8_MEMBER(pc6001m2_opt_bank_w); + DECLARE_WRITE8_MEMBER(work_ram0_w); + DECLARE_WRITE8_MEMBER(work_ram1_w); + DECLARE_WRITE8_MEMBER(work_ram2_w); + DECLARE_WRITE8_MEMBER(work_ram3_w); + DECLARE_WRITE8_MEMBER(work_ram4_w); + DECLARE_WRITE8_MEMBER(work_ram5_w); + DECLARE_WRITE8_MEMBER(work_ram6_w); + DECLARE_WRITE8_MEMBER(work_ram7_w); + DECLARE_WRITE8_MEMBER(necmk2_ppi8255_w); + DECLARE_WRITE8_MEMBER(pc6001m2_system_latch_w); + DECLARE_WRITE8_MEMBER(pc6001m2_vram_bank_w); + DECLARE_WRITE8_MEMBER(pc6001m2_col_bank_w); + DECLARE_WRITE8_MEMBER(pc6001m2_0xf3_w); + DECLARE_WRITE8_MEMBER(pc6001m2_timer_adj_w); + DECLARE_WRITE8_MEMBER(pc6001m2_timer_irqv_w); + DECLARE_READ8_MEMBER(pc6001m2_bank_r0_r); + DECLARE_READ8_MEMBER(pc6001m2_bank_r1_r); + DECLARE_READ8_MEMBER(pc6001m2_bank_w0_r); + DECLARE_READ8_MEMBER(pc6601_fdc_r); + DECLARE_WRITE8_MEMBER(pc6601_fdc_w); + DECLARE_READ8_MEMBER(pc6001sr_bank_rn_r); + DECLARE_WRITE8_MEMBER(pc6001sr_bank_rn_w); + DECLARE_READ8_MEMBER(pc6001sr_bank_wn_r); + DECLARE_WRITE8_MEMBER(pc6001sr_bank_wn_w); + DECLARE_WRITE8_MEMBER(sr_work_ram0_w); + DECLARE_WRITE8_MEMBER(sr_work_ram1_w); + DECLARE_WRITE8_MEMBER(sr_work_ram2_w); + DECLARE_WRITE8_MEMBER(sr_work_ram3_w); + DECLARE_WRITE8_MEMBER(sr_work_ram4_w); + DECLARE_WRITE8_MEMBER(sr_work_ram5_w); + DECLARE_WRITE8_MEMBER(sr_work_ram6_w); + DECLARE_WRITE8_MEMBER(sr_work_ram7_w); + DECLARE_WRITE8_MEMBER(pc6001sr_mode_w); + DECLARE_WRITE8_MEMBER(pc6001sr_vram_bank_w); + DECLARE_WRITE8_MEMBER(pc6001sr_system_latch_w); + DECLARE_WRITE8_MEMBER(necsr_ppi8255_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(pc6001); + DECLARE_MACHINE_RESET(pc6001m2); + DECLARE_PALETTE_INIT(pc6001m2); + DECLARE_MACHINE_RESET(pc6001sr); + UINT32 screen_update_pc6001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_pc6001m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(pc6001_interrupt); + INTERRUPT_GEN_MEMBER(pc6001sr_interrupt); + TIMER_CALLBACK_MEMBER(audio_callback); + TIMER_DEVICE_CALLBACK_MEMBER(cassette_callback); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); + DECLARE_READ8_MEMBER(pc6001_8255_porta_r); + DECLARE_WRITE8_MEMBER(pc6001_8255_porta_w); + DECLARE_READ8_MEMBER(pc6001_8255_portb_r); + DECLARE_WRITE8_MEMBER(pc6001_8255_portb_w); + DECLARE_WRITE8_MEMBER(pc6001_8255_portc_w); + DECLARE_READ8_MEMBER(pc6001_8255_portc_r); + IRQ_CALLBACK_MEMBER(pc6001_irq_callback); +protected: + required_device m_maincpu; + optional_device m_cassette; + optional_device m_cas_hack; + required_device m_cart; + required_memory_region m_region_maincpu; + required_memory_region m_region_gfx1; + required_ioport m_io_mode4_dsw; + required_ioport m_io_p1; + required_ioport m_io_p2; + required_ioport m_io_key1; + required_ioport m_io_key2; + required_ioport m_io_key3; + required_ioport m_io_key_modifiers; + required_memory_bank m_bank1; + optional_memory_bank m_bank2; + optional_memory_bank m_bank3; + optional_memory_bank m_bank4; + optional_memory_bank m_bank5; + optional_memory_bank m_bank6; + optional_memory_bank m_bank7; + optional_memory_bank m_bank8; + required_device m_palette; + + memory_region *m_cart_rom; + + void draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr); + void draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr); + void draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr); + void draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr,int has_mc6847); + void draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr,int has_mc6847); + void pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &cliprect, int has_mc6847); + UINT8 check_joy_press(); + UINT8 check_keyboard_press(); + void vram_bank_change(UINT8 vram_bank); + ATTR_CONST UINT8 pc6001_get_attributes(UINT8 c,int scanline, int pos); + const UINT8 *pc6001_get_video_ram(int scanline); + UINT8 pc6001_get_char_rom(UINT8 ch, int line); +}; + + +/* PC6001mk2 specific */ +/* PC6001SR specific */ + +#define IRQ_LOG (0) + +void pc6001_state::video_start() +{ + #if 0 + m6847_config cfg; + + memset(&cfg, 0, sizeof(cfg)); + cfg.type = M6847_VERSION_M6847T1_NTSC; + cfg.get_attributes = pc6001_get_attributes; + cfg.get_video_ram = pc6001_get_video_ram; + cfg.get_char_rom = pc6001_get_char_rom; + m6847_init(machine(), &cfg); + #endif + m_video_ram = auto_alloc_array(machine(), UINT8, 0x4000); +} + +/* this is known as gfx mode 4 */ +void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr) +{ + int x,y,xi; + int fgcol,color; + int col_setting; + static const UINT8 pen_gattr[4][4] = { + { 0, 1, 6, 2 }, //Red / Blue + { 0, 6, 1, 2 }, //Blue / Red + { 0, 5, 2, 2 }, //Pink / Green + { 0, 2, 5, 2 }, //Green / Pink + }; + static const UINT8 pen_wattr[4][4] = { + { 0, 1, 6, 7 }, //Red / Blue + { 0, 6, 1, 7 }, //Blue / Red + { 0, 5, 2, 7 }, //Pink / Green + { 0, 2, 5, 7 }, //Green / Pink + }; + col_setting = m_io_mode4_dsw->read() & 7; + + if((attr & 0x0c) != 0x0c) + popmessage("Mode 4 vram attr != 0x0c, contact MESSdev"); + + for(y=0;y<192;y++) + { + for(x=0;x<32;x++) + { + int tile = m_video_ram[(x+(y*32))+0x200]; + + if(col_setting == 0x00) //monochrome + { + for(xi=0;xi<8;xi++) + { + fgcol = (attr & 2) ? 7 : 2; + + color = ((tile)>>(7-xi) & 1) ? fgcol : 0; + + bitmap.pix16((y+24), (x*8+xi)+32) = m_palette->pen(color); + } + } + else + { + for(xi=0;xi<4;xi++) + { + fgcol = ((tile)>>(6-(xi*2)) & 3); + + color = (attr & 2) ? (pen_wattr[col_setting-1][fgcol]) : (pen_gattr[col_setting-1][fgcol]); + + bitmap.pix16((y+24), ((x*8+xi*2)+0)+32) = m_palette->pen(color); + bitmap.pix16((y+24), ((x*8+xi*2)+1)+32) = m_palette->pen(color); + } + } + } + } +} + +void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr) +{ + int color,x,y,xi,yi; + + int shrink_x = 2*4; + int shrink_y = (attr & 8) ? 1 : 2; + int w = (shrink_x == 8) ? 32 : 16; + int col_bank = ((attr & 2)<<1); + + if(attr & 4) + { + for(y=0;y<(192/shrink_y);y++) + { + for(x=0;x>1; + color = ((tile >> i) & 3)+8; + color+= col_bank; + + bitmap.pix16(((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + } + } + } + } + } + else /* TODO: clean this up */ + { + for(y=0;y<(192/shrink_y);y+=3) + { + for(x=0;x>1; + color = ((tile >> i) & 3)+8; + color+= col_bank; + + bitmap.pix16((((y+0)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix16((((y+1)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix16((((y+2)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + } + } + } + } + } +} + +void pc6001_state::draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr) +{ + int color,pen,xi,yi; + + if(attr & 0x10) //2x2 squares on a single cell + pen = (tile & 0x70)>>4; + else //2x3 + pen = (tile & 0xc0) >> 6 | (attr & 2)<<1; + + for(yi=0;yi<12;yi++) + { + for(xi=0;xi<8;xi++) + { + int i; + i = (xi & 4)>>2; //x-axis + if(attr & 0x10) //2x2 + { + i+= (yi >= 6) ? 2 : 0; //y-axis + } + else //2x3 + { + i+= (yi & 4)>>1; //y-axis 1 + i+= (yi & 8)>>1; //y-axis 2 + } + + color = ((tile >> i) & 1) ? pen+8 : 0; + + bitmap.pix16(((y*12+(11-yi))+24), (x*8+(7-xi))+32) = m_palette->pen(color); + } + } +} + +void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr,int has_mc6847) +{ + int xi,yi,pen,fgcol,color; + UINT8 *gfx_data = m_region_gfx1->base(); + + for(yi=0;yi<12;yi++) + { + for(xi=0;xi<8;xi++) + { + pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + + if(has_mc6847) + { + fgcol = (attr & 2) ? 0x12 : 0x10; + + if(attr & 1) + color = pen ? (fgcol+0) : (fgcol+1); + else + color = pen ? (fgcol+1) : (fgcol+0); + + } + else + { + fgcol = (attr & 2) ? 2 : 7; + + if(attr & 1) + color = pen ? 0 : fgcol; + else + color = pen ? fgcol : 0; + } + + bitmap.pix16(((y*12+yi)+24), (x*8+xi)+32) = m_palette->pen(color); + } + } +} + +void pc6001_state::draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr,int has_mc6847) +{ + int x,y,color; + + for(y=0;y<240;y++) + { + for(x=0;x<320;x++) + { + if(!has_mc6847) //mk2 border color is always black + color = 0; + else if((attr & 0x90) == 0x80) //2bpp + color = ((attr & 2)<<1) + 8; + else if((attr & 0x90) == 0x90) //1bpp + color = (attr & 2) ? 7 : 2; + else + color = 0; //FIXME: other modes not yet checked + + bitmap.pix16(y, x) = m_palette->pen(color); + } + } +} + +void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &cliprect, int has_mc6847) +{ + int x,y; + int tile,attr; + + attr = m_video_ram[0]; + + draw_border(bitmap,cliprect,attr,has_mc6847); + + if(attr & 0x80) // gfx mode + { + if(attr & 0x10) // 256x192x1 mode (FIXME: might be a different trigger) + { + draw_gfx_mode4(bitmap,cliprect,attr); + } + else // 128x192x2 mode + { + draw_bitmap_2bpp(bitmap,cliprect,attr); + } + } + else // text mode + { + for(y=0;y<16;y++) + { + for(x=0;x<32;x++) + { + tile = m_video_ram[(x+(y*32))+0x200]; + attr = m_video_ram[(x+(y*32)) & 0x1ff]; + + if(attr & 0x40) + { + draw_tile_3bpp(bitmap,cliprect,x,y,tile,attr); + } + else + { + draw_tile_text(bitmap,cliprect,x,y,tile,attr,has_mc6847); + } + } + } + } +} + +UINT32 pc6001_state::screen_update_pc6001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + pc6001_screen_draw(bitmap,cliprect,1); + + return 0; +} + +UINT32 pc6001_state::screen_update_pc6001m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,tile,attr; + + /* note: bitmap mode have priority over everything else, check American Truck */ + if(m_exgfx_bitmap_mode) + { + int count,color,i; + + count = 0; + + for(y=0;y<200;y++) + { + for(x=0;x<160;x+=4) + { + for(i=0;i<4;i++) + { + int pen[2]; +#if 0 + /* palette reference: */ + static const UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05, + 0x02, 0x06, 0x03, 0x07, + 0x08, 0x0c, 0x09, 0x0d, + 0x0a, 0x0e, 0x0b, 0x0f }; + + color |= pal_num[(pen[0] & 3) | ((pen[1] & 3) << 2)]; +#endif + + pen[0] = m_video_ram[count+0x0000] >> (6-i*2) & 3; + pen[1] = m_video_ram[count+0x2000] >> (6-i*2) & 3; + + color = 0x10; + color |= ((pen[0] & 1) << 2); + color |= ((pen[0] & 2) >> 1); + color |= ((pen[1] & 1) << 1); + color |= ((pen[1] & 2) << 2); + + if (cliprect.contains((x+i)*2+0, y)) + bitmap.pix16(y, (x+i)*2+0) = m_palette->pen(color); + if (cliprect.contains((x+i)*2+1, y)) + bitmap.pix16(y, (x+i)*2+1) = m_palette->pen(color); + } + + count++; + } + } + } + else if(m_exgfx_2bpp_mode) + { + int count,color,i; + + count = 0; + + for(y=0;y<200;y++) + { + for(x=0;x<320;x+=8) + { + for(i=0;i<8;i++) + { + int pen[2]; +#if 0 + /* palette reference: */ + static const UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05 }; + + color |= pal_num[(pen[0] & 1) | ((pen[1] & 1) << 1)]; +#endif + + pen[0] = m_video_ram[count+0x0000] >> (7-i) & 1; + pen[1] = m_video_ram[count+0x2000] >> (7-i) & 1; + + if(m_bgcol_bank & 4) //PC-6001 emulation mode + { + color = 0x08; + color |= (pen[0]) | (pen[1]<<1); + color |= (m_bgcol_bank & 1) << 2; + } + else //Mk-2 mode + { + color = 0x10; + color |= ((pen[0] & 1) << 2); + color |= ((pen[1] & 1) >> 0); + color |= ((m_bgcol_bank & 1) << 1); + color |= ((m_bgcol_bank & 2) << 2); + } + + if (cliprect.contains(x+i, y)) + bitmap.pix16(y, (x+i)) = m_palette->pen(color); + } + + count++; + } + } + + } + else if(m_exgfx_text_mode) + { + int xi,yi,pen,fgcol,bgcol,color; + UINT8 *gfx_data = m_region_gfx1->base(); + + for(y=0;y<20;y++) + { + for(x=0;x<40;x++) + { + /* + exgfx attr format: + x--- ---- rom bank select + -xxx ---- bg color + ---- xxxx fg color + Note that the exgfx banks a different gfx ROM + */ + tile = m_video_ram[(x+(y*40))+0x400] + 0x200; + attr = m_video_ram[(x+(y*40)) & 0x3ff]; + tile+= ((attr & 0x80) << 1); + + for(yi=0;yi<12;yi++) + { + for(xi=0;xi<8;xi++) + { + pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + + fgcol = (attr & 0x0f) + 0x10; + bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); + + color = pen ? fgcol : bgcol; + + if (cliprect.contains(x*8+xi, y*12+yi)) + bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); + } + } + } + } + } + else + { + attr = m_video_ram[0]; + pc6001_screen_draw(bitmap,cliprect,0); + } + + return 0; +} + +UINT32 pc6001_state::screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,tile,attr; + int xi,yi,pen,fgcol,bgcol,color; + UINT8 *gfx_data = m_region_gfx1->base(); + + + if(m_sr_video_mode & 8) // text mode + { + for(y=0;y<20;y++) + { + for(x=0;x<40;x++) + { + tile = m_video_ram[(x+(y*40))*2+0]; + attr = m_video_ram[(x+(y*40))*2+1]; + tile+= ((attr & 0x80) << 1); + + for(yi=0;yi<12;yi++) + { + for(xi=0;xi<8;xi++) + { + pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + + fgcol = (attr & 0x0f) + 0x10; + bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); + + color = pen ? fgcol : bgcol; + + if (cliprect.contains(x*8+xi, y*12+yi)) + bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); + } + } + } + } + } + else //4bpp bitmap mode (TODO) + { + int count; + + count = 0; + + for(y=0;y<200;y+=2) + { + for(x=0;x<320;x+=4) + { + color = m_video_ram[count] & 0x0f; + + if (cliprect.contains(x+0, y+0)) + bitmap.pix16((y+0), (x+0)) = m_palette->pen(color+0x10); + + color = (m_video_ram[count] & 0xf0) >> 4; + + if (cliprect.contains(x+1, y+0)) + bitmap.pix16((y+0), (x+1)) = m_palette->pen(color+0x10); + + color = m_video_ram[count+1] & 0x0f; + + if (cliprect.contains(x+2, y+0)) + bitmap.pix16((y+0), (x+2)) = m_palette->pen(color+0x10); + + color = (m_video_ram[count+1] & 0xf0) >> 4; + + if (cliprect.contains(x+3, y+0)) + bitmap.pix16((y+0), (x+3)) = m_palette->pen(color+0x10); + + color = m_video_ram[count+2] & 0x0f; + + if (cliprect.contains(x+0, y+1)) + bitmap.pix16((y+1), (x+0)) = m_palette->pen(color+0x10); + + color = (m_video_ram[count+2] & 0xf0) >> 4; + + if (cliprect.contains(x+1, y+1)) + bitmap.pix16((y+1), (x+1)) = m_palette->pen(color+0x10); + + color = m_video_ram[count+3] & 0x0f; + + if (cliprect.contains(x+2, y+1)) + bitmap.pix16((y+1), (x+2)) = m_palette->pen(color+0x10); + + color = (m_video_ram[count+3] & 0xf0) >> 4; + + if (cliprect.contains(x+3, y+1)) + bitmap.pix16((y+1), (x+3)) = m_palette->pen(color+0x10); + + + count+=4; + } + } + } + + return 0; +} + +WRITE8_MEMBER(pc6001_state::pc6001_system_latch_w) +{ + static const UINT16 startaddr[] = {0xC000, 0xE000, 0x8000, 0xA000 }; + + m_video_ram = m_ram + startaddr[(data >> 1) & 0x03] - 0x8000; + + if((!(m_sys_latch & 8)) && data & 0x8) //PLAY tape cmd + { + m_cas_switch = 1; + //m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + //m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); + } + if((m_sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd + { + m_cas_switch = 0; + //m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + //m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + //m_irq_vector = 0x00; + //m_maincpu->set_input_line(0, ASSERT_LINE); + } + + m_sys_latch = data; + m_timer_irq_mask = data & 1; + //printf("%02x\n",data); +} + +#if 0 +ATTR_CONST pc6001_state::UINT8 pc6001_get_attributes(UINT8 c,int scanline, int pos) +{ + UINT8 result = 0x00; + UINT8 val = m_video_ram [(scanline / 12) * 0x20 + pos]; + + if (val & 0x01) { + result |= M6847_INV; + } + if (val & 0x40) + result |= M6847_AG | M6847_GM1; //TODO + + result |= M6847_INTEXT; // always use external ROM + return result; +} + +const pc6001_state::UINT8 *pc6001_get_video_ram(int scanline) +{ + return m_video_ram +0x0200+ (scanline / 12) * 0x20; +} + +UINT8 pc6001_state::pc6001_get_char_rom(UINT8 ch, int line) +{ + UINT8 *gfx = m_region_gfx1->base(); + return gfx[ch*16+line]; +} +#endif + + +READ8_MEMBER(pc6001_state::nec_ppi8255_r) +{ + if (offset==2) + return m_port_c_8255; + else if(offset==0) + { + UINT8 res; + res = m_cur_keycode; + //m_cur_keycode = 0; + return res; + } + + return m_ppi->read(space, offset); +} + +WRITE8_MEMBER(pc6001_state::nec_ppi8255_w) +{ + if (offset==3) + { + if(data & 1) + m_port_c_8255 |= 1<<((data>>1)&0x07); + else + m_port_c_8255 &= ~(1<<((data>>1)&0x07)); + + switch(data) { + case 0x08: m_port_c_8255 |= 0x88; break; + case 0x09: m_port_c_8255 &= 0xf7; break; + case 0x0c: m_port_c_8255 |= 0x28; break; + case 0x0d: m_port_c_8255 &= 0xf7; break; + default: break; + } + + m_port_c_8255 |= 0xa8; + + { + //printf("%02x\n",data); + + if ((data & 0x0f) == 0x05 && m_cart_rom) + m_bank1->set_base(m_cart_rom->base() + 0x2000); + if ((data & 0x0f) == 0x04) + m_bank1->set_base(m_region_gfx1->base()); + } + } + m_ppi->write(space,offset,data); +} + +static ADDRESS_MAP_START(pc6001_map, AS_PROGRAM, 8, pc6001_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP + //AM_RANGE(0x4000, 0x5fff) // mapped by the cartslot + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc6001_io , AS_IO, 8, pc6001_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_READWRITE(nec_ppi8255_r, nec_ppi8255_w) + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, data_w) + AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_device, data_r) + AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_WRITENOP + AM_RANGE(0xb0, 0xb0) AM_MIRROR(0x0f) AM_WRITE(pc6001_system_latch_w) + AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x0c) AM_NOP // disk device +ADDRESS_MAP_END + +/* + ROM_REGION( 0x28000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "basicrom.62", 0x10000, 0x8000, CRC(950ac401) SHA1(fbf195ba74a3b0f80b5a756befc96c61c2094182) ) + ROM_LOAD( "voicerom.62", 0x18000, 0x4000, CRC(49b4f917) SHA1(1a2d18f52ef19dc93da3d65f19d3abbd585628af) ) + ROM_LOAD( "cgrom60.62", 0x1c000, 0x2000, CRC(81eb5d95) SHA1(53d8ae9599306ff23bf95208d2f6cc8fed3fc39f) ) + ROM_LOAD( "cgrom60m.62", 0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) + ROM_LOAD( "kanjirom.62", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) +*/ + +#define BASICROM(_v_) \ + 0x10000+0x2000*_v_ +#define VOICEROM(_v_) \ + 0x18000+0x2000*_v_ +#define TVROM(_v_) \ + 0x1c000+0x2000*_v_ +#define KANJIROM(_v_) \ + 0x20000+0x2000*_v_ +#define WRAM(_v_) \ + 0x28000+0x2000*_v_ +#define EXWRAM(_v_) \ + 0x38000+0x2000*_v_ +#define EXROM(_v_) \ + 0x48000+0x2000*_v_ +#define INVALID(_v_) \ + 0x4c000+0x2000*_v_ +/* FIXME: some comments aren't right */ +static const UINT32 banksw_table_r0[0x10*4][4] = { + /* 0 */ + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: + { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 + { TVROM(0), TVROM(1), VOICEROM(0), VOICEROM(1) }, //0x02: tv rom 0 & 1 / voice rom 0 & 1 + { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 + { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 + { TVROM(1), BASICROM(1), VOICEROM(0), BASICROM(3) }, //0x05: tv rom 1 & basic rom 1 / voice rom 0 & basic 3 + { BASICROM(0), TVROM(2), BASICROM(2), VOICEROM(1) }, //0x06: basic rom 0 & tv rom 2 / basic rom 2 & voice 1 + { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 + { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 + { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 + { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 + { EXROM(0), TVROM(2), EXROM(0), VOICEROM(1) }, //0x0b: ex rom 0 & tv rom 2 / ex rom 0 & voice 1 + { TVROM(1), EXROM(0), VOICEROM(0), EXROM(0) }, //0x0c: tv rom 1 & ex rom 0 / voice rom 0 & ex rom 0 + { WRAM(0), WRAM(1), WRAM(2), WRAM(3) }, //0x0d: ram 0 & 1 / ram 2 & 3 + { EXWRAM(0), EXWRAM(1), EXWRAM(2), EXWRAM(3) }, //0x0e: exram 0 & 1 / exram 2 & 3 + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: + /* 1 */ + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: + { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 + { KANJIROM(0), KANJIROM(1), KANJIROM(0), KANJIROM(1) }, //0x02: tv rom 0 & 1 / voice rom 0 & 1 + { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 + { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 + { KANJIROM(0), BASICROM(1), KANJIROM(0), BASICROM(3) }, //0x05: tv rom 1 & basic rom 1 / voice rom 0 & basic 3 + { BASICROM(0), KANJIROM(1), BASICROM(2), KANJIROM(1) }, //0x06: basic rom 0 & tv rom 2 / basic rom 2 & voice 1 + { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 + { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 + { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 + { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 + { EXROM(0), KANJIROM(1), EXROM(0), KANJIROM(1) }, //0x0b: ex rom 0 & tv rom 2 / ex rom 0 & voice 1 + { KANJIROM(0), EXROM(0), KANJIROM(0), EXROM(0) }, //0x0c: tv rom 1 & ex rom 0 / voice rom 0 & ex rom 0 + { WRAM(0), WRAM(1), WRAM(2), WRAM(3) }, //0x0d: ram 0 & 1 / ram 2 & 3 + { EXWRAM(0), EXWRAM(1), EXWRAM(2), EXWRAM(3) }, //0x0e: exram 0 & 1 / exram 2 & 3 + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: + /* 2 */ + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: + { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 + { TVROM(0), TVROM(1), VOICEROM(0), VOICEROM(1) }, //0x02: tv rom 0 & 1 / voice rom 0 & 1 + { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 + { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 + { TVROM(1), BASICROM(1), VOICEROM(0), BASICROM(3) }, //0x05: tv rom 1 & basic rom 1 / voice rom 0 & basic 3 + { BASICROM(0), TVROM(2), BASICROM(2), VOICEROM(1) }, //0x06: basic rom 0 & tv rom 2 / basic rom 2 & voice 1 + { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 + { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 + { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 + { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 + { EXROM(0), TVROM(2), EXROM(0), VOICEROM(1) }, //0x0b: ex rom 0 & tv rom 2 / ex rom 0 & voice 1 + { TVROM(1), EXROM(0), VOICEROM(0), EXROM(0) }, //0x0c: tv rom 1 & ex rom 0 / voice rom 0 & ex rom 0 + { WRAM(0), WRAM(1), WRAM(2), WRAM(3) }, //0x0d: ram 0 & 1 / ram 2 & 3 + { EXWRAM(0), EXWRAM(1), EXWRAM(2), EXWRAM(3) }, //0x0e: exram 0 & 1 / exram 2 & 3 + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: + /* 3 */ + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: + { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 + { KANJIROM(2), KANJIROM(3), KANJIROM(2), KANJIROM(3) }, //0x02: tv rom 0 & 1 / voice rom 0 & 1 + { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 + { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 + { KANJIROM(2), BASICROM(1), KANJIROM(2), BASICROM(3) }, //0x05: tv rom 1 & basic rom 1 / voice rom 0 & basic 3 + { BASICROM(0), KANJIROM(3), BASICROM(2), KANJIROM(3) }, //0x06: basic rom 0 & tv rom 2 / basic rom 2 & voice 1 + { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 + { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 + { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 + { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 + { EXROM(0), KANJIROM(3), EXROM(0), KANJIROM(3) }, //0x0b: ex rom 0 & tv rom 2 / ex rom 0 & voice 1 + { KANJIROM(2), EXROM(0), KANJIROM(2), EXROM(0) }, //0x0c: tv rom 1 & ex rom 0 / voice rom 0 & ex rom 0 + { WRAM(0), WRAM(1), WRAM(2), WRAM(3) }, //0x0d: ram 0 & 1 / ram 2 & 3 + { EXWRAM(0), EXWRAM(1), EXWRAM(2), EXWRAM(3) }, //0x0e: exram 0 & 1 / exram 2 & 3 + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) } //0x0f: +}; + +static const UINT32 banksw_table_r1[0x10*4][4] = { + /* 0 */ + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: + { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 + { VOICEROM(0), VOICEROM(1), VOICEROM(0), VOICEROM(1) }, //0x02: voice rom 0 & 1 / voice rom 0 & 1 + { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 + { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 + { VOICEROM(0), BASICROM(1), VOICEROM(0), BASICROM(3) }, //0x05: voice rom 0 & basic rom 1 / voice rom 0 & basic 3 + { BASICROM(0), VOICEROM(1), BASICROM(2), VOICEROM(1) }, //0x06: basic rom 0 & voice rom 1 / basic rom 2 & voice 1 + { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 + { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 + { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 + { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 + { EXROM(0), VOICEROM(1), EXROM(0), VOICEROM(1) }, //0x0b: ex rom 0 & voice rom 1 / ex rom 0 & voice 1 + { VOICEROM(0), EXROM(0), VOICEROM(0), EXROM(0) }, //0x0c: voice rom 1 & ex rom 0 / voice rom 0 & ex rom 0 + { WRAM(4), WRAM(5), WRAM(6), WRAM(7) }, //0x0d: ram 4 & 5 / ram 6 & 7 + { EXWRAM(4), EXWRAM(5), EXWRAM(6), EXWRAM(7) }, //0x0e: exram 4 & 5 / exram 6 & 7 + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: + /* 1 */ + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: + { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 + { KANJIROM(0), KANJIROM(1), KANJIROM(0), KANJIROM(1) }, //0x02: kanji rom 0 & 1 / kanji rom 0 & 1 + { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 + { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 + { KANJIROM(0), BASICROM(1), KANJIROM(0), BASICROM(3) }, //0x05: voice rom 0 & basic rom 1 / voice rom 0 & basic 3 + { BASICROM(0), KANJIROM(1), BASICROM(2), KANJIROM(1) }, //0x06: basic rom 0 & voice rom 1 / basic rom 2 & voice 1 + { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 + { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 + { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 + { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 + { EXROM(0), KANJIROM(1), EXROM(0), KANJIROM(1) }, //0x0b: ex rom 0 & voice rom 1 / ex rom 0 & voice 1 + { KANJIROM(0), EXROM(0), KANJIROM(0), EXROM(0) }, //0x0c: voice rom 1 & ex rom 0 / voice rom 0 & ex rom 0 + { WRAM(4), WRAM(5), WRAM(6), WRAM(7) }, //0x0d: ram 4 & 5 / ram 6 & 7 + { EXWRAM(4), EXWRAM(5), EXWRAM(6), EXWRAM(7) }, //0x0e: exram 4 & 5 / exram 6 & 7 + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: + /* 2 */ + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: + { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 + { VOICEROM(0), VOICEROM(1), VOICEROM(0), VOICEROM(1) }, //0x02: voice rom 0 & 1 / voice rom 0 & 1 + { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 + { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 + { VOICEROM(0), BASICROM(1), VOICEROM(0), BASICROM(3) }, //0x05: voice rom 0 & basic rom 1 / voice rom 0 & basic 3 + { BASICROM(0), VOICEROM(1), BASICROM(2), VOICEROM(1) }, //0x06: basic rom 0 & voice rom 1 / basic rom 2 & voice 1 + { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 + { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 + { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 + { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 + { EXROM(0), VOICEROM(1), EXROM(0), VOICEROM(1) }, //0x0b: ex rom 0 & voice rom 1 / ex rom 0 & voice 1 + { VOICEROM(0), EXROM(0), VOICEROM(0), EXROM(0) }, //0x0c: voice rom 1 & ex rom 0 / voice rom 0 & ex rom 0 + { WRAM(4), WRAM(5), WRAM(6), WRAM(7) }, //0x0d: ram 4 & 5 / ram 6 & 7 + { EXWRAM(4), EXWRAM(5), EXWRAM(6), EXWRAM(7) }, //0x0e: exram 4 & 5 / exram 6 & 7 + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: + /* 3 */ + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: + { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 + { KANJIROM(2), KANJIROM(3), KANJIROM(2), KANJIROM(3) }, //0x02: kanji rom 0 & 1 / kanji rom 0 & 1 + { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 + { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 + { KANJIROM(2), BASICROM(1), KANJIROM(2), BASICROM(3) }, //0x05: voice rom 0 & basic rom 1 / voice rom 0 & basic 3 + { BASICROM(0), KANJIROM(3), BASICROM(2), KANJIROM(3) }, //0x06: basic rom 0 & voice rom 1 / basic rom 2 & voice 1 + { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 + { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 + { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 + { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 + { EXROM(0), KANJIROM(3), EXROM(0), KANJIROM(3) }, //0x0b: ex rom 0 & voice rom 1 / ex rom 0 & voice 1 + { KANJIROM(2), EXROM(0), KANJIROM(2), EXROM(0) }, //0x0c: voice rom 1 & ex rom 0 / voice rom 0 & ex rom 0 + { WRAM(4), WRAM(5), WRAM(6), WRAM(7) }, //0x0d: ram 4 & 5 / ram 6 & 7 + { EXWRAM(4), EXWRAM(5), EXWRAM(6), EXWRAM(7) }, //0x0e: exram 4 & 5 / exram 6 & 7 + { INVALID(0), INVALID(0), INVALID(0), INVALID(0) } //0x0f: +}; + +WRITE8_MEMBER(pc6001_state::pc6001m2_bank_r0_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + UINT8 *gfx_data = m_region_gfx1->base(); + +// bankaddress = 0x10000 + (0x4000 * ((data & 0x40)>>6)); +// membank(1)->set_base(&ROM[bankaddress]); + + m_bank_r0 = data; + +// printf("%02x BANK | %02x\n",data,m_bank_opt); + m_bank1->set_base(&ROM[banksw_table_r0[(data & 0xf)+(m_bank_opt*0x10)][0]]); + m_bank2->set_base(&ROM[banksw_table_r0[(data & 0xf)+(m_bank_opt*0x10)][1]]); + m_bank3->set_base(&ROM[banksw_table_r0[((data & 0xf0)>>4)+(m_bank_opt*0x10)][2]]); + if(!m_gfx_bank_on) + m_bank4->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); + else + m_bank4->set_base(&gfx_data[m_cgrom_bank_addr]); +} + +WRITE8_MEMBER(pc6001_state::pc6001m2_bank_r1_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + +// bankaddress = 0x10000 + (0x4000 * ((data & 0x40)>>6)); +// membank(1)->set_base(&ROM[bankaddress]); + + m_bank_r1 = data; + +// printf("%02x BANK\n",data); + m_bank5->set_base(&ROM[banksw_table_r1[(data & 0xf)+(m_bank_opt*0x10)][0]]); + m_bank6->set_base(&ROM[banksw_table_r1[(data & 0xf)+(m_bank_opt*0x10)][1]]); + m_bank7->set_base(&ROM[banksw_table_r1[((data & 0xf0)>>4)+(m_bank_opt*0x10)][2]]); + m_bank8->set_base(&ROM[banksw_table_r1[((data & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); +} + +WRITE8_MEMBER(pc6001_state::pc6001m2_bank_w0_w) +{ + m_bank_w = data; +} + +WRITE8_MEMBER(pc6001_state::pc6001m2_opt_bank_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + UINT8 *gfx_data = m_region_gfx1->base(); + + /* + 0 - TVROM / VOICE ROM + 1 - KANJI ROM bank 0 + 2 - KANJI ROM bank 1 + 3 - TVROM / VOICE ROM + */ + m_bank_opt = data & 3; + + m_bank1->set_base(&ROM[banksw_table_r0[(m_bank_r0 & 0xf)+(m_bank_opt*0x10)][0]]); + m_bank2->set_base(&ROM[banksw_table_r0[(m_bank_r0 & 0xf)+(m_bank_opt*0x10)][1]]); + m_bank3->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][2]]); + if(!m_gfx_bank_on) + m_bank4->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); + else + m_bank4->set_base(&gfx_data[m_cgrom_bank_addr]); + m_bank4->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); + m_bank5->set_base(&ROM[banksw_table_r1[(m_bank_r1 & 0xf)+(m_bank_opt*0x10)][0]]); + m_bank6->set_base(&ROM[banksw_table_r1[(m_bank_r1 & 0xf)+(m_bank_opt*0x10)][1]]); + m_bank7->set_base(&ROM[banksw_table_r1[((m_bank_r1 & 0xf0)>>4)+(m_bank_opt*0x10)][2]]); + m_bank8->set_base(&ROM[banksw_table_r1[((m_bank_r1 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); + +} + +WRITE8_MEMBER(pc6001_state::work_ram0_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + ROM[offset+((m_bank_w & 0x01) ? WRAM(0) : EXWRAM(0))] = data; +} + +WRITE8_MEMBER(pc6001_state::work_ram1_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + ROM[offset+((m_bank_w & 0x01) ? WRAM(1) : EXWRAM(1))] = data; +} + +WRITE8_MEMBER(pc6001_state::work_ram2_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + ROM[offset+((m_bank_w & 0x04) ? WRAM(2) : EXWRAM(2))] = data; +} + +WRITE8_MEMBER(pc6001_state::work_ram3_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + ROM[offset+((m_bank_w & 0x04) ? WRAM(3) : EXWRAM(3))] = data; +} + +WRITE8_MEMBER(pc6001_state::work_ram4_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + ROM[offset+((m_bank_w & 0x10) ? WRAM(4) : EXWRAM(4))] = data; +} + +WRITE8_MEMBER(pc6001_state::work_ram5_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + ROM[offset+((m_bank_w & 0x10) ? WRAM(5) : EXWRAM(5))] = data; +} + +WRITE8_MEMBER(pc6001_state::work_ram6_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + ROM[offset+((m_bank_w & 0x40) ? WRAM(6) : EXWRAM(6))] = data; +} + +WRITE8_MEMBER(pc6001_state::work_ram7_w) +{ + UINT8 *ROM = m_region_maincpu->base(); + ROM[offset+((m_bank_w & 0x40) ? WRAM(7) : EXWRAM(7))] = data; +} + + +WRITE8_MEMBER(pc6001_state::necmk2_ppi8255_w) +{ + if (offset==3) + { + if(data & 1) + m_port_c_8255 |= 1<<((data>>1)&0x07); + else + m_port_c_8255 &= ~(1<<((data>>1)&0x07)); + + switch(data) { + case 0x08: m_port_c_8255 |= 0x88; break; + case 0x09: m_port_c_8255 &= 0xf7; break; + case 0x0c: m_port_c_8255 |= 0x28; break; + case 0x0d: m_port_c_8255 &= 0xf7; break; + default: break; + } + + m_port_c_8255 |= 0xa8; + + { + UINT8 *ROM = m_region_maincpu->base(); + UINT8 *gfx_data = m_region_gfx1->base(); + + //printf("%02x\n",data); + + if((data & 0x0f) == 0x05) + { + m_gfx_bank_on = 0; + m_bank4->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); + } + if((data & 0x0f) == 0x04) + { + m_gfx_bank_on = 1; + m_bank4->set_base(&gfx_data[m_cgrom_bank_addr]); + } + } + } + m_ppi->write(space,offset,data); +} + +void pc6001_state::vram_bank_change(UINT8 vram_bank) +{ + UINT8 *work_ram = m_region_maincpu->base(); + +// popmessage("%02x",vram_bank); + + switch(vram_bank & 0x66) + { + case 0x00: m_video_ram = work_ram + 0x8000 + 0x28000; break; //4 color mode + case 0x02: m_video_ram = work_ram + 0xc000 + 0x28000; break; + case 0x04: m_video_ram = work_ram + 0x8000 + 0x28000; break; + case 0x06: m_video_ram = work_ram + 0xc000 + 0x28000; break; + case 0x20: m_video_ram = work_ram + 0xc000 + 0x28000; break; //4 color mode + case 0x22: m_video_ram = work_ram + 0xe000 + 0x28000; break; + case 0x24: m_video_ram = work_ram + 0xc000 + 0x28000; break; + case 0x26: m_video_ram = work_ram + 0xe000 + 0x28000; break; + case 0x40: m_video_ram = work_ram + 0x0000 + 0x28000; break; //4 color mode + case 0x42: m_video_ram = work_ram + 0x8000 + 0x28000; break; + case 0x44: m_video_ram = work_ram + 0x0000 + 0x28000; break; + case 0x46: m_video_ram = work_ram + 0x8000 + 0x28000; break; + case 0x60: m_video_ram = work_ram + 0x4000 + 0x28000; break; //4 color mode + case 0x62: m_video_ram = work_ram + 0xa000 + 0x28000; break; + case 0x64: m_video_ram = work_ram + 0x4000 + 0x28000; break; + case 0x66: m_video_ram = work_ram + 0xa000 + 0x28000; break; + } +} + +WRITE8_MEMBER(pc6001_state::pc6001m2_system_latch_w) +{ + if((!(m_sys_latch & 8)) && data & 0x8) //PLAY tape cmd + { + m_cas_switch = 1; + //m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + //m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); + } + if((m_sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd + { + m_cas_switch = 0; + //m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + //m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + //m_irq_vector = 0x00; + //m_maincpu->set_input_line(0, ASSERT_LINE); + } + + m_sys_latch = data; + + m_timer_irq_mask = data & 1; + vram_bank_change((m_ex_vram_bank & 0x06) | ((m_sys_latch & 0x06) << 4)); + + //printf("%02x B0\n",data); +} + + +WRITE8_MEMBER(pc6001_state::pc6001m2_vram_bank_w) +{ + //static const UINT32 startaddr[] = {WRAM(6), WRAM(6), WRAM(0), WRAM(4) }; + + m_ex_vram_bank = data; + vram_bank_change((m_ex_vram_bank & 0x06) | ((m_sys_latch & 0x06) << 4)); + + m_exgfx_text_mode = ((data & 2) == 0); + m_cgrom_bank_addr = (data & 2) ? 0x0000 : 0x2000; + + m_exgfx_bitmap_mode = (data & 8); + m_exgfx_2bpp_mode = ((data & 6) == 0); + + { + /* Apparently bitmap modes changes the screen res to 320 x 200 */ + { + rectangle visarea = machine().first_screen()->visible_area(); + int y_height; + + y_height = (m_exgfx_bitmap_mode || m_exgfx_2bpp_mode) ? 200 : 240; + + visarea.set(0, (320) - 1, 0, (y_height) - 1); + + machine().first_screen()->configure(320, 240, visarea, machine().first_screen()->frame_period().attoseconds()); + } + } + +// popmessage("%02x",data); + +// m_video_ram = work_ram + startaddr[(data >> 1) & 0x03]; +} + +WRITE8_MEMBER(pc6001_state::pc6001m2_col_bank_w) +{ + m_bgcol_bank = (data & 7); +} + + +WRITE8_MEMBER(pc6001_state::pc6001m2_0xf3_w) +{ + /* + x--- ---- M1 (?) wait setting + -x-- ---- ROM wait setting + --x- ---- RAM wait setting + ---x ---- custom irq 2 address output + ---- x--- custom irq 1 address output + ---- -x-- timer irq mask 2 (mirror?) + ---- --x- custom irq 2 mask + ---- ---x custom irq 1 mask + */ + m_timer_irq_mask2 = data & 4; +} + +TIMER_CALLBACK_MEMBER(pc6001_state::audio_callback) +{ + if(m_cas_switch == 0 && ((m_timer_irq_mask == 0) || (m_timer_irq_mask2 == 0))) + { + if(IRQ_LOG) printf("Timer IRQ called %02x\n",m_timer_irq_vector); + m_irq_vector = m_timer_irq_vector; + m_maincpu->set_input_line(0, ASSERT_LINE); + } +} + + +WRITE8_MEMBER(pc6001_state::pc6001m2_timer_adj_w) +{ + m_timer_hz_div = data; + attotime period = attotime::from_hz((487.5*4)/(m_timer_hz_div+1)); + m_timer_irq_timer->adjust(period, 0, period); +} + +WRITE8_MEMBER(pc6001_state::pc6001m2_timer_irqv_w) +{ + m_timer_irq_vector = data; +} + +READ8_MEMBER(pc6001_state::pc6001m2_bank_r0_r) +{ + return m_bank_r0; +} + +READ8_MEMBER(pc6001_state::pc6001m2_bank_r1_r) +{ + return m_bank_r1; +} + +READ8_MEMBER(pc6001_state::pc6001m2_bank_w0_r) +{ + return m_bank_w; +} + +static ADDRESS_MAP_START(pc6001m2_map, AS_PROGRAM, 8, pc6001_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1") AM_WRITE(work_ram0_w) + AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank2") AM_WRITE(work_ram1_w) + AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3") AM_WRITE(work_ram2_w) + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4") AM_WRITE(work_ram3_w) + AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank5") AM_WRITE(work_ram4_w) + AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank6") AM_WRITE(work_ram5_w) + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank7") AM_WRITE(work_ram6_w) + AM_RANGE(0xe000, 0xffff) AM_ROMBANK("bank8") AM_WRITE(work_ram7_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc6001m2_io , AS_IO, 8, pc6001_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + + AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_READWRITE(nec_ppi8255_r, necmk2_ppi8255_w) + + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, data_w) + AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_device, data_r) + AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_NOP + + AM_RANGE(0xb0, 0xb0) AM_MIRROR(0x0f) AM_WRITE(pc6001m2_system_latch_w) + + AM_RANGE(0xc0, 0xc0) AM_WRITE(pc6001m2_col_bank_w) + AM_RANGE(0xc1, 0xc1) AM_WRITE(pc6001m2_vram_bank_w) + AM_RANGE(0xc2, 0xc2) AM_WRITE(pc6001m2_opt_bank_w) + + AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x0c) AM_NOP // disk device + + AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) + + AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) + AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) + AM_RANGE(0xf2, 0xf2) AM_READWRITE(pc6001m2_bank_w0_r,pc6001m2_bank_w0_w) + AM_RANGE(0xf3, 0xf3) AM_WRITE(pc6001m2_0xf3_w) +// AM_RANGE(0xf4 +// AM_RANGE(0xf5 + AM_RANGE(0xf6, 0xf6) AM_WRITE(pc6001m2_timer_adj_w) + AM_RANGE(0xf7, 0xf7) AM_WRITE(pc6001m2_timer_irqv_w) +ADDRESS_MAP_END + +/* disk device placeholder (TODO: identify & hook-up this) */ +READ8_MEMBER(pc6001_state::pc6601_fdc_r) +{ + return machine().rand(); +} + +WRITE8_MEMBER(pc6001_state::pc6601_fdc_w) +{ +} + +static ADDRESS_MAP_START( pc6601_io , AS_IO, 8, pc6001_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + + AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_READWRITE(nec_ppi8255_r, necmk2_ppi8255_w) + + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, data_w) + AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_device, data_r) + AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_NOP + + AM_RANGE(0xb0, 0xb0) AM_WRITE(pc6001m2_system_latch_w) + /* these are disk related */ +// AM_RANGE(0xb1 +// AM_RANGE(0xb2 +// AM_RANGE(0xb3 + + AM_RANGE(0xc0, 0xc0) AM_WRITE(pc6001m2_col_bank_w) + AM_RANGE(0xc1, 0xc1) AM_WRITE(pc6001m2_vram_bank_w) + AM_RANGE(0xc2, 0xc2) AM_WRITE(pc6001m2_opt_bank_w) + + AM_RANGE(0xd0, 0xdf) AM_READWRITE(pc6601_fdc_r,pc6601_fdc_w) // disk device + + AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) + + AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) + AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) + AM_RANGE(0xf2, 0xf2) AM_READWRITE(pc6001m2_bank_w0_r,pc6001m2_bank_w0_w) + AM_RANGE(0xf3, 0xf3) AM_WRITE(pc6001m2_0xf3_w) +// AM_RANGE(0xf4 +// AM_RANGE(0xf5 + AM_RANGE(0xf6, 0xf6) AM_WRITE(pc6001m2_timer_adj_w) + AM_RANGE(0xf7, 0xf7) AM_WRITE(pc6001m2_timer_irqv_w) +ADDRESS_MAP_END + +/* PC-6001 SR */ + +#define SR_SYSROM_1(_v_) \ + 0x10000+(0x1000*_v_) +#define SR_SYSROM_2(_v_) \ + 0x20000+(0x1000*_v_) +#define SR_CGROM1(_v_) \ + 0x30000+(0x1000*_v_) +#define SR_EXROM0(_v_) \ + 0x40000+(0x1000*_v_) +#define SR_EXROM1(_v_) \ + 0x50000+(0x1000*_v_) +#define SR_EXRAM0(_v_) \ + 0x60000+(0x1000*_v_) +#define SR_WRAM0(_v_) \ + 0x70000+(0x1000*_v_) +#define SR_NULL(_v_) \ + 0x80000+(0x1000*_v_) +READ8_MEMBER(pc6001_state::pc6001sr_bank_rn_r) +{ + return m_sr_bank_r[offset]; +} + +WRITE8_MEMBER(pc6001_state::pc6001sr_bank_rn_w) +{ + memory_bank *bank[8] = { m_bank1, m_bank2, m_bank3, m_bank4, m_bank5, m_bank6, m_bank7, m_bank8 }; + UINT8 *ROM = m_region_maincpu->base(); + UINT8 bank_num; + + m_sr_bank_r[offset] = data; + bank_num = data & 0x0f; + + switch(data & 0xf0) + { + case 0xf0: bank[offset]->set_base(&ROM[SR_SYSROM_1(bank_num)]); break; + case 0xe0: bank[offset]->set_base(&ROM[SR_SYSROM_2(bank_num)]); break; + case 0xd0: bank[offset]->set_base(&ROM[SR_CGROM1(bank_num)]); break; + case 0xc0: bank[offset]->set_base(&ROM[SR_EXROM0(bank_num)]); break; + case 0xb0: bank[offset]->set_base(&ROM[SR_EXROM1(bank_num)]); break; + case 0x20: bank[offset]->set_base(&ROM[SR_EXRAM0(bank_num)]); break; + case 0x00: bank[offset]->set_base(&ROM[SR_WRAM0(bank_num)]); break; + default: bank[offset]->set_base(&ROM[SR_NULL(bank_num)]); break; + } +} + +READ8_MEMBER(pc6001_state::pc6001sr_bank_wn_r) +{ + return m_sr_bank_w[offset]; +} + +WRITE8_MEMBER(pc6001_state::pc6001sr_bank_wn_w) +{ + m_sr_bank_w[offset] = data; +} + +#define SR_WRAM_BANK_W(_v_) \ +{ \ + UINT8 *ROM = m_region_maincpu->base(); \ + UINT8 bank_num; \ + bank_num = m_sr_bank_w[_v_] & 0x0f; \ + if((m_sr_bank_w[_v_] & 0xf0) != 0x20) \ + ROM[offset+(SR_WRAM0(bank_num))] = data; \ + else \ + ROM[offset+(SR_EXRAM0(bank_num))] = data; \ +} +WRITE8_MEMBER(pc6001_state::sr_work_ram0_w){ SR_WRAM_BANK_W(0); } +WRITE8_MEMBER(pc6001_state::sr_work_ram1_w){ SR_WRAM_BANK_W(1); } +WRITE8_MEMBER(pc6001_state::sr_work_ram2_w){ SR_WRAM_BANK_W(2); } +WRITE8_MEMBER(pc6001_state::sr_work_ram3_w){ SR_WRAM_BANK_W(3); } +WRITE8_MEMBER(pc6001_state::sr_work_ram4_w){ SR_WRAM_BANK_W(4); } +WRITE8_MEMBER(pc6001_state::sr_work_ram5_w){ SR_WRAM_BANK_W(5); } +WRITE8_MEMBER(pc6001_state::sr_work_ram6_w){ SR_WRAM_BANK_W(6); } +WRITE8_MEMBER(pc6001_state::sr_work_ram7_w){ SR_WRAM_BANK_W(7); } + +WRITE8_MEMBER(pc6001_state::pc6001sr_mode_w) +{ + m_sr_video_mode = data; + + if(data & 1) + assert("PC-6001SR in Mk-2 compatibility mode not yet supported!\n"); +} + +WRITE8_MEMBER(pc6001_state::pc6001sr_vram_bank_w) +{ + UINT8 *work_ram = m_region_maincpu->base(); + + m_video_ram = work_ram + 0x70000 + ((data & 0x0f)*0x1000); +} + +WRITE8_MEMBER(pc6001_state::pc6001sr_system_latch_w) +{ + if((!(m_sys_latch & 8)) && data & 0x8) //PLAY tape cmd + { + m_cas_switch = 1; + //m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + //m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); + } + if((m_sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd + { + m_cas_switch = 0; + //m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + //m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + //m_irq_vector = 0x00; + //m_maincpu->set_input_line(0, ASSERT_LINE); + } + + m_sys_latch = data; + + m_timer_irq_mask = data & 1; + //vram_bank_change((m_ex_vram_bank & 0x06) | ((m_sys_latch & 0x06) << 4)); + + //printf("%02x B0\n",data); +} + +WRITE8_MEMBER(pc6001_state::necsr_ppi8255_w) +{ + if (offset==3) + { + if(data & 1) + m_port_c_8255 |= 1<<((data>>1)&0x07); + else + m_port_c_8255 &= ~(1<<((data>>1)&0x07)); + + switch(data) { + case 0x08: m_port_c_8255 |= 0x88; break; + case 0x09: m_port_c_8255 &= 0xf7; break; + case 0x0c: m_port_c_8255 |= 0x28; break; + case 0x0d: m_port_c_8255 &= 0xf7; break; + default: break; + } + + m_port_c_8255 |= 0xa8; + + if(0) + { + //printf("%02x\n",data); + + if ((data & 0x0f) == 0x05 && m_cart_rom) + m_bank1->set_base(m_cart_rom->base() + 0x2000); + if ((data & 0x0f) == 0x04) + m_bank1->set_base(m_region_gfx1->base()); + } + } + m_ppi->write(space,offset,data); +} + + +static ADDRESS_MAP_START(pc6001sr_map, AS_PROGRAM, 8, pc6001_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1") AM_WRITE(sr_work_ram0_w) + AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank2") AM_WRITE(sr_work_ram1_w) + AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3") AM_WRITE(sr_work_ram2_w) + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4") AM_WRITE(sr_work_ram3_w) + AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank5") AM_WRITE(sr_work_ram4_w) + AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank6") AM_WRITE(sr_work_ram5_w) + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank7") AM_WRITE(sr_work_ram6_w) + AM_RANGE(0xe000, 0xffff) AM_ROMBANK("bank8") AM_WRITE(sr_work_ram7_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc6001sr_io , AS_IO, 8, pc6001_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x60, 0x67) AM_READWRITE(pc6001sr_bank_rn_r,pc6001sr_bank_rn_w) + AM_RANGE(0x68, 0x6f) AM_READWRITE(pc6001sr_bank_wn_r,pc6001sr_bank_wn_w) + AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + + AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_READWRITE(nec_ppi8255_r, necsr_ppi8255_w) + + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, data_w) + AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_device, data_r) + AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_NOP + + AM_RANGE(0xb0, 0xb0) AM_WRITE(pc6001sr_system_latch_w) + /* these are disk related */ +// AM_RANGE(0xb1 +// AM_RANGE(0xb2 +// AM_RANGE(0xb3 + +// AM_RANGE(0xc0, 0xc0) AM_WRITE(pc6001m2_col_bank_w) +// AM_RANGE(0xc1, 0xc1) AM_WRITE(pc6001m2_vram_bank_w) +// AM_RANGE(0xc2, 0xc2) AM_WRITE(pc6001m2_opt_bank_w) + + AM_RANGE(0xc8, 0xc8) AM_WRITE(pc6001sr_mode_w) + AM_RANGE(0xc9, 0xc9) AM_WRITE(pc6001sr_vram_bank_w) + + AM_RANGE(0xd0, 0xdf) AM_READWRITE(pc6601_fdc_r,pc6601_fdc_w) // disk device + + AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) + +// AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) +// AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) +// AM_RANGE(0xf2, 0xf2) AM_READWRITE(pc6001m2_bank_w0_r,pc6001m2_bank_w0_w) + AM_RANGE(0xf3, 0xf3) AM_WRITE(pc6001m2_0xf3_w) +// AM_RANGE(0xf4 +// AM_RANGE(0xf5 + AM_RANGE(0xf6, 0xf6) AM_WRITE(pc6001m2_timer_adj_w) + AM_RANGE(0xf7, 0xf7) AM_WRITE(pc6001m2_timer_irqv_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pc6001 ) + PORT_START("MODE4_DSW") //TODO: is this really a DSW? bit arrangement is also unknown if so. + PORT_DIPNAME( 0x07, 0x00, "Mode 4 GFX colors" ) + PORT_DIPSETTING( 0x00, "Monochrome" ) + PORT_DIPSETTING( 0x01, "Red/Blue" ) + PORT_DIPSETTING( 0x02, "Blue/Red" ) + PORT_DIPSETTING( 0x03, "Pink/Green" ) + PORT_DIPSETTING( 0x04, "Green/Pink" ) + //5-6-7 is presumably invalid + + /* TODO: these two are unchecked */ + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("key1") //0x00-0x1f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x01 soh + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x02 stx + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x03 etx + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x04 etx + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x05 eot + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x06 enq + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x07 ack + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0a + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0b lf + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0c vt + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e cr + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f so + + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x10 si + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x11 dle + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x12 dc1 + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x13 dc2 + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x14 dc3 + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x15 dc4 + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x16 nak + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x17 syn + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x18 etb + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x19 cancel + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1a em + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1b sub + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1d fs + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1e gs + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1f us + + PORT_START("key2") //0x20-0x3f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') //0x2c + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') //0x2e + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') //0x2f + + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3a : + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3b ; + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3c < + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? + + PORT_START("key3") //0x40-0x5f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") + + PORT_START("key_modifiers") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_ESC) +INPUT_PORTS_END + +INTERRUPT_GEN_MEMBER(pc6001_state::pc6001_interrupt) +{ + m_cur_keycode = check_joy_press(); + if(IRQ_LOG) printf("Stick IRQ called 0x16\n"); + m_irq_vector = 0x16; + device.execute().set_input_line(0, ASSERT_LINE); +} + +INTERRUPT_GEN_MEMBER(pc6001_state::pc6001sr_interrupt) +{ + m_kludge^= 1; + + m_cur_keycode = check_joy_press(); + if(IRQ_LOG) printf("VRTC IRQ called 0x16\n"); + m_irq_vector = (m_kludge) ? 0x22 : 0x16; + device.execute().set_input_line(0, ASSERT_LINE); +} + +IRQ_CALLBACK_MEMBER(pc6001_state::pc6001_irq_callback) +{ + device.execute().set_input_line(0, CLEAR_LINE); + return m_irq_vector; +} + +READ8_MEMBER(pc6001_state::pc6001_8255_porta_r) +{ + return 0; +} + +WRITE8_MEMBER(pc6001_state::pc6001_8255_porta_w) +{ +// if(data != 0x06) +// printf("pc6001_8255_porta_w %02x\n",data); +} + +READ8_MEMBER(pc6001_state::pc6001_8255_portb_r) +{ + return 0; +} + +WRITE8_MEMBER(pc6001_state::pc6001_8255_portb_w) +{ + //printf("pc6001_8255_portb_w %02x\n",data); +} + +WRITE8_MEMBER(pc6001_state::pc6001_8255_portc_w) +{ + //printf("pc6001_8255_portc_w %02x\n",data); +} + +READ8_MEMBER(pc6001_state::pc6001_8255_portc_r) +{ + return 0x88; +} + +UINT8 pc6001_state::check_keyboard_press() +{ + ioport_port *ports[3] = { m_io_key1, m_io_key2, m_io_key3 }; + int i,port_i,scancode; + UINT8 shift_pressed,caps_lock; + scancode = 0; + + shift_pressed = (m_io_key_modifiers->read() & 2)>>1; + caps_lock = (m_io_key_modifiers->read() & 8)>>3; + + for(port_i=0;port_i<3;port_i++) + { + for(i=0;i<32;i++) + { + if((ports[port_i]->read()>>i) & 1) + { + if((shift_pressed != caps_lock) && scancode >= 0x41 && scancode <= 0x5f) + scancode+=0x20; + + if(shift_pressed && scancode >= 0x31 && scancode <= 0x39) + scancode-=0x10; + + if(shift_pressed && scancode == 0x30) // '0' / '=' + scancode = 0x3d; + + if(shift_pressed && scancode == 0x2c) // ',' / ';' + scancode = 0x3b; + + if(shift_pressed && scancode == 0x2f) // '/' / '?' + scancode = 0x3f; + + if(shift_pressed && scancode == 0x2e) // '.' / ':' + scancode = 0x3a; + + return scancode; + } + scancode++; + } + } + + return 0; +} + +UINT8 pc6001_state::check_joy_press() +{ + UINT8 p1_key = m_io_p1->read() ^ 0xff; + UINT8 shift_key = m_io_key_modifiers->read() & 0x02; + UINT8 space_key = m_io_key2->read() & 0x01; + UINT8 joy_press; + + /* + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + */ + + joy_press = 0; + + switch(p1_key & 0xf) + { + case 0x01: joy_press = 0x04; break; //up + case 0x02: joy_press = 0x08; break; //down + case 0x04: joy_press = 0x20; break; + case 0x05: joy_press = 0x24; break; //up-left + case 0x06: joy_press = 0x28; break; //down-left + case 0x08: joy_press = 0x10; break; //right + case 0x09: joy_press = 0x14; break; //up-right + case 0x0a: joy_press = 0x18; break; //down-right + } + + if(p1_key & 0x10 || space_key) { joy_press |= 0x80; } //button 1 (space) + if(p1_key & 0x20 || shift_key) { joy_press |= 0x01; } //button 2 (shift) + + return joy_press; +} + +TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::cassette_callback) +{ + if(m_cas_switch == 1) + { + #if 0 + static UINT8 cas_data_i = 0x80,cas_data_poll; + //m_cur_keycode = gfx_data[m_cas_offset++]; + if(m_cassette->input() > 0.03) + cas_data_poll|= cas_data_i; + else + cas_data_poll&=~cas_data_i; + if(cas_data_i == 1) + { + m_cur_keycode = cas_data_poll; + cas_data_i = 0x80; + /* data ready, poll irq */ + m_irq_vector = 0x08; + m_maincpu->set_input_line(0, ASSERT_LINE); + } + else + cas_data_i>>=1; + #else + address_space &space = m_maincpu->space(AS_PROGRAM); + m_cur_keycode = m_cas_hack->read_rom(space, m_cas_offset++); + popmessage("%04x %04x", m_cas_offset, m_cas_maxsize); + if(m_cas_offset > m_cas_maxsize) + { + m_cas_offset = 0; + m_cas_switch = 0; + if(IRQ_LOG) printf("Tape-E IRQ 0x12\n"); + m_irq_vector = 0x12; + m_maincpu->set_input_line(0, ASSERT_LINE); + } + else + { + if(IRQ_LOG) printf("Tape-D IRQ 0x08\n"); + m_irq_vector = 0x08; + m_maincpu->set_input_line(0, ASSERT_LINE); + } + #endif + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::keyboard_callback) +{ + UINT32 key1 = m_io_key1->read(); + UINT32 key2 = m_io_key2->read(); + UINT32 key3 = m_io_key3->read(); +// UINT8 p1_key = m_io_p1->read(); + + if(m_cas_switch == 0) + { + if((key1 != m_old_key1) || (key2 != m_old_key2) || (key3 != m_old_key3)) + { + m_cur_keycode = check_keyboard_press(); + if(IRQ_LOG) printf("KEY IRQ 0x02\n"); + m_irq_vector = 0x02; + m_maincpu->set_input_line(0, ASSERT_LINE); + m_old_key1 = key1; + m_old_key2 = key2; + m_old_key3 = key3; + } + #if 0 + else /* joypad polling */ + { + m_cur_keycode = check_joy_press(); + if(m_cur_keycode) + { + m_irq_vector = 0x16; + m_maincpu->set_input_line(0, ASSERT_LINE); + } + } + #endif + } +} + +void pc6001_state::machine_start() +{ + m_timer_hz_div = 3; + { + attotime period = attotime::from_hz((487.5*4)/(m_timer_hz_div+1)); + m_timer_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc6001_state::audio_callback),this)); + m_timer_irq_timer->adjust(period, 0, period); + } +} + +void pc6001_state::machine_reset() +{ + m_video_ram = m_region_maincpu->base() + 0xc000; + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + m_port_c_8255=0; + + m_cas_switch = 0; + m_cas_offset = 0; + m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; + m_timer_irq_mask = 1; + m_timer_irq_mask2 = 1; + m_timer_irq_vector = 0x06; // actually vector is fixed in plain PC-6001 + m_timer_hz_div = 3; +} + +MACHINE_RESET_MEMBER(pc6001_state,pc6001m2) +{ + m_video_ram = m_region_maincpu->base() + 0xc000 + 0x28000; + + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + // hackish way to simplify bankswitch handling + if (m_cart_rom) + memcpy(m_region_maincpu->base() + 0x48000, m_cart_rom->base(), 0x4000); + + m_port_c_8255=0; + + m_cas_switch = 0; + m_cas_offset = 0; + m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; + + /* set default bankswitch */ + { + UINT8 *ROM = m_region_maincpu->base(); + m_bank_r0 = 0x71; + m_bank1->set_base(&ROM[BASICROM(0)]); + m_bank2->set_base(&ROM[BASICROM(1)]); + m_bank3->set_base(&ROM[EXROM(0)]); + m_bank4->set_base(&ROM[EXROM(1)]); + m_bank_r1 = 0xdd; + m_bank5->set_base(&ROM[WRAM(4)]); + m_bank6->set_base(&ROM[WRAM(5)]); + m_bank7->set_base(&ROM[WRAM(6)]); + m_bank8->set_base(&ROM[WRAM(7)]); + m_bank_opt = 0x02; //tv rom + m_bank_w = 0x50; //enable write to work ram 4,5,6,7 + m_gfx_bank_on = 0; + } + + m_timer_irq_mask = 1; + m_timer_irq_mask2 = 1; + m_timer_irq_vector = 0x06; +} + +MACHINE_RESET_MEMBER(pc6001_state,pc6001sr) +{ + m_video_ram = m_region_maincpu->base() + 0x70000; + + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + // should this be mirrored into the EXROM regions? hard to tell without an actual cart dump... + + m_port_c_8255=0; + + m_cas_switch = 0; + m_cas_offset = 0; + m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; + + /* set default bankswitch */ + { + UINT8 *ROM = m_region_maincpu->base(); + m_sr_bank_r[0] = 0xf8; m_bank1->set_base(&ROM[SR_SYSROM_1(0x08)]); + m_sr_bank_r[1] = 0xfa; m_bank2->set_base(&ROM[SR_SYSROM_1(0x0a)]); + m_sr_bank_r[2] = 0xb0; m_bank3->set_base(&ROM[SR_EXROM1(0x00)]); + m_sr_bank_r[3] = 0xc0; m_bank4->set_base(&ROM[SR_EXROM0(0x00)]); + m_sr_bank_r[4] = 0x08; m_bank5->set_base(&ROM[SR_WRAM0(0x08)]); + m_sr_bank_r[5] = 0x0a; m_bank6->set_base(&ROM[SR_WRAM0(0x0a)]); + m_sr_bank_r[6] = 0x0c; m_bank7->set_base(&ROM[SR_WRAM0(0x0c)]); + m_sr_bank_r[7] = 0x0e; m_bank8->set_base(&ROM[SR_WRAM0(0x0e)]); +// m_bank_opt = 0x02; //tv rom + + /* enable default work RAM writes */ + m_sr_bank_w[0] = 0x00; + m_sr_bank_w[1] = 0x02; + m_sr_bank_w[2] = 0x04; + m_sr_bank_w[3] = 0x06; + m_sr_bank_w[4] = 0x08; + m_sr_bank_w[5] = 0x0a; + m_sr_bank_w[6] = 0x0c; + m_sr_bank_w[7] = 0x0e; + + m_gfx_bank_on = 0; + } + + m_timer_irq_mask = 1; + m_timer_irq_mask2 = 1; + m_timer_irq_vector = 0x06; +} + +static const rgb_t defcolors[] = +{ + rgb_t(0x07, 0xff, 0x00), /* GREEN */ + rgb_t(0xff, 0xff, 0x00), /* YELLOW */ + rgb_t(0x3b, 0x08, 0xff), /* BLUE */ + rgb_t(0xcc, 0x00, 0x3b), /* RED */ + rgb_t(0xff, 0xff, 0xff), /* BUFF */ + rgb_t(0x07, 0xe3, 0x99), /* CYAN */ + rgb_t(0xff, 0x1c, 0xff), /* MAGENTA */ + rgb_t(0xff, 0x81, 0x00), /* ORANGE */ + + /* MC6847 specific */ + rgb_t(0x00, 0x7c, 0x00), /* ALPHANUMERIC DARK GREEN */ + rgb_t(0x07, 0xff, 0x00), /* ALPHANUMERIC BRIGHT GREEN */ + rgb_t(0x91, 0x00, 0x00), /* ALPHANUMERIC DARK ORANGE */ + rgb_t(0xff, 0x81, 0x00) /* ALPHANUMERIC BRIGHT ORANGE */ +}; + +static const rgb_t mk2_defcolors[] = +{ + rgb_t(0x00, 0x00, 0x00), /* BLACK */ + rgb_t(0xff, 0xaf, 0x00), /* ORANGE */ + rgb_t(0x00, 0xff, 0xaf), /* tone of GREEN */ + rgb_t(0xaf, 0xff, 0x00), /* tone of GREEN */ + rgb_t(0xaf, 0x00, 0xff), /* VIOLET */ + rgb_t(0xff, 0x00, 0xaf), /* SCARLET */ + rgb_t(0x00, 0xaf, 0xff), /* LIGHT BLUE */ + rgb_t(0xaf, 0xaf, 0xaf), /* GRAY */ + rgb_t(0x00, 0x00, 0x00), /* BLACK */ + rgb_t(0xff, 0x00, 0x00), /* RED */ + rgb_t(0x00, 0xff, 0x00), /* GREEN */ + rgb_t(0xff, 0xff, 0x00), /* YELLOW */ + rgb_t(0x00, 0x00, 0xff), /* BLUE */ + rgb_t(0xff, 0x00, 0xff), /* PINK */ + rgb_t(0x00, 0xff, 0xff), /* CYAN */ + rgb_t(0xff, 0xff, 0xff) /* WHITE */ +}; + +PALETTE_INIT_MEMBER(pc6001_state, pc6001) +{ + int i; + + for(i=0;i<8+4;i++) + palette.set_pen_color(i+8,defcolors[i]); +} + +PALETTE_INIT_MEMBER(pc6001_state,pc6001m2) +{ + int i; + + for(i=0;i<8;i++) + palette.set_pen_color(i+8,defcolors[i]); + + for(i=0x10;i<0x20;i++) + palette.set_pen_color(i,mk2_defcolors[i-0x10]); +} + +#if 0 +static const cassette_interface pc6001_cassette_interface = +{ + pc6001_cassette_formats, + NULL, + (cassette_state)(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED), + NULL +}; +#endif + +static const gfx_layout char_layout = +{ + 8, 16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 +}; + + +static const gfx_layout kanji_layout = +{ + 16, 16, + RGN_FRAC(1,2), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, + 0+RGN_FRAC(1,2), 1+RGN_FRAC(1,2), 2+RGN_FRAC(1,2), 3+RGN_FRAC(1,2), 4+RGN_FRAC(1,2), 5+RGN_FRAC(1,2), 6+RGN_FRAC(1,2), 7+RGN_FRAC(1,2) }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 +}; + +static GFXDECODE_START( pc6001m2 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, char_layout, 2, 1 ) + GFXDECODE_ENTRY( "gfx2", 0x0000, kanji_layout, 2, 1 ) +GFXDECODE_END + +#define PC6001_MAIN_CLOCK 7987200 + +static MACHINE_CONFIG_START( pc6001, pc6001_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, PC6001_MAIN_CLOCK / 2) // ~4 Mhz + MCFG_CPU_PROGRAM_MAP(pc6001_map) + MCFG_CPU_IO_MAP(pc6001_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc6001_state, pc6001_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pc6001_state,pc6001_irq_callback) + +// MCFG_CPU_ADD("subcpu", I8049, 7987200) + + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc6001m2) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DRIVER(pc6001_state, screen_update_pc6001) + MCFG_SCREEN_SIZE(320, 25+192+26) + MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16+4) + MCFG_PALETTE_INIT_OWNER(pc6001_state, pc6001) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pc6001_state, pc6001_8255_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pc6001_state, pc6001_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pc6001_state, pc6001_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pc6001_state, pc6001_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pc6001_state, pc6001_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc6001_state, pc6001_8255_portc_w)) + + /* uart */ + MCFG_DEVICE_ADD("uart", I8251, 0) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pc6001_cart") + +// MCFG_CASSETTE_ADD("cassette", pc6001_cassette_interface) + MCFG_GENERIC_CARTSLOT_ADD("cas_hack", generic_plain_slot, "pc6001_cass") + MCFG_GENERIC_EXTENSIONS("cas,p6") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay8910", AY8910, PC6001_MAIN_CLOCK/4) + MCFG_AY8910_PORT_A_READ_CB(IOPORT("P1")) + MCFG_AY8910_PORT_B_READ_CB(IOPORT("P2")) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +// MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* TODO: accurate timing on this */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", pc6001_state, keyboard_callback, attotime::from_hz(250)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", pc6001_state, cassette_callback, attotime::from_hz(1200/12)) +MACHINE_CONFIG_END + + + +static MACHINE_CONFIG_DERIVED( pc6001m2, pc6001 ) + + MCFG_MACHINE_RESET_OVERRIDE(pc6001_state,pc6001m2) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(pc6001_state, screen_update_pc6001m2) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(16+16) + MCFG_PALETTE_INIT_OWNER(pc6001_state,pc6001m2) + + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pc6001m2_map) + MCFG_CPU_IO_MAP(pc6001m2_io) + + MCFG_GFXDECODE_MODIFY("gfxdecode", pc6001m2) + + MCFG_SOUND_ADD("upd7752", UPD7752, PC6001_MAIN_CLOCK/4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc6601, pc6001m2 ) + + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", Z80, PC6001_MAIN_CLOCK / 2) + MCFG_CPU_PROGRAM_MAP(pc6001m2_map) + MCFG_CPU_IO_MAP(pc6601_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc6001_state, pc6001_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pc6001_state,pc6001_irq_callback) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc6001sr, pc6001m2 ) + + MCFG_MACHINE_RESET_OVERRIDE(pc6001_state,pc6001sr) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(pc6001_state, screen_update_pc6001sr) + + /* basic machine hardware */ + MCFG_CPU_REPLACE("maincpu", Z80, XTAL_3_579545MHz) //*Yes*, PC-6001 SR Z80 CPU is actually slower than older models + MCFG_CPU_PROGRAM_MAP(pc6001sr_map) + MCFG_CPU_IO_MAP(pc6001sr_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc6001_state, pc6001sr_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pc6001_state,pc6001_irq_callback) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pc6001 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "basicrom.60", 0x0000, 0x4000, CRC(54c03109) SHA1(c622fefda3cdc2b87a270138f24c05828b5c41d2) ) + + ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) + ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_LOAD( "cgrom60.60", 0x0000, 0x1000, CRC(b0142d32) SHA1(9570495b10af5b1785802681be94b0ea216a1e26) ) + ROM_RELOAD( 0x1000, 0x1000 ) + + ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( pc6001a ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "basicrom.60a", 0x0000, 0x4000, CRC(fa8e88d9) SHA1(c82e30050a837e5c8ffec3e0c8e3702447ffd69c) ) + + ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) + ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x1000, "gfx1", 0 ) + ROM_LOAD( "cgrom60.60a", 0x0000, 0x1000, CRC(49c21d08) SHA1(9454d6e2066abcbd051bad9a29a5ca27b12ec897) ) + + ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( pc6001mk2 ) + ROM_REGION( 0x50000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "basicrom.62", 0x10000, 0x8000, CRC(950ac401) SHA1(fbf195ba74a3b0f80b5a756befc96c61c2094182) ) + ROM_LOAD( "voicerom.62", 0x18000, 0x4000, CRC(49b4f917) SHA1(1a2d18f52ef19dc93da3d65f19d3abbd585628af) ) + ROM_LOAD( "cgrom60.62", 0x1c000, 0x2000, CRC(81eb5d95) SHA1(53d8ae9599306ff23bf95208d2f6cc8fed3fc39f) ) + ROM_LOAD( "cgrom60m.62", 0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) + ROM_LOAD( "kanjirom.62", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) + // work ram 0x28000,0x10000 + // extended work ram 0x38000,0x10000 + // exrom 0x48000, 0x4000 + // 0x4c000, 0x4000 + + ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) + ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_COPY( "maincpu", 0x1c000, 0x00000, 0x4000 ) + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 ) +ROM_END + +ROM_START( pc6601 ) /* Variant of pc6001m2 */ + ROM_REGION( 0x50000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "basicrom.66", 0x10000, 0x8000, CRC(c0b01772) SHA1(9240bb6b97fe06f5f07b5d65541c4d2f8758cc2a) ) + ROM_LOAD( "voicerom.66", 0x18000, 0x4000, CRC(91d078c1) SHA1(6a93bd7723ef67f461394530a9feee57c8caf7b7) ) + ROM_LOAD( "cgrom60.66", 0x1c000, 0x2000, CRC(d2434f29) SHA1(a56d76f5cbdbcdb8759abe601eab68f01b0a8fe8) ) + ROM_LOAD( "cgrom66.66", 0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) + ROM_LOAD( "kanjirom.66", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) + // exrom 0x48000, 0x4000 + + ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) + ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_COPY( "maincpu", 0x1c000, 0x00000, 0x4000 ) + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 ) +ROM_END + +ROM_START( pc6001sr ) + ROM_REGION( 0x90000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "systemrom1.64", 0x10000, 0x10000, CRC(b6fc2db2) SHA1(dd48b1eee60aa34780f153359f5da7f590f8dff4) ) + ROM_LOAD( "systemrom2.64", 0x20000, 0x10000, CRC(55a62a1d) SHA1(3a19855d290fd4ac04e6066fe4a80ecd81dc8dd7) ) +// cgrom 1 0x30000, 0x10000 +// exrom 0 0x40000, 0x10000 +// exrom 1 0x50000, 0x10000 +// exram 0 0x60000, 0x10000 +// work ram 0 0x70000, 0x10000 +// 0x80000, 0x10000 + + ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) + ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_LOAD( "cgrom68.64", 0x0000, 0x4000, CRC(73bc3256) SHA1(5f80d62a95331dc39b2fb448a380fd10083947eb) ) + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_COPY( "maincpu", 0x28000, 0x00000, 0x8000 ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, pc6001, 0, 0, pc6001, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6001 (Japan)", MACHINE_NOT_WORKING ) +COMP( 1981, pc6001a, pc6001, 0, pc6001, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6001A (US)", MACHINE_NOT_WORKING ) // This version is also known as the NEC Trek +COMP( 1983, pc6001mk2,pc6001, 0, pc6001m2, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6001mkII (Japan)", MACHINE_NOT_WORKING ) +COMP( 1983, pc6601, pc6001, 0, pc6601, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6601 (Japan)", MACHINE_NOT_WORKING ) +COMP( 1984, pc6001sr, pc6001, 0, pc6001sr, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6001mkIISR (Japan)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pc8001.c b/src/mame/drivers/pc8001.c new file mode 100644 index 00000000000..fd95aa724b6 --- /dev/null +++ b/src/mame/drivers/pc8001.c @@ -0,0 +1,601 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + http://www2.odn.ne.jp/~haf09260/Pc80/EnrPc.htm + http://home1.catvmics.ne.jp/~kanemoto/n80/inside.html + http://www.geocities.jp/retro_zzz/machines/nec/8001/index.html + +*/ + +/* + + TODO: + + - uPD3301 attributes + - PCG1000 + - Intel 8251 + - cassette + - floppy + - PC-8011 + - PC-8021 + - PC-8031 + +*/ + +#include "includes/pc8001.h" + +/* Read/Write Handlers */ + +WRITE8_MEMBER( pc8001_state::port10_w ) +{ + /* + + bit description + + 0 RTC C0 + 1 RTC C1 + 2 RTC C2 + 3 RTC DATA IN + 4 + 5 + 6 + 7 + + */ + + // RTC + m_rtc->c0_w(BIT(data, 0)); + m_rtc->c1_w(BIT(data, 1)); + m_rtc->c2_w(BIT(data, 2)); + m_rtc->data_in_w(BIT(data, 3)); + + // centronics + m_cent_data_out->write(space, 0, data); +} + +WRITE8_MEMBER( pc8001_state::port30_w ) +{ + /* + + bit description + + 0 characters per line (0=40, 1=80) + 1 color mode (0=color, 1=B&W) + 2 CMT CHIN + 3 CMT MOTOR (1=on) + 4 CMT BS1 + 5 CMT BS2 + 6 unused + 7 unused + + */ + + /* characters per line */ + m_width80 = BIT(data, 0); + + /* color mode */ + m_color = BIT(data, 1); + + /* cassette motor */ + m_cassette->change_state(BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + +WRITE8_MEMBER( pc8001mk2_state::port31_w ) +{ + /* + + bit description + + 0 expansion ROM (0=expansion, 1=N80) + 1 memory mode (0=ROM, 1=RAM) + 2 color mode (0=attribute, 1=B&W) + 3 graphics enable + 4 resolution (0=640x200, 1=320x200) + 5 background color + 6 background color + 7 background color + + */ +} + +WRITE_LINE_MEMBER( pc8001_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( pc8001_state::write_centronics_ack ) +{ + m_centronics_ack = state; +} + +READ8_MEMBER( pc8001_state::port40_r ) +{ + /* + + bit description + + 0 BUSY + 1 ACK + 2 CMT CDIN + 3 EXP /EXTON + 4 RTC DATA OUT + 5 VRTC + 6 + 7 + + */ + + UINT8 data = 0x08; + + data |= m_centronics_busy; + data |= m_centronics_ack << 1; + data |= m_rtc->data_out_r() << 4; + data |= m_crtc->vrtc_r() << 5; + + return data; +} + +WRITE8_MEMBER( pc8001_state::port40_w ) +{ + /* + + bit description + + 0 STROBE + 1 RTC STB + 2 RTC CLK + 3 CRT /CLDS CLK + 4 + 5 SPEAKER + 6 + 7 + + */ + + m_centronics->write_strobe(BIT(data, 0)); + + m_rtc->clk_w(BIT(data, 2)); + m_rtc->stb_w(BIT(data, 1)); + + m_speaker->level_w(BIT(data, 5)); +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( pc8001_mem, AS_PROGRAM, 8, pc8001_state ) + AM_RANGE(0x0000, 0x5fff) AM_RAMBANK("bank1") + AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank3") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8001_io, AS_IO, 8, pc8001_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_READ_PORT("Y0") + AM_RANGE(0x01, 0x01) AM_READ_PORT("Y1") + AM_RANGE(0x02, 0x02) AM_READ_PORT("Y2") + AM_RANGE(0x03, 0x03) AM_READ_PORT("Y3") + AM_RANGE(0x04, 0x04) AM_READ_PORT("Y4") + AM_RANGE(0x05, 0x05) AM_READ_PORT("Y5") + AM_RANGE(0x06, 0x06) AM_READ_PORT("Y6") + AM_RANGE(0x07, 0x07) AM_READ_PORT("Y7") + AM_RANGE(0x08, 0x08) AM_READ_PORT("Y8") + AM_RANGE(0x09, 0x09) AM_READ_PORT("Y9") + AM_RANGE(0x10, 0x10) AM_MIRROR(0x0f) AM_WRITE(port10_w) + AM_RANGE(0x20, 0x20) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x21, 0x21) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x30, 0x30) AM_MIRROR(0x0f) AM_WRITE(port30_w) + AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READWRITE(port40_r, port40_w) + AM_RANGE(0x50, 0x51) AM_DEVREADWRITE(UPD3301_TAG, upd3301_device, read, write) + AM_RANGE(0x60, 0x68) AM_DEVREADWRITE(I8257_TAG, i8257_device, read, write) +// AM_RANGE(0x70, 0x7f) unused +// AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext0_w) +// AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext1_w) +// AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext2_w) +// AM_RANGE(0xb0, 0xb0) AM_READ(pc8011_gpio8_r) +// AM_RANGE(0xb1, 0xb1) AM_WRITE(pc8011_gpio8_w) +// AM_RANGE(0xb2, 0xb2) AM_READ(pc8011_gpio4_r) +// AM_RANGE(0xb3, 0xb3) AM_WRITE(pc8011_gpio4_w) +// AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(PC8011_CH1_I8251_TAG, i8251_device, data_r, data_w) +// AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE(PC8011_CH1_I8251_TAG, i8251_device, status_r, control_w) +// AM_RANGE(0xc2, 0xc2) AM_DEVREADWRITE(PC8011_CH2_I8251_TAG, i8251_device, data_r, data_w) +// AM_RANGE(0xc3, 0xc3) AM_DEVREADWRITE(PC8011_CH2_I8251_TAG, i8251_device, status_r, control_w) +// AM_RANGE(0xc8, 0xc8) RS-232 output enable? +// AM_RANGE(0xca, 0xca) RS-232 output disable? +// AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE(PC8011_IEEE488_I8255A_TAG, i8255_device, read, write) +// AM_RANGE(0xd8, 0xd8) AM_READ(pc8011_ieee488_control_signal_input_r) +// AM_RANGE(0xda, 0xda) AM_READ(pc8011_ieee488_bus_address_mode_r) +// AM_RANGE(0xdc, 0xdc) AM_WRITE(pc8011_ieee488_nrfd_w) +// AM_RANGE(0xde, 0xde) AM_WRITE(pc8011_ieee488_bus_mode_control_w) +// AM_RANGE(0xe0, 0xe3) AM_WRITE(expansion_storage_mode_w) +// AM_RANGE(0xe4, 0xe4) AM_MIRROR(0x01) AM_WRITE(irq_level_w) +// AM_RANGE(0xe6, 0xe6) AM_WRITE(irq_mask_w) +// AM_RANGE(0xe7, 0xe7) AM_WRITE(pc8012_memory_mode_w) +// AM_RANGE(0xe8, 0xfb) unused + AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8001mk2_mem, AS_PROGRAM, 8, pc8001mk2_state ) + AM_RANGE(0x0000, 0x5fff) AM_RAMBANK("bank1") + AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8001mk2_io, AS_IO, 8, pc8001mk2_state ) + AM_IMPORT_FROM(pc8001_io) + AM_RANGE(0x30, 0x30) AM_WRITE(port30_w) + AM_RANGE(0x31, 0x31) AM_WRITE(port31_w) +// AM_RANGE(0x5c, 0x5c) AM_WRITE(gram_on_w) +// AM_RANGE(0x5f, 0x5f) AM_WRITE(gram_off_w) +// AM_RANGE(0xe8, 0xe8) kanji_address_lo_w, kanji_data_lo_r +// AM_RANGE(0xe9, 0xe9) kanji_address_hi_w, kanji_data_hi_r +// AM_RANGE(0xea, 0xea) kanji_readout_start_w +// AM_RANGE(0xeb, 0xeb) kanji_readout_end_w +// AM_RANGE(0xf3, 0xf3) DMA type disk unit interface selection port +// AM_RANGE(0xf4, 0xf4) DMA type 8 inch control +// AM_RANGE(0xf5, 0xf5) DMA type 8 inch margin control +// AM_RANGE(0xf6, 0xf6) DMA type 8 inch FDC status +// AM_RANGE(0xf7, 0xf7) DMA type 8 inch FDC data register +// AM_RANGE(0xf8, 0xf8) DMA type 5 inch control +// AM_RANGE(0xf9, 0xf9) DMA type 5 inch margin control +// AM_RANGE(0xfa, 0xfa) DMA type 5 inch FDC status +// AM_RANGE(0xfb, 0xfb) DMA type 5 inch FDC data register +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( pc8001 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_PGUP) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_PGDN) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA5') PORT_CHAR('|') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(" _") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0) PORT_CHAR('_') + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Kana") PORT_CODE(KEYCODE_LCONTROL) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("DSW1") +INPUT_PORTS_END + +/* uPD3301 Interface */ + +static const rgb_t PALETTE_PC8001[] = +{ + rgb_t::black, + rgb_t(0x00, 0x00, 0xff), + rgb_t(0xff, 0x00, 0x00), + rgb_t(0xff, 0x00, 0xff), + rgb_t(0x00, 0xff, 0x00), + rgb_t(0x00, 0xff, 0xff), + rgb_t(0xff, 0xff, 0x00), + rgb_t::white +}; + +UPD3301_DRAW_CHARACTER_MEMBER( pc8001_state::pc8001_display_pixels ) +{ + UINT8 data = m_char_rom->base()[(cc << 3) | lc]; + int i; + + if (lc >= 8) return; + if (csr) data = 0xff; + + if (m_width80) + { + for (i = 0; i < 8; i++) + { + int color = BIT(data, 7) ^ rvv; + + bitmap.pix32(y, (sx * 8) + i) = PALETTE_PC8001[color ? 7 : 0]; + + data <<= 1; + } + } + else + { + if (sx % 2) return; + + for (i = 0; i < 8; i++) + { + int color = BIT(data, 7) ^ rvv; + + bitmap.pix32(y, (sx/2 * 16) + (i * 2)) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix32(y, (sx/2 * 16) + (i * 2) + 1) = PALETTE_PC8001[color ? 7 : 0]; + + data <<= 1; + } + } +} + +/* 8257 Interface */ + +WRITE_LINE_MEMBER( pc8001_state::hrq_w ) +{ + /* HACK - this should be connected to the BUSREQ line of Z80 */ + m_maincpu->set_input_line(INPUT_LINE_HALT, state); + + /* HACK - this should be connected to the BUSACK line of Z80 */ + m_dma->hlda_w(state); +} + +READ8_MEMBER( pc8001_state::dma_mem_r ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + return program.read_byte(offset); +} + +/* Machine Initialization */ + +void pc8001_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* initialize RTC */ + m_rtc->cs_w(1); + m_rtc->oe_w(1); + + /* initialize DMA */ + m_dma->ready_w(1); + + /* setup memory banking */ + UINT8 *ram = m_ram->pointer(); + + membank("bank1")->configure_entry(1, m_rom->base()); + program.install_read_bank(0x0000, 0x5fff, "bank1"); + program.unmap_write(0x0000, 0x5fff); + + switch (m_ram->size()) + { + case 16*1024: + membank("bank3")->configure_entry(0, ram); + program.unmap_readwrite(0x6000, 0xbfff); + program.unmap_readwrite(0x8000, 0xbfff); + program.install_readwrite_bank(0xc000, 0xffff, "bank3"); + break; + + case 32*1024: + membank("bank3")->configure_entry(0, ram); + program.unmap_readwrite(0x6000, 0xbfff); + program.install_readwrite_bank(0x8000, 0xffff, "bank3"); + break; + + case 64*1024: + membank("bank1")->configure_entry(0, ram); + membank("bank2")->configure_entry(0, ram + 0x6000); + membank("bank3")->configure_entry(0, ram + 0x8000); + program.install_readwrite_bank(0x0000, 0x5fff, "bank1"); + program.install_readwrite_bank(0x6000, 0xbfff, "bank2"); + program.install_readwrite_bank(0x8000, 0xffff, "bank3"); + membank("bank2")->set_entry(0); + break; + } + + membank("bank1")->set_entry(1); + membank("bank3")->set_entry(0); + + /* register for state saving */ + save_item(NAME(m_width80)); + save_item(NAME(m_color)); +} + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( pc8001, pc8001_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(pc8001_mem) + MCFG_CPU_IO_MAP(pc8001_io) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DEVICE(UPD3301_TAG, upd3301_device, screen_update) + MCFG_SCREEN_SIZE(640, 220) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + + MCFG_DEVICE_ADD(I8257_TAG, I8257, 4000000) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(pc8001_state, hrq_w)) + MCFG_I8257_IN_MEMR_CB(READ8(pc8001_state, dma_mem_r)) + MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8(UPD3301_TAG, upd3301_device, dack_w)) + + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) + + MCFG_DEVICE_ADD(UPD3301_TAG, UPD3301, 14318180) + MCFG_UPD3301_CHARACTER_WIDTH(8) + MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(pc8001_state, pc8001_display_pixels) + MCFG_UPD3301_VRTC_CALLBACK(DEVWRITELINE(I8257_TAG, i8257_device, dreq2_w)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pc8001_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pc8001_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K,64K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pc8001mk2, pc8001mk2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(pc8001mk2_mem) + MCFG_CPU_IO_MAP(pc8001mk2_io) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DEVICE(UPD3301_TAG, upd3301_device, screen_update) + MCFG_SCREEN_SIZE(640, 220) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + + MCFG_DEVICE_ADD(I8257_TAG, I8257, 4000000) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(pc8001_state, hrq_w)) + MCFG_I8257_IN_MEMR_CB(READ8(pc8001_state, dma_mem_r)) + MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8(UPD3301_TAG, upd3301_device, dack_w)) + + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) + + MCFG_DEVICE_ADD(UPD3301_TAG, UPD3301, 14318180) + MCFG_UPD3301_CHARACTER_WIDTH(8) + MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(pc8001_state, pc8001_display_pixels) + MCFG_UPD3301_VRTC_CALLBACK(DEVWRITELINE(I8257_TAG, i8257_device, dreq2_w)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( pc8001 ) + ROM_REGION( 0x6000, Z80_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "v101", "N-BASIC v1.01" ) + ROMX_LOAD( "n80v101.rom", 0x00000, 0x6000, CRC(a2cc9f22) SHA1(6d2d838de7fea20ddf6601660d0525d5b17bf8a3), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v102", "N-BASIC v1.02" ) + ROMX_LOAD( "n80v102.rom", 0x00000, 0x6000, CRC(ed01ca3f) SHA1(b34a98941499d5baf79e7c0e5578b81dbede4a58), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v110", "N-BASIC v1.10" ) + ROMX_LOAD( "n80v110.rom", 0x00000, 0x6000, CRC(1e02d93f) SHA1(4603cdb7a3833e7feb257b29d8052c872369e713), ROM_BIOS(3) ) + + ROM_REGION( 0x800, UPD3301_TAG, 0) + ROM_LOAD( "font.rom", 0x000, 0x800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) ) +ROM_END + +ROM_START( pc8001mk2 ) + ROM_REGION( 0x8000, Z80_TAG, 0 ) + ROM_LOAD( "n80_2.rom", 0x00000, 0x8000, CRC(03cce7b6) SHA1(c12d34e42021110930fed45a8af98db52136f1fb) ) + + ROM_REGION( 0x800, UPD3301_TAG, 0) + ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) ) + + ROM_REGION( 0x20000, "kanji", 0) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, pc8001, 0, 0, pc8001, pc8001, driver_device, 0, "Nippon Electronic Company", "PC-8001", MACHINE_NOT_WORKING ) +COMP( 1983, pc8001mk2, pc8001, 0, pc8001mk2, pc8001, driver_device, 0, "Nippon Electronic Company", "PC-8001mkII", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pc8401a.c b/src/mame/drivers/pc8401a.c new file mode 100644 index 00000000000..0f5ccc2a0c0 --- /dev/null +++ b/src/mame/drivers/pc8401a.c @@ -0,0 +1,677 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "includes/pc8401a.h" + +/* + + NEC PC-8401A-LS "Starlet" + NEC PC-8500 "Studley" + + TODO: + + - keyboard interrupt + - RTC TP pulse + - disassembler for NEC uPD70008C (RST mnemonics are different from Z80) + - clock does not advance in menu + - mirror e800-ffff to 6800-7fff + - soft power on/off + - NVRAM + - 8251 USART + - 8255 ports + - MC6845 palette + - MC6845 chargen ROM + - MC6845 screen update + + - peripherals + * PC-8431A Dual Floppy Drive + * PC-8441A CRT / Disk Interface + * PC-8461A 1200 Baud Modem + * PC-8407A 128KB RAM Expansion + * PC-8508A ROM/RAM Cartridge + + - Use the 600 baud save rate (PIP CAS2:=A: this is more reliable than the 1200 baud (PIP CAS:=A: rate. + +*/ + +#include "bus/rs232/rs232.h" + +/* Fake Keyboard */ + +void pc8401a_state::scan_keyboard() +{ + int strobe = 0; + + /* scan keyboard */ + for (int row = 0; row < 10; row++) + { + UINT8 data = m_io_y[row]->read(); + + if (data != 0xff) + { + strobe = 1; + m_key_latch = data; + } + } + + if (!m_key_strobe && strobe) + { + /* trigger interrupt */ + m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0x28); + logerror("INTERRUPT\n"); + } + + if (strobe) m_key_strobe = strobe; +} + +TIMER_DEVICE_CALLBACK_MEMBER(pc8401a_state::pc8401a_keyboard_tick) +{ + scan_keyboard(); +} + +/* Read/Write Handlers */ + +void pc8401a_state::bankswitch(UINT8 data) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + int rombank = data & 0x03; + int ram0000 = (data >> 2) & 0x03; + int ram8000 = (data >> 4) & 0x03; + + switch (ram0000) + { + case 0: /* ROM 0000H to 7FFFH */ + if (rombank < 3) + { + /* internal ROM */ + program.install_read_bank(0x0000, 0x7fff, "bank1"); + program.unmap_write(0x0000, 0x7fff); + membank("bank1")->set_entry(rombank); + } + else if (m_cart_rom) + { + /* ROM cartridge */ + program.install_read_bank(0x0000, 0x7fff, "bank1"); + program.unmap_write(0x0000, 0x7fff); + membank("bank1")->set_entry(6); + } + else + program.unmap_readwrite(0x0000, 0x7fff); + //logerror("0x0000-0x7fff = ROM %u\n", rombank); + break; + + case 1: /* RAM 0000H to 7FFFH */ + program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); + membank("bank1")->set_entry(4); + //logerror("0x0000-0x7fff = RAM 0-7fff\n"); + break; + + case 2: /* RAM 8000H to FFFFH */ + program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); + membank("bank1")->set_entry(5); + //logerror("0x0000-0x7fff = RAM 8000-ffff\n"); + break; + + case 3: /* invalid */ + logerror("0x0000-0x7fff = invalid\n"); + break; + } + + switch (ram8000) + { + case 0: /* cell addresses 0000H to 3FFFH */ + program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); + membank("bank3")->set_entry(0); + //logerror("0x8000-0xbfff = RAM 0-3fff\n"); + break; + + case 1: /* cell addresses 4000H to 7FFFH */ + program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); + membank("bank3")->set_entry(1); + //logerror("0x8000-0xbfff = RAM 4000-7fff\n"); + break; + + case 2: /* cell addresses 8000H to BFFFH */ + program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); + membank("bank3")->set_entry(2); + //logerror("0x8000-0xbfff = RAM 8000-bfff\n"); + break; + + case 3: /* RAM cartridge */ + if (m_ram->size() > 64) + { + program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); + membank("bank3")->set_entry(3); // TODO or 4 + } + else + { + program.unmap_readwrite(0x8000, 0xbfff); + } + //logerror("0x8000-0xbfff = RAM cartridge\n"); + break; + } + + if (BIT(data, 6)) + { + /* CRT video RAM */ + program.install_readwrite_bank(0xc000, 0xdfff, "bank4"); + program.unmap_readwrite(0xe000, 0xe7ff); + membank("bank4")->set_entry(1); + //logerror("0xc000-0xdfff = video RAM\n"); + } + else + { + /* RAM */ + program.install_readwrite_bank(0xc000, 0xe7ff, "bank4"); + membank("bank4")->set_entry(0); + //logerror("0xc000-0e7fff = RAM c000-e7fff\n"); + } +} + +WRITE8_MEMBER( pc8401a_state::mmr_w ) +{ + /* + + bit description + + 0 ROM section bit 0 + 1 ROM section bit 1 + 2 mapping for CPU addresses 0000H to 7FFFH bit 0 + 3 mapping for CPU addresses 0000H to 7FFFH bit 1 + 4 mapping for CPU addresses 8000H to BFFFH bit 0 + 5 mapping for CPU addresses 8000H to BFFFH bit 1 + 6 mapping for CPU addresses C000H to E7FFH + 7 + + */ + + if (data != m_mmr) + { + bankswitch(data); + } + + m_mmr = data; +} + +READ8_MEMBER( pc8401a_state::mmr_r ) +{ + return m_mmr; +} + +READ8_MEMBER( pc8401a_state::rtc_r ) +{ + /* + + bit description + + 0 RTC TP? + 1 RTC DATA OUT + 2 ? + 3 + 4 + 5 + 6 + 7 + + */ + + return (m_rtc->data_out_r() << 1) | (m_rtc->tp_r() << 2); +} + +WRITE8_MEMBER( pc8401a_state::rtc_cmd_w ) +{ + /* + + bit description + + 0 RTC C0 + 1 RTC C1 + 2 RTC C2 + 3 RTC DATA IN? + 4 + 5 + 6 + 7 + + */ + + m_rtc->c0_w(BIT(data, 0)); + m_rtc->c1_w(BIT(data, 1)); + m_rtc->c2_w(BIT(data, 2)); + m_rtc->data_in_w(BIT(data, 3)); +} + +WRITE8_MEMBER( pc8401a_state::rtc_ctrl_w ) +{ + /* + + bit description + + 0 RTC OE or CS? + 1 RTC STB + 2 RTC CLK + 3 + 4 + 5 + 6 + 7 + + */ + + m_rtc->oe_w(BIT(data, 0)); + m_rtc->stb_w(BIT(data, 1)); + m_rtc->clk_w(BIT(data, 2)); +} + +READ8_MEMBER( pc8401a_state::io_rom_data_r ) +{ + //logerror("I/O ROM read from %05x\n", m_io_addr); + return m_io_cart->read_rom(space, m_io_addr); +} + +WRITE8_MEMBER( pc8401a_state::io_rom_addr_w ) +{ + switch (offset) + { + case 0: /* A17..A16 */ + m_io_addr = ((data & 0x03) << 16) | (m_io_addr & 0xffff); + break; + + case 1: /* A15..A8 */ + m_io_addr = (m_io_addr & 0x300ff) | (data << 8); + break; + + case 2: /* A7..A0 */ + m_io_addr = (m_io_addr & 0x3ff00) | data; + break; + + case 3: + /* the same data is written here as to 0xb2, maybe this latches the address value? */ + break; + } +} + +READ8_MEMBER( pc8401a_state::port70_r ) +{ + /* + + bit description + + 0 key pressed + 1 + 2 + 3 + 4 must be 1 or CPU goes to HALT + 5 + 6 + 7 + + */ + + return 0x10 | m_key_strobe; +} + +READ8_MEMBER( pc8401a_state::port71_r ) +{ + return m_key_latch; +} + +WRITE8_MEMBER( pc8401a_state::port70_w ) +{ + m_key_strobe = 0; +} + +WRITE8_MEMBER( pc8401a_state::port71_w ) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + + m_key_latch = data; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( pc8401a_mem, AS_PROGRAM, 8, pc8401a_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xe7ff) AM_RAMBANK("bank4") + AM_RANGE(0xe800, 0xffff) AM_RAMBANK("bank5") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8401a_io, AS_IO, 8, pc8401a_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8500_io, AS_IO, 8, pc8401a_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READ_PORT("Y.0") + AM_RANGE(0x01, 0x01) AM_READ_PORT("Y.1") + AM_RANGE(0x02, 0x02) AM_READ_PORT("Y.2") + AM_RANGE(0x03, 0x03) AM_READ_PORT("Y.3") + AM_RANGE(0x04, 0x04) AM_READ_PORT("Y.4") + AM_RANGE(0x05, 0x05) AM_READ_PORT("Y.5") + AM_RANGE(0x06, 0x06) AM_READ_PORT("Y.6") + AM_RANGE(0x07, 0x07) AM_READ_PORT("Y.7") + AM_RANGE(0x08, 0x08) AM_READ_PORT("Y.8") + AM_RANGE(0x09, 0x09) AM_READ_PORT("Y.9") + AM_RANGE(0x10, 0x10) AM_WRITE(rtc_cmd_w) + AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x21, 0x21) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x30, 0x30) AM_READWRITE(mmr_r, mmr_w) +// AM_RANGE(0x31, 0x31) + AM_RANGE(0x40, 0x40) AM_READWRITE(rtc_r, rtc_ctrl_w) +// AM_RANGE(0x41, 0x41) +// AM_RANGE(0x50, 0x51) + AM_RANGE(0x60, 0x60) AM_DEVREADWRITE(SED1330_TAG, sed1330_device, status_r, data_w) + AM_RANGE(0x61, 0x61) AM_DEVREADWRITE(SED1330_TAG, sed1330_device, data_r, command_w) + AM_RANGE(0x70, 0x70) AM_READWRITE(port70_r, port70_w) + AM_RANGE(0x71, 0x71) AM_READWRITE(port71_r, port71_w) +// AM_RANGE(0x80, 0x80) modem status, set to 0xff to boot +// AM_RANGE(0x8b, 0x8b) +// AM_RANGE(0x90, 0x93) +// AM_RANGE(0xa0, 0xa1) + AM_RANGE(0x98, 0x98) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) + AM_RANGE(0x99, 0x99) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r, register_w) + AM_RANGE(0xb0, 0xb3) AM_WRITE(io_rom_addr_w) + AM_RANGE(0xb3, 0xb3) AM_READ(io_rom_data_r) +// AM_RANGE(0xc8, 0xc8) + AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( pc8401a ) + PORT_START("Y.0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP")// PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y.1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y.2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + + PORT_START("Y.3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + + PORT_START("Y.4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('*') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("Y.5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('*') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('*') + + PORT_START("Y.6") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('*') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ? + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + + PORT_START("Y.7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^I + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^C + + PORT_START("Y.8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y.9") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) +INPUT_PORTS_END + +/* Machine Initialization */ + +void pc8401a_state::machine_start() +{ + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + /* initialize RTC */ + m_rtc->cs_w(1); + + /* allocate CRT video RAM */ + m_crt_ram.allocate(PC8401A_CRT_VIDEORAM_SIZE); + + UINT8 *ram = m_ram->pointer(); + + /* set up A0/A1 memory banking */ + membank("bank1")->configure_entries(0, 4, m_rom->base(), 0x8000); + membank("bank1")->configure_entries(4, 2, ram, 0x8000); + if (m_cart_rom) + membank("bank1")->configure_entries(6, 1, m_cart_rom->base(), 0x8000); + membank("bank1")->set_entry(0); + + /* set up A2 memory banking */ + membank("bank3")->configure_entries(0, 5, ram, 0x4000); + membank("bank3")->set_entry(0); + + /* set up A3 memory banking */ + membank("bank4")->configure_entry(0, ram + 0xc000); + membank("bank4")->configure_entry(1, m_crt_ram); + membank("bank4")->set_entry(0); + + /* set up A4 memory banking */ + membank("bank5")->configure_entry(0, ram + 0xe800); + membank("bank5")->set_entry(0); + + /* bank switch */ + bankswitch(0); + + /* register for state saving */ + save_item(NAME(m_mmr)); + save_item(NAME(m_io_addr)); +} + +READ8_MEMBER( pc8401a_state::ppi_pc_r ) +{ + /* + + bit signal description + + PC0 + PC1 + PC2 + PC3 + PC4 PC-8431A DAV data valid + PC5 PC-8431A RFD ready for data + PC6 PC-8431A DAC data accepted + PC7 PC-8431A ATN attention + + */ + + return 0; +} + +WRITE8_MEMBER( pc8401a_state::ppi_pc_w ) +{ + /* + + bit signal description + + PC0 + PC1 + PC2 + PC3 + PC4 PC-8431A DAV data valid + PC5 PC-8431A RFD ready for data + PC6 PC-8431A DAC data accepted + PC7 PC-8431A ATN attention + + */ +} + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( pc8401a, pc8401a_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) // NEC uPD70008C + MCFG_CPU_PROGRAM_MAP(pc8401a_mem) + MCFG_CPU_IO_MAP(pc8401a_io) + + /* fake keyboard */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", pc8401a_state, pc8401a_keyboard_tick, attotime::from_hz(64)) + + /* devices */ + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_IN_PORTC_CB(READ8(pc8401a_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc8401a_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) + + /* video hardware */ + MCFG_FRAGMENT_ADD(pc8401a_video) + + /* option ROM cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* I/O ROM cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("96K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pc8500, pc8500_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) // NEC uPD70008C + MCFG_CPU_PROGRAM_MAP(pc8401a_mem) + MCFG_CPU_IO_MAP(pc8500_io) + + /* fake keyboard */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", pc8401a_state, pc8401a_keyboard_tick, attotime::from_hz(64)) + + /* devices */ + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_IN_PORTC_CB(READ8(pc8401a_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc8401a_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) + + /* video hardware */ + MCFG_FRAGMENT_ADD(pc8500_video) + + /* option ROM cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* I/O ROM cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("96K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( pc8401a ) + ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF ) + ROM_LOAD( "pc8401a.bin", 0x0000, 0x18000, NO_DUMP ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP ) +ROM_END + +ROM_START( pc8500 ) + ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF ) + ROM_LOAD( "pc8500.bin", 0x0000, 0x10000, CRC(c2749ef0) SHA1(f766afce9fda9ec84ed5b39ebec334806798afb3) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1984, pc8401a, 0, 0, pc8401a, pc8401a, driver_device, 0, "Nippon Electronic Company", "PC-8401A-LS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +//COMP( 1984, pc8401bd, pc8401a,0, pc8401a, pc8401a, driver_device, 0, "Nippon Electronic Company", "PC-8401BD", MACHINE_NOT_WORKING) +COMP( 1985, pc8500, 0, 0, pc8500, pc8401a, driver_device, 0, "Nippon Electronic Company", "PC-8500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/pc8801.c b/src/mame/drivers/pc8801.c new file mode 100644 index 00000000000..9d2a6e58c99 --- /dev/null +++ b/src/mame/drivers/pc8801.c @@ -0,0 +1,2971 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/************************************************************************************************************************************* + + PC-8801 (c) 1981 NEC + + driver by Angelo Salese, original MESS PC-88SR driver by ??? + + TODO: + - implement proper i8214 routing, also add irq latch mechanism; + - Fix up Floppy Terminal Count 0 / 1 writes properly, Castle Excellent (and presumably other games) is very picky about it. + + - add differences between various models; + - implement proper upd3301 / i8257 support; + - fix "jumps" in mouse support pointer (noticeable in Balance of Power); + - Add limits for extend work RAM; + - What happens to the palette contents when the analog/digital palette mode changes? + - waitstates; + - dipswitches needs to be controlled; + - below notes states that plain PC-8801 doesn't have a disk CPU, but the BIOS clearly checks the floppy ports. Wrong info? + - clean-ups, banking and video in particular (i.e. hook-ups with memory region should go away and device models should be used instead) + + per-game specific TODO: + - 100yen Soft 8 Revival Special: tight loop with vblank bit, but vblank irq takes too much time to execute its code; + - 177: gameplay is too fast (parent pc8801 only); + - 1942: missing sound, enables a masked irq; + - Acro Jet: hangs waiting for an irq (floppy issue); + - Arcus: doesn't surpass Wolf Team logo; + - Advanced Fantasian: garbage during gameplay (floppy?) + - American Success: reads the light pen? + - Attacker: resets after a bunch of animation frames; + - Balance of Power: uses the SIO port for something ... + - Belloncho Shintai Kensa: hangs + - Bishoujo Baseball Gakuen: checks ym2608 after intro screen; + - The Black Onyx: writes a katakana msg: "sono kata ha koko ni orimasen" then doesn't show up anything. (Needs user disk?) + - Boukenshatachi: dies after the intro. + - Campaign Ban Daisenryaku 2: Hangs at title screen? + - Carigraph: inputs doesn't work? + - Can Can Bunny: bitmap artifacts on intro, caused by a fancy usage of the attribute vram; + - Can Can Bunny: no sound (regression); + - Can Can Bunny Superior: black screen during the intro + - Chou Bishoujo Densetsu CROQUIS: accesses ports 0xa0-0xa3 and 0xc2-0xc3 + - Combat: mono gfx mode enabled, but I don't see any noticeable quirk? + - Cranston Manor (actually N88-Basic demo): no sound + - Datenshi Kyouko: gfx garbage on the right edge? + - Final Crisis: sound stuck with OPNA? + - Fire Hawk: tries to r/w the opn ports (probably crashed due to floppy?) + - Game Music Library: "Disk I/O error on 3040", starting from Sorcerian item + - Gaudi - Barcelona no Kaze: fails PCM loading + - GeGeGe no Kitarou: title screen text/bitmap contrast is pretty ugly (BTANB?); + - Grobda: palette is ugly (parent pc8801 only); + - Makaimura: after losing a life the game doesn't work properly anymore, copy protection? + - Music Collection Vol. 2 - Final Fantasy Tokushuu: sound irq dies pretty soon + - N-BASIC: cursor doesn't show up; + - The Return of Ishtar: z80 exception after entering the name. + - Star Cruiser: bad kanji data? + - Star Cruiser: reads at i/o 0x8e? + - Wanderers from Ys: user data disk looks screwed? It loads with everything as maximum as per now ... + - WerDragon: no BGMs + - Xevious: game is too fast (parent pc8801 only) + + list of games/apps that crashes due of floppy issues (* -> denotes games fixed with current floppy code, # -> regressed with current floppy code): + * Agni no Ishi + * Amazoness no Hihou (takes invalid data from floppy) + - American Truck / American Truck SR (polls read deleted data command) + * Ankokujou + * Ao No Sekizou (fdc CPU irq doesn't fire anymore) + * Arcus + * Attacker + - Autumn Park (BASIC error) + * Battle Gorilla + * Belloncho Shintai Kensa + - Bishoujo Noriko Part I (writes to FDC CPU ROM then expects some strict values, taken from floppy image) + * Blassty (attempts to read at 0x801b) + - Bokosuka Wars (polls read ID command) + * Boukenshatachi + * Can Can Bunny Superior + - Carmine + - Castle Excellent (sets sector 0xf4? Jumps to 0xa100 and it shouldn't) (REGRESSED with current floppy code) + - Card Game Pro 8.8k Plus Unit 1 (prints Disk i/o error 135 in vram, not visible for whatever reason) + - Championship Lode Runner (fdc CPU irq doesn't fire anymore) + - Change Vol. 1 (stops at PCM loading) + - Chikyuu Boueigun (disk i/o error during "ESDF SYSTEM LOADING") (REGRESSED with current floppy code) + * Chikyuu Senshi Rayieza (fdc CPU crashes) + - Choplifter + - Columns (code at 0x28c8, copy protection) + - Corridor ("THIS SYSTEM NOT KOEI SYSTEM" printed on screen) (REGRESSED with current floppy code) + # Craze (returns to basic after logo pops up, tries to self-modify program data via the window offset?) + * Crimson + * Crimson 3 + * Cuby Panic (copy protection routine at 0x911A) + - Daidasso (prints "BOOT dekimasen" on screen -> can't boot) + - Daikoukai Jidai (YSHELL.COM error) + - Databox (app) + - Day Dream ("Bad drive number at 570") + - Demons Ring + * Dennou Tsuushin + - Door Door MK-2 (sets up TC in the middle of execution phase read then wants status bit 6 to be low PC=0x7050 of fdc cpu) + * Dragon Slayer - The Legend of Heroes 2 + - Dungeon Buster + * El Dorado Denki + * Elevator Action + - Emerald Densetsu (dies after few seconds of intro) + - Emerald Dragon (it seems to miss a timer) + - Emmy + - Explosion (fails to load ADPCM data?) + * F15 Strike Eagle + - F2 Grand Prix ("Boot dekimasen") + # Fangs - The Saga of Wolf Blood (Crashes at the first random battle) + - Fantasian + * Final Zone + # Final Zone (demo) (REGRESSION: asserts at MESS boot) + - Fruit Panic + - FSD Sample Ongaku Shuu Vol. 1-7 + - Gaia no Kiba (Disk I/O error at 150) + - Gaiflame + - Gambler Jiko Chuushin ha + - Gambler Jiko Chuushin ha 2 + - Gambler Jiko Chuushin ha 3 + - Gambler Jiko Chuushin ha 3 (demo) + - Gambler Jiko Chuushin ha Mahjong Puzzle Collection + - Gambler Jiko Chuushin ha Mahjong Puzzle Collection (demo) + * Game Music Library + * Gaudi - Barcelona no Kaze (bad Wolfteam logo then black screen) + - GC-clusterz Music Disk Vol. 1-7 + * Genji + * Gokuraku Tengoku + - Grodius 3 (might not be floppy) + - Gun Ship (at gameplay) + (Hacker) + + - Harakiri + - Kaseijin (app) (code snippet is empty at some point) + - Lamia: fails to create an user disk (after character creation) -> disk write error + * MakaiMura (attempts to r/w the sio ports, but it's clearly crashed) + * Mugen Senshi Valis (at Telenet logo, it also appears to have a nasty copy protection when taking a specific item (untested)) + - Mr. Pro Yakyuu + - Panorama Toh + - PC-8034 (app) + - PC-8037SR (app) + - P1 (app) + - Pattern Editor 88 (app) + - Super Shunbo II (app) (Load error) + - Super TII (app) + * The Return of Ishtar + - Tobira wo Akete (random crashes in parent pc8801 only) + + list of games that doesn't like i8214_irq_level == 5 in sound irq + - 100yen Disk 2 / Jumper 2: Sound BGM dies pretty soon; + - Alpha (demo): stuck note in title screen, doesn't seem to go further; + - Ayumi: black screen after new game / load game screen; + - Brunette: No sound, eventually hangs at gameplay; + - Digital Devil Story Megami Tensei: hangs at gameplay (sound irq issue) + - Double Face: hangs at logo (sound irq issue) + + games that needs to NOT have write-protect floppies (BTANBs): + - Balance of Power + - Blue Moon Story: moans with a kanji msg; + - Mahjong Clinic Zoukangou + - Tobira wo Akete (hangs at title screen) + + games that needs to HAVE write-protect floppies (BTANBs): + - 100 Yen Disk 7: (doesn't boot in V2 mode) + + other BTANBs + - Attack Hirokochan: returns to BASIC after an initial animation, needs BASIC V1: + - Jark (needs PC-8801MC) + - Kuronekosou Souzoku Satsujin Jiken: "Illegal function call in 105", needs BASIC V1; + + Notes: + - BIOS disk ROM defines what kind of floppies you could load: + * with 0x0800 ROM size you can load 2d floppies only; + * with 0x2000 ROM size you can load 2d and 2hd floppies; + - Later models have palette bugs with some games (Alphos, Tokyo Nampa Street). + This is because you have to set up the V1 / V2 DIP-SW to V1 for those games (it's the BIOS that sets up to analog and never changes back otherwise). + - Password for "AY-1: Fortress Solomon" is "123" then press enter, any other key pressed makes it to fail the check (you must soft reset the machine) + - Pressing Home in Dennou Gakuen during gameplay makes it to show a fake DASM screen. That's supposed to be a panic button and it's also in the + sequels (with different screens); + + Bankswitch Notes: + - 0x31 - graphic banking + - 0x32 - misc banking + - 0x5c / 0x5f - VRAM banking + - 0x70 - window offset (banking) + - 0x71 - extra ROM banking + - 0x78 - window offset (banking) increment (+ 0x100) + - 0xe2 / 0xe3 - extra RAM banking + - 0xf0 / 0xf1 = kanji banking + +====================================================================================================================================== + + PC-88xx Models (and similar machines like PC-80xx and PC-98DO) + + Model | release | CPU | BIOS components | | + | | clock | N-BASIC | N88-BASIC | N88-BASIC Enh | Sound | CD | Dict | Disk | Notes + ================================================================================================================================== + PC-8001 | 1979-03 | z80A @ 4 | X | - | - | - | - | - | - | + PC-8001A | ?? | z80A @ 4 | X | - | - | - | - | - | - | (U) + PC-8801 | 1981-11 | z80A @ 4 | X | X | - | - | - | - | - | (KO) + PC-8801A | ?? | z80A @ 4 | X | X | - | - | - | - | - | (U) + PC-8001 mkII | 1983-03 | z80A @ 4 | X | - | - | - | - | - | - | (GE),(KO) + PC-8001 mkIIA | ?? | z80A @ 4 | X | - | - | - | - | - | - | (U),(GE) + PC-8801 mkII | 1983-11 | z80A @ 4 | X | X | - | - | - | - | (FDM) | (K1) + PC-8001 mkII SR | 1985-01 | z80A @ 4 | X | - | - | - | - | - | - | (GE),(NE),(KO) + PC-8801 mkII SR | 1985-03 | z80A @ 4 | X | X | X | X | - | - | (FDM) | (K1) + PC-8801 mkII TR | 1985-10 | z80A @ 4 | X | X | X | X | - | - | (FD2) | (K1) + PC-8801 mkII FR | 1985-11 | z80A @ 4 | X | X | X | X | - | - | (FDM) | (K1) + PC-8801 mkII MR | 1985-11 | z80A @ 4 | X | X | X | X | - | - | (FDH) | (K2) + PC-8801 FH | 1986-11 | z80H @ 4/8 | X | X | X | X | - | - | (FDM) | (K2) + PC-8801 MH | 1986-11 | z80H @ 4/8 | X | X | X | X | - | - | (FDH) | (K2) + PC-88 VA | 1987-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FDH) | (K2) + PC-8801 FA | 1987-11 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) + PC-8801 MA | 1987-11 | z80H @ 4/8 | X | X | X | X | - | X | (FDH) | (K2) + PC-88 VA2 | 1988-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FDH) | (K2) + PC-88 VA3 | 1988-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FD3) | (K2) + PC-8801 FE | 1988-10 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) + PC-8801 MA2 | 1988-10 | z80H @ 4/8 | X | X | X | X | - | X | (FDH) | (K2) + PC-98 DO | 1989-06 | z80H @ 8 | X | X | X | X | - | - | (FDH) | (KE) + PC-8801 FE2 | 1989-10 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) + PC-8801 MC | 1989-11 | z80H @ 4/8 | X | X | X | X | X | X | (FDH) | (K2) + PC-98 DO+ | 1990-10 | z80H @ 8 | X | X | X | X | - | - | (FDH) | (KE) + + info for PC-98 DO & DO+ refers to their 88-mode + + Disk Drive options: + (FDM): there exist three model of this computer: Model 10 (base model, only optional floppy drive), Model 20 + (1 floppy drive for 5.25" 2D disks) and Model 30 (2 floppy drive for 5.25" 2D disks) + (FD2): 2 floppy drive for 5.25" 2D disks + (FDH): 2 floppy drive for both 5.25" 2D disks and 5.25" HD disks + (FD3): 2 floppy drive for both 5.25" 2D disks and 5.25" HD disks + 1 floppy drive for 3.5" 2TD disks + + Notes: + (U): US version + (GE): Graphic Expansion for PC-8001 + (NE): N-BASIC Expansion for PC-8001 (similar to N88-BASIC Expansion for PC-88xx) + (KO): Optional Kanji ROM + (K1): Kanji 1st Level ROM + (K2): Kanji 2nd Level ROM + (KE): Kanji Enhanced ROM + + Memory mounting locations: + * N-BASIC 0x0000 - 0x5fff, N-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff + * N-BASIC 0x0000 - 0x5fff, N-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff + * N88-BASIC 0x0000 - 0x7fff, N88-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff + * Sound BIOS: 0x6000 - 0x7fff + * CD-ROM BIOS: 0x0000 - 0x7fff + * Dictionary: 0xc000 - 0xffff (32 Banks) + + info from http://www.geocities.jp/retro_zzz/machines/nec/cmn_roms.html + also, refer to http://www.geocities.jp/retro_zzz/machines/nec/cmn_vers.html for + info about BASIC revisions in the various models (BASIC V2 is the BASIC + Expansion, if I unerstood correctly) + +*************************************************************************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8255.h" +#include "machine/upd1990a.h" +#include "machine/upd765.h" +#include "machine/i8214.h" +#include "machine/i8251.h" +#include "sound/2203intf.h" +#include "sound/2608intf.h" +#include "sound/beep.h" +//#include "includes/pc8801.h" + +//#define USE_PROPER_I8214 + + +#define IRQ_DEBUG (0) +#define IRQ_LOG(x) do { if (IRQ_DEBUG) printf x; } while (0) + +#define MASTER_CLOCK XTAL_4MHz +/* TODO: clocks of this */ +#define PIXEL_CLOCK_15KHz XTAL_14_31818MHz +#define PIXEL_CLOCK_24KHz XTAL_21_4772MHz + +#define I8214_TAG "i8214" +#define UPD1990A_TAG "upd1990a" +#define I8251_TAG "i8251" + +struct crtc_t +{ + UINT8 cmd,param_count,cursor_on,status,irq_mask; + UINT8 param[8][5]; + UINT8 inverse; +}; + +struct mouse_t +{ + UINT8 phase; + UINT8 x,y; + attotime time; +}; + +class pc8801_state : public driver_device +{ +public: + pc8801_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_fdccpu(*this, "fdccpu"), + m_pic(*this, I8214_TAG), + m_rtc(*this, UPD1990A_TAG), + m_cassette(*this, "cassette"), + m_beeper(*this, "beeper"), + m_opna(*this, "opna"), + m_opn(*this, "opn"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_fdccpu; + optional_device m_pic; + required_device m_rtc; + required_device m_cassette; + required_device m_beeper; + required_device m_opna; + required_device m_opn; + required_device m_palette; + + UINT8 *m_work_ram; + UINT8 *m_hi_work_ram; + UINT8 *m_ext_work_ram; + UINT8 *m_gvram; + UINT8 *m_n80rom; + UINT8 *m_n88rom; + UINT8 *m_kanji_rom; + UINT8 *m_cg_rom; + + UINT8 m_i8255_0_pc; + UINT8 m_i8255_1_pc; + UINT8 m_fdc_irq_opcode; + UINT8 m_ext_rom_bank; + UINT8 m_gfx_ctrl; + UINT8 m_vram_sel; + UINT8 m_misc_ctrl; + UINT8 m_device_ctrl_data; + UINT8 m_window_offset_bank; + UINT8 m_layer_mask; + UINT16 m_dma_counter[4]; + UINT16 m_dma_address[4]; + UINT8 m_alu_reg[3]; + UINT8 m_dmac_mode; + UINT8 m_alu_ctrl1; + UINT8 m_alu_ctrl2; + UINT8 m_extram_mode; + UINT8 m_extram_bank; + UINT8 m_txt_width; + UINT8 m_txt_color; +#ifdef USE_PROPER_I8214 + UINT8 m_timer_irq_mask; + UINT8 m_vblank_irq_mask; + UINT8 m_sound_irq_mask; + UINT8 m_int_state; +#else + UINT8 m_i8214_irq_level; + UINT8 m_vrtc_irq_mask; + UINT8 m_vrtc_irq_latch; + UINT8 m_timer_irq_mask; + UINT8 m_timer_irq_latch; + UINT8 m_sound_irq_mask; + UINT8 m_sound_irq_latch; + UINT8 m_sound_irq_pending; +#endif + UINT8 m_has_clock_speed; + UINT8 m_clock_setting; + UINT8 m_baudrate_val; + UINT8 m_has_dictionary; + UINT8 m_dic_ctrl; + UINT8 m_dic_bank; + UINT8 m_has_cdrom; + UINT8 m_cdrom_reg[0x10]; + crtc_t m_crtc; + mouse_t m_mouse; + struct { UINT8 r, g, b; } m_palram[8]; + UINT8 m_dmac_ff; + UINT32 m_knj_addr[2]; + UINT32 m_extram_size; + UINT8 m_has_opna; + + DECLARE_READ8_MEMBER(pc8801_alu_r); + DECLARE_WRITE8_MEMBER(pc8801_alu_w); + DECLARE_READ8_MEMBER(pc8801_wram_r); + DECLARE_WRITE8_MEMBER(pc8801_wram_w); + DECLARE_READ8_MEMBER(pc8801_ext_wram_r); + DECLARE_WRITE8_MEMBER(pc8801_ext_wram_w); + DECLARE_READ8_MEMBER(pc8801_nbasic_rom_r); + DECLARE_READ8_MEMBER(pc8801_n88basic_rom_r); + DECLARE_READ8_MEMBER(pc8801_gvram_r); + DECLARE_WRITE8_MEMBER(pc8801_gvram_w); + DECLARE_READ8_MEMBER(pc8801_high_wram_r); + DECLARE_WRITE8_MEMBER(pc8801_high_wram_w); + DECLARE_READ8_MEMBER(pc8801ma_dic_r); + DECLARE_READ8_MEMBER(pc8801_cdbios_rom_r); + DECLARE_READ8_MEMBER(pc8801_mem_r); + DECLARE_WRITE8_MEMBER(pc8801_mem_w); + DECLARE_READ8_MEMBER(pc8801_ctrl_r); + DECLARE_WRITE8_MEMBER(pc8801_ctrl_w); + DECLARE_READ8_MEMBER(pc8801_ext_rom_bank_r); + DECLARE_WRITE8_MEMBER(pc8801_ext_rom_bank_w); + DECLARE_WRITE8_MEMBER(pc8801_gfx_ctrl_w); + DECLARE_READ8_MEMBER(pc8801_vram_select_r); + DECLARE_WRITE8_MEMBER(pc8801_vram_select_w); + DECLARE_WRITE8_MEMBER(i8214_irq_level_w); + DECLARE_WRITE8_MEMBER(i8214_irq_mask_w); + DECLARE_WRITE8_MEMBER(pc8801_irq_level_w); + DECLARE_WRITE8_MEMBER(pc8801_irq_mask_w); + DECLARE_READ8_MEMBER(pc8801_window_bank_r); + DECLARE_WRITE8_MEMBER(pc8801_window_bank_w); + DECLARE_WRITE8_MEMBER(pc8801_window_bank_inc_w); + DECLARE_READ8_MEMBER(pc8801_misc_ctrl_r); + DECLARE_WRITE8_MEMBER(pc8801_misc_ctrl_w); + DECLARE_WRITE8_MEMBER(pc8801_bgpal_w); + DECLARE_WRITE8_MEMBER(pc8801_palram_w); + DECLARE_WRITE8_MEMBER(pc8801_layer_masking_w); + DECLARE_READ8_MEMBER(pc8801_crtc_param_r); + DECLARE_WRITE8_MEMBER(pc88_crtc_param_w); + DECLARE_READ8_MEMBER(pc8801_crtc_status_r); + DECLARE_WRITE8_MEMBER(pc88_crtc_cmd_w); + DECLARE_READ8_MEMBER(pc8801_dmac_r); + DECLARE_WRITE8_MEMBER(pc8801_dmac_w); + DECLARE_READ8_MEMBER(pc8801_dmac_status_r); + DECLARE_WRITE8_MEMBER(pc8801_dmac_mode_w); + DECLARE_READ8_MEMBER(pc8801_extram_mode_r); + DECLARE_WRITE8_MEMBER(pc8801_extram_mode_w); + DECLARE_READ8_MEMBER(pc8801_extram_bank_r); + DECLARE_WRITE8_MEMBER(pc8801_extram_bank_w); + DECLARE_WRITE8_MEMBER(pc8801_alu_ctrl1_w); + DECLARE_WRITE8_MEMBER(pc8801_alu_ctrl2_w); + DECLARE_WRITE8_MEMBER(pc8801_pcg8100_w); + DECLARE_WRITE8_MEMBER(pc8801_txt_cmt_ctrl_w); + DECLARE_READ8_MEMBER(pc8801_kanji_r); + DECLARE_WRITE8_MEMBER(pc8801_kanji_w); + DECLARE_READ8_MEMBER(pc8801_kanji_lv2_r); + DECLARE_WRITE8_MEMBER(pc8801_kanji_lv2_w); + DECLARE_WRITE8_MEMBER(pc8801_dic_bank_w); + DECLARE_WRITE8_MEMBER(pc8801_dic_ctrl_w); + DECLARE_READ8_MEMBER(pc8801_cdrom_r); + DECLARE_WRITE8_MEMBER(pc8801_cdrom_w); + DECLARE_READ8_MEMBER(pc8801_cpuclock_r); + DECLARE_READ8_MEMBER(pc8801_baudrate_r); + DECLARE_WRITE8_MEMBER(pc8801_baudrate_w); + DECLARE_WRITE8_MEMBER(pc8801_rtc_w); + DECLARE_WRITE8_MEMBER(upd765_mc_w); + DECLARE_READ8_MEMBER(upd765_tc_r); + DECLARE_WRITE8_MEMBER(fdc_irq_vector_w); + DECLARE_WRITE8_MEMBER(fdc_drive_mode_w); + DECLARE_WRITE_LINE_MEMBER(txdata_callback); + DECLARE_WRITE_LINE_MEMBER(rxrdy_w); + DECLARE_READ8_MEMBER(pc8801_sound_board_r); + DECLARE_WRITE8_MEMBER(pc8801_sound_board_w); + DECLARE_READ8_MEMBER(pc8801_opna_r); + DECLARE_WRITE8_MEMBER(pc8801_opna_w); + DECLARE_READ8_MEMBER(pc8801_unk_r); + DECLARE_WRITE8_MEMBER(pc8801_unk_w); + + UINT8 pc8801_pixel_clock(void); + void pc8801_dynamic_res_change(void); + void draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect); + void draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect); + UINT8 calc_cursor_pos(int x,int y,int yi); + UINT8 extract_text_attribute(UINT32 address,int x, UINT8 width, UINT8 &non_special); + void pc8801_draw_char(bitmap_ind16 &bitmap,int x,int y,int pal,UINT8 gfx_mode,UINT8 reverse,UINT8 secret, + UINT8 blink,UINT8 upper,UINT8 lower,int y_size,int width, UINT8 non_special); + void draw_text(bitmap_ind16 &bitmap,int y_size, UINT8 width); + void fdc_irq_w(bool state); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_PALETTE_INIT(pc8801); +protected: + + virtual void video_start(); + virtual void machine_start(); + virtual void machine_reset(); +public: + DECLARE_MACHINE_RESET(pc8801_clock_speed); + DECLARE_MACHINE_RESET(pc8801_dic); + DECLARE_MACHINE_RESET(pc8801_cdrom); + INTERRUPT_GEN_MEMBER(pc8801_vrtc_irq); + TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero); + TIMER_DEVICE_CALLBACK_MEMBER(pc8801_rtc_irq); + DECLARE_READ8_MEMBER(cpu_8255_c_r); + DECLARE_WRITE8_MEMBER(cpu_8255_c_w); + DECLARE_READ8_MEMBER(fdc_8255_c_r); + DECLARE_WRITE8_MEMBER(fdc_8255_c_w); + DECLARE_WRITE_LINE_MEMBER(pic_int_w); + DECLARE_WRITE_LINE_MEMBER(pic_enlg_w); + DECLARE_READ8_MEMBER(opn_porta_r); + DECLARE_READ8_MEMBER(opn_portb_r); + IRQ_CALLBACK_MEMBER(pc8801_irq_callback); + void pc8801_raise_irq(UINT8 irq,UINT8 state); + DECLARE_WRITE_LINE_MEMBER(pc8801_sound_irq); +}; + + +/* +CRTC command params: +0. CRTC reset + +[0] *--- ---- +[0] -xxx xxxx screen columns (+2) + +[1] xx-- ---- blink speed (in frame unit) (+1, << 3) +[1] --xx xxxx screen lines (+1) + +[2] x--- ---- "skip line" +[2] -x-- ---- cursor style (reverse on / underscore off) +[2] --x- ---- cursor blink on/off +[2] ---x xxxx lines per character (+1) + +[3] xxx- ---- Vertical Retrace (+1) +[3] ---x xxxx Horizontal Retrace (+2) + +[4] x--- ---- attribute not separate flag +[4] -x-- ---- attribute color flag +[4] --x- ---- attribute not special flag (invalidates next register) +[4] ---x xxxx attribute size (+1) +*/ + +#define screen_width ((m_crtc.param[0][0] & 0x7f) + 2) * 8 + +#define blink_speed ((((m_crtc.param[0][1] & 0xc0) >> 6) + 1) << 3) +#define screen_height ((m_crtc.param[0][1] & 0x3f) + 1) + +#define lines_per_char ((m_crtc.param[0][2] & 0x1f) + 1) + +#define vretrace (((m_crtc.param[0][3] & 0xe0) >> 5) + 1) +#define hretrace ((m_crtc.param[0][3] & 0x1f) + 2) * 8 + +#define text_color_flag ((m_crtc.param[0][4] & 0xe0) == 0x40) +//#define monitor_24KHz ((m_gfx_ctrl & 0x19) == 0x08) /* TODO: this is most likely to be WRONG */ + +void pc8801_state::video_start() +{ +} + +void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) +{ + int x,y,xi; + UINT32 count; + UINT16 y_size; + UINT16 y_double; + + count = 0; + + y_double = (pc8801_pixel_clock()); + y_size = (y_double+1) * 200; + + for(y=0;y> (7-xi)) & 1) << 0; + pen |= ((m_gvram[count+0x4000] >> (7-xi)) & 1) << 1; + pen |= ((m_gvram[count+0x8000] >> (7-xi)) & 1) << 2; + + if(y_double) + { + if(cliprect.contains(x+xi, y+0)) + bitmap.pix16(y+0, x+xi) = m_palette->pen(pen & 7); + + if(cliprect.contains(x+xi, y+1)) + bitmap.pix16(y+1, x+xi) = m_palette->pen(pen & 7); + } + else + { + if(cliprect.contains(x+xi, y+0)) + bitmap.pix16(y, x+xi) = m_palette->pen(pen & 7); + } + } + + count++; + } + } +} + +void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) +{ + int x,y,xi; + UINT32 count; + UINT8 color; + UINT8 is_cursor; + + count = 0; + color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; + is_cursor = 0; + + for(y=0;y<200;y++) + { + for(x=0;x<640;x+=8) + { + if(!(m_gfx_ctrl & 1)) + is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); + + for(xi=0;xi<8;xi++) + { + int pen; + + pen = ((m_gvram[count+0x0000] >> (7-xi)) & 1); + if(is_cursor) + pen^=1; + + if((m_gfx_ctrl & 1)) + { + if(cliprect.contains(x+xi, y*2+0)) + bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen ? color : 0); + + if(cliprect.contains(x+xi, y*2+1)) + bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen ? color : 0); + } + else + { + if(cliprect.contains(x+xi, y)) + bitmap.pix16(y, x+xi) = m_palette->pen(pen ? color : 0); + } + } + + count++; + } + } + + if(!(m_gfx_ctrl & 1)) // 400 lines + { + count = 0; + + for(y=200;y<400;y++) + { + for(x=0;x<640;x+=8) + { + if(!(m_gfx_ctrl & 1)) + is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); + + for(xi=0;xi<8;xi++) + { + int pen; + + pen = ((m_gvram[count+0x4000] >> (7-xi)) & 1); + if(is_cursor) + pen^=1; + + if(cliprect.contains(x+xi, y)) + bitmap.pix16(y, x+xi) = m_palette->pen(pen ? 7 : 0); + } + + count++; + } + } + } +} + +UINT8 pc8801_state::calc_cursor_pos(int x,int y,int yi) +{ + if(!(m_crtc.cursor_on)) // don't bother if cursor is off + return 0; + + if(x == m_crtc.param[4][0] && y == m_crtc.param[4][1]) /* check if position matches */ + { + /* don't pass through if we are using underscore */ + if((!(m_crtc.param[0][2] & 0x40)) && yi != 7) + return 0; + + /* finally check if blinking is currently active high */ + if(!(m_crtc.param[0][2] & 0x20)) + return 1; + + if(((machine().first_screen()->frame_number() / blink_speed) & 1) == 0) + return 1; + + return 0; + } + + return 0; +} + + + +UINT8 pc8801_state::extract_text_attribute(UINT32 address,int x, UINT8 width, UINT8 &non_special) +{ + UINT8 *vram = m_work_ram; + int i; + int fifo_size; + int offset; + + non_special = 0; + if(m_crtc.param[0][4] & 0x80) + { + popmessage("Using non-separate mode for text tilemap, contact MESSdev"); + return 0; + } + + fifo_size = (m_crtc.param[0][4] & 0x20) ? 0 : ((m_crtc.param[0][4] & 0x1f) + 1); + + if(fifo_size == 0) + { + non_special = 1; + return (text_color_flag) ? 0xe8 : 0; + } + + /* TODO: correct or hack-ish? Certainly having 0 as a attribute X is weird in any case. */ + offset = (vram[address] == 0) ? 2 : 0; + + for(i=0;ivisible_area().contains(res_x, res_y)) + continue; + + if(gfx_mode) + { + UINT8 mask; + + mask = (xi & 4) ? 0x10 : 0x01; + mask <<= ((yi & (0x6 << y_double)) >> (1+y_double)); + color = (tile & mask) ? pal : -1; + } + else + { + UINT8 char_data; + UINT8 blink_mask; + + blink_mask = 0; + if(blink && ((machine().first_screen()->frame_number() / blink_speed) & 3) == 1) + blink_mask = 1; + + if(yi >= (1 << (y_double+3)) || secret || blink_mask) + char_data = 0; + else + char_data = (m_cg_rom[tile*8+(yi >> y_double)] >> (7-xi)) & 1; + + if(yi == 0 && upper) + char_data = 1; + + if(yi == y_height && lower) + char_data = 1; + + if(is_cursor) + char_data^=1; + + if(reverse) + char_data^=1; + + color = char_data ? pal : -1; + } + + if(color != -1) + { + bitmap.pix16(res_y, res_x) = m_palette->pen(color); + if(width) + { + if(!machine().first_screen()->visible_area().contains(res_x+1, res_y)) + continue; + + bitmap.pix16(res_y, res_x+1) = m_palette->pen(color); + } + } + } + } + } +} + +void pc8801_state::draw_text(bitmap_ind16 &bitmap,int y_size, UINT8 width) +{ + int x,y; + UINT8 attr; + UINT8 reverse; + UINT8 gfx_mode; + UINT8 secret; + UINT8 upper; + UINT8 lower; + UINT8 blink; + int pal; + UINT8 non_special; + + for(y=0;y> 5); + gfx_mode = (attr & 0x10) >> 4; + reverse = 0; + secret = 0; + upper = 0; + lower = 0; + blink = 0; + pal|=8; //text pal bank + } + else // monochrome + { + pal = 7; /* TODO: Bishoujo Baseball Gakuen Pasoket logo wants this to be black somehow ... */ + gfx_mode = (attr & 0x80) >> 7; + reverse = (attr & 4) >> 2; + secret = (attr & 1); + upper = (attr & 0x10) >> 4; + lower = (attr & 0x20) >> 5; + blink = (attr & 2) >> 1; + pal|=8; //text pal bank + reverse ^= m_crtc.inverse; + + if(attr & 0x80) + popmessage("Warning: mono gfx mode enabled, contact MESSdev"); + + } + + pc8801_draw_char(bitmap,x,y,pal,gfx_mode,reverse,secret,blink,upper,lower,y_size,!width,non_special); + } + } +} + +UINT32 pc8801_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(m_palette->pen(0), cliprect); + +// popmessage("%04x %04x %02x",m_dma_address[2],m_dma_counter[2],m_dmac_mode); + + if(m_gfx_ctrl & 8) + { + if(m_gfx_ctrl & 0x10) + draw_bitmap_3bpp(bitmap,cliprect); + else + draw_bitmap_1bpp(bitmap,cliprect); + } + + //popmessage("%02x %02x %02x %02x %02x",state->m_layer_mask,state->m_dmac_mode,state->m_crtc.status,state->m_crtc.irq_mask,state->m_gfx_ctrl); + + if(!(m_layer_mask & 1) && m_dmac_mode & 4 && m_crtc.status & 0x10 && m_crtc.irq_mask == 3) + { + //popmessage("%02x %02x",m_crtc.param[0][0],m_crtc.param[0][4]); + + draw_text(bitmap,screen_height,m_txt_width); + } + + return 0; +} + +READ8_MEMBER(pc8801_state::pc8801_alu_r) +{ + int i; + UINT8 b,r,g; + + /* store data to ALU regs */ + for(i=0;i<3;i++) + m_alu_reg[i] = m_gvram[i*0x4000 + offset]; + + b = m_gvram[offset + 0x0000]; + r = m_gvram[offset + 0x4000]; + g = m_gvram[offset + 0x8000]; + if(!(m_alu_ctrl2 & 1)) { b^=0xff; } + if(!(m_alu_ctrl2 & 2)) { r^=0xff; } + if(!(m_alu_ctrl2 & 4)) { g^=0xff; } + + return b & r & g; +} + +WRITE8_MEMBER(pc8801_state::pc8801_alu_w) +{ + int i; + + switch(m_alu_ctrl2 & 0x30) // alu write mode + { + case 0x00: //logic operation + { + UINT8 logic_op; + + for(i=0;i<3;i++) + { + logic_op = (m_alu_ctrl1 & (0x11 << i)) >> i; + + switch(logic_op) + { + case 0x00: { m_gvram[i*0x4000 + offset] &= ~data; } break; + case 0x01: { m_gvram[i*0x4000 + offset] |= data; } break; + case 0x10: { m_gvram[i*0x4000 + offset] ^= data; } break; + case 0x11: break; // NOP + } + } + } + break; + + case 0x10: // restore data from ALU regs + { + for(i=0;i<3;i++) + m_gvram[i*0x4000 + offset] = m_alu_reg[i]; + } + break; + + case 0x20: // swap ALU reg 1 into R GVRAM + m_gvram[0x0000 + offset] = m_alu_reg[1]; + break; + + case 0x30: // swap ALU reg 0 into B GVRAM + m_gvram[0x4000 + offset] = m_alu_reg[0]; + break; + } +} + + +READ8_MEMBER(pc8801_state::pc8801_wram_r) +{ + return m_work_ram[offset]; +} + +WRITE8_MEMBER(pc8801_state::pc8801_wram_w) +{ + m_work_ram[offset] = data; +} + +READ8_MEMBER(pc8801_state::pc8801_ext_wram_r) +{ + if(offset < m_extram_size) + return m_ext_work_ram[offset]; + + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_ext_wram_w) +{ + if(offset < m_extram_size) + m_ext_work_ram[offset] = data; +} + +READ8_MEMBER(pc8801_state::pc8801_nbasic_rom_r) +{ + return m_n80rom[offset]; +} + +READ8_MEMBER(pc8801_state::pc8801_n88basic_rom_r) +{ + return m_n88rom[offset]; +} + +READ8_MEMBER(pc8801_state::pc8801_gvram_r) +{ + return m_gvram[offset]; +} + +WRITE8_MEMBER(pc8801_state::pc8801_gvram_w) +{ + m_gvram[offset] = data; +} + +READ8_MEMBER(pc8801_state::pc8801_high_wram_r) +{ + return m_hi_work_ram[offset]; +} + +WRITE8_MEMBER(pc8801_state::pc8801_high_wram_w) +{ + m_hi_work_ram[offset] = data; +} + +READ8_MEMBER(pc8801_state::pc8801ma_dic_r) +{ + UINT8 *dic_rom = memregion("dictionary")->base(); + + return dic_rom[offset]; +} + +READ8_MEMBER(pc8801_state::pc8801_cdbios_rom_r) +{ + UINT8 *cdrom_bios = memregion("cdrom")->base(); + + return cdrom_bios[offset]; +} + +READ8_MEMBER(pc8801_state::pc8801_mem_r) +{ + if(offset <= 0x7fff) + { + if(m_extram_mode & 1) + return pc8801_ext_wram_r(space,offset | (m_extram_bank * 0x8000)); + + if(m_gfx_ctrl & 2) + return pc8801_wram_r(space,offset); + + if(m_has_cdrom && m_cdrom_reg[9] & 0x10) + return pc8801_cdbios_rom_r(space,(offset & 0x7fff) | ((m_gfx_ctrl & 4) ? 0x8000 : 0x0000)); + + if(m_gfx_ctrl & 4) + return pc8801_nbasic_rom_r(space,offset); + + if(offset >= 0x6000 && offset <= 0x7fff && ((m_ext_rom_bank & 1) == 0)) + return pc8801_n88basic_rom_r(space,0x8000 + (offset & 0x1fff) + (0x2000 * (m_misc_ctrl & 3))); + + return pc8801_n88basic_rom_r(space,offset); + } + else if(offset >= 0x8000 && offset <= 0x83ff) // work RAM window + { + UINT32 window_offset; + + if(m_gfx_ctrl & 6) //wram read select or n basic select banks this as normal wram + return pc8801_wram_r(space,offset); + + window_offset = (offset & 0x3ff) + (m_window_offset_bank << 8); + + if(((window_offset & 0xf000) == 0xf000) && (m_misc_ctrl & 0x10)) + printf("Read from 0xf000 - 0xffff window offset\n"); //accessed by Castle Excellent, no noticeable quirk + + if(((window_offset & 0xf000) == 0xf000) && (m_misc_ctrl & 0x10)) + return pc8801_high_wram_r(space,window_offset & 0xfff); + + return pc8801_wram_r(space,window_offset); + } + else if(offset >= 0x8400 && offset <= 0xbfff) + { + return pc8801_wram_r(space,offset); + } + else if(offset >= 0xc000 && offset <= 0xffff) + { + if(m_has_dictionary && m_dic_ctrl) + return pc8801ma_dic_r(space,(offset & 0x3fff) + ((m_dic_bank & 0x1f) * 0x4000)); + + if(m_misc_ctrl & 0x40) + { + if(!space.debugger_access()) + m_vram_sel = 3; + + if(m_alu_ctrl2 & 0x80) + return pc8801_alu_r(space,offset & 0x3fff); + } + + if(m_vram_sel == 3) + { + if(offset >= 0xf000 && offset <= 0xffff && (m_misc_ctrl & 0x10)) + return pc8801_high_wram_r(space,offset & 0xfff); + + return pc8801_wram_r(space,offset); + } + + return pc8801_gvram_r(space,(offset & 0x3fff) + (0x4000 * m_vram_sel)); + } + + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_mem_w) +{ + if(offset <= 0x7fff) + { + if(m_extram_mode & 0x10) + pc8801_ext_wram_w(space,offset | (m_extram_bank * 0x8000),data); + else + pc8801_wram_w(space,offset,data); + + return; + } + else if(offset >= 0x8000 && offset <= 0x83ff) + { + if(m_gfx_ctrl & 6) //wram read select or n basic select banks this as normal wram + pc8801_wram_w(space,offset,data); + else + { + UINT32 window_offset; + + window_offset = (offset & 0x3ff) + (m_window_offset_bank << 8); + + if(((window_offset & 0xf000) == 0xf000) && (m_misc_ctrl & 0x10)) + printf("Write to 0xf000 - 0xffff window offset\n"); //accessed by Castle Excellent, no noticeable quirk + + if(((window_offset & 0xf000) == 0xf000) && (m_misc_ctrl & 0x10)) + pc8801_high_wram_w(space,window_offset & 0xfff,data); + else + pc8801_wram_w(space,window_offset,data); + } + + return; + } + else if(offset >= 0x8400 && offset <= 0xbfff) + { + pc8801_wram_w(space,offset,data); + return; + } + else if(offset >= 0xc000 && offset <= 0xffff) + { + if(m_misc_ctrl & 0x40) + { + if(!space.debugger_access()) + m_vram_sel = 3; + + if(m_alu_ctrl2 & 0x80) + { + pc8801_alu_w(space,offset & 0x3fff,data); + return; + } + } + + if(m_vram_sel == 3) + { + if(offset >= 0xf000 && offset <= 0xffff && (m_misc_ctrl & 0x10)) + { + pc8801_high_wram_w(space,offset & 0xfff,data); + return; + } + + pc8801_wram_w(space,offset,data); + return; + } + + pc8801_gvram_w(space,(offset & 0x3fff) + (0x4000 * m_vram_sel),data); + return; + } +} + +static ADDRESS_MAP_START( pc8801_mem, AS_PROGRAM, 8, pc8801_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(pc8801_mem_r,pc8801_mem_w) +ADDRESS_MAP_END + +READ8_MEMBER(pc8801_state::pc8801_ctrl_r) +{ + /* + 11-- ---- + --x- ---- vrtc + ---x ---- calendar CDO + ---- x--- fdc auto-boot DIP-SW + ---- -x-- (RS-232C related) + ---- --x- monitor refresh rate DIP-SW + ---- ---x (pbsy?) + */ + return ioport("CTRL")->read(); +} + +WRITE8_MEMBER(pc8801_state::pc8801_ctrl_w) +{ + /* + x--- ---- SING (buzzer mask?) + -x-- ---- mouse latch (JOP1, routes on OPN sound port A) + --x- ---- beeper + ---x ---- ghs mode + ---- x--- crtc i/f sync mode + ---- -x-- upd1990a clock bit + ---- --x- upd1990a strobe bit + ---- ---x printer strobe + */ + + m_rtc->stb_w((data & 2) >> 1); + m_rtc->clk_w((data & 4) >> 2); + + if(((m_device_ctrl_data & 0x20) == 0x00) && ((data & 0x20) == 0x20)) + m_beeper->set_state(1); + + if(((m_device_ctrl_data & 0x20) == 0x20) && ((data & 0x20) == 0x00)) + m_beeper->set_state(0); + + if((m_device_ctrl_data & 0x40) != (data & 0x40)) + { + attotime new_time = machine().time(); + + if(m_mouse.phase == 0) + { + m_mouse.x = ioport("MOUSEX")->read(); + m_mouse.y = ioport("MOUSEY")->read(); + } + + if(data & 0x40 && (new_time - m_mouse.time) > attotime::from_hz(900)) + { + m_mouse.phase = 0; + } + else + { + m_mouse.phase++; + m_mouse.phase &= 3; + } + + m_mouse.time = machine().time(); + } + + /* TODO: is SING a buzzer mask? Bastard Special relies on this ... */ + if(m_device_ctrl_data & 0x80) + m_beeper->set_state(0); + + m_device_ctrl_data = data; +} + +READ8_MEMBER(pc8801_state::pc8801_ext_rom_bank_r) +{ + return m_ext_rom_bank; +} + +WRITE8_MEMBER(pc8801_state::pc8801_ext_rom_bank_w) +{ + m_ext_rom_bank = data; +} + +UINT8 pc8801_state::pc8801_pixel_clock(void) +{ + int ysize = machine().first_screen()->height(); /* TODO: correct condition*/ + + return (ysize >= 400); +} + +void pc8801_state::pc8801_dynamic_res_change(void) +{ + rectangle visarea; + int xsize,ysize,xvis,yvis; + attoseconds_t refresh;; + + /* bail out if screen params aren't valid */ + if(!m_crtc.param[0][0] || !m_crtc.param[0][1] || !m_crtc.param[0][2] || !m_crtc.param[0][3]) + return; + + xvis = screen_width; + yvis = screen_height * lines_per_char; + xsize = screen_width + hretrace; + ysize = screen_height * lines_per_char + vretrace * lines_per_char; + +// popmessage("H %d V %d (%d x %d) HR %d VR %d (%d %d)\n",xvis,yvis,screen_height,lines_per_char,hretrace,vretrace, xsize,ysize); + + visarea.set(0, xvis - 1, 0, yvis - 1); + if(pc8801_pixel_clock()) + refresh = HZ_TO_ATTOSECONDS(PIXEL_CLOCK_24KHz) * (xsize) * ysize; + else + refresh = HZ_TO_ATTOSECONDS(PIXEL_CLOCK_15KHz) * (xsize) * ysize; + + machine().first_screen()->configure(xsize, ysize, visarea, refresh); +} + +WRITE8_MEMBER(pc8801_state::pc8801_gfx_ctrl_w) +{ + /* + --x- ---- ??? + ---x ---- graphic color yes (1) / no (0) + ---- x--- graphic display yes (1) / no (0) + ---- -x-- Basic N (1) / N88 (0) + ---- --x- RAM select yes (1) / no (0) + ---- ---x VRAM 200 lines (1) / 400 lines (0) in 1bpp mode + */ + + m_gfx_ctrl = data; + + pc8801_dynamic_res_change(); +} + +READ8_MEMBER(pc8801_state::pc8801_vram_select_r) +{ + return 0xf8 | ((m_vram_sel == 3) ? 0 : (1 << m_vram_sel)); +} + +WRITE8_MEMBER(pc8801_state::pc8801_vram_select_w) +{ + m_vram_sel = offset & 3; +} + +#ifdef USE_PROPER_I8214 + +WRITE8_MEMBER(pc8801_state::i8214_irq_level_w) +{ + if(data & 8) + m_pic->b_w(7); + else + m_pic->b_w(data & 0x07); +} + +WRITE8_MEMBER(pc8801_state::i8214_irq_mask_w) +{ + m_timer_irq_mask = data & 1; + m_vblank_irq_mask = data & 2; +} + + +#else +WRITE8_MEMBER(pc8801_state::pc8801_irq_level_w) +{ + if(data & 8) + m_i8214_irq_level = 7; + else + m_i8214_irq_level = data & 7; + +// IRQ_LOG(("%02x LV\n",m_i8214_irq_level)); +} + + +WRITE8_MEMBER(pc8801_state::pc8801_irq_mask_w) +{ + m_timer_irq_mask = data & 1; + m_vrtc_irq_mask = data & 2; + + if(m_timer_irq_mask == 0) + m_timer_irq_latch = 0; + + if(m_vrtc_irq_mask == 0) + m_vrtc_irq_latch = 0; + + if(m_timer_irq_latch == 0 && m_vrtc_irq_latch == 0 && m_sound_irq_latch == 0) + m_maincpu->set_input_line(0,CLEAR_LINE); + +// IRQ_LOG(("%02x MASK (%02x %02x)\n",data,m_timer_irq_latch,m_vrtc_irq_latch)); + + //if(data & 4) + // printf("IRQ mask %02x\n",data); +} +#endif + +READ8_MEMBER(pc8801_state::pc8801_window_bank_r) +{ + return m_window_offset_bank; +} + +WRITE8_MEMBER(pc8801_state::pc8801_window_bank_w) +{ + m_window_offset_bank = data; +} + +WRITE8_MEMBER(pc8801_state::pc8801_window_bank_inc_w) +{ + m_window_offset_bank++; + m_window_offset_bank&=0xff; +} + +READ8_MEMBER(pc8801_state::pc8801_misc_ctrl_r) +{ + return m_misc_ctrl; +} + +WRITE8_MEMBER(pc8801_state::pc8801_misc_ctrl_w) +{ + /* + x--- ---- sound irq mask, active low + --x- ---- analog (1) / digital (0) palette select + */ + + m_misc_ctrl = data; + + #ifdef USE_PROPER_I8214 + m_sound_irq_mask = ((data & 0x80) == 0); + #else + m_sound_irq_mask = ((data & 0x80) == 0); + + if(m_sound_irq_mask == 0) + m_sound_irq_latch = 0; + + if(m_timer_irq_latch == 0 && m_vrtc_irq_latch == 0 && m_sound_irq_latch == 0) + m_maincpu->set_input_line(0,CLEAR_LINE); + + if(m_sound_irq_mask && m_sound_irq_pending) + { + m_maincpu->set_input_line(0,HOLD_LINE); + m_sound_irq_latch = 1; + m_sound_irq_pending = 0; + } + + #endif +} + +WRITE8_MEMBER(pc8801_state::pc8801_bgpal_w) +{ + if(data) + printf("BG Pal %02x\n",data); +} + +WRITE8_MEMBER(pc8801_state::pc8801_palram_w) +{ + if(m_misc_ctrl & 0x20) //analog palette + { + if((data & 0x40) == 0) + { + m_palram[offset].b = data & 0x7; + m_palram[offset].r = (data & 0x38) >> 3; + } + else + { + m_palram[offset].g = data & 0x7; + } + } + else //digital palette + { + m_palram[offset].b = data & 1 ? 7 : 0; + m_palram[offset].r = data & 2 ? 7 : 0; + m_palram[offset].g = data & 4 ? 7 : 0; + } + + m_palette->set_pen_color(offset, pal3bit(m_palram[offset].r), pal3bit(m_palram[offset].g), pal3bit(m_palram[offset].b)); +} + +WRITE8_MEMBER(pc8801_state::pc8801_layer_masking_w) +{ + /* + ---- x--- green gvram masked flag + ---- -x-- red gvram masked flag + ---- --x- blue gvram masked flag + ---- ---x text vram masked + */ + + m_layer_mask = data; +} + +READ8_MEMBER(pc8801_state::pc8801_crtc_param_r) +{ + printf("CRTC param reading\n"); + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc88_crtc_param_w) +{ + if(m_crtc.param_count < 5) + { + m_crtc.param[m_crtc.cmd][m_crtc.param_count] = data; + if(m_crtc.cmd == 0) + pc8801_dynamic_res_change(); + + m_crtc.param_count++; + } +} + +READ8_MEMBER(pc8801_state::pc8801_crtc_status_r) +{ + /* + ---x ---- video enable + ---- x--- DMA is running + ---- -x-- special control character IRQ + ---- --x- indication end IRQ + ---- ---x light pen input + */ + + return m_crtc.status; +} + +#if 0 +static const char *const crtc_command[] = +{ + "Reset / Stop Display", // 0 + "Start Display", // 1 + "Set IRQ MASK", // 2 + "Read Light Pen", // 3 + "Load Cursor Position", // 4 + "Reset IRQ", // 5 + "Reset Counters", // 6 + "Read Status" // 7 +}; +#endif + +WRITE8_MEMBER(pc8801_state::pc88_crtc_cmd_w) +{ + m_crtc.cmd = (data & 0xe0) >> 5; + m_crtc.param_count = 0; + + switch(m_crtc.cmd) + { + case 0: // reset CRTC + m_crtc.status &= (~0x16); + break; + case 1: // start display + m_crtc.status |= 0x10; + m_crtc.status &= (~0x08); + m_crtc.inverse = data & 1; + + if(data & 1) /* Ink Pot uses it, but I want another test case before removing this log */ + printf("CRTC inverse mode ON\n"); + break; + case 2: // set irq mask + m_crtc.irq_mask = data & 3; + break; + case 3: // read light pen + m_crtc.status &= (~0x01); + break; + case 4: // load cursor position ON/OFF + m_crtc.cursor_on = data & 1; + break; + case 5: // reset IRQ + case 6: // reset counters + m_crtc.status &= (~0x06); + break; + } + + //if((data >> 5) != 4) + // printf("CRTC cmd %s polled %02x\n",crtc_command[data >> 5],data & 0x1f); +} + +READ8_MEMBER(pc8801_state::pc8801_dmac_r) +{ + printf("DMAC R %08x\n",offset); + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_dmac_w) +{ + if(offset & 1) + m_dma_counter[offset >> 1] = (m_dmac_ff) ? (m_dma_counter[offset >> 1]&0xff)|(data<<8) : (m_dma_counter[offset >> 1]&0xff00)|(data&0xff); + else + m_dma_address[offset >> 1] = (m_dmac_ff) ? (m_dma_address[offset >> 1]&0xff)|(data<<8) : (m_dma_address[offset >> 1]&0xff00)|(data&0xff); + + m_dmac_ff ^= 1; +} + +READ8_MEMBER(pc8801_state::pc8801_dmac_status_r) +{ + printf("DMAC R STATUS\n"); + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_dmac_mode_w) +{ + m_dmac_mode = data; + m_dmac_ff = 0; + + if(data != 0xe4 && data != 0xa0 && data != 0xc4 && data != 0x80 && data != 0x00) + printf("%02x DMAC mode\n",data); +} + +READ8_MEMBER(pc8801_state::pc8801_extram_mode_r) +{ + return (m_extram_mode ^ 0x11) | 0xee; +} + +WRITE8_MEMBER(pc8801_state::pc8801_extram_mode_w) +{ + /* + ---x ---- Write EXT RAM access at 0x0000 - 0x7fff + ---- ---x Read EXT RAM access at 0x0000 - 0x7fff + */ + + m_extram_mode = data & 0x11; +} + +READ8_MEMBER(pc8801_state::pc8801_extram_bank_r) +{ + return m_extram_bank; +} + +WRITE8_MEMBER(pc8801_state::pc8801_extram_bank_w) +{ + m_extram_bank = data; +} + +WRITE8_MEMBER(pc8801_state::pc8801_alu_ctrl1_w) +{ + m_alu_ctrl1 = data; +} + +WRITE8_MEMBER(pc8801_state::pc8801_alu_ctrl2_w) +{ + m_alu_ctrl2 = data; +} + +WRITE8_MEMBER(pc8801_state::pc8801_pcg8100_w) +{ + if(data) + printf("Write to PCG-8100 %02x %02x\n",offset,data); +} + +WRITE8_MEMBER(pc8801_state::pc8801_txt_cmt_ctrl_w) +{ + /* bits 2 to 5 are cmt related */ + + m_txt_width = data & 1; + m_txt_color = data & 2; + + m_cassette->change_state(BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + + +READ8_MEMBER(pc8801_state::pc8801_kanji_r) +{ + if((offset & 2) == 0) + return m_kanji_rom[m_knj_addr[0]*2+((offset & 1) ^ 1)]; + + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_kanji_w) +{ + if((offset & 2) == 0) + m_knj_addr[0] = ((offset & 1) == 0) ? ((m_knj_addr[0]&0xff00)|(data&0xff)) : ((m_knj_addr[0]&0x00ff)|(data<<8)); +} + +READ8_MEMBER(pc8801_state::pc8801_kanji_lv2_r) +{ + if((offset & 2) == 0) + return m_kanji_rom[m_knj_addr[1]*2+((offset & 1) ^ 1)]; + + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_kanji_lv2_w) +{ + if((offset & 2) == 0) + m_knj_addr[1] = ((offset & 1) == 0) ? ((m_knj_addr[1]&0xff00)|(data&0xff)) : ((m_knj_addr[1]&0x00ff)|(data<<8)); +} + +WRITE8_MEMBER(pc8801_state::pc8801_dic_bank_w) +{ + printf("JISHO BANK = %02x\n",data); + if(m_has_dictionary) + m_dic_bank = data & 0x1f; +} + +WRITE8_MEMBER(pc8801_state::pc8801_dic_ctrl_w) +{ + printf("JISHO CTRL = %02x\n",data); + if(m_has_dictionary) + m_dic_ctrl = (data ^ 1) & 1; +} + +READ8_MEMBER(pc8801_state::pc8801_cdrom_r) +{ + //printf("CD-ROM read [%02x]\n",offset); + + //if(m_has_cdrom) + // return m_cdrom_reg[offset]; + + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_cdrom_w) +{ + /* + [9] ---x ---- CD-ROM BIOS bank + ---- ---x CD-ROM E-ROM bank (?) + */ + //printf("CD-ROM write %02x -> [%02x]\n",data,offset); + + if(m_has_cdrom) + m_cdrom_reg[offset] = data; +} + +READ8_MEMBER(pc8801_state::pc8801_cpuclock_r) +{ + if(m_has_clock_speed) + return 0x10 | m_clock_setting; + + return 0xff; +} + +READ8_MEMBER(pc8801_state::pc8801_baudrate_r) +{ + if(m_has_clock_speed) + return 0xf0 | m_baudrate_val; + + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_baudrate_w) +{ + if(m_has_clock_speed) + m_baudrate_val = data & 0xf; +} + +WRITE8_MEMBER(pc8801_state::pc8801_rtc_w) +{ + m_rtc->c0_w((data & 1) >> 0); + m_rtc->c1_w((data & 2) >> 1); + m_rtc->c2_w((data & 4) >> 2); + m_rtc->data_in_w((data & 8) >> 3); + + /* TODO: remaining bits */ +} + +READ8_MEMBER(pc8801_state::pc8801_sound_board_r) +{ + if(m_has_opna) + return m_opna->read(space, offset); + + return (offset & 2) ? 0xff : m_opn->read(space, offset); +} + +WRITE8_MEMBER(pc8801_state::pc8801_sound_board_w) +{ + if(m_has_opna) + m_opna->write(space, offset,data); + else if((offset & 2) == 0) + m_opn->write(space, offset, data); +} + +READ8_MEMBER(pc8801_state::pc8801_opna_r) +{ + if(m_has_opna && (offset & 2) == 0) + return m_opna->read(space, (offset & 1) | ((offset & 4) >> 1)); + + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_opna_w) +{ + if(m_has_opna && (offset & 2) == 0) + m_opna->write(space, (offset & 1) | ((offset & 4) >> 1),data); + else if(m_has_opna && offset == 2) + { + m_sound_irq_mask = ((data & 0x80) == 0); + + if(m_sound_irq_mask == 0) + m_sound_irq_latch = 0; + + if(m_timer_irq_latch == 0 && m_vrtc_irq_latch == 0 && m_sound_irq_latch == 0) + m_maincpu->set_input_line(0,CLEAR_LINE); + + if(m_sound_irq_mask && m_sound_irq_pending) + { + m_maincpu->set_input_line(0,HOLD_LINE); + m_sound_irq_latch = 1; + m_sound_irq_pending = 0; + } + } +} + +READ8_MEMBER(pc8801_state::pc8801_unk_r) +{ + printf("Read port 0x33\n"); + return 0xff; +} + +WRITE8_MEMBER(pc8801_state::pc8801_unk_w) +{ + printf("Write port 0x33\n"); +} + +static ADDRESS_MAP_START( pc8801_io, AS_IO, 8, pc8801_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_READ_PORT("KEY0") + AM_RANGE(0x01, 0x01) AM_READ_PORT("KEY1") + AM_RANGE(0x02, 0x02) AM_READ_PORT("KEY2") + AM_RANGE(0x03, 0x03) AM_READ_PORT("KEY3") + AM_RANGE(0x04, 0x04) AM_READ_PORT("KEY4") + AM_RANGE(0x05, 0x05) AM_READ_PORT("KEY5") + AM_RANGE(0x06, 0x06) AM_READ_PORT("KEY6") + AM_RANGE(0x07, 0x07) AM_READ_PORT("KEY7") + AM_RANGE(0x08, 0x08) AM_READ_PORT("KEY8") + AM_RANGE(0x09, 0x09) AM_READ_PORT("KEY9") + AM_RANGE(0x0a, 0x0a) AM_READ_PORT("KEY10") + AM_RANGE(0x0b, 0x0b) AM_READ_PORT("KEY11") + AM_RANGE(0x0c, 0x0c) AM_READ_PORT("KEY12") + AM_RANGE(0x0d, 0x0d) AM_READ_PORT("KEY13") + AM_RANGE(0x0e, 0x0e) AM_READ_PORT("KEY14") + AM_RANGE(0x0f, 0x0f) AM_READ_PORT("KEY15") + AM_RANGE(0x00, 0x02) AM_WRITE(pc8801_pcg8100_w) + AM_RANGE(0x10, 0x10) AM_WRITE(pc8801_rtc_w) + AM_RANGE(0x20, 0x20) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) /* RS-232C and CMT */ + AM_RANGE(0x21, 0x21) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x30, 0x30) AM_READ_PORT("DSW1") AM_WRITE(pc8801_txt_cmt_ctrl_w) + AM_RANGE(0x31, 0x31) AM_READ_PORT("DSW2") AM_WRITE(pc8801_gfx_ctrl_w) + AM_RANGE(0x32, 0x32) AM_READWRITE(pc8801_misc_ctrl_r, pc8801_misc_ctrl_w) + AM_RANGE(0x33, 0x33) AM_READWRITE(pc8801_unk_r,pc8801_unk_w) + AM_RANGE(0x34, 0x34) AM_WRITE(pc8801_alu_ctrl1_w) + AM_RANGE(0x35, 0x35) AM_WRITE(pc8801_alu_ctrl2_w) + AM_RANGE(0x40, 0x40) AM_READWRITE(pc8801_ctrl_r, pc8801_ctrl_w) + AM_RANGE(0x44, 0x47) AM_READWRITE(pc8801_sound_board_r,pc8801_sound_board_w) /* OPN / OPNA ports */ + AM_RANGE(0x50, 0x50) AM_READWRITE(pc8801_crtc_param_r, pc88_crtc_param_w) + AM_RANGE(0x51, 0x51) AM_READWRITE(pc8801_crtc_status_r, pc88_crtc_cmd_w) + AM_RANGE(0x52, 0x52) AM_WRITE(pc8801_bgpal_w) + AM_RANGE(0x53, 0x53) AM_WRITE(pc8801_layer_masking_w) + AM_RANGE(0x54, 0x5b) AM_WRITE(pc8801_palram_w) + AM_RANGE(0x5c, 0x5c) AM_READ(pc8801_vram_select_r) + AM_RANGE(0x5c, 0x5f) AM_WRITE(pc8801_vram_select_w) + AM_RANGE(0x60, 0x67) AM_READWRITE(pc8801_dmac_r,pc8801_dmac_w) + AM_RANGE(0x68, 0x68) AM_READWRITE(pc8801_dmac_status_r,pc8801_dmac_mode_w) + AM_RANGE(0x6e, 0x6e) AM_READ(pc8801_cpuclock_r) + AM_RANGE(0x6f, 0x6f) AM_READWRITE(pc8801_baudrate_r,pc8801_baudrate_w) + AM_RANGE(0x70, 0x70) AM_READWRITE(pc8801_window_bank_r, pc8801_window_bank_w) + AM_RANGE(0x71, 0x71) AM_READWRITE(pc8801_ext_rom_bank_r, pc8801_ext_rom_bank_w) + AM_RANGE(0x78, 0x78) AM_WRITE(pc8801_window_bank_inc_w) + AM_RANGE(0x90, 0x9f) AM_READWRITE(pc8801_cdrom_r,pc8801_cdrom_w) +// AM_RANGE(0xa0, 0xa3) AM_NOP /* music & network */ + AM_RANGE(0xa8, 0xad) AM_READWRITE(pc8801_opna_r,pc8801_opna_w) /* second sound board */ +// AM_RANGE(0xb4, 0xb5) AM_NOP /* Video art board */ +// AM_RANGE(0xc1, 0xc1) AM_NOP /* (unknown) */ +// AM_RANGE(0xc2, 0xcf) AM_NOP /* music */ +// AM_RANGE(0xd0, 0xd7) AM_NOP /* music & GP-IB */ +// AM_RANGE(0xd8, 0xd8) AM_NOP /* GP-IB */ +// AM_RANGE(0xdc, 0xdf) AM_NOP /* MODEM */ + AM_RANGE(0xe2, 0xe2) AM_READWRITE(pc8801_extram_mode_r,pc8801_extram_mode_w) /* expand RAM mode */ + AM_RANGE(0xe3, 0xe3) AM_READWRITE(pc8801_extram_bank_r,pc8801_extram_bank_w) /* expand RAM bank */ +#ifdef USE_PROPER_I8214 + AM_RANGE(0xe4, 0xe4) AM_WRITE(i8214_irq_level_w) + AM_RANGE(0xe6, 0xe6) AM_WRITE(i8214_irq_mask_w) +#else + AM_RANGE(0xe4, 0xe4) AM_WRITE(pc8801_irq_level_w) + AM_RANGE(0xe6, 0xe6) AM_WRITE(pc8801_irq_mask_w) +#endif +// AM_RANGE(0xe7, 0xe7) AM_NOP /* Arcus writes here, almost likely to be a mirror of above */ + AM_RANGE(0xe8, 0xeb) AM_READWRITE(pc8801_kanji_r, pc8801_kanji_w) + AM_RANGE(0xec, 0xef) AM_READWRITE(pc8801_kanji_lv2_r, pc8801_kanji_lv2_w) + AM_RANGE(0xf0, 0xf0) AM_WRITE(pc8801_dic_bank_w) + AM_RANGE(0xf1, 0xf1) AM_WRITE(pc8801_dic_ctrl_w) +// AM_RANGE(0xf3, 0xf3) AM_NOP /* DMA floppy (unknown) */ +// AM_RANGE(0xf4, 0xf7) AM_NOP /* DMA 5'floppy (may be not released) */ +// AM_RANGE(0xf8, 0xfb) AM_NOP /* DMA 8'floppy (unknown) */ + AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("d8255_master", i8255_device, read, write) +ADDRESS_MAP_END + +READ8_MEMBER(pc8801_state::cpu_8255_c_r) +{ +// machine().scheduler().synchronize(); // force resync + + return m_i8255_1_pc >> 4; +} + +WRITE8_MEMBER(pc8801_state::cpu_8255_c_w) +{ +// machine().scheduler().synchronize(); // force resync + + m_i8255_0_pc = data; +} + + +READ8_MEMBER(pc8801_state::fdc_8255_c_r) +{ +// machine().scheduler().synchronize(); // force resync + + return m_i8255_0_pc >> 4; +} + +WRITE8_MEMBER(pc8801_state::fdc_8255_c_w) +{ +// machine().scheduler().synchronize(); // force resync + + m_i8255_1_pc = data; +} + +static ADDRESS_MAP_START( pc8801fdc_mem, AS_PROGRAM, 8, pc8801_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x4000, 0x7fff) AM_RAM +ADDRESS_MAP_END + +TIMER_CALLBACK_MEMBER(pc8801_state::pc8801fd_upd765_tc_to_zero) +{ + //printf("0\n"); + machine().device("upd765")->tc_w(false); +} + +WRITE8_MEMBER(pc8801_state::upd765_mc_w) +{ + machine().device("upd765:0")->get_device()->mon_w(!(data & 1)); + machine().device("upd765:1")->get_device()->mon_w(!(data & 2)); +} + +READ8_MEMBER(pc8801_state::upd765_tc_r) +{ + //printf("%04x 1\n",m_fdccpu->pc()); + + machine().device("upd765")->tc_w(true); + //TODO: I'm not convinced that this works correctly with current hook-up ... 1000 usec is needed by Aploon, a bigger value breaks Alpha. + //OTOH, 50 seems more than enough for the new upd... + machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(pc8801_state::pc8801fd_upd765_tc_to_zero),this)); + return 0xff; // value is meaningless +} + +WRITE8_MEMBER(pc8801_state::fdc_irq_vector_w) +{ + popmessage("Write to FDC IRQ vector I/O %02x, contact MESSdev\n",data); + m_fdc_irq_opcode = data; +} + +WRITE8_MEMBER(pc8801_state::fdc_drive_mode_w) +{ + logerror("FDC drive mode %02x\n", data); + machine().device("upd765:0")->get_device()->set_rpm(data & 0x01 ? 360 : 300); + machine().device("upd765:1")->get_device()->set_rpm(data & 0x02 ? 360 : 300); + + machine().device("upd765")->set_rate(data & 0x20 ? 500000 : 250000); +} + +static ADDRESS_MAP_START( pc8801fdc_io, AS_IO, 8, pc8801_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf0, 0xf0) AM_WRITE(fdc_irq_vector_w) // Interrupt Opcode Port + AM_RANGE(0xf4, 0xf4) AM_WRITE(fdc_drive_mode_w) // Drive mode, 2d, 2dd, 2hd + AM_RANGE(0xf7, 0xf7) AM_WRITENOP // printer port output + AM_RANGE(0xf8, 0xf8) AM_READWRITE(upd765_tc_r,upd765_mc_w) // (R) Terminal Count Port (W) Motor Control Port + AM_RANGE(0xfa, 0xfb) AM_DEVICE("upd765", upd765a_device, map ) + AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("d8255_slave", i8255_device, read, write) +ADDRESS_MAP_END + +/* Input Ports */ + +/* 2008-05 FP: +Small note about the strange default mapping of function keys: +the top line of keys in PC8801 keyboard is as follows +[STOP][COPY] [F1][F2][F3][F4][F5] [ROLL UP][ROLL DOWN] +Therefore, in Full Emulation mode, "F1" goes to 'F3' and so on + +Also, the Keypad has 16 keys, making impossible to map it in a satisfactory +way to a PC keypad. Therefore, default settings for these keys in Full +Emulation are currently based on the effect of the key rather than on +their real position + +About natural keyboards: currently, +- "Keypad =" and "Keypad ," are not mapped +- "Stop" is mapped to 'Pause' +- "Copy" is mapped to 'Print Screen' +- "Kana" is mapped to 'F6' +- "Grph" is mapped to 'F7' +- "Roll Up" and "Roll Down" are mapped to 'Page Up' and 'Page Down' +- "Help" is mapped to 'F8' + */ + +static INPUT_PORTS_START( pc8001 ) + PORT_START("KEY0") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_START("KEY1") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_PGUP) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_PGDN) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + + PORT_START("KEY2") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("KEY3") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("KEY4") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + + PORT_START("KEY5") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA5') PORT_CHAR('|') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + + PORT_START("KEY6") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("KEY7") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" _") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0) PORT_CHAR('_') + + PORT_START("KEY8") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Kana") PORT_CODE(KEYCODE_LCONTROL) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("KEY9") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("KEY10") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + + PORT_START("KEY11") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY12") /* port 0x0c */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY13") /* port 0x0d */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY14") /* port 0x0e */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY15") /* port 0x0f */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x00, "BASIC" ) + PORT_DIPSETTING( 0x01, "N88-BASIC" ) + PORT_DIPSETTING( 0x00, "N-BASIC" ) + PORT_DIPNAME( 0x02, 0x02, "Terminal mode" ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, "Text width" ) + PORT_DIPSETTING( 0x04, "40 chars/line" ) + PORT_DIPSETTING( 0x00, "80 chars/line" ) + PORT_DIPNAME( 0x08, 0x00, "Text height" ) + PORT_DIPSETTING( 0x08, "20 lines/screen" ) + PORT_DIPSETTING( 0x00, "25 lines/screen" ) + PORT_DIPNAME( 0x10, 0x10, "Enable S parameter" ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, "Enable DEL code" ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "Memory wait" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Disable CMD SING" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, "Parity generate" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, "Parity type" ) + PORT_DIPSETTING( 0x00, "Even" ) + PORT_DIPSETTING( 0x02, "Odd" ) + PORT_DIPNAME( 0x04, 0x00, "Serial character length" ) + PORT_DIPSETTING( 0x04, "7 bits/char" ) + PORT_DIPSETTING( 0x00, "8 bits/char" ) + PORT_DIPNAME( 0x08, 0x08, "Stop bit length" ) + PORT_DIPSETTING( 0x08, "1" ) + PORT_DIPSETTING( 0x00, "2" ) + PORT_DIPNAME( 0x10, 0x10, "Enable X parameter" ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "Duplex" ) + PORT_DIPSETTING( 0x20, "Half" ) + PORT_DIPSETTING( 0x00, "Full" ) + PORT_DIPNAME( 0xc0, 0x40, "Basic mode" ) + PORT_DIPSETTING( 0x80, "N88-BASIC (V1L)" ) + PORT_DIPSETTING( 0xc0, "N88-BASIC (V1H)" ) + PORT_DIPSETTING( 0x40, "N88-BASIC (V2)" ) +// PORT_DIPSETTING( 0x00, "N88-BASIC (V2)" ) + + PORT_START("CTRL") + PORT_DIPNAME( 0x02, 0x02, "Monitor Type" ) + PORT_DIPSETTING( 0x02, "15 KHz" ) + PORT_DIPSETTING( 0x00, "24 KHz" ) + PORT_DIPNAME( 0x08, 0x00, "Auto-boot floppy at start-up" ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_device, data_out_r) + PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_CUSTOM ) PORT_VBLANK("screen") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("CFG") /* EXSWITCH */ + #if 0 // reference only, afaik there isn't a thing like this ... + PORT_DIPNAME( 0x0f, 0x08, "Serial speed" ) + PORT_DIPSETTING( 0x01, "75bps" ) + PORT_DIPSETTING( 0x02, "150bps" ) + PORT_DIPSETTING( 0x03, "300bps" ) + PORT_DIPSETTING( 0x04, "600bps" ) + PORT_DIPSETTING( 0x05, "1200bps" ) + PORT_DIPSETTING( 0x06, "2400bps" ) + PORT_DIPSETTING( 0x07, "4800bps" ) + PORT_DIPSETTING( 0x08, "9600bps" ) + PORT_DIPSETTING( 0x09, "19200bps" ) + #endif + PORT_DIPNAME( 0x40, 0x40, "Speed mode" ) + PORT_DIPSETTING( 0x00, "Slow" ) + PORT_DIPSETTING( 0x40, DEF_STR( High ) ) + PORT_DIPNAME( 0x80, 0x80, "Main CPU clock" ) + PORT_DIPSETTING( 0x80, "4MHz" ) + PORT_DIPSETTING( 0x00, "8MHz" ) + + PORT_START("OPN_PA") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPN_PB") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Mouse Button 1") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Mouse Button 2") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02) + PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("MOUSEX") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_RESET PORT_REVERSE PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02) + + PORT_START("MOUSEY") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_RESET PORT_REVERSE PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02) + + PORT_START("MEM") + PORT_CONFNAME( 0x0f, 0x0a, "Extension memory" ) + PORT_CONFSETTING( 0x00, DEF_STR( None ) ) + PORT_CONFSETTING( 0x01, "32KB (PC-8012-02 x 1)" ) + PORT_CONFSETTING( 0x02, "64KB (PC-8012-02 x 2)" ) + PORT_CONFSETTING( 0x03, "128KB (PC-8012-02 x 4)" ) + PORT_CONFSETTING( 0x04, "128KB (PC-8801-02N x 1)" ) + PORT_CONFSETTING( 0x05, "256KB (PC-8801-02N x 2)" ) + PORT_CONFSETTING( 0x06, "512KB (PC-8801-02N x 4)" ) + PORT_CONFSETTING( 0x07, "1M (PIO-8234H-1M x 1)" ) + PORT_CONFSETTING( 0x08, "2M (PIO-8234H-2M x 1)" ) + PORT_CONFSETTING( 0x09, "4M (PIO-8234H-2M x 2)" ) + PORT_CONFSETTING( 0x0a, "8M (PIO-8234H-2M x 4)" ) + PORT_CONFSETTING( 0x0b, "1.1M (PIO-8234H-1M x 1 + PC-8801-02N x 1)" ) + PORT_CONFSETTING( 0x0c, "2.1M (PIO-8234H-2M x 1 + PC-8801-02N x 1)" ) + PORT_CONFSETTING( 0x0d, "4.1M (PIO-8234H-2M x 2 + PC-8801-02N x 1)" ) + + PORT_START("BOARD_CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Sound Board" ) /* TODO: is it possible to have BOTH sound chips in there? */ + PORT_CONFSETTING( 0x00, "OPN (YM2203)" ) + PORT_CONFSETTING( 0x01, "OPNA (YM2608)" ) + PORT_CONFNAME( 0x02, 0x00, "Port 1 Connection" ) + PORT_CONFSETTING( 0x00, "Joystick" ) + PORT_CONFSETTING( 0x02, "Mouse" ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc88sr ) + PORT_INCLUDE( pc8001 ) + + PORT_MODIFY("DSW1") + PORT_DIPNAME( 0x01, 0x01, "BASIC" ) + PORT_DIPSETTING( 0x01, "N88-BASIC" ) + PORT_DIPSETTING( 0x00, "N-BASIC" ) +INPUT_PORTS_END + +/* Graphics Layouts */ + +static const gfx_layout char_layout = +{ + 8, 8, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP8(0,1) }, + { STEP8(0,8) }, + 8*8 +}; + +static const gfx_layout kanji_layout = +{ + 16, 16, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP16(0,1) }, + { STEP16(0,16) }, + 16*16 +}; + +/* debugging only */ +static GFXDECODE_START( pc8801 ) + GFXDECODE_ENTRY( "cgrom", 0, char_layout, 0, 8 ) + GFXDECODE_ENTRY( "kanji", 0, kanji_layout, 0, 8 ) +GFXDECODE_END + +/* Floppy Configuration */ + +static SLOT_INTERFACE_START( pc88_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +#if 0 +/* Cassette Configuration */ + +static const cassette_interface pc88_cassette_interface = +{ + cassette_default_formats, // we need T88 format support! + NULL, + (cassette_state)(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED), + "pc8801_cass" +}; +#endif + +#ifdef USE_PROPER_I8214 +void pc8801_state::pc8801_raise_irq(UINT8 irq,UINT8 state) +{ + if(state) + { + drvm_int_state |= irq; + + drvm_pic->r_w(~irq); + + m_maincpu->set_input_line(0,ASSERT_LINE); + } + else + { + //drvm_int_state &= ~irq; + + //m_maincpu->set_input_line(0,CLEAR_LINE); + } +} + +WRITE_LINE_MEMBER(pc8801_state::pic_int_w) +{ + device_t *device = m_maincpu; +// if (state == ASSERT_LINE) +// { +// } +} + +WRITE_LINE_MEMBER(pc8801_state::pic_enlg_w) +{ + device_t *device = m_maincpu; + //if (state == CLEAR_LINE) + //{ + //} +} + +static I8214_INTERFACE( pic_intf ) +{ + DEVCB_DRIVER_LINE_MEMBER(pc8801_state,pic_int_w), + DEVCB_DRIVER_LINE_MEMBER(pc8801_state,pic_enlg_w) +}; + +IRQ_CALLBACK_MEMBER(pc8801_state::pc8801_irq_callback) +{ + UINT8 vector = (7 - m_pic->a_r()); + + m_int_state &= ~(1<set_input_line(0,CLEAR_LINE); + + return vector << 1; +} + +WRITE_LINE_MEMBER(pc8801_state::pc8801_sound_irq) +{ + if(m_sound_irq_mask && state) + pc8801_raise_irq(machine(),1<<(4),1); +} + +/* +TIMER_DEVICE_CALLBACK_MEMBER(pc8801_state::pc8801_rtc_irq) +{ + if(m_timer_irq_mask) + pc8801_raise_irq(machine(),1<<(2),1); +} +*/ + +INTERRUPT_GEN_MEMBER(pc8801_state::pc8801_vrtc_irq) +{ + if(m_vblank_irq_mask) + pc8801_raise_irq(machine(),1<<(1),1); +} + +#else + +#include "debugger.h" + +IRQ_CALLBACK_MEMBER(pc8801_state::pc8801_irq_callback) +{ + if(m_sound_irq_latch) + { + m_sound_irq_latch = 0; + return 4*2; + } + else if(m_vrtc_irq_latch) + { + m_vrtc_irq_latch = 0; + return 1*2; + } + else if(m_timer_irq_latch) + { + m_timer_irq_latch = 0; + return 2*2; + } + + printf("IRQ triggered but no vector on the bus! %02x %02x %02x %02x\n",m_i8214_irq_level,m_sound_irq_latch,m_vrtc_irq_latch,m_timer_irq_latch); + debugger_break(machine()); + + return 4*2; //TODO: mustn't happen +} + +WRITE_LINE_MEMBER(pc8801_state::pc8801_sound_irq) +{ +// printf("%02x %02x %02x\n",m_sound_irq_mask,m_i8214_irq_level,state); + /* TODO: correct i8214 irq level? */ + if(state) + { + if(m_sound_irq_mask) + { + m_sound_irq_latch = 1; + m_sound_irq_pending = 0; + //IRQ_LOG(("sound\n")); + m_maincpu->set_input_line(0,HOLD_LINE); + } + else + m_sound_irq_pending = 1; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(pc8801_state::pc8801_rtc_irq) +{ + if(m_timer_irq_mask && m_i8214_irq_level >= 3) + { + m_timer_irq_latch = 1; + //IRQ_LOG(("timer\n")); + m_maincpu->set_input_line(0,HOLD_LINE); + } +} + +INTERRUPT_GEN_MEMBER(pc8801_state::pc8801_vrtc_irq) +{ + if(m_vrtc_irq_mask && m_i8214_irq_level >= 2) + { + m_vrtc_irq_latch = 1; + //IRQ_LOG(("vrtc\n")); + m_maincpu->set_input_line(0,HOLD_LINE); + } +} +#endif + +void pc8801_state::machine_start() +{ + machine().device("upd765:0")->get_device()->set_rpm(300); + machine().device("upd765:1")->get_device()->set_rpm(300); + machine().device("upd765")->set_rate(250000); + + m_rtc->cs_w(1); + m_rtc->oe_w(1); + + m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); + m_hi_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x1000); + m_ext_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x8000*0x100); + m_gvram = auto_alloc_array_clear(machine(), UINT8, 0xc000); + m_n80rom = memregion("n80rom")->base(); + m_n88rom = memregion("n88rom")->base(); + m_kanji_rom = memregion("kanji")->base(); + m_cg_rom = memregion("cgrom")->base(); + + save_pointer(NAME(m_work_ram), 0x10000); + save_pointer(NAME(m_hi_work_ram), 0x1000); + save_pointer(NAME(m_ext_work_ram), 0x8000*0x100); + save_pointer(NAME(m_gvram), 0xc000); +} + +void pc8801_state::machine_reset() +{ + #define kB 1024 + #define MB 1024*1024 + const UINT32 extram_type[] = { 0*kB, 32*kB,64*kB,128*kB,128*kB,256*kB,512*kB,1*MB,2*MB,4*MB,8*MB,1*MB+128*kB,2*MB+128*kB,4*MB+128*kB, 0*kB, 0*kB }; + #undef kB + #undef MB + + m_ext_rom_bank = 0xff; + m_gfx_ctrl = 0x31; + m_window_offset_bank = 0x80; + m_misc_ctrl = 0x80; + m_layer_mask = 0x00; + m_vram_sel = 3; + +// pc8801_dynamic_res_change(machine()); + + m_fdc_irq_opcode = 0; //TODO: copied from PC-88VA, could be wrong here ... should be 0x7f ld a,a in the latter case + m_mouse.phase = 0; + + m_fdccpu->set_input_line_vector(0, 0); + + { + m_txt_color = 2; + } + + { + int i; + + for(i=0;i<3;i++) + m_alu_reg[i] = 0x00; + } + + { + m_crtc.param_count = 0; + m_crtc.cmd = 0; + m_crtc.status = 0; + } + + m_beeper->set_frequency(2400); + m_beeper->set_state(0); + + #ifdef USE_PROPER_I8214 + { + /* initialize I8214 */ + m_pic->etlg_w(1); + m_pic->inte_w(1); + } + #else + { + m_vrtc_irq_mask = 0; + m_vrtc_irq_latch = 0; + m_timer_irq_mask = 0; + m_timer_irq_latch = 0; + m_sound_irq_mask = 0; + m_sound_irq_latch = 0; + m_i8214_irq_level = 0; + m_sound_irq_pending = 0; + } + #endif + + { + m_dma_address[2] = 0xf300; + } + + { + m_extram_bank = 0; + m_extram_mode = 0; + } + + { + int i; + + for(i=0;i<0x10;i++) //text + bitmap + m_palette->set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); + } + + m_has_clock_speed = 0; + m_has_dictionary = 0; + m_has_cdrom = 0; + + m_extram_size = extram_type[ioport("MEM")->read() & 0x0f]; + m_has_opna = ioport("BOARD_CONFIG")->read() & 1; +} + +MACHINE_RESET_MEMBER(pc8801_state,pc8801_clock_speed) +{ + pc8801_state::machine_reset(); + m_has_clock_speed = 1; + m_clock_setting = ioport("CFG")->read() & 0x80; + + m_maincpu->set_unscaled_clock(m_clock_setting ? XTAL_4MHz : XTAL_8MHz); + m_fdccpu->set_unscaled_clock(m_clock_setting ? XTAL_4MHz : XTAL_8MHz); // correct? + m_baudrate_val = 0; +} + +MACHINE_RESET_MEMBER(pc8801_state,pc8801_dic) +{ + MACHINE_RESET_CALL_MEMBER( pc8801_clock_speed ); + m_has_dictionary = 1; + m_dic_bank = 0; + m_dic_ctrl = 0; +} + +MACHINE_RESET_MEMBER(pc8801_state,pc8801_cdrom) +{ + MACHINE_RESET_CALL_MEMBER( pc8801_dic ); + m_has_cdrom = 1; + + { + int i; + + for(i=0;i<0x10;i++) + m_cdrom_reg[i] = 0; + } +} + +PALETTE_INIT_MEMBER(pc8801_state, pc8801) +{ + int i; + + for(i=0;i<0x10;i++) //text + bitmap + palette.set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); +} + +/* YM2203 Interface */ + +READ8_MEMBER(pc8801_state::opn_porta_r) +{ + if(ioport("BOARD_CONFIG")->read() & 2) + { + UINT8 shift,res; + + shift = (m_mouse.phase & 1) ? 0 : 4; + res = (m_mouse.phase & 2) ? m_mouse.y : m_mouse.x; + +// printf("%d\n",m_mouse.phase); + + return ((res >> shift) & 0x0f) | 0xf0; + } + + return ioport("OPN_PA")->read(); +} +READ8_MEMBER(pc8801_state::opn_portb_r){ return ioport("OPN_PB")->read(); } + +/* Cassette Configuration */ +WRITE_LINE_MEMBER( pc8801_state::txdata_callback ) +{ + //m_cass->output( (state) ? 0.8 : -0.8); +} + +WRITE_LINE_MEMBER( pc8801_state::rxrdy_w ) +{ + // ... +} + +static MACHINE_CONFIG_START( pc8801, pc8801_state ) + /* main CPU */ + MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK) /* 4 MHz */ + MCFG_CPU_PROGRAM_MAP(pc8801_mem) + MCFG_CPU_IO_MAP(pc8801_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc8801_state, pc8801_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pc8801_state,pc8801_irq_callback) + + /* sub CPU(5 inch floppy drive) */ + MCFG_CPU_ADD("fdccpu", Z80, MASTER_CLOCK) /* 4 MHz */ + MCFG_CPU_PROGRAM_MAP(pc8801fdc_mem) + MCFG_CPU_IO_MAP(pc8801fdc_io) + + //MCFG_QUANTUM_TIME(attotime::from_hz(300000)) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + MCFG_DEVICE_ADD("d8255_master", I8255, 0) + MCFG_I8255_IN_PORTA_CB(DEVREAD8("d8255_slave", i8255_device, pb_r)) + MCFG_I8255_IN_PORTB_CB(DEVREAD8("d8255_slave", i8255_device, pa_r)) + MCFG_I8255_IN_PORTC_CB(READ8(pc8801_state, cpu_8255_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc8801_state, cpu_8255_c_w)) + + MCFG_DEVICE_ADD("d8255_slave", I8255, 0) + MCFG_I8255_IN_PORTA_CB(DEVREAD8("d8255_master", i8255_device, pb_r)) + MCFG_I8255_IN_PORTB_CB(DEVREAD8("d8255_master", i8255_device, pa_r)) + MCFG_I8255_IN_PORTC_CB(READ8(pc8801_state, fdc_8255_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc8801_state, fdc_8255_c_w)) + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE("fdccpu", INPUT_LINE_IRQ0)) + + #ifdef USE_PROPER_I8214 + MCFG_I8214_ADD(I8214_TAG, MASTER_CLOCK, pic_intf) + #endif + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) + //MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_SOFTWARE_LIST_ADD("tape_list","pc8801_cass") + + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(pc8801_state, txdata_callback)) + MCFG_I8251_RTS_HANDLER(WRITELINE(pc8801_state, rxrdy_w)) + + MCFG_FLOPPY_DRIVE_ADD("upd765:0", pc88_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", pc88_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("disk_list","pc8801_flop") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK_24KHz,848,0,640,448,0,400) + MCFG_SCREEN_UPDATE_DRIVER(pc8801_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc8801 ) + MCFG_PALETTE_ADD("palette", 0x10) + MCFG_PALETTE_INIT_OWNER(pc8801_state, pc8801) + +// MCFG_VIDEO_START_OVERRIDE(pc8801_state,pc8801) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("opn", YM2203, MASTER_CLOCK) + MCFG_YM2203_IRQ_HANDLER(WRITELINE(pc8801_state, pc8801_sound_irq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(pc8801_state, opn_porta_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(pc8801_state, opn_portb_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOUND_ADD("opna", YM2608, MASTER_CLOCK*2) + MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc8801_state, pc8801_sound_irq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(pc8801_state, opn_porta_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(pc8801_state, opn_portb_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("rtc_timer", pc8801_state, pc8801_rtc_irq, attotime::from_hz(600)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc8801fh, pc8801 ) + MCFG_MACHINE_RESET_OVERRIDE(pc8801_state, pc8801_clock_speed ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc8801ma, pc8801 ) + MCFG_MACHINE_RESET_OVERRIDE(pc8801_state, pc8801_dic ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc8801mc, pc8801 ) + MCFG_MACHINE_RESET_OVERRIDE(pc8801_state, pc8801_cdrom ) +MACHINE_CONFIG_END + + +/* TODO: clean this up */ +#define PC8801_MEM_LOAD \ + ROM_REGION( 0x100000, "opna", ROMREGION_ERASE00 ) + + +ROM_START( pc8801 ) + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.2 + ROM_LOAD( "n80.rom", 0x0000, 0x8000, CRC(5cb8b584) SHA1(063609dd518c124a4fc9ba35d1bae35771666a34) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 1.0 + ROM_LOAD( "n88.rom", 0x0000, 0x8000, CRC(ffd68be0) SHA1(3518193b8207bdebf22c1380c2db8c554baff329) ) + ROM_LOAD( "n88_0.rom", 0x8000, 0x2000, CRC(61984bab) SHA1(d1ae642aed4f0584eeb81ff50180db694e5101d4) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "disk.rom", 0x0000, 0x0800, CRC(2158d307) SHA1(bb7103a0818850a039c67ff666a31ce49a8d516f) ) + + ROM_REGION( 0x40000, "kanji", ROMREGION_ERASEFF) + ROM_LOAD_OPTIONAL( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) ) +ROM_END + +/* The dump only included "maincpu". Other roms arbitrariely taken from PC-8801 & PC-8801 MkIISR (there should be +at least 1 Kanji ROM). */ +ROM_START( pc8801mk2 ) + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.4 + ROM_LOAD( "m2_n80.rom", 0x0000, 0x8000, CRC(91d84b1a) SHA1(d8a1abb0df75936b3fc9d226ccdb664a9070ffb1) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) //1.3 + ROM_LOAD( "m2_n88.rom", 0x0000, 0x8000, CRC(f35169eb) SHA1(ef1f067f819781d9fb2713836d195866f0f81501) ) + ROM_LOAD( "m2_n88_0.rom", 0x8000, 0x2000, CRC(5eb7a8d0) SHA1(95a70af83b0637a5a0f05e31fb0452bb2cb68055) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "disk.rom", 0x0000, 0x0800, CRC(2158d307) SHA1(bb7103a0818850a039c67ff666a31ce49a8d516f) ) + + ROM_REGION( 0x40000, "kanji", ROMREGION_ERASEFF) + ROM_LOAD_OPTIONAL( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x800 ) +ROM_END + +ROM_START( pc8801mk2sr ) + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.5 + ROM_LOAD( "mk2sr_n80.rom", 0x0000, 0x8000, CRC(27e1857d) SHA1(5b922ed9de07d2a729bdf1da7b57c50ddf08809a) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.0 + ROM_LOAD( "mk2sr_n88.rom", 0x0000, 0x8000, CRC(a0fc0473) SHA1(3b31fc68fa7f47b21c1a1cb027b86b9e87afbfff) ) + ROM_LOAD( "mk2sr_n88_0.rom", 0x8000, 0x2000, CRC(710a63ec) SHA1(d239c26ad7ac5efac6e947b0e9549b1534aa970d) ) + ROM_LOAD( "n88_1.rom", 0xa000, 0x2000, CRC(c0bd2aa6) SHA1(8528eef7946edf6501a6ccb1f416b60c64efac7c) ) + ROM_LOAD( "n88_2.rom", 0xc000, 0x2000, CRC(af2b6efa) SHA1(b7c8bcea219b77d9cc3ee0efafe343cc307425d1) ) + ROM_LOAD( "n88_3.rom", 0xe000, 0x2000, CRC(7713c519) SHA1(efce0b51cab9f0da6cf68507757f1245a2867a72) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "disk.rom", 0x0000, 0x0800, CRC(2158d307) SHA1(bb7103a0818850a039c67ff666a31ce49a8d516f) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x40000, "kanji", 0) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + ROM_LOAD( "kanji2.rom", 0x20000, 0x20000, CRC(154803cc) SHA1(7e6591cd465cbb35d6d3446c5a83b46d30fafe95) ) // it should not be here + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x800 ) +ROM_END + +ROM_START( pc8801mk2fr ) + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.5 + ROM_LOAD( "m2fr_n80.rom", 0x0000, 0x8000, CRC(27e1857d) SHA1(5b922ed9de07d2a729bdf1da7b57c50ddf08809a) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.1 + ROM_LOAD( "m2fr_n88.rom", 0x0000, 0x8000, CRC(b9daf1aa) SHA1(696a480232bcf8c827c7aeea8329db5c44420d2a) ) + ROM_LOAD( "m2fr_n88_0.rom", 0x8000, 0x2000, CRC(710a63ec) SHA1(d239c26ad7ac5efac6e947b0e9549b1534aa970d) ) + ROM_LOAD( "m2fr_n88_1.rom", 0xa000, 0x2000, CRC(e3e78a37) SHA1(85ecd287fe72b56e54c8b01ea7492ca4a69a7470) ) + ROM_LOAD( "m2fr_n88_2.rom", 0xc000, 0x2000, CRC(98c3a7b2) SHA1(fc4980762d3caa56964d0ae583424756f511d186) ) + ROM_LOAD( "m2fr_n88_3.rom", 0xe000, 0x2000, CRC(0ca08abd) SHA1(a5a42d0b7caa84c3bc6e337c9f37874d82f9c14b) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "m2fr_disk.rom", 0x0000, 0x0800, CRC(2163b304) SHA1(80da2dee49d4307f00895a129a5cfeff00cf5321) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x40000, "kanji", 0) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x800 ) +ROM_END + +ROM_START( pc8801mk2mr ) + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8 + ROM_LOAD( "m2mr_n80.rom", 0x0000, 0x8000, CRC(f074b515) SHA1(ebe9cf4cf57f1602c887f609a728267f8d953dce) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.2 + ROM_LOAD( "m2mr_n88.rom", 0x0000, 0x8000, CRC(69caa38e) SHA1(3c64090237152ee77c76e04d6f36bad7297bea93) ) + ROM_LOAD( "m2mr_n88_0.rom", 0x8000, 0x2000, CRC(710a63ec) SHA1(d239c26ad7ac5efac6e947b0e9549b1534aa970d) ) + ROM_LOAD( "m2mr_n88_1.rom", 0xa000, 0x2000, CRC(e3e78a37) SHA1(85ecd287fe72b56e54c8b01ea7492ca4a69a7470) ) + ROM_LOAD( "m2mr_n88_2.rom", 0xc000, 0x2000, CRC(11176e0b) SHA1(f13f14f3d62df61498a23f7eb624e1a646caea45) ) + ROM_LOAD( "m2mr_n88_3.rom", 0xe000, 0x2000, CRC(0ca08abd) SHA1(a5a42d0b7caa84c3bc6e337c9f37874d82f9c14b) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "m2mr_disk.rom", 0x0000, 0x2000, CRC(2447516b) SHA1(1492116f15c426f9796dc2bb6fcccf2656c0ca75) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x40000, "kanji", 0) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + ROM_LOAD( "m2mr_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x800 ) +ROM_END + +ROM_START( pc8801mh ) + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8, but different BIOS code? + ROM_LOAD( "mh_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 + ROM_LOAD( "mh_n88.rom", 0x0000, 0x8000, CRC(64c5d162) SHA1(3e0aac76fb5d7edc99df26fa9f365fd991742a5d) ) + ROM_LOAD( "mh_n88_0.rom", 0x8000, 0x2000, CRC(deb384fb) SHA1(5f38cafa8aab16338038c82267800446fd082e79) ) + ROM_LOAD( "mh_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) + ROM_LOAD( "mh_n88_2.rom", 0xc000, 0x2000, CRC(6aa6b6d8) SHA1(2a077ab444a4fd1470cafb06fd3a0f45420c39cc) ) + ROM_LOAD( "mh_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "mh_disk.rom", 0x0000, 0x2000, CRC(a222ecf0) SHA1(79e9c0786a14142f7a83690bf41fb4f60c5c1004) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x40000, "kanji", 0) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + ROM_LOAD( "mh_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) +ROM_END + +ROM_START( pc8801fa ) + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8, but different BIOS code? + ROM_LOAD( "fa_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 but different BIOS code? + ROM_LOAD( "fa_n88.rom", 0x0000, 0x8000, CRC(73573432) SHA1(9b1346d44044eeea921c4cce69b5dc49dbc0b7e9) ) + ROM_LOAD( "fa_n88_0.rom", 0x8000, 0x2000, CRC(a72697d7) SHA1(5aedbc5916d67ef28767a2b942864765eea81bb8) ) + ROM_LOAD( "fa_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) + ROM_LOAD( "fa_n88_2.rom", 0xc000, 0x2000, CRC(6aee9a4e) SHA1(e94278682ef9e9bbb82201f72c50382748dcea2a) ) + ROM_LOAD( "fa_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "fa_disk.rom", 0x0000, 0x0800, CRC(2163b304) SHA1(80da2dee49d4307f00895a129a5cfeff00cf5321) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x40000, "kanji", 0 ) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + ROM_LOAD( "fa_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) +ROM_END + +ROM_START( pc8801ma ) // newer floppy BIOS and Jisyo (dictionary) ROM + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8, but different BIOS code? + ROM_LOAD( "ma_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 but different BIOS code? + ROM_LOAD( "ma_n88.rom", 0x0000, 0x8000, CRC(73573432) SHA1(9b1346d44044eeea921c4cce69b5dc49dbc0b7e9) ) + ROM_LOAD( "ma_n88_0.rom", 0x8000, 0x2000, CRC(a72697d7) SHA1(5aedbc5916d67ef28767a2b942864765eea81bb8) ) + ROM_LOAD( "ma_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) + ROM_LOAD( "ma_n88_2.rom", 0xc000, 0x2000, CRC(6aee9a4e) SHA1(e94278682ef9e9bbb82201f72c50382748dcea2a) ) + ROM_LOAD( "ma_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "ma_disk.rom", 0x0000, 0x2000, CRC(a222ecf0) SHA1(79e9c0786a14142f7a83690bf41fb4f60c5c1004) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x40000, "kanji", 0 ) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + ROM_LOAD( "ma_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) + + /* 32 banks, to be loaded at 0xc000 - 0xffff */ + ROM_REGION( 0x80000, "dictionary", 0 ) + ROM_LOAD( "ma_jisyo.rom", 0x00000, 0x80000, CRC(a6108f4d) SHA1(3665db538598abb45d9dfe636423e6728a812b12) ) +ROM_END + +ROM_START( pc8801ma2 ) + PC8801_MEM_LOAD + + ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8 + ROM_LOAD( "ma2_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 (2.31?) + ROM_LOAD( "ma2_n88.rom", 0x0000, 0x8000, CRC(ae1a6ebc) SHA1(e53d628638f663099234e07837ffb1b0f86d480d) ) + ROM_LOAD( "ma2_n88_0.rom", 0x8000, 0x2000, CRC(a72697d7) SHA1(5aedbc5916d67ef28767a2b942864765eea81bb8) ) + ROM_LOAD( "ma2_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) + ROM_LOAD( "ma2_n88_2.rom", 0xc000, 0x2000, CRC(1d6277b6) SHA1(dd9c3e50169b75bb707ef648f20d352e6a8bcfe4) ) + ROM_LOAD( "ma2_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "ma2_disk.rom", 0x0000, 0x2000, CRC(a222ecf0) SHA1(79e9c0786a14142f7a83690bf41fb4f60c5c1004) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x40000, "kanji", 0) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + ROM_LOAD( "ma2_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) + + ROM_REGION( 0x80000, "dictionary", 0 ) + ROM_LOAD( "ma2_jisyo.rom", 0x00000, 0x80000, CRC(856459af) SHA1(06241085fc1d62d4b2968ad9cdbdadc1e7d7990a) ) +ROM_END + +ROM_START( pc8801mc ) + PC8801_MEM_LOAD + + ROM_REGION( 0x08000, "n80rom", ROMREGION_ERASEFF ) // 1.8 + ROM_LOAD( "mc_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) + + ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 (2.33?) + ROM_LOAD( "mc_n88.rom", 0x0000, 0x8000, CRC(356d5719) SHA1(5d9ba80d593a5119f52aae1ccd61a1457b4a89a1) ) + ROM_LOAD( "mc_n88_0.rom", 0x8000, 0x2000, CRC(a72697d7) SHA1(5aedbc5916d67ef28767a2b942864765eea81bb8) ) + ROM_LOAD( "mc_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) + ROM_LOAD( "mc_n88_2.rom", 0xc000, 0x2000, CRC(1d6277b6) SHA1(dd9c3e50169b75bb707ef648f20d352e6a8bcfe4) ) + ROM_LOAD( "mc_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) + + ROM_REGION( 0x10000, "fdccpu", 0) + ROM_LOAD( "mc_disk.rom", 0x0000, 0x2000, CRC(a222ecf0) SHA1(79e9c0786a14142f7a83690bf41fb4f60c5c1004) ) + + ROM_REGION( 0x10000, "cdrom", 0 ) + ROM_LOAD( "cdbios.rom", 0x0000, 0x10000, CRC(5c230221) SHA1(6394a8a23f44ea35fcfc3e974cf940bc8f84d62a) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x40000, "kanji", 0 ) + ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) + ROM_LOAD( "mc_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) + + ROM_REGION( 0x800, "cgrom", 0) + ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) + + ROM_REGION( 0x80000, "dictionary", 0 ) + ROM_LOAD( "mc_jisyo.rom", 0x00000, 0x80000, CRC(bd6eb062) SHA1(deef0cc2a9734ba891a6d6c022aa70ffc66f783e) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ + +COMP( 1981, pc8801, 0, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801", MACHINE_NOT_WORKING ) +COMP( 1983, pc8801mk2, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkII", MACHINE_NOT_WORKING ) +COMP( 1985, pc8801mk2sr, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkIISR", MACHINE_NOT_WORKING ) +//COMP( 1985, pc8801mk2tr, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkIITR", MACHINE_NOT_WORKING ) +COMP( 1985, pc8801mk2fr, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkIIFR", MACHINE_NOT_WORKING ) +COMP( 1985, pc8801mk2mr, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkIIMR", MACHINE_NOT_WORKING ) + +//COMP( 1986, pc8801fh, 0, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801FH", MACHINE_NOT_WORKING ) +COMP( 1986, pc8801mh, pc8801, 0, pc8801fh, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801MH", MACHINE_NOT_WORKING ) +COMP( 1987, pc8801fa, pc8801, 0, pc8801fh, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801FA", MACHINE_NOT_WORKING ) +COMP( 1987, pc8801ma, pc8801, 0, pc8801ma, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801MA", MACHINE_NOT_WORKING ) +//COMP( 1988, pc8801fe, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801FE", MACHINE_NOT_WORKING ) +COMP( 1988, pc8801ma2, pc8801, 0, pc8801ma, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801MA2", MACHINE_NOT_WORKING ) +//COMP( 1989, pc8801fe2, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801FE2", MACHINE_NOT_WORKING ) +COMP( 1989, pc8801mc, pc8801, 0, pc8801mc, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801MC", MACHINE_NOT_WORKING ) + +//COMP( 1989, pc98do, 0, 0, pc88va, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-98DO", MACHINE_NOT_WORKING ) +//COMP( 1990, pc98dop, 0, 0, pc88va, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-98DO+", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pc88va.c b/src/mame/drivers/pc88va.c new file mode 100644 index 00000000000..8999e56b864 --- /dev/null +++ b/src/mame/drivers/pc88va.c @@ -0,0 +1,1919 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/******************************************************************************************** + + PC-88VA (c) 1987 NEC + + A follow up of the regular PC-8801. It can also run PC-8801 software in compatible mode + + preliminary driver by Angelo Salese + Special thanks to Fujix for his documentation translation help + + TODO: + - Does this system have one or two CPUs? I'm prone to think that the V30 does all the job + and then enters into z80 compatible mode for PC-8801 emulation. + - What exact kind of garbage happens if you try to enable both direct and palette color + modes to a graphic layer? + - What is exactly supposed to be a "bus slot"? + - fdc "intelligent mode" has 0x7f as irq vector ... 0x7f is ld a,a and it IS NOT correctly + hooked up by the current z80 core + - PC-88VA stock version has two bogus opcodes. One is at 0xf0b15, another at 0xf0b31. + Making a patch for the latter makes the system to jump into a "DIP-Switch" display. + - unemulated upd71071 demand mode. + - Fix floppy motor hook-up; + +********************************************************************************************/ + +#include "emu.h" +#include "cpu/nec/nec.h" +#include "cpu/z80/z80.h" +#include "debug/debugcpu.h" +#include "machine/i8255.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/upd765.h" +#include "sound/2203intf.h" +#include "formats/xdf_dsk.h" +//#include "machine/upd71071.h" +#include "machine/am9517a.h" + + +/* Note: for the time being, just disable FDC CPU, it's for PC-8801 compatibility mode anyway ... */ +#define TEST_SUBFDC 0 + +struct tsp_t +{ + UINT16 tvram_vreg_offset; + UINT16 attr_offset; + UINT16 spr_offset; + UINT8 disp_on; + UINT8 spr_on; + UINT8 pitch; + UINT8 line_height; + UINT8 h_line_pos; + UINT8 blink; + UINT16 cur_pos_x,cur_pos_y; + UINT8 curn; + UINT8 curn_blink; +}; + + +class pc88va_state : public driver_device +{ +public: + enum + { + TIMER_PC8801FD_UPD765_TC_TO_ZERO, + TIMER_T3_MOUSE_CALLBACK, + TIMER_PC88VA_FDC_TIMER, + TIMER_PC88VA_FDC_MOTOR_START_0, + TIMER_PC88VA_FDC_MOTOR_START_1 + }; + + pc88va_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_fdc(*this, "upd765"), + m_dmac(*this, "dmac"), + m_palram(*this, "palram"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + required_device m_maincpu; + required_device m_fdc; + required_device m_dmac; + required_shared_ptr m_palram; + UINT16 m_bank_reg; + UINT16 m_screen_ctrl_reg; + UINT8 m_timer3_io_reg; + emu_timer *m_t3_mouse_timer; + tsp_t m_tsp; + UINT16 m_video_pri_reg[2]; + UINT8 m_backupram_wp; + UINT8 m_cmd; + UINT8 m_buf_size; + UINT8 m_buf_index; + UINT8 m_buf_ram[16]; + UINT8 m_portc_test; + UINT8 m_fdc_motor_status[2]; + + /* floppy state */ + UINT8 m_i8255_0_pc; + UINT8 m_i8255_1_pc; + UINT8 m_fdc_mode; + UINT8 m_fdc_irq_opcode; + DECLARE_READ16_MEMBER(sys_mem_r); + DECLARE_WRITE16_MEMBER(sys_mem_w); + DECLARE_READ8_MEMBER(idp_status_r); + DECLARE_WRITE8_MEMBER(idp_command_w); + DECLARE_WRITE8_MEMBER(idp_param_w); + DECLARE_WRITE16_MEMBER(palette_ram_w); + DECLARE_READ16_MEMBER(sys_port4_r); + DECLARE_READ16_MEMBER(bios_bank_r); + DECLARE_WRITE16_MEMBER(bios_bank_w); + DECLARE_READ8_MEMBER(rom_bank_r); + DECLARE_READ8_MEMBER(key_r); + DECLARE_WRITE16_MEMBER(backupram_wp_1_w); + DECLARE_WRITE16_MEMBER(backupram_wp_0_w); + DECLARE_READ8_MEMBER(hdd_status_r); + #if TEST_SUBFDC + DECLARE_READ8_MEMBER(upd765_tc_r); + DECLARE_WRITE8_MEMBER(upd765_mc_w); + #else + DECLARE_READ8_MEMBER(no_subfdc_r); + #endif + DECLARE_READ8_MEMBER(pc88va_fdc_r); + DECLARE_WRITE8_MEMBER(pc88va_fdc_w); + DECLARE_READ16_MEMBER(sysop_r); + DECLARE_READ16_MEMBER(screen_ctrl_r); + DECLARE_WRITE16_MEMBER(screen_ctrl_w); + DECLARE_WRITE8_MEMBER(timer3_ctrl_reg_w); + DECLARE_WRITE16_MEMBER(video_pri_w); + DECLARE_READ8_MEMBER(backupram_dsw_r); + DECLARE_WRITE8_MEMBER(sys_port1_w); + DECLARE_WRITE8_MEMBER(fdc_irq_vector_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_pc88va(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(pc88va_vrtc_irq); + DECLARE_READ8_MEMBER(cpu_8255_c_r); + DECLARE_WRITE8_MEMBER(cpu_8255_c_w); + DECLARE_READ8_MEMBER(fdc_8255_c_r); + DECLARE_WRITE8_MEMBER(fdc_8255_c_w); + DECLARE_READ8_MEMBER(r232_ctrl_porta_r); + DECLARE_READ8_MEMBER(r232_ctrl_portb_r); + DECLARE_READ8_MEMBER(r232_ctrl_portc_r); + DECLARE_WRITE8_MEMBER(r232_ctrl_porta_w); + DECLARE_WRITE8_MEMBER(r232_ctrl_portb_w); + DECLARE_WRITE8_MEMBER(r232_ctrl_portc_w); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE_LINE_MEMBER(pc88va_pit_out0_changed); +// DECLARE_WRITE_LINE_MEMBER(pc88va_upd765_interrupt); + UINT8 m_fdc_ctrl_2; + TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero); + TIMER_CALLBACK_MEMBER(t3_mouse_callback); + TIMER_CALLBACK_MEMBER(pc88va_fdc_timer); + TIMER_CALLBACK_MEMBER(pc88va_fdc_motor_start_0); + TIMER_CALLBACK_MEMBER(pc88va_fdc_motor_start_1); +// UINT16 m_fdc_dma_r(); +// void m_fdc_dma_w(UINT16 data); + DECLARE_WRITE_LINE_MEMBER(pc88va_hlda_w); + DECLARE_WRITE_LINE_MEMBER(pc88va_tc_w); + DECLARE_READ8_MEMBER(fdc_dma_r); + DECLARE_WRITE8_MEMBER(fdc_dma_w); +DECLARE_READ8_MEMBER(dma_memr_cb); +DECLARE_WRITE8_MEMBER(dma_memw_cb); + + DECLARE_WRITE_LINE_MEMBER(fdc_irq); + DECLARE_WRITE_LINE_MEMBER(fdc_drq); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + void pc88va_fdc_update_ready(floppy_image_device *, int); + void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 calc_kanji_rom_addr(UINT8 jis1,UINT8 jis2,int x,int y); + void draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void tsp_sprite_enable(UINT32 spr_offset, UINT8 sw_bit); + void execute_sync_cmd(); + void execute_dspon_cmd(); + void execute_dspdef_cmd(); + void execute_curdef_cmd(); + void execute_actscr_cmd(); + void execute_curs_cmd(); + void execute_emul_cmd(); + void execute_spron_cmd(); + void execute_sprsw_cmd(); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + required_device m_gfxdecode; + required_device m_palette; +}; + + + +void pc88va_state::video_start() +{ +} + +void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT16 *tvram = (UINT16 *)(memregion("tvram")->base()); + int offs,i; + + offs = m_tsp.spr_offset; + for(i=0;i<(0x100);i+=(8)) + { + int xp,yp,sw,md,xsize,ysize,spda,fg_col,bc; + int x_i,y_i,x_s; + int spr_count; + int pen; + + ysize = (tvram[(offs + i + 0) / 2] & 0xfc00) >> 10; + sw = (tvram[(offs + i + 0) / 2] & 0x200) >> 9; + yp = (tvram[(offs + i + 0) / 2] & 0x1ff); + xsize = (tvram[(offs + i + 2) / 2] & 0xf800) >> 11; + md = (tvram[(offs + i + 2) / 2] & 0x400) >> 10; + xp = (tvram[(offs + i + 2) / 2] & 0x3ff); + spda = (tvram[(offs + i + 4) / 2] & 0xffff); + fg_col = (tvram[(offs + i + 6) / 2] & 0xf0) >> 4; + bc = (tvram[(offs + i + 6) / 2] & 0x08) >> 3; + + if(!sw) + continue; + + if(yp & 0x100) + { + yp &= 0xff; + yp = 0x100 - yp; + } + + if(0) // uhm, makes more sense without the sign? + if(xp & 0x200) + { + xp &= 0x1ff; + xp = 0x200 - xp; + } + + if(md) // 1bpp mode + { + xsize = (xsize + 1) * 32; + ysize = (ysize + 1) * 4; + + if(!(spda & 0x8000)) // correct? + spda *= 2; + + spr_count = 0; + + for(y_i=0;y_i> (15-x_s)) & 1; + + pen = pen & 1 ? fg_col : (bc) ? 8 : -1; + + if(pen != -1) //transparent pen + bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); + } + spr_count+=2; + } + } + } + else // 4bpp mode (UNTESTED) + { + xsize = (xsize + 1) * 8; + ysize = (ysize + 1) * 4; + + if(!(spda & 0x8000)) // correct? + spda *= 2; + + spr_count = 0; + + for(y_i=0;y_i> (16-(x_s*8)) & 0xf; + + //if(bc != -1) //transparent pen + bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); + } + spr_count+=2; + } + } + } + } +} + +/* TODO: this is either a result of an hand-crafted ROM or the JIS stuff is really attribute related ... */ +UINT32 pc88va_state::calc_kanji_rom_addr(UINT8 jis1,UINT8 jis2,int x,int y) +{ + if(jis1 < 0x30) + return ((jis2 & 0x60) << 8) + ((jis1 & 0x07) << 10) + ((jis2 & 0x1f) << 5); + else if(jis1 >= 0x30 && jis1 < 0x3f) + return ((jis2 & 0x60) << 10) + ((jis1 & 0x0f) << 10) + ((jis2 & 0x1f) << 5); + else if(jis1 >= 0x40 && jis1 < 0x50) + return 0x4000 + ((jis2 & 0x60) << 10) + ((jis1 & 0x0f) << 10) + ((jis2 & 0x1f) << 5); + else if(x == 0 && y == 0 && jis1 != 0) // debug stuff, to be nuked in the end + printf("%02x\n",jis1); + + return 0; +} + +void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT8 *tvram = memregion("tvram")->base(); + UINT8 *kanji = memregion("kanji")->base(); + int xi,yi; + int x,y; + int res_x,res_y; + UINT16 lr_half_gfx; + UINT8 jis1,jis2; + UINT32 count; + UINT32 tile_num; + UINT16 attr; + UINT8 attr_mode; + UINT8 fg_col,bg_col,secret,reverse; + //UINT8 blink,dwidc,dwid,uline,hline; + UINT8 screen_fg_col,screen_bg_col; + + count = (tvram[m_tsp.tvram_vreg_offset+0] | tvram[m_tsp.tvram_vreg_offset+1] << 8); + + attr_mode = tvram[m_tsp.tvram_vreg_offset+0xa] & 0x1f; + /* Note: bug in docs has the following two reversed */ + screen_fg_col = (tvram[m_tsp.tvram_vreg_offset+0xb] & 0xf0) >> 4; + screen_bg_col = tvram[m_tsp.tvram_vreg_offset+0xb] & 0x0f; + + for(y=0;y<13;y++) + { + for(x=0;x<80;x++) + { + jis1 = (tvram[count+0] & 0x7f) + 0x20; + jis2 = tvram[count+1] & 0x7f; + lr_half_gfx = ((tvram[count+1] & 0x80) >> 7); + + tile_num = calc_kanji_rom_addr(jis1,jis2,x,y); + + attr = (tvram[count+m_tsp.attr_offset] & 0x00ff); + + fg_col = bg_col = reverse = secret = 0; //blink = dwidc = dwid = uline = hline = 0; + + switch(attr_mode) + { + /* + xxxx ---- foreground color + ---- xxxx background color + */ + case 0: + fg_col = (attr & 0xf0) >> 4; + bg_col = (attr & 0x0f) >> 0; + break; + /* + xxxx ---- foreground color + ---- x--- horizontal line + ---- -x-- reverse + ---- --x- blink + ---- ---x secret (hide text) + background color is defined by screen control table values + */ + case 1: + fg_col = (attr & 0xf0) >> 4; + bg_col = screen_bg_col; + //hline = (attr & 0x08) >> 3; + reverse = (attr & 0x04) >> 2; + //blink = (attr & 0x02) >> 1; + secret = (attr & 0x01) >> 0; + break; + /* + x--- ---- dwidc + -x-- ---- dwid + --x- ---- uline + ---x ---- hline + ---- -x-- reverse + ---- --x- blink + ---- ---x secret (hide text) + background and foreground colors are defined by screen control table values + */ + case 2: + fg_col = screen_fg_col; + bg_col = screen_bg_col; + //dwidc = (attr & 0x80) >> 7; + //dwid = (attr & 0x40) >> 6; + //uline = (attr & 0x20) >> 5; + //hline = (attr & 0x10) >> 4; + reverse = (attr & 0x04) >> 2; + //blink = (attr & 0x02) >> 1; + secret = (attr & 0x01) >> 0; + break; + /* + ---- x--- mixes between mode 0 and 2 + + xxxx 1--- foreground color + ---- 1xxx background color + 2) + x--- 0--- dwidc + -x-- 0--- dwid + --x- 0--- uline + ---x 0--- hline + ---- 0x-- reverse + ---- 0-x- blink + ---- 0--x secret (hide text) + background and foreground colors are defined by screen control table values + */ + case 3: + { + if(attr & 0x8) + { + fg_col = (attr & 0xf0) >> 4; + bg_col = (attr & 0x07) >> 0; + } + else + { + fg_col = screen_fg_col; + bg_col = screen_bg_col; + //dwidc = (attr & 0x80) >> 7; + //dwid = (attr & 0x40) >> 6; + //uline = (attr & 0x20) >> 5; + //hline = (attr & 0x10) >> 4; + reverse = (attr & 0x04) >> 2; + //blink = (attr & 0x02) >> 1; + secret = (attr & 0x01) >> 0; + } + } + break; + /* + x--- ---- blink + -xxx ---- background color + ---- xxxx foreground color + */ + case 4: + fg_col = (attr & 0x0f) >> 0; + bg_col = (attr & 0x70) >> 4; + //blink = (attr & 0x80) >> 7; + break; + /* + x--- ---- blink + -xxx ---- background color + ---- xxxx foreground color + hline is enabled if foreground color is 1 or 9 + */ + case 5: + fg_col = (attr & 0x0f) >> 0; + bg_col = (attr & 0x70) >> 4; + //blink = (attr & 0x80) >> 7; + //if((fg_col & 7) == 1) + //hline = 1; + break; + default: + popmessage("Illegal text tilemap attribute mode %02x, contact MESSdev",attr_mode); + return; + } + + for(yi=0;yi<16;yi++) + { + for(xi=0;xi<8;xi++) + { + int pen; + + res_x = x*8+xi; + res_y = y*16+yi; + + if(!cliprect.contains(res_x, res_y)) + continue; + + pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1; + + if(reverse) + pen = pen & 1 ? bg_col : fg_col; + else + pen = pen & 1 ? fg_col : bg_col; + + if(secret) { pen = 0; } //hide text + + if(pen != -1) //transparent + bitmap.pix32(res_y, res_x) = m_palette->pen(pen); + } + } + + count+=2; + count&=0xffff; + } + } +} + +UINT32 pc88va_state::screen_update_pc88va(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT8 pri,cur_pri_lv; + UINT32 screen_pri; + bitmap.fill(0, cliprect); + + if(m_tsp.disp_on == 0) // don't bother if we are under DSPOFF command + return 0; + + /* + m_video_pri_reg[0] + xxxx ---- ---- ---- priority 3 + ---- xxxx ---- ---- priority 2 + ---- ---- xxxx ---- priority 1 + ---- ---- ---- xxxx priority 0 + m_video_pri_reg[1] + ---- ---- xxxx ---- priority 5 + ---- ---- ---- xxxx priority 4 + + Note that orthogonality level is actually REVERSED than the level number it indicates, so we have to play a little with the data for an easier usage ... + */ + + screen_pri = (m_video_pri_reg[1] & 0x00f0) >> 4; // priority 5 + screen_pri|= (m_video_pri_reg[1] & 0x000f) << 4; // priority 4 + screen_pri|= (m_video_pri_reg[0] & 0xf000) >> 4; // priority 3 + screen_pri|= (m_video_pri_reg[0] & 0x0f00) << 4; // priority 2 + screen_pri|= (m_video_pri_reg[0] & 0x00f0) << 12; // priority 1 + screen_pri|= (m_video_pri_reg[0] & 0x000f) << 20; // priority 0 + + for(pri=0;pri<6;pri++) + { + cur_pri_lv = (screen_pri >> (pri*4)) & 0xf; + + if(cur_pri_lv & 8) // enable layer + { + if(pri <= 1) // (direct color mode, priority 5 and 4) + { + // 8 = graphic 0 + // 9 = graphic 1 + } + else + { + switch(cur_pri_lv & 3) // (palette color mode) + { + case 0: draw_text(bitmap,cliprect); break; + case 1: if(m_tsp.spr_on) { draw_sprites(bitmap,cliprect); } break; + case 2: /* A = graphic 0 */ break; + case 3: /* B = graphic 1 */ break; + } + } + } + } + + return 0; +} + +void pc88va_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_PC8801FD_UPD765_TC_TO_ZERO: + pc8801fd_upd765_tc_to_zero(ptr, param); + break; + case TIMER_T3_MOUSE_CALLBACK: + t3_mouse_callback(ptr, param); + break; + case TIMER_PC88VA_FDC_TIMER: + pc88va_fdc_timer(ptr, param); + break; + case TIMER_PC88VA_FDC_MOTOR_START_0: + pc88va_fdc_motor_start_0(ptr, param); + break; + case TIMER_PC88VA_FDC_MOTOR_START_1: + pc88va_fdc_motor_start_1(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in pc88va_state::device_timer"); + } +} + +READ16_MEMBER(pc88va_state::sys_mem_r) +{ + switch((m_bank_reg & 0xf00) >> 8) + { + case 0: // select bus slot + return 0xffff; + case 1: // TVRAM + { + UINT16 *tvram = (UINT16 *)(memregion("tvram")->base()); + + if(((offset*2) & 0x30000) == 0) + return tvram[offset]; + + return 0xffff; + } + case 4: + { + UINT16 *gvram = (UINT16 *)(memregion("gvram")->base()); + + return gvram[offset]; + } + case 8: // kanji ROM + case 9: + { + UINT16 *knj_ram = (UINT16 *)(memregion("kanji")->base()); + UINT32 knj_offset; + + knj_offset = (offset + (((m_bank_reg & 0x100) >> 8)*0x20000)); + + /* 0x00000 - 0x3ffff Kanji ROM 1*/ + /* 0x40000 - 0x4ffff Kanji ROM 2*/ + /* 0x50000 - 0x53fff Backup RAM */ + /* anything else is a NOP (I presume?) */ + + return knj_ram[knj_offset]; + } + case 0xc: // Dictionary ROM + case 0xd: + { + UINT16 *dic_rom = (UINT16 *)(memregion("dictionary")->base()); + UINT32 dic_offset; + + dic_offset = (offset + (((m_bank_reg & 0x100) >> 8)*0x20000)); + + return dic_rom[dic_offset]; + } + } + + return 0xffff; +} + +WRITE16_MEMBER(pc88va_state::sys_mem_w) +{ + switch((m_bank_reg & 0xf00) >> 8) + { + case 0: // select bus slot + break; + case 1: // TVRAM + { + UINT16 *tvram = (UINT16 *)(memregion("tvram")->base()); + + if(((offset*2) & 0x30000) == 0) + COMBINE_DATA(&tvram[offset]); + } + break; + case 4: // TVRAM + { + UINT16 *gvram = (UINT16 *)(memregion("gvram")->base()); + + COMBINE_DATA(&gvram[offset]); + } + break; + case 8: // kanji ROM, backup RAM at 0xb0000 - 0xb3fff + case 9: + { + UINT16 *knj_ram = (UINT16 *)(memregion("kanji")->base()); + UINT32 knj_offset; + + knj_offset = ((offset) + (((m_bank_reg & 0x100) >> 8)*0x20000)); + + if(knj_offset >= 0x50000/2 && knj_offset <= 0x53fff/2) // TODO: there's an area that can be write protected + { + COMBINE_DATA(&knj_ram[knj_offset]); + m_gfxdecode->gfx(0)->mark_dirty((knj_offset * 2) / 8); + m_gfxdecode->gfx(1)->mark_dirty((knj_offset * 2) / 32); + } + } + break; + case 0xc: // Dictionary ROM + case 0xd: + { + // NOP? + } + break; + } +} + +static ADDRESS_MAP_START( pc88va_map, AS_PROGRAM, 16, pc88va_state ) + AM_RANGE(0x00000, 0x7ffff) AM_RAM +// AM_RANGE(0x80000, 0x9ffff) AM_RAM // EMM + AM_RANGE(0xa0000, 0xdffff) AM_READWRITE(sys_mem_r,sys_mem_w) + AM_RANGE(0xe0000, 0xeffff) AM_ROMBANK("rom00_bank") + AM_RANGE(0xf0000, 0xfffff) AM_ROMBANK("rom10_bank") +ADDRESS_MAP_END + +/* IDP = NEC uPD72022 */ +READ8_MEMBER(pc88va_state::idp_status_r) +{ +/* + x--- ---- LP Light-pen signal detection (with VA use failure) + -x-- ---- VB Vertical elimination period + --x- ---- SC Sprite control (sprite over/collision) + ---x ---- ER Error occurrence + ---- x--- In the midst of execution of EMEN emulation development + ---- -x-- In the midst of BUSY command execution + ---- --x- OBF output data buffer full + ---- ---x IBF input data buffer full (command/parameter commonness) +*/ + return 0x00; +} + + +#define SYNC 0x10 +#define DSPON 0x12 +#define DSPOFF 0x13 +#define DSPDEF 0x14 +#define CURDEF 0x15 +#define ACTSCR 0x16 +#define CURS 0x1e +#define EMUL 0x8c +#define EXIT 0x88 +#define SPRON 0x82 +#define SPROFF 0x83 +#define SPRSW 0x85 +#define SPROV 0x81 + +WRITE8_MEMBER(pc88va_state::idp_command_w) +{ + switch(data) + { + /* 0x10 - SYNC: sets CRTC values */ + case SYNC: m_cmd = SYNC; m_buf_size = 14; m_buf_index = 0; break; + + /* 0x12 - DSPON: set DiSPlay ON and set up tvram table vreg */ + case DSPON: m_cmd = DSPON; m_buf_size = 3; m_buf_index = 0; break; + + /* 0x13 - DSPOFF: set DiSPlay OFF */ + case DSPOFF: m_cmd = DSPOFF; m_tsp.disp_on = 0; break; + + /* 0x14 - DSPDEF: set DiSPlay DEFinitions */ + case DSPDEF: m_cmd = DSPDEF; m_buf_size = 6; m_buf_index = 0; break; + + /* 0x15 - CURDEF: set CURsor DEFinition */ + case CURDEF: m_cmd = CURDEF; m_buf_size = 1; m_buf_index = 0; break; + + /* 0x16 - ACTSCR: ??? */ + case ACTSCR: m_cmd = ACTSCR; m_buf_size = 1; m_buf_index = 0; break; + + /* 0x15 - CURS: set CURSor position */ + case CURS: m_cmd = CURS; m_buf_size = 4; m_buf_index = 0; break; + + /* 0x8c - EMUL: set 3301 EMULation */ + case EMUL: m_cmd = EMUL; m_buf_size = 4; m_buf_index = 0; break; + + /* 0x88 - EXIT: ??? */ + case EXIT: m_cmd = EXIT; break; + + /* 0x82 - SPRON: set SPRite ON */ + case SPRON: m_cmd = SPRON; m_buf_size = 3; m_buf_index = 0; break; + + /* 0x83 - SPROFF: set SPRite OFF */ + case SPROFF: m_cmd = SPROFF; m_tsp.spr_on = 0; break; + + /* 0x85 - SPRSW: ??? */ + case SPRSW: m_cmd = SPRSW; m_buf_size = 1; m_buf_index = 0; break; + + /* 0x81 - SPROV: set SPRite OVerflow information */ + /* + -x-- ---- Sprite Over flag + --x- ---- Sprite Collision flag + ---x xxxx First sprite that caused Sprite Over event + */ + case SPROV: m_cmd = SPROV; /* TODO: where it returns the info? */ break; + + /* TODO: 0x89 shouldn't trigger, should be one of the above commands */ + /* Update: actually 0x89 is mask command */ + default: m_cmd = 0x00; printf("PC=%05x: Unknown IDP %02x cmd set\n",space.device().safe_pc(),data); break; + } +} + +void pc88va_state::tsp_sprite_enable(UINT32 spr_offset, UINT8 sw_bit) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.write_word(spr_offset, space.read_word(spr_offset) & ~0x200); + space.write_word(spr_offset, space.read_word(spr_offset) | (sw_bit & 0x200)); +} + +/* TODO: very preliminary, needs something showable first */ +void pc88va_state::execute_sync_cmd() +{ + /* + ???? ???? [0] - unknown + ???? ???? [1] - unknown + --xx xxxx [2] - h blank start + --xx xxxx [3] - h border start + xxxx xxxx [4] - h visible area + --xx xxxx [5] - h border end + --xx xxxx [6] - h blank end + --xx xxxx [7] - h sync + --xx xxxx [8] - v blank start + --xx xxxx [9] - v border start + xxxx xxxx [A] - v visible area + -x-- ---- [B] - v visible area (bit 9) + --xx xxxx [C] - v border end + --xx xxxx [D] - v blank end + --xx xxxx [E] - v sync + */ + rectangle visarea; + attoseconds_t refresh; + UINT16 x_vis_area,y_vis_area; + + //printf("V blank start: %d\n",(sync_cmd[0x8])); + //printf("V border start: %d\n",(sync_cmd[0x9])); + //printf("V Visible Area: %d\n",(sync_cmd[0xa])|((sync_cmd[0xb] & 0x40)<<2)); + //printf("V border end: %d\n",(sync_cmd[0xc])); + //printf("V blank end: %d\n",(sync_cmd[0xd])); + + x_vis_area = m_buf_ram[4] * 4; + y_vis_area = (m_buf_ram[0xa])|((m_buf_ram[0xb] & 0x40)<<2); + + visarea.set(0, x_vis_area - 1, 0, y_vis_area - 1); + + //if(y_vis_area == 400) + // refresh = HZ_TO_ATTOSECONDS(24800) * x_vis_area * y_vis_area; //24.8 KHz + //else + // refresh = HZ_TO_ATTOSECONDS(15730) * x_vis_area * y_vis_area; //15.73 KHz + + refresh = HZ_TO_ATTOSECONDS(60); + + machine().first_screen()->configure(640, 480, visarea, refresh); +} + +void pc88va_state::execute_dspon_cmd() +{ + /* + [0] text table offset (hi word) + [1] unknown + [2] unknown + */ + m_tsp.tvram_vreg_offset = m_buf_ram[0] << 8; + m_tsp.disp_on = 1; +} + +void pc88va_state::execute_dspdef_cmd() +{ + /* + [0] attr offset (lo word) + [1] attr offset (hi word) + [2] pitch (character code interval x 16, i.e. 0x20 = 2 bytes + [3] line height + [4] hline vertical position + [5] blink number + */ + m_tsp.attr_offset = m_buf_ram[0] | m_buf_ram[1] << 8; + m_tsp.pitch = (m_buf_ram[2] & 0xf0) >> 4; + m_tsp.line_height = m_buf_ram[3] + 1; + m_tsp.h_line_pos = m_buf_ram[4]; + m_tsp.blink = (m_buf_ram[5] & 0xf8) >> 3; +} + +void pc88va_state::execute_curdef_cmd() +{ + /* + xxxx x--- [0] Sprite Cursor number (sprite RAM entry) + ---- --x- [0] show cursor bit (actively modifies the spriteram entry) + ---- ---x [0] Blink Enable + */ + + /* TODO: needs basic sprite emulation */ + m_tsp.curn = (m_buf_ram[0] & 0xf8); + m_tsp.curn_blink = (m_buf_ram[0] & 1); + + tsp_sprite_enable(0xa0000 + m_tsp.spr_offset + m_tsp.curn, (m_buf_ram[0] & 2) << 8); +} + +void pc88va_state::execute_actscr_cmd() +{ + /* + This command assigns a strip where the cursor is located. + xxxx xxxx [0] strip ID * 32 (???) + */ + + /* TODO: no idea about this command */ + //printf("ACTSCR: %02x\n",m_buf_ram[0]); +} + +void pc88va_state::execute_curs_cmd() +{ + /* + [0] Cursor Position Y (lo word) + [1] Cursor Position Y (hi word) + [2] Cursor Position X (lo word) + [3] Cursor Position X (hi word) + */ + + m_tsp.cur_pos_y = m_buf_ram[0] | m_buf_ram[1] << 8; + m_tsp.cur_pos_x = m_buf_ram[2] | m_buf_ram[3] << 8; +} + +void pc88va_state::execute_emul_cmd() +{ + /* + [0] Emulate target strip ID x 32 + [1] The number of chars + [2] The number of attributes + [3] The number of lines + */ + + // TODO: this starts 3301 video emulation + //popmessage("Warning: TSP executes EMUL command, contact MESSdev"); +} + +void pc88va_state::execute_spron_cmd() +{ + /* + [0] Sprite Table Offset (hi word) + [1] (unknown / reserved) + xxxx x--- [2] HSPN: Maximum number of sprites in one raster (num + 1) for Sprite Over + ---- --x- [2] MG: all sprites are 2x zoomed vertically when 1 + ---- ---x [2] GR: 1 to enable the group collision detection + */ + m_tsp.spr_offset = m_buf_ram[0] << 8; + m_tsp.spr_on = 1; + printf("SPR TABLE %02x %02x %02x\n",m_buf_ram[0],m_buf_ram[1],m_buf_ram[2]); +} + +void pc88va_state::execute_sprsw_cmd() +{ + /* + Toggle an individual sprite in the sprite ram entry + [0] xxxx x--- target sprite number + [0] ---- --x- sprite off/on switch + */ + + tsp_sprite_enable(0xa0000 + m_tsp.spr_offset + (m_buf_ram[0] & 0xf8), (m_buf_ram[0] & 2) << 8); +} + +WRITE8_MEMBER(pc88va_state::idp_param_w) +{ + if(m_cmd == DSPOFF || m_cmd == EXIT || m_cmd == SPROFF || m_cmd == SPROV) // no param commands + return; + + m_buf_ram[m_buf_index] = data; + m_buf_index++; + + if(m_buf_index >= m_buf_size) + { + m_buf_index = 0; + switch(m_cmd) + { + case SYNC: execute_sync_cmd(); break; + case DSPON: execute_dspon_cmd(); break; + case DSPDEF: execute_dspdef_cmd(); break; + case CURDEF: execute_curdef_cmd(); break; + case ACTSCR: execute_actscr_cmd(); break; + case CURS: execute_curs_cmd(); break; + case EMUL: execute_emul_cmd(); break; + case SPRON: execute_spron_cmd(); break; + case SPRSW: execute_sprsw_cmd(); break; + + default: + //printf("%02x\n",data); + break; + } + } +} + +WRITE16_MEMBER(pc88va_state::palette_ram_w) +{ + int r,g,b; + COMBINE_DATA(&m_palram[offset]); + + b = (m_palram[offset] & 0x001e) >> 1; + r = (m_palram[offset] & 0x03c0) >> 6; + g = (m_palram[offset] & 0x7800) >> 11; + + m_palette->set_pen_color(offset,pal4bit(r),pal4bit(g),pal4bit(b)); +} + +READ16_MEMBER(pc88va_state::sys_port4_r) +{ + UINT8 vrtc,sw1; + vrtc = (machine().first_screen()->vpos() < 200) ? 0x20 : 0x00; // vblank + + sw1 = (ioport("DSW")->read() & 1) ? 2 : 0; + + return vrtc | sw1 | 0xc0; +} + +READ16_MEMBER(pc88va_state::bios_bank_r) +{ + return m_bank_reg; +} + +WRITE16_MEMBER(pc88va_state::bios_bank_w) +{ + /* + -x-- ---- ---- ---- SMM (compatibility mode) + ---x ---- ---- ---- GMSP (VRAM drawing Mode) + ---- xxxx ---- ---- SMBC (0xa0000 - 0xdffff RAM bank) + ---- ---- xxxx ---- RBC1 (0xf0000 - 0xfffff ROM bank) + ---- ---- ---- xxxx RBC0 (0xe0000 - 0xeffff ROM bank) + */ + if ((mem_mask&0xffff) == 0xffff) + m_bank_reg = data; + else if ((mem_mask & 0xffff) == 0xff00) + m_bank_reg = (data & 0xff00) | (m_bank_reg & 0x00ff); + else if ((mem_mask & 0xffff) == 0x00ff) + m_bank_reg = (data & 0x00ff) | (m_bank_reg & 0xff00); + + + /* RBC1 */ + { + UINT8 *ROM10 = memregion("rom10")->base(); + + if((m_bank_reg & 0xe0) == 0x00) + membank("rom10_bank")->set_base(&ROM10[(m_bank_reg & 0x10) ? 0x10000 : 0x00000]); + } + + /* RBC0 */ + { + UINT8 *ROM00 = memregion("rom00")->base(); + + membank("rom00_bank")->set_base(&ROM00[(m_bank_reg & 0xf)*0x10000]); // TODO: docs says that only 0 - 5 are used, dunno why ... + } +} + +READ8_MEMBER(pc88va_state::rom_bank_r) +{ + return 0xff; // bit 7 low is va91 rom bank status +} + +READ8_MEMBER(pc88va_state::key_r) +{ + // note row D bit 2 does something at POST ... some kind of test mode? + static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", + "KEY4", "KEY5", "KEY6", "KEY7", + "KEY8", "KEY9", "KEYA", "KEYB", + "KEYC", "KEYD", "KEYE", "KEYF" }; + + return ioport(keynames[offset])->read(); +} + +WRITE16_MEMBER(pc88va_state::backupram_wp_1_w) +{ + m_backupram_wp = 1; +} + +WRITE16_MEMBER(pc88va_state::backupram_wp_0_w) +{ + m_backupram_wp = 0; +} + +READ8_MEMBER(pc88va_state::hdd_status_r) +{ + return 0x20; +} + +READ8_MEMBER(pc88va_state::pc88va_fdc_r) +{ + printf("%08x\n",offset); + + switch(offset*2) + { + case 0x00: return 0; // FDC mode register + case 0x02: return 0; // FDC control port 0 + case 0x04: return 0; // FDC control port 1 + /* ---x ---- RDY: (0) Busy (1) Ready */ + case 0x06: // FDC control port 2 + return 0; + } + + return 0xff; +} + +TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_timer) +{ + if(m_fdc_ctrl_2 & 4) // XTMASK + { + machine().device( "pic8259_slave")->ir3_w(0); + machine().device( "pic8259_slave")->ir3_w(1); + } +} + +TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_motor_start_0) +{ + machine().device("upd765:0")->get_device()->mon_w(0); + m_fdc_motor_status[0] = 1; +} + +TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_motor_start_1) +{ + machine().device("upd765:1")->get_device()->mon_w(0); + m_fdc_motor_status[1] = 1; +} + +void pc88va_state::pc88va_fdc_update_ready(floppy_image_device *, int) +{ + bool ready = m_fdc_ctrl_2 & 0x40; + + floppy_image_device *floppy; + floppy = machine().device("upd765:0")->get_device(); + if(floppy && ready) + ready = floppy->ready_r(); + floppy = machine().device("upd765:1")->get_device(); + if(floppy && ready) + ready = floppy->ready_r(); + + m_fdc->ready_w(ready); +} + +WRITE8_MEMBER(pc88va_state::pc88va_fdc_w) +{ + printf("%08x %02x\n",offset<<1,data); + switch(offset<<1) + { + /* + ---- ---x MODE: FDC op mode (0) Intelligent (1) DMA + */ + case 0x00: // FDC mode register + m_fdc_mode = data & 1; + #if TEST_SUBFDC + m_fdccpu->set_input_line(INPUT_LINE_HALT, (m_fdc_mode) ? ASSERT_LINE : CLEAR_LINE); + #endif + break; + /* + --x- ---- CLK: FDC clock selection (0) 4.8MHz (1) 8 MHz + ---x ---- DS1: Prohibition of the drive selection of FDC (0) Permission (1) Prohibition + ---- xx-- TD1/TD0: Drive 1/0 track density (0) 48 TPI (1) 96 TPI + ---- --xx RV1/RV0: Drive 1/0 mode selection (0) 2D and 2DD mode (1) 2HD mode + */ + case 0x02: // FDC control port 0 + machine().device("upd765:0")->get_device()->set_rpm(data & 0x01 ? 360 : 300); + machine().device("upd765:1")->get_device()->set_rpm(data & 0x02 ? 360 : 300); + + machine().device("upd765")->set_rate(data & 0x20 ? 500000 : 250000); + break; + /* + ---- x--- PCM: ? + ---- --xx M1/M0: Drive 1/0 motor control (0) NOP (1) Change motor status + */ + case 0x04: + if(data & 1) + { + machine().device("upd765:0")->get_device()->mon_w(1); + if(m_fdc_motor_status[0] == 0) + timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_0); + else + m_fdc_motor_status[0] = 0; + } + + if(data & 2) + { + machine().device("upd765:1")->get_device()->mon_w(1); + if(m_fdc_motor_status[1] == 0) + timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_1); + else + m_fdc_motor_status[1] = 0; + } + + break; + /* + x--- ---- FDCRST: FDC Reset + -xx- ---- FDCFRY FRYCEN: FDC force ready control + ---x ---- DMAE: DMA Enable (0) Prohibit DMA (1) Enable DMA + ---- -x-- XTMASK: FDC timer IRQ mask (0) Disable (1) Enable + ---- ---x TTRG: FDC timer trigger (0) FDC timer clearing (1) FDC timer start + */ + case 0x06: + //printf("%02x\n",data); + if(data & 1) + timer_set(attotime::from_msec(100), TIMER_PC88VA_FDC_TIMER); + + if((m_fdc_ctrl_2 & 0x10) != (data & 0x10)) + m_dmac->dreq2_w(1); + + if(data & 0x80) // correct? + machine().device("upd765")->reset(); + + m_fdc_ctrl_2 = data; + + pc88va_fdc_update_ready(NULL, 0); + + break; // FDC control port 2 + } +} + + +READ16_MEMBER(pc88va_state::sysop_r) +{ + UINT8 sys_op; + + sys_op = ioport("SYSOP_SW")->read() & 3; + + return 0xfffc | sys_op; // docs says all the other bits are high +} + +READ16_MEMBER(pc88va_state::screen_ctrl_r) +{ + return m_screen_ctrl_reg; +} + +WRITE16_MEMBER(pc88va_state::screen_ctrl_w) +{ + m_screen_ctrl_reg = data; +} + +TIMER_CALLBACK_MEMBER(pc88va_state::t3_mouse_callback) +{ + if(m_timer3_io_reg & 0x80) + { + machine().device("pic8259_slave")->ir5_w(0); + machine().device("pic8259_slave")->ir5_w(1); + m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3))); + } +} + +WRITE8_MEMBER(pc88va_state::timer3_ctrl_reg_w) +{ + /* + x--- ---- MINTEN (TCU irq enable) + ---- --xx general purpose timer 3 interval (120, 60, 30, 15) + */ + m_timer3_io_reg = data; + + if(data & 0x80) + m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3))); + else + { + machine().device("pic8259_slave")->ir5_w(0); + m_t3_mouse_timer->adjust(attotime::never); + } +} + +WRITE16_MEMBER(pc88va_state::video_pri_w) +{ + COMBINE_DATA(&m_video_pri_reg[offset]); +} + +READ8_MEMBER(pc88va_state::backupram_dsw_r) +{ + UINT16 *knj_ram = (UINT16 *)(memregion("kanji")->base()); + + if(offset == 0) + return knj_ram[(0x50000 + 0x1fc2) / 2] & 0xff; + + return knj_ram[(0x50000 + 0x1fc6) / 2] & 0xff; +} + +WRITE8_MEMBER(pc88va_state::sys_port1_w) +{ + // ... +} + +#if !TEST_SUBFDC +READ8_MEMBER(pc88va_state::no_subfdc_r) +{ + return machine().rand(); +} +#endif + +static ADDRESS_MAP_START( pc88va_io_map, AS_IO, 16, pc88va_state ) + AM_RANGE(0x0000, 0x000f) AM_READ8(key_r,0xffff) // Keyboard ROW reading +// AM_RANGE(0x0010, 0x0010) Printer / Calendar Clock Interface + AM_RANGE(0x0020, 0x0021) AM_NOP // RS-232C + AM_RANGE(0x0030, 0x0031) AM_READWRITE8(backupram_dsw_r,sys_port1_w,0xffff) // 0x30 (R) DSW1 (W) Text Control Port 0 / 0x31 (R) DSW2 (W) System Port 1 +// AM_RANGE(0x0032, 0x0032) (R) ? (W) System Port 2 +// AM_RANGE(0x0034, 0x0034) GVRAM Control Port 1 +// AM_RANGE(0x0035, 0x0035) GVRAM Control Port 2 + AM_RANGE(0x0040, 0x0041) AM_READ(sys_port4_r) // (R) System Port 4 (W) System port 3 (strobe port) + AM_RANGE(0x0044, 0x0045) AM_MIRROR(0x0002) AM_DEVREADWRITE8("ym", ym2203_device, read, write, 0xffff) +// AM_RANGE(0x005c, 0x005c) (R) GVRAM status +// AM_RANGE(0x005c, 0x005f) (W) GVRAM selection +// AM_RANGE(0x0070, 0x0070) ? (*) +// AM_RANGE(0x0071, 0x0071) Expansion ROM select (*) +// AM_RANGE(0x0078, 0x0078) Memory offset increment (*) +// AM_RANGE(0x0080, 0x0081) HDD related + AM_RANGE(0x0082, 0x0083) AM_READ8(hdd_status_r,0x00ff)// HDD control, byte access 7-0 +// AM_RANGE(0x00bc, 0x00bf) d8255 1 +// AM_RANGE(0x00e2, 0x00e3) Expansion RAM selection (*) +// AM_RANGE(0x00e4, 0x00e4) 8214 IRQ control (*) +// AM_RANGE(0x00e6, 0x00e6) 8214 IRQ mask (*) +// AM_RANGE(0x00e8, 0x00e9) ? (*) +// AM_RANGE(0x00ec, 0x00ed) ? (*) + #if TEST_SUBFDC + AM_RANGE(0x00fc, 0x00ff) AM_DEVREADWRITE8("d8255_2", i8255_device, read, write, 0xffff) // d8255 2, FDD + #else + AM_RANGE(0x00fc, 0x00ff) AM_READ8(no_subfdc_r,0xffff) AM_WRITENOP + #endif + + AM_RANGE(0x0100, 0x0101) AM_READWRITE(screen_ctrl_r,screen_ctrl_w) // Screen Control Register +// AM_RANGE(0x0102, 0x0103) Graphic Screen Control Register + AM_RANGE(0x0106, 0x0109) AM_WRITE(video_pri_w) // Palette Control Register (priority) / Direct Color Control Register (priority) +// AM_RANGE(0x010a, 0x010b) Picture Mask Mode Register +// AM_RANGE(0x010c, 0x010d) Color Palette Mode Register +// AM_RANGE(0x010e, 0x010f) Backdrop Color Register +// AM_RANGE(0x0110, 0x0111) Color Code/Plain Mask Register +// AM_RANGE(0x0124, 0x0125) ? (related to Transparent Color of Graphic Screen 0) +// AM_RANGE(0x0126, 0x0127) ? (related to Transparent Color of Graphic Screen 1) +// AM_RANGE(0x012e, 0x012f) ? (related to Transparent Color of Text/Sprite) +// AM_RANGE(0x0130, 0x0137) Picture Mask Parameter + AM_RANGE(0x0142, 0x0143) AM_READWRITE8(idp_status_r,idp_command_w,0x00ff) //Text Controller (IDP) - (R) Status (W) command + AM_RANGE(0x0146, 0x0147) AM_WRITE8(idp_param_w,0x00ff) //Text Controller (IDP) - (R/W) Parameter +// AM_RANGE(0x0148, 0x0149) Text control port 1 +// AM_RANGE(0x014c, 0x014f) ? CG Port + AM_RANGE(0x0150, 0x0151) AM_READ(sysop_r) // System Operational Mode + AM_RANGE(0x0152, 0x0153) AM_READWRITE(bios_bank_r,bios_bank_w) // Memory Map Register +// AM_RANGE(0x0154, 0x0155) Refresh Register (wait states) + AM_RANGE(0x0156, 0x0157) AM_READ8(rom_bank_r,0x00ff) // ROM bank status +// AM_RANGE(0x0158, 0x0159) Interruption Mode Modification +// AM_RANGE(0x015c, 0x015f) NMI mask port (strobe port) + AM_RANGE(0x0160, 0x016f) AM_DEVREADWRITE8("dmac", am9517a_device, read, write, 0xffff) // DMA Controller + AM_RANGE(0x0184, 0x0187) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x0188, 0x018b) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff) // ICU, also controls 8214 emulation +// AM_RANGE(0x0190, 0x0191) System Port 5 +// AM_RANGE(0x0196, 0x0197) Keyboard sub CPU command port + AM_RANGE(0x0198, 0x0199) AM_WRITE(backupram_wp_1_w) //Backup RAM write inhibit + AM_RANGE(0x019a, 0x019b) AM_WRITE(backupram_wp_0_w) //Backup RAM write permission + AM_RANGE(0x01a0, 0x01a7) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0x00ff)// vTCU (timer counter unit) + AM_RANGE(0x01a8, 0x01a9) AM_WRITE8(timer3_ctrl_reg_w,0x00ff) // General-purpose timer 3 control port + AM_RANGE(0x01b0, 0x01b7) AM_READWRITE8(pc88va_fdc_r,pc88va_fdc_w,0x00ff)// FDC related (765) + AM_RANGE(0x01b8, 0x01bb) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff) +// AM_RANGE(0x01c0, 0x01c1) ? + AM_RANGE(0x01c6, 0x01c7) AM_WRITENOP // ??? + AM_RANGE(0x01c8, 0x01cf) AM_DEVREADWRITE8("d8255_3", i8255_device, read, write,0xff00) //i8255 3 (byte access) +// AM_RANGE(0x01d0, 0x01d1) Expansion RAM bank selection + AM_RANGE(0x0200, 0x021f) AM_RAM // Frame buffer 0 control parameter + AM_RANGE(0x0220, 0x023f) AM_RAM // Frame buffer 1 control parameter + AM_RANGE(0x0240, 0x025f) AM_RAM // Frame buffer 2 control parameter + AM_RANGE(0x0260, 0x027f) AM_RAM // Frame buffer 3 control parameter + AM_RANGE(0x0300, 0x033f) AM_RAM_WRITE(palette_ram_w) AM_SHARE("palram") // Palette RAM (xBBBBxRRRRxGGGG format) + +// AM_RANGE(0x0500, 0x05ff) GVRAM +// AM_RANGE(0x1000, 0xfeff) user area (???) + AM_RANGE(0xff00, 0xffff) AM_NOP // CPU internal use +ADDRESS_MAP_END +// (*) are specific N88 V1 / V2 ports + +TIMER_CALLBACK_MEMBER(pc88va_state::pc8801fd_upd765_tc_to_zero) +{ + machine().device("upd765")->tc_w(false); +} + +/* FDC subsytem CPU */ +#if TEST_SUBFDC +static ADDRESS_MAP_START( pc88va_z80_map, AS_PROGRAM, 8, pc88va_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x4000, 0x7fff) AM_RAM +ADDRESS_MAP_END + +READ8_MEMBER(pc88va_state::upd765_tc_r) +{ + machine().device("upd765")->tc_w(true); + timer_set(attotime::from_usec(50), TIMER_PC8801FD_UPD765_TC_TO_ZERO); + return 0; +} + +WRITE8_MEMBER(pc88va_state::fdc_irq_vector_w) +{ + m_fdc_irq_opcode = data; +} + +WRITE8_MEMBER(pc88va_state::upd765_mc_w) +{ + machine().device("upd765:0")->get_device()->mon_w(!(data & 1)); + machine().device("upd765:1")->get_device()->mon_w(!(data & 2)); +} + +static ADDRESS_MAP_START( pc88va_z80_io_map, AS_IO, 8, pc88va_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf0, 0xf0) AM_WRITE(fdc_irq_vector_w) // Interrupt Opcode Port +// AM_RANGE(0xf4, 0xf4) // Drive Control Port + AM_RANGE(0xf8, 0xf8) AM_READWRITE(upd765_tc_r,upd765_mc_w) // (R) Terminal Count Port (W) Motor Control Port + AM_RANGE(0xfa, 0xfb) AM_DEVICE("upd765", upd765a_device, map ) + AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("d8255_2s", i8255_device, read, write) +ADDRESS_MAP_END +#endif + +/* TODO: active low or active high? */ +static INPUT_PORTS_START( pc88va ) + PORT_START("KEY0") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_START("KEY1") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("= (PAD)") // PORT_CODE(KEYCODE_EQUAL_PAD) PORT_CHAR(UCHAR_MAMEKEY(EQUAL_PAD)) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", (PAD)") // PORT_CODE(KEYCODE_EQUAL_PAD) PORT_CHAR(UCHAR_MAMEKEY(EQUAL_PAD)) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". (PAD)") // PORT_CODE(KEYCODE_EQUAL_PAD) PORT_CHAR(UCHAR_MAMEKEY(EQUAL_PAD)) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RETURN (PAD)") //PORT_CODE(KEYCODE_RETURN_PAD) PORT_CHAR(UCHAR_MAMEKEY(RETURN_PAD)) + + PORT_START("KEY2") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@") // PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("KEY3") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("KEY4") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + + PORT_START("KEY5") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("\xC2\xA5") /* Yen */ + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^") + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") + + PORT_START("KEY6") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("KEY7") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(": *") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("; +") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", <") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". >") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ ?") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ ?") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("KEY8") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CLR") // PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) /* Up */ + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) /* Right */ + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("INSDEL") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + + PORT_START("KEY9") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("STOP") // PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1 (mirror)") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2 (mirror)") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3 (mirror)") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4 (mirror)") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5 (mirror)") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SPACES") // PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + + PORT_START("KEYA") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) /* Down */ + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) /* Left */ + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("HELP") // PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("COPY") // PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("- (mirror)") // PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") // PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + + PORT_START("KEYB") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_PGUP) /* Roll Up */ + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_PGDN) /* Roll Down */ + PORT_BIT(0xfc,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYC") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + + PORT_START("KEYD") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) // Conversion? + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) // Decision? + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + + /* TODO: I don't understand the meaning of several of these */ + PORT_START("KEYE") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) + PORT_BIT(0xc0,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("KEYF") + PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED) + + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x01, "CRT Mode" ) + PORT_DIPSETTING( 0x01, "15.7 KHz" ) + PORT_DIPSETTING( 0x00, "24.8 KHz" ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("SPEED_SW") + PORT_DIPNAME( 0x01, 0x01, "Speed Mode" ) + PORT_DIPSETTING( 0x01, "H Mode" ) + PORT_DIPSETTING( 0x00, "S Mode" ) + + PORT_START("SYSOP_SW") + PORT_DIPNAME( 0x03, 0x01, "System Operational Mode" ) +// PORT_DIPSETTING( 0x00, "Reserved" ) + PORT_DIPSETTING( 0x01, "N88 V2 Mode" ) + PORT_DIPSETTING( 0x02, "N88 V1 Mode" ) +// PORT_DIPSETTING( 0x03, "???" ) +INPUT_PORTS_END + +static const gfx_layout pc88va_chars_8x8 = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout pc88va_chars_16x16 = +{ + 16,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, + 16*16 +}; + +/* decoded for debugging purpose, this will be nuked in the end... */ +static GFXDECODE_START( pc88va ) + GFXDECODE_ENTRY( "kanji", 0x00000, pc88va_chars_8x8, 0, 1 ) + GFXDECODE_ENTRY( "kanji", 0x00000, pc88va_chars_16x16, 0, 1 ) +GFXDECODE_END + +READ8_MEMBER(pc88va_state::cpu_8255_c_r) +{ + return m_i8255_1_pc >> 4; +} + +WRITE8_MEMBER(pc88va_state::cpu_8255_c_w) +{ + m_i8255_0_pc = data; +} + +READ8_MEMBER(pc88va_state::fdc_8255_c_r) +{ + return m_i8255_0_pc >> 4; +} + +WRITE8_MEMBER(pc88va_state::fdc_8255_c_w) +{ + m_i8255_1_pc = data; +} + +READ8_MEMBER(pc88va_state::r232_ctrl_porta_r) +{ + UINT8 sw5, sw4, sw3, sw2,speed_sw; + + speed_sw = (ioport("SPEED_SW")->read() & 1) ? 0x20 : 0x00; + sw5 = (ioport("DSW")->read() & 0x10); + sw4 = (ioport("DSW")->read() & 0x08); + sw3 = (ioport("DSW")->read() & 0x04); + sw2 = (ioport("DSW")->read() & 0x02); + + return 0xc1 | sw5 | sw4 | sw3 | sw2 | speed_sw; +} + +READ8_MEMBER(pc88va_state::r232_ctrl_portb_r) +{ + UINT8 xsw1; + + xsw1 = (ioport("DSW")->read() & 1) ? 0 : 8; + + return 0xf7 | xsw1; +} + +READ8_MEMBER(pc88va_state::r232_ctrl_portc_r) +{ + return 0xff; +} + +WRITE8_MEMBER(pc88va_state::r232_ctrl_porta_w) +{ + // ... +} + +WRITE8_MEMBER(pc88va_state::r232_ctrl_portb_w) +{ + // ... +} + +WRITE8_MEMBER(pc88va_state::r232_ctrl_portc_w) +{ + // ... +} + +READ8_MEMBER(pc88va_state::get_slave_ack) +{ + if (offset==7) { // IRQ = 7 + return machine().device( "pic8259_slave")->acknowledge(); + } + return 0x00; +} + +void pc88va_state::machine_start() +{ + m_t3_mouse_timer = timer_alloc(TIMER_T3_MOUSE_CALLBACK); + m_t3_mouse_timer->adjust(attotime::never); + floppy_image_device *floppy; + floppy = machine().device("upd765:0")->get_device(); + if(floppy) + floppy->setup_ready_cb(floppy_image_device::ready_cb(FUNC(pc88va_state::pc88va_fdc_update_ready), this)); + + floppy = machine().device("upd765:1")->get_device(); + if(floppy) + floppy->setup_ready_cb(floppy_image_device::ready_cb(FUNC(pc88va_state::pc88va_fdc_update_ready), this)); + + machine().device("upd765:0")->get_device()->set_rpm(300); + machine().device("upd765:1")->get_device()->set_rpm(300); + machine().device("upd765")->set_rate(250000); +} + +void pc88va_state::machine_reset() +{ + UINT8 *ROM00 = memregion("rom00")->base(); + UINT8 *ROM10 = memregion("rom10")->base(); + + membank("rom10_bank")->set_base(&ROM10[0x00000]); + membank("rom00_bank")->set_base(&ROM00[0x00000]); + + m_bank_reg = 0x4100; + m_backupram_wp = 1; + + /* default palette */ + { + UINT8 i; + for(i=0;i<32;i++) + m_palette->set_pen_color(i,pal1bit((i & 2) >> 1),pal1bit((i & 4) >> 2),pal1bit(i & 1)); + } + + m_tsp.tvram_vreg_offset = 0; + + m_fdc_mode = 0; + m_fdc_irq_opcode = 0x00; //0x7f ld a,a ! + + #if TEST_SUBFDC + m_fdccpu->set_input_line_vector(0, 0); + #endif + + m_fdc_motor_status[0] = 0; + m_fdc_motor_status[1] = 0; +} + +INTERRUPT_GEN_MEMBER(pc88va_state::pc88va_vrtc_irq) +{ + machine().device("pic8259_master")->ir2_w(0); + machine().device("pic8259_master")->ir2_w(1); +} + +WRITE_LINE_MEMBER(pc88va_state::pc88va_pit_out0_changed) +{ + if(state) + { + machine().device("pic8259_master")->ir0_w(0); + machine().device("pic8259_master")->ir0_w(1); + } +} + +WRITE_LINE_MEMBER( pc88va_state::fdc_drq ) +{ + printf("%02x DRQ\n",state); + m_dmac->dreq2_w(state); +} + +WRITE_LINE_MEMBER( pc88va_state::fdc_irq ) +{ + if(m_fdc_mode && state) + { + //printf("%d\n",state); + machine().device( "pic8259_slave")->ir3_w(0); + machine().device( "pic8259_slave")->ir3_w(1); + } + #if TEST_SUBFDC + else + m_fdccpu->set_input_line(0, HOLD_LINE); + #endif +} + +WRITE_LINE_MEMBER(pc88va_state::pc88va_hlda_w) +{ +// m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + m_dmac->hack_w(state); + +// printf("%02x HLDA\n",state); +} + +WRITE_LINE_MEMBER( pc88va_state::pc88va_tc_w ) +{ + /* floppy terminal count */ + m_fdc->tc_w(state); + +// printf("TC %02x\n",state); +} + + +READ8_MEMBER(pc88va_state::fdc_dma_r) +{ + printf("R DMA\n"); + return m_fdc->dma_r(); +} + +WRITE8_MEMBER(pc88va_state::fdc_dma_w) +{ + printf("W DMA %08x\n",data); + m_fdc->dma_w(data); +} + +FLOPPY_FORMATS_MEMBER( pc88va_state::floppy_formats ) + FLOPPY_XDF_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( pc88va_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +READ8_MEMBER(pc88va_state::dma_memr_cb) +{ +printf("%08x\n",offset); + return 0; +} + +WRITE8_MEMBER(pc88va_state::dma_memw_cb) +{ +printf("%08x %02x\n",offset,data); +} + + +static MACHINE_CONFIG_START( pc88va, pc88va_state ) + + MCFG_CPU_ADD("maincpu", V30, 8000000) /* 8 MHz */ + MCFG_CPU_PROGRAM_MAP(pc88va_map) + MCFG_CPU_IO_MAP(pc88va_io_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc88va_state, pc88va_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + +#if TEST_SUBFDC + MCFG_CPU_ADD("fdccpu", Z80, 8000000) /* 8 MHz */ + MCFG_CPU_PROGRAM_MAP(pc88va_z80_map) + MCFG_CPU_IO_MAP(pc88va_z80_io_map) + + MCFG_QUANTUM_PERFECT_CPU("maincpu") +#endif + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(pc88va_state, screen_update_pc88va) + + MCFG_PALETTE_ADD("palette", 32) +// MCFG_PALETTE_INIT_OWNER(pc88va_state, pc8801 ) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc88va ) + + MCFG_DEVICE_ADD("d8255_2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(DEVREAD8("d8255_2s", i8255_device, pb_r)) + MCFG_I8255_IN_PORTB_CB(DEVREAD8("d8255_2s", i8255_device, pa_r)) + MCFG_I8255_IN_PORTC_CB(READ8(pc88va_state, cpu_8255_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc88va_state, cpu_8255_c_w)) + + MCFG_DEVICE_ADD("d8255_3", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pc88va_state, r232_ctrl_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pc88va_state, r232_ctrl_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pc88va_state, r232_ctrl_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pc88va_state, r232_ctrl_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pc88va_state, r232_ctrl_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc88va_state, r232_ctrl_portc_w)) + + MCFG_DEVICE_ADD("d8255_2s", I8255, 0) + MCFG_I8255_IN_PORTA_CB(DEVREAD8("d8255_2", i8255_device, pb_r)) + MCFG_I8255_IN_PORTB_CB(DEVREAD8("d8255_2", i8255_device, pa_r)) + MCFG_I8255_IN_PORTC_CB(READ8(pc88va_state, fdc_8255_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc88va_state, fdc_8255_c_w)) + + MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(pc88va_state,get_slave_ack) ) + + MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL ) + + MCFG_DEVICE_ADD("dmac", AM9517A, 8000000) /* ch2 is FDC, ch0/3 are "user". ch1 is unused */ + MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(pc88va_state, pc88va_hlda_w)) + MCFG_AM9517A_OUT_EOP_CB(WRITELINE(pc88va_state, pc88va_tc_w)) + MCFG_AM9517A_IN_IOR_2_CB(READ8(pc88va_state, fdc_dma_r)) + MCFG_AM9517A_OUT_IOW_2_CB(WRITE8(pc88va_state, fdc_dma_w)) + MCFG_AM9517A_IN_MEMR_CB(READ8(pc88va_state, dma_memr_cb)) + MCFG_AM9517A_OUT_MEMW_CB(WRITE8(pc88va_state, dma_memw_cb)) + + MCFG_UPD765A_ADD("upd765", false, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pc88va_state, fdc_irq)) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pc88va_state, fdc_drq)) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", pc88va_floppies, "525hd", pc88va_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", pc88va_floppies, "525hd", pc88va_state::floppy_formats) + MCFG_SOFTWARE_LIST_ADD("disk_list","pc88va") + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(8000000) /* general purpose timer 1 */ + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(pc88va_state, pc88va_pit_out0_changed)) + MCFG_PIT8253_CLK1(8000000) /* BEEP frequency setting */ + MCFG_PIT8253_CLK2(8000000) /* RS232C baud rate setting */ + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ym", YM2203, 3993600) //unknown clock / divider + MCFG_SOUND_ROUTE(0, "mono", 0.25) + MCFG_SOUND_ROUTE(1, "mono", 0.25) + MCFG_SOUND_ROUTE(2, "mono", 0.50) + MCFG_SOUND_ROUTE(3, "mono", 0.50) +MACHINE_CONFIG_END + + +ROM_START( pc88va2 ) + ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x100000, "fdccpu", ROMREGION_ERASEFF ) + ROM_LOAD( "vasubsys.rom", 0x0000, 0x2000, CRC(08962850) SHA1(a9375aa480f85e1422a0e1385acb0ea170c5c2e0) ) + + ROM_REGION( 0x100000, "rom00", ROMREGION_ERASEFF ) // 0xe0000 - 0xeffff + ROM_LOAD( "varom00_va2.rom", 0x00000, 0x80000, CRC(98c9959a) SHA1(bcaea28c58816602ca1e8290f534360f1ca03fe8) ) + ROM_LOAD( "varom08_va2.rom", 0x80000, 0x20000, CRC(eef6d4a0) SHA1(47e5f89f8b0ce18ff8d5d7b7aef8ca0a2a8e3345) ) + + ROM_REGION( 0x20000, "rom10", 0 ) // 0xf0000 - 0xfffff + ROM_LOAD( "varom1_va2.rom", 0x00000, 0x20000, CRC(7e767f00) SHA1(dd4f4521bfbb068f15ab3bcdb8d47c7d82b9d1d4) ) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x80000, "kanji", ROMREGION_ERASEFF ) + ROM_LOAD( "vafont_va2.rom", 0x00000, 0x50000, BAD_DUMP CRC(b40d34e4) SHA1(a0227d1fbc2da5db4b46d8d2c7e7a9ac2d91379f) ) // should be splitted + + ROM_REGION( 0x80000, "dictionary", 0 ) + ROM_LOAD( "vadic_va2.rom", 0x00000, 0x80000, CRC(a6108f4d) SHA1(3665db538598abb45d9dfe636423e6728a812b12) ) + + ROM_REGION( 0x10000, "tvram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x40000, "gvram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START( pc88va ) + ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x100000, "fdccpu", ROMREGION_ERASEFF ) + ROM_LOAD( "vasubsys.rom", 0x0000, 0x2000, CRC(08962850) SHA1(a9375aa480f85e1422a0e1385acb0ea170c5c2e0) ) + + ROM_REGION( 0x100000, "rom00", ROMREGION_ERASEFF ) // 0xe0000 - 0xeffff + ROM_LOAD( "varom00.rom", 0x00000, 0x80000, CRC(8a853b00) SHA1(1266ba969959ff25433ecc900a2caced26ef1a9e)) + ROM_LOAD( "varom08.rom", 0x80000, 0x20000, CRC(154803cc) SHA1(7e6591cd465cbb35d6d3446c5a83b46d30fafe95)) + + ROM_REGION( 0x20000, "rom10", 0 ) // 0xf0000 - 0xfffff + ROM_LOAD( "varom1.rom", 0x00000, 0x20000, CRC(0783b16a) SHA1(54536dc03238b4668c8bb76337efade001ec7826)) + + /* No idea of the proper size: it has never been dumped */ + ROM_REGION( 0x2000, "audiocpu", 0) + ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x80000, "kanji", ROMREGION_ERASEFF ) + ROM_LOAD( "vafont.rom", 0x0000, 0x50000, BAD_DUMP CRC(faf7c466) SHA1(196b3d5b7407cb4f286ffe5c1e34ebb1f6905a8c)) // should be splitted + + ROM_REGION( 0x80000, "dictionary", 0 ) + ROM_LOAD( "vadic.rom", 0x0000, 0x80000, CRC(f913c605) SHA1(5ba1f3578d0aaacdaf7194a80e6d520c81ae55fb)) + + ROM_REGION( 0x10000, "tvram", ROMREGION_ERASE00 ) + + ROM_REGION( 0x40000, "gvram", ROMREGION_ERASE00 ) +ROM_END + + + + +COMP( 1987, pc88va, 0, 0, pc88va, pc88va, driver_device, 0, "Nippon Electronic Company", "PC-88VA", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1988, pc88va2, pc88va, 0, pc88va, pc88va, driver_device, 0, "Nippon Electronic Company", "PC-88VA2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +//COMP( 1988, pc88va3, pc88va, 0, pc88va, pc88va, driver_device, 0, "Nippon Electronic Company", "PC-88VA3", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pc9801.c b/src/mame/drivers/pc9801.c new file mode 100644 index 00000000000..739cbe37a10 --- /dev/null +++ b/src/mame/drivers/pc9801.c @@ -0,0 +1,3886 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese,Carl +/*************************************************************************************************** + + PC-9801 (c) 1981 NEC + + driver by Angelo Salese + + TODO: + - proper 8251 uart hook-up on keyboard + - SASI /SCSI support; + - Write a PC80S31K device (also used on PC-8801 and PC-88VA, it's the FDC + Z80 sub-system); + - Finish DIP-Switches support + - text scrolling + - GRCG+ + - rewrite using slot devices + - some later SWs put "Invalid command byte 05" (Absolutely Mahjong on Epson logo) + - investigate on POR bit + - test 2dd more + + TODO (PC-9801RS): + - extra features; + - keyboard shift doesn't seem to disable properly; + - clean-up duplicate code; + + TODO (PC-9821): + - fix CPU for some clones; + - "cache error" + - undumped IDE ROM, kludged to work + - Compatibility is untested; + + TODO: (PC-486MU) + - Tries to read port C of i8255_sys (-> 0x35) at boot without setting up the control + port. This causes a jump to invalid program area; + - Dies on ARTIC check; + - Presumably one ROM is undumped? + + TODO: (PC-9821AP) + - No way to exit the initial loop. Code looks broken/bad dump? + + floppy issues TODO (certain fail) + - Unsupported disk types: *.nfd, *.fdd, *.nhd + - 46 Okunen Monogatari - The Shinkaron + - AD&D Champions of Krynn + - AI Shougi (asserts upon loading, 3'5 image?) + - Aki no Tsukasa no Fushigi no Kabe (works in PC-9801RS only) + - Aoki Ookami no Shiroki Mejika - Gengis Khan + - Arcshu + - Arcus 2 + - Art Jigsaw + - Atlantia (disk swap?) + - Azusa 108 Jimusho + - Bacta 2 + - BattleTech (disk swap?) + - Bay City Elegy (disk swap?) + - Beast (keeps reading command sense) + - Beast 2 + - Bells Avenue (disk swap?) + - Bible Master 2 (at new game loading) + - Birdy World + + - Bokosuka Wars + - Jangou 2: floppy fails to load after the title screen; + + List of per-game TODO: + - 38 Man Kilo no Kokuu: doesn't seem possible to skip the intro? + - 4D Boxing: inputs are unresponsive + - A Ressha de Ikou 2: missing text (PC-9801RS only); + - Absolutely Mahjong: Transitions are too fast. + - Agumix Selects!: needs GDC = 5 MHz, interlace doesn't work properly; + - Alice no Yakata: doesn't set bitmap interlace properly, can't do disk swaps via the File Manager; + - Anniversary - Memories of Summer: thinks that a button is pressed; + - Another Genesis: fails loading; + - Apple Club 1: how to pass an hand? + - Arctic: keyboard doesn't work? + - Arcus 3: moans with a JP message "not enough memory (needs 640kb to start)"; + - Armored Flagship Atragon: needs HDD install + - Arquephos: needs extra sound board(s)? + - Asoko no Koufuku: black screen with BGM, waits at 0x225f6; + - Band-Kun: (how to run this without installing?) + - Battle Chess: wants some dip-switches to be on in DSW4, too slow during IA thinking? + - Bishoujo Audition: Moans with a "(program) ended. remove the floppy disk and turn off the poewr." + - Bishoujo Hunter ZX: Doesn't color cycle at intro (seems stuck?), doesn't clear text selection at new game screen; + - Bishoujo Shanshinkan: has white rectangles all over the place; + - Bishoujo Tsuushin: hangs with a beep while writing some intro text; + + - Bomber Quest: beeps when speech is supposed to be played (0->1 to i/o port 0xfe8e?) + - Deflektor: no sound, moans about a DIP-sw during loading, very slow on non-pc9801rs machines; + - Dragon Buster: slight issue with window masking; + - Far Side Moon: doesn't detect sound board (tied to 0x00ec ports) + - Jan Borg Suzume: gets stuck at a pic8259 read; + - Karateka: no sound? + - Lovely Horror: Doesn't show kanji, tries to read it thru the 0xa9 port; + - Madou Monogatari 1/2/3: doesn't display bitmap gfxs during gameplay; + - Quarth: title screen is broken after first attract play; + - Princess Maker 2: mouse is buggy; + - Princess Maker 2: screen transitions are very ugly (btanb?) + - Puyo Puyo: beeps out when it's supposed to play samples, Not supposed to use ADPCM, is it a PIT issue? + - Puzznic: trips illegal irq 0x41 (?), prints an error on screen. (PC-9801RS only, writes an 1 to 0x69d2f for whatever reason, almost surely a btanb) + - Runner's High: wrong double height on the title screen; + - Sokoban Perfect: hangs at title screen, after loading the menu; + - Sorcerian, Twilight Zone 3: Fails initial booting, issue with 2dd irq? + - The Incredible Machine: hangs at main menu (YM mis-fires irq?) + - Uchiyama Aki no Chou Bangai: keyboard irq is fussy (sometimes it doesn't register a key press); + - Uno: has minor EGC gfx bugs; + - Windows 2: EGC drawing issue (byte wide writes?) + + per-game TODO (PC-9821): + - Battle Skin Panic: gfx bugs at the Gainax logo, it crashes after it; + - Policenauts: EMS error at boot; + + Notes: + - Animahjong V3 makes advantage of the possibility of installing 2 sound boards, where SFX and BGMs are played on separate chips. + - Apple Club 1/2 needs data disks to load properly; + - Beast Lord: needs a titan.fnt, in MS-DOS + - To deprotect BASIC modules set 0xcd7 in ram to 0 + +======================================================================================== + + This series features a huge number of models released between 1982 and 1997. They + were not IBM PC-compatible, but they had similar hardware (and software: in the + 1990s, they run MS Windows as OS) + + Models: + + | CPU | RAM | Drives | CBus| Release | + PC-9801 | 8086 @ 5 | 128 KB | - | 6 | 1982/10 | + PC-9801F1 | 8086-2 @ 5/8 | 128 KB | 5"2DDx1 | 4 | 1983/10 | + PC-9801F2 | 8086-2 @ 5/8 | 128 KB | 5"2DDx2 | 4 | 1983/10 | + PC-9801E | 8086-2 @ 5/8 | 128 KB | - | 6 | 1983/11 | + PC-9801F3 | 8086-2 @ 5/8 | 256 KB | 5"2DDx1, 10M SASI HDD | 2 | 1984/10 | + PC-9801M2 | 8086-2 @ 5/8 | 256 KB | 5"2HDx2 | 4 | 1984/11 | + PC-9801M3 | 8086-2 @ 5/8 | 256 KB | 5"2HDx1, 20M SASI HDD | 3 | 1985/02 | + PC-9801U2 | V30 @ 8 | 128 KB | 3.5"2HDx2 | 2 | 1985/05 | + PC-98XA1 | 80286 @ 8 | 512 KB | - | 6 | 1985/05 | + PC-98XA2 | 80286 @ 8 | 512 KB | 5"2DD/2HDx2 | 6 | 1985/05 | + PC-98XA3 | 80286 @ 8 | 512 KB | 5"2DD/2HDx1, 20M SASI HDD | 6 | 1985/05 | + PC-9801VF2 | V30 @ 8 | 384 KB | 5"2DDx2 | 4 | 1985/07 | + PC-9801VM0 | V30 @ 8/10 | 384 KB | - | 4 | 1985/07 | + PC-9801VM2 | V30 @ 8/10 | 384 KB | 5"2DD/2HDx2 | 4 | 1985/07 | + PC-9801VM4 | V30 @ 8/10 | 384 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1985/10 | + PC-98XA11 | 80286 @ 8 | 512 KB | - | 6 | 1986/05 | + PC-98XA21 | 80286 @ 8 | 512 KB | 5"2DD/2HDx2 | 6 | 1986/05 | + PC-98XA31 | 80286 @ 8 | 512 KB | 5"2DD/2HDx1, 20M SASI HDD | 6 | 1986/05 | + PC-9801UV2 | V30 @ 8/10 | 384 KB | 3.5"2DD/2HDx2 | 2 | 1986/05 | + PC-98LT1 | V50 @ 8 | 384 KB | 3.5"2DD/2HDx1 | 0 | 1986/11 | + PC-98LT2 | V50 @ 8 | 384 KB | 3.5"2DD/2HDx1 | 0 | 1986/11 | + PC-9801VM21 | V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 4 | 1986/11 | + PC-9801VX0 | 80286 @ 8 & V30 @ 8/10 | 640 KB | - | 4 | 1986/11 | + PC-9801VX2 | 80286 @ 8 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 4 | 1986/11 | + PC-9801VX4 | 80286 @ 8 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1986/11 | + PC-9801VX4/WN | 80286 @ 8 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1986/11 | + PC-98XL1 | 80286 @ 8 & V30 @ 8/10 | 1152 KB | - | 4 | 1986/12 | + PC-98XL2 | 80286 @ 8 & V30 @ 8/10 | 1152 KB | 5"2DD/2HDx2 | 4 | 1986/12 | + PC-98XL4 | 80286 @ 8 & V30 @ 8/10 | 1152 KB | 5"2DD/2HDx1, 20M SASI HDD | 4 | 1986/12 | + PC-9801VX01 | 80286-10 @ 8/10 & V30 @ 8/10 | 640 KB | - | 4 | 1987/06 | + PC-9801VX21 | 80286-10 @ 8/10 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 4 | 1987/06 | + PC-9801VX41 | 80286-10 @ 8/10 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1987/06 | + PC-9801UV21 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1987/06 | + PC-98XL^2 | i386DX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1987/10 | + PC-98LT11 | V50 @ 8 | 640 KB | 3.5"2DD/2HDx1 | 0 | 1987/10 | + PC-98LT21 | V50 @ 8 | 640 KB | 3.5"2DD/2HDx1 | 0 | 1987/10 | + PC-9801UX21 | 80286-10 @ 10 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 3 | 1987/10 | + PC-9801UX41 | 80286-10 @ 10 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 20M SASI HDD | 3 | 1987/10 | + PC-9801LV21 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 0 | 1988/03 | + PC-9801CV21 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1988/03 | + PC-9801UV11 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1988/03 | + PC-9801RA2 | i386DX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1988/07 | + PC-9801RA5 | i386DX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1988/07 | + PC-9801RX2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1988/07 | + PC-9801RX4 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1988/07 | + PC-98LT22 | V50 @ 8 | 640 KB | 3.5"2DD/2HDx1 | 0 | 1988/11 | + PC-98LS2 | i386SX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 0 | 1988/11 | + PC-98LS5 | i386SX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 0 | 1988/11 | + PC-9801VM11 | V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 4 | 1988/11 | + PC-9801LV22 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 0 | 1989/01 | + PC-98RL2 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1989/02 | + PC-98RL5 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1989/02 | + PC-9801EX2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 3 | 1989/04 | + PC-9801EX4 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 20M SASI HDD | 3 | 1989/04 | + PC-9801ES2 | i386SX-16 @ 16 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2 | 3 | 1989/04 | + PC-9801ES5 | i386SX-16 @ 16 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 3 | 1989/04 | + PC-9801LX2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 0 | 1989/04 | + PC-9801LX4 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 20M SASI HDD | 0 | 1989/04 | + PC-9801LX5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 0 | 1989/06 | + PC-98DO | V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 1 | 1989/06 | + PC-9801LX5C | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 0 | 1989/06 | + PC-9801RX21 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1989/10 | + PC-9801RX51 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1989/10 | + PC-9801RA21 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1989/11 | + PC-9801RA51 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1989/11 | + PC-9801RS21 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1989/11 | + PC-9801RS51 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1989/11 | + PC-9801N | V30 @ 10 | 640 KB | 3.5"2DD/2HDx1 | 0 | 1989/11 | + PC-9801TW2 | i386SX-20 @ 20 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1990/02 | + PC-9801TW5 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1990/02 | + PC-9801TS5 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1990/06 | + PC-9801NS | i386SX-12 @ 12 | 1.6 MB | 3.5"2DD/2HDx1 | 0 | 1990/06 | + PC-9801TF5 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1990/07 | + PC-9801NS-20 | i386SX-12 @ 12 | 1.6 MB | 3.5"2DD/2HDx1, 20M SASI HDD | 0 | 1990/09 | + PC-98RL21 | i386DX-20 @ 20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1990/09 | + PC-98RL51 | i386DX-20 @ 20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx1, 40M SASI HDD | 4 | 1990/09 | + PC-98DO+ | V33A @ 8/16 | 640 KB | 5"2DD/2HDx2 | 1 | 1990/10 | + PC-9801DX2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1990/11 | + PC-9801DX/U2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 4 | 1990/11 | + PC-9801DX5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1990/11 | + PC-9801DX/U5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 4 | 1990/11 | + PC-9801NV | V30HL @ 8/16 | 1.6 MB | 3.5"2DD/2HDx1 | 0 | 1990/11 | + PC-9801DS2 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1991/01 | + PC-9801DS/U2 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 4 | 1991/01 | + PC-9801DS5 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1991/01 | + PC-9801DS/U5 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 4 | 1991/01 | + PC-9801DA2 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1991/01 | + PC-9801DA/U2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 4 | 1991/01 | + PC-9801DA5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1991/01 | + PC-9801DA/U5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 4 | 1991/01 | + PC-9801DA7 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 100M SCSI HDD | 4 | 1991/02 | + PC-9801DA/U7 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 100M SCSI HDD | 4 | 1991/02 | + PC-9801UF | V30 @ 8/16 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1991/02 | + PC-9801UR | V30 @ 8/16 | 640 KB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 2 | 1991/02 | + PC-9801UR/20 | V30 @ 8/16 | 640 KB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 20M SASI HDD | 2 | 1991/02 | + PC-9801NS/E | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1991/06 | + PC-9801NS/E20 | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 20M SASI HDD | 0 | 1991/06 | + PC-9801NS/E40 | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1991/06 | + PC-9801TW7 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 100M SCSI HDD | 2 | 1991/07 | + PC-9801TF51 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1991/07 | + PC-9801TF71 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 100M SCSI HDD | 2 | 1991/07 | + PC-9801NC | i386SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1991/10 | + PC-9801NC40 | i386SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1991/10 | + PC-9801CS2 | i386SX-16 @ 16 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1991/10 | + PC-9801CS5 | i386SX-16 @ 16 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1991/10 | + PC-9801CS5/W | i386SX-16 @ 16 | 3.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1991/11 | + PC-98GS1 | i386SX-20 @ 20 & V30 @ 8 | 2.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 3 | 1991/11 | + PC-98GS2 | i386SX-20 @ 20 & V30 @ 8 | 2.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD, 1xCD-ROM | 3 | 1991/11 | + PC-9801FA2 | i486SX-16 @ 16 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1992/01 | + PC-9801FA/U2 | i486SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2 | 4 | 1992/01 | + PC-9801FA5 | i486SX-16 @ 16 | 1.6 MB | 5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/01 | + PC-9801FA/U5 | i486SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/01 | + PC-9801FA7 | i486SX-16 @ 16 | 1.6 MB | 5"2DD/2HDx2, 100M SCSI HDD | 4 | 1992/01 | + PC-9801FA/U7 | i486SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2, 100M SCSI HDD | 4 | 1992/01 | + PC-9801FS2 | i386SX-20 @ 16/20 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1992/05 | + PC-9801FS/U2 | i386SX-20 @ 16/20 | 1.6 MB | 3.5"2DD/2HDx2 | 4 | 1992/05 | + PC-9801FS5 | i386SX-20 @ 16/20 | 1.6 MB | 5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/05 | + PC-9801FS/U5 | i386SX-20 @ 16/20 | 1.6 MB | 3.5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/05 | + PC-9801FS7 | i386SX-20 @ 16/20 | 1.6 MB | 5"2DD/2HDx2, 100M SCSI HDD | 4 | 1992/01 | + PC-9801FS/U7 | i386SX-20 @ 16/20 | 1.6 MB | 3.5"2DD/2HDx2, 100M SCSI HDD | 4 | 1992/01 | + PC-9801NS/T | i386SL(98) @ 20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1992/01 | + PC-9801NS/T40 | i386SL(98) @ 20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1992/01 | + PC-9801NS/T80 | i386SL(98) @ 20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 80M SASI HDD | 0 | 1992/01 | + PC-9801NL | V30H @ 8/16 | 640 KB | 1.25 MB RAM Disk | 0 | 1992/01 | + PC-9801FX2 | i386SX-12 @ 10/12 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1992/05 | + PC-9801FX/U2 | i386SX-12 @ 10/12 | 1.6 MB | 3.5"2DD/2HDx2 | 4 | 1992/05 | + PC-9801FX5 | i386SX-12 @ 10/12 | 1.6 MB | 5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/05 | + PC-9801FX/U5 | i386SX-12 @ 10/12 | 1.6 MB | 3.5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/05 | + PC-9801US | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2 | 2 | 1992/07 | + PC-9801US40 | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1992/07 | + PC-9801US80 | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2, 80M SASI HDD | 2 | 1992/07 | + PC-9801NS/L | i386SX-20 @ 10/20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1992/07 | + PC-9801NS/L40 | i386SX-20 @ 10/20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1992/07 | + PC-9801NA | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1992/11 | + PC-9801NA40 | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1992/11 | + PC-9801NA120 | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 120M SASI HDD | 0 | 1992/11 | + PC-9801NA/C | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1992/11 | + PC-9801NA40/C | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1992/11 | + PC-9801NA120/C | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 120M SASI HDD | 0 | 1992/11 | + PC-9801NS/R | i486SX(J) @ 20 | 1.6 MB | 3.5"2DD/2HDx1 (3mode), 1.25MB RAM Disk | 0 | 1993/01 | + PC-9801NS/R40 | i486SX(J) @ 20 | 1.6 MB | 3.5"2DD/2HDx1 (3mode), 1.25MB RAM Disk, 40M SASI HDD | 0 | 1993/01 | + PC-9801NS/R120 | i486SX(J) @ 20 | 1.6 MB | 3.5"2DD/2HDx1 (3mode), 1.25MB RAM Disk, 120M SASI HDD | 0 | 1993/01 | + PC-9801BA/U2 | i486DX2-40 @ 40 | 1.6 MB | 3.5"2DD/2HDx2 | 3 | 1993/01 | + PC-9801BA/U6 | i486DX2-40 @ 40 | 3.6 MB | 3.5"2DD/2HDx1, 40M SASI HDD | 3 | 1993/01 | + PC-9801BA/M2 | i486DX2-40 @ 40 | 1.6 MB | 5"2DD/2HDx2 | 3 | 1993/01 | + PC-9801BX/U2 | i486SX-20 @ 20 | 1.6 MB | 3.5"2DD/2HDx2 | 3 | 1993/01 | + PC-9801BX/U6 | i486SX-20 @ 20 | 3.6 MB | 3.5"2DD/2HDx1, 40M SASI HDD | 3 | 1993/01 | + PC-9801BX/M2 | i486SX-20 @ 20 | 1.6 MB | 5"2DD/2HDx2 | 3 | 1993/01 | + PC-9801NX/C | i486SX(J) @ 20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1993/07 | + PC-9801NX/C120 | i486SX(J) @ 20 | 3.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1993/07 | + PC-9801P40/D | i486SX(J) @ 20 | 5.6 MB | 40MB IDE HDD | 0 | 1993/07 | + PC-9801P80/W | i486SX(J) @ 20 | 7.6 MB | 80MB IDE HDD | 0 | 1993/07 | + PC-9801P80/P | i486SX(J) @ 20 | 7.6 MB | 80MB IDE HDD | 0 | 1993/07 | + PC-9801BA2/U2 | i486DX2-66 @ 66 | 3.6 MB | 3.5"2DD/2HDx2 | 3 | 1993/11 | + PC-9801BA2/U7 | i486DX2-66 @ 66 | 3.6 MB | 3.5"2DD/2HDx1, 120MB IDE HDD | 3 | 1993/11 | + PC-9801BA2/M2 | i486DX2-66 @ 66 | 3.6 MB | 5"2DD/2HDx2 | 3 | 1993/11 | + PC-9801BS2/U2 | i486SX-33 @ 33 | 3.6 MB | 3.5"2DD/2HDx2 | 3 | 1993/11 | + PC-9801BS2/U7 | i486SX-33 @ 33 | 3.6 MB | 3.5"2DD/2HDx1, 120MB IDE HDD | 3 | 1993/11 | + PC-9801BS2/M2 | i486SX-33 @ 33 | 3.6 MB | 5"2DD/2HDx2 | 3 | 1993/11 | + PC-9801BX2/U2 | i486SX-25 @ 25 | 1.8 MB | 3.5"2DD/2HDx2 | 3 | 1993/11 | + PC-9801BX2/U7 | i486SX-25 @ 25 | 3.6 MB | 3.5"2DD/2HDx1, 120MB IDE HDD | 3 | 1993/11 | + PC-9801BX2/M2 | i486SX-25 @ 25 | 1.8 MB | 5"2DD/2HDx2 | 3 | 1993/11 | + PC-9801BA3/U2 | i486DX-66 @ 66 | 3.6 MB | 3.5"2DD/2HDx2 | 3 | 1995/01 | + PC-9801BA3/U2/W | i486DX-66 @ 66 | 7.6 MB | 3.5"2DD/2HDx2, 210MB IDE HDD | 3 | 1995/01 | + PC-9801BX3/U2 | i486SX-33 @ 33 | 1.6 MB | 3.5"2DD/2HDx2 | 3 | 1995/01 | + PC-9801BX3/U2/W | i486SX-33 @ 33 | 5.6 MB | 3.5"2DD/2HDx2, 210MB IDE HDD | 3 | 1995/01 | + PC-9801BX4/U2 | AMD/i 486DX2-66 @ 66 | 2 MB | 3.5"2DD/2HDx2 | 3 | 1995/07 | + PC-9801BX4/U2/C | AMD/i 486DX2-66 @ 66 | 2 MB | 3.5"2DD/2HDx2, 2xCD-ROM | 3 | 1995/07 | + PC-9801BX4/U2-P | Pentium ODP @ 66 | 2 MB | 3.5"2DD/2HDx2 | 3 | 1995/09 | + PC-9801BX4/U2/C-P | Pentium ODP @ 66 | 2 MB | 3.5"2DD/2HDx2, 2xCD-ROM | 3 | 1995/09 | + + For more info (e.g. optional hardware), see http://www.geocities.jp/retro_zzz/machines/nec/9801/mdl98cpu.html + + + PC-9821 Series + + PC-9821 (1992) - aka 98MULTi, desktop computer, 386 based + PC-9821A series (1993->1994) - aka 98MATE A, desktop computers, 486 based + PC-9821B series (1993) - aka 98MATE B, desktop computers, 486 based + PC-9821C series (1993->1996) - aka 98MULTi CanBe, desktop & tower computers, various CPU + PC-9821Es (1994) - aka 98FINE, desktop computer with integrated LCD, successor of the PC-98T + PC-9821X series (1994->1995) - aka 98MATE X, desktop computers, Pentium based + PC-9821V series (1995) - aka 98MATE Valuestar, desktop computers, Pentium based + PC-9821S series (1995->2996) - aka 98Pro, tower computers, PentiumPro based + PC-9821R series (1996->2000) - aka 98MATE R, desktop & tower & server computers, various CPU + PC-9821C200 (1997) - aka CEREB, desktop computer, Pentium MMX based + PC-9821 Ne/Ns/Np/Nm (1993->1995) - aka 98NOTE, laptops, 486 based + PC-9821 Na/Nb/Nw (1995->1997) - aka 98NOTE Lavie, laptops, Pentium based + PC-9821 Lt/Ld (1995) - aka 98NOTE Light, laptops, 486 based + PC-9821 La/Ls (1995->1997) - aka 98NOTE Aile, laptops, Pentium based + +==== + +Documentation notes (for unemulated stuff, courtesy of T. Kodaka and T. Kono): + +IDE: +(r/w) +0x430: IDE drive switch +0x432: IDE drive switch +0x435: + + (ISA correlated i/o) +---------------------------------------------------------- +0x0640 |WORD|R/W|Data Register |01F0h +0x0642 |BYTE| R |Error Register |01F1h +0x0642 |BYTE| W |Write Precomp Register |01F1h +0x0644 |BYTE|R/W|Sector Count |01F2h +0x0646 |BYTE|R/W|Sector Number |01F3h +0x0648 |BYTE|R/W|Cylinder Low |01F4h +0x064A |BYTE|R/W|Cylinder High |01F5h +0x064C |BYTE|R/W|SDH Register |01F6h +0x064E |BYTE| R |Status Register |01F7h +0x064E |BYTE| W |Command Register |01F7h +0x074C |BYTE| R |Alternate Status Register |03F6h +0x074C |BYTE| W |Digital Output Register |03F6h +0x074E |BYTE| R |Digital Input Register |03F7h + +Video F/F (i/o 0x68): +KAC mode (video ff = 5) is basically how the kanji ROM could be accessed, 1=thru the CG window ports, 0=thru the kanji +window RAM at 0xa4***. +My guess is that the system locks up or doesn't have any data if the wrong port is being accessed. + +Ext Video F/F (i/o 0x6a): +0000 011x enables EGC +0000 111x enables PC-98GS +0010 000x enables multicolor (a.k.a. 256 colors mode) +0010 001x enables 65'536 colors +0010 010x 64k color palette related (?) +0010 011x full screen reverse (?) +0010 100x text and gfxs synthesis (?) +0010 101x 256 color palette registers fast write (?) +0010 110x 256 color overscan (?) +0100 000x (0) CRT (1) Plasma/LCD +0100 001x text and gfxs right shifted one dot (undocumented behaviour) +0100 010x hi-res mode in PC-9821 +0110 000x EEGC mode +0110 001x VRAM config (0) plain (1) packed +0110 011x AGDC mode +0110 100x 480 lines +0110 110x VRAM bitmap orientation (0) MSB left-to-right LSB (1) LSB left-to-right MSB +1000 001x CHR GDC clock (0) 2,5 MHz (1) 5 MHz +1000 010x BMP GDC clock +1000 111x related to GFX accelerator cards (like Vision864) +1100 010x chart GDC operating mode (?) +(everything else is undocumented / unknown) + +Keyboard TX commands: +0xfa ACK +0xfc NACK +0x95 +---- --xx extension key settings (00 normal 11 Win and App Keys enabled) +0x96 identification codes +0x9c +-xx- ---- key delay (11 = 1000 ms, 10 = 500 ms, 01 = 500 ms, 00 = 250 ms) +---x xxxx repeat rate (slow 11111 -> 00001 fast) +0x9d keyboard LED settings +0x9f keyboard ID + +****************************************************************************************************/ + +#include "emu.h" + +#include "cpu/i86/i86.h" +#include "cpu/nec/nec.h" +#include "cpu/i86/i286.h" +#include "cpu/i386/i386.h" + +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/am9517a.h" +#include "machine/pic8259.h" +#include "machine/upd765.h" +#include "machine/upd1990a.h" +#include "machine/i8251.h" + +#include "bus/scsi/pc9801_sasi.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" +#include "machine/buffer.h" +#include "machine/latch.h" + +#include "sound/beep.h" +#include "sound/speaker.h" +#include "sound/2608intf.h" + +#include "video/upd7220.h" + +#include "machine/ram.h" + +#include "formats/pc98_dsk.h" +#include "formats/pc98fdi_dsk.h" +#include "formats/fdd_dsk.h" +#include "formats/dcp_dsk.h" +#include "formats/dip_dsk.h" +#include "formats/nfd_dsk.h" + +#include "machine/pc9801_26.h" +#include "machine/pc9801_86.h" +#include "machine/pc9801_118.h" +#include "machine/pc9801_cbus.h" +#include "machine/pc9801_kbd.h" + +#include "machine/idectrl.h" +#include "machine/idehd.h" + +#include "debugger.h" + +#define UPD1990A_TAG "upd1990a" +#define UPD8251_TAG "upd8251" +#define SASIBUS_TAG "sasi" + +class pc9801_state : public driver_device +{ +public: + pc9801_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dmac(*this, "i8237"), + m_pit8253(*this, "pit8253"), + m_pic1(*this, "pic8259_master"), + m_pic2(*this, "pic8259_slave"), + m_fdc_2hd(*this, "upd765_2hd"), + m_fdc_2dd(*this, "upd765_2dd"), + m_rtc(*this, UPD1990A_TAG), + m_keyb(*this, "keyb"), + m_sio(*this, UPD8251_TAG), + m_hgdc1(*this, "upd7220_chr"), + m_hgdc2(*this, "upd7220_btm"), + m_sasibus(*this, SASIBUS_TAG), + m_sasi_data_out(*this, "sasi_data_out"), + m_sasi_data_in(*this, "sasi_data_in"), + m_sasi_ctrl_in(*this, "sasi_ctrl_in"), + m_ide(*this, "ide"), + m_video_ram_1(*this, "video_ram_1"), + m_video_ram_2(*this, "video_ram_2"), + m_ext_gvram(*this, "ext_gvram"), + m_beeper(*this, "beeper"), + m_ram(*this, RAM_TAG), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_screen(*this, "screen") + { + } + + required_device m_maincpu; + required_device m_dmac; + required_device m_pit8253; + required_device m_pic1; + required_device m_pic2; + required_device m_fdc_2hd; + optional_device m_fdc_2dd; + required_device m_rtc; + required_device m_keyb; + required_device m_sio; + required_device m_hgdc1; + required_device m_hgdc2; + optional_device m_sasibus; + optional_device m_sasi_data_out; + optional_device m_sasi_data_in; + optional_device m_sasi_ctrl_in; + optional_device m_ide; + required_shared_ptr m_video_ram_1; + required_shared_ptr m_video_ram_2; + optional_shared_ptr m_ext_gvram; + required_device m_beeper; + optional_device m_ram; + required_device m_gfxdecode; + required_device m_palette; + required_device m_screen; + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + enum + { + TIMER_VBIRQ + }; + + emu_timer *m_vbirq; + UINT8 *m_ipl_rom; + UINT8 *m_char_rom; + UINT8 *m_kanji_rom; + + UINT8 m_dma_offset[4]; + int m_dack; + + UINT8 m_video_ff[8],m_gfx_ff; + UINT8 m_txt_scroll_reg[8]; + UINT8 m_pal_clut[4]; + + UINT16 *m_tvram; + + UINT16 m_font_addr; + UINT8 m_font_line; + UINT16 m_font_lr; + + UINT8 m_keyb_press; + + UINT8 m_fdc_2dd_ctrl,m_fdc_2hd_ctrl; + UINT8 m_nmi_ff; + + UINT8 m_vram_bank; + UINT8 m_vram_disp; + + /* PC9801RS specific */ + UINT8 m_gate_a20; //A20 line + UINT8 m_nmi_enable; + UINT8 m_access_ctrl; // DMA related + UINT8 m_rom_bank; + UINT8 m_fdc_ctrl; + UINT8 m_ex_video_ff[128]; + struct { + UINT8 pal_entry; + UINT8 r[16],g[16],b[16]; + }m_analog16; + struct { + UINT8 pal_entry; + UINT8 r[0x100],g[0x100],b[0x100]; + }m_analog256; + struct { + UINT8 mode; + UINT8 tile[4], tile_index; + }m_grcg; + + struct { + UINT16 regs[8]; + UINT16 pat[4]; + UINT16 src[4]; + INT16 count; + UINT16 leftover[4]; + bool first; + bool init; + } m_egc; + + /* PC9821 specific */ + UINT8 m_sdip[24], m_sdip_bank; + UINT8 m_pc9821_window_bank; + UINT8 m_ext2_ff; + UINT8 m_sys_type; + + DECLARE_WRITE_LINE_MEMBER( write_uart_clock ); + DECLARE_WRITE8_MEMBER(rtc_dmapg_w); + DECLARE_WRITE8_MEMBER(nmi_ctrl_w); + DECLARE_WRITE8_MEMBER(vrtc_clear_w); + DECLARE_WRITE8_MEMBER(pc9801_video_ff_w); + DECLARE_READ8_MEMBER(txt_scrl_r); + DECLARE_WRITE8_MEMBER(txt_scrl_w); + DECLARE_READ8_MEMBER(grcg_r); + DECLARE_WRITE8_MEMBER(grcg_w); + DECLARE_WRITE16_MEMBER(egc_w); + DECLARE_READ8_MEMBER(pc9801_a0_r); + DECLARE_WRITE8_MEMBER(pc9801_a0_w); + DECLARE_READ8_MEMBER(pc9801_fdc_2hd_r); + DECLARE_WRITE8_MEMBER(pc9801_fdc_2hd_w); + DECLARE_READ8_MEMBER(pc9801_fdc_2dd_r); + DECLARE_WRITE8_MEMBER(pc9801_fdc_2dd_w); + DECLARE_READ16_MEMBER(tvram_r); + DECLARE_WRITE16_MEMBER(tvram_w); + DECLARE_READ8_MEMBER(gvram_r); + DECLARE_WRITE8_MEMBER(gvram_w); + DECLARE_WRITE8_MEMBER(pc9801rs_mouse_freq_w); + DECLARE_CUSTOM_INPUT_MEMBER(system_type_r); + DECLARE_READ16_MEMBER(grcg_gvram_r); + DECLARE_WRITE16_MEMBER(grcg_gvram_w); + DECLARE_READ16_MEMBER(grcg_gvram0_r); + DECLARE_WRITE16_MEMBER(grcg_gvram0_w); + DECLARE_READ16_MEMBER(upd7220_grcg_r); + DECLARE_WRITE16_MEMBER(upd7220_grcg_w); + void egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask); + UINT16 egc_blit_r(UINT32 offset, UINT16 mem_mask); + UINT32 pc9801_286_a20(bool state); + + DECLARE_READ8_MEMBER(ide_hack_r); + DECLARE_WRITE8_MEMBER(sasi_data_w); + DECLARE_READ8_MEMBER(sasi_data_r); + DECLARE_WRITE_LINE_MEMBER(write_sasi_io); + DECLARE_WRITE_LINE_MEMBER(write_sasi_req); + DECLARE_READ8_MEMBER(sasi_status_r); + DECLARE_WRITE8_MEMBER(sasi_ctrl_w); + + UINT8 m_sasi_data; + int m_sasi_data_enable; + UINT8 m_sasi_ctrl; + + DECLARE_READ8_MEMBER(pc9801rs_ipl_r); + DECLARE_READ8_MEMBER(pc9801rs_knjram_r); + DECLARE_WRITE8_MEMBER(pc9801rs_knjram_w); + DECLARE_WRITE8_MEMBER(pc9801rs_bank_w); + DECLARE_READ8_MEMBER(a20_ctrl_r); + DECLARE_WRITE8_MEMBER(a20_ctrl_w); + DECLARE_READ8_MEMBER(pc9810rs_fdc_ctrl_r); + DECLARE_WRITE8_MEMBER(pc9810rs_fdc_ctrl_w); + DECLARE_READ8_MEMBER(pc9801rs_2hd_r); + DECLARE_WRITE8_MEMBER(pc9801rs_2hd_w); +// DECLARE_READ8_MEMBER(pc9801rs_2dd_r); +// DECLARE_WRITE8_MEMBER(pc9801rs_2dd_w); + DECLARE_WRITE8_MEMBER(pc9801rs_video_ff_w); + DECLARE_WRITE8_MEMBER(pc9801rs_a0_w); + DECLARE_WRITE8_MEMBER(pc9821_video_ff_w); + DECLARE_READ8_MEMBER(pc9821_a0_r); + DECLARE_WRITE8_MEMBER(pc9821_a0_w); + DECLARE_READ8_MEMBER(pc9801rs_access_ctrl_r); + DECLARE_WRITE8_MEMBER(pc9801rs_access_ctrl_w); + DECLARE_WRITE8_MEMBER(pc9801rs_nmi_w); + DECLARE_READ8_MEMBER(pc9801rs_midi_r); +// DECLARE_READ8_MEMBER(winram_r); +// DECLARE_WRITE8_MEMBER(winram_w); +// DECLARE_READ8_MEMBER(pc9801_ext_opna_r); +// DECLARE_WRITE8_MEMBER(pc9801_ext_opna_w); + DECLARE_READ8_MEMBER(pic_r); + DECLARE_WRITE8_MEMBER(pic_w); + + DECLARE_READ8_MEMBER(sdip_0_r); + DECLARE_READ8_MEMBER(sdip_1_r); + DECLARE_READ8_MEMBER(sdip_2_r); + DECLARE_READ8_MEMBER(sdip_3_r); + DECLARE_READ8_MEMBER(sdip_4_r); + DECLARE_READ8_MEMBER(sdip_5_r); + DECLARE_READ8_MEMBER(sdip_6_r); + DECLARE_READ8_MEMBER(sdip_7_r); + DECLARE_READ8_MEMBER(sdip_8_r); + DECLARE_READ8_MEMBER(sdip_9_r); + DECLARE_READ8_MEMBER(sdip_a_r); + DECLARE_READ8_MEMBER(sdip_b_r); + + DECLARE_WRITE8_MEMBER(sdip_0_w); + DECLARE_WRITE8_MEMBER(sdip_1_w); + DECLARE_WRITE8_MEMBER(sdip_2_w); + DECLARE_WRITE8_MEMBER(sdip_3_w); + DECLARE_WRITE8_MEMBER(sdip_4_w); + DECLARE_WRITE8_MEMBER(sdip_5_w); + DECLARE_WRITE8_MEMBER(sdip_6_w); + DECLARE_WRITE8_MEMBER(sdip_7_w); + DECLARE_WRITE8_MEMBER(sdip_8_w); + DECLARE_WRITE8_MEMBER(sdip_9_w); + DECLARE_WRITE8_MEMBER(sdip_a_w); + DECLARE_WRITE8_MEMBER(sdip_b_w); + + DECLARE_READ8_MEMBER(pc9821_window_bank_r); + DECLARE_WRITE8_MEMBER(pc9821_window_bank_w); + DECLARE_READ16_MEMBER(pc9821_timestamp_r); + DECLARE_READ8_MEMBER(pc9821_ext2_video_ff_r); + DECLARE_WRITE8_MEMBER(pc9821_ext2_video_ff_w); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); + UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); + +private: + UINT8 m_sdip_read(UINT16 port, UINT8 sdip_offset); + void m_sdip_write(UINT16 port, UINT8 sdip_offset,UINT8 data); + UINT16 egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst); + UINT16 egc_shift(int plane, UINT16 val); +public: + DECLARE_MACHINE_START(pc9801_common); + DECLARE_MACHINE_START(pc9801f); + DECLARE_MACHINE_START(pc9801rs); + DECLARE_MACHINE_START(pc9801bx2); + DECLARE_MACHINE_START(pc9821); + DECLARE_MACHINE_START(pc9821ap2); + DECLARE_MACHINE_RESET(pc9801_common); + DECLARE_MACHINE_RESET(pc9801f); + DECLARE_MACHINE_RESET(pc9801rs); + DECLARE_MACHINE_RESET(pc9821); + + DECLARE_PALETTE_INIT(pc9801); + INTERRUPT_GEN_MEMBER(pc9801_vrtc_irq); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); + DECLARE_WRITE_LINE_MEMBER(tc_w); + DECLARE_READ8_MEMBER(dma_read_byte); + DECLARE_WRITE8_MEMBER(dma_write_byte); + DECLARE_WRITE_LINE_MEMBER(dack0_w); + DECLARE_WRITE_LINE_MEMBER(dack1_w); + DECLARE_WRITE_LINE_MEMBER(dack2_w); + DECLARE_WRITE_LINE_MEMBER(dack3_w); + DECLARE_WRITE8_MEMBER(ppi_sys_portc_w); + + DECLARE_WRITE_LINE_MEMBER(fdc_2dd_irq); + DECLARE_WRITE_LINE_MEMBER(pc9801rs_fdc_irq); + DECLARE_WRITE_LINE_MEMBER(pc9801rs_fdc_drq); + + DECLARE_READ8_MEMBER(ppi_mouse_porta_r); + DECLARE_WRITE8_MEMBER(ppi_mouse_porta_w); + DECLARE_WRITE8_MEMBER(ppi_mouse_portb_w); + DECLARE_WRITE8_MEMBER(ppi_mouse_portc_w); + struct{ + UINT8 control; + UINT8 lx; + UINT8 ly; + UINT8 freq_reg; + UINT8 freq_index; + }m_mouse; + TIMER_DEVICE_CALLBACK_MEMBER( mouse_irq_cb ); + + DECLARE_DRIVER_INIT(pc9801_kanji); + inline void set_dma_channel(int channel, int state); + virtual void device_reset_after_children(); +}; + + + +#define ATTRSEL_REG 0 +#define WIDTH40_REG 2 +#define FONTSEL_REG 3 +#define INTERLACE_REG 4 +#define MEMSW_REG 6 +#define DISPLAY_REG 7 + +#define ANALOG_16_MODE 0 +#define ANALOG_256_MODE 0x10 + +void pc9801_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_VBIRQ: + m_pic1->ir2_w(0); + } +} + +void pc9801_state::video_start() +{ + m_tvram = auto_alloc_array(machine(), UINT16, 0x2000); + + // find memory regions + m_char_rom = memregion("chargen")->base(); + m_kanji_rom = memregion("kanji")->base(); +} + +UINT32 pc9801_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(m_palette->black_pen(), cliprect); + + /* graphics */ + m_hgdc2->screen_update(screen, bitmap, cliprect); + m_hgdc1->screen_update(screen, bitmap, cliprect); + return 0; +} + +UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int xi; + int res_x,res_y; + UINT8 pen; + UINT8 interlace_on; + UINT8 colors16_mode; + + if(m_video_ff[DISPLAY_REG] == 0) //screen is off + return; + +// popmessage("%02x %d",m_video_ff[INTERLACE_REG],machine().first_screen()->visible_area().max_y + 1); +// interlace_on = ((machine().first_screen()->visible_area().max_y + 1) >= 400) ? 1 : 0; + interlace_on = m_video_ff[INTERLACE_REG]; + colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8; + + if(m_ex_video_ff[ANALOG_256_MODE]) + { + for(xi=0;xi<16;xi++) + { + res_x = x + xi; + res_y = y; + + if(!m_screen->visible_area().contains(res_x, res_y*2+0)) + return; + + pen = m_ext_gvram[((address*16+xi)+(m_vram_disp*0x40000)) >> 1]; + + bitmap.pix32(res_y*2+0, res_x) = palette[pen + 0x20]; + if(m_screen->visible_area().contains(res_x, res_y*2+1)) + bitmap.pix32(res_y*2+1, res_x) = palette[pen + 0x20]; + } + } + else + { + for(xi=0;xi<16;xi++) + { + res_x = x + xi; + res_y = y; + + pen = ((m_video_ram_2[((address & 0x7fff) + (0x08000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 1 : 0; + pen|= ((m_video_ram_2[((address & 0x7fff) + (0x10000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 2 : 0; + pen|= ((m_video_ram_2[((address & 0x7fff) + (0x18000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 4 : 0; + if(m_ex_video_ff[ANALOG_16_MODE]) + pen|= ((m_video_ram_2[((address & 0x7fff) + (0) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 8 : 0; + + if(interlace_on) + { + if(m_screen->visible_area().contains(res_x, res_y*2+0)) + bitmap.pix32(res_y*2+0, res_x) = palette[pen + colors16_mode]; + /* TODO: it looks like that PC-98xx can only display even lines ... */ + if(m_screen->visible_area().contains(res_x, res_y*2+1)) + bitmap.pix32(res_y*2+1, res_x) = palette[pen + colors16_mode]; + } + else + bitmap.pix32(res_y, res_x) = palette[pen + colors16_mode]; + } + } +} + +UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int xi,yi; + int x; + UINT8 char_size; +// UINT8 interlace_on; + UINT16 tile; + UINT8 kanji_lr; + UINT8 kanji_sel; + UINT8 x_step; + + if(m_video_ff[DISPLAY_REG] == 0) //screen is off + return; + +// interlace_on = m_video_ff[INTERLACE_REG]; + char_size = m_video_ff[FONTSEL_REG] ? 16 : 8; + tile = 0; + + for(x=0;x> 8; + if(knj_tile) + { + /* Note: bit 7 doesn't really count, if a kanji is enabled then the successive tile is always the second part of it. + Trusted with Alice no Yakata, Animahjong V3, Aki no Tsukasa no Fushigi no Kabe, Apros ... + */ + //kanji_lr = (knj_tile & 0x80) >> 7; + //kanji_lr |= (tile & 0x80) >> 7; // Tokimeki Sports Gal 3 + tile &= 0x7f; + tile <<= 8; + tile |= (knj_tile & 0x7f); + kanji_sel = 1; + if((tile & 0x7c00) == 0x0800) // 8x16 charset selector + x_step = 1; + else + x_step = 2; +// kanji_lr = 0; + } + else + x_step = 1; + + + + for(kanji_lr=0;kanji_lr> 5; + + for(yi=0;yivisible_area().contains(res_x, res_y)) + continue; + + tile_data = 0; + + if(!secret) + { + /* TODO: priority */ + if(gfx_mode) + { + int gfx_bit; + tile_data = 0; + + /* + gfx strip mode: + + number refers to the bit number in the tile data. + This mode is identical to the one seen in PC-8801 + 00004444 + 11115555 + 22226666 + 33337777 + */ + + gfx_bit = (xi & 4); + gfx_bit+= (yi & (2 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); + gfx_bit+= (yi & (4 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); + + tile_data = ((tile >> gfx_bit) & 1) ? 0xff : 0x00; + } + else if(kanji_sel) + tile_data = (m_kanji_rom[tile*0x20+yi*2+kanji_lr]); + else + tile_data = (m_char_rom[tile*char_size+m_video_ff[FONTSEL_REG]*0x800+yi]); + } + + if(reverse) { tile_data^=0xff; } + if(u_line && yi == 7) { tile_data = 0xff; } + if(v_line) { tile_data|=8; } + + /* TODO: proper blink rate for these two */ + if(cursor_on && cursor_addr == tile_addr && m_screen->frame_number() & 0x10) + tile_data^=0xff; + + if(blink && m_screen->frame_number() & 0x10) + tile_data^=0xff; + + if(yi >= char_size) + pen = -1; + else + pen = (tile_data >> (7-xi) & 1) ? color : -1; + + if(pen != -1) + bitmap.pix32(res_y, res_x) = palette[pen]; + + if(m_video_ff[WIDTH40_REG]) + { + if(!m_screen->visible_area().contains(res_x+1, res_y)) + continue; + + if(pen != -1) + bitmap.pix32(res_y, res_x+1) = palette[pen]; + } + } + } + } + } +} + + +WRITE8_MEMBER(pc9801_state::rtc_dmapg_w) +{ + if((offset & 1) == 0) + { + if(offset == 0) + { + m_rtc->c0_w((data & 0x01) >> 0); + m_rtc->c1_w((data & 0x02) >> 1); + m_rtc->c2_w((data & 0x04) >> 2); + m_rtc->stb_w((data & 0x08) >> 3); + m_rtc->clk_w((data & 0x10) >> 4); + m_rtc->data_in_w(((data & 0x20) >> 5)); + if(data & 0xc0) + logerror("RTC write to undefined bits %02x\n",data & 0xc0); + } + else + logerror("Write to undefined port [%02x] <- %02x\n",offset+0x20,data); + } + else // odd + { +// logerror("Write to DMA bank register %d %02x\n",((offset >> 1)+1) & 3,data); + m_dma_offset[((offset >> 1)+1) & 3] = data & 0x0f; + } +} + +WRITE8_MEMBER(pc9801_state::nmi_ctrl_w) +{ + m_nmi_ff = (offset & 2) >> 1; +} + +WRITE8_MEMBER(pc9801_state::vrtc_clear_w) +{ + m_pic1->ir2_w(0); +} + +WRITE8_MEMBER(pc9801_state::pc9801_video_ff_w) +{ + /* + TODO: this is my best bet so far. Register 4 is annoying, the pattern seems to be: + Write to video FF register Graphic -> 00 + Write to video FF register 200 lines -> 0x + Write to video FF register 200 lines -> 00 + + where x is the current mode. + */ + switch((data & 0x0e) >> 1) + { + case 1: + m_gfx_ff = 1; + if(data & 1) + logerror("Graphic f/f actually enabled!\n"); + break; + case 4: + if(m_gfx_ff) + { + m_video_ff[(data & 0x0e) >> 1] = data &1; + m_gfx_ff = 0; + } + break; + default: m_video_ff[(data & 0x0e) >> 1] = data & 1; break; + } + + if(0) + { + static const char *const video_ff_regnames[] = + { + "Attribute Select", // 0 + "Graphic", // 1 + "Column", // 2 + "Font Select", // 3 + "200 lines", // 4 + "KAC?", // 5 + "Memory Switch", // 6 + "Display ON" // 7 + }; + + logerror("Write to video FF register %s -> %02x\n",video_ff_regnames[(data & 0x0e) >> 1],data & 1); + } +} + + +READ8_MEMBER(pc9801_state::txt_scrl_r) +{ + //logerror("Read to display register [%02x]\n",offset+0x70); + /* TODO: ok? */ + return m_txt_scroll_reg[offset >> 1]; +} + +WRITE8_MEMBER(pc9801_state::txt_scrl_w) +{ + //logerror("Write to display register [%02x] %02x\n",offset+0x70,data); + m_txt_scroll_reg[offset >> 1] = data; + + //popmessage("%02x %02x %02x %02x",m_txt_scroll_reg[0],m_txt_scroll_reg[1],m_txt_scroll_reg[2],m_txt_scroll_reg[3]); +} + +READ8_MEMBER(pc9801_state::pc9801_a0_r) +{ + if((offset & 1) == 0) + { + switch(offset & 0xe) + { + case 0x00: + case 0x02: + return m_hgdc2->read(space, (offset & 2) >> 1); + /* TODO: double check these two */ + case 0x04: + return m_vram_disp & 1; + case 0x06: + return m_vram_bank & 1; + /* bitmap palette clut read */ + case 0x08: + case 0x0a: + case 0x0c: + case 0x0e: + return m_pal_clut[(offset & 0x6) >> 1]; + } + + return 0xff; //code unreachable + } + else // odd + { + switch((offset & 0xe) + 1) + { + case 0x09://cg window font read + { + UINT32 pcg_offset; + + pcg_offset = (m_font_addr & 0x7f7f) << 5; + pcg_offset|= m_font_line; + pcg_offset|= m_font_lr; + + return m_kanji_rom[pcg_offset]; + } + } + + logerror("Read to undefined port [%02x]\n",offset+0xa0); + return 0xff; + } +} + +WRITE8_MEMBER(pc9801_state::pc9801_a0_w) +{ + if((offset & 1) == 0) + { + switch(offset & 0xe) + { + case 0x00: + case 0x02: + m_hgdc2->write(space, (offset & 2) >> 1,data); + return; + case 0x04: + m_vram_disp = data & 1; + return; + case 0x06: + m_vram_bank = data & 1; + return; + /* bitmap palette clut write */ + case 0x08: + case 0x0a: + case 0x0c: + case 0x0e: + { + UINT8 pal_entry; + + m_pal_clut[(offset & 0x6) >> 1] = data; + + /* can't be more twisted I presume ... :-/ */ + pal_entry = (((offset & 4) >> 1) | ((offset & 2) << 1)) >> 1; + pal_entry ^= 3; + + m_palette->set_pen_color((pal_entry)|4|8, pal1bit((data & 0x2) >> 1), pal1bit((data & 4) >> 2), pal1bit((data & 1) >> 0)); + m_palette->set_pen_color((pal_entry)|8, pal1bit((data & 0x20) >> 5), pal1bit((data & 0x40) >> 6), pal1bit((data & 0x10) >> 4)); + return; + } + default: + logerror("Write to undefined port [%02x] <- %02x\n",offset+0xa0,data); + return; + } + } + else // odd + { + switch((offset & 0xe) + 1) + { + case 0x01: + m_font_addr = (data & 0xff) | (m_font_addr & 0x7f00); + return; + case 0x03: + m_font_addr = ((data & 0x7f) << 8) | (m_font_addr & 0xff); + return; + case 0x05: + //logerror("%02x\n",data); + m_font_line = ((data & 0x0f) << 1); + m_font_lr = ((data & 0x20) >> 5) ^ 1; + return; + case 0x09: //cg window font write + { + UINT32 pcg_offset; + + pcg_offset = m_font_addr << 5; + pcg_offset|= m_font_line; + pcg_offset|= m_font_lr; + //logerror("%04x %02x %02x %08x\n",m_font_addr,m_font_line,m_font_lr,pcg_offset); + if((m_font_addr & 0xff00) == 0x5600 || (m_font_addr & 0xff00) == 0x5700) + { + m_kanji_rom[pcg_offset] = data; + m_gfxdecode->gfx(2)->mark_dirty(pcg_offset >> 5); + } + return; + } + } + + //logerror("Write to undefined port [%02x) <- %02x\n",offset+0xa0,data); + } +} + +DECLARE_WRITE_LINE_MEMBER(pc9801_state::write_uart_clock) +{ + m_sio->write_txc(state); + m_sio->write_rxc(state); +} + +READ8_MEMBER(pc9801_state::pc9801_fdc_2hd_r) +{ + if((offset & 1) == 0) + { + switch(offset & 6) + { + case 0: return m_fdc_2hd->msr_r(space, 0, 0xff); + case 2: return m_fdc_2hd->fifo_r(space, 0, 0xff); + case 4: return 0x5f; //unknown port meaning + } + } + else + { + switch((offset & 6) + 1) + { + case 1: return m_sio->data_r(space, 0); + case 3: return m_sio->status_r(space, 0); + } + logerror("Read to undefined port [%02x]\n",offset+0x90); + return 0xff; + } + + return 0xff; +} + +WRITE8_MEMBER(pc9801_state::pc9801_fdc_2hd_w) +{ + if((offset & 1) == 0) + { + switch(offset & 6) + { + case 0: logerror("Write to undefined port [%02x] <- %02x\n",offset+0x90,data); return; + case 2: m_fdc_2hd->fifo_w(space, 0, data, 0xff); return; + case 4: + //logerror("%02x ctrl\n",data); + if(((m_fdc_2hd_ctrl & 0x80) == 0) && (data & 0x80)) + m_fdc_2hd->soft_reset(); + + m_fdc_2hd_ctrl = data; + + if(data & 0x40) + { + m_fdc_2hd->set_ready_line_connected(0); + m_fdc_2hd->ready_w(0); + } + else + m_fdc_2hd->set_ready_line_connected(1); + + // TODO: is the motor control bit really inverted relative to the other fdcs? + m_fdc_2hd->subdevice("0")->get_device()->mon_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); + m_fdc_2hd->subdevice("1")->get_device()->mon_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); + break; + } + } + else + { + switch((offset & 6) + 1) + { + case 1: m_sio->data_w(space, 0, data); return; + case 3: m_sio->control_w(space, 0, data); return; + } + logerror("Write to undefined port [%02x] <- %02x\n",offset+0x90,data); + } +} + + +READ8_MEMBER(pc9801_state::pc9801_fdc_2dd_r) +{ + if((offset & 1) == 0) + { + switch(offset & 6) + { + case 0: return m_fdc_2dd->msr_r(space, 0, 0xff); + case 2: return m_fdc_2dd->fifo_r(space, 0, 0xff); + case 4: + { + int ret = (!m_fdc_2dd->subdevice("0")->get_device()->ready_r()) ? 0x10 : 0; + ret |= (m_fdc_2dd->subdevice("1")->get_device()->ready_r()) ? 0x10 : 0; + return ret | 0x40; //unknown port meaning, might be 0x70 + } + } + } + else + { + logerror("Read to undefined port [%02x]\n",offset+0xc8); + return 0xff; + } + + return 0xff; +} + +WRITE8_MEMBER(pc9801_state::pc9801_fdc_2dd_w) +{ + if((offset & 1) == 0) + { + switch(offset & 6) + { + case 0: logerror("Write to undefined port [%02x] <- %02x\n",offset+0xc8,data); return; + case 2: m_fdc_2dd->fifo_w(space, 0, data, 0xff); return; + case 4: + logerror("%02x ctrl\n",data); + if(((m_fdc_2dd_ctrl & 0x80) == 0) && (data & 0x80)) + m_fdc_2dd->soft_reset(); + + m_fdc_2dd_ctrl = data; + m_fdc_2dd->subdevice("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); + m_fdc_2dd->subdevice("1")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); + break; + } + } + else + { + logerror("Write to undefined port [%02x] <- %02x\n",offset+0xc8,data); + } +} + + +/* TODO: banking? */ +READ16_MEMBER(pc9801_state::tvram_r) +{ + UINT16 res; + + if((offset & 0x1000) && (mem_mask == 0xff00)) + return 0xffff; + + res = m_tvram[offset]; + + return res; +} + +WRITE16_MEMBER(pc9801_state::tvram_w) +{ + if(offset < (0x3fe2>>1) || m_video_ff[MEMSW_REG]) + COMBINE_DATA(&m_tvram[offset]); + + COMBINE_DATA(&m_video_ram_1[offset]); //TODO: check me +} + +/* +0x8000 is trusted (bank 0 is actually used by 16 colors mode) */ +READ8_MEMBER(pc9801_state::gvram_r) +{ + return BITSWAP8(m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] >> ((offset & 1) << 3),0,1,2,3,4,5,6,7); +} + +WRITE8_MEMBER(pc9801_state::gvram_w) +{ + UINT16 ram = m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000]; + int mask = (offset & 1) << 3; + data = BITSWAP8(data,0,1,2,3,4,5,6,7); + m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] = (ram & (0xff00 >> mask)) | (data << mask); +} + +UINT16 pc9801_state::egc_shift(int plane, UINT16 val) +{ + int src_off = m_egc.regs[6] & 0xf, dst_off = (m_egc.regs[6] >> 4) & 0xf; + int left = src_off - dst_off, right = dst_off - src_off; + UINT16 out; + if(m_egc.regs[6] & 0x1000) + { + if(right >= 0) + { + out = (val >> right) | m_egc.leftover[plane]; + m_egc.leftover[plane] = val << (16 - right); + } + else + { + out = (val >> (16 - left)) | m_egc.leftover[plane]; + m_egc.leftover[plane] = val << left; + } + } + else + { + if(right >= 0) + { + out = (val << right) | m_egc.leftover[plane]; + m_egc.leftover[plane] = val >> (16 - right); + } + else + { + out = (val << (16 - left)) | m_egc.leftover[plane]; + m_egc.leftover[plane] = val >> left; + } + } + return out; +} + +UINT16 pc9801_state::egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst) +{ + UINT16 out = 0; + + for(int i = 7; i >= 0; i--) + { + if(BIT(m_egc.regs[2], i)) + out |= src & pat & dst; + pat = ~pat; + dst = (!(i & 1)) ? ~dst : dst; + src = (i == 4) ? ~src : src; + } + return out; +} + +void pc9801_state::egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask) +{ + UINT16 mask = m_egc.regs[4] & mem_mask, out = 0; + bool dir = !(m_egc.regs[6] & 0x1000); + int dst_off = (m_egc.regs[6] >> 4) & 0xf, src_off = m_egc.regs[6] & 0xf; + offset &= 0x13fff; + + if(!m_egc.init && (src_off > dst_off)) + { + if(BIT(m_egc.regs[2], 10)) + { + m_egc.leftover[0] = 0; + egc_shift(0, data); + // leftover[0] is inited above, set others to same + m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = m_egc.leftover[0]; + } + m_egc.init = true; + return; + } + + // mask off the bits before the start + if(m_egc.first) + { + mask &= dir ? ~((1 << dst_off) - 1) : ((1 << (16 - dst_off)) - 1); + if(BIT(m_egc.regs[2], 10) && !m_egc.init) + m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0; + } + + // mask off the bits past the end of the blit + if(m_egc.count < 16) + { + UINT16 end_mask = dir ? ((1 << m_egc.count) - 1) : ~((1 << (16 - m_egc.count)) - 1); + // if the blit is less than 16 bits, adjust the masks + if(m_egc.first) + { + if(dir) + end_mask <<= dst_off; + else + end_mask >>= dst_off; + } + mask &= end_mask; + } + + for(int i = 0; i < 4; i++) + { + if(!BIT(m_egc.regs[0], i)) + { + UINT16 src = m_egc.src[i] & mem_mask, pat = m_egc.pat[i]; + if(BIT(m_egc.regs[2], 10)) + src = egc_shift(i, data); + + if((m_egc.regs[2] & 0x300) == 0x200) + pat = m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)]; + + switch((m_egc.regs[2] >> 11) & 3) + { + case 0: + out = data; + break; + case 1: + if(mem_mask == 0x00ff) + src = src | src << 8; + else if(mem_mask == 0xff00) + src = src | src >> 8; + + out = egc_do_partial_op(i, src, pat, m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)]); + break; + case 2: + out = pat; + break; + case 3: + logerror("Invalid EGC blit operation\n"); + return; + } + + m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)] &= ~mask; + m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)] |= out & mask; + } + } + if(mem_mask != 0xffff) + { + if(m_egc.first) + m_egc.count -= 8 - (dst_off & 7); + else + m_egc.count -= 8; + } + else + { + if(m_egc.first) + m_egc.count -= 16 - dst_off; + else + m_egc.count -= 16; + } + + m_egc.first = false; + + if(m_egc.count <= 0) + { + m_egc.first = true; + m_egc.init = false; + m_egc.count = (m_egc.regs[7] & 0xfff) + 1; + } +} + +UINT16 pc9801_state::egc_blit_r(UINT32 offset, UINT16 mem_mask) +{ + UINT32 plane_off = offset & 0x13fff; + if((m_egc.regs[2] & 0x300) == 0x100) + { + m_egc.pat[0] = m_video_ram_2[plane_off + 0x4000]; + m_egc.pat[1] = m_video_ram_2[plane_off + (0x4000 * 2)]; + m_egc.pat[2] = m_video_ram_2[plane_off + (0x4000 * 3)]; + m_egc.pat[3] = m_video_ram_2[plane_off]; + } + if(m_egc.first && !m_egc.init) + { + m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0; + m_egc.init = true; + } + for(int i = 0; i < 4; i++) + m_egc.src[i] = egc_shift(i, m_video_ram_2[plane_off + (((i + 1) & 3) * 0x4000)]); + + if(BIT(m_egc.regs[2], 13)) + return m_video_ram_2[offset]; + else + return m_egc.src[(m_egc.regs[1] >> 8) & 3]; +} + +READ16_MEMBER(pc9801_state::upd7220_grcg_r) +{ + UINT16 res = 0; + + if(!(m_grcg.mode & 0x80) || space.debugger_access()) + res = m_video_ram_2[offset]; + else if(m_ex_video_ff[2]) + res = egc_blit_r(offset, mem_mask); + else if(!(m_grcg.mode & 0x40)) + { + int i; + + offset &= 0x13fff; + res = 0; + for(i=0;i<4;i++) + { + if((m_grcg.mode & (1 << i)) == 0) + { + res |= m_video_ram_2[offset | (((i + 1) & 3) * 0x4000)] ^ (m_grcg.tile[i] | m_grcg.tile[i] << 8); + } + } + + res ^= 0xffff; + } + + return res; +} + +WRITE16_MEMBER(pc9801_state::upd7220_grcg_w) +{ + if(!(m_grcg.mode & 0x80)) + COMBINE_DATA(&m_video_ram_2[offset]); + else if(m_ex_video_ff[2]) + egc_blit_w(offset, data, mem_mask); + else + { + int i; + UINT8 *vram = (UINT8 *)m_video_ram_2.target(); + offset = (offset << 1) & 0x27fff; + + if(m_grcg.mode & 0x40) // RMW + { + for(i=0;i<4;i++) + { + if((m_grcg.mode & (1 << i)) == 0) + { + if(mem_mask & 0xff) + { + vram[offset | (((i + 1) & 3) * 0x8000)] &= ~(data >> 0); + vram[offset | (((i + 1) & 3) * 0x8000)] |= m_grcg.tile[i] & (data >> 0); + } + if(mem_mask & 0xff00) + { + vram[offset | (((i + 1) & 3) * 0x8000) | 1] &= ~(data >> 8); + vram[offset | (((i + 1) & 3) * 0x8000) | 1] |= m_grcg.tile[i] & (data >> 8); + } + } + } + } + else // TDW + { + for(i=0;i<4;i++) + { + if((m_grcg.mode & (1 << i)) == 0) + { + if(mem_mask & 0xff) + vram[offset | (((i + 1) & 3) * 0x8000)] = m_grcg.tile[i]; + if(mem_mask & 0xff00) + vram[offset | (((i + 1) & 3) * 0x8000) | 1] = m_grcg.tile[i]; + } + } + } + } +} + +READ8_MEMBER(pc9801_state::ide_hack_r) +{ + address_space &ram = m_maincpu->space(AS_PROGRAM); + // this makes the ide driver not do 512 to 256 byte sector translation, the 9821 looks for bit 6 of offset 0xac403 of the kanji ram to set this, the rs unknown + ram.write_byte(0x457, ram.read_byte(0x457) | 0xc0); + return 0xff; +} + +READ8_MEMBER( pc9801_state::sasi_data_r ) +{ + UINT8 data = m_sasi_data_in->read(); + + if(m_sasi_ctrl_in->read() & 0x80) + m_sasibus->write_ack(1); + return data; +} + +WRITE8_MEMBER( pc9801_state::sasi_data_w ) +{ + m_sasi_data = data; + + if (m_sasi_data_enable) + { + m_sasi_data_out->write(m_sasi_data); + if(m_sasi_ctrl_in->read() & 0x80) + m_sasibus->write_ack(1); + } +} + +WRITE_LINE_MEMBER( pc9801_state::write_sasi_io ) +{ + m_sasi_ctrl_in->write_bit2(state); + + m_sasi_data_enable = !state; + + if (m_sasi_data_enable) + { + m_sasi_data_out->write(m_sasi_data); + } + else + { + m_sasi_data_out->write(0); + } + if((m_sasi_ctrl_in->read() & 0x9C) == 0x8C) + m_pic2->ir1_w(m_sasi_ctrl & 1); + else + m_pic2->ir1_w(0); +} + +WRITE_LINE_MEMBER( pc9801_state::write_sasi_req ) +{ + m_sasi_ctrl_in->write_bit7(state); + + if (!state) + m_sasibus->write_ack(0); + + if((m_sasi_ctrl_in->read() & 0x9C) == 0x8C) + m_pic2->ir1_w(m_sasi_ctrl & 1); + else + m_pic2->ir1_w(0); + + m_dmac->dreq0_w(!(state && !(m_sasi_ctrl_in->read() & 8) && (m_sasi_ctrl & 2))); +} + + +READ8_MEMBER( pc9801_state::sasi_status_r ) +{ + UINT8 res = 0; + + if(m_sasi_ctrl & 0x40) // read status + { + /* + x--- ---- REQ + -x-- ---- ACK + --x- ---- BSY + ---x ---- MSG + ---- x--- CD + ---- -x-- IO + ---- ---x INT? + */ + res |= m_sasi_ctrl_in->read(); + } + else // read drive info + { +/* + xx-- ---- unknown but tested + --xx x--- SASI-1 media type + ---- -xxx SASI-2 media type +*/ + //res |= 7 << 3; // read mediatype SASI-1 + //res |= 7; // read mediatype SASI-2 + } + return res; +} + +WRITE8_MEMBER( pc9801_state::sasi_ctrl_w ) +{ + /* + x--- ---- channel enable + -x-- ---- read switch + --x- ---- sel + ---- x--- reset line + ---- --x- dma enable + ---- ---x irq enable + */ + + m_sasibus->write_sel(BIT(data, 5)); + + if(m_sasi_ctrl & 8 && ((data & 8) == 0)) // 1 -> 0 transition + { + m_sasibus->write_rst(1); +// m_timer_rst->adjust(attotime::from_nsec(100)); + } + else + m_sasibus->write_rst(0); // TODO + + m_sasi_ctrl = data; + +// m_sasibus->write_sel(BIT(data, 0)); +} + +static ADDRESS_MAP_START( pc9801_map, AS_PROGRAM, 16, pc9801_state ) + AM_RANGE(0x00000, 0x9ffff) AM_RAM //work RAM + AM_RANGE(0xa0000, 0xa3fff) AM_READWRITE(tvram_r,tvram_w) //TVRAM + AM_RANGE(0xa8000, 0xbffff) AM_READWRITE8(gvram_r,gvram_w,0xffff) //bitmap VRAM + AM_RANGE(0xcc000, 0xcdfff) AM_ROM AM_REGION("sound_bios",0) //sound BIOS + AM_RANGE(0xd6000, 0xd6fff) AM_ROM AM_REGION("fdc_bios_2dd",0) //floppy BIOS 2dd + AM_RANGE(0xd7000, 0xd7fff) AM_ROM AM_REGION("fdc_bios_2hd",0) //floppy BIOS 2hd + AM_RANGE(0xe8000, 0xfffff) AM_ROM AM_REGION("ipl",0) +ADDRESS_MAP_END + +/* first device is even offsets, second one is odd offsets */ +static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("i8237", am9517a_device, read, write, 0xff00) + AM_RANGE(0x0000, 0x000f) AM_READWRITE8(pic_r, pic_w, 0x00ff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA + AM_RANGE(0x0020, 0x0027) AM_WRITE8(rtc_dmapg_w,0xffff) // RTC / DMA registers (LS244) + AM_RANGE(0x0030, 0x0037) AM_DEVREADWRITE8("ppi8255_sys", i8255_device, read, write, 0xff00) //i8251 RS232c / i8255 system port + AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255_prn", i8255_device, read, write, 0x00ff) + AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("keyb", pc9801_kbd_device, rx_r, tx_w, 0xff00) //i8255 printer port / i8251 keyboard + AM_RANGE(0x0050, 0x0057) AM_DEVREADWRITE8("ppi8255_fdd", i8255_device, read, write, 0xff00) + AM_RANGE(0x0050, 0x0053) AM_WRITE8(nmi_ctrl_w,0x00ff) // NMI FF / i8255 floppy port (2d?) + AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("upd7220_chr", upd7220_device, read, write, 0x00ff) //upd7220 character ports / + AM_RANGE(0x0064, 0x0065) AM_WRITE8(vrtc_clear_w,0x00ff) + AM_RANGE(0x0068, 0x0069) AM_WRITE8(pc9801_video_ff_w,0x00ff) //mode FF / +// AM_RANGE(0x006c, 0x006f) border color / + AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00) + AM_RANGE(0x0070, 0x007b) AM_READWRITE8(txt_scrl_r,txt_scrl_w,0x00ff) //display registers / i8253 pit + AM_RANGE(0x0080, 0x0081) AM_READWRITE8(sasi_data_r, sasi_data_w, 0x00ff) + AM_RANGE(0x0082, 0x0083) AM_READWRITE8(sasi_status_r, sasi_ctrl_w,0x00ff) + AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801_fdc_2hd_r,pc9801_fdc_2hd_w,0xffff) //upd765a 2hd / cmt + AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,pc9801_a0_w,0xffff) //upd7220 bitmap ports / display registers + AM_RANGE(0x00c8, 0x00cd) AM_READWRITE8(pc9801_fdc_2dd_r,pc9801_fdc_2dd_w,0xffff) //upd765a 2dd / +// AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,pc9801_opn_w,0xffff) //ym2203 opn / + AM_RANGE(0x7fd8, 0x7fdf) AM_DEVREADWRITE8("ppi8255_mouse", i8255_device, read, write, 0xff00) +ADDRESS_MAP_END + +/************************************* + * + * PC-9801RS specific handlers (IA-32) + * + ************************************/ + +READ8_MEMBER(pc9801_state::pc9801rs_ipl_r) { return m_ipl_rom[(offset & 0x1ffff)+(m_rom_bank*0x20000)]; } + +/* TODO: it's possible that the offset calculation is actually linear. */ +/* TODO: having this non-linear makes the system to boot in BASIC for PC-9821. Perhaps it stores settings? How to change these? */ +READ8_MEMBER(pc9801_state::pc9801rs_knjram_r) +{ + UINT32 pcg_offset; + + pcg_offset = m_font_addr << 5; + pcg_offset|= offset & 0x1e; + pcg_offset|= m_font_lr; + + if(!(m_font_addr & 0xff)) + { + int char_size = m_video_ff[FONTSEL_REG]; + return m_char_rom[(m_font_addr >> 8) * (8 << char_size) + (char_size * 0x800) + ((offset >> 1) & 0xf)]; + } + + /* TODO: investigate on this difference */ + if((m_font_addr & 0xff00) == 0x5600 || (m_font_addr & 0xff00) == 0x5700) + return m_kanji_rom[pcg_offset]; + + pcg_offset = m_font_addr << 5; + pcg_offset|= offset & 0x1f; +// pcg_offset|= m_font_lr; + + return m_kanji_rom[pcg_offset]; +} + +WRITE8_MEMBER(pc9801_state::pc9801rs_knjram_w) +{ + UINT32 pcg_offset; + + pcg_offset = m_font_addr << 5; + pcg_offset|= offset & 0x1e; + pcg_offset|= m_font_lr; + + if((m_font_addr & 0xff00) == 0x5600 || (m_font_addr & 0xff00) == 0x5700) + { + m_kanji_rom[pcg_offset] = data; + m_gfxdecode->gfx(2)->mark_dirty(pcg_offset >> 5); + } +} + +/* FF-based */ +WRITE8_MEMBER(pc9801_state::pc9801rs_bank_w) +{ + if(offset == 1) + { + if((data & 0xf0) == 0x00 || (data & 0xf0) == 0x10) + { + if((data & 0xed) == 0x00) + { + m_rom_bank = (data & 2) >> 1; + return; + } + } + + logerror("Unknown EMS ROM setting %02x\n",data); + } + if(offset == 3) + { + if((data & 0xf0) == 0x20) + m_vram_bank = (data & 2) >> 1; + else + { + logerror("Unknown EMS RAM setting %02x\n",data); + } + } +} + +READ8_MEMBER(pc9801_state::a20_ctrl_r) +{ + if(offset == 0x01) + return (m_gate_a20 ^ 1) | 0xfe; + else if(offset == 0x03) + return (m_gate_a20 ^ 1) | (m_nmi_enable << 1); + + return 0x00; +} + +WRITE8_MEMBER(pc9801_state::a20_ctrl_w) +{ + if(offset == 0x00) + { + UINT8 por; + /* reset POR bit, TODO: is there any other way? */ + por = machine().device("ppi8255_sys")->read(space, 2) & ~0x20; + machine().device("ppi8255_sys")->write(space, 2,por); + m_maincpu->set_input_line(INPUT_LINE_A20, 0); + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + m_gate_a20 = 0; + } + + if(offset == 0x01) + m_gate_a20 = 1; + + if(offset == 0x03) + { + if(data == 0x02) + m_gate_a20 = 1; + else if(data == 0x03) + m_gate_a20 = 0; + } + m_maincpu->set_input_line(INPUT_LINE_A20, m_gate_a20); +} + +READ8_MEMBER(pc9801_state::grcg_r) +{ + if(offset == 6) + { + logerror("GRCG mode R\n"); + return 0xff; + } + else if(offset == 7) + { + logerror("GRCG tile R\n"); + return 0xff; + } + return txt_scrl_r(space,offset); +} + +WRITE8_MEMBER(pc9801_state::grcg_w) +{ + if(offset == 6) + { +// logerror("%02x GRCG MODE\n",data); + m_grcg.mode = data; + m_grcg.tile_index = 0; + return; + } + else if(offset == 7) + { +// logerror("%02x GRCG TILE %02x\n",data,m_grcg.tile_index); + m_grcg.tile[m_grcg.tile_index] = BITSWAP8(data,0,1,2,3,4,5,6,7); + m_grcg.tile_index ++; + m_grcg.tile_index &= 3; + return; + } + + txt_scrl_w(space,offset,data); +} + +WRITE16_MEMBER(pc9801_state::egc_w) +{ + if(!m_ex_video_ff[2]) + return; + + if(!(m_egc.regs[1] & 0x6000) || (offset != 4)) // why? + COMBINE_DATA(&m_egc.regs[offset]); + switch(offset) + { + case 1: + case 3: + case 5: + { + UINT8 color = 0; + switch((m_egc.regs[1] >> 13) & 3) + { + case 1: + //back color + color = m_egc.regs[5]; + break; + case 2: + //fore color + color = m_egc.regs[3]; + break; + default: + return; + } + m_egc.pat[0] = (color & 1) ? 0xffff : 0; + m_egc.pat[1] = (color & 2) ? 0xffff : 0; + m_egc.pat[2] = (color & 4) ? 0xffff : 0; + m_egc.pat[3] = (color & 8) ? 0xffff : 0; + break; + } + case 6: + case 7: + m_egc.count = (m_egc.regs[7] & 0xfff) + 1; + m_egc.first = true; + m_egc.init = false; + break; + } +} + +READ8_MEMBER(pc9801_state::pc9810rs_fdc_ctrl_r) +{ + return (m_fdc_ctrl & 3) | 0xf0 | 8 | 4; +} + +WRITE8_MEMBER(pc9801_state::pc9810rs_fdc_ctrl_w) +{ + /* + ---- x--- ready line? + ---- --x- select type (1) 2hd (0) 2dd + ---- ---x select irq + */ + + m_fdc_2hd->subdevice("0")->get_device()->set_rpm(data & 0x02 ? 360 : 300); + m_fdc_2hd->subdevice("1")->get_device()->set_rpm(data & 0x02 ? 360 : 300); + + m_fdc_2hd->set_rate(data & 0x02 ? 500000 : 250000); + + m_fdc_ctrl = data; + //if(data & 0xfc) + // logerror("FDC ctrl called with %02x\n",data); +} + +READ8_MEMBER(pc9801_state::pc9801rs_2hd_r) +{ + if((offset & 1) == 0) + { + switch(offset & 6) + { + case 0: return m_fdc_2hd->msr_r(space, 0, 0xff); + case 2: return m_fdc_2hd->fifo_r(space, 0, 0xff); + case 4: return 0x44; //2hd flag + } + } + + logerror("Read to undefined port [%02x]\n",offset+0x90); + + return 0xff; +} + +WRITE8_MEMBER(pc9801_state::pc9801rs_2hd_w) +{ + if((offset & 1) == 0) + { + switch(offset & 6) + { + case 2: m_fdc_2hd->fifo_w(space, 0, data, 0xff); return; + case 4: + if(data & 0x80) + m_fdc_2hd->soft_reset(); + + if(data & 0x40) + { + m_fdc_2hd->set_ready_line_connected(0); + m_fdc_2hd->ready_w(0); + } + else + m_fdc_2hd->set_ready_line_connected(1); + + //TODO: verify + if(!(m_fdc_ctrl & 4)) + { + m_fdc_2hd->subdevice("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); + m_fdc_2hd->subdevice("1")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); + } + return; + } + } + + logerror("Write to undefined port [%02x] %02x\n",offset+0x90,data); +} + +#if 0 +READ8_MEMBER(pc9801_state::pc9801rs_2dd_r) +{ +// if(m_fdc_ctrl & 1) +// return 0xff; + + if((offset & 1) == 0) + { + switch(offset & 6) + { + case 0: return machine().device("upd765_2hd")->msr_r(space, 0, 0xff); + case 2: return machine().device("upd765_2hd")->fifo_r(space, 0, 0xff); + case 4: return 0x44; //2dd flag + } + } + + logerror("Read to undefined port [%02x]\n",offset+0x90); + + return 0xff; +} + +WRITE8_MEMBER(pc9801_state::pc9801rs_2dd_w) +{ +// if(m_fdc_ctrl & 1) +// return; + + if((offset & 1) == 0) + { + switch(offset & 6) + { + case 2: machine().device("upd765_2hd")->fifo_w(space, 0, data, 0xff); return; + case 4: logerror("%02x 2DD FDC ctrl\n",data); return; + } + } + + logerror("Write to undefined port [%02x] %02x\n",offset+0x90,data); +} +#endif + +WRITE8_MEMBER(pc9801_state::pc9801rs_video_ff_w) +{ + if(offset == 1) + { + if((data & 0xf0) == 0) /* disable any PC-9821 specific HW regs */ + m_ex_video_ff[(data & 0xfe) >> 1] = data & 1; + + if(0) + { + static const char *const ex_video_ff_regnames[] = + { + "16 colors mode", // 0 + "", // 1 + "EGC related", // 2 + "" // 3 + }; + + logerror("Write to extended video FF register %s -> %02x\n",ex_video_ff_regnames[(data & 0x06) >> 1],data & 1); + } + //else + // logerror("Write to extended video FF register %02x\n",data); + + return; + } + + pc9801_video_ff_w(space,offset,data); +} + +WRITE8_MEMBER(pc9801_state::pc9801rs_a0_w) +{ + if((offset & 1) == 0 && offset & 8 && m_ex_video_ff[ANALOG_16_MODE]) + { + switch(offset) + { + case 0x08: m_analog16.pal_entry = data & 0xf; break; + case 0x0a: m_analog16.g[m_analog16.pal_entry] = data & 0xf; break; + case 0x0c: m_analog16.r[m_analog16.pal_entry] = data & 0xf; break; + case 0x0e: m_analog16.b[m_analog16.pal_entry] = data & 0xf; break; + } + + m_palette->set_pen_color((m_analog16.pal_entry)+0x10, + pal4bit(m_analog16.r[m_analog16.pal_entry]), + pal4bit(m_analog16.g[m_analog16.pal_entry]), + pal4bit(m_analog16.b[m_analog16.pal_entry])); + return; + } + + pc9801_a0_w(space,offset,data); +} + +READ8_MEMBER( pc9801_state::pc9801rs_access_ctrl_r ) +{ + if(offset == 1) + return m_access_ctrl; + + return 0xff; +} + +WRITE8_MEMBER( pc9801_state::pc9801rs_access_ctrl_w ) +{ + if(offset == 1) + m_access_ctrl = data; +} + +WRITE8_MEMBER( pc9801_state::pc9801rs_mouse_freq_w ) +{ + /* TODO: bit 3 used */ + if(offset == 3) + { + m_mouse.freq_reg = data & 3; + m_mouse.freq_index = 0; + } +} + + +WRITE8_MEMBER( pc9801_state::pc9801rs_nmi_w ) +{ + if(offset == 0) + m_nmi_enable = 0; + + if(offset == 2) + m_nmi_enable = 1; +} + +READ8_MEMBER( pc9801_state::pc9801rs_midi_r ) +{ + /* unconnect, needed by Amaranth KH to boot */ + return 0xff; +} + +READ8_MEMBER(pc9801_state::pic_r) +{ + return ((offset >= 4) ? m_pic2 : m_pic1)->read(space, offset & 3); +} + +WRITE8_MEMBER(pc9801_state::pic_w) +{ + ((offset >= 4) ? m_pic2 : m_pic1)->write(space, offset & 3, data); +} + +READ16_MEMBER(pc9801_state::grcg_gvram_r) +{ + UINT16 ret = upd7220_grcg_r(space, (offset + 0x4000) | (m_vram_bank << 16), mem_mask); + return BITSWAP16(ret,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); +} + +WRITE16_MEMBER(pc9801_state::grcg_gvram_w) +{ + data = BITSWAP16(data,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); + upd7220_grcg_w(space, (offset + 0x4000) | (m_vram_bank << 16), data, mem_mask); +} + +READ16_MEMBER(pc9801_state::grcg_gvram0_r) +{ + UINT16 ret = upd7220_grcg_r(space, offset | (m_vram_bank << 16), mem_mask); + return BITSWAP16(ret,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); +} + +WRITE16_MEMBER(pc9801_state::grcg_gvram0_w) +{ + data = BITSWAP16(data,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); + upd7220_grcg_w(space, offset | (m_vram_bank << 16), data, mem_mask); +} + +static ADDRESS_MAP_START( pc9801ux_map, AS_PROGRAM, 16, pc9801_state ) + AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("wram") + AM_RANGE(0x0a0000, 0x0a3fff) AM_READWRITE(tvram_r, tvram_w) + AM_RANGE(0x0a4000, 0x0a4fff) AM_READWRITE8(pc9801rs_knjram_r, pc9801rs_knjram_w, 0xffff) + AM_RANGE(0x0a8000, 0x0bffff) AM_READWRITE(grcg_gvram_r, grcg_gvram_w) + AM_RANGE(0x0e0000, 0x0e7fff) AM_READWRITE(grcg_gvram0_r,grcg_gvram0_w) + AM_RANGE(0x0e0000, 0x0fffff) AM_READ8(pc9801rs_ipl_r, 0xffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc9801ux_io, AS_IO, 16, pc9801_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0050, 0x0057) AM_NOP // 2dd ppi? + AM_RANGE(0x005c, 0x005f) AM_READ(pc9821_timestamp_r) AM_WRITENOP // artic + AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9801rs_video_ff_w,0x00ff) //mode FF / + AM_RANGE(0x0070, 0x007f) AM_READWRITE8(grcg_r, grcg_w, 0x00ff) //display registers "GRCG" / i8253 pit + AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffff) + AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r, pc9801rs_a0_w, 0xffff) //upd7220 bitmap ports / display registers + AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffff) + AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffff) + AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(a20_ctrl_r, a20_ctrl_w, 0x00ff) + AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffff) + AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffff) //ROM/RAM bank + AM_RANGE(0x04a0, 0x04af) AM_WRITE(egc_w) + AM_RANGE(0x3fd8, 0x3fdf) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00) +// AM_RANGE(0xa460, 0xa463) AM_READWRITE8(pc9801_ext_opna_r, pc9801_ext_opna_w, 0xffff) + AM_IMPORT_FROM(pc9801_io) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc9801rs_map, AS_PROGRAM, 16, pc9801_state ) +// AM_RANGE(0x0d8000, 0x0d9fff) AM_ROM AM_REGION("ide",0) + AM_RANGE(0x0da000, 0x0dbfff) AM_RAM // ide ram + AM_RANGE(0xee0000, 0xefffff) AM_READ8(pc9801rs_ipl_r, 0xffff) + AM_RANGE(0xfe0000, 0xffffff) AM_READ8(pc9801rs_ipl_r, 0xffff) + AM_IMPORT_FROM(pc9801ux_map) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc9801rs_io, AS_IO, 16, pc9801_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0050, 0x0053) AM_WRITE8(pc9801rs_nmi_w, 0xffff) + AM_RANGE(0x0430, 0x0433) AM_READ8(ide_hack_r, 0x00ff) + AM_RANGE(0x0640, 0x064f) AM_DEVREADWRITE("ide", ata_interface_device, read_cs0, write_cs0) + AM_RANGE(0x0740, 0x074f) AM_DEVREADWRITE("ide", ata_interface_device, read_cs1, write_cs1) + AM_RANGE(0xbfd8, 0xbfdf) AM_WRITE8(pc9801rs_mouse_freq_w, 0xffff) + AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(pc9801rs_midi_r, 0xffff) + AM_IMPORT_FROM(pc9801ux_io) +ADDRESS_MAP_END + +/************************************* + * + * PC-9821 specific handlers + * + ************************************/ + +WRITE8_MEMBER(pc9801_state::pc9821_video_ff_w) +{ + if(offset == 1) + { + m_ex_video_ff[(data & 0xfe) >> 1] = data & 1; + + //if((data & 0xfe) == 0x20) + // logerror("%02x\n",data & 1); + } + + /* Intentional fall-through */ + pc9801rs_video_ff_w(space,offset,data); +} + +READ8_MEMBER(pc9801_state::pc9821_a0_r) +{ + if((offset & 1) == 0 && offset & 8) + { + if(m_ex_video_ff[ANALOG_256_MODE]) + { + logerror("256 color mode [%02x] R\n",offset); + return 0; + } + else if(m_ex_video_ff[ANALOG_16_MODE]) //16 color mode, readback possible there + { + UINT8 res = 0; + + switch(offset) + { + case 0x08: res = m_analog16.pal_entry & 0xf; break; + case 0x0a: res = m_analog16.g[m_analog16.pal_entry] & 0xf; break; + case 0x0c: res = m_analog16.r[m_analog16.pal_entry] & 0xf; break; + case 0x0e: res = m_analog16.b[m_analog16.pal_entry] & 0xf; break; + } + + return res; + } + } + + return pc9801_a0_r(space,offset); +} + +WRITE8_MEMBER(pc9801_state::pc9821_a0_w) +{ + if((offset & 1) == 0 && offset & 8 && m_ex_video_ff[ANALOG_256_MODE]) + { + switch(offset) + { + case 0x08: m_analog256.pal_entry = data & 0xff; break; + case 0x0a: m_analog256.g[m_analog256.pal_entry] = data & 0xff; break; + case 0x0c: m_analog256.r[m_analog256.pal_entry] = data & 0xff; break; + case 0x0e: m_analog256.b[m_analog256.pal_entry] = data & 0xff; break; + } + + m_palette->set_pen_color((m_analog256.pal_entry)+0x20, + m_analog256.r[m_analog256.pal_entry], + m_analog256.g[m_analog256.pal_entry], + m_analog256.b[m_analog256.pal_entry]); + return; + } + + pc9801rs_a0_w(space,offset,data); +} + +READ8_MEMBER(pc9801_state::pc9821_window_bank_r) +{ + if(offset == 1) + return m_pc9821_window_bank & 0xfe; + + return 0xff; +} + +WRITE8_MEMBER(pc9801_state::pc9821_window_bank_w) +{ + if(offset == 1) + m_pc9821_window_bank = data & 0xfe; + else + logerror("PC-9821 $f0000 window bank %02x\n",data); +} + +UINT8 pc9801_state::m_sdip_read(UINT16 port, UINT8 sdip_offset) +{ + if(port == 2) + return m_sdip[sdip_offset]; + + logerror("Warning: read from unknown SDIP area %02x %04x\n",port,0x841c + port + (sdip_offset % 12)*0x100); + return 0xff; +} + +void pc9801_state::m_sdip_write(UINT16 port, UINT8 sdip_offset,UINT8 data) +{ + if(port == 2) + { + m_sdip[sdip_offset] = data; + return; + } + + logerror("Warning: write from unknown SDIP area %02x %04x %02x\n",port,0x841c + port + (sdip_offset % 12)*0x100,data); +} + +READ8_MEMBER(pc9801_state::sdip_0_r) { return m_sdip_read(offset, 0+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_1_r) { return m_sdip_read(offset, 1+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_2_r) { return m_sdip_read(offset, 2+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_3_r) { return m_sdip_read(offset, 3+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_4_r) { return m_sdip_read(offset, 4+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_5_r) { return m_sdip_read(offset, 5+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_6_r) { return m_sdip_read(offset, 6+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_7_r) { return m_sdip_read(offset, 7+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_8_r) { return m_sdip_read(offset, 8+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_9_r) { return m_sdip_read(offset, 9+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_a_r) { return m_sdip_read(offset, 10+m_sdip_bank*12); } +READ8_MEMBER(pc9801_state::sdip_b_r) { return m_sdip_read(offset, 11+m_sdip_bank*12); } + +WRITE8_MEMBER(pc9801_state::sdip_0_w) { m_sdip_write(offset,0+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_1_w) { m_sdip_write(offset,1+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_2_w) { m_sdip_write(offset,2+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_3_w) { m_sdip_write(offset,3+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_4_w) { m_sdip_write(offset,4+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_5_w) { m_sdip_write(offset,5+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_6_w) { m_sdip_write(offset,6+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_7_w) { m_sdip_write(offset,7+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_8_w) { m_sdip_write(offset,8+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_9_w) { m_sdip_write(offset,9+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_a_w) { m_sdip_write(offset,10+m_sdip_bank*12,data); } +WRITE8_MEMBER(pc9801_state::sdip_b_w) +{ + if(offset == 3) + m_sdip_bank = (data & 0x40) >> 6; + + if(offset == 2) + m_sdip_write(offset,11+m_sdip_bank*12,data); + + if((offset & 2) == 0) + logerror("SDIP area B write %02x %02x\n",offset,data); +} + +READ16_MEMBER(pc9801_state::pc9821_timestamp_r) +{ + return (m_maincpu->total_cycles() >> (16 * offset)); +} + +/* basically a read-back of various registers */ +READ8_MEMBER(pc9801_state::pc9821_ext2_video_ff_r) +{ + UINT8 res; + + res = 0; + + switch(m_ext2_ff) + { + case 3: res = m_video_ff[DISPLAY_REG]; break; // display reg + default: + logerror("PC-9821: read ext2 f/f with value %02x\n",m_ext2_ff); + } + + return res; +} + +WRITE8_MEMBER(pc9801_state::pc9821_ext2_video_ff_w) +{ + m_ext2_ff = data; +} + +/*READ8_MEMBER(pc9801_state::winram_r) +{ + offset = (offset & 0x1ffff) | (m_pc9821_window_bank & 0xfe) * 0x10000; + return +} + + +WRITE8_MEMBER(pc9801_state::winram_w) +{ + offset = (offset & 0x1ffff) | (m_pc9821_window_bank & 0xfe) * 0x10000; +}*/ + +static ADDRESS_MAP_START( pc9821_map, AS_PROGRAM, 32, pc9801_state ) + AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("wram") + //AM_RANGE(0x00080000, 0x0009ffff) AM_READWRITE8(winram_r, winram_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000a3fff) AM_READWRITE16(tvram_r, tvram_w, 0xffffffff) + AM_RANGE(0x000a4000, 0x000a4fff) AM_READWRITE8(pc9801rs_knjram_r, pc9801rs_knjram_w, 0xffffffff) + AM_RANGE(0x000a8000, 0x000bffff) AM_READWRITE16(grcg_gvram_r, grcg_gvram_w, 0xffffffff) + AM_RANGE(0x000cc000, 0x000cdfff) AM_ROM AM_REGION("sound_bios",0) //sound BIOS +// AM_RANGE(0x000d8000, 0x000d9fff) AM_ROM AM_REGION("ide",0) + AM_RANGE(0x000da000, 0x000dbfff) AM_RAM // ide ram + AM_RANGE(0x000e0000, 0x000e7fff) AM_READWRITE16(grcg_gvram0_r,grcg_gvram0_w, 0xffffffff) + AM_RANGE(0x000e0000, 0x000fffff) AM_READ8(pc9801rs_ipl_r, 0xffffffff) + AM_RANGE(0x00f00000, 0x00f9ffff) AM_RAM AM_SHARE("ext_gvram") + AM_RANGE(0xffee0000, 0xffefffff) AM_READ8(pc9801rs_ipl_r, 0xffffffff) + AM_RANGE(0xfffe0000, 0xffffffff) AM_READ8(pc9801rs_ipl_r, 0xffffffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) +// ADDRESS_MAP_UNMAP_HIGH // TODO: a read to somewhere makes this to fail at POST + AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("i8237", am9517a_device, read, write, 0xff00ff00) + AM_RANGE(0x0000, 0x000f) AM_READWRITE8(pic_r, pic_w, 0x00ff00ff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA + AM_RANGE(0x0020, 0x0027) AM_WRITE8(rtc_dmapg_w, 0xffffffff) // RTC / DMA registers (LS244) + AM_RANGE(0x0030, 0x0037) AM_DEVREADWRITE8("ppi8255_sys", i8255_device, read, write, 0xff00ff00) //i8251 RS232c / i8255 system port + AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255_prn", i8255_device, read, write, 0x00ff00ff) + AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("keyb", pc9801_kbd_device, rx_r, tx_w, 0xff00ff00) //i8255 printer port / i8251 keyboard + AM_RANGE(0x0050, 0x0053) AM_WRITE8(pc9801rs_nmi_w, 0xffffffff) + AM_RANGE(0x005c, 0x005f) AM_READ16(pc9821_timestamp_r,0xffffffff) AM_WRITENOP // artic + AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("upd7220_chr", upd7220_device, read, write, 0x00ff00ff) //upd7220 character ports / + AM_RANGE(0x0064, 0x0067) AM_WRITE8(vrtc_clear_w, 0x000000ff) + AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9821_video_ff_w, 0x00ff00ff) //mode FF / + AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00ff00) + AM_RANGE(0x0070, 0x007f) AM_READWRITE8(grcg_r, grcg_w, 0x00ff00ff) //display registers "GRCG" / i8253 pit + AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffffffff) + AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9821_a0_r, pc9821_a0_w, 0xffffffff) //upd7220 bitmap ports / display registers +// AM_RANGE(0x00b0, 0x00b3) PC9861k (serial port?) +// AM_RANGE(0x00b9, 0x00b9) PC9861k +// AM_RANGE(0x00bb, 0x00bb) PC9861k + AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffffffff) + AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffffffff) +// AM_RANGE(0x00d8, 0x00df) AMD98 (sound?) board + AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(a20_ctrl_r, a20_ctrl_w, 0x00ff00ff) +// AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffffffff) //ym2203 opn / +// AM_RANGE(0x018c, 0x018f) YM2203 OPN extended ports / + AM_RANGE(0x0430, 0x0433) AM_READ8(ide_hack_r, 0x000000ff) + AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffffffff) +// AM_RANGE(0x043d, 0x043d) ROM/RAM bank (NEC) + AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffffffff) //ROM/RAM bank (EPSON) + AM_RANGE(0x0460, 0x0463) AM_READWRITE8(pc9821_window_bank_r,pc9821_window_bank_w, 0xffffffff) + AM_RANGE(0x04a0, 0x04af) AM_WRITE16(egc_w, 0xffffffff) +// AM_RANGE(0x04be, 0x04be) FDC "RPM" register + AM_RANGE(0x0640, 0x064f) AM_DEVREADWRITE16("ide", ata_interface_device, read_cs0, write_cs0, 0xffffffff) + AM_RANGE(0x0740, 0x074f) AM_DEVREADWRITE16("ide", ata_interface_device, read_cs1, write_cs1, 0xffffffff) +// AM_RANGE(0x08e0, 0x08ea) / EMM SIO registers + AM_RANGE(0x09a0, 0x09a3) AM_READWRITE8(pc9821_ext2_video_ff_r, pc9821_ext2_video_ff_w, 0x000000ff) // GDC extended register r/w +// AM_RANGE(0x09a8, 0x09a8) GDC 31KHz register r/w +// AM_RANGE(0x0c07, 0x0c07) EPSON register w +// AM_RANGE(0x0c03, 0x0c03) EPSON register 0 r +// AM_RANGE(0x0c13, 0x0c14) EPSON register 1 r +// AM_RANGE(0x0c24, 0x0c24) cs4231 PCM board register control +// AM_RANGE(0x0c2b, 0x0c2b) cs4231 PCM board low byte control +// AM_RANGE(0x0c2d, 0x0c2d) cs4231 PCM board hi byte control +// AM_RANGE(0x0cc0, 0x0cc7) SCSI interface / +// AM_RANGE(0x0cfc, 0x0cff) PCI bus + AM_RANGE(0x3fd8, 0x3fdf) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00ff00) // / pit mirror ports + AM_RANGE(0x7fd8, 0x7fdf) AM_DEVREADWRITE8("ppi8255_mouse", i8255_device, read, write, 0xff00ff00) + AM_RANGE(0x841c, 0x841f) AM_READWRITE8(sdip_0_r,sdip_0_w,0xffffffff) + AM_RANGE(0x851c, 0x851f) AM_READWRITE8(sdip_1_r,sdip_1_w,0xffffffff) + AM_RANGE(0x861c, 0x861f) AM_READWRITE8(sdip_2_r,sdip_2_w,0xffffffff) + AM_RANGE(0x871c, 0x871f) AM_READWRITE8(sdip_3_r,sdip_3_w,0xffffffff) + AM_RANGE(0x881c, 0x881f) AM_READWRITE8(sdip_4_r,sdip_4_w,0xffffffff) + AM_RANGE(0x891c, 0x891f) AM_READWRITE8(sdip_5_r,sdip_5_w,0xffffffff) + AM_RANGE(0x8a1c, 0x8a1f) AM_READWRITE8(sdip_6_r,sdip_6_w,0xffffffff) + AM_RANGE(0x8b1c, 0x8b1f) AM_READWRITE8(sdip_7_r,sdip_7_w,0xffffffff) + AM_RANGE(0x8c1c, 0x8c1f) AM_READWRITE8(sdip_8_r,sdip_8_w,0xffffffff) + AM_RANGE(0x8d1c, 0x8d1f) AM_READWRITE8(sdip_9_r,sdip_9_w,0xffffffff) + AM_RANGE(0x8e1c, 0x8e1f) AM_READWRITE8(sdip_a_r,sdip_a_w,0xffffffff) + AM_RANGE(0x8f1c, 0x8f1f) AM_READWRITE8(sdip_b_r,sdip_b_w,0xffffffff) +// AM_RANGE(0xa460, 0xa463) AM_READWRITE8(pc9801_ext_opna_r, pc9801_ext_opna_w, 0xffffffff) +// AM_RANGE(0xa460, 0xa46f) cs4231 PCM extended port / +// AM_RANGE(0xbfdb, 0xbfdb) mouse timing port +// AM_RANGE(0xc0d0, 0xc0d3) MIDI port, option 0 / +// AM_RANGE(0xc4d0, 0xc4d3) MIDI port, option 1 / +// AM_RANGE(0xc8d0, 0xc8d3) MIDI port, option 2 / +// AM_RANGE(0xccd0, 0xccd3) MIDI port, option 3 / +// AM_RANGE(0xd0d0, 0xd0d3) MIDI port, option 4 / +// AM_RANGE(0xd4d0, 0xd4d3) MIDI port, option 5 / +// AM_RANGE(0xd8d0, 0xd8d3) MIDI port, option 6 / +// AM_RANGE(0xdcd0, 0xdcd3) MIDI port, option 7 / + AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(pc9801rs_midi_r, 0xffffffff) // MIDI port, option 8 / +// AM_RANGE(0xe4d0, 0xe4d3) MIDI port, option 9 / +// AM_RANGE(0xe8d0, 0xe8d3) MIDI port, option A / +// AM_RANGE(0xecd0, 0xecd3) MIDI port, option B / +// AM_RANGE(0xf0d0, 0xf0d3) MIDI port, option C / +// AM_RANGE(0xf4d0, 0xf4d3) MIDI port, option D / +// AM_RANGE(0xf8d0, 0xf8d3) MIDI port, option E / +// AM_RANGE(0xfcd0, 0xfcd3) MIDI port, option F / +ADDRESS_MAP_END + +static ADDRESS_MAP_START( upd7220_1_map, AS_0, 16, pc9801_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram_1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( upd7220_2_map, AS_0, 16, pc9801_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram_2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( upd7220_grcg_2_map, AS_0, 16, pc9801_state ) + AM_RANGE(0x00000, 0x3ffff) AM_READWRITE(upd7220_grcg_r, upd7220_grcg_w) AM_SHARE("video_ram_2") +ADDRESS_MAP_END + +CUSTOM_INPUT_MEMBER(pc9801_state::system_type_r) +{ +// System Type (0x00 stock PC-9801, 0xc0 PC-9801U / PC-98LT, PC-98HA, 0x80 others) + return m_sys_type; +} + +static INPUT_PORTS_START( pc9801 ) + PORT_START("DSW1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH,IPT_SPECIAL) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_device, data_out_r) + PORT_DIPNAME( 0x0002, 0x0000, "DSW1" ) // error beep if OFF + PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0008, 0x0008, "Display Type" ) PORT_DIPLOCATION("SW2:1") + PORT_DIPSETTING( 0x0000, "Normal Display" ) + PORT_DIPSETTING( 0x0008, "Hi-Res Display" ) + PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_START("DSW5") + PORT_DIPNAME( 0x01, 0x00, "DSW5" ) // goes into basic with this off, PC-9801VF / PC-9801U setting + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) // V30 / V33 + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) // printer busy + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) // 8 / 4096 + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) // LCD display + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) //system clock = 5 MHz (0) / 8 MHz (1) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pc9801_state, system_type_r, NULL) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, "System Specification" ) PORT_DIPLOCATION("SW1:1") //jumps to daa00 if off, presumably some card booting + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "Terminal Mode" ) PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, "Text width" ) PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x04, "40 chars/line" ) + PORT_DIPSETTING( 0x00, "80 chars/line" ) + PORT_DIPNAME( 0x08, 0x00, "Text height" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x08, "20 lines/screen" ) + PORT_DIPSETTING( 0x00, "25 lines/screen" ) + PORT_DIPNAME( 0x10, 0x00, "Memory Switch Init" ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) //Fix memory switch condition + PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) //Initialize Memory Switch with the system default + PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW1:6" ) + PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW1:7" ) + PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW1:8" ) + + PORT_START("DSW3") + PORT_DIPNAME( 0x01, 0x01, "DSW3" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW4") + PORT_DIPNAME( 0x01, 0x01, "DSW4" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("MOUSE_X") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_RESET PORT_SENSITIVITY(30) PORT_KEYDELTA(30) + + PORT_START("MOUSE_Y") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_RESET PORT_SENSITIVITY(30) PORT_KEYDELTA(30) + + PORT_START("MOUSE_B") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_CODE(MOUSECODE_BUTTON3) PORT_NAME("Mouse Middle Button") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Right Button") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Left Button") + + PORT_START("ROM_LOAD") + PORT_CONFNAME( 0x01, 0x01, "Load floppy 2hd BIOS" ) + PORT_CONFSETTING( 0x00, DEF_STR( Yes ) ) + PORT_CONFSETTING( 0x01, DEF_STR( No ) ) + PORT_CONFNAME( 0x02, 0x02, "Load floppy 2dd BIOS" ) + PORT_CONFSETTING( 0x00, DEF_STR( Yes ) ) + PORT_CONFSETTING( 0x02, DEF_STR( No ) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc9801rs ) + PORT_INCLUDE( pc9801 ) + + PORT_MODIFY("DSW2") + PORT_DIPNAME( 0x80, 0x80, "GDC clock" ) PORT_DIPLOCATION("SW1:8") // DSW 2-8 + PORT_DIPSETTING( 0x80, "2.5 MHz" ) + PORT_DIPSETTING( 0x00, "5 MHz" ) + + PORT_MODIFY("DSW4") + PORT_DIPNAME( 0x04, 0x00, "CPU Type" ) PORT_DIPLOCATION("SW4:8") // DSW 3-8 + PORT_DIPSETTING( 0x04, "V30" ) + PORT_DIPSETTING( 0x00, "I386" ) + + PORT_MODIFY("DSW5") + PORT_DIPNAME( 0x08, 0x00, "Graphic Function" ) // DSW 1-8 + PORT_DIPSETTING( 0x08, "Basic (8 Colors)" ) + PORT_DIPSETTING( 0x00, "Expanded (16/4096 Colors)" ) + + PORT_MODIFY("ROM_LOAD") + PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_CONFNAME( 0x04, 0x04, "Load IDE BIOS" ) + PORT_CONFSETTING( 0x00, DEF_STR( Yes ) ) + PORT_CONFSETTING( 0x04, DEF_STR( No ) ) + +// PORT_START("SOUND_CONFIG") +// PORT_CONFNAME( 0x01, 0x00, "Sound Type" ) +// PORT_CONFSETTING( 0x00, "YM2203 (OPN)" ) +// PORT_CONFSETTING( 0x01, "YM2608 (OPNA)" ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc9821 ) + PORT_INCLUDE( pc9801rs ) + + PORT_MODIFY("DSW2") + PORT_DIPNAME( 0x01, 0x00, "S-Dip SW Init" ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_MODIFY("DSW3") + PORT_DIPNAME( 0x40, 0x40, "Conventional RAM size" ) PORT_DIPLOCATION("SW3:7") + PORT_DIPSETTING( 0x40, "640 KB" ) + PORT_DIPSETTING( 0x00, "512 KB" ) +INPUT_PORTS_END + +static const gfx_layout charset_8x8 = +{ + 8,8, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout charset_8x16 = +{ + 8,16, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 +}; + +static const gfx_layout charset_16x16 = +{ + 16,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP16(0,1) }, + { STEP16(0,16) }, + 16*16 +}; + +static GFXDECODE_START( pc9801 ) + GFXDECODE_ENTRY( "chargen", 0x00000, charset_8x8, 0x000, 0x01 ) + GFXDECODE_ENTRY( "chargen", 0x00800, charset_8x16, 0x000, 0x01 ) + GFXDECODE_ENTRY( "kanji", 0x00000, charset_16x16, 0x000, 0x01 ) + GFXDECODE_ENTRY( "raw_kanji", 0x00000, charset_16x16, 0x000, 0x01 ) + GFXDECODE_ENTRY( "new_chargen",0, charset_16x16, 0x000, 0x01 ) +GFXDECODE_END + +/**************************************** +* +* I8259 PIC interface +* +****************************************/ + +/* +irq assignment (PC-9801F): + +8259 master: +ir0 PIT +ir1 keyboard +ir2 vblank +ir3 +ir4 rs-232c +ir5 +ir6 +ir7 slave irq + +8259 slave: +ir0 printer +ir1 IDE? +ir2 2dd floppy irq +ir3 2hd floppy irq +ir4 opn +ir5 mouse +ir6 +ir7 +*/ + + +READ8_MEMBER(pc9801_state::get_slave_ack) +{ + if (offset==7) { // IRQ = 7 + return m_pic2->acknowledge(); + } + return 0x00; +} + +/**************************************** +* +* I8253 PIT interface +* +****************************************/ + +/* basically, PC-98xx series has two xtals. + My guess is that both are on the PCB, and they clocks the various system components. + PC-9801RS needs X1 for the pit, otherwise Uchiyama Aki no Chou Bangai has sound pitch bugs + PC-9821 definitely needs X2, otherwise there's a timer error at POST. Unless it needs a different clock anyway ... + */ +#define MAIN_CLOCK_X1 XTAL_1_9968MHz +#define MAIN_CLOCK_X2 XTAL_2_4576MHz + +/**************************************** +* +* I8237 DMA interface +* +****************************************/ + +WRITE_LINE_MEMBER(pc9801_state::dma_hrq_changed) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + m_dmac->hack_w(state); + +// logerror("%02x HLDA\n",state); +} + +WRITE_LINE_MEMBER(pc9801_state::tc_w ) +{ + /* floppy terminal count */ + m_fdc_2hd->tc_w(state); + if(m_fdc_2dd) + m_fdc_2dd->tc_w(state); + +// logerror("TC %02x\n",state); +} + +READ8_MEMBER(pc9801_state::dma_read_byte) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + offs_t addr = (m_dma_offset[m_dack] << 16) | offset; + +// logerror("%08x\n",addr); + + return program.read_byte(addr); +} + + +WRITE8_MEMBER(pc9801_state::dma_write_byte) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + offs_t addr = (m_dma_offset[m_dack] << 16) | offset; + +// logerror("%08x %02x\n",addr,data); + + program.write_byte(addr, data); +} + +void pc9801_state::set_dma_channel(int channel, int state) +{ + if (!state) m_dack = channel; +} + +WRITE_LINE_MEMBER(pc9801_state::dack0_w){ /*logerror("%02x 0\n",state);*/ set_dma_channel(0, state); } +WRITE_LINE_MEMBER(pc9801_state::dack1_w){ /*logerror("%02x 1\n",state);*/ set_dma_channel(1, state); } +WRITE_LINE_MEMBER(pc9801_state::dack2_w){ /*logerror("%02x 2\n",state);*/ set_dma_channel(2, state); } +WRITE_LINE_MEMBER(pc9801_state::dack3_w){ /*logerror("%02x 3\n",state);*/ set_dma_channel(3, state); } + +/* +ch1 cs-4231a +ch2 FDC +ch3 SCSI +*/ + +/**************************************** +* +* PPI interfaces +* +****************************************/ + +WRITE8_MEMBER(pc9801_state::ppi_sys_portc_w) +{ + m_beeper->set_state(!(data & 0x08)); +} + +READ8_MEMBER(pc9801_state::ppi_mouse_porta_r) +{ + UINT8 res; + UINT8 isporthi; + const char *const mousenames[] = { "MOUSE_X", "MOUSE_Y" }; + + res = ioport("MOUSE_B")->read() & 0xf0; + isporthi = ((m_mouse.control & 0x20) >> 5)*4; + + if((m_mouse.control & 0x80) == 0) + res |= ioport(mousenames[(m_mouse.control & 0x40) >> 6])->read() >> (isporthi) & 0xf; + else + { + if(m_mouse.control & 0x40) + res |= (m_mouse.ly >> isporthi) & 0xf; + else + res |= (m_mouse.lx >> isporthi) & 0xf; + } + +// logerror("A\n"); + return res; +} + +WRITE8_MEMBER(pc9801_state::ppi_mouse_porta_w) +{ +// logerror("A %02x\n",data); +} + +WRITE8_MEMBER(pc9801_state::ppi_mouse_portb_w) +{ +// logerror("B %02x\n",data); +} + +WRITE8_MEMBER(pc9801_state::ppi_mouse_portc_w) +{ + if((m_mouse.control & 0x80) == 0 && data & 0x80) + { + m_mouse.lx = ioport("MOUSE_X")->read(); + m_mouse.ly = ioport("MOUSE_Y")->read(); + } + + m_mouse.control = data; +} + +/**************************************** +* +* UPD765 interface +* +****************************************/ + +static SLOT_INTERFACE_START( pc9801_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) + SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START( pc9801_cbus ) +// PC-9801-14 + SLOT_INTERFACE( "pc9801_26", PC9801_26 ) + SLOT_INTERFACE( "pc9801_86", PC9801_86 ) +// PC-9801-86 +// PC-9801-26 + PC-9801-86 (?) +// PC-9801-86 + Chibi-Oto + SLOT_INTERFACE( "pc9801_118", PC9801_118 ) +// Speak Board +// Spark Board +// AMD-98 (AmuseMent boarD) +SLOT_INTERFACE_END + +// Jast Sound, could be put independently + +WRITE_LINE_MEMBER( pc9801_state::fdc_2dd_irq ) +{ + logerror("IRQ 2DD %d\n",state); + + if(m_fdc_2dd_ctrl & 8) + { + m_pic2->ir2_w(state); + } +} + +WRITE_LINE_MEMBER( pc9801_state::pc9801rs_fdc_irq ) +{ + /* 0xffaf8 */ + + //logerror("%02x %d\n",m_fdc_ctrl,state); + + if(m_fdc_ctrl & 1) + m_pic2->ir3_w(state); + else + m_pic2->ir2_w(state); +} + +WRITE_LINE_MEMBER( pc9801_state::pc9801rs_fdc_drq ) +{ + if(m_fdc_ctrl & 1) + m_dmac->dreq2_w(state ^ 1); + else + m_dmac->dreq3_w(state ^ 1); +} + +UINT32 pc9801_state::pc9801_286_a20(bool state) +{ + return (state ? 0xffffff : 0x0fffff); +} + +/**************************************** +* +* Init emulation status +* +****************************************/ + +// +PALETTE_INIT_MEMBER(pc9801_state,pc9801) +{ + int i; + + for(i=0;i<8;i++) + palette.set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); + for(i=8;ics_w(1); + m_rtc->oe_w(1); + + m_ipl_rom = memregion("ipl")->base(); + m_vbirq = timer_alloc(TIMER_VBIRQ); + + save_item(NAME(m_sasi_data)); + save_item(NAME(m_sasi_data_enable)); + save_item(NAME(m_sasi_ctrl)); +} + +MACHINE_START_MEMBER(pc9801_state,pc9801f) +{ + MACHINE_START_CALL_MEMBER(pc9801_common); + + m_fdc_2hd->set_rate(500000); + m_fdc_2dd->set_rate(250000); + m_sys_type = 0x00 >> 6; +} + +MACHINE_START_MEMBER(pc9801_state,pc9801rs) +{ + MACHINE_START_CALL_MEMBER(pc9801_common); + + int ram_size = m_ram->size() - 0xa0000; + + address_space& space = m_maincpu->space(AS_PROGRAM); + membank("wram")->set_base(m_ram->pointer()); + if(ram_size) + { + space.install_read_bank(0x100000, 0x100000 + ram_size - 1, "ext_wram"); + space.install_write_bank(0x100000, 0x100000 + ram_size - 1, "ext_wram"); + membank("ext_wram")->set_base(m_ram->pointer() + 0xa0000); + } + + m_sys_type = 0x80 >> 6; +} + +MACHINE_START_MEMBER(pc9801_state,pc9801bx2) +{ + MACHINE_START_CALL_MEMBER(pc9801rs); + + save_pointer(NAME(m_sdip), 24); +} + + +MACHINE_START_MEMBER(pc9801_state,pc9821) +{ + MACHINE_START_CALL_MEMBER(pc9801rs); + + save_pointer(NAME(m_sdip), 24); +} + +MACHINE_START_MEMBER(pc9801_state,pc9821ap2) +{ + MACHINE_START_CALL_MEMBER(pc9821); + + // ... +} + +MACHINE_RESET_MEMBER(pc9801_state,pc9801_common) +{ + memset(m_tvram, 0, sizeof(UINT16) * 0x2000); + /* this looks like to be some kind of backup ram, system will boot with green colors otherwise */ + { + int i; + static const UINT8 default_memsw_data[0x10] = + { + 0xe1, 0x48, 0xe1, 0x05, 0xe1, 0x04, 0xe1, 0x00, 0xe1, 0x01, 0xe1, 0x00, 0xe1, 0x00, 0xe1, 0x6e +// 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff + }; + + for(i=0;i<0x10;i++) + m_tvram[(0x3fe0>>1)+i] = default_memsw_data[i]; + } + + m_beeper->set_frequency(2400); + m_beeper->set_state(0); + + m_nmi_ff = 0; + m_mouse.control = 0xff; + m_mouse.freq_reg = 0; + m_mouse.freq_index = 0; + memset(&m_egc, 0, sizeof(m_egc)); +} + +MACHINE_RESET_MEMBER(pc9801_state,pc9801f) +{ + MACHINE_RESET_CALL_MEMBER(pc9801_common); + + UINT8 op_mode; + UINT8 *ROM; + UINT8 *PRG = memregion("fdc_data")->base(); + int i; + + ROM = memregion("fdc_bios_2dd")->base(); + op_mode = (ioport("ROM_LOAD")->read() & 2) >> 1; + + for(i=0;i<0x1000;i++) + ROM[i] = PRG[i+op_mode*0x8000]; + + ROM = memregion("fdc_bios_2hd")->base(); + op_mode = ioport("ROM_LOAD")->read() & 1; + + for(i=0;i<0x1000;i++) + ROM[i] = PRG[i+op_mode*0x8000+0x10000]; +} + +MACHINE_RESET_MEMBER(pc9801_state,pc9801rs) +{ + MACHINE_RESET_CALL_MEMBER(pc9801_common); + + m_gate_a20 = 0; + m_rom_bank = 0; + m_fdc_ctrl = 3; + m_access_ctrl = 0; + m_keyb_press = 0xff; // temp kludge, for PC-9821 booting +// m_has_opna = ioport("SOUND_CONFIG")->read() & 1; + m_maincpu->set_input_line(INPUT_LINE_A20, m_gate_a20); + + if(!(ioport("ROM_LOAD")->read() & 4)) + m_maincpu->space(AS_PROGRAM).install_rom(0xd8000, 0xd9fff, memregion("ide")->base()); + else + m_maincpu->space(AS_PROGRAM).install_rom(0xd8000, 0xd9fff, memregion("ide")->base() + 0x2000); +} + +MACHINE_RESET_MEMBER(pc9801_state,pc9821) +{ + MACHINE_RESET_CALL_MEMBER(pc9801rs); + + m_pc9821_window_bank = 0x08; +} + +void pc9801_state::device_reset_after_children() +{ + driver_device::device_reset_after_children(); + ata_mass_storage_device *ide0 = machine().device("ide:0:hdd"); + if(ide0) + ide0->identify_device_buffer()[47] = 0; +} + +INTERRUPT_GEN_MEMBER(pc9801_state::pc9801_vrtc_irq) +{ + m_pic1->ir2_w(1); + m_vbirq->adjust(m_screen->time_until_vblank_end()); +} + + +FLOPPY_FORMATS_MEMBER( pc9801_state::floppy_formats ) + FLOPPY_PC98_FORMAT, + FLOPPY_PC98FDI_FORMAT, + FLOPPY_FDD_FORMAT, + FLOPPY_DCP_FORMAT, + FLOPPY_DIP_FORMAT, + FLOPPY_NFD_FORMAT +FLOPPY_FORMATS_END + +TIMER_DEVICE_CALLBACK_MEMBER( pc9801_state::mouse_irq_cb ) +{ + if((m_mouse.control & 0x10) == 0) + { + m_mouse.freq_index ++; + +// logerror("%02x\n",m_mouse.freq_index); + if(m_mouse.freq_index > m_mouse.freq_reg) + { +// logerror("irq %02x\n",m_mouse.freq_reg); + m_mouse.freq_index = 0; + m_pic2->ir5_w(0); + m_pic2->ir5_w(1); + } + } +} + +static MACHINE_CONFIG_FRAGMENT( pc9801_keyboard ) + MCFG_DEVICE_ADD("keyb", PC9801_KBD, 53) + MCFG_PC9801_KBD_IRQ_CALLBACK(DEVWRITELINE("pic8259_master", pic8259_device, ir1_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( pc9801_mouse ) + MCFG_DEVICE_ADD("ppi8255_mouse", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pc9801_state, ppi_mouse_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pc9801_state, ppi_mouse_porta_w)) + MCFG_I8255_IN_PORTB_CB(IOPORT("DSW3")) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pc9801_state, ppi_mouse_portb_w)) + MCFG_I8255_IN_PORTC_CB(IOPORT("DSW4")) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc9801_state, ppi_mouse_portc_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("mouse_timer", pc9801_state, mouse_irq_cb, attotime::from_hz(120)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( pc9801_cbus ) + MCFG_PC9801CBUS_SLOT_ADD("cbus0", pc9801_cbus, "pc9801_26") + MCFG_PC9801CBUS_SLOT_ADD("cbus1", pc9801_cbus, NULL) +// TODO: six max slots +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( pc9801_sasi ) + MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0) + MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in") + MCFG_SCSI_IO_HANDLER(WRITELINE(pc9801_state, write_sasi_io)) // bit2 + MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) + MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) + MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit5)) + MCFG_SCSI_ACK_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit6)) + MCFG_SCSI_REQ_HANDLER(WRITELINE(pc9801_state, write_sasi_req)) + + MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", PC9801_SASI, SCSI_ID_0) + + MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG) + MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0) + MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0) + + MCFG_DEVICE_MODIFY("i8237") + MCFG_I8237_IN_IOR_0_CB(READ8(pc9801_state, sasi_data_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc9801_state, sasi_data_w)) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_FRAGMENT( pc9801_ide ) + MCFG_ATA_INTERFACE_ADD("ide", ata_devices, "hdd", NULL, false) + MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir1_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( pc9801_common ) + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(MAIN_CLOCK_X1) /* heartbeat IRQ */ + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259_master", pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(MAIN_CLOCK_X1) /* Memory Refresh */ + MCFG_PIT8253_CLK2(MAIN_CLOCK_X1) /* RS-232c */ + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(pc9801_state, write_uart_clock)) + + MCFG_DEVICE_ADD("i8237", AM9517A, 5000000) // unknown clock, TODO: check channels 0 - 1 + MCFG_I8237_OUT_HREQ_CB(WRITELINE(pc9801_state, dma_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(pc9801_state, tc_w)) + MCFG_I8237_IN_MEMR_CB(READ8(pc9801_state, dma_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(pc9801_state, dma_write_byte)) + MCFG_I8237_IN_IOR_2_CB(DEVREAD8("upd765_2hd", upd765a_device, mdma_r)) + MCFG_I8237_OUT_IOW_2_CB(DEVWRITE8("upd765_2hd", upd765a_device, mdma_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(pc9801_state, dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(pc9801_state, dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(pc9801_state, dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(pc9801_state, dack3_w)) + MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(pc9801_state,get_slave_ack) ) + MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL ) // TODO: Check ir7_w + + MCFG_DEVICE_ADD("ppi8255_sys", I8255, 0) + MCFG_I8255_IN_PORTA_CB(IOPORT("DSW2")) + MCFG_I8255_IN_PORTB_CB(IOPORT("DSW1")) + MCFG_I8255_IN_PORTC_CB(CONSTANT(0xa0)) // 0x80 cpu triple fault reset flag? + MCFG_I8255_OUT_PORTC_CB(WRITE8(pc9801_state, ppi_sys_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_prn", I8255, 0) + /* TODO: check this one */ + MCFG_I8255_IN_PORTB_CB(IOPORT("DSW5")) + + MCFG_FRAGMENT_ADD(pc9801_keyboard) + MCFG_FRAGMENT_ADD(pc9801_mouse) + MCFG_FRAGMENT_ADD(pc9801_cbus) + + MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) + + MCFG_UPD765A_ADD("upd765_2hd", true, true) + MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("pic8259_slave", pic8259_device, ir3_w)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("i8237", am9517a_device, dreq2_w)) MCFG_DEVCB_INVERT + MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", pc9801_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", pc9801_state::floppy_formats) + + MCFG_DEVICE_ADD("ppi8255_fdd", I8255, 0) + MCFG_I8255_IN_PORTA_CB(CONSTANT(0xff)) + MCFG_I8255_IN_PORTB_CB(CONSTANT(0xff)) //upd765_status_r(machine().device("upd765_2dd"),space, 0); + MCFG_I8255_IN_PORTC_CB(CONSTANT(0xff)) //upd765_data_r(machine().device("upd765_2dd"),space, 0); + //MCFG_I8255_OUT_PORTC_CB(WRITE8(pc9801_state, ppi_fdd_portc_w)) //upd765_data_w(machine().device("upd765_2dd"),space, 0,data); + + MCFG_SOFTWARE_LIST_ADD("disk_list","pc98") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DRIVER(pc9801_state, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + + MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2) + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map) + MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text) + MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w)) + + MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2) + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels) + + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc9801) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pc9801, pc9801_state ) + MCFG_CPU_ADD("maincpu", I8086, 5000000) //unknown clock + MCFG_CPU_PROGRAM_MAP(pc9801_map) + MCFG_CPU_IO_MAP(pc9801_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_FRAGMENT_ADD(pc9801_common) + + MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801f) + MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9801f) +#if 0 + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("256K,384K,512K,640K") +#endif + + MCFG_UPD765A_ADD("upd765_2dd", false, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pc9801_state, fdc_2dd_irq)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("i8237", am9517a_device, dreq3_w)) MCFG_DEVCB_INVERT + MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:0", pc9801_floppies, "525dd", pc9801_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:1", pc9801_floppies, "525dd", pc9801_state::floppy_formats) + + MCFG_FRAGMENT_ADD(pc9801_sasi) + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) + + MCFG_DEVICE_MODIFY("i8237") + MCFG_I8237_IN_IOR_3_CB(DEVREAD8("upd765_2dd", upd765a_device, mdma_r)) + MCFG_I8237_OUT_IOW_3_CB(DEVWRITE8("upd765_2dd", upd765a_device, mdma_w)) + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc9801vm, pc9801 ) + MCFG_CPU_REPLACE("maincpu",V30,10000000) + MCFG_CPU_PROGRAM_MAP(pc9801ux_map) + MCFG_CPU_IO_MAP(pc9801ux_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + + MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801_common) + MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9801_common) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pc9801rs, pc9801_state ) + MCFG_CPU_ADD("maincpu", I386SX, MAIN_CLOCK_X1*8) // unknown clock. + MCFG_CPU_PROGRAM_MAP(pc9801rs_map) + MCFG_CPU_IO_MAP(pc9801rs_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_FRAGMENT_ADD(pc9801_common) + + MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801rs) + MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9801rs) + + MCFG_DEVICE_MODIFY("i8237") + MCFG_DEVICE_CLOCK(MAIN_CLOCK_X1*8); // unknown clock + + MCFG_FRAGMENT_ADD(pc9801_ide) + MCFG_UPD4990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1664K") + MCFG_RAM_EXTRA_OPTIONS("640K,3712K,7808K") + + MCFG_DEVICE_MODIFY("upd7220_btm") + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_grcg_2_map) + + MCFG_PALETTE_ADD("palette", 16+16) + MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc9801ux, pc9801rs ) + MCFG_CPU_REPLACE("maincpu",I80286,10000000) + MCFG_CPU_PROGRAM_MAP(pc9801ux_map) + MCFG_CPU_IO_MAP(pc9801ux_io) + MCFG_80286_A20(pc9801_state, pc9801_286_a20) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) +// MCFG_DEVICE_MODIFY("i8237", AM9157A, 10000000) // unknown clock +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc9801bx2, pc9801rs ) + MCFG_CPU_REPLACE("maincpu",I486,25000000) + MCFG_CPU_PROGRAM_MAP(pc9821_map) + MCFG_CPU_IO_MAP(pc9821_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801bx2) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc9821, pc9801rs ) + MCFG_CPU_REPLACE("maincpu", I486, 16000000) // unknown clock + MCFG_CPU_PROGRAM_MAP(pc9821_map) + MCFG_CPU_IO_MAP(pc9821_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_DEVICE_MODIFY("pit8253") + MCFG_PIT8253_CLK0(MAIN_CLOCK_X2) + MCFG_PIT8253_CLK1(MAIN_CLOCK_X2) + MCFG_PIT8253_CLK2(MAIN_CLOCK_X2) + + MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9821) + MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9821) + + MCFG_DEVICE_MODIFY("i8237") + MCFG_DEVICE_CLOCK(16000000); // unknown clock + + MCFG_DEVICE_REMOVE("palette") + MCFG_PALETTE_ADD("palette", 16+16+256) + MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc9821ap2, pc9821) + MCFG_CPU_REPLACE("maincpu", I486, 66666667) // unknown clock + MCFG_CPU_PROGRAM_MAP(pc9821_map) + MCFG_CPU_IO_MAP(pc9821_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9821ap2) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc9821v20, pc9821 ) + MCFG_CPU_REPLACE("maincpu",PENTIUM,32000000) /* TODO: clock */ + MCFG_CPU_PROGRAM_MAP(pc9821_map) + MCFG_CPU_IO_MAP(pc9821_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) +MACHINE_CONFIG_END + +/* took from "raw" memory dump, uncomment ROM_FILL if you want to play with it */ +#define LOAD_IDE_ROM \ + ROM_REGION( 0x4000, "ide", ROMREGION_ERASEVAL(0xcb) ) \ + ROM_LOAD( "d8000.rom", 0x0000, 0x2000, BAD_DUMP CRC(5dda57cc) SHA1(d0dead41c5b763008a4d777aedddce651eb6dcbb) ) \ + ROM_IGNORE( 0x2000 ) \ + ROM_IGNORE( 0x2000 ) \ + ROM_IGNORE( 0x2000 ) + +// all of these are half size :/ +#define LOAD_KANJI_ROMS \ + ROM_REGION( 0x80000, "raw_kanji", ROMREGION_ERASEFF ) \ + ROM_LOAD16_BYTE( "24256c-x01.bin", 0x00000, 0x4000, BAD_DUMP CRC(28ec1375) SHA1(9d8e98e703ce0f483df17c79f7e841c5c5cd1692) ) \ + ROM_CONTINUE( 0x20000, 0x4000 ) \ + ROM_LOAD16_BYTE( "24256c-x02.bin", 0x00001, 0x4000, BAD_DUMP CRC(90985158) SHA1(78fb106131a3f4eb054e87e00fe4f41193416d65) ) \ + ROM_CONTINUE( 0x20001, 0x4000 ) \ + ROM_LOAD16_BYTE( "24256c-x03.bin", 0x40000, 0x4000, BAD_DUMP CRC(d4893543) SHA1(eb8c1bee0f694e1e0c145a24152222d4e444e86f) ) \ + ROM_CONTINUE( 0x60000, 0x4000 ) \ + ROM_LOAD16_BYTE( "24256c-x04.bin", 0x40001, 0x4000, BAD_DUMP CRC(5dec0fc2) SHA1(41000da14d0805ed0801b31eb60623552e50e41c) ) \ + ROM_CONTINUE( 0x60001, 0x4000 ) \ + ROM_REGION( 0x100000, "kanji", ROMREGION_ERASEFF ) \ + ROM_REGION( 0x80000, "new_chargen", ROMREGION_ERASEFF ) +/* +F - 8086 5 +*/ + +ROM_START( pc9801f ) + ROM_REGION( 0x18000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "urm01-02.bin", 0x00000, 0x4000, CRC(cde04615) SHA1(8f6fb587c0522af7a8131b45d13f8ae8fc60e8cd) ) + ROM_LOAD16_BYTE( "urm02-02.bin", 0x00001, 0x4000, CRC(9e39b8d1) SHA1(df1f3467050a41537cb9d071e4034f0506f07eda) ) + ROM_LOAD16_BYTE( "urm03-02.bin", 0x08000, 0x4000, CRC(95e79064) SHA1(c27d96949fad82aeb26e316200c15a4891e1063f) ) + ROM_LOAD16_BYTE( "urm04-02.bin", 0x08001, 0x4000, CRC(e4855a53) SHA1(223f66482c77409706cfc64c214cec7237c364e9) ) + ROM_LOAD16_BYTE( "urm05-02.bin", 0x10000, 0x4000, CRC(ffefec65) SHA1(106e0d920e857e59da12225a489ca2756ca405c1) ) + ROM_LOAD16_BYTE( "urm06-02.bin", 0x10001, 0x4000, CRC(1147760b) SHA1(4e0299091dfd53ac7988d40c5a6775a10389faac) ) + + ROM_REGION( 0x4000, "sound_bios", ROMREGION_ERASEFF ) /* FM board*/ + ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) + + ROM_REGION( 0x1000, "fdc_bios_2dd", ROMREGION_ERASEFF ) + + ROM_REGION( 0x1000, "fdc_bios_2hd", ROMREGION_ERASEFF ) + + ROM_REGION( 0x20000, "fdc_data", ROMREGION_ERASEFF ) // 2dd fdc bios, presumably bad size (should be 0x800 for each rom) + ROM_LOAD16_BYTE( "urf01-01.bin", 0x00000, 0x4000, BAD_DUMP CRC(2f5ae147) SHA1(69eb264d520a8fc826310b4fce3c8323867520ee) ) + ROM_LOAD16_BYTE( "urf02-01.bin", 0x00001, 0x4000, BAD_DUMP CRC(62a86928) SHA1(4160a6db096dbeff18e50cbee98f5d5c1a29e2d1) ) + ROM_LOAD( "2hdif.rom", 0x10000, 0x1000, BAD_DUMP CRC(9652011b) SHA1(b607707d74b5a7d3ba211825de31a8f32aec8146) ) // needs dumping from a board + + ROM_REGION( 0x800, "kbd_mcu", ROMREGION_ERASEFF) + ROM_LOAD( "mcu.bin", 0x0000, 0x0800, NO_DUMP ) //connected through a i8251 UART, needs decapping + + /* note: ROM names of following two might be swapped */ + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "d23128c-17.bin", 0x00000, 0x00800, BAD_DUMP CRC(eea57180) SHA1(4aa037c684b72ad4521212928137d3369174eb1e) ) //original is a bad dump, this is taken from i386 model + ROM_LOAD("hn613128pac8.bin",0x00800, 0x01000, BAD_DUMP CRC(b5a15b5c) SHA1(e5f071edb72a5e9a8b8b1c23cf94a74d24cb648e) ) //bad dump, 8x16 charset? (it's on the kanji board) + + LOAD_KANJI_ROMS +ROM_END + +/* +UX - 80286 10 + V30 8 +*/ + +ROM_START( pc9801ux ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf_ux.rom", 0x18000, 0x08000, CRC(c7942563) SHA1(61bb210d64c7264be939b11df1e9cd14ffeee3c9) ) + ROM_LOAD( "bios_ux.rom", 0x28000, 0x18000, BAD_DUMP CRC(97375ca2) SHA1(bfe458f671d90692104d0640730972ca8dc0a100) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_ux.rom", 0x0000, 0x4000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_ux.rom", 0x000000, 0x046800, BAD_DUMP CRC(19a76eeb) SHA1(96a006e8515157a624599c2b53a581ae0dd560fd) ) + + LOAD_KANJI_ROMS +// LOAD_IDE_ROM +ROM_END + +/* +RX - 80286 12 (no V30?) + +The bios is from a 386 model not an RX +*/ + +ROM_START( pc9801rx ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf_rs.rom", 0x18000, 0x08000, BAD_DUMP CRC(c1815325) SHA1(a2fb11c000ed7c976520622cfb7940ed6ddc904e) ) + ROM_LOAD( "bios_rx.rom", 0x28000, 0x018000, BAD_DUMP CRC(0a682b93) SHA1(76a7360502fa0296ea93b4c537174610a834d367) ) + // fix csum + ROM_FILL(0x3fffe, 1, 0x0d) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_rx.rom", 0x000000, 0x004000, CRC(fe9f57f2) SHA1(d5dbc4fea3b8367024d363f5351baecd6adcd8ef) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_rx.rom", 0x000000, 0x046800, CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +RS - 386SX 16 + +(note: might be a different model!) +*/ + +ROM_START( pc9801rs ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf_rs.rom", 0x18000, 0x08000, CRC(c1815325) SHA1(a2fb11c000ed7c976520622cfb7940ed6ddc904e) ) + ROM_LOAD( "bios_rs.rom", 0x28000, 0x18000, BAD_DUMP CRC(315d2703) SHA1(4f208d1dbb68373080d23bff5636bb6b71eb7565) ) + + /* following is an emulator memory dump, should be checked and nuked */ + ROM_REGION( 0x100000, "memory", 0 ) + ROM_LOAD( "00000.rom", 0x00000, 0x8000, CRC(6e299128) SHA1(d0e7d016c005cdce53ea5ecac01c6f883b752b80) ) + ROM_LOAD( "c0000.rom", 0xc0000, 0x8000, CRC(1b43eabd) SHA1(ca711c69165e1fa5be72993b9a7870ef6d485249) ) // 0xff everywhere + ROM_LOAD( "c8000.rom", 0xc8000, 0x8000, CRC(f2a262b0) SHA1(fe97d2068d18bbb7425d9774e2e56982df2aa1fb) ) + ROM_LOAD( "d0000.rom", 0xd0000, 0x8000, CRC(1b43eabd) SHA1(ca711c69165e1fa5be72993b9a7870ef6d485249) ) // 0xff everywhere + ROM_LOAD( "e8000.rom", 0xe8000, 0x8000, CRC(4e32081e) SHA1(e23571273b7cad01aa116cb7414c5115a1093f85) ) // contains n-88 basic (86) v2.0 + ROM_LOAD( "f0000.rom", 0xf0000, 0x8000, CRC(4da85a6c) SHA1(18dccfaf6329387c0c64cc4c91b32c25cde8bd5a) ) + ROM_LOAD( "f8000.rom", 0xf8000, 0x8000, CRC(2b1e45b1) SHA1(1fec35f17d96b2e2359e3c71670575ad9ff5007e) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_rs.rom", 0x00000, 0x46800, BAD_DUMP CRC(da370e7a) SHA1(584d0c7fde8c7eac1f76dc5e242102261a878c5e) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +BX2/U2 - 486SX - (should be 33, but "dumper" note says it's 25 MHz) + +Yet another franken-dump done with a lame program, shrug + +*/ + +ROM_START( pc9801bx2 ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "pc98bank0.bin", 0x00000, 0x08000, BAD_DUMP CRC(bfd100cc) SHA1(cf8e6a5679cca7761481abef0ba4b35ead39efdb) ) + ROM_LOAD( "pc98bank1.bin", 0x00000, 0x08000, BAD_DUMP CRC(d0562af8) SHA1(2c4fd27eb598f4b8a00f3e86941ba27007d58e47) ) + ROM_LOAD( "pc98bank2.bin", 0x00000, 0x08000, BAD_DUMP CRC(12818a14) SHA1(9c31e8ac85d78fa779d6bbc2095557065294ec09) ) + ROM_LOAD( "pc98bank3.bin", 0x00000, 0x08000, BAD_DUMP CRC(d0bda44e) SHA1(c1022a3b2be4d2a1e43914df9e4605254e5f99d5) ) + ROM_LOAD( "pc98bank4.bin", 0x18000, 0x08000, BAD_DUMP CRC(be8092f4) SHA1(12c8a166b8c6ebbef85568b67e1f098562883365) ) + ROM_LOAD( "pc98bank5.bin", 0x00000, 0x08000, BAD_DUMP CRC(4e32081e) SHA1(e23571273b7cad01aa116cb7414c5115a1093f85) ) + ROM_LOAD( "pc98bank6.bin", 0x00000, 0x08000, BAD_DUMP CRC(f878c160) SHA1(cad47f09075ffe4f7b51bb937c9f716c709d4596) ) + ROM_LOAD( "pc98bank7.bin", 0x00000, 0x08000, BAD_DUMP CRC(1bd6537b) SHA1(ff9ee1c976a12b87851635ce8991ac4ad607675b) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_rs.rom", 0x00000, 0x46800, BAD_DUMP CRC(da370e7a) SHA1(584d0c7fde8c7eac1f76dc5e242102261a878c5e) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +VM - V30 8/10 + +TODO: this ISN'T a real VM model! +*/ + +ROM_START( pc9801vm ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf_ux.rom", 0x18000, 0x08000, BAD_DUMP CRC(c7942563) SHA1(61bb210d64c7264be939b11df1e9cd14ffeee3c9) ) + ROM_LOAD( "bios_vm.rom", 0x28000, 0x018000, CRC(2e2d7cee) SHA1(159549f845dc70bf61955f9469d2281a0131b47f) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_vm.rom", 0x000000, 0x004000, CRC(fe9f57f2) SHA1(d5dbc4fea3b8367024d363f5351baecd6adcd8ef) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_vm.rom", 0x000000, 0x046800, BAD_DUMP CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff) ) + + LOAD_KANJI_ROMS +// LOAD_IDE_ROM +ROM_END + +/* +98MATE A - 80486SX 25 + +(note: might be a different model!) +*/ + +ROM_START( pc9821 ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf.rom", 0x18000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) + ROM_LOAD( "bios.rom", 0x28000, 0x18000, BAD_DUMP CRC(34a19a59) SHA1(2e92346727b0355bc1ec9a7ded1b444a4917f2b9) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font.rom", 0x00000, 0x46800, BAD_DUMP CRC(a61c0649) SHA1(554b87377d176830d21bd03964dc71f8e98676b1) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +As - 80486DX 33 +*/ + +ROM_START( pc9821as ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf.rom", 0x18000, 0x08000, BAD_DUMP CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) + ROM_LOAD( "bios_as.rom", 0x28000, 0x018000, BAD_DUMP CRC(0a682b93) SHA1(76a7360502fa0296ea93b4c537174610a834d367) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_as.rom", 0x000000, 0x004000, CRC(fe9f57f2) SHA1(d5dbc4fea3b8367024d363f5351baecd6adcd8ef) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_as.rom", 0x000000, 0x046800, BAD_DUMP CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +PC-9821AP2/U8W +80486DX2 66MHz +DOS 5.0, Windows 3.1 +5.6MB RAM, up to 73.6MB +340MB HD +Expansion slot C-BUS4 (4) +Graphics controller S3 86C928 +*/ + +ROM_START( pc9821ap2 ) + ROM_REGION( 0x80000, "biosrom", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS("phd0104") + ROM_SYSTEM_BIOS(0, "phd0104", "PHD0104") + ROMX_LOAD( "phd0104.rom", 0x000000, 0x80000, CRC(da73b372) SHA1(2c15b63a0869b81ef7f04972dbb0975f4e77d384), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "phd0102", "PHD0102") + ROMX_LOAD( "phd0102.rom", 0x000000, 0x80000, CRC(3036774c) SHA1(59856a348f156adf5eca06326f967aca54ff871c), ROM_BIOS(2) ) + + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) // TODO: identify ROM banks + ROM_COPY( "biosrom", 0x20000, 0x18000, 0x08000 ) + ROM_COPY( "biosrom", 0x30000, 0x28000, 0x18000 ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font.rom", 0x00000, 0x46800, BAD_DUMP CRC(a61c0649) SHA1(554b87377d176830d21bd03964dc71f8e98676b1) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + + +/* +98NOTE - i486SX 33 +*/ + +ROM_START( pc9821ne ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf.rom", 0x18000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) + ROM_LOAD( "bios_ne.rom", 0x28000, 0x18000, BAD_DUMP CRC(2ae070c4) SHA1(d7963942042bfd84ed5fc9b7ba8f1c327c094172) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_ne.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_ne.rom", 0x00000, 0x46800, BAD_DUMP CRC(fb213757) SHA1(61525826d62fb6e99377b23812faefa291d78c2e) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +Epson PC-486MU - 486 based, unknown clock +*/ + +ROM_START( pc486mu ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "bios_486mu.rom", 0x08000, 0x18000, BAD_DUMP CRC(57b5d701) SHA1(15029800842e93e07615b0fd91fb9f2bfe3e3c24)) + ROM_RELOAD( 0x28000, 0x18000 ) // missing rom? + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_486mu.rom", 0x0000, 0x4000, CRC(6cdfa793) SHA1(4b8250f9b9db66548b79f961d61010558d6d6e1c)) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_486mu.rom", 0x0000, 0x46800, CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff)) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +98MULTi Ce2 - 80486SX 25 +*/ + +ROM_START( pc9821ce2 ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf_ce2.rom", 0x18000, 0x08000, CRC(273e9e88) SHA1(9bca7d5116788776ed0f297bccb4dfc485379b41) ) + ROM_LOAD( "bios_ce2.rom", 0x28000, 0x018000, BAD_DUMP CRC(76affd90) SHA1(910fae6763c0cd59b3957b6cde479c72e21f33c1) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_ce2.rom", 0x000000, 0x004000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_ce2.rom", 0x000000, 0x046800, CRC(d1c2702a) SHA1(e7781e9d35b6511d12631641d029ad2ba3f7daef) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +98MATE X - 486/Pentium based +*/ + +ROM_START( pc9821xs ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf.rom", 0x18000, 0x08000, BAD_DUMP CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) + ROM_LOAD( "bios_xs.rom", 0x28000, 0x018000, BAD_DUMP CRC(0a682b93) SHA1(76a7360502fa0296ea93b4c537174610a834d367) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_xs.rom", 0x000000, 0x004000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_xs.rom", 0x000000, 0x046800, BAD_DUMP CRC(c9a77d8f) SHA1(deb8563712eb2a634a157289838b95098ba0c7f2) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + + +/* +98MATE VALUESTAR - Pentium based +*/ + +ROM_START( pc9821v13 ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf.rom", 0x18000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) + ROM_LOAD( "bios_v13.rom", 0x28000, 0x18000, BAD_DUMP CRC(0a682b93) SHA1(76a7360502fa0296ea93b4c537174610a834d367) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_v13.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_a.rom", 0x00000, 0x46800, BAD_DUMP CRC(c9a77d8f) SHA1(deb8563712eb2a634a157289838b95098ba0c7f2) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + +/* +98MATE VALUESTAR - Pentium based +*/ + +ROM_START( pc9821v20 ) + ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "itf_v20.rom", 0x38000, 0x08000, CRC(10e52302) SHA1(f95b8648e3f5a23e507a9fbda8ab2e317d8e5151) ) + ROM_LOAD( "bios_v20.rom", 0x08000, 0x018000, BAD_DUMP CRC(d5d1f13b) SHA1(bf44b5f4e138e036f1b848d6616fbd41b5549764) ) + + ROM_REGION( 0x10000, "sound_bios", 0 ) + ROM_LOAD( "sound_v20.rom", 0x000000, 0x004000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) + + ROM_REGION( 0x80000, "chargen", 0 ) + ROM_LOAD( "font_v20.rom", 0x000000, 0x046800, BAD_DUMP CRC(6244c4c0) SHA1(9513cac321e89b4edb067b30e9ecb1adae7e7be7) ) + + LOAD_KANJI_ROMS + LOAD_IDE_ROM +ROM_END + + + +DRIVER_INIT_MEMBER(pc9801_state,pc9801_kanji) +{ + #define copy_kanji_strip(_dst,_src,_fill_type) \ + for(i=_dst,k=_src;i<_dst+0x20;i++,k++) \ + { \ + for(j=0;j<0x20;j++) \ + kanji[j+(i << 5)] = _fill_type ? new_chargen[j+(k << 5)] : 0; \ + } + UINT32 i,j,k; + UINT32 pcg_tile; + UINT8 *kanji = memregion("kanji")->base(); + UINT8 *raw_kanji = memregion("raw_kanji")->base(); + UINT8 *new_chargen = memregion("new_chargen")->base(); + UINT8 *chargen = memregion("chargen")->base(); + + /* Convert the ROM bitswap here from the original structure */ + /* TODO: kanji bitswap should be completely wrong, will check it out once that a dump is remade. */ + for(i=0;i<0x80000/0x20;i++) + { + for(j=0;j<0x20;j++) + { + pcg_tile = BITSWAP16(i,15,14,13,12,11,7,6,5,10,9,8,4,3,2,1,0) << 5; + kanji[j+(i << 5)] = raw_kanji[j+pcg_tile]; + } + } + + /* convert charset into even/odd structure */ + for(i=0;i<0x80000/0x20;i++) + { + for(j=0;j<0x10;j++) + { + new_chargen[j*2+(i << 5)] = chargen[j+(i<<5)]; + new_chargen[j*2+(i << 5)+1] = chargen[j+(i<<5)+0x10]; + } + } + + /* now copy the data from the fake roms into our kanji struct */ + copy_kanji_strip(0x0800, -1,0); copy_kanji_strip(0x0820, -1,0); copy_kanji_strip(0x0840, -1,0); copy_kanji_strip(0x0860, -1,0); + copy_kanji_strip(0x0900, -1,0); copy_kanji_strip(0x0920,0x3c0,1); copy_kanji_strip(0x0940,0x3e0,1); copy_kanji_strip(0x0960,0x400,1); + copy_kanji_strip(0x0a00, -1,0); copy_kanji_strip(0x0a20,0x420,1); copy_kanji_strip(0x0a40,0x440,1); copy_kanji_strip(0x0a60,0x460,1); + copy_kanji_strip(0x0b00, -1,0); copy_kanji_strip(0x0b20,0x480,1); copy_kanji_strip(0x0b40,0x4a0,1); copy_kanji_strip(0x0b60,0x4c0,1); + copy_kanji_strip(0x0c00, -1,0); copy_kanji_strip(0x0c20,0x4e0,1); copy_kanji_strip(0x0c40,0x500,1); copy_kanji_strip(0x0c60,0x520,1); + copy_kanji_strip(0x0d00, -1,0); copy_kanji_strip(0x0d20,0x540,1); copy_kanji_strip(0x0d40,0x560,1); copy_kanji_strip(0x0d60,0x580,1); + copy_kanji_strip(0x0e00, -1,0); copy_kanji_strip(0x0e20, -1,0); copy_kanji_strip(0x0e40, -1,0); copy_kanji_strip(0x0e60, -1,0); + copy_kanji_strip(0x0f00, -1,0); copy_kanji_strip(0x0f20, -1,0); copy_kanji_strip(0x0f40, -1,0); copy_kanji_strip(0x0f60, -1,0); + { + int src_1,dst_1; + + for(src_1=0x1000,dst_1=0x660;src_1<0x8000;src_1+=0x100,dst_1+=0x60) + { + copy_kanji_strip(src_1, -1,0); + copy_kanji_strip(src_1+0x20,dst_1+0x00,1); + copy_kanji_strip(src_1+0x40,dst_1+0x20,1); + copy_kanji_strip(src_1+0x60,dst_1+0x40,1); + } + } + #undef copy_kanji_strip +} + +/* Genuine dumps */ +COMP( 1983, pc9801f, 0, 0, pc9801, pc9801, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801F", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) + +/* TODO: ANYTHING below there needs REDUMPING! */ +COMP( 1989, pc9801rs, 0 ,0, pc9801rs, pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801RS", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) //TODO: not sure about the exact model +COMP( 1985, pc9801vm, pc9801ux,0, pc9801vm, pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801VM", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1987, pc9801ux, 0 ,0, pc9801ux, pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801UX", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1988, pc9801rx, pc9801rs,0, pc9801rs, pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801RX", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1993, pc9801bx2, pc9801rs,0, pc9801bx2,pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801BX2/U2", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1994, pc9821, 0, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) //TODO: not sure about the exact model +COMP( 1993, pc9821as, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE A)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1993, pc9821ap2, pc9821, 0, pc9821ap2,pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821AP2/U8W (98MATE A)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1994, pc9821xs, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE Xs)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1994, pc9821ce2, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MULTi Ce2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1994, pc9821ne, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98NOTE)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1994, pc486mu, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Epson", "PC-486MU", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1998, pc9821v13, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE VALUESTAR 13)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) +COMP( 1998, pc9821v20, pc9821, 0, pc9821v20,pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE VALUESTAR 20)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/pcd.c b/src/mame/drivers/pcd.c new file mode 100644 index 00000000000..727efdb102a --- /dev/null +++ b/src/mame/drivers/pcd.c @@ -0,0 +1,603 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best, Carl +/*************************************************************************** + + Siemens PC-D + + For PC-X HDD should have 306,4,9 chs at 1024Bps or 18 at 512Bps + +***************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i186.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "machine/pic8259.h" +#include "machine/mc2661.h" +#include "machine/wd_fdc.h" +#include "machine/mc146818.h" +#include "machine/pcd_kbd.h" +#include "video/pcd.h" +#include "sound/speaker.h" +#include "formats/pc_dsk.h" +#include "bus/scsi/omti5100.h" +#include "bus/rs232/rs232.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class pcd_state : public driver_device +{ +public: + pcd_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pic1(*this, "pic1"), + m_pic2(*this, "pic2"), + m_speaker(*this, "speaker"), + m_fdc(*this, "fdc"), + m_rtc(*this, "rtc"), + m_scsi(*this, "scsi"), + m_scsi_data_out(*this, "scsi_data_out"), + m_scsi_data_in(*this, "scsi_data_in"), + m_ram(*this, "ram"), + m_req_hack(NULL) + { } + + DECLARE_READ8_MEMBER( irq_callback ); + TIMER_DEVICE_CALLBACK_MEMBER( timer0_tick ); + DECLARE_WRITE_LINE_MEMBER( i186_timer1_w ); + + DECLARE_READ8_MEMBER( nmi_io_r ); + DECLARE_WRITE8_MEMBER( nmi_io_w ); + DECLARE_READ8_MEMBER( rtc_r ); + DECLARE_WRITE8_MEMBER( rtc_w ); + DECLARE_READ8_MEMBER( stat_r ); + DECLARE_WRITE8_MEMBER( stat_w ); + DECLARE_READ8_MEMBER( led_r ); + DECLARE_WRITE8_MEMBER( led_w ); + DECLARE_READ16_MEMBER( dskctl_r ); + DECLARE_WRITE16_MEMBER( dskctl_w ); + + DECLARE_READ8_MEMBER( scsi_r ); + DECLARE_WRITE8_MEMBER( scsi_w ); + DECLARE_READ16_MEMBER( mmu_r ); + DECLARE_WRITE16_MEMBER( mmu_w ); + DECLARE_READ16_MEMBER( mem_r ); + DECLARE_WRITE16_MEMBER( mem_w ); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + DECLARE_WRITE_LINE_MEMBER(write_scsi_bsy); + DECLARE_WRITE_LINE_MEMBER(write_scsi_cd); + DECLARE_WRITE_LINE_MEMBER(write_scsi_io); + DECLARE_WRITE_LINE_MEMBER(write_scsi_msg); + DECLARE_WRITE_LINE_MEMBER(write_scsi_req); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + required_device m_maincpu; + required_device m_pic1; + required_device m_pic2; + required_device m_speaker; + required_device m_fdc; + required_device m_rtc; + required_device m_scsi; + required_device m_scsi_data_out; + required_device m_scsi_data_in; + required_device m_ram; + UINT8 m_stat, m_led; + int m_msg, m_bsy, m_io, m_cd, m_req, m_rst; + emu_timer *m_req_hack; + UINT16 m_dskctl; + struct { + UINT16 ctl; + UINT16 regs[1024]; + int type; + bool sc; + } m_mmu; + + void check_scsi_irq(); +}; + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void pcd_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + // TODO: remove this hack + if(m_req) + m_maincpu->drq0_w(1); +} + +void pcd_state::machine_start() +{ + m_req_hack = timer_alloc(); + save_item(NAME(m_mmu.ctl)); + save_item(NAME(m_mmu.regs)); +} + +void pcd_state::machine_reset() +{ + m_stat = 0; + m_led = 0; + m_dskctl = 0; + m_rst = 0; + m_mmu.ctl = 0; + m_mmu.sc = false; + if(ioport("mmu")) + m_mmu.type = ioport("mmu")->read(); + else + m_mmu.type = 0; +} + +READ8_MEMBER( pcd_state::irq_callback ) +{ + return (offset ? m_pic2 : m_pic1)->acknowledge(); +} + +TIMER_DEVICE_CALLBACK_MEMBER( pcd_state::timer0_tick ) +{ + m_maincpu->tmrin0_w(0); + m_maincpu->tmrin0_w(1); +} + +WRITE_LINE_MEMBER( pcd_state::i186_timer1_w ) +{ + if(m_dskctl & 0x20) + m_speaker->level_w(state); +} + +READ8_MEMBER( pcd_state::nmi_io_r ) +{ + if(space.debugger_access()) + return 0; + logerror("%s: unmapped %s %04x\n", machine().describe_context(), space.name(), offset); + m_stat |= 8; + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + return 0; +} + +WRITE8_MEMBER( pcd_state::nmi_io_w ) +{ + if(space.debugger_access()) + return; + logerror("%s: unmapped %s %04x\n", machine().describe_context(), space.name(), offset); + m_stat |= 8; + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + +READ8_MEMBER( pcd_state::rtc_r ) +{ + m_rtc->write(space, 0, offset); + return m_rtc->read(space, 1); +} + +WRITE8_MEMBER( pcd_state::rtc_w ) +{ + m_rtc->write(space, 0, offset); + m_rtc->write(space, 1, data); +} + +READ8_MEMBER( pcd_state::stat_r ) +{ + return m_stat; +} + +WRITE8_MEMBER( pcd_state::stat_w ) +{ + m_stat &= ~data; +} + +READ16_MEMBER( pcd_state::dskctl_r ) +{ + return m_dskctl; +} + +WRITE16_MEMBER( pcd_state::dskctl_w ) +{ + floppy_image_device *floppy0 = m_fdc->subdevice("0")->get_device(); + floppy_image_device *floppy1 = m_fdc->subdevice("1")->get_device(); + + COMBINE_DATA(&m_dskctl); + + if((m_dskctl & 1) && floppy0) + m_fdc->set_floppy(floppy0); + if((m_dskctl & 2) && floppy1) + m_fdc->set_floppy(floppy1); + + if(floppy0) + { + floppy0->mon_w(!(m_dskctl & 4)); + floppy0->ss_w((m_dskctl & 8) != 0); + } + if(floppy1) + { + floppy1->mon_w(!(m_dskctl & 4)); + floppy1->ss_w((m_dskctl & 8) != 0); + } + m_fdc->dden_w((m_dskctl & 0x10) ? 1 : 0); +} + +READ8_MEMBER( pcd_state::led_r ) +{ + // DIPs? + // 0x01 no mmu + // 0x10 enter monitor after post + // 0x20 enter monitor before post + return 0x01; +} + +WRITE8_MEMBER( pcd_state::led_w ) +{ + for(int i = 0; i < 6; i++) + logerror("%c", (data & (1 << i)) ? '-' : '*'); + logerror("\n"); + m_led = data; +} + +READ16_MEMBER( pcd_state::mmu_r ) +{ + UINT16 data = m_mmu.regs[((m_mmu.ctl & 0x1f) << 5) | ((offset >> 2) & 0x1f)]; + //logerror("%s: mmu read %04x %04x\n", machine().describe_context(), (offset << 1) + 0x8000, data); + if(!offset) + return m_mmu.ctl; + else if((offset >= 0x200) && (offset < 0x300) && !(offset & 3)) + return (data << 4) | (data >> 12) | (m_mmu.sc && (offset == 0x200) ? 0xc0 : 0); + else if(offset == 0x400) + { + m_mmu.sc = false; + m_pic1->ir0_w(CLEAR_LINE); + } + return 0; +} + +WRITE16_MEMBER( pcd_state::mmu_w ) +{ + //logerror("%s: mmu write %04x %04x\n", machine().describe_context(), (offset << 1) + 0x8000, data); + if(!offset) + m_mmu.ctl = data; + else if((offset >= 0x200) && (offset < 0x300) && !(offset & 3)) + m_mmu.regs[((m_mmu.ctl & 0x1f) << 5) | ((offset >> 2) & 0x1f)] = (data >> 4) | (data << 12); + else if(offset == 0x400) + { + m_mmu.sc = true; + m_pic1->ir0_w(ASSERT_LINE); + } +} + +READ8_MEMBER(pcd_state::scsi_r) +{ + UINT8 ret = 0; + + switch(offset) + { + case 0: + case 2: + ret = m_scsi_data_in->read(); + m_scsi->write_ack(1); + if(!offset) + m_maincpu->drq0_w(0); + break; + + case 1: + ret = (m_cd << 7) | (m_req << 5) | (m_bsy << 4); + break; + } + + return ret; +} + +WRITE8_MEMBER(pcd_state::scsi_w) +{ + switch(offset) + { + case 0: + m_scsi_data_out->write(data); + m_scsi->write_ack(1); + m_maincpu->drq0_w(0); + break; + case 1: + if(data & 4) + { + m_rst = 1; + m_scsi->write_rst(1); + break; + } + if(m_rst) + { + m_rst = 0; + m_scsi->write_rst(0); + break; + } + + if(!m_bsy) + { + m_scsi_data_out->write(0); + m_scsi->write_sel(1); + } + break; + } +} + +void pcd_state::check_scsi_irq() +{ + m_pic1->ir5_w(m_io && m_cd && m_req); +} + +WRITE_LINE_MEMBER(pcd_state::write_scsi_bsy) +{ + m_bsy = state ? 1 : 0; + m_scsi->write_sel(0); +} +WRITE_LINE_MEMBER(pcd_state::write_scsi_cd) +{ + m_cd = state ? 1 : 0; + check_scsi_irq(); +} +WRITE_LINE_MEMBER(pcd_state::write_scsi_io) +{ + m_io = state ? 1 : 0; + if(state) + m_scsi_data_out->write(0); + check_scsi_irq(); +} +WRITE_LINE_MEMBER(pcd_state::write_scsi_msg) +{ + m_msg = state ? 1 : 0; +} + +WRITE_LINE_MEMBER(pcd_state::write_scsi_req) +{ + m_req = state ? 1 : 0; + if(state) + { + if(!m_cd) + { + m_maincpu->drq0_w(1); + m_req_hack->adjust(attotime::from_msec(10)); // poke the dmac + } + else if(m_msg) + { + m_scsi_data_in->read(); + m_scsi->write_ack(1); + } + } + else + { + if(m_req_hack) // this might be called before machine_start + m_req_hack->adjust(attotime::never); + m_scsi->write_ack(0); + } + check_scsi_irq(); +} + +WRITE16_MEMBER(pcd_state::mem_w) +{ + UINT16 *ram = (UINT16 *)m_ram->pointer(); + if((m_mmu.ctl & 0x20) && m_mmu.type) + { + UINT16 reg; + if(m_mmu.type == 2) + reg = m_mmu.regs[((offset >> 10) & 0xff) | ((m_mmu.ctl & 0x18) << 5)]; + else + reg = m_mmu.regs[((offset >> 10) & 0x7f) | ((m_mmu.ctl & 0x1c) << 5)]; + if(!reg && !space.debugger_access()) + { + offset <<= 1; + logerror("%s: Null mmu entry %06x\n", machine().describe_context(), offset); + nmi_io_w(space, offset, data, mem_mask); + return; + } + offset = ((reg << 3) & 0x7fc00) | (offset & 0x3ff); + } + COMBINE_DATA(&ram[offset]); +} + +READ16_MEMBER(pcd_state::mem_r) +{ + UINT16 *ram = (UINT16 *)m_ram->pointer(); + if((m_mmu.ctl & 0x20) && m_mmu.type) + { + UINT16 reg; + if(m_mmu.type == 2) + reg = m_mmu.regs[((offset >> 10) & 0xff) | ((m_mmu.ctl & 0x18) << 5)]; + else + reg = m_mmu.regs[((offset >> 10) & 0x7f) | ((m_mmu.ctl & 0x1c) << 5)]; + if(!reg && !space.debugger_access()) + { + offset <<= 1; + logerror("%s: Null mmu entry %06x\n", machine().describe_context(), offset); + return nmi_io_r(space, offset, mem_mask); + } + offset = ((reg << 3) & 0x7fc00) | (offset & 0x3ff); + } + return ram[offset]; +} + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( pcd_map, AS_PROGRAM, 16, pcd_state ) + AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(mem_r, mem_w) + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("bios", 0) + AM_RANGE(0x00000, 0xfffff) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pcd_io, AS_IO, 16, pcd_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xefff) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xffff) + AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE8("pic1", pic8259_device, read, write, 0xffff) + AM_RANGE(0xf820, 0xf821) AM_DEVREADWRITE8("pic2", pic8259_device, read, write, 0xffff) + AM_RANGE(0xf840, 0xf841) AM_READWRITE8(stat_r, stat_w, 0x00ff) + AM_RANGE(0xf840, 0xf841) AM_READWRITE8(led_r, led_w, 0xff00) + AM_RANGE(0xf880, 0xf8bf) AM_READWRITE8(rtc_r, rtc_w, 0xffff) + AM_RANGE(0xf900, 0xf903) AM_DEVREADWRITE8("fdc", wd2793_t, read, write, 0xffff) + AM_RANGE(0xf904, 0xf905) AM_READWRITE(dskctl_r, dskctl_w) + AM_RANGE(0xf940, 0xf943) AM_READWRITE8(scsi_r, scsi_w, 0xffff) + AM_RANGE(0xf980, 0xf9bf) AM_DEVICE("video", pcdx_video_device, map) + AM_RANGE(0xf9c0, 0xf9c3) AM_DEVREADWRITE8("usart1",mc2661_device,read,write,0xffff) // UARTs + AM_RANGE(0xf9d0, 0xf9d3) AM_DEVREADWRITE8("usart2",mc2661_device,read,write,0xffff) + AM_RANGE(0xf9e0, 0xf9e3) AM_DEVREADWRITE8("usart3",mc2661_device,read,write,0xffff) +// AM_RANGE(0xfa00, 0xfa7f) // pcs4-n (peripheral chip select) + AM_RANGE(0xfb00, 0xffff) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pcx_io, AS_IO, 16, pcd_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x8000, 0x8fff) AM_READWRITE(mmu_r, mmu_w) + AM_RANGE(0xfb00, 0xfb01) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xff00) + AM_IMPORT_FROM(pcd_io) +ADDRESS_MAP_END + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static SLOT_INTERFACE_START( pcd_floppies ) + SLOT_INTERFACE("55f", TEAC_FD_55F) // 80 tracks + SLOT_INTERFACE("55g", TEAC_FD_55G) // 77 tracks +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( pcd_state::floppy_formats ) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +static INPUT_PORTS_START(pcx) + PORT_START("mmu") + PORT_CONFNAME(0x03, 0x00, "MMU Type") + PORT_CONFSETTING(0x00, "None") + PORT_CONFSETTING(0x01, "SINIX 1.0") + PORT_CONFSETTING(0x02, "SINIX 1.2") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( pcd, pcd_state ) + MCFG_CPU_ADD("maincpu", I80186, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(pcd_map) + MCFG_CPU_IO_MAP(pcd_io) + MCFG_80186_TMROUT1_HANDLER(WRITELINE(pcd_state, i186_timer1_w)) + MCFG_80186_IRQ_SLAVE_ACK(READ8(pcd_state, irq_callback)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer0_tick", pcd_state, timer0_tick, attotime::from_hz(XTAL_16MHz / 24)) // adjusted to pass post + + MCFG_PIC8259_ADD("pic1", DEVWRITELINE("maincpu", i80186_cpu_device, int0_w), VCC, NULL) + MCFG_PIC8259_ADD("pic2", DEVWRITELINE("maincpu", i80186_cpu_device, int1_w), VCC, NULL) + + MCFG_DEVICE_ADD("video", PCD_VIDEO, 0) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1M") + + // nvram + MCFG_NVRAM_ADD_1FILL("nvram") + + // floppy disk controller + MCFG_WD2793_ADD("fdc", XTAL_16MHz / 8) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pic1", pic8259_device, ir6_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq1_w)) + MCFG_WD_FDC_ENMF_CALLBACK(GND) + + // floppy drives + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcd_floppies, "55f", pcd_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", pcd_floppies, "55f", pcd_state::floppy_formats) + + // usart + MCFG_DEVICE_ADD("usart1", MC2661, XTAL_4_9152MHz) + MCFG_MC2661_RXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir3_w)) + MCFG_MC2661_TXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir3_w)) + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("rs232_1", rs232_port_device, write_txd)) + MCFG_DEVICE_ADD("usart2", MC2661, XTAL_4_9152MHz) + MCFG_MC2661_RXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir2_w)) + //MCFG_MC2661_TXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir2_w)) // this gets stuck high causing the keyboard to not work + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("keyboard", pcd_keyboard_device, t0_w)) + MCFG_DEVICE_ADD("usart3", MC2661, XTAL_4_9152MHz) + MCFG_MC2661_RXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir4_w)) + MCFG_MC2661_TXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir4_w)) + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("rs232_2", rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD("rs232_1", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("usart1", mc2661_device, rx_w)) + MCFG_RS232_PORT_ADD("rs232_2", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("usart3", mc2661_device, rx_w)) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + // rtc + MCFG_MC146818_ADD("rtc", XTAL_32_768kHz) + MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir7_w)) + MCFG_MC146818_BINARY(true) + MCFG_MC146818_EPOCH(1900) + MCFG_MC146818_24_12(true) + + MCFG_DEVICE_ADD("keyboard", PCD_KEYBOARD, 0) + MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE("usart2", mc2661_device, rx_w)) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") + MCFG_SCSI_MSG_HANDLER(WRITELINE(pcd_state, write_scsi_msg)) + MCFG_SCSI_BSY_HANDLER(WRITELINE(pcd_state, write_scsi_bsy)) + MCFG_SCSI_IO_HANDLER(WRITELINE(pcd_state, write_scsi_io)) + MCFG_SCSI_CD_HANDLER(WRITELINE(pcd_state, write_scsi_cd)) + MCFG_SCSI_REQ_HANDLER(WRITELINE(pcd_state, write_scsi_req)) + + MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", "scsi") + MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) + MCFG_SCSIDEV_ADD("scsi:1", "harddisk", OMTI5100, SCSI_ID_0) +MACHINE_CONFIG_END + +MACHINE_CONFIG_DERIVED(pcx, pcd) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(pcx_io) + + MCFG_DEVICE_REPLACE("video", PCX_VIDEO, 0) + MCFG_PCX_VIDEO_TXD_HANDLER(DEVWRITELINE("keyboard", pcd_keyboard_device, t0_w)) + + MCFG_DEVICE_MODIFY("keyboard") + MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE("video", pcx_video_device, rx_w)) + + MCFG_DEVICE_MODIFY("usart2") + MCFG_MC2661_TXD_HANDLER(NULL) +MACHINE_CONFIG_END + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( pcd ) + ROM_REGION(0x4000, "bios", 0) + ROM_SYSTEM_BIOS(0, "v2", "V2 GS") // from mainboard SYBAC S26361-D359 V2 GS + ROMX_LOAD("s26361-d359.d42", 0x0001, 0x2000, CRC(e20244dd) SHA1(0ebc5ddb93baacd9106f1917380de58aac64fe73), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("s26361-d359.d43", 0x0000, 0x2000, CRC(e03db2ec) SHA1(fcae8b0c9e7543706817b0a53872826633361fda), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v3", "V3 GS4") // from mainboard SYBAC S26361-D359 V3 GS4 + ROMX_LOAD("361d0359.d42", 0x0001, 0x2000, CRC(5b4461e4) SHA1(db6756aeabb2e6d3921dc7571a5bed3497b964bf), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("361d0359.d43", 0x0000, 0x2000, CRC(71c3189d) SHA1(e8dd6c632bfc833074d3a833ea7f59bb5460f313), ROM_SKIP(1) | ROM_BIOS(2)) +ROM_END + +ROM_START( pcx ) + ROM_REGION(0x4000, "bios", 0) + ROM_SYSTEM_BIOS(0, "v2", "V2 GS") // from mainboard SYBAC S26361-D359 V2 GS + ROMX_LOAD("s26361-d359.d42", 0x0001, 0x2000, CRC(e20244dd) SHA1(0ebc5ddb93baacd9106f1917380de58aac64fe73), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD("s26361-d359.d43", 0x0000, 0x2000, CRC(e03db2ec) SHA1(fcae8b0c9e7543706817b0a53872826633361fda), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v3", "V3 GS4") // from mainboard SYBAC S26361-D359 V3 GS4 + ROMX_LOAD("361d0359.d42", 0x0001, 0x2000, CRC(5b4461e4) SHA1(db6756aeabb2e6d3921dc7571a5bed3497b964bf), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD("361d0359.d43", 0x0000, 0x2000, CRC(71c3189d) SHA1(e8dd6c632bfc833074d3a833ea7f59bb5460f313), ROM_SKIP(1) | ROM_BIOS(2)) +ROM_END + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +COMP( 1984, pcd, 0, 0, pcd, 0, driver_device, 0, "Siemens", "PC-D", MACHINE_NOT_WORKING ) +COMP( 1984, pcx, pcd, 0, pcx, pcx, driver_device, 0, "Siemens", "PC-X", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pce.c b/src/mame/drivers/pce.c new file mode 100644 index 00000000000..9153ec14c0b --- /dev/null +++ b/src/mame/drivers/pce.c @@ -0,0 +1,429 @@ +// license:BSD-3-Clause +// copyright-holders:Charles MacDonald, Wilbert Pol, Angelo Salese +/**************************************************************************** + + PC-Engine / Turbo Grafx 16 driver + by Charles Mac Donald + E-Mail: cgfm2@hooked.net + + Thanks to David Shadoff and Brian McPhail for help with the driver. + +****************************************************************************/ + +/********************************************************************** + To-Do List: +- convert h6280-based drivers to internal memory map for the I/O region +- test sprite collision and overflow interrupts +- sprite precaching +- rewrite the base renderer loop +- Add CD support +- Add 6 button joystick support +- Add 263 line mode +- Sprite DMA should use vdc VRAM functions +- properly implement the pixel clocks instead of the simple scaling we do now + +Banking +======= + +Normally address spacebanks 00-F6 are assigned to regular HuCard ROM space. There +are a couple of special situations: + +Street Fighter II: + - address space banks 40-7F switchable by writing to 1FF0-1FF3 + 1FF0 - select rom banks 40-7F + 1FF1 - select rom banks 80-BF + 1FF2 - select rom banks C0-FF + 1FF3 - select rom banks 100-13F + +Populous: + - address space banks 40-43 contains 32KB RAM + +CDRom units: + - address space banks 80-87 contains 64KB RAM + +Super System Card: + - address space banks 68-7F contains 192KB RAM + +**********************************************************************/ + +/********************************************************************** + Known Bugs +*********************************************************************** +- Benkei Gaiden: hangs after a few Sunsoft logo spins. +- Busou Keiji Cyber Cross: hangs on attract mode +- Cadash: After choosing character and name, the game starts and the display 'jiggles' like tracking if off a VCR +- Fighting Run: has color and sprite issues during gameplay; +- Hisou Kihei - Xserd: black screen; +**********************************************************************/ + +#include "emu.h" +#include "cpu/h6280/h6280.h" +#include "includes/pce.h" +#include "bus/pce/pce_rom.h" +#include "sound/c6280.h" +#include "sound/cdda.h" +#include "sound/msm5205.h" +#include "video/huc6270.h" +#include "video/huc6202.h" + +/* todo: alternate forms of input (multitap, mouse, etc.) */ +static INPUT_PORTS_START( pce ) + + PORT_START("JOY_P.0") + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P1 Run") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) + + PORT_START("JOY_P.1") + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P2 Run") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + + PORT_START("JOY_P.2") + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P3 Select") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P3 Run") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) + + PORT_START("JOY_P.3") + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P4 Select") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P4 Run") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) + + PORT_START("JOY_P.4") + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P5 Select") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P5 Run") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) + + PORT_START("JOY6B_P.0") + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P1 Run") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Button III") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Button IV") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Button V") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Button VI") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) + PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header + + PORT_START("JOY6B_P.1") /* Player 2 controls */ + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P2 Run") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Button III") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Button IV") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Button V") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Button VI") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) + PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header + + PORT_START("JOY6B_P.2") /* Player 3 controls */ + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P3 Select") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P3 Run") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P3 Button III") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P3 Button IV") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P3 Button V") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) + PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header + + PORT_START("JOY6B_P.3") /* Player 4 controls */ + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P4 Select") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P4 Run") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P3 Button III") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P3 Button IV") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P3 Button V") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) + PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header + + PORT_START("JOY6B_P.4") /* Player 5 controls */ + /* II is left of I on the original pad so we map them in reverse order */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P5 Select") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P5 Run") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P5 Button III") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P5 Button IV") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P5 Button V") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P5 Button VI") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) + PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header + + PORT_START("JOY_TYPE") + PORT_CONFNAME(0x0003,0x0000,"Joystick Type Player 1") + PORT_CONFSETTING( 0x0000,"2-buttons" ) +// PORT_CONFSETTING( 0x0001,"3-buttons" ) + PORT_CONFSETTING( 0x0002,"6-buttons" ) +// PORT_CONFSETTING( 0x0003,"Mouse" ) + PORT_CONFNAME(0x000c,0x0000,"Joystick Type Player 2") + PORT_CONFSETTING( 0x0000,"2-buttons" ) +// PORT_CONFSETTING( 0x0004,"3-buttons" ) + PORT_CONFSETTING( 0x0008,"6-buttons" ) +// PORT_CONFSETTING( 0x000c,"Mouse" ) + PORT_CONFNAME(0x0030,0x0000,"Joystick Type Player 3") + PORT_CONFSETTING( 0x0000,"2-buttons" ) +// PORT_CONFSETTING( 0x0010,"3-buttons" ) + PORT_CONFSETTING( 0x0020,"6-buttons" ) +// PORT_CONFSETTING( 0x0030,"Mouse" ) + PORT_CONFNAME(0x00c0,0x0000,"Joystick Type Player 4") + PORT_CONFSETTING( 0x0000,"2-buttons" ) +// PORT_CONFSETTING( 0x0040,"3-buttons" ) + PORT_CONFSETTING( 0x0080,"6-buttons" ) +// PORT_CONFSETTING( 0x00c0,"Mouse" ) + PORT_CONFNAME(0x0300,0x0000,"Joystick Type Player 5") + PORT_CONFSETTING( 0x0000,"2-buttons" ) +// PORT_CONFSETTING( 0x0100,"3-buttons" ) + PORT_CONFSETTING( 0x0200,"6-buttons" ) +// PORT_CONFSETTING( 0x0300,"Mouse" ) + + PORT_START("A_CARD") + PORT_CONFNAME( 0x01, 0x01, "Arcade Card" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) +INPUT_PORTS_END + + + +static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8, pce_state ) + AM_RANGE( 0x000000, 0x0FFFFF) AM_DEVREADWRITE("cartslot", pce_cart_slot_device, read_cart, write_cart) + AM_RANGE( 0x100000, 0x10FFFF) AM_RAM AM_SHARE("cd_ram") + AM_RANGE( 0x110000, 0x1EDFFF) AM_NOP + AM_RANGE( 0x1EE000, 0x1EE7FF) AM_DEVREADWRITE("pce_cd", pce_cd_device, bram_r, bram_w) + AM_RANGE( 0x1EE800, 0x1EFFFF) AM_NOP + AM_RANGE( 0x1F0000, 0x1F1FFF) AM_RAM AM_MIRROR(0x6000) AM_SHARE("user_ram") + AM_RANGE( 0x1FE000, 0x1FE3FF) AM_DEVREADWRITE( "huc6270", huc6270_device, read, write ) + AM_RANGE( 0x1FE400, 0x1FE7FF) AM_DEVREADWRITE( "huc6260", huc6260_device, read, write ) + AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE( C6280_TAG, c6280_device, c6280_r, c6280_w ) + AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_DEVREADWRITE( "maincpu", h6280_device, timer_r, timer_w ) + AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( mess_pce_joystick_r, mess_pce_joystick_w ) + AM_RANGE( 0x1FF400, 0x1FF7FF) AM_DEVREADWRITE( "maincpu", h6280_device, irq_status_r, irq_status_w ) + AM_RANGE( 0x1FF800, 0x1FFBFF) AM_READWRITE( pce_cd_intf_r, pce_cd_intf_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pce_io , AS_IO, 8, pce_state ) + AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6270", huc6270_device, read, write ) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( sgx_mem , AS_PROGRAM, 8, pce_state ) + AM_RANGE( 0x000000, 0x0FFFFF) AM_DEVREADWRITE("cartslot", pce_cart_slot_device, read_cart, write_cart) + AM_RANGE( 0x100000, 0x10FFFF) AM_RAM AM_SHARE("cd_ram") + AM_RANGE( 0x110000, 0x1EDFFF) AM_NOP + AM_RANGE( 0x1EE000, 0x1EE7FF) AM_DEVREADWRITE("pce_cd", pce_cd_device, bram_r, bram_w) + AM_RANGE( 0x1EE800, 0x1EFFFF) AM_NOP + AM_RANGE( 0x1F0000, 0x1F7FFF) AM_RAM AM_SHARE("user_ram") + AM_RANGE( 0x1FE000, 0x1FE007) AM_DEVREADWRITE( "huc6270_0", huc6270_device, read, write ) AM_MIRROR(0x03E0) + AM_RANGE( 0x1FE008, 0x1FE00F) AM_DEVREADWRITE( "huc6202", huc6202_device, read, write ) AM_MIRROR(0x03E0) + AM_RANGE( 0x1FE010, 0x1FE017) AM_DEVREADWRITE( "huc6270_1", huc6270_device, read, write ) AM_MIRROR(0x03E0) + AM_RANGE( 0x1FE400, 0x1FE7FF) AM_DEVREADWRITE( "huc6260", huc6260_device, read, write ) + AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE(C6280_TAG, c6280_device, c6280_r, c6280_w ) + AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_DEVREADWRITE("maincpu", h6280_device, timer_r, timer_w ) + AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE(mess_pce_joystick_r, mess_pce_joystick_w ) + AM_RANGE( 0x1FF400, 0x1FF7FF) AM_DEVREADWRITE("maincpu", h6280_device, irq_status_r, irq_status_w ) + AM_RANGE( 0x1FF800, 0x1FFBFF) AM_READWRITE(pce_cd_intf_r, pce_cd_intf_w ) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( sgx_io , AS_IO, 8, pce_state ) + AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6202", huc6202_device, io_read, io_write ) +ADDRESS_MAP_END + + +UINT32 pce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_huc6260->video_update( bitmap, cliprect ); + return 0; +} + + +WRITE_LINE_MEMBER(pce_state::pce_irq_changed) +{ + m_maincpu->set_input_line(0, state); +} + + +static SLOT_INTERFACE_START(pce_cart) + SLOT_INTERFACE_INTERNAL("rom", PCE_ROM_STD) + SLOT_INTERFACE_INTERNAL("cdsys3u", PCE_ROM_CDSYS3) + SLOT_INTERFACE_INTERNAL("cdsys3j", PCE_ROM_CDSYS3) + SLOT_INTERFACE_INTERNAL("populous", PCE_ROM_POPULOUS) + SLOT_INTERFACE_INTERNAL("sf2", PCE_ROM_SF2) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( pce_common, pce_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", H6280, MAIN_CLOCK/3) + MCFG_CPU_PROGRAM_MAP(pce_mem) + MCFG_CPU_IO_MAP(pce_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(pce_state, pce ) + MCFG_MACHINE_RESET_OVERRIDE(pce_state, mess_pce ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, HUC6260_WPF, 64, 64 + 1024 + 64, HUC6260_LPF, 18, 18 + 242) + MCFG_SCREEN_UPDATE_DRIVER( pce_state, screen_update ) + MCFG_SCREEN_PALETTE("huc6260:palette") + + MCFG_DEVICE_ADD( "huc6260", HUC6260, MAIN_CLOCK ) + MCFG_HUC6260_NEXT_PIXEL_DATA_CB(DEVREAD16("huc6270", huc6270_device, next_pixel)) + MCFG_HUC6260_TIME_TIL_NEXT_EVENT_CB(DEVREAD16("huc6270", huc6270_device, time_until_next_event)) + MCFG_HUC6260_VSYNC_CHANGED_CB(DEVWRITELINE("huc6270", huc6270_device, vsync_changed)) + MCFG_HUC6260_HSYNC_CHANGED_CB(DEVWRITELINE("huc6270", huc6270_device, hsync_changed)) + + MCFG_DEVICE_ADD( "huc6270", HUC6270, 0 ) + MCFG_HUC6270_VRAM_SIZE(0x10000) + MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed)) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6) + MCFG_C6280_CPU("maincpu") + MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) + MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) + + MCFG_PCE_CD_ADD("pce_cd") + + MCFG_SOFTWARE_LIST_ADD("cd_list","pcecd") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( pce, pce_common ) + MCFG_PCE_CARTRIDGE_ADD("cartslot", pce_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","pce") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( tg16, pce_common ) + MCFG_TG16_CARTRIDGE_ADD("cartslot", pce_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","tg16") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( sgx, pce_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", H6280, MAIN_CLOCK/3) + MCFG_CPU_PROGRAM_MAP(sgx_mem) + MCFG_CPU_IO_MAP(sgx_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(pce_state, pce ) + MCFG_MACHINE_RESET_OVERRIDE(pce_state, mess_pce ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, HUC6260_WPF, 64, 64 + 1024 + 64, HUC6260_LPF, 18, 18 + 242) + MCFG_SCREEN_UPDATE_DRIVER( pce_state, screen_update ) + MCFG_SCREEN_PALETTE("huc6260:palette") + + MCFG_DEVICE_ADD( "huc6260", HUC6260, MAIN_CLOCK ) + MCFG_HUC6260_NEXT_PIXEL_DATA_CB(DEVREAD16("huc6202", huc6202_device, next_pixel)) + MCFG_HUC6260_TIME_TIL_NEXT_EVENT_CB(DEVREAD16("huc6202", huc6202_device, time_until_next_event)) + MCFG_HUC6260_VSYNC_CHANGED_CB(DEVWRITELINE("huc6202", huc6202_device, vsync_changed)) + MCFG_HUC6260_HSYNC_CHANGED_CB(DEVWRITELINE("huc6202", huc6202_device, hsync_changed)) + MCFG_DEVICE_ADD( "huc6270_0", HUC6270, 0 ) + MCFG_HUC6270_VRAM_SIZE(0x10000) + MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed)) + MCFG_DEVICE_ADD( "huc6270_1", HUC6270, 0 ) + MCFG_HUC6270_VRAM_SIZE(0x10000) + MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed)) + MCFG_DEVICE_ADD( "huc6202", HUC6202, 0 ) + MCFG_HUC6202_NEXT_PIXEL_0_CB(DEVREAD16("huc6270_0", huc6270_device, next_pixel)) + MCFG_HUC6202_TIME_TIL_NEXT_EVENT_0_CB(DEVREAD16("huc6270_0", huc6270_device, time_until_next_event)) + MCFG_HUC6202_VSYNC_CHANGED_0_CB(DEVWRITELINE("huc6270_0", huc6270_device, vsync_changed)) + MCFG_HUC6202_HSYNC_CHANGED_0_CB(DEVWRITELINE("huc6270_0", huc6270_device, hsync_changed)) + MCFG_HUC6202_READ_0_CB(DEVREAD8("huc6270_0", huc6270_device, read)) + MCFG_HUC6202_WRITE_0_CB(DEVWRITE8("huc6270_0", huc6270_device, write)) + MCFG_HUC6202_NEXT_PIXEL_1_CB(DEVREAD16("huc6270_1", huc6270_device, next_pixel)) + MCFG_HUC6202_TIME_TIL_NEXT_EVENT_1_CB(DEVREAD16("huc6270_1", huc6270_device, time_until_next_event)) + MCFG_HUC6202_VSYNC_CHANGED_1_CB(DEVWRITELINE("huc6270_1", huc6270_device, vsync_changed)) + MCFG_HUC6202_HSYNC_CHANGED_1_CB(DEVWRITELINE("huc6270_1", huc6270_device, hsync_changed)) + MCFG_HUC6202_READ_1_CB(DEVREAD8("huc6270_1", huc6270_device, read)) + MCFG_HUC6202_WRITE_1_CB(DEVWRITE8("huc6270_1", huc6270_device, write)) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6) + MCFG_C6280_CPU("maincpu") + MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) + + MCFG_PCE_CARTRIDGE_ADD("cartslot", pce_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","sgx") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("pce_list","pce") + + MCFG_PCE_CD_ADD("pce_cd") + + MCFG_SOFTWARE_LIST_ADD("cd_list","pcecd") +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( pce ) + ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) +ROM_END + +#define rom_tg16 rom_pce +#define rom_sgx rom_pce + +CONS( 1987, pce, 0, 0, pce, pce, pce_state, mess_pce, "Nippon Electronic Company", "PC Engine", MACHINE_IMPERFECT_SOUND) +CONS( 1989, tg16, pce, 0, tg16, pce, pce_state, tg16, "Nippon Electronic Company", "TurboGrafx 16", MACHINE_IMPERFECT_SOUND) +CONS( 1989, sgx, pce, 0, sgx, pce, pce_state, sgx, "Nippon Electronic Company", "SuperGrafx", MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/pce220.c b/src/mame/drivers/pce220.c new file mode 100644 index 00000000000..3edaa42e745 --- /dev/null +++ b/src/mame/drivers/pce220.c @@ -0,0 +1,1049 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese, Sandro Ronco +/*************************************************************************** + + Sharp PC-E220 + + preliminary driver by Angelo Salese + improvements by Sandro Ronco + + Notes: + - NVRAM works only if the machine is turned off (with OFF key) before closing MESS + + TODO: + - ON key doesn't work. + - Fix the PC-G850V keyboard, that sometimes is too slow. + - LCD contrast. + - Add an artwork for the LCD symbols. + - Add other models that have a similar hardware. + + More info: + http://wwwhomes.uni-bielefeld.de/achim/pc-e220.html + http://www.akiyan.com/pc-g850_technical_data (in Japanese) + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "sound/beep.h" +#include "machine/pce220_ser.h" +#include "machine/nvram.h" +#include "rendlay.h" + +// Interrupt flags +#define IRQ_FLAG_KEY 0x01 +#define IRQ_FLAG_ON 0x02 +#define IRQ_FLAG_TIMER 0x04 + +class pce220_state : public driver_device +{ +public: + pce220_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_beep(*this, "beeper"), + m_serial(*this, PCE220SERIAL_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_beep; + required_device m_serial; + + // HD61202 LCD controller + UINT8 m_lcd_index_row; + UINT8 m_lcd_index_col; + UINT8 m_lcd_start_line; + UINT8 m_lcd_on; + + //basic machine + UINT8 m_bank_num; + UINT8 m_irq_mask; + UINT8 m_irq_flag; + UINT8 m_timer_status; + UINT16 m_kb_matrix; + UINT8 *m_vram; + + UINT8 m_port15; + UINT8 m_port18; + + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER( lcd_status_r ); + DECLARE_WRITE8_MEMBER( lcd_control_w ); + DECLARE_READ8_MEMBER( lcd_data_r ); + DECLARE_WRITE8_MEMBER( lcd_data_w ); + DECLARE_READ8_MEMBER( rom_bank_r ); + DECLARE_WRITE8_MEMBER( rom_bank_w ); + DECLARE_WRITE8_MEMBER( ram_bank_w ); + DECLARE_READ8_MEMBER( timer_r ); + DECLARE_WRITE8_MEMBER( timer_w ); + DECLARE_WRITE8_MEMBER( boot_bank_w ); + DECLARE_READ8_MEMBER( port15_r ); + DECLARE_WRITE8_MEMBER( port15_w ); + DECLARE_READ8_MEMBER( port18_r ); + DECLARE_WRITE8_MEMBER( port18_w ); + DECLARE_READ8_MEMBER( port1f_r ); + DECLARE_WRITE8_MEMBER( kb_matrix_w ); + DECLARE_READ8_MEMBER( kb_r ); + DECLARE_READ8_MEMBER( irq_status_r ); + DECLARE_WRITE8_MEMBER( irq_ack_w ); + DECLARE_WRITE8_MEMBER( irq_mask_w ); + DECLARE_PALETTE_INIT(pce220); + DECLARE_INPUT_CHANGED_MEMBER(kb_irq); + DECLARE_INPUT_CHANGED_MEMBER(on_irq); + TIMER_DEVICE_CALLBACK_MEMBER(pce220_timer_callback); +}; + +class pcg850v_state : public pce220_state +{ +public: + pcg850v_state(const machine_config &mconfig, device_type type, const char *tag) + : pce220_state(mconfig, type, tag) + { } + + UINT8 m_g850v_bank_num; + UINT8 m_lcd_effects; + UINT8 m_lcd_contrast; + UINT8 m_lcd_read_mode; + + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER( g850v_bank_r ); + DECLARE_WRITE8_MEMBER( g850v_bank_w ); + DECLARE_READ8_MEMBER( g850v_lcd_status_r ); + DECLARE_WRITE8_MEMBER( g850v_lcd_control_w ); + DECLARE_READ8_MEMBER( g850v_lcd_data_r ); + DECLARE_WRITE8_MEMBER( g850v_lcd_data_w ); +}; + +UINT32 pce220_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 lcd_symbols[4]; + + if (m_lcd_on) + { + for (int y = 0; y < 4; y++) + { + int row_pos = 0; + + for (int x = 0; x < 12; x++) + { + for (int xi = 0; xi < 5; xi++) + { + for (int yi = 0; yi < 8; yi++) + { + //first 12 columns + int panel1_addr = ((m_lcd_start_line>>3) + y)*0x40 + row_pos; + bitmap.pix16(y*8 + yi, x*6 + xi) = (m_vram[panel1_addr & 0x1ff] >> yi) & 1; + + //last 12 columns + int panel2_addr = ((m_lcd_start_line>>3) + y + 4)*0x40 + (59-row_pos); + bitmap.pix16(y*8 + yi, (x+12)*6 + xi) = (m_vram[panel2_addr & 0x1ff] >> yi) & 1; + } + + row_pos++; + } + } + } + + lcd_symbols[0] = m_vram[((m_lcd_start_line>>3)*0x40 + 0x03c) & 0x1ff]; + lcd_symbols[1] = m_vram[((m_lcd_start_line>>3)*0x40 + 0x0fc) & 0x1ff]; + lcd_symbols[2] = m_vram[((m_lcd_start_line>>3)*0x40 + 0x13c) & 0x1ff]; + lcd_symbols[3] = m_vram[((m_lcd_start_line>>3)*0x40 + 0x1fc) & 0x1ff]; + } + else + { + bitmap.fill(0, cliprect); + memset(lcd_symbols, 0, sizeof(lcd_symbols)); + } + + output_set_value("BUSY" , (lcd_symbols[0] & 0x01) ? 1 : 0); + output_set_value("CAPS" , (lcd_symbols[0] & 0x02) ? 1 : 0); + output_set_value("KANA" , (lcd_symbols[0] & 0x04) ? 1 : 0); + output_set_value("SYO" , (lcd_symbols[0] & 0x08) ? 1 : 0); + output_set_value("2ndF" , (lcd_symbols[0] & 0x10) ? 1 : 0); + output_set_value("TEXT" , (lcd_symbols[1] & 0x08) ? 1 : 0); + output_set_value("CASL" , (lcd_symbols[1] & 0x10) ? 1 : 0); + output_set_value("PRO" , (lcd_symbols[1] & 0x20) ? 1 : 0); + output_set_value("RUN" , (lcd_symbols[1] & 0x40) ? 1 : 0); + output_set_value("BATT" , (lcd_symbols[2] & 0x01) ? 1 : 0); + output_set_value("E" , (lcd_symbols[2] & 0x02) ? 1 : 0); + output_set_value("M" , (lcd_symbols[2] & 0x04) ? 1 : 0); + output_set_value("CONST", (lcd_symbols[2] & 0x08) ? 1 : 0); + output_set_value("RAD" , (lcd_symbols[2] & 0x10) ? 1 : 0); + output_set_value("G" , (lcd_symbols[2] & 0x20) ? 1 : 0); + output_set_value("DE" , (lcd_symbols[2] & 0x40) ? 1 : 0); + output_set_value("STAT" , (lcd_symbols[3] & 0x20) ? 1 : 0); + output_set_value("PRINT", (lcd_symbols[3] & 0x40) ? 1 : 0); + + return 0; +} + +UINT32 pcg850v_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 lcd_symbols[6]; + int color0 = 0; + int color1 = 1; + + if (m_lcd_on) + { + switch (m_lcd_effects) + { + case 0x01: //mirror effect + //TODO + break; + case 0x05: //black mask effect + color0 = color1 = 1; + break; + case 0x07: //reverse effect + color0 = 1; + color1 = 0; + break; + case 0x08: //contrast effect + //TODO: use the max contrast value + break; + case 0x0e: //white mask effect + color0 = color1 = 0; + break; + } + + for (int y = 0; y < 6; y++) + { + int row_pos = 0; + + for (int x = 0; x < 24; x++) + { + for (int xi = 0; xi < 6; xi++) + { + for (int yi = 0; yi < 8; yi++) + { + int addr = ((m_lcd_start_line>>3) + y)*0x100 + row_pos; + bitmap.pix16(y*8 + yi, x*6 + xi) = ((m_vram[addr & 0x7ff] >> yi) & 1 ) ? color1 : color0; + } + + row_pos++; + } + } + } + + lcd_symbols[0] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x090) & 0x7ff]; + lcd_symbols[1] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x190) & 0x7ff]; + lcd_symbols[2] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x290) & 0x7ff]; + lcd_symbols[3] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x390) & 0x7ff]; + lcd_symbols[4] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x490) & 0x7ff]; + lcd_symbols[5] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x590) & 0x7ff]; + } + else + { + bitmap.fill(0, cliprect); + memset(lcd_symbols, 0, sizeof(lcd_symbols)); + } + + output_set_value("RUN" , (lcd_symbols[0] & 0x02) ? 1 : 0); + output_set_value("PRO" , (lcd_symbols[0] & 0x08) ? 1 : 0); + output_set_value("TEXT" , (lcd_symbols[0] & 0x40) ? 1 : 0); + output_set_value("CASL" , (lcd_symbols[1] & 0x08) ? 1 : 0); + output_set_value("STAT" , (lcd_symbols[2] & 0x01) ? 1 : 0); + output_set_value("2ndF" , (lcd_symbols[2] & 0x20) ? 1 : 0); + output_set_value("M" , (lcd_symbols[2] & 0x80) ? 1 : 0); + output_set_value("CAPS" , (lcd_symbols[3] & 0x04) ? 1 : 0); + output_set_value("KANA" , (lcd_symbols[3] & 0x80) ? 1 : 0); + output_set_value("SYO" , (lcd_symbols[4] & 0x02) ? 1 : 0); + output_set_value("DE" , (lcd_symbols[4] & 0x10) ? 1 : 0); + output_set_value("G" , (lcd_symbols[4] & 0x40) ? 1 : 0); + output_set_value("RAD" , (lcd_symbols[5] & 0x01) ? 1 : 0); + output_set_value("CONST", (lcd_symbols[5] & 0x04) ? 1 : 0); + output_set_value("PRINT", (lcd_symbols[5] & 0x10) ? 1 : 0); + output_set_value("BUSY" , (lcd_symbols[5] & 0x40) ? 1 : 0); + output_set_value("BATT" , (lcd_symbols[5] & 0x80) ? 1 : 0); + + return 0; +} + +READ8_MEMBER( pce220_state::lcd_status_r ) +{ + /* + x--- ---- Busy (not emulated) + --x- ---- LCD on/off + ---x ---- Reset + */ + UINT8 data = 0; + + data &= (m_lcd_on<<5); + + return data; +} + +WRITE8_MEMBER( pce220_state::lcd_control_w ) +{ + if((data & 0xfe) == 0x3e) //Display on/off + m_lcd_on = data & 0x01; + if((data & 0xb8) == 0xb8) //Set page + m_lcd_index_row = data & 0x07; + if((data & 0xc0) == 0x40) //Set address + m_lcd_index_col = data & 0x3f; + if((data & 0xc0) == 0xc0) //Set display start line + m_lcd_start_line = data & 0x3f; +} + +READ8_MEMBER( pce220_state::lcd_data_r ) +{ + return m_vram[(m_lcd_index_row*0x40 + m_lcd_index_col - 1) & 0x1ff]; +} + +WRITE8_MEMBER( pce220_state::lcd_data_w ) +{ + m_vram[(m_lcd_index_row*0x40 + m_lcd_index_col) & 0x1ff] = data; + + m_lcd_index_col++; +} + +READ8_MEMBER( pce220_state::rom_bank_r ) +{ + return m_bank_num; +} + +WRITE8_MEMBER( pce220_state::rom_bank_w ) +{ + UINT8 bank4 = data & 0x07; // bits 0,1,2 + UINT8 bank3 = (data & 0x70) >> 4; // bits 4,5,6 + + m_bank_num = data; + + membank("bank3")->set_entry(bank3); + membank("bank4")->set_entry(bank4); +} + +WRITE8_MEMBER( pce220_state::ram_bank_w ) +{ + UINT8 bank = BIT(data,2); + + membank("bank1")->set_entry(bank); + membank("bank2")->set_entry(bank); +} + +READ8_MEMBER( pce220_state::timer_r ) +{ + return m_timer_status; +} + +WRITE8_MEMBER( pce220_state::timer_w ) +{ + m_timer_status = data & 1; +} + +WRITE8_MEMBER( pce220_state::boot_bank_w ) +{ + // set to 1 after boot for restore the ram in the first bank + if (data & 0x01) + { + address_space &space_prg = m_maincpu->space(AS_PROGRAM); + space_prg.install_write_bank(0x0000, 0x3fff, "bank1"); + membank("bank1")->set_entry(0); + } +} + +READ8_MEMBER( pce220_state::port15_r ) +{ + /* + x--- ---- XIN input enabled + ---- ---0 + */ + return m_port15; +} + +WRITE8_MEMBER( pce220_state::port15_w ) +{ + m_serial->enable_interface(BIT(data, 7)); + + m_port15 = data; +} + +READ8_MEMBER( pce220_state::port18_r ) +{ + /* + x--- ---- XOUT/TXD + ---- --x- DOUT + ---- ---x BUSY/CTS + */ + + return m_port18; +} + +WRITE8_MEMBER( pce220_state::port18_w ) +{ + m_beep->set_state(BIT(data, 7)); + + m_serial->out_busy(BIT(data, 0)); + m_serial->out_dout(BIT(data, 1)); + m_serial->out_xout(BIT(data, 7)); + + m_port18 = data; +} + +READ8_MEMBER( pce220_state::port1f_r ) +{ + /* + x--- ---- ON - resp. break key status (?) + ---- -x-- XIN/RXD + ---- --x- ACK/RTS + ---- ---x DIN + */ + + UINT8 data = 0; + + data |= m_serial->in_din()<<0; + data |= m_serial->in_ack()<<1; + data |= m_serial->in_xin()<<2; + + data |= ioport("ON")->read()<<7; + + return data; +} + +WRITE8_MEMBER( pce220_state::kb_matrix_w ) +{ + switch(offset) + { + case 0: + m_kb_matrix = (m_kb_matrix & 0x300) | data; + break; + case 1: + m_kb_matrix = (m_kb_matrix & 0xff) | ((data&0x03)<<8); + break; + } +} + +READ8_MEMBER( pce220_state::kb_r ) +{ + UINT8 data = 0x00; + + if (m_kb_matrix & 0x01) + data |= ioport("LINE0")->read(); + if (m_kb_matrix & 0x02) + data |= ioport("LINE1")->read(); + if (m_kb_matrix & 0x04) + data |= ioport("LINE2")->read(); + if (m_kb_matrix & 0x08) + data |= ioport("LINE3")->read(); + if (m_kb_matrix & 0x10) + data |= ioport("LINE4")->read(); + if (m_kb_matrix & 0x20) + data |= ioport("LINE5")->read(); + if (m_kb_matrix & 0x40) + data |= ioport("LINE6")->read(); + if (m_kb_matrix & 0x80) + data |= ioport("LINE7")->read(); + if (m_kb_matrix & 0x100) + data |= ioport("LINE8")->read(); + if (m_kb_matrix & 0x200) + data |= ioport("LINE9")->read(); + + return data; +} + +READ8_MEMBER( pce220_state::irq_status_r ) +{ + /* + ---- -x-- timer + ---- --x- ON-Key + ---- ---x keyboard + */ + return m_irq_flag; +} + +WRITE8_MEMBER( pce220_state::irq_ack_w ) +{ + m_irq_flag &= ~data; +} + +WRITE8_MEMBER( pce220_state::irq_mask_w ) +{ + m_irq_mask = data; +} + +READ8_MEMBER( pcg850v_state::g850v_bank_r ) +{ + return m_g850v_bank_num; +} + +WRITE8_MEMBER( pcg850v_state::g850v_bank_w ) +{ + address_space &space_prg = m_maincpu->space(AS_PROGRAM); + + if (data < 0x16) + { + space_prg.install_read_bank(0xc000, 0xffff, "bank4"); + membank("bank4")->set_entry(data); + } + else + { + space_prg.unmap_read(0xc000, 0xffff); + } + + m_g850v_bank_num = data; +} + +READ8_MEMBER( pcg850v_state::g850v_lcd_status_r ) +{ + /* + x--- ---- Busy (not emulated) + --x- ---- LCD on/off + */ + UINT8 data = 0; + + data &= (m_lcd_on<<5); + + return data; +} + +WRITE8_MEMBER( pcg850v_state::g850v_lcd_control_w ) +{ + if ((data & 0xf0) == 0x00) // LCD column LSB + { + m_lcd_index_col = (m_lcd_index_col & 0xf0) | (data & 0x0f); + } + else if ((data & 0xf0) == 0x10) // LCD column MSB + { + m_lcd_index_col = (m_lcd_index_col & 0x0f) | ((data<<4) & 0xf0); + } + else if ((data & 0xf0) == 0x20) // LCD on/off + { + m_lcd_on = BIT(data, 0); + } + else if ((data & 0xc0) == 0x40) // display start line + { + m_lcd_start_line = data & 0x3f; + } + else if ((data & 0xe0) == 0x80) // contrast level + { + m_lcd_contrast = data; + } + else if ((data & 0xf0) == 0xa0) // display effects + { + m_lcd_effects = data & 0x0f; + } + else if ((data & 0xf0) == 0xb0) // set row + { + m_lcd_index_row = data & 0x07; + } + else if ((data & 0xf0) == 0xe0) // display controls + { + if (BIT(data, 1)) + m_lcd_contrast = 0; + + m_lcd_read_mode = BIT(data, 2); + } + else + { + logerror( "PC-G850V: Unknown LCD command 0x%02x\n", data ); + } +} + +READ8_MEMBER( pcg850v_state::g850v_lcd_data_r ) +{ + UINT8 data = m_vram[(m_lcd_index_row*0x100 + m_lcd_index_col - 1) & 0x7ff]; + + if (m_lcd_read_mode == 1) + m_lcd_index_col++; + + return data; +} + +WRITE8_MEMBER( pcg850v_state::g850v_lcd_data_w ) +{ + m_vram[(m_lcd_index_row*0x100 + m_lcd_index_col) & 0x7ff] = data; + + m_lcd_index_col++; +} + + +static ADDRESS_MAP_START(pce220_mem, AS_PROGRAM, 8, pce220_state) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pce220_io , AS_IO, 8, pce220_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x10, 0x10) AM_READ(kb_r) + AM_RANGE(0x11, 0x12) AM_WRITE(kb_matrix_w) + AM_RANGE(0x13, 0x13) AM_READ_PORT("SHIFT") + AM_RANGE(0x14, 0x14) AM_READWRITE(timer_r, timer_w) + AM_RANGE(0x15, 0x15) AM_READWRITE(port15_r, port15_w) + AM_RANGE(0x16, 0x16) AM_READWRITE(irq_status_r, irq_ack_w) + AM_RANGE(0x17, 0x17) AM_WRITE(irq_mask_w) + AM_RANGE(0x18, 0x18) AM_READWRITE(port18_r, port18_w) + AM_RANGE(0x19, 0x19) AM_READWRITE(rom_bank_r, rom_bank_w) + AM_RANGE(0x1a, 0x1a) AM_WRITE(boot_bank_w) + AM_RANGE(0x1b, 0x1b) AM_WRITE(ram_bank_w) + AM_RANGE(0x1c, 0x1c) AM_WRITENOP //peripheral reset + AM_RANGE(0x1d, 0x1d) AM_READ_PORT("BATTERY") + AM_RANGE(0x1e, 0x1e) AM_WRITENOP //??? + AM_RANGE(0x1f, 0x1f) AM_READ(port1f_r) + AM_RANGE(0x58, 0x58) AM_WRITE(lcd_control_w) + AM_RANGE(0x59, 0x59) AM_READ(lcd_status_r) + AM_RANGE(0x5a, 0x5a) AM_WRITE(lcd_data_w) + AM_RANGE(0x5b, 0x5b) AM_READ(lcd_data_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pcg850v_io , AS_IO, 8, pcg850v_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x10, 0x10) AM_READ(kb_r) + AM_RANGE(0x11, 0x12) AM_WRITE(kb_matrix_w) + AM_RANGE(0x13, 0x13) AM_READ_PORT("SHIFT") + AM_RANGE(0x14, 0x14) AM_READWRITE(timer_r, timer_w) + AM_RANGE(0x15, 0x15) AM_READWRITE(port15_r, port15_w) + AM_RANGE(0x16, 0x16) AM_READWRITE(irq_status_r, irq_ack_w) + AM_RANGE(0x17, 0x17) AM_WRITE(irq_mask_w) + AM_RANGE(0x18, 0x18) AM_READWRITE(port18_r, port18_w) + AM_RANGE(0x19, 0x19) AM_READWRITE(rom_bank_r, rom_bank_w) + AM_RANGE(0x1a, 0x1a) AM_WRITE(boot_bank_w) + AM_RANGE(0x1b, 0x1b) AM_WRITE(ram_bank_w) + AM_RANGE(0x1c, 0x1c) AM_WRITENOP //peripheral reset + AM_RANGE(0x1d, 0x1d) AM_READ_PORT("BATTERY") + AM_RANGE(0x1e, 0x1e) AM_WRITENOP //??? + AM_RANGE(0x1f, 0x1f) AM_READ(port1f_r) + AM_RANGE(0x40, 0x40) AM_READWRITE(g850v_lcd_status_r, g850v_lcd_control_w) + AM_RANGE(0x41, 0x41) AM_READWRITE(g850v_lcd_data_r, g850v_lcd_data_w) + AM_RANGE(0x69, 0x69) AM_READWRITE(g850v_bank_r, g850v_bank_w) +ADDRESS_MAP_END + +INPUT_CHANGED_MEMBER(pce220_state::kb_irq) +{ + if (m_irq_mask & IRQ_FLAG_KEY) + { + m_maincpu->set_input_line(0, newval ? ASSERT_LINE : CLEAR_LINE ); + + m_irq_flag = (m_irq_flag & 0xfe) | (newval & 0x01); + } +} + +INPUT_CHANGED_MEMBER(pce220_state::on_irq) +{ + if (m_irq_mask & IRQ_FLAG_ON) + { + m_maincpu->set_input_line(0, newval ? ASSERT_LINE : CLEAR_LINE ); + + m_irq_flag = (m_irq_flag & 0xfd) | ((newval & 0x01)<<1); + } +} + +/* Input ports */ +static INPUT_PORTS_START( pce220 ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) + PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x01, "Low Battery" ) + + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Q') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('W') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('E') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('R') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('T') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Y') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('U') PORT_CHAR('\'') + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('A') PORT_CHAR('[') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('S') PORT_CHAR(']') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('D') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('F') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('G') PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('H') PORT_CHAR('|') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('J') PORT_CHAR('`') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('K') PORT_CHAR('_') + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('X') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(',') PORT_CHAR('?') + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("CAL") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("BAS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("CAPS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("ANS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_NAME("TAB") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("SPACE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(' ') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("DOWN") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("UP") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("LEFT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("RIGHT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("CONS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('.') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("+/-") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("RET") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(13) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('L') PORT_CHAR('=') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DEL") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('1') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('2') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('3') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('-') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("M+") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('I') PORT_CHAR('<') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('O') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('5') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('6') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('*') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("RM") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('P') PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("BS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("n!") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('7') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('8') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('9') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('/') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(')') + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("hyp") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("DEG") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("y^x") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('^') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("sqrt") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("x^2") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('(') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("1/x") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("MDF") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_NAME("2nd") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("sin") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("cos") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("ln") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("log") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("tan") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("FSE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("CCE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_START("SHIFT") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Shift") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("ON") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("ON") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, on_irq, NULL ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pcg850v ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) + PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x01, "Low Battery" ) + + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Q') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('W') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('E') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('R') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('T') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Y') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('U') PORT_CHAR('\'') + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('A') PORT_CHAR('[') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('S') PORT_CHAR(']') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('D') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('F') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('H') PORT_CHAR('|') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('J') PORT_CHAR('`') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('K') PORT_CHAR('_') + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('X') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(',') PORT_CHAR('?') + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("BAS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("TEXT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("CAPS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("KANA") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_NAME("TAB") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("SPACE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(' ') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("DOWN") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("UP") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("LEFT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("RIGHT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("CONS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('.') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("=") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("RET") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(13) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('L') PORT_CHAR('=') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DEL") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('1') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('2') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('3') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('-') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("M+") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('I') PORT_CHAR('<') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('O') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('5') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('6') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('*') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("RM") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('P') PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("BS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("pi") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('7') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('8') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('9') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('/') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(')') + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("nPr") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("DEG") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("SQR") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("SQU") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("x^y") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('^') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('(') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("1/x") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("MDF") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_NAME("2nd") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("sin") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("cos") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("ln") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("log") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("tan") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("FSE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("CCE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) + PORT_START("SHIFT") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Shift") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("ON") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("ON") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, on_irq, NULL ) +INPUT_PORTS_END + +void pce220_state::machine_start() +{ + UINT8 *rom = memregion("user1")->base(); + UINT8 *ram = m_ram->pointer(); + + membank("bank1")->configure_entries(0, 2, ram + 0x0000, 0x8000); + membank("bank2")->configure_entries(0, 2, ram + 0x4000, 0x8000); + membank("bank3")->configure_entries(0, 8, rom, 0x4000); + membank("bank4")->configure_entries(0, 8, rom, 0x4000); + + m_vram = (UINT8*)memregion("lcd_vram")->base(); + + machine().device("nvram")->set_base(ram, m_ram->size()); +} + +void pcg850v_state::machine_start() +{ + UINT8 *rom = memregion("user1")->base(); + UINT8 *ram = m_ram->pointer(); + + membank("bank1")->configure_entries(0, 2, ram + 0x0000, 0x8000); + membank("bank2")->configure_entries(0, 2, ram + 0x4000, 0x8000); + membank("bank3")->configure_entries(0, 22, rom, 0x4000); + membank("bank4")->configure_entries(0, 22, rom, 0x4000); + + m_vram = (UINT8*)memregion("lcd_vram")->base(); + machine().device("nvram")->set_base(ram, m_ram->size()); +} + +void pce220_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + space.unmap_write(0x0000, 0x3fff); + + // install the boot code into the first bank + membank("bank1")->set_base(memregion("user1")->base() + 0x0000); + + m_lcd_index_row = 0; + m_lcd_index_col = 0; + m_lcd_start_line = 0; + m_lcd_on = 0; + m_bank_num = 0; + m_irq_mask = 0; + m_irq_flag = 0; + m_timer_status = 0; + m_kb_matrix = 0; +} + +void pcg850v_state::machine_reset() +{ + pce220_state::machine_reset(); + + m_g850v_bank_num = 0; + m_lcd_effects = 0; + m_lcd_contrast = 0; + m_lcd_read_mode = 0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(pce220_state::pce220_timer_callback) +{ + m_timer_status = !m_timer_status; + + if (m_irq_mask & IRQ_FLAG_TIMER) + { + m_maincpu->set_input_line(0, HOLD_LINE ); + + m_irq_flag = (m_irq_flag & 0xfb) | (m_timer_status<<2); + } +} + +PALETTE_INIT_MEMBER(pce220_state,pce220) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + + +static MACHINE_CONFIG_START( pce220, pce220_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, 3072000 ) // CMOS-SC7852 + MCFG_CPU_PROGRAM_MAP(pce220_mem) + MCFG_CPU_IO_MAP(pce220_io) + + /* video hardware */ + // 4 lines x 24 characters, resp. 144 x 32 pixel + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(pce220_state, screen_update) + MCFG_SCREEN_SIZE(24*6, 4*8) + MCFG_SCREEN_VISIBLE_AREA(0, 24*6-1, 0, 4*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(pce220_state,pce220) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468)) + + MCFG_NVRAM_ADD_0FILL("nvram") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") // 32K internal + 32K external card + + MCFG_PCE220_SERIAL_ADD(PCE220SERIAL_TAG) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pcg850v, pcg850v_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz ) // CMOS-SC7852 + MCFG_CPU_PROGRAM_MAP(pce220_mem) + MCFG_CPU_IO_MAP(pcg850v_io) + + /* video hardware */ + // 6 lines x 24 characters, resp. 144 x 48 pixel + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(pcg850v_state, screen_update) + MCFG_SCREEN_SIZE(144, 48) + MCFG_SCREEN_VISIBLE_AREA(0, 144-1, 0, 48-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(pce220_state,pce220) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468)) + + MCFG_NVRAM_ADD_0FILL("nvram") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") // 32K internal + 32K external card + + MCFG_PCE220_SERIAL_ADD(PCE220SERIAL_TAG) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pce220 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v1", "v 0.1") + ROM_SYSTEM_BIOS( 1, "v2", "v 0.2") + ROM_LOAD( "bank0.bin", 0x0000, 0x4000, CRC(1fa94d11) SHA1(24c54347dbb1423388360a359aa09db47d2057b7)) + ROM_LOAD( "bank1.bin", 0x4000, 0x4000, CRC(0f9864b0) SHA1(6b7301c96f1a865e1931d82872a1ed5d1f80644e)) + ROM_LOAD( "bank2.bin", 0x8000, 0x4000, CRC(1625e958) SHA1(090440600d461aa7efe4adbf6e975aa802aabeec)) + ROM_LOAD( "bank3.bin", 0xc000, 0x4000, CRC(ed9a57f8) SHA1(58087dc64103786a40325c0a1e04bd88bfd6da57)) + ROM_LOAD( "bank4.bin", 0x10000, 0x4000, CRC(e37665ae) SHA1(85f5c84f69f79e7ac83b30397b2a1d9629f9eafa)) + ROMX_LOAD( "bank5.bin", 0x14000, 0x4000, CRC(6b116e7a) SHA1(b29f5a070e846541bddc88b5ee9862cc36b88eee),ROM_BIOS(2)) + ROMX_LOAD( "bank5_0.1.bin", 0x14000, 0x4000, CRC(13c26eb4) SHA1(b9cd0efd6b195653b9610e20ad8aab541824a689),ROM_BIOS(1)) + ROMX_LOAD( "bank6.bin", 0x18000, 0x4000, CRC(4fbfbd18) SHA1(e5aab1df172dcb94aa90e7d898eacfc61157ff15),ROM_BIOS(2)) + ROMX_LOAD( "bank6_0.1.bin", 0x18000, 0x4000, CRC(e2cda7a6) SHA1(01b1796d9485fde6994cb5afbe97514b54cfbb3a),ROM_BIOS(1)) + ROMX_LOAD( "bank7.bin", 0x1c000, 0x4000, CRC(5e98b5b6) SHA1(f22d74d6a24f5929efaf2983caabd33859232a94),ROM_BIOS(2)) + ROMX_LOAD( "bank7_0.1.bin", 0x1c000, 0x4000, CRC(d8e821b2) SHA1(18245a75529d2f496cdbdc28cdf40def157b20c0),ROM_BIOS(1)) + + ROM_REGION( 0x200, "lcd_vram", ROMREGION_ERASE00) //HD61202 internal RAM (4096 bits) +ROM_END + +ROM_START( pcg850v ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x58000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "rom00.bin", 0x00000, 0x4000, CRC(c41a7a3e) SHA1(8b85d07e6f2fa048f8a958c261ab3344df750bd2)) + ROM_LOAD( "rom01.bin", 0x04000, 0x4000, CRC(45cafcaf) SHA1(e6142ac2ddb50c90bf1afd03ee2d2741abde8b76)) + ROM_LOAD( "rom02.bin", 0x08000, 0x4000, CRC(c81a804e) SHA1(322b9c6ca5cb7bc41a55c7874838e601ef50644e)) + ROM_LOAD( "rom03.bin", 0x0c000, 0x4000, CRC(9301e937) SHA1(b152186577abf86a7fb535cd63985f2a67e154b9)) + ROM_LOAD( "rom04.bin", 0x10000, 0x4000, CRC(6bf11755) SHA1(fe7458758d26fabfcca34e791fe2425104830b7b)) + ROM_LOAD( "rom05.bin", 0x14000, 0x4000, CRC(8a808f5e) SHA1(448caf0cc30de483d876c31785c8bb27305860b8)) + ROM_LOAD( "rom06.bin", 0x18000, 0x4000, CRC(3902f135) SHA1(40fbd51718a830e3f374843990522e29508376fd)) + ROM_LOAD( "rom07.bin", 0x1c000, 0x4000, CRC(618a7be8) SHA1(5f16e47eeeb9c153bb95c6d6e3af276576b8274e)) + ROM_LOAD( "rom08.bin", 0x20000, 0x4000, CRC(bf05b34d) SHA1(8556d64ddd89191c9dc048280e384f9146d81a16)) + ROM_LOAD( "rom09.bin", 0x24000, 0x4000, CRC(b75dbd0a) SHA1(ca149134a819fa52591ae1733270f8b3c811a18a)) + ROM_LOAD( "rom0a.bin", 0x28000, 0x4000, CRC(e7c5ec8f) SHA1(70cac20d4f01b5b2fdd76837659bc4947a1ebd21)) + ROM_LOAD( "rom0b.bin", 0x2c000, 0x4000, CRC(bdc4f889) SHA1(154d6223e8e750fcbffdb069215fee9492685747)) + ROM_LOAD( "rom0c.bin", 0x30000, 0x4000, CRC(6ef5560a) SHA1(5b2ad8e36354f448fe01acba1d2f69630de345a7)) + ROM_LOAD( "rom0d.bin", 0x34000, 0x4000, CRC(4295a44e) SHA1(0f8dfc759ed17f2b0acc1dc4912e881b1f0f65aa)) + ROM_LOAD( "rom0e.bin", 0x38000, 0x4000, CRC(0c8212e1) SHA1(8145728d87ea5a5e29c0e98c3d2d4278b1070359)) + ROM_LOAD( "rom0f.bin", 0x3c000, 0x4000, CRC(33c30dba) SHA1(296fb6fa3921822c3458acde0962c3a25cb19a1e)) + ROM_LOAD( "rom10.bin", 0x40000, 0x4000, CRC(553a0926) SHA1(2149827f9a2eb879756b3da609e17fc5b1c9bd78)) + ROM_LOAD( "rom11.bin", 0x44000, 0x4000, CRC(385a128d) SHA1(eda1192a75e4cfb50c0ac058f230a84cbfe67d51)) + ROM_LOAD( "rom12.bin", 0x48000, 0x4000, CRC(cd12dfca) SHA1(50a5defdeb4da9b2eac196816559056fc55e1dca)) + ROM_LOAD( "rom13.bin", 0x4c000, 0x4000, CRC(9bca873b) SHA1(4ce43553fb15c0ca866e9582a3ef8dc22a2795b4)) + ROM_LOAD( "rom14.bin", 0x50000, 0x4000, CRC(a2938c40) SHA1(d2c24401eea5e56268ef6eadcc612c8bbaa3342a)) + ROM_LOAD( "rom15.bin", 0x54000, 0x4000, CRC(53a0bf0a) SHA1(bf27baeaf208628fbe3c959d623cc08de21cf9f8)) + + ROM_REGION( 0x1000, "lcd_vram", ROMREGION_ERASE00) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1991, pce220, 0, 0, pce220, pce220, driver_device, 0, "Sharp", "PC-E220", MACHINE_NOT_WORKING ) +COMP( 2001, pcg850v, 0, 0, pcg850v, pcg850v, driver_device, 0, "Sharp", "PC-G850V", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pcfx.c b/src/mame/drivers/pcfx.c new file mode 100644 index 00000000000..d2faa292087 --- /dev/null +++ b/src/mame/drivers/pcfx.c @@ -0,0 +1,531 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + pcfx.c + + Driver file to handle emulation of the NEC PC-FX. + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/v810/v810.h" +#include "video/huc6261.h" +#include "video/huc6270.h" +#include "video/huc6272.h" + +struct pcfx_pad_t +{ + UINT8 ctrl[2]; + UINT8 status[2]; + UINT32 latch[2]; +}; + +class pcfx_state : public driver_device +{ +public: + enum + { + TIMER_PAD_FUNC + }; + + pcfx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_huc6261(*this, "huc6261") { } + + required_device m_maincpu; + required_device m_huc6261; + + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + // Interrupt controller (component unknown) + UINT16 m_irq_mask; + UINT16 m_irq_pending; + UINT8 m_irq_priority[8]; + + pcfx_pad_t m_pad; + + DECLARE_READ16_MEMBER( irq_read ); + DECLARE_WRITE16_MEMBER( irq_write ); + DECLARE_READ16_MEMBER( pad_r ); + DECLARE_WRITE16_MEMBER( pad_w ); + DECLARE_READ8_MEMBER( extio_r ); + DECLARE_WRITE8_MEMBER( extio_w ); + + inline void check_irqs(); + inline void set_irq_line(int line, int state); + DECLARE_WRITE_LINE_MEMBER( irq8_w ); + DECLARE_WRITE_LINE_MEMBER( irq9_w ); + DECLARE_WRITE_LINE_MEMBER( irq10_w ); + DECLARE_WRITE_LINE_MEMBER( irq11_w ); + DECLARE_WRITE_LINE_MEMBER( irq12_w ); + DECLARE_WRITE_LINE_MEMBER( irq13_w ); + DECLARE_WRITE_LINE_MEMBER( irq14_w ); + DECLARE_WRITE_LINE_MEMBER( irq15_w ); + TIMER_CALLBACK_MEMBER(pad_func); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +READ8_MEMBER(pcfx_state::extio_r) +{ + address_space &io_space = m_maincpu->space(AS_IO); + + return io_space.read_byte(offset); +} + +WRITE8_MEMBER(pcfx_state::extio_w) +{ + address_space &io_space = m_maincpu->space(AS_IO); + + io_space.write_byte(offset, data); +} + +static ADDRESS_MAP_START( pcfx_mem, AS_PROGRAM, 32, pcfx_state ) + AM_RANGE( 0x00000000, 0x001FFFFF ) AM_RAM /* RAM */ +// AM_RANGE( 0x80000000, 0x807FFFFF ) AM_READWRITE8(extio_r,extio_w,0xffffffff) /* EXTIO */ + AM_RANGE( 0xE0000000, 0xE7FFFFFF ) AM_NOP /* BackUp RAM */ + AM_RANGE( 0xE8000000, 0xE9FFFFFF ) AM_NOP /* Extended BackUp RAM */ + AM_RANGE( 0xF8000000, 0xF8000007 ) AM_NOP /* PIO */ + AM_RANGE( 0xFFF00000, 0xFFFFFFFF ) AM_ROMBANK("bank1") /* ROM */ +ADDRESS_MAP_END + +READ16_MEMBER( pcfx_state::pad_r ) +{ + UINT16 res; + UINT8 port_type = ((offset<<1) & 0x80) >> 7; + + if(((offset<<1) & 0x40) == 0) + { + // status + /* + ---- x--- + ---- ---x incoming data state (0=available) + */ + res = m_pad.status[port_type]; + //printf("STATUS %d\n",port_type); + } + else + { + // received data + //printf("RX %d\n",port_type); + res = m_pad.latch[port_type] >> (((offset<<1) & 2) ? 16 : 0); + + if(((offset<<1) & 0x02) == 0) + { + m_pad.status[port_type] &= ~8; // clear latch on LSB read according to docs + set_irq_line(11, 0); + } + } + + return res; +} + +void pcfx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_PAD_FUNC: + pad_func(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in pcfx_state::device_timer"); + } +} + +TIMER_CALLBACK_MEMBER(pcfx_state::pad_func) +{ + const char *const padnames[] = { "P1", "P2" }; + + m_pad.latch[param] = ioport(padnames[param])->read(); + m_pad.status[param] |= 8; + m_pad.ctrl[param] &= ~1; // ack TX line + // TODO: pad IRQ + set_irq_line(11, 1); +} + +WRITE16_MEMBER( pcfx_state::pad_w ) +{ + UINT8 port_type = ((offset<<1) & 0x80) >> 7; + + if(((offset<<1) & 0x40) == 0) + { + // control + /* + ---- -x-- receiver enable + ---- --x- enable multi-tap + ---- ---x enable send (0->1 transition) + */ + if(data & 1 && (!(m_pad.ctrl[port_type] & 1))) + { + timer_set(attotime::from_msec(1), TIMER_PAD_FUNC, port_type); // TODO: time + } + + m_pad.ctrl[port_type] = data & 7; + //printf("%04x CONTROL %d\n",data,port_type); + } + else + { + // transmitted data + //printf("%04x TX %d\n",data,port_type); + } +} + + +static ADDRESS_MAP_START( pcfx_io, AS_IO, 32, pcfx_state ) + AM_RANGE( 0x00000000, 0x000000FF ) AM_READWRITE16(pad_r, pad_w, 0xffffffff) /* PAD */ + AM_RANGE( 0x00000100, 0x000001FF ) AM_NOP /* HuC6230 */ + AM_RANGE( 0x00000200, 0x000002FF ) AM_NOP /* HuC6271 */ + AM_RANGE( 0x00000300, 0x000003FF ) AM_DEVREADWRITE16( "huc6261", huc6261_device, read, write, 0xffff ) /* HuC6261 */ + AM_RANGE( 0x00000400, 0x000004FF ) AM_DEVREADWRITE8( "huc6270_a", huc6270_device, read, write, 0xffff ) /* HuC6270-A */ + AM_RANGE( 0x00000500, 0x000005FF ) AM_DEVREADWRITE8( "huc6270_b", huc6270_device, read, write, 0xffff ) /* HuC6270-B */ + AM_RANGE( 0x00000600, 0x000006FF ) AM_DEVREADWRITE( "huc6272", huc6272_device, read, write ) /* HuC6272 */ + AM_RANGE( 0x00000C80, 0x00000C83 ) AM_NOP + AM_RANGE( 0x00000E00, 0x00000EFF ) AM_READWRITE16( irq_read, irq_write, 0xffff ) /* Interrupt controller */ + AM_RANGE( 0x00000F00, 0x00000FFF ) AM_NOP +// AM_RANGE( 0x00600000, 0x006FFFFF ) AM_READ(scsi_ctrl_r) + AM_RANGE( 0x00780000, 0x007FFFFF ) AM_ROM AM_REGION("scsi_rom", 0 ) + AM_RANGE( 0x80500000, 0x805000FF ) AM_NOP /* HuC6273 */ +ADDRESS_MAP_END + + +static INPUT_PORTS_START( pcfx ) + /* + xxxx ---- ---- ---- ID (0xf = 6 button pad, 0xe = tap, 0xd = ?) + */ + PORT_START("P1") + PORT_BIT( 0xf0000000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ID + PORT_DIPNAME( 0x01000000, 0x01000000, "1" ) + PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x02000000, 0x02000000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x04000000, 0x04000000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x08000000, 0x08000000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x010000, 0x010000, "2" ) + PORT_DIPSETTING( 0x010000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x020000, 0x020000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x020000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x040000, 0x040000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x040000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x080000, 0x080000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x080000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x100000, 0x100000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x100000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x200000, 0x200000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x200000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x400000, 0x400000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x400000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x800000, 0x800000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x800000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0100, 0x0100, "3" ) + PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) // * + PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) // * + PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1) PORT_NAME("RUN button") + PORT_DIPNAME( 0x01, 0x01, "4" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("P2") + PORT_BIT( 0xf0000000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0fffffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) +INPUT_PORTS_END + + +READ16_MEMBER( pcfx_state::irq_read ) +{ + UINT16 data = 0; + + switch( offset ) + { + // Interrupts pending + // Same bit order as mask + case 0x00/4: + data = m_irq_pending; + break; + + // Interrupt mask + case 0x40/4: + data = m_irq_mask; + break; + + // Interrupt priority 0 + case 0x80/4: + data = m_irq_priority[4] | ( m_irq_priority[5] << 3 ) | ( m_irq_priority[6] << 6 ) | ( m_irq_priority[7] << 9 ); + break; + + // Interrupt priority 1 + case 0xC0/4: + data = m_irq_priority[0] | ( m_irq_priority[1] << 3 ) | ( m_irq_priority[2] << 6 ) | ( m_irq_priority[3] << 9 ); + break; + } + + return data; +} + + +WRITE16_MEMBER( pcfx_state::irq_write ) +{ + switch( offset ) + { + // Interrupts pending + case 0x00/4: + logerror("irq_write: Attempt to write to irq pending register\n"); + break; + + // Interrupt mask + // --------x------- Mask interrupt level 8 (Unknown) + // ---------x------ Mask interrupt level 9 (Timer) + // ----------x----- Mask interrupt level 10 (Unknown) + // -----------x---- Mask interrupt level 11 (Pad) + // ------------x--- Mask interrupt level 12 (HuC6270-A) + // -------------x-- Mask interrupt level 13 (HuC6272) + // --------------x- Mask interrupt level 14 (HuC6270-B) + // ---------------x Mask interrupt level 15 (HuC6273) + // 0 - allow, 1 - ignore interrupt + case 0x40/4: + m_irq_mask = data; + check_irqs(); + break; + + // Interrupt priority 0 + // ----xxx--------- Priority level interrupt 12 + // -------xxx------ Priority level interrupt 13 + // ----------xxx--- Priority level interrupt 14 + // -------------xxx Priority level interrupt 15 + case 0x80/4: + m_irq_priority[7] = ( data >> 0 ) & 0x07; + m_irq_priority[6] = ( data >> 3 ) & 0x07; + m_irq_priority[5] = ( data >> 6 ) & 0x07; + m_irq_priority[4] = ( data >> 9 ) & 0x07; + check_irqs(); + break; + + // Interrupt priority 1 + // ----xxx--------- Priority level interrupt 8 + // -------xxx------ Priority level interrupt 9 + // ----------xxx--- Priority level interrupt 10 + // -------------xxx Priority level interrupt 11 + case 0xC0/4: + m_irq_priority[3] = ( data >> 0 ) & 0x07; + m_irq_priority[2] = ( data >> 3 ) & 0x07; + m_irq_priority[1] = ( data >> 6 ) & 0x07; + m_irq_priority[0] = ( data >> 9 ) & 0x07; + check_irqs(); + break; + } +} + + +inline void pcfx_state::check_irqs() +{ + UINT16 active_irqs = m_irq_pending & ~m_irq_mask; + int highest_prio = -1; + + for ( int i = 0; i < 8; i++ ) + { + if ( active_irqs & 0x80 ) + { + if ( m_irq_priority[i] >= highest_prio ) + { + highest_prio = m_irq_priority[i]; + } + } + active_irqs <<= 1; + } + + if ( highest_prio >= 0 ) + { + m_maincpu->set_input_line(8 + highest_prio, ASSERT_LINE ); + } + else + { + m_maincpu->set_input_line(0, CLEAR_LINE ); + } +} + + +inline void pcfx_state::set_irq_line(int line, int state) +{ + if ( state ) + { +//printf("Setting irq line %d\n", line); + m_irq_pending |= ( 1 << ( 15 - line ) ); + } + else + { +//printf("Clearing irq line %d\n", line); + m_irq_pending &= ~( 1 << ( 15 - line ) ); + } + check_irqs(); +} + +WRITE_LINE_MEMBER( pcfx_state::irq8_w ) +{ + set_irq_line(8, state); +} + +WRITE_LINE_MEMBER( pcfx_state::irq9_w ) +{ + set_irq_line(9, state); +} + +WRITE_LINE_MEMBER( pcfx_state::irq10_w ) +{ + set_irq_line(10, state); +} + +WRITE_LINE_MEMBER( pcfx_state::irq11_w ) +{ + set_irq_line(11, state); +} + +WRITE_LINE_MEMBER( pcfx_state::irq12_w ) +{ + set_irq_line(12, state); +} + +WRITE_LINE_MEMBER( pcfx_state::irq13_w ) +{ + set_irq_line(13, state); +} + +WRITE_LINE_MEMBER( pcfx_state::irq14_w ) +{ + set_irq_line(14, state); +} + +WRITE_LINE_MEMBER( pcfx_state::irq15_w ) +{ + set_irq_line(15, state); +} + + +void pcfx_state::machine_reset() +{ + membank( "bank1" )->set_base( memregion("user1")->base() ); + + m_irq_mask = 0xFF; + m_irq_pending = 0; +} + + +UINT32 pcfx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_huc6261->video_update( bitmap, cliprect ); + return 0; +} + + +static MACHINE_CONFIG_START( pcfx, pcfx_state ) + MCFG_CPU_ADD( "maincpu", V810, XTAL_21_4772MHz ) + MCFG_CPU_PROGRAM_MAP( pcfx_mem) + MCFG_CPU_IO_MAP( pcfx_io) + + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_UPDATE_DRIVER(pcfx_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_21_4772MHz, HUC6261_WPF, 64, 64 + 1024 + 64, HUC6261_LPF, 18, 18 + 242) + + MCFG_DEVICE_ADD( "huc6270_a", HUC6270, 0 ) + MCFG_HUC6270_VRAM_SIZE(0x20000) + MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq12_w)) + + MCFG_DEVICE_ADD( "huc6270_b", HUC6270, 0 ) + MCFG_HUC6270_VRAM_SIZE(0x20000) + MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq14_w)) + + MCFG_DEVICE_ADD("huc6261", HUC6261, XTAL_21_4772MHz) + MCFG_HUC6261_VDC1("huc6270_a") + MCFG_HUC6261_VDC2("huc6270_b") + + MCFG_HUC6272_ADD( "huc6272", XTAL_21_4772MHz ) +MACHINE_CONFIG_END + + +ROM_START( pcfx ) + ROM_REGION( 0x100000, "user1", 0 ) + ROM_SYSTEM_BIOS( 0, "v100", "BIOS v1.00 - 2 Sep 1994" ) + ROMX_LOAD( "pcfxbios.bin", 0x000000, 0x100000, CRC(76ffb97a) SHA1(1a77fd83e337f906aecab27a1604db064cf10074), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v101", "BIOS v1.01 - 5 Dec 1994" ) + ROMX_LOAD( "pcfxv101.bin", 0x000000, 0x100000, CRC(236102c9) SHA1(8b662f7548078be52a871565e19511ccca28c5c8), ROM_BIOS(2) ) + + ROM_REGION( 0x80000, "scsi_rom", 0 ) + ROM_LOAD( "fx-scsi.rom", 0x00000, 0x80000, CRC(f3e60e5e) SHA1(65482a23ac5c10a6095aee1db5824cca54ead6e5) ) +ROM_END + + +ROM_START( pcfxga ) + ROM_REGION( 0x100000, "user1", 0 ) + ROM_LOAD( "pcfxga.rom", 0x000000, 0x100000, CRC(41c3776b) SHA1(a9372202a5db302064c994fcda9b24d29bb1b41c) ) + + ROM_REGION( 0x80000, "scsi_rom", ROMREGION_ERASEFF ) +ROM_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1994, pcfx, 0, 0, pcfx, pcfx, driver_device, 0, "Nippon Electronic Company", "PC-FX", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +CONS( 199?, pcfxga, pcfx, 0, pcfx, pcfx, driver_device, 0, "Nippon Electronic Company", "PC-FX/GA (PC ISA Card)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/pcm.c b/src/mame/drivers/pcm.c new file mode 100644 index 00000000000..ee4024b4b02 --- /dev/null +++ b/src/mame/drivers/pcm.c @@ -0,0 +1,330 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + PC/M by Miodrag Milanovic + + http://www.li-pro.net/pcm.phtml (in German) + + 12/05/2009 Preliminary driver. + + 14/02/2011 Added keyboard (from terminal). + + Commands: + 1 select memory bank 1 + 2 select memory bank 2 + B + C start cp/m from the inbuilt CCP + D Debugger + Fx Format disk A or B + G Jump to address + I List files on tape + L filename.typ Load file from tape + R read from disk + S filename aaaa / bbbb save a file to tape + V verify + W write to disk + X + Z set tape baud (1200, 2400, 3600 (default), 4800) + filename start running this .COM file + + Therefore if you enter random input, it will lock up while trying to + load up a file of that name. Filenames on disk and tape are of the + standard 8.3 format. You must specify an extension. + + Here is an example of starting the debugger, executing a command in + it, then exiting back to the monitor. + + D + U + E + + In practice, the I and R commands produce an error, while all disk + commands are directed to tape. The F command lists the files on a + tape. + + ToDo: + - Add bankswitching + - Add NMI generator + - Find out if there really is any floppy-disk feature - the schematic + has no mention of it. + - Add the 6 LEDs. + +****************************************************************************/ + +#include "emu.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "machine/k7659kb.h" + + +class pcm_state : public driver_device +{ +public: + pcm_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pio_s(*this, "z80pio_s"), + m_pio_u(*this, "z80pio_u"), + m_sio(*this, "z80sio"), + m_ctc_s(*this, "z80ctc_s"), + m_ctc_u(*this, "z80ctc_u"), + m_speaker(*this, "speaker"), + m_cass(*this, "cassette"), + m_p_videoram(*this, "videoram"){ } + + required_device m_maincpu; + required_device m_pio_s; + required_device m_pio_u; + required_device m_sio; + required_device m_ctc_s; + required_device m_ctc_u; + required_device m_speaker; + required_device m_cass; + DECLARE_READ8_MEMBER( pcm_85_r ); + DECLARE_WRITE_LINE_MEMBER( pcm_82_w ); + DECLARE_WRITE8_MEMBER( pcm_85_w ); + UINT8 *m_p_chargen; + bool m_cone; + required_shared_ptr m_p_videoram; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +private: + UINT8 m_85; +}; + + +WRITE_LINE_MEMBER( pcm_state::pcm_82_w ) +{ + if (state) + { + m_cone ^= 1; + m_speaker->level_w(m_cone); + } +} + + +/* PIO connections as far as i could decipher + +PortA is input and connects to the keyboard +PortB is mostly output and connects to a series of LEDs, + but also carries the cassette control & data lines. + +A0-A6 ascii codes from the keyboard +A7 strobe, high while a key is pressed +B0 power indicator LED +B1 Run/Stop LED +B2 Sound on/off LED +B3 n/c +B4 High=Save, Low=Load LED +B5 Motor On LED +B6 Save data +B7 Load data +There is also a HALT LED, connected directly to the processor. +*/ + + +READ8_MEMBER( pcm_state::pcm_85_r ) +{ + UINT8 data = m_85 & 0x7f; + + if ((m_cass)->input() > 0.03) + data |= 0x80; + + return data; +} + +WRITE8_MEMBER( pcm_state::pcm_85_w ) +{ + if (BIT(data, 5)) + m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + else + m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + + m_cass->output( BIT(data, 6) ? -1.0 : +1.0); + m_85 = data; +} + + + +static ADDRESS_MAP_START(pcm_mem, AS_PROGRAM, 8, pcm_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x1fff ) AM_ROM // ROM + AM_RANGE( 0x2000, 0xf7ff ) AM_RAM // RAM + AM_RANGE( 0xf800, 0xffff ) AM_RAM AM_SHARE("videoram") // Video RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pcm_io, AS_IO, 8, pcm_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80ctc_s", z80ctc_device, read, write) // system CTC + AM_RANGE(0x84, 0x87) AM_DEVREADWRITE("z80pio_s", z80pio_device, read, write) // system PIO + AM_RANGE(0x88, 0x8B) AM_DEVREADWRITE("z80sio", z80sio0_device, cd_ba_r, cd_ba_w) // SIO + AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE("z80ctc_u", z80ctc_device, read, write) // user CTC + AM_RANGE(0x90, 0x93) AM_DEVREADWRITE("z80pio_u", z80pio_device, read, write) // user PIO + //AM_RANGE(0x94, 0x97) // bank select + //AM_RANGE(0x98, 0x9B) // NMI generator + //AM_RANGE(0x9C, 0x9F) // io ports available to the user + // disk controller? +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pcm ) +INPUT_PORTS_END + +void pcm_state::machine_reset() +{ +} + +void pcm_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 pcm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0x400,x; + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x++) + { + chr = m_p_videoram[x]; + + gfx = m_p_chargen[(chr<<3) | ra]; + + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} + + +static const z80_daisy_config pcm_daisy_chain[] = +{ + { "z80ctc_s" }, /* System ctc */ + { "z80pio_s" }, /* System pio */ + { "z80sio" }, /* sio */ + { "z80pio_u" }, /* User pio */ + { "z80ctc_u" }, /* User ctc */ + { NULL } +}; + + +/* F4 Character Displayer */ +static const gfx_layout pcm_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( pcm ) + GFXDECODE_ENTRY( "chargen", 0x0000, pcm_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( pcm, pcm_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_10MHz /4) + MCFG_CPU_PROGRAM_MAP(pcm_mem) + MCFG_CPU_IO_MAP(pcm_io) + MCFG_CPU_CONFIG(pcm_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(pcm_state, screen_update) + MCFG_SCREEN_SIZE(64*8, 16*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pcm) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* Sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_K7659_KEYBOARD_ADD() + MCFG_CASSETTE_ADD("cassette") + + MCFG_DEVICE_ADD("z80pio_u", Z80PIO, XTAL_10MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80pio_s", Z80PIO, XTAL_10MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(DEVREAD8(K7659_KEYBOARD_TAG, k7659_keyboard_device, read)) + MCFG_Z80PIO_IN_PB_CB(READ8(pcm_state, pcm_85_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(pcm_state, pcm_85_w)) + + MCFG_Z80SIO0_ADD("z80sio", 4800, 0, 0, 0, 0) // clocks come from the system ctc + + MCFG_DEVICE_ADD("z80ctc_u", Z80CTC, XTAL_10MHz /4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80ctc_s", Z80CTC, XTAL_10MHz /4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + // ZC0 : SIO channel A clock + // ZC1 : SIO channel B clock + MCFG_Z80CTC_ZC2_CB(WRITELINE(pcm_state, pcm_82_w)) // speaker +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pcm ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v202", "Version 2.02" ) + ROMX_LOAD( "bios_v202.d14", 0x0000, 0x0800, CRC(27c24892) SHA1(a97bf9ef075de91330dc0c7cfd3bb6c7a88bb585), ROM_BIOS(1)) + ROMX_LOAD( "bios_v202.d15", 0x0800, 0x0800, CRC(e9cedc70) SHA1(913c526283d9289d0cb2157985bb48193df7aa16), ROM_BIOS(1)) + ROMX_LOAD( "bios_v202.d16", 0x1000, 0x0800, CRC(abe12001) SHA1(d8f0db6b141736d7715d588384fa49ab386bcc55), ROM_BIOS(1)) + ROMX_LOAD( "bios_v202.d17", 0x1800, 0x0800, CRC(2d48d1cc) SHA1(36a825140124dbe10d267fdf28b3eacec6f6d556), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v210", "Version 2.10" ) + ROMX_LOAD( "bios_v210.d14", 0x0000, 0x0800, CRC(45923112) SHA1(dde922533ebd0f6ac06d25b9786830ee3c7178b9), ROM_BIOS(2)) + ROMX_LOAD( "bios_v210.d15", 0x0800, 0x0800, CRC(e9cedc70) SHA1(913c526283d9289d0cb2157985bb48193df7aa16), ROM_BIOS(2)) + ROMX_LOAD( "bios_v210.d16", 0x1000, 0x0800, CRC(ee9ed77b) SHA1(12ea18e3e280f2a0657ff11c7bcdd658d325235c), ROM_BIOS(2)) + ROMX_LOAD( "bios_v210.d17", 0x1800, 0x0800, CRC(2d48d1cc) SHA1(36a825140124dbe10d267fdf28b3eacec6f6d556), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v330", "Version 3.30" ) + ROMX_LOAD( "bios_v330.d14", 0x0000, 0x0800, CRC(9bbfee10) SHA1(895002f2f4c711278f1e2d0e2a987e2d31472e4f), ROM_BIOS(3)) + ROMX_LOAD( "bios_v330.d15", 0x0800, 0x0800, CRC(4f8d5b40) SHA1(440b0be4cf45a5d450f9eb7684ceb809450585dc), ROM_BIOS(3)) + ROMX_LOAD( "bios_v330.d16", 0x1000, 0x0800, CRC(93fd0d91) SHA1(c8f1bbb63eca3c93560622581ecbb588716aeb91), ROM_BIOS(3)) + ROMX_LOAD( "bios_v330.d17", 0x1800, 0x0800, CRC(d8c7ce33) SHA1(9030d9a73ef1c12a31ac2cb9a593fb2a5097f24d), ROM_BIOS(3)) + + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD( "charrom.d113", 0x0000, 0x0800, CRC(5684b3c3) SHA1(418054aa70a0fd120611e32059eb2051d3b82b5a)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1988, pcm, 0, 0, pcm, pcm, driver_device, 0, "Mugler/Mathes", "PC/M", 0) diff --git a/src/mame/drivers/pcw.c b/src/mame/drivers/pcw.c new file mode 100644 index 00000000000..9af7f2fccd6 --- /dev/null +++ b/src/mame/drivers/pcw.c @@ -0,0 +1,1403 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/****************************************************************************** + + pcw.c + system driver + + Kevin Thacker [MESS driver] + + Thankyou to Jacob Nevins, Richard Fairhurst and Cliff Lawson, + for their documentation that I used for the development of this + driver. + + PCW came in 4 forms. + PCW8256, PCW8512, PCW9256, PCW9512 + + These systems were nicknamed "Joyce", apparently after a secretary who worked at + Amstrad plc. + + These machines were designed for wordprocessing and other business applications. + + The computer came with Locoscript (wordprocessor by Locomotive Software Ltd), + and CP/M+ (3.1). + + The original PCW8256 system came with a keyboard, green-screen monitor + (which had 2 3" 80 track, double sided disc drives mounted vertically in it), + and a dedicated printer. The other systems had different design but shared the + same hardware. + + Since it was primarily designed as a wordprocessor, there were not many games + written. + Some of the games available: + - Head Over Heels + - Infocom adventures (Hitchhikers Guide to the Galaxy etc) + + However, it can use the CP/M OS, there is a large variety of CPM software that will + run on it!!!!!!!!!!!!!! + + Later systems had: + - black/white monitor, + - dedicated printer was removed, and support for any printer was added + - 3" internal drive replaced by a 3.5" drive + + All the logic for the system, except the FDC was found in a Amstrad designed custom + chip. + + In the original PCW8256, there was no boot-rom. A boot-program was stored in the printer + chip, and this was activated when the PCW was first switched on. AFAIK there are no + dumps of this program, so I have written my own replacement. + + The boot-program performs a simple task: Load sector 0, track 0 to &f000 in ram, and execute + &f010. + + From here CP/M is booted, and the appropiate programs can be run. + + The hardware: + - Z80 CPU running at 3.4 MHz + - UPD765 FDC + - mono display + - beep (a fixed Hz tone which can be turned on/off) + - 720x256 (PAL) bitmapped display, 720x200 (NTSC) bitmapped display + - Amstrad CPC6128 style keyboard + + If there are special roms for any of the PCW series I would be interested in them + so I can implement the driver properly. + + From comp.sys.amstrad.8bit FAQ: + + "Amstrad made the following PCW systems : + + - 1) PCW8256 + - 2) PCW8512 + - 3) PCW9512 + - 4) PCW9512+ + - 5) PcW10 + - 6) PcW16 + + 1 had 180K drives, 2 had a 180K A drive and a 720K B drive, 3 had only + 720K drives. All subsequent models had 3.5" disks using CP/M format at + 720K until 6 when it switched to 1.44MB in MS-DOS format. The + of + model 4 was that it had a "real" parallel interface so could be sold + with an external printer such as the Canon BJ10. The PcW10 wasn't + really anything more than 4 in a more modern looking case. + + The PcW16 is a radical digression who's sole "raison d'etre" was to + make a true WYSIWYG product but this meant a change in the screen and + processor (to 16MHz) etc. which meant that it could not be kept + compatible with the previous models (though documents ARE compatible)" + + + TODO: + - Printer hardware emulation (8256 etc) + - Parallel port emulation (9512, 9512+, 10) + - emulation of serial hardware + - emulation of other hardware...? + ******************************************************************************/ +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/i8243.h" +// upd765 interface +#include "machine/upd765.h" +// pcw video hardware +#include "includes/pcw.h" +// pcw/pcw16 beeper +#include "sound/beep.h" +#include "machine/ram.h" + +#include "pcw.lh" + +#define VERBOSE 1 +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +static const UINT8 half_step_table[4] = { 0x01, 0x02, 0x04, 0x08 }; +static const UINT8 full_step_table[4] = { 0x03, 0x06, 0x0c, 0x09 }; + +void pcw_state::pcw_update_interrupt_counter() +{ + /* never increments past 15! */ + if (m_interrupt_counter==0x0f) + return; + + /* increment count */ + m_interrupt_counter++; +} + + +// set/reset INT and NMI lines +void pcw_state::pcw_update_irqs() +{ + // set NMI line, remains set until FDC interrupt type is changed + if(m_nmi_flag != 0) + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + else + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + + // set IRQ line, timer pulses IRQ line, all other devices hold it as necessary + if(m_fdc_interrupt_code == 1 && (m_system_status & 0x20)) + { + m_maincpu->set_input_line(0, ASSERT_LINE); + return; + } + + if(m_timer_irq_flag != 0) + { + m_maincpu->set_input_line(0, ASSERT_LINE); + return; + } + + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +TIMER_CALLBACK_MEMBER(pcw_state::pcw_timer_pulse) +{ + m_timer_irq_flag = 0; + pcw_update_irqs(); +} + +/* callback for 1/300ths of a second interrupt */ +TIMER_DEVICE_CALLBACK_MEMBER(pcw_state::pcw_timer_interrupt) +{ + pcw_update_interrupt_counter(); + + m_timer_irq_flag = 1; + pcw_update_irqs(); + machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(pcw_state::pcw_timer_pulse),this)); +} + +/* PCW uses UPD765 in NON-DMA mode. FDC Ints are connected to /INT or + * /NMI depending on choice (see system control below) + * fdc interrupt callback. set/clear fdc int */ +WRITE_LINE_MEMBER( pcw_state::pcw_fdc_interrupt ) +{ + if (!state) + m_system_status &= ~(1<<5); + else + { + m_system_status |= (1<<5); + if(m_fdc_interrupt_code == 0) // NMI is held until interrupt type is changed + m_nmi_flag = 1; + } +} + + +/* Memory is banked in 16k blocks. + + The upper 16 bytes of block 3, contains the keyboard + state. This is updated by the hardware. + + block 3 could be paged into any bank, and this explains the + setup of the memory below. +*/ +static ADDRESS_MAP_START(pcw_map, AS_PROGRAM, 8, pcw_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank5") + AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank6") + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank7") + AM_RANGE(0xc000, 0xffff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank8") +ADDRESS_MAP_END + + +/* Keyboard is read by the MCU and sent as serial data to the gate array ASIC */ +READ8_MEMBER(pcw_state::pcw_keyboard_r) +{ + static const char *const keynames[] = { + "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", + "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15" + }; + + return ioport(keynames[offset])->read(); +} + +READ8_MEMBER(pcw_state::pcw_keyboard_data_r) +{ + return m_mcu_keyboard_data[offset]; +} + +/* ----------------------------------------------------------------------- + * PCW Banking + * ----------------------------------------------------------------------- */ + +void pcw_state::pcw_update_read_memory_block(int block, int bank) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + char block_name[10]; + + sprintf(block_name,"bank%d",block+1); + /* bank 3? */ + if (bank == 3) + { + /* when upper 16 bytes are accessed use keyboard read + handler */ + space.install_read_handler( + block * 0x04000 + 0x3ff0, block * 0x04000 + 0x3fff, read8_delegate(FUNC(pcw_state::pcw_keyboard_data_r),this)); +// LOG(("MEM: read block %i -> bank %i\n",block,bank)); + } + else + { + /* restore bank handler across entire block */ + space.install_read_bank(block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff,block_name); +// LOG(("MEM: read block %i -> bank %i\n",block,bank)); + } + membank(block_name)->set_base(m_ram->pointer() + ((bank * 0x4000) % m_ram->size())); +} + + + +void pcw_state::pcw_update_write_memory_block(int block, int bank) +{ + char block_name[10]; + + sprintf(block_name,"bank%d",block+5); + membank(block_name)->set_base(m_ram->pointer() + ((bank * 0x4000) % m_ram->size())); +// LOG(("MEM: write block %i -> bank %i\n",block,bank)); +} + + +/* ----------------------------------------------------------------------- */ + +/* &F4 O b7-b4: when set, force memory reads to access the same bank as +writes for &C000, &0000, &8000, and &4000 respectively */ + +void pcw_state::pcw_update_mem(int block, int data) +{ + /* expansion ram select. + if block is 0-7, selects internal ram instead for read/write + */ + if (data & 0x080) + { + int bank; + + /* same bank for reading and writing */ + bank = data & 0x7f; + + pcw_update_read_memory_block(block, bank); + pcw_update_write_memory_block(block, bank); + } + else + { + /* specify a different bank for reading and writing */ + int write_bank; + int read_bank; + int mask=0; + + switch (block) + { + case 0: + { + mask = (1<<6); + } + break; + + case 1: + { + mask = (1<<4); + } + break; + + case 2: + { + mask = (1<<5); + } + break; + + case 3: + { + mask = (1<<7); + } + break; + } + + if (m_bank_force & mask) + { + read_bank = data & 0x07; + } + else + { + read_bank = (data>>4) & 0x07; + } + + pcw_update_read_memory_block(block, read_bank); + + write_bank = data & 0x07; + pcw_update_write_memory_block(block, write_bank); + } + + /* if boot is active, page in fake ROM */ +/* if ((m_boot) && (block==0)) + { + unsigned char *FakeROM; + + FakeROM = &memregion("maincpu")->base()[0x010000]; + + membank("bank1")->set_base(FakeROM); + }*/ +} + +/* from Jacob Nevins docs */ +int pcw_state::pcw_get_sys_status() +{ + return + m_interrupt_counter + | (m_screen->vblank() ? 0x40 : 0x00) + | (ioport("EXTRA")->read() & 0x010) + | (m_system_status & 0x20); +} + +READ8_MEMBER(pcw_state::pcw_interrupt_counter_r) +{ + int data; + + /* from Jacob Nevins docs */ + + /* get data */ + data = pcw_get_sys_status(); + /* clear int counter */ + m_interrupt_counter = 0; + /* check interrupts */ + pcw_update_irqs(); + /* return data */ + //LOG(("SYS: IRQ counter read, returning %02x\n",data)); + return data; +} + + +WRITE8_MEMBER(pcw_state::pcw_bank_select_w) +{ + //LOG(("BANK: %2x %x\n",offset, data)); + m_banks[offset] = data; + + pcw_update_mem(offset, data); +// popmessage("RAM Banks: %02x %02x %02x %02x Lock:%02x",m_banks[0],m_banks[1],m_banks[2],m_banks[3],m_bank_force); +} + +WRITE8_MEMBER(pcw_state::pcw_bank_force_selection_w) +{ + m_bank_force = data; + + pcw_update_mem(0, m_banks[0]); + pcw_update_mem(1, m_banks[1]); + pcw_update_mem(2, m_banks[2]); + pcw_update_mem(3, m_banks[3]); +} + + +WRITE8_MEMBER(pcw_state::pcw_roller_ram_addr_w) +{ + /* + Address of roller RAM. b7-5: bank (0-7). b4-1: address / 512. */ + + m_roller_ram_addr = (((data>>5) & 0x07)<<14) | + ((data & 0x01f)<<9); + LOG(("Roller-RAM: Address set to 0x%05x\n",m_roller_ram_addr)); +} + +WRITE8_MEMBER(pcw_state::pcw_pointer_table_top_scan_w) +{ + m_roller_ram_offset = data; + LOG(("Roller-RAM: offset set to 0x%05x\n",m_roller_ram_offset)); +} + +WRITE8_MEMBER(pcw_state::pcw_vdu_video_control_register_w) +{ + m_vdu_video_control_register = data; + LOG(("Roller-RAM: control reg set to 0x%02x\n",data)); +} + +WRITE8_MEMBER(pcw_state::pcw_system_control_w) +{ + upd765a_device *fdc = machine().device("upd765"); + LOG(("SYSTEM CONTROL: %d\n",data)); + + switch (data) + { + /* end bootstrap */ + case 0: + { + m_boot = 0; + pcw_update_mem(0, m_banks[0]); + } + break; + + /* reboot */ + case 1: + { + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + popmessage("SYS: Reboot"); + } + break; + + /* connect fdc interrupt to nmi */ + case 2: + { + int fdc_previous_interrupt_code = m_fdc_interrupt_code; + + m_fdc_interrupt_code = 0; + + /* previously connected to INT? */ + if (fdc_previous_interrupt_code == 1) + { + /* yes */ + + pcw_update_irqs(); + } + + } + break; + + + /* connect fdc interrupt to interrupt */ + case 3: + { + int fdc_previous_interrupt_code = m_fdc_interrupt_code; + + /* connect to INT */ + m_fdc_interrupt_code = 1; + + /* previously connected to NMI? */ + if (fdc_previous_interrupt_code == 0) + { + /* yes */ + + /* clear nmi interrupt */ + m_nmi_flag = 0; + } + + /* re-issue interrupt */ + pcw_update_irqs(); + } + break; + + + /* connect fdc interrupt to neither */ + case 4: + { + int fdc_previous_interrupt_code = m_fdc_interrupt_code; + + m_fdc_interrupt_code = 2; + + /* previously connected to NMI or INT? */ + if ((fdc_previous_interrupt_code == 0) || (fdc_previous_interrupt_code == 1)) + { + /* yes */ + + /* Clear NMI */ + m_nmi_flag = 0; + } + pcw_update_irqs(); + + } + break; + + /* set fdc terminal count */ + case 5: + { + fdc->tc_w(true); + } + break; + + /* clear fdc terminal count */ + case 6: + { + fdc->tc_w(false); + } + break; + + /* screen on */ + case 7: + { + } + break; + + /* screen off */ + case 8: + { + } + break; + + /* disc motor on */ + case 9: + { + floppy_image_device *floppy; + floppy = machine().device(":upd765:0")->get_device(); + if(floppy) + floppy->mon_w(0); + floppy = machine().device(":upd765:1")->get_device(); + if(floppy) + floppy->mon_w(0); + } + break; + + /* disc motor off */ + case 10: + { + floppy_image_device *floppy; + floppy = machine().device(":upd765:0")->get_device(); + if(floppy) + floppy->mon_w(1); + floppy = machine().device(":upd765:1")->get_device(); + if(floppy) + floppy->mon_w(1); + } + break; + + /* beep on */ + case 11: + { + m_beeper->set_state(1); + } + break; + + /* beep off */ + case 12: + { + m_beeper->set_state(0); + } + break; + + } +} + +READ8_MEMBER(pcw_state::pcw_system_status_r) +{ + /* from Jacob Nevins docs */ + UINT8 ret = pcw_get_sys_status(); + + return ret; +} + +/* read from expansion hardware - additional hardware not part of +the PCW custom ASIC */ +READ8_MEMBER(pcw_state::pcw_expansion_r) +{ + logerror("pcw expansion r: %04x\n",offset+0x080); + + switch (offset+0x080) + { + case 0x0e0: + { + /* spectravideo joystick */ + if (ioport("EXTRA")->read() & 0x020) + { + return ioport("SPECTRAVIDEO")->read(); + } + else + { + return 0x0ff; + } + } + + case 0x09f: + { + /* kempston joystick */ + return ioport("KEMPSTON")->read(); + } + + case 0x0e1: + case 0x0e3: + { + return 0x7f; + } + + case 0x085: + { + return 0x0fe; + } + + case 0x087: + { + return 0x0ff; + } + + } + + /* result from floating bus/no peripherial at this port */ + return 0x0ff; +} + +/* write to expansion hardware - additional hardware not part of +the PCW custom ASIC */ +WRITE8_MEMBER(pcw_state::pcw_expansion_w) +{ + logerror("pcw expansion w: %04x %02x\n",offset+0x080, data); +} + +void pcw_state::pcw_printer_fire_pins(UINT16 pins) +{ + int x,line; + INT32 feed = (m_paper_feed / 2); + + for(x=feed+PCW_PRINTER_HEIGHT-16;xpix16(line, m_printer_headpos) = (UINT16)(pins & 0x01); + pins >>= 1; + } +// if(m_printer_headpos < PCW_PRINTER_WIDTH) +// m_printer_headpos++; +} + +WRITE8_MEMBER(pcw_state::pcw_printer_data_w) +{ + m_printer_data = data; + machine().device("printer_mcu")->upi41_master_w(space,0,data); + logerror("PRN [0xFC]: Sent command %02x\n",data); +} + +WRITE8_MEMBER(pcw_state::pcw_printer_command_w) +{ + m_printer_command = data; + machine().device("printer_mcu")->upi41_master_w(space,1,data); + logerror("PRN [0xFD]: Sent command %02x\n",data); +} + +// print error type +// should return 0xF8 if there are no errors +// 0 = underrun +// 1 = printer controller RAM fault +// 3 = bad command +// 5 = print error +// anything else = no printer +READ8_MEMBER(pcw_state::pcw_printer_data_r) +{ + return machine().device("printer_mcu")->upi41_master_r(space,0); +} + +// printer status +// bit 7 - bail bar in +// bit 6 - not currently executing a command +// bit 5 - printer RAM is full +// bit 4 - print head is not at left margin +// bit 3 - sheet feeder is present +// bit 2 - paper is present +// bit 1 - busy +// bit 0 - controller fault +READ8_MEMBER(pcw_state::pcw_printer_status_r) +{ + return machine().device("printer_mcu")->upi41_master_r(space,1); +} + +/* MCU handlers */ +/* I/O ports: (likely to be completely wrong...) + * (write) + * all are active low + * P1: pins 0-7 + * P2 bit 0: pin 8 + * P2 bit 1: serial shift/store clock + * P2 bit 2: serial shift store data + * P2 bit 3: serial shift/store strobe + * P2 bit 4: print head motor + * P2 bit 5: paper feed motor + * P2 bit 6: fire pins + * (read) + * P2 bit 7: bail bar status (0 if out) + * T0: Paper sensor (?) + * T1: Print head location (1 if not at left margin) + */ +TIMER_CALLBACK_MEMBER(pcw_state::pcw_stepper_callback) +{ + //popmessage("PRN: P2 bits %s %s %s\nSerial: %02x\nHeadpos: %i",m_printer_p2 & 0x40 ? " " : "6",m_printer_p2 & 0x20 ? " " : "5",m_printer_p2 & 0x10 ? " " : "4",m_printer_shift_output,m_printer_headpos); + if((m_printer_p2 & 0x10) == 0) // print head motor active + { + UINT8 stepper_state = (m_printer_shift_output >> 4) & 0x0f; + if(stepper_state == full_step_table[(m_head_motor_state + 1) & 0x03]) + { + m_printer_headpos += 2; + m_head_motor_state++; + logerror("Printer head moved forward by 2 to %i\n",m_printer_headpos); + } + if(stepper_state == half_step_table[(m_head_motor_state + 1) & 0x03]) + { + m_printer_headpos += 1; + m_head_motor_state++; + logerror("Printer head moved forward by 1 to %i\n",m_printer_headpos); + } + if(stepper_state == full_step_table[(m_head_motor_state - 1) & 0x03]) + { + m_printer_headpos -= 2; + m_head_motor_state--; + logerror("Printer head moved back by 2 to %i\n",m_printer_headpos); + } + if(stepper_state == half_step_table[(m_head_motor_state - 1) & 0x03]) + { + m_printer_headpos -= 1; + m_head_motor_state--; + logerror("Printer head moved back by 1 to %i\n",m_printer_headpos); + } + if(m_printer_headpos < 0) + m_printer_headpos = 0; + if(m_printer_headpos > PCW_PRINTER_WIDTH) + m_printer_headpos = PCW_PRINTER_WIDTH; + m_head_motor_state &= 0x03; + m_printer_p2 |= 0x10; + } + if((m_printer_p2 & 0x20) == 0) // line feed motor active + { + UINT8 stepper_state = m_printer_shift_output & 0x0f; + if(stepper_state == full_step_table[(m_linefeed_motor_state + 1) & 0x03]) + { + m_paper_feed++; + if(m_paper_feed > PCW_PRINTER_HEIGHT*2) + m_paper_feed = 0; + m_linefeed_motor_state++; + } + if(stepper_state == half_step_table[(m_linefeed_motor_state + 1) & 0x03]) + { + m_paper_feed++; + if(m_paper_feed > PCW_PRINTER_HEIGHT*2) + m_paper_feed = 0; + m_linefeed_motor_state++; + } + m_linefeed_motor_state &= 0x03; + m_printer_p2 |= 0x20; + } +} + +TIMER_CALLBACK_MEMBER(pcw_state::pcw_pins_callback) +{ + pcw_printer_fire_pins(m_printer_pins); + m_printer_p2 |= 0x40; +} + +READ8_MEMBER(pcw_state::mcu_printer_p1_r) +{ +// logerror("PRN: MCU reading data from P1\n"); + return m_printer_pins & 0x00ff; +} + +WRITE8_MEMBER(pcw_state::mcu_printer_p1_w) +{ + m_printer_pins = (m_printer_pins & 0x0100) | data; + //popmessage("PRN: Print head position = %i",m_printer_headpos); + logerror("PRN: MCU writing %02x to P1 [%03x/%03x]\n",data,m_printer_pins,~m_printer_pins & 0x1ff); +} + +READ8_MEMBER(pcw_state::mcu_printer_p2_r) +{ + UINT8 ret = 0x00; +// logerror("PRN: MCU reading data from P2\n"); + ret |= 0x80; // make sure bail bar is in + ret |= (m_printer_p2 & 0x70); + ret |= (m_printer_pins & 0x100) ? 0x01 : 0x00; // ninth pin + ret |= 0x0e; + return ret; +} + +WRITE8_MEMBER(pcw_state::mcu_printer_p2_w) +{ + //logerror("PRN: MCU writing %02x to P2\n",data); + m_printer_p2 = data & 0x70; + + // handle shift/store + m_printer_serial = data & 0x04; // data + if((data & 0x02) != 0) // clock + { + m_printer_shift <<= 1; + if(m_printer_serial == 0) + m_printer_shift &= ~0x01; + else + m_printer_shift |= 0x01; + } + if((data & 0x08) != 0) // strobe + { + logerror("Strobe active [%02x]\n",m_printer_shift); + m_printer_shift_output = m_printer_shift; + m_prn_stepper->adjust(PERIOD_OF_555_MONOSTABLE(22000,0.00000001)); + } + + if(data & 0x40) + m_prn_pins->adjust(PERIOD_OF_555_MONOSTABLE(22000,0.0000000068)); + + if(data & 0x01) + m_printer_pins |= 0x0100; + else + m_printer_pins &= ~0x0100; + m_printer_p2_prev = data; +} + +// Paper sensor +READ8_MEMBER(pcw_state::mcu_printer_t1_r) +{ + return 1; +} + +// Print head location (0 if at left margin, otherwise 1) +READ8_MEMBER(pcw_state::mcu_printer_t0_r) +{ + if(m_printer_headpos == 0) + return 0; + else + return 1; +} + +/* + * Keyboard MCU (i8048) + * P1 = keyboard scan row select (low 8 bits) + * P2 = bits 7-4: keyboard scan row select (high 4 bits) + * bit 1: keyboard serial clock + * bit 0: keyboard serial data + */ +void pcw_state::mcu_transmit_serial(UINT8 bit) +{ + int seq; + + /* Keyboard data is sent in serial from the MCU through the keyboard port, to the ASIC + Sends a string of 12-bit sequences, first 4 bits are the RAM location (from &3ff0), + then 8 bits for the data to be written there. */ + seq = m_mcu_transmit_count % 12; + if(seq < 4) + { + if(bit == 0) + m_mcu_selected &= ~(8 >> seq); + else + m_mcu_selected |= (8 >> seq); + } + else + { + seq -= 4; + if(bit == 0) + m_mcu_buffer &= ~(128 >> seq); + else + m_mcu_buffer |= (128 >> seq); + } + m_mcu_transmit_count++; + if(m_mcu_transmit_count >= 12) + { + m_mcu_keyboard_data[m_mcu_selected] = m_mcu_buffer; + m_mcu_transmit_count = 0; + } +} + +READ8_MEMBER(pcw_state::mcu_kb_scan_r) +{ + return m_kb_scan_row & 0xff; +} + +WRITE8_MEMBER(pcw_state::mcu_kb_scan_w) +{ + m_kb_scan_row = (m_kb_scan_row & 0xff00) | data; +} + +READ8_MEMBER(pcw_state::mcu_kb_scan_high_r) +{ + return (m_kb_scan_row & 0xff00) >> 8; +} + +WRITE8_MEMBER(pcw_state::mcu_kb_scan_high_w) +{ + if((m_mcu_prev & 0x02) && !(data & 0x02)) // bit is transmitted on high-to-low clock transition + { + mcu_transmit_serial(data & 0x01); + m_mcu_transmit_reset_seq = 0; + } + + if((m_mcu_prev & 0x01) != (data & 0x01)) // two high->low transitions on the data pin signals the beginning of a new transfer + { + m_mcu_transmit_reset_seq++; + if(m_mcu_transmit_reset_seq > 3) + m_mcu_transmit_count = 0; + } + + m_kb_scan_row = (m_kb_scan_row & 0x00ff) | ((data & 0xff) << 8); + m_mcu_prev = data; +} + +READ8_MEMBER(pcw_state::mcu_kb_data_r) +{ + UINT16 scan_bits = ((m_kb_scan_row & 0xf000) >> 4) | (m_kb_scan_row & 0xff); + int x; + + for(x=0;x<12;x++) + { + if(!(scan_bits & 1)) + return pcw_keyboard_r(space,x); + else + scan_bits >>= 1; + } + return 0xff; +} + +READ8_MEMBER(pcw_state::mcu_kb_t1_r) +{ + return 1; +} + +READ8_MEMBER(pcw_state::mcu_kb_t0_r) +{ + return 0; +} + +/* TODO: Implement parallel port! */ +READ8_MEMBER(pcw_state::pcw9512_parallel_r) +{ + if (offset==1) + { + return 0xff^0x020; + } + + logerror("pcw9512 parallel r: offs: %04x\n", (int) offset); + return 0x00; +} + +/* TODO: Implement parallel port! */ +WRITE8_MEMBER(pcw_state::pcw9512_parallel_w) +{ + logerror("pcw9512 parallel w: offs: %04x data: %02x\n",offset,data); +} + +static ADDRESS_MAP_START(pcw_io, AS_IO, 8, pcw_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x000, 0x001) AM_MIRROR(0x7e) AM_DEVICE("upd765", upd765a_device, map) + AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r, pcw_expansion_w) + AM_RANGE(0x0f0, 0x0f3) AM_WRITE( pcw_bank_select_w) + AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) + AM_RANGE(0x0f5, 0x0f5) AM_WRITE( pcw_roller_ram_addr_w) + AM_RANGE(0x0f6, 0x0f6) AM_WRITE( pcw_pointer_table_top_scan_w) + AM_RANGE(0x0f7, 0x0f7) AM_WRITE( pcw_vdu_video_control_register_w) + AM_RANGE(0x0f8, 0x0f8) AM_READWRITE(pcw_system_status_r, pcw_system_control_w) + AM_RANGE(0x0fc, 0x0fc) AM_READWRITE(pcw_printer_data_r, pcw_printer_data_w) + AM_RANGE(0x0fd, 0x0fd) AM_READWRITE(pcw_printer_status_r, pcw_printer_command_w) +ADDRESS_MAP_END + + + +static ADDRESS_MAP_START(pcw9512_io, AS_IO, 8, pcw_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x000, 0x001) AM_MIRROR(0x7e) AM_DEVICE("upd765", upd765a_device, map) + AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r, pcw_expansion_w) + AM_RANGE(0x0f0, 0x0f3) AM_WRITE( pcw_bank_select_w) + AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) + AM_RANGE(0x0f5, 0x0f5) AM_WRITE( pcw_roller_ram_addr_w) + AM_RANGE(0x0f6, 0x0f6) AM_WRITE( pcw_pointer_table_top_scan_w) + AM_RANGE(0x0f7, 0x0f7) AM_WRITE( pcw_vdu_video_control_register_w) + AM_RANGE(0x0f8, 0x0f8) AM_READWRITE(pcw_system_status_r, pcw_system_control_w) + AM_RANGE(0x0fc, 0x0fd) AM_READWRITE(pcw9512_parallel_r, pcw9512_parallel_w) +ADDRESS_MAP_END + +/* i8041 MCU */ +static ADDRESS_MAP_START(pcw_printer_io, AS_IO, 8, pcw_state ) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu_printer_p2_r,mcu_printer_p2_w) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(mcu_printer_p1_r, mcu_printer_p1_w) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(mcu_printer_t1_r) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(mcu_printer_t0_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pcw_keyboard_io, AS_IO, 8, pcw_state ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(mcu_kb_scan_r,mcu_kb_scan_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu_kb_scan_high_r,mcu_kb_scan_high_w) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(mcu_kb_t1_r) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(mcu_kb_t0_r) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(mcu_kb_data_r) +ADDRESS_MAP_END + + +TIMER_CALLBACK_MEMBER(pcw_state::setup_beep) +{ + m_beeper->set_state(0); + m_beeper->set_frequency(3750); +} + + +void pcw_state::machine_start() +{ + m_fdc_interrupt_code = 2; +} + +void pcw_state::machine_reset() +{ + UINT8* code = memregion("printer_mcu")->base(); + int x; + /* ram paging is actually undefined at power-on */ + + m_bank_force = 0xf0; // banks are locked for CPC-style paging - Batman expects this + + m_banks[0] = 0x80; + m_banks[1] = 0x81; + m_banks[2] = 0x82; + m_banks[3] = 0x83; + + pcw_update_mem(0, m_banks[0]); + pcw_update_mem(1, m_banks[1]); + pcw_update_mem(2, m_banks[2]); + pcw_update_mem(3, m_banks[3]); + + m_boot = 0; // System starts up in bootstrap mode, disabled until it's possible to emulate it. + + /* copy boot code into RAM - yes, it's skipping a step */ + memset(m_ram->pointer(),0x00,m_ram->size()); + for(x=0;x<256;x++) + m_ram->pointer()[x+2] = code[x+0x300]; + + /* and hack our way past the MCU side of the boot process */ + code[0x01] = 0x40; + + m_printer_status = 0xff; + m_printer_command = 0xff; + m_printer_data = 0x00; + m_printer_headpos = 0x00; // bring printer head to left margin + m_printer_shift = 0; + m_printer_shift_output = 0; +} + +DRIVER_INIT_MEMBER(pcw_state,pcw) +{ + m_maincpu->set_input_line_vector(0, 0x0ff); + + /* lower 4 bits are interrupt counter */ + m_system_status = 0x000; + m_system_status &= ~((1<<6) | (1<<5) | (1<<4)); + + m_interrupt_counter = 0; + + m_roller_ram_offset = 0; + + /* timer interrupt */ + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(pcw_state::setup_beep),this)); + + m_prn_stepper = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_stepper_callback),this)); + m_prn_pins = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_pins_callback),this)); +} + + +/* +b7: k2 k1 [+] . , space V X Z del< alt +b6: k3 k5 1/2 / M N B C lock k. +b5: k6 k4 shift ; K J F D A enter +b4: k9 k8 k7 ?? L H G S tab f8 +b3: paste copy # P I Y T W Q [-] +b2: f2 cut return [ O U R E stop can +b1: k0 ptr ] - 9 7 5 3 2 extra +b0: f4 exit del> = 0 8 6 4 1 f6 + &3FF0 &3FF1 &3FF2 &3FF3 &3FF4 &3FF5 &3FF6 &3FF7 &3FF8 &3FF9 &3FFA + +2008-05 FP: +Small note about atural keyboard: currently, +- "Paste" is mapped to 'F9' +- "Exit" is mapped to 'F10' +- "Ptr" is mapped to 'Print Screen' +- "Cut" is mapped to 'F11' +- "Copy" is mapped to 'F12' +- "Stop" is mapped to 'Esc' +- [+] is mapped to 'Page Up' +- [-] is mapped to 'Page Down' +- "Extra" is mapped to 'Home' +- "Can" is mapped to 'Insert' +*/ + +static INPUT_PORTS_START(pcw) + /* keyboard "ports". These are poked automatically into the PCW address space */ + + PORT_START("LINE0") /* 0x03ff0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F4") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F2") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Paste") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + + PORT_START("LINE1") /* 0x03ff1 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Exit") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ptr") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cut") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("LINE2") /* 0x03ff2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL>") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('#') PORT_CHAR('>') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, 0xff, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[+]") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) // 1st key on the left from 'Spacebar' + + PORT_START("LINE3") /* 0x03ff3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\xA7') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + + PORT_START("LINE4") /* 0x03ff4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + + PORT_START("LINE5") /* 0x03ff5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE6") /* 0x03ff6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("LINE7") /* 0x03ff7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("LINE8") /* 0x03ff8 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("LINE9") /* 0x03ff9 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F6") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Extra") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Can") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[-]") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) // 1st key on the right from 'Spacebar' + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7 F8") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL<") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_START("LINE10") /* 0x03ffa */ + PORT_BIT(0x07f,0x7f, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + + /* at this point the following reflect the above key combinations but in a incomplete + way. No details available at this time */ + PORT_START("LINE11") /* 0x03ffb */ + PORT_BIT(0xff, 0xff, IPT_UNUSED) + + PORT_START("LINE12") /* 0x03ffc */ + PORT_BIT(0xff, 0xff, IPT_UNUSED) + + /* 2008-05 FP: not sure if this key is correct, "Caps Lock" is already mapped above. + For now, I let it with no default mapping. */ + PORT_START("LINE13") /* 0x03ffd */ + PORT_BIT(0xff, 0xff, IPT_UNUSED) +// PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") //PORT_CODE(KEYCODE_CAPSLOCK) +// PORT_BIT(0x80, 0xff, IPT_UNUSED) + + PORT_START("LINE14") /* 0x03ffe */ + PORT_BIT ( 0xff, 0xff, IPT_UNUSED ) + + PORT_START("LINE15") /* 0x03fff */ + PORT_BIT ( 0xff, 0xff, IPT_UNUSED ) + + /* from here on are the pretend dipswitches for machine config etc */ + PORT_START("EXTRA") + /* frame rate option */ + PORT_DIPNAME( 0x10, 0x010, "50/60Hz Frame Rate Option") + PORT_DIPSETTING( 0x00, "60Hz") + PORT_DIPSETTING( 0x10, "50Hz" ) + /* spectravideo joystick enabled */ + PORT_DIPNAME( 0x20, 0x020, "Spectravideo Joystick Enabled") + PORT_DIPSETTING( 0x00, DEF_STR(No)) + PORT_DIPSETTING( 0x20, DEF_STR(Yes) ) + + /* Spectravideo joystick */ + /* bit 7: 0 + 6: 1 + 5: 1 + 4: 1 if in E position + 3: 1 if N + 2: 1 if W + 1: 1 if fire pressed + 0: 1 if S + */ + + PORT_START("SPECTRAVIDEO") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_BUTTON1) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) + PORT_BIT(0x020, 0x020, IPT_UNUSED) + PORT_BIT(0x040, 0x040, IPT_UNUSED) + PORT_BIT(0x080, 0x00, IPT_UNUSED) + + /* Kempston joystick */ + PORT_START("KEMPSTON") + PORT_BIT( 0xff, 0x00, IPT_UNUSED) +INPUT_PORTS_END + +static SLOT_INTERFACE_START( pcw_floppies ) + SLOT_INTERFACE( "3dsdd", FLOPPY_3_DSDD ) +SLOT_INTERFACE_END + +/* PCW8256, PCW8512, PCW9256 */ +static MACHINE_CONFIG_START( pcw, pcw_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 4000000) /* clock supplied to chip, but in reality it is 3.4 MHz */ + MCFG_CPU_PROGRAM_MAP(pcw_map) + MCFG_CPU_IO_MAP(pcw_io) + + MCFG_CPU_ADD("printer_mcu", I8041, 11000000) // 11MHz + MCFG_CPU_IO_MAP(pcw_printer_io) + + MCFG_CPU_ADD("keyboard_mcu", I8048, 5000000) // 5MHz + MCFG_CPU_IO_MAP(pcw_keyboard_io) + +// MCFG_QUANTUM_TIME(attotime::from_hz(50)) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(PCW_SCREEN_WIDTH, PCW_SCREEN_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, PCW_SCREEN_WIDTH-1, 0, PCW_SCREEN_HEIGHT-1) + MCFG_SCREEN_UPDATE_DRIVER(pcw_state, screen_update_pcw) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", PCW_NUM_COLOURS) + MCFG_PALETTE_INIT_OWNER(pcw_state, pcw) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pcw_state, pcw_fdc_interrupt)) + + MCFG_FLOPPY_DRIVE_ADD("upd765:0", pcw_floppies, "3dsdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", pcw_floppies, "3dsdd", floppy_image_device::default_floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("disk_list","pcw") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("pcw_timer", pcw_state, pcw_timer_interrupt, attotime::from_hz(300)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pcw8256, pcw ) + MCFG_SCREEN_ADD("printer",RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE( PCW_PRINTER_WIDTH, PCW_PRINTER_HEIGHT ) + MCFG_SCREEN_VISIBLE_AREA(0, PCW_PRINTER_WIDTH-1, 0, PCW_PRINTER_HEIGHT-1) + MCFG_SCREEN_UPDATE_DRIVER(pcw_state, screen_update_pcw_printer) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT( layout_pcw ) + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pcw8512, pcw ) + MCFG_SCREEN_ADD("printer",RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE( PCW_PRINTER_WIDTH, PCW_PRINTER_HEIGHT ) + MCFG_SCREEN_VISIBLE_AREA(0, PCW_PRINTER_WIDTH-1, 0, PCW_PRINTER_HEIGHT-1) + MCFG_SCREEN_UPDATE_DRIVER(pcw_state, screen_update_pcw_printer) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT( layout_pcw ) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") +MACHINE_CONFIG_END + +/* PCW9512, PCW9512+, PCW10 */ +static MACHINE_CONFIG_DERIVED( pcw9512, pcw ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_IO_MAP(pcw9512_io) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(pcw8256) + ROM_REGION(0x10000,"maincpu",0) + ROM_FILL(0x0000,0x10000,0x00) \ + ROM_REGION(0x400,"printer_mcu",0) // i8041 9-pin dot-matrix + ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) + ROM_REGION(0x400,"keyboard_mcu",0) // i8048 + ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) +ROM_END + +ROM_START(pcw8512) + ROM_REGION(0x10000,"maincpu",0) + ROM_FILL(0x0000,0x10000,0x00) \ + ROM_REGION(0x400,"printer_mcu",0) // i8041 9-pin dot-matrix + ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) + ROM_REGION(0x400,"keyboard_mcu",0) // i8048 + ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) +ROM_END + +ROM_START(pcw9256) + ROM_REGION(0x10000,"maincpu",0) + ROM_FILL(0x0000,0x10000,0x00) \ + ROM_REGION(0x2000,"printer_mcu",0) // i8041 9-pin dot-matrix + ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) + ROM_REGION(0x400,"keyboard_mcu",0) // i8048 + ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) +ROM_END + +ROM_START(pcw9512) + ROM_REGION(0x10000,"maincpu",0) + ROM_FILL(0x0000,0x10000,0x00) \ + ROM_REGION(0x2000,"printer_mcu",0) // i8041 daisywheel (schematics say i8039?) + ROM_LOAD("40103.ic109", 0, 0x2000, CRC(a64d450a) SHA1(ebbf0ef19d39912c1c127c748514dd299915f88b)) + ROM_REGION(0x400,"keyboard_mcu",0) // i8048 + ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) +ROM_END + +ROM_START(pcw10) + ROM_REGION(0x10000,"maincpu",0) + ROM_FILL(0x0000,0x10000,0x00) \ + ROM_REGION(0x2000,"printer_mcu",0) // i8041 9-pin dot matrix + ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) + ROM_REGION(0x400,"keyboard_mcu",0) // i8048 + ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) +ROM_END + + +/* these are all variants on the pcw design */ +/* major difference is memory configuration and drive type */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1985, pcw8256, 0, 0, pcw8256, pcw, pcw_state, pcw, "Amstrad plc", "PCW8256", MACHINE_NOT_WORKING) +COMP( 1985, pcw8512, pcw8256, 0, pcw8512, pcw, pcw_state, pcw, "Amstrad plc", "PCW8512", MACHINE_NOT_WORKING) +COMP( 1987, pcw9256, pcw8256, 0, pcw8256, pcw, pcw_state, pcw, "Amstrad plc", "PCW9256", MACHINE_NOT_WORKING) +COMP( 1987, pcw9512, pcw8256, 0, pcw9512, pcw, pcw_state, pcw, "Amstrad plc", "PCW9512 (+)", MACHINE_NOT_WORKING) +COMP( 1993, pcw10, pcw8256, 0, pcw8512, pcw, pcw_state, pcw, "Amstrad plc", "PCW10", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/pcw16.c b/src/mame/drivers/pcw16.c new file mode 100644 index 00000000000..109624be06c --- /dev/null +++ b/src/mame/drivers/pcw16.c @@ -0,0 +1,1094 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/****************************************************************************** + + pcw16.c + system driver + + Kevin Thacker [MESS driver] + + Thankyou to: + + - Cliff Lawson @ Amstrad plc for his documentation (Anne ASIC documentation), + and extensive help. + (web.ukonline.co.uk/cliff.lawson/) + (www.amstrad.com) + - John Elliot for his help and tips + (he's written a CP/M implementation for the PCW16) + (www.seasip.deomon.co.uk) + - and others who offered their help (Richard Fairhurst, Richard Wildey) + + Hardware: + - 2mb dram max, + - 2mb flash-file memory max (in 2 1mb chips), + - 16MHz Z80 (core combined in Anne ASIC), + - Anne ASIC (keyboard interface, video (colours), dram/flash/rom paging, + real time clock, "glue" logic for Super I/O) + - Winbond Super I/O chip (PC type hardware - FDC, Serial, LPT, Hard-drive) + - PC/AT keyboard - some keys are coloured to identify special functions, but + these are the same as normal PC keys + - PC Serial Mouse - uses Mouse System Mouse protocol + - PC 1.44MB Floppy drive + + Primary Purpose: + - built as a successor to the PCW8526/PCW9512 series + - wordprocessor system (also contains spreadsheet and other office applications) + - 16MHz processor used so proportional fonts and enhanced wordprocessing features + are possible, true WYSIWYG wordprocessing. + - flash-file can store documents. + + To Do: + - reduce memory usage so it is more MESSD friendly + - different configurations + - implement configuration register + - extract game-port hardware from pc driver - used in any PCW16 progs? + - extract hard-drive code from PC driver and use in this driver + - implement printer + - .. anything else that requires implementing + + Info: + - to use this driver you need a OS rescue disc. + (HINT: This also contains the boot-rom) + - the OS will be installed from the OS rescue disc into the Flash-ROM + + Uses "MEMCARD" dir to hold flash-file data. + To use the power button, flick the dip switch off/on + + From comp.sys.amstrad.8bit FAQ: + + "Amstrad made the following PCW systems : + + - 1) PCW8256 + - 2) PCW8512 + - 3) PCW9512 + - 4) PCW9512+ + - 5) PcW10 + - 6) PcW16 + + 1 had 180K drives, 2 had a 180K A drive and a 720K B drive, 3 had only + 720K drives. All subsequent models had 3.5" disks using CP/M format at + 720K until 6 when it switched to 1.44MB in MS-DOS format. The + of + model 4 was that it had a "real" parallel interface so could be sold + with an external printer such as the Canon BJ10. The PcW10 wasn't + really anything more than 4 in a more modern looking case. + + The PcW16 is a radical digression who's sole "raison d'etre" was to + make a true WYSIWYG product but this meant a change in the screen and + processor (to 16MHz) etc. which meant that it could not be kept + compatible with the previous models (though documents ARE compatible)" + + +TODO: +- Verfiy uart model. + + + ******************************************************************************/ +/* PeT 19.October 2000 + added/changed printer support + not working reliable, seams to expect parallelport in epp/ecp mode + epp/ecp modes in parallel port not supported yet + so ui disabled */ + +#include "includes/pcw16.h" +#include "bus/rs232/rs232.h" +#include "bus/rs232/ser_mouse.h" + +// interrupt counter +/* controls which bank of 2mb address space is paged into memory */ + +// output of 4-bit port from Anne ASIC +// code defining which INT fdc is connected to +// interrupt bits +// bit 7: ?? +// bit 6: fdc +// bit 5: ?? +// bit 3,4; Serial +// bit 2: Vsync state +// bit 1: keyboard int +// bit 0: Display ints + +// debugging - write ram as seen by cpu +void pcw16_state::pcw16_refresh_ints() +{ + /* any bits set excluding vsync */ + if ((m_system_status & (~0x04))!=0) + { + m_maincpu->set_input_line(0, HOLD_LINE); + } + else + { + m_maincpu->set_input_line(0, CLEAR_LINE); + } +} + + +TIMER_DEVICE_CALLBACK_MEMBER(pcw16_state::pcw16_timer_callback) +{ + /* do not increment past 15 */ + if (m_interrupt_counter!=15) + { + m_interrupt_counter++; + /* display int */ + m_system_status |= (1<<0); + } + + if (m_interrupt_counter!=0) + { + pcw16_refresh_ints(); + } +} + +static ADDRESS_MAP_START(pcw16_map, AS_PROGRAM, 8, pcw16_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(pcw16_mem_r, pcw16_mem_w) +ADDRESS_MAP_END + + +WRITE8_MEMBER(pcw16_state::pcw16_palette_w) +{ + m_colour_palette[offset & 0x0f] = data & 31; +} + +UINT8 pcw16_state::read_bank_data(UINT8 type, UINT16 offset) +{ + if(type & 0x80) // DRAM + { + return m_ram->pointer()[((type & 0x7f)*0x4000) + offset]; + } + else // ROM / Flash + { + if(type < 4) + { + return m_region_rom->base()[((type & 0x03)*0x4000)+offset+0x10000]; + } + if(type < 0x40) // first flash + { + return m_flash0->read(((type & 0x3f)*0x4000)+offset); + } + else // second flash + { + return m_flash1->read(((type & 0x3f)*0x4000)+offset); + } + } +} + +void pcw16_state::write_bank_data(UINT8 type, UINT16 offset, UINT8 data) +{ + if(type & 0x80) // DRAM + { + m_ram->pointer()[((type & 0x7f)*0x4000) + offset] = data; + } + else // ROM / Flash + { + if(type < 4) + return; // first four sectors are write protected + if(type < 0x40) // first flash + { + m_flash0->write(((type & 0x3f)*0x4000)+offset,data); + } + else // second flash + { + m_flash1->write(((type & 0x3f)*0x4000)+offset,data); + } + } +} + +UINT8 pcw16_state::pcw16_read_mem(UINT8 bank, UINT16 offset) +{ + switch(bank) + { + case 0: + return read_bank_data(m_banks[bank],offset); + case 1: + return read_bank_data(m_banks[bank],offset); + case 2: + return read_bank_data(m_banks[bank],offset); + case 3: + return read_bank_data(m_banks[bank],offset); + } + return 0xff; +} + +void pcw16_state::pcw16_write_mem(UINT8 bank, UINT16 offset, UINT8 data) +{ + switch(bank) + { + case 0: + write_bank_data(m_banks[bank],offset,data); + break; + case 1: + write_bank_data(m_banks[bank],offset,data); + break; + case 2: + write_bank_data(m_banks[bank],offset,data); + break; + case 3: + write_bank_data(m_banks[bank],offset,data); + break; + } +} + +READ8_MEMBER(pcw16_state::pcw16_mem_r) +{ + if(offset < 0x4000) + return pcw16_read_mem(0,offset); + if(offset >= 0x4000 && offset < 0x8000) + return pcw16_read_mem(1,offset-0x4000); + if(offset >= 0x8000 && offset < 0xc000) + return pcw16_read_mem(2,offset-0x8000); + if(offset >= 0xc000 && offset < 0x10000) + return pcw16_read_mem(3,offset-0xc000); + + return 0xff; +} + +WRITE8_MEMBER(pcw16_state::pcw16_mem_w) +{ + if(offset < 0x4000) + pcw16_write_mem(0,offset,data); + if(offset >= 0x4000 && offset < 0x8000) + pcw16_write_mem(1,offset-0x4000,data); + if(offset >= 0x8000 && offset < 0xc000) + pcw16_write_mem(2,offset-0x8000,data); + if(offset >= 0xc000 && offset < 0x10000) + pcw16_write_mem(3,offset-0xc000,data); +} + +READ8_MEMBER(pcw16_state::pcw16_bankhw_r) +{ +// logerror("bank r: %d \n", offset); + + return m_banks[offset]; +} + +WRITE8_MEMBER(pcw16_state::pcw16_bankhw_w) +{ + //logerror("bank w: %d block: %02x\n", offset, data); + + m_banks[offset] = data; +} + +WRITE8_MEMBER(pcw16_state::pcw16_video_control_w) +{ + //logerror("video control w: %02x\n", data); + + m_video_control = data; +} + +/* PCW16 KEYBOARD */ + +//unsigned char pcw16_keyboard_status; + + + +#define PCW16_KEYBOARD_PARITY_MASK (1<<7) +#define PCW16_KEYBOARD_STOP_BIT_MASK (1<<6) +#define PCW16_KEYBOARD_START_BIT_MASK (1<<5) +#define PCW16_KEYBOARD_BUSY_STATUS (1<<4) +#define PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK (1<<1) +#define PCW16_KEYBOARD_TRANSMIT_MODE (1<<0) + +#define PCW16_KEYBOARD_RESET_INTERFACE (1<<2) + +#define PCW16_KEYBOARD_DATA (1<<1) +#define PCW16_KEYBOARD_CLOCK (1<<0) + +/* parity table. Used to set parity bit in keyboard status register */ + +void pcw16_state::pcw16_keyboard_init() +{ + int i; + int b; + + /* if sum of all bits in the byte is even, then the data + has even parity, otherwise it has odd parity */ + for (i=0; i<256; i++) + { + int data; + int sum; + + sum = 0; + data = i; + + for (b=0; b<8; b++) + { + sum+=data & 0x01; + + data = data>>1; + } + + m_keyboard_parity_table[i] = sum & 0x01; + } + + + /* clear int */ + pcw16_keyboard_int(0); + /* reset state */ + m_keyboard_state = 0; + /* reset ready for transmit */ + pcw16_keyboard_reset(); +} + +void pcw16_state::pcw16_keyboard_refresh_outputs() +{ + /* generate output bits */ + m_keyboard_bits_output = m_keyboard_bits; + + /* force clock low? */ + if (m_keyboard_state & PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK) + { + m_keyboard_bits_output &= ~PCW16_KEYBOARD_CLOCK; + } +} + +void pcw16_state::pcw16_keyboard_set_clock_state(int state) +{ + m_keyboard_bits &= ~PCW16_KEYBOARD_CLOCK; + + if (state) + { + m_keyboard_bits |= PCW16_KEYBOARD_CLOCK; + } + + pcw16_keyboard_refresh_outputs(); +} + +void pcw16_state::pcw16_keyboard_int(int state) +{ + m_system_status &= ~(1<<1); + + if (state) + { + m_system_status |= (1<<1); + } + + pcw16_refresh_ints(); +} + +void pcw16_state::pcw16_keyboard_reset() +{ + /* clock set to high */ + pcw16_keyboard_set_clock_state(1); +} + +/* interfaces to a pc-at keyboard */ +READ8_MEMBER(pcw16_state::pcw16_keyboard_data_shift_r) +{ + //logerror("keyboard data shift r: %02x\n", m_keyboard_data_shift); + m_keyboard_state &= ~(PCW16_KEYBOARD_BUSY_STATUS); + + pcw16_keyboard_int(0); + /* reset for reception */ + pcw16_keyboard_reset(); + + /* read byte */ + return m_keyboard_data_shift; +} + +/* if force keyboard clock is low it is safe to send */ +int pcw16_state::pcw16_keyboard_can_transmit() +{ + /* clock is not forced low */ + /* and not busy - i.e. not already sent a char */ + return ((m_keyboard_bits_output & PCW16_KEYBOARD_CLOCK)!=0); +} + +#ifdef UNUSED_FUNCTION +/* issue a begin byte transfer */ +void ::pcw16_begin_byte_transfer(void) +{ +} +#endif + +/* signal a code has been received */ +void pcw16_state::pcw16_keyboard_signal_byte_received(int data) +{ + /* clear clock */ + pcw16_keyboard_set_clock_state(0); + + /* set code in shift register */ + m_keyboard_data_shift = data; + /* busy */ + m_keyboard_state |= PCW16_KEYBOARD_BUSY_STATUS; + + /* initialise start, stop and parity bits */ + m_keyboard_state &= ~PCW16_KEYBOARD_START_BIT_MASK; + m_keyboard_state |=PCW16_KEYBOARD_STOP_BIT_MASK; + + /* "Keyboard data has odd parity, so the parity bit in the + status register should only be set when the shift register + data itself has even parity. */ + + m_keyboard_state &= ~PCW16_KEYBOARD_PARITY_MASK; + + /* if data has even parity, set parity bit */ + if ((m_keyboard_parity_table[data])==0) + m_keyboard_state |= PCW16_KEYBOARD_PARITY_MASK; + + pcw16_keyboard_int(1); +} + + +WRITE8_MEMBER(pcw16_state::pcw16_keyboard_data_shift_w) +{ + //logerror("Keyboard Data Shift: %02x\n", data); + /* writing to shift register clears parity */ + /* writing to shift register clears start bit */ + m_keyboard_state &= ~( + PCW16_KEYBOARD_PARITY_MASK | + PCW16_KEYBOARD_START_BIT_MASK); + + /* writing to shift register sets stop bit */ + m_keyboard_state |= PCW16_KEYBOARD_STOP_BIT_MASK; + + m_keyboard_data_shift = data; + +} + +READ8_MEMBER(pcw16_state::pcw16_keyboard_status_r) +{ + /* bit 2,3 are bits 8 and 9 of vdu pointer */ + return (m_keyboard_state & + (PCW16_KEYBOARD_PARITY_MASK | + PCW16_KEYBOARD_STOP_BIT_MASK | + PCW16_KEYBOARD_START_BIT_MASK | + PCW16_KEYBOARD_BUSY_STATUS | + PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK | + PCW16_KEYBOARD_TRANSMIT_MODE)); +} + +WRITE8_MEMBER(pcw16_state::pcw16_keyboard_control_w) +{ + //logerror("Keyboard control w: %02x\n",data); + + m_keyboard_previous_state = m_keyboard_state; + + /* if set, set parity */ + if (data & 0x080) + { + m_keyboard_state |= PCW16_KEYBOARD_PARITY_MASK; + } + + /* clear read/write bits */ + m_keyboard_state &= + ~(PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK | + PCW16_KEYBOARD_TRANSMIT_MODE); + /* set read/write bits from data */ + m_keyboard_state |= (data & 0x03); + + if (data & PCW16_KEYBOARD_RESET_INTERFACE) + { + pcw16_keyboard_reset(); + } + + if (data & PCW16_KEYBOARD_TRANSMIT_MODE) + { + /* force clock changed */ + if (((m_keyboard_state^m_keyboard_previous_state) & PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK)!=0) + { + /* just cleared? */ + if ((m_keyboard_state & PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK)==0) + { + /* write */ + /* busy */ + m_keyboard_state |= PCW16_KEYBOARD_BUSY_STATUS; + /* keyboard takes data */ + m_keyboard->write(space, 0, m_keyboard_data_shift); + /* set clock low - no furthur transmissions */ + pcw16_keyboard_set_clock_state(0); + /* set int */ + pcw16_keyboard_int(1); + } + } + + + } + + if (((m_keyboard_state^m_keyboard_previous_state) & PCW16_KEYBOARD_TRANSMIT_MODE)!=0) + { + if ((m_keyboard_state & PCW16_KEYBOARD_TRANSMIT_MODE)==0) + { + if ((m_system_status & (1<<1))!=0) + { + pcw16_keyboard_int(0); + } + } + } + + pcw16_keyboard_refresh_outputs(); +} + + +WRITE_LINE_MEMBER(pcw16_state::pcw16_keyboard_callback) +{ + if(!state) + return; + + if (pcw16_keyboard_can_transmit()) + { + int data; + + data = m_keyboard->read(machine().driver_data()->generic_space(), 0); + + if (data) + { +// if (data==4) +// { +// pcw16_dump_cpu_ram(); +// } + + pcw16_keyboard_signal_byte_received(data); + } + } +} + + +static const int rtc_days_in_each_month[]= +{ + 31,/* jan */ + 28, /* feb */ + 31, /* march */ + 30, /* april */ + 31, /* may */ + 30, /* june */ + 31, /* july */ + 31, /* august */ + 30, /* september */ + 31, /* october */ + 30, /* november */ + 31 /* december */ +}; + +static const int rtc_days_in_february[] = +{ + 29, 28, 28, 28 +}; + +void pcw16_state::rtc_setup_max_days() +{ + /* february? */ + if (m_rtc_months == 2) + { + /* low two bits of year select number of days in february */ + m_rtc_days_max = rtc_days_in_february[m_rtc_years & 0x03]; + } + else + { + m_rtc_days_max = (unsigned char)rtc_days_in_each_month[m_rtc_months]; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(pcw16_state::rtc_timer_callback) +{ + int fraction_of_second; + + /* halt counter? */ + if ((m_rtc_control & 0x01)!=0) + { + /* no */ + + /* increment 256th's of a second register */ + fraction_of_second = m_rtc_256ths_seconds+1; + /* add bit 8 = overflow */ + m_rtc_seconds+=(fraction_of_second>>8); + /* ensure counter is in range 0-255 */ + m_rtc_256ths_seconds = fraction_of_second & 0x0ff; + } + + if (m_rtc_seconds>59) + { + m_rtc_seconds = 0; + + m_rtc_minutes++; + + if (m_rtc_minutes>59) + { + m_rtc_minutes = 0; + + m_rtc_hours++; + + if (m_rtc_hours>23) + { + m_rtc_hours = 0; + + m_rtc_days++; + + if (m_rtc_days > m_rtc_days_max) + { + m_rtc_days = 1; + + m_rtc_months++; + + if (m_rtc_months>12) + { + m_rtc_months = 1; + + /* 7 bit year counter */ + m_rtc_years = (m_rtc_years + 1) & 0x07f; + + } + + rtc_setup_max_days(); + } + + } + + + } + } +} + +READ8_MEMBER(pcw16_state::rtc_year_invalid_r) +{ + /* year in lower 7 bits. RTC Invalid status is m_rtc_control bit 0 + inverted */ + return (m_rtc_years & 0x07f) | (((m_rtc_control & 0x01)<<7)^0x080); +} + +READ8_MEMBER(pcw16_state::rtc_month_r) +{ + return m_rtc_months; +} + +READ8_MEMBER(pcw16_state::rtc_days_r) +{ + return m_rtc_days; +} + +READ8_MEMBER(pcw16_state::rtc_hours_r) +{ + return m_rtc_hours; +} + +READ8_MEMBER(pcw16_state::rtc_minutes_r) +{ + return m_rtc_minutes; +} + +READ8_MEMBER(pcw16_state::rtc_seconds_r) +{ + return m_rtc_seconds; +} + +READ8_MEMBER(pcw16_state::rtc_256ths_seconds_r) +{ + return m_rtc_256ths_seconds; +} + +WRITE8_MEMBER(pcw16_state::rtc_control_w) +{ + /* write control */ + m_rtc_control = data; +} + +WRITE8_MEMBER(pcw16_state::rtc_seconds_w) +{ + /* TODO: Writing register could cause next to increment! */ + m_rtc_seconds = data; +} + +WRITE8_MEMBER(pcw16_state::rtc_minutes_w) +{ + /* TODO: Writing register could cause next to increment! */ + m_rtc_minutes = data; +} + +WRITE8_MEMBER(pcw16_state::rtc_hours_w) +{ + /* TODO: Writing register could cause next to increment! */ + m_rtc_hours = data; +} + +WRITE8_MEMBER(pcw16_state::rtc_days_w) +{ + /* TODO: Writing register could cause next to increment! */ + m_rtc_days = data; +} + +WRITE8_MEMBER(pcw16_state::rtc_month_w) +{ + /* TODO: Writing register could cause next to increment! */ + m_rtc_months = data; + + rtc_setup_max_days(); +} + + +WRITE8_MEMBER(pcw16_state::rtc_year_w) +{ + /* TODO: Writing register could cause next to increment! */ + m_rtc_hours = data; + + rtc_setup_max_days(); +} + + +void pcw16_state::trigger_fdc_int() +{ + int state; + + state = m_system_status & (1<<6); + + switch (m_fdc_int_code) + { + /* nmi */ + case 0: + { + /* I'm assuming that the nmi is edge triggered */ + /* a interrupt from the fdc will cause a change in line state, and + the nmi will be triggered, but when the state changes because the int + is cleared this will not cause another nmi */ + /* I'll emulate it like this to be sure */ + + if (state!=m_previous_fdc_int_state) + { + if (state) + { + /* I'll pulse it because if I used hold-line I'm not sure + it would clear - to be checked */ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } + } + } + break; + + /* attach fdc to int */ + case 1: + { + pcw16_refresh_ints(); + } + break; + + /* do not interrupt */ + default: + break; + } + + m_previous_fdc_int_state = state; +} + +READ8_MEMBER(pcw16_state::pcw16_system_status_r) +{ +// logerror("system status r: \n"); + + return m_system_status | (m_io_extra->read() & 0x04); +} + +READ8_MEMBER(pcw16_state::pcw16_timer_interrupt_counter_r) +{ + int data; + + data = m_interrupt_counter; + + m_interrupt_counter = 0; + /* clear display int */ + m_system_status &= ~(1<<0); + + pcw16_refresh_ints(); + + return data; +} + + +WRITE8_MEMBER(pcw16_state::pcw16_system_control_w) +{ + //logerror("0x0f8: function: %d\n",data); + + /* lower 4 bits define function code */ + switch (data & 0x0f) + { + /* no effect */ + case 0x00: + case 0x09: + case 0x0a: + case 0x0d: + case 0x0e: + break; + + /* system reset */ + case 0x01: + break; + + /* connect IRQ6 input to /NMI */ + case 0x02: + { + m_fdc_int_code = 0; + } + break; + + /* connect IRQ6 input to /INT */ + case 0x03: + { + m_fdc_int_code = 1; + } + break; + + /* dis-connect IRQ6 input from /NMI and /INT */ + case 0x04: + { + m_fdc_int_code = 2; + } + break; + + /* set terminal count */ + case 0x05: + { + m_fdc->tc_w(true); + } + break; + + /* clear terminal count */ + case 0x06: + { + m_fdc->tc_w(false); + } + break; + + /* bleeper on */ + case 0x0b: + { + m_beeper->set_state(1); + } + break; + + /* bleeper off */ + case 0x0c: + { + m_beeper->set_state(0); + } + break; + + /* drive video outputs */ + case 0x07: + { + } + break; + + /* float video outputs */ + case 0x08: + { + } + break; + + /* set 4-bit output port to value X */ + case 0x0f: + { + /* bit 7 - ?? */ + /* bit 6 - ?? */ + /* bit 5 - green/red led (1==green)*/ + /* bit 4 - monitor on/off (1==on) */ + + m_4_bit_port = data>>4; + + + } + break; + } +} + +WRITE_LINE_MEMBER( pcw16_state::fdc_interrupt ) +{ + /* IRQ6 */ + /* bit 6 of PCW16 system status indicates floppy ints */ + if (state) + m_system_status |= (1<<6); + else + m_system_status &= ~(1<<6); + + trigger_fdc_int(); +} + + +WRITE_LINE_MEMBER(pcw16_state::pcw16_com_interrupt_1) +{ + m_system_status &= ~(1 << 4); + + if ( state ) { + m_system_status |= (1 << 4); + } + + pcw16_refresh_ints(); +} + + +WRITE_LINE_MEMBER(pcw16_state::pcw16_com_interrupt_2) +{ + m_system_status &= ~(1 << 3); + + if ( state ) { + m_system_status |= (1 << 3); + } + + pcw16_refresh_ints(); +} + +FLOPPY_FORMATS_MEMBER( pcw16_state::floppy_formats ) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( pcw16_floppies ) + SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) +SLOT_INTERFACE_END + + +static ADDRESS_MAP_START(pcw16_io, AS_IO, 8, pcw16_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + /* super i/o chip */ + AM_RANGE(0x018, 0x01f) AM_DEVICE("fdc", pc_fdc_superio_device, map) + AM_RANGE(0x020, 0x027) AM_DEVREADWRITE("ns16550_1", ns16550_device, ins8250_r, ins8250_w) + AM_RANGE(0x028, 0x02f) AM_DEVREADWRITE("ns16550_2", ns16550_device, ins8250_r, ins8250_w) + AM_RANGE(0x038, 0x03a) AM_DEVREADWRITE("lpt", pc_lpt_device, read, write) + /* anne asic */ + AM_RANGE(0x0e0, 0x0ef) AM_WRITE(pcw16_palette_w) + AM_RANGE(0x0f0, 0x0f3) AM_READWRITE(pcw16_bankhw_r, pcw16_bankhw_w) + AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw16_keyboard_data_shift_r, pcw16_keyboard_data_shift_w) + AM_RANGE(0x0f5, 0x0f5) AM_READWRITE(pcw16_keyboard_status_r, pcw16_keyboard_control_w) + AM_RANGE(0x0f7, 0x0f7) AM_READWRITE(pcw16_timer_interrupt_counter_r, pcw16_video_control_w) + AM_RANGE(0x0f8, 0x0f8) AM_READWRITE(pcw16_system_status_r, pcw16_system_control_w) + AM_RANGE(0x0f9, 0x0f9) AM_READWRITE(rtc_256ths_seconds_r, rtc_control_w) + AM_RANGE(0x0fa, 0x0fa) AM_READWRITE(rtc_seconds_r, rtc_seconds_w) + AM_RANGE(0x0fb, 0x0fb) AM_READWRITE(rtc_minutes_r, rtc_minutes_w) + AM_RANGE(0x0fc, 0x0fc) AM_READWRITE(rtc_hours_r, rtc_hours_w) + AM_RANGE(0x0fd, 0x0fd) AM_READWRITE(rtc_days_r, rtc_days_w) + AM_RANGE(0x0fe, 0x0fe) AM_READWRITE(rtc_month_r, rtc_month_w) + AM_RANGE(0x0ff, 0x0ff) AM_READWRITE(rtc_year_invalid_r, rtc_year_w) +ADDRESS_MAP_END + + +void pcw16_state::machine_reset() +{ + /* initialise defaults */ + m_fdc_int_code = 2; + /* clear terminal count */ + m_fdc->tc_w(false); + /* select first rom page */ + m_banks[0] = 0; +// pcw16_update_memory(machine); + + /* temp rtc setup */ + m_rtc_seconds = 0; + m_rtc_minutes = 0; + m_rtc_hours = 0; + m_rtc_days_max = 0; + m_rtc_days = 1; + m_rtc_months = 1; + m_rtc_years = 0; + m_rtc_control = 1; + m_rtc_256ths_seconds = 0; + + pcw16_keyboard_init(); + m_uart2->ri_w(0); +} + + +void pcw16_state::machine_start() +{ + m_system_status = 0; + m_interrupt_counter = 0; + + m_beeper->set_state(0); + m_beeper->set_frequency(3750); +} + +static INPUT_PORTS_START(pcw16) + PORT_START("EXTRA") + /* vblank */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") + /* power switch - default is on */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Power Switch/Suspend") PORT_WRITE_LINE_DEVICE_MEMBER("ns16550_2", ins8250_uart_device, ri_w) PORT_TOGGLE + + PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ +INPUT_PORTS_END + +static SLOT_INTERFACE_START(pcw16_com) + SLOT_INTERFACE("msystems_mouse", MSYSTEM_SERIAL_MOUSE) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( pcw16, pcw16_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 16000000) + MCFG_CPU_PROGRAM_MAP(pcw16_map) + MCFG_CPU_IO_MAP(pcw16_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + + MCFG_DEVICE_ADD( "ns16550_1", NS16550, XTAL_1_8432MHz ) /* TODO: Verify uart model */ + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport1", rs232_port_device, write_txd)) + MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport1", rs232_port_device, write_dtr)) + MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport1", rs232_port_device, write_rts)) + MCFG_INS8250_OUT_INT_CB(WRITELINE(pcw16_state, pcw16_com_interrupt_1)) + MCFG_RS232_PORT_ADD( "serport1", pcw16_com, "msystems_mouse" ) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, dsr_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, ri_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, cts_w)) + + MCFG_DEVICE_ADD( "ns16550_2", NS16550, XTAL_1_8432MHz ) /* TODO: Verify uart model */ + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport2", rs232_port_device, write_txd)) + MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport2", rs232_port_device, write_dtr)) + MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport2", rs232_port_device, write_rts)) + MCFG_INS8250_OUT_INT_CB(WRITELINE(pcw16_state, pcw16_com_interrupt_2)) + MCFG_RS232_PORT_ADD( "serport2", pcw16_com, NULL ) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ns16550_2", ins8250_uart_device, rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ns16550_2", ins8250_uart_device, dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ns16550_2", ins8250_uart_device, dsr_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ns16550_2", ins8250_uart_device, cts_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(PCW16_SCREEN_WIDTH, PCW16_SCREEN_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, PCW16_SCREEN_WIDTH-1, 0, PCW16_SCREEN_HEIGHT-1) + MCFG_SCREEN_UPDATE_DRIVER(pcw16_state, screen_update_pcw16) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", PCW16_NUM_COLOURS) + MCFG_PALETTE_INIT_OWNER(pcw16_state, pcw16) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* printer */ + MCFG_DEVICE_ADD("lpt", PC_LPT, 0) + MCFG_PC_LPT_IRQ_HANDLER(INPUTLINE("maincpu", 0)) + + MCFG_PC_FDC_SUPERIO_ADD("fdc") + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pcw16_state, fdc_interrupt)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcw16_floppies, "35hd", pcw16_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", pcw16_floppies, "35hd", pcw16_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("disk_list","pcw16") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2M") + MCFG_INTEL_E28F008SA_ADD("flash0") + MCFG_INTEL_E28F008SA_ADD("flash1") + + MCFG_AT_KEYB_ADD("at_keyboard", 3, WRITELINE(pcw16_state, pcw16_keyboard_callback)) + + /* video ints */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("video_timer", pcw16_state, pcw16_timer_callback, attotime::from_usec(5830)) + /* rtc timer */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("rtc_timer", pcw16_state, rtc_timer_callback, attotime::from_hz(256)) +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* the lower 64k of the flash-file memory is write protected. This contains the boot + rom. The boot rom is also on the OS rescue disc. Handy! */ +ROM_START(pcw16) + ROM_REGION((0x010000+524288), "maincpu",0) + ROM_LOAD("pcw045.sys",0x10000, 524288, CRC(c642f498) SHA1(8a5c05de92e7b2c5acdfb038217503ad363285b5)) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1995, pcw16, 0, 0, pcw16, pcw16, driver_device, 0, "Amstrad plc", "PcW16", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pda600.c b/src/mame/drivers/pda600.c new file mode 100644 index 00000000000..a3e8f3d453e --- /dev/null +++ b/src/mame/drivers/pda600.c @@ -0,0 +1,238 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Amstrad PenPad PDA 600 + + 05/11/2009 Skeleton driver. + + Hardware info: + U1: CPU + Z8S180 + Enhanced Z80 CPU + 1 MB MMU + 2 DMAs + 2 UARTs (up to 512 Kbps) + Two 16-Bit Timers + Clock Serial I/O + + U2: ROM + contains OS (binary and disassembled source) + apparently compatible to 27C1001 (128K*8) + + U3: RAM + 128K RAM, static + U4: RTC + U5: Amstrad ASIC (unknown functionality ) + U6, U7, U8, U9: Multiplexer + quad channel dual multiplexer + U11: RAM + 32K RAM, static + U12: LCD Controller + U21: 5V StepUp converter voltage converter + U27: OA quad operational amplifier + U30: RS232 Driver + U31: Amstrad ASIC + U32: FlipFlop Octal D-Flip-Flop + U33: RAM + 32K RAM, static + U35: Tone Dialer + generates DTMF frequencies + U36: unknown + U37: Nand + Dual Quad-Input Nand + U43: Bus Buffer + Octal Bus Buffer + + Connectors: + LCD + Digitizer + Serial + PCMCIA + + Additional info: + Two Z8 for power management and character recognition + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z180/z180.h" +#include "machine/nvram.h" +#include "machine/hd64610.h" +#include "rendlay.h" + + +class pda600_state : public driver_device +{ +public: + pda600_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + {} + + required_device m_maincpu; + + virtual void video_start(); + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + UINT8 * m_video_ram; +}; + + +static ADDRESS_MAP_START(pda600_mem, AS_PROGRAM, 8, pda600_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x1ffff) AM_ROM + //AM_RANGE(0x20000, 0x9ffff) AM_RAM // PCMCIA Card + AM_RANGE(0xa0000, 0xa7fff) AM_RAM AM_REGION("videoram", 0) + AM_RANGE(0xe0000, 0xfffff) AM_RAM AM_REGION("mainram", 0) AM_SHARE("nvram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pda600_io, AS_IO, 8, pda600_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x3f) AM_NOP /* Z180 internal registers */ + //AM_RANGE(0x40, 0x7f) AM_NOP /* Z180 internal registers */ + AM_RANGE(0x80, 0x8f) AM_DEVREADWRITE("rtc", hd64610_device, read, write) + //AM_RANGE(0xC0, 0xC1) AM_NOP /* LCD */ +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pda600 ) +INPUT_PORTS_END + + +void pda600_state::machine_reset() +{ + // the PDA600 soon after start waits for something from the Z180 CSIO, I do not know exactly for what + // the CSIO is used and for now I forced the CNTR End-Flag bit to 1 for allow the emulation to continue. + m_maincpu->set_state_int(Z180_CNTR, m_maincpu->state_int(Z180_CNTR) | 0x80); +} + +void pda600_state::video_start() +{ + m_video_ram = memregion("videoram")->base(); +} + +UINT32 pda600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int y=0; y<320; y++) + for (int x=0; x<30; x++) + { + UINT8 data = m_video_ram[y*30 + x]; + + for (int px=0; px<8; px++) + { + bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); + data <<= 1; + } + } + + return 0; +} + +static const gfx_layout pda600_charlayout_8 = +{ + 8, 8, + 49, + 1, + { 0 }, + { 0,1,2,3,4,5,6,7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout pda600_charlayout_13 = +{ + 8, 13, + 123, + 1, + { 0 }, + { 0,1,2,3,4,5,6,7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12 }, + 8*13 +}; + +static const gfx_layout pda600_charlayout_13a = +{ + 8, 13, + 132, + 1, + { 0 }, + { 0,1,2,3,4,5,6,7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12 }, + 8*13 +}; + +static const gfx_layout pda600_charlayout_19 = +{ + 8, 19, + 32, + 1, + { 0 }, + { 0,1,2,3,4,5,6,7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12, 8*13, 8*14, 8*15, 8*16, 8*17, 8*18 }, + 8*19 +}; + +static const gfx_layout pda600_charlayout_19a = +{ + 8, 19, + 11, + 1, + { 0 }, + { 0,1,2,3,4,5,6,7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12, 8*13, 8*14, 8*15, 8*16, 8*17, 8*18 }, + 8*19 +}; + +static GFXDECODE_START( pda600 ) + GFXDECODE_ENTRY( "maincpu", 0x45cd, pda600_charlayout_19, 0, 1 ) + GFXDECODE_ENTRY( "maincpu", 0x4892, pda600_charlayout_19a, 0, 1 ) + GFXDECODE_ENTRY( "maincpu", 0x4d73, pda600_charlayout_8, 0, 1 ) + GFXDECODE_ENTRY( "maincpu", 0x5b8f, pda600_charlayout_13, 0, 1 ) + GFXDECODE_ENTRY( "maincpu", 0x61d3, pda600_charlayout_13a, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( pda600, pda600_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z180, XTAL_14_31818MHz) + MCFG_CPU_PROGRAM_MAP(pda600_mem) + MCFG_CPU_IO_MAP(pda600_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(240, 320) + MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 320-1) + MCFG_SCREEN_UPDATE_DRIVER( pda600_state, screen_update ) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pda600) + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + // NVRAM needs to be filled with random data to fail the checksum and be initialized correctly + MCFG_NVRAM_ADD_RANDOM_FILL("nvram") + + MCFG_DEVICE_ADD("rtc", HD64610, XTAL_32_768kHz) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pda600 ) + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "pdarom.bin", 0x00000, 0x20000, CRC(f793a6c5) SHA1(ab14b0fdcedb927c66357368a2bfff605ba758fb)) + + // 128KB RAM + ROM_REGION( 0x20000, "mainram", ROMREGION_ERASE ) + + // 32KB Video RAM + ROM_REGION( 0x8000, "videoram", ROMREGION_ERASE ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1993, pda600, 0, 0, pda600, pda600, driver_device, 0, "Amstrad plc", "PenPad PDA 600", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/pdp1.c b/src/mame/drivers/pdp1.c new file mode 100644 index 00000000000..f3827cf61b1 --- /dev/null +++ b/src/mame/drivers/pdp1.c @@ -0,0 +1,1979 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + +Driver for a PDP1 emulator. + + Digital Equipment Corporation + Brian Silverman (original Java Source) + Vadim Gerasimov (original Java Source) + Chris Salomon (MESS driver) + Raphael Nabet (MESS driver) + +Initially, this was a conversion of a JAVA emulator +(although code has been edited extensively ever since). +I have tried contacting the author, but heard as yet nothing of him, +so I don't know if it all right with him, but after all -> he did +release the source, so hopefully everything will be fine (no his +name is not Marat). + +Note: naturally I have no PDP1, I have never seen one, nor have I any +programs for it. + +The first supported program was: + +SPACEWAR! + +The first Videogame EVER! + +When I saw the java emulator, running that game I was quite intrigued to +include a driver for MESS. +I think the historical value of SPACEWAR! is enormous. + +Two other programs are supported: Munching squares and LISP. + +Added Debugging and Disassembler... + + +Also: +ftp://minnie.cs.adfa.oz.au/pub/PDP-11/Sims/Supnik_2.3/software/lispswre.tar.gz +Is a packet which includes the original LISP as source and +binary form plus a macro assembler for PDP1 programs. + +For more documentation look at the source for the driver, +and the cpu/pdp1/pdp1.c file (information about the whereabouts of information +and the java source). + + +To load and play a game: +- Load a .rim file into the first tape reader +- Hold down Left Control, and press Enter. Let go. +- The lights will flash while the paper tape is being read. +- At the end, the game will start. + + + +*/ + +#include "emu.h" +#include "cpu/pdp1/pdp1.h" +#include "includes/pdp1.h" +#include "video/crt.h" + +/* + * + * The loading storing OS... is not emulated (I haven't a clue where to + * get programs for the machine) + * + */ + + +static ADDRESS_MAP_START(pdp1_map, AS_PROGRAM, 32, pdp1_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM +ADDRESS_MAP_END + +static INPUT_PORTS_START( pdp1 ) + PORT_START("SPACEWAR") /* 0: spacewar controllers */ + PORT_BIT( ROTATE_LEFT_PLAYER1, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("Spin Left Player 1") PORT_CODE(KEYCODE_A) PORT_CODE(JOYCODE_X_LEFT_SWITCH) + PORT_BIT( ROTATE_RIGHT_PLAYER1, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("Spin Right Player 1") PORT_CODE(KEYCODE_S) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) + PORT_BIT( THRUST_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Thrust Player 1") PORT_CODE(KEYCODE_D) PORT_CODE(JOYCODE_BUTTON1) + PORT_BIT( FIRE_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Fire Player 1") PORT_CODE(KEYCODE_F) PORT_CODE(JOYCODE_BUTTON2) + PORT_BIT( ROTATE_LEFT_PLAYER2, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("Spin Left Player 2") PORT_CODE(KEYCODE_LEFT) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_PLAYER(2) + PORT_BIT( ROTATE_RIGHT_PLAYER2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("Spin Right Player 2") PORT_CODE(KEYCODE_RIGHT) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_PLAYER(2) + PORT_BIT( THRUST_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Thrust Player 2") PORT_CODE(KEYCODE_UP) PORT_CODE(JOYCODE_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( FIRE_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Fire Player 2") PORT_CODE(KEYCODE_DOWN) PORT_CODE(JOYCODE_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( HSPACE_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Hyperspace Player 1") PORT_CODE(KEYCODE_Z) PORT_CODE(JOYCODE_BUTTON3) + PORT_BIT( HSPACE_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Hyperspace Player 2") PORT_CODE(KEYCODE_SLASH) PORT_CODE(JOYCODE_BUTTON3 ) PORT_PLAYER(2) + + PORT_START("CSW") /* 1: various pdp1 operator control panel switches */ + PORT_BIT(pdp1_control, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(pdp1_extend, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("extend") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(pdp1_start_nobrk, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("start (sequence break disabled)") PORT_CODE(KEYCODE_U) + PORT_BIT(pdp1_start_brk, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("start (sequence break enabled)") PORT_CODE(KEYCODE_I) + PORT_BIT(pdp1_stop, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop") PORT_CODE(KEYCODE_O) + PORT_BIT(pdp1_continue, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("continue") PORT_CODE(KEYCODE_P) + PORT_BIT(pdp1_examine, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("examine") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(pdp1_deposit, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("deposit") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(pdp1_read_in, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("read in") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(pdp1_reader, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("reader") + PORT_BIT(pdp1_tape_feed, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("tape feed") + PORT_BIT(pdp1_single_step, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("single step") PORT_CODE(KEYCODE_STOP) + PORT_BIT(pdp1_single_inst, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("single inst") PORT_CODE(KEYCODE_SLASH) + + PORT_START("SENSE") /* 2: operator control panel sense switches */ + PORT_DIPNAME( 040, 000, "Sense Switch 1") PORT_CODE(KEYCODE_1_PAD) + PORT_DIPSETTING( 000, DEF_STR( Off ) ) + PORT_DIPSETTING( 040, DEF_STR( On ) ) + PORT_DIPNAME( 020, 000, "Sense Switch 2") PORT_CODE(KEYCODE_2_PAD) + PORT_DIPSETTING( 000, DEF_STR( Off ) ) + PORT_DIPSETTING( 020, DEF_STR( On ) ) + PORT_DIPNAME( 010, 000, "Sense Switch 3") PORT_CODE(KEYCODE_3_PAD) + PORT_DIPSETTING( 000, DEF_STR( Off ) ) + PORT_DIPSETTING( 010, DEF_STR( On ) ) + PORT_DIPNAME( 004, 000, "Sense Switch 4") PORT_CODE(KEYCODE_4_PAD) + PORT_DIPSETTING( 000, DEF_STR( Off ) ) + PORT_DIPSETTING( 004, DEF_STR( On ) ) + PORT_DIPNAME( 002, 002, "Sense Switch 5") PORT_CODE(KEYCODE_5_PAD) + PORT_DIPSETTING( 000, DEF_STR( Off ) ) + PORT_DIPSETTING( 002, DEF_STR( On ) ) + PORT_DIPNAME( 001, 000, "Sense Switch 6") PORT_CODE(KEYCODE_6_PAD) + PORT_DIPSETTING( 000, DEF_STR( Off ) ) + PORT_DIPSETTING( 001, DEF_STR( On ) ) + + PORT_START("TSTADD") /* 3: operator control panel test address switches */ + PORT_BIT( 0100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 3") PORT_CODE(KEYCODE_1) + PORT_BIT( 0040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 4") PORT_CODE(KEYCODE_2) + PORT_BIT( 0020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 5") PORT_CODE(KEYCODE_3) + PORT_BIT( 0010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 6") PORT_CODE(KEYCODE_4) + PORT_BIT( 0004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 7") PORT_CODE(KEYCODE_5) + PORT_BIT( 0002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 8") PORT_CODE(KEYCODE_6) + PORT_BIT( 0001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 9") PORT_CODE(KEYCODE_7) + PORT_BIT( 0000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 10") PORT_CODE(KEYCODE_8) + PORT_BIT( 0000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 11") PORT_CODE(KEYCODE_9) + PORT_BIT( 0000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 12") PORT_CODE(KEYCODE_0) + PORT_BIT( 0000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 13") PORT_CODE(KEYCODE_MINUS) + PORT_BIT( 0000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 14") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT( 0000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 15") PORT_CODE(KEYCODE_Q) + PORT_BIT( 0000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 16") PORT_CODE(KEYCODE_W) + PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 17") PORT_CODE(KEYCODE_E) + PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 18") PORT_CODE(KEYCODE_R) + + PORT_START("TWDMSB") /* 4: operator control panel test word switches MSB */ + PORT_BIT( 0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 1") PORT_CODE(KEYCODE_A) + PORT_BIT( 0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 2") PORT_CODE(KEYCODE_S) + + PORT_START("TWDLSB") /* 5: operator control panel test word switches LSB */ + PORT_BIT( 0100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 3") PORT_CODE(KEYCODE_D) + PORT_BIT( 0040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 4") PORT_CODE(KEYCODE_F) + PORT_BIT( 0020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 5") PORT_CODE(KEYCODE_G) + PORT_BIT( 0010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 6") PORT_CODE(KEYCODE_H) + PORT_BIT( 0004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 7") PORT_CODE(KEYCODE_J) + PORT_BIT( 0002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 8") PORT_CODE(KEYCODE_K) + PORT_BIT( 0001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 9") PORT_CODE(KEYCODE_L) + PORT_BIT( 0000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 10") PORT_CODE(KEYCODE_COLON) + PORT_BIT( 0000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 11") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT( 0000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 12") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT( 0000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 13") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 14") PORT_CODE(KEYCODE_X) + PORT_BIT( 0000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 15") PORT_CODE(KEYCODE_C) + PORT_BIT( 0000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 16") PORT_CODE(KEYCODE_V) + PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 17") PORT_CODE(KEYCODE_B) + PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 18") PORT_CODE(KEYCODE_N) + + /* + Note that I can see 2 additional keys whose purpose is unknown to me. + The caps look like "MAR REL" for the leftmost one and "MAR SET" for + rightmost one: maybe they were used to set the margin (I don't have the + manual for the typewriter). */ + + PORT_START("TWR.0") /* 6: typewriter codes 00-17 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(Space)") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 \"") PORT_CODE(KEYCODE_1) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 '") PORT_CODE(KEYCODE_2) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 ~") PORT_CODE(KEYCODE_3) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 (implies)") PORT_CODE(KEYCODE_4) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 (or)") PORT_CODE(KEYCODE_5) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 (and)") PORT_CODE(KEYCODE_6) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 <") PORT_CODE(KEYCODE_7) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 >") PORT_CODE(KEYCODE_8) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (up arrow)") PORT_CODE(KEYCODE_9) + + PORT_START("TWR.1") /* 7: typewriter codes 20-37 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 (right arrow)") PORT_CODE(KEYCODE_0) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", =") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab Key") PORT_CODE(KEYCODE_TAB) + + PORT_START("TWR.2") /* 8: typewriter codes 40-57 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(non-spacing middle dot) _") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") ]") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(non-spacing overstrike) |") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( [") PORT_CODE(KEYCODE_MINUS) + + PORT_START("TWR.3") /* 9: typewriter codes 60-77 */ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lower Case") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (multiply)") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upper case") PORT_CODE(KEYCODE_RSHIFT) + /* hack to support my macintosh which does not differentiate the Right Shift key */ + /* PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upper case") PORT_CODE(KEYCODE_CAPSLOCK) */ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) + + PORT_START("CFG") /* 10: pseudo-input port with config */ + PORT_DIPNAME( 0x0003, 0x0002, "RAM size") + PORT_DIPSETTING( 0x0000, "4kw" ) + PORT_DIPSETTING( 0x0001, "32kw") + PORT_DIPSETTING( 0x0002, "64kw") + PORT_DIPNAME( 0x0004, 0x0000, "Hardware multiply") + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) + PORT_DIPNAME( 0x0008, 0x0000, "Hardware divide") + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( On ) ) + PORT_DIPNAME( 0x0010, 0x0000, "Type 20 sequence break system") + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0000, "Type 32 light pen") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) + + PORT_START("LIGHTPEN") /* 11: pseudo-input port with lightpen status */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("select larger light pen tip") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("select smaller light pen tip") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("light pen down") + + PORT_START("LIGHTX") /* 12: lightpen - X AXIS */ + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_RESET + + PORT_START("LIGHTY") /* 13: lightpen - Y AXIS */ + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_RESET +INPUT_PORTS_END + + +static const gfx_layout fontlayout = +{ + 6, 8, /* 6*8 characters */ + pdp1_charnum, /* 96+4 characters */ + 1, /* 1 bit per pixel */ + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 consecutive bytes */ +}; + + +/* + The static palette only includes the pens for the control panel and + the typewriter, as the CRT palette is generated dynamically. + + The CRT palette defines various levels of intensity between white and + black. Grey levels follow an exponential law, so that decrementing the + color index periodically will simulate the remanence of a cathode ray tube. +*/ +static const UINT8 pdp1_colors[] = +{ + 0x00,0x00,0x00, /* black */ + 0xFF,0xFF,0xFF, /* white */ + 0x00,0xFF,0x00, /* green */ + 0x00,0x40,0x00, /* dark green */ + 0xFF,0x00,0x00, /* red */ + 0x80,0x80,0x80 /* light gray */ +}; + +static const UINT8 pdp1_palette[] = +{ + pen_panel_bg, pen_panel_caption, + pen_typewriter_bg, pen_black, + pen_typewriter_bg, pen_red +}; + +static const UINT8 total_colors_needed = pen_crt_num_levels + sizeof(pdp1_colors) / 3; + +static GFXDECODE_START( pdp1 ) + GFXDECODE_ENTRY( "gfx1", 0, fontlayout, pen_crt_num_levels + sizeof(pdp1_colors) / 3, 3 ) +GFXDECODE_END + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(pdp1_state, pdp1) +{ + /* rgb components for the two color emissions */ + const double r1 = .1, g1 = .1, b1 = .924, r2 = .7, g2 = .7, b2 = .076; + /* half period in seconds for the two color emissions */ + const double half_period_1 = .05, half_period_2 = .20; + /* refresh period in seconds */ + const double update_period = 1./refresh_rate; + double decay_1, decay_2; + double cur_level_1, cur_level_2; + UINT8 i, r, g, b; + + /* initialize CRT palette */ + + /* compute the decay factor per refresh frame */ + decay_1 = pow(.5, update_period / half_period_1); + decay_2 = pow(.5, update_period / half_period_2); + + cur_level_1 = cur_level_2 = 255.; /* start with maximum level */ + + for (i=pen_crt_max_intensity; i>0; i--) + { + /* compute the current color */ + r = (int) ((r1*cur_level_1 + r2*cur_level_2) + .5); + g = (int) ((g1*cur_level_1 + g2*cur_level_2) + .5); + b = (int) ((b1*cur_level_1 + b2*cur_level_2) + .5); + /* write color in palette */ + m_palette->set_indirect_color(i, rgb_t(r, g, b)); + /* apply decay for next iteration */ + cur_level_1 *= decay_1; + cur_level_2 *= decay_2; + } + + m_palette->set_indirect_color(0, rgb_t(0, 0, 0)); + + /* load static palette */ + for ( i = 0; i < 6; i++ ) + { + r = pdp1_colors[i*3]; g = pdp1_colors[i*3+1]; b = pdp1_colors[i*3+2]; + m_palette->set_indirect_color(pen_crt_num_levels + i, rgb_t(r, g, b)); + } + + /* copy colortable to palette */ + for( i = 0; i < total_colors_needed; i++ ) + m_palette->set_pen_indirect(i, i); + + /* set up palette for text */ + for( i = 0; i < 6; i++ ) + m_palette->set_pen_indirect(total_colors_needed + i, pdp1_palette[i]); +} + + +/* + pdp1 machine code + + includes emulation for I/O devices (with the IOT opcode) and control panel functions + + TODO: + * typewriter out should overwrite the typewriter buffer + * improve emulation of the internals of tape reader? + * improve puncher timing? +*/ + + +/* This flag makes the emulated pdp-1 trigger a sequence break request when a character has been +typed on the typewriter keyboard. It is useful in order to test sequence break, but we need +to emulate a connection box in which we can connect each wire to any interrupt line. Also, +we need to determine the exact relationship between the status register and the sequence break +system (both standard and type 20). */ +#define USE_SBS 0 + +#define LOG_IOT 0 +#define LOG_IOT_EXTRA 0 + +/* IOT completion may take much more than the 5us instruction time. A possible programming +error would be to execute an IOT before the last IOT of the same kind is over: such a thing +would confuse the targeted IO device, which might ignore the latter IOT, execute either +or both IOT incompletely, or screw up completely. I insist that such an error can be caused +by a pdp-1 programming error, even if there is no emulator error. */ +#define LOG_IOT_OVERLAP 0 + +static void pdp1_tape_read_binary(device_t *device); +static void pdp1_io_sc_callback(device_t *device); + +static void iot_rpa(device_t *device, int op2, int nac, int mb, int *io, int ac); +static void iot_rpb(device_t *device, int op2, int nac, int mb, int *io, int ac); +static void iot_rrb(device_t *device, int op2, int nac, int mb, int *io, int ac); +static void iot_ppa(device_t *device, int op2, int nac, int mb, int *io, int ac); +static void iot_ppb(device_t *device, int op2, int nac, int mb, int *io, int ac); + +static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac); +static void iot_tyi(device_t *device, int op2, int nac, int mb, int *io, int ac); + +static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac); + +static void iot_dia(device_t *device, int op2, int nac, int mb, int *io, int ac); +static void iot_dba(device_t *device, int op2, int nac, int mb, int *io, int ac); +static void iot_dcc(device_t *device, int op2, int nac, int mb, int *io, int ac); +static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac); + +static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac); + +static void iot_cks(device_t *device, int op2, int nac, int mb, int *io, int ac); + + +/* + devices which are known to generate a completion pulse (source: maintenance manual 9-??, + and 9-20, 9-21): + emulated: + * perforated tape reader + * perforated tape punch + * typewriter output + * CRT display + unemulated: + * card punch (pac: 43) + * line printer (lpr, lsp, but NOT lfb) + + This list should probably include additional optional devices (card reader comes to mind). +*/ + +/* IO status word */ + +/* defines for io_status bits */ +enum +{ + io_st_pen = 0400000, /* light pen: light has hit the pen */ + io_st_ptr = 0200000, /* perforated tape reader: reader buffer full */ + io_st_tyo = 0100000, /* typewriter out: device ready */ + io_st_tyi = 0040000, /* typewriter in: new character in buffer */ + io_st_ptp = 0020000 /* perforated tape punch: device ready */ +}; + + + + + + + +/* crt display timer */ + +/* light pen config */ + + + +#define PARALLEL_DRUM_WORD_TIME attotime::from_nsec(8500) +#define PARALLEL_DRUM_ROTATION_TIME attotime::from_nsec(8500*4096) + + +static pdp1_reset_param_t pdp1_reset_param = +{ + { /* external iot handlers. NULL means that the iot is unimplemented, unless there are + parentheses around the iot name, in which case the iot is internal to the cpu core. */ + /* I put a ? when the source is the handbook, since a) I have used the maintenance manual + as the primary source (as it goes more into details) b) the handbook and the maintenance + manual occasionnally contradict each other. */ + /* dia, dba, dcc, dra are documented in MIT PDP-1 COMPUTER MODIFICATION + BULLETIN no. 2 (drumInstrWriteup.bin/drumInstrWriteup.txt), and are + similar to IOT documented in Parallel Drum Type 23 Instruction Manual. */ + /* (iot) rpa rpb tyo tyi ppa ppb dpy */ + NULL, iot_rpa, iot_rpb, iot_tyo, iot_tyi, iot_ppa, iot_ppb, iot_dpy, + /* spacewar */ + NULL, iot_011, NULL, NULL, NULL, NULL, NULL, NULL, + /* lag glf?/jsp? gpl?/gpr?/gcf? */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* rrb rcb? rcc? cks mcs mes mel */ + iot_rrb, NULL, NULL, iot_cks, NULL, NULL, NULL, NULL, + /* cad? rac? rbc? pac lpr/lfb/lsp swc/sci/sdf?/shr? scv? */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* (dsc) (asc) (isb) (cac) (lsm) (esm) (cbs) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* icv? dia dba dcc dra mri|rlc? mrf/inr?/ccr? */ + NULL, iot_dia, iot_dba, iot_dcc, iot_dra, NULL, NULL, NULL, + /* mcb|dur? mwc|mtf? mrc|sfc?... msm|cgo? (eem/lem) mic muf */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + }, + pdp1_tape_read_binary, + pdp1_io_sc_callback, + 0, /* extend mode support defined in input ports and pdp1_init_machine */ + 0, /* hardware multiply/divide support defined in input ports and pdp1_init_machine */ + 0 /* type 20 sequence break system support defined in input ports and pdp1_init_machine */ +}; + +void pdp1_state::machine_reset() +{ + int cfg = m_cfg->read(); + + pdp1_reset_param.extend_support = (cfg >> pdp1_config_extend_bit) & pdp1_config_extend_mask; + pdp1_reset_param.hw_mul_div = (cfg >> pdp1_config_hw_mul_div_bit) & pdp1_config_hw_mul_div_mask; + pdp1_reset_param.type_20_sbs = (cfg >> pdp1_config_type_20_sbs_bit) & pdp1_config_type_20_sbs_mask; + + /* reset device state */ + m_tape_reader.rcl = m_tape_reader.rc = 0; + m_io_status = io_st_tyo | io_st_ptp; + m_lightpen.active = m_lightpen.down = 0; + m_lightpen.x = m_lightpen.y = 0; + m_lightpen.radius = 10; /* ??? */ + pdp1_update_lightpen_state(&m_lightpen); +} + + +void pdp1_state::pdp1_machine_stop() +{ + /* the core will take care of freeing the timers, BUT we must set the variables + to NULL if we don't want to risk confusing the tape image init function */ + m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.tyo_timer = m_dpy_timer = NULL; +} + + +/* + driver init function + + Set up the pdp1_memory pointer, and generate font data. +*/ +void pdp1_state::machine_start() +{ + UINT8 *dst; + + static const unsigned char fontdata6x8[pdp1_fontdata_size] = + { /* ASCII characters */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00, + 0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08, + 0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00, + 0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00, + 0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00, + 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00, + 0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00, + 0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, + 0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00, + 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00, + 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60, + 0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, + 0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, + 0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, + 0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, + 0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, + 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00, + 0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, + 0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08, + 0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, + 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00, + 0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00, + 0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00, + 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00, + 0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc, + 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, + 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00, + 0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, + 0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, + 0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00, + 0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00, + 0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, + 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, + 0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, + 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00, + 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00, + 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, + 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, + 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00, + + /* non-spacing middle dot */ + 0x00, + 0x00, + 0x00, + 0x20, + 0x00, + 0x00, + 0x00, + 0x00, + /* non-spacing overstrike */ + 0x00, + 0x00, + 0x00, + 0x00, + 0xfc, + 0x00, + 0x00, + 0x00, + /* implies */ + 0x00, + 0x00, + 0x70, + 0x08, + 0x08, + 0x08, + 0x70, + 0x00, + /* or */ + 0x88, + 0x88, + 0x88, + 0x50, + 0x50, + 0x50, + 0x20, + 0x00, + /* and */ + 0x20, + 0x50, + 0x50, + 0x50, + 0x88, + 0x88, + 0x88, + 0x00, + /* up arrow */ + 0x20, + 0x70, + 0xa8, + 0x20, + 0x20, + 0x20, + 0x20, + 0x00, + /* right arrow */ + 0x00, + 0x20, + 0x10, + 0xf8, + 0x10, + 0x20, + 0x00, + 0x00, + /* multiply */ + 0x00, + 0x88, + 0x50, + 0x20, + 0x50, + 0x88, + 0x00, + 0x00, + }; + + /* set up our font */ + dst = memregion("gfx1")->base(); + memcpy(dst, fontdata6x8, pdp1_fontdata_size); + + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_state::pdp1_machine_stop),this)); + + m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::reader_callback),this)); + m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::puncher_callback),this)); + m_typewriter.tyo_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::tyo_callback),this)); + m_dpy_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::dpy_callback),this)); + m_tape_reader.timer->adjust(attotime::zero, 0, attotime::from_hz(2500)); + m_tape_reader.timer->enable(0); +} + + +/* + perforated tape handling +*/ + +class pdp1_readtape_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + pdp1_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 0; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "tap,rim"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type PDP1_READTAPE = &device_creator; + +pdp1_readtape_image_device::pdp1_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PDP1_READTAPE, "PDP1 Tape Reader", tag, owner, clock, "pdp1_readtape_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +class pdp1_punchtape_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + pdp1_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } + + virtual bool is_readable() const { return 0; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "tap,rim"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type PDP1_PUNCHTAPE = &device_creator; + +pdp1_punchtape_image_device::pdp1_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PDP1_PUNCHTAPE, "PDP1 Tape Puncher", tag, owner, clock, "pdp1_punchtape_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + + +class pdp1_printer_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + pdp1_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_PRINTER; } + + virtual bool is_readable() const { return 0; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "typ"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type PDP1_PRINTER = &device_creator; + +pdp1_printer_image_device::pdp1_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PDP1_PRINTER, "PDP1 Typewriter", tag, owner, clock, "pdp1_printer_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +class pdp1_cylinder_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + pdp1_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_CYLINDER; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "drm"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type PDP1_CYLINDER = &device_creator; + +pdp1_cylinder_image_device::pdp1_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PDP1_CYLINDER, "PDP1 Cylinder", tag, owner, clock, "pdp1_cylinder_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +/* + Open a perforated tape image +*/ +bool pdp1_readtape_image_device::call_load() +{ + pdp1_state *state = machine().driver_data(); + + /* reader unit */ + state->m_tape_reader.fd = this; + + /* start motor */ + state->m_tape_reader.motor_on = 1; + + /* restart reader IO when necessary */ + /* note that this function may be called before pdp1_init_machine, therefore + before state->m_tape_reader.timer is allocated. It does not matter, as the clutch is never + down at power-up, but we must not call timer_enable with a NULL parameter! */ + + if (state->m_tape_reader.timer) + { + if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl) + { + state->m_tape_reader.timer->enable(1); + } + else + { + state->m_tape_reader.timer->enable(0); + } + } + + return IMAGE_INIT_PASS; +} + +void pdp1_readtape_image_device::call_unload() +{ + pdp1_state *state = machine().driver_data(); + + /* reader unit */ + state->m_tape_reader.fd = NULL; + + /* stop motor */ + state->m_tape_reader.motor_on = 0; + + if (state->m_tape_reader.timer) + state->m_tape_reader.timer->enable(0); +} + +/* + Read a byte from perforated tape +*/ +int pdp1_state::tape_read(UINT8 *reply) +{ + if (m_tape_reader.fd && (m_tape_reader.fd->fread(reply, 1) == 1)) + return 0; /* unit OK */ + else + return 1; /* unit not ready */ +} + + +/* + common code for tape read commands (RPA, RPB, and read-in mode) +*/ +void pdp1_state::begin_tape_read( int binary, int nac) +{ + m_tape_reader.rb = 0; + m_tape_reader.rcl = 1; + m_tape_reader.rc = (binary) ? 1 : 3; + m_tape_reader.rby = (binary) ? 1 : 0; + m_tape_reader.rcp = nac; + + if (LOG_IOT_OVERLAP) + { + if (m_tape_reader.timer->enable(0)) + logerror("Error: overlapped perforated tape reads (Read-in mode, RPA/RPB instruction)\n"); + } + /* set up delay if tape is advancing */ + if (m_tape_reader.motor_on && m_tape_reader.rcl) + { + /* delay is approximately 1/400s */ + m_tape_reader.timer->enable(1); + } + else + { + m_tape_reader.timer->enable(0); + } +} + +/* + timer callback to simulate reader IO +*/ +TIMER_CALLBACK_MEMBER(pdp1_state::reader_callback) +{ + int not_ready; + UINT8 data; + + if (m_tape_reader.rc) + { + not_ready = tape_read(& data); + if (not_ready) + { + m_tape_reader.motor_on = 0; /* let us stop the motor */ + } + else + { + if ((! m_tape_reader.rby) || (data & 0200)) + { + m_tape_reader.rb |= (m_tape_reader.rby) ? (data & 077) : data; + + if (m_tape_reader.rc != 3) + { + m_tape_reader.rb <<= 6; + } + + m_tape_reader.rc = (m_tape_reader.rc+1) & 3; + + if (m_tape_reader.rc == 0) + { /* IO complete */ + m_tape_reader.rcl = 0; + if (m_tape_reader.rcp) + { + m_maincpu->set_state_int(PDP1_IO, m_tape_reader.rb); /* transfer reader buffer to IO */ + m_maincpu->set_state_int(PDP1_IOS,1); + } + else + m_io_status |= io_st_ptr; + } + } + } + } + + if (m_tape_reader.motor_on && m_tape_reader.rcl) + { + m_tape_reader.timer->enable(1); + } + else + { + m_tape_reader.timer->enable(0); + } +} + +/* + Initiate read of a 18-bit word in binary format from tape (used in read-in mode) +*/ +void pdp1_tape_read_binary(device_t *device) +{ + pdp1_state *state = device->machine().driver_data(); + state->begin_tape_read(1, 1); +} + +/* + perforated tape reader iot callbacks +*/ + +/* + rpa iot callback + + op2: iot command operation (equivalent to mb & 077) + nac: nead a completion pulse + mb: contents of the MB register + io: pointer on the IO register + ac: contents of the AC register +*/ +/* + * Read Perforated Tape, Alphanumeric + * rpa Address 0001 + * + * This instruction reads one line of tape (all eight Channels) and transfers the resulting 8-bit code to + * the Reader Buffer. If bits 5 and 6 of the rpa function are both zero (720001), the contents of the + * Reader Buffer must be transferred to the IO Register by executing the rrb instruction. When the Reader + * Buffer has information ready to be transferred to the IO Register, Status Register Bit 1 is set to + * one. If bits 5 and 6 are different (730001 or 724001) the 8-bit code read from tape is automatically + * transferred to the IO Register via the Reader Buffer and appears as follows: + * + * IO Bits 10 11 12 13 14 15 16 17 + * TAPE CHANNELS 8 7 6 5 4 3 2 1 + */ +static void iot_rpa(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + if (LOG_IOT_EXTRA) + logerror("Warning, RPA instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + + state->begin_tape_read(0, nac); +} + +/* + rpb iot callback +*/ +/* + * Read Perforated Tape, Binary rpb + * Address 0002 + * + * The instruction reads three lines of tape (six Channels per line) and assembles + * the resulting 18-bit word in the Reader Buffer. For a line to be recognized by + * this instruction Channel 8 must be punched (lines with Channel 8 not punched will + * be skipped over). Channel 7 is ignored. The instruction sub 5137, for example, + * appears on tape and is assembled by rpb as follows: + * + * Channel 8 7 6 5 4 | 3 2 1 + * Line 1 X X | X + * Line 2 X X X | X + * Line 3 X X X | X X X + * Reader Buffer 100 010 101 001 011 111 + * + * (Vertical dashed line indicates sprocket holes and the symbols "X" indicate holes + * punched in tape). + * + * If bits 5 and 6 of the rpb instruction are both zero (720002), the contents of + * the Reader Buffer must be transferred to the IO Register by executing + * a rrb instruction. When the Reader Buffer has information ready to be transferred + * to the IO Register, Status Register Bit 1 is set to one. If bits 5 and 6 are + * different (730002 or 724002) the 18-bit word read from tape is automatically + * transferred to the IO Register via the Reader Buffer. + */ +static void iot_rpb(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + if (LOG_IOT_EXTRA) + logerror("Warning, RPB instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + + state->begin_tape_read(1, nac); +} + +/* + rrb iot callback +*/ +static void iot_rrb(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + if (LOG_IOT_EXTRA) + logerror("RRB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + + *io = state->m_tape_reader.rb; + state->m_io_status &= ~io_st_ptr; +} + + +bool pdp1_punchtape_image_device::call_load() +{ + pdp1_state *state = machine().driver_data(); + + /* punch unit */ + state->m_tape_puncher.fd = this; + + return IMAGE_INIT_PASS; +} + +void pdp1_punchtape_image_device::call_unload() +{ + pdp1_state *state = machine().driver_data(); + + /* punch unit */ + state->m_tape_puncher.fd = NULL; +} + +/* + Write a byte to perforated tape +*/ +void pdp1_state::tape_write(UINT8 data) +{ + if (m_tape_puncher.fd) + m_tape_puncher.fd->fwrite(& data, 1); +} + +/* + timer callback to generate punch completion pulse +*/ +TIMER_CALLBACK_MEMBER(pdp1_state::puncher_callback) +{ + int nac = param; + m_io_status |= io_st_ptp; + if (nac) + { + m_maincpu->set_state_int(PDP1_IOS,1); + } +} + +/* + perforated tape punch iot callbacks +*/ + +/* + ppa iot callback +*/ +/* + * Punch Perforated Tape, Alphanumeric + * ppa Address 0005 + * + * For each In-Out Transfer instruction one line of tape is punched. In-Out Register + * Bit 17 conditions Hole 1. Bit 16 conditions Hole 2, etc. Bit 10 conditions Hole 8 + */ +static void iot_ppa(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + if (LOG_IOT_EXTRA) + logerror("PPA instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + + state->tape_write(*io & 0377); + state->m_io_status &= ~io_st_ptp; + /* delay is approximately 1/63.3 second */ + if (LOG_IOT_OVERLAP) + { + if (state->m_tape_puncher.timer->enable(0)) + logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + } + + state->m_tape_puncher.timer->adjust(attotime::from_usec(15800), nac); +} + +/* + ppb iot callback +*/ +/* + * Punch Perforated Tape, Binary + * ppb Addres 0006 + * + * For each In-Out Transfer instruction one line of tape is punched. In-Out Register + * Bit 5 conditions Hole 1. Bit 4 conditions Hole 2, etc. Bit 0 conditions Hole 6. + * Hole 7 is left blank. Hole 8 is always punched in this mode. + */ +static void iot_ppb(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + if (LOG_IOT_EXTRA) + logerror("PPB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + + state->tape_write((*io >> 12) | 0200); + state->m_io_status &= ~io_st_ptp; + /* delay is approximately 1/63.3 second */ + if (LOG_IOT_OVERLAP) + { + if (state->m_tape_puncher.timer->enable(0)) + logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + } + state->m_tape_puncher.timer->adjust(attotime::from_usec(15800), nac); +} + + +/* + Typewriter handling + + The alphanumeric on-line typewriter is a standard device on pdp-1: it + can both handle keyboard input and print output text. +*/ + +/* + Open a file for typewriter output +*/ +bool pdp1_printer_image_device::call_load() +{ + pdp1_state *state = machine().driver_data(); + /* open file */ + state->m_typewriter.fd = this; + + state->m_io_status |= io_st_tyo; + + return IMAGE_INIT_PASS; +} + +void pdp1_printer_image_device::call_unload() +{ + pdp1_state *state = machine().driver_data(); + state->m_typewriter.fd = NULL; +} + +/* + Write a character to typewriter +*/ +void pdp1_state::typewriter_out(UINT8 data) +{ + if (LOG_IOT_EXTRA) + logerror("typewriter output %o\n", data); + + pdp1_typewriter_drawchar(data); + if (m_typewriter.fd) +#if 1 + m_typewriter.fd->fwrite(& data, 1); +#else + { + static const char ascii_table[2][64] = + { /* n-s = non-spacing */ + { /* lower case */ + ' ', '1', '2', '3', + '4', '5', '6', '7', + '8', '9', '*', '*', + '*', '*', '*', '*', + '0', '/', 's', 't', + 'u', 'v', 'w', 'x', + 'y', 'z', '*', ',', + '*',/*black*/ '*',/*red*/ '*',/*Tab*/ '*', + '\200',/*n-s middle dot*/'j', 'k', 'l', + 'm', 'n', 'o', 'p', + 'q', 'r', '*', '*', + '-', ')', '\201',/*n-s overstrike*/'(', + '*', 'a', 'b', 'c', + 'd', 'e', 'f', 'g', + 'h', 'i', '*',/*Lower Case*/ '.', + '*',/*Upper Case*/ '*',/*Backspace*/ '*', '*'/*Carriage Return*/ + }, + { /* upper case */ + ' ', '"', '\'', '~', + '\202',/*implies*/ '\203',/*or*/ '\204',/*and*/ '<', + '>', '\205',/*up arrow*/ '*', '*', + '*', '*', '*', '*', + '\206',/*right arrow*/'?', 'S', 'T', + 'U', 'V', 'W', 'X', + 'Y', 'Z', '*', '=', + '*',/*black*/ '*',/*red*/ '\t',/*Tab*/ '*', + '_',/*n-s???*/ 'J', 'K', 'L', + 'M', 'N', 'O', 'P', + 'Q', 'R', '*', '*', + '+', ']', '|',/*n-s???*/ '[', + '*', 'A', 'B', 'C', + 'D', 'E', 'F', 'G', + 'H', 'I', '*',/*Lower Case*/ '\207',/*multiply*/ + '*',/*Upper Case*/ '\b',/*Backspace*/ '*', '*'/*Carriage Return*/ + } + }; + + data &= 0x3f; + + switch (data) + { + case 034: + /* Black: ignore */ + //color = color_typewriter_black; + { + static const char black[5] = { '\033', '[', '3', '0', 'm' }; + image_fwrite(m_typewriter.fd, black, sizeof(black)); + } + break; + + case 035: + /* Red: ignore */ + //color = color_typewriter_red; + { + static const char red[5] = { '\033', '[', '3', '1', 'm' }; + image_fwrite(m_typewriter.fd, red, sizeof(red)); + } + break; + + case 072: + /* Lower case */ + m_case_shift = 0; + break; + + case 074: + /* Upper case */ + m_case_shift = 1; + break; + + case 077: + /* Carriage Return */ + { + static const char line_end[2] = { '\r', '\n' }; + image_fwrite(m_typewriter.fd, line_end, sizeof(line_end)); + } + break; + + default: + /* Any printable character... */ + + if ((data != 040) && (data != 056)) /* 040 and 056 are non-spacing characters: don't try to print right now */ + /* print character (lookup ASCII equivalent in table) */ + image_fwrite(m_typewriter.fd, & ascii_table[m_case_shift][data], 1); + + break; + } + } +#endif +} + +/* + timer callback to generate typewriter completion pulse +*/ +TIMER_CALLBACK_MEMBER(pdp1_state::tyo_callback) +{ + int nac = param; + m_io_status |= io_st_tyo; + if (nac) + { + m_maincpu->set_state_int(PDP1_IOS,1); + } +} + +/* + tyo iot callback +*/ +static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + int ch, delay; + + if (LOG_IOT_EXTRA) + logerror("Warning, TYO instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + + ch = (*io) & 077; + + state->typewriter_out(ch); + state->m_io_status &= ~io_st_tyo; + + /* compute completion delay (source: maintenance manual 9-12, 9-13 and 9-14) */ + switch (ch) + { + case 072: /* lower-case */ + case 074: /* upper-case */ + case 034: /* black */ + case 035: /* red */ + delay = 175; /* approximately 175ms (?) */ + break; + + case 077: /* carriage return */ + delay = 205; /* approximately 205ms (?) */ + break; + + default: + delay = 105; /* approximately 105ms */ + break; + } + if (LOG_IOT_OVERLAP) + { + if (state->m_typewriter.tyo_timer->enable(0)) + logerror("Error: overlapped TYO instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + } + + state->m_typewriter.tyo_timer->adjust(attotime::from_msec(delay), nac); +} + +/* + tyi iot callback +*/ +/* When a typewriter key is struck, the code for the struck key is placed in the + * typewriter buffer, Program Flag 1 is set, and the type-in status bit is set to + * one. A program designed to accept typed-in data would periodically check + * Program Flag 1, and if found to be set, an In-Out Transfer Instruction with + * address 4 could be executed for the information to be transferred to the + * In-Out Register. This In-Out Transfer should not use the optional in-out wait. + * The information contained in the typewriter buffer is then transferred to the + * right six bits of the In-Out Register. The tyi instruction automatically + * clears the In-Out Register before transferring the information and also clears + * the type-in status bit. + */ +static void iot_tyi(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + if (LOG_IOT_EXTRA) + logerror("Warning, TYI instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + + *io = state->m_typewriter.tb; + if (! (state->m_io_status & io_st_tyi)) + *io |= 0100; + else + { + state->m_io_status &= ~io_st_tyi; + if (USE_SBS) + state->m_maincpu->set_input_line_and_vector(0, CLEAR_LINE, 0); /* interrupt it, baby */ + } +} + + +/* + * PRECISION CRT DISPLAY (TYPE 30) + * + * This sixteen-inch cathode ray tube display is intended to be used as an on-line output device for the + * PDP-1. It is useful for high speed presentation of graphs, diagrams, drawings, and alphanumerical + * information. The unit is solid state, self-powered and completely buffered. It has magnetic focus and + * deflection. + * + * Display characteristics are as follows: + * + * Random point plotting + * Accuracy of points +/-3 per cent of raster size + * Raster size 9.25 by 9.25 inches + * 1024 by 1024 addressable locations + * Fixed origin at center of CRT + * Ones complement binary arithmetic + * Plots 20,000 points per second + * + * Resolution is such that 512 points along each axis are discernable on the face of the tube. + * + * One instruction is added to the PDP-1 with the installation of this display: + * + * Display One Point On CRT + * dpy Address 0007 + * + * This instruction clears the light pen status bit and displays one point using bits 0 through 9 of the + * AC to represent the (signed) X coordinate of the point and bits 0 through 9 of the IO as the (signed) + * Y coordinate. + * + * Many variations of the Type 30 Display are available. Some of these include hardware for line and + * curve generation. + */ + + +/* + timer callback to generate crt completion pulse +*/ +TIMER_CALLBACK_MEMBER(pdp1_state::dpy_callback) +{ + m_maincpu->set_state_int(PDP1_IOS,1); +} + + +/* + dpy iot callback + + Light on one pixel on CRT +*/ +static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + int x; + int y; + + + x = ((ac+0400000) & 0777777) >> 8; + y = (((*io)+0400000) & 0777777) >> 8; + state->pdp1_plot(x, y); + + /* light pen 32 support */ + state->m_io_status &= ~io_st_pen; + + if (state->m_lightpen.down && ((x-state->m_lightpen.x)*(x-state->m_lightpen.x)+(y-state->m_lightpen.y)*(y-state->m_lightpen.y) < state->m_lightpen.radius*state->m_lightpen.radius)) + { + state->m_io_status |= io_st_pen; + + state->m_maincpu->set_state_int(PDP1_PF3, 1); + } + + if (nac) + { + /* 50us delay */ + if (LOG_IOT_OVERLAP) + { + /* note that overlap detection is incomplete: it will only work if both DPY + instructions require a completion pulse */ + if (state->m_dpy_timer->enable(0)) + logerror("Error: overlapped DPY instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + } + state->m_dpy_timer->adjust(attotime::from_usec(50)); + } +} + + + +/* + MIT parallel drum (variant of type 23) +*/ + +void pdp1_state::parallel_drum_set_il(int il) +{ + attotime il_phase; + + m_parallel_drum.il = il; + + il_phase = ((PARALLEL_DRUM_WORD_TIME * il) - m_parallel_drum.rotation_timer->elapsed()); + if (il_phase < attotime::zero) + il_phase = il_phase + PARALLEL_DRUM_ROTATION_TIME; + m_parallel_drum.il_timer->adjust(il_phase, 0, PARALLEL_DRUM_ROTATION_TIME); +} + +#ifdef UNUSED_FUNCTION +TIMER_CALLBACK_MEMBER(pdp1_state::il_timer_callback) +{ + if (m_parallel_drum.dba) + { + /* set break request and status bit 5 */ + /* ... */ + } +} + +void pdp1_state::parallel_drum_init(pdp1_state *state) +{ + m_parallel_drum.rotation_timer = machine().scheduler().timer_alloc(); + m_parallel_drum.rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME); + + m_parallel_drum.il_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::il_timer_callback),this)); + parallel_drum_set_il(0); +} +#endif + +/* + Open a file for drum +*/ +bool pdp1_cylinder_image_device::call_load() +{ + pdp1_state *state = machine().driver_data(); + /* open file */ + state->m_parallel_drum.fd = this; + + return IMAGE_INIT_PASS; +} + +void pdp1_cylinder_image_device::call_unload() +{ + pdp1_state *state = machine().driver_data(); + state->m_parallel_drum.fd = NULL; +} + +static void iot_dia(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + state->m_parallel_drum.wfb = ((*io) & 0370000) >> 12; + state->parallel_drum_set_il((*io) & 0007777); + + state->m_parallel_drum.dba = 0; /* right? */ +} + +static void iot_dba(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + state->m_parallel_drum.wfb = ((*io) & 0370000) >> 12; + state->parallel_drum_set_il((*io) & 0007777); + + state->m_parallel_drum.dba = 1; +} + +/* + Read a word from drum +*/ +UINT32 pdp1_state::drum_read(int field, int position) +{ + int offset = (field*4096+position)*3; + UINT8 buf[3]; + + if (m_parallel_drum.fd && (!m_parallel_drum.fd->fseek(offset, SEEK_SET)) && (m_parallel_drum.fd->fread( buf, 3) == 3)) + return ((buf[0] << 16) | (buf[1] << 8) | buf[2]) & 0777777; + + return 0; +} + +/* + Write a word to drum +*/ +void pdp1_state::drum_write(int field, int position, UINT32 data) +{ + int offset = (field*4096+position)*3; + UINT8 buf[3]; + + if (m_parallel_drum.fd) + { + buf[0] = data >> 16; + buf[1] = data >> 8; + buf[2] = data; + + m_parallel_drum.fd->fseek(offset, SEEK_SET); + m_parallel_drum.fd->fwrite( buf, 3); + } +} + +static void iot_dcc(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + attotime delay; + int dc; + + state->m_parallel_drum.rfb = ((*io) & 0370000) >> 12; + state->m_parallel_drum.wc = - ((*io) & 0007777); + + state->m_parallel_drum.wcl = ac & 0177777/*0007777???*/; + + state->m_parallel_drum.dba = 0; /* right? */ + /* clear status bit 5... */ + + /* do transfer */ + delay = state->m_parallel_drum.il_timer->remaining(); + dc = state->m_parallel_drum.il; + do + { + if ((state->m_parallel_drum.wfb >= 1) && (state->m_parallel_drum.wfb <= 22)) + { + state->drum_write(state->m_parallel_drum.wfb-1, dc, (signed)state->m_maincpu->space(AS_PROGRAM).read_dword(state->m_parallel_drum.wcl<<2)); + } + + if ((state->m_parallel_drum.rfb >= 1) && (state->m_parallel_drum.rfb <= 22)) + { + state->m_maincpu->space(AS_PROGRAM).write_dword(state->m_parallel_drum.wcl<<2, state->drum_read(state->m_parallel_drum.rfb-1, dc)); + } + + state->m_parallel_drum.wc = (state->m_parallel_drum.wc+1) & 07777; + state->m_parallel_drum.wcl = (state->m_parallel_drum.wcl+1) & 0177777/*0007777???*/; + dc = (dc+1) & 07777; + if (state->m_parallel_drum.wc) + delay = delay + PARALLEL_DRUM_WORD_TIME; + } while (state->m_parallel_drum.wc); + state->m_maincpu->adjust_icount(-state->m_maincpu->attotime_to_cycles(delay)); + /* if no error, skip */ + state->m_maincpu->set_state_int(PDP1_PC, state->m_maincpu->state_int(PDP1_PC)+1); +} + +static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + (*io) = (state->m_parallel_drum.rotation_timer->elapsed() * + (ATTOSECONDS_PER_SECOND / (PARALLEL_DRUM_WORD_TIME.as_attoseconds()))).seconds() & 0007777; + + /* set parity error and timing error... */ +} + + + +/* + iot 11 callback + + Read state of Spacewar! controllers + + Not documented, except a few comments in the Spacewar! source code: + it should leave the control word in the io as follows. + high order 4 bits, rotate ccw, rotate cw, (both mean hyperspace) + fire rocket, and fire torpedo. low order 4 bits, same for + other ship. routine is entered by jsp cwg. +*/ +static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + int key_state = device->machine().driver_data()->read_spacewar(); + int reply; + + + reply = 0; + + if (key_state & ROTATE_RIGHT_PLAYER2) + reply |= 0400000; + if (key_state & ROTATE_LEFT_PLAYER2) + reply |= 0200000; + if (key_state & THRUST_PLAYER2) + reply |= 0100000; + if (key_state & FIRE_PLAYER2) + reply |= 0040000; + if (key_state & HSPACE_PLAYER2) + reply |= 0600000; + + if (key_state & ROTATE_RIGHT_PLAYER1) + reply |= 010; + if (key_state & ROTATE_LEFT_PLAYER1) + reply |= 004; + if (key_state & THRUST_PLAYER1) + reply |= 002; + if (key_state & FIRE_PLAYER1) + reply |= 001; + if (key_state & HSPACE_PLAYER1) + reply |= 014; + + *io = reply; +} + + +/* + cks iot callback + + check IO status +*/ +static void iot_cks(device_t *device, int op2, int nac, int mb, int *io, int ac) +{ + pdp1_state *state = device->machine().driver_data(); + if (LOG_IOT_EXTRA) + logerror("CKS instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); + + *io = state->m_io_status; +} + + +/* + callback which is called when Start Clear is pulsed + + IO devices should reset +*/ +void pdp1_io_sc_callback(device_t *device) +{ + pdp1_state *state = device->machine().driver_data(); + state->m_tape_reader.rcl = state->m_tape_reader.rc = 0; + if (state->m_tape_reader.timer) + state->m_tape_reader.timer->enable(0); + + if (state->m_tape_puncher.timer) + state->m_tape_puncher.timer->enable(0); + + if (state->m_typewriter.tyo_timer) + state->m_typewriter.tyo_timer->enable(0); + + if (state->m_dpy_timer) + state->m_dpy_timer->enable(0); + + state->m_io_status = io_st_tyo | io_st_ptp; +} + + +/* + typewriter keyboard handler +*/ +void pdp1_state::pdp1_keyboard() +{ + int i; + int j; + + int typewriter_keys[4]; + + int typewriter_transitions; + + + for (i=0; i<4; i++) + { + typewriter_keys[i] = m_twr[i]->read(); + } + + for (i=0; i<4; i++) + { + typewriter_transitions = typewriter_keys[i] & (~ m_old_typewriter_keys[i]); + if (typewriter_transitions) + { + for (j=0; (((typewriter_transitions >> j) & 1) == 0) /*&& (j<16)*/; j++) + ; + m_typewriter.tb = (i << 4) + j; + m_io_status |= io_st_tyi; + #if USE_SBS + m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0); /* interrupt it, baby */ + #endif + m_maincpu->set_state_int(PDP1_PF1, 1); + pdp1_typewriter_drawchar(m_typewriter.tb); /* we want to echo input */ + break; + } + } + + for (i=0; i<4; i++) + m_old_typewriter_keys[i] = typewriter_keys[i]; +} + +void pdp1_state::pdp1_lightpen() +{ + int x_delta, y_delta; + int current_state = m_io_lightpen->read(); + + m_lightpen.active = (m_cfg->read() >> pdp1_config_lightpen_bit) & pdp1_config_lightpen_mask; + + /* update pen down state */ + m_lightpen.down = m_lightpen.active && (current_state & pdp1_lightpen_down); + + /* update size of pen tip hole */ + if ((current_state & ~m_old_lightpen) & pdp1_lightpen_smaller) + { + m_lightpen.radius --; + if (m_lightpen.radius < 0) + m_lightpen.radius = 0; + } + if ((current_state & ~m_old_lightpen) & pdp1_lightpen_larger) + { + m_lightpen.radius ++; + if (m_lightpen.radius > 32) + m_lightpen.radius = 32; + } + + m_old_lightpen = current_state; + + /* update pen position */ + x_delta = m_lightx->read(); + y_delta = m_lighty->read(); + + if (x_delta >= 0x80) + x_delta -= 0x100; + if (y_delta >= 0x80) + y_delta -= 256; + + m_lightpen.x += x_delta; + m_lightpen.y += y_delta; + + if (m_lightpen.x < 0) + m_lightpen.x = 0; + if (m_lightpen.x > 1023) + m_lightpen.x = 1023; + if (m_lightpen.y < 0) + m_lightpen.y = 0; + if (m_lightpen.y > 1023) + m_lightpen.y = 1023; + + pdp1_update_lightpen_state(&m_lightpen); +} + +/* + Not a real interrupt - just handle keyboard input +*/ +INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) +{ + int control_keys; + int tw_keys; + int ta_keys; + + int control_transitions; + int tw_transitions; + int ta_transitions; + + + m_maincpu->set_state_int(PDP1_SS, m_sense->read()); + + /* read new state of control keys */ + control_keys = m_csw->read(); + + if (control_keys & pdp1_control) + { + /* compute transitions */ + control_transitions = control_keys & (~ m_old_control_keys); + + if (control_transitions & pdp1_extend) + { + m_maincpu->set_state_int(PDP1_EXTEND_SW, ! m_maincpu->state_int(PDP1_EXTEND_SW)); + } + if (control_transitions & pdp1_start_nobrk) + { + m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ + m_maincpu->set_state_int(PDP1_EXD, m_maincpu->state_int(PDP1_EXTEND_SW)); + m_maincpu->set_state_int(PDP1_SBM, (UINT64)0); + m_maincpu->set_state_int(PDP1_OV, (UINT64)0); + m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_TA)); + m_maincpu->set_state_int(PDP1_RUN, 1); + } + if (control_transitions & pdp1_start_brk) + { + m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ + m_maincpu->set_state_int(PDP1_EXD, m_maincpu->state_int(PDP1_EXTEND_SW)); + m_maincpu->set_state_int(PDP1_SBM, 1); + m_maincpu->set_state_int(PDP1_OV, (UINT64)0); + m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_TA)); + m_maincpu->set_state_int(PDP1_RUN, 1); + } + if (control_transitions & pdp1_stop) + { + m_maincpu->set_state_int(PDP1_RUN, (UINT64)0); + m_maincpu->set_state_int(PDP1_RIM, (UINT64)0); /* bug : we stop after reading an even-numbered word + (i.e. data), whereas a real pdp-1 stops after reading + an odd-numbered word (i.e. dio instruciton) */ + } + if (control_transitions & pdp1_continue) + { + m_maincpu->set_state_int(PDP1_RUN, 1); + } + if (control_transitions & pdp1_examine) + { + m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ + m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_TA)); + m_maincpu->set_state_int(PDP1_MA, m_maincpu->state_int(PDP1_PC)); + m_maincpu->set_state_int(PDP1_IR, LAC); /* this instruction is actually executed */ + + m_maincpu->set_state_int(PDP1_MB, (signed)m_maincpu->space(AS_PROGRAM).read_dword(PDP1_MA<<2)); + m_maincpu->set_state_int(PDP1_AC, m_maincpu->state_int(PDP1_MB)); + } + if (control_transitions & pdp1_deposit) + { + m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ + m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_TA)); + m_maincpu->set_state_int(PDP1_MA, m_maincpu->state_int(PDP1_PC)); + m_maincpu->set_state_int(PDP1_AC, m_maincpu->state_int(PDP1_TW)); + m_maincpu->set_state_int(PDP1_IR, DAC); /* this instruction is actually executed */ + + m_maincpu->set_state_int(PDP1_MB, m_maincpu->state_int(PDP1_AC)); + m_maincpu->space(AS_PROGRAM).write_dword(m_maincpu->state_int(PDP1_MA)<<2, m_maincpu->state_int(PDP1_MB)); + } + if (control_transitions & pdp1_read_in) + { /* set cpu to read instructions from perforated tape */ + m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ + m_maincpu->set_state_int(PDP1_PC, ( m_maincpu->state_int(PDP1_TA) & 0170000) + | (m_maincpu->state_int(PDP1_PC) & 0007777)); /* transfer ETA to EPC */ + /*m_maincpu->set_state_int(PDP1_MA, m_maincpu->state_int(PDP1_PC));*/ + m_maincpu->set_state_int(PDP1_EXD, m_maincpu->state_int(PDP1_EXTEND_SW)); + m_maincpu->set_state_int(PDP1_OV, (UINT64)0); /* right??? */ + m_maincpu->set_state_int(PDP1_RUN, (UINT64)0); + m_maincpu->set_state_int(PDP1_RIM, 1); + } + if (control_transitions & pdp1_reader) + { + } + if (control_transitions & pdp1_tape_feed) + { + } + if (control_transitions & pdp1_single_step) + { + m_maincpu->set_state_int(PDP1_SNGL_STEP, ! m_maincpu->state_int(PDP1_SNGL_STEP)); + } + if (control_transitions & pdp1_single_inst) + { + m_maincpu->set_state_int(PDP1_SNGL_INST, ! m_maincpu->state_int(PDP1_SNGL_INST)); + } + + /* remember new state of control keys */ + m_old_control_keys = control_keys; + + + /* handle test word keys */ + tw_keys = (m_twdmsb->read() << 16) | m_twdlsb->read(); + + /* compute transitions */ + tw_transitions = tw_keys & (~ m_old_tw_keys); + + if (tw_transitions) + m_maincpu->set_state_int(PDP1_TW, m_maincpu->state_int(PDP1_TW) ^ tw_transitions); + + /* remember new state of test word keys */ + m_old_tw_keys = tw_keys; + + + /* handle address keys */ + ta_keys = m_tstadd->read(); + + /* compute transitions */ + ta_transitions = ta_keys & (~ m_old_ta_keys); + + if (ta_transitions) + m_maincpu->set_state_int(PDP1_TA, m_maincpu->state_int(PDP1_TA) ^ ta_transitions); + + /* remember new state of test word keys */ + m_old_ta_keys = ta_keys; + + } + else + { + m_old_control_keys = 0; + m_old_tw_keys = 0; + m_old_ta_keys = 0; + + pdp1_keyboard(); + } + + pdp1_lightpen(); +} + + +static MACHINE_CONFIG_START( pdp1, pdp1_state ) + + /* basic machine hardware */ + /* PDP1 CPU @ 200 kHz (no master clock, but the instruction and memory rate is 200 kHz) */ + MCFG_CPU_ADD("maincpu", PDP1, 1000000/*the CPU core uses microsecond counts*/) + MCFG_CPU_CONFIG(pdp1_reset_param) + MCFG_CPU_PROGRAM_MAP(pdp1_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pdp1_state, pdp1_interrupt) /* dummy interrupt: handles input */ + + /* video hardware (includes the control panel and typewriter output) */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(refresh_rate) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(virtual_width, virtual_height) + MCFG_SCREEN_VISIBLE_AREA(0, virtual_width-1, 0, virtual_height-1) + MCFG_SCREEN_UPDATE_DRIVER(pdp1_state, screen_update_pdp1) + MCFG_SCREEN_VBLANK_DRIVER(pdp1_state, screen_eof_pdp1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEVICE_ADD("crt", CRT, 0) + MCFG_CRT_NUM_LEVELS(pen_crt_num_levels) + MCFG_CRT_OFFSETS(crt_window_offset_x, crt_window_offset_y) + MCFG_CRT_SIZE(crt_window_width, crt_window_height) + + MCFG_DEVICE_ADD("readt", PDP1_READTAPE, 0) + MCFG_DEVICE_ADD("punch", PDP1_PUNCHTAPE, 0) + MCFG_DEVICE_ADD("typewriter", PDP1_PRINTER, 0) + MCFG_DEVICE_ADD("drum", PDP1_CYLINDER, 0) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pdp1) + MCFG_PALETTE_ADD("palette", total_colors_needed + sizeof(pdp1_palette)) + MCFG_PALETTE_INDIRECT_ENTRIES(total_colors_needed) + MCFG_PALETTE_INIT_OWNER(pdp1_state, pdp1) +MACHINE_CONFIG_END + +/* + pdp1 can address up to 65336 18 bit words when extended (4096 otherwise). +*/ +ROM_START(pdp1) + ROM_REGION(pdp1_fontdata_size, "gfx1", ROMREGION_ERASEFF) + /* space filled with our font */ +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP( 1961, pdp1, 0, 0, pdp1, pdp1, driver_device, 0, "Digital Equipment Corporation", "PDP-1" , MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/pdp11.c b/src/mame/drivers/pdp11.c new file mode 100644 index 00000000000..8aa53ba3f47 --- /dev/null +++ b/src/mame/drivers/pdp11.c @@ -0,0 +1,470 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + PDP-11 + + Unibus models + ================== + PDP-11/20 and PDP-11/15 ? The original, non-microprogrammed processor; + designed by Jim O'Loughlin. Floating point was supported by + peripheral options using various data formats. + PDP-11/35 and PDP-11/40 ? A microprogrammed successor to the PDP-11/20; + the design team was led by Jim O'Loughlin. + PDP-11/45, PDP-11/50, and PDP-11/55 ? A much faster microprogrammed processor + that could use up to 256 kB of semiconductor memory instead of or in + addition to core memory. First model to support an optional FP11 + floating-point coprocessor, which established the format used in + later models. + PDP-11/70 ? The 11/45 architecture expanded to allow 4 MB of physical memory + segregated onto a private memory bus, 2 kB of cache memory, and much + faster I/O devices connected via the Massbus.[9] + PDP-11/05 and PDP-11/10 ? A cost-reduced successor to the PDP-11/20. + PDP-11/34 and PDP-11/04 ? Cost-reduced follow-on products to the 11/35 + and 11/05; the PDP-11/34 concept was created by Bob Armstrong. + The 11/34 supported up to 256 kB of Unibus memory. The PDP-11/34a + supported a fast floating-point option, and the 11/34c supported a + cache memory option. + PDP-11/60 ? A PDP-11 with user-writable microcontrol store; this was + designed by another team led by Jim O'Loughlin. + PDP-11/44 ? Replacement for the 11/45 and 11/70 that supported optional cache + memory and floating-point processor, and included a sophisticated serial + console interface and support for 4 MB of physical memory. The design + team was managed by John Sofio. + PDP-11/24 ? First VLSI PDP-11 for Unibus, using the "Fonz-11" (F11) chip set + with a Unibus adapter. + PDP-11/84 ? Using the VLSI "Jaws-11" (J11) chip set with a Unibus adapter. + PDP-11/94 ? J11-based, faster than 11/84. + + Q-bus models + ============== + PDP-11/03 (also known as the LSI-11/03) ? The first LSI PDP-11, this system + used a chipset from Western Digital and supported 60 kB of memory. + PDP-11/23 ? Second generation of LSI (F-11). Early units supported + only 248 kB of memory. + PDP-11/23+/MicroPDP-11/23 ? Improved 11/23 with more functions on the + (larger) processor card. + MicroPDP-11/73 ? The third generation LSI-11, this system used the + faster "Jaws-11" (J-11) chip set and supported up to 4 MB of memory. + MicroPDP-11/53 ? Slower 11/73 with on-board memory. + MicroPDP-11/83 ? Faster 11/73 with PMI (private memory interconnect). + MicroPDP-11/93 ? Faster 11/83; final DEC Q-Bus PDP-11 model. + KXJ11 - QBUS card (M7616) with PDP-11 based peripheral processor and + DMA controller. Based on a J11 CPU equipped with 512 kB of RAM, + 64 kB of ROM, and parallel and serial interfaces. + Mentec M100 ? Mentec redesign of the 11/93, with J-11 chipset at 19.66 MHz, + four on-board serial ports, 1-4 MB of on-board memory, and optional FPU. + Mentec M11 ? Processor upgrade board; microcode implementation of PDP-11 + instruction set by Mentec, using the TI 8832 ALU and TI 8818 + microsequencer from Texas Instruments. + Mentec M1 ? Processor upgrade board; microcode implementation of + PDP-11 instruction set by Mentec, using Atmel 0.35 ?m ASIC.[10] + Quickware QED-993 ? High performance PDP-11/93 processor upgrade board. + DECserver 500 and 550 LAT terminal servers DSRVS-BA using the KDJ11-SB chipset + + All PDP-11's execept the first one (11/15 and 11/20) are microprogrammed. + + 23/02/2009 Skeleton driver. + + Memory Map (converted from the annoying octal format from the manuals): + 0x0000 - 0x00ff: irq vectors + 0xe000: ROM + 0xff68: "high speed reader and punch device status and buffer register" + 0xff70 - 0xff7e: "teletype keyboard and punch device status and buffer register" + PDP-11 internal registers: + 0xff80 - 0xffbf: "reserved for expansion of processor registers" + 0xffc0: R0 + 0xffc2: R1 + 0xffc4: R2 + 0xffc6: R3 + 0xffc8: R4 + 0xffca: R5 + 0xffcc: R6 / SP + 0xffce: R7 / PC + 0xfffe: PSW + + SMS-1000: + Claims to be 100% compatible with DEC PDP-11. Added as a skeleton. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/t11/t11.h" +#include "machine/terminal.h" +#include "machine/rx01.h" + +#define TERMINAL_TAG "terminal" + +class pdp11_state : public driver_device +{ +public: + pdp11_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ16_MEMBER( teletype_ctrl_r ); + DECLARE_WRITE16_MEMBER( teletype_ctrl_w ); + DECLARE_WRITE8_MEMBER( kbd_put ); + UINT8 m_teletype_data; + UINT16 m_teletype_status; + virtual void machine_reset(); + DECLARE_MACHINE_RESET(pdp11ub2); + DECLARE_MACHINE_RESET(pdp11qb); + void load9312prom(UINT8 *desc, UINT8 *src, int size); +}; + +READ16_MEMBER(pdp11_state::teletype_ctrl_r) +{ + UINT16 res = 0; + + switch(offset) + { + /* + keyboard + ---- x--- ---- ---- busy bit + ---- ---- x--- ---- ready bit (set on character receive, clear on buffer read) + ---- ---- -x-- ---- irq enable + ---- ---- ---- ---x reader enable (?) + */ + case 0: res = m_teletype_status; break; // reader status register (tks) + case 1: m_teletype_status &= ~0x80; res = m_teletype_data; break;// reader buffer register (tkb) + /* + printer + ---- ---- x--- ---- ready bit + ---- ---- -x-- ---- irq enable + ---- ---- ---- -x-- maintenance + */ + case 2: res = 0x80; break; // punch status register (tps) + case 3: res = 0; break; // punch buffer register (tpb) + } + + return res; +} + +WRITE16_MEMBER(pdp11_state::teletype_ctrl_w) +{ + switch(offset) + { + case 3: + m_terminal->write(space, 0, data); + break; + } +} + +static ADDRESS_MAP_START(pdp11_mem, AS_PROGRAM, 16, pdp11_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xdfff ) AM_RAM // RAM + AM_RANGE( 0xea00, 0xfeff ) AM_ROM + AM_RANGE( 0xff70, 0xff77 ) AM_READWRITE(teletype_ctrl_r,teletype_ctrl_w) + + AM_RANGE( 0xfe78, 0xfe7b ) AM_DEVREADWRITE("rx01", rx01_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pdp11qb_mem, AS_PROGRAM, 16, pdp11_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xe9ff ) AM_RAM // RAM + AM_RANGE( 0xea00, 0xefff ) AM_ROM + AM_RANGE( 0xf000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +#define M9312_PORT_CONFSETTING \ +PORT_CONFSETTING ( 0x00, "'DL' BOOT prom for RL11 controller") \ +PORT_CONFSETTING ( 0x01, "'DM' BOOT prom for RK06/07 controller") \ +PORT_CONFSETTING ( 0x02, "'DX' BOOT prom for RX01 compatible controller") \ +PORT_CONFSETTING ( 0x03, "'DP/DB' BOOT prom for RP02/03,RP04/5/6 RM02/3 controller") \ +PORT_CONFSETTING ( 0x04, "'DK/DT' BOOT prom for RK03/05,TU55/56 controllers") \ +PORT_CONFSETTING ( 0x05, "'MM' BOOT prom for TU16/E16 TM02/3 controllers") \ +PORT_CONFSETTING ( 0x06, "'MT' BOOT prom for TU10/TS03 controller") \ +PORT_CONFSETTING ( 0x07, "'DS' BOOT prom for RS03/RS04 controller") \ +PORT_CONFSETTING ( 0x08, "'PR/TT' BOOT prom for PC05,LO SPD RDR controllers") \ +PORT_CONFSETTING ( 0x09, "'CT' BOOT prom for TA11/TU60 controller") \ +PORT_CONFSETTING ( 0x0a, "'RS' BOOT prom for RS11, RS64 controller") \ +PORT_CONFSETTING ( 0x0b, "'CR' BOOT prom for CR11 card reader") \ +PORT_CONFSETTING ( 0x0c, "'MS' BOOT prom for TS11/TS04/TU80 compatible controller") \ +PORT_CONFSETTING ( 0x0d, "'DD' BOOT prom for TU58 DECtapeII serial tape controller") \ +PORT_CONFSETTING ( 0x0e, "'DU' BOOT prom for MSCP compatible controller") \ +PORT_CONFSETTING ( 0x0f, "'XX' Unknown 1/3") \ +PORT_CONFSETTING ( 0x10, "'XX' Unknown 2/3") \ +PORT_CONFSETTING ( 0x11, "'XX' Unknown 3/3") \ +PORT_CONFSETTING ( 0x12, "'DY' BOOT prom for RX02 compatible controller") \ +PORT_CONFSETTING ( 0x13, "'XM' DECNET 1/3 (DECnet DDCMP DMC11/DMR11)") \ +PORT_CONFSETTING ( 0x14, "'XM' DECNET 2/3 (DECnet DDCMP DMC11/DMR11)") \ +PORT_CONFSETTING ( 0x15, "'XM' DECNET 3/3 (DECnet DDCMP DMC11/DMR11)") \ +PORT_CONFSETTING ( 0x16, "'XU' DECNET 1/3 (DECnet DDCMP DU11)") \ +PORT_CONFSETTING ( 0x17, "'XU' DECNET 2/3 (DECnet DDCMP DU11)") \ +PORT_CONFSETTING ( 0x18, "'XU' DECNET 3/3 (DECnet DDCMP DU11)") \ +PORT_CONFSETTING ( 0x19, "'XW' DECNET 1/3 (DECnet DDCMP DUP11)") \ +PORT_CONFSETTING ( 0x1a, "'XW' DECNET 2/3 (DECnet DDCMP DUP11)") \ +PORT_CONFSETTING ( 0x1b, "'XW' DECNET 3/3 (DECnet DDCMP DUP11)") \ +PORT_CONFSETTING ( 0x1c, "'XL' DECNET 1/3 (DECnet DDCMP DL11-E)") \ +PORT_CONFSETTING ( 0x1d, "'XL' DECNET 2/3 (DECnet DDCMP DL11-E)") \ +PORT_CONFSETTING ( 0x1e, "'XL' DECNET 3/3 (DECnet DDCMP DL11-E)") \ +PORT_CONFSETTING ( 0x1f, "'XE' DEUNA DECnet Ethernet") \ +PORT_CONFSETTING ( 0x20, "'MU' TMSCP tapes, including TK50, TU81") +/* Input ports */ +static INPUT_PORTS_START( pdp11 ) + PORT_START("S1") + PORT_DIPNAME( 0x01, 0x01, "S1-1" ) + PORT_DIPSETTING( 0x00, "Direct boot" ) + PORT_DIPSETTING( 0x01, "Console mode" ) + PORT_DIPNAME( 0x02, 0x02, "S1-2 Boot") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_START("S1_2") + PORT_DIPNAME( 0x80, 0x00, "S1-3" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, "S1-4" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, "S1-5" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, "S1-6" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "S1-7" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, "S1-8" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, "S1-9" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x01, 0x00, "S1-10" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_START( "CONSPROM" ) + PORT_CONFNAME ( 0x01, 0, "Console PROM" ) + PORT_CONFSETTING ( 0x00, "11/04/05/34/35/40/45/50/55" ) + PORT_CONFSETTING ( 0x01, "11/60-70" ) + PORT_START( "DEVPROM1" ) + PORT_CONFNAME ( 0x2f, 0x02, "Device 1 PROM" ) + M9312_PORT_CONFSETTING + PORT_START( "DEVPROM2" ) + PORT_CONFNAME ( 0x2f, 0x00, "Device 2 PROM" ) + M9312_PORT_CONFSETTING + PORT_START( "DEVPROM3" ) + PORT_CONFNAME ( 0x2f, 0x0d, "Device 3 PROM" ) + M9312_PORT_CONFSETTING + PORT_START( "DEVPROM4" ) + PORT_CONFNAME ( 0x2f, 0x04, "Device 4 PROM" ) + M9312_PORT_CONFSETTING +INPUT_PORTS_END + + +void pdp11_state::machine_reset() +{ + // Load M9301-YA + UINT8* user1 = memregion("user1")->base(); + UINT8* maincpu = memregion("maincpu")->base(); + int i; + + for(i=0;i<0x100;i++) { + UINT8 nib1 = user1[i+0x000] ^ 0x00; + UINT8 nib2 = user1[i+0x200] ^ 0x01; + UINT8 nib3 = user1[i+0x400] ^ 0x0f; + UINT8 nib4 = user1[i+0x600] ^ 0x0e; + + maincpu[0xea00 + i*2 + 1] = (nib1 << 4) + nib2; + maincpu[0xea00 + i*2 + 0] = (nib3 << 4) + nib4; + } + for(i=0x100;i<0x200;i++) { + UINT8 nib1 = user1[i+0x000] ^ 0x00; + UINT8 nib2 = user1[i+0x200] ^ 0x01; + UINT8 nib3 = user1[i+0x400] ^ 0x0f; + UINT8 nib4 = user1[i+0x600] ^ 0x0e; + + maincpu[0xf600 + (i-0x100)*2 + 1] = (nib1 << 4) + nib2; + maincpu[0xf600 + (i-0x100)*2 + 0] = (nib3 << 4) + nib4; + } +} + +void pdp11_state::load9312prom(UINT8 *desc, UINT8 *src, int size) +{ + // 3 2 1 8 + // 7 6 5 4 + // ~11 ~10 9 0 + // 15 14 13 ~12 + for(int i=0;ibase() + ioport("CONSPROM")->read() * 0x0400; + UINT8* maincpu = memregion("maincpu")->base(); + + //0165000 + load9312prom(maincpu + 0165000,user1,0x100); + + UINT8 s1 = ioport("S1")->read(); + + if (s1 & 0x02) { // if boot enabled + UINT16 addr = 0173000; + if (s1 & 1) { + addr = 0165000; + } + addr += ioport("S1_2")->read() * 2; + m_maincpu->set_state_int(T11_PC, addr); + } + + //0173000 + load9312prom(maincpu + 0173000,memregion("devproms")->base() + ioport("DEVPROM1")->read() * 0x0200,0x080); + //0173200 + load9312prom(maincpu + 0173200,memregion("devproms")->base() + ioport("DEVPROM2")->read() * 0x0200,0x080); + //0173400 + load9312prom(maincpu + 0173400,memregion("devproms")->base() + ioport("DEVPROM3")->read() * 0x0200,0x080); + //0173600 + load9312prom(maincpu + 0173600,memregion("devproms")->base() + ioport("DEVPROM4")->read() * 0x0200,0x080); + +} + +MACHINE_RESET_MEMBER(pdp11_state,pdp11qb) +{ + m_maincpu->set_state_int(T11_PC, 0xea00); +} + + +WRITE8_MEMBER( pdp11_state::kbd_put ) +{ + m_teletype_data = data; + m_teletype_status |= 0x80; +} + +static MACHINE_CONFIG_START( pdp11, pdp11_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) // Need proper CPU here + MCFG_T11_INITIAL_MODE(6 << 13) + MCFG_CPU_PROGRAM_MAP(pdp11_mem) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(pdp11_state, kbd_put)) + + MCFG_RX01_ADD("rx01") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pdp11ub2, pdp11 ) + MCFG_MACHINE_RESET_OVERRIDE(pdp11_state,pdp11ub2) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pdp11qb, pdp11 ) + MCFG_MACHINE_RESET_OVERRIDE(pdp11_state,pdp11qb) + + MCFG_CPU_MODIFY("maincpu") + MCFG_T11_INITIAL_MODE(0 << 13) + MCFG_CPU_PROGRAM_MAP(pdp11qb_mem) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pdp11ub ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x1000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "23-034a9.bin", 0x0000, 0x0200, CRC(01c5d78d) SHA1(b447c67bfd5134c142240a919f23a949e1953fb2)) + ROM_LOAD( "23-035a9.bin", 0x0200, 0x0200, CRC(c456df6c) SHA1(188c8ece6a2d67911016f55dd22b698a40aff515)) + ROM_LOAD( "23-036a9.bin", 0x0400, 0x0200, CRC(208ff511) SHA1(27198a1110319b70674a72fd03a798dfa2c2109a)) + ROM_LOAD( "23-037a9.bin", 0x0600, 0x0200, CRC(d248b282) SHA1(ea638de6bde8342654d3e62b7810aa041e111913)) +ROM_END + +ROM_START( pdp11ub2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x800, "consproms", ROMREGION_ERASEFF ) + ROM_LOAD( "23-248f1.bin", 0x0000, 0x0400, CRC(ecda1a6d) SHA1(b2bf770dda349fdd469235871564280baf06301d)) // M9312 11/04/05/34/35/40/45/50/55 Console/Diagnostic PROM + ROM_LOAD( "23-616f1.bin", 0x0400, 0x0400, CRC(a3dfb5aa) SHA1(7f06c624ae3fbb49535258b8722b5a3c548da3ba)) // M9312 11/60-70 Diagnostic/Console ROM + ROM_REGION( 0x4200, "devproms", ROMREGION_ERASEFF ) + ROM_LOAD( "23-751a9.bin", 0x0000, 0x0200, CRC(15bebc6a) SHA1(a621c5b1cebebbb110ee646a8c36ee4c606e269b)) // M9312 'DL' BOOT prom for RL11 controller + ROM_LOAD( "23-752a9.bin", 0x0200, 0x0200, CRC(6cf1f859) SHA1(7c876eda2f0d74d6f5d876256c28dbd56c405ca7)) // M9312 'DM' BOOT prom for RK06/07 controller + ROM_LOAD( "23-753a9.bin", 0x0400, 0x0200, CRC(f4c4b40c) SHA1(a0bdb922c722d439f35ba8149a8f657ffcc8fb54)) // M9312 'DX' BOOT prom for RX01 compatible controller + ROM_LOAD( "23-755a9.bin", 0x0600, 0x0200, CRC(ed06b35c) SHA1(d972c6a743d73ce9244d2bcfdd40eea2bb22e717)) // M9312 'DP/DB' BOOT prom for RP02/03,RP04/5/6 RM02/3 controller + ROM_LOAD( "23-756a9.bin", 0x0800, 0x0200, CRC(12271ab2) SHA1(f0ff42a8fd839dd75d6c1a25cc82d0933fd09dbc)) // M9312 'DK/DT' BOOT prom for RK03/05,TU55/56 controllers + ROM_LOAD( "23-757a9.bin", 0x0a00, 0x0200, CRC(af251aab) SHA1(4d760ec3f6ff5f4e2cafcb44b275183872b69cb6)) // M9312 'MM' BOOT prom for TU16/E16 TM02/3 controllers + ROM_LOAD( "23-758a9.bin", 0x0c00, 0x0200, CRC(b71e8878) SHA1(f45c47c702c94a70c36732c12173ce60d0be1a11)) // M9312 'MT' BOOT prom for TU10/TS03 controller + ROM_LOAD( "23-759a9.bin", 0x0e00, 0x0200, CRC(29a93448) SHA1(0b549170c6a3f49c1587adb6cc691786111c0dd3)) // M9312 'DS' BOOT prom for RS03/RS04 controller + ROM_LOAD( "23-760a9.bin", 0x1000, 0x0200, CRC(ea093648) SHA1(3875a0147c43db1a5a381bbe85937a5628e6220c)) // M9312 'PR/TT' BOOT prom for PC05,LO SPD RDR controllers + ROM_LOAD( "23-761a9.bin", 0x1200, 0x0200, CRC(4310ebe8) SHA1(a3144f96819ea57acfac5de5e19961294e7d4ad9)) // M9312 'CT' BOOT prom for TA11/TU60 controller + ROM_LOAD( "23-762a9.bin", 0x1400, 0x0200, NO_DUMP) // M9312 'RS' BOOT prom for RS11, RS64 controller + ROM_LOAD( "23-763a9.bin", 0x1600, 0x0200, NO_DUMP) // M9312 'CR' BOOT prom for CR11 card reader + ROM_LOAD( "23-764a9.bin", 0x1800, 0x0200, CRC(7c8b7ed4) SHA1(ba0c9f03027eb3dafcc0936e877637d3c9947f94)) // M9312 'MS' BOOT prom for TS11/TS04/TU80 compatible controller + ROM_LOAD( "23-765a9.bin", 0x1a00, 0x0200, CRC(702dfeb2) SHA1(0d37bdd3846de4b104b8968a0e83ed81abd7f9ae)) // M9312 'DD' BOOT prom for TU58 DECtapeII serial tape controller + ROM_LOAD( "23-767a9.bin", 0x1c00, 0x0200, CRC(4b94e3fa) SHA1(3cf92c2f64f95e8cc3abb8af2526cc65ce53ca8a)) // M9312 'DU' BOOT prom for MSCP compatible controller (UDA50/RA50/RC25/RAxx) + ROM_LOAD( "23-786a9.bin", 0x1e00, 0x0200, CRC(a5326664) SHA1(238f97fc5b2b540948ea1e27a4cd1dcf18255b21)) // M9312 'XX' Unknown 1/3 + ROM_LOAD( "23-787a9.bin", 0x2000, 0x0200, CRC(025debf9) SHA1(8ea2faf2e2d78be0ad2f77e61bae0dfb9c3b4b01)) // M9312 'XX' Unknown 2/3 + ROM_LOAD( "23-788a9.bin", 0x2200, 0x0200, CRC(3c7ed364) SHA1(519ffac2e4878490128e754a0473502c767a94e2)) // M9312 'XX' Unknown 3/3 + ROM_LOAD( "23-811a9.bin", 0x2400, 0x0200, CRC(9aa8499a) SHA1(11b040e0908d7492dcc450cbb72d76633dd687ca)) // M9312 'DY' BOOT prom for RX02 compatible controller + ROM_LOAD( "23-862a9.bin", 0x2600, 0x0200, CRC(38dbd994) SHA1(c5db671e6b70f3b4d345a02b46e0ea7566160d04)) // M9312 'XM' DECNET 1/3 (DECnet DDCMP DMC11/DMR11) + ROM_LOAD( "23-863a9.bin", 0x2800, 0x0200, CRC(bbef2f41) SHA1(f472b7a8bd4c0a49dc3ec38f886755910f73fe66)) // M9312 'XM' DECNET 2/3 (DECnet DDCMP DMC11/DMR11) + ROM_LOAD( "23-864a9.bin", 0x2a00, 0x0200, CRC(85cc17dc) SHA1(371dbd3c672fe4b1819762c3082c4217a7597547)) // M9312 'XM' DECNET 3/3 (DECnet DDCMP DMC11/DMR11) + ROM_LOAD( "23-865a9.bin", 0x2c00, 0x0200, NO_DUMP) // M9312 'XU' DECNET 1/3 (DECnet DDCMP DU11) + ROM_LOAD( "23-866a9.bin", 0x2e00, 0x0200, NO_DUMP) // M9312 'XU' DECNET 2/3 (DECnet DDCMP DU11) + ROM_LOAD( "23-867a9.bin", 0x3000, 0x0200, NO_DUMP) // M9312 'XU' DECNET 3/3 (DECnet DDCMP DU11) + ROM_LOAD( "23-868a9.bin", 0x3200, 0x0200, NO_DUMP) // M9312 'XW' DECNET 1/3 (DECnet DDCMP DUP11) + ROM_LOAD( "23-869a9.bin", 0x3400, 0x0200, NO_DUMP) // M9312 'XW' DECNET 2/3 (DECnet DDCMP DUP11) + ROM_LOAD( "23-870a9.bin", 0x3600, 0x0200, NO_DUMP) // M9312 'XW' DECNET 3/3 (DECnet DDCMP DUP11) + ROM_LOAD( "23-926a9.bin", 0x3800, 0x0200, NO_DUMP) // M9312 'XL' DECNET 1/3 (DECnet DDCMP DL11-E) + ROM_LOAD( "23-927a9.bin", 0x3a00, 0x0200, NO_DUMP) // M9312 'XL' DECNET 2/3 (DECnet DDCMP DL11-E) + ROM_LOAD( "23-928a9.bin", 0x3c00, 0x0200, NO_DUMP) // M9312 'XL' DECNET 3/3 (DECnet DDCMP DL11-E) + ROM_LOAD( "23-e22a9.bin", 0x3e00, 0x0200, NO_DUMP) // M9312 'XE' DEUNA DECnet Ethernet + ROM_LOAD( "23-e39a9.bin", 0x4000, 0x0200, CRC(4b94e3fa) SHA1(3cf92c2f64f95e8cc3abb8af2526cc65ce53ca8a)) // M9312 'MU' TMSCP tapes, including TK50, TU81 + +ROM_END + +ROM_START( pdp11qb ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "m7195fa.1", 0xc000, 0x2000, CRC(0fa58752) SHA1(4bcd006790a60f2998ee8377ac5e2c18ef330930)) + ROM_LOAD16_BYTE( "m7195fa.2", 0xc001, 0x2000, CRC(15b6f60c) SHA1(80dd4f8ca3c27babb5e75111b04241596a07c53a)) +ROM_END + +ROM_START( sms1000 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "21251000u", 0x00000, 0x008000, CRC(68db0afc) SHA1(577124bc64f6ddc9771e11b483120a175bfcf8c5) ) + ROM_LOAD( "21251001u", 0x00000, 0x010000, CRC(eec3ccbb) SHA1(69eedb2c3bffe0a2988b1c066df1fea195618087) ) + ROM_LOAD( "21251002u", 0x00000, 0x000800, CRC(66ca0eaf) SHA1(8141f64f81d9954169bcff6c79fd9f85e91f98e0) ) + ROM_LOAD( "2123001", 0x00000, 0x000800, CRC(7eb10e9b) SHA1(521ce8b8a79075c30ad92d810141c725d26fc50e) ) + ROM_LOAD( "2115001.jed", 0x00000, 0x000b19, CRC(02170f78) SHA1(afe50d165b39bff1cadae4290344341376729fda) ) + // no idea how large these undumped proms are + ROM_LOAD( "2096001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2097002", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "20982000f", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "20982001f", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2099002b", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2108001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2109001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2110001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2111001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2116001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2117001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2118001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2119001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2120001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2121001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2122001", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2124008", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2124009", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2124010", 0x1f000, 0x000100, NO_DUMP ) + ROM_LOAD( "2127001b", 0x1f000, 0x000100, NO_DUMP ) // has 3 of these +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( ????, pdp11ub, 0, 0, pdp11, pdp11, driver_device, 0, "Digital Equipment Corporation", "PDP-11 [Unibus](M9301-YA)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( ????, pdp11ub2, pdp11ub, 0, pdp11ub2, pdp11, driver_device, 0, "Digital Equipment Corporation", "PDP-11 [Unibus](M9312)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( ????, pdp11qb, pdp11ub, 0, pdp11qb, pdp11, driver_device, 0, "Digital Equipment Corporation", "PDP-11 [Q-BUS] (M7195 - MXV11)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1987, sms1000, pdp11ub, 0, pdp11qb, pdp11, driver_device, 0, "Scientific Micro Systems", "SMS-1000", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/pecom.c b/src/mame/drivers/pecom.c new file mode 100644 index 00000000000..7bb5ad07aec --- /dev/null +++ b/src/mame/drivers/pecom.c @@ -0,0 +1,217 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Pecom driver by Miodrag Milanovic + + 08/11/2008 Preliminary driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "sound/cdp1869.h" +#include "sound/wave.h" +#include "machine/ram.h" +#include "includes/pecom.h" + +/* Address maps */ +static ADDRESS_MAP_START(pecom64_mem, AS_PROGRAM, 8, pecom_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x4000, 0x7fff ) AM_RAMBANK("bank2") + AM_RANGE( 0x8000, 0xbfff ) AM_ROM // ROM 1 + AM_RANGE( 0xc000, 0xf3ff ) AM_ROM // ROM 2 + AM_RANGE( 0xf000, 0xf7ff ) AM_RAMBANK("bank3") // CDP1869 / ROM + AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank4") // CDP1869 / ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pecom64_io, AS_IO, 8, pecom_state ) + AM_RANGE(0x01, 0x01) AM_WRITE(pecom_bank_w) + AM_RANGE(0x03, 0x03) AM_READ(pecom_keyboard_r) + AM_RANGE(0x03, 0x07) AM_WRITE(pecom_cdp1869_w) +ADDRESS_MAP_END + +/* Input ports */ +/* Pecom 64 keyboard layout is as follows + + 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 BREAK + + DEL Q W E R T Y U I O P ESC + + CAPS A S D F G H J K L RETURN + + CTRL ,< Z X C V B N M :* /? LF + + SHIFT .> Down Left SPACEBAR Right Up ;+ =- + +Being keys distributed on four lines, it makes a bit difficult to accurately remap them +on modern keyboards. Hence, we move by default Up/Down/Left/Right to Cursor Keys and +use LEft/Right Ctrl/Alt keys for the remaining keys. Due to the unnatural emulated keyboard +mappings, this is another situation where natural keyboard comes very handy! */ + +INPUT_CHANGED_MEMBER(pecom_state::ef_w) +{ + m_cdp1802->set_input_line((int)(FPTR)param, newval); +} + +static INPUT_PORTS_START( pecom ) + PORT_START("LINE0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_COLON) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_SLASH) + + PORT_START("LINE1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // Actually this is again / ? - same key connected as on SLASH + + PORT_START("LINE2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("LINE3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START("LINE4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START("LINE5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("LINE7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_CHAR(';') PORT_CHAR('+') + + PORT_START("LINE8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('=') PORT_CHAR('-') + + PORT_START("LINE9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE10") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + + PORT_START("LINE11") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + + PORT_START("LINE12") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + + PORT_START("LINE13") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + + PORT_START("LINE14") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + + PORT_START("LINE15") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + + PORT_START("LINE16") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + + PORT_START("LINE17") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("LINE18") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + + PORT_START("LINE19") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + + PORT_START("LINE20") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + + PORT_START("LINE21") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + + PORT_START("LINE22") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + + PORT_START("LINE23") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Sh") PORT_CODE(KEYCODE_DOWN) // sh up + + PORT_START("LINE24") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Dj") PORT_CODE(KEYCODE_LEFT) // dj left + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cj") PORT_CODE(KEYCODE_RIGHT) // cj right + + PORT_START("LINE25") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ch") PORT_CODE(KEYCODE_UP) //ch up + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + + PORT_START("CNT") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) PORT_CHANGED_MEMBER(DEVICE_SELF, pecom_state, ef_w, (void*)COSMAC_INPUT_LINE_EF1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, pecom_state, ef_w, (void*)COSMAC_INPUT_LINE_EF3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, pecom_state, ef_w, (void*)COSMAC_INPUT_LINE_EF4) +INPUT_PORTS_END + +/* Machine driver */ +static MACHINE_CONFIG_START( pecom64, pecom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, CDP1869_DOT_CLK_PAL/3) + MCFG_CPU_PROGRAM_MAP(pecom64_mem) + MCFG_CPU_IO_MAP(pecom64_io) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(pecom_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(pecom_state, ef2_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(pecom_state, q_w)) + MCFG_COSMAC_SC_CALLBACK(WRITE8(pecom_state, sc_w)) + + // sound and video hardware + MCFG_FRAGMENT_ADD(pecom_video) + + // devices + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("pecom_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","pecom_cass") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pecom32 ) + ROM_REGION( 0x10000, CDP1802_TAG, ROMREGION_ERASEFF ) + ROM_LOAD( "090786.bin", 0x8000, 0x4000, CRC(b3b1ea23) SHA1(de69f22568161ced801973345fa39d6d207b9e8c) ) +ROM_END + +ROM_START( pecom64 ) + ROM_REGION( 0x10000, CDP1802_TAG, ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "ver4", "version 4") + ROMX_LOAD( "rom_1_g_24.02.88_l.bin", 0x8000, 0x4000, CRC(9a433b47) SHA1(dadb8c399e0a25a2693e10e42a2d7fc2ea9ad427), ROM_BIOS(1) ) + ROMX_LOAD( "rom_2_g_24.02.88_d.bin", 0xc000, 0x4000, CRC(2116cadc) SHA1(03f11055cd221d438a40a41874af8fba0fa116d9), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "ver1", "version 1") + ROMX_LOAD( "170887-rom1.bin", 0x8000, 0x4000, CRC(43710fb4) SHA1(f84f75061c9ac3e34af93141ecabd3c955881aa2), ROM_BIOS(2) ) + ROMX_LOAD( "170887-rom2.bin", 0xc000, 0x4000, CRC(d0d34f08) SHA1(7baab17d1e68771b8dcef97d0fffc655beabef28), ROM_BIOS(2) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, pecom32, 0, 0, pecom64, pecom, driver_device, 0, "Ei Nis", "Pecom 32", 0) +COMP( 1987, pecom64, pecom32, 0, pecom64, pecom, driver_device, 0, "Ei Nis", "Pecom 64", 0) diff --git a/src/mame/drivers/pegasus.c b/src/mame/drivers/pegasus.c new file mode 100644 index 00000000000..47f09b1f0ac --- /dev/null +++ b/src/mame/drivers/pegasus.c @@ -0,0 +1,581 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Aamber Pegasus computer (New Zealand) + + http://web.mac.com/lord_philip/aamber_pegasus/Aamber_Pegasus.html + + Each copy of the monitor rom was made for an individual machine. + The early bios versions checked that it was running on that + particular computer. + + This computer has no sound. + + The usual way of loading a new rom was to plug it into the board. + We have replaced this with cartslots, to save having to recompile + whenever a new rom is found. Single rom programs will usually work in + any slot (if it is going to work at all). A working rom will appear + in the menu. Press the first letter to run it. + + If a machine language program is loaded via cassette, do it in the + Monitor (L command), when loaded press Enter, and it will be in the + menu. + + Basic cassettes are loaded in the usual way, that is, start Basic, + type LOAD, press Enter. When done, RUN or LIST as needed. + + The Aamber Pegasus uses a MCM66710P, which is functionally + equivalent to the MCM6571. + + Note that datasheet is incorrect for the number "9". + The first byte is really 0x3E rather than 0x3F, confirmed on real + hardware. + + TO DO: + - Work on the other non-working programs + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/6821pia.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + + +class pegasus_state : public driver_device +{ +public: + pegasus_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cass(*this, "cassette") + , m_pia_s(*this, "pia_s") + , m_pia_u(*this, "pia_u") + , m_exp_00(*this, "exp00") + , m_exp_01(*this, "exp01") + , m_exp_02(*this, "exp02") + , m_exp_0c(*this, "exp0c") + , m_exp_0d(*this, "exp0d") + , m_p_videoram(*this, "videoram") + , m_io_keyboard(*this, "KEY") + { } + + DECLARE_READ8_MEMBER(pegasus_keyboard_r); + DECLARE_READ8_MEMBER(pegasus_protection_r); + DECLARE_READ8_MEMBER(pegasus_pcg_r); + DECLARE_WRITE8_MEMBER(pegasus_controls_w); + DECLARE_WRITE8_MEMBER(pegasus_keyboard_w); + DECLARE_WRITE8_MEMBER(pegasus_pcg_w); + DECLARE_READ_LINE_MEMBER(pegasus_keyboard_irq); + DECLARE_READ_LINE_MEMBER(pegasus_cassette_r); + DECLARE_WRITE_LINE_MEMBER(pegasus_cassette_w); + DECLARE_WRITE_LINE_MEMBER(pegasus_firq_clr); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_DRIVER_INIT(pegasus); + TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq); + int load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp00_load) { return load_cart(image, m_exp_00, "0000"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp01_load) { return load_cart(image, m_exp_01, "1000"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp02_load) { return load_cart(image, m_exp_02, "2000"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp0c_load) { return load_cart(image, m_exp_0c, "c000"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp0d_load) { return load_cart(image, m_exp_0d, "d000"); } +private: + UINT8 m_kbd_row; + bool m_kbd_irq; + UINT8 *m_p_pcgram; + const UINT8 *m_p_chargen; + UINT8 m_control_bits; + virtual void machine_reset(); + virtual void machine_start(); + virtual void video_start(); + void pegasus_decrypt_rom(UINT8 *ROM); + required_device m_maincpu; + required_device m_cass; + required_device m_pia_s; + required_device m_pia_u; + required_device m_exp_00; + required_device m_exp_01; + required_device m_exp_02; + required_device m_exp_0c; + required_device m_exp_0d; + required_shared_ptr m_p_videoram; + required_ioport_array<8> m_io_keyboard; +}; + +TIMER_DEVICE_CALLBACK_MEMBER(pegasus_state::pegasus_firq) +{ + m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); +} + +WRITE_LINE_MEMBER( pegasus_state::pegasus_firq_clr ) +{ + m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); +} + +READ8_MEMBER( pegasus_state::pegasus_keyboard_r ) +{ + UINT8 i,data = 0xff; + for (i = 0; i < 8; i++) + if (!BIT(m_kbd_row, i)) data &= m_io_keyboard[i]->read(); + + m_kbd_irq = (data == 0xff) ? 1 : 0; + if BIT(m_control_bits, 3) + data<<=4; + return data; +} + +WRITE8_MEMBER( pegasus_state::pegasus_keyboard_w ) +{ + m_kbd_row = data; +} + +WRITE8_MEMBER( pegasus_state::pegasus_controls_w ) +{ +/* d0,d2 - not emulated + d0 - Blank - Video blanking + d1 - Char - select character rom or ram + d2 - Page - enables writing to video ram + d3 - Asc - Select which half of the keyboard to read +*/ + + m_control_bits = data; +} + +READ_LINE_MEMBER( pegasus_state::pegasus_keyboard_irq ) +{ + return m_kbd_irq; +} + +READ_LINE_MEMBER( pegasus_state::pegasus_cassette_r ) +{ + return m_cass->input(); +} + +WRITE_LINE_MEMBER( pegasus_state::pegasus_cassette_w ) +{ + m_cass->output(state ? 1 : -1); +} + +READ8_MEMBER( pegasus_state::pegasus_pcg_r ) +{ + UINT8 code = m_p_videoram[offset] & 0x7f; + return m_p_pcgram[(code << 4) | (~m_kbd_row & 15)]; +} + +WRITE8_MEMBER( pegasus_state::pegasus_pcg_w ) +{ +// if BIT(m_control_bits, 1) + { + UINT8 code = m_p_videoram[offset] & 0x7f; + m_p_pcgram[(code << 4) | (~m_kbd_row & 15)] = data; + } +} + +/* Must return the A register except when it is doing a rom search */ +READ8_MEMBER( pegasus_state::pegasus_protection_r ) +{ + UINT8 data = m_maincpu->state_int(M6809_A); + if (data == 0x20) data = 0xff; + return data; +} + +static ADDRESS_MAP_START(pegasus_mem, AS_PROGRAM, 8, pegasus_state) + ADDRESS_MAP_UNMAP_HIGH + //AM_RANGE(0x0000, 0x2fff) // mapped by the cartslots 1-3 + AM_RANGE(0xb000, 0xbdff) AM_RAM + AM_RANGE(0xbe00, 0xbfff) AM_RAM AM_SHARE("videoram") + //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslots 4-5 + AM_RANGE(0xe000, 0xe1ff) AM_READ(pegasus_protection_r) + AM_RANGE(0xe200, 0xe3ff) AM_READWRITE(pegasus_pcg_r,pegasus_pcg_w) + AM_RANGE(0xe400, 0xe403) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pia_u", pia6821_device, read, write) + AM_RANGE(0xe600, 0xe603) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pia_s", pia6821_device, read, write) + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pegasusm_mem, AS_PROGRAM, 8, pegasus_state) + ADDRESS_MAP_UNMAP_HIGH + AM_IMPORT_FROM(pegasus_mem) + AM_RANGE(0x5000, 0xafff) AM_RAM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pegasus ) + PORT_START("KEY.0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BackSpace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(8) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(20) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(13) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(16) + + PORT_START("KEY.1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ ]") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(127) PORT_CHAR('_') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(9) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(11) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(15) + + PORT_START("KEY.2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(10) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(21) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(7) + + PORT_START("KEY.3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(20) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // outputs a space + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ShiftR") PORT_NAME("ShiftR") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(8) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(25) + + PORT_START("KEY.4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(18) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(23) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // outputs a space + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(3) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(6) + + PORT_START("KEY.5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(5) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(17) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // REPEAT key which is disconnected - outputs a space + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LineFeed") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(10) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(4) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(14) + + PORT_START("KEY.6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(22) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(24) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BlankL") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(16) + + PORT_START("KEY.7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(19) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CapsLock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(19) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ShiftL") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BlankR") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(21) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(26) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("{ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('{') PORT_CHAR('}') +INPUT_PORTS_END + +void pegasus_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +static const UINT8 mcm6571a_shift[] = +{ + 0,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0, + 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0, + 1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0 +}; + + +UINT32 pegasus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,inv; + UINT16 sy=0,ma=0,x; + bool pcg_mode = BIT(m_control_bits, 1); + + for(y = 0; y < 16; y++ ) + { + for(ra = 0; ra < 16; ra++ ) + { + UINT16 *p = &bitmap.pix16(sy++); + + for(x = ma; x < ma + 32; x++ ) + { + inv = 0xff; + chr = m_p_videoram[x]; + + if (BIT(chr, 7)) + { + inv = 0; + chr &= 0x7f; + } + + if (pcg_mode) + { + gfx = m_p_pcgram[(chr << 4) | ra] ^ inv; + } + else + if (mcm6571a_shift[chr]) + { + if (ra < 3) + gfx = inv; + else + gfx = m_p_chargen[(chr<<4) | (ra-3) ] ^ inv; + } + else + { + if (ra < 10) + gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; + else + gfx = inv; + } + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=32; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout pegasus_charlayout = +{ + 8, 16, /* text = 7 x 9, pcg = 8 x 16 */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( pegasus ) + GFXDECODE_ENTRY( "chargen", 0x0000, pegasus_charlayout, 0, 1 ) + GFXDECODE_ENTRY( "pcg", 0x0000, pegasus_charlayout, 0, 1 ) +GFXDECODE_END + + +// An encrypted single rom starts with 02, decrypted with 20. +// The 2nd and 3rd part of a multi-rom set will have no obvious byte, +// so we check the first 4 bytes for a signature, and decrypt if found. +void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM) +{ + bool doit = FALSE; + UINT8 b; + UINT16 j; + dynamic_buffer temp_copy; + temp_copy.resize(0x1000); + + if (ROM[0] == 0x02) doit = TRUE; + if (ROM[0] == 0x1e && ROM[1] == 0xfa && ROM[2] == 0x60 && ROM[3] == 0x71) doit = TRUE; // xbasic 2nd rom + if (ROM[0] == 0x72 && ROM[1] == 0x62 && ROM[2] == 0xc6 && ROM[3] == 0x36) doit = TRUE; // xbasic 3rd rom + if (ROM[0] == 0xf0 && ROM[1] == 0x40 && ROM[2] == 0xce && ROM[3] == 0x80) doit = TRUE; // forth 2nd rom (both sets) + if (ROM[0] == 0x80 && ROM[1] == 0x06 && ROM[2] == 0x68 && ROM[3] == 0x14) doit = TRUE; // pascal 2nd rom + + if (doit) + { + for (int i = 0; i < 0x1000; i++) + { + b = ROM[i]; + j = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7); + b = BITSWAP8(b, 3, 2, 1, 0, 7, 6, 5, 4); + temp_copy[j & 0xfff] = b; + } + memcpy(ROM, &temp_copy[0], 0x1000); + } +} + +int pegasus_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag) +{ + UINT32 size = slot->common_get_size(reg_tag); + bool any_socket = false; + + if (size > 0x1000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + if (image.software_entry() != NULL && size == 0) + { + // we might be loading a cart compatible with all sockets! + // so try to get region "rom" + size = slot->common_get_size("rom"); + any_socket = true; + + if (size == 0) + { + std::string errmsg; + strprintf(errmsg,"Attempted to load a file that does not work in this socket.\nPlease check \"Usage\" field in the software list for the correct socket(s) to use."); + image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); + return IMAGE_INIT_FAIL; + } + } + + slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // we alloc 0x1000 also for smaller roms! + slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag); + + // raw images have to be decrypted (in particular the ones from softlist) + pegasus_decrypt_rom(slot->get_rom_base()); + + return IMAGE_INIT_PASS; +} + +void pegasus_state::machine_start() +{ + m_p_pcgram = memregion("pcg")->base(); + + if (m_exp_00->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_00)); + if (m_exp_01->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_01)); + if (m_exp_02->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x2fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_02)); + if (m_exp_0c->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_0c)); + if (m_exp_0d->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_0d)); +} + +void pegasus_state::machine_reset() +{ + m_kbd_row = 0; + m_kbd_irq = 1; + m_control_bits = 0; +} + +DRIVER_INIT_MEMBER(pegasus_state, pegasus) +{ + // decrypt monitor + UINT8 *base = memregion("maincpu")->base() + 0xf000; + pegasus_decrypt_rom(base); +} + +static MACHINE_CONFIG_START( pegasus, pegasus_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809E, XTAL_4MHz) // actually a 6809C - 4MHZ clock coming in, 1MHZ internally + MCFG_CPU_PROGRAM_MAP(pegasus_mem) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("pegasus_firq", pegasus_state, pegasus_firq, attotime::from_hz(400)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(pegasus_state, screen_update) + MCFG_SCREEN_SIZE(32*8, 16*16) + MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 16*16-1) + MCFG_SCREEN_PALETTE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pegasus) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD("pia_s", PIA6821, 0) + MCFG_PIA_READPB_HANDLER(READ8(pegasus_state, pegasus_keyboard_r)) + MCFG_PIA_READCA1_HANDLER(READLINE(pegasus_state, pegasus_cassette_r)) + MCFG_PIA_READCB1_HANDLER(READLINE(pegasus_state, pegasus_keyboard_irq)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(pegasus_state, pegasus_keyboard_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(pegasus_state, pegasus_controls_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(pegasus_state, pegasus_cassette_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(pegasus_state, pegasus_firq_clr)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + + MCFG_DEVICE_ADD("pia_u", PIA6821, 0) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + + MCFG_GENERIC_SOCKET_ADD("exp00", generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp00_load) + + MCFG_GENERIC_SOCKET_ADD("exp01", generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp01_load) + + MCFG_GENERIC_SOCKET_ADD("exp02", generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp02_load) + + MCFG_GENERIC_SOCKET_ADD("exp0c", generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp0c_load) + + MCFG_GENERIC_SOCKET_ADD("exp0d", generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp0d_load) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED|CASSETTE_MOTOR_ENABLED) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "pegasus_cart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pegasusm, pegasus ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP(pegasusm_mem) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( pegasus ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "11r2674", "Monitor 1.1 r2674") + ROMX_LOAD( "mon11_2674.bin", 0xf000, 0x1000, CRC(1640ff7e) SHA1(8199643749fb40fb8be05e9f311c75620ca939b1), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "10r2569", "Monitor 1.0 r2569") + ROMX_LOAD( "mon10_2569.bin", 0xf000, 0x1000, CRC(910fc930) SHA1(a4f6bbe5def0268cc49ee7045616a39017dd8052), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "11r2569", "Monitor 1.1 r2569") + ROMX_LOAD( "mon11_2569.bin", 0xf000, 0x1000, CRC(07b92002) SHA1(3c434601120870c888944ecd9ade5186432ddbc2), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "11r2669", "Monitor 1.1 r2669") + ROMX_LOAD( "mon11_2669.bin", 0xf000, 0x1000, CRC(f3ee23c8) SHA1(3ac96935668f5e53799c90db5140393c2ef9ce36), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS(4, "22r2856", "Monitor 2.2 r2856") + ROMX_LOAD( "mon22_2856.bin", 0xf000, 0x1000, CRC(5f5f688a) SHA1(3719eecc347e158dd027ea7aa8a068cdafc00d9b), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS(5, "22br2856", "Monitor 2.2B r2856") + ROMX_LOAD( "mon22b_2856.bin", 0xf000, 0x1000, CRC(a47b0308) SHA1(f215e51aa8df6aed99c10f3df6a3589cb9f63d46), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS(6, "23r2601", "Monitor 2.3 r2601") + ROMX_LOAD( "mon23_2601.bin", 0xf000, 0x1000, CRC(0e024222) SHA1(9950cba08996931b9d5a3368b44c7309638b4e08), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS(7, "23ar2569", "Monitor 2.3A r2569") + ROMX_LOAD( "mon23a_2569.bin", 0xf000, 0x1000, CRC(248e62c9) SHA1(adbde27e69b38b29ff89bacf28d0240a8e5d90f3), ROM_BIOS(8) ) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "6571.bin", 0x0000, 0x0800, CRC(5a25144b) SHA1(7b9fee0c8ef2605b85d12b6d9fe8feb82418c63a) ) + + ROM_REGION( 0x800, "pcg", ROMREGION_ERASEFF ) +ROM_END + +#define rom_pegasusm rom_pegasus + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, pegasus, 0, 0, pegasus, pegasus, pegasus_state, pegasus, "Technosys", "Aamber Pegasus", MACHINE_NO_SOUND_HW ) +COMP( 1981, pegasusm, pegasus, 0, pegasusm, pegasus, pegasus_state, pegasus, "Technosys", "Aamber Pegasus with RAM expansion unit", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/pencil2.c b/src/mame/drivers/pencil2.c new file mode 100644 index 00000000000..bde1c817f9c --- /dev/null +++ b/src/mame/drivers/pencil2.c @@ -0,0 +1,348 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Hanimex Pencil II + Manufactured by Soundic, Hong Kong. + + 2012-11-06 [Robbbert] + + Computer kindly donated for MESS by Ian Farquhar. + + Accessories: + - PEN-216 : 16k RAM expansion + - PEN-264 : 64k RAM expansion + - PEN-511 : Data Cassette Recorder + - ??? : Printer + - ??? : Floppy Disk Drive (5.25) + - ??? : Floppy Disk Controller + - ??? : RS-232C Serial Interface + - ??? : Coleco Adapter* + - PEN-8xx : Various software on Cassette or Floppy Disk + - ??? : Game Controller (joystick and 14 buttons) + - PEN-7xx : Various software in Cartridge format + - PEN-430 : Modem + - PEN-902 : Computer power supply + - PEN-962 : Monitor cable + + * The cart slot is the same as that found on the Colecovision console. By plugging the + Coleco Adapter into the expansion slot, Colecovision cartridges can be plugged into the + cart slot and played. + +Information found by looking inside the computer +------------------------------------------------ +Main Board PEN-002 11-50332-10 + +J1 Expansion slot +J2 Cart slot +J3 Memory expansion slot +J4 Printer slot +J5,J6 Joystick ports + +XTAL 10.738 MHz + +Output is to a TV on Australian Channel 1. + +U1 uPD780C-1 (Z80A) +U2 Video chip with heatsink stuck on top, TMS9929 +U3 SN76489AN +U4 2764 bios rom +U5 uPD4016C-2 (assumed to be equivalent of 6116 2K x 8bit static RAM) +U6 74LS04 +U7 74LS74A +U8-10 74LS138 +U11 74LS00 +U12 74LS273 +U13 74LS74A +U14-21 TMM416P-3 (4116-3 16k x 1bit dynamic RAM) +U22 74LS05 +U23-24 SN74LS541 + + +SD-BASIC usage: +All commands must be in uppercase, which is the default at boot. +The 'capslock' is done by pressing Shift and Esc together, and the +cursor will change to a checkerboard pattern. + + +MEMORY MAP +0000-1FFF bios rom +2000-5FFF available for expansion +6000-7FFF static RAM (2K mirrored) +8000-FFFF cart slot + +The 16k dynamic RAM holds the BASIC program and the video/gfx etc +but is banked out of view of a BASIC program. + + +ToDo: +- Joysticks (no info) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/tms9928a.h" +#include "sound/sn76496.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class pencil2_state : public driver_device +{ +public: + pencil2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_centronics(*this, "centronics") + , m_cass(*this, "cassette") + , m_cart(*this, "cartslot") + {} + + DECLARE_WRITE8_MEMBER(port10_w); + DECLARE_WRITE8_MEMBER(port30_w); + DECLARE_WRITE8_MEMBER(port80_w); + DECLARE_WRITE8_MEMBER(portc0_w); + DECLARE_READ8_MEMBER(porte2_r); + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_CUSTOM_INPUT_MEMBER(printer_ready_r); + DECLARE_CUSTOM_INPUT_MEMBER(printer_ack_r); +private: + virtual void machine_start(); + int m_centronics_busy; + int m_centronics_ack; + bool m_cass_state; + required_device m_maincpu; + required_device m_centronics; + required_device m_cass; + required_device m_cart; +}; + +static ADDRESS_MAP_START(pencil2_mem, AS_PROGRAM, 8, pencil2_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0x5fff) AM_WRITENOP // stop error log filling up + AM_RANGE(0x6000, 0x67ff) AM_MIRROR(0x1800) AM_RAM + //AM_RANGE(0x8000, 0xffff) // mapped by the cartslot +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pencil2_io, AS_IO, 8, pencil2_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x0f) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x10, 0x1f) AM_WRITE(port10_w) + AM_RANGE(0x30, 0x3f) AM_WRITE(port30_w) + AM_RANGE(0x80, 0x9f) AM_WRITE(port80_w) + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) + AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) + AM_RANGE(0xc0, 0xdf) AM_WRITE(portc0_w) + AM_RANGE(0xe0, 0xff) AM_DEVWRITE("sn76489a", sn76489a_device, write) + AM_RANGE(0xe0, 0xe0) AM_READ_PORT("E0") + AM_RANGE(0xe1, 0xe1) AM_READ_PORT("E1") + AM_RANGE(0xe2, 0xe2) AM_READ(porte2_r) + AM_RANGE(0xe3, 0xe3) AM_READ_PORT("E3") + AM_RANGE(0xe4, 0xe4) AM_READ_PORT("E4") + AM_RANGE(0xe6, 0xe6) AM_READ_PORT("E6") + AM_RANGE(0xe8, 0xe8) AM_READ_PORT("E8") + AM_RANGE(0xea, 0xea) AM_READ_PORT("EA") + AM_RANGE(0xf0, 0xf0) AM_READ_PORT("F0") + AM_RANGE(0xf2, 0xf2) AM_READ_PORT("F2") +ADDRESS_MAP_END + +READ8_MEMBER( pencil2_state::porte2_r) +{ + return (m_cass->input() > 0.1) ? 0xff : 0x7f; +} + +WRITE8_MEMBER( pencil2_state::port10_w ) +{ + m_centronics->write_strobe(BIT(data, 0)); +} + +WRITE8_MEMBER( pencil2_state::port30_w ) +{ + m_cass_state ^= 1; + m_cass->output( m_cass_state ? -1.0 : +1.0); +} + +WRITE8_MEMBER( pencil2_state::port80_w ) +{ +} + +WRITE8_MEMBER( pencil2_state::portc0_w ) +{ +} + +WRITE_LINE_MEMBER( pencil2_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +CUSTOM_INPUT_MEMBER( pencil2_state::printer_ready_r ) +{ + return m_centronics_busy; +} + +WRITE_LINE_MEMBER( pencil2_state::write_centronics_ack ) +{ + m_centronics_ack = state; +} + +CUSTOM_INPUT_MEMBER( pencil2_state::printer_ack_r ) +{ + return m_centronics_ack; +} + + +/* Input ports */ +static INPUT_PORTS_START( pencil2 ) + PORT_START("E0") + // port_custom MUST be ACTIVE_HIGH to work + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pencil2_state, printer_ready_r, " ") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_END) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pencil2_state, printer_ack_r, " ") + + PORT_START("E1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR('@') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('>') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("E3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("E4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("E6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("E8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR('/') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR('?') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("EA") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("F0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("F2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +void pencil2_state::machine_start() +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +static MACHINE_CONFIG_START( pencil2, pencil2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_10_738635MHz/3) + MCFG_CPU_PROGRAM_MAP(pencil2_mem) + MCFG_CPU_IO_MAP(pencil2_io) + + /* video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("sn76489a", SN76489A, XTAL_10_738635MHz/3) // guess + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pencil2_cart") + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pencil2_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pencil2_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "pencil2") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pencil2 ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "mt.u4", 0x0000, 0x2000, CRC(338d7b59) SHA1(2f89985ac06971e00210ff992bf1e30a296d10e7) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, pencil2, 0, 0, pencil2, pencil2, driver_device, 0, "Hanimex", "Pencil II", 0 ) diff --git a/src/mame/drivers/pentagon.c b/src/mame/drivers/pentagon.c new file mode 100644 index 00000000000..61265e75ab4 --- /dev/null +++ b/src/mame/drivers/pentagon.c @@ -0,0 +1,354 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, MetalliC +#include "emu.h" +#include "includes/spectrum.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/ay8910.h" +#include "sound/speaker.h" +#include "formats/tzx_cas.h" +#include "machine/beta.h" +#include "machine/ram.h" + +class pentagon_state : public spectrum_state +{ +public: + enum + { + TIMER_IRQ_ON, + TIMER_IRQ_OFF + }; + pentagon_state(const machine_config &mconfig, device_type type, const char *tag) + : spectrum_state(mconfig, type, tag) + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_bank4(*this, "bank4") + , m_beta(*this, BETA_DISK_TAG) + { } + + DECLARE_DIRECT_UPDATE_MEMBER(pentagon_direct); + DECLARE_WRITE8_MEMBER(pentagon_port_7ffd_w); + DECLARE_WRITE8_MEMBER(pentagon_scr_w); + DECLARE_WRITE8_MEMBER(pentagon_scr2_w); + DECLARE_MACHINE_RESET(pentagon); + INTERRUPT_GEN_MEMBER(pentagon_interrupt); + TIMER_CALLBACK_MEMBER(irq_on); + TIMER_CALLBACK_MEMBER(irq_off); +protected: + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_device m_beta; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +private: + UINT8 *m_p_ram; + void pentagon_update_memory(); +}; + +DIRECT_UPDATE_MEMBER(pentagon_state::pentagon_direct) +{ + UINT16 pc = m_maincpu->pcbase(); + + if (m_beta->started() && m_beta->is_active() && (pc >= 0x4000)) + { + m_ROMSelection = BIT(m_port_7ffd_data, 4); + m_beta->disable(); + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); + } + else + if (((pc & 0xff00) == 0x3d00) && (m_ROMSelection==1)) + { + m_ROMSelection = 3; + if (m_beta->started()) + m_beta->enable(); + } + + if (address<=0x3fff) + { + if (m_ROMSelection == 3) + { + if (m_beta->started()) + { + direct.explicit_configure(0x0000, 0x3fff, 0x3fff, memregion("beta:beta")->base()); + m_bank1->set_base(memregion("beta:beta")->base()); + } + } + else + { + direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x10000 + (m_ROMSelection<<14)]); + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); + } + return ~0; + } + + return address; +} + +void pentagon_state::pentagon_update_memory() +{ + UINT8 *messram = m_ram->pointer(); + + m_screen_location = messram + ((m_port_7ffd_data & 8) ? (7<<14) : (5<<14)); + + if (strcmp(machine().system().name, "pent1024") != 0) + { + m_bank4->set_base(messram + ((m_port_7ffd_data & 0x07) * 0x4000)); + } + else + { + // currently 512Kb ram expansion supported + m_bank4->set_base(messram + (((m_port_7ffd_data & 0x07) | ((m_port_7ffd_data & 0xc0) >> 3)) * 0x4000)); + } + + if (m_beta->started() && m_beta->is_active() && !( m_port_7ffd_data & 0x10 ) ) + { + /* GLUK */ + if (strcmp(machine().system().name, "pent1024")==0) + m_ROMSelection = 2; + else + m_ROMSelection = BIT(m_port_7ffd_data, 4); + } + else + /* ROM switching */ + m_ROMSelection = BIT(m_port_7ffd_data, 4); + + /* rom 0 is 128K rom, rom 1 is 48 BASIC */ + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); +} + +WRITE8_MEMBER(pentagon_state::pentagon_port_7ffd_w) +{ + /* disable paging */ + if (m_port_7ffd_data & 0x20) + return; + + if ((m_port_7ffd_data ^ data) & 0x08) + spectrum_UpdateScreenBitmap(); + + /* store new state */ + m_port_7ffd_data = data; + + /* update memory */ + pentagon_update_memory(); +} + +WRITE8_MEMBER(pentagon_state::pentagon_scr_w) +{ + spectrum_UpdateScreenBitmap(); + + *((UINT8*)m_bank2->base() + offset) = data; +} + +WRITE8_MEMBER(pentagon_state::pentagon_scr2_w) +{ + if ((m_port_7ffd_data & 0x0f) == 0x0f || (m_port_7ffd_data & 0x0f) == 5) + spectrum_UpdateScreenBitmap(); + + *((UINT8*)m_bank4->base() + offset) = data; +} + +void pentagon_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_IRQ_ON: + irq_on(ptr, param); + break; + case TIMER_IRQ_OFF: + irq_off(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in pentagon_state::device_timer"); + } +} + +TIMER_CALLBACK_MEMBER(pentagon_state::irq_on) +{ + m_maincpu->set_input_line(0, HOLD_LINE); + timer_set(attotime::from_ticks(32, XTAL_14MHz / 4), TIMER_IRQ_OFF, 0); +} + +TIMER_CALLBACK_MEMBER(pentagon_state::irq_off) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +INTERRUPT_GEN_MEMBER(pentagon_state::pentagon_interrupt) +{ + timer_set(attotime::from_ticks(179, XTAL_14MHz / 4), TIMER_IRQ_ON, 0); +} +static ADDRESS_MAP_START (pentagon_io, AS_IO, 8, pentagon_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0000) AM_WRITE(pentagon_port_7ffd_w) AM_MIRROR(0x7ffd) // (A15 | A1) == 0 + AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, status_r, command_w) AM_MIRROR(0xff00) + AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, track_r, track_w) AM_MIRROR(0xff00) + AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, sector_r, sector_w) AM_MIRROR(0xff00) + AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, data_r, data_w) AM_MIRROR(0xff00) + AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) + AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, state_r, param_w) AM_MIRROR(0xff00) + AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3ffd) + AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd) +ADDRESS_MAP_END + +MACHINE_RESET_MEMBER(pentagon_state,pentagon) +{ + UINT8 *messram = m_ram->pointer(); + address_space &space = m_maincpu->space(AS_PROGRAM); + m_p_ram = memregion("maincpu")->base(); + + space.install_read_bank(0x0000, 0x3fff, "bank1"); + space.unmap_write(0x0000, 0x3fff); + + space.install_write_handler(0x4000, 0x5aff, write8_delegate(FUNC(pentagon_state::pentagon_scr_w), this)); + space.install_write_handler(0xc000, 0xdaff, write8_delegate(FUNC(pentagon_state::pentagon_scr2_w), this)); + + if (m_beta->started()) + { + if (strcmp(machine().system().name, "pent1024")==0) + m_beta->enable(); + } + space.set_direct_update_handler(direct_update_delegate(FUNC(pentagon_state::pentagon_direct), this)); + + memset(messram,0,128*1024); + + /* Bank 5 is always in 0x4000 - 0x7fff */ + m_bank2->set_base(messram + (5<<14)); + + /* Bank 2 is always in 0x8000 - 0xbfff */ + m_bank3->set_base(messram + (2<<14)); + + m_port_7ffd_data = 0; + m_port_1ffd_data = -1; + pentagon_update_memory(); +} + +/* F4 Character Displayer */ +static const gfx_layout spectrum_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 96, /* 96 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( pentagon ) + GFXDECODE_ENTRY( "maincpu", 0x17d00, spectrum_charlayout, 0, 8 ) +GFXDECODE_END + + + +static MACHINE_CONFIG_DERIVED_CLASS( pentagon, spectrum_128, pentagon_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(XTAL_14MHz / 4) + MCFG_CPU_IO_MAP(pentagon_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pentagon_state, pentagon_interrupt) + MCFG_MACHINE_RESET_OVERRIDE(pentagon_state, pentagon ) + + MCFG_SCREEN_MODIFY("screen") + //MCFG_SCREEN_RAW_PARAMS(XTAL_14MHz / 2, 448, 0, 352, 320, 0, 304) + MCFG_SCREEN_RAW_PARAMS(XTAL_14MHz / 2, 448, 0, 352, 320, 0, 287) + + MCFG_BETA_DISK_ADD(BETA_DISK_TAG) + MCFG_GFXDECODE_MODIFY("gfxdecode", pentagon) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_REPLACE("ay8912", AY8912, XTAL_14MHz / 8) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "lspeaker", 0.25) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) + MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) + + MCFG_SOFTWARE_LIST_ADD("cass_list_pen","pentagon_cass") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pent1024, pentagon) + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1024K") +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(pentagon) + ROM_REGION(0x01c000, "maincpu", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "v1", "Pentagon 128K") + ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(1)) + ROMX_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "Pentagon 128K 93") + ROMX_LOAD("128tr93.rom",0x010000, 0x4000, CRC(08ad241c) SHA1(16daba547c644ef01ce76d2686ccfbff72e13dbe), ROM_BIOS(2)) + ROMX_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v3", "Pentagon 128K (joined)") + ROMX_LOAD( "pentagon.rom", 0x010000, 0x8000, CRC(aa1ce4bd) SHA1(a584272f21dc82c14b7d4f1ed440e23a976e71f0), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v4", "Pentagon 128K Spanish") + ROMX_LOAD( "pent-es.rom", 0x010000, 0x8000, CRC(34d04bae) SHA1(6782c8c0ee77c40d6d3170a254894dae44ddc93e), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v5", "Pentagon 128K SOS89R Monitor") + ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(5)) + ROMX_LOAD( "sos89r.rom",0x014000, 0x4000, CRC(09c9e7e1) SHA1(29c567921abd377d2f9c088352c392a5a0858651), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "v6", "Pentagon 128K 1990 Monitor") + ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(6)) + ROMX_LOAD( "basic90.rom",0x014000, 0x4000, CRC(a41575ba) SHA1(44c5de86e765172b0af154fe3934643ce40bf378), ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "v7", "Pentagon 128K RaK(c) 1991 Monitor") + ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(7)) + ROMX_LOAD( "sos48.rom", 0x014000, 0x4000, CRC(ceb4005d) SHA1(d56c01ea7abdca178efb2b1c6b2866a9a38274ee), ROM_BIOS(7)) + ROM_SYSTEM_BIOS(7, "v8", "Pentagon 128K Dynaelectronics 1989") + ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(8)) + ROMX_LOAD( "m48a.rom", 0x014000, 0x4000, CRC(a3b4def6) SHA1(7ad59ca373876d452b0cf0ed5edb0e93c3176f1a), ROM_BIOS(8)) + ROM_SYSTEM_BIOS(8, "v9", "ZXVGS v0.22 by Yarek") + ROMX_LOAD( "zxvgs-22-0.rom", 0x010000, 0x4000, CRC(63041c61) SHA1(f6718097d939afa8881b4436741a5a23d7e93d78), ROM_BIOS(9)) + ROMX_LOAD( "zxvgs-22-1.rom", 0x014000, 0x4000, CRC(f3736047) SHA1(f3739bf460a57e3f10e8dfb1e7120842938d27ea), ROM_BIOS(9)) + ROM_SYSTEM_BIOS(9, "v10", "ZXVGS v0.29 by Yarek") + ROMX_LOAD( "zxvg-29-0.rom", 0x010000, 0x4000, CRC(3b66f433) SHA1(d21df9e7f1ee99d8b38c2e6a32727aac0f1d5dc6), ROM_BIOS(10)) + ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(10)) + ROM_SYSTEM_BIOS(10, "v11", "ZXVGS v0.30 by Yarek") + ROMX_LOAD( "zxvg-30-0.rom", 0x010000, 0x4000, CRC(533e0f26) SHA1(b5f157c5d0da414ec77e445fdc40b78450129709), ROM_BIOS(11)) + ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(11)) + ROM_SYSTEM_BIOS(11, "v12", "ZXVGS v0.31 by Yarek") + ROMX_LOAD( "zxvg-31-0.rom", 0x010000, 0x4000, CRC(76f43500) SHA1(1c7cd52894847668418876d55b93b213d89d92ee), ROM_BIOS(12)) + ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(12)) + ROM_SYSTEM_BIOS(12, "v13", "ZXVGS v0.35 by Yarek") + ROMX_LOAD( "zxvg-35-0.rom", 0x010000, 0x4000, CRC(5cc8b3b1) SHA1(6c6d0ef1b65d7dc4f607d17204488264575ce48c), ROM_BIOS(13)) + ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(13)) + ROM_SYSTEM_BIOS(13, "v14", "NeOS 512") + ROMX_LOAD("neos_512.rom", 0x010000, 0x4000, CRC(1657fa43) SHA1(647545f06257bce9b1919fcb86b2a49a21c851a7), ROM_BIOS(14)) + ROMX_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(14)) +ROM_END + +ROM_START(pent1024) + ROM_REGION(0x01c000, "maincpu", ROMREGION_ERASEFF) + ROM_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca)) + ROM_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa)) + ROM_SYSTEM_BIOS(0, "v1", "Gluk 6.3r") + ROMX_LOAD( "gluk63r.rom",0x018000, 0x4000, CRC(ca321d79) SHA1(015eb96dafb273d4f4512c467e9b43c305fd1bc4), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "Gluk 5.2i") + ROMX_LOAD( "gluk52i.rom", 0x018000, 0x4000, CRC(fe44b86a) SHA1(9099d8a0f99a818849ca67ae1a8d3e7eacf06e65), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v3", "Gluk 5.3") + ROMX_LOAD( "gluk53.rom", 0x018000, 0x4000, CRC(479515ef) SHA1(ed656cd4faa36de2e31b38102bcbd8cee12e7976), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v4", "Gluk 5.4") + ROMX_LOAD( "gluk54r.rom", 0x018000, 0x4000, CRC(f4c1e975) SHA1(7e9e116750e1398572695b9cf8a120e47066256e), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v5", "Gluk 5.5r") + ROMX_LOAD( "gluk55r.rom", 0x018000, 0x4000, CRC(3658c1ee) SHA1(4a5c8ca1e090cfb0168796f0d695310fa5c955d3), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "v6", "Gluk 5.5rr") + ROMX_LOAD( "gluk55rr.rom",0x018000, 0x4000, CRC(6b60b818) SHA1(9d606275d17770c9341b33b43f40aee227078827), ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "v7", "Gluk 6.0r") + ROMX_LOAD( "gluk60r.rom", 0x018000, 0x4000, CRC(d114a032) SHA1(5db3462ce7a51b473a3a7056e67c11a62cc1cc2a), ROM_BIOS(7)) + ROM_SYSTEM_BIOS(7, "v8", "Gluk 6.0-1r") + ROMX_LOAD( "gluk601r.rom", 0x018000, 0x4000, CRC(daf6310b) SHA1(b8945168d4d136b731b33ec4758f8510c47fb8c4), ROM_BIOS(8)) + ROM_SYSTEM_BIOS(8, "v9", "Gluk 5.1") + ROMX_LOAD( "gluk51.rom", 0x018000, 0x4000, CRC(ea8c760b) SHA1(adaab28066ca46fbcdcf084c3b53d5a1b82d94a9), ROM_BIOS(9)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1989, pentagon, spec128, 0, pentagon, spec_plus, driver_device, 0, "", "Pentagon", 0) +COMP( 19??, pent1024, spec128, 0, pent1024, spec_plus, driver_device, 0, "", "Pentagon 1024", 0) diff --git a/src/mame/drivers/peoplepc.c b/src/mame/drivers/peoplepc.c new file mode 100644 index 00000000000..ce6041841d4 --- /dev/null +++ b/src/mame/drivers/peoplepc.c @@ -0,0 +1,302 @@ +// license:BSD-3-Clause +// copyright-holders:Carl + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "machine/i8257.h" +#include "machine/upd765.h" +#include "video/mc6845.h" +#include "bus/rs232/rs232.h" +#include "bus/rs232/keyboard.h" + +class peoplepc_state : public driver_device +{ +public: + peoplepc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette"), + m_pic_1(*this, "pic8259_1"), + m_8251key(*this, "i8251_0"), + m_8251ser(*this, "i8251_1"), + m_fdc(*this, "upd765"), + m_flop0(*this, "upd765:0"), + m_flop1(*this, "upd765:1"), + m_dmac(*this, "i8257"), + m_gfxdecode(*this, "gfxdecode"), + m_gvram(*this, "gvram"), + m_cvram(*this, "cvram"), + m_charram(4*1024) + { } + required_device m_maincpu; + required_device m_palette; + required_device m_pic_1; + required_device m_8251key; + required_device m_8251ser; + required_device m_fdc; + required_device m_flop0; + required_device m_flop1; + required_device m_dmac; + required_device m_gfxdecode; + required_shared_ptr m_gvram; + required_shared_ptr m_cvram; + dynamic_buffer m_charram; + + MC6845_UPDATE_ROW(update_row); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE16_MEMBER(charram_w); + DECLARE_WRITE_LINE_MEMBER(tty_clock_tick_w); + DECLARE_WRITE_LINE_MEMBER(kbd_clock_tick_w); + DECLARE_WRITE8_MEMBER(dmapg_w); + DECLARE_WRITE_LINE_MEMBER(tc_w); + DECLARE_WRITE_LINE_MEMBER(hrq_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + int floppy_load(floppy_image_device *dev); + void floppy_unload(floppy_image_device *dev); + + UINT8 m_dma0pg; +protected: + virtual void machine_start(); + virtual void machine_reset(); +}; + +static const gfx_layout peoplepc_charlayout = +{ + 8, 19, /* 8 x 19 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0}, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8, 16*8, 17*8, 18*8 }, + 8*32 +}; + +MC6845_UPDATE_ROW(peoplepc_state::update_row) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int i, j; + + for(i = 0; i < x_count; i++) + { + if(0) + { + UINT16 offset = ((ma | (ra << 1)) << 4) + i; + UINT8 data = m_gvram[offset] >> (offset & 1 ? 8 : 0); + + for(j = 8; j >= 0; j--) + bitmap.pix32(y, (i * 8) + j) = palette[( data & 1 << j ) ? 1 : 0]; + } + else + { + UINT8 data = m_charram[(m_cvram[(ma + i) & 0x3fff] & 0x7f) * 32 + ra]; + for(j = 0; j < 8; j++) + bitmap.pix32(y, (i * 8) + j) = palette[(data & (1 << j)) ? 1 : 0]; + } + } +} + +READ8_MEMBER(peoplepc_state::get_slave_ack) +{ + if (offset == 7) + return m_pic_1->acknowledge(); + + return 0x00; +} + +WRITE16_MEMBER(peoplepc_state::charram_w) +{ + m_charram[offset] = data; + m_gfxdecode->gfx(0)->mark_dirty(offset/16); +} + +WRITE_LINE_MEMBER(peoplepc_state::tty_clock_tick_w) +{ + m_8251ser->write_txc(state); + m_8251ser->write_rxc(state); +} + +WRITE_LINE_MEMBER(peoplepc_state::kbd_clock_tick_w) +{ + m_8251key->write_txc(state); + m_8251key->write_rxc(state); +} + +WRITE8_MEMBER(peoplepc_state::dmapg_w) +{ + m_dma0pg = data; +} + +WRITE_LINE_MEMBER(peoplepc_state::tc_w) +{ + m_fdc->tc_w(state); +} + +WRITE_LINE_MEMBER(peoplepc_state::hrq_w) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state); + m_dmac->hlda_w(state); +} + +READ8_MEMBER(peoplepc_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset | (m_dma0pg << 16)); +} + +WRITE8_MEMBER(peoplepc_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset | (m_dma0pg << 16), data); +} + +int peoplepc_state::floppy_load(floppy_image_device *dev) +{ + dev->mon_w(0); + return IMAGE_INIT_PASS; +} + +void peoplepc_state::floppy_unload(floppy_image_device *dev) +{ + dev->mon_w(1); +} + +void peoplepc_state::machine_reset() +{ + m_flop0->get_device()->mon_w(!m_flop0->get_device()->exists()); + m_flop1->get_device()->mon_w(!m_flop1->get_device()->exists()); +} + +void peoplepc_state::machine_start() +{ + m_gfxdecode->set_gfx(0, global_alloc(gfx_element(machine().device("palette"), peoplepc_charlayout, &m_charram[0], 0, 1, 0))); + m_dma0pg = 0; + + // FIXME: cheat as there no docs about how or obvious ports that set to control the motor + m_flop0->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(peoplepc_state::floppy_load), this)); + m_flop0->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(peoplepc_state::floppy_unload), this)); + m_flop1->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(peoplepc_state::floppy_load), this)); + m_flop1->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(peoplepc_state::floppy_unload), this)); +} + +static ADDRESS_MAP_START( peoplepc_map, AS_PROGRAM, 16, peoplepc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x7ffff) AM_RAM + AM_RANGE(0xc0000, 0xdffff) AM_RAM AM_SHARE("gvram") + AM_RANGE(0xe0000, 0xe3fff) AM_RAM AM_SHARE("cvram") + AM_RANGE(0xe4000, 0xe5fff) AM_WRITE(charram_w) + AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(peoplepc_io, AS_IO, 16, peoplepc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0014, 0x0017) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x0018, 0x001b) AM_DEVREADWRITE8("pic8259_0", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x0020, 0x0031) AM_DEVREADWRITE8("i8257", i8257_device, read, write, 0x00ff) + AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0x00ff) + AM_RANGE(0x0048, 0x004f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0x00ff) + AM_RANGE(0x0054, 0x0055) AM_DEVREADWRITE8("i8251_0", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0x0056, 0x0057) AM_DEVREADWRITE8("i8251_0", i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0x005c, 0x005d) AM_DEVREADWRITE8("i8251_1", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0x005e, 0x005f) AM_DEVREADWRITE8("i8251_1", i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0x0064, 0x0067) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff) + AM_RANGE(0x006c, 0x006d) AM_DEVWRITE8("h46505", mc6845_device, address_w, 0x00ff) + AM_RANGE(0x006e, 0x006f) AM_DEVREADWRITE8("h46505", mc6845_device, register_r, register_w, 0x00ff) + AM_RANGE(0x0070, 0x0071) AM_WRITE8(dmapg_w, 0x00ff) +ADDRESS_MAP_END + +static SLOT_INTERFACE_START( peoplepc_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( peoplepc_state::floppy_formats ) + FLOPPY_IMD_FORMAT +FLOPPY_FORMATS_END + +SLOT_INTERFACE_START( peoplepc_keyboard_devices ) + SLOT_INTERFACE("keyboard", SERIAL_KEYBOARD) +SLOT_INTERFACE_END + +static DEVICE_INPUT_DEFAULTS_START(keyboard) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_1200 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +static MACHINE_CONFIG_START( olypeopl, peoplepc_state) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_14_7456MHz/3) + MCFG_CPU_PROGRAM_MAP(peoplepc_map) + MCFG_CPU_IO_MAP(peoplepc_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_0", pic8259_device, inta_cb) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_14_7456MHz/6) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(peoplepc_state, kbd_clock_tick_w)) + MCFG_PIT8253_CLK1(XTAL_14_7456MHz/6) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(peoplepc_state, tty_clock_tick_w)) + MCFG_PIT8253_CLK2(XTAL_14_7456MHz/6) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic8259_0", pic8259_device, ir0_w)) + + MCFG_PIC8259_ADD("pic8259_0", INPUTLINE("maincpu", 0), VCC, READ8(peoplepc_state, get_slave_ack)) + MCFG_PIC8259_ADD("pic8259_1", DEVWRITELINE("pic8259_0", pic8259_device, ir7_w), GND, NULL) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_22MHz,640,0,640,475,0,475) + MCFG_SCREEN_UPDATE_DEVICE( "h46505", mc6845_device, screen_update ) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_MC6845_ADD("h46505", H46505, "screen", XTAL_22MHz/8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(peoplepc_state, update_row) + + MCFG_DEVICE_ADD("i8257", I8257, XTAL_14_7456MHz/3) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(peoplepc_state, hrq_w)) + MCFG_I8257_OUT_TC_CB(WRITELINE(peoplepc_state, tc_w)) + MCFG_I8257_IN_MEMR_CB(READ8(peoplepc_state, memory_read_byte)) + MCFG_I8257_OUT_MEMW_CB(WRITE8(peoplepc_state, memory_write_byte)) + MCFG_I8257_IN_IOR_0_CB(DEVREAD8("upd765", upd765a_device, mdma_r)) + MCFG_I8257_OUT_IOW_0_CB(DEVWRITE8("upd765", upd765a_device, mdma_w)) + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("pic8259_0", pic8259_device, ir2_w)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("i8257", i8257_device, dreq0_w)) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", peoplepc_floppies, "525qd", peoplepc_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", peoplepc_floppies, "525qd", peoplepc_state::floppy_formats) + + MCFG_DEVICE_ADD("i8251_0", I8251, 0) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259_1", pic8259_device, ir1_w)) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("kbd", rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD("kbd", peoplepc_keyboard_devices, "keyboard") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251_0", i8251_device, write_rxd)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("keyboard", keyboard) + + MCFG_DEVICE_ADD("i8251_1", I8251, 0) +MACHINE_CONFIG_END + +ROM_START( olypeopl ) + ROM_REGION(0x2000,"maincpu", 0) + ROM_SYSTEM_BIOS(0, "hd", "HD ROM") + ROMX_LOAD( "u01271c0.bin", 0x00000, 0x1000, CRC(8e0ef114) SHA1(774bab0a3e29853e9f6b951cf73082063ea61e6d), ROM_SKIP(1)|ROM_BIOS(1)) + ROMX_LOAD( "u01271d0.bin", 0x00001, 0x1000, CRC(e2419bf9) SHA1(d88381f8709c91e2adba08f378e29bd0d19ee5ae), ROM_SKIP(1)|ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "2fd", "2 FD ROM") + ROMX_LOAD( "u01277f3.bin", 0x00000, 0x1000, CRC(428ff135) SHA1(ec11f0e43455570c40f5dc4b84f8420da5939368), ROM_SKIP(1)|ROM_BIOS(2)) + ROMX_LOAD( "u01277g3.bin", 0x00001, 0x1000, CRC(3295691c) SHA1(7d7ade62117d11656b8dd86cf0703127616d55bc), ROM_SKIP(1)|ROM_BIOS(2)) +ROM_END + +COMP( 198?, olypeopl, 0, 0, olypeopl, 0, driver_device, 0, "Olympia", "People PC", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mame/drivers/pes.c b/src/mame/drivers/pes.c new file mode 100644 index 00000000000..f80cb743f21 --- /dev/null +++ b/src/mame/drivers/pes.c @@ -0,0 +1,285 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/****************************************************************************** +* +* Pacific Educational Systems 'PES' Speech box +* Part number VPU-1 V1 +* By Kevin 'kevtris' Horton and Jonathan Gevaryahu AKA Lord Nightmare +* +* RE work done by Kevin Horton and Jonathan Gevaryahu +* +* DONE: +* compiles correctly +* rom loads correctly +* interface with tms5220 is done +* rts and cts bits are stored in struct +* serial is attached to terminal +* +* TODO: +* serial receive clear should happen after delay of one cpu cycle, not ASSERT and then CLEAR immediately after +* figure out how to attach serial to external socket +* +*********************************************************************** +This is almost as simple as hardware gets from the digital side: +Hardware consists of: +10.245Mhz xtal +80c31 cpu/mcu +27c64 rom (holds less than 256 bytes of code) +unpopulated 6164 sram, which isn't used +TSP5220C speech chip (aka tms5220c) +mc145406 RS232 driver/receiver (+-24v to 0-5v converter for serial i/o) +74hc573b1 octal tri-state D-latch (part of bus interface for ROM) +74hc74b1 dual d-flipflop with set/reset, positive edge trigger (?) +74hc02b1 quad 2-input NOR gate (wired up to decode address 0, and data 0 and 1 to produce /RS and /WS) +mc14520b dual 4-bit binary up counter (used as a chopper for the analog filter) +Big messy analog section to allow voice output to be filtered extensively by a 4th order filter + +Address map: +80C31 ADDR: + 0000-1FFF: ROM + 2000-3FFF: open bus (would be ram) + 4000-ffff: open bus +80C31 IO: + 00 W: d0 and d1 are the /RS and /WS bits + port 1.x: tms5220 bus + port 2.x: unused + port 3.0: RxD serial receive + port 3.1: TxD serial send + port 3.2: read, from /INT on tms5220c + port 3.3: read, from /READY on tms5220c + port 3.4: read, from the serial RTS line + port 3.5: read/write, to the serial CTS line, inverted (effectively /CTS) + port 3.6: write, /WR (general) and /WE (pin 27) for unpopulated 6164 SRAM + port 3.7: write, /RD (general) and /OE (pin 22) for unpopulated 6164 SRAM + +*/ +#define CPU_CLOCK XTAL_10_245MHz + +#undef DEBUG_FIFO +#undef DEBUG_SERIAL_CB +#undef DEBUG_PORTS + +/* Core includes */ +#include "emu.h" +#include "includes/pes.h" +#include "cpu/mcs51/mcs51.h" +#include "sound/tms5220.h" + +/* Devices */ +WRITE8_MEMBER(pes_state::pes_kbd_input) +{ +#ifdef DEBUG_FIFO + fprintf(stderr,"keyboard input: %c, ", data); +#endif + // if fifo is full (head ptr = tail ptr-1), do not increment the head ptr and do not store the data + if (((m_infifo_tail_ptr-1)&0x1F) == m_infifo_head_ptr) + { + logerror("infifo was full, write ignored!\n"); +#ifdef DEBUG_FIFO + fprintf(stderr,"infifo was full, write ignored!\n"); +#endif + return; + } + m_infifo[m_infifo_head_ptr] = data; + m_infifo_head_ptr++; + m_infifo_head_ptr&=0x1F; +#ifdef DEBUG_FIFO + fprintf(stderr,"kb input fifo fullness: %d\n",(m_infifo_head_ptr-m_infifo_tail_ptr)&0x1F); +#endif + // todo: following two should be set so clear happens after one cpu cycle + m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); + m_maincpu->set_input_line(MCS51_RX_LINE, CLEAR_LINE); +} + +/* Helper Functions */ +READ8_MEMBER( pes_state::data_to_i8031) +{ + UINT8 data; + data = m_infifo[m_infifo_tail_ptr]; + // if fifo is empty (tail ptr == head ptr), do not increment the tail ptr, otherwise do. + if (m_infifo_tail_ptr != m_infifo_head_ptr) m_infifo_tail_ptr++; + m_infifo_tail_ptr&=0x1F; +#ifdef DEBUG_SERIAL_CB + fprintf(stderr,"callback: input to i8031/pes from pc/terminal: %02X\n",data); +#endif + return data; +} + +WRITE8_MEMBER(pes_state::data_from_i8031) +{ + m_terminal->write(space,0,data); +#ifdef DEBUG_SERIAL_CB + fprintf(stderr,"callback: output from i8031/pes to pc/terminal: %02X\n",data); +#endif +} + +/* Port Handlers */ +WRITE8_MEMBER( pes_state::rsws_w ) +{ + m_wsstate = data&0x1; // /ws is bit 0 + m_rsstate = (data&0x2)>>1; // /rs is bit 1 +#ifdef DEBUG_PORTS + logerror("port0 write: RSWS states updated: /RS: %d, /WS: %d\n", m_rsstate, m_wsstate); +#endif + m_speech->rsq_w(m_rsstate); + m_speech->wsq_w(m_wsstate); +} + +WRITE8_MEMBER( pes_state::port1_w ) +{ +#ifdef DEBUG_PORTS + logerror("port1 write: tms5220 data written: %02X\n", data); +#endif + m_speech->data_w(space, 0, data); + +} + +READ8_MEMBER( pes_state::port1_r ) +{ + UINT8 data = 0xFF; + data = m_speech->status_r(space, 0); +#ifdef DEBUG_PORTS + logerror("port1 read: tms5220 data read: 0x%02X\n", data); +#endif + return data; +} + +/*#define P3_RXD (((state->m_port3_data)&(1<<0))>>0) +#define P3_TXD (((state->m_port3_data)&(1<<1))>>1) +#define P3_INT (((state->m_port3_data)&(1<<2))>>2) +#define P3_RDY (((state->m_port3_data)&(1<<3))>>3) +#define P3_RTS (((state->m_port3_data)&(1<<4))>>4) +#define P3_CTS (((state->m_port3_data)&(1<<5))>>5) +#define P3_WR (((state->m_port3_data)&(1<<6))>>6) +#define P3_RD (((state->m_port3_data)&(1<<7))>>7) +*/ +WRITE8_MEMBER( pes_state::port3_w ) +{ + m_port3_state = data; +#ifdef DEBUG_PORTS + logerror("port3 write: control data written: %02X; ", data); + logerror("RXD: %d; ", BIT(data,0)); + logerror("TXD: %d; ", BIT(data,1)); + logerror("/INT: %d; ", BIT(data,2)); + logerror("/RDY: %d; ", BIT(data,3)); + logerror("RTS: %d; ", BIT(data,4)); + logerror("CTS: %d; ", BIT(data,5)); + logerror("WR: %d; ", BIT(data,6)); + logerror("RD: %d;\n", BIT(data,7)); +#endif + // todo: poke serial handler here somehow? +} + +READ8_MEMBER( pes_state::port3_r ) +{ + UINT8 data = m_port3_state & 0xE3; // return last written state with rts, /rdy and /int masked out + // check rts state; if virtual fifo is nonzero, rts is set, otherwise it is cleared + if (m_infifo_tail_ptr != m_infifo_head_ptr) + { + data |= 0x10; // set RTS bit + } + data |= (m_speech->intq_r()<<2); + data |= (m_speech->readyq_r()<<3); +#ifdef DEBUG_PORTS + logerror("port3 read: returning 0x%02X: ", data); + logerror("RXD: %d; ", BIT(data,0)); + logerror("TXD: %d; ", BIT(data,1)); + logerror("/INT: %d; ", BIT(data,2)); + logerror("/RDY: %d; ", BIT(data,3)); + logerror("RTS: %d; ", BIT(data,4)); + logerror("CTS: %d; ", BIT(data,5)); + logerror("WR: %d; ", BIT(data,6)); + logerror("RD: %d;\n", BIT(data,7)); +#endif + return data; +} + + +/* Reset */ +void pes_state::machine_reset() +{ + // clear fifos (TODO: memset would work better here...) + int i; + for (i=0; i<32; i++) m_infifo[i] = 0; + m_infifo_tail_ptr = m_infifo_head_ptr = 0; + m_wsstate = 1; + m_rsstate = 1; + + m_port3_state = 0; // reset the openbus state of port 3 + //m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // this causes debugger to fail badly if included + machine().device("tms5220")->reset(); // reset the 5220 +} + +/****************************************************************************** + Driver Init and Timer Callbacks +******************************************************************************/ +/*static TIMER_CALLBACK_MEMBER(pes_state::serial_read_cb ) +{ + timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ); +}*/ + +DRIVER_INIT_MEMBER(pes_state,pes) +{ + m_maincpu->i8051_set_serial_tx_callback(write8_delegate(FUNC(pes_state::data_from_i8031),this)); + m_maincpu->i8051_set_serial_rx_callback(read8_delegate(FUNC(pes_state::data_to_i8031),this)); +} + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(i80c31_mem, AS_PROGRAM, 8, pes_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM /* 27C64 ROM */ + // AM_RANGE(0x2000, 0x3fff) AM_RAM /* 6164 8k SRAM, not populated */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, pes_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0, 0x0) AM_WRITE(rsws_w) /* /WS(0) and /RS(1) */ + AM_RANGE(0x1, 0x1) AM_READWRITE(port1_r, port1_w) /* tms5220 reads and writes */ + AM_RANGE(0x3, 0x3) AM_READWRITE(port3_r, port3_w) /* writes and reads from port 3, see top of file */ +ADDRESS_MAP_END + +/****************************************************************************** + Input Ports +******************************************************************************/ +static INPUT_PORTS_START( pes ) +INPUT_PORTS_END + +/****************************************************************************** + Machine Drivers +******************************************************************************/ +static MACHINE_CONFIG_START( pes, pes_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80C31, CPU_CLOCK) + MCFG_CPU_PROGRAM_MAP(i80c31_mem) + MCFG_CPU_IO_MAP(i80c31_io) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("tms5220", TMS5220C, 720000) /* 720Khz clock, 10khz output */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(pes_state, pes_kbd_input)) +MACHINE_CONFIG_END + +/****************************************************************************** + ROM Definitions +******************************************************************************/ +ROM_START( pes ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_DEFAULT_BIOS("kevbios") + ROM_SYSTEM_BIOS( 0, "orig", "PES box with original firmware v2.5") + ROMX_LOAD( "vpu_2-5.bin", 0x0000, 0x2000, CRC(b27cfdf7) SHA1(c52acf9c080823de5ef26ac55abe168ad53a7d38), ROM_BIOS(1)) // original firmware, rather buggy, 4800bps serial, buggy RTS/CTS flow control, no buffer + ROM_SYSTEM_BIOS( 1, "kevbios", "PES box with kevtris' rewritten firmware") + ROMX_LOAD( "pes.bin", 0x0000, 0x2000, CRC(22c1c4ec) SHA1(042e139cd0cf6ffafcd88904f1636c6fa1b38f25), ROM_BIOS(2)) // rewritten firmware by kevtris, 4800bps serial, RTS/CTS plus XON/XOFF flow control, 64 byte buffer +ROM_END + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, pes, 0, 0, pes, pes, pes_state, pes, "Pacific Educational Systems", "VPU-01 Speech box", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pet.c b/src/mame/drivers/pet.c new file mode 100644 index 00000000000..f8bb9a06933 --- /dev/null +++ b/src/mame/drivers/pet.c @@ -0,0 +1,2620 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +http://www.6502.org/users/andre/petindex/boards.html + +Static Board (PET 2001) +----------------------- + +Four variations based on type of RAM(6550 or 2114) and ROM(6540 or 2316B). +4K or 8K static RAM (selected by jumper). +40 column display +A video interrupt interferes with disk drive operation. +Display timing not compatible with Basic 4.0. +ROM sockets: A2 2K character ROM sockets: A2 2K character + (2316B) H1 C000-CFFF (6540) H1 C000-C7FF + H2 D000-DFFF H2 D000-D7FF + H3 E000-E7FF H3 E000-E7FF + H4 F000-FFFF H4 F000-F7FF + H5 C000-CFFF H5 C800-CFFF + H6 D000-DFFF H6 D800-DFFF + H7 F000-FFFF H7 F800-FFFF + + + IEEE user tape #2 + +------####-####--##-+ + ! # + ! # + ! # exp + ! # bus + ! # + ! # 2000 Series + ! ! circa 1977/78 Max RAM - 8k + ! (2k) ROMS ! [w/daughter board exp to 32k shown] + ! F F E D D C C ! + ! 8 0 0 8 0 8 0 ! + ! ! +tape # RAM MEMORY ! + #1 # ! + +--------------------+ + + +Dynamic Board (PET/CBM 2001-N/2001-B/4000) +------------------------------------------ + +4K, 8K, 16K or 32K dynamic RAM (selected by jumper). +40 column display +Can run all versions of 40 column Basic (Basic 1 must be copied to 4K ROMs) +Can be jumpered to replace the older board. +ROM sockets: UD3 9000-9FFF + UD4 A000-AFFF + UD5 B000-BFFF + UD6 C000-CFFF + UD7 D000-DFFF + UD8 E000-E7FF + UD9 F000-FFFF + UF10 2K character + + + IEEE user tape #1 + +------####-####--##-+ + ! #! + ! #! + ! #! exp + ! ROMS #! bus + ! F E D C B A 9 #! + ! #! 3000, 4000 Series + ! ! (3000 series is European version) + ! ! circa 1979/80 Max RAM - 32k + ! ! + ! ! + ! ! +tape # RAM MEMORY ! + #2 # ! + +--------------------+ + + +80 Column Board (CBM 8000) +-------------------------- + +16K or 32K RAM (selected by jumper). +Uses CTRC to generate 80 column display. +Can only run the 80 column version of Basic 4.0. +Not compatible with older boards. +ROM sockets: UA3 2K or 4K character + UD6 F000-FFFF + UD7 E000-E7FF + UD8 D000-DFFF + UD9 C000-CFFF + UD10 B000-BFFF + UD11 A000-AFFF + UD12 9000-9FFF + +The layout is the same of the one used in Universal Boards below. + + +Universal Board (CBM 8000/PET 4000-12) +-------------------------------------- + +This is an 80 column board with jumpers for different configurations. +16K or 32K RAM (selected by jumper). +Uses CTRC to generate 40 or 80 column display (selected by jumpers). +Can only run Basic 4.0 versions that support the CRTC. +Can be jumpered to replace all older boards. +ROM sockets: UA3 2K or 4K character + UD6 F000-FFFF + UD7 E000-E7FF + UD8 D000-DFFF + UD9 C000-CFFF + UD10 B000-BFFF + UD11 A000-AFFF + UD12 9000-9FFF + + + IEEE user tape #1 + +------####-####--##-+ + ! # # tape + ! # # #2 + ! R exp bus # ! + ! A #! + ! M 9 #! + ! A #! 4000, 8000 Series + ! M R B ! circa 1981 Max RAM - 32k* + ! E O C ! [8296 layout not shown] + ! M M D ! + ! O S E ! + ! R F ! + ! Y ! + ! spkr! + +--------------------+ +*/ + +/* + + TODO: + + - accurate video timing for non-CRTC models + - High Speed Graphics board + - keyboard layouts + - Swedish + - German + - SuperPET + - 6809 + - OS/9 MMU + - 8296 + - PLA dumps + - high resolution graphics + - Malvern Particle Sizer OEM variant + +*/ + +#include "includes/pet.h" +#include "bus/ieee488/c2040.h" +#include "machine/cbm_snqk.h" + + + +static void cbm_pet_quick_sethiaddress( address_space &space, UINT16 hiaddress ) +{ + space.write_byte(0x2e, hiaddress & 0xff); + space.write_byte(0x2c, hiaddress & 0xff); + space.write_byte(0x2a, hiaddress & 0xff); + space.write_byte(0x2f, hiaddress >> 8); + space.write_byte(0x2d, hiaddress >> 8); + space.write_byte(0x2b, hiaddress >> 8); +} + +QUICKLOAD_LOAD_MEMBER( pet_state, cbm_pet ) +{ + return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_pet_quick_sethiaddress); +} + + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// check_interrupts - +//------------------------------------------------- + +void pet_state::check_interrupts() +{ + int irq = m_via_irq || m_pia1a_irq || m_pia1b_irq || m_pia2a_irq || m_pia2b_irq || m_exp_irq; + + m_maincpu->set_input_line(M6502_IRQ_LINE, irq); + m_exp->irq_w(irq); +} + + +//------------------------------------------------- +// update_speaker - +//------------------------------------------------- + +void pet_state::update_speaker() +{ + if (m_speaker) + { + int level = m_via_cb2 && m_pia1_pa7; + + m_speaker->level_w(level); + } +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( pet_state::read ) +{ + int sel = offset >> 12; + int norom = m_exp->norom_r(space, offset, sel); + UINT8 data = 0; + + data = m_exp->read(space, offset, data, sel); + + switch (sel) + { + case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7: + if (offset < m_ram->size()) + { + data = m_ram->pointer()[offset]; + } + break; + + case SEL8: + data = m_video_ram[offset & (m_video_ram_size - 1)]; + break; + + case SEL9: + if (norom) + { + if (m_cart_9000 && m_cart_9000->exists()) + data = m_cart_9000->read_rom(space, offset & 0xfff); + else + data = m_rom->base()[offset - 0x9000]; + } + break; + + case SELA: + if (norom) + { + if (m_cart_a000 && m_cart_a000->exists()) + data = m_cart_a000->read_rom(space, offset & 0xfff); + else + data = m_rom->base()[offset - 0x9000]; + } + break; + + case SELB: + if (norom) + { + if (m_cart_b000 && m_cart_b000->exists()) + data = m_cart_b000->read_rom(space, offset & 0xfff); + else + data = m_rom->base()[offset - 0x9000]; + } + break; + + case SELC: case SELD: case SELF: + if (norom) + { + data = m_rom->base()[offset - 0x9000]; + } + break; + + case SELE: + if (BIT(offset, 11)) + { + data = 0xff; + + if (BIT(offset, 4)) + { + data &= m_pia1->read(space, offset & 0x03); + } + if (BIT(offset, 5)) + { + data &= m_pia2->read(space, offset & 0x03); + } + if (BIT(offset, 6)) + { + data &= m_via->read(space, offset & 0x0f); + } + if (m_crtc && BIT(offset, 7) && BIT(offset, 0)) + { + data &= m_crtc->register_r(space, 0); + } + } + else if (norom) + { + data = m_rom->base()[offset - 0x9000]; + } + break; + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( pet_state::write ) +{ + int sel = offset >> 12; + + m_exp->write(space, offset, data, sel); + + switch (sel) + { + case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7: + if (offset < m_ram->size()) + { + m_ram->pointer()[offset] = data; + } + break; + + case SEL8: + m_video_ram[offset & (m_video_ram_size - 1)] = data; + break; + + case SELE: + if (BIT(offset, 11)) + { + if (BIT(offset, 4)) + { + m_pia1->write(space, offset & 0x03, data); + } + if (BIT(offset, 5)) + { + m_pia2->write(space, offset & 0x03, data); + } + if (BIT(offset, 6)) + { + m_via->write(space, offset & 0x0f, data); + } + if (m_crtc && BIT(offset, 7)) + { + if (BIT(offset, 0)) + { + m_crtc->register_w(space, 0, data); + } + else + { + m_crtc->address_w(space, 0, data); + } + } + } + break; + } +} + +//------------------------------------------------- +// read_pla1 - +//------------------------------------------------- + +void cbm8296_state::read_pla1(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, + int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1) +{ + UINT32 input = (offset & 0xff00) | phi2 << 7 | brw << 6 | noscreen << 5 | noio << 4 | ramsela << 3 | ramsel9 << 2 | ramon << 1 | norom; + UINT32 data = m_pla1->read(input); + + cswff = BIT(data, 0); + cs9 = BIT(data, 1); + csa = BIT(data, 2); + csio = BIT(data, 3); + cse = BIT(data, 4); + cskb = BIT(data, 5); + fa12 = BIT(data, 6); + casena1 = BIT(data, 7); +} + +void cbm8296_state::read_pla1_eprom(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, + int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1) +{ + // PLA-EPROM adapter by Joachim Nemetz (Jogi) + + UINT32 input = (offset & 0xff00) | phi2 << 7 | brw << 6 | noscreen << 5 | noio << 4 | ramsela << 3 | ramsel9 << 2 | ramon << 1 | norom; + input = BITSWAP16(input,13,8,9,7,12,14,11,10,6,5,4,3,2,1,0,15); + + UINT8 data = m_ue6_rom->base()[input]; + data = BITSWAP8(data,7,0,1,2,3,4,5,6); + + cswff = BIT(data, 0); + cs9 = BIT(data, 1); + csa = BIT(data, 2); + csio = BIT(data, 3); + cse = BIT(data, 4); + cskb = BIT(data, 5); + fa12 = BIT(data, 6); + casena1 = BIT(data, 7); +} + + +//------------------------------------------------- +// read_pla2 - +//------------------------------------------------- + +void cbm8296_state::read_pla2(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15) +{ + UINT32 input = BITSWAP8(m_cr, 0,1,2,3,4,5,6,7) << 8 | ((offset >> 8) & 0xf8) | brw << 2 | phi2 << 1 | casena1; + UINT32 data = m_pla2->read(input); + + endra = BIT(data, 4); + noscreen = BIT(data, 5); + casena2 = BIT(data, 6); + fa15 = BIT(data, 7); +} + +void cbm8296_state::read_pla2_eprom(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15) +{ + // PLA-EPROM adapter by Joachim Nemetz (Jogi) + + UINT32 input = BITSWAP8(m_cr, 0,1,2,3,4,5,6,7) << 8 | ((offset >> 8) & 0xf8) | brw << 2 | phi2 << 1 | casena1; + input = BITSWAP16(input,13,8,9,7,12,14,11,10,6,5,4,3,2,1,0,15); + + UINT8 data = m_ue5_rom->base()[input]; + data = BITSWAP8(data,7,0,1,2,3,4,5,6); + + endra = BIT(data, 4); + noscreen = BIT(data, 5); + casena2 = BIT(data, 6); + fa15 = BIT(data, 7); +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( cbm8296_state::read ) +{ + int norom = m_exp->norom_r(space, offset, offset >> 12) && !BIT(m_cr, 7); + int phi2 = 1, brw = 1, noscreen = 1, noio = BIT(m_cr, 6); + int ramsela = BIT(m_via_pa, 0), ramsel9 = BIT(m_via_pa, 1), ramon = BIT(m_via_pa, 2); + int cswff = 1, cs9 = 1, csa = 1, csio = 1, cse = 1, cskb = 1, fa12 = 1, fa15 = 1, casena1 = 1, casena2 = 1, endra = 1; + + read_pla1_eprom(offset, phi2, brw, noscreen, noio, ramsela, ramsel9, ramon, norom, + cswff, cs9, csa, csio, cse, cskb, fa12, casena1); + + read_pla2_eprom(offset, phi2, brw, casena1, endra, noscreen, casena2, fa15); + + read_pla1_eprom(offset, phi2, brw, noscreen, noio, ramsela, ramsel9, ramon, norom, + cswff, cs9, csa, csio, cse, cskb, fa12, casena1); + + //logerror("%s read %04x : norom %u noio %u ramsela %u ramsel9 %u ramon %u / cswff %u cs9 %u csa %u csio %u cse %u cskb %u fa12 %u casena1 %u endra %u noscreen %u casena2 %u fa15 %u\n",machine().describe_context(),offset,norom,noio,ramsela,ramsel9,ramon,cswff,cs9,csa,csio,cse,cskb,fa12,casena1,endra,noscreen,casena2,fa15); + + UINT8 data = 0; + + offs_t drma = fa15 << 15 | (offset & 0x7e00) | BIT(offset, 0) << 8 | (offset & 0x1fe) >> 1; + + if (!endra && !casena1) + { + data = m_ram->pointer()[drma]; + } + if (casena2) + { + data = m_ram->pointer()[0x10000 | drma]; + } + if (!cs9) + { + if (m_cart_9000 && m_cart_9000->exists()) + data = m_cart_9000->read_rom(space, offset & 0xfff); + else + data = m_rom->base()[offset & 0xfff]; + } + if (!csa) + { + if (m_cart_a000 && m_cart_a000->exists()) + data = m_cart_a000->read_rom(space, offset & 0xfff); + else + data = m_rom->base()[0x1000 | (offset & 0xfff)]; + } + if (!cse) + { + data = m_editor_rom->base()[offset & 0xfff]; + } + if (!cskb) + { + data = m_basic_rom->base()[(offset & 0x2fff) | fa12 << 12]; + } + if (!csio) + { + data = 0xff; + + if (BIT(offset, 4)) + { + data &= m_pia1->read(space, offset & 0x03); + } + if (BIT(offset, 5)) + { + data &= m_pia2->read(space, offset & 0x03); + } + if (BIT(offset, 6)) + { + data &= m_via->read(space, offset & 0x0f); + } + if (BIT(offset, 7) && BIT(offset, 0)) + { + data &= m_crtc->register_r(space, 0); + } + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( cbm8296_state::write ) +{ + int norom = m_exp->norom_r(space, offset, offset >> 12) && !BIT(m_cr, 7); + int phi2 = 1, brw = 0, noscreen = 1, noio = BIT(m_cr, 6); + int ramsela = BIT(m_via_pa, 0), ramsel9 = BIT(m_via_pa, 1), ramon = BIT(m_via_pa, 2); + int cswff = 1, cs9 = 1, csa = 1, csio = 1, cse = 1, cskb = 1, fa12 = 1, fa15 = 1, casena1 = 1, casena2 = 1, endra = 1; + + read_pla1_eprom(offset, phi2, brw, noscreen, noio, ramsela, ramsel9, ramon, norom, + cswff, cs9, csa, csio, cse, cskb, fa12, casena1); + + read_pla2_eprom(offset, phi2, brw, casena1, endra, noscreen, casena2, fa15); + + read_pla1_eprom(offset, phi2, brw, noscreen, noio, ramsela, ramsel9, ramon, norom, + cswff, cs9, csa, csio, cse, cskb, fa12, casena1); + + //logerror("%s write %04x : norom %u noio %u ramsela %u ramsel9 %u ramon %u / cswff %u cs9 %u csa %u csio %u cse %u cskb %u fa12 %u casena1 %u endra %u noscreen %u casena2 %u fa15 %u\n",machine().describe_context(),offset,norom,noio,ramsela,ramsel9,ramon,cswff,cs9,csa,csio,cse,cskb,fa12,casena1,endra,noscreen,casena2,fa15); + + offs_t drma = fa15 << 15 | (offset & 0x7e00) | BIT(offset, 0) << 8 | (offset & 0x1fe) >> 1; + + if (!endra && !casena1) + { + m_ram->pointer()[drma] = data; + } + if (casena2) + { + m_ram->pointer()[0x10000 | drma] = data; + } + if (!csio) + { + if (BIT(offset, 4)) + { + m_pia1->write(space, offset & 0x03, data); + } + if (BIT(offset, 5)) + { + m_pia2->write(space, offset & 0x03, data); + } + if (BIT(offset, 6)) + { + m_via->write(space, offset & 0x0f, data); + } + if (BIT(offset, 7)) + { + if (BIT(offset, 0)) + { + m_crtc->register_w(space, 0, data); + } + else + { + m_crtc->address_w(space, 0, data); + } + } + } + if (cswff && ((offset & 0xff) == 0xf0)) + { + m_cr = data; + } +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( pet2001_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( pet2001_mem, AS_PROGRAM, 8, pet_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( cbm8296_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( cbm8296_mem, AS_PROGRAM, 8, cbm8296_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( pet ) +//------------------------------------------------- + +static INPUT_PORTS_START( pet ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr Screen") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x2190) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('#') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('!') + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('\\') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('$') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('"') + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR(0x03C0) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR(';') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START( "ROW8" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) + + PORT_START( "ROW9" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('=') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('<') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('[') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Rvs Off") PORT_CODE(KEYCODE_TAB) + + PORT_START( "LOCK" ) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( petb ) +//------------------------------------------------- + +INPUT_PORTS_START( petb ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_DEL) PORT_CHAR('^') + + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Repeat") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START( "ROW8" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr Screen") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Rvs Off") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START( "ROW9" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_END) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + + PORT_START( "LOCK" ) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( petb_de ) +//------------------------------------------------- + +INPUT_PORTS_START( petb_de ) + PORT_INCLUDE( petb ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( petb_fr ) +//------------------------------------------------- + +INPUT_PORTS_START( petb_fr ) + PORT_INCLUDE( petb ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( petb_se ) +//------------------------------------------------- + +INPUT_PORTS_START( petb_se ) + PORT_INCLUDE( petb ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +WRITE_LINE_MEMBER( pet_state::via_irq_w ) +{ + m_via_irq = state; + + check_interrupts(); +} + +WRITE8_MEMBER( pet_state::via_pa_w ) +{ + m_user->write_c((data>>0)&1); + m_user->write_d((data>>1)&1); + m_user->write_e((data>>2)&1); + m_user->write_f((data>>3)&1); + m_user->write_h((data>>4)&1); + m_user->write_j((data>>5)&1); + m_user->write_k((data>>6)&1); + m_user->write_l((data>>7)&1); + + m_via_pa = data; +} + +READ8_MEMBER( pet_state::via_pb_r ) +{ + /* + + bit description + + PB0 _NDAC IN + PB1 + PB2 + PB3 + PB4 + PB5 SYNC IN + PB6 _NRFD IN + PB7 _DAV IN + + */ + + UINT8 data = 0; + + // video sync + data |= (m_crtc ? m_crtc->vsync_r() : m_sync) << 5; + + // IEEE-488 + data |= m_ieee->ndac_r(); + data |= m_ieee->nrfd_r() << 6; + data |= m_ieee->dav_r() << 7; + + return data; +} + +WRITE8_MEMBER( pet_state::via_pb_w ) +{ + /* + + bit description + + PB0 + PB1 _NRFD OUT + PB2 _ATN OUT + PB3 CASS WRITE + PB4 #2 CASS MOTOR + PB5 + PB6 + PB7 + + */ + + // IEEE-488 + m_ieee->nrfd_w(BIT(data, 1)); + m_ieee->atn_w(BIT(data, 2)); + + // cassette + m_cassette->write(BIT(data, 3)); + m_cassette2->write(BIT(data, 3)); + m_cassette2->motor_w(BIT(data, 4)); +} + +WRITE_LINE_MEMBER( pet_state::via_ca2_w ) +{ + m_graphic = state; +} + +WRITE_LINE_MEMBER( pet_state::via_cb2_w ) +{ + m_via_cb2 = state; + update_speaker(); + + m_user->write_m(state); +} + + +WRITE_LINE_MEMBER( pet_state::pia1_irqa_w ) +{ + m_pia1a_irq = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( pet_state::pia1_irqb_w ) +{ + m_pia1b_irq = state; + + check_interrupts(); +} + +READ8_MEMBER( pet_state::pia1_pa_r ) +{ + /* + + bit description + + PA0 KEY A + PA1 KEY B + PA2 KEY C + PA3 KEY D + PA4 #1 CASS SWITCH + PA5 #2 CASS SWITCH + PA6 _EOI IN + PA7 DIAG JUMPER + + */ + + UINT8 data = 0; + + // keyboard + data |= m_key; + + // cassette + data |= m_cassette->sense_r() << 4; + data |= m_cassette2->sense_r() << 5; + + // IEEE-488 + data |= m_ieee->eoi_r() << 6; + + // diagnostic jumper + data |= (m_user_diag && m_exp->diag_r()) << 7; + + return data; +} + +WRITE8_MEMBER( pet_state::pia1_pa_w ) +{ + /* + + bit description + + PA0 KEY A + PA1 KEY B + PA2 KEY C + PA3 KEY D + PA4 + PA5 + PA6 + PA7 SPEAKER + + */ + + // keyboard + m_key = data & 0x0f; + + // speaker + m_pia1_pa7 = BIT(data, 7); + update_speaker(); +} + +READ8_MEMBER( pet_state::pia1_pb_r ) +{ + UINT8 data = 0xff; + + switch (m_key) + { + case 0: data &= m_row0->read(); break; + case 1: data &= m_row1->read(); break; + case 2: data &= m_row2->read(); break; + case 3: data &= m_row3->read(); break; + case 4: data &= m_row4->read(); break; + case 5: data &= m_row5->read(); break; + case 6: data &= m_row6->read(); break; + case 7: data &= m_row7->read(); break; + case 8: data &= m_row8->read() & m_lock->read(); break; + case 9: data &= m_row9->read(); break; + } + + return data; +} + +READ8_MEMBER( pet2001b_state::pia1_pb_r ) +{ + UINT8 data = 0xff; + + switch (m_key) + { + case 0: data &= m_row0->read(); break; + case 1: data &= m_row1->read(); break; + case 2: data &= m_row2->read(); break; + case 3: data &= m_row3->read(); break; + case 4: data &= m_row4->read(); break; + case 5: data &= m_row5->read(); break; + case 6: data &= m_row6->read() & m_lock->read(); break; + case 7: data &= m_row7->read(); break; + case 8: data &= m_row8->read(); break; + case 9: data &= m_row9->read(); break; + } + + return data; +} + +WRITE_LINE_MEMBER( pet_state::pia1_ca2_w ) +{ + m_ieee->eoi_w(state); + + m_blanktv = state; +} + + +WRITE_LINE_MEMBER( pet_state::pia2_irqa_w ) +{ + m_pia2a_irq = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( pet_state::pia2_irqb_w ) +{ + m_pia2b_irq = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( pet_state::user_diag_w ) +{ + m_user_diag = state; +} + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +//------------------------------------------------- +// TIMER_DEVICE_CALLBACK( sync_tick ) +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER( pet_state::sync_tick ) +{ + m_sync = !m_sync; + + m_pia1->cb1_w(m_sync); +} + + +//------------------------------------------------- +// SCREEN_UPDATE( pet2001 ) +//------------------------------------------------- + +UINT32 pet_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const pen_t *pen = m_palette->pens(); + + for (int y = 0; y < 200; y++) + { + for (int sx = 0; sx < 40; sx++) + { + int sy = y / 8; + offs_t video_addr = (sy * 40) + sx; + UINT8 lsd = m_video_ram[video_addr]; + + int ra = y & 0x07; + offs_t char_addr = (m_graphic << 10) | ((lsd & 0x7f) << 3) | ra; + UINT8 data = m_char_rom->base()[char_addr]; + + for (int x = 0; x < 8; x++, data <<= 1) + { + int color = (BIT(data, 7) ^ BIT(lsd, 7)) && m_blanktv; + bitmap.pix32(y, (sx * 8) + x) = pen[color]; + } + } + } + + return 0; +} + + +//------------------------------------------------- +// MC6845 PET80 +//------------------------------------------------- + +MC6845_BEGIN_UPDATE( pet_state::pet_begin_update ) +{ + bitmap.fill(rgb_t::black); +} + +MC6845_UPDATE_ROW( pet80_state::pet80_update_row ) +{ + int x = 0; + int char_rom_mask = m_char_rom->bytes() - 1; + const pen_t *pen = m_palette->pens(); + hbp = 80; + + for (int column = 0; column < x_count; column++) + { + UINT8 lsd = 0, data = 0; + UINT8 rra = ra & 0x07; + int no_row = !(BIT(ra, 3) || BIT(ra, 4)); + int invert = BIT(ma, 12); + int chr_option = BIT(ma, 13); + + // even character + + lsd = m_video_ram[((ma + column) << 1) & 0x7ff]; + + offs_t char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; + data = m_char_rom->base()[char_addr & char_rom_mask]; + + for (int bit = 0; bit < 8; bit++, data <<= 1) + { + int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + } + + // odd character + + lsd = m_video_ram[(((ma + column) << 1) + 1) & 0x7ff]; + + char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; + data = m_char_rom->base()[char_addr & char_rom_mask]; + + for (int bit = 0; bit < 8; bit++, data <<= 1) + { + int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + } + } +} + + +//------------------------------------------------- +// MC6845 PET40 +//------------------------------------------------- + +MC6845_UPDATE_ROW( pet_state::pet40_update_row ) +{ + int x = 0; + int char_rom_mask = m_char_rom->bytes() - 1; + const pen_t *pen = m_palette->pens(); + hbp = 41; + + for (int column = 0; column < x_count; column++) + { + UINT8 lsd = 0, data = 0; + UINT8 rra = ra & 0x07; + int no_row = !(BIT(ra, 3) || BIT(ra, 4)); + int invert = BIT(ma, 12); + int chr_option = BIT(ma, 13); + + lsd = m_video_ram[(ma + column) & 0x3ff]; + + offs_t char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; + data = m_char_rom->base()[char_addr & char_rom_mask]; + + for (int bit = 0; bit < 8; bit++, data <<= 1) + { + int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + } + } +} + + +//------------------------------------------------- +// MC6845 CBM8296 +//------------------------------------------------- + +MC6845_UPDATE_ROW( pet80_state::cbm8296_update_row ) +{ + int x = 0; + int char_rom_mask = m_char_rom->bytes() - 1; + const pen_t *pen = m_palette->pens(); + + for (int column = 0; column < x_count; column++) + { + UINT8 lsd = 0, data = 0; + UINT8 rra = ra & 0x07; + int no_row = !BIT(ra, 3); + int ra4 = BIT(ra, 4); + int chr_option = BIT(ma, 13); + offs_t vma = (ma + column) & 0x1fff; + offs_t drma = 0x8000 | ra4 << 14 | ((vma & 0xf00) << 1) | (vma & 0xff); + + // even character + + lsd = m_ram->pointer()[drma]; + + offs_t char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; + data = m_char_rom->base()[char_addr & char_rom_mask]; + + for (int bit = 0; bit < 8; bit++, data <<= 1) + { + int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); + bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + } + + // odd character + + lsd = m_ram->pointer()[drma | 0x100]; + + char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; + data = m_char_rom->base()[char_addr & char_rom_mask]; + + for (int bit = 0; bit < 8; bit++, data <<= 1) + { + int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); + bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + } + } +} + + +//------------------------------------------------- +// SLOT_INTERFACE( cbm8296d_ieee488_devices ) +//------------------------------------------------- + +SLOT_INTERFACE_START( cbm8296d_ieee488_devices ) + SLOT_INTERFACE("c8250lp", C8250LP) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( pet ) +//------------------------------------------------- + +MACHINE_START_MEMBER( pet_state, pet ) +{ + // allocate memory + m_video_ram.allocate(m_video_ram_size); + + // initialize memory + UINT8 data = 0xff; + + for (offs_t offset = 0; offset < m_ram->size(); offset++) + { + m_ram->pointer()[offset] = data; + if (!(offset % 64)) data ^= 0xff; + } + + data = 0xff; + + for (offs_t offset = 0; offset < m_video_ram_size; offset++) + { + m_video_ram[offset] = data; + if (!(offset % 64)) data ^= 0xff; + } + + // state saving + save_item(NAME(m_key)); + save_item(NAME(m_sync)); + save_item(NAME(m_graphic)); + save_item(NAME(m_blanktv)); + save_item(NAME(m_via_irq)); + save_item(NAME(m_pia1a_irq)); + save_item(NAME(m_pia1b_irq)); + save_item(NAME(m_pia2a_irq)); + save_item(NAME(m_pia2b_irq)); + save_item(NAME(m_exp_irq)); + save_item(NAME(m_user_diag)); +} + + +//------------------------------------------------- +// MACHINE_START( pet2001 ) +//------------------------------------------------- + +MACHINE_START_MEMBER( pet_state, pet2001 ) +{ + m_video_ram_size = 0x400; + + MACHINE_START_CALL_MEMBER(pet); +} + + +MACHINE_RESET_MEMBER( pet_state, pet ) +{ + m_maincpu->reset(); + + m_via->reset(); + m_pia1->reset(); + m_pia2->reset(); + + m_exp->reset(); + + m_ieee->ren_w(0); +} + + +//------------------------------------------------- +// MACHINE_START( pet40 ) +//------------------------------------------------- + +MACHINE_START_MEMBER( pet_state, pet40 ) +{ + m_video_ram_size = 0x400; + + MACHINE_START_CALL_MEMBER(pet); +} + + +MACHINE_RESET_MEMBER( pet_state, pet40 ) +{ + MACHINE_RESET_CALL_MEMBER(pet); + + m_crtc->reset(); +} + + +//------------------------------------------------- +// MACHINE_START( pet80 ) +//------------------------------------------------- + +MACHINE_START_MEMBER( pet80_state, pet80 ) +{ + m_video_ram_size = 0x800; + + MACHINE_START_CALL_MEMBER(pet); +} + + +MACHINE_RESET_MEMBER( pet80_state, pet80 ) +{ + MACHINE_RESET_CALL_MEMBER(pet); + + m_crtc->reset(); +} + + +//------------------------------------------------- +// MACHINE_START( cbm8296 ) +//------------------------------------------------- + +MACHINE_START_MEMBER( cbm8296_state, cbm8296 ) +{ + MACHINE_START_CALL_MEMBER(pet80); + + // state saving + save_item(NAME(m_cr)); + save_item(NAME(m_via_pa)); +} + + +MACHINE_RESET_MEMBER( cbm8296_state, cbm8296 ) +{ + MACHINE_RESET_CALL_MEMBER(pet80); + + m_cr = 0; + m_via_pa = 0xff; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( 4k ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( 4k ) + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("8K,16K,32K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( 8k ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( 8k ) + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8K") + MCFG_RAM_EXTRA_OPTIONS("16K,32K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( 8k ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( 16k ) + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( 8k ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( 32k ) + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pet, pet_state ) + MCFG_MACHINE_START_OVERRIDE(pet_state, pet2001) + MCFG_MACHINE_RESET_OVERRIDE(pet_state, pet) + + // basic machine hardware + MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_8MHz/8) + MCFG_CPU_PROGRAM_MAP(pet2001_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) + MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(120)) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + // devices + MCFG_DEVICE_ADD(M6522_TAG, VIA6522, XTAL_8MHz/8) + MCFG_VIA6522_READPB_HANDLER(READ8(pet_state, via_pb_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(pet_state, via_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(pet_state, via_pb_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(pet_state, via_ca2_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(pet_state, via_cb2_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(pet_state, via_irq_w)) + + MCFG_DEVICE_ADD(M6520_1_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(pet_state, pia1_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(pet_state, pia1_pb_r)) + MCFG_PIA_READCA1_HANDLER(DEVREADLINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, read)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(pet_state, pia1_pa_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(pet_state, pia1_ca2_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, motor_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(pet_state, pia1_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(pet_state, pia1_irqb_w)) + + MCFG_DEVICE_ADD(M6520_2_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) + MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) + MCFG_PIA_CA2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(pet_state, pia2_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(pet_state, pia2_irqb_w)) + + MCFG_CBM_IEEE488_ADD("c4040") + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, cb1_w)) + MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, ca1_w)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c2n", DEVWRITELINE(M6520_1_TAG, pia6821_device, ca1_w)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, cbm_datassette_devices, NULL, DEVWRITELINE(M6522_TAG, via6522_device, write_cb1)) + MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_8MHz/8, pet_expansion_cards, NULL) + MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(READ8(pet_state, read), WRITE8(pet_state, write)) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, pet_user_port_cards, NULL) + MCFG_PET_USER_PORT_5_HANDLER(WRITELINE(pet_state, user_diag_w)) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1)) + MCFG_PET_USER_PORT_C_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa0)) + MCFG_PET_USER_PORT_D_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa1)) + MCFG_PET_USER_PORT_E_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa2)) + MCFG_PET_USER_PORT_F_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa3)) + MCFG_PET_USER_PORT_H_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa4)) + MCFG_PET_USER_PORT_J_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa5)) + MCFG_PET_USER_PORT_K_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa6)) + MCFG_PET_USER_PORT_L_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa7)) + MCFG_PET_USER_PORT_M_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_cb2)) + + MCFG_QUICKLOAD_ADD("quickload", pet_state, cbm_pet, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + // software lists + MCFG_SOFTWARE_LIST_ADD("cass_list", "pet_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "pet_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "pet_hdd") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet2001, pet ) + MCFG_FRAGMENT_ADD(4k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet20018 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet20018, pet ) + MCFG_FRAGMENT_ADD(8k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001n ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet2001n, pet ) + MCFG_GENERIC_CARTSLOT_ADD("cart_9000", generic_linear_slot, "pet_9000_rom") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_GENERIC_CARTSLOT_ADD("cart_a000", generic_linear_slot, "pet_a000_rom") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_GENERIC_CARTSLOT_ADD("cart_b000", generic_linear_slot, "pet_b000_rom") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_SOFTWARE_LIST_ADD("rom_list", "pet_rom") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001n8 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet2001n8, pet2001n ) + MCFG_FRAGMENT_ADD(8k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001n16 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet2001n16, pet2001n ) + MCFG_FRAGMENT_ADD(16k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001n32 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet2001n32, pet2001n ) + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm3000 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm3000, pet2001n ) + // video hardware + MCFG_SCREEN_MODIFY(SCREEN_TAG) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) + MCFG_DEVICE_REMOVE("sync_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(100)) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm3008 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm3008, cbm3000 ) + MCFG_FRAGMENT_ADD(8k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm3016 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm3016, cbm3000 ) + MCFG_FRAGMENT_ADD(16k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm3032 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm3032, cbm3000 ) + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001b ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( pet2001b, pet2001n, pet2001b_state ) + MCFG_DEVICE_MODIFY(M6520_1_TAG) + MCFG_PIA_READPB_HANDLER(READ8(pet2001b_state, pia1_pb_r)) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001b8 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet2001b8, pet2001b ) + MCFG_FRAGMENT_ADD(8k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001b16 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet2001b16, pet2001b ) + MCFG_FRAGMENT_ADD(16k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet2001b32 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet2001b32, pet2001b ) + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm3032b ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm3032b, pet2001b ) + // video hardware + MCFG_SCREEN_MODIFY(SCREEN_TAG) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) + MCFG_DEVICE_REMOVE("sync_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(100)) + + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet4000 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet4000, pet2001n ) + MCFG_DEVICE_REMOVE("cart_b000") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet4016 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet4016, pet4000 ) + // RAM not upgradeable + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet4032 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet4032, pet4000 ) + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet4032f ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet4032f, pet4000 ) + MCFG_MACHINE_START_OVERRIDE(pet_state, pet40) + MCFG_MACHINE_RESET_OVERRIDE(pet_state, pet40) + + // video hardware + MCFG_SCREEN_MODIFY(SCREEN_TAG) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(320, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 250 - 1) + MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) + MCFG_DEVICE_REMOVE("sync_timer") + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_BEGIN_UPDATE_CB(pet_state, pet_begin_update) + MCFG_MC6845_UPDATE_ROW_CB(pet_state, pet40_update_row) + MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(M6520_1_TAG, pia6821_device, cb1_w)) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm4000 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm4000, pet2001n ) + // video hardware + MCFG_SCREEN_MODIFY(SCREEN_TAG) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) + MCFG_DEVICE_REMOVE("sync_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(100)) + + MCFG_DEVICE_REMOVE("cart_b000") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm4016 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm4016, cbm4000 ) + // RAM not upgradeable + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm4032 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm4032, cbm4000 ) + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm4032f ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm4032f, cbm4000 ) + MCFG_MACHINE_START_OVERRIDE(pet_state, pet40) + MCFG_MACHINE_RESET_OVERRIDE(pet_state, pet40) + + // video hardware + MCFG_SCREEN_MODIFY(SCREEN_TAG) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(320, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 250 - 1) + MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) + MCFG_DEVICE_REMOVE("sync_timer") + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_BEGIN_UPDATE_CB(pet_state, pet_begin_update) + MCFG_MC6845_UPDATE_ROW_CB(pet_state, pet40_update_row) + MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(M6520_1_TAG, pia6821_device, cb1_w)) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet4000b ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet4000b, pet2001b ) + MCFG_DEVICE_REMOVE("cart_b000") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet4032b ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet4032b, pet4000b ) + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm4000b ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm4000b, pet2001b ) + // video hardware + MCFG_SCREEN_MODIFY(SCREEN_TAG) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) + MCFG_DEVICE_REMOVE("sync_timer") + MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(100)) + + MCFG_DEVICE_REMOVE("cart_b000") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm4032b ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm4032b, cbm4000b ) + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet80 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( pet80, pet80_state ) + MCFG_MACHINE_START_OVERRIDE(pet80_state, pet80) + MCFG_MACHINE_RESET_OVERRIDE(pet80_state, pet80) + + // basic machine hardware + MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16) + MCFG_CPU_PROGRAM_MAP(pet2001_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(640, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 250 - 1) + MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(2*8) + MCFG_MC6845_BEGIN_UPDATE_CB(pet_state, pet_begin_update) + MCFG_MC6845_UPDATE_ROW_CB(pet80_state, pet80_update_row) + MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(M6520_1_TAG, pia6821_device, cb1_w)) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_DEVICE_ADD(M6522_TAG, VIA6522, XTAL_16MHz/16) + MCFG_VIA6522_READPB_HANDLER(READ8(pet_state, via_pb_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(pet_state, via_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(pet_state, via_pb_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(pet_state, via_ca2_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(pet_state, via_cb2_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(pet_state, via_irq_w)) + + MCFG_DEVICE_ADD(M6520_1_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(pet_state, pia1_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(pet_state, pia1_pb_r)) + MCFG_PIA_READCA1_HANDLER(DEVREADLINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, read)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(pet_state, pia1_pa_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(pet_state, pia1_ca2_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, motor_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(pet_state, pia1_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(pet_state, pia1_irqb_w)) + + MCFG_DEVICE_ADD(M6520_2_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) + MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) + MCFG_PIA_CA2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(pet_state, pia2_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(pet_state, pia2_irqb_w)) + + MCFG_CBM_IEEE488_ADD("c8050") + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, cb1_w)) + MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, ca1_w)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c2n", DEVWRITELINE(M6520_1_TAG, pia6821_device, ca1_w)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, cbm_datassette_devices, NULL, DEVWRITELINE(M6522_TAG, via6522_device, write_cb1)) + MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, pet_expansion_cards, NULL) + MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(READ8(pet_state, read), WRITE8(pet_state, write)) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, pet_user_port_cards, NULL) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1)) + MCFG_PET_USER_PORT_C_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa0)) + MCFG_PET_USER_PORT_D_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa1)) + MCFG_PET_USER_PORT_E_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa2)) + MCFG_PET_USER_PORT_F_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa3)) + MCFG_PET_USER_PORT_H_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa4)) + MCFG_PET_USER_PORT_J_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa5)) + MCFG_PET_USER_PORT_K_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa6)) + MCFG_PET_USER_PORT_L_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa7)) + MCFG_PET_USER_PORT_M_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_cb2)) + + MCFG_QUICKLOAD_ADD("quickload", pet_state, cbm_pet, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + MCFG_GENERIC_CARTSLOT_ADD("cart_9000", generic_linear_slot, "pet_9000_rom") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_GENERIC_CARTSLOT_ADD("cart_a000", generic_linear_slot, "pet_a000_rom") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + // software lists + MCFG_SOFTWARE_LIST_ADD("cass_list", "pet_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "pet_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "pet_hdd") + MCFG_SOFTWARE_LIST_ADD("rom_list", "pet_rom") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pet8032 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pet8032, pet80 ) + MCFG_FRAGMENT_ADD(32k) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( superpet ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( superpet, pet8032, superpet_state ) + MCFG_DEVICE_REMOVE(PET_EXPANSION_SLOT_TAG) + MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, pet_expansion_cards, "superpet") + MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(READ8(pet_state, read), WRITE8(pet_state, write)) + + MCFG_SOFTWARE_LIST_ADD("flop_list2", "superpet_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm8096 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( cbm8096, pet80, cbm8096_state ) + MCFG_DEVICE_REMOVE(PET_EXPANSION_SLOT_TAG) + MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, pet_expansion_cards, "64k") + MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(READ8(pet_state, read), WRITE8(pet_state, write)) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("96K") + + MCFG_SOFTWARE_LIST_ADD("flop_list2", "cbm8096_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm8296 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( cbm8296, pet80, cbm8296_state ) + MCFG_MACHINE_START_OVERRIDE(cbm8296_state, cbm8296) + MCFG_MACHINE_RESET_OVERRIDE(cbm8296_state, cbm8296) + + MCFG_CPU_MODIFY(M6502_TAG) + MCFG_CPU_PROGRAM_MAP(cbm8296_mem) + + MCFG_PLS100_ADD(PLA1_TAG) + MCFG_PLS100_ADD(PLA2_TAG) + + MCFG_DEVICE_REMOVE(MC6845_TAG) + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(2*8) + MCFG_MC6845_UPDATE_ROW_CB(pet80_state, cbm8296_update_row) + MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(M6520_1_TAG, pia6821_device, cb1_w)) + + MCFG_DEVICE_MODIFY("ieee8") + MCFG_SLOT_DEFAULT_OPTION("c8250") + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + + MCFG_SOFTWARE_LIST_ADD("flop_list2", "cbm8296_flop") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( cbm8296d ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( cbm8296d, cbm8296 ) + MCFG_DEVICE_MODIFY("ieee8") + MCFG_DEVICE_SLOT_INTERFACE(cbm8296d_ieee488_devices, "c8250lp", false) +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( pet2001 ) +//------------------------------------------------- + +ROM_START( pet2001 ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_DEFAULT_BIOS( "basic1r" ) + ROM_SYSTEM_BIOS( 0, "basic1o", "Original" ) + ROMX_LOAD( "901447-01.h1", 0x3000, 0x0800, CRC(a055e33a) SHA1(831db40324113ee996c434d38b4add3fd1f820bd), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "basic1r", "Revised" ) + ROMX_LOAD( "901447-09.h1", 0x3000, 0x0800, CRC(03cf16d0) SHA1(1330580c0614d3556a389da4649488ba04a60908), ROM_BIOS(2) ) + ROM_LOAD( "901447-02.h5", 0x3800, 0x0800, CRC(69fd8a8f) SHA1(70c0f4fa67a70995b168668c957c3fcf2c8641bd) ) + ROM_LOAD( "901447-03.h2", 0x4000, 0x0800, CRC(d349f2d4) SHA1(4bf2c20c51a63d213886957485ebef336bb803d0) ) + ROM_LOAD( "901447-04.h6", 0x4800, 0x0800, CRC(850544eb) SHA1(d293972d529023d8fd1f493149e4777b5c253a69) ) + ROM_LOAD( "901447-05.h3", 0x5000, 0x0800, CRC(9e1c5cea) SHA1(f02f5fb492ba93dbbd390f24c10f7a832dec432a) ) + ROM_LOAD( "901447-06.h4", 0x6000, 0x0800, CRC(661a814a) SHA1(960717282878e7de893d87242ddf9d1512be162e) ) + ROM_LOAD( "901447-07.h7", 0x6800, 0x0800, CRC(c4f47ad1) SHA1(d440f2510bc52e20c3d6bc8b9ded9cea7f462a9c) ) + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-08.a2", 0x000, 0x800, CRC(54f32f45) SHA1(3e067cc621e4beafca2b90cb8f6dba975df2855b) ) +ROM_END + +#define rom_pet20018 rom_pet2001 + + +//------------------------------------------------- +// ROM( pet2001n ) +//------------------------------------------------- + +ROM_START( pet2001n ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-01.ud6", 0x3000, 0x1000, CRC(63a7fe4a) SHA1(3622111f486d0e137022523657394befa92bde44) ) // BASIC 2 + ROM_LOAD( "901465-02.ud7", 0x4000, 0x1000, CRC(ae4cb035) SHA1(1bc0ebf27c9bb62ad71bca40313e874234cab6ac) ) // BASIC 2 + ROM_LOAD( "901447-24.ud8", 0x5000, 0x0800, CRC(e459ab32) SHA1(5e5502ce32f5a7e387d65efe058916282041e54b) ) // Screen Editor (40 columns, no CRTC, Normal Keyb) + ROM_LOAD( "901465-03.ud9", 0x6000, 0x1000, CRC(f02238e2) SHA1(38742bdf449f629bcba6276ef24d3daeb7da6e84) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + +#define rom_pet2001n16 rom_pet2001n +#define rom_pet2001n32 rom_pet2001n +#define rom_cbm3008 rom_pet2001n +#define rom_cbm3016 rom_pet2001n +#define rom_cbm3032 rom_pet2001n + + +//------------------------------------------------- +// ROM( pet2001b ) +//------------------------------------------------- + +ROM_START( pet2001b ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-01.ud6", 0x3000, 0x1000, CRC(63a7fe4a) SHA1(3622111f486d0e137022523657394befa92bde44) ) // BASIC 2 + ROM_LOAD( "901465-02.ud7", 0x4000, 0x1000, CRC(ae4cb035) SHA1(1bc0ebf27c9bb62ad71bca40313e874234cab6ac) ) // BASIC 2 + ROM_LOAD( "901474-01.ud8", 0x5000, 0x0800, CRC(05db957e) SHA1(174ace3a8c0348cd21d39cc864e2adc58b0101a9) ) // Screen Editor (40 columns, no CRTC, Business Keyb) + ROM_LOAD( "901465-03.ud9", 0x6000, 0x1000, CRC(f02238e2) SHA1(38742bdf449f629bcba6276ef24d3daeb7da6e84) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + +#define rom_pet2001b16 rom_pet2001b +#define rom_pet2001b32 rom_pet2001b +#define rom_cbm3032b rom_pet2001b + + +//------------------------------------------------- +// ROM( pet4016 ) +//------------------------------------------------- + +ROM_START( pet4016 ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_DEFAULT_BIOS( "basic4r" ) + ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) + ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) + ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 + ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "901447-29.ud8", 0x5000, 0x0800, CRC(e5714d4c) SHA1(e88f56e5c54b0e8d8d4e8cb39a4647c803c1f51c) ) // Screen Editor (40 columns, no CRTC, Normal Keyb) + ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + +#define rom_pet4032 rom_pet4016 + + +//------------------------------------------------- +// ROM( pet4032f ) +//------------------------------------------------- + +ROM_START( pet4032f ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_DEFAULT_BIOS( "basic4r" ) + ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) + ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) + ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 + ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "901499-01.ud7", 0x5000, 0x0800, CRC(5f85bdf8) SHA1(8cbf086c1ce4dfb2a2fe24c47476dfb878493dee) ) // Screen Editor (40 columns, CRTC 60Hz, Normal Keyb?) + ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + + +//------------------------------------------------- +// ROM( cbm4016 ) +//------------------------------------------------- + +ROM_START( cbm4016 ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_DEFAULT_BIOS( "basic4r" ) + ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) + ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) + ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 + ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "901447-29.ud8", 0x5000, 0x0800, CRC(e5714d4c) SHA1(e88f56e5c54b0e8d8d4e8cb39a4647c803c1f51c) ) // Screen Editor (40 columns, no CRTC, Normal Keyb) + ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + +#define rom_cbm4032 rom_cbm4016 + + +//------------------------------------------------- +// ROM( cbm4032f ) +//------------------------------------------------- + +ROM_START( cbm4032f ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_DEFAULT_BIOS( "basic4r" ) + ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) + ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) + ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 + ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "901498-01.ud7", 0x5000, 0x0800, CRC(3370e359) SHA1(05af284c914d53a52987b5f602466de75765f650) ) // Screen Editor (40 columns, CRTC 50Hz, Normal Keyb?) + ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + + +//------------------------------------------------- +// ROM( pet4032b ) +//------------------------------------------------- + +ROM_START( pet4032b ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_DEFAULT_BIOS( "basic4r" ) + ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) + ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) + ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 + ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "901474-02.ud8", 0x5000, 0x0800, CRC(75ff4af7) SHA1(0ca5c4e8f532f914cb0bf86ea9900f20f0a655ce) ) // Screen Editor (40 columns, no CRTC, Business Keyb) + ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + +#define rom_cbm4032b rom_pet4032b + + +//------------------------------------------------- +// ROM( pet8032 ) +//------------------------------------------------- + +ROM_START( pet8032 ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 + ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "901474-03.ud7", 0x5000, 0x0800, CRC(5674dd5e) SHA1(c605fa343fd77c73cbe1e0e9567e2f014f6e7e30) ) // Screen Editor (80 columns, CRTC 60Hz, Business Keyb) + ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.ua3", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + + +//------------------------------------------------- +// ROM( cbm8032 ) +//------------------------------------------------- + +ROM_START( cbm8032 ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 + ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "901474-04.ud7", 0x5000, 0x0800, CRC(abb000e7) SHA1(66887061b6c4ebef7d6efb90af9afd5e2c3b08ba) ) // Screen Editor (80 columns, CRTC 50Hz, Business Keyb) + ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-10.ua3", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator +ROM_END + +#define rom_cbm8096 rom_cbm8032 + + +//------------------------------------------------- +// ROM( cbm8032_de ) +//------------------------------------------------- + +ROM_START( cbm8032_de ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 + ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "german.bin", 0x5000, 0x0800, CRC(1c1e597d) SHA1(7ac75ed73832847623c9f4f197fe7fb1a73bb41c) ) + ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "chargen.de", 0x0000, 0x800, CRC(3bb8cb87) SHA1(a4f0df13473d7f9cd31fd62cfcab11318e2fb1dc) ) +ROM_END + + +//------------------------------------------------- +// ROM( cbm8032_fr ) +//------------------------------------------------- + +ROM_START( cbm8032_fr ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 + ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "8032_editor_80c_fr_a1ab.ud7", 0x5000, 0x1000, CRC(4d3d9918) SHA1(eedac298a201a28ad86a5939b569a46f9f12c16f) ) + ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "8032_chargen_80c_fr_b9c1.ua3", 0x0000, 0x1000, CRC(d7424620) SHA1(e74c0eabb921d4a34032b57a7ee61ce61ec8a10c) ) +ROM_END + + +//------------------------------------------------- +// ROM( cbm8032_se ) +//------------------------------------------------- + +ROM_START( cbm8032_se ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 + ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "8000-ud7, screen-04.ud7", 0x5000, 0x0800, CRC(75901dd7) SHA1(2ead0d83255a344a42bb786428353ca48d446d03) ) + ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x800, "charom", 0 ) + ROM_LOAD( "901447-14.ua3", 0x0000, 0x800, CRC(48c77d29) SHA1(aa7c8ff844d16ec05e2b32acc586c58d9e35388c) ) // Character Generator +ROM_END + + +//------------------------------------------------- +// ROM( superpet ) +//------------------------------------------------- + +ROM_START( superpet ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 + ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "901474-04.ud7", 0x5000, 0x0800, CRC(abb000e7) SHA1(66887061b6c4ebef7d6efb90af9afd5e2c3b08ba) ) // Screen Editor (80 columns, CRTC 50Hz, Business Keyb) + ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901640-01.ua3", 0x0000, 0x1000, CRC(ee8229c4) SHA1(bf346f11595a3e65e55d6aeeaa2c0cec807b66c7) ) +ROM_END + +#define rom_mmf9000 rom_superpet + + +//------------------------------------------------- +// ROM( mmf9000_se ) +//------------------------------------------------- + +ROM_START( mmf9000_se ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 + ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "8000-ud7, screen-04.ud7", 0x5000, 0x0800, CRC(75901dd7) SHA1(2ead0d83255a344a42bb786428353ca48d446d03) ) + ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901640-01 skand.gen.ua3", 0x0000, 0x1000, CRC(da1cd630) SHA1(35f472114ff001259bdbae073ae041b0759e32cb) ) +ROM_END + + +//------------------------------------------------- +// ROM( cbm8296 ) +//------------------------------------------------- + +ROM_START( cbm8296 ) + ROM_REGION( 0x2000, M6502_TAG, ROMREGION_ERASE00 ) + + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 + + ROM_REGION( 0x1000, "editor", 0 ) + ROM_LOAD( "8296.ue8", 0x000, 0x800, CRC(a3475de6) SHA1(b715db83fd26458dfd254bef5c4aae636753f7f5) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901447-10.uc5", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator + + ROM_REGION( 0x20, "prom", 0 ) + ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing + + ROM_REGION( 0x10000, "ue5_eprom", 0 ) + ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) + + ROM_REGION( 0x10000, "ue6_eprom", 0 ) + ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 + + ROM_REGION( 0xf5, PLA2_TAG, 0 ) + ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 +ROM_END + + +//------------------------------------------------- +// ROM( cbm8296ed ) +//------------------------------------------------- + +ROM_START( cbm8296ed ) + ROM_REGION( 0x2000, M6502_TAG, 0 ) + ROM_LOAD( "oracle.ue10", 0x0000, 0x1000, CRC(1ee9485d) SHA1(f876933087c9633b0fafff4d1dc198017f250267) ) // Oracle 3.03 + ROM_LOAD( "paperclip.ue9", 0x1000, 0x1000, CRC(8fb11d4b) SHA1(1c0f883cd3b8ded42ec00d83f7e7f0887f91fec0) ) // Paperclip 2.84 + + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 + + ROM_REGION( 0x1000, "editor", 0 ) + ROM_LOAD( "execudesk.ue8", 0x0000, 0x1000, CRC(bef0eaa1) SHA1(7ea63a2d651f516e96b8725195c13542ea495ebd) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901447-10.uc5", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator + + ROM_REGION( 0x20, "prom", 0 ) + ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing + + ROM_REGION( 0x10000, "ue5_eprom", 0 ) + ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) + + ROM_REGION( 0x10000, "ue6_eprom", 0 ) + ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 + + ROM_REGION( 0xf5, PLA2_TAG, 0 ) + ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 +ROM_END + + +//------------------------------------------------- +// ROM( cbm8296d ) +//------------------------------------------------- + +ROM_START( cbm8296d ) + ROM_REGION( 0x2000, M6502_TAG, ROMREGION_ERASE00 ) + + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 + + ROM_REGION( 0x1000, "editor", 0 ) + ROM_LOAD( "324243-01.ue8", 0x0000, 0x1000, CRC(4000e833) SHA1(dafbdf8ba0a1fe7d7b9586ffbfc9e5390c0fcf6f) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901447-10.uc5", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator + + ROM_REGION( 0x20, "prom", 0 ) + ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing + + ROM_REGION( 0x10000, "ue5_eprom", 0 ) + ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) + + ROM_REGION( 0x10000, "ue6_eprom", 0 ) + ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 + + ROM_REGION( 0xf5, PLA2_TAG, 0 ) + ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 +ROM_END + + +//------------------------------------------------- +// ROM( cbm8296d_de ) +//------------------------------------------------- + +ROM_START( cbm8296d_de ) + ROM_REGION( 0x2000, M6502_TAG, ROMREGION_ERASE00 ) + + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 + + ROM_REGION( 0x1000, "editor", 0 ) + ROM_LOAD( "324243-04.ue8", 0x0000, 0x1000, CRC(3fe48897) SHA1(c218ff3168514f1d5e7822ae1b1ac3e161523b33) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "324242-10.uc5", 0x0000, 0x1000, CRC(a5632a0f) SHA1(9616f7f18757cccefb702a945f954b644d5b17d1) ) + + ROM_REGION( 0x20, "prom", 0 ) + ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing + + ROM_REGION( 0x10000, "ue5_eprom", 0 ) + ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) + + ROM_REGION( 0x10000, "ue6_eprom", 0 ) + ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 + + ROM_REGION( 0xf5, PLA2_TAG, 0 ) + ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 +ROM_END + + +//------------------------------------------------- +// ROM( cbm8296gd ) +//------------------------------------------------- + +ROM_START( cbm8296gd ) + ROM_REGION( 0x2000, M6502_TAG, 0 ) + ROM_LOAD( "324992-02.ue10", 0x0000, 0x1000, CRC(2bac5baf) SHA1(03aa866e4bc4e38e95983a6a82ba925e710bede8) ) // HiRes Emulator + ROM_LOAD( "324993-02.ue9", 0x1000, 0x1000, CRC(57444531) SHA1(74aa39888a6bc95762de767fce883203daca0d34) ) // HiRes BASIC + + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 + + ROM_REGION( 0x1000, "editor", 0 ) + ROM_LOAD( "324243-01.ue8", 0x0000, 0x1000, CRC(4000e833) SHA1(dafbdf8ba0a1fe7d7b9586ffbfc9e5390c0fcf6f) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901447-10.uc5", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator + + ROM_REGION( 0x20, "prom", 0 ) + ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing + + ROM_REGION( 0x10000, "ue5_eprom", 0 ) + ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) + + ROM_REGION( 0x10000, "ue6_eprom", 0 ) + ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 + + ROM_REGION( 0xf5, PLA2_TAG, 0 ) + ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 +ROM_END + + +//------------------------------------------------- +// ROM( cbm8296dgv_de ) +//------------------------------------------------- + +ROM_START( cbm8296dgv_de ) // SER.NO.WG 8947 + ROM_REGION( 0x2000, M6502_TAG, 0 ) + ROM_LOAD( "io gv.ue9", 0x1000, 0x1000, CRC(7adf50a0) SHA1(4f7abc5286e51f34cde98238410274715e766b31) ) // I/O MASTER (C)1982 J.PFEIFER + + ROM_REGION( 0x4000, "basic", 0 ) + ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) + + ROM_REGION( 0x1000, "editor", 0 ) + ROM_LOAD( "ue8gv.ue8", 0x0000, 0x1000, CRC(8ad1fca9) SHA1(3c939092e51549696754c308b2a09f47c5d4d277) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "ua3gv.uc5", 0x000, 0x1000, CRC(d8035dc4) SHA1(cdf520a7dabf1b18aed15455b1dbefac15ff91f3) ) + + ROM_REGION( 0x20, "prom", 0 ) + ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) + + ROM_REGION( 0x10000, "ue5_eprom", 0 ) + ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) + + ROM_REGION( 0x10000, "ue6_eprom", 0 ) + ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) + + ROM_REGION( 0xf5, PLA1_TAG, 0 ) + ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 + + ROM_REGION( 0xf5, PLA2_TAG, 0 ) + ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1977, pet2001, 0, 0, pet2001, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-4", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1977, pet20018, pet2001, 0, pet20018, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-8", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, pet2001n, 0, 0, pet2001n8, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-N8", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, pet2001n16, pet2001n, 0, pet2001n16, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-N16", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, pet2001n32, pet2001n, 0, pet2001n32, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-N32", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, cbm3008, pet2001n, 0, cbm3008, pet, driver_device, 0, "Commodore Business Machines", "CBM 3008", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, cbm3016, pet2001n, 0, cbm3016, pet, driver_device, 0, "Commodore Business Machines", "CBM 3016", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, cbm3032, pet2001n, 0, cbm3032, pet, driver_device, 0, "Commodore Business Machines", "CBM 3032", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, pet2001b, 0, 0, pet2001b8, petb, driver_device, 0, "Commodore Business Machines", "PET 2001-B8", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, pet2001b16, pet2001b, 0, pet2001b16, petb, driver_device, 0, "Commodore Business Machines", "PET 2001-B16", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, pet2001b32, pet2001b, 0, pet2001b32, petb, driver_device, 0, "Commodore Business Machines", "PET 2001-B32", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, cbm3032b, pet2001b, 0, cbm3032b, petb, driver_device, 0, "Commodore Business Machines", "CBM 3032B", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1980, pet4016, 0, 0, pet4016, pet, driver_device, 0, "Commodore Business Machines", "PET 4016", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1980, pet4032, pet4016, 0, pet4032, pet, driver_device, 0, "Commodore Business Machines", "PET 4032", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1980, pet4032f, pet4016, 0, pet4032f, pet, driver_device, 0, "Commodore Business Machines", "PET 4032 (Fat 40)", MACHINE_SUPPORTS_SAVE ) +COMP( 1980, cbm4016, pet4016, 0, cbm4016, pet, driver_device, 0, "Commodore Business Machines", "CBM 4016", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1980, cbm4032, pet4016, 0, cbm4032, pet, driver_device, 0, "Commodore Business Machines", "CBM 4032", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1980, cbm4032f, pet4016, 0, cbm4032f, pet, driver_device, 0, "Commodore Business Machines", "CBM 4032 (Fat 40)", MACHINE_SUPPORTS_SAVE ) +COMP( 1980, pet4032b, 0, 0, pet4032b, petb, driver_device, 0, "Commodore Business Machines", "PET 4032B", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1980, cbm4032b, pet4032b, 0, cbm4032b, petb, driver_device, 0, "Commodore Business Machines", "CBM 4032B", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1980, pet8032, 0, 0, pet8032, petb, driver_device, 0, "Commodore Business Machines", "PET 8032", MACHINE_SUPPORTS_SAVE ) +COMP( 1981, cbm8032, pet8032, 0, pet8032, petb, driver_device, 0, "Commodore Business Machines", "CBM 8032", MACHINE_SUPPORTS_SAVE ) +COMP( 1981, cbm8032_de, pet8032, 0, pet8032, petb_de, driver_device, 0, "Commodore Business Machines", "CBM 8032 (Germany)", MACHINE_SUPPORTS_SAVE ) +COMP( 1981, cbm8032_fr, pet8032, 0, pet8032, petb_fr, driver_device, 0, "Commodore Business Machines", "CBM 8032 (France)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1981, cbm8032_se, pet8032, 0, pet8032, petb_se, driver_device, 0, "Commodore Business Machines", "CBM 8032 (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) +COMP( 1981, superpet, pet8032, 0, superpet, petb, driver_device, 0, "Commodore Business Machines", "SuperPET SP-9000", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1981, mmf9000, pet8032, 0, superpet, petb, driver_device, 0, "Commodore Business Machines", "MicroMainFrame 9000", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1981, mmf9000_se, pet8032, 0, superpet, petb_se, driver_device, 0, "Commodore Business Machines", "MicroMainFrame 9000 (Sweden/Finland)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1981, cbm8096, pet8032, 0, cbm8096, petb, driver_device, 0, "Commodore Business Machines", "CBM 8096", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, cbm8296, 0, 0, cbm8296, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, cbm8296ed, cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296 ExecuDesk", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, cbm8296d, cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296-D", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, cbm8296d_de,cbm8296, 0, cbm8296d, petb_de, driver_device, 0, "Commodore Business Machines", "CBM 8296-D (Germany)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, cbm8296gd, cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296GD", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, cbm8296dgv_de,cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296-D GV? (Germany)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/phc25.c b/src/mame/drivers/phc25.c new file mode 100644 index 00000000000..861f8589201 --- /dev/null +++ b/src/mame/drivers/phc25.c @@ -0,0 +1,384 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Robbbert +/*************************************************************************** + + Sanyo PHC-25 + + + http://www.geocities.jp/sanyo_phc_25/ + http://www.phc25.com/ + + Z80 @ 4 MHz + MC6847 video + 3x 8KB bios ROM + 1x 4KB chargen ROM + 16KB RAM + 6KB video RAM + + LOCK key (CAPSLOCK) selects upper-case/lower-case on international version + (phc25), and selects hiragana/upper-case on Japanese version (phc25j). + + + + TODO: + + - sound isn't working + - screen attribute bit 7 is unknown + + + +10 SCREEN3,1,1:COLOR,,1:CLS +20 X1=INT(RND(1)*256):Y1=INT(RND(1)*192):X2=INT(RND(1)*256):Y2=INT(RND(1)*192):C=INT(RND(1)*4)+1:LINE(X1,Y1)-(X2,Y2),C:GOTO 20 +RUN + + +10 SCREEN2,1,1:CLS:FORX=0TO8:LINE(X*24,0)-(X*24+16,191),X,BF:NEXT +RUN + +*****************************************************************************/ + +#include "includes/phc25.h" + +/* Read/Write Handlers */ + +READ8_MEMBER( phc25_state::port40_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 vertical sync + 5 cassette read + 6 centronics busy + 7 horizontal sync + + */ + + UINT8 data = 0; + + /* vertical sync */ + data |= !m_vdg->fs_r() << 4; + + /* cassette read */ + data |= ((m_cassette)->input() < +0.3) << 5; + + /* centronics busy */ + data |= m_centronics_busy << 6; + + /* horizontal sync */ + data |= !m_vdg->hs_r() << 7; + + return data; +} + +WRITE8_MEMBER( phc25_state::port40_w ) +{ + /* + + bit description + + 0 cassette output + 1 cassette motor + 2 LED in the LOCK button (on = capslock) + 3 centronics strobe + 4 + 5 MC6847 GM0 + 6 MC6847 CSS + 7 MC6847 A/G + + */ + + /* cassette output */ + m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); + + /* cassette motor */ + m_cassette->change_state(BIT(data,1) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + + /* centronics strobe */ + m_centronics->write_strobe(BIT(data, 3)); + + /* MC6847 */ + m_vdg->gm0_w(BIT(data, 5)); + m_vdg->css_w(BIT(data, 6)); + m_vdg->ag_w(BIT(data, 7)); + m_port40 = data; +} + +WRITE_LINE_MEMBER( phc25_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( phc25_mem, AS_PROGRAM, 8, phc25_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x5fff) AM_ROM AM_REGION(Z80_TAG, 0) + AM_RANGE(0x6000, 0x77ff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0xc000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( phc25_io, AS_IO, 8, phc25_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x40, 0x40) AM_READWRITE(port40_r, port40_w) + AM_RANGE(0x80, 0x80) AM_READ_PORT("KEY0") + AM_RANGE(0x81, 0x81) AM_READ_PORT("KEY1") + AM_RANGE(0x82, 0x82) AM_READ_PORT("KEY2") + AM_RANGE(0x83, 0x83) AM_READ_PORT("KEY3") + AM_RANGE(0x84, 0x84) AM_READ_PORT("KEY4") + AM_RANGE(0x85, 0x85) AM_READ_PORT("KEY5") + AM_RANGE(0x86, 0x86) AM_READ_PORT("KEY6") + AM_RANGE(0x87, 0x87) AM_READ_PORT("KEY7") + AM_RANGE(0x88, 0x88) AM_READ_PORT("KEY8") + AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(AY8910_TAG, ay8910_device, data_r, data_w) + AM_RANGE(0xc1, 0xc1) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( phc25 ) + PORT_START("KEY0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) // unlabeled key + + PORT_START("KEY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("KEY2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("KEY4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("KEY8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("JOY0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( phc25j ) + PORT_INCLUDE( phc25 ) +INPUT_PORTS_END + +/* Video */ + +READ8_MEMBER( phc25_state::video_ram_r ) +{ + if BIT(m_port40, 7) // graphics + { + return m_video_ram[offset]; + } + else // text + { + offset &= 0x7ff; + m_vdg->inv_w(BIT(m_video_ram[offset | 0x800], 0)); // cursor attribute + m_vdg->as_w(BIT(m_video_ram[offset | 0x800], 1)); // screen2 lores attribute + m_vdg->css_w(BIT(m_video_ram[offset | 0x800], 2)); // css attribute + // bit 7 is set for all text (not spaces), meaning is unknown + return m_video_ram[offset]; + } +} + +MC6847_GET_CHARROM_MEMBER(phc25_state::pal_char_rom_r) +{ + return m_char_rom[((ch - 2) * 12) + line + 4]; +} + +// irq is inverted in emulation, so we need this trampoline +WRITE_LINE_MEMBER( phc25_state::irq_w ) +{ + m_maincpu->set_input_line(0, state ? CLEAR_LINE : ASSERT_LINE); +} + +MC6847_GET_CHARROM_MEMBER(phc25_state::ntsc_char_rom_r) +{ + return m_char_rom[(ch * 16) + line]; +} + +void phc25_state::video_start() +{ + /* find memory regions */ + m_char_rom = memregion(Z80_TAG)->base() + 0x5000; + m_port40 = 0; +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( phc25, phc25_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(phc25_mem) + MCFG_CPU_IO_MAP(phc25_io) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(AY8910_TAG, AY8910, 1996750) + MCFG_AY8910_PORT_A_READ_CB(IOPORT("JOY0")) + MCFG_AY8910_PORT_B_READ_CB(IOPORT("JOY1")) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) + + /* devices */ + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(phc25_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(phc25_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pal, phc25 ) + /* video hardware */ + MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, MC6847_TAG) + + MCFG_DEVICE_ADD(MC6847_TAG, MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(phc25_state, irq_w)) + MCFG_MC6847_INPUT_CALLBACK(READ8(phc25_state, video_ram_r)) + MCFG_MC6847_CHARROM_CALLBACK(phc25_state, pal_char_rom_r) + MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM2 | MC6847_MODE_GM1 | MC6847_MODE_INTEXT) + // other lines not connected +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ntsc, phc25 ) + /* video hardware */ + MCFG_SCREEN_MC6847_NTSC_ADD(SCREEN_TAG, MC6847_TAG) + + MCFG_DEVICE_ADD(MC6847_TAG, MC6847_NTSC, XTAL_3_579545MHz) + MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(phc25_state, irq_w)) + MCFG_MC6847_INPUT_CALLBACK(READ8(phc25_state, video_ram_r)) + MCFG_MC6847_CHARROM_CALLBACK(phc25_state, ntsc_char_rom_r) + MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM2 | MC6847_MODE_GM1 | MC6847_MODE_INTEXT) + // other lines not connected +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( phc25 ) + ROM_REGION( 0x6000, Z80_TAG, 0 ) + ROM_LOAD( "phc25rom.0", 0x0000, 0x2000, CRC(fa28336b) SHA1(582376bee455e124de24ba4ac02326c8a592fa5a)) + ROM_LOAD( "phc25rom.1", 0x2000, 0x2000, CRC(38fd578b) SHA1(dc3db78c0cdc89f1605200d39535be65a4091705)) + ROM_LOAD( "phc25rom.2", 0x4000, 0x2000, CRC(54392b27) SHA1(1587827fe9438780b50164727ce3fdea1b98078a)) +ROM_END + +ROM_START( phc25j ) + ROM_REGION( 0x6000, Z80_TAG, 0 ) + ROM_LOAD( "phc25-11.0", 0x0000, 0x2000, CRC(287e83b0) SHA1(9fe960a8245f28efc04defeeeaceb1e5ec6793b8)) + ROM_LOAD( "phc25-11.1", 0x2000, 0x2000, CRC(6223f945) SHA1(5d44b883b6264cb5d2e21b2269308630c62e0e56)) + ROM_LOAD( "phc25-11.2", 0x4000, 0x2000, CRC(da859ae4) SHA1(6121e85947921e434d0157c378de3d81537f6b9f)) + //ROM_LOAD( "022 00aa.ic", 0x0000, 0x2000, NO_DUMP ) + //ROM_LOAD( "022 01aa.ic", 0x2000, 0x2000, NO_DUMP ) + //ROM_LOAD( "022 02aa.ic", 0x4000, 0x2000, NO_DUMP ) + //ROM_REGION( 0x1000, "chargen", 0 ) + //ROM_LOAD( "022 04a.ic", 0x0000, 0x1000, NO_DUMP ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, phc25, 0, 0, pal, phc25, driver_device, 0, "Sanyo", "PHC-25 (Europe)", MACHINE_NO_SOUND ) +COMP( 1983, phc25j, phc25, 0, ntsc, phc25j, driver_device, 0, "Sanyo", "PHC-25 (Japan)", MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/phunsy.c b/src/mame/drivers/phunsy.c new file mode 100644 index 00000000000..20ba34c3f49 --- /dev/null +++ b/src/mame/drivers/phunsy.c @@ -0,0 +1,398 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + PHUNSY (Philipse Universal System) + + 2010-11-04 Skeleton driver. + 2012-05-24 Cassette added. + 2014-01-13 Quickload added. + + http://www.tubedata.info/phunsy/index.html + + Baud Rate ~ 6000 baud + W command to save data, eg 800-8FFW + R command to read data, eg 1100R to load the file at 1100, + or R to load the file where it came from. + The tape must already be playing the leader when you press the Enter + key, or it errors immediately. + + Rom banking (in U bank): + 0U: RAM + 1U: MDCR program + 2U: Disassembler + 3U: Label handler + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/s2650/s2650.h" +#include "machine/keyboard.h" +#include "sound/speaker.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "imagedev/snapquik.h" + + +#define LOG 1 + +#define KEYBOARD_TAG "keyboard" + +class phunsy_state : public driver_device +{ +public: + phunsy_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cass(*this, "cassette"), + m_p_videoram(*this, "videoram") + { + } + + DECLARE_DRIVER_INIT(phunsy); + DECLARE_READ8_MEMBER( phunsy_data_r ); + DECLARE_WRITE8_MEMBER( phunsy_ctrl_w ); + DECLARE_WRITE8_MEMBER( phunsy_data_w ); + DECLARE_WRITE8_MEMBER( kbd_put ); + DECLARE_READ8_MEMBER(cass_r); + DECLARE_WRITE_LINE_MEMBER(cass_w); + DECLARE_QUICKLOAD_LOAD_MEMBER(phunsy); + DECLARE_PALETTE_INIT(phunsy); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +private: + const UINT8 *m_p_chargen; + UINT8 m_data_out; + UINT8 m_keyboard_input; + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; + required_device m_speaker; + required_device m_cass; + required_shared_ptr m_p_videoram; +}; + + +WRITE_LINE_MEMBER( phunsy_state::cass_w ) +{ + m_cass->output(state ? -1.0 : +1.0); +} + +READ8_MEMBER( phunsy_state::cass_r ) +{ + return (m_cass->input() > 0.03) ? 0 : 1; +} + +static ADDRESS_MAP_START( phunsy_mem, AS_PROGRAM, 8, phunsy_state ) + AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0x0800, 0x0fff) AM_RAM + AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE("videoram") // Video RAM + AM_RANGE(0x1800, 0x1fff) AM_READ_BANK("bankru") AM_WRITE_BANK("bankwu") // Banked RAM/ROM + AM_RANGE(0x2000, 0x3fff) AM_RAM + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bankq") // Banked RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( phunsy_io, AS_IO, 8, phunsy_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( S2650_CTRL_PORT, S2650_CTRL_PORT ) AM_WRITE( phunsy_ctrl_w ) + AM_RANGE( S2650_DATA_PORT,S2650_DATA_PORT) AM_READWRITE( phunsy_data_r, phunsy_data_w ) + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) +ADDRESS_MAP_END + + +WRITE8_MEMBER( phunsy_state::phunsy_ctrl_w ) +{ + if (LOG) + logerror("%s: phunsy_ctrl_w %02x\n", machine().describe_context(), data); + + // Q-bank + membank("bankq")->set_entry(data & 15); + + // U-bank + data >>= 4; + + if (data < 4) + membank("bankru")->set_entry(data); +} + + +WRITE8_MEMBER( phunsy_state::phunsy_data_w ) +{ + if (LOG) + logerror("%s: phunsy_data_w %02x\n", machine().describe_context(), data); + + m_data_out = data; + + /* b0 - TTY out */ + /* b1 - select MDCR / keyboard */ + /* b2 - Clear keyboard strobe signal */ + if ( data & 0x04 ) + { + m_keyboard_input |= 0x80; + } + + /* b3 - speaker output (manual says it is bit 1)*/ + m_speaker->level_w(BIT(data, 1)); + + /* b4 - -REV MDCR output */ + /* b5 - -FWD MDCR output */ + /* b6 - -WCD MDCR output */ + /* b7 - WDA MDCR output */ +} + + +READ8_MEMBER( phunsy_state::phunsy_data_r ) +{ + UINT8 data = 0xff; + + //if (LOG) + //logerror("%s: phunsy_data_r\n", machine().describe_context()); + + if ( m_data_out & 0x02 ) + { + /* MDCR selected */ + /* b0 - TTY input */ + /* b1 - SK1 switch input */ + /* b2 - SK2 switch input */ + /* b3 - -WEN MDCR input */ + /* b4 - -CIP MDCR input */ + /* b5 - -BET MDCR input */ + /* b6 - RDA MDCR input */ + /* b7 - RDC MDCR input */ + data = 0xFF; + } + else + { + /* Keyboard selected */ + /* b0-b6 - ASCII code from keyboard */ + /* b7 - strobe signal */ + data = m_keyboard_input; + } + + return data; +} + + +/* Input ports */ +static INPUT_PORTS_START( phunsy ) +INPUT_PORTS_END + + +WRITE8_MEMBER( phunsy_state::kbd_put ) +{ + if (data) + m_keyboard_input = data; +} + + +void phunsy_state::machine_reset() +{ + membank("bankru")->set_entry(0); // point at ram + membank("bankq" )->set_base( memregion("ram_4000")->base() ); + m_keyboard_input = 0xFF; + m_data_out = 0; +} + + +PALETTE_INIT_MEMBER(phunsy_state, phunsy) +{ + for ( int i = 0; i < 8; i++ ) + { + int j = ( i << 5 ) | ( i << 2 ) | ( i >> 1 ); + + palette.set_pen_color( i, j, j, j ); + } +} + + +void phunsy_state::video_start() +{ + m_p_chargen = memregion( "chargen" )->base(); +} + + +UINT32 phunsy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,col; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 32; y++) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma+64; x++) + { + chr = m_p_videoram[x]; + + if (BIT(chr, 7)) + { + /* Graphics mode */ + gfx = 0; + col = ( chr >> 4 ) & 7; + if ( (BIT(chr, 0) && (!BIT(ra, 2))) || (BIT(chr, 2) && (BIT(ra, 2))) ) + gfx = 0x38; + if ( (BIT(chr, 1) && (!BIT(ra, 2))) || (BIT(chr, 3) && (BIT(ra, 2))) ) + gfx |= 7; + } + else + { + /* ASCII mode */ + gfx = m_p_chargen[(chr<<3) | ra]; + col = 7; + } + + /* Display a scanline of a character (6 pixels) */ + *p++ = BIT( gfx, 5 ) ? col : 0; + *p++ = BIT( gfx, 4 ) ? col : 0; + *p++ = BIT( gfx, 3 ) ? col : 0; + *p++ = BIT( gfx, 2 ) ? col : 0; + *p++ = BIT( gfx, 1 ) ? col : 0; + *p++ = BIT( gfx, 0 ) ? col : 0; + } + } + ma+=64; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout phunsy_charlayout = +{ + 5, 7, /* 6 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 3, 4, 5, 6, 7 }, + /* y offsets */ + { 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( phunsy ) + GFXDECODE_ENTRY( "chargen", 0x0000, phunsy_charlayout, 1, 3 ) +GFXDECODE_END + +// quickloads can start from various addresses, and the files have no header. +QUICKLOAD_LOAD_MEMBER( phunsy_state, phunsy ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT16 i; + UINT16 quick_addr = 0x1800; + dynamic_buffer quick_data; + int result = IMAGE_INIT_FAIL; + int quick_length = image.length(); + if (quick_length > 0x4000) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.message(" File too long"); + } + else + { + quick_data.resize(quick_length); + membank("bankru")->set_entry(0); // point at ram + + UINT16 exec_addr = quick_addr + 2; + + for (i = 0; i < quick_length; i++) + space.write_byte(i+quick_addr, quick_data[i]); + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); + + // Start the quickload + m_maincpu->set_state_int(S2650_R0, exec_addr>>8); + m_maincpu->set_state_int(S2650_R1, 0x08); + m_maincpu->set_state_int(S2650_R2, 0xe0); + m_maincpu->set_state_int(S2650_R3, 0x83); + m_maincpu->set_state_int(S2650_PC, exec_addr); + + result = IMAGE_INIT_PASS; + } + + return result; +} + +DRIVER_INIT_MEMBER( phunsy_state, phunsy ) +{ + UINT8 *main = memregion("maincpu")->base(); + UINT8 *roms = memregion("roms")->base(); + UINT8 *ram = memregion("ram_4000")->base(); + + membank("bankru")->configure_entry(0, &main[0x1800]); + membank("bankwu")->configure_entry(0, &main[0x1800]); + membank("bankru")->configure_entries(1, 3, &roms[0x800], 0x800); + membank("bankq")->configure_entries(0, 16, &ram[0], 0x4000); + + membank("bankru")->set_entry(0); // point at ram + membank("bankwu")->set_entry(0); // always write to ram + membank("bankq")->set_entry(0); +} + +static MACHINE_CONFIG_START( phunsy, phunsy_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(phunsy_mem) + MCFG_CPU_IO_MAP(phunsy_io) + MCFG_S2650_FLAG_HANDLER(WRITELINE(phunsy_state, cass_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + /* Display (page 12 of pdf) + - 8Mhz clock + - 64 6 pixel characters on a line. + - 16us not active, 48us active: ( 64 * 6 ) * 60 / 48 => 480 pixels wide + - 313 line display of which 256 are displayed. + */ + MCFG_SCREEN_RAW_PARAMS(XTAL_8MHz, 480, 0, 64*6, 313, 0, 256) + MCFG_SCREEN_UPDATE_DRIVER(phunsy_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", phunsy) + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(phunsy_state, phunsy) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(phunsy_state, kbd_put)) + MCFG_CASSETTE_ADD( "cassette" ) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", phunsy_state, phunsy, "bin", 2) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( phunsy ) + ROM_REGION( 0x4000, "maincpu", ROMREGION_ERASE00 ) + + ROM_REGION( 0x2000, "roms", 0 ) + ROM_LOAD( "phunsy_bios.bin", 0x0000, 0x0800, CRC(a789e82e) SHA1(b1c130ab2b3c139fd16ddc5dc7bdcaf7a9957d02)) + ROM_LOAD( "pdcr.bin", 0x0800, 0x0800, CRC(74bf9d0a) SHA1(8d2f673615215947f033571f1221c6aa99c537e9)) + ROM_LOAD( "dass.bin", 0x1000, 0x0800, CRC(13380140) SHA1(a999201cb414abbf1e10a7fcc1789e3e000a5ef1)) + ROM_LOAD( "labhnd.bin", 0x1800, 0x0800, CRC(1d5a106b) SHA1(a20d09e32e21cf14db8254cbdd1d691556b473f0)) + + ROM_REGION( 0x0400, "chargen", 0 ) + ROM_LOAD( "ph_char1.bin", 0x0200, 0x0100, CRC(a7e567fc) SHA1(b18aae0a2d4f92f5a7e22640719bbc4652f3f4ee)) + ROM_CONTINUE(0x0100, 0x0100) + ROM_LOAD( "ph_char2.bin", 0x0000, 0x0100, CRC(3d5786d3) SHA1(8cf87d83be0b5e4becfa9fd6e05b01250a2feb3b)) + ROM_CONTINUE(0x0300, 0x0100) + + /* 16 x 16KB RAM banks */ + ROM_REGION( 0x40000, "ram_4000", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, phunsy, 0, 0, phunsy, phunsy, phunsy_state, phunsy, "J.F.P. Philipse", "PHUNSY", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pimps.c b/src/mame/drivers/pimps.c new file mode 100644 index 00000000000..633aa870ac0 --- /dev/null +++ b/src/mame/drivers/pimps.c @@ -0,0 +1,114 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + P.I.M.P.S. (Personal Interactive MicroProcessor System) + + 06/12/2009 Skeleton driver. + +Commands: +A Assemble Code +D Dump Memory +E Enter the Text Editor +F Full Duplex Host Operation +G Go To +H Half Duplex Host Operation +M Memory +P Port +S Substitute +T Transparent Mode +U Usart Parameters for Host +V Virtual Memory + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class pimps_state : public driver_device +{ +public: + pimps_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_terminal(*this, TERMINAL_TAG), + m_maincpu(*this, "maincpu") + { + } + + DECLARE_READ8_MEMBER(term_status_r); + DECLARE_READ8_MEMBER(term_r); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_term_data; + virtual void machine_reset(); + + required_device m_terminal; + required_device m_maincpu; +}; + + +// should be 8251 UART + + +READ8_MEMBER( pimps_state::term_status_r ) +{ + return (m_term_data) ? 3 : 1; +} + +READ8_MEMBER( pimps_state::term_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +static ADDRESS_MAP_START(pimps_mem, AS_PROGRAM, 8, pimps_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pimps_io, AS_IO, 8, pimps_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xf0, 0xf0) AM_READ(term_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0xf1, 0xf1) AM_READ(term_status_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pimps ) +INPUT_PORTS_END + + +void pimps_state::machine_reset() +{ + m_term_data = 0; +} + +WRITE8_MEMBER( pimps_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( pimps, pimps_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8085A, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(pimps_mem) + MCFG_CPU_IO_MAP(pimps_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(pimps_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pimps ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "pimps.bin", 0xf000, 0x1000, CRC(5da1898f) SHA1(d20e31d0981a1f54c83186dbdfcf4280e49970d0)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 197?, pimps, 0, 0, pimps, pimps, driver_device, 0, "Henry Colford", "P.I.M.P.S.", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/pipbug.c b/src/mame/drivers/pipbug.c new file mode 100644 index 00000000000..c6050fb81cf --- /dev/null +++ b/src/mame/drivers/pipbug.c @@ -0,0 +1,182 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + PIPBUG + + 08/04/2010 Skeleton driver. + 16/05/2012 Connected to serial terminal.. working + + All input must be in uppercase. + + Commands: + A - See and alter memory + B - Set breakpoint (2 permitted) + C - Clear breakpoint + D - Dump memory to paper tape + G - Go to address, run + L - Load memory from paper tape + S - See and alter registers + + PIPBUG isn't a computer; it is a the name of the bios used + in a number of small 2650-based computers from 1976 to 1978. + Examples include Baby 2650, Eurocard 2650, etc., plus Signetics + own PC1001, PC1500, and KT9500 systems. PIPBUG was written by Signetics. + + The sole means of communication is via a serial terminal. + PIPBUG uses the SENSE and FLAG pins as serial lines, thus + there is no need for a UART. The baud rate is 110. + + The Baby 2650 (featured in Electronics Australia magazine in + March 1977) has 256 bytes of RAM. + + The terminal is expected to have a papertape device attached, and + use it to save and load programs. PIPBUG still thinks it is talking + to the terminal, when in fact the data is flowing to the papertape + reader and punch. + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/s2650/s2650.h" +#include "machine/terminal.h" +#include "imagedev/snapquik.h" + + +class pipbug_state : public driver_device +{ +public: + pipbug_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_rs232(*this, "rs232"), + m_maincpu(*this, "maincpu") + { + } + + DECLARE_WRITE8_MEMBER(pipbug_ctrl_w); + required_device m_rs232; + required_device m_maincpu; + DECLARE_QUICKLOAD_LOAD_MEMBER( pipbug ); +}; + +WRITE8_MEMBER( pipbug_state::pipbug_ctrl_w ) +{ +// 0x80 is written here - not connected in the baby 2650 +} + +static ADDRESS_MAP_START(pipbug_mem, AS_PROGRAM, 8, pipbug_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x03ff) AM_ROM + AM_RANGE( 0x0400, 0x7fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pipbug_io, AS_IO, 8, pipbug_state) +// ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_WRITE(pipbug_ctrl_w) + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READNOP // this has to return zero or the parameter to write_sense is ignored +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pipbug ) +INPUT_PORTS_END + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_110 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_110 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +QUICKLOAD_LOAD_MEMBER( pipbug_state, pipbug ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int i; + int quick_addr = 0x440; + int exec_addr; + int quick_length; + dynamic_buffer quick_data; + int read_; + int result = IMAGE_INIT_FAIL; + + quick_length = image.length(); + if (quick_length < 0x0444) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.message(" File too short"); + } + else if (quick_length > 0x8000) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.message(" File too long"); + } + else + { + quick_data.resize(quick_length); + read_ = image.fread( &quick_data[0], quick_length); + if (read_ != quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.message(" Cannot read the file"); + } + else if (quick_data[0] != 0xc4) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.message(" Invalid header"); + } + else + { + exec_addr = quick_data[1] * 256 + quick_data[2]; + + if (exec_addr >= quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.message(" Exec address beyond end of file"); + } + else + { + for (i = quick_addr; i < read_; i++) + space.write_byte(i, quick_data[i]); + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); + + // Start the quickload + m_maincpu->set_state_int(S2650_PC, exec_addr); + + result = IMAGE_INIT_PASS; + } + } + } + + return result; +} + +static MACHINE_CONFIG_START( pipbug, pipbug_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(pipbug_mem) + MCFG_CPU_IO_MAP(pipbug_io) + MCFG_S2650_FLAG_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + + /* video hardware */ + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("maincpu", s2650_device, write_sense)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", pipbug_state, pipbug, "pgm", 1) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( pipbug ) + ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "pipbug.rom", 0x0000, 0x0400, CRC(f242b93e) SHA1(f82857cc882e6b5fc9f00b20b375988024f413ff)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, pipbug, 0, 0, pipbug, pipbug, driver_device, 0, "Signetics", "PIPBUG", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/pitagjr.c b/src/mame/drivers/pitagjr.c new file mode 100644 index 00000000000..79f3b5b1957 --- /dev/null +++ b/src/mame/drivers/pitagjr.c @@ -0,0 +1,232 @@ +// license:BSD-3-Clause +// copyright-holders:Roberto Fresca +/*************************************************************************************** + + Product name: Pitagorin Junior. + Brand: VTech. + Type: First steps (4-6 years old) laptop. + Language: Spanish. + Description: 23 didactic games with voice and sounds for 1 or 2 players. + (simple maths operations, spell, hang man, letters, numbers, etc) + + Docs by Roberto Fresca. + + *************************************************************************************** + + Games / Activities ... + + ORDER TITLE TRANSLATION + -----+---------------------------+---------------------- + 01 - La letra perdida. The missing letter. + 02 - Deletrear. Spell. + 03 - Plurales. Plurals. + 04 - Verbos. Verbs. + 05 - El Ahorcado. Hangman. + 06 - Revoltijo de letras. Messed letters. + 07 - La palabra escondida. The hidden word. + 08 - Trueque de letras. Swapped letters. + 09 - La letra intrusa. The intruder letter. + 10 - Matematicas (+,-,x,/). Mathematics (+,-,x,/). + 11 - Aprendiendo los numeros. Learning the numbers. + 12 - Redondeando cifras. Rounding numbers. + 13 - Encuentra el signo. Find the sign. + 14 - Calculadora. Calculator. + 15 - Tres en raya. Three in a raw. + 16 - El juego de los puntos. The dot's game. + 17 - El juego del squash. The squash game. + 18 - El juego del arquero. The archer game. + 19 - Dibujos animados. Animated cartoons. + 20 - El compositor. The composer. + + *************************************************************************************** + + What's inside.... + + PCB silkscreened '9817' + etched on copper '35-19122-2' & '703013-C' + + 1x Unknown CPU inside an epoxy blob (more than 100 connections) @ U? (covered with the blob). + 1x VTech LH532HJT mask ROM (originary from Sharp) also silkscreened '9811D' @ U3. + 1x Texas Instruments 84C91HT (CSM10150AN) speech synth with 8-bit microprocessor @ U2. + 1x SN74HC00N @ U5. + 1x SN74HC244N @ U4. + + 1x Unknown oscillator (XTAL1). + 1x Unknown trimpot on an r/c oscillator (XTAL2). + + 1x 32 contacts (single side) expansion port. + 1x 3 contacts (unknown) connector. + 1x 17 contacts Keyboard (KEY1) connector. + 1x 3 contacts (CONT) connector. + + + PCB layout: + .......CONNECTORS........ + .------------------------------------------------------------------------------------. + | .-----------------. ooo ooooooooooooooooo ooo 9817 |.---. + | | THIS SECTOR | unk KEY1 CONT .-------. / =| + | | | | | / =| + | | IS POPULATED | | VTECH | | E =| + | | | .-----------. | | | X =| + | | WITH A LOT | | SN74HC00N | (84C91) | LH532 | | P P =| + | | | '-----------' .----------. | HJT | | A O =| + | | OF... | U5 |CSM10150AN| | | | N R =| + | | | '----------'.---. | 9811D | | S T =| + | | RESISTORS, | U2 | / | | | | I =| + | | | U4 '---' | | | O =| + | | CAPACITORS, | .--. XTAL 2 '-------' | N =| + | | | |SN| ____ U3 \ =| + | | AND | |74| / \ \ =| + | | | |HC| 35-19122-2 | BLOB | |'---' + | | TRANSISTORS | |24| 703013-C \____/ .----. | + | | | |4N| U? '----' | + | '-----------------' '--' XTAL 1 | + '------------------------------------------------------------------------------------' + + + Expansion Port: + + CONNECTOR CONNECTOR + --------- --------- + 01 ----> Vcc 17 ----> LH532HJT (pin 09) + 02 ----> Vcc 18 ----> LH532HJT (pin 25) + 03 ----> GND 19 ----> LH532HJT (pin 10) + 04 ----> ??? 20 ----> LH532HJT (pin 23) + 05 ----> LH532HJT (pin 03) 21 ----> LH532HJT (pin 11) + 06 ----> LH532HJT (pin 02) 22 ----> LH532HJT (pin 21) + 07 ----> LH532HJT (pin 04) 23 ----> LH532HJT (pin 12) + 08 ----> LH532HJT (pin 30) 24 ----> LH532HJT (pin 20) + 09 ----> LH532HJT (pin 05) 25 ----> LH532HJT (pin 13) + 10 ----> LH532HJT (pin 29) 26 ----> LH532HJT (pin 19) + 11 ----> LH532HJT (pin 06) 27 ----> LH532HJT (pin 14) + 12 ----> LH532HJT (pin 28) 28 ----> LH532HJT (pin 18) + 13 ----> LH532HJT (pin 07) 29 ----> LH532HJT (pin 15) + 14 ----> LH532HJT (pin 27) 30 ----> LH532HJT (pin 17) + 15 ----> LH532HJT (pin 08) 31 ----> GND + 16 ----> LH532HJT (pin 26) 32 ----> GND + + + U3 - VTech LH532HJT (9811D) 2Mb mask ROM. + Seems to be 27C020 pin compatible. + + .----v----. + VCC --|01 32|-- VCC + --|02 31|-- + --|03 30|-- + --|04 29|-- + --|05 28|-- + --|06 27|-- + --|07 26|-- + --|08 25|-- + --|09 24|-- + --|10 23|-- + --|11 22|-- + --|12 21|-- + --|13 20|-- + --|14 19|-- + --|15 18|-- + GND --|16 17|-- + '---------' + + + U2 - Texas Instruments 84C91HT (CSM10150AN). + + Speech Generator with 8-bit microprocessor, 8K ROM, 112 bytes RAM. + Maximum Clock Frequency = 9.6 MHz. + Package = DIP16 + Technology = CMOS + + .---v---. + --|01 16|-- + --|02 15|-- + --|03 14|-- + --|04 13|-- + GND --|05 12|-- VCC + --|06 11|-- + --|07 10|-- GND + --|08 09|-- + '-------' + + ***************************************************************************************/ + + +#include "emu.h" +#include "cpu/m6805/m6805.h" +#include "rendlay.h" + +class pitagjr_state : public driver_device +{ +public: + pitagjr_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_rombank(*this, "rombank") + { } + + required_device m_maincpu; + required_memory_bank m_rombank; + + virtual void machine_start(); + DECLARE_PALETTE_INIT(pitagjr); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + + +static ADDRESS_MAP_START(pitajr_mem, AS_PROGRAM, 8, pitagjr_state) + AM_RANGE(0x0000, 0x00ff) AM_RAM + AM_RANGE(0x1000, 0x1fff) AM_ROM // boot ROM ??? + AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("rombank") +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( pitajr ) +INPUT_PORTS_END + +void pitagjr_state::machine_start() +{ + m_rombank->configure_entries(0, 0x20, memregion("maincpu")->base(), 0x2000); + m_rombank->set_entry(1); +} + +PALETTE_INIT_MEMBER(pitagjr_state, pitagjr) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +UINT32 pitagjr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( pitajr, pitagjr_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD63705, XTAL_2MHz) // probably a m6805-based MCU with internal boot ROM + MCFG_CPU_PROGRAM_MAP(pitajr_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(pitagjr_state, screen_update) + MCFG_SCREEN_SIZE( 200, 100 ) // FIXME + MCFG_SCREEN_VISIBLE_AREA( 0, 200-1, 0, 100-1 ) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(pitagjr_state, pitagjr) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( pitagjr ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_LOAD( "lh532hjt_9811d.u3", 0x00000, 0x40000, CRC(23878b45) SHA1(8f3c41c10cfde9d76763c3a8701ec6616db4ab40) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 199?, pitagjr, 0, 0, pitajr, pitajr, driver_device, 0, "VTech", "Pitagorin Junior", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/pk8000.c b/src/mame/drivers/pk8000.c new file mode 100644 index 00000000000..ca833cf9f8e --- /dev/null +++ b/src/mame/drivers/pk8000.c @@ -0,0 +1,413 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + PK-8000 + + 18/07/2009 Mostly working driver + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "imagedev/cassette.h" +#include "formats/fmsx_cas.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "includes/pk8000.h" +#include "machine/ram.h" + + +class pk8000_state : public pk8000_base_state +{ +public: + pk8000_state(const machine_config &mconfig, device_type type, const char *tag) + : pk8000_base_state(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cassette(*this, "cassette") + , m_ram(*this, RAM_TAG) + , m_speaker(*this, "speaker") + , m_region_maincpu(*this, "maincpu") + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_bank4(*this, "bank4") + , m_bank5(*this, "bank5") + , m_bank6(*this, "bank6") + , m_bank7(*this, "bank7") + , m_bank8(*this, "bank8") + , m_io_joy1(*this, "JOY1") + , m_io_joy2(*this, "JOY2") + { } + + UINT8 m_keyboard_line; + DECLARE_READ8_MEMBER(pk8000_joy_1_r); + DECLARE_READ8_MEMBER(pk8000_joy_2_r); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_pk8000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(pk8000_interrupt); + DECLARE_WRITE8_MEMBER(pk8000_80_porta_w); + DECLARE_READ8_MEMBER(pk8000_80_portb_r); + DECLARE_WRITE8_MEMBER(pk8000_80_portc_w); + + IRQ_CALLBACK_MEMBER(pk8000_irq_callback); + +protected: + required_device m_maincpu; + required_device m_cassette; + required_device m_ram; + required_device m_speaker; + required_memory_region m_region_maincpu; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_memory_bank m_bank5; + required_memory_bank m_bank6; + required_memory_bank m_bank7; + required_memory_bank m_bank8; + required_ioport m_io_joy1; + required_ioport m_io_joy2; + ioport_port *m_io_port[10]; + + void pk8000_set_bank(UINT8 data); +}; + + + +void pk8000_state::pk8000_set_bank(UINT8 data) +{ + UINT8 *rom = m_region_maincpu->base(); + UINT8 *ram = m_ram->pointer(); + UINT8 block1 = data & 3; + UINT8 block2 = (data >> 2) & 3; + UINT8 block3 = (data >> 4) & 3; + UINT8 block4 = (data >> 6) & 3; + + switch(block1) { + case 0: + m_bank1->set_base(rom + 0x10000); + m_bank5->set_base(ram); + break; + case 1: break; + case 2: break; + case 3: + m_bank1->set_base(ram); + m_bank5->set_base(ram); + break; + } + + switch(block2) { + case 0: + m_bank2->set_base(rom + 0x14000); + m_bank6->set_base(ram + 0x4000); + break; + case 1: break; + case 2: break; + case 3: + m_bank2->set_base(ram + 0x4000); + m_bank6->set_base(ram + 0x4000); + break; + } + switch(block3) { + case 0: + m_bank3->set_base(rom + 0x18000); + m_bank7->set_base(ram + 0x8000); + break; + case 1: break; + case 2: break; + case 3: + m_bank3->set_base(ram + 0x8000); + m_bank7->set_base(ram + 0x8000); + break; + } + switch(block4) { + case 0: + m_bank4->set_base(rom + 0x1c000); + m_bank8->set_base(ram + 0xc000); + break; + case 1: break; + case 2: break; + case 3: + m_bank4->set_base(ram + 0xc000); + m_bank8->set_base(ram + 0xc000); + break; + } +} +WRITE8_MEMBER(pk8000_state::pk8000_80_porta_w) +{ + pk8000_set_bank(data); +} + +READ8_MEMBER(pk8000_state::pk8000_80_portb_r) +{ + if(m_keyboard_line>9) { + return 0xff; + } + return m_io_port[m_keyboard_line]->read(); +} + +WRITE8_MEMBER(pk8000_state::pk8000_80_portc_w) +{ + m_keyboard_line = data & 0x0f; + + m_speaker->level_w(BIT(data, 7)); + + m_cassette->change_state((BIT(data, 4)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_cassette->output((BIT(data, 6)) ? +1.0 : 0.0); +} + +READ8_MEMBER(pk8000_state::pk8000_joy_1_r) +{ + UINT8 retVal = (m_cassette->input() > 0.0038 ? 0x80 : 0); + retVal |= m_io_joy1->read() & 0x7f; + return retVal; +} +READ8_MEMBER(pk8000_state::pk8000_joy_2_r) +{ + UINT8 retVal = (m_cassette->input() > 0.0038 ? 0x80 : 0); + retVal |= m_io_joy2->read() & 0x7f; + return retVal; +} + +static ADDRESS_MAP_START(pk8000_mem, AS_PROGRAM, 8, pk8000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x3fff ) AM_READ_BANK("bank1") AM_WRITE_BANK("bank5") + AM_RANGE( 0x4000, 0x7fff ) AM_READ_BANK("bank2") AM_WRITE_BANK("bank6") + AM_RANGE( 0x8000, 0xbfff ) AM_READ_BANK("bank3") AM_WRITE_BANK("bank7") + AM_RANGE( 0xc000, 0xffff ) AM_READ_BANK("bank4") AM_WRITE_BANK("bank8") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pk8000_io , AS_IO, 8, pk8000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE(0x84, 0x87) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) + AM_RANGE(0x88, 0x88) AM_READWRITE(pk8000_video_color_r,pk8000_video_color_w) + AM_RANGE(0x8c, 0x8c) AM_READ(pk8000_joy_1_r) + AM_RANGE(0x8d, 0x8d) AM_READ(pk8000_joy_2_r) + AM_RANGE(0x90, 0x90) AM_READWRITE(pk8000_text_start_r,pk8000_text_start_w) + AM_RANGE(0x91, 0x91) AM_READWRITE(pk8000_chargen_start_r,pk8000_chargen_start_w) + AM_RANGE(0x92, 0x92) AM_READWRITE(pk8000_video_start_r,pk8000_video_start_w) + AM_RANGE(0x93, 0x93) AM_READWRITE(pk8000_color_start_r,pk8000_color_start_w) + AM_RANGE(0xa0, 0xbf) AM_READWRITE(pk8000_color_r,pk8000_color_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pk8000 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("|") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rg") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Upr") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graf") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alf") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("???") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("VSh") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sel") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Probel") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cls") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up-Left") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down-Right") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Begin") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End page") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Begin page") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("JOY1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("JOY2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +INTERRUPT_GEN_MEMBER(pk8000_state::pk8000_interrupt) +{ + device.execute().set_input_line(0, HOLD_LINE); +} + +IRQ_CALLBACK_MEMBER(pk8000_state::pk8000_irq_callback) +{ + return 0xff; +} + + +void pk8000_state::machine_start() +{ + static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; + + for ( int i = 0; i < 10; i++ ) + { + m_io_port[i] = ioport(keynames[i]); + } +} + +void pk8000_state::machine_reset() +{ + pk8000_set_bank(0); +} + +void pk8000_state::video_start() +{ +} + +UINT32 pk8000_state::screen_update_pk8000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return pk8000_video_update(screen, bitmap, cliprect, m_ram->pointer()); +} + +static MACHINE_CONFIG_START( pk8000, pk8000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, 1780000) + MCFG_CPU_PROGRAM_MAP(pk8000_mem) + MCFG_CPU_IO_MAP(pk8000_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pk8000_state, pk8000_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pk8000_state,pk8000_irq_callback) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256+32, 192+32) + MCFG_SCREEN_VISIBLE_AREA(0, 256+32-1, 0, 192+32-1) + MCFG_SCREEN_UPDATE_DRIVER(pk8000_state, screen_update_pk8000) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(pk8000_base_state, pk8000) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pk8000_state, pk8000_80_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pk8000_state, pk8000_80_portb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pk8000_state, pk8000_80_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pk8000_base_state, pk8000_84_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pk8000_base_state, pk8000_84_porta_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pk8000_base_state,pk8000_84_portc_w)) + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(fmsx_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( vesta ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "vesta.rom", 0x10000, 0x4000, CRC(fbf7e2cc) SHA1(4bc5873066124bd926c3c6aa2fd1a062c87af339)) +ROM_END + +ROM_START( hobby ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hobby.rom", 0x10000, 0x4000, CRC(a25b4b2c) SHA1(0d86e6e4be8d1aa389bfa9dd79e3604a356729f7)) +ROM_END + +ROM_START( pk8002 ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "pk8002.rom", 0x10000, 0x4000, CRC(07b9ae71) SHA1(2137a41cc095c7aba58b7b109fce63f30a4568b2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, vesta, 0, 0, pk8000, pk8000, driver_device, 0, "BP EVM", "PK8000 Vesta", 0) +COMP( 1987, hobby, vesta, 0, pk8000, pk8000, driver_device, 0, "BP EVM", "PK8000 Sura/Hobby", 0) +COMP( 1987, pk8002, vesta, 0, pk8000, pk8000, driver_device, 0, "", "PK8002 Elf", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/pk8020.c b/src/mame/drivers/pk8020.c new file mode 100644 index 00000000000..1b8e83ef527 --- /dev/null +++ b/src/mame/drivers/pk8020.c @@ -0,0 +1,292 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + PK-8020 driver by Miodrag Milanovic + based on work of Sergey Erokhin from pk8020.narod.ru + + 18/07/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "imagedev/flopdrv.h" +#include "formats/pk8020_dsk.h" +#include "includes/pk8020.h" +#include "machine/ram.h" + +/* Address maps */ +static ADDRESS_MAP_START(pk8020_mem, AS_PROGRAM, 8, pk8020_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pk8020_io , AS_IO, 8, pk8020_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pk8020 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_EQUALS) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STRN") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("IZ") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VZ") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_START("LINE7") + // All keys in this line are reversed logic + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alf") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Graf") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Prf") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Sel") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upr") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OO") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("LINE10") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("LINE11") + PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("LINE12") + PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("LINE13") + PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("LINE14") + PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("LINE15") + PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + + +/* F4 Character Displayer */ +static const gfx_layout pk8020_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 512, /* 512 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( pk8020 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, pk8020_charlayout, 0, 4 ) +GFXDECODE_END + + +FLOPPY_FORMATS_MEMBER( pk8020_state::floppy_formats ) + FLOPPY_PK8020_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( pk8020_floppies ) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + + +/* Machine driver */ +static MACHINE_CONFIG_START( pk8020, pk8020_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, XTAL_20MHz / 8) + MCFG_CPU_PROGRAM_MAP(pk8020_mem) + MCFG_CPU_IO_MAP(pk8020_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pk8020_state, pk8020_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(pk8020_state, screen_update_pk8020) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pk8020) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(pk8020_state, pk8020) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pk8020_state, pk8020_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pk8020_state, pk8020_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pk8020_state, pk8020_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pk8020_state, pk8020_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pk8020_state, pk8020_2_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_3", I8255, 0) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_20MHz / 10) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(pk8020_state,pk8020_pit_out0)) + MCFG_PIT8253_CLK1(XTAL_20MHz / 10) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(pk8020_state,pk8020_pit_out1)) + MCFG_PIT8253_CLK2((XTAL_20MHz / 8) / 164) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir5_w)) + + MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) + MCFG_DEVICE_ADD("rs232", I8251, 0) + MCFG_DEVICE_ADD("lan", I8251, 0) + + MCFG_FD1793_ADD("wd1793", XTAL_20MHz / 20) + + MCFG_FLOPPY_DRIVE_ADD("wd1793:0", pk8020_floppies, "qd", pk8020_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:1", pk8020_floppies, "qd", pk8020_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:2", pk8020_floppies, "qd", pk8020_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:3", pk8020_floppies, "qd", pk8020_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "korvet_flop") + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("258K") //64 + 4*48 + 2 + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( korvet ) + ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS("v11") + ROM_SYSTEM_BIOS(0, "v11", "v1.1") + ROMX_LOAD( "korvet11.rom", 0x10000, 0x6000, CRC(81bdc2af) SHA1(c3484c3f1f3d252475979283c073286b8661d2b9), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v20", "v2.0") + ROMX_LOAD( "korvet20.rom", 0x10000, 0x6000, CRC(d6c36a45) SHA1(dba67e63457251814ad5c0fe6bb6d584eea5c7d2), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "cpm", "cpm") + ROMX_LOAD( "cpm.rom", 0x10000, 0x4000, CRC(7a38d7f6) SHA1(fec6623291a38990b003e818683cd5edfb494c36), ROM_BIOS(3)) + ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_LOAD( "korvet2.fnt", 0x0000, 0x2000, CRC(fb1cd3d4) SHA1(58f1d6e393253b1e8b497ce0880b6eff6d85b42a)) +ROM_END + +ROM_START( neiva ) + ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "neiva_d22.bin", 0x10000, 0x2000, CRC(9cc28f67) SHA1(68f390e846e1290df68419d522088d5325682945)) + ROM_LOAD( "neiva_d23.bin", 0x12000, 0x2000, CRC(31b53dc4) SHA1(607f2a2d8b1de469125c6c02b9ffc65649b753a2)) + ROM_LOAD( "neiva_d24.bin", 0x14000, 0x2000, CRC(d05c80df) SHA1(1ec2fa9983be5579abff7247fc9b98fe50661bd9)) + ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_LOAD( "neiva_d21.bin", 0x0000, 0x2000, CRC(fb1cd3d4) SHA1(58f1d6e393253b1e8b497ce0880b6eff6d85b42a)) +ROM_END + +ROM_START( kontur ) + ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v1", "v1") + ROMX_LOAD( "kontur.rom", 0x10000, 0x2000, CRC(92cd441e) SHA1(9a0f9079256cefc6169ae4ba2114841d1f380480), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "v2") + ROMX_LOAD( "kontur2.rom", 0x10000, 0x2000, CRC(5256d101) SHA1(22022a3c6882dbc5ea28d7815f00c182bbaef9e1), ROM_BIOS(2)) + ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_LOAD( "kontur.fnt", 0x0000, 0x2000, CRC(14d33790) SHA1(6d5fcb214805c5fc44ef98a97219158ff7826ac0)) +ROM_END + +ROM_START( bk8t ) + ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "kor1.bin", 0x10000, 0x2000, CRC(f1e16ddc) SHA1(e3a10c9ce3f333928eb0d5f9b84e159e41fae6ca)) + ROM_LOAD( "kor2.bin", 0x12000, 0x2000, CRC(d4431d97) SHA1(08f79785846369d410a4183f0d60b856d6d70199)) + ROM_LOAD( "kor3.bin", 0x14000, 0x2000, CRC(74781903) SHA1(caaa638afe80eb83fc30b07dd6d1e40b66ddc6d1)) + ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_LOAD( "kor4.bin", 0x0000, 0x2000, CRC(d164bada) SHA1(c334e50fd31b1f42c7668b89772487971a6875cb)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, korvet, 0, 0, pk8020, pk8020, driver_device, 0, "", "PK8020 Korvet", 0) +COMP( 1987, neiva, korvet, 0, pk8020, pk8020, driver_device, 0, "", "PK8020 Neiva", 0) +COMP( 1987, kontur, korvet, 0, pk8020, pk8020, driver_device, 0, "", "PK8020 Kontur", 0) +COMP( 1987, bk8t, korvet, 0, pk8020, pk8020, driver_device, 0, "", "BK-8T", 0) diff --git a/src/mame/drivers/plan80.c b/src/mame/drivers/plan80.c new file mode 100644 index 00000000000..b0a75765ce8 --- /dev/null +++ b/src/mame/drivers/plan80.c @@ -0,0 +1,265 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Plan-80 + + 06/12/2009 Skeleton driver. + + Summary of Monitor commands: + + D - dump memory + F - fill memory + G - go (execute program at address) + I - in from a port and display + M - move? + O - out to a port + S - edit memory + + ToDo: + - fix autorepeat on the keyboard + - Add missing devices + - Picture of unit shows graphics, possibly a PCG + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" + + +class plan80_state : public driver_device +{ +public: + enum + { + TIMER_BOOT + }; + + plan80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_p_videoram(*this, "p_videoram") + { } + + required_device m_maincpu; + DECLARE_READ8_MEMBER(plan80_04_r); + DECLARE_WRITE8_MEMBER(plan80_09_w); + required_shared_ptr m_p_videoram; + const UINT8* m_p_chargen; + UINT8 m_kbd_row; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_DRIVER_INIT(plan80); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +READ8_MEMBER( plan80_state::plan80_04_r ) +{ + UINT8 data = 0xff; + + if (m_kbd_row == 0xfe) + data = ioport("LINE0")->read(); + else + if (m_kbd_row == 0xfd) + data = ioport("LINE1")->read(); + else + if (m_kbd_row == 0xfb) + data = ioport("LINE2")->read(); + else + if (m_kbd_row == 0xf7) + data = ioport("LINE3")->read(); + else + if (m_kbd_row == 0xef) + data = ioport("LINE4")->read(); + + return data; +} + +WRITE8_MEMBER( plan80_state::plan80_09_w ) +{ + m_kbd_row = data; +} + + +static ADDRESS_MAP_START(plan80_mem, AS_PROGRAM, 8, plan80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") + AM_RANGE(0x0800, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("p_videoram") + AM_RANGE(0xf800, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(plan80_io, AS_IO, 8, plan80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x04, 0x04) AM_READ(plan80_04_r) + AM_RANGE(0x09, 0x09) AM_WRITE(plan80_09_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( plan80 ) // Keyboard was worked out by trial & error;'F' keys produce foreign symbols + PORT_START("LINE0") /* FE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A -") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('-') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q ! 1") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('!') PORT_CHAR('1') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F-shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P ?? 0") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('0') + PORT_START("LINE1") /* FD */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Numbers") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X /") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('/') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D =") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('=') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E # 3") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('#') PORT_CHAR('3') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M .") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('.') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K [") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('[') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I ( 8") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('(') PORT_CHAR('8') + PORT_START("LINE2") /* FB */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V ;") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR(';') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G _") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('_') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T % 5") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('%') PORT_CHAR('5') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ?") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H <") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('<') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y & 6") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('&') PORT_CHAR('6') + PORT_START("LINE3") /* F7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C :") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F ^") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R $ 4") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('$') PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N ,") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(',') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J >") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U \' 7") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('\'') PORT_CHAR('7') + PORT_START("LINE4") /* EF */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z *") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S +") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W \" 2") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('\"') PORT_CHAR('2') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L ]") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR(']') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O ) 9") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR(')') PORT_CHAR('9') +INPUT_PORTS_END + + +void plan80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BOOT: + /* after the first 4 bytes have been read from ROM, switch the ram back in */ + membank("boot")->set_entry(0); + break; + default: + assert_always(FALSE, "Unknown id in plan80_state::device_timer"); + } +} + +void plan80_state::machine_reset() +{ + membank("boot")->set_entry(1); + timer_set(attotime::from_usec(10), TIMER_BOOT); +} + +DRIVER_INIT_MEMBER(plan80_state,plan80) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf800); +} + +void plan80_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 plan80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 32; y++) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma+48; x++) + { + chr = m_p_videoram[x]; + gfx = m_p_chargen[(chr << 3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + } + } + ma+=64; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout plan80_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( plan80 ) + GFXDECODE_ENTRY( "chargen", 0x0000, plan80_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( plan80, plan80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, 2048000) + MCFG_CPU_PROGRAM_MAP(plan80_mem) + MCFG_CPU_IO_MAP(plan80_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(plan80_state, screen_update) + MCFG_SCREEN_SIZE(48*6, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 48*6-1, 0, 32*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", plan80) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( plan80 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "pl80mon.bin", 0xf800, 0x0800, CRC(433fb685) SHA1(43d53c35544d3a197ab71b6089328d104535cfa5)) + + ROM_REGION( 0x10000, "spare", 0 ) + ROM_LOAD_OPTIONAL( "pl80mod.bin", 0xf000, 0x0800, CRC(6bdd7136) SHA1(721eab193c33c9330e0817616d3d2b601285fe50)) + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD( "pl80gzn.bin", 0x0000, 0x0800, CRC(b4ddbdb6) SHA1(31bf9cf0f2ed53f48dda29ea830f74cea7b9b9b2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1988, plan80, 0, 0, plan80, plan80, plan80_state, plan80, "Tesla Eltos", "Plan-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/plus4.c b/src/mame/drivers/plus4.c new file mode 100644 index 00000000000..03924846402 --- /dev/null +++ b/src/mame/drivers/plus4.c @@ -0,0 +1,1129 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + TODO: + + - c16 function ROM test fails + - clean up TED + - dump PLA + - T6721 speech chip + +*/ + +#include "includes/plus4.h" +#include "machine/cbm_snqk.h" +#include "sound/t6721a.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define BA15 BIT(offset, 15) +#define BA14 BIT(offset, 14) +#define BA13 BIT(offset, 13) +#define BA12 BIT(offset, 12) +#define BA11 BIT(offset, 11) +#define BA10 BIT(offset, 10) +#define BA9 BIT(offset, 9) +#define BA8 BIT(offset, 8) +#define BA7 BIT(offset, 7) +#define BA6 BIT(offset, 6) +#define BA5 BIT(offset, 5) +#define BA4 BIT(offset, 4) + + + +QUICKLOAD_LOAD_MEMBER( plus4_state, cbm_c16 ) +{ + return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress); +} + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// check_interrupts - +//------------------------------------------------- + +void plus4_state::check_interrupts() +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_ted_irq || m_acia_irq || m_exp_irq); +} + + + +//************************************************************************** +// MEMORY MANAGEMENT +//************************************************************************** + +void plus4_state::bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal) +{ + UINT16 i = ras << 15 | BA10 << 14 | BA11 << 13 | BA13 << 12 | BA9 << 11 | BA8 << 10 | BA14 << 9 | mux << 8 | BA12 << 7 | BA7 << 6 | BA6 << 5 | BA5 << 4 | BA4 << 3 | BA15 << 2 | phi0 << 1 | 1; +/* UINT8 data = m_pla->read(i); + + *scs = BIT(data, 0); + *phi2 = BIT(data, 1); + *user = BIT(data, 2); + *_6551 = BIT(data, 3); + *addr_clk = BIT(data, 4); + *keyport = BIT(data, 5); + *kernal = BIT(data, 6); + *f7 = BIT(data, 7);*/ + + // the following code is on loan from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/plus4/pla.c until we get the PLA dumped + + #define I(b) (!!((i) & (1 << b))) + + #define I0_F7 I(0) + #define PHI0 I(1) + #define A15 I(2) + #define A4 I(3) + #define A5 I(4) + #define A6 I(5) + #define A7 I(6) + #define A12 I(7) + #define MUX I(8) + #define A14 I(9) + #define A8 I(10) + #define A9 I(11) + #define A13 I(12) + #define A11 I(13) + #define A10 I(14) + #define RAS_ I(15) + + /* unused_ 0 when 0111 011x 1001 011x */ + #define F0 RAS_ || !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ + !A12 || A7 || A6 || !A5 || A4 || !A15 || !PHI0 + /* PHI2 1 when 0xxx xxxx xxxx xx11 */ + #define F1 !RAS_ && PHI0 && I0_F7 + /* USER_ 0 when 0111 011x 1000 1111 */ + #define F2 RAS_ || !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ + !A12 || A7 || A6 || A5 || !A4 || !A15 || !PHI0 || !I0_F7 + /* 6551_ 0 when x111 011x 1000 011x */ + #define F3 !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ + !A12 || A7 || A6 || A5 || A4 || !A15 || !PHI0 + /* ADDR_CLK 0 when 1111 011x 1110 1111 */ + #define F4 RAS_ || !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ + !A12 || !A7 || !A6 || A5 || !A4 || !A15 || !PHI0 || !I0_F7 + /* KEYPORT_ 0 when 0111 011x 1001 1111 */ + #define F5 RAS_ || !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ + !A12 || A7 || A6 || !A5 || !A4 || !A15 || !PHI0 || !I0_F7 + /* KERNAL_ 1 when x111 001x 1xxx x1xx */ + #define F6 A10 && A11 && A13 && !A9 && !A8 && A14 && \ + A12 && A15 + /* I0_F7 1 when xxxx xxx1 xxxx xxxx or + when 0xxx xxxx xxxx xx11 */ + #define F7 MUX || (F1) + + *scs = F0; + *phi2 = F1; + *user = F2; + *_6551 = F3; + *addr_clk = F4; + *keyport = F5; + *kernal = F6; +} + + +//------------------------------------------------- +// read_memory - +//------------------------------------------------- + +UINT8 plus4_state::read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal) +{ + int cs0 = 1, cs1 = 1, c1l = 1, c1h = 1, c2l = 1, c2h = 1; + UINT8 data = m_ted->read(space, offset, cs0, cs1); + + //logerror("offset %04x user %u 6551 %u addr_clk %u keyport %u kernal %u cs0 %u cs1 %u\n", offset,user,_6551,addr_clk,keyport,kernal,cs0,cs1); + + if (!scs && m_vslsi) + { + data = m_vslsi->read(space, offset & 0x03); + } + else if (!user) + { + if (m_spi_user) + { + data = m_spi_user->read(space, 0); + } + + data &= ~0x04; + data |= m_cassette->sense_r() << 2; + } + else if (!_6551 && m_acia) + { + data = m_acia->read(space, offset & 0x03); + } + else if (!keyport) + { + data = m_spi_kb->read(space, 0); + } + else if (!cs0) + { + switch (m_addr & 0x03) + { + case CS0_BASIC: + data = m_kernal->base()[offset & 0x7fff]; + break; + + case CS0_FUNCTION_LO: + if (m_function != NULL) + { + data = m_function->base()[offset & 0x7fff]; + } + break; + + case CS0_C1_LOW: + c1l = 0; + break; + + case CS0_C2_LOW: + c2l = 0; + + if (m_c2 != NULL) + { + data = m_c2->base()[offset & 0x7fff]; + } + break; + } + } + else if (!cs1) + { + if (kernal) + { + data = m_kernal->base()[offset & 0x7fff]; + } + else + { + switch ((m_addr >> 2) & 0x03) + { + case CS1_KERNAL: + data = m_kernal->base()[offset & 0x7fff]; + break; + + case CS1_FUNCTION_HI: + if (m_function != NULL) + { + data = m_function->base()[offset & 0x7fff]; + } + break; + + case CS1_C1_HIGH: + c1h = 0; + break; + + case CS1_C2_HIGH: + c2h = 0; + + if (m_c2 != NULL) + { + data = m_c2->base()[offset & 0x7fff]; + } + break; + } + } + } + else if (offset < 0xfd00 || offset >= 0xff20) + { + data = m_ram->pointer()[offset & m_ram->mask()]; + } + + return m_exp->cd_r(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h); +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( plus4_state::read ) +{ + int phi0 = 1, mux = 0, ras = 0, ba = 1; + int scs, phi2, user, _6551, addr_clk, keyport, kernal; + + bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal); + + return read_memory(space, offset, ba, scs, phi2, user, _6551, addr_clk, keyport, kernal); +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( plus4_state::write ) +{ + int scs, phi2, user, _6551, addr_clk, keyport, kernal; + int phi0 = 1, mux = 0, ras = 0, ba = 1; + int cs0 = 1, cs1 = 1, c1l = 1, c1h = 1, c2l = 1, c2h = 1; + + bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal); + + m_ted->write(space, offset, data, cs0, cs1); + + //logerror("write offset %04x data %02x user %u 6551 %u addr_clk %u keyport %u kernal %u cs0 %u cs1 %u\n", offset,data,user,_6551,addr_clk,keyport,kernal,cs0,cs1); + + if (!scs && m_vslsi) + { + m_vslsi->write(space, offset & 0x03, data); + } + else if (!user && m_spi_user) + { + m_spi_user->write(space, 0, data); + } + else if (!_6551 && m_acia) + { + m_acia->write(space, offset & 0x03, data); + } + else if (!addr_clk) + { + m_addr = offset & 0x0f; + } + else if (!keyport) + { + m_spi_kb->write(space, 0, data); + } + else if (offset < 0xfd00 || offset >= 0xff20) + { + m_ram->pointer()[offset & m_ram->mask()] = data; + } + + m_exp->cd_w(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h); +} + + +//------------------------------------------------- +// ted_videoram_r - +//------------------------------------------------- + +READ8_MEMBER( plus4_state::ted_videoram_r ) +{ + int phi0 = 1, mux = 0, ras = 1, ba = 0; + int scs, phi2, user, _6551, addr_clk, keyport, kernal; + + bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal); + + return read_memory(space, offset, ba, scs, phi2, user, _6551, addr_clk, keyport, kernal); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( plus4_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( plus4_mem, AS_PROGRAM, 8, plus4_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( ted_videoram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ted_videoram_map, AS_0, 8, plus4_state ) + AM_RANGE(0x0000, 0xffff) AM_READ(ted_videoram_r) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( plus4 ) +//------------------------------------------------- + +static INPUT_PORTS_START( plus4 ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP f7") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0xA3) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left & Right)") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 \xE2\x86\x91") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(0x2191) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= Pi \xE2\x86\x90") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('=') PORT_CHAR(0x03C0) PORT_CHAR(0x2190) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clear") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START( "LOCK" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( c16 ) +//------------------------------------------------- + +static INPUT_PORTS_START( c16 ) + PORT_INCLUDE( plus4 ) + + PORT_MODIFY( "ROW0" ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(0xA3) + + PORT_MODIFY( "ROW5" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_MODIFY( "ROW6" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= Pi \xE2\x86\x90") PORT_CODE(KEYCODE_PGDN) PORT_CHAR('=') PORT_CHAR(0x03C0) PORT_CHAR(0x2190) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// M6510_INTERFACE( cpu_intf ) +//------------------------------------------------- + +READ8_MEMBER( plus4_state::cpu_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 CST RD + 5 + 6 IEC CLK IN + 7 IEC DATA IN, CST SENSE + + */ + + UINT8 data = 0x2f; + + // cassette read + data |= m_cassette->read() << 4; + + // serial clock + data |= m_iec->clk_r() << 6; + + // serial data, cassette sense + data |= (m_iec->data_r() && m_cassette->sense_r()) << 7; + + return data; +} + +READ8_MEMBER( c16_state::cpu_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 CST RD + 5 + 6 IEC CLK IN + 7 IEC DATA IN + + */ + + UINT8 data = 0; + + // cassette read + data |= m_cassette->read() << 4; + + // serial clock + data |= m_iec->clk_r() << 6; + + // serial data + data |= m_iec->data_r() << 7; + + return data; +} + +WRITE8_MEMBER( plus4_state::cpu_w ) +{ + /* + + bit description + + 0 IEC DATA + 1 IEC CLK, CST WR + 2 IEC ATN + 3 CST MTR + 4 + 5 + 6 (CST WR) + 7 + + */ + + //logerror("%s cpu write %02x\n", machine().describe_context(), data); + + // serial data + m_iec->data_w(!BIT(data, 0)); + + // serial clock + m_iec->clk_w(!BIT(data, 1)); + + // serial attention + m_iec->atn_w(!BIT(data, 2)); + + // cassette motor + m_cassette->motor_w(BIT(data, 3)); + + // cassette write + m_cassette->write(!BIT(data, 1)); +} + + +//------------------------------------------------- +// ted7360_interface ted_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( plus4_state::ted_irq_w ) +{ + m_ted_irq = state; + + check_interrupts(); +} + +READ8_MEMBER( plus4_state::ted_k_r ) +{ + /* + + bit description + + 0 JOY A0, JOY B0 + 1 JOY A1, JOY B1 + 2 JOY A2, JOY B2 + 3 JOY A3, JOY B3 + 4 + 5 + 6 BTN A + 7 BTN B + + */ + + UINT8 data = 0xff; + + // joystick + if (!BIT(offset, 2)) + { + UINT8 joy_a = m_joy1->joy_r(); + + data &= (0xf0 | (joy_a & 0x0f)); + data &= ~(!BIT(joy_a, 5) << 6); + } + + if (!BIT(offset, 1)) + { + UINT8 joy_b = m_joy2->joy_r(); + + data &= (0xf0 | (joy_b & 0x0f)); + data &= ~(!BIT(joy_b, 5) << 7); + } + + // keyboard + if (!BIT(m_kb, 7)) data &= m_row7->read(); + if (!BIT(m_kb, 6)) data &= m_row6->read(); + if (!BIT(m_kb, 5)) data &= m_row5->read(); + if (!BIT(m_kb, 4)) data &= m_row4->read(); + if (!BIT(m_kb, 3)) data &= m_row3->read(); + if (!BIT(m_kb, 2)) data &= m_row2->read(); + if (!BIT(m_kb, 1)) data &= m_row1->read() & m_lock->read(); + if (!BIT(m_kb, 0)) data &= m_row0->read(); + + return data; +} + + + +//------------------------------------------------- +// MOS6551_INTERFACE( acia_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( plus4_state::acia_irq_w ) +{ + m_acia_irq = state; + + check_interrupts(); +} + + +//------------------------------------------------- +// PLUS4_EXPANSION_INTERFACE( expansion_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( plus4_state::exp_irq_w ) +{ + m_exp_irq = state; + + check_interrupts(); +} + + +//------------------------------------------------- +// SLOT_INTERFACE( cbm_datassette_devices ) +//------------------------------------------------- + +SLOT_INTERFACE_START( plus4_datassette_devices ) + SLOT_INTERFACE("c1531", C1531) + SLOT_INTERFACE("diag264", DIAG264_CASSETTE_LOOPBACK) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( plus4 ) +//------------------------------------------------- + +void plus4_state::machine_start() +{ + // initialize memory + UINT8 data = 0xff; + + for (offs_t offset = 0; offset < m_ram->size(); offset++) + { + m_ram->pointer()[offset] = data; + if (!(offset % 64)) data ^= 0xff; + } + + // state saving + save_item(NAME(m_addr)); + save_item(NAME(m_ted_irq)); + save_item(NAME(m_acia_irq)); + save_item(NAME(m_exp_irq)); + save_item(NAME(m_kb)); + + if (m_acia) + { + m_acia->write_cts(0); + } + + m_spi_kb->write_p0(1); + m_spi_kb->write_p1(1); + m_spi_kb->write_p2(1); + m_spi_kb->write_p3(1); + m_spi_kb->write_p4(1); + m_spi_kb->write_p5(1); + m_spi_kb->write_p6(1); + m_spi_kb->write_p7(1); +} + + +void plus4_state::machine_reset() +{ + m_maincpu->reset(); + + m_iec->reset(); + + if (m_acia) + { + m_acia->reset(); + } + + m_exp->reset(); + + if (m_user) + { + m_user->write_3(0); + m_user->write_3(1); + } + + m_addr = 0; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( plus4 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( plus4, plus4_state ) + // basic machine hardware + MCFG_CPU_ADD(MOS7501_TAG, M7501, 0) + MCFG_CPU_PROGRAM_MAP(plus4_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_M7501_PORT_CALLBACKS(READ8(plus4_state, cpu_r), WRITE8(plus4_state, cpu_w)) + MCFG_M7501_PORT_PULLS(0x00, 0xc0) + MCFG_QUANTUM_PERFECT_CPU(MOS7501_TAG) + + // video and sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_MOS7360_ADD(MOS7360_TAG, SCREEN_TAG, MOS7501_TAG, 0, ted_videoram_map, WRITELINE(plus4_state, ted_irq_w), READ8(plus4_state, ted_k_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_PLS100_ADD(PLA_TAG) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, plus4_user_port_cards, NULL) + MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p2)) // cassette sense + MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p3)) + MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p4)) + MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p5)) + MCFG_PET_USER_PORT_8_HANDLER(DEVWRITELINE(MOS6551_TAG, mos6551_device, write_rxc)) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p0)) + MCFG_PET_USER_PORT_C_HANDLER(DEVWRITELINE(MOS6551_TAG, mos6551_device, write_rxd)) + MCFG_PET_USER_PORT_F_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p7)) + MCFG_PET_USER_PORT_H_HANDLER(DEVWRITELINE(MOS6551_TAG, mos6551_device, write_dcd)) MCFG_DEVCB_XOR(1) // TODO: add missing pull up before inverter + MCFG_PET_USER_PORT_J_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p6)) + MCFG_PET_USER_PORT_K_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p1)) + MCFG_PET_USER_PORT_L_HANDLER(DEVWRITELINE(MOS6551_TAG, mos6551_device, write_dsr)) MCFG_DEVCB_XOR(1) // TODO: add missing pull up before inverter + + MCFG_DEVICE_ADD(MOS6551_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_RXC_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) + MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_d)) MCFG_DEVCB_XOR(1) + MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_e)) MCFG_DEVCB_XOR(1) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_m)) + MCFG_MOS6551_IRQ_HANDLER(WRITELINE(plus4_state, acia_irq_w)) + + MCFG_DEVICE_ADD(MOS6529_USER_TAG, MOS6529, 0) + MCFG_MOS6529_P0_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_b)) + MCFG_MOS6529_P1_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_k)) + MCFG_MOS6529_P2_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) + MCFG_MOS6529_P3_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) + MCFG_MOS6529_P4_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) + MCFG_MOS6529_P5_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) + MCFG_MOS6529_P6_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_j)) + MCFG_MOS6529_P7_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_f)) + + MCFG_DEVICE_ADD(MOS6529_KB_TAG, MOS6529, 0) + MCFG_MOS6529_P0_HANDLER(WRITELINE(plus4_state, write_kb0)) + MCFG_MOS6529_P1_HANDLER(WRITELINE(plus4_state, write_kb1)) + MCFG_MOS6529_P2_HANDLER(WRITELINE(plus4_state, write_kb2)) + MCFG_MOS6529_P3_HANDLER(WRITELINE(plus4_state, write_kb3)) + MCFG_MOS6529_P4_HANDLER(WRITELINE(plus4_state, write_kb4)) + MCFG_MOS6529_P5_HANDLER(WRITELINE(plus4_state, write_kb5)) + MCFG_MOS6529_P6_HANDLER(WRITELINE(plus4_state, write_kb6)) + MCFG_MOS6529_P7_HANDLER(WRITELINE(plus4_state, write_kb7)) + + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, plus4_datassette_devices, "c1531", NULL) + + MCFG_CBM_IEC_ADD("c1541") + MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_9)) + + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") + MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, plus4_expansion_cards, NULL) + MCFG_PLUS4_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(plus4_state, exp_irq_w)) + MCFG_PLUS4_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(plus4_state, read)) + MCFG_PLUS4_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(plus4_state, write)) + MCFG_PLUS4_EXPANSION_SLOT_AEC_CALLBACK(INPUTLINE(MOS7501_TAG, INPUT_LINE_HALT)) + + MCFG_QUICKLOAD_ADD("quickload", plus4_state, cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( plus4p ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( plus4p, plus4, c16_state ) + MCFG_DEVICE_MODIFY(MOS7501_TAG) + MCFG_DEVICE_CLOCK(XTAL_17_73447MHz/20) + + MCFG_DEVICE_MODIFY(MOS7360_TAG) + MCFG_DEVICE_CLOCK(XTAL_17_73447MHz/5) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list", "plus4_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "plus4_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "plus4_flop") + MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") + MCFG_SOFTWARE_LIST_FILTER("cass_list", "PAL") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( plus4n ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( plus4n, plus4, c16_state ) + MCFG_DEVICE_MODIFY(MOS7501_TAG) + MCFG_DEVICE_CLOCK(XTAL_14_31818MHz/16) + + MCFG_DEVICE_MODIFY(MOS7360_TAG) + MCFG_DEVICE_CLOCK(XTAL_14_31818MHz/4) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list", "plus4_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "plus4_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "plus4_flop") + MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("cass_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( c16n ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( c16n, plus4n, c16_state ) + MCFG_CPU_MODIFY(MOS7501_TAG) + MCFG_M7501_PORT_CALLBACKS(READ8(c16_state, cpu_r), WRITE8(plus4_state, cpu_w)) + MCFG_M7501_PORT_PULLS(0x00, 0xc0) + + MCFG_DEVICE_REMOVE(MOS6551_TAG) + MCFG_DEVICE_REMOVE(MOS6529_USER_TAG) + MCFG_DEVICE_REMOVE(PET_USER_PORT_TAG) + + MCFG_DEVICE_MODIFY(CBM_IEC_TAG) + MCFG_CBM_IEC_BUS_ATN_CALLBACK(NULL) + + MCFG_DEVICE_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("64K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( c16p ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED_CLASS( c16p, plus4p, c16_state ) + MCFG_CPU_MODIFY(MOS7501_TAG) + MCFG_M7501_PORT_CALLBACKS(READ8(c16_state, cpu_r), WRITE8(plus4_state, cpu_w)) + MCFG_M7501_PORT_PULLS(0x00, 0xc0) + + MCFG_DEVICE_REMOVE(MOS6551_TAG) + MCFG_DEVICE_REMOVE(MOS6529_USER_TAG) + MCFG_DEVICE_REMOVE(PET_USER_PORT_TAG) + + MCFG_DEVICE_MODIFY(CBM_IEC_TAG) + MCFG_CBM_IEC_BUS_ATN_CALLBACK(NULL) + + MCFG_DEVICE_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("64K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( c232 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( c232, c16p ) + MCFG_DEVICE_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( v364 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( v364, plus4n ) + MCFG_SOUND_ADD(T6721A_TAG, T6721A, XTAL_640kHz) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_MOS8706_ADD(MOS8706_TAG, XTAL_14_31818MHz/16) +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( c264 ) +//------------------------------------------------- + +ROM_START( c264 ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_LOAD( "basic-264.bin", 0x0000, 0x4000, CRC(6a2fc8e3) SHA1(473fce23afa07000cdca899fbcffd6961b36a8a0) ) + ROM_LOAD( "kernal-264.bin", 0x4000, 0x4000, CRC(8f32abe7) SHA1(d481faf5fcbb331878dc7851c642d04f26a32873) ) + + ROM_REGION( 0x8000, "function", ROMREGION_ERASE00 ) + // TODO: add cart slots to mount EPROMs here + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02", 0x00, 0xf5, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( c232 ) +//------------------------------------------------- + +ROM_START( c232 ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_LOAD( "318006-01.u4", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) + ROM_LOAD( "318004-01.u5", 0x4000, 0x4000, CRC(dbdc3319) SHA1(3c77caf72914c1c0a0875b3a7f6935cd30c54201) ) + + ROM_REGION( 0x8000, "function", ROMREGION_ERASE00 ) + // TODO: add cart slots to mount EPROMs here + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02.u7", 0x00, 0xf5, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( v364 ) +//------------------------------------------------- + +ROM_START( v364 ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_LOAD( "318006-01", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) + ROM_LOAD( "kern364p", 0x4000, 0x4000, CRC(84fd4f7a) SHA1(b9a5b5dacd57ca117ef0b3af29e91998bf4d7e5f) ) + + ROM_REGION( 0x8000, "function", 0 ) + ROM_LOAD( "317053-01", 0x0000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) + ROM_LOAD( "317054-01", 0x4000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) + + ROM_REGION( 0x8000, "c2", 0 ) + ROM_LOAD( "spk3cc4.bin", 0x0000, 0x4000, CRC(5227c2ee) SHA1(59af401cbb2194f689898271c6e8aafa28a7af11) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02", 0x00, 0xf5, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( plus4 ) +//------------------------------------------------- + +ROM_START( plus4 ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_DEFAULT_BIOS("r5") + ROM_SYSTEM_BIOS( 0, "r4", "Revision 4" ) + ROMX_LOAD( "318005-04.u24", 0x4000, 0x4000, CRC(799a633d) SHA1(5df52c693387c0e2b5d682613a3b5a65477311cf), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r5", "Revision 5" ) + ROMX_LOAD( "318005-05.u24", 0x4000, 0x4000, CRC(70295038) SHA1(a3d9e5be091b98de39a046ab167fb7632d053682), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "jiffydos", "JiffyDOS v6.01" ) + ROMX_LOAD( "jiffydos plus4.u24", 0x0000, 0x8000, CRC(818d3f45) SHA1(9bc1b1c3da9ca642deae717905f990d8e36e6c3b), ROM_BIOS(3) ) // first half contains R5 kernal + + ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) + + ROM_REGION( 0x8000, "function", 0 ) + ROM_LOAD( "317053-01.u25", 0x0000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) + ROM_LOAD( "317054-01.u26", 0x4000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02.u19", 0x00, 0xf5, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( plus4p ) +//------------------------------------------------- + +ROM_START( plus4p ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) + + ROM_DEFAULT_BIOS("r5") + ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) + ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) + ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) + ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) + + ROM_REGION( 0x8000, "function", 0 ) + ROM_LOAD( "317053-01.u25", 0x0000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) + ROM_LOAD( "317054-01.u26", 0x4000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02.u19", 0x00, 0xf5, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( c16 ) +//------------------------------------------------- + +ROM_START( c16 ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_DEFAULT_BIOS("r5") + ROM_SYSTEM_BIOS( 0, "r4", "Revision 4" ) + ROMX_LOAD( "318005-04.u24", 0x4000, 0x4000, CRC(799a633d) SHA1(5df52c693387c0e2b5d682613a3b5a65477311cf), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r5", "Revision 5" ) + ROMX_LOAD( "318005-05.u24", 0x4000, 0x4000, CRC(70295038) SHA1(a3d9e5be091b98de39a046ab167fb7632d053682), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "jiffydos", "JiffyDOS v6.01" ) + ROMX_LOAD( "jiffydos plus4.u24", 0x0000, 0x8000, CRC(818d3f45) SHA1(9bc1b1c3da9ca642deae717905f990d8e36e6c3b), ROM_BIOS(3) ) // first half contains R5 kernal + + ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02.u19", 0x00, 0xf5, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( c16p ) +//------------------------------------------------- + +ROM_START( c16p ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) + + ROM_DEFAULT_BIOS("r5") + ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) + ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) + ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) + ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02.u16", 0x00, 0xf5, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( c16_hu ) +//------------------------------------------------- + +ROM_START( c16_hu ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) + + ROM_DEFAULT_BIOS("r2") + ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) + ROMX_LOAD( "318030-01.u4", 0x4000, 0x4000, NO_DUMP, ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) + ROMX_LOAD( "318030-02.u4", 0x4000, 0x4000, CRC(775f60c5) SHA1(20cf3c4bf6c54ef09799af41887218933f2e27ee), ROM_BIOS(2) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02.u16", 0x00, 0xf5, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( c116 ) +//------------------------------------------------- + +ROM_START( c116 ) + ROM_REGION( 0x8000, "kernal", 0 ) + ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) + + ROM_DEFAULT_BIOS("r5") + ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) + ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) + ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) + ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) + + ROM_REGION( 0xf5, PLA_TAG, 0 ) + ROM_LOAD( "251641-02.u101", 0x00, 0xf5, NO_DUMP ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1984, c264, 0, 0, plus4n, plus4, driver_device, 0, "Commodore Business Machines", "Commodore 264 (Prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +COMP( 1984, c232, c264, 0, c232, plus4, driver_device, 0, "Commodore Business Machines", "Commodore 232 (Prototype)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, v364, c264, 0, v364, plus4, driver_device, 0, "Commodore Business Machines", "Commodore V364 (Prototype)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, plus4, c264, 0, plus4n, plus4, driver_device, 0, "Commodore Business Machines", "Plus/4 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, plus4p, c264, 0, plus4p, plus4, driver_device, 0, "Commodore Business Machines", "Plus/4 (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, c16, c264, 0, c16n, c16, driver_device, 0, "Commodore Business Machines", "Commodore 16 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, c16p, c264, 0, c16p, c16, driver_device, 0, "Commodore Business Machines", "Commodore 16 (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, c16_hu, c264, 0, c16p, c16, driver_device, 0, "Commodore Business Machines", "Commodore 16 (Hungary)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, c116, c264, 0, c16p, c16, driver_device, 0, "Commodore Business Machines", "Commodore 116", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pm68k.c b/src/mame/drivers/pm68k.c new file mode 100644 index 00000000000..8aac2f9f853 --- /dev/null +++ b/src/mame/drivers/pm68k.c @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Callan PM68K Unix mainframe. + +2013-09-04 Skeleton driver + +Status: Boots into monitor, some commands work, some freeze. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class pm68k_state : public driver_device +{ +public: + pm68k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_base(*this, "rambase"), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ16_MEMBER(keyin_r); + DECLARE_READ16_MEMBER(status_r); +private: + UINT8 m_term_data; + virtual void machine_reset(); + required_shared_ptr m_p_base; + required_device m_maincpu; + required_device m_terminal; +}; + +READ16_MEMBER( pm68k_state::keyin_r ) +{ + UINT16 ret = m_term_data; + m_term_data = 0; + return ret << 8; +} + +READ16_MEMBER( pm68k_state::status_r ) +{ + return (m_term_data) ? 0x500 : 0x400; +} + + +static ADDRESS_MAP_START(pm68k_mem, AS_PROGRAM, 16, pm68k_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xffffff) + AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("rambase") + AM_RANGE(0x200000, 0x205fff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x600000, 0x600001) AM_READ(keyin_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff00) + AM_RANGE(0x600002, 0x600003) AM_READ(status_r) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( pm68k ) +INPUT_PORTS_END + + +void pm68k_state::machine_reset() +{ + UINT8* ROM = memregion("maincpu")->base(); + memcpy(m_p_base, ROM, 8); + m_maincpu->reset(); +} + +WRITE8_MEMBER( pm68k_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( pm68k, pm68k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 8000000) + MCFG_CPU_PROGRAM_MAP(pm68k_mem) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(pm68k_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pm68k ) + ROM_REGION16_BE(0x6000, "maincpu", 0) + ROM_LOAD16_BYTE("u103", 0x00000, 0x1000, CRC(86d32d6c) SHA1(ce9c54b62c64c37ae9106fb06b8a2b2152d1ddf6) ) + ROM_LOAD16_BYTE("u101", 0x00001, 0x1000, CRC(66607e54) SHA1(06f380fdeba13dc3aee826dd166f4bd3031febb9) ) + ROM_LOAD16_BYTE("u104", 0x02000, 0x2000, CRC(ccd2ba4d) SHA1(5cdcf875e136aa9af5f150e0102cd209c496885e) ) + ROM_LOAD16_BYTE("u102", 0x02001, 0x2000, CRC(48182abd) SHA1(a6e4fb62c5f04cb397c6c3294723ec1f7bc3b680) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, pm68k, 0, 0, pm68k, pm68k, driver_device, 0, "Callan Data Systems", "PM68K", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/pmd85.c b/src/mame/drivers/pmd85.c new file mode 100644 index 00000000000..ce1189c9592 --- /dev/null +++ b/src/mame/drivers/pmd85.c @@ -0,0 +1,813 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/******************************************************************************* + +PMD-85 driver by Krzysztof Strzecha + +What's new: +----------- + +27.06.2004 Mato crash fixed. +21.05.2004 V.24 / Tape switch added. V.24 is not emulated. +25.04.2004 PMD-85.1 tape emulation with support for .pmd format files added. +19.04.2004 Verified PMD-85.1 and PMD-85.2 monitor roms and replaced with + unmodified ones. + Memory system cleanups. +03.04.2004 PMD-85.3 and Mato (PMD-85.2 clone) drivers. + Preliminary and not working tape support. + Reset key fixed. PMD-85.1 fixed. +15.03.2004 Added drivers for: PMD-85.2, PMD-85.2A, PMD-85.2B and Didaktik + Alfa (PMD-85.1 clone). Keyboard finished. Natural keyboard added. + Memory system rewritten. I/O system rewritten. Support for Basic + ROM module added. Video emulation rewritten. +30.11.2002 Memory mapping improved. +06.07.2002 Preliminary driver. + +Notes on emulation status and to do list: +----------------------------------------- + +1. V.24. +2. Tape emulation for other machines than PMD-85.1. +3. Flash video attribute. +4. External interfaces connectors (K2-K5). +5. Speaker. +6. Verify PMD-85.2A, PMD-85.3, Didaktik Alfa and Mato monitor roms. +7. Verify all Basic roms. +8. 8251 in Didaktik Alfa. +9. Colors (if any). +10. PMD-85, Didaktik Alfa 2 and Didaktik Beta (ROMs and documentation needed). +11. FDD interface (ROMs and disk images needed). +12. "Duch & Pampuch" Mato game displays scores with incorrect characters. + +PMD-85 technical information +============================ + +Memory map: +----------- + + PMD-85.1, PMD-85.2 + ------------------ + + start-up map (cleared by the first I/O write operation done by the CPU): + 0000-0fff ROM mirror #1 + 1000-1fff not mapped + 2000-2fff ROM mirror #2 + 3000-3fff not mapped + 4000-7fff Video RAM mirror #1 + 8000-8fff ROM + 9000-9fff not mapped + a000-afff ROM mirror #3 + b000-bfff not mapped + c000-ffff Video RAM + + normal map: + 0000-7fff RAM + 8000-8fff ROM + 9000-9fff not mapped + a000-afff ROM mirror #1 + b000-bfff not mapped + c000-ffff Video RAM + + Didaktik Alfa (PMD-85.1 clone) + ------------------------------ + + start-up map (cleared by the first I/O write operation done by the CPU): + 0000-0fff ROM mirror + 1000-33ff BASIC mirror + 3400-3fff not mapped + 4000-7fff Video RAM mirror + 8000-8fff ROM + 9000-b3ff BASIC + b400-bfff not mapped + c000-ffff Video RAM + + normal map: + 0000-7fff RAM + 8000-8fff ROM + 9000-b3ff BASIC + b400-bfff not mapped + c000-ffff Video RAM + + PMD-85.2A, PMD-85.2B + -------------------- + + start-up map (cleared by the first I/O write operation done by the CPU): + 0000-0fff ROM mirror #1 + 1000-1fff RAM #2 mirror + 2000-2fff ROM mirror #2 + 3000-3fff RAM #3 mirror + 4000-7fff Video RAM mirror #1 + 8000-8fff ROM + 9000-9fff RAM #2 + a000-afff ROM mirror #3 + b000-bfff RAM #3 + c000-ffff Video RAM + + normal map: + 0000-7fff RAM #1 + 8000-8fff ROM + 9000-9fff RAM #2 + a000-afff ROM mirror #1 + b000-bfff RAM #3 + c000-ffff Video RAM + + PMD-85.3 + -------- + + start-up map (cleared by the first I/O write operation done by the CPU): + 0000-1fff ROM mirror #1 read, RAM write + 2000-3fff ROM mirror #2 read, RAM write + 4000-5fff ROM mirror #3 read, RAM write + 6000-7fff ROM mirror #4 read, RAM write + 8000-9fff ROM mirror #5 read, RAM write + a000-bfff ROM mirror #6 read, RAM write + c000-dfff ROM mirror #7 read, Video RAM #1 write + e000-ffff ROM, Video RAM #2 write + + normal map: + 0000-bfff RAM + c000-dfff Video RAM #1 + e000-ffff Video RAM #2 / ROM read, Video RAM #2 write + + Mato + ---- + + start-up map (cleared by the first I/O write operation done by the CPU): + 0000-3fff ROM mirror #1 + 4000-7fff Video RAM mirror #1 + 8000-bfff ROM + c000-ffff Video RAM + + normal map: + 0000-7fff RAM + 8000-bfff ROM + c000-ffff Video RAM + +I/O ports +--------- + + I/O board + --------- + 1xxx11aa external interfaces connector (K2) + + 0xxx11aa I/O board interfaces + 000111aa 8251 (casette recorder, V24) + 010011aa 8255 (GPIO/0, GPIO/1) + 010111aa 8253 + 011111aa 8255 (IMS-2) + I/O board is not supported by Mato. + + Motherboard + ----------- + 1xxx01aa 8255 (keyboard, speaker, LEDs) + PMD-85.3 memory banking + Mato cassette recorder + + ROM Module + ---------- + 1xxx10aa 8255 (ROM reading) + ROM module is not supported by Didaktik Alfa and Mato. + + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "includes/pmd85.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/i8251.h" +#include "formats/pmd_cas.h" +#include "machine/ram.h" + + +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +UINT32 pmd85_state::screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int y = 0; y < 256; y++) + { + // address of current line in PMD-85 video memory + UINT8 *line = m_ram->pointer() + 0xc000 + 0x40 * y; + + for (int x = 0; x < 288/6; x++) + { + int pen = BIT(line[x], 7) ? 1 : 2; + + bitmap.pix16(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; + bitmap.pix16(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; + bitmap.pix16(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; + bitmap.pix16(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; + bitmap.pix16(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; + bitmap.pix16(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; + } + + } + + return 0; +} + + +/* I/O ports */ + +static ADDRESS_MAP_START( pmd85_io_map, AS_IO, 8, pmd85_state ) + AM_RANGE( 0x00, 0xff) AM_READWRITE(pmd85_io_r, pmd85_io_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mato_io_map, AS_IO, 8, pmd85_state ) + AM_RANGE( 0x00, 0xff) AM_READWRITE(mato_io_r, mato_io_w ) +ADDRESS_MAP_END + +/* memory w/r functions */ + +static ADDRESS_MAP_START( pmd85_mem , AS_PROGRAM, 8, pmd85_state ) + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") + AM_RANGE(0x1000, 0x1fff) AM_RAMBANK("bank2") + AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") + AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank5") + AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bank6") + AM_RANGE(0x9000, 0x9fff) AM_NOP + AM_RANGE(0xa000, 0xafff) AM_READ_BANK("bank7") + AM_RANGE(0xb000, 0xbfff) AM_NOP + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank8") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pmd852a_mem , AS_PROGRAM, 8, pmd85_state ) + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") + AM_RANGE(0x1000, 0x1fff) AM_RAMBANK("bank2") + AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") + AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank5") + AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bank6") + AM_RANGE(0x9000, 0x9fff) AM_RAMBANK("bank7") + AM_RANGE(0xa000, 0xafff) AM_READ_BANK("bank8") + AM_RANGE(0xb000, 0xbfff) AM_RAMBANK("bank9") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank10") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pmd853_mem , AS_PROGRAM, 8, pmd85_state ) + AM_RANGE(0x0000, 0x1fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank9") + AM_RANGE(0x2000, 0x3fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank10") + AM_RANGE(0x4000, 0x5fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank11") + AM_RANGE(0x6000, 0x7fff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank12") + AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank13") + AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank14") + AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank7") AM_WRITE_BANK("bank15") + AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank16") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( alfa_mem , AS_PROGRAM, 8, pmd85_state ) + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") + AM_RANGE(0x1000, 0x33ff) AM_RAMBANK("bank2") + AM_RANGE(0x3400, 0x3fff) AM_RAMBANK("bank3") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank4") + AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bank5") + AM_RANGE(0x9000, 0xb3ff) AM_READ_BANK("bank6") + AM_RANGE(0xb400, 0xbfff) AM_NOP + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank7") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mato_mem , AS_PROGRAM, 8, pmd85_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( c2717_mem , AS_PROGRAM, 8, pmd85_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +/* keyboard input */ + +static INPUT_PORTS_START( pmd85 ) + PORT_START("KEY0") /* port 0x00 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K0") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY1") /* port 0x01 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY2") /* port 0x02 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY3") /* port 0x03 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY4") /* port 0x04 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY5") /* port 0x05 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY6") /* port 0x06 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY7") /* port 0x07 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY8") /* port 0x08 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY9") /* port 0x09 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY10") /* port 0x0a */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY11") /* port 0x0b */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('{') PORT_CHAR('}') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY12") /* port 0x0c */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("WRK") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS PTL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<-") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<-") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY13") /* port 0x0d */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C-D") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("^\\") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("END") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL1") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY14") /* port 0x0e */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RCL") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("->") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("->|") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL2") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY15") /* port 0x0f */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("RESET") /* port 0x10 */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_CHANGED_MEMBER(DEVICE_SELF, pmd85_state, pmd85_reset, 0) + + PORT_START("DSW0") /* port 0x11 */ + PORT_CONFNAME( 0x01, 0x00, "Basic ROM Module" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + PORT_CONFNAME( 0x02, 0x00, "Tape/V.24" ) + PORT_CONFSETTING( 0x00, "Tape" ) + PORT_CONFSETTING( 0x02, "V.24" ) +INPUT_PORTS_END + + +static INPUT_PORTS_START( alfa ) + PORT_INCLUDE( pmd85 ) + + PORT_MODIFY( "DSW0" ) + PORT_BIT( 0x01, 0x00, IPT_UNUSED ) +INPUT_PORTS_END + + +static INPUT_PORTS_START (mato) + PORT_START("KEY0") /* port 0x00 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("KEY1") /* port 0x01 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("KEY2") /* port 0x02 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("KEY3") /* port 0x03 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("KEY4") /* port 0x04 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('_') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("KEY5") /* port 0x05 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("KEY6") /* port 0x06 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("KEY7") /* port 0x07 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_START("KEY8") /* port 0x08 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Continue") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("RESET") /* port 0x09 */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_CHANGED_MEMBER(DEVICE_SELF, pmd85_state, pmd85_reset, 0) +INPUT_PORTS_END + + + +static const struct CassetteOptions pmd85_cassette_options = +{ + 1, /* channels */ + 16, /* bits per sample */ + 7200 /* sample frequency */ +}; + +/* machine definition */ +static MACHINE_CONFIG_START( pmd85, pmd85_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2000000) /* 2.048MHz ??? */ + MCFG_CPU_PROGRAM_MAP(pmd85_mem) + MCFG_CPU_IO_MAP(pmd85_io_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + +/******************************************************************************* + + I/O board 8253 + -------------- + + Timer 0: + OUT0 - external interfaces connector (K2) + CLK0 - external interfaces connector (K2) + GATE0 - external interfaces connector (K2), default = 1 + Timer 1: + OUT1 - external interfaces connector (K2), i8251 (for V24 only) + CLK1 - hardwired to 2 MHz system clock + GATE1 - external interfaces connector (K2), default = 1 + Timer 2: + OUT2 - unused + CLK2 - hardwired to 1HZ signal generator + GATE2 - hardwired to 5V, default = 1 + +*******************************************************************************/ + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(0) + MCFG_PIT8253_CLK1(2000000) + MCFG_PIT8253_CLK2(1) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_SCREEN_SIZE(288, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 288-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(pmd85_state, screen_update_pmd85) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cassette */ + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(pmd85_cassette_formats) + MCFG_CASSETTE_CREATE_OPTS(&pmd85_cassette_options) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("pmd85_cass") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list", "pmd85_cass") + + /* uart */ + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(pmd85_state, write_cas_tx)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pmd851, pmd85 ) + + MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_0_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_0_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_0_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_0_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_0_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_0_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_1_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_1_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_1_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_1_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_1_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_1_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_2_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_2_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_2_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_2_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_2_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_2_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_3", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_3_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_3_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_3_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_3_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_3_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_3_portc_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pmd852a, pmd851 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pmd852a_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pmd853, pmd851 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pmd853_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( alfa, pmd85 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(alfa_mem) + + MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_0_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_0_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_0_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_0_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_0_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_0_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_1_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_1_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_1_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_1_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_1_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_1_portc_w)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_2_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_2_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_2_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_2_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_2_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_2_portc_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mato, pmd85 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(mato_mem) + MCFG_CPU_IO_MAP(mato_io_map) + + MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_0_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_0_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, mato_ppi_0_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_0_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, mato_ppi_0_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, mato_ppi_0_portc_w)) + + /* no uart */ + MCFG_DEVICE_REMOVE("uart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( c2717, pmd851 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(c2717_mem) +MACHINE_CONFIG_END + + +ROM_START(pmd851) + ROM_REGION(0x11000,"maincpu",0) + ROM_LOAD("pmd85-1.bin", 0x10000, 0x1000, CRC(ef50b416) SHA1(afa3ec0d03228adc5287a4cba905ce7ad0497dff)) + ROM_REGION(0x2400,"user1",0) + ROM_LOAD_OPTIONAL("pmd85-1.bas", 0x0000, 0x2400, CRC(4fc37d45) SHA1(3bd0f92f37a3f2ee539916dc75508bda37433a72)) +ROM_END + +ROM_START(pmd852) + ROM_REGION(0x11000,"maincpu",0) + ROM_LOAD("pmd85-2.bin", 0x10000, 0x1000, CRC(d4786f63) SHA1(6facdf37bb012714244b012a0c4bd715a956e42b)) + ROM_REGION(0x2400,"user1",0) + ROM_LOAD_OPTIONAL("pmd85-2.bas", 0x0000, 0x2400, CRC(fc4a3ebf) SHA1(3bfc0e9a5cd5187da573b5d539d7246358125a88)) +ROM_END + +ROM_START(pmd852a) + ROM_REGION(0x11000,"maincpu",0) + ROM_LOAD("pmd85-2a.bin", 0x10000, 0x1000, CRC(5a9a961b) SHA1(7363341596367d08b9a98767c6585ce18dfd03af)) + ROM_REGION(0x2400,"user1",0) + ROM_LOAD_OPTIONAL("pmd85-2a.bas", 0x0000, 0x2400, CRC(6ff379ad) SHA1(edcaf2420cac9771596ead5c86c41116b228eca3)) +ROM_END + +ROM_START(pmd852b) + ROM_REGION(0x11000,"maincpu",0) + ROM_LOAD("pmd85-2a.bin", 0x10000, 0x1000, CRC(5a9a961b) SHA1(7363341596367d08b9a98767c6585ce18dfd03af)) + ROM_REGION(0x2400,"user1",0) + ROM_LOAD_OPTIONAL("pmd85-2a.bas", 0x0000, 0x2400, CRC(6ff379ad) SHA1(edcaf2420cac9771596ead5c86c41116b228eca3)) +ROM_END + +ROM_START(pmd853) + ROM_REGION(0x12000,"maincpu",0) + ROM_LOAD("pmd85-3.bin", 0x10000, 0x2000, CRC(83e22c47) SHA1(5f131e27ae3ec8907adbe5cd228c67d131066084)) + ROM_REGION(0x2800,"user1",0) + ROM_LOAD_OPTIONAL("pmd85-3.bas", 0x0000, 0x2800, CRC(1e30e91d) SHA1(d086040abf4c0a7e5da8cf4db7d1668a1d9309a4)) +ROM_END + +ROM_START(alfa) + ROM_REGION(0x13400,"maincpu",0) + ROM_LOAD("alfa.bin", 0x10000, 0x1000, CRC(e425eedb) SHA1(db93b5de1e16b5ae71be08feb083a2ac15759495)) + ROM_LOAD("alfa.bas", 0x11000, 0x2400, CRC(9a73bfd2) SHA1(74314d989846f64e715f64deb84cb177fa62f4a9)) +ROM_END + +ROM_START(mato) + ROM_REGION(0x14000,"maincpu",0) + ROM_SYSTEM_BIOS(0, "default", "BASIC") + ROMX_LOAD("mato.bin", 0x10000, 0x4000, CRC(574110a6) SHA1(4ff2cd4b07a1a700c55f92e5b381c04f758fb461), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "ru", "Russian") + ROMX_LOAD("mato-ru.rom", 0x10000, 0x4000, CRC(44b68be4) SHA1(0d9ea9a9380e2af011a2f0b64c534dd0eb0a1fac), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "lan", "BASIC LAN") + ROMX_LOAD("mato-lan.rom", 0x10000, 0x4000, CRC(422cddde) SHA1(2a3dacf8e3e7637109c9d267f589a00881e9a5f4), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "games", "Games v1") + ROMX_LOAD("matoh.bin", 0x10000, 0x4000, CRC(ca25880d) SHA1(38ce0b6a26d48a09fdf96863c3eaf3705aca2590), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "gamesen", "Games v2 EN") + ROMX_LOAD("matogmen.rom", 0x10000, 0x4000, CRC(47e039c8) SHA1(6cc73a6b58921b33691d2751dee28428456eb222), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "gamessk", "Games v2 SK") + ROMX_LOAD("matogmsk.rom", 0x10000, 0x4000, CRC(d0c9b1e7) SHA1(9e7289d971a957bf161c317e5fa76db3289ee23c), ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "games3", "Games v3") + ROMX_LOAD("matogm3.rom", 0x10000, 0x4000, CRC(9352f2c1) SHA1(b3e45c56d2800c69a0bb02febda6fa715f1afbc3), ROM_BIOS(7)) +ROM_END + +ROM_START(c2717) + ROM_REGION(0x14000,"maincpu",0) + ROM_LOAD("c2717.rom", 0x10000, 0x4000, CRC(da1703b1) SHA1(9fb93e6cae8b551064c7175bf3b4e3113429ce73)) +ROM_END + +ROM_START(c2717pmd) + ROM_REGION(0x14000,"maincpu",0) + ROM_LOAD( "c2717-pmd32.rom", 0x10000, 0x4000, CRC(cbdd323c) SHA1(ee9fea11be8bd4f945c583b0ae5684269906d0ce)) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1985, pmd851, 0, 0, pmd851, pmd85, pmd85_state, pmd851, "Tesla", "PMD-85.1" , 0) +COMP( 1985, pmd852, pmd851, 0, pmd851, pmd85, pmd85_state, pmd851, "Tesla", "PMD-85.2" , 0) +COMP( 1985, pmd852a, pmd851, 0, pmd852a, pmd85, pmd85_state, pmd852a, "Tesla", "PMD-85.2A" , 0) +COMP( 1985, pmd852b, pmd851, 0, pmd852a, pmd85, pmd85_state, pmd852a, "Tesla", "PMD-85.2B" , 0) +COMP( 1988, pmd853, pmd851, 0, pmd853, pmd85, pmd85_state, pmd853, "Tesla", "PMD-85.3" , 0) +COMP( 1986, alfa, pmd851, 0, alfa, alfa, pmd85_state, alfa, "Didaktik Skalica", "Didaktik Alfa" , 0) +COMP( 1985, mato, pmd851, 0, mato, mato, pmd85_state, mato, "Statny", "Mato" , 0) +COMP( 1989, c2717, pmd851, 0, c2717, pmd85, pmd85_state, c2717, "Zbrojovka Brno", "Consul 2717" , 0) +COMP( 1989, c2717pmd,pmd851, 0, c2717, pmd85, pmd85_state, c2717, "Zbrojovka Brno", "Consul 2717 (with PMD-32)" , MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/pmi80.c b/src/mame/drivers/pmi80.c new file mode 100644 index 00000000000..8c41f5cd083 --- /dev/null +++ b/src/mame/drivers/pmi80.c @@ -0,0 +1,175 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Tesla PMI-80 + + 12/05/2009 Skeleton driver. + 20/06/2011 Made mostly working [Robbbert] + + +ToDo: +- cassette +- keyboard to be finished +- artwork + + +Notes: +- Keyboard consists of 16 black hex keys, and 9 blue function keys +- The hex keys are 0 through 9, A through F on our keyboard +- The function keys are mostly not worked out although I've guessed a few +- The function key labels are RE, I, EX, R, BR, M, L, S, = +- The letter M shows as an inverted U in the display +- Turn it on, it says ''PMI -80'' +- Press any key, it shows a ? at the left +- Press the function key corresponding to what you want to do +- Press the numbers to select an address or whatever +- For example, press M then enter an address, press =, enter data, + press = to increment to next address or to scan through them. +- As for the rest, no idea +- In the layout, there is a 10th digit. It is disabled but if you + enable it (by renaming 'digitx' to 'digit9'), it will display + things. Perhaps it connected to discrete LEDs or output lines. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "pmi80.lh" + +class pmi80_state : public driver_device +{ +public: + pmi80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_ledready(0) + , m_maincpu(*this, "maincpu") + { } + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(keyboard_w); + DECLARE_WRITE8_MEMBER(leds_w); +private: + UINT8 m_keyrow; + bool m_ledready; + virtual void machine_reset(); + required_device m_maincpu; +}; + + +READ8_MEMBER( pmi80_state::keyboard_r) +{ + char kbdrow[6]; + sprintf(kbdrow,"%X",m_keyrow); + return ioport(kbdrow)->read(); +} + +WRITE8_MEMBER( pmi80_state::keyboard_w ) +{ + m_keyrow = data; + m_ledready = TRUE; +} + +WRITE8_MEMBER( pmi80_state::leds_w ) +{ + if (m_ledready) + { + m_ledready = FALSE; + output_set_digit_value(m_keyrow^0xff, data^0xff); + } +} + +static ADDRESS_MAP_START(pmi80_mem, AS_PROGRAM, 8, pmi80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x03ff ) AM_ROM + AM_RANGE( 0x0400, 0x1fff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pmi80_io, AS_IO, 8, pmi80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf8, 0xf8) AM_WRITE(leds_w) + AM_RANGE(0xfa, 0xfa) AM_READWRITE(keyboard_r,keyboard_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pmi80 ) + PORT_START("F6") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) // does nothing + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_Q) // unknown + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) // same as '2' + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("F7") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("F8") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_W) // unknown + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("F9") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_R) // unknown + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B BC") PORT_CODE(KEYCODE_B) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 HL") PORT_CODE(KEYCODE_9) + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("FA") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) // memory mode + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("FB") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BR") PORT_CODE(KEYCODE_B) // b mode? + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DE") PORT_CODE(KEYCODE_D) + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("FC") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_T) // unknown + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_Y) // unknown + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EX") PORT_CODE(KEYCODE_G) // Go? + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("FD") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) // Load tape? + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A AF") PORT_CODE(KEYCODE_A) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 SP") PORT_CODE(KEYCODE_8) + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("FE") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) // Save tape? + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("FF") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_U) // unknown + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +void pmi80_state::machine_reset() +{ +} + + +static MACHINE_CONFIG_START( pmi80, pmi80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(pmi80_mem) + MCFG_CPU_IO_MAP(pmi80_io) + + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_pmi80) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pmi80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "pmi80_monitor.rom", 0x0000, 0x0400, CRC(b93f4407) SHA1(43153441070ed0572f33d2815635eb7bae878e38)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, pmi80, 0, 0, pmi80, pmi80, driver_device, 0, "Tesla", "PMI-80", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/pocketc.c b/src/mame/drivers/pocketc.c new file mode 100644 index 00000000000..4a2dd453bc9 --- /dev/null +++ b/src/mame/drivers/pocketc.c @@ -0,0 +1,988 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + sharp pocket computers + pc1401/pc1403 + PeT mess@utanet.at May 2000 +******************************************************************************/ + +#include "emu.h" +#include "cpu/sc61860/sc61860.h" + +#include "includes/pocketc.h" +#include "includes/pc1401.h" +#include "includes/pc1251.h" +#include "includes/pc1350.h" +#include "includes/pc1403.h" +#include "machine/ram.h" + +/* pc1430 no peek poke operations! */ + +/* pc1280?? */ + +/* pc126x + port + 1 ? + 2 +6v + 3 gnd + 4 f0 + 5 f1 + 6 load + 7 save + 8 ib7 + 9 ib6 + 10 ib5 + 11 ib4 */ + +/* pc1350 other keyboard, + f2 instead f0 at port + port + 1 ? + 2 +6v + 3 gnd + 4 f2 + 5 f1 + 6 load + 7 save + 8 ib7 + 9 ib6 + 10 ib5 + 11 ib4 +*/ + +/* similar computers + pc1260/1261 + pc1402/1403 + pc1421 */ +/* pc140x + a,b0..b5 keyboard matrix + b0 off key + c0 display on + c1 counter reset + c2 cpu halt + c3 computer off + c4 beeper frequency (1 4kHz, 0 2kHz), or (c5=0) membran pos1/pos2 + c5 beeper on + c6 beeper steuerung + + port + 1 ? + 2 +6v + 3 gnd + 4 f0 + 5 f1 + 6 load + 7 save + 8 ib7 + 9 ib6 + 10 ? + 11 ? +*/ + +/* special keys + red c-ce and reset; warm boot, program NOT lost*/ + +static ADDRESS_MAP_START( pc1401_mem , AS_PROGRAM, 8, pc1401_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x3800, 0x47ff) AM_RAM + AM_RANGE( 0x6000, 0x67ff) AM_READWRITE(pc1401_lcd_read, pc1401_lcd_write ) AM_MIRROR(0x1000) + AM_RANGE( 0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1402_mem , AS_PROGRAM, 8, pc1401_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x2000, 0x47ff) AM_RAM + AM_RANGE( 0x6000, 0x67ff) AM_READWRITE(pc1401_lcd_read, pc1401_lcd_write ) AM_MIRROR(0x1000) + AM_RANGE( 0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1250_mem , AS_PROGRAM, 8, pc1251_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x4000, 0x7fff) AM_ROM + AM_RANGE( 0xc000, 0xc7ff) AM_RAM // 2KB RAM + AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1251_mem , AS_PROGRAM, 8, pc1251_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x4000, 0x7fff) AM_ROM + AM_RANGE( 0xb800, 0xc7ff) AM_RAM // 4KB RAM + AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1255_mem , AS_PROGRAM, 8, pc1251_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x4000, 0x7fff) AM_ROM + AM_RANGE( 0xa000, 0xc7ff) AM_RAM // 10KB RAM + AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1260_mem , AS_PROGRAM, 8, pc1251_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x2000, 0x20ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) + //AM_RANGE( 0x2800, 0x28ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) + AM_RANGE( 0x5800, 0x67ff) AM_RAM // 4KB RAM + AM_RANGE( 0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1261_mem , AS_PROGRAM, 8, pc1251_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x2000, 0x20ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) + //AM_RANGE( 0x2800, 0x28ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) + AM_RANGE( 0x4000, 0x67ff) AM_RAM // 10KB RAM + AM_RANGE( 0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( pc1350_mem , AS_PROGRAM, 8, pc1350_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x7000, 0x7eff) AM_READWRITE(pc1350_lcd_read, pc1350_lcd_write ) + AM_RANGE( 0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1403_mem , AS_PROGRAM, 8, pc1403_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x3000, 0x30bf) AM_READWRITE(pc1403_lcd_read, pc1403_lcd_write ) + AM_RANGE( 0x3800, 0x3fff) AM_READWRITE(pc1403_asic_read, pc1403_asic_write ) + AM_RANGE( 0x4000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE( 0xe000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1403h_mem , AS_PROGRAM, 8, pc1403_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x3000, 0x30bf) AM_READWRITE(pc1403_lcd_read, pc1403_lcd_write ) + AM_RANGE( 0x3800, 0x3fff) AM_READWRITE(pc1403_asic_read, pc1403_asic_write ) + AM_RANGE( 0x4000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE( 0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +#if 0 +static ADDRESS_MAP_START( pc1421_readmem , AS_PROGRAM, 8, pc1403_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x3800, 0x47ff) AM_RAM + AM_RANGE( 0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc1421_writemem , AS_PROGRAM, 8, pc1403_state ) + AM_RANGE( 0x0000, 0x1fff) AM_ROM + AM_RANGE( 0x2000, 0x37ff) AM_RAM + AM_RANGE( 0x3800, 0x47ff) AM_RAM + AM_RANGE( 0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END +#endif + + +/* 2008-05 FP: the following input ports are based on the way ports are read, but I would like + to have confirmation from technical docs before considering these correct. + If they need to be changed, you must also update the clickable artwork. +*/ + +static INPUT_PORTS_START( pc1401 ) + PORT_START("KEY0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+/- y'") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 Sy") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 a") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 Sx") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAL") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q !") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A INPUT") PORT_CODE(KEYCODE_A) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z PRINT") PORT_CODE(KEYCODE_Z) + + PORT_START("KEY1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". DRG") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 sigmay") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 b") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 sigmax") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BASIC") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W \"") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S IF") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X USING") PORT_CODE(KEYCODE_X) + + PORT_START("KEY2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ ^") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- >") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* <") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D THEN") PORT_CODE(KEYCODE_D) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C GOSUB") PORT_CODE(KEYCODE_C) + + PORT_START("KEY3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") n!") PORT_CODE(KEYCODE_9) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( ->xy") PORT_CODE(KEYCODE_8) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sqr tri% D") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sqrt 3root C") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("y^x xROOTy B") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXP Pi A") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X->M Sum y Sum y^2") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("KEY4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("chnge STAT") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1/x ->r theta") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG 10^x F") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN e^x E") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("->DEG ->D.MS") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("->HEX ->DEC") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M+ DATA CD") + + PORT_START("KEY5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C-CE CA") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F<>E TAB") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN TAN^-1") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS COS^-1") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN SIN^-1") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HYP ARCHYP") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RM (x,y)") + + PORT_START("KEY6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 y mean") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 r") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 x mean") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F GOTO") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V RETURN") PORT_CODE(KEYCODE_V) + + PORT_START("KEY7") + PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", RUN") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P ;") PORT_CODE(KEYCODE_P) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T %") PORT_CODE(KEYCODE_T) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G FOR") PORT_CODE(KEYCODE_G) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B DIM") PORT_CODE(KEYCODE_B) + + PORT_START("KEY8") + PORT_BIT(0x07, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O :") PORT_CODE(KEYCODE_O) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("left DEL") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H TO") PORT_CODE(KEYCODE_H) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N END") PORT_CODE(KEYCODE_N) + + PORT_START("KEY9") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("right INS") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U ?") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J STEP") PORT_CODE(KEYCODE_J) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M CSAVE") PORT_CODE(KEYCODE_M) + + PORT_START("KEY10") + PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I @") PORT_CODE(KEYCODE_I) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K NEXT") PORT_CODE(KEYCODE_K) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPC CLOAD") PORT_CODE(KEYCODE_SPACE) + + PORT_START("KEY11") + PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L LIST") PORT_CODE(KEYCODE_L) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER N<>NP") PORT_CODE(KEYCODE_ENTER) + + PORT_START("KEY12") + PORT_BIT(0x7f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 x'") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("EXTRA") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK ON") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) + PORT_DIPNAME( 0x04, 0x00, "Power") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW0") + PORT_DIPNAME( 0x07, 0x01, "Contrast") + PORT_DIPSETTING( 0x00, "0/Low" ) + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x05, "5" ) + PORT_DIPSETTING( 0x06, "6" ) + PORT_DIPSETTING( 0x07, "7/High" ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc1403 ) + PORT_START("KEY0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 y mean") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 Sy") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 sigmay") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X->M Sum y Sum y^2") + PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("KEY1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 x mean") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 Sx") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 sigmax") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* <") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RM (x,y)") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SML") PORT_CODE(KEYCODE_CAPSLOCK) + + PORT_START("KEY2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 r") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 a") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 b") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- >") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M+ DATA CD") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q !") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A INPUT") PORT_CODE(KEYCODE_A) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z PRINT") PORT_CODE(KEYCODE_Z) + + PORT_START("KEY3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 x'") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+/- y'") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". DRG") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ ^") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W \"") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S IF") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X USING") PORT_CODE(KEYCODE_X) + + PORT_START("KEY4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HYP ARCHYP") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN SIN^-1") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS COS^-1") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN TAN^-1") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* toggles indicator 3c bit 0 japan? */ + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D THEN") PORT_CODE(KEYCODE_D) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C GOSUB") PORT_CODE(KEYCODE_C) + + PORT_START("KEY5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("->HEX ->DEC") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("->DEG ->D.MS") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN e^x E") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG 10^x F") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* tilde? */ + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F GOTO") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V RETURN") PORT_CODE(KEYCODE_V) + + PORT_START("KEY6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXP Pi A") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("y^x xROOTy B") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sqrt 3root C") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sqr tri% D") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* yen? */ + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T %") PORT_CODE(KEYCODE_T) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G FOR") PORT_CODE(KEYCODE_G) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B DIM") PORT_CODE(KEYCODE_B) + + PORT_START("KEY7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C-CE CA") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("chnge STAT") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F<>E TAB") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H TO") PORT_CODE(KEYCODE_H) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N END") PORT_CODE(KEYCODE_N) + + PORT_START("KEY8") + PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") n!") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1/x ->r theta") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U ?") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J STEP") PORT_CODE(KEYCODE_J) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M CSAVE") PORT_CODE(KEYCODE_M) + + PORT_START("KEY9") + PORT_BIT(0x07, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( ->x y") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left DEL") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I @") PORT_CODE(KEYCODE_I) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K NEXT") PORT_CODE(KEYCODE_K) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPC CLOAD") PORT_CODE(KEYCODE_SPACE) + + PORT_START("KEY10") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right INS") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O :") PORT_CODE(KEYCODE_O) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L LIST") PORT_CODE(KEYCODE_L) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER N<>NP") PORT_CODE(KEYCODE_ENTER) + + PORT_START("KEY11") + PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P ;") PORT_CODE(KEYCODE_P) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", RUN") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BASIC") PORT_CODE(KEYCODE_F2) + + PORT_START("KEY12") + PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* shift lock */ + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAL") PORT_CODE(KEYCODE_F1) + + PORT_START("KEY13") + PORT_BIT(0x7f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_DIPNAME( 0x80, 0x00, "Power") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("EXTRA") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK ON") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) + + PORT_START("DSW0") + // normally no contrast control! + PORT_DIPNAME( 0x07, 0x01, "Contrast") + PORT_DIPSETTING( 0x00, "0/Low" ) + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x05, "5" ) + PORT_DIPSETTING( 0x06, "6" ) + PORT_DIPSETTING( 0x07, "7/High" ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc1251 ) + PORT_START("KEY0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- >") PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL CA") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* <") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ^") PORT_CODE(KEYCODE_SLASH) PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN (") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + + PORT_START("KEY1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ Exp") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 @") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W \"") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + + PORT_START("KEY2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". SquareRoot") PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q !") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + + PORT_START("KEY3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP )") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + + PORT_START("KEY4") + PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P ;") PORT_CODE(KEYCODE_P) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT DEL") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T %") PORT_CODE(KEYCODE_T) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + + PORT_START("KEY5") + PORT_BIT(0x07, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O ,") PORT_CODE(KEYCODE_O) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT INS") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + + PORT_START("KEY6") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* down? */ + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U ?") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + + PORT_START("KEY7") + PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I :") PORT_CODE(KEYCODE_I) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" SPC") PORT_CODE(KEYCODE_SPACE) + + PORT_START("KEY8") + PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER N<>NP") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("KEY9") + PORT_BIT(0x7f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 Pi") PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) + + PORT_START("EXTRA") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK ON") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) + + PORT_START("MODE") + PORT_DIPNAME( 0x07, 0x00, "Mode") + PORT_DIPSETTING( 0x04, DEF_STR(Off) ) + PORT_DIPSETTING( 0x00, "On/RUN" ) + PORT_DIPSETTING( 0x02, "On/PRO" ) + PORT_DIPSETTING( 0x01, "On/RSV" ) + + PORT_START("DSW0") + PORT_DIPNAME( 0x07, 0x01, "Contrast") + PORT_DIPSETTING( 0x00, "0/Low" ) + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x05, "5" ) + PORT_DIPSETTING( 0x06, "6" ) + PORT_DIPSETTING( 0x07, "7/High" ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pc1350 ) + PORT_START("KEY0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") >") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SML") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) /* are both Shifts connected here? or is Left Shift missing */ + + PORT_START("KEY1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( <") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- ^") PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q !") PORT_CODE(KEYCODE_Q) + + PORT_START("KEY2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W \"") PORT_CODE(KEYCODE_W) + + PORT_START("KEY3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) + + PORT_START("KEY4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) + + PORT_START("KEY5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T %") PORT_CODE(KEYCODE_T) + + PORT_START("KEY6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* 1 ?*/ + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) + + PORT_START("KEY7") + PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* 2 ?*/ + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U ?") PORT_CODE(KEYCODE_U) + + PORT_START("KEY8") + PORT_BIT(0x07, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS CA") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I Pi") PORT_CODE(KEYCODE_I) + + PORT_START("KEY9") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER P<->NP") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O Squareroot") PORT_CODE(KEYCODE_O) + + PORT_START("KEY10") + PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P Alpha") PORT_CODE(KEYCODE_P) + + PORT_START("KEY11") + PORT_DIPNAME( 0xc0, 0x00, "Power") + PORT_DIPSETTING( 0xc0, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("EXTRA") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK ON") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) // temporarily here, but not read... + + PORT_START("DSW0") + PORT_DIPNAME( 0x07, 0x07, "Contrast") + PORT_DIPSETTING( 0x00, "0/Low" ) + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x05, "5" ) + PORT_DIPSETTING( 0x06, "6" ) + PORT_DIPSETTING( 0x07, "7/High" ) +INPUT_PORTS_END + + +static const gfx_layout pc1401_charlayout = +{ + 2,21, + 128, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0,0 }, /* no bitplanes; 1 bit per pixel */ + /* x offsets */ + { 0,0 }, + /* y offsets */ + { + 7, 7, 7, + 6, 6, 6, + 5, 5, 5, + 4, 4, 4, + 3, 3, 3, + 2, 2, 2, + 1, 1, 1 + }, + 1*8 +}; + +static const gfx_layout pc1251_charlayout = +{ + 3,21, + 128, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0, }, /* no bitplanes; 1 bit per pixel */ + /* x offsets */ + { 0,0,0 }, + /* y offsets */ + { + 7, 7, 7, + 6, 6, 6, + 5, 5, 5, + 4, 4, 4, + 3, 3, 3, + 2, 2, 2, + 1, 1, 1 + }, + 1*8 +}; + +static GFXDECODE_START( pc1401 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, pc1401_charlayout, 0, 8 ) +GFXDECODE_END + +static GFXDECODE_START( pc1251 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, pc1251_charlayout, 0, 8 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( pocketc, pocketc_state) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_NVRAM_ADD_0FILL("cpu_nvram") + MCFG_NVRAM_ADD_0FILL("ram_nvram") + + /* + aim: show sharp with keyboard + resolution depends on the dots of the lcd + (lcd dot displayed as 2x3 pixel) + it seems to have 3/4 ratio in the real pc1401 */ + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(20) /* very early and slow lcd */ + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(594, 273) + MCFG_SCREEN_VISIBLE_AREA(0, 594-1, 0, 273-1) +// MCFG_SCREEN_SIZE(640, 273) +// MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 273-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc1401 ) + MCFG_PALETTE_ADD("palette", 8*2) + MCFG_PALETTE_INDIRECT_ENTRIES(6) + MCFG_PALETTE_INIT_OWNER( pocketc_state, pocketc ) + + /* sound hardware */ + /*MCFG_SOUND_ADD("dac", DAC, pocketc_sound_interface)*/ +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( pc1401, pocketc, pc1401_state ) + MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ + MCFG_CPU_PROGRAM_MAP(pc1401_mem) + MCFG_SC61860_READ_RESET_HANDLER(READLINE(pc1401_state,pc1401_reset)) + MCFG_SC61860_READ_BRK_HANDLER(READLINE(pc1401_state,pc1401_brk)) + MCFG_SC61860_READ_X_HANDLER(NULL) + MCFG_SC61860_READ_A_HANDLER(READ8(pc1401_state,pc1401_ina)) + MCFG_SC61860_WRITE_A_HANDLER(WRITE8(pc1401_state,pc1401_outa)) + MCFG_SC61860_READ_B_HANDLER(READ8(pc1401_state,pc1401_inb)) + MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1401_state,pc1401_outb)) + MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1401_state,pc1401_outc)) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(pc1401_state, screen_update_pc1401) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc1402, pc1401 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( pc1402_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( pc1250, pocketc, pc1251_state ) + MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ + MCFG_CPU_PROGRAM_MAP( pc1250_mem) + MCFG_SC61860_READ_RESET_HANDLER(NULL) + MCFG_SC61860_READ_BRK_HANDLER(READLINE(pc1251_state,pc1251_brk)) + MCFG_SC61860_READ_X_HANDLER(NULL) + MCFG_SC61860_READ_A_HANDLER(READ8(pc1251_state,pc1251_ina)) + MCFG_SC61860_WRITE_A_HANDLER(WRITE8(pc1251_state,pc1251_outa)) + MCFG_SC61860_READ_B_HANDLER(READ8(pc1251_state,pc1251_inb)) + MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1251_state,pc1251_outb)) + MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1251_state,pc1251_outc)) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(608, 300) + MCFG_SCREEN_VISIBLE_AREA(0, 608-1, 0, 300-1) + MCFG_SCREEN_UPDATE_DRIVER(pc1251_state, screen_update_pc1251) + MCFG_GFXDECODE_MODIFY("gfxdecode", pc1251 ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc1251, pc1250 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( pc1251_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc1255, pc1250 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( pc1255_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc1260, pc1250 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( pc1260_mem) + + MCFG_MACHINE_START_OVERRIDE(pc1251_state, pc1260 ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc1261, pc1260 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( pc1261_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( pc1350, pocketc, pc1350_state ) + MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ + MCFG_CPU_PROGRAM_MAP( pc1350_mem) + MCFG_SC61860_READ_RESET_HANDLER(NULL) + MCFG_SC61860_READ_BRK_HANDLER(READLINE(pc1350_state,pc1350_brk)) + MCFG_SC61860_READ_X_HANDLER(NULL) + MCFG_SC61860_READ_A_HANDLER(READ8(pc1350_state,pc1350_ina)) + MCFG_SC61860_WRITE_A_HANDLER(WRITE8(pc1350_state,pc1350_outa)) + MCFG_SC61860_READ_B_HANDLER(READ8(pc1350_state,pc1350_inb)) + MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1350_state,pc1350_outb)) + MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1350_state,pc1350_outc)) + + /* + aim: show sharp with keyboard + resolution depends on the dots of the lcd + (lcd dot displayed as 2x2 pixel) */ + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(640, 252) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 252-1) + MCFG_SCREEN_UPDATE_DRIVER(pc1350_state, screen_update_pc1350) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("12K,20K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( pc1403, pocketc, pc1403_state ) + MCFG_CPU_ADD( "maincpu", SC61860, 256000 ) + MCFG_CPU_PROGRAM_MAP( pc1403_mem) + MCFG_SC61860_READ_RESET_HANDLER(NULL) + MCFG_SC61860_READ_BRK_HANDLER(READLINE(pc1403_state,pc1403_brk)) + MCFG_SC61860_READ_X_HANDLER(NULL) + MCFG_SC61860_READ_A_HANDLER(READ8(pc1403_state,pc1403_ina)) + MCFG_SC61860_WRITE_A_HANDLER(WRITE8(pc1403_state,pc1403_outa)) + MCFG_SC61860_READ_B_HANDLER(NULL) + MCFG_SC61860_WRITE_B_HANDLER(NULL) + MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1403_state,pc1403_outc)) + + /* + aim: show sharp with keyboard + resolution depends on the dots of the lcd + (lcd dot displayed as 2x2 pixel) */ + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(848, 320) + MCFG_SCREEN_VISIBLE_AREA(0, 848-1, 0, 320-1) +// MCFG_SCREEN_SIZE(848, 361) +// MCFG_SCREEN_VISIBLE_AREA(0, 848-1, 0, 361-1) + MCFG_SCREEN_UPDATE_DRIVER(pc1403_state, screen_update_pc1403) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc1403h, pc1403 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( pc1403h_mem) +MACHINE_CONFIG_END + + +ROM_START(pc1401) + ROM_REGION(0x10000,"maincpu",0) + /* SC61860A08 5H 13LD cpu with integrated rom*/ + ROM_LOAD("sc61860.a08", 0x0000, 0x2000, CRC(44bee438) SHA1(c5106bc8d848be1b49494ace30a26eeb1cc5e504)) +/* 5S1 SC613256 D30 + or SC43536LD 5G 13 (LCD chip?) */ + ROM_LOAD("sc613256.d30", 0x8000, 0x8000, CRC(69b9d587) SHA1(fa0602e7dfee548546f801fb4cca7d73da2d8f18)) + ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) +ROM_END + +#define rom_pc1402 rom_pc1401 + +ROM_START(pc1245) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD( "cpu1245.rom", 0x0000, 0x2000, CRC(e0964069) SHA1(293c57b233d55944b308191fd72ecff81979cda7)) + ROM_LOAD( "bas1245.rom", 0x4000, 0x4000, CRC(f6253a0d) SHA1(bcac9b4f5a88eb952e81b3ee28f922c06bace18e)) + ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) +ROM_END + +ROM_START(pc1250) + ROM_REGION(0x10000,"maincpu",0) + /* sc61860a13 6c 13 ld */ + ROM_LOAD("cpu1250.rom", 0x0000, 0x2000, CRC(f7287aca) SHA1(19bfa778e3e05ea06bdca15cd9dfbba9b971340e)) + ROM_LOAD("bas1250.rom", 0x4000, 0x4000, CRC(93ecb629) SHA1(0fe0ad419053ee7814600b0be320dd2e8eb2ec92)) + ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) +ROM_END + +#define rom_pc1251 rom_pc1250 +#define rom_pc1255 rom_pc1250 +#define rom_trs80pc3 rom_pc1250 + + +ROM_START(pc1260) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD( "cpu1260.rom", 0x0000, 0x2000, CRC(f46d23d3) SHA1(e00c9194570048185ec8358732adeba151c56b33)) + ROM_LOAD( "bas1260.rom", 0x8000, 0x8000, CRC(6c7e017d) SHA1(e2ae717438cea59416b0670e2a53989c147fb362)) + ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) +ROM_END + +#define rom_pc1261 rom_pc1260 + +ROM_START(pc1350) + ROM_REGION(0x10000,"maincpu",0) + /* sc61860a13 6c 13 ld */ + ROM_LOAD("cpu.rom", 0x0000, 0x2000, CRC(79a924bc) SHA1(2eaef0d53d85863ca70a41c8e1eddc5915136b99)) + ROM_LOAD("basic.rom", 0x8000, 0x8000, CRC(158b28e2) SHA1(b63b37dd510b3c4d9f16d224f87ae2efb3bcc51f)) + ROM_REGION(0x100,"gfx1",ROMREGION_ERASEFF) +ROM_END + +ROM_START( pc1360 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "cpu-1360.rom", 0x0000, 0x2000, CRC(8fc9bf75) SHA1(f803cfecb8179f47031901c4d5bd546ac93118b1)) + ROM_REGION(0x20000,"user1",0) + ROM_LOAD( "b0-1360.rom", 0x00000, 0x4000, CRC(afe1d3d6) SHA1(7178fd30dcc7f2777f0539897ef7245832f26152)) + ROM_LOAD( "b1-1360.rom", 0x04000, 0x4000, CRC(83f7e4dd) SHA1(ae6d133fdb586df8660dd9315c1fdf80b7b8dd57)) + ROM_LOAD( "b2-1360.rom", 0x08000, 0x4000, CRC(007cf5a6) SHA1(311d3ceaaed61479bdb00d8ade358fd6a99da170)) + ROM_LOAD( "b3-1360.rom", 0x0c000, 0x4000, CRC(4170849f) SHA1(70eeaa29c008131137bd28e4e957694cdf312413)) + ROM_LOAD( "b4-1360.rom", 0x10000, 0x4000, CRC(0d311e21) SHA1(55987b7b00ddc666db30f35cbf23500b49e7ff09)) + ROM_LOAD( "b5-1360.rom", 0x14000, 0x4000, CRC(f945f3f7) SHA1(26116d8277212e14bddb64c531f134fbb5c86f9e)) + ROM_LOAD( "b6-1360.rom", 0x18000, 0x4000, CRC(ae823112) SHA1(9ab458e70752cacfd5d3ed36a8e89f96c63a6f50)) + ROM_LOAD( "b7-1360.rom", 0x1c000, 0x4000, CRC(ba7384b6) SHA1(95396d506f1d71e66c3ae2d47ffb4b6d10b31401)) + ROM_REGION(0x100,"gfx1",ROMREGION_ERASEFF) +ROM_END + +ROM_START(pc1403) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("introm.bin", 0x0000, 0x2000, CRC(588c500b) SHA1(2fed9ebede27e20a8ee4b4b03b9f8cd7808ada5c)) + ROM_REGION(0x10000,"user1",0) + ROM_LOAD("extrom08.bin", 0x0000, 0x4000, CRC(1fa65140) SHA1(f22a9f114486f69733fc43dfec26fb210643aeff)) + ROM_LOAD("extrom09.bin", 0x4000, 0x4000, CRC(4a7da6ab) SHA1(b50fe8a4ca821244c119147b3ff04cee0fd6ad5c)) + ROM_LOAD("extrom0a.bin", 0x8000, 0x4000, CRC(9925174f) SHA1(793a79142cd170ed7ac3f7ecb1b6e6f92c8fa4e0)) + ROM_LOAD("extrom0b.bin", 0xc000, 0x4000, CRC(fa5df9ec) SHA1(6ff62c215f510a3a652d61823f54cd4018d6a771)) + ROM_REGION(0x100,"gfx1",ROMREGION_ERASEFF) +ROM_END + +#define rom_pc1403h rom_pc1403 + +// disk drive support +#define io_pc1403 io_pc1401 +#define io_pc1403h io_pc1403 + +/* ROM definition */ +ROM_START( pc1450 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "cpu-1450.rom", 0x0000, 0x2000, CRC(dead7be5) SHA1(f55ba8cb823eb16b514032e96d2068d028964c1f)) + ROM_LOAD( "bas-1450.rom", 0x8000, 0x8000, CRC(d207cae9) SHA1(a88ef79bc38ea264165f800e4e386050d4d461b2)) + ROM_REGION(0x100,"gfx1",ROMREGION_ERASEFF) +ROM_END + +/* YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME */ + +/* cpu sc43177, sc43178 (4bit!) + pc 1211 + clone tandy trs80 pocket computer + pc1246/pc1247 +*/ + +/* cpu lh5801 + pc1500 + clone tandy pc2 look into drivers/pc1500.c + pc1600 +*/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +/* cpu sc61860 */ +COMP( 1982, pc1245, 0, 0, pc1250, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1245", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1982, pc1250, 0, 0, pc1250, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1250", MACHINE_NO_SOUND) +COMP( 1982, pc1251, pc1250, 0, pc1251, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1251", MACHINE_NO_SOUND) +COMP( 1982, pc1255, pc1250, 0, pc1255, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1255", MACHINE_NO_SOUND) +COMP( 1983, trs80pc3, pc1250, 0, pc1251, pc1251, pc1251_state, pc1251, "Tandy Radio Shack", "TRS-80 Pocket Computer PC-3", MACHINE_NO_SOUND) + +COMP( 1982, pc1260, 0, 0, pc1260, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1260", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1982, pc1261, pc1260, 0, pc1261, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1261/1262", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) + +/* pc1261/pc1262 */ +COMP( 1984, pc1350, 0, 0, pc1350, pc1350, driver_device, 0, "Sharp", "Pocket Computer 1350", MACHINE_NO_SOUND ) +COMP( 198?, pc1450, 0, 0, pc1350, pc1350, driver_device, 0, "Sharp", "Pocket Computer 1450", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) + +COMP( 1983, pc1401, 0, 0, pc1401, pc1401, pc1401_state, pc1401, "Sharp", "Pocket Computer 1401", MACHINE_NO_SOUND) +COMP( 1984, pc1402, pc1401, 0, pc1402, pc1401, pc1401_state, pc1401, "Sharp", "Pocket Computer 1402", MACHINE_NO_SOUND) +COMP( 198?, pc1360, pc1401, 0, pc1401, pc1401, pc1401_state, pc1401, "Sharp", "Pocket Computer 1360", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) + +/* 72kb rom, 32kb ram, cpu? pc1360 */ +COMP( 1986, pc1403, 0, 0, pc1403, pc1403, pc1403_state, pc1403, "Sharp", "Pocket Computer 1403", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, pc1403h, pc1403, 0, pc1403h,pc1403, pc1403_state, pc1403, "Sharp", "Pocket Computer 1403H", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/pockstat.c b/src/mame/drivers/pockstat.c new file mode 100644 index 00000000000..f276a1e7c8f --- /dev/null +++ b/src/mame/drivers/pockstat.c @@ -0,0 +1,1017 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/*************************************************************************** + + Sony PocketStation + + 05/2009 Skeleton driver written. + 11/2009 Initial bring-up commenced by Harmony. + 11/2009 Playable state achieved by Harmony. + + PocketStation games were dowloaded from PS1 games into flash RAM after + the unit had been inserted in the memory card slot, and so this should + be emulated alongside the PS1. However, as many flash dumps exist, it + is possible to emulate the PocketStation in the meantime. + + CPU: ARM7T (32 bit RISC Processor) + Memory: 2Kbytes of SRAM, 128Kbytes of FlashROM + Graphics: 32x32 monochrome LCD + Sound: 1 12-bit PCM channel + Input: 5 input buttons, 1 reset button + Infrared communication: Bi-directional and uni-directional comms + Other: 1 LED indicator + + Info available at: + * http://exophase.devzero.co.uk/ps_info.txt + * http://members.at.infoseek.co.jp/DrHell/pocket/index.html + + Currently, a handful of games run, but some die due to odd hardware + issues. + +To start a game: +- Wait for the set-date screen to appear +- Press down arrow +- set date with arrows (optional) +- Press Ctrl, wait a sec, press ctrl, press right arrow, game starts + +It doesn't save the date so you have to go through this procedure every time. + +If you do nothing for about 20 secs, it turns itself off (screen goes white). + +****************************************************************************/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "cpu/arm7/arm7core.h" +#include "sound/dac.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define MAX_PS_TIMERS 3 + +struct ps_ftlb_regs_t +{ + UINT32 control; + UINT32 stat; + UINT32 valid; + UINT32 wait1; + UINT32 wait2; + UINT32 entry[16]; + UINT32 serial; +}; + +struct ps_intc_regs_t +{ + UINT32 hold; + UINT32 status; + UINT32 enable; + UINT32 mask; +}; + +struct ps_timer_t +{ + UINT32 period; + UINT32 count; + UINT32 control; + emu_timer *timer; +}; + +struct ps_timer_regs_t +{ + ps_timer_t timer[MAX_PS_TIMERS]; +}; + +struct ps_clock_regs_t +{ + UINT32 mode; + UINT32 control; +}; + +#define PS_CLOCK_STEADY 0x10 + +struct ps_rtc_regs_t +{ + UINT32 mode; + UINT32 control; + UINT32 time; + UINT32 date; + emu_timer *timer; +}; + + + +class pockstat_state : public driver_device +{ +public: + pockstat_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_lcd_buffer(*this, "lcd_buffer"), + m_maincpu(*this, "maincpu"), + m_dac(*this, "dac"), + m_cart(*this, "cartslot") + { } + + required_shared_ptr m_lcd_buffer; + required_device m_maincpu; + required_device m_dac; + required_device m_cart; + memory_region *m_cart_rom; + + ps_ftlb_regs_t m_ftlb_regs; + ps_intc_regs_t m_intc_regs; + ps_timer_regs_t m_timer_regs; + ps_clock_regs_t m_clock_regs; + ps_rtc_regs_t m_rtc_regs; + UINT32 m_lcd_control; + INT32 m_ps_flash_write_enable_count; + INT32 m_ps_flash_write_count; + DECLARE_READ32_MEMBER(ps_ftlb_r); + DECLARE_WRITE32_MEMBER(ps_ftlb_w); + DECLARE_READ32_MEMBER(ps_intc_r); + DECLARE_WRITE32_MEMBER(ps_intc_w); + DECLARE_READ32_MEMBER(ps_timer_r); + DECLARE_WRITE32_MEMBER(ps_timer_w); + DECLARE_READ32_MEMBER(ps_clock_r); + DECLARE_WRITE32_MEMBER(ps_clock_w); + DECLARE_READ32_MEMBER(ps_rtc_r); + DECLARE_WRITE32_MEMBER(ps_rtc_w); + DECLARE_READ32_MEMBER(ps_lcd_r); + DECLARE_WRITE32_MEMBER(ps_lcd_w); + DECLARE_READ32_MEMBER(ps_rombank_r); + DECLARE_READ32_MEMBER(ps_flash_r); + DECLARE_WRITE32_MEMBER(ps_flash_w); + DECLARE_READ32_MEMBER(ps_audio_r); + DECLARE_WRITE32_MEMBER(ps_audio_w); + DECLARE_WRITE32_MEMBER(ps_dac_w); + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update_pockstat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_INPUT_CHANGED_MEMBER(input_update); + TIMER_CALLBACK_MEMBER(timer_tick); + TIMER_CALLBACK_MEMBER(rtc_tick); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( pockstat_flash ); + inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); + UINT32 ps_intc_get_interrupt_line(UINT32 line); + void ps_intc_set_interrupt_line(UINT32 line, int state); + void ps_timer_start(int index); +}; + + +#define DEFAULT_CLOCK 2000000 + +static const int CPU_FREQ[16] = +{ + 0x00f800, + 0x01f000, + 0x03e000, + 0x07c000, + 0x0f8000, + 0x1e8000, + 0x3d0000, + 0x7a0000, + 0x7a0000, + 0x7a0000, + 0x7a0000, + 0x7a0000, + 0x7a0000, + 0x7a0000, + 0x7a0000, + 0x7a0000 +}; + +#define VERBOSE_LEVEL (0) + +#define ENABLE_VERBOSE_LOG (0) + +inline void ATTR_PRINTF(3,4) pockstat_state::verboselog( int n_level, const char *s_fmt, ... ) +{ +#if ENABLE_VERBOSE_LOG + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%s: %s", machine().describe_context(), buf ); + } +#endif +} + +#define PS_INT_BTN_ACTION 0x00000001 // "Action button" +#define PS_INT_BTN_RIGHT 0x00000002 // "Right button" +#define PS_INT_BTN_LEFT 0x00000004 // "Left button" +#define PS_INT_BTN_DOWN 0x00000008 // "Down button" +#define PS_INT_BTN_UP 0x00000010 // "Up button" +#define PS_INT_UNKNOWN 0x00000020 // "Unknown" +#define PS_INT_COM 0x00000040 // "COM" ??? +#define PS_INT_TIMER0 0x00000080 // "Timer 0" +#define PS_INT_TIMER1 0x00000100 // "Timer 1" +#define PS_INT_RTC 0x00000200 // "RTC" +#define PS_INT_BATTERY 0x00000400 // "Battery Monitor" +#define PS_INT_IOP 0x00000800 // "IOP" +#define PS_INT_IRDA 0x00001000 // "IrDA" +#define PS_INT_TIMER2 0x00002000 // "Timer 2" +#define PS_INT_IRQ_MASK 0x00001fbf +#define PS_INT_FIQ_MASK 0x00002040 +#define PS_INT_STATUS_MASK 0x0000021f + +READ32_MEMBER(pockstat_state::ps_ftlb_r) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_ftlb_r: FlashROM TLB Control = %08x & %08x\n", m_ftlb_regs.control, mem_mask ); + return m_ftlb_regs.control | 1; // ??? + case 0x0004/4: + verboselog(0, "ps_ftlb_r: Unknown (F_STAT) = %08x & %08x\n", m_ftlb_regs.stat, mem_mask ); + return m_ftlb_regs.stat; + case 0x0008/4: + verboselog(0, "ps_ftlb_r: FlashROM TLB Valid Tag = %08x & %08x\n", m_ftlb_regs.valid, mem_mask ); + return m_ftlb_regs.valid; + case 0x000c/4: + verboselog(0, "ps_ftlb_r: Unknown (F_WAIT1) = %08x & %08x\n", m_ftlb_regs.wait1, mem_mask ); + return m_ftlb_regs.wait1; + case 0x0010/4: + verboselog(0, "ps_ftlb_r: Unknown (F_WAIT2) = %08x & %08x\n", m_ftlb_regs.wait2 | 0x04, mem_mask ); + return m_ftlb_regs.wait2 | 0x04; + case 0x0100/4: + case 0x0104/4: + case 0x0108/4: + case 0x010c/4: + case 0x0110/4: + case 0x0114/4: + case 0x0118/4: + case 0x011c/4: + case 0x0120/4: + case 0x0124/4: + case 0x0128/4: + case 0x012c/4: + case 0x0130/4: + case 0x0134/4: + case 0x0138/4: + case 0x013c/4: + verboselog(0, "ps_ftlb_r: FlashROM TLB Entry %d = %08x & %08x\n", offset - 0x100/4, m_ftlb_regs.entry[offset - 0x100/4], mem_mask ); + return m_ftlb_regs.entry[offset - 0x100/4]; + case 0x0300/4: + verboselog(0, "ps_ftlb_r: Unknown (F_SN) = %08x & %08x\n", m_ftlb_regs.serial, mem_mask ); + return m_ftlb_regs.serial; + default: + verboselog(0, "ps_ftlb_r: Unknown Register %08x & %08x\n", 0x06000000 + (offset << 2), mem_mask ); + break; + } + return 0; +} + +WRITE32_MEMBER(pockstat_state::ps_ftlb_w) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_ftlb_w: FlashROM TLB Control = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_ftlb_regs.control); + break; + case 0x0004/4: + verboselog(0, "ps_ftlb_w: Unknown (F_STAT) = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_ftlb_regs.stat); + break; + case 0x0008/4: + verboselog(0, "ps_ftlb_w: FlashROM TLB Valid Tag = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_ftlb_regs.valid); + break; + case 0x000c/4: + verboselog(0, "ps_ftlb_w: Unknown (F_WAIT1) = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_ftlb_regs.wait1); + break; + case 0x0010/4: + verboselog(0, "ps_ftlb_w: Unknown (F_WAIT2) = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_ftlb_regs.wait2); + break; + case 0x0100/4: + case 0x0104/4: + case 0x0108/4: + case 0x010c/4: + case 0x0110/4: + case 0x0114/4: + case 0x0118/4: + case 0x011c/4: + case 0x0120/4: + case 0x0124/4: + case 0x0128/4: + case 0x012c/4: + case 0x0130/4: + case 0x0134/4: + case 0x0138/4: + case 0x013c/4: + verboselog(0, "ps_ftlb_w: FlashROM TLB Entry %d = %08x & %08x\n", offset - 0x100/4, data, mem_mask ); + COMBINE_DATA(&m_ftlb_regs.entry[offset - 0x100/4]); + break; + case 0x0300/4: + verboselog(0, "ps_ftlb_w: Unknown (F_SN) = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_ftlb_regs.serial); + break; + default: + verboselog(0, "ps_ftlb_w: Unknown Register %08x = %08x & %08x\n", 0x06000000 + (offset << 2), data, mem_mask ); + break; + } +} + +UINT32 pockstat_state::ps_intc_get_interrupt_line(UINT32 line) +{ + return m_intc_regs.status & line; +} + +void pockstat_state::ps_intc_set_interrupt_line(UINT32 line, int state) +{ + //printf( "%08x %d %08x %08x %08x\n", line, state, drvm_intc_regs.hold, drvm_intc_regs.status, drvm_intc_regs.enable ); + if(line) + { + if(state) + { + m_intc_regs.status |= line & PS_INT_STATUS_MASK; + m_intc_regs.hold |= line &~ PS_INT_STATUS_MASK; + //printf( " Setting %08x, status = %08x, hold = %08x\n", line, m_intc_regs.status, m_intc_regs.hold ); + } + else + { + m_intc_regs.status &= ~line; + m_intc_regs.hold &= ~line; + //printf( "Clearing %08x, status = %08x, hold = %08x\n", line, m_intc_regs.status, m_intc_regs.hold ); + } + } + if(m_intc_regs.hold & m_intc_regs.enable & PS_INT_IRQ_MASK) + { + m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + } + else + { + m_maincpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); + } + if(m_intc_regs.hold & m_intc_regs.enable & PS_INT_FIQ_MASK) + { + m_maincpu->set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE); + } + else + { + m_maincpu->set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE); + } +} + +READ32_MEMBER(pockstat_state::ps_intc_r) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_intc_r: Held Interrupt = %08x & %08x\n", m_intc_regs.hold, mem_mask ); + return m_intc_regs.hold; + case 0x0004/4: + verboselog(0, "ps_intc_r: Interrupt Status = %08x & %08x\n", m_intc_regs.status, mem_mask ); + return m_intc_regs.status; + case 0x0008/4: + verboselog(0, "ps_intc_r: Interrupt Enable = %08x & %08x\n", m_intc_regs.enable, mem_mask ); + return m_intc_regs.enable; + case 0x000c/4: + verboselog(0, "ps_intc_r: Interrupt Mask (Invalid Read) = %08x & %08x\n", 0, mem_mask ); + return 0; + case 0x0010/4: + verboselog(0, "ps_intc_r: Interrupt Acknowledge (Invalid Read) = %08x & %08x\n", 0, mem_mask ); + return 0; + default: + verboselog(0, "ps_intc_r: Unknown Register %08x & %08x\n", 0x0a000000 + (offset << 2), mem_mask ); + break; + } + return 0; +} + +WRITE32_MEMBER(pockstat_state::ps_intc_w) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_intc_w: Held Interrupt (Invalid Write) = %08x & %08x\n", data, mem_mask ); + break; + case 0x0004/4: + verboselog(0, "ps_intc_w: Interrupt Status (Invalid Write) = %08x & %08x\n", data, mem_mask ); + break; + case 0x0008/4: + verboselog(0, "ps_intc_w: Interrupt Enable = %08x & %08x\n", data, mem_mask ); + m_intc_regs.enable |= data; + //COMBINE_DATA(&m_intc_regs.enable); + //m_intc_regs.status &= m_intc_regs.enable; + //m_intc_regs.hold &= m_intc_regs.enable; + ps_intc_set_interrupt_line(0, 0); + break; + case 0x000c/4: + verboselog(0, "ps_intc_w: Interrupt Mask = %08x & %08x\n", data, mem_mask ); + m_intc_regs.enable &= ~data; + COMBINE_DATA(&m_intc_regs.mask); + //m_intc_regs.status &= m_intc_regs.enable; + //m_intc_regs.hold &= m_intc_regs.enable; + ps_intc_set_interrupt_line(0, 0); + break; + case 0x0010/4: + verboselog(0, "ps_intc_w: Interrupt Acknowledge = %08x & %08x\n", data, mem_mask ); + m_intc_regs.hold &= ~data; + m_intc_regs.status &= ~data; + ps_intc_set_interrupt_line(0, 0); + //COMBINE_DATA(&m_intc_regs.acknowledge); + break; + default: + verboselog(0, "ps_intc_w: Unknown Register %08x = %08x & %08x\n", 0x0a000000 + (offset << 2), data, mem_mask ); + break; + } +} + +TIMER_CALLBACK_MEMBER(pockstat_state::timer_tick) +{ + ps_intc_set_interrupt_line(param == 2 ? PS_INT_TIMER2 : (param == 1 ? PS_INT_TIMER1 : PS_INT_TIMER0), 1); + //printf( "Timer %d is calling back\n", param ); + m_timer_regs.timer[param].count = m_timer_regs.timer[param].period; + ps_timer_start(param); +} + +void pockstat_state::ps_timer_start(int index) +{ + int divisor = 1; + attotime period; + switch(m_timer_regs.timer[index].control & 3) + { + case 0: + case 3: + divisor = 1; + break; + case 1: + divisor = 16; + break; + case 2: + divisor = 256; + break; + } + period = attotime::from_hz(CPU_FREQ[m_clock_regs.mode & 0x0f] / 2) * divisor; + period = period * m_timer_regs.timer[index].count; + m_timer_regs.timer[index].timer->adjust(period, index); +} + +READ32_MEMBER(pockstat_state::ps_timer_r) +{ + switch(offset) + { + case 0x0000/4: + case 0x0010/4: + case 0x0020/4: + verboselog(0, "ps_timer_r: Timer %d Period = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].period, mem_mask ); + return m_timer_regs.timer[offset / (0x10/4)].period; + case 0x0004/4: + case 0x0014/4: + case 0x0024/4: + verboselog(0, "ps_timer_r: Timer %d Count = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].count, mem_mask ); + if(m_timer_regs.timer[offset / (0x10/4)].control & 4) + { + m_timer_regs.timer[offset / (0x10/4)].count--; + if(m_timer_regs.timer[offset / (0x10/4)].count > m_timer_regs.timer[offset / (0x10/4)].period) + { + m_timer_regs.timer[offset / (0x10/4)].count = m_timer_regs.timer[offset / (0x10/4)].period; + } + return --m_timer_regs.timer[offset / (0x10/4)].count; + } + return m_timer_regs.timer[offset / (0x10/4)].count; + case 0x0008/4: + case 0x0018/4: + case 0x0028/4: + verboselog(0, "ps_timer_r: Timer %d Control = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].control, mem_mask ); + return m_timer_regs.timer[offset / (0x10/4)].control; + default: + verboselog(0, "ps_timer_r: Unknown Register %08x & %08x\n", 0x0a800000 + (offset << 2), mem_mask ); + break; + } + return 0; +} + +WRITE32_MEMBER(pockstat_state::ps_timer_w) +{ + switch(offset) + { + case 0x0000/4: + case 0x0010/4: + case 0x0020/4: + verboselog(0, "ps_timer_w: Timer %d Period = %08x & %08x\n", offset / (0x10/4), data, mem_mask ); + COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].period); + break; + case 0x0004/4: + case 0x0014/4: + case 0x0024/4: + verboselog(0, "ps_timer_w: Timer %d Count = %08x & %08x\n", offset / (0x10/4), data, mem_mask ); + COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].count); + break; + case 0x0008/4: + case 0x0018/4: + case 0x0028/4: + verboselog(0, "ps_timer_w: Timer %d Control = %08x & %08x\n", offset / (0x10/4), data, mem_mask ); + COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].control); + if(m_timer_regs.timer[offset / (0x10/4)].control & 4) + { + ps_timer_start(offset / (0x10/4)); + } + else + { + m_timer_regs.timer[offset / (0x10/4)].timer->adjust(attotime::never, offset / (0x10/4)); + } + break; + default: + verboselog(0, "ps_timer_w: Unknown Register %08x = %08x & %08x\n", 0x0a800000 + (offset << 2), data, mem_mask ); + break; + } +} + +READ32_MEMBER(pockstat_state::ps_clock_r) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_clock_r: Clock Mode = %08x & %08x\n", m_clock_regs.mode | 0x10, mem_mask ); + return m_clock_regs.mode | PS_CLOCK_STEADY; + case 0x0004/4: + verboselog(0, "ps_clock_r: Clock Control = %08x & %08x\n", m_clock_regs.control, mem_mask ); + return m_clock_regs.control; + default: + verboselog(0, "ps_clock_r: Unknown Register %08x & %08x\n", 0x0b000000 + (offset << 2), mem_mask ); + break; + } + return 0; +} + +WRITE32_MEMBER(pockstat_state::ps_clock_w) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_clock_w: Clock Mode = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_clock_regs.mode); + m_maincpu->set_unscaled_clock(CPU_FREQ[m_clock_regs.mode & 0x0f]); + break; + case 0x0004/4: + verboselog(0, "ps_clock_w: Clock Control = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_clock_regs.control); + break; + default: + verboselog(0, "ps_clock_w: Unknown Register %08x = %08x & %08x\n", 0x0b000000 + (offset << 2), data, mem_mask ); + break; + } +} + +TIMER_CALLBACK_MEMBER(pockstat_state::rtc_tick) +{ + //printf( "RTC is calling back\n" ); + ps_intc_set_interrupt_line(PS_INT_RTC, ps_intc_get_interrupt_line(PS_INT_RTC) ? 0 : 1); + if(!(m_rtc_regs.mode & 1)) + { + m_rtc_regs.time++; + if((m_rtc_regs.time & 0x0000000f) == 0x0000000a) + { + m_rtc_regs.time &= 0xfffffff0; + m_rtc_regs.time += 0x00000010; + if((m_rtc_regs.time & 0x000000ff) == 0x00000060) + { + m_rtc_regs.time &= 0xffffff00; + m_rtc_regs.time += 0x00000100; + if((m_rtc_regs.time & 0x00000f00) == 0x00000a00) + { + m_rtc_regs.time &= 0xfffff0ff; + m_rtc_regs.time += 0x00001000; + if((m_rtc_regs.time & 0x0000ff00) == 0x00006000) + { + m_rtc_regs.time &= 0xffff00ff; + m_rtc_regs.time += 0x00010000; + if((m_rtc_regs.time & 0x00ff0000) == 0x00240000) + { + m_rtc_regs.time &= 0xff00ffff; + m_rtc_regs.time += 0x01000000; + if((m_rtc_regs.time & 0x0f000000) == 0x08000000) + { + m_rtc_regs.time &= 0xf0ffffff; + m_rtc_regs.time |= 0x01000000; + } + } + else if((m_rtc_regs.time & 0x000f0000) == 0x000a0000) + { + m_rtc_regs.time &= 0xfff0ffff; + m_rtc_regs.time += 0x00100000; + } + } + } + } + } + } + m_rtc_regs.timer->adjust(attotime::from_hz(1)); +} + +READ32_MEMBER(pockstat_state::ps_rtc_r) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_rtc_r: RTC Mode = %08x & %08x\n", m_rtc_regs.mode, mem_mask ); + return m_rtc_regs.mode; + case 0x0004/4: + verboselog(0, "ps_rtc_r: RTC Control = %08x & %08x\n", m_rtc_regs.control, mem_mask ); + return m_rtc_regs.control; + case 0x0008/4: + verboselog(0, "ps_rtc_r: RTC Time = %08x & %08x\n", m_rtc_regs.time, mem_mask ); + return m_rtc_regs.time; + case 0x000c/4: + verboselog(0, "ps_rtc_r: RTC Date = %08x & %08x\n", m_rtc_regs.date, mem_mask ); + return m_rtc_regs.date; + default: + verboselog(0, "ps_rtc_r: Unknown Register %08x & %08x\n", 0x0b800000 + (offset << 2), mem_mask ); + break; + } + return 0; +} + +WRITE32_MEMBER(pockstat_state::ps_rtc_w) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_rtc_w: RTC Mode = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_rtc_regs.mode); + break; + case 0x0004/4: + verboselog(0, "ps_rtc_w: RTC Control = %08x & %08x\n", data, mem_mask ); + if(m_rtc_regs.control == 1 && data == 1) + { + switch(m_rtc_regs.mode >> 1) + { + case 0: // Seconds + m_rtc_regs.time += 0x00000001; + if((m_rtc_regs.time & 0x0000000f) == 0x0000000a) + { + m_rtc_regs.time &= 0xfffffff0; + m_rtc_regs.time += 0x00000010; + if((m_rtc_regs.time & 0x000000ff) == 0x00000060) + { + m_rtc_regs.time &= 0xffffff00; + } + } + break; + case 1: // Minutes + m_rtc_regs.time += 0x00000100; + if((m_rtc_regs.time & 0x00000f00) == 0x00000a00) + { + m_rtc_regs.time &= 0xfffff0ff; + m_rtc_regs.time += 0x00001000; + if((m_rtc_regs.time & 0x0000ff00) == 0x00006000) + { + m_rtc_regs.time &= 0xffff00ff; + } + } + break; + case 2: // Hours + m_rtc_regs.time += 0x00010000; + if((m_rtc_regs.time & 0x00ff0000) == 0x00240000) + { + m_rtc_regs.time &= 0xff00ffff; + } + else if((m_rtc_regs.time & 0x000f0000) == 0x000a0000) + { + m_rtc_regs.time &= 0xfff0ffff; + m_rtc_regs.time += 0x00100000; + } + break; + case 3: // Day of the week + m_rtc_regs.time += 0x01000000; + if((m_rtc_regs.time & 0x0f000000) == 0x08000000) + { + m_rtc_regs.time &= 0xf0ffffff; + m_rtc_regs.time |= 0x01000000; + } + break; + case 4: // Day + m_rtc_regs.date += 0x00000001; + if((m_rtc_regs.date & 0x000000ff) == 0x00000032) + { + m_rtc_regs.date &= 0xffffff00; + } + else if((m_rtc_regs.date & 0x0000000f) == 0x0000000a) + { + m_rtc_regs.date &= 0xfffffff0; + m_rtc_regs.date += 0x00000010; + } + break; + case 5: // Month + m_rtc_regs.date += 0x00000100; + if((m_rtc_regs.date & 0x0000ff00) == 0x00001300) + { + m_rtc_regs.date &= 0xffffff00; + m_rtc_regs.date |= 0x00000001; + } + else if((m_rtc_regs.date & 0x00000f00) == 0x00000a00) + { + m_rtc_regs.date &= 0xfffff0ff; + m_rtc_regs.date += 0x00001000; + } + break; + case 6: // Year (LSB) + m_rtc_regs.date += 0x00010000; + if((m_rtc_regs.date & 0x000f0000) == 0x000a0000) + { + m_rtc_regs.date &= 0xfff0ffff; + m_rtc_regs.date += 0x00100000; + if((m_rtc_regs.date & 0x00f00000) == 0x00a00000) + { + m_rtc_regs.date &= 0xff00ffff; + } + } + break; + case 7: // Year (MSB) + break; + } + m_rtc_regs.control = 0; + } + else if(m_rtc_regs.control == 0) + { + COMBINE_DATA(&m_rtc_regs.control); + } + break; + default: + verboselog(0, "ps_rtc_w: Unknown Register %08x = %08x & %08x\n", 0x0b800000 + (offset << 2), data, mem_mask ); + break; + } +} + + +READ32_MEMBER(pockstat_state::ps_lcd_r) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_lcd_r: LCD Control = %08x & %08x\n", m_lcd_control | 0x100, mem_mask ); + return m_lcd_control; + default: + verboselog(0, "ps_lcd_r: Unknown Register %08x & %08x\n", 0x0d000000 + (offset << 2), mem_mask ); + break; + } + return 0; +} + +WRITE32_MEMBER(pockstat_state::ps_lcd_w) +{ + switch(offset) + { + case 0x0000/4: + verboselog(0, "ps_lcd_w: LCD Control = %08x & %08x\n", data, mem_mask ); + COMBINE_DATA(&m_lcd_control); + break; + default: + verboselog(0, "ps_lcd_w: Unknown Register %08x = %08x & %08x\n", 0x0d000000 + (offset << 2), data, mem_mask ); + break; + } +} + +INPUT_CHANGED_MEMBER(pockstat_state::input_update) +{ + UINT32 buttons = ioport("BUTTONS")->read(); + + ps_intc_set_interrupt_line(PS_INT_BTN_ACTION, (buttons & 1) ? 1 : 0); + ps_intc_set_interrupt_line(PS_INT_BTN_RIGHT, (buttons & 2) ? 1 : 0); + ps_intc_set_interrupt_line(PS_INT_BTN_LEFT, (buttons & 4) ? 1 : 0); + ps_intc_set_interrupt_line(PS_INT_BTN_DOWN, (buttons & 8) ? 1 : 0); + ps_intc_set_interrupt_line(PS_INT_BTN_UP, (buttons & 16) ? 1 : 0); +} + +READ32_MEMBER(pockstat_state::ps_rombank_r) +{ + INT32 bank = (offset >> 11) & 0x0f; + for (int index = 0; index < 32; index++) + { + if (m_ftlb_regs.valid & (1 << index)) + { + if (m_ftlb_regs.entry[index] == bank) + { + //printf( "Address %08x is assigned to %08x in entry %d\n", 0x02000000 + (offset << 2), index * 0x2000 + ((offset << 2) & 0x1fff), index ); + return m_cart->read32_rom(space, index * (0x2000/4) + (offset & (0x1fff/4)), mem_mask); + } + } + } + return m_cart->read32_rom(space, offset & 0x7fff, mem_mask); +} + + +// Horrible hack, probably wrong +WRITE32_MEMBER(pockstat_state::ps_flash_w) +{ + if(offset == (0x55a8/4)) + { + m_ps_flash_write_enable_count++; + return; + } + if(offset == (0x2a54/4)) + { + m_ps_flash_write_enable_count++; + return; + } + if(m_ps_flash_write_enable_count == 3) + { + m_ps_flash_write_enable_count = 0; + m_ps_flash_write_count = 0x40; + return; + } + if(m_ps_flash_write_count) + { + m_ps_flash_write_count--; + COMBINE_DATA(&((UINT32*)(m_cart_rom->base()))[offset]); + } +} + +READ32_MEMBER(pockstat_state::ps_flash_r) +{ + return m_cart->read32_rom(space, offset, mem_mask); +} + +READ32_MEMBER(pockstat_state::ps_audio_r) +{ + verboselog(0, "ps_audio_r: Unknown Read: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), 0x10, mem_mask); + return 0; +} + +WRITE32_MEMBER(pockstat_state::ps_audio_w) +{ + verboselog(0, "ps_audio_w: Unknown Write: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), data, mem_mask); +} + +WRITE32_MEMBER(pockstat_state::ps_dac_w) +{ + m_dac->write_unsigned16((UINT16)((data + 0x8000) & 0x0000ffff)); +} + +static ADDRESS_MAP_START(pockstat_mem, AS_PROGRAM, 32, pockstat_state ) + AM_RANGE(0x00000000, 0x000007ff) AM_RAM + AM_RANGE(0x02000000, 0x02ffffff) AM_READ(ps_rombank_r) + AM_RANGE(0x04000000, 0x04003fff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x06000000, 0x06000307) AM_READWRITE(ps_ftlb_r, ps_ftlb_w) + AM_RANGE(0x08000000, 0x0801ffff) AM_READWRITE(ps_flash_r, ps_flash_w) + AM_RANGE(0x0a000000, 0x0a000013) AM_READWRITE(ps_intc_r, ps_intc_w) + AM_RANGE(0x0a800000, 0x0a80002b) AM_READWRITE(ps_timer_r, ps_timer_w) + AM_RANGE(0x0b000000, 0x0b000007) AM_READWRITE(ps_clock_r, ps_clock_w) + AM_RANGE(0x0b800000, 0x0b80000f) AM_READWRITE(ps_rtc_r, ps_rtc_w) + AM_RANGE(0x0d000000, 0x0d000003) AM_READWRITE(ps_lcd_r, ps_lcd_w) + AM_RANGE(0x0d000100, 0x0d00017f) AM_RAM AM_SHARE("lcd_buffer") + AM_RANGE(0x0d80000c, 0x0d80000f) AM_READWRITE(ps_audio_r, ps_audio_w) + AM_RANGE(0x0d800014, 0x0d800017) AM_WRITE(ps_dac_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pockstat ) + PORT_START("BUTTONS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Action Button") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("Left") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("Down") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("Up") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) + PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +void pockstat_state::machine_start() +{ + int index = 0; + for (index = 0; index < 3; index++) + { + m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::timer_tick),this)); + m_timer_regs.timer[index].timer->adjust(attotime::never, index); + } + + m_rtc_regs.time = 0x01000000; + m_rtc_regs.date = 0x19990101; + + m_rtc_regs.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::rtc_tick),this)); + m_rtc_regs.timer->adjust(attotime::from_hz(1), index); + + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + save_item(NAME(m_ftlb_regs.control)); + save_item(NAME(m_ftlb_regs.stat)); + save_item(NAME(m_ftlb_regs.valid)); + save_item(NAME(m_ftlb_regs.wait1)); + save_item(NAME(m_ftlb_regs.wait2)); + save_item(NAME(m_ftlb_regs.entry)); + + save_item(NAME(m_intc_regs.hold)); + save_item(NAME(m_intc_regs.status)); + save_item(NAME(m_intc_regs.enable)); + save_item(NAME(m_intc_regs.mask)); + + save_item(NAME(m_timer_regs.timer[0].period)); + save_item(NAME(m_timer_regs.timer[0].count)); + save_item(NAME(m_timer_regs.timer[0].control)); + save_item(NAME(m_timer_regs.timer[1].period)); + save_item(NAME(m_timer_regs.timer[1].count)); + save_item(NAME(m_timer_regs.timer[1].control)); + save_item(NAME(m_timer_regs.timer[2].period)); + save_item(NAME(m_timer_regs.timer[2].count)); + save_item(NAME(m_timer_regs.timer[2].control)); + + save_item(NAME(m_clock_regs.mode)); + save_item(NAME(m_clock_regs.control)); + + save_item(NAME(m_rtc_regs.mode)); + save_item(NAME(m_rtc_regs.control)); + save_item(NAME(m_rtc_regs.time)); + save_item(NAME(m_rtc_regs.date)); + + save_item(NAME(m_ps_flash_write_enable_count)); + save_item(NAME(m_ps_flash_write_count)); + + save_item(NAME(m_lcd_control)); +} + +void pockstat_state::machine_reset() +{ + m_maincpu->set_state_int(ARM7_R15, 0x4000000); + + m_ps_flash_write_enable_count = 0; + m_ps_flash_write_count = 0; +} + +UINT32 pockstat_state::screen_update_pockstat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + for (int y = 0; y < 32; y++) + { + UINT32 *scanline = &bitmap.pix32(y); + for (int x = 0; x < 32; x++) + { + if (m_lcd_control != 0) // Hack + { + if (m_lcd_buffer[y] & (1 << x)) + scanline[x] = 0x00000000; + else + scanline[x] = 0x00ffffff; + } + else + scanline[x] = 0x00ffffff; + } + } + return 0; +} + +DEVICE_IMAGE_LOAD_MEMBER( pockstat_state, pockstat_flash ) +{ + static const char *gme_id = "123-456-STD"; + char cart_id[0xf40]; + UINT32 size = image.length(); + + if (size != 0x20f40) + return IMAGE_INIT_FAIL; + + image.fread(cart_id, 0xf40); + + for (int i = 0; i < strlen(gme_id); i++) + { + if (cart_id[i] != gme_id[i]) + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(0x20000, GENERIC_ROM32_WIDTH, ENDIANNESS_LITTLE); + image.fread(m_cart->get_rom_base(), 0x20000); + + return IMAGE_INIT_PASS; +} + +static MACHINE_CONFIG_START( pockstat, pockstat_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", ARM7, DEFAULT_CLOCK) + MCFG_CPU_PROGRAM_MAP(pockstat_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(32, 32) + MCFG_SCREEN_VISIBLE_AREA(0, 32-1, 0, 32-1) + MCFG_SCREEN_UPDATE_DRIVER(pockstat_state, screen_update_pockstat) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pockstat_cart") + MCFG_GENERIC_EXTENSIONS("gme") + MCFG_GENERIC_WIDTH(GENERIC_ROM32_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_LITTLE) + MCFG_GENERIC_LOAD(pockstat_state, pockstat_flash) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pockstat ) + ROM_REGION( 0x4000, "maincpu", 0 ) + ROM_LOAD( "kernel.bin", 0x0000, 0x4000, CRC(5fb47dd8) SHA1(6ae880493ddde880827d1e9f08e9cb2c38f9f2ec) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1999, pockstat, 0, 0, pockstat, pockstat, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PocketStation", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/poisk1.c b/src/mame/drivers/poisk1.c new file mode 100644 index 00000000000..fce63ee23ac --- /dev/null +++ b/src/mame/drivers/poisk1.c @@ -0,0 +1,314 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + drivers/poisk1.c + + Driver file for Poisk-1 + +***************************************************************************/ + +#include "emu.h" + +#include "includes/poisk1.h" +#include "machine/kb_poisk1.h" + +#include "cpu/i86/i86.h" + +#define CGA_PALETTE_SETS 83 +/* one for colour, one for mono, 81 for colour composite */ + +#define VERBOSE_DBG 0 + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + +/* + * onboard devices: + */ + +// Timer. Poisk-1 uses single XTAL for everything? -- check + +WRITE_LINE_MEMBER( p1_state::p1_speaker_set_spkrdata ) +{ + m_p1_spkrdata = state ? 1 : 0; + m_speaker->level_w(m_p1_spkrdata & m_p1_input); +} + +WRITE_LINE_MEMBER( p1_state::p1_pit8253_out2_changed ) +{ + m_p1_input = state ? 1 : 0; + m_speaker->level_w(m_p1_spkrdata & m_p1_input); +} + +// Keyboard (via PPI) + +WRITE8_MEMBER(p1_state::p1_ppi_porta_w) +{ + m_kbpoll_mask = data; + DBG_LOG(2,"p1_ppi_porta_w",("( %02X -> %02X )\n", data, m_kbpoll_mask)); +} + +READ8_MEMBER(p1_state::p1_ppi_porta_r) +{ + UINT8 ret; + + ret = m_kbpoll_mask; + DBG_LOG(1,"p1_ppi_porta_r",("= %02X\n", ret)); + return ret; +} + +READ8_MEMBER(p1_state::p1_ppi_portb_r) +{ + UINT16 key = 0xffff; + UINT8 ret = 0; + + if (m_kbpoll_mask & 0x01) { key &= ioport("Y1")->read(); } + if (m_kbpoll_mask & 0x02) { key &= ioport("Y2")->read(); } + if (m_kbpoll_mask & 0x04) { key &= ioport("Y3")->read(); } + if (m_kbpoll_mask & 0x08) { key &= ioport("Y4")->read(); } + if (m_kbpoll_mask & 0x10) { key &= ioport("Y5")->read(); } + if (m_kbpoll_mask & 0x20) { key &= ioport("Y6")->read(); } + if (m_kbpoll_mask & 0x40) { key &= ioport("Y7")->read(); } + if (m_kbpoll_mask & 0x80) { key &= ioport("Y8")->read(); } + ret = key & 0xff; +// DBG_LOG(1,"p1_ppi_portb_r",("= %02X\n", ret)); + return ret; +} + +READ8_MEMBER(p1_state::p1_ppi_portc_r) +{ + UINT16 key = 0xffff; + UINT8 ret = 0; + + if (m_kbpoll_mask & 0x01) { key &= ioport("Y1")->read(); } + if (m_kbpoll_mask & 0x02) { key &= ioport("Y2")->read(); } + if (m_kbpoll_mask & 0x04) { key &= ioport("Y3")->read(); } + if (m_kbpoll_mask & 0x08) { key &= ioport("Y4")->read(); } + if (m_kbpoll_mask & 0x10) { key &= ioport("Y5")->read(); } + if (m_kbpoll_mask & 0x20) { key &= ioport("Y6")->read(); } + if (m_kbpoll_mask & 0x40) { key &= ioport("Y7")->read(); } + if (m_kbpoll_mask & 0x80) { key &= ioport("Y8")->read(); } + ret = (key >> 8) & 0xff; + DBG_LOG(2,"p1_ppi_portc_r",("= %02X\n", ret)); + return ret; +} + +// XXX + +READ8_MEMBER(p1_state::p1_ppi2_portc_r) +{ + int data = 0xff; + double tap_val = m_cassette->input(); + + data = ( data & ~0x10 ) | ( tap_val < 0 ? 0x10 : 0x00 ); + + DBG_LOG(2,"p1_ppi_portc_r",("= %02X (tap_val %f) at %s\n", + data, tap_val, machine().describe_context())); + return data; +} + +WRITE8_MEMBER(p1_state::p1_ppi2_portb_w) +{ + m_pit8253->write_gate2(BIT(data, 0)); + p1_speaker_set_spkrdata( data & 0x02 ); +} + +READ8_MEMBER(p1_state::p1_ppi_r) +{ +// DBG_LOG(1,"p1ppi",("R %.2x\n", 0x60+offset)); + switch (offset) { + case 0: + return m_ppi8255n1->read(space, 0); + case 9: + case 10: + case 11: + return m_ppi8255n1->read(space, offset - 8); + case 8: + return m_ppi8255n2->read(space, 0); + case 1: + case 2: + case 3: + return m_ppi8255n2->read(space, offset); + default: + DBG_LOG(1,"p1ppi",("R %.2x (unimp)\n", 0x60+offset)); + return 0xff; + } +} + +WRITE8_MEMBER(p1_state::p1_ppi_w) +{ +// DBG_LOG(1,"p1ppi",("W %.2x $%02x\n", 0x60+offset, data)); + switch (offset) { + case 0: + return m_ppi8255n1->write(space, 0, data); + case 9: + case 10: + case 11: + return m_ppi8255n1->write(space, offset - 8, data); + case 8: + return m_ppi8255n2->write(space, 0, data); + case 1: + case 2: + case 3: + return m_ppi8255n2->write(space, offset, data); + default: + DBG_LOG(1,"p1ppi",("W %.2x $%02x (unimp)\n", 0x60+offset, data)); + return; + } +} + +/********************************************************** + * + * NMI handling + * + **********************************************************/ + +DRIVER_INIT_MEMBER( p1_state, poisk1 ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + DBG_LOG(0,"init",("driver_init()\n")); + + program.unmap_readwrite(0, 0x7ffff); + program.install_readwrite_bank(0, m_ram->size()-1, "bank10"); + membank( "bank10" )->set_base( m_ram->pointer() ); +} + +MACHINE_START_MEMBER( p1_state, poisk1 ) +{ + DBG_LOG(0,"init",("machine_start()\n")); +} + +MACHINE_RESET_MEMBER( p1_state, poisk1 ) +{ + DBG_LOG(0,"init",("machine_reset()\n")); + + m_kbpoll_mask = 0; +} + +/* + * macros + */ + +static ADDRESS_MAP_START( poisk1_map, AS_PROGRAM, 8, p1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x7ffff) AM_RAM + AM_RANGE(0xc0000, 0xc1fff) AM_ROM + AM_RANGE(0xc0000, 0xfbfff) AM_NOP + AM_RANGE(0xfc000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( poisk1_io, AS_IO, 8, p1_state ) + AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) + AM_RANGE(0x0028, 0x002B) AM_READWRITE(p1_trap_r, p1_trap_w) + AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + // can't use regular AM_DEVREADWRITE, because THIS IS SPARTA! + // 1st PPI occupies ports 60, 69, 6A and 6B; 2nd PPI -- 68, 61, 62 and 63. + AM_RANGE(0x0060, 0x006F) AM_READWRITE(p1_ppi_r, p1_ppi_w) + AM_RANGE(0x03D0, 0x03DF) AM_READWRITE(p1_cga_r, p1_cga_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( poisk1 ) + PORT_INCLUDE( poisk1_keyboard_v91 ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( poisk1, p1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8088, 5000000) + MCFG_CPU_PROGRAM_MAP(poisk1_map) + MCFG_CPU_IO_MAP(poisk1_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + MCFG_MACHINE_START_OVERRIDE( p1_state, poisk1 ) + MCFG_MACHINE_RESET_OVERRIDE( p1_state, poisk1 ) + + MCFG_DEVICE_ADD( "pit8253", PIT8253 ,0) + MCFG_PIT8253_CLK0(XTAL_15MHz/12) /* heartbeat IRQ */ + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_15MHz/12) /* keyboard poll -- XXX edge or level triggered? */ + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir6_w)) + MCFG_PIT8253_CLK2(XTAL_15MHz/12) /* pio port c pin 4, and speaker polling enough */ + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(p1_state, p1_pit8253_out2_changed)) + + MCFG_PIC8259_ADD( "pic8259", INPUTLINE(":maincpu", 0), VCC, NULL ) + + MCFG_DEVICE_ADD("ppi8255n1", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(p1_state, p1_ppi_porta_r)) /*60H*/ + MCFG_I8255_OUT_PORTA_CB(WRITE8(p1_state, p1_ppi_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(p1_state, p1_ppi_portb_r)) /*69H*/ + MCFG_I8255_IN_PORTC_CB(READ8(p1_state, p1_ppi_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(p1_state, p1_ppi_portc_w)) /*6AH*/ + + MCFG_DEVICE_ADD("ppi8255n2", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(p1_state, p1_ppi2_porta_w)) /*68H*/ + MCFG_I8255_OUT_PORTB_CB(WRITE8(p1_state, p1_ppi2_portb_w)) /*61H*/ + MCFG_I8255_IN_PORTC_CB(READ8(p1_state, p1_ppi2_portc_r)) /*62H*/ + + MCFG_DEVICE_ADD("isa", ISA8, 0) + MCFG_ISA8_CPU(":maincpu") + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("pic8259", pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) + MCFG_ISA8_SLOT_ADD("isa", "isa1", p1_isa8_cards, "fdc", false) + MCFG_ISA8_SLOT_ADD("isa", "isa2", p1_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("isa", "isa3", p1_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("isa", "isa4", p1_isa8_cards, NULL, false) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "speaker", SPEAKER_SOUND, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_RAW_PARAMS( XTAL_15MHz, 912,0,640, 262,0,200 ) + MCFG_SCREEN_UPDATE_DRIVER( p1_state, screen_update ) + + /* XXX verify palette */ + MCFG_PALETTE_ADD("palette", CGA_PALETTE_SETS * 16 ) + MCFG_PALETTE_INIT_OWNER(p1_state, p1) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") +MACHINE_CONFIG_END + +ROM_START( poisk1 ) + ROM_REGION16_LE(0x100000,"maincpu", 0) + + ROM_DEFAULT_BIOS("v91") + ROM_SYSTEM_BIOS(0, "v89", "1989") + ROMX_LOAD( "biosp1s.rf4", 0xfe000, 0x2000, CRC(1a85f671) SHA1(f0e59b2c4d92164abca55a96a58071ce869ff988), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v91", "1991") + ROMX_LOAD( "poisk_1991.bin", 0xfe000, 0x2000, CRC(d61c56fd) SHA1(de202e1f7422d585a1385a002a4fcf9d756236e5), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v91r2", "1991r2") + ROMX_LOAD( "p_bios_nm.bin", 0xfe000, 0x2000, CRC(84430b4f) SHA1(3e477962be3cea09662cb2e3ad9966ad01c7455d), ROM_BIOS(3)) + + // 0xc0000, sets 80x25 text and loops asking for 'Boot from hard disk (Y or N)?' + ROM_LOAD( "boot_net.rf4", 0x00000, 0x2000, CRC(316c2030) SHA1(d043325596455772252e465b85321f1b5c529d0b)) // NET BIOS + // 0xc0000, accesses ports 0x90..0x97 + ROM_LOAD( "pois_net.bin", 0x00000, 0x2000, CRC(cf9dd80a) SHA1(566bcb40c0cb2c8bfd5b485f0db689fdeaca3e86)) // ??? BIOS + + ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) + ROM_LOAD( "poisk.cga", 0x0000, 0x0800, CRC(f6eb39f0) SHA1(0b788d8d7a8e92cc612d044abcb2523ad964c200)) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1989, poisk1, ibm5150, 0, poisk1, poisk1, p1_state, poisk1, "Electronmash", "Poisk-1", 0) diff --git a/src/mame/drivers/pokemini.c b/src/mame/drivers/pokemini.c new file mode 100644 index 00000000000..65c63fabe0b --- /dev/null +++ b/src/mame/drivers/pokemini.c @@ -0,0 +1,1798 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/******************************************************************** + +Driver file to handle emulation of the Nintendo Pokemon Mini handheld +by Wilbert Pol. + +The LCD is likely to be a SSD1828 LCD. + +********************************************************************/ + +#include "emu.h" +#include "sound/speaker.h" +#include "machine/i2cmem.h" +#include "cpu/minx/minx.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "rendlay.h" + + +struct PRC +{ + UINT8 colors_inverted; + UINT8 background_enabled; + UINT8 sprites_enabled; + UINT8 copy_enabled; + UINT8 map_size; + UINT8 map_size_x; + UINT8 frame_count; + UINT8 max_frame_count; + UINT32 bg_tiles; + UINT32 spr_tiles; + UINT8 count; + emu_timer *count_timer; +}; + + +struct TIMERS +{ + emu_timer *seconds_timer; + emu_timer *hz256_timer; + emu_timer *timer1; /* Timer 1 low or 16bit */ + emu_timer *timer1_hi; /* Timer 1 hi */ + emu_timer *timer2; /* Timer 2 low or 16bit */ + emu_timer *timer2_hi; /* Timer 2 high */ + emu_timer *timer3; /* Timer 3 low or 16bit */ + emu_timer *timer3_hi; /* Timer 3 high */ +}; + + +class pokemini_state : public driver_device +{ +public: + pokemini_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_p_ram(*this, "p_ram"), + m_speaker(*this, "speaker"), + m_i2cmem(*this, "i2cmem"), + m_cart(*this, "cartslot"), + m_inputs(*this, "INPUTS") + { } + + UINT8 m_pm_reg[0x100]; + PRC m_prc; + TIMERS m_timers; + bitmap_ind16 m_bitmap; + virtual void video_start(); + virtual void machine_start(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_PALETTE_INIT(pokemini); + DECLARE_WRITE8_MEMBER(hwreg_w); + DECLARE_READ8_MEMBER(hwreg_r); + DECLARE_READ8_MEMBER(rom_r); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pokemini_cart); + +protected: + enum + { + TIMER_SECONDS, + TIMER_256HZ, + TIMER_1, + TIMER_1_HI, + TIMER_2, + TIMER_2_HI, + TIMER_3, + TIMER_3_HI, + TIMER_PRC + }; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + required_device m_maincpu; + required_shared_ptr m_p_ram; + required_device m_speaker; + required_device m_i2cmem; + required_device m_cart; + required_ioport m_inputs; + + void check_irqs(); + void update_sound(); + void seconds_timer_callback(); + void timer_256hz_callback(); + void timer1_callback(); + void timer1_hi_callback(); + void timer2_callback(); + void timer2_hi_callback(); + void timer3_callback(); + void timer3_hi_callback(); + void prc_counter_callback(); + +}; + + +READ8_MEMBER( pokemini_state::rom_r ) +{ + offset += 0x2100; + return m_cart->read_rom(space, offset & 0x1fffff); +} + +static ADDRESS_MAP_START( pokemini_mem_map, AS_PROGRAM, 8, pokemini_state ) + AM_RANGE( 0x000000, 0x000fff ) AM_ROM /* bios */ + AM_RANGE( 0x001000, 0x001fff ) AM_RAM AM_SHARE("p_ram") /* VRAM/RAM */ + AM_RANGE( 0x002000, 0x0020ff ) AM_READWRITE(hwreg_r, hwreg_w) /* hardware registers */ + AM_RANGE( 0x002100, 0x1fffff ) AM_READ(rom_r) /* cartridge area */ +ADDRESS_MAP_END + + +static INPUT_PORTS_START( pokemini ) + PORT_START("INPUTS") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button A") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button B") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Button C") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1) PORT_NAME("Power") +INPUT_PORTS_END + + +PALETTE_INIT_MEMBER(pokemini_state, pokemini) +{ + palette.set_pen_color(0, rgb_t(0xff, 0xfb, 0x87)); + palette.set_pen_color(1, rgb_t(0xb1, 0xae, 0x4e)); + palette.set_pen_color(2, rgb_t(0x84, 0x80, 0x4e)); + palette.set_pen_color(3, rgb_t(0x4e, 0x4e, 0x4e)); +} + + +void pokemini_state::check_irqs() +{ + int irq_set[4] = { 1, 0, 0, 0 }; + int prio, vector; + + /* Check IRQ $03-$04 */ + prio = ( m_pm_reg[0x20] >> 6 ) & 0x03; + if ( ! irq_set[prio] ) + { + if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x40 ) + irq_set[prio] = 0x04; + + if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x80 ) + irq_set[prio] = 0x03; + } + + /* Check IRQ $05-$06 */ + prio = ( m_pm_reg[0x20] >> 4 ) & 0x03; + if ( ! irq_set[prio] ) + { + if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x10 ) + irq_set[prio] = 0x06; + + if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x20 ) + irq_set[prio] = 0x05; + } + + /* Check IRQ $07-$08 */ + prio = ( m_pm_reg[0x20] >> 2 ) & 0x03; + if ( ! irq_set[prio] ) + { + if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x04 ) + irq_set[prio] = 0x08; + + if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x08 ) + irq_set[prio] = 0x07; + } + + /* Check IRQ $09-$0A */ + prio = ( m_pm_reg[0x20] >> 0 ) & 0x03; + if ( ! irq_set[prio] ) + { + if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x01 ) + irq_set[prio] = 0x0A; + + if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x02 ) + irq_set[prio] = 0x09; + } + + /* Check IRQ $0B-$0E */ + prio = ( m_pm_reg[0x21] >> 6 ) & 0x03; + if ( ! irq_set[prio] ) + { + if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x04 ) + irq_set[prio] = 0x0E; + + if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x08 ) + irq_set[prio] = 0x0D; + + if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x10 ) + irq_set[prio] = 0x0C; + + if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x20 ) + irq_set[prio] = 0x0B; + } + + /* Check IRQ $0F-$10 */ + prio = ( m_pm_reg[0x22] >> 0 ) & 0x03; + if ( ! irq_set[prio] ) + { + if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x40 ) + irq_set[prio] = 0x10; + + if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x80 ) + irq_set[prio] = 0x0F; + } + + /* Check IRQ $13-$14 */ + prio = ( m_pm_reg[0x21] >> 4 ) & 0x03; + if ( ! irq_set[prio] ) + { + if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x01 ) + irq_set[prio] = 0x14; + + if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x02 ) + irq_set[prio] = 0x13; + } + + /* Check IRQ $15-$1C */ + prio = ( m_pm_reg[0x21] >> 2 ) & 0x03; + if ( ! irq_set[prio] ) + { + if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x01 ) + irq_set[prio] = 0x1C; + + if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x02 ) + irq_set[prio] = 0x1B; + + if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x04 ) + irq_set[prio] = 0x1A; + + if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x08 ) + irq_set[prio] = 0x19; + + if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x10 ) + irq_set[prio] = 0x18; + + if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x20 ) + irq_set[prio] = 0x17; + + if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x40 ) + irq_set[prio] = 0x16; + + if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x80 ) + irq_set[prio] = 0x15; + } + + /* Check IRQ $1D-$1F */ + prio = ( m_pm_reg[0x21] >> 0 ) & 0x03; + if ( ! irq_set[prio] && ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x07 ) ) + { + if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x01 ) + irq_set[prio] = 0x1F; + + if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x02 ) + irq_set[prio] = 0x1E; + + if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x04 ) + irq_set[prio] = 0x1D; + } + + /* Determine vector */ + vector = 0; + if ( irq_set[1] ) + vector = irq_set[1]; + if ( irq_set[2] ) + vector = irq_set[2]; + if ( irq_set[3] ) + vector = irq_set[3]; + + if ( vector ) + { + //logerror("Triggering IRQ with vector %02x\n", vector ); + /* Trigger interrupt and set vector */ + m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, vector ); + } + else + { + m_maincpu->set_input_line(0, CLEAR_LINE ); + } +} + + +void pokemini_state::update_sound() +{ + /* Check if sound should be muted */ + if ( m_pm_reg[0x70] & 0x03 ) + { + m_speaker->level_w(0); + } + else + { + ///static const int levels[4] = { 0, 1, 1, 2 }; + int level; /// silence clang warning/// = levels[ m_pm_reg[0x71] & 0x03 ]; + +// if ( ( ( m_pm_reg[0x48] & 0x80 ) && ( m_pm_reg[0x4E] | ( m_pm_reg[0x4F] << 8 ) ) > ( m_pm_reg[0x4C] | ( m_pm_reg[0x4D] << 8 ) ) ) +// || ( ( m_pm_reg[0x48] & 0x80 ) && m_pm_reg[0x4F] > m_pm_reg[0x4D] ) ) +// { + level = 0; +// } + + m_speaker->level_w(level); + } +} + + +void pokemini_state::seconds_timer_callback() +{ + if ( m_pm_reg[0x08] & 0x01 ) + { + m_pm_reg[0x09] += 1; + if ( ! m_pm_reg[0x09] ) + { + m_pm_reg[0x0A] += 1; + if ( ! m_pm_reg[0x0A] ) + { + m_pm_reg[0x0B] += 1; + } + } + } +} + + +void pokemini_state::timer_256hz_callback() +{ + if ( m_pm_reg[0x40] & 0x01 ) + { + m_pm_reg[0x41] += 1; + /* Check if the 32Hz IRQ should be triggered */ + if ( ! ( m_pm_reg[0x41] & 0x07 ) ) + { + m_pm_reg[0x28] |= 0x20; + + /* Check if the 8Hz IRQ should be triggered */ + if ( ! ( m_pm_reg[0x41] & 0x1F ) ) + { + m_pm_reg[0x28] |= 0x10; + + /* Check if the 2Hz IRQ should be triggered */ + if ( ! ( m_pm_reg[0x41] & 0x7F ) ) + { + m_pm_reg[0x28] |= 0x08; + + /* Check if the 1Hz IRQ should be triggered */ + if ( ! m_pm_reg[0x41] ) + { + m_pm_reg[0x28] |= 0x04; + } + } + } + + check_irqs(); + } + } +} + + +void pokemini_state::timer1_callback() +{ + m_pm_reg[0x36] -= 1; + /* Check for underflow of timer */ + if ( m_pm_reg[0x36] == 0xFF ) + { + /* Check if timer1 is running in 16bit mode */ + if ( m_pm_reg[0x30] & 0x80 ) + { + m_pm_reg[0x37] -= 1; + if ( m_pm_reg[0x37] == 0xFF ) + { + m_pm_reg[0x27] |= 0x08; + check_irqs(); + m_pm_reg[0x36] = m_pm_reg[0x32]; + m_pm_reg[0x37] = m_pm_reg[0x33]; + } + } + else + { + m_pm_reg[0x27] |= 0x04; + check_irqs(); + m_pm_reg[0x36] = m_pm_reg[0x32]; + } + } +} + + +void pokemini_state::timer1_hi_callback() +{ + m_pm_reg[0x37] -= 1; + /* Check for underflow of timer */ + if ( m_pm_reg[0x37] == 0xFF ) + { + m_pm_reg[0x27] |= 0x08; + check_irqs(); + m_pm_reg[0x37] = m_pm_reg[0x33]; + } +} + + +void pokemini_state::timer2_callback() +{ + m_pm_reg[0x3E] -= 1; + /* Check for underflow of timer */ + if ( m_pm_reg[0x3E] == 0xFF ) + { + /* Check if timer2 is running in 16bit mode */ + if ( m_pm_reg[0x38] & 0x80 ) + { + m_pm_reg[0x3F] -= 1; + if ( m_pm_reg[0x3F] == 0xFF ) + { + m_pm_reg[0x27] |= 0x20; + check_irqs(); + m_pm_reg[0x3E] = m_pm_reg[0x3A]; + m_pm_reg[0x3F] = m_pm_reg[0x3B]; + } + } + else + { + m_pm_reg[0x27] |= 0x10; + check_irqs(); + m_pm_reg[0x3E] = m_pm_reg[0x3A]; + } + } +} + + +void pokemini_state::timer2_hi_callback() +{ + m_pm_reg[0x3F] -= 1; + /* Check for underfow of timer */ + if ( m_pm_reg[0x3F] == 0xFF ) + { + m_pm_reg[0x27] |= 0x20; + check_irqs(); + m_pm_reg[0x3F] = m_pm_reg[0x3B]; + } +} + + +void pokemini_state::timer3_callback() +{ + m_pm_reg[0x4E] -= 1; + /* Check for underflow of timer */ + if ( m_pm_reg[0x4E] == 0xFF ) + { + /* Check if timer3 is running in 16bit mode */ + if ( m_pm_reg[0x48] & 0x80 ) + { + m_pm_reg[0x4F] -= 1; + if ( m_pm_reg[0x4F] == 0xFF ) + { + m_pm_reg[0x27] |= 0x02; + check_irqs(); + m_pm_reg[0x4E] = m_pm_reg[0x4A]; + m_pm_reg[0x4F] = m_pm_reg[0x4B]; + } + } + else + { + m_pm_reg[0x4E] = m_pm_reg[0x4A]; + } + } + + if ( m_pm_reg[0x48] & 0x80 ) + { + if ( ( m_pm_reg[0x4E] == m_pm_reg[0x4C] ) && ( m_pm_reg[0x4F] == m_pm_reg[0x4D] ) ) + { + m_pm_reg[0x27] |= 0x01; + check_irqs(); + } + update_sound(); + } +} + + +void pokemini_state::timer3_hi_callback() +{ + m_pm_reg[0x4F] -= 1; + /* Check for underflow of timer */ + if ( m_pm_reg[0x4F] == 0xFF ) + { + m_pm_reg[0x27] |= 0x02; + check_irqs(); + m_pm_reg[0x4F] = m_pm_reg[0x4B]; + } + + if ( ! ( m_pm_reg[0x48] & 0x80 ) ) + { + if( m_pm_reg[0x4F] == m_pm_reg[0x4D] ) + { + m_pm_reg[0x27] |= 0x01; + check_irqs(); + } + update_sound(); + } +} + + +WRITE8_MEMBER(pokemini_state::hwreg_w) +{ + static const int timer_to_cycles_fast[8] = { 2, 8, 32, 64, 128, 256, 1024, 4096 }; + static const int timer_to_cycles_slow[8] = { 128, 256, 512, 1024, 2048, 4096, 8192, 16384 }; + + //logerror( "%0X: Write to hardware address: %02X, %02X\n", space.device() .safe_pc( ), offset, data ); + + switch( offset ) + { + case 0x00: /* start-up contrast + Bit 0-1 R/W Must be 1(?) + Bit 2-7 R/W Start up contrast (doesn't affect contrast until after reboot) + */ + case 0x01: /* CPU related? + Bit 0-7 R/W Unknown + */ + case 0x02: /* CPU related? + Bit 0-7 R/W Unknown + */ + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); + break; + case 0x08: /* Seconds-timer control + Bit 0 R/W Timer enable + Bit 1 W Timer reset + Bit 2-7 Unused + */ + if ( data & 0x02 ) + { + m_pm_reg[0x09] = 0x00; + m_pm_reg[0x0A] = 0x00; + m_pm_reg[0x0B] = 0x00; + data &= ~0x02; + } + break; + case 0x09: /* Seconds-timer (low), read only + Bit 0-7 R Seconds timer bit 0-7 + */ + return; + case 0x0A: /* Seconds-timer (mid), read only + Bit 0-7 R Seconds timer bit 8-15 + */ + return; + case 0x0B: /* Seconds-timer (high), read only + Bit 0-7 R Seconds timer bit 16-23 + */ + return; + case 0x10: /* Low power detector + Bit 0-4 R/W Unknown + Bit 5 R Battery status: 0 - battery OK, 1 - battery low + Bit 6-7 Unused + */ + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); + break; + case 0x18: /* Timer 1 pre-scale + enable + Bit 0-2 R/W low timer 1 prescaler select + 000 - 2 or 128 cycles + 001 - 8 or 256 cycles + 010 - 32 or 512 cycles + 011 - 64 or 1024 cycles + 100 - 128 or 2048 cycles + 101 - 256 or 4096 cycles + 110 - 1024 or 8192 cycles + 111 - 4096 or 16384 cycles + Bit 3 R/W Enable low counting + Bit 4-6 R/W high timer 1 prescaler select + Bit 7 R/W Enable high counting + */ + /* Check for prescaler change for the low counter */ + if ( ( data & 0x07 ) != ( m_pm_reg[0x18] & 0x07 ) ) + { + int index = data & 0x07; + int cycles = ( m_pm_reg[0x19] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer1->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + } + + /* Check for prescaler change for the high counter */ + if ( ( data & 0x70 ) != ( m_pm_reg[0x18] & 0x70 ) ) + { + int index = ( data >> 4 ) & 0x07; + int cycles = ( m_pm_reg[0x19] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer1_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + } + + /* Check if timer1 low should be enabled */ + if ( ( data & 0x08 ) && ( m_pm_reg[0x30] & 0x04 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x01 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x01 ) ) ) ) + { + m_timers.timer1->enable( 1 ); + } + else + { + m_timers.timer1->enable( 0 ); + } + + /* Check if timer1 high should be enabled */ + if ( ( data & 0x80 ) && ( m_pm_reg[0x31] & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) ) ) + { + m_timers.timer1_hi->enable( 1 ); + } + else + { + m_timers.timer1_hi->enable( 0 ); + } + break; + case 0x19: /* Timers 1 speed + Bit 0 R/W Select slow timer for timer 1 lo + Bit 1 R/W Select slow timer for timer 1 hi + Bit 2-3 Unused + Bit 4 R/W Enable slow timers + Bit 5 R/W Enable fast timers + Bit 6-7 Unused + */ + /* Check for prescaler change for the high counter */ + if ( ( data & 0x01 ) != ( m_pm_reg[0x19] & 0x01 ) ) + { + int index = m_pm_reg[0x18] & 0x07; + int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer1->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + } + + /* Check for prescaler change for the low counter */ + if ( ( data & 0x02 ) != ( m_pm_reg[0x19] & 0x02 ) ) + { + int index = ( m_pm_reg[0x18] >> 4 ) & 0x07; + int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer1_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + } + + { + int timer1_enable = 0, timer1_hi_enable = 0; + int timer2_enable = 0, timer2_hi_enable = 0; + int timer3_enable = 0, timer3_hi_enable = 0; + + /* Check which fast timers should be enabled */ + if ( data & 0x20 ) + { + if ( ( m_pm_reg[0x18] & 0x08 ) && ( m_pm_reg[0x30] & 0x04 ) && ! ( data & 0x01 ) ) + timer1_enable = 1; + + if ( ( m_pm_reg[0x18] & 0x80 ) && ( m_pm_reg[0x31] & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) && ! ( data & 0x02 ) ) + timer1_hi_enable = 1; + + if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) && ! ( m_pm_reg[0x1B] & 0x01 ) ) + timer2_enable = 1; + + if ( ( m_pm_reg[0x1A] & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) + timer2_hi_enable = 1; + + if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) && ! ( m_pm_reg[0x1D] & 0x01 ) ) + timer3_enable = 1; + + if ( ( m_pm_reg[0x1C] & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) + timer3_hi_enable = 1; + } + + /* Check which slow timers should be enabled */ + if ( data & 0x10 ) + { + if ( ( m_pm_reg[0x18] & 0x08 ) && ( data & 0x01 ) ) + timer1_enable = 1; + + if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x1B] & 0x01 ) ) + timer2_enable = 1; + + if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x1D] & 0x01 ) ) + timer3_enable = 1; + } + m_timers.timer1->enable( timer1_enable ); + m_timers.timer1_hi->enable( timer1_hi_enable ); + m_timers.timer2->enable( timer2_enable ); + m_timers.timer2_hi->enable( timer2_hi_enable ); + m_timers.timer3->enable( timer3_enable ); + m_timers.timer3_hi->enable( timer3_hi_enable ); + } + break; + case 0x1A: /* Timer 2 pre-scale + enable + Bit 0-2 R/W low timer 2 prescaler select + 000 - 2 or 128 cycles + 001 - 8 or 256 cycles + 010 - 32 or 512 cycles + 011 - 64 or 1024 cycles + 100 - 128 or 2048 cycles + 101 - 256 or 4096 cycles + 110 - 1024 or 8192 cycles + 111 - 4096 or 16384 cycles + Bit 3 R/W Enable low counting + Bit 4-6 R/W high timer 2 prescaler select + Bit 7 R/W Enable high counting + */ + /* Check for prescaler change for the low counter */ + if ( ( data & 0x07 ) != ( m_pm_reg[0x1A] & 0x07 ) ) + { + int index = data & 0x07; + int cycles = ( m_pm_reg[0x1B] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer2->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + } + + /* Check for prescaler change for the high counter */ + if ( ( data & 0x70 ) != ( m_pm_reg[0x1A] & 0x70 ) ) + { + int index = ( data >> 4 ) & 0x07; + int cycles = ( m_pm_reg[0x1B] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer2_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + } + + /* Check if timer2 low should be enabled */ + if ( ( data & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x01 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x01 ) ) ) ) + { + m_timers.timer2->enable( 1 ); + } + else + { + m_timers.timer2->enable( 0 ); + } + + /* Check if timer2 high should be enabled */ + if ( ( data & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) ) ) + { + m_timers.timer2_hi->enable( 1 ); + } + else + { + m_timers.timer2_hi->enable( 0 ); + } + break; + case 0x1B: /* Timer 2 speeds + Bit 0 R/W Select slow timer for timer 2 lo + Bit 1 R/W Select slow timer for timer 2 hi + */ + /* Check for prescaler change for the high counter */ + if ( ( data & 0x01 ) != ( m_pm_reg[0x1B] & 0x01 ) ) + { + int index = m_pm_reg[0x1A] & 0x07; + int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer2->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + + if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) ) + { + m_timers.timer2->enable( 1 ); + } + else + { + m_timers.timer2->enable( 0 ); + } + } + + /* Check for prescaler change for the low counter */ + if ( ( data & 0x02 ) != ( m_pm_reg[0x1B] & 0x02 ) ) + { + int index = ( m_pm_reg[0x1A] >> 4 ) & 0x07; + int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer2_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + + if ( ( m_pm_reg[0x1A] & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) ) + { + m_timers.timer2_hi->enable( 1 ); + } + else + { + m_timers.timer2_hi->enable( 0 ); + } + } + break; + case 0x1C: /* Timer 3 pre-scale + enable + Bit 0-2 R/W low timer 3 prescaler select + 000 - 2 or 128 cycles + 001 - 8 or 256 cycles + 010 - 32 or 512 cycles + 011 - 64 or 1024 cycles + 100 - 128 or 2048 cycles + 101 - 256 or 4096 cycles + 110 - 1024 or 8192 cycles + 111 - 4096 or 16384 cycles + Bit 3 R/W Enable low counting + Bit 4-6 R/W high timer 3 prescaler select + Bit 7 R/W Enable high counting + */ + /* Check for prescaler change for the low counter */ + if ( ( data & 0x07 ) != ( m_pm_reg[0x1C] & 0x07 ) ) + { + int index = data & 0x07; + int cycles = ( m_pm_reg[0x1D] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer3->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + } + + /* Check for prescaler change for the high counter */ + if ( ( data & 0x70 ) != ( m_pm_reg[0x1C] & 0x70 ) ) + { + int index = ( data >> 4 ) & 0x07; + int cycles = ( m_pm_reg[0x1D] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer3_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + } + + /* Check if timer2 low should be enabled */ + if ( ( data & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x01 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x01 ) ) ) ) + { + m_timers.timer3->enable( 1 ); + } + else + { + m_timers.timer3->enable( 0 ); + } + + /* Check if timer2 high should be enabled */ + if ( ( data & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) ) ) + { + m_timers.timer3_hi->enable( 1 ); + } + else + { + m_timers.timer3_hi->enable( 0 ); + } + break; + case 0x1D: /* Timer 3 speeds + Bit 0 R/W Select slow timer for timer 3 lo + Bit 1 R/W Select slow timer for timer 3 hi + */ + /* Check for prescaler change for the high counter */ + if ( ( data & 0x01 ) != ( m_pm_reg[0x1D] & 0x01 ) ) + { + int index = m_pm_reg[0x1C] & 0x07; + int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer3->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + + if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) ) + { + m_timers.timer3->enable( 1 ); + } + else + { + m_timers.timer3->enable( 0 ); + } + } + + /* Check for prescaler change for the low counter */ + if ( ( data & 0x02 ) != ( m_pm_reg[0x1D] & 0x02 ) ) + { + int index = ( m_pm_reg[0x1C] >> 4 ) & 0x07; + int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; + + m_timers.timer3_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); + + if ( ( m_pm_reg[0x1C] & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) ) + { + m_timers.timer3_hi->enable( 1 ); + } + else + { + m_timers.timer3_hi->enable( 0 ); + } + } + break; + case 0x20: /* Event #1-#8 priority + Bit 0-1 R/W Timer 3 overflow Interrupt #7-#8 + Bit 2-3 R/W Timer 1 overflow Interrupt #5-#6 + Bit 4-5 R/W Timer 2 overflow Interrupt #3-#4 + Bit 6-7 R/W VDraw/VBlank trigger Interrupt #1-#2 + */ + m_pm_reg[0x20] = data; + check_irqs(); + break; + case 0x21: /* Event #15-#22 priority + Bit 0-1 R/W Unknown + Bit 2-3 R/W All keypad interrupts - Interrupt #15-#22 + Bit 4-7 R/W Unknown + */ + m_pm_reg[0x21] = data; + check_irqs(); + break; + case 0x22: /* Event #9-#14 priority + Bit 0-1 R/W All #9 - #14 events - Interrupt #9-#14 + Bit 2-7 Unused + */ + m_pm_reg[0x22] = data; + check_irqs(); + break; + case 0x23: /* Event #1-#8 enable + Bit 0 R/W Timer 3 overflow (mirror) - Enable Interrupt #8 + Bit 1 R/W Timer 3 overflow - Enable Interrupt #7 + Bit 2 R/W Not called... - Enable Interrupt #6 + Bit 3 R/W Timer 1 overflow - Enable Interrupt #5 + Bit 4 R/W Not called... - Enable Interrupt #4 + Bit 5 R/W Timer 2 overflow - Enable Interrupt #3 + Bit 6 R/W V-Draw trigger - Enable Interrupt #2 + Bit 7 R/W V-Blank trigger - Enable Interrupt #1 + */ + m_pm_reg[0x23] = data; + check_irqs(); + break; + case 0x24: /* Event #9-#12 enable + Bit 0-5 R/W Unknown + Bit 6-7 Unused + */ + m_pm_reg[0x24] = data; + check_irqs(); + break; + case 0x25: /* Event #15-#22 enable + Bit 0 R/W Press key "A" event - Enable interrupt #22 + Bit 1 R/W Press key "B" event - Enable interrupt #21 + Bit 2 R/W Press key "C" event - Enable interrupt #20 + Bit 3 R/W Press D-pad up key event - Enable interrupt #19 + Bit 4 R/W Press D-pad down key event - Enable interrupt #18 + Bit 5 R/W Press D-pad left key event - Enable interrupt #17 + Bit 6 R/W Press D-pad right key event - Enable interrupt #16 + Bit 7 R/W Press power button event - Enable interrupt #15 + */ + m_pm_reg[0x25] = data; + check_irqs(); + break; + case 0x26: /* Event #13-#14 enable + Bit 0-2 R/W Unknown + Bit 3 Unused + Bit 4-5 R/W Unknown + Bit 6 R/W Shock detector trigger - Enable interrupt #14 + Bit 7 R/W IR receiver - low to high trigger - Enable interrupt #13 + */ + m_pm_reg[0x26] = data; + check_irqs(); + break; + case 0x27: /* Interrupt active flag #1-#8 + Bit 0 Timer 3 overflow (mirror) / Clear interrupt #8 + Bit 1 Timer 3 overflow / Clear interrupt #7 + Bit 2 Not called ... / Clear interrupt #6 + Bit 3 Timer 1 overflow / Clear interrupt #5 + Bit 4 Not called ... / Clear interrupt #4 + Bit 5 Timer 2 overflow / Clear interrupt #3 + Bit 6 VDraw trigger / Clear interrupt #2 + Bit 7 VBlank trigger / Clear interrupt #1 + */ + m_pm_reg[0x27] &= ~data; + check_irqs(); + return; + case 0x28: /* Interrupt active flag #9-#12 + Bit 0-1 Unknown + Bit 2 Unknown / Clear interrupt #12 + Bit 3 Unknown / Clear interrupt #11 + Bit 4 Unknown / Clear interrupt #10 + Bit 5 Unknown / Clear interrupt #9 + Bit 6-7 Unknown + */ + m_pm_reg[0x28] &= ~data; + check_irqs(); + return; + case 0x29: /* Interrupt active flag #15-#22 + Bit 0 Press key "A" event / Clear interrupt #22 + Bit 1 Press key "B" event / Clear interrupt #21 + Bit 2 Press key "C" event / Clear interrupt #20 + Bit 3 Press D-pad up key event / Clear interrupt #19 + Bit 4 Press D-pad down key event / Clear interrupt #18 + Bit 5 Press D-pad left key event / Clear interrupt #17 + Bit 6 Press D-pad right key event / Clear interrupt #16 + Bit 7 Press power button event / Clear interrupt #15 + */ + m_pm_reg[0x29] &= ~data; + check_irqs(); + return; + case 0x2A: /* Interrupt active flag #13-#14 + Bit 0-5 Unknown + Bit 6 Shock detector trigger / Clear interrupt #14 + Bit 7 Unknown / Clear interrupt #13 + */ + m_pm_reg[0x2A] &= ~data; + check_irqs(); + return; + case 0x30: /* Timer 1 control 1 + Bit 0 R/W Unknown + Bit 1 W Reset low counter + Bit 2 R/W Enable high counter + Bit 3 R/W Unknown + Bit 4-6 Unused + Bit 7 R/W Enable 16bit mode + */ + if ( data & 0x02 ) + { + m_pm_reg[0x36] = m_pm_reg[0x32]; + data &= ~0x02; + } + + if ( ( data & 0x04 ) && ( m_pm_reg[0x18] & 0x08 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x01 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x01 ) ) ) ) + { + m_timers.timer1->enable( 1 ); + } + else + { + m_timers.timer1->enable( 0 ); + } + + if ( ( m_pm_reg[0x31] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x18] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) ) ) + { + m_timers.timer1_hi->enable( 1 ); + } + else + { + m_timers.timer1_hi->enable( 0 ); + } + break; + case 0x31: /* Timer 1 control 2 + Bit 0 R/W Unknown + Bit 1 W Reset hi counter + Bit 2 R/W Enable high counter + Bit 3 R/W Unknown + Bit 4-7 Unused + */ + if ( data & 0x02 ) + { + m_pm_reg[0x37] = m_pm_reg[0x33]; + data &= ~0x02; + } + + if ( ( data & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) && ( m_pm_reg[0x18] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) ) ) + { + m_timers.timer1_hi->enable( 1 ); + } + else + { + m_timers.timer1_hi->enable( 0 ); + } + break; + case 0x32: /* Timer 1 preset value (low) + Bit 0-7 R/W Timer 1 preset value bit 0-7 + */ + break; + case 0x33: /* Timer 1 preset value (high) + Bit 0-7 R/W Timer 1 preset value bit 8-15 + */ + break; + case 0x34: /* Timer 1 sound-pivot (low, unused) + */ + case 0x35: /* Timer 1 sound-pivot (high, unused) + */ + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); + break; + case 0x36: /* Timer 1 counter (low), read only + */ + return; + case 0x37: /* Timer 1 counter (high), read only + */ + return; + case 0x38: /* Timer 2 control 1 + Bit 0 R/W Unknown + Bit 1 W Reset low counter + Bit 2 R/W Enable high counter + Bit 3 R/W Unknown + Bit 4-6 Unused + Bit 7 R/W Enable 16bit mode + */ + if ( data & 0x02 ) + { + m_pm_reg[0x3E] = m_pm_reg[0x3A]; + data &= ~0x02; + } + + if ( ( data & 0x04 ) && ( m_pm_reg[0x1A] & 0x08 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1A] & 0x01 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1A] & 0x01 ) ) ) ) + { + m_timers.timer2->enable( 1 ); + } + else + { + m_timers.timer2->enable( 0 ); + } + if ( ( m_pm_reg[0x39] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x1A] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) ) ) + { + m_timers.timer2_hi->enable( 1 ); + } + else + { + m_timers.timer2_hi->enable( 0 ); + } + break; + case 0x39: /* Timer 2 control 2 + Bit 0 R/W Unknown + Bit 1 W Reset hi counter + Bit 2 R/W Enable high counter + Bit 3 R/W Unknown + Bit 4-7 Unused + */ + if ( data & 0x02 ) + { + m_pm_reg[0x3F] = m_pm_reg[0x3A]; + data &= ~0x02; + } + + if ( ( data & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && ( m_pm_reg[0x1A] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) ) ) + { + m_timers.timer2_hi->enable( 1 ); + } + else + { + m_timers.timer2_hi->enable( 0 ); + } + break; + case 0x3A: /* Timer 2 preset value (low) + Bit 0-7 R/W Timer 2 preset value bit 0-7 + */ + break; + case 0x3B: /* Timer 2 preset value (high) + Bit 0-7 R/W Timer 2 preset value bit 8-15 + */ + break; + case 0x3C: /* Timer 2 sound-pivot (low, unused) + */ + case 0x3D: /* Timer 2 sound-pivot (high, unused) + */ + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); + break; + case 0x3E: /* Timer 2 counter (low), read only + Bit 0-7 R/W Timer 2 counter value bit 0-7 + */ + return; + case 0x3F: /* Timer 2 counter (high), read only + Bit 0-7 R/W Timer 2 counter value bit 8-15 + */ + return; + case 0x40: /* 256Hz timer control + Bit 0 R/W Enable Timer + Bit 1 W Reset Timer + Bit 2-7 Unused + */ + if ( data & 0x02 ) + { + m_pm_reg[0x41] = 0; + data &= ~0x02; + } + break; + case 0x41: /* 256Hz timer counter + Bit 0-7 R 256Hz timer counter + */ + return; + case 0x48: /* Timer 3 control 1 + Bit 0 R/W Unknown + Bit 1 W Reset low counter + Bit 2 R/W Enable high counter + Bit 3 R/W Unknown + Bit 4-6 Unused + Bit 7 R/W Enable 16bit mode + */ + if ( data & 0x02 ) + { + m_pm_reg[0x4E] = m_pm_reg[0x4A]; + data &= ~0x02; + } + + if ( ( data & 0x04 ) && ( m_pm_reg[0x1C] & 0x08 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x01 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x01 ) ) ) ) + { + m_timers.timer3->enable( 1 ); + } + else + { + m_timers.timer3->enable( 0 ); + } + if ( ( m_pm_reg[0x49] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x1C] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) ) ) + { + m_timers.timer3_hi->enable( 1 ); + } + else + { + m_timers.timer3_hi->enable( 0 ); + } + m_pm_reg[0x48] = data; + update_sound(); + break; + case 0x49: /* Timer 3 control 2 + Bit 0 R/W Unknown + Bit 1 W Reset hi counter + Bit 2 R/W Enable high counter + Bit 3 R/W Unknown + Bit 4-7 Unused + */ + if ( data & 0x02 ) + { + m_pm_reg[0x4F] = m_pm_reg[0x4B]; + data &= ~0x02; + } + + if ( ( data & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && ( m_pm_reg[0x1C] & 0x80 ) && + ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) || + ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) ) ) + { + m_timers.timer3_hi->enable( 1 ); + } + else + { + m_timers.timer3_hi->enable( 0 ); + } + m_pm_reg[0x49] = data; + update_sound(); + break; + case 0x4A: /* Timer 3 preset value (low) + Bit 0-7 R/W Timer 3 preset value bit 0-7 + */ + m_pm_reg[0x4A] = data; + update_sound(); + break; + case 0x4B: /* Timer 3 preset value (high) + Bit 0-7 R/W Timer 3 preset value bit 8-15 + */ + m_pm_reg[0x4B] = data; + update_sound(); + break; + case 0x4C: /* Timer 3 sound-pivot (low) + Bit 0-7 R/W Timer 3 sound-pivot value bit 0-7 + */ + m_pm_reg[0x4C] = data; + update_sound(); + break; + case 0x4D: /* Timer 3 sound-pivot (high) + Bit 0-7 R/W Timer 3 sound-pivot value bit 8-15 + + Sound-pivot location: + Pulse-Width of 0% = 0x0000 + Pulse-Width of 50% = Half of preset-value + Pulse-Width of 100% = Same as preset-value + */ + m_pm_reg[0x4D] = data; + update_sound(); + break; + case 0x4E: /* Timer 3 counter (low), read only + Bit 0-7 R/W Timer 3 counter value bit 0-7 + */ + return; + case 0x4F: /* Timer 3 counter (high), read only + Bit 0-7 R/W Timer 3 counter value bit 8-15 + */ + return; + case 0x52: /* Keypad status + Bit 0 R Key "A" + Bit 1 R Key "B" + Bit 2 R Key "C" + Bit 3 R D-pad up + Bit 4 R D-pad down + Bit 5 R D-pad left + Bit 6 R D-pad right + Bit 7 R Power button + */ + return; + case 0x60: /* I/O peripheral circuit select + Bit 0 R/W Unknown + bit 1 R/W IR receive / transmit + Bit 2 R/W EEPROM / RTC data + Bit 3 R/W EEPROM / RTC clock + Bit 4 R/W Rumble controller + Bit 5 R/W IR enable/disable + Bit 6 R/W Unknown + Bit 7 R/W Unknown + */ + break; + case 0x61: /* I/O peripheral status control + Bit 0 R/W IR received bit (if device not selected: 0) + Bit 1 R/W IR transmit (if device not selected: 0) + Bit 2 R/W EEPROM / RTC data (if device not selected: 1) + Bit 3 R/W EEPROM / RTC clock (if device not selected: 0) + Bit 4 R/W Rumble on/off (if device not selected: 0) + Bit 5 R/W IR disable (receive & transmit) (if device not selected: 1) + Bit 6 Always 1 + Bit 7 R/W IR received bit (mirror, if device not selected: 0) + */ + if ( m_pm_reg[0x60] & 0x04 ) + m_i2cmem->write_sda( ( data & 0x04 ) ? 1 : 0 ); + + if ( m_pm_reg[0x60] & 0x08 ) + m_i2cmem->write_scl( ( data & 0x08 ) ? 1 : 0 ); + break; + case 0x70: /* Sound related */ + m_pm_reg[0x70] = data; + update_sound(); + break; + case 0x71: /* Sound volume + Bit 0-1 R/W Sound volume + 00 - 0% + 01 - 50% + 10 - 50% + 11 - 100% + Bit 2 R/W Always set to 0 + Bit 3-7 Unused + */ + m_pm_reg[0x71] = data; + update_sound(); + break; + case 0x80: /* LCD control + Bit 0 R/W Invert colors; 0 - normal, 1 - inverted + Bit 1 R/W Enable rendering of background + Bit 2 R/W Enable rendering of sprites + Bit 3 R/W Enable copy to LCD ram + Bit 4-5 R/W Map size + 00 - 12x16 + 01 - 16x12 + 10 - 24x8 + 11 - 24x8 (prohibited code) + Bit 6-7 Unused + */ + m_prc.colors_inverted = ( data & 0x01 ) ? 1 : 0; + m_prc.background_enabled = ( data & 0x02 ) ? 1 : 0; + m_prc.sprites_enabled = ( data & 0x04 ) ? 1 : 0; + m_prc.copy_enabled = ( data & 0x08 ) ? 1 : 0; + m_prc.map_size = ( data >> 4 ) & 0x03; + switch( m_prc.map_size ) + { + case 0: + m_prc.map_size_x = 12; break; + case 1: + m_prc.map_size_x = 16; break; + case 2: + case 3: + m_prc.map_size_x = 24; break; + } + break; + case 0x81: /* LCD render refresh rate + Bit 0 R/W Unknown + Bit 1-3 R/W LCD refresh rate divider + 000 - 60Hz / 3 = 20Hz (0 - 2) + 001 - 60Hz / 6 = 10Hz (0 - 5) + 010 - 60Hz / 9 = 6,6Hz (0 - 8) + 011 - 60Hz / 12 = 5Hz (0 - B) + 100 - 60Hz / 2 = 30Hz (0 - 1) + 101 - 60Hz / 4 = 15Hz (0 - 3) + 110 - 60Hz / 6 = 10Hz (0 - 5) + 111 - 60Hz / 8 = 7,5Hz (0 - 7) + Bit 4-7 R Divider position, when overflow the LCD is updated + */ + switch ( data & 0x0E ) + { + case 0x00: m_prc.max_frame_count = 3; break; + case 0x02: m_prc.max_frame_count = 6; break; + case 0x04: m_prc.max_frame_count = 9; break; + case 0x06: m_prc.max_frame_count = 12; break; + case 0x08: m_prc.max_frame_count = 2; break; + case 0x0A: m_prc.max_frame_count = 4; break; + case 0x0C: m_prc.max_frame_count = 6; break; + case 0x0E: m_prc.max_frame_count = 8; break; + } + break; + case 0x82: /* BG tile data memory offset (low) + Bit 0-2 Always "0" + Bit 3-7 R/W BG tile data memory offset bit 3-7 + */ + data &= 0xF8; + m_prc.bg_tiles = ( m_prc.bg_tiles & 0xFFFF00 ) | data; + break; + case 0x83: /* BG tile data memory offset (mid) + Bit 0-7 R/W BG tile data memory offset bit 8-15 + */ + m_prc.bg_tiles = ( m_prc.bg_tiles & 0xFF00FF ) | ( data << 8 ); + break; + case 0x84: /* BG tile data memory offset (high) + Bit 0-4 R/W BG tile data memory offset bit 16-20 + Bit 5-7 Unused + */ + data &= 0x1F; + m_prc.bg_tiles = ( m_prc.bg_tiles & 0x00FFFF ) | ( data << 16 ); + break; + case 0x85: /* BG vertical move + Bit 0-6 R/W Move the background up, move range: + Map size 0: 0x00 to 0x40 + Map size 1: 0x00 to 0x20 + Map size 2: move ignored + Bit 7 Unused + */ + case 0x86: /* BG horizontal move + Bit 0-6 R/W Move the background left, move range: + Map size 0: move ignored + Map size 1: 0x00 to 0x20 + Map size 2: 0x00 to 0x60 + Bit 7 Unused + */ + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); + break; + case 0x87: /* Sprite tile data memory offset (low) + Bit 0-5 Always "0" + Bit 6-7 R/W Sprite tile data memory offset bit 6-7 + */ + data &= 0xC0; + m_prc.spr_tiles = ( m_prc.spr_tiles & 0xFFFF00 ) | data; + break; + case 0x88: /* Sprite tile data memory offset (med) + Bit 0-7 R/W Sprite tile data memory offset bit 8-15 + */ + m_prc.spr_tiles = ( m_prc.spr_tiles & 0xFF00FF ) | ( data << 8 ); + break; + case 0x89: /* Sprite tile data memory offset (high) + Bit 0-4 R/W Sprite tile data memory offset bit 16-20 + Bit 5-7 Unused + */ + data &= 0x1F; + m_prc.spr_tiles = ( m_prc.spr_tiles & 0x00FFFF ) | ( data << 16 ); + break; + case 0x8A: /* LCD status + Bit 0 R Unknown + Bit 1 R Unknown + Bit 2 R Unknown + Bit 3 R Unknown + Bit 4 R LCD during V-Sync / Rendering circuitry active or not ( 1 = not active) + Bit 5 R Unknown + Bit 6-7 Unused + */ + case 0xFE: /* Direct LCD control / data + Bit 0-7 R/W Direct LCD command or data + */ +// lcd_command_w( data ); + break; + case 0xFF: /* Direct LCD data + Bit 0-7 R/W Direct LCD data + */ +// lcd_data_w( data ); + break; + default: + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); + break; + } + m_pm_reg[offset] = data; +} + +READ8_MEMBER(pokemini_state::hwreg_r) +{ + UINT8 data = m_pm_reg[offset]; + + switch( offset ) + { + case 0x52: return m_inputs->read(); + case 0x61: + if ( ! ( m_pm_reg[0x60] & 0x04 ) ) + { + data = ( data & ~ 0x04 ) | ( m_i2cmem->read_sda() ? 0x04 : 0x00 ); + } + + if ( ! ( m_pm_reg[0x60] & 0x08 ) ) + { + data &= ~0x08; + } + break; + case 0x81: return ( m_pm_reg[offset] & 0x0F ) | ( m_prc.frame_count << 4 ); + case 0x8A: return m_prc.count; + } + return data; +} + +DEVICE_IMAGE_LOAD_MEMBER( pokemini_state, pokemini_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + /* Verify that the image is big enough */ + if (size <= 0x2100) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM image: ROM image is too small"); + return IMAGE_INIT_FAIL; + } + + /* Verify that the image is not too big */ + if (size > 0x1fffff) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM image: ROM image is too big"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + +void pokemini_state::prc_counter_callback() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + m_prc.count++; + + /* Check for overflow */ + if ( m_prc.count >= 0x42 ) + { + m_prc.count = 0; + m_prc.frame_count++; + } + else + { + if ( m_prc.count == 0x18 && m_prc.frame_count >= m_prc.max_frame_count ) + { + m_prc.frame_count = 0; + + /* Check if the background should be drawn */ + if ( m_prc.background_enabled ) + { + int x, y; + for ( y = 0; y < 8; y++ ) { + for ( x = 0; x < 12; x++ ) { + UINT8 tile = m_p_ram[ 0x360 + ( y * m_prc.map_size_x ) + x ]; + int i; + for( i = 0; i < 8; i++ ) { + m_p_ram[ ( y * 96 ) + ( x * 8 ) + i ] = space.read_byte( m_prc.bg_tiles + ( tile * 8 ) + i ); + } + } + } + } + + /* Check if the sprites should be drawn */ + if ( m_prc.sprites_enabled ) + { + UINT16 spr; + + for ( spr = 0x35C; spr >= 0x300; spr -= 4 ) + { + int spr_x = ( m_p_ram[ spr + 0 ] & 0x7F ) - 16; + int spr_y = ( m_p_ram[ spr + 1 ] & 0x7F ) - 16; + UINT8 spr_tile = m_p_ram[ spr + 2 ]; + UINT8 spr_flag = m_p_ram[ spr + 3 ]; + + if ( spr_flag & 0x08 ) + { + UINT16 gfx, mask; + UINT32 spr_base = m_prc.spr_tiles + spr_tile * 64; + int i, j; + + for ( i = 0; i < 16; i++ ) + { + if ( spr_x + i >= 0 && spr_x + i < 96 ) + { + int rel_x = ( spr_flag & 0x01 ) ? 15 - i : i; + UINT32 s = spr_base + ( ( rel_x & 0x08 ) << 2 ) + ( rel_x & 0x07 ); + + mask = ~ ( space.read_byte( s ) | ( space.read_byte( s + 8 ) << 8 ) ); + gfx = space.read_byte( s + 16 ) | ( space.read_byte( s + 24 ) << 8 ); + + /* Are the colors inverted? */ + if ( spr_flag & 0x04 ) + { + gfx = ~gfx; + } + + for ( j = 0; j < 16; j++ ) + { + if ( spr_y + j >= 0 && spr_y + j < 64 ) + { + UINT16 ram_addr = ( ( ( spr_y + j ) >> 3 ) * 96 ) + spr_x + i; + + if ( spr_flag & 0x02 ) + { + if ( mask & 0x8000 ) + { + m_p_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); + if ( gfx & 0x8000 ) + { + m_p_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); + } + } + mask <<= 1; + gfx <<= 1; + } + else + { + if ( mask & 0x0001 ) + { + m_p_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); + if ( gfx & 0x0001 ) + { + m_p_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); + } + } + mask >>= 1; + gfx >>= 1; + } + } + } + } + } + } + } + } + + /* Set PRC Render interrupt */ + m_pm_reg[0x27] |= 0x40; + check_irqs(); + + /* Check if the rendered data should be copied to the LCD */ + if ( m_prc.copy_enabled ) + { + int x, y; + + for( y = 0; y < 64; y += 8 ) { + for( x = 0; x < 96; x++ ) { + UINT8 data = m_p_ram[ ( y * 12 ) + x ]; + + m_bitmap.pix16(y + 0, x) = ( data & 0x01 ) ? 3 : 0; + m_bitmap.pix16(y + 1, x) = ( data & 0x02 ) ? 3 : 0; + m_bitmap.pix16(y + 2, x) = ( data & 0x04 ) ? 3 : 0; + m_bitmap.pix16(y + 3, x) = ( data & 0x08 ) ? 3 : 0; + m_bitmap.pix16(y + 4, x) = ( data & 0x10 ) ? 3 : 0; + m_bitmap.pix16(y + 5, x) = ( data & 0x20 ) ? 3 : 0; + m_bitmap.pix16(y + 6, x) = ( data & 0x40 ) ? 3 : 0; + m_bitmap.pix16(y + 7, x) = ( data & 0x80 ) ? 3 : 0; + } + } + + /* Set PRC Copy interrupt */ + m_pm_reg[0x27] |= 0x80; + check_irqs(); + } + } + + /* Set possible input irqs */ + m_pm_reg[0x29] |= ~ m_inputs->read(); + } +} + + +void pokemini_state::machine_start() +{ + /* Clear internal structures */ + memset( &m_prc, 0, sizeof(m_prc) ); + memset( &m_timers, 0, sizeof(m_timers) ); + memset( m_pm_reg, 0, sizeof(m_pm_reg) ); + + /* Set up timers */ + m_timers.seconds_timer = timer_alloc(TIMER_SECONDS); + m_timers.seconds_timer->adjust(attotime::zero, 0, attotime::from_seconds(1)); + + m_timers.hz256_timer = timer_alloc(TIMER_256HZ); + m_timers.hz256_timer->adjust(attotime::zero, 0, attotime::from_hz(256)); + + m_timers.timer1 = timer_alloc(TIMER_1); + m_timers.timer1_hi = timer_alloc(TIMER_1_HI); + m_timers.timer2 = timer_alloc(TIMER_2); + m_timers.timer2_hi = timer_alloc(TIMER_2_HI); + m_timers.timer3 = timer_alloc(TIMER_3); + m_timers.timer3_hi = timer_alloc(TIMER_3_HI); + + /* Set up the PRC */ + m_prc.max_frame_count = 2; + m_prc.count_timer = timer_alloc(TIMER_PRC); + m_prc.count_timer->adjust( attotime::zero, 0, m_maincpu->cycles_to_attotime(55640 / 65) ); +} + + +void pokemini_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SECONDS: + seconds_timer_callback(); + break; + + case TIMER_256HZ: + timer_256hz_callback(); + break; + + case TIMER_1: + timer1_callback(); + break; + + case TIMER_1_HI: + timer1_hi_callback(); + break; + + case TIMER_2: + timer2_callback(); + break; + + case TIMER_2_HI: + timer2_hi_callback(); + break; + + case TIMER_3: + timer3_callback(); + break; + + case TIMER_3_HI: + timer3_hi_callback(); + break; + + case TIMER_PRC: + prc_counter_callback(); + break; + } +} + + +static const INT16 speaker_levels[] = {-32768, 0, 32767}; + +void pokemini_state::video_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); +} + + +UINT32 pokemini_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + + +static MACHINE_CONFIG_START( pokemini, pokemini_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", MINX, 4000000) + MCFG_CPU_PROGRAM_MAP(pokemini_mem_map) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_I2CMEM_ADD("i2cmem") + MCFG_I2CMEM_DATA_SIZE(0x2000) + + /* This still needs to be improved to actually match the hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_UPDATE_DRIVER(pokemini_state, screen_update) + MCFG_SCREEN_SIZE( 96, 64 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 95, 0, 63 ) + MCFG_SCREEN_REFRESH_RATE( 72 ) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_PALETTE_ADD("palette", 4) + MCFG_PALETTE_INIT_OWNER(pokemini_state, pokemini) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(3, speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pokemini_cart") + MCFG_GENERIC_EXTENSIONS("bin,min") + MCFG_GENERIC_LOAD(pokemini_state, pokemini_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "pokemini") +MACHINE_CONFIG_END + +ROM_START( pokemini ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_LOAD( "bios.min", 0x0000, 0x1000, CRC(aed3c14d) SHA1(daad4113713ed776fbd47727762bca81ba74915f) ) +ROM_END + + +CONS( 2001, pokemini, 0, 0, pokemini, pokemini, driver_device, 0, "Nintendo", "Pokemon Mini", MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/poly.c b/src/mame/drivers/poly.c new file mode 100644 index 00000000000..0ae7749316b --- /dev/null +++ b/src/mame/drivers/poly.c @@ -0,0 +1,229 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Poly/Proteus (New Zealand) + + 10/07/2011 Skeleton driver. + + http://www.cs.otago.ac.nz/homepages/andrew/poly/Poly.htm + + Andrew has supplied the roms for -bios 1 + + It uses a 6809 for all main functions. There is a Z80 for CP/M, but all + of the roms are 6809 code. + + The keyboard controller is one of those custom XR devices. + Will use the terminal keyboard instead. + + With bios 1, after entering your userid and password, you get a black + screen. This is normal, because it joins to a network which isn't there. + + ToDo: + - Almost Everything! + - Connect up the device ports & lines + - Find out about graphics mode and how it is selected + - Fix Keyboard so that the Enter key tells BASIC to do something + - Find out how to make 2nd teletext screen to display + - Banking + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "cpu/z80/z80.h" +#include "machine/6821pia.h" +#include "machine/6840ptm.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "machine/mc6854.h" +#include "video/saa5050.h" +#include "machine/keyboard.h" +#include "sound/speaker.h" + +#define KEYBOARD_TAG "keyboard" + +class poly_state : public driver_device +{ +public: + poly_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pia0(*this, "pia0"), + m_pia1(*this, "pia1"), + m_acia(*this, "acia"), + m_ptm(*this, "ptm"), + m_speaker(*this, "speaker"), + m_videoram(*this, "videoram") + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(pia1_b_in); + DECLARE_READ8_MEMBER(videoram_r); + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + DECLARE_WRITE8_MEMBER( ptm_o2_callback ); + DECLARE_WRITE8_MEMBER( ptm_o3_callback ); + +protected: + virtual void machine_reset(); + +private: + required_device m_maincpu; + required_device m_pia0; + required_device m_pia1; + required_device m_acia; + required_device m_ptm; + required_device m_speaker; + required_shared_ptr m_videoram; + UINT8 m_term_data; +}; + + +static ADDRESS_MAP_START(poly_mem, AS_PROGRAM, 8, poly_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0x9fff) AM_RAM + AM_RANGE(0xa000,0xcfff) AM_ROM + AM_RANGE(0xd000,0xdfff) AM_RAM + AM_RANGE(0xe000,0xe003) AM_DEVREADWRITE("pia0", pia6821_device, read, write) //video control PIA 6821 + AM_RANGE(0xe004,0xe004) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) + AM_RANGE(0xe005,0xe005) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) + //AM_RANGE(0xe006, 0xe006) // baud rate controller (0=9600,2=4800,4=2400,6=1200,8=600,A=300) + AM_RANGE(0xe00c,0xe00f) AM_DEVREADWRITE("pia1", pia6821_device, read, write) //keyboard PIA 6821 + AM_RANGE(0xe020,0xe027) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) //timer 6840 + AM_RANGE(0xe030,0xe037) AM_DEVREADWRITE("adlc", mc6854_device, read, write) //Data Link Controller 6854 + AM_RANGE(0xe040,0xe040) AM_NOP //Set protect flip-flop after 1 E-cycle + AM_RANGE(0xe050,0xe05f) AM_RAM //Dynamic Address Translater (arranges memory banks) + // AM_RANGE(0xe060,0xe060) Select Map 1 + // AM_RANGE(0xe070,0xe070) Select Map 2 + AM_RANGE(0xe800,0xebbf) AM_RAM AM_SHARE("videoram") + AM_RANGE(0xebc0,0xebff) AM_RAM + AM_RANGE(0xec00,0xefbf) AM_RAM // screen 2 AM_SHARE("videoram") + AM_RANGE(0xefc0,0xefff) AM_RAM + AM_RANGE(0xf000,0xffff) AM_ROM +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( poly ) +INPUT_PORTS_END + + +void poly_state::machine_reset() +{ +} + +READ8_MEMBER( poly_state::pia1_b_in ) +{ +// return ascii key value, bit 7 is the strobe value + UINT8 data = m_term_data; + m_term_data &= 0x7f; + return data; +} + +READ8_MEMBER( poly_state::videoram_r ) +{ + return m_videoram[offset]; +} + +WRITE8_MEMBER( poly_state::kbd_put ) +{ + m_term_data = data | 0x80; + + m_pia1->cb1_w(1); + m_pia1->cb1_w(0); +} + +WRITE_LINE_MEMBER( poly_state::write_acia_clock ) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + +WRITE8_MEMBER( poly_state::ptm_o2_callback ) +{ + m_ptm->set_c1(data); +} + +WRITE8_MEMBER( poly_state::ptm_o3_callback ) +{ + m_speaker->level_w(data); +} + +static MACHINE_CONFIG_START( poly, poly_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809E, XTAL_12MHz / 3) // 12.0576MHz + MCFG_CPU_PROGRAM_MAP(poly_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(40 * 12, 24 * 20) + MCFG_SCREEN_VISIBLE_AREA(0, 40 * 12 - 1, 0, 24 * 20 - 1) + MCFG_SCREEN_UPDATE_DEVICE("saa5050", saa5050_device, screen_update) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000) + MCFG_SAA5050_D_CALLBACK(READ8(poly_state, videoram_r)) + MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) + + MCFG_DEVICE_ADD("pia0", PIA6821, 0) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + + MCFG_DEVICE_ADD("pia1", PIA6821, 0) + MCFG_PIA_READPB_HANDLER(READ8(poly_state, pia1_b_in)) + // CB1 kbd strobe + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + + MCFG_DEVICE_ADD("ptm", PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(XTAL_12MHz / 3) + MCFG_PTM6840_EXTERNAL_CLOCKS(0, 0, 0) + MCFG_PTM6840_OUT1_CB(WRITE8(poly_state, ptm_o2_callback)) + MCFG_PTM6840_OUT2_CB(WRITE8(poly_state, ptm_o3_callback)) + MCFG_PTM6840_IRQ_CB(INPUTLINE("maincpu", M6809_IRQ_LINE)) + + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + //MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + //MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + //MCFG_DEVICE_ADD("acia_clock", CLOCK, 1) + //MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(poly_state, write_acia_clock)) + + MCFG_DEVICE_ADD("adlc", MC6854, 0) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(poly_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( poly1 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS(0, "bios0", "Standalone") + ROMX_LOAD( "v3bas1.bin", 0xa000, 0x1000, CRC(2c5276cb) SHA1(897cb9c2456ddb0f316a8c3b8aa56706056cc1dd), ROM_BIOS(1) ) + ROMX_LOAD( "v3bas2.bin", 0xb000, 0x1000, CRC(30f99447) SHA1(a26170113a968ccd8df7db1b0f256a2198054037), ROM_BIOS(1) ) + ROMX_LOAD( "v3bas3.bin", 0xc000, 0x1000, CRC(89ea5b27) SHA1(e37a61d3dd78fb40bc43c70af9714ce3f75fd895), ROM_BIOS(1) ) + ROMX_LOAD( "v3bas4.bin", 0x9000, 0x1000, CRC(c16c1209) SHA1(42f3b0bce32aafab14bc0500fb13bd456730875c), ROM_BIOS(1) ) + // boot rom + ROMX_LOAD( "plrt16v3e9.bin", 0xf000, 0x1000, CRC(453c10a0) SHA1(edfbc3d83710539c01093e89fe1b47dfe1e68acd), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS(1, "bios1", "Terminal") + // supplied by Andrew Trotman, author of Poly1 emulator (PolyROM v3.4) + ROMX_LOAD( "v2bas1.bin", 0xa000, 0x1000, CRC(f8c5adc4) SHA1(b1a16d7d996909185495b15a52afa697324e1f8d), ROM_BIOS(2) ) + ROMX_LOAD( "v2bas2.bin", 0xb000, 0x1000, CRC(a2b0fa4d) SHA1(05ab723eb2e2b09325380a1a72da5ade401847d1), ROM_BIOS(2) ) + ROMX_LOAD( "v2bas3.bin", 0xc000, 0x1000, CRC(04a58be5) SHA1(729fa02c76783213e40bb179e60c09d4b439ab90), ROM_BIOS(2) ) + ROMX_LOAD( "v2bas4.bin", 0x9000, 0x1000, CRC(328fe790) SHA1(43dca92092b27627603d3588f91cf9eca24ed29f), ROM_BIOS(2) ) + ROMX_LOAD( "slrt14_00f9.bin", 0xf000, 0x1000, CRC(6559a2ce) SHA1(7c38f449ca122342732123b56992ed0c446406c2), ROM_BIOS(2) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, poly1, 0, 0, poly, poly, driver_device, 0, "Polycorp", "Poly-1 Educational Computer", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/poly88.c b/src/mame/drivers/poly88.c new file mode 100644 index 00000000000..79905bc2eea --- /dev/null +++ b/src/mame/drivers/poly88.c @@ -0,0 +1,230 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Poly-88 driver by Miodrag Milanovic + + 18/05/2009 Initial implementation + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "includes/poly88.h" + +static ADDRESS_MAP_START(poly88_mem, AS_PROGRAM, 8, poly88_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x03ff) AM_ROM // Monitor ROM + AM_RANGE(0x0400, 0x0bff) AM_ROM // ROM Expansion + AM_RANGE(0x0c00, 0x0dff) AM_RAM AM_MIRROR(0x200) // System RAM (mirrored) + AM_RANGE(0x1000, 0x1fff) AM_ROM // System Expansion area + AM_RANGE(0x2000, 0x3fff) AM_RAM // Minimal user RAM area + AM_RANGE(0x4000, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("video_ram") // Video RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( poly88_io, AS_IO, 8, poly88_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x04, 0x04) AM_WRITE(poly88_baud_rate_w) + AM_RANGE(0x08, 0x08) AM_WRITE(poly88_intr_w) + AM_RANGE(0xf8, 0xf8) AM_READ(poly88_keyboard_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(poly8813_mem, AS_PROGRAM, 8, poly88_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x03ff) AM_ROM // Monitor ROM + AM_RANGE(0x0400, 0x0bff) AM_ROM // Disk System ROM + AM_RANGE(0x0c00, 0x0fff) AM_RAM // System RAM + AM_RANGE(0x1800, 0x1bff) AM_RAM AM_SHARE("video_ram") // Video RAM + AM_RANGE(0x2000, 0xffff) AM_RAM // RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( poly8813_io, AS_IO, 8, poly88_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( poly88 ) + PORT_START("LINEC") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_END) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL")PORT_CODE(KEYCODE_BACKSPACE) + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) +INPUT_PORTS_END + +static const struct CassetteOptions poly88_cassette_options = +{ + 1, /* channels */ + 16, /* bits per sample */ + 7200 /* sample frequency */ +}; + +/* F4 Character Displayer */ +static const gfx_layout poly88_charlayout = +{ + 8, 16, /* text = 7 x 9 */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( poly88 ) + GFXDECODE_ENTRY( "chargen", 0x0000, poly88_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( poly88, poly88_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, 1853000) + MCFG_CPU_PROGRAM_MAP(poly88_mem) + MCFG_CPU_IO_MAP(poly88_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", poly88_state, poly88_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(poly88_state,poly88_irq_callback) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*10, 16*15) + MCFG_SCREEN_VISIBLE_AREA(0, 64*10-1, 0, 16*15-1) + MCFG_SCREEN_UPDATE_DRIVER(poly88_state, screen_update_poly88) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", poly88) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_CREATE_OPTS(&poly88_cassette_options) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) + + /* uart */ + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(poly88_state,write_cas_tx)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(poly88_state,poly88_usart_rxready)) + + /* snapshot */ + MCFG_SNAPSHOT_ADD("snapshot", poly88_state, poly88, "img", 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( poly8813, poly88 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(poly8813_mem) + MCFG_CPU_IO_MAP(poly8813_io) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( poly88 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "polymon4.bin", 0x0000, 0x0400, CRC(0baa1a4c) SHA1(c6cf4b89bdde200813d34aab08150d5f3025ce33)) + ROM_LOAD( "tbasic_1.rom", 0x0400, 0x0400, CRC(ec22740e) SHA1(bc606c58ef5f046200bdf402eda66ec070464306)) + ROM_LOAD( "tbasic_2.rom", 0x0800, 0x0400, CRC(f2619232) SHA1(eb6fb0356d2fb153111cfddf39eab10253cb4c53)) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "6571.bin", 0x0000, 0x0800, CRC(5a25144b) SHA1(7b9fee0c8ef2605b85d12b6d9fe8feb82418c63a) ) +ROM_END + +ROM_START( poly8813 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "poly8813-1.bin", 0x0000, 0x0400, CRC(7fd980a0) SHA1(a71d5999deb4323a11db1c0ea0dcb1dacfaf47ef)) + ROM_LOAD( "poly8813-2.rom", 0x0400, 0x0400, CRC(1ad7c06c) SHA1(c96b8f03c184de58dbdcee18d297dbccf2d77176)) + ROM_LOAD( "poly8813-3.rom", 0x0800, 0x0400, CRC(3df57e5b) SHA1(5b0c4febfc7515fc07e63dcb21d0ab32bc6a2e46)) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "6571.bin", 0x0000, 0x0800, CRC(5a25144b) SHA1(7b9fee0c8ef2605b85d12b6d9fe8feb82418c63a) ) +ROM_END +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1976, poly88, 0, 0, poly88, poly88, poly88_state, poly88, "PolyMorphic Systems", "Poly-88", 0) +COMP( 1977, poly8813,poly88,0, poly8813, poly88, poly88_state, poly88, "PolyMorphic Systems", "Poly-8813",MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/poly880.c b/src/mame/drivers/poly880.c new file mode 100644 index 00000000000..26917bcd25e --- /dev/null +++ b/src/mame/drivers/poly880.c @@ -0,0 +1,288 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Poly-Computer 880 + + 12/05/2009 Skeleton driver. + + http://www.kc85-museum.de/books/poly880/index.html + +After starting this driver, the screen may be blank. Press F2 until +something appears (most likely 'Go'). Then it can be used, or pasted to. + +To see it say POLY-880, start the system, press F2, F1, F2. + +Pasting: + 0-F : as is + EXEC : ^ + BACK : V + MEM : - + GO : X + +Test Paste: + -4000^11^22^33^44^55^66^77^88^99^-4000 + Now press up-arrow to confirm the data has been entered. + +****************************************************************************/ + +#include "includes/poly880.h" +#include "poly880.lh" + +/* + + TODO: + + - SEND/SCON + - MCYCL (activate single stepping) + - CYCL (single step) + - layout LEDs (address bus, data bus, command bus, MCYCL) + - RAM expansion + +*/ + +/* Read/Write Handlers */ + +void poly880_state::update_display() +{ + int i; + + for (i = 0; i < 8; i++) + { + if (BIT(m_digit, i)) output_set_digit_value(7 - i, m_segment); + } +} + +WRITE8_MEMBER( poly880_state::cldig_w ) +{ + m_digit = data; + + update_display(); +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( poly880_mem, AS_PROGRAM, 8, poly880_state ) + AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_ROM + AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_ROM + AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_ROM + AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_ROM + AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x3c00) AM_RAM + AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( poly880_io, AS_IO, 8, poly880_state ) + ADDRESS_MAP_GLOBAL_MASK(0xaf) + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_device, read_alt, write_alt) + AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_device, read_alt, write_alt) + AM_RANGE(0x88, 0x8b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(cldig_w) +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( poly880_state::trigger_reset ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_CHANGED_MEMBER( poly880_state::trigger_nmi ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + +static INPUT_PORTS_START( poly880 ) + PORT_START("KI1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EXEC") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACK") PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FCT") PORT_CODE(KEYCODE_T) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STEP") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_M) PORT_CHAR('-') + + PORT_START("KI2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + + PORT_START("KI3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RES") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, poly880_state, trigger_reset, 0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MON") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF, poly880_state, trigger_nmi, 0) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MCYCL") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CYCL") PORT_CODE(KEYCODE_F4) +INPUT_PORTS_END + +/* Z80-CTC Interface */ + +WRITE_LINE_MEMBER( poly880_state::ctc_z0_w ) +{ + // SEND +} + +WRITE_LINE_MEMBER( poly880_state::ctc_z1_w ) +{ +} + +/* Z80-PIO Interface */ + +WRITE8_MEMBER( poly880_state::pio1_pa_w ) +{ + /* + + bit signal description + + PA0 SD0 segment E + PA1 SD1 segment D + PA2 SD2 segment C + PA3 SD3 segment P + PA4 SD4 segment G + PA5 SD5 segment A + PA6 SD6 segment F + PA7 SD7 segment B + + */ + + m_segment = BITSWAP8(data, 3, 4, 6, 0, 1, 2, 7, 5); + + update_display(); +} + +READ8_MEMBER( poly880_state::pio1_pb_r ) +{ + /* + + bit signal description + + PB0 TTY + PB1 MIN tape input + PB2 MOUT tape output + PB3 + PB4 KI1 key row 1 input + PB5 KI2 key row 2 input + PB6 SCON + PB7 KI3 key row 3 input + + */ + + UINT8 data = 0xf0 | ((m_cassette->input() < +0.0) << 1); + int i; + + for (i = 0; i < 8; i++) + { + if (BIT(m_digit, i)) + { + if (!BIT(m_ki1->read(), i)) data &= ~0x10; + if (!BIT(m_ki2->read(), i)) data &= ~0x20; + if (!BIT(m_ki3->read(), i)) data &= ~0x80; + } + } + + return data; +} + +WRITE8_MEMBER( poly880_state::pio1_pb_w ) +{ + /* + + bit signal description + + PB0 TTY teletype serial output + PB1 MIN + PB2 MOUT tape output + PB3 + PB4 KI1 key row 1 input + PB5 KI2 key row 2 input + PB6 SCON + PB7 KI3 key row 3 input + + */ + + /* tape output */ + m_cassette->output( BIT(data, 2) ? +1.0 : -1.0); +} + +#if 0 +/* Z80 Daisy Chain */ + +static const z80_daisy_config poly880_daisy_chain[] = +{ + { Z80PIO1_TAG }, + { Z80PIO2_TAG }, + { Z80CTC_TAG }, + { NULL } +}; +#endif + +/* Machine Initialization */ + +void poly880_state::machine_start() +{ + /* register for state saving */ + save_item(NAME(m_digit)); + save_item(NAME(m_segment)); +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( poly880, poly880_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_7_3728MHz/8) + MCFG_CPU_PROGRAM_MAP(poly880_mem) + MCFG_CPU_IO_MAP(poly880_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_poly880 ) + + /* devices */ + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_7_3728MHz/16) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(poly880_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(poly880_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + + MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, XTAL_7_3728MHz/16) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(poly880_state, pio1_pa_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(poly880_state, pio1_pb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(poly880_state, pio1_pb_w)) + + MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, XTAL_7_3728MHz/16) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( poly880 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "poly880.i5", 0x0000, 0x0400, CRC(b1c571e8) SHA1(85bfe53d39d6690e79999a1e1240789497e72db0) ) + ROM_LOAD( "poly880.i6", 0x1000, 0x0400, CRC(9efddf5b) SHA1(6ffa2f80b2c6f8ec9e22834f739c82f9754272b8) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, poly880, 0, 0, poly880, poly880, driver_device, 0, "VEB Polytechnik", "Poly-Computer 880", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/portfoli.c b/src/mame/drivers/portfoli.c new file mode 100644 index 00000000000..1cbbc30fc57 --- /dev/null +++ b/src/mame/drivers/portfoli.c @@ -0,0 +1,929 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Atari Portfolio + + http://portfolio.wz.cz/ + http://www.pofowiki.de/doku.php + http://www.best-electronics-ca.com/portfoli.htm + http://www.atari-portfolio.co.uk/pfnews/pf9.txt + + + Undumped Atari cartridges: + + Utility-Card HPC-701 + Finance-Card HPC-702 + Science-Card HPC-703 + File Manager / Tutorial HPC-704 + PowerBASIC HPC-705 + Instant Spell HPC-709 + Hyperlist HPC-713 + Bridge Baron HPC-724 + Wine Companion HPC-725 + Diet / Cholesterol Counter HPC-726 + Astrologer HPC-728 + Stock Tracker HPC-729 + Chess HPC-750 + + + Undumped 3rd party cartridges: + + Adcalc AAC-1000 + Alpha Paging Interface SAMpage + Business Contacts and Information Manager BCIM + Checkwriter + Colossal Cave Adventure + Drug Interactions + Dynapulse 200M-A + Form Letters + FORTH programming system UTIL + FX-3 DUAT Flight Software + FX-4 Flight Planner + Graphics Screens + Marine Device Interface CM380 UMPIRE + Message Mover (Mac) MSG-PKG6 + Message Mover (PC) MSG-PKG5 + Micro Hedge + Micro-Roentgen Radiation Monitor RM-60 + Patient Management + PBase + PDD2 Utilities + Pharmaceuticals + Physician's Reference I + PIPELINE Fuel Management + REACT + Stocks Games + Terminal+ + Timekeeper + TIMEPAC-5 + +*/ + +/* + + TODO: + + - expansion port slot interface + - clock is running too fast + - create chargen ROM from tech manual + - memory error interrupt vector + - i/o port 8051 + - screen contrast + - system tick frequency selection (1 or 128 Hz) + - speaker + - credit card memory (A:/B:) + - software list + +*/ + +#include "includes/portfoli.h" +#include "bus/rs232/rs232.h" +#include "rendlay.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +enum +{ + INT_TICK = 0, + INT_KEYBOARD, + INT_ERROR, + INT_EXTERNAL +}; + +enum +{ + PID_COMMCARD = 0x00, + PID_SERIAL, + PID_PARALLEL, + PID_PRINTER, + PID_MODEM, + PID_NONE = 0xff +}; + +static const UINT8 INTERRUPT_VECTOR[] = { 0x08, 0x09, 0x00 }; + + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// check_interrupt - check interrupt status +//------------------------------------------------- + +void portfolio_state::check_interrupt() +{ + int level = (m_ip & m_ie) ? ASSERT_LINE : CLEAR_LINE; + + m_maincpu->set_input_line(INPUT_LINE_INT0, level); +} + + +//------------------------------------------------- +// trigger_interrupt - trigger interrupt request +//------------------------------------------------- + +void portfolio_state::trigger_interrupt(int level) +{ + // set interrupt pending bit + m_ip |= 1 << level; + + check_interrupt(); +} + + +//------------------------------------------------- +// irq_status_r - interrupt status read +//------------------------------------------------- + +READ8_MEMBER( portfolio_state::irq_status_r ) +{ + return m_ip; +} + + +//------------------------------------------------- +// irq_mask_w - interrupt enable mask +//------------------------------------------------- + +WRITE8_MEMBER( portfolio_state::irq_mask_w ) +{ + m_ie = data; + //logerror("IE %02x\n", data); + + check_interrupt(); +} + + +//------------------------------------------------- +// sivr_w - serial interrupt vector register +//------------------------------------------------- + +WRITE8_MEMBER( portfolio_state::sivr_w ) +{ + m_sivr = data; + //logerror("SIVR %02x\n", data); +} + + +//------------------------------------------------- +// IRQ_CALLBACK_MEMBER( portfolio_int_ack ) +//------------------------------------------------- + +IRQ_CALLBACK_MEMBER(portfolio_state::portfolio_int_ack) +{ + UINT8 vector = m_sivr; + + for (int i = 0; i < 4; i++) + { + if (BIT(m_ip, i)) + { + // clear interrupt pending bit + m_ip &= ~(1 << i); + + if (i == 3) + vector = m_sivr; + else + vector = INTERRUPT_VECTOR[i]; + + break; + } + } + + check_interrupt(); + + return vector; +} + + + +//************************************************************************** +// KEYBOARD +//************************************************************************** + +//------------------------------------------------- +// scan_keyboard - scan keyboard +//------------------------------------------------- + +void portfolio_state::scan_keyboard() +{ + UINT8 keycode = 0xff; + + UINT8 keydata[8] = { m_y0->read(), m_y1->read(), m_y2->read(), m_y3->read(), + m_y4->read(), m_y5->read(), m_y6->read(), m_y7->read() }; + + for (int row = 0; row < 8; row++) + { + UINT8 data = keydata[row]; + + if (data != 0xff) + { + for (int col = 0; col < 8; col++) + { + if (!BIT(data, col)) + { + keycode = (row * 8) + col; + } + } + } + } + + if (keycode != 0xff) + { + // key pressed + if (keycode != m_keylatch) + { + m_keylatch = keycode; + + trigger_interrupt(INT_KEYBOARD); + } + } + else + { + // key released + if (m_keylatch != 0xff) + { + m_keylatch |= 0x80; + + trigger_interrupt(INT_KEYBOARD); + } + } +} + + +//------------------------------------------------- +// TIMER_DEVICE_CALLBACK_MEMBER( keyboard_tick ) +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::keyboard_tick) +{ + scan_keyboard(); +} + + +//------------------------------------------------- +// keyboard_r - keyboard scan code register +//------------------------------------------------- + +READ8_MEMBER( portfolio_state::keyboard_r ) +{ + return m_keylatch; +} + + + +//************************************************************************** +// INTERNAL SPEAKER +//************************************************************************** + +//------------------------------------------------- +// speaker_w - internal speaker output +//------------------------------------------------- + +WRITE8_MEMBER( portfolio_state::speaker_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 speaker level + + */ + + m_speaker->level_w(!BIT(data, 7)); + + //logerror("SPEAKER %02x\n", data); +} + + + +//************************************************************************** +// POWER MANAGEMENT +//************************************************************************** + +//------------------------------------------------- +// power_w - power management +//------------------------------------------------- + +WRITE8_MEMBER( portfolio_state::power_w ) +{ + /* + + bit description + + 0 + 1 1=power off + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + //logerror("POWER %02x\n", data); +} + + +//------------------------------------------------- +// battery_r - battery status +//------------------------------------------------- + +READ8_MEMBER( portfolio_state::battery_r ) +{ + /* + + bit signal description + + 0 + 1 + 2 + 3 + 4 + 5 PDET 1=peripheral connected + 6 BATD? 0=battery low + 7 1=cold boot + + */ + + UINT8 data = 0; + + /* peripheral detect */ + data |= (m_pid != PID_NONE) << 5; + + /* battery status */ + data |= BIT(m_battery->read(), 0) << 6; + + return data; +} + + +//------------------------------------------------- +// unknown_w - ? +//------------------------------------------------- + +WRITE8_MEMBER( portfolio_state::unknown_w ) +{ + //logerror("UNKNOWN %02x\n", data); +} + + + +//************************************************************************** +// SYSTEM TIMERS +//************************************************************************** + +//------------------------------------------------- +// TIMER_DEVICE_CALLBACK_MEMBER( system_tick ) +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::system_tick) +{ + trigger_interrupt(INT_TICK); +} + + +//------------------------------------------------- +// TIMER_DEVICE_CALLBACK_MEMBER( counter_tick ) +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::counter_tick) +{ + m_counter++; +} + + +//------------------------------------------------- +// counter_r - counter register read +//------------------------------------------------- + +READ8_MEMBER( portfolio_state::counter_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0: + data = m_counter & 0xff; + break; + + case 1: + data = m_counter >> 1; + break; + } + + return data; +} + + +//------------------------------------------------- +// counter_w - counter register write +//------------------------------------------------- + +WRITE8_MEMBER( portfolio_state::counter_w ) +{ + switch (offset) + { + case 0: + m_counter = (m_counter & 0xff00) | data; + break; + + case 1: + m_counter = (data << 8) | (m_counter & 0xff); + break; + } +} + + + +//************************************************************************** +// EXPANSION +//************************************************************************** + +//------------------------------------------------- +// ncc1_w - credit card memory select +//------------------------------------------------- + +WRITE8_MEMBER( portfolio_state::ncc1_w ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + if (BIT(data, 0)) + { + // system ROM + program.install_rom(0xc0000, 0xdffff, m_rom); + } + else + { + // credit card memory + program.unmap_readwrite(0xc0000, 0xdffff); + } + + //logerror("NCC %02x\n", data); +} + + +//------------------------------------------------- +// pid_r - peripheral identification +//------------------------------------------------- + +READ8_MEMBER( portfolio_state::pid_r ) +{ + /* + + PID peripheral + + 00 communication card + 01 serial port + 02 parallel port + 03 printer peripheral + 04 modem + 05-3f reserved + 40-7f user peripherals + 80 file-transfer interface + 81-ff reserved + + */ + + return m_pid; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( portfolio_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( portfolio_mem, AS_PROGRAM, 8, portfolio_state ) + AM_RANGE(0x00000, 0x1efff) AM_RAM AM_SHARE("nvram1") + AM_RANGE(0x1f000, 0x9efff) AM_RAM // expansion + AM_RANGE(0xb0000, 0xb0fff) AM_MIRROR(0xf000) AM_RAM AM_SHARE("nvram2") // video RAM + AM_RANGE(0xc0000, 0xdffff) AM_ROM AM_REGION(M80C88A_TAG, 0) // or credit card memory + AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION(M80C88A_TAG, 0x20000) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( portfolio_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( portfolio_io, AS_IO, 8, portfolio_state ) + AM_RANGE(0x8000, 0x8000) AM_READ(keyboard_r) + AM_RANGE(0x8010, 0x8010) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, data_r, data_w) + AM_RANGE(0x8011, 0x8011) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, status_r, control_w) + AM_RANGE(0x8020, 0x8020) AM_WRITE(speaker_w) + AM_RANGE(0x8030, 0x8030) AM_WRITE(power_w) + AM_RANGE(0x8040, 0x8041) AM_READWRITE(counter_r, counter_w) + AM_RANGE(0x8050, 0x8050) AM_READWRITE(irq_status_r, irq_mask_w) + AM_RANGE(0x8051, 0x8051) AM_READWRITE(battery_r, unknown_w) + AM_RANGE(0x8060, 0x8060) AM_RAM AM_SHARE("contrast") +// AM_RANGE(0x8070, 0x8077) AM_DEVREADWRITE(M82C50A_TAG, ins8250_device, ins8250_r, ins8250_w) // Serial Interface +// AM_RANGE(0x8078, 0x807b) AM_DEVREADWRITE(M82C55A_TAG, i8255_device, read, write) // Parallel Interface + AM_RANGE(0x807c, 0x807c) AM_WRITE(ncc1_w) + AM_RANGE(0x807f, 0x807f) AM_READWRITE(pid_r, sivr_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( portfolio ) +//------------------------------------------------- + +static INPUT_PORTS_START( portfolio ) + PORT_START("Y0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Atari") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + + PORT_START("Y1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + + PORT_START("Y2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + + PORT_START("Y3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('"') PORT_CHAR('`') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("Y4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + + PORT_START("Y5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('8') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("Y6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fn") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("Y7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) + PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x00, "Low Battery" ) + + PORT_START("PERIPHERAL") + PORT_CONFNAME( 0xff, PID_NONE, "Peripheral" ) + PORT_CONFSETTING( PID_NONE, DEF_STR( None ) ) + PORT_CONFSETTING( PID_PARALLEL, "Intelligent Parallel Interface (HPC-101)" ) + PORT_CONFSETTING( PID_SERIAL, "Serial Interface (HPC-102)" ) +INPUT_PORTS_END + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +PALETTE_INIT_MEMBER(portfolio_state, portfolio) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + + +//------------------------------------------------- +// HD61830_INTERFACE( lcdc_intf ) +//------------------------------------------------- + +READ8_MEMBER( portfolio_state::hd61830_rd_r ) +{ + UINT16 address = ((offset & 0xff) << 3) | ((offset >> 12) & 0x07); + UINT8 data = m_char_rom[address]; + + return data; +} + + +//------------------------------------------------- +// gfx_layout charlayout +//------------------------------------------------- + +static const gfx_layout charlayout = +{ + 6, 8, + 256, + 1, + { 0 }, + { 7, 6, 5, 4, 3, 2 }, + { STEP8(0,8) }, + 8*8 +}; + + +//------------------------------------------------- +// GFXDECODE( portfolio ) +//------------------------------------------------- + +static GFXDECODE_START( portfolio ) + GFXDECODE_ENTRY( HD61830_TAG, 0, charlayout, 0, 2 ) +GFXDECODE_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// ins8250_interface i8250_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( portfolio_state::i8250_intrpt_w ) +{ + if (state) + trigger_interrupt(INT_EXTERNAL); +} + +//************************************************************************** +// IMAGE LOADING +//************************************************************************** + +//------------------------------------------------- +// DEVICE_IMAGE_LOAD( portfolio_cart ) +//------------------------------------------------- + +DEVICE_IMAGE_LOAD_MEMBER( portfolio_state, portfolio_cart ) +{ + return IMAGE_INIT_FAIL; +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// machine_start +//------------------------------------------------- + +void portfolio_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* memory expansions */ + switch (m_ram->size()) + { + case 128 * 1024: + program.unmap_readwrite(0x1f000, 0x9efff); + break; + + case 384 * 1024: + program.unmap_readwrite(0x5f000, 0x9efff); + break; + } + + /* set initial values */ + m_keylatch = 0xff; + m_sivr = 0x2a; + m_pid = 0xff; + + /* register for state saving */ + save_item(NAME(m_ip)); + save_item(NAME(m_ie)); + save_item(NAME(m_sivr)); + save_item(NAME(m_counter)); + save_item(NAME(m_keylatch)); + save_pointer(NAME(m_contrast.target()), m_contrast.bytes()); + save_item(NAME(m_pid)); +} + + +//------------------------------------------------- +// machine_reset +//------------------------------------------------- + +void portfolio_state::machine_reset() +{ + address_space &io = m_maincpu->space(AS_IO); + + // peripherals + m_pid = ioport("PERIPHERAL")->read(); + + io.unmap_readwrite(0x8070, 0x807b); + io.unmap_readwrite(0x807d, 0x807e); + + switch (m_pid) + { + case PID_SERIAL: + io.install_readwrite_handler(0x8070, 0x8077, READ8_DEVICE_DELEGATE(m_uart, ins8250_device, ins8250_r), WRITE8_DEVICE_DELEGATE(m_uart, ins8250_device, ins8250_w)); + break; + + case PID_PARALLEL: + io.install_readwrite_handler(0x8078, 0x807b, READ8_DEVICE_DELEGATE(m_ppi, i8255_device, read), WRITE8_DEVICE_DELEGATE(m_ppi, i8255_device, write)); + break; + } +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( portfolio ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( portfolio, portfolio_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M80C88A_TAG, I8088, XTAL_4_9152MHz) + MCFG_CPU_PROGRAM_MAP(portfolio_mem) + MCFG_CPU_IO_MAP(portfolio_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(portfolio_state,portfolio_int_ack) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(72) + MCFG_SCREEN_UPDATE_DEVICE(HD61830_TAG, hd61830_device, screen_update) + MCFG_SCREEN_SIZE(240, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(portfolio_state, portfolio) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", portfolio) + + MCFG_DEVICE_ADD(HD61830_TAG, HD61830, XTAL_4_9152MHz/2/2) + MCFG_HD61830_RD_CALLBACK(READ8(portfolio_state, hd61830_rd_r)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD(M82C55A_TAG, I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_ctrl_out", output_latch_device, write)) + MCFG_I8255_IN_PORTC_CB(DEVREAD8("cent_status_in", input_buffer_device, read)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) + MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit3)) + MCFG_CENTRONICS_SELECT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1)) + MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit0)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) + MCFG_OUTPUT_LATCH_BIT0_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) + MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_autofd)) + MCFG_OUTPUT_LATCH_BIT2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_init)) + MCFG_OUTPUT_LATCH_BIT3_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_select_in)) + + MCFG_DEVICE_ADD(M82C50A_TAG, INS8250, XTAL_1_8432MHz) // should be INS8250A + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_INS8250_OUT_INT_CB(WRITELINE(portfolio_state, i8250_intrpt_w)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("counter", portfolio_state, counter_tick, attotime::from_hz(XTAL_32_768kHz/16384)) + MCFG_TIMER_DRIVER_ADD_PERIODIC(TIMER_TICK_TAG, portfolio_state, system_tick, attotime::from_hz(XTAL_32_768kHz/32768)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, dsr_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, ri_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, cts_w)) + + /* fake keyboard */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", portfolio_state, keyboard_tick, attotime::from_usec(2500)) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "portfolio_cart") + MCFG_GENERIC_LOAD(portfolio_state, portfolio_cart) + + /* memory card */ +/* MCFG_MEMCARD_ADD("memcard_a") + MCFG_MEMCARD_EXTENSION_LIST("bin") + MCFG_MEMCARD_LOAD(portfolio_memcard) + MCFG_MEMCARD_SIZE_OPTIONS("32K,64K,128K") + + MCFG_MEMCARD_ADD("memcard_b") + MCFG_MEMCARD_EXTENSION_LIST("bin") + MCFG_MEMCARD_LOAD(portfolio_memcard) + MCFG_MEMCARD_SIZE_OPTIONS("32K,64K,128K")*/ + + /* software lists */ +// MCFG_SOFTWARE_LIST_ADD("cart_list", "pofo") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("384K,640K") + + MCFG_NVRAM_ADD_RANDOM_FILL("nvram1") + MCFG_NVRAM_ADD_RANDOM_FILL("nvram2") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( pofo ) +//------------------------------------------------- + +ROM_START( pofo ) + ROM_REGION( 0x40000, M80C88A_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "dip1072", "DIP DOS 1.072" ) + ROMX_LOAD( "rom b.u4", 0x00000, 0x20000, BAD_DUMP CRC(c9852766) SHA1(c74430281bc717bd36fd9b5baec1cc0f4489fe82), ROM_BIOS(1) ) // dumped with debug.com + ROMX_LOAD( "rom a.u3", 0x20000, 0x20000, BAD_DUMP CRC(b8fb730d) SHA1(1b9d82b824cab830256d34912a643a7d048cd401), ROM_BIOS(1) ) // dumped with debug.com + + ROM_REGION( 0x800, HD61830_TAG, 0 ) + ROM_LOAD( "hd61830 external character generator", 0x000, 0x800, BAD_DUMP CRC(747a1db3) SHA1(a4b29678fdb43791a8ce4c1ec778f3231bb422c5) ) // typed in from manual +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, pofo, 0, 0, portfolio, portfolio, driver_device, 0, "Atari", "Portfolio", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pp01.c b/src/mame/drivers/pp01.c new file mode 100644 index 00000000000..3ebde2d08ce --- /dev/null +++ b/src/mame/drivers/pp01.c @@ -0,0 +1,276 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + PP-01 driver by Miodrag Milanovic + + 08/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "includes/pp01.h" + + +/* Address maps */ +static ADDRESS_MAP_START(pp01_mem, AS_PROGRAM, 8, pp01_state ) + AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") + AM_RANGE(0x1000, 0x1fff) AM_RAMBANK("bank2") + AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") + AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4") + AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank5") + AM_RANGE(0x5000, 0x5fff) AM_RAMBANK("bank6") + AM_RANGE(0x6000, 0x6fff) AM_RAMBANK("bank7") + AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank8") + AM_RANGE(0x8000, 0x8fff) AM_RAMBANK("bank9") + AM_RANGE(0x9000, 0x9fff) AM_RAMBANK("bank10") + AM_RANGE(0xa000, 0xafff) AM_RAMBANK("bank11") + AM_RANGE(0xb000, 0xbfff) AM_RAMBANK("bank12") + AM_RANGE(0xc000, 0xcfff) AM_RAMBANK("bank13") + AM_RANGE(0xd000, 0xdfff) AM_RAMBANK("bank14") + AM_RANGE(0xe000, 0xefff) AM_RAMBANK("bank15") + AM_RANGE(0xf000, 0xffff) AM_RAMBANK("bank16") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pp01_io, AS_IO, 8, pp01_state ) + AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // system + //AM_RANGE(0xc4, 0xc7) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // user + AM_RANGE(0xc8, 0xc8) AM_MIRROR(2) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0xc9, 0xc9) AM_MIRROR(2) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0xcc, 0xcf) AM_WRITE(pp01_video_write_mode_w) + AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE(0xe0, 0xef) AM_MIRROR(0x10) AM_READWRITE(pp01_mem_block_r, pp01_mem_block_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pp01 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F13") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F14") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete line") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINEA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINEB") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINEC") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num *") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINED") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINEE") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num /") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINEF") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINEALL") + PORT_BIT(0x3F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) +INPUT_PORTS_END + +/* Machine driver */ +static MACHINE_CONFIG_START( pp01, pp01_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(pp01_mem) + MCFG_CPU_IO_MAP(pp01_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(pp01_state, screen_update_pp01) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(pp01_state, pp01) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + //MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + //MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_DEVICE_ADD("uart", I8251, 0) + // when rts and dtr are both high, the uart is being used for cassette operations + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(0) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(pp01_state,pp01_pit_out0)) + MCFG_PIT8253_CLK1(2000000) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(pp01_state,pp01_pit_out1)) + MCFG_PIT8253_CLK2(2000000) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pit8253", pit8253_device, write_clk0)) + + MCFG_DEVICE_ADD("ppi8255", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(pp01_state, pp01_8255_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pp01_state, pp01_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(pp01_state, pp01_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pp01_state, pp01_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pp01_state, pp01_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pp01_state, pp01_8255_portc_w)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( pp01 ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + + ROM_LOAD( "ep01.rom", 0x14000, 0x0400, CRC(e48e440f) SHA1(aaae41f0bf163f254e28f6e4d9f6010b349e0c45)) + ROM_LOAD( "ep02.rom", 0x14400, 0x0400, CRC(b9314867) SHA1(220e2a686c6624574e8ea7f6012030c8378a8be6)) + ROM_LOAD( "ep03.rom", 0x14800, 0x0400, CRC(47b91d49) SHA1(51445e24d1c375e798c5ed7b48cb1c7b5e01603a)) + ROM_LOAD( "ep04.rom", 0x14c00, 0x0400, CRC(cc890123) SHA1(7110f301453d925da0d3f29c2ba4eacd5ff8583d)) + ROM_LOAD( "ep05.rom", 0x15000, 0x0400, CRC(b36e2071) SHA1(7c7b2c410f4039980627196575109426bb7bab35)) + ROM_LOAD( "ep06.rom", 0x15400, 0x0400, CRC(3f74efb3) SHA1(77d055eb53ba9b4b14eb2bb8d71f93095b846bb5)) + ROM_LOAD( "ep07.rom", 0x15800, 0x0400, CRC(1dd0bc29) SHA1(109bc3f24a76884d2581f75edc532917cb7ea155)) + ROM_LOAD( "ep08.rom", 0x15c00, 0x0400, CRC(607b710a) SHA1(c5ac7da31204c54d6892d6b708d0291d71963581)) + ROM_LOAD( "ep09.rom", 0x16000, 0x0400, CRC(07f773d1) SHA1(a6cf454318ef0a564a86e669b751e414b12c12d1)) + ROM_LOAD( "ep10.rom", 0x16400, 0x0400, CRC(7793d84b) SHA1(d16ad3db36c8cec68713082ee60324219d3d5032)) + ROM_LOAD( "ep11.rom", 0x16800, 0x0400, CRC(d1b98b5e) SHA1(5526af6317667d707ae413916242cd1bac821373)) + ROM_LOAD( "ep12.rom", 0x16c00, 0x0400, CRC(03c45326) SHA1(f9157ab86cdf1d111bcf19c24e4d7250705be965)) + ROM_LOAD( "ep13.rom", 0x17000, 0x0400, CRC(51769d6c) SHA1(76d6e91cf32b1eb94b9c0ded02e5057ed7ff7d72)) + ROM_LOAD( "ep14.rom", 0x17400, 0x0400, CRC(5d48cefb) SHA1(9b8599dabaf7297ec800fa9a122ad7e3b7b30e8b)) + ROM_LOAD( "ep15.rom", 0x17800, 0x0400, CRC(f44bfe36) SHA1(0ab3c4f061dff6f779685409b07343d0a839fdae)) + ROM_LOAD( "ep16.rom", 0x17c00, 0x0400, CRC(f39c230d) SHA1(9789cedef5655bcb82561f387cc1a6cf48287d78)) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, pp01, 0, 0, pp01, pp01, driver_device, 0, "ZVT", "PP-01", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/prestige.c b/src/mame/drivers/prestige.c new file mode 100644 index 00000000000..18049ff3952 --- /dev/null +++ b/src/mame/drivers/prestige.c @@ -0,0 +1,893 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/* + +VTech PreComputer Prestige Elite + +PCB Layout +---------- + +|-------------------------------------------| +| |-------CN1-------| CN2 | +| | +| CN3 | +| | +|CN10 | +|CN9 RAM --| +|CN8 | +| | +| Z80 ROM | +| 04010 CN4 | +|CN7 | +|CN6 | +| |------CN5------| --| +|-------------------------------------------| + +Notes: + All IC's shown. + + ROM - VTech LH5S8R14, labeled "1998 27-6020-02" (dumped as 1Mx8) + Z80 - Z80 family SOC? + RAM - LG Semicon GM76C256CLLFW55 32Kx8 Static RAM + 04010 - ? + CN1 - Centronics connector + CN2 - mouse connector + CN3 - LCD ribbon cable + CN4 - expansion connector + CN5 - keyboard ribbon cable + CN6 - speaker wire + CN7 - volume wire + CN8 - ? wire + CN9 - power wire + CN10 - NVRAM battery wire +*/ + +/* + + Undumped cartridges: + + 80-1410 Super Science + 80-1533 Famous Things & Places + 80-0989 Bible Knowledge + 80-1001 Fantasy Trivia + 80-1002 General Knowledge II + 80-1003 Sports History + 80-2314 Familiar Faces + 80-2315 Historical Happenings + 80-2333 Arts, Entertainment & More + 80-2334 Customs & Cultures + 80-1531 32K RAM Memory Expansion Cartridge + 80-12051 Space Scholar + 80-12053 Frenzy of Facts + 80-12052 Spreadsheet Success + +*/ + +/* + + TODO: + + - identify unknown chips (maybe related to the sound??) + - better IRQ timing + - the mouse is too slow and sometime freezes + - finish to decode the memory banking + - sound + - cartridges + +*/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "rendlay.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class prestige_state : public driver_device +{ +public: + prestige_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_cart(*this, "cartslot"), + m_keyboard(*this, "KEY"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_bank5(*this, "bank5") + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_cart; + required_ioport_array<16> m_keyboard; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_memory_bank m_bank5; + + UINT8 m_bank[7]; + UINT8 m_kb_matrix; + UINT8 m_irq_counter; + UINT8 m_mousex; + UINT8 m_mousey; + UINT8 *m_vram; + struct + { + UINT16 addr1; + UINT16 addr2; + UINT8 lcd_w; + UINT8 lcd_h; + UINT8 fb_width; + UINT8 split_pos; + } m_lcdc; + + virtual void machine_start(); + UINT32 screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_1bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_2bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + memory_region *m_cart_rom; + + DECLARE_READ8_MEMBER( bankswitch_r ); + DECLARE_WRITE8_MEMBER( bankswitch_w ); + DECLARE_READ8_MEMBER( kb_r ); + DECLARE_WRITE8_MEMBER( kb_w ); + DECLARE_READ8_MEMBER( mouse_r ); + DECLARE_WRITE8_MEMBER( mouse_w ); + DECLARE_WRITE8_MEMBER( lcdc_w ); + DECLARE_PALETTE_INIT(prestige); + DECLARE_PALETTE_INIT(glcolor); + TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); + IRQ_CALLBACK_MEMBER(prestige_int_ack); +}; + + +READ8_MEMBER( prestige_state::bankswitch_r ) +{ + return m_bank[offset]; +} + +WRITE8_MEMBER( prestige_state::bankswitch_w ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + switch (offset) + { + case 0: + m_bank1->set_entry(data & 0x3f); + break; + + case 1: + if (!(m_bank[5] & 0x01) && (m_bank[5] & 0x02) && m_cart->exists()) + m_bank2->set_entry(0x40 + (data & 0x1f)); + else + m_bank2->set_entry(data & 0x3f); + break; + + case 2: + if (!(m_bank[5] & 0x01) && (m_bank[5] & 0x04) && m_cart->exists()) + m_bank3->set_entry(0x40 + (data & 0x1f)); + else + m_bank3->set_entry(data & 0x3f); + break; + + case 3: + m_bank4->set_entry(data & 0x03); + break; + + case 4: + m_bank5->set_entry(data & 0x03); + break; + + case 5: + if (m_bank[5] == data) + break; + + if (data & 0x20) + { + program.install_ram(0x8000, 0xbfff, m_vram); + } + else if (ioport("CART_TYPE")->read() == 0x01) + { + //cartridge memory is writable + if (data & 0x02) + program.install_readwrite_bank(0x4000, 0x7fff, "bank2"); + else + program.unmap_write(0x4000, 0x7fff); + + if (data & 0x04) + program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); + else + program.unmap_write(0x8000, 0xbfff); + } + else + { + //cartridge memory is read-only + program.unmap_write(0x4000, 0xbfff); + program.install_read_bank(0x8000, 0xbfff, "bank3"); + } + break; + case 6: + break; + } + + m_bank[offset] = data; +} + +READ8_MEMBER( prestige_state::kb_r ) +{ + UINT8 data = 0xff; + + for (int line=0; line<8; line++) + if (!(m_kb_matrix & (1<read(); + + return data; +} + +WRITE8_MEMBER( prestige_state::kb_w ) +{ + m_kb_matrix = data; +} + +READ8_MEMBER( prestige_state::mouse_r ) +{ + INT16 data = 0; + + switch( offset ) + { + case 0: //x-axis + data = (ioport("MOUSEX")->read() - m_mousex); + break; + case 1: //y-axis + data = (ioport("MOUSEY")->read() - m_mousey); + break; + } + + data = MIN(data, +127); + data = MAX(data, -127); + + return 0x80 + data; +} + +WRITE8_MEMBER( prestige_state::mouse_w ) +{ + switch( offset ) + { + case 0: //x-axis + m_mousex = ioport("MOUSEX")->read(); + break; + case 1: //y-axis + m_mousey = ioport("MOUSEY")->read(); + break; + } +} + +WRITE8_MEMBER( prestige_state::lcdc_w ) +{ + switch(offset) + { + case 0x02: + m_lcdc.lcd_w = data; + break; + case 0x04: + m_lcdc.lcd_h = data; + break; + case 0x06: + m_lcdc.addr1 = (m_lcdc.addr1 & 0xff00) | data; + break; + case 0x07: + m_lcdc.addr1 = (m_lcdc.addr1 & 0x00ff) | (data << 8); + break; + case 0x08: + m_lcdc.addr2 = (m_lcdc.addr2 & 0xff00) | data; + break; + case 0x09: + m_lcdc.addr2 = (m_lcdc.addr2 & 0x00ff) | (data << 8); + break; + case 0x0a: + m_lcdc.split_pos = data; + break; + case 0x0d: + m_lcdc.fb_width = data; + break; + default: + logerror("Unknown LCDC reg write %x = %x\n", offset, data); + } +} + + +static ADDRESS_MAP_START(prestige_mem, AS_PROGRAM, 8, prestige_state) + AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank3") + AM_RANGE(0xc000, 0xdfff) AM_RAMBANK("bank4") + AM_RANGE(0xe000, 0xffff) AM_RAMBANK("bank5") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( prestige_io , AS_IO, 8, prestige_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x04, 0x05) AM_READWRITE(mouse_r, mouse_w) + AM_RANGE(0x30, 0x3f) AM_WRITE(lcdc_w) + AM_RANGE(0x40, 0x40) AM_WRITE(kb_w) + AM_RANGE(0x41, 0x42) AM_READ(kb_r) + AM_RANGE(0x50, 0x56) AM_READWRITE(bankswitch_r, bankswitch_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( glcolor_io , AS_IO, 8, prestige_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x30, 0x3f) AM_WRITE(lcdc_w) + AM_RANGE(0x40, 0x40) AM_WRITE(kb_w) + AM_RANGE(0x41, 0x42) AM_READ(kb_r) + AM_RANGE(0x50, 0x56) AM_READWRITE(bankswitch_r, bankswitch_w) +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( prestige ) + PORT_START("CART_TYPE") + PORT_CONFNAME( 0x01, 0x00, "Cartridge Type" ) + PORT_CONFSETTING( 0x00, "ROM" ) + PORT_CONFSETTING( 0x01, "RAM" ) + + PORT_START("MOUSEX") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(2) + + PORT_START("MOUSEY") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(2) + + PORT_START("KEY.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xca\xbb") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + + PORT_START("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + + PORT_START("KEY.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Up (KB)") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + + PORT_START("KEY.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Left (KB)") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc2\xa1") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + + PORT_START("KEY.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Right (KB)") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + + PORT_START("KEY.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Down (KB)") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb1") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_PGUP) + + PORT_START("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Symbol") PORT_CODE(KEYCODE_PGDN) + + PORT_START("KEY.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Answer") PORT_CODE(KEYCODE_END) + + PORT_START("KEY.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Word Games") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Player") PORT_CODE(KEYCODE_F2) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mathematics") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Level") PORT_CODE(KEYCODE_F4) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.10") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Trivia") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cartridge") PORT_CODE(KEYCODE_F6) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.11") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Logic Games") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Business Basics") PORT_CODE(KEYCODE_F8) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.12") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.13") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.14") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left mouse button (KB)") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KEY.15") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right mouse button (KB)") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) + +INPUT_PORTS_END + +INPUT_PORTS_START( glcolor ) + PORT_START("CART_TYPE") + PORT_CONFNAME( 0x01, 0x00, "Cartridge Type" ) + PORT_CONFSETTING( 0x00, "ROM" ) + PORT_CONFSETTING( 0x01, "RAM" ) + + PORT_START("KEY.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + + PORT_START("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("Help") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00df) PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + + PORT_START("KEY.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("KEY.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("KEY.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("Spieler 1") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("KEY.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("Spielers") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("Stufe") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("Symbols") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + + PORT_START("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Button 1") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("Button 2") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Button 3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Button 4") + + PORT_START("KEY.7") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("KEY.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Backspace") PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("KEY.9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("KEY.10") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("KEY.11") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("KEY.12") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("Spieler 2") + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("KEY.13") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("KEY.14") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("KEY.15") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) + +INPUT_PORTS_END + +INPUT_PORTS_START( glmcolor ) + PORT_INCLUDE(glcolor) + + PORT_MODIFY("KEY.14") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 2") + + PORT_START("MOUSEX") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) + + PORT_START("MOUSEY") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) +INPUT_PORTS_END + + +IRQ_CALLBACK_MEMBER(prestige_state::prestige_int_ack) +{ + UINT32 vector; + + m_maincpu->set_input_line(0, CLEAR_LINE); + + if (m_irq_counter == 0x04) + { + m_irq_counter = 0; + vector = 0x0020; + } + else + { + m_irq_counter++; + vector = 0x0030; + } + + return (0xcd<<16) | vector; +} + +void prestige_state::machine_start() +{ + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + UINT8 *rom = memregion("maincpu")->base(); + UINT8 *cart = m_cart_rom->base(); + UINT8 *ram = m_ram->pointer(); + memset(ram, 0x00, m_ram->size()); + + m_bank1->configure_entries(0, 64, rom, 0x4000); + m_bank1->configure_entries(64,32, cart, 0x4000); + m_bank2->configure_entries(0, 64, rom, 0x4000); + m_bank2->configure_entries(64,32, cart, 0x4000); + m_bank3->configure_entries(0, 64, rom, 0x4000); + m_bank3->configure_entries(64,32, cart, 0x4000); + m_bank4->configure_entries(0, 4, ram, 0x2000); + m_bank5->configure_entries(0, 4, ram, 0x2000); + + m_bank1->set_entry(0); + m_bank2->set_entry(0); + m_bank3->set_entry(0); + m_bank4->set_entry(0); + m_bank5->set_entry(0); + + //pointer to the videoram + m_vram = ram; +} + +PALETTE_INIT_MEMBER(prestige_state, prestige) +{ + palette.set_pen_color(0, rgb_t(39, 108, 51)); + palette.set_pen_color(1, rgb_t(16, 37, 84)); +} + +PALETTE_INIT_MEMBER(prestige_state, glcolor) +{ + palette.set_pen_color(0, rgb_t(0x3f,0xbf,0x3f)); + palette.set_pen_color(1, rgb_t(0xff,0x3f,0x5f)); + palette.set_pen_color(2, rgb_t(0x1f,0x1f,0x3f)); + palette.set_pen_color(3, rgb_t(0xff,0xdf,0x1f)); +} + +UINT32 prestige_state::screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int width = m_lcdc.fb_width + m_lcdc.lcd_w + 1; + + for (int y = 0; y <= m_lcdc.lcd_h; y++) + { + int line_start; + if (y <= m_lcdc.split_pos) + line_start = m_lcdc.addr1 + y * width; + else + line_start = m_lcdc.addr2 + (y - m_lcdc.split_pos - 1) * width; + + for (int sx = 0; sx <= m_lcdc.lcd_w; sx++) + { + UINT8 data = m_vram[(line_start + sx) & 0x1fff]; + + for (int x = 0; x < 8 / bpp; x++) + { + int pix = 0; + for (int b=0; bset_input_line(0, ASSERT_LINE); +} + +static MACHINE_CONFIG_START( prestige_base, prestige_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz) // Z84C008 + MCFG_CPU_PROGRAM_MAP(prestige_mem) + MCFG_CPU_IO_MAP(prestige_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(prestige_state,prestige_int_ack) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", prestige_state, irq_timer, attotime::from_msec(10)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(prestige_state, screen_update_1bpp) + MCFG_SCREEN_SIZE( 240, 100 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 240-1, 0, 100-1 ) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT( layout_lcd ) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(prestige_state, prestige) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "genius_cart") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("64K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( glcolor, prestige_base ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(glcolor_io) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(prestige_state, screen_update_2bpp) + MCFG_SCREEN_SIZE( 160, 80 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 160-1, 0, 80-1 ) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(4) + MCFG_PALETTE_INIT_OWNER(prestige_state, glcolor) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "glcolor") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( glmcolor, glcolor ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(prestige_io) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( prestige, prestige_base ) + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl6000sl_cart", "gl6000sl") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( gl6000sl, prestige_base ) + MCFG_SOFTWARE_LIST_ADD("cart_list", "gl6000sl") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( gl7007sl, prestige_base ) + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl6000sl_cart", "gl6000sl") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( gjmovie, prestige_base ) + MCFG_SOFTWARE_LIST_ADD("cart_list", "gjmovie") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( gl6000sl ) + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD( "27-5894-01", 0x000000, 0x080000, CRC(7336231c) SHA1(35a1f739994b5c8fb67a7f76d423e50d8154e9ea) ) +ROM_END + +ROM_START( gl7007sl ) + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD( "27-6060-00", 0x000000, 0x100000, CRC(06b2a595) SHA1(654d00e55ee43627ff947d72676c8e48e0518123) ) +ROM_END + +ROM_START( prestige ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-6020-02.u2", 0x00000, 0x100000, CRC(6bb6db14) SHA1(5d51fc3fd799e7f01ee99c453f9005fb07747b1e) ) +ROM_END + +ROM_START( gwnf ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-6372-00.bin", 0x00000, 0x100000, CRC(1bb574bd) SHA1(04234a33405782e8641883ebd6dee46a24e014d5) ) +ROM_END + +ROM_START( glcolor ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-5488-00.u5", 0x00000, 0x080000, CRC(e6cf7702) SHA1(ce40418a7777b331bf8c4c881d51732aeb384582) ) +ROM_END + +ROM_START( glscolor ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-5488-00.u5", 0x00000, 0x080000, CRC(e6cf7702) SHA1(ce40418a7777b331bf8c4c881d51732aeb384582) ) // identical to 'Genius Leader Color' +ROM_END + +ROM_START( glmcolor ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-5673-00.u6", 0x00000, 0x100000, CRC(c4245392) SHA1(bb651aaf11b75f4155c0a0106de9394018110cc7) ) +ROM_END + +ROM_START( gj4000 ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-05886-000-000.u4", 0x000000, 0x40000, CRC(5f6db95b) SHA1(fe683154e33a82ea38696096616d11e850e0c7a3)) +ROM_END + +ROM_START( gj5000 ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-6019-01.u2", 0x000000, 0x80000, CRC(946e5b7d) SHA1(80963d6ad80d49e54c8996bfc77ac135c4935be5)) +ROM_END + +ROM_START( gjmovie ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "lh532hlk.bin", 0x000000, 0x40000, CRC(2e64c296) SHA1(604034f902e20851cb9af60964031a508ceef83e)) +ROM_END + +ROM_START( gjrstar ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-5740-00.u1", 0x000000, 0x40000, CRC(ff3dc3bb) SHA1(bc16dfc1e12b0008456c700c431c8df6263b671f)) +ROM_END + +ROM_START( gjrstar2 ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "27-5740-00.u1", 0x000000, 0x40000, CRC(ff3dc3bb) SHA1(bc16dfc1e12b0008456c700c431c8df6263b671f)) // identical to 'Genius Junior Redstar' +ROM_END + +ROM_START( gjrstar3 ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "54-06056-000-000.u3", 0x000000, 0x040000, CRC(72522179) SHA1(ede9491713ad018012cf925a519bcafe126f1ad3)) +ROM_END + +ROM_START( gl6600cx ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_LOAD( "54-06400-00.u1", 0x000000, 0x200000, CRC(b05cd075) SHA1(b1d9eb02ca56350eb9e89518db89c0a2a845ebd8)) +ROM_END + +ROM_START( gkidabc ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD("27-5730-00.bin", 0x00000, 0x20000, CRC(64664708) SHA1(74212c2dec1caa41dbc933b50f857904a8ac623b)) +ROM_END + +ROM_START( cars2lap ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_LOAD("n25s16.u6", 0x00000, 0x200000, CRC(ec1ba96e) SHA1(51b8844ae77adf20f74f268d380d268c9ce19785)) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1994, glcolor, 0, 0, glcolor, glcolor, driver_device, 0, "VTech", "Genius Leader Color (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1994, glscolor, glcolor, 0, glcolor, glcolor, driver_device, 0, "VTech", "Genius Leader Super Color (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1996, glmcolor, 0, 0, glmcolor, glmcolor, driver_device, 0, "VTech", "Genius Leader Magic Color (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1997, gl6000sl, 0, 0, gl6000sl, prestige, driver_device, 0, "VTech", "Genius Leader 6000SL (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1998, gl7007sl, 0, 0, gl7007sl, prestige, driver_device, 0, "VTech", "Genius Leader 7007SL (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1998, prestige, 0, 0, prestige, prestige, driver_device, 0, "VTech", "PreComputer Prestige Elite", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1999, gwnf, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Winner Notebook Fun (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) + + +// these systems need to be moved into a separate driver +COMP( 1996, gj4000, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior 4000 (Germany)", MACHINE_IS_SKELETON) +COMP( 1996, gkidabc, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius KID ABC Fan (Germany)", MACHINE_IS_SKELETON) +COMP( 1993, gjmovie, 0, 0, gjmovie, prestige, driver_device, 0, "VTech", "Genius Junior Movie (Germany)", MACHINE_IS_SKELETON) +COMP( 1996, gjrstar, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior Redstar(Germany)", MACHINE_IS_SKELETON) +COMP( 1996, gjrstar2, gjrstar, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior Redstar 2 (Germany)", MACHINE_IS_SKELETON) +COMP( 1998, gjrstar3, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior Redstar 3 (Germany)", MACHINE_IS_SKELETON) +COMP( 1998, gj5000, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior 5000 (Germany)", MACHINE_IS_SKELETON) +COMP( 2012, cars2lap, 0, 0, prestige, prestige, driver_device, 0, "VTech", "CARS 2 Laptop (Germany)", MACHINE_IS_SKELETON) + + +// gl6600cx use a NSC1028 system-on-a-chip designed by National Semiconductor specifically for VTech +// http://web.archive.org/web/19991127134657/http://www.national.com/news/item/0,1735,425,00.html +COMP( 1999, gl6600cx, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Leader 6600CX (Germany)", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/primo.c b/src/mame/drivers/primo.c new file mode 100644 index 00000000000..65e40039316 --- /dev/null +++ b/src/mame/drivers/primo.c @@ -0,0 +1,382 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/******************************************************************************* + +Primo driver by Krzysztof Strzecha + +What's new: +----------- +2009.07.19 - Removed hacked and duplicated ROMs (Krzysztof Strzecha) +2008.08.31 - Added new ROMs including B32 and B48 [Miodrag Milanovic] +2005.05.19 - Primo B-32 and B-48 testdrivers added. +2005.05.15 - EPROM+RAM expansion. + Support for .pp files improved. + Some cleanups. +2005.05.12 - Memory fixed for A-48 model what make it fully working. + Fixed address of second video memory area. + +To do: + 1. Disk + 2. V.24 / tape control + 3. CDOS autoboot + 4. Joystick + 5. Printer + 6. .PRI format + +Primo variants: + A-32 - 16kB RAM + 16KB ROM + A-48 - 32kB RAM + 16KB ROM + A-64 - 48kB RAM + 16KB ROM + B-32 - 16kB RAM + 16KB ROM + B-48 - 32kB RAM + 16KB ROM + B-64 - 48kB RAM + 16KB ROM + +CPU: + U880D (DDR clone of Z80), 2.5 MHz + +Memory map: + A-32, B-32 + 0000-3fff ROM + 4000-7fff RAM + 8000-bfff not mapped + c000-ffff not mapped + + A-48, B-48 + 0000-3fff ROM + 4000-7fff RAM + 8000-bfff RAM + c000-ffff not mapped + + A-64, B-64 + 0000-3fff ROM + 4000-7fff RAM + 8000-bfff RAM + c000-ffff RAM + +I/O Ports: + Write: + 00h-3fh + bit 7 - NMI + 0 - disable + 1 - enable + bit 6 - joystick register shift + bit 5 - V.24 (2) / tape control + bit 4 - speaker + bit 3 - display page + 0 - secondary + 1 - primary + bit 2 - V.24 (1) / tape control + bit 1 - cassette output + bit 0 / + 00 - -110mV + 01 - 0V + 10 - 0V + 11 - 110mV + 40h-ffh (B models only) + bit 7 - not used + bit 6 - not used + bit 5 - SCLK + bit 4 - SDATA + bit 3 - not used + bit 2 - SRQ + bit 1 - ATN + bit 0 - not used + Read: + 00h-3fh + bit 7 - not used + bit 6 - not used + bit 5 - VBLANK + bit 4 - I4 + bit 3 - I3 + bit 2 - cassette input + bit 1 - reset + bit 0 - keyboard input + 40h-ffh (B models only) + bit 7 - not used + bit 6 - not used + bit 5 - SCLK + bit 4 - SDATA + bit 3 - SRQ + bit 2 - joystick 2 + bit 1 - ATN + bit 0 - joystick 1 + +Interrupts: + NMI - 20ms (50HZ), can be disbled/enabled by I/O write + +*******************************************************************************/ + +#include "emu.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "includes/primo.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "formats/primoptp.h" +#include "bus/cbmiec/cbmiec.h" + +static ADDRESS_MAP_START( primoa_port, AS_IO, 8, primo_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x00, 0x3f ) AM_READWRITE(primo_be_1_r, primo_ki_1_w ) + AM_RANGE( 0xfd, 0xfd ) AM_WRITE(primo_FD_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( primob_port, AS_IO, 8, primo_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x00, 0x3f ) AM_READWRITE(primo_be_1_r, primo_ki_1_w ) + AM_RANGE( 0x40, 0x7f ) AM_READWRITE(primo_be_2_r, primo_ki_2_w ) + AM_RANGE( 0xfd, 0xfd ) AM_WRITE(primo_FD_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( primo32_mem, AS_PROGRAM, 8, primo_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x4000, 0x7fff ) AM_RAM AM_MIRROR ( 0x8000 ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( primo48_mem, AS_PROGRAM, 8, primo_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x4000, 0x7fff ) AM_RAM + AM_RANGE( 0x8000, 0xbfff ) AM_RAM AM_MIRROR ( 0x4000 ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( primo64_mem, AS_PROGRAM, 8, primo_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x4000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static INPUT_PORTS_START( primo ) + PORT_START( "IN0" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UPPER") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTR") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START( "IN1" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + + PORT_START( "IN2" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR('>') PORT_CHAR('<') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('|') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + + PORT_START( "IN3" ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("?") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('\'') + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA3") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CLS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x80\x9A") PORT_CODE(KEYCODE_COLON) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA2") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA0") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x80\x9D") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BRK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START( "RESET" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "CPU_CLOCK" ) + PORT_CONFNAME(0x01, 0x00, "CPU clock" ) + PORT_CONFSETTING( 0x00, "2.50 MHz" ) + PORT_CONFSETTING( 0x01, "3.75 MHz" ) + + PORT_START( "MEMORY_EXPANSION" ) + PORT_CONFNAME(0x01, 0x00, "EPROM+RAM Expansion" ) + PORT_CONFSETTING( 0x00, DEF_STR( On ) ) + PORT_CONFSETTING( 0x01, DEF_STR( Off ) ) +INPUT_PORTS_END + +static const struct CassetteOptions primo_cassette_options = { + 1, /* channels */ + 16, /* bits per sample */ + 22050 /* sample frequency */ +}; + +static MACHINE_CONFIG_START( primoa32, primo_state ) + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", Z80, 2500000 ) + MCFG_CPU_PROGRAM_MAP( primo32_mem) + MCFG_CPU_IO_MAP( primoa_port) + MCFG_CPU_VBLANK_INT_DRIVER("screen", primo_state, primo_vblank_interrupt) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE( 50 ) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE( 256, 192 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 256-1, 0, 192-1 ) + MCFG_SCREEN_UPDATE_DRIVER(primo_state, screen_update_primo) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* snapshot/quickload */ + MCFG_SNAPSHOT_ADD("snapshot", primo_state, primo, "pss", 0) + MCFG_QUICKLOAD_ADD("quickload", primo_state, primo, "pp", 0) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(primo_ptp_format) + MCFG_CASSETTE_CREATE_OPTS(&primo_cassette_options) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) + + /* floppy from serial bus */ + MCFG_CBM_IEC_ADD(NULL) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_plain_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_plain_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( primoa48, primoa32 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(primo48_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( primoa64, primoa32 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(primo64_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( primob32, primoa32 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(primob_port) + + MCFG_MACHINE_RESET_OVERRIDE(primo_state, primob) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( primob48, primoa48 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(primob_port) + + MCFG_MACHINE_RESET_OVERRIDE(primo_state, primob) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( primob64, primoa64 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(primob_port) + + MCFG_MACHINE_RESET_OVERRIDE(primo_state, primob) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( primoc64, primoa64 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(primob_port) + + MCFG_MACHINE_RESET_OVERRIDE(primo_state, primob) +MACHINE_CONFIG_END + +ROM_START( primoa32 ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "a32_1.rom", 0x10000, 0x1000, CRC(4e91c1a4) SHA1(bf6e41b6b36a2556a50065e9acfd8cd57968f039) ) + ROM_LOAD( "a32_2.rom", 0x11000, 0x1000, CRC(81a8a0fb) SHA1(df75bd7774969cabb062e50da6004f2efbde489e) ) + ROM_LOAD( "a32_3.rom", 0x12000, 0x1000, CRC(a97de2f5) SHA1(743c76121f5b9e1eab35c8c00797311f58da5243) ) + ROM_LOAD( "a32_4.rom", 0x13000, 0x1000, CRC(70f84bc8) SHA1(9ae1c06531edf20c14ba47e78c0747dd2a92612a) ) +ROM_END + +ROM_START( primoa48 ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "a48_1.rom", 0x10000, 0x1000, CRC(7de6ad6f) SHA1(f2fd6fac4f9bc57c646efe40281758bb7c3f56e1) ) + ROM_LOAD( "a48_2.rom", 0x11000, 0x1000, CRC(81a8a0fb) SHA1(df75bd7774969cabb062e50da6004f2efbde489e) ) + ROM_LOAD( "a48_3.rom", 0x12000, 0x1000, CRC(a97de2f5) SHA1(743c76121f5b9e1eab35c8c00797311f58da5243) ) + ROM_LOAD( "a48_4.rom", 0x13000, 0x1000, CRC(e4d0c452) SHA1(4a98ff7502f1236445250d6b4e1c34850734350e) ) +ROM_END + +ROM_START( primoa64 ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "ver1", "ver 1") + ROM_LOAD( "a64_1.rom", 0x10000, 0x1000, CRC(6a7a9b9b) SHA1(e9ce16f90d9a799a26a9cef09d9ee6a6d7749484) ) + ROM_LOAD( "a64_2.rom", 0x11000, 0x1000, CRC(81a8a0fb) SHA1(df75bd7774969cabb062e50da6004f2efbde489e) ) + ROM_LOAD( "a64_3.rom", 0x12000, 0x1000, CRC(a97de2f5) SHA1(743c76121f5b9e1eab35c8c00797311f58da5243) ) + ROM_LOAD( "a64_4.rom", 0x13000, 0x1000, CRC(e4d0c452) SHA1(4a98ff7502f1236445250d6b4e1c34850734350e) ) +ROM_END + +ROM_START( primob32 ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "b32.rom", 0x10000, 0x4000, CRC(f594d2bb) SHA1(b74961dba008a1a6f15a22ddbd1b89acd7e286c2) ) +ROM_END + +ROM_START( primob48 ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "b48.rom", 0x10000, 0x4000, CRC(df3d2a57) SHA1(ab9413aa9d7749d30a486da00bc8c6d178a2172c) ) +ROM_END + +ROM_START( primob64 ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "standart", "Standart") + ROMX_LOAD( "b64.rom", 0x10000, 0x4000, CRC(cea28188) SHA1(a77e42e97402e601b78ab3751eac1e85d0bbb4a0), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "cdos", "CDOS") + ROMX_LOAD( "b64cdos.rom", 0x10000, 0x4000, CRC(73305e4d) SHA1(c090c3430cdf19eed8363377b981e1c21a4ed169), ROM_BIOS(2) ) +ROM_END + +ROM_START( primoc64 ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "c64_1.rom", 0x10000, 0x1000, CRC(c22290ea) SHA1(af5c73f6d0f7a987c4f082a5cb69e3f016127d57) ) + ROM_LOAD( "c64_2.rom", 0x11000, 0x1000, CRC(0756b56e) SHA1(589dbdb7c43ca7ca29ed1e56e080adf8c069e407) ) + ROM_LOAD( "c64_3.rom", 0x12000, 0x1000, CRC(fc56e0af) SHA1(b547fd270d3413400bc800f5b7ea9153b7a59bff) ) + ROM_LOAD( "c64_4.rom", 0x13000, 0x1000, CRC(3770e3e6) SHA1(792cc71d8f89eb447f94aded5afc70d626a26030) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP ( 1984, primoa32, 0, 0, primoa32, primo, primo_state, primo32, "Microkey", "Primo A-32" , 0) +COMP ( 1984, primoa48, primoa32, 0, primoa48, primo, primo_state, primo48, "Microkey", "Primo A-48" , 0) +COMP ( 1984, primoa64, primoa32, 0, primoa64, primo, primo_state, primo64, "Microkey", "Primo A-64" , 0) +COMP ( 1984, primob32, primoa32, 0, primob32, primo, primo_state, primo32, "Microkey", "Primo B-32" , 0) +COMP ( 1984, primob48, primoa32, 0, primob48, primo, primo_state, primo48, "Microkey", "Primo B-48" , 0) +COMP ( 1984, primob64, primoa32, 0, primob64, primo, primo_state, primo64, "Microkey", "Primo B-64" , 0) +COMP ( 1984, primoc64, primoa32, 0, primoc64, primo, primo_state, primo64, "Microkey", "Primo C-64" , MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/pro80.c b/src/mame/drivers/pro80.c new file mode 100644 index 00000000000..051a6da3a34 --- /dev/null +++ b/src/mame/drivers/pro80.c @@ -0,0 +1,171 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco, Robbbert +/*************************************************************************** + + Protec Pro-80 + + 06/12/2009 Skeleton driver. + + TODO: + - Cassette load/save + - Use messram for optional ram + - Fix Step command (don't works due of missing interrupt emulation) + +The unit has a PIO, ports 40-43, but it was for expansion only. + +The cassette used 2 bits for input, plus a D flipflop and a 74LS221 oneshot. + + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "pro80.lh" + +class pro80_state : public driver_device +{ +public: + pro80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cass(*this, "cassette") + { } + + required_device m_maincpu; + required_device m_cass; + void machine_reset(); + + DECLARE_WRITE8_MEMBER( digit_w ); + DECLARE_WRITE8_MEMBER( segment_w ); + DECLARE_READ8_MEMBER( kp_r ); + + UINT8 m_digit_sel; +}; + + +WRITE8_MEMBER( pro80_state::digit_w ) +{ + // --xx xxxx digit select + // -x-- ---- cassette out + // x--- ---- ??? + m_digit_sel = data & 0x3f; +} + +WRITE8_MEMBER( pro80_state::segment_w ) +{ + if (m_digit_sel) + { + if (!BIT(m_digit_sel, 0)) output_set_digit_value(0, data); + if (!BIT(m_digit_sel, 1)) output_set_digit_value(1, data); + if (!BIT(m_digit_sel, 2)) output_set_digit_value(2, data); + if (!BIT(m_digit_sel, 3)) output_set_digit_value(3, data); + if (!BIT(m_digit_sel, 4)) output_set_digit_value(4, data); + if (!BIT(m_digit_sel, 5)) output_set_digit_value(5, data); + m_cass->output( BIT(data, 6) ? -1.0 : +1.0); + + m_digit_sel = 0; + } +} + +READ8_MEMBER( pro80_state::kp_r ) +{ + UINT8 data = 0x0f; + + if (!BIT(m_digit_sel, 0)) data &= ioport("LINE0")->read(); + if (!BIT(m_digit_sel, 1)) data &= ioport("LINE1")->read(); + if (!BIT(m_digit_sel, 2)) data &= ioport("LINE2")->read(); + if (!BIT(m_digit_sel, 3)) data &= ioport("LINE3")->read(); + if (!BIT(m_digit_sel, 4)) data &= ioport("LINE4")->read(); + if (!BIT(m_digit_sel, 5)) data &= ioport("LINE5")->read(); + + // cassette-in bits go here - bit 4 = sync bit, bit 5 = data bit + return data; +} + +static ADDRESS_MAP_START( pro80_mem, AS_PROGRAM, 8, pro80_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x03ff) AM_ROM + AM_RANGE(0x1000, 0x13ff) AM_RAM + AM_RANGE(0x1400, 0x17ff) AM_RAM // 2nd RAM is optional +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pro80_io, AS_IO, 8, pro80_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + //AM_RANGE(0x40, 0x43) Z80PIO + AM_RANGE(0x44, 0x47) AM_READ(kp_r) + AM_RANGE(0x48, 0x4b) AM_WRITE(digit_w) + AM_RANGE(0x4c, 0x4f) AM_WRITE(segment_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pro80 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CR") PORT_CODE(KEYCODE_L) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CW") PORT_CODE(KEYCODE_W) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("SSt") PORT_CODE(KEYCODE_S) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Res") PORT_CODE(KEYCODE_EQUALS) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("NEx") PORT_CODE(KEYCODE_N) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("REx") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("MEx") PORT_CODE(KEYCODE_M) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("7 [IY]") PORT_CODE(KEYCODE_7) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("6 [IX]") PORT_CODE(KEYCODE_6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("5 [PC]") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("9 [H]") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("4 [SP]") PORT_CODE(KEYCODE_4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("8 [L]") PORT_CODE(KEYCODE_8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_C) +INPUT_PORTS_END + +void pro80_state::machine_reset() +{ + m_digit_sel = 0; +} + +static MACHINE_CONFIG_START( pro80, pro80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(pro80_mem) + MCFG_CPU_IO_MAP(pro80_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_pro80) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pro80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // This rom dump is taken out of manual for this machine + ROM_LOAD( "pro80.bin", 0x0000, 0x0400, CRC(1bf6e0a5) SHA1(eb45816337e08ed8c30b589fc24960dc98b94db2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, pro80, 0, 0, pro80, pro80, driver_device, 0, "Protec", "Pro-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/prof180x.c b/src/mame/drivers/prof180x.c new file mode 100644 index 00000000000..7668ef88445 --- /dev/null +++ b/src/mame/drivers/prof180x.c @@ -0,0 +1,329 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + PROF-180X + + 07/07/2009 Skeleton driver. + +****************************************************************************/ + +/* + + TODO: + + - HD64180 CPU (DMA, MMU, SIO, etc) (Z80180 like) + - memory banking + - keyboard + - floppy + - floppy motor off timer + - floppy index callback + - RTC + +*/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "bus/centronics/ctronics.h" +#include "machine/upd765.h" +#include "includes/prof180x.h" + +UINT32 prof180x_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +READ8_MEMBER( prof180x_state::read ) +{ + UINT8 data = 0; + + if (offset < 0x40000) + { + } + else + { + } +/* + switch ((m_mm1 << 1) | m_mm0) + { + case 0: + // bank0_r = EPROM, bank0_w = RAM, bank1 = RAM + break; + + case 1: + // bank0_r = RAM, bank0_w = RAM, bank1 = RAM + break; + + case 2: + // bank0_r = UNMAP, bank0_w = UNMAP, bank1 = RAM + break; + + case 3: + // bank0_r = RAM, bank0_w = RAM, bank1 = UNMAP + break; + } +*/ + return data; +} + +WRITE8_MEMBER( prof180x_state::write ) +{ + if (offset < 0x40000) + { + } + else + { + } +} + +void prof180x_state::ls259_w(int flag, int value) +{ + switch (flag) + { + case 0: // C0 + m_c0 = value; + break; + + case 1: // C1 + m_c1 = value; + break; + + case 2: // C2 + m_c2 = value; + break; + + case 3: // MINI + break; + + case 4: // MM0 + m_mm0 = value; + break; + + case 5: // RTC + break; + + case 6: // PEPS + break; + + case 7: // MM1 + m_mm1 = value; + break; + } +} + +WRITE8_MEMBER( prof180x_state::flr_w ) +{ + /* + + bit description + + 0 VAL + 1 FLG0 + 2 FLG1 + 3 FLG2 + 4 + 5 + 6 + 7 + + */ + + int val = BIT(data, 0); + int flg = (data >> 1) & 0x07; + + ls259_w(flg, val); +} + +READ8_MEMBER( prof180x_state::status0_r ) +{ + /* + + bit description + + 0 BUSY + 1 + 2 + 3 + 4 B-E + 5 IDX + 6 + 7 MOT + + */ + + return 0; +} + +READ8_MEMBER( prof180x_state::status1_r ) +{ + /* + + bit description + + 0 FREE + 1 + 2 + 3 + 4 J18 + 5 J19 + 6 + 7 TDO + + */ + + return 0; +} + +READ8_MEMBER( prof180x_state::status_r ) +{ + return BIT(offset, 8) ? status1_r(space, offset) : status0_r(space, offset); +} + +/* Address Maps */ + +static ADDRESS_MAP_START( prof180x_mem, AS_PROGRAM, 8, prof180x_state ) + AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( prof180x_io , AS_IO, 8, prof180x_state ) + AM_RANGE(0x08, 0x08) AM_MIRROR(0xff00) AM_WRITE(flr_w) + AM_RANGE(0x09, 0x09) AM_MASK(0xff00) AM_READ(status_r) + AM_RANGE(0x0a, 0x0a) AM_MIRROR(0xff00) AM_DEVREADWRITE(FDC9268_TAG, upd765a_device, mdma_r, mdma_w) + AM_RANGE(0x0b, 0x0b) AM_MIRROR(0xff00) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x0c, 0x0d) AM_MIRROR(0xff00) AM_DEVICE(FDC9268_TAG, upd765a_device, map) +ADDRESS_MAP_END + +/* Input ports */ + +static INPUT_PORTS_START( prof180x ) +INPUT_PORTS_END + +/* Video */ + +static SLOT_INTERFACE_START( prof180x_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +/* +static RTC8583_INTERFACE( rtc_intf ) +{ + DEVCB_CPU_INPUT_LINE(HD64180_TAG, INPUT_LINE_INT2) +}; +*/ + +void prof180x_state::machine_start() +{ + // register for state saving + save_item(NAME(m_c0)); + save_item(NAME(m_c1)); + save_item(NAME(m_c2)); + save_item(NAME(m_mm0)); + save_item(NAME(m_mm1)); +} + +void prof180x_state::machine_reset() +{ + for (int i = 0; i < 8; i++) + { + ls259_w(i, 0); + } +} + +static MACHINE_CONFIG_START( prof180x, prof180x_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(HD64180_TAG, Z80, XTAL_9_216MHz) + MCFG_CPU_PROGRAM_MAP(prof180x_mem) + MCFG_CPU_IO_MAP(prof180x_io) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(prof180x_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + + /* devices */ + MCFG_UPD765A_ADD(FDC9268_TAG, false, true) + MCFG_FLOPPY_DRIVE_ADD(FDC9268_TAG ":0", prof180x_floppies, "35dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC9268_TAG ":1", prof180x_floppies, "35dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC9268_TAG ":2", prof180x_floppies, "35dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC9268_TAG ":3", prof180x_floppies, "35dd", floppy_image_device::default_floppy_formats) + + //MCFG_RTC8583_ADD(MK3835_TAG, rtc_intf) + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("256K,512K") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("flop_list", "prof180") +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( prof180x ) + ROM_REGION( 0x10000, HD64180_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "pmon13", "pmon v1.3" ) + ROMX_LOAD( "pmon1_3.z16", 0x00000, 0x04000, CRC(32986688) SHA1(a6229d7e66ef699722ca3d41179fe3f1b75185d4), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "pmon14", "pmon v1.4" ) + ROMX_LOAD( "pmon1_4.z16", 0x00000, 0x04000, CRC(ed03f49f) SHA1(e016f9e0b89ab64c6203e2e46501d0b09f74ee9b), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "pmon15", "pmon v1.5" ) + ROMX_LOAD( "pmon1_5.z16", 0x00000, 0x04000, CRC(f43d185c) SHA1(a7a219b3d48c74602b3116cfcd34e44d6e7bc423), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "pmon", "pmon" ) + ROMX_LOAD( "pmon.z16", 0x00000, 0x04000, CRC(4f3732d7) SHA1(7dc27262db4e0c8f109470253b9364a216909f2c), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "eboot1", "eboot1" ) + ROMX_LOAD( "eboot1.z16", 0x00000, 0x08000, CRC(7a164b3c) SHA1(69367804b5cbc0633e3d7bbbcc256c2c8c9e7aca), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "eboot2", "eboot2" ) + ROMX_LOAD( "eboot2.z16", 0x00000, 0x08000, CRC(0c2d4301) SHA1(f1a4f457e287b19e14d8ccdbc0383f183d8a3efe), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 6, "epmon1", "epmon1" ) + ROMX_LOAD( "epmon1.z16", 0x00000, 0x10000, CRC(27aabfb4) SHA1(41adf038c474596dbf7d387a1a7f33ed86aa7869), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS( 7, "epmon2", "epmon2" ) + ROMX_LOAD( "epmon2.z16", 0x00000, 0x10000, CRC(3b8a7b59) SHA1(33741f0725e3eaa21c6881c712579b3c1fd30607), ROM_BIOS(8) ) + ROM_SYSTEM_BIOS( 8, "epmon3", "epmon3" ) + ROMX_LOAD( "epmon3.z16", 0x00000, 0x10000, CRC(51313af1) SHA1(60c293171a1c7cb9a5ff6d681e61894f44fddbd1), ROM_BIOS(9) ) + + ROM_REGION( 0x157, "plds", 0 ) + ROM_LOAD( "pal14l8.z10", 0x000, 0x157, NO_DUMP ) +ROM_END + +ROM_START( prof181x ) + ROM_REGION( 0x10000, HD64180_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "pmon13", "pmon v1.3" ) + ROMX_LOAD( "pmon1_3.u13", 0x00000, 0x04000, CRC(32986688) SHA1(a6229d7e66ef699722ca3d41179fe3f1b75185d4), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "pmon14", "pmon v1.4" ) + ROMX_LOAD( "pmon1_4.u13", 0x00000, 0x04000, CRC(ed03f49f) SHA1(e016f9e0b89ab64c6203e2e46501d0b09f74ee9b), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "pmon15", "pmon v1.5" ) + ROMX_LOAD( "pmon1_5.u13", 0x00000, 0x04000, CRC(f43d185c) SHA1(a7a219b3d48c74602b3116cfcd34e44d6e7bc423), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "pmon", "pmon" ) + ROMX_LOAD( "pmon.u13", 0x00000, 0x04000, CRC(4f3732d7) SHA1(7dc27262db4e0c8f109470253b9364a216909f2c), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "eboot1", "eboot1" ) + ROMX_LOAD( "eboot1.u13", 0x00000, 0x08000, CRC(7a164b3c) SHA1(69367804b5cbc0633e3d7bbbcc256c2c8c9e7aca), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "eboot2", "eboot2" ) + ROMX_LOAD( "eboot2.u13", 0x00000, 0x08000, CRC(0c2d4301) SHA1(f1a4f457e287b19e14d8ccdbc0383f183d8a3efe), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 6, "epmon1", "epmon1" ) + ROMX_LOAD( "epmon1.u13", 0x00000, 0x10000, CRC(27aabfb4) SHA1(41adf038c474596dbf7d387a1a7f33ed86aa7869), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS( 7, "epmon2", "epmon2" ) + ROMX_LOAD( "epmon2.u13", 0x00000, 0x10000, CRC(3b8a7b59) SHA1(33741f0725e3eaa21c6881c712579b3c1fd30607), ROM_BIOS(8) ) + ROM_SYSTEM_BIOS( 8, "epmon3", "epmon3" ) + ROMX_LOAD( "epmon3.u13", 0x00000, 0x10000, CRC(51313af1) SHA1(60c293171a1c7cb9a5ff6d681e61894f44fddbd1), ROM_BIOS(9) ) + + ROM_REGION( 0x157, "plds", 0 ) // converted from JED files + ROM_LOAD( "pal20v8.u14", 0x000, 0x157, CRC(46da52b0) SHA1(c11362223c0d5c57c6ef970e66d674b89d8e7784) ) + ROM_LOAD( "pal20v8.u15", 0x000, 0x157, CRC(19fef936) SHA1(579ad23ee3c0b1c64c584383f9c8085c6ce3d094) ) + ROM_LOAD( "pal20v8.u19", 0x000, 0x157, CRC(69348c3b) SHA1(6eb8432660eb9b639a95b1973a54dab8b99f10ef) ) + ROM_LOAD( "pal20v8.u21", 0x000, 0x157, CRC(6df4e281) SHA1(602fa4637cd9356acc31b2adfb3a084fd5a0bfcb) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, prof180x, 0, 0, prof180x, prof180x, driver_device, 0, "Conitec Datensysteme", "PROF-180X", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1992, prof181x, prof180x,0, prof180x, prof180x, driver_device, 0, "Conitec Datensysteme", "PROF-181X", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/prof80.c b/src/mame/drivers/prof80.c new file mode 100644 index 00000000000..c8e21f4d8fc --- /dev/null +++ b/src/mame/drivers/prof80.c @@ -0,0 +1,566 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + PROF-80 (Prozessor RAM-Floppy Kontroller) + GRIP-1/2/3/4/5 (Grafik-Interface-Prozessor) + UNIO-1 (?) + + http://www.prof80.de/ + http://oldcomputers.dyndns.org/public/pub/rechner/conitec/info.html + +*/ + +/* + + TODO: + + - floppy Err on A: Select + - NE555 timeout is 10x too high + - grip31 does not work + - UNIO card (Z80-STI, Z80-SIO, 2x centronics) + - GRIP-COLOR (192kB color RAM) + - GRIP-5 (HD6345, 256KB RAM) + - XR color card + +*/ + +#include "includes/prof80.h" + + + +//************************************************************************** +// PERIPHERALS +//************************************************************************** + +//------------------------------------------------- +// motor - +//------------------------------------------------- + +void prof80_state::motor(int mon) +{ + if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(mon); + if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(mon); + + m_motor = mon; +} + + +//------------------------------------------------- +// ls259_w - +//------------------------------------------------- + +void prof80_state::ls259_w(int fa, int sa, int fb, int sb) +{ + switch (sa) + { + case 0: // C0/TDI + m_rtc->data_in_w(fa); + m_rtc->c0_w(fa); + m_c0 = fa; + break; + + case 1: // C1 + m_rtc->c1_w(fa); + m_c1 = fa; + break; + + case 2: // C2 + m_rtc->c2_w(fa); + m_c2 = fa; + break; + + case 3: // READY + if (m_ready != fa) + { + m_fdc->set_ready_line_connected(!fa); + m_fdc->ready_w(!fa); + m_ready = fa; + } + break; + + case 4: // TCK + m_rtc->clk_w(fa); + break; + + case 5: // IN USE + //m_floppy->inuse_w(fa); + break; + + case 6: // _MOTOR + if (fa) + { + // trigger floppy motor off NE555 timer + int t = 110 * RES_M(10) * CAP_U(6.8); // t = 1.1 * R8 * C6 + + timer_set(attotime::from_msec(t), TIMER_ID_MOTOR); + } + else + { + // turn on floppy motor + motor(0); + + // reset floppy motor off NE555 timer + timer_set(attotime::never, TIMER_ID_MOTOR); + } + break; + + case 7: // SELECT + if (m_select != fa) + { + //m_fdc->set_select_lines_connected(fa); + m_select = fa; + } + break; + } + + switch (sb) + { + case 0: // RESF + if (fb) m_fdc->soft_reset(); + break; + + case 1: // MINI + break; + + case 2: // _RTS + m_rs232a->write_rts(fb); + break; + + case 3: // TX + m_rs232a->write_txd(fb); + break; + + case 4: // _MSTOP + if (!fb) + { + // turn off floppy motor + motor(1); + + // reset floppy motor off NE555 timer + timer_set(attotime::never, TIMER_ID_MOTOR); + } + break; + + case 5: // TXP + m_rs232b->write_txd(fb); + break; + + case 6: // TSTB + m_rtc->stb_w(fb); + break; + + case 7: // MME + m_mmu->mme_w(fb); + break; + } +} + + +//------------------------------------------------- +// flr_w - +//------------------------------------------------- + +WRITE8_MEMBER( prof80_state::flr_w ) +{ + /* + + bit description + + 0 FB + 1 SB0 + 2 SB1 + 3 SB2 + 4 SA0 + 5 SA1 + 6 SA2 + 7 FA + + */ + + int fa = BIT(data, 7); + int sa = (data >> 4) & 0x07; + + int fb = BIT(data, 0); + int sb = (data >> 1) & 0x07; + + ls259_w(fa, sa, fb, sb); +} + + +//------------------------------------------------- +// status_r - +//------------------------------------------------- + +READ8_MEMBER( prof80_state::status_r ) +{ + /* + + bit signal description + + 0 _RX + 1 + 2 + 3 + 4 CTS + 5 _INDEX + 6 + 7 CTSP + + */ + + UINT8 data = 0; + + // serial receive + data |= !m_rs232a->rxd_r(); + + // clear to send + data |= m_rs232a->cts_r() << 4; + data |= m_rs232b->cts_r() << 7; + + // floppy index + data |= (m_floppy0->get_device() ? m_floppy0->get_device()->idx_r() : m_floppy1->get_device() ? m_floppy1->get_device()->idx_r() : 1) << 5; + + return data; +} + + +//------------------------------------------------- +// status2_r - +//------------------------------------------------- + +READ8_MEMBER( prof80_state::status2_r ) +{ + /* + + bit signal description + + 0 _MOTOR floppy motor (0=on, 1=off) + 1 + 2 + 3 + 4 JS4 + 5 JS5 + 6 + 7 _TDO + + */ + + UINT8 data = 0; + int js4 = 0, js5 = 0; + + // floppy motor + data |= m_motor; + + // JS4 + switch (m_j4->read()) + { + case 0: js4 = 0; break; + case 1: js4 = 1; break; + case 2: js4 = !m_c0; break; + case 3: js4 = !m_c1; break; + case 4: js4 = !m_c2; break; + } + + data |= js4 << 4; + + // JS5 + switch (m_j5->read()) + { + case 0: js5 = 0; break; + case 1: js5 = 1; break; + case 2: js5 = !m_c0; break; + case 3: js5 = !m_c1; break; + case 4: js5 = !m_c2; break; + } + + data |= js5 << 4; + + // RTC data + data |= !m_rtc->data_out_r() << 7; + + return data; +} + +// UNIO +/* +WRITE8_MEMBER( prof80_state::unio_ctrl_w ) +{ +// int flag = BIT(data, 0); + int flad = (data >> 1) & 0x07; + + switch (flad) + { + case 0: // CG1 + case 1: // CG2 + case 2: // _STB1 + case 3: // _STB2 + case 4: // _INIT + case 5: // JSO0 + case 6: // JSO1 + case 7: // JSO2 + break; + } +} +*/ + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( prof80_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( prof80_mem, AS_PROGRAM, 8, prof80_state ) + AM_RANGE(0x0000, 0xffff) AM_DEVICE(MMU_TAG, prof80_mmu_device, z80_program_map) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( prof80_mmu ) +//------------------------------------------------- + +static ADDRESS_MAP_START( prof80_mmu, AS_PROGRAM, 8, prof80_state ) + AM_RANGE(0x40000, 0x5ffff) AM_RAM + AM_RANGE(0xc0000, 0xdffff) AM_RAM + AM_RANGE(0xf0000, 0xf1fff) AM_MIRROR(0xe000) AM_ROM AM_REGION(Z80_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( prof80_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( prof80_io, AS_IO, 8, prof80_state ) + AM_RANGE(0x00, 0xd7) AM_MIRROR(0xff00) AM_DEVREADWRITE(ECBBUS_TAG, ecbbus_device, io_r, io_w) +// AM_RANGE(0x80, 0x8f) AM_MIRROR(0xff00) AM_DEVREADWRITE(UNIO_Z80STI_TAG, z80sti_device, read, write) +// AM_RANGE(0x94, 0x95) AM_MIRROR(0xff00) AM_DEVREADWRITE_LEGACY(UNIO_Z80SIO_TAG, z80sio_d_r, z80sio_d_w) +// AM_RANGE(0x96, 0x97) AM_MIRROR(0xff00) AM_DEVREADWRITE_LEGACY(UNIO_Z80SIO_TAG, z80sio_c_r, z80sio_c_w) +// AM_RANGE(0x9e, 0x9e) AM_MIRROR(0xff00) AM_WRITE(unio_ctrl_w) +// AM_RANGE(0x9c, 0x9c) AM_MIRROR(0xff00) AM_DEVWRITE(UNIO_CENTRONICS1_TAG, centronics_device, write) +// AM_RANGE(0x9d, 0x9d) AM_MIRROR(0xff00) AM_DEVWRITE(UNIO_CENTRONICS1_TAG, centronics_device, write) +// AM_RANGE(0xc0, 0xc0) AM_MIRROR(0xff00) AM_READ(gripc_r) +// AM_RANGE(0xc1, 0xc1) AM_MIRROR(0xff00) AM_READWRITE(gripd_r, gripd_w) + AM_RANGE(0xd8, 0xd8) AM_MIRROR(0xff00) AM_WRITE(flr_w) + AM_RANGE(0xda, 0xda) AM_MIRROR(0xff00) AM_READ(status_r) + AM_RANGE(0xdb, 0xdb) AM_MIRROR(0xff00) AM_READ(status2_r) + AM_RANGE(0xdc, 0xdd) AM_MIRROR(0xff00) AM_DEVICE(UPD765_TAG, upd765a_device, map) + AM_RANGE(0xde, 0xde) AM_MIRROR(0xff01) AM_MASK(0xff00) AM_DEVWRITE(MMU_TAG, prof80_mmu_device, par_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( prof80 ) +//------------------------------------------------- + +static INPUT_PORTS_START( prof80 ) + PORT_START("J1") + PORT_CONFNAME( 0x01, 0x00, "J1 RDY/HDLD") + PORT_CONFSETTING( 0x00, "HDLD" ) + PORT_CONFSETTING( 0x01, "READY" ) + + PORT_START("J2") + PORT_CONFNAME( 0x01, 0x01, "J2 RDY/DCHG") + PORT_CONFSETTING( 0x00, "DCHG" ) + PORT_CONFSETTING( 0x01, "READY" ) + + PORT_START("J3") + PORT_CONFNAME( 0x01, 0x00, "J3 Port Address") + PORT_CONFSETTING( 0x00, "D8-DF" ) + PORT_CONFSETTING( 0x01, "E8-EF" ) + + PORT_START("J4") + PORT_CONFNAME( 0x07, 0x00, "J4 Console") + PORT_CONFSETTING( 0x00, "GRIP-1" ) + PORT_CONFSETTING( 0x01, "V24 DUPLEX" ) + PORT_CONFSETTING( 0x02, "USER1" ) + PORT_CONFSETTING( 0x03, "USER2" ) + PORT_CONFSETTING( 0x04, "CP/M" ) + + PORT_START("J5") + PORT_CONFNAME( 0x07, 0x00, "J5 Baud") + PORT_CONFSETTING( 0x00, "9600" ) + PORT_CONFSETTING( 0x01, "4800" ) + PORT_CONFSETTING( 0x02, "2400" ) + PORT_CONFSETTING( 0x03, "1200" ) + PORT_CONFSETTING( 0x04, "300" ) + + PORT_START("J6") + PORT_CONFNAME( 0x01, 0x01, "J6 Interrupt") + PORT_CONFSETTING( 0x00, "Serial" ) + PORT_CONFSETTING( 0x01, "ECB" ) + + PORT_START("J7") + PORT_CONFNAME( 0x01, 0x01, "J7 DMA MMU") + PORT_CONFSETTING( 0x00, "PROF" ) + PORT_CONFSETTING( 0x01, "DMA Card" ) + + PORT_START("J8") + PORT_CONFNAME( 0x01, 0x01, "J8 Active Mode") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + + PORT_START("J9") + PORT_CONFNAME( 0x01, 0x00, "J9 EPROM Type") + PORT_CONFSETTING( 0x00, "2732/2764" ) + PORT_CONFSETTING( 0x01, "27128" ) + + PORT_START("J10") + PORT_CONFNAME( 0x03, 0x00, "J10 Wait States") + PORT_CONFSETTING( 0x00, "On all memory accesses" ) + PORT_CONFSETTING( 0x01, "On internal memory accesses" ) + PORT_CONFSETTING( 0x02, DEF_STR( None ) ) + + PORT_START("L1") + PORT_CONFNAME( 0x01, 0x00, "L1 Write Polarity") + PORT_CONFSETTING( 0x00, "Inverted" ) + PORT_CONFSETTING( 0x01, "Normal" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// upd765_interface fdc_intf +//------------------------------------------------- + +static SLOT_INTERFACE_START( prof80_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void prof80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_ID_MOTOR: + motor(1); + break; + } +} + + +//------------------------------------------------- +// MACHINE_START( prof80 ) +//------------------------------------------------- + +void prof80_state::machine_start() +{ + // initialize RTC + m_rtc->cs_w(1); + m_rtc->oe_w(1); + + // register for state saving + save_item(NAME(m_c0)); + save_item(NAME(m_c1)); + save_item(NAME(m_c2)); + save_item(NAME(m_motor)); + save_item(NAME(m_ready)); + save_item(NAME(m_select)); +} + + +void prof80_state::machine_reset() +{ + int i; + + for (i = 0; i < 8; i++) + { + ls259_w(0, i, 0, i); + } +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( prof80 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( prof80, prof80_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_6MHz) + MCFG_CPU_PROGRAM_MAP(prof80_mem) + MCFG_CPU_IO_MAP(prof80_io) + + // devices + MCFG_PROF80_MMU_ADD(MMU_TAG, prof80_mmu) + MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) + MCFG_UPD765A_ADD(UPD765_TAG, true, true) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", prof80_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", prof80_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", prof80_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":3", prof80_floppies, NULL, floppy_image_device::default_floppy_formats) + + // ECB bus + MCFG_ECBBUS_ADD() + MCFG_ECBBUS_SLOT_ADD(1, "ecb_1", ecbbus_cards, "grip21") + MCFG_ECBBUS_SLOT_ADD(2, "ecb_2", ecbbus_cards, NULL) + MCFG_ECBBUS_SLOT_ADD(3, "ecb_3", ecbbus_cards, NULL) + MCFG_ECBBUS_SLOT_ADD(4, "ecb_4", ecbbus_cards, NULL) + MCFG_ECBBUS_SLOT_ADD(5, "ecb_5", ecbbus_cards, NULL) + + // V24 + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "prof80") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( prof80 ) +//------------------------------------------------- + +ROM_START( prof80 ) + ROM_REGION( 0x2000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "v17" ) + ROM_SYSTEM_BIOS( 0, "v15", "v1.5" ) + ROMX_LOAD( "prof80v15.z7", 0x0000, 0x2000, CRC(8f74134c) SHA1(83f9dcdbbe1a2f50006b41d406364f4d580daa1f), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v16", "v1.6" ) + ROMX_LOAD( "prof80v16.z7", 0x0000, 0x2000, CRC(7d3927b3) SHA1(bcc15fd04dbf1d6640115be595255c7b9d2a7281), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v17", "v1.7" ) + ROMX_LOAD( "prof80v17.z7", 0x0000, 0x2000, CRC(53305ff4) SHA1(3ea209093ac5ac8a5db618a47d75b705965cdf44), ROM_BIOS(3) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1984, prof80, 0, 0, prof80, prof80, driver_device, 0, "Conitec Datensysteme", "PROF-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/psion.c b/src/mame/drivers/psion.c new file mode 100644 index 00000000000..741df4c3585 --- /dev/null +++ b/src/mame/drivers/psion.c @@ -0,0 +1,796 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Psion Organiser II series + + Driver by Sandro Ronco + + TODO: + - dump CGROM of the HD44780 + - emulate other devices in slot C(Comms Link, printer) + + Note: + - 4 lines display has an custom LCD controller derived from an HD66780 + - NVRAM works only if the machine is turned off (with OFF menu) before closing MESS + + More info: + http://archive.psion2.org/org2/techref/index.htm + +****************************************************************************/ + + +#include "emu.h" +#include "includes/psion.h" +#include "rendlay.h" + +TIMER_DEVICE_CALLBACK_MEMBER(psion_state::nmi_timer) +{ + if (m_enable_nmi) + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + +UINT8 psion_state::kb_read() +{ + static const char *const bitnames[] = {"K1", "K2", "K3", "K4", "K5", "K6", "K7"}; + UINT8 line, data = 0x7c; + + if (m_kb_counter) + { + for (line = 0; line < 7; line++) + if (m_kb_counter == (0x7f & ~(1 << line))) + data = machine().root_device().ioport(bitnames[line])->read(); + } + else + { + //Read all the input lines + for (line = 0; line < 7; line++) + data &= machine().root_device().ioport(bitnames[line])->read(); + } + + return data & 0x7c; +} + +void psion_state::update_banks() +{ + if (m_ram_bank < m_ram_bank_count && m_ram_bank_count) + membank("rambank")->set_entry(m_ram_bank); + + if (m_rom_bank < m_rom_bank_count && m_rom_bank_count) + membank("rombank")->set_entry(m_rom_bank); +} + +WRITE8_MEMBER( psion_state::hd63701_int_reg_w ) +{ + switch (offset) + { + case 0x01: + m_port2_ddr = data; + break; + case 0x03: + /* datapack i/o data bus */ + m_pack1->data_w(data & m_port2_ddr); + m_pack2->data_w(data & m_port2_ddr); + break; + case 0x08: + m_tcsr_value = data; + break; + case 0x15: + /* read-only */ + break; + case 0x16: + m_port6_ddr = data; + break; + case 0x17: + /* + datapack control lines + x--- ---- slot on/off + -x-- ---- slot 3 + --x- ---- slot 2 + ---x ---- slot 1 + ---- x--- output enable + ---- -x-- program line + ---- --x- reset line + ---- ---x clock line + */ + m_port6 = (data & m_port6_ddr) | (m_port6 & ~m_port6_ddr); + + m_pack1->control_w((m_port6 & 0x8f) | (m_port6 & 0x10)); + m_pack2->control_w((m_port6 & 0x8f) | ((m_port6 & 0x20) >> 1)); + break; + } + + m_maincpu->m6801_io_w(space, offset, data); +} + +READ8_MEMBER( psion_state::hd63701_int_reg_r ) +{ + switch (offset) + { + case 0x03: + /* datapack i/o data bus */ + return (m_pack1->data_r() | m_pack2->data_r()) & (~m_port2_ddr); + case 0x14: + return (m_maincpu->m6801_io_r(space, offset)&0x7f) | (m_stby_pwr<<7); + case 0x15: + /* + x--- ---- ON key active high + -xxx xx-- keys matrix active low + ---- --x- pulse + ---- ---x battery status + */ + return kb_read() | ioport("BATTERY")->read() | ioport("ON")->read() | (m_kb_counter == 0x7ff)<<1 | m_pulse<<1; + case 0x17: + /* datapack control lines */ + return (m_pack1->control_r() | (m_pack2->control_r() & 0x8f)) | ((m_pack2->control_r() & 0x10)<<1); + case 0x08: + m_maincpu->m6801_io_w(space, offset, m_tcsr_value); + default: + return m_maincpu->m6801_io_r(space, offset); + } +} + +/* Read/Write common */ +void psion_state::io_rw(address_space &space, UINT16 offset) +{ + if (space.debugger_access()) + return; + + switch (offset & 0xffc0) + { + case 0xc0: + /* switch off, CPU goes into standby mode */ + m_enable_nmi = 0; + m_stby_pwr = 1; + m_maincpu->suspend(SUSPEND_REASON_HALT, 1); + break; + case 0x100: + m_pulse = 1; + break; + case 0x140: + m_pulse = 0; + break; + case 0x200: + m_kb_counter = 0; + break; + case 0x180: + m_beep->set_state(1); + break; + case 0x1c0: + m_beep->set_state(0); + break; + case 0x240: + if (offset == 0x260 && (m_rom_bank_count || m_ram_bank_count)) + { + m_ram_bank=0; + m_rom_bank=0; + update_banks(); + } + else + m_kb_counter++; + break; + case 0x280: + if (offset == 0x2a0 && m_ram_bank_count) + { + m_ram_bank++; + update_banks(); + } + else + m_enable_nmi = 1; + break; + case 0x2c0: + if (offset == 0x2e0 && m_rom_bank_count) + { + m_rom_bank++; + update_banks(); + } + else + m_enable_nmi = 0; + break; + } +} + +WRITE8_MEMBER( psion_state::io_w ) +{ + switch (offset & 0x0ffc0) + { + case 0x80: + m_lcdc->write(space, offset & 0x01, data); + break; + default: + io_rw(space, offset); + } +} + +READ8_MEMBER( psion_state::io_r ) +{ + switch (offset & 0xffc0) + { + case 0x80: + return m_lcdc->read(space, offset & 0x01); + default: + io_rw(space, offset); + } + + return 0; +} + +INPUT_CHANGED_MEMBER(psion_state::psion_on) +{ + /* reset the CPU for resume from standby */ + if (m_maincpu->suspended(SUSPEND_REASON_HALT)) + m_maincpu->reset(); +} + +READ8_MEMBER( psion1_state::reset_kb_counter_r ) +{ + m_kb_counter = 0; + return 0; +} + +READ8_MEMBER( psion1_state::inc_kb_counter_r ) +{ + m_kb_counter++; + return 0; +} + +READ8_MEMBER( psion1_state::switchoff_r ) +{ + if (!m_stby_pwr) + { + m_stby_pwr = 1; + m_maincpu->reset(); + } + return 0; +} + +static ADDRESS_MAP_START(psion1_mem, AS_PROGRAM, 8, psion1_state) + AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) + AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") + AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x07fe) AM_DEVREADWRITE("hd44780", hd44780_device, control_read, control_write) + AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x07fe) AM_DEVREADWRITE("hd44780", hd44780_device, data_read, data_write) + AM_RANGE(0x2800, 0x2800) AM_READ(reset_kb_counter_r) + AM_RANGE(0x2e00, 0x2e00) AM_READ(switchoff_r) + AM_RANGE(0x3000, 0x3000) AM_READ(inc_kb_counter_r) + AM_RANGE(0x4000, 0x47ff) AM_RAM AM_SHARE("ram") + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(psioncm_mem, AS_PROGRAM, 8, psion_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) + AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") + AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) + AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(psionla_mem, AS_PROGRAM, 8, psion_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) + AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") + AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) + AM_RANGE(0x0400, 0x5fff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(psionp350_mem, AS_PROGRAM, 8, psion_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) + AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") + AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) + AM_RANGE(0x0400, 0x3fff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("rambank") + AM_RANGE(0x8000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(psionlam_mem, AS_PROGRAM, 8, psion_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) + AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") + AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) + AM_RANGE(0x0400, 0x7fff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("rombank") + AM_RANGE(0xc000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(psionlz_mem, AS_PROGRAM, 8, psion_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) + AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") + AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) + AM_RANGE(0x0400, 0x3fff) AM_RAM AM_SHARE("ram") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("rambank") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("rombank") + AM_RANGE(0xc000, 0xffff) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( psion ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) + PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x01, "Low Battery" ) + + PORT_START("ON") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/CLEAR") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, psion_state, psion_on, 0) + + PORT_START("K1") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up [CAP]") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down [NUM]") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + + PORT_START("K2") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S [;]") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M [,]") PORT_CODE(KEYCODE_M) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G [=]") PORT_CODE(KEYCODE_G) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A [<]") PORT_CODE(KEYCODE_A) + + PORT_START("K3") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T [:]") PORT_CODE(KEYCODE_T) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N [$]") PORT_CODE(KEYCODE_N) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H [\"]") PORT_CODE(KEYCODE_H) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B [>]") PORT_CODE(KEYCODE_B) + + PORT_START("K4") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y [0]") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U [1]") PORT_CODE(KEYCODE_U) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O [4]") PORT_CODE(KEYCODE_O) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I [7]") PORT_CODE(KEYCODE_I) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C [(]") PORT_CODE(KEYCODE_C) + + PORT_START("K5") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W [3]") PORT_CODE(KEYCODE_W) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q [6]") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K [9]") PORT_CODE(KEYCODE_K) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E [%]") PORT_CODE(KEYCODE_E) + + PORT_START("K6") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X [+]") PORT_CODE(KEYCODE_X) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R [-]") PORT_CODE(KEYCODE_R) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L [*]") PORT_CODE(KEYCODE_L) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F [/]") PORT_CODE(KEYCODE_F) + + PORT_START("K7") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z [.]") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V [2]") PORT_CODE(KEYCODE_V) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P [5]") PORT_CODE(KEYCODE_P) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J [8]") PORT_CODE(KEYCODE_J) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D [)]") PORT_CODE(KEYCODE_D) +INPUT_PORTS_END + +INPUT_PORTS_START( psion1 ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) + PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x01, "Low Battery" ) + + PORT_START("ON") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/CLEAR") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, psion_state, psion_on, 0) + + PORT_START("K1") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down [NUM]") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up [CAP]") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_EQUALS) + + PORT_START("K2") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S [;]") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M [,]") PORT_CODE(KEYCODE_M) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G [=]") PORT_CODE(KEYCODE_G) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A [<]") PORT_CODE(KEYCODE_A) + + PORT_START("K3") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y [0]") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T [:]") PORT_CODE(KEYCODE_T) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N [$]") PORT_CODE(KEYCODE_N) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H [\"]") PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B [>]") PORT_CODE(KEYCODE_B) + + PORT_START("K4") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z [.]") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U [1]") PORT_CODE(KEYCODE_U) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O [4]") PORT_CODE(KEYCODE_O) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I [7]") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C [(]") PORT_CODE(KEYCODE_C) + + PORT_START("K5") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W [3]") PORT_CODE(KEYCODE_W) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q [6]") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K [9]") PORT_CODE(KEYCODE_K) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E [%]") PORT_CODE(KEYCODE_E) + + PORT_START("K6") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X [+]") PORT_CODE(KEYCODE_X) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R [-]") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L [*]") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F [/]") PORT_CODE(KEYCODE_F) + + PORT_START("K7") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V [2]") PORT_CODE(KEYCODE_V) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P [5]") PORT_CODE(KEYCODE_P) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J [8]") PORT_CODE(KEYCODE_J) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D [)]") PORT_CODE(KEYCODE_D) +INPUT_PORTS_END + + +void psion_state::nvram_init(nvram_device &nvram, void *data, size_t size) +{ + //cold start (by default is 1=warm start) + m_stby_pwr = 0; +} + + +void psion_state::machine_start() +{ + if (!strcmp(machine().system().name, "psionlam")) + { + m_rom_bank_count = 3; + m_ram_bank_count = 0; + } + else if (!strncmp(machine().system().name, "psionlz", 7)) + { + m_rom_bank_count = 3; + m_ram_bank_count = 3; + } + else if (!strcmp(machine().system().name, "psionp464")) + { + m_rom_bank_count = 3; + m_ram_bank_count = 9; + } + else if (!strncmp(machine().system().name, "psionp", 6)) + { + m_rom_bank_count = 0; + m_ram_bank_count = 5; + } + else + { + m_rom_bank_count = 0; + m_ram_bank_count = 0; + } + + if (m_rom_bank_count) + { + UINT8* rom_base = (UINT8 *)memregion("maincpu")->base(); + + membank("rombank")->configure_entry(0, rom_base + 0x8000); + membank("rombank")->configure_entries(1, m_rom_bank_count-1, rom_base + 0x10000, 0x4000); + membank("rombank")->set_entry(0); + } + + if (m_ram_bank_count) + { + m_paged_ram = auto_alloc_array(machine(), UINT8, m_ram_bank_count * 0x4000); + memset(m_paged_ram, 0, sizeof(UINT8) * (m_ram_bank_count * 0x4000)); + membank("rambank")->configure_entries(0, m_ram_bank_count, m_paged_ram, 0x4000); + membank("rambank")->set_entry(0); + } + + m_nvram1->set_base(m_sys_register, 0xc0); + m_nvram2->set_base(m_ram, m_ram.bytes()); + if (m_nvram3) + m_nvram3->set_base(m_paged_ram, m_ram_bank_count * 0x4000); + + save_item(NAME(m_kb_counter)); + save_item(NAME(m_enable_nmi)); + save_item(NAME(m_tcsr_value)); + save_item(NAME(m_stby_pwr)); + save_item(NAME(m_pulse)); + save_item(NAME(m_rom_bank)); + save_item(NAME(m_ram_bank)); + save_item(NAME(m_port2_ddr)); + save_item(NAME(m_port2)); + save_item(NAME(m_port6_ddr)); + save_item(NAME(m_port6)); + save_pointer(NAME(m_paged_ram), m_ram_bank_count * 0x4000); +} + +void psion_state::machine_reset() +{ + m_enable_nmi=0; + m_kb_counter=0; + m_ram_bank=0; + m_rom_bank=0; + m_pulse=0; + + if (m_rom_bank_count || m_ram_bank_count) + update_banks(); +} + +void psion1_state::machine_reset() +{ + psion_state::machine_reset(); + m_enable_nmi = 1; +} + +HD44780_PIXEL_UPDATE(psion_state::lz_pixel_update) +{ + if (pos < 40) + { + static const UINT8 psion_display_layout[] = + { + 0x00, 0x01, 0x02, 0x03, 0x28, 0x29, 0x2a, 0x2b, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, + 0x14, 0x15, 0x16, 0x17, 0x3c, 0x3d, 0x3e, 0x3f, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x40, 0x41, 0x42, 0x43, + 0x44, 0x45, 0x46, 0x47, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f + }; + + UINT8 char_pos = psion_display_layout[line*40 + pos]; + bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; + } +} + +HD44780_PIXEL_UPDATE(psion1_state::psion1_pixel_update) +{ + if (pos < 8 && line < 2) + bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; +} + +PALETTE_INIT_MEMBER(psion_state, psion) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static const gfx_layout psion_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( psion ) + GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, psion_charlayout, 0, 1 ) +GFXDECODE_END + +/* basic configuration for 2 lines display */ +static MACHINE_CONFIG_START( psion_2lines, psion_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD63701, 980000) // should be HD6303 at 0.98MHz + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_SIZE(6*16, 9*2) + MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(psion_state, psion) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", psion) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 16) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram1", psion_state, nvram_init) // sys_regs + MCFG_NVRAM_ADD_0FILL("nvram2") // RAM + + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", psion_state, nmi_timer, attotime::from_seconds(1)) + + /* Datapack */ + MCFG_PSION_DATAPACK_ADD("pack1") + MCFG_PSION_DATAPACK_ADD("pack2") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("pack_list", "psion2") +MACHINE_CONFIG_END + +/* basic configuration for 4 lines display */ +static MACHINE_CONFIG_DERIVED( psion_4lines, psion_2lines ) + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(6*20, 9*4) + MCFG_SCREEN_VISIBLE_AREA(0, 6*20-1, 0, 9*4-1) + + MCFG_DEVICE_MODIFY("hd44780") + MCFG_HD44780_LCD_SIZE(4, 20) + MCFG_HD44780_PIXEL_UPDATE_CB(psion_state::lz_pixel_update) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( psion1, psion_2lines, psion1_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(psion1_mem) + + MCFG_DEVICE_MODIFY("nmi_timer") + MCFG_TIMER_START_DELAY(attotime::from_seconds(1)) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(6*16, 1*8) + MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 8*1-1) + + MCFG_DEVICE_MODIFY("hd44780") + MCFG_HD44780_LCD_SIZE(1, 16) + MCFG_HD44780_PIXEL_UPDATE_CB(psion1_state::psion1_pixel_update) + + /* Software lists */ + MCFG_SOFTWARE_LIST_REMOVE("pack_list") + MCFG_SOFTWARE_LIST_ADD("pack_list", "psion1") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( psioncm, psion_2lines ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(psioncm_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( psionla, psion_2lines ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(psionla_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( psionlam, psion_2lines ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(psionlam_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( psionp350, psion_2lines ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(psionp350_mem) + + MCFG_NVRAM_ADD_0FILL("nvram3") // paged RAM +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( psionlz, psion_4lines ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(psionlz_mem) + + MCFG_NVRAM_ADD_0FILL("nvram3") // paged RAM +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( psion1 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v1", "Organiser I") + ROMX_LOAD( "psion1.rom", 0xf000, 0x1000, CRC(7e2609c1) SHA1(a3320ea8ac3ab9e0039ee16f7c571731adde5869), ROM_BIOS(1)) +ROM_END + +ROM_START( psioncm ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v24", "CM v2.4") + ROMX_LOAD( "24-cm.dat", 0x8000, 0x8000, CRC(f6798394) SHA1(736997f0db9a9ee50d6785636bdc3f8ff1c33c66), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v26", "CM v2.6") + ROMX_LOAD( "26-cm.rom", 0x8000, 0x8000, CRC(21b7c94c) SHA1(e0a3168c96a3f0b37b8698e86574e40597fe3c62), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v33", "CM v3.3") + ROMX_LOAD( "33-cm.rom", 0x8000, 0x8000, CRC(5c10b167) SHA1(6deea00fe648bddae1d61a22858023bc80277ea0), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v33f","CM v3.3 French") + ROMX_LOAD( "33-cmf.rom", 0x8000, 0x8000, CRC(4d626ce2) SHA1(82b96f11a0abfc1931b6022b84733d975ad7ab2b), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v36f","CM v3.6 French") + ROMX_LOAD( "36-cmf.rom", 0x8000, 0x8000, CRC(beabe0f5) SHA1(a5ef3bb92190a257cb0e94d58b2c23935436edeb), ROM_BIOS(5)) +ROM_END + +ROM_START( psionxp ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v26", "XP v2.6") + ROMX_LOAD( "26-xp.rom", 0x8000, 0x8000, CRC(a81db40f) SHA1(af72d94ccee1fa1dade8776bdbd39920665a68b7), ROM_BIOS(1) ) +ROM_END + +ROM_START( psionla ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v33", "LA v3.3") + ROMX_LOAD( "33-la.dat", 0x8000, 0x8000, CRC(02668ed4) SHA1(e5d4ee6b1cde310a2970ffcc6f29a0ce09b08c46), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v34g", "LA v3.4 German") + ROMX_LOAD( "34-lag.rom", 0x8000, 0x8000, CRC(13a92c4b) SHA1(dab8bd6a41a5fd509c5ad4b0b0ab80d14f2c421a), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v36", "LA v3.6") + ROMX_LOAD( "36-la.rom", 0x8000, 0x8000, CRC(7442c7f6) SHA1(94f15bd06bd750be70fa4a4ab588237c5a703f65), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v30", "LA v3.0") + ROMX_LOAD( "30-lahp.rom", 0x8000, 0x8000, CRC(50192528) SHA1(c556d53f70bf5ecae756b2ebfc6d954912316bbe), ROM_BIOS(4)) +ROM_END + +ROM_START( psionp200 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v33", "POS200a v3.3") + ROMX_LOAD( "33-p200a.rom", 0x8000, 0x8000, CRC(91e94998) SHA1(e9e8106eb9283d20452697859894aa407cc07bd1), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v36", "POS200 v3.6") + ROMX_LOAD( "36-p200.rom", 0x8000, 0x8000, CRC(4569ef5b) SHA1(8c275474cc6e3f50156f0b6e32121cadd14ea8be), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v36a", "POS200a v3.6") + ROMX_LOAD( "36-p200a.rom", 0x8000, 0x8000, CRC(36cceeb7) SHA1(57069812c5a16babfff91dc7d7e0842e5dc68652), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v36b", "POS250 v3.6") + ROMX_LOAD( "36-p250.rom", 0x8000, 0x8000, CRC(235cc76a) SHA1(3229cdff4b049a1fbf9a758ce3abf3fdc9b547c9), ROM_BIOS(4)) +ROM_END + +ROM_START( psionp350 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v36", "POS350 v3.6") + ROMX_LOAD( "36-p350.dat", 0x8000, 0x8000, CRC(3a371a74) SHA1(9167210b2c0c3bd196afc08ca44ab23e4e62635e), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v38", "POS350 v3.8") + ROMX_LOAD( "38-p350.dat", 0x8000, 0x8000, CRC(1b8b082f) SHA1(a3e875a59860e344f304a831148a7980f28eaa4a), ROM_BIOS(2)) +ROM_END + +ROM_START( psionlam ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v37", "LA v3.7") + ROMX_LOAD( "37-lam.dat", 0x8000, 0x10000, CRC(7ee3a1bc) SHA1(c7fbd6c8e47c9b7d5f636e9f56e911b363d6796b), ROM_BIOS(1)) +ROM_END + +ROM_START( psionlz64 ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v44", "LZ64 v4.4") + ROMX_LOAD( "44-lz64.dat", 0x8000, 0x10000, CRC(aa487913) SHA1(5a44390f63fc8c1bc94299ab2eb291bc3a5b989a), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v46si", "LZ64 v4.6 Spanish / Italian") + ROMX_LOAD( "46-lz64i.rom", 0x8000, 0x10000, CRC(c96c7e65) SHA1(1b4af43657bbd3ecd92f370762bde166047b85e2), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v43", "LZ64 v4.3") + ROMX_LOAD( "43-lz64.rom", 0x8000, 0x10000, CRC(57e7a372) SHA1(46c2da1cfe991c0c1f2486e4aa28388767937ddd), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v46a", "LZ64 v4.6a") + ROMX_LOAD( "46a-lz64.rom", 0x8000, 0x10000, CRC(9b0d5a7a) SHA1(f1cdd6ef43cd65ef18e148deca0500f0c1ad2f80), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v46b", "LZ64 v4.6b") + ROMX_LOAD( "46b-lz64.rom", 0x8000, 0x10000, CRC(8d1101e2) SHA1(eddd0c3a2881667a1485b0d66f82f8c7792995c2), ROM_BIOS(5)) + + ROM_REGION( 0x1000, "hd44780", 0 ) + ROM_LOAD( "psion_lz_charset.bin", 0x0000, 0x1000, BAD_DUMP CRC(44bff6f6) SHA1(aef544548b783d608a7d55456f6c46f421a11ed7)) +ROM_END + +ROM_START( psionlz64s ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v46", "LZ64 v4.6") + ROMX_LOAD( "46-lz64s.dat", 0x8000, 0x10000, CRC(328d9772) SHA1(7f9e2d591d59ecfb0822d7067c2fe59542ea16dd), ROM_BIOS(1)) + + ROM_REGION( 0x1000, "hd44780", 0 ) + ROM_LOAD( "psion_lz_charset.bin", 0x0000, 0x1000, BAD_DUMP CRC(44bff6f6) SHA1(aef544548b783d608a7d55456f6c46f421a11ed7)) +ROM_END + +ROM_START( psionlz ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v46", "LZ v4.6") + ROMX_LOAD( "46-lz.dat", 0x8000, 0x10000, CRC(22715f48) SHA1(cf460c81cadb53eddb7afd8dadecbe8c38ea3fc2), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v42", "LZ v4.2") + ROMX_LOAD( "42-lz.rom", 0x8000, 0x10000, CRC(f2d6ad47) SHA1(ee8315ae872463068d805c6e0b71f62ae8eb65be), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v44", "LZ v4.4") + ROMX_LOAD( "44-lz.rom", 0x8000, 0x10000, CRC(4a0a990b) SHA1(dde0ba69a4a7f02b610ad6bd69a8b8552b060223), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v45", "LZ v4.5") + ROMX_LOAD( "45-lz.rom", 0x8000, 0x10000, CRC(f95d8f39) SHA1(cb64152c2418bf730c89999d1b13c1d1ada1f082), ROM_BIOS(4)) + + ROM_REGION( 0x1000, "hd44780", 0 ) + ROM_LOAD( "psion_lz_charset.bin", 0x0000, 0x1000, BAD_DUMP CRC(44bff6f6) SHA1(aef544548b783d608a7d55456f6c46f421a11ed7)) +ROM_END + +ROM_START( psionp464 ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v46", "POS464 v4.6") + ROMX_LOAD( "46-p464.dat", 0x8000, 0x10000, CRC(672a0945) SHA1(d2a6e3fe1019d1bd7ae4725e33a0b9973f8cd7d8), ROM_BIOS(1)) + + ROM_REGION( 0x1000, "hd44780", 0 ) + ROM_LOAD( "psion_lz_charset.bin", 0x0000, 0x1000, BAD_DUMP CRC(44bff6f6) SHA1(aef544548b783d608a7d55456f6c46f421a11ed7)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, psion1, 0, 0, psion1, psion1,driver_device, 0, "Psion", "Organiser I", MACHINE_NOT_WORKING) +COMP( 1986, psioncm, 0, 0, psioncm, psion, driver_device, 0, "Psion", "Organiser II CM", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1986, psionla, psioncm, 0, psionla, psion, driver_device, 0, "Psion", "Organiser II LA", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1986, psionxp, psioncm, 0, psionla, psion, driver_device, 0, "Psion", "Organiser II XP", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1986, psionp200, psioncm, 0, psionp350, psion, driver_device, 0, "Psion", "Organiser II P200", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1986, psionp350, psioncm, 0, psionp350, psion, driver_device, 0, "Psion", "Organiser II P350", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1986, psionlam, psioncm, 0, psionlam, psion, driver_device, 0, "Psion", "Organiser II LAM", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1989, psionlz, 0, 0, psionlz, psion, driver_device, 0, "Psion", "Organiser II LZ", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1989, psionlz64, psionlz, 0, psionlz, psion, driver_device, 0, "Psion", "Organiser II LZ64", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1989, psionlz64s, psionlz, 0, psionlz, psion, driver_device, 0, "Psion", "Organiser II LZ64S", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +COMP( 1989, psionp464, psionlz, 0, psionlz, psion, driver_device, 0, "Psion", "Organiser II P464", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) diff --git a/src/mame/drivers/psx.c b/src/mame/drivers/psx.c new file mode 100644 index 00000000000..17f3d904a93 --- /dev/null +++ b/src/mame/drivers/psx.c @@ -0,0 +1,307 @@ +// license:BSD-3-Clause +// copyright-holders:smf, pSXAuthor, R. Belmont +/*************************************************************************** + + Sony Playstaion + =============== + Preliminary driver by smf + Additional development by pSXAuthor and R. Belmont + +***************************************************************************/ + +#include "emu.h" +#include "cpu/psx/psx.h" +#include "cpu/m6805/m6805.h" +#include "video/psx.h" +#include "imagedev/snapquik.h" +#include "imagedev/chd_cd.h" +#include "sound/spu.h" +#include "debugger.h" +#include "machine/psxcd.h" +#include "bus/psx/ctlrport.h" + +#define PSXCD_TAG "psxcd" + +class psx1_state : public driver_device +{ +public: + psx1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_ram(*this, "maincpu:ram") + { + } + + UINT8 *m_exe_buffer; + int m_exe_size; + int m_cd_param_p; + int m_cd_result_p; + int m_cd_result_c; + int m_cd_result_ready; + int m_cd_reset; + UINT8 m_cd_stat; + UINT8 m_cd_io_status; + UINT8 m_cd_param[8]; + UINT8 m_cd_result[8]; + DECLARE_MACHINE_RESET(psx); + inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); + void cd_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); + void cd_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); + required_device m_maincpu; + required_device m_ram; +}; + + +#define VERBOSE_LEVEL ( 0 ) + +inline void ATTR_PRINTF(3,4) psx1_state::verboselog( int n_level, const char *s_fmt, ... ) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%s: %s", machine().describe_context(), buf ); + } +} + + +void psx1_state::cd_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) +{ + UINT8 *psxram = (UINT8 *) p_n_psxram; + psxcd_device *psxcd = machine().device(PSXCD_TAG); + psxcd->start_dma(psxram + n_address, n_size*4); +} + +void psx1_state::cd_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) +{ + printf("cd_dma_write?!: addr %x, size %x\n", n_address, n_size); +} + +static ADDRESS_MAP_START( psx_map, AS_PROGRAM, 32, psx1_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( subcpu_map, AS_PROGRAM, 8, psx1_state ) + AM_RANGE(0x0000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( psj, psx1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", CXD8530CQ, XTAL_67_7376MHz ) + MCFG_CPU_PROGRAM_MAP( psx_map ) + + MCFG_RAM_MODIFY("maincpu:ram") + MCFG_RAM_DEFAULT_SIZE("2M") + + MCFG_DEVICE_ADD("controllers", PSXCONTROLLERPORTS, 0) + MCFG_PSX_CONTROLLER_PORTS_RXD_HANDLER(DEVWRITELINE("maincpu:sio0", psxsio0_device, write_rxd)) + MCFG_PSX_CONTROLLER_PORTS_DSR_HANDLER(DEVWRITELINE("maincpu:sio0", psxsio0_device, write_dsr)) + MCFG_PSX_CTRL_PORT_ADD("port1", psx_controllers, "digital_pad") + MCFG_PSX_CTRL_PORT_ADD("port2", psx_controllers, "digital_pad") + + MCFG_DEVICE_MODIFY("maincpu:sio0") + MCFG_PSX_SIO_DTR_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_dtr)) + MCFG_PSX_SIO_SCK_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_sck)) + MCFG_PSX_SIO_TXD_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_txd)) + + /* video hardware */ + MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0x100000, XTAL_53_693175MHz ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 ) + MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) + MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) + + MCFG_SOFTWARE_LIST_ADD("cd_list","psx") + + MCFG_DEVICE_MODIFY( "maincpu" ) + MCFG_PSX_CD_READ_HANDLER( DEVREAD8( PSXCD_TAG, psxcd_device, read ) ) + MCFG_PSX_CD_WRITE_HANDLER( DEVWRITE8( PSXCD_TAG, psxcd_device, write ) ) + + MCFG_PSXCD_ADD(PSXCD_TAG, "cdrom") + MCFG_PSXCD_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin2)) + MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 3, psx_dma_read_delegate( FUNC( psx1_state::cd_dma_read ), (psx1_state *) owner ) ) + MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 3, psx_dma_write_delegate( FUNC( psx1_state::cd_dma_write ), (psx1_state *) owner ) ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( psu, psj ) + MCFG_CPU_ADD( "subcpu", HD63705, 4166667 ) // MC68HC05G6 + MCFG_CPU_PROGRAM_MAP( subcpu_map ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pse, psx1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", CXD8530AQ, XTAL_67_7376MHz ) + MCFG_CPU_PROGRAM_MAP( psx_map) + + MCFG_RAM_MODIFY("maincpu:ram") + MCFG_RAM_DEFAULT_SIZE("2M") + + MCFG_DEVICE_ADD("controllers", PSXCONTROLLERPORTS, 0) + MCFG_PSX_CONTROLLER_PORTS_RXD_HANDLER(DEVWRITELINE("maincpu:sio0", psxsio0_device, write_rxd)) + MCFG_PSX_CONTROLLER_PORTS_DSR_HANDLER(DEVWRITELINE("maincpu:sio0", psxsio0_device, write_dsr)) + MCFG_PSX_CTRL_PORT_ADD("port1", psx_controllers, "digital_pad") + MCFG_PSX_CTRL_PORT_ADD("port2", psx_controllers, "digital_pad") + + MCFG_DEVICE_MODIFY("maincpu:sio0") + MCFG_PSX_SIO_DTR_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_dtr)) + MCFG_PSX_SIO_SCK_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_sck)) + MCFG_PSX_SIO_TXD_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_txd)) + + /* video hardware */ + /* TODO: visible area and refresh rate */ + MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0x100000, XTAL_53_693175MHz ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 ) + MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) + MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) + + MCFG_SOFTWARE_LIST_ADD("cd_list","psx") + + MCFG_DEVICE_MODIFY( "maincpu" ) + MCFG_PSX_CD_READ_HANDLER( DEVREAD8( PSXCD_TAG, psxcd_device, read ) ) + MCFG_PSX_CD_WRITE_HANDLER( DEVWRITE8( PSXCD_TAG, psxcd_device, write ) ) + + MCFG_PSXCD_ADD(PSXCD_TAG, "cdrom") + MCFG_PSXCD_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin2)) + MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 3, psx_dma_read_delegate( FUNC( psx1_state::cd_dma_read ), (psx1_state *) owner ) ) + MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 3, psx_dma_write_delegate( FUNC( psx1_state::cd_dma_write ), (psx1_state *) owner ) ) +MACHINE_CONFIG_END + +ROM_START( psj ) + ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) + + ROM_SYSTEM_BIOS( 0, "1.0j", "SCPH-1000/DTL-H1000" ) // 22091994 + ROMX_LOAD( "ps-10j.bin", 0x000000, 0x080000, CRC(3b601fc8) SHA1(343883a7b555646da8cee54aadd2795b6e7dd070), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "1.1j", "SCPH-3000/DTL-H1000H (Version 1.1 01/22/95)" ) // 22091994 + ROMX_LOAD( "ps-11j.bin", 0x000000, 0x080000, CRC(3539def6) SHA1(b06f4a861f74270be819aa2a07db8d0563a7cc4e), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS( 2, "2.1j", "SCPH-3500 (Version 2.1 07/17/95 J)" ) // 22091994 + ROMX_LOAD( "ps-21j.bin", 0x000000, 0x080000, CRC(bc190209) SHA1(e38466a4ba8005fba7e9e3c7b9efeba7205bee3f), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS( 3, "2.2j", "SCPH-5000/DTL-H1200/DTL-H3000 (Version 2.2 12/04/95 J)" ) // 04121995 +/* ROMX_LOAD( "ps-22j.bad", 0x000000, 0x080000, BAD_DUMP CRC(8c93a399) SHA1(e340db2696274dda5fdc25e434a914db71e8b02b), ROM_BIOS(4) ) */ + ROMX_LOAD( "ps-22j.bin", 0x000000, 0x080000, CRC(24fc7e17) SHA1(ffa7f9a7fb19d773a0c3985a541c8e5623d2c30d), ROM_BIOS(4) ) + + ROM_SYSTEM_BIOS( 4, "2.2d", "DTL-H1100 (Version 2.2 03/06/96 D)" ) // 04121995 + ROMX_LOAD( "ps-22d.bin", 0x000000, 0x080000, CRC(decb22f5) SHA1(73107d468fc7cb1d2c5b18b269715dd889ecef06), ROM_BIOS(5) ) + + ROM_SYSTEM_BIOS( 5, "3.0j", "SCPH-5500 (Version 3.0 09/09/96 J)" ) // 04121995 + ROMX_LOAD( "ps-30j.bin", 0x000000, 0x080000, CRC(ff3eeb8c) SHA1(b05def971d8ec59f346f2d9ac21fb742e3eb6917), ROM_BIOS(6) ) + + ROM_SYSTEM_BIOS( 6, "4.0j", "SCPH-7000/SCPH-7500/SCPH-9000 (Version 4.0 08/18/97 J)" ) // 29051997 + ROMX_LOAD( "ps-40j.bin", 0x000000, 0x080000, CRC(ec541cd0) SHA1(77b10118d21ac7ffa9b35f9c4fd814da240eb3e9), ROM_BIOS(7) ) + + ROM_SYSTEM_BIOS( 7, "4.1a", "SCPH-7000W (Version 4.1 11/14/97 A)" ) // 04121995 + ROMX_LOAD( "ps-41a(w).bin", 0x000000, 0x080000, CRC(b7c43dad) SHA1(1b0dbdb23da9dc0776aac58d0755dc80fea20975), ROM_BIOS(8) ) + + ROM_SYSTEM_BIOS( 8, "4.3j", "SCPH-100 (Version 4.3 03/11/00 J)" ) // 04121995 + ROMX_LOAD( "psone-43j.bin", 0x000000, 0x080000, CRC(f2af798b) SHA1(339a48f4fcf63e10b5b867b8c93cfd40945faf6c), ROM_BIOS(9) ) +ROM_END + +ROM_START( psu ) + ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) + + ROM_SYSTEM_BIOS( 0, "2.0a", "DTL-H1001 (Version 2.0 05/07/95 A)" ) // 22091994 + ROMX_LOAD( "ps-20a.bin", 0x000000, 0x080000, CRC(55847d8c) SHA1(649895efd79d14790eabb362e94eb0622093dfb9), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "2.1a", "DTL-H1101 (Version 2.1 07/17/95 A)" ) // 22091994 + ROMX_LOAD( "ps-21a.bin", 0x000000, 0x080000, CRC(aff00f2f) SHA1(ca7af30b50d9756cbd764640126c454cff658479), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS( 2, "2.2a", "SCPH-1001/DTL-H1201/DTL-H3001 (Version 2.2 12/04/95 A)" ) // 04121995 + ROMX_LOAD( "ps-22a.bin", 0x000000, 0x080000, CRC(37157331) SHA1(10155d8d6e6e832d6ea66db9bc098321fb5e8ebf), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS( 3, "3.0a", "SCPH-5501/SCPH-5503/SCPH-7003 (Version 3.0 11/18/96 A)" ) // 04121995 + ROMX_LOAD( "ps-30a.bin", 0x000000, 0x080000, CRC(8d8cb7e4) SHA1(0555c6fae8906f3f09baf5988f00e55f88e9f30b), ROM_BIOS(4) ) + + ROM_SYSTEM_BIOS( 4, "4.1a", "SCPH-7001/SCPH-7501/SCPH-7503/SCPH-9001/SCPH-9003/SCPH-9903 (Version 4.1 12/16/97 A)" ) // 04121995 + ROMX_LOAD( "ps-41a.bin", 0x000000, 0x080000, CRC(502224b6) SHA1(14df4f6c1e367ce097c11deae21566b4fe5647a9), ROM_BIOS(5) ) + + ROM_SYSTEM_BIOS( 5, "4.5a", "SCPH-101 (Version 4.5 05/25/00 A)" ) // 04121995 + ROMX_LOAD( "psone-45a.bin", 0x000000, 0x080000, CRC(171bdcec) SHA1(dcffe16bd90a723499ad46c641424981338d8378), ROM_BIOS(6) ) + + ROM_REGION( 0x10000, "subcpu", 0 ) + ROM_LOAD( "ram.ic304", 0x000000, 0x000400, CRC(e9fefc8b) SHA1(7ab4a498216fb9a3fca9daf6ad21b4553126e74f) ) + ROM_FILL( 0x0400, 0x0c00, 0xff ) + ROM_LOAD( "scea.ic304", 0x001000, 0x004000, CRC(82729934) SHA1(7d5f52eb9df1243dcdab32cb763a9eb6a22706d7) ) + ROM_FILL( 0x5000, 0xae00, 0xff ) + ROM_LOAD( "test.ic304", 0x00fe00, 0x000200, CRC(3b2f8041) SHA1(d7127cb4a9b5efe9deffab3b72ab4451cb30675b) ) +ROM_END + +ROM_START( pse ) + ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) + + ROM_SYSTEM_BIOS( 0, "2.0e", "DTL-H1002/SCPH-1002 (Version 2.0 05/10/95 E)" ) // 22091994 + ROMX_LOAD( "ps-20e.bin", 0x000000, 0x080000, CRC(9bb87c4b) SHA1(20b98f3d80f11cbf5a7bfd0779b0e63760ecc62c), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "2.1e", "SCPH-1002/DTL-H1102 (Version 2.1 07/17/95 E)" ) // 22091994 + ROMX_LOAD( "ps-21e.bin", 0x000000, 0x080000, CRC(86c30531) SHA1(76cf6b1b2a7c571a6ad07f2bac0db6cd8f71e2cc), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS( 2, "2.2e", "SCPH-1002/DTL-H1202/DTL-H3002 (Version 2.2 12/04/95 E)" ) // 04121995 + ROMX_LOAD( "ps-22e.bin", 0x000000, 0x080000, CRC(1e26792f) SHA1(b6a11579caef3875504fcf3831b8e3922746df2c), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS( 3, "3.0e", "SCPH-5502/SCPH-5552 (Version 3.0 01/06/97 E)" ) // 04121995 +/* ROMX_LOAD( "ps-30e.bad", 0x000000, 0x080000, BAD_DUMP CRC(4d9e7c86) SHA1(f8de9325fc36fcfa4b29124d291c9251094f2e54), ROM_BIOS(4) ) */ + ROMX_LOAD( "ps-30e.bin", 0x000000, 0x080000, CRC(d786f0b9) SHA1(f6bc2d1f5eb6593de7d089c425ac681d6fffd3f0), ROM_BIOS(4) ) + + ROM_SYSTEM_BIOS( 4, "4.1e", "SCPH-7002/SCPH-7502/SCPH-9002 (Version 4.1 12/16/97 E)" ) // 04121995 + ROMX_LOAD( "ps-41e.bin", 0x000000, 0x080000, CRC(318178bf) SHA1(8d5de56a79954f29e9006929ba3fed9b6a418c1d), ROM_BIOS(5) ) + + ROM_SYSTEM_BIOS( 5, "4.4e", "SCPH-102 (Version 4.4 03/24/00 E)" ) // 04121995 + ROMX_LOAD( "psone-44e.bin", 0x000000, 0x080000, CRC(0bad7ea9) SHA1(beb0ac693c0dc26daf5665b3314db81480fa5c7c), ROM_BIOS(6) ) + + ROM_SYSTEM_BIOS( 6, "4.5e", "SCPH-102 (Version 4.5 05/25/00 E)" ) // 04121995 + ROMX_LOAD( "psone-45e.bin", 0x000000, 0x080000, CRC(76b880e5) SHA1(dbc7339e5d85827c095764fc077b41f78fd2ecae), ROM_BIOS(7) ) +ROM_END + +ROM_START( psa ) + ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) + + ROM_SYSTEM_BIOS( 0, "3.0a", "SCPH-5501/SCPH-5503/SCPH-7003 (Version 3.0 11/18/96 A)" ) // 04121995 + ROMX_LOAD( "ps-30a.bin", 0x000000, 0x080000, CRC(8d8cb7e4) SHA1(0555c6fae8906f3f09baf5988f00e55f88e9f30b), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "4.1a", "SCPH-7001/SCPH-7501/SCPH-7503/SCPH-9001/SCPH-9003/SCPH-9903 (Version 4.1 12/16/97 A)" ) // 04121995 + ROMX_LOAD( "ps-41a.bin", 0x000000, 0x080000, CRC(502224b6) SHA1(14df4f6c1e367ce097c11deae21566b4fe5647a9), ROM_BIOS(2) ) +ROM_END + +/* +The version number & release date is stored in ascii text at the end of every bios, except for scph1000. +There is also a BCD encoded date at offset 0x100, but this is set to 22091994 for versions prior to 2.2 +and 04121995 for all versions from 2.2 ( except Version 4.0J which is 29051997 ). + +Consoles not dumped: + +DTL-H1001H +SCPH-5001 +SCPH-5002 (this is not mentioned in SCPH-102B.pdf so it's likely it doesn't exist) +SCPH-5003 +SCPH-103 + +Holes in version numbers: + +Version 2.0 J +Version 4.1 J (SCPH7000W uses 4.1 A) +Version 4.2 J +Version 4.4 J +Version 4.5 J +Version 4.0 A +Version 4.2 A +Version 4.3 A +Version 4.4 A +Version 4.0 E +Version 4.2 E +Version 4.3 E + +*/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1994, psj, 0, 0, psj, 0, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PlayStation (Japan)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 1995, pse, psj, 0, pse, 0, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PlayStation (Europe)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 1995, psu, psj, 0, psu, 0, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PlayStation (USA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 1995, psa, psj, 0, psj, 0, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PlayStation (Asia-Pacific)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/pt68k4.c b/src/mame/drivers/pt68k4.c new file mode 100644 index 00000000000..4a24667e873 --- /dev/null +++ b/src/mame/drivers/pt68k4.c @@ -0,0 +1,491 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert, R. Belmont +/*************************************************************************** + + Peripheral Technology PT68K2/PT68K4 family + + 2011-01-03 Skeleton driver. + 2013-09-30 Connected to a terminal + 2014-01-03 Connect real DUARTs, FDC, and TimeKeeper. Settings now save properly, floppies can be read. + 2014-01-19 ISA bus and compatible cards, PC keyboard support, speaker support + 2014-09-20 Add PT68K2, add save states, we have a working SK*DOS disk! + +This has the appearance of a PC, including pc power supply, slots, etc +on a conventional pc-like motherboard and case. + +Some pics: http://www.wormfood.net/old_computers/ + +Source code and manuals for the HUMBUG BIOS and SK*DOS are at: +http://www.users.cloud9.net/~stark/sources.html + +Usage: + Start up and press Enter as prompted. Type he to see a command list, or fd to boot from the + first floppy drive. + + The stock NVRAM configures PT68k2 for 2 DSDD 5.25" drives, and PT68k4 for 2 DSHD 5.25" drives. + +Chips: + 68230 Parallel Interface/Timer @ FE0081 + 68681 DUART/Timer (x2) @ FE0001 and FE0041 + WD37C65 FDC (PC FDC compatible, even mapped as an ISA device) + MK48T02 TimeKeeper @ odd bytes from FF0001 to FF0FFF. even bytes in that range are a standard SRAM chip which is not backed up. + Keyboard at FE01C1 (status/IRQ clear)/FE01C3 (AT scan codes) + WD1002 HDD controller @ FE0141-FE014F. "Monk" BIOS also supports an 8-bit ISA IDE card. + +Video: ISA MDA or CGA/EGA/VGA-style boards + ISA memory is C00001-DFFFFF odd bytes only. So the MDA B0000 framebuffer becames (B0000*2) + C00001 = D60001. + ISA I/O is at FA0001-FBFFFF odd bytes only, and the mapping is similar. + + HUMBUG BIOS tests MDA and CGA VRAM to determine existence, falls back to serial console if neither exists. If both exist, MDA is used. + VRAM is every other byte for ISA cards. (Only 8 bit cards are supported). + + OP3 on DUART1 drives a speaker. + IP2 on DUART1 signals if a new keyboard scan code is available. + +IRQs: + 2: 68230 PIT + 4: DUART2 + 5: DUART1 + 6: PC FDC IRQ + +TODO: 68230 device + This system and SK*DOS don't like our ISA WDXT-GEN emulation so HDD installs are not currently possible. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/mc68681.h" +#include "machine/timekpr.h" +#include "machine/wd_fdc.h" +#include "machine/pc_fdc.h" +#include "formats/imd_dsk.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "bus/pc_kbd/pc_kbdc.h" +#include "bus/pc_kbd/keyboards.h" +#include "sound/speaker.h" + +#define M68K_TAG "maincpu" +#define DUART1_TAG "duart1" +#define DUART2_TAG "duart2" +#define TIMEKEEPER_TAG "timekpr" +#define ISABUS_TAG "isa" +#define KBDC_TAG "pc_kbdc" +#define SPEAKER_TAG "speaker" +#define WDFDC_TAG "wdfdc" + +class pt68k4_state : public driver_device +{ +public: + pt68k4_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_p_base(*this, "rambase") + , m_maincpu(*this, M68K_TAG) + , m_duart1(*this, DUART1_TAG) + , m_duart2(*this, DUART2_TAG) + , m_isa(*this, ISABUS_TAG) + , m_speaker(*this, SPEAKER_TAG) + , m_wdfdc(*this, WDFDC_TAG) + { } + + DECLARE_READ8_MEMBER(hiram_r); + DECLARE_WRITE8_MEMBER(hiram_w); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(keyboard_w); + + DECLARE_READ8_MEMBER(pia_stub_r); + DECLARE_WRITE8_MEMBER(duart1_out); + + DECLARE_WRITE8_MEMBER(fdc_select_w); + + DECLARE_WRITE_LINE_MEMBER(duart1_irq); + DECLARE_WRITE_LINE_MEMBER(duart2_irq); + + DECLARE_WRITE_LINE_MEMBER(irq5_w); + + DECLARE_WRITE_LINE_MEMBER(keyboard_clock_w); + DECLARE_WRITE_LINE_MEMBER(keyboard_data_w); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + +private: + virtual void machine_start(); + virtual void machine_reset(); + required_shared_ptr m_p_base; + required_device m_maincpu; + required_device m_duart1; + required_device m_duart2; + required_device m_isa; + required_device m_speaker; + optional_device m_wdfdc; + + void irq5_update(); + + UINT8 m_hiram[0x800]; + + bool m_kclk; + UINT8 m_kdata; + UINT8 m_scancode; + UINT8 m_kbdflag; + int m_kbit; + int m_lastdrive; + bool m_irq5_duart1, m_irq5_isa; +}; + +FLOPPY_FORMATS_MEMBER( pt68k4_state::floppy_formats ) + FLOPPY_IMD_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( pt68k_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +// XT keyboard interface - done in TTL instead of an 804x +WRITE_LINE_MEMBER(pt68k4_state::keyboard_clock_w) +{ +// printf("KCLK: %d\n", state ? 1 : 0); + + // rising edge? + if ((state == ASSERT_LINE) && (!m_kclk)) + { + if (m_kbit >= 1 && m_kbit <= 8) + { + m_scancode >>= 1; + m_scancode |= m_kdata; + } + + // stop bit? + if (m_kbit == 9) + { +// printf("scancode %02x\n", m_scancode); + m_kbit = 0; + m_kbdflag = 0x80; + m_duart1->ip2_w(CLEAR_LINE); + } + else + { + m_kbit++; + } + } + + m_kclk = (state == ASSERT_LINE) ? true : false; +} + +WRITE_LINE_MEMBER(pt68k4_state::keyboard_data_w) +{ +// printf("KDATA: %d\n", state ? 1 : 0); + m_kdata = (state == ASSERT_LINE) ? 0x80 : 0x00; +} + +WRITE8_MEMBER(pt68k4_state::duart1_out) +{ + m_speaker->level_w((data >> 3) & 1); +} + +READ8_MEMBER(pt68k4_state::pia_stub_r) +{ + return 0; +} + +WRITE8_MEMBER(pt68k4_state::fdc_select_w) +{ + floppy_connector *con = machine().device(WDFDC_TAG":0"); + floppy_connector *con2 = machine().device(WDFDC_TAG":1"); + floppy_image_device *floppy = con ? con->get_device() : 0; + floppy_image_device *floppy2 = con2 ? con2->get_device() : 0; + int drive = data & 3; + + if (drive != m_lastdrive) + { + switch (drive) + { + case 0: + m_wdfdc->set_floppy(floppy); + break; + + case 1: + m_wdfdc->set_floppy(floppy2); + break; + + default: + m_wdfdc->set_floppy(NULL); + break; + } + + m_lastdrive = drive; + } + + switch (drive) + { + case 0: + floppy->ss_w((data & 0x40) ? 1 : 0); + break; + + case 1: + floppy2->ss_w((data & 0x40) ? 1 : 0); + break; + + default: + break; + } +} + +static ADDRESS_MAP_START(pt68k2_mem, AS_PROGRAM, 16, pt68k4_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("rambase") // 1MB RAM + AM_RANGE(0xf80000, 0xf8ffff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0xc00000, 0xdfffff) AM_DEVREADWRITE8(ISABUS_TAG, isa8_device, prog_r, prog_w, 0x00ff) + AM_RANGE(0xfa0000, 0xfbffff) AM_DEVREADWRITE8(ISABUS_TAG, isa8_device, io_r, io_w, 0x00ff) + AM_RANGE(0xfe0000, 0xfe001f) AM_DEVREADWRITE8(DUART1_TAG, mc68681_device, read, write, 0x00ff) + AM_RANGE(0xfe0040, 0xfe005f) AM_DEVREADWRITE8(DUART2_TAG, mc68681_device, read, write, 0x00ff) + AM_RANGE(0xfe0080, 0xfe00bf) AM_READ8(pia_stub_r, 0x00ff) + AM_RANGE(0xfe00c0, 0xfe00ff) AM_WRITE8(fdc_select_w, 0x00ff) + AM_RANGE(0xfe0100, 0xfe013f) AM_DEVREADWRITE8(WDFDC_TAG, wd1772_t, read, write, 0x00ff) + AM_RANGE(0xfe01c0, 0xfe01c3) AM_READWRITE8(keyboard_r, keyboard_w, 0x00ff) + AM_RANGE(0xff0000, 0xff0fff) AM_READWRITE8(hiram_r, hiram_w, 0xff00) + AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE8(TIMEKEEPER_TAG, timekeeper_device, read, write, 0x00ff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pt68k4_mem, AS_PROGRAM, 16, pt68k4_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("rambase") // 1MB RAM (OS9 needs more) + AM_RANGE(0xf80000, 0xf8ffff) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0xc00000, 0xdfffff) AM_DEVREADWRITE8(ISABUS_TAG, isa8_device, prog_r, prog_w, 0x00ff) + AM_RANGE(0xfa0000, 0xfbffff) AM_DEVREADWRITE8(ISABUS_TAG, isa8_device, io_r, io_w, 0x00ff) + AM_RANGE(0xfe0000, 0xfe001f) AM_DEVREADWRITE8(DUART1_TAG, mc68681_device, read, write, 0x00ff) + AM_RANGE(0xfe0040, 0xfe005f) AM_DEVREADWRITE8(DUART2_TAG, mc68681_device, read, write, 0x00ff) + AM_RANGE(0xfe01c0, 0xfe01c3) AM_READWRITE8(keyboard_r, keyboard_w, 0x00ff) + AM_RANGE(0xff0000, 0xff0fff) AM_READWRITE8(hiram_r, hiram_w, 0xff00) + AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE8(TIMEKEEPER_TAG, timekeeper_device, read, write, 0x00ff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pt68k4 ) +INPUT_PORTS_END + +/* built in keyboard: offset 0 reads 0x80 if key ready, 0 if not. If key ready, offset 1 reads scancode. Read or write to offs 0 clears key ready */ +READ8_MEMBER(pt68k4_state::keyboard_r) +{ + if (offset == 0) + { + UINT8 rv = m_kbdflag; + + m_kbdflag = 0; + m_duart1->ip2_w(ASSERT_LINE); + + return rv; + } + + return m_scancode; +} + +WRITE8_MEMBER(pt68k4_state::keyboard_w) +{ + m_kbdflag = 0; + m_duart1->ip2_w(ASSERT_LINE); +} + +READ8_MEMBER(pt68k4_state::hiram_r) +{ + return m_hiram[offset]; +} + +WRITE8_MEMBER(pt68k4_state::hiram_w) +{ + m_hiram[offset] = data; +} + +void pt68k4_state::machine_start() +{ + save_item(NAME(m_hiram)); + save_item(NAME(m_kclk)); + save_item(NAME(m_kdata)); + save_item(NAME(m_scancode)); + save_item(NAME(m_kbdflag)); + save_item(NAME(m_kbit)); + save_item(NAME(m_lastdrive)); + save_item(NAME(m_irq5_duart1)); + save_item(NAME(m_irq5_isa)); +} + +void pt68k4_state::machine_reset() +{ + UINT8* user1 = memregion("roms")->base(); + memcpy((UINT8*)m_p_base.target(), user1, 8); + + m_maincpu->reset(); + + m_kclk = true; + m_kbit = 0; + m_scancode = 0; + m_kbdflag = 0; + m_irq5_duart1 = CLEAR_LINE; + m_irq5_isa = CLEAR_LINE; + + // set line to asserted (no key code ready) + m_duart1->ip2_w(ASSERT_LINE); + + if (m_wdfdc) + { + floppy_connector *con = machine().device(WDFDC_TAG":0"); + floppy_image_device *floppy = con ? con->get_device() : 0; + + m_wdfdc->set_floppy(floppy); + floppy->ss_w(0); + + m_lastdrive = 0; + } +} + +void pt68k4_state::irq5_update() +{ + if ((m_irq5_duart1) || (m_irq5_isa)) + { + m_maincpu->set_input_line(M68K_IRQ_5, ASSERT_LINE); + } + else + { + m_maincpu->set_input_line(M68K_IRQ_5, CLEAR_LINE); + } +} + +WRITE_LINE_MEMBER(pt68k4_state::duart1_irq) +{ + m_irq5_duart1 = state; + irq5_update(); +} + +WRITE_LINE_MEMBER(pt68k4_state::irq5_w) +{ + m_irq5_isa = state; + irq5_update(); +} + +WRITE_LINE_MEMBER(pt68k4_state::duart2_irq) +{ + m_maincpu->set_input_line(M68K_IRQ_4, state); +} + +// these are cards supported by the HUMBUG and Monk BIOSes +SLOT_INTERFACE_START( pt68k4_isa8_cards ) + SLOT_INTERFACE("mda", ISA8_MDA) + SLOT_INTERFACE("cga", ISA8_CGA) + SLOT_INTERFACE("ega", ISA8_EGA) // Monk only + SLOT_INTERFACE("vga", ISA8_VGA) // Monk only + SLOT_INTERFACE("fdc_at", ISA8_FDC_AT) + SLOT_INTERFACE("wdxt_gen", ISA8_WDXT_GEN) + SLOT_INTERFACE("lpt", ISA8_LPT) + SLOT_INTERFACE("xtide", ISA8_XTIDE) // Monk only +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( pt68k2, pt68k4_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M68K_TAG, M68000, XTAL_16MHz/2) // 68k2 came in 8, 10, and 12 MHz versions + MCFG_CPU_PROGRAM_MAP(pt68k2_mem) + + MCFG_MC68681_ADD("duart1", XTAL_3_6864MHz) + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(pt68k4_state, duart1_irq)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(pt68k4_state, duart1_out)) + + MCFG_MC68681_ADD("duart2", XTAL_3_6864MHz) + + MCFG_DEVICE_ADD(KBDC_TAG, PC_KBDC, 0) + MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(pt68k4_state, keyboard_clock_w)) + MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE(pt68k4_state, keyboard_data_w)) + MCFG_PC_KBDC_SLOT_ADD(KBDC_TAG, "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + + MCFG_M48T02_ADD(TIMEKEEPER_TAG) + + MCFG_WD1772_ADD(WDFDC_TAG, XTAL_16MHz / 2) + MCFG_FLOPPY_DRIVE_ADD(WDFDC_TAG":0", pt68k_floppies, "525dd", pt68k4_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WDFDC_TAG":1", pt68k_floppies, "525dd", pt68k4_state::floppy_formats) + + MCFG_DEVICE_ADD(ISABUS_TAG, ISA8, 0) + MCFG_ISA8_CPU(":" M68K_TAG) + MCFG_ISA8_BUS_CUSTOM_SPACES() + MCFG_ISA_OUT_IRQ5_CB(WRITELINE(pt68k4_state, irq5_w)) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa1", pt68k4_isa8_cards, "cga", false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa2", pt68k4_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa3", pt68k4_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa4", pt68k4_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa5", pt68k4_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa6", pt68k4_isa8_cards, NULL, false) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOFTWARE_LIST_ADD("flop525_list", "pt68k2") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( pt68k4, pt68k4_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(M68K_TAG, M68000, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(pt68k4_mem) + + // add the DUARTS. first one has the console on channel A at 19200. + MCFG_MC68681_ADD("duart1", XTAL_16MHz / 4) + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(pt68k4_state, duart1_irq)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(pt68k4_state, duart1_out)) + + MCFG_MC68681_ADD("duart2", XTAL_16MHz / 4) + + MCFG_DEVICE_ADD(KBDC_TAG, PC_KBDC, 0) + MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(pt68k4_state, keyboard_clock_w)) + MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE(pt68k4_state, keyboard_data_w)) + MCFG_PC_KBDC_SLOT_ADD(KBDC_TAG, "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) + + MCFG_M48T02_ADD(TIMEKEEPER_TAG) + + MCFG_DEVICE_ADD(ISABUS_TAG, ISA8, 0) + MCFG_ISA8_CPU(":" M68K_TAG) + MCFG_ISA8_BUS_CUSTOM_SPACES() + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa1", pt68k4_isa8_cards, "fdc_at", false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa2", pt68k4_isa8_cards, "cga", false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa3", pt68k4_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa4", pt68k4_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa5", pt68k4_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa6", pt68k4_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa7", pt68k4_isa8_cards, NULL, false) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOFTWARE_LIST_ADD("flop525_list", "pt68k2") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pt68k2 ) + ROM_REGION16_BE( 0x10000, "roms", 0 ) + ROM_LOAD16_BYTE( "hum_u20.bin", 0x000000, 0x008000, CRC(69db483a) SHA1(9dfea73e4d7deef7c66a27cca92eb7c9ff767215) ) + ROM_LOAD16_BYTE( "hum_u27.bin", 0x000001, 0x008000, CRC(54441b06) SHA1(0e2d63b1cd01f88f37fc4859c11c252c4fea220b) ) + + ROM_REGION(0x800, TIMEKEEPER_TAG, 0) + ROM_LOAD( "u21_ds1220.bin", 0x000000, 0x000800, CRC(7a6b75ce) SHA1(07663860aa6cc21aed04a568ff9c05bc75d62e4f) ) +ROM_END + +ROM_START( pt68k4 ) + ROM_REGION16_BE( 0x10000, "roms", 0 ) + ROM_SYSTEM_BIOS( 0, "humbug", "Humbug" ) + ROMX_LOAD( "humpta40.bin", 0x0000, 0x8000, CRC(af67ff64) SHA1(da9fa31338c6847bb0e66118679b1ec01f6dc30b), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "humpta41.bin", 0x0001, 0x8000, CRC(a8b16e27) SHA1(218802f6e20d14cff736bb7423f06ce2f66e074c), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "monk", "Monk" ) + ROMX_LOAD( "monk_0.bin", 0x0000, 0x8000, CRC(420d6a4b) SHA1(fca8c53c9c3c8ebd09370499cf34f4cc75ed9463), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "monk_1.bin", 0x0001, 0x8000, CRC(fc495e82) SHA1(f7b720d87db4d72a23e6c42d2cdd03216db04b60), ROM_SKIP(1) | ROM_BIOS(2)) + + ROM_REGION(0x800, TIMEKEEPER_TAG, 0) + ROM_LOAD( "u21_ds1220_k4.bin", 0x000000, 0x000800, CRC(753472e6) SHA1(58dc8bcc86191e4a4429fe6a9b4fdd7788abb0cd) ) + + ROM_REGION( 0x0900, "proms", 0 ) + ROM_LOAD_OPTIONAL( "20l8.u71", 0x0000, 0x000149, CRC(77365121) SHA1(5ecf490ead119966a5c097d90740acde60462ab0) ) + ROM_LOAD_OPTIONAL( "16l8.u53", 0x0200, 0x000109, CRC(cb6a9984) SHA1(45b9b14e7b45cda6f0edfcbb9895b6a14eacb852) ) + ROM_LOAD_OPTIONAL( "22v10.u40", 0x0400, 0x0002e1, CRC(24df92e4) SHA1(c183113956bb0db132b6f37b239ca0bb7fac2d82) ) + ROM_LOAD_OPTIONAL( "16l8.u11", 0x0700, 0x000109, CRC(397a1363) SHA1(aca2a02e1bf1f7cdb9b0ca24ebecb0b01ae472e8) ) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1988, pt68k2, 0, 0, pt68k2, pt68k4, driver_device, 0, "Peripheral Technology", "PT68K2", MACHINE_SUPPORTS_SAVE ) +COMP( 1990, pt68k4, 0, 0, pt68k4, pt68k4, driver_device, 0, "Peripheral Technology", "PT68K4", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/ptcsol.c b/src/mame/drivers/ptcsol.c new file mode 100644 index 00000000000..bf3afcb02fd --- /dev/null +++ b/src/mame/drivers/ptcsol.c @@ -0,0 +1,796 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Processor Technology Corp. SOL-20 + + 07/2009 Skeleton driver. + + Info from: http://www.sol20.org/ + + Note that the SOLOS dump comes from the Solace emu. Confirmed as ok. + + The roms DPMON and CONSOL are widely available on the net as ENT files, + which can be loaded into memory with the Paste option, then exported to + binary files with the debugger. They are working, however the ENT files + do not indicate the values of unused rom space. Therefore they are marked + as BAD_DUMP. + + Note that the CONSOL rom is basically a dumb terminal program and doesn't + do anything useful unless the MODE key (whatever that is) is pressed. + + CUTER is a relocatable cassette-based alternative to SOLOS. According + to the manual, it should work if the sense switches are set to on. But, + it continuously reads port 00 and does nothing. + + Need original dumps of all roms. + + The character roms are built by a script from the Solace source, then the + characters moved back to the original 7x9 matrix positions, as shown in + the manual. Although they look exactly the same, I've marked them as + BAD_DUMP until properly verified. + + Other roms needed: + - Dump of U18 in the keyboard + + Hardware variants (ever shipped?): + - SOL-10, i.e. a stripped down version without expansion backplane and + numeric keypad + - SOL-PC, i.e. the single board version, basically it consisted of the + SOL-20 board only + + Similarity to Exidy Sorcerer: + - Some hardware is the same design (parallel ports, serial ports, 2 + tape players, the cassette circuits) + - The cassette format is totally identical, in fact tapes from one + machine can be loaded on the other natively. They won't run of course. + - Sorcerer monitor commands are almost identical to the SOLOS ones. + example: to change tape speed to 300 baud: + SE T=1 (sorcerer) SE TA 1 (SOLOS) + Most other commands are identical. The EN command (enter bytes into + memory) is rather primitive in SOLOS, better on Sorcerer. + - Sol20 has "personality modules" where you could plug a new OS into + a special socket on the motherboard. Sorcerer improved upon this by + being the first computer to use cartridges. + - Some circuits are completely different... the video and keyboard are + notable examples, while the addresses of ram and bios on the basic + machines is another major difference. + + ToDo: + - connect up half/full duplex dipswitch function + - connect up the remaining functions of port FE + - keyboard (using terminal keyboard for now) + - optional floppy disk support and CP/M + - parallel i/o and handshake lines + - connect serial i/o to something + - support for loading the various file formats + + File Formats: + - Most files are simple ascii which can be loaded via the Paste handler. + These are ASC, ENT, BAS, ROM, BS5 and ECB. Most files require that the + correct version of BASIC be loaded first. Paste works, but it is very + very slow. Perhaps we need something faster such as what Solace has. + - SVT (Solace Virtual Tape) files are a representation of a cassette, + usually holding about 4 games, just like a multifile tape. This format + is partially supported. + - HEX files appear to be the standard Intel format, and can be loaded + by Solace. + - The remaining formats (OPN, PL, PRN, SMU, SOL, ASM and LIB) appear + at first glance to be more specialised, and probably not worth being + supported. + + System Setup (to play games etc). + - In the Dipswitches (not the Configuration), turn cursor flashing OFF. + - Loading via wav files works, so load a tape image in the file manager + - In UPPER CASE, enter XE press enter, cassette will load. + - At the end, the program will start by itself. + - When it says use 2,4,6,8 keys, you can use the keyboard arrow keys. + + Monitor Commands: + - TE - ? + - DU - dump memory + - EN - modify memory + - EX - Go (execute) + - CU - ? + - SE - Set parameters (eg tape speed) + - SA - Save + - GE - Load + - XE - Load and run + - CA - List the files on a tape + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/keyboard.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "machine/ay31015.h" +#include "formats/sol_cas.h" + + +struct cass_data_t { + struct { + int length; /* time cassette level is at input.level */ + int level; /* cassette level */ + int bit; /* bit being read */ + } input; + struct { + int length; /* time cassette level is at output.level */ + int level; /* cassette level */ + int bit; /* bit to output */ + } output; +}; + +#define KEYBOARD_TAG "keyboard" + +class sol20_state : public driver_device +{ +public: + enum + { + TIMER_SOL20_CASSETTE_TC, + TIMER_SOL20_BOOT + }; + + sol20_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cass1(*this, "cassette") + , m_cass2(*this, "cassette2") + , m_uart(*this, "uart") + , m_uart_s(*this, "uart_s") + , m_p_videoram(*this, "videoram") + , m_iop_arrows(*this, "ARROWS") + , m_iop_config(*this, "CONFIG") + , m_iop_s1(*this, "S1") + , m_iop_s2(*this, "S2") + , m_iop_s3(*this, "S3") + , m_iop_s4(*this, "S4") + , m_cassette1(*this, "cassette") + , m_cassette2(*this, "cassette2") + { } + + DECLARE_READ8_MEMBER( sol20_f8_r ); + DECLARE_READ8_MEMBER( sol20_f9_r ); + DECLARE_READ8_MEMBER( sol20_fa_r ); + DECLARE_READ8_MEMBER( sol20_fb_r ); + DECLARE_READ8_MEMBER( sol20_fc_r ); + DECLARE_READ8_MEMBER( sol20_fd_r ); + DECLARE_WRITE8_MEMBER( sol20_f8_w ); + DECLARE_WRITE8_MEMBER( sol20_f9_w ); + DECLARE_WRITE8_MEMBER( sol20_fa_w ); + DECLARE_WRITE8_MEMBER( sol20_fb_w ); + DECLARE_WRITE8_MEMBER( sol20_fd_w ); + DECLARE_WRITE8_MEMBER( sol20_fe_w ); + DECLARE_WRITE8_MEMBER( kbd_put ); + DECLARE_DRIVER_INIT(sol20); + TIMER_CALLBACK_MEMBER(sol20_cassette_tc); + TIMER_CALLBACK_MEMBER(sol20_boot); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + UINT8 m_sol20_fa; + virtual void machine_reset(); + virtual void machine_start(); + virtual void video_start(); + UINT8 m_sol20_fc; + UINT8 m_sol20_fe; + const UINT8 *m_p_chargen; + UINT8 m_framecnt; + cass_data_t m_cass_data; + emu_timer *m_cassette_timer; + cassette_image_device *cassette_device_image(); + required_device m_maincpu; + required_device m_cass1; + required_device m_cass2; + required_device m_uart; + required_device m_uart_s; + required_shared_ptr m_p_videoram; + required_ioport m_iop_arrows; + required_ioport m_iop_config; + required_ioport m_iop_s1; + required_ioport m_iop_s2; + required_ioport m_iop_s3; + required_ioport m_iop_s4; + required_device m_cassette1; + required_device m_cassette2; +}; + + +/* timer to read cassette waveforms */ + + +cassette_image_device *sol20_state::cassette_device_image() +{ + if (m_sol20_fa & 0x40) + return m_cassette2; + else + return m_cassette1; +} + + +void sol20_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SOL20_CASSETTE_TC: + sol20_cassette_tc(ptr, param); + break; + case TIMER_SOL20_BOOT: + sol20_boot(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in sol20_state::device_timer"); + } +} + + +// identical to sorcerer +TIMER_CALLBACK_MEMBER(sol20_state::sol20_cassette_tc) +{ + UINT8 cass_ws = 0; + switch (m_sol20_fa & 0x20) + { + case 0x20: /* Cassette 300 baud */ + + /* loading a tape - this is basically the same as the super80. + We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */ + + m_cass_data.input.length++; + + cass_ws = ((cassette_device_image())->input() > +0.02) ? 1 : 0; + + if (cass_ws != m_cass_data.input.level) + { + m_cass_data.input.level = cass_ws; + m_cass_data.input.bit = ((m_cass_data.input.length < 0x6) || (m_cass_data.input.length > 0x20)) ? 1 : 0; + m_cass_data.input.length = 0; + m_uart->set_input_pin(AY31015_SI, m_cass_data.input.bit); + } + + /* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies. + Synchronisation of the frequency pulses to the uart is extremely important. */ + + m_cass_data.output.length++; + if (!(m_cass_data.output.length & 0x1f)) + { + cass_ws = m_uart->get_output_pin(AY31015_SO); + if (cass_ws != m_cass_data.output.bit) + { + m_cass_data.output.bit = cass_ws; + m_cass_data.output.length = 0; + } + } + + if (!(m_cass_data.output.length & 3)) + { + if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 4))) + { + m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit + cassette_device_image()->output(m_cass_data.output.level ? -1.0 : +1.0); + } + } + return; + + case 0x00: /* Cassette 1200 baud */ + /* loading a tape */ + m_cass_data.input.length++; + + cass_ws = ((cassette_device_image())->input() > +0.02) ? 1 : 0; + + if (cass_ws != m_cass_data.input.level || m_cass_data.input.length == 10) + { + m_cass_data.input.bit = ((m_cass_data.input.length < 10) || (m_cass_data.input.length > 0x20)) ? 1 : 0; + if ( cass_ws != m_cass_data.input.level ) + { + m_cass_data.input.length = 0; + m_cass_data.input.level = cass_ws; + } + m_uart->set_input_pin(AY31015_SI, m_cass_data.input.bit); + } + + /* saving a tape - convert the serial stream from the uart, into 600 and 1200 Hz frequencies. */ + + m_cass_data.output.length++; + if (!(m_cass_data.output.length & 7)) + { + cass_ws = m_uart->get_output_pin(AY31015_SO); + if (cass_ws != m_cass_data.output.bit) + { + m_cass_data.output.bit = cass_ws; + m_cass_data.output.length = 0; + } + } + + if (!(m_cass_data.output.length & 7)) + { + if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 8))) + { + m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit + cassette_device_image()->output(m_cass_data.output.level ? -1.0 : +1.0); + } + } + return; + } +} + +READ8_MEMBER( sol20_state::sol20_f8_r ) +{ +// d7 - TMBT; d6 - DAV; d5 - CTS; d4 - OE; d3 - PE; d2 - FE; d1 - DSR; d0 - CD + /* set unemulated bits (CTS/DSR/CD) high */ + UINT8 data = 0x23; + + m_uart_s->set_input_pin(AY31015_SWE, 0); + data |= m_uart_s->get_output_pin(AY31015_TBMT) ? 0x80 : 0; + data |= m_uart_s->get_output_pin(AY31015_DAV ) ? 0x40 : 0; + data |= m_uart_s->get_output_pin(AY31015_OR ) ? 0x10 : 0; + data |= m_uart_s->get_output_pin(AY31015_PE ) ? 0x08 : 0; + data |= m_uart_s->get_output_pin(AY31015_FE ) ? 0x04 : 0; + m_uart_s->set_input_pin(AY31015_SWE, 1); + + return data; +} + +READ8_MEMBER( sol20_state::sol20_f9_r) +{ + UINT8 data = m_uart_s->get_received_data(); + m_uart_s->set_input_pin(AY31015_RDAV, 0); + m_uart_s->set_input_pin(AY31015_RDAV, 1); + return data; +} + +READ8_MEMBER( sol20_state::sol20_fa_r ) +{ + /* set unused bits high */ + UINT8 data = 0x26; + + m_uart->set_input_pin(AY31015_SWE, 0); + data |= m_uart->get_output_pin(AY31015_TBMT) ? 0x80 : 0; + data |= m_uart->get_output_pin(AY31015_DAV ) ? 0x40 : 0; + data |= m_uart->get_output_pin(AY31015_OR ) ? 0x10 : 0; + data |= m_uart->get_output_pin(AY31015_FE ) ? 0x08 : 0; + m_uart->set_input_pin(AY31015_SWE, 1); + + bool arrowkey = m_iop_arrows->read() ? 0 : 1; + bool keydown = m_sol20_fa & 1; + + return data | (arrowkey & keydown); +} + +READ8_MEMBER( sol20_state::sol20_fb_r) +{ + UINT8 data = m_uart->get_received_data(); + m_uart->set_input_pin(AY31015_RDAV, 0); + m_uart->set_input_pin(AY31015_RDAV, 1); + return data; +} + +READ8_MEMBER( sol20_state::sol20_fc_r ) +{ + UINT8 data = m_iop_arrows->read(); + if (BIT(data, 0)) return 0x32; + if (BIT(data, 1)) return 0x34; + if (BIT(data, 2)) return 0x36; + if (BIT(data, 3)) return 0x38; + + m_sol20_fa |= 1; + return m_sol20_fc; +} + +READ8_MEMBER( sol20_state::sol20_fd_r ) +{ +// Return a byte from parallel interface + return 0; +} + +WRITE8_MEMBER( sol20_state::sol20_f8_w ) +{ +// The only function seems to be to send RTS from bit 4 +} + +WRITE8_MEMBER( sol20_state::sol20_f9_w ) +{ + m_uart_s->set_transmit_data(data); +} + +WRITE8_MEMBER( sol20_state::sol20_fa_w ) +{ + m_sol20_fa &= 1; + m_sol20_fa |= (data & 0xf0); + + /* cassette 1 motor */ + m_cass1->change_state( + (BIT(data,7)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + /* cassette 2 motor */ + m_cass2->change_state( + (BIT(data,6)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + if (data & 0xc0) + m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(19200)); + else + m_cassette_timer->adjust(attotime::zero); + + // bit 5 baud rate */ + m_uart->set_receiver_clock((BIT(data, 5)) ? 4800.0 : 19200.0); + m_uart->set_transmitter_clock((BIT(data, 5)) ? 4800.0 : 19200.0); +} + +WRITE8_MEMBER( sol20_state::sol20_fb_w ) +{ + m_uart->set_transmit_data(data); +} + +WRITE8_MEMBER( sol20_state::sol20_fd_w ) +{ +// Output a byte to parallel interface +} + +WRITE8_MEMBER( sol20_state::sol20_fe_w ) +{ + m_sol20_fe = data; +} + +static ADDRESS_MAP_START( sol20_mem, AS_PROGRAM, 8, sol20_state) + AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") + AM_RANGE(0X0800, 0Xbfff) AM_RAM // optional s100 ram + AM_RANGE(0xc000, 0xc7ff) AM_ROM + AM_RANGE(0Xc800, 0Xcbff) AM_RAM // system ram + AM_RANGE(0Xcc00, 0Xcfff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0Xd000, 0Xffff) AM_RAM // optional s100 ram +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sol20_io, AS_IO, 8, sol20_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf8, 0xf8) AM_READWRITE(sol20_f8_r,sol20_f8_w) + AM_RANGE(0xf9, 0xf9) AM_READWRITE(sol20_f9_r,sol20_f9_w) + AM_RANGE(0xfa, 0xfa) AM_READWRITE(sol20_fa_r,sol20_fa_w) + AM_RANGE(0xfb, 0xfb) AM_READWRITE(sol20_fb_r,sol20_fb_w) + AM_RANGE(0xfc, 0xfc) AM_READ(sol20_fc_r) + AM_RANGE(0xfd, 0xfd) AM_READWRITE(sol20_fd_r,sol20_fd_w) + AM_RANGE(0xfe, 0xfe) AM_WRITE(sol20_fe_w) + AM_RANGE(0xff, 0xff) AM_READ_PORT("S2") +/* AM_RANGE(0xf8, 0xf8) serial status in (bit 6=data av, bit 7=tmbe) + AM_RANGE(0xf9, 0xf9) serial data in, out + AM_RANGE(0xfa, 0xfa) general status in (bit 0=keyb data av, bit 1=parin data av, bit 2=parout ready) + AM_RANGE(0xfb, 0xfb) tape + AM_RANGE(0xfc, 0xfc) keyboard data in + AM_RANGE(0xfd, 0xfd) parallel data in, out + AM_RANGE(0xfe, 0xfe) scroll register + AM_RANGE(0xff, 0xff) sense switches */ +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sol20 ) + PORT_START("ARROWS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("S1") + PORT_DIPNAME( 0x04, 0x00, "Ctrl Chars") + PORT_DIPSETTING( 0x04, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x08, 0x00, "Polarity") + PORT_DIPSETTING( 0x00, DEF_STR( Normal )) + PORT_DIPSETTING( 0x08, "Inverse") + PORT_DIPNAME( 0x30, 0x10, "Cursor Type") + PORT_DIPSETTING( 0x10, "Blinking") + PORT_DIPSETTING( 0x20, "Solid") + PORT_DIPSETTING( 0x30, DEF_STR(None)) + + PORT_START("S2") // Sense Switches + PORT_DIPNAME( 0x01, 0x01, "FF bit 0") + PORT_DIPSETTING( 0x01, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x02, 0x02, "FF bit 1") + PORT_DIPSETTING( 0x02, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x04, 0x04, "FF bit 2") + PORT_DIPSETTING( 0x04, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x08, 0x08, "FF bit 3") + PORT_DIPSETTING( 0x08, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x10, 0x10, "FF bit 4") + PORT_DIPSETTING( 0x10, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x20, 0x20, "FF bit 5") + PORT_DIPSETTING( 0x20, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x40, 0x40, "FF bit 6") + PORT_DIPSETTING( 0x40, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x80, 0x80, "FF bit 7") + PORT_DIPSETTING( 0x80, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + + PORT_START("S3") + PORT_DIPNAME( 0xff, 0x08, "Baud Rate") + PORT_DIPSETTING( 0x01, "75") + PORT_DIPSETTING( 0x02, "110") + PORT_DIPSETTING( 0x04, "180") + PORT_DIPSETTING( 0x08, "300") + PORT_DIPSETTING( 0x10, "600") + PORT_DIPSETTING( 0x20, "1200") + PORT_DIPSETTING( 0x40, "2400") + PORT_DIPSETTING( 0x80, "4800/9600") + + PORT_START("S4") + PORT_DIPNAME( 0x11, 0x10, "Parity") + PORT_DIPSETTING( 0x00, "Even") + PORT_DIPSETTING( 0x01, "Odd") + PORT_DIPSETTING( 0x10, DEF_STR(None)) + PORT_DIPNAME( 0x06, 0x06, "Data Bits") + PORT_DIPSETTING( 0x00, "5") + PORT_DIPSETTING( 0x02, "6") + PORT_DIPSETTING( 0x04, "7") + PORT_DIPSETTING( 0x06, "8") + PORT_DIPNAME( 0x08, 0x08, "Stop Bits") + PORT_DIPSETTING( 0x00, "1") + PORT_DIPSETTING( 0x08, "2") + PORT_DIPNAME( 0x20, 0x00, "Duplex") + PORT_DIPSETTING( 0x00, "Half") + PORT_DIPSETTING( 0x20, "Full") + + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "High Baud Rate") // jumper on the board + PORT_CONFSETTING( 0x00, "4800") + PORT_CONFSETTING( 0x01, "9600") + PORT_CONFNAME( 0x02, 0x00, "Character Rom") + PORT_CONFSETTING( 0x00, "6574") + PORT_CONFSETTING( 0x02, "6575") +INPUT_PORTS_END + + +/* after the first 4 bytes have been read from ROM, switch the ram back in */ +TIMER_CALLBACK_MEMBER(sol20_state::sol20_boot) +{ + membank("boot")->set_entry(0); +} + +void sol20_state::machine_start() +{ + m_cassette_timer = timer_alloc(TIMER_SOL20_CASSETTE_TC); +} + +void sol20_state::machine_reset() +{ + UINT8 data = 0, s_count = 0; + int s_clock; + const UINT16 s_bauds[8]={ 75, 110, 180, 300, 600, 1200, 2400, 4800 }; + m_sol20_fe=0; + m_sol20_fa=1; + + // set hard-wired uart pins + m_uart->set_input_pin(AY31015_CS, 0); + m_uart->set_input_pin(AY31015_NB1, 1); + m_uart->set_input_pin(AY31015_NB2, 1); + m_uart->set_input_pin(AY31015_TSB, 1); + m_uart->set_input_pin(AY31015_EPS, 1); + m_uart->set_input_pin(AY31015_NP, 1); + m_uart->set_input_pin(AY31015_CS, 1); + + // set switched uart pins + data = m_iop_s4->read(); + m_uart_s->set_input_pin(AY31015_CS, 0); + m_uart_s->set_input_pin(AY31015_NB1, BIT(data, 1)); + m_uart_s->set_input_pin(AY31015_NB2, BIT(data, 2)); + m_uart_s->set_input_pin(AY31015_TSB, BIT(data, 3)); + m_uart_s->set_input_pin(AY31015_EPS, BIT(data, 0)); + m_uart_s->set_input_pin(AY31015_NP, BIT(data, 4)); + m_uart_s->set_input_pin(AY31015_CS, 1); + + // set rs232 baud rate + data = m_iop_s3->read(); + + if (data > 1) + do + { + s_count++; + data >>= 1; + } + while (!(data & 1) && (s_count < 7)); // find which switch is used + + if ( (s_count == 7) & BIT(m_iop_config->read(), 0) ) // if highest, look at jumper + s_clock = 9600 << 4; + else + s_clock = s_bauds[s_count] << 4; + + // these lines could be commented out for now if you want better performance + m_uart_s->set_receiver_clock(s_clock); + m_uart_s->set_transmitter_clock(s_clock); + + // boot-bank + membank("boot")->set_entry(1); + timer_set(attotime::from_usec(9), TIMER_SOL20_BOOT); +} + +DRIVER_INIT_MEMBER(sol20_state,sol20) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); +} + +void sol20_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +// Visible screen is 64 x 16, with start position controlled by scroll register. +// Each character is 9 pixels wide (blank ones at the right) and 13 lines deep. +// Note on blinking characters: +// any character with bit 7 set will blink. With DPMON, do DA C000 C2FF to see what happens + UINT16 which = (m_iop_config->read() & 2) << 10; + UINT8 s1 = m_iop_s1->read(); + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma,x,inv; + UINT8 polarity = (s1 & 8) ? 0xff : 0; + + bool cursor_inv = false; + if (((s1 & 0x30) == 0x20) || (((s1 & 0x30) == 0x10) && (m_framecnt & 0x08))) + cursor_inv = true; + + m_framecnt++; + + ma = m_sol20_fe << 6; // scroll register + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 13; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x++) + { + inv = polarity; + chr = m_p_videoram[x & 0x3ff]; + + // cursor + if (BIT(chr, 7) & cursor_inv) + inv ^= 0xff; + + chr &= 0x7f; + + if ((ra == 0) || ((s1 & 4) && (chr < 0x20))) + gfx = inv; + else + if ((chr==0x2C) || (chr==0x3B) || (chr==0x67) || (chr==0x6A) || (chr==0x70) || (chr==0x71) || (chr==0x79)) + { + if (ra < 4) + gfx = inv; + else + gfx = m_p_chargen[which | (chr<<4) | (ra-4) ] ^ inv; + } + else + { + if (ra < 10) + gfx = m_p_chargen[which | (chr<<4) | (ra-1) ] ^ inv; + else + gfx = inv; + } + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + *p++ = BIT(inv, 0); + } + } + ma+=64; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout sol20_charlayout = +{ + 7, 9, /* 7 x 9 characters */ + 128*2, /* 128 characters per rom */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( sol20 ) + GFXDECODE_ENTRY( "chargen", 0x0000, sol20_charlayout, 0, 1 ) +GFXDECODE_END + +WRITE8_MEMBER( sol20_state::kbd_put ) +{ + if (data) + { + m_sol20_fa &= 0xfe; + m_sol20_fc = data; + } +} + +static MACHINE_CONFIG_START( sol20, sol20_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_14_31818MHz/7) + MCFG_CPU_PROGRAM_MAP(sol20_mem) + MCFG_CPU_IO_MAP(sol20_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(sol20_state, screen_update) + MCFG_SCREEN_SIZE(576, 208) + MCFG_SCREEN_VISIBLE_AREA(0, 575, 0, 207) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", sol20) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // cass1 speaker + MCFG_SOUND_WAVE_ADD(WAVE2_TAG, "cassette2") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // cass2 speaker + + // devices + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(sol20_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("sol20_cass") + + MCFG_CASSETTE_ADD("cassette2") + MCFG_CASSETTE_FORMATS(sol20_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("sol20_cass") + + MCFG_DEVICE_ADD("uart", AY31015, 0) + MCFG_AY31015_TX_CLOCK(4800.0) + MCFG_AY31015_RX_CLOCK(4800.0) + MCFG_DEVICE_ADD("uart_s", AY31015, 0) + MCFG_AY31015_TX_CLOCK(4800.0) + MCFG_AY31015_RX_CLOCK(4800.0) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(sol20_state, kbd_put)) + + MCFG_SOFTWARE_LIST_ADD("cass_list", "sol20_cass") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sol20 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS(0, "solos", "SOLOS") + ROMX_LOAD( "solos.bin", 0xc000, 0x0800, CRC(4d0af383) SHA1(ac4510c3380ed4a31ccf4f538af3cb66b76701ef), ROM_BIOS(1) ) // from solace emu + ROM_SYSTEM_BIOS(1, "dpmon", "DPMON") + ROMX_LOAD( "dpmon.bin", 0xc000, 0x0800, BAD_DUMP CRC(2a84f099) SHA1(60ff6e38082c50afcf0f40707ef65668a411008b), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "consol", "CONSOL") + ROMX_LOAD( "consol.bin", 0xc000, 0x0400, BAD_DUMP CRC(80bf6d85) SHA1(84b81c60bb08a3a5435ec1be56a67aa695bce099), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "solos2", "Solos Patched") + ROMX_LOAD( "solos2.bin", 0xc000, 0x0800, CRC(7776cc7d) SHA1(c4739a9ea7e8146ce7ae3305ed526b6045efa9d6), ROM_BIOS(4) ) // from Nama + ROM_SYSTEM_BIOS(4, "bootload", "BOOTLOAD") + ROMX_LOAD( "bootload.bin", 0xc000, 0x0800, BAD_DUMP CRC(4261ac71) SHA1(4752408ac85d88857e8e9171c7f42bd623c9271e), ROM_BIOS(5) ) // from Nama +// This one doesn't work + ROM_SYSTEM_BIOS(5, "cuter", "CUTER") + ROMX_LOAD( "cuter.bin", 0xc000, 0x0800, BAD_DUMP CRC(39cca901) SHA1(33725d6da63e295552ee13f0a735d33aee8f0d17), ROM_BIOS(6) ) // from Nama + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "6574.bin", 0x0000, 0x0800, BAD_DUMP CRC(fd75df4f) SHA1(4d09aae2f933478532b7d3d1a2dee7123d9828ca) ) + ROM_LOAD( "6575.bin", 0x0800, 0x0800, BAD_DUMP CRC(cfdb76c2) SHA1(ab00798161d13f07bee3cf0e0070a2f0a805591f) ) +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1976, sol20, 0, 0, sol20, sol20, sol20_state, sol20, "Processor Technology Corporation", "SOL-20", 0 ) diff --git a/src/mame/drivers/pulsar.c b/src/mame/drivers/pulsar.c new file mode 100644 index 00000000000..b44cc9c8e6a --- /dev/null +++ b/src/mame/drivers/pulsar.c @@ -0,0 +1,263 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Pulsar Little Big Board + +2013-12-29 Skeleton driver. + +Chips: Z80A @4MHz, Z80DART, FD1797-02, 8255A-5, AY-5-8116, MSM5832. +Crystals: 4 MHz, 5.0688 MHz, 32768. + +This is a complete CP/M single-board computer. You needed to supply your own +power supply and serial terminal. + +The terminal must be set for 9600 baud, 7 bits, even parity, 1 stop bit. + + +ToDo: +- Need software + + +Monitor Commands: +B - Boot from disk +D - Dump memory +F - Fill memory +G - Go +I - In port +L - Load bootstrap from drive A to 0x80 +M - Modify memory +O - Out port +P - choose which rs232 channel for the console +T - Test memory +V - Move memory +X - Test off-board memory banks + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80dart.h" +#include "machine/msm5832.h" +#include "machine/i8255.h" +#include "machine/com8116.h" +#include "machine/wd_fdc.h" + + +class pulsar_state : public driver_device +{ +public: + pulsar_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dart(*this, "z80dart"), + m_brg(*this, "brg"), + m_fdc (*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_rtc(*this, "rtc") + { + } + + DECLARE_DRIVER_INIT(pulsar); + DECLARE_MACHINE_RESET(pulsar); + TIMER_CALLBACK_MEMBER(pulsar_reset); + DECLARE_WRITE8_MEMBER(baud_w); + DECLARE_WRITE_LINE_MEMBER(fr_w); + DECLARE_WRITE_LINE_MEMBER(ft_w); + DECLARE_WRITE8_MEMBER(ppi_pa_w); + DECLARE_WRITE8_MEMBER(ppi_pb_w); + DECLARE_WRITE8_MEMBER(ppi_pc_w); + DECLARE_READ8_MEMBER(ppi_pc_r); + +private: + floppy_image_device *m_floppy; + required_device m_maincpu; + required_device m_dart; + required_device m_brg; + required_device m_fdc; + required_device m_floppy0; + required_device m_rtc; +}; + +static ADDRESS_MAP_START(pulsar_mem, AS_PROGRAM, 8, pulsar_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x0800, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pulsar_io, AS_IO, 8, pulsar_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xc0, 0xc3) AM_MIRROR(0x0c) AM_DEVREADWRITE("z80dart", z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x0c) AM_DEVREADWRITE("fdc", fd1797_t, read, write) + AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("ppi", i8255_device, read, write) + AM_RANGE(0xf0, 0xff) AM_WRITE(baud_w) +ADDRESS_MAP_END + +// Schematic has the labels for FT and FR the wrong way around, +// the pin numbers are correct. +WRITE_LINE_MEMBER( pulsar_state::fr_w ) +{ + m_dart->rxca_w(state); + m_dart->txca_w(state); +} + +WRITE_LINE_MEMBER( pulsar_state::ft_w ) +{ + m_dart->rxcb_w(state); + m_dart->txcb_w(state); +} + +WRITE8_MEMBER( pulsar_state::baud_w ) +{ + m_brg->str_w(data & 0x0f); + m_brg->stt_w(data >> 4); +} + +/* after the first 4 bytes have been read from ROM, switch the ram back in */ +TIMER_CALLBACK_MEMBER( pulsar_state::pulsar_reset) +{ + membank("bankr0")->set_entry(1); +} + +static const z80_daisy_config daisy_chain_intf[] = +{ + { "z80dart" }, + { NULL } +}; + +/* +d0..d3 Drive select 0-3 (we only emulate 1 drive) +d4 Side select 0=side0 +d5 /DDEN +d6 /DSK_WAITEN (don't know what this is, not emulated) +d7 XMEMEX line (for external memory, not emulated) +*/ +WRITE8_MEMBER( pulsar_state::ppi_pa_w ) +{ + m_floppy = NULL; + if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); + m_fdc->set_floppy(m_floppy); + m_fdc->dden_w(BIT(data, 5)); +} + +/* +d0..d3 RTC address +d4 RTC read line (inverted in emulation) +d5 RTC write line (inverted in emulation) +d6 RTC hold line +d7 Allow 64k of ram +*/ +WRITE8_MEMBER( pulsar_state::ppi_pb_w ) +{ + m_rtc->address_w(data & 0x0f); + m_rtc->read_w(!BIT(data, 4)); + m_rtc->write_w(!BIT(data, 5)); + m_rtc->hold_w(BIT(data, 6)); + membank("bankr1")->set_entry(BIT(data, 7)); +} + +/* +d0..d3 Data lines to rtc +d7 /2 SIDES (assumed to be side select) +*/ +WRITE8_MEMBER( pulsar_state::ppi_pc_w ) +{ + m_rtc->data_w(space, 0, data & 15); + if (m_floppy) + m_floppy->ss_w(BIT(data, 7)); +} + +READ8_MEMBER( pulsar_state::ppi_pc_r ) +{ + return m_rtc->data_r(space, 0); +} + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +static SLOT_INTERFACE_START( pulsar_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +/* Input ports */ +static INPUT_PORTS_START( pulsar ) +INPUT_PORTS_END + +MACHINE_RESET_MEMBER( pulsar_state, pulsar ) +{ + machine().scheduler().timer_set(attotime::from_usec(3), timer_expired_delegate(FUNC(pulsar_state::pulsar_reset),this)); + membank("bankr0")->set_entry(0); // point at rom + membank("bankw0")->set_entry(0); // always write to ram + membank("bankr1")->set_entry(1); // point at rom + membank("bankw1")->set_entry(0); // always write to ram + m_rtc->cs_w(1); // always enabled +} + +DRIVER_INIT_MEMBER( pulsar_state, pulsar ) +{ + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(1, &main[0x0000]); + membank("bankr0")->configure_entry(0, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); + + membank("bankr1")->configure_entry(0, &main[0xf800]); + membank("bankr1")->configure_entry(1, &main[0x10000]); + membank("bankw1")->configure_entry(0, &main[0xf800]); +} + +static MACHINE_CONFIG_START( pulsar, pulsar_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(pulsar_mem) + MCFG_CPU_IO_MAP(pulsar_io) + MCFG_CPU_CONFIG(daisy_chain_intf) + MCFG_MACHINE_RESET_OVERRIDE(pulsar_state, pulsar) + + /* Devices */ + MCFG_DEVICE_ADD("ppi", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(pulsar_state, ppi_pa_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(pulsar_state, ppi_pb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(pulsar_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(pulsar_state, ppi_pc_w)) + + MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) + + MCFG_Z80DART_ADD("z80dart", XTAL_4MHz, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80dart", z80dart_device, rxa_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("z80dart", z80dart_device, ctsa_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(pulsar_state, fr_w)) + MCFG_COM8116_FT_HANDLER(WRITELINE(pulsar_state, ft_w)) + + MCFG_FD1797_ADD("fdc", XTAL_4MHz / 2) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "525dd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pulsarlb ) + ROM_REGION( 0x10800, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mp7a.bin", 0x10000, 0x800, CRC(726b8a19) SHA1(43b2af84d5622c1f67584c501b730acf002a6113) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, pulsarlb, 0, 0, pulsar, pulsar, pulsar_state, pulsar, "Pulsar", "Little Big Board", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/pv1000.c b/src/mame/drivers/pv1000.c new file mode 100644 index 00000000000..7ba26775c81 --- /dev/null +++ b/src/mame/drivers/pv1000.c @@ -0,0 +1,482 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + Driver for Casio PV-1000 + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +// PV-1000 Sound device + +class pv1000_sound_device : public device_t, + public device_sound_interface +{ +public: + pv1000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE8_MEMBER(voice_w); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + + // internal state + struct + { + UINT32 count; + UINT16 period; + UINT8 val; + } m_voice[4]; + + sound_stream *m_sh_channel; +}; + +extern const device_type PV1000; + +const device_type PV1000 = &device_creator; + +pv1000_sound_device::pv1000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PV1000, "NEC D65010G031", tag, owner, clock, "pv1000_sound", __FILE__), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pv1000_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pv1000_sound_device::device_start() +{ + m_sh_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 1024); + + save_item(NAME(m_voice[0].count)); + save_item(NAME(m_voice[0].period)); + save_item(NAME(m_voice[0].val)); + save_item(NAME(m_voice[1].count)); + save_item(NAME(m_voice[1].period)); + save_item(NAME(m_voice[1].val)); + save_item(NAME(m_voice[2].count)); + save_item(NAME(m_voice[2].period)); + save_item(NAME(m_voice[2].val)); + // are these ever used? + save_item(NAME(m_voice[3].count)); + save_item(NAME(m_voice[3].period)); + save_item(NAME(m_voice[3].val)); +} + +WRITE8_MEMBER(pv1000_sound_device::voice_w) +{ + offset &= 0x03; + m_voice[offset].period = data; +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + + +/* + plgDavid's audio implementation/analysis notes: + + Sound appears to be 3 50/50 pulse voices made by cutting the main clock by 1024, + then by the value of the 6bit period registers. + This creates a surprisingly accurate pitch range. + + Note: the register periods are inverted. + */ + +void pv1000_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + stream_sample_t *buffer = outputs[0]; + + while (samples > 0) + { + *buffer=0; + + for (int i = 0; i < 3; i++) + { + UINT32 per = (0x3f - (m_voice[i].period & 0x3f)); + + if (per != 0) //OFF! + *buffer += m_voice[i].val * 8192; + + m_voice[i].count++; + + if (m_voice[i].count >= per) + { + m_voice[i].count = 0; + m_voice[i].val = !m_voice[i].val; + } + } + + buffer++; + samples--; + } +} + + +// PV-1000 System + + +class pv1000_state : public driver_device +{ +public: + pv1000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_sound(*this, "pv1000_sound"), + m_cart(*this, "cartslot"), + m_p_videoram(*this, "p_videoram"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette") + { } + + DECLARE_WRITE8_MEMBER(io_w); + DECLARE_READ8_MEMBER(io_r); + DECLARE_WRITE8_MEMBER(gfxram_w); + UINT8 m_io_regs[8]; + UINT8 m_fd_data; + + emu_timer *m_irq_on_timer; + emu_timer *m_irq_off_timer; + UINT8 m_pcg_bank; + UINT8 m_force_pattern; + UINT8 m_fd_buffer_flag; + UINT8 m_border_col; + + UINT8 * m_gfxram; + void pv1000_postload(); + + required_device m_maincpu; + required_device m_sound; + required_device m_cart; + required_shared_ptr m_p_videoram; + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update_pv1000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(d65010_irq_on_cb); + TIMER_CALLBACK_MEMBER(d65010_irq_off_cb); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( pv1000_cart ); + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; +}; + + +static ADDRESS_MAP_START( pv1000, AS_PROGRAM, 8, pv1000_state ) + //AM_RANGE(0x0000, 0x7fff) // mapped by the cartslot + AM_RANGE(0xb800, 0xbbff) AM_RAM AM_SHARE("p_videoram") + AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(gfxram_w) AM_REGION("gfxram", 0) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( pv1000_io, AS_IO, 8, pv1000_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf8, 0xff) AM_READWRITE(io_r, io_w) +ADDRESS_MAP_END + + +WRITE8_MEMBER( pv1000_state::gfxram_w ) +{ + UINT8 *gfxram = memregion( "gfxram" )->base(); + + gfxram[ offset ] = data; + m_gfxdecode->gfx(1)->mark_dirty(offset/32); +} + + +WRITE8_MEMBER( pv1000_state::io_w ) +{ + switch (offset) + { + case 0x00: + case 0x01: + case 0x02: + //logerror("io_w offset=%02x, data=%02x (%03d)\n", offset, data , data); + m_sound->voice_w(space, offset, data); + break; + + case 0x03: + //currently unknown use + break; + + case 0x05: + m_fd_data = 0xf; + break; +// case 0x06 VRAM + PCG location, always fixed at 0xb8xx + case 0x07: + /* ---- -xxx unknown, border color? */ + m_pcg_bank = (data & 0x20) >> 5; + m_force_pattern = ((data & 0x10) >> 4); /* Dig Dug relies on this */ + m_border_col = data & 7; + break; + } + + m_io_regs[offset] = data; +} + + +READ8_MEMBER( pv1000_state::io_r ) +{ + UINT8 data = m_io_regs[offset]; + +// logerror("io_r offset=%02x\n", offset ); + + switch ( offset ) + { + case 0x04: + /* Bit 1 = 1 => Data is available in port FD */ + /* Bit 0 = 1 => Buffer at port FD is empty */ + data = 0; + data = m_fd_buffer_flag & 1; + data |= m_fd_data ? 2 : 0; + m_fd_buffer_flag &= ~1; + break; + case 0x05: + static const char *const joynames[] = { "IN0", "IN1", "IN2", "IN3" }; + + data = 0; + + for (int i = 0; i < 4; i++) + { + if (m_io_regs[5] & 1 << i) + { + data |= ioport(joynames[i])->read(); + m_fd_data &= ~(1 << i); + } + } + + //m_fd_data = 0; + break; + } + + return data; +} + + +static INPUT_PORTS_START( pv1000 ) + PORT_START( "IN0" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(2) + + PORT_START( "IN1" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + + PORT_START( "IN2" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY + + PORT_START( "IN3" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) +INPUT_PORTS_END + + +DEVICE_IMAGE_LOAD_MEMBER( pv1000_state, pv1000_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size != 0x2000 && size != 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + +UINT32 pv1000_state::screen_update_pv1000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y; + + bitmap.fill(m_border_col); // TODO: might be either black or colored by this register + + for ( y = 0; y < 24; y++ ) + { + for ( x = 2; x < 30; x++ ) // left-right most columns are definitely masked by the border color + { + UINT16 tile = m_p_videoram[ y * 32 + x ]; + + if ( tile < 0xe0 || m_force_pattern ) + { + tile += ( m_pcg_bank << 8); + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*8 ); + } + else + { + tile -= 0xe0; + m_gfxdecode->gfx(1)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*8 ); + } + } + } + + return 0; +} + + + +/* Interrupt is triggering 16 times during vblank. */ +/* we have chosen to trigger on scanlines 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255 */ +TIMER_CALLBACK_MEMBER(pv1000_state::d65010_irq_on_cb) +{ + int vpos = m_screen->vpos(); + int next_vpos = vpos + 4; + + if(vpos == 195) + m_fd_buffer_flag |= 1; /* TODO: exact timing of this */ + + /* Set IRQ line and schedule release of IRQ line */ + m_maincpu->set_input_line(0, ASSERT_LINE ); + m_irq_off_timer->adjust( m_screen->time_until_pos(vpos, 380/2 ) ); + + /* Schedule next IRQ trigger */ + if ( vpos >= 255 ) + { + next_vpos = 195; + } + m_irq_on_timer->adjust( m_screen->time_until_pos(next_vpos, 0 ) ); +} + + +TIMER_CALLBACK_MEMBER(pv1000_state::d65010_irq_off_cb) +{ + m_maincpu->set_input_line(0, CLEAR_LINE ); +} + + +void pv1000_state::pv1000_postload() +{ + // restore GFX ram + for (int i = 0; i < 0x400; i++) + gfxram_w(m_maincpu->space(AS_PROGRAM), i, m_gfxram[i]); +} + +void pv1000_state::machine_start() +{ + m_irq_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_on_cb),this)); + m_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_off_cb),this)); + + m_gfxram = memregion("gfxram")->base(); + save_pointer(NAME(m_gfxram), 0x400); + + if (m_cart->exists()) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x7fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + // FIXME: this is needed for gfx decoding, but there is probably a cleaner solution! + std::string region_tag; + memcpy(memregion("gfxrom")->base(), memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(), m_cart->get_rom_size()); + } + + save_item(NAME(m_io_regs)); + save_item(NAME(m_fd_data)); + save_item(NAME(m_pcg_bank)); + save_item(NAME(m_force_pattern)); + save_item(NAME(m_fd_buffer_flag)); + save_item(NAME(m_border_col)); + + machine().save().register_postload(save_prepost_delegate(FUNC(pv1000_state::pv1000_postload), this)); +} + + +void pv1000_state::machine_reset() +{ + m_io_regs[5] = 0; + m_fd_data = 0; + m_irq_on_timer->adjust(m_screen->time_until_pos(195, 0)); + m_irq_off_timer->adjust(attotime::never); +} + + +static const gfx_layout pv1000_3bpp_gfx = +{ + 8, 8, /* 8x8 characters */ + RGN_FRAC(1,1), + 3, + { 0, 8*8, 16*8 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8*4 +}; + + +static GFXDECODE_START( pv1000 ) + GFXDECODE_ENTRY( "gfxrom", 8, pv1000_3bpp_gfx, 0, 8 ) + GFXDECODE_ENTRY( "gfxram", 8, pv1000_3bpp_gfx, 0, 8 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( pv1000, pv1000_state ) + + MCFG_CPU_ADD( "maincpu", Z80, 17897725/5 ) + MCFG_CPU_PROGRAM_MAP( pv1000 ) + MCFG_CPU_IO_MAP( pv1000_io ) + + + /* D65010G031 - Video & sound chip */ + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_RAW_PARAMS( 17897725/3, 380, 0, 256, 262, 0, 192 ) + MCFG_SCREEN_UPDATE_DRIVER(pv1000_state, screen_update_pv1000) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_3BIT_BGR("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pv1000 ) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD( "pv1000_sound", PV1000, 17897725 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + /* Cartridge slot */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "pv1000_cart") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(pv1000_state, pv1000_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","pv1000") +MACHINE_CONFIG_END + + +ROM_START( pv1000 ) + ROM_REGION( 0x4000, "gfxrom", ROMREGION_ERASE00 ) + ROM_REGION( 0x400, "gfxram", ROMREGION_ERASE00 ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1983, pv1000, 0, 0, pv1000, pv1000, driver_device, 0, "Casio", "PV-1000", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pv2000.c b/src/mame/drivers/pv2000.c new file mode 100644 index 00000000000..a0084f36143 --- /dev/null +++ b/src/mame/drivers/pv2000.c @@ -0,0 +1,428 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/* + +CASIO PV-2000 + +(preliminary work by anondumper) +Thanks for the loaner (Ianoid) + +NOTE: +The PCB has printed names of components, not ICXY, etc +but: "hn613128pc64.bin" + +SEE +http://hou4gong1.mo-blog.jp/.shared/image.html?/photos/uncategorized/pv_2000_k1.jpg +http://hou4gong1.mo-blog.jp/.shared/image.html?/photos/uncategorized/pv_2000_14.jpg +http://hou4gong1.mo-blog.jp/.shared/image.html?/photos/uncategorized/pv_2000_15.jpg + +Keyboard inputs are partially supported. Keys missing from the input ports: +- GAME - no beep in basic - is this really a key? + +Todo: +- Add joystick support +- Cassette support + +Also See: +http://www2.odn.ne.jp/~haf09260/Pv2000/EnrPV.htm +For BIOS CRC confirmation +*/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/sn76496.h" +#include "sound/wave.h" +#include "video/tms9928a.h" +#include "imagedev/cassette.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class pv2000_state : public driver_device +{ +public: + pv2000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cass(*this, "cassette"), + m_cart(*this, "cartslot"), + m_last_state(0) + { } + + required_device m_maincpu; + required_device m_cass; + required_device m_cart; + DECLARE_WRITE8_MEMBER(cass_conf_w); + DECLARE_WRITE8_MEMBER(keys_w); + DECLARE_READ8_MEMBER(keys_hi_r); + DECLARE_READ8_MEMBER(keys_lo_r); + DECLARE_READ8_MEMBER(keys_mod_r); + DECLARE_WRITE_LINE_MEMBER(pv2000_vdp_interrupt); + DECLARE_READ8_MEMBER(cass_in); + DECLARE_WRITE8_MEMBER(cass_out); + bool m_last_state; + UINT8 m_key_pressed; + UINT8 m_keyb_column; + UINT8 m_cass_conf; + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pv2000_cart); +}; + + +WRITE8_MEMBER( pv2000_state::cass_conf_w ) +{ + logerror( "%s: cass_conf_w %02x\n", machine().describe_context(), data ); + + m_cass_conf = data & 0x0f; + + if ( m_cass_conf & 0x01 ) + m_cass->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + else + m_cass->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); +} + + +WRITE8_MEMBER( pv2000_state::keys_w ) +{ + logerror( "%s: keys_w %02x\n", machine().describe_context(), data ); + + m_keyb_column = data & 0x0f; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); +} + + +READ8_MEMBER( pv2000_state::keys_hi_r ) +{ + UINT8 data = 0; + char kbdrow[6]; + + switch ( m_keyb_column ) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + sprintf(kbdrow,"IN%d",m_keyb_column); + data = ioport( kbdrow )->read() >> 4; + } + + return data; +} + + +READ8_MEMBER( pv2000_state::keys_lo_r ) +{ + UINT8 data = 0; + char kbdrow[6]; + + logerror("%s: pv2000_keys_r\n", machine().describe_context() ); + + switch ( m_keyb_column ) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + sprintf(kbdrow,"IN%d",m_keyb_column); + data = ioport( kbdrow )->read() & 0x0f; + } + + return 0xf0 | data; +} + + +READ8_MEMBER( pv2000_state::keys_mod_r ) +{ + return 0xf0 | ioport( "MOD" )->read(); +} + +READ8_MEMBER( pv2000_state::cass_in ) +{ + // from what i can tell, + // 0 = data in + // 1 = must be high + // 2 = must be low + // bits 1 & 2 are checked while reading and writing tapes + // Press STOP key (F1) to cancel LOAD or SAVE + + return 2 | ((m_cass->input() > +0.03) ? 1 : 0); +} + +WRITE8_MEMBER( pv2000_state::cass_out ) +{ + // it outputs 8-bit values here which are not the bytes in the file + // result is not readable + + m_cass->output( BIT(data, 0) ? -1.0 : +1.0); +} + + +/* Memory Maps */ + +static ADDRESS_MAP_START( pv2000_map, AS_PROGRAM, 8, pv2000_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM + + AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) + AM_RANGE(0x4001, 0x4001) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) + + AM_RANGE(0x7000, 0x7fff) AM_RAM + //AM_RANGE(0x8000, 0xbfff) ext ram? + //AM_RANGE(0xc000, 0xffff) // mapped by the cartslot +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( pv2000_io_map, AS_IO, 8, pv2000_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + + //theres also printer and tape I/O (TODO) + AM_RANGE(0x00, 0x00) AM_WRITE(cass_conf_w) + + //keyboard/joystick + AM_RANGE(0x10, 0x10) AM_READ(keys_hi_r) + AM_RANGE(0x20, 0x20) AM_READWRITE(keys_lo_r, keys_w) + + //sn76489a + AM_RANGE(0x40, 0x40) AM_READ(keys_mod_r) AM_DEVWRITE("sn76489a", sn76489a_device, write) + + /* Cassette input. Gets hit a lot after a GLOAD command */ + AM_RANGE(0x60, 0x60) AM_READWRITE(cass_in,cass_out) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( pv2000 ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + + PORT_START("IN2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + + PORT_START("IN3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Hiragana") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + + PORT_START("IN4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Yen") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN4_1") /* Game?? DEL / MODE / STOP ??, no beep in basic, START in galaga */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN4_2") /* DEL / MODE / STOP ??, no beep in basic, SELECT in galaga */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_START("IN5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CRSR Up+Left") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CRSR Down+Left") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CRSR Down+Right") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CRSR Up+Right") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + + PORT_START("IN6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN6_2") /* Unknown ??, no beep in basic */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN6_3") /* Unknown ??, no beep in basic */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + + PORT_START("IN7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN7_2") /* Unknown ??, no beep in basic */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN7_3") /* Unknown ??, no beep in basic */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("IN8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_NAME("Attack 0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_NAME("Attack 1") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN8_2") /* Unknown ?, no beep in basic */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN8_3") /* Unknown ?, no beep in basic */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mode") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN8_7") /* Unknown ?, no beep in basic */ + + PORT_START("IN9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("Stop") + + PORT_START("MOD") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_NAME("Color") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_NAME("Func") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + +INPUT_PORTS_END + + +WRITE_LINE_MEMBER( pv2000_state::pv2000_vdp_interrupt ) +{ + // only if it goes up + if (state && !m_last_state) + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + + m_last_state = state; + + /* Check if irq triggering from keyboard presses is enabled */ + if ( m_keyb_column == 0x0f ) + { + /* Check if a key is pressed */ + UINT8 key_pressed; + + key_pressed = ioport( "IN0" )->read() + | ioport( "IN1" )->read() + | ioport( "IN2" )->read() + | ioport( "IN3" )->read() + | ioport( "IN4" )->read() + | ioport( "IN5" )->read() + | ioport( "IN6" )->read() + | ioport( "IN7" )->read() + | ioport( "IN8" )->read(); + + if ( key_pressed && m_key_pressed != key_pressed ) + m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + + m_key_pressed = key_pressed; + } +} + + + +/* Machine Initialization */ + +void pv2000_state::machine_start() +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +void pv2000_state::machine_reset() +{ + m_last_state = 0; + m_key_pressed = 0; + m_keyb_column = 0; + + m_maincpu->set_input_line_vector(INPUT_LINE_IRQ0, 0xff); + memset(&memregion("maincpu")->base()[0x7000], 0xff, 0x1000); // initialize RAM +} + +DEVICE_IMAGE_LOAD_MEMBER( pv2000_state, pv2000_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size != 0x2000 && size != 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +/* Machine Drivers */ +static MACHINE_CONFIG_START( pv2000, pv2000_state ) + + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, XTAL_7_15909MHz/2) // 3.579545 MHz + MCFG_CPU_PROGRAM_MAP(pv2000_map) + MCFG_CPU_IO_MAP(pv2000_io_map) + + // video hardware + MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(pv2000_state, pv2000_vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("sn76489a", SN76489A, XTAL_7_15909MHz/2) /* 3.579545 MHz */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pv2000_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom,col") + MCFG_GENERIC_LOAD(pv2000_state, pv2000_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","pv2000") +MACHINE_CONFIG_END + + + +/* ROMs */ +ROM_START (pv2000) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "hn613128pc64.bin", 0x0000, 0x4000, CRC(8f31f297) SHA1(94b5f54dd7bce321e377fdaaf592acd3870cf621) ) +ROM_END + + +/* System Drivers */ + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +CONS( 1983, pv2000, 0, 0, pv2000, pv2000, driver_device, 0, "Casio", "PV-2000", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pv9234.c b/src/mame/drivers/pv9234.c new file mode 100644 index 00000000000..339492d7874 --- /dev/null +++ b/src/mame/drivers/pv9234.c @@ -0,0 +1,170 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + +PowerVu D9234 STB (c) 1997 Scientific Atlanta + +20-mar-2010 skeleton driver + +http://www.vetrun.net/forums/showthread.php?t=395 +http://colibri.net63.net/powervu.htm +http://www.growl.de/d9234/ + +Google 'powervu 9234' for plenty more info. + +Meant for payTV providers to decrypt signals from the satellite and pump +them out on a local cable network. The powervu encryption is very secure. + +There is a menu system, and with the right equipment, many secrets can +be found! + +****************************************************************************/ + +#include "emu.h" +#include "cpu/arm7/arm7.h" + + +class pv9234_state : public driver_device +{ +public: + pv9234_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_ram(*this, "p_ram"), + m_maincpu(*this, "maincpu") { } + + DECLARE_WRITE32_MEMBER(debug_w); + DECLARE_WRITE32_MEMBER(debug1_w); + DECLARE_WRITE32_MEMBER(debug2_w); + required_shared_ptr m_p_ram; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_pv9234(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +/* +This is the serial output to a terminal, used for debugging. +The boot process goes something like this: + +Start + +Config: 0x00001080 (Max Config: 00003C80) +MV 00000004.00000003 +DL Avail +IOP Com. O.K. 00000004 +Check CRC ... +CRC O.K. +Launch App +************** +* Ver 2.05 * +************** +Compiled by: FURLANO +Date & time: Nov 3 1997, 15:34:29 +All printing enabled. Press space bar to toggle on/off. +Time stamping enabled. Press 't' to turn on/off. +Press 'o' to toggle printing of MPEG Xport error messages. +*/ +WRITE32_MEMBER( pv9234_state::debug_w ) +{ + if (data) + { + printf("%02x %c\n",data,data); // this prints 'Start' to the console. + logerror("debug=%02x %c\n",data,data); + } +} + +WRITE32_MEMBER( pv9234_state::debug1_w ) +{ + UINT8 i,j; + if (data) + { + for (i = 0; i < 4; i++) + { + j = (data & 0xff000000) >> 24; + data <<= 8; +// printf("%c",j); // this prints 'OFF' to the console. + logerror("debug1=%02x %c\n",j,j); + } +// printf("\n"); + } +} + +WRITE32_MEMBER( pv9234_state::debug2_w ) +{ + if (data) + logerror("debug2=%02x\n",data); // ignore the huge amount of zeroes here +} + +static ADDRESS_MAP_START(pv9234_map, AS_PROGRAM, 32, pv9234_state) + // AM_RANGE(0x00000000, 0x00000033) AM_WRITE something + // AM_RANGE(0x00000044, 0x00000047) AM_WRITE something + // AM_RANGE(0x00000060, 0x0000006b) AM_WRITE something + // AM_RANGE(0x00007000, 0x00007003) AM_WRITE something + // AM_RANGE(0x00008000, 0x00008003) AM_WRITE something + AM_RANGE(0x00008014, 0x00008017) AM_WRITE(debug1_w) + // AM_RANGE(0x00008020, 0x00008027) AM_WRITE something + AM_RANGE(0x000080c0, 0x000080c3) AM_WRITE(debug2_w) + AM_RANGE(0x000080cc, 0x000080cf) AM_WRITE(debug_w) + // AM_RANGE(0x000080d0, 0x000080d3) AM_WRITE something + AM_RANGE(0x0003e000, 0x0003efff) AM_RAM AM_SHARE("p_ram") + AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_REGION("maincpu",0) //FLASH ROM! + AM_RANGE(0x00080000, 0x00087fff) AM_MIRROR(0x78000) AM_RAM AM_SHARE("share1")//mirror is a guess, writes a prg at 0xc0200 then it jumps at b0200 (!) + AM_RANGE(0xe0000000, 0xe0007fff) AM_MIRROR(0x0fff8000) AM_RAM AM_SHARE("share1") + AM_RANGE(0xffffff00, 0xffffffff) AM_RAM //i/o? stack ram? +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( pv9234 ) +INPUT_PORTS_END + + +void pv9234_state::machine_reset() +{ + int i; + + for(i=0;i<0x1000/4;i++) + m_p_ram[i] = 0; +} + +void pv9234_state::video_start() +{ +} + +UINT32 pv9234_state::screen_update_pv9234(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( pv9234, pv9234_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", ARM7, 4915000) //probably a more powerful clone. + MCFG_CPU_PROGRAM_MAP(pv9234_map) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(pv9234_state, screen_update_pv9234) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pv9234 ) + ROM_REGION32_LE( 0x80000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD16_BYTE( "u19.bin", 0x00000, 0x20000, CRC(1e06b0c8) SHA1(f8047f7127919e73675375578bb9fcc0eed2178e)) + ROM_LOAD16_BYTE( "u18.bin", 0x00001, 0x20000, CRC(924487dd) SHA1(fb1d7c9a813ded8c820589fa85ae72265a0427c7)) + ROM_LOAD16_BYTE( "u17.bin", 0x40000, 0x20000, CRC(cac03650) SHA1(edd8aec6fed886d47de39ed4e127de0a93250a45)) + ROM_LOAD16_BYTE( "u16.bin", 0x40001, 0x20000, CRC(bd07d545) SHA1(90a63af4ee82b0f7d0ed5f0e09569377f22dd98c)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +SYST( 1997, pv9234, 0, 0, pv9234, pv9234, driver_device, 0, "Scientific Atlanta", "PowerVu D9234", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/pve500.c b/src/mame/drivers/pve500.c new file mode 100644 index 00000000000..9bc202d51e1 --- /dev/null +++ b/src/mame/drivers/pve500.c @@ -0,0 +1,441 @@ +// license:GPL-2.0+ +// copyright-holders: Felipe Sanches +/*************************************************************************** + + SONY PVE-500 Editing Control Unit + "A/B roll edit controller for professional video editing applications" + + Driver by Felipe Correa da Silva Sanches + Technical info at https://www.garoa.net.br/wiki/PVE-500 + + Notes: + One can induce the self-diagnose by booting the device holding LEARN and P2-RESET buttons togheter + With the default keyboard map, this can be done by holding keys L and S while pressing F3. + (Don't forget to unlock the keyboard by using the UI TOGGLE key) + + This self-diagnose routine displays the value C817, which is the checksum value of the subcpu ROM + and afterwards it displays the following message: + + SELFdIAG Error___ _F3 F3_CtC3c + + which means it detected an error in the CTC circuitry (it means we're emulating it wrong!) + F3 is the coordinate of the subcpu EPROM chip in the PCB. + + According to the service manual, this error code means: "ICF3 CTC CH-3 counter operation failure (No interruption)" + + Known issues: + There's still an annoying blinking in the 7-seg display. + + Changelog: + + 2014 SEP 01 [Felipe Sanches]: + * hooked-up MB8421 device (dual-port SRAM) + + 2014 JUN 24 [Felipe Sanches]: + * figured out the multiplexing signals for the 7-seg display + + 2014 JUN 23 [Felipe Sanches]: + * hooked-up the RS422 ports + + 2014 JAN 14 [Felipe Sanches]: + * Initial driver skeleton +*/ + +#define LOG_7SEG_DISPLAY_SIGNALS 0 +#define DEBUGGING_INDUCE_SELFDIAGNOSE 0 + +#include "emu.h" +#include "cpu/z80/tmpz84c015.h" +#include "cpu/mb88xx/mb88xx.h" +#include "sound/beep.h" +#include "bus/rs232/rs232.h" /* actually meant to be RS422 ports */ +#include "pve500.lh" +#include "machine/mb8421.h" +#include "machine/eepromser.h" + +#define IO_EXPANDER_PORTA 0 +#define IO_EXPANDER_PORTB 1 +#define IO_EXPANDER_PORTC 2 +#define IO_EXPANDER_PORTD 3 +#define IO_EXPANDER_PORTE 4 + +class pve500_state : public driver_device +{ +public: + pve500_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "subcpu") + , m_eeprom(*this, "eeprom") + , m_buzzer(*this, "buzzer") + { } + + DECLARE_WRITE_LINE_MEMBER(mb8421_intl); + DECLARE_WRITE_LINE_MEMBER(mb8421_intr); + DECLARE_WRITE_LINE_MEMBER(GPI_w); + DECLARE_WRITE_LINE_MEMBER(external_monitor_w); + + DECLARE_WRITE8_MEMBER(io_expander_w); + DECLARE_READ8_MEMBER(io_expander_r); + DECLARE_WRITE8_MEMBER(eeprom_w); + DECLARE_READ8_MEMBER(eeprom_r); + DECLARE_DRIVER_INIT(pve500); +private: + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_subcpu; + required_device m_eeprom; + required_device m_buzzer; + UINT8 io_SEL, io_LD, io_LE, io_SC, io_KY; +}; + +WRITE_LINE_MEMBER( pve500_state::GPI_w ) +{ + /* TODO: Implement-me */ +} + +WRITE_LINE_MEMBER( pve500_state::external_monitor_w ) +{ + /* TODO: Implement-me */ +} + +static const z80_daisy_config maincpu_daisy_chain[] = +{ + TMPZ84C015_DAISY_INTERNAL, + { "external_ctc" }, + { "external_sio" }, + { NULL } +}; + + +static ADDRESS_MAP_START(maincpu_io, AS_IO, 8, pve500_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("external_sio", z80sio0_device, cd_ba_r, cd_ba_w) + AM_RANGE(0x08, 0x0B) AM_DEVREADWRITE("external_ctc", z80ctc_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(maincpu_prg, AS_PROGRAM, 8, pve500_state) + AM_RANGE (0x0000, 0xBFFF) AM_ROM // ICB7: 48kbytes EPROM + AM_RANGE (0xC000, 0xDFFF) AM_RAM // ICD6: 8kbytes of RAM + AM_RANGE (0xE000, 0xE7FF) AM_MIRROR(0x1800) AM_DEVREADWRITE("mb8421", mb8421_device, left_r, left_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(subcpu_io, AS_IO, 8, pve500_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(subcpu_prg, AS_PROGRAM, 8, pve500_state) + AM_RANGE (0x0000, 0x7FFF) AM_ROM // ICG5: 32kbytes EPROM + AM_RANGE (0x8000, 0xBFFF) AM_MIRROR(0x3FF8) AM_READWRITE(io_expander_r, io_expander_w) // ICG3: I/O Expander + AM_RANGE (0xC000, 0xC7FF) AM_MIRROR(0x3800) AM_DEVREADWRITE("mb8421", mb8421_device, right_r, right_w) +ADDRESS_MAP_END + +DRIVER_INIT_MEMBER( pve500_state, pve500 ) +{ +} + +static INPUT_PORTS_START( pve500 ) + PORT_START("SCAN0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRANS") PORT_CODE(KEYCODE_5) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A/B") PORT_CODE(KEYCODE_4) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FROM TO") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) + + PORT_START("SCAN1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALL STOP") PORT_CODE(KEYCODE_M) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LAST EDIT") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AUDIO SPLIT") PORT_CODE(KEYCODE_T) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A2") PORT_CODE(KEYCODE_9) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ASMBL") PORT_CODE(KEYCODE_6) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_7) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_8) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) + + PORT_START("SCAN2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RVW/JUMP") PORT_CODE(KEYCODE_N) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AUTO EDIT") PORT_CODE(KEYCODE_B) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PREVIEW") PORT_CODE(KEYCODE_V) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-FF") PORT_CODE(KEYCODE_R) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-REW") PORT_CODE(KEYCODE_E) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-STILL") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-PLAY") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) + + PORT_START("SCAN3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-OUT") PORT_CODE(KEYCODE_K) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-IN") PORT_CODE(KEYCODE_J) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GO TO") PORT_CODE(KEYCODE_H) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-OUT") PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-IN") PORT_CODE(KEYCODE_F) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRIM+") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRIM-") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) + + PORT_START("SCAN4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-FF") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-REW") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-STILL") PORT_CODE(KEYCODE_P) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-PLAY") PORT_CODE(KEYCODE_O) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EDIT") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REC") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) + + PORT_START("SCAN5") + PORT_DIPNAME( 0x03, 0x02, "R-EDIT REF" ) + PORT_DIPSETTING( 0x02, "TC" ) + PORT_DIPSETTING( 0x00, "RTC" ) + PORT_DIPSETTING( 0x01, "CTL" ) + + PORT_DIPNAME( 0x0C, 0x08, "P2-EDIT REF" ) + PORT_DIPSETTING( 0x08, "TC" ) + PORT_DIPSETTING( 0x00, "RTC" ) + PORT_DIPSETTING( 0x04, "CTL" ) + + PORT_DIPNAME( 0x30, 0x20, "P1-EDIT REF" ) + PORT_DIPSETTING( 0x20, "TC" ) + PORT_DIPSETTING( 0x00, "RTC" ) + PORT_DIPSETTING( 0x10, "CTL" ) + + PORT_START("SCAN6") + PORT_DIPNAME( 0x03, 0x02, "SYNCHRO" ) + PORT_DIPSETTING( 0x02, "ON/CF" ) + PORT_DIPSETTING( 0x00, "ON" ) + PORT_DIPSETTING( 0x01, "OFF" ) + + PORT_DIPNAME( 0x0C, 0x08, "PREROLL" ) + PORT_DIPSETTING( 0x08, "7" ) + PORT_DIPSETTING( 0x00, "5" ) + PORT_DIPSETTING( 0x04, "3" ) + + PORT_START("SCAN7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TOTAL") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEARN") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRANS-1F") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRANS-10F") PORT_CODE(KEYCODE_X) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRANS-100F") PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-RESET") PORT_CODE(KEYCODE_A) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P2-RESET") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1-RESET") PORT_CODE(KEYCODE_D) +INPUT_PORTS_END + +void pve500_state::machine_start() +{ + io_LD = 0; + io_SC = 0; + io_LE = 0; + io_SEL = 0; + io_KY = 0; +} + +void pve500_state::machine_reset() +{ + /* Setup beep */ + m_buzzer->set_state(0); + m_buzzer->set_frequency(3750); //CLK2 coming out of IC D4 (frequency divider circuitry) +} + +WRITE_LINE_MEMBER(pve500_state::mb8421_intl) +{ + // shared ram interrupt request from subcpu side + m_maincpu->trg1(state); +} + +WRITE_LINE_MEMBER(pve500_state::mb8421_intr) +{ + // shared ram interrupt request from maincpu side + m_subcpu->trg1(state); +} + +READ8_MEMBER(pve500_state::eeprom_r) +{ + return (m_eeprom->ready_read() << 1) | m_eeprom->do_read(); +} + +WRITE8_MEMBER(pve500_state::eeprom_w) +{ + m_eeprom->di_write( (data & (1 << 2)) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->clk_write( (data & (1 << 3)) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->cs_write( (data & (1 << 4)) ? ASSERT_LINE : CLEAR_LINE); +} + +READ8_MEMBER(pve500_state::io_expander_r) +{ +// printf("READ IO_EXPANDER_PORT%c\n", 'A'+offset); + switch (offset){ + case IO_EXPANDER_PORTA: + return io_SC; + case IO_EXPANDER_PORTB: + return io_LE; + case IO_EXPANDER_PORTC: + io_KY = 0x00; + if (!BIT(io_SC, 0)) io_KY |= ioport("SCAN0")->read(); + if (!BIT(io_SC, 1)) io_KY |= ioport("SCAN1")->read(); + if (!BIT(io_SC, 2)) io_KY |= ioport("SCAN2")->read(); + if (!BIT(io_SC, 3)) io_KY |= ioport("SCAN3")->read(); + if (!BIT(io_SC, 4)) io_KY |= ioport("SCAN4")->read(); + if (!BIT(io_SC, 5)) io_KY |= ioport("SCAN5")->read(); + if (!BIT(io_SC, 6)) io_KY |= ioport("SCAN6")->read(); + if (!BIT(io_SC, 7)) io_KY |= ioport("SCAN7")->read(); +#if DEBUGGING_INDUCE_SELFDIAGNOSE + io_KY = 0x42; //according to procedure described in the service manual +#endif + return io_KY; + case IO_EXPANDER_PORTD: + return io_LD; + case IO_EXPANDER_PORTE: + return io_SEL & 0x0F; //This is a 4bit port. + default: + return 0; + } +} + +WRITE8_MEMBER(pve500_state::io_expander_w) +{ + static int LD_data[4]; + int swap[4] = {2,1,0,3}; + switch (offset){ + case IO_EXPANDER_PORTA: +#if LOG_7SEG_DISPLAY_SIGNALS +printf("io_expander_w: PORTA (io_SC=%02X)\n", data); +#endif + io_SC = data; + + for (int j=0; j<8; j++){ + if (!BIT(io_SC,j)){ + for (int i=0; i<4; i++) + output_set_digit_value(8*swap[i] + j, LD_data[i]); + } + } + break; + case IO_EXPANDER_PORTB: +#if LOG_7SEG_DISPLAY_SIGNALS + printf("io_expander_w: PORTB (io_LE=%02X)\n", data); +#endif + io_LE = data; + break; + case IO_EXPANDER_PORTC: +#if LOG_7SEG_DISPLAY_SIGNALS + printf("io_expander_w: PORTC (io_KY=%02X)\n", data); +#endif + io_KY = data; + break; + case IO_EXPANDER_PORTD: +#if LOG_7SEG_DISPLAY_SIGNALS + printf("io_expander_w: PORTD (io_LD=%02X)\n", data); +#endif + io_LD = data; + break; + case IO_EXPANDER_PORTE: +#if LOG_7SEG_DISPLAY_SIGNALS + printf("io_expander_w PORTE (io_SEL=%02X)\n", data); +#endif + io_SEL = data; + for (int i=0; i<4; i++){ + if (BIT(io_SEL, i)){ + LD_data[i] = 0x7F & BITSWAP8(io_LD ^ 0xFF, 7, 0, 1, 2, 3, 4, 5, 6); + } + } + break; + default: + break; + } +} + +static MACHINE_CONFIG_START( pve500, pve500_state ) + /* Main CPU */ + MCFG_CPU_ADD("maincpu", TMPZ84C015, XTAL_12MHz / 2) /* TMPZ84C015BF-6 */ + MCFG_CPU_PROGRAM_MAP(maincpu_prg) + MCFG_CPU_IO_MAP(maincpu_io) + MCFG_CPU_CONFIG(maincpu_daisy_chain) + MCFG_TMPZ84C015_OUT_DTRA_CB(WRITELINE(pve500_state, GPI_w)) + MCFG_TMPZ84C015_OUT_DTRB_CB(DEVWRITELINE("buzzer", beep_device, set_state)) + MCFG_TMPZ84C015_OUT_TXDA_CB(DEVWRITELINE("recorder", rs232_port_device, write_txd)) + MCFG_TMPZ84C015_OUT_TXDB_CB(DEVWRITELINE("player1", rs232_port_device, write_txd)) + + MCFG_DEVICE_ADD("external_ctc", Z80CTC, XTAL_12MHz / 2) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_Z80SIO0_ADD("external_sio", XTAL_12MHz / 2, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("player2", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("edl_inout", rs232_port_device, write_txd)) + + /* Secondary CPU */ + MCFG_CPU_ADD("subcpu", TMPZ84C015, XTAL_12MHz / 2) /* TMPZ84C015BF-6 */ + MCFG_CPU_PROGRAM_MAP(subcpu_prg) + MCFG_CPU_IO_MAP(subcpu_io) + MCFG_TMPZ84C015_OUT_DTRB_CB(WRITELINE(pve500_state, external_monitor_w)) + MCFG_TMPZ84C015_OUT_TXDA_CB(DEVWRITELINE("switcher", rs232_port_device, write_txd)) + MCFG_TMPZ84C015_OUT_TXDB_CB(DEVWRITELINE("serial_mixer", rs232_port_device, write_txd)) + + // PIO callbacks + MCFG_TMPZ84C015_IN_PA_CB(READ8(pve500_state, eeprom_r)) + MCFG_TMPZ84C015_OUT_PA_CB(WRITE8(pve500_state, eeprom_w)) + + /* Search Dial MCUs */ + MCFG_CPU_ADD("dial_mcu_left", MB88201, XTAL_4MHz) /* PLAYER DIAL MCU */ + MCFG_CPU_ADD("dial_mcu_right", MB88201, XTAL_4MHz) /* RECORDER DIAL MCU */ + + /* Serial EEPROM (128 bytes, 8-bit data organization) */ + /* The EEPROM stores the setup data */ + MCFG_EEPROM_SERIAL_MSM16911_8BIT_ADD("eeprom") + + /* FIX-ME: These are actually RS422 ports (except EDL IN/OUT which is indeed an RS232 port)*/ + MCFG_RS232_PORT_ADD("recorder", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("maincpu", tmpz84c015_device, rxa_w)) + + MCFG_RS232_PORT_ADD("player1", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("maincpu", tmpz84c015_device, rxb_w)) + + MCFG_RS232_PORT_ADD("player2", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("external_sio", z80dart_device, rxa_w)) + + MCFG_RS232_PORT_ADD("edl_inout", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("external_sio", z80dart_device, rxb_w)) + + MCFG_RS232_PORT_ADD("switcher", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("subcpu", tmpz84c015_device, rxa_w)) + + MCFG_RS232_PORT_ADD("serial_mixer", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("subcpu", tmpz84c015_device, rxb_w)) + + /* ICF5: 2kbytes of RAM shared between the two CPUs (dual-port RAM)*/ + MCFG_DEVICE_ADD("mb8421", MB8421, 0) + MCFG_MB8421_INTL_HANDLER(WRITELINE(pve500_state, mb8421_intl)) + MCFG_MB8421_INTR_HANDLER(WRITELINE(pve500_state, mb8421_intr)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_pve500) + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("buzzer", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05) + +MACHINE_CONFIG_END + +ROM_START( pve500 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("pve500.icb7", 0x00000, 0x10000, CRC(1036709c) SHA1(207d6fcad5c2f081a138184060ce7bd02736965b) ) //48kbyte main-cpu program + 16kbyte of unreachable memory + + ROM_REGION( 0x8000, "subcpu", 0 ) + ROM_LOAD("pve500.icg5", 0x00000, 0x8000, CRC(28cca60a) SHA1(308d70062653769250327ede7a4e1a8a76fc9ab9) ) //32kbyte sub-cpu program + + ROM_REGION( 0x200, "dial_mcu_left", 0 ) /* PLAYER DIAL MCU */ + ROM_LOAD( "pve500.icd3", 0x0000, 0x0200, NO_DUMP ) + + ROM_REGION( 0x200, "dial_mcu_right", 0 ) /* RECORDER DIAL MCU */ + ROM_LOAD( "pve500.icc3", 0x0000, 0x0200, NO_DUMP ) + + ROM_REGION( 0x80, "eeprom", 0 ) /* The EEPROM stores the setup data */ + ROM_LOAD( "pve500.ice3", 0x0000, 0x080, NO_DUMP ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1995, pve500, 0, 0, pve500, pve500, pve500_state, pve500, "SONY", "PVE-500", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS) diff --git a/src/mame/drivers/px4.c b/src/mame/drivers/px4.c new file mode 100644 index 00000000000..7a07a87e46a --- /dev/null +++ b/src/mame/drivers/px4.c @@ -0,0 +1,1590 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Epson PX-4 + + Note: We are missing a dump of the slave 7508 CPU that controls + the keyboard and some other things. + +***************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "bus/epson_sio/epson_sio.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "sound/speaker.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "coreutil.h" +#include "px4.lh" + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define VERBOSE 1 + + +//************************************************************************** +// MACROS +//************************************************************************** + +#define ART_TX_ENABLED (BIT(m_artcr, 0)) +#define ART_RX_ENABLED (BIT(m_artcr, 2)) +#define ART_BREAK (BIT(m_artcr, 3)) + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class px4_state : public driver_device, public device_serial_interface +{ +public: + px4_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + device_serial_interface(mconfig, *this), + m_z80(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_nvram(*this, "nvram"), + m_centronics(*this, "centronics"), + m_ext_cas(*this, "extcas"), + m_ext_cas_timer(*this, "extcas_timer"), + m_speaker(*this, "speaker"), + m_sio(*this, "sio"), + m_rs232(*this, "rs232"), + m_caps1(*this, "capsule1"), m_caps2(*this, "capsule2"), + m_caps1_rom(NULL), m_caps2_rom(NULL), + m_ctrl1(0), m_icrb(0), m_bankr(0), + m_isr(0), m_ier(0), m_str(0), m_sior(0xbf), + m_frc_value(0), m_frc_latch(0), + m_vadr(0), m_yoff(0), + m_receive_timer(NULL), m_transmit_timer(NULL), + m_artdir(0xff), m_artdor(0xff), m_artsr(0), m_artcr(0), + m_swr(0), + m_one_sec_int_enabled(true), m_alarm_int_enabled(true), m_key_int_enabled(true), + m_key_status(0), m_interrupt_status(0), + m_time(), m_clock_state(0), + m_ear_last_state(0), + m_sio_pin(0), m_serial_rx(0), m_rs232_dcd(0), m_rs232_cts(0), + m_centronics_busy(0), m_centronics_perror(0) + { } + + DECLARE_DRIVER_INIT( px4 ); + + DECLARE_PALETTE_INIT( px4 ); + UINT32 screen_update_px4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( icrlc_r ); + DECLARE_WRITE8_MEMBER( ctrl1_w ); + DECLARE_READ8_MEMBER( icrhc_r ); + DECLARE_WRITE8_MEMBER( cmdr_w ); + DECLARE_READ8_MEMBER( icrlb_r ); + DECLARE_WRITE8_MEMBER( ctrl2_w ); + DECLARE_READ8_MEMBER( icrhb_r ); + DECLARE_READ8_MEMBER( isr_r ); + DECLARE_WRITE8_MEMBER( ier_w ); + DECLARE_READ8_MEMBER( str_r ); + DECLARE_WRITE8_MEMBER( bankr_w ); + DECLARE_READ8_MEMBER( sior_r ); + DECLARE_WRITE8_MEMBER( sior_w ); + DECLARE_WRITE8_MEMBER( vadr_w ); + DECLARE_WRITE8_MEMBER( yoff_w ); + DECLARE_WRITE8_MEMBER( fr_w ); + DECLARE_WRITE8_MEMBER( spur_w ); + DECLARE_READ8_MEMBER( ctgif_r ); + DECLARE_WRITE8_MEMBER( ctgif_w ); + DECLARE_READ8_MEMBER( artdir_r ); + DECLARE_WRITE8_MEMBER( artdor_w ); + DECLARE_READ8_MEMBER( artsr_r ); + DECLARE_WRITE8_MEMBER( artmr_w ); + DECLARE_READ8_MEMBER( iostr_r ); + DECLARE_WRITE8_MEMBER( artcr_w ); + DECLARE_WRITE8_MEMBER( swr_w ); + DECLARE_WRITE8_MEMBER( ioctlr_w ); + + DECLARE_INPUT_CHANGED_MEMBER( key_callback ); + + TIMER_DEVICE_CALLBACK_MEMBER( ext_cassette_read ); + TIMER_DEVICE_CALLBACK_MEMBER( frc_tick ); + TIMER_DEVICE_CALLBACK_MEMBER( upd7508_1sec_callback ); + + // serial + DECLARE_WRITE_LINE_MEMBER( sio_rx_w ); + DECLARE_WRITE_LINE_MEMBER( sio_pin_w ); + DECLARE_WRITE_LINE_MEMBER( rs232_rx_w ); + DECLARE_WRITE_LINE_MEMBER( rs232_dcd_w ); + DECLARE_WRITE_LINE_MEMBER( rs232_dsr_w ); + DECLARE_WRITE_LINE_MEMBER( rs232_cts_w ); + TIMER_CALLBACK_MEMBER( transmit_data ); + TIMER_CALLBACK_MEMBER( receive_data ); + + // centronics + DECLARE_WRITE_LINE_MEMBER( centronics_busy_w ) { m_centronics_busy = state; } + DECLARE_WRITE_LINE_MEMBER( centronics_perror_w ) { m_centronics_perror = state; } + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + // device_serial_interface overrides + virtual void tra_callback(); + virtual void tra_complete(); + virtual void rcv_callback(); + virtual void rcv_complete(); + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + // z80 interrupt sources + enum + { + INT0_7508 = 0x01, + INT1_ART = 0x02, + INT2_ICF = 0x04, + INT3_OVF = 0x08, + INT4_EXT = 0x10 + }; + + // 7508 interrupt sources + enum + { + UPD7508_INT_ALARM = 0x02, + UPD7508_INT_POWER_FAIL = 0x04, + UPD7508_INT_7508_RESET = 0x08, + UPD7508_INT_Z80_RESET = 0x10, + UPD7508_INT_ONE_SECOND = 0x20 + }; + + // art (asynchronous receiver transmitter) + enum + { + ART_TXRDY = 0x01, // output buffer empty + ART_RXRDY = 0x02, // data byte received + ART_TXEMPTY = 0x04, // transmit buffer empty + ART_PE = 0x08, // parity error + ART_OE = 0x10, // overrun error + ART_FE = 0x20 // framing error + }; + + void gapnit_interrupt(); + + DECLARE_WRITE_LINE_MEMBER( serial_rx_w ); + void txd_w(int data); + + void install_rom_capsule(address_space &space, int size, memory_region *mem); + + // internal devices + required_device m_z80; + required_device m_ram; + required_device m_nvram; + required_device m_centronics; + required_device m_ext_cas; + required_device m_ext_cas_timer; + required_device m_speaker; + required_device m_sio; + required_device m_rs232; + required_device m_caps1; + required_device m_caps2; + + memory_region *m_caps1_rom; + memory_region *m_caps2_rom; + + // gapnit register + UINT8 m_ctrl1; + UINT16 m_icrb; + UINT8 m_bankr; + UINT8 m_isr; + UINT8 m_ier; + UINT8 m_str; + UINT8 m_sior; + + // gapnit internal + UINT16 m_frc_value; + UINT16 m_frc_latch; + + // gapndi register + UINT8 m_vadr; + UINT8 m_yoff; + + // gapnio + emu_timer *m_receive_timer; + emu_timer *m_transmit_timer; + UINT8 m_artdir; + UINT8 m_artdor; + UINT8 m_artsr; + UINT8 m_artcr; + UINT8 m_swr; + + // 7508 internal + bool m_one_sec_int_enabled; + bool m_alarm_int_enabled; + bool m_key_int_enabled; + + UINT8 m_key_status; + UINT8 m_interrupt_status; + + system_time m_time; + int m_clock_state; + + // external cassette/barcode reader + int m_ear_last_state; + + // serial + int m_sio_pin; + int m_serial_rx; + int m_rs232_dcd; + int m_rs232_cts; + + // centronics + int m_centronics_busy; + int m_centronics_perror; +}; + +class px4p_state : public px4_state +{ +public: + px4p_state(const machine_config &mconfig, device_type type, const char *tag) : + px4_state(mconfig, type, tag), + m_rdnvram(*this, "rdnvram"), + m_rdsocket(*this, "ramdisk_socket"), + m_ramdisk_address(0), + m_ramdisk(NULL) + { } + + DECLARE_DRIVER_INIT( px4p ); + + DECLARE_PALETTE_INIT( px4p ); + + DECLARE_WRITE8_MEMBER( ramdisk_address_w ); + DECLARE_READ8_MEMBER( ramdisk_data_r ); + DECLARE_WRITE8_MEMBER( ramdisk_data_w ); + DECLARE_READ8_MEMBER( ramdisk_control_r ); + +protected: + // driver_device overrides + virtual void machine_start(); + +private: + required_device m_rdnvram; + required_device m_rdsocket; + + offs_t m_ramdisk_address; + UINT8 *m_ramdisk; +}; + + +//************************************************************************** +// GAPNIT +//************************************************************************** + +// process interrupts +void px4_state::gapnit_interrupt() +{ + // any interrupts enabled and pending? + if (m_ier & m_isr & INT0_7508) + { + m_isr &= ~INT0_7508; + m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf0); + } + else if (m_ier & m_isr & INT1_ART) + m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf2); + else if (m_ier & m_isr & INT2_ICF) + m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf4); + else if (m_ier & m_isr & INT3_OVF) + m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf6); + else if (m_ier & m_isr & INT4_EXT) + m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf8); + else + m_z80->set_input_line(0, CLEAR_LINE); +} + +// external cassette or barcode reader input +TIMER_DEVICE_CALLBACK_MEMBER( px4_state::ext_cassette_read ) +{ + UINT8 result; + int trigger = 0; + + // sample input state + result = (m_ext_cas->input() > 0) ? 1 : 0; + + // detect transition + switch ((m_ctrl1 >> 1) & 0x03) + { + case 0: // trigger inhibit + trigger = 0; + break; + case 1: // falling edge trigger + trigger = m_ear_last_state == 1 && result == 0; + break; + case 2: // rising edge trigger + trigger = m_ear_last_state == 0 && result == 1; + break; + case 3: // rising/falling edge trigger + trigger = m_ear_last_state != result; + break; + } + + // generate an interrupt if we need to trigger + if (trigger) + { + m_icrb = m_frc_value; + m_isr |= INT2_ICF; + gapnit_interrupt(); + } + + // save last state + m_ear_last_state = result; +} + +// free running counter +TIMER_DEVICE_CALLBACK_MEMBER( px4_state::frc_tick ) +{ + m_frc_value++; + + if (m_frc_value == 0) + { + m_isr |= INT3_OVF; + gapnit_interrupt(); + } +} + +// input capture register low command trigger +READ8_MEMBER( px4_state::icrlc_r ) +{ + if (VERBOSE) + logerror("%s: icrlc_r\n", machine().describe_context()); + + // latch value + m_frc_latch = m_frc_value; + + return m_frc_latch & 0xff; +} + +// control register 1 +WRITE8_MEMBER( px4_state::ctrl1_w ) +{ + const int rcv_rates[] = { 110, 150, 300, 600, 1200, 2400, 4800, 9600, 75, 1200, 19200, 38400, 200 }; + const int tra_rates[] = { 110, 150, 300, 600, 1200, 2400, 4800, 9600, 1200, 75, 19200, 38400, 200 }; + + if (VERBOSE) + logerror("%s: ctrl1_w (0x%02x)\n", machine().describe_context(), data); + + // baudrate generator + int baud = data >> 4; + + if (baud <= 12) + { + if (VERBOSE) + logerror("rcv baud = %d, tra baud = %d\n", rcv_rates[baud], tra_rates[baud]); + + set_rcv_rate(rcv_rates[baud]); + set_tra_rate(tra_rates[baud]); + } + + m_ctrl1 = data; +} + +// input capture register high command trigger +READ8_MEMBER( px4_state::icrhc_r ) +{ + if (VERBOSE) + logerror("%s: icrhc_r\n", machine().describe_context()); + + return (m_frc_latch >> 8) & 0xff; +} + +// command register +WRITE8_MEMBER( px4_state::cmdr_w ) +{ + if (0) + logerror("%s: cmdr_w (0x%02x)\n", machine().describe_context(), data); + + // clear overflow interrupt? + if (BIT(data, 2)) + { + m_isr &= ~INT3_OVF; + gapnit_interrupt(); + } +} + +// input capture register low barcode trigger +READ8_MEMBER( px4_state::icrlb_r ) +{ + if (VERBOSE) + logerror("%s: icrlb_r\n", machine().describe_context()); + + return m_icrb & 0xff; +} + +// control register 2 +WRITE8_MEMBER( px4_state::ctrl2_w ) +{ + if (VERBOSE) + logerror("%s: ctrl2_w (0x%02x)\n", machine().describe_context(), data); + + // bit 0, MIC, cassette output + m_ext_cas->output( BIT(data, 0) ? -1.0 : +1.0); + + // bit 1, RMT, cassette motor + if (BIT(data, 1)) + { + m_ext_cas->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_ext_cas_timer->adjust(attotime::zero, 0, attotime::from_hz(44100)); + } + else + { + m_ext_cas->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_ext_cas_timer->adjust(attotime::zero); + } +} + +// input capture register high barcode trigger +READ8_MEMBER( px4_state::icrhb_r ) +{ + if (VERBOSE) + logerror("%s: icrhb_r\n", machine().describe_context()); + + // clear icf interrupt + m_isr &= ~INT2_ICF; + gapnit_interrupt(); + + return (m_icrb >> 8) & 0xff; +} + +// interrupt status register +READ8_MEMBER( px4_state::isr_r ) +{ + if (VERBOSE) + logerror("%s: isr_r\n", machine().describe_context()); + + return m_isr; +} + +// interrupt enable register +WRITE8_MEMBER( px4_state::ier_w ) +{ + if (0) + logerror("%s: ier_w (0x%02x)\n", machine().describe_context(), data); + + m_ier = data; + gapnit_interrupt(); +} + +// status register +READ8_MEMBER( px4_state::str_r ) +{ + UINT8 data = 0; + + if (0) + logerror("%s: str_r\n", machine().describe_context()); + + data |= (m_ext_cas)->input() > 0 ? 1 : 0; + data |= 1 << 1; // BCRD, barcode reader input + data |= 1 << 2; // RDY signal from 7805 + data |= 1 << 3; // RDYSIO, enable access to the 7805 + data |= m_bankr & 0xf0; // bit 4-7, BANK - memory bank + + return data; +} + +// helper function to map rom capsules +void px4_state::install_rom_capsule(address_space &space, int size, memory_region *mem) +{ + // ram, part 1 + space.install_ram(0x0000, 0xdfff - size, 0, 0, m_ram->pointer()); + + // actual rom data, part 1 + if (mem) + space.install_rom(0xe000 - size, 0xffff, 0, 0, mem->base() + (size - 0x2000)); + + // rom data, part 2 + if (mem && size != 0x2000) + space.install_rom(0x10000 - size, 0xdfff, 0, 0, mem->base()); + + // ram, continued + space.install_ram(0xe000, 0xffff, 0, 0, m_ram->pointer() + 0xe000); +} + +// bank register +WRITE8_MEMBER( px4_state::bankr_w ) +{ + address_space &space_program = m_z80->space(AS_PROGRAM); + + if (0) + logerror("%s: bankr_w (0x%02x)\n", machine().describe_context(), data); + + m_bankr = data; + + // bank switch + switch (data >> 4) + { + case 0x00: + // system bank + space_program.install_rom(0x0000, 0x7fff, 0, 0, memregion("os")->base()); + space_program.install_ram(0x8000, 0xffff, 0, 0, m_ram->pointer() + 0x8000); + break; + + case 0x04: + // memory + space_program.install_ram(0x0000, 0xffff, 0, 0, m_ram->pointer()); + break; + + case 0x08: install_rom_capsule(space_program, 0x2000, m_caps1_rom); break; + case 0x09: install_rom_capsule(space_program, 0x4000, m_caps1_rom); break; + case 0x0a: install_rom_capsule(space_program, 0x8000, m_caps1_rom); break; + case 0x0c: install_rom_capsule(space_program, 0x2000, m_caps2_rom); break; + case 0x0d: install_rom_capsule(space_program, 0x4000, m_caps2_rom); break; + case 0x0e: install_rom_capsule(space_program, 0x8000, m_caps2_rom); break; + + default: + if (VERBOSE) + logerror("invalid bank switch value: 0x%02x\n", data >> 4); + break; + } +} + +// serial io register +READ8_MEMBER( px4_state::sior_r ) +{ + if (0) + logerror("%s: sior_r 0x%02x\n", machine().describe_context(), m_sior); + + // reading clock? + if (m_clock_state > 0) + { + switch (m_clock_state++) + { + case 1: m_sior = (dec_2_bcd(m_time.local_time.year) >> 4) & 0xf; break; + case 2: m_sior = dec_2_bcd(m_time.local_time.year) & 0xf; break; + case 3: m_sior = dec_2_bcd(m_time.local_time.month + 1); break; + case 4: m_sior = dec_2_bcd(m_time.local_time.mday); break; + case 5: m_sior = dec_2_bcd(m_time.local_time.hour); break; + case 6: m_sior = dec_2_bcd(m_time.local_time.minute); break; + case 7: m_sior = dec_2_bcd(m_time.local_time.second); break; + case 8: m_sior = dec_2_bcd(m_time.local_time.weekday); break; + } + + // done? + if (m_clock_state == 9) + m_clock_state = 0; + } + + return m_sior; +} + +// serial io register +WRITE8_MEMBER( px4_state::sior_w ) +{ + if (0) + logerror("%s: sior_w (0x%02x)\n", machine().describe_context(), data); + + // writing clock? + if (m_clock_state > 0) + { + time_t time = m_time.time; + struct tm *t = localtime(&time); + + switch (m_clock_state++) + { + case 1: + { + int year = dec_2_bcd(m_time.local_time.year); + year = (year & 0xff0f) | ((data & 0xf) << 4); + t->tm_year = bcd_2_dec(year) - 1900; + } + break; + case 2: + { + int year = dec_2_bcd(m_time.local_time.year); + year = (year & 0xfff0) | (data & 0xf); + t->tm_year = bcd_2_dec(year) - 1900; + } + break; + case 3: t->tm_mon = bcd_2_dec(data & 0x7f) - 1; break; + case 4: t->tm_mday = bcd_2_dec(data & 0x7f); break; + case 5: t->tm_hour = bcd_2_dec(data & 0x7f); break; + case 6: t->tm_min = bcd_2_dec(data & 0x7f); break; + case 7: t->tm_sec = bcd_2_dec(data & 0x7f); break; + case 8: t->tm_wday = bcd_2_dec(data & 0x7f); break; + } + + // update + m_time.set(mktime(t)); + + // done? + if (m_clock_state == 9) + m_clock_state = 0; + } + else + { + m_sior = data; + + switch (data) + { + case 0x01: + if (VERBOSE) + logerror("7508 cmd: Power OFF\n"); + + break; + + case 0x02: + if (VERBOSE) + logerror("7508 cmd: Read Status\n"); + + if (m_interrupt_status != 0) + { + if (VERBOSE) + logerror("> 7508 has interrupts pending: 0x%02x\n", m_interrupt_status); + + // signal the interrupt(s) + m_sior = 0xc1 | m_interrupt_status; + m_interrupt_status = 0x00; + } + else if (m_key_status != 0xff) + { + m_sior = m_key_status; + m_key_status = 0xff; + } + else + { + // nothing happened + m_sior = 0xbf; + } + + break; + + case 0x03: if (VERBOSE) logerror("7508 cmd: KB Reset\n"); break; + case 0x04: if (VERBOSE) logerror("7508 cmd: KB Repeat Timer 1 Set\n"); break; + case 0x14: if (VERBOSE) logerror("7508 cmd: KB Repeat Timer 2 Set\n"); break; + case 0x24: if (VERBOSE) logerror("7508 cmd: KB Repeat Timer 1 Read\n"); break; + case 0x34: if (VERBOSE) logerror("7508 cmd: KB Repeat Timer 2 Read\n"); break; + case 0x05: if (VERBOSE) logerror("7508 cmd: KB Repeat OFF\n"); break; + case 0x15: if (VERBOSE) logerror("7508 cmd: KB Repeat ON\n"); break; + + case 0x06: + if (VERBOSE) + logerror("7508 cmd: KB Interrupt OFF\n"); + + m_key_int_enabled = false; + break; + + case 0x16: + if (VERBOSE) + logerror("7508 cmd: KB Interrupt ON\n"); + + m_key_int_enabled = true; + break; + + case 0x07: + if (VERBOSE) + logerror("7508 cmd: Clock Read\n"); + + m_clock_state = 1; + break; + + case 0x17: + if (VERBOSE) + logerror("7508 cmd: Clock Write\n"); + + m_clock_state = 1; + break; + + case 0x08: + if (VERBOSE) + logerror("7508 cmd: Power Switch Read\n"); + + // indicate that the power switch is in the "ON" position + m_sior = 0x01; + break; + + case 0x09: if (VERBOSE) logerror("7508 cmd: Alarm Read\n"); break; + case 0x19: if (VERBOSE) logerror("7508 cmd: Alarm Set\n"); break; + case 0x29: if (VERBOSE) logerror("7508 cmd: Alarm OFF\n"); break; + case 0x39: if (VERBOSE) logerror("7508 cmd: Alarm ON\n"); break; + + case 0x0a: + if (VERBOSE) + logerror("7508 cmd: DIP Switch Read\n"); + m_sior = ioport("dips")->read(); + break; + + case 0x0b: if (VERBOSE) logerror("7508 cmd: Stop Key Interrupt disable\n"); break; + case 0x1b: if (VERBOSE) logerror("7508 cmd: Stop Key Interrupt enable\n"); break; + case 0x0c: if (VERBOSE) logerror("7508 cmd: 7 chr. Buffer\n"); break; + case 0x1c: if (VERBOSE) logerror("7508 cmd: 1 chr. Buffer\n"); break; + + case 0x0d: + if (VERBOSE) + logerror("7508 cmd: 1 sec. Interrupt OFF\n"); + + m_one_sec_int_enabled = false; + break; + + case 0x1d: + if (VERBOSE) + logerror("7508 cmd: 1 sec. Interrupt ON\n"); + + m_one_sec_int_enabled = true; + break; + + case 0x0e: + if (VERBOSE) + logerror("7508 cmd: KB Clear\n"); + + m_sior = 0xbf; + break; + + case 0x0f: if (VERBOSE) logerror("7508 cmd: System Reset\n"); break; + } + } +} + + +//************************************************************************** +// GAPNDL +//************************************************************************** + +// vram start address register +WRITE8_MEMBER( px4_state::vadr_w ) +{ + if (VERBOSE) + logerror("%s: vadr_w (0x%02x)\n", machine().describe_context(), data); + + m_vadr = data; +} + +// y offset register +WRITE8_MEMBER( px4_state::yoff_w ) +{ + if (VERBOSE) + logerror("%s: yoff_w (0x%02x)\n", machine().describe_context(), data); + + m_yoff = data; +} + +// frame register +WRITE8_MEMBER( px4_state::fr_w ) +{ + if (VERBOSE) + logerror("%s: fr_w (0x%02x)\n", machine().describe_context(), data); +} + +// speed-up register +WRITE8_MEMBER( px4_state::spur_w ) +{ + if (VERBOSE) + logerror("%s: spur_w (0x%02x)\n", machine().describe_context(), data); +} + + +//************************************************************************** +// GAPNIO +//************************************************************************** + +WRITE_LINE_MEMBER( px4_state::serial_rx_w ) +{ + m_serial_rx = state; + device_serial_interface::rx_w(state); +} + +WRITE_LINE_MEMBER( px4_state::sio_rx_w ) +{ + if (!BIT(m_swr, 3) && BIT(m_swr, 2)) + serial_rx_w(state); +} + +WRITE_LINE_MEMBER( px4_state::sio_pin_w ) +{ + m_sio_pin = state; +} + +WRITE_LINE_MEMBER( px4_state::rs232_rx_w ) +{ + if (BIT(m_swr, 3)) + serial_rx_w(state); +} + +WRITE_LINE_MEMBER( px4_state::rs232_dcd_w ) +{ + m_rs232_dcd = state; +} + +WRITE_LINE_MEMBER( px4_state::rs232_dsr_w ) +{ + m_artsr |= !state << 7; +} + +WRITE_LINE_MEMBER( px4_state::rs232_cts_w ) +{ + m_rs232_cts = state; +} + +void px4_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + device_serial_interface::device_timer(timer, id, param, ptr); +} + +void px4_state::tra_callback() +{ + if (ART_TX_ENABLED) + { + if (ART_BREAK) + txd_w(0); // transmit break + else + txd_w(transmit_register_get_data_bit()); // transmit data + } + else + txd_w(1); // transmit mark +} + +void px4_state::tra_complete() +{ + if (m_artsr & ART_TXRDY) + { + // no more bytes, buffer now empty + m_artsr |= ART_TXEMPTY; + } + else + { + // transfer next byte + transmit_register_setup(m_artdor); + m_artsr |= ART_TXRDY; + } +} + +void px4_state::rcv_callback() +{ + if (ART_RX_ENABLED) + receive_register_update_bit(m_serial_rx); // receive data +} + +void px4_state::rcv_complete() +{ + receive_register_extract(); + m_artdir = get_received_char(); + + // TODO: verify parity and framing + + // overrun? + if (m_artsr & ART_RXRDY) + m_artsr |= ART_OE; + + // set ready and signal interrupt + m_artsr |= ART_RXRDY; + m_isr |= INT1_ART; + gapnit_interrupt(); +} + +// helper function to write to selected serial port +void px4_state::txd_w(int data) +{ + if (BIT(m_swr, 2)) + // to sio + m_sio->tx_w(data); + else + if (BIT(m_swr, 3)) + // to rs232 + m_rs232->write_txd(data); + // else to cartridge +} + +// cartridge interface +READ8_MEMBER( px4_state::ctgif_r ) +{ + if (VERBOSE) + logerror("%s: ctgif_r @ 0x%02x\n", machine().describe_context(), offset); + + return 0x00; +} + +// cartridge interface +WRITE8_MEMBER( px4_state::ctgif_w ) +{ + if (VERBOSE) + logerror("%s: ctgif_w (0x%02x @ 0x%02x)\n", machine().describe_context(), data, offset); +} + +// art data input register +READ8_MEMBER( px4_state::artdir_r ) +{ + if (VERBOSE) + logerror("%s: artdir_r (%02x)\n", machine().describe_context(), m_artdir); + + // clear ready + m_artsr &= ~ART_RXRDY; + + // clear interrupt + m_isr &= ~INT1_ART; + gapnit_interrupt(); + + return m_artdir; +} + +// art data output register +WRITE8_MEMBER( px4_state::artdor_w ) +{ + if (VERBOSE) + logerror("%s: artdor_w (0x%02x)\n", machine().describe_context(), data); + + m_artdor = data; + + // new data to transmit? + if (ART_TX_ENABLED && is_transmit_register_empty()) + { + transmit_register_setup(m_artdor); + m_artsr &= ~ART_TXEMPTY; + } + else + { + // clear ready + m_artsr &= ~ART_TXRDY; + } +} + +// art status register +READ8_MEMBER( px4_state::artsr_r ) +{ + if (0) + logerror("%s: artsr_r (%02x)\n", machine().describe_context(), m_artsr); + + return m_artsr; +} + +// art mode register +WRITE8_MEMBER( px4_state::artmr_w ) +{ + int data_bit_count = BIT(data, 2) ? 8 : 7; + parity_t parity = BIT(data, 4) ? (BIT(data, 5) ? PARITY_EVEN : PARITY_ODD) : PARITY_NONE; + stop_bits_t stop_bits = BIT(data, 7) ? STOP_BITS_2 : STOP_BITS_1; + + if (VERBOSE) + logerror("%s: serial frame setup: %d-%s-%d\n", tag(), data_bit_count, device_serial_interface::parity_tostring(parity), stop_bits); + + set_data_frame(1, data_bit_count, parity, stop_bits); +} + +// io status register +READ8_MEMBER( px4_state::iostr_r ) +{ + UINT8 data = 0; + + // centronics status + data |= m_centronics_busy << 0; + data |= m_centronics_perror << 1; + + // sio status + data |= !m_sio_pin << 2; + + // serial data + data |= m_serial_rx << 3; + + // rs232 status + data |= !m_rs232_dcd << 4; + data |= !m_rs232_cts << 5; + + data |= 1 << 6; // bit 6, csel, cartridge option select signal + data |= 0 << 7; // bit 7, caud - audio input from cartridge + + if (0) + logerror("%s: iostr_r: rx = %d, dcd = %d, cts = %d\n", machine().describe_context(), BIT(data, 3), BIT(data, 4), BIT(data, 5)); + + return data; +} + +// art command register +WRITE8_MEMBER( px4_state::artcr_w ) +{ + if (VERBOSE) + logerror("%s: artcr_w (0x%02x)\n", machine().describe_context(), data); + + m_artcr = data; + + // error reset + if (BIT(data, 4)) + m_artsr &= ~(ART_PE | ART_OE | ART_FE); + + // rs232 + m_rs232->write_dtr(!BIT(data, 1)); + m_rs232->write_rts(!BIT(data, 5)); +} + +// switch register +WRITE8_MEMBER( px4_state::swr_w ) +{ + if (VERBOSE) + { + const char *cart_mode[] = { "hs", "io", "db", "ot" }; + const char *ser_mode[] = { "cart sio / cart sio", "sio / sio", "rs232 / rs232", "rs232 / sio" }; + logerror("%s: px4_swr_w: cartridge mode: %s, serial mode: %s, audio: %s\n", machine().describe_context(), + cart_mode[data & 0x03], ser_mode[(data >> 2) & 0x03], BIT(data, 4) ? "on" : "off"); + } + + m_swr = data; +} + +// io control register +WRITE8_MEMBER( px4_state::ioctlr_w ) +{ + if (VERBOSE) + logerror("%s: ioctlr_w (0x%02x)\n", machine().describe_context(), data); + + m_centronics->write_strobe(!BIT(data, 0)); + m_centronics->write_init(BIT(data, 1)); + + m_sio->pout_w(BIT(data, 2)); + + // bit 3, cartridge reset + + output_set_value("led_0", BIT(data, 4)); // caps lock + output_set_value("led_1", BIT(data, 5)); // num lock + output_set_value("led_2", BIT(data, 6)); // "led 2" + + m_speaker->level_w(BIT(data, 7)); +} + + +//************************************************************************** +// 7508 RELATED +//************************************************************************** + +TIMER_DEVICE_CALLBACK_MEMBER( px4_state::upd7508_1sec_callback ) +{ + // adjust interrupt status + m_interrupt_status |= UPD7508_INT_ONE_SECOND; + + // are interrupts enabled? + if (m_one_sec_int_enabled) + { + m_isr |= INT0_7508; + gapnit_interrupt(); + } + + // update clock + m_time.set(m_time.time + 1); +} + +INPUT_CHANGED_MEMBER( px4_state::key_callback ) +{ + UINT32 oldvalue = oldval * field.mask(), newvalue = newval * field.mask(); + UINT32 delta = oldvalue ^ newvalue; + int i, scancode = 0xff, down = 0; + + for (i = 0; i < 32; i++) + { + if (delta & (1 << i)) + { + down = (newvalue & (1 << i)) ? 0x10 : 0x00; + scancode = (FPTR)param * 32 + i; + + // control keys + if ((scancode & 0xa0) == 0xa0) + scancode |= down; + + if (VERBOSE) + logerror("upd7508: key callback, key=0x%02x\n", scancode); + + break; + } + } + + if (down || (scancode & 0xa0) == 0xa0) + { + m_key_status = scancode; + + if (m_key_int_enabled) + { + if (VERBOSE) + logerror("upd7508: key interrupt\n"); + + m_isr |= INT0_7508; + gapnit_interrupt(); + } + } +} + + +//************************************************************************** +// EXTERNAL RAM-DISK +//************************************************************************** + +WRITE8_MEMBER( px4p_state::ramdisk_address_w ) +{ + switch (offset) + { + case 0x00: m_ramdisk_address = (m_ramdisk_address & 0xffff00) | ((data & 0xff) << 0); break; + case 0x01: m_ramdisk_address = (m_ramdisk_address & 0xff00ff) | ((data & 0xff) << 8); break; + case 0x02: m_ramdisk_address = (m_ramdisk_address & 0x00ffff) | ((data & 0x07) << 16); break; + } +} + +READ8_MEMBER( px4p_state::ramdisk_data_r ) +{ + UINT8 ret = 0xff; + + if (m_ramdisk_address < 0x20000) + { + // read from ram + ret = m_ramdisk[m_ramdisk_address]; + } + else if (m_ramdisk_address < 0x40000) + { + // read from rom + ret = m_rdsocket->read_rom(space, m_ramdisk_address); + } + + m_ramdisk_address = (m_ramdisk_address & 0xffff00) | ((m_ramdisk_address & 0xff) + 1); + + return ret; +} + +WRITE8_MEMBER( px4p_state::ramdisk_data_w ) +{ + if (m_ramdisk_address < 0x20000) + m_ramdisk[m_ramdisk_address] = data; + + m_ramdisk_address = (m_ramdisk_address & 0xffff00) | ((m_ramdisk_address & 0xff) + 1); +} + +READ8_MEMBER( px4p_state::ramdisk_control_r ) +{ + // bit 7 determines the presence of a ram-disk + return 0x7f; +} + +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +UINT32 px4_state::screen_update_px4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // display enabled? + if (BIT(m_yoff, 7)) + { + int y, x; + + // get vram start address + UINT8 *vram = &m_ram->pointer()[(m_vadr & 0xf8) << 8]; + + for (y = 0; y < 64; y++) + { + // adjust against y-offset + UINT8 row = (y - (m_yoff & 0x3f)) & 0x3f; + + for (x = 0; x < 240/8; x++) + { + bitmap.pix16(row, x * 8 + 0) = BIT(*vram, 7); + bitmap.pix16(row, x * 8 + 1) = BIT(*vram, 6); + bitmap.pix16(row, x * 8 + 2) = BIT(*vram, 5); + bitmap.pix16(row, x * 8 + 3) = BIT(*vram, 4); + bitmap.pix16(row, x * 8 + 4) = BIT(*vram, 3); + bitmap.pix16(row, x * 8 + 5) = BIT(*vram, 2); + bitmap.pix16(row, x * 8 + 6) = BIT(*vram, 1); + bitmap.pix16(row, x * 8 + 7) = BIT(*vram, 0); + + vram++; + } + + // skip the last 2 unused bytes + vram += 2; + } + } + else + { + // display is disabled, draw an empty screen + bitmap.fill(0, cliprect); + } + + return 0; +} + + +//************************************************************************** +// DRIVER INIT +//************************************************************************** + +DRIVER_INIT_MEMBER( px4_state, px4 ) +{ + // map os rom and last half of memory + membank("bank1")->set_base(memregion("os")->base()); + membank("bank2")->set_base(m_ram->pointer() + 0x8000); +} + +DRIVER_INIT_MEMBER( px4p_state, px4p ) +{ + DRIVER_INIT_CALL(px4); + + // reserve memory for external ram-disk + m_ramdisk = auto_alloc_array(machine(), UINT8, 0x20000); +} + +void px4_state::machine_start() +{ + std::string region_tag; + m_caps1_rom = memregion(region_tag.assign(m_caps1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + m_caps2_rom = memregion(region_tag.assign(m_caps2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + m_nvram->set_base(m_ram->pointer(), 0x10000); + + // initialize clock + machine().base_datetime(m_time); +} + +void px4_state::machine_reset() +{ + m_artsr = ART_TXRDY | ART_TXEMPTY | (!m_rs232->dsr_r() << 7); + receive_register_reset(); + transmit_register_reset(); +} + +void px4p_state::machine_start() +{ + px4_state::machine_start(); + m_rdnvram->set_base(m_ramdisk, 0x20000); +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( px4_mem, AS_PROGRAM, 8, px4_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( px4_io, AS_IO, 8, px4_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // gapnit, 0x00-0x07 + AM_RANGE(0x00, 0x00) AM_READWRITE( icrlc_r, ctrl1_w ) + AM_RANGE(0x01, 0x01) AM_READWRITE( icrhc_r, cmdr_w ) + AM_RANGE(0x02, 0x02) AM_READWRITE( icrlb_r, ctrl2_w ) + AM_RANGE(0x03, 0x03) AM_READ( icrhb_r ) + AM_RANGE(0x04, 0x04) AM_READWRITE( isr_r, ier_w ) + AM_RANGE(0x05, 0x05) AM_READWRITE( str_r, bankr_w ) + AM_RANGE(0x06, 0x06) AM_READWRITE( sior_r, sior_w ) + AM_RANGE(0x07, 0x07) AM_NOP + // gapndl, 0x08-0x0f + AM_RANGE(0x08, 0x08) AM_WRITE( vadr_w ) + AM_RANGE(0x09, 0x09) AM_WRITE( yoff_w ) + AM_RANGE(0x0a, 0x0a) AM_WRITE( fr_w ) + AM_RANGE(0x0b, 0x0b) AM_WRITE( spur_w ) + AM_RANGE(0x0c, 0x0f) AM_NOP + // gapnio, 0x10-0x1f + AM_RANGE(0x10, 0x13) AM_READWRITE( ctgif_r, ctgif_w ) + AM_RANGE(0x14, 0x14) AM_READWRITE( artdir_r, artdor_w ) + AM_RANGE(0x15, 0x15) AM_READWRITE( artsr_r, artmr_w ) + AM_RANGE(0x16, 0x16) AM_READWRITE( iostr_r, artcr_w ) + AM_RANGE(0x17, 0x17) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x18, 0x18) AM_WRITE( swr_w ) + AM_RANGE(0x19, 0x19) AM_WRITE( ioctlr_w ) + AM_RANGE(0x1a, 0x1f) AM_NOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START( px4p_io, AS_IO, 8, px4p_state ) + AM_IMPORT_FROM(px4_io) + AM_RANGE(0x90, 0x92) AM_WRITE(ramdisk_address_w ) + AM_RANGE(0x93, 0x93) AM_READWRITE(ramdisk_data_r, ramdisk_data_w ) + AM_RANGE(0x94, 0x94) AM_READ(ramdisk_control_r) +ADDRESS_MAP_END + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +/* The PX-4 has an exchangeable keyboard. Available is a standard ASCII + * keyboard and an "item" keyboard, as well as regional variants for + * UK, France, Germany, Denmark, Sweden, Norway, Italy and Spain. + */ + +// configuration dip switch found on the rom capsule board +static INPUT_PORTS_START( px4_dips ) + PORT_START("dips") + + PORT_DIPNAME(0x0f, 0x0f, "Character set") + PORT_DIPLOCATION("PX-4:8,7,6,5") + PORT_DIPSETTING(0x0f, "ASCII") + PORT_DIPSETTING(0x0e, "France") + PORT_DIPSETTING(0x0d, "Germany") + PORT_DIPSETTING(0x0c, "England") + PORT_DIPSETTING(0x0b, "Denmark") + PORT_DIPSETTING(0x0a, "Sweden") + PORT_DIPSETTING(0x09, "Italy") + PORT_DIPSETTING(0x08, "Spain") + PORT_DIPSETTING(0x07, DEF_STR(Japan)) + PORT_DIPSETTING(0x06, "Norway") + + PORT_DIPNAME(0x30, 0x30, "LST device") + PORT_DIPLOCATION("PX-4:4,3") + PORT_DIPSETTING(0x00, "SIO") + PORT_DIPSETTING(0x10, "Cartridge printer") + PORT_DIPSETTING(0x20, "RS-232C") + PORT_DIPSETTING(0x30, "Centronics printer") + + // available for user applications + PORT_DIPNAME(0x40, 0x40, "Not used") + PORT_DIPLOCATION("PX-4:2") + PORT_DIPSETTING(0x40, "Enable") + PORT_DIPSETTING(0x00, "Disable") + + // this is automatically selected by the os, the switch has no effect + PORT_DIPNAME(0x80, 0x00, "Keyboard type") + PORT_DIPLOCATION("PX-4:1") + PORT_DIPSETTING(0x80, "Item keyboard") + PORT_DIPSETTING(0x00, "Standard keyboard") +INPUT_PORTS_END + +// US ASCII keyboard +static INPUT_PORTS_START( px4_h450a ) + PORT_INCLUDE(px4_dips) + + PORT_START("keyboard_0") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // 00 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) // 01 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_NAME("Help") // 02 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("PF1") // 03 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_NAME("PF2") // 04 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_NAME("PF3") // 05 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_NAME("PF4") // 06 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_NAME("PF5") // 07 + PORT_BIT(0x0000ff00, IP_ACTIVE_HIGH, IPT_UNUSED) // 08-0f + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) PORT_NAME("Stop") // 10 + PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') // 11 + PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') // 12 + PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // 13 + PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // 14 + PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // 15 + PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') // 16 + PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') // 17 + PORT_BIT(0xff000000, IP_ACTIVE_HIGH, IPT_UNUSED) // 18-1f + + PORT_START("keyboard_1") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // 20 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // 21 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // 22 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // 23 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // 24 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // 25 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // 26 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // 27 + PORT_BIT(0x0000ff00, IP_ACTIVE_HIGH, IPT_UNUSED) // 28-2f + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // 30 + PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // 31 + PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // 32 + PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // 33 + PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // 34 + PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // 35 + PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // 36 + PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') // 37 + PORT_BIT(0xff000000, IP_ACTIVE_HIGH, IPT_UNUSED) // 38-3f + + PORT_START("keyboard_2") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // 40 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // 41 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // 42 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') // 43 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') // 44 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // 45 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_F9) PORT_CHAR('[') PORT_CHAR('{') // 46 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_F10) PORT_CHAR(']') PORT_CHAR('}') // 47 + PORT_BIT(0x0000ff00, IP_ACTIVE_HIGH, IPT_UNUSED) // 48-4f + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') // 50 + PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') // 51 + PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') // 52 + PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') // 53 + PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') // 54 + PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // 55 + PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // 56 + PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') // 57 + PORT_BIT(0xff000000, IP_ACTIVE_HIGH, IPT_UNUSED) // 58-5f + + PORT_START("keyboard_3") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // 60 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // 61 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR(96) // 62 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // 63 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // 64 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // 65 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // 66 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // 67 + PORT_BIT(0x0000ff00, IP_ACTIVE_HIGH, IPT_UNUSED) // 48-4f + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') // 70 + PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // 71 + PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') // 72 + PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // 73 + PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // 74 + PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // 75 + PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // 76 + PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // 77 + PORT_BIT(0xff000000, IP_ACTIVE_HIGH, IPT_UNUSED) // 58-5f + + PORT_START("keyboard_4") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)4) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) // 80 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)4) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(12) // 81 + PORT_BIT(0xfffffffc, IP_ACTIVE_HIGH, IPT_UNUSED) // 82-9f + + PORT_START("keyboard_5") + PORT_BIT(0x00000003, IP_ACTIVE_HIGH, IPT_UNUSED) // a0-a1 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) // a2 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // a3 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // a4 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_RALT) PORT_NAME("Graph") // a5 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // a6 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // a7 + PORT_BIT(0xffffff00, IP_ACTIVE_HIGH, IPT_UNUSED) // a8-bf /* b2-b7 are the 'make' codes for the above keys */ +INPUT_PORTS_END + +#if 0 + +/* item keyboard */ +static INPUT_PORTS_START( px4_h421a ) + PORT_INCLUDE(px4_dips) +INPUT_PORTS_END + +#endif + +//************************************************************************** +// PALETTE +//************************************************************************** + +PALETTE_INIT_MEMBER( px4_state, px4 ) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +PALETTE_INIT_MEMBER( px4p_state, px4p ) +{ + palette.set_pen_color(0, rgb_t(149, 157, 130)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static MACHINE_CONFIG_START( px4, px4_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, XTAL_7_3728MHz / 2) // uPD70008 + MCFG_CPU_PROGRAM_MAP(px4_mem) + MCFG_CPU_IO_MAP(px4_io) + + // video hardware + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(72) + MCFG_SCREEN_SIZE(240, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 63) + MCFG_SCREEN_UPDATE_DRIVER(px4_state, screen_update_px4) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_px4) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(px4_state, px4) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("one_sec", px4_state, upd7508_1sec_callback, attotime::from_seconds(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("frc", px4_state, frc_tick, attotime::from_hz(XTAL_7_3728MHz / 2 / 6)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64k") + MCFG_NVRAM_ADD_NO_FILL("nvram") + + // centronics printer + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(px4_state, centronics_busy_w)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(px4_state, centronics_perror_w)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + // external cassette + MCFG_CASSETTE_ADD("extcas") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) + + MCFG_TIMER_DRIVER_ADD("extcas_timer", px4_state, ext_cassette_read) + + // sio port + MCFG_EPSON_SIO_ADD("sio", NULL) + MCFG_EPSON_SIO_RX(WRITELINE(px4_state, sio_rx_w)) + MCFG_EPSON_SIO_PIN(WRITELINE(px4_state, sio_pin_w)) + + // rs232 port + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(WRITELINE(px4_state, rs232_rx_w)) + MCFG_RS232_DCD_HANDLER(WRITELINE(px4_state, rs232_dcd_w)) + MCFG_RS232_DSR_HANDLER(WRITELINE(px4_state, rs232_dsr_w)) + MCFG_RS232_CTS_HANDLER(WRITELINE(px4_state, rs232_cts_w)) + + // rom capsules + MCFG_GENERIC_CARTSLOT_ADD("capsule1", generic_plain_slot, "px4_cart") + MCFG_GENERIC_CARTSLOT_ADD("capsule2", generic_plain_slot, "px4_cart") + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list", "px4_cart") + MCFG_SOFTWARE_LIST_ADD("epson_cpm_list", "epson_cpm") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( px4p, px4, px4p_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(px4p_io) + + MCFG_NVRAM_ADD_0FILL("rdnvram") + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(px4p_state, px4p) + + MCFG_GENERIC_CARTSLOT_ADD("ramdisk_socket", generic_plain_slot, "px4_cart") +MACHINE_CONFIG_END + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +// Note: We are missing "Kana OS V1.0" and "Kana OS V2.0" (Japanese version) + +ROM_START( px4 ) + ROM_REGION(0x8000, "os", 0) + ROM_SYSTEM_BIOS(0, "default", "PX-4 OS ROM") + ROMX_LOAD("m25122aa_po_px4.10c", 0x0000, 0x8000, CRC(62d60dc6) SHA1(3d32ec79a317de7c84c378302e95f48d56505502), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "ramtest", "PX-4/PX-8 DRAM Test Ver. 1.0") + ROMX_LOAD("ramtest.10c", 0x0000, 0x8000, CRC(f8aced5f) SHA1(a5a2f398e602aa349c3636d6659dd0c7eaba07fb), ROM_BIOS(2)) + + ROM_REGION(0x1000, "slave", 0) + ROM_LOAD("upd7508.bin", 0x0000, 0x1000, NO_DUMP) +ROM_END + +ROM_START( px4p ) + ROM_REGION(0x8000, "os", 0) + ROM_SYSTEM_BIOS(0, "default", "PX-4+ OS ROM") + ROMX_LOAD("b0_pxa.10c", 0x0000, 0x8000, CRC(d74b9ef5) SHA1(baceee076c12f5a16f7a26000e9bc395d021c455), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "ramtest", "PX-4/PX-8 DRAM Test Ver. 1.0") + ROMX_LOAD("ramtest.10c", 0x0000, 0x8000, CRC(f8aced5f) SHA1(a5a2f398e602aa349c3636d6659dd0c7eaba07fb), ROM_BIOS(2)) + + ROM_REGION(0x1000, "slave", 0) + ROM_LOAD("upd7508.bin", 0x0000, 0x1000, NO_DUMP) +ROM_END + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1985, px4, 0, 0, px4, px4_h450a, px4_state, px4, "Epson", "PX-4", 0 ) +COMP( 1985, px4p, px4, 0, px4p, px4_h450a, px4p_state, px4p, "Epson", "PX-4+", 0 ) diff --git a/src/mame/drivers/px8.c b/src/mame/drivers/px8.c new file mode 100644 index 00000000000..9557c46c2a9 --- /dev/null +++ b/src/mame/drivers/px8.c @@ -0,0 +1,838 @@ +// license:GPL-2.0+ +// copyright-holders:Curt Coder,Dirk Best +/*************************************************************************** + + Epson PX-8 + + 12/05/2009 Skeleton driver. + + Seems to be a CP/M computer. + +***************************************************************************/ + +/* + + TODO: + + - dumps of the internal ROMs + - uPD7508 CPU core + - keyboard + - cassette + - display + - jumpers + - ROM capsule + - uPD7001 + - RAM disk (64K/128K RAM, Z80, 4K ROM) + - modem (82C55) + - Multi-Unit (60K RAM, ROM capsule, modem, 82C55) + - attach PF-10s + +*/ + +#include "includes/px8.h" +#include "px8.lh" + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define XTAL_CR1 XTAL_9_8304MHz +#define XTAL_CR2 XTAL_32_768kHz + +/* interrupt sources */ +#define INT0_7508 0x01 +#define INT1_SERIAL 0x02 +#define INT2_RS232 0x04 +#define INT3_BARCODE 0x08 +#define INT4_FRC 0x10 +#define INT5_OPTION 0x20 + +enum +{ + GAH40M_CTLR1 = 0, + GAH40M_CMDR, + GAH40M_CTLR2, + GAH40M_IER = 4 +}; + +enum +{ + GAH40M_ICRL_C = 0, + GAH40M_ICRH_C, + GAH40M_ICRL_B, + GAH40M_ICRH_B, + GAH40M_ISR, + GAH40M_STR, + GAH40M_SIOR, + GAH40M_IVR +}; + +/*************************************************************************** + READ/WRITE HANDLERS +***************************************************************************/ + +/*------------------------------------------------- + bankswitch - memory bankswitching +-------------------------------------------------*/ + +void px8_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + UINT8 *ipl_rom = memregion(UPD70008_TAG)->base(); + + if (!m_bank0) + { + /* IPL ROM */ + program.install_rom(0x0000, 0x7fff, ipl_rom); + } + else + { + if (m_bk2) + { + /* D-RAM (L) */ + program.install_ram(0x0000, 0x7fff, ram); + } + else + { + /* OPTION ROM (L) */ + program.unmap_readwrite(0x0000, 0x7fff); + } + } + + if (m_bk2) + { + /* D-RAM (H) */ + program.install_ram(0x8000, 0xffff, ram + 0x8000); + } + else + { + /* OPTION ROM (H) */ + program.unmap_readwrite(0x8000, 0xffff); + } +} + +/*------------------------------------------------- + gah40m_r - GAH40M read +-------------------------------------------------*/ + +READ8_MEMBER( px8_state::gah40m_r ) +{ + switch (offset) + { + case GAH40M_ICRL_C: + /* + + bit signal description + + 0 ICR0 + 1 ICR1 + 2 ICR2 + 3 ICR3 + 4 ICR4 + 5 ICR5 + 6 ICR6 + 7 ICR7 + + */ + break; + + case GAH40M_ICRH_C: + /* + + bit signal description + + 0 ICR8 + 1 ICR9 + 2 ICR10 + 3 ICR11 + 4 ICR12 + 5 ICR13 + 6 ICR14 + 7 ICR15 + + */ + break; + + case GAH40M_ICRL_B: + /* + + bit signal description + + 0 ICR0 + 1 ICR1 + 2 ICR2 + 3 ICR3 + 4 ICR4 + 5 ICR5 + 6 ICR6 + 7 ICR7 + + */ + break; + + case GAH40M_ICRH_B: + /* + + bit signal description + + 0 ICR8 + 1 ICR9 + 2 ICR10 + 3 ICR11 + 4 ICR12 + 5 ICR13 + 6 ICR14 + 7 ICR15 + + */ + break; + + case GAH40M_ISR: + /* + + bit signal description + + 0 INT0 7508 interrupt (INT 7508) + 1 INT1 82C51 interrupt (INT 82C51) + 2 INT2 6303 interrupt (INT 6303) + 3 INT3 input capture flag timer (CF) + 4 INT4 overflow flag timer (OVF) + 5 INT5 external interrupt (INTEXT) + 6 + 7 + + */ + break; + + case GAH40M_STR: + /* + + bit signal description + + 0 _BANK0 + 1 BRDT barcode reader data timer + 2 RDY ready (SIO) + 3 RDYSIO SIO ready (SIO) + 4 + 5 + 6 + 7 + + */ + break; + + case GAH40M_SIOR: + /* + + bit signal description + + 0 SIO0 + 1 SIO1 + 2 SIO2 + 3 SIO3 + 4 SIO4 + 5 SIO5 + 6 SIO6 + 7 SIO7 + + */ + break; + + case GAH40M_IVR: + /* + + bit description + + 0 0 + 1 vect 1 + 2 vect 2 + 3 vect 3 + 4 1 + 5 1 + 6 1 + 7 1 + + */ + break; + } + + return 0xff; +} + +/*------------------------------------------------- + gah40m_w - GAH40M write +-------------------------------------------------*/ + +WRITE8_MEMBER( px8_state::gah40m_w ) +{ + switch (offset) + { + case GAH40M_CTLR1: + /* + + bit signal description + + 0 _BANK0 bank switching + 1 BCK0 barcode mode select 0 timer (down) + 2 BCK1 barcode mode select 1 timer (up) + 3 SWBCD barcode reader switch timer + 4 BRG0 bad rate generator select 0 timer + 5 BRG1 bad rate generator select 1 timer + 6 BRG2 bad rate generator select 2 timer + 7 BRG3 bad rate generator select 3 timer + + */ + + m_bank0 = BIT(data, 0); + bankswitch(); + break; + + case GAH40M_CMDR: + /* + + bit description + + 0 set RDYSIOFF (pulse) + 1 reset RDYSIOFF (pulse) + 2 reset OVF (pulse) + 3 + 4 + 5 + 6 + 7 + + */ + break; + + case GAH40M_CTLR2: + /* + + bit signal description + + 0 LED0 LED + 1 LED1 LED + 2 LED2 LED + 3 SWRS RS-232C switch + 4 INHRS inhibit RS-232C + 5 AUX external auxiliary output + 6 + 7 + + */ + + output_set_value("led_0", BIT(data, 0)); + output_set_value("led_1", BIT(data, 1)); + output_set_value("led_2", BIT(data, 2)); + break; + + case GAH40M_IER: + /* + + bit signal description + + 0 IER0 INT 7508 enable + 1 IER1 INT 82C51 enable + 2 IER2 INT 6303 enable + 3 IER3 INTICF enable + 4 IER4 INTOVF enable + 5 IER5 INTEXT enable + 6 + 7 + + */ + + m_ier = data; + break; + + case GAH40M_SIOR: + /* + + bit signal description + + 0 SIO0 + 1 SIO1 + 2 SIO2 + 3 SIO3 + 4 SIO4 + 5 SIO5 + 6 SIO6 + 7 SIO7 + + */ + + m_sio = data; + break; + } +} + +/*------------------------------------------------- + gah40s_r - GAH40S read +-------------------------------------------------*/ + +READ8_MEMBER( px8_state::gah40s_r ) +{ + UINT8 data = 0xff; + + switch (offset) + { + case 0: /* counter (upper byte) input */ + data = (m_cnt >> 8) & 0x1f; + break; + + case 1: /* counter (lower byte) */ + data = m_cnt & 0xff; + break; + + case 3: /* P-ROM read data */ + data = m_prd; + break; + } + + return data; +} + +/*------------------------------------------------- + gah40s_w - GAH40S write +-------------------------------------------------*/ + +WRITE8_MEMBER( px8_state::gah40s_w ) +{ + switch (offset) + { + case 0: /* counter reset */ + m_cnt = 0; + break; + + case 1: /* command register */ + /* + + bit signal description + + 0 SW PR PROM power switch + 1 SW MCT microcassette power switch + 2 MTA microcassette drive motor control signal A + 3 MTB microcassette drive motor control signal B + 4 MTC microcassette drive motor control signal C + 5 + 6 _FAST + 7 _STOP CNT + + */ + + m_swpr = BIT(data, 0); + break; + + case 2: /* P-ROM address (upper 8 byte) */ + m_pra = (data << 8) | (m_pra & 0xff); + m_prd = 0; // TODO read prom! + break; + + case 3: /* P-ROM address (lower 8 byte) */ + m_pra = (m_pra & 0xff00) | data; + m_prd = 0; // TODO read prom! + break; + } +} + +/*------------------------------------------------- + gah40s_ier_w - interrupt enable register write +-------------------------------------------------*/ + +WRITE8_MEMBER( px8_state::gah40s_ier_w ) +{ + m_ier = data; +} + +/*------------------------------------------------- + krtn_read - read keyboard return +-------------------------------------------------*/ + +UINT8 px8_state::krtn_read() +{ + UINT8 data = 0xff; + + switch (m_ksc) + { + case 0: data = ioport("KSC0")->read(); break; + case 1: data = ioport("KSC1")->read(); break; + case 2: data = ioport("KSC2")->read(); break; + case 3: data = ioport("KSC3")->read(); break; + case 4: data = ioport("KSC4")->read(); break; + case 5: data = ioport("KSC5")->read(); break; + case 6: data = ioport("KSC6")->read(); break; + case 7: data = ioport("KSC7")->read(); break; + case 8: data = ioport("KSC8")->read(); break; + case 9: data = ioport("SW4")->read(); break; + } + + return data; +} + +/*------------------------------------------------- + krtn_0_3_r - keyboard return 0..3 read +-------------------------------------------------*/ + +READ8_MEMBER( px8_state::krtn_0_3_r ) +{ + return krtn_read() & 0x0f; +} + +/*------------------------------------------------- + krtn_4_7_r - keyboard return 4..7 read +-------------------------------------------------*/ + +READ8_MEMBER( px8_state::krtn_4_7_r ) +{ + return krtn_read() >> 4; +} + +/*------------------------------------------------- + ksc_w - keyboard scan write +-------------------------------------------------*/ + +WRITE8_MEMBER( px8_state::ksc_w ) +{ + m_ksc = data; +} + +/*************************************************************************** + MEMORY MAPS +***************************************************************************/ + +/*------------------------------------------------- + ADDRESS_MAP( px8_mem ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( px8_mem, AS_PROGRAM, 8, px8_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank0") + AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank1") +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( px8_io ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( px8_io, AS_IO, 8, px8_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x0f) + AM_RANGE(0x00, 0x07) AM_READWRITE(gah40m_r, gah40m_w) + AM_RANGE(0x0c, 0x0c) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x0d, 0x0d) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) +// AM_RANGE(0x0e, 0x0e) AM_DEVREADWRITE(SED1320_TAG, sed1330_device, status_r, data_w) +// AM_RANGE(0x0f, 0x0f) AM_DEVREADWRITE(SED1320_TAG, sed1330_device, data_r, command_w) +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( px8_slave_mem ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( px8_slave_mem, AS_PROGRAM, 8, px8_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0020, 0x0023) AM_READWRITE(gah40s_r, gah40s_w) +// AM_RANGE(0x0024, 0x0027) AM_DEVREADWRITE_LEGACY(SED1320_TAG, ) + AM_RANGE(0x0028, 0x0028) AM_WRITE(gah40s_ier_w) + AM_RANGE(0x8000, 0x97ff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0x9800, 0xefff) AM_NOP + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6303_TAG, 0) /* internal mask rom */ +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( px8_slave_io ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( px8_slave_io, AS_IO, 8, px8_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(M6801_PORT1, M6801_PORT1) + AM_RANGE(M6801_PORT2, M6801_PORT2) + AM_RANGE(M6801_PORT3, M6801_PORT3) + AM_RANGE(M6801_PORT4, M6801_PORT4) +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( px8_sub_io ) +-------------------------------------------------*/ +#ifdef UNUSED_CODE +static ADDRESS_MAP_START( px8_sub_io, AS_IO, 8, px8_state ) +// AM_RANGE(0x00, 0x00) AM_READWRITE() + AM_RANGE(0x01, 0x01) AM_READ(krtn_0_3_r) +// AM_RANGE(0x02, 0x02) AM_WRITE() + AM_RANGE(0x03, 0x03) AM_WRITE(ksc_w) +// AM_RANGE(0x04, 0x04) AM_WRITE() + AM_RANGE(0x05, 0x05) AM_READ(krtn_4_7_r) +// AM_RANGE(0x06, 0x06) AM_READ() +// AM_RANGE(0x07, 0x07) AM_WRITE() +ADDRESS_MAP_END +#endif +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( px8 ) + PORT_START("KSC0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SCRN INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NUM GRPH") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + + PORT_START("KSC1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF1") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF2") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF3") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF5") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("KSC2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("KSC3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + + PORT_START("KSC4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + + PORT_START("KSC5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("KSC6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + + PORT_START("KSC7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR(96) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + + PORT_START("KSC8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("SW4") + PORT_DIPNAME( 0xef, 0x2f, "Character Set" ) PORT_DIPLOCATION("SW4:1,2,3,4,6,7,8") + PORT_DIPSETTING( 0x2f, "ASCII" ) + PORT_DIPSETTING( 0x2e, DEF_STR( French ) ) + PORT_DIPSETTING( 0x2d, DEF_STR( German ) ) + PORT_DIPSETTING( 0x2c, DEF_STR( English ) ) + PORT_DIPSETTING( 0x2b, "Danish" ) + PORT_DIPSETTING( 0x2a, "Swedish" ) + PORT_DIPSETTING( 0x26, "Norwegian" ) + PORT_DIPSETTING( 0x29, "Italy" ) + PORT_DIPSETTING( 0x28, "Spain" ) + PORT_DIPSETTING( 0x60, "HASCI" ) + PORT_DIPSETTING( 0x21, "Japanese (Japanese)" ) + PORT_DIPSETTING( 0x00, "Japanese (JIS)" ) + PORT_DIPSETTING( 0x01, "Japanese (touch 16)" ) + PORT_DIPNAME( 0x10, 0x00, "RAM disk check" ) PORT_DIPLOCATION("SW4:5") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) +INPUT_PORTS_END + +/*************************************************************************** + VIDEO +***************************************************************************/ + +PALETTE_INIT_MEMBER(px8_state, px8) +{ + palette.set_pen_color(0, 0xa5, 0xad, 0xa5); + palette.set_pen_color(1, 0x31, 0x39, 0x10); +} + +UINT32 px8_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +/*------------------------------------------------- + gfx_layout px8_charlayout +-------------------------------------------------*/ + +static const gfx_layout px8_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +/*------------------------------------------------- + GFXDECODE( px8 ) +-------------------------------------------------*/ + +static GFXDECODE_START( px8 ) + GFXDECODE_ENTRY( SED1320_TAG, 0x0000, px8_charlayout, 0, 1 ) +GFXDECODE_END + +/*************************************************************************** + MACHINE INITIALIZATION +***************************************************************************/ + +/*------------------------------------------------- + MACHINE_START( px8 ) +-------------------------------------------------*/ + +void px8_state::machine_start() +{ + /* register for state saving */ + save_item(NAME(m_ier)); + save_item(NAME(m_isr)); + save_item(NAME(m_bank0)); + save_item(NAME(m_bk2)); + save_item(NAME(m_sio)); + save_item(NAME(m_ksc)); +} + +void px8_state::machine_reset() +{ + m_bank0 = 0; + m_bk2 = 1; + + bankswitch(); +} + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static MACHINE_CONFIG_START( px8, px8_state ) + /* main cpu (uPD70008) */ + MCFG_CPU_ADD(UPD70008_TAG, Z80, XTAL_CR1 / 4) /* 2.45 MHz */ + MCFG_CPU_PROGRAM_MAP(px8_mem) + MCFG_CPU_IO_MAP(px8_io) + + /* slave cpu (HD6303) */ + MCFG_CPU_ADD(HD6303_TAG, M6803, XTAL_CR1 / 4) /* 614 kHz */ + MCFG_CPU_PROGRAM_MAP(px8_slave_mem) + MCFG_CPU_IO_MAP(px8_slave_io) + MCFG_DEVICE_DISABLE() + + /* sub CPU (uPD7508) */ +// MCFG_CPU_ADD(UPD7508_TAG, UPD7508, 200000) /* 200 kHz */ +// MCFG_CPU_IO_MAP(px8_sub_io) +// MCFG_DEVICE_DISABLE() + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_px8) + + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(72) + MCFG_SCREEN_UPDATE_DRIVER(px8_state, screen_update) + MCFG_SCREEN_SIZE(480, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 479, 0, 63) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", px8) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(px8_state, px8) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(0, "mono", 0.25) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("capsule1", generic_plain_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_GENERIC_CARTSLOT_ADD("capsule2", generic_plain_slot, NULL) + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* devices */ + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // software + MCFG_SOFTWARE_LIST_ADD("epson_cpm_list", "epson_cpm") +MACHINE_CONFIG_END + +/*************************************************************************** + ROMS +***************************************************************************/ + +ROM_START( px8 ) + ROM_REGION( 0x10000, UPD70008_TAG, 0 ) + ROM_DEFAULT_BIOS("052884") + ROM_SYSTEM_BIOS( 0, "091383", "9/13/83" ) + ROMX_LOAD( "m25030aa.2a", 0x0000, 0x8000, CRC(bd3e4938) SHA1(5bd48abd2a563a1ae31ff137280f40c8f756e969), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "052884", "5/28/84" ) + ROMX_LOAD( "px060688.2a", 0x0000, 0x8000, CRC(44308bdf) SHA1(5c4545fcf1af9931b4699436294d9b6298052a7b), ROM_BIOS(2) ) + + ROM_REGION( 0x0800, SED1320_TAG, 0 ) + ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(5b52edbd) SHA1(38197edf301bb2843bea040536af545f76b3d44f) ) + + ROM_REGION( 0x1000, HD6303_TAG, 0 ) + ROM_LOAD( "hd6303 slave cpu internal rom.13d", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x1000, UPD7508_TAG, 0 ) + ROM_LOAD( "upd7508 sub cpu internal rom.2e", 0x0000, 0x1000, NO_DUMP ) +ROM_END + +/*************************************************************************** + SYSTEM DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, px8, 0, 0, px8, px8, driver_device, 0, "Epson", "PX-8", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/pyl601.c b/src/mame/drivers/pyl601.c new file mode 100644 index 00000000000..3073d635e20 --- /dev/null +++ b/src/mame/drivers/pyl601.c @@ -0,0 +1,622 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Pyldin-601 + + 12/05/2009 Skeleton driver. + 22/04/2012 Added sound, fixed keyboard, marked as working [Robbbert] + + ToDo? + - PYL601 - command 'MODE80' does nothing + + - PYL601a - most software looks odd (unplayable) because of the + different design of the screen. + - PYL601A - command 'MODE40' doesn't go to 40-columns, instead + there is a space between each letter. + + + The BASIC + - to get back to dos, enter SYSTEM + - It has its own internal monitor: MON to enter, Q to exit. + + + +':maincpu' (F013): unmapped program memory write to E628 = 00 & FF +':maincpu' (FCBC): unmapped program memory write to E636 = 00 & FF +':maincpu' (FCBC): unmapped program memory write to E637 = 00 & FF +':maincpu' (FCC2): unmapped program memory write to E634 = 07 & FF +':maincpu' (FCC2): unmapped program memory write to E635 = FF & FF +':maincpu' (FCC7): unmapped program memory write to E637 = 34 & FF +':maincpu' (FCCC): unmapped program memory write to E637 = 3C & FF +':maincpu' (FCCF): unmapped program memory write to E636 = 3C & FF +':maincpu' (FCD3): unmapped program memory read from E634 & FF + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "video/mc6845.h" +#include "sound/speaker.h" +#include "formats/pyldin_dsk.h" +#include "machine/upd765.h" +#include "machine/ram.h" + + +class pyl601_state : public driver_device +{ +public: + pyl601_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_speaker(*this, "speaker"), + m_fdc(*this, "upd765"), + m_ram(*this, RAM_TAG), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") { } + + UINT8 m_rom_page; + UINT32 m_vdisk_addr; + UINT8 m_key_code; + UINT8 m_keyboard_clk; + UINT8 m_video_mode; + UINT8 m_tick50_mark; + UINT8 m_floppy_ctrl; + DECLARE_READ8_MEMBER(rom_page_r); + DECLARE_WRITE8_MEMBER(rom_page_w); + DECLARE_WRITE8_MEMBER(vdisk_page_w); + DECLARE_WRITE8_MEMBER(vdisk_h_w); + DECLARE_WRITE8_MEMBER(vdisk_l_w); + DECLARE_WRITE8_MEMBER(vdisk_data_w); + DECLARE_READ8_MEMBER(vdisk_data_r); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_READ8_MEMBER(keycheck_r); + DECLARE_WRITE8_MEMBER(video_mode_w); + DECLARE_READ8_MEMBER(video_mode_r); + DECLARE_READ8_MEMBER(timer_r); + DECLARE_WRITE8_MEMBER(speaker_w); + DECLARE_WRITE8_MEMBER(led_w); + DECLARE_WRITE8_MEMBER(floppy_w); + DECLARE_READ8_MEMBER(floppy_r); + MC6845_UPDATE_ROW(pyl601_update_row); + MC6845_UPDATE_ROW(pyl601a_update_row); + UINT8 selectedline(UINT16 data); + required_device m_speaker; + required_device m_fdc; + required_device m_ram; + DECLARE_DRIVER_INIT(pyl601); + virtual void machine_reset(); + virtual void video_start(); + INTERRUPT_GEN_MEMBER(pyl601_interrupt); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + required_device m_maincpu; + required_device m_palette; +}; + + + +READ8_MEMBER(pyl601_state::rom_page_r) +{ + return m_rom_page; +} + +WRITE8_MEMBER(pyl601_state::rom_page_w) +{ + m_rom_page = data; + if (data & 8) + { + int chip = (data >> 4) % 5; + int page = data & 7; + membank("bank2")->set_base(memregion("romdisk")->base() + chip*0x10000 + page * 0x2000); + } + else + { + membank("bank2")->set_base(m_ram->pointer() + 0xc000); + } +} + + +WRITE8_MEMBER(pyl601_state::vdisk_page_w) +{ + m_vdisk_addr = (m_vdisk_addr & 0x0ffff) | ((data & 0x0f)<<16); +} + +WRITE8_MEMBER(pyl601_state::vdisk_h_w) +{ + m_vdisk_addr = (m_vdisk_addr & 0xf00ff) | (data<<8); +} + +WRITE8_MEMBER(pyl601_state::vdisk_l_w) +{ + m_vdisk_addr = (m_vdisk_addr & 0xfff00) | data; +} + +WRITE8_MEMBER(pyl601_state::vdisk_data_w) +{ + m_ram->pointer()[0x10000 + (m_vdisk_addr & 0x7ffff)] = data; + m_vdisk_addr++; + m_vdisk_addr&=0x7ffff; +} + +READ8_MEMBER(pyl601_state::vdisk_data_r) +{ + UINT8 retVal = m_ram->pointer()[0x10000 + (m_vdisk_addr & 0x7ffff)]; + m_vdisk_addr++; + m_vdisk_addr &= 0x7ffff; + return retVal; +} + +UINT8 pyl601_state::selectedline(UINT16 data) +{ + UINT8 i; + for(i = 0; i < 16; i++) + if (BIT(data, i)) + return i; + + return 0; +} + +READ8_MEMBER(pyl601_state::keyboard_r) +{ + UINT8 ret = m_key_code; + m_key_code = 0xff; + return ret; +} + +READ8_MEMBER(pyl601_state::keycheck_r) +{ + UINT8 retVal = 0x3f; + UINT8 *keyboard = memregion("keyboard")->base(); + UINT16 row1 = ioport("ROW1")->read(); + UINT16 row2 = ioport("ROW2")->read(); + UINT16 row3 = ioport("ROW3")->read(); + UINT16 row4 = ioport("ROW4")->read(); + UINT16 row5 = ioport("ROW5")->read(); + UINT16 all = row1 | row2 | row3 | row4 | row5; + UINT16 addr = ioport("MODIFIERS")->read(); + if (all) + { + addr |= selectedline(all) << 2; + + addr |= ((row5 == 0x00) ? 1 : 0) << 6; + addr |= ((row4 == 0x00) ? 1 : 0) << 7; + addr |= ((row3 == 0x00) ? 1 : 0) << 8; + addr |= ((row2 == 0x00) ? 1 : 0) << 9; + addr |= ((row1 == 0x00) ? 1 : 0) << 10; + + m_key_code = keyboard[addr]; + m_keyboard_clk = ~m_keyboard_clk; + + if (m_keyboard_clk) + retVal |= 0x80; + } + return retVal; +} + + +WRITE8_MEMBER(pyl601_state::video_mode_w) +{ + m_video_mode = data; +} + +READ8_MEMBER(pyl601_state::video_mode_r) +{ + return m_video_mode; +} + +READ8_MEMBER(pyl601_state::timer_r) +{ + UINT8 retVal= m_tick50_mark | 0x37; + m_tick50_mark = 0; + return retVal; +} + +WRITE8_MEMBER(pyl601_state::speaker_w) +{ + m_speaker->level_w(BIT(data, 3)); +} + +WRITE8_MEMBER(pyl601_state::led_w) +{ +// UINT8 caps_led = BIT(data,4); +} + +WRITE8_MEMBER(pyl601_state::floppy_w) +{ + // bit 0 is reset (if zero) + // bit 1 is TC state + // bit 2 is drive selected + // bit 3 is motor state + + if (BIT(data,0)==0) + //reset + m_fdc->reset(); + + floppy_image_device *floppy = machine().device(BIT(data,2) ? "upd765:1" : "upd765:0")->get_device(); + if(floppy) + floppy->mon_w(!BIT(data, 3)); + + m_fdc->tc_w(BIT(data, 1)); + + m_floppy_ctrl = data; +} + +READ8_MEMBER(pyl601_state::floppy_r) +{ + return m_floppy_ctrl; +} + +static ADDRESS_MAP_START(pyl601_mem, AS_PROGRAM, 8, pyl601_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xbfff ) AM_RAMBANK("bank1") + AM_RANGE( 0xc000, 0xdfff ) AM_RAMBANK("bank2") + AM_RANGE( 0xe000, 0xe5ff ) AM_RAMBANK("bank3") + AM_RANGE( 0xe600, 0xe600 ) AM_MIRROR(4) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE( 0xe601, 0xe601 ) AM_MIRROR(4) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE( 0xe628, 0xe628 ) AM_READ(keyboard_r) + AM_RANGE( 0xe629, 0xe629 ) AM_READWRITE(video_mode_r,video_mode_w) + AM_RANGE( 0xe62a, 0xe62a ) AM_READWRITE(keycheck_r,led_w) + AM_RANGE( 0xe62b, 0xe62b ) AM_READWRITE(timer_r,speaker_w) + AM_RANGE( 0xe62d, 0xe62d ) AM_READ(video_mode_r) + AM_RANGE( 0xe62e, 0xe62e ) AM_READWRITE(keycheck_r,led_w) + AM_RANGE( 0xe680, 0xe680 ) AM_WRITE(vdisk_page_w) + AM_RANGE( 0xe681, 0xe681 ) AM_WRITE(vdisk_h_w) + AM_RANGE( 0xe682, 0xe682 ) AM_WRITE(vdisk_l_w) + AM_RANGE( 0xe683, 0xe683 ) AM_READWRITE(vdisk_data_r,vdisk_data_w) + AM_RANGE( 0xe6c0, 0xe6c0 ) AM_READWRITE(floppy_r, floppy_w) + AM_RANGE( 0xe6d0, 0xe6d1 ) AM_DEVICE("upd765", upd765a_device, map) + AM_RANGE( 0xe6f0, 0xe6f0 ) AM_READWRITE(rom_page_r, rom_page_w) + AM_RANGE( 0xe700, 0xefff ) AM_RAMBANK("bank4") + AM_RANGE( 0xf000, 0xffff ) AM_READ_BANK("bank5") AM_WRITE_BANK("bank6") +ADDRESS_MAP_END + +/* Input ports */ +/* A small note about natural keyboard mode: Ctrl is mapped to PGUP and the 'Lat/Cyr' key is mapped to PGDOWN */ +static INPUT_PORTS_START( pyl601 ) + PORT_START("ROW1") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Lat/Cyr") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("ROW2") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') // it should be the 4th key at right of 'L' + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW3") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + + PORT_START("ROW4") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW5") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F15)) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F14)) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F13)) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("MODIFIERS") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) +INPUT_PORTS_END + +void pyl601_state::machine_reset() +{ + UINT8 *ram = m_ram->pointer(); + m_key_code = 0xff; + membank("bank1")->set_base(ram + 0x0000); + membank("bank2")->set_base(ram + 0xc000); + membank("bank3")->set_base(ram + 0xe000); + membank("bank4")->set_base(ram + 0xe700); + membank("bank5")->set_base(memregion("maincpu")->base() + 0xf000); + membank("bank6")->set_base(ram + 0xf000); + + m_maincpu->reset(); +} + +void pyl601_state::video_start() +{ +} + +MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 *charrom = memregion("chargen")->base(); + + int column, bit, i; + UINT8 data; + if (BIT(m_video_mode, 5) == 0) + { + for (column = 0; column < x_count; column++) + { + UINT8 code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; + code = ((code << 1) | (code >> 7)) & 0xff; + if (column == cursor_x-2) + data = 0xff; + else + data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff]; + + for (bit = 0; bit < 8; bit++) + { + int x = (column * 8) + bit; + + bitmap.pix32(y, x) = palette[BIT(data, 7)]; + + data <<= 1; + } + } + } + else + { + for (i = 0; i < x_count; i++) + { + data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; + for (bit = 0; bit < 8; bit++) + { + bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; + data <<= 1; + } + } + } +} + +MC6845_UPDATE_ROW( pyl601_state::pyl601a_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 *charrom = memregion("chargen")->base(); + + int column, bit, i; + UINT8 data; + if (BIT(m_video_mode, 5) == 0) + { + for (column = 0; column < x_count; column++) + { + UINT8 code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; + data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; + if (column == cursor_x) + data = 0xff; + + for (bit = 0; bit < 8; bit++) + { + int x = (column * 8) + bit; + + bitmap.pix32(y, x) = palette[BIT(data, 7)]; + + data <<= 1; + } + } + } + else + { + for (i = 0; i < x_count; i++) + { + data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; + for (bit = 0; bit < 8; bit++) + { + bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; + data <<= 1; + } + } + } +} + + + +DRIVER_INIT_MEMBER(pyl601_state,pyl601) +{ + memset(m_ram->pointer(), 0, 64 * 1024); +} + +INTERRUPT_GEN_MEMBER(pyl601_state::pyl601_interrupt) +{ + m_tick50_mark = 0x80; + device.execute().set_input_line(0, HOLD_LINE); +} + +FLOPPY_FORMATS_MEMBER( pyl601_state::floppy_formats ) + FLOPPY_PYLDIN_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( pyl601_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +/* F4 Character Displayer */ +static const gfx_layout pyl601_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout pyl601a_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( pyl601 ) + GFXDECODE_ENTRY( "chargen", 0x0000, pyl601_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( pyl601a ) + GFXDECODE_ENTRY( "chargen", 0x0000, pyl601a_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( pyl601, pyl601_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6800, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(pyl601_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pyl601_state, pyl601_interrupt) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pyl601) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_2MHz) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) /* ? */ + MCFG_MC6845_UPDATE_ROW_CB(pyl601_state, pyl601_update_row) + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", pyl601_floppies, "525hd", pyl601_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", pyl601_floppies, "525hd", pyl601_state::floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","pyl601") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("576K") // 64 + 512 +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pyl601a, pyl601 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK( XTAL_2MHz) + + MCFG_GFXDECODE_MODIFY("gfxdecode", pyl601a) + + MCFG_DEVICE_REMOVE("crtc") + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_2MHz) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) /* ? */ + MCFG_MC6845_UPDATE_ROW_CB(pyl601_state, pyl601a_update_row) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( pyl601 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bios.rom", 0xf000, 0x1000, CRC(41fe4c4b) SHA1(d8ca92aea0eb283e8d7779cb976bcdfa03e81aea)) + + ROM_REGION(0x0800, "chargen", 0) + ROM_LOAD( "video.rom", 0x0000, 0x0800, CRC(1c23ba43) SHA1(eb1cfc139858abd0aedbbf3d523f8ba55d27a11d)) + + ROM_REGION(0x50000, "romdisk", ROMREGION_ERASEFF) + ROM_LOAD( "rom0.rom", 0x00000, 0x10000, CRC(60103920) SHA1(ee5b4ee5b513c4a0204da751e53d63b8c6c0aab9)) + ROM_LOAD( "rom1.rom", 0x10000, 0x10000, CRC(cb4a9b22) SHA1(dd09e4ba35b8d1a6f60e6e262aaf2f156367e385)) + ROM_LOAD( "rom2.rom", 0x20000, 0x08000, CRC(0b7684bf) SHA1(c02ad1f2a6f484cd9d178d8b060c21c0d4e53442)) + ROM_COPY("romdisk", 0x20000, 0x28000, 0x08000) + ROM_LOAD( "rom3.rom", 0x30000, 0x08000, CRC(e4a86dfa) SHA1(96e6bb9ffd66f81fca63bf7491fbba81c4ff1fd2)) + ROM_COPY("romdisk", 0x30000, 0x38000, 0x08000) + ROM_LOAD( "rom4.rom", 0x40000, 0x08000, CRC(d88ac21d) SHA1(022db11fdcf8db81ce9efd9cd9fa50ebca88e79e)) + ROM_COPY("romdisk", 0x40000, 0x48000, 0x08000) + + ROM_REGION(0x0800, "keyboard", 0) + ROM_LOAD( "keyboard.rom", 0x0000, 0x0800, CRC(41fbe5ca) SHA1(875adaef53bc37e92ad0b6b6ee3d8fd28344d358)) +ROM_END + +ROM_START( pyl601a ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bios_a.rom", 0xf000, 0x1000, CRC(e018b11e) SHA1(884d59abd5fa5af1295d1b5a53693facc7945b63)) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "video_a.rom", 0x0000,0x1000, CRC(00fa4077) SHA1(d39d15969a08bdb768d08bea4ec9a9cb498232fd)) + + ROM_REGION(0x50000, "romdisk", ROMREGION_ERASEFF) + ROM_LOAD( "rom0.rom", 0x00000, 0x10000, CRC(60103920) SHA1(ee5b4ee5b513c4a0204da751e53d63b8c6c0aab9)) + ROM_LOAD( "rom1.rom", 0x10000, 0x10000, CRC(cb4a9b22) SHA1(dd09e4ba35b8d1a6f60e6e262aaf2f156367e385)) + ROM_LOAD( "rom2.rom", 0x20000, 0x08000, CRC(0b7684bf) SHA1(c02ad1f2a6f484cd9d178d8b060c21c0d4e53442)) + ROM_COPY("romdisk", 0x20000, 0x28000, 0x08000) + ROM_LOAD( "rom3.rom", 0x30000, 0x08000, CRC(e4a86dfa) SHA1(96e6bb9ffd66f81fca63bf7491fbba81c4ff1fd2)) + ROM_COPY("romdisk", 0x30000, 0x38000, 0x08000) + ROM_LOAD( "rom4.rom", 0x40000, 0x08000, CRC(d88ac21d) SHA1(022db11fdcf8db81ce9efd9cd9fa50ebca88e79e)) + ROM_COPY("romdisk", 0x40000, 0x48000, 0x08000) + + ROM_REGION(0x0800, "keyboard", 0) + ROM_LOAD( "keyboard.rom", 0x0000, 0x0800, CRC(41fbe5ca) SHA1(875adaef53bc37e92ad0b6b6ee3d8fd28344d358)) +ROM_END +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, pyl601, 0, 0, pyl601, pyl601, pyl601_state, pyl601, "Mikroelektronika", "Pyldin-601", 0 ) +COMP( 1989, pyl601a, pyl601, 0, pyl601a, pyl601, pyl601_state, pyl601, "Mikroelektronika", "Pyldin-601A", 0 ) diff --git a/src/mame/drivers/ql.c b/src/mame/drivers/ql.c new file mode 100644 index 00000000000..e8749cb6695 --- /dev/null +++ b/src/mame/drivers/ql.c @@ -0,0 +1,1152 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Phill Harvey-Smith +/* + + Sinclair QL + + MESS Driver by Curt Coder + +*/ + +/* + + TODO: + + - microdrive + - ZX8301 memory access slowdown + - use resnet.h to create palette + - Tyche bios is broken + - several disk interfaces (720K/1.44MB/3.2MB) + - Gold Card (68000 @ 16MHz, 2MB RAM) + - Super Gold Card (68020 @ 24MHz, 4MB RAM) + - QLToolkit II ROM + - GST 68kOS ROM + - natural keyboard SHIFT does not work, it causes characters to be skipped altogether + - get modified Danish version to boot (e.g. MD_DESEL was patched to jump to 0x1cd5e) + - ICL One Per Desk / British Telecom Merlin Tonto / Telecom Australia Computerphone / Mega OPD (US) + - OPD: 68008P8 @ 7.5MHz, ZX8301 @ 12MHz, CDP65C51E1 @ 1.8432MHz, 128K RAM, 2K NVRAM, 128K ROM (4x32), 16K speech ROM, ADM7910 modem, TMS5220 speech, 2x100K microdrives, RTC 1/1/1970, 1xRS-423 + - Sandy Q-XT 640 (original motherboard, Super QBoard 512KB, Centronics, Super Toolkit II, FDC, 1 or 2 3.5" 1MB drives, 3 expansion slots) + - CST Thor PC 1F (720K 3.5") + - CST Thor PC 2F (2x 720k 3.5") + - CST Thor PC 2FW (20MB Winchester + 720K 3.5") + - CST Thor 20 (68020) + - CST Thor 21 (68020+68881) + - CST Thor XVI CF (Workstation, 68000 @ 8 MHz, M6802, 68682 DUART) + - CST Thor XVI IF (Single Floppy) + - CST Thor XVI FF (Dual Floppy) + - CST Thor XVI W20F (20MB Winchester, 1 Floppy) + - CST Thor XVI W20FF (20MB Winchester, 2 Floppies) + - CST Thor XVI W40F (40MB Winchester, 1 Floppy) + - CST Thor XVI W40FF (40MB Winchester, 2 Floppies) + + + 2011-02-22, P.Harvey-Smith, + Implemented Miracle Trump Card disk and ram interface. + + The trump card has some interesting memory mapping and re-mapping during initialisation which goes like this + + On reset the card ram is mapped into the entire $40000-$fffff area, this is the official 512K expansion ram area + plus the area set aside for addon card roms. The trump card onboard rom is also mapped in at $10000-$17fff. + + The main bios then performs a series of loops that initialise and size the ram, this will find either + 0K, 256K, 512K or 768K of expansion ram depending on how many banks of ram are populated. + + After the ram test, the main bios looks for the signature longword of a cartridge rom at $0c000, this read + triggers the Trump Card to also map it's rom in at $c0000-$c7fff, the first addon rom area. If a cartridge + rom is found it is first initialised. + + The main bios goes on to search the addon card rom area from $c0000 by searching for the signature word for + an addon rom at $c0000 and upwards in 16K steps (there is a bug in JM and before that means they only find + the first addon, but this does not matter). + + The main bios finds the trump card addon rom at $c0000, and calls it's initialisation routine at $c011e, this + contains a jump instruction to jump to $10124 (in the lower mapped copy of the trumpcard rom). + + The first memory access in the $10000-$17fff range triggers the trumcard to page out the rom at $c0000, and + page the ram back in. Once it arrives at this state the ram will remain paged in until the next reset. + + I have implemented this with a pair of read handlers at $0c000-$0cfff and $10000-$17fff which do the apropreate + re-map of the upper area and then remove themselves from the address map and return it to simple rom handlers. + + On the Trump card the above is implemented with a pair of 16L8 PAL chips, the logic of these was decoded with + the assistance of Malcolm Lear, without who's help working all this out would have been a much harder process. + +*/ + +#include "includes/ql.h" + + + +//************************************************************************** +// ADDRESS DECODING +//************************************************************************** + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( ql_state::read ) +{ + UINT8 data = 0; + int cart_romoeh = 0; + int exp_romoeh = 0; + + if (offset < 0xc000) + { + data = m_rom->base()[offset]; + } + if (offset >= 0xc000 && offset < 0x10000) + { + cart_romoeh = 1; + } + if (offset >= 0x18000 && offset <= 0x18003) + { + data = m_zx8302->rtc_r(space, offset & 0x03); + } + if (offset == 0x18020) + { + data = m_zx8302->status_r(space, 0); + } + if (offset == 0x18021) + { + data = m_zx8302->irq_status_r(space, 0); + } + if (offset >= 0x18022 && offset <= 0x18023) + { + data = m_zx8302->mdv_track_r(space, offset & 0x01); + } + if (offset >= 0x20000 && offset < 0x40000) + { + data = m_zx8301->data_r(space, offset & 0x1ffff); + } + if (offset >= 0xc0000) + { + exp_romoeh = 1; + } + if (m_qimi_enabled) + { + data = m_qimi->read(space, offset, data); + } + + m_cart->romoeh_w(cart_romoeh); + data = m_cart->read(space, offset & 0x7fff, data); + m_cart->romoeh_w(0); + + m_exp->romoeh_w(exp_romoeh); + data = m_exp->read(space, offset, data); + m_exp->romoeh_w(0); + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( ql_state::write ) +{ + if (offset >= 0x18000 && offset <= 0x18001) + { + m_zx8302->rtc_w(space, offset & 0x01, data); + } + if (offset == 0x18002) + { + m_zx8302->control_w(space, 0, data); + } + if (offset == 0x18003) + { + m_zx8302->ipc_command_w(space, 0, data); + } + if (offset == 0x18020) + { + m_zx8302->mdv_control_w(space, 0, data); + } + if (offset == 0x18021) + { + m_zx8302->irq_acknowledge_w(space, 0, data); + } + if (offset == 0x18022) + { + m_zx8302->data_w(space, 0, data); + } + if (offset == 0x18063) + { + m_zx8301->control_w(space, 0, data); + } + if (offset >= 0x20000 && offset < 0x40000) + { + m_zx8301->data_w(space, offset & 0x1ffff, data); + } + if (m_qimi_enabled) + { + m_qimi->write(space, offset, data); + } + + m_cart->romoeh_w(0); + m_cart->write(space, offset & 0x7fff, data); + + m_exp->romoeh_w(0); + m_exp->write(space, offset, data); +} + + + +//************************************************************************** +// INTELLIGENT PERIPHERAL CONTROLLER +//************************************************************************** + +//------------------------------------------------- +// ipc_w - +//------------------------------------------------- + +WRITE8_MEMBER( ql_state::ipc_w ) +{ + m_zx8302->comctl_w(0); + m_zx8302->comctl_w(1); +} + + +//------------------------------------------------- +// ipc_port1_w - +//------------------------------------------------- + +WRITE8_MEMBER( ql_state::ipc_port1_w ) +{ + /* + + bit description + + 0 Keyboard column output (KBO0) + 1 Keyboard column output (KBO1) + 2 Keyboard column output (KBO2) + 3 Keyboard column output (KBO3) + 4 Keyboard column output (KBO4) + 5 Keyboard column output (KBO5) + 6 Keyboard column output (KBO6) + 7 Keyboard column output (KBO7) + + */ + + m_keylatch = data; +} + + +//------------------------------------------------- +// ipc_port2_r - +//------------------------------------------------- + +READ8_MEMBER( ql_state::ipc_port2_r ) +{ + /* + + bit description + + 0 Serial data input (SER2 RxD, SER1 TxD) + 1 + 2 + 3 + 4 + 5 + 6 + 7 ZX8302 serial link input/output (COMDATA) + + */ + + UINT8 data = 0; + + // SER2 serial data input + data |= m_ser2->rxd_r(); + + // COMDATA + data |= m_comdata_to_ipc << 7; + + return data; +} + + +//------------------------------------------------- +// ipc_port2_w - +//------------------------------------------------- + +WRITE8_MEMBER( ql_state::ipc_port2_w ) +{ + /* + + bit description + + 0 + 1 Speaker output + 2 Interrupt output (IPL0-2) + 3 Interrupt output (IPL1) + 4 Serial Clear-to-Send output (SER1 CTS) + 5 Serial Data Terminal Ready output (SER2 DTR) + 6 + 7 ZX8302 serial link input/output (COMDATA) + + */ + + // speaker + m_speaker->level_w(BIT(data, 1)); + + // interrupts + int ipl = (BIT(data, 2) << 1) | BIT(data, 3); + + if (ipl != m_ipl) + { + switch (ipl) + { + case 0: m_maincpu->set_input_line(M68K_IRQ_7, ASSERT_LINE); break; + case 1: m_maincpu->set_input_line(M68K_IRQ_5, ASSERT_LINE); break; // CTRL-ALT-7 pressed + case 2: m_maincpu->set_input_line(M68K_IRQ_2, ASSERT_LINE); break; + case 3: m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); break; + } + + m_ipl = ipl; + } + + // TODO SER1 clear to send + + // SER2 data terminal ready + m_ser2->write_dtr(!BIT(data, 5)); + + // COMDATA + m_zx8302->comdata_w(BIT(data, 7)); +} + + +//------------------------------------------------- +// ipc_t1_r - +//------------------------------------------------- + +READ8_MEMBER( ql_state::ipc_t1_r ) +{ + return m_baudx4; +} + + +//------------------------------------------------- +// ipc_bus_r - +//------------------------------------------------- + +READ8_MEMBER( ql_state::ipc_bus_r ) +{ + /* + + bit description + + 0 Keyboard row input (KBI0) + 1 Keyboard row input (KBI1) + 2 Keyboard row input (KBI2) + 3 Keyboard row input (KBI3) + 4 Keyboard row input (KBI4) + 5 Keyboard row input (KBI5) + 6 Keyboard row input (KBI6) + 7 Keyboard row input (KBI7) + + */ + + UINT8 data = 0; + + if (BIT(m_keylatch, 0)) data |= m_y0->read() | m_joy0->read(); + if (BIT(m_keylatch, 1)) data |= m_y1->read() | m_joy1->read(); + if (BIT(m_keylatch, 2)) data |= m_y2->read(); + if (BIT(m_keylatch, 3)) data |= m_y3->read(); + if (BIT(m_keylatch, 4)) data |= m_y4->read(); + if (BIT(m_keylatch, 5)) data |= m_y5->read(); + if (BIT(m_keylatch, 6)) data |= m_y6->read(); + if (BIT(m_keylatch, 7)) data |= m_y7->read(); + + return data; +} + + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( ql_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ql_mem, AS_PROGRAM, 8, ql_state ) + AM_RANGE(0x000000, 0x0fffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( ipc_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( ipc_io, AS_IO, 8, ql_state ) + AM_RANGE(0x00, 0x7f) AM_WRITE(ipc_w) + AM_RANGE(0x27, 0x28) AM_READNOP // IPC reads these to set P0 (bus) to Hi-Z mode + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(ipc_port1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(ipc_port2_r, ipc_port2_w) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(ipc_t1_r) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(ipc_bus_r) AM_WRITENOP +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( ql ) +//------------------------------------------------- + +static INPUT_PORTS_START( ql ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_NAME("F4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("F1") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_NAME("F2") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_NAME("F3") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_NAME("F5") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC @") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHAR('\x1b') PORT_CHAR('@') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("\xc2\xa3 ~") PORT_CHAR(0xa3) PORT_CHAR('~') // ? ~ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TABULATE") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("JOY0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )PORT_PLAYER(1) PORT_8WAY PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("JOY1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )PORT_PLAYER(2) PORT_8WAY PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_SPACE) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY PORT_CODE(KEYCODE_DOWN) + + PORT_START("config") + PORT_CONFNAME( 0x01, 0x00, "QL Internal Mouse Interface (QIMI)") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( ql_es ) +//------------------------------------------------- + +static INPUT_PORTS_START( ql_es ) + PORT_INCLUDE(ql) + + PORT_MODIFY("Y1") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("] \xc3\x9c") PORT_CHAR(']') PORT_CHAR(0xfc) PORT_CHAR(0xdc) + + PORT_MODIFY("Y2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('`') PORT_CHAR('^') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('!') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ \xc3\x87") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('[') PORT_CHAR(0xe7) PORT_CHAR(0xc7) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(':') + + PORT_MODIFY("Y3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x91") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0xf1) PORT_CHAR(0xd1) + + PORT_MODIFY("Y4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 \xc2\xa1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR(0xa1) + + PORT_MODIFY("Y6") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \xc2\xbf") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(0xbf) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('/') + + PORT_MODIFY("Y7") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( ql_de ) +//------------------------------------------------- + +static INPUT_PORTS_START( ql_de ) + PORT_INCLUDE(ql) + + PORT_MODIFY("Y0") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + + PORT_MODIFY("Y1") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') + + PORT_MODIFY("Y2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('^') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x84") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xe4) PORT_CHAR(0xc4) + + PORT_MODIFY("Y3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x9c") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0xfc) PORT_CHAR(0xdc) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('#') PORT_CHAR('\'') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x96") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0xf6) PORT_CHAR(0xd6) + + PORT_MODIFY("Y4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 \xc2\xa3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xa7) + + PORT_MODIFY("Y5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x9f ?") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0xdf) PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_MODIFY("Y6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + + PORT_MODIFY("Y7") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( ql_it ) +//------------------------------------------------- + +static INPUT_PORTS_START( ql_it ) + PORT_INCLUDE(ql) + + PORT_MODIFY("Y0") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \xc3\xa8") PORT_CODE(KEYCODE_7) PORT_CHAR('?') PORT_CHAR('7') + + PORT_MODIFY("Y1") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') + + PORT_MODIFY("Y2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('$') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* \xc2\xa7") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('*') PORT_CHAR(0xa7) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xb9 %") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xf9) PORT_CHAR('%') + + PORT_MODIFY("Y3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xac =") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0xec) PORT_CHAR('=') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('+') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_MODIFY("Y4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('#') PORT_CHAR('1') + + PORT_MODIFY("Y5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa7 9") PORT_CODE(KEYCODE_9) PORT_CHAR(0xe7) PORT_CHAR('9') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR('\\') + + PORT_MODIFY("Y6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('^') PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa9 2") PORT_CODE(KEYCODE_2) PORT_CHAR(0xe9) PORT_CHAR('2') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('_') PORT_CHAR('6') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa0 0") PORT_CODE(KEYCODE_0) PORT_CHAR(0xe0) PORT_CHAR('0') + + PORT_MODIFY("Y7") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xb2 !") PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0xf2) PORT_CHAR('!') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('.') +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( ql_fr ) +//------------------------------------------------- + +static INPUT_PORTS_START( ql_fr ) + PORT_INCLUDE(ql) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( ql_se ) +//------------------------------------------------- + +static INPUT_PORTS_START( ql_se ) + PORT_INCLUDE(ql) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( ql_dk ) +//------------------------------------------------- + +static INPUT_PORTS_START( ql_dk ) + PORT_INCLUDE(ql) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// ZX8302_INTERFACE( ql_zx8302_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( ql_state::ql_baudx4_w ) +{ + m_baudx4 = state; +} + +// CPU to IPC +WRITE_LINE_MEMBER( ql_state::ql_comdata_w ) +{ + m_comdata_to_ipc = state; +} + +WRITE_LINE_MEMBER( ql_state::zx8302_mdselck_w ) +{ + m_mdv2->clk_w(state); + m_mdv1->clk_w(state); +} + +WRITE_LINE_MEMBER( ql_state::zx8302_mdrdw_w ) +{ + m_mdv1->read_write_w(state); + m_mdv2->read_write_w(state); +} + +WRITE_LINE_MEMBER( ql_state::zx8302_erase_w ) +{ + m_mdv1->erase_w(state); + m_mdv2->erase_w(state); +} + +WRITE_LINE_MEMBER( ql_state::zx8302_raw1_w ) +{ + m_mdv1->data1_w(state); + m_mdv2->data1_w(state); +} + +READ_LINE_MEMBER( ql_state::zx8302_raw1_r ) +{ + return m_mdv1->data1_r() | m_mdv2->data1_r(); +} + +WRITE_LINE_MEMBER( ql_state::zx8302_raw2_w ) +{ + m_mdv1->data2_w(state); + m_mdv2->data2_w(state); +} + +READ_LINE_MEMBER( ql_state::zx8302_raw2_r ) +{ + return m_mdv1->data2_r() | m_mdv2->data2_r(); +} + +void ql_state::update_interrupt() +{ + m_zx8302->extint_w(m_extintl || m_qimi_extint); +} + +WRITE_LINE_MEMBER( ql_state::exp_extintl_w ) +{ + m_extintl = state; + update_interrupt(); +} + +WRITE_LINE_MEMBER( ql_state::qimi_extintl_w ) +{ + if (m_qimi_enabled) + { + m_qimi_extint = state; + update_interrupt(); + } +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +void ql_state::machine_start() +{ + // register for state saving + save_item(NAME(m_keylatch)); + save_item(NAME(m_ipl)); + save_item(NAME(m_comdata_to_ipc)); + save_item(NAME(m_baudx4)); +} + +void ql_state::machine_reset() +{ + // QIMI + m_qimi_enabled = (m_config->read() & 0x01) ? true : false; +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( ql ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( ql, ql_state ) + // basic machine hardware + MCFG_CPU_ADD(M68008_TAG, M68008, X1/2) + MCFG_CPU_PROGRAM_MAP(ql_mem) + + MCFG_CPU_ADD(I8749_TAG, I8749, X4) + MCFG_CPU_IO_MAP(ipc_io) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50.08) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate + MCFG_SCREEN_UPDATE_DEVICE(ZX8301_TAG, zx8301_device, screen_update) + MCFG_SCREEN_SIZE(960, 312) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_DEVICE_ADD(ZX8301_TAG, ZX8301, X1) + MCFG_ZX8301_CPU(M68008_TAG) + MCFG_ZX8301_VSYNC_CALLBACK(DEVWRITELINE(ZX8302_TAG, zx8302_device, vsync_w)) + + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + + MCFG_DEVICE_ADD(ZX8302_TAG, ZX8302, X1) + MCFG_ZX8302_RTC_CLOCK(X2) + MCFG_ZX8302_OUT_IPL1L_CB(INPUTLINE(M68008_TAG, M68K_IRQ_2)) + MCFG_ZX8302_OUT_BAUDX4_CB(WRITELINE(ql_state, ql_baudx4_w)) + MCFG_ZX8302_OUT_COMDATA_CB(WRITELINE(ql_state, ql_comdata_w)) + // TXD1 + MCFG_ZX8302_OUT_TXD2_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + // NETOUT + MCFG_ZX8302_OUT_MDSELCK_CB(WRITELINE(ql_state, zx8302_mdselck_w)) + MCFG_ZX8302_OUT_MDSELD_CB(DEVWRITELINE(MDV_1, microdrive_image_device, comms_in_w)) + MCFG_ZX8302_OUT_MDRDW_CB(WRITELINE(ql_state, zx8302_mdrdw_w)) + MCFG_ZX8302_OUT_ERASE_CB(WRITELINE(ql_state, zx8302_erase_w)) + MCFG_ZX8302_OUT_RAW1_CB(WRITELINE(ql_state, zx8302_raw1_w)) + MCFG_ZX8302_IN_RAW1_CB(READLINE(ql_state, zx8302_raw1_r)) + MCFG_ZX8302_OUT_RAW2_CB(WRITELINE(ql_state, zx8302_raw2_w)) + MCFG_ZX8302_IN_RAW2_CB(READLINE(ql_state, zx8302_raw2_r)) + + MCFG_MICRODRIVE_ADD(MDV_1) + MCFG_MICRODRIVE_COMMS_OUT_CALLBACK(DEVWRITELINE(MDV_2, microdrive_image_device, comms_in_w)) + MCFG_MICRODRIVE_ADD(MDV_2) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) // wired as DCE + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) // wired as DTE + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ZX8302_TAG, zx8302_device, write_cts2)) + + MCFG_QL_EXPANSION_SLOT_ADD("exp", ql_expansion_cards, NULL) + //MCFG_QL_EXPANSION_SLOT_IPL0L_CALLBACK() + //MCFG_QL_EXPANSION_SLOT_IPL1L_CALLBACK() + //MCFG_QL_EXPANSION_SLOT_BERRL_CALLBACK() + MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(ql_state, exp_extintl_w)) + + MCFG_QL_ROM_CARTRIDGE_SLOT_ADD("rom", ql_rom_cartridge_cards, NULL) + + MCFG_DEVICE_ADD(QIMI_TAG, QIMI, 0) + MCFG_QIMI_EXTINT_CALLBACK(WRITELINE(ql_state, qimi_extintl_w)) + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list", "ql_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "ql_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "ql_flop") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( ql_ntsc ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( ql_ntsc, ql ) + // video hardware + MCFG_SCREEN_MODIFY(SCREEN_TAG) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(960, 262) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( opd ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( opd, ql ) + // internal ram + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("256K") +MACHINE_CONFIG_END + + +/* +//------------------------------------------------- +// MACHINE_CONFIG( megaopd ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( megaopd, ql ) + // internal ram + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") +MACHINE_CONFIG_END +*/ + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( ql ) +//------------------------------------------------- + +ROM_START( ql ) + ROM_REGION( 0x10000, M68008_TAG, 0 ) + ROM_DEFAULT_BIOS("js") + ROM_SYSTEM_BIOS( 0, "fb", "v1.00 (FB)" ) + ROMX_LOAD( "fb.ic33", 0x0000, 0x8000, NO_DUMP, ROM_BIOS(1) ) + ROMX_LOAD( "fb.ic34", 0x8000, 0x4000, NO_DUMP, ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "pm", "v1.01 (PM)" ) + ROMX_LOAD( "pm.ic33", 0x0000, 0x8000, NO_DUMP, ROM_BIOS(2) ) + ROMX_LOAD( "pm.ic34", 0x8000, 0x4000, NO_DUMP, ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "ah", "v1.02 (AH)" ) + ROMX_LOAD( "ah.ic33.1", 0x0000, 0x4000, BAD_DUMP CRC(a9b4d2df) SHA1(142d6f01a9621aff5e0ad678bd3cbf5cde0db801), ROM_BIOS(3) ) + ROMX_LOAD( "ah.ic33.2", 0x4000, 0x4000, BAD_DUMP CRC(36488e4e) SHA1(ff6f597b30ea03ce480a3d6728fd1d858da34d6a), ROM_BIOS(3) ) + ROMX_LOAD( "ah.ic34", 0x8000, 0x4000, BAD_DUMP CRC(61259d4c) SHA1(bdd10d111e7ba488551a27c8d3b2743917ff1307), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "jm", "v1.03 (JM)" ) + ROMX_LOAD( "ql.jm 0000.ic33", 0x0000, 0x8000, CRC(1f8e840a) SHA1(7929e716dfe88318bbe99e34f47d039957fe3cc0), ROM_BIOS(4) ) + ROMX_LOAD( "ql.jm 8000.ic34", 0x8000, 0x4000, CRC(9168a2e9) SHA1(1e7c47a59fc40bd96dfefc2f4d86827c15f0199e), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "tb", "v1.0? (TB)" ) + ROMX_LOAD( "tb.ic33", 0x0000, 0x8000, BAD_DUMP CRC(1c86d688) SHA1(7df8028e6671afc4ebd5f65bf6c2d6019181f239), ROM_BIOS(5) ) + ROMX_LOAD( "tb.ic34", 0x8000, 0x4000, BAD_DUMP CRC(de7f9669) SHA1(9d6bc0b794541a4cec2203256ae92c7e68d1011d), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "js", "v1.10 (JS)" ) + ROMX_LOAD( "ql.js 0000.ic33", 0x0000, 0x8000, CRC(1bbad3b8) SHA1(59fd4372771a630967ee102760f4652904d7d5fa), ROM_BIOS(6) ) + ROMX_LOAD( "ql.js 8000.ic34", 0x8000, 0x4000, CRC(c970800e) SHA1(b8c9203026a7de6a44bd0942ec9343e8b222cb41), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 6, "tyche", "v2.05 (Tyche)" ) + ROMX_LOAD( "tyche.rom", 0x0000, 0x010000, CRC(8724b495) SHA1(5f33a1bc3f23fd09c31844b65bc3aca7616f180a), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS( 7, "min189", "Minerva v1.89" ) + ROMX_LOAD( "minerva.rom", 0x0000, 0x00c000, BAD_DUMP CRC(930befe3) SHA1(84a99c4df13b97f90baf1ec8cb6c2e52e3e1bb4d), ROM_BIOS(8) ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) + + ROM_REGION( 0x4000, "printer", 0 ) // original Sinclair QL printer (based on Seikosha SP-1000 / SP-800QL, with custom QL font) + ROM_LOAD( "bql010-sqpp", 0x0000, 0x4000, CRC(07834797) SHA1(ba94bdad2303a263008b6ea744669a19938d9998) ) +ROM_END + + +//------------------------------------------------- +// ROM( ql_us ) +//------------------------------------------------- + +ROM_START( ql_us ) + ROM_REGION( 0xc000, M68008_TAG, 0 ) + ROM_LOAD( "jsu.ic33", 0x0000, 0x8000, BAD_DUMP CRC(e397f49f) SHA1(c06f92eabaf3e6dd298c51cb7f7535d8ef0ef9c5) ) + ROM_LOAD( "jsu.ic34", 0x8000, 0x4000, BAD_DUMP CRC(3debbacc) SHA1(9fbc3e42ec463fa42f9c535d63780ff53a9313ec) ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( ql_es ) +//------------------------------------------------- + +ROM_START( ql_es ) + ROM_REGION( 0xc000, M68008_TAG, 0 ) + ROM_LOAD( "mge.ic33", 0x0000, 0x8000, BAD_DUMP CRC(d5293bde) SHA1(bf5af7e53a472d4e9871f182210787d601db0634) ) + ROM_LOAD( "mge.ic34", 0x8000, 0x4000, BAD_DUMP CRC(a694f8d7) SHA1(bd2868656008de85d7c191598588017ae8aa3339) ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( ql_fr ) +//------------------------------------------------- + +ROM_START( ql_fr ) + ROM_REGION( 0xc000, M68008_TAG, 0 ) + ROM_LOAD( "mgf.ic33", 0x0000, 0x8000, NO_DUMP ) + ROM_LOAD( "mgf.ic34", 0x8000, 0x4000, NO_DUMP ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( ql_de ) +//------------------------------------------------- + +ROM_START( ql_de ) + ROM_REGION( 0xc000, M68008_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "mg", "v1.10 (MG)" ) + ROMX_LOAD( "mgg.ic33", 0x0000, 0x8000, BAD_DUMP CRC(b4e468fd) SHA1(cd02a3cd79af90d48b65077d0571efc2f12f146e), ROM_BIOS(1) ) + ROMX_LOAD( "mgg.ic34", 0x8000, 0x4000, BAD_DUMP CRC(54959d40) SHA1(ffc0be9649f26019d7be82925c18dc699259877f), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "mf", "v1.14 (MF)" ) + ROMX_LOAD( "mf.ic33", 0x0000, 0x8000, BAD_DUMP CRC(49c40563) SHA1(d3bcd0614cf9b52e9d7fc2832e11463e5030476b), ROM_BIOS(2) ) + ROMX_LOAD( "mf.ic34", 0x8000, 0x4000, BAD_DUMP CRC(5974616b) SHA1(c3603768c08535c25f077eed02fb80128aff13d9), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "ultramg", "Ultrasoft" ) + ROMX_LOAD( "ultramg.rom", 0x0000, 0x00c000, BAD_DUMP CRC(ad12463b) SHA1(0561b3bc7ce090f3101b2142ee957c18c250eefa), ROM_BIOS(3) ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( ql_it ) +//------------------------------------------------- + +ROM_START( ql_it ) + ROM_REGION( 0xc000, M68008_TAG, 0 ) + ROM_LOAD( "mgi.ic33", 0x0000, 0x8000, BAD_DUMP CRC(d5293bde) SHA1(bf5af7e53a472d4e9871f182210787d601db0634) ) + ROM_LOAD( "mgi.ic34", 0x8000, 0x4000, BAD_DUMP CRC(a2fdfb83) SHA1(162b1052737500f3c13497cdf0f813ba006bdae9) ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( ql_se ) +//------------------------------------------------- + +ROM_START( ql_se ) + ROM_REGION( 0xc000, M68008_TAG, 0 ) + ROM_LOAD( "mgs.ic33", 0x0000, 0x8000, NO_DUMP ) + ROM_LOAD( "mgs.ic34", 0x8000, 0x4000, NO_DUMP ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( ql_gr ) +//------------------------------------------------- + +ROM_START( ql_gr ) + ROM_REGION( 0xc000, M68008_TAG, 0 ) + ROM_LOAD( "efp.ic33", 0x0000, 0x8000, BAD_DUMP CRC(eb181641) SHA1(43c1e0215cf540cbbda240b1048910ff55681059) ) + ROM_LOAD( "efp.ic34", 0x8000, 0x4000, BAD_DUMP CRC(4c3b34b7) SHA1(f9dc571d2d4f68520b306ecc7516acaeea69ec0d) ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( ql_dk ) +//------------------------------------------------- + +ROM_START( ql_dk ) + ROM_REGION( 0xc000, M68008_TAG, 0 ) + ROM_LOAD( "mgd.ic33", 0x0000, 0x8000, BAD_DUMP CRC(f57755eb) SHA1(dc57939ffb8741e17967a1d2479c339750ec7ff6) ) + ROM_LOAD( "mgd.ic34", 0x8000, 0x4000, BAD_DUMP CRC(1892465a) SHA1(0ff3046b5276da6639d3fe79b22ae25cc265d540) ) + + ROM_REGION( 0x4000, "extra", 0 ) + ROM_LOAD( "extra.rom", 0x0000, 0x4000, NO_DUMP ) // located at 0x1c000 in M68008 memory map + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x400, "plds", 0 ) + ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( tonto ) +//------------------------------------------------- + +ROM_START( tonto ) + ROM_REGION( 0x20000, M68008_TAG, 0 ) + ROM_LOAD( "xbaa02.ic4", 0x000000, 0x008000, CRC(86e7915b) SHA1(a4d8369052eaea93d2174cfd3b14e6cf777f54b4) ) + ROM_LOAD( "xbab03.ic5", 0x008000, 0x008000, CRC(97ef393c) SHA1(450c708e8dfbd42d939a9af6a72ef2a33a3dd3b5) ) + ROM_LOAD( "xbac02.ic6", 0x010000, 0x008000, CRC(a7950897) SHA1(7cd4d6e33a350420a9ebd5c1b32708c29cb20799) ) + ROM_LOAD( "xbad02.ic7", 0x018000, 0x008000, CRC(69d59443) SHA1(cdf28b1b4fca00e8cb79930a1963955af2925618) ) + + ROM_REGION( 0x800, I8749_TAG, 0 ) + ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) + + ROM_REGION( 0x10000, I8051_TAG, 0 ) + ROM_LOAD( "8051-1.rom", 0x000000, 0x010000, NO_DUMP ) + + ROM_REGION( 0x10000, "tms5220", 0 ) + ROM_LOAD( "tms5220.rom", 0x000000, 0x004000, NO_DUMP ) + + ROM_REGION( 0x400000, "rompack", 0 ) + ROM_LOAD( "xbak02.ic6", 0x000000, 0x008000, CRC(3d61e84e) SHA1(7d0a473b0ed3e3ae3cd6d3fb43cb7a70a550d1d9) ) + ROM_LOAD( "xbaf01.ic7", 0x008000, 0x008000, CRC(c5724357) SHA1(6e765f8e85d2312c31e4b09c9a6645ab3d166e65) ) + ROM_LOAD( "xbag01.ic8", 0x010000, 0x008000, CRC(9af3bcbf) SHA1(9a848926f2bf6f632ab198a8bb03a8ee83ea0e5d) ) + ROM_LOAD( "qcaw02.ic9", 0x018000, 0x008000, CRC(1091a789) SHA1(33881b2a818cbaf610a0746fde4acfef5c91338f) ) + ROM_LOAD( "qcax02.ic10", 0x020000, 0x008000, CRC(396f13d9) SHA1(b2deb5db4565ff7224730c2f3245fbf9df84d728) ) +ROM_END + + +#if 0 +//------------------------------------------------- +// ROM( megaopd ) +//------------------------------------------------- + +ROM_START( megaopd ) + ROM_REGION( 0x20000, M68008_TAG, 0 ) + ROM_LOAD( "bios-1.rom", 0x000000, 0x008000, NO_DUMP ) + ROM_LOAD( "bios-2.rom", 0x008000, 0x008000, NO_DUMP ) + ROM_LOAD( "bios-3.rom", 0x010000, 0x008000, NO_DUMP ) + ROM_LOAD( "bios-4.rom", 0x018000, 0x008000, NO_DUMP ) + + ROM_REGION( 0x10000, I8051_TAG, 0 ) + ROM_LOAD( "8051-1.rom", 0x000000, 0x010000, NO_DUMP ) + + ROM_REGION( 0x10000, "tms5220", 0 ) + ROM_LOAD( "tms5220.rom", 0x000000, 0x004000, NO_DUMP ) + + ROM_REGION( 0x400000, "rompack", 0 ) + ROM_LOAD( "rompack-1.rom", 0x000000, 0x008000, NO_DUMP ) + ROM_LOAD( "rompack-2.rom", 0x008000, 0x008000, NO_DUMP ) + ROM_LOAD( "rompack-3.rom", 0x010000, 0x008000, NO_DUMP ) + ROM_LOAD( "rompack-4.rom", 0x018000, 0x008000, NO_DUMP ) + ROM_LOAD( "rompack-5.rom", 0x020000, 0x008000, NO_DUMP ) +ROM_END +#endif + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1984, ql, 0, 0, ql, ql, driver_device, 0, "Sinclair Research Ltd", "QL (UK)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, ql_us, ql, 0, ql_ntsc, ql, driver_device, 0, "Sinclair Research Ltd", "QL (USA)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, ql_es, ql, 0, ql, ql_es, driver_device, 0, "Sinclair Research Ltd", "QL (Spain)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, ql_fr, ql, 0, ql, ql_fr, driver_device, 0, "Sinclair Research Ltd", "QL (France)", MACHINE_NOT_WORKING ) +COMP( 1985, ql_de, ql, 0, ql, ql_de, driver_device, 0, "Sinclair Research Ltd", "QL (Germany)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, ql_it, ql, 0, ql, ql_it, driver_device, 0, "Sinclair Research Ltd", "QL (Italy)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, ql_se, ql, 0, ql, ql_se, driver_device, 0, "Sinclair Research Ltd", "QL (Sweden)", MACHINE_NOT_WORKING ) +COMP( 1985, ql_dk, ql, 0, ql, ql_dk, driver_device, 0, "Sinclair Research Ltd", "QL (Denmark)", MACHINE_NOT_WORKING ) +COMP( 1985, ql_gr, ql, 0, ql, ql, driver_device, 0, "Sinclair Research Ltd", "QL (Greece)", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, tonto, 0, 0, opd, ql, driver_device, 0, "British Telecom Business Systems", "Merlin M1800 Tonto", MACHINE_NOT_WORKING ) +//COMP( 1986, megaopd,tonto, 0, megaopd, ql, driver_device, 0, "International Computer Limited", "MegaOPD (USA)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/qtsbc.c b/src/mame/drivers/qtsbc.c new file mode 100644 index 00000000000..a79b75fd8ad --- /dev/null +++ b/src/mame/drivers/qtsbc.c @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + QT Computer Systems SBC +2/4 + + 11/12/2009 Skeleton driver. + + It expects a rom or similar at E377-up, so currently it crashes. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class qtsbc_state : public driver_device +{ +public: + qtsbc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_p_ram(*this, "p_ram") + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER( qtsbc_06_r ); + DECLARE_READ8_MEMBER( qtsbc_43_r ); + DECLARE_WRITE8_MEMBER( kbd_put ); + required_shared_ptr m_p_ram; + UINT8 m_term_data; + virtual void machine_reset(); +}; + + +READ8_MEMBER( qtsbc_state::qtsbc_06_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( qtsbc_state::qtsbc_43_r ) +{ + return 0; +} + +static ADDRESS_MAP_START(qtsbc_mem, AS_PROGRAM, 8, qtsbc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xffff ) AM_RAM AM_SHARE("p_ram") AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( qtsbc_io, AS_IO, 8, qtsbc_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x06, 0x06) AM_READ(qtsbc_06_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x43, 0x43) AM_READ(qtsbc_43_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( qtsbc ) +INPUT_PORTS_END + + +void qtsbc_state::machine_reset() +{ + UINT8* bios = memregion("maincpu")->base()+0x10000; + memcpy(m_p_ram, bios, 0x800); +} + +WRITE8_MEMBER( qtsbc_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( qtsbc, qtsbc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) // Mostek MK3880 + MCFG_CPU_PROGRAM_MAP(qtsbc_mem) + MCFG_CPU_IO_MAP(qtsbc_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(qtsbc_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( qtsbc ) + ROM_REGION( 0x10800, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "qtsbc.bin", 0x10000, 0x0800, CRC(823fd942) SHA1(64c4f74dd069ae4d43d301f5e279185f32a1efa0)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, qtsbc, 0, 0, qtsbc, qtsbc, driver_device, 0, "Computer Systems Inc.", "QT SBC +2/4", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/qx10.c b/src/mame/drivers/qx10.c new file mode 100644 index 00000000000..c69fe705e72 --- /dev/null +++ b/src/mame/drivers/qx10.c @@ -0,0 +1,787 @@ +// license:BSD-3-Clause +// copyright-holders:Mariusz Wojcieszek, Angelo Salese +/*************************************************************************** + + QX-10 + + Preliminary driver by Mariusz Wojcieszek + + Status: + Driver boots and load CP/M from floppy image. Needs upd7220 for gfx + + Done: + - preliminary memory map + - floppy (upd765) + - DMA + - Interrupts (pic8295) + + banking: + - 0x1c = 0 + AM_RANGE(0x0000,0x1fff) ROM + AM_RANGE(0x2000,0xdfff) NOP + AM_RANGE(0xe000,0xffff) RAM + - 0x1c = 1 0x20 = 1 + AM_RANGE(0x0000,0x7fff) RAM (0x18 selects bank) + AM_RANGE(0x8000,0x87ff) CMOS + AM_RANGE(0x8800,0xdfff) NOP or previous bank? + AM_RANGE(0xe000,0xffff) RAM + - 0x1c = 1 0x20 = 0 + AM_RANGE(0x0000,0xdfff) RAM (0x18 selects bank) + AM_RANGE(0xe000,0xffff) RAM +****************************************************************************/ + + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/z80dart.h" +#include "machine/mc146818.h" +#include "machine/i8255.h" +#include "machine/am9517a.h" +#include "video/upd7220.h" +#include "machine/upd765.h" +#include "machine/ram.h" +#include "machine/qx10kbd.h" + +#define MAIN_CLK 15974400 + +#define RS232_TAG "rs232" + +/* + Driver data +*/ + +class qx10_state : public driver_device +{ +public: + qx10_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_pit_1(*this, "pit8253_1"), + m_pit_2(*this, "pit8253_2"), + m_pic_m(*this, "pic8259_master"), + m_pic_s(*this, "pic8259_slave"), + m_scc(*this, "upd7201"), + m_ppi(*this, "i8255"), + m_dma_1(*this, "8237dma_1"), + m_dma_2(*this, "8237dma_2"), + m_fdc(*this, "upd765"), + m_hgdc(*this, "upd7220"), + m_rtc(*this, "rtc"), + m_kbd(*this, "kbd"), + m_vram_bank(0), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette") + { + } + + required_device m_pit_1; + required_device m_pit_2; + required_device m_pic_m; + required_device m_pic_s; + required_device m_scc; + required_device m_ppi; + required_device m_dma_1; + required_device m_dma_2; + required_device m_fdc; + required_device m_hgdc; + required_device m_rtc; + required_device m_kbd; + UINT8 m_vram_bank; + //required_shared_ptr m_video_ram; + UINT16 *m_video_ram; + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + + void update_memory_mapping(); + + DECLARE_WRITE8_MEMBER( qx10_18_w ); + DECLARE_WRITE8_MEMBER( prom_sel_w ); + DECLARE_WRITE8_MEMBER( cmos_sel_w ); + DECLARE_WRITE_LINE_MEMBER( qx10_upd765_interrupt ); + DECLARE_READ8_MEMBER( fdc_dma_r ); + DECLARE_WRITE8_MEMBER( fdc_dma_w ); + DECLARE_WRITE8_MEMBER( fdd_motor_w ); + DECLARE_READ8_MEMBER( qx10_30_r ); + DECLARE_READ8_MEMBER( gdc_dack_r ); + DECLARE_WRITE8_MEMBER( gdc_dack_w ); + DECLARE_WRITE_LINE_MEMBER( tc_w ); + DECLARE_READ8_MEMBER( mc146818_r ); + DECLARE_WRITE8_MEMBER( mc146818_w ); + DECLARE_READ8_MEMBER( get_slave_ack ); + DECLARE_READ8_MEMBER( vram_bank_r ); + DECLARE_WRITE8_MEMBER( vram_bank_w ); + DECLARE_READ16_MEMBER( vram_r ); + DECLARE_WRITE16_MEMBER( vram_w ); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_WRITE_LINE_MEMBER(keyboard_clk); + DECLARE_WRITE_LINE_MEMBER(keyboard_irq); + + UINT8 *m_char_rom; + + /* FDD */ + int m_fdcint; + int m_fdcmotor; + int m_fdcready; + + /* memory */ + int m_membank; + int m_memprom; + int m_memcmos; + UINT8 m_cmosram[0x800]; + + UINT8 m_color_mode; + + struct{ + UINT8 rx; + }m_rs232c; + + DECLARE_PALETTE_INIT(qx10); + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); + required_device m_maincpu; + required_device m_ram; + required_device m_palette; + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); + UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); +}; + +UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int xi,gfx[3]; + UINT8 pen; + + if(m_color_mode) + { + gfx[0] = m_video_ram[((address) + 0x00000) >> 1]; + gfx[1] = m_video_ram[((address) + 0x20000) >> 1]; + gfx[2] = m_video_ram[((address) + 0x40000) >> 1]; + } + else + { + gfx[0] = m_video_ram[(address) >> 1]; + gfx[1] = 0; + gfx[2] = 0; + } + + for(xi=0;xi<16;xi++) + { + pen = ((gfx[0] >> xi) & 1) ? 1 : 0; + pen|= ((gfx[1] >> xi) & 1) ? 2 : 0; + pen|= ((gfx[2] >> xi) & 1) ? 4 : 0; + + bitmap.pix32(y, x + xi) = palette[pen]; + } +} + +UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + int x; + int xi,yi; + int tile; + int attr; + UINT8 color; + UINT8 tile_data; + UINT8 pen; + + for( x = 0; x < pitch; x++ ) + { + tile = m_video_ram[((addr+x)*2) >> 1] & 0xff; + attr = m_video_ram[((addr+x)*2) >> 1] >> 8; + + color = (m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */ + + for( yi = 0; yi < lr; yi++) + { + tile_data = (m_char_rom[tile*16+yi]); + + if(attr & 8) + tile_data^=0xff; + + if(cursor_on && cursor_addr == addr+x) //TODO + tile_data^=0xff; + + if(attr & 0x80 && machine().first_screen()->frame_number() & 0x10) //TODO: check for blinking interval + tile_data=0; + + for( xi = 0; xi < 8; xi++) + { + int res_x,res_y; + + res_x = x * 8 + xi; + res_y = y + yi; + + if(!machine().first_screen()->visible_area().contains(res_x, res_y)) + continue; + + if(yi >= 16) + pen = 0; + else + pen = ((tile_data >> xi) & 1) ? color : 0; + + if(pen) + bitmap.pix32(res_y, res_x) = palette[pen]; + } + } + } +} + +UINT32 qx10_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) +{ + bitmap.fill(m_palette->black_pen(), cliprect); + + m_hgdc->screen_update(screen, bitmap, cliprect); + + return 0; +} + +/* + Memory +*/ +void qx10_state::update_memory_mapping() +{ + int drambank = 0; + + if (m_membank & 1) + { + drambank = 0; + } + else if (m_membank & 2) + { + drambank = 1; + } + else if (m_membank & 4) + { + drambank = 2; + } + else if (m_membank & 8) + { + drambank = 3; + } + + if (!m_memprom) + { + membank("bank1")->set_base(memregion("maincpu")->base()); + } + else + { + membank("bank1")->set_base(m_ram->pointer() + drambank*64*1024); + } + if (m_memcmos) + { + membank("bank2")->set_base(m_cmosram); + } + else + { + membank("bank2")->set_base(m_ram->pointer() + drambank*64*1024 + 32*1024); + } +} + +READ8_MEMBER( qx10_state::fdc_dma_r ) +{ + return m_fdc->dma_r(); +} + +WRITE8_MEMBER( qx10_state::fdc_dma_w ) +{ + m_fdc->dma_w(data); +} + + +WRITE8_MEMBER( qx10_state::qx10_18_w ) +{ + m_membank = (data >> 4) & 0x0f; + update_memory_mapping(); +} + +WRITE8_MEMBER( qx10_state::prom_sel_w ) +{ + m_memprom = data & 1; + update_memory_mapping(); +} + +WRITE8_MEMBER( qx10_state::cmos_sel_w ) +{ + m_memcmos = data & 1; + update_memory_mapping(); +} + +/* + FDD +*/ + +static SLOT_INTERFACE_START( qx10_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER( qx10_state::qx10_upd765_interrupt ) +{ + m_fdcint = state; + + //logerror("Interrupt from upd765: %d\n", state); + // signal interrupt + m_pic_m->ir6_w(state); +} + +WRITE8_MEMBER( qx10_state::fdd_motor_w ) +{ + m_fdcmotor = 1; + + machine().device("upd765:0")->get_device()->mon_w(false); + // motor off controlled by clock +} + +READ8_MEMBER( qx10_state::qx10_30_r ) +{ + floppy_image_device *floppy1,*floppy2; + + floppy1 = machine().device("upd765:0")->get_device(); + floppy2 = machine().device("upd765:1")->get_device(); + + return m_fdcint | + /*m_fdcmotor*/ 0 << 1 | + ((floppy1 != NULL) || (floppy2 != NULL) ? 1 : 0) << 3 | + m_membank << 4; +} + +/* + DMA8237 +*/ +WRITE_LINE_MEMBER(qx10_state::dma_hrq_changed) +{ + /* Assert HLDA */ + m_dma_1->hack_w(state); +} + +READ8_MEMBER( qx10_state::gdc_dack_r ) +{ + logerror("GDC DACK read\n"); + return 0; +} + +WRITE8_MEMBER( qx10_state::gdc_dack_w ) +{ + logerror("GDC DACK write %02x\n", data); +} + +WRITE_LINE_MEMBER( qx10_state::tc_w ) +{ + /* floppy terminal count */ + m_fdc->tc_w(!state); +} + +/* + 8237 DMA (Master) + Channel 1: Floppy disk + Channel 2: GDC + Channel 3: Option slots +*/ +READ8_MEMBER(qx10_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(qx10_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.write_byte(offset, data); +} + +/* + 8237 DMA (Slave) + Channel 1: Option slots #1 + Channel 2: Option slots #2 + Channel 3: Option slots #3 + Channel 4: Option slots #4 +*/ + +/* + MC146818 +*/ + +WRITE8_MEMBER(qx10_state::mc146818_w) +{ + m_rtc->write(space, !offset, data); +} + +READ8_MEMBER(qx10_state::mc146818_r) +{ + return m_rtc->read(space, !offset); +} + +WRITE_LINE_MEMBER(qx10_state::keyboard_irq) +{ + m_scc->m1_r(); // always set + m_pic_m->ir4_w(state); +} + +WRITE_LINE_MEMBER(qx10_state::keyboard_clk) +{ + // clock keyboard too + m_scc->rxca_w(state); + m_scc->txca_w(state); +} + +/* + Master PIC8259 + IR0 Power down detection interrupt + IR1 Software timer #1 interrupt + IR2 External interrupt INTF1 + IR3 External interrupt INTF2 + IR4 Keyboard/RS232 interrupt + IR5 CRT/lightpen interrupt + IR6 Floppy controller interrupt + IR7 Slave cascade +*/ + +READ8_MEMBER( qx10_state::get_slave_ack ) +{ + if (offset==7) { // IRQ = 7 + return m_pic_s->acknowledge(); + } + return 0x00; +} + + +/* + Slave PIC8259 + IR0 Printer interrupt + IR1 External interrupt #1 + IR2 Calendar clock interrupt + IR3 External interrupt #2 + IR4 External interrupt #3 + IR5 Software timer #2 interrupt + IR6 External interrupt #4 + IR7 External interrupt #5 + +*/ + +READ8_MEMBER( qx10_state::vram_bank_r ) +{ + return m_vram_bank; +} + +WRITE8_MEMBER( qx10_state::vram_bank_w ) +{ + if(m_color_mode) + { + m_vram_bank = data & 7; + if(data != 1 && data != 2 && data != 4) + printf("%02x\n",data); + } +} + +static ADDRESS_MAP_START(qx10_mem, AS_PROGRAM, 8, qx10_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x7fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x8000, 0xdfff ) AM_RAMBANK("bank2") + AM_RANGE( 0xe000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( qx10_io , AS_IO, 8, qx10_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253_1", pit8253_device, read, write) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("pit8253_2", pit8253_device, read, write) + AM_RANGE(0x08, 0x09) AM_DEVREADWRITE("pic8259_master", pic8259_device, read, write) + AM_RANGE(0x0c, 0x0d) AM_DEVREADWRITE("pic8259_slave", pic8259_device, read, write) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("upd7201", z80dart_device, cd_ba_r, cd_ba_w) + AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("i8255", i8255_device, read, write) + AM_RANGE(0x18, 0x1b) AM_READ_PORT("DSW") AM_WRITE(qx10_18_w) + AM_RANGE(0x1c, 0x1f) AM_WRITE(prom_sel_w) + AM_RANGE(0x20, 0x23) AM_WRITE(cmos_sel_w) + AM_RANGE(0x2c, 0x2c) AM_READ_PORT("CONFIG") + AM_RANGE(0x2d, 0x2d) AM_READWRITE(vram_bank_r,vram_bank_w) + AM_RANGE(0x30, 0x33) AM_READWRITE(qx10_30_r, fdd_motor_w) + AM_RANGE(0x34, 0x35) AM_DEVICE("upd765", upd765a_device, map) + AM_RANGE(0x38, 0x39) AM_DEVREADWRITE("upd7220", upd7220_device, read, write) +// AM_RANGE(0x3a, 0x3a) GDC zoom +// AM_RANGE(0x3b, 0x3b) GDC light pen req + AM_RANGE(0x3c, 0x3d) AM_READWRITE(mc146818_r, mc146818_w) + AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("8237dma_1", am9517a_device, read, write) + AM_RANGE(0x50, 0x5f) AM_DEVREADWRITE("8237dma_2", am9517a_device, read, write) +// AM_RANGE(0xfc, 0xfd) Multi-Font comms +ADDRESS_MAP_END + +/* Input ports */ +/* TODO: shift break */ +/*INPUT_CHANGED_MEMBER(qx10_state::key_stroke) +{ + if(newval && !oldval) + { + m_keyb.rx = (UINT8)(FPTR)(param) & 0x7f; + m_pic_m->ir4_w(1); + } + + if(oldval && !newval) + m_keyb.rx = 0; +}*/ + +static INPUT_PORTS_START( qx10 ) + /* TODO: All of those have unknown meaning */ + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x00, "DSW" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) //CMOS related + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("CONFIG") + PORT_CONFNAME( 0x03, 0x02, "Video Board" ) + PORT_CONFSETTING( 0x02, "Monochrome" ) + PORT_CONFSETTING( 0x01, "Color" ) + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +void qx10_state::machine_start() +{ +} + +void qx10_state::machine_reset() +{ + m_dma_1->dreq0_w(1); + + m_memprom = 0; + m_memcmos = 0; + m_membank = 0; + update_memory_mapping(); + + { + int i; + + /* TODO: is there a bit that sets this up? */ + m_color_mode = ioport("CONFIG")->read() & 1; + + if(m_color_mode) //color + { + for ( i = 0; i < 8; i++ ) + m_palette->set_pen_color(i, pal1bit((i >> 2) & 1), pal1bit((i >> 1) & 1), pal1bit((i >> 0) & 1)); + } + else //monochrome + { + for ( i = 0; i < 8; i++ ) + m_palette->set_pen_color(i, pal1bit(0), pal1bit(0), pal1bit(0)); + + m_palette->set_pen_color(1, 0x00, 0x9f, 0x00); + m_palette->set_pen_color(2, 0x00, 0xff, 0x00); + m_vram_bank = 0; + } + } +} + +/* F4 Character Displayer */ +static const gfx_layout qx10_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + RGN_FRAC(1,1), /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( qx10 ) + GFXDECODE_ENTRY( "chargen", 0x0000, qx10_charlayout, 1, 1 ) +GFXDECODE_END + +void qx10_state::video_start() +{ + // allocate memory + m_video_ram = auto_alloc_array_clear(machine(), UINT16, 0x30000); + + // find memory regions + m_char_rom = memregion("chargen")->base(); +} + +PALETTE_INIT_MEMBER(qx10_state, qx10) +{ + // ... +} + +READ16_MEMBER( qx10_state::vram_r ) +{ + int bank = 0; + + if (m_vram_bank & 1) { bank = 0; } // B + else if(m_vram_bank & 2) { bank = 1; } // G + else if(m_vram_bank & 4) { bank = 2; } // R + + return m_video_ram[offset + (0x20000 * bank)]; +} + +WRITE16_MEMBER( qx10_state::vram_w ) +{ + int bank = 0; + + if (m_vram_bank & 1) { bank = 0; } // B + else if(m_vram_bank & 2) { bank = 1; } // G + else if(m_vram_bank & 4) { bank = 2; } // R + + COMBINE_DATA(&m_video_ram[offset + (0x20000 * bank)]); +} + +static ADDRESS_MAP_START( upd7220_map, AS_0, 16, qx10_state ) + AM_RANGE(0x00000, 0x5ffff) AM_READWRITE(vram_r,vram_w) +ADDRESS_MAP_END + +static SLOT_INTERFACE_START(keyboard) + SLOT_INTERFACE("qx10", QX10_KEYBOARD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( qx10, qx10_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, MAIN_CLK / 4) + MCFG_CPU_PROGRAM_MAP(qx10_mem) + MCFG_CPU_IO_MAP(qx10_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(qx10_state, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", qx10) + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(qx10_state, qx10) + + /* Devices */ + +/* + Timer 0 + Counter CLK Gate OUT Operation + 0 Keyboard clock (1200bps) Memory register D0 Speaker timer Speaker timer (100ms) + 1 Keyboard clock (1200bps) +5V 8259A (10E) IR5 Software timer + 2 Clock 1,9668MHz Memory register D7 8259 (12E) IR1 Software timer +*/ + + MCFG_DEVICE_ADD("pit8253_1", PIT8253, 0) + MCFG_PIT8253_CLK0(1200) + MCFG_PIT8253_CLK1(1200) + MCFG_PIT8253_CLK2(MAIN_CLK / 8) + +/* + Timer 1 + Counter CLK Gate OUT Operation + 0 Clock 1,9668MHz +5V Speaker frequency 1kHz + 1 Clock 1,9668MHz +5V Keyboard clock 1200bps (Clock / 1664) + 2 Clock 1,9668MHz +5V RS-232C baud rate 9600bps (Clock / 208) +*/ + MCFG_DEVICE_ADD("pit8253_2", PIT8253, 0) + MCFG_PIT8253_CLK0(MAIN_CLK / 8) + MCFG_PIT8253_CLK1(MAIN_CLK / 8) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(qx10_state, keyboard_clk)) + MCFG_PIT8253_CLK2(MAIN_CLK / 8) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("upd7201", z80dart_device, rxtxcb_w)) + + MCFG_PIC8259_ADD("pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(qx10_state, get_slave_ack)) + MCFG_PIC8259_ADD("pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL) + + MCFG_UPD7201_ADD("upd7201", MAIN_CLK/4, 0, 0, 0, 0) // channel b clock set by pit2 channel 2 + // Channel A: Keyboard + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("kbd", rs232_port_device, write_txd)) + // Channel B: RS232 + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(WRITELINE(qx10_state, keyboard_irq)) + + MCFG_DEVICE_ADD("8237dma_1", AM9517A, MAIN_CLK/4) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(qx10_state, dma_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(qx10_state, tc_w)) + MCFG_I8237_IN_MEMR_CB(READ8(qx10_state, memory_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(qx10_state, memory_write_byte)) + MCFG_I8237_IN_IOR_0_CB(READ8(qx10_state, fdc_dma_r)) + MCFG_I8237_IN_IOR_1_CB(READ8(qx10_state, gdc_dack_r)) + //MCFG_I8237_IN_IOR_2_CB(DEVREAD8("upd7220", upd7220_device, dack_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(qx10_state, fdc_dma_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(qx10_state, gdc_dack_w)) + //MCFG_I8237_OUT_IOW_2_CB(DEVWRITE8("upd7220", upd7220_device, dack_w)) + MCFG_DEVICE_ADD("8237dma_2", AM9517A, MAIN_CLK/4) + + MCFG_DEVICE_ADD("i8255", I8255, 0) + + MCFG_DEVICE_ADD("upd7220", UPD7220, MAIN_CLK/6) // unk clock + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(qx10_state, hgdc_display_pixels) + MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(qx10_state, hgdc_draw_text) + MCFG_VIDEO_SET_SCREEN("screen") + + MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) + MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir2_w)) + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(qx10_state, qx10_upd765_interrupt)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("8237dma_1", am9517a_device, dreq0_w)) MCFG_DEVCB_INVERT + MCFG_FLOPPY_DRIVE_ADD("upd765:0", qx10_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", qx10_floppies, "525dd", floppy_image_device::default_floppy_formats) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, rxb_w)) + + MCFG_RS232_PORT_ADD("kbd", keyboard, "qx10") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd7201", z80dart_device, rxa_w)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "qx10_flop") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( qx10 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v006", "v0.06") + ROMX_LOAD( "ipl006.bin", 0x0000, 0x0800, CRC(3155056a) SHA1(67cc0ae5055d472aa42eb40cddff6da69ffc6553), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v003", "v0.03") + ROMX_LOAD( "ipl003.bin", 0x0000, 0x0800, CRC(3cbc4008) SHA1(cc8c7d1aa0cca8f9753d40698b2dc6802fd5f890), ROM_BIOS(2)) + + /* This is probably the i8039 program ROM for the Q10MF Multifont card, and the actual font ROMs are missing (6 * HM43128) */ + /* The first part of this rom looks like code for an embedded controller? + From 0300 on, is a keyboard lookup table */ + ROM_REGION( 0x0800, "i8039", 0 ) + ROM_LOAD( "m12020a.3e", 0x0000, 0x0800, CRC(fa27f333) SHA1(73d27084ca7b002d5f370220d8da6623a6e82132)) + + ROM_REGION( 0x1000, "chargen", 0 ) +// ROM_LOAD( "qge.2e", 0x0000, 0x0800, BAD_DUMP CRC(ed93cb81) SHA1(579e68bde3f4184ded7d89b72c6936824f48d10b)) //this one contains special characters only + ROM_LOAD( "qge.2e", 0x0000, 0x1000, BAD_DUMP CRC(eb31a2d5) SHA1(6dc581bf2854a07ae93b23b6dfc9c7abd3c0569e)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, qx10, 0, 0, qx10, qx10, driver_device, 0, "Epson", "QX-10", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/radio86.c b/src/mame/drivers/radio86.c new file mode 100644 index 00000000000..c1b08bed357 --- /dev/null +++ b/src/mame/drivers/radio86.c @@ -0,0 +1,561 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Radio-86RK driver by Miodrag Milanovic + + 15/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/wave.h" +#include "machine/i8255.h" +#include "imagedev/cassette.h" +#include "formats/rk_cas.h" +#include "includes/radio86.h" + +/* Address maps */ +static ADDRESS_MAP_START(radio86_mem, AS_PROGRAM, 8, radio86_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM + AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) + //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) + AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video + AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( radio86_io , AS_IO, 8, radio86_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00, 0xff ) AM_READWRITE(radio_io_r,radio_io_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( rk7007_io , AS_IO, 8, radio86_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x80, 0x83 ) AM_DEVREADWRITE("ms7007", i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(radio86rom_mem, AS_PROGRAM, 8, radio86_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM + AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) + AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) + AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video + AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(radio86ram_mem, AS_PROGRAM, 8, radio86_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x1000, 0xdfff ) AM_RAM // RAM + AM_RANGE( 0xe000, 0xe7ff ) AM_ROM // System ROM page 2 + AM_RANGE( 0xe800, 0xf5ff ) AM_RAM // RAM + AM_RANGE( 0xf700, 0xf703 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE( 0xf780, 0xf7bf ) AM_DEVREADWRITE("i8275", i8275_device, read, write) // video + AM_RANGE( 0xf684, 0xf687 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) + AM_RANGE( 0xf688, 0xf688 ) AM_WRITE(radio86_pagesel ) + AM_RANGE( 0xf800, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM page 1 +ADDRESS_MAP_END + +static ADDRESS_MAP_START(radio86_16_mem, AS_PROGRAM, 8, radio86_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x1000, 0x3fff ) AM_RAM // RAM + AM_RANGE( 0x4000, 0x7fff ) AM_READ(radio_cpu_state_r) + AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) + //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) + AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video + AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(mikron2_mem, AS_PROGRAM, 8, radio86_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM + AM_RANGE( 0xc000, 0xc003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x00fc) + //AM_RANGE( 0xc100, 0xc103 ) AM_DEVREADWRITE_LEGACY("ppi8255_2", i8255a_r, i8255a_w) AM_MIRROR(0x00fc) + AM_RANGE( 0xc200, 0xc201 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x00fe) // video + AM_RANGE( 0xc300, 0xc3ff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(impuls03_mem, AS_PROGRAM, 8, radio86_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM + AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) + AM_RANGE( 0xa000, 0xbfff ) AM_ROM // Basic ROM + AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video + AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA + AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( radio86 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) +INPUT_PORTS_END + +INPUT_PORTS_START( ms7007 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(' ') PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR(')') PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('\'') PORT_CHAR('7') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('(') PORT_CHAR('8') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('\xA4') PORT_CHAR('4') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('"') PORT_CHAR('2') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('#') PORT_CHAR('3') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('%') PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('&') PORT_CHAR('6') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("LINE8") + PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("CLINE0") + PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + + PORT_START("CLINE1") + PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR('+') + + PORT_START("CLINE2") + PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + + PORT_START("CLINE3") + PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("CLINE4") + PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + + PORT_START("CLINE5") + PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + + PORT_START("CLINE6") + PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + + PORT_START("CLINE7") + PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) +INPUT_PORTS_END + +/* F4 Character Displayer */ +static const gfx_layout radio86_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( radio86 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, radio86_charlayout, 0, 1 ) +GFXDECODE_END + + +/* Machine driver */ +static MACHINE_CONFIG_START( radio86, radio86_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_16MHz / 9) + MCFG_CPU_PROGRAM_MAP(radio86_mem) + MCFG_CPU_IO_MAP(radio86_io) + MCFG_MACHINE_RESET_OVERRIDE(radio86_state, radio86 ) + + MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) + + MCFG_DEVICE_ADD("i8275", I8275, XTAL_16MHz / 12) + MCFG_I8275_CHARACTER_WIDTH(6) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(radio86_state, display_pixels) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma8257",i8257_device, dreq2_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(78*6, 30*10) + MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", radio86) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(radio86_state,radio86) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(radio86_state, hrq_w)) + MCFG_I8257_IN_MEMR_CB(READ8(radio86_state, memory_read_byte)) + MCFG_I8257_OUT_MEMW_CB(WRITE8(radio86_state, memory_write_byte)) + MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("i8275", i8275_device, dack_w)) + MCFG_I8257_REVERSE_RW_MODE(1) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rkr_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("radio86_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "radio86_cass") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( radio16, radio86 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(radio86_16_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( radiorom, radio86 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(radio86rom_mem) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(radio86_state, radio86rom_romdisk_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(radio86_state, radio86_romdisk_portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_romdisk_portc_w)) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "radio86_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_SOFTWARE_LIST_ADD("cart_list", "radio86_cart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( radioram, radio86 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(radio86ram_mem) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(radio86_state, radio86ram_romdisk_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(radio86_state, radio86_romdisk_portb_w)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_romdisk_portc_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( rk7007, radio86 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(rk7007_io) + + MCFG_DEVICE_ADD("ms7007", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, rk7007_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( rk700716, radio16 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(rk7007_io) + + MCFG_DEVICE_ADD("ms7007", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) + MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) + MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, rk7007_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mikron2, radio86 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(mikron2_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( impuls03, radio86 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(impuls03_mem) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( radio86 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bios.rom", 0xf800, 0x0800, CRC(bf1ceea5) SHA1(8f3d472203e550e9854dd79e1f44628635581ed0)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( radio4k ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bios4k.rom", 0xf000, 0x1000, CRC(2ac9d864) SHA1(296716c6cddc9dd31d500ba421aa807c45757cfd)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( spektr01 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "spektr001.rom", 0xf800, 0x0800, CRC(5a38e6d5) SHA1(799c3bbe2a9f08f3aba55379cc093329048350ff)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( radio16 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "rk86.16k", 0xf800, 0x0800, CRC(fd8a4caf) SHA1(90d6af571049a7c8748eac03541e921eac3f70c5)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( radiorom ) + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "32k", "32 KB rom disk") + ROMX_LOAD( "radiorom.rom", 0xf800, 0x0800, CRC(b5cdeab7) SHA1(1c80d72082f2fb2190b575726cb82d86ae0ee7d8), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "64k", "64 KB rom disk") + ROMX_LOAD( "radiorom.64", 0xf800, 0x0800, CRC(5250b927) SHA1(e885e0f5b2325190b38a4c92b20a8b4fa78fbd8f), ROM_BIOS(2)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( radioram ) + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "r86-1.bin", 0xf800, 0x0800, CRC(7e7ab7cb) SHA1(fedb00b6b8fbe1167faba3e4611b483f800e6934)) + ROM_LOAD( "r86-2.bin", 0xe000, 0x0800, CRC(955f0616) SHA1(d2b9f960558bdcb60074091fc79d1ad56c313586)) + ROM_LOAD( "romdisk.bin", 0x10000, 0x10000, CRC(43c0279b) SHA1(bc1dfd9bdbce39460616e2158f5d96279d0af3cf)) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( rk7007 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ms7007.rom", 0xf800, 0x0800, CRC(002811dc) SHA1(4529eb72198c49af77fbcd7833bcd06a1cf9b1ac)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( rk700716 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ms7007.16k", 0xf800, 0x0800, CRC(5268d7b6) SHA1(efd69d8456b8cf8b37f33237153c659725608528)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( mikron2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mikron2.bin", 0xf800, 0x0800, CRC(2cd79bb4) SHA1(501df47e65aaa8f4ce27751bc2a7e7089e2e888c)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END + +ROM_START( kr03 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "kr03-dd17.rf2", 0xf800, 0x0800, CRC(ac2e24d5) SHA1(a1317a261bfd55b3b37109b14d1391308dee04de)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("kr03-dd12.rf2", 0x0000, 0x0800, CRC(085f4259) SHA1(11c5829b072a00961ad936c26559fb63bf2dc896)) +ROM_END + +ROM_START( impuls03 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "imp03bas.rom", 0xa000, 0x2000, CRC(b13b2de4) SHA1(9af8c49d72ca257bc34cad3c62e530730929702e)) + ROM_LOAD( "imp03mon.rom", 0xf800, 0x0800, CRC(8c591ce4) SHA1(8e8e9cba6b3123d74218b92f4b4210606ba53376)) + ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) + ROM_REGION(0x0800, "gfx1",0) + ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) +ROM_END +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, radio86, 0, 0, radio86, radio86, radio86_state, radio86, "", "Radio-86RK", 0) +COMP( 1986, radio16, radio86, 0, radio16, radio86, radio86_state, radio86, "", "Radio-86RK (16K RAM)", 0) +COMP( 1986, kr03, radio86, 0, radio86, radio86, radio86_state, radio86, "Elektronika", "KR-03", 0) +COMP( 1986, radio4k, radio86, 0, radio86, radio86, radio86_state, radio86, "", "Radio-86RK (4K ROM)", 0) +COMP( 1986, radiorom, radio86, 0, radiorom, radio86, radio86_state, radio86, "", "Radio-86RK (ROM-Disk)", 0) +COMP( 1986, radioram, radio86, 0, radioram, radio86, radio86_state, radioram, "", "Radio-86RK (ROM/RAM Disk)", 0) +COMP( 1986, spektr01, radio86, 0, radio86, radio86, radio86_state, radio86, "", "Spektr-001", 0) +COMP( 1986, rk7007, radio86, 0, rk7007, ms7007, radio86_state, radio86, "", "Radio-86RK (MS7007)", 0) +COMP( 1986, rk700716, radio86, 0, rk700716, ms7007, radio86_state, radio86, "", "Radio-86RK (MS7007 16K RAM)", 0) +COMP( 1986, mikron2, radio86, 0, mikron2, radio86, radio86_state, radio86, "", "Mikron-2", 0) +COMP( 1986, impuls03, radio86, 0, impuls03, radio86, radio86_state, radio86, "", "Impuls-03", 0) diff --git a/src/mame/drivers/rainbow.c b/src/mame/drivers/rainbow.c new file mode 100644 index 00000000000..aab93ed3d0f --- /dev/null +++ b/src/mame/drivers/rainbow.c @@ -0,0 +1,2465 @@ +// license:GPL-2.0+ +// copyright-holders:Miodrag Milanovic,Karl-Ludwig Deisenhofer +/*************************************************************************************************** +DEC Rainbow 100 + +Driver-in-progress by R. Belmont and Miodrag Milanovic. +Portions (2013 - 2015) by Karl-Ludwig Deisenhofer (Floppy, ClikClok RTC, NVRAM, DIPs, hard disk). + +STATE AS OF APRIL 2015 +---------------------- +Driver is based entirely on the DEC-100 'B' variant (DEC-190 and DEC-100 A models are treated as clones). +While this is OK for the compatible -190, it doesn't do justice to ancient '100 A' hardware. +RBCONVERT.ZIP has details on how model 'A' differs from version B. + +Issues with this driver: + +(1) Keyboard emulation incomplete (fatal; inhibits the system from booting with ERROR 50). + +Serial ports do not work, so serial communication failure (ERROR 60) and ERROR 40 (serial +printer interface) result. Unfortunately the BIOS tests all three serial interfaces in line. + +(2) while DOS 3 and UCSD systems (fort_sys, pas_sys) + diag disks boot, CPM 2.x and DOS 2.x die +in secondary boot loader with a RESTORE (seek track 0) when track 2 sector 1 should be loaded. + +Writing files to floppy is next to impossible on both CPM 1.x and DOS 3 (these two OS boot +with keyboard workarounds enabled). File deletion works, so few bytes pass. + +(3) heavy system interaction stalls the driver. Start one of the torture tests on the diag.disk +and see what happens (system interaction, Z80, about any test except the video / CRT tests). + +(4) arbitration chip (E11; in 100-A schematics or E13 in -B) should be dumped. +It is a 6308 OTP ROM (2048 bit, 256 x 8) used as a lookup table (LUT) with the address pins (A) +used as inputs and the data pins (D) as output. + +Plays a role in DMA access to lower memory (limited to 64 K; Extended communication option only). +Arbiter is also involved in refresh and shared memory contention (affects Z80/8088 CPU cycles). + +=> INPUTS on E13 (PC-100 B): + +SH5 RF SH REQ H -> Pin 19 (A7) shared memory request / refresh ? + 1K -> +5 V -> Pin 18 (A6) < UNUSED > +SH 2 BDL ACK (L) -> Pin 17 (A5) BUNDLE OPTION: IRQ acknowledged +SH 2 NONSHRCYC H -> Pin 5 (A4) unshared memory cycle is in progress +SH 2 PRECHARGE H -> Pin 4 (A3) +SH 2 SHMUX 88 ENB -> Pin 3 (A2) shared memory +SH2 DO REFRESH H -> Pin 2 (A1) indicates that extended memory must be refreshed -> on J6 as (L) +SH10 BDL REQ (L) -> Pin 1 (A0) BUNDLE OPTION wishes to use shared memory + + +UPGRADES WORTH EMULATING: +- SHOULD BE IMPLEMENTED AS SLOT DEVICES (for now, DIP settings affect 'system_parameter_r' only and are disabled): + +* Color graphics option (uses NEC upd7220 GDC). REFERENCE: Programmer's Reference: AA-AE36A-TV. +Either 384 x 240 x 16 or 800 x 240 x 4 colors (out of 4096). 8 ? 64 K video RAM. Pallette limited to 4 colors on 100-A. +Graphics output is independent from monochrome output. + +* Extended communication option (occupies BUNDLE_OPTION 1 + 2) REFERENCE: AA-V172A-TV + Addendum AV-Y890A-TV. +Two ports, a high-speed RS-422 half-duplex interface (port A) + lower-speed RS-423 full/half-duplex interface +with modem control (port B). A 5 Mhz. 8237 DMA controller transfers data into and out of shared memory (not: optional RAM). + +Uses SHRAM, SHMA, BDL SH WR L, NONSHARED CYCLE. Implementation requires DMA and arbitration logic (dump of E11/E13 ?). +Can't be added if RD51 hard disk controller present (J4 + J5). For programming info see NEWCOM1.DOC (-> RBETECDOC.ZIP). + + +* ( NO DUMP YET ) PC character set. Enhances Code Blue emulation. Simple CHARACTER ROM replacement? + +* ( NO DUMP YET ) TCS / Technical Character Set ('$95 from DEC, for Rainbow 100, 100B, 100+ ; separate docs available') + Source: price list of a DEC reseller. Possibly identical to http://vt100.net/charsets/technical.html + +* 8087 Numerical Data Coprocessor daughterboard. REFERENCE: EK-PCNDP-IN-PRE +Daughterboard, to be plugged into the expansion port where the memory expansion card usually sits (J6). +If a memory adapter board is present, it has to be plugged into a connector atop the 8087 copro board. +The 8088 is put into the CPU socket on the coprocessor board. +SOFTWARE: MATH test on 'Design Maturity Diagnostics'; AutoCad, TurboPascal and Fortran. + +* Suitable Solutions TURBOW286: 12 Mhz, 68-pin, low power AMD N80L286-12 and WAYLAND/EDSUN EL286-88-10-B ( 80286 to 8088 Processor Signal Converter ) +plus DC 7174 or DT 7174 (barely readable). Add-on card, replaces main 8088 cpu (via ribbon cable). Patched V5.03 BOOT ROM labeled 'TBSS1.3 - 3ED4'. + +* NEC_V20 (requires modded BOOT ROM because of - at least 2 - hard coded timing loops): +100A: 100B/100+: 100B+ ALTERNATE RECOMMENDATION (fixes RAM size auto-detection problems when V20 is in place. +Tested on a 30+ year old live machine. Your mileage may vary) + +Location Data Location Data Loc.|Data +.... .. .... .. ------------------ 00C6 46 [ increases 'wait for Z80' from approx. 27,5 ms (old value 40) to 30,5 ms ] +.... .. .... .. ------------------ 0303 00 [ disable CHECKSUM ] +043F 64 072F 64 <-----------------> 072F 73 [ increases minimum cycle time from 2600 (64) to 3000 ms (73) ] +067D 20 0B36 20 <-----------------> 0B36 20 [ USE A VALUE OF 20 FOR THE NEC - as in the initial patch! CHANGES CAUSE VFR-ERROR 10 ] +1FFE 2B 3FFE 1B (BIOS CHECKSUM) +1FFF 70 3FFF 88 (BIOS CHECKSUM) + +-------------------------------------------------------------- +Meaning of Diagnostics LEDs (from PC100ESV1.PDF found, e.g., +on ftp://ftp.update.uu.se/pub/rainbow/doc/rainbow-docs/ + +Internal Diagnostic Messages F +Msg Message Lights Display A +No. * = on o = off T +..........................................- = on or off A +..........................................1 2 3 4 5 6 7 L +-------------------------------------------------------------- +.1 Main Board (Video) o * * o * o * Yes +.2 Main Board* (unsolicited interrupt) * * * * o * o Yes +.3 Drive A or B (index) o o * o o * * +.4 Drive A or B (motor) * * o o o * * +.5 Drive A or B (seek) o * o o o * * +.6 Drive A or B (read) * o o o o * * +.7 Drive A or B (restore) o * * o o * * +.8 Drive A or B (step) * o * o o * * +.9 System Load incomplete+ (System Load) o o o o o o o +10 Main Board (video, vfr) * * * o * o * Yes +11 System Load incomplete+ (Boot Load) o o o o o o o +12 Drive A or B (not ready) o o o o o * * +13 Keyboard * * o * o * o Yes +14 Main Board (nvm data) * * * * o * * +15 (no msg. 15 in that table) +16 Interrupts off* * * * o o o o Cond. +17 Main Board (video RAM) * * * o * * o Yes +18 Main Board (Z80 crc) * * * * o o * Yes +19 Main Board RAM (0-64K) - - - * * o * Yes +20 Main Board (unsolicited int., Z80) * * * o o o * Yes +21 Drive Not Ready+ o o o o o o o +22 Remove Card or Diskette o * * o o o * +23 Non-System Diskette+ o o o o o o o +24 new memory size = nnnK o o o o o o o +25 Set Up Defaults stored o o o o o o o +26 Main Board (RAM arbitration) * * * o * o o Yes +27 Main Board (RAM option) - - - * * o o +28 RX50 controller board * * * o o * * +29 Main Board* (Z80 response) * * * * o o o +30 Main Board (ROM crc, ROM 0) * * * * * * * Yes +31 Main Board (ROM crc, ROM 1) * * * * * * o Yes +- Main Board (ROM crc, ROM 2) * * * o * * * Yes +33 Main Board (contention) o o o o o * o Yes +40 Main Board (printer port) * o * * o * o +50 Main Board (keyboard port) o o * * o * o Yes +60 Main Board (comm port) o * * * o * o +-------------------------------------------------------------- +* These errors can occur at any time because the circuits +are monitored constantly ++ These messages may occur during power-up if auto boot is +selected + +PCB layout +========== + +DEC-100 model B += part no.70-19974-02 according to document EK-RB100-TM_001 + +PCB # 5416206 / 5016205-01C1: + +7-6-5-4 |3-2-1 +DIAGNOSTIC-LEDs |J3 | |J2 | |J1 | +|------|----8088|Z80-|--|VIDEO|-|PRINTER|-|SERIAL|----| +| 2 x 64 K |/KBD.| !!!!!| +| R A M NEC D7201C |P|!W90!| +| |O|!!!!!| +| [W6] ROM 1 INTEL 8088 |W| | +| (23-020e5-00) |E| | +| |R| | +| ...J5.. BOOT ROM 0 ...J4... =J8 | +| (23-022e5-00) | +| ...J6... | +| [W5] | +| | +| INTEL 8251A ZILOG Z 80A | +| [W18] | +| A 4x 74 LS 244 | +| M S [W15] | +| 9 - DEC-DC011 74 LS 245 | +| 1 R [W14] | +| 2 A [W13] | +| 8 M CHARGEN.- | +| ROM (4K) ...J7... | ...J9 = RX50 | +| | +|-------------PCB# 5416206 / 5016205-01C1-------------| + +CONNECTORS ("J"): + ...J5... ...J4... both: RD51 controller (hard disk) + ...J5... ...J4... both: EXTENDED COMM. controller + + ...J6... is the MEMORY OPTION connector (52 pin) + ...J7... is the GRAPHICS OPTION connector (40 pin) + ...J9... RX50 FLOPPY CONTROLLER (40 pin; REQUIRED) + +JUMPERS (labeled "W"): + W5 + W6 are out when 16K x 8 EPROMS are used +/ W5 + W6 installed => 32 K x 8 EPROMs (pin 27 = A14) + +W13, W14, W15, W18 = for manufacturing tests. +=> W13 - W15 affect diagnostic read register (port $0a) +=> W18 pulls DSR to ground and affects 8251A - port $11 (bit 7) + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! DO NOT SHORT JUMPER / CONNECTOR [W90] ON LIVE HARDWARE !! +!! !! +!! WARNING: CIRCUIT DAMAGE could occur if this jumper is !! +!! set by end users. See PDF document AA-V523A-TV. !! +!! !! +!! W90 connects to pin 2 (Voltage Bias on PWR connector J8)!! +!! and is designed FOR ===> FACTORY TESTS OF THE PSU <=== !! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +WIRE CONNECTORS - SEEN ON SCHEMATICS - NOT PRESENT ON DEC-100 B (-A only?): +W16 pulls J2 printer port pin 1 to GND when set (chassis to logical GND). +W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND). +****************************************************************************/ + +// --------------------------------------------------------------------------- +// WORKAROUNDS: +// (1) FORCE LOGO: - not valid for 100-A ROM - +//#define FORCE_RAINBOW_B_LOGO + +// (2) KEYBOARD_WORKAROUND : also requires FORCE...LOGO (and preliminary headers) +//#define KEYBOARD_WORKAROUND +//#define KBD_DELAY 8 // (debounce delay) +// --------------------------------------------------------------------------- + + +// Define standard and maximum RAM sizes (A, then B model): +//#define BOARD_RAM 0x0ffff // 64 K base RAM (100-A) +//#define END_OF_RAM 0xcffff // very last byte (100-A) DO NOT CHANGE. + +// DEC-100-B probes until a 'flaky' area is found (BOOT ROM around F400:0E04). +// It is no longer possible to key in the RAM size from within the 100-B BIOS. +#define BOARD_RAM 0x1ffff // 128 K base RAM (100-B) +#define END_OF_RAM 0xdffff // very last byte (100-B) DO NOT CHANGE. + +// ---------------------------------------------------------------------------------------------- +#include "emu.h" +#include "cpu/i86/i86.h" +#include "cpu/z80/z80.h" +#include "video/vtvideo.h" + +#include "machine/wd_fdc.h" +#include "formats/rx50_dsk.h" +#include "formats/pc_dsk.h" // PC Formats (TESTING) +#include "imagedev/flopdrv.h" + +#include "imagedev/harddriv.h" +#include "machine/wd2010.h" + +#include "machine/i8251.h" +#include "machine/clock.h" +#include "machine/dec_lk201.h" +#include "machine/nvram.h" + +#include "machine/ds1315.h" + +#include "rainbow.lh" // BEZEL - LAYOUT with LEDs for diag 1-7, keyboard 8-11 and floppy 20-23 + +#define LK201_TAG "lk201" +#define FD1793_TAG "fd1793x" + +#define INVALID_DRIVE 255 +#define MAX_FLOPPIES 4 + +class rainbow_state : public driver_device +{ +public: + rainbow_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + +#ifdef KEYBOARD_WORKAROUND +#include "./m_kbd1.c" +#endif + + + m_inp1(*this, "W13"), + m_inp2(*this, "W14"), + m_inp3(*this, "W15"), + m_inp4(*this, "W18"), + m_inp5(*this, "HARD DISK PRESENT"), // DO NOT CHANGE ORDER (also: COMMUNICATION EXTENSION) + m_inp6(*this, "FLOPPY CONTROLLER"), // DO NOT CHANGE ORDER + m_inp7(*this, "GRAPHICS OPTION"), // DO NOT CHANGE ORDER + m_inp8(*this, "MEMORY PRESENT"), // DO NOT CHANGE ORDER + m_inp9(*this, "MONITOR TYPE"), + m_inp10(*this, "J17"), + m_inp11(*this, "CLIKCLOK"), + m_inp12(*this, "WATCHDOG"), + + m_crtc(*this, "vt100_video"), + m_i8088(*this, "maincpu"), + m_z80(*this, "subcpu"), + m_fdc(*this, FD1793_TAG), + + m_hdc(*this, "hdc"), + + m_kbd8251(*this, "kbdser"), + m_lk201(*this, LK201_TAG), + m_p_ram(*this, "p_ram"), + + m_p_vol_ram(*this, "vol_ram"), + m_p_nvram(*this, "nvram"), + + m_shared(*this, "sh_ram"), + + m_rtc(*this, "rtc") + { + } + + DECLARE_READ8_MEMBER(read_video_ram_r); + DECLARE_WRITE_LINE_MEMBER(clear_video_interrupt); + //DECLARE_WRITE8_MEMBER(hd_status_10C_w); // MHFU DISABLE REGISTER (W) + + DECLARE_READ8_MEMBER(diagnostic_r); + DECLARE_WRITE8_MEMBER(diagnostic_w); + + DECLARE_READ8_MEMBER(comm_control_r); + DECLARE_WRITE8_MEMBER(comm_control_w); + + DECLARE_READ8_MEMBER(share_z80_r); + DECLARE_WRITE8_MEMBER(share_z80_w); + + // 'RD51' MFM CONTROLLER (WD1010) ************************************* + DECLARE_READ8_MEMBER(hd_status_60_r); // TRI STATE DATA PORT (R/W) + DECLARE_WRITE8_MEMBER(hd_status_60_w); + + DECLARE_READ8_MEMBER(hd_status_68_r); // EXTRA REGISTER 0x68 (R/W 8088) + DECLARE_WRITE8_MEMBER(hd_status_68_w); + + DECLARE_READ8_MEMBER(hd_status_69_r); // EXTRA REGISTER 0x69 (R/- 8088) + + DECLARE_WRITE_LINE_MEMBER(bundle_irq); + DECLARE_WRITE_LINE_MEMBER(hdc_bdrq); // BUFFER DATA REQUEST (FROM WD) + DECLARE_WRITE_LINE_MEMBER(hdc_bcr); // BUFFER COUNTER RESET (FROM WD) + + DECLARE_WRITE_LINE_MEMBER(hdc_step); + DECLARE_WRITE_LINE_MEMBER(hdc_direction); + + DECLARE_WRITE_LINE_MEMBER(hdc_read_sector); + DECLARE_WRITE_LINE_MEMBER(hdc_write_sector); + + DECLARE_READ_LINE_MEMBER(hdc_drive_ready); + DECLARE_READ_LINE_MEMBER(hdc_write_fault); + + DECLARE_READ8_MEMBER(i8088_latch_r); + DECLARE_WRITE8_MEMBER(i8088_latch_w); + DECLARE_READ8_MEMBER(z80_latch_r); + DECLARE_WRITE8_MEMBER(z80_latch_w); + + DECLARE_WRITE8_MEMBER(z80_diskdiag_read_w); + DECLARE_WRITE8_MEMBER(z80_diskdiag_write_w); + + DECLARE_READ8_MEMBER(z80_generalstat_r); + + DECLARE_READ8_MEMBER(z80_diskstatus_r); + DECLARE_WRITE8_MEMBER(z80_diskcontrol_w); + + DECLARE_READ8_MEMBER(system_parameter_r); + + DECLARE_WRITE_LINE_MEMBER(kbd_tx); + DECLARE_WRITE_LINE_MEMBER(kbd_rxready_w); + DECLARE_WRITE_LINE_MEMBER(kbd_txready_w); + + DECLARE_WRITE_LINE_MEMBER(irq_hi_w); + + DECLARE_READ8_MEMBER(rtc_reset); + DECLARE_READ8_MEMBER(rtc_enable); + DECLARE_READ8_MEMBER(rtc_r); + + DECLARE_READ8_MEMBER(rtc_reset2); + DECLARE_READ8_MEMBER(rtc_enable2); + DECLARE_READ8_MEMBER(rtc_r2); + + DECLARE_READ8_MEMBER(rtc_w); + + +#ifdef KEYBOARD_WORKAROUND +#include "./port9x_Ax.c" +#endif + UINT32 screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vblank_irq); + + DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); + TIMER_DEVICE_CALLBACK_MEMBER(motor_tick); + + DECLARE_FLOPPY_FORMATS(floppy_formats); +protected: + virtual void machine_start(); + +private: + enum + { // LOWEST PRIORITY + // Mnemonic - - - - - - TYPE ADDRESS - Source + // [1][0] [1][0] <= Depends on DTR(L) output of keyboard PUSART (on Rainbow-100 B) + IRQ_8088_MAILBOX = 0, // 27/A7 9C/29C - [built-in] Interrupt from Z80A + IRQ_8088_KBD, // 26/A6 98/298 - [built-in] KEYBOARD Interrupt - 8251A + IRQ_BDL_INTR_L, // 25/A5 94/294 - [ext. BUNDLE OPTION] Hard disk or Extended communication IRQ (no DMA) + // IRQ_COMM_PTR_INTR_L, // 24/A4 90/290 - [built-in 7201] Communication/Printer interrupt + // IRQ_DMAC_INTR_L, // 23/A3 8C/28C - [ext. COMM.BOARD only] - external DMA Controller (8237) interrupt + // IRQ_GRF_INTR_L, // 22/A2 88/288 - [ext. COLOR GRAPHICS] + // IRQ_BDL_INTR_1L, // 21/A1 84/284 - [ext. COMM.BOARD only] + IRQ_8088_VBL, // 20/A0 80/280 - [built-in DC012] - VERT INTR L (= schematics) + IRQ_8088_NMI // 02/02 08/08 - [external MEMORY EXTENSION] - PARITY ERROR L + }; // HIGHEST PRIORITY + + +#ifdef KEYBOARD_WORKAROUND +#include "./m_kbd2.c" +#endif + + required_ioport m_inp1; + required_ioport m_inp2; + required_ioport m_inp3; + required_ioport m_inp4; + required_ioport m_inp5; + required_ioport m_inp6; + required_ioport m_inp7; + required_ioport m_inp8; + required_ioport m_inp9; + required_ioport m_inp10; + required_ioport m_inp11; + required_ioport m_inp12; + required_device m_crtc; + required_device m_i8088; + required_device m_z80; + + required_device m_fdc; + optional_device m_hdc; + + required_device m_kbd8251; + required_device m_lk201; + required_shared_ptr m_p_ram; + required_shared_ptr m_p_vol_ram; + required_shared_ptr m_p_nvram; + required_shared_ptr m_shared; + + optional_device m_rtc; + + void raise_8088_irq(int ref); + void lower_8088_irq(int ref); + + void update_8088_irqs(); + + void update_bundle_irq(); // RD51 or COMM.OPTION! + int do_write_sector(); + void hdc_buffer_counter_reset(); + void hdc_reset(); + + hard_disk_file *rainbow_hdc_file(int ref); + + bool m_SCREEN_BLANK; + + int INT88, INTZ80; + + bool m_zflip; // Z80 alternate memory map with A15 inverted + bool m_z80_halted; + int m_z80_diskcontrol; // retains values needed for status register + + bool m_kbd_tx_ready, m_kbd_rx_ready; + int m_KBD; + + int m_beep_counter; + int MOTOR_DISABLE_counter; + + int COLD_BOOT; + UINT8 m_diagnostic; + + UINT8 m_z80_private[0x800]; // Z80 private 2K + UINT8 m_z80_mailbox, m_8088_mailbox; + + void update_kbd_irq(); + virtual void machine_reset(); + + int m_unit; + floppy_image_device *m_floppy; + + int m_irq_high; + UINT32 m_irq_mask; + + int m_bdl_irq; + int m_hdc_buf_offset; + + bool m_hdc_index_latch; + bool m_hdc_step_latch; + int m_hdc_direction; + bool m_hdc_track0; + bool m_hdc_write_gate; + + bool m_hdc_drive_ready; + bool m_hdc_write_fault; + + UINT8 m_hdc_buffer[2048]; +}; + +// initially only RX50IMG_FORMAT, FLOPPY_TD0_FORMAT, (IMD + PC : TESTING !!) +FLOPPY_FORMATS_MEMBER(rainbow_state::floppy_formats) +FLOPPY_RX50IMG_FORMAT, +FLOPPY_TD0_FORMAT, +FLOPPY_IMD_FORMAT, +FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +// initially only : SLOT_INTERFACE("525qd", FLOPPY_525_SSQD) +static SLOT_INTERFACE_START(rainbow_floppies) +SLOT_INTERFACE("525qd0", FLOPPY_525_SSQD) +SLOT_INTERFACE("525qd1", FLOPPY_525_SSQD) +SLOT_INTERFACE("525qd2", FLOPPY_525_SSQD) +SLOT_INTERFACE("525qd3", FLOPPY_525_SSQD) +SLOT_INTERFACE_END +// testing: SLOT_INTERFACE("35ssdd", FLOPPY_35_SSDD) + +void rainbow_state::machine_start() +{ + MOTOR_DISABLE_counter = 2; // soon resets drv.LEDs + COLD_BOOT = 1; + + m_SCREEN_BLANK = false; + + save_item(NAME(m_z80_private)); + save_item(NAME(m_z80_mailbox)); + save_item(NAME(m_8088_mailbox)); + save_item(NAME(m_zflip)); + save_item(NAME(m_kbd_tx_ready)); + save_item(NAME(m_kbd_rx_ready)); + save_item(NAME(m_irq_high)); + save_item(NAME(m_irq_mask)); + +#ifdef FORCE_RAINBOW_B_LOGO + UINT8 *rom = memregion("maincpu")->base(); + + rom[0xf4000 + 0x364a] = 2 + 8; // 2 :set ; 4 : reset, 8 : set for 0xf4363 ( 0363 WAIT_FOR_BIT3__loc_35E ) + + rom[0xf4000 + 0x0363] = 0x90; + rom[0xf4000 + 0x0364] = 0x90; + + // If bit 2 = 1 (Efff9), then a keyboard powerup is necessary (=> will lock up in current state) + rom[0xf4000 + 0x3638] = 0x80; // OR instead of TEST + rom[0xf4000 + 0x3639] = 0x0f; // OR instead of TEST + rom[0xf4000 + 0x363a] = 0x08; // 04 => 08 + + rom[0xf4000 + 0x363b] = 0xeb; // COND => JMPS + + if (rom[0xf4174] == 0x75) + { + rom[0xf4174] = 0xeb; // jmps RAINBOW100_LOGO__loc_33D + rom[0xf4175] = 0x08; + } + + if (rom[0xf4000 + 0x3ffc] == 0x31) // 100-B + rom[0xf4384] = 0xeb; // JMPS => BOOT80 + + if (rom[0xf4000 + 0x3ffc] == 0x35) // v5.05 + rom[0xf437b] = 0xeb; + + //TEST-DEBUG: always reset NVM to defaults (!) + //rom[0x3d6c] = 0x90; + //rom[0x3d6d] = 0x90; +#endif + +#ifdef KEYBOARD_WORKAROUND +#include "./rainbow_keyboard0.c" +#endif +} + +static ADDRESS_MAP_START(rainbow8088_map, AS_PROGRAM, 8, rainbow_state) +ADDRESS_MAP_UNMAP_HIGH +AM_RANGE(0x00000, 0x0ffff) AM_RAM AM_SHARE("sh_ram") +AM_RANGE(0x10000, END_OF_RAM) AM_RAM + +// There is a 2212 (256 x 4 bit) NVRAM from 0xed000 to 0xed0ff (*) +// shadowed at $ec000 - $ecfff and from $ed100 - $edfff. + +// (*) ED000 - ED0FF is the area the DEC-100-B BIOS accesses and checks + +// - Specs say that the CPU has direct access to volatile RAM only. +// So NVRAM is hidden and loads & saves are triggered within the +// 'diagnostic_w' handler (similar to real hardware). + +// - Address bits 8-12 are ignored (-> AM_MIRROR). +AM_RANGE(0xed000, 0xed0ff) AM_RAM AM_SHARE("vol_ram") AM_MIRROR(0x1f00) +AM_RANGE(0xed100, 0xed1ff) AM_RAM AM_SHARE("nvram") + +AM_RANGE(0xee000, 0xeffff) AM_RAM AM_SHARE("p_ram") +AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(rainbow8088_io, AS_IO, 8, rainbow_state) +ADDRESS_MAP_UNMAP_HIGH +//ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_GLOBAL_MASK(0x1ff) +AM_RANGE(0x00, 0x00) AM_READWRITE(i8088_latch_r, i8088_latch_w) + +// 0x02 Communication status / control register (8088) +AM_RANGE(0x02, 0x02) AM_READWRITE(comm_control_r, comm_control_w) + +AM_RANGE(0x04, 0x04) AM_DEVWRITE("vt100_video", rainbow_video_device, dc011_w) + +// TODO: unmapped [06] : Communication bit rates (see page 21 of PC 100 SPEC) + +AM_RANGE(0x08, 0x08) AM_READ(system_parameter_r) + +AM_RANGE(0x0a, 0x0a) AM_READWRITE(diagnostic_r, diagnostic_w) + +AM_RANGE(0x0c, 0x0c) AM_DEVWRITE("vt100_video", rainbow_video_device, dc012_w) + +// TODO: unmapped [0e] : PRINTER BIT RATE REGISTER (WO) + +AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("kbdser", i8251_device, data_r, data_w) +AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("kbdser", i8251_device, status_r, control_w) + +// =========================================================== +// There are 4 select lines for Option Select 1 to 4 +// Option Select ------------------- Bundle Option Present +// 1 2 3 4: BDL PRES (L): +// X X o o Communication Option----- X +// o X o o RD51 hard disk controller X --------- (X = SELECT) +// =========================================================== +// 0x20 -> 0x2f ***** EXTENDED COMM. OPTION / Option Select 1. +// See boot rom @1EA6: 0x27 (<- RESET EXTENDED COMM OPTION ) +// =========================================================== +// 0x30 -> 0x3f ***** Option Select 3 +// =========================================================== +// 0x40 COMMUNICATIONS DATA REGISTER (MPSC) +// 0x41 PRINTER DATA REGISTER (MPSC) +// 0x42 COMMUNICATIONS CONTROL / STATUS REGISTER (MPSC) +// 0x43 PRINTER CONTROL / STATUS REGISTER (MPSC) +// =========================================================== +// 0x50 - 0x57 ***** COLOR GRAPHICS OPTION: +// 50h Graphics option software reset. Any write to this +// port also resynchronizes the read/modify/write memory +// cycles of the Graphics Option to those of the GDC (*) +// * see boot ROM @1EB4/8 +// 51h Data written to this port is loaded into the area +// selected by the previous write to port 53h. + +// 52h Data written to this port is loaded into the Write Buffer. + +// 53h Data written to this port provides address selection +// for indirect addressing (see Indirect Register). + +// 54h Data written to this port is loaded into the low-order +// byte of the Write Mask. + +// 55h Data written to this port is loaded into the high-order +// byte of the Write Mask. + +// 56h Data written to this port is loaded into the GDC's FIFO +// Buffer and flagged as a parameter. +// =========================================================== +// 0x60 -> 0x6f ***** EXTENDED COMM. OPTION / Option Select 2. +// =========================================================== +// 0x60 -> 0x6f ***** RD51 HD. CONTROLLER / Option Select 2. +AM_RANGE(0x60, 0x67) AM_DEVREADWRITE("hdc", wd2010_device, read, write) +AM_RANGE(0x68, 0x68) AM_READWRITE(hd_status_68_r, hd_status_68_w) +AM_RANGE(0x69, 0x69) AM_READ(hd_status_69_r) +// =========================================================== +// THE RD51 CONTROLLER: +// - WD1010AL - 00 (WDC '83) +// + 2 K x 8 SRAM (SY2128-4 or Japan 8328) 21-17872-01 +// + 74(L)Sxxx glue logic (drive/head select, buffers etc.) +// + 10 Mhz Quartz (/2) +// SERVICE JUMPERS (not to be removed for normal operation): +// JUMPER "W1" : bridge between 10 Mhz master clock and board +// JUMPER "W2" : bridges SYNC within Read Data Circuit +// JUMPER "W3" : bridges 'drive read data' (from hard disk) +// Later RD51 boards (> '83 week 28 ?) have no jumpers at all. +// =========================================================== +// DEC RD TYPE (MByte) CYL ---- HEADS ---- MODEL (typical) +// DEC RD50 (5 Mbyte): 153 cyl. 4 heads -- ST506 +// DEC RD51(10 Mbyte); 306 cyl. 4 heads -- ST412 +// DEC RD31(20 Mbyte); 615 cyl. 4 heads -- ST225 +// DEC RD52(32 Mbyte); 512 cyl. 8 heads -- Q540 [!] +// DEC RD32(40 Mbyte); 820 cyl. 6 heads -- ST251 [!] +// DEC RD53(67 Mbyte); 1024 cyl.8 heads -- 1325 [!] +// [!] More than 4 heads. Prepare with WUTIL and / or DSKPREP. + +// SIZE RESTRICTIONS +// * HARDWARE: +// WD1010 controller has a built-in limit of 8 heads / 1024 cylinders. +// * BOOT LOADERS: +// - the DEC boot loader (and FDISK from DOS 3.10) initially allowed a maximum hard disc size of 20 MB. +// - the custom boot loader that comes with 'WUTIL 3.2' allows 117 MB and 8 surfaces. +// * SOFTWARE: +// - MS-DOS 2 allows a maximum partition size of 16 MB (sizes > 15 MB are incompatible to DOS 3) +// [ no more than 4 partitions of 8 MB size on one hard disk possible ] +// - MS-DOS 3 - and Concurrent CPM - have a global 32 MB (1024 cylinder) limit +// - a CP/M-86-80 partition can have up to 8 MB (all CP/M partitions together must not exceed 10 MB) +// =========================================================== +// 0x70 -> 0x7f ***** Option Select 4 +// =========================================================== +// 0x10c +AM_RANGE(0x10c, 0x10c) AM_DEVWRITE("vt100_video", rainbow_video_device, dc012_w) + + +#ifdef KEYBOARD_WORKAROUND +#include "./am_range_9x_Ax.c" +#endif + +ADDRESS_MAP_END + +static ADDRESS_MAP_START(rainbowz80_mem, AS_PROGRAM, 8, rainbow_state) +ADDRESS_MAP_UNMAP_HIGH +AM_RANGE(0x0000, 0xffff) AM_READWRITE(share_z80_r, share_z80_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(rainbowz80_io, AS_IO, 8, rainbow_state) +ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_GLOBAL_MASK(0xff) +AM_RANGE(0x00, 0x00) AM_READWRITE(z80_latch_r, z80_latch_w) +AM_RANGE(0x20, 0x20) AM_READWRITE(z80_generalstat_r, z80_diskdiag_read_w) // read to port 0x20 used by MS-DOS 2.x diskette loader. +AM_RANGE(0x21, 0x21) AM_READWRITE(z80_generalstat_r, z80_diskdiag_write_w) +AM_RANGE(0x40, 0x40) AM_READWRITE(z80_diskstatus_r, z80_diskcontrol_w) +AM_RANGE(0x60, 0x63) AM_DEVREADWRITE(FD1793_TAG, fd1793_t, read, write) + +// Z80 I/O shadow area > $80 +AM_RANGE(0x80, 0x80) AM_READWRITE(z80_latch_r, z80_latch_w) +AM_RANGE(0xA0, 0xA0) AM_READWRITE(z80_generalstat_r, z80_diskdiag_read_w) // read to port 0x20 used by MS-DOS 2.x diskette loader. +AM_RANGE(0xA1, 0xA1) AM_READWRITE(z80_generalstat_r, z80_diskdiag_write_w) +AM_RANGE(0xC0, 0xC0) AM_READWRITE(z80_diskstatus_r, z80_diskcontrol_w) +AM_RANGE(0xE0, 0xE3) AM_DEVREADWRITE(FD1793_TAG, fd1793_t, read, write) +ADDRESS_MAP_END + +/* Input ports */ + +/* DIP switches */ +static INPUT_PORTS_START(rainbow100b_in) + +#ifdef KEYBOARD_WORKAROUND +#include "./rainbow_ipt.c" +#endif +PORT_START("MONITOR TYPE") +PORT_DIPNAME(0x03, 0x03, "MONOCHROME MONITOR") +PORT_DIPSETTING(0x01, "WHITE") +PORT_DIPSETTING(0x02, "GREEN") +PORT_DIPSETTING(0x03, "AMBER") + +// MEMORY, FLOPPY, BUNDLE, GRAPHICS affect 'system_parameter_r': +PORT_START("MEMORY PRESENT") +PORT_DIPNAME(0xF0000, 0x20000, "MEMORY PRESENT") +PORT_DIPSETTING(0x10000, "64 K (MINIMUM ON 100-A)") // see BOARD_RAM +PORT_DIPSETTING(0x20000, "128 K (MINIMUM ON 100-B)") +PORT_DIPSETTING(0x30000, "192 K (w. MEMORY OPTION)") +PORT_DIPSETTING(0x40000, "256 K (w. MEMORY OPTION)") +PORT_DIPSETTING(0x50000, "320 K (100-B MEMORY OPTION)") +PORT_DIPSETTING(0x60000, "384 K (100-B MEMORY OPTION)") +PORT_DIPSETTING(0x70000, "448 K (100-B MEMORY OPTION)") +PORT_DIPSETTING(0x80000, "512 K (100-B MEMORY OPTION)") +PORT_DIPSETTING(0x90000, "576 K (100-B MEMORY OPTION)") +PORT_DIPSETTING(0xA0000, "640 K (100-B MEMORY OPTION)") +PORT_DIPSETTING(0xB0000, "704 K (100-B MEMORY OPTION)") +PORT_DIPSETTING(0xC0000, "768 K (100-B MEMORY OPTION)") +PORT_DIPSETTING(0xD0000, "832 K (100-B MEMORY OPTION)") // see END_OF_RAM +PORT_DIPSETTING(0xE0000, "896 K (100-B MAX. MEMORY)") + +PORT_START("FLOPPY CONTROLLER") // floppy controller is not optional +PORT_DIPNAME(0x01, 0x01, "FLOPPY CONTROLLER") PORT_TOGGLE +PORT_DIPSETTING(0x01, DEF_STR(On)) + +// EXT.COMM.card -or- RD51 HD. controller (marketed later). +PORT_START("HARD DISK PRESENT") // BUNDLE_OPTION +PORT_DIPNAME(0x01, 0x00, "HARD DISK PRESENT") PORT_TOGGLE +PORT_DIPSETTING(0x00, DEF_STR(Off)) +PORT_DIPSETTING(0x01, DEF_STR(On)) + +PORT_START("CLIKCLOK") // DS1315 RTC +PORT_DIPNAME(0x01, 0x00, "REAL TIME CLOCK (CLIKCLOK)") PORT_TOGGLE +PORT_DIPSETTING(0x00, DEF_STR(Off)) +PORT_DIPSETTING(0x01, DEF_STR(On)) + +PORT_START("GRAPHICS OPTION") // NEC COLOR GRAPHICS not implemented yet +PORT_DIPNAME(0x00, 0x00, "GRAPHICS OPTION") PORT_TOGGLE +PORT_DIPSETTING(0x00, DEF_STR(Off)) +PORT_DIPSETTING(0x01, DEF_STR(On)) + +// W13 - W18 are used for factory tests and affect the boot process - +PORT_START("W13") +PORT_DIPNAME(0x02, 0x02, "W13 (FACTORY TEST A, LEAVE OFF)") PORT_TOGGLE +PORT_DIPSETTING(0x02, DEF_STR(Off)) +PORT_DIPSETTING(0x00, DEF_STR(On)) + +PORT_START("W14") +PORT_DIPNAME(0x04, 0x04, "W14 (FACTORY TEST B, LEAVE OFF)") PORT_TOGGLE +PORT_DIPSETTING(0x04, DEF_STR(Off)) +PORT_DIPSETTING(0x00, DEF_STR(On)) +PORT_START("W15") +PORT_DIPNAME(0x08, 0x08, "W15 (FACTORY TEST C, LEAVE OFF)") PORT_TOGGLE +PORT_DIPSETTING(0x08, DEF_STR(Off)) +PORT_DIPSETTING(0x00, DEF_STR(On)) + +PORT_START("W18") // DSR = 1 when switch is OFF - see i8251.c +PORT_DIPNAME(0x01, 0x00, "W18 (FACTORY TEST D, LEAVE OFF) (8251A: DSR)") PORT_TOGGLE +PORT_DIPSETTING(0x00, DEF_STR(Off)) +PORT_DIPSETTING(0x01, DEF_STR(On)) +PORT_WRITE_LINE_DEVICE_MEMBER("kbdser", i8251_device, write_dsr) + +// J17 jumper on FDC controller board shifts drive select (experimental) - +PORT_START("J17") +PORT_DIPNAME(0x02, 0x00, "J17 DRIVE SELECT (A => C and B => D)") PORT_TOGGLE +PORT_DIPSETTING(0x00, DEF_STR(Off)) +PORT_DIPSETTING(0x02, DEF_STR(On)) + +PORT_START("WATCHDOG") +PORT_DIPNAME(0x01, 0x01, "WATCHDOG ENABLED (MHFU)") PORT_TOGGLE +PORT_DIPSETTING(0x00, DEF_STR(Off)) +PORT_DIPSETTING(0x01, DEF_STR(On)) + +INPUT_PORTS_END + +void rainbow_state::machine_reset() +{ + /* configure RAM */ + address_space &program = machine().device("maincpu")->space(AS_PROGRAM); + if (m_inp8->read() < END_OF_RAM) + { + program.unmap_readwrite(m_inp8->read(), END_OF_RAM); + } + // BIOS can't handle soft resets (would trigger ERROR 16). + // As a fallback, execute a hard reboot! + if (COLD_BOOT == 2) + { // FIXME: ask for confirmation (via UI ?) + device().machine().schedule_hard_reset(); + } + + /* ***************************************************************************************************************** + Suitable Solutions ClikClok (one of the more compatible battery backed real time clocks) + + DESCRIPTION: plugs into NVRAM chip socket on a 100-A and into one of the (EP)ROM sockets on the 100-B + ............ (there is a socket on the ClikClok for the NVRAM / EPROM chip). + + DS1315 phantom clock. No address space needed (-> IRQs must be disabled to block ROM accesses during reads). + + DRIVERS: 'rbclik.zip' DOS and CP/M binaries plus source from DEC employee; Reads & displays times. Y2K READY. + + 'newclk.arc' (Suitable Solutions; sets time and date; uses FE000 and up). 2 digit year here. + + TODO: obtain hardware / check address decoders. Access logic here is derived from Vincent Esser's source. + *****************************************************************************************************************/ + + // * Reset RTC to a defined state * + #define RTC_RESET 0xFC104 // read $FC104 or mirror $FE104 + program.install_read_handler(RTC_RESET, RTC_RESET, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_reset), this)); + program.install_read_handler(RTC_RESET + 0x2000, RTC_RESET + 0x2000, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_reset2), this)); + + // A magic pattern enables reads or writes (-> RTC_WRITE_DATA_0 / RTC_WRITE_DATA_1) + // 64 bits read from two alternating addresses (see DS1315.C) + #define RTC_PATTERN_0 0xFC100 // MIRROR: FE100 + #define RTC_PATTERN_1 0xFC101 // MIRROR: FE101 + program.install_read_handler(RTC_PATTERN_0, RTC_PATTERN_1, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_enable), this)); + program.install_read_handler(RTC_PATTERN_0 + 0x2000, RTC_PATTERN_1 + 0x2000, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_enable2), this)); + + // * Read actual time/date from ClikClok * + #define RTC_READ_DATA 0xFC004 // Single byte - delivers one bit (if RTC enabled). MIRROR: FE004 + program.install_read_handler(RTC_READ_DATA, RTC_READ_DATA, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_r), this)); + program.install_read_handler(RTC_READ_DATA + 0x2000, RTC_READ_DATA + 0x2000, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_r2), this)); + + // * Secretly transmit data to RTC (set time / date) * Works only if magic pattern enabled RTC. Look ma, no writes! + #define RTC_WRITE_DATA_0 0xFE000 + #define RTC_WRITE_DATA_1 0xFE001 + program.install_read_handler(RTC_WRITE_DATA_0, RTC_WRITE_DATA_1, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_w), this)); + + m_rtc->chip_reset(); + // *********************************** / DS1315 'PHANTOM CLOCK' IMPLEMENTATION FOR 'DEC-100-B' *************************************** + + + if (COLD_BOOT == 1) + { + COLD_BOOT = 2; + m_crtc->MHFU(-100); // reset MHFU counter + } + + // *********** HARD DISK CONTROLLER... + if (m_inp5->read() == 0x01) // ...PRESENT? + { + // Install 8088 read / write handler + address_space &io = machine().device("maincpu")->space(AS_IO); + io.unmap_readwrite(0x60, 0x60); + io.install_read_handler(0x60, 0x60, read8_delegate(FUNC(rainbow_state::hd_status_60_r), this)); + io.install_write_handler(0x60, 0x60, write8_delegate(FUNC(rainbow_state::hd_status_60_w), this)); + + hdc_reset(); + m_hdc_drive_ready = true; + m_hdc_write_fault = false; + + hard_disk_file *local_hard_disk; + local_hard_disk = rainbow_hdc_file(0); // one hard disk for now. + + output_set_value("led1", 0); + if (local_hard_disk) + { + hard_disk_info *info; + if ( (info = hard_disk_get_info(local_hard_disk)) ) + { + output_set_value("led1", 1); + + UINT32 max_sector = (info->cylinders) * (info->heads) * (info->sectors); + printf("\n%u MB HARD DISK: HEADS (1..8 OK) = %d / CYL. (151..1024 OK) = %d / SPT. (16 OK) = %d / SECTOR_BYTES (128..1024 OK) = %d\n", max_sector * 512 / 1000000, + info->heads, info->cylinders, info->sectors, info->sectorbytes); + } + } + } + + // *********** FLOPPY DISK CONTROLLER + m_unit = INVALID_DRIVE; + m_fdc->reset(); + m_fdc->set_floppy(NULL); + m_fdc->dden_w(0); + + m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_z80_halted = true; + m_zflip = true; + + INTZ80 = false; + INT88 = false; + + m_kbd_tx_ready = m_kbd_rx_ready = false; + m_kbd8251->write_cts(1); + m_KBD = 0; + + m_irq_high = 0; + + // RESET ALL LEDs + output_set_value("led1", 1); + output_set_value("led2", 1); + output_set_value("led3", 1); + output_set_value("led4", 1); + output_set_value("led5", 1); + output_set_value("led6", 1); + output_set_value("led7", 1); + + // GREEN KEYBOARD LEDs (1 = on, 0 = off): + output_set_value("led_wait", 0); // led8 + output_set_value("led_compose", 0); // led9 + output_set_value("led_lock", 0); // led10 + output_set_value("led_hold", 0); // led11 + + m_irq_mask = 0; +} + +#ifdef KEYBOARD_WORKAROUND +#include "./rainbow_keyboard2.c" +#endif + +UINT32 rainbow_state::screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +/* + // Suppress display when accessing floppy (switch to 'smooth scroll' when working with DOS, please)! + if (MOTOR_DISABLE_counter) // IF motor running... + { + if (m_p_vol_ram[0x84] == 0x00) // IF jump scroll + return 0; + } +*/ + m_crtc->palette_select(m_inp9->read()); + + if (m_SCREEN_BLANK) + m_crtc->video_blanking(bitmap, cliprect); + else + m_crtc->video_update(bitmap, cliprect); + return 0; +} + +// Interrupt handling and arbitration. See 3.1.3.8 OF PC-100 spec. +void rainbow_state::update_8088_irqs() +{ + static const int vectors[] = { 0x27, 0x26, 0x25, 0x20 }; + + if (m_irq_mask != 0) + { + for (int i = 0; i < IRQ_8088_NMI; i++) + { + if (m_irq_mask & (1 << i)) + { + m_i8088->set_input_line_and_vector(INPUT_LINE_INT0, ASSERT_LINE, vectors[i] | m_irq_high); + break; + } + } + } + else + { + m_i8088->set_input_line(INPUT_LINE_INT0, CLEAR_LINE); + } +} + +void rainbow_state::raise_8088_irq(int ref) +{ + m_irq_mask |= (1 << ref); + update_8088_irqs(); +} + +void rainbow_state::lower_8088_irq(int ref) +{ + m_irq_mask &= ~(1 << ref); + update_8088_irqs(); +} + +// Only Z80 * private SRAM * is wait state free +// (= fast enough to allow proper I/O to the floppy) + +// Shared memory is contended by refresh, concurrent +// 8088 accesses and arbitration logic (DMA). +READ8_MEMBER(rainbow_state::share_z80_r) +{ + if (m_zflip) + { + if (offset < 0x8000) + { + return m_shared[offset + 0x8000]; + } + else if (offset < 0x8800) + { + return m_z80_private[offset & 0x7ff]; // SRAM + } + + return m_shared[offset ^ 0x8000]; + } + else + { + if (offset < 0x800) + { + return m_z80_private[offset]; // SRAM + } + + return m_shared[offset]; + } +} + +WRITE8_MEMBER(rainbow_state::share_z80_w) +{ + if (m_zflip) + { + if (offset < 0x8000) + { + m_shared[offset + 0x8000] = data; + return; // [!] + } + else if (offset < 0x8800) + { + m_z80_private[offset & 0x7ff] = data; // SRAM + return; // [!] + } + + m_shared[offset ^ 0x8000] = data; + } + else + { + if (offset < 0x800) + m_z80_private[offset] = data; // SRAM + else + m_shared[offset] = data; + } + return; +} + + +// ------------------------ClikClok (for model B; DS1315) --------------------------------- +#define RTC_RESET_MACRO m_rtc->chip_reset(); \ + UINT8 *rom = memregion("maincpu")->base(); + +#define RTC_ENABLE_MACRO \ + if (m_inp11->read() == 0x01) \ + { \ + if (offset & 1) \ + m_rtc->read_1(space, 0); \ + else \ + m_rtc->read_0(space, 0); \ + } \ + UINT8 *rom = memregion("maincpu")->base(); + +#define RTC_READ_MACRO \ + if (m_rtc->chip_enable() && (m_inp11->read() == 0x01)) \ + return (m_rtc->read_data(space, 0) & 0x01); \ + UINT8 *rom = memregion("maincpu")->base(); + +// *********** RTC RESET ************** +READ8_MEMBER(rainbow_state::rtc_reset) +{ + RTC_RESET_MACRO + return rom[RTC_RESET]; +} + +READ8_MEMBER(rainbow_state::rtc_reset2) +{ + RTC_RESET_MACRO + return rom[RTC_RESET + 0x2000]; +} + +// *********** RTC ENABLE ************** +READ8_MEMBER(rainbow_state::rtc_enable) +{ + RTC_ENABLE_MACRO + return rom[RTC_PATTERN_0 + offset]; +} + +READ8_MEMBER(rainbow_state::rtc_enable2) +{ + RTC_ENABLE_MACRO + return rom[RTC_PATTERN_0 + offset + 0x2000]; +} + +// ** READ single bit from RTC (or ROM) ** +READ8_MEMBER(rainbow_state::rtc_r) +{ + RTC_READ_MACRO + return rom[RTC_READ_DATA]; +} + +READ8_MEMBER(rainbow_state::rtc_r2) +{ + RTC_READ_MACRO + return rom[RTC_READ_DATA + 0x2000]; +} + +// Transfer data to DS1315 (read operation; data in offset): +// (always return ROM char to prevent potential IRQ issues) +READ8_MEMBER(rainbow_state::rtc_w) +{ + if (m_rtc->chip_enable() && (m_inp11->read() == 0x01)) + m_rtc->write_data(space, offset & 0x01); + + UINT8 *rom = memregion("maincpu")->base(); + return rom[RTC_WRITE_DATA_0 + offset]; +} +// ------------------------/ ClikClok (for model B; DS1315) --------------------------------- + + +// ---------------------------- RD51 HARD DISK CONTROLLER ---------------------------------- +static const int SECTOR_SIZES[4] = { 256, 512, 1024, 128 }; + +#define RD51_MAX_HEAD 8 +#define RD51_MAX_CYLINDER 1024 +#define RD51_SECTORS_PER_TRACK 16 + +void rainbow_state::hdc_reset() +{ +// printf(">> HARD DISC CONTROLLER RESET <<\n"); + logerror(">> HARD DISC CONTROLLER RESET <<\n"); + + m_hdc->reset(); // NEW HDC + + m_bdl_irq = 0; + update_bundle_irq(); // reset INTRQ + + m_hdc_buf_offset = 0; + m_hdc_direction = 0; + + m_hdc->buffer_ready(false); + m_hdc_write_gate = false; + + m_hdc_step_latch = false; + m_hdc_index_latch = false; + + m_hdc_track0 = true; // set true to avoid stepping +} + +// Return 'hard_disk_file' object for harddisk 1 (fixed). +// < NULL if geometry is insane or other errors occured > +hard_disk_file *(rainbow_state::rainbow_hdc_file(int drv)) +{ + m_hdc_drive_ready = false; + + if (m_inp5->read() != 0x01) // ...PRESENT? + return NULL; + + if (drv != 0) + return NULL; + + harddisk_image_device *img = NULL; + img = dynamic_cast(machine().device(subtag("harddisk1").c_str())); + + if (!img) + return NULL; + + if (!img->exists()) + return NULL; + + hard_disk_file *file = img->get_hard_disk_file(); + hard_disk_info *info = hard_disk_get_info(file); + + // ALWAYS 16 SECTORS / TRACK. + // CYLINDERS: 151 (~ 5 MB) to 1024 (max. cylinders on WD1010 controller) + if (((info->sectors == RD51_SECTORS_PER_TRACK)) && + ((info->heads >= 1) && (info->heads <= RD51_MAX_HEAD)) && // HEADS WITHIN 1...8 + ((info->cylinders > 150) && (info->cylinders <= RD51_MAX_CYLINDER)) + ) + { + m_hdc_drive_ready = true; + return file; // HAS SANE GEOMETRY + } + else + { + UINT32 max_sector = info->cylinders * info->heads * info->sectors; + printf("%u MB HARD DISK: HEADS (1..8 OK) = %d / CYL. (151..1024 OK) = %d / SPT. (16 OK) = %d / SECTOR_BYTES (128..1024 OK) = %d\n", max_sector * 512 / 1000000, + info->heads, info->cylinders, info->sectors, info->sectorbytes); + + printf("\n <<< === REJECTED = (SANITY CHECK FAILED) === >>> \n"); + return NULL; + } +} + +// LBA sector from CHS +static UINT32 get_and_print_lbasector(hard_disk_info *info, UINT16 cylinder, UINT8 head, UINT8 sector_number) +{ + if (info == NULL) + return 0; + + // LBA_ADDRESS = (C * HEADS + H) * NUMBER_SECTORS + (S - 1) + UINT32 lbasector = (double)cylinder * info->heads; // LBA : ( x 4 ) + lbasector += head; + lbasector *= info->sectors; // LBA : ( x 16 ) + lbasector += (sector_number - 1); // + (sector number - 1) + + logerror(" CYLINDER %u - HEAD %u - SECTOR NUMBER %u (LBA-SECTOR %u) ", cylinder, head, sector_number, lbasector); + return lbasector; +} + +// READ SECTOR (on BCS 1 -> 0 transition) +WRITE_LINE_MEMBER(rainbow_state::hdc_read_sector) +{ + static int last_state; + int read_status = 1; + + if (!m_hdc_write_gate) // do not read when WRITE GATE is on + { + UINT8 SDH = (m_hdc->read(space(AS_PROGRAM), 0x06)); + int drv = (SDH & (8 + 16)) >> 3; // get DRIVE from SDH register + + if ( (state == 0) && (last_state == 1) && (drv == 0) ) + { + read_status = 2; + + logerror("\nTRYING TO READ"); + output_set_value("led1", 0); + + int hi = (m_hdc->read(space(AS_PROGRAM), 0x05)) & 0x07; + UINT16 cylinder = (m_hdc->read(space(AS_PROGRAM), 0x04)) | (hi << 8); + UINT8 sector_number = m_hdc->read(space(AS_PROGRAM), 0x03); + + hard_disk_file *local_hard_disk; + local_hard_disk = rainbow_hdc_file(0); // one hard disk for now. + + if (local_hard_disk) + { + read_status = 3; + + hard_disk_info *info; + if ( (info = hard_disk_get_info(local_hard_disk)) ) + { + read_status = 4; + output_set_value("led1", 1); + + // Pointer to info + C + H + S + UINT32 lbasector = get_and_print_lbasector(info, cylinder, SDH & 0x07, sector_number); + + if ((cylinder <= info->cylinders) && // filter invalid ranges + (SECTOR_SIZES[(SDH >> 5) & 0x03] == info->sectorbytes) // may not vary in image! + ) + { + read_status = 5; + if( hard_disk_read(local_hard_disk, lbasector, m_hdc_buffer) ) // accepts LBA sector (UINT32) ! + { + read_status = 0; + logerror("...success!\n"); + } + } + } + m_hdc_buf_offset = 0; + m_hdc->buffer_ready(true); + } // if valid (..) + + if (read_status != 0) + { + logerror("...** READ FAILED WITH STATUS %u ** (CYLINDER %u - HEAD %u - SECTOR # %u - SECTOR_SIZE %u ) ***\n", + read_status, cylinder, SDH & 0x07, sector_number, SECTOR_SIZES[(SDH >> 5) & 0x03] + ) ; + } + + } // (on BCS 1 -> 0) + + } // do not read when WRITE GATE is on + + last_state = state; +} + + +// WRITE SECTOR +// ...IF WRITE_GATE (WG) TRANSITS FROM 1 -> 0 + +// NO PROVISIONS for sector sizes != 512 or MULTIPLE DRIVES (> 0) !!! +WRITE_LINE_MEMBER(rainbow_state::hdc_write_sector) +{ + int success = 0; + static int wg_last; + + if (state == 0) + m_hdc_write_gate = false; + else + m_hdc_write_gate = true; + + int drv = ((m_hdc->read(space(AS_PROGRAM), 0x06)) & (8 + 16)) >> 3; // get DRIVE from SDH register + + if (((state == 0) && (wg_last == 1)) // Check correct state transition and DRIVE 0 .... + && (drv == 0) + ) + { + output_set_value("led1", 0); // (1 = OFF ) =HARD DISK ACTIVITY = + MOTOR_DISABLE_counter = 20; + + if (rainbow_hdc_file(0) != NULL) + { + success = do_write_sector(); + if (success < 88) + logerror("! SECTOR WRITE (or FORMAT) FAULT ! ERROR CODE %i.\n", success); + + m_hdc_buf_offset = 0; + m_hdc->buffer_ready(false); + } + + // CHD WRITE FAILURES or UNMOUNTED HARDDSIK TRIGGER A PERMANENT ERROR. + if (success < 50) + m_hdc_write_fault = true; // reset only by HDC RESET! + } + + wg_last = state; // remember state +} + + +// Initiated by 'hdc_write_sector' (below) +// - in turn invoked by a WG: 1 -> 0 transit. +// STATUS CODES: +// 0 = DEFAULT ERROR (no HARD DISK FILE ?) +// 10 = CHD WRITE FAILURE (?) + +// 50 = SANITY CHECK FAILED (cylinder limit / <> 512 sectors?) + +// 88 = (LOW LEVEL) WRITE/FORMAT (sector_count != 1 IGNORED) +// 99 = SUCCESS : SECTOR WRITTEN + +// * RELIES * ON THE FACT THAT THERE WILL BE NO MULTI SECTOR TRANSFERS (!) +int rainbow_state::do_write_sector() +{ + int feedback = 0; // no error + output_set_value("led1", 0); // ON + + hard_disk_file *local_hard_disk; + local_hard_disk = rainbow_hdc_file(0); // one hard disk for now. + + if (local_hard_disk) + { + hard_disk_info *info; + if ( (info = hard_disk_get_info(local_hard_disk)) ) + { + feedback = 10; + logerror("\n* TRYING TO WRITE * "); + output_set_value("led1", 1); // OFF + + UINT8 SDH = (m_hdc->read(space(AS_PROGRAM), 0x06)); + + int hi = (m_hdc->read(space(AS_PROGRAM), 0x05)) & 0x07; + UINT16 cylinder = (m_hdc->read(space(AS_PROGRAM), 0x04)) | (hi << 8); + + int sector_number = m_hdc->read(space(AS_PROGRAM), 0x03); + int sector_count = m_hdc->read(space(AS_PROGRAM), 0x02); // (1 = single sector) + + if (!((cylinder <= info->cylinders) && // filter invalid cylinders + (SECTOR_SIZES[(SDH >> 5) & 0x03] == info->sectorbytes) // 512, may not vary + )) + { + logerror("...*** SANITY CHECK FAILED (CYLINDER %u vs. info->cylinders %u - - SECTOR_SIZE %u vs. info->sectorbytes %u) ***\n", + cylinder, info->cylinders, SECTOR_SIZES[(SDH >> 5) & 0x03], info->sectorbytes + ); + return 50; + } + // Pointer to info + C + H + S + UINT32 lbasector = get_and_print_lbasector(info, cylinder, SDH & 0x07, sector_number); + + if (sector_count != 1) // ignore all SECTOR_COUNTS != 1 + { + logerror(" - ** IGNORED (SECTOR_COUNT !=1) **\n"); + return 88; // BAIL OUT + } + + if (hard_disk_write(local_hard_disk, lbasector, m_hdc_buffer)) // accepts LBA sector (UINT32) ! + { + logerror("...success! ****\n"); + feedback = 99; + } + else + { + logerror("...FAILURE **** \n"); + } + + } // IF 'info' not NULL + } // IF hard disk present + + return feedback; +} + + + +READ8_MEMBER(rainbow_state::hd_status_60_r) +{ + int data = m_hdc_buffer[m_hdc_buf_offset]; + //logerror("HARD DISK DISK BUFFER: READ offset %04x | data = %02x\n", m_hdc_buf_offset, data); // ! DO NOT CHANGE ORDER ! + + m_hdc_buf_offset = (m_hdc_buf_offset + 1); + if (m_hdc_buf_offset >= 1024) // 1 K enforced by controller + { + m_hdc_buf_offset = 0; + m_hdc->buffer_ready(true); + } + return data; +} + +WRITE8_MEMBER(rainbow_state::hd_status_60_w) +{ + //logerror("HARD DISK BUFFER: WRITE offset %04x | data = %02x\n", m_hdc_buf_offset, data); + + m_hdc_buffer[m_hdc_buf_offset] = data; + m_hdc_buf_offset = (m_hdc_buf_offset + 1); + + if (m_hdc_buf_offset >= 1024) // 1 K enforced by controller + { + m_hdc_buf_offset = 0; + m_hdc->buffer_ready(true); + } +} + + +// Secondary Command / Status Registers(68H) is... +// (A) a write - only register for commands +// (B) a read - only register for status signals +// Holds the status of the following signals: +// - 3 hard-wired controller module identification bits. +// - signals from the WD1010 chip, +// - disk drive(latched status signals) +READ8_MEMBER(rainbow_state::hd_status_68_r) +{ + // (*) Bits 5-7 : HARD WIRED IDENTIFICATION BITS, bits 5+7 = 1 and bit 6 = 0 (= 101 f?r RD51 module) + int data = 0xe0; // 111 gives DRIVE NOT READY (when W is pressed on boot screen) + if ((m_inp5->read() == 0x01) && (rainbow_hdc_file(0) != NULL)) + data = 0xa0; // A0 : OK, DRIVE IS READY (!) + + int my_offset = 0x07; + int stat = m_hdc->read(space, my_offset); + logerror("(x68) WD1010 register %04x (STATUS) read, result : %04x\n", my_offset, stat); + + // NOTE: SEEK COMPLETE IS CURRENTLY HARD WIRED / NOT FULLY EMULATED - + // Bit 4 : SEEK COMPLETE: This status bit indicates that the disk drive positioned the R/W heads over the desired track on the disk surface. + + // (ALT.TEXT): "Seek Complete - When this signal from the disk drive goes low(0), it indicates that the R /W heads settled on the correct track. + // Writing is inhibited until this signal goes low(0). Seek complete is high(1) during normal seek operation. + if (stat & 16) // SEEK COMPLETE (bit 4)? + data |= 16; + + // Bit 3 : DIRECTION : This bit indicates the direction the read/write heads in the disk + // drive will move when the WD1010 chip issues step pulse(s). When high(1), the R / W heads will move toward the spindle. + // When low (0), the heads will move away from the spindle, towards track O. + if (m_hdc_direction) + data |= 8; + + // Bit 2 : LATCHED STEP PULSE: This status bit from the step pulse latch indicates if the WD1010 + // chip issued a step pulse since the last time the 8088 processor cleared the step pulse latch. + if (m_hdc_step_latch) + data |= 4; + + // Bit 1 : LATCHED INDEX : This status bit from the index latch indicates if the disk drive + // encountered an index mark since the last time the 8088 processor cleared the index latch. + if (m_hdc_index_latch) + data |= 2; + + // Bit 0 : CTRL BUSY : indicates that the WD 1010 chip is accessing the sector buffer. When this bit is set, + // the 8088 cannot access the WD 1010 registers. + if (stat & 128) // BUSY (bit 7)? + data |= 1; + + return data; +} + + +// 68 (WRITE): Secondary Command Registers (68H) - - ERKL?RUNG: "write-only register for commands" +// - see TABLE 4.8 (4-24) +WRITE8_MEMBER(rainbow_state::hd_status_68_w) +{ + // Bit 4-7 : --- not used / reserved + + // Bit 3 : CLEAR STEP LATCH : This bit BAD<3>H clears out the step pulse latch. The step pulse + //latch is set every time the WD1010 chip issues a step pulse.The output of the step pulse latch is sent to the secondary status register. + if (data & 0x08) + m_hdc_step_latch = false; + + // Bit 2 : CLEAR INDEX LATCH : This bit BAD<2>H clears out the index latch. The index latch is + //set when the disk drive senses the index position on the disk.The index latch output is sent to the secondary status register. + if (data & 0x04) + m_hdc_index_latch = false; + + // * Bit 1 : SOFTWARE INITIALIZE: The BADH bit sets this bit. This bit, when set, initializes the + // controller. The controller cannot be accessed for 7 microseconds(us) after the 8088 issues the software initialize. + if (data & 0x02) + hdc_reset(); + + // * Bit 0 : SET BUFFER READY : READ SECTOR command: this bit, when set, tells the WDI010 chip that the sector buffer was emptied which would then end the + // command. WRITE SECTOR / FORMAT CMD: bit tells the WD1010 that the sector buffer now contains valid data for transfer to the disk drive. + + // * SET BY BIOS: 2 : (WD1010 IRQ based transfer operation?) @ 0810 + // 1 : see @ 088D after 'READ_SECTOR_OK' + if (data & 0x01) + { + logerror(">> HARD DISC * SET BUFFER READY * <<\n"); + + output_set_value("led1", 0); // 1 = OFF (One of the CPU LEDs as DRIVE LED) = HARD DISK ACTIVITY = + MOTOR_DISABLE_counter = 20; + + m_hdc->buffer_ready(true); + } +} + + +/* +/ READ ONLY REGISTER (HEX 69) + +The drive status register at I/O address 69H is a read-only register +that monitors the status of control and error signals to/from the disk drive. + +0 Drive Select - high (1) indicates that the controller module is selecting the drive. + +1-3 Head Select - These 3 bits are the binary head address of the R/W head +selected for the current read/write operation. The RD51 drive has 4 heads. + +4 Write Gate - The WDlOI0 chip asserts this bit high (1) to inform the 8088 of +data being written on the disk. Signal also enables write current in disk drive. + +5 Drive Write Fault - The disk drive asserts this bit high (1) to indicate that a condition +exists at the drive that may cause improper writing on the disk. +Inhibits further writing until the error is corrected (.. until RESET?) [Bavarese] + +6 Drive Ready - When the disk drive together with SEEK COMPLETE asserts this +bit high (1), it indicates that the drive is ready to read, write, or +seek. When this bit is low (0), all reading, writing, and seeking are +inhibited. + +7 Track 0 - The disk drive sets this bit high (1) when the R/W heads are +positioned over cylinder 0 (the data track furthest away from the spindle). +*/ +READ8_MEMBER(rainbow_state::hd_status_69_r) +{ + int HS = m_hdc->read(space, 0x06) & (1 + 2 + 4); // SDH bits 0-2 = HEAD # + logerror("(x69 READ) %i = HEAD SELECT WD1010\n", HS); + + UINT8 data = (HS << 1); + + // DRIVE SELECT: 2 bits in SDH register of WDx010 could address 4 drives. + // External circuit supports 1 drive here (DRIVE 0 selected or deselected) + int DRV = ((m_hdc->read(space, 0x06) >> 3) & 0x01); // 0x03 gives error R6 with DIAG.DISK + if (DRV == 0) + { + logerror("(x69 READ) %i = _DRIVE # 0_ SELECT! \n", DRV); + data |= 1; + } + + if (m_hdc_write_gate) // WRITE GATE (cached here) + data |= 16; + + if (m_hdc_write_fault) + data |= 32; + + if (m_hdc_drive_ready) + data |= 64; + + // Fake TRACK 0 signal (normally FROM DRIVE) + m_hdc_track0 = false; // Set a default + + int stat1 = m_hdc->read(space, 0x04); // CYL LO + int stat2 = m_hdc->read(space, 0x05); // CYL HI + if ((stat1 == 0) && (stat2 == 0)) + m_hdc_track0 = true; + + if (m_hdc_track0) + { + data |= 128; + logerror("(x69 READ) TRACK 00 detected\n"); + } + + return data; +} + +// TREAT SIGNALS FROM / TO CONTROLLER +WRITE_LINE_MEMBER(rainbow_state::hdc_step) +{ + m_hdc_step_latch = true; + + output_set_value("led1", 0); // 1 = OFF (One of the CPU LEDs as DRIVE LED) = HARD DISK ACTIVITY = + MOTOR_DISABLE_counter = 20; +} + +WRITE_LINE_MEMBER(rainbow_state::hdc_direction) +{ + m_hdc_direction = state; // (0 = OUT) +} + +READ_LINE_MEMBER(rainbow_state::hdc_drive_ready) +{ + return m_hdc_drive_ready; +} + +READ_LINE_MEMBER(rainbow_state::hdc_write_fault) +{ + return m_hdc_write_fault; +} + +// Buffer counter reset when BCR goes from 0 -> 1 +WRITE_LINE_MEMBER(rainbow_state::hdc_bcr) +{ + static int bcr_state; + if ((bcr_state == 0) && (state == 1)) + hdc_buffer_counter_reset(); + bcr_state = state; +} + +void rainbow_state::hdc_buffer_counter_reset() +{ + m_hdc->buffer_ready(false); + m_hdc_buf_offset = 0; +} + +// DATA REQUEST - When high (..) initiates data transfers +// to or from the sector buffer. On a READ, this signal +// goes high AFTER the sector buffer is filled. + +// On a WRITE / FORMAT command, signal goes high when the WD1010 +// chip is READY TO ACCESS the information in the sector buffer. +WRITE_LINE_MEMBER(rainbow_state::hdc_bdrq) +{ + static int old_state; + + logerror("BDRQ - BUFFER DATA REQUEST OBTAINED: %u\n", state); + if ((state == 1) && (old_state == 0)) + { + hdc_buffer_counter_reset(); + + m_bdl_irq = state; + update_bundle_irq(); // TRIGGER AN INTERRUPT + } + old_state = state; +} +// ---------------------------- / RD51 HARD DISK CONTROLLER ---------------------------------- + + +// IRQ service for both RD51 and COMM. OPTION +void rainbow_state::update_bundle_irq() +{ + if (m_bdl_irq == 0) + { + lower_8088_irq(IRQ_BDL_INTR_L); + + if (m_inp5->read() == 0x01) + hdc_buffer_counter_reset(); + } + else + { + raise_8088_irq(IRQ_BDL_INTR_L); + } +} + +WRITE_LINE_MEMBER(rainbow_state::bundle_irq) +{ + m_bdl_irq = state; + update_bundle_irq(); +} + + + +READ8_MEMBER(rainbow_state::system_parameter_r) +{ +#ifdef FORCE_RAINBOW_B_LOGO + + // WORKAROUND: Initialize NVRAM + VOLATILE RAM with DEFAULTS + correct RAM SIZE ! + int test = (m_inp8->read() >> 16) - 2; // 0 = 128 K (!) + if (test >= 0) + { + m_p_vol_ram[0xdb] = test; + m_p_nvram[0xdb] = test; + } + + // NVRAM @ 0x89 : AUTO RPT(0 = OFF 1 = ON) + m_p_nvram[0x89] = 0; // AUTO REPEAT ON (1 would be DETRIMENTAL TO "SET-UP" (80/132 + 50/60 Hz) with KEYBOARD_WORKAROUND (!) +#endif + + + /* Info about option boards is in bits 0 - 3: + SYSTEM PARAMETER INFORMATION: see AA-P308A-TV page 92 section 14.0 + Bundle card (1) | Floppy (2) | Graphics (4) | Memory option (8) + 0 1 2 3 4 5 6 7 + B F G M + (bit SET means NOT present; 4-7 reserved ) + + B : no separation between the 2 available 'bundle cards' (HD controller / COMM.OPTION) ? + + M : old RAM extension (128 / 192 K ?) detected with OPTION_PRESENT bit, newer models 'by presence'. + BIOS uses a seperate IRQ vector for RAM board detection (at least on a 100-B). + */ + return (((m_inp5->read() == 1) ? 0 : 1) | + ((m_inp6->read() == 1) ? 0 : 2) | + ((m_inp7->read() == 1) ? 0 : 4) | + ((m_inp8->read() > BOARD_RAM) ? 0 : 8) + // 16 | 32 | 64 | 128 // to be verified. + ); +} + +READ8_MEMBER(rainbow_state::comm_control_r) +{ + /* [02] COMMUNICATIONS STATUS REGISTER - PAGE 154 (**** READ **** ) + Used to read status of SERIAL port, IRQ line of each CPU, and MHFU logic enable signal. + + // What the specs says on how MHFU detection is disabled: + // 1. by first disabling interrupts with CLI + // 2. by writing 0x00 to port 0x10C (handled by a 8088 write handler) + // MHFU is re-enabled by writing to 0x0c (or 'automatically after STI') <-- when under BIOS control ? + */ + int data = 0; + if (COLD_BOOT == 2) + data = 0; // During boot phase 2, never enable MHFU (prevents errors). + else + { + data = m_crtc->MHFU(1); + } + return (((data) ? 0x00 : 0x20) | // // (L) status of MHFU flag => bit pos.5 + ((INT88) ? 0x00 : 0x40) | // (L) + ((INTZ80) ? 0x00 : 0x80) // (L) + ); +} + +WRITE8_MEMBER(rainbow_state::comm_control_w) +{ + /* Communication control register of -COMM- port (when written): + + 8088 LEDs: + 5 7 6 4 <- BIT POSITION + D6 -D5-D4-D3 <- INTERNAL LED NUMBER (DEC PDF) + -4--5--6--7- <- NUMBERS EMBOSSED ON BACK OF PLASTIC HOUSING (see error chart) + */ + output_set_value("led4", BIT(data, 5)); // LED "D6" + output_set_value("led5", BIT(data, 7)); // LED "D5" + output_set_value("led6", BIT(data, 6)); // LED "D4" + output_set_value("led7", BIT(data, 4)); // LED "D3" + + // printf("%02x to COMM.CONTROL REGISTER\n", data); +} + + + +// 8088 writes to port 0x00 (interrupts Z80) +// See page 133 (4-34) +WRITE8_MEMBER(rainbow_state::i8088_latch_w) +{ + // printf("%02x to Z80 mailbox\n", data); + + // The interrupt vector address(F7H) placed on the bus is hardwired into the Z80A interrupt vector encoder. + // The F7H interrupt vector address causes the Z80A processor to perform an RST 30 instruction in + // interrupt mode 0 + m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf7); + m_z80_mailbox = data; + + INTZ80 = true; // +} + +// Z80 reads port 0x00 +// See page 134 (4-35) +READ8_MEMBER(rainbow_state::z80_latch_r) +{ + // printf("Read %02x from Z80 mailbox\n", m_z80_mailbox); + m_z80->set_input_line(0, CLEAR_LINE); + + INTZ80 = false; + return m_z80_mailbox; +} + +// Z80 writes to port 0x00 (interrupts 8088) +// See page 134 (4-35) +WRITE8_MEMBER(rainbow_state::z80_latch_w) +{ + // printf("%02x to 8088 mailbox\n", data); + raise_8088_irq(IRQ_8088_MAILBOX); + m_8088_mailbox = data; + + INT88 = true; +} + +// 8088 reads port 0x00. See page 133 (4-34) +READ8_MEMBER(rainbow_state::i8088_latch_r) +{ + // printf("Read %02x from 8088 mailbox\n", m_8088_mailbox); + lower_8088_irq(IRQ_8088_MAILBOX); + + INT88 = false; + return m_8088_mailbox; +} + +// (Z80) : WRITE to 0x20 +WRITE8_MEMBER(rainbow_state::z80_diskdiag_read_w) +{ + m_zflip = true; +} + +// (Z80) : PORT 21H * WRITE * +WRITE8_MEMBER(rainbow_state::z80_diskdiag_write_w) +{ + /* Z80 LEDs: + 4 5 6 <- bit # + D11 D10 -D9 <- INTERNAL LED NUMBER (see PDF) + -1 --2-- 3 <- NUMBERS EMBOSSED ON BACK OF PLASTIC HOUSING (see error chart) + */ + output_set_value("led1", BIT(data, 4)); // LED "D11" + output_set_value("led2", BIT(data, 5)); // LED "D10" + output_set_value("led3", BIT(data, 6)); // LED "D9" + + m_zflip = false; +} + +// (Z80) : PORT 21H _READ_ +READ8_MEMBER(rainbow_state::z80_generalstat_r) +{ + /* + General / diag.status register Z80 / see page 157 (table 4-18). + ---- BITS FROM RX50 CONTROLLER CARD: + D7 : STEP L : reflects status of STEP signal _FROM FDC_ + (when this 2us output pulse is low, the stepper will move into DIR) + D6 : WRITE GATE L :reflects status of WRITE GATE signal _FROM FDC_ + (asserted low before data can be written on the diskette) + D5 : TR00: reflects status of TRACK 0 signal (= 1) * from the disk drive * + D4 : DIR L: reflects status of DIRECTION signal * FROM FDC * to disk + (when low, the head will step towards the center) + D3 : READY L: reflects status of READY L signal * from the disk drive * + (low active, asserts when disk is inserted and door is closed) + ---- BITS BELOW FROM MAINBOARD: + D2 : INT88 L: (bit reads the INT88 bit sent by Z80 to interrupt 8088) + D1 : INTZ80 L: (bit reads the INTZ80 bit sent by 8088 to interrupt Z80) + D0 : ZFLIP L: (read from the diagnostic control register of Z80A) + */ + static int last_track; + + int track = 0; + int fdc_step = 0; + int fdc_ready = 0; + int tk00 = 0; + int fdc_write_gate = 0; + int last_dir = 0; + + printf("\nFLOPPY %02d - ", m_unit); // TEST-DEBUG + + // Attempt to block invalid accesses + if (m_unit != INVALID_DRIVE) + { + track = m_fdc->track_r(space, 0); + if (track != last_track) + fdc_step = 1; // calculate STEP (sic) + last_track = track; + + if (!m_floppy->ready_r()) // weird (see wd_fdc) + fdc_ready = 1; + + if (fdc_ready) + fdc_write_gate = 1; // * FAKE * WRITE GATE ! + + // "valid only when drive is selected" ! + if (!m_floppy->trk00_r()) // weird (see wd_fdc) + tk00 = 1; + + if (last_track > track) + last_dir = 1; // correct? + else + last_dir = 0; + + if (fdc_ready == 1) + printf(" RDY:1 "); // TEST-DEBUG + else + printf(" RDY:0 "); // TEST-DEBUG + + if (fdc_step == 1) + printf(" STP:1 "); // TEST-DEBUG + else + printf(" STP:0 "); // TEST-DEBUG + + if (tk00 == 0) + printf(" TK00=0 "); // TEST-DEBUG + else + printf(" TK00=1 "); // TEST-DEBUG + + } + + int data = ( + ((fdc_step) ? 0x00 : 0x80) | + ((fdc_write_gate) ? 0x00 : 0x40) | + ((tk00) ? 0x20 : 0x00) | // ***** ALL LOW ACTIVE - EXCEPT tk00 : + ((last_dir) ? 0x00 : 0x10) | + ((fdc_ready) ? 0x00 : 0x08) | + ((INT88) ? 0x00 : 0x04) | + ((INTZ80) ? 0x00 : 0x02) | + ((m_zflip) ? 0x00 : 0x01) + ); + + return data; +} + + + +// (Z80) : PORT 40H _READ_ +// 40H diskette status Register **** READ ONLY *** ( 4-60 of TM100.pdf ) +READ8_MEMBER(rainbow_state::z80_diskstatus_r) +{ + int track = 0; + + // AND 00111011 - return what was WRITTEN to D5-D3, D1, D0 previously + // (except D7,D6,D2) + int data = m_z80_diskcontrol & 0x3b; + + // -DOES NOT WORK HERE- Attempt to block invalid accesses + if (m_unit != INVALID_DRIVE) + { + // D7: DRQ: reflects status of DATA REQUEST signal from FDC. + // '1' indicates that FDC has read data OR requires new write data. + data |= m_fdc->drq_r() ? 0x80 : 0x00; + + // D6: IRQ: indicates INTERRUPT REQUEST signal from FDC. Indicates that a + // status bit has changed. Set to 1 at the completion of any + // command (.. see page 207 or 5-25). + data |= m_fdc->intrq_r() ? 0x40 : 0x00; + + // D5: SIDE 0H: status of side select signal at J2 + J3 of RX50 controller. + // For 1 sided drives, this bit will always read low (0). + + // D4: MOTOR 1 ON L: 0 = indicates MOTOR 1 ON bit is set in drive control reg. + // D3: MOTOR 0 ON L: 0 = indicates MOTOR 0 ON bit is set in drive " + + track = m_fdc->track_r(space, 0); + + // Print HEX track number + static UINT8 bcd2hex[] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71 }; + // 0...9 ,A (0x77), b (0x7c), C (0x39) , d (0x5e), E (0x79), F (0x71) + output_set_digit_value(0, bcd2hex[(track >> 4) & 0x0f]); + output_set_digit_value(1, bcd2hex[(track - ((track >> 4) << 4)) & 0x0f]); + } + + // D2: TG43 L : 0 = INDICATES TRACK > 43 SIGNAL FROM FDC TO DISK DRIVE. + if (track > 43) + data = data & (255 - 4); + else + data = data | 4; + + // D1: DS1 H: reflect status of bits 0 and 1 form disk.control reg. + // D0: DS0 H: " + return data; +} + +// (Z80) : PORT 40H * WRITE * +// NOTE: routine will accept invalid drive letters... +WRITE8_MEMBER(rainbow_state::z80_diskcontrol_w) +{ + int selected_drive = INVALID_DRIVE; + static const char *names[] = { FD1793_TAG ":0", FD1793_TAG ":1", FD1793_TAG ":2", FD1793_TAG ":3" }; + + int drive = 0; + if (m_inp10->read() && ((data & 3) < 2)) + drive = (data & 1) + 2; + else + drive = data & 3; + + floppy_connector *con = NULL; + if (drive < MAX_FLOPPIES) + con = machine().device(names[drive]); + + if (con) + { + m_floppy = con->get_device(); + if (m_floppy) + selected_drive = drive; + //printf("%i <- SELECTED DRIVE...\n", m_unit); + } + + if (selected_drive == INVALID_DRIVE) + { + printf("(m_unit = %i) ** SELECTED DRIVE ** INVALID. (selected drive = %i)\n", m_unit, selected_drive); + m_unit = INVALID_DRIVE; + m_floppy = NULL; + } + + if (m_floppy != NULL) + { + m_fdc->set_floppy(m_floppy); // Sets new _image device_ + if (!m_floppy->exists()) + { + m_floppy = NULL; + printf("(m_unit = %i) SELECTED IMAGE *** DOES NOT EXIST *** (selected drive = %i)\n", m_unit, selected_drive); + selected_drive = INVALID_DRIVE; + //m_unit = INVALID_DRIVE; + } + else + { + m_floppy->ss_w((data & 20) ? 1 : 0); // RX50 board in Rainbow has 'side select' + m_floppy->set_rpm(300.); + } + } + + output_set_value("driveled0", (selected_drive == 0) ? 1 : 0); + output_set_value("driveled1", (selected_drive == 1) ? 1 : 0); + + output_set_value("driveled2", (selected_drive == 2) ? 1 : 0); + output_set_value("driveled3", (selected_drive == 3) ? 1 : 0); + + if (selected_drive < 4) + { + m_unit = selected_drive; + + if (MOTOR_DISABLE_counter == 0) // "one shot" + MOTOR_DISABLE_counter = 20; + + // FORCE_READY = 0 : assert DRIVE READY on FDC (diagnostic override; USED BY BIOS!) + bool force_ready = ((data & 4) == 0) ? true : false; + m_fdc->set_force_ready(force_ready); + } + + int enable_start = 0; + int disable_start = 2; // set defaults + + if (m_unit == INVALID_DRIVE) + { + printf("\n**** INVALID DRIVE ****"); + data = (data & (255 - 3)) | m_unit; + + data = data & (255 - 8); // MOTOR 0 OFF + data = data & (255 - 16); // MOTOR 1 OFF + } + else + { + data = (data & (255 - 3)) | m_unit; + + if (m_unit < 2) + { + data = data | 8; // MOTOR 0 (for A or B) + } + else + { + data = data | 16; // MOTOR 1 (for C or D) + enable_start = 2; + disable_start = 4; + } + + // RX-50 has head A and head B (1 for each of the 2 disk slots in a RX-50). + // Assume the other one is switched off - + for (int f_num = 0; f_num < MAX_FLOPPIES; f_num++) + { + floppy_connector *con = machine().device(names[f_num]); + floppy_image_device *tmp_floppy = con->get_device(); + + tmp_floppy->mon_w(ASSERT_LINE); + if ((f_num >= enable_start) && (f_num < disable_start)) + tmp_floppy->mon_w(CLEAR_LINE); // enable + } + + } + + m_z80_diskcontrol = data; +} +// --------- END OF Z80 -------------------- + +READ8_MEMBER(rainbow_state::read_video_ram_r) +{ + return m_p_ram[offset]; +} + + +// ************************************************** +// VIDEO INTERRUPT HANDLING +// ************************************************** + +INTERRUPT_GEN_MEMBER(rainbow_state::vblank_irq) +{ + raise_8088_irq(IRQ_8088_VBL); + m_crtc->notify_vblank(true); +} + + +WRITE_LINE_MEMBER(rainbow_state::clear_video_interrupt) +{ + lower_8088_irq(IRQ_8088_VBL); + m_crtc->notify_vblank(false); +} + +// Reflects bits from 'diagnostic_w', except test jumpers +READ8_MEMBER(rainbow_state::diagnostic_r) // 8088 (port 0A READ). Fig.4-29 + table 4-15 +{ + return ((m_diagnostic & (0xf1)) | // MASK 0xf1 = 11110001 + (m_inp1->read() | + m_inp2->read() | + m_inp3->read() + ) + ); +} + + +WRITE8_MEMBER(rainbow_state::diagnostic_w) // 8088 (port 0A WRITTEN). Fig.4-28 + table 4-15 +{ + // printf("%02x to diag port (PC=%x)\n", data, space.device().safe_pc()); + m_SCREEN_BLANK = (data & 2) ? false : true; + + // ZRESET (high at powerup) + if (!(data & 1)) + { + m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_z80_halted = true; + } + + if ((data & 1) && (m_z80_halted)) + { + m_zflip = true; + m_z80_halted = false; + + m_z80->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_z80->reset(); + } + + if ((m_diagnostic & 1) && !(data & 1)) + { + printf("\nFDC ** RESET **"); + m_fdc->reset(); + } + + if (!(m_diagnostic & 1) && (data & 1)) + { + printf("\nFDC RESTORE"); + m_fdc->soft_reset(); // See formatter description p.197 or 5-13 + } + + // MISSING BITS (* not vital for normal operation, see diag.disk) - + // BIT 2: GRF VID SEL (0 = system module; 1 = graphics option) + // BIT 3: PARITY TEST (1 = enables parity test on memory option board) + // * BIT 4: DIAG LOOPBACK (0 at power-up; 1 directs RX50 and DC12 output to printer port) + // * BIT 5: PORT LOOPBACK (1 enables loopback for COMM, PRINTER, KEYBOARD ports) + + /* 2.1.7.3 DIAGNOSTIC LOOPBACK Maintenance Bit - The DIAGNOSTIC LOOPBACK bit is a + maintenance bit that is cleared on power - up.This bit, when set to 1, + allows the floppy data separator and the serial video output to be tested + through the use of the printer port. The following table shows how signals are routed. + + DIAGNOSTIC LOOPBACK = 0 DIAGNOSTIC LOOPBACK = 1 SIGNAL INPUT + SIGNAL SOURCE SIGNAL SOURCE TO + FROM FROM + PRT RDATA(J2) VIDEO OUT PRT RXD(7201) + PRT RXTXC 500 KHZ PRT RXTXC(7201) + MASTER CLK 250 KHZ VIDEO CLK(DCO11) + FLOPPY RAW DATA PRT TXD(7201) FLOPPY DATA SEPARATOR + + During Diagnostic Loopback, the - TEST input of the 8088 is connected to the + interrupt output of the MPSC.Thus, using the 8088's WAIT instruction in a + polled I / O loop, the diagnostic firmware will be able to keep up with the + 500 Kb data rate on the MPSC. + */ + if (data & 16) + { + printf("\nWARNING: UNEMULATED DIAG LOOPBACK (directs RX50 and DC12 output to printer port) ****"); + } + + if (data & 32) + { + /* BIT 5: PORT LOOPBACK (1 enables loopback for COMM, PRINTER, KEYBOARD ports) + 2.1.7.2. of AA-V523A-TV (PDF Mar83) says how the signals are routed: + port_loopback_0 | port_loopback_1 SIGNAL INPUT TO + COMM RCV DATA.......COMM TXD..........COMM_RXD + PRT RCV DATA.......KBD TXD...........PRT RDATA + KBD RCV DATA.......PRT TXD...........KBD RXD + */ + printf("\nWARNING: UNEMULATED PORT LOOPBACK (COMM, PRINTER, KEYBOARD ports) ****"); + } + + // BIT 6: Transfer data from volatile memory to NVM (PROGRAM: 1 => 0 BIT 6) + if (!(data & 0x40) && (m_diagnostic & 0x40)) + memcpy(m_p_nvram, m_p_vol_ram, 256); + + // BIT 7: Transfer data from NVM to volatile memory (RECALL 0 => 1 BIT 7) + if ((data & 0x80) && !(m_diagnostic & 0x80)) + memcpy(m_p_vol_ram, m_p_nvram, 256); + + m_diagnostic = data; +} + + +// KEYBOARD +void rainbow_state::update_kbd_irq() +{ +#ifndef KEYBOARD_WORKAROUND + if ((m_kbd_rx_ready) || (m_kbd_tx_ready)) + { + raise_8088_irq(IRQ_8088_KBD); + } + else + { + lower_8088_irq(IRQ_8088_KBD); + } +#endif +} + +WRITE_LINE_MEMBER(rainbow_state::kbd_tx) +{ + // printf("%02x to keyboard\n", state); + m_lk201->rx_w(state); +} + +WRITE_LINE_MEMBER(rainbow_state::kbd_rxready_w) +{ + // printf("rxready %d\n", state); + m_kbd_rx_ready = (state == 1) ? true : false; + update_kbd_irq(); +} + +WRITE_LINE_MEMBER(rainbow_state::kbd_txready_w) +{ + // printf("8251 txready %d\n", state); + m_kbd_tx_ready = (state == 1) ? true : false; + update_kbd_irq(); +} + +WRITE_LINE_MEMBER(rainbow_state::write_keyboard_clock) +{ + m_kbd8251->write_txc(state); + m_kbd8251->write_rxc(state); +} + +TIMER_DEVICE_CALLBACK_MEMBER(rainbow_state::motor_tick) +{ + m_hdc_index_latch = true; // HDC drive index signal (not working ?) + + if (MOTOR_DISABLE_counter) + MOTOR_DISABLE_counter--; + + if (MOTOR_DISABLE_counter < 2) + { + output_set_value("driveled0", 0); // DRIVE 0 (A) + output_set_value("driveled1", 0); // DRIVE 1 (B) + output_set_value("driveled2", 0); // DRIVE 2 (C) + output_set_value("driveled3", 0); // DRIVE 3 (D) + + output_set_value("led1", 1); // 1 = OFF (One of the CPU LEDs as DRIVE LED) + } + + if (m_crtc->MHFU(1)) // MHFU * flag * enabled ? + { + int data = m_crtc->MHFU(-1); // increment MHFU, return new value + + // MHFU gets active if the 8088 has not acknowledged a video processor interrupt within approx. 108 milliseconds. + // Timer reset by 2 sources : the VERT INT L from the DC012, or the MHFU ENB L from the enable flip - flop. + + if ( data > 480 ) // longer than needed. Better than an instant "INTERRUPT 16" + { + for (int i = 0; i < 9; i++) + printf("\nWATCHDOG TRIPPED *** NOW RESET MACHINE ***\n"); + + m_crtc->MHFU(-100); // -100 : Enable MHFU flag + + if (m_inp12->read() == 0x01) // DIP for watchdog set? + { + COLD_BOOT = 0; // massive foulup (no recovery) + device().machine().schedule_soft_reset(); // FFFF:0 + } + } + } + + if (m_beep_counter > 0) + m_beep_counter--; +} + +// on 100-B, DTR from the keyboard 8051 controls bit 7 of IRQ vectors +WRITE_LINE_MEMBER(rainbow_state::irq_hi_w) +{ + m_irq_high = (state == ASSERT_LINE) ? 0x80 : 0; + //logerror("%i = m_irq_high\n", m_irq_high); +} + +/* F4 Character Displayer */ +static const gfx_layout rainbow_charlayout = +{ + 8, 10, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 15 * 8, 0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, 8 * 8 }, + 8 * 16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START(rainbow) +GFXDECODE_ENTRY("chargen", 0x0000, rainbow_charlayout, 0, 1) +GFXDECODE_END + + +static MACHINE_CONFIG_START(rainbow, rainbow_state) +MCFG_DEFAULT_LAYOUT(layout_rainbow) + +/* basic machine hardware */ +MCFG_CPU_ADD("maincpu", I8088, XTAL_24_0734MHz / 5) +MCFG_CPU_PROGRAM_MAP(rainbow8088_map) +MCFG_CPU_IO_MAP(rainbow8088_io) +MCFG_CPU_VBLANK_INT_DRIVER("screen", rainbow_state, vblank_irq) + +MCFG_CPU_ADD("subcpu", Z80, XTAL_24_0734MHz / 6) +MCFG_CPU_PROGRAM_MAP(rainbowz80_mem) +MCFG_CPU_IO_MAP(rainbowz80_io) + +/* video hardware */ +MCFG_SCREEN_ADD("screen", RASTER) +MCFG_SCREEN_REFRESH_RATE(60) +MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ +MCFG_SCREEN_SIZE(132 * 10, 49 * 10) +MCFG_SCREEN_VISIBLE_AREA(0, 80 * 10 - 1, 0, 48 * 10 - 1) +MCFG_SCREEN_UPDATE_DRIVER(rainbow_state, screen_update_rainbow) +MCFG_SCREEN_PALETTE("vt100_video:palette") +MCFG_GFXDECODE_ADD("gfxdecode", "vt100_video:palette", rainbow) + +MCFG_DEVICE_ADD("vt100_video", RAINBOW_VIDEO, 0) +MCFG_VT_SET_SCREEN("screen") +MCFG_VT_CHARGEN("chargen") +MCFG_VT_VIDEO_RAM_CALLBACK(READ8(rainbow_state, read_video_ram_r)) +MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(rainbow_state, clear_video_interrupt)) + +MCFG_FD1793_ADD(FD1793_TAG, XTAL_24_0734MHz / 24) // no separate 1 Mhz quartz +//MCFG_WD_FDC_FORCE_READY +MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":0", rainbow_floppies, "525qd0", rainbow_state::floppy_formats) +MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":1", rainbow_floppies, "525qd1", rainbow_state::floppy_formats) +MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":2", rainbow_floppies, "525qd2", rainbow_state::floppy_formats) +MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":3", rainbow_floppies, "525qd3", rainbow_state::floppy_formats) +MCFG_SOFTWARE_LIST_ADD("flop_list", "rainbow") + + +/// ********************************* HARD DISK CONTROLLER ***************************************** +MCFG_DEVICE_ADD("hdc", WD2010, 5000000) // 10 Mhz quartz on controller (divided by 2 for WCLK) +MCFG_WD2010_OUT_INTRQ_CB(WRITELINE(rainbow_state, bundle_irq)) // FIRST IRQ SOURCE (OR'ed with DRQ) +MCFG_WD2010_OUT_BDRQ_CB(WRITELINE(rainbow_state, hdc_bdrq)) // BUFFER DATA REQUEST + +// SIGNALS -FROM- WD CONTROLLER: +MCFG_WD2010_OUT_BCS_CB(WRITELINE(rainbow_state, hdc_read_sector)) // Problem: OUT_BCS_CB = WRITE8 ... (!) +MCFG_WD2010_OUT_BCR_CB(WRITELINE(rainbow_state, hdc_bcr)) // BUFFER COUNTER RESET (pulses) + +MCFG_WD2010_OUT_WG_CB(WRITELINE(rainbow_state, hdc_write_sector)) // WRITE GATE +MCFG_WD2010_OUT_STEP_CB(WRITELINE(rainbow_state, hdc_step)) // STEP PULSE +MCFG_WD2010_OUT_DIRIN_CB(WRITELINE(rainbow_state, hdc_direction)) + +MCFG_WD2010_IN_WF_CB(READLINE(rainbow_state, hdc_write_fault)) // WRITE FAULT (set to GND if not serviced) + +MCFG_WD2010_IN_DRDY_CB(READLINE(rainbow_state, hdc_drive_ready)) // DRIVE_READY (set to VCC if not serviced) +MCFG_WD2010_IN_SC_CB(VCC) // SEEK COMPLETE (set to VCC if not serviced) + +// CURRENTLY NOT EVALUATED WITHIN 'WD2010': +MCFG_WD2010_IN_TK000_CB(VCC) +MCFG_WD2010_IN_INDEX_CB(VCC) + +MCFG_HARDDISK_ADD("harddisk1") +/// ******************************** / HARD DISK CONTROLLER **************************************** + +MCFG_DS1315_ADD("rtc") // DS1315 (ClikClok for DEC-100 B) * OPTIONAL * + +MCFG_DEVICE_ADD("kbdser", I8251, 0) +MCFG_I8251_TXD_HANDLER(WRITELINE(rainbow_state, kbd_tx)) +MCFG_I8251_DTR_HANDLER(WRITELINE(rainbow_state, irq_hi_w)) +MCFG_I8251_RXRDY_HANDLER(WRITELINE(rainbow_state, kbd_rxready_w)) +MCFG_I8251_TXRDY_HANDLER(WRITELINE(rainbow_state, kbd_txready_w)) + +MCFG_DEVICE_ADD(LK201_TAG, LK201, 0) +MCFG_LK201_TX_HANDLER(DEVWRITELINE("kbdser", i8251_device, write_rxd)) + +MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4800 * 16) // 8251 is set to /16 on the clock input +MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(rainbow_state, write_keyboard_clock)) + +MCFG_TIMER_DRIVER_ADD_PERIODIC("motor", rainbow_state, motor_tick, attotime::from_hz(60)) + +MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + +//---------------------------------------------------------------------------------------- +// 'Rainbow 100-A' (system module 70-19974-00, PSU H7842-A) +// - first generation hardware (introduced May '82) with ROM 04.03.11 +// - inability to boot from hard disc (mind the inadequate PSU) +//---------------------------------------------------------------------------------------- +// AVAILABLE RAM: 64 K on board (versus 128 K on model 'B'). + +// Two compatible memory expansions were sold by DEC: +// (PCIXX-AA) : 64 K (usable on either Rainbow 100-A or 100-B) * +// (PCIXX-AB) : 192 K ( " ) * +// Totals to 256 K on a 100-A, while the RAM limit appears to be 832 K. + +// * DEC changed the way signals are handled on J6 (memory connector) later: +// "Whether a PC100-A or PC100-B memory module is installed on the PC100-B system module +// affects the functions the signals on 5 pins (29, 30, 32, 43, and 47) of the J6 connector +// will perform." (from 'EK-RB100_TM_001 Addendum for PC100-A_PC100-B Dec.84' page 120). +//---------------------------------------------------------------------------------------- +// KNOWN DIFFERENCES TO 100-B: +// - cannot control bit 7 of IRQ vector (prevents DOS > 2.01 from booting on unmodified hardware) +// - 4 color palette with graphics option (instead of 16 colors on later models) +// - smaller ROMs (3 x 2764) with fewer routines (no documented way to beep...) +// - socketed NVRAM chip: X2212D 8238AES +ROM_START(rainbow100a) +ROM_REGION(0x100000, "maincpu", 0) + +ROM_LOAD("23-176e4-00.bin", 0xFA000, 0x2000, NO_DUMP) // ROM (FA000-FBFFF) (E89) 8 K +ROM_LOAD("23-177e4-00.bin", 0xFC000, 0x2000, NO_DUMP) // ROM (FC000-FDFFF) (E90) 8 K + +// SOCKETED LANGUAGE ROM (E91) with 1 single localization per ROM - +ROM_LOAD("23-092e4-00.bin", 0xFE000, 0x2000, NO_DUMP) // ROM (FE000-FFFFF) (E91) 8 K - English (?) +// See also MP-01491-00 - PC100A FIELD MAINTENANCE SET. Appendix A of EK-RB100 Rainbow +// Technical Manual Addendum f.100A and 100B (Dec.84) lists 15 localizations / part numbers + +ROM_REGION(0x1000, "chargen", 0) // [E98] 2732 (4 K) EPROM +ROM_LOAD("23-020e3-00.bin", 0x0000, 0x1000, CRC(1685e452) SHA1(bc299ff1cb74afcededf1a7beb9001188fdcf02f)) +ROM_END + +//---------------------------------------------------------------------------------------- +// ROM definition for 100-B (system module 70-19974-02, PSU H7842-D) +// Built until ~ May 1986 (from MP-01491-00) +// - 32 K ROM (version 5.03) +// - 128 K base and 896 K max. mem. +ROM_START(rainbow) +ROM_REGION(0x100000, "maincpu", 0) + +// Note that the 'Field Maintenance Print Set 1984' also lists alternate revision 'A1' with +// 23-063e3-00 (for chargen) and '23-074e5-00' / '23-073e5-00' for E5-01 / E5-02. + +// Part numbers 22E5, 20E5 and 37E3 verified to match revision "B" (FCC ID : A0994Q - PC100 - B). + +// BOOT ROM +ROM_LOAD("23-022e5-00.bin", 0xf0000, 0x4000, CRC(9d1332b4) SHA1(736306d2a36bd44f95a39b36ebbab211cc8fea6e)) +ROM_RELOAD(0xf4000, 0x4000) + +// LANGUAGE ROM +ROM_LOAD("23-020e5-00.bin", 0xf8000, 0x4000, CRC(8638712f) SHA1(8269b0d95dc6efbe67d500dac3999df4838625d8)) // German, French, English +//ROM_LOAD( "23-015e5-00.bin", 0xf8000, 0x4000, NO_DUMP) // Dutch, French, English +//ROM_LOAD( "23-016e5-00.bin", 0xf8000, 0x4000, NO_DUMP) // Finish, Swedish, English +//ROM_LOAD( "23-017e5-00.bin", 0xf8000, 0x4000, NO_DUMP) // Danish, Norwegian, English +//ROM_LOAD( "23-018e5-00.bin", 0xf8000, 0x4000, NO_DUMP) // Spanish, Italian, English +ROM_RELOAD(0xfc000, 0x4000) + +// CHARACTER GENERATOR (E3-03) +ROM_REGION(0x1000, "chargen", 0) +ROM_LOAD("23-037e3.bin", 0x0000, 0x1000, CRC(1685e452) SHA1(bc299ff1cb74afcededf1a7beb9001188fdcf02f)) +ROM_END + +//---------------------------------------------------------------------------------------- +// 'Rainbow 190 B' (announced March 1985) is identical to 100-B, with alternate ROM v5.05. +// According to an article in Wall Street Journal it came with a 10 MB HD and 640 K RAM. + +// All programs not dependent on specific ROM addresses should work. A first glance: +// - jump tables (F4000-F40083 and FC000-FC004D) were not extended +// - absolute addresses of some internal routines have changed (affects BOOT 2.x / 3.x dual boot) + +// A Readme from January 1985 mentions 'recent ROM changes for MASS 11' (a VAX word processor). +// It is *likely* that the sole differences between 5.05 and 5.03 affect terminal emulation. + +// FIXME: ROM names are * made up *. +// Someone who knows the DEC naming conventions should correct them - +ROM_START(rainbow190) +ROM_REGION(0x100000, "maincpu", 0) +ROM_LOAD("dec190rom0.bin", 0xf0000, 0x4000, CRC(fac191d2) SHA1(4aff5b1e031d3b5eafc568b23e68235270bb34de)) +ROM_RELOAD(0xf4000, 0x4000) +ROM_LOAD("dec190rom1.bin", 0xf8000, 0x4000, CRC(5ce59632) SHA1(d29793f7014c57a4e7cb77bbf6e84f9113635ed2)) + +ROM_RELOAD(0xfc000, 0x4000) +ROM_REGION(0x1000, "chargen", 0) +ROM_LOAD("chargen.bin", 0x0000, 0x1000, CRC(1685e452) SHA1(bc299ff1cb74afcededf1a7beb9001188fdcf02f)) +ROM_END +//---------------------------------------------------------------------------------------- + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP(1982, rainbow100a, rainbow, 0, rainbow, rainbow100b_in, driver_device, 0, "Digital Equipment Corporation", "Rainbow 100-A", MACHINE_IS_SKELETON) +COMP(1983, rainbow, 0, 0, rainbow, rainbow100b_in, driver_device, 0, "Digital Equipment Corporation", "Rainbow 100-B", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_COLORS) +COMP(1985, rainbow190, rainbow, 0, rainbow, rainbow100b_in, driver_device, 0, "Digital Equipment Corporation", "Rainbow 190-B", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_COLORS) diff --git a/src/mame/drivers/rambo.c b/src/mame/drivers/rambo.c new file mode 100644 index 00000000000..a1fcf25b781 --- /dev/null +++ b/src/mame/drivers/rambo.c @@ -0,0 +1,227 @@ +// license:GPL-2.0+ +// copyright-holders:Felipe Sanches +/* + RAMBo (RepRap Arduino-compatible Mother Board) by UltiMachine + for controlling desktop 3d printers + http://reprap.org/wiki/Rambo + + driver by Felipe Correa da Silva Sanches + + This driver is based on the schematics of the version 1.1b: + http://reprap.org/mediawiki/images/7/75/Rambo1-1-schematic.png + + 3d printers currently supported by this driver: + * Metam??quina 2 + + 3d printers known to use this board: + * TODO: list them all here +*/ + +#include "emu.h" +#include "cpu/avr8/avr8.h" + +#define MASTER_CLOCK 16000000 + +#define LOG_PORTS 0 + +/****************************************************\ +* I/O devices * +\****************************************************/ + +class rambo_state : public driver_device +{ +public: + rambo_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { + } + + UINT8 m_port_a; + UINT8 m_port_b; + UINT8 m_port_c; + UINT8 m_port_d; + UINT8 m_port_e; + UINT8 m_port_f; + UINT8 m_port_g; + UINT8 m_port_h; + UINT8 m_port_j; + UINT8 m_port_k; + UINT8 m_port_l; + required_device m_maincpu; + + DECLARE_READ8_MEMBER(port_r); + DECLARE_WRITE8_MEMBER(port_w); + + DECLARE_DRIVER_INIT(rambo); + virtual void machine_start(); + virtual void machine_reset(); +}; + +void rambo_state::machine_start() +{ +} + +READ8_MEMBER(rambo_state::port_r) +{ + switch( offset ) + { + case AVR8_IO_PORTA: + { +#if LOG_PORTS + printf("[%08X] Port A READ \n", m_maincpu->m_shifted_pc); +#endif + return m_port_a; + } + default: + break; + } + return 0; +} + +WRITE8_MEMBER(rambo_state::port_w) +{ + switch( offset ) + { + case AVR8_IO_PORTA: + { + if (data == m_port_a) break; + +#if LOG_PORTS + UINT8 old_port_a = m_port_a; + UINT8 changed = data ^ old_port_a; +#endif + m_port_a = data; + break; + } + default: + break; + } +} + +/****************************************************\ +* Address maps * +\****************************************************/ + +static ADDRESS_MAP_START( rambo_prg_map, AS_PROGRAM, 8, rambo_state ) + AM_RANGE(0x0000, 0x1FFFF) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( rambo_data_map, AS_DATA, 8, rambo_state ) + AM_RANGE(0x0200, 0x21FF) AM_RAM /* ATMEGA2560 Internal SRAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( rambo_io_map, AS_IO, 8, rambo_state ) + AM_RANGE(AVR8_IO_PORTA, AVR8_IO_PORTL) AM_READWRITE( port_r, port_w ) +ADDRESS_MAP_END + +/****************************************************\ +* Machine definition * +\****************************************************/ + +DRIVER_INIT_MEMBER(rambo_state, rambo) +{ +} + +void rambo_state::machine_reset() +{ + m_port_a = 0; + m_port_b = 0; + m_port_c = 0; + m_port_d = 0; + m_port_e = 0; + m_port_f = 0; + m_port_g = 0; + m_port_h = 0; + m_port_j = 0; + m_port_k = 0; + m_port_l = 0; +} + +static MACHINE_CONFIG_START( rambo, rambo_state ) + + MCFG_CPU_ADD("maincpu", ATMEGA2560, MASTER_CLOCK) + MCFG_CPU_PROGRAM_MAP(rambo_prg_map) + MCFG_CPU_DATA_MAP(rambo_data_map) + MCFG_CPU_IO_MAP(rambo_io_map) + + MCFG_CPU_AVR8_EEPROM("eeprom") + MCFG_CPU_AVR8_LFUSE(0xFF) + MCFG_CPU_AVR8_HFUSE(0xDA) + MCFG_CPU_AVR8_EFUSE(0xF4) + MCFG_CPU_AVR8_LOCK(0x0F) + + /*TODO: Add an ATMEGA32U2 for USB-Serial communications */ + /*TODO: Emulate the AD5206 digipot */ + /*TODO: Emulate the A4982 stepper motor drivers and instantiate 5 of these here + for controlling the X, Y, Z, E1 (and optionally E2) motors */ + /*TODO: Simulate the heating elements */ + /*TODO: Implement the thermistor measurements */ +MACHINE_CONFIG_END + +ROM_START( metamaq2 ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_DEFAULT_BIOS("20131015") + + ROM_SYSTEM_BIOS( 0, "20130619", "June 19th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_06_19) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-06-19.bin", 0x0000, 0x1000e, CRC(4279b178) SHA1(e4d3c9d6421287c980639c2df32d07b754adc8fc), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "20130624", "June 24th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_RC2_RAMBo_rev10e_2013_06_24) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-06-24_mm2rc2_rambo_rev10e.bin", 0x0000, 0xcebc, CRC(82400a3c) SHA1(0781ce29406ce69b63edb93d776b9c081bed841e), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS( 2, "20130625", "June 25th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_06_25) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-06-25.bin", 0x0000, 0x10076, CRC(e7e4db38) SHA1(0c307bb0a0ee4e9d38253936e7030d0efb3c1845), ROM_BIOS(3)) + + ROM_SYSTEM_BIOS( 3, "20130709", "July 9th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_07_09) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-07-09.bin", 0x0000, 0x10078, CRC(9a45509f) SHA1(3a2e6516b45cc0ea1aef039335b02208847aaebf), ROM_BIOS(4)) + + ROM_SYSTEM_BIOS( 4, "20130712", "July 12th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_07_12) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-07-12.bin", 0x0000, 0x10184, CRC(9aeac87c) SHA1(c1441096553c214c12a34da87fa42cc3f0eaf74d), ROM_BIOS(5)) + + ROM_SYSTEM_BIOS( 5, "20130717", "July 17th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_07_17) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-07-17.bin", 0x0000, 0x10180, CRC(7c053ed0) SHA1(7abeabcbfdb411b6e681e2d0c9398c40b142f76b), ROM_BIOS(6)) + + ROM_SYSTEM_BIOS( 6, "20130806", "August 6th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_08_06) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-08-06.bin", 0x0000, 0x1017e, CRC(6aaf5a14) SHA1(93cebee8ab9eda9d81e70504b407268a198577f0), ROM_BIOS(7)) + + ROM_SYSTEM_BIOS( 7, "20130809", "August 9th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_08_09) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-08-09.bin", 0x0000, 0x1018a, CRC(ee53a011) SHA1(666d09fe69220a172528fe8d1c358e3ddaaa743a), ROM_BIOS(8)) + + ROM_SYSTEM_BIOS( 8, "20130822", "August 22nd, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_08_22) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-08-22.bin", 0x0000, 0x1018a, CRC(70a5a3c9) SHA1(20e52ea7bf40e71020b815b9fb6385d880677927), ROM_BIOS(9)) + + ROM_SYSTEM_BIOS( 9, "20130913", "September 13th, 2013" ) + /* source code for this one is unavailable as it was an unreleased internal development build */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-09-13-devel.bin", 0x0000, 0x101bc, CRC(5e7c7933) SHA1(5b9bfe919daf705ad7a9a2de3cf4c51e3338ec47), ROM_BIOS(10)) + + ROM_SYSTEM_BIOS( 10, "20130920", "September 20th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_09_20) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-09-20.bin", 0x0000, 0x10384, CRC(48378e58) SHA1(513f0a0c65219875cc467420cc091e3489b58919), ROM_BIOS(11)) + + ROM_SYSTEM_BIOS( 11, "20131015", "October 15th, 2013" ) + /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_10_15) */ + ROMX_LOAD("repetier-fw-metamaquina2-2013-10-15.bin", 0x0000, 0x102c8, CRC(520134bd) SHA1(dfe2251aad06972f237eb4920ce14ccb32da5af0), ROM_BIOS(12)) + + /*Arduino MEGA bootloader */ + /* This is marked as a BAD_DUMP because we're not sure this is the bootloader we're actually using. + This is inherited from the Replicator 1 driver. + A proper dump would be good. + Also, it is not clear whether there's any difference in the bootloader + between the ATMEGA1280 and the ATMEGA2560 MCUs */ + ROM_LOAD( "atmegaboot_168_atmega1280.bin", 0x1f000, 0x0f16, BAD_DUMP CRC(c041f8db) SHA1(d995ebf360a264cccacec65f6dc0c2257a3a9224) ) + + /* on-die 4kbyte eeprom */ + ROM_REGION( 0x1000, "eeprom", ROMREGION_ERASEFF ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP(2012, metamaq2, 0, 0, rambo, 0, rambo_state, rambo, "Metamaquina", "Metamaquina 2 desktop 3d printer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/ravens.c b/src/mame/drivers/ravens.c new file mode 100644 index 00000000000..e122ab12f72 --- /dev/null +++ b/src/mame/drivers/ravens.c @@ -0,0 +1,388 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Ravensburger Selbstbaucomputer + +This is a project described in "Ravensburger" magazine. You had to make +the entire thing (including the circuit boards) yourself. + +http://petersieg.bplaced.com/?2650_Computer:2650_Selbstbaucomputer + + 2013-04-23 Skeleton driver. + + +No instructions, no schematics - it's all guesswork. + +The cassette saves a noise but it returns a bad load. + + +Version 0.9 +----------- +Hardware: + 0000-07FF ROM "MON1" + 0800-1FFF RAM (3x HM6116) + 24 pushbuttons and 6-digit LED display on front panel. + Other buttons and switches on the main board. + +The few photos show the CPU and a number of ordinary 74LSxxx chips. +There is a XTAL of unknown frequency. + +The buttons are labelled CMD, RUN, GOTO, RST, F, MON, PC, NXT but at +this time not all buttons are identified. + +What is known: +- Press NXT to read memory. Press NXT again to read the next address. +- Press PC and it says PCxxxx +- Press CMD, it says CND=, you can choose one of these: +-- A displays value of a register. Press A again to see more registers. +-- B sets a breakpoint +-- C clears a breakpoint +-- D dumps blocks to tape +-- E examine tape file +-- F fetch (load) from tape + +Quickload: Load the program then press Y. There are 6 that work and + 6 that do nothing. + +ToDo: +- Cassette + +Version V2.0 +------------ +This used a terminal interface with a few non-standard control codes. +The pushbuttons and LEDs appear to have been done away with. + +Commands (must be in uppercase): +A Examine memory; press C to alter memory +B Set breakpoint? +C View breakpoint? +D Dump to screen and tape (at the same time) +E Execute +I ? +L Load +R ? +V Verify? + +ToDo: +- Cassette + +****************************************************************************/ + +#include "emu.h" +#include "cpu/s2650/s2650.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "machine/terminal.h" +#include "sound/wave.h" +#include "ravens.lh" + +#define TERMINAL_TAG "terminal" + +class ravens_state : public driver_device +{ +public: + ravens_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_cass(*this, "cassette") + { + } + + DECLARE_READ8_MEMBER(port07_r); + DECLARE_READ8_MEMBER(port17_r); + DECLARE_WRITE8_MEMBER(port1b_w); + DECLARE_WRITE8_MEMBER(port1c_w); + DECLARE_WRITE8_MEMBER(display_w); + DECLARE_WRITE8_MEMBER(leds_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_MACHINE_RESET(ravens2); + DECLARE_READ8_MEMBER(cass_r); + DECLARE_WRITE_LINE_MEMBER(cass_w); + DECLARE_QUICKLOAD_LOAD_MEMBER( ravens ); + UINT8 m_term_char; + UINT8 m_term_data; + required_device m_maincpu; + optional_device m_terminal; + required_device m_cass; +}; + +WRITE_LINE_MEMBER( ravens_state::cass_w ) +{ + m_cass->output(state ? -1.0 : +1.0); +} + +READ8_MEMBER( ravens_state::cass_r ) +{ + return (m_cass->input() > 0.03) ? 1 : 0; +} + +WRITE8_MEMBER( ravens_state::display_w ) +{ + output_set_digit_value(offset, data); +} + +WRITE8_MEMBER( ravens_state::leds_w ) +{ + char ledname[8]; + for (int i = 0; i < 8; i++) + { + sprintf(ledname,"led%d",i); + output_set_value(ledname, !BIT(data, i)); + } +} + +READ8_MEMBER( ravens_state::port07_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0x80; + return ret; +} + +READ8_MEMBER( ravens_state::port17_r ) +{ + UINT8 keyin, i; + + keyin = ioport("X0")->read(); + if (keyin != 0xff) + for (i = 0; i < 8; i++) + if BIT(~keyin, i) + return i | 0x80; + + keyin = ioport("X1")->read(); + if (keyin != 0xff) + for (i = 0; i < 8; i++) + if BIT(~keyin, i) + return i | 0x88; + + keyin = ioport("X2")->read(); + if (!BIT(keyin, 0)) + m_maincpu->reset(); + if (keyin != 0xff) + for (i = 0; i < 8; i++) + if BIT(~keyin, i) + return (i<<4) | 0x80; + + return 0; +} + +WRITE8_MEMBER( ravens_state::port1b_w ) +{ + if (BIT(data, 7)) + return; + else + if ((data == 0x08 && m_term_char == 0x20)) + data = 0x0c; // FormFeed + else + if ((data == 0x0a && m_term_char == 0x20)) + data = 0x0a; // LineFeed + else + if ((data == 0x01 && m_term_char == 0xc2)) + data = 0x0d; // CarriageReturn + else + data = m_term_char; + + m_terminal->write(space, 0, data); +} + +WRITE8_MEMBER( ravens_state::port1c_w ) +{ + m_term_char = data; +} + +MACHINE_RESET_MEMBER( ravens_state, ravens2 ) +{ + m_term_data = 0x80; + output_set_digit_value(6, 0); +} + + +static ADDRESS_MAP_START( ravens_mem, AS_PROGRAM, 8, ravens_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff) AM_ROM + AM_RANGE( 0x0800, 0x1fff) AM_RAM + AM_RANGE( 0x2000, 0x7FFF) AM_RAM // for quickload, optional +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ravens_io, AS_IO, 8, ravens_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x09, 0x09) AM_WRITE(leds_w) // LED output port + AM_RANGE(0x10, 0x15) AM_WRITE(display_w) // 6-led display + AM_RANGE(0x17, 0x17) AM_READ(port17_r) // pushbuttons + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ravens2_io, AS_IO, 8, ravens_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x07, 0x07) AM_READ(port07_r) + AM_RANGE(0x1b, 0x1b) AM_WRITE(port1b_w) + AM_RANGE(0x1c, 0x1c) AM_WRITE(port1c_w) + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ravens ) + PORT_START("X0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("X1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("X2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("???") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("???") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CMD") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("???") PORT_CODE(KEYCODE_O) PORT_CHAR('O') +INPUT_PORTS_END + +WRITE8_MEMBER( ravens_state::kbd_put ) +{ + if (data > 0x60) data -= 0x20; // fold to uppercase + m_term_data = data; +} + +QUICKLOAD_LOAD_MEMBER( ravens_state, ravens ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int i; + int quick_addr = 0x900; + int exec_addr; + int quick_length; + dynamic_buffer quick_data; + int read_; + int result = IMAGE_INIT_FAIL; + + quick_length = image.length(); + if (quick_length < 0x0900) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.message(" File too short"); + } + else if (quick_length > 0x8000) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.message(" File too long"); + } + else + { + quick_data.resize(quick_length); + read_ = image.fread( &quick_data[0], quick_length); + if (read_ != quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.message(" Cannot read the file"); + } + else if (quick_data[0] != 0xc6) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.message(" Invalid header"); + } + else + { + exec_addr = quick_data[2] * 256 + quick_data[3]; + + if (exec_addr >= quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.message(" Exec address beyond end of file"); + } + else + { + for (i = quick_addr; i < read_; i++) + space.write_byte(i, quick_data[i]); + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); + + // Start the quickload + m_maincpu->set_state_int(S2650_PC, exec_addr); + + result = IMAGE_INIT_PASS; + } + } + } + + return result; +} + +static MACHINE_CONFIG_START( ravens, ravens_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) // frequency is unknown + MCFG_CPU_PROGRAM_MAP(ravens_mem) + MCFG_CPU_IO_MAP(ravens_io) + MCFG_S2650_FLAG_HANDLER(WRITELINE(ravens_state, cass_w)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_ravens) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", ravens_state, ravens, "pgm", 1) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ravens2, ravens_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) // frequency is unknown + MCFG_CPU_PROGRAM_MAP(ravens_mem) + MCFG_CPU_IO_MAP(ravens2_io) + MCFG_S2650_FLAG_HANDLER(WRITELINE(ravens_state, cass_w)) + + MCFG_MACHINE_RESET_OVERRIDE(ravens_state, ravens2) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ravens_state, kbd_put)) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", ravens_state, ravens, "pgm", 1) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ravens ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "v1.0", "V1.0" ) + ROMX_LOAD( "mon_v1.0.bin", 0x0000, 0x0800, CRC(785eb1ad) SHA1(c316b8ac32ab6aa37746af37b9f81a23367fedd8), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v0.9", "V0.9" ) + ROMX_LOAD( "mon_v0_9.bin", 0x0000, 0x07b5, CRC(2f9b9178) SHA1(ec2ebbc80ee9ff2502c1409ab4f99127032ed724), ROM_BIOS(2)) +ROM_END + +ROM_START( ravens2 ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "mon_v2.0.bin", 0x0000, 0x0800, CRC(bcd47c58) SHA1(f261a3f128fbedbf59a8b5480758fff4d7f76de1)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, ravens, 0, 0, ravens, ravens, driver_device, 0, "Joseph Glagla and Dieter Feiler", "Ravensburger Selbstbaucomputer V0.9", MACHINE_NO_SOUND_HW ) +COMP( 1985, ravens2, ravens, 0, ravens2, ravens, driver_device, 0, "Joseph Glagla and Dieter Feiler", "Ravensburger Selbstbaucomputer V2.0", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/rc759.c b/src/mame/drivers/rc759.c new file mode 100644 index 00000000000..aa69efb9dd2 --- /dev/null +++ b/src/mame/drivers/rc759.c @@ -0,0 +1,617 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Regnecentralen RC759 Piccoline + + Status: Error 32 (cassette data error) + +***************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i186.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "machine/mm58167.h" +#include "machine/pic8259.h" +#include "machine/i8255.h" +#include "video/i82730.h" +#include "sound/speaker.h" +#include "sound/sn76496.h" +#include "machine/keyboard.h" +#include "bus/centronics/ctronics.h" +#include "machine/wd_fdc.h" +#include "imagedev/cassette.h" +#include "bus/isbx/isbx.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class rc759_state : public driver_device +{ +public: + rc759_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pic(*this, "pic"), + m_nvram(*this, "nvram"), + m_ppi(*this, "ppi"), + m_txt(*this, "txt"), + m_cas(*this, "cas"), + m_isbx(*this, "isbx"), + m_speaker(*this, "speaker"), + m_snd(*this, "snd"), + m_rtc(*this, "rtc"), + m_centronics(*this, "centronics"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_vram(*this, "vram"), + m_config(*this, "config"), + m_cas_enabled(0), m_cas_data(0), + m_drq_source(0), + m_nvram_bank(0), + m_gfx_mode(0), + m_keyboard_enable(0), m_keyboard_key(0x00), + m_centronics_strobe(0), m_centronics_init(0), m_centronics_select_in(0), m_centronics_busy(0), + m_centronics_ack(0), m_centronics_fault(0), m_centronics_perror(0), m_centronics_select(0), + m_centronics_data(0xff) + { } + + DECLARE_WRITE8_MEMBER(keyb_put); + DECLARE_READ8_MEMBER(keyboard_r); + + DECLARE_WRITE8_MEMBER(floppy_control_w); + DECLARE_READ8_MEMBER(floppy_ack_r); + DECLARE_WRITE8_MEMBER(floppy_reserve_w); + DECLARE_WRITE8_MEMBER(floppy_release_w); + + DECLARE_READ8_MEMBER(ppi_porta_r); + DECLARE_READ8_MEMBER(ppi_portb_r); + DECLARE_WRITE8_MEMBER(ppi_portc_w); + + DECLARE_WRITE_LINE_MEMBER(centronics_busy_w); + DECLARE_WRITE_LINE_MEMBER(centronics_ack_w); + DECLARE_WRITE_LINE_MEMBER(centronics_fault_w); + DECLARE_WRITE_LINE_MEMBER(centronics_perror_w); + DECLARE_WRITE_LINE_MEMBER(centronics_select_w); + + DECLARE_READ8_MEMBER(centronics_data_r); + DECLARE_WRITE8_MEMBER(centronics_data_w); + DECLARE_READ8_MEMBER(centronics_control_r); + DECLARE_WRITE8_MEMBER(centronics_control_w); + + I82730_UPDATE_ROW(txt_update_row); + DECLARE_WRITE16_MEMBER(txt_ca_w); + DECLARE_WRITE16_MEMBER(txt_irst_w); + DECLARE_READ8_MEMBER(palette_r); + DECLARE_WRITE8_MEMBER(palette_w); + + DECLARE_WRITE_LINE_MEMBER(i186_timer0_w); + DECLARE_WRITE_LINE_MEMBER(i186_timer1_w); + + void nvram_init(nvram_device &nvram, void *data, size_t size); + DECLARE_READ8_MEMBER(nvram_r); + DECLARE_WRITE8_MEMBER(nvram_w); + DECLARE_READ8_MEMBER(rtc_r); + DECLARE_WRITE8_MEMBER(rtc_w); + DECLARE_READ8_MEMBER(irq_callback); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + +private: + required_device m_maincpu; + required_device m_pic; + required_device m_nvram; + required_device m_ppi; + required_device m_txt; + required_device m_cas; + required_device m_isbx; + required_device m_speaker; + required_device m_snd; + required_device m_rtc; + required_device m_centronics; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_shared_ptr m_vram; + required_ioport m_config; + + std::vector m_nvram_mem; + + int m_cas_enabled; + int m_cas_data; + int m_drq_source; + int m_nvram_bank; + int m_gfx_mode; + int m_keyboard_enable; + UINT8 m_keyboard_key; + + int m_centronics_strobe; + int m_centronics_init; + int m_centronics_select_in; + int m_centronics_busy; + int m_centronics_ack; + int m_centronics_fault; + int m_centronics_perror; + int m_centronics_select; + UINT8 m_centronics_data; +}; + + +//************************************************************************** +// I/O +//************************************************************************** + +WRITE8_MEMBER( rc759_state::keyb_put ) +{ + m_keyboard_key = data; + m_pic->ir1_w(1); +} + +READ8_MEMBER( rc759_state::keyboard_r ) +{ + logerror("keyboard_r\n"); + + m_pic->ir1_w(0); + + if (m_keyboard_enable) + return m_keyboard_key; + else + return 0x00; +} + +READ8_MEMBER( rc759_state::ppi_porta_r ) +{ + UINT8 data = 0; + + data |= m_cas_enabled ? m_cas_data : (m_cas->input() > 0 ? 1 : 0); + data |= m_isbx->mpst_r() << 1; + data |= m_isbx->opt0_r() << 2; + data |= m_isbx->opt1_r() << 3; + data |= 1 << 4; // mem ident0 + data |= 1 << 5; // mem ident1 (both 1 = 256k installed) + data |= 1 << 6; // dpc connect (0 = external floppy/printer installed) + data |= 1 << 7; // not used + + return data; +} + +READ8_MEMBER( rc759_state::ppi_portb_r ) +{ + UINT8 data = 0; + + data |= 1 << 0; // 0 = micronet controller installed + data |= 1 << 1; // rtc type, mm58167/cdp1879 + data |= m_snd->ready_r() << 2; + data |= 1 << 3; // not used + data |= 1 << 4; // not used + data |= m_config->read(); // monitor type and frequency + data |= 1 << 7; // 0 = enable remote hardware debug (using an isbx351 module) + + return data; +} + +WRITE8_MEMBER( rc759_state::ppi_portc_w ) +{ + m_cas_enabled = BIT(data, 0); + m_cas->change_state(BIT(data, 1) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_drq_source = (data >> 2) & 0x03; + m_nvram_bank = (data >> 4) & 0x03; + m_gfx_mode = BIT(data, 6); + m_keyboard_enable = BIT(data, 7); + + logerror("ppi_portc_w: cas_enabled: %d, cas_motor: %d, drq_source: %d, nvram_bank: %d, gfx_mode: %d, keyb_enable: %d\n", + m_cas_enabled, BIT(data, 1), m_drq_source, m_nvram_bank, m_gfx_mode, m_keyboard_enable); +} + +WRITE_LINE_MEMBER( rc759_state::centronics_busy_w ) +{ + m_centronics_busy = state; + m_pic->ir6_w(state); +} + +WRITE_LINE_MEMBER( rc759_state::centronics_ack_w ) +{ + m_centronics_ack = state; +} + +WRITE_LINE_MEMBER( rc759_state::centronics_fault_w ) +{ + m_centronics_fault = state; +} + +WRITE_LINE_MEMBER( rc759_state::centronics_perror_w ) +{ + m_centronics_perror = state; +} + +WRITE_LINE_MEMBER( rc759_state::centronics_select_w ) +{ + m_centronics_select = state; +} + +READ8_MEMBER( rc759_state::centronics_data_r ) +{ + return m_centronics_data; +} + +WRITE8_MEMBER( rc759_state::centronics_data_w ) +{ + m_centronics_data = data; + + m_centronics->write_data0(BIT(data, 0)); + m_centronics->write_data1(BIT(data, 1)); + m_centronics->write_data2(BIT(data, 2)); + m_centronics->write_data3(BIT(data, 3)); + m_centronics->write_data4(BIT(data, 4)); + m_centronics->write_data5(BIT(data, 5)); + m_centronics->write_data6(BIT(data, 6)); + m_centronics->write_data7(BIT(data, 7)); +} + +READ8_MEMBER( rc759_state::centronics_control_r ) +{ + UINT8 data = 0; + + data |= m_centronics_busy << 0; + data |= m_centronics_ack << 1; + data |= m_centronics_fault << 2; + data |= m_centronics_perror << 3; + data |= m_centronics_select << 4; + data |= !m_centronics_strobe << 5; + data |= !m_centronics_init << 6; + data |= !m_centronics_select_in << 7; + + return data; +} + +WRITE8_MEMBER( rc759_state::centronics_control_w ) +{ + logerror("centronics_control_w: %02x\n", data); + + m_centronics_strobe = BIT(data, 0); + m_centronics_init = BIT(data, 2); + m_centronics_select_in = BIT(data, 4); + + m_centronics->write_strobe(m_centronics_strobe); + m_centronics->write_autofd(BIT(data, 1)); + m_centronics->write_init(m_centronics_init); + m_centronics->write_select_in(m_centronics_select_in); +} + +WRITE8_MEMBER( rc759_state::floppy_control_w ) +{ + logerror("floppy_control_w: %02x\n", data); + + switch (BIT(data, 0)) + { + case 0: m_fdc->set_floppy(m_floppy0->get_device()); break; + case 1: m_fdc->set_floppy(m_floppy1->get_device()); break; + } + + if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(!BIT(data, 1)); + if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(!BIT(data, 2)); + + // bit 3, enable precomp + // bit 4, precomp 125/250 nsec + + m_fdc->dden_w(BIT(data, 5)); + m_fdc->set_unscaled_clock(BIT(data, 6) ? 2000000 : 1000000); + m_fdc->set_force_ready(BIT(data, 7)); +} + +READ8_MEMBER( rc759_state::floppy_ack_r ) +{ + logerror("floppy_ack_r\n"); + return 0xff; +} + +WRITE8_MEMBER( rc759_state::floppy_reserve_w ) +{ + logerror("floppy_reserve_w: %02x\n", data); +} + +WRITE8_MEMBER( rc759_state::floppy_release_w ) +{ + logerror("floppy_release_w: %02x\n", data); +} + + +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +I82730_UPDATE_ROW( rc759_state::txt_update_row ) +{ + for (int i = 0; i < x_count; i++) + { + UINT16 gfx = m_vram[(data[i] & 0x3ff) << 4 | lc]; + + // pretty crude detection if char sizes have been initialized, need something better + if ((gfx & 0xff) == 0) + continue; + + // figure out char width + int width; + for (width = 0; width < 16; width++) + if (BIT(gfx, width) == 0) + break; + + width = 15 - width; + + for (int p = 0; p < width; p++) + bitmap.pix32(y, i * width + p) = BIT(gfx, 15 - p) ? rgb_t::white : rgb_t::black; + } +} + +WRITE16_MEMBER( rc759_state::txt_ca_w ) +{ + m_txt->ca_w(1); + m_txt->ca_w(0); +} + +WRITE16_MEMBER( rc759_state::txt_irst_w ) +{ + m_txt->irst_w(1); + m_txt->irst_w(0); +} + +READ8_MEMBER( rc759_state::palette_r ) +{ + logerror("palette_r(%02x)\n", offset); + return 0xff; +} + +WRITE8_MEMBER( rc759_state::palette_w ) +{ + logerror("palette_w(%02x): %02x\n", offset, data); +} + + +//************************************************************************** +// SOUND/RTC +//************************************************************************** + +READ8_MEMBER( rc759_state::rtc_r ) +{ + logerror("rtc_r(%02x)\n", offset); + return 0xff; +} + +WRITE8_MEMBER( rc759_state::rtc_w ) +{ + logerror("rtc_w(%02x): %02x\n", offset, data); +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +WRITE_LINE_MEMBER( rc759_state::i186_timer0_w ) +{ + if (m_cas_enabled) + { + m_cas_data = state; + m_cas->output(state ? -1.0 : 1.0); + } +} + +WRITE_LINE_MEMBER( rc759_state::i186_timer1_w ) +{ + m_speaker->level_w(state); +} + +// 256x4 nvram is bank-switched using ppi port c, bit 4 and 5 +void rc759_state::nvram_init(nvram_device &nvram, void *data, size_t size) +{ + memset(data, 0x00, size); + memset(data, 0xaa, 1); +} + +READ8_MEMBER( rc759_state::nvram_r ) +{ + offs_t addr = (m_nvram_bank << 6) | offset; + + logerror("nvram_r(%02x)\n", addr); + + if (addr & 1) + return (m_nvram_mem[addr >> 1] & 0xf0) >> 4; + else + return (m_nvram_mem[addr >> 1] & 0x0f) >> 0; +} + +WRITE8_MEMBER( rc759_state::nvram_w ) +{ + offs_t addr = (m_nvram_bank << 6) | offset; + + logerror("nvram_w(%02x): %02x\n", addr, data); + + if (addr & 1) + m_nvram_mem[addr >> 1] = ((data << 4) & 0xf0) | (m_nvram_mem[addr >> 1] & 0x0f); + else + m_nvram_mem[addr >> 1] = (m_nvram_mem[addr >> 1] & 0xf0) | (data & 0x0f); +} + +READ8_MEMBER( rc759_state::irq_callback ) +{ + return m_pic->acknowledge(); +} + +void rc759_state::machine_start() +{ + m_nvram_mem.resize(256 / 2); + m_nvram->set_base(&m_nvram_mem[0], 256 / 2); +} + +void rc759_state::machine_reset() +{ +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( rc759_map, AS_PROGRAM, 16, rc759_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM + AM_RANGE(0xd8000, 0xdffff) AM_MIRROR(0x08000) AM_RAM AM_SHARE("vram") + AM_RANGE(0xf8000, 0xfffff) AM_MIRROR(0x10000) AM_ROM AM_REGION("bios", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( rc759_io, AS_IO, 16, rc759_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000, 0x003) AM_MIRROR(0x0c) AM_DEVREADWRITE8("pic", pic8259_device, read, write, 0x00ff) + AM_RANGE(0x020, 0x021) AM_READ8(keyboard_r, 0x00ff) + AM_RANGE(0x056, 0x057) AM_NOP // in reality, access to sound and rtc is a bit more involved + AM_RANGE(0x05a, 0x05b) AM_DEVWRITE8("snd", sn76489a_device, write, 0x00ff) + AM_RANGE(0x05c, 0x05d) AM_READWRITE8(rtc_r, rtc_w, 0x00ff) +// AM_RANGE(0x060, 0x06f) AM_WRITE8(crt_control_w, 0x00ff) + AM_RANGE(0x070, 0x077) AM_MIRROR(0x08) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) + AM_RANGE(0x080, 0x0ff) AM_READWRITE8(nvram_r, nvram_w, 0x00ff) +// AM_RANGE(0x100, 0x101) net + AM_RANGE(0x180, 0x1bf) AM_READWRITE8(palette_r, palette_w, 0x00ff) + AM_RANGE(0x230, 0x231) AM_WRITE(txt_irst_w) + AM_RANGE(0x240, 0x241) AM_WRITE(txt_ca_w) + AM_RANGE(0x250, 0x251) AM_READWRITE8(centronics_data_r, centronics_data_w, 0x00ff) + AM_RANGE(0x260, 0x261) AM_READWRITE8(centronics_control_r, centronics_control_w, 0x00ff) + AM_RANGE(0x280, 0x287) AM_DEVREADWRITE8("fdc", wd2797_t, read, write, 0x00ff) + AM_RANGE(0x288, 0x289) AM_WRITE8(floppy_control_w, 0x00ff) +// AM_RANGE(0x28a, 0x28b) external printer data +// AM_RANGE(0x28d, 0x28d) external printer control + AM_RANGE(0x28e, 0x28f) AM_READWRITE8(floppy_ack_r, floppy_reserve_w, 0x00ff) + AM_RANGE(0x290, 0x291) AM_WRITE8(floppy_release_w, 0x00ff) +// AM_RANGE(0x292, 0x293) AM_READWRITE8(printer_ack_r, printer_reserve_w, 0x00ff) +// AM_RANGE(0x294, 0x295) AM_WRITE8(printer_release_w, 0x00ff) + AM_RANGE(0x300, 0x30f) AM_DEVREADWRITE8("isbx", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) + AM_RANGE(0x310, 0x31f) AM_DEVREADWRITE8("isbx", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) +// AM_RANGE(0x320, 0x321) isbx dma ack +// AM_RANGE(0x330, 0x331) isbx tc +ADDRESS_MAP_END + + +//************************************************************************** +// INPUTS +//************************************************************************** + +static INPUT_PORTS_START( rc759 ) + PORT_START("config") + PORT_CONFNAME(0x20, 0x00, "Monitor Type") + PORT_CONFSETTING(0x00, "Color") + PORT_CONFSETTING(0x20, "Monochrome") + PORT_CONFNAME(0x40, 0x00, "Monitor Frequency") + PORT_CONFSETTING(0x00, "15 kHz") + PORT_CONFSETTING(0x40, "22 kHz") +INPUT_PORTS_END + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static SLOT_INTERFACE_START( rc759_floppies ) + SLOT_INTERFACE("hd", FLOPPY_525_HD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( rc759, rc759_state ) + MCFG_CPU_ADD("maincpu", I80186, 6000000) + MCFG_CPU_PROGRAM_MAP(rc759_map) + MCFG_CPU_IO_MAP(rc759_io) + MCFG_80186_IRQ_SLAVE_ACK(READ8(rc759_state, irq_callback)) + MCFG_80186_TMROUT0_HANDLER(WRITELINE(rc759_state, i186_timer0_w)) + MCFG_80186_TMROUT1_HANDLER(WRITELINE(rc759_state, i186_timer1_w)) + + // interrupt controller + MCFG_PIC8259_ADD("pic", DEVWRITELINE("maincpu", i80186_cpu_device, int0_w), VCC, NULL) + + // nvram + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", rc759_state, nvram_init) + + // ppi + MCFG_DEVICE_ADD("ppi", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(rc759_state, ppi_porta_r)) + MCFG_I8255_IN_PORTB_CB(READ8(rc759_state, ppi_portb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(rc759_state, ppi_portc_w)) + + // rtc + MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz) + MCFG_MM58167_IRQ_CALLBACK(DEVWRITELINE("pic", pic8259_device, ir3_w)) + + // video + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(1250000 * 16, 896, 96, 816, 377, 4, 364) // 22 kHz setting + MCFG_SCREEN_UPDATE_DEVICE("txt", i82730_device, screen_update) + + MCFG_I82730_ADD("txt", "maincpu", 1250000) + MCFG_VIDEO_SET_SCREEN("screen") + MCFG_I82730_UPDATE_ROW_CB(rc759_state, txt_update_row) + MCFG_I82730_SINT_HANDLER(DEVWRITELINE("pic", pic8259_device, ir4_w)) + + // keyboard + MCFG_DEVICE_ADD("keyb", GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(rc759_state, keyb_put)) + + // cassette + MCFG_CASSETTE_ADD("cas") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + // sound + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ADD("snd", SN76489A, XTAL_20MHz / 10) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + // internal centronics + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(rc759_state, centronics_busy_w)) + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(rc759_state, centronics_ack_w)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(rc759_state, centronics_fault_w)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(rc759_state, centronics_perror_w)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(rc759_state, centronics_select_w)) + + // isbx slot + MCFG_ISBX_SLOT_ADD("isbx", 0, isbx_cards, NULL) + MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int1_w)) + MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int3_w)) + MCFG_ISBX_SLOT_MDRQT_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq0_w)) + + // floppy disk controller + MCFG_WD2797_ADD("fdc", 1000000) +// MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pic", pic8259_device, ir0_w)) +// MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq1_w)) + + // floppy drives + MCFG_FLOPPY_DRIVE_ADD("fdc:0", rc759_floppies, "hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", rc759_floppies, "hd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( rc759 ) + ROM_REGION(0x8000, "bios", 0) + ROM_SYSTEM_BIOS(0, "1-21", "1? Version 2.1") + ROMX_LOAD("rc759-1-2.1.rom", 0x0000, 0x8000, CRC(3a777d56) SHA1(a8592d61d5e1f92651a6f5e41c4ba14c9b6cc39b), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "1-51", "1? Version 5.1") + ROMX_LOAD("rc759-1-5.1.rom", 0x0000, 0x8000, CRC(e1d53845) SHA1(902dc5ce28efd26b4f9c631933e197c2c187a7f1), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "2-40", "2? Version 4.0") + ROMX_LOAD("rc759-2-4.0.rom", 0x0000, 0x8000, CRC(d3cb752a) SHA1(f50afe5dfa1b33a36a665d32d57c8c41d6685005), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "2-51", "2? Version 5.1") + ROMX_LOAD("rc759-2-5.1.rom", 0x0000, 0x8000, CRC(00a31948) SHA1(23c4473c641606a56473791773270411d1019248), ROM_BIOS(4)) +ROM_END + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +COMP( 1984, rc759, 0, 0, rc759, rc759, driver_device, 0, "Regnecentralen", "RC759 Piccoline", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/rd110.c b/src/mame/drivers/rd110.c new file mode 100644 index 00000000000..2be9e6d7c11 --- /dev/null +++ b/src/mame/drivers/rd110.c @@ -0,0 +1,278 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, Jonathan Gevaryahu +/************************************************************************************************* + + Roland D-110 driver + + Driver by Olivier Galibert and Jonathan Gevaryahu + + The Roland D-110 is an expander (synthesizer without the keyboard) + from 1988. Internally it's very similar to a mt32, with a better + LCD screen (16x2) and more control buttons. More importantly, it + has more sound rom, a battery-backed ram and a port for memory + cards allowing to load and save new sounds. + + After the first boot, the ram needs to be reinitialized to factory + default values. Press Write/Copy (I) while resetting then + validate with Enter (K). +*/ + +#include "emu.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "video/msm6222b.h" +#include "cpu/mcs96/i8x9x.h" + +static INPUT_PORTS_START( d110 ) + PORT_START("SC0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Write/Copy") PORT_CODE(KEYCODE_I) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Number +") PORT_CODE(KEYCODE_U) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bank +") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Group +") PORT_CODE(KEYCODE_T) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part +") PORT_CODE(KEYCODE_R) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Timbre") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Patch") PORT_CODE(KEYCODE_W) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Exit") PORT_CODE(KEYCODE_Q) + + PORT_START("SC1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Enter") PORT_CODE(KEYCODE_K) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Number -") PORT_CODE(KEYCODE_J) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bank -") PORT_CODE(KEYCODE_H) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Group -") PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part -") PORT_CODE(KEYCODE_F) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("System") PORT_CODE(KEYCODE_D) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Edit") PORT_CODE(KEYCODE_A) +INPUT_PORTS_END + +class d110_state : public driver_device +{ +public: + required_device cpu; + required_device ram; + required_device rams; + required_device memc; + required_device memcs; + required_device lcd; + required_device midi_timer; + + d110_state(const machine_config &mconfig, device_type type, const char *tag); + + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(d110); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE8_MEMBER(bank_w); + DECLARE_WRITE8_MEMBER(so_w); + DECLARE_WRITE16_MEMBER(midi_w); + + DECLARE_READ8_MEMBER(lcd_ctrl_r); + DECLARE_WRITE8_MEMBER(lcd_ctrl_w); + DECLARE_WRITE8_MEMBER(lcd_data_w); + DECLARE_READ16_MEMBER(port0_r); + + TIMER_DEVICE_CALLBACK_MEMBER(midi_timer_cb); + TIMER_DEVICE_CALLBACK_MEMBER(samples_timer_cb); + +private: + UINT8 lcd_data_buffer[256]; + int lcd_data_buffer_pos; + UINT8 midi; + int midi_pos; + UINT8 port0; + required_device m_maincpu; +}; + +d110_state::d110_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + cpu(*this, "maincpu"), + ram(*this, "ram"), + rams(*this, "rams"), + memc(*this, "memc"), + memcs(*this, "memcs"), + lcd(*this, "lcd"), + midi_timer(*this, "midi_timer") +, + m_maincpu(*this, "maincpu") { +} + + +UINT32 d110_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0); + const UINT8 *data = lcd->render(); + for(int l=0; l<2; l++) + for(int c=0; c<20; c++) + for(int y=0; y<8; y++) { + UINT8 v = data[c*16 + l*40*16 + y]; + for(int x=0; x<5; x++) + bitmap.pix16(y+9*l, c*6+x) = v & (0x10 >> x) ? 1 : 0; + } + return 0; +} + +void d110_state::machine_start() +{ + rams->set_base(ram->pointer(), 32768); + memcs->set_base(memc->pointer(), 32768); + + membank("bank")->configure_entries(0x00, 4, memregion("maincpu")->base(), 0x4000); + membank("bank")->configure_entries(0x10, 2, ram->pointer(), 0x4000); + membank("bank")->configure_entries(0x20, 8, memregion("presets")->base(), 0x4000); + membank("bank")->configure_entries(0x30, 2, memc->pointer(), 0x4000); + membank("fixed")->set_base(ram->pointer()); + + lcd_data_buffer_pos = 0; +} + +void d110_state::machine_reset() +{ + // midi_timer->adjust(attotime::from_hz(1)); + midi_pos = 0; + port0 = 0x80; // battery ok +} + +WRITE8_MEMBER(d110_state::lcd_ctrl_w) +{ + lcd->control_w(data); + for(int i=0; i != lcd_data_buffer_pos; i++) + lcd->data_w(lcd_data_buffer[i]); + lcd_data_buffer_pos = 0; +} + +READ8_MEMBER(d110_state::lcd_ctrl_r) +{ + // Busy flag in the msm622b is bit 7, while the software expects it in bit 0... + return lcd->control_r() >> 7; +} + +WRITE8_MEMBER(d110_state::lcd_data_w) +{ + if(lcd_data_buffer_pos == sizeof(lcd_data_buffer)) { + logerror("Warning: lcd data buffer overflow (%04x)\n", cpu->pc()); + return; + } + lcd_data_buffer[lcd_data_buffer_pos++] = data; +} + +WRITE8_MEMBER(d110_state::bank_w) +{ + membank("bank")->set_entry(data); +} + +WRITE16_MEMBER(d110_state::midi_w) +{ + logerror("midi_out %02x\n", data); + midi = data; +} + +TIMER_DEVICE_CALLBACK_MEMBER(d110_state::midi_timer_cb) +{ + const static UINT8 midi_data[3] = { 0x91, 0x40, 0x7f }; + midi = midi_data[midi_pos++]; + logerror("midi_in %02x\n", midi); + cpu->serial_w(midi); + if(midi_pos < sizeof(midi_data)) + midi_timer->adjust(attotime::from_hz(1250)); +} + +READ16_MEMBER(d110_state::port0_r) +{ + return port0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(d110_state::samples_timer_cb) +{ + port0 ^= 0x10; +} + +WRITE8_MEMBER(d110_state::so_w) +{ + // bit 0 = led + // bit 1-2 = reverb program a13/a14 + // bit 3 = R. SW. to ananlog board + // bit 5 = boss 8Mhz clock, handled internally + // logerror("so: rw=%d bank=%d led=%d\n", (data >> 3) & 1, (data >> 1) & 3, data & 1); +} + +PALETTE_INIT_MEMBER(d110_state, d110) +{ + palette.set_pen_color(0, rgb_t(0, 255, 0)); + palette.set_pen_color(1, rgb_t(0, 0, 0)); +} + +static ADDRESS_MAP_START( d110_map, AS_PROGRAM, 8, d110_state ) + AM_RANGE(0x0100, 0x0100) AM_WRITE(bank_w) + AM_RANGE(0x0200, 0x0200) AM_WRITE(so_w) + AM_RANGE(0x021a, 0x021a) AM_READ_PORT("SC0") AM_WRITENOP + AM_RANGE(0x021c, 0x021c) AM_READ_PORT("SC1") + AM_RANGE(0x0300, 0x0300) AM_WRITE(lcd_data_w) + AM_RANGE(0x0380, 0x0380) AM_READWRITE(lcd_ctrl_r, lcd_ctrl_w) + AM_RANGE(0x1000, 0x7fff) AM_ROM AM_REGION("maincpu", 0x1000) + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("fixed") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( d110_io, AS_IO, 16, d110_state ) + AM_RANGE(i8x9x_device::SERIAL, i8x9x_device::SERIAL) AM_WRITE(midi_w) + AM_RANGE(i8x9x_device::P0, i8x9x_device::P0) AM_READ(port0_r) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( d110, d110_state ) + MCFG_CPU_ADD( "maincpu", P8098, XTAL_12MHz ) + MCFG_CPU_PROGRAM_MAP( d110_map ) + MCFG_CPU_IO_MAP( d110_io ) + +// Battery-backed main ram + MCFG_RAM_ADD( "ram" ) + MCFG_RAM_DEFAULT_SIZE( "32K" ) + MCFG_NVRAM_ADD_0FILL( "rams" ) + + +// Shall become a proper memcard device someday + MCFG_RAM_ADD( "memc" ) + MCFG_RAM_DEFAULT_SIZE( "32K" ) + MCFG_NVRAM_ADD_0FILL( "memcs" ) + + MCFG_SCREEN_ADD( "screen", LCD ) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DRIVER(d110_state, screen_update) +// MCFG_SCREEN_SIZE(20*6-1, 2*9-1) + MCFG_SCREEN_SIZE(16*6-1, (16*6-1)*3/4) + MCFG_SCREEN_VISIBLE_AREA(0, 16*6-2, 0, (16*6-1)*3/4-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(d110_state, d110) + + MCFG_MSM6222B_01_ADD( "lcd" ) + + MCFG_TIMER_DRIVER_ADD( "midi_timer", d110_state, midi_timer_cb ) + + MCFG_TIMER_DRIVER_ADD_PERIODIC( "samples_timer", d110_state, samples_timer_cb, attotime::from_hz(32000*2) ) +MACHINE_CONFIG_END + +ROM_START( d110 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_DEFAULT_BIOS( "110" ) + + ROM_SYSTEM_BIOS( 0, "106", "Firmware 1.06" ) + ROMX_LOAD( "d-110.v1.06.ic19.bin", 0, 0x8000, CRC(3dd5b6e9) SHA1(73b155fb0a8adc2362e73cb0803dafba9ccfb508), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "110", "Firmware 1.10" ) + ROMX_LOAD( "d-110.v1.10.ic19.bin", 0, 0x8000, CRC(3ae68187) SHA1(28635510f30d6c1fb88e00da03e5b4e045c380cb), ROM_BIOS(2) ) + + ROM_REGION( 0x20000, "presets", 0 ) + ROM_LOAD( "r15179873-lh5310-97.ic12.bin", 0, 0x20000, CRC(580a8f9e) SHA1(05587a0542b01625dcde37de5bb339880e47eb93) ) + + ROM_REGION( 0x100000, "la32", 0 ) + ROM_LOAD( "r15179878.ic7.bin", 0, 0x80000, CRC(e117e6ab) SHA1(6760d14900161b8715c2bfd4ebe997877087c90c) ) + ROM_LOAD( "r15179880.ic8.bin", 0x80000, 0x80000, CRC(b329f945) SHA1(9c59f50518a070461b2ec6cb4e43ee7cc1e905b6) ) + + ROM_REGION( 0x8000, "boss", 0 ) + ROM_LOAD( "r15179879.ic6.bin", 0, 0x8000, CRC(5d34174e) SHA1(17bd2887711c5c5458aba6d3be5972b2096eb450) ) +ROM_END + +CONS( 1988, d110, 0, 0, d110, d110, driver_device, 0, "Roland", "D110", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/replicator.c b/src/mame/drivers/replicator.c new file mode 100644 index 00000000000..aacdc07e3db --- /dev/null +++ b/src/mame/drivers/replicator.c @@ -0,0 +1,751 @@ +// license:GPL-2.0+ +// copyright-holders:Felipe Sanches +/* + Replicator 1 desktop 3d printer + + driver by Felipe Correa da Silva Sanches + +Changelog: + + 2013 DEC 28 [Felipe Sanches]: + * LCD now works. We can see the firmware boot screen :-) + + 2013 DEC 24 [Felipe Sanches]: + * declaration of internal EEPROM + + 2013 DEC 18 [Felipe Sanches]: + * Initial driver skeleton + +*/ + +// TODO: +// * figure out what's wrong with the keypad inputs (interface seems to be blocked in the first screen) +// * fix avr8 timer/counter #0 (toggle OC0B) and #5 (overflow interrupt "Microsecond timer") so that we get the buzzer to work +// * figure-out correct size of internal EEPROM +// * emulate an SD Card +// * implement avr8 WDR (watchdog reset) opcode + +#include "emu.h" +#include "cpu/avr8/avr8.h" +#include "video/hd44780.h" +#include "rendlay.h" +#include "debugger.h" +#include "sound/dac.h" + +#define MASTER_CLOCK 16000000 + +#define LOG_PORTS 0 + +//Port A bits: +//Bit 0 unused +//Bit 1 unused +#define A_AXIS_DIR (1 << 2) +#define A_AXIS_STEP (1 << 3) +#define A_AXIS_EN (1 << 4) +#define A_AXIS_POT (1 << 5) +#define B_AXIS_DIR (1 << 6) +#define B_AXIS_STEP (1 << 7) + +//Port B bits: +#define SD_CS (1 << 0) +#define SCK_1280 (1 << 1) +#define MOSI_1280 (1 << 2) +#define MISO_1280 (1 << 3) +#define EX2_PWR_CHECK (1 << 4) +#define EX2_HEAT (1 << 5) +#define EX2_FAN (1 << 6) +#define BLINK (1 << 7) + +//Port C bits: +#define EX2_1280 (1 << 0) +#define EX1_1280 (1 << 1) +#define LCD_CLK (1 << 2) +#define LCD_DATA (1 << 3) +#define LCD_STROBE (1 << 4) +#define RLED (1 << 5) +#define GLED (1 << 6) +#define DETECT (1 << 7) + +//Port D bits: +#define PORTD_SCL (1 << 0) +#define PORTD_SDA (1 << 1) +#define EX_RX_1280 (1 << 2) +#define EX_TX_1280 (1 << 3) +//Bit 4 unused +//Bit 5 unused +//Bit 6 unused +//Bit 7 unused + +//Port E bits: +#define RX_1280 (1 << 0) +#define TX_1280 (1 << 1) +#define THERMO_SCK (1 << 2) +#define THERMO_CS1 (1 << 3) +#define THERMO_CS2 (1 << 4) +#define THERMO_DO (1 << 5) +//Bit 6 unused +//Bit 7 unused + +//Port F bits: +#define X_AXIS_DIR (1 << 0) +#define X_AXIS_STEP (1 << 1) +#define X_AXIS_EN (1 << 2) +#define X_AXIS_POT (1 << 3) +#define Y_AXIS_DIR (1 << 4) +#define Y_AXIS_STEP (1 << 5) +#define Y_AXIS_EN (1 << 6) +#define Y_AXIS_POT (1 << 7) + +//Port G bits: +#define EX4_1280 (1 << 0) +#define EX3_1280 (1 << 1) +#define B_AXIS_EN (1 << 2) +//Bit 3 unused +#define CUTOFF_SR_CHECK (1 << 4) +#define BUZZ (1 << 5) +//Bit 6 unused +//Bit 7 unused + +//Port H bits: +#define CUTOFF_TEST (1 << 0) +#define CUTOFF_RESET (1 << 1) +#define EX1_PWR_CHECK (1 << 2) +#define EX1_HEAT (1 << 3) +#define EX1_FAN (1 << 4) +#define SD_WP (1 << 5) +#define SD_CD (1 << 6) +//Bit 7 unused + +//Port J bits: +#define BUTTON_CENTER (1 << 0) +#define BUTTON_RIGHT (1 << 1) +#define BUTTON_LEFT (1 << 2) +#define BUTTON_DOWN (1 << 3) +#define BUTTON_UP (1 << 4) +#define POTS_SCL (1 << 5) +#define B_AXIS_POT (1 << 6) +//Bit 7 unused + +//Port K bits: +#define Z_AXIS_DIR (1 << 0) +#define Z_AXIS_STEP (1 << 1) +#define Z_AXIS_EN (1 << 2) +#define Z_AXIS_POT (1 << 3) +#define EX7_1280 (1 << 4) +#define EX6_1280 (1 << 5) +#define EX5_1280 (1 << 6) +#define HBP_THERM (1 << 7) + +//Port L bits: +#define X_MIN (1 << 0) +#define X_MAX (1 << 1) +#define Y_MIN (1 << 2) +#define Y_MAX (1 << 3) +#define HBP (1 << 4) +#define EXTRA_FET (1 << 5) +#define Z_MIN (1 << 6) +#define Z_MAX (1 << 7) + +/****************************************************\ +* I/O devices * +\****************************************************/ + +class replicator_state : public driver_device +{ +public: + replicator_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_lcdc(*this, "hd44780"), + m_dac(*this, "dac") + { + } + + virtual void machine_start(); + + UINT8 m_port_a; + UINT8 m_port_b; + UINT8 m_port_c; + UINT8 m_port_d; + UINT8 m_port_e; + UINT8 m_port_f; + UINT8 m_port_g; + UINT8 m_port_h; + UINT8 m_port_j; + UINT8 m_port_k; + UINT8 m_port_l; + + UINT8 shift_register_value; + + required_device m_maincpu; + required_device m_lcdc; + required_device m_dac; + + DECLARE_READ8_MEMBER(port_r); + DECLARE_WRITE8_MEMBER(port_w); + DECLARE_DRIVER_INIT(replicator); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(replicator); +}; + +void replicator_state::machine_start() +{ +} + +READ8_MEMBER(replicator_state::port_r) +{ + switch( offset ) + { + case AVR8_IO_PORTA: + { +#if LOG_PORTS + printf("[%08X] Port A READ (A-axis signals + B-axis STEP&DIR)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + case AVR8_IO_PORTB: + { +#if LOG_PORTS + printf("[%08X] Port B READ (SD-CS; 1280-MISO/MOSI/SCK; EX2-FAN/HEAT/PWR-CHECK; BLINK)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + case AVR8_IO_PORTC: + { +#if LOG_PORTS + printf("[%08X] Port C READ (1280-EX1/EX2; LCD-signals; R&G-LED; DETECT)\n", m_maincpu->m_shifted_pc); +#endif + return DETECT; //indicated that the Interface board is present. + } + case AVR8_IO_PORTD: + { +#if LOG_PORTS + printf("[%08X] Port D READ (SDA/SCL; 1280-EX-TX/RX)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + case AVR8_IO_PORTE: + { +#if LOG_PORTS + printf("[%08X] Port E READ (1280-TX/RX; THERMO-signals)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + case AVR8_IO_PORTF: + { +#if LOG_PORTS + printf("[%08X] Port F READ (X-axis & Y-axis signals)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + case AVR8_IO_PORTG: + { +#if LOG_PORTS + printf("[%08X] Port G READ (BUZZ; Cutoff-sr-check; B-axis EN; 1280-EX3/EX4)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + case AVR8_IO_PORTH: + { +#if LOG_PORTS + printf("[%08X] Port H READ (cuttoff-text/reset; EX1-FAN/HEAT/PWR-CHECK; SD-CD/SD-WP)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + case AVR8_IO_PORTJ: + { +#if LOG_PORTS + printf("[%08X] Port J READ (Interface buttons; POTS-SCL; B-axis-POT)\n", m_maincpu->m_shifted_pc); +#endif + return ioport("keypad")->read(); + } + case AVR8_IO_PORTK: + { +#if LOG_PORTS + printf("[%08X] Port K READ (Z-axis signals; HBP-THERM; 1280-EX5/6/7)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + case AVR8_IO_PORTL: + { +#if LOG_PORTS + printf("[%08X] Port L READ (HBP; EXTRA-FET; X-MIN/MAX; Y-MIN/MAX; Z-MIN/MAX)\n", m_maincpu->m_shifted_pc); +#endif + return 0x00; + } + } + return 0; +} + +WRITE8_MEMBER(replicator_state::port_w) +{ + switch( offset ) + { + case AVR8_IO_PORTA: + { + if (data == m_port_a) break; + +#if LOG_PORTS + UINT8 old_port_a = m_port_a; + UINT8 changed = data ^ old_port_a; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + if(changed & A_AXIS_DIR) printf("[A] A_AXIS_DIR: %s\n", data & A_AXIS_DIR ? "HIGH" : "LOW"); + if(changed & A_AXIS_STEP) printf("[A] A_AXIS_STEP: %s\n", data & A_AXIS_STEP ? "HIGH" : "LOW"); + if(changed & A_AXIS_EN) printf("[A] A_AXIS_EN: %s\n", data & A_AXIS_EN ? "HIGH" : "LOW"); + if(changed & A_AXIS_POT) printf("[A] A_AXIS_POT: %s\n", data & A_AXIS_POT ? "HIGH" : "LOW"); + if(changed & B_AXIS_DIR) printf("[A] B_AXIS_DIR: %s\n", data & B_AXIS_DIR ? "HIGH" : "LOW"); + if(changed & B_AXIS_STEP) printf("[A] B_AXIS_STEP: %s\n", data & B_AXIS_STEP ? "HIGH" : "LOW"); +#endif + + m_port_a = data; + break; + } + case AVR8_IO_PORTB: + { + if (data == m_port_b) break; + +#if LOG_PORTS + UINT8 old_port_b = m_port_b; + UINT8 changed = data ^ old_port_b; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + if(changed & SD_CS) printf("[B] SD Card Chip Select: %s\n", data & SD_CS ? "HIGH" : "LOW"); + if(changed & SCK_1280) printf("[B] 1280-SCK: %s\n", data & SCK_1280 ? "HIGH" : "LOW"); + if(changed & MOSI_1280) printf("[B] 1280-MOSI: %s\n", data & MOSI_1280 ? "HIGH" : "LOW"); + if(changed & MISO_1280) printf("[B] 1280-MISO: %s\n", data & MISO_1280 ? "HIGH" : "LOW"); + if(changed & EX2_PWR_CHECK) printf("[B] EX2-PWR-CHECK: %s\n", data & EX2_PWR_CHECK ? "HIGH" : "LOW"); + if(changed & EX2_HEAT) printf("[B] EX2_HEAT: %s\n", data & EX2_HEAT ? "HIGH" : "LOW"); + if(changed & EX2_FAN) printf("[B] EX2_FAN: %s\n", data & EX2_FAN ? "HIGH" : "LOW"); + if(changed & BLINK) printf("[B] BLINK: %s\n", data & BLINK ? "HIGH" : "LOW"); +#endif + + m_port_b = data; + break; + } + case AVR8_IO_PORTC: + { + if (data == m_port_c) break; + + UINT8 old_port_c = m_port_c; + UINT8 changed = data ^ old_port_c; +#if LOG_PORTS + printf("[%08X] ", m_maincpu->m_shifted_pc); + if(changed & EX2_1280) printf("[C] EX2_1280: %s\n", data & EX2_1280 ? "HIGH" : "LOW"); + if(changed & EX1_1280) printf("[C] EX1_1280: %s\n", data & EX1_1280 ? "HIGH" : "LOW"); + if(changed & LCD_CLK) printf("[C] LCD_CLK: %s\n", data & LCD_CLK ? "HIGH" : "LOW"); + if(changed & LCD_DATA) printf("[C] LCD_DATA: %s\n", data & LCD_DATA ? "HIGH" : "LOW"); + if(changed & LCD_STROBE) printf("[C] LCD_STROBE: %s\n", data & LCD_STROBE ? "HIGH" : "LOW"); + if(changed & RLED) printf("[C] RLED: %s\n", data & RLED ? "HIGH" : "LOW"); + if(changed & GLED) printf("[C] GLED: %s\n", data & GLED ? "HIGH" : "LOW"); + if(changed & DETECT) printf("[C] DETECT: %s\n", data & DETECT ? "HIGH" : "LOW"); +#endif + + if (changed & LCD_CLK){ + /* The LCD is interfaced by an 8-bit shift register (74HC4094). */ + if (data & LCD_CLK){//CLK positive edge + shift_register_value = (shift_register_value << 1) | ((data & LCD_DATA) >> 3); + //printf("[%08X] ", m_maincpu->m_shifted_pc); + //printf("[C] LCD CLK positive edge. shift_register=0x%02X\n", shift_register_value); + } + } + + if(changed & LCD_STROBE){ + if (data & LCD_STROBE){ //STROBE positive edge + bool RS = (shift_register_value >> 1) & 1; + bool RW = (shift_register_value >> 2) & 1; + bool enable = (shift_register_value >> 3) & 1; + UINT8 lcd_data = shift_register_value & 0xF0; + + if (enable && RW==0){ + if (RS==0){ + m_lcdc->control_write(space, 0, lcd_data); + } else { + m_lcdc->data_write(space, 0, lcd_data); + } + } + } + } + m_port_c = data; + + break; + } + case AVR8_IO_PORTD: + { + if (data == m_port_d) break; + +#if LOG_PORTS + UINT8 old_port_d = m_port_d; + UINT8 changed = data ^ old_port_d; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + if(changed & PORTD_SCL) printf("[D] PORTD_SCL: %s\n", data & PORTD_SCL ? "HIGH" : "LOW"); + if(changed & PORTD_SDA) printf("[D] PORTD_SDA: %s\n", data & PORTD_SDA ? "HIGH" : "LOW"); + if(changed & EX_RX_1280) printf("[D] EX_RX_1280: %s\n", data & EX_RX_1280 ? "HIGH" : "LOW"); + if(changed & EX_TX_1280) printf("[D] EX_TX_1280: %s\n", data & EX_TX_1280 ? "HIGH" : "LOW"); +#endif + + m_port_d = data; + break; + } + case AVR8_IO_PORTE: + { + if (data == m_port_e) break; + +#if LOG_PORTS + UINT8 old_port_e = m_port_e; + UINT8 changed = data ^ old_port_e; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + if(changed & RX_1280) printf("[E] 1280-RX: %s\n", data & RX_1280 ? "HIGH" : "LOW"); + if(changed & TX_1280) printf("[E] 1280-TX: %s\n", data & TX_1280 ? "HIGH" : "LOW"); + if(changed & THERMO_SCK) printf("[E] THERMO-SCK: %s\n", data & THERMO_SCK ? "HIGH" : "LOW"); + if(changed & THERMO_CS1) printf("[E] THERMO-CS1: %s\n", data & THERMO_CS1 ? "HIGH" : "LOW"); + if(changed & THERMO_CS2) printf("[E] THERMO-CS2: %s\n", data & THERMO_CS2 ? "HIGH" : "LOW"); + if(changed & THERMO_DO) printf("[E] THERMO-DO: %s\n", data & THERMO_DO ? "HIGH" : "LOW"); +#endif + + m_port_e = data; + break; + } + case AVR8_IO_PORTF: + { + if (data == m_port_f) break; + +#if LOG_PORTS + UINT8 old_port_f = m_port_f; + UINT8 changed = data ^ old_port_f; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + if(changed & X_AXIS_DIR) printf("[F] X_AXIS_DIR: %s\n", data & X_AXIS_DIR ? "HIGH" : "LOW"); + if(changed & X_AXIS_STEP) printf("[F] X_AXIS_STEP: %s\n", data & X_AXIS_STEP ? "HIGH" : "LOW"); + if(changed & X_AXIS_EN) printf("[F] X_AXIS_EN: %s\n", data & X_AXIS_EN ? "HIGH" : "LOW"); + if(changed & X_AXIS_POT) printf("[F] X_AXIS_POT: %s\n", data & X_AXIS_POT ? "HIGH" : "LOW"); + if(changed & Y_AXIS_DIR) printf("[F] Y_AXIS_DIR: %s\n", data & Y_AXIS_DIR ? "HIGH" : "LOW"); + if(changed & Y_AXIS_STEP) printf("[F] Y_AXIS_STEP: %s\n", data & Y_AXIS_STEP ? "HIGH" : "LOW"); + if(changed & Y_AXIS_EN) printf("[F] Y_AXIS_EN: %s\n", data & Y_AXIS_EN ? "HIGH" : "LOW"); + if(changed & Y_AXIS_POT) printf("[F] Y_AXIS_POT: %s\n", data & Y_AXIS_POT ? "HIGH" : "LOW"); +#endif + + m_port_f = data; + break; + } + case AVR8_IO_PORTG: + { + if (data == m_port_g) break; + + UINT8 old_port_g = m_port_g; + UINT8 changed = data ^ old_port_g; + +#if LOG_PORTS + printf("[%08X] ", m_maincpu->m_shifted_pc); + if(changed & EX4_1280) printf("[G] EX4_1280: %s\n", data & EX4_1280 ? "HIGH" : "LOW"); + if(changed & EX3_1280) printf("[G] EX3_1280: %s\n", data & EX3_1280 ? "HIGH" : "LOW"); + if(changed & B_AXIS_EN) printf("[G] B_AXIS_EN: %s\n", data & B_AXIS_EN ? "HIGH" : "LOW"); + if(changed & CUTOFF_SR_CHECK) printf("[G] CUTOFF_SR_CHECK: %s\n", data & CUTOFF_SR_CHECK ? "HIGH" : "LOW"); + if(changed & BUZZ) printf("[G] BUZZ: %s\n", data & BUZZ ? "HIGH" : "LOW"); +#endif + + if(changed & BUZZ){ + /* FIX-ME: What is the largest sample value allowed? + I'm using 0x3F based on what I see in src/mame/drivers/craft.c + But as the method is called "write_unsigned8", I guess we could have samples with values up to 0xFF, right? + Anyway... With the 0x3F value we'll get a sound that is not so loud, which may be less annoying... :-) + */ + UINT8 audio_sample = (data & BUZZ) ? 0x3F : 0; + m_dac->write_unsigned8(audio_sample << 1); + } + + m_port_g = data; + break; + } + case AVR8_IO_PORTH: + { + if (data == m_port_h) break; + +#if LOG_PORTS + UINT8 old_port_h = m_port_h; + UINT8 changed = data ^ old_port_h; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + if(changed & CUTOFF_TEST) printf("[H] CUTOFF_TEST: %s\n", data & CUTOFF_TEST ? "HIGH" : "LOW"); + if(changed & CUTOFF_RESET) printf("[H] CUTOFF_RESET: %s\n", data & CUTOFF_RESET ? "HIGH" : "LOW"); + if(changed & EX1_PWR_CHECK) printf("[H] EX1_PWR_CHECK: %s\n", data & EX1_PWR_CHECK ? "HIGH" : "LOW"); + if(changed & EX1_HEAT) printf("[H] EX1_HEAT: %s\n", data & EX1_HEAT ? "HIGH" : "LOW"); + if(changed & EX1_FAN) printf("[H] EX1_FAN: %s\n", data & EX1_FAN ? "HIGH" : "LOW"); + if(changed & SD_WP) printf("[H] SD_WP: %s\n", data & SD_WP ? "HIGH" : "LOW"); + if(changed & SD_CD) printf("[H] SD_CD: %s\n", data & SD_CD ? "HIGH" : "LOW"); +#endif + + m_port_h = data; + break; + } + case AVR8_IO_PORTJ: + { + if (data == m_port_j) break; + +#if LOG_PORTS + UINT8 old_port_j = m_port_j; + UINT8 changed = data ^ old_port_j; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + + if(changed & BUTTON_CENTER) printf("[J] BUTTON_CENTER: %s\n", data & BUTTON_CENTER ? "HIGH" : "LOW"); + if(changed & BUTTON_RIGHT) printf("[J] BUTTON_RIGHT: %s\n", data & BUTTON_RIGHT ? "HIGH" : "LOW"); + if(changed & BUTTON_LEFT) printf("[J] BUTTON_LEFT: %s\n", data & BUTTON_LEFT ? "HIGH" : "LOW"); + if(changed & BUTTON_DOWN) printf("[J] BUTTON_DOWN: %s\n", data & BUTTON_DOWN ? "HIGH" : "LOW"); + if(changed & BUTTON_UP) printf("[J] BUTTON_UP: %s\n", data & BUTTON_UP ? "HIGH" : "LOW"); + if(changed & POTS_SCL) printf("[J] POTS_SCL: %s\n", data & POTS_SCL ? "HIGH" : "LOW"); + if(changed & B_AXIS_POT) printf("[J] B_AXIS_POT: %s\n", data & B_AXIS_POT ? "HIGH" : "LOW"); +#endif + + m_port_j = data; + break; + } + case AVR8_IO_PORTK: + { + if (data == m_port_k) break; + +#if LOG_PORTS + UINT8 old_port_k = m_port_k; + UINT8 changed = data ^ old_port_k; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + + if(changed & Z_AXIS_DIR) printf("[K] Z_AXIS_DIR: %s\n", data & Z_AXIS_DIR ? "HIGH" : "LOW"); + if(changed & Z_AXIS_STEP) printf("[K] Z_AXIS_STEP: %s\n", data & Z_AXIS_STEP ? "HIGH" : "LOW"); + if(changed & Z_AXIS_EN) printf("[K] Z_AXIS_EN: %s\n", data & Z_AXIS_EN ? "HIGH" : "LOW"); + if(changed & Z_AXIS_POT) printf("[K] Z_AXIS_POT: %s\n", data & Z_AXIS_POT ? "HIGH" : "LOW"); + if(changed & EX7_1280) printf("[K] EX7_1280: %s\n", data & EX7_1280 ? "HIGH" : "LOW"); + if(changed & EX6_1280) printf("[K] EX6_1280: %s\n", data & EX6_1280 ? "HIGH" : "LOW"); + if(changed & EX5_1280) printf("[K] EX5_1280: %s\n", data & EX5_1280 ? "HIGH" : "LOW"); + if(changed & HBP_THERM) printf("[K] HBP_THERM: %s\n", data & HBP_THERM ? "HIGH" : "LOW"); +#endif + + m_port_k = data; + break; + } + case AVR8_IO_PORTL: + { + if (data == m_port_l) break; + +#if LOG_PORTS + UINT8 old_port_l = m_port_l; + UINT8 changed = data ^ old_port_l; + + printf("[%08X] ", m_maincpu->m_shifted_pc); + + if(changed & X_MIN) printf("[L] X_MIN: %s\n", data & X_MIN ? "HIGH" : "LOW"); + if(changed & X_MAX) printf("[L] X_MAX: %s\n", data & X_MAX ? "HIGH" : "LOW"); + if(changed & Y_MIN) printf("[L] Y_MIN: %s\n", data & Y_MIN ? "HIGH" : "LOW"); + if(changed & Y_MAX) printf("[L] Y_MAX: %s\n", data & Y_MAX ? "HIGH" : "LOW"); + if(changed & HBP) printf("[L] HBP: %s\n", data & HBP ? "HIGH" : "LOW"); + if(changed & EXTRA_FET) printf("[L] EXTRA_FET: %s\n", data & EXTRA_FET ? "HIGH" : "LOW"); + if(changed & Z_MIN) printf("[L] Z_MIN: %s\n", data & Z_MIN ? "HIGH" : "LOW"); + if(changed & Z_MAX) printf("[L] Z_MAX: %s\n", data & Z_MAX ? "HIGH" : "LOW"); +#endif + + m_port_l = data; + break; + } + } +} + +/****************************************************\ +* Address maps * +\****************************************************/ + +static ADDRESS_MAP_START( replicator_prg_map, AS_PROGRAM, 8, replicator_state ) + AM_RANGE(0x0000, 0x1FFFF) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( replicator_data_map, AS_DATA, 8, replicator_state ) + AM_RANGE(0x0200, 0x21FF) AM_RAM /* ATMEGA1280 Internal SRAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( replicator_io_map, AS_IO, 8, replicator_state ) + AM_RANGE(AVR8_IO_PORTA, AVR8_IO_PORTL) AM_READWRITE( port_r, port_w ) +ADDRESS_MAP_END + +/****************************************************\ +* Input ports * +\****************************************************/ + +static INPUT_PORTS_START( replicator ) + PORT_START("keypad") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CENTER") PORT_CODE(KEYCODE_M) + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_D) + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_A) + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_S) + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_W) +INPUT_PORTS_END + +/****************************************************\ +* Machine definition * +\****************************************************/ + +DRIVER_INIT_MEMBER(replicator_state, replicator) +{ +} + +void replicator_state::machine_reset() +{ + shift_register_value = 0; + m_port_a = 0; + m_port_b = 0; + m_port_c = 0; + m_port_d = 0; + m_port_e = 0; + m_port_f = 0; + m_port_g = 0; + m_port_h = 0; + m_port_j = 0; + m_port_k = 0; + m_port_l = 0; +} + +PALETTE_INIT_MEMBER(replicator_state, replicator) +{ +//These colors were picked with the color picker in Inkscape, based on a photo of the LCD used in the Replicator 1 3d printer: + palette.set_pen_color(0, rgb_t(0xCA, 0xE7, 0xEB)); + palette.set_pen_color(1, rgb_t(0x78, 0xAB, 0xA8)); +} + +static const gfx_layout hd44780_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( replicator ) + GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, hd44780_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( replicator, replicator_state ) + + MCFG_CPU_ADD("maincpu", ATMEGA1280, MASTER_CLOCK) + MCFG_CPU_PROGRAM_MAP(replicator_prg_map) + MCFG_CPU_DATA_MAP(replicator_data_map) + MCFG_CPU_IO_MAP(replicator_io_map) + + MCFG_CPU_AVR8_EEPROM("eeprom") + MCFG_CPU_AVR8_LFUSE(0xFF) + MCFG_CPU_AVR8_HFUSE(0xDA) + MCFG_CPU_AVR8_EFUSE(0xF4) + MCFG_CPU_AVR8_LOCK(0x0F) + + /*TODO: Add an ATMEGA8U2 for USB-Serial communications */ + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_SIZE(120, 18*2) //4x20 chars + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18*2-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(replicator_state, replicator) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", replicator) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(4, 20) + + /* sound hardware */ + /* A piezo is connected to the PORT G bit 5 (OC0B pin driven by Timer/Counter #4) */ + MCFG_SPEAKER_STANDARD_MONO("buzzer") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(0, "buzzer", 1.00) + +MACHINE_CONFIG_END + +ROM_START( replica1 ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_DEFAULT_BIOS("v750") + + /* Version 5.1 release: + - Initial firmware release + */ + ROM_SYSTEM_BIOS( 0, "v51", "V 5.1" ) + ROMX_LOAD("mighty-mb40-v5.1.bin", 0x0000, 0x10b90, CRC(20d65cd1) SHA1(da18c3eb5a29a6bc1eecd92eaae6063fe29d0305), ROM_BIOS(1)) + + /* Version 5.2 release: + - Nozzle Tolerance added to EEPROM + - Updated onboard menus + - X,Y calibration tool added + */ + ROM_SYSTEM_BIOS( 1, "v52", "V 5.2" ) + ROMX_LOAD("mighty-mb40-v5.2.bin", 0x0000, 0x126c4, CRC(555e47cf) SHA1(9d24a3dbeddce16669bb4d29c3366220ddf15d2a), ROM_BIOS(2)) + + /* Version 5.5 release: + - Acceleration added to motor motion + - Digipot updates + */ + ROM_SYSTEM_BIOS( 2, "v55", "V 5.5" ) + ROMX_LOAD("mighty-mb40-v5.5.bin", 0x0000, 0x1a420, CRC(9327d7e4) SHA1(d734ba2bda12f50ec3ac0035ab11591909d9edde), ROM_BIOS(3)) + + /* Version 6.2.0 release: + - Bug fix release to firmware 6.0 + - Addresses wavy print issue above 1cm + - Left extruder prints with makerware. + */ + ROM_SYSTEM_BIOS( 3, "v620", "V 6.2.0" ) + ROMX_LOAD("mighty_one_v6.2.0.bin", 0x0000, 0x1cf54, CRC(00df6f48) SHA1(db05afc2e1ebc104fb04753634a911187e396556), ROM_BIOS(4)) + + /* Version 7.0.0 release: + - Major upgrade to Stepper Motor Smoothness (via Sailfish team) + - X3G format introduced + - Heaters default to leaving 'preheat' on more of the time + */ + ROM_SYSTEM_BIOS( 4, "v700", "V 7.0.0" ) + ROMX_LOAD("mighty_one_v7.0.0.bin", 0x0000, 0x1cb52, CRC(aa2a5fcf) SHA1(934e642b0b2d007689249680bad03c9255ae016a), ROM_BIOS(5)) + + /* Version 7.2.0 release: + - Removes support for S3G files + - X3G is the recognized format + - Minor bug fixes + */ + ROM_SYSTEM_BIOS( 5, "v720", "V 7.2.0" ) + ROMX_LOAD("mighty_one_v7.2.0.bin", 0x0000, 0x1cb80, CRC(5e546706) SHA1(ed4aaf7522d5a5beea7eb69bf2c85d7a89f8f188), ROM_BIOS(6)) + + /* Version 7.3.0 release: + - Pause at Z Height + - Elapsed time displays during prints + - Minor bug fixes + */ + ROM_SYSTEM_BIOS( 6, "v730", "V 7.3.0" ) + ROMX_LOAD("mighty_one_v7.3.0.bin", 0x0000, 0x1d738, CRC(71811ff5) SHA1(6728ea600ab3ff4b589adca90b0d700d9b70bd18), ROM_BIOS(7)) + + /* Version 7.4.0 (bugfix) release: + - Fixes issues with Z Pause and elapsed print time + */ + ROM_SYSTEM_BIOS( 7, "v740", "V 7.4.0" ) + ROMX_LOAD("mighty_one_v7.4.0.bin", 0x0000, 0x1b9e2, CRC(97b05a27) SHA1(76ca2c9c1db2e006e501c3177a8a1aa693dda0f9), ROM_BIOS(8)) + + /* Version 7.5.0 (bugfix) release: + - Fixes issue with Heat Hold + */ + ROM_SYSTEM_BIOS( 8, "v750", "V 7.5.0" ) + ROMX_LOAD("mighty_one_v7.5.0.bin", 0x0000, 0x1b9c4, CRC(169d6709) SHA1(62b5aacd1bc46969042aea7a50531ec467a4ff1f), ROM_BIOS(9)) + + /* Sailfish firmware image - Metam??quina experimental build v7.5.0 */ + ROM_SYSTEM_BIOS( 9, "v750mm", "V 7.5.0 - Metam??quina" ) + ROMX_LOAD("mighty_one_v7.5.0.mm.bin", 0x0000, 0x1ef9a, CRC(0d36d9e7) SHA1(a53899775b4c4eea87b6903758ebb75f06710a69), ROM_BIOS(10)) + + + /*Arduino MEGA bootloader */ + ROM_LOAD( "atmegaboot_168_atmega1280.bin", 0x1f000, 0x0f16, CRC(c041f8db) SHA1(d995ebf360a264cccacec65f6dc0c2257a3a9224) ) + + /* on-die 4kbyte eeprom */ + ROM_REGION( 0x1000, "eeprom", ROMREGION_ERASEFF ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP(2012, replica1, 0, 0, replicator, replicator, replicator_state, replicator, "Makerbot", "Replicator 1 desktop 3d printer", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/rex6000.c b/src/mame/drivers/rex6000.c new file mode 100644 index 00000000000..ee428f58fc1 --- /dev/null +++ b/src/mame/drivers/rex6000.c @@ -0,0 +1,722 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Xircom / Intel REX 6000 + + Driver by Sandro Ronco + + Known REX 6000 banks: + 0x0000 - 0x00ff first flash chip + 0x0600 - 0x06ff second flash chip + 0x1000 - 0x1003 32KB RAM + + Known DataSlim 2 banks: + 0x0000 - 0x00ff first flash chip + 0x0b00 - 0x0bff second flash chip + 0x1000 - 0x1003 32KB RAM + + TODO: + - deleting all Memos causes an error + - alarm doesn't work + - alarm sound and keyclick + - NVRAM and warm start (without the pen calibration) + - serial I/O + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/rp5c01.h" +#include "machine/ram.h" +#include "machine/intelfsh.h" +#include "imagedev/snapquik.h" +#include "sound/beep.h" +#include "rendlay.h" + +#define MAKE_BANK(lo, hi) ((lo) | ((hi)<<8)) + +//irq flag/mask bits +#define IRQ_FLAG_KEYCHANGE 0x01 +#define IRQ_FLAG_ALARM 0x02 +#define IRQ_FLAG_SERIAL 0x04 +#define IRQ_FLAG_1HZ 0x10 +#define IRQ_FLAG_IRQ2 0x20 +#define IRQ_FLAG_IRQ1 0x40 +#define IRQ_FLAG_EVENT 0x80 + +//memory bank types +#define BANK_FLASH0_B0 0x00 +#define BANK_FLASH0_B1 0x01 +#define BANK_FLASH1_B0 0x02 +#define BANK_FLASH1_B1 0x03 +#define BANK_RAM 0x10 +#define BANK_UNKNOWN 0xff + +#define TC8521_TAG "rtc" + +class rex6000_state : public driver_device +{ +public: + rex6000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_beep(*this, "beeper") + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_beep; + fujitsu_29dl16x_device *m_flash[4]; + + UINT8 m_bank[4]; + UINT8 m_beep_io[5]; + UINT8 m_lcd_base[2]; + UINT8 m_touchscreen[0x10]; + UINT8 m_lcd_enabled; + UINT8 m_lcd_cmd; + UINT8 *m_ram_base; + + UINT8 m_irq_mask; + UINT8 m_irq_flag; + UINT8 m_port6; + UINT8 m_beep_mode; + + struct + { + UINT8 type; + UINT16 page; + } m_banks[2]; + + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( bankswitch_r ); + DECLARE_WRITE8_MEMBER( bankswitch_w ); + DECLARE_READ8_MEMBER( lcd_base_r ); + DECLARE_WRITE8_MEMBER( lcd_base_w ); + DECLARE_READ8_MEMBER( beep_r ); + DECLARE_WRITE8_MEMBER( beep_w ); + DECLARE_READ8_MEMBER( lcd_io_r ); + DECLARE_WRITE8_MEMBER( lcd_io_w ); + DECLARE_READ8_MEMBER( irq_r ); + DECLARE_WRITE8_MEMBER( irq_w ); + DECLARE_READ8_MEMBER( touchscreen_r ); + DECLARE_WRITE8_MEMBER( touchscreen_w ); + DECLARE_WRITE_LINE_MEMBER( alarm_irq ); + + DECLARE_READ8_MEMBER( flash_0x0000_r ); + DECLARE_WRITE8_MEMBER( flash_0x0000_w ); + DECLARE_READ8_MEMBER( flash_0x8000_r ); + DECLARE_WRITE8_MEMBER( flash_0x8000_w ); + DECLARE_READ8_MEMBER( flash_0xa000_r ); + DECLARE_WRITE8_MEMBER( flash_0xa000_w ); + + UINT8 identify_bank_type(UINT32 bank); + DECLARE_PALETTE_INIT(rex6000); + DECLARE_INPUT_CHANGED_MEMBER(trigger_irq); + TIMER_DEVICE_CALLBACK_MEMBER(irq_timer1); + TIMER_DEVICE_CALLBACK_MEMBER(irq_timer2); + TIMER_DEVICE_CALLBACK_MEMBER(sec_timer); + DECLARE_QUICKLOAD_LOAD_MEMBER(rex6000); +}; + + +UINT8 rex6000_state::identify_bank_type(UINT32 bank) +{ + if (bank < 0x080) + { + return BANK_FLASH0_B0; + } + else if (bank >= 0x080 && bank < 0x100) + { + return BANK_FLASH0_B1; + } + else if ((bank >= 0xb00 && bank < 0xb80) || (bank >= 0x600 && bank < 0x680)) + { + return BANK_FLASH1_B0; + } + else if ((bank >= 0xb80 && bank < 0xc00) || (bank >= 0x680 && bank < 0x700)) + { + return BANK_FLASH1_B1; + } + else if (bank >= 0x1000 && bank < 0x1004) + { + return BANK_RAM; + } + else + { + //logerror("%04x: unkonwn memory bank %x\n", m_maincpu->pc(), bank); + return BANK_UNKNOWN; + } +} + +READ8_MEMBER( rex6000_state::bankswitch_r ) +{ + return m_bank[offset]; +} + +WRITE8_MEMBER( rex6000_state::bankswitch_w ) +{ + address_space& program = m_maincpu->space(AS_PROGRAM); + + m_bank[offset&3] = data; + + switch (offset) + { + case 0: //bank 1 low + case 1: //bank 1 high + { + //bank 1 start at 0x8000 + m_banks[0].page = (MAKE_BANK(m_bank[0], m_bank[1]&0x0f) + 4); + m_banks[0].type = identify_bank_type(m_banks[0].page); + + if (m_banks[0].type != BANK_UNKNOWN) + { + program.install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this)); + } + else + { + program.unmap_readwrite(0x8000, 0x9fff); + } + + break; + } + case 2: //bank 2 low + case 3: //bank 2 high + { + m_banks[1].page = MAKE_BANK(m_bank[2], m_bank[3]&0x1f); + m_banks[1].type = identify_bank_type(m_banks[1].page); + + if (m_banks[1].type == BANK_RAM) + { + program.install_ram(0xa000, 0xbfff, m_ram_base + ((m_banks[1].page & 0x03)<<13)); + } + else if (m_banks[1].type != BANK_UNKNOWN) + { + program.install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this)); + } + else + { + program.unmap_readwrite(0xa000, 0xbfff); + } + + break; + } + } +} + +READ8_MEMBER( rex6000_state::beep_r ) +{ + return m_beep_io[offset]; +} + +WRITE8_MEMBER( rex6000_state::beep_w ) +{ + m_beep_io[offset] = data; + + switch (offset) + { + case 0: //alarm mode control + /* + ---- ---x beep off + ---- --x- continuous beep + ---- -x-- continuous alarm 1 + ---- x--- continuous alarm 2 + ---x ---- continuous alarm 3 + --x- ---- single very short beep (keyclick) + -x-- ---- single alarm + x--- ---- single short beep + */ + //TODO: the beeper frequency and length in alarm mode need to be measured + break; + case 1: //tone mode control + if (m_beep_mode) + { + m_beep->set_state(BIT(data, 0)); + + //the beeper frequency is update only if the bit 1 is set + if (BIT(data, 1)) + m_beep->set_frequency(16384 / (((m_beep_io[2] | (m_beep_io[3]<<8)) & 0x0fff) + 2)); + } + break; + case 4: //select alarm/tone mode + if (m_beep_mode != BIT(data, 0)) + m_beep->set_state(0); //turned off when mode changes + + m_beep_mode = BIT(data, 0); + break; + } +} + +READ8_MEMBER( rex6000_state::lcd_base_r ) +{ + return m_lcd_base[offset]; +} + +WRITE8_MEMBER( rex6000_state::lcd_base_w ) +{ + m_lcd_base[offset&1] = data; +} + +READ8_MEMBER( rex6000_state::lcd_io_r ) +{ + return (offset == 0) ? m_lcd_enabled : m_lcd_cmd; +} + +WRITE8_MEMBER( rex6000_state::lcd_io_w ) +{ + switch (offset) + { + case 0: + m_lcd_enabled = data; + break; + case 1: + m_lcd_cmd = data; + break; + } +} + +READ8_MEMBER( rex6000_state::irq_r ) +{ + switch (offset) + { + case 0: //irq flag + /* + ---- ---x input port + ---- --x- alarm + ---- -x-- serial + ---- x--- ?? + ---x ---- 1Hz timer + --x- ---- 32Hz timer + -x-- ---- 4096Hz timer + x--- ---- special events + */ + return m_irq_flag; + + case 1: + return m_port6; + + case 2: //irq mask + return m_irq_mask; + + default: + return 0; + } +} + +WRITE8_MEMBER( rex6000_state::irq_w ) +{ + switch (offset) + { + case 0: //irq flag + m_irq_flag = data; + break; + case 1: //clear irq flag + m_port6 = data; + m_irq_flag &= (~data); + break; + case 2: //irq mask + m_irq_mask = data; + break; + } +} + +READ8_MEMBER( rex6000_state::touchscreen_r ) +{ + UINT16 x = ioport("PENX")->read(); + UINT16 y = ioport("PENY")->read(); + UINT16 battery = ioport("BATTERY")->read(); + + switch (offset) + { + case 0x08: + return ((ioport("INPUT")->read() & 0x40) ? 0x20 : 0x00) | 0X10; + case 0x09: + if (m_touchscreen[4] & 0x80) + return (battery>>0) & 0xff; + else + return (y>>0) & 0xff; + case 0x0a: + if (m_touchscreen[4] & 0x80) + return (battery>>8) & 0xff; + else + return (y>>8) & 0xff; + case 0x0b: + return (x>>0) & 0xff; + case 0x0c: + return (x>>8) & 0xff; + } + + return m_touchscreen[offset&0x0f]; +} + +WRITE8_MEMBER( rex6000_state::touchscreen_w ) +{ + m_touchscreen[offset&0x0f] = data; +} + +READ8_MEMBER( rex6000_state::flash_0x0000_r ) +{ + return m_flash[0]->read(offset); +} + +WRITE8_MEMBER( rex6000_state::flash_0x0000_w ) +{ + m_flash[0]->write(offset, data); +} + +READ8_MEMBER( rex6000_state::flash_0x8000_r ) +{ + return m_flash[m_banks[0].type]->read(((m_banks[0].page & 0x7f)<<13) | offset); +} + +WRITE8_MEMBER( rex6000_state::flash_0x8000_w ) +{ + m_flash[m_banks[0].type]->write(((m_banks[0].page & 0x7f)<<13) | offset, data); +} + +READ8_MEMBER( rex6000_state::flash_0xa000_r ) +{ + return m_flash[m_banks[1].type]->read(((m_banks[1].page & 0x7f)<<13) | offset); +} + +WRITE8_MEMBER( rex6000_state::flash_0xa000_w ) +{ + m_flash[m_banks[1].type]->write(((m_banks[1].page & 0x7f)<<13) | offset, data); +} + + +static ADDRESS_MAP_START(rex6000_mem, AS_PROGRAM, 8, rex6000_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x7fff ) AM_READWRITE(flash_0x0000_r, flash_0x0000_w) + AM_RANGE( 0x8000, 0x9fff ) AM_READWRITE(flash_0x8000_r, flash_0x8000_w) + AM_RANGE( 0xa000, 0xbfff ) AM_READWRITE(flash_0xa000_r, flash_0xa000_w) + AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("ram") //system RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( rex6000_io, AS_IO, 8, rex6000_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x01, 0x04 ) AM_READWRITE(bankswitch_r, bankswitch_w) + AM_RANGE( 0x05, 0x07 ) AM_READWRITE(irq_r, irq_w) + AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("INPUT") + AM_RANGE( 0x15, 0x19 ) AM_READWRITE(beep_r, beep_w) + AM_RANGE( 0x22, 0x23 ) AM_READWRITE(lcd_base_r, lcd_base_w) + AM_RANGE( 0x30, 0x3f ) AM_DEVREADWRITE(TC8521_TAG, rp5c01_device, read, write) + AM_RANGE( 0x40, 0x47 ) AM_MIRROR(0x08) AM_NOP //SIO + AM_RANGE( 0x50, 0x51 ) AM_READWRITE(lcd_io_r, lcd_io_w) + AM_RANGE( 0x60, 0x6f ) AM_READWRITE(touchscreen_r, touchscreen_w) + //AM_RANGE( 0x00, 0xff ) AM_RAM +ADDRESS_MAP_END + +INPUT_CHANGED_MEMBER(rex6000_state::trigger_irq) +{ + if (!(m_irq_mask & IRQ_FLAG_KEYCHANGE)) + { + m_irq_flag |= IRQ_FLAG_KEYCHANGE; + + m_maincpu->set_input_line(0, HOLD_LINE); + } +} + +/* Input ports */ +INPUT_PORTS_START( rex6000 ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x03ff, 0x03ff, "Battery Status" ) + PORT_CONFSETTING( 0x03ff, "Good" ) + PORT_CONFSETTING( 0x0000, "Poor" ) + + PORT_START("INPUT") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Select") PORT_CODE(KEYCODE_SPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Up") PORT_CODE(KEYCODE_PGUP) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Down") PORT_CODE(KEYCODE_PGDN) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Pen") PORT_CODE(KEYCODE_ENTER) PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) + + PORT_START("PENX") + PORT_BIT(0x3ff, 0x00, IPT_LIGHTGUN_X) PORT_NAME("Pen X") PORT_CROSSHAIR(X, 1, 0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_INVERT + + PORT_START("PENY") + PORT_BIT(0x3ff, 0x00, IPT_LIGHTGUN_Y) PORT_NAME("Pen Y") PORT_CROSSHAIR(Y, 1, 0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_INVERT +INPUT_PORTS_END + +void rex6000_state::machine_start() +{ + m_flash[0] = machine().device("flash0a"); + m_flash[1] = machine().device("flash0b"); + m_flash[2] = machine().device("flash1a"); + m_flash[3] = machine().device("flash1b"); + + m_ram_base = m_ram->pointer(); + membank("ram")->set_base(m_ram_base + 0x4000); +} +void rex6000_state::machine_reset() +{ + address_space& program = m_maincpu->space(AS_PROGRAM); + + program.install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this)); + program.install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this)); + + m_banks[0].type = 0x04; + m_banks[0].type = 0; + m_banks[1].type = 0x00; + m_banks[1].type = 0; + + memset(m_ram_base, 0, m_ram->size()); + memset(m_bank, 0, sizeof(m_bank)); + memset(m_beep_io, 0, sizeof(m_beep_io)); + memset(m_lcd_base, 0, sizeof(m_lcd_base)); + memset(m_touchscreen, 0, sizeof(m_touchscreen)); + m_lcd_enabled = 0; + m_lcd_cmd = 0; + m_irq_mask = 0; + m_irq_flag = 0; + m_port6 = 0; + m_beep_mode = 0; +} + +UINT32 rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]&0x1f); + UINT8 mem_type = identify_bank_type(lcd_bank); + + if (m_lcd_enabled && mem_type != BANK_UNKNOWN) + { + for (int y=0; y<120; y++) + for (int x=0; x<30; x++) + { + UINT8 data = 0; + + if (mem_type == BANK_RAM) + { + data = (m_ram_base + ((lcd_bank & 0x03)<<13))[y*30 + x]; + } + else + { + data = m_flash[mem_type]->space(0).read_byte(((lcd_bank & 0x7f)<<13) | (y*30 + x)); + } + + + for (int b=0; b<8; b++) + { + bitmap.pix16(y, (x * 8) + b) = BIT(data, 7); + data <<= 1; + } + } + } + else + { + bitmap.fill(0, cliprect); + } + + return 0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::irq_timer1) +{ + if (!(m_irq_mask & IRQ_FLAG_IRQ2)) + { + m_irq_flag |= IRQ_FLAG_IRQ2; + + m_maincpu->set_input_line(0, HOLD_LINE); + } + +} + +TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::irq_timer2) +{ + if (!(m_irq_mask & IRQ_FLAG_IRQ1)) + { + m_irq_flag |= IRQ_FLAG_IRQ1; + + m_maincpu->set_input_line(0, HOLD_LINE); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::sec_timer) +{ + if (!(m_irq_mask & IRQ_FLAG_1HZ)) + { + m_irq_flag |= IRQ_FLAG_1HZ; + + m_maincpu->set_input_line(0, HOLD_LINE); + } +} + +WRITE_LINE_MEMBER( rex6000_state::alarm_irq ) +{ + if (!(m_irq_mask & IRQ_FLAG_ALARM) && state) + { + m_irq_flag |= IRQ_FLAG_ALARM; + m_maincpu->set_input_line(0, HOLD_LINE); + } +} + + +PALETTE_INIT_MEMBER(rex6000_state, rex6000) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +QUICKLOAD_LOAD_MEMBER( rex6000_state,rex6000) +{ + static const char magic[] = "ApplicationName:Addin"; + address_space& flash = machine().device("flash0b")->memory().space(0); + UINT32 img_start = 0; + + dynamic_buffer data(image.length()); + image.fread(&data[0], image.length()); + + if(strncmp((const char*)&data[0], magic, 21)) + return IMAGE_INIT_FAIL; + + img_start = strlen((const char*)&data[0]) + 5; + img_start += 0xa0; //skip the icon (40x32 pixel) + + for (UINT32 i=0; i m_maincpu; + required_device m_palette; + DECLARE_READ32_MEMBER(a7000_iomd_r); + DECLARE_WRITE32_MEMBER(a7000_iomd_w); + DECLARE_WRITE32_MEMBER(a7000_vidc20_w); + + UINT8 m_vidc20_pal_index; + UINT16 m_vidc20_horz_reg[0x10]; + UINT16 m_vidc20_vert_reg[0x10]; + UINT8 m_vidc20_bpp_mode; + emu_timer *m_flyback_timer; + UINT16 m_timer_in[2]; + UINT16 m_timer_out[2]; + int m_timer_counter[2]; + emu_timer *m_IOMD_timer[2]; + UINT8 m_IRQ_status_A; + UINT8 m_IRQ_mask_A; + UINT8 m_IOMD_IO_ctrl; + UINT8 m_IOMD_keyb_ctrl; + UINT16 m_io_id; + UINT8 m_viddma_status; + UINT32 m_viddma_addr_start; + UINT32 m_viddma_addr_end; + UINT8 m_t0readinc; + UINT8 m_t1readinc; + void fire_iomd_timer(int timer); + void viddma_transfer_start(); + void vidc20_dynamic_screen_change(); + virtual void machine_reset(); + virtual void machine_start(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(IOMD_timer0_callback); + TIMER_CALLBACK_MEMBER(IOMD_timer1_callback); + TIMER_CALLBACK_MEMBER(flyback_timer_callback); +}; + + +/* + * + * VIDC20 chip emulation + * + */ + + +static const char *const vidc20_regnames[] = +{ + "Video Palette", // 0 + "Video Palette Address", // 1 + "RESERVED", // 2 + "LCD offset", // 3 + "Border Colour", // 4 + "Cursor Palette Logical Colour 1", // 5 + "Cursor Palette Logical Colour 2", // 6 + "Cursor Palette Logical Colour 3", // 7 + "Horizontal", // 8 + "Vertical", // 9 + "Stereo Image", // A + "Sound", // B + "External", // C + "Frequency Synthesis", // D + "Control", // E + "Data Control" // F +}; + +#if 0 +static const char *const vidc20_horz_regnames[] = +{ + "Horizontal Cycle", // 0x80 HCR + "Horizontal Sync Width", // 0x81 HSWR + "Horizontal Border Start", // 0x82 HBSR + "Horizontal Display Start", // 0x83 HDSR + "Horizontal Display End", // 0x84 HDER + "Horizontal Border End", // 0x85 HBER + "Horizontal Cursor Start", // 0x86 HCSR + "Horizontal Interlace", // 0x87 HIR + "Horizontal Counter TEST", // 0x88 + "Horizontal ", // 0x89 + "Horizontal ", // 0x8a + "Horizontal ", // 0x8b + "Horizontal All TEST", // 0x8c + "Horizontal ", // 0x8d + "Horizontal ", // 0x8e + "Horizontal " // 0x8f +}; +#endif + +#define HCR 0 +#define HSWR 1 +#define HBSR 2 +#define HDSR 3 +#define HDER 4 +#define HBER 5 +#define HCSR 6 +#define HIR 7 + +#if 0 +static const char *const vidc20_vert_regnames[] = +{ + "Vertical Cycle", // 0x90 VCR + "Vertical Sync Width", // 0x91 VSWR + "Vertical Border Start", // 0x92 VBSR + "Vertical Display Start", // 0x93 VDSR + "Vertical Display End", // 0x94 VDER + "Vertical Border End", // 0x95 VBER + "Vertical Cursor Start", // 0x96 VCSR + "Vertical Cursor End", // 0x97 VCER + "Vertical Counter TEST", // 0x98 + "Horizontal ", // 0x99 + "Vertical Counter Increment TEST", // 0x9a + "Horizontal ", // 0x9b + "Vertical All TEST", // 0x9c + "Horizontal ", // 0x9d + "Horizontal ", // 0x9e + "Horizontal " // 0x9f +}; +#endif + +#define VCR 0 +#define VSWR 1 +#define VBSR 2 +#define VDSR 3 +#define VDER 4 +#define VBER 5 +#define VCSR 6 +#define VCER 7 + +void riscpc_state::vidc20_dynamic_screen_change() +{ + /* sanity checks - first pass */ + /* + total cycles + border start/end + */ + if(m_vidc20_horz_reg[HCR] && m_vidc20_horz_reg[HBSR] && m_vidc20_horz_reg[HBER] && + m_vidc20_vert_reg[VCR] && m_vidc20_vert_reg[VBSR] && m_vidc20_vert_reg[VBER]) + { + /* sanity checks - second pass */ + /* + total cycles > border end > border start + */ + if((m_vidc20_horz_reg[HCR] > m_vidc20_horz_reg[HBER]) && + (m_vidc20_horz_reg[HBER] > m_vidc20_horz_reg[HBSR]) && + (m_vidc20_vert_reg[VCR] > m_vidc20_vert_reg[VBER]) && + (m_vidc20_vert_reg[VBER] > m_vidc20_vert_reg[VBSR])) + { + /* finally ready to change the resolution */ + int hblank_period,vblank_period; + rectangle visarea = machine().first_screen()->visible_area(); + hblank_period = (m_vidc20_horz_reg[HCR] & 0x3ffc); + vblank_period = (m_vidc20_vert_reg[VCR] & 0x3fff); + /* note that we use the border registers as the visible area */ + visarea.min_x = (m_vidc20_horz_reg[HBSR] & 0x3ffe); + visarea.max_x = (m_vidc20_horz_reg[HBER] & 0x3ffe)-1; + visarea.min_y = (m_vidc20_vert_reg[VBSR] & 0x1fff); + visarea.max_y = (m_vidc20_vert_reg[VBER] & 0x1fff)-1; + + machine().first_screen()->configure(hblank_period, vblank_period, visarea, machine().first_screen()->frame_period().attoseconds() ); + logerror("VIDC20: successfully changed the screen to:\n Display Size = %d x %d\n Border Size %d x %d\n Cycle Period %d x %d\n", + (m_vidc20_horz_reg[HDER]-m_vidc20_horz_reg[HDSR]),(m_vidc20_vert_reg[VDER]-m_vidc20_vert_reg[VDSR]), + (m_vidc20_horz_reg[HBER]-m_vidc20_horz_reg[HBSR]),(m_vidc20_vert_reg[VBER]-m_vidc20_vert_reg[VBSR]), + hblank_period,vblank_period); + } + } +} + +WRITE32_MEMBER( riscpc_state::a7000_vidc20_w ) +{ + int r,g,b,cursor_index,horz_reg,vert_reg,reg = data >> 28; + + switch(reg) + { + case 0: // Video Palette + r = (data & 0x0000ff) >> 0; + g = (data & 0x00ff00) >> 8; + b = (data & 0xff0000) >> 16; + + m_palette->set_pen_color(m_vidc20_pal_index & 0xff,r,g,b); + + /* auto-increment & wrap-around */ + m_vidc20_pal_index++; + m_vidc20_pal_index &= 0xff; + break; + + case 1: // Video Palette Address + + // according to RPCEmu, these mustn't be set + if (data & 0x0fffff00) + return; + + m_vidc20_pal_index = data & 0xff; + break; + + case 4: // Border Color + r = (data & 0x0000ff) >> 0; + g = (data & 0x00ff00) >> 8; + b = (data & 0xff0000) >> 16; + + m_palette->set_pen_color(0x100,r,g,b); + break; + case 5: // Cursor Palette Logical Colour n + case 6: + case 7: + cursor_index = 0x100 + reg - 4; // 0x101,0x102 and 0x103 (plus 0x100 of above, 2bpp) + + r = (data & 0x0000ff) >> 0; + g = (data & 0x00ff00) >> 8; + b = (data & 0xff0000) >> 16; + + m_palette->set_pen_color(cursor_index,r,g,b); + break; + case 8: // Horizontal + horz_reg = (data >> 24) & 0xf; + m_vidc20_horz_reg[horz_reg] = data & 0x3fff; + if(horz_reg == 0 || horz_reg == 2 || horz_reg == 5) + vidc20_dynamic_screen_change(); + + // logerror("VIDC20: %s Register write = %08x (%d)\n",vidc20_horz_regnames[horz_reg],val,val); + break; + case 9: // Vertical + vert_reg = (data >> 24) & 0xf; + m_vidc20_vert_reg[vert_reg] = data & 0x1fff; + if(vert_reg == 0 || vert_reg == 2 || vert_reg == 5) + vidc20_dynamic_screen_change(); + + if(vert_reg == 4) + { + if(m_vidc20_vert_reg[VDER] != 0) + m_flyback_timer->adjust(machine().first_screen()->time_until_pos(m_vidc20_vert_reg[VDER])); + else + m_flyback_timer->adjust(attotime::never); + } + + // logerror("VIDC20: %s Register write = %08x (%d)\n",vidc20_vert_regnames[vert_reg],val,val); + + break; + case 0x0e: // Control + m_vidc20_bpp_mode = (data & 0xe0) >> 5; + break; + default: logerror("VIDC20: %s Register write = %08x\n",vidc20_regnames[reg],data & 0xfffffff); + } +} + +UINT32 riscpc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int x_size,y_size,x_start,y_start; + int x,y,xi; + UINT32 count; + UINT8 *vram = memregion("vram")->base(); + + bitmap.fill(m_palette->pen(0x100), cliprect); + + x_size = (m_vidc20_horz_reg[HDER]-m_vidc20_horz_reg[HDSR]); + y_size = (m_vidc20_vert_reg[VDER]-m_vidc20_vert_reg[VDSR]); + x_start = m_vidc20_horz_reg[HDSR]; + y_start = m_vidc20_vert_reg[VDSR]; + + /* check if display is enabled */ + if(x_size <= 0 || y_size <= 0) + return 0; + +// popmessage("%d",m_vidc20_bpp_mode); + + count = 0; + + switch(m_vidc20_bpp_mode) + { + case 0: /* 1 bpp */ + { + for(y=0;ypen((vram[count]>>(xi))&1); + + count++; + } + } + } + break; + case 1: /* 2 bpp */ + { + for(y=0;ypen((vram[count]>>(xi*2))&3); + + count++; + } + } + } + break; + case 2: /* 4 bpp */ + { + for(y=0;ypen((vram[count]>>(xi*4))&0xf); + + count++; + } + } + } + break; + case 3: /* 8 bpp */ + { + for(y=0;ypen((vram[count])&0xff); + + count++; + } + } + } + break; + case 4: /* 16 bpp */ + { + for(y=0;y> 4; + b = (pen & 0x0f00) >> 8; + r = (r << 4) | (r & 0xf); + g = (g << 4) | (g & 0xf); + b = (b << 4) | (b & 0xf); + + bitmap.pix32(y+y_start, x+x_start) = b | g << 8 | r << 16; + + count+=2; + } + } + } + break; + case 6: /* 32 bpp */ + { + for(y=0;y> 8; + b = (pen & 0xff0000) >> 16; + + bitmap.pix32(y+y_start, x+x_start) = b | g << 8 | r << 16; + + count+=4; + } + } + } + break; + default: + //fatalerror("VIDC20 %08x BPP mode not supported\n",m_vidc20_bpp_mode); + break; + } + + return 0; +} + +/* +* +* IOMD / ARM7500 / ARM7500FE chip emulation +* +*/ + +/* TODO: some of these registers are actually ARM7500 specific */ +static const char *const iomd_regnames[] = +{ + "I/O Control", // 0x000 IOCR + "Keyboard Data", // 0x004 KBDDAT + "Keyboard Control", // 0x008 KBDCR + "General Purpose I/O Lines", // 0x00c IOLINES + "IRQA Status", // 0x010 IRQSTA + "IRQA Request/clear", // 0x014 IRQRQA + "IRQA Mask", // 0x018 IRQMSKA + "Enter SUSPEND Mode", // 0x01c SUSMODE + "IRQB Status", // 0x020 IRQSTB + "IRQB Request/clear", // 0x024 IRQRQB + "IRQB Mask", // 0x028 IRQMSKB + "Enter STOP Mode", // 0x02c STOPMODE + "FIQ Status", // 0x030 FIQST + "FIQ Request/clear", // 0x034 FIQRQ + "FIQ Mask", // 0x038 FIQMSK + "Clock divider control", // 0x03c CLKCTL + "Timer 0 Low Bits", // 0x040 T0LOW + "Timer 0 High Bits", // 0x044 T0HIGH + "Timer 0 Go Command", // 0x048 T0GO + "Timer 0 Latch Command", // 0x04c T0LATCH + "Timer 1 Low Bits", // 0x050 T1LOW + "Timer 1 High Bits", // 0x054 T1HIGH + "Timer 1 Go Command", // 0x058 T1GO + "Timer 1 Latch Command", // 0x05c T1LATCH + "IRQC Status", // 0x060 IRQSTC + "IRQC Request/clear", // 0x064 IRQRQC + "IRQC Mask", // 0x068 IRQMSKC + "LCD and IIS Control Bits", // 0x06c VIDIMUX + "IRQD Status", // 0x070 IRQSTD + "IRQD Request/clear", // 0x074 IRQRQD + "IRQD Mask", // 0x078 IRQMSKD + "", // 0x07c + "ROM Control Bank 0", // 0x080 ROMCR0 + "ROM Control Bank 1", // 0x084 ROMCR1 + "DRAM Control (IOMD)", // 0x088 DRAMCR + "VRAM and Refresh Control", // 0x08c VREFCR + "Flyback Line Size", // 0x090 FSIZE + "Chip ID no. Low Byte", // 0x094 ID0 + "Chip ID no. High Byte", // 0x098 ID1 + "Chip Version Number", // 0x09c VERSION + "Mouse X Position", // 0x0a0 MOUSEX + "Mouse Y Position", // 0x0a4 MOUSEY + "Mouse Data", // 0x0a8 MSEDAT + "Mouse Control", // 0x0ac MSECR + "", // 0x0b0 + "", // 0x0b4 + "", // 0x0b8 + "", // 0x0bc + "DACK Timing Control", // 0x0c0 DMATCR + "I/O Timing Control", // 0x0c4 IOTCR + "Expansion Card Timing", // 0x0c8 ECTCR + "DMA External Control", // 0x0cc DMAEXT (IOMD) / ASTCR (ARM7500) + "DRAM Width Control", // 0x0d0 DRAMWID + "Force CAS/RAS Lines Low", // 0x0d4 SELFREF + "", // 0x0d8 + "", // 0x0dc + "A to D IRQ Control", // 0x0e0 ATODICR + "A to D IRQ Status", // 0x0e4 ATODCC + "A to D IRQ Converter Control", // 0x0e8 ATODICR + "A to D IRQ Counter 1", // 0x0ec ATODCNT1 + "A to D IRQ Counter 2", // 0x0f0 ATODCNT2 + "A to D IRQ Counter 3", // 0x0f4 ATODCNT3 + "A to D IRQ Counter 4", // 0x0f8 ATODCNT4 + "", // 0x0fc + "I/O DMA 0 CurA", // 0x100 IO0CURA + "I/O DMA 0 EndA", // 0x104 IO0ENDA + "I/O DMA 0 CurB", // 0x108 IO0CURB + "I/O DMA 0 EndB", // 0x10c IO0ENDB + "I/O DMA 0 Control", // 0x110 IO0CR + "I/O DMA 0 Status", // 0x114 IO0ST + "", // 0x118 + "", // 0x11c + "I/O DMA 1 CurA", // 0x120 IO1CURA + "I/O DMA 1 EndA", // 0x124 IO1ENDA + "I/O DMA 1 CurB", // 0x128 IO1CURB + "I/O DMA 1 EndB", // 0x12c IO1ENDB + "I/O DMA 1 Control", // 0x130 IO1CR + "I/O DMA 1 Status", // 0x134 IO1ST + "", // 0x138 + "", // 0x13c + "I/O DMA 2 CurA", // 0x140 IO2CURA + "I/O DMA 2 EndA", // 0x144 IO2ENDA + "I/O DMA 2 CurB", // 0x148 IO2CURB + "I/O DMA 2 EndB", // 0x14c IO2ENDB + "I/O DMA 2 Control", // 0x150 IO2CR + "I/O DMA 2 Status", // 0x154 IO2ST + "", // 0x158 + "", // 0x15c + "I/O DMA 3 CurA", // 0x160 IO3CURA + "I/O DMA 3 EndA", // 0x164 IO3ENDA + "I/O DMA 3 CurB", // 0x168 IO3CURB + "I/O DMA 3 EndB", // 0x16c IO3ENDB + "I/O DMA 3 Control", // 0x170 IO3CR + "I/O DMA 3 Status", // 0x174 IO3ST + "", // 0x178 + "", // 0x17c + "Sound DMA 0 CurA", // 0x180 SD0CURA + "Sound DMA 0 EndA", // 0x184 SD0ENDA + "Sound DMA 0 CurB", // 0x188 SD0CURB + "Sound DMA 0 EndB", // 0x18c SD0ENDB + "Sound DMA 0 Control", // 0x190 SD0CR + "Sound DMA 0 Status", // 0x194 SD0ST + "", // 0x198 + "", // 0x19c + "Sound DMA 1 CurA", // 0x1a0 SD1CURA + "Sound DMA 1 EndA", // 0x1a4 SD1ENDA + "Sound DMA 1 CurB", // 0x1a8 SD1CURB + "Sound DMA 1 EndB", // 0x1ac SD1ENDB + "Sound DMA 1 Control", // 0x1b0 SD1CR + "Sound DMA 1 Status", // 0x1b4 SD1ST + "", // 0x1b8 + "", // 0x1bc + "Cursor DMA Current", // 0x1c0 CURSCUR + "Cursor DMA Init", // 0x1c4 CURSINIT + "Duplex LCD Current B", // 0x1c8 VIDCURB + "", // 0x1cc + "Video DMA Current", // 0x1d0 VIDCUR + "Video DMA End", // 0x1d4 VIDEND + "Video DMA Start", // 0x1d8 VIDSTART + "Video DMA Init", // 0x1dc VIDINIT + "Video DMA Control", // 0x1e0 VIDCR + "", // 0x1e4 + "Duplex LCD Init B", // 0x1e8 VIDINITB + "", // 0x1ec + "DMA IRQ Status", // 0x1f0 DMAST + "DMA IRQ Request", // 0x1f4 DMARQ + "DMA IRQ Mask", // 0x1f8 DMAMSK + "" // 0x1fc +}; + +#define IOMD_IOCR 0x000/4 +#define IOMD_KBDDAT 0x004/4 +#define IOMD_KBDCR 0x008/4 + +#define IOMD_IRQSTA 0x010/4 +#define IOMD_IRQRQA 0x014/4 +#define IOMD_IRQMSKA 0x018/4 + +#define IOMD_T0LOW 0x040/4 +#define IOMD_T0HIGH 0x044/4 +#define IOMD_T0GO 0x048/4 +#define IOMD_T0LATCH 0x04c/4 + +#define IOMD_T1LOW 0x050/4 +#define IOMD_T1HIGH 0x054/4 +#define IOMD_T1GO 0x058/4 +#define IOMD_T1LATCH 0x05c/4 + +#define IOMD_ID0 0x094/4 +#define IOMD_ID1 0x098/4 +#define IOMD_VERSION 0x09c/4 + +#define IOMD_VIDCUR 0x1d0/4 +#define IOMD_VIDEND 0x1d4/4 +#define IOMD_VIDSTART 0x1d8/4 +#define IOMD_VIDINIT 0x1dc/4 +#define IOMD_VIDCR 0x1e0/4 + + + +void riscpc_state::fire_iomd_timer(int timer) +{ + int timer_count = m_timer_counter[timer]; + int val = timer_count / 2; // correct? + + if(val==0) + m_IOMD_timer[timer]->adjust(attotime::never); + else + m_IOMD_timer[timer]->adjust(attotime::from_usec(val), 0, attotime::from_usec(val)); +} + +TIMER_CALLBACK_MEMBER(riscpc_state::IOMD_timer0_callback) +{ + m_IRQ_status_A|=0x20; + if(m_IRQ_mask_A&0x20) + { + generic_pulse_irq_line(m_maincpu, ARM7_IRQ_LINE,1); + } +} + +TIMER_CALLBACK_MEMBER(riscpc_state::IOMD_timer1_callback) +{ + m_IRQ_status_A|=0x40; + if(m_IRQ_mask_A&0x40) + { + generic_pulse_irq_line(m_maincpu, ARM7_IRQ_LINE,1); + } +} + +TIMER_CALLBACK_MEMBER(riscpc_state::flyback_timer_callback) +{ + m_IRQ_status_A|=0x08; + if(m_IRQ_mask_A&0x08) + { + generic_pulse_irq_line(m_maincpu, ARM7_IRQ_LINE,1); + } + + m_flyback_timer->adjust(machine().first_screen()->time_until_pos(m_vidc20_vert_reg[VDER])); +} + +void riscpc_state::viddma_transfer_start() +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + UINT32 src = m_viddma_addr_start; + UINT32 dst = 0; + UINT32 size = m_viddma_addr_end; + UINT32 dma_index; + UINT8 *vram = memregion("vram")->base(); + + /* TODO: this should actually be a qword transfer */ + for(dma_index = 0;dma_index < size;dma_index++) + { + vram[dst] = mem.read_byte(src); + + src++; + dst++; + } +} + +READ32_MEMBER( riscpc_state::a7000_iomd_r ) +{ +// if(offset != IOMD_KBDCR) +// logerror("IOMD: %s Register (%04x) read\n",iomd_regnames[offset & (0x1ff >> 2)],offset*4); + + + switch(offset) + { + case IOMD_IOCR: + { + UINT8 flyback; + int vert_pos; + + vert_pos = machine().first_screen()->vpos(); + flyback = (vert_pos <= m_vidc20_vert_reg[VDSR] || vert_pos >= m_vidc20_vert_reg[VDER]) ? 0x80 : 0x00; + + return m_IOMD_IO_ctrl | 0x34 | flyback; + } + case IOMD_KBDCR: return m_IOMD_keyb_ctrl | 0x80; //IOMD Keyb status + + /* + 1--- ---- always high + -x-- ---- Timer 1 + --x- ---- Timer 0 + ---x ---- Power On Reset + ---- x--- Flyback + ---- -x-- nINT1 + ---- --0- always low + ---- ---x INT2 + */ + case IOMD_IRQSTA: return (m_IRQ_status_A & ~2) | 0x80; + case IOMD_IRQRQA: return (m_IRQ_status_A & m_IRQ_mask_A) | 0x80; + case IOMD_IRQMSKA: return m_IRQ_mask_A; + + case IOMD_T0LOW: return m_timer_out[0] & 0xff; + case IOMD_T0HIGH: return (m_timer_out[0] >> 8) & 0xff; + + case IOMD_T1LOW: return m_timer_out[1] & 0xff; + case IOMD_T1HIGH: return (m_timer_out[1] >> 8) & 0xff; + + case IOMD_ID0: return m_io_id & 0xff; // IOMD ID low + case IOMD_ID1: return (m_io_id >> 8) & 0xff; // IOMD ID high + case IOMD_VERSION: return 0; + + case IOMD_VIDEND: return m_viddma_addr_end & 0x00fffff8; //bits 31:24 undefined + case IOMD_VIDSTART: return m_viddma_addr_start & 0x1ffffff8; //bits 31, 30, 29 undefined + case IOMD_VIDCR: return (m_viddma_status & 0xa0) | 0x50; //bit 6 = DRAM mode, bit 4 = QWORD transfer + + default: logerror("IOMD: %s Register (%04x) read\n",iomd_regnames[offset & (0x1ff >> 2)],offset*4); break; + } + + return 0; +} + +WRITE32_MEMBER( riscpc_state::a7000_iomd_w ) +{ +// logerror("IOMD: %s Register (%04x) write = %08x\n",iomd_regnames[offset & (0x1ff >> 2)],offset*4,data); + + switch(offset) + { + case IOMD_IOCR: m_IOMD_IO_ctrl = data & ~0xf4; break; + + case IOMD_KBDCR: + m_IOMD_keyb_ctrl = data & ~0xf4; + //keyboard_ctrl_write(data & 0x08); + break; + + case IOMD_IRQRQA: m_IRQ_status_A &= ~data; break; + case IOMD_IRQMSKA: m_IRQ_mask_A = (data & ~2) | 0x80; break; + + case IOMD_T0LOW: m_timer_in[0] = (m_timer_in[0] & 0xff00) | (data & 0xff); break; + case IOMD_T0HIGH: m_timer_in[0] = (m_timer_in[0] & 0x00ff) | ((data & 0xff) << 8); break; + case IOMD_T0GO: + m_timer_counter[0] = m_timer_in[0]; + fire_iomd_timer(0); + break; + case IOMD_T0LATCH: + { + m_t0readinc^=1; + m_timer_out[0] = m_timer_counter[0]; + if(m_t0readinc) + { + m_timer_counter[0]--; + if(m_timer_counter[0] < 0) + m_timer_counter[0]+= m_timer_in[0]; + } + } + break; + + case IOMD_T1LOW: m_timer_in[1] = (m_timer_in[1] & 0xff00) | (data & 0xff); break; + case IOMD_T1HIGH: m_timer_in[1] = (m_timer_in[1] & 0x00ff) | ((data & 0xff) << 8); break; + case IOMD_T1GO: + m_timer_counter[1] = m_timer_in[1]; + fire_iomd_timer(1); + break; + case IOMD_T1LATCH: + { + m_t1readinc^=1; + m_timer_out[1] = m_timer_counter[1]; + if(m_t1readinc) + { + m_timer_counter[1]--; + if(m_timer_counter[1] < 0) + m_timer_counter[1]+= m_timer_in[1]; + } + } + break; + + case IOMD_VIDEND: m_viddma_addr_end = data & 0x00fffff8; //bits 31:24 unused + case IOMD_VIDSTART: m_viddma_addr_start = data & 0x1ffffff8; //bits 31, 30, 29 unused + case IOMD_VIDCR: + m_viddma_status = data & 0xa0; if(data & 0x20) { viddma_transfer_start(); } + break; + + + default: logerror("IOMD: %s Register (%04x) write = %08x\n",iomd_regnames[offset & (0x1ff >> 2)],offset*4,data); + } +} + +static ADDRESS_MAP_START( a7000_mem, AS_PROGRAM, 32, riscpc_state) + AM_RANGE(0x00000000, 0x003fffff) AM_MIRROR(0x00800000) AM_ROM AM_REGION("user1", 0) +// AM_RANGE(0x01000000, 0x01ffffff) AM_NOP //expansion ROM +// AM_RANGE(0x02000000, 0x02ffffff) AM_RAM //VRAM +// I/O 03000000 - 033fffff +// AM_RANGE(0x03010000, 0x03011fff) //Super IO +// AM_RANGE(0x03012000, 0x03029fff) //FDC +// AM_RANGE(0x0302b000, 0x0302bfff) //Network podule +// AM_RANGE(0x03040000, 0x0304ffff) //podule space 0,1,2,3 +// AM_RANGE(0x03070000, 0x0307ffff) //podule space 4,5,6,7 + AM_RANGE(0x03200000, 0x032001ff) AM_READWRITE(a7000_iomd_r,a7000_iomd_w) //IOMD Registers //mirrored at 0x03000000-0x1ff? +// AM_RANGE(0x03310000, 0x03310003) //Mouse Buttons + + AM_RANGE(0x03400000, 0x037fffff) AM_WRITE(a7000_vidc20_w) +// AM_RANGE(0x08000000, 0x08ffffff) AM_MIRROR(0x07000000) //EASI space + AM_RANGE(0x10000000, 0x13ffffff) AM_RAM //SIMM 0 bank 0 + AM_RANGE(0x14000000, 0x17ffffff) AM_RAM //SIMM 0 bank 1 +// AM_RANGE(0x18000000, 0x18ffffff) AM_MIRROR(0x03000000) AM_RAM //SIMM 1 bank 0 +// AM_RANGE(0x1c000000, 0x1cffffff) AM_MIRROR(0x03000000) AM_RAM //SIMM 1 bank 1 +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( a7000 ) +INPUT_PORTS_END + +void riscpc_state::machine_start() +{ + m_IOMD_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(riscpc_state::IOMD_timer0_callback),this)); + m_IOMD_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(riscpc_state::IOMD_timer1_callback),this)); + m_flyback_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(riscpc_state::flyback_timer_callback),this)); + + m_io_id = 0xd4e7; +} + +void riscpc_state::machine_reset() +{ + m_IOMD_IO_ctrl = 0x0b | 0x34; //bit 0,1 and 3 set high on reset plus 2,4,5 always high +// m_IRQ_status_A = 0x10; // set POR bit ON + m_IRQ_mask_A = 0x00; + + m_IOMD_keyb_ctrl = 0x00; + + m_IOMD_timer[0]->adjust( attotime::never); + m_IOMD_timer[1]->adjust( attotime::never); + m_flyback_timer->adjust( attotime::never); +} + +static MACHINE_CONFIG_START( rpc600, riscpc_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD( "maincpu", ARM7, XTAL_30MHz ) // ARM610 + MCFG_CPU_PROGRAM_MAP(a7000_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1900, 1080) //max available size + MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) + MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) + MCFG_PALETTE_ADD("palette", 0x200) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( rpc700, riscpc_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD( "maincpu", ARM7, XTAL_40MHz ) // ARM710 + MCFG_CPU_PROGRAM_MAP(a7000_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1900, 1080) //max available size + MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) + MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) + MCFG_PALETTE_ADD("palette", 0x200) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( a7000, riscpc_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD( "maincpu", ARM7, XTAL_32MHz ) // ARM7500 + MCFG_CPU_PROGRAM_MAP(a7000_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1900, 1080) //max available size + MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) + MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) + MCFG_PALETTE_ADD("palette", 0x200) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( a7000p, a7000 ) + MCFG_CPU_MODIFY("maincpu") // ARM7500FE + MCFG_CPU_CLOCK(XTAL_48MHz) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( sarpc, riscpc_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD( "maincpu", ARM7, 202000000 ) // StrongARM + MCFG_CPU_PROGRAM_MAP(a7000_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1900, 1080) //max available size + MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) + MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) + MCFG_PALETTE_ADD("palette", 0x200) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( sarpc_j233, riscpc_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD( "maincpu", ARM7, 233000000 ) // StrongARM + MCFG_CPU_PROGRAM_MAP(a7000_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(1900, 1080) //max available size + MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) + MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) + MCFG_PALETTE_ADD("palette", 0x200) +MACHINE_CONFIG_END + +ROM_START(rpc600) + ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) + // Version 3.50 + ROM_SYSTEM_BIOS( 0, "350", "RiscOS 3.50" ) + ROMX_LOAD( "0277,521-01.bin", 0x000000, 0x100000, CRC(8ba4444e) SHA1(1b31d7a6e924bef0e0056c3a00a3fed95e55b175), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD( "0277,522-01.bin", 0x000002, 0x100000, CRC(2bc95c9f) SHA1(f8c6e2a1deb4fda48aac2e9fa21b9e01955331cf), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START(rpc700) + ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) + // Version 3.60 + ROM_SYSTEM_BIOS( 0, "360", "RiscOS 3.60" ) + ROMX_LOAD( "1203,101-01.bin", 0x000000, 0x200000, CRC(2eeded56) SHA1(7217f942cdac55033b9a8eec4a89faa2dd63cd68), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD( "1203,102-01.bin", 0x000002, 0x200000, CRC(6db87d21) SHA1(428403ed31682041f1e3d114ea02a688d24b7d94), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START(a7000) + ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) + // Version 3.60 + ROM_SYSTEM_BIOS( 0, "360", "RiscOS 3.60" ) + ROMX_LOAD( "1203,101-01.bin", 0x000000, 0x200000, CRC(2eeded56) SHA1(7217f942cdac55033b9a8eec4a89faa2dd63cd68), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD( "1203,102-01.bin", 0x000002, 0x200000, CRC(6db87d21) SHA1(428403ed31682041f1e3d114ea02a688d24b7d94), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START(a7000p) + ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) + // Version 3.71 + ROM_SYSTEM_BIOS( 0, "371", "RiscOS 3.71" ) + ROMX_LOAD( "1203,261-01.bin", 0x000000, 0x200000, CRC(8e3c570a) SHA1(ffccb52fa8e165d3f64545caae1c349c604386e9), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD( "1203,262-01.bin", 0x000002, 0x200000, CRC(cf4615b4) SHA1(c340f29aeda3557ebd34419fcb28559fc9b620f8), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + // Version 4.02 + ROM_SYSTEM_BIOS( 1, "402", "RiscOS 4.02" ) + ROMX_LOAD( "riscos402_1.bin", 0x000000, 0x200000, CRC(4c32f7e2) SHA1(d290e29a4de7be9eb36cbafbb2dc99b1c4ce7f72), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(2)) + ROMX_LOAD( "riscos402_2.bin", 0x000002, 0x200000, CRC(7292b790) SHA1(67f999c1ccf5419e0a142b7e07f809e13dfed425), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(2)) + // Version 4.39 + ROM_SYSTEM_BIOS( 2, "439", "RiscOS 4.39" ) + ROMX_LOAD( "riscos439_1.bin", 0x000000, 0x200000, CRC(dab94cb8) SHA1(a81fb7f1a8117f85e82764675445092d769aa9af), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(3)) + ROMX_LOAD( "riscos439_2.bin", 0x000002, 0x200000, CRC(22e6a5d4) SHA1(b73b73c87824045130840a19ce16fa12e388c039), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(3)) + ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START(sarpc) + ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) + // Version 3.70 + ROM_SYSTEM_BIOS( 0, "370", "RiscOS 3.70" ) + ROMX_LOAD( "1203,191-01.bin", 0x000000, 0x200000, NO_DUMP, ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD( "1203,192-01.bin", 0x000002, 0x200000, NO_DUMP, ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) +ROM_END + +ROM_START(sarpc_j233) + ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) + // Version 3.71 + ROM_SYSTEM_BIOS( 0, "371", "RiscOS 3.71" ) + ROMX_LOAD( "1203,261-01.bin", 0x000000, 0x200000, CRC(8e3c570a) SHA1(ffccb52fa8e165d3f64545caae1c349c604386e9), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROMX_LOAD( "1203,262-01.bin", 0x000002, 0x200000, CRC(cf4615b4) SHA1(c340f29aeda3557ebd34419fcb28559fc9b620f8), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) + ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1994, rpc600, 0, 0, rpc600, a7000, driver_device, 0, "Acorn", "Risc PC 600", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1994, rpc700, rpc600, 0, rpc700, a7000, driver_device, 0, "Acorn", "Risc PC 700", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1995, a7000, rpc600, 0, a7000, a7000, driver_device, 0, "Acorn", "Archimedes A7000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1997, a7000p, rpc600, 0, a7000p, a7000, driver_device, 0, "Acorn", "Archimedes A7000+", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1997, sarpc, rpc600, 0, sarpc, a7000, driver_device, 0, "Acorn", "StrongARM Risc PC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1997, sarpc_j233, rpc600, 0, sarpc_j233, a7000, driver_device, 0, "Acorn", "J233 StrongARM Risc PC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/rm380z.c b/src/mame/drivers/rm380z.c new file mode 100644 index 00000000000..659ec0dbe31 --- /dev/null +++ b/src/mame/drivers/rm380z.c @@ -0,0 +1,179 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol,Gabriele D'Antona +/* + +Research Machines 380Z (aka "RML 380Z" or "RM 380Z") +Microcomputer produced by Research Machines Limited, Oxford, UK +1978-1985 +MESS driver by Wilbert Pol and friol (dantonag (at) gmail.com) +Driver started on 22/12/2011 + +=== + +Memory map from sevice manual: + +PAGE SEL bit in PORT0 set to 0: + + 0000-3BFF - CPU RAM row 1 (15KB!) + 3C00-7BFF - CPU RAM row 2 (16KB) + 7C00-BBFF - Add-on RAM row 1 or HRG RAM (16KB) + BC00-DFFF - Add-on RAM row 2 (9KB!) + E000-EFFF - ROM (COS) + F000-F5FF - VDU and HRG Video RAM + F600-F9FF - ROM (monitor extension) + FA00-FAFF - Reserved, RAM? + FB00-FBFF - Memory-mapped ports (FBFC-FBFF) + FC00-FFFF - RAM + +PAGE SEL bit in PORT0 set to 1: + 0000-0FFF - ROM (COS mirror from E000) + 1B00-1BFF - Memory-mapped ports (1BFC-1BFF) + 1C00-1DFF - ROM + 4000-7FFF - CPU RAM row 1 (16KB!, this RAM normally appears at 0000) + 8000-BFFF - ??? + C000-DFFF - ??? + E000-EFFF - ROM (COS) + F000-F5FF - VDU and HRG Video RAM + F600-F9FF - ROM (monitor extension) + FA00-FAFF - Reserved, RAM? + FB00-FBFF - Memory-mapped ports (FBFC-FBFF) + FC00-FFFF - RAM + +Video resolution (not confirmed): +80x24 - 6 pixels wide (5 + spacing), 10 pixels high (9 + spacing) = 480x240 +Video input clock is 16MHz + +According to the manuals, VDU-1 chargen is Texas 74LS262. + +=== + +Notes on COS 4.0 disassembly: + +- routine at 0xe438 is called at startup in COS 4.0 and it sets the RST vectors in RAM +- routine at 0xe487 finds "top" of system RAM and stores it in 0x0006 and 0x000E +- 0xeca0 - outputs a string (null terminated) to screen (?) +- 0xff18 - does char output to screen (char in A?) + +=== + +TODO: + +- Properly implement "backwards" or "last 4 lines" scrolling +- Properly implement dimming and graphic chars (>0x80) +- Understand why any write to disk command fails with "bad sector" +- Understand why ctrl-U (blinking cursor) in COS 4.0 stops keyboard input from working +- Get a reliable ROM dump and charset ROM dump + + +Attempt to register save state entry after state registration is closed! +Module timer tag static_vblank_timer name m_param +Attempt to register save state entry after state registration is closed! +Module timer tag static_vblank_timer name m_enabled +Attempt to register save state entry after state registration is closed! +Module timer tag static_vblank_timer name m_period.attoseconds +Attempt to register save state entry after state registration is closed! +Module timer tag static_vblank_timer name m_period.seconds +Attempt to register save state entry after state registration is closed! +Module timer tag static_vblank_timer name m_start.attoseconds +Attempt to register save state entry after state registration is closed! +Module timer tag static_vblank_timer name m_start.seconds +Attempt to register save state entry after state registration is closed! +Module timer tag static_vblank_timer name m_expire.attoseconds +Attempt to register save state entry after state registration is closed! +Module timer tag static_vblank_timer name m_expire.seconds +':maincpu' (E48B): unmapped program memory write to E000 = C1 & FF +':maincpu' (E48E): unmapped program memory write to E000 = 3E & FF + +*/ + + +#include "includes/rm380z.h" + +#define KEYBOARD_TAG "keyboard" + +static ADDRESS_MAP_START(rm380z_mem, AS_PROGRAM, 8, rm380z_state) + AM_RANGE( 0xe000, 0xefff ) AM_ROM AM_REGION(RM380Z_MAINCPU_TAG, 0) + AM_RANGE( 0xf000, 0xf5ff ) AM_READWRITE(videoram_read,videoram_write) + AM_RANGE( 0xf600, 0xf9ff ) AM_ROM AM_REGION(RM380Z_MAINCPU_TAG, 0x1000) /* Extra ROM space for COS4.0 */ + AM_RANGE( 0xfa00, 0xfaff ) AM_RAM + AM_RANGE( 0xfb00, 0xfbff ) AM_READWRITE( port_read, port_write ) + AM_RANGE( 0xfc00, 0xffff ) AM_READWRITE(hiram_read,hiram_write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( rm380z_io , AS_IO, 8, rm380z_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0xbf) AM_READWRITE(rm380z_portlow_r, rm380z_portlow_w) + AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("wd1771", fd1771_t, read, write) + AM_RANGE(0xc4, 0xc4) AM_WRITE(disk_0_control) + AM_RANGE(0xc5, 0xff) AM_READWRITE(rm380z_porthi_r, rm380z_porthi_w) +ADDRESS_MAP_END + +INPUT_PORTS_START( rm380z ) +// PORT_START("additional_chars") +// PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CODE(KEYCODE_ESC) +INPUT_PORTS_END + +// +// +// + +static SLOT_INTERFACE_START( rm380z_floppies ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) +SLOT_INTERFACE_END + +UINT32 rm380z_state::screen_update_rm380z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + update_screen(bitmap); + return 0; +} + +static MACHINE_CONFIG_START( rm380z, rm380z_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(RM380Z_MAINCPU_TAG, Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(rm380z_mem) + MCFG_CPU_IO_MAP(rm380z_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + // according to videos and pictures of the real hardware, chars are spaced of at least 1 pixel + // and there is at least 1 pixel between each row of characters + MCFG_SCREEN_SIZE((RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1)), (RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))) + MCFG_SCREEN_VISIBLE_AREA(0, (RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1))-1, 0, (RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))-1) + MCFG_SCREEN_UPDATE_DRIVER(rm380z_state, screen_update_rm380z) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* RAM configurations */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("56K") + + /* floppy disk */ + MCFG_FD1771_ADD("wd1771", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("wd1771:0", rm380z_floppies, "sssd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1771:1", rm380z_floppies, "sssd", floppy_image_device::default_floppy_formats) + + /* keyboard */ + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(rm380z_state, keyboard_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( rm380z ) + ROM_REGION( 0x10000, RM380Z_MAINCPU_TAG, 0 ) +// ROM_LOAD( "cos34e-m.bin", 0x0000, 0x1000, CRC(20e2ddf4) SHA1(3177b28793d5a348c94fd0ae6393d74e2e9a8662)) + // I'm not sure of how those roms have been dumped. I don't know if those are good dumps or not. + ROM_LOAD( "cos40b-m.bin", 0x0000, 0x1000, BAD_DUMP CRC(1f0b3a5c) SHA1(0b29cb2a3b7eaa3770b34f08c4fd42844f42700f)) + ROM_LOAD( "cos40b-m_f600-f9ff.bin", 0x1000, 0x400, BAD_DUMP CRC(e3397d9d) SHA1(490a0c834b0da392daf782edc7d51ca8f0668b1a)) + ROM_LOAD( "cos40b-m_1c00-1dff.bin", 0x1400, 0x200, BAD_DUMP CRC(0f759f44) SHA1(9689c1c1faa62c56def999cbedbbb0c8d928dcff)) + // chargen ROM is undumped, afaik + ROM_REGION( 0x1680, "chargen", 0 ) + ROM_LOAD( "ch3.raw", 0x0000, 0x1680, BAD_DUMP CRC(c223622b) SHA1(185ef24896419d7ff46f71a760ac217de3811684)) +ROM_END + +/* Driver */ + +COMP(1978, rm380z, 0, 0, rm380z, rm380z, driver_device, 0, "Research Machines", "RM-380Z", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/rmnimbus.c b/src/mame/drivers/rmnimbus.c new file mode 100644 index 00000000000..94a34ff7b6f --- /dev/null +++ b/src/mame/drivers/rmnimbus.c @@ -0,0 +1,225 @@ +// license:BSD-3-Clause +// copyright-holders:Phill Harvey-Smith, Carl +/* + drivers/rmnimbus.c + + Research machines Nimbus. + + 2009-11-14, P.Harvey-Smith. + +*/ + +#include "includes/rmnimbus.h" +#include "cpu/mcs51/mcs51.h" +#include "imagedev/flopdrv.h" +#include "formats/pc_dsk.h" +#include "bus/scsi/scsihd.h" +#include "bus/scsi/s1410.h" +#include "bus/scsi/acb4070.h" +#include "bus/isa/fdc.h" +#include "bus/rs232/rs232.h" +#include "machine/rmnkbd.h" + +static SLOT_INTERFACE_START(rmnimbus_floppies) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(keyboard) + SLOT_INTERFACE("rmnkbd", RMNIMBUS_KEYBOARD) +SLOT_INTERFACE_END + +static ADDRESS_MAP_START(nimbus_mem, AS_PROGRAM, 16, rmnimbus_state ) + AM_RANGE( 0x00000, 0x1FFFF ) AM_RAMBANK(RAM_BANK00_TAG) + AM_RANGE( 0x20000, 0x3FFFF ) AM_RAMBANK(RAM_BANK01_TAG) + AM_RANGE( 0x40000, 0x5FFFF ) AM_RAMBANK(RAM_BANK02_TAG) + AM_RANGE( 0x60000, 0x7FFFF ) AM_RAMBANK(RAM_BANK03_TAG) + AM_RANGE( 0x80000, 0x9FFFF ) AM_RAMBANK(RAM_BANK04_TAG) + AM_RANGE( 0xA0000, 0xBFFFF ) AM_RAMBANK(RAM_BANK05_TAG) + AM_RANGE( 0xC0000, 0xDFFFF ) AM_RAMBANK(RAM_BANK06_TAG) + AM_RANGE( 0xE0000, 0xEFFFF ) AM_RAMBANK(RAM_BANK07_TAG) + AM_RANGE( 0xF0000, 0xFFFFF ) AM_ROM AM_REGION(MAINCPU_TAG, 0x0f0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(nimbus_io, AS_IO, 16, rmnimbus_state ) + AM_RANGE( 0x0000, 0x0031) AM_READWRITE(nimbus_video_io_r, nimbus_video_io_w) + AM_RANGE( 0x0080, 0x0081) AM_READWRITE8(nimbus_mcu_r, nimbus_mcu_w, 0x00FF) + AM_RANGE( 0x0092, 0x0093) AM_READWRITE8(nimbus_iou_r, nimbus_iou_w, 0x00FF) + AM_RANGE( 0x00A4, 0x00A5) AM_READWRITE8(nimbus_mouse_js_r, nimbus_mouse_js_w, 0x00FF) + AM_RANGE( 0X00c0, 0X00cf) AM_READWRITE8(nimbus_pc8031_r, nimbus_pc8031_w, 0x00FF) + AM_RANGE( 0X00e0, 0X00ef) AM_DEVREADWRITE8(AY8910_TAG, ay8910_device, data_r, address_data_w, 0x00FF) + AM_RANGE( 0x00f0, 0x00f7) AM_DEVREADWRITE8(Z80SIO_TAG, z80sio2_device, cd_ba_r, cd_ba_w, 0x00ff) + AM_RANGE( 0x0400, 0x0401) AM_WRITE8(fdc_ctl_w, 0x00ff) + AM_RANGE( 0x0408, 0x040f) AM_DEVREADWRITE8(FDC_TAG, wd2793_t, read, write, 0x00ff) + AM_RANGE( 0x0410, 0x041f) AM_READWRITE8(scsi_r, scsi_w, 0x00ff) + AM_RANGE( 0x0480, 0x049f) AM_DEVREADWRITE8(VIA_TAG, via6522_device, read, write, 0x00FF) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( nimbus ) + PORT_START("config") + PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device") + PORT_CONFSETTING( 0x00, "Mouse" ) + PORT_CONFSETTING( 0x01, DEF_STR( Joystick ) ) + + PORT_START(JOYSTICK0_TAG) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY // XB + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY // XA + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY // YA + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY // YB + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + + PORT_START(MOUSE_BUTTON_TAG) /* Mouse buttons */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1) + + PORT_START(MOUSEX_TAG) /* Mouse - X AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START(MOUSEY_TAG) /* Mouse - Y AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + +INPUT_PORTS_END + +static ADDRESS_MAP_START(nimbus_iocpu_mem, AS_PROGRAM, 8, rmnimbus_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( nimbus_iocpu_io , AS_IO, 8, rmnimbus_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x000FF) AM_READWRITE(nimbus_pc8031_iou_r, nimbus_pc8031_iou_w) + AM_RANGE(0x20000, 0x20004) AM_READWRITE(nimbus_pc8031_port_r, nimbus_pc8031_port_w) +ADDRESS_MAP_END + +static const UINT16 def_config[16] = +{ + 0x0280, 0x017F, 0xE824, 0x8129, + 0x0329, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8893, 0x2025, 0xB9E6 +}; + +static MACHINE_CONFIG_START( nimbus, rmnimbus_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(MAINCPU_TAG, I80186, 16000000) // the cpu is a 10Mhz part but the serial clocks are wrong unless it runs at 8Mhz + MCFG_CPU_PROGRAM_MAP(nimbus_mem) + MCFG_CPU_IO_MAP(nimbus_io) + MCFG_80186_IRQ_SLAVE_ACK(READ8(rmnimbus_state, cascade_callback)) + MCFG_80186_TMROUT0_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxca_w)) + MCFG_80186_TMROUT1_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + + MCFG_CPU_ADD(IOCPU_TAG, I8031, 11059200) + MCFG_CPU_PROGRAM_MAP(nimbus_iocpu_mem) + MCFG_CPU_IO_MAP(nimbus_iocpu_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS( XTAL_4_433619MHz*2,650,0,640,260,0,250) + MCFG_SCREEN_UPDATE_DRIVER(rmnimbus_state, screen_update_nimbus) + //MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + + /* Backing storage */ + MCFG_WD2793_ADD(FDC_TAG, 1000000) + MCFG_WD_FDC_FORCE_READY + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(rmnimbus_state,nimbus_fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(rmnimbus_state,nimbus_fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":0", rmnimbus_floppies, "35dd", isa8_fdc_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":1", rmnimbus_floppies, "35dd", isa8_fdc_device::floppy_formats) + + MCFG_DEVICE_ADD(SCSIBUS_TAG, SCSI_PORT, 0) + MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") + MCFG_SCSI_MSG_HANDLER(WRITELINE(rmnimbus_state, write_scsi_msg)) + MCFG_SCSI_BSY_HANDLER(WRITELINE(rmnimbus_state, write_scsi_bsy)) + MCFG_SCSI_IO_HANDLER(WRITELINE(rmnimbus_state, write_scsi_io)) + MCFG_SCSI_CD_HANDLER(WRITELINE(rmnimbus_state, write_scsi_cd)) + MCFG_SCSI_REQ_HANDLER(WRITELINE(rmnimbus_state, write_scsi_req)) + + MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) + MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1) + MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE3, "harddisk", ACB4070, SCSI_ID_2) + MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE4, "harddisk", S1410, SCSI_ID_3) + + MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SCSIBUS_TAG) + MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) + + MCFG_DEVICE_ADD("scsi_ctrl_out", OUTPUT_LATCH, 0) + MCFG_OUTPUT_LATCH_BIT0_HANDLER(DEVWRITELINE(SCSIBUS_TAG, SCSI_PORT_DEVICE, write_rst)) + MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE(SCSIBUS_TAG, SCSI_PORT_DEVICE, write_sel)) + MCFG_OUTPUT_LATCH_BIT2_HANDLER(WRITELINE(rmnimbus_state, write_scsi_iena)) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1536K") + MCFG_RAM_EXTRA_OPTIONS("128K,256K,384K,512K,640K,1024K") + + /* Peripheral chips */ + MCFG_Z80SIO2_ADD(Z80SIO_TAG, 4000000, 0, 0, 0, 0) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(WRITELINE(rmnimbus_state, sio_interrupt)) + + MCFG_RS232_PORT_ADD("rs232a", keyboard, "rmnkbd") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) + + MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcdb_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rib_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsb_w)) + + MCFG_EEPROM_SERIAL_93C06_ADD(ER59256_TAG) + MCFG_EEPROM_DATA(def_config,sizeof(def_config)) + + MCFG_DEVICE_ADD(VIA_TAG, VIA6522, 1000000) + MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(rmnimbus_state,nimbus_via_write_portb)) + MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(MAINCPU_TAG, i80186_cpu_device, int3_w)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(VIA_TAG, via6522_device, write_ca1)) MCFG_DEVCB_INVERT + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO(MONO_TAG) + MCFG_SOUND_ADD(AY8910_TAG, AY8910, 2000000) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(rmnimbus_state, nimbus_sound_ay8910_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(rmnimbus_state, nimbus_sound_ay8910_portb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,MONO_TAG, 0.75) + + MCFG_SOUND_ADD(MSM5205_TAG, MSM5205, 384000) + MCFG_MSM5205_VCLK_CB(WRITELINE(rmnimbus_state, nimbus_msm5205_vck)) /* VCK function */ + MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* 8 kHz */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, MONO_TAG, 0.75) + + /* Software list */ + MCFG_SOFTWARE_LIST_ADD("disk_list","nimbus") +MACHINE_CONFIG_END + + +ROM_START( nimbus ) + ROM_REGION( 0x100000, MAINCPU_TAG, 0 ) + + ROM_SYSTEM_BIOS(0, "v131a", "Nimbus BIOS v1.31a (1986-06-18)") + ROMX_LOAD("sys1-1.31a-16128-1986-06-18.rom", 0xf0001, 0x8000, CRC(6416eb05) SHA1(1b640163a7efbc24381c7b24976a8609c066959b),ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD("sys2-1.31a-16129-1986-06-18.rom", 0xf0000, 0x8000, CRC(b224359d) SHA1(456bbe37afcd4429cca76ba2d6bd534dfda3fc9c),ROM_SKIP(1) | ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS(1, "v132f", "Nimbus BIOS v1.32f (1989-10-20)") + ROMX_LOAD("sys-1-1.32f-22779-1989-10-20.rom", 0xf0001, 0x8000, CRC(786c31e8) SHA1(da7f828f7f96087518bea1a3d89fee59b283b4ba),ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD("sys-2-1.32f-22779-1989-10-20.rom", 0xf0000, 0x8000, CRC(0be3db64) SHA1(af806405ec6fbc20385705f90d5059a47de17b08),ROM_SKIP(1) | ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS(2, "v140d", "Nimbus BIOS v1.40d (1990-xx-xx)") + ROMX_LOAD("sys-1-1.40d.rom", 0xf0001, 0x8000, CRC(b8d3dc0b) SHA1(82e0dcdc6c7a83339af68d6cb61211fcb14bed88),ROM_SKIP(1) | ROM_BIOS(3) ) + ROMX_LOAD("sys-2-1.40d.rom", 0xf0000, 0x8000, CRC(b0826b0b) SHA1(3baa369a0e7ef138ca29aae0ee8a89ab670a02b9),ROM_SKIP(1) | ROM_BIOS(3) ) + + ROM_REGION( 0x4000, IOCPU_TAG, 0 ) + ROM_LOAD("hexec-v1.02u-13488-1985-10-29.rom", 0x0000, 0x1000, CRC(75c6adfd) SHA1(0f11e0b7386c6368d20e1fc7a6196d670f924825)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, nimbus, 0, 0, nimbus, nimbus, driver_device, 0, "Research Machines", "Nimbus", 0) diff --git a/src/mame/drivers/rmt32.c b/src/mame/drivers/rmt32.c new file mode 100644 index 00000000000..9579adc778c --- /dev/null +++ b/src/mame/drivers/rmt32.c @@ -0,0 +1,438 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert,Jonathan Gevaryahu +/************************************************************************************************* + + Roland MT-32/CM32L driver + + Driver by Olivier Galibert and Jonathan Gevaryahu + + The Roland MT32 is an expander (synthesizer without the keyboard) + from 1987. It had a small 20-char LCD display and 10 control + buttons (part 1-5, rhythm, sound/sound group, volume/master + volume), a rotating knob and a midi message led. It uses a weird + kind of synthesis called "Linear Additive". + + The CM32L versions is a simpler/smaller version without the lcd, + buttons or knob but keeping the led. It also has a different + firmware and more partials rom, adding "game sounds". "CM" means + "Computer Music". + + The LAPC-I (I as in Intel) is a ISA board variant of the CM32L + with a MPU-401 frontend added to communicate with the synth. All + the roms are identical with the CM32L. + + Some special tricks: + - pressing 3+V (Part 3 + Volume) at boot time starts the test mode + + - predding 4+R+M (Part 4 + Rhythm + Master Volume) at boot time + shows the firmware version + + - the CM32L drives the lcd as if it was there and looks at the + buttons at boot time for test mode and firmware version + + + +Roland MT-32 rev00 pcb (early 1.0.7 and all earlier firmware, with ic26 and ic27 socketed): + +PCB Layout +---------- + +MT-32 MAIN BOARD ASSY 79377310 00 +|---------------------------------|------------------------|-----------| +| JK1 JK2 IR3M03 | JK3 |JK4 SW1 | +| | | | +|5218 072D 5218 072D |------------------------| | +| IR3M03 PC910 74HC04 | +| | +|072D 4051 | +| ROM.IC21 |----| | +| M5238 | | | +| ROM.IC26 6264 | | | +| |---------| 74LS05 74HC27 ROM.IC22 | | 12MHz| +| | PCM54HP | 74HC00 6264 | | | +| |---------| |8095| | +| |------| | | | +| | | ROM.IC27 6264 | | | +| 4416 4416 | *2 | | | | +| | | 6264 |----| | +| 4416 4416 | | | +| |------| |-----| | +| |-------| | | | +| ROM.IC13 | | 32.768kHz | *1 | | +| | *3 | 74HC04 | | | +| CN1 CN2 |-------| CN3 CN4 74HC02 74HC00 |-----| CN5| +|----------------------------------------------------------------------| +Notes: (All IC's listed for completeness) + 8095 - Intel C8095-90 16-Bit Microcontroller, Clock Input 12.000MHz (DIP48) + 6264 - Hitachi HM6264ALSP-15 8K x8 SRAM (DIP28) + 4416 - Mitsubishi M5M4416P-12 16K x4 DRAM (DIP18) + PC910 - Sharp PC910 Opto-Isolator (DIP8) + IR3M03 - Sharp IR3M03A (DIP8) + 072D - New Japan Radio Co., Ltd JRC072D Dual J-FET Input Operational Amplifier (DIP8) + 5218 - Mitsubishi 5218 Operational Amplifier (DIP8) + M5238 - Mitsubishi M5238 LCD Display Controller (SIP8) + CN1 - 6 Pin Connector + CN2 - 6 Pin Connector + CN3 - 2 Pin Connector + CN4 - 3 Pin Connector + CN5 - 10 Pin Connector + SW1 - Power On/Off Switch + JK1 - 1/4" Stereo Jack + JK2 - 1/4" Stereo Jack + JK3 - MIDI In, MIDI Out and Midi Thru DIN5 Jacks + JK4 - Mini 1/8th" Power Input Jack + *1 - R15229865 HG61H15B59F (QFP80, stamped 'Roland') + *2 - R15229851 MB87136A LA32 (PGA144?, stamped 'Roland') + *3 - R15229863 HG61H20R36F (QFP100, stamped 'BOSS') + PCM54HP- Burr-Brown PCM54HP 16-Bit Monolithic Digital-to-Analog Converter (DIP28) + & Various logic ICs - 4051, 74HC27, 74HC00, 74HC02, 74HC04, 74LS05 + + ROMs - Filename Device Type + ------------------------------------------------------------------------ + ROM.IC26.106 Mitsubishi M5M27C256 (labeled 1.0.6) read as 27C256 + ROM.IC27.106 Mitsubishi M5M27C256 (labeled 1.0.6) read as 27C256 + ROM.IC13.200 Mitsubishi M5M27C128 (labeled 2.0.0) read as 27C128 + ROM.IC21 Toshiba TC532000P (-7471) read as TC572000 + ROM.IC22 Toshiba TC532000P (-7472) read as TC572000 + + + +Newer version + +PCB Layout +---------- + +MT-32 MAIN BOARD ASSY 79377310 01 +|---------------------------------|------------------------|-----------| +| JK1 JK2 IR3M03 | JK3 |JK4 SW1 | +| | | | +|5218 072D 5218 072D |------------------------| | +| IR3M03 PC910 74HC04 | +| | +|072D 4051 | +| ROM.IC37 |----| | +| M5238 | | | +| ROM.IC26 4364 | | | +| |---------| 74LS05 74HC27 | | 12MHz| +| | PCM54HP | 74HC00 4364 | | | +| |---------| |8095| | +| | | | +| |-----|ROM.IC27 4364 | | | +| 81416 81416 | | | | | +| | *2 | 4364 |----| | +| 81416 81416 | | | +| |-----| |-----| | +| |-------| | | | +| ROM.IC13 | | 32.768kHz | *1 | | +| | *3 | 74HC04 | | | +| CN1 CN2 |-------| CN3 CN4 74HC02 74HC00 |-----| CN5| +|----------------------------------------------------------------------| +Notes: (All IC's listed for completeness) + 8095 - Intel C8095-90 16-Bit Microcontroller, Clock Input 12.000MHz (DIP48) + 4364 - NEC D4364CX-15L 8K x8 SRAM (DIP28) + 81416 - Fujitsu MB81416 16K x4 DRAM (DIP18) + PC910 - Sharp PC910 Opto-Isolator (DIP8) + IR3M03 - Sharp IR3M03A (DIP8) + 072D - New Japan Radio Co., Ltd JRC072D Dual J-FET Input Operational Amplifier (DIP8) + 5218 - Mitsubishi 5218 Operational Amplifier (DIP8) + M5238 - Mitsubishi M5238 LCD Display Controller (SIP8) + CN1 - 6 Pin Connector + CN2 - 6 Pin Connector + CN3 - 2 Pin Connector + CN4 - 3 Pin Connector + CN5 - 10 Pin Connector + SW1 - Power On/Off Switch + JK1 - 1/4" Stereo Jack + JK2 - 1/4" Stereo Jack + JK3 - MIDI In, MIDI Out and Midi Thru DIN5 Jacks + JK4 - Mini 1/8th" Power Input Jack + *1 - R15229865 HG61H15B59F (QFP80, stamped 'Roland') + *2 - R15229896 LA32 (QFP100, stamped 'Roland') + *3 - R15229863 HG61H20R36F (QFP100, stamped 'BOSS') + PCM54HP- Burr-Brown PCM54HP 16-Bit Monolithic Digital-to-Analog Converter (DIP28) + & Various logic ICs - 4051, 74HC27, 74HC00, 74HC02, 74HC04, 74LS05 + + ROMs - Filename Device Type + ---------------------------------------------------- + ROM.IC26 Hitachi HN623258PH26 read as 27C256 + ROM.IC27 Hitachi HN623258PH26 read as 27C256 + ROM.IC13 Hitachi HN623257PC21 read as 27C256 + ROM.IC37 Toshiba TC534000P read as TC574000 +*/ + +#include "emu.h" +#include "machine/ram.h" +#include "video/sed1200.h" +#include "cpu/mcs96/i8x9x.h" + +static INPUT_PORTS_START( mt32 ) + PORT_START("SC0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Sound group") PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Volume") PORT_CODE(KEYCODE_V) + PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("SC1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Rhythm") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Sound") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Master volume") PORT_CODE(KEYCODE_M) + PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("A7") + PORT_BIT(0x03ff, 0x0000, IPT_DIAL) PORT_NAME("Knob") PORT_SENSITIVITY(50) PORT_KEYDELTA(8) PORT_CODE_DEC(KEYCODE_DOWN) PORT_CODE_INC(KEYCODE_UP) +INPUT_PORTS_END + +class mt32_state : public driver_device +{ +public: + required_device cpu; + required_device ram; + optional_device lcd; + required_device midi_timer; + + mt32_state(const machine_config &mconfig, device_type type, const char *tag); + + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(mt32); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE8_MEMBER(bank_w); + DECLARE_WRITE8_MEMBER(so_w); + DECLARE_WRITE16_MEMBER(midi_w); + + DECLARE_READ8_MEMBER(lcd_ctrl_r); + DECLARE_WRITE8_MEMBER(lcd_ctrl_w); + DECLARE_WRITE8_MEMBER(lcd_data_w); + DECLARE_READ16_MEMBER(port0_r); + + TIMER_DEVICE_CALLBACK_MEMBER(midi_timer_cb); + TIMER_DEVICE_CALLBACK_MEMBER(samples_timer_cb); + +private: + UINT8 lcd_data_buffer[256]; + int lcd_data_buffer_pos; + UINT8 midi; + int midi_pos; + UINT8 port0; + required_device m_maincpu; +}; + +mt32_state::mt32_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + cpu(*this, "maincpu"), + ram(*this, "ram"), + lcd(*this, "lcd"), + midi_timer(*this, "midi_timer") +, + m_maincpu(*this, "maincpu") { +} + + +UINT32 mt32_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0); + const UINT8 *data = lcd->render(); + for(int c=0; c<20; c++) + for(int y=0; y<8; y++) { + UINT8 v = data[c*8+y]; + for(int x=0; x<5; x++) + bitmap.pix16(y == 7 ? 8 : y, c*6+x) = v & (0x10 >> x) ? 1 : 0; + } + return 0; +} + +void mt32_state::machine_start() +{ + membank("bank")->configure_entries(0, 4, memregion("maincpu")->base(), 0x4000); + membank("bank")->configure_entries(0x10, 2, ram->pointer(), 0x4000); // 0x10 doesn't seem used though, but that ram is accessible at c000+ + membank("fixed")->set_base(ram->pointer()); + + lcd_data_buffer_pos = 0; +} + +void mt32_state::machine_reset() +{ + midi_timer->adjust(attotime::from_hz(1)); + midi_pos = 0; + port0 = 0; +} + +WRITE8_MEMBER(mt32_state::lcd_ctrl_w) +{ + lcd->control_w(data); + for(int i=0; i != lcd_data_buffer_pos; i++) + lcd->data_w(lcd_data_buffer[i]); + lcd_data_buffer_pos = 0; +} + +READ8_MEMBER(mt32_state::lcd_ctrl_r) +{ + return lcd->control_r(); +} + +WRITE8_MEMBER(mt32_state::lcd_data_w) +{ + lcd_data_buffer[lcd_data_buffer_pos++] = data; +} + +WRITE8_MEMBER(mt32_state::bank_w) +{ + membank("bank")->set_entry(data); +} + +WRITE16_MEMBER(mt32_state::midi_w) +{ + logerror("midi_out %02x\n", data); + midi = data; +} + +TIMER_DEVICE_CALLBACK_MEMBER(mt32_state::midi_timer_cb) +{ + const static UINT8 midi_data[3] = { 0x91, 0x40, 0x7f }; + midi = midi_data[midi_pos++]; + logerror("midi_in %02x\n", midi); + cpu->serial_w(midi); + if(midi_pos < sizeof(midi_data)) + midi_timer->adjust(attotime::from_hz(1250)); +} + +READ16_MEMBER(mt32_state::port0_r) +{ + return port0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(mt32_state::samples_timer_cb) +{ + port0 ^= 0x10; +} + +WRITE8_MEMBER(mt32_state::so_w) +{ + // bit 0 = led + // bit 1-2 = reverb program a13/a14 + // bit 3-4 = nc + // bit 5 = boss x1 + // bit 6 = lcd cs, also handled internally by the gate array + // bit 7 = lcd clk, also handled internally by the gate array + // logerror("so: x1=%d bank=%d led=%d\n", (data >> 5) & 1, (data >> 1) & 3, data & 1); +} + +PALETTE_INIT_MEMBER(mt32_state, mt32) +{ + palette.set_pen_color(0, rgb_t(0, 0, 0)); + palette.set_pen_color(1, rgb_t(0, 255, 0)); +} + +static ADDRESS_MAP_START( mt32_map, AS_PROGRAM, 8, mt32_state ) + AM_RANGE(0x0100, 0x0100) AM_WRITE(bank_w) + AM_RANGE(0x0200, 0x0200) AM_WRITE(so_w) + AM_RANGE(0x021a, 0x021a) AM_READ_PORT("SC0") + AM_RANGE(0x021c, 0x021c) AM_READ_PORT("SC1") + AM_RANGE(0x0300, 0x0300) AM_WRITE(lcd_data_w) + AM_RANGE(0x0380, 0x0380) AM_READWRITE(lcd_ctrl_r, lcd_ctrl_w) + AM_RANGE(0x1000, 0x7fff) AM_ROM AM_REGION("maincpu", 0x1000) + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("fixed") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mt32_io, AS_IO, 16, mt32_state ) + AM_RANGE(i8x9x_device::A7, i8x9x_device::A7) AM_READ_PORT("A7") + AM_RANGE(i8x9x_device::SERIAL, i8x9x_device::SERIAL) AM_WRITE(midi_w) + AM_RANGE(i8x9x_device::P0, i8x9x_device::P0) AM_READ(port0_r) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( mt32, mt32_state ) + MCFG_CPU_ADD( "maincpu", P8098, XTAL_12MHz ) + MCFG_CPU_PROGRAM_MAP( mt32_map ) + MCFG_CPU_IO_MAP( mt32_io ) + + MCFG_RAM_ADD( "ram" ) + MCFG_RAM_DEFAULT_SIZE( "32K" ) + + MCFG_SCREEN_ADD( "screen", LCD ) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DRIVER(mt32_state, screen_update) +// MCFG_SCREEN_SIZE(20*6-1, 9) + MCFG_SCREEN_SIZE(20*6-1, (20*6-1)*3/4) + MCFG_SCREEN_VISIBLE_AREA(0, 20*6-2, 0, (20*6-1)*3/4-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(mt32_state, mt32) + + MCFG_SED1200D0A_ADD( "lcd" ) + + MCFG_TIMER_DRIVER_ADD( "midi_timer", mt32_state, midi_timer_cb ) + + MCFG_TIMER_DRIVER_ADD_PERIODIC( "samples_timer", mt32_state, samples_timer_cb, attotime::from_hz(32000*2) ) +MACHINE_CONFIG_END + +ROM_START( mt32 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_DEFAULT_BIOS( "107" ) + + ROM_SYSTEM_BIOS( 0, "104", "Firmware 1.0.4" ) + ROMX_LOAD( "mt32_1.0.4.ic27.bin", 0, 0x8000, CRC(a93b65f2) SHA1(9cd4858014c4e8a9dff96053f784bfaac1092a2e), ROM_BIOS(1)|ROM_SKIP(1) ) + ROMX_LOAD( "mt32_1.0.4.ic26.bin", 1, 0x8000, CRC(b5ee2192) SHA1(fe8db469b5bfeb37edb269fd47e3ce6d91014652), ROM_BIOS(1)|ROM_SKIP(1) ) + + ROM_SYSTEM_BIOS( 1, "105", "Firmware 1.0.5" ) + ROMX_LOAD( "mt32_1.0.5.ic27.bin", 0, 0x8000, CRC(3281216c) SHA1(57a09d80d2f7ca5b9734edbe9645e6e700f83701), ROM_BIOS(2)|ROM_SKIP(1) ) + ROMX_LOAD( "mt32_1.0.5.ic26.bin", 1, 0x8000, CRC(e06d8020) SHA1(52e3c6666db9ef962591a8ee99be0cde17f3a6b6), ROM_BIOS(2)|ROM_SKIP(1) ) + + ROM_SYSTEM_BIOS( 2, "106", "Firmware 1.0.6" ) + ROMX_LOAD( "mt32_1.0.6.ic27.bin", 0, 0x8000, CRC(29369ae1) SHA1(cc83bf23cee533097fb4c7e2c116e43b50ebacc8), ROM_BIOS(3)|ROM_SKIP(1) ) + ROMX_LOAD( "mt32_1.0.6.ic26.bin", 1, 0x8000, CRC(4d495d98) SHA1(bf4f15666bc46679579498386704893b630c1171), ROM_BIOS(3)|ROM_SKIP(1) ) + + ROM_SYSTEM_BIOS( 3, "107", "Firmware 1.0.7" ) + ROMX_LOAD( "mt32_1.0.7.ic27.bin", 0, 0x8000, CRC(67fd8968) SHA1(13f06b38f0d9e0fc050b6503ab777bb938603260), ROM_BIOS(4)|ROM_SKIP(1) ) + ROMX_LOAD( "mt32_1.0.7.ic26.bin", 1, 0x8000, CRC(60f45882) SHA1(c55e165487d71fa88bd8c5e9c083bc456c1a89aa), ROM_BIOS(4)|ROM_SKIP(1) ) + + ROM_SYSTEM_BIOS( 4, "br", "Blue Ridge enhanced firmware" ) + ROMX_LOAD( "blue_ridge__mt32b.bin", 1, 0x8000, CRC(5816476f) SHA1(e0934320d7cbb5edfaa29e0d01ae835ef620085b), ROM_BIOS(5)|ROM_SKIP(1) ) + ROMX_LOAD( "blue_ridge__mt32a.bin", 0, 0x8000, CRC(d75fc3d9) SHA1(11a6ae5d8b6ee328b371af7f1e40b82125aa6b4d), ROM_BIOS(5)|ROM_SKIP(1) ) + + ROM_SYSTEM_BIOS( 5, "m9", "M9 enhanced firmware" ) + ROMX_LOAD( "a__m-9.27c256.ic27.bin", 0, 0x8000, CRC(c078ab00) SHA1(381e4208c0211a9a24a3a1b06a36760a1940ea6b), ROM_BIOS(6)|ROM_SKIP(1) ) + ROMX_LOAD( "b__m-9.27c256.ic26.bin", 1, 0x8000, CRC(e9c439c4) SHA1(36fece02eddd84230a7cf32f931c94dd14adbf2c), ROM_BIOS(6)|ROM_SKIP(1) ) + +// We need a bios-like selection for these too + ROM_REGION( 0x80000, "la32", 0 ) + ROM_LOAD16_BYTE( "r15179844.ic21.bin", 0, 0x40000, CRC(dd9deac3) SHA1(3a1e19b0cd4036623fd1d1d11f5f25995585962b) ) + ROM_LOAD16_BYTE( "r15179845.ic22.bin", 1, 0x40000, CRC(4ee6506c) SHA1(2cadb99d21a6a4a6f5b61b6218d16e9b43f61d01) ) + + ROM_LOAD( "r15449121.ic37.bin", 0, 0x80000, CRC(573e31cc) SHA1(f6b1eebc4b2d200ec6d3d21d51325d5b48c60252) ) + + + ROM_REGION( 0x8000, "boss", 0 ) + ROM_LOAD( "r15179857.ic13.bin", 0, 0x8000, CRC(cb219d85) SHA1(c2933cb7ad86e51904aa1c3bc12fa234e73a337f) ) +ROM_END + +ROM_START( cm32l ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_DEFAULT_BIOS( "102" ) + + ROM_SYSTEM_BIOS( 0, "100", "Firmware 1.00" ) + ROMX_LOAD( "lapc-i.v1.0.0.ic3.bin", 0, 0x10000, CRC(ee62022f) SHA1(73683d585cd6948cc19547942ca0e14a0319456d), ROM_BIOS(1) ) + + ROM_SYSTEM_BIOS( 1, "102", "Firmware 1.02" ) + ROMX_LOAD( "cm32l_control.rom", 0, 0x10000, CRC(b998047e) SHA1(a439fbb390da38cada95a7cbb1d6ca199cd66ef8), ROM_BIOS(2) ) + + ROM_REGION( 0x100000, "la32", 0 ) +// We need a bios-like selection for these too + ROM_LOAD( "r15179945.ic8.bin", 0, 0x80000, CRC(8e9ea06e) SHA1(3ad889fde5db5b6437cbc2eb6e305312fec3df93) ) + ROM_LOAD( "r15449121.ic9.bin", 0x80000, 0x80000, CRC(0d81f53c) SHA1(7cc7bf1d1f27b6fc5fbb75c5d6a9458703275b28) ) + + ROM_LOAD( "cm32l_pcm.rom", 0, 0x100000, CRC(04204baa) SHA1(f2a10225b0c191a10fbf068f1320c91b35c1c3f2) ) + + ROM_REGION( 0x8000, "boss", 0 ) + ROM_LOAD( "r15179917.ic19.bin", 0, 0x8000, CRC(236c87a6) SHA1(e1c03905c46e962d1deb15eeed92eb61b42bba4a) ) +ROM_END + +CONS( 1987, mt32, 0, 0, mt32, mt32, driver_device, 0, "Roland", "MT32", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) +CONS( 1989, cm32l, 0, 0, mt32, mt32, driver_device, 0, "Roland", "CM32L", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/rsc55.c b/src/mame/drivers/rsc55.c new file mode 100644 index 00000000000..4d53cea0f17 --- /dev/null +++ b/src/mame/drivers/rsc55.c @@ -0,0 +1,83 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/************************************************************************************************* + + Roland Sound Canvas SC-55 + + Skeleton by R. Belmont + + Reference and LCD photo: http://www.synthman.com/roland/Roland_SC-55.html + http://en.wikipedia.org/wiki/Roland_SCC-1 + + The Roland SC55 is an expander (synthesizer without the keyboard) + from 1991. It has 24 voice polyphony, is 16 part multitimbral, and + outputs 16-bit stereo samples at 32 kHz. The synthesis engine uses a + combination of Roland's LA and straight PCM playback. + + The front panel includes the power switch, a headphone jack with volume knob, + a second MIDI IN port, a large LCD, ALL and MUTE buttons, and a group of up/down + buttons for Part, Level, Reverb, Key Shift, Instrument, Pan, Chorus, and MIDI Channel. + + The SCC-1 is an ISA board variant of the SC55 with a MPU-401 frontend added to + communicate with the synth. + + Main PCB: + + 20.0 MHz crystal + Roland R15239147 HG62E11B23FS 1L1 Japan + Roland R15199778 6435328A97F 1M1 R Japan + Roland R15239148 24201F002 9148EAI Japan + Roland R15209363 LH532H6D 9152 D + R15239176 BU3910F + HM62256ALFP-12T 32K by 8-bit RAM + 65256BLFP-12T 32K by 8-bit high-speed pseudo-static RAM + MB89251A - Serial data transceiver + + LCD controller (on front panel board) is a Toshiba T7934. +*/ + +#include "emu.h" +#include "machine/ram.h" +#include "cpu/mcs96/i8x9x.h" + +static INPUT_PORTS_START( sc55 ) +INPUT_PORTS_END + +class sc55_state : public driver_device +{ +public: + required_device m_maincpu; + + sc55_state(const machine_config &mconfig, device_type type, const char *tag); +}; + +sc55_state::sc55_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") +{ +} + +static ADDRESS_MAP_START( sc55_map, AS_PROGRAM, 8, sc55_state ) + AM_RANGE(0x1000, 0x3fff) AM_ROM AM_REGION("maincpu", 0x1000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sc55_io, AS_IO, 16, sc55_state ) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( sc55, sc55_state ) + MCFG_CPU_ADD( "maincpu", P8098, XTAL_20MHz ) // probably not? + MCFG_CPU_PROGRAM_MAP( sc55_map ) + MCFG_CPU_IO_MAP( sc55_io ) +MACHINE_CONFIG_END + +ROM_START( sc55 ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_LOAD( "roland_r15209363.ic23", 0x000000, 0x040000, CRC(2dc58549) SHA1(9c17f85e784dc1549ac1f98d457b353393331f6b) ) + + ROM_REGION( 0x300000, "la", 0 ) + ROM_LOAD( "roland-gss.a_r15209276.ic28", 0x000000, 0x100000, CRC(1ac774d3) SHA1(8cc3c0d7ec0993df81d4ca1970e01a4b0d8d3775) ) + ROM_LOAD( "roland-gss.b_r15209277.ic27", 0x100000, 0x100000, CRC(8dcc592a) SHA1(80e6eb130c18c09955551563f78906163c55cc11) ) + ROM_LOAD( "roland-gss.c_r15209281.ic26", 0x200000, 0x100000, CRC(e21ebc04) SHA1(7454b817778179806f3f9d1985b3a2ef67ace76f) ) +ROM_END + +CONS( 1991, sc55, 0, 0, sc55, sc55, driver_device, 0, "Roland", "Sound Canvas SC-55", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/rt1715.c b/src/mame/drivers/rt1715.c new file mode 100644 index 00000000000..30b2a2e43cb --- /dev/null +++ b/src/mame/drivers/rt1715.c @@ -0,0 +1,377 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Robotron PC-1715 + + 10/06/2008 Preliminary driver. + + + Notes: + + - keyboard connected to sio channel a + - sio channel a clock output connected to ctc trigger 0 + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/z80pio.h" +#include "machine/z80dma.h" +#include "machine/ram.h" +#include "video/i8275.h" + + +class rt1715_state : public driver_device +{ +public: + rt1715_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG) { } + + int m_led1_val; + int m_led2_val; + DECLARE_WRITE8_MEMBER(rt1715_floppy_enable); + DECLARE_READ8_MEMBER(k7658_led1_r); + DECLARE_READ8_MEMBER(k7658_led2_r); + DECLARE_READ8_MEMBER(k7658_data_r); + DECLARE_WRITE8_MEMBER(k7658_data_w); + DECLARE_WRITE8_MEMBER(rt1715_rom_disable); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(rt1715); + I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); + required_device m_maincpu; + required_device m_ram; +}; + + +/*************************************************************************** + FLOPPY +***************************************************************************/ + +WRITE8_MEMBER(rt1715_state::rt1715_floppy_enable) +{ + logerror("%s: rt1715_floppy_enable %02x\n", machine().describe_context(), data); +} + + +/*************************************************************************** + KEYBOARD +***************************************************************************/ + +/* si/so led */ +READ8_MEMBER(rt1715_state::k7658_led1_r) +{ + m_led1_val ^= 1; + logerror("%s: k7658_led1_r %02x\n", machine().describe_context(), m_led1_val); + return 0xff; +} + +/* caps led */ +READ8_MEMBER(rt1715_state::k7658_led2_r) +{ + m_led2_val ^= 1; + logerror("%s: k7658_led2_r %02x\n", machine().describe_context(), m_led2_val); + return 0xff; +} + +/* read key state */ +READ8_MEMBER(rt1715_state::k7658_data_r) +{ + UINT8 result = 0xff; + + if (BIT(offset, 0)) result &= ioport("row_00")->read(); + if (BIT(offset, 1)) result &= ioport("row_10")->read(); + if (BIT(offset, 2)) result &= ioport("row_20")->read(); + if (BIT(offset, 3)) result &= ioport("row_30")->read(); + if (BIT(offset, 4)) result &= ioport("row_40")->read(); + if (BIT(offset, 5)) result &= ioport("row_50")->read(); + if (BIT(offset, 6)) result &= ioport("row_60")->read(); + if (BIT(offset, 7)) result &= ioport("row_70")->read(); + if (BIT(offset, 8)) result &= ioport("row_08")->read(); + if (BIT(offset, 9)) result &= ioport("row_18")->read(); + if (BIT(offset, 10)) result &= ioport("row_28")->read(); + if (BIT(offset, 11)) result &= ioport("row_38")->read(); + if (BIT(offset, 12)) result &= ioport("row_48")->read(); + + return result; +} + +/* serial output on D0 */ +WRITE8_MEMBER(rt1715_state::k7658_data_w) +{ + logerror("%s: k7658_data_w %02x\n", machine().describe_context(), BIT(data, 0)); +} + + +/*************************************************************************** + MEMORY HANDLING +***************************************************************************/ + +void rt1715_state::machine_start() +{ + membank("bank2")->set_base(m_ram->pointer() + 0x0800); + membank("bank3")->set_base(m_ram->pointer()); +} + +void rt1715_state::machine_reset() +{ + /* on reset, enable ROM */ + membank("bank1")->set_base(memregion("ipl")->base()); +} + +WRITE8_MEMBER(rt1715_state::rt1715_rom_disable) +{ + logerror("%s: rt1715_set_bank %02x\n", machine().describe_context(), data); + + /* disable ROM, enable RAM */ + membank("bank1")->set_base(m_ram->pointer()); +} + +/*************************************************************************** + VIDEO EMULATION +***************************************************************************/ + +I8275_DRAW_CHARACTER_MEMBER( rt1715_state::crtc_display_pixels ) +{ +} + +/* F4 Character Displayer */ +static const gfx_layout rt1715_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*128, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8, 8*128*8, 9*128*8, 10*128*8, 11*128*8, 12*128*8, 13*128*8, 14*128*8, 15*128*8 }, + 8 /* every char takes 1 x 16 bytes */ +}; + +static GFXDECODE_START( rt1715 ) + GFXDECODE_ENTRY("gfx", 0x0000, rt1715_charlayout, 0, 1) + GFXDECODE_ENTRY("gfx", 0x0800, rt1715_charlayout, 0, 1) +GFXDECODE_END + + +/*************************************************************************** + PALETTE +***************************************************************************/ + +PALETTE_INIT_MEMBER(rt1715_state, rt1715) +{ + palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); /* black */ + palette.set_pen_color(1, rgb_t(0x00, 0x7f, 0x00)); /* low intensity */ + palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); /* high intensitiy */ +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( rt1715_mem, AS_PROGRAM, 8, rt1715_state ) + AM_RANGE(0x0000, 0x07ff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank3") + AM_RANGE(0x0800, 0xffff) AM_RAMBANK("bank2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( rt1715_io, AS_IO, 8, rt1715_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("a71", z80pio_device, read_alt, write_alt) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("a72", z80pio_device, read_alt, write_alt) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("a30", z80ctc_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("a29", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x18, 0x19) AM_DEVREADWRITE("a26", i8275_device, read, write) + AM_RANGE(0x20, 0x20) AM_WRITE(rt1715_floppy_enable) + AM_RANGE(0x28, 0x28) AM_WRITE(rt1715_rom_disable) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( k7658_mem, AS_PROGRAM, 8, rt1715_state ) + AM_RANGE(0x0000, 0xffff) AM_WRITE(k7658_data_w) + AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0xf800) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( k7658_io, AS_IO, 8, rt1715_state ) + AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x8000) AM_READ(k7658_led1_r) + AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x8000) AM_READ(k7658_led2_r) + AM_RANGE(0x8000, 0x9fff) AM_READ(k7658_data_r) +ADDRESS_MAP_END + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( k7658 ) + PORT_START("row_00") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_10") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_20") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_30") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_40") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_50") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_60") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_70") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_08") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_18") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_28") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_38") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_48") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +/* priority unknown */ +static const z80_daisy_config rt1715_daisy_chain[] = +{ + { "a71" }, + { "a72" }, + { "a30" }, + { "a29" }, + { NULL } +}; + +static MACHINE_CONFIG_START( rt1715, rt1715_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_2_4576MHz) + MCFG_CPU_PROGRAM_MAP(rt1715_mem) + MCFG_CPU_IO_MAP(rt1715_io) + MCFG_CPU_CONFIG(rt1715_daisy_chain) + + + /* keyboard */ + MCFG_CPU_ADD("keyboard", Z80, 683000) + MCFG_CPU_PROGRAM_MAP(k7658_mem) + MCFG_CPU_IO_MAP(k7658_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("a26", i8275_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(78*6, 30*10) + MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", rt1715) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(rt1715_state, rt1715) + + MCFG_DEVICE_ADD("a26", I8275, XTAL_2_4576MHz) + MCFG_I8275_CHARACTER_WIDTH(8) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(rt1715_state, crtc_display_pixels) + + MCFG_DEVICE_ADD("a30", Z80CTC, XTAL_10MHz/4 /* ? */) + + MCFG_Z80SIO0_ADD("a29", XTAL_10MHz/4 /* ? */, 0, 0, 0, 0) + + /* floppy */ + MCFG_DEVICE_ADD("a71", Z80PIO, XTAL_10MHz/4 /* ? */) + MCFG_DEVICE_ADD("a72", Z80PIO, XTAL_10MHz/4 /* ? */) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( rt1715w, rt1715 ) +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( rt1715 ) + ROM_REGION(0x0800, "ipl", 0) + ROM_LOAD("s500.a25.3", 0x0000, 0x0800, NO_DUMP) // CCITT 90e7 + ROM_LOAD("s501.a25.3", 0x0000, 0x0800, NO_DUMP) // CCITT 68da + ROM_LOAD("s502.a25.3", 0x0000, 0x0800, CRC(7b6302e1) SHA1(e8f61763ff8841078a1939aa5e85a17f2af42163)) + + ROM_REGION(0x1000, "gfx", 0) + ROM_LOAD("s619.a25.2", 0x0000, 0x0800, CRC(98647763) SHA1(93fba51ed26392ec3eff1037886576fa12443fe5)) + ROM_LOAD("s602.a25.1", 0x0800, 0x0800, NO_DUMP) // CCITT fd67 + + ROM_REGION(0x0800, "keyboard", 0) + ROM_LOAD("s600.ic8", 0x0000, 0x0800, CRC(b7070122) SHA1(687056b822086ef0eee1e9b27e5b031bdbcade61)) + + ROM_REGION(0x0800, "floppy", 0) + ROM_LOAD("068.a8.2", 0x0000, 0x0400, CRC(5306d57b) SHA1(a12d025717b039a8a760eb9961365402f1f501f5)) // "read rom" + ROM_LOAD("069.a8.1", 0x0400, 0x0400, CRC(319fa72c) SHA1(5f26af1e36339a934760a63e5975e9db09abeaaf)) // "write rom" +ROM_END + +ROM_START( rt1715lc ) + ROM_REGION(0x0800, "ipl", 0) + ROM_LOAD("s500.a25.3", 0x0000, 0x0800, NO_DUMP) // CCITT 90e7 + ROM_LOAD("s501.a25.3", 0x0000, 0x0800, NO_DUMP) // CCITT 68da + ROM_LOAD("s502.a25.3", 0x0000, 0x0800, CRC(7b6302e1) SHA1(e8f61763ff8841078a1939aa5e85a17f2af42163)) + + ROM_REGION(0x1000, "gfx", 0) + ROM_LOAD("s643.a25.2", 0x0000, 0x0800, CRC(ea37f0e6) SHA1(357760974d944b9782734504b9820771e7e37645)) + ROM_LOAD("s605.a25.1", 0x0800, 0x0800, CRC(38062024) SHA1(798f62d4adeb7098b7dcbfe6caf28302853ee97d)) + + ROM_REGION(0x0800, "keyboard", 0) + ROM_LOAD("s642.ic8", 0x0000, 0x0800, NO_DUMP) // CCITT 962e + + ROM_REGION(0x0800, "floppy", 0) + ROM_LOAD("068.a8.2", 0x0000, 0x0400, CRC(5306d57b) SHA1(a12d025717b039a8a760eb9961365402f1f501f5)) // "read rom" + ROM_LOAD("069.a8.1", 0x0400, 0x0400, CRC(319fa72c) SHA1(5f26af1e36339a934760a63e5975e9db09abeaaf)) // "write rom" +ROM_END + +ROM_START( rt1715w ) + ROM_REGION(0x0800, "ipl", 0) + ROM_LOAD("s550.bin", 0x0000, 0x0800, CRC(0a96c754) SHA1(4d9ad5b877353d91ba355044d2847e1d621e2b01)) + + // loaded from floppy on startup + ROM_REGION(0x1000, "gfx", ROMREGION_ERASEFF) + + ROM_REGION(0x0800, "keyboard", 0) + ROM_LOAD("s600.ic8", 0x0000, 0x0800, CRC(b7070122) SHA1(687056b822086ef0eee1e9b27e5b031bdbcade61)) + + ROM_REGION(0x0100, "prom", 0) + ROM_LOAD("287.bin", 0x0000, 0x0100, CRC(8508360c) SHA1(d262a8c3cf2d284c67f23b853e0d59ae5cc1d4c8)) // /CAS decoder prom, 74S287 +ROM_END + + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, rt1715, 0, 0, rt1715, k7658, driver_device, 0, "Robotron", "Robotron PC-1715", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1986, rt1715lc, rt1715, 0, rt1715, k7658, driver_device, 0, "Robotron", "Robotron PC-1715 (latin/cyrillic)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1986, rt1715w, rt1715, 0, rt1715w, k7658, driver_device, 0, "Robotron", "Robotron PC-1715W", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/rvoice.c b/src/mame/drivers/rvoice.c new file mode 100644 index 00000000000..a91fa959943 --- /dev/null +++ b/src/mame/drivers/rvoice.c @@ -0,0 +1,405 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu, Kevin Horton +/****************************************************************************** +* +* Bare bones Realvoice PC driver +* By Jonathan Gevaryahu AKA Lord Nightmare +* Binary supplied by Kevin 'kevtris' Horton +* + +******************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "machine/mos6551.h" +//#include "dectalk.lh" // hack to avoid screenless system crash +#include "machine/terminal.h" + +/* Defines */ + +#define TERMINAL_TAG "terminal" + +/* Components */ + +struct hd63701y0_t +{ + UINT8 data[8]; + UINT8 P1DDR; + UINT8 P2DDR; + UINT8 PORT1; + UINT8 PORT2; + UINT8 P3DDR; + UINT8 P4DDR; + UINT8 PORT3; + UINT8 PORT4; + UINT8 TCSR1; + UINT8 FRCH; + UINT8 FRCL; + UINT8 OCR1H; + UINT8 OCR1L; + UINT8 ICRH; + UINT8 ICRL; + UINT8 TCSR2; + UINT8 RMCR; + UINT8 TRCSR1; + UINT8 RDR; + UINT8 TDR; + UINT8 RP5CR; + UINT8 PORT5; + UINT8 P6DDR; + UINT8 PORT6; + UINT8 PORT7; + UINT8 OCR2H; + UINT8 OCR2L; + UINT8 TCSR3; + UINT8 TCONR; + UINT8 T2CNT; + UINT8 TRCSR2; + UINT8 TSTREG; + UINT8 P5DDR; + UINT8 P6CSR; +}; + +struct rvoicepc_t +{ + UINT8 data[8]; + UINT8 port1; + UINT8 port2; + UINT8 port3; + UINT8 port4; + UINT8 port5; + UINT8 port6; + UINT8 port7; +}; + +class rvoice_state : public driver_device +{ +public: + rvoice_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + hd63701y0_t m_hd63701y0; + rvoicepc_t m_rvoicepc; + DECLARE_READ8_MEMBER(main_hd63701_internal_registers_r); + DECLARE_WRITE8_MEMBER(main_hd63701_internal_registers_w); + DECLARE_DRIVER_INIT(rvoicepc); + virtual void machine_reset(); + DECLARE_WRITE8_MEMBER(null_kbd_put); + required_device m_maincpu; +}; + + +/* Devices */ + +DRIVER_INIT_MEMBER(rvoice_state,rvoicepc) +{ +} + +void rvoice_state::machine_reset() +{ + /* following is from datasheet at http://datasheets.chipdb.org/Hitachi/63701/HD63701Y0.pdf */ + m_hd63701y0.P1DDR = 0xFE; // port 1 ddr, W + m_hd63701y0.P2DDR = 0x00; // port 2 ddr, W + m_hd63701y0.PORT1 = 0x00; // port 1, R/W + m_hd63701y0.PORT2 = 0x00; // port 2, R/W + m_hd63701y0.P3DDR = 0xFE; // port 3 ddr, W + m_hd63701y0.P4DDR = 0x00; // port 4 ddr, W + m_hd63701y0.PORT3 = 0x00; // port 3, R/W + m_hd63701y0.PORT4 = 0x00; // port 4, R/W + m_hd63701y0.TCSR1 = 0x00; // timer control/status, R/W + m_hd63701y0.FRCH = 0x00; + m_hd63701y0.FRCL = 0x00; + m_hd63701y0.OCR1H = 0xFF; + m_hd63701y0.OCR1L = 0xFF; + m_hd63701y0.ICRH = 0x00; + m_hd63701y0.ICRL = 0x00; + m_hd63701y0.TCSR2 = 0x10; + m_hd63701y0.RMCR = 0xC0; + m_hd63701y0.TRCSR1 = 0x20; + m_hd63701y0.RDR = 0x00; // Receive Data Reg, R + m_hd63701y0.TDR = 0x00; // Transmit Data Reg, W + m_hd63701y0.RP5CR = 0x78; // or 0xF8; Ram/Port5 Control Reg, R/W + m_hd63701y0.PORT5 = 0x00; // port 5, R/W + m_hd63701y0.P6DDR = 0x00; // port 6 ddr, W + m_hd63701y0.PORT6 = 0x00; // port 6, R/W + m_hd63701y0.PORT7 = 0x00; // port 7, R/W + m_hd63701y0.OCR2H = 0xFF; + m_hd63701y0.OCR2L = 0xFF; + m_hd63701y0.TCSR3 = 0x20; + m_hd63701y0.TCONR = 0xFF; + m_hd63701y0.T2CNT = 0x00; + m_hd63701y0.TRCSR2 = 0x28; + m_hd63701y0.TSTREG = 0x00; + m_hd63701y0.P5DDR = 0x00; // port 5 ddr, W + m_hd63701y0.P6CSR = 0x00; +} + +READ8_MEMBER(rvoice_state::main_hd63701_internal_registers_r) +{ + UINT8 data = 0; + logerror("main hd637B01Y0: %04x: read from 0x%02X: ", space.device().safe_pc(), offset); + switch(offset) + { + case 0x00: // Port 1 DDR + case 0x01: // Port 2 DDR + case 0x04: // Port 3 DDR + case 0x05: // Port 4 DDR + case 0x13: // TxD Register + case 0x16: // Port 6 DDR + case 0x1C: // Time Constant Register + case 0x20: // Port 5 DDR + logerror("a write only register! returning 0\n"); + data = 0; + return data; + case 0x02: // Port 1 + logerror("Port 1\n"); + data = m_hd63701y0.PORT1; + break; + case 0x03: // Port 2 + logerror("Port 2\n"); + data = m_hd63701y0.PORT1; + break; + case 0x06: // Port 3 + logerror("Port 3\n"); + data = m_hd63701y0.PORT3; + break; + case 0x07: // Port 4 + logerror("Port 4\n"); + data = m_hd63701y0.PORT4; + break; + case 0x08: // Timer Control/Status Register 1 + logerror("Timer Control/Status Register 1\n"); + data = m_hd63701y0.TCSR1; + break; + case 0x09: // Free Running Counter (MSB) + logerror("Free Running Counter (MSB)\n"); + data = m_hd63701y0.FRCH; + break; + case 0x0A: // Free Running Counter (LSB) + logerror("Free Running Counter (LSB)\n"); + data = m_hd63701y0.FRCL; + break; + // B C (D E) + case 0x0F: // Timer Control/Status Register 2 + logerror("Timer Control/Status Register 2\n"); + data = m_hd63701y0.TCSR2; + break; + // 10 11 (12) + + case 0x14: // RAM/Port 5 Control Register + logerror("RAM/Port 5 Control Register\n"); + data = m_hd63701y0.RP5CR; + break; + case 0x15: // Port 5 + logerror("Port 5\n"); + data = m_hd63701y0.PORT5; + break; + case 0x17: // Port 6 + logerror("Port 6\n"); + data = m_hd63701y0.PORT6; + break; + case 0x18: // Port 7 + logerror("Port 7\n"); + data = m_hd63701y0.PORT7; + break; + // 19 1a 1b 1c 1d 1e 1f + case 0x21: // Port 6 Control/Status Register + logerror("Port 6 Control/Status Register\n"); + data = m_hd63701y0.P6CSR; + break; + default: + logerror("\n"); + data = 0; + break; + } + logerror("returning %02X\n", data); + return data; +} + + +WRITE8_MEMBER(rvoice_state::main_hd63701_internal_registers_w) +{ + logerror("main hd637B01Y0: %04x: write to 0x%02X: ", space.device().safe_pc(), offset); + switch(offset) + { + case 0x00: // Port 1 DDR + logerror("Port 1 DDR of %02X\n", data); + m_hd63701y0.P1DDR = data; + m_rvoicepc.port1 = (m_hd63701y0.PORT1 & m_hd63701y0.P1DDR); + break; + case 0x01: // Port 2 DDR + logerror("Port 2 DDR of %02X\n", data); + m_hd63701y0.P2DDR = data; + m_rvoicepc.port2 = (m_hd63701y0.PORT2 & m_hd63701y0.P2DDR); + break; + case 0x02: // Port 1 + logerror("Port 1 of %02X\n", data); + m_hd63701y0.PORT1 = data; + m_rvoicepc.port1 = (m_hd63701y0.PORT1 & m_hd63701y0.P1DDR); + break; + case 0x03: // Port 2 + logerror("Port 2 of %02X\n", data); + m_hd63701y0.PORT2 = data; + m_rvoicepc.port2 = (m_hd63701y0.PORT2 & m_hd63701y0.P2DDR); + break; + case 0x04: // Port 3 DDR + logerror("Port 3 DDR of %02X\n", data); + m_hd63701y0.P3DDR = data; + m_rvoicepc.port3 = (m_hd63701y0.PORT3 & m_hd63701y0.P3DDR); + break; + case 0x05: // Port 4 DDR + logerror("Port 4 DDR of %02X\n", data); + m_hd63701y0.P4DDR = data; + m_rvoicepc.port4 = (m_hd63701y0.PORT4 & m_hd63701y0.P4DDR); + break; + case 0x06: // Port 3 + logerror("Port 3 of %02X\n", data); + m_hd63701y0.PORT3 = data; + m_rvoicepc.port3 = (m_hd63701y0.PORT3 & m_hd63701y0.P3DDR); + break; + case 0x07: // Port 4 + logerror("Port 4 of %02X\n", data); + m_hd63701y0.PORT4 = data; + m_rvoicepc.port4 = (m_hd63701y0.PORT4 & m_hd63701y0.P4DDR); + break; + case 0x08: // Timer Control/Status Register 1 + logerror("Timer Control/Status Register 1 of %02X\n", data); + m_hd63701y0.TCSR1 = data; + break; + case 0x09: // Free Running Counter (MSB) + logerror("Free Running Counter (MSB) of %02X\n", data); + m_hd63701y0.FRCH = data; + break; + case 0x0A: // Free Running Counter (LSB) + logerror("Free Running Counter (LSB) of %02X\n", data); + m_hd63701y0.FRCL = data; + break; + // B C (D E) + case 0x0F: // Timer Control/Status Register 2 + logerror("Timer Control/Status Register 2 of %02X\n", data); + m_hd63701y0.TCSR2 = data; + break; + // 10 11 (12) + case 0x13: // TxD Register + logerror("TxD Register of %02X\n", data); + m_hd63701y0.TDR = data; + break; + case 0x14: // RAM/Port 5 Control Register + logerror("RAM/Port 5 Control Register of %02X\n", data); + m_hd63701y0.RP5CR = data; + break; + case 0x15: // Port 5 + logerror("Port 5 of %02X\n", data); + m_hd63701y0.PORT5 = data; + m_rvoicepc.port5 = (m_hd63701y0.PORT5 & m_hd63701y0.P5DDR); + break; + case 0x16: // Port 6 DDR + logerror("Port 6 DDR of %02X\n", data); + m_hd63701y0.P6DDR = data; + m_rvoicepc.port6 = (m_hd63701y0.PORT6 & m_hd63701y0.P6DDR); + break; + case 0x17: // Port 6 + logerror("Port 6 of %02X\n", data); + m_hd63701y0.PORT6 = data; + m_rvoicepc.port6 = (m_hd63701y0.PORT6 & m_hd63701y0.P6DDR); + break; + case 0x18: // Port 7 + logerror("Port 7 of %02X\n", data); + m_hd63701y0.PORT7 = data; + m_rvoicepc.port7 = data; + break; + // 19 1a 1b 1c 1d 1e 1f + case 0x20: // Port 5 DDR + logerror("Port 5 DDR of %02X\n", data); + m_hd63701y0.P5DDR = data; + m_rvoicepc.port5 = (m_hd63701y0.PORT5 & m_hd63701y0.P5DDR); + break; + case 0x21: // Port 6 Control/Status Register + logerror("Port 6 Control/Status Register of %02X\n", data); + m_hd63701y0.P6CSR = data; + break; + default: + logerror("with data of %02X\n", data); + break; + } +} + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(hd63701_main_mem, AS_PROGRAM, 8, rvoice_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0027) AM_READWRITE(main_hd63701_internal_registers_r, main_hd63701_internal_registers_w) // INTERNAL REGS + AM_RANGE(0x0040, 0x013f) AM_RAM // INTERNAL RAM (overlaps acia) + AM_RANGE(0x0060, 0x007f) AM_DEVREADWRITE("acia65c51", mos6551_device, read, write) // ACIA 65C51 + AM_RANGE(0x2000, 0x7fff) AM_RAM // EXTERNAL SRAM + AM_RANGE(0x8000, 0xffff) AM_ROM // 27512 EPROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(hd63701_main_io, AS_IO, 8, rvoice_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + + +/****************************************************************************** + Input Ports +******************************************************************************/ +static INPUT_PORTS_START( rvoicepc ) +INPUT_PORTS_END + +/****************************************************************************** + Machine Drivers +******************************************************************************/ +WRITE8_MEMBER(rvoice_state::null_kbd_put) +{ +} + +static MACHINE_CONFIG_START( rvoicepc, rvoice_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", HD63701, XTAL_7_3728MHz) + MCFG_CPU_PROGRAM_MAP(hd63701_main_mem) + MCFG_CPU_IO_MAP(hd63701_main_io) + + //MCFG_CPU_ADD("playercpu", HD63701, XTAL_7_3728MHz) // not dumped yet + //MCFG_CPU_PROGRAM_MAP(hd63701_slave_mem) + //MCFG_CPU_IO_MAP(hd63701_slave_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("acia65c51", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + + /* video hardware */ + //MCFG_DEFAULT_LAYOUT(layout_dectalk) // hack to avoid screenless system crash + + /* sound hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(rvoice_state, null_kbd_put)) + +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START(rvoicepc) + + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("rv_pc.bin", 0x08000, 0x08000, CRC(4001cd5f) SHA1(d973c6e19e493eedd4f7216bc530ddb0b6c4921e)) + ROM_CONTINUE(0x8000, 0x8000) // first half of 27c512 rom is blank due to stupid address decoder circuit + +ROM_END + + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1988?, rvoicepc, 0, 0, rvoicepc, rvoicepc, rvoice_state, rvoicepc, "Adaptive Communication Systems", "Realvoice PC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/rx78.c b/src/mame/drivers/rx78.c new file mode 100644 index 00000000000..be2f20e388b --- /dev/null +++ b/src/mame/drivers/rx78.c @@ -0,0 +1,513 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese, Robbbert +/************************************************************************************************************ + + Gundam RX-78 (c) 1983 Bandai + + driver by Angelo Salese & Robbbert. + + TODO: + - implement printer + + Notes: + - BS-BASIC v1.0 have a graphic bug with the RX-78 logo, it doesn't set the read bank so all of the color + info minus plane 1 is lost when the screen scrolls vertically. Almost certainly a btanb. + - To stop a cmt load, press STOP + SHIFT keys + +============================================================================================================== + Summary of Monitor commands. + - The monitor is entered at bootup. The prompt is the * character. This is followed by a command + letter (upper case). Some commands require hex parameters. You must enter all 4 characters of + these. No spaces allowed except where shown. + - While in BASIC, you may enter the monitor by using the MON command. After you have finished, + you can return to BASIC by entering the command *J2005. + + - Tape commands: + *L Load a tape + *V Verify a tape + *S Save a block of memory to tape. You are asked for a filename (blank is allowed), the start address, + the end address, and the Jump address (where it should begin execution) + + - Memory commands: + *Dnnnn nnnn Displays a hex dump in the address range entered + *Mnnnn Allows you to examine and modify memory. Enter to skip to next, period (.) to quit. + *Jnnnn Transfer execution (Jump) to a program in memory at the specified address + + - Other: + *R This is a block transfer load from a mystery parallel device, using ports E0 and E1, + using handshaking similar to a centronics printer. The incoming file is loaded into + memory and it appears that the operator is not provided any information of what happened. + +*************************************************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/sn76496.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "machine/ram.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class rx78_state : public driver_device +{ +public: + rx78_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cass(*this, "cassette"), + m_cart(*this, "cartslot"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette") + { } + + DECLARE_READ8_MEMBER( key_r ); + DECLARE_READ8_MEMBER( rx78_f0_r ); + DECLARE_READ8_MEMBER( rx78_vram_r ); + DECLARE_WRITE8_MEMBER( rx78_f0_w ); + DECLARE_WRITE8_MEMBER( rx78_vram_w ); + DECLARE_WRITE8_MEMBER( vram_read_bank_w ); + DECLARE_WRITE8_MEMBER( vram_write_bank_w ); + DECLARE_WRITE8_MEMBER( key_w ); + DECLARE_WRITE8_MEMBER( vdp_reg_w ); + DECLARE_WRITE8_MEMBER( vdp_bg_reg_w ); + DECLARE_WRITE8_MEMBER( vdp_pri_mask_w ); + UINT8 m_vram_read_bank; + UINT8 m_vram_write_bank; + UINT8 m_pal_reg[7]; + UINT8 m_pri_mask; + UINT8 m_key_mux; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_DRIVER_INIT(rx78); + required_device m_maincpu; + required_device m_cass; + required_device m_cart; + required_device m_ram; + required_device m_palette; + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( rx78_cart ); +}; + + +#define MASTER_CLOCK XTAL_28_63636MHz + + +WRITE8_MEMBER( rx78_state::rx78_f0_w ) +{ + m_cass->output(BIT(data, 0) ? -1.0 : +1.0); +} + +READ8_MEMBER( rx78_state::rx78_f0_r ) +{ + return (m_cass->input() > 0.03); +} + + +void rx78_state::video_start() +{ +} + +UINT32 rx78_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *vram = memregion("vram")->base(); + int x,y,count; + + bitmap.fill(16, cliprect); + + count = 0x2c0; //first 0x2bf bytes aren't used for bitmap drawing apparently + + for(y=0;y<184;y++) + { + for(x=0;x<192;x+=8) + { + int color,pen[3],i; + + for (i = 0; i < 8; i++) + { + /* bg color */ + pen[0] = (m_pri_mask & 0x08) ? (vram[count + 0x6000] >> (i)) : 0x00; + pen[1] = (m_pri_mask & 0x10) ? (vram[count + 0x8000] >> (i)) : 0x00; + pen[2] = (m_pri_mask & 0x20) ? (vram[count + 0xa000] >> (i)) : 0x00; + + color = ((pen[0] & 1) << 0); + color |= ((pen[1] & 1) << 1); + color |= ((pen[2] & 1) << 2); + + if(color) + bitmap.pix16(y, x+i) = color; + + /* fg color */ + pen[0] = (m_pri_mask & 0x01) ? (vram[count + 0x0000] >> (i)) : 0x00; + pen[1] = (m_pri_mask & 0x02) ? (vram[count + 0x2000] >> (i)) : 0x00; + pen[2] = (m_pri_mask & 0x04) ? (vram[count + 0x4000] >> (i)) : 0x00; + + color = ((pen[0] & 1) << 0); + color |= ((pen[1] & 1) << 1); + color |= ((pen[2] & 1) << 2); + + if(color) + bitmap.pix16(y, x+i) = color; + } + count++; + } + } + + return 0; +} + + +READ8_MEMBER( rx78_state::key_r ) +{ + static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", + "KEY4", "KEY5", "KEY6", "KEY7", + "KEY8", "JOY1P_0","JOY1P_1","JOY1P_2", + "JOY2P_0", "JOY2P_1", "JOY2P_2", "UNUSED" }; + + if(m_key_mux == 0x30) //status read + { + int res,i; + + res = 0; + for(i=0;i<15;i++) + res |= ioport(keynames[i])->read(); + + return res; + } + + if(m_key_mux >= 1 && m_key_mux <= 15) + return ioport(keynames[m_key_mux - 1])->read(); + + return 0; +} + +WRITE8_MEMBER( rx78_state::key_w ) +{ + m_key_mux = data; +} + +READ8_MEMBER( rx78_state::rx78_vram_r ) +{ + UINT8 *vram = memregion("vram")->base(); + + if(m_vram_read_bank == 0 || m_vram_read_bank > 6) + return 0xff; + + return vram[offset + ((m_vram_read_bank - 1) * 0x2000)]; +} + +WRITE8_MEMBER( rx78_state::rx78_vram_w ) +{ + UINT8 *vram = memregion("vram")->base(); + + if(m_vram_write_bank & 0x01) { vram[offset + 0 * 0x2000] = data; } + if(m_vram_write_bank & 0x02) { vram[offset + 1 * 0x2000] = data; } + if(m_vram_write_bank & 0x04) { vram[offset + 2 * 0x2000] = data; } + if(m_vram_write_bank & 0x08) { vram[offset + 3 * 0x2000] = data; } + if(m_vram_write_bank & 0x10) { vram[offset + 4 * 0x2000] = data; } + if(m_vram_write_bank & 0x20) { vram[offset + 5 * 0x2000] = data; } +} + +WRITE8_MEMBER( rx78_state::vram_read_bank_w ) +{ + m_vram_read_bank = data; +} + +WRITE8_MEMBER( rx78_state::vram_write_bank_w ) +{ + m_vram_write_bank = data; +} + +WRITE8_MEMBER( rx78_state::vdp_reg_w ) +{ + UINT8 r,g,b,res,i; + + m_pal_reg[offset] = data; + + for(i=0;i<16;i++) + { + res = ((i & 1) ? m_pal_reg[0 + (i & 8 ? 3 : 0)] : 0) | ((i & 2) ? m_pal_reg[1 + (i & 8 ? 3 : 0)] : 0) | ((i & 4) ? m_pal_reg[2 + (i & 8 ? 3 : 0)] : 0); + if(res & m_pal_reg[6]) //color mask, TODO: check this + res &= m_pal_reg[6]; + + r = (res & 0x11) == 0x11 ? 0xff : ((res & 0x11) == 0x01 ? 0x7f : 0x00); + g = (res & 0x22) == 0x22 ? 0xff : ((res & 0x22) == 0x02 ? 0x7f : 0x00); + b = (res & 0x44) == 0x44 ? 0xff : ((res & 0x44) == 0x04 ? 0x7f : 0x00); + + m_palette->set_pen_color(i, rgb_t(r,g,b)); + } +} + +WRITE8_MEMBER( rx78_state::vdp_bg_reg_w ) +{ + int r,g,b; + + r = (data & 0x11) == 0x11 ? 0xff : ((data & 0x11) == 0x01 ? 0x7f : 0x00); + g = (data & 0x22) == 0x22 ? 0xff : ((data & 0x22) == 0x02 ? 0x7f : 0x00); + b = (data & 0x44) == 0x44 ? 0xff : ((data & 0x44) == 0x04 ? 0x7f : 0x00); + + m_palette->set_pen_color(0x10, rgb_t(r,g,b)); +} + +WRITE8_MEMBER( rx78_state::vdp_pri_mask_w ) +{ + m_pri_mask = data; +} + + +static ADDRESS_MAP_START(rx78_mem, AS_PROGRAM, 8, rx78_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM + //AM_RANGE(0x2000, 0x5fff) // mapped by the cartslot + AM_RANGE(0x6000, 0xafff) AM_RAM //ext RAM + AM_RANGE(0xb000, 0xebff) AM_RAM + AM_RANGE(0xec00, 0xffff) AM_READWRITE(rx78_vram_r, rx78_vram_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(rx78_io, AS_IO, 8, rx78_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +// AM_RANGE(0xe2, 0xe2) AM_READNOP AM_WRITENOP //printer +// AM_RANGE(0xe3, 0xe3) AM_WRITENOP //printer + AM_RANGE(0xf0, 0xf0) AM_READWRITE(rx78_f0_r,rx78_f0_w) //cmt + AM_RANGE(0xf1, 0xf1) AM_WRITE(vram_read_bank_w) + AM_RANGE(0xf2, 0xf2) AM_WRITE(vram_write_bank_w) + AM_RANGE(0xf4, 0xf4) AM_READWRITE(key_r,key_w) //keyboard + AM_RANGE(0xf5, 0xfb) AM_WRITE(vdp_reg_w) //vdp + AM_RANGE(0xfc, 0xfc) AM_WRITE(vdp_bg_reg_w) //vdp + AM_RANGE(0xfe, 0xfe) AM_WRITE(vdp_pri_mask_w) + AM_RANGE(0xff, 0xff) AM_DEVWRITE("sn1", sn76489a_device, write) //psg +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( rx78 ) + PORT_START("KEY0") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("KEY1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("KEY2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + + PORT_START("KEY3") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("KEY4") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + + PORT_START("KEY5") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up Down Arrow") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right Left Arrow") PORT_CODE(KEYCODE_PGDN) + + PORT_START("KEY6") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME / CLR") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_UNUSED ) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INST / DEL") PORT_CODE(KEYCODE_BACKSPACE) + + PORT_START("KEY7") + PORT_BIT(0x07,IP_ACTIVE_HIGH,IPT_UNUSED ) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_UNUSED ) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_UNUSED ) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + + PORT_START("KEY8") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) //kana shift? + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED ) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0xf8,IP_ACTIVE_HIGH,IPT_UNUSED ) + + PORT_START("JOY1P_0") + PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Up Left") PORT_PLAYER(1) + PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) + + PORT_START("JOY1P_1") + PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Down Left") PORT_PLAYER(1) + PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Up Right") PORT_PLAYER(1) + PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("JOY1P_2") + PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Down Right") PORT_PLAYER(1) + PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) + + PORT_START("JOY2P_0") + PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Up Left") PORT_PLAYER(2) + PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) + + PORT_START("JOY2P_1") + PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Down Left") PORT_PLAYER(2) + PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Up Right") PORT_PLAYER(2) + PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("JOY2P_2") + PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Down Right") PORT_PLAYER(2) + PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) + + PORT_START("UNUSED") + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +void rx78_state::machine_reset() +{ + address_space &prg = m_maincpu->space(AS_PROGRAM); + if (m_cart->exists()) + prg.install_read_handler(0x2000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +DEVICE_IMAGE_LOAD_MEMBER( rx78_state, rx78_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size != 0x2000 && size != 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +/* F4 Character Displayer */ +static const gfx_layout rx78_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 187, /* 187 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( rx78 ) + GFXDECODE_ENTRY( "maincpu", 0x1a27, rx78_charlayout, 0, 8 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( rx78, rx78_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, MASTER_CLOCK/7) // unknown divider + MCFG_CPU_PROGRAM_MAP(rx78_mem) + MCFG_CPU_IO_MAP(rx78_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", rx78_state, irq0_line_hold) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(rx78_state, screen_update) + MCFG_SCREEN_SIZE(192, 184) + MCFG_SCREEN_VISIBLE_AREA(0, 192-1, 0, 184-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16+1) //+1 for the background color + MCFG_GFXDECODE_ADD("gfxdecode", "palette", rx78) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "rx78_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(rx78_state, rx78_cart) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32k") + MCFG_RAM_EXTRA_OPTIONS("16k") + + MCFG_CASSETTE_ADD( "cassette" ) + + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_ADD("sn1", SN76489A, XTAL_28_63636MHz/8) // unknown divider + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","rx78") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( rx78 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(a194ea53) SHA1(ba39e73e6eb7cbb8906fff1f81a98964cd62af0d)) + + ROM_REGION( 6 * 0x2000, "vram", ROMREGION_ERASE00 ) +ROM_END + +DRIVER_INIT_MEMBER(rx78_state,rx78) +{ + UINT32 ram_size = m_ram->size(); + address_space &prg = m_maincpu->space(AS_PROGRAM); + + if (ram_size == 0x4000) + prg.unmap_readwrite(0x6000, 0xafff); +} + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, rx78, 0, 0, rx78, rx78, rx78_state, rx78, "Bandai", "Gundam RX-78", 0) diff --git a/src/mame/drivers/sacstate.c b/src/mame/drivers/sacstate.c new file mode 100644 index 00000000000..ac86d563934 --- /dev/null +++ b/src/mame/drivers/sacstate.c @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + SacState 8008 + + 23/02/2009 Skeleton driver. + +http://www.digibarn.com/stories/bill-pentz-story/index.html + +The year is listed as '1972/73'. + +All input to be in lowercase. +The weird characters that show on screen are various escape sequences. +These are different depending on the terminal type chosen. The codes +need to be understood and emulated before this system makes sense. + +Known Monitor commands: (from the disassembly) +! write buffer to AD000 +* set RAM036 flag ++ increment AD000 by 1 ++n increment AD000 by n +- decrement AD000 by 1 +-n decrement AD000 by n +: clear RAM036 flag += display AD000 +=nnn set AD000 to nnn +@ fill buffer with 026 + +unknown commands: / & d e l r s t u z \ ^ | ~ + +Other input will either result in '!' message, or halt. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8008/i8008.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class sacstate_state : public driver_device +{ +public: + sacstate_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(port00_r); + DECLARE_READ8_MEMBER(port01_r); + DECLARE_READ8_MEMBER(port04_r); + DECLARE_WRITE8_MEMBER(port08_w); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_term_data; + UINT8 m_val; + virtual void machine_reset(); +}; + +READ8_MEMBER( sacstate_state::port01_r ) +{ + UINT8 ret = m_val; + if (m_term_data) + ret |= 0x04; // data in + return ret; +} + +READ8_MEMBER( sacstate_state::port00_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( sacstate_state::port04_r ) +{ + logerror("unknown_r\n"); + return 0; +} + +WRITE8_MEMBER( sacstate_state::port08_w ) +{ + if (data == 0x40) + m_val = 0x40; + else + if (data == 0x04) + m_val = 0; +} + +static ADDRESS_MAP_START(sacstate_mem, AS_PROGRAM, 8, sacstate_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000,0x7ff) AM_ROM + AM_RANGE(0x800,0xfff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sacstate_io, AS_IO, 8, sacstate_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00,0x00) AM_READ(port00_r) + AM_RANGE(0x01,0x01) AM_READ(port01_r) + AM_RANGE(0x04,0x04) AM_READ(port04_r) + AM_RANGE(0x08,0x08) AM_WRITE(port08_w) + AM_RANGE(0x16,0x16) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x17,0x1f) AM_WRITENOP +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sacstate ) + PORT_START("CONFIG") + PORT_CONFNAME( 0x08, 0x08, "Terminal Type") // no idea of actual terminal types + PORT_CONFSETTING( 0x00, "A") + PORT_CONFSETTING( 0x08, "B") +INPUT_PORTS_END + +WRITE8_MEMBER( sacstate_state::kbd_put ) +{ + m_term_data = data; +} + +void sacstate_state::machine_reset() +{ + m_term_data = 0; + m_val = ioport("CONFIG")->read(); +} + +static MACHINE_CONFIG_START( sacstate, sacstate_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8008, 800000) + MCFG_CPU_PROGRAM_MAP(sacstate_mem) + MCFG_CPU_IO_MAP(sacstate_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(sacstate_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sacstate ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "sacst1.bin", 0x0700, 0x0100, CRC(ba020160) SHA1(6337cdf65583808768664653c937e50040aec6d4)) + ROM_LOAD( "sacst2.bin", 0x0600, 0x0100, CRC(26f3e505) SHA1(3526060dbd1bf885c2e686bc9a6082387630952a)) + ROM_LOAD( "sacst3.bin", 0x0500, 0x0100, CRC(965b3474) SHA1(6d9142e68d375fb000fd6ea48369d0801274ded6)) + ROM_LOAD( "sacst4.bin", 0x0400, 0x0100, CRC(3cd3e169) SHA1(75a99e8e4dbd6e054209a4979bb498f37e962697)) + ROM_LOAD( "sacst5.bin", 0x0300, 0x0100, CRC(30619454) SHA1(cb498880bec27c9adc44dc1267858555000452c6)) + ROM_LOAD( "sacst6.bin", 0x0200, 0x0100, CRC(a4cd2ff6) SHA1(3f4da5510c0778eb770c96c01f91f5cb7f5285fa)) + ROM_LOAD( "sacst7.bin", 0x0100, 0x0100, CRC(33971d8b) SHA1(9e0bbeef6a6a15107f270e8b285300284ee7f63f)) + ROM_LOAD( "sacst8.bin", 0x0000, 0x0100, CRC(931252ef) SHA1(e06ea6947f432f0a4ce944de74978d929920fb53)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1973, sacstate, 0, 0, sacstate, sacstate, driver_device, 0, "SacState", "SacState 8008", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/sage2.c b/src/mame/drivers/sage2.c new file mode 100644 index 00000000000..6ba6993a153 --- /dev/null +++ b/src/mame/drivers/sage2.c @@ -0,0 +1,569 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Sage II + + For memory map look at : + http://www.thebattles.net/sage/img/SDT.pdf (pages 14-) + + + 06/12/2009 Skeleton driver. + +****************************************************************************/ + +/* + + TODO: + + - floppy loading + - TMS9914 IEEE-488 controller + - board 2 (4x 2651 USART) + - Winchester controller + +*/ + +#include "includes/sage2.h" +#include "bus/rs232/rs232.h" + + +//************************************************************************** +// MEMORY MANAGEMENT UNIT +//************************************************************************** + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( sage2_state::read ) +{ + UINT8 data = 0xff; + + if (m_reset || (offset >= 0xfe0000 && offset < 0xff4000)) + { + data = m_rom[offset & 0x1fff]; + } + else if (offset < 0x080000) + { + data = m_ram->pointer()[offset]; + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( sage2_state::write ) +{ + if (offset < 0x080000) + { + m_ram->pointer()[offset] = data; + } +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( sage2_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( sage2_mem, AS_PROGRAM, 16, sage2_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0xfeffff) AM_READWRITE8(read, write, 0xffff) + AM_RANGE(0xffc000, 0xffc007) AM_DEVREADWRITE8(I8253_1_TAG, pit8253_device, read, write, 0x00ff) + AM_RANGE(0xffc010, 0xffc01f) AM_NOP //AM_DEVREADWRITE8(TMS9914_TAG, tms9914_device, read, write, 0x00ff) + AM_RANGE(0xffc020, 0xffc027) AM_DEVREADWRITE8(I8255A_0_TAG, i8255_device, read, write, 0x00ff) // i8255, DIPs + Floppy ctrl port + AM_RANGE(0xffc030, 0xffc031) AM_DEVREADWRITE8(I8251_1_TAG, i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xffc032, 0xffc033) AM_DEVREADWRITE8(I8251_1_TAG, i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0xffc040, 0xffc043) AM_DEVREADWRITE8(I8259_TAG, pic8259_device, read, write, 0x00ff) + AM_RANGE(0xffc050, 0xffc053) AM_DEVICE8(UPD765_TAG, upd765a_device, map, 0x00ff) + AM_RANGE(0xffc060, 0xffc067) AM_DEVREADWRITE8(I8255A_1_TAG, i8255_device, read, write, 0x00ff) // i8255, Printer + AM_RANGE(0xffc070, 0xffc071) AM_DEVREADWRITE8(I8251_0_TAG, i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xffc072, 0xffc073) AM_DEVREADWRITE8(I8251_0_TAG, i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0xffc080, 0xffc087) AM_MIRROR(0x78) AM_DEVREADWRITE8(I8253_0_TAG, pit8253_device, read, write, 0x00ff) +// AM_RANGE(0xffc400, 0xffc407) AM_DEVREADWRITE8(S2651_0_TAG, s2651_device, read, write, 0x00ff) +// AM_RANGE(0xffc440, 0xffc447) AM_DEVREADWRITE8(S2651_1_TAG, s2651_device, read, write, 0x00ff) +// AM_RANGE(0xffc480, 0xffc487) AM_DEVREADWRITE8(S2651_2_TAG, s2651_device, read, write, 0x00ff) +// AM_RANGE(0xffc4c0, 0xffc4c7) AM_DEVREADWRITE8(S2651_3_TAG, s2651_device, read, write, 0x00ff) +// AM_RANGE(0xffc500, 0xffc7ff) // Winchester drive ports +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( sage2 ) +//------------------------------------------------- + +static INPUT_PORTS_START( sage2 ) + PORT_START("J7") + PORT_DIPNAME( 0x07, 0x07, "Terminal Baud Rate" ) PORT_DIPLOCATION("J7:1,2,3") + PORT_DIPSETTING( 0x07, "19200" ) + PORT_DIPSETTING( 0x06, "9600" ) + PORT_DIPSETTING( 0x05, "4800" ) + PORT_DIPSETTING( 0x04, "2400" ) + PORT_DIPSETTING( 0x03, "1200" ) + PORT_DIPSETTING( 0x02, "600" ) + PORT_DIPSETTING( 0x01, "300" ) + PORT_DIPSETTING( 0x00, "Reserved (19200)" ) + PORT_DIPNAME( 0x08, 0x08, "Parity Control" ) PORT_DIPLOCATION("J7:4") + PORT_DIPSETTING( 0x08, "Even Parity" ) + PORT_DIPSETTING( 0x00, "Disabled" ) + PORT_DIPNAME( 0x30, 0x20, "Boot Device" ) PORT_DIPLOCATION("J7:5,6") + PORT_DIPSETTING( 0x30, "Debugger" ) + PORT_DIPSETTING( 0x20, "Floppy Drive 0" ) + PORT_DIPSETTING( 0x10, "Winchester" ) + PORT_DIPSETTING( 0x00, "Reserved (Debugger)" ) + PORT_DIPNAME( 0x40, 0x40, "Floppy Configuration" ) PORT_DIPLOCATION("J7:7") + PORT_DIPSETTING( 0x40, "96 TPI" ) + PORT_DIPSETTING( 0x00, "48 TPI" ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Service_Mode ) ) PORT_DIPLOCATION("J7:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("J6") + PORT_DIPNAME( 0x1f, 0x07, "IEEE-488 Bus Address" ) PORT_DIPLOCATION("J6:1,2,3,4,5") + PORT_DIPSETTING( 0x00, "0" ) + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x05, "5" ) + PORT_DIPSETTING( 0x06, "6" ) + PORT_DIPSETTING( 0x07, "7" ) + PORT_DIPSETTING( 0x08, "8" ) + PORT_DIPSETTING( 0x09, "9" ) + PORT_DIPSETTING( 0x0a, "10" ) + PORT_DIPSETTING( 0x0b, "11" ) + PORT_DIPSETTING( 0x0c, "12" ) + PORT_DIPSETTING( 0x0d, "13" ) + PORT_DIPSETTING( 0x0e, "14" ) + PORT_DIPSETTING( 0x0f, "15" ) + PORT_DIPSETTING( 0x10, "16" ) + PORT_DIPSETTING( 0x11, "17" ) + PORT_DIPSETTING( 0x12, "18" ) + PORT_DIPSETTING( 0x13, "19" ) + PORT_DIPSETTING( 0x14, "20" ) + PORT_DIPSETTING( 0x15, "21" ) + PORT_DIPSETTING( 0x16, "22" ) + PORT_DIPSETTING( 0x17, "23" ) + PORT_DIPSETTING( 0x18, "24" ) + PORT_DIPSETTING( 0x19, "25" ) + PORT_DIPSETTING( 0x1a, "26" ) + PORT_DIPSETTING( 0x1b, "27" ) + PORT_DIPSETTING( 0x1c, "28" ) + PORT_DIPSETTING( 0x1d, "29" ) + PORT_DIPSETTING( 0x1e, "30" ) + PORT_DIPSETTING( 0x1f, "31" ) + PORT_DIPNAME( 0x20, 0x00, "IEEE-488 TALK" ) PORT_DIPLOCATION("J6:6") + PORT_DIPSETTING( 0x00, "Disabled" ) + PORT_DIPSETTING( 0x20, "Enabled" ) + PORT_DIPNAME( 0x40, 0x00, "IEEE-488 LISTEN" ) PORT_DIPLOCATION("J6:7") + PORT_DIPSETTING( 0x00, "Disabled" ) + PORT_DIPSETTING( 0x40, "Enabled" ) + PORT_DIPNAME( 0x80, 0x00, "IEEE-488 Consecutive Addresses" ) PORT_DIPLOCATION("J6:8") + PORT_DIPSETTING( 0x00, "1" ) + PORT_DIPSETTING( 0x80, "2" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// I8255A INTERFACE( ppi0_intf ) +//------------------------------------------------- + +/* + + IR0 U74 OUT2 + IR1 RX2I+ + IR2 TX1I+ + IR3 TX2I+ + IR4 MI- + IR5 CNI+ + IR6 U74 OUT0 + IR7 SI+ + +*/ + + +//------------------------------------------------- +// I8255A INTERFACE( ppi0_intf ) +//------------------------------------------------- + +WRITE8_MEMBER( sage2_state::ppi0_pc_w ) +{ + /* + + bit signal + + PC0 TC+ + PC1 RDY+ + PC2 FDIE+ + PC3 SL0- + PC4 SL1- + PC5 MOT- + PC6 PCRMP- + PC7 FRES+ + + */ + + // floppy terminal count + m_fdc->tc_w(BIT(data, 0)); + + // floppy ready + m_fdc->ready_w(BIT(data, 1)); + + // floppy interrupt enable + m_fdie = BIT(data, 2); + update_fdc_int(); + + // drive select + m_floppy = NULL; + + if (!BIT(data, 3)) m_floppy = m_floppy0->get_device(); + if (!BIT(data, 4)) m_floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(m_floppy); + + // floppy motor + if (m_floppy) m_floppy->mon_w(BIT(data, 5)); + + // FDC reset + if(BIT(data, 7)) m_fdc->reset(); +} + + +//------------------------------------------------- +// I8255A INTERFACE( ppi1_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER(sage2_state::write_centronics_ack) +{ + if (!state) + { + m_pic->ir5_w(ASSERT_LINE); + } +} + +WRITE_LINE_MEMBER(sage2_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER(sage2_state::write_centronics_perror) +{ + m_centronics_perror = state; +} + +WRITE_LINE_MEMBER(sage2_state::write_centronics_select) +{ + m_centronics_select = state; +} + +WRITE_LINE_MEMBER(sage2_state::write_centronics_fault) +{ + m_centronics_fault = state; +} + +READ8_MEMBER( sage2_state::ppi1_pb_r ) +{ + /* + + bit signal + + PB0 FDI+ + PB1 WP+ + PB2 RG- + PB3 CD- + PB4 BUSY + PB5 PAPER + PB6 SEL + PB7 FAULT- + + */ + + UINT8 data = 0; + + // floppy interrupt + data = m_fdc->get_irq(); + + // floppy write protected + data = (m_floppy ? m_floppy->wpt_r() : 1) << 1; + + // RS-232 ring indicator + + // RS-232 carrier detect + + // centronics + data |= m_centronics_busy << 4; + data |= m_centronics_perror << 5; + data |= m_centronics_select << 6; + data |= m_centronics_fault << 7; + + return data; +} + +WRITE8_MEMBER( sage2_state::ppi1_pc_w ) +{ + /* + + bit signal + + PC0 PRES- + PC1 U8 SC+ + PC2 SI+ + PC3 LEDR+ + PC4 STROBE- + PC5 PRIME- + PC6 U38 CL- + PC7 RMI- + + */ + + if (!BIT(data, 0)) + { + // clear parity error interrupt + m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); + } + + // s? interrupt + m_pic->ir7_w(BIT(data, 2)); + + // processor LED + output_set_led_value(0, BIT(data, 3)); + + // centronics + m_centronics->write_strobe(BIT(data, 4)); + m_centronics->write_init(BIT(data, 5)); + + if (!BIT(data, 6)) + { + // clear ACK interrupt + m_pic->ir5_w(CLEAR_LINE); + } + + if (!BIT(data, 7)) + { + // clear modem interrupt + m_pic->ir4_w(CLEAR_LINE); + } +} + +WRITE_LINE_MEMBER( sage2_state::br1_w ) +{ + m_usart0->write_txc(state); + m_usart0->write_rxc(state); +} + +WRITE_LINE_MEMBER( sage2_state::br2_w ) +{ + m_usart1->write_txc(state); + m_usart1->write_rxc(state); +} + +//------------------------------------------------- +// upd765_interface fdc_intf +//------------------------------------------------- + +static SLOT_INTERFACE_START( sage2_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Mitsubishi M4859 +SLOT_INTERFACE_END + +void sage2_state::update_fdc_int() +{ + m_maincpu->set_input_line(M68K_IRQ_6, m_fdie && m_fdc_int); +} + +WRITE_LINE_MEMBER( sage2_state::fdc_irq ) +{ + m_fdc_int = state; + update_fdc_int(); +} + + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_19200 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_19200 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( sage2 ) +//------------------------------------------------- + +void sage2_state::machine_start() +{ + // find memory regions + m_rom = memregion(M68000_TAG)->base(); +} + + +void sage2_state::machine_reset() +{ + m_reset = 1; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( sage2 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( sage2, sage2_state ) + // basic machine hardware + MCFG_CPU_ADD(M68000_TAG, M68000, XTAL_16MHz/2) + MCFG_CPU_PROGRAM_MAP(sage2_mem) + + // devices + MCFG_PIC8259_ADD(I8259_TAG, INPUTLINE(M68000_TAG, M68K_IRQ_1), VCC, NULL) + + MCFG_DEVICE_ADD(I8255A_0_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(IOPORT("J7")) + MCFG_I8255_IN_PORTB_CB(IOPORT("J6")) + MCFG_I8255_OUT_PORTC_CB(WRITE8(sage2_state, ppi0_pc_w)) + + MCFG_DEVICE_ADD(I8255A_1_TAG, I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_IN_PORTB_CB(READ8(sage2_state, ppi1_pb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(sage2_state, ppi1_pc_w)) + + MCFG_DEVICE_ADD(I8253_0_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(0) // from U75 OUT0 + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir6_w)) + MCFG_PIT8253_CLK1(XTAL_16MHz/2/125) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE(I8253_0_TAG, pit8253_device, write_clk2)) + MCFG_PIT8253_CLK2(0) // from OUT2 + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir0_w)) + + MCFG_DEVICE_ADD(I8253_1_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_16MHz/2/125) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8253_0_TAG, pit8253_device, write_clk0)) + MCFG_PIT8253_CLK1(XTAL_16MHz/2/13) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(sage2_state, br1_w)) + MCFG_PIT8253_CLK2(XTAL_16MHz/2/13) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(sage2_state, br2_w)) + + MCFG_DEVICE_ADD(I8251_0_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(M68000_TAG, m68000_base_device, write_irq5)) + MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir2_w)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_0_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_0_TAG, i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_DEVICE_ADD(I8251_1_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir1_w)) + MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir3_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_1_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_1_TAG, i8251_device, write_dsr)) + + MCFG_UPD765A_ADD(UPD765_TAG, false, false) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(sage2_state, fdc_irq)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(sage2_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(sage2_state, write_centronics_busy)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(sage2_state, write_centronics_perror)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(sage2_state, write_centronics_select)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(sage2_state, write_centronics_fault)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", sage2_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", sage2_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_IEEE488_BUS_ADD() + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "sage2") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( sage2 ) +//------------------------------------------------- + +ROM_START( sage2 ) + ROM_REGION( 0x2000, M68000_TAG, 0 ) + ROM_LOAD16_BYTE( "sage2.u18", 0x0000, 0x1000, CRC(ca9b312d) SHA1(99436a6d166aa5280c3b2d28355c4d20528fe48c) ) + ROM_LOAD16_BYTE( "sage2.u17", 0x0001, 0x1000, CRC(27e25045) SHA1(041cd9d4617473d089f31f18cbb375046c3b61bb) ) +ROM_END + + + +//************************************************************************** +// DRIVER INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// DRIVER_INIT( sage2 ) +//------------------------------------------------- + +DIRECT_UPDATE_MEMBER(sage2_state::sage2_direct_update_handler) +{ + if (m_reset && address >= 0xfe0000) + { + m_reset = 0; + } + + return address; +} + +DRIVER_INIT_MEMBER(sage2_state,sage2) +{ + address_space &program = machine().device(M68000_TAG)->space(AS_PROGRAM); + program.set_direct_update_handler(direct_update_delegate(FUNC(sage2_state::sage2_direct_update_handler), this)); +} + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1982, sage2, 0, 0, sage2, sage2, sage2_state, sage2, "Sage Technology", "Sage II", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/samcoupe.c b/src/mame/drivers/samcoupe.c new file mode 100644 index 00000000000..e6262e1d0ff --- /dev/null +++ b/src/mame/drivers/samcoupe.c @@ -0,0 +1,620 @@ +// license:GPL-2.0+ +// copyright-holders:Lee Hammerton, Dirk Best +/*************************************************************************** + + Miles Gordon Technology SAM Coupe + + Notes: + ------ + + Beware - the early ROMs are very buggy, and tend to go mad once BASIC + starts paging. ROM 10 (version 1.0) requires the CALL after F9 or BOOT + because the ROM loads the bootstrap but fails to execute it. The address + depends on the RAM size: + + On a 256K SAM: CALL 229385 + Or on a 512K (or larger) machine: CALL 491529 + + + Todo: + ----- + + - Attribute read + - Better timing + - Harddisk interfaces + +***************************************************************************/ + +/* core includes */ +#include "emu.h" +#include "includes/samcoupe.h" +# +/* components */ +#include "cpu/z80/z80.h" +#include "sound/saa1099.h" + +/* devices */ +#include "formats/tzx_cas.h" +#include "formats/coupedsk.h" + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define SAMCOUPE_XTAL_X1 XTAL_24MHz +#define SAMCOUPE_XTAL_X2 XTAL_4_433619MHz + + +/*************************************************************************** + TIMERS +***************************************************************************/ + +void samcoupe_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_IRQ_OFF: + irq_off(ptr, param); + break; + case TIMER_MOUSE_RESET: + samcoupe_mouse_reset(ptr, param); + break; + case TIMER_VIDEO_UPDATE: + sam_video_update_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in samcoupe_state::device_timer"); + } +} + +/*************************************************************************** + I/O PORTS +***************************************************************************/ + +READ8_MEMBER(samcoupe_state::samcoupe_disk_r) +{ + /* drive and side is encoded into bit 5 and 3 */ + floppy_connector *con = (BIT(offset, 4) ? m_wd1772_1 : m_wd1772_0); + floppy_image_device *floppy = con ? con->get_device() : 0; + + if(floppy) + floppy->ss_w(BIT(offset, 2)); + m_fdc->set_floppy(floppy); + + /* bit 1 and 2 select the controller register */ + switch (offset & 0x03) + { + case 0: return m_fdc->status_r(); + case 1: return m_fdc->track_r(); + case 2: return m_fdc->sector_r(); + case 3: return m_fdc->data_r(); + } + + return 0xff; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_disk_w) +{ + /* drive and side is encoded into bit 5 and 3 */ + floppy_connector *con = (BIT(offset, 4) ? m_wd1772_1 : m_wd1772_0); + floppy_image_device *floppy = con ? con->get_device() : 0; + + if(floppy) + floppy->ss_w(BIT(offset, 2)); + m_fdc->set_floppy(floppy); + + /* bit 1 and 2 select the controller register */ + switch (offset & 0x03) + { + case 0: m_fdc->cmd_w(data); break; + case 1: m_fdc->track_w(data); break; + case 2: m_fdc->sector_w(data); break; + case 3: m_fdc->data_w(data); break; + } +} + +READ8_MEMBER(samcoupe_state::samcoupe_pen_r) +{ + screen_device *scr = machine().first_screen(); + UINT8 data; + + if (offset & 0x100) + { + int vpos = scr->vpos(); + + /* return the current screen line or 192 for the border area */ + if (vpos < SAM_BORDER_TOP || vpos >= SAM_BORDER_TOP + SAM_SCREEN_HEIGHT) + data = 192; + else + data = vpos - SAM_BORDER_TOP; + } + else + { + /* horizontal position is encoded into bits 3 to 8 */ + data = scr->hpos() & 0xfc; + } + + return data; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_clut_w) +{ + m_clut[(offset >> 8) & 0x0f] = data & 0x7f; +} + +READ8_MEMBER(samcoupe_state::samcoupe_status_r) +{ + UINT8 data = 0xe0; + + /* bit 5-7, keyboard input */ + if (!BIT(offset, 8)) data &= m_keyboard_row_fe->read() & 0xe0; + if (!BIT(offset, 9)) data &= m_keyboard_row_fd->read() & 0xe0; + if (!BIT(offset, 10)) data &= m_keyboard_row_fb->read() & 0xe0; + if (!BIT(offset, 11)) data &= m_keyboard_row_f7->read() & 0xe0; + if (!BIT(offset, 12)) data &= m_keyboard_row_ef->read() & 0xe0; + if (!BIT(offset, 13)) data &= m_keyboard_row_df->read() & 0xe0; + if (!BIT(offset, 14)) data &= m_keyboard_row_bf->read() & 0xe0; + if (!BIT(offset, 15)) data &= m_keyboard_row_7f->read() & 0xe0; + + /* bit 0-4, interrupt source */ + data |= m_status; + + return data; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_line_int_w) +{ + m_line_int = data; +} + +READ8_MEMBER(samcoupe_state::samcoupe_lmpr_r) +{ + return m_lmpr; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_lmpr_w) +{ + address_space &space_program = m_maincpu->space(AS_PROGRAM); + + m_lmpr = data; + samcoupe_update_memory(space_program); +} + +READ8_MEMBER(samcoupe_state::samcoupe_hmpr_r) +{ + return m_hmpr; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_hmpr_w) +{ + address_space &space_program = m_maincpu->space(AS_PROGRAM); + + m_hmpr = data; + samcoupe_update_memory(space_program); +} + +READ8_MEMBER(samcoupe_state::samcoupe_vmpr_r) +{ + return m_vmpr; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_vmpr_w) +{ + address_space &space_program = m_maincpu->space(AS_PROGRAM); + + m_vmpr = data; + samcoupe_update_memory(space_program); +} + +READ8_MEMBER(samcoupe_state::samcoupe_midi_r) +{ + logerror("%s: read from midi port\n", machine().describe_context()); + return 0xff; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_midi_w) +{ + logerror("%s: write to midi port: 0x%02x\n", machine().describe_context(), data); +} + +READ8_MEMBER(samcoupe_state::samcoupe_keyboard_r) +{ + UINT8 data = 0x1f; + + /* bit 0-4, keyboard input */ + if (!BIT(offset, 8)) data &= m_keyboard_row_fe->read() & 0x1f; + if (!BIT(offset, 9)) data &= m_keyboard_row_fd->read() & 0x1f; + if (!BIT(offset, 10)) data &= m_keyboard_row_fb->read() & 0x1f; + if (!BIT(offset, 11)) data &= m_keyboard_row_f7->read() & 0x1f; + if (!BIT(offset, 12)) data &= m_keyboard_row_ef->read() & 0x1f; + if (!BIT(offset, 13)) data &= m_keyboard_row_df->read() & 0x1f; + if (!BIT(offset, 14)) data &= m_keyboard_row_bf->read() & 0x1f; + if (!BIT(offset, 15)) data &= m_keyboard_row_7f->read() & 0x1f; + + if (offset == 0xff00) + { + data &= m_keyboard_row_ff->read() & 0x1f; + + /* if no key has been pressed, return the mouse state */ + if (data == 0x1f) + data = samcoupe_mouse_r(); + } + + /* bit 5, lightpen strobe */ + data |= 1 << 5; + + /* bit 6, cassette input */ + data |= (m_cassette->input() > 0 ? 1 : 0) << 6; + + /* bit 7, external memory */ + data |= 1 << 7; + + return data; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_border_w) +{ + m_border = data; + + /* bit 3, cassette output */ + m_cassette->output( BIT(data, 3) ? -1.0 : +1.0); + + /* bit 4, beep */ + m_speaker->level_w(BIT(data, 4)); +} + +READ8_MEMBER(samcoupe_state::samcoupe_attributes_r) +{ + return m_attribute; +} + +WRITE_LINE_MEMBER(samcoupe_state::write_lpt1_busy) +{ + m_lpt1_busy = state; +} + +READ8_MEMBER(samcoupe_state::samcoupe_lpt1_busy_r) +{ + return m_lpt1_busy; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_lpt1_strobe_w) +{ + m_lpt1->write_strobe(data & 1); +} + +DECLARE_WRITE_LINE_MEMBER(samcoupe_state::write_lpt2_busy) +{ + m_lpt2_busy = state; +} + +READ8_MEMBER(samcoupe_state::samcoupe_lpt2_busy_r) +{ + return m_lpt2_busy; +} + +WRITE8_MEMBER(samcoupe_state::samcoupe_lpt2_strobe_w) +{ + m_lpt2->write_strobe(data & 1); +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( samcoupe_mem, AS_PROGRAM, 8, samcoupe_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAM AM_READWRITE(sam_bank1_r, sam_bank1_w) // AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAM AM_READWRITE(sam_bank2_r, sam_bank2_w) // AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_RAM AM_READWRITE(sam_bank3_r, sam_bank3_w) // AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAM AM_READWRITE(sam_bank4_r, sam_bank4_w) // AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( samcoupe_io, AS_IO, 8, samcoupe_state ) + AM_RANGE(0x0080, 0x0081) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_WRITE(samcoupe_ext_mem_w) + AM_RANGE(0x00e0, 0x00e7) AM_MIRROR(0xff10) AM_MASK(0xffff) AM_READWRITE(samcoupe_disk_r, samcoupe_disk_w) + AM_RANGE(0x00e8, 0x00e8) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVWRITE("lpt1_data_out", output_latch_device, write) + AM_RANGE(0x00e9, 0x00e9) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lpt1_busy_r, samcoupe_lpt1_strobe_w) + AM_RANGE(0x00ea, 0x00ea) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVWRITE("lpt2_data_out", output_latch_device, write) + AM_RANGE(0x00eb, 0x00eb) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lpt2_busy_r, samcoupe_lpt2_strobe_w) + AM_RANGE(0x00f8, 0x00f8) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_pen_r, samcoupe_clut_w) + AM_RANGE(0x00f9, 0x00f9) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_status_r, samcoupe_line_int_w) + AM_RANGE(0x00fa, 0x00fa) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lmpr_r, samcoupe_lmpr_w) + AM_RANGE(0x00fb, 0x00fb) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_hmpr_r, samcoupe_hmpr_w) + AM_RANGE(0x00fc, 0x00fc) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_vmpr_r, samcoupe_vmpr_w) + AM_RANGE(0x00fd, 0x00fd) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_midi_r, samcoupe_midi_w) + AM_RANGE(0x00fe, 0x00fe) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_keyboard_r, samcoupe_border_w) + AM_RANGE(0x00ff, 0x00ff) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READ(samcoupe_attributes_r) + AM_RANGE(0x00ff, 0x00ff) AM_MIRROR(0xfe00) AM_MASK(0xffff) AM_DEVWRITE("saa1099", saa1099_device, data_w) + AM_RANGE(0x01ff, 0x01ff) AM_MIRROR(0xfe00) AM_MASK(0xffff) AM_DEVWRITE("saa1099", saa1099_device, control_w) +ADDRESS_MAP_END + + +/*************************************************************************** + INTERRUPTS +***************************************************************************/ + +TIMER_CALLBACK_MEMBER(samcoupe_state::irq_off) +{ + /* adjust STATUS register */ + m_status |= param; + + /* clear interrupt */ + if ((m_status & 0x1f) == 0x1f) + m_maincpu->set_input_line(0, CLEAR_LINE); + +} + +void samcoupe_state::samcoupe_irq(UINT8 src) +{ + /* assert irq and a timer to set it off again */ + m_maincpu->set_input_line(0, ASSERT_LINE); + timer_set(attotime::from_usec(20), TIMER_IRQ_OFF, src); + + /* adjust STATUS register */ + m_status &= ~src; +} + +INTERRUPT_GEN_MEMBER(samcoupe_state::samcoupe_frame_interrupt) +{ + /* signal frame interrupt */ + samcoupe_irq(SAM_FRAME_INT); +} + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( samcoupe ) + PORT_START("keyboard_row_fe") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('?') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("keyboard_row_fd") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("keyboard_row_fb") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR('<') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('[') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(']') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("keyboard_row_f7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + + PORT_START("keyboard_row_ef") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('~') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('/') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_START("keyboard_row_df") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('=') PORT_CHAR('_') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('"') PORT_CHAR('\xa9') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(F10)) + + PORT_START("keyboard_row_bf") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('\xa3') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR('^') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EDIT") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("keyboard_row_7f") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SYMBOL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INV") PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR('\\') + + PORT_START("keyboard_row_ff") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("mouse_buttons") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_CODE(MOUSECODE_BUTTON3) PORT_NAME("Mouse Button 3") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 2") + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("mouse_x") + PORT_BIT(0xfff, 0x000, IPT_MOUSE_X) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_REVERSE + + PORT_START("mouse_y") + PORT_BIT(0xfff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) + + PORT_START("config") + PORT_CONFNAME(0x01, 0x00, "Real Time Clock") + PORT_CONFSETTING( 0x00, DEF_STR(None)) + PORT_CONFSETTING( 0x01, "SAMBUS") +INPUT_PORTS_END + + +/*************************************************************************** + PALETTE +***************************************************************************/ + +/* + Decode colours for the palette as follows: + + bit 7 6 5 4 3 2 1 0 + nothing G+4 R+4 B+4 ALL+1 G+2 R+2 B+2 + +*/ +PALETTE_INIT_MEMBER(samcoupe_state, samcoupe) +{ + for (int i = 0; i < 128; i++) + { + UINT8 b = BIT(i, 0) * 2 + BIT(i, 4) * 4 + BIT(i, 3); + UINT8 r = BIT(i, 1) * 2 + BIT(i, 5) * 4 + BIT(i, 3); + UINT8 g = BIT(i, 2) * 2 + BIT(i, 6) * 4 + BIT(i, 3); + + r <<= 5; + g <<= 5; + b <<= 5; + + palette.set_pen_color(i, rgb_t(r, g, b)); + } + + palette.palette()->normalize_range(0, 127); +} + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +FLOPPY_FORMATS_MEMBER( samcoupe_state::floppy_formats ) + FLOPPY_MGT_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( samcoupe_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( samcoupe, samcoupe_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, SAMCOUPE_XTAL_X1 / 4) /* 6 MHz */ + MCFG_CPU_PROGRAM_MAP(samcoupe_mem) + MCFG_CPU_IO_MAP(samcoupe_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", samcoupe_state, samcoupe_frame_interrupt) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(SAMCOUPE_XTAL_X1/2, SAM_TOTAL_WIDTH, 0, SAM_BORDER_LEFT + SAM_SCREEN_WIDTH + SAM_BORDER_RIGHT, SAM_TOTAL_HEIGHT, 0, SAM_BORDER_TOP + SAM_SCREEN_HEIGHT + SAM_BORDER_BOTTOM) + MCFG_SCREEN_UPDATE_DRIVER(samcoupe_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 128) + MCFG_PALETTE_INIT_OWNER(samcoupe_state, samcoupe) + + /* devices */ + MCFG_CENTRONICS_ADD("lpt1", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(samcoupe_state, write_lpt1_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("lpt1_data_out", "lpt1") + + MCFG_CENTRONICS_ADD("lpt2", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(samcoupe_state, write_lpt2_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("lpt2_data_out", "lpt2") + + MCFG_DEVICE_ADD("sambus_clock", MSM6242, XTAL_32_768kHz) + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(tzx_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("samcoupe_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","samcoupe_cass") + + MCFG_WD1772_ADD("wd1772", SAMCOUPE_XTAL_X1/3) + MCFG_FLOPPY_DRIVE_ADD("wd1772:0", samcoupe_floppies, "35dd", samcoupe_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1772:1", samcoupe_floppies, "35dd", samcoupe_state::floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","samcoupe_flop") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SAA1099_ADD("saa1099", SAMCOUPE_XTAL_X1/3) /* 8 MHz */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_EXTRA_OPTIONS("256K,1280K,1536K,2304K,2560K,3328K,3584K,4352K,4608K") +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +/* + The bios is actually 32K. This is the combined version of the two old 16K MESS roms. + It does match the 3.0 one the most, but the first half differs in one byte + and in the second half, the case of the "plc" in the company string differs. +*/ +ROM_START( samcoupe ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "31", "v3.1" ) + ROMX_LOAD( "rom31.z5", 0x0000, 0x8000, CRC(0b7e3585) SHA1(c86601633fb61a8c517f7657aad9af4e6870f2ee), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "30", "v3.0" ) + ROMX_LOAD( "rom30.z5", 0x0000, 0x8000, CRC(e535c25d) SHA1(d390f0be420dfb12b1e54a4f528b5055d7d97e2a), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "25", "v2.5" ) + ROMX_LOAD( "rom25.z5", 0x0000, 0x8000, CRC(ddadd358) SHA1(a25ed85a0f1134ac3a481a3225f24a8bd3a790cf), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "24", "v2.4" ) + ROMX_LOAD( "rom24.z5", 0x0000, 0x8000, CRC(bb23fee4) SHA1(10cd911ba237dd2cf0c2637be1ad6745b7cc89b9), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "21", "v2.1" ) + ROMX_LOAD( "rom21.z5", 0x0000, 0x8000, CRC(f6804b46) SHA1(11dcac5fdea782cdac03b4d0d7ac25d88547eefe), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "20", "v2.0" ) + ROMX_LOAD( "rom20.z5", 0x0000, 0x8000, CRC(eaf32054) SHA1(41736323f0236649f2d5fe111f900def8db93a13), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 6, "181", "v1.81" ) + ROMX_LOAD( "rom181.z5", 0x0000, 0x8000, CRC(d25e1de1) SHA1(cb0fa79e4d5f7df0b57ede08ea7ecc9ae152f534), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS( 7, "18", "v1.8" ) + ROMX_LOAD( "rom18.z5", 0x0000, 0x8000, CRC(f626063f) SHA1(485e7d9e9a4f8a70c0f93cd6e69ff12269438829), ROM_BIOS(8) ) + ROM_SYSTEM_BIOS( 8, "14", "v1.4" ) + ROMX_LOAD( "rom14.z5", 0x0000, 0x8000, CRC(08799596) SHA1(b4e596051f2748dee9481ea4af7d15ccddc1e1b5), ROM_BIOS(9) ) + ROM_SYSTEM_BIOS( 9, "13", "v1.3" ) + ROMX_LOAD( "rom13.z5", 0x0000, 0x8000, CRC(2093768c) SHA1(af8d348fd080b18a4cbe9ed69d254be7be330146), ROM_BIOS(10) ) + ROM_SYSTEM_BIOS( 10, "12", "v1.2" ) + ROMX_LOAD( "rom12.z5", 0x0000, 0x8000, CRC(7fe37dd8) SHA1(9339a0c1f72e8512c6f32dec15ab7d6c3bb04151), ROM_BIOS(11) ) + ROM_SYSTEM_BIOS( 11, "10", "v1.0" ) + ROMX_LOAD( "rom10.z5", 0x0000, 0x8000, CRC(3659d31f) SHA1(d3de7bb74e04d5b4dc7477f70de54d540b1bcc07), ROM_BIOS(12) ) + ROM_SYSTEM_BIOS( 12, "04", "v0.4" ) + ROMX_LOAD( "rom04.z5", 0x0000, 0x8000, CRC(f439e84e) SHA1(8bc457a5c764b0bb0aa7008c57f28c30248fc6a4), ROM_BIOS(13) ) + ROM_SYSTEM_BIOS( 13, "01", "v0.1" ) + ROMX_LOAD( "rom01.z5", 0x0000, 0x8000, CRC(c04acfdf) SHA1(8976ed005c14905eec1215f0a5c28aa686a7dda2), ROM_BIOS(14) ) +ROM_END + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, samcoupe, 0, 0, samcoupe, samcoupe, driver_device, 0, "Miles Gordon Technology plc", "SAM Coupe", 0 ) diff --git a/src/mame/drivers/sapi1.c b/src/mame/drivers/sapi1.c new file mode 100644 index 00000000000..732baca6c3e --- /dev/null +++ b/src/mame/drivers/sapi1.c @@ -0,0 +1,671 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + SAPI-1 driver by Miodrag Milanovic + + 2008-09-09 Preliminary driver. + + 2010-12-07 Added some code to allow sapizps3 to read its rom. + With no available docs, the i/o ports are a guess. The ram + allocation is based on the actions of the various bios roms. + Port 25 is used as a jump vector. in a,(25); ld l,a; jp(hl). + + 2012-04-19 Connected sapizps3 to a terminal. It is trying to + load a 128-byte boot sector from a floppy disk. + Modernised driver. + Connected sapizps2 to ascii keyboard. System is now usable. + According to wikipedia, sapi1 & 2 have cassette facility, + while sapi3 uses 8 inch floppy disk. + +ToDo: +- Add cassette to sapi1 and 2 +-- UART on port 12, save and load bytes +-- port 11 bit 7 for load, chr available +-- port 11 bit 6 for save, tx buffer empty +- sapi3 is trying to read a disk, so there is no response after showing the logo + +Unable to proceed due to no info available (& in English). + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "machine/ram.h" +#include "machine/keyboard.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" +#define KEYBOARD_TAG "keyboard" + +class sapi1_state : public driver_device +{ +public: + sapi1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_bank1(*this, "bank1"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1"), + m_line2(*this, "LINE2"), + m_line3(*this, "LINE3"), + m_line4(*this, "LINE4"), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") + { + } + + optional_shared_ptr m_p_videoram; + DECLARE_READ8_MEMBER(sapi1_keyboard_r); + DECLARE_WRITE8_MEMBER(sapi1_keyboard_w); + DECLARE_READ8_MEMBER(sapi2_keyboard_status_r); + DECLARE_READ8_MEMBER(sapi2_keyboard_data_r); + DECLARE_READ8_MEMBER(sapi3_0c_r); + DECLARE_WRITE8_MEMBER(sapi3_00_w); + DECLARE_READ8_MEMBER(sapi3_25_r); + DECLARE_WRITE8_MEMBER(sapi3_25_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_DRIVER_INIT(sapizps3); + DECLARE_DRIVER_INIT(sapizps3a); + DECLARE_DRIVER_INIT(sapizps3b); + DECLARE_MACHINE_RESET(sapi1); + DECLARE_MACHINE_RESET(sapizps3); + MC6845_UPDATE_ROW(crtc_update_row); + UINT32 screen_update_sapi1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_sapi3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +private: + UINT8 m_term_data; + UINT8 m_keyboard_mask; + UINT8 m_refresh_counter; + UINT8 m_zps3_25; + optional_memory_bank m_bank1; // Only for sapi3 + required_ioport m_line0; + required_ioport m_line1; + required_ioport m_line2; + required_ioport m_line3; + required_ioport m_line4; + required_device m_maincpu; +public: + optional_device m_palette; +}; + +static const UINT8 MHB2501[] = { + 0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @ + 0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A + 0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B + 0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C + 0x1e,0x09,0x09,0x09,0x09,0x09,0x1e,0x00, // D + 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E + 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F + 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G + + 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H + 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I + 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J + 0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00, // K + 0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00, // L + 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M + 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N + 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O + + 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P + 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q + 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R + 0x0e,0x11,0x10,0x0e,0x01,0x11,0x0e,0x00, // S + 0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // T + 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U + 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V + 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W + + 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X + 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y + 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z + 0x1c,0x10,0x10,0x10,0x10,0x10,0x1c,0x00, // [ + 0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00, // backslash + 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ] + 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^ + 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _ + + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // + 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // ! + 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // " + 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // # + 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // + 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // % + 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // & + 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // ' + + 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // ( + 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // ) + 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // * + 0x00,0x04,0x04,0x1f,0x04,0x04,0x00,0x00, // + + 0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00, // , + 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // - + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // . + 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // / + + 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0 + 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1 + 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2 + 0x1f,0x01,0x02,0x06,0x01,0x11,0x0e,0x00, // 3 + 0x02,0x06,0x0a,0x12,0x1f,0x02,0x02,0x00, // 4 + 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5 + 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6 + 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7 + + 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8 + 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9 + 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // : + 0x00,0x00,0x04,0x00,0x04,0x04,0x08,0x00, // ; + 0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00, // < + 0x00,0x00,0x1f,0x00,0x1f,0x00,0x00,0x00, // = + 0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00, // > + 0x0e,0x11,0x01,0x02,0x04,0x00,0x04,0x00 // ? +}; + + +/* Address maps */ +static ADDRESS_MAP_START(sapi1_mem, AS_PROGRAM, 8, sapi1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM + AM_RANGE(0x2000, 0x23ff) AM_RAM + AM_RANGE(0x2400, 0x27ff) AM_READWRITE(sapi1_keyboard_r, sapi1_keyboard_w) // PORT 0 - keyboard + //AM_RANGE(0x2800, 0x2bff) AM_NOP // PORT 1 + //AM_RANGE(0x2c00, 0x2fff) AM_NOP // PORT 2 + //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214 + AM_RANGE(0x3800, 0x3fff) AM_RAM AM_SHARE("videoram") // AND-1 (video RAM) + AM_RANGE(0x4000, 0x7fff) AM_RAM // REM-1 +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sapi2_mem, AS_PROGRAM, 8, sapi1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM + AM_RANGE(0x2000, 0x23ff) AM_RAM + AM_RANGE(0x2400, 0x27ff) AM_READ(sapi2_keyboard_status_r) + AM_RANGE(0x2800, 0x28ff) AM_READ(sapi2_keyboard_data_r) + AM_RANGE(0x3800, 0x3fff) AM_RAM AM_SHARE("videoram") // AND-1 (video RAM) + AM_RANGE(0x4000, 0x7fff) AM_RAM // REM-1 +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sapi3_mem, AS_PROGRAM, 8, sapi1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RAMBANK("bank1") + AM_RANGE(0x0800, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sapi3a_mem, AS_PROGRAM, 8, sapi1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RAMBANK("bank1") + AM_RANGE(0x0800, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xfdff) AM_ROM + AM_RANGE(0xfe00, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sapi3b_mem, AS_PROGRAM, 8, sapi1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RAMBANK("bank1") + AM_RANGE(0x0800, 0xafff) AM_RAM + AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0xb800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sapi3_io, AS_IO, 8, sapi1_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(sapi3_00_w) + AM_RANGE(0x25, 0x25) AM_READWRITE(sapi3_25_r,sapi3_25_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sapi3a_io, AS_IO, 8, sapi1_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(sapi3_00_w) + AM_RANGE(0x12, 0x12) AM_READ(sapi2_keyboard_data_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x25, 0x25) AM_READWRITE(sapi3_25_r,sapi3_25_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sapi3b_io, AS_IO, 8, sapi1_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(sapi3_00_w) + AM_RANGE(0x0c, 0x0c) AM_READ(sapi3_0c_r) + AM_RANGE(0x25, 0x25) AM_READWRITE(sapi3_25_r,sapi3_25_w) + AM_RANGE(0xe0, 0xe0) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0xe1, 0xe1) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sapi1 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('~') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR(';') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('/') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(',') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('-') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR(':') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('<') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('"') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('.') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('@') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('>') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('?') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') +INPUT_PORTS_END + + + +/************************************** + + Video + +**************************************/ + +UINT32 sapi1_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bool val; + UINT16 addr,xpos; + UINT8 chr,attr,ra,x,y,b; + + for(y = 0; y < 24; y++ ) + { + addr = y*64; + xpos = 0; + for(x = 0; x < 40; x++ ) + { + chr = m_p_videoram[addr + x]; + attr = (chr >> 6) & 3; + chr &= 0x3f; + for(ra = 0; ra < 9; ra++ ) + { + for(b = 0; b < 6; b++ ) + { + val = 0; + + if (ra==8) + { + if (attr==2) + val = BIT(m_refresh_counter, 5); + } + else + { + val = BIT(MHB2501[(chr<<3) | ra], 5-b); + if (attr==1) + val = BIT(m_refresh_counter, 5) ? val : 0; + } + + if(attr==3) + { + bitmap.pix16(y*9+ra, xpos+2*b ) = val; + bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; + } + else + { + bitmap.pix16(y*9+ra, xpos+b ) = val; + } + } + } + xpos+= (attr==3) ? 12 : 6; + if (xpos>=6*40) break; + } + } + m_refresh_counter++; + return 0; +} + +// The attributes seem to be different on this one, they need to be understood, so disabled for now +UINT32 sapi1_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bool val; + UINT16 addr,xpos; + UINT8 chr,attr,ra,x,y,b; + + for(y = 0; y < 20; y++ ) + { + addr = y*64; + xpos = 0; + for(x = 0; x < 40; x++ ) + { + chr = m_p_videoram[addr + x]; + attr = 0;//(chr >> 6) & 3; + if (chr > 0x3f) + chr &= 0x1f; + + for(ra = 0; ra < 9; ra++ ) + { + for(b = 0; b < 6; b++ ) + { + val = 0; + + if (ra==8) + { + if (attr==2) + val = BIT(m_refresh_counter, 5); + } + else + { + val = BIT(MHB2501[(chr<<3) | ra], 5-b); + if (attr==1) + val = BIT(m_refresh_counter, 5) ? val : 0; + } + + if(attr==3) + { + bitmap.pix16(y*9+ra, xpos+2*b ) = val; + bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; + } + else + { + bitmap.pix16(y*9+ra, xpos+b ) = val; + } + } + } + xpos+= (attr==3) ? 12 : 6; + if (xpos>=6*40) break; + } + } + m_refresh_counter++; + return 0; +} + +MC6845_UPDATE_ROW( sapi1_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,inv; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + inv = gfx = 0; + if (x == cursor_x) inv ^= 0xff; + mem = (2*(ma + x)) & 0xfff; + chr = m_p_videoram[mem] & 0x3f; + + if (ra < 8) + gfx = MHB2501[(chr<<3) | ra] ^ inv; + + /* Display a scanline of a character */ + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} + +/************************************** + + Keyboard + +**************************************/ + +READ8_MEMBER( sapi1_state::sapi1_keyboard_r ) +{ + UINT8 key = 0xff; + if (BIT(m_keyboard_mask, 0)) { key &= m_line0->read(); } + if (BIT(m_keyboard_mask, 1)) { key &= m_line1->read(); } + if (BIT(m_keyboard_mask, 2)) { key &= m_line2->read(); } + if (BIT(m_keyboard_mask, 3)) { key &= m_line3->read(); } + if (BIT(m_keyboard_mask, 4)) { key &= m_line4->read(); } + return key; +} + +WRITE8_MEMBER( sapi1_state::sapi1_keyboard_w ) +{ + m_keyboard_mask = (data ^ 0xff ) & 0x1f; +} + +READ8_MEMBER( sapi1_state::sapi2_keyboard_status_r) +{ + return (m_term_data) ? 0 : 1; +} + +READ8_MEMBER( sapi1_state::sapi2_keyboard_data_r) +{ + UINT8 ret = ~m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( sapi1_state::kbd_put ) +{ + m_term_data = data; +} + +/************************************** + + Machine + +**************************************/ + +READ8_MEMBER( sapi1_state::sapi3_0c_r ) +{ + return 0xc0; +} + +/* switch out the rom shadow */ +WRITE8_MEMBER( sapi1_state::sapi3_00_w ) +{ + m_bank1->set_entry(0); +} + +/* to stop execution in random ram */ +READ8_MEMBER( sapi1_state::sapi3_25_r ) +{ + return m_zps3_25; +} + +WRITE8_MEMBER( sapi1_state::sapi3_25_w ) +{ + m_zps3_25 = data & 0xfc; //?? +} + +MACHINE_RESET_MEMBER( sapi1_state, sapi1 ) +{ + m_keyboard_mask = 0; + m_refresh_counter = 0x20; +} + +MACHINE_RESET_MEMBER( sapi1_state, sapizps3 ) +{ + m_keyboard_mask = 0; + m_bank1->set_entry(1); +} + +DRIVER_INIT_MEMBER( sapi1_state, sapizps3 ) +{ + UINT8 *RAM = memregion("maincpu")->base(); + m_bank1->configure_entries(0, 2, &RAM[0x0000], 0x10000); +} + +DRIVER_INIT_MEMBER( sapi1_state, sapizps3a ) +{ + UINT8 *RAM = memregion("maincpu")->base(); + m_bank1->configure_entries(0, 2, &RAM[0x0000], 0xf800); +} + +DRIVER_INIT_MEMBER( sapi1_state, sapizps3b ) +{ + UINT8 *RAM = memregion("maincpu")->base(); + m_bank1->configure_entries(0, 2, &RAM[0x0000], 0x10000); +} + + +/* Machine driver */ +static MACHINE_CONFIG_START( sapi1, sapi1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(sapi1_mem) + MCFG_MACHINE_RESET_OVERRIDE(sapi1_state, sapi1) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(40*6, 24*9) + MCFG_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*9-1) + MCFG_SCREEN_UPDATE_DRIVER(sapi1_state, screen_update_sapi1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sapi2, sapi1 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sapi2_mem) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(sapi1_state, kbd_put)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sapi3, sapi2 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sapi3_mem) + MCFG_CPU_IO_MAP(sapi3_io) + MCFG_MACHINE_RESET_OVERRIDE(sapi1_state, sapizps3 ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(40*6, 20*9) + MCFG_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 20*9-1) + MCFG_SCREEN_UPDATE_DRIVER(sapi1_state, screen_update_sapi3) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sapi3b, sapi3 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sapi3b_mem) + MCFG_CPU_IO_MAP(sapi3b_io) + + MCFG_MC6845_ADD("crtc", MC6845, "screen", 1008000) // guess + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(6) + MCFG_MC6845_UPDATE_ROW_CB(sapi1_state, crtc_update_row) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_SCREEN_NO_PALETTE +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( sapi3a, sapi1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 2000000) + MCFG_CPU_PROGRAM_MAP(sapi3a_mem) + MCFG_CPU_IO_MAP(sapi3a_io) + MCFG_MACHINE_RESET_OVERRIDE(sapi1_state, sapizps3 ) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(sapi1_state, kbd_put)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + + + +/************************************** + + Roms + +**************************************/ + +ROM_START( sapi1 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "mb1", "MB1" ) + ROMX_LOAD( "sapi1.rom", 0x0000, 0x1000, CRC(c6e85b01) SHA1(2a26668249c6161aef7215a1e2b92bfdf6fe3671), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "mb2", "MB2 (ANK-1)" ) + ROMX_LOAD( "mb2_4.bin", 0x0000, 0x1000, CRC(a040b3e0) SHA1(586990a07a96323741679a11ff54ad0023da87bc), ROM_BIOS(2)) +ROM_END + +ROM_START( sapizps2 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "v4", "MIKOS 4" ) + ROMX_LOAD( "36.bin", 0x0000, 0x0800, CRC(a27f340a) SHA1(d07d208fcbe428897336c17197d3e8fb52181f38), ROM_BIOS(1)) + ROMX_LOAD( "37.bin", 0x0800, 0x0800, CRC(30daa708) SHA1(66e990c40788ee25cf6cabd4842a78daf4fcdddd), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v5", "MIKOS 5" ) + ROMX_LOAD( "mikos5_1.bin", 0x0000, 0x0800, CRC(c2a83ca3) SHA1(a3678253d7690c89945e791ea0f8e15b081c9126), ROM_BIOS(2)) + ROMX_LOAD( "mikos5_2.bin", 0x0800, 0x0800, CRC(c4458a04) SHA1(0cc909323f0e6507d95e57ea39e1deb8bd57bf89), ROM_BIOS(2)) + ROMX_LOAD( "mikos5_3.bin", 0x1000, 0x0800, CRC(efb499f3) SHA1(78f0ca3ff10d7af4ae94ab820723296beb035f8f), ROM_BIOS(2)) + ROMX_LOAD( "mikos5_4.bin", 0x1800, 0x0800, CRC(4d90e9be) SHA1(8ec554198697550a49432e8210d43700ef1d6a32), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "mb3", "MB3 (Consul)" ) + ROMX_LOAD( "mb3_1.bin", 0x0000, 0x1000, CRC(be895f88) SHA1(7fc2a92f41d978a9f0ccd0e235ea3c6146adfb6f), ROM_BIOS(3)) +ROM_END + +ROM_START( sapizps3 ) + ROM_REGION( 0x10800, "maincpu", 0 ) + // These 2 bioses use videoram at F800 + ROM_SYSTEM_BIOS( 0, "per", "Perina" ) + ROMX_LOAD( "perina_1988.bin",0x10000, 0x0800, CRC(d71e8d3a) SHA1(9b3a26ea7c2f2c8a1fb10b51c1c880acc9fd806d), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "1zmod", "JPR-1Zmod" ) + ROMX_LOAD( "jpr1zmod.bin", 0x10000, 0x0800, CRC(69a29b07) SHA1(1cd31032954fcd7d10b1586be62db6f7597eb4f2), ROM_BIOS(2)) +ROM_END + +ROM_START( sapizps3a ) + ROM_REGION( 0x10000, "maincpu", 0 ) + // This bios uses a terminal + ROM_LOAD( "jpr1a.bin", 0xf800, 0x0800, CRC(3ed89786) SHA1(dcc8657b4884bfe58d114c539b733b73d038ee30)) +ROM_END + +ROM_START( sapizps3b ) + ROM_REGION( 0x10800, "maincpu", 0 ) + // This bios uses a 6845 + ROM_LOAD( "pkt1.bin", 0x10000, 0x0800, CRC(ed5a2725) SHA1(3383c15f87f976400b8d0f31829e2a95236c4b6c)) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, sapi1, 0, 0, sapi1, sapi1, driver_device, 0, "Tesla", "SAPI-1 ZPS 1", MACHINE_NO_SOUND_HW) +COMP( 1985, sapizps2, sapi1, 0, sapi2, sapi1, driver_device, 0, "Tesla", "SAPI-1 ZPS 2", MACHINE_NO_SOUND_HW) +COMP( 1985, sapizps3, sapi1, 0, sapi3, sapi1, sapi1_state, sapizps3, "Tesla", "SAPI-1 ZPS 3", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1985, sapizps3a,sapi1, 0, sapi3a, sapi1, sapi1_state, sapizps3a, "Tesla", "SAPI-1 ZPS 3 (terminal)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1985, sapizps3b,sapi1, 0, sapi3b, sapi1, sapi1_state, sapizps3b, "Tesla", "SAPI-1 ZPS 3 (6845)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c new file mode 100644 index 00000000000..c28e60051f4 --- /dev/null +++ b/src/mame/drivers/saturn.c @@ -0,0 +1,904 @@ +// license:LGPL-2.1+ +// copyright-holders:David Haywood, Angelo Salese, Olivier Galibert, Mariusz Wojcieszek, R. Belmont +/************************************************************************************************** + + Sega Saturn & Sega ST-V (Sega Titan Video) HW (c) 1994 Sega + + Driver by David Haywood, Angelo Salese, Olivier Galibert & Mariusz Wojcieszek + SCSP driver provided by R. Belmont, based on ElSemi's SCSP sound chip emulator + Many thanks to Guru, Fabien, Runik and Charles MacDonald for the help given. + +=================================================================================================== + +Notes: +-To enter into an Advanced Test Mode,keep pressed the Test Button (F2) on the start-up. +-Memo: Some tests done on the original & working PCB,to be implemented: + -The AD-Stick returns 0x00 or a similar value. + -The Ports E,F & G must return 0xff + +TODO: +(Main issues) +- decap the SH-1, used for CD block (needed especially for Sega Saturn) +- IRQs: some games have some issues with timing accurate IRQs, check/fix all of them. +- The Cart-Dev mode hangs even with the -dev bios,I would like to see what it does on the real HW. +- IC13 games on the dev bios doesn't even load the cartridge / crashes the emulation at start-up, + rom rearrange needed? +- SCU DSP still has its fair share of issues, it also needs to be converted to CPU structure; +- Add the RS232c interface (serial port), needed by fhboxers (accesses some ports in the a-bus dummy range). +- Video emulation is nowhere near perfection. +- Reimplement the idle skip if possible. +- Move SCU device into its respective file; + +test1f diagnostic hacks: +"chash parge error" test 0x6035d04 <- 0x0009 (nop the button check) +"chase line pearg" test 0x6036964 <- 0x0009 (nop the button check again) + +****************************************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/eepromser.h" +#include "cpu/sh2/sh2.h" +#include "cpu/scudsp/scudsp.h" +#include "sound/scsp.h" +#include "sound/cdda.h" +#include "machine/smpc.h" +#include "machine/nvram.h" +#include "includes/stv.h" +#include "imagedev/chd_cd.h" +#include "coreutil.h" + +#include "bus/saturn/sat_slot.h" +#include "bus/saturn/rom.h" +#include "bus/saturn/dram.h" +#include "bus/saturn/bram.h" + + +class sat_console_state : public saturn_state +{ +public: + sat_console_state(const machine_config &mconfig, device_type type, const char *tag) + : saturn_state(mconfig, type, tag) + , m_exp(*this, "exp") + , m_nvram(*this, "nvram") + , m_smpc_nv(*this, "smpc_nv") + { } + + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + DECLARE_INPUT_CHANGED_MEMBER(nmi_reset); + DECLARE_INPUT_CHANGED_MEMBER(tray_open); + DECLARE_INPUT_CHANGED_MEMBER(tray_close); + + DECLARE_MACHINE_START(saturn); + DECLARE_MACHINE_RESET(saturn); + + DECLARE_READ8_MEMBER(saturn_cart_type_r); + DECLARE_READ32_MEMBER( abus_dummy_r ); + + DECLARE_READ32_MEMBER(saturn_null_ram_r); + DECLARE_WRITE32_MEMBER(saturn_null_ram_w); + + void saturn_init_driver(int rgn); + DECLARE_DRIVER_INIT(saturnus); + DECLARE_DRIVER_INIT(saturneu); + DECLARE_DRIVER_INIT(saturnjp); + + void nvram_init(nvram_device &nvram, void *data, size_t size); + + required_device m_exp; + required_device m_nvram; + required_device m_smpc_nv; // TODO: move this in the base class saturn_state and add it to stv in MAME +}; + + +READ8_MEMBER(sat_console_state::saturn_cart_type_r) +{ + if (m_exp) + return m_exp->get_cart_type(); + else + return 0xff; +} + +/* TODO: Bug! accesses this one, if returning 0 the SH-2 hard-crashes. Might be an actual bug with the CD block. */ +READ32_MEMBER( sat_console_state::abus_dummy_r ) +{ + logerror("A-Bus Dummy access %08x\n",offset*4); + return -1; +} + +static ADDRESS_MAP_START( saturn_mem, AS_PROGRAM, 32, sat_console_state ) + AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_SHARE("share6") AM_WRITENOP // bios + AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE8(saturn_SMPC_r, saturn_SMPC_w,0xffffffff) + AM_RANGE(0x00180000, 0x0018ffff) AM_READWRITE8(saturn_backupram_r, saturn_backupram_w,0xffffffff) AM_SHARE("share1") + AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x20100000) AM_SHARE("workram_l") + AM_RANGE(0x01000000, 0x017fffff) AM_WRITE(saturn_minit_w) + AM_RANGE(0x01800000, 0x01ffffff) AM_WRITE(saturn_sinit_w) +// AM_RANGE(0x02000000, 0x023fffff) AM_ROM // Cartridge area +// AM_RANGE(0x02400000, 0x027fffff) AM_RAM // External Data RAM area +// AM_RANGE(0x04000000, 0x047fffff) AM_RAM // External Battery RAM area + AM_RANGE(0x04fffffc, 0x04ffffff) AM_READ8(saturn_cart_type_r,0x000000ff) + AM_RANGE(0x05000000, 0x057fffff) AM_READ(abus_dummy_r) + AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE(stvcd_r, stvcd_w) + /* Sound */ + AM_RANGE(0x05a00000, 0x05a7ffff) AM_READWRITE16(saturn_soundram_r, saturn_soundram_w,0xffffffff) + AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16("scsp", scsp_device, read, write, 0xffffffff) + /* VDP1 */ + AM_RANGE(0x05c00000, 0x05c7ffff) AM_READWRITE(saturn_vdp1_vram_r, saturn_vdp1_vram_w) + AM_RANGE(0x05c80000, 0x05cbffff) AM_READWRITE(saturn_vdp1_framebuffer0_r, saturn_vdp1_framebuffer0_w) + AM_RANGE(0x05d00000, 0x05d0001f) AM_READWRITE16(saturn_vdp1_regs_r, saturn_vdp1_regs_w,0xffffffff) + AM_RANGE(0x05e00000, 0x05e7ffff) AM_MIRROR(0x80000) AM_READWRITE(saturn_vdp2_vram_r, saturn_vdp2_vram_w) + AM_RANGE(0x05f00000, 0x05f7ffff) AM_READWRITE(saturn_vdp2_cram_r, saturn_vdp2_cram_w) + AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE16(saturn_vdp2_regs_r, saturn_vdp2_regs_w,0xffffffff) + AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(saturn_scu_r, saturn_scu_w) + AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x21f00000) AM_SHARE("workram_h") + AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE("share6") // bios mirror +// AM_RANGE(0x22000000, 0x24ffffff) AM_ROM // Cartridge area mirror + AM_RANGE(0x45000000, 0x46ffffff) AM_WRITENOP + AM_RANGE(0x60000000, 0x600003ff) AM_WRITENOP // cache address array + AM_RANGE(0xc0000000, 0xc0000fff) AM_RAM // cache data array, Dragon Ball Z sprites relies on this +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sound_mem, AS_PROGRAM, 16, sat_console_state ) + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("sound_ram") + AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE("scsp", scsp_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( scudsp_mem, AS_PROGRAM, 32, sat_console_state ) + AM_RANGE(0x00, 0xff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( scudsp_data, AS_DATA, 32, sat_console_state ) + AM_RANGE(0x00, 0xff) AM_RAM +ADDRESS_MAP_END + + +/* keyboard code */ +/* TODO: needs a proper keycode table */ +INPUT_CHANGED_MEMBER(sat_console_state::key_stroke) +{ + if(newval && !oldval) + { + m_keyb.data = ((UINT8)(FPTR)(param) & 0xff); + m_keyb.status |= 8; + } + + if(oldval && !newval) + { + //m_keyb.status &= ~8; + m_keyb.data = 0; + } +} + +/* Note: unused bits must stay high, Bug 2 relies on this. */ +#define SATURN_PAD_P1(_mask_, _val_) \ + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 A") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 C") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 B") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P1 R") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 X") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Y") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Z") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("P1 L") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0007, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) + +#define SATURN_PAD_P2(_mask_, _val_) \ + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 A") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 C") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 B") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P2 R") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 X") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Y") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Z") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("P2 L") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0007, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) + +#define MD_PAD_P1(_mask_, _val_) \ + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 A") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 C") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 B") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P1 Mode") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 X") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Y") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Z") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) //read '1' when direct mode is polled + +#define MD_PAD_P2(_mask_, _val_) \ + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 A") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 C") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 B") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P2 Mode") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 X") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Y") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Z") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ + PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) //read '1' when direct mode is polled + +#define SATURN_KEYBOARD PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x05) + +INPUT_CHANGED_MEMBER(sat_console_state::nmi_reset) +{ + /* TODO: correct? */ + if(!m_NMI_reset) + return; + + /* TODO: NMI doesn't stay held on SH-2 core so we can't use ASSERT_LINE/CLEAR_LINE with that yet */ + if(newval) + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + +INPUT_CHANGED_MEMBER(sat_console_state::tray_open) +{ + if(newval) + stvcd_set_tray_open(); +} + +INPUT_CHANGED_MEMBER(sat_console_state::tray_close) +{ + if(newval) + stvcd_set_tray_close(); +} + +static INPUT_PORTS_START( saturn ) + PORT_START("RESET") /* hardwired buttons */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, nmi_reset,0) PORT_NAME("Reset Button") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, tray_open,0) PORT_NAME("Tray Open Button") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, tray_close,0) PORT_NAME("Tray Close") + + PORT_START("JOY1") + SATURN_PAD_P1(0x0f, 0) + + PORT_START("JOY2") + SATURN_PAD_P2(0xf0, 0) + + /* TODO: there's no info about the keycode used on Saturn keyboard, following is trial & error with Game Basic software */ + PORT_START("KEY0") // 0x00 - 0x07 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_UNUSED) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") /*PORT_CODE(KEYCODE_F1)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x01) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x02) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") /*PORT_CODE(KEYCODE_F2)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x03) PORT_PLAYER(1) SATURN_KEYBOARD // RUN + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") /*PORT_CODE(KEYCODE_F3)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x04) PORT_PLAYER(1) SATURN_KEYBOARD // LIST + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") /*PORT_CODE(KEYCODE_F4)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x05) PORT_PLAYER(1) SATURN_KEYBOARD // EDIT + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") /*PORT_CODE(KEYCODE_F5)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x06) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLR SCR") PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x07) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY1") // 0x08 - 0x0f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x08) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6") /*PORT_CODE(KEYCODE_F6)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x09) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F7") /*PORT_CODE(KEYCODE_F7)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F8") /*PORT_CODE(KEYCODE_F8)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0b) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F9") /*PORT_CODE(KEYCODE_F9)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0c) PORT_PLAYER(1) SATURN_KEYBOARD // LIST again + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0d) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0e) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0f) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY2") // 0x10 - 0x17 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x10) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x11) PORT_PLAYER(1) SATURN_KEYBOARD + /* TODO: break codes! */ + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x12) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA SHIFT") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x13) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(special keys)") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x14) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x15) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x16) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x17) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY3") // 0x18 - 0x1f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x18) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x19) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1b) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1c) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1d) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1e) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1f) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY4") // 0x20 - 0x27 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x20) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x21) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x22) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x23) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x24) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x25) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x26) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x27) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY5") // 0x28 - 0x2f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-1") /*PORT_CODE(KEYCODE_F) PORT_CHAR('F')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x28) PORT_PLAYER(1) SATURN_KEYBOARD // another F? + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x29) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2b) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2c) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2d) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2e) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2f) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY6") // 0x30 - 0x37 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x30) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x31) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x32) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x33) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x34) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x35) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x36) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x37) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY7") // 0x38 - 0x3f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x38) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x39) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3b) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3c) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3d) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3e) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3f) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY8") // 0x40 - 0x47 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x40) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x41) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x42) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x43) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x44) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x45) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x46) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x47) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEY9") // 0x48 - 0x4f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x48) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x49) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4b) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4c) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4d) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- / =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4e) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4f) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEYA") // 0x50 - 0x57 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x50) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xC2\xA5") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x51) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x52) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x53) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x54) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x55) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x56) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x57) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEYB") // 0x58 - 0x5f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x58) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x59) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5b) PORT_PLAYER(1) SATURN_KEYBOARD // { + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5c) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5d) PORT_PLAYER(1) SATURN_KEYBOARD // } + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5e) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5f) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEYC") // 0x60 - 0x67 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x60) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x61) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x62) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x63) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x64) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x65) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) /* PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x66) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x67) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEYD") // 0x68 - 0x6f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x68) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x69) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6b) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6c) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6d) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6e) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6f) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEYE") // 0x70 - 0x77 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x70) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x71) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x72) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x73) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x74) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x75) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x76) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x77) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("KEYF") // 0x78 - 0x7f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x78) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x79) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7b) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7c) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7d) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7e) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7f) PORT_PLAYER(1) SATURN_KEYBOARD //SYSTEM CONFIGURATION + + PORT_START("KEYS_1") // special keys + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) /*PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x78) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) /*PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x79) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) /*PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7a) PORT_PLAYER(1) SATURN_KEYBOARD + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) /*PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7b) PORT_PLAYER(1) SATURN_KEYBOARD + + PORT_START("MOUSEB1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Pointer Left Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Pointer Right Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Pointer Middle Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Pointer Start Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Mouse Left Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Mouse Right Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Mouse Middle Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Mouse Start Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) + + PORT_START("MOUSEX1") + PORT_BIT(0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_NAME("P1 Pointer X") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) + PORT_BIT(0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_NAME("P1 Mouse X") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) + + PORT_START("MOUSEY1") + PORT_BIT(0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_REVERSE PORT_NAME("P1 Pointer Y") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) + PORT_BIT(0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_REVERSE PORT_NAME("P1 Mouse Y") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) + + PORT_START("MOUSEB2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Pointer Left Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Pointer Right Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Pointer Middle Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P2 Pointer Start Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Mouse Left Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Mouse Right Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Mouse Middle Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P2 Mouse Start Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) + + PORT_START("MOUSEX2") + PORT_BIT(0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_NAME("P2 Pointer X") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) + PORT_BIT(0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_NAME("P2 Mouse X") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) + + PORT_START("MOUSEY2") + PORT_BIT(0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_REVERSE PORT_NAME("P2 Pointer Y") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) + PORT_BIT(0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_REVERSE PORT_NAME("P2 Mouse Y") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) + + PORT_START("AN_JOY1") + SATURN_PAD_P1(0x0f, 0x01) // racing device + SATURN_PAD_P1(0x0f, 0x02) // analog controller + + PORT_START("AN_JOY2") + SATURN_PAD_P2(0xf0, 0x10) // racing device + SATURN_PAD_P2(0xf0, 0x20) // analog controller + + PORT_START("AN_X1") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 Racing Stick X") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x01) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 AD Stick X") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x02) + + PORT_START("AN_Y1") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 Racing Stick Y") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x01) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 AD Stick Y") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x02) + + PORT_START("AN_Z1") + PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Z ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 Racing Stick Z") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x01) + PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Z ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 AD Stick Z") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x02) + + PORT_START("AN_X2") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 Racing Stick X") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x10) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 AD Stick X") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x20) + + PORT_START("AN_Y2") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 Racing Stick Y") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x10) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 AD Stick Y") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x20) + + PORT_START("AN_Z2") + PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Z ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 Racing Stick Z") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x10) + PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Z ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 AD Stick Z") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x20) + + PORT_START("MD_JOY1") + MD_PAD_P1(0x0f, 0x06) // MD 3 buttons pad + MD_PAD_P1(0x0f, 0x07) // MD 6 buttons pad + + PORT_START("MD_JOY2") + MD_PAD_P2(0xf0, 0x60) // MD 3 buttons pad + MD_PAD_P2(0xf0, 0x70) // MD 6 buttons pad + + PORT_START("INPUT_TYPE") + PORT_CONFNAME(0x0f,0x00,"Controller Port 1") + PORT_CONFSETTING(0x00,"Digital Device (standard Saturn pad)") + PORT_CONFSETTING(0x01,"Racing Device") /* steering wheel only */ + PORT_CONFSETTING(0x02,"Analog Device") //Nights pad? +// PORT_CONFSETTING(0x03,"Lightgun Device") + PORT_CONFSETTING(0x04,"Trackball") // TODO: according to the docs this ID is labeled "Pointing Device" + PORT_CONFSETTING(0x05,"Keyboard Device") + PORT_CONFSETTING(0x06,"Megadrive 3B Pad") + PORT_CONFSETTING(0x07,"Megadrive 6B Pad") + PORT_CONFSETTING(0x08,"Saturn Mouse") +// PORT_CONFSETTING(0x09,"") + PORT_CONFNAME(0xf0,0x00,"Controller Port 2") + PORT_CONFSETTING(0x00,"Digital Device (standard Saturn pad)") + PORT_CONFSETTING(0x10,"Racing Device") + PORT_CONFSETTING(0x20,"Analog Device") //Nights pad? +// PORT_CONFSETTING(0x30,"Lightgun Device") + PORT_CONFSETTING(0x40,"Pointing Device") +// PORT_CONFSETTING(0x50,"Keyboard Device") + PORT_CONFSETTING(0x60,"Megadrive 3B Pad") + PORT_CONFSETTING(0x70,"Megadrive 6B Pad") + PORT_CONFSETTING(0x80,"Saturn Mouse") + PORT_CONFSETTING(0x90,"") + + PORT_START("fake") + PORT_CONFNAME(0x01,0x00,"Master-Slave Comms") + PORT_CONFSETTING(0x00,"Normal (400 cycles)") + PORT_CONFSETTING(0x01,"One Shot (Hack)") +INPUT_PORTS_END + + +/* TODO: if you change the driver configuration then NVRAM contents gets screwed, needs mods in MAME framework */ +void sat_console_state::nvram_init(nvram_device &nvram, void *data, size_t size) +{ + static const UINT8 init[64] = { + 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', + 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', + 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', + 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', }; + + memset(data, 0x00, size); + memcpy(data, init, sizeof(init)); +} + + +MACHINE_START_MEMBER(sat_console_state, saturn) +{ + system_time systime; + machine().base_datetime(systime); + + machine().device("scsp")->set_ram_base(m_sound_ram); + + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x02400000, 0x027fffff, read32_delegate(FUNC(sat_console_state::saturn_null_ram_r),this), write32_delegate(FUNC(sat_console_state::saturn_null_ram_w),this)); + m_slave->space(AS_PROGRAM).install_readwrite_handler(0x02400000, 0x027fffff, read32_delegate(FUNC(sat_console_state::saturn_null_ram_r),this), write32_delegate(FUNC(sat_console_state::saturn_null_ram_w),this)); + + m_maincpu->space(AS_PROGRAM).nop_readwrite(0x04000000, 0x047fffff); + m_slave->space(AS_PROGRAM).nop_readwrite(0x04000000, 0x047fffff); + + m_nvram->set_base(m_backupram, 0x8000); + m_smpc_nv->set_base(&m_smpc.SMEM, 4); + + if (m_exp) + { + switch (m_exp->get_cart_type()) + { + case 0x21: // Battery RAM cart + case 0x22: + case 0x23: + case 0x24: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x04000000, 0x047fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_bram), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x04000000, 0x047fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_bram), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_read_handler(0x04000000, 0x047fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_bram), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_write_handler(0x04000000, 0x047fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_bram), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x24000000, 0x247fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_bram), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x24000000, 0x247fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_bram), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_read_handler(0x24000000, 0x247fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_bram), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_write_handler(0x24000000, 0x247fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_bram), (sat_cart_slot_device*)m_exp)); + break; + case 0x5a: // Data RAM cart + case 0x5c: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x02400000, 0x025fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram0), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x02400000, 0x025fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram0), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x02600000, 0x027fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram1), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x02600000, 0x027fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram1), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_read_handler(0x02400000, 0x025fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram0), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_write_handler(0x02400000, 0x025fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram0), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_read_handler(0x02600000, 0x027fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram1), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_write_handler(0x02600000, 0x027fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram1), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x22400000, 0x225fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram0), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x22400000, 0x225fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram0), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x22600000, 0x227fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram1), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x22600000, 0x227fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram1), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_read_handler(0x22400000, 0x225fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram0), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_write_handler(0x22400000, 0x225fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram0), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_read_handler(0x22600000, 0x227fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram1), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_write_handler(0x22600000, 0x227fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram1), (sat_cart_slot_device*)m_exp)); + break; + case 0xff: // ROM cart + mirror + m_maincpu->space(AS_PROGRAM).install_read_handler(0x02000000, 0x023fffff, read32_delegate(FUNC(sat_cart_slot_device::read_rom), (sat_cart_slot_device*)m_exp)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x22000000, 0x223fffff, read32_delegate(FUNC(sat_cart_slot_device::read_rom), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_read_handler(0x02000000, 0x023fffff, read32_delegate(FUNC(sat_cart_slot_device::read_rom), (sat_cart_slot_device*)m_exp)); + m_slave->space(AS_PROGRAM).install_read_handler(0x22000000, 0x223fffff, read32_delegate(FUNC(sat_cart_slot_device::read_rom), (sat_cart_slot_device*)m_exp)); + break; + } + } + + // save states + save_pointer(NAME(m_scu_regs), 0x100/4); + save_pointer(NAME(m_scsp_regs), 0x1000/2); + save_item(NAME(m_NMI_reset)); + save_item(NAME(m_en_68k)); + save_item(NAME(m_smpc.IOSEL1)); + save_item(NAME(m_smpc.IOSEL2)); + save_item(NAME(m_smpc.EXLE1)); + save_item(NAME(m_smpc.EXLE2)); + save_item(NAME(m_smpc.PDR1)); + save_item(NAME(m_smpc.PDR2)); +// save_item(NAME(m_port_sel)); +// save_item(NAME(mux_data)); + save_item(NAME(m_scsp_last_line)); + save_item(NAME(m_smpc.intback_stage)); + save_item(NAME(m_smpc.pmode)); + save_item(NAME(m_smpc.SR)); + save_item(NAME(m_smpc.SMEM)); + + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sat_console_state::stvcd_exit), this)); + + m_smpc.rtc_data[0] = DectoBCD(systime.local_time.year /100); + m_smpc.rtc_data[1] = DectoBCD(systime.local_time.year %100); + m_smpc.rtc_data[2] = (systime.local_time.weekday << 4) | (systime.local_time.month+1); + m_smpc.rtc_data[3] = DectoBCD(systime.local_time.mday); + m_smpc.rtc_data[4] = DectoBCD(systime.local_time.hour); + m_smpc.rtc_data[5] = DectoBCD(systime.local_time.minute); + m_smpc.rtc_data[6] = DectoBCD(systime.local_time.second); + + m_stv_rtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sat_console_state::stv_rtc_increment),this)); + + m_audiocpu->set_reset_callback(write_line_delegate(FUNC(sat_console_state::m68k_reset_callback),this)); +} + +/* Die Hard Trilogy tests RAM address 0x25e7ffe bit 2 with Slave during FRT minit irq, in-development tool for breaking execution of it? */ +READ32_MEMBER(sat_console_state::saturn_null_ram_r) +{ + return 0xffffffff; +} + +WRITE32_MEMBER(sat_console_state::saturn_null_ram_w) +{ +} + +MACHINE_RESET_MEMBER(sat_console_state,saturn) +{ + m_scsp_last_line = 0; + + // don't let the slave cpu and the 68k go anywhere + m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_scudsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + + m_smpc.SR = 0x40; // this bit is always on according to docs + + scu_reset(); + + m_en_68k = 0; + m_NMI_reset = 0; + m_smpc.slave_on = 0; + + //memset(stv_m_workram_l, 0, 0x100000); + //memset(stv_m_workram_h, 0, 0x100000); + + m_maincpu->set_unscaled_clock(MASTER_CLOCK_320/2); + m_slave->set_unscaled_clock(MASTER_CLOCK_320/2); + + stvcd_reset(); + + m_vdp2.old_crmd = -1; + m_vdp2.old_tvmd = -1; + + m_stv_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1)); +} + + +static MACHINE_CONFIG_START( saturn, sat_console_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz + MCFG_CPU_PROGRAM_MAP(saturn_mem) + MCFG_SH2_IS_SLAVE(0) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sat_console_state, saturn_scanline, "screen", 0, 1) + + MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz + MCFG_CPU_PROGRAM_MAP(saturn_mem) + MCFG_SH2_IS_SLAVE(1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("slave_scantimer", sat_console_state, saturn_slave_scanline, "screen", 0, 1) + + MCFG_CPU_ADD("audiocpu", M68000, 11289600) //256 x 44100 Hz = 11.2896 MHz + MCFG_CPU_PROGRAM_MAP(sound_mem) + + MCFG_CPU_ADD("scudsp", SCUDSP, MASTER_CLOCK_352/4) // 14 MHz + MCFG_CPU_PROGRAM_MAP(scudsp_mem) + MCFG_CPU_DATA_MAP(scudsp_data) + MCFG_SCUDSP_OUT_IRQ_CB(WRITELINE(saturn_state, scudsp_end_w)) + MCFG_SCUDSP_IN_DMA_CB(READ16(saturn_state, scudsp_dma_r)) + MCFG_SCUDSP_OUT_DMA_CB(WRITE16(saturn_state, scudsp_dma_w)) + +// SH-1 + +// SMPC MCU, running at 4 MHz (+ custom RTC device that runs at 32.768 KHz) + + MCFG_MACHINE_START_OVERRIDE(sat_console_state,saturn) + MCFG_MACHINE_RESET_OVERRIDE(sat_console_state,saturn) + + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", sat_console_state, nvram_init) + MCFG_NVRAM_ADD_0FILL("smpc_nv") // TODO: default for each region (+ move it inside SMPC when converted to device) + + MCFG_TIMER_DRIVER_ADD("sector_timer", sat_console_state, stv_sector_cb) + MCFG_TIMER_DRIVER_ADD("sh1_cmd", sat_console_state, stv_sh1_sim) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_320/8, 427, 0, 320, 263, 0, 224) + MCFG_SCREEN_UPDATE_DRIVER(sat_console_state, screen_update_stv_vdp2) + MCFG_PALETTE_ADD("palette", 2048+(2048*2))//standard palette + extra memory for rgb brightness. + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", stv) + + MCFG_VIDEO_START_OVERRIDE(sat_console_state,stv_vdp2) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_SOUND_ADD("scsp", SCSP, 0) + MCFG_SCSP_IRQ_CB(WRITE8(saturn_state, scsp_irq)) + MCFG_SCSP_MAIN_IRQ_CB(WRITELINE(saturn_state, scsp_to_main_irq)) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + + MCFG_SOUND_ADD("cdda", CDDA, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) +MACHINE_CONFIG_END + +static SLOT_INTERFACE_START(saturn_cart) + SLOT_INTERFACE_INTERNAL("rom", SATURN_ROM) + SLOT_INTERFACE_INTERNAL("ram8", SATURN_DRAM_8MB) + SLOT_INTERFACE_INTERNAL("ram32", SATURN_DRAM_32MB) + SLOT_INTERFACE_INTERNAL("bram4", SATURN_BRAM_4MB) + SLOT_INTERFACE_INTERNAL("bram8", SATURN_BRAM_8MB) + SLOT_INTERFACE_INTERNAL("bram16", SATURN_BRAM_16MB) + SLOT_INTERFACE_INTERNAL("bram32", SATURN_BRAM_32MB) +SLOT_INTERFACE_END + + +MACHINE_CONFIG_DERIVED( saturnus, saturn ) + MCFG_CDROM_ADD( "cdrom" ) + MCFG_CDROM_INTERFACE("sat_cdrom") + MCFG_SOFTWARE_LIST_ADD("cd_list","saturn") + MCFG_SOFTWARE_LIST_FILTER("cd_list","NTSC-U") + + MCFG_SATURN_CARTRIDGE_ADD("exp", saturn_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","sat_cart") + +MACHINE_CONFIG_END + +MACHINE_CONFIG_DERIVED( saturneu, saturn ) + MCFG_CDROM_ADD( "cdrom" ) + MCFG_CDROM_INTERFACE("sat_cdrom") + MCFG_SOFTWARE_LIST_ADD("cd_list","saturn") + MCFG_SOFTWARE_LIST_FILTER("cd_list","PAL") + + MCFG_SATURN_CARTRIDGE_ADD("exp", saturn_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","sat_cart") + +MACHINE_CONFIG_END + +MACHINE_CONFIG_DERIVED( saturnjp, saturn ) + MCFG_CDROM_ADD( "cdrom" ) + MCFG_CDROM_INTERFACE("sat_cdrom") + MCFG_SOFTWARE_LIST_ADD("cd_list","saturn") + MCFG_SOFTWARE_LIST_FILTER("cd_list","NTSC-J") + + MCFG_SATURN_CARTRIDGE_ADD("exp", saturn_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","sat_cart") + +MACHINE_CONFIG_END + + +void sat_console_state::saturn_init_driver(int rgn) +{ + m_saturn_region = rgn; + m_vdp2.pal = (rgn == 12) ? 1 : 0; + + // set compatible options + m_maincpu->sh2drc_set_options(SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); + m_slave->sh2drc_set_options(SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); + + m_maincpu->sh2drc_add_fastram(0x00000000, 0x0007ffff, 1, &m_rom[0]); + m_maincpu->sh2drc_add_fastram(0x00200000, 0x002fffff, 0, &m_workram_l[0]); + m_maincpu->sh2drc_add_fastram(0x06000000, 0x060fffff, 0, &m_workram_h[0]); + m_slave->sh2drc_add_fastram(0x00000000, 0x0007ffff, 1, &m_rom[0]); + m_slave->sh2drc_add_fastram(0x00200000, 0x002fffff, 0, &m_workram_l[0]); + m_slave->sh2drc_add_fastram(0x06000000, 0x060fffff, 0, &m_workram_h[0]); + + /* amount of time to boost interleave for on MINIT / SINIT, needed for communication to work */ + m_minit_boost = 400; + m_sinit_boost = 400; + m_minit_boost_timeslice = attotime::zero; + m_sinit_boost_timeslice = attotime::zero; + + m_scu_regs = auto_alloc_array_clear(machine(), UINT32, 0x100/4); + m_scsp_regs = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_backupram = auto_alloc_array_clear(machine(), UINT8, 0x8000); +} + +DRIVER_INIT_MEMBER(sat_console_state,saturnus) +{ + saturn_init_driver(4); +} + +DRIVER_INIT_MEMBER(sat_console_state,saturneu) +{ + saturn_init_driver(12); +} + +DRIVER_INIT_MEMBER(sat_console_state,saturnjp) +{ + saturn_init_driver(1); +} + + +/* Japanese Saturn */ +ROM_START(saturnjp) + ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ + ROM_SYSTEM_BIOS(0, "101", "Japan v1.01 (941228)") + ROMX_LOAD("sega_101.bin", 0x00000000, 0x00080000, CRC(224b752c) SHA1(df94c5b4d47eb3cc404d88b33a8fda237eaf4720), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "1003", "Japan v1.003 (941012)") + ROMX_LOAD("sega1003.bin", 0x00000000, 0x00080000, CRC(b3c63c25) SHA1(7b23b53d62de0f29a23e423d0fe751dfb469c2fa), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "100", "Japan v1.00 (940921)") + ROMX_LOAD("sega_100.bin", 0x00000000, 0x00080000, CRC(2aba43c2) SHA1(2b8cb4f87580683eb4d760e4ed210813d667f0a2), ROM_BIOS(3)) + ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ + ROM_COPY( "maincpu",0,0,0x080000) +ROM_END + +/* Overseas Saturn */ +ROM_START(saturn) + ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ + ROM_SYSTEM_BIOS(0, "101a", "Overseas v1.01a (941115)") + /* Confirmed by ElBarto */ + ROMX_LOAD("mpr-17933.bin", 0x00000000, 0x00080000, CRC(4afcf0fa) SHA1(faa8ea183a6d7bbe5d4e03bb1332519800d3fbc3), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "100a", "Overseas v1.00a (941115)") + ROMX_LOAD("sega_100a.bin", 0x00000000, 0x00080000, CRC(f90f0089) SHA1(3bb41feb82838ab9a35601ac666de5aacfd17a58), ROM_BIOS(2)) + ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ + ROM_COPY( "maincpu",0,0,0x080000) +ROM_END + +ROM_START(saturneu) + ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ + ROM_SYSTEM_BIOS(0, "101a", "Overseas v1.01a (941115)") + /* Confirmed by ElBarto */ + ROMX_LOAD("mpr-17933.bin", 0x00000000, 0x00080000, CRC(4afcf0fa) SHA1(faa8ea183a6d7bbe5d4e03bb1332519800d3fbc3), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "100a", "Overseas v1.00a (941115)") + ROMX_LOAD("sega_100a.bin", 0x00000000, 0x00080000, CRC(f90f0089) SHA1(3bb41feb82838ab9a35601ac666de5aacfd17a58), ROM_BIOS(2)) + ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ + ROM_COPY( "maincpu",0,0,0x080000) +ROM_END + +ROM_START(vsaturn) + ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ + ROM_LOAD("vsaturn.bin", 0x00000000, 0x00080000, CRC(e4d61811) SHA1(4154e11959f3d5639b11d7902b3a393a99fb5776)) + ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ + ROM_COPY( "maincpu",0,0,0x080000) +ROM_END + +ROM_START(hisaturn) + ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ + ROM_SYSTEM_BIOS(0, "102", "v1.02 (950519)") + ROMX_LOAD( "mpr-18100.bin", 0x000000, 0x080000, CRC(3408dbf4) SHA1(8a22710e09ce75f39625894366cafe503ed1942d), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "101", "v1.01 (950130)") + ROMX_LOAD("hisaturn.bin", 0x00000000, 0x00080000, CRC(721e1b60) SHA1(49d8493008fa715ca0c94d99817a5439d6f2c796), ROM_BIOS(2)) + ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ + ROM_COPY( "maincpu",0,0,0x080000) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1994, saturn, 0, 0, saturnus, saturn, sat_console_state, saturnus, "Sega", "Saturn (USA)", MACHINE_NOT_WORKING ) +CONS( 1994, saturnjp, saturn, 0, saturnjp, saturn, sat_console_state, saturnjp, "Sega", "Saturn (Japan)", MACHINE_NOT_WORKING ) +CONS( 1994, saturneu, saturn, 0, saturneu, saturn, sat_console_state, saturneu, "Sega", "Saturn (PAL)", MACHINE_NOT_WORKING ) +CONS( 1995, vsaturn, saturn, 0, saturnjp, saturn, sat_console_state, saturnjp, "JVC", "V-Saturn", MACHINE_NOT_WORKING ) +CONS( 1995, hisaturn, saturn, 0, saturnjp, saturn, sat_console_state, saturnjp, "Hitachi", "HiSaturn", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/savia84.c b/src/mame/drivers/savia84.c new file mode 100644 index 00000000000..99949af89cd --- /dev/null +++ b/src/mame/drivers/savia84.c @@ -0,0 +1,201 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Savia 84 + + More data at : + http://www.nostalcomp.cz/pdfka/savia84.pdf + http://www.nostalcomp.cz/savia.php + + 05/02/2011 Skeleton driver. + 11/10/2011 Found a new rom. Working [Robbbert] + + I assume all the LEDs are red ones. The LEDs down the + left side I assume to be bit 0 through 7 in that order. + + Pasting: + 0-F : as is + DA : ^ + AD : - + GO : X + + Here is a test program. Copy the text and Paste into the emulator. + -1800^3E^55^D3^F9^76^XX1800^ + + ToDo: + - Make better artwork + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "savia84.lh" + + +class savia84_state : public driver_device +{ +public: + savia84_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ppi8255(*this, "ppi8255") + { } + + required_device m_maincpu; + required_device m_ppi8255; + DECLARE_READ8_MEMBER(savia84_8255_portc_r); + DECLARE_WRITE8_MEMBER(savia84_8255_porta_w); + DECLARE_WRITE8_MEMBER(savia84_8255_portb_w); + DECLARE_WRITE8_MEMBER(savia84_8255_portc_w); + UINT8 m_kbd; + UINT8 m_segment; + UINT8 m_digit; + UINT8 m_digit_last; + virtual void machine_reset(); +}; + +static ADDRESS_MAP_START( savia84_mem, AS_PROGRAM, 8, savia84_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x7fff) // A15 not connected at the CPU + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x1800, 0x1fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( savia84_io, AS_IO, 8, savia84_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x07) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // ports F8-FB +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( savia84 ) + PORT_START("X0") + PORT_BIT( 0x9F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_START("X1") + PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + + PORT_START("X2") + PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + + PORT_START("X3") + PORT_BIT( 0x9F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ex") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("X4") + PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BR") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + + PORT_START("X5") + PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + + PORT_START("X6") + PORT_BIT( 0x9F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + + PORT_START("X7") + PORT_BIT( 0x9F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + + PORT_START("X8") + PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') +INPUT_PORTS_END + + +void savia84_state::machine_reset() +{ + m_digit_last = 0; +} + +WRITE8_MEMBER( savia84_state::savia84_8255_porta_w ) // OUT F8 - output segments on the selected digit +{ + m_segment = ~data & 0x7f; + if (m_digit && (m_digit != m_digit_last)) output_set_digit_value(m_digit, m_segment); + m_digit_last = m_digit; +} + +WRITE8_MEMBER( savia84_state::savia84_8255_portb_w ) // OUT F9 - light the 8 leds down the left side +{ + char ledname[8]; + for (int i = 0; i < 8; i++) + { + sprintf(ledname,"led%d",i); + output_set_value(ledname, !BIT(data, i)); + } +} + +WRITE8_MEMBER( savia84_state::savia84_8255_portc_w ) // OUT FA - set keyboard scanning row; set digit to display +{ + m_digit = 0; + m_kbd = data & 15; + if (m_kbd == 0) + m_digit = 1; + else + if ((m_kbd > 1) && (m_kbd < 9)) + m_digit = m_kbd; +} + +READ8_MEMBER( savia84_state::savia84_8255_portc_r ) // IN FA - read keyboard +{ + if (m_kbd < 9) + { + char kbdrow[6]; + sprintf(kbdrow,"X%d",m_kbd); + return ioport(kbdrow)->read(); + } + else + return 0xff; +} + +static MACHINE_CONFIG_START( savia84, savia84_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz / 2) + MCFG_CPU_PROGRAM_MAP(savia84_mem) + MCFG_CPU_IO_MAP(savia84_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_savia84) + + /* Devices */ + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(savia84_state, savia84_8255_porta_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(savia84_state, savia84_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(savia84_state, savia84_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(savia84_state, savia84_8255_portc_w)) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( savia84 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("savia84.bin", 0x0000, 0x0800, CRC(fa8f1fcf) SHA1(b08404469ed988d96c0413416b6a66f3e5b997a3)) + + // Note - the below is a bad dump and does not work + //ROM_LOAD("savia84_1kb.bin", 0x0000, 0x0400, CRC(23a5c15e) SHA1(7e769ed8960d8c591a25cfe4effffcca3077c94b)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, savia84, 0, 0, savia84, savia84, driver_device, 0, "JT Hyan", "Savia 84", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/sbc6510.c b/src/mame/drivers/sbc6510.c new file mode 100644 index 00000000000..c345c2e9ede --- /dev/null +++ b/src/mame/drivers/sbc6510.c @@ -0,0 +1,326 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + SBC6510 from Josip Perusanec + + 18/12/2009 Skeleton driver. + 2012-08-12 Working [Robbbert] + + CPU MOS 6510 (1MHz) + ROM 4KB + RAM 128KB + CIA 6526 - for interrupt gen and scan of keyboard + YM2149/AY-3-8910 - sound + HDD/CF IDE + GAL16V8 - address decoder + ATMEGA8 - gen. of PAL video signal (modified TellyMate) + keyboard of C64 computer used + +Commands: +A - (unknown) +C - (unknown) +E - (unknown) +F - (unknown) +G - (unknown) +L - (unknown) +R - (unknown) +S - (unknown) + +Some commands expect a filename enclosed in double quotes. If the quotes +are not there, it loops forever looking for them. Good example of bad +programming. There is no help and no error messages. + +ToDo: + +- The ATMEGA8 is a CPU with Timer, 4 IO ports, UART, ADC, Watchdog all + built in. This enormously complex device needs to be emulated. It also + contains some (4k?) RAM, of which certain addresses have special meaning. + For example bytes 0 and 1 control the serial video stream of bits. + +- When the system boots, there is a Y in the top corner. This is actually + Esc-Y, which our terminal does not understand. + +- IDE interface. + +- Find out the proper way to use the monitor, there are no instructions + and the slightest mistake can freeze the system. + +- No software to test with. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6510.h" +#include "cpu/avr8/avr8.h" +#include "machine/mos6526.h" +#include "sound/ay8910.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class sbc6510_state : public driver_device +{ +public: + sbc6510_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_videocpu(*this, "videocpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_READ8_MEMBER(a2_r); + DECLARE_WRITE8_MEMBER(a2_w); + DECLARE_READ8_MEMBER(psg_a_r); + DECLARE_READ8_MEMBER(psg_b_r); + DECLARE_WRITE8_MEMBER(key_w); + DECLARE_READ8_MEMBER(key_r); + UINT8 m_term_data; + UINT8 m_key_row; + UINT8 m_2; + virtual void machine_start(); + virtual void machine_reset(); + +protected: + ioport_port *m_io_port[8]; + required_device m_maincpu; + required_device m_videocpu; + required_device m_terminal; +}; + + +static ADDRESS_MAP_START( sbc6510_mem, AS_PROGRAM, 8, sbc6510_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0001) AM_RAM + AM_RANGE(0x0002, 0x0002) AM_READWRITE(a2_r,a2_w) + AM_RANGE(0x0003, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xe00f) AM_MIRROR(0x1f0) AM_DEVREADWRITE("cia6526", mos6526_device, read, write) + AM_RANGE(0xe800, 0xe800) AM_MIRROR(0x1ff) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0xea00, 0xea00) AM_MIRROR(0x1ff) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sbc6510_video_mem, AS_PROGRAM, 8, sbc6510_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sbc6510_video_data, AS_DATA, 8, sbc6510_state ) + AM_RANGE(0x0100, 0x04ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sbc6510_video_io, AS_IO, 8, sbc6510_state ) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sbc6510 ) // cbm keyboard + PORT_START( "X0" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START( "X1" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START( "X2" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START( "X3" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START( "X4" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START( "X5" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + + PORT_START( "X6" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home Clr") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') + + PORT_START( "X7" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START( "X8" ) /* unused */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("MAIN") + PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + + +READ8_MEMBER( sbc6510_state::a2_r ) +{ + return m_2; +} + +WRITE8_MEMBER( sbc6510_state::a2_w ) +{ + m_2 = data; + m_terminal->write(space, 0, data); +} + +void sbc6510_state::machine_start() +{ + char kbdrow[6]; + for ( int i = 0; i < 8; i++ ) + { + sprintf(kbdrow,"X%X",i); + m_io_port[i] = ioport(kbdrow); + } +} + + +void sbc6510_state::machine_reset() +{ +} + +READ8_MEMBER( sbc6510_state::psg_a_r ) +{ + return 0xff; +} + +READ8_MEMBER( sbc6510_state::psg_b_r ) +{ + return 0x7f; +} + +READ8_MEMBER( sbc6510_state::key_r ) +{ + UINT8 data=0; + + for (int i = 0; i < 8; i++) + { + if (!BIT(m_key_row, i)) + { + data |= m_io_port[i]->read(); + } + } + return ~data; +} + +WRITE8_MEMBER( sbc6510_state::key_w ) +{ + m_key_row = data; +} + +static const gfx_layout charset_8x16 = +{ + 8, 9, + 256, + 1, + { 0 }, + { STEP8(0,1) }, + { 0*1024*2, 1*1024*2, 2*1024*2, 3*1024*2, 4*1024*2, 5*1024*2, 6*1024*2, 7*1024*2, 8*1024*2 }, + 8 +}; + + +static GFXDECODE_START( sbc6510 ) + GFXDECODE_ENTRY( "videocpu", 0x1500, charset_8x16, 0, 128 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( sbc6510, sbc6510_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6510, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(sbc6510_mem) + + MCFG_CPU_ADD("videocpu",ATMEGA88, XTAL_16MHz) +// MCFG_DEVICE_DISABLE() // trips SLEEP opcode, needs to be emulated + MCFG_CPU_PROGRAM_MAP(sbc6510_video_mem) + MCFG_CPU_DATA_MAP(sbc6510_video_data) + MCFG_CPU_IO_MAP(sbc6510_video_io) + MCFG_CPU_AVR8_EEPROM("eeprom") + + MCFG_GFXDECODE_ADD("gfxdecode", TERMINAL_TAG":palette", sbc6510) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_1MHz) + // Ports A and B connect to the IDE socket + MCFG_AY8910_PORT_A_READ_CB(READ8(sbc6510_state, psg_a_r)) // port A read + MCFG_AY8910_PORT_B_READ_CB(READ8(sbc6510_state, psg_b_r)) // port B read + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_DEVICE_ADD("cia6526", MOS6526, XTAL_1MHz) + MCFG_MOS6526_TOD(50) + MCFG_MOS6526_IRQ_CALLBACK(INPUTLINE("maincpu", M6510_IRQ_LINE)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(sbc6510_state, key_w)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(sbc6510_state, key_r)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sbc6510 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "sbc6510.rom", 0xf000, 0x1000, CRC(e13a5e62) SHA1(1e7482e9b98b39d0cc456254fbe8fd0981e9377e)) + ROM_REGION( 0x10000, "videocpu", ROMREGION_ERASEFF ) // ATMEGA8 at 16MHz + ROM_LOAD( "video.bin", 0x0000, 0x2000, CRC(809f31ce) SHA1(4639de5f7b8f6c036d74f217ba85e7e897039094)) + ROM_REGION( 0x200, "gal", ROMREGION_ERASEFF ) + ROM_LOAD( "sbc6510.gal", 0x0000, 0x0117, CRC(f78f9927) SHA1(b951163958f5722032826d0d17a07c81dbd5f68e)) + ROM_REGION( 0x2000, "eeprom", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 2009, sbc6510, 0, 0, sbc6510, sbc6510, driver_device, 0, "Josip Perusanec", "SBC6510", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/sbrain.c b/src/mame/drivers/sbrain.c new file mode 100644 index 00000000000..6c760eee0fe --- /dev/null +++ b/src/mame/drivers/sbrain.c @@ -0,0 +1,376 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/************************************************************************************************************ + +Intertec SuperBrain + +2013-08-19 Skeleton + +Chips: 2x Z80; FD1791; 2x 8251; 8255; BR1941; CRT8002; KR3600; DP8350 +Xtals: 16.0, 10.92, 5.0688 +Disk parameters: 512 bytes x 10 sectors x 35 tracks. 1 and 2-sided disks supported. +Sound: Beeper + +The boot prom is shared between both cpus. This feat is accomplished by holding the sub cpu + in reset, until the main cpu has prepared a few memory locations. The first thing in the rom + is to check these locations, and then program flow splits into 2 sections, one for each cpu. +The main cpu does a busreq to gain access to the sub cpu's 1k static ram. When the sub cpu + responds with busack, then the main cpu switches bank2. In emulation, it isn't actually + necessary to stop the sub cpu because of other handshaking. Our Z80 emulation doesn't + support the busack signal anyway, so we just assume it is granted immediately. + +The schematic in parts is difficult to read. Some assumptions have been made. + +To Do: +- Without a disk in, it should display a message to insert a disk. Doesn't happen. + It thinks a disk is in and tries to execute garbage in the disk buffer instead. +- Port 08 is largely a guess. +- No work done on the keyboard. Should be able to hook up the generic ascii keyboard. +- No software available to try. +- Bug in floppy code means the motor will turn off after a few seconds. It should stay on. +- Video chips need to be emulated (CRT8002 and DP8350), attributes etc. +- After each line of characters, an interrupt should be generated. 25 IRQs per screen. +- Hook the outputs of the baud rate generator to the uarts. +- Probably lots of other stuff. + +*************************************************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/wd_fdc.h" +#include "machine/i8251.h" +#include "machine/i8255.h" +#include "machine/com8116.h" +#include "sound/beep.h" + +class sbrain_state : public driver_device +{ +public: + sbrain_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "subcpu"), + m_beep(*this, "beeper"), + m_brg(*this, "brg"), + m_u0(*this, "uart0"), + m_u1(*this, "uart1"), + m_ppi(*this, "ppi"), + m_fdc (*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_vs(*this, "VS"), + m_bankr0(*this, "bankr0"), + m_bankw0(*this, "bankw0"), + m_bank2(*this, "bank2") {} + +public: + const UINT8 *m_p_chargen; + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; + DECLARE_DRIVER_INIT(sbrain); + DECLARE_MACHINE_RESET(sbrain); + DECLARE_READ8_MEMBER(ppi_pa_r); + DECLARE_WRITE8_MEMBER(ppi_pa_w); + DECLARE_READ8_MEMBER(ppi_pb_r); + DECLARE_WRITE8_MEMBER(ppi_pb_w); + DECLARE_READ8_MEMBER(ppi_pc_r); + DECLARE_WRITE8_MEMBER(ppi_pc_w); + DECLARE_READ8_MEMBER(port08_r); + DECLARE_WRITE8_MEMBER(port08_w); + DECLARE_WRITE8_MEMBER(baud_w); + DECLARE_WRITE_LINE_MEMBER(fr_w); + DECLARE_WRITE_LINE_MEMBER(ft_w); +private: + UINT8 m_porta; + UINT8 m_portb; + UINT8 m_portc; + UINT8 m_port08; + required_device m_maincpu; + required_device m_subcpu; + required_device m_beep; + required_device m_brg; + required_device m_u0; + required_device m_u1; + required_device m_ppi; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_ioport m_vs; + required_memory_bank m_bankr0; + required_memory_bank m_bankw0; + required_memory_bank m_bank2; +}; + +static ADDRESS_MAP_START( sbrain_mem, AS_PROGRAM, 8, sbrain_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE( 0x4000, 0x7fff ) AM_RAM + AM_RANGE( 0x8000, 0xbfff ) AM_RAMBANK("bank2") + AM_RANGE( 0xc000, 0xf7ff ) AM_RAM + AM_RANGE( 0xf800, 0xffff ) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sbrain_io, AS_IO, 8, sbrain_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x40) AM_MIRROR(6) AM_DEVREADWRITE("uart0", i8251_device, data_r, data_w) + AM_RANGE(0x41, 0x41) AM_MIRROR(6) AM_DEVREADWRITE("uart0", i8251_device, status_r, control_w) + //AM_RANGE(0x48, 0x4f) chr_int_latch + //AM_RANGE(0x50, 0x57) key_in + AM_RANGE(0x58, 0x58) AM_MIRROR(6) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) + AM_RANGE(0x59, 0x59) AM_MIRROR(6) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) + AM_RANGE(0x60, 0x67) AM_WRITE(baud_w) + AM_RANGE(0x68, 0x6b) AM_MIRROR(4) AM_DEVREADWRITE("ppi", i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sbrain_submem, AS_PROGRAM, 8, sbrain_state ) + AM_RANGE( 0x0000, 0x07ff ) AM_ROM + AM_RANGE( 0x8800, 0x8bff ) AM_RAM AM_REGION("subcpu", 0x8800) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sbrain_subio, AS_IO, 8, sbrain_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r,port08_w) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", fd1791_t, read, write) +ADDRESS_MAP_END + +// bit 0 is wrong, maybe the whole byte is wrong +READ8_MEMBER( sbrain_state::port08_r ) +{ + return m_port08; +} + +/* Misc disk functions +d0 : disk busy? +d1 : SEL A (drive 0?) +d2 : SEL B (drive 1?) +d3 : SEL C +d4 : SEL D +d5 : side select +d6,7 : not used +*/ +WRITE8_MEMBER( sbrain_state::port08_w ) +{ + m_port08 = data | 0xc0; + + floppy_image_device *floppy = NULL; + if (BIT(m_port08, 1)) floppy = m_floppy0->get_device(); + if (BIT(m_port08, 2)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->ss_w(BIT(m_port08, 5)); // might need inverting + } + + // refresh motor on, hopefully this will keep them turning + m_floppy0->get_device()->mon_w(0); // motors run all the time + m_floppy1->get_device()->mon_w(0); +} + +WRITE_LINE_MEMBER( sbrain_state::fr_w ) +{ +} + +WRITE_LINE_MEMBER( sbrain_state::ft_w ) +{ +} + +WRITE8_MEMBER( sbrain_state::baud_w ) +{ + m_brg->str_w(data & 0x0f); + m_brg->stt_w(data >> 4); +} + +READ8_MEMBER( sbrain_state::ppi_pa_r ) +{ + return m_porta; +} + +/* Video functions: +d0,1 : 11 = alphanumeric; 10 = external ;other = graphics +d2 : Underline +d3,4 : not used +d5 : strike through +d6 : 1=60hz 0=50hz +d7 : reverse video +*/ +WRITE8_MEMBER( sbrain_state::ppi_pa_w ) +{ + m_porta = data; +} + +/* Inputs +d0 : data ready from keyboard +d1 : key held down +d2 : Vert Blank +d3 : not used +d4 : /capslock +d5 : disk is busy +d6 : Ring Indicator line from main rs232 port, 1=normal, 0=set +d7 : cpu2 /busak line +*/ +READ8_MEMBER( sbrain_state::ppi_pb_r ) +{ + return m_portb | 0x50 | m_vs->read() | (BIT(m_port08, 0) << 5) | ((UINT8)BIT(m_portc, 5) << 7); +} + +WRITE8_MEMBER( sbrain_state::ppi_pb_w ) +{ + m_portb = data & 8; +} + +READ8_MEMBER( sbrain_state::ppi_pc_r ) +{ + return m_portc; +} + +/* System +d0 : 1 = bank 0 disabled +d1 : character blanking +d2 : 1=enable rom, 0=enable ram bank 0 +d3 : cpu2 reset line +d4 : 1=enable ram bank 2, 0=bank 2 uses disk buffer +d5 : cpu2 /busreq line +d6 : beeper +d7 : keyboard, 1=enable comms, 0=reset +*/ +WRITE8_MEMBER( sbrain_state::ppi_pc_w ) +{ + m_portc = data; + m_beep->set_state(BIT(data, 6)); + m_bankr0->set_entry(BIT(data, 2)); + m_bank2->set_entry(BIT(data, 4)); + + m_subcpu->set_input_line(INPUT_LINE_RESET, BIT(data, 3) ? ASSERT_LINE : CLEAR_LINE); +} + +static INPUT_PORTS_START( sbrain ) + /* vblank */ + PORT_START("VS") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") +INPUT_PORTS_END + +DRIVER_INIT_MEMBER( sbrain_state, sbrain ) +{ + UINT8 *main = memregion("maincpu")->base(); + UINT8 *sub = memregion("subcpu")->base(); + + m_bankr0->configure_entry(0, &main[0x0000]); + m_bankr0->configure_entry(1, &sub[0x0000]); + m_bankw0->configure_entry(0, &main[0x0000]); + m_bank2->configure_entry(0, &sub[0x8000]); + m_bank2->configure_entry(1, &main[0x8000]); +} + +static SLOT_INTERFACE_START( sbrain_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +MACHINE_RESET_MEMBER( sbrain_state, sbrain ) +{ + m_beep->set_frequency(800); + m_p_chargen = memregion("chargen")->base(); + m_bankr0->set_entry(1); // point at rom + m_bankw0->set_entry(0); // always write to ram + m_bank2->set_entry(1); // point at maincpu bank + m_subcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // hold subcpu in reset +} + +UINT32 sbrain_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 24; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 80; x++) + { + gfx = 0; + if (ra < 9) + { + chr = m_p_videoram[x+ma]; + + if (chr) gfx = m_p_chargen[(chr<<4) | ra ]; + } + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=80; + } + return 0; +} + +static MACHINE_CONFIG_START( sbrain, sbrain_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(sbrain_mem) + MCFG_CPU_IO_MAP(sbrain_io) + MCFG_MACHINE_RESET_OVERRIDE(sbrain_state, sbrain) + MCFG_CPU_ADD("subcpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(sbrain_submem) + MCFG_CPU_IO_MAP(sbrain_subio) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(sbrain_state, screen_update) + MCFG_SCREEN_SIZE(640, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* Devices */ + MCFG_DEVICE_ADD("ppi", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(sbrain_state, ppi_pa_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(sbrain_state, ppi_pa_w)) + MCFG_I8255_IN_PORTB_CB(READ8(sbrain_state, ppi_pb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(sbrain_state, ppi_pb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(sbrain_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(sbrain_state, ppi_pc_w)) + + MCFG_DEVICE_ADD("uart0", I8251, 0) + + MCFG_DEVICE_ADD("uart1", I8251, 0) + + MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(sbrain_state, fr_w)) + MCFG_COM8116_FT_HANDLER(WRITELINE(sbrain_state, ft_w)) + + MCFG_FD1791_ADD("fdc", XTAL_16MHz / 16) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", sbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", sbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + +ROM_START( sbrain ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x10000, "subcpu", ROMREGION_ERASEFF ) + ROM_LOAD( "superbrain.bin", 0x0000, 0x0800, CRC(b6a2e6a5) SHA1(a646faaecb9ac45ee1a42764628e8971524d5c13) ) + + // Using the chargen from 'c10' for now. + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + +COMP( 1981, sbrain, 0, 0, sbrain, sbrain, sbrain_state, sbrain, "Intertec", "Superbrain", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/sc1.c b/src/mame/drivers/sc1.c new file mode 100644 index 00000000000..18a8d05dda4 --- /dev/null +++ b/src/mame/drivers/sc1.c @@ -0,0 +1,200 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Schachcomputer SC1 + + 12/05/2009 Skeleton driver. + +ToDo: +- speaker +- LEDs +- 7seg sometimes flashes + +Port 80-83 could be a device + +This happens at the start: +'maincpu' (04EF): unmapped i/o memory write to 0081 = 0F & FF +'maincpu' (04F3): unmapped i/o memory write to 0083 = CF & FF +'maincpu' (04F7): unmapped i/o memory write to 0083 = BB & FF +'maincpu' (04FB): unmapped i/o memory write to 0082 = 01 & FF +'maincpu' (0523): unmapped i/o memory write to 00FC = 02 & FF ** +'maincpu' (0523): unmapped i/o memory write to 00FC = 04 & FF ** + +** These two happen for a while (making a tone from a speaker?) + +Then: +'maincpu' (0523): unmapped i/o memory write to 00FC = 00 & FF +'maincpu' (0075): unmapped i/o memory write to 0080 = 02 & FF +'maincpu' (0523): unmapped i/o memory write to 00FC = 20 & FF + +Then this happens continuously: +Port 80 out - 00, 02, FF +Port FC out - 00, 01, 02, 04, 08, 10, 20, 40, 80 (selecting rows?) +Port 80 in - upper byte = 20 thru 26 +Port 82 in - upper byte = 0 thru 7 + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "machine/z80pio.h" +#include "sc1.lh" + + +class sc1_state : public driver_device +{ +public: + sc1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker") + { } + + required_device m_maincpu; + required_device m_speaker; + + DECLARE_WRITE8_MEMBER( matrix_w ); + DECLARE_WRITE8_MEMBER( pio_port_a_w ); + DECLARE_READ8_MEMBER( pio_port_b_r ); + + UINT8 m_matrix; +}; + +/*************************************************************************** + + Display + +***************************************************************************/ + +WRITE8_MEMBER( sc1_state::pio_port_a_w ) +{ + UINT8 digit = BITSWAP8( data,3,4,6,0,1,2,7,5 ); + + if (m_matrix & 0x04) + output_set_digit_value(3, digit & 0x7f); + if (m_matrix & 0x08) + output_set_digit_value(2, digit & 0x7f); + if (m_matrix & 0x10) + output_set_digit_value(1, digit & 0x7f); + if (m_matrix & 0x20) + output_set_digit_value(0, digit & 0x7f); +} + + +/*************************************************************************** + + Keyboard + +***************************************************************************/ + +WRITE8_MEMBER( sc1_state::matrix_w ) +{ + m_matrix = data; +} + +READ8_MEMBER( sc1_state::pio_port_b_r ) +{ + UINT8 data = 0; + + if (m_matrix & 0x01) + data |= ioport("LINE1")->read(); + if (m_matrix & 0x02) + data |= ioport("LINE2")->read(); + if (m_matrix & 0x04) + data |= ioport("LINE3")->read(); + if (m_matrix & 0x08) + data |= ioport("LINE4")->read(); + if (m_matrix & 0x10) + data |= ioport("LINE5")->read(); + if (m_matrix & 0x20) + data |= ioport("LINE6")->read(); + if (m_matrix & 0x40) + data |= ioport("LINE7")->read(); + if (m_matrix & 0x80) + data |= ioport("LINE8")->read(); + + return data; +} + + +static ADDRESS_MAP_START(sc1_mem, AS_PROGRAM, 8, sc1_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_ROM + AM_RANGE( 0x4000, 0x43ff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sc1_io, AS_IO, 8, sc1_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE(0xfc, 0xfc) AM_WRITE(matrix_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sc1 ) + PORT_START("LINE1") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) + + PORT_START("LINE2") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) + + PORT_START("LINE3") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) + + PORT_START("LINE4") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) + + PORT_START("LINE5") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE") PORT_CODE(KEYCODE_DEL) + + PORT_START("LINE6") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) + + PORT_START("LINE7") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_O) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("W/S") PORT_CODE(KEYCODE_W) + + PORT_START("LINE8") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_M) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( sc1, sc1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(sc1_mem) + MCFG_CPU_IO_MAP(sc1_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_sc1) + + /* devices */ + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(sc1_state, pio_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(sc1_state, pio_port_b_r)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sc1 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "sc1.rom", 0x0000, 0x1000, CRC(26965b23) SHA1(01568911446eda9f05ec136df53da147b7c6f2bf)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, sc1, 0, 0, sc1, sc1, driver_device, 0, "VEB Mikroelektronik Erfurt", "Schachcomputer SC1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/sc2.c b/src/mame/drivers/sc2.c new file mode 100644 index 00000000000..2eb3455c1f7 --- /dev/null +++ b/src/mame/drivers/sc2.c @@ -0,0 +1,238 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Schachcomputer SC2 + + Note: + The HW is very similar to Fidelity Chess Challenger series (see fidelz80.c) + + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80pio.h" +#include "sound/beep.h" +#include "sc2.lh" + +class sc2_state : public driver_device +{ +public: + sc2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_beep(*this, "beeper") + , + m_maincpu(*this, "maincpu") { } + + required_device m_beep; + DECLARE_READ8_MEMBER(pio_port_a_r); + DECLARE_READ8_MEMBER(pio_port_b_r); + DECLARE_WRITE8_MEMBER(pio_port_a_w); + DECLARE_WRITE8_MEMBER(pio_port_b_w); + DECLARE_READ8_MEMBER(sc2_beep); + UINT8 m_kp_matrix; + UINT8 m_led_7seg_data[4]; + UINT8 m_led_selected; + UINT8 m_digit_data; + UINT8 m_beep_state; + void sc2_update_display(); + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; +}; + +READ8_MEMBER( sc2_state::sc2_beep ) +{ + //if (!space.debugger_access()) + { + m_beep_state = ~m_beep_state; + + m_beep->set_state(m_beep_state); + } + + return 0xff; +} + +static ADDRESS_MAP_START(sc2_mem, AS_PROGRAM, 8, sc2_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0fff ) AM_ROM + AM_RANGE( 0x1000, 0x13ff ) AM_RAM + AM_RANGE( 0x2000, 0x33ff ) AM_ROM + AM_RANGE( 0x3c00, 0x3c00 ) AM_READ(sc2_beep) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sc2_io, AS_IO, 8, sc2_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_MIRROR(0xfc) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sc2 ) + PORT_START("LINE1") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_UNUSED + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + + PORT_START("LINE2") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) + + PORT_START("LINE3") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) + + PORT_START("LINE4") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_O) +INPUT_PORTS_END + +void sc2_state::machine_start() +{ + save_item(NAME(m_led_7seg_data)); + save_item(NAME(m_kp_matrix)); + save_item(NAME(m_led_selected)); + save_item(NAME(m_digit_data)); + save_item(NAME(m_beep_state)); +} + +void sc2_state::machine_reset() +{ + m_kp_matrix = 0; + m_led_selected = 0; + m_digit_data = 0; + m_beep_state = 0; + memset(m_led_7seg_data, 0, ARRAY_LENGTH(m_led_7seg_data)); +} + +void sc2_state::sc2_update_display() +{ + UINT8 digit_data = BITSWAP8( m_digit_data,7,0,1,2,3,4,5,6 ) & 0x7f; + + if (!BIT(m_led_selected, 0)) + { + output_set_digit_value(0, digit_data); + m_led_7seg_data[0] = digit_data; + + output_set_led_value(0, BIT(m_digit_data, 7)); + } + + if (!BIT(m_led_selected, 1)) + { + output_set_digit_value(1, digit_data); + m_led_7seg_data[1] = digit_data; + + output_set_led_value(1, BIT(m_digit_data, 7)); + } + + if (!BIT(m_led_selected, 2)) + { + output_set_digit_value(2, digit_data); + m_led_7seg_data[2] = digit_data; + } + + if (!BIT(m_led_selected, 3)) + { + output_set_digit_value(3, digit_data); + m_led_7seg_data[3] = digit_data; + } +} + +READ8_MEMBER( sc2_state::pio_port_a_r ) +{ + return m_digit_data; +} + +READ8_MEMBER( sc2_state::pio_port_b_r ) +{ + UINT8 data = m_led_selected & 0x0f; + + if (BIT(m_kp_matrix, 0)) + { + data |= ioport("LINE1")->read(); + } + + if (BIT(m_kp_matrix, 1)) + { + data |= ioport("LINE2")->read(); + } + + if (BIT(m_kp_matrix, 2)) + { + data |= ioport("LINE3")->read(); + } + + if (BIT(m_kp_matrix, 3)) + { + data |= ioport("LINE4")->read(); + } + + return data; +} + +WRITE8_MEMBER( sc2_state::pio_port_a_w ) +{ + m_digit_data = data; +} + +WRITE8_MEMBER( sc2_state::pio_port_b_w ) +{ + if (data != 0xf1 && data != 0xf2 && data != 0xf4 && data != 0xf8) + { + m_led_selected = data; + sc2_update_display(); + } + else + m_kp_matrix = data; +} + +static MACHINE_CONFIG_START( sc2, sc2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(sc2_mem) + MCFG_CPU_IO_MAP(sc2_io) + + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_sc2) + + /* devices */ + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) + MCFG_Z80PIO_IN_PA_CB(READ8(sc2_state, pio_port_a_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(sc2_state, pio_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(sc2_state, pio_port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(sc2_state, pio_port_b_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 0.50 ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sc2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bm008.bin", 0x0000, 0x0400, CRC(3023ea82) SHA1(07020d153d802c672c39e1af3c716dbe35e23f08)) + ROM_LOAD( "bm009.bin", 0x0400, 0x0400, CRC(6a34814e) SHA1(e58ae6615297b028db135a48a8f9e186a4220f4f)) + ROM_LOAD( "bm010.bin", 0x0800, 0x0400, CRC(deab0373) SHA1(81c9a7197eef8d9131e47ecd2ec35b943caee54e)) + ROM_LOAD( "bm011.bin", 0x0c00, 0x0400, CRC(c8282339) SHA1(8d6b8861281e967a77609b6d77e80afd47d28ed2)) + ROM_LOAD( "bm012.bin", 0x2000, 0x0400, CRC(2e6a4294) SHA1(7b9bd191c9ec73139a65c3a339ab88e1f3eb5ed2)) + ROM_LOAD( "bm013.bin", 0x2400, 0x0400, CRC(3e02eb42) SHA1(2e4a9a8fd04c202c9518550d7e8cf9bfea394153)) + ROM_LOAD( "bm014.bin", 0x2800, 0x0400, CRC(538d449e) SHA1(c4186995b69e97740e01eaff84a20d49d03d180f)) + ROM_LOAD( "bm015.bin", 0x2c00, 0x0400, CRC(b4991dca) SHA1(6a6cdddf5c4afa24773acf693f58c34b99c8d328)) + ROM_LOAD( "bm016.bin", 0x3000, 0x0400, CRC(4fe0853a) SHA1(c2253e320778b0ea468fb54f26ae83d07f9700e6)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, sc2, 0, 0, sc2, sc2, driver_device, 0, "VEB Mikroelektronik Erfurt", "Schachcomputer SC2", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/drivers/scorpion.c b/src/mame/drivers/scorpion.c new file mode 100644 index 00000000000..897cd6ff054 --- /dev/null +++ b/src/mame/drivers/scorpion.c @@ -0,0 +1,377 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic + +#include "emu.h" +#include "includes/spectrum.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/ay8910.h" +#include "sound/speaker.h" +#include "formats/tzx_cas.h" +#include "machine/beta.h" +#include "machine/ram.h" + +class scorpion_state : public spectrum_state +{ +public: + scorpion_state(const machine_config &mconfig, device_type type, const char *tag) + : spectrum_state(mconfig, type, tag) + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_bank4(*this, "bank4") + , m_beta(*this, BETA_DISK_TAG) + { } + + DECLARE_DIRECT_UPDATE_MEMBER(scorpion_direct); + DECLARE_WRITE8_MEMBER(scorpion_0000_w); + DECLARE_WRITE8_MEMBER(scorpion_port_7ffd_w); + DECLARE_WRITE8_MEMBER(scorpion_port_1ffd_w); + DECLARE_MACHINE_START(scorpion); + DECLARE_MACHINE_RESET(scorpion); + TIMER_DEVICE_CALLBACK_MEMBER(nmi_check_callback); +protected: + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_device m_beta; +private: + UINT8 *m_p_ram; + void scorpion_update_memory(); + +}; + +/****************************************************************************************************/ +/* Zs Scorpion 256 */ + +/* +port 7ffd. full compatibility with Zx spectrum 128. digits are: + +D0-D2 - number of RAM page to put in C000-FFFF +D3 - switch of address for RAM of screen. 0 - 4000, 1 - c000 +D4 - switch of ROM : 0-zx128, 1-zx48 +D5 - 1 in this bit will block further output in port 7FFD, until reset. +*/ + +/* +port 1ffd - additional port for resources of computer. + +D0 - block of ROM in 0-3fff. when set to 1 - allows read/write page 0 of RAM +D1 - selects ROM expansion. this rom contains main part of service monitor. +D2 - not used +D3 - used for output in RS-232C +D4 - extended RAM. set to 1 - connects RAM page with number 8-15 in + C000-FFFF. number of page is given in gidits D0-D2 of port 7FFD +D5 - signal of strobe for interface centronics. to form the strobe has to be + set to 1. +D6-D7 - not used. ( yet ? ) +*/ + +/* rom 0=zx128, 1=zx48, 2 = service monitor, 3=tr-dos */ + +void scorpion_state::scorpion_update_memory() +{ + UINT8 *messram = m_ram->pointer(); + + m_screen_location = messram + ((m_port_7ffd_data & 8) ? (7<<14) : (5<<14)); + + m_bank4->set_base(messram + (((m_port_7ffd_data & 0x07) | ((m_port_1ffd_data & 0x10)>>1)) * 0x4000)); + + if ((m_port_1ffd_data & 0x01)==0x01) + { + m_ram_0000 = messram+(8<<14); + m_bank1->set_base(messram+(8<<14)); + logerror("RAM\n"); + } + else + { + if ((m_port_1ffd_data & 0x02)==0x02) + m_ROMSelection = 2; + else + m_ROMSelection = BIT(m_port_7ffd_data, 4); + + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); + } +} + +WRITE8_MEMBER(scorpion_state::scorpion_0000_w) +{ + if ( ! m_ram_0000 ) + return; + + if ((m_port_1ffd_data & 0x01)==0x01) + { + if ( ! m_ram_disabled_by_beta ) + m_ram_0000[offset] = data; + } +} + + +DIRECT_UPDATE_MEMBER(scorpion_state::scorpion_direct) +{ + UINT16 pc = m_maincpu->device_t::safe_pcbase(); // works, but... + + m_ram_disabled_by_beta = 0; + if (m_beta->is_active() && (pc >= 0x4000)) + { + m_ROMSelection = BIT(m_port_7ffd_data, 4); + m_beta->disable(); + m_ram_disabled_by_beta = 1; + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); + } + else + if (((pc & 0xff00) == 0x3d00) && (m_ROMSelection==1)) + { + m_ROMSelection = 3; + m_beta->enable(); + } + + if(address<=0x3fff) + { + m_ram_disabled_by_beta = 1; + direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x10000 + (m_ROMSelection<<14)]); + m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); + return ~0; + } + + return address; +} + +TIMER_DEVICE_CALLBACK_MEMBER(scorpion_state::nmi_check_callback) +{ + if ((m_io_nmi->read() & 1)==1) + { + m_port_1ffd_data |= 0x02; + scorpion_update_memory(); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } +} + +WRITE8_MEMBER(scorpion_state::scorpion_port_7ffd_w) +{ + /* disable paging */ + if (m_port_7ffd_data & 0x20) + return; + + /* store new state */ + m_port_7ffd_data = data; + + /* update memory */ + scorpion_update_memory(); +} + +WRITE8_MEMBER(scorpion_state::scorpion_port_1ffd_w) +{ + m_port_1ffd_data = data; + scorpion_update_memory(); +} + +static ADDRESS_MAP_START (scorpion_io, AS_IO, 8, scorpion_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, status_r, command_w) AM_MIRROR(0xff00) + AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, track_r, track_w) AM_MIRROR(0xff00) + AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, sector_r, sector_w) AM_MIRROR(0xff00) + AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, data_r, data_w) AM_MIRROR(0xff00) + AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) + AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, state_r, param_w) AM_MIRROR(0xff00) + AM_RANGE(0x4021, 0x4021) AM_WRITE(scorpion_port_7ffd_w) AM_MIRROR(0x3fdc) + AM_RANGE(0x8021, 0x8021) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3fdc) + AM_RANGE(0xc021, 0xc021) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3fdc) + AM_RANGE(0x0021, 0x0021) AM_WRITE(scorpion_port_1ffd_w) AM_MIRROR(0x3fdc) +ADDRESS_MAP_END + + +MACHINE_RESET_MEMBER(scorpion_state,scorpion) +{ + UINT8 *messram = m_ram->pointer(); + address_space &space = m_maincpu->space(AS_PROGRAM); + m_p_ram = memregion("maincpu")->base(); + + m_ram_0000 = NULL; + space.install_read_bank(0x0000, 0x3fff, "bank1"); + space.install_write_handler(0x0000, 0x3fff, write8_delegate(FUNC(scorpion_state::scorpion_0000_w),this)); + + m_beta->disable(); + space.set_direct_update_handler(direct_update_delegate(FUNC(scorpion_state::scorpion_direct), this)); + + memset(messram,0,256*1024); + + /* Bank 5 is always in 0x4000 - 0x7fff */ + m_bank2->set_base(messram + (5<<14)); + + /* Bank 2 is always in 0x8000 - 0xbfff */ + m_bank3->set_base(messram + (2<<14)); + + m_port_7ffd_data = 0; + m_port_1ffd_data = 0; + scorpion_update_memory(); +} +MACHINE_START_MEMBER(scorpion_state,scorpion) +{ +} + + +/* F4 Character Displayer */ +static const gfx_layout spectrum_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 96, /* 96 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout quorum_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 160, /* 160 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout profi_8_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 224, /* 224 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( scorpion ) + GFXDECODE_ENTRY( "maincpu", 0x17d00, spectrum_charlayout, 0, 8 ) +GFXDECODE_END + +static GFXDECODE_START( profi ) + GFXDECODE_ENTRY( "maincpu", 0x17d00, spectrum_charlayout, 0, 8 ) + GFXDECODE_ENTRY( "maincpu", 0x1abfc, profi_8_charlayout, 0, 8 ) + /* There are more characters after this, that haven't been decoded */ +GFXDECODE_END + +static GFXDECODE_START( quorum ) + GFXDECODE_ENTRY( "maincpu", 0x1fb00, quorum_charlayout, 0, 8 ) +GFXDECODE_END + +static MACHINE_CONFIG_DERIVED_CLASS( scorpion, spectrum_128, scorpion_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(scorpion_io) + + MCFG_MACHINE_START_OVERRIDE(scorpion_state, scorpion ) + MCFG_MACHINE_RESET_OVERRIDE(scorpion_state, scorpion ) + MCFG_GFXDECODE_MODIFY("gfxdecode", scorpion) + + MCFG_BETA_DISK_ADD(BETA_DISK_TAG) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", scorpion_state, nmi_check_callback, attotime::from_hz(50)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( profi, scorpion ) + MCFG_GFXDECODE_MODIFY("gfxdecode", profi) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( quorum, scorpion ) + MCFG_GFXDECODE_MODIFY("gfxdecode", quorum) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(scorpio) + ROM_REGION(0x90000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "v1", "V.2.92") + ROMX_LOAD("scorp0.rom", 0x010000, 0x4000, CRC(0eb40a09) SHA1(477114ff0fe1388e0979df1423602b21248164e5), ROM_BIOS(1)) + ROMX_LOAD("scorp1.rom", 0x014000, 0x4000, CRC(9d513013) SHA1(367b5a102fb663beee8e7930b8c4acc219c1f7b3), ROM_BIOS(1)) + ROMX_LOAD("scorp2.rom", 0x018000, 0x4000, CRC(fd0d3ce1) SHA1(07783ee295274d8ff15d935bfd787c8ac1d54900), ROM_BIOS(1)) + ROMX_LOAD("scorp3.rom", 0x01c000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "V.2.92 joined") + ROMX_LOAD( "scorpion.rom", 0x010000, 0x10000, CRC(fef73c28) SHA1(66cecdadf992d8adb9c66deee929eb56600dc9bc), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v3", "V.2.94") + ROMX_LOAD( "scorp294.rom", 0x010000, 0x10000, CRC(99f57ce1) SHA1(083bb57ad52cc871b92d3e1794fd9790872c3584), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v4", "SMUC V.4.02") + ROMX_LOAD( "scorp402.rom", 0x010000, 0x20000, CRC(9fcf893d) SHA1(0cc7ba60f5cfc36e75bd3a5c90e26b2a1905a970), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v5", "ProfROM V.3.9f") + ROMX_LOAD( "prof_39f.rom", 0x010000, 0x20000, CRC(c55e64da) SHA1(cec7770fe26350f57f6c325a29db78787dc4521e), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "v6", "ProfROM V.4.01") + ROMX_LOAD( "profrom.rom", 0x010000, 0x80000, CRC(b02d89de) SHA1(4cb85341e2a400e0e88869304d80af430266cdd1), ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "v7", "NeOS 256") + ROMX_LOAD("neos_256.rom", 0x010000, 0x4000, CRC(364ae09a) SHA1(bb6db1947415503a6bc48f33c603fb3a0dbb3690), ROM_BIOS(7)) + ROMX_LOAD("scorp1.rom", 0x014000, 0x4000, CRC(9d513013) SHA1(367b5a102fb663beee8e7930b8c4acc219c1f7b3), ROM_BIOS(7)) + ROMX_LOAD("scorp2.rom", 0x018000, 0x4000, CRC(fd0d3ce1) SHA1(07783ee295274d8ff15d935bfd787c8ac1d54900), ROM_BIOS(7)) + ROMX_LOAD("scorp3.rom", 0x01c000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db), ROM_BIOS(7)) + + ROM_REGION(0x01000, "keyboard", 0) + ROM_LOAD( "scrpkey.rom", 0x0000, 0x1000, CRC(e938a510) SHA1(2753993c97ff0fc6cff26ed792929abc1288dc6f)) + + ROM_REGION(0x010000, "gsound", 0) + ROM_LOAD( "gs104.rom", 0x0000, 0x8000, CRC(7a365ba6) SHA1(c865121306eb3a7d811d82fbcc653b4dc1d6fa3d)) + ROM_LOAD( "gs105a.rom", 0x8000, 0x8000, CRC(1cd490c6) SHA1(1ba78923dc7d803e7995c165992e14e4608c2153)) +ROM_END + +ROM_START(profi) + ROM_REGION(0x020000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "v1", "ver 1") + ROMX_LOAD( "profi.rom", 0x010000, 0x10000, CRC(285a0985) SHA1(2b33ab3561e7bc5997da7f0d3a2a906fe7ea960f), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "ver 2") + ROMX_LOAD( "profi_my.rom", 0x010000, 0x10000, CRC(2ffd6cd9) SHA1(1b74a3251358c5f102bb87654f47b02281e15e9c), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v3", "ver 3") + ROMX_LOAD( "profi-p1.rom", 0x010000, 0x10000, CRC(537ddb81) SHA1(00a23e8dc722b248d4f98cb14a600ce7487f2b9c), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "v4", "ver 4") + ROMX_LOAD( "profi_1.rom", 0x010000, 0x10000, CRC(f07fbee8) SHA1(b29c81a94658a4d50274ba953775a49e855534de), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "v5", "T-Rex") + ROMX_LOAD( "profi-p.rom", 0x010000, 0x10000, CRC(314f6b57) SHA1(1507f53ec64dcf5154b5cfce6922f69f70296a53), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "v6", "JV Kramis V0.2") + ROMX_LOAD( "profi32.rom", 0x010000, 0x10000, CRC(77327f52) SHA1(019bd00cc7939741d99b99beac6ae1298652e652), ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "v7", "Power Of Sound Group") + ROMX_LOAD( "profi1k.rom", 0x010000, 0x10000, CRC(a932676f) SHA1(907ac56219f325949a7c2fe8168799d9cdd5ba6c), ROM_BIOS(7)) +ROM_END + +ROM_START(quorum) + ROM_REGION(0x020000, "maincpu", 0) + ROM_LOAD("qu7v42.rom", 0x010000, 0x10000, CRC(e950eee5) SHA1(f8e22672722b0038689c6c8bc4acf5392acc9d8c)) +ROM_END + +ROM_START(bestzx) + ROM_REGION(0x020000, "maincpu", 0) + ROM_LOAD( "bestzx.rom", 0x010000, 0x10000, CRC(fc7936e8) SHA1(0d6378c51b2f08a3e2b4c75e64c76c15ae5dc76d)) +ROM_END + +ROM_START( kay1024 ) + ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "v1", "ver 1") + ROMX_LOAD( "kay98.rom", 0x010000, 0x08000, CRC(7fbf2d43) SHA1(e555f2ed01ecf2231d493bd70a4d79b436e9f10e), ROM_BIOS(1)) + ROMX_LOAD( "trd503.rom", 0x01c000, 0x04000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "Kramis V0.2") + ROMX_LOAD( "kay1024b.rom", 0x010000, 0x10000, CRC(ab99c31e) SHA1(cfa9e6553aea72956fce4f0130c007981d684734), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v3", "Kramis V0.3") + ROMX_LOAD( "kay1024s.rom", 0x010000, 0x10000, CRC(67351caa) SHA1(1d9c0606b380c000ca1dfa33f90a122ecf9df1f1), ROM_BIOS(3)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP( 1994, scorpio, spec128, 0, scorpion, spec_plus, driver_device, 0, "Zonov and Co.", "Scorpion ZS-256", 0 ) +COMP( 1991, profi, spec128, 0, profi, spec_plus, driver_device, 0, "Kondor and Kramis", "Profi", MACHINE_NOT_WORKING ) +COMP( 1998, kay1024, spec128, 0, scorpion, spec_plus, driver_device, 0, "NEMO", "Kay 1024", MACHINE_NOT_WORKING ) +COMP( 19??, quorum, spec128, 0, quorum, spec_plus, driver_device, 0, "", "Quorum", MACHINE_NOT_WORKING ) +COMP( 19??, bestzx, spec128, 0, scorpion, spec_plus, driver_device, 0, "", "BestZX", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/scv.c b/src/mame/drivers/scv.c new file mode 100644 index 00000000000..20101807b25 --- /dev/null +++ b/src/mame/drivers/scv.c @@ -0,0 +1,719 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + Driver for Epoch Super Cassette Vision + +***************************************************************************/ + +#include "emu.h" +#include "cpu/upd7810/upd7810.h" +#include "audio/upd1771.h" +#include "bus/scv/slot.h" +#include "bus/scv/rom.h" + + +class scv_state : public driver_device +{ +public: + scv_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_videoram(*this,"videoram"), + m_maincpu(*this, "maincpu"), + m_upd1771c(*this, "upd1771c"), + m_cart(*this, "cartslot"), + m_pa(*this, "PA"), + m_pc0(*this, "PC0"), + m_charrom(*this, "charrom") { } + + DECLARE_WRITE8_MEMBER(porta_w); + DECLARE_READ8_MEMBER(portb_r); + DECLARE_READ8_MEMBER(portc_r); + DECLARE_WRITE8_MEMBER(portc_w); + DECLARE_WRITE_LINE_MEMBER(upd1771_ack_w); + required_shared_ptr m_videoram; + UINT8 m_porta; + UINT8 m_portc; + emu_timer *m_vb_timer; + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(scv); + UINT32 screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + enum + { + TIMER_VB + }; + + required_device m_maincpu; + required_device m_upd1771c; + required_device m_cart; + required_ioport_array<8> m_pa; + required_ioport m_pc0; + required_memory_region m_charrom; + + ioport_port *m_key[8]; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + void scv_set_banks(); + inline void plot_sprite_part( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 pat, UINT8 col, UINT8 screen_sprite_start_line ); + inline void draw_sprite( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y, UINT8 screen_sprite_start_line ); + inline void draw_text( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 *char_data, UINT8 fg, UINT8 bg ); + inline void draw_semi_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 data, UINT8 fg ); + inline void draw_block_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 col ); +}; + + +static ADDRESS_MAP_START( scv_mem, AS_PROGRAM, 8, scv_state ) + AM_RANGE( 0x0000, 0x0fff ) AM_ROM // BIOS + + AM_RANGE( 0x2000, 0x3403 ) AM_RAM AM_SHARE("videoram") // VRAM + 4 registers + AM_RANGE( 0x3600, 0x3600 ) AM_DEVWRITE("upd1771c", upd1771c_device, write) + + AM_RANGE( 0x8000, 0xff7f ) AM_DEVREADWRITE("cartslot", scv_cart_slot_device, read_cart, write_cart) // cartridge + AM_RANGE( 0xff80, 0xffff ) AM_RAM // upd7801 internal RAM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( scv_io, AS_IO, 8, scv_state ) + AM_RANGE( 0x00, 0x00 ) AM_WRITE(porta_w) + AM_RANGE( 0x01, 0x01 ) AM_READ(portb_r) + AM_RANGE( 0x02, 0x02 ) AM_READWRITE(portc_r, portc_w) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( scv ) + PORT_START( "PA.0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "PA.1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "PA.2" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) + + PORT_START( "PA.3" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) + + PORT_START( "PA.4" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) + + PORT_START( "PA.5" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) + + PORT_START( "PA.6" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) + + PORT_START( "PA.7" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Cl") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("En") PORT_CODE(KEYCODE_PLUS_PAD) + + PORT_START( "PC0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_O) +INPUT_PORTS_END + + +WRITE8_MEMBER( scv_state::porta_w ) +{ + m_porta = data; +} + + +READ8_MEMBER( scv_state::portb_r ) +{ + UINT8 data = 0xff; + + for (int i = 0; i < 8; i++) + { + if (!BIT(m_porta, i)) + data &= m_pa[i]->read(); + } + + return data; +} + + +READ8_MEMBER( scv_state::portc_r ) +{ + UINT8 data = m_portc; + + data = (data & 0xfe) | (m_pc0->read() & 0x01); + + return data; +} + + +WRITE8_MEMBER( scv_state::portc_w ) +{ + //logerror("%04x: scv_portc_w: data = 0x%02x\n", m_maincpu->pc(), data ); + m_portc = data; + m_cart->write_bank(space, 0, m_portc); + m_upd1771c->pcm_write(m_portc & 0x08); +} + + +PALETTE_INIT_MEMBER(scv_state, scv) +{ + /* + SCV Epoch-1A chip RGB voltage readouts from paused Bios color test: + + (values in millivolts) + + R G B + 0 29 29 325 + 1 29 27 22 + 2 25 24 510 + 3 337 28 508 + 4 29 515 22 + 5 336 512 329 + 6 26 515 511 + 7 29 337 25 + 8 520 24 22 + 9 517 338 21 + 10 520 25 512 + 11 521 336 333 + 12 518 515 21 + 13 342 336 22 + 14 337 336 330 + 15 516 511 508 + + Only tree 'bins' of values are obviously captured + 25 ish + 330 ish + 520 ish. + + Quamtizing/scaling/rounding between 0 and 255 we thus get: + + */ + palette.set_pen_color( 0, 0, 0, 155); + palette.set_pen_color( 1, 0, 0, 0); + palette.set_pen_color( 2, 0, 0, 255); + palette.set_pen_color( 3, 161, 0, 255); + palette.set_pen_color( 4, 0, 255, 0); + palette.set_pen_color( 5, 160, 255, 157); + palette.set_pen_color( 6, 0, 255, 255); + palette.set_pen_color( 7, 0, 161, 0); + palette.set_pen_color( 8, 255, 0, 0); + palette.set_pen_color( 9, 255, 161, 0); + palette.set_pen_color( 10, 255, 0, 255); + palette.set_pen_color( 11, 255, 160, 159); + palette.set_pen_color( 12, 255, 255, 0); + palette.set_pen_color( 13, 163, 160, 0); + palette.set_pen_color( 14, 161, 160, 157); + palette.set_pen_color( 15, 255, 255, 255); +} + + +void scv_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_VB: + { + int vpos = machine().first_screen()->vpos(); + + switch( vpos ) + { + case 240: + m_maincpu->set_input_line(UPD7810_INTF2, ASSERT_LINE); + break; + case 0: + m_maincpu->set_input_line(UPD7810_INTF2, CLEAR_LINE); + break; + } + + m_vb_timer->adjust(machine().first_screen()->time_until_pos((vpos + 1) % 262, 0)); + } + break; + + default: + assert_always(FALSE, "Unknown id in scv_state::device_timer"); + } +} + + +inline void scv_state::plot_sprite_part( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 pat, UINT8 col, UINT8 screen_sprite_start_line ) +{ + if ( x < 4 ) + { + return; + } + + x -= 4; + + if ( y + 2 >= screen_sprite_start_line ) + { + if ( pat & 0x08 ) + { + bitmap.pix16(y + 2, x ) = col; + } + if ( pat & 0x04 && x < 255 ) + { + bitmap.pix16(y + 2, x + 1 ) = col; + } + if ( pat & 0x02 && x < 254 ) + { + bitmap.pix16(y + 2, x + 2 ) = col; + } + if ( pat & 0x01 && x < 253 ) + { + bitmap.pix16(y + 2, x + 3 ) = col; + } + } +} + + +inline void scv_state::draw_sprite( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y, UINT8 screen_sprite_start_line ) +{ + int j; + + y += clip_y * 2; + for ( j = clip_y * 4; j < 32; j += 4 ) + { + UINT8 pat0 = m_videoram[ tile_idx * 32 + j + 0 ]; + UINT8 pat1 = m_videoram[ tile_idx * 32 + j + 1 ]; + UINT8 pat2 = m_videoram[ tile_idx * 32 + j + 2 ]; + UINT8 pat3 = m_videoram[ tile_idx * 32 + j + 3 ]; + + if ( ( top && j < 16 ) || ( bottom && j >= 16 ) ) + { + if ( left ) + { + plot_sprite_part( bitmap, x , y, pat0 >> 4, col, screen_sprite_start_line ); + plot_sprite_part( bitmap, x + 4, y, pat1 >> 4, col, screen_sprite_start_line ); + } + if ( right ) + { + plot_sprite_part( bitmap, x + 8, y, pat2 >> 4, col, screen_sprite_start_line ); + plot_sprite_part( bitmap, x + 12, y, pat3 >> 4, col, screen_sprite_start_line ); + } + + if ( left ) + { + plot_sprite_part( bitmap, x , y + 1, pat0 & 0x0f, col, screen_sprite_start_line ); + plot_sprite_part( bitmap, x + 4, y + 1, pat1 & 0x0f, col, screen_sprite_start_line ); + } + if ( right ) + { + plot_sprite_part( bitmap, x + 8, y + 1, pat2 & 0x0f, col, screen_sprite_start_line ); + plot_sprite_part( bitmap, x + 12, y + 1, pat3 & 0x0f, col, screen_sprite_start_line ); + } + } + + y += 2; + } +} + + +inline void scv_state::draw_text( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 *char_data, UINT8 fg, UINT8 bg ) +{ + int i; + + for ( i = 0; i < 8; i++ ) + { + UINT8 d = char_data[i]; + + bitmap.pix16(y + i, x + 0 ) = ( d & 0x80 ) ? fg : bg; + bitmap.pix16(y + i, x + 1 ) = ( d & 0x40 ) ? fg : bg; + bitmap.pix16(y + i, x + 2 ) = ( d & 0x20 ) ? fg : bg; + bitmap.pix16(y + i, x + 3 ) = ( d & 0x10 ) ? fg : bg; + bitmap.pix16(y + i, x + 4 ) = ( d & 0x08 ) ? fg : bg; + bitmap.pix16(y + i, x + 5 ) = ( d & 0x04 ) ? fg : bg; + bitmap.pix16(y + i, x + 6 ) = ( d & 0x02 ) ? fg : bg; + bitmap.pix16(y + i, x + 7 ) = ( d & 0x01 ) ? fg : bg; + } + + for ( i = 8; i < 16; i++ ) + { + bitmap.pix16(y + i, x + 0 ) = bg; + bitmap.pix16(y + i, x + 1 ) = bg; + bitmap.pix16(y + i, x + 2 ) = bg; + bitmap.pix16(y + i, x + 3 ) = bg; + bitmap.pix16(y + i, x + 4 ) = bg; + bitmap.pix16(y + i, x + 5 ) = bg; + bitmap.pix16(y + i, x + 6 ) = bg; + bitmap.pix16(y + i, x + 7 ) = bg; + } + +} + + +inline void scv_state::draw_semi_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 data, UINT8 fg ) +{ + int i; + + if ( ! data ) + return; + + for ( i = 0; i < 4; i++ ) + { + bitmap.pix16(y + i, x + 0) = fg; + bitmap.pix16(y + i, x + 1) = fg; + bitmap.pix16(y + i, x + 2) = fg; + bitmap.pix16(y + i, x + 3) = fg; + } +} + + +inline void scv_state::draw_block_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 col ) +{ + int i; + + for ( i = 0; i < 8; i++ ) + { + bitmap.pix16(y + i, x + 0) = col; + bitmap.pix16(y + i, x + 1) = col; + bitmap.pix16(y + i, x + 2) = col; + bitmap.pix16(y + i, x + 3) = col; + bitmap.pix16(y + i, x + 4) = col; + bitmap.pix16(y + i, x + 5) = col; + bitmap.pix16(y + i, x + 6) = col; + bitmap.pix16(y + i, x + 7) = col; + } +} + + +UINT32 scv_state::screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y; + UINT8 fg = m_videoram[0x1403] >> 4; + UINT8 bg = m_videoram[0x1403] & 0x0f; + UINT8 gr_fg = m_videoram[0x1401] >> 4; + UINT8 gr_bg = m_videoram[0x1401] & 0x0f; + int clip_x = ( m_videoram[0x1402] & 0x0f ) * 2; + int clip_y = m_videoram[0x1402] >> 4; + + /* Clear the screen */ + bitmap.fill(gr_bg , cliprect); + + /* Draw background */ + for ( y = 0; y < 16; y++ ) + { + int text_y = 0; + + if ( y < clip_y ) + { + text_y = ( m_videoram[0x1400] & 0x80 ) ? 0 : 1; + } + else + { + text_y = ( m_videoram[0x1400] & 0x80 ) ? 1 : 0; + } + + for ( x = 0; x < 32; x++ ) + { + int text_x = 0; + UINT8 d = m_videoram[ 0x1000 + y * 32 + x ]; + + if ( x < clip_x ) + { + text_x = ( m_videoram[0x1400] & 0x40 ) ? 0 : 1; + } + else + { + text_x = ( m_videoram[0x1400] & 0x40 ) ? 1 : 0; + } + + if ( text_x && text_y ) + { + /* Text mode */ + UINT8 *char_data = m_charrom->base() + ( d & 0x7f ) * 8; + draw_text( bitmap, x * 8, y * 16, char_data, fg, bg ); + } + else + { + switch ( m_videoram[0x1400] & 0x03 ) + { + case 0x01: /* Semi graphics mode */ + draw_semi_graph( bitmap, x * 8 , y * 16 , d & 0x80, gr_fg ); + draw_semi_graph( bitmap, x * 8 + 4, y * 16 , d & 0x40, gr_fg ); + draw_semi_graph( bitmap, x * 8 , y * 16 + 4, d & 0x20, gr_fg ); + draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 4, d & 0x10, gr_fg ); + draw_semi_graph( bitmap, x * 8 , y * 16 + 8, d & 0x08, gr_fg ); + draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 8, d & 0x04, gr_fg ); + draw_semi_graph( bitmap, x * 8 , y * 16 + 12, d & 0x02, gr_fg ); + draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 12, d & 0x01, gr_fg ); + break; + + case 0x03: /* Block graphics mode */ + draw_block_graph( bitmap, x * 8, y * 16 , d >> 4 ); + draw_block_graph( bitmap, x * 8, y * 16 + 8, d & 0x0f ); + break; + + default: /* Otherwise draw nothing? */ + break; + } + } + } + } + + /* Draw sprites if enabled */ + if ( m_videoram[0x1400] & 0x10 ) + { + UINT8 screen_start_sprite_line = ( ( ( m_videoram[0x1400] & 0xf7 ) == 0x17 ) && ( ( m_videoram[0x1402] & 0xef ) == 0x4f ) ) ? 21 + 32 : 0 ; + int i; + + for ( i = 0; i < 128; i++ ) + { + UINT8 spr_y = m_videoram[ 0x1200 + i * 4 ] & 0xfe; + UINT8 y_32 = m_videoram[ 0x1200 + i * 4 ] & 0x01; /* Xx32 sprite */ + UINT8 clip = m_videoram[ 0x1201 + i * 4 ] >> 4; + UINT8 col = m_videoram[ 0x1201 + i * 4 ] & 0x0f; + UINT8 spr_x = m_videoram[ 0x1202 + i * 4 ] & 0xfe; + UINT8 x_32 = m_videoram[ 0x1202 + i * 4 ] & 0x01; /* 32xX sprite */ + UINT8 tile_idx = m_videoram[ 0x1203 + i * 4 ] & 0x7f; + UINT8 half = m_videoram[ 0x1203 + i * 4] & 0x80; + UINT8 left = 1; + UINT8 right = 1; + UINT8 top = 1; + UINT8 bottom = 1; + + if ( !col ) + { + continue; + } + + if ( !spr_y ) + { + continue; + } + + if ( half ) + { + if ( tile_idx & 0x40 ) + { + if ( y_32 ) + { + spr_y -= 8; + top = 0; + bottom = 1; + y_32 = 0; + } + else + { + top = 1; + bottom = 0; + } + } + if ( x_32 ) + { + spr_x -= 8; + left = 0; + right = 1; + x_32 = 0; + } + else + { + left = 1; + right = 0; + } + } + + /* Check if 2 color sprites are enabled */ + if ( ( m_videoram[0x1400] & 0x20 ) && ( i & 0x20 ) ) + { + /* 2 color sprite handling */ + draw_sprite( bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip, screen_start_sprite_line ); + if ( x_32 || y_32 ) + { + static const UINT8 spr_2col_lut0[16] = { 0, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 1, 1 }; + static const UINT8 spr_2col_lut1[16] = { 0, 1, 8, 11, 2, 3, 10, 9, 4, 5, 12, 13, 6, 7, 14, 15 }; + + draw_sprite( bitmap, spr_x, spr_y, tile_idx ^ ( 8 * x_32 + y_32 ), ( i & 0x40 ) ? spr_2col_lut1[col] : spr_2col_lut0[col], left, right, top, bottom, clip, screen_start_sprite_line ); + } + } + else + { + /* regular sprite handling */ + draw_sprite( bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip, screen_start_sprite_line ); + if ( x_32 ) + { + draw_sprite( bitmap, spr_x + 16, spr_y, tile_idx | 8, col, 1, 1, top, bottom, clip, screen_start_sprite_line ); + } + + if ( y_32 ) + { + clip = ( clip & 0x08 ) ? ( clip & 0x07 ) : 0; + draw_sprite( bitmap, spr_x, spr_y + 16, tile_idx | 1, col, left, right, 1, 1, clip, screen_start_sprite_line ); + if ( x_32 ) + { + draw_sprite( bitmap, spr_x + 16, spr_y + 16, tile_idx | 9, col, 1, 1, 1, 1, clip, screen_start_sprite_line ); + } + } + } + } + } + + return 0; +} + + +WRITE_LINE_MEMBER( scv_state::upd1771_ack_w ) +{ + m_maincpu->set_input_line(UPD7810_INTF1, (state) ? ASSERT_LINE : CLEAR_LINE); +} + +void scv_state::machine_start() +{ + m_vb_timer = timer_alloc(TIMER_VB); + + save_item(NAME(m_porta)); + save_item(NAME(m_portc)); + if (m_cart->exists()) + m_cart->save_ram(); + +} + + +void scv_state::machine_reset() +{ + m_vb_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); +} + + +/* F4 Character Displayer */ +static const gfx_layout scv_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( scv ) + GFXDECODE_ENTRY( "charrom", 0x0000, scv_charlayout, 0, 8 ) +GFXDECODE_END + + +static SLOT_INTERFACE_START(scv_cart) + SLOT_INTERFACE_INTERNAL("rom8k", SCV_ROM8K) + SLOT_INTERFACE_INTERNAL("rom16k", SCV_ROM16K) + SLOT_INTERFACE_INTERNAL("rom32k", SCV_ROM32K) + SLOT_INTERFACE_INTERNAL("rom32k_ram", SCV_ROM32K_RAM8K) + SLOT_INTERFACE_INTERNAL("rom64k", SCV_ROM64K) + SLOT_INTERFACE_INTERNAL("rom128k", SCV_ROM128K) + SLOT_INTERFACE_INTERNAL("rom128k_ram", SCV_ROM128K_RAM4K) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( scv, scv_state ) + + MCFG_CPU_ADD( "maincpu", UPD7801, XTAL_4MHz ) + MCFG_CPU_PROGRAM_MAP( scv_mem ) + MCFG_CPU_IO_MAP( scv_io ) + + /* Video chip is EPOCH TV-1 */ + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_RAW_PARAMS( XTAL_14_31818MHz/2, 456, 24, 24+192, 262, 23, 23+222 ) /* TODO: Verify */ + MCFG_SCREEN_UPDATE_DRIVER(scv_state, screen_update_scv) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", scv) + MCFG_PALETTE_ADD( "palette", 16 ) + MCFG_PALETTE_INIT_OWNER(scv_state, scv) + + /* Sound is generated by UPD1771C clocked at XTAL_6MHz */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD( "upd1771c", UPD1771C, XTAL_6MHz ) + MCFG_UPD1771_ACK_HANDLER(WRITELINE(scv_state, upd1771_ack_w)) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + + MCFG_SCV_CARTRIDGE_ADD("cartslot", scv_cart, NULL) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","scv") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( scv_pal, scv ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_CLOCK( 3780000 ) + + /* Video chip is EPOCH TV-1A */ + MCFG_SCREEN_MODIFY( "screen" ) + MCFG_SCREEN_RAW_PARAMS( XTAL_13_4MHz/2, 456, 24, 24+192, 342, 23, 23+222 ) /* TODO: Verify */ +MACHINE_CONFIG_END + + +/* The same bios is used in both the NTSC and PAL versions of the console */ +ROM_START( scv ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "upd7801g.s01", 0, 0x1000, CRC(7ac06182) SHA1(6e89d1227581c76441a53d605f9e324185f1da33) ) + + ROM_REGION( 0x400, "charrom", 0 ) + ROM_LOAD( "epochtv.chr", 0, 0x400, BAD_DUMP CRC(db521533) SHA1(40b4e44838c35191f115437a14f200f052e71509) ) +ROM_END + + +ROM_START( scv_pal ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "upd7801g.s01", 0, 0x1000, CRC(7ac06182) SHA1(6e89d1227581c76441a53d605f9e324185f1da33) ) + + ROM_REGION( 0x400, "charrom", 0 ) + ROM_LOAD( "epochtv.chr", 0, 0x400, BAD_DUMP CRC(db521533) SHA1(40b4e44838c35191f115437a14f200f052e71509) ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1984, scv, 0, 0, scv, scv, driver_device, 0, "Epoch", "Super Cassette Vision", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +CONS( 198?, scv_pal, scv, 0, scv_pal, scv, driver_device, 0, "Yeno", "Super Cassette Vision (PAL)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/sdk80.c b/src/mame/drivers/sdk80.c new file mode 100644 index 00000000000..34fb057518a --- /dev/null +++ b/src/mame/drivers/sdk80.c @@ -0,0 +1,205 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes,Ryan Holtz +/*************************************************************************** + + Intel SDK-80 + +This is an evaluation kit for the 8080 cpu. + +There is no speaker or storage facility in the standard kit. + +Download the User Manual to get the operating procedures. + +Monitor Commands: +D Display memory contents +G Go to address (execute program at address) +I Insert hex code +M Move blocks of memory +S Substitute memory locations +X Examine registers + +Please note this rom set boots into BASIC, not monitor. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8251.h" +#include "machine/clock.h" +#include "bus/rs232/rs232.h" +//#include "machine/ay31015.h" + +#define I8251A_TAG "usart" +#define I8251A_BAUD_TAG "usart_baud" +#define RS232_TAG "rs232" + +class sdk80_state : public driver_device +{ +public: + sdk80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_usart(*this, I8251A_TAG) + , m_rs232(*this, RS232_TAG) + , m_usart_baud_rate(*this, I8251A_BAUD_TAG) + , m_usart_divide_counter(0) + , m_usart_clock_state(0) + { } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE_LINE_MEMBER( usart_clock_tick ); + +private: + required_device m_maincpu; + required_device m_usart; + required_device m_rs232; + required_ioport m_usart_baud_rate; + + UINT8 m_usart_divide_counter; + UINT8 m_usart_clock_state; +}; + +static ADDRESS_MAP_START(sdk80_mem, AS_PROGRAM, 8, sdk80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x3c00, 0x3fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sdk80_io, AS_IO, 8, sdk80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xec, 0xec) AM_DEVREADWRITE(I8251A_TAG, i8251_device, data_r, data_w) + AM_RANGE(0xed, 0xed) AM_DEVREADWRITE(I8251A_TAG, i8251_device, status_r, control_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( sdk80 ) + PORT_START(I8251A_BAUD_TAG) + PORT_DIPNAME( 0x3f, 0x01, "i8251 Baud Rate" ) + PORT_DIPSETTING( 0x01, "4800") + PORT_DIPSETTING( 0x02, "2400") + PORT_DIPSETTING( 0x04, "1200") + PORT_DIPSETTING( 0x08, "600") + PORT_DIPSETTING( 0x10, "300") + PORT_DIPSETTING( 0x20, "150") + PORT_DIPSETTING( 0x40, "75") +INPUT_PORTS_END + +#if 0 +/* Graphics Output */ +const gfx_layout sdk80_charlayout = +{ + 7, 8, /* character cell is 7 pixels wide by 8 pixels high */ + 64, /* 64 characters in 2513 character generator ROM */ + 1, /* 1 bitplane */ + { 0 }, + /* 5 visible pixels per row, starting at bit 3, with MSB being 0: */ + { 3, 4, 5, 6, 7 }, + /* pixel rows stored from top to bottom: */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8 * 8 /* 8 8-bit pixel rows per character */ +}; + +static GFXDECODE_START( sdk80 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, sdk80_charlayout, 0, 1 ) +GFXDECODE_END +#endif + +UINT32 sdk80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +WRITE_LINE_MEMBER( sdk80_state::usart_clock_tick ) +{ + UINT8 old_counter = m_usart_divide_counter; + m_usart_divide_counter++; + + UINT8 transition = (old_counter ^ m_usart_divide_counter) & m_usart_baud_rate->read(); + if (transition) + { + m_usart->write_txc(m_usart_clock_state); + m_usart->write_rxc(m_usart_clock_state); + m_usart_clock_state ^= 1; + } +} + +static MACHINE_CONFIG_START( sdk80, sdk80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080A, XTAL_18_432MHz/9) + MCFG_CPU_PROGRAM_MAP(sdk80_mem) + MCFG_CPU_IO_MAP(sdk80_io) + + MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "null_modem") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_dsr)) + + MCFG_DEVICE_ADD("usart_clock", CLOCK, XTAL_18_432MHz/60) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sdk80_state, usart_clock_tick)) + + /* video hardware */ + // 96364 crt controller + +// MCFG_SCREEN_ADD("screen", RASTER) +// MCFG_SCREEN_REFRESH_RATE(60) + /* Video is blanked for 70 out of 262 scanlines per refresh cycle. + Each scanline is composed of 65 character times, 40 of which + are visible, and each character time is 7 dot times; a dot time + is 2 cycles of the fundamental 14.31818 MHz oscillator. The + total blanking time is about 4450 microseconds. */ +// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((int) (70 * 65 * 7 * 2 / 14.31818))) + /* It would be nice if we could implement some sort of display + overscan here. */ +// MCFG_SCREEN_SIZE(40 * 7, 24 * 8) +// MCFG_SCREEN_VISIBLE_AREA(0, 40 * 7 - 1, 0, 24 * 8 - 1) +// MCFG_SCREEN_UPDATE_DRIVER(sdk80_state, screen_update) +// MCFG_SCREEN_PALETTE("palette") + +// MCFG_GFXDECODE_ADD("gfxdecode", "palette", sdk80) + +// MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + // Video board UART +// MCFG_DEVICE_ADD( "hd6402", AY31015, 0 ) +// MCFG_AY31015_TX_CLOCK(( XTAL_16MHz / 16 ) / 256) +// MCFG_AY31015_RX_CLOCK(( XTAL_16MHz / 16 ) / 256) +// MCFG_AY51013_READ_SI_CB(READ8(sdk80_state, nascom1_hd6402_si)) +// MCFG_AY51013_WRITE_SO_CB(WRITE8(sdk80_state, nascom1_hd6402_so)) + + /* Devices */ +// MCFG_DEVICE_ADD("i8279", I8279, 3100000) // based on divider +// MCFG_I8279_OUT_IRQ_CB(INPUTLINE("maincpu", I8085_RST55_LINE)) // irq +// MCFG_I8279_OUT_SL_CB(WRITE8(sdk80_state, scanlines_w)) // scan SL lines +// MCFG_I8279_OUT_DISP_CB(WRITE8(sdk80_state, digit_w)) // display A&B +// MCFG_I8279_IN_RL_CB(READ8(sdk80_state, kbd_r)) // kbd RL lines +// MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key +// MCFG_I8279_IN_CTRL_CB(VCC) + + //MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0) + //MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(sdk80_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sdk80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "basic_blc_1.a14", 0x0000, 0x0400, CRC(b5e75aee) SHA1(6bd1eb9586d72544e8afb4ae43ecedcefa14da33)) + ROM_LOAD( "basic_blc_2.a15", 0x0400, 0x0400, CRC(0a9ad1ed) SHA1(92c47eadcf8b18eeedcccaa3deb9f1518aaceeae)) + ROM_LOAD( "basic_blc_3.a16", 0x0800, 0x0400, CRC(bc898e4b) SHA1(adc000534db0f736a75fbceed360dc220e02c30d)) + ROM_LOAD( "basic_blc_4.a17", 0x0c00, 0x0400, CRC(568e8b6d) SHA1(22960193d3b0ae1b5d876d8c3b3f3b40db01358c)) + + /* 512-byte Signetics 2513 character generator ROM at location D2-D3 */ + ROM_REGION(0x0200, "gfx1",0) + ROM_LOAD("s2513.d2", 0x0000, 0x0200, CRC(a7e567fc) SHA1(b18aae0a2d4f92f5a7e22640719bbc4652f3f4ee)) + + /* 256x4 PROM located on the video board, schematic location P7, to be moved into separate device later */ + ROM_REGION( 0x0120, "proms", 0 ) + ROM_LOAD( "6300__d7.p7", 0x0020, 0x0100, CRC(3eb3a8e4) SHA1(19097b5f60d1030f8b82d9f1d3a241f93e5c75d6) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1975, sdk80, 0, 0, sdk80, sdk80, driver_device, 0, "Intel", "SDK-80", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/sdk85.c b/src/mame/drivers/sdk85.c new file mode 100644 index 00000000000..8438add6efe --- /dev/null +++ b/src/mame/drivers/sdk85.c @@ -0,0 +1,145 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Intel SDK-85 + + 09/12/2009 Skeleton driver. + + 22/06/2011 Working [Robbbert] + +This is an evaluation kit for the 8085 cpu. + +There is no speaker or storage facility in the standard kit. + +Download the User Manual to get the operating procedures. + +An example is Press SUBST key, enter an address, press NEXT key, enter data, +then press NEXT to increment the address. + +ToDo: +- Artwork + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8279.h" +#include "sdk85.lh" + + +class sdk85_state : public driver_device +{ +public: + sdk85_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_WRITE8_MEMBER(scanlines_w); + DECLARE_WRITE8_MEMBER(digit_w); + DECLARE_READ8_MEMBER(kbd_r); + UINT8 m_digit; + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(sdk85_mem, AS_PROGRAM, 8, sdk85_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM // Monitor rom (A14) + AM_RANGE(0x0800, 0x0fff) AM_ROM // Expansion rom (A15) + AM_RANGE(0x1800, 0x1800) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w ) + AM_RANGE(0x1900, 0x1900) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) + //AM_RANGE(0x1800, 0x1fff) AM_RAM // i8279 (A13) + AM_RANGE(0x2000, 0x27ff) AM_RAM // i8155 (A16) + AM_RANGE(0x2800, 0x2fff) AM_RAM // i8155 (A17) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sdk85_io, AS_IO, 8, sdk85_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sdk85 ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXEC") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SUBST") PORT_CODE(KEYCODE_T) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXAM") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SINGLE") PORT_CODE(KEYCODE_U) + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +WRITE8_MEMBER( sdk85_state::scanlines_w ) +{ + m_digit = data; +} + +WRITE8_MEMBER( sdk85_state::digit_w ) +{ + if (m_digit < 6) + output_set_digit_value(m_digit, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4)^0xff); +} + +READ8_MEMBER( sdk85_state::kbd_r ) +{ + UINT8 data = 0xff; + + if (m_digit < 3) + { + char kbdrow[6]; + sprintf(kbdrow,"X%X",m_digit); + data = ioport(kbdrow)->read(); + } + return data; +} + +static MACHINE_CONFIG_START( sdk85, sdk85_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8085A, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(sdk85_mem) + MCFG_CPU_IO_MAP(sdk85_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_sdk85) + + /* Devices */ + MCFG_DEVICE_ADD("i8279", I8279, 3100000) // based on divider + MCFG_I8279_OUT_IRQ_CB(INPUTLINE("maincpu", I8085_RST55_LINE)) // irq + MCFG_I8279_OUT_SL_CB(WRITE8(sdk85_state, scanlines_w)) // scan SL lines + MCFG_I8279_OUT_DISP_CB(WRITE8(sdk85_state, digit_w)) // display A&B + MCFG_I8279_IN_RL_CB(READ8(sdk85_state, kbd_r)) // kbd RL lines + MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key + MCFG_I8279_IN_CTRL_CB(VCC) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sdk85 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "sdk85.a14", 0x0000, 0x0800, CRC(9d5a983f) SHA1(54e218560fbec009ac3de5cfb64b920241ef2eeb)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, sdk85, 0, 0, sdk85, sdk85, driver_device, 0, "Intel", "SDK-85", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/sdk86.c b/src/mame/drivers/sdk86.c new file mode 100644 index 00000000000..c895211950a --- /dev/null +++ b/src/mame/drivers/sdk86.c @@ -0,0 +1,212 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu, Robbbert +/*************************************************************************** + + Intel SDK-86 + + 12/05/2009 Skeleton driver by Micko + 29/11/2009 Some fleshing out by Lord Nightmare + 22/06/2011 Working [Robbbert] + + TODO: + Add optional 2x 8255A port read/write logging + + + +This is an evaluation kit for the 8086 cpu. + +There is no speaker or storage facility in the standard kit. + +Download the User Manual to get the operating procedures. +The user manual is available from: http://www.bitsavers.org/pdf/intel/8086/9800698A_SDK-86_Users_Man_Apr79.pdf + +ToDo: +- Artwork +- Add INTR and RESET keys + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/i86/i86.h" +#include "machine/clock.h" +#include "machine/i8251.h" +#include "machine/i8279.h" +#include "sdk86.lh" + +#define I8251_TAG "i8251" +#define RS232_TAG "rs232" + + +class sdk86_state : public driver_device +{ +public: + sdk86_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_usart(*this, I8251_TAG) + { + } + + required_device m_maincpu; + required_device m_usart; + + DECLARE_WRITE8_MEMBER(scanlines_w); + DECLARE_WRITE8_MEMBER(digit_w); + DECLARE_READ8_MEMBER(kbd_r); + + DECLARE_WRITE_LINE_MEMBER( write_usart_clock ); + + UINT8 m_digit; +}; + +static ADDRESS_MAP_START(sdk86_mem, AS_PROGRAM, 16, sdk86_state) + AM_RANGE(0x00000, 0x00fff) AM_RAM //2K standard, or 4k (board fully populated) + AM_RANGE(0xfe000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sdk86_io, AS_IO, 16, sdk86_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xfff0, 0xfff1) AM_MIRROR(4) AM_DEVREADWRITE8(I8251_TAG, i8251_device, data_r, data_w, 0xff) + AM_RANGE(0xfff2, 0xfff3) AM_MIRROR(4) AM_DEVREADWRITE8(I8251_TAG, i8251_device, status_r, control_w, 0xff) + AM_RANGE(0xffe8, 0xffe9) AM_MIRROR(4) AM_DEVREADWRITE8("i8279", i8279_device, data_r, data_w, 0xff) + AM_RANGE(0xffea, 0xffeb) AM_MIRROR(4) AM_DEVREADWRITE8("i8279", i8279_device, status_r, cmd_w, 0xff) + // FFF8-FFFF = 2 x 8255A i/o chips. chip 1 uses the odd addresses, chip 2 uses the even addresses. + // ports are A,B,C,control in that order. +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sdk86 ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 EB/AX") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ER/BX") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 GO/CX") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 ST/DX") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 IB/SP") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 OB/BP") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 MV/SI") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 EW/DI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IW/CS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 OW/DS") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A SS") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ES") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C IP") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D FL") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_X) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) + PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +WRITE8_MEMBER( sdk86_state::scanlines_w ) +{ + m_digit = data; +} + +WRITE8_MEMBER( sdk86_state::digit_w ) +{ + if (m_digit < 8) + output_set_digit_value(m_digit, data); +} + +READ8_MEMBER( sdk86_state::kbd_r ) +{ + UINT8 data = 0xff; + + if (m_digit < 3) + { + char kbdrow[6]; + sprintf(kbdrow,"X%X",m_digit); + data = ioport(kbdrow)->read(); + } + return data; +} + +WRITE_LINE_MEMBER( sdk86_state::write_usart_clock ) +{ + m_usart->write_txc(state); + m_usart->write_rxc(state); +} + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_4800 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_4800 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) +DEVICE_INPUT_DEFAULTS_END + +static MACHINE_CONFIG_START( sdk86, sdk86_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, XTAL_14_7456MHz/3) /* divided down by i8284 clock generator; jumper selection allows it to be slowed to 2.5MHz, hence changing divider from 3 to 6 */ + MCFG_CPU_PROGRAM_MAP(sdk86_mem) + MCFG_CPU_IO_MAP(sdk86_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_sdk86) + + /* Devices */ + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_cts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_DEVICE_ADD("usart_clock", CLOCK, 307200) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sdk86_state, write_usart_clock)) + + MCFG_DEVICE_ADD("i8279", I8279, 2500000) // based on divider + MCFG_I8279_OUT_SL_CB(WRITE8(sdk86_state, scanlines_w)) // scan SL lines + MCFG_I8279_OUT_DISP_CB(WRITE8(sdk86_state, digit_w)) // display A&B + MCFG_I8279_IN_RL_CB(READ8(sdk86_state, kbd_r)) // kbd RL lines + MCFG_I8279_IN_SHIFT_CB(GND) // Shift key + MCFG_I8279_IN_CTRL_CB(GND) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sdk86 ) + ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) // all are Intel D2616 ?eproms with the windows painted over? (factory programmed eproms? this would match the 'i8642' marking on the factory programmed eprom version of the AT keyboard mcu...) + // Note that the rom pairs at FE000-FEFFF and FF000-FFFFF are interchangeable; the ones at FF000-FFFFF are the ones which start on bootup, and the other ones live at FE000-FEFFF and can be switched in by the user. One pair is the Serial RS232 Monitor and the other is the Keypad/front panel monitor. On the SDK-86 I (LN) dumped, the Keypad monitor was primary, but the other SDK-86 I know of has the roms in the opposite arrangement (Serial primary). + // Keypad Monitor Version 1.1 (says "- 86 1.1" on LED display at startup) + ROM_SYSTEM_BIOS( 0, "keypad", "Keypad Monitor" ) + ROMX_LOAD( "0169_102042-001.a27", 0xff000, 0x0800, CRC(3f46311a) SHA1(a97e6861b736f26230b9adbf5cd2576a9f60d626), ROM_SKIP(1) | ROM_BIOS(1) ) /* Label: "iD2616 // T142094WS // (C)INTEL '77 // 0169 // 102042-001" */ + ROMX_LOAD( "0170_102043-001.a30", 0xff001, 0x0800, CRC(65924471) SHA1(5d258695bf585f89179dfa0a113a0eeeabd5ee2b), ROM_SKIP(1) | ROM_BIOS(1) ) /* Label: "iD2616 // T145056WS // (C)INTEL '77 // 0170 // 102043-001" */ + // Serial Monitor Version 1.2 (says " 86 1.2" on LED display at startup, and sends a data prompt over serial) + ROM_SYSTEM_BIOS( 1, "serial", "Serial Monitor" ) + ROMX_LOAD( "0456_104531-001.a36", 0xff000, 0x0800, CRC(f9c4a809) SHA1(aea324c3f52dd393f1eed2b856ba11f050a35b93), ROM_SKIP(1) | ROM_BIOS(2) ) /* Label: "iD2616 // T142099WS // (C)INTEL '77 // 0456 // 104531-001" */ + ROMX_LOAD( "0457_104532-001.a37", 0xff001, 0x0800, CRC(a245ba5c) SHA1(7f67277f866fca5377cb123e9cc405b5fdfe61d3), ROM_SKIP(1) | ROM_BIOS(2) ) /* Label: "iD2616 // T145054WS // (C)INTEL '77 // 0457 // 104532-001" */ + + /* proms: + * dumped 11/21/09 through 11/29/09 by LN + * purposes: (according to sdk-86 user manual from http://www.bitsavers.org/pdf/intel/8086/9800698A_SDK-86_Users_Man_Apr79.pdf) + * A12: main address decoding (selects ram or rom or open bus/offboard, see page 2-7) + * A22: I/O decoding for 8251, 8279 and optional pair of 8255 chips (in the FFE8-FFFF I/O area; see page 2-6) + * A26: ROM address decoding for selecting which of the 4 pairs of roms is active (note that to use the FCxxx and FDxxx pairs requires wiring them into the prototype area, they are not standard; see page 2-5) + * A29: RAM address decoding (see page 2-4) + */ + ROM_REGION(0x1000, "proms", 0 ) // all are Intel D3625A 1kx4 (82s137A equivalent) + ROM_LOAD( "0036_101993-001.a12", 0x0000, 0x0400, CRC(bb7edbfd) SHA1(8847f9815c7cb8695986743199673920a7d4390d)) /* Label: "iD3625A 0036 // 8142 // 101993-001" */ + ROM_LOAD( "0035_101992-001.a22", 0x0400, 0x0400, CRC(76aced0c) SHA1(89fa39473e19d8cb6b65d6430d3d683ae2398fb3)) /* Label: "iD3625A 0035 // 8142 // 101992-001" */ + ROM_LOAD( "0037_101994-001.a26", 0x0800, 0x0400, CRC(d6f33d30) SHA1(41e794bf202266fa57516403e6a80ebbf6c95fdc)) /* Label: "iD3625A 0037 // 8142 // 101994-001" */ + ROM_LOAD( "0038_101995-001.a29", 0x0C00, 0x0400, CRC(3d2c18bc) SHA1(5e1935cd07fef26b2cf3d8fa7612fe0d8e678c06)) /* Label: "iD3625A 0038 // 8142 // 101995-001" */ +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1979, sdk86, 0, 0, sdk86, sdk86, driver_device, 0, "Intel", "SDK-86", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/seattlecmp.c b/src/mame/drivers/seattlecmp.c new file mode 100644 index 00000000000..4c590f22642 --- /dev/null +++ b/src/mame/drivers/seattlecmp.c @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Seattle Computer SCP-300F S100 card. It has sockets on the card for +one serial and 2 parallel connections. + +2013-08-14 Skeleton driver. + +When started you must press Enter twice before anything happens. + +All commands must be in UPPER case. + +Known Commands: +B : Boot from disk? +D : Dump memory +E : Edit memory +F : Find +G : Go? +I : Input port +M : Move +O : Output port +R : Display / Modify Registers +S : Search +T : Trace + +Chips on the board: 8259 x2; AM9513; 8251; 2716 ROM (MON-86 V1.5TDD) +There is a 4MHz crystal connected to the 9513. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class seattle_comp_state : public driver_device +{ +public: + seattle_comp_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_READ16_MEMBER(read); + DECLARE_WRITE16_MEMBER(write); + DECLARE_WRITE8_MEMBER(kbd_put); +private: + virtual void machine_reset(); + required_device m_maincpu; + required_device m_terminal; + UINT8 m_term_data; + bool m_key_available; +}; + + +static ADDRESS_MAP_START(seattle_mem, AS_PROGRAM, 16, seattle_comp_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0xff7ff) AM_RAM + AM_RANGE(0xff800,0xfffff) AM_ROM AM_REGION("user1", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(seattle_io, AS_IO, 16, seattle_comp_state) + //ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf6,0xf7) AM_READWRITE(read, write) + //AM_RANGE(0xf0, 0xf1) 8259_0 + //AM_RANGE(0xf2, 0xf3) 8259_1 + //AM_RANGE(0xf4, 0xf5) AM9513 + //AM_RANGE(0xf6, 0xf7) 8251 + //AM_RANGE(0xfc, 0xfd) Parallel data, status, serial DCD + //AM_RANGE(0xfe, 0xff) Eprom disable bit, read sense switches (bank of 8 dipswitches) +ADDRESS_MAP_END + +READ16_MEMBER( seattle_comp_state::read ) +{ + UINT16 status = (m_key_available) ? 0x300 : 0x100; + m_key_available = 0; + return m_term_data | status; +} + +WRITE16_MEMBER( seattle_comp_state::write ) +{ + m_terminal->write(space, 0, data&0x7f); +} + +/* Input ports */ +static INPUT_PORTS_START( seattle ) +INPUT_PORTS_END + + +void seattle_comp_state::machine_reset() +{ + m_key_available = 0; + m_term_data = 0; +} + +WRITE8_MEMBER( seattle_comp_state::kbd_put ) +{ + m_term_data = data; + m_key_available = 1; +} + +static MACHINE_CONFIG_START( seattle, seattle_comp_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8086, 4000000) // no idea + MCFG_CPU_PROGRAM_MAP(seattle_mem) + MCFG_CPU_IO_MAP(seattle_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(seattle_comp_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( seattle ) + ROM_REGION( 0x800, "user1", 0 ) + ROM_LOAD( "mon86 v1.5tdd", 0x0000, 0x0800, CRC(7db23169) SHA1(c791b02ca33a4e1f8e95eb541624a59738f378c4)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1986, seattle, 0, 0, seattle, seattle, driver_device, 0, "Seattle Computer", "SCP-300F", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/segapico.c b/src/mame/drivers/segapico.c new file mode 100644 index 00000000000..8cf04bc03a5 --- /dev/null +++ b/src/mame/drivers/segapico.c @@ -0,0 +1,626 @@ +// license:BSD-3-Clause +// copyright-holders:Emmanuel Vadot + +/****************************************** PICO emulation ****************************************/ + +/* todo, make this more independent of the Genesis emulation, it's really only the same CPU + VDP + and doesn't need to be connected to the Genesis at all. + + sound is the 315-5641 / D77591, should be compatible with the 7759? but probably wants us to maintain + an external buffer of at least 0x40 bytes and feed it on a timer in sync with the timer in the chip? + + currently no way to select (or display) the story book area of the games? (will require layout and + external artwork) + +*/ + + +/* + +Pico mainboard (PAL version) + ++---+ +-------------------------------------------------------------------------+ +| | | +-+ | +| | | +--+ |B| +-+ | +| | | |A3| +-+ | | | +| +------------------------------+ +--+ |C| +-| +| | | | | +| GCMK-C2X +-+ | --> PEN +| +-----+ +--+ +-| +| | | |A3| +--------+ | +| | A1 | +--+ | | +---------+ | +| SEGA | | | A2 | |HM53861J | | +| 1994 837-10846 +-----+ | | | | | +| IAC MAIN PAL +--------+ +---------+ | +| MADE IN JAPAN +----+ | +| VA0 +----------+ |XTAL| +--+ +| | SEGA | +---------+ | | | <-- VCC IN +| | 315-5640 | |MC68HC000| |53.2| +--+ +| | 9434 W51 | |FN8-A | +----+ |00 | +----------+ | +| | | | | | | +----+ | SEGA | | +| | | | 2B89N | | | | 315-5313A| | +| | | |S0AH9425A| | A4 | | F1001 | +--| +| +----------+ +---------+ | | | | | | +| | | |9428 LAGG | | --> VIDEO OUT +| | | | | | | +| +----+ +----------+ +--| +| | +| +----------------------------+ | +| ||||||CARTRIDGE CONNECTOR||||| | +| +----------------------------+ | +| | ++------------------------------------------------------------------------------------------------------------+ + +A1 = SEGA / 315-5641 / D77591 / 9442CA010 +A2 = SEGA / 315-5769 U13 / 9451MD020 +A3 = BA10324AF +A4 = MALAYSIA 9336 / 651632DFP-15 / 0000988S +B = 4K16 / HC00 +C = MB3514 / 9325 M36 + + +315-5640 - touchpad controller? +315-5313A - VDP +315-5641 - PCM chip + + +*/ + +/* + Pico Implementation By ElBarto (Emmanuel Vadot, elbarto@megadrive.org) + Still missing the PCM custom chip + Some game will not boot due to this + + Pico Info from Notaz (http://notaz.gp2x.de/docs/picodoc.txt) + + addr acc description +-------+-----+------------ +800001 byte Version register. + ?vv? ????, where v can be: + 00 - hardware is for Japan + 01 - European version + 10 - USA version + 11 - ? +800003 byte Buttons, 0 for pressed, 1 for released: + bit 0: UP (white) + bit 1: DOWN (orange) + bit 2: LEFT (blue) + bit 3: RIGHT (green) + bit 4: red button + bit 5: unused? + bit 6: unused? + bit 7: pen button +800005 byte Most significant byte of pen x coordinate. +800007 byte Least significant byte of pen x coordinate. +800009 byte Most significant byte of pen y coordinate. +80000b byte Least significant byte of pen y coordinate. +80000d byte Page register. One bit means one uncovered page sensor. + 00 - storyware closed + 01, 03, 07, 0f, 1f, 3f - pages 1-6 + either page 5 or page 6 is often unused. +800010 word PCM data register. + r/w read returns free bytes left in PCM FIFO buffer + writes write data to buffer. +800012 word PCM control register. + r/w For writes, it has following possible meanings: + ?p?? ???? ???? ?rrr + p - set to enable playback? + r - sample rate / PCM data type? + 0: 8kHz 4bit ADPCM? + 1-7: 16kHz variants? + For reads, if bit 15 is cleared, it means PCM is 'busy' or + something like that, as games sometimes wait for it to become 1. +800019 byte Games write 'S' +80001b byte Games write 'E' +80001d byte Games write 'G' +80001f byte Games write 'A' + +*/ + +#include "emu.h" +#include "includes/md_cons.h" +#include "sound/315-5641.h" + + +#define PICO_PENX 1 +#define PICO_PENY 2 + +class pico_base_state : public md_cons_state +{ +public: + pico_base_state(const machine_config &mconfig, device_type type, const char *tag) + : md_cons_state(mconfig, type, tag), + m_sega_315_5641_pcm(*this, "315_5641"), + m_io_page(*this, "PAGE"), + m_io_pad(*this, "PAD"), + m_io_penx(*this, "PENX"), + m_io_peny(*this, "PENY") + { } + + optional_device m_sega_315_5641_pcm; + + required_ioport m_io_page; + required_ioport m_io_pad; + required_ioport m_io_penx; + required_ioport m_io_peny; + + UINT8 m_page_register; + + UINT16 pico_read_penpos(int pen); + DECLARE_READ16_MEMBER(pico_68k_io_read); + DECLARE_WRITE16_MEMBER(pico_68k_io_write); + DECLARE_WRITE_LINE_MEMBER(sound_cause_irq); + + DECLARE_DRIVER_INIT(pico); + DECLARE_DRIVER_INIT(picou); + DECLARE_DRIVER_INIT(picoj); +}; + +class pico_state : public pico_base_state +{ +public: + pico_state(const machine_config &mconfig, device_type type, const char *tag) + : pico_base_state(mconfig, type, tag), + m_picocart(*this, "picoslot") { } + + required_device m_picocart; + DECLARE_MACHINE_START(pico); +}; + + + +UINT16 pico_base_state::pico_read_penpos(int pen) +{ + UINT16 penpos = 0; + + switch (pen) + { + case PICO_PENX: + penpos = m_io_penx->read(); + penpos |= 0x6; + penpos = penpos * 320 / 255; + penpos += 0x3d; + break; + case PICO_PENY: + penpos = m_io_peny->read(); + penpos |= 0x6; + penpos = penpos * 251 / 255; + penpos += 0x1fc; + break; + } + + return penpos; +} + +READ16_MEMBER(pico_base_state::pico_68k_io_read ) +{ + UINT8 retdata = 0; + + switch (offset) + { + case 0: /* Version register ?XX?????? where XX is 00 for japan, 01 for europe and 10 for USA*/ + retdata = m_version_hi_nibble; + break; + case 1: + retdata = m_io_pad->read(); + break; + + /* + Still notes from notaz for the pen : + + The pen can be used to 'draw' either on the drawing pad or on the storyware + itself. Both storyware and drawing pad are mapped on single virtual plane, where + coordinates range: + + x: 0x03c - 0x17c + y: 0x1fc - 0x2f7 (drawing pad) + 0x2f8 - 0x3f3 (storyware) + */ + case 2: + retdata = pico_read_penpos(PICO_PENX) >> 8; + break; + case 3: + retdata = pico_read_penpos(PICO_PENX) & 0x00ff; + break; + case 4: + retdata = pico_read_penpos(PICO_PENY) >> 8; + break; + case 5: + retdata = pico_read_penpos(PICO_PENY) & 0x00ff; + break; + case 6: + /* Page register : + 00 - storyware closed + 01, 03, 07, 0f, 1f, 3f - pages 1-6 + either page 5 or page 6 is often unused. + */ + { + UINT8 tmp = m_io_page->read(); + if (tmp == 2 && m_page_register != 0x3f) + { + m_page_register <<= 1; + m_page_register |= 1; + } + if (tmp == 1 && m_page_register != 0x00) + m_page_register >>= 1; + retdata = m_page_register; + break; + } + + + + case 8: // toy story 2 checks this for 0x3f (is that 'empty'?) + /* Returns free bytes left in the PCM FIFO buffer */ + retdata = m_sega_315_5641_pcm->get_fifo_space(); + break; + case 9: + /* + For reads, if bit 15 is cleared, it means PCM is 'busy' or + something like that, as games sometimes wait for it to become 1. + */ + // return (m_upd7759->busy_r()^1) << 15; + // The BUSY bit stays 1 as long as some PCM sound is playing. + // SMPS drivers check 800012 [byte] and clear the "prevent music PCM" byte when the READY bit gets set. + // If this is done incorrectly, the voices in Sonic Gameworld (J) are muted by the music's PCM drums. + return m_sega_315_5641_pcm->busy_r() << 15; + + + case 7: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + logerror("pico_68k_io_read %d\n", offset); + + } + + return retdata | retdata << 8; +} + + +WRITE_LINE_MEMBER(pico_base_state::sound_cause_irq) +{ +// printf("sound irq\n"); + /* sega_315_5641_pcm callback */ + m_maincpu->set_input_line(3, HOLD_LINE); +} + +WRITE16_MEMBER(pico_base_state::pico_68k_io_write ) +{ +// printf("pico_68k_io_write %04x %04x %04x\n", offset*2, data, mem_mask); + + switch (offset) + { + case 0x10/2: + if (mem_mask & 0xFF00) + m_sega_315_5641_pcm->port_w(space, 0, (data >> 8) & 0xFF); + if (mem_mask & 0x00FF) + m_sega_315_5641_pcm->port_w(space, 0, (data >> 0) & 0xFF); + break; + case 0x12/2: // guess + // Note about uPD7759 lines: + // reset line: 1 - normal, 1->0 - reset chip, 0 - playback disabled + // start line: 0->1 - start playback + if (mem_mask & 0xFF00) + { + // I assume that: + // value 8000 resets the FIFO? (always used with low reset line) + // value 0800 maps to the uPD7759's reset line (0 = reset, 1 = normal) + // value 4000 maps to the uPD7759's start line (0->1 = start) + m_sega_315_5641_pcm->reset_w((data >> 8) & 0x08); + m_sega_315_5641_pcm->start_w((data >> 8) & 0x40); + if (data & 0x4000) + { + // Somewhere between "Reset Off" and the first sample data, + // we need to send a few commands to make the sample stream work. + // Doing that when rising the "start" line seems to work fine. + m_sega_315_5641_pcm->port_w(space, 0, 0xFF); // "Last Sample" value (must be >= 0x10) + m_sega_315_5641_pcm->port_w(space, 0, 0x00); // Dummy 1 + m_sega_315_5641_pcm->port_w(space, 0, 0x00); // Addr MSB + m_sega_315_5641_pcm->port_w(space, 0, 0x00); // Addr LSB + } + } + + + /*m_sega_315_5641_pcm->reset_w(0); + m_sega_315_5641_pcm->start_w(0); + m_sega_315_5641_pcm->reset_w(1); + m_sega_315_5641_pcm->start_w(1); + + if (mem_mask&0x00ff) m_sega_315_5641_pcm->port_w(space,0,data&0xff); + if (mem_mask&0xff00) m_sega_315_5641_pcm->port_w(space,0,(data>>8)&0xff);*/ + + break; + } +} + +static ADDRESS_MAP_START( pico_mem, AS_PROGRAM, 16, pico_base_state ) + AM_RANGE(0x000000, 0x3fffff) AM_ROM + + AM_RANGE(0x800000, 0x80001f) AM_READWRITE(pico_68k_io_read, pico_68k_io_write) + + AM_RANGE(0xc00000, 0xc0001f) AM_DEVREADWRITE("gen_vdp", sega315_5313_device, vdp_r, vdp_w) + AM_RANGE(0xe00000, 0xe0ffff) AM_RAM AM_MIRROR(0x1f0000) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( pico ) + PORT_START("PAD") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Red Button") + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Pen Button") + + PORT_START("PAGE") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Increment Page") + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Decrement Page") + + PORT_START("PENX") + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_NAME("PEN X") + + PORT_START("PENY") + PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_MINMAX(0,255 ) PORT_PLAYER(1) PORT_NAME("PEN Y") +INPUT_PORTS_END + + +static SLOT_INTERFACE_START(pico_cart) + SLOT_INTERFACE_INTERNAL("rom", MD_STD_ROM) + SLOT_INTERFACE_INTERNAL("rom_sram", MD_ROM_SRAM) // not sure these are needed... + SLOT_INTERFACE_INTERNAL("rom_sramsafe", MD_ROM_SRAM) // not sure these are needed... +SLOT_INTERFACE_END + +MACHINE_START_MEMBER(pico_state,pico) +{ + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_picocart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_picocart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_picocart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)m_picocart)); + + m_vdp->stop_timers(); +} + +static MACHINE_CONFIG_START( pico, pico_state ) + MCFG_FRAGMENT_ADD( md_ntsc ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pico_mem) + + MCFG_DEVICE_REMOVE("genesis_snd_z80") + MCFG_DEVICE_REMOVE("ymsnd") + + MCFG_MACHINE_START_OVERRIDE( pico_state, pico ) + MCFG_MACHINE_RESET_OVERRIDE( pico_base_state, ms_megadriv ) + + MCFG_PICO_CARTRIDGE_ADD("picoslot", pico_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","pico") + + MCFG_SOUND_ADD("315_5641", SEGA_315_5641_PCM, UPD7759_STANDARD_CLOCK*2) + MCFG_UPD7759_DRQ_CALLBACK(WRITELINE(pico_state,sound_cause_irq)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.16) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.16) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( picopal, pico_state ) + MCFG_FRAGMENT_ADD( md_pal ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pico_mem) + + MCFG_DEVICE_REMOVE("genesis_snd_z80") + MCFG_DEVICE_REMOVE("ymsnd") + + MCFG_MACHINE_START_OVERRIDE( pico_state, pico ) + MCFG_MACHINE_RESET_OVERRIDE( pico_base_state, ms_megadriv ) + + MCFG_PICO_CARTRIDGE_ADD("picoslot", pico_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","pico") + + MCFG_SOUND_ADD("315_5641", SEGA_315_5641_PCM, UPD7759_STANDARD_CLOCK*2) + MCFG_UPD7759_DRQ_CALLBACK(WRITELINE(pico_state,sound_cause_irq)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.16) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.16) +MACHINE_CONFIG_END + + + +ROM_START( pico ) + ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) + ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) +ROM_END + +ROM_START( picou ) + ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) + ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) +ROM_END + +ROM_START( picoj ) + ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) + ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) +ROM_END + + +DRIVER_INIT_MEMBER(pico_base_state, pico) +{ + DRIVER_INIT_CALL(megadrie); + DRIVER_INIT_CALL(mess_md_common); + + m_version_hi_nibble = 0x60; // Export PAL +} + +DRIVER_INIT_MEMBER(pico_base_state, picou) +{ + DRIVER_INIT_CALL(megadriv); + DRIVER_INIT_CALL(mess_md_common); + + m_version_hi_nibble = 0x40; // Export NTSC +} + +DRIVER_INIT_MEMBER(pico_base_state, picoj) +{ + DRIVER_INIT_CALL(megadrij); + DRIVER_INIT_CALL(mess_md_common); + + m_version_hi_nibble = 0x00; // JPN NTSC +} + + +CONS( 1994, pico, 0, 0, picopal, pico, pico_base_state, pico, "Sega", "Pico (Europe, PAL)", MACHINE_NOT_WORKING) +CONS( 1994, picou, pico, 0, pico, pico, pico_base_state, picou, "Sega", "Pico (USA, NTSC)", MACHINE_NOT_WORKING) +CONS( 1993, picoj, pico, 0, pico, pico, pico_base_state, picoj, "Sega", "Pico (Japan, NTSC)", MACHINE_NOT_WORKING) + +/* + +This looks a lot like a Pico with extra sound hardware... + YMZ263B is the basis of a Sound Blaster Clone + YMF262-M is the OPL3 + +YAMAHA - MIXT BOOK PLAYER COPERA +MMG-1 + + + +-------------+ + | | + |------+ | + | | | + MIDI OUT <-- | | + | | | + |------+ | + | | +------------------------------------------------------------------------------------------------------+ + |------+ | | +--+ | + | | | | |YM| | + MIDI IN <-- | | | |7 | | + | | | | |12| +---------+ | + |------+ +--+ | +------+ |8B| | YAMAHA | | + | |||| | | +--+ | YMZ263B | | + +---------||--+ | +--------+ | | | + || | |YM7 128B| +---------+ +---+ | + || | +--------+ |YMF| | + +---------||----------+ |262| | + | || |-M | | + | || +---+ | + | || | + | || SEGA | + |------+ || 1993 837-9845 COPERA | + | | || MADE IN JAPAN +--| + | | || VA0 | --> PEN + CONTROL <-- | || | | + | | || +--| + | | || | + | | || | + |------+ || +----+ | + | || |XTAL| +------------+ | + | || | | | OKI JAPAN | +----+ + | || +----------+ |53.6| | M54C864-80 | | | + | |||| | SEGA | |93 | +------------+ | | + | +--+ | 315-5639 | | Mhz| | | + | | U11| +----+ +-------------+ | E | + | |9341PD025 | | | | X | + |--+ +----------+ | SEGA | | T | + MIC <-- | +----+ +----+ | 315-5313A | | E | + | | |TC51| |TC51| | FC1001 | | N | + |--+ |832A| |832A| | 9331 AASG | | D | + | |FL-1| |FL-1| | | | E | + | |0 | |0 | | | | D | + | | | | | | | | | + |--+ +----+ +----+ +-------------+ | | + +-- | | C | + | |--+ | O | +S-AUDIO <-| | +-----------+ +-------+ | N | + | |--+ | SEGA | | SEGA | +-----------+ | N | + +-- | | 315-5640 | |315-564| | 3D4 UA | | E | + |--+ | 9333 W26 | |1 | |HD68HC000CP| | C | + | | | |D77591 | |8 | | T | + |--+ | | +-------+ | | | O | + S-VIDEO <-- | | | | | | R | + |--+ | | | | | | + | +-----------+ | JAPAN| | | + | +-----------+ | | + |--+ | | + VCC --> | +----------------------------------------------+ | | + |--+ | CARTRIDGE | +----+ + | | CONNECTOR | | + | +----------------------------------------------+ | + +-----------------------------------------------------------------------------------------------------------------------------------+ + +*/ + + + +class copera_state : public pico_base_state +{ +public: + copera_state(const machine_config &mconfig, device_type type, const char *tag) + : pico_base_state(mconfig, type, tag), + m_picocart(*this, "coperaslot") { } + + required_device m_picocart; + DECLARE_MACHINE_START(copera); +}; + + + +static ADDRESS_MAP_START( copera_mem, AS_PROGRAM, 16, copera_state ) + AM_RANGE(0x000000, 0x3fffff) AM_ROM + + AM_RANGE(0x800000, 0x80001f) AM_READWRITE(pico_68k_io_read, pico_68k_io_write) + + AM_RANGE(0xc00000, 0xc0001f) AM_DEVREADWRITE("gen_vdp", sega315_5313_device, vdp_r, vdp_w) + + AM_RANGE(0xe00000, 0xe0ffff) AM_RAM AM_MIRROR(0x1f0000) +ADDRESS_MAP_END + + + +static SLOT_INTERFACE_START(copera_cart) + SLOT_INTERFACE_INTERNAL("rom", MD_STD_ROM) + SLOT_INTERFACE_INTERNAL("rom_sram", MD_ROM_SRAM) // not sure these are needed... + SLOT_INTERFACE_INTERNAL("rom_sramsafe", MD_ROM_SRAM) // not sure these are needed... +SLOT_INTERFACE_END + +MACHINE_START_MEMBER(copera_state,copera) +{ + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_picocart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_picocart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_picocart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)m_picocart)); + + m_sega_315_5641_pcm->reset_w(0); + m_sega_315_5641_pcm->start_w(0); + m_sega_315_5641_pcm->reset_w(1); + m_sega_315_5641_pcm->start_w(1); + +} + +static MACHINE_CONFIG_START( copera, copera_state ) + MCFG_FRAGMENT_ADD( md_ntsc ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(copera_mem) + + MCFG_DEVICE_REMOVE("genesis_snd_z80") + MCFG_DEVICE_REMOVE("ymsnd") + + MCFG_MACHINE_START_OVERRIDE( copera_state, copera ) + MCFG_MACHINE_RESET_OVERRIDE( pico_base_state, ms_megadriv ) + + MCFG_COPERA_CARTRIDGE_ADD("coperaslot", copera_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","copera") + + MCFG_SOUND_ADD("315_5641", SEGA_315_5641_PCM, UPD7759_STANDARD_CLOCK) + MCFG_UPD7759_DRQ_CALLBACK(WRITELINE(copera_state,sound_cause_irq)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.16) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.16) +MACHINE_CONFIG_END + + + +ROM_START( copera ) + ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) + ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) +ROM_END + +CONS( 1993, copera, 0, 0, copera, pico, pico_base_state, picoj, "Yamaha / Sega", "Yamaha Mixt Book Player Copera", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/segapm.c b/src/mame/drivers/segapm.c new file mode 100644 index 00000000000..34d7488e8b3 --- /dev/null +++ b/src/mame/drivers/segapm.c @@ -0,0 +1,80 @@ +/* Sega Picture Magic (codename JANUS) */ +// http://segaretro.org/Sega_Picture_Magic + +// this uses a Sega 32X PCB (not in a 32X case) attached to a stripped down 68k based board rather than a full Genesis / Megadrive +// it is likely the internal SH2 bios roms differ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" + + +class segapm_state : public driver_device +{ +public: + segapm_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + virtual void video_start(); + UINT32 screen_update_segapm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +void segapm_state::video_start() +{ +} + +UINT32 segapm_state::screen_update_segapm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + + +static ADDRESS_MAP_START( segapm_map, AS_PROGRAM, 16, segapm_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM + + // A15100 + + AM_RANGE(0xe00000, 0xe7ffff) AM_RAM + +ADDRESS_MAP_END + +static INPUT_PORTS_START( segapm ) +INPUT_PORTS_END + + + + +static MACHINE_CONFIG_START( segapm, segapm_state ) + + MCFG_CPU_ADD("maincpu", M68000, 8000000) // ?? + MCFG_CPU_PROGRAM_MAP(segapm_map) + + // + 2 sh2s on 32x board + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + MCFG_SCREEN_UPDATE_DRIVER(segapm_state, screen_update_segapm) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x200) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) +MACHINE_CONFIG_END + + + +ROM_START( segapm ) // was more than one cartridge available? if so softlist them? + ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD( "picture magic boot cart (j) [!].bin", 0x00000, 0x80000, CRC(c9ab4e60) SHA1(9c4d4ab3e59c8acde86049a1ba3787aa03b549a3) ) // internal header is GOUSEI HENSYUU + + // todo, sh2 bios roms etc. +ROM_END + +GAME( 1996, segapm, 0, segapm, segapm, driver_device, 0, ROT0, "Sega", "Picture Magic", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/selz80.c b/src/mame/drivers/selz80.c new file mode 100644 index 00000000000..62a2692f574 --- /dev/null +++ b/src/mame/drivers/selz80.c @@ -0,0 +1,202 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + SEL Z80 Trainer (LEHRSYSTEME) + + 31/08/2010 Skeleton driver. + 23/06/2011 Working [Robbbert] + +No diagram has been found. The following is guesswork. + +Test sequence: Press -, enter an address, press = to show contents, press + up/down-arrow to cycle through addresses. + +ToDo: +- Artwork +- Various missing LEDs and switches +- Keys are a guess, need to be confirmed. +- Needs to be tested by a subject-matter expert. + +- Unknown I/O: +'maincpu' (00F2): unmapped i/o memory write to 000C = 00 & FF +'maincpu' (00F8): unmapped i/o memory write to 0010 = FF & FF +'maincpu' (0122): unmapped i/o memory write to 0019 = 91 & FF +'maincpu' (0122): unmapped i/o memory write to 0019 = 40 & FF +'maincpu' (0122): unmapped i/o memory write to 0019 = CE & FF +'maincpu' (0122): unmapped i/o memory write to 0019 = 17 & FF + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8279.h" +#include "selz80.lh" + + +class selz80_state : public driver_device +{ +public: + selz80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_p_ram(*this, "ram") + { } + + DECLARE_WRITE8_MEMBER(scanlines_w); + DECLARE_WRITE8_MEMBER(digit_w); + DECLARE_READ8_MEMBER(kbd_r); + DECLARE_MACHINE_RESET(dagz80); + UINT8 m_digit; + required_device m_maincpu; + optional_shared_ptr m_p_ram; +}; + +static ADDRESS_MAP_START(dagz80_mem, AS_PROGRAM, 8, selz80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("ram") + AM_RANGE(0xe000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(selz80_mem, AS_PROGRAM, 8, selz80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0x1fff) AM_RAM + AM_RANGE(0xa000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(selz80_io, AS_IO, 8, selz80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w ) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( selz80 ) +/* 2 x 16-key pads +RS SS RN MM C(IS) D(FL) E(FL') F +EX BP TW TR 8(IX) 9(IY) A(PC) B(SP) +RL IN - + 4(AF') 5(BC') 6(DE') 7(HL') +RG EN SA SD 0(AF) 1(BC) 2(DE) 3(HL) + */ + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E FL'") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D FL") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C IS") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RN") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SS") PORT_CODE(KEYCODE_R) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RS") PORT_CODE(KEYCODE_T) + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B SP") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A PC") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 IY") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IX") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TR (tape read)") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TW (tape write)") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BP") PORT_CODE(KEYCODE_I) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EX") PORT_CODE(KEYCODE_O) + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 HL'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 DE'") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 BC'") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 AF'") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("IN") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RL") PORT_CODE(KEYCODE_G) + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 HL") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 DE") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 BC") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 AF") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SD") PORT_CODE(KEYCODE_H) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EN") PORT_CODE(KEYCODE_K) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RG") PORT_CODE(KEYCODE_L) +INPUT_PORTS_END + + +MACHINE_RESET_MEMBER(selz80_state, dagz80) +{ + UINT8* rom = memregion("user1")->base(); + UINT16 size = memregion("user1")->bytes(); + memcpy(m_p_ram, rom, size); + m_maincpu->reset(); +} + +WRITE8_MEMBER( selz80_state::scanlines_w ) +{ + m_digit = data; +} + +WRITE8_MEMBER( selz80_state::digit_w ) +{ + output_set_digit_value(m_digit, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4)); +} + +READ8_MEMBER( selz80_state::kbd_r ) +{ + UINT8 data = 0xff; + + if (m_digit < 4) + { + char kbdrow[6]; + sprintf(kbdrow,"X%X",m_digit); + data = ioport(kbdrow)->read(); + } + return data; +} + +static MACHINE_CONFIG_START( selz80, selz80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(selz80_mem) + MCFG_CPU_IO_MAP(selz80_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_selz80) + + /* Devices */ + MCFG_DEVICE_ADD("i8279", I8279, 2500000) // based on divider + MCFG_I8279_OUT_SL_CB(WRITE8(selz80_state, scanlines_w)) // scan SL lines + MCFG_I8279_OUT_DISP_CB(WRITE8(selz80_state, digit_w)) // display A&B + MCFG_I8279_IN_RL_CB(READ8(selz80_state, kbd_r)) // kbd RL lines + MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key + MCFG_I8279_IN_CTRL_CB(VCC) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( dagz80, selz80 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(dagz80_mem) + MCFG_MACHINE_RESET_OVERRIDE(selz80_state, dagz80 ) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( selz80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v3.3", "V3.3") + ROMX_LOAD( "z80-trainer.rom", 0x0000, 0x1000, CRC(eed1755f) SHA1(72e6ebfccb0e50034660bc36db1a741932311ce1), ROM_BIOS(1)) // (c)TEL86/V3.3 + ROM_SYSTEM_BIOS(1, "v3.2", "V3.2") + ROMX_LOAD( "moniz80_3.2_04.12.1985.bin", 0x0000, 0x1000, CRC(3a3cf574) SHA1(ba6cd2276ce66f3a4545baf4d396f6c06d51dc38), ROM_BIOS(2)) // (c)SEL85/V3.2 + ROM_LOAD( "term80-a000.bin", 0xa000, 0x2000, CRC(0a58c0a7) SHA1(d1b4b3b2ad0d084175b1ff6966653d8b20025252)) + ROM_LOAD( "term80-e000.bin", 0xe000, 0x2000, CRC(158e08e6) SHA1(f1add43bcf8744a01238fb893ee284872d434db5)) +ROM_END + +ROM_START( dagz80 ) + ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "moni_1.5_15.08.1988.bin", 0x0000, 0x2000, CRC(318aee6e) SHA1(c698fdee401b88e673791aabcba6a9628938a075) ) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS, INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, selz80, 0, 0, selz80, selz80, driver_device, 0, "SEL", "SEL Z80 Trainer", MACHINE_NO_SOUND_HW) +COMP( 1988, dagz80, selz80, 0, dagz80, selz80, driver_device, 0, "DAG", "DAG Z80 Trainer", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/sg1000.c b/src/mame/drivers/sg1000.c new file mode 100644 index 00000000000..4c5c7025d75 --- /dev/null +++ b/src/mame/drivers/sg1000.c @@ -0,0 +1,915 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Sega SG-1000 + +PCB Layout +---------- + +171-5078 (C) SEGA 1983 +171-5046 REV. A (C) SEGA 1983 + +|---------------------------| |----------------------------| +| SW1 CN2 | |------|---------------| | SW2 CN4 | +| |---| CN3 |---| | +| CN1 CN5 | +| | +| 10.738635MHz |------------------------------| 7805 | +| |---| |------------------------------| | +| | | CN6 | +| | 9 | | +| | 9 | LS32 | +| | 1 | |---------| | +| | 8 | | TMM2009 | LS139 | +| | A | |---------| |------------------| | +| | | | Z80 | | +| |---| |------------------| | +| | +| | +| MB8118 MB8118 MB8118 MB8118 SN76489A SW3 | +| MB8118 MB8118 MB8118 MB8118 LS257 LS257 | +|---------------------------------------------------------------------------------------| + +Notes: + All IC's shown. + + Z80 - NEC D780C-1 / Zilog Z8400A (REV.A) Z80A CPU @ 3.579545 + TMS9918A- Texas Instruments TMS9918ANL Video Display Processor @ 10.738635MHz + MB8118 - Fujitsu MB8118-12 16K x 1 Dynamic RAM + TMM2009 - Toshiba TMM2009P-A / TMM2009P-B (REV.A) + SN76489A- Texas Instruments SN76489AN Digital Complex Sound Generator @ 3.579545 + CN1 - player 1 joystick connector + CN2 - RF video connector + CN3 - keyboard connector + CN4 - power connector (+9VDC) + CN5 - player 2 joystick connector + CN6 - cartridge connector + SW1 - TV channel select switch + SW2 - power switch + SW3 - hold switch + +*/ + +/* + + TODO: + + - SC-3000 return instruction referenced by R when reading ports 60-7f,e0-ff + - connect PSG /READY signal to Z80 WAIT + - accurate video timing + - SP-400 serial printer + - SH-400 racing controller + - SF-7000 serial comms + +*/ + + +#include "includes/sg1000.h" +#include "bus/rs232/rs232.h" + + +/*************************************************************************** + READ/WRITE HANDLERS +***************************************************************************/ + +// TODO: not sure if the OMV bios actually detects the presence of a cart, +// or if the cart data simply overwrites the internal bios... +// for the moment let assume the latter! +READ8_MEMBER( sg1000_state::omv_r ) +{ + if (m_cart && m_cart->exists()) + return m_cart->read_cart(space, offset); + else + return m_rom->base()[offset]; +} + +WRITE8_MEMBER( sg1000_state::omv_w ) +{ + if (m_cart && m_cart->exists()) + m_cart->write_cart(space, offset, data); +} + +/*------------------------------------------------- + joysel_r - +-------------------------------------------------*/ + +READ8_MEMBER( sg1000_state::joysel_r ) +{ + return 0x80; +} + +/*------------------------------------------------- + ADDRESS_MAP( sg1000_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( sg1000_map, AS_PROGRAM, 8, sg1000_state ) + AM_RANGE(0x0000, 0xbfff) AM_DEVREADWRITE(CARTSLOT_TAG, sega8_cart_slot_device, read_cart, write_cart) + AM_RANGE(0xc000, 0xc3ff) AM_MIRROR(0x3c00) AM_RAM +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( sg1000_io_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( sg1000_io_map, AS_IO, 8, sg1000_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) + AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) + AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) + AM_RANGE(0xdc, 0xdc) AM_READ_PORT("PA7") + AM_RANGE(0xdd, 0xdd) AM_READ_PORT("PB7") + AM_RANGE(0xde, 0xde) AM_READ(joysel_r) AM_WRITENOP + AM_RANGE(0xdf, 0xdf) AM_NOP +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( omv_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( omv_map, AS_PROGRAM, 8, sg1000_state ) + AM_RANGE(0x0000, 0xbfff) AM_READWRITE(omv_r, omv_w) + AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3800) AM_RAM +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( omv_io_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( omv_io_map, AS_IO, 8, sg1000_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) + AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) + AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x38) AM_READ_PORT("C0") + AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x38) AM_READ_PORT("C1") + AM_RANGE(0xc2, 0xc2) AM_MIRROR(0x38) AM_READ_PORT("C2") + AM_RANGE(0xc3, 0xc3) AM_MIRROR(0x38) AM_READ_PORT("C3") + AM_RANGE(0xc4, 0xc4) AM_MIRROR(0x3a) AM_READ_PORT("C4") + AM_RANGE(0xc5, 0xc5) AM_MIRROR(0x3a) AM_READ_PORT("C5") +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( sc3000_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( sc3000_map, AS_PROGRAM, 8, sg1000_state ) + AM_RANGE(0x0000, 0xbfff) AM_DEVREADWRITE(CARTSLOT_TAG, sega8_cart_slot_device, read_cart, write_cart) + AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3800) AM_RAM +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( sc3000_io_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( sc3000_io_map, AS_IO, 8, sg1000_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) + AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) + AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) + AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write) +ADDRESS_MAP_END + +/* This is how the I/O ports are really mapped, but MAME does not support overlapping ranges +static ADDRESS_MAP_START( sc3000_io_map, AS_IO, 8, sg1000_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write) + AM_RANGE(0x00, 0x00) AM_MIRROR(0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) + AM_RANGE(0x01, 0x01) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) + AM_RANGE(0x60, 0x60) AM_MIRROR(0x9f) AM_READ(sc3000_r_r) +ADDRESS_MAP_END +*/ + +/*------------------------------------------------- + ADDRESS_MAP( sf7000_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( sf7000_map, AS_PROGRAM, 8, sf7000_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") + AM_RANGE(0x4000, 0xffff) AM_RAM +ADDRESS_MAP_END + +/*------------------------------------------------- + ADDRESS_MAP( sf7000_io_map ) +-------------------------------------------------*/ + +static ADDRESS_MAP_START( sf7000_io_map, AS_IO, 8, sf7000_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) + AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) + AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) + AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_0_TAG, i8255_device, read, write) + AM_RANGE(0xe0, 0xe1) AM_DEVICE(UPD765_TAG, upd765a_device, map) + AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE(UPD9255_1_TAG, i8255_device, read, write) + AM_RANGE(0xe8, 0xe8) AM_DEVREADWRITE(UPD8251_TAG, i8251_device, data_r, data_w) + AM_RANGE(0xe9, 0xe9) AM_DEVREADWRITE(UPD8251_TAG, i8251_device, status_r, control_w) +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/*------------------------------------------------- + INPUT_CHANGED_MEMBER( trigger_nmi ) +-------------------------------------------------*/ + +INPUT_CHANGED_MEMBER( sg1000_state::trigger_nmi ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + +/*------------------------------------------------- + INPUT_PORTS( sg1000 ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( sg1000 ) + PORT_START("PA7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + + PORT_START("PB7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("NMI") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_P) PORT_CHANGED_MEMBER(DEVICE_SELF, sg1000_state, trigger_nmi, 0) +INPUT_PORTS_END + +/*------------------------------------------------- + INPUT_PORTS( omv ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( omv ) + PORT_START("C0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("C1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 #") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 *") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("C2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("C3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("C4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("S-1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("S-2") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + + PORT_START("C5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +/*------------------------------------------------- + INPUT_PORTS( sk1100 ) +-------------------------------------------------*/ + +INPUT_PORTS_START( sk1100 ) + PORT_START("PA0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENG DIER'S") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + + PORT_START("PA1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + + PORT_START("PA2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + + PORT_START("PA3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_SMALL_PI) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x03c0) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + + PORT_START("PA4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + + PORT_START("PA5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PA7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + + PORT_START("PB0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('^') + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("PB5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xa5") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x00a5) + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNC") PORT_CODE(KEYCODE_TAB) + + PORT_START("PB6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("PB7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + + PORT_START("NMI") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, sg1000_state, trigger_nmi, 0) +INPUT_PORTS_END + +/*------------------------------------------------- + INPUT_PORTS( sc3000 ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( sc3000 ) + PORT_INCLUDE( sk1100 ) +INPUT_PORTS_END + +/*------------------------------------------------- + INPUT_PORTS( sf7000 ) +-------------------------------------------------*/ + +static INPUT_PORTS_START( sf7000 ) + PORT_INCLUDE( sk1100 ) + + PORT_START("BAUD") + PORT_CONFNAME( 0x07, 0x05, "Baud rate") + PORT_CONFSETTING( 0x00, "9600 baud" ) + PORT_CONFSETTING( 0x01, "4800 baud" ) + PORT_CONFSETTING( 0x02, "2400 baud" ) + PORT_CONFSETTING( 0x03, "1200 baud" ) + PORT_CONFSETTING( 0x04, "600 baud" ) + PORT_CONFSETTING( 0x05, "300 baud" ) +INPUT_PORTS_END + +/*************************************************************************** + DEVICE CONFIGURATION +***************************************************************************/ + +/*------------------------------------------------- + TMS9928a_interface tms9928a_interface +-------------------------------------------------*/ + +WRITE_LINE_MEMBER(sg1000_state::sg1000_vdp_interrupt) +{ + m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); +} + +/*------------------------------------------------- + I8255 INTERFACE +-------------------------------------------------*/ + +READ8_MEMBER( sc3000_state::ppi_pa_r ) +{ + /* + Signal Description + + PA0 Keyboard input + PA1 Keyboard input + PA2 Keyboard input + PA3 Keyboard input + PA4 Keyboard input + PA5 Keyboard input + PA6 Keyboard input + PA7 Keyboard input + */ + + return m_key_row[m_keylatch]->read(); +} + +READ8_MEMBER( sc3000_state::ppi_pb_r ) +{ + /* + Signal Description + + PB0 Keyboard input + PB1 Keyboard input + PB2 Keyboard input + PB3 Keyboard input + PB4 /CONT input from cartridge terminal B-11 + PB5 FAULT input from printer + PB6 BUSY input from printer + PB7 Cassette tape input + */ + + /* keyboard */ + UINT8 data = m_key_row[m_keylatch + 8]->read(); + + /* cartridge contact */ + data |= 0x10; + + /* printer */ + data |= 0x60; + + /* tape input */ + if (m_cassette->input() > +0.0) data |= 0x80; + + return data; +} + +WRITE8_MEMBER( sc3000_state::ppi_pc_w ) +{ + /* + Signal Description + + PC0 Keyboard raster output + PC1 Keyboard raster output + PC2 Keyboard raster output + PC3 not connected + PC4 Cassette tape output + PC5 DATA to printer + PC6 /RESET to printer + PC7 /FEED to printer + */ + + /* keyboard */ + m_keylatch = data & 0x07; + + /* cassette */ + m_cassette->output( BIT(data, 4) ? +1.0 : -1.0); + + /* TODO printer */ +} + +/*------------------------------------------------- + I8255 INTERFACE +-------------------------------------------------*/ + +WRITE_LINE_MEMBER( sf7000_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +READ8_MEMBER( sf7000_state::ppi_pa_r ) +{ + /* + Signal Description + + PA0 INT from FDC + PA1 BUSY from Centronics printer + PA2 INDEX from FDD + PA3 + PA4 + PA5 + PA6 + PA7 + */ + + UINT8 data = 0; + + data |= m_fdc->get_irq() ? 0x01 : 0x00; + data |= m_centronics_busy << 1; + data |= m_floppy0->idx_r() << 2; + + return data; +} + +WRITE8_MEMBER( sf7000_state::ppi_pc_w ) +{ + /* + Signal Description + + PC0 /INUSE signal to FDD + PC1 /MOTOR ON signal to FDD + PC2 TC signal to FDC + PC3 RESET signal to FDC + PC4 not connected + PC5 not connected + PC6 /ROM SEL (switch between IPL ROM and RAM) + PC7 /STROBE to Centronics printer + */ + + if (!BIT(data, 0)) + m_fdc->set_floppy(m_floppy0); + else + m_fdc->set_floppy(NULL); + + /* floppy motor */ + m_floppy0->mon_w(BIT(data, 1)); + + /* FDC terminal count */ + m_fdc->tc_w(BIT(data, 2)); + + /* FDC reset */ + if (BIT(data, 3)) + { + m_fdc->reset(); + } + + /* ROM selection */ + membank("bank1")->set_entry(BIT(data, 6)); + + /* printer strobe */ + m_centronics->write_strobe(BIT(data, 7)); +} + +/*------------------------------------------------- + upd765_interface sf7000_upd765_interface +-------------------------------------------------*/ + +FLOPPY_FORMATS_MEMBER( sf7000_state::floppy_formats ) + FLOPPY_SF7000_FORMAT +FLOPPY_FORMATS_END + +/*------------------------------------------------- + floppy_interface sf7000_floppy_interface +-------------------------------------------------*/ + +static SLOT_INTERFACE_START( sf7000_floppies ) + SLOT_INTERFACE( "3ssdd", FLOPPY_3_SSDD ) +SLOT_INTERFACE_END + +/*------------------------------------------------- + MACHINE_START( sg1000 ) +-------------------------------------------------*/ + +void sg1000_state::machine_start() +{ + if (m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(sega8_cart_slot_device::read_ram),(sega8_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, 0, 0, write8_delegate(FUNC(sega8_cart_slot_device::write_ram),(sega8_cart_slot_device*)m_cart)); + } + + if (m_cart) + m_cart->save_ram(); +} + +/*------------------------------------------------- + MACHINE_START( sc3000 ) +-------------------------------------------------*/ + +void sc3000_state::machine_start() +{ + /* toggle light gun crosshair */ + timer_set(attotime::zero, TIMER_LIGHTGUN_TICK); + + // find keyboard rows + m_key_row[0] = m_pa0; + m_key_row[1] = m_pa1; + m_key_row[2] = m_pa2; + m_key_row[3] = m_pa3; + m_key_row[4] = m_pa4; + m_key_row[5] = m_pa5; + m_key_row[6] = m_pa6; + m_key_row[7] = m_pa7; + m_key_row[8] = m_pb0; + m_key_row[9] = m_pb1; + m_key_row[10] = m_pb2; + m_key_row[11] = m_pb3; + m_key_row[12] = m_pb4; + m_key_row[13] = m_pb5; + m_key_row[14] = m_pb6; + m_key_row[15] = m_pb7; + + /* register for state saving */ + save_item(NAME(m_keylatch)); + + if (m_cart && m_cart->exists() && (m_cart->get_type() == SEGA8_BASIC_L3 || m_cart->get_type() == SEGA8_MUSIC_EDITOR + || m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB)) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(sega8_cart_slot_device::read_ram),(sega8_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, 0, 0, write8_delegate(FUNC(sega8_cart_slot_device::write_ram),(sega8_cart_slot_device*)m_cart)); + } + + if (m_cart) + m_cart->save_ram(); +} + + +/*------------------------------------------------- + MACHINE_START( sf7000 ) +-------------------------------------------------*/ + +void sf7000_state::machine_start() +{ + sc3000_state::machine_start(); + + save_item(NAME(m_centronics_busy)); + + /* configure memory banking */ + membank("bank1")->configure_entry(0, m_rom->base()); + membank("bank1")->configure_entry(1, m_ram->pointer()); + membank("bank2")->configure_entry(0, m_ram->pointer()); +} + +void sf7000_state::machine_reset() +{ + membank("bank1")->set_entry(0); + membank("bank2")->set_entry(0); +} + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +/*------------------------------------------------- + MACHINE_CONFIG_START( sg1000, sg1000_state ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( sg1000, sg1000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) + MCFG_CPU_PROGRAM_MAP(sg1000_map) + MCFG_CPU_IO_MAP(sg1000_io_map) + + /* video hardware */ + MCFG_DEVICE_ADD( TMS9918A_TAG, TMS9918A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000_state, sg1000_vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) + MCFG_SCREEN_UPDATE_DEVICE( TMS9918A_TAG, tms9918a_device, screen_update ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_10_738635MHz/3) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* cartridge */ + MCFG_SG1000_CARTRIDGE_ADD(CARTSLOT_TAG, sg1000_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","sg1000") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_CONFIG_DERIVED( omv, sg1000 ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_DERIVED( omv, sg1000 ) + MCFG_CPU_MODIFY(Z80_TAG) + MCFG_CPU_PROGRAM_MAP(omv_map) + MCFG_CPU_IO_MAP(omv_io_map) + + MCFG_DEVICE_REMOVE(CARTSLOT_TAG) + MCFG_OMV_CARTRIDGE_ADD(CARTSLOT_TAG, sg1000_cart, NULL) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_CONFIG_START( sc3000, sc3000_state ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( sc3000, sc3000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) // LH0080A + MCFG_CPU_PROGRAM_MAP(sc3000_map) + MCFG_CPU_IO_MAP(sc3000_io_map) + + /* video hardware */ + MCFG_DEVICE_ADD( TMS9918A_TAG, TMS9918A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000_state, sg1000_vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) + MCFG_SCREEN_UPDATE_DEVICE( TMS9918A_TAG, tms9918a_device, screen_update ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_10_738635MHz/3) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_DEVICE_ADD(UPD9255_TAG, I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(sc3000_state, ppi_pa_r)) + MCFG_I8255_IN_PORTB_CB(READ8(sc3000_state, ppi_pb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(sc3000_state, ppi_pc_w)) + +// MCFG_PRINTER_ADD("sp400") /* serial printer */ + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(sc3000_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("sc3000_cass") + + /* cartridge */ + MCFG_SC3000_CARTRIDGE_ADD(CARTSLOT_TAG, sg1000_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","sg1000") + MCFG_SOFTWARE_LIST_ADD("sc3k_cart_list","sc3000_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list","sc3000_cass") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") +MACHINE_CONFIG_END + +/*------------------------------------------------- + MACHINE_CONFIG_START( sf7000, sf7000_state ) +-------------------------------------------------*/ + +static MACHINE_CONFIG_START( sf7000, sf7000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) + MCFG_CPU_PROGRAM_MAP(sf7000_map) + MCFG_CPU_IO_MAP(sf7000_io_map) + + /* video hardware */ + MCFG_DEVICE_ADD( TMS9918A_TAG, TMS9918A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000_state, sg1000_vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) + MCFG_SCREEN_UPDATE_DEVICE( TMS9918A_TAG, tms9918a_device, screen_update ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_10_738635MHz/3) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_DEVICE_ADD(UPD9255_0_TAG, I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(sc3000_state, ppi_pa_r)) + MCFG_I8255_IN_PORTB_CB(READ8(sc3000_state, ppi_pb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(sc3000_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(UPD9255_1_TAG, I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(sf7000_state, ppi_pa_r)) + MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(sf7000_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UPD8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(UPD8251_TAG, i8251_device, write_dsr)) + + MCFG_UPD765A_ADD(UPD765_TAG, false, false) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", sf7000_floppies, "3ssdd", sf7000_state::floppy_formats) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(sc3000_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("sc3000_cass") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("flop_list","sf7000") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +/*************************************************************************** + ROMS +***************************************************************************/ + +ROM_START( sg1000 ) + ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) +ROM_END + +#define rom_sg1000m2 rom_sg1000 + +#define rom_sc3000 rom_sg1000 + +#define rom_sc3000h rom_sg1000 + +ROM_START( sf7000 ) + ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) + ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(d76810b8) SHA1(77339a6db2593aadc638bed77b8e9bed5d9d87e3) ) +ROM_END + +ROM_START( omv1000 ) + ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) + ROM_LOAD( "omvbios.bin", 0x0000, 0x4000, BAD_DUMP CRC(c5a67b95) SHA1(6d7c64dd60dee4a33061d3d3a7c2ed190d895cdb) ) // The BIOS comes from a Multivision FG-2000. It is still unknown if the FG-1000 BIOS differs +ROM_END + +ROM_START( omv2000 ) + ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) + ROM_LOAD( "omvbios.bin", 0x0000, 0x4000, CRC(c5a67b95) SHA1(6d7c64dd60dee4a33061d3d3a7c2ed190d895cdb) ) +ROM_END + +/*************************************************************************** + SYSTEM DRIVERS +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1983, sg1000, 0, 0, sg1000, sg1000, driver_device, 0, "Sega", "SG-1000", MACHINE_SUPPORTS_SAVE ) +CONS( 1984, sg1000m2, sg1000, 0, sc3000, sc3000, driver_device, 0, "Sega", "SG-1000 II", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, sc3000, 0, sg1000, sc3000, sc3000, driver_device, 0, "Sega", "SC-3000", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, sc3000h, sc3000, 0, sc3000, sc3000, driver_device, 0, "Sega", "SC-3000H", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, sf7000, sc3000, 0, sf7000, sf7000, driver_device, 0, "Sega", "SC-3000/Super Control Station SF-7000", MACHINE_SUPPORTS_SAVE ) +CONS( 1984, omv1000, sg1000, 0, omv, omv, driver_device, 0, "Tsukuda Original", "Othello Multivision FG-1000", MACHINE_SUPPORTS_SAVE ) +CONS( 1984, omv2000, sg1000, 0, omv, omv, driver_device, 0, "Tsukuda Original", "Othello Multivision FG-2000", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/sgi_ip2.c b/src/mame/drivers/sgi_ip2.c new file mode 100644 index 00000000000..628ee4e1997 --- /dev/null +++ b/src/mame/drivers/sgi_ip2.c @@ -0,0 +1,517 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/**************************************************************************** + + drivers/sgi_ip2.c + SGI IRIS 3130 skeleton driver with some meat on its bones + + by Harmony + + 0x00000000 - ? RAM (?) + 0x30000000 - 0x30017fff ROM (3x32k) + 0x30800000 - 0x30800000 Mouse Buttons (1) + 0x31000000 - 0x31000001 Mouse Quadrature (2) + 0x32000000 - 0x3200000f DUART0 (serial console on channel B at 19200 baud 8N1, channel A set to 600 baud 8N1 (mouse?)) + 0x32800000 - 0x3280000f DUART1 (printer/modem?) + 0x33000000 - 0x330007ff SRAM (2k) + 0x34000000 - 0x34000000 Clock Control (1) + 0x35000000 - 0x35000000 Clock Data (1) + 0x36000000 - 0x36000000 OS Base (1) + 0x38000000 - 0x38000001 Status Register (2) + 0x39000000 - 0x39000000 Parity control (1) + 0x3a000000 - 0x3a000000 Multibus Protection (1) + 0x3b000000 - 0x3b000003 Page Table Map Base (4) + 0x3c000000 - 0x3c000001 Text/Data Base (2) + 0x3d000000 - 0x3d000001 Text/Data Limit (2) + 0x3e000000 - 0x3e000001 Stack Base (2) + 0x3f000000 - 0x3f000001 Stack Limit (2) + + TODO: + Hook up keyboard + Hook up mouse + Hook up graphics + Hook up mass storage + + Interrupts: + M68K: + 6 - DUART + +****************************************************************************/ + +#include "emu.h" +#include "bus/rs232/rs232.h" +#include "sound/dac.h" +#include "cpu/m68000/m68000.h" +#include "machine/mc146818.h" /* TOD clock */ +#include "machine/mc68681.h" /* DUART0, DUART1 */ +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class sgi_ip2_state : public driver_device +{ +public: + sgi_ip2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_mainram(*this, "mainram"), + m_duarta(*this, "duart68681a"), + m_duartb(*this, "duart68681b"), + m_bss(*this, "bss"), + m_ptmap(*this, "ptmap"), + m_rtc(*this, "rtc") + { + } + + DECLARE_READ8_MEMBER(sgi_ip2_m_but_r); + DECLARE_WRITE8_MEMBER(sgi_ip2_m_but_w); + DECLARE_READ16_MEMBER(sgi_ip2_m_quad_r); + DECLARE_WRITE16_MEMBER(sgi_ip2_m_quad_w); + DECLARE_READ16_MEMBER(sgi_ip2_swtch_r); + DECLARE_READ8_MEMBER(sgi_ip2_clock_ctl_r); + DECLARE_WRITE8_MEMBER(sgi_ip2_clock_ctl_w); + DECLARE_READ8_MEMBER(sgi_ip2_clock_data_r); + DECLARE_WRITE8_MEMBER(sgi_ip2_clock_data_w); + DECLARE_READ8_MEMBER(sgi_ip2_os_base_r); + DECLARE_WRITE8_MEMBER(sgi_ip2_os_base_w); + DECLARE_READ16_MEMBER(sgi_ip2_status_r); + DECLARE_WRITE16_MEMBER(sgi_ip2_status_w); + DECLARE_READ8_MEMBER(sgi_ip2_parctl_r); + DECLARE_WRITE8_MEMBER(sgi_ip2_parctl_w); + DECLARE_READ8_MEMBER(sgi_ip2_mbp_r); + DECLARE_WRITE8_MEMBER(sgi_ip2_mbp_w); + DECLARE_READ32_MEMBER(sgi_ip2_ptmap_r); + DECLARE_WRITE32_MEMBER(sgi_ip2_ptmap_w); + DECLARE_READ16_MEMBER(sgi_ip2_tdbase_r); + DECLARE_WRITE16_MEMBER(sgi_ip2_tdbase_w); + DECLARE_READ16_MEMBER(sgi_ip2_tdlmt_r); + DECLARE_WRITE16_MEMBER(sgi_ip2_tdlmt_w); + DECLARE_READ16_MEMBER(sgi_ip2_stkbase_r); + DECLARE_WRITE16_MEMBER(sgi_ip2_stkbase_w); + DECLARE_READ16_MEMBER(sgi_ip2_stklmt_r); + DECLARE_WRITE16_MEMBER(sgi_ip2_stklmt_w); + DECLARE_DRIVER_INIT(sgi_ip2); + DECLARE_WRITE_LINE_MEMBER(duarta_irq_handler); + DECLARE_WRITE_LINE_MEMBER(duartb_irq_handler); + required_device m_maincpu; +protected: + required_shared_ptr m_mainram; + required_device m_duarta; + required_device m_duartb; + required_shared_ptr m_bss; + required_shared_ptr m_ptmap; + required_device m_rtc; +private: + UINT8 m_mbut; + UINT16 m_mquad; + UINT16 m_tdbase; + UINT16 m_tdlmt; + UINT16 m_stkbase; + UINT16 m_stklmt; + UINT8 m_parctl; + UINT8 m_mbp; + virtual void machine_start(); + virtual void machine_reset(); + inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); +}; + + +#define VERBOSE_LEVEL ( 0 ) + +#define ENABLE_VERBOSE_LOG (0) + +inline void ATTR_PRINTF(3,4) sgi_ip2_state::verboselog( int n_level, const char *s_fmt, ... ) +{ +#if ENABLE_VERBOSE_LOG + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror("%08x: %s", machine().device("maincpu")->safe_pc(), buf); + } +#endif +} + +/*************************************************************************** + MACHINE FUNCTIONS +***************************************************************************/ + +#define MBUT_RIGHT 0x01 /* Right button */ +#define MBUT_MIDDLE 0x02 /* Middle button */ +#define MBUT_LEFT 0x04 /* Left button */ +#define BOARD_REV1 0x60 /* Board revision - #1 */ +#define BOARD_REV2 0x50 /* Board revision - #2 */ + + +READ8_MEMBER(sgi_ip2_state::sgi_ip2_m_but_r) +{ + verboselog(0, "sgi_ip2_m_but_r: %02x\n", m_mbut | BOARD_REV1); + return m_mbut | BOARD_REV1; +} + +WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_m_but_w) +{ + verboselog(0, "sgi_ip2_m_but_w: %02x\n", data); + m_mbut = data; +} + +#define MOUSE_XFIRE 0x01 /* X Quadrature Fired, active low */ +#define MOUSE_XCHANGE 0x02 /* MOUSE_XCHANGE ? x-- : x++ */ +#define MOUSE_YFIRE 0x04 /* Y Quadrature Fired, active low */ +#define MOUSE_YCHANGE 0x08 /* MOUSE_YCHANGE ? y-- : y++ */ + + +READ16_MEMBER(sgi_ip2_state::sgi_ip2_m_quad_r) +{ + verboselog(0, "sgi_ip2_m_quad_r: %04x\n", m_mquad); + return m_mquad; +} + +WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_m_quad_w) +{ + verboselog(0, "sgi_ip2_m_quad_w = %04x & %04x\n", data, mem_mask); + COMBINE_DATA(&m_mquad); +} + +READ16_MEMBER(sgi_ip2_state::sgi_ip2_swtch_r) +{ + verboselog(0, "sgi_ip2_swtch_r: %04x\n", ioport("SWTCH")->read()); + return ioport("SWTCH")->read(); +} + +READ8_MEMBER(sgi_ip2_state::sgi_ip2_clock_ctl_r) +{ + UINT8 ret = m_rtc->read(space, 1); + verboselog(1, "sgi_ip2_clock_ctl_r: %02x\n", ret); + return ret; +} + +WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_clock_ctl_w) +{ + verboselog(1, "sgi_ip2_clock_ctl_w: %02x\n", data); + m_rtc->write(space, 1, data); +} + +READ8_MEMBER(sgi_ip2_state::sgi_ip2_clock_data_r) +{ + UINT8 ret = m_rtc->read(space, 0); + verboselog(1, "sgi_ip2_clock_data_r: %02x\n", ret); + return ret; +} + +WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_clock_data_w) +{ + verboselog(1, "sgi_ip2_clock_data_w: %02x\n", data); + m_rtc->write(space, 0, data); +} + + +READ8_MEMBER(sgi_ip2_state::sgi_ip2_os_base_r) +{ + switch(offset) + { + default: + verboselog(0, "sgi_ip2_os_base_r: Unknown Register %08x\n", 0x36000000 + offset); + break; + } + return 0; +} + +WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_os_base_w) +{ + switch(offset) + { + default: + verboselog(0, "sgi_ip2_os_base_w: Unknown Register %08x = %02x\n", 0x36000000 + offset, data); + break; + } +} + +READ16_MEMBER(sgi_ip2_state::sgi_ip2_status_r) +{ + switch(offset) + { + default: + verboselog(0, "sgi_ip2_status_r: Unknown Register %08x & %04x\n", 0x38000000 + (offset << 1), mem_mask); + break; + } + return 0; +} + +WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_status_w) +{ + switch(offset) + { + default: + verboselog(0, "sgi_ip2_status_w: Unknown Register %08x = %04x & %04x\n", 0x38000000 + (offset << 1), data, mem_mask); + break; + } +} + +#define PAR_UR 0x01 /* Check parity on user-mode reads */ +#define PAR_UW 0x02 /* Check parity on user-mode writes */ +#define PAR_KR 0x04 /* Check parity on kernel-mode reads */ +#define PAR_KW 0x08 /* Check parity on kernel-mode writes */ +#define PAR_DIS0 0x10 /* Disable access to DUART0 and LEDs */ +#define PAR_DIS1 0x20 /* Disable access to DUART1 */ +#define PAR_MBR 0x40 /* Check parity on multibus reads */ +#define PAR_MBW 0x80 /* Check parity on multibus writes */ + + +READ8_MEMBER(sgi_ip2_state::sgi_ip2_parctl_r) +{ + verboselog(0, "sgi_ip2_parctl_r: %02x\n", m_parctl); + return m_parctl; +} + +WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_parctl_w) +{ + verboselog(0, "sgi_ip2_parctl_w: %02x\n", data); + m_parctl = data; +} + +#define MBP_DCACC 0x01 /* Display controller access (I/O page 4) */ +#define MBP_UCACC 0x02 /* Update controller access (I/O page 3) */ +#define MBP_GFACC 0x04 /* Allow GF access (I/O page 1) */ +#define MBP_DMACC 0x08 /* Allow GL2 DMA access (0x8nnnnn - x0bnnnnn) */ +#define MBP_LIOACC 0x10 /* Allow lower I/O access (0x0nnnnn - 0x7nnnnn) */ +#define MBP_HIOACC 0x20 /* Allow upper I/O access (0x8nnnnn - 0xfnnnnn) */ +#define MBP_LMACC 0x40 /* Allow lower memory access (0x0nnnnn - 0x7nnnnn) */ +#define MBP_HMACC 0x80 /* Allow upper memory access (0x8nnnnn - 0xfnnnnn) */ + + +READ8_MEMBER(sgi_ip2_state::sgi_ip2_mbp_r) +{ + verboselog(0, "sgi_ip2_mbp_r: %02x\n", m_mbp); + return m_mbp; +} + +WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_mbp_w) +{ + verboselog(0, "sgi_ip2_mbp_w: %02x\n", data); + m_mbp = data; +} + + +READ32_MEMBER(sgi_ip2_state::sgi_ip2_ptmap_r) +{ + verboselog(0, "sgi_ip2_ptmap_r: %08x = %08x & %08x\n", 0x3b000000 + (offset << 2), m_ptmap[offset], mem_mask); + return m_ptmap[offset]; +} + +WRITE32_MEMBER(sgi_ip2_state::sgi_ip2_ptmap_w) +{ + verboselog(0, "sgi_ip2_ptmap_w: %08x = %08x & %08x\n", 0x3b000000 + (offset << 2), data, mem_mask); + COMBINE_DATA(&m_ptmap[offset]); +} + + +READ16_MEMBER(sgi_ip2_state::sgi_ip2_tdbase_r) +{ + verboselog(0, "sgi_ip2_tdbase_r: %04x\n", m_tdbase); + return m_tdbase; +} + +WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_tdbase_w) +{ + verboselog(0, "sgi_ip2_tdbase_w: %04x & %04x\n", data, mem_mask); + COMBINE_DATA(&m_tdbase); +} + + +READ16_MEMBER(sgi_ip2_state::sgi_ip2_tdlmt_r) +{ + verboselog(0, "sgi_ip2_tdlmt_r: %04x\n", m_tdlmt); + return m_tdlmt; +} + +WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_tdlmt_w) +{ + verboselog(0, "sgi_ip2_tdlmt_w: %04x & %04x\n", data, mem_mask); + COMBINE_DATA(&m_tdlmt); +} + + +READ16_MEMBER(sgi_ip2_state::sgi_ip2_stkbase_r) +{ + verboselog(0, "sgi_ip2_stkbase_r: %04x\n", m_stkbase); + return m_stkbase; +} + +WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_stkbase_w) +{ + verboselog(0, "sgi_ip2_stkbase_w: %04x & %04x\n", data, mem_mask); + COMBINE_DATA(&m_stkbase); +} + + +READ16_MEMBER(sgi_ip2_state::sgi_ip2_stklmt_r) +{ + verboselog(0, "sgi_ip2_stklmt_r: %04x\n", m_stklmt); + return m_stklmt; +} + +WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_stklmt_w) +{ + verboselog(0, "sgi_ip2_stklmt_w: %04x & %04x\n", data, mem_mask); + COMBINE_DATA(&m_stklmt); +} + +void sgi_ip2_state::machine_start() +{ +} + +void sgi_ip2_state::machine_reset() +{ +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + + +static ADDRESS_MAP_START(sgi_ip2_map, AS_PROGRAM, 32, sgi_ip2_state ) + AM_RANGE(0x00000000, 0x00ffffff) AM_RAM AM_SHARE("mainram") + AM_RANGE(0x02100000, 0x0210ffff) AM_RAM AM_SHARE("bss") // ??? I don't understand the need for this... + AM_RANGE(0x30000000, 0x30017fff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x30800000, 0x30800003) AM_READWRITE8(sgi_ip2_m_but_r, sgi_ip2_m_but_w, 0xffffffff) + AM_RANGE(0x31000000, 0x31000003) AM_READWRITE16(sgi_ip2_m_quad_r, sgi_ip2_m_quad_w, 0xffffffff) + AM_RANGE(0x31800000, 0x31800003) AM_READ16(sgi_ip2_swtch_r, 0xffffffff) + AM_RANGE(0x32000000, 0x3200000f) AM_DEVREADWRITE8("duart68681a", mc68681_device, read, write, 0xffffffff) + AM_RANGE(0x32800000, 0x3280000f) AM_DEVREADWRITE8("duart68681b", mc68681_device, read, write, 0xffffffff) + AM_RANGE(0x33000000, 0x330007ff) AM_RAM + AM_RANGE(0x34000000, 0x34000003) AM_READWRITE8(sgi_ip2_clock_ctl_r, sgi_ip2_clock_ctl_w, 0xffffffff) + AM_RANGE(0x35000000, 0x35000003) AM_READWRITE8(sgi_ip2_clock_data_r, sgi_ip2_clock_data_w, 0xffffffff) + AM_RANGE(0x36000000, 0x36000003) AM_READWRITE8(sgi_ip2_os_base_r, sgi_ip2_os_base_w, 0xffffffff) + AM_RANGE(0x38000000, 0x38000003) AM_READWRITE16(sgi_ip2_status_r, sgi_ip2_status_w, 0xffffffff) + AM_RANGE(0x39000000, 0x39000003) AM_READWRITE8(sgi_ip2_parctl_r, sgi_ip2_parctl_w, 0xffffffff) + AM_RANGE(0x3a000000, 0x3a000003) AM_READWRITE8(sgi_ip2_mbp_r, sgi_ip2_mbp_w, 0xffffffff) + AM_RANGE(0x3b000000, 0x3b003fff) AM_READWRITE(sgi_ip2_ptmap_r, sgi_ip2_ptmap_w) AM_SHARE("ptmap") + AM_RANGE(0x3c000000, 0x3c000003) AM_READWRITE16(sgi_ip2_tdbase_r, sgi_ip2_tdbase_w, 0xffffffff) + AM_RANGE(0x3d000000, 0x3d000003) AM_READWRITE16(sgi_ip2_tdlmt_r, sgi_ip2_tdlmt_w, 0xffffffff) + AM_RANGE(0x3e000000, 0x3e000003) AM_READWRITE16(sgi_ip2_stkbase_r, sgi_ip2_stkbase_w, 0xffffffff) + AM_RANGE(0x3f000000, 0x3f000003) AM_READWRITE16(sgi_ip2_stklmt_r, sgi_ip2_stklmt_w, 0xffffffff) +ADDRESS_MAP_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +WRITE_LINE_MEMBER(sgi_ip2_state::duarta_irq_handler) +{ + m_maincpu->set_input_line_and_vector(M68K_IRQ_6, state, M68K_INT_ACK_AUTOVECTOR); +} + +WRITE_LINE_MEMBER(sgi_ip2_state::duartb_irq_handler) +{ + m_maincpu->set_input_line_and_vector(M68K_IRQ_6, state, M68K_INT_ACK_AUTOVECTOR); +} + +static DEVICE_INPUT_DEFAULTS_START( ip2_terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_19200 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_19200 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +static MACHINE_CONFIG_START( sgi_ip2, sgi_ip2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68020, 16000000) + MCFG_CPU_PROGRAM_MAP(sgi_ip2_map) + + MCFG_MC68681_ADD( "duart68681a", XTAL_3_6864MHz ) /* Y3 3.6864MHz Xtal ??? copy-over from dectalk */ + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(sgi_ip2_state, duarta_irq_handler)) + MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + + MCFG_MC68681_ADD( "duart68681b", XTAL_3_6864MHz ) /* Y3 3.6864MHz Xtal ??? copy-over from dectalk */ + MCFG_MC68681_IRQ_CALLBACK(WRITELINE(sgi_ip2_state, duartb_irq_handler)) + + MCFG_MC146818_ADD( "rtc", XTAL_4_194304Mhz ) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duart68681a", mc68681_device, rx_b_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", ip2_terminal) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD( "dac", DAC, 0 ) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( sgi_ip2 ) + PORT_START("SWTCH") + PORT_DIPNAME( 0x8000, 0x8000, "Master/Slave" ) + PORT_DIPSETTING( 0x0000, "Slave" ) + PORT_DIPSETTING( 0x8000, "Master" ) + PORT_BIT( 0x6000, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_DIPNAME( 0x1800, 0x1800, "RS232 Console Speed" ) + PORT_DIPSETTING( 0x0000, "9600 Baud" ) + PORT_DIPSETTING( 0x0800, "300 Baud" ) + PORT_DIPSETTING( 0x1000, "1200 Baud" ) + PORT_DIPSETTING( 0x1800, "19200 Baud" ) + PORT_DIPNAME( 0x0700, 0x0000, "Display Setting" ) + PORT_DIPSETTING( 0x0000, "60Hz Non-Interlaced / 60Hz Non-Interlaced" ) + PORT_DIPSETTING( 0x0100, "60Hz Non-Interlaced / 30Hz Interlaced" ) + PORT_DIPSETTING( 0x0200, "60Hz Non-Interlaced / NTSC RS 170A" ) + PORT_DIPSETTING( 0x0300, "60Hz Non-Interlaced / PAL" ) + PORT_DIPSETTING( 0x0400, "30Hz Interlaced / 60Hz Non-Interlaced" ) + PORT_DIPSETTING( 0x0500, "30Hz Interlaced / 30Hz Interlaced" ) + PORT_DIPSETTING( 0x0600, "30Hz Interlaced / NTSC RS 170A" ) + PORT_DIPSETTING( 0x0700, "30Hz Interlaced / PAL" ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_DIPNAME( 0x0040, 0x0000, "Enable Dual-Head Display" ) + PORT_DIPSETTING( 0x0000, "Use Primary Display" ) + PORT_DIPSETTING( 0x0040, "Use Secondary Display" ) + PORT_DIPNAME( 0x0020, 0x0000, "Verbose Boot" ) + PORT_DIPSETTING( 0x0000, "Be Verbose" ) + PORT_DIPSETTING( 0x0020, "Be Quiet" ) + PORT_DIPNAME( 0x0010, 0x0000, "Auto-Boot" ) + PORT_DIPSETTING( 0x0000, "Enter PROM Monitor" ) + PORT_DIPSETTING( 0x0010, "Auto-Boot" ) + PORT_DIPNAME( 0x000f, 0x0005, "Boot Media" ) + PORT_DIPSETTING( 0x0000, "Hard Disk (IP, SD, MD)" ) + PORT_DIPSETTING( 0x0001, "Cartridge Tape" ) + PORT_DIPSETTING( 0x0002, "Floppy Disk (SF, MF)" ) + PORT_DIPSETTING( 0x0003, "Ethernet using XNS" ) + PORT_DIPSETTING( 0x0005, "Enter PROM Monitor" ) + PORT_DIPSETTING( 0x0006, "Boot from PROM Board" ) + PORT_DIPSETTING( 0x0007, "TCP/UDP Netboot" ) + PORT_DIPSETTING( 0x0009, "Interphase SMD Disk Boot" ) + PORT_DIPSETTING( 0x000a, "Storager Tape Boot (1)" ) + PORT_DIPSETTING( 0x000b, "Storager Tape Boot (2)" ) + PORT_DIPSETTING( 0x000c, "Stoarger Hard Disk Boot" ) + PORT_DIPSETTING( 0x000d, "DSD Tape Boot (1)" ) + PORT_DIPSETTING( 0x000e, "DSD Tape Boot (2)" ) + PORT_DIPSETTING( 0x000f, "DSD Hard Disk Boot" ) + +INPUT_PORTS_END + +DRIVER_INIT_MEMBER(sgi_ip2_state,sgi_ip2) +{ + UINT32 *src = (UINT32*)(memregion("maincpu")->base()); + UINT32 *dst = m_mainram; + memcpy(dst, src, 8); + + m_maincpu->reset(); +} + +/*************************************************************************** + + ROM definition(s) + +***************************************************************************/ + +ROM_START( sgi_ip2 ) + ROM_REGION32_BE(0x18000, "maincpu", 0) + ROM_LOAD( "sgi-ip2-u91.nolabel.od", 0x00000, 0x8000, CRC(32e1f6b5) SHA1(2bd928c3fe2e364b9a38189158e9bad0e5271a59) ) + ROM_LOAD( "sgi-ip2-u92.nolabel.od", 0x08000, 0x8000, CRC(13dbfdb3) SHA1(3361fb62f7a8c429653700bccfc3e937f7508182) ) + ROM_LOAD( "sgi-ip2-u93.ip2.2-008.od", 0x10000, 0x8000, CRC(bf967590) SHA1(1aac48e4f5531a25c5482f64de5cd3c7a9931f11) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1985, sgi_ip2, 0, 0, sgi_ip2, sgi_ip2, sgi_ip2_state, sgi_ip2, "Silicon Graphics Inc", "IRIS 3130 (IP2)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/sgi_ip6.c b/src/mame/drivers/sgi_ip6.c new file mode 100644 index 00000000000..c6125c81153 --- /dev/null +++ b/src/mame/drivers/sgi_ip6.c @@ -0,0 +1,269 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/**************************************************************************** + + drivers/sgi_ip6.c + SGI 4D/PI IP6 family skeleton driver + + by Harmony + + 0x1fc00000 - 0x1fc3ffff ROM + + Interrupts: + R2000: + NYI + +****************************************************************************/ + +#include "emu.h" +#include "cpu/mips/r3000.h" + + +struct ip6_regs_t +{ + UINT16 unknown_half_0; + UINT8 unknown_byte_0; + UINT8 unknown_byte_1; +}; + +class sgi_ip6_state : public driver_device +{ +public: + sgi_ip6_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + ip6_regs_t m_ip6_regs; + DECLARE_READ32_MEMBER(ip6_unk1_r); + DECLARE_WRITE32_MEMBER(ip6_unk1_w); + DECLARE_READ32_MEMBER(ip6_unk2_r); + DECLARE_WRITE32_MEMBER(ip6_unk2_w); + DECLARE_READ32_MEMBER(ip6_unk3_r); + DECLARE_WRITE32_MEMBER(ip6_unk3_w); + DECLARE_DRIVER_INIT(sgi_ip6); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_sgi_ip6(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(sgi_ip6_vbl); + inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); + required_device m_maincpu; +}; + + +#define VERBOSE_LEVEL ( 0 ) + +#define ENABLE_VERBOSE_LOG (1) + +inline void ATTR_PRINTF(3,4) sgi_ip6_state::verboselog( int n_level, const char *s_fmt, ... ) +{ +#if ENABLE_VERBOSE_LOG + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror("%08x: %s", machine().device("maincpu")->safe_pc(), buf); + } +#endif +} + +/*************************************************************************** + VIDEO HARDWARE +***************************************************************************/ + +void sgi_ip6_state::video_start() +{ +} + +UINT32 sgi_ip6_state::screen_update_sgi_ip6(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +/*************************************************************************** + MACHINE FUNCTIONS +***************************************************************************/ + + +READ32_MEMBER(sgi_ip6_state::ip6_unk1_r) +{ + UINT32 ret = 0; + switch(offset) + { + case 0x0000/4: + if(ACCESSING_BITS_16_31) + { + verboselog(0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask ); + } + if(ACCESSING_BITS_0_15) + { + verboselog(0, "ip6_unk1_r: Unknown Halfword 0: %08x & %08x\n", m_ip6_regs.unknown_half_0, mem_mask ); + ret |= m_ip6_regs.unknown_half_0; + } + break; + default: + verboselog(0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask ); + break; + } + return ret; +} + +WRITE32_MEMBER(sgi_ip6_state::ip6_unk1_w) +{ + switch(offset) + { + case 0x0000/4: + if(ACCESSING_BITS_16_31) + { + verboselog(0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask ); + } + if(ACCESSING_BITS_0_15) + { + verboselog(0, "ip6_unk1_w: Unknown Halfword 0 = %04x & %04x\n", data & 0x0000ffff, mem_mask & 0x0000ffff ); + m_ip6_regs.unknown_half_0 = data & 0x0000ffff; + } + break; + default: + verboselog(0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask ); + break; + } +} + +READ32_MEMBER(sgi_ip6_state::ip6_unk2_r) +{ + UINT32 ret = 0; + switch(offset) + { + case 0x0000/4: + if(!ACCESSING_BITS_24_31) + { + verboselog(0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask ); + } + if(ACCESSING_BITS_24_31) + { + verboselog(0, "ip6_unk2_r: Unknown Byte 0 = %02x & %02x\n", m_ip6_regs.unknown_byte_0, mem_mask >> 24 ); + ret |= m_ip6_regs.unknown_byte_0 << 24; + } + break; + default: + verboselog(0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask ); + break; + } + return ret; +} + +WRITE32_MEMBER(sgi_ip6_state::ip6_unk2_w) +{ + switch(offset) + { + case 0x0000/4: + if(!ACCESSING_BITS_24_31) + { + verboselog(0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask ); + } + if(ACCESSING_BITS_24_31) + { + verboselog(0, "ip6_unk2_w: Unknown Byte 0 = %02x & %02x\n", data >> 24, mem_mask >> 24 ); + m_ip6_regs.unknown_byte_0 = (data & 0xff000000) >> 24; + } + break; + default: + verboselog(0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask ); + break; + } +} + +READ32_MEMBER(sgi_ip6_state::ip6_unk3_r) +{ + UINT32 ret = 0; + if(ACCESSING_BITS_16_23) + { + verboselog(0, "ip6_unk3_r: Unknown Byte 1: %02x & %02x\n", m_ip6_regs.unknown_byte_1, (mem_mask >> 16) & 0x000000ff); + ret |= m_ip6_regs.unknown_byte_1 << 16; + } + else + { + verboselog(0, "ip6_unk3_r: Unknown address: %08x & %08x\n", 0x1fb00000 + (offset << 2), mem_mask ); + } + return ret; +} + +WRITE32_MEMBER(sgi_ip6_state::ip6_unk3_w) +{ + verboselog(0, "ip6_unk3_w: Unknown address: %08x = %08x & %08x\n", 0x1fb00000 + (offset << 2), data, mem_mask ); +} + +INTERRUPT_GEN_MEMBER(sgi_ip6_state::sgi_ip6_vbl) +{ +} + +void sgi_ip6_state::machine_start() +{ +} + +void sgi_ip6_state::machine_reset() +{ + m_ip6_regs.unknown_byte_0 = 0x80; + m_ip6_regs.unknown_byte_1 = 0x80; + m_ip6_regs.unknown_half_0 = 0; +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( sgi_ip6_map, AS_PROGRAM, 32, sgi_ip6_state ) + AM_RANGE( 0x1f880000, 0x1f880003 ) AM_READWRITE(ip6_unk1_r, ip6_unk1_w) + AM_RANGE( 0x1fb00000, 0x1fb00003 ) AM_READWRITE(ip6_unk3_r, ip6_unk3_w) + AM_RANGE( 0x1fbc004c, 0x1fbc004f ) AM_READWRITE(ip6_unk2_r, ip6_unk2_w) + AM_RANGE( 0x1fc00000, 0x1fc3ffff ) AM_ROM AM_REGION( "user1", 0 ) +ADDRESS_MAP_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static MACHINE_CONFIG_START( sgi_ip6, sgi_ip6_state ) + MCFG_CPU_ADD( "maincpu", R3041, 20000000 ) // FIXME: Should be R2000 + MCFG_R3000_ENDIANNESS(ENDIANNESS_BIG) + MCFG_CPU_CONFIG( config ) + MCFG_CPU_PROGRAM_MAP( sgi_ip6_map ) + MCFG_CPU_VBLANK_INT_DRIVER("screen", sgi_ip6_state, sgi_ip6_vbl) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE( 60 ) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(sgi_ip6_state, screen_update_sgi_ip6) + + +MACHINE_CONFIG_END + +static INPUT_PORTS_START( sgi_ip6 ) + PORT_START("UNUSED") // unused IN0 + PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +DRIVER_INIT_MEMBER(sgi_ip6_state,sgi_ip6) +{ +} + +/*************************************************************************** + + ROM definition(s) + +***************************************************************************/ + +ROM_START( sgi_ip6 ) + ROM_REGION32_BE( 0x40000, "user1", 0 ) + ROM_LOAD( "4d202031.bin", 0x000000, 0x040000, CRC(065a290a) SHA1(6f5738e79643f94901e6efe3612468d14177f65b) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1988, sgi_ip6, 0, 0, sgi_ip6, sgi_ip6, sgi_ip6_state, sgi_ip6, "Silicon Graphics Inc", "4D/PI (R2000, 20MHz)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/sh4robot.c b/src/mame/drivers/sh4robot.c new file mode 100644 index 00000000000..5ebe20f7530 --- /dev/null +++ b/src/mame/drivers/sh4robot.c @@ -0,0 +1,93 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + SH4 Robot + + http://perso.telecom-paristech.fr/~polti/robot/ + + 27/11/2013 Skeleton driver. + + + 0x0000 0000 - 0x7FFF FFFF : P0 area, cachable + 0x8000 0000 - 0x9FFF FFFF : P1 area, cachable + 0xA000 0000 - 0xBFFF FFFF : P2 area, non-cachable + 0xC000 0000 - 0xDFFF FFFF : P3 area, cachable + 0xE000 0000 - 0xFFFF FFFF : P4 area, non-cachable + + + 0x0000 0000 - 0x03FF FFFF : Area 0 (boot, ROM) + 0x0400 0000 - 0x07FF FFFF : Area 1 (FPGA) + 0x0800 0000 - 0x08FF FFFF : Area 2 (SDRAM 1, 16M) + 0x0C00 0000 - 0x0CFF FFFF : Area 3 (SDRAM 2, 16M) + 0x1000 0000 - 0x13FF FFFF : Area 4 (FPGA) + 0x1400 0000 - 0x17FF FFFF : Area 5 (FPGA) + 0x1800 0000 - 0x1BFF FFFF : Area 6 (FPGA) + 0x1C00 0000 - 0x1FFF FFFF : Area 7 (reserved) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/sh4/sh4.h" + +class sh4robot_state : public driver_device +{ +public: + sh4robot_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") { } + + + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(sh4robot_mem, AS_PROGRAM, 64, sh4robot_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x00000fff) AM_ROM + AM_RANGE(0x08000000, 0x08ffffff) AM_RAM // SDRAM 1 + AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM // SDRAM 2 + AM_RANGE(0xa0000000, 0xa0000fff) AM_ROM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sh4robot_io, AS_IO, 64, sh4robot_state ) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +static INPUT_PORTS_START( sh4robot ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( sh4robot, sh4robot_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", SH4LE, 200000000) // SH7750 + MCFG_SH4_MD0(1) + MCFG_SH4_MD1(0) + MCFG_SH4_MD2(1) + MCFG_SH4_MD3(0) + MCFG_SH4_MD4(0) + MCFG_SH4_MD5(1) + MCFG_SH4_MD6(0) + MCFG_SH4_MD7(1) + MCFG_SH4_MD8(0) + MCFG_SH4_CLOCK(200000000) + MCFG_CPU_PROGRAM_MAP(sh4robot_mem) + MCFG_CPU_IO_MAP(sh4robot_io) + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sh4robot ) + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "bootloader.bin", 0x0000, 0x0882, CRC(d2ea0b7d) SHA1(7dd566c5e325d1ce1156a0bcbd7e10d011e9d35f)) + + // FLASH TC58128AFT + // flash blocks 1 till 199 (1*32*512 till 199*32*512) + //ROM_LOAD( "vmlinux-nand_img_with_oob-2.6.10-v1.0", 0x0000, 0x149be0, CRC(eec69ef5) SHA1(524e26d2c2c28061911f4726646b18596d134736)) + // Root FS at flash blocks from 201 till end (201*32*512) + //ROM_LOAD( "shix-linux-v1.0.yaffs", 0x0000, 0x7e9e40, CRC(7a7fdb04) SHA1(0b761e2d179335398399cb046de4e591157cb72f)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ +COMP( 20??, sh4robot, 0, 0, sh4robot, sh4robot, driver_device, 0, "", "Robot", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/sitcom.c b/src/mame/drivers/sitcom.c new file mode 100644 index 00000000000..4f98a75a42d --- /dev/null +++ b/src/mame/drivers/sitcom.c @@ -0,0 +1,135 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + SITCOM (known as Sitcom, Sitcom85, Sitcom8085) + + 25/09/2011 Driver [Robbbert] + + http://www.izabella.me.uk/html/sitcom_.html + http://www.sbprojects.com/sitcom/sitcom.htm + + The display consists of a LED connected to SOD, and a pair of + DL1414 intelligent alphanumeric displays. + + The idea of this device is that you write a 8085 program with an + assembler on your PC. You then compile it, and then send it to + the SITCOM via a serial cable. The program then (hopefully) runs + on the SITCOM. With the 8255 expansion, you could wire up input + devices or other hardware for your program to use. + + The SOD LED blinks slowly while waiting; stays on while downloading; + and blinks quickly if an error occurs. + + After a successful download, the ROM is switched out and the RAM + mirrored to the lower 32k. The downloaded program is then executed. + This part is not emulated. + + In MESS, start emulation. After about 10 seconds the display will + scroll sideways with a message and a weblink. There are no input keys. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "video/dl1416.h" +#include "sitcom.lh" + + + +class sitcom_state : public driver_device +{ +public: + sitcom_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ds0(*this, "ds0"), + m_ds1(*this, "ds1") + { } + + required_device m_maincpu; + required_device m_ds0; + required_device m_ds1; + DECLARE_WRITE_LINE_MEMBER(sod_led); + DECLARE_READ_LINE_MEMBER(sid_line); + virtual void machine_reset(); + DECLARE_WRITE16_MEMBER(sitcom_update_ds0); + DECLARE_WRITE16_MEMBER(sitcom_update_ds1); +}; + +static ADDRESS_MAP_START( sitcom_mem, AS_PROGRAM, 8, sitcom_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sitcom_io, AS_IO, 8, sitcom_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // AM_RANGE(0x00, 0x1f) 8255 for expansion only + AM_RANGE(0xc0, 0xc3) AM_DEVWRITE("ds0", dl1416_device, data_w) //left display + AM_RANGE(0xe0, 0xe3) AM_DEVWRITE("ds1", dl1416_device, data_w) //right display +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sitcom ) +INPUT_PORTS_END + +void sitcom_state::machine_reset() +{ + m_ds0->ce_w(0); // enable + m_ds0->wr_w(0); + m_ds0->cu_w(1); // no cursor + m_ds1->ce_w(0); + m_ds1->wr_w(0); + m_ds1->cu_w(1); +} + +WRITE16_MEMBER(sitcom_state::sitcom_update_ds0) +{ + output_set_digit_value(offset, data); +} + +WRITE16_MEMBER(sitcom_state::sitcom_update_ds1) +{ + output_set_digit_value(4 + offset, data); +} + +// SID line used as serial input from a pc +READ_LINE_MEMBER( sitcom_state::sid_line ) +{ + return 1; //idle - changing to 0 gives a FR ERROR +} + +WRITE_LINE_MEMBER( sitcom_state::sod_led ) +{ + output_set_value("sod_led", state); +} + +static MACHINE_CONFIG_START( sitcom, sitcom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8085A, XTAL_6_144MHz) // 3.072MHz can be used for an old slow 8085 + MCFG_CPU_PROGRAM_MAP(sitcom_mem) + MCFG_CPU_IO_MAP(sitcom_io) + MCFG_I8085A_SID(READLINE(sitcom_state, sid_line)) + MCFG_I8085A_SOD(WRITELINE(sitcom_state, sod_led)) + + MCFG_DEFAULT_LAYOUT(layout_sitcom) + + /* video hardware */ + MCFG_DEVICE_ADD("ds0", DL1416B, 0) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(sitcom_state, sitcom_update_ds0)) + MCFG_DEVICE_ADD("ds1", DL1416B, 0) + MCFG_DL1416_UPDATE_HANDLER(WRITE16(sitcom_state, sitcom_update_ds1)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sitcom ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "boot8085.bin", 0x0000, 0x06b8, CRC(1b5e3310) SHA1(3323b65f0c10b7ab6bb75ec824e6d5fb643693a8)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 2002, sitcom, 0, 0, sitcom, sitcom, driver_device, 0, "San Bergmans & Izabella Malcolm", "Sitcom", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/slc1.c b/src/mame/drivers/slc1.c new file mode 100644 index 00000000000..14f3631cc8b --- /dev/null +++ b/src/mame/drivers/slc1.c @@ -0,0 +1,285 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +2011-JUL-16 SLC1 skeleton driver [Robbbert] +2011-DEC-29 Working [Robbbert] + +http://www.jens-mueller.org/jkcemu/slc1.html + +This computer is both a Z80 trainer, and a chess computer. + The keyboard is different between the two, so + we redefine it for your convenience. + + There is no chess board attached. You supply your own + and you sync the pieces and the computer instructions. + + When started, it is in Chess mode. Press 11111 to switch to + Trainer mode. + +Hardware + 4 Kbytes ROM in the address range 0000-0FFF + 1 Kbyte RAM in the address range 5000-53ff (user area starts at 5100) + 6-digit 7-segment display + Busy LED + Keyboard with 12 keys + +Keys: + 0-7 : hexadecimal numbers + Shift then 0-7 : Hexadecimal 8-F (decimal points will appear) + ADR : enter an address to work with. After the 4 digits are entered, + the data at that address shows, and you can modify the data. + + (inc) : Enter the data into memory, and increment the address by 1. + +Pasting doesn't work, but if it did... + + Pasting: + 0-7 : as is + 8-F : H, then 0-7 + + : ^ + - : H^ + ADR : - + + Test Paste: + [[[[[-510011^22^33^44^55^66^77^H8H8^H9H9^-5100 + Now press up-arrow to confirm the data has been entered. + + + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "slc1.lh" + + +class slc1_state : public driver_device +{ +public: + slc1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker") + { } + + required_device m_maincpu; + required_device m_speaker; + DECLARE_READ8_MEMBER( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + UINT8 m_digit; + bool m_kbd_type; + virtual void machine_reset(); + virtual void machine_start(); +}; + + + + +/*************************************************************************** + + Display + +***************************************************************************/ + +WRITE8_MEMBER( slc1_state::io_w ) +{ + bool segonoff = BIT(data, 7); + bool busyled = BIT(data, 4); + data &= 15; + + if (data < 8) + m_digit = data; + else + if (data < 12) + { + m_speaker->level_w(BIT(data, 1)); + return; + } + else + if (offset == 0x2f07) + return; + + UINT8 segdata = output_get_digit_value(m_digit); + UINT8 segnum = offset & 7; + UINT8 segmask = 1 << segnum; + + if (segonoff) + segdata |= segmask; + else + segdata &= ~segmask; + + output_set_digit_value(m_digit, segdata); + + output_set_value("busyled", busyled); + + if (m_digit == 3) + m_kbd_type = (segdata); +} + + +/*************************************************************************** + + Keyboard + +***************************************************************************/ + +READ8_MEMBER( slc1_state::io_r ) +{ + UINT8 data = 0xff, upper = (offset >> 8) & 7; + + if (m_kbd_type) + { // Trainer + if (upper == 3) + data &= ioport("Y0")->read(); + else + if (upper == 4) + data &= ioport("Y1")->read(); + else + if (upper == 5) + data &= ioport("Y2")->read(); + } + else + { // Chess + if (upper == 3) + data &= ioport("X0")->read(); + else + if (upper == 4) + data &= ioport("X1")->read(); + else + if (upper == 5) + data &= ioport("X2")->read(); + } + + return data; +} + + + +/*************************************************************************** + + Machine + +***************************************************************************/ + +void slc1_state::machine_start() +{ +} + +void slc1_state::machine_reset() +{ +} + + + +/*************************************************************************** + + Address Map + +***************************************************************************/ + +static ADDRESS_MAP_START( slc1_map, AS_PROGRAM, 8, slc1_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x4fff) + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x5000, 0x53ff) AM_RAM AM_MIRROR(0xc00) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( slc1_io, AS_IO, 8, slc1_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_READWRITE(io_r,io_w) +ADDRESS_MAP_END + + +/************************************************************************** + + Keyboard Layout + +***************************************************************************/ + +static INPUT_PORTS_START( slc1 ) +// Chess Keyboard + PORT_START("X0") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4 T") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3 L") PORT_CODE(KEYCODE_3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2 S") PORT_CODE(KEYCODE_2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A1 B") PORT_CODE(KEYCODE_1) PORT_CHAR('[') + + PORT_START("X1") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5 D") PORT_CODE(KEYCODE_5) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6 K") PORT_CODE(KEYCODE_6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) + + PORT_START("X2") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("St") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + +// Trainer Keyboard + PORT_START("Y0") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 B") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 A") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 9") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 8") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_START("Y1") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 C INS") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 D DEL") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 E BL") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 F Go") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("Y2") + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fu DP") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+-1 SS") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Seq BG") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADR BP") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') +INPUT_PORTS_END + + +/*************************************************************************** + + Machine driver + +***************************************************************************/ + +static MACHINE_CONFIG_START( slc1, slc1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 2500000) + MCFG_CPU_PROGRAM_MAP(slc1_map) + MCFG_CPU_IO_MAP(slc1_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_slc1) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver + +***************************************************************************/ + +ROM_START(slc1) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "bios0", "SLC-1") + ROMX_LOAD("slc1_0000.bin", 0x0000, 0x1000, CRC(06d32967) SHA1(f25eac66a4fca9383964d509c671a7ad2e020e7e), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "bios1", "SC-1 v2") + ROMX_LOAD("sc1-v2.bin", 0x0000, 0x1000, CRC(1f122a85) SHA1(d60f89f8b59d04f4cecd6e3ecfe0a24152462a36), ROM_BIOS(2) ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1989, slc1, 0, 0, slc1, slc1, driver_device, 0, "Dr. Dieter Scheuschner", "SLC-1" , 0 ) diff --git a/src/mame/drivers/slicer.c b/src/mame/drivers/slicer.c new file mode 100644 index 00000000000..ca322b43001 --- /dev/null +++ b/src/mame/drivers/slicer.c @@ -0,0 +1,143 @@ +// license:BSD-3-Clause +// copyright-holders:Carl + +// Slicer Computers Slicer 80186 SBC +// The bios makefile refers to a "exe3bin" utility, this can be substituted with FreeDOS exe2bin and the /l=0xf800 option +// which will fixup the relocations + +#include "emu.h" +#include "cpu/i86/i186.h" +#include "machine/wd_fdc.h" +#include "machine/mc68681.h" +#include "bus/rs232/rs232.h" +#include "bus/isa/isa.h" +#include "bus/scsi/scsi.h" + +class slicer_state : public driver_device +{ +public: + slicer_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_fdc(*this, "fdc"), + m_sasi(*this, "sasi") + {} + + required_device m_fdc; + required_device m_sasi; + + DECLARE_WRITE8_MEMBER(sio_out_w); + DECLARE_WRITE8_MEMBER(drive_sel_w); +}; + +WRITE8_MEMBER(slicer_state::sio_out_w) +{ + floppy_image_device *floppy; + int state = (data & 0x80) ? 0 : 1; + char devname[8]; + + for(int i = 0; i < 4; i++) + { + sprintf(devname, "%d", i); + floppy = m_fdc->subdevice(devname)->get_device(); + if(floppy) + floppy->mon_w(state); + } +} + +WRITE8_MEMBER(slicer_state::drive_sel_w) +{ + data &= 1; + switch(offset) + { + case 0: + m_sasi->write_sel(data); + break; + case 1: + m_sasi->write_rst(data); + break; + case 7: + m_fdc->dden_w(data); + break; + + default: + { + floppy_image_device *floppy; + char devname[8]; + unsigned int drive = 3 - (offset - 2); + if((drive > 3) || !data) + break; + + sprintf(devname, "%d", drive); + floppy = m_fdc->subdevice(devname)->get_device(); + m_fdc->set_floppy(floppy); + break; + } + } +} + +static ADDRESS_MAP_START( slicer_map, AS_PROGRAM, 16, slicer_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM // fixed 256k for now + AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION("bios", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( slicer_io, AS_IO, 16, slicer_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x007f) AM_DEVREADWRITE8("fdc", fd1797_t, read, write, 0x00ff) //PCS0 + AM_RANGE(0x0080, 0x00ff) AM_DEVREADWRITE8("sc2681", mc68681_device, read, write, 0x00ff) //PCS1 + AM_RANGE(0x0100, 0x017f) AM_WRITE8(drive_sel_w, 0x00ff) //PCS2 + // TODO: 0x180 sets ack + AM_RANGE(0x0180, 0x0181) AM_DEVREAD8("sasi_data_in", input_buffer_device, read, 0x00ff) AM_DEVWRITE8("sasi_data_out", output_latch_device, write, 0x00ff) //PCS3 + AM_RANGE(0x0180, 0x0181) AM_DEVREAD8("sasi_ctrl_in", input_buffer_device, read, 0xff00) + AM_RANGE(0x0184, 0x0185) AM_DEVREAD8("sasi_data_in", input_buffer_device, read, 0x00ff) AM_DEVWRITE8("sasi_data_out", output_latch_device, write, 0x00ff) + AM_RANGE(0x0184, 0x0185) AM_DEVREAD8("sasi_ctrl_in", input_buffer_device, read, 0xff00) +ADDRESS_MAP_END + +static SLOT_INTERFACE_START( slicer_floppies ) + SLOT_INTERFACE("525dd", FLOPPY_525_DD) + SLOT_INTERFACE("8dsdd", FLOPPY_8_DSDD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( slicer, slicer_state ) + MCFG_CPU_ADD("maincpu", I80186, XTAL_16MHz / 2) + MCFG_CPU_PROGRAM_MAP(slicer_map) + MCFG_CPU_IO_MAP(slicer_io) + + MCFG_MC68681_ADD("sc2681", XTAL_3_6864MHz) + MCFG_MC68681_IRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int0_w)) + MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232_1", rs232_port_device, write_txd)) + MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE("rs232_2", rs232_port_device, write_txd)) + MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(slicer_state, sio_out_w)) + + MCFG_RS232_PORT_ADD("rs232_1", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_a_w)) + MCFG_RS232_PORT_ADD("rs232_2", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_b_w)) + + MCFG_FD1797_ADD("fdc", XTAL_16MHz/2/8) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int1_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq0_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", slicer_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", slicer_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", slicer_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", slicer_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD("sasi", SCSI_PORT, 0) + MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in") + MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) + MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) + MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit5)) + MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit6)) + MCFG_SCSI_IO_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit7)) + + MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", "sasi") + MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0) + MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0) +MACHINE_CONFIG_END + +ROM_START( slicer ) + ROM_REGION(0x8001, "bios", 0) + // built from sources, reset.asm adds an extra byte + ROM_LOAD("epbios.bin", 0x0000, 0x8001, CRC(96fe9dd4) SHA1(5fc43454fe7d51f2ae97aef822155dcd28eb7f23)) +ROM_END + +COMP( 1983, slicer, 0, 0, slicer, 0, driver_device, 0, "Slicer Computers", "Slicer", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/sm1800.c b/src/mame/drivers/sm1800.c new file mode 100644 index 00000000000..51e5648273c --- /dev/null +++ b/src/mame/drivers/sm1800.c @@ -0,0 +1,201 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + SM1800 (original name is CM1800 in cyrilic letters) + + 10/12/2010 Skeleton driver. + + On board hardware : + KR580VM80A central processing unit (i8080) + KR580VG75 programmable CRT video display controller (i8275) + KR580VV55 programmable parallel interface (i8255) + KR580IK51 programmable serial interface/communication controller (i8251) + KR580VV79 programmable peripheral device, keyboard and display controller (i8279) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "video/i8275.h" + + +class sm1800_state : public driver_device +{ +public: + sm1800_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_uart(*this, "i8251"), + m_ppi(*this, "i8255"), + m_crtc(*this, "i8275"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_uart; + required_device m_ppi; + required_device m_crtc; + required_device m_palette; + DECLARE_WRITE8_MEMBER(sm1800_8255_portb_w); + DECLARE_WRITE8_MEMBER(sm1800_8255_portc_w); + DECLARE_READ8_MEMBER(sm1800_8255_porta_r); + DECLARE_READ8_MEMBER(sm1800_8255_portc_r); + UINT8 m_irq_state; + virtual void machine_reset(); + DECLARE_PALETTE_INIT(sm1800); + INTERRUPT_GEN_MEMBER(sm1800_vblank_interrupt); + IRQ_CALLBACK_MEMBER(sm1800_irq_callback); + I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); +}; + +static ADDRESS_MAP_START(sm1800_mem, AS_PROGRAM, 8, sm1800_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff ) AM_ROM + //AM_RANGE( 0x0fb0, 0x0fff ) AM_DEVWRITE("i8275", i8275_device, dack_w) + AM_RANGE( 0x1000, 0x17ff ) AM_RAM // videoram looks like 1080-17FF, normal ascii +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sm1800_io, AS_IO, 8, sm1800_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x3c, 0x3d ) AM_DEVREADWRITE("i8275", i8275_device, read, write) + AM_RANGE( 0x5c, 0x5c) AM_DEVREADWRITE("i8251", i8251_device, data_r, data_w) + AM_RANGE( 0x5d, 0x5d) AM_DEVREADWRITE("i8251", i8251_device, status_r, control_w) + AM_RANGE( 0x6c, 0x6f ) AM_DEVREADWRITE("i8255", i8255_device, read, write) + //AM_RANGE( 0x74, 0x74 ) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) + //AM_RANGE( 0x75, 0x75 ) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sm1800 ) +INPUT_PORTS_END + +IRQ_CALLBACK_MEMBER(sm1800_state::sm1800_irq_callback) +{ + return 0xff; +} + +void sm1800_state::machine_reset() +{ +} + +INTERRUPT_GEN_MEMBER(sm1800_state::sm1800_vblank_interrupt) +{ + m_maincpu->set_input_line(0, m_irq_state ? HOLD_LINE : CLEAR_LINE); + m_irq_state ^= 1; +} + +I8275_DRAW_CHARACTER_MEMBER( sm1800_state::crtc_display_pixels ) +{ + int i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 *charmap = memregion("chargen")->base(); + UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; + if (vsp) + pixels = 0; + + if (lten) + pixels = 0xff; + + if (rvv) + pixels ^= 0xff; + + for(i=0;i<8;i++) + bitmap.pix32(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; +} + +WRITE8_MEMBER( sm1800_state::sm1800_8255_portb_w ) +{ +} + +WRITE8_MEMBER( sm1800_state::sm1800_8255_portc_w ) +{ +} + +READ8_MEMBER( sm1800_state::sm1800_8255_porta_r ) +{ + return 0xff; +} + +READ8_MEMBER( sm1800_state::sm1800_8255_portc_r ) +{ + return 0; +} + +PALETTE_INIT_MEMBER(sm1800_state, sm1800) +{ + palette.set_pen_color(0, rgb_t::black); // black + palette.set_pen_color(1, 0xa0, 0xa0, 0xa0); // white + palette.set_pen_color(2, rgb_t::white); // highlight +} + + +/* F4 Character Displayer */ +static const gfx_layout sm1800_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( sm1800 ) + GFXDECODE_ENTRY( "chargen", 0x0000, sm1800_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( sm1800, sm1800_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(sm1800_mem) + MCFG_CPU_IO_MAP(sm1800_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", sm1800_state, sm1800_vblank_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(sm1800_state,sm1800_irq_callback) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(sm1800_state, sm1800) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", sm1800) + + /* Devices */ + MCFG_DEVICE_ADD("i8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(sm1800_state, sm1800_8255_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(sm1800_state, sm1800_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(sm1800_state, sm1800_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(sm1800_state, sm1800_8255_portc_w)) + + MCFG_DEVICE_ADD("i8275", I8275, 2000000) + MCFG_I8275_CHARACTER_WIDTH(8) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(sm1800_state, crtc_display_pixels) + + MCFG_DEVICE_ADD("i8251", I8251, 0) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sm1800 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "prog.bin", 0x0000, 0x0800, CRC(55736ad5) SHA1(b77f720f1b64b208dd6a5d4f9c9521d1284028e9)) + + ROM_REGION(0x0800, "chargen", 0) + ROM_LOAD( "font.bin", 0x0000, 0x0800, CRC(28ed9ebc) SHA1(f561136962a06a5dcb5a0436931d29e940155d24)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( ????, sm1800, 0, 0, sm1800, sm1800, driver_device, 0, "", "SM1800", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/smc777.c b/src/mame/drivers/smc777.c new file mode 100644 index 00000000000..db6e3ec6f14 --- /dev/null +++ b/src/mame/drivers/smc777.c @@ -0,0 +1,1027 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese +/************************************************************************************* + + SMC-777 (c) 1983 Sony + + driver by Angelo Salese + + TODO: + - no real documentation, the entire driver is just a bunch of educated + guesses ... + - ROM/RAM bankswitch, it apparently happens after one instruction prefetching. + We currently use an hackish implementation until the MAME/MESS framework can + support that ... + - keyboard input is very sluggish; + - cursor stuck in Bird Crash; + - add mc6845 features; + - many other missing features; + +**************************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/sn76496.h" +#include "sound/beep.h" +#include "video/mc6845.h" +#include "machine/wd_fdc.h" +#include "imagedev/flopdrv.h" + +#define MASTER_CLOCK XTAL_4_028MHz + +#define mc6845_h_char_total (m_crtc_vreg[0]+1) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]+1) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + +class smc777_state : public driver_device +{ +public: + smc777_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "crtc"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_beeper(*this, "beeper"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + DECLARE_WRITE8_MEMBER(mc6845_w); + DECLARE_READ8_MEMBER(vram_r); + DECLARE_READ8_MEMBER(attr_r); + DECLARE_READ8_MEMBER(pcg_r); + DECLARE_WRITE8_MEMBER(vram_w); + DECLARE_WRITE8_MEMBER(attr_w); + DECLARE_WRITE8_MEMBER(pcg_w); + DECLARE_READ8_MEMBER(fbuf_r); + DECLARE_WRITE8_MEMBER(fbuf_w); + DECLARE_READ8_MEMBER(key_r); + DECLARE_WRITE8_MEMBER(key_w); + DECLARE_WRITE8_MEMBER(border_col_w); + DECLARE_READ8_MEMBER(system_input_r); + DECLARE_WRITE8_MEMBER(system_output_w); + DECLARE_WRITE8_MEMBER(color_mode_w); + DECLARE_WRITE8_MEMBER(ramdac_w); + DECLARE_READ8_MEMBER(display_reg_r); + DECLARE_WRITE8_MEMBER(display_reg_w); + DECLARE_READ8_MEMBER(smc777_mem_r); + DECLARE_WRITE8_MEMBER(smc777_mem_w); + DECLARE_READ8_MEMBER(irq_mask_r); + DECLARE_WRITE8_MEMBER(irq_mask_w); + DECLARE_PALETTE_INIT(smc777); + UINT32 screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vblank_irq); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); + + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); + DECLARE_READ8_MEMBER(fdc_request_r); + DECLARE_WRITE8_MEMBER(floppy_select_w); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + +protected: + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + +private: + required_device m_maincpu; + required_device m_crtc; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_beeper; + required_device m_gfxdecode; + required_device m_palette; + + UINT8 *m_ipl_rom; + UINT8 *m_work_ram; + UINT8 *m_vram; + UINT8 *m_attr; + UINT8 *m_gvram; + UINT8 *m_pcg; + + UINT8 m_keyb_press; + UINT8 m_keyb_press_flag; + UINT8 m_shift_press_flag; + UINT8 m_backdrop_pen; + UINT8 m_display_reg; + UINT8 m_fdc_irq_flag; + UINT8 m_fdc_drq_flag; + UINT8 m_system_data; + struct { UINT8 r,g,b; } m_pal; + UINT8 m_raminh,m_raminh_pending_change; //bankswitch + UINT8 m_raminh_prefetch; + UINT8 m_irq_mask; + UINT8 m_pal_mode; + UINT8 m_keyb_cmd; + UINT8 m_crtc_vreg[0x20]; + UINT8 m_crtc_addr; +}; + + +/* TODO: correct calculation thru mc6845 regs */ +#define CRTC_MIN_X 24*8 +#define CRTC_MIN_Y 4*8 + +void smc777_state::video_start() +{ +} + +UINT32 smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,yi; + UINT16 count; + int x_width; + +// popmessage("%d %d %d %d",mc6845_v_char_total,mc6845_v_total_adj,mc6845_v_display,mc6845_v_sync_pos); + + bitmap.fill(m_palette->pen(m_backdrop_pen), cliprect); + + x_width = ((m_display_reg & 0x80) >> 7); + + count = 0x0000; + + for(yi=0;yi<8;yi++) + { + for(y=0;y<200;y+=8) + { + for(x=0;x<160;x++) + { + UINT16 color; + + color = (m_gvram[count] & 0xf0) >> 4; + /* todo: clean this up! */ + //if(x_width) + { + bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = m_palette->pen(color); + } + //else + //{ + // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+0+CRTC_MIN_X) = m_palette->pen(color); + //} + + color = (m_gvram[count] & 0x0f) >> 0; + //if(x_width) + { + bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = m_palette->pen(color); + } + //else + //{ + // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+1+CRTC_MIN_X) = m_palette->pen(color); + //} + + count++; + + } + } + count+= 0x60; + } + + count = 0x0000; + + for(y=0;y<25;y++) + { + for(x=0;x<80/(x_width+1);x++) + { + /* + -x-- ---- blink + --xx x--- bg color (00 transparent, 01 white, 10 black, 11 complementary to fg color + ---- -xxx fg color + */ + int tile = m_vram[count]; + int color = m_attr[count] & 7; + int bk_color = (m_attr[count] & 0x18) >> 3; + int blink = m_attr[count] & 0x40; + int xi; + int bk_pen; + //int bk_struct[4] = { -1, 0x10, 0x11, (color & 7) ^ 8 }; + + bk_pen = -1; + switch(bk_color & 3) + { + case 0: bk_pen = -1; break; //transparent + case 1: bk_pen = 0x17; break; //white + case 2: bk_pen = 0x10; break; //black + case 3: bk_pen = (color ^ 0xf); break; //complementary + } + + if(blink && machine().first_screen()->frame_number() & 0x10) //blinking, used by Dragon's Alphabet + color = bk_pen; + + for(yi=0;yi<8;yi++) + { + for(xi=0;xi<8;xi++) + { + int pen; + + pen = ((m_pcg[tile*8+yi]>>(7-xi)) & 1) ? (color+m_pal_mode) : bk_pen; + + if (pen != -1) + { + if(x_width) + { + bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+0+CRTC_MIN_X) = m_palette->pen(pen); + bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+1+CRTC_MIN_X) = m_palette->pen(pen); + } + else + bitmap.pix16(y*8+CRTC_MIN_Y+yi, x*8+CRTC_MIN_X+xi) = m_palette->pen(pen); + } + } + } + + // draw cursor + if(mc6845_cursor_addr == count) + { + int xc,yc,cursor_on; + + cursor_on = 0; + switch(mc6845_cursor_y_start & 0x60) + { + case 0x00: cursor_on = 1; break; //always on + case 0x20: cursor_on = 0; break; //always off + case 0x40: if(machine().first_screen()->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink + case 0x60: if(machine().first_screen()->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink + } + + if(cursor_on) + { + for(yc=0;yc<(8-(mc6845_cursor_y_start & 7));yc++) + { + for(xc=0;xc<8;xc++) + { + if(x_width) + { + bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+0+CRTC_MIN_X) = m_palette->pen(0x7); + bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+1+CRTC_MIN_X) = m_palette->pen(0x7); + } + else + bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = m_palette->pen(0x7); + } + } + } + } + + (m_display_reg & 0x80) ? count+=2 : count++; + } + } + + return 0; +} + +WRITE8_MEMBER(smc777_state::mc6845_w) +{ + if(offset == 0) + { + m_crtc_addr = data; + m_crtc->address_w(space, 0,data); + } + else + { + m_crtc_vreg[m_crtc_addr] = data; + m_crtc->register_w(space, 0,data); + } +} + +READ8_MEMBER(smc777_state::vram_r) +{ + UINT16 vram_index; + + vram_index = ((offset & 0x0007) << 8); + vram_index |= ((offset & 0xff00) >> 8); + + return m_vram[vram_index]; +} + +READ8_MEMBER(smc777_state::attr_r) +{ + UINT16 vram_index; + + vram_index = ((offset & 0x0007) << 8); + vram_index |= ((offset & 0xff00) >> 8); + + return m_attr[vram_index]; +} + +READ8_MEMBER(smc777_state::pcg_r) +{ + UINT16 vram_index; + + vram_index = ((offset & 0x0007) << 8); + vram_index |= ((offset & 0xff00) >> 8); + + return m_pcg[vram_index]; +} + +WRITE8_MEMBER(smc777_state::vram_w) +{ + UINT16 vram_index; + + vram_index = ((offset & 0x0007) << 8); + vram_index |= ((offset & 0xff00) >> 8); + + m_vram[vram_index] = data; +} + +WRITE8_MEMBER(smc777_state::attr_w) +{ + UINT16 vram_index; + + vram_index = ((offset & 0x0007) << 8); + vram_index |= ((offset & 0xff00) >> 8); + + m_attr[vram_index] = data; +} + +WRITE8_MEMBER(smc777_state::pcg_w) +{ + UINT16 vram_index; + + vram_index = ((offset & 0x0007) << 8); + vram_index |= ((offset & 0xff00) >> 8); + + m_pcg[vram_index] = data; + + m_gfxdecode->gfx(0)->mark_dirty(vram_index >> 3); +} + +READ8_MEMBER(smc777_state::fbuf_r) +{ + UINT16 vram_index; + + vram_index = ((offset & 0x007f) << 8); + vram_index |= ((offset & 0xff00) >> 8); + + return m_gvram[vram_index]; +} + +WRITE8_MEMBER(smc777_state::fbuf_w) +{ + UINT16 vram_index; + + vram_index = ((offset & 0x00ff) << 8); + vram_index |= ((offset & 0xff00) >> 8); + + m_gvram[vram_index] = data; +} + +READ8_MEMBER( smc777_state::fdc_r ) +{ + return m_fdc->read(space, offset) ^ 0xff; +} + +WRITE8_MEMBER( smc777_state::fdc_w ) +{ + m_fdc->write(space, offset, data ^ 0xff); +} + +READ8_MEMBER( smc777_state::fdc_request_r ) +{ + UINT8 data = 0; + + data |= !m_fdc_drq_flag << 6; + data |= m_fdc_irq_flag << 7; + + return data; +} + +WRITE8_MEMBER( smc777_state::floppy_select_w ) +{ + floppy_image_device *floppy = NULL; + + // ---- xxxx select floppy drive (yes, 15 of them, A to P) + switch (data & 0x01) + { + case 0: floppy = m_floppy0->get_device(); break; + case 1: floppy = m_floppy1->get_device(); break; + } + + m_fdc->set_floppy(floppy); + + // no idea where the motor on signal is + if (floppy) + floppy->mon_w(0); + + if(data & 0xf0) + printf("floppy access %02x\n", data); +} + +WRITE_LINE_MEMBER( smc777_state::fdc_intrq_w ) +{ + m_fdc_irq_flag = state; +} + +WRITE_LINE_MEMBER( smc777_state::fdc_drq_w ) +{ + m_fdc_drq_flag = state; +} + +READ8_MEMBER(smc777_state::key_r) +{ + /* + -x-- ---- shift key + ---- -x-- MCU data ready + ---- ---x handshake bit? + */ + + switch(m_keyb_cmd) + { + case 0x00: //poll keyboard input + { + if(offset == 0) + m_keyb_press_flag = 0; + + return (offset == 0) ? m_keyb_press : ((m_shift_press_flag << 6) | (m_keyb_press_flag << 2) | (m_keyb_press_flag)); + } + default: + { + //if(offset == 1) + // printf("Unknown keyboard command %02x read-back\n",m_keyb_cmd); + + return (offset == 0) ? 0x00 : (machine().rand() & 0x5); + } + } + + // never executed + //return 0x00; +} + +/* TODO: the packet commands strikes me as something I've already seen before, don't remember where however ... */ +WRITE8_MEMBER(smc777_state::key_w) +{ + if(offset == 1) //keyboard command + m_keyb_cmd = data; + else + { + // keyboard command param + } +} + +WRITE8_MEMBER(smc777_state::border_col_w) +{ + if(data & 0xf0) + printf("Special border color enabled %02x\n",data); + + m_backdrop_pen = data & 0xf; +} + + +READ8_MEMBER(smc777_state::system_input_r) +{ + printf("System FF R %02x\n",m_system_data & 0x0f); + + switch(m_system_data & 0x0f) + { + case 0x00: + return ((m_raminh & 1) << 4); //unknown bit, Dragon's Alphabet and Bird Crush relies on this for correct colors + } + + return m_system_data; +} + + + +WRITE8_MEMBER(smc777_state::system_output_w) +{ + /* + ---x 0000 ram inibit signal + ---x 1001 beep + all the rest is unknown at current time + */ + m_system_data = data; + switch(m_system_data & 0x0f) + { + case 0x00: + m_raminh_pending_change = ((data & 0x10) >> 4) ^ 1; + m_raminh_prefetch = (UINT8)(space.device().state().state_int(Z80_R)) & 0x7f; + break; + case 0x02: printf("Interlace %s\n",data & 0x10 ? "on" : "off"); break; + case 0x05: m_beeper->set_state(data & 0x10); break; + default: printf("System FF W %02x\n",data); break; + } +} + +WRITE8_MEMBER(smc777_state::color_mode_w) +{ + switch(data & 0x0f) + { + case 0x06: m_pal_mode = (data & 0x10) ^ 0x10; break; + default: printf("Color FF %02x\n",data); break; + } +} + +WRITE8_MEMBER(smc777_state::ramdac_w) +{ + UINT8 pal_index; + pal_index = (offset & 0xf00) >> 8; + + if(data & 0x0f) + printf("RAMdac used with data bits 0-3 set (%02x)\n",data); + + switch((offset & 0x3000) >> 12) + { + case 0: m_pal.r = (data & 0xf0) >> 4; m_palette->set_pen_color(pal_index, pal4bit(m_pal.r), pal4bit(m_pal.g), pal4bit(m_pal.b)); break; + case 1: m_pal.g = (data & 0xf0) >> 4; m_palette->set_pen_color(pal_index, pal4bit(m_pal.r), pal4bit(m_pal.g), pal4bit(m_pal.b)); break; + case 2: m_pal.b = (data & 0xf0) >> 4; m_palette->set_pen_color(pal_index, pal4bit(m_pal.r), pal4bit(m_pal.g), pal4bit(m_pal.b)); break; + case 3: printf("RAMdac used with gradient index = 3! pal_index = %02x data = %02x\n",pal_index,data); break; + } +} + +READ8_MEMBER(smc777_state::display_reg_r) +{ + return m_display_reg; +} + +/* x */ +WRITE8_MEMBER(smc777_state::display_reg_w) +{ + /* + x--- ---- width 80 / 40 switch (0 = 640 x 200 1 = 320 x 200) + ---- -x-- mode select? + */ + + m_display_reg = data; +} + +READ8_MEMBER(smc777_state::smc777_mem_r) +{ + UINT8 z80_r; + + if(m_raminh_prefetch != 0xff) //do the bankswitch AFTER that the prefetch instruction is executed (FIXME: this is an hackish implementation) + { + z80_r = (UINT8)space.device().state().state_int(Z80_R); + + if(z80_r == ((m_raminh_prefetch+2) & 0x7f)) + { + m_raminh = m_raminh_pending_change; + m_raminh_prefetch = 0xff; + } + } + + if(m_raminh == 1 && ((offset & 0xc000) == 0)) + return m_ipl_rom[offset]; + + return m_work_ram[offset]; +} + +WRITE8_MEMBER(smc777_state::smc777_mem_w) +{ + m_work_ram[offset] = data; +} + +READ8_MEMBER(smc777_state::irq_mask_r) +{ + return m_irq_mask; +} + +WRITE8_MEMBER(smc777_state::irq_mask_w) +{ + if(data & 0xfe) + printf("Irq mask = %02x\n",data & 0xfe); + + m_irq_mask = data & 1; +} + +static ADDRESS_MAP_START( smc777_mem, AS_PROGRAM, 8, smc777_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_READWRITE(smc777_mem_r, smc777_mem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( smc777_io, AS_IO, 8, smc777_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x07) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(vram_r, vram_w) + AM_RANGE(0x08, 0x0f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(attr_r, attr_w) + AM_RANGE(0x10, 0x17) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(pcg_r, pcg_w) + AM_RANGE(0x18, 0x19) AM_MIRROR(0xff00) AM_WRITE(mc6845_w) + AM_RANGE(0x1a, 0x1b) AM_MIRROR(0xff00) AM_READWRITE(key_r, key_w) + AM_RANGE(0x1c, 0x1c) AM_MIRROR(0xff00) AM_READWRITE(system_input_r, system_output_w) +// AM_RANGE(0x1d, 0x1d) system and control read, printer strobe write +// AM_RANGE(0x1e, 0x1f) rs232 irq control + AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_READWRITE(display_reg_r, display_reg_w) + AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_READWRITE(irq_mask_r, irq_mask_w) +// AM_RANGE(0x22, 0x22) printer output data + AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_WRITE(border_col_w) +// AM_RANGE(0x24, 0x24) rtc write address +// AM_RANGE(0x25, 0x25) rtc read +// AM_RANGE(0x26, 0x26) rs232 #1 +// AM_RANGE(0x28, 0x2c) fdc #2 +// AM_RANGE(0x2d, 0x2f) rs232 #2 + AM_RANGE(0x30, 0x33) AM_MIRROR(0xff00) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0x34, 0x34) AM_MIRROR(0xff00) AM_READWRITE(fdc_request_r, floppy_select_w) +// AM_RANGE(0x35, 0x37) rs232 #3 +// AM_RANGE(0x38, 0x3b) cache disk unit +// AM_RANGE(0x3c, 0x3d) rgb superimposer +// AM_RANGE(0x40, 0x47) ieee-488 +// AM_RANGE(0x48, 0x4f) hdd (winchester) + AM_RANGE(0x51, 0x51) AM_MIRROR(0xff00) AM_READ_PORT("JOY_1P") AM_WRITE(color_mode_w) + AM_RANGE(0x52, 0x52) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_WRITE(ramdac_w) + AM_RANGE(0x53, 0x53) AM_MIRROR(0xff00) AM_DEVWRITE("sn1", sn76489a_device, write) +// AM_RANGE(0x54, 0x59) vrt controller +// AM_RANGE(0x5a, 0x5b) ram banking +// AM_RANGE(0x70, 0x70) auto-start rom +// AM_RANGE(0x74, 0x74) ieee-488 rom +// AM_RANGE(0x75, 0x75) vrt controller rom +// AM_RANGE(0x7e, 0x7f) kanji rom + AM_RANGE(0x80, 0xff) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(fbuf_r, fbuf_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( smc777 ) + PORT_START("key0") //0x00-0x07 + PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_START("key1") //0x08-0x0f + PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ PAD") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* PAD") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- PAD") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ PAD") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER PAD") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". PAD") PORT_CODE(KEYCODE_DEL_PAD) + + PORT_START("key2") //0x10-0x17 + PORT_BIT (0x01, IP_ACTIVE_HIGH,IPT_UNUSED) // PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT (0x02, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT (0x04, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT (0x08, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT (0x10, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT (0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT (0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT (0x80, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("key3") //0x18-0x1f + PORT_BIT (0x01, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT (0x02, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT (0x04, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT (0x08, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT (0x10, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT (0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT (0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT (0x80, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("key4") //0x20-0x27 + PORT_BIT (0x01, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT (0x02, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT (0x04, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT (0x08, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT (0x10, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT (0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT (0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT (0x80, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("key5") //0x28-0x2f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-1") /* TODO: labels */ + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-1") + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-2") + + PORT_START("key6") //0x30-0x37 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("key7") //0x38-0x3f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /* TODO: labels */ + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") + + PORT_START("key8") //0x40-0x47 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) + PORT_BIT(0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + /* TODO: control inputs */ + + PORT_START("key9") //0x40-0x47 + /* TODO: cursor inputs */ + PORT_BIT(0x01, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CURSOR UP") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x02, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CURSOR DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x04, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CURSOR LEFT") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CURSOR RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x10, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("END") PORT_CODE(KEYCODE_END) + PORT_BIT(0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PGUP") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x80, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PGDOWN") PORT_CODE(KEYCODE_PGDN) + + PORT_START("keya") //0x48-0x4f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + + PORT_START("key_mod") + PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KANA SHIFT") PORT_CODE(KEYCODE_LALT) + + + #if 0 + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") + #endif + + PORT_START("JOY_1P") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNKNOWN ) //status? +INPUT_PORTS_END + +/* + Keyboard data: + kana lock |= 0x80 + numpad 0 to 9 = 0x30 - 0x39 + / pad = 0x2f + * pad = 0x2a + - pad = 0x2d + + pad = 0x2b + ENTER pad = 0x0d + . pad = 0x2e + enter = 0x0d + space = 0x20 + backspace = 0x08 + CTRL (TAB?) = 0x09 + cursor up = 0x17 + cursor down = 0x1c + cursor left = 0x16 + cursor right = 0x19 + 0 to 9 -> 0x30 to 0x39 + S + 0 = 0x29 + S + 1 = 0x21 + S + 2 = 0x40 + S + 3 = 0x23 + S + 4 = 0x24 + S + 5 = 0x25 + S + 6 = 0x5e + S + 7 = 0x26 + S + 8 = 0x2a + S + 9 = 0x28 + F1 = 0x01 / 0x15 + F2 = 0x02 / 0x18 + F3 = 0x04 / 0x12 + F4 = 0x06 / 0x05 + F5 = 0x0b / 0x03 + ESC = 0x1b + INS = 0x0f + DEL = 0x11 + PG UP = 0x12 + PG DOWN = 0x03 + HOME = 0x14 + END = 0x0e + ' = 0x2d / 0x5f + "P" row 1 ] = 0x5d / 0x7d + "P" row 2 ' / ~ = 0x60 / 0x7e + "L" row 1 ; / : = 0x3b / 0x3a + "L" row 2 = (unused) + "L" row 3 Yen / | = 0x5c / 0x7c + "M" row 1 , / < = 0x2c / 0x3c + "M" row 2 . / > = 0x2e / 0x3e + "M" row 3 / / ? = 0x2f / 0x3f +*/ + +static const UINT8 smc777_keytable[2][0xa0] = +{ + /* normal*/ + { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* numpad */ + 0x38, 0x39, 0x2f, 0x2a, 0x2d, 0x2b, 0x0d, 0x2e, + 0xff, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* A - G */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* H - O */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* P - W */ + 0x78, 0x79, 0x7a, 0x2d, 0x5d, 0x60, 0xff, 0xff, /* X - Z */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0 - 7*/ + 0x38, 0x39, 0x3b, 0x5c, 0x2c, 0x2e, 0x2f, 0xff, /* 8 - 9 */ + 0x0d, 0x20, 0x08, 0x09, 0x1b, 0x0f, 0x11, 0xff, + 0x17, 0x1c, 0x16, 0x19, 0x14, 0x0e, 0x12, 0x03, + 0x01, 0x02, 0x04, 0x06, 0x0b, 0xff, 0xff, 0xff, + + }, + /* shift */ + { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* numpad */ + 0x38, 0x39, 0x2f, 0x2a, 0x2d, 0x2b, 0x0d, 0x2e, + 0xff, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* H - O */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* P - W */ + 0x58, 0x59, 0x5a, 0x5f, 0x7d, 0x7e, 0xff, 0xff, /* X - Z */ + 0x29, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, + 0x2a, 0x28, 0x3a, 0x7c, 0x3c, 0x3e, 0x3f, 0xff, + 0x0d, 0x20, 0x08, 0x09, 0x1b, 0x0f, 0x11, 0xff, + 0x17, 0x1c, 0x16, 0x19, 0x14, 0x0e, 0x12, 0x03, + 0x15, 0x18, 0x12, 0x05, 0x03, 0xff, 0xff, 0xff, /* F1 - F5 */ + } +}; + +TIMER_DEVICE_CALLBACK_MEMBER(smc777_state::keyboard_callback) +{ + static const char *const portnames[11] = { "key0","key1","key2","key3","key4","key5","key6","key7", "key8", "key9", "keya" }; + int i,port_i,scancode; + UINT8 shift_mod = ioport("key_mod")->read() & 1; + UINT8 kana_mod = ioport("key_mod")->read() & 0x10; + scancode = 0; + + for(port_i=0;port_i<11;port_i++) + { + for(i=0;i<8;i++) + { + if((ioport(portnames[port_i])->read()>>i) & 1) + { + m_keyb_press = smc777_keytable[shift_mod & 1][scancode]; + if(kana_mod) { m_keyb_press|=0x80; } + m_keyb_press_flag = 1; + m_shift_press_flag = shift_mod & 1; + return; + } + scancode++; + } + } +} + +static const gfx_layout smc777_charlayout = +{ + 8, 8, + 0x800 / 8, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +void smc777_state::machine_start() +{ + m_ipl_rom = memregion("ipl")->base(); + m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); + m_vram = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_attr = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_gvram = auto_alloc_array_clear(machine(), UINT8, 0x8000); + m_pcg = auto_alloc_array_clear(machine(), UINT8, 0x800); + + save_pointer(NAME(m_work_ram), 0x10000); + save_pointer(NAME(m_vram), 0x800); + save_pointer(NAME(m_attr), 0x800); + save_pointer(NAME(m_gvram), 0x8000); + save_pointer(NAME(m_pcg), 0x800); + + m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, smc777_charlayout, (UINT8 *)m_pcg, 0, 8, 0))); +} + +void smc777_state::machine_reset() +{ + m_raminh = 1; + m_raminh_pending_change = 1; + m_raminh_prefetch = 0xff; + m_pal_mode = 0x10; + + m_beeper->set_frequency(300); //TODO: correct frequency + m_beeper->set_state(0); +} + + +/* set-up SMC-70 mode colors */ +PALETTE_INIT_MEMBER(smc777_state, smc777) +{ + int i; + + for(i=0x10;i<0x18;i++) + { + UINT8 r,g,b; + + r = (i & 4) >> 2; + g = (i & 2) >> 1; + b = (i & 1) >> 0; + + palette.set_pen_color(i, pal1bit(r),pal1bit(g),pal1bit(b)); + palette.set_pen_color(i+8, pal1bit(0),pal1bit(0),pal1bit(0)); + } +} + + +INTERRUPT_GEN_MEMBER(smc777_state::vblank_irq) +{ + if(m_irq_mask) + device.execute().set_input_line(0,HOLD_LINE); +} + + +static SLOT_INTERFACE_START( smc777_floppies ) + SLOT_INTERFACE("ssdd", FLOPPY_35_SSDD) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( smc777, smc777_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, MASTER_CLOCK) + MCFG_CPU_PROGRAM_MAP(smc777_mem) + MCFG_CPU_IO_MAP(smc777_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", smc777_state, vblank_irq) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(0x400, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 660-1, 0, 220-1) //normal 640 x 200 + 20 pixels for border color + MCFG_SCREEN_UPDATE_DRIVER(smc777_state, screen_update_smc777) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x20) // 16 + 8 colors (SMC-777 + SMC-70) + 8 empty entries (SMC-70) + MCFG_PALETTE_INIT_OWNER(smc777_state, smc777) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) + + MCFG_MC6845_ADD("crtc", H46505, "screen", MASTER_CLOCK/2) /* unknown clock, hand tuned to get ~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + + // floppy controller + MCFG_MB8876_ADD("fdc", XTAL_1MHz) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(smc777_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(smc777_state, fdc_drq_w)) + + // does it really support 16 of them? + MCFG_FLOPPY_DRIVE_ADD("fdc:0", smc777_floppies, "ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", smc777_floppies, "ssdd", floppy_image_device::default_floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "smc777") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("sn1", SN76489A, MASTER_CLOCK) // unknown clock / divider + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", smc777_state, keyboard_callback, attotime::from_hz(240/32)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( smc777 ) + /* shadow ROM */ + ROM_REGION( 0x10000, "ipl", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "1st", "1st rev.") + ROMX_LOAD( "smcrom.dat", 0x0000, 0x4000, CRC(b2520d31) SHA1(3c24b742c38bbaac85c0409652ba36e20f4687a1), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "2nd", "2nd rev.") + ROMX_LOAD( "smcrom.v2", 0x0000, 0x4000, CRC(c1494b8f) SHA1(a7396f5c292f11639ffbf0b909e8473c5aa63518), ROM_BIOS(2)) + + ROM_REGION( 0x800, "mcu", ROMREGION_ERASEFF ) + ROM_LOAD( "i80xx", 0x000, 0x800, NO_DUMP ) // keyboard mcu, needs decapping +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, smc777, 0, 0, smc777, smc777, driver_device, 0, "Sony", "SMC-777", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/sms.c b/src/mame/drivers/sms.c new file mode 100644 index 00000000000..f93674b584c --- /dev/null +++ b/src/mame/drivers/sms.c @@ -0,0 +1,1017 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Charles MacDonald,Mathis Rosenhauer,Brad Oliver,Michael Luong,Fabio Priuli,Enik Land +/****************************************************************************** + Contributors: + + Marat Fayzullin (MG source) + Charles MacDonald + Mathis Rosenhauer + Brad Oliver + Michael Luong + Wilbert Pol + Fabio Priuli + Enik Land + + To do: + + - SIO interface for Game Gear (needs netplay, I guess) + - Support for other DE-9 compatible controllers, like the Mega Drive 6-Button + that has homebrew software support + - Sega SK-1100 keyboard support for Sega Mark III (sg1000m3 driver) + - Link between two Mark III's through keyboard, supported by F-16 Fighting Falcon + - Mark III expansion slot, used by keyboard and FM Sound Unit + - Verify if the SN76489 chip can be disabled on sg1000m3 and sms1krfm consoles + - Rapid button of smsj, sms1krfm and sms1kr consoles + - Software compatibility flags, by region and/or BIOS + - Samsung modem for Gam*Boy Securities Information Service System + - Sega Demo Unit II (kiosk expansion device) + - SMS 8 slot game changer (kiosk expansion device) + - SMS Disk System (floppy disk drive expansion device) - unreleased + - Emulate SRAM cartridges? (for use with Bock's dump tool) + + The Game Gear SIO hardware is not emulated but has some + placeholders in 'machine/sms.c' + + Changes: + Apr 02 - Added raster palette effects for SMS & GG (ML) + - Added sprite collision (ML) + - Added zoomed sprites (ML) + May 02 - Fixed paging bug (ML) + - Fixed sprite and tile priority bug (ML) + - Fixed bug #66 (ML) + - Fixed bug #78 (ML) + - try to implement LCD persistence emulation for GG (ML) + Jun 10, 02 - Added bios emulation (ML) + Jun 12, 02 - Added PAL & NTSC systems (ML) + Jun 25, 02 - Added border emulation (ML) + Jun 27, 02 - Version bits for Game Gear (bits 6 of port 00) (ML) + Nov-Dec, 05 - Numerous cleanups, fixes, updates (WP) + Mar, 07 - More cleanups, fixes, mapper additions, etc (WP) + +-------------------------------------------------------------------------------- + +General compatibility issues on real hardware (not emulation bugs): + +- Some ROMs have issues or don't work when running on a console of different + region; +- Many Japanese, Korean and homebrew ROMs don't have the signature required by + BIOSes of consoles sold overseas; +- Paddle games need to detect the system region as Japanese to work with the + Paddle controller; +- Few games of the ones with FM support need to detect the system region as + Japanese to play FM sound; +- The Light Phaser gun doesn't work with the Japanese SMS; +- There are reports about Light Phaser working on the second Korean SMS + version, and a Korean advert shows support on the first version (Gam*Boy I, + although based on Japanese SMS); +- The Korean SMS versions have Japanese-format cartridge slot, but only on the + first (Gam*Boy I) the region is detected as Japanese; +- Some SMS ROMs don't run when are plugged-in to SMS expansion slot, through + the gender adapter; +- Some SMS ROMs don't run or have issues when are plugged-in to a Game Gear, + through the Master Gear adapter; + +-------------------------------------------------------------------------------- + +Sega Master System II +Sega 1990 + +This particular version was manufactured between July 1991 and October 1992 +The PCB is stamped '17 AUG 1991' + +PCB Layout +---------- +171-5922A +(C) SEGA 1990 +IC BD M4Jr. PAL +|----------|------|-----------------------| +| POWER_IN |RF_OUT| IC1 IC2 IC3 | +| | | Z80 BIOS 6264 | +| | | IC9 | +| |------| CXA1145 | +| | +| | +|IC8 | +|7805 | +| |---------------| | +| | CART SLOT | | +| |---------------| | +| | +| | +| PAUSE_SW | +| | +| IC6 IC5 IC4 | +| D4168 315-5246 315-5237 | +| | +| IC7 | +| D4168 | +| | +| POWER_SW JOY1 JOY2 53.2034MHz| +|-----------------------------------------| +Notes: (All ICs shown) + IC1 Z80 - Z0840004PSC Z80 CPU (DIP40). Clock input 3.54689MHz (53.2034/15) + IC2 BIOS - 1M 28-pin mask ROM marked MPR-12808 (DIP28) + IC3 6264 - Samsung KM6264 8k x8 SRAM. Some models have NEC D4168 or Sanyo LC3664 which are compatible (DIP28) + IC4 315-5237 - Custom Sega I/O controller IC (DIP48) + Clocks - Pin 43 - master clock input 53.2034MHz from OSC + Pin 41 - 10.6406MHz (53.2034/5) + Pin 42 - 4.43361MHz (53.2034/12) + IC5 315-5246 - Custom Sega Video Display Processor (VDP) (64 pin flat pack) + The VDP also contains a Texas Instruments SN76489 sound chip + Clocks - Pin 33 - 3.54689MHz (53.2034/15) + Pin 34 - 10.6406MHz (53.2034/5) + Pin 35 - 10.6406MHz (53.2034/5) + Pin 39 - 2.66017MHz (53.2034/20) + IC6/IC7 D4168- NEC D4168 8k x8 SRAM (DIP28) + IC8 7805 - Motorola MC7805 voltage regulator (7v to 25v input, 5v output) + IC9 CXA1145 - Sony CXA1145 RGB to composite video encoder IC (DIP24) + POWER_IN - Power input from AC/DC power pack. System requires 9VDC at 500mA. Center pin is negative and + outer barrel is positive. Note this is opposite to regular DC power packs + RF_OUT - RF modulator with RF signal output to TV + POWER_SW - Power on/off switch + PAUSE_SW - Push button used to pause the game + JOY1/JOY2 - Joystick connectors (DB9) + HSync - 15.5565kHz + VSync - 49.7015Hz + + +Cart PCB Examples +----------------- +Note! There are many more types of PCBs & custom chip matching variations. This document +is not meant to provide all details of every type in existence. Some games have been +found on different types of ROM boards with and without bankswitching hardware. + +Type with no bankswitching hardware + +171-5519 \ no visible difference? +171-5519D/ +|------------------| +||----------| | +|| DIP28 | | +||----------| | +|IC1 | +|------------------| +Notes: + DIP28 - 1M mask ROM (DIP28) at location IC1. Actual ROM type is Fujitsu MB831001 + This ROM has a built-in mapper so no bankswitching chip is required. + The CPU uses pin 22 of the ROM to bankswitch it. + Found in.... + Game Name Sega ROM ID + ----------------------------- + World Grand Prix MPR-11074 + Black Belt MPR-10150 + Ghost House MPR-12586 + + +Types with bankswitching hardware + +171-5713D (uses 315-5235) +171-5838 (uses 315-5365) +171-5893 (uses 315-5365) +|------------------| +| | +| |------------| | +| | SDIP42 | | +| |------------| | +| IC1| +||----------| | +|| DIP32 | | +||----------| | +|IC2 | +|------------------| +Notes: + SDIP42 - Custom Sega bankswitch chip at location IC1. There are several different + types of these chips with different 315-xxxx numbers + These include 315-5235 (DIP42), 315-5208 (DIP28) and 315-5365 (DIP42) and possibly others. + DIP32 - 1MBit/2MBit/4MBit mask ROM (DIP32) at location IC2 + Actual ROM type can be 831000, 831001, 832011, 834000, 834011 + Found in.... + Game Name Sega ROM ID Bank Chip + ----------------------------------------- + Spellcaster MPR-12532-T 315-5365 + Altered Beast MPR-12534 315-5235 + Bubble Bobble MPR-14177 315-5365 + +171-5442 (uses 315-5235) +|--------------------------| +| |----------------| | +| | DIP40 | | +| |----------------|IC2 | +| | +| |------------| | +| | SDIP42 | | +| |------------|IC1 | +|----| |----| + | | + |----------------| +Notes: + SDIP42 - Custom Sega bankswitch chip at location IC1. There are several different + types of these chips with different 315-xxxx numbers + These include 315-5235 (DIP42), 315-5208 (DIP28) and 315-5365 (DIP42) and possibly others. + DIP40 - 2MBit/4Mbit 16-bit mask ROM (DIP40) at location IC2 + Found in.... + Game Name Sega ROM ID Bank Chip + ----------------------------------------- + Space Harrier MPR-10410 315-5235 + +Another ROM board 171-5497 used by Monopoly has 315-5235 DIP42 mapper chip, DIP28 mask ROM, a DIP8 chip (unknown), +DIP28 SRAM (likely 8k) and a 3V coin battery. +Yet another type of ROM board with unknown PCB number used by Phantasy Star has 315-5235 DIP42 mapper chip, DIP32 mask +ROM and DIP28 SRAM (likely 8k) and a 3V coin battery. +Unfortunatley the majority of these ROM boards, ROM types and MPR-xxxxx Sega part numbers are undocumented because they +were mostly dumped from the edge connector without being opened. +Some additional info can be found at http://www.smspower.org/Development/Index +Some excellent SMS documentation can be found at http://cgfm2.emuviews.com/sms.php + +-------------------------------------------------------------------------------- +SMS Store Unit memory map for the second CPU: + +0000-3FFF - BIOS +4000-47FF - RAM +8000 - System Control Register (R/W) + Reading: + bit7 - ready (0 = ready, 1 = not ready) + bit6 - active timer bit switch (0 = timer 2, 1 = timer 1) + bit5 - unknown + bit4-bit3 - timer 2 length bit switches (10s-25s) + bit2-bit0 - timer 1 length bit switches (30s-135s) + Writing: + bit7-bit4 - led of selected game to set + bit3 - unknown, 1 seems to be written all the time + bit2 - unknown, 1 seems to be written all the time + bit1 - reset signal for sms cpu, 0 = reset low, 1 = reset high + bit0 - which cpu receives interrupt signals, 0 = sms cpu, 1 = controlling cpu +C000 - Card/Cartridge selction register (W) + bit7-bit4 - slot to select + bit3 - slot type (0 = cartridge, 1 = card ?) + bit2-bit0 - unknown +C400 - ???? (used once) +D800 - Selection buttons #1, 1-8 (R) +DC00 - Selection buttons #2, 9-16 (R) + + ******************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/sn76496.h" +#include "sound/2413intf.h" +#include "video/315_5124.h" +#include "includes/sms.h" + +#include "sms1.lh" + +#define MASTER_CLOCK_PAL 53203425 /* 12 * subcarrier freq. (4.43361875MHz) */ + + +static ADDRESS_MAP_START( sms1_mem, AS_PROGRAM, 8, sms_state ) + AM_RANGE(0x0000, 0xbfff) AM_WRITE(write_cart) + AM_RANGE(0x0000, 0x3fff) AM_READ(read_0000) + AM_RANGE(0x4000, 0x7fff) AM_READ(read_4000) + AM_RANGE(0x8000, 0xbfff) AM_READ(read_8000) + AM_RANGE(0xc000, 0xfff7) AM_READWRITE(read_ram, write_ram) + AM_RANGE(0xfff8, 0xfffb) AM_READWRITE(sms_sscope_r, sms_sscope_w) /* 3-D glasses */ + AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w) /* Bankswitch control */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sms_mem, AS_PROGRAM, 8, sms_state ) + AM_RANGE(0x0000, 0xbfff) AM_WRITE(write_cart) + AM_RANGE(0x0000, 0x3fff) AM_READ(read_0000) + AM_RANGE(0x4000, 0x7fff) AM_READ(read_4000) + AM_RANGE(0x8000, 0xbfff) AM_READ(read_8000) + AM_RANGE(0xc000, 0xfff7) AM_READWRITE(read_ram, write_ram) + AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w) /* Bankswitch control */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sms_store_mem, AS_PROGRAM, 8, smssdisp_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM /* BIOS */ + AM_RANGE(0x4000, 0x47ff) AM_RAM /* RAM */ + AM_RANGE(0x6000, 0x7fff) AM_READ(store_cart_peek) + AM_RANGE(0x8000, 0x8000) AM_READ_PORT("DSW") AM_WRITE(sms_store_control_w) /* Control */ + AM_RANGE(0xc000, 0xc000) AM_READWRITE(sms_store_cart_select_r, sms_store_cart_select_w) /* cartridge/card slot selector */ + AM_RANGE(0xd800, 0xd800) AM_READ_PORT("GAMESEL1") /* Game selector port #1 */ + AM_RANGE(0xdc00, 0xdc00) AM_READ_PORT("GAMESEL2") /* Game selector port #2 */ +ADDRESS_MAP_END + +// I/O ports $3E and $3F do not exist on Mark III +static ADDRESS_MAP_START( sg1000m3_io, AS_IO, 8, sms_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, sms_psg_w) + AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write) + AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1e) AM_READ(sms_input_port_dc_r) + AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x1e) AM_READ(sms_input_port_dd_r) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0e) AM_READ(sms_input_port_dc_r) + AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x0e) AM_READ(sms_input_port_dd_r) + AM_RANGE(0xf0, 0xf0) AM_READWRITE(sms_input_port_dc_r, sms_ym2413_register_port_w) + AM_RANGE(0xf1, 0xf1) AM_READWRITE(sms_input_port_dd_r, sms_ym2413_data_port_w) + AM_RANGE(0xf2, 0xf2) AM_READWRITE(sms_audio_control_r, sms_audio_control_w) + AM_RANGE(0xf3, 0xf3) AM_READ(sms_input_port_dd_r) + AM_RANGE(0xf4, 0xf4) AM_MIRROR(0x02) AM_READ(sms_input_port_dc_r) + AM_RANGE(0xf5, 0xf5) AM_MIRROR(0x02) AM_READ(sms_input_port_dd_r) + AM_RANGE(0xf8, 0xf8) AM_MIRROR(0x06) AM_READ(sms_input_port_dc_r) + AM_RANGE(0xf9, 0xf9) AM_MIRROR(0x06) AM_READ(sms_input_port_dd_r) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( sms_io, AS_IO, 8, sms_state ) + AM_IMPORT_FROM(sg1000m3_io) + AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_mem_control_w) + AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_WRITE(sms_io_control_w) +ADDRESS_MAP_END + + +// It seems the Korean versions do some more strict decoding on the I/O +// addresses. +// At least the mirrors for I/O ports $3E/$3F don't seem to exist there. +// Enri's doc ( http://www43.tok2.com/home/cmpslv/Sms/EnrSms.htm ) about +// the Japanese SMS also doesn't mention them. +// Leaving the mirrors breaks the Korean cartridge bublboky. +static ADDRESS_MAP_START( smsj_io, AS_IO, 8, sms_state ) + AM_IMPORT_FROM(sg1000m3_io) + AM_RANGE(0x3e, 0x3e) AM_WRITE(sms_mem_control_w) + AM_RANGE(0x3f, 0x3f) AM_WRITE(sms_io_control_w) +ADDRESS_MAP_END + + +// The first Korean SMS version also seems to lack I/O port $3F. Games execute +// a region detection procedure that, through that port, sets the mode used by +// the TH bits of port $DD and tests their behavior. The region of the first SMS +// version is detected as Japanese (opposite to the second version). However, +// as it supports Light Phaser games, it doesn't have the same behavior of the +// Japanese SMS. If it had the behavior of other SMS versions, the system +// region would be detected as Export, so it probably lacks the port. +static ADDRESS_MAP_START( sms1kr_io, AS_IO, 8, sms_state ) + AM_IMPORT_FROM(sg1000m3_io) + AM_RANGE(0x3e, 0x3e) AM_WRITE(sms_mem_control_w) +ADDRESS_MAP_END + + +// It seems the mirrors for I/O ports $3E/$3F also don't seem to exist on the +// Game Gear. Leaving the mirrors breaks 'gloc' (it freezes after 1st stage). +static ADDRESS_MAP_START( gg_io, AS_IO, 8, sms_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x00) AM_READ(gg_input_port_00_r) + AM_RANGE(0x01, 0x05) AM_READWRITE(gg_sio_r, gg_sio_w) + AM_RANGE(0x06, 0x06) AM_WRITE(gg_psg_stereo_w) + AM_RANGE(0x3e, 0x3e) AM_WRITE(sms_mem_control_w) + AM_RANGE(0x3f, 0x3f) AM_WRITE(sms_io_control_w) + AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, gg_psg_w) + AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write) + AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write) + AM_RANGE(0xc0, 0xc0) AM_READ(sms_input_port_dc_r) + AM_RANGE(0xc1, 0xc1) AM_READ(sms_input_port_dd_r) + AM_RANGE(0xdc, 0xdc) AM_READ(sms_input_port_dc_r) + AM_RANGE(0xdd, 0xdd) AM_READ(sms_input_port_dd_r) +ADDRESS_MAP_END + + +static INPUT_PORTS_START( sms ) + PORT_START("PAUSE") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_1) +INPUT_PORTS_END + +static INPUT_PORTS_START( sg1000m3 ) + PORT_INCLUDE( sms ) + + PORT_START("SEGASCOPE") + PORT_CONFNAME( 0x01, 0x00, "SegaScope (3-D Glasses)" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + + PORT_START("SSCOPE_BINOCULAR") + PORT_CONFNAME( 0x03, 0x00, "SegaScope - Binocular Hack" ) PORT_CONDITION("SEGASCOPE", 0x01, EQUALS, 0x01) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, "Left Lens" ) + PORT_CONFSETTING( 0x02, "Right Lens" ) + PORT_CONFSETTING( 0x03, "Both Lens" ) + PORT_BIT( 0x03, 0x00, IPT_UNUSED ) PORT_CONDITION("SEGASCOPE", 0x01, EQUALS, 0x00) +INPUT_PORTS_END + +static INPUT_PORTS_START( sms1 ) + PORT_INCLUDE( sg1000m3 ) + + PORT_START("RESET") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Reset Button") +INPUT_PORTS_END + +static INPUT_PORTS_START( smsj ) + PORT_INCLUDE( sg1000m3 ) + + //PORT_START("RAPID") + //PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Rapid Button") /* Not implemented */ +INPUT_PORTS_END + +static INPUT_PORTS_START( smssdisp ) + // For each peripheral port (for controllers or 3-D glasses), there are sets + // of two connectors wired in parallel on the real hardware. This allows to + // have different controllers, like a pad and a Light Phaser, plugged together + // for a player input, what avoids having to re-plug them every time a game is + // changed to another that requires a different controller. Also, this allows + // 3-D games to be properly watched by two persons at same time. + // For now the driver just uses single input ports. + PORT_INCLUDE( sms1 ) + + PORT_START("DSW") + PORT_DIPNAME( 0x07, 0x07, "Timer 1 length" ) + PORT_DIPSETTING( 0x00, "135s" ) + PORT_DIPSETTING( 0x01, "120s" ) + PORT_DIPSETTING( 0x02, "105s" ) + PORT_DIPSETTING( 0x03, "90s" ) + PORT_DIPSETTING( 0x04, "75s" ) + PORT_DIPSETTING( 0x05, "60s" ) + PORT_DIPSETTING( 0x06, "45s" ) + PORT_DIPSETTING( 0x07, "30s" ) + PORT_DIPNAME( 0x18, 0x18, "Timer 2 length" ) + PORT_DIPSETTING( 0x00, "25s" ) + PORT_DIPSETTING( 0x08, "20s" ) + PORT_DIPSETTING( 0x10, "15s" ) + PORT_DIPSETTING( 0x18, "10s" ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPNAME( 0x40, 0x40, "Select Timer" ) + PORT_DIPSETTING( 0x00, "Timer 2" ) + PORT_DIPSETTING( 0x40, "Timer 1" ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // READY, must be high + + PORT_START("GAMESEL1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 03") PORT_CODE(KEYCODE_N) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 02") PORT_CODE(KEYCODE_H) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 01") PORT_CODE(KEYCODE_Y) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 00") PORT_CODE(KEYCODE_6) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 07") PORT_CODE(KEYCODE_M) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 06") PORT_CODE(KEYCODE_J) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 05") PORT_CODE(KEYCODE_U) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 04") PORT_CODE(KEYCODE_7) + + PORT_START("GAMESEL2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 11") PORT_CODE(KEYCODE_COMMA) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 10") PORT_CODE(KEYCODE_K) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 09") PORT_CODE(KEYCODE_I) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 08") PORT_CODE(KEYCODE_8) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 15") PORT_CODE(KEYCODE_STOP) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 14") PORT_CODE(KEYCODE_L) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 13") PORT_CODE(KEYCODE_O) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 12") PORT_CODE(KEYCODE_9) +INPUT_PORTS_END + +static INPUT_PORTS_START( gg ) + PORT_START("GG_PORT_DC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("START") + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */ + + PORT_START("PERSISTENCE") + PORT_CONFNAME( 0x01, 0x01, "LCD Persistence Hack" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) +INPUT_PORTS_END + + +WRITE_LINE_MEMBER(sms_state::sms_int_callback) +{ + m_maincpu->set_input_line(0, state); +} + + +static MACHINE_CONFIG_START( sms_ntsc_base, sms_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_53_693175MHz/15) + MCFG_CPU_PROGRAM_MAP(sms_mem) + MCFG_CPU_IO_MAP(sms_io) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(sms_state,sms) + MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("segapsg", SEGAPSG, XTAL_53_693175MHz/15) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SMS_CARTRIDGE_ADD("slot", sms_cart, NULL) + + MCFG_SOFTWARE_LIST_ADD("cart_list","sms") + + MCFG_SMS_CONTROL_PORT_ADD(CONTROL1_TAG, sms_control_port_devices, "joypad") + MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl1_th_input)) + MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) + + MCFG_SMS_CONTROL_PORT_ADD(CONTROL2_TAG, sms_control_port_devices, "joypad") + MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) + MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) +MACHINE_CONFIG_END + +/* + For SMS drivers, the ratio between CPU and pixel clocks, set through dividers, is 2/3. The + division that sets the pixel clock, in MCFG_SCREEN_RAW_PARAMS(), results in a remainder + that is discarded internally. Due to this rounding, the cycle time and the screen pixel + time, derived from their clocks, do not longer match (inversely) the exact original ratio + of these clocks. The SMS VDP emulation controls some properties (counters/flags) through + screen timing, that the core calculates based on the emulation time. The VDP properties + are read in the CPU timeslice. When a CPU operation that access the VDP is executed, the + elapsed emulation time is also based on how many CPU cycles have elapsed since start of + the current timeslice. Depending on this amount of CPU cycles, when the core divides the + elapsed time by the pixel time, the obtained pixel count may be less than expected. Flubba's + VDPTest ROM relies on exact results. A workaround is to use an additional macro, for each + driver, that resets the refresh rate, and by consequence the pixel time, without discarding + the remainder of the division. If the core is fixed in the future, the MCFG_SCREEN_REFRESH_RATE + lines after each MCFG_SCREEN_RAW_PARAMS call below can be removed. +*/ + +static MACHINE_CONFIG_DERIVED( sms2_ntsc, sms_ntsc_base ) + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ + SEGA315_5124_WIDTH , SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ + SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) + MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms) + + MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0) + MCFG_SEGA315_5246_SET_SCREEN("screen") + MCFG_SEGA315_5246_IS_PAL(false) + MCFG_SEGA315_5246_INT_CB(WRITELINE(sms_state, sms_int_callback)) + MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( sms1_ntsc, sms_ntsc_base ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses + MCFG_CPU_IO_MAP(sms_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ + SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ + SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) + MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) + + MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD + MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ + SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ + SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) + MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) + + MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD + MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ + SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ + SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) + MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) + + MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1) + + MCFG_DEFAULT_LAYOUT(layout_sms1) + + MCFG_VIDEO_START_OVERRIDE(sms_state,sms1) + MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1) + + MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0) + MCFG_SEGA315_5124_SET_SCREEN("screen") + MCFG_SEGA315_5124_IS_PAL(false) + MCFG_SEGA315_5124_INT_CB(WRITELINE(sms_state, sms_int_callback)) + MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) + + // card and expansion slots, not present in Master System II + MCFG_SMS_CARD_ADD("mycard", sms_cart, NULL) + MCFG_SMS_EXPANSION_ADD("exp", sms_expansion_devices, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( sms_sdisp, sms1_ntsc, smssdisp_state ) + + MCFG_DEVICE_MODIFY("sms_vdp") + MCFG_SEGA315_5124_INT_CB(WRITELINE(smssdisp_state, sms_store_int_callback)) + + MCFG_CPU_ADD("control", Z80, XTAL_53_693175MHz/15) + MCFG_CPU_PROGRAM_MAP(sms_store_mem) + /* Both CPUs seem to communicate with the VDP etc? */ + MCFG_CPU_IO_MAP(sms_io) + + MCFG_DEVICE_REMOVE("mycard") + MCFG_DEVICE_REMOVE("exp") + + MCFG_SMS_CARTRIDGE_ADD("slot2", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot3", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot4", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot5", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot6", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot7", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot8", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot9", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot10", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot11", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot12", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot13", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot14", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot15", sms_cart, NULL) + MCFG_SMS_CARTRIDGE_ADD("slot16", sms_cart, NULL) + + MCFG_SMS_CARD_ADD("slot17", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot18", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot19", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot20", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot21", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot22", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot23", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot24", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot25", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot26", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot27", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot28", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot29", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot30", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot31", sms_cart, NULL) + MCFG_SMS_CARD_ADD("slot32", sms_cart, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( sms_pal_base, sms_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_PAL/15) + MCFG_CPU_PROGRAM_MAP(sms_mem) + MCFG_CPU_IO_MAP(sms_io) + + MCFG_QUANTUM_TIME(attotime::from_hz(50)) + + MCFG_MACHINE_START_OVERRIDE(sms_state,sms) + MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PAL/15) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_SMS_CARTRIDGE_ADD("slot", sms_cart, NULL) + + MCFG_SOFTWARE_LIST_ADD("cart_list","sms") + + MCFG_SMS_CONTROL_PORT_ADD(CONTROL1_TAG, sms_control_port_devices, "joypad") + MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl1_th_input)) + MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) + + MCFG_SMS_CONTROL_PORT_ADD(CONTROL2_TAG, sms_control_port_devices, "joypad") + MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) + MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sms2_pal, sms_pal_base ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \ + SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ + SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) + MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms) + + MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0) + MCFG_SEGA315_5246_SET_SCREEN("screen") + MCFG_SEGA315_5246_IS_PAL(true) + MCFG_SEGA315_5246_INT_CB(WRITELINE(sms_state, sms_int_callback)) + MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sms1_pal, sms_pal_base ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses + MCFG_CPU_IO_MAP(sms_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \ + SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ + SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) + MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) + + MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \ + SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ + SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) + MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) + + MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \ + SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ + SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) + MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) + + MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1) + + MCFG_DEFAULT_LAYOUT(layout_sms1) + + MCFG_VIDEO_START_OVERRIDE(sms_state,sms1) + MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1) + + MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0) + MCFG_SEGA315_5124_SET_SCREEN("screen") + MCFG_SEGA315_5124_IS_PAL(true) + MCFG_SEGA315_5124_INT_CB(WRITELINE(sms_state, sms_int_callback)) + MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) + + // card and expansion slots, not present in Master System II + MCFG_SMS_CARD_ADD("mycard", sms_cart, NULL) + MCFG_SMS_EXPANSION_ADD("exp", sms_expansion_devices, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sms1_kr, sms1_ntsc ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(sms1kr_io) + + MCFG_DEVICE_REMOVE("slot") + MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sms1_krfm, sms1_kr ) + MCFG_SOUND_ADD("ym2413", YM2413, XTAL_53_693175MHz/15) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( smsj, sms1_krfm ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(smsj_io) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sg1000m3, smsj ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(sg1000m3_io) + + // Mark III does not have TH connected. + MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL1_TAG) + MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NULL) + MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL2_TAG) + MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sms2_kr, sms2_ntsc ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(smsj_io) + + MCFG_DEVICE_REMOVE("slot") + MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( gamegear, sms_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_53_693175MHz/15) + MCFG_CPU_PROGRAM_MAP(sms_mem) + MCFG_CPU_IO_MAP(gg_io) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(sms_state,sms) + MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ + SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 6*8, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 26*8, \ + SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_192_TBORDER_HEIGHT + 3*8, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_192_TBORDER_HEIGHT + 21*8 ) + MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) + MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_gamegear) + + MCFG_VIDEO_START_OVERRIDE(sms_state,gamegear) + MCFG_VIDEO_RESET_OVERRIDE(sms_state,gamegear) + + MCFG_DEVICE_ADD("sms_vdp", SEGA315_5378, 0) + MCFG_SEGA315_5378_SET_SCREEN("screen") + MCFG_SEGA315_5378_IS_PAL(false) + MCFG_SEGA315_5378_INT_CB(WRITELINE(sms_state, sms_int_callback)) + MCFG_SEGA315_5378_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") + + MCFG_SOUND_ADD("gamegear", GAMEGEAR, XTAL_53_693175MHz/15) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) + + /* cartridge */ + MCFG_GG_CARTRIDGE_ADD("slot", gg_cart, NULL) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "gamegear") + + MCFG_GG_EXT_PORT_ADD("ext", gg_ext_port_devices, NULL) + MCFG_GG_EXT_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, gg_ext_th_input)) + //MCFG_GG_EXT_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) // only for GG-TV mod +MACHINE_CONFIG_END + + +ROM_START(sms1) + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0xff) + + ROM_REGION(0x20000, "user1", 0) + ROM_SYSTEM_BIOS( 0, "bios13", "US/European BIOS v1.3 (1986)" ) + ROMX_LOAD("mpr-10052.rom", 0x0000, 0x2000, CRC(0072ed54) SHA1(c315672807d8ddb8d91443729405c766dd95cae7), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" ) + ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91e93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "hangon", "US/European BIOS v3.4 with Hang On (1988)" ) + ROMX_LOAD("mpr-11458.rom", 0x0000, 0x20000, CRC(8edf7ac6) SHA1(51fd6d7990f62cd9d18c9ecfc62ed7936169107e), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" ) + ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(e79bb689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "v10", "US Master System BIOS v1.0 (prototype)" ) + ROMX_LOAD("v1.0.bin", 0x0000, 0x2000, CRC(72bec693) SHA1(29091ff60ef4c22b1ee17aa21e0e75bac6b36474), ROM_BIOS(5)) + ROM_SYSTEM_BIOS( 5, "proto", "US Master System Prototype BIOS" ) + ROMX_LOAD("m404prot.rom", 0x0000, 0x2000, CRC(1a15dfcc) SHA1(4a06c8e66261611dce0305217c42138b71331701), ROM_BIOS(6)) +ROM_END + +ROM_START(sms) + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0xff) + + ROM_REGION(0x20000, "user1", 0) + ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" ) + ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(cf4a09ea) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1)) /* "SEGA // MPR-12808 W63 // 9114E9004" @ IC2 */ +ROM_END + +ROM_START(smssdisp) + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0x00) + + ROM_REGION(0x4000, "user1", 0) + ROM_FILL(0x0000, 0x4000, 0xff) + + ROM_REGION(0x4000, "control", 0) + ROM_LOAD("smssdisp.rom", 0x0000, 0x4000, CRC(ee2c29ba) SHA1(fc465122134d95363112eb51b9ab71db3576cefd)) +ROM_END + +ROM_START(sms1pal) + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0xff) + + ROM_REGION(0x20000, "user1", 0) + ROM_SYSTEM_BIOS( 0, "bios13", "US/European BIOS v1.3 (1986)" ) + ROMX_LOAD("mpr-10052.rom", 0x0000, 0x2000, CRC(0072ed54) SHA1(c315672807d8ddb8d91443729405c766dd95cae7), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "bios20", "European BIOS v2.0 (198?)" ) + ROMX_LOAD("mpr-10883.rom", 0x0000, 0x2000, CRC(b3d854f8) SHA1(fc7eb9141f38c92bf98d9134816f64b45e811112), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" ) + ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91e93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "hangon", "Sega Master System - US/European BIOS v3.4 with Hang On (1988)" ) + ROMX_LOAD("mpr-11458.rom", 0x0000, 0x20000, CRC(8edf7ac6) SHA1(51fd6d7990f62cd9d18c9ecfc62ed7936169107e), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" ) + ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(e79bb689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(5)) +ROM_END + +ROM_START(smspal) + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0xff) + + ROM_REGION(0x40000, "user1", 0) + ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" ) /* PCB Label: SEGA // IC BD M4Jr. PAL" Master System II with 314-5246 (ZIP) VDP and 314-5237 (DIP48) IO */ + ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(cf4a09ea) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1)) /* "SEGA // MPR-12808 W63 // 9114E9004" @ IC2 */ + ROM_SYSTEM_BIOS( 1, "sonic", "European/Brazilian BIOS with Sonic the Hedgehog (1991)" ) + ROMX_LOAD("sonbios.rom", 0x0000, 0x40000, CRC(81c3476b) SHA1(6aca0e3dffe461ba1cb11a86cd4caf5b97e1b8df), ROM_BIOS(2)) +ROM_END + +ROM_START(sg1000m3) + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0x00) +ROM_END + +ROM_START(smsj) /* PCB Label: "SEGA(R) IC BOARD M4J MAIN // 837-6418"; has "YM2413 // 78 04 71 G" at IC10; Back of pcb has traces marked "171-5541 (C)SEGA 1987 MADE IN JAPAN" + see http://www.smspower.org/Development/JapaneseSMS837-6418 */ + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0xff) + + ROM_REGION(0x4000, "user1", 0) + ROM_SYSTEM_BIOS( 0, "jbios21", "Japanese BIOS v2.1 (1987)" ) + ROMX_LOAD("mpr-11124.ic2", 0x0000, 0x2000, CRC(48d44a13) SHA1(a8c1b39a2e41137835eda6a5de6d46dd9fadbaf2), ROM_BIOS(1)) /* "SONY 7J06 // MPR-11124 // JAPAN 021" @ IC2 */ +ROM_END + +ROM_START(smskr) + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0xff) + + ROM_REGION(0x20000, "user1", 0) + ROM_SYSTEM_BIOS( 0, "akbioskr", "Samsung Gam*Boy II with Alex Kidd in Miracle World (1990)" ) + ROMX_LOAD("akbioskr.rom", 0x000, 0x20000, CRC(9c5bad91) SHA1(2feafd8f1c40fdf1bd5668f8c5c02e5560945b17), ROM_BIOS(1)) +ROM_END + +ROM_START(gamegear) + ROM_REGION(0x4000, "maincpu", 0) + ROM_FILL(0x0000, 0x4000, 0x00) + + ROM_REGION(0x0400, "user1", 0) + ROM_SYSTEM_BIOS( 0, "none", "No BIOS" ) /* gamegear */ + ROM_SYSTEM_BIOS( 1, "majesco", "Majesco BIOS" ) /* gamg */ + ROMX_LOAD("majbios.rom", 0x0000, 0x0400, CRC(0ebea9d4) SHA1(914aa165e3d879f060be77870d345b60cfeb4ede), ROM_BIOS(2)) +ROM_END + +#define rom_gamegeaj rom_gamegear +#define rom_sms1krfm rom_smsj +#define rom_sms1kr rom_smsj + +/*************************************************************************** + + Game driver(s) + + US + - Sega Master System (I) (sms1) + - prototype (M404) bios - 1986 + - without built-in game v1.3 - 1986 + - built-in Hang On/Safari Hunt v2.4 - 1988 + - built-in Hang On v3.4 - 1988 + - built-in Missile Defense 3-D v4.4 - 1988 + - built-in Hang On/Astro Warrior - 19?? + - Sega Master System II (sms) + - built-in Alex Kidd in Miracle World - 1990 + + JP + - Sega SG-1000 Mark III (sg1000m3) + - no bios - 1985 + - Sega Master System (I) (smsj) + - without built-in game v2.1 - 1987 + + KR + - Samsung Gam*Boy (I) - with FM Chip (sms1krfm) + - without built-in game v2.1 - 1989 + - Samsung Gam*Boy (I) (sms1kr) + - without built-in game v2.1 - 19?? + - Samsung Gam*Boy II / Aladdin Boy (smskr) + - built-in Alex Kidd in Miracle World (Korean) - 1991 (GB II) / 1992 (AB) + Note about KR: + - units of Gam*Boy (I) with plug-in AC adaptor have FM and the ones with + built-in AC adaptor do not. + + EU + - Sega Master System (I) (sms1pal) + - without built-in game v1.3 - 1986 + - built-in Hang On/Safari Hunt v2.4 - 1988 + - built-in Hang On v3.4 - 1988 + - built-in Missile Defense 3-D v4.4 - 1988 + - built-in Hang On/Astro Warrior - 19?? + - Sega Master System II (smspal) + - built-in Alex Kidd in Miracle World - 1990 + - built-in Sonic the Hedgehog - 1991 + + BR + - Tec Toy Master System (I) (same as sms1) + - built-in Hang On/Safari Hunt v2.4 - 1989 + - Tec Toy Master System II (same as sms1) + - built-in Alex Kidd in Miracle World - 1991 + - Tec Toy Master System III Compact (same as sms) + - built-in Alex Kidd in Miracle World - 1992 + - built-in Sonic the Hedgehog - 1993 + - built-in World Cup Italia '90 (Super Futebol II) - 1994 + - built-in Hang On/Safari Hunt v2.4 (blue L.Phaser pack) - 1995 + - Tec Toy Master System Super Compact (no driver) + - built-in Alex Kidd in Miracle World - 1993 + - built-in Sonic the Hedgehog - 1993 + - built-in World Cup Italia '90 (Super Futebol II) - 1994 + - Tec Toy Master System Girl (no driver) + - built-in Monica no Castelo do Dragao - 1994 + - built-in Sonic the Hedgehog (T. Monica em O Resgate pack) - 199? + Notes about BR: + - PAL-M has same frequency and line count of NTSC + - Tec Toy later changed its logo twice and its name to Tectoy + - 20XX models (Handy, Collection, Evolution...) likely have SoC hardware + + These are coin-operated machines (stuff for MAME): + + - Sega Game Box 9 + - Sega Mark III Soft Desk 5 + - Sega Mark III Soft Desk 10 + - Sega Shooting Zone + + The SMS Store Display Unit is labeled PD-W UNIT. Pictures found on Internet + show cartridges with a label where a not-for-sale message is written along + the information that it is for use on the Product Display-Working Unit. + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +CONS( 1985, sg1000m3, sms, 0, sg1000m3, sg1000m3, sms_state, sg1000m3, "Sega", "SG-1000 Mark III", MACHINE_SUPPORTS_SAVE ) +CONS( 1986, sms1, sms, 0, sms1_ntsc, sms1, sms_state, sms1, "Sega", "Master System I", MACHINE_SUPPORTS_SAVE ) +CONS( 1986, sms1pal, sms, 0, sms1_pal, sms1, sms_state, sms1, "Sega", "Master System I (PAL)" , MACHINE_SUPPORTS_SAVE ) +CONS( 1986, smssdisp, sms, 0, sms_sdisp, smssdisp, smssdisp_state, smssdisp, "Sega", "Master System Store Display Unit", MACHINE_SUPPORTS_SAVE ) +CONS( 1987, smsj, sms, 0, smsj, smsj, sms_state, smsj, "Sega", "Master System (Japan)", MACHINE_SUPPORTS_SAVE ) +CONS( 1990, sms, 0, 0, sms2_ntsc, sms, sms_state, sms1, "Sega", "Master System II", MACHINE_SUPPORTS_SAVE ) +CONS( 1990, smspal, sms, 0, sms2_pal, sms, sms_state, sms1, "Sega", "Master System II (PAL)", MACHINE_SUPPORTS_SAVE ) +CONS( 1989, sms1krfm, sms, 0, sms1_krfm, smsj, sms_state, sms1krfm, "Samsung", "Gam*Boy I - FM (Korea)", MACHINE_SUPPORTS_SAVE ) +CONS( 19??, sms1kr, sms, 0, sms1_kr, smsj, sms_state, sms1kr, "Samsung", "Gam*Boy I (Korea)", MACHINE_SUPPORTS_SAVE ) +CONS( 1991, smskr, sms, 0, sms2_kr, sms, sms_state, smskr, "Samsung", "Gam*Boy II (Korea)", MACHINE_SUPPORTS_SAVE ) + +CONS( 1991, gamegear, 0, sms, gamegear, gg, sms_state, gamegear, "Sega", "Game Gear (Europe/America)", MACHINE_SUPPORTS_SAVE ) +CONS( 1990, gamegeaj, gamegear, 0, gamegear, gg, sms_state, gamegeaj, "Sega", "Game Gear (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/snes.c b/src/mame/drivers/snes.c new file mode 100644 index 00000000000..0032bfbf997 --- /dev/null +++ b/src/mame/drivers/snes.c @@ -0,0 +1,1396 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese, R. Belmont, Anthony Kruize, Fabio Priuli +/*************************************************************************** + + snes.c + + Driver file to handle emulation of the Nintendo Super NES. + + Based on original MESS driver by Lee Hammerton (aka Savoury Snax), + later contributions by + R. Belmont + Anthony Kruize + Angelo Salese + Fabio Priuli + byuu (extensive RE of both SNES and add-on chips) + + + Todo (in no particular order): + - Fix sync between 5A22, SPC700 and PPU + - Fix remaining sound and video bugs + - Fix vertical mosaic effects + - Add support for real CX4 and ST018 CPUs + - Add support for SA-1 and SuperGB add-ons + - Fix superscope support + - Add support for other controllers + +***************************************************************************/ + +#include "emu.h" +#include "audio/snes_snd.h" +#include "cpu/spc700/spc700.h" +#include "includes/snes.h" +#include "machine/snescx4.h" + +#include "bus/snes/snes_slot.h" +#include "bus/snes/snes_carts.h" +#include "bus/snes_ctrl/ctrl.h" + +class snes_console_state : public snes_state +{ +public: + snes_console_state(const machine_config &mconfig, device_type type, const char *tag) + : snes_state(mconfig, type, tag) + , m_ctrl1(*this, "ctrl1") + , m_ctrl2(*this, "ctrl2") + , m_cartslot(*this, "snsslot") + { } + + DECLARE_READ8_MEMBER( snes20_hi_r ); + DECLARE_WRITE8_MEMBER( snes20_hi_w ); + DECLARE_READ8_MEMBER( snes20_lo_r ); + DECLARE_WRITE8_MEMBER( snes20_lo_w ); + DECLARE_READ8_MEMBER( snes21_lo_r ); + DECLARE_WRITE8_MEMBER( snes21_lo_w ); + DECLARE_READ8_MEMBER( snes21_hi_r ); + DECLARE_WRITE8_MEMBER( snes21_hi_w ); + DECLARE_READ8_MEMBER( snessfx_hi_r ); + DECLARE_READ8_MEMBER( snessfx_lo_r ); + DECLARE_WRITE8_MEMBER( snessfx_hi_w ); + DECLARE_WRITE8_MEMBER( snessfx_lo_w ); + DECLARE_READ8_MEMBER( snessa1_hi_r ); + DECLARE_READ8_MEMBER( snessa1_lo_r ); + DECLARE_WRITE8_MEMBER( snessa1_hi_w ); + DECLARE_WRITE8_MEMBER( snessa1_lo_w ); + DECLARE_READ8_MEMBER( snes7110_hi_r ); + DECLARE_READ8_MEMBER( snes7110_lo_r ); + DECLARE_WRITE8_MEMBER( snes7110_hi_w ); + DECLARE_WRITE8_MEMBER( snes7110_lo_w ); + DECLARE_READ8_MEMBER( snessdd1_lo_r ); + DECLARE_WRITE8_MEMBER( snessdd1_lo_w ); + DECLARE_READ8_MEMBER( snessdd1_hi_r ); + DECLARE_WRITE8_MEMBER( snessdd1_hi_w ); + DECLARE_READ8_MEMBER( snesbsx_hi_r ); + DECLARE_WRITE8_MEMBER( snesbsx_hi_w ); + DECLARE_READ8_MEMBER( snesbsx_lo_r ); + DECLARE_WRITE8_MEMBER( snesbsx_lo_w ); + DECLARE_READ8_MEMBER( snessgb_hi_r ); + DECLARE_READ8_MEMBER( snessgb_lo_r ); + DECLARE_WRITE8_MEMBER( snessgb_hi_w ); + DECLARE_WRITE8_MEMBER( snessgb_lo_w ); + DECLARE_READ8_MEMBER( pfest94_hi_r ); + DECLARE_WRITE8_MEMBER( pfest94_hi_w ); + DECLARE_READ8_MEMBER( pfest94_lo_r ); + DECLARE_WRITE8_MEMBER( pfest94_lo_w ); + + DECLARE_READ8_MEMBER( spc_ram_100_r ); + DECLARE_WRITE8_MEMBER( spc_ram_100_w ); + TIMER_CALLBACK_MEMBER( lightgun_tick ); + + // input related + SNESCTRL_ONSCREEN_CB(onscreen_cb); + SNESCTRL_GUNLATCH_CB(gun_latch_cb); + virtual DECLARE_WRITE8_MEMBER(io_read); + virtual UINT8 oldjoy1_read(int latched); + virtual UINT8 oldjoy2_read(int latched); + virtual void write_joy_latch(UINT8 data); + virtual void wrio_write(UINT8 data); + + virtual void machine_start(); + virtual void machine_reset(); + int m_type; + required_device m_ctrl1; + required_device m_ctrl2; + optional_device m_cartslot; +}; + + +/************************************* + * + * Memory handlers + * + *************************************/ + +// SPC access + +READ8_MEMBER(snes_console_state::spc_ram_100_r ) +{ + return m_spc700->spc_ram_r(space, offset + 0x100); +} + +WRITE8_MEMBER(snes_console_state::spc_ram_100_w ) +{ + m_spc700->spc_ram_w(space, offset + 0x100, data); +} + +// Memory access for the various types of carts + +//--------------------------------------------------------------------------------- +// LoROM & LoROM + BSX slot & LoROM + some add-on chips +//--------------------------------------------------------------------------------- + +// In general LoROM games have perfect mirror between 0x00-0x7d and 0x80-0xff +// But BSX+LoROM games use different read handlers (to access ROM beyond 2MB) +// so we use two different set of handlers... + +// Also we have here LoROM + CX4, until the Hitachi CPU is emulated, +// and the LoROM + Seta DSP, because their chip_read/chip_write need global offset + +READ8_MEMBER( snes_console_state::snes20_hi_r ) +{ + UINT16 address = offset & 0xffff; + + // take care of add-on IO + if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) + && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) + return m_cartslot->chip_read(space, offset); + else if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) + && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) + return m_cartslot->chip_read(space, offset); + else if (m_cartslot->get_type() == SNES_CX4 + && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU + return CX4_read((offset & 0xffff) - 0x6000); + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + return snes_r_io(space, address); + else if (address < 0x8000) + return snes_open_bus_r(space, 0); + else + return m_cartslot->read_h(space, offset); + } + else if (offset < 0x700000) + { + if (address < 0x8000) + return snes_open_bus_r(space, 0); + else + return m_cartslot->read_h(space, offset); + } + else + { + if (m_type == SNES_SUFAMITURBO && address >= 0x8000 && offset < 0x740000) + return m_cartslot->read_h(space, offset); + + // here usually there is SRAM mirrored in the whole range, but if ROM is very large then arrives here too (see tokimeki and wizardg4) + if (m_cartslot->m_cart->get_rom_size() > 0x200000 && address >= 0x8000) + return m_cartslot->read_h(space, offset); + else + { + if (m_cartslot->m_cart->get_nvram_size() > 0x8000) + { + // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc. + offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff); + return m_cartslot->read_ram(space, offset); + } + else if (m_cartslot->m_cart->get_nvram_size() > 0) + return m_cartslot->read_ram(space, offset); + else + return snes_open_bus_r(space, 0); + } + } +} + +WRITE8_MEMBER( snes_console_state::snes20_hi_w ) +{ + UINT16 address = offset & 0xffff; + + // take care of add-on IO + if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) + && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) + { m_cartslot->chip_write(space, offset, data); return; } + else if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) + && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) + { m_cartslot->chip_write(space, offset, data); return; } + else if (m_cartslot->get_type() == SNES_CX4 + && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU + { CX4_write(space.machine(), (offset & 0xffff) - 0x6000, data); return; } + else if (m_type == SNES_SUFAMITURBO + && address >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000))) + { m_cartslot->write_h(space, offset, data); return; } + + if (offset < 0x400000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + snes_w_io(space, address, data); + } + else if (offset >= 0x700000 && (m_cartslot->m_cart->get_rom_size() <= 0x200000 || address < 0x8000)) // NVRAM access + { + if (m_cartslot->m_cart->get_nvram_size() > 0x8000) + { + // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc. + offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff); + m_cartslot->write_ram(space, offset, data); + } + else if (m_cartslot->m_cart->get_nvram_size() > 0) + m_cartslot->write_ram(space, offset, data); + } +} + +READ8_MEMBER( snes_console_state::snes20_lo_r ) +{ + UINT16 address = offset & 0xffff; + + // take care of add-on IO + if ((m_cartslot->get_type() == SNES_ST010 /*|| m_cartslot->get_type() == SNES_ST011*/) // why does this break moritash? + && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) + return m_cartslot->chip_read(space, offset); + else if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) + && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) + return m_cartslot->chip_read(space, offset); + else if (m_cartslot->get_type() == SNES_CX4 + && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU + return CX4_read((offset & 0xffff) - 0x6000); + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + return snes_r_io(space, address); + else if (address < 0x8000) + return snes_open_bus_r(space, 0); + else + return m_cartslot->read_l(space, offset); + } + else if (offset < 0x700000) + { + if (address < 0x8000) + return snes_open_bus_r(space, 0); + else + return m_cartslot->read_l(space, offset); + } + else + { + if (m_type == SNES_SUFAMITURBO && address >= 0x8000 && offset < 0x740000) + return m_cartslot->read_l(space, offset); + + // here usually there is SRAM mirrored in the whole range, but if ROM is very large then arrives here too (see tokimeki and wizardg4) + if (m_cartslot->m_cart->get_rom_size() > 0x200000 && address >= 0x8000) + return m_cartslot->read_l(space, offset); + else + { + if (m_cartslot->m_cart->get_nvram_size() > 0x8000) + { + // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc. + offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff); + return m_cartslot->read_ram(space, offset); + } + else if (m_cartslot->m_cart->get_nvram_size() > 0) + return m_cartslot->read_ram(space, offset); + else + return snes_open_bus_r(space, 0); + } + } +} + +WRITE8_MEMBER( snes_console_state::snes20_lo_w ) +{ + if (m_type == SNES_SUFAMITURBO + && (offset & 0xffff) >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000))) + { m_cartslot->write_l(space, offset, data); return; } + + // other add-on writes matches the hi handler + snes20_hi_w(space, offset, data, 0xff); +} + + +//--------------------------------------------------------------------------------- +// HiROM & HiROM + BSX slot +//--------------------------------------------------------------------------------- + +READ8_MEMBER( snes_console_state::snes21_lo_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000 && address < 0x8000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + return snes_r_io(space, address); + else + { + if (m_type == SNES_BSXHI && m_cartslot->m_cart->get_nvram_size() && offset >= 0x200000) + { + int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; + return m_cartslot->read_ram(space, (offset - 0x6000) & mask); + } + + if (m_cartslot->m_cart->get_nvram_size() && offset >= 0x300000) + { + /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ + /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */ + int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */ + return m_cartslot->read_ram(space, (offset - 0x6000) & mask); + } + else + return snes_open_bus_r(space, 0); + } + } + + // ROM access + return m_cartslot->read_l(space, offset); +} + +WRITE8_MEMBER( snes_console_state::snes21_lo_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000 && address < 0x8000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + snes_w_io(space, address, data); + else + { + if (m_type == SNES_BSXHI && m_cartslot->m_cart->get_nvram_size() && offset >= 0x200000) + { + int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; + m_cartslot->write_ram(space, (offset - 0x6000) & mask, data); + return; + } + if (m_cartslot->m_cart->get_nvram_size() && offset >= 0x300000) + { + /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ + /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */ + int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */ + m_cartslot->write_ram(space, (offset - 0x6000) & mask, data); + } + } + } +} + +READ8_MEMBER( snes_console_state::snes21_hi_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000 && address < 0x8000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + return snes_r_io(space, address); + else + { + if (m_type == SNES_BSXHI && m_cartslot->m_cart->get_nvram_size() && offset >= 0x200000) + { + int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; + return m_cartslot->read_ram(space, (offset - 0x6000) & mask); + } + + if (m_cartslot->m_cart->get_nvram_size() && offset >= 0x300000) + { + /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ + /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */ + int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */ + return m_cartslot->read_ram(space, (offset - 0x6000) & mask); + } + else + return snes_open_bus_r(space, 0); + } + } + + // ROM access + return m_cartslot->read_h(space, offset); +} + +WRITE8_MEMBER( snes_console_state::snes21_hi_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000 && address < 0x8000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + snes_w_io(space, address, data); + else + { + if (m_type == SNES_BSXHI && m_cartslot->m_cart->get_nvram_size() && offset >= 0x200000) + { + int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; + m_cartslot->write_ram(space, (offset - 0x6000) & mask, data); + return; + } + if (m_cartslot->m_cart->get_nvram_size() && offset >= 0x300000) + { + /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ + /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */ + int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */ + m_cartslot->write_ram(space, (offset - 0x6000) & mask, data); + } + } + } +} + +//--------------------------------------------------------------------------------- +// LoROM + SuperFX / GSU +//--------------------------------------------------------------------------------- + +READ8_MEMBER( snes_console_state::snessfx_hi_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + if (address >= 0x3000 && address < 0x3300) + return m_cartslot->chip_read(space, offset); + else + return snes_r_io(space, address); + } + else if (address < 0x8000) + return m_cartslot->read_ram(space, offset & 0x1fff); + else + return m_cartslot->read_h(space, offset); + } + else if (offset < 0x600000) + return m_cartslot->read_h(space, offset); + else + return m_cartslot->read_ram(space, offset); +} + +READ8_MEMBER( snes_console_state::snessfx_lo_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + if (address >= 0x3000 && address < 0x3300) + return m_cartslot->chip_read(space, offset); + else + return snes_r_io(space, address); + } + else if (address < 0x8000) + return m_cartslot->read_ram(space, offset & 0x1fff); + else + return m_cartslot->read_l(space, offset); + } + else if (offset < 0x600000) + return m_cartslot->read_l(space, offset); + else + return m_cartslot->read_ram(space, offset); +} + +WRITE8_MEMBER( snes_console_state::snessfx_hi_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + { + if (address >= 0x3000 && address < 0x3300) + m_cartslot->chip_write(space, offset, data); + else + snes_w_io(space, address, data); + } + else if (address < 0x8000) + m_cartslot->write_ram(space, offset & 0x1fff, data); + } + else if (offset >= 0x600000) + m_cartslot->write_ram(space, offset, data); +} + +WRITE8_MEMBER( snes_console_state::snessfx_lo_w ) +{ + snessfx_hi_w(space, offset, data, 0xff); +} + +//--------------------------------------------------------------------------------- +// LoROM + SA-1 +//--------------------------------------------------------------------------------- + +READ8_MEMBER( snes_console_state::snessa1_hi_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + if (address >= 0x2200 && address < 0x2400) + return m_cartslot->chip_read(space, offset); // SA-1 Regs + else if (address >= 0x3000 && address < 0x3800) + return m_cartslot->chip_read(space, offset); // Internal SA-1 RAM (2K) + else + return snes_r_io(space, address); + } + else if (address < 0x8000) + return m_cartslot->chip_read(space, offset); // SA-1 BWRAM + else + return m_cartslot->read_h(space, offset); + } + else + return m_cartslot->read_h(space, offset); +} + +READ8_MEMBER( snes_console_state::snessa1_lo_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + if (address >= 0x2200 && address < 0x2400) + return m_cartslot->chip_read(space, offset); // SA-1 Regs + else if (address >= 0x3000 && address < 0x3800) + return m_cartslot->chip_read(space, offset); // Internal SA-1 RAM (2K) + else + return snes_r_io(space, address); + } + else if (address < 0x8000) + return m_cartslot->chip_read(space, offset); // SA-1 BWRAM + else + return m_cartslot->read_l(space, offset); + } + else if (offset < 0x500000) + return m_cartslot->chip_read(space, offset); // SA-1 BWRAM (not mirrored above!) + else + return snes_r_io(space, address); // nothing mapped here! +} + +WRITE8_MEMBER( snes_console_state::snessa1_hi_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + { + if (address >= 0x2200 && address < 0x2400) + m_cartslot->chip_write(space, offset, data); // SA-1 Regs + else if (address >= 0x3000 && address < 0x3800) + m_cartslot->chip_write(space, offset, data); // Internal SA-1 RAM (2K) + else + snes_w_io(space, address, data); + } + else if (address < 0x8000) + m_cartslot->chip_write(space, offset, data); // SA-1 BWRAM + } +} + +WRITE8_MEMBER( snes_console_state::snessa1_lo_w ) +{ + if (offset >= 0x400000 && offset < 0x500000) + m_cartslot->chip_write(space, offset, data); // SA-1 BWRAM (not mirrored above!) + else + snessa1_hi_w(space, offset, data, 0xff); +} + +//--------------------------------------------------------------------------------- +// HiROM + SPC-7110 +//--------------------------------------------------------------------------------- + +READ8_MEMBER( snes_console_state::snes7110_hi_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + UINT16 limit = (m_cartslot->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840; + if (address >= 0x4800 && address < limit) + return m_cartslot->chip_read(space, address); + + return snes_r_io(space, address); + } + else if (address < 0x8000) + { + if (offset < 0x10000) + return m_cartslot->read_ram(space, offset); + if (offset >= 0x300000 && offset < 0x310000) + return m_cartslot->read_ram(space, offset); + } + else + return m_cartslot->read_h(space, offset); + } + return m_cartslot->read_h(space, offset); +} + +READ8_MEMBER( snes_console_state::snes7110_lo_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + UINT16 limit = (m_cartslot->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840; + if (address >= 0x4800 && address < limit) + return m_cartslot->chip_read(space, address); + + return snes_r_io(space, address); + } + else if (address < 0x8000) + { + if (offset < 0x10000) + return m_cartslot->read_ram(space, offset); + if (offset >= 0x300000 && offset < 0x310000) + return m_cartslot->read_ram(space, offset); + } + else + return m_cartslot->read_l(space, offset); + } + if (offset >= 0x500000 && offset < 0x510000) + return m_cartslot->chip_read(space, 0x4800); + + return snes_open_bus_r(space, 0); +} + +WRITE8_MEMBER( snes_console_state::snes7110_hi_w ) +{ + snes7110_lo_w(space, offset, data, 0xff); +} + +WRITE8_MEMBER( snes_console_state::snes7110_lo_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + { + UINT16 limit = (m_cartslot->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840; + if (address >= 0x4800 && address < limit) + { + m_cartslot->chip_write(space, address, data); + return; + } + snes_w_io(space, address, data); + } + else if (address < 0x8000) + { + if (offset < 0x10000) + m_cartslot->write_ram(space, offset, data); + if (offset >= 0x300000 && offset < 0x310000) + m_cartslot->write_ram(space, offset, data); + } + } +} + + +//--------------------------------------------------------------------------------- +// LoROM + S-DD1 +//--------------------------------------------------------------------------------- + +READ8_MEMBER( snes_console_state::snessdd1_lo_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + if (address >= 0x4800 && address < 0x4808) + return m_cartslot->chip_read(space, address); + + return snes_r_io(space, address); + } + else if (address < 0x8000) + return snes_open_bus_r(space, 0); + else + return m_cartslot->read_l(space, offset); + } + else if (offset >= 0x700000 && address < 0x8000 && m_cartslot->m_cart->get_nvram_size()) // NVRAM access + return m_cartslot->read_ram(space, offset); + else // ROM access + return m_cartslot->read_l(space, offset); +} + +READ8_MEMBER( snes_console_state::snessdd1_hi_r ) +{ + if (offset >= 0x400000) + return m_cartslot->read_h(space, offset); + else + return snessdd1_lo_r(space, offset, 0xff); +} + +WRITE8_MEMBER( snes_console_state::snessdd1_lo_w ) +{ + snessdd1_hi_w(space, offset, data, 0xff); +} + +WRITE8_MEMBER( snes_console_state::snessdd1_hi_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + { + if (address >= 0x4300 && address < 0x4380) + { + m_cartslot->chip_write(space, address, data); + // here we don't return, but we let the w_io happen... + } + if (address >= 0x4800 && address < 0x4808) + { + m_cartslot->chip_write(space, address, data); + return; + } + snes_w_io(space, address, data); + } + } + if (offset >= 0x700000 && address < 0x8000 && m_cartslot->m_cart->get_nvram_size()) + return m_cartslot->write_ram(space, offset, data); +} + + +//--------------------------------------------------------------------------------- +// LoROM + BS-X (Base unit) +//--------------------------------------------------------------------------------- + +READ8_MEMBER( snes_console_state::snesbsx_hi_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + if (address >= 0x2188 && address < 0x21a0) + return m_cartslot->chip_read(space, offset); + if (address >= 0x5000) + return m_cartslot->chip_read(space, offset); + return snes_r_io(space, address); + } + else if (address < 0x8000) + { + if (offset >= 0x200000) + return m_cartslot->read_h(space, offset); + else + return snes_open_bus_r(space, 0); + } + else + return m_cartslot->read_h(space, offset); + } + return m_cartslot->read_h(space, offset); +} + +WRITE8_MEMBER( snes_console_state::snesbsx_hi_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + { + if (address >= 0x2188 && address < 0x21a0) + { + m_cartslot->chip_write(space, offset, data); + return; + } + if (address >= 0x5000) + { + m_cartslot->chip_write(space, offset, data); + return; + } + snes_w_io(space, address, data); + } + else if (address < 0x8000) + { + if (offset >= 0x200000) + return m_cartslot->write_l(space, offset, data); + } + else + return m_cartslot->write_l(space, offset, data); + } + return m_cartslot->write_l(space, offset, data); +} + +READ8_MEMBER( snes_console_state::snesbsx_lo_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + { + if (address >= 0x2188 && address < 0x21a0) + return m_cartslot->chip_read(space, offset); + if (address >= 0x5000) + return m_cartslot->chip_read(space, offset); + return snes_r_io(space, address); + } + else if (address < 0x8000) + { + if (offset >= 0x200000) + return m_cartslot->read_l(space, offset); + else + return snes_open_bus_r(space, 0); + } + else + return m_cartslot->read_l(space, offset); + } + return m_cartslot->read_l(space, offset); +} + +WRITE8_MEMBER( snes_console_state::snesbsx_lo_w ) +{ + snesbsx_hi_w(space, offset, data, 0xff); +} + + +//--------------------------------------------------------------------------------- +// LoROM + SuperGB +//--------------------------------------------------------------------------------- + +READ8_MEMBER( snes_console_state::snessgb_hi_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + return snes_r_io(space, address); + else if (address < 0x8000) + return m_cartslot->chip_read(space, offset); + else + return m_cartslot->read_h(space, offset); + } + else if (address >= 0x8000) + return m_cartslot->read_h(space, offset); + + return snes_open_bus_r(space, 0); +} + +READ8_MEMBER( snes_console_state::snessgb_lo_r ) +{ + return snessgb_hi_r(space, offset, 0xff); +} + +WRITE8_MEMBER( snes_console_state::snessgb_hi_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + snes_w_io(space, address, data); + else if (address < 0x8000) + m_cartslot->chip_write(space, offset, data); + } +} + +WRITE8_MEMBER( snes_console_state::snessgb_lo_w ) +{ + snessgb_hi_w(space, offset, data, 0xff); +} + +//--------------------------------------------------------------------------------- +// Powerfest '94 event cart +//--------------------------------------------------------------------------------- + +READ8_MEMBER( snes_console_state::pfest94_hi_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + return snes_r_io(space, address); + else if (address < 0x8000) + { + if (offset < 0x100000) // DSP access + return m_cartslot->chip_read(space, offset); + else if (offset == 0x106000) // menu access + return m_cartslot->chip_read(space, offset + 0x8000); + else if (offset >= 0x300000 && m_cartslot->m_cart->get_nvram_size()) // NVRAM access + return m_cartslot->read_ram(space, offset); + else + return snes_open_bus_r(space, 0); + } + else + return m_cartslot->read_h(space, offset); + } + return m_cartslot->read_h(space, offset); +} + +WRITE8_MEMBER( snes_console_state::pfest94_hi_w ) +{ + UINT16 address = offset & 0xffff; + if (offset < 0x400000) + { + if (address < 0x2000) + space.write_byte(0x7e0000 + address, data); + else if (address < 0x6000) + snes_w_io(space, address, data); + else if (address < 0x8000) + { + if (offset < 0x100000) // DSP access + m_cartslot->chip_write(space, offset, data); + else if (offset == 0x206000) // menu access + m_cartslot->chip_write(space, offset + 0x8000, data); + else if (offset >= 0x300000 && m_cartslot->m_cart->get_nvram_size()) // NVRAM access + m_cartslot->write_ram(space, offset, data); + } + } +} + +READ8_MEMBER( snes_console_state::pfest94_lo_r ) +{ + UINT16 address = offset & 0xffff; + + if (offset < 0x400000) + { + if (address < 0x2000) + return space.read_byte(0x7e0000 + address); + else if (address < 0x6000) + return snes_r_io(space, address); + else if (address < 0x8000) + { + if (offset < 0x100000) // DSP access + return m_cartslot->chip_read(space, offset); + else if (offset == 0x106000) // menu access + return m_cartslot->chip_read(space, offset + 0x8000); + else if (offset >= 0x300000 && m_cartslot->m_cart->get_nvram_size()) // NVRAM access + return m_cartslot->read_ram(space, offset); + else + return snes_open_bus_r(space, 0); + } + else + return m_cartslot->read_l(space, offset); + } + return 0xff; // or open_bus? +} + +WRITE8_MEMBER( snes_console_state::pfest94_lo_w ) +{ + pfest94_hi_w(space, offset, data, 0xff); +} + + +/************************************* + * + * Address maps + * + *************************************/ + +static ADDRESS_MAP_START( snes_map, AS_PROGRAM, 8, snes_console_state ) +// AM_RANGE(0x000000, 0x7dffff) AM_READWRITE(snes20_lo_r, snes20_lo_w) + AM_RANGE(0x7e0000, 0x7fffff) AM_RAM /* 8KB Low RAM, 24KB High RAM, 96KB Expanded RAM */ +// AM_RANGE(0x800000, 0xffffff) AM_READWRITE(snes20_hi_r, snes20_hi_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( spc_map, AS_PROGRAM, 8, snes_console_state ) + AM_RANGE(0x0000, 0x00ef) AM_DEVREADWRITE("spc700", snes_sound_device, spc_ram_r, spc_ram_w) /* lower 32k ram */ + AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE("spc700", snes_sound_device, spc_io_r, spc_io_w) /* spc io */ + AM_RANGE(0x0100, 0xffff) AM_READWRITE(spc_ram_100_r, spc_ram_100_w) +ADDRESS_MAP_END + + +/************************************* + * + * Input ports + * + *************************************/ + +static INPUT_PORTS_START( snes ) + // input devices go through slot options + PORT_START("OPTIONS") + PORT_CONFNAME( 0x01, 0x00, "Hi-Res pixels blurring (TV effect)") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + +#if SNES_LAYER_DEBUG + PORT_START("DEBUG1") + PORT_CONFNAME( 0x03, 0x00, "Select BG1 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x01, "BG1B (lower) only" ) + PORT_CONFSETTING( 0x02, "BG1A (higher) only" ) + PORT_CONFNAME( 0x0c, 0x00, "Select BG2 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x04, "BG2B (lower) only" ) + PORT_CONFSETTING( 0x08, "BG2A (higher) only" ) + PORT_CONFNAME( 0x30, 0x00, "Select BG3 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x10, "BG3B (lower) only" ) + PORT_CONFSETTING( 0x20, "BG3A (higher) only" ) + PORT_CONFNAME( 0xc0, 0x00, "Select BG4 priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x40, "BG4B (lower) only" ) + PORT_CONFSETTING( 0x80, "BG4A (higher) only" ) + + PORT_START("DEBUG2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 1") PORT_CODE(KEYCODE_1_PAD) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 2") PORT_CODE(KEYCODE_2_PAD) PORT_TOGGLE + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 3") PORT_CODE(KEYCODE_3_PAD) PORT_TOGGLE + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 4") PORT_CODE(KEYCODE_4_PAD) PORT_TOGGLE + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Objects") PORT_CODE(KEYCODE_5_PAD) PORT_TOGGLE + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Main/Sub") PORT_CODE(KEYCODE_6_PAD) PORT_TOGGLE + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Color Math") PORT_CODE(KEYCODE_7_PAD) PORT_TOGGLE + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Windows") PORT_CODE(KEYCODE_8_PAD) PORT_TOGGLE + + PORT_START("DEBUG3") + PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mosaic") PORT_CODE(KEYCODE_9_PAD) PORT_TOGGLE + PORT_CONFNAME( 0x70, 0x00, "Select OAM priority" ) + PORT_CONFSETTING( 0x00, "All" ) + PORT_CONFSETTING( 0x10, "OAM0 only" ) + PORT_CONFSETTING( 0x20, "OAM1 only" ) + PORT_CONFSETTING( 0x30, "OAM2 only" ) + PORT_CONFSETTING( 0x40, "OAM3 only" ) + PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x80, DEF_STR( On ) ) + + PORT_START("DEBUG4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 0 draw") PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 1 draw") PORT_TOGGLE + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 2 draw") PORT_TOGGLE + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 3 draw") PORT_TOGGLE + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 4 draw") PORT_TOGGLE + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 5 draw") PORT_TOGGLE + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 6 draw") PORT_TOGGLE + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 7 draw") PORT_TOGGLE +#endif +INPUT_PORTS_END + + +/************************************* + * + * Input callbacks + * + *************************************/ + +WRITE8_MEMBER(snes_console_state::io_read) +{ + // is automatic reading on? if so, read 16bits from oldjoy1/2 + if (SNES_CPU_REG(NMITIMEN) & 1) + { + UINT16 joy1 = 0, joy2 = 0, joy3 = 0, joy4 = 0; + m_ctrl1->port_poll(); + m_ctrl2->port_poll(); + + for (int i = 0; i < 16; i++) + { + joy1 |= ((m_ctrl1->read_pin4() & 1) << (15 - i)); + joy2 |= ((m_ctrl2->read_pin4() & 1) << (15 - i)); + joy3 |= ((m_ctrl1->read_pin5() & 1) << (15 - i)); + joy4 |= ((m_ctrl2->read_pin5() & 1) << (15 - i)); + } + + SNES_CPU_REG(JOY1L) = (joy1 & 0x00ff) >> 0; + SNES_CPU_REG(JOY1H) = (joy1 & 0xff00) >> 8; + SNES_CPU_REG(JOY2L) = (joy2 & 0x00ff) >> 0; + SNES_CPU_REG(JOY2H) = (joy2 & 0xff00) >> 8; + SNES_CPU_REG(JOY3L) = (joy3 & 0x00ff) >> 0; + SNES_CPU_REG(JOY3H) = (joy3 & 0xff00) >> 8; + SNES_CPU_REG(JOY4L) = (joy4 & 0x00ff) >> 0; + SNES_CPU_REG(JOY4H) = (joy4 & 0xff00) >> 8; + } +} + +UINT8 snes_console_state::oldjoy1_read(int latched) +{ + UINT8 ret = 0; + ret |= m_ctrl1->read_pin4(); + ret |= (m_ctrl1->read_pin5() << 1); + return ret; +} + +UINT8 snes_console_state::oldjoy2_read(int latched) +{ + UINT8 ret = 0; + ret |= m_ctrl2->read_pin4(); + ret |= (m_ctrl2->read_pin5() << 1); + return ret; +} + +void snes_console_state::write_joy_latch(UINT8 data) +{ + m_ctrl1->write_strobe(data); + m_ctrl2->write_strobe(data); +} + +void snes_console_state::wrio_write(UINT8 data) +{ + if (!(SNES_CPU_REG(WRIO) & 0x80) && (data & 0x80)) + { + // external latch + m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y()); + } + + m_ctrl1->write_pin6(BIT(data, 6)); + m_ctrl2->write_pin6(BIT(data, 7)); + +} + +SNESCTRL_GUNLATCH_CB(snes_console_state::gun_latch_cb) +{ + // these are the theoretical boundaries + if (x < 0) + x = 0; + if (x > (SNES_SCR_WIDTH - 1)) + x = SNES_SCR_WIDTH - 1; + + if (y < 0) + y = 0; + if (y > (m_ppu->m_beam.last_visible_line - 1)) + y = m_ppu->m_beam.last_visible_line - 1; + +// m_ppu->set_latch_hv(x, y); // it would be more accurate to write twice to WRIO register, first with bit7 = 0 and then with bit7 = 1 + m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y()); +} + +SNESCTRL_ONSCREEN_CB(snes_console_state::onscreen_cb) +{ + // these are the theoretical boundaries, but we currently are always onscreen due to the + // way IPT_LIGHTGUNs work... investigate more on this! + if (x < 0 || x >= SNES_SCR_WIDTH || y < 0 || y >= m_ppu->m_beam.last_visible_line) + return false; + else + return true; +} + + +/************************************* + * + * Machine driver + * + *************************************/ + +void snes_console_state::machine_start() +{ + snes_state::machine_start(); + + if (m_cartslot && m_cartslot->exists()) + { + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes20_lo_r),this), write8_delegate(FUNC(snes_console_state::snes20_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes20_hi_r),this), write8_delegate(FUNC(snes_console_state::snes20_hi_w),this)); + m_maincpu->set_5a22_map(); + + m_type = m_cartslot->get_type(); + + switch (m_type) + { + // LoROM & LoROM + addons + case SNES_MODE20: + case SNES_BSXLO: + case SNES_SUFAMITURBO: + case SNES_CX4: // this still uses the old simulation instead of emulating the CPU + case SNES_ST010: // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w + case SNES_ST011: // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w + case SNES_ST018: // still unemulated + break; + case SNES_Z80GB: // skeleton support + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessgb_lo_r),this), write8_delegate(FUNC(snes_console_state::snessgb_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessgb_hi_r),this), write8_delegate(FUNC(snes_console_state::snessgb_hi_w),this)); + m_maincpu->set_5a22_map(); + break; + case SNES_SA1: // skeleton support + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessa1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessa1_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessa1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessa1_hi_w),this)); + m_maincpu->set_5a22_map(); + break; + case SNES_DSP: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x208000, 0x20ffff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x208000, 0x20ffff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + break; + case SNES_DSP_2MB: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x600000, 0x607fff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x600000, 0x607fff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + break; + case SNES_DSP4: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x308000, 0x30ffff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x308000, 0x30ffff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + break; + case SNES_OBC1: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + break; + case SNES_SFX: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessfx_lo_r),this), write8_delegate(FUNC(snes_console_state::snessfx_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessfx_hi_r),this), write8_delegate(FUNC(snes_console_state::snessfx_hi_w),this)); + m_maincpu->set_5a22_map(); + break; + case SNES_SDD1: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessdd1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessdd1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_hi_w),this)); + m_maincpu->set_5a22_map(); + break; + case SNES_BSX: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snesbsx_lo_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snesbsx_hi_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_hi_w),this)); + m_maincpu->set_5a22_map(); + break; + // HiROM & HiROM + addons + case SNES_MODE21: + case SNES_BSXHI: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); + m_maincpu->set_5a22_map(); + break; + case SNES_DSP_MODE21: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->set_5a22_map(); + break; + case SNES_SRTC: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->set_5a22_map(); + break; + case SNES_SPC7110: + case SNES_SPC7110_RTC: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes7110_lo_r),this), write8_delegate(FUNC(snes_console_state::snes7110_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes7110_hi_r),this), write8_delegate(FUNC(snes_console_state::snes7110_hi_w),this)); + m_maincpu->set_5a22_map(); + break; + case SNES_PFEST94: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::pfest94_lo_r),this), write8_delegate(FUNC(snes_console_state::pfest94_lo_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::pfest94_hi_r),this), write8_delegate(FUNC(snes_console_state::pfest94_hi_w),this)); + m_maincpu->set_5a22_map(); + break; + // pirate 'mappers' + case SNES_POKEMON: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x800000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x800000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + break; + case SNES_TEKKEN2: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x8087ff, 0, 0x3f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x8087ff, 0, 0x3f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + break; + case SNES_MCPIR1: + case SNES_MCPIR2: + m_maincpu->space(AS_PROGRAM).install_write_handler(0xffff00, 0xffffff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + break; + case SNES_20COL: + m_maincpu->space(AS_PROGRAM).install_write_handler(0x008000, 0x008fff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); + break; + case SNES_SOULBLAD: + // reads from xxx0-xxx3in range [80-bf] return a fixed sequence of 4bits; reads in range [c0-ff] return open bus + m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x808003, 0, 0x3f7ff0, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0xc00000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes_open_bus_r),this)); + break; + case SNES_BUGS: + case SNES_BANANA: +// m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); +// m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); +// m_maincpu->set_5a22_map(); + break; + } + m_cartslot->save_ram(); + } +} + +void snes_console_state::machine_reset() +{ + snes_state::machine_reset(); +} + + +static MACHINE_CONFIG_START( snes, snes_console_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", _5A22, MCLK_NTSC) /* 2.68 MHz, also 3.58 MHz */ + MCFG_CPU_PROGRAM_MAP(snes_map) + + MCFG_CPU_ADD("soundcpu", SPC700, 1024000) /* 1.024 MHz */ + MCFG_CPU_PROGRAM_MAP(spc_map) + + //MCFG_QUANTUM_TIME(attotime::from_hz(48000)) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(DOTCLK_NTSC * 2, SNES_HTOTAL * 2, 0, SNES_SCR_WIDTH * 2, SNES_VTOTAL_NTSC, 0, SNES_SCR_HEIGHT_NTSC) + MCFG_SCREEN_UPDATE_DRIVER( snes_state, screen_update ) + + MCFG_DEVICE_ADD("ppu", SNES_PPU, 0) + MCFG_SNES_PPU_OPENBUS_CB(READ8(snes_state, snes_open_bus_r)) + MCFG_VIDEO_SET_SCREEN("screen") + + MCFG_SNES_CONTROL_PORT_ADD("ctrl1", snes_control_port_devices, "joypad") + MCFG_SNESCTRL_ONSCREEN_CB(snes_console_state, onscreen_cb) + MCFG_SNES_CONTROL_PORT_ADD("ctrl2", snes_control_port_devices, "joypad") + MCFG_SNESCTRL_ONSCREEN_CB(snes_console_state, onscreen_cb) + MCFG_SNESCTRL_GUNLATCH_CB(snes_console_state, gun_latch_cb) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("spc700", SNES, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) + + MCFG_SNS_CARTRIDGE_ADD("snsslot", snes_cart, NULL) + MCFG_SOFTWARE_LIST_ADD("cart_list","snes") + MCFG_SOFTWARE_LIST_ADD("bsx_list","snes_bspack") + MCFG_SOFTWARE_LIST_ADD("st_list","snes_strom") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( snespal, snes ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_CLOCK( MCLK_PAL ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(DOTCLK_PAL, SNES_HTOTAL, 0, SNES_SCR_WIDTH, SNES_VTOTAL_PAL, 0, SNES_SCR_HEIGHT_PAL) +MACHINE_CONFIG_END + + + +/************************************* + * + * ROM definition(s) + * + *************************************/ + +ROM_START( snes ) + ROM_REGION( 0x1000000, "maincpu", ROMREGION_ERASE00 ) + + ROM_REGION( 0x100, "sound_ipl", 0 ) /* IPL ROM */ + ROM_LOAD( "spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) ) /* boot rom */ +ROM_END + +#define rom_snespal rom_snes + +/************************************* + * + * Game driver(s) + * + *************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1989, snes, 0, 0, snes, snes, driver_device, 0, "Nintendo", "Super Nintendo Entertainment System / Super Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +CONS( 1991, snespal, snes, 0, snespal, snes, driver_device, 0, "Nintendo", "Super Nintendo Entertainment System (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/socrates.c b/src/mame/drivers/socrates.c new file mode 100644 index 00000000000..ddf88ddc002 --- /dev/null +++ b/src/mame/drivers/socrates.c @@ -0,0 +1,1587 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/****************************************************************************** +* +* V-tech Socrates Driver +* Copyright (C) 2009-2013 Jonathan Gevaryahu AKA Lord Nightmare +* with dumping help from Kevin 'kevtris' Horton +* +* +TODO: + * The speech chip is a Toshiba tc8802AF (which is pin and speech + compatible with the older Toshiba t6803, but adds vsm rom read mode and + apparently does away with the melody mode); the chip is running at + 800khz clock/10khz output with between 1 and 4 t6684F vsm roms + attached; create a sound driver for this! + * fix glitches with keyboard input (double keys still don't work, super painter letter entry still doesn't work) + * hook up hblank (m_hblankstate is inited 0 right now and never changed) + * hook up mouse + * add waitstates for ram access (lack of this causes the system to run + way too fast) + This will require some probing with the LA and the fluke to figure out + how many cycles the waitstates are for for rom/ram/etc access. + * figure out what bit 6 of the status register actually does; is this an + ir mcu flag? + * keyboard IR decoder MCU is HLE'd for now, needs decap and cpu core (it + is rather tms1000 or CIC-like iirc) + + + Socrates Educational Video System + FFFF|----------------| + | RAM (window 1) | + | | + C000|----------------| + | RAM (window 0) | + | | + 8000|----------------| + | ROM (banked) | + | *Cartridge | + 4000|----------------| + | ROM (fixed) | + | | + 0000|----------------| + + * cartridge lives in banks 10 onward, see below + + Banked rom area (4000-7fff) bankswitching + Bankswitching is achieved by writing to I/O port 0 (mirrored on 1-7) + Bank ROM_REGION Contents + 0 0x00000 - 0x03fff System ROM page 0 + 1 0x04000 - 0x07fff System ROM page 1 + 2 0x08000 - 0x0bfff System ROM page 2 + ... etc ... + E 0x38000 - 0x38fff System ROM page E + F 0x3c000 - 0x3ffff System ROM page F + 10 0x40000 - 0x43fff Expansion Cartridge page 0 (cart ROM 0x0000-0x3fff) + 11 0x44000 - 0x47fff Expansion Cartridge page 1 (cart ROM 0x4000-0x7fff) + ... etc ... + + Banked ram area (z80 0x8000-0xbfff window 0 and z80 0xc000-0xffff window 1) + Bankswitching is achieved by writing to I/O port 8 (mirrored to 9-F), only low nybble + byte written: 0b****BBAA + where BB controls ram window 1 and AA controls ram window 0 + hence: + Write [window 0] [window 1] + 0 0x0000-0x3fff 0x0000-0x3fff + 1 0x4000-0x7fff 0x0000-0x3fff + 2 0x8000-0xbfff 0x0000-0x3fff + 3 0xc000-0xffff 0x0000-0x3fff + 4 0x0000-0x3fff 0x4000-0x7fff + 5 0x4000-0x7fff 0x4000-0x7fff + 6 0x8000-0xbfff 0x4000-0x7fff + 7 0xc000-0xffff 0x4000-0x7fff + 8 0x0000-0x3fff 0x8000-0xbfff + 9 0x4000-0x7fff 0x8000-0xbfff + A 0x8000-0xbfff 0x8000-0xbfff + B 0xc000-0xffff 0x8000-0xbfff + C 0x0000-0x3fff 0xc000-0xffff + D 0x4000-0x7fff 0xc000-0xffff + E 0x8000-0xbfff 0xc000-0xffff + F 0xc000-0xffff 0xc000-0xffff + +******************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "cpu/z80/z80.h" +#include "audio/socrates.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +class socrates_state : public driver_device +{ +public: + enum + { + TIMER_CLEAR_SPEECH, + TIMER_CLEAR_IRQ + }; + + socrates_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_sound(*this, "soc_snd"), + m_screen(*this, "screen"), + m_cart(*this, "cartslot"), + m_bios_reg(*this, "maincpu"), + m_vram_reg(*this, "vram") + { } + required_device m_maincpu; + required_device m_sound; + required_device m_screen; + required_device m_cart; + + rgb_t m_palette_val[256]; + + required_memory_region m_bios_reg; + required_memory_region m_vram_reg; + memory_region *m_cart_reg; + + UINT8 m_data[8]; + UINT8 m_rom_bank; + UINT8 m_ram_bank; + UINT16 m_scroll_offset; + UINT8 m_kb_latch_low[2]; + UINT8 m_kb_latch_high[2]; + UINT8 m_kb_latch_mouse; + UINT8 m_kbmcu_rscount; // how many pokes the kbmcu has taken in the last frame + UINT8 m_io40_latch; // what was last written to speech reg (for open bus)? + UINT8 m_hblankstate; // are we in hblank? + UINT8 m_vblankstate; // are we in vblank? + UINT8 m_speech_running; // is speech synth talking? + UINT32 m_speech_address; // address in speech space + UINT8 m_speech_settings; // speech settings (nybble 0: ? externrom ? ?; nybble 1: ? ? ? ?) + UINT8 m_speech_dummy_read; // have we done a dummy read yet? + UINT8 m_speech_load_address_count; // number of times load address has happened + UINT8 m_speech_load_settings_count; // number of times load settings has happened + DECLARE_READ8_MEMBER(socrates_rom_bank_r); + DECLARE_WRITE8_MEMBER(socrates_rom_bank_w); + DECLARE_READ8_MEMBER(socrates_ram_bank_r); + DECLARE_WRITE8_MEMBER(socrates_ram_bank_w); + DECLARE_READ8_MEMBER(read_f3); + DECLARE_WRITE8_MEMBER(kbmcu_strobe); + DECLARE_READ8_MEMBER(status_and_speech); + DECLARE_WRITE8_MEMBER(speech_command); + DECLARE_READ8_MEMBER(socrates_keyboard_low_r); + DECLARE_READ8_MEMBER(socrates_keyboard_high_r); + DECLARE_WRITE8_MEMBER(socrates_keyboard_clear); + DECLARE_WRITE8_MEMBER(reset_speech); + DECLARE_WRITE8_MEMBER(socrates_scroll_w); + DECLARE_WRITE8_MEMBER(socrates_sound_w); + DECLARE_DRIVER_INIT(socrates); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(socrates); + UINT32 screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(assert_irq); + TIMER_CALLBACK_MEMBER(clear_speech_cb); + TIMER_CALLBACK_MEMBER(clear_irq_cb); + void socrates_set_rom_bank(); + void socrates_set_ram_bank(); + void socrates_update_kb(); + void socrates_check_kb_latch(); + rgb_t socrates_create_color(UINT8 color); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +class iqunlim_state : public socrates_state +{ +public: + iqunlim_state(const machine_config &mconfig, device_type type, const char *tag) + : socrates_state(mconfig, type, tag), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4") + { } + + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE8_MEMBER( colors_w ); + DECLARE_READ8_MEMBER( rombank_r ); + DECLARE_WRITE8_MEMBER( rombank_w ); + DECLARE_READ8_MEMBER( rambank_r ); + DECLARE_WRITE8_MEMBER( rambank_w ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_WRITE8_MEMBER( keyboard_clear ); + DECLARE_READ8_MEMBER( video_regs_r ); + DECLARE_WRITE8_MEMBER( video_regs_w ); + DECLARE_READ8_MEMBER( status_r ); + DECLARE_INPUT_CHANGED_MEMBER( send_input ); + +protected: + virtual void machine_start(); + virtual void machine_reset(); + int get_color(int index, int y); + +private: + UINT8 m_rombank[2]; + UINT8 m_rambank; + UINT8 m_colors[8]; + UINT8 m_video_regs[4]; + + struct + { + UINT8 buffer[8]; + int head; + int tail; + } m_kb_queue; +}; + +/* Defines */ + +/* Components */ + +/* Devices */ + +void socrates_state::socrates_set_rom_bank() +{ + if (m_cart_reg && m_rom_bank >= 0x10) + { + int bank = m_rom_bank % (m_cart->get_rom_size() / 0x4000); + membank("bank1")->set_base(m_cart_reg->base() + (bank * 0x4000)); + } + else + membank("bank1")->set_base(m_bios_reg->base() + (m_rom_bank * 0x4000)); +} + +void socrates_state::socrates_set_ram_bank() +{ + membank("bank2")->set_base(m_vram_reg->base() + ( (m_ram_bank & 0x3) * 0x4000)); // window 0 + membank("bank3")->set_base(m_vram_reg->base() + (((m_ram_bank & 0xc) >> 2) * 0x4000)); // window 1 +} + +void socrates_state::socrates_update_kb( ) +{ + static const char *const rownames[] = { "keyboard_40", "keyboard_41", "keyboard_42", "keyboard_43", "keyboard_44" }; + int row, keyvalue, powerof2; + int shift = 0; + // first check that the kb latch[1] is clear; if it isn't, don't touch it! + if ((m_kb_latch_low[1] != 0) || (m_kb_latch_high[1] != 1)) return; + // next check for joypad buttons + keyvalue = ioport("keyboard_jp")->read(); + if (keyvalue != 0) + { + m_kb_latch_low[1] = (keyvalue & 0xFF0)>>4; + m_kb_latch_high[1] = 0x80 | (keyvalue & 0xF); + return; // get out of this function; due to the way key priorities work, we're done here. + } + // next check for mouse movement. + // this isn't written yet, so write me please! + // next check if shift is down + shift = ioport("keyboard_50")->read(); + // find key low and high byte ok keyboard section + for (row = 4; row>=0; row--) + { + keyvalue = ioport(rownames[row])->read(); + if (keyvalue != 0) + { + for (powerof2 = 9; powerof2 >= 0; powerof2--) + { + if ((keyvalue&(1<tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + m_rom_bank = 0xF3; // actually set semi-randomly on real console but we need to initialize it somewhere... + socrates_set_rom_bank(); + m_ram_bank = 0; // the actual console sets it semi randomly on power up, and the bios cleans it up. + socrates_set_ram_bank(); + m_kb_latch_low[0] = 0xFF; + m_kb_latch_high[0] = 0x8F; + m_kb_latch_low[1] = 0x00; + m_kb_latch_high[1] = 0x01; + m_kb_latch_mouse = 0; + m_kbmcu_rscount = 0; + m_io40_latch = 0; + m_hblankstate = 0; + m_vblankstate = 0; + m_speech_running = 0; + m_speech_address = 0; + m_speech_settings = 0; + m_speech_dummy_read = 0; + m_speech_load_address_count = 0; + m_speech_load_settings_count = 0; +} + +void socrates_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_CLEAR_SPEECH: + clear_speech_cb(ptr, param); + break; + case TIMER_CLEAR_IRQ: + clear_irq_cb(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in socrates_state::device_timer"); + } +} + +DRIVER_INIT_MEMBER(socrates_state,socrates) +{ + UINT8 *gfx = memregion("vram")->base(); + + /* fill vram with its init powerup bit pattern, so startup has the checkerboard screen */ + for (int i = 0; i < 0x10000; i++) + gfx[i] = (((i&0x1)?0x00:0xFF)^((i&0x100)?0x00:0xff)); +// init sound channels to both be on lowest pitch and max volume + m_maincpu->set_clock_scale(0.45f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */ +} + +READ8_MEMBER(socrates_state::socrates_rom_bank_r) +{ + return m_rom_bank; +} + +WRITE8_MEMBER(socrates_state::socrates_rom_bank_w) +{ + m_rom_bank = data; + socrates_set_rom_bank(); +} + +READ8_MEMBER(socrates_state::socrates_ram_bank_r) +{ + return m_ram_bank; +} + +WRITE8_MEMBER(socrates_state::socrates_ram_bank_w) +{ + m_ram_bank = data&0xF; + socrates_set_ram_bank(); +} + +READ8_MEMBER(socrates_state::read_f3)// used for read-only i/o ports as mame/mess doesn't have a way to set the unmapped area to read as 0xF3 +{ + return 0xF3; +} + +WRITE8_MEMBER(socrates_state::kbmcu_strobe) // strobe the keyboard MCU +{ + //logerror("0x%04X: kbmcu written with %02X!\n", m_maincpu->pc(), data); //if (m_maincpu->pc() != 0x31D) + // if two writes happen within one frame, reset the keyboard latches + m_kbmcu_rscount++; + if (m_kbmcu_rscount > 1) + { + m_kb_latch_low[0] = 0x00; + m_kb_latch_high[0] = 0x01; + m_kb_latch_low[1] = 0x00; + m_kb_latch_high[1] = 0x01; + m_kb_latch_mouse = 0; + } +} + +READ8_MEMBER(socrates_state::status_and_speech)// read 0x4x, some sort of status reg +{ +// bit 7 - speech status: high when speech is playing, low when it is not (or when speech cart is not present) +// bit 6 - unknown, usually set, may involve the writes to 0x30, possibly some sort of fixed-length timer? +// bit 5 - vblank status, high when not in vblank +// bit 4 - hblank status, high when not in hblank +// bit 3 - speech chip bit 3 +// bit 2 - speech chip bit 2 +// bit 1 - speech chip bit 1 +// bit 0 - speech chip bit 0 +UINT8 *speechromint = memregion("speechint")->base(); +UINT8 *speechromext = memregion("speechext")->base(); + int temp = 0; + temp |= (m_speech_running)?0x80:0; + temp |= 0x40; // unknown, possibly IR mcu busy + temp |= (m_vblankstate)?0:0x20; + temp |= (m_hblankstate)?0:0x10; + switch(m_io40_latch&0xF0) // what was last opcode sent? + { + case 0x60: case 0xE0:// speech status 'read' register + if(m_speech_settings&0x04) // external speech roms (outside of speech ic but still in cart) enabled + { + logerror("reading external speech rom nybble from nybble address %x (byte address %x)\n",m_speech_address, m_speech_address>>1); + temp |= ((speechromext[((m_speech_address>>1)&0xffff)]>>((m_speech_address&1)*4))&0xF); + } + else + { + logerror("reading internal speech rom nybble from nybble address %x (byte address %x)\n",m_speech_address, m_speech_address>>1); + temp |= ((speechromint[((m_speech_address>>1)&0x1fff)]>>((m_speech_address&1)*4))&0xF); + } + if (m_speech_dummy_read == 0) // if we havent done the dummy read yet, do so now + { + m_speech_dummy_read++; + } + else + { + m_speech_address++; + } + break; + default: + temp |= m_io40_latch&0xF; // read open bus + break; + } + logerror("read from i/o 0x4x of %x\n", temp); + return temp; +} + +TIMER_CALLBACK_MEMBER(socrates_state::clear_speech_cb) +{ + m_speech_running = 0; + m_speech_load_address_count = 0; // should this be here or in the write functuon subpart which is speak command? + m_speech_load_settings_count = 0; +} + +WRITE8_MEMBER(socrates_state::speech_command) // write 0x4x +{ + /* + * 76543210 + * |||||||\-- SEL0 + * ||||||\--- SEL1 + * |||||\---- SEL2 + * ||||\----- SEL3 + * |||\------ SEL4 + * ||\------- SEL5 + * |\-------- 64UP (if LOW the chip is in 'dumb' mode and can only play 64 fixed phrases; if HIGH the chip is in 'cpu controlled' mode and commands work) (not 100% sure about this but suspect it is correct) + * \--------- START (in cpu mode must be toggled from low->high for a cpu command to 'take'; in 'dumb' mode must be toggled low->high to start that 'word') + */ + logerror("write to i/o 0x4x of %x\n", data); +/* +// old readback test, probably get rid of this junk: +// 00-0f: readback: 70-7f +// 10-1f: readback: 70-7f +// 20-2f: readback: 70-7f +// 30-3f: readback: 70-7f +// 40-5f: readback: 70-7f +// 50-5f: readback: 70-7f +// 60-6f: readback: ALL 7f +// 70-7f: readback: 50, 71-7f (force vblank?) +// 80-8f: 80 starts speech reads as f0, rest read as 71-7f +// 90-9f: all 70-7f +// a0-af: 70-7f +// b0-bf: 70-7f +// c0-cf: 70-7f +// d0-df: 70-7f +// e0-ef: readback ALL 76 +// f0-ff: 70-7f +*/ +/* The speech chip is a toshiba tc8802, it is NOT a t6803 since the t6803 + does not have the rom read mode, which the socrates definitely uses! */ +/* Commands (tc8802): +SEL 5 4 3 2 1 0 + 0 0 n n n n - ADLD - ADdress LoaD - writes one nybble to the address + of vsm rom selected (internal or external) starting + from the low 4 bits; each subsequent write writes to + the next higher 4 bits; resetting the chip resets + the position + 0 1 n n n n - CNDT - CoNDiTion (aka 'setup') - writes one nybble to the + setting register, starting from the low 4 bits; the + subsequent write will be to the high 4 bits; + resetting the chip will reset the position + + CNDT bits (? are from T6803 datasheet, which could be wrong on the tc8802AF here): + * 76543210 + * |||||||\-- ?bits/frame bit 1 (0 = see bit 2; 1 = 98bits/frame (these may be backwards)) + * ||||||\--- ?melody mode select if high + * |||||\---- speech rom select; 0 is internal 8k mask, 1 is external vsm bus + * ||||\----- ?voiced source select (0 = A; 1 = B) + * |||\------ ?filter stages (0 = lpc-10; 1 = lpc-8) + * ||\------- ?always 0 + * |\-------- ?frame length (0 = 20ms; 1 = 10ms) + * \--------- ?bits/frame bit 2 (if bit 1 is not set: 0 = 56 bits/frame; 1 = 50 bits/frame) + * + 1 0 x x x x - DTRD - DaTa ReaD - reads a nybble from the address as loaded + and increments the address by one nybble. The first + DTRD command after any other commands is a 'dummy + read' which serves to reset the bus direction of the + low 4 SEL lines, identical to the way the TMS5100 + does things. it doesn't affect the bus direction of + the high two SEL lines. + 1 1 0 x x x - START - Starts speech at the address as loaded. + 1 1 1 x x x - RESET - Resets the internal chip state (clears shifters and + counters) and forces speech to end/silence + immediately. +*/ + switch(data&0xF8) + { + case 0x80: case 0x88: case 0x90: case 0x98: case 0xA0: case 0xA8: case 0xB0: case 0xB8: + /* 'dumb' mode speech command: write me: start talking */ + m_speech_running = 1; + timer_set(attotime::from_seconds(4), TIMER_CLEAR_SPEECH); // hack + break; + case 0xC0: case 0xC8: // ADLD: load address to vsm + m_speech_address |= (((int)data&0xF)<<(m_speech_load_address_count*4))<<1; + m_speech_load_address_count++; + logerror("loaded address nybble %X, byte address is currently %5X with %d nybbles loaded\n", data&0xF, m_speech_address>>1, m_speech_load_address_count); + break; + case 0xD0: case 0xD8: // CNDT: load settings + m_speech_settings |= ((data&0xF)<<(m_speech_load_settings_count*4)); + m_speech_load_settings_count++; + break; + case 0xE0: case 0xE8: // DTRD: read byte, handled elsewhere + break; + case 0xF0: // SPEAK + m_speech_running = 1; + timer_set(attotime::from_seconds(4), TIMER_CLEAR_SPEECH); // hack + break; + case 0xF8: // RESET + m_speech_running = 0; + m_speech_address = 0; + m_speech_settings = 0; + m_speech_dummy_read = 0; + m_speech_load_address_count = 0; + m_speech_load_settings_count = 0; + m_io40_latch &= 0x0f; // set last command to 0 to prevent problems + break; + default: // 00 through 70 are packets without the write bit set, ignore them + break; + } + m_io40_latch = data; +} + +READ8_MEMBER(socrates_state::socrates_keyboard_low_r)// keyboard code low +{ + socrates_update_kb(); + socrates_check_kb_latch(); + return m_kb_latch_low[0]; +} + +READ8_MEMBER(socrates_state::socrates_keyboard_high_r)// keyboard code high +{ + socrates_update_kb(); + socrates_check_kb_latch(); + return m_kb_latch_high[0]; +} + +WRITE8_MEMBER(socrates_state::socrates_keyboard_clear)// keyboard latch shift/clear +{ + m_kb_latch_low[0] = m_kb_latch_low[1]; + m_kb_latch_high[0] = m_kb_latch_high[1]; + m_kb_latch_low[1] = 0; + m_kb_latch_high[1] = 1; +} + +WRITE8_MEMBER(socrates_state::reset_speech)// i/o 60: reset speech synth +{ + m_speech_running = 0; + m_speech_address = 0; + m_speech_settings = 0; + m_speech_dummy_read = 0; + m_speech_load_address_count = 0; + m_speech_load_settings_count = 0; + m_io40_latch &= 0x0f; // set last command to 0 to prevent problems +logerror("write to i/o 0x60 of %x\n",data); +} + +/* stuff below belongs in video/nc.c */ + +WRITE8_MEMBER(socrates_state::socrates_scroll_w) +{ + if (offset == 0) + m_scroll_offset = (m_scroll_offset&0x100) | data; + else + m_scroll_offset = (m_scroll_offset&0xFF) | ((data&1)<<8); +} + +/* NTSC-based Palette stuff */ +// max for I and Q +#define M_I 0.5957 +#define M_Q 0.5226 + /* luma amplitudes, measured on scope */ +#define LUMAMAX 1.420 +#define LUMA_COL_0 0.355, 0.139, 0.205, 0, 0.569, 0.355, 0.419, 0.205, 0.502, 0.288, 0.358, 0.142, 0.720, 0.502, 0.571, 0.358, +#define LUMA_COL_COMMON 0.52, 0.52, 0.52, 0.52, 0.734, 0.734, 0.734, 0.734, 0.667, 0.667, 0.667, 0.667, 0.885, 0.885, 0.885, 0.885, +#define LUMA_COL_2 0.574, 0.6565, 0.625, 0.71, 0.792, 0.87, 0.8425, 0.925, 0.724, 0.8055, 0.7825, 0.865, 0.94275, 1.0225, 0.99555, 1.07525, +#define LUMA_COL_5 0.4585, 0.382, 0.4065, 0.337, 0.6715, 0.5975, 0.6205, 0.5465, 0.6075, 0.531, 0.5555, 0.45, 0.8255, 0.7455, 0.774, 0.6985, +#define LUMA_COL_F 0.690, 0.904, 0.830, 1.053, 0.910, 1.120, 1.053, 1.270, 0.840, 1.053, 0.990, 1.202, 1.053, 1.270, 1.202, 1.420 + /* chroma amplitudes, measured on scope */ +#define CHROMAMAX 0.42075 +#define CHROMA_COL_COMMON 0.148, 0.3125, 0.26475, 0.42075, 0.148, 0.3125, 0.26475, 0.42075, 0.148, 0.3125, 0.26475, 0.42075, 0.148, 0.3125, 0.26475, 0.42075, +#define CHROMA_COL_2 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, +#define CHROMA_COL_5 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, +// gamma: this needs to be messed with... may differ on different systems... attach to slider somehow? +#define GAMMA 1.5 + +rgb_t socrates_state::socrates_create_color(UINT8 color) +{ + rgb_t composedcolor; + static const double lumatable[256] = { + LUMA_COL_0 + LUMA_COL_COMMON + LUMA_COL_2 + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_5 + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_COMMON + LUMA_COL_F + }; + static const double chromaintensity[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + CHROMA_COL_COMMON + CHROMA_COL_2 + CHROMA_COL_COMMON + CHROMA_COL_COMMON + CHROMA_COL_5 + CHROMA_COL_COMMON + CHROMA_COL_COMMON + CHROMA_COL_COMMON + CHROMA_COL_COMMON + CHROMA_COL_COMMON + CHROMA_COL_COMMON + CHROMA_COL_COMMON + CHROMA_COL_COMMON + CHROMA_COL_COMMON + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + }; + /* chroma colors and phases: + 0: black-through-grey (0 assumed chroma) + 1: purple (90 chroma seems correct) + 2: light blue/green (210 or 240 chroma, 210 seems slightly closer) + 3: bright blue (150 seems correct) + 4: green (270 seems correct) + 5: red (30 seems correct, does have some blue in it) + 6: orange (0 seems correct, does have some red in it) + 7: yellow/gold (330 is closest but conflicts with color C, hence 315 seems close, and must have its own delay line separate from the other phases which use a standard 12 phase scheme) + 8: blue with a hint of green in it (180 seems correct) + 9: blue-green (210 seems correct) + A: forest green (240 seems correct) + B: yellow-green (300 seems correct) + C: yellow-orange (330 is close but this conflicts with color 7, and is not quite the same; color 7 has more green in it than color C) + D: magenta (60 is closest) + E: blue-purple (more blue than color 1, 120 is closest) + F: grey-through-white (0 assumed chroma) + */ + static const double phaseangle[16] = { 0, 90, 220, 150, 270, 40, 0, 315, 180, 210, 240, 300, 330, 60, 120, 0 }; // note: these are guessed, not measured yet! + int chromaindex = color&0x0F; + int swappedcolor = ((color&0xf0)>>4)|((color&0x0f)<<4); + double finalY, finalI, finalQ, finalR, finalG, finalB; + finalY = (1/LUMAMAX) * lumatable[swappedcolor]; + finalI = (M_I * (cos((phaseangle[chromaindex]/180)*3.141592653589793)))* ((1/CHROMAMAX)*chromaintensity[swappedcolor]); + finalQ = (M_Q * (sin((phaseangle[chromaindex]/180)*3.141592653589793)))* ((1/CHROMAMAX)*chromaintensity[swappedcolor]); + if (finalY > 1) finalY = 1; // clamp luma + /* calculate the R, G and B values here, neato matrix math */ + finalR = (finalY*1)+(finalI*0.9563)+(finalQ*0.6210); + finalG = (finalY*1)+(finalI*-0.2721)+(finalQ*-0.6474); + finalB = (finalY*1)+(finalI*-1.1070)+(finalQ*1.7046); + /* scale/clamp to 0-255 range */ + if (finalR<0) finalR = 0; + if (finalR>1) finalR = 1; + if (finalG<0) finalG = 0; + if (finalG>1) finalG = 1; + if (finalB<0) finalB = 0; + if (finalB>1) finalB = 1; + // gamma correction: 1.0 to GAMMA: + finalR = pow(finalR, 1/GAMMA)*255; + finalG = pow(finalG, 1/GAMMA)*255; + finalB = pow(finalB, 1/GAMMA)*255; +composedcolor = rgb_t((int)finalR,(int)finalG,(int)finalB); +return composedcolor; +} + + +PALETTE_INIT_MEMBER(socrates_state, socrates) +{ + int i; // iterator + for (i = 0; i < 256; i++) + { + m_palette_val[i] = socrates_create_color(i); + } + palette.set_pen_colors(0, m_palette_val, ARRAY_LENGTH(m_palette_val)); +} + +void socrates_state::video_start() +{ + m_scroll_offset = 0; +} + +UINT32 socrates_state::screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + static const UINT8 fixedcolors[8] = + { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 + }; + UINT8 *videoram = m_vram_reg->base(); + int x, y, colidx, color; + int lineoffset = 0; // if display ever tries to display data at 0xfxxx, offset line displayed by 0x1000 + for (y = 0; y < 228; y++) + { + if ((((y+m_scroll_offset)*128)&0xffff) >= 0xf000) lineoffset = 0x1000; // see comment above + for (x = 0; x < 264; x++) + { + if (x < 256) + { + colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; + if (x&1) colidx >>=4; + colidx &= 0xF; + if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; + else color=fixedcolors[colidx]; + bitmap.pix16(y, x) = color; + } + else + { + colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; + colidx >>=4; + colidx &= 0xF; + if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; + else color=fixedcolors[colidx]; + bitmap.pix16(y, x) = color; + } + } + } + return 0; +} + +/* below belongs in sound/nc.c */ + +WRITE8_MEMBER(socrates_state::socrates_sound_w) +{ + switch(offset) + { + case 0: + m_sound->reg0_w(data); + break; + case 1: + m_sound->reg1_w(data); + break; + case 2: + m_sound->reg2_w(data); + break; + case 3: + m_sound->reg3_w(data); + break; + case 4: case 5: case 6: case 7: default: + m_sound->reg4_w(data); + break; + } +} + + + +//----------------------------------------------------------------------------- +// +// IQ Unlimited +// +//----------------------------------------------------------------------------- + +int iqunlim_state::get_color(int index, int y) +{ + if (index < 8) + return m_colors[index]; + else + return m_vram_reg->u8(0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff)); +} + +UINT32 iqunlim_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_vram_reg->base(); + + // bitmap layer + for (int y=0; y<224; y++) + { + if (y >= m_video_regs[0x03]) break; + for (int x=0; x<128; x++) + { + UINT8 data = videoram[(m_scroll_offset + y) * 0x80 + x]; + + for(int b=0; b<2; b++) + { + bitmap.pix16(y, x*2 + b) = get_color(data & 0x0f, y); + data >>= 4; + } + } + } + + // text layer + bool mode_80 = m_video_regs[0x02] & 0x02; // 80 chars mode + int line_len = mode_80 ? 80 : 40; + for (int y=0; y<28; y++) + { + for (int x=0; x= m_video_regs[0x03]) + { + UINT8 col0 = get_color(0x0e, py); + UINT8 col1 = get_color(0x0f, py); + UINT8 data = 0; + + if (BIT(m_video_regs[0x02],4) && m_video_regs[0x00] == x && m_video_regs[0x01] == ((y - 1) + (0x400 / (mode_80 ? 0x80 : 0x40)))) // cursor position start at 0x8000 + data = 0xff; + else if (y > 0 && y < 26) + data = gfx[cy] ^ (c & 0x80 ? 0xff : 0); + + if (x == 0) bitmap.plot_box(0, py, 8 + line_len*6 + 8, 1, col0); + for (int cx=0; cx<6; cx++) + { + int px = 8 + x*6 + cx; + bitmap.pix16(py, px) = BIT(data, 7) ? col1 : col0; + data <<= 1; + } + } + } + } + } + + return 0; +} + +READ8_MEMBER( iqunlim_state::status_r ) +{ + // ---x ---- main battery status + // --x- ---- backup battery status + + return 0x30; +} + +READ8_MEMBER( iqunlim_state::video_regs_r ) +{ + return m_video_regs[offset]; +} + +WRITE8_MEMBER( iqunlim_state::video_regs_w ) +{ + if (offset == 2 && ((m_video_regs[offset] ^ data) & 0x02)) + { + rectangle visarea = m_screen->visible_area(); + visarea.set(0, (data & 0x02 ? 496 : 256) - 1, 0, 224 - 1); + m_screen->configure(data & 0x02 ? 496 : 256 , 224, visarea, m_screen->frame_period().attoseconds()); + } + + m_video_regs[offset] = data; +} + +void iqunlim_state::machine_start() +{ + std::string region_tag; + m_cart_reg = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + UINT8 *bios = m_bios_reg->base(); + UINT8 *cart = m_cart_reg ? m_cart_reg->base() : m_bios_reg->base(); + UINT8 *ram = m_vram_reg->base(); + + m_bank1->configure_entries(0x00, 0x10, bios, 0x4000); + m_bank1->configure_entries(0x10, 0x10, cart , 0x4000); + m_bank1->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000); + m_bank1->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000); + + m_bank2->configure_entries(0x00, 0x10, bios, 0x4000); + m_bank2->configure_entries(0x10, 0x10, cart , 0x4000); + m_bank2->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000); + m_bank2->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000); + + m_bank3->configure_entries(0x00, 0x08, ram, 0x4000); + m_bank4->configure_entries(0x00, 0x08, ram, 0x4000); +} + +void iqunlim_state::machine_reset() +{ + socrates_state::machine_reset(); + + m_rambank = m_rombank[0] = m_rombank[1] = 0; + memset(m_colors, 0, 8); + memset(m_video_regs, 0, 4); + m_kb_queue.head = m_kb_queue.tail = 0; + + m_bank1->set_entry(0x00); + m_bank2->set_entry(0x00); + m_bank3->set_entry(0x00); + m_bank4->set_entry(0x00); +} + +READ8_MEMBER( iqunlim_state::rombank_r ) +{ + return m_rombank[offset]; +} + +WRITE8_MEMBER( iqunlim_state::rombank_w ) +{ + memory_bank *bank = offset ? m_bank1 : m_bank2; + bank->set_entry(data & 0x3f); + + m_rombank[offset] = data; +} + +READ8_MEMBER( iqunlim_state::rambank_r ) +{ + return m_rambank; +} + +WRITE8_MEMBER( iqunlim_state::rambank_w ) +{ + m_bank3->set_entry(((data>>2) & 0x0c) | ((data>>0) & 0x03)); + m_bank4->set_entry(((data>>4) & 0x0c) | ((data>>2) & 0x03)); + m_rambank = data; +} + +WRITE8_MEMBER( iqunlim_state::colors_w ) +{ + m_colors[offset] = data; +} + + +// IQ Unlimited keyboard MCU simulation + +INPUT_CHANGED_MEMBER( iqunlim_state::send_input ) +{ + UINT8 data = (UINT8)(FPTR)param; + + if (newval) + { + m_kb_queue.buffer[m_kb_queue.tail] = data; + m_kb_queue.tail = (m_kb_queue.tail + 1) % sizeof(m_kb_queue.buffer); + } +} + +WRITE8_MEMBER( iqunlim_state::keyboard_clear ) +{ + if(m_kb_queue.head != m_kb_queue.tail) + m_kb_queue.head = (m_kb_queue.head + 1) % sizeof(m_kb_queue.buffer); +} + +READ8_MEMBER( iqunlim_state::keyboard_r ) +{ + UINT8 data = 0; + + switch(offset) + { + case 0: + if(m_kb_queue.head != m_kb_queue.tail) + data = m_kb_queue.buffer[m_kb_queue.head]; + break; + case 1: + data = (m_kb_queue.head != m_kb_queue.tail ? 0x80 : 0) | (ioport("IN0")->read() & 0x7f); + if (m_screen->vblank()) data |= 0x80; // FIXME + break; + } + + return data; +} + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(z80_mem, AS_PROGRAM, 8, socrates_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROM /* system rom, bank 0 (fixed) */ + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") /* banked rom space; system rom is banks 0 through F, cartridge rom is banks 10 onward, usually banks 10 through 17. area past the end of the cartridge, and the whole 10-ff area when no cartridge is inserted, reads as 0xF3 */ + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank2") /* banked ram 'window' 0 */ + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank3") /* banked ram 'window' 1 */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(z80_io, AS_IO, 8, socrates_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READWRITE(socrates_rom_bank_r, socrates_rom_bank_w) AM_MIRROR(0x7) /* rom bank select - RW - 8 bits */ + AM_RANGE(0x08, 0x08) AM_READWRITE(socrates_ram_bank_r, socrates_ram_bank_w) AM_MIRROR(0x7) /* ram banks select - RW - 4 low bits; Format: 0b****HHLL where LL controls whether window 0 points at ram area: 0b00: 0x0000-0x3fff; 0b01: 0x4000-0x7fff; 0b10: 0x8000-0xbfff; 0b11: 0xc000-0xffff. HH controls the same thing for window 1 */ + AM_RANGE(0x10, 0x17) AM_READWRITE(read_f3, socrates_sound_w) AM_MIRROR (0x8) /* sound section: + 0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL_21_4772MHz/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions) + 0x11 - W - frequency control for channel 2 (softer channel) - 01=high pitch, ff=low; same equation as above + 0x12 - W - 0b***EVVVV enable, volume control for channel 1 + 0x13 - W - 0b***EVVVV enable, volume control for channel 2 + 0x14-0x17 - 0bE??????? enable, unknown for channel 3; produces well defined dmc waves when bit 7 is set, and one or two other bits + This may be some sort of debug register for serial-dmc banging out some internal rom from the asic, maybe color data? + No writes to ram seem to change the waveforms produced, in my limited testing. + 0x80 produces about a very very quiet 1/8 duty cycle wave at 60hz or so + 0xC0 produces a DMC wave read from an unknown address at around 342hz + 0x + */ + AM_RANGE(0x20, 0x21) AM_READWRITE(read_f3, socrates_scroll_w) AM_MIRROR (0xe) /* graphics section: + 0x20 - W - lsb offset of screen display + 0x21 - W - msb offset of screen display + resulting screen line is one of 512 total offsets on 128-byte boundaries in the whole 64k ram + */ + AM_RANGE(0x30, 0x30) AM_READWRITE(read_f3, kbmcu_strobe) AM_MIRROR (0xf) /* resets the keyboard IR decoder MCU */ + AM_RANGE(0x40, 0x40) AM_READWRITE(status_and_speech, speech_command ) AM_MIRROR(0xf) /* reads status register for vblank/hblank/speech, also reads and writes speech module */ + AM_RANGE(0x50, 0x50) AM_READWRITE(socrates_keyboard_low_r, socrates_keyboard_clear) AM_MIRROR(0xE) /* Keyboard keycode low, latched on keypress, can be unlatched by writing anything here */ + AM_RANGE(0x51, 0x51) AM_READWRITE(socrates_keyboard_high_r, socrates_keyboard_clear) AM_MIRROR(0xE) /* Keyboard keycode high, latched as above, unlatches same as above */ + AM_RANGE(0x60, 0x60) AM_READWRITE(read_f3, reset_speech) AM_MIRROR(0xF) /* reset the speech module, or perhaps fire an NMI? */ + AM_RANGE(0x70, 0xFF) AM_READ(read_f3) // nothing mapped here afaik +ADDRESS_MAP_END + +static ADDRESS_MAP_START(iqunlim_mem, AS_PROGRAM, 8, iqunlim_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( iqunlim_io , AS_IO, 8, iqunlim_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x01) AM_READWRITE(rombank_r, rombank_w) AM_MIRROR(0x06) + AM_RANGE(0x08, 0x08) AM_READWRITE(rambank_r, rambank_w) AM_MIRROR(0x07) + AM_RANGE(0x10, 0x17) AM_WRITE(socrates_sound_w) AM_MIRROR (0x08) + AM_RANGE(0x20, 0x21) AM_WRITE(socrates_scroll_w) AM_MIRROR (0x0e) + AM_RANGE(0x50, 0x51) AM_READWRITE(keyboard_r, keyboard_clear) + AM_RANGE(0x70, 0x73) AM_READWRITE(video_regs_r, video_regs_w) AM_MIRROR (0x0c) + AM_RANGE(0x80, 0x81) AM_WRITENOP // LCD + AM_RANGE(0xb1, 0xb1) AM_WRITENOP + AM_RANGE(0xa0, 0xa0) AM_READ(status_r) AM_MIRROR(0x0f) + AM_RANGE(0xe0, 0xe7) AM_WRITE(colors_w) AM_MIRROR(0x08) +ADDRESS_MAP_END + + + +/****************************************************************************** + Input Ports +******************************************************************************/ + +/* socrates keyboard codes: +keycode low +| keycode high +| | key name +00 01 No key pressed +// pads on the sides of the kb; this acts like a giant bitfield, both dpads/buttons can send data at once +00 81 left dpad right +00 82 left dpad up +00 84 left dpad left +00 88 left dpad down +01 80 right dpad down +02 80 right dpad left +04 80 right dpad up +08 80 right dpad right +10 80 left red button +20 80 right red button +// top row (right to left) +44 82 ENTER +44 83 MENU +44 84 ANSWER +44 85 HELP +44 86 ERASE +44 87 divide_sign +44 88 multiply_sign +44 89 minus_sign +44 80 plus_sign +//second row (right to left) +43 81 0 +43 82 9 +43 83 8 +43 84 7 +43 85 6 +43 86 5 +43 87 4 +43 88 3 +43 89 2 +43 80 1 +// third row (right to left) +42 82 I/La +42 83 H/So +42 84 G/Fa +42 85 F/Mi +42 86 E/Re +42 87 D/Do +42 88 C/Ti. +42 89 B/La. +42 80 A/So. +42 81 hyphen/period +// fourth row (right to left) +41 81 S +41 82 R +41 83 Q/NEW +41 84 P/PLAY +41 85 O/PAUSE +41 86 N/Fa` +41 87 M/Mi` +41 88 L/Re` +41 89 K/Do` +41 80 J/Ti +// fifth row (right to left) +40 82 SPACE +40 83 Z +40 84 Y +40 85 X +40 86 W +40 87 V +40 88 U +40 89 T +50 80 SHIFT +// socrates mouse pad (separate from keyboard) +8x 8y mouse movement +x: down = 1 (small) through 7 (large), up = 8 (small) through F (large) +y: right = 1 (small) through 7 (large), left = 8 (small) through F (large) +90 80 right click +A0 80 left click +B0 80 both buttons click +90 81 right click (mouse movement in queue, will be in regs after next latch clear) +A0 81 left click (mouse movement in queue, will be in regs after next latch clear) +B0 81 both buttons click (mouse movement in queue, will be in regs after next latch clear) +// socrates touch pad +// unknown yet, but probably uses the 60/70/c0/d0/e0/f0 low reg vals +*/ +static INPUT_PORTS_START( socrates ) + + PORT_START("keyboard_jp") // joypad keys + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_NAME("Left D-pad Right") // 00 81 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_NAME("Left D-pad Up") // 00 82 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_NAME("Left D-pad Left") // 00 84 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_NAME("Left D-pad Down") // 00 88 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("Right D-pad Down") // 01 80 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME("Right D-pad Left") // 02 80 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_NAME("Right D-pad Up") // 04 80 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("Right D-pad Right") // 08 80 + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_NAME("Left D-pad Button") // 10 80 + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Right D-pad Button") // 20 80 + PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) + /* alt w/left and right keypad keys swapped + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("Left D-pad Right") // 00 81 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_NAME("Left D-pad Up") // 00 82 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME("Left D-pad Left") // 00 84 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("Left D-pad Down") // 00 88 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_NAME("Right D-pad Down") // 01 80 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_NAME("Right D-pad Left") // 02 80 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_NAME("Right D-pad Up") // 04 80 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_NAME("Right D-pad Right") // 08 80 + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Left D-pad Button") // 10 80 + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_NAME("Right D-pad Button") // 20 80 + PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) + */ + + PORT_START("keyboard_50") // lowest 'row' (technically the shift key is on the 5th row but it has its own keycode) + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("SHIFT") // 5x xx + PORT_BIT(0xfffffffe, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyboard_40") // 5th row + PORT_BIT(0x00000003, IP_ACTIVE_HIGH, IPT_UNUSED) // 40 80 and 40 81 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_NAME("SPACE") // 40 82 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_NAME("Z") // 40 83 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_NAME("Y") // 40 84 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_NAME("X") // 40 85 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_NAME("W") // 40 86 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_NAME("V") // 40 87 + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_NAME("U") // 40 88 + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_NAME("T") // 40 89 + PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyboard_41") // 4th row + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_NAME("J/Ti") // 41 80 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_NAME("S") // 41 81 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_NAME("R") // 41 82 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_NAME("Q/NEW") // 41 83 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_NAME("P/PLAY") // 41 84 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_NAME("O/PAUSE") // 41 85 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_NAME("N/Fa'") // 41 86 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_NAME("M/Mi'") // 41 87 + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_NAME("L/Re'") // 41 88 + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_NAME("K/Do'") // 41 89 + PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyboard_42") // 3rd row + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_NAME("A/So.") // 42 80 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('-') PORT_NAME("-/.") // 42 81 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_NAME("I/La") // 42 82 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_NAME("H/So") // 42 83 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_NAME("G/Fa") // 42 84 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_NAME("F/Mi") // 42 85 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_NAME("E/Re") // 42 86 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_NAME("D/Do") // 42 87 + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_NAME("C/Ti.") // 42 88 + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_NAME("B/La.") // 42 89 + PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyboard_43") // 2nd row + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_NAME("1") // 43 80 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_NAME("0") // 43 81 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9") // 43 82 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_NAME("8") // 43 83 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_NAME("7") // 43 84 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_NAME("6") // 43 85 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_NAME("5") // 43 86 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_NAME("4") // 43 87 + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_NAME("3") // 43 88 + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_NAME("2") // 43 89 + PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("keyboard_44") // 1st row + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_NAME("+") // 44 80 + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_UNUSED) // 44 81 + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_NAME("ENTER") // 44 82 + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("MENU") // 44 83 + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_NAME("ANSWER") // 44 84 + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_NAME("HELP") // 44 85 + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_NAME("ERASE") // 44 86 + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_NAME("/") // 44 87 + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') PORT_NAME("*") // 44 88 + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("-") // 44 89 + PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) + + // mouse goes here +INPUT_PORTS_END + + +static INPUT_PORTS_START( iqunlimz ) + PORT_START( "IN0" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LSHIFT ) PORT_CODE( KEYCODE_RSHIFT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LCONTROL ) PORT_CODE( KEYCODE_RCONTROL ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LALT ) PORT_CODE( KEYCODE_RALT ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CAPSLOCK ) + PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START( "IN1" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_N ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x10 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x11 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x12 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_B ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x13 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_C ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x14 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x15 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_V ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x16 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_X ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x17 ) + + PORT_START( "IN2" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x20 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2_PAD ) PORT_CODE( KEYCODE_DOWN ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x21 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x22 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_DEL_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x23 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x24 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8_PAD ) PORT_CODE( KEYCODE_UP ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x25 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ASTERISK ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x26 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x27 ) + + PORT_START( "IN3" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x30 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x31 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x32 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x33 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F1 ) PORT_NAME( "Help" ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x34 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x35 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSPACE ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x36 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x37 ) + + PORT_START( "IN4" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_H ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x40 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_J ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x41 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_K ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x42 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_G ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x43 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_D ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x44 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x45 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x46 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_S ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x47 ) + + PORT_START( "IN5" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x50 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x51 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x52 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x53 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_EQUALS ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x54 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_O ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x55 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_NUMLOCK ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x56 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_P ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x57 ) + + PORT_START( "IN6" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x60 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_U ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x61 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_I ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x62 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_T ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x63 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_E ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x64 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x65 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_R ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x66 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x67 ) + + PORT_START( "IN7" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x70 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x71 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x72 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_STOP ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x73 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x74 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_L ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x75 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ENTER ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x76 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COLON ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x77 ) + + PORT_START( "IN8" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x80 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x81 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x82 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x83 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x84 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x85 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x86 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x87 ) + + PORT_START( "IN9" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4_PAD ) PORT_CODE( KEYCODE_LEFT ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x90 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x91 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6_PAD ) PORT_CODE( KEYCODE_RIGHT ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x92 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PLUS_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x93 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x94 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x95 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x96 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x97 ) + + PORT_START( "INA" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa0 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa1 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa2 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa3 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F2 ) PORT_NAME("Answer") PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa4 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ESC ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa5 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SPACE ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa6 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_TAB ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa7 ) +INPUT_PORTS_END + +/****************************************************************************** + Machine Drivers +******************************************************************************/ +TIMER_CALLBACK_MEMBER(socrates_state::clear_irq_cb) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); + m_vblankstate = 0; +} + +INTERRUPT_GEN_MEMBER(socrates_state::assert_irq) +{ + device.execute().set_input_line(0, ASSERT_LINE); + timer_set(downcast(&device)->cycles_to_attotime(44), TIMER_CLEAR_IRQ); +// 44 is a complete and total guess, need to properly measure how many clocks/microseconds the int line is high for. + m_vblankstate = 1; + m_kbmcu_rscount = 0; // clear the mcu poke count +} + +static MACHINE_CONFIG_START( socrates, socrates_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_21_4772MHz/6) /* Toshiba TMPZ84C00AP @ 3.579545 MHz, verified, xtal is divided by 6 */ + MCFG_CPU_PROGRAM_MAP(z80_mem) + MCFG_CPU_IO_MAP(z80_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + MCFG_CPU_VBLANK_INT_DRIVER("screen", socrates_state, assert_irq) + //MCFG_MACHINE_START_OVERRIDE(socrates_state,socrates) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(264, 228) // technically the screen size is 256x228 but super painter abuses what I suspect is a hardware bug to display repeated pixels of the very last pixel beyond this horizontal space, well into hblank + MCFG_SCREEN_VISIBLE_AREA(0, 263, 0, 219) // the last few rows are usually cut off by the screen bottom but are indeed displayed if you mess with v-hold + MCFG_SCREEN_UPDATE_DRIVER(socrates_state, screen_update_socrates) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_INIT_OWNER(socrates_state, socrates) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256)) // this is correct, as strange as it sounds. + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( socrates_pal, socrates_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_26_601712MHz/6) /* Toshiba TMPZ84C00AP @ 4.433 MHz? /6 or 7 or 8? TODO: verify divider!*/ + MCFG_CPU_PROGRAM_MAP(z80_mem) + MCFG_CPU_IO_MAP(z80_io) + MCFG_QUANTUM_TIME(attotime::from_hz(50)) + MCFG_CPU_VBLANK_INT_DRIVER("screen", socrates_state, assert_irq) + //MCFG_MACHINE_START_OVERRIDE(socrates_state,socrates) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(264, 238) // technically the screen size is 256x228 but super painter abuses what I suspect is a hardware bug to display repeated pixels of the very last pixel beyond this horizontal space, well into hblank + MCFG_SCREEN_VISIBLE_AREA(0, 263, 0, 229) // the last few rows are usually cut off by the screen bottom but are indeed displayed if you mess with v-hold + MCFG_SCREEN_UPDATE_DRIVER(socrates_state, screen_update_socrates) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_INIT_OWNER(socrates_state, socrates) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_26_601712MHz/(512+256)) // TODO: verify divider for pal mode + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates") +MACHINE_CONFIG_END + +/* This doesn't work for some reason. +static MACHINE_CONFIG_DERIVED( socrates_pal, socrates ) + MCFG_CPU_REPLACE("maincpu", Z80, XTAL_26_601712MHz/8) + MCFG_SCREEN_REPLACE("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(264, 256) // technically the screen size is 256x228 but super painter abuses what I suspect is a hardware bug to display repeated pixels of the very last pixel beyond this horizontal space, well into hblank + MCFG_SCREEN_VISIBLE_AREA(0, 263, 0, 256) // the last few rows are usually cut off by the screen bottom but are indeed displayed if you mess with v-hold + MCFG_SCREEN_UPDATE_DRIVER(socrates_state, screen_update_socrates) + MCFG_SOUND_REPLACE("soc_snd", SOCRATES_SOUND, XTAL_26_601712MHz/(512+256)) // this is correct, as strange as it sounds. + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END +*/ + +static MACHINE_CONFIG_START( iqunlimz, iqunlim_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) /* not accurate */ + MCFG_CPU_PROGRAM_MAP(iqunlim_mem) + MCFG_CPU_IO_MAP(iqunlim_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", iqunlim_state, assert_irq) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(iqunlim_state, screen_update) + MCFG_SCREEN_SIZE(256, 224) + MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 224-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_INIT_OWNER(socrates_state, socrates) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) +MACHINE_CONFIG_END + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START(socrates) + ROM_REGION(0x400000, "maincpu", ROMREGION_ERASEVAL(0xF3)) /* can technically address 4mb of rom via bankswitching; open bus area reads as 0xF3 */ + /* Socrates US NTSC */ + /* all cart roms are 28 pin 23c1000/tc531000 128Kx8 roms */ + /* cart port pinout: + (looking into end of disk-shaped cartridge with label/top side pointing to the right) + A15 -> 19 18 -- VCC + A14 -> 20 17 <- A16 + A13 -> 21 16 <- A12 + A8 -> 22 15 <- A7 + A9 -> 23 14 <- A6 + A11 -> 24 13 <- A5 + A3 -> 25 12 <- A4 + A2 -> 26 11 <- A10 + D7 <- 27 10 <- A1 + D6 <- 28 9 <- A0 + D5 <- 29 8 -> D0 + D4 <- 30 7 -> D1 + D3 <- 31 6 -> D2 + ? ?? 32 5 ?? ? + A17 -> 33 4 ?? ? + ? ?? 34 3 ?? ? + /CE -> 35 2 ?? ? + GND -- 36 1 -- GND + Note that a17 goes to what would be pin 2 on a rom chip if a 32 pin rom were installed, which is not the case. (pins 1, 31 and 32 would be tied to vcc) + It is likely that at least one of the 6 unknown lines is R/W from the z80, and another may be phi1/m1/clock etc to allow for ram to live in cart space + + Cartridge check procedure by socrates is, after screen init and check for speech synth, + bankswitch to bank 0x10 (i.e. first 0x4000 of cart appears at 4000-7fff in z80 space), + do following tests; if any tests fail, jump to 0x0015 (socrates main menu) + * read 0x7ff0(0x3ff0 in cart rom) and compare to 0xAA + * read 0x7ff1(0x3ff1 in cart rom) and compare to 0x55 + * read 0x7ff2(0x3ff2 in cart rom) and compare to 0xE7 + * read 0x7ff3(0x3ff3 in cart rom) and compare to 0x18 + if all tests passed, jump to 0x4000 (0x0000 in cart rom) + */ + ROM_LOAD("27-00817-000-000.u1", 0x00000, 0x40000, CRC(80f5aa20) SHA1(4fd1ff7f78b5dd2582d5de6f30633e4e4f34ca8f)) // Label: "(Vtech) 27-00817-000-000 // (C)1987 VIDEO TECHNOLOGY // 8811 D" + + ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ + + ROM_REGION(0x800, "kbmcu", ROMREGION_ERASEFF) + ROM_LOAD("tmp42c40p1844.u2", 0x000, 0x200, NO_DUMP) /* keyboard IR decoder MCU */ + + /* english speech cart has a green QC sticker */ + ROM_REGION(0x2000, "speechint", ROMREGION_ERASE00) // speech data inside of the speech chip; fill with 00, if no speech cart is present socrates will see this + ROM_LOAD_OPTIONAL("speech_eng_internal.bin", 0x0000, 0x2000, CRC(edc1fb3f) SHA1(78b4631fc3b1c038e14911047f9edd6c4e8bae58)) // 8k on the speech chip itself + + ROM_REGION(0x10000, "speechext", ROMREGION_ERASE00) // speech serial modules outside of the speech chip but still on speech cart + ROM_LOAD_OPTIONAL("speech_eng_vsm1.bin", 0x0000, 0x4000, CRC(888e3ddd) SHA1(33af6a21ba6d826071c9d48557b1c9012752570b)) // 16k in serial rom + ROM_LOAD_OPTIONAL("speech_eng_vsm2.bin", 0x4000, 0x4000, CRC(de4ac89d) SHA1(3dfa853b02df756a9b72def94a39310992ee11c7)) // 16k in serial rom + ROM_LOAD_OPTIONAL("speech_eng_vsm3.bin", 0x8000, 0x4000, CRC(972384aa) SHA1(ffcb1d633ca6bffc7f481ec505da447e5b847f16)) // 16k in serial rom + ROM_FILL(0xC000, 0x4000, 0xff) // last vsm isn't present, FF fill +ROM_END + +ROM_START(socratfc) + ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEVAL(0xF3)) + /* Socrates SAITOUT (French Canadian) NTSC */ + ROM_LOAD("27-00884-001-000.u1", 0x00000, 0x40000, CRC(042d9d21) SHA1(9ffc67b2721683b2536727d0592798fbc4d061cb)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D" + + ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ + + ROM_REGION(0x800, "kbmcu", ROMREGION_ERASEFF) + ROM_LOAD("tmp42c40p1844.u2", 0x000, 0x200, NO_DUMP) /* keyboard IR decoder MCU */ + + ROM_REGION(0x2000, "speechint", ROMREGION_ERASE00) // speech data inside of the speech chip; fill with 00, if no speech cart is present socrates will see this + ROM_LOAD_OPTIONAL("speech_fra_internal.bin", 0x0000, 0x2000, NO_DUMP) + + ROM_REGION(0x10000, "speechext", ROMREGION_ERASE00) // speech serial modules outside of the speech chip but still on speech cart + ROM_LOAD_OPTIONAL("speech_fra_vsm1.bin", 0x0000, 0x4000, NO_DUMP) // 16k in serial rom + ROM_LOAD_OPTIONAL("speech_fra_vsm2.bin", 0x4000, 0x4000, NO_DUMP) // 16k in serial rom + ROM_LOAD_OPTIONAL("speech_fra_vsm3.bin", 0x8000, 0x4000, NO_DUMP) // 16k in serial rom + ROM_FILL(0xC000, 0x4000, 0xff) // last vsm isn't present, FF fill +ROM_END + +ROM_START(profweis) + ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEVAL(0xF3)) + /* Yeno Professor Weiss-Alles (German PAL) */ + ROM_SYSTEM_BIOS(0, "89", "1989") + ROMX_LOAD("lh53216d.u1", 0x00000, 0x40000, CRC(6e801762) SHA1(b80574a3abacf18133dacb9d3a8d9e2916730423), ROM_BIOS(1)) // Label: "(Vtech) LH53216D // (C)1989 VIDEO TECHNOLOGY // 9119 D" + ROM_SYSTEM_BIOS(1, "88", "1988") + ROMX_LOAD("27-00885-001-000.u1", 0x00000, 0x40000, CRC(fcaf8850) SHA1(a99011ee6a1ef63461c00d062278951252f117db), ROM_BIOS(2)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D" + + ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ + + ROM_REGION(0x800, "kbmcu", ROMREGION_ERASEFF) + ROM_LOAD("tmp42c40p1844.u2", 0x000, 0x200, NO_DUMP) /* keyboard IR decoder MCU */ + + ROM_REGION(0x2000, "speechint", ROMREGION_ERASE00) // speech data inside of the speech chip; fill with 00, if no speech cart is present socrates will see this + ROM_LOAD_OPTIONAL("speech_ger_internal.bin", 0x0000, 0x2000, CRC(5ff0fdc6) SHA1(8ef128561a846762a20e3fe9513a4a22aaadc7f6)) + + ROM_REGION(0x10000, "speechext", ROMREGION_ERASE00) // speech serial modules outside of the speech chip but still on speech cart + ROM_LOAD_OPTIONAL("speech_ger_vsm1.bin", 0x0000, 0x4000, CRC(a979a00b) SHA1(0290844619dbdf336757003aaab3ffd0a75b7ee9)) // 16k in serial rom + ROM_FILL(0x4000, 0xc000, 0xff) // last 3 vsms aren't present, FF fill +ROM_END + +ROM_START( iqunlimz ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD( "vtech.bin", 0x000000, 0x080000, CRC(f100c8a7) SHA1(6ad2a8accae2dd5c5c46ae953eef33cdd1ea3cf9) ) + + ROM_REGION( 0x20000, "vram", ROMREGION_ERASE ) +ROM_END + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1988, socrates, 0, 0, socrates, socrates, socrates_state, socrates, "Video Technology", "Socrates Educational Video System", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) // English NTSC, no title copyright +COMP( 1988, socratfc, socrates, 0, socrates, socrates, socrates_state, socrates, "Video Technology", "Socrates SAITOUT", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) // French Canandian NTSC, 1988 title copyright +COMP( 1988, profweis, socrates, 0, socrates_pal, socrates, socrates_state, socrates, "Video Technology/Yeno", "Professor Weiss-Alles", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) // German PAL, 1988 title copyright +// Yeno Professeur Saitout goes here (french SECAM) +// ? goes here (spanish PAL) + +COMP( 1991, iqunlimz, 0, 0, iqunlimz, iqunlimz, driver_device, 0, "Video Technology", "IQ Unlimited (Z80)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/softbox.c b/src/mame/drivers/softbox.c new file mode 100644 index 00000000000..ba2c07688ea --- /dev/null +++ b/src/mame/drivers/softbox.c @@ -0,0 +1,450 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Mike Naberezny +/* + + SSE SoftBox + + http://mikenaberezny.com/hardware/pet-cbm/sse-softbox-z80-computer/ + + + Standalone vs. PET/CBM Peripheral Mode + -------------------------------------- + + The SoftBox can be used as a standalone computer with an RS-232 terminal, + or as a PET/CBM peripheral. This is an emulation of the standalone mode. + For the peripheral mode, see: src/emu/bus/ieee488/softbox.c. + + + Using the Corvus hard disk + -------------------------- + + The SoftBox distribution disk (softbox-distrib.d80) is configured for + a CBM 8050 as CP/M drives A/B and a 10MB Corvus hard disk as drives C/D. + + Use the CHDMAN utility to create a 10MB hard disk image for the Corvus: + + $ chdman createhd -o /path/to/corvus10mb.chd -chs 358,3,20 -ss 512 + + Start the SoftBox emulator with the floppy and hard disk images mounted: + + $ mess softbox -flop1 /path/to/softbox-distrib.d80 \ + -hard1 /path/to/corvus10mb.chd + + Before the Corvus can be used under CP/M, it must be prepared + by running DIAG.COM and FORMAT.COM. + + DIAG.COM + + Enter "diag" (no arguments) at the CP/M prompt to run the Corvus diagnostics + program. This program will perform the Corvus low-level format. + + Select option 6 (Update Controller Code) at the menu. + Enter "corvb184.fmt" when prompted for the filename. + Enter "y" at the confirmation prompts. + Enter "1" for the Corvus drive number (two prompts). + After formatting is complete, it will return to the menu. + + Select option 3 (Read Controller Code Version #) at the menu. + Enter "1" for the Corvus drive number. + It should report "V18.4AP" and then return to the menu. + + Select option 9 to return to CP/M. + + FORMAT.COM + + Enter "format" (no arguments) at the CP/M prompt to run the SoftBox disk + format program. This program will perform the CP/M filesystem format. + + Enter drive letter "c" at the prompt. + Enter "y" to confirm the format. + After formatting is complete, it will prompt for a drive letter again. + + Enter drive letter "d" at the prompt. + Enter "y" to confirm the format. + After formatting is complete, it will prompt for a drive letter again. + + Press RETURN to return to CP/M. + + STAT.COM + + After all steps are completed, drives C and D should be usable from + CP/M. Each drive is one half of the Corvus 10MB disk. Running the + command "stat c: dsk:" should show 4712 kilobyte drive capacity. + Drive D should show the same information. + + + Using other Corvus hard disk sizes + ---------------------------------- + + The SoftBox supports 5, 10, and 20 MB hard disks. The distribution disk + is configured for 10 MB as explained above. To use other sizes, make + a new image with CHDMAN. See the top of src/emu/machine/corvushd.h + for the parameters for the other drives. + + After the image has been created and the SoftBox emulator started with + it mounted, the SoftBox BIOS needs to be told what size Corvus hard + disk is attached. Use the NEWSYS.COM utility to reconfigure the drive + size. When NEWSYS prompts for a source drive, enter "a" (the drive letter + of the CP/M distribution disk). Use option "d" (Disk drive assignment) + to reconfigure the Corvus size. After the change has been made, use option + "s" (Save new system) to write the configuration to the floppy (drive A) and + option "e" (Execute new system) to restart CP/M with the configuration. + DIAG.COM and FORMAT.COM can then be used to format the hard disk. + +*/ + +#include "includes/softbox.h" +#include "bus/rs232/rs232.h" + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// dbrg_w - baud rate selection +//------------------------------------------------- + +WRITE8_MEMBER( softbox_state::dbrg_w ) +{ + m_dbrg->str_w(data & 0x0f); + m_dbrg->stt_w(data >> 4); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( softbox_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( softbox_mem, AS_PROGRAM, 8, softbox_state ) + AM_RANGE(0x0000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(Z80_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( softbox_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( softbox_io, AS_IO, 8, softbox_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x08, 0x08) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x09, 0x09) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x0c, 0x0c) AM_WRITE(dbrg_w) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(I8255_0_TAG, i8255_device, read, write) + AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(I8255_1_TAG, i8255_device, read, write) + AM_RANGE(0x18, 0x18) AM_DEVREADWRITE(CORVUS_HDC_TAG, corvus_hdc_t, read, write) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( softbox ) +//------------------------------------------------- + +static INPUT_PORTS_START( softbox ) + /* An 8-position DIP switch may be installed at SW1. Some + SoftBox units have it and some do not. The switches are + not used by the SoftBox BIOS. */ + PORT_START("SW1") + PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" ) + PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) + PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) + PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" ) + PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW1:5" ) + PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" ) + PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" ) + PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// I8255A 0 Interface +//------------------------------------------------- + +READ8_MEMBER( softbox_state::ppi0_pa_r ) +{ + return m_ieee->dio_r() ^ 0xff; +} + +WRITE8_MEMBER( softbox_state::ppi0_pb_w ) +{ + m_ieee->dio_w(data ^ 0xff); +} + +//------------------------------------------------- +// I8255A 1 Interface +//------------------------------------------------- + +READ8_MEMBER( softbox_state::ppi1_pa_r ) +{ + /* + + bit description + + PA0 ATN + PA1 DAV + PA2 NDAC + PA3 NRFD + PA4 EOI + PA5 SRQ + PA6 REN + PA7 IFC + + */ + + UINT8 data = 0; + + data |= !m_ieee->atn_r(); + data |= !m_ieee->dav_r() << 1; + data |= !m_ieee->ndac_r() << 2; + data |= !m_ieee->nrfd_r() << 3; + data |= !m_ieee->eoi_r() << 4; + data |= !m_ieee->srq_r() << 5; + data |= !m_ieee->ren_r() << 6; + data |= !m_ieee->ifc_r() << 7; + + return data; +} + +WRITE8_MEMBER( softbox_state::ppi1_pb_w ) +{ + /* + + bit description + + PB0 ATN + PB1 DAV + PB2 NDAC + PB3 NRFD + PB4 EOI + PB5 SRQ + PB6 REN + PB7 IFC + + */ + + m_ieee->atn_w(!BIT(data, 0)); + m_ieee->dav_w(!BIT(data, 1)); + m_ieee->ndac_w(!BIT(data, 2)); + m_ieee->nrfd_w(!BIT(data, 3)); + m_ieee->eoi_w(!BIT(data, 4)); + m_ieee->srq_w(!BIT(data, 5)); + m_ieee->ren_w(!BIT(data, 6)); + m_ieee->ifc_w(!BIT(data, 7)); +} + +READ8_MEMBER( softbox_state::ppi1_pc_r ) +{ + /* + + bit description + + PC0 + PC1 + PC2 + PC3 + PC4 Corvus READY + PC5 Corvus DIRC + PC6 + PC7 + + */ + + UINT8 status = m_hdc->status_r(space, 0); + UINT8 data = 0; + + data |= (status & CONTROLLER_BUSY) ? 0 : 0x10; + data |= (status & CONTROLLER_DIRECTION) ? 0 : 0x20; + + return data; +} + +WRITE8_MEMBER( softbox_state::ppi1_pc_w ) +{ + /* + + bit description + + PC0 LED "A" + PC1 LED "B" + PC2 LED "READY" + PC3 + PC4 + PC5 + PC6 + PC7 + + */ + + output_set_led_value(LED_A, !BIT(data, 0)); + output_set_led_value(LED_B, !BIT(data, 1)); + output_set_led_value(LED_READY, !BIT(data, 2)); +} + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( softbox ) +//------------------------------------------------- + +void softbox_state::machine_start() +{ +} + + +//------------------------------------------------- +// device_reset_after_children - device-specific +// reset that must happen after child devices +// have performed their resets +//------------------------------------------------- + +void softbox_state::device_reset_after_children() +{ + /* The Z80 starts at address 0x0000 but the SoftBox has RAM there and + needs to start from the BIOS at 0xf000. The PCB has logic and a + 74S287 PROM that temporarily changes the memory map so that the + IC3 EPROM at 0xf000 is mapped to 0x0000 for the first instruction + fetch only. The instruction normally at 0xf000 is an absolute jump + into the BIOS. On reset, the Z80 will fetch it from 0x0000 and set + its PC, then the normal map will be restored before the next + instruction fetch. Here we just set the PC to 0xf000 after the Z80 + resets, which has the same effect. */ + + m_maincpu->set_state_int(Z80_PC, 0xf000); +} + + +//------------------------------------------------- +// ieee488_ifc - interface clear (reset) +//------------------------------------------------- + +void softbox_state::ieee488_ifc(int state) +{ + if (!m_ifc && state) + { + device_reset(); + } + + m_ifc = state; +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( softbox ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( softbox, softbox_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) + MCFG_CPU_PROGRAM_MAP(softbox_mem) + MCFG_CPU_IO_MAP(softbox_io) + + // devices + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_DEVICE_ADD(I8255_0_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(softbox_state, ppi0_pa_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(softbox_state, ppi0_pb_w)) + MCFG_I8255_IN_PORTC_CB(IOPORT("SW1")) + + MCFG_DEVICE_ADD(I8255_1_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(softbox_state, ppi1_pa_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(softbox_state, ppi1_pb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(softbox_state, ppi1_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(softbox_state, ppi1_pc_w)) + + MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxc)) + MCFG_COM8116_FT_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_txc)) + + MCFG_CBM_IEEE488_ADD("c8050") + + MCFG_DEVICE_ADD(CORVUS_HDC_TAG, CORVUS_HDC, 0) + MCFG_HARDDISK_ADD("harddisk1") + MCFG_HARDDISK_INTERFACE("corvus_hdd") + MCFG_HARDDISK_ADD("harddisk2") + MCFG_HARDDISK_INTERFACE("corvus_hdd") + MCFG_HARDDISK_ADD("harddisk3") + MCFG_HARDDISK_INTERFACE("corvus_hdd") + MCFG_HARDDISK_ADD("harddisk4") + MCFG_HARDDISK_INTERFACE("corvus_hdd") + + MCFG_IMI7000_BUS_ADD("imi5000h", NULL, NULL, NULL) + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "softbox") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( softbox ) +//------------------------------------------------- + +ROM_START( softbox ) + ROM_REGION( 0x1000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS("19830609") + ROM_SYSTEM_BIOS( 0, "19810908", "8/9/81" ) + ROMX_LOAD( "375.ic3", 0x000, 0x800, CRC(177580e7) SHA1(af6a97495de825b80cdc9fbf72329d5440826177), ROM_BIOS(1) ) + ROMX_LOAD( "376.ic4", 0x800, 0x800, CRC(edfee5be) SHA1(5662e9071cc622a1c071d89b00272fc6ba122b9a), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "19811027", "27-Oct-81" ) + ROMX_LOAD( "379.ic3", 0x000, 0x800, CRC(7b5a737c) SHA1(2348590884b026b7647f6864af8c9ba1c6f8746b), ROM_BIOS(2) ) + ROMX_LOAD( "380.ic4", 0x800, 0x800, CRC(65a13029) SHA1(46de02e6f04be298047efeb412e00a5714dc21b3), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "19830609", "09-June-1983" ) + ROMX_LOAD( "389.ic3", 0x000, 0x800, CRC(d66e581a) SHA1(2403e25c140c41b0e6d6975d39c9cd9d6f335048), ROM_BIOS(3) ) + ROMX_LOAD( "390.ic4", 0x800, 0x800, CRC(abe6cb30) SHA1(4b26d5db36f828e01268f718799f145d09b449ad), ROM_BIOS(3) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1981, softbox, 0, 0, softbox, softbox, driver_device, 0, "Small Systems Engineering", "SoftBox", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/sorcerer.c b/src/mame/drivers/sorcerer.c new file mode 100644 index 00000000000..bff2e0820a2 --- /dev/null +++ b/src/mame/drivers/sorcerer.c @@ -0,0 +1,510 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Robbbert +/****************************************************************************** + + Exidy Sorcerer system driver + + The UART controls rs232 and cassette i/o. The chip is a AY-3-1014A or AY-3-1015. + + + port fc: + ======== + input/output: + uart data + + port fd: + ======== + input: uart status + bit 4: parity error (RPE) + bit 3: framing error (RFE) + bit 2: over-run (RDP) + bit 1: data available (RDA) + bit 0: transmit buffer empty (TPMT) + + output: + bit 4: no parity (NPB) + bit 3: parity type (POE) + bit 2: number of stop bits (NSB) + bit 1: number of bits per char bit 2 (NDB2) + bit 0: number of bits per char bit 1 (NDB1) + + port fe: + ======== + + output: + + bit 7: rs232 enable (1=rs232, 0=cassette) + bit 6: baud rate (1=1200, 0=300) + bit 5: cassette motor 2 + bit 4: cassette motor 1 + bit 3..0: keyboard line select + + input: + bit 7..6: parallel control (not emulated) + 7: must be 1 to read data from parallel port via PARIN + 6: must be 1 to send data out of parallel port via PAROUT + bit 5: vsync + bit 4..0: keyboard line data + + port ff: + ======== + parallel port in/out + + ------------------------------------------------------------------------------------- + + When cassette is selected, it is connected to the uart data input via the cassette + interface hardware. + + The cassette interface hardware converts square-wave pulses into bits which the uart receives. + + 1. the cassette format: "frequency shift" is converted + into the uart data format "non-return to zero" + + 2. on cassette a 1 data bit is stored as a high frequency + and a 0 data bit as a low frequency + - At 1200 baud, a logic 1 is 1 cycle of 1200 Hz and a logic 0 is 1/2 cycle of 600 Hz. + - At 300 baud, a logic 1 is 8 cycles of 2400 Hz and a logic 0 is 4 cycles of 1200 Hz. + + Attenuation is applied to the signal and the square wave edges are rounded. + + A manchester encoder is used. A flip-flop synchronises input + data on the positive-edge of the clock pulse. + + Interestingly the data on cassette is stored in xmodem-checksum. + + + Due to bugs in the hardware and software of a real Sorcerer, the serial + interface misbehaves. + 1. Sorcerer I had a hardware problem causing rs232 idle to be a space (+9v) + instead of mark (-9v). Fixed in Sorcerer II. + 2. When you select a different baud for rs232, it was "remembered" but not + sent to port fe. It only gets sent when motor on was requested. Motor on is + only meaningful in a cassette operation. + 3. The monitor software always resets the device to cassette whenever the + keyboard is scanned, motors altered, or an error occurred. + 4. The above problems make rs232 communication impractical unless you write + your own routines or create a corrected monitor rom. + + Sound: + + External speaker connected to the parallel port. + There was a dac you could make instead, this is supported. + + + Kevin Thacker [MESS driver] + Robbbert [Various corrections and additions over the years] + + ****************************************************************************** + + The CPU clock speed is 2.106 MHz, which was increased to 4.0 MHz on the last production runs. + + The Sorcerer has a bus connection for S100 equipment. This allows the connection + of disk drives, provided that suitable driver/boot software is loaded. + +******************************************************************************* + +Real machines had optional RAM sizes of 8k, 16k, 32k, 48k (officially). +Unofficially, the cart could hold another 8k of static RAM (4x 6116), giving 56k total. + +On the back of the machine is a 50-pin expansion port, which could be hooked to the +expansion unit. + +Also is a 25-pin parallel port, allowing inwards and outwards communication. +It was often hooked to a printer, a joystick, a music card, or a speaker. + +We emulate the printer and the speaker. + +Another 25-pin port provided two-way serial communications. Only two speeds are +available - 300 baud and 1200 baud. There is no handshaking. This protocol is +currently not emulated. + +Other pins on this connector provided for two cassette players. The connections +for cassette unit 1 are duplicated on a set of phono plugs. + +We emulate the use of two cassette units. An option allows you to hear the sound +of the tape during playback. + + +******************************************************************************** + +NOTES (2011-01-09) +1. Converted to MODERN driver as much as possible. +2. Added 2 defines for work that needs doing at some time: +- SORCERER_USING_RS232 - this is for when we can connect a serial interface. +- SORCERER_USING_DISKS - the disk controller I believe most likely to be a + 'Micropolis Floppy Disk System' at 143KB on 13cm disks. + There was a hard-sector system (top of ram = BBFF), + and a soft-sector system (top of RAM = BDFF). You could + use alternate systems (since you could attach a S-100 + unit), so not sure how this could be developed. The + Micropolis seems completely undocumented in the technical + sense. When using the hard-sector system, in the monitor + enter GO BC00 to boot the disk. No idea how in other + disk systems. + + Note that the code within the defines has NOT been + compiled or tested. You are on your own! + + +NOTES (2011-08-08) +1. SORCERER_USING_DISKS removed, replaced with a new driver "sorcererd". + This is disk-enabled, allowing CP/M to run. + To initialise the disk system, you must enter + GO BC00 + after the computer has booted. It is not particularly + stable, so be prepared to cold boot whenever something + goes wrong. + +********************************************************************************/ + +#include "includes/sorcerer.h" + +static ADDRESS_MAP_START( sorcerer_mem, AS_PROGRAM, 8, sorcerer_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") + AM_RANGE(0x0800, 0xbfff) AM_RAM + //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslot + AM_RANGE(0xe000, 0xefff) AM_ROM /* rom pac and bios */ + AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_REGION("maincpu", 0xf000) /* screen ram */ + AM_RANGE(0xf800, 0xfbff) AM_ROM /* char rom */ + AM_RANGE(0xfc00, 0xffff) AM_RAM AM_REGION("maincpu", 0xfc00) /* programmable chars */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sorcererd_mem, AS_PROGRAM, 8, sorcerer_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") + AM_RANGE(0x0800, 0xbbff) AM_RAM + AM_RANGE(0xbc00, 0xbcff) AM_ROM + AM_RANGE(0xbe00, 0xbe03) AM_DEVREADWRITE("fdc", micropolis_device, read, write) + //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslot + AM_RANGE(0xe000, 0xefff) AM_ROM /* rom pac and bios */ + AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_REGION("maincpu", 0xf000) /* screen ram */ + AM_RANGE(0xf800, 0xfbff) AM_ROM /* char rom */ + AM_RANGE(0xfc00, 0xffff) AM_RAM AM_REGION("maincpu", 0xfc00) /* programmable chars */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sorcerer_io, AS_IO, 8, sorcerer_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xfc, 0xfc) AM_READWRITE( sorcerer_fc_r, sorcerer_fc_w ) + AM_RANGE(0xfd, 0xfd) AM_READWRITE( sorcerer_fd_r, sorcerer_fd_w ) + AM_RANGE(0xfe, 0xfe) AM_READWRITE( sorcerer_fe_r, sorcerer_fe_w ) + AM_RANGE(0xff, 0xff) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE(0xff, 0xff) AM_WRITE( sorcerer_ff_w ) +ADDRESS_MAP_END + +static INPUT_PORTS_START(sorcerer) + PORT_START("VS") + /* vblank */ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_VBLANK("screen") + + /* line 0 */ + PORT_START("X.0") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graphic") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + /* line 1 */ + PORT_START("X.1") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Sel)") PORT_CODE(KEYCODE_F2) PORT_CHAR(27) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Skip") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_F5) PORT_CHAR(12) + /* line 2 */ + PORT_START("X.2") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(0x11) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(0x01) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(0x1a) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(0x18) + /* line 3 */ + PORT_START("X.3") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(0x17) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(0x13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(0x04) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(0x03) + /* line 4 */ + PORT_START("X.4") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(0x05) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(0x12) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(0x06) + /* line 5 */ + PORT_START("X.5") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(0x14) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(0x07) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(0x16) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(0x02) + /* line 6 */ + PORT_START("X.6") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(0x19) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(0x08) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(0x0e) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(0x0d) + /* line 7 */ + PORT_START("X.7") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(0x15) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(0x0a) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(0x09) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(0x0b) + /* line 8 */ + PORT_START("X.8") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(0x0f) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(0x0c) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + /* line 9 */ + PORT_START("X.9") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(0x10) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + /* line 10 */ + PORT_START("X.10") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_F7) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + /* line 11 */ + PORT_START("X.11") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F6) PORT_CHAR(10) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_ Rub") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') PORT_CHAR(8) + /* line 12 */ + PORT_START("X.12") + PORT_BIT(0x10, 0x10, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + /* line 13 */ + PORT_START("X.13") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + /* line 14 */ + PORT_START("X.14") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + /* line 15 */ + PORT_START("X.15") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= (PAD)") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT(0x04, 0x04, IPT_UNUSED) + PORT_BIT(0x02, 0x02, IPT_UNUSED) + PORT_BIT(0x01, 0x01, IPT_UNUSED) + + /* Enhanced options not available on real hardware */ + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") + PORT_CONFSETTING( 0x00, DEF_STR(No)) + PORT_CONFSETTING( 0x01, DEF_STR(Yes)) + /* hardware connected to printer port */ + PORT_CONFNAME( 0x02, 0x02, "Parallel port" ) + PORT_CONFSETTING( 0x00, "7-bit" ) + PORT_CONFSETTING( 0x02, "8-bit" ) + PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") + PORT_CONFSETTING( 0x08, DEF_STR(On)) + PORT_CONFSETTING( 0x00, DEF_STR(Off)) +INPUT_PORTS_END + +/**************************** F4 CHARACTER DISPLAYER ******************************************************/ + +static const gfx_layout sorcerer_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +/* This will show the 128 characters in the ROM + whatever happens to be in the PCG */ +static GFXDECODE_START( sorcerer ) + GFXDECODE_ENTRY( "maincpu", 0xf800, sorcerer_charlayout, 0, 1 ) +GFXDECODE_END + +void sorcerer_state::video_start() +{ + m_p_videoram = memregion("maincpu")->base()+0xf000; +} + +UINT32 sorcerer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0x80,x; + UINT16 *p; + + for (y = 0; y < 30; y++) + { + for (ra = 0; ra < 8; ra++) + { + p = &bitmap.pix16(sy++); + + for (x = ma; x < ma+64; x++) + { + chr = m_p_videoram[x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_videoram[0x800 | (chr<<3) | ra]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} + + +/**********************************************************************************************************/ + +static const floppy_interface sorcerer_floppy_interface = +{ + FLOPPY_STANDARD_8_SSSD, + LEGACY_FLOPPY_OPTIONS_NAME(sorcerer), + "floppy_8" +}; + + +static MACHINE_CONFIG_START( sorcerer, sorcerer_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 12638000/6) + MCFG_CPU_PROGRAM_MAP(sorcerer_mem) + MCFG_CPU_IO_MAP(sorcerer_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(200)) + MCFG_SCREEN_SIZE(64*8, 30*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 30*8-1) + MCFG_SCREEN_UPDATE_DRIVER(sorcerer_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", sorcerer) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // cass1 speaker + MCFG_SOUND_WAVE_ADD(WAVE2_TAG, "cassette2") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // cass2 speaker + + MCFG_DEVICE_ADD( "uart", AY31015, 0 ) + MCFG_AY31015_TX_CLOCK(4800.0) + MCFG_AY31015_RX_CLOCK(4800.0) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "covox") + + /* The use of the parallel port as a general purpose port is not emulated. + Currently the only use is to read the printer status in the Centronics CENDRV bios routine. */ + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) + + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + /* quickload */ + MCFG_SNAPSHOT_ADD("snapshot", sorcerer_state, sorcerer, "snp", 2) + MCFG_QUICKLOAD_ADD("quickload", sorcerer_state, sorcerer, "bin", 3) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(sorcerer_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("sorcerer_cass") + + MCFG_CASSETTE_ADD( "cassette2" ) + MCFG_CASSETTE_FORMATS(sorcerer_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("sorcerer_cass") + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "sorcerer_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","sorcerer_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list","sorcerer_cass") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") + MCFG_RAM_EXTRA_OPTIONS("8K,16K,32K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sorcererd, sorcerer ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(sorcererd_mem) + + MCFG_MACHINE_START_OVERRIDE(sorcerer_state, sorcererd ) + + MCFG_DEVICE_ADD("fdc", MICROPOLIS, 0) + MCFG_MICROPOLIS_DEFAULT_DRIVE4_TAGS + + MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(sorcerer_floppy_interface) + MCFG_SOFTWARE_LIST_ADD("flop_list","sorcerer_flop") +MACHINE_CONFIG_END + + +DRIVER_INIT_MEMBER(sorcerer_state, sorcerer) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000); +} + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ +ROM_START(sorcerer) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("exmo1-1.dat", 0xe000, 0x0800, CRC(ac924f67) SHA1(72fcad6dd1ed5ec0527f967604401284d0e4b6a1) ) /* monitor roms */ + ROM_LOAD("exmo1-2.dat", 0xe800, 0x0800, CRC(ead1d0f6) SHA1(c68bed7344091bca135e427b4793cc7d49ca01be) ) + ROM_LOAD("exchr-1.dat", 0xf800, 0x0400, CRC(4a7e1cdd) SHA1(2bf07a59c506b6e0c01ec721fb7b747b20f5dced) ) /* char rom */ +ROM_END + +ROM_START(sorcererd) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("diskboot.dat",0xbc00, 0x0100, CRC(d82a40d6) SHA1(cd1ef5fb0312cd1640e0853d2442d7d858bc3e3b) ) + ROM_LOAD("exmo1-1.dat", 0xe000, 0x0800, CRC(ac924f67) SHA1(72fcad6dd1ed5ec0527f967604401284d0e4b6a1) ) /* monitor roms */ + ROM_LOAD("exmo1-2.dat", 0xe800, 0x0800, CRC(ead1d0f6) SHA1(c68bed7344091bca135e427b4793cc7d49ca01be) ) + ROM_LOAD("exchr-1.dat", 0xf800, 0x0400, CRC(4a7e1cdd) SHA1(2bf07a59c506b6e0c01ec721fb7b747b20f5dced) ) /* char rom */ + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD_OPTIONAL("bruce.dat", 0x0000, 0x0020, CRC(fae922cb) SHA1(470a86844cfeab0d9282242e03ff1d8a1b2238d1) ) /* video prom */ +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP(1979, sorcerer, 0, 0, sorcerer, sorcerer, sorcerer_state, sorcerer, "Exidy Inc", "Sorcerer", 0 ) +COMP(1979, sorcererd, sorcerer, 0, sorcererd, sorcerer, sorcerer_state, sorcerer, "Exidy Inc", "Sorcerer (with floppy disks)", 0 ) diff --git a/src/mame/drivers/spc1000.c b/src/mame/drivers/spc1000.c new file mode 100644 index 00000000000..e69561163c6 --- /dev/null +++ b/src/mame/drivers/spc1000.c @@ -0,0 +1,522 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + +Samsung SPC-1000 driver by Miodrag Milanovic + + 2009-05-10 Preliminary driver. + 2014-02-16 Added cassette, many games are playable + +ToDo: +- Find out if any of the unconnected parts of 6000,4000,4001 are used + + +NOTE: 2014-09-13: added code from someone's modified MESS driver for floppy + disk. Since it is not to our coding standards, it is + commented out with #if 0/#endif and 3 slashes (///). + It is planned to be converted when time permits. The + author is Meeso Kim. + + Hardware details of the fdc: Intelligent device, Z80 CPU, + XTAL_8MHz, PPI 8255, FDC uPD765C, 2 RAM chips, 28 other + small ics. And of course, no schematic. + + +2014-10-11: Replaced above code with MESS-compliant code [Meeso Kim] + +2015-06-19: Added code for the centronics printer port + +IMPORTANT NOTE for tape usage: you *FIRST* press PLAY on the tape drive + (e.g. by pressing F2 in partial emulated keyboard mode) and *THEN* you + type LOAD on the BASIC prompt! + Otherwise, the system turns the tape motor ON but it does not receive any + data from tape, and it turns it OFF before the user can press PLAY. + + +****************************************************************************/ +/* + * SAMSUNG SPC-1000 Series (info from zannylim) + * + * YEAR MODEL MainVideo PRT FDD + * ---- -------------- ------ ----- ------ ------- + * 1982 SPC-1000 S68047 RGB buffer - + * 1983 SPC-1000 S68047 RF-TV buffer - + * 1983 SPC-1100 S68047 RF-TV - - + * 1983 SPC-1000/1100 MC6847 RF-TV direct support + * 1985 SPC-1000A MC6847 RF-TV direct support + * + * 2nd Video Display Processor type 1 : VDP UNIT (TMS9918 + 4KB VRAM) by staticsoft + * 2nd Video Display Processor type 2 : SOFT BOX (TMS9918 + 4KB VRAM with BIOS) by sammi computer + * + * Intelligence FDD : SD-725(2FDD, RS232C), SD-720(1FDD), SD-725A(2FDD), SD-725B(Desktop 2FDD, RS232C) - EPSON TF20 F100 + * External FDD with Expansion slot : KWE-1000 by kyungwoo + * + * Network device : ISAM-1000 by samsung + * + * +---------PRT------RGB----TVRF--+ SPC-1000 + * + + + * + ROM0 + CPU : Z80A (4MHz) + * + ROM1 + RAM : 64KB + * +-------+ ROM2 AY-3-8910 + VRAM : 6KB + * + SPC-1000 + VDG : AMI S68047 with TTL RGB output + * IPL + PSG : AY-3-8910 + * RESET S68047 + + * + Z80A + Include Internal Data-recorder + * + ROM3 + + * + + ROM : 32KB (8KB x 4) + * +---------------------------------------+ + * + * +---------PRT----VIDEO----TVRF--+ SPC-1000 + * + + + * + ROM0 LM1889 + Support RF TV Support, but Removed RGB output + * + ROM1 + + * +-------+ ROM2 AY-3-8910 SPC-1000 + + * + 1100 + + * IPL + + * RESET S68047 + + * + Z80A + + * + ROM3 + + * + + + * +---------------------------------------+ + * + * +----------------VIDEO----TVRF--+ SPC-1100 + * + + + * + ROM0 LM1889 + Removed Printer port + * + ROM1 LM386(5V) + + * +-------+ ROM2 AY-3-8910 SPC-1000 + + * + 1100 + + * IPL + + * RESET S68047 + + * + Z80A + + * + ROM3 + + * + + + * +---------------------------------------+ + * + * +---------PRT----VIDEO----TVRF--+ SPC-1000, SPC-1100 + * + + + * + ROM0 MC1372 + New Video Display Generator : MC6847 + * + ROM1 LM386(5V) + + * +-------+ ROM2 AY-3-8910 + + * + ROM3 SPC-1000/1100 + + * IPL + + * RESET MC6847 + + * + Z80A + + * + + + * + + + * +---------------------------------------+ + * + * +---------PRT----VIDEO----TVRF--+ SPC-1000, SPC-1100 + * + + + * + ROM0 S4 MC1372 + REV PCB No.839291 + * + ROM1 LM386(5V) + + * +-------+ ROM2 AY-3-8910 + Add composite color on/off switch + * + ROM3 SPC-1000/1100 + + * IPL + + * RESET MC6847 + + * + Z80A + + * + + + * + + + * +---------------------------------------+ + * + * +---------PRT----VIDEO----TVRF--+ SPC-1000A + * + + + * + ROM0 S4 MC1372 + Internal Data-recorder with Cassette Audio Player + * + ROM1 LM386(12V) + Add FDD auto detect + * +-------+ ROM2 AY-3-8910 + Remove IPL button + * + SPC-1000A ROM3 + Change DRAM refresh circuit + * IPL + Use 64K DRAM made by Samsung + * + MC6847 + Use TTL IC made by Goldstar + * + Z80A + + * + + + * + + + * +---------------------------------------+ + * + */ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "sound/ay8910.h" +#include "sound/wave.h" +#include "video/mc6847.h" +#include "imagedev/cassette.h" +#include "formats/spc1000_cas.h" +#include "bus/centronics/ctronics.h" + +#include "bus/spc1000/exp.h" +#include "bus/spc1000/fdd.h" +#include "bus/spc1000/vdp.h" + + +class spc1000_state : public driver_device +{ +public: + spc1000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_motor(false) + , m_maincpu(*this, "maincpu") + , m_vdg(*this, "mc6847") + , m_cass(*this, "cassette") + , m_ram(*this, RAM_TAG) + , m_p_videoram(*this, "videoram") + , m_io_kb(*this, "LINE") + , m_io_joy(*this, "JOY") + , m_centronics(*this, "centronics") + {} + + DECLARE_WRITE8_MEMBER(iplk_w); + DECLARE_READ8_MEMBER(iplk_r); + DECLARE_WRITE_LINE_MEMBER(irq_w); + DECLARE_WRITE8_MEMBER(gmode_w); + DECLARE_READ8_MEMBER(gmode_r); + DECLARE_READ8_MEMBER(porta_r); + DECLARE_WRITE_LINE_MEMBER( centronics_busy_w ) { m_centronics_busy = state; } + DECLARE_READ8_MEMBER(mc6847_videoram_r); + DECLARE_WRITE8_MEMBER(cass_w); + DECLARE_READ8_MEMBER(keyboard_r); + MC6847_GET_CHARROM_MEMBER(get_char_rom) + { + return m_p_videoram[0x1000 + (ch & 0x7f) * 16 + line]; + } + +private: + UINT8 m_IPLK; + UINT8 m_GMODE; + UINT16 m_page; + UINT8 *m_work_ram; + bool m_motor; + bool m_centronics_busy; + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_vdg; + required_device m_cass; + required_device m_ram; + required_shared_ptr m_p_videoram; + required_ioport_array<10> m_io_kb; + required_ioport m_io_joy; + required_device m_centronics; +}; + +static ADDRESS_MAP_START(spc1000_mem, AS_PROGRAM, 8, spc1000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") + AM_RANGE(0x8000, 0xffff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4") +ADDRESS_MAP_END + +WRITE8_MEMBER(spc1000_state::iplk_w) +{ + m_IPLK = m_IPLK ? 0 : 1; + membank("bank1")->set_entry(m_IPLK); + membank("bank3")->set_entry(m_IPLK); +} + +READ8_MEMBER(spc1000_state::iplk_r) +{ + m_IPLK = m_IPLK ? 0 : 1; + membank("bank1")->set_entry(m_IPLK); + membank("bank3")->set_entry(m_IPLK); + + return 0; +} + +WRITE8_MEMBER( spc1000_state::cass_w ) +{ + bool m = BIT(data, 1) ? true : false; + m_cass->output(BIT(data, 0) ? -1.0 : 1.0); + if (m && !m_motor) + m_cass->change_state(m_cass->get_state() & CASSETTE_MASK_MOTOR ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_motor = m; + m_centronics->write_strobe(BIT(data, 2) ? true : false); +} + +WRITE8_MEMBER(spc1000_state::gmode_w) +{ + m_GMODE = data; + + // m_GMODE layout: CSS|NA|PS2|PS1|~A/G|GM0|GM1|NA + // [PS2,PS1] is used to set screen 0/1 pages + m_vdg->gm1_w(BIT(data, 1)); + m_vdg->gm0_w(BIT(data, 2)); + m_vdg->ag_w(BIT(data, 3)); + m_vdg->css_w(BIT(data, 7)); + m_page = ((BIT(data, 5) << 1) | BIT(data, 4)) * 0x200; +} + +READ8_MEMBER(spc1000_state::gmode_r) +{ + return m_GMODE; +} + +READ8_MEMBER( spc1000_state::keyboard_r ) +{ + // most games just read kb in $8000-$8009 but a few of them + // (e.g. Toiler Adventure II and Vela) use mirrored addr instead + offset &= 0xf; + + if (offset <= 9) + return m_io_kb[offset]->read(); + else + return 0xff; +} + + +static ADDRESS_MAP_START( spc1000_io , AS_IO, 8, spc1000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x2000, 0x3fff) AM_READWRITE(gmode_r, gmode_w) + AM_RANGE(0x4000, 0x4000) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0x4001, 0x4001) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) + AM_RANGE(0x6000, 0x6000) AM_WRITE(cass_w) + AM_RANGE(0x8000, 0x9fff) AM_READ(keyboard_r) + AM_RANGE(0xa000, 0xa000) AM_READWRITE(iplk_r, iplk_w) + AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE("ext1", spc1000_exp_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( spc1000 ) + PORT_START("LINE.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_RCONTROL) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_PAUSE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x16) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("LINE.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + + PORT_START("LINE.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(0x12) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START("LINE.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + + PORT_START("LINE.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START("LINE.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + + PORT_START("LINE.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START("LINE.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + + PORT_START("LINE.9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START) PORT_NAME("IPL") PORT_CODE(KEYCODE_END) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0e) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START("JOY") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) // Button 2? + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) // Cassette related +INPUT_PORTS_END + + +void spc1000_state::machine_start() +{ + UINT8 *mem = memregion("maincpu")->base(); + UINT8 *ram = m_ram->pointer(); + + // configure and intialize banks 1 & 3 (read banks) + membank("bank1")->configure_entry(0, ram); + membank("bank1")->configure_entry(1, mem); + membank("bank3")->configure_entry(0, ram + 0x8000); + membank("bank3")->configure_entry(1, mem); + membank("bank1")->set_entry(1); + membank("bank3")->set_entry(1); + + // intialize banks 2 & 4 (write banks) + membank("bank2")->set_base(ram); + membank("bank4")->set_base(ram + 0x8000); +} + +void spc1000_state::machine_reset() +{ + m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); + m_IPLK = 1; + m_motor = false; +} + +READ8_MEMBER(spc1000_state::mc6847_videoram_r) +{ + if (offset == ~0) + return 0xff; + + // m_GMODE layout: CSS|NA|PS2|PS1|~A/G|GM0|GM1|NA + if (!BIT(m_GMODE, 3)) + { // text mode (~A/G set to A) + UINT8 data = m_p_videoram[offset + m_page + 0x800]; + m_vdg->inv_w(BIT(data, 0)); + m_vdg->css_w(BIT(data, 1)); + m_vdg->as_w (BIT(data, 2)); + m_vdg->intext_w(BIT(data, 3)); + return m_p_videoram[offset + m_page]; + } + else + { // graphics mode: uses full 6KB of VRAM + return m_p_videoram[offset]; + } +} + +READ8_MEMBER( spc1000_state::porta_r ) +{ + UINT8 data = 0x3f; + data |= (m_cass->input() > 0.0038) ? 0x80 : 0; + data |= ((m_cass->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED) && ((m_cass->get_state() & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED) ? 0x00 : 0x40; + data &= ~(m_io_joy->read() & 0x3f); + data &= ~((m_centronics_busy == 0)<< 5); + return data; +} + +// irq is inverted in emulation, so we need this trampoline +WRITE_LINE_MEMBER( spc1000_state::irq_w ) +{ + m_maincpu->set_input_line(0, state ? CLEAR_LINE : HOLD_LINE); +} + +//------------------------------------------------- +// address maps +//------------------------------------------------- + +extern SLOT_INTERFACE_START(spc1000_exp) + SLOT_INTERFACE("fdd", SPC1000_FDD_EXP) + SLOT_INTERFACE("vdp", SPC1000_VDP_EXP) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( spc1000, spc1000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(spc1000_mem) + MCFG_CPU_IO_MAP(spc1000_io) + + /* video hardware */ + MCFG_SCREEN_MC6847_NTSC_ADD("screen", "mc6847") + + MCFG_DEVICE_ADD("mc6847", MC6847_NTSC, XTAL_3_579545MHz) + MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(spc1000_state, irq_w)) + MCFG_MC6847_INPUT_CALLBACK(READ8(spc1000_state, mc6847_videoram_r)) + MCFG_MC6847_CHARROM_CALLBACK(spc1000_state, get_char_rom) + MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM2) + // other lines not connected + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_4MHz / 1) + MCFG_AY8910_PORT_A_READ_CB(READ8(spc1000_state, porta_r)) + MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_DEVICE_ADD("ext1", SPC1000_EXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(spc1000_exp, NULL, false) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(spc1000_state, centronics_busy_w)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(spc1000_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) + + MCFG_SOFTWARE_LIST_ADD("cass_list", "spc1000_cass") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( spc1000 ) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_LOAD("spcall.rom", 0x0000, 0x8000, CRC(19638fc9) SHA1(489f1baa7aebf3c8c660325fb1fd790d84203284)) +ROM_END + +#if 0 +ROM_START( spc1000 ) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_LOAD("spcall.rom", 0x0000, 0x8000, CRC(2fbb6eca) SHA1(cc9a076b0f00d54b2aec31f1f558b10f43ef61c8)) + /// more roms to come... +ROM_END +#endif + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, spc1000, 0, 0, spc1000, spc1000, driver_device, 0, "Samsung", "SPC-1000", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/spec128.c b/src/mame/drivers/spec128.c new file mode 100644 index 00000000000..0c5161f65f4 --- /dev/null +++ b/src/mame/drivers/spec128.c @@ -0,0 +1,364 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/*************************************************************************** + + NOTE: ****** Specbusy: press N, R, or E to boot ************* + + + Spectrum/Inves/TK90X etc. memory map: + + CPU: + 0000-3fff ROM + 4000-ffff RAM + + Spectrum 128/+2/+2a/+3 memory map: + + CPU: + 0000-3fff Banked ROM/RAM (banked rom only on 128/+2) + 4000-7fff Banked RAM + 8000-bfff Banked RAM + c000-ffff Banked RAM + + TS2068 memory map: (Can't have both EXROM and DOCK active) + The 8K EXROM can be loaded into multiple pages. + + CPU: + 0000-1fff ROM / EXROM / DOCK (Cartridge) + 2000-3fff ROM / EXROM / DOCK + 4000-5fff \ + 6000-7fff \ + 8000-9fff |- RAM / EXROM / DOCK + a000-bfff | + c000-dfff / + e000-ffff / + + +Interrupts: + +Changes: + +29/1/2000 KT - Implemented initial +3 emulation. +30/1/2000 KT - Improved input port decoding for reading and therefore + correct keyboard handling for Spectrum and +3. +31/1/2000 KT - Implemented buzzer sound for Spectrum and +3. + Implementation copied from Paul Daniel's Jupiter driver. + Fixed screen display problems with dirty chars. + Added support to load .Z80 snapshots. 48k support so far. +13/2/2000 KT - Added Interface II, Kempston, Fuller and Mikrogen + joystick support. +17/2/2000 DJR - Added full key descriptions and Spectrum+ keys. + Fixed Spectrum +3 keyboard problems. +17/2/2000 KT - Added tape loading from WAV/Changed from DAC to generic + speaker code. +18/2/2000 KT - Added tape saving to WAV. +27/2/2000 KT - Took DJR's changes and added my changes. +27/2/2000 KT - Added disk image support to Spectrum +3 driver. +27/2/2000 KT - Added joystick I/O code to the Spectrum +3 I/O handler. +14/3/2000 DJR - Tape handling dipswitch. +26/3/2000 DJR - Snapshot files are now classifed as snapshots not + cartridges. +04/4/2000 DJR - Spectrum 128 / +2 Support. +13/4/2000 DJR - +4 Support (unofficial 48K hack). +13/4/2000 DJR - +2a Support (rom also used in +3 models). +13/4/2000 DJR - TK90X, TK95 and Inves support (48K clones). +21/4/2000 DJR - TS2068 and TC2048 support (TC2048 Supports extra video + modes but doesn't have bank switching or sound chip). +09/5/2000 DJR - Spectrum +2 (France, Spain), +3 (Spain). +17/5/2000 DJR - Dipswitch to enable/disable disk drives on +3 and clones. +27/6/2000 DJR - Changed 128K/+3 port decoding (sound now works in Zub 128K). +06/8/2000 DJR - Fixed +3 Floppy support +10/2/2001 KT - Re-arranged code and split into each model emulated. + Code is split into 48k, 128k, +3, tc2048 and ts2048 + segments. 128k uses some of the functions in 48k, +3 + uses some functions in 128, and tc2048/ts2048 use some + of the functions in 48k. The code has been arranged so + these functions come in some kind of "override" order, + read functions changed to use READ8_HANDLER and write + functions changed to use WRITE8_HANDLER. + Added Scorpion256 preliminary. +18/6/2001 DJR - Added support for Interface 2 cartridges. +xx/xx/2001 KS - TS-2068 sound fixed. + Added support for DOCK cartridges for TS-2068. + Added Spectrum 48k Psycho modified rom driver. + Added UK-2086 driver. +23/12/2001 KS - 48k machines are now able to run code in screen memory. + Programs which keep their code in screen memory + like monitors, tape copiers, decrunchers, etc. + works now. + Fixed problem with interrupt vector set to 0xffff (much + more 128k games works now). + A useful used trick on the Spectrum is to set + interrupt vector to 0xffff (using the table + which contain 0xff's) and put a byte 0x18 hex, + the opcode for JR, at this address. The first + byte of the ROM is a 0xf3 (DI), so the JR will + jump to 0xfff4, where a long JP to the actual + interrupt routine is put. Due to unideal + bankswitching in MAME this JP were to 0001 what + causes Spectrum to reset. Fixing this problem + made much more software runing (i.e. Paperboy). + Corrected frames per second value for 48k and 128k + Sinclair machines. + There are 50.08 frames per second for Spectrum + 48k what gives 69888 cycles for each frame and + 50.021 for Spectrum 128/+2/+2A/+3 what gives + 70908 cycles for each frame. + Remapped some Spectrum+ keys. + Pressing F3 to reset was seting 0xf7 on keyboard + input port. Problem occurred for snapshots of + some programms where it was readed as pressing + key 4 (which is exit in Tapecopy by R. Dannhoefer + for example). + Added support to load .SP snapshots. + Added .BLK tape images support. + .BLK files are identical to .TAP ones, extension + is an only difference. +08/03/2002 KS - #FF port emulation added. + Arkanoid works now, but is not playable due to + completly messed timings. + +Initialisation values used when determining which model is being emulated: + 48K Spectrum doesn't use either port. + 128K/+2 Bank switches with port 7ffd only. + +3/+2a Bank switches with both ports. + +Notes: + 1. No contented memory. + 2. No hi-res colour effects (need contended memory first for accurate timing). + 3. Multiface 1 and Interface 1 not supported. + 4. Horace and the Spiders cartridge doesn't run properly. + 5. Tape images not supported: + .TZX, .SPC, .ITM, .PAN, .TAP(Warajevo), .VOC, .ZXS. + 6. Snapshot images not supported: + .ACH, .PRG, .RAW, .SEM, .SIT, .SNX, .ZX, .ZXS, .ZX82. + 7. 128K emulation is not perfect - the 128K machines crash and hang while + running quite a lot of games. + 8. Disk errors occur on some +3 games. + 9. Video hardware of all machines is timed incorrectly. +10. EXROM and HOME cartridges are not emulated. +11. The TK90X and TK95 roms output 0 to port #df on start up. +12. The purpose of this port is unknown (probably display mode as TS2068) and + thus is not emulated. + +Very detailed infos about the ZX Spectrum +3e can be found at + +http://www.z88forever.org.uk/zxplus3e/ + + +The hc2000 corrupts its memory, especially if you type something, and the +resulting mess can be seen in the F4 viewer display. + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "includes/spectrum.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/ay8910.h" +#include "sound/speaker.h" +#include "formats/tzx_cas.h" +#include "machine/ram.h" + +/****************************************************************************************************/ +/* Spectrum 128 specific functions */ + +WRITE8_MEMBER(spectrum_state::spectrum_128_port_7ffd_w) +{ + /* D0-D2: RAM page located at 0x0c000-0x0ffff */ + /* D3 - Screen select (screen 0 in ram page 5, screen 1 in ram page 7 */ + /* D4 - ROM select - which rom paged into 0x0000-0x03fff */ + /* D5 - Disable paging */ + + /* disable paging? */ + if (m_port_7ffd_data & 0x20) + return; + + if ((m_port_7ffd_data ^ data) & 0x08) + spectrum_UpdateScreenBitmap(); + + /* store new state */ + m_port_7ffd_data = data; + + /* update memory */ + spectrum_128_update_memory(); +} + +void spectrum_state::spectrum_128_update_memory() +{ + UINT8 *messram = m_ram->pointer(); + + /* select ram at 0x0c000-0x0ffff */ + int ram_page = m_port_7ffd_data & 0x07; + unsigned char *ram_data = messram + (ram_page<<14); + membank("bank4")->set_base(ram_data); + + if (BIT(m_port_7ffd_data, 3)) + m_screen_location = messram + (7<<14); + else + m_screen_location = messram + (5<<14); + + if (!m_cart->exists()) + { + /* ROM switching */ + int ROMSelection = BIT(m_port_7ffd_data, 4); + + /* rom 0 is 128K rom, rom 1 is 48 BASIC */ + unsigned char *ChosenROM = memregion("maincpu")->base() + 0x010000 + (ROMSelection << 14); + + membank("bank1")->set_base(ChosenROM); + } +} + +READ8_MEMBER( spectrum_state::spectrum_128_ula_r ) +{ + int vpos = machine().first_screen()->vpos(); + + return vpos<193 ? m_screen_location[0x1800|(vpos&0xf8)<<2]:0xff; +} + +static ADDRESS_MAP_START (spectrum_128_io, AS_IO, 8, spectrum_state ) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) + AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) + AM_RANGE(0x007f, 0x007f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) + AM_RANGE(0x00df, 0x00df) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) + AM_RANGE(0x0000, 0x0000) AM_WRITE(spectrum_128_port_7ffd_w) AM_MIRROR(0x7ffd) // (A15 | A1) == 0, note: reading from this port does write to it by value from data bus + AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3ffd) + AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd) + AM_RANGE(0x0001, 0x0001) AM_READ(spectrum_128_ula_r) AM_MIRROR(0xfffe) +ADDRESS_MAP_END + +static ADDRESS_MAP_START (spectrum_128_mem, AS_PROGRAM, 8, spectrum_state ) + AM_RANGE( 0x0000, 0x3fff) AM_ROMBANK("bank1") // don't use RAMBANK here otherwise programs can erase the ROM(!) + AM_RANGE( 0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE( 0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE( 0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +MACHINE_RESET_MEMBER(spectrum_state,spectrum_128) +{ + UINT8 *messram = m_ram->pointer(); + + memset(messram,0,128*1024); + /* 0x0000-0x3fff always holds ROM */ + + /* Bank 5 is always in 0x4000 - 0x7fff */ + membank("bank2")->set_base(messram + (5<<14)); + + /* Bank 2 is always in 0x8000 - 0xbfff */ + membank("bank3")->set_base(messram + (2<<14)); + + MACHINE_RESET_CALL_MEMBER(spectrum); + + /* set initial ram config */ + m_port_7ffd_data = 0; + m_port_1ffd_data = -1; + spectrum_128_update_memory(); +} + +/* F4 Character Displayer */ +static const gfx_layout spectrum_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 96, /* 96 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( spec128 ) + GFXDECODE_ENTRY( "maincpu", 0x17d00, spectrum_charlayout, 0, 8 ) +GFXDECODE_END + + +MACHINE_CONFIG_DERIVED( spectrum_128, spectrum ) + + MCFG_DEVICE_REMOVE("maincpu") + + MCFG_CPU_ADD("maincpu", Z80, X1_128_SINCLAIR / 5) + MCFG_CPU_PROGRAM_MAP(spectrum_128_mem) + MCFG_CPU_IO_MAP(spectrum_128_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", spectrum_state, spec_interrupt) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, spectrum_128 ) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_RAW_PARAMS(X1_128_SINCLAIR / 2.5f, 456, 0, 352, 311, 0, 296) + + MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum_128 ) + MCFG_GFXDECODE_MODIFY("gfxdecode", spec128) + + /* sound hardware */ + MCFG_SOUND_ADD("ay8912", AY8912, 1773400) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + + +ROM_START(spec128) + ROM_REGION(0x18000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "en", "English" ) + ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(1)) + ROMX_LOAD("zx128_1.rom",0x14000,0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) + ROMX_LOAD("zx128s0.rom",0x10000,0x4000, CRC(453d86b2) SHA1(968937b1c750f0ef6205f01c6db4148da4cca4e3), ROM_BIOS(2)) + ROMX_LOAD("zx128s1.rom",0x14000,0x4000, CRC(6010e796) SHA1(bea3f397cc705eafee995ea629f4a82550562f90), ROM_BIOS(2)) +ROM_END + +ROM_START(specpls2) + ROM_REGION(0x18000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "en", "English" ) + ROMX_LOAD("zxp2_0.rom",0x10000,0x4000, CRC(5d2e8c66) SHA1(72703f9a3e734f3c23ec34c0727aae4ccbef9a91), ROM_BIOS(1)) + ROMX_LOAD("zxp2_1.rom",0x14000,0x4000, CRC(98b1320b) SHA1(de8b0d2d0379cfe7c39322a086ca6da68c7f23cb), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "fr", "French" ) + ROMX_LOAD("plus2fr0.rom",0x10000,0x4000, CRC(c684c535) SHA1(56684c4c85a616e726a50707483b9a42d8e724ed), ROM_BIOS(2)) + ROMX_LOAD("plus2fr1.rom",0x14000,0x4000, CRC(f5e509c5) SHA1(7e398f62689c9d90a36d3a101351ec9987207308), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "sp", "Spanish" ) + ROMX_LOAD("plus2sp0.rom",0x10000,0x4000, CRC(e807d06e) SHA1(8259241b28ff85441f1bedc2bee53445767c51c5), ROM_BIOS(3)) + ROMX_LOAD("plus2sp1.rom",0x14000,0x4000, CRC(41981d4b) SHA1(ec0d5a158842d20601b4fbeaefc6668db979d0e1), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "ao", "ZX Spectrum +2c (Andrew Owen)" ) + ROMX_LOAD("plus2c-0.rom",0x10000,0x4000, CRC(bfddf748) SHA1(3eba870bcb2c5efa906f2ca3febe960fc35d66bb), ROM_BIOS(4)) + ROMX_LOAD("plus2c-1.rom",0x14000,0x4000, CRC(fd8552b6) SHA1(5ffcf79f2154ba2cf42cc1d9cb4be93cb5043e73), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "namco", "ZX Spectrum +2c (Namco)" ) + ROMX_LOAD("pl2namco.rom",0x10000,0x8000, CRC(72a54e75) SHA1(311400157df689450dadc3620f4c4afa960b05ad), ROM_BIOS(5)) +ROM_END + +ROM_START(hc128) + ROM_REGION(0x18000,"maincpu",0) + ROM_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5)) + ROM_LOAD("hc128.rom", 0x14000,0x4000, CRC(0241e960) SHA1(cea0d14391b9e571460a816088a1c00ecb24afa3)) +ROM_END + +ROM_START(hc2000) + ROM_REGION(0x18000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) + ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(1)) + ROMX_LOAD("hc2000.v1", 0x14000,0x4000, CRC(453c1a5a) SHA1(f8139fc38478691cf44944dc83fd6e70b0f002fb), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) + ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(2)) + ROMX_LOAD("hc2000.v2", 0x14000,0x4000, CRC(65d90464) SHA1(5e2096e6460ff2120c8ada97579fdf82c1199c09), ROM_BIOS(2)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1986, spec128, 0, 0, spectrum_128, spec_plus, driver_device, 0, "Sinclair Research Ltd", "ZX Spectrum 128" , 0 ) +COMP( 1986, specpls2, spec128, 0, spectrum_128, spec_plus, driver_device, 0, "Amstrad plc", "ZX Spectrum +2" , 0 ) +COMP( 1991, hc128, spec128, 0, spectrum_128, spec_plus, driver_device, 0, "ICE-Felix", "HC-128" , 0 ) +COMP( 1992, hc2000, spec128, 0, spectrum_128, spec_plus, driver_device, 0, "ICE-Felix", "HC-2000" , MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/special.c b/src/mame/drivers/special.c new file mode 100644 index 00000000000..fa5c6943602 --- /dev/null +++ b/src/mame/drivers/special.c @@ -0,0 +1,599 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Specialist driver by Miodrag Milanovic + + 2008-03-15 Preliminary driver. + 2008-03-20 Cassette support + +****************************************************************************/ + + +#include "includes/special.h" + + +/* Address maps */ +static ADDRESS_MAP_START(specialist_mem, AS_PROGRAM, 8, special_state ) + AM_RANGE( 0x0000, 0x2fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x3000, 0x8fff ) AM_RAM // RAM + AM_RANGE( 0x9000, 0xbfff ) AM_RAM AM_SHARE("p_videoram") // Video RAM + AM_RANGE( 0xc000, 0xefff ) AM_ROM // System ROM + AM_RANGE( 0xf800, 0xf803 ) AM_MIRROR(0x7fc) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(specialp_mem, AS_PROGRAM, 8, special_state ) + AM_RANGE( 0x0000, 0x2fff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x3000, 0x7fff ) AM_RAM // RAM + AM_RANGE( 0x8000, 0xbfff ) AM_RAM AM_SHARE("p_videoram") // Video RAM + AM_RANGE( 0xc000, 0xefff ) AM_ROM // System ROM + AM_RANGE( 0xf800, 0xf803 ) AM_MIRROR(0x7fc) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(erik_mem, AS_PROGRAM, 8, special_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x4000, 0x8fff ) AM_RAMBANK("bank2") + AM_RANGE( 0x9000, 0xbfff ) AM_RAMBANK("bank3") + AM_RANGE( 0xc000, 0xefff ) AM_RAMBANK("bank4") + AM_RANGE( 0xf000, 0xf7ff ) AM_RAMBANK("bank5") + AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank6") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( erik_io_map, AS_IO, 8, special_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf1, 0xf1) AM_READWRITE(erik_rr_reg_r, erik_rr_reg_w) + AM_RANGE(0xf2, 0xf2) AM_READWRITE(erik_rc_reg_r, erik_rc_reg_w) + AM_RANGE(0xf3, 0xf3) AM_READWRITE(erik_disk_reg_r, erik_disk_reg_w) + AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("fd1793", fd1793_t, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(specimx_mem, AS_PROGRAM, 8, special_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x8fff ) AM_RAMBANK("bank1") + AM_RANGE( 0x9000, 0xbfff ) AM_RAMBANK("bank2") + AM_RANGE( 0xc000, 0xffbf ) AM_RAMBANK("bank3") + AM_RANGE( 0xffc0, 0xffdf ) AM_RAMBANK("bank4") + AM_RANGE( 0xffe0, 0xffe3 ) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) + AM_RANGE( 0xffe4, 0xffe7 ) AM_RAM //external 8255 + AM_RANGE( 0xffe8, 0xffeb ) AM_DEVREADWRITE("fd1793", fd1793_t, read, write) + AM_RANGE( 0xffec, 0xffef ) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) + AM_RANGE( 0xfff0, 0xfff3 ) AM_READWRITE(specimx_disk_ctrl_r, specimx_disk_ctrl_w) + AM_RANGE( 0xfff8, 0xfffb ) AM_READWRITE(specimx_video_color_r,specimx_video_color_w) + AM_RANGE( 0xfffc, 0xffff ) AM_WRITE(specimx_select_bank) +ADDRESS_MAP_END + +/* Input ports */ + +/* Inputs will need to be adapted when/if support for non-latin keys is added to natural keyboard: +these systems have different keys to switch among alphabets! +*/ +static INPUT_PORTS_START( special ) +/* Alt switches between Latin and Cyrillic alphabets */ + PORT_START("LINE0") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("LINE1") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('\\') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + + PORT_START("LINE2") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + + PORT_START("LINE3") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("LINE4") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + + PORT_START("LINE5") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("LINE6") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("LINE7") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("LINE8") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("LINE9") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("LINE10") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("LINE11") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lat / Cyr") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("LINE12") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + +static INPUT_PORTS_START( specialp ) + PORT_INCLUDE( special ) + + /* Shift itself switches between Latin and Cyrillic alphabets */ + PORT_MODIFY("LINE0") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR('_') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') + + PORT_MODIFY("LINE11") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) +INPUT_PORTS_END + +static INPUT_PORTS_START( lik ) + PORT_INCLUDE( special ) + + /* 2009-05 FP: Shift + Numbers produces still numbers: does it work differently outside monitor? */ + PORT_MODIFY("LINE0") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_MODIFY("LINE2") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')// PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9')// PORT_CHAR(')') + + PORT_MODIFY("LINE3") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8')// PORT_CHAR('(') + + PORT_MODIFY("LINE4") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7')// PORT_CHAR('\'') + + PORT_MODIFY("LINE5") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6')// PORT_CHAR('&') + + PORT_MODIFY("LINE6") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5')// PORT_CHAR('%') + + PORT_MODIFY("LINE7") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4')// PORT_CHAR('$') + + PORT_MODIFY("LINE8") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3')// PORT_CHAR('#') + + PORT_MODIFY("LINE9") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2')// PORT_CHAR('"') + + PORT_MODIFY("LINE10") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1')// PORT_CHAR('!') +INPUT_PORTS_END + + +static INPUT_PORTS_START( specimx ) +/* Alt switches between Latin and Cyrillic alphabets */ + PORT_START("LINE0") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("LINE1") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("LINE2") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("LINE3") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("LINE4") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("LINE5") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("LINE6") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("LINE7") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("LINE8") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("LINE9") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("LINE10") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + + PORT_START("LINE11") + PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("LINE12") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + +FLOPPY_FORMATS_MEMBER( special_state::specimx_floppy_formats ) + FLOPPY_SMX_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( specimx_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +/* Machine driver */ +static MACHINE_CONFIG_START( special, special_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(specialist_mem) + MCFG_MACHINE_RESET_OVERRIDE(special_state, special ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(384, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) + MCFG_VIDEO_START_OVERRIDE(special_state,special) + MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_special) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(special_state, specialist_8255_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(special_state, specialist_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(special_state, specialist_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(special_state, specialist_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rks_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("special_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","special_cass") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( specialp, special ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(specialp_mem) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_specialp) + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_VIDEO_START_OVERRIDE(special_state,specialp) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( specialm, special ) + MCFG_DEVICE_REMOVE("ppi8255") + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(special_state, specialist_8255_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(special_state, specialist_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(special_state, specimx_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(special_state, specialist_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( specimx, special ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(specimx_mem) + + MCFG_MACHINE_START_OVERRIDE (special_state, specimx ) + MCFG_MACHINE_RESET_OVERRIDE (special_state, specimx ) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_specimx) + MCFG_VIDEO_START_OVERRIDE(special_state,specimx) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(16) + MCFG_PALETTE_INIT_OWNER(special_state, specimx ) + + /* audio hardware */ + MCFG_SOUND_ADD("custom", SPECIMX_SND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* Devices */ + MCFG_DEVICE_ADD( "pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(2000000) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("custom", specimx_sound_device, set_input_ch0)) + MCFG_PIT8253_CLK1(2000000) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("custom", specimx_sound_device, set_input_ch1)) + MCFG_PIT8253_CLK2(2000000) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("custom", specimx_sound_device, set_input_ch2)) + + MCFG_DEVICE_REMOVE("ppi8255") + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(special_state, specialist_8255_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(special_state, specialist_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(special_state, specimx_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(special_state, specialist_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) + + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(special_state, fdc_drq)) + MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525qd", special_state::specimx_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525qd", special_state::specimx_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop_list","special_flop") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( erik, special_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(erik_mem) + MCFG_CPU_IO_MAP(erik_io_map) + MCFG_MACHINE_RESET_OVERRIDE(special_state, erik ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(384, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) + MCFG_VIDEO_START_OVERRIDE(special_state,erik) + MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_erik) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(special_state,erik) + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rks_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("special_cass") + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(special_state, specialist_8255_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(special_state, specialist_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(special_state, specialist_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(special_state, specialist_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) + + MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(special_state, fdc_drq)) + MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525qd", special_state::specimx_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525qd", special_state::specimx_floppy_formats) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("192K") + MCFG_RAM_DEFAULT_VALUE(0x00) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( special ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "2nd", "2nd rev.") + ROMX_LOAD( "monitor2_1.rom", 0xc000, 0x0800, CRC(52abde77) SHA1(66ba2ef9eac14a5c0df510224ea25fd5745399cd), ROM_BIOS(1)) + ROMX_LOAD( "monitor2_2.rom", 0xc800, 0x0800, CRC(c425f719) SHA1(1c322591b4e5c8b01b81362c6801aa6fd9fc1492), ROM_BIOS(1)) + ROMX_LOAD( "monitor2_3.rom", 0xd000, 0x0800, CRC(d804aeba) SHA1(1585f354719c25e1f59c7cb8b3a3f5d309a7e8fb), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "2rom", "2nd rev. rom disk") + ROMX_LOAD( "monitor2_1.rom", 0xc000, 0x0800, CRC(52abde77) SHA1(66ba2ef9eac14a5c0df510224ea25fd5745399cd), ROM_BIOS(2)) + ROMX_LOAD( "m2_rom-disk.rom", 0xc800, 0x0800, CRC(7bd3d476) SHA1(232341755ae794f8aab4f6181c8d499a66016af2), ROM_BIOS(2)) + ROMX_LOAD( "monitor2_3.rom", 0xd000, 0x0800, CRC(d804aeba) SHA1(1585f354719c25e1f59c7cb8b3a3f5d309a7e8fb), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "1b", "1st rev. + BASIC") + ROMX_LOAD( "root.rom", 0xc000, 0x0800, CRC(62de741d) SHA1(6c6a29d4340b0b1230c708f9c04ff2ed1c012a76), ROM_BIOS(3)) + ROMX_LOAD( "pzu2.rom", 0xc800, 0x0800, CRC(49937e13) SHA1(872ae5a7c3496d4404cdd577caa2236424016c66), ROM_BIOS(3)) + ROMX_LOAD( "pzu3.rom", 0xd000, 0x0800, CRC(dc817a08) SHA1(8101fe924386f38c10ef929e6dea5a83fcf34600), ROM_BIOS(3)) + ROMX_LOAD( "pzu4.rom", 0xd800, 0x0800, CRC(6793ba23) SHA1(3a27b5dbc6561ea7af5fb30513dc83ec64f1d94c), ROM_BIOS(3)) + ROMX_LOAD( "pzu5.rom", 0xe000, 0x0800, CRC(13a1a0dc) SHA1(3a0818cb8f36c2c5a9b9916669538ad1702a7710), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "1st", "1st rev.") + ROMX_LOAD( "special1.rom", 0xc000, 0x1000, CRC(217414bd) SHA1(345cd1410fbca8f75421d12d1419f27f81cd35d6), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "2col", "2nd rev. color") + ROMX_LOAD( "col_mon2.rom", 0xc000, 0x0800, CRC(8cebb1b5) SHA1(0c912a25220de8c5135e16c443e4796e6bb6f805), ROM_BIOS(5)) + ROMX_LOAD( "monitor2_2.rom", 0xc800, 0x0800, CRC(c425f719) SHA1(1c322591b4e5c8b01b81362c6801aa6fd9fc1492), ROM_BIOS(5)) + ROMX_LOAD( "monitor2_3.rom", 0xd000, 0x0800, CRC(d804aeba) SHA1(1585f354719c25e1f59c7cb8b3a3f5d309a7e8fb), ROM_BIOS(5)) +ROM_END + +ROM_START( specialm ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "pzu1-m.rom", 0xc000, 0x0800, CRC(61e94485) SHA1(dbe212dcd377cb8cd16000516cd4b3b760ce779e)) + ROM_LOAD( "pzu2-m.rom", 0xc800, 0x0800, CRC(83d76815) SHA1(9d139eaa6ca6b241fa9fac94ede72abb56d83674)) + ROM_LOAD( "pzu3-m.rom", 0xd000, 0x0800, CRC(2121ad65) SHA1(b43811d058d818f8c1cee59b405b515f96958656)) + ROM_LOAD( "pzu4-m.rom", 0xd800, 0x0800, CRC(8bf8218e) SHA1(bd1174c384b04a40dfcaa35aa373c5070304f37b)) +ROM_END + +ROM_START( specialp ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "special6.rom", 0xc000, 0x1000, CRC(f0c5a0ac) SHA1(50b53bd7c05117930aa84653a9ea0fc0c6f0f496) ) +ROM_END + +ROM_START( lik ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "1st", "1st rev.") + ROMX_LOAD( "lik.rom", 0xc000, 0x3000, CRC(705bb3a0) SHA1(f90b009ec9d3303bbda228714dd24de057e744b6), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "2nd", "2nd rev.") + ROMX_LOAD( "lik2.rom", 0xc000, 0x3000, CRC(71820e43) SHA1(a85b4fc33b1ea96a1b8fe0c791f1aab8e967bb44), ROM_BIOS(2)) +ROM_END + +ROM_START( specimx ) + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "fos", "ROM FOS") + ROMX_LOAD( "specimx.rom", 0x10000, 0xb800, CRC(db68f9b1) SHA1(c79888449f8a605267ec3e10dcc8e6e6f43b3a95), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "nc", "NC") + ROMX_LOAD( "ncrdy.rom", 0x10000, 0x10000, CRC(5d04c522) SHA1(d7daa7fe14cd8e0c6f87fd6453ec3e94ea2c259f) ,ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "ramfos", "RAMFOS") + ROMX_LOAD( "ramfos.rom", 0x10000, 0x3000, CRC(83e19df4) SHA1(20e5e53eb45729a24c1c7c63e114dbd14e3c4184) ,ROM_BIOS(3)) +ROM_END + +ROM_START( erik ) + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "erik.bin", 0x10000, 0x10000, CRC(6f3208f4) SHA1(41f6e2763ef60d3c7214c98893e580d25346fa2d)) +ROM_END + +ROM_START( pioner ) + // Ukranian clone with 16KB RAM + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "pioner.rf2", 0xc000, 0x0800, CRC(d6250ab2) SHA1(b953517d883c64857e63139fed52436f77d371cb)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, special, 0, 0, special, special, special_state, special, "", "Specialist", 0 ) +COMP( 1985, specialm, special, 0, specialm, special, special_state, special, "", "Specialist M", 0 ) +COMP( 1985, pioner, special, 0, special, special, special_state, special, "", "Pioner", MACHINE_NOT_WORKING ) +COMP( 1985, specialp, special, 0, specialp, specialp, special_state, special, "", "Specialist + hires graph", MACHINE_NOT_WORKING ) +COMP( 1985, lik, special, 0, special, lik, special_state, special, "", "Lik", 0 ) +COMP( 1985, specimx, special, 0, specimx, specimx, driver_device, 0, "", "Specialist MX", 0) +COMP( 1994, erik, special, 0, erik, special, special_state, erik, "", "Erik", 0 ) diff --git a/src/mame/drivers/specpls3.c b/src/mame/drivers/specpls3.c new file mode 100644 index 00000000000..14e428533e6 --- /dev/null +++ b/src/mame/drivers/specpls3.c @@ -0,0 +1,461 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/*************************************************************************** + + NOTE: ****** Specbusy: press N, R, or E to boot ************* + + + Spectrum/Inves/TK90X etc. memory map: + + CPU: + 0000-3fff ROM + 4000-ffff RAM + + Spectrum 128/+2/+2a/+3 memory map: + + CPU: + 0000-3fff Banked ROM/RAM (banked rom only on 128/+2) + 4000-7fff Banked RAM + 8000-bfff Banked RAM + c000-ffff Banked RAM + + TS2068 memory map: (Can't have both EXROM and DOCK active) + The 8K EXROM can be loaded into multiple pages. + + CPU: + 0000-1fff ROM / EXROM / DOCK (Cartridge) + 2000-3fff ROM / EXROM / DOCK + 4000-5fff \ + 6000-7fff \ + 8000-9fff |- RAM / EXROM / DOCK + a000-bfff | + c000-dfff / + e000-ffff / + + +Interrupts: + +Changes: + +29/1/2000 KT - Implemented initial +3 emulation. +30/1/2000 KT - Improved input port decoding for reading and therefore + correct keyboard handling for Spectrum and +3. +31/1/2000 KT - Implemented buzzer sound for Spectrum and +3. + Implementation copied from Paul Daniel's Jupiter driver. + Fixed screen display problems with dirty chars. + Added support to load .Z80 snapshots. 48k support so far. +13/2/2000 KT - Added Interface II, Kempston, Fuller and Mikrogen + joystick support. +17/2/2000 DJR - Added full key descriptions and Spectrum+ keys. + Fixed Spectrum +3 keyboard problems. +17/2/2000 KT - Added tape loading from WAV/Changed from DAC to generic + speaker code. +18/2/2000 KT - Added tape saving to WAV. +27/2/2000 KT - Took DJR's changes and added my changes. +27/2/2000 KT - Added disk image support to Spectrum +3 driver. +27/2/2000 KT - Added joystick I/O code to the Spectrum +3 I/O handler. +14/3/2000 DJR - Tape handling dipswitch. +26/3/2000 DJR - Snapshot files are now classifed as snapshots not + cartridges. +04/4/2000 DJR - Spectrum 128 / +2 Support. +13/4/2000 DJR - +4 Support (unofficial 48K hack). +13/4/2000 DJR - +2a Support (rom also used in +3 models). +13/4/2000 DJR - TK90X, TK95 and Inves support (48K clones). +21/4/2000 DJR - TS2068 and TC2048 support (TC2048 Supports extra video + modes but doesn't have bank switching or sound chip). +09/5/2000 DJR - Spectrum +2 (France, Spain), +3 (Spain). +17/5/2000 DJR - Dipswitch to enable/disable disk drives on +3 and clones. +27/6/2000 DJR - Changed 128K/+3 port decoding (sound now works in Zub 128K). +06/8/2000 DJR - Fixed +3 Floppy support +10/2/2001 KT - Re-arranged code and split into each model emulated. + Code is split into 48k, 128k, +3, tc2048 and ts2048 + segments. 128k uses some of the functions in 48k, +3 + uses some functions in 128, and tc2048/ts2048 use some + of the functions in 48k. The code has been arranged so + these functions come in some kind of "override" order, + read functions changed to use READ8_HANDLER and write + functions changed to use WRITE8_HANDLER. + Added Scorpion256 preliminary. +18/6/2001 DJR - Added support for Interface 2 cartridges. +xx/xx/2001 KS - TS-2068 sound fixed. + Added support for DOCK cartridges for TS-2068. + Added Spectrum 48k Psycho modified rom driver. + Added UK-2086 driver. +23/12/2001 KS - 48k machines are now able to run code in screen memory. + Programs which keep their code in screen memory + like monitors, tape copiers, decrunchers, etc. + works now. + Fixed problem with interrupt vector set to 0xffff (much + more 128k games works now). + A useful used trick on the Spectrum is to set + interrupt vector to 0xffff (using the table + which contain 0xff's) and put a byte 0x18 hex, + the opcode for JR, at this address. The first + byte of the ROM is a 0xf3 (DI), so the JR will + jump to 0xfff4, where a long JP to the actual + interrupt routine is put. Due to unideal + bankswitching in MAME this JP were to 0001 what + causes Spectrum to reset. Fixing this problem + made much more software runing (i.e. Paperboy). + Corrected frames per second value for 48k and 128k + Sinclair machines. + There are 50.08 frames per second for Spectrum + 48k what gives 69888 cycles for each frame and + 50.021 for Spectrum 128/+2/+2A/+3 what gives + 70908 cycles for each frame. + Remaped some Spectrum+ keys. + Presing F3 to reset was seting 0xf7 on keyboard + input port. Problem occurred for snapshots of + some programms where it was readed as pressing + key 4 (which is exit in Tapecopy by R. Dannhoefer + for example). + Added support to load .SP snapshots. + Added .BLK tape images support. + .BLK files are identical to .TAP ones, extension + is an only difference. +08/03/2002 KS - #FF port emulation added. + Arkanoid works now, but is not playable due to + completly messed timings. + +Initialisation values used when determining which model is being emulated: + 48K Spectrum doesn't use either port. + 128K/+2 Bank switches with port 7ffd only. + +3/+2a Bank switches with both ports. + +Notes: + 1. No contented memory. + 2. No hi-res colour effects (need contended memory first for accurate timing). + 3. Multiface 1 and Interface 1 not supported. + 4. Horace and the Spiders cartridge doesn't run properly. + 5. Tape images not supported: + .TZX, .SPC, .ITM, .PAN, .TAP(Warajevo), .VOC, .ZXS. + 6. Snapshot images not supported: + .ACH, .PRG, .RAW, .SEM, .SIT, .SNX, .ZX, .ZXS, .ZX82. + 7. 128K emulation is not perfect - the 128K machines crash and hang while + running quite a lot of games. + 8. Disk errors occur on some +3 games. + 9. Video hardware of all machines is timed incorrectly. +10. EXROM and HOME cartridges are not emulated. +11. The TK90X and TK95 roms output 0 to port #df on start up. +12. The purpose of this port is unknown (probably display mode as TS2068) and + thus is not emulated. + +Very detailed infos about the ZX Spectrum +3e can be found at + +http://www.z88forever.org.uk/zxplus3e/ + +*******************************************************************************/ + +#include "emu.h" +#include "includes/spectrum.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/ay8910.h" +#include "sound/speaker.h" +#include "formats/tzx_cas.h" + +/* +3 hardware */ +#include "machine/ram.h" + + +/****************************************************************************************************/ +/* Spectrum + 3 specific functions */ +/* This driver uses some of the spectrum_128 functions. The +3 is similar to a spectrum 128 +but with a disc drive */ + + +static const int spectrum_plus3_memory_selections[]= +{ + 0,1,2,3, + 4,5,6,7, + 4,5,6,3, + 4,7,6,3 +}; + +WRITE8_MEMBER( spectrum_state::spectrum_plus3_port_3ffd_w ) +{ + if (m_floppy==1) + m_upd765->fifo_w(space, 0, data, 0xff); +} + +READ8_MEMBER( spectrum_state::spectrum_plus3_port_3ffd_r ) +{ + if (m_floppy==0) + return 0xff; + else + return m_upd765->fifo_r(space, 0, 0xff); +} + + +READ8_MEMBER( spectrum_state::spectrum_plus3_port_2ffd_r ) +{ + if (m_floppy==0) + return 0xff; + else + return m_upd765->msr_r(space, 0, 0xff); +} + + +void spectrum_state::spectrum_plus3_update_memory() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *messram = m_ram->pointer(); + + if (m_port_7ffd_data & 8) + { + logerror("+3 SCREEN 1: BLOCK 7\n"); + m_screen_location = messram + (7 << 14); + } + else + { + logerror("+3 SCREEN 0: BLOCK 5\n"); + m_screen_location = messram + (5 << 14); + } + + if ((m_port_1ffd_data & 0x01) == 0) + { + /* select ram at 0x0c000-0x0ffff */ + int ram_page = m_port_7ffd_data & 0x07; + unsigned char *ram_data = messram + (ram_page<<14); + membank("bank4")->set_base(ram_data); + + logerror("RAM at 0xc000: %02x\n", ram_page); + + /* Reset memory between 0x4000 - 0xbfff in case extended paging was being used */ + /* Bank 5 in 0x4000 - 0x7fff */ + membank("bank2")->set_base(messram + (5 << 14)); + + /* Bank 2 in 0x8000 - 0xbfff */ + membank("bank3")->set_base(messram + (2 << 14)); + + if (!m_cart->exists()) + { + /* ROM switching */ + int ROMSelection = BIT(m_port_7ffd_data, 4) | ((m_port_1ffd_data >> 1) & 0x02); + + /* rom 0 is editor, rom 1 is syntax, rom 2 is DOS, rom 3 is 48 BASIC */ + unsigned char *ChosenROM = memregion("maincpu")->base() + 0x010000 + (ROMSelection << 14); + + membank("bank1")->set_base(ChosenROM); + space.unmap_write(0x0000, 0x3fff); + + logerror("rom switch: %02x\n", ROMSelection); + } + } + else + { + /* Extended memory paging */ + int MemorySelection = (m_port_1ffd_data >> 1) & 0x03; + const int *memory_selection = &spectrum_plus3_memory_selections[(MemorySelection << 2)]; + unsigned char *ram_data = messram + (memory_selection[0] << 14); + + membank("bank1")->set_base(ram_data); + /* allow writes to 0x0000-0x03fff */ + space.install_write_bank(0x0000, 0x3fff, "bank1"); + + ram_data = messram + (memory_selection[1] << 14); + membank("bank2")->set_base(ram_data); + + ram_data = messram + (memory_selection[2] << 14); + membank("bank3")->set_base(ram_data); + + ram_data = messram + (memory_selection[3] << 14); + membank("bank4")->set_base(ram_data); + + logerror("extended memory paging: %02x\n", MemorySelection); + } +} + + + +WRITE8_MEMBER( spectrum_state::spectrum_plus3_port_7ffd_w ) +{ + /* D0-D2: RAM page located at 0x0c000-0x0ffff */ + /* D3 - Screen select (screen 0 in ram page 5, screen 1 in ram page 7 */ + /* D4 - ROM select - which rom paged into 0x0000-0x03fff */ + /* D5 - Disable paging */ + + /* disable paging? */ + if (m_port_7ffd_data & 0x20) + return; + + /* store new state */ + m_port_7ffd_data = data; + + /* update memory */ + spectrum_plus3_update_memory(); +} + +WRITE8_MEMBER( spectrum_state::spectrum_plus3_port_1ffd_w ) +{ + /* D0-D1: ROM/RAM paging */ + /* D2: Affects if d0-d1 work on ram/rom */ + /* D3 - Disk motor on/off */ + /* D4 - parallel port strobe */ + + m_upd765_0->get_device()->mon_w(!BIT(data, 3)); + m_upd765_1->get_device()->mon_w(!BIT(data, 3)); + + m_port_1ffd_data = data; + + /* disable paging? */ + if ((m_port_7ffd_data & 0x20)==0) + { + /* no */ + spectrum_plus3_update_memory(); + } +} + +/* ports are not decoded full. +The function decodes the ports appropriately */ +static ADDRESS_MAP_START (spectrum_plus3_io, AS_IO, 8, spectrum_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) + AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) + AM_RANGE(0x4000, 0x4000) AM_WRITE(spectrum_plus3_port_7ffd_w) AM_MIRROR(0x3ffd) + AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3ffd) + AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd) + AM_RANGE(0x1000, 0x1000) AM_WRITE(spectrum_plus3_port_1ffd_w) AM_MIRROR(0x0ffd) + AM_RANGE(0x2000, 0x2000) AM_READ(spectrum_plus3_port_2ffd_r) AM_MIRROR(0x0ffd) + AM_RANGE(0x3000, 0x3000) AM_READWRITE(spectrum_plus3_port_3ffd_r,spectrum_plus3_port_3ffd_w) AM_MIRROR(0x0ffd) +ADDRESS_MAP_END + +MACHINE_RESET_MEMBER(spectrum_state,spectrum_plus3) +{ + UINT8 *messram = m_ram->pointer(); + memset(messram,0,128*1024); + + MACHINE_RESET_CALL_MEMBER(spectrum); + + /* Initial configuration */ + m_port_7ffd_data = 0; + m_port_1ffd_data = 0; + spectrum_plus3_update_memory(); +} + +DRIVER_INIT_MEMBER(spectrum_state,plus3) +{ + m_floppy = 1; +} + +DRIVER_INIT_MEMBER(spectrum_state,plus2) +{ + m_floppy = 0; +} + +static SLOT_INTERFACE_START( specpls3_floppies ) + SLOT_INTERFACE( "3ssdd", FLOPPY_3_SSDD ) +SLOT_INTERFACE_END + +/* F4 Character Displayer */ +static const gfx_layout spectrum_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 96, /* 96 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( specpls3 ) + GFXDECODE_ENTRY( "maincpu", 0x1fd00, spectrum_charlayout, 0, 8 ) +GFXDECODE_END + + +static MACHINE_CONFIG_DERIVED( spectrum_plus3, spectrum_128 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(spectrum_plus3_io) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(50.01) + MCFG_GFXDECODE_MODIFY("gfxdecode", specpls3) + + MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, spectrum_plus3 ) + + MCFG_UPD765A_ADD("upd765", true, true) + MCFG_FLOPPY_DRIVE_ADD("upd765:0", specpls3_floppies, "3ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd765:1", specpls3_floppies, "3ssdd", floppy_image_device::default_floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list", "specpls3_flop") +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(specpl2a) + ROM_REGION(0x20000,"maincpu",0) + ROM_LOAD("p2a41_0.rom",0x10000,0x4000, CRC(30c9f490) SHA1(62ec15a4af56cd1d206d0bd7011eac7c889a595d)) + ROM_LOAD("p2a41_1.rom",0x14000,0x4000, CRC(a7916b3f) SHA1(1a7812c383a3701e90e88d1da086efb0c033ac72)) + ROM_LOAD("p2a41_2.rom",0x18000,0x4000, CRC(c9a0b748) SHA1(8df145d10ff78f98138682ea15ebccb2874bf759)) + ROM_LOAD("p2a41_3.rom",0x1c000,0x4000, CRC(b88fd6e3) SHA1(be365f331942ec7ec35456b641dac56a0dbfe1f0)) +ROM_END + +ROM_START(specpls3) + ROM_REGION(0x20000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "en", "English v4.0" ) + ROMX_LOAD("pl3-0.rom",0x10000,0x4000, CRC(17373da2) SHA1(e319ed08b4d53a5e421a75ea00ea02039ba6555b), ROM_BIOS(1)) + ROMX_LOAD("pl3-1.rom",0x14000,0x4000, CRC(f1d1d99e) SHA1(c9969fc36095a59787554026a9adc3b87678c794), ROM_BIOS(1)) + ROMX_LOAD("pl3-2.rom",0x18000,0x4000, CRC(3dbf351d) SHA1(22e50c6ba4157a3f6a821bd9937cd26e292775c6), ROM_BIOS(1)) + ROMX_LOAD("pl3-3.rom",0x1c000,0x4000, CRC(04448eaa) SHA1(65f031caa8148a5493afe42c41f4929deab26b4e), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "sp", "Spanish v.40" ) + ROMX_LOAD("plus3sp0.rom",0x10000,0x4000, CRC(1f86147a) SHA1(e9b0a60a1a8def511d59090b945d175bdc646346), ROM_BIOS(2)) + ROMX_LOAD("plus3sp1.rom",0x14000,0x4000, CRC(a8ac4966) SHA1(4e48f196427596c7990c175d135c15a039c274a4), ROM_BIOS(2)) + ROMX_LOAD("plus3sp2.rom",0x18000,0x4000, CRC(f6bb0296) SHA1(09fc005625589ef5992515957ce7a3167dec24b2), ROM_BIOS(2)) + ROMX_LOAD("plus3sp3.rom",0x1c000,0x4000, CRC(f6d25389) SHA1(ec8f644a81e2e9bcb58ace974103ea960361bad2), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "en41", "English v4.1" ) + ROMX_LOAD("plus341.rom",0x10000,0x10000, CRC(be0d9ec4) SHA1(500c0945760abeefcbd08bc22c0d07b14b336cf0), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "4ms", "Customize 3.5\" 4ms" ) + ROMX_LOAD("p3_01_4m.rom",0x10000,0x8000, CRC(ad99380a) SHA1(4e5d114b72d464cefdde0566457f52a3c0c1cae2), ROM_BIOS(4)) + ROMX_LOAD("p3_23_4m.rom",0x18000,0x8000, CRC(07727895) SHA1(752cdd6a083ab9910348995e483541d60bb6372b), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "12ms", "Customize 3.5\" 12ms" ) + ROMX_LOAD("p3_01_cm.rom",0x10000,0x8000, CRC(ad99380a) SHA1(4e5d114b72d464cefdde0566457f52a3c0c1cae2), ROM_BIOS(5)) + ROMX_LOAD("p3_23_cm.rom",0x18000,0x8000, CRC(61f2b50c) SHA1(d062765ceb1f3cd2c94ea51cb737cac7ad6151b4), ROM_BIOS(5)) +ROM_END + +ROM_START(specpl3e) + ROM_REGION(0x20000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "en", "English" ) + ROMX_LOAD("roma-en.rom",0x10000,0x8000, CRC(2d533344) SHA1(5ff2dae32eb745d87e0b54c595d1d20a866f316f), ROM_BIOS(1)) + ROMX_LOAD("romb-en.rom",0x18000,0x8000, CRC(ef8d5d92) SHA1(983aa53aa76e25a3af123c896016bacf6829b72b), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) + ROMX_LOAD("roma-es.rom",0x10000,0x8000, CRC(ba694b4b) SHA1(d15d9e43950483cffc79f1cfa89ecb114a88f6c2), ROM_BIOS(2)) + ROMX_LOAD("romb-es.rom",0x18000,0x8000, CRC(61ed94db) SHA1(935b14c13db75d872de8ad0d591aade0adbbc355), ROM_BIOS(2)) +ROM_END + +ROM_START(sp3e8bit) + ROM_REGION(0x20000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "en", "English" ) + ROMX_LOAD("3e8biten.rom",0x10000,0x10000, CRC(beee3bf6) SHA1(364ec903916282d5401901c5fb0cb93a142038b3), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) + ROMX_LOAD("3e8bites.rom",0x10000,0x10000, CRC(cafe4c35) SHA1(8331d273d29d3e37ec1324053bb050874d2c1434), ROM_BIOS(2)) +ROM_END + +ROM_START(sp3ezcf) + ROM_REGION(0x20000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "en", "English" ) + ROMX_LOAD("3ezcfen.rom",0x10000,0x10000, CRC(43993f11) SHA1(27cbfbe8b5ef9eec6056026fa0b84fe158ba2f45), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) + ROMX_LOAD("3ezcfes.rom",0x10000,0x10000, CRC(1325a0d7) SHA1(521cf47e10f46c8a621c8889ef1f008454c7e10b), ROM_BIOS(2)) +ROM_END + +ROM_START(sp3eata) + ROM_REGION(0x20000,"maincpu",0) + ROM_SYSTEM_BIOS( 0, "en", "English" ) + ROMX_LOAD("3ezxaen.rom",0x10000,0x10000, CRC(dfb676dc) SHA1(37618bc66ae33dbf686be8a92867e4a9144b65dc), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) + ROMX_LOAD("3ezxaes.rom",0x10000,0x10000, CRC(8f0ae91a) SHA1(71693e18b30c90914be58cba26682ca025c924ea), ROM_BIOS(2)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1987, specpl2a, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus2, "Amstrad plc", "ZX Spectrum +2a" , 0 ) +COMP( 1987, specpls3, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3" , 0 ) +COMP( 2000, specpl3e, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3e" , MACHINE_UNOFFICIAL ) +COMP( 2002, sp3e8bit, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3e 8bit IDE" , MACHINE_UNOFFICIAL ) +COMP( 2002, sp3eata, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3e 8bit ZXATASP" , MACHINE_UNOFFICIAL ) +COMP( 2002, sp3ezcf, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3e 8bit ZXCF" , MACHINE_UNOFFICIAL ) diff --git a/src/mame/drivers/spectrum.c b/src/mame/drivers/spectrum.c new file mode 100644 index 00000000000..5803b8a2d52 --- /dev/null +++ b/src/mame/drivers/spectrum.c @@ -0,0 +1,995 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/*************************************************************************** + + NOTE: ****** Specbusy: press N, R, or E to boot ************* + + + Spectrum/Inves/TK90X etc. memory map: + + CPU: + 0000-3fff ROM + 4000-ffff RAM + + Spectrum 128/+2/+2a/+3 memory map: + + CPU: + 0000-3fff Banked ROM/RAM (banked rom only on 128/+2) + 4000-7fff Banked RAM + 8000-bfff Banked RAM + c000-ffff Banked RAM + + TS2068 memory map: (Can't have both EXROM and DOCK active) + The 8K EXROM can be loaded into multiple pages. + + CPU: + 0000-1fff ROM / EXROM / DOCK (Cartridge) + 2000-3fff ROM / EXROM / DOCK + 4000-5fff \ + 6000-7fff \ + 8000-9fff |- RAM / EXROM / DOCK + a000-bfff | + c000-dfff / + e000-ffff / + + +Interrupts: + +Changes: + +29/1/2000 KT - Implemented initial +3 emulation. +30/1/2000 KT - Improved input port decoding for reading and therefore + correct keyboard handling for Spectrum and +3. +31/1/2000 KT - Implemented buzzer sound for Spectrum and +3. + Implementation copied from Paul Daniel's Jupiter driver. + Fixed screen display problems with dirty chars. + Added support to load .Z80 snapshots. 48k support so far. +13/2/2000 KT - Added Interface II, Kempston, Fuller and Mikrogen + joystick support. +17/2/2000 DJR - Added full key descriptions and Spectrum+ keys. + Fixed Spectrum +3 keyboard problems. +17/2/2000 KT - Added tape loading from WAV/Changed from DAC to generic + speaker code. +18/2/2000 KT - Added tape saving to WAV. +27/2/2000 KT - Took DJR's changes and added my changes. +27/2/2000 KT - Added disk image support to Spectrum +3 driver. +27/2/2000 KT - Added joystick I/O code to the Spectrum +3 I/O handler. +14/3/2000 DJR - Tape handling dipswitch. +26/3/2000 DJR - Snapshot files are now classifed as snapshots not + cartridges. +04/4/2000 DJR - Spectrum 128 / +2 Support. +13/4/2000 DJR - +4 Support (unofficial 48K hack). +13/4/2000 DJR - +2a Support (rom also used in +3 models). +13/4/2000 DJR - TK90X, TK95 and Inves support (48K clones). +21/4/2000 DJR - TS2068 and TC2048 support (TC2048 Supports extra video + modes but doesn't have bank switching or sound chip). +09/5/2000 DJR - Spectrum +2 (France, Spain), +3 (Spain). +17/5/2000 DJR - Dipswitch to enable/disable disk drives on +3 and clones. +27/6/2000 DJR - Changed 128K/+3 port decoding (sound now works in Zub 128K). +06/8/2000 DJR - Fixed +3 Floppy support +10/2/2001 KT - Re-arranged code and split into each model emulated. + Code is split into 48k, 128k, +3, tc2048 and ts2048 + segments. 128k uses some of the functions in 48k, +3 + uses some functions in 128, and tc2048/ts2048 use some + of the functions in 48k. The code has been arranged so + these functions come in some kind of "override" order, + read functions changed to use READ8_HANDLER and write + functions changed to use WRITE8_HANDLER. + Added Scorpion256 preliminary. +18/6/2001 DJR - Added support for Interface 2 cartridges. +xx/xx/2001 KS - TS-2068 sound fixed. + Added support for DOCK cartridges for TS-2068. + Added Spectrum 48k Psycho modified rom driver. + Added UK-2086 driver. +23/12/2001 KS - 48k machines are now able to run code in screen memory. + Programs which keep their code in screen memory + like monitors, tape copiers, decrunchers, etc. + works now. + Fixed problem with interrupt vector set to 0xffff (much + more 128k games works now). + A useful used trick on the Spectrum is to set + interrupt vector to 0xffff (using the table + which contain 0xff's) and put a byte 0x18 hex, + the opcode for JR, at this address. The first + byte of the ROM is a 0xf3 (DI), so the JR will + jump to 0xfff4, where a long JP to the actual + interrupt routine is put. Due to unideal + bankswitching in MAME this JP were to 0001 what + causes Spectrum to reset. Fixing this problem + made much more software runing (i.e. Paperboy). + Corrected frames per second value for 48k and 128k + Sincalir machines. + There are 50.08 frames per second for Spectrum + 48k what gives 69888 cycles for each frame and + 50.021 for Spectrum 128/+2/+2A/+3 what gives + 70908 cycles for each frame. + Remaped some Spectrum+ keys. + Presing F3 to reset was seting 0xf7 on keyboard + input port. Problem occurred for snapshots of + some programms where it was readed as pressing + key 4 (which is exit in Tapecopy by R. Dannhoefer + for example). + Added support to load .SP snapshots. + Added .BLK tape images support. + .BLK files are identical to .TAP ones, extension + is an only difference. +08/03/2002 KS - #FF port emulation added. + Arkanoid works now, but is not playable due to + completly messed timings. +25/10/2012 DH - simplified border emulation to be a (manual) partial + update with bitmap + Removed legacy fff4 interrupt hack, modern version of + MAME can handle this just fine + +Initialisation values used when determining which model is being emulated: + 48K Spectrum doesn't use either port. + 128K/+2 Bank switches with port 7ffd only. + +3/+2a Bank switches with both ports. + +TODO: (the best resource for ZX Spectrum HW informations is the http://www.zxdesign.info/ + blog, a project devored to reverse-engineer the ZX Spectrum in h/w). + + 1. No contended memory. The different Spectrum models have different contention timings + Updated info can be found here: http://scratchpad.wikia.com/wiki/Contended_memory + Of course, neither "late timing" contention effects are emulated. + + 2. Russian models (at least Pentagon and Scorpion) reportedly don't have contended memory. + Information about screen timings are here: http://www.worldofspectrum.org/rusfaq/ + + 3. Similarly, contended I/O is not emulated: http://scratchpad.wikia.com/wiki/Contended_IO + + 4. Finally, the Floating Bus implementation is incomplete: http://scratchpad.wikia.com/wiki/Floating_bus + The page hosts a couple of testing programs. + + 5. A NTSC model exists: it's not the Timex, but a plain ZX Spectrum made for the Chilean market: + http://scratchpad.wikia.com/wiki/NTSC_Spectrum + + 6. No hi-res colour effects (need contended memory first for accurate timing). + + 7. Keyboard autorepeat is broken. + + 8. Port decoding on all models needs to be checked and, in case, corrected. + + 9. The actual Issue 2/3 effect is a bit more complicated than implemented: + http://piters.tripod.com/cassport.htm for an explanation/test suite. + +10. Tape formats not supported: + .001, .CSW, .LTP, .PZX, .SPC, .STA, .ITM/.PAN, .TAP(Warajevo), .VOC, .ZXS, .ZXT + +11. Disk formats not supported: + .CPD, .DSK, .FDD, .FDI, .HDF, .IMG, .MDR, .MGT, .SCL, .TRD, .ZXD + +12. 128K emulation is not perfect - the 128K machines crash and hang while + running quite a lot of games. + +13. Disk errors occur on some +3 games. + +14. EXROM and HOME cartridges are not emulated on Timex machines. + +15. The TK90X and TK95 roms output 0 to port #df on start up. The purpose of this port is unknown + (probably display mode as TS2068) and thus is not emulated. + +16. Very detailed infos about the ZX Spectrum +3e can be found at + http://www.worldofspectrum.org/zxplus3e/ + +17. The ZX Spectrum is known to support a huge number of peripherals, daisy-chained through its expansion bus. + In the earlier part of its life cycle, a common configuration consisted of a "docking station"-type + peripheral providing drive controllers (the disk drives were not part of the packages), a game + interface (joystick and/or sound chip) and the ZX Printer (which, if present, must terminate the chain). + + Later, all-in-one peripherals became more common. The following list is just a little part of the huge + catalog of peripherals available to the ZX Spectrum; however these peripherals are both the most successful + and the better documented ones. + + Except when noted, technical and usage manuals are available at http://www.worldofspectrum.org/ + +------------------------ +Mass storage controllers +------------------------ + +ZX Interface 1 + up to 8 Microdrives + 1 RS-232 port + 2 ZX Network ports - http://scratchpad.wikia.com/wiki/ZX_Net + +Opus Discovery + up to 2 Disk drives + 1 Centronics port + 1 Joystick port (Kempston) + +DISCiPLE Interface + up to 2 Disk drives + 1 Centronics port + 2 Joystick ports (RH: Sinclair/Kempston, LH: Sinclair) + 2 ZX Network ports + +Plus D Interface + up to 2 Disk drives + 1 Centronics port + +Rotronics Wafadrive + 2 "Stringy" drives + 1 RS-232 port + 1 Centronics port + +Kempston Disc Interface + up to 4 Disk drives (KDOS) + +Beta 128 Disk Interface + up to 4 Disk drives (TR-DOS) + +Philips Disc ROM + ??? + +---------------- +Game controllers +---------------- + +ZX Interface 2 + 2 Joystick ports (Sinclair) + 1 ROM slot + +Kempston Interface + 1 Joystick port (Kempston) + +Protek/AGF/Cursor Interface + 1 Joystick port (Protek) + +Fuller Box + 1 Joystick port (Fuller) + 1 G1-AY-3-8912 sound chip - the chip is identical to the one present on the 128 model, + but the I/O ports are different: http://scratchpad.wikia.com/wiki/AY-3-8912(a) and + http://scratchpad.wikia.com/wiki/Timex_2000_series#Sound_Chip + +Mikro-Plus Interface + 1 Joystick port (Mikrogen) + 1 ROM slot - http://www.worldofspectrum.org/showmag.cgi?mag=Crash/Issue19/Pages/Crash1900020.jpg + +------------ +Misc devices +------------ + +DK'Tronics Light Pen (identical to TK90X light pen) + +AMX Mouse + Schematics and test software at http://velesoft.speccy.cz/othermouse-cz.htm + +Kempston Mouse + Schematics and test software at http://8bit.yarek.pl/hardware/zx.mouse/ + +Currah uSpeech + Speech synthesis through allophones (SP0256-AL2) + +MGT Messenger + Allows connection between ZX Spectrum and SAM Coup?? + +Soft-ROM + A development system board - http://www.wearmouth.demon.co.uk/softrom.htm + +Multiface 1/128/+3 + The classic snapshot interface for ZX Spectrum, 128 and +3 models, with 8K internal RAM. + +SamRam + A more versatile "Multiface I"-type interface - http://8bit.yarek.pl/upgrade/zx.samram/samram.html + + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/wave.h" +#include "includes/spectrum.h" +#include "formats/tzx_cas.h" +#include "machine/spec_snqk.h" + + +/****************************************************************************************************/ +/* Spectrum 48k functions */ + +/* + bit 7-5: not used + bit 4: Ear output/Speaker + bit 3: MIC/Tape Output + bit 2-0: border colour +*/ + +WRITE8_MEMBER(spectrum_state::spectrum_port_fe_w) +{ + unsigned char Changed; + + Changed = m_port_fe_data^data; + + /* border colour changed? */ + if ((Changed & 0x07)!=0) + { + spectrum_UpdateBorderBitmap(); + } + + if ((Changed & (1<<4))!=0) + { + /* DAC output state */ + m_speaker->level_w(BIT(data, 4)); + } + + if ((Changed & (1<<3))!=0) + { + /* write cassette data */ + m_cassette->output((data & (1<<3)) ? -1.0 : +1.0); + } + + m_port_fe_data = data; +} + + + +/* KT: more accurate keyboard reading */ +/* DJR: Spectrum+ keys added */ +READ8_MEMBER(spectrum_state::spectrum_port_fe_r) +{ + int lines = offset >> 8; + int data = 0xff; + + int cs_extra1 = m_io_plus0 ? m_io_plus0->read() & 0x1f : 0x1f; + int cs_extra2 = m_io_plus1 ? m_io_plus1->read() & 0x1f : 0x1f; + int cs_extra3 = m_io_plus2 ? m_io_plus2->read() & 0x1f : 0x1f; + int ss_extra1 = m_io_plus3 ? m_io_plus3->read() & 0x1f : 0x1f; + int ss_extra2 = m_io_plus4 ? m_io_plus4->read() & 0x1f : 0x1f; + + /* Caps - V */ + if ((lines & 1) == 0) + { + data &= m_io_line0->read(); + /* CAPS for extra keys */ + if (cs_extra1 != 0x1f || cs_extra2 != 0x1f || cs_extra3 != 0x1f) + data &= ~0x01; + } + + /* A - G */ + if ((lines & 2) == 0) + data &= m_io_line1->read(); + + /* Q - T */ + if ((lines & 4) == 0) + data &= m_io_line2->read(); + + /* 1 - 5 */ + if ((lines & 8) == 0) + data &= m_io_line3->read() & cs_extra1; + + /* 6 - 0 */ + if ((lines & 16) == 0) + data &= m_io_line4->read() & cs_extra2; + + /* Y - P */ + if ((lines & 32) == 0) + data &= m_io_line5->read() & ss_extra1; + + /* H - Enter */ + if ((lines & 64) == 0) + data &= m_io_line6->read(); + + /* B - Space */ + if ((lines & 128) == 0) + { + data &= m_io_line7->read() & cs_extra3 & ss_extra2; + /* SYMBOL SHIFT for extra keys */ + if (ss_extra1 != 0x1f || ss_extra2 != 0x1f) + data &= ~0x02; + } + + data |= (0xe0); /* Set bits 5-7 - as reset above */ + + /* cassette input from wav */ + if (m_cassette->input() > 0.0038 ) + { + data &= ~0x40; + } + + /* Issue 2 Spectrums default to having bits 5, 6 & 7 set. + Issue 3 Spectrums default to having bits 5 & 7 set and bit 6 reset. */ + if (m_io_config->read() & 0x80) + data ^= (0x40); + + return data; +} + +/* kempston joystick interface */ +READ8_MEMBER(spectrum_state::spectrum_port_1f_r) +{ + return m_io_kempston->read() & 0x1f; +} + +/* fuller joystick interface */ +READ8_MEMBER(spectrum_state::spectrum_port_7f_r) +{ + return m_io_fuller->read() | (0xff^0x8f); +} + +/* mikrogen joystick interface */ +READ8_MEMBER(spectrum_state::spectrum_port_df_r) +{ + return m_io_mikrogen->read() | (0xff^0x1f); +} + +READ8_MEMBER(spectrum_state::spectrum_port_ula_r) +{ + int vpos = machine().first_screen()->vpos(); + + return vpos<193 ? m_video_ram[(vpos&0xf8)<<2]:0xff; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START (spectrum_mem, AS_PROGRAM, 8, spectrum_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x4000, 0x5aff) AM_RAM AM_SHARE("video_ram") +// AM_RANGE(0x5b00, 0x7fff) AM_RAM +// AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + +/* ports are not decoded full. +The function decodes the ports appropriately */ +static ADDRESS_MAP_START (spectrum_io, AS_IO, 8, spectrum_state ) + AM_RANGE(0x00, 0x00) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) + AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) + AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) + AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) + AM_RANGE(0x01, 0x01) AM_READ(spectrum_port_ula_r) AM_MIRROR(0xfffe) +ADDRESS_MAP_END + +/* Input ports */ + +/****************************************************************************************************/ + +static INPUT_PORTS_START( spec_joys ) + PORT_START("JOY_INTF") + PORT_CONFNAME( 0x0f, 0x01, "Joystick Interface") + PORT_CONFSETTING( 0x00, "None (No Joystick)" ) + PORT_CONFSETTING( 0x01, "Kempston" ) + PORT_CONFSETTING( 0x02, "Fuller" ) + PORT_CONFSETTING( 0x03, "Mikrogen" ) + + PORT_START("KEMPSTON") /* Kempston joystick interface */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right (Kempston)") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left (Kempston)") PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down (Kempston)") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up (Kempston)") PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire (Kempston)") PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) + + PORT_START("FULLER") /* Fuller joystick interface */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up (Fuller)") PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down (Fuller)") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left (Fuller)") PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right (Fuller)") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire (Fuller)") PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) + + PORT_START("MIKROGEN") /* Mikrogen joystick interface */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up (Mikrogen)") PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down (Mikrogen)") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right (Mikrogen)") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left (Mikrogen)") PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire (Mikrogen)") PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) +INPUT_PORTS_END + +/* +Spectrum keyboard is quite complicate to emulate. Each key can have 5 or 6 different functions, depending on which input mode we are in: + +------------------------------------------------------------------------------------------------------------------- + Mode | Sequence on Spectrum | Sequence in MESS +------------------------------------------------------------------------------------------------------------------- + KEY Mode | Simply press the key | Simply press the key + CAPS Mode | Press Key + CAPS SHIFT | Press Key + LShift (default mapping) + SYMBOL Mode | Press Key + SYMBOL SHIFT | Press Key + RShift (default mapping) + EXT Mode | Press CAPS + SYMBOL once, | Press LShift + RShift (to enter EXT Mode), + | then press Key | then press Key + EXT+Shift Mode | In EXT Mode, press Key + SHIFT | In EXT Mode, press Key + LShift or Key + RShift + | (no matter if CAPS and SYMBOL) | + BASIC Mode | At BASIC Prompt, press the key | At BASIC Prompt, press the key +------------------------------------------------------------------------------------------------------------------- + +Number Keys are the only keys not having a function in BASIC Mode (hence, they only have 5 functions) + +2009-04: Added natural keyboard support. The commented out PORT_CHARs are not reachable in natural keyboard mode (they are entered +in EXT+Shift Mode on a real Spectrum). +*/ + +/* TO DO: replace PORT_CHAR('\xD7') with an 'empty' PORT_CHAR. I used \xD7 (multiplication sign) just as a placeholder. There should be no +PORT_CHAR for those functions (which have no equivalent on modern keyboards), but something is needed (to correctly have natural support for +a few keys in SYMBOL Mode) and I found no EMPTY PORT_CHAR in MESS */ +INPUT_PORTS_START( spectrum ) + /* PORT_NAME = KEY Mode CAPS Mode SYMBOL Mode EXT Mode EXT+Shift Mode BASIC Mode */ + PORT_START("LINE0") /* 0xFEFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z Z : LN BEEP COPY") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(':') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x X \xC2\xA3 EXP INK CLEAR") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('\xA3') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c C ? LPRINT PAPER CONT") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('?') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v V / LLIST FLASH CLS") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR('/') + + PORT_START("LINE1") /* 0xFDFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a A STOP READ ~ NEW") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')// PORT_CHAR('~') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s S NOT RESTORE | SAVE") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')// PORT_CHAR('|') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d D STEP DATA \\ DIM") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')// PORT_CHAR('\\') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f F TO SGN { FOR") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')// PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g G THEN ABS } GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')// PORT_CHAR('}') + + PORT_START("LINE2") /* 0xFBFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q Q <= SIN ASN PLOT") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w W <> COS ACS DRAW") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e E >= TAN ATN REM") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r R < INT VERIFY RUN") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t T > RND MERGE RAND") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR('>') + + /* interface II uses this port for joystick */ + PORT_START("LINE3") /* 0xF7FE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 EDIT ! BLUE DEF FN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('\xD7') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 CAPS LOCK @ RED FN") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\xD7') PORT_CHAR('@') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 TRUE VID # MAGENTA LINE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xD7') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 INV VID $ GREEN OPEN#") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xD7') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 Left % CYAN CLOSE#") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('%') + + /* protek clashes with interface II! uses 5 = left, 6 = down, 7 = up, 8 = right, 0 = fire */ + PORT_START("LINE4") /* 0xEFFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 DEL _ BLACK FORMAT") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(8) PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 GRAPH ) POINT") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('\xD7') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 Right ( CAT") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 Up ' WHITE ERASE") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 Down & YELLOW MOVE") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('&') + + PORT_START("LINE5") /* 0xDFFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p P \" TAB (c) PRINT") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o O ; PEEK OUT POKE") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(';') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i I AT CODE IN INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u U OR CHR$ ] IF") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')// PORT_CHAR(']') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y Y AND STR$ [ RETURN") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')// PORT_CHAR('[') + + PORT_START("LINE6") /* 0xBFFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l L = USR ATTR LET") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('=') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k K + LEN SCREEN$ LIST") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j J - VAL VAL$ LOAD") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR('-') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h H ^ SQR CIRCLE GOSUB") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR('^') + + PORT_START("LINE7") /* 0x7FFE */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SYMBOL SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m M . PI INVERSE PAUSE") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR('.') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n N , INKEY$ OVER NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(',') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b B * BIN BRIGHT BORDER") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR('*') + + PORT_START("NMI") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_F12) + + PORT_START("CONFIG") + PORT_CONFNAME( 0x80, 0x00, "Hardware Version" ) + PORT_CONFSETTING( 0x00, "Issue 2" ) + PORT_CONFSETTING( 0x80, "Issue 3" ) + PORT_BIT(0x7f, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_INCLUDE( spec_joys ) +INPUT_PORTS_END + +/* These keys need not to be mapped in natural mode because Spectrum+ supports both these and the Spectrum sequences above. + Hence, we can simply keep using such sequences in natural keyboard emulation */ +INPUT_PORTS_START( spec_plus ) + PORT_INCLUDE( spectrum ) + + PORT_START("PLUS0") /* Spectrum+ Keys (Same as CAPS + 1-5) */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EDIT") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRUE VID") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INV VID") PORT_CODE(KEYCODE_END) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("PLUS1") /* Spectrum+ Keys (Same as CAPS + 6-0) */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("PLUS2") /* Spectrum+ Keys (Same as CAPS + SPACE and CAPS + SYMBOL) */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_PAUSE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXT MODE") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("PLUS3") /* Spectrum+ Keys (Same as SYMBOL SHIFT + O/P) */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\"") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("PLUS4") /* Spectrum+ Keys (Same as SYMBOL SHIFT + N/M) */ + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0xf3, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +/* Machine initialization */ + +DRIVER_INIT_MEMBER(spectrum_state,spectrum) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + switch (m_ram->size()) + { + case 48*1024: + space.install_ram(0x8000, 0xffff, NULL); // Fall through + case 16*1024: + space.install_ram(0x5b00, 0x7fff, NULL); + } +} + +MACHINE_RESET_MEMBER(spectrum_state,spectrum) +{ + m_port_7ffd_data = -1; + m_port_1ffd_data = -1; + + if (m_cart && m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x3fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +/* F4 Character Displayer */ +static const gfx_layout spectrum_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 96, /* 96 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( spectrum ) + GFXDECODE_ENTRY( "maincpu", 0x3d00, spectrum_charlayout, 0, 8 ) +GFXDECODE_END + +void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt) +{ + m_maincpu->set_input_line(0, HOLD_LINE); + timer_set(attotime::from_ticks(32, m_maincpu->clock()), 0, 0); +} + +DEVICE_IMAGE_LOAD_MEMBER(spectrum_state, spectrum_cart) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size != 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +MACHINE_CONFIG_START( spectrum_common, spectrum_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, X1 / 4) /* This is verified only for the ZX Spectum. Other clones are reported to have different clocks */ + MCFG_CPU_PROGRAM_MAP(spectrum_mem) + MCFG_CPU_IO_MAP(spectrum_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", spectrum_state, spec_interrupt) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, spectrum ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + + MCFG_SCREEN_RAW_PARAMS(X1 / 2, 448, 0, 352, 312, 0, 296) + + MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_spectrum) + MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_spectrum) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(spectrum_state, spectrum ) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", spectrum) + MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_SNAPSHOT_ADD("snapshot", spectrum_state, spectrum, "ach,frz,plusd,prg,sem,sit,sna,snp,snx,sp,z80,zx", 0) + MCFG_QUICKLOAD_ADD("quickload", spectrum_state, spectrum, "raw,scr", 2) // The delay prevents the screen from being cleared by the RAM test at boot + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(tzx_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("spectrum_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "spectrum_cass") + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "spectrum_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(spectrum_state, spectrum_cart) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "spectrum_cart") +MACHINE_CONFIG_END + +MACHINE_CONFIG_DERIVED( spectrum, spectrum_common ) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) // This configuration is verified only for the original ZX Spectrum. + MCFG_RAM_DEFAULT_SIZE("48K") // It's likely, but still to be checked, that many clones were produced only + MCFG_RAM_EXTRA_OPTIONS("16K") // in the 48k configuration, while others have extra memory (80k, 128K, 1024K) + MCFG_RAM_DEFAULT_VALUE(0xff) // available via bankswitching. +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(spectrum) + ROM_REGION(0x10000,"maincpu",0) + ROM_SYSTEM_BIOS(0, "en", "English") + ROMX_LOAD("spectrum.rom", 0x0000, 0x4000, CRC(ddee531f) SHA1(5ea7c2b824672e914525d1d5c419d71b84a426a2), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "sp", "Spanish") + ROMX_LOAD("48e.rom", 0x0000, 0x4000, CRC(f051746e) SHA1(9e535e2e24231ccb65e33d107f6d0ceb23e99477), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "bsrom118", "BusySoft Upgrade v1.18") + ROMX_LOAD("bsrom118.rom", 0x0000, 0x4000, CRC(1511cddb) SHA1(ab3c36daad4325c1d3b907b6dc9a14af483d14ec), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "bsrom140", "BusySoft Upgrade v1.40") + ROMX_LOAD("bsrom140.rom", 0x0000, 0x4000, CRC(07017c6d) SHA1(2ee2dbe6ab96b60d7af1d6cb763b299374c21776), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "groot", "De Groot's Upgrade") + ROMX_LOAD("groot.rom", 0x0000, 0x4000, CRC(abf18c45) SHA1(51165cde68e218512d3145467074bc7e786bf307), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "48turbo", "48 Turbo") + ROMX_LOAD("48turbo.rom", 0x0000, 0x4000, CRC(56189781) SHA1(e62a431b0938af414b7ab8b1349a18b3c4407f70), ROM_BIOS(6)) + ROM_SYSTEM_BIOS(6, "psycho", "Maly's Psycho Upgrade") + ROMX_LOAD("psycho.rom", 0x0000, 0x4000, CRC(cd60b589) SHA1(0853e25857d51dd41b20a6dbc8e80f028c5befaa), ROM_BIOS(7)) + ROM_SYSTEM_BIOS(7, "turbo23", "Turbo 2.3") + ROMX_LOAD("turbo2_3.rom", 0x0000, 0x4000, CRC(fd3b0413) SHA1(84ea64af06adaf05e68abe1d69454b4fc6888505), ROM_BIOS(8)) + ROM_SYSTEM_BIOS(8, "turbo44", "Turbo 4.4") + ROMX_LOAD("turbo4_4.rom", 0x0000, 0x4000, CRC(338b6e87) SHA1(21ad93ffe41a4458704c866cca2754f066f6a560), ROM_BIOS(9)) + ROM_SYSTEM_BIOS(9, "imc", "Ian Collier's Upgrade") + ROMX_LOAD("imc.rom", 0x0000, 0x4000, CRC(d1be99ee) SHA1(dee814271c4d51de257d88128acdb324fb1d1d0d), ROM_BIOS(10)) + ROM_SYSTEM_BIOS(10, "plus4", "ZX Spectrum +4") + ROMX_LOAD("plus4.rom",0x0000,0x4000, CRC(7e0f47cb) SHA1(c103e89ef58e6ade0c01cea0247b332623bd9a30), ROM_BIOS(11)) + ROM_SYSTEM_BIOS(11, "deutsch", "German unofficial (Andrew Owen)") + ROMX_LOAD("deutsch.rom",0x0000,0x4000, CRC(1a9190f4) SHA1(795c20324311dd5a56300e6e4ec49b0a694ac0b3), ROM_BIOS(12)) + ROM_SYSTEM_BIOS(12, "hdt", "HDT-ISO HEX-DEC-TEXT") + ROMX_LOAD("hdt-iso.rom",0x0000,0x4000, CRC(b81c570c) SHA1(2a9745ba3b369a84c4913c98ede66ec87cb8aec1), ROM_BIOS(13)) + ROM_SYSTEM_BIOS(13, "sc", "The Sea Change Minimal ROM V1.78") + ROMX_LOAD("sc01.rom",0x0000,0x4000, CRC(73b4057a) SHA1(c58ff44a28db47400f09ed362ca0527591218136), ROM_BIOS(14)) + ROM_SYSTEM_BIOS(14, "gosh", "GOSH Wonderful ZX Spectrum ROM V1.32") + ROMX_LOAD("gw03.rom",0x0000,0x4000, CRC(5585d7c2) SHA1(a701c3d4b698f7d2be537dc6f79e06e4dbc95929), ROM_BIOS(15)) + ROM_SYSTEM_BIOS(15, "1986es", "1986ES Snapshot") + ROMX_LOAD("1986es.rom",0x0000,0x4000, CRC(9e0fdaaa) SHA1(f9d23f25640c51bcaa63e21ed5dd66bb2d5f63d4), ROM_BIOS(16)) + ROM_SYSTEM_BIOS(16, "jgh", "JGH ROM V0.74 (C) J.G.Harston") + ROMX_LOAD("jgh.rom",0x0000,0x4000, CRC(7224138e) SHA1(d7f02ed66455f1c08ac0c864c7038a92a88ba94a), ROM_BIOS(17)) + ROM_SYSTEM_BIOS(17, "iso22", "ISO ROM V2.2") + ROMX_LOAD("isomoje.rom",0x0000,0x4000, CRC(62ab3640) SHA1(04adbdb1380d6ccd4ab26ddd61b9ccbba462a60f), ROM_BIOS(18)) + ROM_SYSTEM_BIOS(18, "iso8", "ISO ROM 8") + ROMX_LOAD("iso8bm.rom",0x0000,0x4000, CRC(43e9c2fd) SHA1(5752e6f789769475711b91e0a75911fa5232c767), ROM_BIOS(19)) +ROM_END + +ROM_START(specide) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("zxide.rom", 0x0000, 0x4000, CRC(bd48db54) SHA1(54c2aa958902b5395c260770a0b25c7ba5685de9)) +ROM_END + +ROM_START(spec80k) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("80-lec.rom", 0x0000, 0x4000, CRC(5b5c92b1) SHA1(bb7a77d66e95d2e28ebb610e543c065e0d428619)) +ROM_END + +ROM_START(tk90x) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("tk90x.rom",0x0000,0x4000, CRC(3e785f6f) SHA1(9a943a008be13194fb006bddffa7d22d2277813f)) +ROM_END + +ROM_START(tk95) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("tk95.rom",0x0000,0x4000, CRC(17368e07) SHA1(94edc401d43b0e9a9cdc1d35de4b6462dc414ab3)) +ROM_END + +ROM_START(inves) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("inves.rom",0x0000,0x4000, CRC(8ff7a4d1) SHA1(d020440638aff4d39467128413ef795677be9c23)) +ROM_END + +/* Romanian clones */ +ROM_START(hc85) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("hc85.rom",0x0000,0x4000, CRC(3ab60fb5) SHA1(a4189db0bcdf8b39ed782b398828efb408fc4817)) +ROM_END + +ROM_START( hc88 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "hc88.bin", 0x0000, 0x0800, CRC(33be5134) SHA1(b15a6e7085710de8b818e42d329707cb737627e3)) +ROM_END + +ROM_START(hc90) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("hc90.rom",0x0000,0x4000, CRC(78c14d9a) SHA1(25ef81905bed90497a749770170c24632efb2039)) +ROM_END + +ROM_START(hc91) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("hc91.rom",0x0000,0x4000, CRC(8bf53761) SHA1(967d5179ba2823e9c8dd9ddfb0430465aaddb554)) +ROM_END + +ROM_START(cip03) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("cip03.rom",0x0000,0x4000, CRC(c7d0cd3c) SHA1(811055b44fc74076137e2bf8db206b2a70287cc2)) +ROM_END + +ROM_START(cip01) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("cip01.rom",0x0000,0x4000, CRC(0516a329) SHA1(4e3e0c5719a64d3b4fb224db499b4bef7d146917)) +ROM_END + +ROM_START(jet) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("jet.rom",0x0000,0x4000, CRC(e56a7d11) SHA1(e76be9ee71bae6aa1c2ff969276fb599ed68cb50)) +ROM_END + +ROM_START( cobrasp ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v1", "V1") + ROMX_LOAD( "boot64k_v1.bin", 0x0000, 0x0800, CRC(a54aae6d) SHA1(8f5134ce24aea59065ed166ad79e864e17ce812f), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "V2") + ROMX_LOAD( "boot64k_v2.bin", 0x0000, 0x0800, CRC(ee91cc89) SHA1(37dea7fe0734068adf99b91fdcbf3119095c350d), ROM_BIOS(2)) +ROM_END + +ROM_START( cobra80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v1", "V1") + ROMX_LOAD( "boot80k_v1.bin", 0x0000, 0x0800, CRC(f42d2342) SHA1(8aa1b3b056e311674a051ffc6a49af60cae409f3), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "v2", "V2") + ROMX_LOAD( "boot80k_v2.bin", 0x0000, 0x0800, CRC(df6bd954) SHA1(5b858b59e697d0368ea631ead14f5b2aa7954ccd), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "v3", "V3") + ROMX_LOAD( "boot80k_v3.bin", 0x0000, 0x0800, CRC(8580494c) SHA1(91af3f3fa50f2071f8ff081536bdf7e21e9823d9), ROM_BIOS(3)) +ROM_END + +/* Czechoslovakian clones*/ + +/* TODO: need to add memory handling for 80K RAM */ + +ROM_START(dgama87) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("dgama87.rom",0x0000,0x4000, CRC(43104909) SHA1(f62d1f3f35fda467cae468e890995614f6ec2357)) +ROM_END + +ROM_START(dgama88) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("dgama88.rom",0x0000,0x4000, CRC(4ec7e078) SHA1(09a91f85e82efa7f974d1b88c69636a02063d563)) +ROM_END + +ROM_START(dgama89) + ROM_REGION(0x10000,"maincpu",0) + ROM_SYSTEM_BIOS(0, "default", "Original") + ROMX_LOAD("dgama89.rom",0x0000,0x4000, CRC(45c29401) SHA1(8466a9da0169666210ccff5d43376d70bae0ae9b), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "g81", "Gama 81") + ROMX_LOAD("g81.rom",0x0000,0x4000, CRC(c169a63b) SHA1(71652005c2e7a4301caa7e95ae989b69cb5a6a0d), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "iso", "ISO") + ROMX_LOAD("iso.rom",0x0000,0x4000, CRC(2ee3a992) SHA1(2e39995dd032036d33a6dd88a38b750057bca19d), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "isopolak", "ISO Polak") + ROMX_LOAD("isopolak.rom",0x0000,0x4000, CRC(5e3f1f66) SHA1(61713117c944fc6afcb96c647bdba5ad36fd6a4b), ROM_BIOS(4)) +ROM_END + +ROM_START(didakt90) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("didakt90.rom",0x0000,0x4000, CRC(76f2db1e) SHA1(daee355a8ee58bc406873c1dd81eecb6161dd4bd)) +ROM_END + +ROM_START(didakm91) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("didakm91.rom",0x0000,0x4000, CRC(beab69b8) SHA1(71d4d1a05fb936f616bcb05c3a276f79343ecd4d)) +ROM_END + +ROM_START(didakm92) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("didakm92.bin",0x0000,0x4000, CRC(57264d4f) SHA1(23644fe949cbf527747959d07b72db01de378c4c)) +ROM_END + +ROM_START(didaktk) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("didaktk.rom",0x0000,0x4000, CRC(8ec8a625) SHA1(cba35517d33a5c97e3d9110f12a417c6c5cdeca8)) +ROM_END + +ROM_START(didakm93) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("didakm93.rom",0x0000,0x4000, CRC(ec274b1b) SHA1(a3470d8d1a996ee2a1ffff8bd8044da6e907e07e)) +ROM_END + +ROM_START(mistrum) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("mistrum.rom",0x0000,0x4000, CRC(d496103e) SHA1(cca1c5b059dc3a29ca4282e8621e34a65efaa1a3)) +ROM_END + +/* Russian clones */ + +ROM_START(blitzs) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("blitz.rom",0x0000,0x4000, CRC(91e535a8) SHA1(14f09d45dc3803cbdb05c33adb28eb12dbad9dd0)) +ROM_END + +ROM_START(byte) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("byte.rom",0x0000,0x4000, CRC(c13ba473) SHA1(99f40727185abbb2413f218d69df021ae2e99e45)) +ROM_END + +ROM_START(orizon) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("orizon.rom",0x0000,0x4000, CRC(ed4d9787) SHA1(3e8b29862e06be03344393c320a64a109fd9aff5)) +ROM_END + +ROM_START(quorum48) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("quorum48.rom",0x0000,0x4000, CRC(48085b0e) SHA1(8e01581643f7bdfa773f68207a6437911b631e53)) +ROM_END + +ROM_START(magic6) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("magic6.rom",0x0000,0x4000, CRC(cb63ae06) SHA1(533ad1f50534e6bdeec50eb5a9a4976c3d010dc7)) +ROM_END + +ROM_START(compani1) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("compani1.rom",0x0000,0x4000, CRC(bcfa6068) SHA1(40074b55c91a947698598e9d6ac5b8495e8cc840)) +ROM_END + +ROM_START(spektrbk) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("spektr-bk001.rom", 0x0000, 0x4000, CRC(c011eecc) SHA1(35fdc8cd083e50452655997a997873627b131520)) +ROM_END + +ROM_START(zvezda) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD( "2764-near-cpu_red.bin", 0x0000, 0x2000, CRC(a4ae4938) SHA1(ea1763b9dee29381ddcf882fbc4e404ba5366942)) + ROM_LOAD( "2764-far-cpu_blue.bin", 0x2000, 0x2000, CRC(ebab64bc) SHA1(8c98a8b6e927b02cf602c20a1b50838e60f7785b)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1982, spectrum, 0, 0, spectrum, spectrum, spectrum_state, spectrum, "Sinclair Research Ltd", "ZX Spectrum" , 0) +COMP( 1987, spec80k, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "ZX Spectrum 80K" , MACHINE_UNOFFICIAL) +COMP( 1995, specide, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "ZX Spectrum IDE" , MACHINE_UNOFFICIAL) +COMP( 1986, inves, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Investronica", "Inves Spectrum 48K+" , 0) +COMP( 1985, tk90x, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Micro Digital", "TK 90X Color Computer" , 0) +COMP( 1986, tk95, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Micro Digital", "TK 95 Color Computer" , 0) +COMP( 1985, hc85, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ICE-Felix", "HC-85" , 0) +COMP( 1988, hc88, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ICE-Felix", "HC-88" , MACHINE_NOT_WORKING) +COMP( 1990, hc90, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ICE-Felix", "HC-90" , 0) +COMP( 1991, hc91, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "ICE-Felix", "HC-91" , 0) +COMP( 1988, cobrasp, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ITCI", "Cobra (ITCI)" , MACHINE_NOT_WORKING) +COMP( 1988, cobra80, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ITCI", "Cobra 80K (ITCI)" , MACHINE_NOT_WORKING) +COMP( 1987, cip01, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Electronica", "CIP-01" , 0) // keyboard should be spectrum, but image was not clear +COMP( 1988, cip03, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Electronica", "CIP-03" , 0) // keyboard should be spectrum, but image was not clear +COMP( 1990, jet, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Electromagnetica", "JET" , 0) // keyboard should be spectrum, but image was not clear +COMP( 1987, dgama87, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik Gama 87" , 0) +COMP( 1988, dgama88, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik Gama 88" , 0) +COMP( 1989, dgama89, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik Gama 89" , 0) +COMP( 1990, didakt90, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik 90" , 0) +COMP( 1991, didakm91, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik M 91" , 0) +COMP( 1992, didakm92, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik M 92" , 0) +COMP( 1992, didaktk, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik Kompakt" , 0) +COMP( 1993, didakm93, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik M 93" , 0) +COMP( 1988, mistrum, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Amaterske RADIO", "Mistrum" , 0) // keyboard could be spectrum in some models (since it was a build-yourself design) +COMP( 1990, blitzs, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Blic" , 0) // no keyboard images found +COMP( 1990, byte, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Byte" , 0) // no keyboard images found +COMP( 199?, orizon, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Orizon-Micro" , 0) // no keyboard images found +COMP( 1993, quorum48, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Kvorum 48K" , MACHINE_NOT_WORKING) +COMP( 1993, magic6, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Magic 6" , MACHINE_NOT_WORKING) // keyboard should be spectrum, but image was not clear +COMP( 1990, compani1, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Kompanion 1" , 0) // no keyboard images found +COMP( 1990, spektrbk, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Spektr BK-001" , 0) +COMP( 1990, zvezda, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Zvezda" , 0) diff --git a/src/mame/drivers/squale.c b/src/mame/drivers/squale.c new file mode 100644 index 00000000000..def2dd00257 --- /dev/null +++ b/src/mame/drivers/squale.c @@ -0,0 +1,99 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Apollo 7 Squale + + PCB Ref Qty Manufacturer Ref Description / Datasheet + ============================================================================================ + U1 1 EF6809P 8-BIT MICROPROCESSOR UNIT (MPU) + U2 1 27C32 / 27C64 EPROM + U72,U75 1 EF6821P PERIPHERAL INTERFACE ADAPTER (PIA) + U69 1 EF6850 ASYNCHRONOUS COMMUNICATIONS INTERFACE ADAPTER (ACIA) + U59 1 EF9365P GRAPHIC DISPLAY PROCESSOR (GDP) + U65 1 AY-3-8910A PROGRAMMABLE SOUND GENERATOR + U16,U17,U18,U19, + U20,U21,U22,U23 8 MK4564 65,536 x 1-BIT DYNAMIC RAM + U38,U39,U40,U41, + U42,U43,U44,U45, + U46,U47,U48,U49, + U50,U51,U52,U53 16 TMS4116 16,384-BIT DYNAMIC RAM + U68 1 EFB7510 SINGLE CHIP ASYNCHRONOUS FSK MODEM + + + Memory map + ========== + + Periphiriques Adresses + ========================================================= + EPROM 0xF100-0xFFFF + Extension Port 0xF080-0xF0FF + FREE 0xF070-0xF07F + AY-3-8910A 0xF060-0xF06F + ACIA EF6850 (Modem + K7) 0xF050-0xF05F + Restricted area 0xF04C-0xF04F + PIO EF6821 (Printer + Cartridge) 0xF048-0xF04B + PIO EF6821 (Keyboard) 0xF044-0xF047 + FREE 0xF040-0xF043 + VID_RD2 0xF030-0xF03F + VID_RD1 0xF020-0xF02F + REG1 0xF010-0xF01F + Video Controller EF9365 0xF000-0xF00F + System RAM 0x0000-0xEFFF + + + Notes: + 1) For 8KB versions of the monitor, the bank switching is done via bit 7 of REG1. + 2) VID_RD1 : [7..0] = I0,R0,G0,B0,I1,R1,G1,B1 (I=Intensity,R=Red,G=Green,B=Blue) + 3) VID_RD2 : [7..0] = I2,R2,G2,B2,I3,R3,G3,B3 (I=Intensity,R=Red,G=Green,B=Blue) + 3) REG1 : [7..0] = EPROM Bank,-,Modem,K7,I,R,G,B (I=Intensity,R=Red,V=Green,B=Blue) +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" + +class squale_state : public driver_device +{ +public: + squale_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + +private: + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(squale_mem, AS_PROGRAM, 8, squale_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000,0xefff) AM_RAM + AM_RANGE(0xf100,0xffff) AM_ROM AM_REGION("maincpu", 0x100) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( squale_io, AS_IO, 8, squale_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( squale ) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( squale, squale_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6809, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(squale_mem) + MCFG_CPU_IO_MAP(squale_io) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( squale ) + ROM_REGION( 0x2000, "maincpu", 0 ) + ROM_LOAD( "sqm2r1.bin", 0x0000, 0x2000, CRC(ed57c707) SHA1(c8bd33a6fb07fe7f881f2605ad867b7e82366bfc) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, squale, 0, 0, squale, squale,driver_device, 0, "Apollo 7", "Squale", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/ssem.c b/src/mame/drivers/ssem.c new file mode 100644 index 00000000000..4f3e96d4abf --- /dev/null +++ b/src/mame/drivers/ssem.c @@ -0,0 +1,655 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/* + Manchester Small-Scale Experimental Machine (SSEM) + + Driver by MooglyGuy +*/ + + +#include "emu.h" +#include "cpu/ssem/ssem.h" +#include "imagedev/snapquik.h" + +// for now, make buggy GCC/Mingw STFU about I64FMT +#if (defined(__MINGW32__) && (__GNUC__ >= 5)) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wformat-extra-args" +#endif + +class ssem_state : public driver_device +{ +public: + ssem_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_store(*this, "store"), + m_screen(*this, "screen") { } + + required_device m_maincpu; + required_shared_ptr m_store; + required_device m_screen; + + UINT8 m_store_line; + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update_ssem(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_INPUT_CHANGED_MEMBER(panel_check); + DECLARE_QUICKLOAD_LOAD_MEMBER(ssem_store); + inline UINT32 reverse(UINT32 v); + void glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...) ATTR_PRINTF(5,6); + void strlower(char *buf); +}; + + + +/****************************************************\ +* General helper functions * +\****************************************************/ + +// The SSEM stores its data, visually, with the leftmost bit corresponding to the least significant bit. +// The de facto snapshot format for other SSEM simulators stores the data physically in that format as well. +// Therefore, in MESS, every 32-bit word has its bits reversed, too, and as a result the values must be +// un-reversed before being used. +inline UINT32 ssem_state::reverse(UINT32 v) +{ + // Taken from http://www.graphics.stanford.edu/~seander/bithacks.html#ReverseParallel + // swap odd and even bits + v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1); + // swap consecutive pairs + v = ((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2); + // swap nibbles ... + v = ((v >> 4) & 0x0F0F0F0F) | ((v & 0x0F0F0F0F) << 4); + // swap bytes + v = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8); + // swap 2-byte long pairs + v = ( v >> 16 ) | ( v << 16); + + return v; +} + +/****************************************************\ +* Address map * +\****************************************************/ + +static ADDRESS_MAP_START( ssem_map, AS_PROGRAM, 8, ssem_state ) + AM_RANGE(0x00, 0x7f) AM_RAM AM_SHARE("store")// Primary store +ADDRESS_MAP_END + +/****************************************************\ +* Input ports and front panel handling * +\****************************************************/ + +enum +{ + // Bit-edit buttons + PANEL_BIT0, PANEL_BIT1, PANEL_BIT2, PANEL_BIT3, PANEL_BIT4, PANEL_BIT5, PANEL_BIT6, PANEL_BIT7, + PANEL_BIT8, PANEL_BIT9, PANEL_BIT10, PANEL_BIT11, PANEL_BIT12, PANEL_BIT13, PANEL_BIT14, PANEL_BIT15, + PANEL_BIT16, PANEL_BIT17, PANEL_BIT18, PANEL_BIT19, PANEL_BIT20, PANEL_BIT21, PANEL_BIT22, PANEL_BIT23, + PANEL_BIT24, PANEL_BIT25, PANEL_BIT26, PANEL_BIT27, PANEL_BIT28, PANEL_BIT29, PANEL_BIT30, PANEL_BIT31, + + // Page up, page down + PANEL_PGUP, PANEL_PGDN, + + // Line up, line down + PANEL_LNUP, PANEL_LNDN, + + // Halt + PANEL_HALT +}; + +INPUT_CHANGED_MEMBER(ssem_state::panel_check) +{ + UINT8 edit0_state = ioport("EDIT0")->read(); + UINT8 edit1_state = ioport("EDIT1")->read(); + UINT8 edit2_state = ioport("EDIT2")->read(); + UINT8 edit3_state = ioport("EDIT3")->read(); + UINT8 misc_state = ioport("MISC")->read(); + + switch( (int)(FPTR)param ) + { + case PANEL_BIT0: + if(edit0_state & 0x01) m_store[(m_store_line << 2) | 0] ^= 0x80; + break; + case PANEL_BIT1: + if(edit0_state & 0x02) m_store[(m_store_line << 2) | 0] ^= 0x40; + break; + case PANEL_BIT2: + if(edit0_state & 0x04) m_store[(m_store_line << 2) | 0] ^= 0x20; + break; + case PANEL_BIT3: + if(edit0_state & 0x08) m_store[(m_store_line << 2) | 0] ^= 0x10; + break; + case PANEL_BIT4: + if(edit0_state & 0x10) m_store[(m_store_line << 2) | 0] ^= 0x08; + break; + case PANEL_BIT5: + if(edit0_state & 0x20) m_store[(m_store_line << 2) | 0] ^= 0x04; + break; + case PANEL_BIT6: + if(edit0_state & 0x40) m_store[(m_store_line << 2) | 0] ^= 0x02; + break; + case PANEL_BIT7: + if(edit0_state & 0x80) m_store[(m_store_line << 2) | 0] ^= 0x01; + break; + case PANEL_BIT8: + if(edit1_state & 0x01) m_store[(m_store_line << 2) | 1] ^= 0x80; + break; + case PANEL_BIT9: + if(edit1_state & 0x02) m_store[(m_store_line << 2) | 1] ^= 0x40; + break; + case PANEL_BIT10: + if(edit1_state & 0x04) m_store[(m_store_line << 2) | 1] ^= 0x20; + break; + case PANEL_BIT11: + if(edit1_state & 0x08) m_store[(m_store_line << 2) | 1] ^= 0x10; + break; + case PANEL_BIT12: + if(edit1_state & 0x10) m_store[(m_store_line << 2) | 1] ^= 0x08; + break; + case PANEL_BIT13: + if(edit1_state & 0x20) m_store[(m_store_line << 2) | 1] ^= 0x04; + break; + case PANEL_BIT14: + if(edit1_state & 0x40) m_store[(m_store_line << 2) | 1] ^= 0x02; + break; + case PANEL_BIT15: + if(edit1_state & 0x80) m_store[(m_store_line << 2) | 1] ^= 0x01; + break; + case PANEL_BIT16: + if(edit2_state & 0x01) m_store[(m_store_line << 2) | 2] ^= 0x80; + break; + case PANEL_BIT17: + if(edit2_state & 0x02) m_store[(m_store_line << 2) | 2] ^= 0x40; + break; + case PANEL_BIT18: + if(edit2_state & 0x04) m_store[(m_store_line << 2) | 2] ^= 0x20; + break; + case PANEL_BIT19: + if(edit2_state & 0x08) m_store[(m_store_line << 2) | 2] ^= 0x10; + break; + case PANEL_BIT20: + if(edit2_state & 0x10) m_store[(m_store_line << 2) | 2] ^= 0x08; + break; + case PANEL_BIT21: + if(edit2_state & 0x20) m_store[(m_store_line << 2) | 2] ^= 0x04; + break; + case PANEL_BIT22: + if(edit2_state & 0x40) m_store[(m_store_line << 2) | 2] ^= 0x02; + break; + case PANEL_BIT23: + if(edit2_state & 0x80) m_store[(m_store_line << 2) | 2] ^= 0x01; + break; + case PANEL_BIT24: + if(edit3_state & 0x01) m_store[(m_store_line << 2) | 3] ^= 0x80; + break; + case PANEL_BIT25: + if(edit3_state & 0x02) m_store[(m_store_line << 2) | 3] ^= 0x40; + break; + case PANEL_BIT26: + if(edit3_state & 0x04) m_store[(m_store_line << 2) | 3] ^= 0x20; + break; + case PANEL_BIT27: + if(edit3_state & 0x08) m_store[(m_store_line << 2) | 3] ^= 0x10; + break; + case PANEL_BIT28: + if(edit3_state & 0x10) m_store[(m_store_line << 2) | 3] ^= 0x08; + break; + case PANEL_BIT29: + if(edit3_state & 0x20) m_store[(m_store_line << 2) | 3] ^= 0x04; + break; + case PANEL_BIT30: + if(edit3_state & 0x40) m_store[(m_store_line << 2) | 3] ^= 0x02; + break; + case PANEL_BIT31: + if(edit3_state & 0x80) m_store[(m_store_line << 2) | 3] ^= 0x01; + break; + case PANEL_LNUP: + if(misc_state & 0x01) + { + m_store_line--; + } + break; + case PANEL_LNDN: + if(misc_state & 0x02) + { + m_store_line++; + } + break; + case PANEL_HALT: + if(misc_state & 0x04) + { + m_maincpu->set_state_int(SSEM_HALT, 1 - m_maincpu->state_int(SSEM_HALT)); + } + break; + } +} + +static INPUT_PORTS_START( ssem ) + PORT_START("EDIT0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 0") PORT_CODE(KEYCODE_1) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT0) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 1") PORT_CODE(KEYCODE_2) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 2") PORT_CODE(KEYCODE_3) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 3") PORT_CODE(KEYCODE_4) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT3) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 4") PORT_CODE(KEYCODE_5) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 5") PORT_CODE(KEYCODE_6) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT5) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 6") PORT_CODE(KEYCODE_7) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT6) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 7") PORT_CODE(KEYCODE_8) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT7) + + PORT_START("EDIT1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 8") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT8) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 9") PORT_CODE(KEYCODE_W) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT9) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 10") PORT_CODE(KEYCODE_E) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT10) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 11") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT11) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 12") PORT_CODE(KEYCODE_T) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT12) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 13") PORT_CODE(KEYCODE_Y) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT13) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 14") PORT_CODE(KEYCODE_U) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT14) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 15") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT15) + + PORT_START("EDIT2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 16") PORT_CODE(KEYCODE_A) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT16) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 17") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT17) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 18") PORT_CODE(KEYCODE_D) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT18) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 19") PORT_CODE(KEYCODE_F) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT19) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 20") PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT20) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 21") PORT_CODE(KEYCODE_H) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT21) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 22") PORT_CODE(KEYCODE_J) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT22) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 23") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT23) + + PORT_START("EDIT3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 24") PORT_CODE(KEYCODE_Z) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT24) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 25") PORT_CODE(KEYCODE_X) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT25) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 26") PORT_CODE(KEYCODE_C) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT26) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 27") PORT_CODE(KEYCODE_V) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT27) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 28") PORT_CODE(KEYCODE_B) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT28) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 29") PORT_CODE(KEYCODE_N) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT29) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 30") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT30) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 31") PORT_CODE(KEYCODE_COMMA) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT31) + + PORT_START("MISC") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Line Up") PORT_CODE(KEYCODE_UP) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_LNUP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Line Down") PORT_CODE(KEYCODE_DOWN) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_LNDN) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Halt") PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_HALT) + PORT_BIT(0xf8, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +/****************************************************\ +* Video hardware * +\****************************************************/ + +static const UINT8 char_glyphs[0x80][8] = +{ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x10, 0x38, 0x10, 0x00, 0x00, 0x00 }, + { 0x38, 0x7c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x00 }, + { 0xff, 0xff, 0xef, 0xc7, 0xef, 0xff, 0xff, 0xff }, + { 0xc7, 0x83, 0x01, 0x01, 0x01, 0x83, 0xc7, 0xff }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00 }, + { 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00 }, + { 0x18, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x18, 0x00 }, + { 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00 }, + { 0x78, 0xcc, 0x78, 0x70, 0xce, 0xcc, 0x7e, 0x00 }, + { 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00 }, + { 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00 }, + { 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00 }, + { 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30 }, + { 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 }, + { 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00 }, + { 0x3c, 0x66, 0x76, 0x7e, 0x6e, 0x66, 0x3c, 0x00 }, + { 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 }, + { 0x3c, 0x66, 0x06, 0x0c, 0x30, 0x60, 0x7e, 0x00 }, + { 0x3c, 0x66, 0x06, 0x0c, 0x06, 0x66, 0x3c, 0x00 }, + { 0x66, 0x66, 0x66, 0x7e, 0x06, 0x06, 0x06, 0x00 }, + { 0x7e, 0x60, 0x7c, 0x06, 0x06, 0x66, 0x3c, 0x00 }, + { 0x3c, 0x66, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00 }, + { 0x7e, 0x66, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x00 }, + { 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00 }, + { 0x3c, 0x66, 0x66, 0x3e, 0x06, 0x66, 0x3c, 0x00 }, + { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00 }, + { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30 }, + { 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00 }, + { 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00 }, + { 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00 }, + { 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00 }, + { 0x3c, 0x66, 0x6e, 0x6e, 0x60, 0x66, 0x3c, 0x00 }, + { 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 }, + { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00 }, + { 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00 }, + { 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00 }, + { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7e, 0x00 }, + { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00 }, + { 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00 }, + { 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 }, + { 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 }, + { 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 }, + { 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00 }, + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00 }, + { 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00 }, + { 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x00 }, + { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 }, + { 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00 }, + { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x06 }, + { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x00 }, + { 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00 }, + { 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 }, + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00 }, + { 0xc6, 0xc6, 0xd6, 0xfe, 0xfe, 0xee, 0xc6, 0x00 }, + { 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00 }, + { 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00 }, + { 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00 }, + { 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00 }, + { 0x80, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00 }, + { 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00 }, + { 0x10, 0x38, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f }, + { 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 }, + { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00 }, + { 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00 }, + { 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00 }, + { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7e, 0x00 }, + { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00 }, + { 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00 }, + { 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 }, + { 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 }, + { 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 }, + { 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00 }, + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00 }, + { 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00 }, + { 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x00 }, + { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 }, + { 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00 }, + { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x06 }, + { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x00 }, + { 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00 }, + { 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 }, + { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00 }, + { 0xc6, 0xc6, 0xd6, 0xfe, 0xfe, 0xee, 0xc6, 0x00 }, + { 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00 }, + { 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00 }, + { 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00 }, + { 0x0c, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00 }, + { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, + { 0x30, 0x18, 0x18, 0x0c, 0x18, 0x18, 0x30, 0x00 }, + { 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 }, + { 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff }, +}; + +void ssem_state::glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...) +{ + va_list arg_list; + char buf[32768]; + INT32 index = 0; + const rectangle &visarea = m_screen->visible_area(); + + va_start( arg_list, msg ); + vsprintf( buf, msg, arg_list ); + va_end( arg_list ); + + for(index = 0; index < strlen(buf) && index < 32768; index++) + { + UINT8 cur = (UINT8)buf[index]; + if(cur < 0x80) + { + INT32 line = 0; + for(line = 0; line < 8; line++) + { + UINT32 *d = &bitmap.pix32(y + line); + INT32 bit = 0; + for(bit = 0; bit < 8; bit++) + { + if(char_glyphs[cur][line] & (1 << (7 - bit))) + { + d[x+bit] = 0xffffffff; + } + else + { + d[x+bit] = 0; + } + } + } + } + + x += 8; + if(x >= visarea.max_x) + { + x = 0; + y += 8; + if(y >= visarea.max_y) + { + y = 0; + } + } + } +} + +UINT32 ssem_state::screen_update_ssem(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 line = 0; + UINT32 accum = m_maincpu->state_int(SSEM_A); + UINT32 bit = 0; + UINT32 word = 0; + + for(line = 0; line < 32; line++) + { + word = (m_store[(line << 2) | 0] << 24) | + (m_store[(line << 2) | 1] << 16) | + (m_store[(line << 2) | 2] << 8) | + (m_store[(line << 2) | 3] << 0); + for(bit = 0; bit < 32; bit++) + { + if(word & (1 << (31 - bit))) + { + glyph_print(bitmap, bit << 3, line << 3, "%c", line == m_store_line ? 4 : 2); + } + else + { + glyph_print(bitmap, bit << 3, line << 3, "%c", line == m_store_line ? 3 : 1); + } + } + } + + for(bit = 0; bit < 32; bit++) + { + if(accum & (1 << bit)) + { + glyph_print(bitmap, bit << 3, 264, "%c", 2); + } + else + { + glyph_print(bitmap, bit << 3, 264, "%c", 1); + } + } + + word = reverse((m_store[(m_store_line << 2) | 0] << 24) | + (m_store[(m_store_line << 2) | 1] << 16) | + (m_store[(m_store_line << 2) | 2] << 8) | + (m_store[(m_store_line << 2) | 3] << 0)); + glyph_print(bitmap, 0, 272, "LINE:%02d VALUE:%08x HALT:%" I64FMT "d", m_store_line, word, m_maincpu->state_int(SSEM_HALT)); + return 0; +} + +/****************************************************\ +* Image helper functions * +\****************************************************/ + +void ssem_state::strlower(char *buf) +{ + if(buf) + { + int i = 0; + for(i = 0; i < strlen(buf); i++) + { + if(buf[i] >= 'A' && buf[i] <= 'Z') + { + buf[i] |= 0x20; + } + } + } +} + +/****************************************************\ +* Image loading * +\****************************************************/ + +QUICKLOAD_LOAD_MEMBER(ssem_state, ssem_store) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + char image_line[100] = { 0 }; + char token_buf[100] = { 0 }; + int num_lines = 0; + + image.fgets(image_line, 99); + sscanf(image_line, "%d", &num_lines); + + if (num_lines) + { + for (int i = 0; i < num_lines; i++) + { + UINT32 line = 0; + image.fgets(image_line, 99); + + // Isolate and convert 4-digit decimal address + memcpy(token_buf, image_line, 4); + token_buf[4] = '\0'; + sscanf(token_buf, "%04u", &line); + + if (!core_stricmp(image.filetype(), "snp")) + { + UINT32 word = 0; + + // Parse a line such as: 0000:00000110101001000100000100000100 + for (int b = 0; b < 32; b++) + { + if (image_line[5 + b] == '1') + word |= 1 << (31 - b); + } + + space.write_byte((line << 2) + 0, (word >> 24) & 0x000000ff); + space.write_byte((line << 2) + 1, (word >> 16) & 0x000000ff); + space.write_byte((line << 2) + 2, (word >> 8) & 0x000000ff); + space.write_byte((line << 2) + 3, (word >> 0) & 0x000000ff); + } + else if (!core_stricmp(image.filetype(), "asm")) + { + char op_buf[4] = { 0 }; + INT32 value = 0; + UINT32 unsigned_value = 0; + UINT32 word = 0; + + // Isolate the opcode and convert to lower-case + memcpy(op_buf, image_line + 5, 3); + op_buf[3] = '\0'; + strlower(op_buf); + + // Isolate the value + sscanf(image_line + 9, "%d", &value); + unsigned_value = reverse((UINT32)value); + + if (!core_stricmp(op_buf, "num")) + word = unsigned_value; + else if (!core_stricmp(op_buf, "jmp")) + word = 0x00000000 | unsigned_value ; + else if (!core_stricmp(op_buf, "jrp")) + word = 0x00040000 | unsigned_value; + else if (!core_stricmp(op_buf, "ldn")) + word = 0x00020000 | unsigned_value; + else if (!core_stricmp(op_buf, "sto")) + word = 0x00060000 | unsigned_value; + else if (!core_stricmp(op_buf, "sub")) + word = 0x00010000 | unsigned_value; + else if (!core_stricmp(op_buf, "cmp")) + word = 0x00030000 | unsigned_value; + else if (!core_stricmp(op_buf, "stp")) + word = 0x00070000 | unsigned_value; + + space.write_byte((line << 2) + 0, (word >> 24) & 0x000000ff); + space.write_byte((line << 2) + 1, (word >> 16) & 0x000000ff); + space.write_byte((line << 2) + 2, (word >> 8) & 0x000000ff); + space.write_byte((line << 2) + 3, (word >> 0) & 0x000000ff); + } + } + } + + return IMAGE_INIT_PASS; +} + +/****************************************************\ +* Machine definition * +\****************************************************/ + +void ssem_state::machine_start() +{ + save_item(NAME(m_store_line)); +} + +void ssem_state::machine_reset() +{ + m_store_line = 0; +} + +static MACHINE_CONFIG_START( ssem, ssem_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", SSEMCPU, 700) + MCFG_CPU_PROGRAM_MAP(ssem_map) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(256, 280) + MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 279) + MCFG_SCREEN_UPDATE_DRIVER(ssem_state, screen_update_ssem) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", ssem_state, ssem_store, "snp,asm", 1) +MACHINE_CONFIG_END + + +ROM_START( ssem ) + ROM_REGION( 0x80, "maincpu", ROMREGION_ERASE00 ) /* Main Store */ +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP(1948, ssem, 0, 0, ssem, ssem, driver_device, 0, "Manchester University", "Small-Scale Experimental Machine (SSEM), 'Baby'", MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) + +#if (defined(__MINGW32__) && (__GNUC__ >= 5)) +#pragma GCC diagnostic pop +#endif diff --git a/src/mame/drivers/ssystem3.c b/src/mame/drivers/ssystem3.c new file mode 100644 index 00000000000..03240af22b5 --- /dev/null +++ b/src/mame/drivers/ssystem3.c @@ -0,0 +1,337 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + + ssystem3.c + +Driver file to handle emulation of the Chess Champion Super System III / Chess +Champion MK III +by PeT mess@utanet.at November 2000, march 2008 + +Hardware descriptions: +- A 6502 CPU +- A 6522 VIA ($6000?) (PB6 and PB7 are tied) +- 2 x 2114 1kx4 SRAM to provide 1KB of RAM ($0000) +- 2xXXKB ROM (both connected to the same pins!, + look into mess source mess/messroms/rddil24.c for notes) + - signetics 7947e c19081e ss-3-lrom + - signetics 7945e c19082 ss-3-hrom ($d000??) + +optional printer (special serial connection) +optional board display (special serial connection) +internal expansion/cartridge port + (special power saving pack) + + +todo: +not sure about lcd signs and their assignments +not sure about all buttons and switches +playfield displayment currently based on simulation and on screen +not check for audio yet +convert to new artwork system + +needed: +artwork for board display +backup of playfield rom and picture/description of its board +*/ + +#include "emu.h" + +#include "includes/ssystem3.h" +#include "cpu/m6502/m6502.h" +#include "sound/dac.h" + + +// in my opinion own cpu to display lcd field and to handle own buttons +void ssystem3_state::ssystem3_playfield_getfigure(int x, int y, int *figure, int *black) +{ + int d; + if (x&1) + d=m_playfield.u.s.field[y][x/2]&0xf; + else + d=m_playfield.u.s.field[y][x/2]>>4; + + *figure=d&7; + *black=d&8; +} + +void ssystem3_state::ssystem3_playfield_reset() +{ + memset(&m_playfield, 0, sizeof(m_playfield)); + m_playfield.signal=FALSE; + // m_playfield.on=TRUE; //m_configuration->read()&1; +} + +void ssystem3_state::ssystem3_playfield_write(int reset, int signal) +{ + int d=FALSE; + + if (!reset) { + m_playfield.count=0; + m_playfield.bit=0; + m_playfield.started=FALSE; + m_playfield.signal=signal; + m_playfield.time=machine().time(); + } + if (!signal && m_playfield.signal) { + attotime t=machine().time(); + m_playfield.high_time=t - m_playfield.time; + m_playfield.time=t; + + // logerror("%.4x playfield %d lowtime %s hightime %s\n",(int)activecpu_get_pc(), m_playfield.count, + // m_playfield.low_time.as_string(7), m_playfield.high_time.as_string(7) ); + + if (m_playfield.started) { + // 0 twice as long low + // 1 twice as long high + if (m_playfield.low_time > m_playfield.high_time) d=TRUE; + + m_playfield.data&=~(1<<(m_playfield.bit^7)); + if (d) m_playfield.data|=1<<(m_playfield.bit^7); + m_playfield.bit++; + if (m_playfield.bit==8) { + logerror("%.4x playfield wrote %d %02x\n", (int)m_maincpu->pc(), m_playfield.count, m_playfield.data); + m_playfield.u.data[m_playfield.count]=m_playfield.data; + m_playfield.bit=0; + m_playfield.count=(m_playfield.count+1)%ARRAY_LENGTH(m_playfield.u.data); + if (m_playfield.count==0) m_playfield.started=FALSE; + } + } + + } else if (signal && !m_playfield.signal) { + attotime t=machine().time(); + m_playfield.low_time= t - m_playfield.time; + m_playfield.time=t; + m_playfield.started=TRUE; + } + m_playfield.signal=signal; +} + +void ssystem3_state::ssystem3_playfield_read(int *on, int *ready) +{ + *on = !(m_configuration->read() & 1); + // *on=!m_playfield.on; + *ready=FALSE; +} + +WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_a) +{ + m_porta=data; + // logerror("%.4x via port a write %02x\n",(int)activecpu_get_pc(), data); +} + +READ8_MEMBER(ssystem3_state::ssystem3_via_read_a) +{ + UINT8 data=0xff; +#if 1 // time switch + if (!(m_porta&0x10)) data&=m_matrix[0]->read()|0xf1; + if (!(m_porta&0x20)) data&=m_matrix[1]->read()|0xf1; + if (!(m_porta&0x40)) data&=m_matrix[2]->read()|0xf1; + if (!(m_porta&0x80)) data&=m_matrix[3]->read()|0xf1; +#else + if (!(m_porta&0x10)) data&=m_matrix[0]->read()|0xf0; + if (!(m_porta&0x20)) data&=m_matrix[1]->read()|0xf0; + if (!(m_porta&0x40)) data&=m_matrix[2]->read()|0xf0; + if (!(m_porta&0x80)) data&=m_matrix[3]->read()|0xf0; +#endif + if (!(m_porta&1)) { + if (!(m_matrix[0]->read()&1)) data&=~0x10; + if (!(m_matrix[1]->read()&1)) data&=~0x20; + if (!(m_matrix[2]->read()&1)) data&=~0x40; + if (!(m_matrix[3]->read()&1)) data&=~0x80; + } + if (!(m_porta&2)) { + if (!(m_matrix[0]->read()&2)) data&=~0x10; + if (!(m_matrix[1]->read()&2)) data&=~0x20; + if (!(m_matrix[2]->read()&2)) data&=~0x40; + if (!(m_matrix[3]->read()&2)) data&=~0x80; + } + if (!(m_porta&4)) { + if (!(m_matrix[0]->read()&4)) data&=~0x10; + if (!(m_matrix[1]->read()&4)) data&=~0x20; + if (!(m_matrix[2]->read()&4)) data&=~0x40; + if (!(m_matrix[3]->read()&4)) data&=~0x80; + } + if (!(m_porta&8)) { + if (!(m_matrix[0]->read()&8)) data&=~0x10; + if (!(m_matrix[1]->read()&8)) data&=~0x20; + if (!(m_matrix[2]->read()&8)) data&=~0x40; + if (!(m_matrix[3]->read()&8)) data&=~0x80; + } + // logerror("%.4x via port a read %02x\n",(int)activecpu_get_pc(), data); + return data; +} + + +/* + port b + bit 0: output opt device reset? + + hi speed serial 1 (d7d7 transfers 40 bit $2e) + bit 1: output data + bit 2: output clock (hi data is taken) + + bit 3: output opt data read + bit 4: input low opt data available + bit 5: input low opt device available + + + bit 6: input clocks!? + + port a: + bit 7: input low x/$37 2 + bit 6: input low x/$37 3 + bit 5: input low x/$37 4 (else 1) + + */ +READ8_MEMBER(ssystem3_state::ssystem3_via_read_b) +{ + UINT8 data=0xff; + int on, ready; + ssystem3_playfield_read(&on, &ready); + if (!on) data&=~0x20; + if (!ready) data&=~0x10; + return data; +} + +WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_b) +{ + ssystem3_playfield_write(data & 1, data & 8); + ssystem3_lcd_write(data & 4, data & 2); + + // TODO: figure out what this is trying to achieve + UINT8 d = ssystem3_via_read_b(space, 0, mem_mask) & ~0x40; + if (data & 0x80) d |= 0x40; + // d&=~0x8f; + m_via6522_0->write_pb0((d >> 0) & 1); + m_via6522_0->write_pb1((d >> 1) & 1); + m_via6522_0->write_pb2((d >> 2) & 1); + m_via6522_0->write_pb3((d >> 3) & 1); + m_via6522_0->write_pb4((d >> 4) & 1); + m_via6522_0->write_pb5((d >> 5) & 1); + m_via6522_0->write_pb6((d >> 6) & 1); + m_via6522_0->write_pb7((d >> 7) & 1); +} + +DRIVER_INIT_MEMBER(ssystem3_state,ssystem3) +{ + ssystem3_playfield_reset(); + ssystem3_lcd_reset(); +} + +static ADDRESS_MAP_START( ssystem3_map , AS_PROGRAM, 8, ssystem3_state ) + AM_RANGE( 0x0000, 0x03ff) AM_RAM + /* +67-de playfield ($40 means white, $80 black) + */ +// AM_RANGE( 0x4000, 0x40ff) AM_NOP +/* + probably zusatzger??t memory (battery powered ram 256x4? at 0x4000) + $40ff low nibble ram if playfield module (else init with normal playfield) + */ + AM_RANGE( 0x6000, 0x600f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) +#if 1 + AM_RANGE( 0xc000, 0xdfff) AM_ROM + AM_RANGE( 0xf000, 0xffff) AM_ROM +#else + AM_RANGE( 0xc000, 0xffff) AM_ROM +#endif +ADDRESS_MAP_END + +static INPUT_PORTS_START( ssystem3 ) +/* + switches: light(hardware?) sound time power(hardware!) + + new game (hardware?) +*/ + + + PORT_START( "Switches" ) +//PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW GAME") PORT_CODE(KEYCODE_F3) // seems to be direct wired to reset +// PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?CLEAR") PORT_CODE(KEYCODE_F1) +// PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_START( "matrix.0" ) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 C SQ EP") PORT_CODE(KEYCODE_9) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER?") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 C BOARD MD") PORT_CODE(KEYCODE_0) + PORT_START( "matrix.1" ) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 F springer zeitvorgabe") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 E laeufer ruecknahme") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CE interrupt") PORT_CODE(KEYCODE_BACKSPACE) + PORT_START( "matrix.2" ) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 G bauer zugvorschlaege") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 D turm #") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 A white") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) + PORT_START( "matrix.3" ) + PORT_DIPNAME( 0x01, 0, "Time") PORT_CODE(KEYCODE_T) PORT_TOGGLE PORT_DIPSETTING( 0, DEF_STR(Off) ) PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 H black") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 C dame #50") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 B koenig FP") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) + PORT_START( "Configuration" ) + PORT_DIPNAME( 0x0001, 0, "Schachbrett") PORT_TOGGLE + PORT_DIPSETTING( 0, DEF_STR( Off ) ) + PORT_DIPSETTING( 1, "angeschlossen" ) +#if 0 + PORT_DIPNAME( 0x0002, 0, "Memory") PORT_TOGGLE + PORT_DIPSETTING( 0, DEF_STR( Off ) ) + PORT_DIPSETTING( 2, "angeschlossen" ) + PORT_DIPNAME( 0x0004, 0, "Drucker") PORT_TOGGLE + PORT_DIPSETTING( 0, DEF_STR( Off ) ) + PORT_DIPSETTING( 4, "angeschlossen" ) +#endif +INPUT_PORTS_END + + + +static MACHINE_CONFIG_START( ssystem3, ssystem3_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, 1000000) + MCFG_CPU_PROGRAM_MAP(ssystem3_map) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(LCD_FRAMES_PER_SECOND) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(728, 437) + MCFG_SCREEN_VISIBLE_AREA(0, 728-1, 0, 437-1) + MCFG_SCREEN_UPDATE_DRIVER(ssystem3_state, screen_update_ssystem3) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 242 + 32768) + MCFG_PALETTE_INIT_OWNER(ssystem3_state, ssystem3) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + /* via */ + MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) + MCFG_VIA6522_READPA_HANDLER(READ8(ssystem3_state,ssystem3_via_read_a)) + MCFG_VIA6522_READPB_HANDLER(READ8(ssystem3_state,ssystem3_via_read_b)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(ssystem3_state,ssystem3_via_write_a)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(ssystem3_state,ssystem3_via_write_b)) +MACHINE_CONFIG_END + + +ROM_START(ssystem3) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("ss3lrom", 0xc000, 0x1000, CRC(9ea46ed3) SHA1(34eef85b356efbea6ddac1d1705b104fc8e2731a) ) +// ROM_RELOAD(0xe000, 0x1000) + ROM_LOAD("ss3hrom", 0xf000, 0x1000, CRC(52741e0b) SHA1(2a7b950f9810c5a14a1b9d5e6b2bd93da621662e) ) + ROM_RELOAD(0xd000, 0x1000) +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS( 1979, ssystem3, 0, 0, ssystem3, ssystem3, ssystem3_state, ssystem3, "NOVAG Industries Ltd", "Chess Champion Super System III", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +//chess champion MK III in germany diff --git a/src/mame/drivers/stratos.c b/src/mame/drivers/stratos.c new file mode 100644 index 00000000000..3ad13837193 --- /dev/null +++ b/src/mame/drivers/stratos.c @@ -0,0 +1,370 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + Saitek/Scisys Kasparov Stratos Chess Computer + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m65c02.h" +#include "machine/nvram.h" + +class stratos_state : public driver_device +{ +public: + stratos_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + maincpu(*this, "maincpu"), + nvram(*this, "nvram"), + bank_8000(*this, "bank_8000"), + bank_4000(*this, "bank_4000"), + nvram_bank(*this, "nvram_bank") + { } + + required_device maincpu; + required_device nvram; + required_memory_bank bank_8000; + required_memory_bank bank_4000; + required_memory_bank nvram_bank; + + UINT8 *nvram_data; + UINT8 control, led_latch_control; + UINT32 individual_leds; + UINT8 latch_AH_red, latch_AH_green, latch_18_red, latch_18_green; + + DECLARE_DRIVER_INIT(stratos); + DECLARE_WRITE8_MEMBER(p2000_w); + DECLARE_READ8_MEMBER(p2200_r); + DECLARE_WRITE8_MEMBER(p2200_w); + DECLARE_WRITE8_MEMBER(p2400_w); + DECLARE_READ8_MEMBER(control_r); + DECLARE_WRITE8_MEMBER(control_w); + DECLARE_READ8_MEMBER(lcd_r); + DECLARE_WRITE8_MEMBER(lcd_w); + + TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); + + void show_leds(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void machine_reset(); +}; + +DRIVER_INIT_MEMBER( stratos_state, stratos ) +{ + nvram_data = auto_alloc_array(machine(), UINT8, 0x2000); + nvram->set_base(nvram_data, 0x2000); + + bank_8000 ->configure_entries(0, 4, memregion("roms_8000")->base(), 0x8000); + bank_4000 ->configure_entries(0, 4, memregion("roms_4000")->base(), 0x4000); + nvram_bank->configure_entries(0, 2, nvram_data, 0x1000); +} + +void stratos_state::machine_reset() +{ + control = 0x00; + led_latch_control = 0x00; + individual_leds = 0x00000; + latch_AH_red = 0; + latch_AH_green = 0; + latch_18_red = 0; + latch_18_green = 0; + bank_8000 ->set_entry(0); + bank_4000 ->set_entry(0); + nvram_bank->set_entry(0); +} + +void stratos_state::show_leds() +{ + static const char *led_pos[18] = { + 0, 0, "gPawn", "gKnight", "gBishop", "gRook", "gQueen", "gKing", 0, 0, "rPawn", "rKnight", "rBishop", "rRook", "rQueen", "rKing", 0, 0 + }; + char str_red[64]; + char str_green[64]; + + char *pr = str_red; + char *pg = str_green; + + *pr = *pg = 0; + + for(int i=0; i != 18; i++) + if(individual_leds & (1 << i)) { + const char *pos = led_pos[i]; + if(!pos) + pr += sprintf(pr, " <%d>", i); + else if(pos[0] == 'r') + pr += sprintf(pr, " %s", pos+1); + else + pg += sprintf(pg, " %s", pos+1); + } + + // Obviously slightly incorrect + if(!(led_latch_control & 8)) { + pr += sprintf(pr, " %c%c", 'A' + latch_AH_red, '1' + latch_18_red); + pg += sprintf(pg, " %c%c", 'A' + latch_AH_green, '1' + latch_18_green); + } + + logerror("leds R:%s -- G:%s (%s)\n", str_red, str_green, machine().describe_context()); +} + +TIMER_DEVICE_CALLBACK_MEMBER(stratos_state::irq_timer) +{ + maincpu->set_input_line(M65C02_IRQ_LINE, HOLD_LINE); +} + +UINT32 stratos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + static bool nmi=false; + + if(machine().input().code_pressed(KEYCODE_W)) { + if(!nmi) { + maincpu->set_input_line(M65C02_NMI_LINE, PULSE_LINE); + nmi = true; + } + } else + nmi = false; + + + return 0; +} + +WRITE8_MEMBER(stratos_state::p2000_w) +{ + led_latch_control = data; + + if(!(data & 0x10)) + latch_18_red = data & 7; + if(!(data & 0x20)) + latch_18_green = data & 7; + if(!(data & 0x40)) + latch_AH_red = data & 7; + if(!(data & 0x80)) + latch_AH_green = data & 7; + + show_leds(); +} + +READ8_MEMBER(stratos_state::p2200_r) +{ + logerror("p2200_r (%s)\n", machine().describe_context()); + return machine().rand(); +} + +WRITE8_MEMBER(stratos_state::p2200_w) +{ + logerror("p2200_w %02x -> %02x (%s)\n", data, data^0xff, machine().describe_context()); +} + +WRITE8_MEMBER(stratos_state::p2400_w) +{ + if(control & 0x20) { + individual_leds = individual_leds & 0x100ff; + individual_leds |= (data ^ 0xff) << 8; + if(!(control & 0x04)) + individual_leds |= 0x20000; + } else { + individual_leds = individual_leds & 0x2ff00; + individual_leds |= data ^ 0xff; + if(!(control & 0x04)) + individual_leds |= 0x10000; + } +} + +READ8_MEMBER(stratos_state::control_r) +{ + static int xx = 0; + xx = !xx; + // [d659/d630] + // d64e: + // 2000 = f9 + // 2000 = f7 + // 8fb = (2600) & 20 + + // d625: test device? + // 8fb=00 : (00, 80) (05, 80) (06, 80) + // 8fb=20 : (03, 20) (06, 20) (04, 20) + // { 2000=f9, 2000=f0 | first, test (2600) & second + // -> 3-bit mask + // d518: 0c 0a 10 0e 14 18 0b 08 -> 1b, timing on loop at e788 + // d520: 02cc 035b 0219 0266 01ad 0166 0300 0432 -> 8d7/8 + + + // table at f70e (index on d545 somehow): + // 0c 0d 0e 0f 10 11 01 02 + + // table at d545: + // 00 4800 6800 + // 01 4802 6800 + // 02 4800 6802 + // 03 4801 6800 + // 04 4800 6801 + // 05 4801 6801 + // 06 4c00 6800 + // 07 4800 6c00 + // 08 4800 6c00 + // 09 4c00 6800 + // 0a 4c00 6c00 + // 0b 4c00 6c00 + // 0c 4880 6800 + // 0d 4840 6800 + // 0e 4820 6800 + // 0f 4810 6800 + // 10 4808 6800 + // 11 4804 6800 + // 12 4800 6880 + // 13 4800 6840 + // 14 4800 6820 + // 15 4800 6810 + // 16 4800 6808 + // 17 4800 6804 + // 18 4880 6880 + // 19 4840 6840 + // 1a 4820 6820 + // 1b 4810 6810 + // 1c 4808 6808 + // 1d 4804 6804 + + // Power up led test table + // 1208 Ki Green + // 1308 Qu + // 1408 Ro + // 1508 Bi + // 1608 Kn + // 1708 Pa + // 0727 8 + // 0026 7 + // 0025 6 + // 0024 5 + // 0023 4 + // 0022 3 + // 0021 2 + // 0020 1 + // 0080 A + // 0081 B + // 0082 C + // 0083 D + // 0084 E + // 0085 F + // 0086 G + // 0087 H + // 0008 - + // 0c08 Ki Red + // 0d08 Qu + // 0e08 Ro + // 0f08 Bi + // 1008 Kn + // 1108 Pa + // 0108 + // 0208 + // 0308 + // 0408 + // 0617 8 + // 0016 7 + // 0015 6 + // 0014 5 + // 0013 4 + // 0012 3 + // 0011 2 + // 0010 1 + // 0040 A + // 0041 B + // 0042 C + // 0043 D + // 0044 E + // 0045 F + // 0046 G + // 0047 H + // 0009 + // 00c2 + + // (20) = difficulty level + + logerror("control_r (%s)\n", machine().describe_context()); + return xx ? 0x20 : 0x00; +} + +WRITE8_MEMBER(stratos_state::control_w) +{ + logerror("control_w %02x bank %d (%s)\n", data, data & 3, machine().describe_context()); + + control = data; + bank_8000->set_entry(data & 3); + bank_4000->set_entry(data & 3); + nvram_bank->set_entry((data >> 1) & 1); +} + + +READ8_MEMBER(stratos_state::lcd_r) +{ + return 0x00; +} + +WRITE8_MEMBER(stratos_state::lcd_w) +{ + // 08 0b - 00? + // 04 06 - 05 + // 02 0d - 07 + // 01 00 - 05 + + static UINT8 vals[18]; + static int idx = 0; + if(data == 0) + idx = 0; + if(idx/2 >= 18) + return; + if(idx & 1) + vals[idx/2] = (vals[idx/2] & 0xf0) | (data & 0xf); + else + vals[idx/2] = (data & 0xf) << 4; + + idx++; + if(idx == 18*2) { + logerror("lcd"); + for(int i=0; i<18; i++) + logerror(" %02x", vals[i]); + logerror("\n"); + } +} + +static ADDRESS_MAP_START( stratos_mem, AS_PROGRAM, 8, stratos_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAM + AM_RANGE(0x2000, 0x2000) AM_WRITE(p2000_w) + AM_RANGE(0x2200, 0x2200) AM_READWRITE(p2200_r, p2200_w) + AM_RANGE(0x2400, 0x2400) AM_WRITE(p2400_w) + AM_RANGE(0x2600, 0x2600) AM_READWRITE(control_r, control_w) + AM_RANGE(0x2800, 0x37ff) AM_RAMBANK("nvram_bank") + AM_RANGE(0x3800, 0x3800) AM_READWRITE(lcd_r, lcd_w) + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank_4000") + AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank_8000") +ADDRESS_MAP_END + +static INPUT_PORTS_START( stratos ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( stratos, stratos_state ) + MCFG_CPU_ADD("maincpu", M65C02, 5670000) + MCFG_CPU_PROGRAM_MAP(stratos_mem) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(240, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 63) + MCFG_SCREEN_UPDATE_DRIVER(stratos_state, screen_update) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq", stratos_state, irq_timer, attotime::from_hz(1000)) + + MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + +ROM_START( stratos ) + ROM_REGION(0x20000, "roms_8000", 0) + ROM_LOAD("w1_728m_u3.u3", 0x0000, 0x8000, CRC(b58a7256) SHA1(75b3a3a65f4ca8d52aa5b17a06319bff59d9014f)) + ROM_LOAD("bw1_918n_u4.u4", 0x8000, 0x8000, CRC(cb0de631) SHA1(f78d40213be21775966cbc832d64acd9b73de632)) + ROM_FILL(0x10000, 0x10000, 0xff) + + ROM_REGION(0x10000, "roms_4000", 0) + ROM_FILL(0x00000, 0x10000, 0xff) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +CONS( 1986, stratos, 0, 0, stratos, stratos, stratos_state, stratos, "Saitek", "Kasparov Stratos Chess Computer", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/studio2.c b/src/mame/drivers/studio2.c new file mode 100644 index 00000000000..46efbaf963b --- /dev/null +++ b/src/mame/drivers/studio2.c @@ -0,0 +1,759 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +RCA Studio II + +PCB Layout +---------- + +1809746-S1-E + +|----------------------------------------------------------------------------------------------------------| +| |----------------------------| | +| |----------------------------| CA555 7805 | +| SPKR CN1 | +| | +| |-----------| | +| | Output | | +| ROM.4 ROM.3 ROM.2 ROM.1 CDP1822 CDP1822 CDP1822 CDP1822 |TV Module | | +| | | | +| CDP1802 TA10171V1 | | | +| | | | +| | | | +| | | | +| |-----------| | +| | +| CD4042 CD4001 CD4515 | +| | +| CN2 CN3 | +|----------------------------------------------------------------------------------------------------------| + +Notes: + All IC's shown. + + CDP1802 - RCA CDP1802CE Microprocessor + TA10171V1 - RCA TA10171V1 NTSC Video Display Controller (VDC) (= RCA CDP1861) + CDP1822 - RCA CDP1822NCE 256 x4 RAM (= Mitsubishi M58721P) + ROM.x - RCA CDP1831CE 512 x8 MASKROM. All ROMs are marked 'PROGRAM COPYRIGHT (C) RCA CORP. 1977' + CD4001 - 4001 Quad 2-Input NOR Buffered B Series Gate (4000-series CMOS TTL logic IC) + CD4042 - 4042 Quad Clocked D Latch (4000-series CMOS TTL logic IC) + CD4515 - 4515 4-Bit Latched/4-to-16 Line Decoders (4000-series CMOS TTL logic IC) + CA555 - CA555CG General Purpose Single Bipolar Timer (= NE555) + 7805 - Voltage regulator, input 10V-35V, output +5V + SPKR - Loudspeaker, 8 ohms, 0.3 W + CN1 - ROM cartridge connector, 2x22 pins, 0.154" spacing + CN2 - Player A keypad connector, 1x12 pins + CN3 - Player B keypad connector, 1x12 pins +*/ + +/* + +Toshiba Visicom Console (RCA Studio II clone) +Toshiba, 1978 + +PCB Layout Many resistors/caps +---------- 7.5VDC / transistors in this area + \/ /---|-----/ +|------------------------------------------||---|-------| |-----|C|------| +|D235 POT TC4011 CART_SLOT | | | TV Modulator | +|HEATSINK | | | | +| TC4515 TC4049 TC4011 74LS08| | | SW (VHF Ch1) | +|DIODES(x20) 74LS74 74LS73| | | (VHF Ch2) | +|-----------| 3.579545MHz | | + | CDP1802 | POT | |--------------| + |TMM331 | | + | CDP1861 TC5012 TC5012 | + | TC4021 TC4021 | | + | TC5012 \-----/ | + | 2111 2111 2111 74LS74 | + |TC4042 2111 2111 2111 TC4011 | + |-------------------------------------------| +Notes: (all chips shown above) + CDP1802 - RCA CDP1802 CPU (DIP40), clock 1.7897725MHz [3.579545/2] + CDP1861 - RCA CDP1861 Video Controller (DIP24) + VSync - 60.4533Hz \ (measured on pin 6) + HSync - 15.8387kHz / + Clock - 223.721562kHz [3.579545/16] (measured on pin 1) + 2111 - NEC D2111AL-4 256 bytes x4 SRAM (DIP18, x6). Total 1.5k + C - Composite Video Output to TV from TV Modulator + TMM331 - Toshiba TMM331AP 2k x8 MASKROM (DIP24) + Pinout: + TMM331 + |----\/----| + A7 |1 24| VCC + A8 |2 23| D0 + A9 |3 22| D1 + A10 |4 21| D2 + A0 |5 20| D3 + A1 |6 19| D4 + A2 |7 18| D5 + A3 |8 17| D6 + A4 |9 16| D7 + A5 |10 15| E0 (measured LOW) + A6 |11 14| E1 (NC?) + GND |12 13| E2 (measured LOW) + |----------| + + E0 - E2 are Programmable Chip Select Inputs + TMM331 is compatible with AMI S6831A, AMD AM9217, + Intel 2316A/8316A, MOSTEK MK31000, GI RO-3-8316, + NATIONAL/NEC/SYNERTEK 2316A etc + + +Cartridges +---------- + +Inside is a Toshiba TMM331AP ROM, which is pin compatible with the Signetics S6831. +The cartridge to TMM331 pin connections are as follows, with cartridge pin 1 being the leftmost angled contact: + +Pin 1 to ROM pins 12,13 (GND and E2) +Pin 2 to ROM pins 24,15 (VCC and E0) +Pin 3 to ROM pin 23 (D0) +Pin 4 to ROM pin 22 (D1) +Pin 5 to ROM pin 21 (D2) +Pin 6 to ROM pin 20 (D3) +Pin 7 to ROM pin 19 (D4) +Pin 8 to ROM pin 18 (D5) +Pin 9 to ROM pin 17 (D6) +Pin 10 to ROM pin 16 (D7) +Pin 11 to ROM pin 14 (E1) +Pin 12 to ROM pin 11 (A6) +Pin 13 to ROM pin 10 (A5) +Pin 14 to ROM pin 9 (A4) +Pin 15 to ROM pin 8 (A3) +Pin 16 to ROM pin 7 (A2) +Pin 17 to ROM pin 6 (A1) +Pin 18 to ROM pin 5 (A0) +Pin 19 to ROM pin 1 (A7) +Pin 20 to ROM pin 4 (A10) +Pin 21 to ROM pin 3 (A9) +Pin 22 to ROM pin 2 (A8) + +*/ + +/* + +Mustang 9016 Telespiel Computer + +PCB Layout +---------- + +|----------------------------------------------------------------------------------------------------------| +|7805 |----------------------------| CD4069 MC14001 | +| |----------------------------| | +| CN1 | +| | +| ROM.IC13 ROM.IC14 CDP1822 CDP1822 CDP1822 CDP1822 |-----------| | +| | Output | | +| |TV Module? | | +| ROM.IC12 CDP1802 CDP1864 | | | +| CDP1822 | | | +| CD4019 CDP1858 CD4081 CD4069 | | | +| | | | +| CD4515 | | | +| 1.750MHz |-----------| | +| 4.3236MHz | +| | +| | +| | +|----------------------------------------------------------------------------------------------------------| + +Notes: + All IC's shown. + + CDP1802 - RCA CDP1802CE Microprocessor + CDP1864 - RCA CDP1864CE PAL Video Display Controller (VDC) + CDP1822 - RCA CDP1822NCE 256 x4 RAM (= Mitsubishi M58721P) + ROM.ICx - RCA CDP1833 1k x8 MASKROM. All ROMs are marked 'PROGRAM COPYRIGHT (C) RCA CORP. 1978' + CD4019 - 4019 Quad AND-OR Select Gate (4000-series CMOS TTL logic IC) + CDP1858 - RCA CDP1858E Latch/Decoder - 4-bit + CD4081 - 4081 Quad 2-Input AND Buffered B Series Gate (4000-series CMOS TTL logic IC) + CD4069 - 4069 Hex Buffer, Inverter (4000-series CMOS TTL logic IC) + CD4515 - 4515 4-Bit Latched/4-to-16 Line Decoders (4000-series CMOS TTL logic IC) + 7805 - Voltage regulator, input 10V-35V, output +5V + CN1 - ROM cartridge connector, 2x22 pins, 0.154" spacing +*/ + +/* + + TODO: + + - NE555 discrete sound + +*/ + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "sound/beep.h" +#include "sound/cdp1864.h" +#include "sound/discrete.h" +#include "video/cdp1861.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define CDP1802_TAG "ic1" +#define CDP1861_TAG "ic2" +#define CDP1864_TAG "cdp1864" +#define SCREEN_TAG "screen" + +class studio2_state : public driver_device +{ +public: + + studio2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_beeper(*this, "beeper"), + m_vdc(*this, CDP1861_TAG), + m_cart(*this, "cartslot"), + m_clear(*this, "CLEAR"), + m_a(*this, "A"), + m_b(*this, "B"), + m_screen(*this, "screen") + { } + + required_device m_maincpu; + required_device m_beeper; + optional_device m_vdc; + required_device m_cart; + required_ioport m_clear; + required_ioport m_a; + required_ioport m_b; + required_device m_screen; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( cart_400 ); + DECLARE_READ8_MEMBER( cart_a00 ); + DECLARE_READ8_MEMBER( cart_e00 ); + DECLARE_READ8_MEMBER( dispon_r ); + DECLARE_WRITE8_MEMBER( keylatch_w ); + DECLARE_WRITE8_MEMBER( dispon_w ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_READ_LINE_MEMBER( ef4_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_INPUT_CHANGED_MEMBER( reset_w ); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( studio2_cart_load ); + + /* keyboard state */ + UINT8 m_keylatch; + DECLARE_DRIVER_INIT(studio2); +}; + +class visicom_state : public studio2_state +{ +public: + visicom_state(const machine_config &mconfig, device_type type, const char *tag) + : studio2_state(mconfig, type, tag), + m_color0_ram(*this, "color0_ram"), + m_color1_ram(*this, "color1_ram") + { } + + virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + required_shared_ptr m_color0_ram; + required_shared_ptr m_color1_ram; + + DECLARE_WRITE8_MEMBER( dma_w ); +}; + +class mpt02_state : public studio2_state +{ +public: + mpt02_state(const machine_config &mconfig, device_type type, const char *tag) + : studio2_state(mconfig, type, tag), + m_cti(*this, CDP1864_TAG), + m_color_ram(*this, "color_ram") + { } + + required_device m_cti; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( cart_c00 ); + DECLARE_WRITE8_MEMBER( dma_w ); + DECLARE_READ_LINE_MEMBER( rdata_r ); + DECLARE_READ_LINE_MEMBER( bdata_r ); + DECLARE_READ_LINE_MEMBER( gdata_r ); + + /* video state */ + required_shared_ptr m_color_ram; + UINT8 m_color; +}; + + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +#define LOG 0 + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +/* Read/Write Handlers */ + +WRITE8_MEMBER( studio2_state::keylatch_w ) +{ + m_keylatch = data & 0x0f; +} + +READ8_MEMBER( studio2_state::dispon_r ) +{ + m_vdc->disp_on_w(1); + m_vdc->disp_on_w(0); + + return 0xff; +} + +WRITE8_MEMBER( studio2_state::dispon_w ) +{ + m_vdc->disp_on_w(1); + m_vdc->disp_on_w(0); +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( studio2_map, AS_PROGRAM, 8, studio2_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0x09ff) AM_MIRROR(0xf400) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( studio2_io_map, AS_IO, 8, studio2_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x01, 0x01) AM_READ(dispon_r) + AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( visicom_map, AS_PROGRAM, 8, visicom_state ) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0x0fff) AM_DEVREAD("cartslot", generic_slot_device, read_rom) + AM_RANGE(0x1000, 0x10ff) AM_RAM + AM_RANGE(0x1100, 0x11ff) AM_RAM AM_SHARE("color0_ram") + AM_RANGE(0x1300, 0x13ff) AM_RAM AM_SHARE("color1_ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( visicom_io_map, AS_IO, 8, visicom_state ) + AM_RANGE(0x01, 0x01) AM_WRITE(dispon_w) + AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mpt02_map, AS_PROGRAM, 8, mpt02_state ) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0x09ff) AM_RAM + AM_RANGE(0x0b00, 0x0b3f) AM_RAM AM_SHARE("color_ram") + AM_RANGE(0x0c00, 0x0fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mpt02_io_map, AS_IO, 8, mpt02_state ) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispon_r, step_bgcolor_w) + AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) + AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispoff_r, tone_latch_w) +ADDRESS_MAP_END + +/* Input Ports */ + +INPUT_CHANGED_MEMBER( studio2_state::reset_w ) +{ + if (oldval && !newval) + { + machine_reset(); + } +} + +static INPUT_PORTS_START( studio2 ) + PORT_START("A") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 0") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 1") PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 2") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 3") PORT_CODE(KEYCODE_E) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 4") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 5") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 6") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 7") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 8") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 9") PORT_CODE(KEYCODE_C) + + PORT_START("B") + PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 1") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 2") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 3") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 7") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 8") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 9") PORT_CODE(KEYCODE_3_PAD) + + PORT_START("CLEAR") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Clear") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHANGED_MEMBER(DEVICE_SELF, studio2_state, reset_w, 0) +INPUT_PORTS_END + +/* Video */ + +static const rgb_t VISICOM_PALETTE[] = +{ + rgb_t(0x00, 0x40, 0x00), + rgb_t(0xaf, 0xdf, 0xe4), + rgb_t(0xb9, 0xc4, 0x2f), + rgb_t(0xef, 0x45, 0x4a) +}; + +UINT32 visicom_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_vdc->screen_update(screen, bitmap, cliprect); + + m_vdc->m_bitmap.fill(VISICOM_PALETTE[0], cliprect); + + return 0; +} + +READ_LINE_MEMBER( mpt02_state::rdata_r ) +{ + return BIT(m_color, 0); +} + +READ_LINE_MEMBER( mpt02_state::bdata_r ) +{ + return BIT(m_color, 1); +} + +READ_LINE_MEMBER( mpt02_state::gdata_r ) +{ + return BIT(m_color, 2); +} + +/* CDP1802 Configuration */ + +READ_LINE_MEMBER( studio2_state::clear_r ) +{ + return BIT(m_clear->read(), 0); +} + +READ_LINE_MEMBER( studio2_state::ef3_r ) +{ + return BIT(m_a->read(), m_keylatch); +} + +READ_LINE_MEMBER( studio2_state::ef4_r ) +{ + return BIT(m_b->read(), m_keylatch); +} + +WRITE_LINE_MEMBER( studio2_state::q_w ) +{ + m_beeper->set_state(state); +} + +WRITE8_MEMBER( visicom_state::dma_w ) +{ + int sx = m_screen->hpos() + 4; + int y = m_screen->vpos(); + + UINT8 addr = offset & 0xff; + UINT8 color0 = m_color0_ram[addr]; + UINT8 color1 = m_color1_ram[addr]; + + for (int x = 0; x < 8; x++) + { + int color = (BIT(color1, 7) << 1) | BIT(color0, 7); + m_vdc->m_bitmap.pix32(y, sx + x) = VISICOM_PALETTE[color]; + color0 <<= 1; + color1 <<= 1; + } +} + +WRITE8_MEMBER( mpt02_state::dma_w ) +{ + UINT8 addr = ((offset & 0xe0) >> 2) | (offset & 0x07); + + m_color = m_color_ram[addr]; + + m_cti->con_w(0); // HACK + m_cti->dma_w(space, offset, data); +} + +/* Machine Initialization */ + +// trampolines to cartridge +READ8_MEMBER( studio2_state::cart_400 ) { return m_cart->read_rom(space, offset); } +READ8_MEMBER( studio2_state::cart_a00 ) { return m_cart->read_rom(space, offset + 0x600); } +READ8_MEMBER( studio2_state::cart_e00 ) { return m_cart->read_rom(space, offset + 0xa00); } +READ8_MEMBER( mpt02_state::cart_c00 ) { return m_cart->read_rom(space, offset + 0x800); } + +void studio2_state::machine_start() +{ + if (m_cart->exists()) + { + // these have to be installed only if a cart is present, because they partially overlap the built-in game + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0400, 0x07ff, read8_delegate(FUNC(studio2_state::cart_400), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0a00, 0x0bff, read8_delegate(FUNC(studio2_state::cart_a00), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0e00, 0x0fff, read8_delegate(FUNC(studio2_state::cart_e00), this)); + } + + // register for state saving + save_item(NAME(m_keylatch)); +} + +void mpt02_state::machine_start() +{ + if (m_cart->exists()) + { + // these have to be installed only if a cart is present, because they partially overlap the built-in game + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0400, 0x07ff, read8_delegate(FUNC(studio2_state::cart_400), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0c00, 0x0fff, read8_delegate(FUNC(mpt02_state::cart_c00), this)); + } + + // register for state saving + save_item(NAME(m_keylatch)); +} + +void studio2_state::machine_reset() +{ + m_vdc->reset(); +} + +void mpt02_state::machine_reset() +{ + m_cti->reset(); +} + +DEVICE_IMAGE_LOAD_MEMBER( studio2_state, studio2_cart_load ) +{ + UINT32 size; + + // always alloc 3K, even if range $400-$600 is not read by the system (RAM is present there) + m_cart->rom_alloc(0xc00, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + + if (image.software_entry() == NULL) + { + if (!strcmp(image.filetype(), "st2")) + { + UINT8 header[0x100]; + UINT8 catalogue[10], title[32], pages[64]; + UINT8 blocks; + + if (image.length() <= 0x100) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM file"); + return IMAGE_INIT_FAIL; + } + + image.fread(&header, 0x100); + + // validate + if (strncmp((const char *)header, "RCA2", 4)) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not an .ST2 file"); + return IMAGE_INIT_FAIL; + } + + blocks = header[4]; + memcpy(&catalogue, &header[16], 10); + memcpy(&title, &header[32], 32); + memcpy(&pages, &header[64], 64); + + /* read ST2 cartridge into memory */ + for (int block = 0; block < (blocks - 1); block++) + { + if (pages[block] < 4) + logerror("ST2 invalid block %u to %04x\n", block, pages[block] << 8); + else + { + UINT16 offset = (pages[block] << 8) - 0x400; + logerror("ST2 Reading block %u to %04x\n", block, offset); + image.fread(m_cart->get_rom_base() + offset, 0x100); + } + } + + logerror("ST2 Catalogue: %s\n", catalogue); + logerror("ST2 Title: %s\n", title); + } + else + { + size = image.length(); + if (size > 0x400) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + else + image.fread(m_cart->get_rom_base(), size); + } + } + else + { + // Studio II carts might map their data at $400-$7ff, $a00-$bff and $e00-$fff + // MPT-2 carts might map their data at $400-$7ff and $c00-$fff + if (image.get_software_region("rom_400")) + memcpy(m_cart->get_rom_base() + 0x000, image.get_software_region("rom_400"), image.get_software_region_length("rom_400")); + if (image.get_software_region("rom_a00")) + memcpy(m_cart->get_rom_base() + 0x600, image.get_software_region("rom_a00"), image.get_software_region_length("rom_a00")); + if (image.get_software_region("rom_c00")) + memcpy(m_cart->get_rom_base() + 0x800, image.get_software_region("rom_c00"), image.get_software_region_length("rom_c00")); + if (image.get_software_region("rom_e00")) + memcpy(m_cart->get_rom_base() + 0xa00, image.get_software_region("rom_e00"), image.get_software_region_length("rom_e00")); + } + + return IMAGE_INIT_PASS; +} + + +/* Machine Drivers */ + +static MACHINE_CONFIG_FRAGMENT( studio2_cartslot ) + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "studio2_cart") + MCFG_GENERIC_EXTENSIONS("st2,bin,rom") + MCFG_GENERIC_LOAD(studio2_state, studio2_cart_load) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "studio2") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( studio2, studio2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, 1760000) /* the real clock is derived from an oscillator circuit */ + MCFG_CPU_PROGRAM_MAP(studio2_map) + MCFG_CPU_IO_MAP(studio2_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(studio2_state, clear_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(studio2_state, ef3_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(studio2_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(studio2_state, q_w)) + MCFG_COSMAC_DMAW_CALLBACK(DEVWRITE8(CDP1861_TAG, cdp1861_device, dma_w)) + + /* video hardware */ + MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, 1760000) + MCFG_CDP1861_IRQ_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) + MCFG_CDP1861_DMA_OUT_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT)) + MCFG_CDP1861_EFX_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) + MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, 1760000) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_FRAGMENT_ADD( studio2_cartslot ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( visicom, visicom_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_3_579545MHz/2) + MCFG_CPU_PROGRAM_MAP(visicom_map) + MCFG_CPU_IO_MAP(visicom_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(visicom_state, clear_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(visicom_state, ef3_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(visicom_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(visicom_state, q_w)) + MCFG_COSMAC_DMAW_CALLBACK(WRITE8(visicom_state, dma_w)) + + /* video hardware */ + MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, XTAL_3_579545MHz/2) + MCFG_CDP1861_IRQ_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) + MCFG_CDP1861_DMA_OUT_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT)) + MCFG_CDP1861_EFX_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) + MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2) + MCFG_SCREEN_UPDATE_DRIVER(visicom_state, screen_update) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "visicom_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "visicom") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( mpt02, mpt02_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, CDP1864_CLOCK) + MCFG_CPU_PROGRAM_MAP(mpt02_map) + MCFG_CPU_IO_MAP(mpt02_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(mpt02_state, clear_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(mpt02_state, ef3_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(mpt02_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(mpt02_state, q_w)) + MCFG_COSMAC_DMAW_CALLBACK(WRITE8(mpt02_state, dma_w)) + + /* video hardware */ + MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, CDP1864_CLOCK) + MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, CDP1864_CLOCK, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(mpt02_state, rdata_r), READLINE(mpt02_state, bdata_r), READLINE(mpt02_state, gdata_r)) + MCFG_CDP1864_CHROMINANCE(RES_K(4.7), RES_K(8.2), RES_K(4.7), RES_K(22)) + + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_FRAGMENT_ADD( studio2_cartslot ) +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( studio2 ) + ROM_REGION( 0x1000, CDP1802_TAG, 0 ) + ROM_LOAD( "84932.ic11", 0x000, 0x200, CRC(283b7e65) SHA1(4b6d21cde59712ecb5941ff63d8eb161420b0aac) ) + ROM_LOAD( "84933.ic12", 0x200, 0x200, CRC(a396b77c) SHA1(023517f67af61790e6916b6c4dbe2d9dc07ae3ff) ) + ROM_LOAD( "85456.ic13", 0x400, 0x200, CRC(d25cf97f) SHA1(d489f41f1125c76cc8ed9defa82a877ae014ef21) ) + ROM_LOAD( "85457.ic14", 0x600, 0x200, CRC(74aa724f) SHA1(085832f29e0d2a387c75463d66c54fb6c1e9e72c) ) +ROM_END + +ROM_START( visicom ) + ROM_REGION( 0x1000, CDP1802_TAG, 0 ) + ROM_LOAD( "visicom.q003", 0x000, 0x800, CRC(23d22074) SHA1(a0a8be23f70621a2bd8010b1134e8a0019075bf1) ) +ROM_END + +ROM_START( mpt02 ) + ROM_REGION( 0x1000, CDP1802_TAG, 0 ) + ROM_LOAD( "86676.ic13", 0x000, 0x400, CRC(a7d0dd3b) SHA1(e1881ab4d67a5d735dd2c8d7e924e41df6f2aeec) ) + ROM_LOAD( "86677b.ic14", 0x400, 0x400, CRC(82a2d29e) SHA1(37e02089d611db10bad070d89c8801de41521189) ) + ROM_LOAD( "87201.ic12", 0xc00, 0x400, CRC(8006a1e3) SHA1(b67612d98231485fce55d604915abd19b6d64eac) ) +ROM_END + +ROM_START( mpt02h ) + ROM_REGION( 0x1000, CDP1802_TAG, 0 ) + ROM_LOAD( "86676.ic13", 0x000, 0x400, CRC(a7d0dd3b) SHA1(e1881ab4d67a5d735dd2c8d7e924e41df6f2aeec) ) +ROM_END + +#define rom_mtc9016 rom_mpt02 +#define rom_shmc1200 rom_mpt02 +#define rom_cm1200 rom_mpt02 +#define rom_apollo80 rom_mpt02 + +/* Driver Initialization */ + +DRIVER_INIT_MEMBER(studio2_state,studio2) +{ + m_beeper->set_state(0); + m_beeper->set_frequency(300); +} + +/* Game Drivers */ + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +CONS( 1977, studio2, 0, 0, studio2, studio2, studio2_state, studio2, "RCA", "Studio II", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +CONS( 1978, visicom, studio2,0, visicom, studio2, studio2_state, studio2, "Toshiba", "Visicom COM-100 (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +CONS( 1978, mpt02, studio2,0, mpt02, studio2, studio2_state, studio2, "Soundic", "Victory MPT-02 Home TV Programmer (Austria)", MACHINE_SUPPORTS_SAVE ) +CONS( 1978, mpt02h, studio2,0, mpt02, studio2, studio2_state, studio2, "Hanimex", "MPT-02 Jeu TV Programmable (France)", MACHINE_SUPPORTS_SAVE ) +CONS( 1978, mtc9016, studio2,0, mpt02, studio2, studio2_state, studio2, "Mustang", "9016 Telespiel Computer (Germany)", MACHINE_SUPPORTS_SAVE ) +CONS( 1978, shmc1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Sheen", "M1200 Micro Computer (Australia)", MACHINE_SUPPORTS_SAVE ) +CONS( 1978, cm1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Conic", "M-1200 (?)", MACHINE_SUPPORTS_SAVE ) +CONS( 1978, apollo80, studio2,0, mpt02, studio2, studio2_state, studio2, "Academy", "Apollo 80 (Germany)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/sun1.c b/src/mame/drivers/sun1.c new file mode 100644 index 00000000000..df26989dbaa --- /dev/null +++ b/src/mame/drivers/sun1.c @@ -0,0 +1,170 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Sun-1 Models + ------------ + + Sun-1 + + Processor(s): 68000 + Notes: Large black desktop boxes with 17" monitors. + Uses the original Stanford-designed video board + and a parallel microswitch keyboard (type 1) and + parallel mouse (Sun-1). + + 100 + Processor(s): 68000 @ 10MHz + Bus: Multibus, serial + Notes: Uses a design similar to original SUN (Stanford + University Network) CPU. The version 1.5 CPU can + take larger RAMs. + + 100U + Processor(s): 68010 @ 10MHz + CPU: 501-1007 + Bus: Multibus, serial + Notes: "Brain transplant" for 100 series. Replaced CPU + and memory boards with first-generation Sun-2 + CPU and memory boards so original customers + could run SunOS 1.x. Still has parallel kb/mouse + interface so type 1 keyboards and Sun-1 mice + could be connected. + + 170 + Processor(s): 68010? + Bus: Multibus? + Chassis type: rackmount + Notes: Server. Slightly different chassis design than + 2/170's + + + Documentation: + http://www.bitsavers.org/pdf/sun/sun1/800-0345_Sun-1_System_Ref_Man_Jul82.pdf + (page 39,40 of pdf contain memory map) + + 04/12/2009 Skeleton driver. + + 04/04/2011 Modernised, added terminal keyboard. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/z80dart.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class sun1_state : public driver_device +{ +public: + sun1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_p_ram(*this, "p_ram") + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ16_MEMBER(sun1_upd7201_r); + DECLARE_WRITE16_MEMBER(sun1_upd7201_w); + DECLARE_WRITE8_MEMBER(kbd_put); + virtual void machine_reset(); + required_shared_ptr m_p_ram; + UINT8 m_term_data; +}; + + + +// Just hack to show output since upd7201 is not implemented yet + +READ16_MEMBER( sun1_state::sun1_upd7201_r ) +{ + UINT16 ret; + if (offset == 0) + { + ret = m_term_data << 8; + m_term_data = 0; + } + else + ret = 0xfeff | (m_term_data ? 0x100 : 0); + + return ret; +} + +WRITE16_MEMBER( sun1_state::sun1_upd7201_w ) +{ + if (offset == 0) + m_terminal->write(space, 0, data >> 8); +} + +static ADDRESS_MAP_START(sun1_mem, AS_PROGRAM, 16, sun1_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("p_ram") // 512 KB RAM / ROM at boot + AM_RANGE(0x00200000, 0x00203fff) AM_ROM AM_REGION("user1",0) + AM_RANGE(0x00600000, 0x00600007) AM_READWRITE( sun1_upd7201_r, sun1_upd7201_w ) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sun1 ) +INPUT_PORTS_END + + +void sun1_state::machine_reset() +{ + UINT8* user1 = memregion("user1")->base(); + + memcpy((UINT8*)m_p_ram.target(),user1,0x4000); + + m_maincpu->reset(); + m_term_data = 0; +} + + +WRITE8_MEMBER( sun1_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( sun1, sun1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(sun1_mem) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(sun1_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sun1 ) + ROM_REGION( 0x4000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "v10.8.bin", 0x0001, 0x2000, CRC(3528a0f8) SHA1(be437dd93d1a44eccffa6f5e05935119482beab0)) + ROM_LOAD16_BYTE( "v10.0.bin", 0x0000, 0x2000, CRC(1ad4c52a) SHA1(4bc1a19e8f202378d5d7baa8b95319275c040a6d)) + + ROM_REGION( 0x4000, "diag", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "8mhzdiag.8.bin", 0x0001, 0x2000, CRC(808a549e) SHA1(d2aba014a5507c1538f2c1a73e1d2524f28034f4)) + ROM_LOAD16_BYTE( "8mhzdiag.0.bin", 0x0000, 0x2000, CRC(7a92d506) SHA1(5df3800f7083293fc01bb6a7e7538ad425bbebfb)) + + ROM_REGION( 0x10000, "gfx", ROMREGION_ERASEFF ) + ROM_LOAD( "gfxu605.g4.bin", 0x0000, 0x0200, CRC(274b7b3d) SHA1(40d8be2cfcbd03512a05925991bb5030d5d4b5e9)) + ROM_LOAD( "gfxu308.g21.bin", 0x0200, 0x0200, CRC(35a6eed8) SHA1(25cb2dd8e5343cd7927c3045eb4cb96dc9935a37)) + ROM_LOAD( "gfxu108.g20.bin", 0x0400, 0x0200, CRC(ecee335e) SHA1(5f4d32dc918af15872cd6e700a04720caeb6c657)) + ROM_LOAD( "gfxu105.g0.bin", 0x0600, 0x0200, CRC(8e1a24b3) SHA1(dad2821c3a3137ad69e78b6fc29ab582e5d78646)) + ROM_LOAD( "gfxu104.g1.bin", 0x0800, 0x0200, CRC(86f7a483) SHA1(8eb3778f5497741cd4345e81ff1a903c9a63c8bb)) + ROM_LOAD( "gfxu307.g61.bin", 0x0a00, 0x0020, CRC(b190f25d) SHA1(80fbdc843f1eb68a2d3713499f04d99dab88ce83)) + ROM_LOAD( "gfxu107.g60.bin", 0x0a20, 0x0020, CRC(425d3a98) SHA1(9ae4ce3761c2f995d00bed8d752c55224d274062)) + + ROM_REGION( 0x10000, "cpu", ROMREGION_ERASEFF ) + ROM_LOAD( "cpuu503.p2.bin", 0x0000, 0x0200, CRC(12d9a6be) SHA1(fca99f9c5afc630ac67cbd4e5ba4e5242b826848)) + ROM_LOAD( "cpuu602.p1.bin", 0x0200, 0x0020, CRC(ee1e5a14) SHA1(0d3346cb3b647fa2475bd7b4fa36ea6ecfdaf805)) + ROM_LOAD( "cpuu502.p0.bin", 0x0220, 0x0020, CRC(20eb1183) SHA1(9b268792b28d858d6b6a1b6c4148af88a8d6b735)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, sun1, 0, 0, sun1, sun1, driver_device, 0, "Sun Microsystems", "Sun-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/sun2.c b/src/mame/drivers/sun2.c new file mode 100644 index 00000000000..ec1ddabc5d6 --- /dev/null +++ b/src/mame/drivers/sun2.c @@ -0,0 +1,136 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Sun-2 Models + ------------ + + 2/120 + Processor(s): 68010 @ 10MHz + CPU: 501-1007/1051 + Chassis type: deskside + Bus: Multibus (9 slots) + Memory: 7M physical + Notes: First machines in deskside chassis. Serial + microswitch keyboard (type 2), Mouse Systems + optical mouse (Sun-2). + + 2/100U + Processor(s): 68010 @ 10MHz + CPU: 501-1007 + Bus: Multibus + Notes: Upgraded Sun 100. Replaced CPU and memory boards + with first-generation Sun-2 CPU and memory + boards so original customers could run SunOS + 1.x. Still has parallel kb/mouse interface so + type 1 keyboards and Sun-1 mice could be + connected. + + 2/150U + Notes: Apparently also an upgraded Sun-1. + + 2/170 + Chassis type: rackmount + Bus: Multibus (15 slots) + Notes: Rackmount version of 2/120, with more slots. + + 2/50 + Processor(s): 68010 @ 10MHz + CPU: 501-1141/1142/1143/1426/1427/1428 + Chassis type: wide pizza box + Bus: VME (2 slots) + Memory: 7M physical + Notes: The (type 2) keyboard and mouse attach via an + adapter that accepts two modular plugs and + attaches to a DB15 port; later on, units were + apparently shipped with type 3 keyboards. The + CPU boards have a double-width back panel but + are otherwise identical to those in the 2/130 + and 2/160. + + 2/130 + 2/160 + Processor(s): 68010 @ 10MHz + CPU: 501-1144/1145/1146/1429/1430/1431 + Chassis type: deskside + Bus: VME (12 slots) + Memory: 7M physical + Notes: First machine in 12-slot deskside VME chassis. + Has four-fan cooling tray instead of six as in + later machines, which led to cooling problems + with lots of cards. Backplane has only four P2 + memory connectors bussed instead of six as in + later 12-slot backplanes; SCSI passthrough is in + slot 6 instead of 7 as in later 12-slot + backplanes. Upgradeable to a 3/160 by replacing + the CPU board. No information on the differences + between the 2/130 and the 2/160. + + + 25/08/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" + + +class sun2_state : public driver_device +{ +public: + sun2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + , + m_p_ram(*this, "p_ram"){ } + + required_device m_maincpu; + virtual void machine_reset(); + + required_shared_ptr m_p_ram; +}; + +static ADDRESS_MAP_START(sun2_mem, AS_PROGRAM, 16, sun2_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("p_ram") // 8MB + AM_RANGE(0x00ef0000, 0x00ef7fff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sun2 ) +INPUT_PORTS_END + + +void sun2_state::machine_reset() +{ + UINT8* user1 = memregion("user1")->base(); + + memcpy((UINT8*)m_p_ram.target(),user1,0x8000); + + m_maincpu->reset(); +} + + +static MACHINE_CONFIG_START( sun2, sun2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68010, 16670000) + MCFG_CPU_PROGRAM_MAP(sun2_mem) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sun2_120 ) + ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "sun2-multi-rev-r.bin", 0x0000, 0x8000, CRC(4df0df77) SHA1(4d6bcf09ddc9cc8f5823847b8ea88f98fe4a642e)) +ROM_END + +ROM_START( sun2_50) + ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "250_q_8.rom", 0x0001, 0x4000, CRC(5bfacb5c) SHA1(ec7fb3fb0217b0138ba4748b7c79b8ff0cad896b)) + ROM_LOAD16_BYTE( "250_q_0.rom", 0x0000, 0x4000, CRC(2ee29abe) SHA1(82f52b9f25e92387329581f7c8ba50a171784968)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, sun2_50, 0, 0, sun2, sun2, driver_device, 0, "Sun Microsystems", "Sun 2/50", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1984, sun2_120, 0, 0, sun2, sun2, driver_device, 0, "Sun Microsystems", "Sun 2/120", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/sun3.c b/src/mame/drivers/sun3.c new file mode 100644 index 00000000000..88cb36d8bbf --- /dev/null +++ b/src/mame/drivers/sun3.c @@ -0,0 +1,977 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, R. Belmont +/*************************************************************************** + + sun3.c: preliminary driver for Sun 3 and Sun 3x models. + + status: 3/80 POSTs, 3/460 needs its unique RTC chip (also used by non-3x Sun 3s). + + TODO: + - Z8530 SCC needs to actually speak serial so we can hook up the mouse and keyboard. + - Improve interrupt controller emulation. + - Figure out how the IOMMU works. + - Intersil 7170 device for 3/460 and 3/480 (they use the same PROMs). + - Sun custom MMU for original Sun 3 models. + - AM7990 LANCE chip support for everyone. + - Figure out how the parallel printer port maps to Centronics and make it so. + - Much more... + + + Sun-3 Models + ------------ + + 3/160 + Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware + contexts, 2 MIPS + CPU: 501-1074/1096/1163/1164/1208 + Chassis type: deskside + Bus: VME, 12 slots + Memory: 16M physical (documented), 256M virtual, 270ns cycle + Notes: First 68020-based Sun machine. Uses the 3004 + "Carrera" CPU, which is used in most other Sun + 3/1xx models and the 3/75. Sun supplied 4M + memory expansion boards; third parties had up to + 32M on one card. SCSI optional. One variant of + the memory card holds a 6U VME SCSI board; there + is also a SCSI board which sits in slot 7 of the + backplane and runs the SCSI bus out the back of + the backplane to the internal disk/tape (slot 6 + in very early backplanes). CPU has two serial + ports, Ethernet, keyboard. Type 3 keyboard plugs + into the CPU; Sun-3 mouse plugs into the + keyboard. Upgradeable to a 3/260 by replacing + CPU and memory boards. + + 3/75 + Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware + contexts, 2 MIPS + CPU: 501-1074/1094/1163/1164 + Chassis type: wide pizza box + Bus: VME, 2 slot + Memory: 16M physical (documented), 256M virtual, 270ns cycle + Notes: Optional SCSI sits on memory expansion board in + second slot. + + 3/140 + Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware + contexts, 2 MIPS + CPU: 501-1074/1094/1163/1164/1208 + Chassis type: deskside + Bus: VME, 3 slots + Memory: 16M physical (documented), 256M virtual, 270ns cycle + + 3/150 + Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware + contexts, 2 MIPS + CPU: 501-1074/1094/1163/1164/1208 + Chassis type: deskside + Bus: VME, 6 slots + Memory: 16M physical (documented), 256M virtual, 270ns cycle + + 3/180 + Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware + contexts, 2 MIPS + CPU: 501-1074/1094/1163/1164/1208 + Chassis type: rackmount + Bus: VME, 12 slots + Memory: 16M physical (documented), 256M virtual, 270ns cycle + Notes: Rackmount version of 3/160. Upgradeable to a + 3/280 by replacing the CPU and memory boards. + Very early backplanes have the special SCSI + hookup on slot 6 rather than 7. + + 3/110 + Processor(s): 68020 + CPU: 501-1134/1209 + Chassis type: deskside + Bus: VME, 3 slots + Notes: Similar to the "Carerra" CPU, but has 8-bit + color framebuffer (cgfour) on board and uses 1M + RAM chips for 4M on-CPU memory. Code-named + "Prism". + + 3/50 + Processor(s): 68020 @ 15.7MHz, 68881 (socket for + 501-1075/1133/1162, installed for 501-1207), + Sun-3 MMU, 8 hardware contexts, 1.5 MIPS + CPU: 501-1075/1133/1162/1207 + Chassis type: wide pizza box + Bus: none + Memory: 4M physical (documented), 256M virtual, 270ns cycle + Notes: Cycle-stealing monochrome frame buffer. 4M + memory maximum stock, but third-party memory + expansion boards were sold, allowing up to at + least 12M. No bus or P4 connector. Onboard SCSI. + Thin coax or AUI Ethernet. Code-named "Model + 25". + + 3/60 + Processor(s): 68020 @ 20MHz, 68881 (stock), Sun-3 MMU, + 8 hardware contexts, 3 MIPS + CPU: 501-1205/1322/1334/1345 + Chassis type: wide pizza box + Bus: P4 connector (not same as P4 on 3/80) + Memory: 24M physical, 256M virtual, 200ns cycle + Notes: VRAM monochome frame buffer for 501-1205/1334. + Optional color frame buffer (can run mono and + color simultaneously) on P4 connector. Onboard + SCSI. SIMM memory (100ns 1M x 9 SIMMs). High + (1600 * 1100) or low (1152 * 900) resolution + mono selectable by jumper. Thin coax or AUI + Ethernet. Code-named "Ferrari". 4M stock on + 501-1205/1322, 0M stock on 501-1322/1345. + + 3/60LE + Processor(s): 68020 @ 20MHz, 68881 (stock), Sun-3 MMU, + 8 hardware contexts, 3 MIPS + CPU: 501-1378 + Bus: P4 connector (not same as P4 on 3/80) + Memory: 12M physical, 256M virtual, 200ns cycle + Notes: A version of the 3/60 with no onboard + framebuffer and limited to 12M of RAM (4M of + 256K SIMMs and 8M of 1M SIMMs). + + 3/260 + Processor(s): 68020 @ 25MHz, 68881 @ 20MHz (stock), Sun-3 MMU, + 8 hardware contexts, 4 MIPS + CPU: 501-1100/1206 + Chassis type: deskside + Bus: VME, 12 slot + Memory: 64M (documented) physical with ECC, 256M virtual; + 64K write-back cache, direct-mapped, + virtually-indexed and virtually-tagged, with + 16-byte lines; 80ns cycle + Notes: Two serial ports, AUI Ethernet, keyboard, and + video on CPU. Video is mono, high-resolution + only. Sun supplied 8M memory boards. Sun 4/2xx + 32M boards work up to 128M. First Sun with an + off-chip cache. Upgradeable to a 4/260 by + replacing the CPU board. Code-named "Sirius". + + 3/280 + Processor(s): 68020 @ 25MHz, 68881 @ 20MHz (stock), Sun-3 MMU, + 8 hardware contexts, 4 MIPS + CPU: 501-1100/1206 + Chassis type: rackmount + Bus: VME, 12 slot + Memory: 64M (documented) physical with ECC, 256M virtual; + 64K write-back cache, direct-mapped, + virtually-indexed and virtually-tagged, with + 16-byte lines; 80ns cycle + Notes: Rackmount version of the 3/260. Upgradeable to a + 4/280 by replacing the CPU board. Code-named + "Sirius". + + 3/80 + Processor(s): 68030 @ 20MHz, 68882 @ 20MHz, 68030 on-chip + MMU, 3 MIPS, 0.16 MFLOPS + CPU: 501-1401/1650 + Chassis type: square pizza box + Bus: P4 connector (not same as P4 on 3/60) + Memory: 16M or 40M physical, 4G virtual, 100ns cycle + Notes: Similar packaging to SparcStation 1. Parallel + port, SCSI port, AUI Ethernet, 1.44M 3.5" floppy + (720K on early units?). No onboard framebuffer. + Code-named "Hydra". Type-4 keyboard and Sun-4 + mouse, plugged together and into the machine + with a small DIN plug. 1M x 9 30-pin 100ns + SIMMs. Boot ROM versions 3.0.2 and later allow + using 4M SIMMs in some slots for up to 40M (see + Misc Q&A #15). + + 3/460 + Processor(s): 68030 @ 33 MHz, 68882, 68030 on-chip MMU, + 7 MIPS, 0.6 MFLOPS + CPU: 501-1299/1550 + Bus: VME + Memory: 128M physical with ECC, 4G/process virtual, + 64K cache, 80ns cycle + Notes: A 3/260 upgraded with a 3/4xx CPU board. Uses + original 3/2xx memory boards. + + 3/470 + Processor(s): 68030 @ 33 MHz, 68882, 68030 on-chip MMU, + 7 MIPS, 0.6 MFLOPS + CPU: 501-1299/1550 + Chassis type: deskside + Bus: VME + Memory: 128M physical with ECC, 4G/process virtual, + 64K cache, 80ns cycle + Notes: Rare. Code-named "Pegasus". 8M standard, uses + same memory boards as 3/2xx. + + 3/480 + Processor(s): 68030 @ 33 MHz, 68882, 68030 on-chip MMU, + 7 MIPS, 0.6 MFLOPS + CPU: 501-1299/1550 + Chassis type: rackmount + Bus: VME + Memory: 128M physical with ECC, 4G/process virtual, + 64K cache, 80ns cycle + Notes: Rare. Code-named "Pegasus". 8M standard, uses + same memory boards as 3/2xx. + + 3/E + Processor(s): 68020 + CPU: 501-8028 + Bus: VME + Notes: Single-board VME Sun-3, presumably for use as a + controller, not as a workstation. 6U form + factor. Serial and keyboard ports. External RAM, + framebuffer, and SCSI/ethernet boards + available. + + Sun3X notes from NetBSD and Linux: + + RAM_END 0x40000000 + P4DAC 0x50200000 + VIDEO_P4ID 0x50300000 + BW2_ADDR 0x50400000 + ENA_PLANE 0x50600000 + FPA_ADDR 0x5c000000 + IOMMU 0x60000000 + ENABLEREG 0x61000000 + BUSERRREG 0x61000400 + DIAGREG 0x61000800 + IDPROM1 0x61000c00 (3/470) + MEMREG 0x61001000 + INTERREG 0x61001400 + SCC1 0x62000000 (keyboard/mouse) + SCC2 0x62002000 (serial console) + EEPROM 0x64000000 + IDPROM2 0x640007d8 (3/80) + CLOCK2 0x640007f8 (3/80 Mostek 48T02) + CLOCK1 0x64002000 (3/470 Intersil 7170) + INTELETH 0x65000000 + LANCEETH 0x65002000 + EMULEXSCSI 0x66000000 (3/80 5394) + EMULLEXDMA 0x66001000 (3/80) + PCACHETAG 0x68000000 + ECCPARREG 0x6a1e0000 + IOCTAGS 0x6c000000 + IOCFLUSH 0x6d000000 + FDC 0x6e000000 (3/80 Intel 82077) + FDC_CNTRL 0x6e000400 + FDC_VEC 0x6e000800 + PRINTER 0x6f00003c (3/80) + + The Sun3x System Enable Register controls the function of a few + on-board devices and general system operation. It is cleared when + the system is reset. + + 15 0 + +---+---+---+---+---+---+---+---+---+---+---+---+---+---.---.---+ + |BT |FPP|DMA| 0 |VID|RES|FPA|DIA| 0 |CCH|IOC|LBK|DCH| UNUSED | + +---+---+---+---+---+---+---+---+---+---+---+---+---+---.---.---+ + + Where: DCH = debug mode for system cache + LBK = VME loopback + IOC = I/O cache enable + CCH = system cache enable + DIA = diagnostic switch + FPA = enable floating-point accelerator + RES = 0 for hi-res, 1 for low res + VID = enable video display + DMA = enable system DVMA + FPP = enable 68881/2 FPU + BT = 0 for boot state, 1 for normal state + + bad '030 MMU mapping: L fef82000 -> P 00000000 + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/timekpr.h" +#include "machine/8530scc.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" +#include "bus/scsi/scsicd.h" +#include "machine/ncr539x.h" +#include "machine/upd765.h" +#include "formats/pc_dsk.h" +#include "formats/mfi_dsk.h" + +#define TIMEKEEPER_TAG "timekpr" +#define SCC1_TAG "scc1" +#define SCC2_TAG "scc2" +#define ESP_TAG "esp" +#define FDC_TAG "fdc" + +class sun3_state : public driver_device +{ +public: + sun3_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_scc1(*this, SCC1_TAG), + m_scc2(*this, SCC2_TAG), + m_fdc(*this, FDC_TAG), + m_p_ram(*this, "p_ram"), + m_bw2_vram(*this, "bw2_vram") + { } + + required_device m_maincpu; + required_device m_scc1; + required_device m_scc2; + optional_device m_fdc; + virtual void machine_reset(); + + required_shared_ptr m_p_ram; + optional_shared_ptr m_bw2_vram; + + DECLARE_READ32_MEMBER(enable_r); + DECLARE_WRITE32_MEMBER(enable_w); + DECLARE_READ32_MEMBER(buserr_r); + DECLARE_WRITE32_MEMBER(buserr_w); + DECLARE_READ32_MEMBER(diag_r); + DECLARE_WRITE32_MEMBER(diag_w); + DECLARE_READ32_MEMBER(printer_r); + DECLARE_WRITE32_MEMBER(printer_w); + DECLARE_READ32_MEMBER(iommu_r); + DECLARE_WRITE32_MEMBER(iommu_w); + DECLARE_READ32_MEMBER(irqctrl_r); + DECLARE_WRITE32_MEMBER(irqctrl_w); + DECLARE_READ32_MEMBER(memreg_r); + DECLARE_WRITE32_MEMBER(memreg_w); + DECLARE_READ32_MEMBER(memrerraddr_r); + DECLARE_WRITE32_MEMBER(memrerraddr_w); + DECLARE_READ32_MEMBER(fdc_control_r); + DECLARE_WRITE32_MEMBER(fdc_control_w); + DECLARE_READ32_MEMBER(cause_buserr_r); + DECLARE_WRITE32_MEMBER(cause_buserr_w); + DECLARE_WRITE32_MEMBER(ramwrite_w); + DECLARE_READ32_MEMBER(fpa_r); + DECLARE_READ32_MEMBER(p4id_r); + + DECLARE_READ8_MEMBER(scc1_r); + DECLARE_WRITE8_MEMBER(scc1_w); + DECLARE_READ8_MEMBER(scc2_r); + DECLARE_WRITE8_MEMBER(scc2_w); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + TIMER_DEVICE_CALLBACK_MEMBER(sun380_timer); + + UINT32 bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +private: + UINT32 m_enable, m_buserr, m_diag, m_printer, m_irqctrl, m_memreg, m_memerraddr; + UINT32 m_iommu[0x800]; + bool m_bInBusErr; +}; + +static ADDRESS_MAP_START(sun3_mem, AS_PROGRAM, 32, sun3_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x00ffffff) AM_RAM AM_SHARE("p_ram") // 16MB + AM_RANGE(0x0fef0000, 0x0fefffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sun3_80_mem, AS_PROGRAM, 32, sun3_state) + AM_RANGE(0x00000000, 0x03ffffff) AM_RAM AM_SHARE("p_ram") AM_WRITE(ramwrite_w) + AM_RANGE(0x40000000, 0x40000003) AM_READWRITE(cause_buserr_r, cause_buserr_w) + AM_RANGE(0x50300000, 0x50300003) AM_READ(p4id_r) + AM_RANGE(0x50400000, 0x504fffff) AM_RAM AM_SHARE("bw2_vram") + AM_RANGE(0x60000000, 0x60001fff) AM_READWRITE(iommu_r, iommu_w) + AM_RANGE(0x61000000, 0x61000003) AM_READWRITE(enable_r, enable_w) + AM_RANGE(0x61000400, 0x61000403) AM_READWRITE(buserr_r, buserr_w) + AM_RANGE(0x61000800, 0x61000803) AM_READWRITE(diag_r, diag_w) + AM_RANGE(0x61001000, 0x61001003) AM_READWRITE(memreg_r, memreg_w) + AM_RANGE(0x61001004, 0x61001007) AM_READWRITE(memrerraddr_r, memrerraddr_w) + AM_RANGE(0x61001400, 0x61001403) AM_READWRITE(irqctrl_r, irqctrl_w) + AM_RANGE(0x62000000, 0x6200000f) AM_READWRITE8(scc1_r, scc1_w, 0xff00ff00) + AM_RANGE(0x62002000, 0x6200200f) AM_READWRITE8(scc2_r, scc2_w, 0xff00ff00) + AM_RANGE(0x63000000, 0x6301ffff) AM_ROM AM_REGION("user1",0) + AM_RANGE(0x64000000, 0x640007ff) AM_DEVREADWRITE8(TIMEKEEPER_TAG, timekeeper_device, read, write, 0xffffffff) + AM_RANGE(0x66000000, 0x6600003f) AM_DEVREADWRITE8(ESP_TAG, ncr539x_device, read, write, 0xff000000) + AM_RANGE(0x6e000000, 0x6e000007) AM_DEVICE8(FDC_TAG, n82077aa_device, map, 0xffffffff) + AM_RANGE(0x6e000400, 0x6e000403) AM_READWRITE(fdc_control_r, fdc_control_w) + AM_RANGE(0x6f00003c, 0x6f00003f) AM_READWRITE(printer_r, printer_w) + AM_RANGE(0xfefe0000, 0xfefeffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sun3_460_mem, AS_PROGRAM, 32, sun3_state) + AM_RANGE(0x00000000, 0x03ffffff) AM_RAM AM_SHARE("p_ram") AM_WRITE(ramwrite_w) + AM_RANGE(0x09000000, 0x09000003) AM_READWRITE(cause_buserr_r, cause_buserr_w) + AM_RANGE(0x50300000, 0x50300003) AM_READ(p4id_r) + AM_RANGE(0x50400000, 0x504fffff) AM_RAM AM_SHARE("bw2_vram") + AM_RANGE(0x5c000f14, 0x5c000f17) AM_READ(fpa_r) + AM_RANGE(0x60000000, 0x60001fff) AM_READWRITE(iommu_r, iommu_w) + AM_RANGE(0x61000000, 0x61000003) AM_READWRITE(enable_r, enable_w) + AM_RANGE(0x61000400, 0x61000403) AM_READWRITE(buserr_r, buserr_w) + AM_RANGE(0x61000800, 0x61000803) AM_READWRITE(diag_r, diag_w) + AM_RANGE(0x61001000, 0x61001003) AM_READWRITE(memreg_r, memreg_w) + AM_RANGE(0x61001004, 0x61001007) AM_READWRITE(memrerraddr_r, memrerraddr_w) + AM_RANGE(0x61001400, 0x61001403) AM_READWRITE(irqctrl_r, irqctrl_w) + AM_RANGE(0x62000000, 0x6200000f) AM_READWRITE8(scc1_r, scc1_w, 0xff00ff00) + AM_RANGE(0x62002000, 0x6200200f) AM_READWRITE8(scc2_r, scc2_w, 0xff00ff00) + AM_RANGE(0x63000000, 0x6301ffff) AM_ROM AM_REGION("user1",0) + + AM_RANGE(0x6f00003c, 0x6f00003f) AM_READWRITE(printer_r, printer_w) + AM_RANGE(0xfefe0000, 0xfefeffff) AM_ROM AM_REGION("user1",0) +ADDRESS_MAP_END + +READ32_MEMBER( sun3_state::p4id_r ) +{ + return (1<<24); // 0 = hires bw2 1600x1280, 1 = bw2 1152x900, 0x45 is "Ibis" color, blt 0x68 is "Lego" color +} + +WRITE32_MEMBER( sun3_state::fdc_control_w ) +{ + logerror("FDC write %02x (%08x)\n", data >> 24, space.device().safe_pc()); +} + +READ32_MEMBER( sun3_state::fdc_control_r ) +{ + // Type of floppy present + // 0 = no floppy in drive + // 1 = ed + // 2 = hd + // 3 = dd + + if(m_fdc) { + floppy_image_device *fdev = machine().device(":fdc:0")->get_device(); + if(fdev->exists()) { + UINT32 variant = fdev->get_variant(); + switch(variant) { + case floppy_image::SSSD: + case floppy_image::SSDD: + case floppy_image::DSDD: + return 3 << 24; + + case floppy_image::DSHD: + return 2 << 24; + + case floppy_image::DSED: + return 1 << 24; + } + } + } + + return 0 << 24; +} + +WRITE32_MEMBER(sun3_state::ramwrite_w) +{ + UINT32 *pRAM = (UINT32 *)m_p_ram.target(); + + if (((m_memreg & 0xf0000000) == 0x70000000) && + (m_irqctrl & 0x01000000) && + !(m_bInBusErr)) + { + m_memerraddr = offset<<2; + + // low 4 bits of memreg are the byte lane(s) involved, negative logic + m_memreg |= 0x0f; + switch (mem_mask) + { + case 0xff000000: + m_memreg &= ~0x08; + break; + + case 0x00ff0000: + m_memerraddr += 1; + m_memreg &= ~0x04; + break; + + case 0x0000ff00: + m_memerraddr += 2; + m_memreg &= ~0x02; + break; + + case 0x000000ff: + m_memerraddr += 3; + m_memreg &= ~0x01; + break; + + case 0x0000ffff: + m_memerraddr += 2; + m_memreg &= ~0x03; + break; + + case 0xffff0000: + m_memreg &= ~0x0c; + break; + + case 0xffffffff: // no address adjust, show all 4 lanes as problematic + break; + } + + m_bInBusErr = true; // prevent recursion + m_maincpu->set_input_line_and_vector(M68K_IRQ_7, ASSERT_LINE, 2); + } + + COMBINE_DATA(&pRAM[offset]); +} + +// sun3: 0 = B control, 1 = B data, 2 = A control, 3 = A data +// 8530scc: 0 = B control, 1 = A control, 2 = B data, 3 = A data +READ8_MEMBER(sun3_state::scc1_r) +{ + int regsel = ((offset & 1)<<1) | ((offset & 2) >> 1); + return m_scc1->reg_r(space, regsel); +} + +WRITE8_MEMBER(sun3_state::scc1_w) +{ + int regsel = ((offset & 1)<<1) | ((offset & 2) >> 1); + m_scc1->reg_w(space, regsel, data); +} + +READ8_MEMBER(sun3_state::scc2_r) +{ + int regsel = ((offset & 1)<<1) | ((offset & 2) >> 1); + return m_scc2->reg_r(space, regsel); +} + +WRITE8_MEMBER(sun3_state::scc2_w) +{ + int regsel = ((offset & 1)<<1) | ((offset & 2) >> 1); + m_scc2->reg_w(space, regsel, data); +} + +READ32_MEMBER(sun3_state::enable_r) +{ + return m_enable; +} + +WRITE32_MEMBER(sun3_state::enable_w) +{ +// printf("sun3x: %08x to enable (mask %08x)\n", data, mem_mask); + COMBINE_DATA(&m_enable); +} + +READ32_MEMBER(sun3_state::buserr_r) +{ + UINT32 rv = m_buserr; + m_buserr = 0; + return rv; +} + +WRITE32_MEMBER(sun3_state::buserr_w) +{ +// printf("sun3x: %08x to buserr (mask %08x)\n", data, mem_mask); + COMBINE_DATA(&m_buserr); +} + +READ32_MEMBER(sun3_state::diag_r) +{ + return m_diag; +} + +WRITE32_MEMBER(sun3_state::diag_w) +{ +// printf("sun3x: %08x to diag (mask %08x)\n", data, mem_mask); + COMBINE_DATA(&m_diag); +} + +READ32_MEMBER(sun3_state::printer_r) +{ + return m_printer; +} + +WRITE32_MEMBER(sun3_state::printer_w) +{ +// printf("sun3x: %08x to printer (mask %08x)\n", data, mem_mask); + COMBINE_DATA(&m_printer); +} + +READ32_MEMBER(sun3_state::irqctrl_r) +{ + return m_irqctrl; +} + +WRITE32_MEMBER(sun3_state::irqctrl_w) +{ +// printf("sun3x: %08x to interrupt control (mask %08x)\n", data, mem_mask); + COMBINE_DATA(&m_irqctrl); + + if (data & 0x01000000) + { + if (data & 0x02000000) + { + m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); + } + if (data & 0x04000000) + { + m_maincpu->set_input_line(M68K_IRQ_2, ASSERT_LINE); + } + if (data & 0x08000000) + { + m_maincpu->set_input_line(M68K_IRQ_3, ASSERT_LINE); + } + if (!(data & 0x80000000)) + { + m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); + } + } + else // master enable clear, clear all interrupts + { + m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_5, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_6, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); + } +} + +READ32_MEMBER(sun3_state::memreg_r) +{ + return m_memreg; +} + +WRITE32_MEMBER(sun3_state::memreg_w) +{ +// printf("sun3x: %08x to memory control (mask %08x)\n", data, mem_mask); + COMBINE_DATA(&m_memreg); +} + +READ32_MEMBER(sun3_state::memrerraddr_r) +{ + m_bInBusErr = false; + m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); + return m_memerraddr; +} + +WRITE32_MEMBER(sun3_state::memrerraddr_w) +{ +// printf("sun3x: %08x to memory error address (mask %08x)\n", data, mem_mask); + COMBINE_DATA(&m_memerraddr); +} + +READ32_MEMBER(sun3_state::iommu_r) +{ + return m_iommu[offset]; +} + +// IOMMU entry defs: +// address mask: 0x03ffe000 +// cache inhibit: 0x00000040 +// full block: 0x00000020 +// modified: 0x00000010 +// used: 0x00000008 +// write prot: 0x00000004 +// bad: 0x00000002 +// valid: 0x00000001 +WRITE32_MEMBER(sun3_state::iommu_w) +{ + COMBINE_DATA(&m_iommu[offset]); +} + +READ32_MEMBER(sun3_state::fpa_r) +{ + m_buserr |= 0x04000000; + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + return 0xffffffff; +} + +READ32_MEMBER(sun3_state::cause_buserr_r) +{ + m_buserr |= 0x20000000; + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + return 0xffffffff; +} + +WRITE32_MEMBER(sun3_state::cause_buserr_w) +{ + m_buserr |= 0x20000000; + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); +} + +TIMER_DEVICE_CALLBACK_MEMBER(sun3_state::sun380_timer) +{ + if ((m_irqctrl & 0x81000000) == 0x81000000) + { + m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_7, ASSERT_LINE); + } +} + +UINT32 sun3_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y; + UINT8 pixels; + static const UINT32 palette[2] = { 0, 0xffffff }; + UINT8 *m_vram = (UINT8 *)m_bw2_vram.target(); + + for (y = 0; y < 900; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 1152/8; x++) + { + pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[(pixels>>7)&1]; + *scanline++ = palette[(pixels>>6)&1]; + *scanline++ = palette[(pixels>>5)&1]; + *scanline++ = palette[(pixels>>4)&1]; + *scanline++ = palette[(pixels>>3)&1]; + *scanline++ = palette[(pixels>>2)&1]; + *scanline++ = palette[(pixels>>1)&1]; + *scanline++ = palette[(pixels&1)]; + } + } + + return 0; +} + +/* Input ports */ +static INPUT_PORTS_START( sun3 ) +INPUT_PORTS_END + + +void sun3_state::machine_reset() +{ + UINT8* user1 = memregion("user1")->base(); + + memcpy((UINT8*)m_p_ram.target(),user1,0x10000); + + m_maincpu->reset(); + + memset(m_iommu, 0, sizeof(m_iommu)); + + m_enable = 0; + m_buserr = 0; + m_diag = 0; + m_printer = 0; + m_irqctrl = 0; + m_memreg = 0; + m_memerraddr = 0; + m_bInBusErr = false; +} + +FLOPPY_FORMATS_MEMBER( sun3_state::floppy_formats ) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( sun_floppies ) + SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( sun3, sun3_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68020, 16670000) + MCFG_CPU_PROGRAM_MAP(sun3_mem) + + MCFG_DEVICE_ADD(SCC1_TAG, SCC8530, XTAL_4_9152MHz) + MCFG_DEVICE_ADD(SCC2_TAG, SCC8530, XTAL_4_9152MHz) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( sun3_80, sun3_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68030, 20000000) + MCFG_CPU_PROGRAM_MAP(sun3_80_mem) + + MCFG_M48T02_ADD(TIMEKEEPER_TAG) + + MCFG_DEVICE_ADD(SCC1_TAG, SCC8530, XTAL_4_9152MHz) + MCFG_DEVICE_ADD(SCC2_TAG, SCC8530, XTAL_4_9152MHz) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) + + MCFG_DEVICE_ADD(ESP_TAG, NCR539X, 20000000/2) + MCFG_LEGACY_SCSI_PORT("scsi") + + MCFG_N82077AA_ADD("fdc", n82077aa_device::MODE_PS2) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", sun_floppies, "35hd", sun3_state::floppy_formats) + + // the timekeeper has no interrupt output, so 3/80 includes a dedicated timer circuit + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer", sun3_state, sun380_timer, attotime::from_hz(100)) + + MCFG_SCREEN_ADD("bwtwo", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(sun3_state, bw2_update) + MCFG_SCREEN_SIZE(1152,900) + MCFG_SCREEN_VISIBLE_AREA(0, 1152-1, 0, 900-1) + MCFG_SCREEN_REFRESH_RATE(72) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( sun3_460, sun3_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68030, 33000000) + MCFG_CPU_PROGRAM_MAP(sun3_460_mem) + + MCFG_M48T02_ADD(TIMEKEEPER_TAG) + + MCFG_DEVICE_ADD(SCC1_TAG, SCC8530, XTAL_4_9152MHz) + MCFG_DEVICE_ADD(SCC2_TAG, SCC8530, XTAL_4_9152MHz) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( sun3_50 ) + ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) +/* +Sun 3/50 V1.2 Bootprom +Sun 3/50 V1.4 Bootprom +Sun 3/50 V1.6 Bootprom +Sun 3/50 V1.8 Bootprom (Req. to load SunOS QIC-24 1/4" tapes) +Sun 3/50 V2.0 Bootprom +Sun 3/50 V2.1 Bootprom +Sun 3/50 V2.3 Bootprom +Sun 3/50 V2.5 Bootprom (Req. to load SunOS QIC-24 1/4" tapes from a Sun-2 Shoebox) +Sun 3/50 V2.6 Bootprom +Sun 3/50 V2.7 Bootprom +Sun 3/50 V2.8 Bootprom +*/ + ROM_SYSTEM_BIOS(0, "rev28", "Rev 2.8") + ROMX_LOAD( "sun3_50_v2.8", 0x0000, 0x10000, CRC(1ca6b0e8) SHA1(5773ac1c46399501d29d1758aa342862b03ec472), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rev27", "Rev 2.7") + ROMX_LOAD( "sun3_50_v2.7", 0x0000, 0x10000, CRC(7c4a9e20) SHA1(6dcd4883a170538050fd0e1f151fae413ec9ea52), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "rev26", "Rev 2.6") + ROMX_LOAD( "sun3_50_v2.6", 0x0000, 0x10000, CRC(08abbb3b) SHA1(6bfb8d5c97d801cd7bb7d564de0e68a48fb807c4), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "rev23", "Rev 2.3") + ROMX_LOAD( "sun3_50_v2.3", 0x0000, 0x10000, CRC(163500b3) SHA1(437c8d539e12d442ca6877566dbbe165d577fcab), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "rev16", "Rev 1.6") + ROMX_LOAD( "sun3_50_v1.6", 0x0000, 0x10000, CRC(8be20826) SHA1(2a4d73fcb7fe0f0c83eb0f4c91d957b7bf88b7ed), ROM_BIOS(5)) +ROM_END + +ROM_START( sun3_60 ) + ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) +/* +Sun 3/60 V1.0 Bootprom +Sun 3/60 V1.3 Bootprom +Sun 3/60 V1.5 Bootprom +Sun 3/60 V1.6 Bootprom (Req. to load SunOS QIC-24 1/4" tapes +Sun 3/60 V1.9 Bootprom +Sun 3/60 V2.8.3 Bootprom +Sun 3/60 V3.0.1 Bootprom +*/ + ROM_SYSTEM_BIOS(0, "rev301", "Rev 3.0.1") + ROMX_LOAD( "sun_3.60v3.0.1", 0x0000, 0x10000, CRC(e55dc1d8) SHA1(6e48414ce2139282e69f57612b20f7d5c475e74c), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rev283", "Rev 2.8.3") + ROMX_LOAD( "sun_3.60v2.8.3", 0x0000, 0x10000, CRC(de4ec54d) SHA1(e621a9c1a2a7df4975b12fa3a0d7f106383736ef), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "rev19", "Rev 1.9") + ROMX_LOAD( "sun_3.60v1.9", 0x0000, 0x10000, CRC(32b6d3a9) SHA1(307756ba5698611d51059881057f8086956ce895), ROM_BIOS(3)) +ROM_END + +ROM_START( sun3_110 ) + ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) +/* +Sun 3/110 V1.8 Bootprom +Sun 3/110 V2.1 Bootprom +Sun 3/110 V2.3 Bootprom +Sun 3/110 V2.6 Bootprom +Sun 3/110 V2.7 Bootprom +Sun 3/110 V2.8 Bootprom +Sun 3/110 V3.0 Bootprom +*/ + ROM_SYSTEM_BIOS(0, "rev30", "Rev 3.0") + ROMX_LOAD( "sun3_110_v3.0", 0x0000, 0x10000, CRC(a193b26b) SHA1(0f54212ee3a5709f70e921069cca1ddb8c143b1b), ROM_BIOS(1)) +ROM_END + +ROM_START( sun3_150 ) + ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) +/* +Sun 3/1[4,5,6,8]0 V1.3 Bootprom +Sun 3/1[4,5,6,8]0 V1.4 Bootprom +Sun 3/1[4,5,6,8]0 V1.5 Bootprom +Sun 3/1[4,5,6,8]0 V1.8 Bootprom (Req. to load SunOS QIC-24 1/4" tapes) +Sun 3/1[4,5,6,8]0 V2.1 Bootprom +Sun 3/1[4,5,6,8]0 V2.1 Bootprom with Capricot Rimfire 3200/3400 support (b rf(0,0,0) works) +Sun 3/1[4,5,6,8]0 V2.3 Bootprom +Sun 3/1[4,5,6,8]0 V2.6 Bootprom (Req. to load SunOS QIC-24 1/4" tapes from a Sun-2 Shoebox and for Xylogics 7053) +Sun 3/1[4,5,6,8]0 V2.7 Bootprom +Sun 3/1[4,5,6,8]0 V2.8 Bootprom +Sun 3/1[4,5,6,8]0 V2.8.4 Bootprom +Sun 3/1[4,5,6,8]0 V3.0 Bootprom +*/ + ROM_SYSTEM_BIOS(0, "rev30", "Rev 3.0") + ROMX_LOAD( "sun3_160_v3.0", 0x0000, 0x10000, CRC(fee6e4d6) SHA1(440d532e1848298dba0f043de710bb0b001fb675), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rev284", "Rev 2.8.4") + ROMX_LOAD( "sun3_160_v2.8.4", 0x0000, 0x10000, CRC(3befd013) SHA1(f642bb42200b794e6e32e2fe6c87d5c269c8656d), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "rev23", "Rev 2.3") + ROMX_LOAD( "sun3_160_v2.3", 0x0000, 0x10000, CRC(09585745) SHA1(1de1725dd9e27f5a910989bbb5b51acfbdc1d70b), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "rev21rf", "Rev 2.1 RF") + ROMX_LOAD( "sun3_160_v2.1_rf", 0x0000, 0x10000, CRC(5c7e9271) SHA1(5e4dbb50859a21f9e1d3e4a06c42494d13a9a8eb), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "rev15", "Rev 1.5") + ROMX_LOAD( "sun3_160_v1.5", 0x0000, 0x10000, CRC(06daee37) SHA1(b9873cd48d78ad8e0c85d69966fc20c21cfc99aa), ROM_BIOS(5)) +ROM_END + +ROM_START( sun3_260 ) + ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) +/* +Sun 3/260/280 V1.8 Bootprom +Sun 3/260/280 V2.1 Bootprom ( 2x^G cause system to beep 'till reset) +Sun 3/260/280 V2.3 Bootprom +Sun 3/260/280 V2.6 Bootprom (Req. for Xylogics 7053) +Sun 3/260/280 V2.7 Bootprom +Sun 3/260/280 V2.8 Bootprom +Sun 3/260/280 V2.8.4 Bootprom +Sun 3/260/280 V3.0 Bootprom +*/ + ROM_SYSTEM_BIOS(0, "rev30", "Rev 3.0") + ROMX_LOAD( "sun3_260_v3.0", 0x0000, 0x10000, CRC(f43ed1d3) SHA1(204880436bd087ede136f853610403d75e60bd75), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rev27", "Rev 2.7") + ROMX_LOAD( "sun3_260_v2.7", 0x0000, 0x10000, CRC(099fcaab) SHA1(4a5233c778676f48103bdd8bab03b4264686b4aa), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "rev26", "Rev 2.6") + ROMX_LOAD( "sun3_260_v2.6", 0x0000, 0x10000, CRC(e8b17951) SHA1(e1fdef42670a349d99b0eca9c50c8566b8bb7c56), ROM_BIOS(3)) +ROM_END + +ROM_START( sun3_e ) + ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "rev28", "Rev 3.2") + ROMX_LOAD( "sun3_e.32", 0x0000, 0x10000, CRC(acedde7e) SHA1(1ab6ec28f4365a613a5e326c34cb37585c3f0ecc), ROM_BIOS(1)) +ROM_END + +ROM_START( sun3_80 ) + ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) +/* +Sun 3/80 V1.0 Bootprom +Sun 3/80 V2.2 Bootprom +Sun 3/80 V2.3 Bootprom +Sun 3/80 V2.9.2 Bootprom +Sun 3/80 V3.0 Bootprom +Sun 3/80 V3.0.2 Bootprom +Sun 3/80 V3.0.3 Bootprom +*/ + ROM_SYSTEM_BIOS(0, "rev303", "Rev 3.0.3") + ROMX_LOAD( "sun3_80_v3.0.3", 0x0000, 0x20000, CRC(8f983115) SHA1(e4be2dcbb29fc5c60ed9d838ab241c634fdd24e5), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rev302", "Rev 3.0.2") + ROMX_LOAD( "sun3_80_v3.0.2", 0x0000, 0x20000, CRC(c09a3592) SHA1(830187dfe58e65289533717a797d2c42da86ac4e), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "rev30", "Rev 3.0") + ROMX_LOAD( "sun3_80_v3.0", 0x0000, 0x20000, CRC(47e3b012) SHA1(1e045b6f542aaf7808d6567c28a9e734a8c5d815), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "rev292", "Rev 2.9.2") + ROMX_LOAD( "sun3_80_v2.9.2", 0x0000, 0x20000, CRC(32bcf711) SHA1(7ecd4a0d0988c1d1d53fd79ac16c8456ed73ace1), ROM_BIOS(4)) + + // default NVRAM: includes valid settings for console on framebuffer, boot from SCSI disk, Ethernet ID, more + ROM_REGION( 0x800, TIMEKEEPER_TAG, 0 ) + ROM_LOAD( "timekpr_380.bin", 0x000000, 0x000800, CRC(e76f1aae) SHA1(8e7c36e3928887a94a8133e8416ee4126c31edd7) ) +ROM_END + +ROM_START( sun3_460 ) + ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) +/* +Sun 3/460/480 V1.2.3 Bootprom +Sun 3/460/480 V2.9.1 Bootprom (2 Files, one for odd and one for even addresses) +Sun 3/460/480 V2.9.2 Bootprom +Sun 3/460/480 V2.9.3 Bootprom +Sun 3/460/480 V3.0 Bootprom (2 Files, one for odd and one for even addresses) +*/ + ROM_SYSTEM_BIOS(0, "rev30", "Rev 3.0") + ROMX_LOAD( "3_400_l.300", 0x00000, 0x10000, CRC(1312a04b) SHA1(6c3b67ba3567991897a48fe20f589ebbfcf0a35d), ROM_BIOS(1)) + ROMX_LOAD( "3_400_h.300", 0x10000, 0x10000, CRC(8d688672) SHA1(a5593844ce6af6c4f7f39bb653dc8f964b73b095), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rev291", "Rev 2.9.1") + ROMX_LOAD( "sun3_460_v2.9.1_0", 0x00000, 0x10000, CRC(d62dbf09) SHA1(4a6b5fd7840b44fe93c9058a8973d8dd3c9f7d24), ROM_BIOS(2)) + ROMX_LOAD( "sun3_460_v2.9.1_1", 0x10000, 0x10000, CRC(3b5a5942) SHA1(ed6250e3c07d7cb62d4dd517a8637c8d37e16dc5), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, sun3_50, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/50", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Model 25 +COMP( 198?, sun3_60, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/60", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Ferrari +COMP( 198?, sun3_110, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/110", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Prism +COMP( 198?, sun3_150, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/75/140/150/160/180", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // AKA Carrera +COMP( 198?, sun3_260, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/260/280", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Prism +COMP( 198?, sun3_e, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/E", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Polaris + +COMP( 198?, sun3_80, 0, 0, sun3_80, sun3, driver_device, 0, "Sun Microsystems", "Sun 3x/80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Hydra +COMP( 198?, sun3_460, 0, 0, sun3_460, sun3, driver_device, 0, "Sun Microsystems", "Sun 3x/460/470/480", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Pegasus diff --git a/src/mame/drivers/sun4.c b/src/mame/drivers/sun4.c new file mode 100644 index 00000000000..140fddc9307 --- /dev/null +++ b/src/mame/drivers/sun4.c @@ -0,0 +1,595 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Sun-4 Models + ------------ + + 4/260 + Processor(s): SF9010 @ 16.67MHz, Weitek 1164/1165, Sun-4 MMU, + 16 hardware contexts + Speed ratings: 10 MIPS, 1.6 MFLOPS + CPU: 501-1274/1491/1522 + Chassis type: deskside + Bus: VME (12 slot) + Memory: 128M (documented) physical with ECC, 1G/process virtual, + 60ns cycle + Architecture: sun4 + Notes: First SPARC machine. Code-named "Sunrise". Cache + much like Sun-3/2xx, uses same memory boards. + May be upgraded 3/260. + + 4/110 + Processor(s): MB86900 @ 14.28MHz, Weitek 1164/1165, Sun-4 MMU, + 16 hardware contexts + Speed ratings: 7 MIPS + CPU: 501-1199/1237/1462/1463/1464/1465/1512/1513/ + 1514/1515/1516/1517/1656/1657/1658/1659/ + 1660/1661 + Chassis type: deskside + Bus: VME (3 slot), P4 + Memory: 32M physical with parity, 1G/process virtual, + 70ns cycle + Architecture: sun4 + Notes: First desktop-able SPARC. CPU doesn't support + VME busmaster cards (insufficient room on CPU + board for full VME bus interface), so DMA disk + and tape boards won't work with it. Originally + intended as single-board machine, although there + are a few slave-only VME boards (such as the + ALM-2 and second ethernet controller) which work + with it. SIMM memory (static column?). + Code-named "Cobra". CPUs 501-1199/1462/1464/1512/ + 1514/1516/1656/1658/1660 do not have an FPU; + 501-1237/1463/1465/1513/1515/1517/1657/1659/1661 + have an FPU. + + 4/280 + Chassis type: rackmount + Notes: Rackmount version of 4/260. May be upgraded + 3/280. + + 4/150 + Chassis type: deskside + Bus: VME (6 slot) + Notes: See 4/110. + + SPARCstation 1 (4/60) + Processor(s): MB86901A or LSI L64801 @ 20MHz, Weitek 3170, + Sun-4c MMU, 8 hardware contexts + Speed ratings: 12.5 MIPS, 1.4 MFLOPS, 10 SPECmark89 + CPU: 501-1382/1629 + Chassis type: square pizza box + Bus: SBus @ 20MHz (3 slots, slot 3 slave-only) + Memory: 64M physical with synchronous parity, + 512M/process virtual, 50 ns cycle + Cache: 64K write-through, direct-mapped, virtually + indexed, virtually tagged, 16-byte lines + Architecture: sun4c + Notes: Code name "Campus". SIMM memory. 3.5" floppy. + First supported in SunOS 4.0.3c. + + SPARCserver 1 + Notes: SPARCstation 1 without a monitor/framebuffer. + + 4/330 (SPARCstation 330, SPARCserver 330) + Processor(s): CY7C601 @ 25MHz, TI8847, Sun-4 MMU, 16 hardware + contexts + Speed ratings: 16 MIPS, 2.6 MFLOPS, 11.3 SPECmark89 + CPU: 501-1316/1742 + Bus: VME (3 9U slots, 2 each 6U and 3U), P4 + Memory: 56M/72M (documented) physical with synchronous + parity, 1G/process virtual, 40ns cycle + Cache: 128K + Architecture: sun4 + Notes: SIMM memory. Cache similar to 4/2xx but + write-through. Code-named "Stingray". 56M limit + only for early versions of ROM. + + 4/310 + Chassis: deskside + Bus: VME (3 slots), P4 + Notes: See 4/330. + + 4/350 + Chassis: deskside + Bus: VME (6 slots), P4 + Notes: See 4/330. + + 4/360 + Notes: 4/260 upgraded with a 4/3xx CPU and memory boards. + + 4/370 (SPARCstation 370, SPARCserver 370) + Chassis: deskside + Bus: VME (12 slots), P4 + Notes: See 4/330. + + 4/380 + Notes: 4/280 upgraded with a 4/3xx CPU and memory boards.. + + 4/390 (SPARCserver 390) + Chassis: rackmount + Bus: VME (16 slots) + Notes: See 4/330. + + 4/470 (SPARCstation 470, SPARCserver 470) + Processor(s): CY7C601 @ 33MHz, TI8847 (?), 64 MMU hardware + contexts + Speed ratings: 22 MIPS, 3.8 MFLOPS, 17.6 SPECmark89 + CPU: 501-1381/1899 + Chassis: deskside + Bus: VME (12 slots), P4 + Memory: 96M (documented) physical + Cache: 128K + Architecture: sun4 + Notes: Write-back rather than write-through cache, + 3-level rather than 2-level Sun-style MMU. + Code-name "Sunray" (which was also the code name + for the 7C601 CPU). + + 4/490 (SPARCserver 490) + Chassis: rackmount + Bus: VME (16 slots), P4 + Notes: See 4/470. + + SPARCstation SLC (4/20) + Processor(s): MB86901A or LSI L64801 @ 20MHz + Speed ratings: 12.5 MIPS, 1.2 MFLOPS, 8.6 SPECmark89 + CPU: 501-1627/1680/1720/1748 (1776/1777 ?) + Chassis type: monitor + Bus: none + Memory: 16M physical + Cache: 64K write-through, direct-mapped, virtually + indexed, virtually tagged, 16-byte lines + Architecture: sun4c + Notes: Code name "Off-Campus". SIMM memory. No fan. + Built into 17" mono monitor. First supported in + SunOS 4.0.3c. + + SPARCstation IPC (4/40) + Processor(s): MB86901A or LSI L64801 @ 25MHz + Speed ratings: 13.8 SPECint92, 11.1 SPECfp92, 327 + SPECintRate92, 263 SPECfpRate92 + CPU: 501-1689/1835/1870/1974 (1690?) + Chassis type: lunchbox + Bus: SBus @ 25MHz (2 slots) + Memory: 48M physical + Cache: 64K write-through, direct-mapped, virtually + indexed, virtually tagged, 16-byte lines + Architecture: sun4c + Notes: Code name "Phoenix". SIMM memory. Onboard mono + framebuffer. 3.5" floppy. First supported in + SunOS 4.0.3c. + + SPARCstation 1+ (4/65) + Processor(s): LSI L64801 @ 25MHz, Weitek 3172, Sun-4c MMU, + 8 hardware contexts + Speed ratings: 15.8 MIPS, 1.7 MFLOPS, 12 SPECmark89 + CPU: 501-1632 + Chassis type: square pizza box + Bus: SBus @ 25MHz (3 slots, slot 3 slave-only) + Memory: 64M (40M?) physical with synchronous parity, + 512M/process virtual, 50ns cycle + Cache: 64K write-through, direct-mapped, virtually + indexed, virtually tagged, 16-byte lines + Architecture: sun4c + Notes: Code name "Campus B". SIMM memory. 3.5" floppy. + Essentially same as SPARCstation 1, just faster + clock and improved SCSI controller. First + supported in SunOS 4.0.3c. + + SPARCserver 1+ + Notes: SPARCstation 1+ without a monitor/framebuffer. + + SPARCstation 2 (4/75) + Processor(s): CY7C601 @ 40MHz, TI TMS390C601A (602A ?), Sun-4c + MMU, 16 hardware contexts + Speed ratings: 28.5 MIPS, 4.2 MFLOPS, 21.8 SPECint92, 22.8 + SPECfp92, 517 SPECintRate92, 541 SPECfpRate92 + CPU: 501-1638/1744/1858/1859/1912/1926/1989/1995 + Chassis type: square pizza box + Bus: SBus @ 20MHz (3 slots) + Memory: 64M physical on motherboard/128M total + Cache: 64K write-through, direct-mapped, virtually + indexed, virtually tagged, 32-byte lines + Architecture: sun4c + Notes: Code name "Calvin". SIMMs memory. 3.5" floppy. + Case slightly larger and has more ventilation. + (Some models apparently have LSI L64811 @ + 40MHz?) Expansion beyond 64M is possible with a + 32M card which can take a 32M daughterboard + (card blocks SBus slot). First supported in + SunOS 4.1.1. + + SPARCserver 2 + Notes: SPARCstation 2 without a monitor/framebuffer. + + SPARCstation ELC (4/25) + Processor(s): Fujitsu MB86903 or Weitek W8701 @ 33MHz, FPU on + CPU chip, Sun-4c MMU, 8 hardware contexts + Speed ratings: 21 MIPS, 3 MFLOPS, 18.2 SPECint92, 17.9 + SPECfp92, 432 SPECintRate92, 425 SPECfpRate92 + CPU: 501-1861 (1730?) + Chassis type: monitor + Bus: none + Memory: 64M physical + Cache: 64K write-through, direct-mapped, virtually + indexed, virtually tagged, 32-byte lines + Architecture: sun4c + Notes: Code name "Node Warrior". SIMM memory. No fan. + Built into 17" mono monitor. first supported in + SunOS 4.1.1c. + + SPARCstation IPX (4/50) + Processor(s): Fujitsu MB86903 or Weitek W8701 @ 40MHz, FPU on + CPU chip, Sun-4c MMU, 8 hardware contexts + Speed ratings: 28.5 MIPS, 4.2 MFLOPS, 21.8 SPECint92, + 21.5 SPECfp92, 517 SPECintRate92, 510 + SPECfpRate92 + CPU: 501-1780/1810/1959/2044 + Chassis type: lunchbox + Bus: SBus @ 20MHz (2 slots) + Memory: 64M physical + Cache: 64K write-through cache, direct-mapped, + virtually indexed, virtually tagged, 32-byte + lines + Architecture: sun4c + Notes: Code name "Hobbes". SIMM memory. Onboard + GX-accelerated cg6 color framebuffer (not usable + with ECL mono monitors, unlike SBus version). + Picture of Hobbes (from Watterson's "Calvin and + Hobbes" comic strip) silkscreened on + motherboard. 3.5" floppy. First supported in + SunOS 4.1.1 (may require IPX supplement). + + SPARCengine 1 (4/E) + CPU: 501-8035/8058/8064 + Bus: VME (6U form factor), SBus (1 slot) + Notes: Single-board VME SPARCstation 1 (or 1+?), + presumably for use as a controller, not as a + workstation. 8K MMU pages rather than 4K. + External RAM, framebuffer, and SCSI/ethernet + boards available. Code name "Polaris". + + SPARCserver 630MP (4/630) + Processor(s): MBus modules + CPU: 501-1686/2055 + Chassis type: deskside + Bus: VME (3 9U slots, 2 each 6U and 3U), SBus @ 20MHz + (4 slots), MBus (2 slots) + Memory: 640M physical + Architecture: sun4m + Notes: First MBus-based machine. Code name "Galaxy". + SIMM memory. + + SPARCserver 670MP (4/670) + Chassis type: deskside + Bus: VME (12 slots), SBus @ 20MHz (4 slots), MBus (2 + slots) + Notes: Like SPARCserver 630MP. More SBus slots can be + added via VME expansion boards. + + SPARCserver 690MP (4/690) + Chassis type: rackmount + Bus: VME (16 slots), SBus @ 20MHz (4 slots), MBus (2 + slots) + Notes: See SPARCserver 670MP. + + SPARCclassic (SPARCclassic Server)(SPARCstation LC) (4/15) + Processor(s): microSPARC @ 50MHz + Speed ratings: 59.1 MIPS, 4.6 MFLOPS, 26.4 SPECint92, 21.0 + SPECfp92, 626 SPECintRate92, 498 SPECfpRate92 + CPU: 501-2200/2262/2326 + Chassis type: lunchbox + Bus: SBus @ 20MHz (2 slots) + Memory: 96M physical + Architecture: sun4m + Notes: Sun4m architecture, but no MBus (uniprocessor + only). SIMM memory. Shares code name "Sunergy" + with LX. 3.5" floppy. Soldered CPU chip. Onboard + cgthree framebuffer, AMD79C30 8-bit audio chip. + First supported in SunOS 4.1.3c. + + SPARCclassic X (4/10) + CPU: 501-2079/2262/2313 + Notes: Essentially the same as SPARCclassic, but + intended for use as an X terminal (?). + + SPARCstation LX/ZX (4/30) + Processor(s): microSPARC @ 50MHz + Speed ratings: 59.1 MIPS, 4.6 MFLOPS, 26.4 SPECint92, 21.0 + SPECfp92, 626 SPECintRate92, 498 SPECfpRate92 + CPU: 501-2031/2032/2233/2474 + Chassis type: lunchbox + Bus: SBus @ 20MHz (2 slots) + Memory: 96M physical + Architecture: sun4m + Notes: Sun4m architecture, but no MBus (uniprocessor + only). SIMM memory. Shares code name "Sunergy" + with SPARCclassic. Soldered CPU chip. Onboard + cgsix framebuffer, 1M VRAM standard, expandable + to 2M. DBRI 16-bit audio/ISDN chip. First + supported in SunOS 4.1.3c. + + SPARCstation Voyager + Processors(s): microSPARC II @ 60MHz + Speed ratings: 47.5 SPECint92, 40.3 SPECfp92, 1025 + SPECintRate92, 859 SPECfpRate92 + Bus: SBus; PCMCIA type II (2 slots) + Memory: 80M physical + Architecture: sun4m + Notes: Portable (laptop?). 16M standard, two memory + expansion slots for Voyager-specific SIMMs (16M + or 32M). Code-named "Gypsy". 14" 1152x900 mono + or 12" 1024x768 color flat panel displays. DBRI + 16-bit audio/ISDN chip. + + SPARCstation 3 + Notes: Although this model appeared in a few Sun price + lists, it was renamed the SPARCstation 10 before + release. + + SPARCstation 10/xx + Processor(s): MBus modules + Motherboard: 501-1733/2259/2274/2365 (-2274 in model 20 only) + Chassis type: square pizza box + Bus: SBus @ 16.6/20MHz (model 20) or 18/20MHz (other + models) (4 slots); MBus (2 slots) + Memory: 512M physical + Architecture: sun4m + Notes: Code name "Campus-2". 3.5" floppy. SIMM memory. + Some models use double-width MBus modules which + block SBus slots. Also, the inner surface of the + chassis is conductive, so internal disk drives + must be mounted with insulating hardware. + + SPARCserver 10/xx + Notes: SPARCstation 10/xx without monitor/framebuffer. + + SPARCcenter 2000 + Processor(s): MBus modules + Motherboard: 501-1866/2334/2362 + Bus: XDBus * 2 (20 slots); SBus @ 20MHz (4 + slots/motherboard); MBus (2 slots/motherboard) + Memory: 5G physical + Cache: 2M/motherboard + Architecture: sun4d + Notes: Dual XDBus backplane with 20 slots. One board + type that carries dual MBus modules with 2M + cache (1M for each XDBus), 512M memory and 4 + SBus slots. Any combination can be used; memory + is *not* tied to the CPU modules but to an + XDBus. Solaris 2.x releases support an + increasing number of CPUs (up to twenty), due to + tuning efforts in the kernel. First supported in + Solaris 2.2 (SunOS 5.2). Code name "Dragon". + + SPARCserver 1000 + Processor(s): MBus modules + Motherboard: 501-2336 (2338?) + Bus: XDBus; SBus @ 20MHz (3 slots/motherboard); MBus + (2 slots/motherboard) + Memory: 2G physical + Cache: 1M/motherboard + Architecture: sun4d + Notes: Single XDBus design with "curious L-shaped + motherboards". Three SBus slots per motherboard, + 512M, two MBus modules per motherboard. Four + motherboards total, or a disk tray with four 1" + high 3.5" disks. Code name "Scorpion". First + supported in Solaris 2.2 (SunOS 5.2). + + + + 21/11/2011 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" + + +class sun4_state : public driver_device +{ +public: + sun4_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(sun4_mem, AS_PROGRAM, 32, sun4_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sun4 ) +INPUT_PORTS_END + + +void sun4_state::machine_reset() +{ +} + + +static MACHINE_CONFIG_START( sun4, sun4_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68020, 16670000) // SPARC32 on real system + MCFG_CPU_PROGRAM_MAP(sun4_mem) +MACHINE_CONFIG_END + +/* +Boot PROM + +Sun-4c Architecture + +SPARCstation SLC (Sun-4/20) - 128K x 8 +U1001 Revision +======================================== +520-2748-01 1.2 Version 3 +520-2748-02 1.3 +520-2748-03 1.3 +520-2748-04 1.4 Version 2 +595-2250-xx Sun-4/20 Boot PROM Kit + +SPARCstation ELC (Sun-4/25) - 256K x 8 +U0806 Revision +======================================== +520-3085-01 +520-3085-02 2.3 Version 95 +520-3085-03 2.4 Version 96 +520-3085-04 2.6 Version 102 (not used) +520-3085-04 2.9 Version 7 + + +SPARCstation IPC (Sun-4/40) - 256K x 8 +U0902 Revision +======================================== +525-1085-01 +525-1085-02 +525-1085-03 1.6 Version 151 +525-1191-01 1.7 Version 3 and 2.4 Version 362 +525-1191-02 1.7 Version 3 and 2.6 Version 411 +525-1191-03 1.7 Version 3 and 2.9 Version 24 + + +SPARCstation IPX (Sun-4/50) - 256K x 8 +U0501 Revision +======================================== +525-1177-01 2.1 Version 66 +525-1177-02 2.2 Version 134 +525-1177-03 2.3 Version 263 +525-1177-04 2.4 Version 347 +525-1177-05 2.6 Version 410 +525-1177-06 2.9 Version 20 + + +SPARCstation 1 (Sun-4/60) - 128K x 8 +U0837 Revision +======================================== +525-1043-01 +525-1043-02 0.1 +525-1043-03 +525-1043-04 1.0 +525-1043-05 1.0 +525-1043-06 1.0 +525-1043-07 1.1 +525-1043-08 1.3 Version 3 +595-1963-xx Sun-4/60 Boot PROM Kit +525-1207-01 2.4 Version 95 +525-1207-02 2.9 Version 9 (2.x is only available from the spare parts price list) +560-1805-xx Sun-4/60 2.4 Boot PROM Kit + + +SPARCstation 1+ (Sun-4/65) - 128K x 8 +U0837 Revision +======================================== +525-1108-01 +525-1108-02 +525-1108-03 1.1 Version 13 +525-1108-04 1.2 +525-1108-05 1.3 Version 4 +525-1208-01 2.4 Version 116 +525-1208-02 2.9 Version 9 (2.x is only available from the spare parts price list) +560-1806-xx Sun-4/65 2.4 Boot PROM Kit + + +SPARCstation 2 (Sun-4/75) - 256K x 8 +U0501 Revision +======================================== +525-1107-01 2.0Beta0 +525-1107-02 2.0Beta1 +525-1107-03 2.0 +525-1107-04 2.0 Version 865 (fails with Weitek Power ?p) +525-1107-05 2.1 Version 931 (fails with Weitek Power ?p) +525-1107-06 2.2 Version 947 +525-1107-07 2.4 Version 990 +525-1107-08 2.4.1 Version 991 +525-1107-09 2.6 Version 1118 +525-1107-10 2.9 Version 16 +595-2249-xx Sun-4/75 Boot PROM Kit + +*/ + +// Sun 4/300, Cypress Semiconductor CY7C601, Texas Instruments 8847 FPU +ROM_START( sun4_300 ) + ROM_REGION32_BE( 0x40000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "1035-09.rom", 0x0000, 0x10000, CRC(4ae2f2ad) SHA1(9c17a80b3ce3efdf18b5eca969f1565ddaad3116)) + ROM_LOAD( "1036-09.rom", 0x0000, 0x10000, CRC(cb3d45a7) SHA1(9d5da09ff87ec52dc99ffabd1003d30811eafdb0)) + ROM_LOAD( "1037-09.rom", 0x0000, 0x10000, CRC(4f005bea) SHA1(db3f6133ea7c497ba440bc797123dde41abea6fd)) + ROM_LOAD( "1038-09.rom", 0x0000, 0x10000, CRC(1e429d31) SHA1(498ce4d34a74ea6e3e369bb7eb9c2b87e12bd080)) + + ROM_REGION( 0x10000, "devices", ROMREGION_ERASEFF ) + // CG3 Color frame buffer (cgthree) + ROM_LOAD( "sunw,501-1415.bin", 0x0000, 0x0800, CRC(d1eb6f4d) SHA1(9bef98b2784b6e70167337bb27cd07952b348b5a)) + + // BW2 frame buffer (bwtwo) + ROM_LOAD( "sunw,501-1561.bin", 0x0800, 0x0800, CRC(e37a3314) SHA1(78761bd2369cb0c58ef1344c697a47d3a659d4bc)) + + // TurboGX 8-Bit Color Frame Buffer + ROM_LOAD( "sunw,501-2325.bin", 0x1000, 0x8000, CRC(bbdc45f8) SHA1(e4a51d78e199cd57f2fcb9d45b25dfae2bd537e4)) +ROM_END + +// SPARCstation IPC (Sun 4/40) +ROM_START( sun4_40 ) + ROM_REGION32_BE( 0x40000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "4.40_v2.9.rom", 0x0000, 0x40000, CRC(532fc20d) SHA1(d86d9e958017b3fecdf510d728a3e46a0ce3281d)) +ROM_END + +// SPARCstation IPX (Sun 4/50) +ROM_START( sun4_50 ) + ROM_REGION32_BE( 0x40000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "ipx-29.rom", 0x0000, 0x40000, CRC(1910aa65) SHA1(7d8832fea8e299b89e6ec7137fcde497673c14f8)) +ROM_END + +// SPARCstation SLC (Sun 4/20) +ROM_START( sun4_20 ) + ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "520-2748-04.rom", 0x0000, 0x20000, CRC(e85b3fd8) SHA1(4cbc088f589375e2d5983f481f7d4261a408702e)) +ROM_END + +// SPARCstation 1 (Sun 4/60) +ROM_START( sun4_60 ) + ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "ss1v29.rom", 0x0000, 0x20000, CRC(e3f103a9) SHA1(5e95835f1090ea94859bd005757f0e7b5e86181b)) +ROM_END + +// SPARCstation 2 (Sun 4/75) +ROM_START( sun4_75 ) + ROM_REGION32_BE( 0x40000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD( "ss2-29.rom", 0x0000, 0x40000, CRC(d04132b3) SHA1(ef26afafa2800b8e2e5e994b3a76ca17ce1314b1)) +ROM_END + +// SPARCstation 10 (Sun S10) +ROM_START( sun_s10 ) + ROM_REGION32_BE( 0x80000, "user1", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "r225", "Rev 2.2.5") + ROMX_LOAD( "ss10_v2.25.rom", 0x0000, 0x80000, CRC(c7a48fd3) SHA1(db13d85b02f181eb7fce4c38b11996ff64116619), ROM_BIOS(1)) + // SPARCstation 10 and 20 + ROM_SYSTEM_BIOS(1, "r225r", "Rev 2.2.5r") + ROMX_LOAD( "ss10-20_v2.25r.rom", 0x0000, 0x80000, CRC(105ba132) SHA1(58530e88369d1d26ab11475c7884205f2299d255), ROM_BIOS(2)) +ROM_END + +// SPARCstation 20 +ROM_START( sun_s20 ) + ROM_REGION32_BE( 0x80000, "user1", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "r225", "Rev 2.2.5") + ROMX_LOAD( "ss20_v2.25.rom", 0x0000, 0x80000, CRC(b4f5c547) SHA1(ee78312069522094950884d5bcb21f691eb6f31e), ROM_BIOS(1)) + // SPARCstation 10 and 20 + ROM_SYSTEM_BIOS(1, "r225r", "Rev 2.2.5r") + ROMX_LOAD( "ss10-20_v2.25r.rom", 0x0000, 0x80000, CRC(105ba132) SHA1(58530e88369d1d26ab11475c7884205f2299d255), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, sun4_300, 0, 0, sun4, sun4, driver_device, 0, "Sun Microsystems", "Sun 4/3x0", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, sun4_40, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation IPC (Sun 4/40)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, sun4_50, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation IPX (Sun 4/50)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, sun4_20, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation SLC (Sun 4/20)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, sun4_60, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation 1 (Sun 4/60)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, sun4_75, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation 2 (Sun 4/75)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, sun_s10, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation 10 (Sun S10)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, sun_s20, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation 20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/super6.c b/src/mame/drivers/super6.c new file mode 100644 index 00000000000..687598f89f8 --- /dev/null +++ b/src/mame/drivers/super6.c @@ -0,0 +1,573 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + TODO: + + - floppy (cannot be implemented currently since this is another case of halting the cpu mid-instruction) + - interrupts + - DMA + - peripheral interfaces + +*/ + +#include "bus/rs232/rs232.h" +#include "includes/super6.h" + + +//************************************************************************** +// MEMORY BANKING +//************************************************************************** + +//------------------------------------------------- +// bankswitch - +//------------------------------------------------- + +void super6_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + // power on jump + if (!BIT(m_bank0, 6)) { program.install_rom(0x0000, 0x07ff, 0, 0xf800, m_rom); return; } + + // first 64KB of memory + program.install_ram(0x0000, 0xffff, ram); + + // second 64KB of memory + int map = (m_bank1 >> 4) & 0x07; + + switch (map) + { + case 0: + if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000); + if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); + if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000); + if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000); + break; + + case 1: + if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000); + if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); + if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000); + if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x0000); + break; + + case 2: + if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000); + if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); + if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x4000); + if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000); + break; + + case 3: + if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000); + if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); + if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x0000); + if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x4000); + break; + + case 4: + if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0xc000); + if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); + if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000); + if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000); + break; + } + + // bank 0 overrides + if (BIT(m_bank0, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x0000); + if (BIT(m_bank0, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x4000); + if (BIT(m_bank0, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x8000); + if (BIT(m_bank0, 3)) program.install_ram(0xc000, 0xffff, ram + 0xc000); + + // PROM enabled + if (!BIT(m_bank0, 5)) program.install_rom(0xf000, 0xf7ff, 0, 0x800, m_rom); +} + + +//------------------------------------------------- +// s100_w - S-100 bus extended address A16-A23 +//------------------------------------------------- + +WRITE8_MEMBER( super6_state::s100_w ) +{ + /* + + bit description + + 0 A16 + 1 A17 + 2 A18 + 3 A19 + 4 A20 + 5 A21 + 6 A22 + 7 A23 + + */ + + m_s100 = data; +} + + +//------------------------------------------------- +// bank0_w - on-board memory control port #0 +//------------------------------------------------- + +WRITE8_MEMBER( super6_state::bank0_w ) +{ + /* + + bit description + + 0 memory bank 0 (0000-3fff) + 1 memory bank 1 (4000-7fff) + 2 memory bank 2 (8000-bfff) + 3 memory bank 3 (c000-ffff) + 4 + 5 PROM enabled (0=enabled, 1=disabled) + 6 power on jump reset + 7 parity check enable + + */ + + m_bank0 = data; + + bankswitch(); +} + + +//------------------------------------------------- +// bank1_w - on-board memory control port #1 +//------------------------------------------------- + +WRITE8_MEMBER( super6_state::bank1_w ) +{ + /* + + bit description + + 0 memory bank 4 + 1 memory bank 5 + 2 memory bank 6 + 3 memory bank 7 + 4 map select 0 + 5 map select 1 + 6 map select 2 + 7 + + */ + + m_bank1 = data; + + bankswitch(); +} + + + +//************************************************************************** +// PERIPHERALS +//************************************************************************** + +//------------------------------------------------- +// floppy_r - FDC synchronization/drive/density +//------------------------------------------------- + +READ8_MEMBER( super6_state::fdc_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 FDC INTRQ + + */ + + fatalerror("Z80 WAIT not supported by MAME core\n"); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + + return !m_fdc->intrq_r() << 7; +} + + +//------------------------------------------------- +// floppy_w - FDC synchronization/drive/density +//------------------------------------------------- + +WRITE8_MEMBER( super6_state::fdc_w ) +{ + /* + + bit description + + 0 disk drive select 0 + 1 disk drive select 1 + 2 head select (0=head 1, 1=head 2) + 3 disk density (0=single, 1=double) + 4 size select (0=8", 1=5.25") + 5 + 6 + 7 + + */ + + // disk drive select + floppy_image_device *m_floppy = NULL; + + if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); + if (BIT(data, 1)) m_floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(m_floppy); + if (m_floppy) m_floppy->mon_w(0); + + // head select + if (m_floppy) m_floppy->ss_w(BIT(data, 2)); + + // disk density + m_fdc->dden_w(!BIT(data, 3)); +} + + +//------------------------------------------------- +// baud_w - baud rate +//------------------------------------------------- + +WRITE8_MEMBER( super6_state::baud_w ) +{ + /* + + bit description + + 0 SIO channel A baud bit A + 1 SIO channel A baud bit B + 2 SIO channel A baud bit C + 3 SIO channel A baud bit D + 4 SIO channel B baud bit A + 5 SIO channel B baud bit B + 6 SIO channel B baud bit C + 7 SIO channel B baud bit D + + */ + + m_brg->str_w(data & 0x0f); + m_brg->stt_w(data >> 4); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( super6_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( super6_mem, AS_PROGRAM, 8, super6_state ) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( super6_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( super6_io, AS_IO, 8, super6_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(WD2793_TAG, wd2793_t, read, write) + AM_RANGE(0x10, 0x10) AM_MIRROR(0x03) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) + AM_RANGE(0x14, 0x14) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0x15, 0x15) AM_READ_PORT("J7") AM_WRITE(s100_w) + AM_RANGE(0x16, 0x16) AM_WRITE(bank0_w) + AM_RANGE(0x17, 0x17) AM_WRITE(bank1_w) + AM_RANGE(0x18, 0x18) AM_MIRROR(0x03) AM_WRITE(baud_w) +// AM_RANGE(0x40, 0x40) ? +// AM_RANGE(0xe0, 0xe7) HDC? +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( super6 ) +//------------------------------------------------- + +static INPUT_PORTS_START( super6 ) + PORT_START("J7") + PORT_DIPNAME( 0x0f, 0x0f, "SIO Channel A Baud Rate" ) PORT_DIPLOCATION("J7:1,2,3,4") + PORT_DIPSETTING( 0x00, "50" ) + PORT_DIPSETTING( 0x01, "75" ) + PORT_DIPSETTING( 0x02, "110" ) + PORT_DIPSETTING( 0x03, "134.5" ) + PORT_DIPSETTING( 0x04, "150" ) + PORT_DIPSETTING( 0x05, "300" ) + PORT_DIPSETTING( 0x06, "600" ) + PORT_DIPSETTING( 0x07, "1200" ) + PORT_DIPSETTING( 0x08, "1800" ) + PORT_DIPSETTING( 0x09, "2000" ) + PORT_DIPSETTING( 0x0a, "2400" ) + PORT_DIPSETTING( 0x0b, "3600" ) + PORT_DIPSETTING( 0x0c, "4800" ) + PORT_DIPSETTING( 0x0d, "7200" ) + PORT_DIPSETTING( 0x0e, "9600" ) + PORT_DIPSETTING( 0x0f, "19200" ) + PORT_DIPNAME( 0x70, 0x70, "SIO Channel B Baud Rate" ) PORT_DIPLOCATION("J7:5,6,7") + PORT_DIPSETTING( 0x00, "50" ) + PORT_DIPSETTING( 0x10, "75" ) + PORT_DIPSETTING( 0x20, "110" ) + PORT_DIPSETTING( 0x30, "134.5" ) + PORT_DIPSETTING( 0x40, "150" ) + PORT_DIPSETTING( 0x50, "300" ) + PORT_DIPSETTING( 0x60, "600" ) + PORT_DIPSETTING( 0x70, "1200" ) + PORT_DIPNAME( 0x80, 0x00, "Disk Drive Type" ) PORT_DIPLOCATION("J7:8") + PORT_DIPSETTING( 0x80, "Single Sided" ) + PORT_DIPSETTING( 0x00, "Double Sided" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// Z80CTC +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER( super6_state::ctc_tick ) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); +} + +//------------------------------------------------- +// Z80DMA +//------------------------------------------------- + +READ8_MEMBER(super6_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(super6_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset, data); +} + +READ8_MEMBER(super6_state::io_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(super6_state::io_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + prog_space.write_byte(offset, data); +} + +//------------------------------------------------- +// COM8116_INTERFACE( brg_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( super6_state::fr_w ) +{ + m_dart->rxca_w(state); + m_dart->txca_w(state); + + m_ctc->trg1(state); +} + + +//------------------------------------------------- +// floppy_format_type floppy_formats +//------------------------------------------------- + +static SLOT_INTERFACE_START( super6_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER( super6_state::fdc_intrq_w ) +{ + if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); + + m_ctc->trg3(!state); +} + +WRITE_LINE_MEMBER( super6_state::fdc_drq_w ) +{ + if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); + + m_dma->rdy_w(state); +} + + +//------------------------------------------------- +// z80_daisy_config super6_daisy_chain +//------------------------------------------------- + +static const z80_daisy_config super6_daisy_chain[] = +{ + { Z80CTC_TAG }, + { Z80DART_TAG }, + { Z80PIO_TAG }, + { NULL } +}; + + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_19200 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_19200 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( super6 ) +//------------------------------------------------- + +void super6_state::machine_start() +{ + // state saving + save_item(NAME(m_s100)); + save_item(NAME(m_bank0)); + save_item(NAME(m_bank1)); +} + + +void super6_state::machine_reset() +{ + m_bank0 = m_bank1 = 0; + + bankswitch(); + + UINT8 baud = m_j7->read(); + + m_brg->str_w(baud & 0x0f); + m_brg->stt_w((baud >> 4) & 0x07); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( super6 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( super6, super6_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_24MHz/4) + MCFG_CPU_PROGRAM_MAP(super6_mem) + MCFG_CPU_IO_MAP(super6_io) + MCFG_CPU_CONFIG(super6_daisy_chain) + + // devices + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_24MHz/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", super6_state, ctc_tick, attotime::from_hz(XTAL_24MHz/16)) + + MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_24MHz/6) + MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) + MCFG_Z80DMA_OUT_INT_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg2)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(super6_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(super6_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(super6_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(super6_state, io_write_byte)) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_24MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_WD2793_ADD(WD2793_TAG, 1000000) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(super6_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(super6_state, fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":0", super6_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":1", super6_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_24MHz/4, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + + MCFG_DEVICE_ADD(BR1945_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(super6_state, fr_w)) + MCFG_COM8116_FT_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "super6") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( super6 ) +//------------------------------------------------- + +ROM_START( super6 ) + ROM_REGION( 0x800, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "v36" ) + ROM_SYSTEM_BIOS( 0, "v36", "ADC S6 v3.6" ) + ROMX_LOAD( "adcs6_v3.6.u29", 0x000, 0x800, CRC(386fd22a) SHA1(9c177990aa180ab93be9c4641e92ae934627e661), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v12", "Digitex Monitor v1.2a" ) + ROMX_LOAD( "digitex monitor 1.2a 6oct1983.u29", 0x000, 0x800, CRC(a4c33ce4) SHA1(46dde43ea51d295f2b3202c2d0e1883bde1a8da7), ROM_BIOS(2) ) + + ROM_REGION( 0x800, "plds", 0 ) + ROM_LOAD( "pal16l8.u16", 0x000, 0x800, NO_DUMP ) + ROM_LOAD( "pal16l8.u36", 0x000, 0x800, NO_DUMP ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, super6, 0, 0, super6, super6, driver_device, 0, "Advanced Digital Corporation", "Super Six", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/super80.c b/src/mame/drivers/super80.c new file mode 100644 index 00000000000..2c6b069e4bf --- /dev/null +++ b/src/mame/drivers/super80.c @@ -0,0 +1,970 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/***************************************************************************** + +Super80.c written by Robbbert, 2005-2010. + +2010-12-19: Added V3.7 bios freshly dumped today. +2014-04-28: Added disk system and did cleanups + +See the MESS sysinfo and wiki for usage +documentation. Below for the most technical bits: + += Architecture (super80): + + * Z80 @ 2MHz + * 16k, 32k or 48k RAM (0000-BFFF) + * 12k ROM (C000-EFFF) + * 3.5k RAM (F000-FDFF), comes with the "64k ram" modification + * 0.5k RAM (FE00-FFFF) for Chipspeed colour board + += Architecture (super80v): + + * Z80 @ 2MHz + * 16k, 32k or 48k RAM (0000-BFFF) + * 12k ROM (C000-EFFF) + * 2k Video RAM (F000-F7FF) banked with Colour RAM (modified Chipspeed board) + * 2k PCG RAM (F800-FFFF) banked with Character Generator ROM + += Super80 ports: + + port $F0: General Purpose output port + Bit 0 - cassette output + Bit 1 - cassette relay control; 0=relay on + Bit 2 - turns screen on and off;0=screen off + Bit 3 - Available for user projects [We will use it for sound] + Bit 4 - Available for user projects + Bit 5 - cassette LED; 0=LED on + Bit 6/7 - not decoded + + port $F1: Video page output port + Bit 0 - not decoded [we will use it for video switching] + Bits 1 to 7 - choose video page to display + Bit 1 controls A9, bit 2 does A10, etc + + port $F2: General purpose input port + Bit 0 - cassette input + Bit 1 - Available for user projects + Bit 2 - Available for user projects + Bit 3 - not decoded + Bit 4 - Switch A [These switches are actual DIP switches on the motherboard] + Bit 5 - Switch B + Bit 6 - Switch C + Bit 7 - Switch D + += Super80v ports: + + port $10: MC6845 control port + + port $11: MC6845 data port + + port $F0: General Purpose output port + Bit 0 - cassette output + Bit 1 - Cassette relay control; 0=relay on + Bit 2 - Colour banking (0 = Colour Ram, 1 = Video Ram) + Bit 3 - Sound + Bit 4 - PCG banking (0 = PROM, 1 = PCG) + Bit 5 - cassette LED; 0=LED on + Bit 6/7 - not decoded + + port $F2: General purpose input port - same as for Super80. + += Cassette information: + +The standard cassette system uses sequences of 1200 Hz and 2400 Hz to represent a 0 or a 1 respectivly. +This is identical to the Exidy Sorcerer and the Microbee. Data rates available are 300, 400, 600, and 1200 baud. +The user has to adjust some bytes in memory in order to select a different baud rate. + + BDF8 BDF9 Baud + --------------------- + F8 04 300 + BA 03 400 + 7C 02 600 + 3E 01 1200 + +The enhanced Monitor roms (those not supplied by Dick Smith) have extra commands to change the rates +without the tedium of manually modifying memory. + +When saving, the OS toggles the cassette bit (bit 0 of port F0) at the required frequencies directly. + +When loading, the signal passes through a filter, then into a 4046 PLL (Phase-Locked-Loop) chip. +This acts as a frequency-to-voltage converter. The output of this device is passed to the "+" input +of a LM311 op-amp. The "-" input is connected to a 10-turn trimpot, which is adjusted by the owner +at construction time. It sets the switching midpoint voltage. Voltages above a certain level become +a "1" level at the output, while voltages below become a "0" level. This output in turn connects +to the cassette input bit of port F2. + +The monitor loading routine (at C066 in most monitor roms), waits for a high-to-low transition +(the low is the beginning of the start bit), then waits for half a bit, checks it is still low, +waits for a full bit, then reads the state (this is the first bit), then cycles between waiting +a bit and reading the next, until a full byte has been constructed. Lastly, the stop bit is +checked that it is at a high level. + +This means that we cannot attempt to convert frequency to voltage ourselves, since the OS only +"looks" once a bit. The solution is to use a mame timer running at a high enough rate (40 kHz) +to read the wave state. While the wave state stays constant, a counter is incremented. When the +state changes, the output is set according to how far the counter has progressed. The counter is +then reset ready for the next wave state. The code for this is in the TIMER_CALLBACK. + +A kit was produced by ETI magazine, which plugged into the line from your cassette player earphone +socket. The computer line was plugged into this box instead of the cassette player. The box was +fitted with a speaker and a volume control. You could listen to the tones, to assist with head +alignment, and with debugging. In MESS, a config switch has been provided so that you can turn +this sound on or off as needed. + += About the 1 MHz / 2 MHz switching: + +The original hardware runs with a 2 MHz clock, but operates in an unusual way. There is no video +processor chip, just a huge bunch of TTL chips. The system spends half the time running the CPU, +and half the time displaying the picture. The timing will activate the BUSREQ line, and the CPU will +finish its current instruction, activate the BUSACK line, and go to sleep. The video circuits will +read the video RAM and show the picture. At the end, the BUSREQ line is released, and processing can +continue. + +The processing time occurs during the black parts of the screen, therefore half the screen will be +black unless you expand the image with the monitor's controls. This method ensures that there will +be no memory contention, and thus, no snow. The processor will run at 2 MHz pulsed at 48.8 Hz, which +is an effective speed of 1 MHz. + +When saving or loading a cassette file, this pulsing would cause the save tone to be modulated with +a loud hum. When loading, the synchronisation to the start bit could be missed, causing errors. +Therefore the screen can be turned off via an output bit. This disables the BUSREQ control, which +in turn prevents screen refresh, and gives the processor a full uninterrupted 2 MHz speed. + +MAME does not emulate BUSREQ or BUSACK. Further, a real system would display a blank screen by not +updating the video. In MAME, the display continues to show. It just doesn't update. + +To obtain accurate timing, the video update routine will toggle the HALT line on alternate frames. +Although physically incorrect, it is the only way to accurately emulate the speed change function. +The video update routine emulates the blank screen by filling it with spaces. + +For the benefit of those who like to experiment, config switches have been provided in MESS to +allow you to leave the screen on at all times, and to always run at 2 MHz if desired. These options +cannot exist in real hardware. + += Quickload: + +This was not a standard feature. It is a hardware facility I added to my machine when age threatened +to kill off my cassette player and tapes. The tapes were loaded up one last time, and transferred to +a hard drive on a surplus 386 PC, in binary format (NOT a wave file). Special roms were made to allow +loading and saving to the S-100 board and its ports. These ports were plugged into the 386 via cables. +A QBASIC program on the 386 monitored the ports and would save and load files when requested by the +Super-80. This worked (and still works) very well, and is a huge improvement over the cassette, both +speedwise and accuracy-wise. + +The modified rom had the autorun option built in. Autorun was never available for cassettes. + +In MESS, the same file format is used - I can transfer files between MESS and the 386 seamlessly. +MESS has one difference - the program simply appears in memory without the processor being aware +of it. To accomplish autorun therefore requires that the processor pc register be set to the start +address of the program. BASIC programs may need some preprocessing before they can be started. This +is not necessary on a Super-80 or a Microbee, but is needed on any system running Microsoft BASIC, +such as the Exidy Sorcerer or the VZ-200. + +In MESS, quickload is available for all Super80 variants (otherwise you would not have any games +to play). MESS features a config switch so the user can turn autorun on or off as desired. + + += Start of Day circuit: + +When the computer is turned on or reset, the Z80 will want to start executing at 0000. Since this is +RAM, this is not a good idea. The SOD circuit forcibly disables the RAM and enables the ROMs, so they +will appear to be at 0000. Thus, the computer will boot. + +The Master Reset signal (power-on or Reset button pushed), triggers a flipflop that disables RAM and +causes C000 to FFFF to appear at 0000 to 3FFF. This will be reset (back to normal) when A14 and A15 +are high, and /M1 is active. This particular combination occurs on all ROM variants, when reading the +fifth byte in the ROM. In reality, the switchover can take place any time between the 4th byte until +the computer has booted up. This is because the low RAM does not contain any system areas. + +Since MAME does not emulate /M1, a banking scheme has had to be used. Bank 0 is normal RAM. Bank 1 +points to the ROMs. When a machine reset occurs, bank 1 is switched in. A timer is triggered, and +after 4 bytes are read, bank 0 is selected. The timer is as close as can be to real operation of the +hardware. + + +Super80 disk WD2793, Z80DMA: + +Port(hex) Role Comment +--------- ----- -------- +30 DMA I/O Z80A DMA Controller Command Register +38 WDSTCM WD2793 Command Status +39 WDTRK WD2793 Track Register +3A WDSEC WD2793 Sector Register +3B WDDATA WD2793 Data Register + +3E UFDSTAT FDD and WD2793 Status input + Bit0 INTRQ 1 = WD2793 Interrupt Request + Bit1 DATARQ 1 = Data Ready to Receive or Send + Bit2 MOTOR ON 1 = FDD Motor On + +3F UFDCOM WD2793 Command Register output + Bit0 5/8 1 = 8" Drive Selected + Bit1 ENMF* 0 = 1MHz, 1 = 2MHz (for 8" double density) + Bit2 DR0SEL 1 = Drive 0 (Drive A) selected + Bit3 DR1SEL 1 = Drive 1 (Drive B) selected + Bit4 DR2SEL 1 = Drive 2 (Drive C) selected + Bit5 DR3SEL 1 = Drive 3 (Drive D) selected + Bit6 SIDESEL 0 = Select Disk side 0, 1 = Select Disk side 1 + Bit7 DDEN* 0 = MFM (Double Density), 1 = FM (Single Density) + +ToDo: +- Fix Paste: Shift operates randomly (only super80m is suitable, the others drop characters because + of the horrible inline editor they use) +- Get disk system to work (no disk images available) only connected to super80r atm + + +***********************************************************************************************************/ + +#include "super80.lh" +#include "includes/super80.h" + +#define MASTER_CLOCK (XTAL_12MHz) +#define PIXEL_CLOCK (MASTER_CLOCK/2) +#define HTOTAL (384) +#define HBEND (0) +#define HBSTART (256) +#define VTOTAL (240) +#define VBEND (0) +#define VBSTART (160) + +#define SUPER80V_SCREEN_WIDTH (560) +#define SUPER80V_SCREEN_HEIGHT (300) +#define SUPER80V_DOTS (7) + + +/**************************** MEMORY AND I/O MAPPINGS *****************************************************************/ + +/* A read_byte or write_byte to unmapped memory crashes MESS, and UNMAP doesnt fix it. + This makes the H and E monitor commands show FF */ +READ8_MEMBER( super80_state::super80_read_ff ) { return 0xff; } + +static ADDRESS_MAP_START( super80_map, AS_PROGRAM, 8, super80_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("boot") AM_REGION("maincpu", 0x0000) + AM_RANGE(0x4000, 0xbfff) AM_RAM AM_REGION("maincpu", 0x4000) + AM_RANGE(0xc000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xffff) AM_READ(super80_read_ff) AM_WRITENOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START( super80m_map, AS_PROGRAM, 8, super80_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("boot") AM_REGION("maincpu", 0x0000) + AM_RANGE(0x4000, 0xbfff) AM_RAM AM_REGION("maincpu", 0x4000) + AM_RANGE(0xc000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xffff) AM_RAM AM_REGION("maincpu", 0xf000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( super80v_map, AS_PROGRAM, 8, super80_state) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("boot") + AM_RANGE(0x4000, 0xbfff) AM_RAM + AM_RANGE(0xc000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(super80v_low_r, super80v_low_w) + AM_RANGE(0xf800, 0xffff) AM_READWRITE(super80v_high_r, super80v_high_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( super80_io, AS_IO, 8, super80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xdc, 0xdc) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE(0xdc, 0xdc) AM_WRITE(super80_dc_w) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80_f0_w) + AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x14) AM_WRITE(super80_f1_w) + AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x14) AM_READ(super80_f2_r) + AM_RANGE(0xf8, 0xfb) AM_MIRROR(0x04) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( super80e_io, AS_IO, 8, super80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0xbc, 0xbc) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE(0xbc, 0xbc) AM_WRITE(super80_dc_w) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80_f0_w) + AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x14) AM_WRITE(super80_f1_w) + AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x14) AM_READ(super80_f2_r) + AM_RANGE(0xf8, 0xfb) AM_MIRROR(0x04) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( super80r_io, AS_IO, 8, super80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x10, 0x10) AM_WRITE(super80v_10_w) + AM_RANGE(0x11, 0x11) AM_DEVREAD("crtc", mc6845_device, register_r) + AM_RANGE(0x11, 0x11) AM_WRITE(super80v_11_w) + AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("dma", z80dma_device, read, write) + AM_RANGE(0x38, 0x3b) AM_DEVREADWRITE("fdc", wd2793_t, read, write) + AM_RANGE(0x3e, 0x3e) AM_READ(port3e_r) + AM_RANGE(0x3f, 0x3f) AM_WRITE(port3f_w) + AM_RANGE(0xdc, 0xdc) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE(0xdc, 0xdc) AM_WRITE(super80_dc_w) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80r_f0_w) + AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x14) AM_READ(super80_f2_r) + AM_RANGE(0xf8, 0xfb) AM_MIRROR(0x04) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( super80v_io, AS_IO, 8, super80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x10, 0x10) AM_WRITE(super80v_10_w) + AM_RANGE(0x11, 0x11) AM_DEVREAD("crtc", mc6845_device, register_r) + AM_RANGE(0x11, 0x11) AM_WRITE(super80v_11_w) + AM_RANGE(0xdc, 0xdc) AM_DEVREAD("cent_status_in", input_buffer_device, read) + AM_RANGE(0xdc, 0xdc) AM_WRITE(super80_dc_w) + AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80_f0_w) + AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x14) AM_READ(super80_f2_r) + AM_RANGE(0xf8, 0xfb) AM_MIRROR(0x04) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) +ADDRESS_MAP_END + +/**************************** DIPSWITCHES, KEYBOARD, HARDWARE CONFIGURATION ****************************************/ + +static INPUT_PORTS_START( super80 ) + PORT_START("DSW") + PORT_BIT( 0xf, 0xf, IPT_UNUSED ) + PORT_DIPNAME( 0x10, 0x00, "Switch A") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x10, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x20, 0x20, "Switch B") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x20, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x40, 0x40, "Switch C") PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x40, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x80, 0x00, "Switch D") PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x80, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + + PORT_START("KEY.0") /* line 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(0x00) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('H') PORT_CHAR(0x08) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('P') PORT_CHAR(0x10) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('X') PORT_CHAR(0x18) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT) + PORT_START("KEY.1") /* line 1 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('A') PORT_CHAR(0x01) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('I') PORT_CHAR(0x09) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('Q') PORT_CHAR(0x11) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('Y') PORT_CHAR(0x19) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("KEY.2") /* line 2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('B') PORT_CHAR(0x02) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('J') PORT_CHAR(0x0a) // port_char 0x0a is hijacked to 0x0d + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('R') PORT_CHAR(0x12) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('Z') PORT_CHAR(0x1a) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Fire)") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_START("KEY.3") /* line 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('C') PORT_CHAR(0x03) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('K') PORT_CHAR(0x0b) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('S') PORT_CHAR(0x13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(0x0a) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_START("KEY.4") /* line 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('D') PORT_CHAR(0x04) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('L') PORT_CHAR(0x0c) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('T') PORT_CHAR(0x14) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |")PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(0x03) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_START("KEY.5") /* line 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('E') PORT_CHAR(0x05) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('M') PORT_CHAR(0x0d) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('U') PORT_CHAR(0x15) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_START("KEY.6") /* line 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('F') PORT_CHAR(0x06) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('N') PORT_CHAR(0x0e) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('V') PORT_CHAR(0x16) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x7f) PORT_CHAR(0x1f) // natural kbd, press ctrl-backspace to DEL + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_START("KEY.7") /* line 7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('G') PORT_CHAR(0x07) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('O') PORT_CHAR(0x0f) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('W') PORT_CHAR(0x17) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(' ') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(0x80) // port_char doesn't work, no equivalent key + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + /* Enhanced options not available on real hardware */ + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") + PORT_CONFSETTING( 0x00, DEF_STR(No)) + PORT_CONFSETTING( 0x01, DEF_STR(Yes)) + PORT_CONFNAME( 0x02, 0x02, "2 MHz always") + PORT_CONFSETTING( 0x02, DEF_STR(No)) + PORT_CONFSETTING( 0x00, DEF_STR(Yes)) + PORT_CONFNAME( 0x04, 0x04, "Screen on always") + PORT_CONFSETTING( 0x04, DEF_STR(No)) + PORT_CONFSETTING( 0x00, DEF_STR(Yes)) + PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") + PORT_CONFSETTING( 0x08, DEF_STR(On)) + PORT_CONFSETTING( 0x00, DEF_STR(Off)) +INPUT_PORTS_END + +static INPUT_PORTS_START( super80d ) + PORT_START("DSW") + PORT_BIT( 0xf, 0xf, IPT_UNUSED ) + PORT_DIPNAME( 0x10, 0x00, "Switch A") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x10, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x20, 0x20, "Switch B") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x20, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x40, 0x40, "Switch C") PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x40, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x80, 0x00, "Switch D") PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x80, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + + PORT_START("KEY.0") /* line 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(0x00) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(0x08) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(0x10) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(0x18) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT) + PORT_START("KEY.1") /* line 1 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(0x01) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(0x09) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(0x11) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(0x19) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START("KEY.2") /* line 2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(0x02) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(0x0a) // port_char 0x0a is hijacked to 0x0d + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(0x12) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(0x1a) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Fire)") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_START("KEY.3") /* line 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(0x03) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(0x0b) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(0x13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(0x0a) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_START("KEY.4") /* line 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(0x04) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(0x0c) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(0x14) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |")PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(0x03) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_START("KEY.5") /* line 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(0x05) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(0x0d) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(0x15) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_START("KEY.6") /* line 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(0x06) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(0x0e) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(0x16) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x5f) PORT_CHAR(0x1f) // natural kbd, press ctrl-backspace to DEL + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_START("KEY.7") /* line 7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(0x07) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(0x0f) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(0x17) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(' ') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(0x80) // port_char doesn't work, no equivalent key + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + /* Enhanced options not available on real hardware */ + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") + PORT_CONFSETTING( 0x00, DEF_STR(No)) + PORT_CONFSETTING( 0x01, DEF_STR(Yes)) + PORT_CONFNAME( 0x02, 0x02, "2 MHz always") + PORT_CONFSETTING( 0x02, DEF_STR(No)) + PORT_CONFSETTING( 0x00, DEF_STR(Yes)) + PORT_CONFNAME( 0x04, 0x04, "Screen on always") + PORT_CONFSETTING( 0x04, DEF_STR(No)) + PORT_CONFSETTING( 0x00, DEF_STR(Yes)) + PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") + PORT_CONFSETTING( 0x08, DEF_STR(On)) + PORT_CONFSETTING( 0x00, DEF_STR(Off)) +INPUT_PORTS_END + +static INPUT_PORTS_START( super80m ) + PORT_INCLUDE( super80d ) + + PORT_MODIFY("CONFIG") + + /* Enhanced options not available on real hardware */ + PORT_CONFNAME( 0x10, 0x10, "Swap CharGens") + PORT_CONFSETTING( 0x10, DEF_STR(No)) + PORT_CONFSETTING( 0x00, DEF_STR(Yes)) + PORT_CONFNAME( 0x60, 0x40, "Colour") + PORT_CONFSETTING( 0x60, "MonoChrome") + PORT_CONFSETTING( 0x40, "Green") + PORT_CONFSETTING( 0x00, "Composite") + PORT_CONFSETTING( 0x20, "RGB") +INPUT_PORTS_END + +static INPUT_PORTS_START( super80v ) + PORT_INCLUDE( super80m ) + + PORT_MODIFY("CONFIG") + PORT_BIT( 0x16, 0x16, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( super80r ) + PORT_INCLUDE( super80v ) + + PORT_MODIFY("CONFIG") + PORT_BIT( 0x16, 0x16, IPT_UNUSED ) + PORT_CONFNAME( 0x60, 0x40, "Colour") + PORT_CONFSETTING( 0x60, "MonoChrome") + PORT_CONFSETTING( 0x40, "Green") +INPUT_PORTS_END + + +/**************************** F4 CHARACTER DISPLAYER ***********************************************************/ + +static const gfx_layout super80_charlayout = +{ + 8,10, /* 8 x 10 characters */ + 64, /* 64 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8, 1*8, 3*8, 5*8, 7*8, 9*8, 11*8, 13*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static const gfx_layout super80d_charlayout = +{ + 8,10, /* 8 x 10 characters */ + 128, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8, 1*8, 3*8, 5*8, 7*8, 9*8, 11*8, 13*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static const gfx_layout super80e_charlayout = +{ + 8,10, /* 8 x 10 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8, 1*8, 3*8, 5*8, 7*8, 9*8, 11*8, 13*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static const gfx_layout super80v_charlayout = +{ + 8,16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( super80 ) + GFXDECODE_ENTRY( "chargen", 0x0000, super80_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( super80d ) + GFXDECODE_ENTRY( "chargen", 0x0000, super80d_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( super80e ) + GFXDECODE_ENTRY( "chargen", 0x0000, super80e_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( super80m ) + GFXDECODE_ENTRY( "chargen", 0x0000, super80e_charlayout, 0, 8 ) + GFXDECODE_ENTRY( "chargen", 0x1000, super80d_charlayout, 0, 8 ) +GFXDECODE_END + +/* This will show the 128 characters in the ROM + whatever happens to be in the PCG */ +static GFXDECODE_START( super80v ) + GFXDECODE_ENTRY( "maincpu", 0xf000, super80v_charlayout, 0, 8 ) +GFXDECODE_END + + + +/**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/ + + +static const z80_daisy_config super80_daisy_chain[] = +{ + { "z80pio" }, + { NULL } +}; + +//------------------------------------------------- +// Z80DMA +//------------------------------------------------- + +WRITE_LINE_MEMBER( super80_state::busreq_w ) +{ +// since our Z80 has no support for BUSACK, we assume it is granted immediately + m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); + m_maincpu->set_input_line(INPUT_LINE_HALT, state); // do we need this? + m_dma->bai_w(state); // tell dma that bus has been granted +} + +READ8_MEMBER(super80_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(super80_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset, data); +} + +READ8_MEMBER(super80_state::io_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(super80_state::io_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + prog_space.write_byte(offset, data); +} + +static SLOT_INTERFACE_START( super80_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( super80, super80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) /* 2 MHz */ + MCFG_CPU_PROGRAM_MAP(super80_map) + MCFG_CPU_IO_MAP(super80_io) + MCFG_CPU_CONFIG(super80_daisy_chain) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, MASTER_CLOCK/6) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(super80_state, pio_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(super80_state,pio_port_b_r)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(48.8) + MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) + MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", super80) + MCFG_DEFAULT_LAYOUT( layout_super80 ) + MCFG_VIDEO_START_OVERRIDE(super80_state,super80) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", super80_state, super80, "bin", 3) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", super80_state, timer_p, attotime::from_hz(40000)) // cass read + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", super80_state, timer_k, attotime::from_hz(300)) // keyb scan + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_h", super80_state, timer_h, attotime::from_hz(100)) // half-speed +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( super80d, super80 ) + MCFG_GFXDECODE_MODIFY("gfxdecode", super80d) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80d) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( super80e, super80 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(super80e_io) + MCFG_GFXDECODE_MODIFY("gfxdecode", super80e) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80e) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( super80m, super80 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(super80m_map) + + MCFG_GFXDECODE_MODIFY("gfxdecode", super80m) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(32) + MCFG_PALETTE_INIT_OWNER(super80_state,super80m) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80m) + MCFG_SCREEN_VBLANK_DRIVER(super80_state, screen_eof_super80m) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( super80v, super80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) /* 2 MHz */ + MCFG_CPU_PROGRAM_MAP(super80v_map) + MCFG_CPU_IO_MAP(super80v_io) + MCFG_CPU_CONFIG(super80_daisy_chain) + + MCFG_DEVICE_ADD("z80pio", Z80PIO, MASTER_CLOCK/6) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(super80_state, pio_port_a_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(super80_state,pio_port_b_r)) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, SUPER80V_SCREEN_WIDTH-1, 0, SUPER80V_SCREEN_HEIGHT-1) + MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80v) + MCFG_SCREEN_VBLANK_DRIVER(super80_state, screen_eof_super80m) + + MCFG_PALETTE_ADD("palette", 32) + MCFG_PALETTE_INIT_OWNER(super80_state,super80m) + + MCFG_MC6845_ADD("crtc", MC6845, "screen", MASTER_CLOCK / SUPER80V_DOTS) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(SUPER80V_DOTS) + MCFG_MC6845_UPDATE_ROW_CB(super80_state, crtc_update_row) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", super80v) + MCFG_DEFAULT_LAYOUT( layout_super80 ) + MCFG_VIDEO_START_OVERRIDE(super80_state,super80v) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", super80_state, super80, "bin", 3) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", super80_state, timer_p, attotime::from_hz(40000)) // cass read + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", super80_state, timer_k, attotime::from_hz(300)) // keyb scan +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( super80r, super80v ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(super80r_io) + + MCFG_DEVICE_ADD("dma", Z80DMA, MASTER_CLOCK/6) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(super80_state, busreq_w)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + //ba0 - not connected + MCFG_Z80DMA_IN_MREQ_CB(READ8(super80_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(super80_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(super80_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(super80_state, io_write_byte)) + + MCFG_WD2793_ADD("fdc", XTAL_2MHz) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", super80_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", super80_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +/**************************** ROMS *****************************************************************/ + +ROM_START( super80 ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("super80.u26", 0xc000, 0x1000, CRC(6a6a9664) SHA1(2c4fcd943aa9bf7419d58fbc0e28ffb89ef22e0b) ) + ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) + ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) + ROM_FILL( 0xf000, 0x1000, 0xff) /* This makes the screen show the FF character when O F1 F0 entered */ + + ROM_REGION(0x0400, "chargen", 0) // 2513 prom + ROM_LOAD("super80.u27", 0x0000, 0x0400, CRC(d1e4b3c6) SHA1(3667b97c6136da4761937958f281609690af4081) ) +ROM_END + +ROM_START( super80d ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "super80d", "V2.2") + ROMX_LOAD("super80d.u26", 0xc000, 0x1000, CRC(cebd2613) SHA1(87b94cc101a5948ce590211c68272e27f4cbe95a), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "super80f", "MDS (original)") + ROMX_LOAD("super80f.u26", 0xc000, 0x1000, CRC(d39775f0) SHA1(b47298ee028924612e9728bb2debd0f47399add7), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "super80g", "MDS (upgraded)") + ROMX_LOAD("super80g.u26", 0xc000, 0x1000, CRC(7386f507) SHA1(69d7627033d62bd4e886ccc136e89f1524d38f47), ROM_BIOS(3)) + ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) + ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) + ROM_FILL( 0xf000, 0x1000, 0xff) + + ROM_REGION(0x0800, "chargen", 0) // 2716 eprom + ROM_LOAD("super80d.u27", 0x0000, 0x0800, CRC(cb4c81e2) SHA1(8096f21c914fa76df5d23f74b1f7f83bd8645783) ) +ROM_END + +ROM_START( super80e ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("super80e.u26", 0xc000, 0x1000, CRC(bdc668f8) SHA1(3ae30b3cab599fca77d5e461f3ec1acf404caf07) ) + ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) + ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) + ROM_FILL( 0xf000, 0x1000, 0xff) + + ROM_REGION(0x1000, "chargen", 0) // 2732 eprom + ROM_LOAD("super80e.u27", 0x0000, 0x1000, CRC(ebe763a7) SHA1(ffaa6d6a2c5dacc5a6651514e6707175a32e83e8) ) +ROM_END + +ROM_START( super80m ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "8r0", "8R0") + ROMX_LOAD("s80-8r0.u26", 0xc000, 0x1000, CRC(48d410d8) SHA1(750d984abc013a3344628300288f6d1ba140a95f), ROM_BIOS(1) ) + ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(1) ) + ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(1) ) +#if 0 + /* Temporary patch to fix crash when lprinting a tab */ + ROM_FILL(0xcc44,1,0x46) + ROM_FILL(0xcc45,1,0xc5) + ROM_FILL(0xcc46,1,0x06) + ROM_FILL(0xcc47,1,0x20) + ROM_FILL(0xcc48,1,0xcd) + ROM_FILL(0xcc49,1,0xc7) + ROM_FILL(0xcc4a,1,0xcb) + ROM_FILL(0xcc4b,1,0xc1) + ROM_FILL(0xcc4c,1,0x10) + ROM_FILL(0xcc4d,1,0xf7) + ROM_FILL(0xcc4e,1,0x00) + ROM_FILL(0xcc4f,1,0x00) +#endif + ROM_SYSTEM_BIOS(1, "v37", "V3.7") + ROMX_LOAD("s80-v37.u26", 0xc000, 0x1000, CRC(46043035) SHA1(1765105df4e4af83d56cafb88e158ed462d4709e), ROM_BIOS(2) ) + ROMX_LOAD("s80-v37.u33", 0xd000, 0x1000, CRC(afb52b15) SHA1(0a2c25834074ce44bf12ac8532b4add492bcf950), ROM_BIOS(2) ) + ROMX_LOAD("s80-v37.u42", 0xe000, 0x1000, CRC(7344b27a) SHA1(f43fc47ddb5c12bffffa63488301cd5eb386cc9a), ROM_BIOS(2) ) + + ROM_SYSTEM_BIOS(2, "8r2", "8R2") + ROMX_LOAD("s80-8r2.u26", 0xc000, 0x1000, CRC(1e166c8c) SHA1(15647614be9300cdd2956da913e83234c36b36a9), ROM_BIOS(3) ) + ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(3) ) + ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(3) ) + + ROM_SYSTEM_BIOS(3, "8r3", "8R3") + ROMX_LOAD("s80-8r3.u26", 0xc000, 0x1000, CRC(ee7dd90b) SHA1(c53f8eef82e8f943642f6ddfc2cb1bfdc32d25ca), ROM_BIOS(4) ) + ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(4) ) + ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(4) ) + + ROM_SYSTEM_BIOS(4, "8r4", "8R4") + ROMX_LOAD("s80-8r4.u26", 0xc000, 0x1000, CRC(637d001d) SHA1(f26b5ecc33fd44b05b1f199d79e0f072ec8d0e23), ROM_BIOS(5) ) + ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(5) ) + ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(5) ) + + ROM_SYSTEM_BIOS(5, "8r5", "8R5") + ROMX_LOAD("s80-8r5.u26", 0xc000, 0x1000, CRC(294f217c) SHA1(f352d54e84e94bf299726dc3af4eb7b2d06d317c), ROM_BIOS(6) ) + ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(6) ) + ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(6) ) + + ROM_REGION(0x1800, "chargen", 0) + ROM_LOAD("super80e.u27", 0x0000, 0x1000, CRC(ebe763a7) SHA1(ffaa6d6a2c5dacc5a6651514e6707175a32e83e8) ) + ROM_LOAD("super80d.u27", 0x1000, 0x0800, CRC(cb4c81e2) SHA1(8096f21c914fa76df5d23f74b1f7f83bd8645783) ) +ROM_END + +ROM_START( super80r ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS(0, "super80r", "MCE (original)") + ROMX_LOAD("super80r.u26", 0xc000, 0x1000, CRC(01bb6406) SHA1(8e275ecf5141b93f86e45ff8a735b965ea3e8d44), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "super80s", "MCE (upgraded)") + ROMX_LOAD("super80s.u26", 0xc000, 0x1000, CRC(3e29d307) SHA1(b3f4667633e0a4eb8577e39b5bd22e1f0bfbc0a9), ROM_BIOS(2)) + + ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) + ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) + ROM_LOAD("s80hmce.ic24", 0xf000, 0x0800, CRC(a6488a1e) SHA1(7ba613d70a37a6b738dcd80c2bb9988ff1f011ef) ) + + ROM_REGION( 0x1000, "videoram", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( super80v ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("s80-v37v.u26", 0xc000, 0x1000, CRC(01e0c0dd) SHA1(ef66af9c44c651c65a21d5bda939ffa100078c08) ) + ROM_LOAD("s80-v37v.u33", 0xd000, 0x1000, CRC(812ad777) SHA1(04f355bea3470a7d9ea23bb2811f6af7d81dc400) ) + ROM_LOAD("s80-v37v.u42", 0xe000, 0x1000, CRC(e02e736e) SHA1(57b0264c805da99234ab5e8e028fca456851a4f9) ) + ROM_LOAD("s80hmce.ic24", 0xf000, 0x0800, CRC(a6488a1e) SHA1(7ba613d70a37a6b738dcd80c2bb9988ff1f011ef) ) + + ROM_REGION( 0x1000, "videoram", ROMREGION_ERASEFF ) + ROM_REGION( 0x1000, "colorram", ROMREGION_ERASEFF ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ +COMP( 1981, super80, 0, 0, super80, super80, super80_state, super80, "Dick Smith Electronics", "Super-80 (V1.2)" , 0) +COMP( 1981, super80d, super80, 0, super80d, super80d, super80_state, super80, "Dick Smith Electronics", "Super-80 (V2.2)" , 0) +COMP( 1981, super80e, super80, 0, super80e, super80d, super80_state, super80, "Dick Smith Electronics", "Super-80 (El Graphix 4)" , MACHINE_UNOFFICIAL) +COMP( 1981, super80m, super80, 0, super80m, super80m, super80_state, super80, "Dick Smith Electronics", "Super-80 (with colour)" , MACHINE_UNOFFICIAL) +COMP( 1981, super80r, super80, 0, super80r, super80r, super80_state, super80, "Dick Smith Electronics", "Super-80 (with VDUEB)" , MACHINE_UNOFFICIAL) +COMP( 1981, super80v, super80, 0, super80v, super80v, super80_state, super80, "Dick Smith Electronics", "Super-80 (with enhanced VDUEB)" , MACHINE_UNOFFICIAL) diff --git a/src/mame/drivers/supercon.c b/src/mame/drivers/supercon.c new file mode 100644 index 00000000000..7c286f6b4c2 --- /dev/null +++ b/src/mame/drivers/supercon.c @@ -0,0 +1,811 @@ +// license:??? +// copyright-holders:Ralf Schaefer, Robbbert +/****************************************************************************** + Novag SuperConstellation Chess Computer + 2010 R. Schaefer + + + CPU 6502 + Clock 4 MHz + IRQ CLK 600 Hz + + RAM 0x0000, 0x0fff) + ROM 0x2000, 0xffff) + I/O 0x1c00 Unknown + 0x1d00 Unknown + 0x1e00 LED's and buttons + 0x1f00 LED's, buttons and buzzer + + +******************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "sound/beep.h" + + +class supercon_state : public driver_device +{ +public: + supercon_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_beep(*this, "beeper"), + m_b_white(*this, "B_WHITE"), + m_b_black(*this, "B_BLACK"), + m_b_clr(*this, "B_CLR"), + m_status_1(*this, "STATUS_1"), + m_status_2(*this, "STATUS_2"), + m_status_3(*this, "STATUS_3"), + m_status_4(*this, "STATUS_4"), + m_status_5(*this, "STATUS_5"), + m_status_6(*this, "STATUS_6"), + m_status_7(*this, "STATUS_7"), + m_status_8(*this, "STATUS_8"), + m_board_1(*this, "BOARD_1"), + m_board_2(*this, "BOARD_2"), + m_board_3(*this, "BOARD_3"), + m_board_4(*this, "BOARD_4"), + m_board_5(*this, "BOARD_5"), + m_board_6(*this, "BOARD_6"), + m_board_7(*this, "BOARD_7"), + m_board_8(*this, "BOARD_8") { } + + required_device m_maincpu; + required_device m_beep; + DECLARE_READ8_MEMBER(supercon_port1_r); + DECLARE_READ8_MEMBER(supercon_port2_r); + DECLARE_READ8_MEMBER(supercon_port3_r); + DECLARE_READ8_MEMBER(supercon_port4_r); + DECLARE_WRITE8_MEMBER(supercon_port1_w); + DECLARE_WRITE8_MEMBER(supercon_port2_w); + DECLARE_WRITE8_MEMBER(supercon_port3_w); + DECLARE_WRITE8_MEMBER(supercon_port4_w); + static const UINT8 m_border_pieces[12]; + emu_timer* m_timer_update_irq; + emu_timer* m_timer_mouse_click; + int m_emu_started; + int m_moving_piece; + UINT8 m_data_1E00; + UINT8 m_data_1F00; + UINT8 m_LED_18; + UINT8 m_LED_AH; + UINT8 m_LED_ST; + UINT8 *m_last_LED; + UINT8 m_last_LED_value; + int m_led_update; + int m_remove_led_flag; + int m_selecting; + int m_save_key_data; + attotime m_wait_time; + int *m_current_field; + int m_confirm_board_click; + int m_board[64]; + int m_save_board[64]; + void set_board(); + void set_pieces(); + void set_border_pieces(); + void clear_pieces(); + void update_leds(); + virtual void machine_reset(); + DECLARE_DRIVER_INIT(supercon); + virtual void machine_start(); + TIMER_CALLBACK_MEMBER(mouse_click); + TIMER_CALLBACK_MEMBER(update_irq); + TIMER_DEVICE_CALLBACK_MEMBER(update_artwork); + void board_presave(); + void board_postload(); + +protected: + required_ioport m_b_white; + required_ioport m_b_black; + required_ioport m_b_clr; + required_ioport m_status_1; + required_ioport m_status_2; + required_ioport m_status_3; + required_ioport m_status_4; + required_ioport m_status_5; + required_ioport m_status_6; + required_ioport m_status_7; + required_ioport m_status_8; + required_ioport m_board_1; + required_ioport m_board_2; + required_ioport m_board_3; + required_ioport m_board_4; + required_ioport m_board_5; + required_ioport m_board_6; + required_ioport m_board_7; + required_ioport m_board_8; + void mouse_update(); + int get_first_cleared_bit(UINT8 data); + int get_first_bit(UINT8 data); +}; + + +#define VERBOSE 0 +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +enum +{ + EM, /*No piece*/ + BP, + BN, + BB, + BR, + BQ, + BK, + WP, + WN, + WB, + WR, + WQ, + WK +}; + + +#define LED_LINE_AH 0x10 +#define LED_LINE_ST 0x20 +#define LED_LINE_18 0x40 + + +#define MAIN_CLOCK 4000000 /* 4 MHz */ + +#define NOT_VALID 99 + +#define NO_ACTION 0 +#define TAKE 1 +#define SET 2 + +/* artwork board */ + +const UINT8 supercon_state::m_border_pieces[12] = {WK,WQ,WR,WB,WN,WP,BK,BQ,BR,BB,BN,BP}; + +void supercon_state::set_board() +{ + static const int start_board[64] = { + BR, BN, BB, BQ, BK, BB, BN, BR, + BP, BP, BP, BP, BP, BP, BP, BP, + EM, EM, EM, EM, EM, EM, EM, EM, + EM, EM, EM, EM, EM, EM, EM, EM, + EM, EM, EM, EM, EM, EM, EM, EM, + EM, EM, EM, EM, EM, EM, EM, EM, + WP, WP, WP, WP, WP, WP, WP, WP, + WR, WN, WB, WQ, WK, WB, WN, WR }; + + for (UINT8 i=0; i<64; i++) + m_board[i]=start_board[i]; +} + +void supercon_state::set_pieces() +{ + int i; + for (i=0;i<64;i++) + output_set_indexed_value("P", i, m_board[i]); +} + +void supercon_state::set_border_pieces() +{ + UINT8 i; + + for (i=0;i<12;i++) + output_set_indexed_value("Q", i, m_border_pieces[i]); +} + +void supercon_state::clear_pieces() +{ + int i; + for (i=0;i<64;i++) + { + output_set_indexed_value("P", i, EM); + m_board[i]=EM; + } +} + +int supercon_state::get_first_cleared_bit(UINT8 data) +{ + int i; + + for (i = 0; i < 8; i++) + if (!BIT(data, i)) + return i; + + return NOT_VALID; +} + +int supercon_state::get_first_bit(UINT8 data) +{ + int i; + + for (i = 0; i < 8; i++) + if (BIT(data, i)) + return i; + + return NOT_VALID; +} + + +void supercon_state::update_leds() +{ + int i; + + for (i = 0; i < 8; i++) + { + if (BIT(m_LED_18, i)) + output_set_led_value(i + 1, 1); + else + output_set_led_value(i + 1, 0); + + if (BIT(m_LED_AH, i)) + output_set_led_value(i + 9, 1); + else + output_set_led_value(i + 9, 0); + + if (BIT(m_LED_ST, i)) + output_set_led_value(i + 17, 1); + else + output_set_led_value(i + 17, 0); + } +} + +void supercon_state::mouse_update() +{ + UINT8 port_input; // m_left; + int i; + +/* border pieces and moving piece */ + + port_input = m_b_white->read(); + if (port_input) + { + i = get_first_bit(port_input); + m_moving_piece = m_border_pieces[i]; + output_set_value("MOVING", m_moving_piece); + return; + } + + + port_input = m_b_black->read(); + if (port_input) + { + i = get_first_bit(port_input); + m_moving_piece = m_border_pieces[6+i]; + output_set_value("MOVING", m_moving_piece); + return; + } + + + port_input = m_b_clr->read(); + if (port_input) + { + if (m_moving_piece) + { + m_moving_piece=0; + output_set_value("MOVING", m_moving_piece); + return; + } + } +} + +/* Driver initialization */ + +DRIVER_INIT_MEMBER(supercon_state,supercon) +{ + m_LED_18=0; + m_LED_AH=0; + m_LED_ST=0; + + m_wait_time = attotime::from_hz(4); + m_save_key_data = 0xff; + + m_moving_piece=0; +} + +/* Read 1C000 */ + +READ8_MEMBER( supercon_state::supercon_port1_r ) +{ + LOG(("Read from %04x \n",0x1C00)); + return 0xff; +} + +/* Read 1D000 */ + +READ8_MEMBER( supercon_state::supercon_port2_r ) +{ + LOG(("Read from %04x \n",0x1D00)); + return 0xff; +} + +/* Read 1E00 */ + +READ8_MEMBER( supercon_state::supercon_port3_r ) +{ + int i; + UINT8 key_data=0; + + static const char *const status_lines[8] = + { "STATUS_1", "STATUS_2", "STATUS_3", "STATUS_4", "STATUS_5", "STATUS_6", "STATUS_7", "STATUS_8" }; + + LOG(("Read from %04x \n",0x1E00)); + +/* remove last bit (only if it was not already set) */ + + if ( m_data_1F00 & LED_LINE_AH ) + { + if (m_last_LED_value != m_LED_AH) + m_LED_AH=m_LED_AH & ~m_data_1E00; + } + else if ( m_data_1F00 & LED_LINE_ST) + { + if (m_last_LED_value != m_LED_ST) + m_LED_ST=m_LED_ST & ~m_data_1E00; + } + else if ( m_data_1F00 & LED_LINE_18 ) + { + if (m_last_LED_value != m_LED_18) + m_LED_18=m_LED_18 & ~m_data_1E00; + } + + + LOG(("LED_18 from %02x \n",m_LED_18)); + LOG(("LED_AH from %02x \n",m_LED_AH)); + LOG(("LED_ST from %02x \n",m_LED_ST)); + + if (m_led_update) /*No LED Update if Port 1C00,1D00 was read */ + update_leds(); + + m_remove_led_flag=TRUE; + m_led_update=TRUE; + + m_LED_18=0; + m_LED_AH=0; + m_LED_ST=0; + + +/* Start */ + + if (!m_emu_started) + return 0xbf; + else + m_timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(598) ); //HACK adjust timer after start ??? + + +/* Buttons */ + + i=get_first_bit(m_data_1E00); + if (i==NOT_VALID) + return 0xff; + + switch ( i ) + { + case 0: key_data=m_status_1->read(); break; + case 1: key_data=m_status_2->read(); break; + case 2: key_data=m_status_3->read(); break; + case 3: key_data=m_status_4->read(); break; + case 4: key_data=m_status_5->read(); break; + case 5: key_data=m_status_6->read(); break; + case 6: key_data=m_status_7->read(); break; + case 7: key_data=m_status_8->read(); break; + } + + if (key_data != 0xc0) + { + LOG(("%s, key_data: %02x \n",status_lines[i],key_data)); + +/* Button: New Game -> initialize board */ + + if (i==0 && key_data==0x80) + { + set_board(); + set_pieces(); + + m_emu_started=FALSE; + } + +/* Button: Clear Board -> remove all pieces */ + + if (i==3 && key_data==0x80) + clear_pieces(); + + if (key_data != 0xff ) + return key_data; + } + + return 0xc0; +} + +/* Read Port $1F00 */ + +READ8_MEMBER( supercon_state::supercon_port4_r ) +{ + int i_18, i_AH; + UINT8 key_data = 0x00; + + static const char *const board_lines[8] = + { "BOARD_1", "BOARD_2", "BOARD_3", "BOARD_4", "BOARD_5", "BOARD_6", "BOARD_7", "BOARD_8" }; + + LOG(("Read from %04x \n",0x1F00)); + +/* Board buttons */ + + i_18=get_first_bit(m_data_1E00); + if (i_18==NOT_VALID) + return 0xff; + +/* if a button was pressed wait til timer -timer_mouse_click- is fired */ + + if (m_selecting) + return m_save_key_data; + else + { + set_pieces(); + output_set_value("MOVING",m_moving_piece); + } + + switch ( i_18 ) + { + case 0: key_data=m_board_1->read(); break; + case 1: key_data=m_board_2->read(); break; + case 2: key_data=m_board_3->read(); break; + case 3: key_data=m_board_4->read(); break; + case 4: key_data=m_board_5->read(); break; + case 5: key_data=m_board_6->read(); break; + case 6: key_data=m_board_7->read(); break; + case 7: key_data=m_board_8->read(); break; + } + + if (key_data != 0xff) + { + LOG(("%s key_data: %02x \n",board_lines[i_18],key_data)); + +/* Only if valid data */ + + if (key_data) + { +/* Set or remove pieces */ + + i_AH=7-get_first_cleared_bit(key_data); + LOG(("Press -> AH: %d 18: %d Piece: %d\n",i_AH,i_18,m_board[i_18*8 + i_AH]);); + + m_current_field=&m_board[i_18*8 + i_AH]; + + if (m_moving_piece) + { + *m_current_field = m_moving_piece; + m_moving_piece = EM; + } + else + { + m_moving_piece = *m_current_field; + *m_current_field = EM; + } + m_selecting=TRUE; /* Flag is removed in timer -timer_mouse_click- */ + m_save_key_data=key_data; /* return same key_data til flag selecting is removed */ + + m_timer_mouse_click->adjust(m_wait_time, 0); + + return key_data; + } + } + + return 0xff; +} + +/* Write Port $1C00 */ + +WRITE8_MEMBER( supercon_state::supercon_port1_w ) +{ + LOG(("Write from %04x data: %02x\n",0x1C00,data)); + m_led_update=FALSE; +} + +/* Write Port $1D00 */ + +WRITE8_MEMBER( supercon_state::supercon_port2_w ) +{ + LOG(("Write from %04x data: %02x\n",0x1D00,data)); + m_led_update=FALSE; +} + +/* Write Port $1E00 */ + +WRITE8_MEMBER( supercon_state::supercon_port3_w ) +{ + if (data) + LOG(("Write from %04x data: %02x\n",0x1E00,data)); + + if (data) + { + m_data_1E00=data; + +/* Set bits for LED's */ + + if ( m_data_1F00) + { + if (m_data_1F00 & LED_LINE_AH ) + { + m_last_LED = &m_LED_AH; /* save last value */ + m_last_LED_value = *m_last_LED; + + m_LED_AH=m_LED_AH | m_data_1E00; + } + else if (m_data_1F00 & LED_LINE_ST ) + { + m_last_LED = &m_LED_ST; + m_last_LED_value = *m_last_LED; + + m_LED_ST=m_LED_ST | m_data_1E00; + } + else if (m_data_1F00 & LED_LINE_18) + { + m_last_LED = &m_LED_18; + m_last_LED_value = *m_last_LED; + + m_LED_18=m_LED_18 | m_data_1E00; + } + } + } + + // The IRQ handler writes to both 0x1E00 (1x) and 0x1F00 (2x) ports. + // Not 100% sure if this is the correct place for clearing the IRQ + // line. + m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); +} + +/* Write Port $1F00 */ + +WRITE8_MEMBER( supercon_state::supercon_port4_w ) +{ + if (data) + LOG(("Write from %04x data: %02x\n",0x1F00,data)); + + if (data) + m_data_1F00=data; + +/* Bit 7 is set -> Buzzer on */ + + if ( m_data_1F00 & 0x80 ) + { + m_beep->set_state(1); + m_emu_started=TRUE; + } + else + m_beep->set_state(0); +} + +TIMER_CALLBACK_MEMBER(supercon_state::mouse_click) +{ + m_selecting=FALSE; +} + +TIMER_DEVICE_CALLBACK_MEMBER(supercon_state::update_artwork) +{ + mouse_update(); +} + +TIMER_CALLBACK_MEMBER(supercon_state::update_irq) +{ + m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); +} + +/* Save state call backs */ + +void supercon_state::board_presave() +{ + for (int i=0;i<64;i++) + { + m_save_board[i] = m_board[i]; + } +} + +void supercon_state::board_postload() +{ + for (int i=0;i<64;i++) + { + m_board[i] = m_save_board[i]; + } + + set_pieces(); +} + +void supercon_state::machine_start() +{ + m_timer_update_irq = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supercon_state::update_irq),this)); + m_timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(1000) ); + m_timer_mouse_click = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supercon_state::mouse_click),this),NULL); + save_item(NAME(m_save_board)); + machine().save().register_postload(save_prepost_delegate(FUNC(supercon_state::board_postload),this)); + machine().save().register_presave(save_prepost_delegate(FUNC(supercon_state::board_presave),this)); +} + +void supercon_state::machine_reset() +{ + set_board(); + set_pieces(); + set_border_pieces(); + + m_emu_started=FALSE; +} + +/* Address maps */ + +static ADDRESS_MAP_START(supercon_mem, AS_PROGRAM, 8, supercon_state) + AM_RANGE( 0x0000, 0x0fff) AM_RAM + AM_RANGE( 0x2000, 0x7fff) AM_ROM + AM_RANGE( 0x8000, 0xffff) AM_ROM + + AM_RANGE( 0x1C00, 0x1C00) AM_WRITE ( supercon_port1_w ) + AM_RANGE( 0x1D00, 0x1D00) AM_WRITE ( supercon_port2_w ) + AM_RANGE( 0x1E00, 0x1E00) AM_WRITE ( supercon_port3_w ) + AM_RANGE( 0x1F00, 0x1F00) AM_WRITE ( supercon_port4_w ) + + AM_RANGE( 0x1C00, 0x1C00) AM_READ ( supercon_port1_r ) + AM_RANGE( 0x1D00, 0x1D00) AM_READ ( supercon_port2_r ) + AM_RANGE( 0x1E00, 0x1E00) AM_READ ( supercon_port3_r ) + AM_RANGE( 0x1F00, 0x1F00) AM_READ ( supercon_port4_r ) +ADDRESS_MAP_END + +/* Input ports */ + +static INPUT_PORTS_START( supercon ) + + PORT_START("BOARD_1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("BOARD_2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("BOARD_3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("BOARD_4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("BOARD_5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("BOARD_6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("BOARD_7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("BOARD_8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("STATUS_1") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("STATUS_2") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("STATUS_3") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("STATUS_4") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("STATUS_5") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("STATUS_6") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("STATUS_7") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("STATUS_8") + PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("B_WHITE") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) + + PORT_START("B_BLACK") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) + + PORT_START("B_CLR") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) + +INPUT_PORTS_END + +/* Machine driver */ +static MACHINE_CONFIG_START( supercon, supercon_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6502,MAIN_CLOCK) + MCFG_CPU_PROGRAM_MAP(supercon_mem) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", supercon_state, update_artwork, attotime::from_hz(20)) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START(supercon) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("supercon_low.bin", 0x0000, 0x8000, CRC(b853cf6e) SHA1(1a759072a5023b92c07f1fac01b7a21f7b5b45d0 )) + ROM_LOAD("supercon_high.bin", 0x8000, 0x8000, CRC(c8f82331) SHA1(f7fd039f9a3344db9749931490ded9e9e309cfbe )) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1983, supercon, 0, 0, supercon, supercon, supercon_state, supercon, "Novag", "SuperConstellation", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mame/drivers/superslave.c b/src/mame/drivers/superslave.c new file mode 100644 index 00000000000..440edac81de --- /dev/null +++ b/src/mame/drivers/superslave.c @@ -0,0 +1,411 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/************************************************************************** + +Monitor commands +Dxxxx,yyyy = Dump memory +Fxxxx,yyyy,zz = Fill memory +Gxxxx = Goto +Ixx = In port +Lxxxx = Load +Mxxxx,yyyy,zzzz = Move x-y to z +Oxx,yy = Out port +- = Edit memory +. = Edit memory + + + TODO: + + - all + +****************************************************************************/ + +#include "includes/superslave.h" + + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( superslave_state::read ) +{ + UINT8 data = 0; + + offs_t boundry = 0xc000 | ((m_memctrl & 0xf0) << 6); + + if ((offset < 0x1000) && BIT(m_cmd, 0)) + { + data = m_rom->base()[offset & 0x7ff]; + } + else if (offset < boundry) + { + if (BIT(m_memctrl, 0)) + { + data = m_ram->pointer()[offset]; + } + else if (BIT(m_memctrl, 1) && (m_ram->size() > 0x10000)) + { + data = m_ram->pointer()[0x10000 | offset]; + } + } + else + { + data = m_ram->pointer()[offset]; + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( superslave_state::write ) +{ + offs_t boundry = 0xc000 | ((m_memctrl & 0xf0) << 6); + + if (offset < boundry) + { + if (BIT(m_memctrl, 0)) + { + m_ram->pointer()[offset] = data; + } + else if (BIT(m_memctrl, 1) && (m_ram->size() > 0x10000)) + { + m_ram->pointer()[0x10000 | offset] = data; + } + } + else + { + m_ram->pointer()[offset] = data; + } +} + + +//------------------------------------------------- +// baud_w - +//------------------------------------------------- + +WRITE8_MEMBER( superslave_state::baud_w ) +{ + m_dbrg->str_w(data & 0x0f); + m_dbrg->stt_w(data >> 4); +} + + +//------------------------------------------------- +// memctrl_w - +//------------------------------------------------- + +WRITE8_MEMBER( superslave_state::memctrl_w ) +{ + /* + + bit description + + 0 Memory bank 0 on + 1 Memory bank 1 on + 2 + 3 + 4 Unswitched memory boundary bit 0 + 5 Unswitched memory boundary bit 1 + 6 Unswitched memory boundary bit 2 + 7 Unswitched memory boundary bit 3 + + */ + + m_memctrl = data; +} + + +//------------------------------------------------- +// status_r - +//------------------------------------------------- + +READ8_MEMBER( superslave_state::status_r) +{ + /* + + bit description + + 0 Sense Switch (0=closed) + 1 Parity error (1=error) + 2 Syncerr (1=error) + 3 Service Request + 4 Data Set Ready 3 + 5 Data Set Ready 2 + 6 Data Set Ready 1 + 7 Data Set Ready 0 + + */ + + UINT8 data = 1; + + // RS-232 + data |= m_rs232d->dsr_r() << 4; + data |= m_rs232c->dsr_r() << 5; + data |= m_rs232b->dsr_r() << 6; + data |= m_rs232a->dsr_r() << 7; + + return data; +} + + +//------------------------------------------------- +// cmd_w - +//------------------------------------------------- + +WRITE8_MEMBER( superslave_state::cmd_w ) +{ + /* + + bit description + + 0 Prom enable (1=enabled) + 1 Clear Parity (1=cleared) + 2 Clear Syncerr (1=cleared) + 3 Service Request + 4 Wait Protocol (0=Wait) + 5 Command bit 5 + 6 Command bit 6 + 7 Command bit 7 + + */ + + m_cmd = data; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( superslave_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( superslave_mem, AS_PROGRAM, 8, superslave_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( superslave_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( superslave_io, AS_IO, 8, superslave_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(Z80DART_0_TAG, z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80DART_1_TAG, z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x10, 0x10) AM_MIRROR(0x03) AM_WRITE(baud_w) + AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read_alt, write_alt) + AM_RANGE(0x18, 0x1c) AM_DEVREADWRITE(AM9519_TAG, pic8259_device, read, write) + AM_RANGE(0x1d, 0x1d) AM_WRITE(memctrl_w) + AM_RANGE(0x1e, 0x1e) AM_NOP // master communications + AM_RANGE(0x1f, 0x1f) AM_READWRITE(status_r, cmd_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( superslave ) +//------------------------------------------------- + +static INPUT_PORTS_START( superslave ) + PORT_START("SW1") + PORT_DIPNAME( 0x7f, 0x38, "Slave Address" ) PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7") + PORT_DIPSETTING( 0x38, "70H (0)" ) + PORT_DIPSETTING( 0x39, "72H (1)" ) + PORT_DIPSETTING( 0x3a, "74H (2)" ) + PORT_DIPSETTING( 0x3b, "76H (3)" ) + PORT_DIPSETTING( 0x3c, "78H (4)" ) + PORT_DIPSETTING( 0x3d, "7AH (5)" ) + PORT_DIPSETTING( 0x3e, "7CH (6)" ) + PORT_DIPSETTING( 0x3f, "7EH (7)" ) + PORT_DIPSETTING( 0x40, "80H (8)" ) + PORT_DIPSETTING( 0x41, "82H (9)" ) + PORT_DIPSETTING( 0x42, "84H (10)" ) + PORT_DIPSETTING( 0x43, "86H (11)" ) + PORT_DIPSETTING( 0x44, "88H (12)" ) + PORT_DIPSETTING( 0x45, "8AH (13)" ) + PORT_DIPSETTING( 0x46, "8CH (14)" ) + PORT_DIPSETTING( 0x47, "8EH (15)" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// COM8116_INTERFACE( dbrg_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( superslave_state::fr_w ) +{ + m_dart0->rxca_w(state); + m_dart0->txca_w(state); + m_dart1->rxca_w(state); + m_dart1->txca_w(state); +} + +WRITE_LINE_MEMBER( superslave_state::ft_w ) +{ + m_dart0->rxtxcb_w(state); + m_dart1->rxtxcb_w(state); +} + + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + + +//------------------------------------------------- +// z80_daisy_config superslave_daisy_chain +//------------------------------------------------- + +static const z80_daisy_config superslave_daisy_chain[] = +{ + { Z80DART_0_TAG }, + { Z80DART_1_TAG }, + { Z80PIO_TAG }, + { NULL } +}; + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( superslave ) +//------------------------------------------------- + +void superslave_state::machine_start() +{ + // state saving + save_item(NAME(m_memctrl)); + save_item(NAME(m_cmd)); +} + + +void superslave_state::machine_reset() +{ + m_memctrl = 0x01; + m_cmd = 0x01; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( superslave ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( superslave, superslave_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) + MCFG_CPU_PROGRAM_MAP(superslave_mem) + MCFG_CPU_IO_MAP(superslave_io) + MCFG_CPU_CONFIG(superslave_daisy_chain) + + // devices + MCFG_PIC8259_ADD(AM9519_TAG, INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0), VCC, NULL) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_8MHz/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_Z80DART_ADD(Z80DART_0_TAG, XTAL_8MHz/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, ctsa_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, dcdb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, ctsb_w)) + + MCFG_Z80DART_ADD(Z80DART_1_TAG, XTAL_8MHz/2, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_C_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_C_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_C_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_RS232_PORT_ADD(RS232_C_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, dcda_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, ctsa_w)) + + MCFG_RS232_PORT_ADD(RS232_D_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, dcdb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, ctsb_w)) + + MCFG_DEVICE_ADD(BR1941_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(superslave_state, fr_w)) + MCFG_COM8116_FT_HANDLER(WRITELINE(superslave_state, ft_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("128K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( superslv ) +//------------------------------------------------- + +ROM_START( superslv ) + ROM_REGION( 0x800, Z80_TAG, 0 ) + ROM_LOAD( "adcs6_slave_v3.2.bin", 0x000, 0x800, CRC(7f39322d) SHA1(2e9621e09378a1bb6fc05317bb58ae7865e52744) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1983, superslv, 0, 0, superslave, superslave, driver_device, 0, "Advanced Digital Corporation", "Super Slave", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/supracan.c b/src/mame/drivers/supracan.c new file mode 100644 index 00000000000..baf2a4668f1 --- /dev/null +++ b/src/mame/drivers/supracan.c @@ -0,0 +1,1927 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese,Ryan Holtz +/*************************************************************************** + + + Funtech Super A'Can + ------------------- + + Preliminary driver by Angelo Salese + Improvements by Harmony + + +******************************************************************************* + +INFO: + + The system unit contains a reset button. + + Controllers: + - 4 directional buttons + - A, B, X, Y, buttons + - Start, select buttons + - L, R shoulder buttons + +STATUS: + + The driver is begging for a re-write or at least a split into video/supracan.c. It will happen eventually. + + Sound CPU comms and sound chip are completely unknown. + + There are 6 interrupt sources on the 6502 side, all of which use the IRQ line. + The register at 0x411 is bitmapped to indicate what source(s) are active. + In priority order from most to least important, they are: + + 411 value How acked Notes + 0x40 read reg 0x16 of sound chip likely timer. snd regs 0x16/0x17 are time constant, write 0 to reg 0x9f to start + 0x04 read at 0x405 latch 1? 0xcd is magic value + 0x08 read at 0x404 latch 2? 0xcd is magic value + 0x10 read at 0x409 unknown, dispatched but not used in startup 6502 code + 0x20 read at 0x40a possible periodic like vblank? + 0x80 read reg 0x14 of sound chip depends on reg 0x14 of sound chip & 0x40: if not set writes 0x8f to reg 0x14, + otherwise writes 0x4f to reg 0x14 and performs additional processing + + Known unemulated graphical effects and issues: + - All: Sprite sizing is still imperfect. + - All: Sprites need to be converted to use scanline rendering for proper clipping. + - All: Improperly-emulated 1bpp ROZ mode, used by the Super A'Can BIOS logo. + - All: Unimplemented ROZ scaling tables, used by the Super A'Can BIOS logo and Speedy Dragon intro, among others. + - All: Priorities are largely unknown. + - C.U.G.: Gameplay backgrounds are broken. + - Sango Fighter: Possible missing masking on the upper edges of the screen during gameplay. + - Sango Fighter: Raster effects off by 1 line + - Sango Fighter: Specifies tiles out of range of video ram?? + - Speedy Dragon: Backgrounds are broken (wrong tile bank/region). + - Super Taiwanese Baseball League: Does not boot, uses an unemulated DMA type + - Super Taiwanese Baseball League: Missing window effect applied on tilemaps? + - The Son of Evil: Many graphical issues. + - Visible area, looks like it should be 224 pixels high at most, most games need 8 off the top and 8 off the bottom (or a global scroll) + Sango looks like it needs 16 off the bottom instead + Visible area is almost certainly 224 as Son of Evil has an explicit check in the vblank handler + + - All: are ALL the layers ROZ capable?? + +DEBUG TRICKS: + + baseball game debug trick: + wpset e90020,1f,w + do pc=5ac40 + ... + do pc=5acd4 + wpclear + bp 0269E4 + [ff7be4] <- 0x269ec + bpclear + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "cpu/m6502/m6502.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define SOUNDCPU_BOOT_HACK (1) + +#define DRAW_DEBUG_ROZ (0) + +#define DRAW_DEBUG_UNK_SPRITE (0) + +#define DEBUG_PRIORITY (0) +#define DEBUG_PRIORITY_INDEX (0) // 0-3 + +#define VERBOSE_LEVEL (3) + +#define ENABLE_VERBOSE_LOG (1) + +struct acan_dma_regs_t +{ + UINT32 source[2]; + UINT32 dest[2]; + UINT16 count[2]; + UINT16 control[2]; +}; + +struct acan_sprdma_regs_t +{ + UINT32 src; + UINT16 src_inc; + UINT32 dst; + UINT16 dst_inc; + UINT16 count; + UINT16 control; +}; + +class supracan_state : public driver_device +{ +public: + supracan_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_soundcpu(*this, "soundcpu"), + m_cart(*this, "cartslot"), + m_vram(*this, "vram"), + m_soundram(*this, "soundram"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { + m_m6502_reset = 0; + } + + required_device m_maincpu; + required_device m_soundcpu; + required_device m_cart; + + required_shared_ptr m_vram; + required_shared_ptr m_soundram; + + DECLARE_READ16_MEMBER(_68k_soundram_r); + DECLARE_WRITE16_MEMBER(_68k_soundram_w); + DECLARE_READ8_MEMBER(_6502_soundmem_r); + DECLARE_WRITE8_MEMBER(_6502_soundmem_w); + + void dma_w(address_space &space, int offset, UINT16 data, UINT16 mem_mask, int ch); + DECLARE_WRITE16_MEMBER(dma_channel0_w); + DECLARE_WRITE16_MEMBER(dma_channel1_w); + + DECLARE_READ16_MEMBER(sound_r); + DECLARE_WRITE16_MEMBER(sound_w); + DECLARE_READ16_MEMBER(video_r); + DECLARE_WRITE16_MEMBER(video_w); + DECLARE_WRITE16_MEMBER(vram_w); + acan_dma_regs_t m_acan_dma_regs; + acan_sprdma_regs_t m_acan_sprdma_regs; + + UINT16 m_m6502_reset; + UINT8 m_soundlatch; + UINT8 m_soundcpu_irq_src; + UINT8 m_sound_irq_enable_reg; + UINT8 m_sound_irq_source_reg; + UINT8 m_sound_cpu_68k_irq_reg; + + emu_timer *m_video_timer; + emu_timer *m_hbl_timer; + emu_timer *m_line_on_timer; + emu_timer *m_line_off_timer; + + dynamic_buffer m_vram_addr_swapped; + + UINT16 *m_pram; + + UINT16 m_sprite_count; + UINT32 m_sprite_base_addr; + UINT8 m_sprite_flags; + + UINT32 m_tilemap_base_addr[3]; + int m_tilemap_scrollx[3]; + int m_tilemap_scrolly[3]; + UINT16 m_video_flags; + UINT16 m_tilemap_flags[3]; + UINT16 m_tilemap_mode[3]; + UINT16 m_irq_mask; + UINT16 m_hbl_mask; + + UINT32 m_roz_base_addr; + UINT16 m_roz_mode; + UINT32 m_roz_scrollx; + UINT32 m_roz_scrolly; + UINT16 m_roz_tile_bank; + UINT32 m_roz_unk_base0; + UINT32 m_roz_unk_base1; + UINT32 m_roz_unk_base2; + UINT16 m_roz_coeffa; + UINT16 m_roz_coeffb; + UINT16 m_roz_coeffc; + UINT16 m_roz_coeffd; + INT32 m_roz_changed; + INT32 m_roz_cx; + INT32 m_roz_cy; + UINT16 m_unk_1d0; + + UINT16 m_video_regs[256]; + + bool m_hack_68k_to_6502_access; + + tilemap_t *m_tilemap_sizes[4][4]; + bitmap_ind16 m_sprite_final_bitmap; + void write_swapped_byte(int offset, UINT8 byte); + TILE_GET_INFO_MEMBER(get_supracan_tilemap0_tile_info); + TILE_GET_INFO_MEMBER(get_supracan_tilemap1_tile_info); + TILE_GET_INFO_MEMBER(get_supracan_tilemap2_tile_info); + TILE_GET_INFO_MEMBER(get_supracan_roz_tile_info); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(supracan); + UINT32 screen_update_supracan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(supracan_irq); + INTERRUPT_GEN_MEMBER(supracan_sound_irq); + TIMER_CALLBACK_MEMBER(supracan_hbl_callback); + TIMER_CALLBACK_MEMBER(supracan_line_on_callback); + TIMER_CALLBACK_MEMBER(supracan_line_off_callback); + TIMER_CALLBACK_MEMBER(supracan_video_callback); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(supracan_cart); + inline void verboselog(const char *tag, int n_level, const char *s_fmt, ...) ATTR_PRINTF(4,5); + int supracan_tilemap_get_region(int layer); + void supracan_tilemap_get_info_common(int layer, tile_data &tileinfo, int count); + void supracan_tilemap_get_info_roz(int layer, tile_data &tileinfo, int count); + int get_tilemap_dimensions(int &xsize, int &ysize, int layer); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void mark_active_tilemap_all_dirty(int layer); + void supracan_suprnova_draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound/*, int columnscroll, UINT32* scrollram*/, int transmask); + required_device m_gfxdecode; + required_device m_palette; +}; + + + +inline void supracan_state::verboselog(const char *tag, int n_level, const char *s_fmt, ...) +{ +#if ENABLE_VERBOSE_LOG + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%06x: %s: %s", machine().device(tag)->safe_pc(), tag, buf ); + } +#endif +} + +int supracan_state::supracan_tilemap_get_region(int layer) +{ + // HACK!!! + if (layer==2) + { + return 2; + } + + + if (layer==3) + { + // roz layer + + int gfx_mode = (m_roz_mode & 3); + + switch(gfx_mode) + { + case 0: return 4; + case 1: return 2; + case 2: return 1; + case 3: return 0; + } + return 1; + } + else + { + // normal layers + int gfx_mode = (m_tilemap_mode[layer] & 0x7000) >> 12; + + switch(gfx_mode) + { + case 7: return 2; + case 4: return 1; + case 2: return 1; + case 0: return 1; + } + + return 1; + } + +} + +void supracan_state::supracan_tilemap_get_info_common(int layer, tile_data &tileinfo, int count) +{ + UINT16* supracan_vram = m_vram; + + UINT32 base = (m_tilemap_base_addr[layer]); + int gfx_mode = (m_tilemap_mode[layer] & 0x7000) >> 12; + int region = supracan_tilemap_get_region(layer); + + count += base; + + UINT16 tile_bank = 0; + UINT16 palette_bank = 0; + switch(gfx_mode) + { + case 7: + tile_bank = 0x1c00; + palette_bank = 0x00; + break; + + case 6: // gambling lord + tile_bank = 0x0c00; + palette_bank = 0x00; + break; + + case 4: + tile_bank = 0x800; + palette_bank = 0x00; + break; + + case 2: + tile_bank = 0x400; + palette_bank = 0x00; + break; + + case 0: + tile_bank = 0; + palette_bank = 0x00; + break; + + default: + verboselog("maincpu", 0, "Unsupported tilemap mode: %d\n", (m_tilemap_mode[layer] & 0x7000) >> 12); + break; + } + + + if(layer == 2) + { + tile_bank = 0x1000; + } + + int tile = (supracan_vram[count] & 0x03ff) + tile_bank; + int flipxy = (supracan_vram[count] & 0x0c00)>>10; + int palette = ((supracan_vram[count] & 0xf000) >> 12) + palette_bank; + + SET_TILE_INFO_MEMBER(region, tile, palette, TILE_FLIPXY(flipxy)); +} + +// I wonder how different this really is.. my guess, not at all. +void supracan_state::supracan_tilemap_get_info_roz(int layer, tile_data &tileinfo, int count) +{ + UINT16* supracan_vram = m_vram; + + UINT32 base = m_roz_base_addr; + + + int region = 1; + UINT16 tile_bank = 0; + UINT16 palette_bank = 0; + + region = supracan_tilemap_get_region(layer); + + switch(m_roz_mode & 3) //FIXME: fix gfx bpp order + { + case 0: + // hack: case for startup logo + // this isn't understood properly, it's rendering a single 64x64 tile, which for convenience we've rearranged and decoded as 8x8 for the tilemaps + { + int tile = 0x880 + ((count & 7)*2); + // tile += (count & 0x070) >> 2; + + if (count & 0x20) tile ^= 1; + tile |= (count & 0xc0)>>2; + + SET_TILE_INFO_MEMBER(region, tile, 0, 0); + return; + } + + + case 1: + tile_bank = (m_roz_tile_bank & 0xf000) >> 3; + break; + + case 2: + tile_bank = (m_roz_tile_bank & 0xf000) >> 3; + break; + + case 3: + tile_bank = (m_roz_tile_bank & 0xf000) >> 3; + break; + } + + count += base; + + int tile = (supracan_vram[count] & 0x03ff) + tile_bank; + int flipxy = (supracan_vram[count] & 0x0c00)>>10; + int palette = ((supracan_vram[count] & 0xf000) >> 12) + palette_bank; + + SET_TILE_INFO_MEMBER(region, tile, palette, TILE_FLIPXY(flipxy)); +} + + + +TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap0_tile_info) +{ + supracan_tilemap_get_info_common(0, tileinfo, tile_index); +} + +TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap1_tile_info) +{ + supracan_tilemap_get_info_common(1, tileinfo, tile_index); +} + +TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap2_tile_info) +{ + supracan_tilemap_get_info_common(2, tileinfo, tile_index); +} + +TILE_GET_INFO_MEMBER(supracan_state::get_supracan_roz_tile_info) +{ + supracan_tilemap_get_info_roz(3, tileinfo, tile_index); +} + + +void supracan_state::video_start() +{ + m_sprite_final_bitmap.allocate(1024, 1024, BITMAP_FORMAT_IND16); + + m_vram_addr_swapped.resize(0x20000); // hack for 1bpp layer at startup + m_gfxdecode->gfx(4)->set_source(&m_vram_addr_swapped[0]); + m_gfxdecode->gfx(4)->set_xormask(0); + + m_tilemap_sizes[0][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_tilemap_sizes[0][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap_sizes[0][2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); + m_tilemap_sizes[0][3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); + + m_tilemap_sizes[1][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_tilemap_sizes[1][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap_sizes[1][2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); + m_tilemap_sizes[1][3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); + + m_tilemap_sizes[2][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_tilemap_sizes[2][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap_sizes[2][2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); + m_tilemap_sizes[2][3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); + + m_tilemap_sizes[3][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_tilemap_sizes[3][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap_sizes[3][2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); + m_tilemap_sizes[3][3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); +} + +int supracan_state::get_tilemap_dimensions(int &xsize, int &ysize, int layer) +{ + int select; + + xsize = 32; + ysize = 32; + + if (layer==3) select = (m_roz_mode & 0x0f00); + else select = m_tilemap_flags[layer] & 0x0f00; + + switch(select) + { + case 0x600: + xsize = 64; + ysize = 32; + return 1; + + case 0xa00: + xsize = 128; + ysize = 32; + return 2; + + case 0xc00: + xsize = 64; + ysize = 64; + return 3; + + default: + verboselog("maincpu", 0, "Unsupported tilemap size for layer %d: %04x\n", layer, select); + return 0; + } +} + + + + +void supracan_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 *supracan_vram = m_vram; + +// [0] +// -e-- ---- ---- ---- sprite enable? +// ---h hhh- ---- ---- Y size (not always right) +// ---- ---y yyyy yyyy Y position +// [1] +// bbbb ---- ---- ---- Tile bank +// ---- h--- ---- ---- Horizontal flip +// ---- -v-- ---- ---- Vertical flip +// ---- --mm ---- ---- Masking mode +// ---- ---- ---- -www X size +// [2] +// zzzz ---- ---- ---- X scale +// ---- ---x xxxx xxxx X position +// [3] +// d--- ---- ---- ---- Direct Sprite (use details from here, not looked up in vram) +// -ooo oooo oooo oooo Sprite address + + UINT32 skip_count = 0; + UINT32 start_word = (m_sprite_base_addr >> 1) + skip_count * 4; + UINT32 end_word = start_word + (m_sprite_count - skip_count) * 4; + int region = (m_sprite_flags & 1) ? 0 : 1; //8bpp : 4bpp + +// printf("frame\n"); + #define VRAM_MASK (0xffff) + + for(int i = start_word; i < end_word; i += 4) + { + int x = supracan_vram[i+2] & 0x01ff; + int y = supracan_vram[i+0] & 0x01ff; + + int sprite_offset = (supracan_vram[i+3])<< 1; + + int bank = (supracan_vram[i+1] & 0xf000) >> 12; + //int mask = (supracan_vram[i+1] & 0x0300) >> 8; + int sprite_xflip = (supracan_vram[i+1] & 0x0800) >> 11; + int sprite_yflip = (supracan_vram[i+1] & 0x0400) >> 10; + //int xscale = (supracan_vram[i+2] & 0xf000) >> 12; + gfx_element *gfx = m_gfxdecode->gfx(region); + + + + + // wraparound + if (y>=0x180) y-=0x200; + if (x>=0x180) x-=0x200; + + if((supracan_vram[i+0] & 0x4000)) + { + #if 0 + printf("%d (unk %02x) (enable %02x) (unk Y2 %02x, %02x) (y pos %02x) (bank %01x) (flip %01x) (unknown %02x) (x size %02x) (xscale %01x) (unk %01x) (xpos %02x) (code %04x)\n", i, + (supracan_vram[i+0] & 0x8000) >> 15, + (supracan_vram[i+0] & 0x4000) >> 14, + (supracan_vram[i+0] & 0x2000) >> 13, + (supracan_vram[i+0] & 0x1e00) >> 8, + (supracan_vram[i+0] & 0x01ff), + (supracan_vram[i+1] & 0xf000) >> 12, + (supracan_vram[i+1] & 0x0c00) >> 10, + (supracan_vram[i+1] & 0x03f0) >> 4, + (supracan_vram[i+1] & 0x000f), + (supracan_vram[i+2] & 0xf000) >> 12, + (supracan_vram[i+2] & 0x0e00) >> 8, + (supracan_vram[i+2] & 0x01ff) >> 0, + (supracan_vram[i+3] & 0xffff)); + #endif + + + if (supracan_vram[i+3] &0x8000) + { + UINT16 data = supracan_vram[i+3]; + int tile = (bank * 0x200) + (data & 0x03ff); + + int palette = (data & 0xf000) >> 12; // this might not be correct, due to the &0x8000 condition above this would force all single tile sprites to be using palette >=0x8 only + + //printf("sprite data %04x %04x %04x %04x\n", supracan_vram[i+0] , supracan_vram[i+1] , supracan_vram[i+2] ,supracan_vram[i+3] ); + + gfx->transpen(bitmap,cliprect,tile,palette,sprite_xflip,sprite_yflip, + x, + y, + 0); + + } + else + { + int xsize = 1 << (supracan_vram[i+1] & 7); + int ysize = ((supracan_vram[i+0] & 0x1e00) >> 9) + 1; + + // I think the xsize must influence the ysize somehow, there are too many conflicting cases otherwise + // there don't appear to be any special markers in the actual looked up tile data to indicate skip / end of list + + for(int ytile = 0; ytile < ysize; ytile++) + { + for(int xtile = 0; xtile< xsize; xtile++) + { + UINT16 data = supracan_vram[(sprite_offset+ytile*xsize+xtile)&VRAM_MASK]; + int tile = (bank * 0x200) + (data & 0x03ff); + int palette = (data & 0xf000) >> 12; + + int xpos, ypos; + + if (!sprite_yflip) + { + ypos = y + ytile*8; + } + else + { + ypos = y - (ytile+1)*8; + ypos += ysize*8; + } + + if (!sprite_xflip) + { + xpos = x + xtile*8; + } + else + { + xpos = x - (xtile+1)*8; + xpos += xsize*8; + } + + int tile_xflip = sprite_xflip ^ ((data & 0x0800)>>11); + int tile_yflip = sprite_yflip ^ ((data & 0x0400)>>10); + + gfx->transpen(bitmap,cliprect,tile,palette,tile_xflip,tile_yflip,xpos,ypos,0); + } + } + } + +#if 0 + if(xscale == 0) continue; + UINT32 delta = (1 << 17) / xscale; + for(int sy = 0; sy < ysize*8; sy++) + { + UINT16 *src = &sprite_bitmap->pix16(sy); + UINT16 *dst = &bitmap.pix16(y + sy); + UINT32 dx = x << 16; + for(int sx = 0; sx < xsize*8; sx++) + { + dst[dx >> 16] = src[sx]; + dx += delta; + } + } +#endif + + } + } +} + + + +void supracan_state::mark_active_tilemap_all_dirty(int layer) +{ + int xsize = 0; + int ysize = 0; + + int which_tilemap_size; + + which_tilemap_size = get_tilemap_dimensions(xsize, ysize, layer); +// for (int i=0;i<4;i++) +// tilemap_mark_all_tiles_dirty(m_tilemap_sizes[layer][i]); + m_tilemap_sizes[layer][which_tilemap_size]->mark_all_dirty(); +} + + + +/* draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap */ +void supracan_state::supracan_suprnova_draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound/*, int columnscroll, UINT32* scrollram*/, int transmask) +{ + //bitmap_ind16 *destbitmap = bitmap; + bitmap_ind16 &srcbitmap = tmap->pixmap(); + //bitmap_ind16 &srcbitmapflags = tmap->flagsmap(); + const int xmask = srcbitmap.width()-1; + const int ymask = srcbitmap.height()-1; + const int widthshifted = srcbitmap.width() << 16; + const int heightshifted = srcbitmap.height() << 16; + UINT32 cx; + UINT32 cy; + int x; + int sx; + int sy; + int ex; + int ey; + UINT16 *dest; +// UINT8* destflags; +// UINT8 *pri; + //const UINT16 *src; + //const UINT8 *maskptr; + //int destadvance = destbitmap->bpp / 8; + + /* pre-advance based on the cliprect */ + startx += cliprect.min_x * incxx + cliprect.min_y * incyx; + starty += cliprect.min_x * incxy + cliprect.min_y * incyy; + + /* extract start/end points */ + sx = cliprect.min_x; + sy = cliprect.min_y; + ex = cliprect.max_x; + ey = cliprect.max_y; + + { + /* loop over rows */ + while (sy <= ey) + { + /* initialize X counters */ + x = sx; + cx = startx; + cy = starty; + + /* get dest and priority pointers */ + dest = &bitmap.pix16(sy, sx); + //destflags = &bitmapflags->pix8(sy, sx); + + /* loop over columns */ + while (x <= ex) + { + if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. + { + #if 0 + if (columnscroll) + { + int scroll = 0;//scrollram[(cx>>16)&0x3ff]); + + + UINT16 data = &srcbitmap.pix16( + ((cy >> 16) - scroll) & ymask, + (cx >> 16) & xmask)[0]; + + if ((data & transmask)!=0) + dest[0] = data; + + //destflags[0] = &srcbitmapflags.pix8(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask)[0]; + } + else + #endif + { + int scroll = 0;//scrollram[(cy>>16)&0x3ff]); + UINT16 data = srcbitmap.pix16( + (cy >> 16) & ymask, + ((cx >> 16) - scroll) & xmask); + + + if ((data & transmask)!=0) + dest[0] = data; + + //destflags[0] = &srcbitmapflags.pix8((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask)[0]; + } + } + + /* advance in X */ + cx += incxx; + cy += incxy; + x++; + dest++; +// destflags++; +// pri++; + } + + /* advance in Y */ + startx += incyx; + starty += incyy; + sy++; + } + } +} + + +// VIDEO FLAGS ROZ MODE TILEMAP FLAGS +// +// Bit Bit Bit +// 15-9: Unknown 15-13: Priority? 15-13: Priority? +// 8: X ht. (256/320) 12: Unknown 12: Unknown +// 7: Tilemap 0 enable 11-8: Dims 11-8: Dims +// 6: Tilemap 1 enable 7-6: Unknown 7-6: Unknown +// 5: Tilemap 2 enable? 5: Wrap 5: Wrap +// 3: Sprite enable 4-2: Unknown 4-2: Mosaic +// 2: ROZ enable 1-0: Bit Depth 1-0: Bit Depth +// 1-0: Unknown + +// Video Flags ROZ Mode Tilemap 0 Tilemap 1 Tilemap 2 VF Unk0 +// A'Can logo: 120e: 0001 0010 0000 1110 4020: 0100 0000 0010 0000 4620 ---- ---- 0x09 +// Boomzoo Intro: 9a82: 1001 1010 1000 0010 0402: 0000 0100 0000 0010 6400 6400 4400 0x4d +// Boomzoo Title: 9acc: 1001 1010 1100 1100 0402: 0000 0100 0000 0010 6400 6400 4400 0x4d +// C.U.G. Intro: 11c8: 0001 0001 1100 1000 0402: 0000 0100 0000 0010 2400 4400 6400 0x08 +// C.U.G. Title: 11cc: 0001 0001 1100 1100 0602: 0000 0110 0000 0010 2600 4600 ---- 0x08 +// Speedy Dragon Logo: 0388: 0000 0011 1000 1000 4020: 0100 0000 0010 0000 6c20 6c20 2600 0x01 +// Speedy Dragon Title: 038c: 0000 0011 1000 1100 2603: 0010 0110 0000 0011 6c20 2c20 2600 0x01 +// Sango Fighter Intro: 03c8: 0000 0011 1100 1000 ----: ---- ---- ---- ---- 6c20 4620 ---- 0x01 +// Sango Fighter Game: 03ce: 0000 0011 1100 1110 0622: 0000 0110 0010 0010 2620 4620 ---- 0x01 + +UINT32 supracan_state::screen_update_supracan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // treat the sprites as frame-buffered and only update the buffer when drawing scanline 0 - this might not be true! + + if (0) + { + if (cliprect.min_y == 0x00) + { + const rectangle &visarea = screen.visible_area(); + + m_sprite_final_bitmap.fill(0x00, visarea); + bitmap.fill(0x80, visarea); + + draw_sprites( m_sprite_final_bitmap, visarea); + } + } + else + { + m_sprite_final_bitmap.fill(0x00, cliprect); + bitmap.fill(0x80, cliprect); + + draw_sprites(m_sprite_final_bitmap, cliprect); + } + + + + // mix screen + int xsize = 0, ysize = 0; +// int tilemap_num; + int which_tilemap_size; + int priority = 0; + + + for (int pri=7;pri>=0;pri--) + { + for (int layer = 3; layer >=0; layer--) + { + // popmessage("%04x\n",m_video_flags); + int enabled = 0; + + if(m_video_flags & 0x04) + if (layer==3) enabled = 1; + + if(m_video_flags & 0x80) + if (layer==0) enabled = 1; + + if(m_video_flags & 0x40) + if (layer==1) enabled = 1; + + if(m_video_flags & 0x20) + if (layer==2) enabled = 1; + + + if (layer==3) priority = ((m_roz_mode >> 13) & 7); // roz case + else priority = ((m_tilemap_flags[layer] >> 13) & 7); // normal cases + + + if (priority==pri) + { +// tilemap_num = layer; + which_tilemap_size = get_tilemap_dimensions(xsize, ysize, layer); + bitmap_ind16 &src_bitmap = m_tilemap_sizes[layer][which_tilemap_size]->pixmap(); + int gfx_region = supracan_tilemap_get_region(layer); + int transmask = 0xff; + + switch (gfx_region) + { + case 0:transmask = 0xff; break; + case 1:transmask = 0x0f; break; + case 2:transmask = 0x03; break; + case 3:transmask = 0x01; break; + case 4:transmask = 0x01; break; + } + + if (enabled) + { + if (layer != 3) // standard layers, NOT roz + { + int wrap = (m_tilemap_flags[layer] & 0x20); + + int scrollx = m_tilemap_scrollx[layer]; + int scrolly = m_tilemap_scrolly[layer]; + + if (scrollx&0x8000) scrollx-= 0x10000; + if (scrolly&0x8000) scrolly-= 0x10000; + + int mosaic_count = (m_tilemap_flags[layer] & 0x001c) >> 2; + int mosaic_mask = 0xffffffff << mosaic_count; + + int y,x; + // yes, it will draw a single line if you specify a cliprect as such (partial updates...) + + for (y=cliprect.min_y;y<=cliprect.max_y;y++) + { + // these will have to change to ADDR32 etc. once alpha blending is supported + UINT16* screen = &bitmap.pix16(y); + + int actualy = y&mosaic_mask; + + int realy = actualy+scrolly; + + if (!wrap) + if (scrolly+y < 0 || scrolly+y > ((ysize*8)-1)) + continue; + + + UINT16* src = &src_bitmap.pix16((realy)&((ysize*8)-1)); + + for (x=cliprect.min_x;x<=cliprect.max_x;x++) + { + int actualx = x & mosaic_mask; + int realx = actualx+scrollx; + + if (!wrap) + if (scrollx+x < 0 || scrollx+x > ((xsize*8)-1)) + continue; + + UINT16 srcpix = src[(realx)&((xsize*8)-1)]; + + if ((srcpix & transmask) != 0) + screen[x] = srcpix; + } + } + } + else + { + int wrap = m_roz_mode & 0x20; + + int incxx = (m_roz_coeffa); + int incyy = (m_roz_coeffd); + + int incxy = (m_roz_coeffc); + int incyx = (m_roz_coeffb); + + int scrollx = (m_roz_scrollx); + int scrolly = (m_roz_scrolly); + + + + + + + if (incyx & 0x8000) incyx -= 0x10000; + if (incxy & 0x8000) incxy -= 0x10000; + + if (incyy & 0x8000) incyy -= 0x10000; + if (incxx & 0x8000) incxx -= 0x10000; + + //popmessage("%04x %04x\n",m_video_flags, m_roz_mode); + + // roz mode.. + //4020 = enabled speedyd + //6c22 = enabled speedyd + //2c22 = enabled speedyd + //4622 = disabled jttlaugh + //2602 = disabled monopoly + //0402 = disabled (sango title) + // or is it always enabled, and only corrupt because we don't clear ram properly? + // (probably not this register?) + + if (!(m_roz_mode & 0x0200) && (m_roz_mode&0xf000) ) // HACK - Not Trusted, Acan Logo, Speedy Dragon Intro ,Speed Dragon Bonus stage need it. Monopoly and JTT *don't* causes graphical issues + { + // NOT accurate, causes issues when the attract mode loops and the logo is shown the 2nd time in some games - investigate + for (int y=cliprect.min_y;y<=cliprect.max_y;y++) + { + rectangle clip(cliprect.min_x, cliprect.max_x, y, y); + + scrollx = (m_roz_scrollx); + scrolly = (m_roz_scrolly); + incxx = (m_roz_coeffa); + + incxx += m_vram[m_roz_unk_base0/2 + y]; + + scrollx += m_vram[m_roz_unk_base1/2 + y*2] << 16; + scrollx += m_vram[m_roz_unk_base1/2 + y*2 + 1]; + + scrolly += m_vram[m_roz_unk_base2/2 + y*2] << 16; + scrolly += m_vram[m_roz_unk_base2/2 + y*2 + 1]; + + if (incxx & 0x8000) incxx -= 0x10000; + + + if (m_vram[m_roz_unk_base0/2 + y]) // incxx = 0, no draw? + supracan_suprnova_draw_roz(bitmap, clip, m_tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask); + } + } + else + { + supracan_suprnova_draw_roz(bitmap, cliprect, m_tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask); + } + } + } + } + } + } + + + // just draw the sprites on top for now + if(m_video_flags & 0x08) + { + for (int y=cliprect.min_y;y<=cliprect.max_y;y++) + { + UINT16* src = &m_sprite_final_bitmap.pix16(y); + UINT16* dst = &bitmap.pix16(y); + + for (int x=cliprect.min_x;x<=cliprect.max_x;x++) + { + UINT16 dat = src[x]; + if (dat) dst[x] = dat; + } + } + } + + return 0; +} + + +void supracan_state::dma_w(address_space &space, int offset, UINT16 data, UINT16 mem_mask, int ch) +{ + acan_dma_regs_t *acan_dma_regs = &m_acan_dma_regs; + address_space &mem = m_maincpu->space(AS_PROGRAM); + + switch(offset) + { + case 0x00/2: // Source address MSW + verboselog("maincpu", 0, "dma_w: source msw %d: %04x\n", ch, data); + acan_dma_regs->source[ch] &= 0x0000ffff; + acan_dma_regs->source[ch] |= data << 16; + break; + case 0x02/2: // Source address LSW + verboselog("maincpu", 0, "dma_w: source lsw %d: %04x\n", ch, data); + acan_dma_regs->source[ch] &= 0xffff0000; + acan_dma_regs->source[ch] |= data; + break; + case 0x04/2: // Destination address MSW + verboselog("maincpu", 0, "dma_w: dest msw %d: %04x\n", ch, data); + acan_dma_regs->dest[ch] &= 0x0000ffff; + acan_dma_regs->dest[ch] |= data << 16; + break; + case 0x06/2: // Destination address LSW + verboselog("maincpu", 0, "dma_w: dest lsw %d: %04x\n", ch, data); + acan_dma_regs->dest[ch] &= 0xffff0000; + acan_dma_regs->dest[ch] |= data; + break; + case 0x08/2: // Byte count + verboselog("maincpu", 0, "dma_w: count %d: %04x\n", ch, data); + acan_dma_regs->count[ch] = data; + break; + case 0x0a/2: // Control + verboselog("maincpu", 0, "dma_w: control %d: %04x\n", ch, data); + if(data & 0x8800) + { +// if(data & 0x2000) +// acan_dma_regs->source-=2; + logerror("dma_w: Kicking off a DMA from %08x to %08x, %d bytes (%04x)\n", acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1, data); + + for(int i = 0; i <= acan_dma_regs->count[ch]; i++) + { + if(data & 0x1000) + { + mem.write_word(acan_dma_regs->dest[ch], mem.read_word(acan_dma_regs->source[ch])); + acan_dma_regs->dest[ch]+=2; + acan_dma_regs->source[ch]+=2; + if(data & 0x0100) + if((acan_dma_regs->dest[ch] & 0xf) == 0) + acan_dma_regs->dest[ch]-=0x10; + } + else + { + mem.write_byte(acan_dma_regs->dest[ch], mem.read_byte(acan_dma_regs->source[ch])); + acan_dma_regs->dest[ch]++; + acan_dma_regs->source[ch]++; + } + } + } + else if(data != 0x0000) // fake DMA, used by C.U.G. + { + verboselog("maincpu", 0, "dma_w: Unknown DMA kickoff value of %04x (other regs %08x, %08x, %d)\n", data, acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1); + fatalerror("dma_w: Unknown DMA kickoff value of %04x (other regs %08x, %08x, %d)\n",data, acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1); + } + break; + default: + verboselog("maincpu", 0, "dma_w: Unknown register: %08x = %04x & %04x\n", 0xe90020 + (offset << 1), data, mem_mask); + break; + } +} + +WRITE16_MEMBER( supracan_state::dma_channel0_w ) +{ + dma_w(space, offset, data, mem_mask, 0); +} + +WRITE16_MEMBER( supracan_state::dma_channel1_w ) +{ + dma_w(space, offset, data, mem_mask, 1); +} + + +#if 0 +WRITE16_MEMBER( supracan_state::supracan_pram_w ) +{ + m_pram[offset] &= ~mem_mask; + m_pram[offset] |= data & mem_mask; +} +#endif + +// swap address around so that 64x64 tile can be decoded as 8x8 tiles.. +void supracan_state::write_swapped_byte( int offset, UINT8 byte ) +{ + int swapped_offset = BITSWAP32(offset, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,2,1,0,6,5,4,3); + + m_vram_addr_swapped[swapped_offset] = byte; +} + +WRITE16_MEMBER( supracan_state::vram_w ) +{ + COMBINE_DATA(&m_vram[offset]); + + // hack for 1bpp layer at startup + write_swapped_byte(offset*2, (data & 0xff00)>>8); + write_swapped_byte(offset*2+1, (data & 0x00ff)); + + // mark tiles of each depth as dirty + m_gfxdecode->gfx(0)->mark_dirty((offset*2)/(64)); + m_gfxdecode->gfx(1)->mark_dirty((offset*2)/(32)); + m_gfxdecode->gfx(2)->mark_dirty((offset*2)/(16)); + m_gfxdecode->gfx(3)->mark_dirty((offset*2)/(512)); + m_gfxdecode->gfx(4)->mark_dirty((offset*2)/(8)); + +} + +static ADDRESS_MAP_START( supracan_mem, AS_PROGRAM, 16, supracan_state ) + //AM_RANGE( 0x000000, 0x3fffff ) // mapped by the cartslot + AM_RANGE( 0xe80200, 0xe80201 ) AM_READ_PORT("P1") + AM_RANGE( 0xe80202, 0xe80203 ) AM_READ_PORT("P2") + AM_RANGE( 0xe80208, 0xe80209 ) AM_READ_PORT("P3") + AM_RANGE( 0xe8020c, 0xe8020d ) AM_READ_PORT("P4") + AM_RANGE( 0xe80000, 0xe8ffff ) AM_READWRITE(_68k_soundram_r, _68k_soundram_w) + AM_RANGE( 0xe90000, 0xe9001f ) AM_READWRITE(sound_r, sound_w) + AM_RANGE( 0xe90020, 0xe9002f ) AM_WRITE(dma_channel0_w) + AM_RANGE( 0xe90030, 0xe9003f ) AM_WRITE(dma_channel1_w) + + AM_RANGE( 0xf00000, 0xf001ff ) AM_READWRITE(video_r, video_w) + AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") + AM_RANGE( 0xf40000, 0xf5ffff ) AM_RAM_WRITE(vram_w) AM_SHARE("vram") + AM_RANGE( 0xfc0000, 0xfdffff ) AM_MIRROR(0x30000) AM_RAM /* System work ram */ +ADDRESS_MAP_END + +READ8_MEMBER( supracan_state::_6502_soundmem_r ) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + UINT8 data = m_soundram[offset]; + + switch(offset) + { +#if SOUNDCPU_BOOT_HACK + case 0x300: // HACK to make games think the sound CPU is always reporting 'OK'. + return 0xff; +#endif + + case 0x410: // Sound IRQ enable + data = m_sound_irq_enable_reg; + if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_r: IRQ enable: %04x\n", data); + if(!mem.debugger_access()) + { + if(m_sound_irq_enable_reg & m_sound_irq_source_reg) + { + m_soundcpu->set_input_line(0, ASSERT_LINE); + } + else + { + m_soundcpu->set_input_line(0, CLEAR_LINE); + } + } + break; + case 0x411: // Sound IRQ source + data = m_sound_irq_source_reg; + m_sound_irq_source_reg = 0; + if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: IRQ source: %04x\n", data); + if(!mem.debugger_access()) + { + m_soundcpu->set_input_line(0, CLEAR_LINE); + } + break; + case 0x420: + if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: Sound hardware status? (not yet implemented): %02x\n", 0); + break; + case 0x422: + if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: Sound hardware data? (not yet implemented): %02x\n", 0); + break; + case 0x404: + case 0x405: + case 0x409: + case 0x414: + case 0x416: + // Intentional fall-through + default: + if(offset >= 0x300 && offset < 0x500) + { + if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_r: Unknown register %04x\n", offset); + } + break; + } + + return data; +} + +WRITE8_MEMBER( supracan_state::_6502_soundmem_w ) +{ + switch(offset) + { + case 0x407: + if(m_sound_cpu_68k_irq_reg &~ data) + { + verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: sound_cpu_68k_irq_reg: %04x: Triggering M68k IRQ\n", data); + m_maincpu->set_input_line(7, HOLD_LINE); + } + else + { + verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: sound_cpu_68k_irq_reg: %04x\n", data); + } + m_sound_cpu_68k_irq_reg = data; + break; + case 0x410: + m_sound_irq_enable_reg = data; + verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: IRQ enable: %02x\n", data); + break; + case 0x420: + verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_w: Sound hardware reg data? (not yet implemented): %02x\n", data); + break; + case 0x422: + verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_w: Sound hardware reg addr? (not yet implemented): %02x\n", data); + break; + default: + if(offset >= 0x300 && offset < 0x500) + { + verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: Unknown register %04x = %02x\n", offset, data); + } + m_soundram[offset] = data; + break; + } +} + +static ADDRESS_MAP_START( supracan_sound_mem, AS_PROGRAM, 8, supracan_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(_6502_soundmem_r, _6502_soundmem_w) AM_SHARE("soundram") +ADDRESS_MAP_END + +static INPUT_PORTS_START( supracan ) + PORT_START("P1") + PORT_DIPNAME( 0x01, 0x00, "SYSTEM" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Button R") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Button L") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Button Y") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Button X") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Right") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Left") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Down") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Up") + PORT_DIPNAME( 0x1000, 0x0000, "SYSTEM" ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( On ) ) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START1 ) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Button B") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Button A") + + PORT_START("P2") + PORT_DIPNAME( 0x01, 0x00, "SYSTEM" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Button R") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Button L") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Button Y") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Button X") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Right") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Left") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Down") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Up") + PORT_DIPNAME( 0x1000, 0x0000, "SYSTEM" ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( On ) ) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START2 ) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Button B") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Button A") + + PORT_START("P3") + PORT_DIPNAME( 0x01, 0x00, "SYSTEM" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(3) PORT_NAME("P3 Button R") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(3) PORT_NAME("P3 Button L") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(3) PORT_NAME("P3 Button Y") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 Button X") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Right") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Left") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Down") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Up") + PORT_DIPNAME( 0x1000, 0x0000, "SYSTEM" ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( On ) ) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START3 ) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 Button B") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 Button A") + + PORT_START("P4") + PORT_DIPNAME( 0x01, 0x00, "SYSTEM" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(4) PORT_NAME("P4 Button R") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(4) PORT_NAME("P4 Button L") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(4) PORT_NAME("P4 Button Y") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 Button X") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Right") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Left") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Down") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Up") + PORT_DIPNAME( 0x1000, 0x0000, "SYSTEM" ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( On ) ) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START4 ) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 Button B") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 Button A") +INPUT_PORTS_END + +PALETTE_INIT_MEMBER(supracan_state, supracan) +{ + // Used for debugging purposes for now + //#if 0 + int i, r, g, b; + + for( i = 0; i < 32768; i++ ) + { + r = (i & 0x1f) << 3; + g = ((i >> 5) & 0x1f) << 3; + b = ((i >> 10) & 0x1f) << 3; + palette.set_pen_color( i, r, g, b ); + } + //#endif +} + +WRITE16_MEMBER( supracan_state::_68k_soundram_w ) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + m_soundram[offset*2 + 1] = data & 0xff; + m_soundram[offset*2 + 0] = data >> 8; + + if(offset*2 < 0x500 && offset*2 >= 0x300) + { + if(mem_mask & 0xff00) + { + m_hack_68k_to_6502_access = true; + _6502_soundmem_w(mem, offset*2, data >> 8); + m_hack_68k_to_6502_access = false; + } + if(mem_mask & 0x00ff) + { + m_hack_68k_to_6502_access = true; + _6502_soundmem_w(mem, offset*2 + 1, data & 0xff); + m_hack_68k_to_6502_access = false; + } + } +} + +READ16_MEMBER( supracan_state::_68k_soundram_r ) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + UINT16 val = m_soundram[offset*2 + 0] << 8; + val |= m_soundram[offset*2 + 1]; + + if(offset*2 >= 0x300 && offset*2 < 0x500) + { + val = 0; + if(mem_mask & 0xff00) + { + m_hack_68k_to_6502_access = true; + val |= _6502_soundmem_r(mem, offset*2) << 8; + m_hack_68k_to_6502_access = false; + } + if(mem_mask & 0x00ff) + { + m_hack_68k_to_6502_access = true; + val |= _6502_soundmem_r(mem, offset*2 + 1); + m_hack_68k_to_6502_access = false; + } + } + + return val; +} + +READ16_MEMBER( supracan_state::sound_r ) +{ + UINT16 data = 0; + + switch( offset ) + { + default: + verboselog("maincpu", 0, "sound_r: Unknown register: (%08x) & %04x\n", 0xe90000 + (offset << 1), mem_mask); + break; + } + + return data; +} + +WRITE16_MEMBER( supracan_state::sound_w ) +{ + switch ( offset ) + { + case 0x000a/2: /* Sound cpu IRQ request. */ + m_soundcpu->set_input_line(0, ASSERT_LINE); + break; + case 0x001c/2: /* Sound cpu control. Bit 0 tied to sound cpu RESET line */ + if(data & 0x01) + { + if(!m_m6502_reset) + { + /* Reset and enable the sound cpu */ +#if !(SOUNDCPU_BOOT_HACK) + m_soundcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_soundcpu->reset(); +#endif + } + m_m6502_reset = data & 0x01; + } + else + { + /* Halt the sound cpu */ + m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + } + verboselog("maincpu", 0, "sound cpu ctrl: %04x\n", data); + break; + default: + verboselog("maincpu", 0, "sound_w: Unknown register: %08x = %04x & %04x\n", 0xe90000 + (offset << 1), data, mem_mask); + break; + } +} + + +READ16_MEMBER( supracan_state::video_r ) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + UINT16 data = m_video_regs[offset]; + + switch(offset) + { + case 0x00/2: // Video IRQ flags + if(!mem.debugger_access()) + { + //verboselog("maincpu", 0, "read video IRQ flags (%04x)\n", data); + m_maincpu->set_input_line(7, CLEAR_LINE); + } + break; + case 0x02/2: // Current scanline + break; + case 0x08/2: // Unknown (not video flags!) - gambling lord disagrees, it MUST read back what it wrote because it reads it before turning on/off layers and writes it back + //data = 0; + break; + case 0x100/2: + if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_flags[0] (%04x)\n", data); + break; + case 0x106/2: + if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_scrolly[0] (%04x)\n", data); + break; + case 0x120/2: + if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_flags[1] (%04x)\n", data); + break; + default: + if(!mem.debugger_access()) verboselog("maincpu", 0, "video_r: Unknown register: %08x (%04x & %04x)\n", 0xf00000 + (offset << 1), data, mem_mask); + break; + } + + return data; +} + +TIMER_CALLBACK_MEMBER(supracan_state::supracan_hbl_callback) +{ + m_maincpu->set_input_line(3, HOLD_LINE); + + m_hbl_timer->adjust(attotime::never); +} + +TIMER_CALLBACK_MEMBER(supracan_state::supracan_line_on_callback) +{ + m_maincpu->set_input_line(5, HOLD_LINE); + + m_line_on_timer->adjust(attotime::never); +} + +TIMER_CALLBACK_MEMBER(supracan_state::supracan_line_off_callback) +{ + m_maincpu->set_input_line(5, CLEAR_LINE); + + m_line_on_timer->adjust(attotime::never); +} + +TIMER_CALLBACK_MEMBER(supracan_state::supracan_video_callback) +{ + int vpos = machine().first_screen()->vpos(); + + m_video_regs[0] &= ~0x0002; + + switch( vpos ) + { + case 0: + m_video_regs[0] &= 0x7fff; + + // we really need better management of this + mark_active_tilemap_all_dirty(0); + mark_active_tilemap_all_dirty(1); + mark_active_tilemap_all_dirty(2); + mark_active_tilemap_all_dirty(3); + + + break; + + case 224://FIXME: Son of Evil is pretty picky about this one, a timing of 240 makes it to crash + m_video_regs[0] |= 0x8000; + break; + + case 240: + if(m_irq_mask & 1) + { + verboselog("maincpu", 0, "Triggering VBL IRQ\n\n"); + m_maincpu->set_input_line(7, HOLD_LINE); + } + break; + } + + m_video_regs[1] = machine().first_screen()->vpos()-16; // for son of evil, wants vblank active around 224 instead... + + m_hbl_timer->adjust( machine().first_screen()->time_until_pos( vpos, 320 ) ); + m_video_timer->adjust( machine().first_screen()->time_until_pos( ( vpos + 1 ) % 256, 0 ) ); +} + +WRITE16_MEMBER( supracan_state::video_w ) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + acan_sprdma_regs_t *acan_sprdma_regs = &m_acan_sprdma_regs; + int i; + + // if any of this changes we need a partial update (see sango fighters intro) + machine().first_screen()->update_partial(machine().first_screen()->vpos()); + + COMBINE_DATA(&m_video_regs[offset]); + data = m_video_regs[offset]; + + switch(offset) + { + case 0x10/2: // Byte count + verboselog("maincpu", 0, "sprite dma word count: %04x\n", data); + acan_sprdma_regs->count = data; + break; + case 0x12/2: // Destination address MSW + acan_sprdma_regs->dst &= 0x0000ffff; + acan_sprdma_regs->dst |= data << 16; + verboselog("maincpu", 0, "sprite dma dest msw: %04x\n", data); + break; + case 0x14/2: // Destination address LSW + acan_sprdma_regs->dst &= 0xffff0000; + acan_sprdma_regs->dst |= data; + verboselog("maincpu", 0, "sprite dma dest lsw: %04x\n", data); + break; + case 0x16/2: // Source word increment + verboselog("maincpu", 0, "sprite dma dest word inc: %04x\n", data); + acan_sprdma_regs->dst_inc = data; + break; + case 0x18/2: // Source address MSW + acan_sprdma_regs->src &= 0x0000ffff; + acan_sprdma_regs->src |= data << 16; + verboselog("maincpu", 0, "sprite dma src msw: %04x\n", data); + break; + case 0x1a/2: // Source address LSW + verboselog("maincpu", 0, "sprite dma src lsw: %04x\n", data); + acan_sprdma_regs->src &= 0xffff0000; + acan_sprdma_regs->src |= data; + break; + case 0x1c/2: // Source word increment + verboselog("maincpu", 0, "sprite dma src word inc: %04x\n", data); + acan_sprdma_regs->src_inc = data; + break; + case 0x1e/2: + logerror( "video_w: Kicking off a DMA from %08x to %08x, %d bytes (%04x)\n", acan_sprdma_regs->src, acan_sprdma_regs->dst, acan_sprdma_regs->count, data); + + /* TODO: what's 0x2000 and 0x4000 for? */ + if(data & 0x8000) + { + if(data & 0x2000 || data & 0x4000) + { + acan_sprdma_regs->dst |= 0xf40000; + } + + if(data & 0x2000) + { + //acan_sprdma_regs->count <<= 1; + } + + for(i = 0; i <= acan_sprdma_regs->count; i++) + { + if(data & 0x0100) //dma 0x00 fill (or fixed value?) + { + mem.write_word(acan_sprdma_regs->dst, 0); + acan_sprdma_regs->dst+=2 * acan_sprdma_regs->dst_inc; + //memset(supracan_vram,0x00,0x020000); + } + else + { + mem.write_word(acan_sprdma_regs->dst, mem.read_word(acan_sprdma_regs->src)); + acan_sprdma_regs->dst+=2 * acan_sprdma_regs->dst_inc; + acan_sprdma_regs->src+=2 * acan_sprdma_regs->src_inc; + } + } + } + else + { + verboselog("maincpu", 0, "dma_w: Attempting to kick off a DMA without bit 15 set! (%04x)\n", data); + } + break; + case 0x08/2: + { + verboselog("maincpu", 3, "video_flags = %04x\n", data); + m_video_flags = data; + + rectangle visarea = machine().first_screen()->visible_area(); + + visarea.set(0, ((m_video_flags & 0x100) ? 320 : 256) - 1, 8, 232 - 1); + machine().first_screen()->configure(348, 256, visarea, machine().first_screen()->frame_period().attoseconds()); + } + break; + case 0x0a/2: + { + // raster interrupt + verboselog("maincpu", 0, "IRQ Trigger? = %04x\n", data); + if(data & 0x8000) + { + m_line_on_timer->adjust(machine().first_screen()->time_until_pos((data & 0x00ff), 0)); + } + else + { + m_line_on_timer->adjust(attotime::never); + } + } + break; + + case 0x0c/2: + { + verboselog("maincpu", 0, "IRQ De-Trigger? = %04x\n", data); + if(data & 0x8000) + { + m_line_off_timer->adjust(machine().first_screen()->time_until_pos(data & 0x00ff, 0)); + } + else + { + m_line_off_timer->adjust(attotime::never); + } + } + break; + + /* Sprites */ + case 0x20/2: m_sprite_base_addr = data << 2; verboselog("maincpu", 0, "sprite_base_addr = %04x\n", data); break; + case 0x22/2: m_sprite_count = data+1; verboselog("maincpu", 0, "sprite_count = %d\n", data+1); break; + case 0x26/2: m_sprite_flags = data; verboselog("maincpu", 0, "sprite_flags = %04x\n", data); break; + + /* Tilemap 0 */ + case 0x100/2: m_tilemap_flags[0] = data; verboselog("maincpu", 3, "tilemap_flags[0] = %04x\n", data); break; + case 0x104/2: m_tilemap_scrollx[0] = data; verboselog("maincpu", 3, "tilemap_scrollx[0] = %04x\n", data); break; + case 0x106/2: m_tilemap_scrolly[0] = data; verboselog("maincpu", 3, "tilemap_scrolly[0] = %04x\n", data); break; + case 0x108/2: m_tilemap_base_addr[0] = (data) << 1; verboselog("maincpu", 3, "tilemap_base_addr[0] = %05x\n", data << 2); break; + case 0x10a/2: m_tilemap_mode[0] = data; verboselog("maincpu", 3, "tilemap_mode[0] = %04x\n", data); break; + + /* Tilemap 1 */ + case 0x120/2: m_tilemap_flags[1] = data; verboselog("maincpu", 3, "tilemap_flags[1] = %04x\n", data); break; + case 0x124/2: m_tilemap_scrollx[1] = data; verboselog("maincpu", 3, "tilemap_scrollx[1] = %04x\n", data); break; + case 0x126/2: m_tilemap_scrolly[1] = data; verboselog("maincpu", 3, "tilemap_scrolly[1] = %04x\n", data); break; + case 0x128/2: m_tilemap_base_addr[1] = (data) << 1; verboselog("maincpu", 3, "tilemap_base_addr[1] = %05x\n", data << 2); break; + case 0x12a/2: m_tilemap_mode[1] = data; verboselog("maincpu", 3, "tilemap_mode[1] = %04x\n", data); break; + + /* Tilemap 2? */ + case 0x140/2: m_tilemap_flags[2] = data; verboselog("maincpu", 0, "tilemap_flags[2] = %04x\n", data); break; + case 0x144/2: m_tilemap_scrollx[2] = data; verboselog("maincpu", 0, "tilemap_scrollx[2] = %04x\n", data); break; + case 0x146/2: m_tilemap_scrolly[2] = data; verboselog("maincpu", 0, "tilemap_scrolly[2] = %04x\n", data); break; + case 0x148/2: m_tilemap_base_addr[2] = (data) << 1; verboselog("maincpu", 0, "tilemap_base_addr[2] = %05x\n", data << 2); break; + case 0x14a/2: m_tilemap_mode[2] = data; verboselog("maincpu", 0, "tilemap_mode[2] = %04x\n", data); break; + + /* ROZ */ + case 0x180/2: m_roz_mode = data; verboselog("maincpu", 3, "roz_mode = %04x\n", data); break; + case 0x184/2: m_roz_scrollx = (data << 16) | (m_roz_scrollx & 0xffff); m_roz_changed |= 1; verboselog("maincpu", 3, "roz_scrollx = %08x\n", m_roz_scrollx); break; + case 0x186/2: m_roz_scrollx = (data) | (m_roz_scrollx & 0xffff0000); m_roz_changed |= 1; verboselog("maincpu", 3, "roz_scrollx = %08x\n", m_roz_scrollx); break; + case 0x188/2: m_roz_scrolly = (data << 16) | (m_roz_scrolly & 0xffff); m_roz_changed |= 2; verboselog("maincpu", 3, "roz_scrolly = %08x\n", m_roz_scrolly); break; + case 0x18a/2: m_roz_scrolly = (data) | (m_roz_scrolly & 0xffff0000); m_roz_changed |= 2; verboselog("maincpu", 3, "roz_scrolly = %08x\n", m_roz_scrolly); break; + case 0x18c/2: m_roz_coeffa = data; verboselog("maincpu", 3, "roz_coeffa = %04x\n", data); break; + case 0x18e/2: m_roz_coeffb = data; verboselog("maincpu", 3, "roz_coeffb = %04x\n", data); break; + case 0x190/2: m_roz_coeffc = data; verboselog("maincpu", 3, "roz_coeffc = %04x\n", data); break; + case 0x192/2: m_roz_coeffd = data; verboselog("maincpu", 3, "roz_coeffd = %04x\n", data); break; + case 0x194/2: m_roz_base_addr = (data) << 1; verboselog("maincpu", 3, "roz_base_addr = %05x\n", data << 2); break; + case 0x196/2: m_roz_tile_bank = data; verboselog("maincpu", 3, "roz_tile_bank = %04x\n", data); break; //tile bank + case 0x198/2: m_roz_unk_base0 = data << 2; verboselog("maincpu", 3, "roz_unk_base0 = %05x\n", data << 2); break; + case 0x19a/2: m_roz_unk_base1 = data << 2; verboselog("maincpu", 3, "roz_unk_base1 = %05x\n", data << 2); break; + case 0x19e/2: m_roz_unk_base2 = data << 2; verboselog("maincpu", 3, "roz_unk_base2 = %05x\n", data << 2); break; + + case 0x1d0/2: m_unk_1d0 = data; verboselog("maincpu", 3, "unk_1d0 = %04x\n", data); break; + + + + + case 0x1f0/2: //FIXME: this register is mostly not understood + m_irq_mask = data;//(data & 8) ? 0 : 1; +#if 0 + if(!m_irq_mask && !m_hbl_mask) + { + m_maincpu->set_input_line(7, CLEAR_LINE); + } +#endif + verboselog("maincpu", 3, "irq_mask = %04x\n", data); + break; + default: + verboselog("maincpu", 0, "video_w: Unknown register: %08x = %04x & %04x\n", 0xf00000 + (offset << 1), data, mem_mask); + break; + } +// m_video_regs[offset] = data; +} + + +DEVICE_IMAGE_LOAD_MEMBER( supracan_state, supracan_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size > 0x400000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + +void supracan_state::machine_start() +{ + m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_video_callback),this)); + m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_hbl_callback),this)); + m_line_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_line_on_callback),this)); + m_line_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_line_off_callback),this)); + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x000000, 0x3fffff, read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart)); +} + + +void supracan_state::machine_reset() +{ + m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + + m_video_timer->adjust( machine().first_screen()->time_until_pos( 0, 0 ) ); + m_irq_mask = 0; +} + +/* gfxdecode is retained for reference purposes but not otherwise used by the driver */ +static const gfx_layout supracan_gfx8bpp = +{ + 8,8, + RGN_FRAC(1,1), + 8, + { 0,1,2,3,4,5,6,7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + { STEP8(0,8*8) }, + 8*8*8 +}; + + + +static const gfx_layout supracan_gfx4bpp = +{ + 8,8, + RGN_FRAC(1,1), + 4, + { 0,1,2,3 }, + { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, + { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, + 8*32 +}; + +static const gfx_layout supracan_gfx2bpp = +{ + 8,8, + RGN_FRAC(1,1), + 2, + { 0,1 }, + { 0*2, 1*2, 2*2, 3*2, 4*2, 5*2, 6*2, 7*2 }, + { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, + 8*16 +}; + + +static const UINT32 xtexlayout_xoffset[64] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44, + 45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63 }; + +static const UINT32 xtexlayout_yoffset[64] = { 0*64,1*64,2*64,3*64,4*64,5*64,6*64,7*64,8*64, + 9*64,10*64,11*64,12*64,13*64,14*64,15*64, + 16*64,17*64,18*64,19*64,20*64,21*64,22*64,23*64, + 24*64,25*64,26*64,27*64,28*64,29*64,30*64,31*64, + 32*64,33*64,34*64,35*64,36*64,37*64,38*64,39*64, + 40*64,41*64,42*64,43*64,44*64,45*64,46*64,47*64, + 48*64,49*64,50*64,51*64,52*64,53*64,54*64,55*64, + 56*64,57*64,58*64,59*64,60*64,61*64,62*64,63*64 }; +static const gfx_layout supracan_gfx1bpp = +{ + 64,64, + RGN_FRAC(1,1), + 1, + { 0 }, + EXTENDED_XOFFS, + EXTENDED_YOFFS, + 64*64, + xtexlayout_xoffset, + xtexlayout_yoffset +}; + +static const gfx_layout supracan_gfx1bpp_alt = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0,1,2,3,4,5,6,7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + + +static GFXDECODE_START( supracan ) + GFXDECODE_RAM( "vram", 0, supracan_gfx8bpp, 0, 1 ) + GFXDECODE_RAM( "vram", 0, supracan_gfx4bpp, 0, 0x10 ) + GFXDECODE_RAM( "vram", 0, supracan_gfx2bpp, 0, 0x40 ) + GFXDECODE_RAM( "vram", 0, supracan_gfx1bpp, 0, 0x80 ) + GFXDECODE_RAM( "vram", 0, supracan_gfx1bpp_alt, 0, 0x80 ) +GFXDECODE_END + +INTERRUPT_GEN_MEMBER(supracan_state::supracan_irq) +{ +#if 0 + + if(m_irq_mask) + { + device.execute().set_input_line(7, HOLD_LINE); + } +#endif +} + +INTERRUPT_GEN_MEMBER(supracan_state::supracan_sound_irq) +{ + m_sound_irq_source_reg |= 0x80; + + if(m_sound_irq_enable_reg & m_sound_irq_source_reg) + { + m_soundcpu->set_input_line(0, ASSERT_LINE); + } + else + { + m_soundcpu->set_input_line(0, CLEAR_LINE); + } +} + +static MACHINE_CONFIG_START( supracan, supracan_state ) + + MCFG_CPU_ADD( "maincpu", M68000, XTAL_10_738635MHz ) /* Correct frequency unknown */ + MCFG_CPU_PROGRAM_MAP( supracan_mem ) + MCFG_CPU_VBLANK_INT_DRIVER("screen", supracan_state, supracan_irq) + + MCFG_CPU_ADD( "soundcpu", M6502, XTAL_3_579545MHz ) /* TODO: Verify actual clock */ + MCFG_CPU_PROGRAM_MAP( supracan_sound_mem ) + MCFG_CPU_VBLANK_INT_DRIVER("screen", supracan_state, supracan_sound_irq) + +#if !(SOUNDCPU_BOOT_HACK) + MCFG_QUANTUM_PERFECT_CPU("maincpu") + MCFG_QUANTUM_PERFECT_CPU("soundcpu") +#endif + + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_RAW_PARAMS(XTAL_10_738635MHz/2, 348, 0, 256, 256, 0, 240 ) /* No idea if this is correct */ + MCFG_SCREEN_UPDATE_DRIVER(supracan_state, screen_update_supracan) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD( "palette", 32768 ) + MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) + MCFG_PALETTE_INIT_OWNER(supracan_state, supracan) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", supracan) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "supracan_cart") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) + MCFG_GENERIC_LOAD(supracan_state, supracan_cart) + + MCFG_SOFTWARE_LIST_ADD("cart_list","supracan") +MACHINE_CONFIG_END + + +ROM_START( supracan ) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1995, supracan, 0, 0, supracan, supracan, driver_device, 0, "Funtech Entertainment", "Super A'Can", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/sv8000.c b/src/mame/drivers/sv8000.c new file mode 100644 index 00000000000..95e5c09dfc5 --- /dev/null +++ b/src/mame/drivers/sv8000.c @@ -0,0 +1,417 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Robbbert +/*************************************************************************** + + Bandai Super Vision 8000 (TV Jack 8000) + driver by Wilbert Pol, Robbbert, ranger_lennier, and Charles McDonald + + 2014/01/07 Skeleton driver. + +The Bandai Super Vision 8000 contains: +- NEC D78C (Z80) +- AY-3-8910 +- AMI S68047P (6847 variant) +- NEC D8255C + +Looking at the code of the cartridges it seems there is: +- 1KB of main system RAM +- 3KB of video RAM + + TODO: + - Check configuration of S68047P pins through 8910 port A against + schematics + - Verify clock + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "sound/ay8910.h" +#include "video/mc6847.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class sv8000_state : public driver_device +{ +public: + sv8000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_s68047p(*this, "s68047p") + , m_cart(*this, "cartslot") + , m_videoram(*this, "videoram") + , m_io_row0(*this, "ROW0") + , m_io_row1(*this, "ROW1") + , m_io_row2(*this, "ROW2") + , m_io_joy(*this, "JOY") + { } + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( cart ); + + DECLARE_READ8_MEMBER( ay_port_a_r ); + DECLARE_READ8_MEMBER( ay_port_b_r ); + DECLARE_WRITE8_MEMBER( ay_port_a_w ); + DECLARE_WRITE8_MEMBER( ay_port_b_w ); + + DECLARE_READ8_MEMBER( i8255_porta_r ); + DECLARE_WRITE8_MEMBER( i8255_porta_w ); + DECLARE_READ8_MEMBER( i8255_portb_r ); + DECLARE_WRITE8_MEMBER( i8255_portb_w ); + DECLARE_READ8_MEMBER( i8255_portc_r ); + DECLARE_WRITE8_MEMBER( i8255_portc_w ); + + DECLARE_READ8_MEMBER( mc6847_videoram_r ); + +private: + virtual void machine_start(); + virtual void machine_reset(); + + required_device m_maincpu; + required_device m_s68047p; + required_device m_cart; + required_shared_ptr m_videoram; + required_ioport m_io_row0; + required_ioport m_io_row1; + required_ioport m_io_row2; + required_ioport m_io_joy; + + UINT8 m_column; + + // graphics signals + UINT8 m_ag; + UINT8 m_gm2; + UINT8 m_gm1; + UINT8 m_gm0; + UINT8 m_as; + UINT8 m_css; + UINT8 m_intext; + UINT8 m_inv; +}; + + +static ADDRESS_MAP_START(sv8000_mem, AS_PROGRAM, 8, sv8000_state) + ADDRESS_MAP_UNMAP_HIGH + //AM_RANGE(0x0000, 0x0fff) // mapped by the cartslot + AM_RANGE( 0x8000, 0x83ff ) AM_RAM // Work RAM?? + AM_RANGE( 0xc000, 0xcbff ) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(sv8000_io, AS_IO, 8, sv8000_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("i8255", i8255_device, read, write) + AM_RANGE(0xc0, 0xc0) AM_DEVWRITE("ay8910", ay8910_device, data_w) // Not sure yet + AM_RANGE(0xc1, 0xc1) AM_DEVWRITE("ay8910", ay8910_device, address_w) // Not sure yet +ADDRESS_MAP_END + + +/* Input ports */ +// On the main console: +// +// 1 2 3 1 2 3 +// 4 5 6 4 5 6 +// 7 8 9 7 8 9 +// * 0 # * 0 # +// +// Button/dial? POWER RESET Button/dial? +// +static INPUT_PORTS_START( sv8000 ) + PORT_START("ROW0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("Left 1") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Left 4") // Guess + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("Left 7") // Guess + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Left *") // Guess + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Right 1") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Right 4") // Guess + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Right 7") // Guess + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("Right *") // Guess + + PORT_START("ROW1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("Left 2") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("Left 5") // Guess + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("Left 8") // Guess + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("Left 0") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Right 2") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Right 5") // Guess + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Right 8") // Guess + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Right 0") + + PORT_START("ROW2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("Left 3") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("Left 6") // Guess + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("Left 9") // Guess + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("Left #") // Guess + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Right 3") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Right 6") // Guess + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Right 9") // Guess + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Right #") // Guess + + PORT_START("JOY") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME("Left Right") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME("Left Left") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("Left Down") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("Left Up") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right Right") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Right Left") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Right Down") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Right Up") +INPUT_PORTS_END + + +void sv8000_state::machine_start() +{ + m_ag = 0; + m_gm2 = 0; + m_gm1 = 0; + m_gm0 = 0; + m_as = 0; + m_css = 0; + m_intext = 0; + m_inv = 0; + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + save_item(NAME(m_column)); + save_item(NAME(m_ag)); + save_item(NAME(m_gm2)); + save_item(NAME(m_gm1)); + save_item(NAME(m_gm0)); + save_item(NAME(m_as)); + save_item(NAME(m_css)); + save_item(NAME(m_intext)); + save_item(NAME(m_inv)); +} + + +void sv8000_state::machine_reset() +{ + m_column = 0xff; +} + + +DEVICE_IMAGE_LOAD_MEMBER( sv8000_state, cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size != 0x1000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Incorrect or not support cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + +READ8_MEMBER( sv8000_state::i8255_porta_r ) +{ + //logerror("i8255_porta_r\n"); + return m_io_joy->read(); +} + + +WRITE8_MEMBER( sv8000_state::i8255_porta_w ) +{ + //logerror("i8255_porta_w: %02X\n", data); +} + + +READ8_MEMBER( sv8000_state::i8255_portb_r ) +{ + UINT8 data = 0xff; + + //logerror("i8255_portb_r\n"); + + if ( ! ( m_column & 0x01 ) ) + { + data &= m_io_row0->read(); + } + if ( ! ( m_column & 0x02 ) ) + { + data &= m_io_row1->read(); + } + if ( ! ( m_column & 0x04 ) ) + { + data &= m_io_row2->read(); + } + return data; +} + + +WRITE8_MEMBER( sv8000_state::i8255_portb_w ) +{ + //logerror("i8255_portb_w: %02X\n", data); +} + + +READ8_MEMBER( sv8000_state::i8255_portc_r ) +{ + //logerror("i8255_portc_r\n"); + return 0xff; +} + + +WRITE8_MEMBER( sv8000_state::i8255_portc_w ) +{ + //logerror("i8255_portc_w: %02X\n", data); + m_column = data; +} + + +READ8_MEMBER( sv8000_state::ay_port_a_r ) +{ + UINT8 data = 0xff; + + //logerror("ay_port_a_r\n"); + return data; +} + + +READ8_MEMBER( sv8000_state::ay_port_b_r ) +{ + UINT8 data = 0xff; + + //logerror("ay_port_b_r\n"); + return data; +} + + +// Possibly connected to S68047P for selecting text/graphics modes +// misvader: +// 0x42 01000010 set on normal text screen +// 0x5A 01011010 set for a 256x192 bit mapped screen 3KB in 6KB mode? +// +// spfire: +// 0x42 01000010 text +// 0x5A 01011010 graphics 3KB in 6KB mode? +// +// othello: +// 0x02 00000010 normal text screen +// 0x58 01011000 graphics 3KB in 6KB mode? +// +// gunprof: +// 0x00 00000000 text +// 0x38 00111000 graphics 3KB mode +// +// pacpac: +// 0x00 00000000 text +// 0x5A 01011010 graphics 3KB in 6KB mode? +// +// submar: +// 0x00 00000000 text +// 0x5A 01011010 graphics 3KB in 6KB mode? +// +// beamgala: +// 0x5A 01011010 graphics 3KB in 6KB mode? +// +WRITE8_MEMBER( sv8000_state::ay_port_a_w ) +{ + //logerror("ay_port_a_w: %02X\n", data); + + // Lacking schematics, these are all wild guesses + // Having bit 1 set makes black display as blue?? + m_ag = BIT(data, 4); + m_gm2 = BIT(data, 6); + m_gm1 = BIT(data, 3); + m_gm0 = BIT(data, 3); + m_css = m_ag; + + m_s68047p->ag_w( m_ag ? ASSERT_LINE : CLEAR_LINE ); + m_s68047p->gm2_w( m_gm2 ? ASSERT_LINE : CLEAR_LINE ); + m_s68047p->gm1_w( m_gm1 ? ASSERT_LINE : CLEAR_LINE ); + m_s68047p->gm0_w( m_gm0 ? ASSERT_LINE : CLEAR_LINE ); + m_s68047p->css_w( m_css ? ASSERT_LINE : CLEAR_LINE ); + m_s68047p->hack_black_becomes_blue( BIT(data, 1) ); +} + + +WRITE8_MEMBER( sv8000_state::ay_port_b_w ) +{ + //logerror("ay_port_b_w: %02X\n", data); +} + +READ8_MEMBER( sv8000_state::mc6847_videoram_r ) +{ + if (offset == ~0) return 0xff; + + if ( m_ag ) + { + if ( m_gm2 ) + { + // 256 x 192 / 6KB + offset = ( ( offset & 0x1fc0 ) >> 1 ) | ( offset & 0x1f ); + return m_videoram[offset % 0xc00]; + } + else + { + // 256 x 96 / 3KB + return m_videoram[offset % 0xc00]; + } + } + + // Standard text + UINT8 data = m_videoram[offset % 0xc00]; + if (!data) data = 0x20; //bodge + + m_s68047p->inv_w( ( data & 0x80 ) ? ASSERT_LINE : CLEAR_LINE ); + + return data; +} + +static MACHINE_CONFIG_START( sv8000, sv8000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_10_738635MHz/3) /* Not verified */ + MCFG_CPU_PROGRAM_MAP(sv8000_mem) + MCFG_CPU_IO_MAP(sv8000_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", sv8000_state, irq0_line_hold) + + MCFG_DEVICE_ADD("i8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(sv8000_state, i8255_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(sv8000_state, i8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(sv8000_state, i8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(sv8000_state, i8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(sv8000_state, i8255_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(sv8000_state, i8255_portc_w)) + + /* video hardware */ + // S68047P - Unknown whether the internal or an external character rom is used + MCFG_DEVICE_ADD("s68047p", S68047, XTAL_10_738635MHz/3 ) // Clock not verified + MCFG_MC6847_INPUT_CALLBACK(READ8(sv8000_state, mc6847_videoram_r)) + + MCFG_SCREEN_MC6847_NTSC_ADD("screen", "s68047p") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay8910", AY8910, XTAL_10_738635MHz/3/2) /* Exact model and clock not verified */ + MCFG_AY8910_PORT_A_READ_CB(READ8(sv8000_state, ay_port_a_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(sv8000_state, ay_port_b_r)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(sv8000_state, ay_port_a_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(sv8000_state, ay_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "sv8000_cart") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(sv8000_state, cart) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","sv8000") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sv8000 ) + ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1979, sv8000, 0, 0, sv8000, sv8000, driver_device, 0, "Bandai", "Super Vision 8000 (TV Jack 8000)", 0 ) diff --git a/src/mame/drivers/svi318.c b/src/mame/drivers/svi318.c new file mode 100644 index 00000000000..746820d902a --- /dev/null +++ b/src/mame/drivers/svi318.c @@ -0,0 +1,540 @@ +// license:??? +// copyright-holders:Sean Young,Tomas Karlsson +/* +** svi318.c : driver for Spectravideo SVI-318 and SVI-328 +** +** Sean Young, Tomas Karlsson +** +** Information taken from: http://www.samdal.com/sv318.htm +** +** SV-318 : 16KB Video RAM, 16KB RAM +** SV-328 : 16KB Video RAM, 64KB RAM +*/ + +#include "emu.h" +#include "includes/svi318.h" +#include "imagedev/flopdrv.h" +#include "formats/svi_dsk.h" +#include "formats/svi_cas.h" +#include "rendlay.h" + +static ADDRESS_MAP_START( svi318_mem, AS_PROGRAM, 8, svi318_state ) + AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITE(writemem1) + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank2") AM_WRITE(writemem2) + AM_RANGE(0xc000, 0xffff) AM_READ_BANK("bank3") AM_WRITE(writemem3) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( svi328_806_mem, AS_PROGRAM, 8, svi318_state ) + AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITE(writemem1) + AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank2") AM_WRITE(writemem2) + AM_RANGE(0xc000, 0xefff) AM_READ_BANK("bank3") AM_WRITE(writemem3) + AM_RANGE(0xf000, 0xffff) AM_READ_BANK("bank4") AM_WRITE(writemem4) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( svi318_io, AS_IO, 8, svi318_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x38) AM_READWRITE(io_ext_r, io_ext_w ) + AM_RANGE(0x80, 0x80) AM_DEVWRITE("tms9928a", tms9928a_device, vram_write) + AM_RANGE(0x81, 0x81) AM_DEVWRITE("tms9928a", tms9928a_device, register_write) + AM_RANGE(0x84, 0x84) AM_DEVREAD("tms9928a", tms9928a_device, vram_read) + AM_RANGE(0x85, 0x85) AM_DEVREAD("tms9928a", tms9928a_device, register_read) + AM_RANGE(0x88, 0x88) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0x8c, 0x8c) AM_DEVWRITE("ay8910", ay8910_device, data_w) + AM_RANGE(0x90, 0x90) AM_DEVREAD("ay8910", ay8910_device, data_r) + AM_RANGE(0x96, 0x97) AM_WRITE(ppi_w) + AM_RANGE(0x98, 0x9a) AM_DEVREAD("ppi8255", i8255_device, read) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( svi328_806_io, AS_IO, 8, svi318_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x58) AM_READWRITE(io_ext_r, io_ext_w ) + AM_RANGE(0x80, 0x80) AM_DEVWRITE("tms9928a", tms9928a_device, vram_write) + AM_RANGE(0x81, 0x81) AM_DEVWRITE("tms9928a", tms9928a_device, register_write) + AM_RANGE(0x84, 0x84) AM_DEVREAD("tms9928a", tms9928a_device, vram_read) + AM_RANGE(0x85, 0x85) AM_DEVREAD("tms9928a", tms9928a_device, register_read) + AM_RANGE(0x88, 0x88) AM_DEVWRITE("ay8910", ay8910_device, address_w) + AM_RANGE(0x8c, 0x8c) AM_DEVWRITE("ay8910", ay8910_device, data_w) + AM_RANGE(0x90, 0x90) AM_DEVREAD("ay8910", ay8910_device, data_r) + AM_RANGE(0x96, 0x97) AM_WRITE(ppi_w) + AM_RANGE(0x98, 0x9a) AM_DEVREAD("ppi8255", i8255_device, read) +ADDRESS_MAP_END + +/* + Keyboard status table + Bit#:| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | + | | | | | | | | | + Line: | | | | | | | | | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 0 | "7" | "6" | "5" | "4" | "3" | "2" | "1" | "0" | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 1 | "/" | "." | "=" | "," | "'" | ":" | "9" | "8" | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 2 | "G" | "F" | "E" | "D" | "C" | "B" | "A" | "-" | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 3 | "O" | "N" | "M" | "L" | "K" | "J" | "I" | "H" | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 4 | "W" | "V" | "U" | "T" | "S" | "R" | "Q" | "P" | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 5 | UP | BS | "]" | "\" | "[" | "Z" | "Y" | "X" | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 6 |LEFT |ENTER|STOP | ESC |RGRAP|LGRAP|CTRL |SHIFT| + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 7 |DOWN | INS | CLS | F5 | F4 | F3 | F2 | F1 | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 8 |RIGHT| |PRINT| SEL |CAPS | DEL | TAB |SPACE| + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 9* | "7" | "6" | "5" | "4" | "3" | "2" | "1" | "0" | + ---------+-----+-----+-----+-----+-----+-----+-----+-----| + 10* | "," | "." | "/" | "*" | "-" | "+" | "9" | "8" | + ---------------------------------------------------------- + * Numcerical keypad (SVI-328 only) + +2008-05 FP: +Small note about natural keyboard: currently, +- "Keypad ," is not mapped +- "Left Grph" and "Right Grph" are mapped to 'Page Up' and 'Page Down' +- "Stop" is mapped to 'End' +- "Select" is mapped to 'F11' +- "CLS/HM" is mapped to 'Home' +TODO: How are multiple keys (Copy, Cut, Paste, CLS/HM) expected to +behave? Do they need multiple mapping in natural keyboard? +*/ + +static INPUT_PORTS_START( svi318 ) + PORT_START("LINE.0") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_START("LINE.1") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR(';') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE.2") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("LINE.3") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('0') PORT_CHAR('J') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("LINE.4") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + + PORT_START("LINE.5") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('~') + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("LINE.6") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Grph") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Grph") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("LINE.7") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4 F9") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F10") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLS/HM Copy") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins Paste") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("LINE.8") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Cut") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Select") PORT_CODE(KEYCODE_PAUSE) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Print") PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("LINE.9") + PORT_BIT (0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.10") + PORT_BIT (0xff, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("JOYSTICKS") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + + PORT_START("BUTTONS") + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON1) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) +INPUT_PORTS_END + + +static INPUT_PORTS_START( svi328 ) + + PORT_INCLUDE( svi318 ) + + PORT_MODIFY("LINE.9") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_MODIFY("LINE.10") + PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_DEL_PAD) +INPUT_PORTS_END + +WRITE_LINE_MEMBER(svi318_state::vdp_interrupt) +{ + m_maincpu->set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE)); +} + +FLOPPY_FORMATS_MEMBER( svi318_state::floppy_formats ) + FLOPPY_SVI_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( svi_floppies ) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_FRAGMENT( svi318_cartslot ) + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "svi318_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(svi318_state, svi318_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","svi318_cart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( svi318, svi318_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 3579545) /* 3.579545 MHz */ + MCFG_CPU_PROGRAM_MAP(svi318_mem) + MCFG_CPU_IO_MAP(svi318_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(svi318_state, ppi_port_a_r)) + MCFG_I8255_IN_PORTB_CB(READ8(svi318_state, ppi_port_b_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(svi318_state, ppi_port_c_w)) + + MCFG_DEVICE_ADD("ins8250_0", INS8250, 1000000) + MCFG_INS8250_OUT_INT_CB(WRITELINE(svi318_state, ins8250_interrupt)) + MCFG_DEVICE_ADD("ins8250_1", INS8250, 3072000) + MCFG_INS8250_OUT_INT_CB(WRITELINE(svi318_state, ins8250_interrupt)) + + /* Video hardware */ + MCFG_DEVICE_ADD("tms9928a", TMS9929A, XTAL_10_738635MHz / 2) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(svi318_state, vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_PAL("screen") + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9929a_device, screen_update) + + /* Sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8910", AY8910, 1789773) + MCFG_AY8910_PORT_A_READ_CB(READ8(svi318_state, psg_port_a_r)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(svi318_state, psg_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(svi318_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(svi_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("svi318_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "svi318_cass") + + MCFG_FD1793_ADD("wd179x", XTAL_1MHz) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(svi318_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(svi318_state, fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("wd179x:0", svi_floppies, "dd", svi318_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd179x:1", svi_floppies, "dd", svi318_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("disk_list", "svi318_flop") + + MCFG_FRAGMENT_ADD(svi318_cartslot) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K,96K,160K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( svi318n, svi318 ) + + MCFG_DEVICE_REMOVE("tms9928a") + MCFG_DEVICE_REMOVE("screen") + MCFG_DEVICE_ADD("tms9928a", TMS9928A, XTAL_10_738635MHz / 2) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(svi318_state, vdp_interrupt)) + MCFG_TMS9928A_SCREEN_ADD_NTSC("screen") + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( svi328, svi318 ) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("96K,160K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( svi328n, svi318n ) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("96K,160K") +MACHINE_CONFIG_END + + +/* F4 Character Displayer */ +static const gfx_layout svi328_charlayout = +{ + 8, 8, /* 8 x 16 characters */ + 256, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( svi328 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, svi328_charlayout, 0, 9 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( svi328_806, svi318_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 3579545) /* 3.579545 MHz */ + MCFG_CPU_PROGRAM_MAP(svi328_806_mem) + MCFG_CPU_IO_MAP(svi328_806_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(svi318_state, ppi_port_a_r)) + MCFG_I8255_IN_PORTB_CB(READ8(svi318_state, ppi_port_b_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(svi318_state, ppi_port_c_w)) + + MCFG_DEVICE_ADD("ins8250_0", INS8250, 1000000) + MCFG_INS8250_OUT_INT_CB(WRITELINE(svi318_state, ins8250_interrupt)) + MCFG_DEVICE_ADD("ins8250_1", INS8250, 3072000) + MCFG_INS8250_OUT_INT_CB(WRITELINE(svi318_state, ins8250_interrupt)) + + /* Video hardware */ + MCFG_DEFAULT_LAYOUT(layout_dualhsxs) + + MCFG_DEVICE_ADD("tms9928a", TMS9929A, XTAL_10_738635MHz / 2) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(svi318_state, vdp_interrupt)) + MCFG_TMS9928A_SET_SCREEN("screen") + MCFG_TMS9928A_SCREEN_ADD_PAL("screen") + MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9929a_device, screen_update) + MCFG_PALETTE_ADD("palette", TMS9928A_PALETTE_SIZE + 2) /* 2 additional entries for monochrome svi806 output */ + + MCFG_SCREEN_ADD("svi806", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", svi328) + + MCFG_MC6845_ADD("crtc", MC6845, "svi806", XTAL_12MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) /* ? */ + MCFG_MC6845_UPDATE_ROW_CB(svi318_state, crtc_update_row) + + /* Sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("ay8910", AY8910, 1789773) + MCFG_AY8910_PORT_A_READ_CB(READ8(svi318_state, psg_port_a_r)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(svi318_state, psg_port_b_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(svi318_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(svi_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("svi318_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "svi318_cass") + + MCFG_FD1793_ADD("wd179x", XTAL_1MHz) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(svi318_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(svi318_state, fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("wd179x:0", svi_floppies, "dd", svi318_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd179x:1", svi_floppies, "dd", svi318_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("disk_list", "svi318_flop") + + MCFG_FRAGMENT_ADD(svi318_cartslot) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("96K,160K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( svi328n_806, svi328_806 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(60) +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( svi318 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS(0, "111", "SV BASIC v1.11") + ROMX_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "110", "SV BASIC v1.1") + ROMX_LOAD("svi110.rom", 0x0000, 0x8000, CRC(709904e9) SHA1(7d8daf52f78371ca2c9443e04827c8e1f98c8f2c), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "100", "SV BASIC v1.0") + ROMX_LOAD("svi100.rom", 0x0000, 0x8000, CRC(98d48655) SHA1(07758272df475e5e06187aa3574241df1b14035b), ROM_BIOS(3)) +ROM_END + +ROM_START( svi318n ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS(0, "111", "SV BASIC v1.11") + ROMX_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "110", "SV BASIC v1.1") + ROMX_LOAD("svi110.rom", 0x0000, 0x8000, CRC(709904e9) SHA1(7d8daf52f78371ca2c9443e04827c8e1f98c8f2c), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "100", "SV BASIC v1.0") + ROMX_LOAD("svi100.rom", 0x0000, 0x8000, CRC(98d48655) SHA1(07758272df475e5e06187aa3574241df1b14035b), ROM_BIOS(3)) +ROM_END + +ROM_START( svi328 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS(0, "111", "SV BASIC v1.11") + ROMX_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "110", "SV BASIC v1.1") + ROMX_LOAD("svi110.rom", 0x0000, 0x8000, CRC(709904e9) SHA1(7d8daf52f78371ca2c9443e04827c8e1f98c8f2c), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "100", "SV BASIC v1.0") + ROMX_LOAD("svi100.rom", 0x0000, 0x8000, CRC(98d48655) SHA1(07758272df475e5e06187aa3574241df1b14035b), ROM_BIOS(3)) +ROM_END + +ROM_START( svi328n ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_SYSTEM_BIOS(0, "111", "SV BASIC v1.11") + ROMX_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "110", "SV BASIC v1.1") + ROMX_LOAD("svi110.rom", 0x0000, 0x8000, CRC(709904e9) SHA1(7d8daf52f78371ca2c9443e04827c8e1f98c8f2c), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "100", "SV BASIC v1.0") + ROMX_LOAD("svi100.rom", 0x0000, 0x8000, CRC(98d48655) SHA1(07758272df475e5e06187aa3574241df1b14035b), ROM_BIOS(3)) +ROM_END + +ROM_START( sv328p80 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89)) + + ROM_REGION( 0x1000, "gfx1", 0 ) + ROM_SYSTEM_BIOS(0, "english", "English Character Set") + ROMX_LOAD("svi806.rom", 0x0000, 0x1000, CRC(850bc232) SHA1(ed45cb0e9bd18a9d7bd74f87e620f016a7ae840f), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "swedish", "Swedish Character Set") + ROMX_LOAD("svi806se.rom", 0x0000, 0x1000, CRC(daea8956) SHA1(3f16d5513ad35692488ae7d864f660e76c6e8ed3), ROM_BIOS(2)) +ROM_END + +ROM_START( sv328n80 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89)) + + ROM_REGION( 0x1000, "gfx1", 0 ) + ROM_SYSTEM_BIOS(0, "english", "English Character Set") + ROMX_LOAD("svi806.rom", 0x0000, 0x1000, CRC(850bc232) SHA1(ed45cb0e9bd18a9d7bd74f87e620f016a7ae840f), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "swedish", "Swedish Character Set") + ROMX_LOAD("svi806se.rom", 0x0000, 0x1000, CRC(daea8956) SHA1(3f16d5513ad35692488ae7d864f660e76c6e8ed3), ROM_BIOS(2)) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, svi318, 0, 0, svi318, svi318, svi318_state, svi318, "Spectravideo", "SVI-318 (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, svi318n, svi318, 0, svi318n, svi318, svi318_state, svi318, "Spectravideo", "SVI-318 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, svi328, svi318, 0, svi328, svi328, svi318_state, svi318, "Spectravideo", "SVI-328 (PAL)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, svi328n, svi318, 0, svi328n, svi328, svi318_state, svi318, "Spectravideo", "SVI-328 (NTSC)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, sv328p80, svi318, 0, svi328_806, svi328, svi318_state, svi328_806, "Spectravideo", "SVI-328 (PAL) + SVI-806 80 column card", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, sv328n80, svi318, 0, svi328n_806, svi328, svi318_state, svi328_806, "Spectravideo", "SVI-328 (NTSC) + SVI-806 80 column card", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/svision.c b/src/mame/drivers/svision.c new file mode 100644 index 00000000000..931d4f391d4 --- /dev/null +++ b/src/mame/drivers/svision.c @@ -0,0 +1,606 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + watara supervision handheld + + PeT mess@utanet.at in december 2000 +******************************************************************************/ + +#include "emu.h" +#include "includes/svision.h" + +#include "svision.lh" + +#define MAKE8_RGB32(red3, green3, blue2) ( ( (red3)<<(16+5)) | ( (green3)<<(8+5)) | ( (blue2)<<(0+6)) ) +#define MAKE9_RGB32(red3, green3, blue3) ( ( (red3)<<(16+5)) | ( (green3)<<(8+5)) | ( (blue3)<<(0+5)) ) +#define MAKE12_RGB32(red4, green4, blue4) ( ( (red4)<<(16+4)) | ((green4)<<(8+4)) | ((blue4)<<(0+4)) ) +#define MAKE24_RGB32(red8, green8, blue8) ( (((red8)&0xf8)<<16) | (((green8)&0xf8)<<8) | (((blue8)&0xf8)) ) + + +// in pixel +#define XSIZE (m_reg[0]&~3) +#define XPOS m_reg[2] +#define YPOS m_reg[3] +#define BANK m_reg[0x26] + +TIMER_CALLBACK_MEMBER(svision_state::svision_pet_timer) +{ + switch (m_pet.state) + { + case 0: + if ( m_joy2 ) + { + m_pet.input = m_joy2->read(); + } + /* fall through */ + + case 2: case 4: case 6: case 8: + case 10: case 12: case 14: + m_pet.clock = m_pet.state & 2; + m_pet.data = m_pet.input & 1; + m_pet.input >>= 1; + m_pet.state++; + break; + + case 16+15: + m_pet.state = 0; + break; + + default: + m_pet.state++; + break; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(svision_state::svision_pet_timer_dev) +{ + svision_pet_timer(ptr,param); +} + +void svision_state::svision_irq() +{ + int irq = m_svision.timer_shot && (BANK & 2); + irq = irq || (*m_dma_finished && (BANK & 4)); + + m_maincpu->set_input_line(M65C02_IRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE); +} + +TIMER_CALLBACK_MEMBER(svision_state::svision_timer) +{ + m_svision.timer_shot = TRUE; + m_svision.timer1->enable(FALSE); + svision_irq(); +} + +READ8_MEMBER(svision_state::svision_r) +{ + int data = m_reg[offset]; + switch (offset) + { + case 0x20: + data = m_joy->read(); + break; + + case 0x21: + data &= ~0xf; + data |= m_reg[0x22] & 0xf; + if (m_pet.on) + { + if (!m_pet.clock) + { + data &= ~4; + } + if (!m_pet.data) + { + data &= ~8; + } + } + break; + + case 0x27: + data &= ~3; + if (m_svision.timer_shot) + { + data|=1; + } + if (*m_dma_finished) + { + data|=2; + } + break; + + case 0x24: + m_svision.timer_shot = FALSE; + svision_irq(); + break; + + case 0x25: + *m_dma_finished = FALSE; + svision_irq(); + break; + + default: + logerror("%.6f svision read %04x %02x\n", machine().time().as_double(),offset,data); + break; + } + + return data; +} + +WRITE8_MEMBER(svision_state::svision_w) +{ + int value, delay, bank; + + m_reg[offset] = data; + + switch (offset) + { + case 2: + case 3: + break; + + case 0x26: /* bits 5,6 memory management for a000? */ + logerror("%.6f svision write %04x %02x\n", machine().time().as_double(), offset, data); + bank = ((m_reg[0x26] & 0xe0) >> 5) % (m_cart_rom->bytes() / 0x4000); + m_bank1->set_base(m_cart_rom->base() + (bank * 0x4000)); + svision_irq(); + break; + + case 0x23: /* delta hero irq routine write */ + value = data; + if (!data) + { + value = 0x100; + } + if (BANK & 0x10) + { + delay = 16384; + } + else + { + delay = 256; + } + m_svision.timer1->enable(TRUE); + m_svision.timer1->reset(m_maincpu->cycles_to_attotime(value * delay)); + break; + + case 0x10: case 0x11: case 0x12: case 0x13: + m_sound->soundport_w(0, offset & 3, data); + break; + + case 0x14: case 0x15: case 0x16: case 0x17: + m_sound->soundport_w(1, offset & 3, data); + break; + + case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: + m_sound->sounddma_w(space, offset - 0x18, data); + break; + + case 0x28: case 0x29: case 0x2a: + m_sound->noise_w(space, offset - 0x28, data); + break; + + default: + logerror("%.6f svision write %04x %02x\n", machine().time().as_double(), offset, data); + break; + } +} + +READ8_MEMBER(svision_state::tvlink_r) +{ + switch(offset) + { + default: + if (offset >= 0x800 && offset < 0x840) + { + /* strange effects when modifying palette */ + return svision_r(space, offset); + } + else + { + return svision_r(space, offset); + } + } +} + +WRITE8_MEMBER(svision_state::tvlink_w) +{ + switch (offset) + { + case 0x0e: + m_reg[offset] = data; + m_tvlink.palette_on = data & 1; + if (m_tvlink.palette_on) + { + // hack, normally initialising with palette from ram + m_tvlink.palette[0] = MAKE12_RGB32(163/16,172/16,115/16); // these are the tron colors messured from screenshot + m_tvlink.palette[1] = MAKE12_RGB32(163/16,155/16,153/16); + m_tvlink.palette[2] = MAKE12_RGB32(77/16,125/16,73/16); + m_tvlink.palette[3] = MAKE12_RGB32(59/16,24/16,20/16); + } + else + { + // cleaner to use colors from compile time palette, or compose from "fixed" palette values + m_tvlink.palette[0]=MAKE12_RGB32(0,0,0); + m_tvlink.palette[1]=MAKE12_RGB32(5*16/256,18*16/256,9*16/256); + m_tvlink.palette[2]=MAKE12_RGB32(48*16/256,76*16/256,100*16/256); + m_tvlink.palette[3]=MAKE12_RGB32(190*16/256,190*16/256,190*16/256); + } + break; + default: + svision_w(space, offset,data); + if (offset >= 0x800 && offset < 0x840) + { + UINT16 c; + if (offset == 0x803 && data == 0x07) + { + /* tron hack */ + m_reg[0x0804]=0x00; + m_reg[0x0805]=0x01; + m_reg[0x0806]=0x00; + m_reg[0x0807]=0x00; + } + c = m_reg[0x800] | (m_reg[0x804] << 8); + m_tvlink.palette[0] = MAKE9_RGB32( (c>>0)&7, (c>>3)&7, (c>>6)&7); + c = m_reg[0x801] | (m_reg[0x805] << 8); + m_tvlink.palette[1] = MAKE9_RGB32( (c>>0)&7, (c>>3)&7, (c>>6)&7); + c = m_reg[0x802] | (m_reg[0x806]<<8); + m_tvlink.palette[2]=MAKE9_RGB32( (c>>0)&7, (c>>3)&7, (c>>6)&7); + c = m_reg[0x803] | (m_reg[0x807]<<8); + m_tvlink.palette[3]=MAKE9_RGB32( (c>>0)&7, (c>>3)&7, (c>>6)&7); + /* writes to palette effect video color immediately */ + /* some writes modify other registers, */ + /* encoding therefor not known (rgb8 or rgb9) */ + } + } +} + +static ADDRESS_MAP_START( svision_mem , AS_PROGRAM, 8, svision_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAM + AM_RANGE(0x2000, 0x3fff) AM_READWRITE(svision_r, svision_w) AM_SHARE("reg") + AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x6000, 0x7fff) AM_NOP + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") + AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank2") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tvlink_mem , AS_PROGRAM, 8, svision_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAM + AM_RANGE(0x2000, 0x3fff) AM_READWRITE(tvlink_r, tvlink_w) AM_SHARE("reg") + AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x6000, 0x7fff) AM_NOP + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") + AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank2") +ADDRESS_MAP_END + +static INPUT_PORTS_START( svision ) + PORT_START("JOY") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") +INPUT_PORTS_END + +static INPUT_PORTS_START( svisions ) + PORT_START("JOY") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") PORT_PLAYER(1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") PORT_PLAYER(1) + PORT_START("JOY2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("2nd B") PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("2nd A") PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("2nd Select") PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("2nd Start/Pause") PORT_PLAYER(2) +INPUT_PORTS_END + +/* most games contain their graphics in roms, and have hardware to + draw complete rectangular objects */ + +#define PALETTE_START 0 + +/* palette in red, green, blue triples */ +static const unsigned char svision_palette[] = +{ +#if 0 + /* greens grabbed from a scan of a handheld + * in its best adjustment for contrast + */ + 86, 121, 86, + 81, 115, 90, + 74, 107, 101, + 54, 78, 85 +#else + /* grabbed from chris covell's black white pics */ + 0xe0, 0xe0, 0xe0, + 0xb9, 0xb9, 0xb9, + 0x54, 0x54, 0x54, + 0x12, 0x12, 0x12 +#endif +}; + +/* palette in red, green, blue tribles */ +static const unsigned char svisionp_palette[] = +{ + // pal + 1, 1, 3, + 5, 18, 9, + 48, 76, 100, + 190, 190, 190 +}; + +/* palette in red, green, blue tribles */ +static const unsigned char svisionn_palette[] = +{ + 0, 0, 0, + 188, 242, 244, // darker + 129, 204, 255, + 245, 249, 248 +}; + +PALETTE_INIT_MEMBER(svision_state, svision) +{ + for (int i = 0; i < sizeof(svision_palette) / 3; i++) + palette.set_pen_color(i, svision_palette[i*3], svision_palette[i*3+1], svision_palette[i*3+2]); +} +PALETTE_INIT_MEMBER(svision_state,svisionn) +{ + for (int i = 0; i < sizeof(svisionn_palette) / 3; i++) + palette.set_pen_color(i, svisionn_palette[i*3], svisionn_palette[i*3+1], svisionn_palette[i*3+2]); +} +PALETTE_INIT_MEMBER(svision_state,svisionp) +{ + for (int i = 0; i < sizeof(svisionn_palette) / 3; i++) + palette.set_pen_color(i, svisionp_palette[i*3], svisionp_palette[i*3+1], svisionp_palette[i*3+2]); +} + +UINT32 svision_state::screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, i, j=XPOS/4+YPOS*0x30; + UINT8 *videoram = m_videoram; + + if (BANK&8) + { + for (y=0; y<160; y++) + { + UINT16 *line = &bitmap.pix16(y, 3 - (XPOS & 3)); + for (x=3-(XPOS&3),i=0; x<160+3 && x>6)&3)+PALETTE_START; + line[2]=((b>>4)&3)+PALETTE_START; + line[1]=((b>>2)&3)+PALETTE_START; + line[0]=((b>>0)&3)+PALETTE_START; + line+=4; + } + j += 0x30; + if (j >= 8160) + j = 0; //sssnake + } + } + else + { + bitmap.plot_box(3, 0, 162, 159, PALETTE_START); + } + return 0; +} + +UINT32 svision_state::screen_update_tvlink(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int x, y, i, j = XPOS/4+YPOS*0x30; + UINT8 *videoram = m_videoram; + + if (BANK & 8) + { + for (y = 0; y < 160; y++) + { + UINT32 *line = &bitmap.pix32(y, 3 - (XPOS & 3)); + for (x = 3 - (XPOS & 3), i = 0; x < 160 + 3 && x < XSIZE + 3; x += 4, i++) + { + UINT8 b=videoram[j+i]; + line[3]=m_tvlink.palette[(b>>6)&3]; + line[2]=m_tvlink.palette[(b>>4)&3]; + line[1]=m_tvlink.palette[(b>>2)&3]; + line[0]=m_tvlink.palette[(b>>0)&3]; + line+=4; + } + j += 0x30; + if (j >= 8160) + j = 0; //sssnake + } + } + else + { + bitmap.plot_box(3, 0, 162, 159, m_palette->pen(PALETTE_START)); + } + return 0; +} + +INTERRUPT_GEN_MEMBER(svision_state::svision_frame_int) +{ + if (BANK & 1) + device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + + m_sound->sound_decrement(); +} + +DRIVER_INIT_MEMBER(svision_state, svision) +{ + m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this)); + m_dma_finished = m_sound->dma_finished(); + m_pet.on = FALSE; +} + +DRIVER_INIT_MEMBER(svision_state, svisions) +{ + m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this)); + m_dma_finished = m_sound->dma_finished(); + m_pet.on = TRUE; + m_pet.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_pet_timer),this)); +} + +DEVICE_IMAGE_LOAD_MEMBER( svision_state, svision_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size > 0x20000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +void svision_state::machine_start() +{ + int num_banks; + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + num_banks = m_cart_rom->bytes() / 0x4000; + + m_bank1 = membank("bank1"); + m_bank2 = membank("bank2"); + // bank1 is set to the first bank + // do not crash if no cart + if (num_banks) + { + m_bank1->set_base(m_cart_rom->base()); + // bank2 is set to the last bank + m_bank2->set_base(m_cart_rom->base() + (num_banks - 1) * 0x4000); + } +} + +void svision_state::machine_reset() +{ + m_svision.timer_shot = FALSE; + *m_dma_finished = FALSE; +} + + +MACHINE_RESET_MEMBER(svision_state,tvlink) +{ + svision_state::machine_reset(); + m_tvlink.palette_on = FALSE; + + memset(m_reg + 0x800, 0xff, 0x40); // normally done from m_tvlink microcontroller + m_reg[0x82a] = 0xdf; + + m_tvlink.palette[0] = MAKE24_RGB32(svisionp_palette[(PALETTE_START+0)*3+0], svisionp_palette[(PALETTE_START+0)*3+1], svisionp_palette[(PALETTE_START+0)*3+2]); + m_tvlink.palette[1] = MAKE24_RGB32(svisionp_palette[(PALETTE_START+1)*3+0], svisionp_palette[(PALETTE_START+1)*3+1], svisionp_palette[(PALETTE_START+1)*3+2]); + m_tvlink.palette[2] = MAKE24_RGB32(svisionp_palette[(PALETTE_START+2)*3+0], svisionp_palette[(PALETTE_START+2)*3+1], svisionp_palette[(PALETTE_START+2)*3+2]); + m_tvlink.palette[3] = MAKE24_RGB32(svisionp_palette[(PALETTE_START+3)*3+0], svisionp_palette[(PALETTE_START+3)*3+1], svisionp_palette[(PALETTE_START+3)*3+2]); +} + +static MACHINE_CONFIG_START( svision, svision_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M65C02, 4000000) /* ? stz used! speed? */ + MCFG_CPU_PROGRAM_MAP(svision_mem) + MCFG_CPU_VBLANK_INT_DRIVER("screen", svision_state, svision_frame_int) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(61) + MCFG_SCREEN_SIZE(3+160+3, 160) + MCFG_SCREEN_VISIBLE_AREA(3+0, 3+160-1, 0, 160-1) + MCFG_SCREEN_UPDATE_DRIVER(svision_state, screen_update_svision) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(svision_palette) * 3) + MCFG_PALETTE_INIT_OWNER(svision_state, svision ) + + MCFG_DEFAULT_LAYOUT(layout_svision) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("custom", SVISION_SND, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + SVISION_SND_IRQ_CB(svision_state, svision_irq) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "svision_cart") + MCFG_GENERIC_EXTENSIONS("bin,ws,sv") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(svision_state, svision_cart) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "svision") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( svisions, svision ) + MCFG_TIMER_DRIVER_ADD_PERIODIC("pet_timer", svision_state, svision_pet_timer_dev, attotime::from_seconds(8)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( svisionp, svision ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(4430000) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(svision_state, svisionp) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( svisionn, svision ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(3560000/*?*/) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(svision_state, svisionn) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tvlinkp, svisionp ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(tvlink_mem) + + MCFG_MACHINE_RESET_OVERRIDE(svision_state, tvlink) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_NO_PALETTE + MCFG_SCREEN_UPDATE_DRIVER(svision_state, screen_update_tvlink) + +MACHINE_CONFIG_END + +ROM_START(svision) + ROM_REGION(0x20000, "maincpu", ROMREGION_ERASE00) +ROM_END + + +#define rom_svisions rom_svision +#define rom_svisionn rom_svision +#define rom_svisionp rom_svision +#define rom_tvlinkp rom_svision + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +// marketed under a ton of firms and names +CONS(1992, svision, 0, 0, svision, svision, svision_state, svision, "Watara", "Super Vision", 0) +// svdual 2 connected via communication port +CONS( 1992, svisions, svision, 0,svisions, svisions, svision_state, svisions, "Watara", "Super Vision (PeT Communication Simulation)", 0 ) + +CONS( 1993, svisionp, svision, 0,svisionp, svision, svision_state, svision, "Watara", "Super Vision (PAL TV Link Colored)", 0 ) +CONS( 1993, svisionn, svision, 0,svisionn, svision, svision_state, svision, "Watara", "Super Vision (NTSC TV Link Colored)", 0 ) +// svtvlink (2 supervisions) +// tvlink (pad supervision simulated) +CONS( 199?, tvlinkp, svision, 0,tvlinkp, svision, svision_state, svision, "Watara", "TV Link PAL", 0 ) diff --git a/src/mame/drivers/svmu.c b/src/mame/drivers/svmu.c new file mode 100644 index 00000000000..1e077c8211f --- /dev/null +++ b/src/mame/drivers/svmu.c @@ -0,0 +1,358 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Sega Visual Memory Unit + + driver by Sandro Ronco + + TODO: + - add more bios versions + - serial + +****************************************************************************/ + +#include "emu.h" +#include "cpu/lc8670/lc8670.h" +#include "imagedev/snapquik.h" +#include "machine/intelfsh.h" +#include "sound/speaker.h" +#include "svmu.lh" + +#define PIXEL_SIZE 7 +#define PIXEL_DISTANCE 1 + +class svmu_state : public driver_device +{ +public: + svmu_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_flash(*this, "flash"), + m_speaker(*this, "speaker"), + m_bios(*this, "bios") + { } + + required_device m_maincpu; + required_device m_flash; + required_device m_speaker; + required_region_ptr m_bios; + + DECLARE_PALETTE_INIT(svmu); + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER(page_w); + DECLARE_READ8_MEMBER(prog_r); + DECLARE_WRITE8_MEMBER(prog_w); + DECLARE_READ8_MEMBER(p1_r); + DECLARE_WRITE8_MEMBER(p1_w); + DECLARE_READ8_MEMBER(p7_r); + DECLARE_QUICKLOAD_LOAD_MEMBER( svmu ); + +private: + UINT8 m_page; +}; + + +WRITE8_MEMBER(svmu_state::page_w) +{ + m_page = data & 0x03; +} + +READ8_MEMBER(svmu_state::prog_r) +{ + if (m_page == 1) + return m_flash->read(offset); + else if (m_page == 2) + return m_flash->read(0x10000 + offset); + else + return m_bios[offset]; +} + +WRITE8_MEMBER(svmu_state::prog_w) +{ + if (m_page == 1) + m_flash->write(offset, data); + else if (m_page == 2) + m_flash->write(0x10000 + offset, data); +} + +/* + Port 1 + + x--- ---- PWM output + -x-- ---- BUZ + --x- ---- SCK1 + ---x ---- SB1 + ---- x--- SO1 + ---- -x-- SCK0 + ---- --x- SB0 + ---- ---x SO0 + +*/ + +READ8_MEMBER(svmu_state::p1_r) +{ + return 0; +} + +WRITE8_MEMBER(svmu_state::p1_w) +{ + m_speaker->level_w(BIT(data, 7)); +} + + +/* + Port 7 + + ---- x--- ID1 + ---- -x-- ID0 + ---- --x- battery low voltage + ---- ---x 5V detection +*/ + +READ8_MEMBER(svmu_state::p7_r) +{ + return (ioport("BATTERY")->read()<<1); +} + + +static ADDRESS_MAP_START(svmu_mem, AS_PROGRAM, 8, svmu_state) + AM_RANGE( 0x0000, 0xffff ) AM_READWRITE(prog_r, prog_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(svmu_io_mem, AS_IO, 8, svmu_state) + AM_RANGE( LC8670_PORT1, LC8670_PORT1 ) AM_READWRITE(p1_r, p1_w) + AM_RANGE( LC8670_PORT3, LC8670_PORT3 ) AM_READ_PORT("P3") + AM_RANGE( LC8670_PORT7, LC8670_PORT7 ) AM_READ(p7_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( svmu ) + PORT_START( "P3" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button A") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button B") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("MODE") PORT_CODE( KEYCODE_M ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("SLEEP") PORT_CODE( KEYCODE_S ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x01, "Battery" ) + PORT_CONFSETTING( 0x01, "Good" ) + PORT_CONFSETTING( 0x00, "Poor" ) +INPUT_PORTS_END + +void svmu_state::machine_reset() +{ + m_page = 0; +} + +PALETTE_INIT_MEMBER(svmu_state, svmu) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static LC8670_LCD_UPDATE( svmu_lcd_update ) +{ + if (lcd_enabled) + { + for (int y=0; y<32; y++) + for (int x=0; x<6; x++) + { + int gfx = vram[y*6 + x]; + + for (int b=0; b<8; b++) + bitmap.plot_box((x*8 + b) * (PIXEL_SIZE + PIXEL_DISTANCE), y * (PIXEL_SIZE + PIXEL_DISTANCE), PIXEL_SIZE, PIXEL_SIZE, BIT(gfx,7-b)); + } + } + else + { + bitmap.fill(0, cliprect); + } + + output_set_value("file_icon" , lcd_enabled ? BIT(vram[0xc1],6) : 0); + output_set_value("game_icon" , lcd_enabled ? BIT(vram[0xc2],4) : 0); + output_set_value("clock_icon", lcd_enabled ? BIT(vram[0xc3],2) : 0); + output_set_value("flash_icon", lcd_enabled ? BIT(vram[0xc4],0) : 0); + + return 0; +} + + +inline void vmufat_write_byte(UINT8* flash, UINT8 block, offs_t offset, UINT8 data) +{ + flash[(block * 512) + offset] = data; +} + +inline void vmufat_write_word(UINT8* flash, UINT8 block, offs_t offset, UINT16 data) +{ + // 16-bit data are stored in little endian + flash[(block * 512) + offset + 0] = data & 0xff; + flash[(block * 512) + offset + 1] = (data>>8) & 0xff; +} + +QUICKLOAD_LOAD_MEMBER( svmu_state, svmu ) +{ + UINT32 size = image.length(); + UINT8 *flash = (UINT8*)m_flash->space().get_read_ptr(0); + + image.fread(flash, size); + + // verify if image is already a valid VMUFAT file system + bool valid_vmufat = true; + if (size == 0x20000) + { + for (int i=0; i<0x10; i++) + if (flash[255 * 512 + i] != 0x55) + { + valid_vmufat = false; + break; + } + } + else + { + valid_vmufat = false; + } + + if (!valid_vmufat) + { + // more info about the VMUFAT here: http://mc.pp.se/dc/vms/flashmem.html + + //-------------------------------- Formatting -------------------------------- + memset(flash + 241*512, 0, 15*512); // clears the last 15 blocks that contain file system information + + for (int i=0; i<0x10; i++) + vmufat_write_byte(flash, 255, i, 0x55); // first 16 bytes should be 0x55 to indicate a properly formatted card + + vmufat_write_byte(flash, 255, 0x10, 0x00); // custom VMS colour (1 = use custom colours, 0 = standard colour) + vmufat_write_byte(flash, 255, 0x11, 0x00); // VMS colour blue component + vmufat_write_byte(flash, 255, 0x12, 0x00); // VMS colour green component + vmufat_write_byte(flash, 255, 0x13, 0x00); // VMS colour red component + vmufat_write_byte(flash, 255, 0x14, 0x00); // VMS colour alpha component + vmufat_write_byte(flash, 255, 0x30, 0x19); // Century (BCD) + vmufat_write_byte(flash, 255, 0x31, 0x99); // Year (BCD) + vmufat_write_byte(flash, 255, 0x32, 0x01); // Month (BCD) + vmufat_write_byte(flash, 255, 0x33, 0x01); // Day (BCD) + vmufat_write_byte(flash, 255, 0x34, 0x00); // Hour (BCD) + vmufat_write_byte(flash, 255, 0x35, 0x00); // Minute (BCD) + vmufat_write_byte(flash, 255, 0x36, 0x00); // Second (BCD) + vmufat_write_byte(flash, 255, 0x37, 0x00); // Day of week (0 = Monday, 6 = Sunday) + vmufat_write_word(flash, 255, 0x44, 0x00ff); // location of Root + vmufat_write_word(flash, 255, 0x46, 0x00fe); // location of FAT (254) + vmufat_write_word(flash, 255, 0x48, 0x0001); // size of FAT in blocks (1) + vmufat_write_word(flash, 255, 0x4a, 0x00fd); // location of Directory (253) + vmufat_write_word(flash, 255, 0x4c, 0x000d); // size of Directory in blocks (13) + vmufat_write_word(flash, 255, 0x4e, 0x0000); // icon shape for this VMS (0-123) + vmufat_write_word(flash, 255, 0x50, 0x00c8); // number of user blocks (200) + + for (int i=0; i<256; i++) + vmufat_write_word(flash, 254, i<<1, 0xfffc); // marks all blocks as unallocated + + for (int i=253; i>241; --i) + vmufat_write_word(flash, 254, i<<1, i - 1); // marsk all Directory blocks as allocate + + vmufat_write_word(flash, 254, 0x1e2, 0xfffa); // marks last Directory block + vmufat_write_word(flash, 254, 0x1fc, 0xfffa); // marks FAT block as allocated + vmufat_write_word(flash, 254, 0x1fe, 0xfffa); // marks Root block as allocated + + //-------------------------------- Create the vms file -------------------------------- + int vms_blocks = (size / 512) + (size & 0x1ff ? 1 : 0); // number of blocks required for store the vms file + + for (int i=0; i m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(swtpc_status_r); + DECLARE_READ8_MEMBER(swtpc_terminal_r); + DECLARE_READ8_MEMBER(swtpc_tricky_r); + DECLARE_WRITE8_MEMBER(swtpc_terminal_w); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_term_data; + virtual void machine_reset(); +}; + +// bit 0 - ready to receive a character; bit 1 - ready to send a character to the terminal +READ8_MEMBER( swtpc_state::swtpc_status_r ) +{ + return (m_term_data) ? 3 : 0x82; +} + +READ8_MEMBER( swtpc_state::swtpc_terminal_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( swtpc_state::swtpc_tricky_r ) +{ + UINT8 ret = m_term_data; + return ret; +} + +static ADDRESS_MAP_START(swtpc_mem, AS_PROGRAM, 8, swtpc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x8004, 0x8004 ) AM_READ(swtpc_status_r) + AM_RANGE( 0x8005, 0x8005 ) AM_READ(swtpc_terminal_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE( 0x8007, 0x8007 ) AM_READ(swtpc_tricky_r) + AM_RANGE( 0xa000, 0xa07f ) AM_RAM + AM_RANGE( 0xe000, 0xe3ff ) AM_MIRROR(0x1c00) AM_ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( swtpc ) +INPUT_PORTS_END + + +void swtpc_state::machine_reset() +{ +} + +WRITE8_MEMBER( swtpc_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( swtpc, swtpc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6800, XTAL_1MHz) + MCFG_CPU_PROGRAM_MAP(swtpc_mem) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(swtpc_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( swtpc ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "swt", "SWTBUG" ) + ROMX_LOAD( "swtbug.bin", 0xe000, 0x0400, CRC(f9130ef4) SHA1(089b2d2a56ce9526c3e78ce5d49ce368b9eabc0c), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "mik", "MIKBUG" ) + ROMX_LOAD( "mikbug.bin", 0xe000, 0x0400, CRC(e7f4d9d0) SHA1(5ad585218f9c9c70f38b3c74e3ed5dfe0357621c), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1975, swtpc, 0, 0, swtpc, swtpc, driver_device, 0, "Southwest Technical Products Corporation", "SWTPC 6800", MACHINE_NO_SOUND) diff --git a/src/mame/drivers/swtpc09.c b/src/mame/drivers/swtpc09.c new file mode 100644 index 00000000000..e1237b55a06 --- /dev/null +++ b/src/mame/drivers/swtpc09.c @@ -0,0 +1,265 @@ +// license:BSD-3-Clause +// copyright-holders:Robert Justice +/************************************************************************** + + SWTPC S/09 Mess driver + Robert Justice ,2009-2014 + + Emulates four different fixed combinations of hardware + 1. swtpc09 + MP-09 with SBUG rom, MP-ID, MP-S2, DMF2. + Will boot Flex operating system + 2. swtpc09i + MP-09 with SBUG rom + HDrom, MP-ID, MP-S2, DMF2, PIAIDE. + Will boot Flex operating system + TODO: finish ide part and get this one working. + 3. swtpc09u + MP-09 with UniBUG rom, MP-ID, MP-S2, DMF2. + Will boot UniFlex operating system + 4. swtpc09d3 + MP-09 with UniBUG U3 rom, MP-ID, MP-S2, DMF3. + Will boot UniFlex operating system + TODO: add Harddisk support, DMF3 has WD1000 interface + +***************************************************************************/ + +#include "emu.h" +#include "includes/swtpc09.h" +#include "formats/flex_dsk.h" + + +/************************************************************************** + Address maps + + 56K of RAM from 0x0000 to 0xdfff + 2K of ROM from 0xf800 to 0xffff + + E000 - E003 S2 MC6850 ACIA1 (used for UniFlex console) + E004 - E007 S2 MC6850 ACIA2 (used for Flex console) + E080 - E08F MPID MC6821 PIA + E090 - E09F MPID MC6840 PTM + + F000 - F01F DMF2 MC6844 DMAC + F020 - F023 DMF2 WD1791 FDC + F024 - F03F DMF2 Drive select register + F040 - F041 DMF2 DMA Address register + + F800 - FFFF ROM + FFF0 - FFFF DAT RAM (only for writes) + + + for DMF3 version + F000 - F01F DMF3 MC6844 DMAC + F020 - F023 DMF3 WD1791 FDC + F024 - F024 DMF3 Drive select register + F025 - F025 DMF3 DMA Address register + F040 - F04F DMF3 6522 VIA + +***************************************************************************/ + +/* Address map is dynamically setup when DAT memory is written to */ +/* only ROM from FF00-FFFF and DAT memory at FFF0-FFFF (write only) is guaranteed always*/ + +static ADDRESS_MAP_START(swtpc09_mem, AS_PROGRAM, 8, swtpc09_state) + AM_RANGE(0xff00, 0xffef) AM_ROM + AM_RANGE(0xfff0, 0xffff) AM_ROM AM_WRITE(dat_w) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( swtpc09 ) +INPUT_PORTS_END + +FLOPPY_FORMATS_MEMBER( swtpc09_state::floppy_formats ) + FLOPPY_FLEX_FORMAT +FLOPPY_FORMATS_END + +// todo: implement floppy controller cards as slot devices and do this properly +static SLOT_INTERFACE_START( swtpc09_floppies ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) // flex 40 trks ss sd 5.25 + SLOT_INTERFACE("sssd35", FLOPPY_525_SSSD_35T) // flex 35 trks ss sd 5.25 + SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) // flex 40 trks ss dd 5.25 + SLOT_INTERFACE("dd", FLOPPY_525_DD) // flex 40 trks ds dd 5.25 + SLOT_INTERFACE("8dssd", FLOPPY_8_DSSD) // UNIFlex 8 inch ds sd + SLOT_INTERFACE("8dsdd", FLOPPY_8_DSDD) // UNIFlex 8 inch ds dd + SLOT_INTERFACE("35hd", FLOPPY_35_HD) // flex 1.44mb disk from swtpc emu (emulator only?) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER(swtpc09_state::write_acia_clock) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + +/*************************************************************************** + Machine definitions +****************************************************************************/ + +/* Machine driver */ +/* MPU09, MPID, MPS2 DMF2 */ +static MACHINE_CONFIG_START( swtpc09, swtpc09_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809, 1000000) + MCFG_CPU_PROGRAM_MAP(swtpc09_mem) + + /* video hardware */ + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) + + MCFG_DEVICE_ADD("ptm", PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(2000000) + MCFG_PTM6840_EXTERNAL_CLOCKS(50, 0, 50) + MCFG_PTM6840_OUT0_CB(WRITE8(swtpc09_state, ptm_o1_callback)) + MCFG_PTM6840_OUT2_CB(WRITE8(swtpc09_state, ptm_o3_callback)) + MCFG_PTM6840_IRQ_CB(WRITELINE(swtpc09_state, ptm_irq)) + + MCFG_DEVICE_ADD("pia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_a_r)) + MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_ca1_r)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(swtpc09_state, pia0_irq_a)) + + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(swtpc09_state, acia_interrupt)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) + + MCFG_FD1793_ADD("fdc", XTAL_1MHz) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(swtpc09_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(swtpc09_state, fdc_drq_w)) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) +MACHINE_CONFIG_END + +/* MPU09, MPID, MPS2 DC4 PIAIDE*/ +static MACHINE_CONFIG_START( swtpc09i, swtpc09_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809, 1000000) + MCFG_CPU_PROGRAM_MAP(swtpc09_mem) + + /* video hardware */ + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) + + MCFG_DEVICE_ADD("ptm", PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(2000000) + MCFG_PTM6840_EXTERNAL_CLOCKS(50, 0, 50) + MCFG_PTM6840_OUT0_CB(WRITE8(swtpc09_state, ptm_o1_callback)) + MCFG_PTM6840_OUT2_CB(WRITE8(swtpc09_state, ptm_o3_callback)) + MCFG_PTM6840_IRQ_CB(WRITELINE(swtpc09_state, ptm_irq)) + + MCFG_DEVICE_ADD("pia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_a_r)) + MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_ca1_r)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(swtpc09_state, pia0_irq_a)) + + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(swtpc09_state, acia_interrupt)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) + + MCFG_FD1793_ADD("fdc", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + + MCFG_DEVICE_ADD("piaide", PIA6821, 0) + +/* old start to adding ide support, needs major updating */ +/* this is to support an add on card driving IDE from a PIA */ +// MCFG_HARDDISK_ADD("harddisk") +// MCFG_IDE_CONTROLLER_ADD("ide", NULL) +// MCFG_IDE_CONTROLLER_REGIONS("harddisk", NULL) +// MCFG_IDE_CONTROLLER_ADD( "ide", ide_intf, "hdd", NULL, false ) /* FIXME */ bebox +MACHINE_CONFIG_END + + +/* MPU09, MPID, MPS2 DMF3 */ +static MACHINE_CONFIG_START( swtpc09d3, swtpc09_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809, 2000000) + MCFG_CPU_PROGRAM_MAP(swtpc09_mem) + + /* video hardware */ + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) + + MCFG_DEVICE_ADD("ptm", PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(2000000) + MCFG_PTM6840_EXTERNAL_CLOCKS(50, 0, 50) + MCFG_PTM6840_OUT0_CB(WRITE8(swtpc09_state, ptm_o1_callback)) + MCFG_PTM6840_OUT2_CB(WRITE8(swtpc09_state, ptm_o3_callback)) + MCFG_PTM6840_IRQ_CB(WRITELINE(swtpc09_state, ptm_irq)) + + MCFG_DEVICE_ADD("pia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_a_r)) + MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_ca1_r)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(swtpc09_state, pia0_irq_a)) + + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(swtpc09_state, acia_interrupt)) + MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) + + MCFG_FD1793_ADD("fdc", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) + + MCFG_DEVICE_ADD("via", VIA6522, XTAL_4MHz / 4) + MCFG_VIA6522_READPA_HANDLER(READ8(swtpc09_state, dmf3_via_read_porta)) + MCFG_VIA6522_READPB_HANDLER(READ8(swtpc09_state, dmf3_via_read_portb)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(swtpc09_state, dmf3_via_write_porta)) + //MCFG_VIA6522_CA1_HANDLER(WRITELINE(swtpc09_state, dmf3_via_write_ca1)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(swtpc09_state, dmf3_via_irq)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( swtpc09 ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD ( "sbugh1-8.bin", 0xf800, 0x0800, CRC(10a045a7) SHA1(de547b77653951c7424a069520d52c5b0432e98d) ) +ROM_END + +ROM_START( swtpc09i ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD ( "hd-rom.bin", 0xe800, 0x0800, CRC(b898b4d7) SHA1(2806633eda7da4e9a243fc534f15526ee928b6bc) ) + ROM_LOAD ( "sbugh1-8.bin", 0xf800, 0x0800, CRC(10a045a7) SHA1(de547b77653951c7424a069520d52c5b0432e98d) ) +ROM_END + +ROM_START( swtpc09u ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD ( "unibug.bin", 0xf800, 0x0800, CRC(92e1cbf2) SHA1(db00f17ee9accdbfa1775fe0162d3556159b8e70) ) +ROM_END + +ROM_START( swtpc09d3 ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD ( "uos3.bin", 0xf800, 0x0800, CRC(e95eb3e0) SHA1(3e971d3b7e143bc87e4b506e18a8c928c089c25a) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, swtpc09, 0, 0, swtpc09, swtpc09, swtpc09_state, swtpc09, "SWTPC", "swtpc S/09 Sbug", MACHINE_NO_SOUND_HW) +COMP( 1980, swtpc09i, swtpc09, 0, swtpc09i, swtpc09, swtpc09_state, swtpc09i, "SWTPC", "swtpc S/09 Sbug + piaide", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1980, swtpc09u, swtpc09, 0, swtpc09, swtpc09, swtpc09_state, swtpc09u, "SWTPC", "swtpc S/09 UNIBug + DMF2", MACHINE_NO_SOUND_HW) +COMP( 1980, swtpc09d3, swtpc09, 0, swtpc09d3, swtpc09, swtpc09_state, swtpc09d3, "SWTPC", "swtpc S/09 UNIBug + DMF3", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/sym1.c b/src/mame/drivers/sym1.c new file mode 100644 index 00000000000..a302da4d0bb --- /dev/null +++ b/src/mame/drivers/sym1.c @@ -0,0 +1,372 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Synertek Systems Corp. SYM-1 + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/ram.h" +#include "sound/speaker.h" +#include "machine/mos6530n.h" +#include "machine/6522via.h" +#include "machine/74145.h" +#include "sym1.lh" + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +// SYM-1 main (and only) oscillator Y1 +#define SYM1_CLOCK XTAL_1MHz + +#define LED_REFRESH_DELAY attotime::from_usec(70) + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class sym1_state : public driver_device +{ +public: + sym1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_ram_1k(*this, "ram_1k"), + m_ram_2k(*this, "ram_2k"), + m_ram_3k(*this, "ram_3k"), + m_monitor(*this, "monitor"), + m_riot_ram(*this, "riot_ram"), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_ttl74145(*this, "ttl74145"), + m_row0(*this, "ROW-0"), + m_row1(*this, "ROW-1"), + m_row2(*this, "ROW-2"), + m_row3(*this, "ROW-3"), + m_wp(*this, "WP") { } + + required_shared_ptr m_ram_1k; + required_shared_ptr m_ram_2k; + required_shared_ptr m_ram_3k; + required_shared_ptr m_monitor; + required_shared_ptr m_riot_ram; + UINT8 m_riot_port_a; + UINT8 m_riot_port_b; + emu_timer *m_led_update; + DECLARE_DRIVER_INIT(sym1); + virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(led_refresh); + DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_0_w); + DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_1_w); + DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_2_w); + DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_3_w); + DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_4_w); + DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_5_w); + DECLARE_READ8_MEMBER(sym1_riot_a_r); + DECLARE_READ8_MEMBER(sym1_riot_b_r); + DECLARE_WRITE8_MEMBER(sym1_riot_a_w); + DECLARE_WRITE8_MEMBER(sym1_riot_b_w); + DECLARE_WRITE8_MEMBER(sym1_via2_a_w); + +protected: + required_device m_maincpu; + required_device m_ram; + required_device m_ttl74145; + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + required_ioport m_row3; + required_ioport m_wp; +}; + + +//************************************************************************** +// KEYBOARD INPUT & LED OUTPUT +//************************************************************************** + +WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_0_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 0); } +WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_1_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 1); } +WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_2_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 2); } +WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_3_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 3); } +WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_4_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 4); } +WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_5_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 5); } + +TIMER_CALLBACK_MEMBER( sym1_state::led_refresh ) +{ + output_set_digit_value(param, m_riot_port_a); +} + +READ8_MEMBER( sym1_state::sym1_riot_a_r ) +{ + int data = 0x7f; + + // scan keypad rows + if (!(m_riot_port_a & 0x80)) data &= m_row0->read(); + if (!(m_riot_port_b & 0x01)) data &= m_row1->read(); + if (!(m_riot_port_b & 0x02)) data &= m_row2->read(); + if (!(m_riot_port_b & 0x04)) data &= m_row3->read(); + + // determine column + if ( ((m_riot_port_a ^ 0xff) & (m_row0->read() ^ 0xff)) & 0x7f ) + data &= ~0x80; + + return data; +} + +READ8_MEMBER( sym1_state::sym1_riot_b_r ) +{ + int data = 0xff; + + // determine column + if ( ((m_riot_port_a ^ 0xff) & (m_row1->read() ^ 0xff)) & 0x7f ) + data &= ~0x01; + + if ( ((m_riot_port_a ^ 0xff) & (m_row2->read() ^ 0xff)) & 0x3f ) + data &= ~0x02; + + if ( ((m_riot_port_a ^ 0xff) & (m_row3->read() ^ 0xff)) & 0x1f ) + data &= ~0x04; + + data &= ~0x80; // else hangs 8b02 + + return data; +} + +WRITE8_MEMBER( sym1_state::sym1_riot_a_w ) +{ + logerror("%x: riot_a_w 0x%02x\n", m_maincpu->pc(), data); + + // save for later use + m_riot_port_a = data; +} + +WRITE8_MEMBER( sym1_state::sym1_riot_b_w ) +{ + logerror("%x: riot_b_w 0x%02x\n", m_maincpu->pc(), data); + + // save for later use + m_riot_port_b = data; + + // first 4 pins are connected to the 74145 + m_ttl74145->write(data & 0x0f); +} + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +static INPUT_PORTS_START( sym1 ) + PORT_START("ROW-0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 USR 0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 USR 4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 JUMP") PORT_CODE(KEYCODE_8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C CALC") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CR S DBL") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO LD P") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LD 2 LD 1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROW-1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 USR 1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 USR 5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 VER") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DEP") PORT_CODE(KEYCODE_D) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG SAV P") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SAV 2 SAV 1") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW-2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 USR 2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 USR 6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A ASCII") PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E EXEC") PORT_CODE(KEYCODE_E) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92 \xE2\x86\x90") PORT_CODE(KEYCODE_RIGHT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM WP") PORT_CODE(KEYCODE_F5) + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW-3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 USR 3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 USR 7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B B MOV") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F FILL") PORT_CODE(KEYCODE_F) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("IN4") /* IN4 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEBUG OFF") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEBUG ON") PORT_CODE(KEYCODE_F7) + + PORT_START("WP") + PORT_DIPNAME(0x01, 0x01, "6532 RAM WP") + PORT_DIPSETTING(0x00, DEF_STR(Off)) + PORT_DIPSETTING(0x01, DEF_STR(On)) + PORT_DIPNAME(0x02, 0x02, "1K RAM WP") + PORT_DIPSETTING(0x00, DEF_STR(Off)) + PORT_DIPSETTING(0x02, DEF_STR(On)) + PORT_DIPNAME(0x04, 0x04, "2K RAM WP") + PORT_DIPSETTING(0x00, DEF_STR(Off)) + PORT_DIPSETTING(0x04, DEF_STR(On)) + PORT_DIPNAME(0x08, 0x08, "3K RAM WP") + PORT_DIPSETTING(0x00, DEF_STR(Off)) + PORT_DIPSETTING(0x08, DEF_STR(On)) +INPUT_PORTS_END + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +/* + PA0: Write protect R6532 RAM + PA1: Write protect RAM 0x400-0x7ff + PA2: Write protect RAM 0x800-0xbff + PA3: Write protect RAM 0xc00-0xfff + */ +WRITE8_MEMBER( sym1_state::sym1_via2_a_w ) +{ + address_space &cpu0space = m_maincpu->space( AS_PROGRAM ); + + logerror("SYM1 VIA2 W 0x%02x\n", data); + + if ((m_wp->read() & 0x01) && !(data & 0x01)) { + cpu0space.nop_write(0xa600, 0xa67f); + } else { + cpu0space.install_write_bank(0xa600, 0xa67f, "bank5"); + } + if ((m_wp->read() & 0x02) && !(data & 0x02)) { + cpu0space.nop_write(0x0400, 0x07ff); + } else { + cpu0space.install_write_bank(0x0400, 0x07ff, "bank2"); + } + if ((m_wp->read() & 0x04) && !(data & 0x04)) { + cpu0space.nop_write(0x0800, 0x0bff); + } else { + cpu0space.install_write_bank(0x0800, 0x0bff, "bank3"); + } + if ((m_wp->read() & 0x08) && !(data & 0x08)) { + cpu0space.nop_write(0x0c00, 0x0fff); + } else { + cpu0space.install_write_bank(0x0c00, 0x0fff, "bank4"); + } +} + +DRIVER_INIT_MEMBER( sym1_state, sym1 ) +{ + // wipe expansion memory banks that are not installed + if (m_ram->size() < 4*1024) + { + m_maincpu->space(AS_PROGRAM).nop_readwrite(m_ram->size(), 0x0fff); + } + + // allocate a timer to refresh the led display + m_led_update = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sym1_state::led_refresh), this)); +} + +void sym1_state::machine_reset() +{ + // make 0xf800 to 0xffff point to the last half of the monitor ROM + // so that the CPU can find its reset vectors + m_maincpu->space(AS_PROGRAM).install_read_bank(0xf800, 0xffff, "bank1"); + m_maincpu->space(AS_PROGRAM).nop_write(0xf800, 0xffff); + membank("bank1")->set_base(m_monitor + 0x800); + m_maincpu->reset(); +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( sym1_map, AS_PROGRAM, 8, sym1_state ) + AM_RANGE(0x0000, 0x03ff) AM_RAM // U12/U13 RAM + AM_RANGE(0x0400, 0x07ff) AM_RAMBANK("bank2") AM_SHARE("ram_1k") + AM_RANGE(0x0800, 0x0bff) AM_RAMBANK("bank3") AM_SHARE("ram_2k") + AM_RANGE(0x0c00, 0x0fff) AM_RAMBANK("bank4") AM_SHARE("ram_3k") + AM_RANGE(0x8000, 0x8fff) AM_ROM AM_SHARE("monitor") // U20 Monitor ROM + AM_RANGE(0xa000, 0xa00f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) // U25 VIA #1 + AM_RANGE(0xa400, 0xa41f) AM_DEVICE("riot", mos6532_t, io_map) // U27 RIOT + AM_RANGE(0xa600, 0xa67f) AM_RAMBANK("bank5") AM_SHARE("riot_ram") // U27 RIOT RAM + AM_RANGE(0xa800, 0xa80f) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) // U28 VIA #2 + AM_RANGE(0xac00, 0xac0f) AM_DEVREADWRITE("via6522_2", via6522_device, read, write) // U29 VIA #3 + AM_RANGE(0xb000, 0xefff) AM_ROM +ADDRESS_MAP_END + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +static MACHINE_CONFIG_START( sym1, sym1_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", M6502, SYM1_CLOCK) + MCFG_CPU_PROGRAM_MAP(sym1_map) + + MCFG_DEFAULT_LAYOUT(layout_sym1) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + // devices + MCFG_DEVICE_ADD("riot", MOS6532n, SYM1_CLOCK) + MCFG_MOS6530n_IN_PA_CB(READ8(sym1_state, sym1_riot_a_r)) + MCFG_MOS6530n_OUT_PA_CB(WRITE8(sym1_state, sym1_riot_a_w)) + MCFG_MOS6530n_IN_PB_CB(READ8(sym1_state, sym1_riot_b_r)) + MCFG_MOS6530n_OUT_PB_CB(WRITE8(sym1_state, sym1_riot_b_w)) + + MCFG_DEVICE_ADD("ttl74145", TTL74145, 0) + MCFG_TTL74145_OUTPUT_LINE_0_CB(WRITELINE(sym1_state, sym1_74145_output_0_w)) + MCFG_TTL74145_OUTPUT_LINE_1_CB(WRITELINE(sym1_state, sym1_74145_output_1_w)) + MCFG_TTL74145_OUTPUT_LINE_2_CB(WRITELINE(sym1_state, sym1_74145_output_2_w)) + MCFG_TTL74145_OUTPUT_LINE_3_CB(WRITELINE(sym1_state, sym1_74145_output_3_w)) + MCFG_TTL74145_OUTPUT_LINE_4_CB(WRITELINE(sym1_state, sym1_74145_output_4_w)) + MCFG_TTL74145_OUTPUT_LINE_5_CB(WRITELINE(sym1_state, sym1_74145_output_5_w)) + MCFG_TTL74145_OUTPUT_LINE_6_CB(DEVWRITELINE("speaker", speaker_sound_device, level_w)) + // lines 7-9 not connected + + MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) + + MCFG_DEVICE_ADD("via6522_1", VIA6522, 0) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) + + MCFG_DEVICE_ADD("via6522_2", VIA6522, 0) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(sym1_state, sym1_via2_a_w)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("1K,2K,3K") +MACHINE_CONFIG_END + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( sym1 ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "ver10", "Version 1.0") + ROMX_LOAD("symon1_0.bin", 0x8000, 0x1000, CRC(97928583) SHA1(6ac52c54adb7a086d51bc7f6d55dd30ab3a0a331), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "ver11", "Version 1.1") + ROMX_LOAD("symon1_1.bin", 0x8000, 0x1000, CRC(7a4b1e12) SHA1(cebdf815105592658cfb7af262f2101d2aeab786), ROM_BIOS(2)) + ROM_LOAD("rae_b000", 0xb000, 0x1000, CRC(f6429326) SHA1(6f2f10649b54f54217bb35c8c453b5d05434bd86) ) + ROM_LOAD("bas_c000", 0xc000, 0x1000, CRC(c168fe70) SHA1(7447a5e229140cbbde4cf90886966a5d93aa24e1) ) + ROM_LOAD("bas_d000", 0xd000, 0x1000, CRC(8375a978) SHA1(240301bf8bb8ddb99b65a585f17895e1ad872631) ) + ROM_LOAD("rae_e000", 0xe000, 0x1000, CRC(2255444b) SHA1(c7dd812962c2e2edd2faa7055e9cce4e769c0388) ) +ROM_END + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1978, sym1, 0, 0, sym1, sym1, sym1_state, sym1, "Synertek Systems Corp.", "SYM-1/SY-VIM-1", 0 ) diff --git a/src/mame/drivers/sys2900.c b/src/mame/drivers/sys2900.c new file mode 100644 index 00000000000..9f71bb44bbb --- /dev/null +++ b/src/mame/drivers/sys2900.c @@ -0,0 +1,146 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + System 2900 + + 12/05/2009 Skeleton driver. + + The system contains 4 S100 boards, 2 8" floppies, enormous power supply, + 1/4" thick mother board, 4 RS232 I/F boards, and an Australian made + "Computer Patch Board". + The S100 boards that make up the unit are: + CPU board - Model CPC2810 Rev D + The board has a Z80A CPU, CTC, PIO, DART and SIO. + U16 (24 pin) is missing (boot EPROM?). + It has a lot of jumpers and an 8 way DIP switch. + Memory board - Model HDM2800 Rev B + This contains 18 4164's and a lot of logic. + Again, a lot of jumpers, and several banks of links. + Also contains 2 Motorola chips I cannot identify, + MC3480P (24 pin) and MC3242AP (28 pin). + (I have searched the Motorola site and the Chip + Directory; nothing even close.) + Disk Controller board - Model FDC2800 Rev D + This board is damaged. The small voltage regulators + for +/- 12V have been fried. + Also, 3 sockets are empty - U1 and U38 (16 pin) + appear to be spares, and U10 (14 pin). + 8 port Serial I/O board - Model INO2808 Rev C + Room for 8 8251 USART's. + I have traced out this board and managed to get it + working in another S100 system. + The "Computer Patch Board" seems to provide some sort of watch dog + facility. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + + +class sys2900_state : public driver_device +{ +public: + enum + { + TIMER_BOOT + }; + + sys2900_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_DRIVER_INIT(sys2900); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_sys2900(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +static ADDRESS_MAP_START(sys2900_mem, AS_PROGRAM, 8, sys2900_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("boot") + AM_RANGE( 0x0800, 0xefff ) AM_RAM + AM_RANGE( 0xf000, 0xf7ff ) AM_ROM + AM_RANGE( 0xf800, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(sys2900_io, AS_IO, 8, sys2900_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( sys2900 ) +INPUT_PORTS_END + + +void sys2900_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BOOT: + /* after the first 4 bytes have been read from ROM, switch the ram back in */ + membank("boot")->set_entry(0); + break; + default: + assert_always(FALSE, "Unknown id in sys2900_state::device_timer"); + } +} + +void sys2900_state::machine_reset() +{ + membank("boot")->set_entry(1); + timer_set(attotime::from_usec(5), TIMER_BOOT); +} + +DRIVER_INIT_MEMBER(sys2900_state,sys2900) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf000); +} + +void sys2900_state::video_start() +{ +} + +UINT32 sys2900_state::screen_update_sys2900(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( sys2900, sys2900_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(sys2900_mem) + MCFG_CPU_IO_MAP(sys2900_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(sys2900_state, screen_update_sys2900) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( sys2900 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "104401cpc.bin", 0xf000, 0x0800, CRC(6c8848bc) SHA1(890e0578e5cb0e3433b4b173e5ed71d72a92af26)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1981, sys2900, 0, 0, sys2900, sys2900, sys2900_state, sys2900, "Systems Group", "System 2900", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/systec.c b/src/mame/drivers/systec.c new file mode 100644 index 00000000000..28848f3e2b9 --- /dev/null +++ b/src/mame/drivers/systec.c @@ -0,0 +1,123 @@ +// license:BSD-3-Clause +// copyright-holders: Miodrag Milanovic, Robbbert +/*************************************************************************** + + Systec Z80 + + More data : + http://www.hd64180-cpm.de/html/systecz80.html + + 30/08/2010 Skeleton driver + + Systec Platine 1 + + SYSTEC 155.1L + EPROM 2764 CP/M LOADER 155 / 9600 Baud + Z8400APS CPU + Z8420APS PIO + Z8430APS CTC + Z8470APS DART + + Systec Platine 2 + + SYSTEC 100.3B + MB8877A FDC Controller + FDC9229BT SMC 8608 + Z8410APS DMA + Z8420APS PIO + + MB8877A Compatible FD1793 + + 2011-12-22 connected to a terminal [Robbbert] + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class systec_state : public driver_device +{ +public: + systec_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(systec_c4_r); + DECLARE_READ8_MEMBER(systec_c6_r); + DECLARE_WRITE8_MEMBER( kbd_put ); + UINT8 m_term_data; + virtual void machine_reset(); +}; + +READ8_MEMBER( systec_state::systec_c4_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( systec_state::systec_c6_r ) +{ + return 0x04 | (m_term_data ? 1 : 0); +} + +WRITE8_MEMBER( systec_state::kbd_put ) +{ + m_term_data = data; +} + +static ADDRESS_MAP_START(systec_mem, AS_PROGRAM, 8, systec_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_RAM AM_REGION("maincpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(systec_io, AS_IO, 8, systec_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xc4, 0xc4) AM_READ(systec_c4_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0xc6, 0xc6) AM_READ(systec_c6_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( systec ) +INPUT_PORTS_END + +void systec_state::machine_reset() +{ + UINT8 *m_p_maincpu = memregion("maincpu")->base(); + UINT8 *m_p_roms = memregion("roms")->base(); + memcpy(m_p_maincpu, m_p_roms, 0x2000); +} + +static MACHINE_CONFIG_START( systec, systec_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(systec_mem) + MCFG_CPU_IO_MAP(systec_io) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(systec_state, kbd_put)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( systec ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x10000, "roms", 0 ) + ROM_LOAD( "systec.bin", 0x0000, 0x2000, CRC(967108ab) SHA1(a414db032ca7db0f9fdbe22aa68a099a93efb593)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP(19??, systec, 0, 0, systec, systec, driver_device, 0, "Systec", "Systec Z80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/tamag1.c b/src/mame/drivers/tamag1.c new file mode 100644 index 00000000000..7b0a73509a5 --- /dev/null +++ b/src/mame/drivers/tamag1.c @@ -0,0 +1,170 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + Bandai Tamagotchi generation 1 hardware + * PCB label TMG-M1 + * Seiko Epson E0C6S46 MCU under epoxy + +***************************************************************************/ + +#include "emu.h" +#include "cpu/e0c6200/e0c6s46.h" +#include "sound/speaker.h" + +#include "tama.lh" + + +class tamag1_state : public driver_device +{ +public: + tamag1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker") + { } + + required_device m_maincpu; + required_device m_speaker; + + DECLARE_WRITE8_MEMBER(speaker_w); + + DECLARE_PALETTE_INIT(tama); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + + +/*************************************************************************** + + Video + +***************************************************************************/ + +static E0C6S46_PIXEL_UPDATE_CB(tama_pixel_update) +{ + // 16 COM(common) pins, 40 SEG(segment) pins from MCU, + // 32x16 LCD screen: + static const int seg2x[0x28] = + { + 0, 1, 2, 3, 4, 5, 6, 7, + 35, 8, 9,10,11,12,13,14, + 15,34,33,32,31,30,29,28, + 27,26,25,24,36,23,22,21, + 20,19,18,17,16,37,38,39 + }; + + int y = com, x = seg2x[seg]; + if (cliprect.contains(x, y)) + bitmap.pix16(y, x) = state; + + // 2 rows of indicators: + // above screen: 0:meal, 1:lamp, 2:play, 3:medicine + // under screen: 4:bath, 5:scales, 6:shout, 7:attention + + // they are on pin SEG8(x=35) + COM0-3, pin SEG28(x=36) + COM12-15 + if (x == 35 && y < 4) + output_set_lamp_value(y, state); + else if (x == 36 && y >= 12) + output_set_lamp_value(y-8, state); + + // output for svg2lay + char buf[0x10]; + sprintf(buf, "%d.%d", y, x); + output_set_value(buf, state); +} + +PALETTE_INIT_MEMBER(tamag1_state, tama) +{ + palette.set_pen_color(0, rgb_t(0xf1, 0xf0, 0xf9)); // background + palette.set_pen_color(1, rgb_t(0x3c, 0x38, 0x38)); // lcd pixel +} + + + +/*************************************************************************** + + I/O + +***************************************************************************/ + +WRITE8_MEMBER(tamag1_state::speaker_w) +{ + // R43: speaker out + m_speaker->level_w(data >> 3 & 1); +} + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +INPUT_CHANGED_MEMBER(tamag1_state::input_changed) +{ + // inputs are hooked up backwards here, because MCU input + // ports are all tied to its interrupt controller + int line = (int)(FPTR)param; + int state = newval ? ASSERT_LINE : CLEAR_LINE; + m_maincpu->set_input_line(line, state); +} + +static INPUT_PORTS_START( tama ) + PORT_START("K0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tamag1_state, input_changed, (void *)E0C6S46_LINE_K00) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tamag1_state, input_changed, (void *)E0C6S46_LINE_K01) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tamag1_state, input_changed, (void *)E0C6S46_LINE_K02) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +static MACHINE_CONFIG_START( tama, tamag1_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", E0C6S46, XTAL_32_768kHz) + MCFG_E0C6S46_PIXEL_UPDATE_CB(tama_pixel_update) + MCFG_E0C6S46_WRITE_R_CB(4, WRITE8(tamag1_state, speaker_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(XTAL_32_768kHz/1024) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(40, 16) + MCFG_SCREEN_VISIBLE_AREA(0, 32-1, 0, 16-1) + MCFG_DEFAULT_LAYOUT(layout_tama) + MCFG_SCREEN_UPDATE_DEVICE("maincpu", e0c6s46_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(tamag1_state, tama) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( tama ) + ROM_REGION( 0x3000, "maincpu", 0 ) + ROM_LOAD( "test.b", 0x0000, 0x3000, CRC(4372220e) SHA1(6e13d015113e16198c0059b9d0c38d7027ae7324) ) // this rom is on the die too, test pin enables it? + ROM_LOAD( "tama.b", 0x0000, 0x3000, CRC(5c864cb1) SHA1(4b4979cf92dc9d2fb6d7295a38f209f3da144f72) ) +ROM_END + + +CONS( 1997, tama, 0, 0, tama, tama, driver_device, 0, "Bandai", "Tamagotchi (USA)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tandy1t.c b/src/mame/drivers/tandy1t.c new file mode 100644 index 00000000000..d770b3f8c72 --- /dev/null +++ b/src/mame/drivers/tandy1t.c @@ -0,0 +1,819 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/* +Tandy 1000 +========== + +Tandy 1000 machines are similar to the IBM 5160s with CGA graphics. Tandy +added some additional graphic capabilities similar, but not equal, to +those added for the IBM PC Jr. + +Tandy 1000 (8088) variations: +1000 128KB-640KB RAM 4.77 MHz v01.00.00, v01.01.00 +1000A/1000HD 128KB-640KB RAM 4.77 MHz v01.01.00 +1000SX/1000AX 384KB-640KB RAM 7.16/4.77 MHz v01.02.00 +1000EX 256KB-640KB RAM 7.16/4.77 MHz v01.02.00 +1000HX 256KB-640KB RAM 7.16/4.77 MHz v02.00.00 + +Tandy 1000 (8086) variations: +1000RL/1000RL-HD 512KB-768KB RAM 9.44/4.77 MHz v02.00.00, v02.00.01 +1000SL/1000PC 384KB-640KB RAM 8.0/4.77 MHz v01.04.00, v01.04.01, v01.04.02, v02.00.01 +1000SL/2 512KB-640KB RAM 8.0/4.77 MHz v01.04.04 + +Tandy 1000 (80286) variations: +1000TX 640KB-768KB RAM 8.0/4.77 MHz v01.03.00 +1000TL 640KB-768KB RAM 8.0/4.77 MHz v01.04.00, v01.04.01, v01.04.02 +1000TL/2 640KB-768KB RAM 8.0/4.77 MHz v02.00.00 +1000TL/3 640KB-768KB RAM 10.0/5.0 MHz v02.00.00 +1000RLX 512KB-1024KB RAM 10.0/5.0 MHz v02.00.00 +1000RLX-HD 1024MB RAM 10.0/5.0 MHz v02.00.00 + +Tandy 1000 (80386) variations: +1000RSX/1000RSX-HD 1M-9M RAM 25.0/8.0 MHz v01.10.00 */ + +#include "emu.h" +#include "includes/genpc.h" +#include "machine/pckeybrd.h" +#include "machine/nvram.h" +#include "machine/pc_fdc.h" +#include "video/pc_t1t.h" +#include "sound/sn76496.h" +#include "cpu/i86/i86.h" +#include "cpu/i86/i286.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" + +class tandy1000_state : public driver_device +{ +public: + tandy1000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_romcs0(*this, "romcs0") + , m_romcs1(*this, "romcs1") + , m_biosbank(*this, "biosbank") + , m_keyboard(*this, "pc_keyboard") + , m_mb(*this, "mb") { } + + required_device m_maincpu; + +// Memory regions for the machines that support rom banking + optional_memory_region m_romcs0; + optional_memory_region m_romcs1; + optional_memory_bank m_biosbank; + + required_device m_keyboard; + required_device m_mb; + + DECLARE_WRITE8_MEMBER ( pc_t1t_p37x_w ); + DECLARE_READ8_MEMBER ( pc_t1t_p37x_r ); + + DECLARE_WRITE8_MEMBER ( tandy1000_pio_w ); + DECLARE_READ8_MEMBER(tandy1000_pio_r); + DECLARE_READ8_MEMBER( tandy1000_bank_r ); + DECLARE_WRITE8_MEMBER( tandy1000_bank_w ); + + int tandy1000_read_eeprom(); + void tandy1000_write_eeprom(UINT8 data); + void tandy1000_set_bios_bank(); + + DECLARE_DRIVER_INIT(t1000hx); + DECLARE_DRIVER_INIT(t1000sl); + + DECLARE_MACHINE_RESET(tandy1000rl); + + struct + { + UINT8 low, high; + } m_eeprom_ee[0x40]; /* only 0 to 4 used in hx, addressing seems to allow this */ + + int m_eeprom_state; + int m_eeprom_clock; + UINT8 m_eeprom_oper; + UINT16 m_eeprom_data; + + UINT8 m_tandy_data[8]; + + UINT8 m_tandy_bios_bank; /* I/O port FFEAh */ + UINT8 m_tandy_ppi_portb, m_tandy_ppi_portc; +}; + +/* tandy 1000 eeprom + hx and later + clock, and data out lines at 0x37c + data in at 0x62 bit 4 (0x10) + + 8x read 16 bit word at x + 30 cx 30 4x 16bit 00 write 16bit at x +*/ + +int tandy1000_state::tandy1000_read_eeprom() +{ + if ((m_eeprom_state>=100)&&(m_eeprom_state<=199)) + return m_eeprom_data&0x8000; + return 1; +} + +void tandy1000_state::tandy1000_write_eeprom(UINT8 data) +{ + if (!m_eeprom_clock && (data&4) ) + { +// logerror("!!!tandy1000 eeprom %.2x %.2x\n",m_eeprom_state, data); + switch (m_eeprom_state) + { + case 0: + if ((data&3)==0) m_eeprom_state++; + break; + case 1: + if ((data&3)==2) m_eeprom_state++; + break; + case 2: + if ((data&3)==3) m_eeprom_state++; + break; + case 3: + m_eeprom_oper=data&1; + m_eeprom_state++; + break; + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + m_eeprom_oper=(m_eeprom_oper<<1)|(data&1); + m_eeprom_state++; + break; + case 10: + m_eeprom_oper=(m_eeprom_oper<<1)|(data&1); + logerror("!!!tandy1000 eeprom %.2x\n",m_eeprom_oper); + if ((m_eeprom_oper&0xc0)==0x80) + { + m_eeprom_state=100; + m_eeprom_data=m_eeprom_ee[m_eeprom_oper&0x3f].low + |(m_eeprom_ee[m_eeprom_oper&0x3f].high<<8); + logerror("!!!tandy1000 eeprom read %.2x,%.4x\n",m_eeprom_oper,m_eeprom_data); + } + else if ((m_eeprom_oper&0xc0)==0x40) + { + m_eeprom_state=200; + } + else + m_eeprom_state=0; + break; + + /* read 16 bit */ + case 100: + m_eeprom_state++; + break; + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + case 113: + case 114: + case 115: + m_eeprom_data<<=1; + m_eeprom_state++; + break; + case 116: + m_eeprom_data<<=1; + m_eeprom_state=0; + break; + + /* write 16 bit */ + case 200: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 208: + case 209: + case 210: + case 211: + case 212: + case 213: + case 214: + m_eeprom_data=(m_eeprom_data<<1)|(data&1); + m_eeprom_state++; + break; + case 215: + m_eeprom_data=(m_eeprom_data<<1)|(data&1); + logerror("tandy1000 %.2x %.4x written\n",m_eeprom_oper,m_eeprom_data); + m_eeprom_ee[m_eeprom_oper&0x3f].low=m_eeprom_data&0xff; + m_eeprom_ee[m_eeprom_oper&0x3f].high=m_eeprom_data>>8; + m_eeprom_state=0; + break; + } + } + m_eeprom_clock=data&4; +} + +WRITE8_MEMBER( tandy1000_state::pc_t1t_p37x_w ) +{ +// DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", space.device().safe_pc( ),offset, data)); + if (offset!=4) + logerror("T1T_p37x_w %.5x #%d $%02x\n", space.device().safe_pc( ),offset, data); + m_tandy_data[offset]=data; + switch( offset ) + { + case 4: + tandy1000_write_eeprom(data); + break; + } +} + +READ8_MEMBER( tandy1000_state::pc_t1t_p37x_r ) +{ + int data = m_tandy_data[offset]; +// DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", space.device().safe_pc( ), offset, data)); + return data; +} + +/* this is for tandy1000hx + hopefully this works for all x models + must not be a ppi8255 chip + (think custom chip) + port c: + bit 4 input eeprom data in + bit 3 output turbo mode +*/ + +WRITE8_MEMBER( tandy1000_state::tandy1000_pio_w ) +{ + switch (offset) + { + case 1: + m_tandy_ppi_portb = data; + m_mb->m_pit8253->write_gate2(BIT(data, 0)); + m_mb->pc_speaker_set_spkrdata( data & 0x02 ); + // sx enables keyboard from bit 3, others bit 6, hopefully theres no conflict + m_keyboard->enable(data&0x48); + if ( data & 0x80 ) + m_mb->m_pic8259->ir1_w(0); + break; + case 2: + m_tandy_ppi_portc = data; + if (data & 8) + m_maincpu->set_clock_scale(1); + else + m_maincpu->set_clock_scale(4.77/8); + break; + } +} + +READ8_MEMBER(tandy1000_state::tandy1000_pio_r) +{ + int data=0xff; + switch (offset) + { + case 0: + data = m_keyboard->read(space, 0); + break; + case 1: + data=m_tandy_ppi_portb; + break; + case 2: +// if (tandy1000hx) { +// data=m_tandy_ppi_portc; // causes problems (setuphx) + if (!tandy1000_read_eeprom()) data&=~0x10; +// } + break; + } + return data; +} + + +void tandy1000_state::tandy1000_set_bios_bank() +{ + UINT8 *p = NULL; + + assert( m_romcs0 != NULL ); + assert( m_romcs1 != NULL ); + assert( m_biosbank != NULL ); + + if ( m_tandy_bios_bank & 0x10 ) + { + if ( m_tandy_bios_bank & 0x04 ) + { + p = m_romcs0->base() + ( m_tandy_bios_bank & 0x03 ) * 0x10000; + } + else + { + p = m_romcs1->base() + ( m_tandy_bios_bank & 0x03 ) * 0x10000; + } + } + else + { + if ( m_tandy_bios_bank & 0x08 ) + { + p = m_romcs0->base() + ( m_tandy_bios_bank & 0x07 ) * 0x10000; + } + else + { + p = m_romcs1->base() + ( m_tandy_bios_bank & 0x07 ) * 0x10000; + } + } + + m_biosbank->set_base( p ); +} + +MACHINE_RESET_MEMBER(tandy1000_state, tandy1000rl) +{ + m_tandy_bios_bank = 6; + tandy1000_set_bios_bank(); +} + +DRIVER_INIT_MEMBER(tandy1000_state,t1000hx) +{ + machine().device("nvram")->set_base(m_eeprom_ee, sizeof(m_eeprom_ee)); +} + + +DRIVER_INIT_MEMBER(tandy1000_state,t1000sl) +{ + // Fix up memory region (highest address bit flipped??) + UINT8 *rom = memregion("romcs0")->base(); + + for( int i = 0; i < 0x40000; i++ ) + { + UINT8 d = rom[0x40000 + i]; + rom[0x40000 + i] = rom[i]; + rom[i] = d; + } + + DRIVER_INIT_NAME(t1000hx)(); +} + + +READ8_MEMBER( tandy1000_state::tandy1000_bank_r ) +{ + UINT8 data = 0xFF; + + logerror( "%s: tandy1000_bank_r: offset = %x\n", space.machine().describe_context(), offset ); + + switch( offset ) + { + case 0x00: /* FFEA */ + data = m_tandy_bios_bank ^ 0x10; // Bit 4 is read back inverted + break; + } + + return data; +} + + +WRITE8_MEMBER( tandy1000_state::tandy1000_bank_w ) +{ + logerror( "%s: tandy1000_bank_w: offset = %x, data = %02x\n", space.machine().describe_context(), offset, data ); + + switch( offset ) + { + case 0x00: /* FFEA */ + m_tandy_bios_bank = data; + tandy1000_set_bios_bank(); + break; + + // UART clock, joystick, and sound enable + // bit 0 - 0 = Clock divided by 13 + // 1 = Clock divided by 1 + // bit 1 - 0 = Disable joystick + // 1 = Enable joystick + // bit 2 - 0 = Disable Sound Chip + // 1 = Enable Sound Chip + case 0x01: + break; + } +} + +static INPUT_PORTS_START( tandy1t ) + PORT_START("IN0") /* IN0 */ + PORT_BIT ( 0xf0, 0xf0, IPT_UNUSED ) + PORT_BIT ( 0x08, 0x08, IPT_CUSTOM ) PORT_VBLANK("pcvideo_t1000:screen") + PORT_BIT ( 0x07, 0x07, IPT_UNUSED ) + + PORT_START("DSW0") /* IN1 */ + PORT_BIT ( 0xff, 0xff, IPT_UNUSED ) + + PORT_START("DSW1") /* IN2 */ + PORT_DIPNAME( 0x80, 0x80, "COM1: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x40, 0x40, "COM2: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) + PORT_BIT ( 0x30, 0x00, IPT_UNUSED ) + PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_BIT ( 0x06, 0x00, IPT_UNUSED ) + PORT_DIPNAME( 0x01, 0x00, "Game port enable") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) + + PORT_START("DSW2") /* IN3 */ + PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) + PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ + PORT_BIT( 0x01, 0x01, IPT_UNUSED ) + + PORT_INCLUDE(pc_keyboard) + + PORT_MODIFY("pc_keyboard_2") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) /* 29 A9 */ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) /* 2B AB */ + + PORT_MODIFY("pc_keyboard_3") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE /* Caps Lock 3A BA */ + + PORT_MODIFY("pc_keyboard_4") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) PORT_TOGGLE /* Num Lock 45 C5 */ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 7 \\") PORT_CODE(KEYCODE_7_PAD) /* Keypad 7 47 C7 */ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 8 ~") PORT_CODE(KEYCODE_8_PAD) /* Keypad 8 48 C8 */ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 9 (PgUp)") PORT_CODE(KEYCODE_9_PAD) /* Keypad 9 (PgUp) 49 C9 */ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) /* 4A CA */ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 4 |") PORT_CODE(KEYCODE_4_PAD) /* Keypad 4 4B CB */ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 6") PORT_CODE(KEYCODE_6_PAD) /* Keypad 6 4D CD */ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /* 4E CE */ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 1 (End)") PORT_CODE(KEYCODE_1_PAD) /* Keypad 1 (End) 4F CF */ + + PORT_MODIFY("pc_keyboard_5") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 2 `") PORT_CODE(KEYCODE_2_PAD) /* Keypad 2 50 D0 */ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 3 (PgDn)") PORT_CODE(KEYCODE_3_PAD) /* Keypad 3 (PgDn) 51 D1 */ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 0") PORT_CODE(KEYCODE_0_PAD) /* Keypad 0 52 D2 */ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP - (Del)") PORT_CODE(KEYCODE_MINUS_PAD) /* - Delete 53 D3 */ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_STOP) /* Break 54 D4 */ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ Insert") PORT_CODE(KEYCODE_PLUS_PAD) /* + Insert 55 D5 */ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) /* . 56 D6 */ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* Enter 57 D7 */ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* HOME 58 D8 */ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) /* F11 59 D9 */ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) /* F12 5a Da */ +INPUT_PORTS_END + +static ADDRESS_MAP_START(tandy1000_map, AS_PROGRAM, 8, tandy1000_state ) + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xaffff) AM_RAM + AM_RANGE(0xb0000, 0xb7fff) AM_NOP + AM_RANGE(0xb8000, 0xbffff) AM_DEVREADWRITE("pcvideo_t1000", pcvideo_t1000_device, videoram_r, videoram_w); + AM_RANGE(0xc0000, 0xc7fff) AM_NOP + AM_RANGE(0xc8000, 0xc9fff) AM_ROM + AM_RANGE(0xca000, 0xcffff) AM_NOP + AM_RANGE(0xd0000, 0xeffff) AM_NOP + AM_RANGE(0xf0000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tandy1000_io, AS_IO, 8, tandy1000_state ) + AM_RANGE(0x0060, 0x0063) AM_READWRITE(tandy1000_pio_r, tandy1000_pio_w) + AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", ncr7496_device, write) + AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("pc_joy", pc_joy_device, joy_port_r, joy_port_w) + AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r, pc_t1t_p37x_w) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE("pcvideo_t1000", pcvideo_t1000_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tandy1000_16_map, AS_PROGRAM, 16, tandy1000_state ) + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xaffff) AM_RAM + AM_RANGE(0xb0000, 0xb7fff) AM_NOP + AM_RANGE(0xb8000, 0xbffff) AM_DEVREADWRITE8("pcvideo_t1000", pcvideo_t1000_device, videoram_r, videoram_w, 0xffff) + AM_RANGE(0xc0000, 0xc7fff) AM_NOP + AM_RANGE(0xc8000, 0xc9fff) AM_ROM + AM_RANGE(0xca000, 0xcffff) AM_NOP + AM_RANGE(0xe0000, 0xeffff) AM_ROMBANK("biosbank") /* Banked part of the BIOS */ + AM_RANGE(0xf0000, 0xfffff) AM_ROM AM_REGION( "romcs0", 0x70000 ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tandy1000_16_io, AS_IO, 16, tandy1000_state ) + AM_RANGE(0x0060, 0x0063) AM_READWRITE8(tandy1000_pio_r, tandy1000_pio_w, 0xffff) + AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496", ncr7496_device, write, 0xffff) + AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) + AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_t1t_p37x_r, pc_t1t_p37x_w, 0xffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("pcvideo_t1000", pcvideo_t1000_device, read, write, 0xffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tandy1000_16_bank_io, AS_IO, 16, tandy1000_state ) + AM_IMPORT_FROM(tandy1000_16_io) + AM_RANGE(0xffea, 0xffeb) AM_READWRITE8(tandy1000_bank_r, tandy1000_bank_w, 0xffff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tandy1000_286_map, AS_PROGRAM, 16, tandy1000_state ) + ADDRESS_MAP_GLOBAL_MASK(0x000fffff) + AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") + AM_RANGE(0xa0000, 0xaffff) AM_RAM + AM_RANGE(0xb0000, 0xb7fff) AM_NOP + AM_RANGE(0xb8000, 0xbffff) AM_DEVREADWRITE8("pcvideo_t1000", pcvideo_t1000_device, videoram_r, videoram_w, 0xffff) + AM_RANGE(0xc0000, 0xc7fff) AM_NOP + AM_RANGE(0xc8000, 0xc9fff) AM_ROM + AM_RANGE(0xca000, 0xcffff) AM_NOP + AM_RANGE(0xe0000, 0xeffff) AM_NOP + AM_RANGE(0xf8000, 0xfffff) AM_ROM +ADDRESS_MAP_END + +static const gfx_layout t1000_charlayout = +{ + 8, 16, + 256, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0, 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624, 28672, 30720 }, + 8 +}; + +static MACHINE_CONFIG_FRAGMENT( cfg_fdc_35 ) + MCFG_DEVICE_MODIFY("fdc:0") + MCFG_SLOT_DEFAULT_OPTION("35dd") + MCFG_SLOT_FIXED(true) + + MCFG_DEVICE_REMOVE("fdc:1") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( cfg_fdc_525 ) + MCFG_DEVICE_MODIFY("fdc:0") + MCFG_SLOT_FIXED(true) + + MCFG_DEVICE_REMOVE("fdc:1") +MACHINE_CONFIG_END + +static GFXDECODE_START( t1000 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, t1000_charlayout, 3, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_FRAGMENT(tandy1000_common) + MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") + + /* video hardware */ + MCFG_PCVIDEO_T1000_ADD("pcvideo_t1000") + MCFG_GFXDECODE_ADD("gfxdecode", "pcvideo_t1000:palette", t1000) + + /* sound hardware */ + MCFG_SOUND_ADD("sn76496", NCR7496, XTAL_14_31818MHz/4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mb:mono", 0.80) + + MCFG_NVRAM_ADD_0FILL("nvram"); + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa_fdc", pc_isa8_cards, "fdc_xt", true) + MCFG_SLOT_OPTION_MACHINE_CONFIG("fdc_xt", cfg_fdc_35) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa_lpt", pc_isa8_cards, "lpt", true) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa_com", pc_isa8_cards, "com", true) + + MCFG_PC_JOY_ADD("pc_joy") + MCFG_PC_KEYB_ADD("pc_keyboard", DEVWRITELINE("mb:pic8259", pic8259_device, ir1_w)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("640K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( t1000hx, tandy1000_state ) + MCFG_CPU_ADD("maincpu", I8088, 8000000) + MCFG_CPU_PROGRAM_MAP(tandy1000_map) + MCFG_CPU_IO_MAP(tandy1000_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_FRAGMENT_ADD(tandy1000_common) + + // plus cards are isa with a nonstandard conntector + MCFG_ISA8_SLOT_ADD("mb:isa", "plus1", pc_isa8_cards, NULL, false) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( t1000sx, t1000hx ) + MCFG_DEVICE_MODIFY("isa_fdc") + MCFG_SLOT_OPTION_MACHINE_CONFIG("fdc_xt", cfg_fdc_525) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, NULL, false) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( t1000_16, tandy1000_state ) + MCFG_CPU_ADD("maincpu", I8086, XTAL_28_63636MHz / 3) + MCFG_CPU_PROGRAM_MAP(tandy1000_16_map) + MCFG_CPU_IO_MAP(tandy1000_16_bank_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_FRAGMENT_ADD(tandy1000_common) + + MCFG_MACHINE_RESET_OVERRIDE(tandy1000_state,tandy1000rl) + +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( t1000_16_8, t1000_16 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_CLOCK( XTAL_24MHz / 3 ) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, NULL, false) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( t1000_286, tandy1000_state ) + MCFG_CPU_ADD("maincpu", I80286, XTAL_28_63636MHz / 2) + MCFG_CPU_PROGRAM_MAP(tandy1000_286_map) + MCFG_CPU_IO_MAP(tandy1000_16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) + + MCFG_FRAGMENT_ADD(tandy1000_common) + + MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, NULL, false) + MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) +MACHINE_CONFIG_END + +#ifdef UNUSED_DEFINITION +ROM_START( t1000 ) + // Schematics displays 2 32KB ROMs at U9 and U10 + ROM_REGION(0x100000,"maincpu", 0) + ROM_SYSTEM_BIOS( 0, "v010000", "v010000" ) + ROMX_LOAD("v010000.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v010100", "v010100" ) + ROMX_LOAD("v010100.f0", 0xf0000, 0x10000, CRC(b6760881) SHA1(8275e4c48ac09cf36685db227434ca438aebe0b9), ROM_BIOS(2)) + + // Part of video array at u76? + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u76", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location +ROM_END + +ROM_START( t1000a ) + ROM_REGION(0x100000,"maincpu", 0) + // partlist says it has 1 128kbyte rom + ROM_LOAD("t1000hx.e0", 0xe0000, 0x10000, CRC(61dbf242) SHA1(555b58d8aa8e0b0839259621c44b832d993beaef)) // not sure about this one + ROM_LOAD("v010100.f0", 0xf0000, 0x10000, CRC(b6760881) SHA1(8275e4c48ac09cf36685db227434ca438aebe0b9)) + + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u25", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location +ROM_END + +ROM_START( t1000ex ) + ROM_REGION(0x100000,"maincpu", 0) + // partlist says it has 1 128kb rom, schematics list a 32k x 8 rom + // "8040328.u17" + ROM_LOAD("t1000hx.e0", 0xe0000, 0x10000, CRC(61dbf242) SHA1(555b58d8aa8e0b0839259621c44b832d993beaef)) // not sure about this one + ROM_LOAD("v010200.f0", 0xf0000, 0x10000, CRC(0e016ecf) SHA1(2f5ac8921b7cba56b02122ef772f5f11bbf6d8a2)) + + // TODO: Add dump of the 8048 at u8 if it ever gets dumped + ROM_REGION(0x400, "kbdc", 0) + ROM_LOAD("8048.u8", 0x000, 0x400, NO_DUMP) + + // Most likely part of big blue at u28 + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u28", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location +ROM_END + +// The T1000SL and T1000SL/2 only differ in amount of RAM installed and BIOS version (SL/2 has v01.04.04) +ROM_START( t1000sl ) + ROM_REGION(0x100000,"maincpu", 0) + + // 8076312.hu1 - most likely v01.04.00 + // 8075312.hu2 + + + // partlist says it has 1 128kbyte rom + ROM_LOAD("t1000hx.e0", 0xe0000, 0x10000, CRC(61dbf242) SHA1(555b58d8aa8e0b0839259621c44b832d993beaef)) // not sure about this one + ROM_SYSTEM_BIOS( 0, "v010400", "v010400" ) + ROMX_LOAD("v010400.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v010401", "v010401" ) + ROMX_LOAD("v010401.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v010402", "v010402" ) + ROMX_LOAD("v010402.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "v020001", "v020001" ) + ROMX_LOAD("v020001.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(4) ) + + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u25", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) +ROM_END + + +ROM_START( t1000tl ) + ROM_REGIoN(0x100000, "maincpu", ROMREGION_ERASE00) + + ROM_REGION(0x80000, "romcs0", 0) + // These 2 sets most likely have the same contents + // v01.04.00 + // 8076323.u55 - Sharp - 256KB + // 8075323.u57 - Sharp - 256KB + // v01.04.00 + // 8079025.u54 - Hitachi - 256KB + // 8079026.u56 - Hitachi - 256KB + ROM_REGION(0x80000, "romcs1", 0) + + // 2x 128x8 eeprom?? @ u58 and u59 - not mentioned in parts list + + ROM_REGION(0x80, "eeprom", 0) + ROM_LOAD("8040346_9346.u12", xxx ) // 64x16 eeprom + + ROM_REGION(0x08000, "gfx1", 0) + ROM_LOAD("8079027.u24", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) +ROM_END +#endif + +ROM_START( t1000hx ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD("v020000.u12", 0xe0000, 0x20000, CRC(6f3acd80) SHA1(976af8c04c3f6fde14d7047f6521d302bdc2d017)) // TODO: Rom label + + // TODO: Add dump of the 8048 at u9 if it ever gets dumped + ROM_REGION(0x400, "kbdc", 0) + ROM_LOAD("8048.u9", 0x000, 0x400, NO_DUMP) + + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u31", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location, probably internal to "big blue" at u31 +ROM_END + +ROM_START( t1000sx ) + ROM_REGION(0x100000,"maincpu", 0) + ROM_LOAD("8040328.u41", 0xf8000, 0x8000, CRC(4e2b9f0b) SHA1(e79a9ed9e885736e30d9b135557f0e596ce5a70b)) + + // No character rom is listed in the schematics? + // But disabling it results in no text being printed + // Part of bigblue at u30?? + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u30", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location +ROM_END + + +ROM_START( t1000tx ) + ROM_REGION(0x100000,"maincpu", 0) + // There should be 2 32KBx8 ROMs, one for odd at u38, one for even at u39 + // The machine already boots up with just this one rom + ROM_LOAD("t1000tx.bin", 0xf8000, 0x8000, BAD_DUMP CRC(9b34765c) SHA1(0b07e87f6843393f7d4ca4634b832b0c0bec304e)) + + // No character rom is listed in the schematics? + // It is most likely part of the big blue chip at u36 + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u36", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location +ROM_END + + +ROM_START( t1000rl ) + ROM_REGION(0x100000,"maincpu", ROMREGION_ERASE00) + + // bankable ROM regions + ROM_REGION(0x80000, "romcs0", 0) + /* v2.0.0.1 */ + /* Rom is labeled "(C) TANDY CORP. 1990 // 8079073 // LH534G70 JAPAN // 9034 D" */ + ROM_LOAD("8079073.u23", 0x00000, 0x80000, CRC(6fab50f7) SHA1(2ccc02bee4c250dc1b7c17faef2590bc158860b0) ) + ROM_REGION(0x80000, "romcs1", ROMREGION_ERASEFF) + + ROM_REGION(0x08000,"gfx1", 0) + /* Character rom located at U3 w/label "8079027 // NCR // 609-2495004 // F841030 A9025" */ + ROM_LOAD("8079027.u3", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location +ROM_END + + +ROM_START( t1000sl2 ) + ROM_REGION(0x100000,"maincpu", ROMREGION_ERASE00) + + // bankable ROM regions + ROM_REGION(0x80000, "romcs0", 0) + // v01.04.04 BIOS + ROM_LOAD16_BYTE("8079047.hu1", 0x00000, 0x40000, CRC(c773ec0e) SHA1(7deb71f14c2c418400b639d60066ab61b7e9df32)) + ROM_LOAD16_BYTE("8079048.hu2", 0x00001, 0x40000, CRC(0f3e6586) SHA1(10f1a7204f69b82a18bc94a3010c9660aec0c802)) + ROM_REGION(0x80000, "romcs1", ROMREGION_ERASEFF) + + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u25", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) + + ROM_REGION(0x80, "nmc9246n", 0) + ROM_LOAD("seeprom.bin", 0, 0x80, CRC(4fff41df) SHA1(41a7009694550c017996932beade608cff968f4a)) +ROM_END + + +ROM_START( t1000tl2 ) + ROM_REGION(0x100000, "maincpu", 0) + ROM_LOAD( "t10000tl2.bin", 0xf0000, 0x10000, CRC(e288f12c) SHA1(9d54ccf773cd7202c9906323f1b5a68b1b3a3a67)) + + ROM_REGION(0x08000,"gfx1", 0) + ROM_LOAD("8079027.u24", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +// tandy 1000 +COMP( 1987, t1000hx, ibm5150, 0, t1000hx, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 HX", 0) +COMP( 1987, t1000sx, ibm5150, 0, t1000sx, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 SX", 0) +COMP( 1987, t1000tx, ibm5150, 0, t1000_286, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 TX", 0) +COMP( 1989, t1000rl, ibm5150, 0, t1000_16, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 RL", 0) +COMP( 1989, t1000tl2, ibm5150, 0, t1000_286, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 TL/2", 0) +COMP( 1988, t1000sl2, ibm5150, 0, t1000_16_8, tandy1t, tandy1000_state, t1000sl, "Tandy Radio Shack", "Tandy 1000 SL/2", 0) diff --git a/src/mame/drivers/tandy2k.c b/src/mame/drivers/tandy2k.c new file mode 100644 index 00000000000..dc3f8e64352 --- /dev/null +++ b/src/mame/drivers/tandy2k.c @@ -0,0 +1,908 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Tandy 2000 + +****************************************************************************/ + +/* + + TODO: + + - floppy + - HDL is also connected to WP/TS input where TS is used to detect motor status + - 3 second motor off delay timer + - video (video RAM is at memory top - 0x1400, i.e. 0x1ec00) + - keyboard ROM + - hires graphics board + - WD1010 + - hard disk + - mouse + +*/ + +#include "includes/tandy2k.h" +#include "machine/pckeybrd.h" + +#define LOG 1 + +// Read/Write Handlers + +void tandy2k_state::update_drq() +{ + int drq0 = CLEAR_LINE; + int drq1 = CLEAR_LINE; + + for (int i = 0; i < 4; i++) + { + if (BIT(m_dma_mux, 0 + i)) + { + if (BIT(m_dma_mux, 4 + i)) + drq1 |= m_busdmarq[i]; + else + drq0 |= m_busdmarq[i]; + } + } + + m_maincpu->drq0_w(drq0); + m_maincpu->drq1_w(drq1); +} + +void tandy2k_state::dma_request(int line, int state) +{ + m_busdmarq[line] = state; + + update_drq(); +} + +void tandy2k_state::speaker_update() +{ + int level = !(m_spkrdata & m_outspkr); + + m_speaker->level_w(level); +} + +READ8_MEMBER( tandy2k_state::char_ram_r ) +{ + return m_char_ram[offset]; +} + +WRITE8_MEMBER( tandy2k_state::char_ram_w ) +{ + m_char_ram[offset] = data; +} + +READ8_MEMBER( tandy2k_state::videoram_r ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + offs_t addr = (m_vram_base << 15) | (offset << 1); + UINT16 data = program.read_word(addr); + + // character + m_drb0->write(space, 0, data & 0xff); + + // attributes + m_drb1->write(space, 0, data >> 8); + + return data & 0xff; +} + +READ8_MEMBER( tandy2k_state::enable_r ) +{ + /* + + bit signal description + + 0 RS-232 ring indicator + 1 RS-232 carrier detect + 2 + 3 + 4 + 5 + 6 + 7 _ACLOW + + */ + + UINT8 data = 0x80; + + data |= m_rs232->ri_r(); + data |= m_rs232->dcd_r() << 1; + + return data; +} + +WRITE8_MEMBER( tandy2k_state::enable_w ) +{ + /* + + bit signal description + + 0 KBEN keyboard enable + 1 EXTCLK external baud rate clock + 2 SPKRGATE enable periodic speaker output + 3 SPKRDATA direct output to speaker + 4 RFRQGATE enable refresh and baud rate clocks + 5 FDCRESET* reset 8272 + 6 TMRIN0 enable 80186 timer 0 + 7 TMRIN1 enable 80186 timer 1 + + */ + + if (LOG) logerror("ENABLE %02x\n", data); + + // keyboard enable + m_kb->power_w(BIT(data, 0)); + machine().device("pc_keyboard")->enable(BIT(data, 0)); + + // external baud rate clock + m_extclk = BIT(data, 1); + + // speaker gate + m_pit->write_gate0(BIT(data, 2)); + + // speaker data + m_spkrdata = BIT(data, 3); + speaker_update(); + + // refresh and baud rate clocks + m_pit->write_gate1(BIT(data, 4)); + m_pit->write_gate2(BIT(data, 4)); + + // FDC reset + if (!BIT(data, 5)) + { + m_fdc->soft_reset(); + } + + // timer 0 enable + m_maincpu->tmrin0_w(BIT(data, 6)); + + // timer 1 enable + m_maincpu->tmrin1_w(BIT(data, 7)); +} + +WRITE8_MEMBER( tandy2k_state::dma_mux_w ) +{ + /* + + bit description + + 0 DMA channel 0 enable + 1 DMA channel 1 enable + 2 DMA channel 2 enable + 3 DMA channel 3 enable + 4 DMA channel 0 select + 5 DMA channel 1 select + 6 DMA channel 2 select + 7 DMA channel 3 select + + */ + + if (LOG) logerror("DMA MUX %02x\n", data); + + m_dma_mux = data; + + // check for DMA error + int drq0 = 0; + int drq1 = 0; + + for (int ch = 0; ch < 4; ch++) + { + if (BIT(data, ch)) { if (BIT(data, ch + 4)) drq1++; else drq0++; } + } + + int dme = (drq0 > 2) || (drq1 > 2); + + m_pic1->ir6_w(dme); + + update_drq(); +} + +READ8_MEMBER( tandy2k_state::kbint_clr_r ) +{ + if (m_pb_sel == KBDINEN) + { + m_kb->busy_w(1); + m_pic1->ir0_w(CLEAR_LINE); + + return machine().device("pc_keyboard")->read(space, 0); + } + + return 0xff; +} + +READ16_MEMBER( tandy2k_state::vpac_r ) +{ + if (ACCESSING_BITS_0_7) + { + return m_vpac->read(space, offset); + } + else + { + return 0xff00; + } +} + +WRITE16_MEMBER( tandy2k_state::vpac_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_vpac->write(space, offset, data & 0xff); + } + else + { + addr_ctrl_w(space, offset, data >> 8); + } +} + +READ8_MEMBER( tandy2k_state::fldtc_r ) +{ + if (LOG) logerror("FLDTC\n"); + + fldtc_w(space, 0, 0); + + return 0; +} + +WRITE8_MEMBER( tandy2k_state::fldtc_w ) +{ + m_fdc->tc_w(1); + m_fdc->tc_w(false); +} + +WRITE8_MEMBER( tandy2k_state::addr_ctrl_w ) +{ + /* + + bit signal description + + 8 A15 A15 of video access + 9 A16 A16 of video access + 10 A17 A17 of video access + 11 A18 A18 of video access + 12 A19 A19 of video access + 13 CLKSP0 clock speed (0 = 22.4 MHz, 1 = 28 MHz) + 14 CLKCNT dots/char (0 = 10 [800x400], 1 = 8 [640x400]) + 15 VIDOUTS selects the video source for display on monochrome monitor + + */ + + if (LOG) logerror("Address Control %02x\n", data); + + // video access + m_vram_base = data & 0x1f; + + // video clock speed + int clkspd = BIT(data, 5); + int clkcnt = BIT(data, 6); + + if (m_clkspd != clkspd || m_clkcnt != clkcnt) + { + float busdotclk = XTAL_16MHz*28 / (clkspd ? 16 : 20); + float vidcclk = busdotclk / (clkcnt ? 8 : 10); + + m_vpac->set_character_width(clkcnt ? 8 : 10); + m_vpac->set_unscaled_clock(vidcclk); + + m_vac->set_unscaled_clock(busdotclk); + + m_timer_vidldsh->adjust(attotime::from_hz(vidcclk), 0, attotime::from_hz(vidcclk)); + + m_clkspd = clkspd; + m_clkcnt = clkcnt; + } + + // video source select + m_vidouts = BIT(data, 7); +} + +// Memory Maps + +static ADDRESS_MAP_START( tandy2k_mem, AS_PROGRAM, 16, tandy2k_state ) + ADDRESS_MAP_UNMAP_HIGH +// AM_RANGE(0x00000, 0xdffff) AM_RAM + AM_RANGE(0xe0000, 0xf7fff) AM_RAM AM_SHARE("hires_ram") + AM_RANGE(0xf8000, 0xfbfff) AM_READWRITE8(char_ram_r, char_ram_w, 0x00ff) + AM_RANGE(0xfc000, 0xfdfff) AM_MIRROR(0x2000) AM_ROM AM_REGION(I80186_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tandy2k_io, AS_IO, 16, tandy2k_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x00001) AM_MIRROR(0x8) AM_READWRITE8(enable_r, enable_w, 0x00ff) + AM_RANGE(0x00002, 0x00003) AM_MIRROR(0x8) AM_WRITE8(dma_mux_w, 0x00ff) + AM_RANGE(0x00004, 0x00005) AM_MIRROR(0x8) AM_READWRITE8(fldtc_r, fldtc_w, 0x00ff) + AM_RANGE(0x00010, 0x00013) AM_MIRROR(0xc) AM_DEVREADWRITE8(I8251A_TAG, i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0x00030, 0x00033) AM_MIRROR(0xc) AM_DEVICE8(I8272A_TAG, i8272a_device, map, 0x00ff) + AM_RANGE(0x00040, 0x00047) AM_MIRROR(0x8) AM_DEVREADWRITE8(I8253_TAG, pit8253_device, read, write, 0x00ff) + AM_RANGE(0x00052, 0x00053) AM_MIRROR(0x8) AM_READ8(kbint_clr_r, 0x00ff) + AM_RANGE(0x00050, 0x00057) AM_MIRROR(0x8) AM_DEVREADWRITE8(I8255A_TAG, i8255_device, read, write, 0x00ff) + AM_RANGE(0x00060, 0x00063) AM_MIRROR(0xc) AM_DEVREADWRITE8(I8259A_0_TAG, pic8259_device, read, write, 0x00ff) + AM_RANGE(0x00070, 0x00073) AM_MIRROR(0xc) AM_DEVREADWRITE8(I8259A_1_TAG, pic8259_device, read, write, 0x00ff) + AM_RANGE(0x00080, 0x00081) AM_MIRROR(0xe) AM_DEVREADWRITE8(I8272A_TAG, i8272a_device, mdma_r, mdma_w, 0x00ff) +// AM_RANGE(0x00100, 0x0017f) AM_DEVREADWRITE8(CRT9007_TAG, crt9007_t, read, write, 0x00ff) AM_WRITE8(addr_ctrl_w, 0xff00) + AM_RANGE(0x00100, 0x0017f) AM_READWRITE(vpac_r, vpac_w) +// AM_RANGE(0x00180, 0x00180) AM_READ8(hires_status_r, 0x00ff) +// AM_RANGE(0x00180, 0x001bf) AM_WRITE(hires_palette_w) +// AM_RANGE(0x001a0, 0x001a0) AM_READ8(hires_plane_w, 0x00ff) +// AM_RANGE(0x0ff00, 0x0ffff) AM_READWRITE(i186_internal_port_r, i186_internal_port_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tandy2k_hd_io, AS_IO, 16, tandy2k_state ) + AM_IMPORT_FROM(tandy2k_io) +// AM_RANGE(0x000e0, 0x000ff) AM_WRITE8(hdc_dack_w, 0x00ff) +// AM_RANGE(0x0026c, 0x0026d) AM_DEVREADWRITE8(WD1010_TAG, wd1010_device, hdc_reset_r, hdc_reset_w, 0x00ff) +// AM_RANGE(0x0026e, 0x0027f) AM_DEVREADWRITE8(WD1010_TAG, wd1010_device, wd1010_r, wd1010_w, 0x00ff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( vpac_mem, AS_0, 8, tandy2k_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ(videoram_r) +ADDRESS_MAP_END + +// Input Ports + +static INPUT_PORTS_START( tandy2k ) + // defined in machine/tandy2kb.c + PORT_INCLUDE(pc_keyboard) +INPUT_PORTS_END + +// Video + +UINT32 tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const pen_t *pen = m_palette->pens(); + address_space &program = m_maincpu->space(AS_PROGRAM); + + for (int y = 0; y < 400; y++) + { + UINT8 cgra = y % 16; + + for (int sx = 0; sx < 80; sx++) + { + offs_t addr = m_ram->size() - 0x1400 + (((y / 16) * 80) + sx) * 2; + UINT8 vidla = program.read_word(addr); + UINT8 data = m_char_ram[(vidla << 4) | cgra]; + + for (int x = 0; x < 8; x++) + { + int color = BIT(data, 7); + bitmap.pix32(y, (sx * 8) + x) = pen[color]; + data <<= 1; + } + } + } + + return 0; +} + +WRITE_LINE_MEMBER( tandy2k_state::vpac_vlt_w ) +{ + m_drb0->ren_w(state); + m_drb0->clrcnt_w(state); + + m_drb1->ren_w(state); + m_drb1->clrcnt_w(state); +} + +WRITE_LINE_MEMBER( tandy2k_state::vpac_drb_w ) +{ + m_drb0->tog_w(state); + m_drb1->tog_w(state); +} + +WRITE_LINE_MEMBER( tandy2k_state::vpac_wben_w ) +{ + m_drb0->wen1_w(state); + m_drb1->wen1_w(state); +} + +WRITE_LINE_MEMBER( tandy2k_state::vpac_cblank_w ) +{ + m_cblank = state; +} + +WRITE_LINE_MEMBER( tandy2k_state::vpac_slg_w ) +{ + m_slg = state; + + m_vac->slg_w(state); +} + +WRITE_LINE_MEMBER( tandy2k_state::vpac_sld_w ) +{ + m_sld = state; + + m_vac->sld_w(state); +} + +WRITE8_MEMBER( tandy2k_state::vidla_w ) +{ + m_vidla = data; +} + +WRITE8_MEMBER( tandy2k_state::drb_attr_w ) +{ + /* + + bit description + + 0 BLC -> DBLC (delayed 2 CCLKs) + 1 BKC -> DBKC (delayed 2 CCLKs) + 2 CHABL + 3 MS0 + 4 MS1 + 5 BLINK + 6 INT + 7 REVID + + */ + + m_blc = BIT(data, 0); + m_bkc = BIT(data, 1); + m_vac->chabl_w(BIT(data, 2)); + m_vac->ms0_w(BIT(data, 3)); + m_vac->ms1_w(BIT(data, 4)); + m_vac->blink_w(BIT(data, 5)); + m_vac->intin_w(BIT(data, 6)); + m_vac->revid_w(BIT(data, 7)); +} + +CRT9021_DRAW_CHARACTER_MEMBER( tandy2k_state::vac_draw_character ) +{ + const pen_t *pen = m_palette->pens(); + + for (int i = 0; i < 8; i++) + { + int color = BIT(video, 7 - i); + + bitmap.pix32(y, x++) = pen[color]; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER( tandy2k_state::vidldsh_tick ) +{ + m_drb0->rclk_w(0); + m_drb0->wclk_w(0); + m_drb1->rclk_w(0); + m_drb1->wclk_w(0); + m_vac->ld_sh_w(0); + + // 1 busdotclk later + m_vac->blc_w(BIT(m_dblc, 0)); + m_dblc >>= 1; + m_dblc |= m_blc << 2; + + m_vac->bkc_w(BIT(m_dbkc, 0)); + m_dbkc >>= 1; + m_dbkc |= m_bkc << 2; + + m_vac->retbl_w(BIT(m_dblank, 0)); + m_dblank >>= 1; + m_dblank |= m_cblank << 2; + + if (!m_slg) + { + m_cgra >>= 1; + m_cgra |= m_sld << 3; + } + + UINT8 vidd = m_char_ram[(m_vidla << 4) | m_cgra]; + m_vac->write(vidd); + + m_drb0->rclk_w(1); + m_drb0->wclk_w(1); + m_drb1->rclk_w(1); + m_drb1->wclk_w(1); + m_vac->ld_sh_w(1); +} + +// Intel 8251A Interface + +WRITE_LINE_MEMBER( tandy2k_state::rxrdy_w ) +{ + m_rxrdy = state; + m_pic0->ir2_w(m_rxrdy || m_txrdy); +} + +WRITE_LINE_MEMBER( tandy2k_state::txrdy_w ) +{ + m_txrdy = state; + m_pic0->ir2_w(m_rxrdy || m_txrdy); +} + +// Intel 8253 Interface + +WRITE_LINE_MEMBER( tandy2k_state::outspkr_w ) +{ + m_outspkr = state; + speaker_update(); +} + +WRITE_LINE_MEMBER( tandy2k_state::intbrclk_w ) +{ + if (!m_extclk) + { + m_uart->write_txc(state); + m_uart->write_rxc(state); + } +} + +WRITE_LINE_MEMBER( tandy2k_state::rfrqpulse_w ) +{ + // memory refresh counter up +} + +// Intel 8255A Interface + +WRITE_LINE_MEMBER( tandy2k_state::write_centronics_ack ) +{ + m_centronics_ack = state; + m_i8255a->pc6_w(state); +} + +WRITE_LINE_MEMBER( tandy2k_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( tandy2k_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +WRITE_LINE_MEMBER( tandy2k_state::write_centronics_select ) +{ + m_centronics_select = state; +} + +WRITE_LINE_MEMBER( tandy2k_state::write_centronics_fault ) +{ + m_centronics_fault = state; +} + +READ8_MEMBER( tandy2k_state::ppi_pb_r ) +{ + /* + + bit signal description + + 0 LPRIN0 auxiliary input 0 + 1 LPRIN1 auxiliary input 1 + 2 LPRIN2 auxiliary input 2 + 3 _LPRACK acknowledge + 4 _LPRFLT fault + 5 _LPRSEL select + 6 LPRPAEM paper empty + 7 LPRBSY busy + + */ + + UINT8 data = 0; + + switch (m_pb_sel) + { + case LPINEN: + // printer acknowledge + data |= m_centronics_ack << 3; + + // printer fault + data |= m_centronics_fault << 4; + + // printer select + data |= m_centronics_select << 5; + + // paper empty + data |= m_centronics_perror << 6; + + // printer busy + data |= m_centronics_busy << 7; + break; + + case KBDINEN: + // keyboard data + data = m_kbdin; + break; + + case PORTINEN: + // PCB revision + data = 0x03; + break; + } + + return data; +} + +WRITE8_MEMBER( tandy2k_state::ppi_pc_w ) +{ + /* + + bit signal description + + 0 port A direction + 1 port B input select bit 0 + 2 port B input select bit 1 + 3 LPRINT13 interrupt + 4 STROBE IN + 5 INBUFFULL + 6 _LPRACK + 7 _LPRDATSTB + + */ + + // input select + m_pb_sel = (data >> 1) & 0x03; + + // interrupt + m_pic1->ir3_w(BIT(data, 3)); + + // printer strobe + m_centronics->write_strobe(BIT(data, 7)); +} + + +// Intel 8259 Interfaces + +/* + + IR0 MEMINT00 + IR1 TMOINT01 + IR2 SERINT02 + IR3 BUSINT03 + IR4 FLDINT04 + IR5 BUSINT05 + IR6 HDCINT06 + IR7 BUSINT07 + +*/ + +/* + + IR0 KBDINT10 + IR1 VIDINT11 + IR2 RATINT12 + IR3 LPRINT13 + IR4 MCPINT14 + IR5 MEMINT15 + IR6 DMEINT16 + IR7 BUSINT17 + +*/ + +// Intel 8272 Interface + +WRITE_LINE_MEMBER( tandy2k_state::fdc_drq_w ) +{ + dma_request(0, state); +} + +WRITE_LINE_MEMBER( tandy2k_state::fdc_hdl_w ) +{ + m_floppy0->mon_w(!state); + m_floppy1->mon_w(!state); +} + +FLOPPY_FORMATS_MEMBER( tandy2k_state::floppy_formats ) + FLOPPY_TANDY_2000_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( tandy2k_floppies ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +// Keyboard + +WRITE_LINE_MEMBER( tandy2k_state::kbdclk_w ) +{ + if (!m_kbdclk && state) + { + m_kbdin >>= 1; + m_kbdin |= m_kb->data_r() << 7; + } + + m_kbdclk = state; +} + +WRITE_LINE_MEMBER( tandy2k_state::kbddat_w ) +{ + if (!m_kbddat && state) + { + m_kb->busy_w(m_kbdclk); + m_pic1->ir0_w(!m_kbdclk); + } + + m_kbddat = state; +} + +READ8_MEMBER( tandy2k_state::irq_callback ) +{ + return (offset ? m_pic1 : m_pic0)->acknowledge(); +} + +// Machine Initialization + +void tandy2k_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + int ram_size = m_ram->size(); + + program.install_ram(0x00000, ram_size - 1, ram); + + m_char_ram.allocate(0x1000); + + // register for state saving + save_item(NAME(m_dma_mux)); + save_item(NAME(m_kbdclk)); + save_item(NAME(m_kbddat)); + save_item(NAME(m_kbdin)); + save_item(NAME(m_extclk)); + save_item(NAME(m_rxrdy)); + save_item(NAME(m_txrdy)); + save_item(NAME(m_pb_sel)); + save_item(NAME(m_vidouts)); + save_item(NAME(m_clkspd)); + save_item(NAME(m_clkcnt)); + save_item(NAME(m_outspkr)); + save_item(NAME(m_spkrdata)); +} + +void tandy2k_state::device_reset_after_children() +{ + machine().device("pc_keyboard")->enable(0); +} + +// Machine Driver + +static MACHINE_CONFIG_START( tandy2k, tandy2k_state ) + // basic machine hardware + MCFG_CPU_ADD(I80186_TAG, I80186, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(tandy2k_mem) + MCFG_CPU_IO_MAP(tandy2k_io) + MCFG_80186_IRQ_SLAVE_ACK(DEVREAD8(DEVICE_SELF, tandy2k_state, irq_callback)) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) + //MCFG_SCREEN_UPDATE_DEVICE(CRT9021B_TAG, crt9021_t, screen_update) + MCFG_SCREEN_UPDATE_DRIVER(tandy2k_state, screen_update) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_DEVICE_ADD(CRT9007_TAG, CRT9007, XTAL_16MHz*28/20/8) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vpac_mem) + MCFG_CRT9007_CHARACTER_WIDTH(8) + MCFG_CRT9007_INT_CALLBACK(DEVWRITELINE(I8259A_1_TAG, pic8259_device, ir1_w)) + MCFG_CRT9007_VS_CALLBACK(DEVWRITELINE(CRT9021B_TAG, crt9021_t, vsync_w)) + MCFG_CRT9007_VLT_CALLBACK(WRITELINE(tandy2k_state, vpac_vlt_w)) + MCFG_CRT9007_CURS_CALLBACK(DEVWRITELINE(CRT9021B_TAG, crt9021_t, cursor_w)) + MCFG_CRT9007_DRB_CALLBACK(WRITELINE(tandy2k_state, vpac_drb_w)) + MCFG_CRT9007_WBEN_CALLBACK(WRITELINE(tandy2k_state, vpac_wben_w)) + MCFG_CRT9007_CBLANK_CALLBACK(WRITELINE(tandy2k_state, vpac_cblank_w)) + MCFG_CRT9007_SLG_CALLBACK(WRITELINE(tandy2k_state, vpac_slg_w)) + MCFG_CRT9007_SLD_CALLBACK(WRITELINE(tandy2k_state, vpac_sld_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + + MCFG_DEVICE_ADD(CRT9212_0_TAG, CRT9212, 0) + MCFG_CRT9212_WEN2_VCC() + MCFG_CRT9212_DOUT_CALLBACK(WRITE8(tandy2k_state, vidla_w)) + + MCFG_DEVICE_ADD(CRT9212_1_TAG, CRT9212, 0) + MCFG_CRT9212_WEN2_VCC() + MCFG_CRT9212_DOUT_CALLBACK(WRITE8(tandy2k_state, drb_attr_w)) + + MCFG_DEVICE_ADD(CRT9021B_TAG, CRT9021, XTAL_16MHz*28/20) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + + MCFG_TIMER_DRIVER_ADD("vidldsh", tandy2k_state, vidldsh_tick) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_IN_PORTB_CB(READ8(tandy2k_state, ppi_pb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(tandy2k_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(tandy2k_state, rxrdy_w)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(tandy2k_state, txrdy_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_dsr)) + // TODO pin 15 external transmit clock + // TODO pin 17 external receiver clock + + MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_16MHz/16) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(tandy2k_state, outspkr_w)) + MCFG_PIT8253_CLK1(XTAL_16MHz/8) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(tandy2k_state, intbrclk_w)) + //MCFG_PIT8253_CLK2(XTAL_16MHz/8) + //MCFG_PIT8253_OUT2_HANDLER(WRITELINE(tandy2k_state, rfrqpulse_w)) + + MCFG_PIC8259_ADD(I8259A_0_TAG, DEVWRITELINE(I80186_TAG, i80186_cpu_device, int0_w), VCC, NULL) + + MCFG_PIC8259_ADD(I8259A_1_TAG, DEVWRITELINE(I80186_TAG, i80186_cpu_device, int1_w), VCC, NULL) + + MCFG_I8272A_ADD(I8272A_TAG, true) + downcast(device)->set_select_lines_connected(true); + MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE(I8259A_0_TAG, pic8259_device, ir4_w)) + MCFG_UPD765_DRQ_CALLBACK(WRITELINE(tandy2k_state, fdc_drq_w)) + MCFG_UPD765_HDL_CALLBACK(WRITELINE(tandy2k_state, fdc_hdl_w)) + MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":0", tandy2k_floppies, "525qd", tandy2k_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":1", tandy2k_floppies, "525qd", tandy2k_state::floppy_formats) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(tandy2k_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(tandy2k_state, write_centronics_busy)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(tandy2k_state, write_centronics_perror)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(tandy2k_state, write_centronics_select)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(tandy2k_state, write_centronics_fault)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_DEVICE_ADD(TANDY2K_KEYBOARD_TAG, TANDY2K_KEYBOARD, 0) + MCFG_TANDY2000_KEYBOARD_CLOCK_CALLBACK(WRITELINE(tandy2k_state, kbdclk_w)) + MCFG_TANDY2000_KEYBOARD_DATA_CALLBACK(WRITELINE(tandy2k_state, kbddat_w)) + + // temporary until the tandy keyboard has a rom dump + MCFG_PC_KEYB_ADD("pc_keyboard", DEVWRITELINE(I8259A_1_TAG, pic8259_device, ir0_w)) + + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "tandy2k") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("256K,384K,512K,640K,768K,896K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tandy2k_hd, tandy2k ) + // basic machine hardware + MCFG_CPU_MODIFY(I80186_TAG) + MCFG_CPU_IO_MAP(tandy2k_hd_io) + + // Tandon TM502 hard disk + MCFG_HARDDISK_ADD("harddisk0") + //MCFG_WD1010_ADD(WD1010_TAG, wd1010_intf) + //MCFG_WD1100_11_ADD(WD1100_11_TAG, wd1100_11_intf) +MACHINE_CONFIG_END + +// ROMs + +ROM_START( tandy2k ) + ROM_REGION( 0x2000, I80186_TAG, 0 ) + ROM_LOAD16_BYTE( "484a00.u48", 0x0000, 0x1000, CRC(a5ee3e90) SHA1(4b1f404a4337c67065dd272d62ff88dcdee5e34b) ) + ROM_LOAD16_BYTE( "474600.u47", 0x0001, 0x1000, CRC(345701c5) SHA1(a775cbfa110b7a88f32834aaa2a9b868cbeed25b) ) + + ROM_REGION( 0x100, "plds", 0 ) + ROM_LOAD( "82s153.u62", 0x000, 0x100, NO_DUMP ) // interrupt/DMA + ROM_LOAD( "82s153.u68", 0x000, 0x100, NO_DUMP ) // video + ROM_LOAD( "82s153.u95", 0x000, 0x100, NO_DUMP ) // memory timing + ROM_LOAD( "pal10l8.u82", 0x000, 0x100, NO_DUMP ) // video + ROM_LOAD( "pal16l8a.u102", 0x000, 0x100, NO_DUMP ) // bus interface + ROM_LOAD( "pal16l8a.u103", 0x000, 0x100, NO_DUMP ) // bus interface + ROM_LOAD( "pal20l8.u103", 0x000, 0x100, NO_DUMP ) // bus interface, alternate + ROM_LOAD( "pal16r6a.u16", 0x000, 0x100, NO_DUMP ) // HDC +ROM_END + +#define rom_tandy2khd rom_tandy2k + +// System Drivers + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, tandy2k, 0, 0, tandy2k, tandy2k, driver_device, 0, "Tandy Radio Shack", "Tandy 2000", MACHINE_NOT_WORKING ) +COMP( 1983, tandy2khd, tandy2k, 0, tandy2k_hd, tandy2k, driver_device, 0, "Tandy Radio Shack", "Tandy 2000HD", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/tavernie.c b/src/mame/drivers/tavernie.c new file mode 100644 index 00000000000..c1ea74dc14d --- /dev/null +++ b/src/mame/drivers/tavernie.c @@ -0,0 +1,401 @@ +// license:BSD-3-Clause +// copyright-holders: Robbbert +/*************************************************************************** + + Tavernier CPU09 and IVG09 (Realisez votre ordinateur individuel) + + 2013-12-08 Skeleton driver. + + This system was described in a French computer magazine. + + CPU09 includes 6809, 6821, 6840, 6850, cassette, rs232 + IVG09 includes 6845, another 6821, beeper + IFD09 includes WD1795 + +ToDo: + - Attributes ram + - Graphics + - Character rom is not dumped + - Graphics rom is not dumped + - 3x 7611 proms not dumped + - Fix cassette + - Test FDC + - Need software + +List of commands (must be in UPPERCASE): +A - +B - +C - +D - Dump memory (^X to break) +G - +I - +L - Load cassette +M - +N - +O - +P - Save cassette +Q - +R - Display/Alter Registers +S - +T - +U - +V - +W - +X - 'erreur de chargement dos' +Y - +Z - more scan lines per row (cursor is bigger) + + +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/m6809/m6809.h" +#include "machine/6821pia.h" +#include "machine/6840ptm.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "video/mc6845.h" +#include "machine/keyboard.h" +#include "imagedev/cassette.h" +#include "machine/wd_fdc.h" +#include "sound/wave.h" +#include "sound/beep.h" +#include "tavernie.lh" + +#define KEYBOARD_TAG "keyboard" + +class tavernie_state : public driver_device +{ +public: + tavernie_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_cass(*this, "cassette"), + m_pia_ivg(*this, "pia_ivg"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_beep(*this, "beeper"), + m_maincpu(*this, "maincpu"), + m_acia(*this, "acia"), + m_palette(*this, "palette") + { + } + + DECLARE_READ_LINE_MEMBER(ca1_r); + DECLARE_READ8_MEMBER(pa_r); + DECLARE_WRITE8_MEMBER(pa_w); + DECLARE_WRITE8_MEMBER(pb_w); + DECLARE_WRITE8_MEMBER(pa_ivg_w); + DECLARE_READ8_MEMBER(pb_ivg_r); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE8_MEMBER(ds_w); + DECLARE_MACHINE_RESET(cpu09); + DECLARE_MACHINE_RESET(ivg09); + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + MC6845_UPDATE_ROW(crtc_update_row); + + const UINT8 *m_p_chargen; + optional_shared_ptr m_p_videoram; + +private: + UINT8 m_term_data; + UINT8 m_pa; + required_device m_cass; + optional_device m_pia_ivg; + optional_device m_fdc; + optional_device m_floppy0; + optional_device m_beep; + required_device m_maincpu; + required_device m_acia; +public: + optional_device m_palette; +}; + + +static ADDRESS_MAP_START(cpu09_mem, AS_PROGRAM, 8, tavernie_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x1000, 0x1fff) AM_NOP + AM_RANGE(0xeb00, 0xeb03) AM_DEVREADWRITE("pia", pia6821_device, read, write) + AM_RANGE(0xeb04, 0xeb04) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) + AM_RANGE(0xeb05, 0xeb05) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) + AM_RANGE(0xeb08, 0xeb0f) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) + AM_RANGE(0xec00, 0xefff) AM_RAM // 1Kx8 RAM MK4118 + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("roms", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ivg09_mem, AS_PROGRAM, 8, tavernie_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x1000, 0x1fff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x2000, 0x2003) AM_DEVREADWRITE("pia_ivg", pia6821_device, read, write) + AM_RANGE(0x2080, 0x2080) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0x2081, 0x2081) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("fdc", fd1795_t, read, write) + AM_RANGE(0xe080, 0xe080) AM_WRITE(ds_w) + AM_RANGE(0xeb00, 0xeb03) AM_DEVREADWRITE("pia", pia6821_device, read, write) + AM_RANGE(0xeb04, 0xeb04) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) + AM_RANGE(0xeb05, 0xeb05) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) + AM_RANGE(0xeb08, 0xeb0f) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) + AM_RANGE(0xec00, 0xefff) AM_RAM // 1Kx8 RAM MK4118 + AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("roms", 0) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( cpu09 ) + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x00, "IRQ PTM") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x02, 0x00, "IRQ ACIA") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x60, 0x40, "Terminal") PORT_DIPLOCATION("SW1:3,4") + PORT_DIPSETTING( 0x00, "110 baud" ) + PORT_DIPSETTING( 0x20, "300 baud" ) + PORT_DIPSETTING( 0x40, "1200 baud" ) + PORT_DIPSETTING( 0x60, "IVG09 (mc6845)" ) +INPUT_PORTS_END + +static INPUT_PORTS_START( ivg09 ) + PORT_START("DSW") + PORT_DIPNAME( 0x01, 0x00, "IRQ PTM") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x02, 0x00, "IRQ ACIA") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x60, 0x60, "Terminal") PORT_DIPLOCATION("SW1:3,4") + PORT_DIPSETTING( 0x00, "110 baud" ) + PORT_DIPSETTING( 0x20, "300 baud" ) + PORT_DIPSETTING( 0x40, "1200 baud" ) + PORT_DIPSETTING( 0x60, "IVG09 (mc6845)" ) +INPUT_PORTS_END + +MACHINE_RESET_MEMBER( tavernie_state, cpu09) +{ + m_term_data = 0; +} + +MACHINE_RESET_MEMBER( tavernie_state, ivg09) +{ + m_p_chargen = memregion("chargen")->base(); + m_beep->set_frequency(950); /* guess */ + m_beep->set_state(1); + m_term_data = 0; + m_pia_ivg->cb1_w(1); +} + +static SLOT_INTERFACE_START( ifd09_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +// can support 3 drives +WRITE8_MEMBER( tavernie_state::ds_w ) +{ + floppy_image_device *floppy = NULL; + if ((data & 3) == 1) floppy = m_floppy0->get_device(); + //if ((data & 3) == 2) floppy = m_floppy1->get_device(); + //if ((data & 3) == 3) floppy = m_floppy2->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + m_fdc->dden_w(!BIT(data, 2)); + } +} + + +MC6845_UPDATE_ROW( tavernie_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx=0; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + UINT8 inv=0; + if (x == cursor_x) inv=0xff; + mem = (ma + x) & 0xfff; + if (ra > 7) + gfx = inv; // some blank spacing lines + else + { + chr = m_p_videoram[mem]; + gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + } + + /* Display a scanline of a character */ + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} + + +READ8_MEMBER( tavernie_state::pa_r ) +{ + return ioport("DSW")->read() | m_pa; +} + + +/* +d0: A16 +d1: A17 (for 256kb expansion) +d2, d3, d4: to 40-pin port +d5: S3 +d6: S4 +d7: cassout +*/ +WRITE8_MEMBER( tavernie_state::pa_w ) +{ + m_pa = data & 0x9f; + m_cass->output(BIT(data, 7) ? -1.0 : +1.0); +} + +// centronics +WRITE8_MEMBER( tavernie_state::pb_w ) +{ +} + +// cass in +READ_LINE_MEMBER( tavernie_state::ca1_r ) +{ + return (m_cass->input() > +0.01); +} + +READ8_MEMBER( tavernie_state::pb_ivg_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( tavernie_state::pa_ivg_w ) +{ +// bits 0-3 are attribute bits +} + +WRITE8_MEMBER( tavernie_state::kbd_put ) +{ + m_term_data = data; + m_pia_ivg->cb1_w(0); + m_pia_ivg->cb1_w(1); +} + +WRITE_LINE_MEMBER( tavernie_state::write_acia_clock ) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + +static MACHINE_CONFIG_START( cpu09, tavernie_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M6809E, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(cpu09_mem) + MCFG_MACHINE_RESET_OVERRIDE(tavernie_state, cpu09) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_CASSETTE_ADD( "cassette" ) + + MCFG_DEVICE_ADD("pia", PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(tavernie_state, pa_r)) + MCFG_PIA_READCA1_HANDLER(READLINE(tavernie_state, ca1_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(tavernie_state, pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(tavernie_state, pb_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) + + MCFG_DEVICE_ADD("ptm", PTM6840, 0) + // all i/o lines connect to the 40-pin expansion connector + MCFG_PTM6840_INTERNAL_CLOCK(XTAL_4MHz / 4) + MCFG_PTM6840_EXTERNAL_CLOCKS(0, 0, 0) + MCFG_PTM6840_OUT1_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_PTM6840_IRQ_CB(INPUTLINE("maincpu", M6809_IRQ_LINE)) + + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(tavernie_state, write_acia_clock)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ivg09, cpu09 ) + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(ivg09_mem) + MCFG_MACHINE_RESET_OVERRIDE(tavernie_state, ivg09) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(80*8, 25*10) + MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*10-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_DEFAULT_LAYOUT(layout_tavernie) + + /* sound hardware */ + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(tavernie_state, kbd_put)) + + MCFG_MC6845_ADD("crtc", MC6845, "screen", 1008000) // unknown clock + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(tavernie_state, crtc_update_row) + + MCFG_DEVICE_ADD("pia_ivg", PIA6821, 0) + MCFG_PIA_READPB_HANDLER(READ8(tavernie_state, pb_ivg_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(tavernie_state, pa_ivg_w)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE("beeper", beep_device, set_state)) + + MCFG_FD1795_ADD("fdc", XTAL_8MHz / 8) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ifd09_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( cpu09 ) + ROM_REGION( 0x1000, "roms", 0 ) + ROM_LOAD( "tavbug.bin", 0x0000, 0x1000, CRC(77945cae) SHA1(d89b577bc0b4e15e9a49a849998681bdc6cf5fbe) ) +ROM_END + +ROM_START( ivg09 ) + ROM_REGION( 0x19f0, "roms", 0 ) + ROM_LOAD( "tavbug.bin", 0x0000, 0x1000, CRC(77945cae) SHA1(d89b577bc0b4e15e9a49a849998681bdc6cf5fbe) ) + // these 2 are not used. Boottav is copied to ram at c100 + ROM_LOAD_OPTIONAL( "promon.bin", 0x1000, 0x0800, CRC(43256bf2) SHA1(e81acb5b659d50d7b019b97ad5d2a8f129da39f6) ) + ROM_LOAD_OPTIONAL( "boottav.bin", 0x1800, 0x01f0, CRC(ae1a858d) SHA1(ab2144a00afd5b75c6dcb15c2c3f9d6910a159ae) ) + + // charrom is missing, using one from 'c10' for now + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, cpu09, 0, 0, cpu09, cpu09, driver_device, 0, "C. Tavernier", "CPU09", MACHINE_NOT_WORKING ) +COMP( 1983, ivg09, cpu09, 0, ivg09, ivg09, driver_device, 0, "C. Tavernier", "CPU09 with IVG09 and IFD09", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/tb303.c b/src/mame/drivers/tb303.c new file mode 100644 index 00000000000..841aa375aed --- /dev/null +++ b/src/mame/drivers/tb303.c @@ -0,0 +1,312 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + ** subclass of hh_ucom4_state (includes/hh_ucom4.h, drivers/hh_ucom4.c) ** + + Roland TB-303 Bass Line, 1982, designed by Tadao Kikumoto + * NEC uCOM-43 MCU, labeled D650C 133 + * 3*uPD444C 1024x4 Static CMOS SRAM + * board is packed with discrete components + + TODO: + - still too much to list here + +***************************************************************************/ + +#include "includes/hh_ucom4.h" + +#include "tb303.lh" + + +class tb303_state : public hh_ucom4_state +{ +public: + tb303_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag), + m_t3_off_timer(*this, "t3_off") + { } + + required_device m_t3_off_timer; + + UINT8 m_ram[0xc00]; + UINT16 m_ram_address; + bool m_ram_ce; + bool m_ram_we; + + DECLARE_WRITE8_MEMBER(ram_w); + DECLARE_READ8_MEMBER(ram_r); + DECLARE_WRITE8_MEMBER(strobe_w); + void refresh_ram(); + + DECLARE_WRITE8_MEMBER(switch_w); + DECLARE_READ8_MEMBER(input_r); + void update_leds(); + + TIMER_DEVICE_CALLBACK_MEMBER(t3_clock); + TIMER_DEVICE_CALLBACK_MEMBER(t3_off); + + virtual void machine_start(); +}; + + +/*************************************************************************** + + Timer/Interrupt + +***************************************************************************/ + +// T2 to MCU CLK: LC circuit, stable sine wave, 2.2us interval +#define TB303_T2_CLOCK_HZ 454545 /* in hz */ + +// T3 to MCU _INT: square wave, 1.8ms interval, short duty cycle +#define TB303_T3_CLOCK attotime::from_usec(1800) +#define TB303_T3_OFF (TB303_T3_CLOCK / 8) + +TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_off) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_clock) +{ + m_maincpu->set_input_line(0, ASSERT_LINE); + m_t3_off_timer->adjust(TB303_T3_OFF); +} + + + +/*************************************************************************** + + I/O + +***************************************************************************/ + +// external ram + +void tb303_state::refresh_ram() +{ + // MCU E2,E3 goes through a 4556 IC(pin 14,13) to one of uPD444 _CE: + // _Q0: N/C, _Q1: IC-5, _Q2: IC-3, _Q3: IC-4 + m_ram_ce = true; + UINT8 hi = 0; + switch (m_port[NEC_UCOM4_PORTE] >> 2 & 3) + { + case 0: m_ram_ce = false; break; + case 1: hi = 0; break; + case 2: hi = 1; break; + case 3: hi = 2; break; + } + + if (m_ram_ce) + { + // _WE must be high(read mode) for address transitions + if (!m_ram_we) + m_ram_address = hi << 10 | (m_port[NEC_UCOM4_PORTE] << 8 & 0x300) | m_port[NEC_UCOM4_PORTF] << 4 | m_port[NEC_UCOM4_PORTD]; + else + m_ram[m_ram_address] = m_port[NEC_UCOM4_PORTC]; + } +} + +WRITE8_MEMBER(tb303_state::ram_w) +{ + // MCU C: RAM data + // MCU D,F,E: RAM address + m_port[offset] = data; + refresh_ram(); + + // MCU D,F01: pitch data + //.. +} + +READ8_MEMBER(tb303_state::ram_r) +{ + // MCU C: RAM data + if (m_ram_ce && !m_ram_we) + return m_ram[m_ram_address]; + else + return 0; +} + +WRITE8_MEMBER(tb303_state::strobe_w) +{ + // MCU I0: RAM _WE + m_ram_we = (data & 1) ? false : true; + refresh_ram(); + + // MCU I1: pitch data latch strobe + // MCU I2: gate signal + + m_port[offset] = data; +} + + +// switch board + +void tb303_state::update_leds() +{ + // 4*4 LED matrix from port G/H: + /* + 0.0 D204 1.0 D211 2.0 D217 3.0 D205 + 0.1 D206 1.1 D213 2.1 D218 3.1 D207 + 0.2 D208 1.2 D215 2.2 D220 3.2 D210 + 0.3 D209 1.3 D216 2.3 D221 3.3 D212 + */ + display_matrix(4, 4, m_port[NEC_UCOM4_PORTG], m_port[NEC_UCOM4_PORTH]); + + // todo: battery led + // todo: 4 more leds(see top-left part) +} + +WRITE8_MEMBER(tb303_state::switch_w) +{ + // MCU G: leds state + // MCU H: input/led mux + if (offset == NEC_UCOM4_PORTH) + m_inp_mux = data = data ^ 0xf; + + m_port[offset] = data; + update_leds(); +} + +READ8_MEMBER(tb303_state::input_r) +{ + // MCU A,B: multiplexed inputs + // if input mux(port H) is 0, port A status buffer & gate is selected (via Q5 NAND) + if (offset == NEC_UCOM4_PORTA && m_inp_mux == 0) + { + // todo.. + return m_inp_matrix[4]->read(); + } + else + return read_inputs(4) >> (offset*4) & 0xf; +} + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +static INPUT_PORTS_START( tb303 ) + PORT_START("IN.0") // H0 port A/B + PORT_CONFNAME( 0x03, 0x03, "Mode" ) + PORT_CONFSETTING( 0x03, "Track Write" ) + PORT_CONFSETTING( 0x02, "Track Play" ) + PORT_CONFSETTING( 0x00, "Pattern Play" ) + PORT_CONFSETTING( 0x01, "Pattern Write" ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("DEL C#") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("INS D#") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("1 C") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("2 D") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("3 E") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_NAME("4 F") + + PORT_START("IN.1") // H1 port A/B + PORT_CONFNAME( 0x07, 0x00, "Track / Patt.Group" ) + PORT_CONFSETTING( 0x00, "1 / I" ) + PORT_CONFSETTING( 0x01, "2 / I" ) + PORT_CONFSETTING( 0x02, "3 / II" ) + PORT_CONFSETTING( 0x03, "4 / II" ) + PORT_CONFSETTING( 0x04, "5 / III" ) + PORT_CONFSETTING( 0x05, "6 / III" ) + PORT_CONFSETTING( 0x06, "7 / IV" ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_NAME("5 G") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_NAME("6 A") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_NAME("7 B") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_NAME("8 C") + + PORT_START("IN.2") // H2 port A/B + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Pattern Clear") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Function") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Pitch Mode") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Time Mode") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_NAME("9 Step") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_NAME("0 3n") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("100 A") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("200 B") + + PORT_START("IN.3") // H3 port B + PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("F#") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("G#") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("A#") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Back") + + PORT_START("IN.4") // H=0 port A + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Run/Stop") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Tap") + PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +void tb303_state::machine_start() +{ + hh_ucom4_state::machine_start(); + + // zerofill + memset(m_ram, 0, sizeof(m_ram)); + m_ram_address = 0; + m_ram_ce = false; + m_ram_we = false; + + // register for savestates + save_item(NAME(m_ram)); + save_item(NAME(m_ram_address)); + save_item(NAME(m_ram_ce)); + save_item(NAME(m_ram_we)); +} + +static MACHINE_CONFIG_START( tb303, tb303_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D650, TB303_T2_CLOCK_HZ) + MCFG_UCOM4_READ_A_CB(READ8(tb303_state, input_r)) + MCFG_UCOM4_READ_B_CB(READ8(tb303_state, input_r)) + MCFG_UCOM4_READ_C_CB(READ8(tb303_state, ram_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tb303_state, ram_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tb303_state, ram_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tb303_state, ram_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tb303_state, ram_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tb303_state, switch_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(tb303_state, switch_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(tb303_state, strobe_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("t3_clock", tb303_state, t3_clock, TB303_T3_CLOCK) + MCFG_TIMER_START_DELAY(TB303_T3_CLOCK) + MCFG_TIMER_DRIVER_ADD("t3_off", tb303_state, t3_off) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tb303) + + /* no video! */ + + /* sound hardware */ + // discrete... +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( tb303 ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d650c-133.ic8", 0x0000, 0x0800, CRC(268a8d8b) SHA1(7a4236b2bc9a5cd4c80c63ca1a193e03becfcb4c) ) +ROM_END + + +CONS( 1982, tb303, 0, 0, tb303, tb303, driver_device, 0, "Roland", "TB-303", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tdv2324.c b/src/mame/drivers/tdv2324.c new file mode 100644 index 00000000000..62eafe4951a --- /dev/null +++ b/src/mame/drivers/tdv2324.c @@ -0,0 +1,349 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder,Jonathan Gevaryahu +/* + + Tandberg TDV2324 + + Skeleton driver + By Curt Coder with some work by Lord Nightmare + + Status: + * Main cpu is currently hacked to read i/o port 0xE6 as 0x10; + it then seems to copy code to a ram area then jumps there + (there may be some sort of overlay/banking mess going on to allow full 64kb of ram) + The cpu gets stuck reading i/o port 0x30 in a loop. + - interrupts and sio lines are not hooked up + * Sub cpu does a bunch of unknown i/o accesses and also tries to + sequentially read chunk of address space which it never writes to; + this seems likely to be a shared ram or i/o mapped area especially since it seems + to write to i/o port 0x60 before trying to read there. + - interrupts and sio lines are not hooked up + * Fdc cpu starts, does a rom checksum (which passes) and tests a ram area + + + Board Notes: + Mainboard (pictures P1010036 & P1010038) + *28-pin: D27128, L4267096S,...(eprom, occluded by sticker: "965268 1", character set) + *40-pin: TMS9937NL, DB 336, ENGLAND (VTAC Video Chip) + *40-pin: P8085AH-2, F4265030, C INTEL '80 (cpus, there are 2 of these) + *28-pin: JAPAN 8442, 00009SS0, HN4827128G-25 (eprom, sticker: "962107") + *22-pin: ER3400, GI 8401HHA (EAROM) + * -pin: MOSTEK C 8424, MK3887N-4 (Z80 Serial I/O Controller) + *20-pin: (pal, sticker: "961420 0") + *24-pin: D2716, L3263271, INTEL '77 (eprom, sticker: "962058 1") + *3 tiny 16-pins which look socketed (proms) + *+B8412, DMPAL10L8NC + *PAL... (can't remove the sticker to read the rest since there's electrical components soldered above the chip) + *Am27S21DC, 835IDmm + *AM27S13DC, 8402DM (x2) + *TBP28L22N, GERMANY 406 A (x2) + *PAL16L6CNS, 8406 + + FD/HD Interface Board P/N 962013 Rev14 (pictures P1010031 & P1010033) + *28-pin: TMS, 2764JL-25, GHP8414 (@U15, labeled "962014 // -4-", fdc cpu rom) + *40-pin: MC68B02P, R1H 8340 (fdc cpu) + *40-pin: WDC '79, FD1797PL-02, 8342 16 (fdc chip) + *14-pin: MC4024P, MG 8341 (dual voltage controlled multivibrator) + *24-pin: TMM2016AP-12 (@U14 and @U80, 120ns 2kx8 SRAM) + + Keyboard: + *40-pin: NEC D8035LC (mcs-48 cpu) + *24-pin: NEC D2716 (eprom) + + Main CPU: + - PIT, SIO + + Sub CPU: + - PIC, PIT, VTAC + +*/ +/* +'subcpu' (17CD): unmapped i/o memory write to 23 = 36 & FF +'subcpu' (17D1): unmapped i/o memory write to 23 = 76 & FF +'subcpu' (17D5): unmapped i/o memory write to 23 = B6 & FF +'subcpu' (17DB): unmapped i/o memory write to 20 = 1A & FF +'subcpu' (17DE): unmapped i/o memory write to 20 = 00 & FF +'subcpu' (17E0): unmapped i/o memory write to 3E = 00 & FF +'subcpu' (17E2): unmapped i/o memory write to 3A = 00 & FF +'subcpu' (17E6): unmapped i/o memory write to 30 = 74 & FF +'subcpu' (17EA): unmapped i/o memory write to 31 = 7F & FF +'subcpu' (17EE): unmapped i/o memory write to 32 = 6D & FF +'subcpu' (17F2): unmapped i/o memory write to 33 = 18 & FF +'subcpu' (17F6): unmapped i/o memory write to 34 = 49 & FF +'subcpu' (17FA): unmapped i/o memory write to 35 = 20 & FF +'subcpu' (17FE): unmapped i/o memory write to 36 = 18 & FF +'subcpu' (1801): unmapped i/o memory write to 3C = 00 & FF +'subcpu' (1803): unmapped i/o memory write to 3C = 00 & FF +'subcpu' (1805): unmapped i/o memory write to 3E = 00 & FF +'subcpu' (0884): unmapped i/o memory write to 10 = 97 & FF +'subcpu' (0888): unmapped i/o memory write to 10 = 96 & FF + +'fdccpu' (E004): unmapped program memory read from 3C05 & FF 0011 1100 0000 0101 +'fdccpu' (E007): unmapped program memory read from C000 & FF 1100 0000 0000 0000 +'fdccpu' (E00A): unmapped program memory read from A000 & FF 1010 0000 0000 0000 +'fdccpu' (E012): unmapped program memory write to F000 = D0 & FF 1111 0000 0000 0000 = 1101 0000 +'fdccpu' (E015): unmapped program memory read from 3801 & FF 0011 1000 0000 0001 +'fdccpu' (E018): unmapped program memory read from 3C06 & FF 0011 1100 0000 0110 +'fdccpu' (E01B): unmapped program memory read from 3C04 & FF 0011 1100 0000 0100 + +'fdccpu' (E070): unmapped program memory write to 2101 = 01 & FF +'fdccpu' (E07C): unmapped program memory read from 6000 & FF +'fdccpu' (E07F): unmapped program memory read from 380D & FF +'fdccpu' (E082): unmapped program memory read from 380F & FF +'fdccpu' (E085): unmapped program memory read from 3803 & FF +'fdccpu' (E08B): unmapped program memory write to 6000 = 08 & FF +'fdccpu' (E08E): unmapped program memory write to 8000 = 08 & FF +'fdccpu' (E091): unmapped program memory write to 6000 = 00 & FF +'fdccpu' (E099): unmapped program memory write to F800 = 55 & FF +... +*/ + + + +#include "includes/tdv2324.h" + + +READ8_MEMBER( tdv2324_state::tdv2324_main_io_30 ) +{ + return 0xff; +} + +// Not sure what this is for, i/o read at 0xE6 on maincpu, post fails if it does not return bit 4 set +READ8_MEMBER( tdv2324_state::tdv2324_main_io_e6 ) +{ + return 0x10; // TODO: this should actually return something meaningful, for now is enough to pass early boot test +} + +WRITE8_MEMBER( tdv2324_state::tdv2324_main_io_e2 ) +{ + printf("%c\n", data); +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( tdv2324_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( tdv2324_mem, AS_PROGRAM, 8, tdv2324_state ) + AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x0800) AM_ROM AM_REGION(P8085AH_0_TAG, 0) + /* when copying code to 4000 area it runs right off the end of rom; + * I'm not sure if its supposed to mirror or read as open bus */ +// AM_RANGE(0x4000, 0x5fff) AM_RAM // 0x4000 has the boot code copied to it, 5fff and down are the stack +// AM_RANGE(0x6000, 0x6fff) AM_RAM // used by the relocated boot code; shared? + AM_RANGE(0x0800, 0xffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( tdv2324_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( tdv2324_io, AS_IO, 8, tdv2324_state ) + //ADDRESS_MAP_GLOBAL_MASK(0xff) + /* 0x30 is read by main code and if high bit isn't set at some point it will never get anywhere */ + /* e0, e2, e8, ea are written to */ + /* 30, e6 and e2 are readable */ + AM_RANGE(0x30, 0x30) AM_READ(tdv2324_main_io_30) +// AM_RANGE(0xe2, 0xe2) AM_WRITE(tdv2324_main_io_e2) console output + AM_RANGE(0xe6, 0xe6) AM_READ(tdv2324_main_io_e6) +// AM_RANGE(0x, 0x) AM_DEVREADWRITE(P8253_5_0_TAG, pit8253_device, read, write) +// AM_RANGE(0x, 0x) AM_DEVREADWRITE(MK3887N4_TAG, z80dart_device, ba_cd_r, ba_cd_w) +// AM_RANGE(0x, 0x) AM_DEVREADWRITE(P8259A_TAG, pic8259_device, read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( tdv2324_sub_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( tdv2324_sub_mem, AS_PROGRAM, 8, tdv2324_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION(P8085AH_1_TAG, 0) + AM_RANGE(0x4000, 0x47ff) AM_RAM + AM_RANGE(0x5000, 0x53ff) AM_RAM // EAROM + AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( tdv2324_sub_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( tdv2324_sub_io, AS_IO, 8, tdv2324_state ) + //ADDRESS_MAP_GLOBAL_MASK(0xff) + /* 20, 23, 30-36, 38, 3a, 3c, 3e, 60, 70 are written to */ + AM_RANGE(0x20, 0x23) AM_DEVREADWRITE(P8253_5_1_TAG, pit8253_device, read, write) + AM_RANGE(0x30, 0x3f) AM_DEVREADWRITE(TMS9937NL_TAG, tms9927_device, read, write) // TODO: this is supposed to be a 9937, which is not quite the same as 9927 +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( tdv2324_fdc_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( tdv2324_fdc_mem, AS_PROGRAM, 8, tdv2324_state ) + // the following two are probably enabled/disabled via the JP2 jumper block next to the fdc cpu + //AM_RANGE(0x0000, 0x001f) AM_RAM // on-6802-die ram (optionally battery backed) + //AM_RANGE(0x0020, 0x007f) AM_RAM // on-6802-die ram + AM_RANGE(0x0000, 0x07ff) AM_RAM // TMM2016AP-12 @ U14, tested with A5,5A pattern + //AM_RANGE(0x1000, 0x17ff) AM_RAM // TMM2016AP-12 @ U80, address is wrong + // the 3xxx area appears to be closely involved in fdc or other i/o + // in particular, reads from 30xx, 38xx, 3Cxx may be actually writes to certain fdc registers with data xx? + // 0x2101 is something writable + // 0x8000 is either a read from reg 0 (status reg) of the FD1797, OR a read from some sort of status from other cpus + // 0x8000 can also be written to + // 0x6000 can also be read from and written to + // Somewhere in here, the FDC chip and the hard disk interface live + AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION(MC68B02P_TAG, 0) // rom "962014 // -4-" @U15 +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( tdv2324 ) +//------------------------------------------------- + +static INPUT_PORTS_START( tdv2324 ) +INPUT_PORTS_END + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +void tdv2324_state::video_start() +{ +} + + +UINT32 tdv2324_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// SLOT_INTERFACE( tdv2324_floppies ) +//------------------------------------------------- + +static SLOT_INTERFACE_START( tdv2324_floppies ) + SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) +SLOT_INTERFACE_END + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( tdv2324 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( tdv2324, tdv2324_state ) + // basic system hardware + MCFG_CPU_ADD(P8085AH_0_TAG, I8085A, 8700000/2) // ??? + MCFG_CPU_PROGRAM_MAP(tdv2324_mem) + MCFG_CPU_IO_MAP(tdv2324_io) + + MCFG_CPU_ADD(P8085AH_1_TAG, I8085A, 8000000/2) // ??? + MCFG_CPU_PROGRAM_MAP(tdv2324_sub_mem) + MCFG_CPU_IO_MAP(tdv2324_sub_io) + + MCFG_CPU_ADD(MC68B02P_TAG, M6802, 8000000/2) // ??? + MCFG_CPU_PROGRAM_MAP(tdv2324_fdc_mem) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DRIVER(tdv2324_state, screen_update) + MCFG_SCREEN_SIZE(800, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 800-1, 0, 400-1) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_DEVICE_ADD(TMS9937NL_TAG, TMS9927, XTAL_25_39836MHz) + MCFG_TMS9927_CHAR_WIDTH(8) + + // devices + MCFG_PIC8259_ADD(P8259A_TAG, NULL, VCC, NULL) + + MCFG_DEVICE_ADD(P8253_5_0_TAG, PIT8253, 0) + + MCFG_DEVICE_ADD(P8253_5_1_TAG, PIT8253, 0) + + MCFG_Z80SIO2_ADD(MK3887N4_TAG, 8000000/2, 0, 0, 0, 0) + + MCFG_FD1797_ADD(FD1797PL02_TAG, 8000000/4) + MCFG_FLOPPY_DRIVE_ADD(FD1797PL02_TAG":0", tdv2324_floppies, "8dsdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1797PL02_TAG":1", tdv2324_floppies, "8dsdd", floppy_image_device::default_floppy_formats) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "tdv2324") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( tdv2324 ) +//------------------------------------------------- + +ROM_START( tdv2324 ) + ROM_REGION( 0x800, P8085AH_0_TAG, 0 ) + ROM_LOAD( "962058-1.21g", 0x000, 0x800, CRC(3771aece) SHA1(36d3f03235f327d6c8682e5c167aed6dddfaa6ec) ) + + ROM_REGION( 0x4000, P8085AH_1_TAG, 0 ) + ROM_LOAD( "962107-1.12c", 0x0000, 0x4000, CRC(29c1a139) SHA1(f55fa9075fdbfa6a3e94e5120270179f754d0ea5) ) + + ROM_REGION( 0x2000, MC68B02P_TAG, 0 ) + ROM_LOAD( "962014-4.13c", 0x0000, 0x2000, CRC(d01c32cd) SHA1(1f00f5f5ff0c035eec6af820b5acb6d0c207b6db) ) + + ROM_REGION( 0x800, "keyboard_8035", 0 ) + ROM_LOAD( "961294-3.u8", 0x000, 0x800, NO_DUMP ) + + ROM_REGION( 0x4000, "chargen", 0 ) + ROM_LOAD( "965268-1.4g", 0x0000, 0x4000, CRC(7222a85f) SHA1(e94074b68d90698734ab1fc38d156407846df47c) ) + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD( "961487-1.3f", 0x0000, 0x0200, NO_DUMP ) + ROM_LOAD( "prom.4f", 0x0000, 0x0200, NO_DUMP ) + ROM_LOAD( "prom.8g", 0x0000, 0x0200, NO_DUMP ) + ROM_LOAD( "prom.10f", 0x0000, 0x0200, NO_DUMP ) + ROM_LOAD( "961420-0.16f", 0x0000, 0x0200, NO_DUMP ) + ROM_LOAD( "962103-0.15g", 0x0000, 0x0200, NO_DUMP ) + + ROM_REGION( 0x200, "plds", 0 ) + ROM_LOAD( "962108-0.2g", 0x0000, 0x0200, NO_DUMP ) + ROM_LOAD( "pal.12d", 0x0000, 0x0200, NO_DUMP ) + ROM_LOAD( "pal.13d", 0x0000, 0x0200, NO_DUMP ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, tdv2324, 0, 0, tdv2324, tdv2324, driver_device, 0, "Tandberg", "TDV 2324", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mame/drivers/tec1.c b/src/mame/drivers/tec1.c new file mode 100644 index 00000000000..bfd701676f9 --- /dev/null +++ b/src/mame/drivers/tec1.c @@ -0,0 +1,463 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + TEC-1 driver, written by Robbbert in April, 2009 for MESS. + +The TEC-1 was a single-board "computer" described in Talking Electronics +magazine, issues number 10 and 11. Talking Electronics do not have dates on +their issues, so the date is uncertain, although 1984 seems a reasonable +guess. Talking Electronics operated from Cheltenham, a suburb of Melbourne. + +The hardware is quite simple, consisting of a Z80 cpu, 2x 8212 8-bit latch, +74C923 keyboard scanner, 20 push-button keys, 6-digit LED display, a speaker, +a 2k EPROM and sundry parts. + +The cpu speed could be adjusted by using a potentiometer, the range being +250 kHz to 2MHz. This is a simple method of adjusting a game's difficulty. + +We emulate the original version. Later enhancements included more RAM, speech +synthesis and various attachments, however I have no information on these. + +Pasting: + 0-F : as is + + (inc) : ^ + - (dec) : V + AD : - + GO : X + +Keys: +0 to 9, A to F are on the key of the same name. +AD (input an address) is the '-' key. ++ and - (increment / decrement address) are the up and down-arrow keys. +GO (execute program at current address) is the X key. +SHIFT - later monitor versions utilised an extra shift button. Hold + it down and press another key (use Left Shift). + +Whenever a program listing mentions RESET, do a Soft Reset. + +Each key causes a beep to be heard. You may need to press more than once +to get it to register. + +Inbuilt games - press the following sequence of keys: +- Welcome: RESET D 1 + 0 2 AD 0 2 7 0 GO GO (Paste: D1^02 -0270XX) +- Nim: RESET AD 3 E 0 GO GO (Paste: -3E0XX) +- Invaders: RESET AD 3 2 0 GO GO (Paste: -320XX) +- Luna Lander: RESET AD 4 9 0 GO GO (Paste: -490XX) + +Thanks to Chris Schwartz who dumped his ROM for me way back in the old days. +It's only taken 25 years to get around to emulating it... + + +Differences between tec1 and tecjmon: + +On the tec1 a keypress is indicated by an NMI from the 74C923; but on +the jmon it sets bit 6 of port 3 low instead. The NMI code is simply +a 'retn' in the jmon rom, so we can use the same code. +The jmon includes a cassette interface, a serial input connection, +and an optional LCD, but the games of the tec1 have been removed. + + +ToDo: +- After a Soft Reset, pressing keys can crash the emulation. +- The 74C923 code may need to be revisited to improve keyboard response. + Sometimes have to press a key a few times before it registers. +- The 10ms debounce is not emulated. + + +JMON ToDo: +- Add LCD display (2 rows by 16 characters) + + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "tec1.lh" + + +class tec1_state : public driver_device +{ +public: + tec1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cass(*this, "cassette"), + m_wave(*this, WAVE_TAG), + m_key_pressed(0), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_shift(*this, "SHIFT") + { } + + required_device m_maincpu; + required_device m_speaker; + optional_device m_cass; + optional_device m_wave; + bool m_key_pressed; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_ioport m_io_line3; + required_ioport m_io_shift; + emu_timer *m_kbd_timer; + DECLARE_READ8_MEMBER( tec1_kbd_r ); + DECLARE_READ8_MEMBER( latch_r ); + DECLARE_WRITE8_MEMBER( tec1_digit_w ); + DECLARE_WRITE8_MEMBER( tecjmon_digit_w ); + DECLARE_WRITE8_MEMBER( tec1_segment_w ); + UINT8 m_kbd; + UINT8 m_segment; + UINT8 m_digit; + UINT8 m_kbd_row; + UINT8 m_refresh[6]; + UINT8 tec1_convert_col_to_bin( UINT8 col, UINT8 row ); + virtual void machine_reset(); + virtual void machine_start(); + TIMER_CALLBACK_MEMBER(tec1_kbd_callback); +}; + + + + +/*************************************************************************** + + Display + +***************************************************************************/ + +WRITE8_MEMBER( tec1_state::tec1_segment_w ) +{ +/* d7 segment d + d6 segment e + d5 segment c + d4 segment dot + d3 segment b + d2 segment g + d1 segment f + d0 segment a */ + + m_segment = BITSWAP8(data, 4, 2, 1, 6, 7, 5, 3, 0); +} + +WRITE8_MEMBER( tec1_state::tec1_digit_w ) +{ +/* d7 speaker + d6 not used + d5 data digit 1 + d4 data digit 2 + d3 address digit 1 + d2 address digit 2 + d1 address digit 3 + d0 address digit 4 */ + + m_speaker->level_w(BIT(data, 7)); + + m_digit = data & 0x3f; +} + +WRITE8_MEMBER( tec1_state::tecjmon_digit_w ) +{ +/* d7 speaker & cassout + d6 not used + d5 data digit 1 + d4 data digit 2 + d3 address digit 1 + d2 address digit 2 + d1 address digit 3 + d0 address digit 4 */ + + m_speaker->level_w(BIT(data, 7)); + m_cass->output(BIT(data, 7) ? -1.0 : +1.0); + m_digit = data & 0x3f; +} + + +/*************************************************************************** + + Keyboard + +***************************************************************************/ + +READ8_MEMBER( tec1_state::latch_r ) +{ +// bit 7 - cass in ; bit 6 low = key pressed + UINT8 data = (m_key_pressed) ? 0 : 0x40; + + if (m_cass->input() > 0.03) + data |= 0x80; + + return data; +} + + +READ8_MEMBER( tec1_state::tec1_kbd_r ) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + return m_kbd | m_io_shift->read(); +} + +UINT8 tec1_state::tec1_convert_col_to_bin( UINT8 col, UINT8 row ) +{ + UINT8 data = row; + + if (BIT(col, 1)) + data |= 4; + else + if (BIT(col, 2)) + data |= 8; + else + if (BIT(col, 3)) + data |= 12; + else + if (BIT(col, 4)) + data |= 16; + + return data; +} + +TIMER_CALLBACK_MEMBER(tec1_state::tec1_kbd_callback) +{ + UINT8 i; + + // Display the digits. Blank any digits that haven't been refreshed for a while. + // This will fix the problem reported by a user. + for (i = 0; i < 6; i++) + { + if (BIT(m_digit, i)) + { + m_refresh[i] = 1; + output_set_digit_value(i, m_segment); + } + else + if (m_refresh[i] == 0x80) + { + output_set_digit_value(i, 0); + m_refresh[i] = 0; + } + else + if (m_refresh[i]) + m_refresh[i]++; + } + + // 74C923 4 by 5 key encoder. + + /* Look at old row */ + if (m_kbd_row == 0) + i = m_io_line0->read(); + else + if (m_kbd_row == 1) + i = m_io_line1->read(); + else + if (m_kbd_row == 2) + i = m_io_line2->read(); + else + if (m_kbd_row == 3) + i = m_io_line3->read(); + + /* if previous key is still held, bail out */ + if (i) + if (tec1_convert_col_to_bin(i, m_kbd_row) == m_kbd) + return; + + m_kbd_row++; + m_kbd_row &= 3; + + /* Look at a new row */ + if (m_kbd_row == 0) + i = m_io_line0->read(); + else + if (m_kbd_row == 1) + i = m_io_line1->read(); + else + if (m_kbd_row == 2) + i = m_io_line2->read(); + else + if (m_kbd_row == 3) + i = m_io_line3->read(); + + /* see if a key pressed */ + if (i) + { + m_kbd = tec1_convert_col_to_bin(i, m_kbd_row); + m_maincpu->set_input_line(INPUT_LINE_NMI, HOLD_LINE); + m_key_pressed = TRUE; + } + else + m_key_pressed = FALSE; +} + + +/*************************************************************************** + + Machine + +***************************************************************************/ + +void tec1_state::machine_start() +{ + m_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tec1_state::tec1_kbd_callback),this)); + m_kbd_timer->adjust( attotime::zero, 0, attotime::from_hz(500) ); +} + +void tec1_state::machine_reset() +{ + m_kbd = 0; +} + + + +/*************************************************************************** + + Address Map + +***************************************************************************/ + +static ADDRESS_MAP_START( tec1_map, AS_PROGRAM, 8, tec1_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0x0fff) AM_RAM // on main board + AM_RANGE(0x1000, 0x3fff) AM_RAM // expansion +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tec1_io, AS_IO, 8, tec1_state ) + ADDRESS_MAP_GLOBAL_MASK(0x07) + AM_RANGE(0x00, 0x00) AM_READ(tec1_kbd_r) + AM_RANGE(0x01, 0x01) AM_WRITE(tec1_digit_w) + AM_RANGE(0x02, 0x02) AM_WRITE(tec1_segment_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( tecjmon_map, AS_PROGRAM, 8, tec1_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0x37ff) AM_RAM + AM_RANGE(0x3800, 0x3fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tecjmon_io, AS_IO, 8, tec1_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READ(tec1_kbd_r) + AM_RANGE(0x01, 0x01) AM_WRITE(tecjmon_digit_w) + AM_RANGE(0x02, 0x02) AM_WRITE(tec1_segment_w) + AM_RANGE(0x03, 0x03) AM_READ(latch_r) + //AM_RANGE(0x04, 0x04) AM_WRITE(lcd_en_w) + //AM_RANGE(0x84, 0x84) AM_WRITE(lcd_2nd_w) +ADDRESS_MAP_END + + +/************************************************************************** + + Keyboard Layout + +***************************************************************************/ + +static INPUT_PORTS_START( tec1 ) + PORT_START("LINE0") /* KEY ROW 0 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + + PORT_START("LINE1") /* KEY ROW 1 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + + PORT_START("LINE2") /* KEY ROW 2 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("LINE3") /* KEY ROW 3 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_START("SHIFT") + PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +/*************************************************************************** + + Machine driver + +***************************************************************************/ + +static MACHINE_CONFIG_START( tec1, tec1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 1000000) /* speed can be varied between 250kHz and 2MHz */ + MCFG_CPU_PROGRAM_MAP(tec1_map) + MCFG_CPU_IO_MAP(tec1_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_tec1) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( tecjmon, tec1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz / 2) + MCFG_CPU_PROGRAM_MAP(tecjmon_map) + MCFG_CPU_IO_MAP(tecjmon_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_tec1) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver + +***************************************************************************/ + +ROM_START(tec1) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS(0, "mon1", "MON1") + ROMX_LOAD("mon1.rom", 0x0000, 0x0800, CRC(b3390c36) SHA1(18aabc68d473206b7fc4e365c6b57a4e218482c3), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "mon1b", "MON1B") + ROMX_LOAD("mon1b.rom", 0x0000, 0x0800, CRC(60daea3c) SHA1(383b7e7f02e91fb18c87eb03c5949e31156771d4), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "mon2", "MON2") + ROMX_LOAD("mon2.rom", 0x0000, 0x0800, CRC(082fd7e7) SHA1(7659add30ca22b15a03d1cbac0892a5c25e47ecd), ROM_BIOS(3)) +ROM_END + +ROM_START(tecjmon) + ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) + ROM_LOAD("jmon.rom", 0x0000, 0x0800, CRC(202c47a2) SHA1(701588ec5640d633d90d94b2ccd6f65422e19a70) ) + ROM_LOAD("util.rom", 0x3800, 0x0800, CRC(7c19700d) SHA1(dc5b3ade66bb11c54430056966ed99cdd299d82b) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1984, tec1, 0, 0, tec1, tec1, driver_device, 0, "Talking Electronics magazine", "TEC-1" , 0 ) +COMP( 1984, tecjmon, tec1, 0, tecjmon, tec1, driver_device, 0, "Talking Electronics magazine", "TEC-1A with JMON" , 0 ) diff --git a/src/mame/drivers/tecnbras.c b/src/mame/drivers/tecnbras.c new file mode 100644 index 00000000000..5e1b7870e38 --- /dev/null +++ b/src/mame/drivers/tecnbras.c @@ -0,0 +1,133 @@ +// license:GPL-2.0+ +// copyright-holders: Felipe Sanches +/*************************************************************************** + + TECNBRAS dot matrix display (70x7 pixels) + Driver by Felipe Correa da Silva Sanches + + The display is composed of 14 blocks of 5x7 LEDs + + These LEDs are driven by several 74xx chips: + * one 74138 + * several 74164 and ULN2003 chips + + Changelog: + + 2014 JUN 23 [Felipe Sanches]: + * Initial driver skeleton + +================ +*/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "tecnbras.lh" + +class tecnbras_state : public driver_device +{ +public: + tecnbras_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + + DECLARE_WRITE8_MEMBER(set_x_position_w); + DECLARE_WRITE8_MEMBER(print_column_w); + +// DECLARE_WRITE8_MEMBER(tecnbras_io_w); +// DECLARE_READ8_MEMBER(tecnbras_io_r); + DECLARE_DRIVER_INIT(tecnbras); +private: + int m_xcoord; + char m_digit[14][7]; + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(i80c31_prg, AS_PROGRAM, 8, tecnbras_state) + AM_RANGE(0x0000, 0x7FFF) AM_ROM + AM_RANGE(0x8000, 0xFFFF) AM_RAM +ADDRESS_MAP_END + +#define DMD_OFFSET 24 //This is a guess. We should verify the real hardware behaviour +static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, tecnbras_state) + AM_RANGE(0x0100+DMD_OFFSET, 0x0145+DMD_OFFSET) AM_WRITE(set_x_position_w) + AM_RANGE(0x06B8, 0x06BC) AM_WRITE(print_column_w) + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_NOP /*buzzer ?*/ +ADDRESS_MAP_END + +DRIVER_INIT_MEMBER( tecnbras_state, tecnbras ) +{ + m_xcoord = 0; + for (int x=0; x<14; x++){ + for (int y=0; y<7; y++){ + m_digit[x][y] = 0; + } + } +} + +WRITE8_MEMBER(tecnbras_state::set_x_position_w) +{ + m_xcoord = offset; +} + +WRITE8_MEMBER(tecnbras_state::print_column_w) +{ + int x = m_xcoord + offset; + for (int i=0; i<7; i++){ + if((x/5) < ARRAY_LENGTH(m_digit)){ + m_digit[x/5][i] &= ~(1 << (x%5)); + m_digit[x/5][i] |= BIT(data, 7-i) ? (1 << (x%5)) : 0; + output_set_indexed_value("dmd_", (x/5)*7 + i, 0x1F & m_digit[x/5][i]); + } + } +} + +void tecnbras_state::machine_start() +{ +/* + for (int x=0; x<14; x++){ + for (int y=0; y<7; y++){ + output_set_indexed_value("dmd_", x*7 + y, y); + } + } +*/ +} + +void tecnbras_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( tecnbras, tecnbras_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80C31, XTAL_12MHz) /* verified on pcb */ + MCFG_CPU_PROGRAM_MAP(i80c31_prg) + MCFG_CPU_IO_MAP(i80c31_io) + +/* TODO: Add an I2C RTC (Phillips PCF8583P) + pin 6 (SCL): cpu T0/P3.4 (pin 14) + pin 5 (SDA): cpu T1/P3.5 (pin 15) +*/ + +/* + TODO: Add a speaker + CPU P1.0 (pin 1) +*/ + +/* + TODO: Add a communications port to receive commands from the remote control +*/ + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_tecnbras) + +MACHINE_CONFIG_END + +ROM_START( tecnbras ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "tecnbras.u2", 0x0000, 0x8000, CRC(1a1e18fc) SHA1(8907e72f0356a2e2e1097dabac6d6b0b3d717f85) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 200?, tecnbras, 0, 0, tecnbras, 0, tecnbras_state, tecnbras, "Tecnbras", "Dot Matrix Display (70x7 pixels)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/tek405x.c b/src/mame/drivers/tek405x.c new file mode 100644 index 00000000000..767d5399d8d --- /dev/null +++ b/src/mame/drivers/tek405x.c @@ -0,0 +1,1252 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Tektronix 4051/4052A + + Skeleton driver. + + http://www.electronixandmore.com/articles/teksystem.html + +****************************************************************************/ + +/* + + TODO: + + - bank switch + - keyboard + - video (persistent vector display) + - joystick + - magnetic tape storage (3M 300) + - communications backpack + - 4051E01 ROM expander + +*/ + + +#include "includes/tek405x.h" + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +enum { + LBS_RBC = 0, // ROM Bank Control + LBS_BSOFL, // Bank Switch Overflow (Select Overflow ROMs) + LBS_BSCOM, // Bank Switch Communication (Select Communication ROMs) + LBS_INVALID, + LBS_BS_L, // Bank Switch Left (Select Left ROM Pack) + LBS_BS_R, // Bank Switch Right (Select Right ROM Pack) + LBS_BSX_L, // Bank Switch Expander (Select Left ROM Expander Unit) + LBS_BSX_R // Bank Switch Expander (Select Right ROM Expander Unit) +}; + + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// update_irq - +//------------------------------------------------- + +void tek4051_state::update_irq() +{ + int state = m_kb_pia_irqa | m_kb_pia_irqb | m_x_pia_irqa | m_x_pia_irqb | m_gpib_pia_irqa | m_gpib_pia_irqb | m_com_pia_irqa | m_com_pia_irqb | m_acia_irq; + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); +} + + +//------------------------------------------------- +// update_nmi - +//------------------------------------------------- + +void tek4051_state::update_nmi() +{ + int state = m_y_pia_irqa | m_y_pia_irqb | m_tape_pia_irqa | m_tape_pia_irqb; + + m_maincpu->set_input_line(INPUT_LINE_NMI, state); +} + + + +//************************************************************************** +// KEYBOARD +//************************************************************************** + +//------------------------------------------------- +// scan_keyboard - scan keyboard +//------------------------------------------------- + +void tek4051_state::scan_keyboard() +{ +} + + +//------------------------------------------------- +// TIMER_DEVICE_CALLBACK_MEMBER( keyboard_tick ) +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(tek4051_state::keyboard_tick) +{ + scan_keyboard(); +} + + + +//************************************************************************** +// MEMORY BANKING +//************************************************************************** + +//------------------------------------------------- +// bankswitch - +//------------------------------------------------- + +void tek4051_state::bankswitch(UINT8 data) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + //int d = data & 0x07; + int lbs = (data >> 3) & 0x07; + + switch (lbs) + { + case LBS_RBC: + program.install_rom(0x8800, 0xa7ff, m_rom->base() + 0x800); + break; + + case LBS_BSOFL: + program.install_rom(0x8800, 0xa7ff, m_bsofl_rom->base()); + break; + + case LBS_BSCOM: + program.install_rom(0x8800, 0xa7ff, m_bscom_rom->base()); + break; + + default: + program.unmap_readwrite(0x8800, 0xa7ff); + } +} + + +WRITE8_MEMBER( tek4051_state::lbs_w ) +{ + /* + + bit description + + 0 ROM Expander Slot Address + 1 ROM Expander Slot Address + 2 ROM Expander Slot Address + 3 Bank Switch + 4 Bank Switch + 5 Bank Switch + 6 + 7 + + */ + + logerror("LBS %02x\n", data); + + bankswitch(data); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( tek4051_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( tek4051_mem, AS_PROGRAM, 8, tek4051_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAM + AM_RANGE(0x2000, 0x7fff) AM_RAM // optional RAM + AM_RANGE(0x8000, 0x877f) AM_ROM AM_REGION(MC6800_TAG, 0) + AM_RANGE(0x878c, 0x878f) AM_DEVREADWRITE(MC6820_Y_TAG, pia6821_device, read, write) + AM_RANGE(0x8794, 0x8797) AM_DEVREADWRITE(MC6820_X_TAG, pia6821_device, read, write) + AM_RANGE(0x8798, 0x879b) AM_DEVREADWRITE(MC6820_TAPE_TAG, pia6821_device, read, write) + AM_RANGE(0x87a8, 0x87ab) AM_DEVREADWRITE(MC6820_KB_TAG, pia6821_device, read, write) + AM_RANGE(0x87b0, 0x87b3) AM_DEVREADWRITE(MC6820_GPIB_TAG, pia6821_device, read, write) + AM_RANGE(0x87c0, 0x87c0) AM_MIRROR(0x03) AM_WRITE(lbs_w) +// AM_RANGE(0x87c0, 0x87c3) AM_DEVREADWRITE(MC6820_COM_TAG, pia6821_device, read, write) +// AM_RANGE(0x87c4, 0x87c4) AM_MIRROR(0x02) AM_DEVREADWRITE(MC6850_TAG, acia6850_device, status_r, control_w) +// AM_RANGE(0x87c5, 0x87c5) AM_MIRROR(0x02) AM_DEVREADWRITE(MC6850_TAG, acia6850_device, data_r, data_w) +// AM_RANGE(0x87c8, 0x87cb) XPC2 +// AM_RANGE(0x87cc, 0x87cf) XPC3 +// AM_RANGE(0x87d0, 0x87d3) XPC4 + AM_RANGE(0x8800, 0xa7ff) AM_ROM AM_REGION(MC6800_TAG, 0x800) + AM_RANGE(0xa800, 0xffff) AM_ROM AM_REGION(MC6800_TAG, 0x2800) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( tek4052_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( tek4052_mem, AS_PROGRAM, 8, tek4052_state ) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( tek4051 ) +//------------------------------------------------- + +static INPUT_PORTS_START( tek4051 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y12") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y13") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y14") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y15") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TTY LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) +INPUT_PORTS_END + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +void tek4051_state::video_start() +{ +} + + +void tek4052_state::video_start() +{ +} + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +READ8_MEMBER( tek4051_state::x_pia_pa_r ) +{ + /* + + bit description + + PA0 + PA1 + PA2 DRBUSY-0 + PA3 VPULSE-1 + PA4 + PA5 + PA6 + PA7 + + */ + + return 0; +} + +WRITE8_MEMBER( tek4051_state::x_pia_pa_w ) +{ + /* + + bit description + + PA0 X D/A + PA1 X D/A + PA2 + PA3 + PA4 ERASE-0 + PA5 COPY-0 + PA6 VECTOR-0 + PA7 VEN-1 + + */ +} + +WRITE8_MEMBER( tek4051_state::x_pia_pb_w ) +{ + /* + + bit description + + PB0 X D/A + PB1 X D/A + PB2 X D/A + PB3 X D/A + PB4 X D/A + PB5 X D/A + PB6 X D/A + PB7 X D/A + + */ +} + +WRITE_LINE_MEMBER( tek4051_state::adot_w ) +{ +} + +WRITE_LINE_MEMBER( tek4051_state::bufclk_w ) +{ +} + +WRITE_LINE_MEMBER( tek4051_state::x_pia_irqa_w ) +{ + m_x_pia_irqa = state; + update_irq(); +} + +WRITE_LINE_MEMBER( tek4051_state::x_pia_irqb_w ) +{ + m_x_pia_irqb = state; + update_irq(); +} + +READ8_MEMBER( tek4051_state::sa_r ) +{ + /* + + bit description + + PA0 SA0 + PA1 SA1 + PA2 SA2 + PA3 SA3 + PA4 SA4 + PA5 SA5 + PA6 SA6 + PA7 SA7 + + */ + + return 0; +} + +WRITE8_MEMBER( tek4051_state::y_pia_pa_w ) +{ + /* + + bit description + + PA0 Y D/A + PA1 Y D/A + PA2 Y CHAR D/A + PA3 Y CHAR D/A + PA4 Y CHAR D/A + PA5 X CHAR D/A + PA6 X CHAR D/A + PA7 X CHAR D/A + + */ +} + +WRITE8_MEMBER( tek4051_state::sb_w ) +{ + /* + + bit description + + PB0 SB0 + PB1 SB1 + PB2 SB2 + PB3 SB3 + PB4 SB4 + PB5 SB5 + PB6 SB6 + PB7 SB7 + + */ +} + +WRITE_LINE_MEMBER( tek4051_state::sot_w ) +{ +} + +WRITE_LINE_MEMBER( tek4051_state::y_pia_irqa_w ) +{ + m_y_pia_irqa = state; + update_nmi(); +} + +WRITE_LINE_MEMBER( tek4051_state::y_pia_irqb_w ) +{ + m_y_pia_irqb = state; + update_nmi(); +} + + +READ8_MEMBER( tek4051_state::kb_pia_pa_r ) +{ + /* + + bit description + + PA0 KC0-1 + PA1 KC1-1 + PA2 KC2-1 + PA3 KC3-1 + PA4 KC4-1 + PA5 KC5-1 + PA6 KC6-1 + PA7 TTY-0 + + */ + + UINT8 data = 0; + UINT8 special = m_special->read(); + + // keyboard column + data = m_kc; + + // TTY lock + data |= BIT(special, 3) << 7; + + return data; +} + +READ8_MEMBER( tek4051_state::kb_pia_pb_r ) +{ + /* + + bit description + + PB0 SHIFT-0 + PB1 CTRL-0 + PB2 + PB3 LOAD-0 + PB4 + PB5 + PB6 + PB7 + + */ + + UINT8 data = 0; + UINT8 special = m_special->read(); + + // shift + data |= (BIT(special, 0) & BIT(special, 1)); + + // ctrl + data |= BIT(special, 2) << 1; + + return data; +} + +WRITE8_MEMBER( tek4051_state::kb_pia_pb_w ) +{ + /* + + bit description + + PB0 + PB1 + PB2 + PB3 + PB4 EOI-1 + PB5 BREAK-1 + PB6 I/O-1 + PB7 BUSY-1/REN-0/SPEAKER + + */ + + // lamps + output_set_led_value(1, !BIT(data, 5)); + output_set_led_value(2, !BIT(data, 6)); + output_set_led_value(3, !BIT(data, 7)); + + // end or identify + m_gpib->eoi_w(!BIT(data, 4)); + + // speaker + m_speaker->level_w(!BIT(data, 7)); + + // remote enable + m_gpib->ren_w(!BIT(data, 7)); +} + +WRITE_LINE_MEMBER( tek4051_state::kb_halt_w ) +{ +} + +WRITE_LINE_MEMBER( tek4051_state::kb_pia_irqa_w ) +{ + m_kb_pia_irqa = state; + update_irq(); +} + +WRITE_LINE_MEMBER( tek4051_state::kb_pia_irqb_w ) +{ + m_kb_pia_irqb = state; + update_irq(); +} + + +READ8_MEMBER( tek4051_state::tape_pia_pa_r ) +{ + /* + + bit description + + PA0 DELAY OUT-1 + PA1 + PA2 TUTS-1 + PA3 SAFE-1 + PA4 SAFE-1 + PA5 JOYSTICK + PA6 FILFND-1 + PA7 JOYSTICK + + */ + + return 0; +} + +WRITE8_MEMBER( tek4051_state::tape_pia_pa_w ) +{ + /* + + bit description + + PA0 + PA1 LDCLK-1 + PA2 + PA3 + PA4 + PA5 XERR-1 + PA6 + PA7 YERR-1 + + */ +} + +WRITE8_MEMBER( tek4051_state::tape_pia_pb_w ) +{ + /* + + bit description + + PB0 WR-0 + PB1 FAST-1 + PB2 REV-1 + PB3 DRTAPE-0 + PB4 GICG-1 + PB5 FICG-1 + PB6 WENABLE-1 + PB7 FSENABLE-0 + + */ +} + +WRITE_LINE_MEMBER( tek4051_state::tape_pia_irqa_w ) +{ + m_tape_pia_irqa = state; + update_nmi(); +} + +WRITE_LINE_MEMBER( tek4051_state::tape_pia_irqb_w ) +{ + m_tape_pia_irqb = state; + update_nmi(); +} + + +WRITE8_MEMBER( tek4051_state::dio_w ) +{ + /* + + bit description + + PA0 DIO1-1 + PA1 DIO2-1 + PA2 DIO3-1 + PA3 DIO4-1 + PA4 DIO5-1 + PA5 DIO6-1 + PA6 DIO7-1 + PA7 DIO8-1 + + */ + + if (m_talk) + { + m_gpib->dio_w(data); + } +} + +READ8_MEMBER( tek4051_state::gpib_pia_pb_r ) +{ + /* + + bit description + + PB0 + PB1 + PB2 + PB3 + PB4 NRFD + PB5 SRQ-1 + PB6 DAV-1 + PB7 NDAC + + */ + + UINT8 data = 0; + + // service request + data |= m_gpib->srq_r() << 5; + + // data valid + data |= m_gpib->dav_r() << 6; + + if (!m_talk) + { + // not ready for data + data |= m_gpib->nrfd_r() << 4; + + // not data acknowledged + data |= m_gpib->ndac_r() << 7; + } + + return data; +} + +WRITE8_MEMBER( tek4051_state::gpib_pia_pb_w ) +{ + /* + + bit description + + PB0 EOI-1 + PB1 IFC-1 + PB2 + PB3 ATN-0 + PB4 NRFD + PB5 + PB6 + PB7 NDAC + + */ + + // end or identify + m_gpib->eoi_w(!BIT(data, 0)); + + // interface clear + m_gpib->ifc_w(!BIT(data, 1)); + + // attention + m_gpib->atn_w(BIT(data, 3)); + + if (m_talk) + { + // not ready for data + m_gpib->nrfd_w(!BIT(data, 4)); + + // not data acknowledged + m_gpib->ndac_w(!BIT(data, 7)); + } +} + +WRITE_LINE_MEMBER( tek4051_state::talk_w ) +{ + m_talk = state; + + if (!m_talk) + { + m_gpib->dio_w(0xff); + m_gpib->nrfd_w(1); + m_gpib->ndac_w(1); + } +} + +WRITE_LINE_MEMBER( tek4051_state::gpib_pia_irqa_w ) +{ + m_gpib_pia_irqa = state; + update_irq(); +} + +WRITE_LINE_MEMBER( tek4051_state::gpib_pia_irqb_w ) +{ + m_gpib_pia_irqb = state; + update_irq(); +} + + +WRITE8_MEMBER( tek4051_state::com_pia_pa_w ) +{ + /* + + bit description + + PA0 + PA1 + PA2 + PA3 Bank Switch Register + PA4 Bank Switch Register + PA5 Bank Switch Register + PA6 + PA7 + + */ + + bankswitch(data); +} + +READ8_MEMBER( tek4051_state::com_pia_pb_r ) +{ + /* + + bit description + + PB0 SRX + PB1 DTR + PB2 RTS + PB3 + PB4 + PB5 + PB6 + PB7 + + */ + + UINT8 data = 0; + + // data terminal ready + + // request to send + + return data; +} + +WRITE8_MEMBER( tek4051_state::com_pia_pb_w ) +{ + /* + + bit description + + PB0 + PB1 + PB2 + PB3 CTS + PB4 STXA-C + PB5 Baud Rate Select + PB6 Baud Rate Select + PB7 Baud Rate Select + + */ + + // clear to send + + // baud rate select + int osc = BIT(data, 7) ? 28160 : 38400; + int div = 1; + + switch ((data >> 5) & 0x03) + { + case 2: div = 4; break; + case 3: div = 2; break; + } + + m_acia_clock->set_unscaled_clock(osc); + m_acia_clock->set_clock_scale((double) 1 / div); +} + +WRITE_LINE_MEMBER( tek4051_state::com_pia_irqa_w ) +{ + m_com_pia_irqa = state; + update_irq(); +} + +WRITE_LINE_MEMBER( tek4051_state::com_pia_irqb_w ) +{ + m_com_pia_irqb = state; + update_irq(); +} + + +WRITE_LINE_MEMBER( tek4051_state::acia_irq_w ) +{ + m_acia_irq = state; + update_irq(); +} + +WRITE_LINE_MEMBER( tek4051_state::write_acia_clock ) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( tek4051 ) +//------------------------------------------------- + +void tek4051_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + // configure RAM + switch (m_ram->size()) + { + case 8*1024: + program.unmap_readwrite(0x2000, 0x7fff); + break; + + case 16*1024: + program.unmap_readwrite(0x4000, 0x7fff); + break; + + case 24*1024: + program.unmap_readwrite(0x6000, 0x7fff); + break; + } + + // register for state saving +} + + +//------------------------------------------------- +// MACHINE_START( tek4052 ) +//------------------------------------------------- + +void tek4052_state::machine_start() +{ +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( tek4051 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( tek4051, tek4051_state ) + // basic machine hardware + MCFG_CPU_ADD(MC6800_TAG, M6800, XTAL_12_5MHz/15) + MCFG_CPU_PROGRAM_MAP(tek4051_mem) + + // video hardware + MCFG_VECTOR_ADD("vector") + MCFG_SCREEN_ADD(SCREEN_TAG, VECTOR) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate + MCFG_SCREEN_SIZE(1024, 780) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 780-1) + MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", tek4051_state, keyboard_tick, attotime::from_hz(XTAL_12_5MHz/15/4)) + + MCFG_DEVICE_ADD(MC6820_X_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(tek4051_state, x_pia_pa_r)) + // CB1 viewcause + MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, x_pia_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, x_pia_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(tek4051_state, adot_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(tek4051_state, bufclk_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, x_pia_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, x_pia_irqb_w)) + + MCFG_DEVICE_ADD(MC6820_Y_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(tek4051_state, sa_r)) + // CA1 rdbyte + // CB1 mdata + // CB2 fmark + MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, y_pia_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, sb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(tek4051_state, sot_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, y_pia_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, y_pia_irqb_w)) + + MCFG_DEVICE_ADD(MC6820_KB_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(tek4051_state, kb_pia_pa_r)) + MCFG_PIA_READPB_HANDLER(READ8(tek4051_state, kb_pia_pb_r)) + // CA1 key + MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, kb_pia_pb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(tek4051_state, kb_halt_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, kb_pia_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, kb_pia_irqb_w)) + + MCFG_DEVICE_ADD(MC6820_TAPE_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(tek4051_state, tape_pia_pa_r)) + // CA1 rmark + // CB1 lohole + // CA2 filfnd + // CB2 uphole + MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, tape_pia_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, tape_pia_pb_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, tape_pia_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, tape_pia_irqb_w)) + + MCFG_DEVICE_ADD(MC6820_GPIB_TAG, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) + MCFG_PIA_READPB_HANDLER(READ8(tek4051_state, gpib_pia_pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, dio_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, gpib_pia_pb_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(tek4051_state, talk_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, gpib_pia_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, gpib_pia_irqb_w)) + + MCFG_DEVICE_ADD(MC6820_COM_TAG, PIA6821, 0) + MCFG_PIA_READPB_HANDLER(READ8(tek4051_state, com_pia_pb_r)) + //CA1 - SRX (RS-232 pin 12) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, com_pia_pa_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, com_pia_pb_w)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, com_pia_irqa_w)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, com_pia_irqb_w)) + + MCFG_DEVICE_ADD(MC6850_TAG, ACIA6850, 0) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(tek4051_state, acia_irq_w)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 38400) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(tek4051_state, write_acia_clock)) + + MCFG_IEEE488_BUS_ADD() + MCFG_IEEE488_EOI_CALLBACK(DEVWRITELINE(MC6820_GPIB_TAG, pia6821_device, ca1_w)) + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MC6820_GPIB_TAG, pia6821_device, cb1_w)) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8K") + MCFG_RAM_EXTRA_OPTIONS("16K,24K,32K") + + // cartridge + MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_plain_slot, "tek4050_cart") + MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_plain_slot, "tek4050_cart") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( tek4052 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( tek4052, tek4052_state ) + // basic machine hardware + MCFG_CPU_ADD(AM2901A_TAG, M6800, 1000000) // should be 4x AM2901A + AM2911 + MCFG_CPU_PROGRAM_MAP(tek4052_mem) + + // video hardware + MCFG_VECTOR_ADD("vector") + MCFG_SCREEN_ADD(SCREEN_TAG, VECTOR) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate + MCFG_SCREEN_SIZE(1024, 780) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 780-1) + MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("64K") + + // cartridge + MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_plain_slot, "tek4050_cart") + MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_plain_slot, "tek4050_cart") + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list", "tek4052_cart") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( tek4054 ) +//------------------------------------------------- +/* +static MACHINE_CONFIG_START( tek4054, tek4052_state ) + MCFG_SCREEN_SIZE(4096, 3125) + MCFG_SCREEN_VISIBLE_AREA(0, 4096-1, 0, 3125-1) +MACHINE_CONFIG_END +*/ + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( tek4051 ) +//------------------------------------------------- + +ROM_START( tek4051 ) + ROM_REGION( 0x8000, MC6800_TAG, 0 ) + ROM_LOAD( "156-0659-xx.u585", 0x0000, 0x0800, CRC(0017ba54) SHA1(533bfacb2e698c1df88a00acce6df6a8c536239d) ) // -01 or -02 ? + ROM_LOAD( "156-0660-01.u581", 0x0800, 0x0800, CRC(c4e302e8) SHA1(a0438cbc70ddc1bab000e30c0f835f0948aae969) ) + ROM_LOAD( "156-0661-01.u487", 0x1000, 0x0800, CRC(edb097c8) SHA1(a07b777b6b20de496089730db8097b65b9a8ef31) ) + ROM_LOAD( "156-0662-01.u485", 0x1800, 0x0800, CRC(0a3af548) SHA1(01bcffa7d55b2585348ea96852b4319c6454d19a) ) + ROM_LOAD( "156-0663-01.u481", 0x2000, 0x0800, CRC(f220d24c) SHA1(fb5dc8a617f4b4d5c094c0cbabb9af158c19c2c2) ) + ROM_LOAD( "156-0664-xx.u385", 0x2800, 0x0800, CRC(aa1ae67d) SHA1(8816654c1b0ad0230bf5027f68c2ec1d315ad188) ) // -01 or -02 ? + ROM_LOAD( "156-0665-xx.u381", 0x3000, 0x0800, CRC(90497138) SHA1(2d6bbe169a434581a49fffcab0d2ca18107b67da) ) // -01 or -02 ? + ROM_LOAD( "156-0666-01.u285", 0x3800, 0x0800, CRC(c35ce405) SHA1(10cae122d000fe2886228a178a1a4e4d3ec2c3f5) ) + ROM_LOAD( "156-0667-xx.u595", 0x4000, 0x0800, CRC(e1723a06) SHA1(dde3e64eb6acc77d8e7234235a99ec338cc74717) ) // -01 or -02 ? + ROM_LOAD( "156-0668-xx.u591", 0x4800, 0x0800, CRC(d8b80d7a) SHA1(6c1f00fa2f9ff6ebd84268c2100637ddbdb3bae6) ) // -01 or -02 ? + ROM_LOAD( "156-0669-01.u497", 0x5000, 0x0800, CRC(f760ed39) SHA1(2b30d20d880002ce3950ee7abe40f4e1539208cc) ) + ROM_LOAD( "156-0670-01.u495", 0x5800, 0x0800, CRC(d40a303d) SHA1(111b399f6178e2fe50b1368536f290d4df9883fc) ) + ROM_LOAD( "156-0671-xx.u491", 0x6000, 0x0800, CRC(32060b64) SHA1(af254dc068686fcd7584128258724fd5415ea458) ) // -01 or -02 ? + ROM_LOAD( "156-0672-xx.u395", 0x6800, 0x0800, CRC(93ad68d1) SHA1(8242058bfc89d11cd9ae82d967410714875eface) ) // -01 or -02 ? + ROM_LOAD( "156-0673-xx.u391", 0x7000, 0x0800, CRC(ee1f5d4c) SHA1(a6fb8347a0dfa94268f091fb7ca091c8bfabeabd) ) // -01 or -02 or -03 ? + ROM_LOAD( "156-0674-xx.u295", 0x7800, 0x0800, CRC(50582341) SHA1(1a028176e5d5ca83012e2f75e9daad88cd7d8fc3) ) // -01 or -02 ? + + ROM_REGION( 0x2000, "020_0147_00", 0 ) // Firmware Backpack (020-0147-00) + ROM_LOAD( "156-0747-xx.u101", 0x0000, 0x0800, CRC(9e1facc1) SHA1(7e7a118c3e8c49630f630ee02c3de843dd95d7e1) ) // -00 or -01 ? + ROM_LOAD( "156-0748-xx.u201", 0x0800, 0x0800, CRC(be42bfbf) SHA1(23575b411bd9dcb7d7116628820096e3064ff93b) ) // -00 or -01 ? + + ROM_REGION( 0x2000, "021_0188_00", 0 ) // Communications Backpack (021-0188-00) + ROM_LOAD( "156-0712-00.u101", 0x0000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0712-01.u101", 0x0000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0713-00.u111", 0x0800, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0713-01.u111", 0x0800, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0714-00.u121", 0x1000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0714-01.u121", 0x1000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0715-01.u131", 0x1800, 0x0800, NO_DUMP ) +/* + ROM_REGION( 0x2000, "4051r01", 0 ) // 4051R01 Matrix Functions + ROM_LOAD( "4051r01", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x2000, "4051r05", 0 ) // 4051R05 Binary Program Loader + ROM_LOAD( "156-0856-00.u1", 0x0000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0857-00.u11", 0x0800, 0x0800, NO_DUMP ) + + ROM_REGION( 0x2000, "4051r06", 0 ) // 4051R06 Editor + ROM_LOAD( "4051r06", 0x0000, 0x1000, NO_DUMP ) +*/ +ROM_END + + +//------------------------------------------------- +// ROM( tek4052a ) +//------------------------------------------------- + +ROM_START( tek4052a ) + ROM_REGION( 0x3800, AM2901A_TAG, 0 ) // ALU 670-7705-00 microcode + ROM_LOAD( "160-1689-00.u340", 0x0000, 0x0800, CRC(97ff62d4) SHA1(e25b495fd1b3f8a5bfef5c8f20efacde8366e89c) ) + ROM_LOAD( "160-1688-00.u335", 0x0800, 0x0800, CRC(19033422) SHA1(0f6ea45be5123701940331c4278bcdc5db4f4147) ) + ROM_LOAD( "160-1687-00.u330", 0x1000, 0x0800, CRC(3b2e37dd) SHA1(294b626d0022fbf9bec50680b6b932f21a3cb049) ) + ROM_LOAD( "160-1686-00.u320", 0x1800, 0x0800, CRC(7916cd64) SHA1(d6b3ed783e488667ca203ec605aa27d78261c61b) ) + ROM_LOAD( "160-1695-00.u315", 0x2000, 0x0800, CRC(cdac76a7) SHA1(2a47f34ae63fb7fe96e7c6fc92ca4f629b0e31ec) ) + ROM_LOAD( "160-1694-00.u305", 0x2800, 0x0800, CRC(c33ae212) SHA1(25ed4cc3600391fbc93bb46c92d3f64ca2aca58e) ) + ROM_LOAD( "160-1693-00.u300", 0x3000, 0x0800, CRC(651b7af2) SHA1(7255c682cf74f2e77661d77c8406b36a567eea46) ) + + ROM_REGION( 0x14000, "672_0799_08", 0 ) // Memory Access Sequencer 672-0799-08 + ROM_LOAD16_BYTE( "160-1698-00.u810", 0x00000, 0x2000, CRC(fd0b8bc3) SHA1(ea9caa151295024267a467ba636ad41aa0c517d3) ) + ROM_LOAD16_BYTE( "160-1682-00.u893", 0x00001, 0x2000, CRC(d54104ef) SHA1(b796c320c8f96f6e4b845718bfb62ccb5903f2db) ) + ROM_LOAD16_BYTE( "160-1699-00.u820", 0x04000, 0x2000, CRC(59cc6c2e) SHA1(b6d85cdfaaef360af2a4fc44eae55e512bb08b21) ) + ROM_LOAD16_BYTE( "160-1684-00.u870", 0x04001, 0x2000, CRC(b24cdbaf) SHA1(476032624110bc5c7a7f30d10458e8baffb2f2ff) ) + ROM_LOAD16_BYTE( "160-1700-00.u825", 0x08000, 0x2000, CRC(59f4a4e2) SHA1(81b5f74ec14bb13735382abc123bb9b09dfb7a63) ) + ROM_LOAD16_BYTE( "160-1683-00.u880", 0x08001, 0x2000, CRC(f6bb15d1) SHA1(eca06211876c12236cfeae0417131e8f04728d51) ) + ROM_LOAD16_BYTE( "160-1701-00.u835", 0x0c000, 0x2000, CRC(195988b9) SHA1(995a77963e869f1a461addf58db9ecbf2b9222ba) ) + ROM_LOAD16_BYTE( "160-1691-00.u885", 0x0c001, 0x2000, CRC(0670bf9e) SHA1(a8c39bd7f3f61436296c6bc5f734354371ae8123) ) + ROM_LOAD16_BYTE( "160-1702-00.u845", 0x10000, 0x2000, CRC(013344b1) SHA1(4a79654427e15d0fcedd9519914f6448938ecffd) ) + ROM_LOAD16_BYTE( "160-1685-00.u863", 0x10001, 0x2000, CRC(53ddc8f9) SHA1(431d6f329dedebb54232c623a924d5ecddc5e44e) ) + + ROM_REGION( 0x2000, "020_0147_00", 0 ) // Firmware Backpack (020-0147-00) + ROM_LOAD( "156-0747-xx.u101", 0x0000, 0x0800, CRC(9e1facc1) SHA1(7e7a118c3e8c49630f630ee02c3de843dd95d7e1) ) // -00 or -01 ? + ROM_LOAD( "156-0748-xx.u201", 0x0800, 0x0800, CRC(be42bfbf) SHA1(23575b411bd9dcb7d7116628820096e3064ff93b) ) // -00 or -01 ? + + ROM_REGION( 0x2000, "021_0188_00", 0 ) // Communications Backpack (021-0188-00) + ROM_LOAD( "156-0712-00.u101", 0x0000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0712-01.u101", 0x0000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0713-00.u111", 0x0800, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0713-01.u111", 0x0800, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0714-00.u121", 0x1000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0714-01.u121", 0x1000, 0x0800, NO_DUMP ) + ROM_LOAD( "156-0715-01.u131", 0x1800, 0x0800, NO_DUMP ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1975, tek4051, 0, 0, tek4051, tek4051, driver_device, 0, "Tektronix", "Tektronix 4051", MACHINE_NOT_WORKING ) +COMP( 1978, tek4052a, tek4051, 0, tek4052, tek4051, driver_device, 0, "Tektronix", "Tektronix 4052A", MACHINE_NOT_WORKING ) +//COMP( 1979, tek4054, tek4051, 0, tek4054, tek4054, driver_device, 0, "Tektronix", "Tektronix 4054", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/tek410x.c b/src/mame/drivers/tek410x.c new file mode 100644 index 00000000000..df28dd8d8e7 --- /dev/null +++ b/src/mame/drivers/tek410x.c @@ -0,0 +1,148 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Tektronix 4107A/4109A + + Skeleton driver. + +****************************************************************************/ + +/* + + TODO: + + - everything + +*/ + + +#include "emu.h" +#include "cpu/i86/i186.h" + +#define I80188_TAG "i80188" +#define SCREEN_TAG "screen" + +class tek4107a_state : public driver_device +{ +public: + tek4107a_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) { } + + virtual void machine_start(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +}; + +/* Memory Maps */ + +static ADDRESS_MAP_START( tek4107a_mem, AS_PROGRAM, 8, tek4107a_state ) + AM_RANGE(0x00000, 0xbffff) AM_RAM + AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION(I80188_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tek4107a_io, AS_IO, 8, tek4107a_state ) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( tek4107a ) +INPUT_PORTS_END + +/* Video */ + +void tek4107a_state::video_start() +{ +} + +UINT32 tek4107a_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static const gfx_layout tek4107a_charlayout = +{ + 8, 15, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP8(0,1) }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8 }, + 16*8 +}; + +static GFXDECODE_START( tek4107a ) + GFXDECODE_ENTRY( "chargen", 0x0000, tek4107a_charlayout, 0, 1 ) +GFXDECODE_END + +/* Machine Initialization */ + +void tek4107a_state::machine_start() +{ +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( tek4107a, tek4107a_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(I80188_TAG, I80188, 21000000) + MCFG_CPU_PROGRAM_MAP(tek4107a_mem) + MCFG_CPU_IO_MAP(tek4107a_io) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(tek4107a_state, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + + MCFG_PALETTE_ADD("palette", 64) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", tek4107a) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tek4109a, tek4107a ) + /* video hardware */ + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(4096) +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( tek4107a ) + ROM_REGION( 0x40000, I80188_TAG, 0 ) + ROM_LOAD16_BYTE( "160-2379-03.u60", 0x00000, 0x8000, NO_DUMP ) + ROM_LOAD16_BYTE( "160-2380-03.u160", 0x00001, 0x8000, NO_DUMP ) + ROM_LOAD16_BYTE( "160-2377-03.u70", 0x10000, 0x8000, NO_DUMP ) + ROM_LOAD16_BYTE( "160-2378-03.u170", 0x10001, 0x8000, CRC(feac272f) SHA1(f2018dc9bb5bd6840b2843c709cbc24689054dc0) ) + ROM_LOAD16_BYTE( "160-2375-03.u80", 0x20000, 0x8000, NO_DUMP ) + ROM_LOAD16_BYTE( "160-2376-03.u180", 0x20001, 0x8000, CRC(35a44e75) SHA1(278c7f218105ad3473409b16a8d27a0b9f7a859e) ) + ROM_LOAD16_BYTE( "160-2373-03.u90", 0x30000, 0x8000, CRC(d5e89b15) SHA1(d6eb1a0a684348a8194238d641528fb96fb29087) ) + ROM_LOAD16_BYTE( "160-2374-03.u190", 0x30001, 0x8000, CRC(a3fef76e) SHA1(902845c4aa0cbc392b62c726ac746ca62567d91c) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "160-2381 v1.0.u855", 0x0000, 0x1000, CRC(ac7ca279) SHA1(4c9de06d1c346f83eb8d0d09a0eb32c40bd8014c) ) +ROM_END + +ROM_START( tek4109a ) + // another set with 160-32xx-03 v10.5 labels exists: http://picasaweb.google.com/glen.slick/Tektronix4107A#5300179291078507810 + ROM_REGION( 0x40000, I80188_TAG, 0 ) + ROM_LOAD16_BYTE( "160-3283-02 v8.2.u60", 0x00000, 0x8000, CRC(2a821db6) SHA1(b4d8b74bd9fe43885dcdc4efbdd1eebb96e32060) ) + ROM_LOAD16_BYTE( "160-3284-02 v8.2.u160", 0x00001, 0x8000, CRC(ee567b01) SHA1(67b1b0648cfaa28d57473bcc45358ff2bf986acf) ) + ROM_LOAD16_BYTE( "160-3281-02 v8.2.u70", 0x10000, 0x8000, CRC(e2713328) SHA1(b0bb3471539ef24d79b18d0e33bc148ed27d0ec4) ) + ROM_LOAD16_BYTE( "160-3282-02 v8.2.u170", 0x10001, 0x8000, CRC(c109a4f7) SHA1(762019105c1f82200a9c99ccfcfd8ee81d2ac4fe) ) + ROM_LOAD16_BYTE( "160-3279-02 v8.2.u80", 0x20000, 0x8000, CRC(00822078) SHA1(a82e61dafccbaea44e67efaa5940e52ec6d07d7d) ) + ROM_LOAD16_BYTE( "160-3280-02 v8.2.u180", 0x20001, 0x8000, CRC(eec9f70f) SHA1(7b65336219f5fa0d11f8be2b37040b564a53c52f) ) + ROM_LOAD16_BYTE( "160-3277-02 v8.2.u90", 0x30000, 0x8000, CRC(cf6ebc97) SHA1(298db473874c57bf4eec788818179748030a9ad8) ) + ROM_LOAD16_BYTE( "160-3278-02 v8.2.u190", 0x30001, 0x8000, CRC(d6124cd1) SHA1(f826aee5ec07cf5ac369697d93def0259ad225bb) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "160-3087 v1.0.u855", 0x0000, 0x1000, CRC(97479528) SHA1(e9e15f1f64b3b6bd139accd51950bae71fdc2193) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, tek4107a, 0, 0, tek4107a, tek4107a, driver_device, 0, "Tektronix", "Tektronix 4107A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1983, tek4109a, tek4107a, 0, tek4109a, tek4107a, driver_device, 0, "Tektronix", "Tektronix 4109A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/terak.c b/src/mame/drivers/terak.c new file mode 100644 index 00000000000..7ffa92684b6 --- /dev/null +++ b/src/mame/drivers/terak.c @@ -0,0 +1,120 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Terak 8510A + + 23/02/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/t11/t11.h" + +class terak_state : public driver_device +{ +public: + terak_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_READ16_MEMBER(terak_fdc_status_r); + DECLARE_WRITE16_MEMBER(terak_fdc_command_w); + DECLARE_READ16_MEMBER(terak_fdc_data_r); + DECLARE_WRITE16_MEMBER(terak_fdc_data_w); + UINT8 m_unit; + UINT8 m_cmd; + UINT16 m_data; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_terak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + +READ16_MEMBER( terak_state::terak_fdc_status_r ) +{ + logerror("terak_fdc_status_r\n"); + if (m_cmd==3) { + logerror("cmd is 3\n"); + return 0xffff; + } + return 0; +} + +WRITE16_MEMBER( terak_state::terak_fdc_command_w ) +{ + m_unit = (data >> 8) & 0x03; + m_cmd = (data >> 1) & 0x07; + logerror("terak_fdc_command_w %04x [%d %d]\n",data,m_unit,m_cmd); +} + +READ16_MEMBER( terak_state::terak_fdc_data_r ) +{ + logerror("terak_fdc_data_r\n"); + return 0; +} + +WRITE16_MEMBER( terak_state::terak_fdc_data_w ) +{ + logerror("terak_fdc_data_w %04x\n",data); +} + +static ADDRESS_MAP_START(terak_mem, AS_PROGRAM, 16, terak_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xf5ff ) AM_RAM // RAM + + // octal + AM_RANGE( 0173000, 0173177 ) AM_ROM // ROM + AM_RANGE( 0177000, 0177001 ) AM_READWRITE(terak_fdc_status_r,terak_fdc_command_w) + AM_RANGE( 0177002, 0177003 ) AM_READWRITE(terak_fdc_data_r,terak_fdc_data_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( terak ) +INPUT_PORTS_END + + +void terak_state::machine_reset() +{ +} + +void terak_state::video_start() +{ +} + +UINT32 terak_state::screen_update_terak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +static MACHINE_CONFIG_START( terak, terak_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) + MCFG_T11_INITIAL_MODE(6 << 13) + MCFG_CPU_PROGRAM_MAP(terak_mem) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(terak_state, screen_update_terak) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( terak ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "terak.rom", 0173000, 0x0080, CRC(fd654b8e) SHA1(273a9933b68a290c5aedcd6d69faa7b1d22c0344)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( ????, terak, 0, 0, terak, terak, driver_device, 0, "Terak", "Terak 8510A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/test_t400.c b/src/mame/drivers/test_t400.c new file mode 100644 index 00000000000..b577d3c77a4 --- /dev/null +++ b/src/mame/drivers/test_t400.c @@ -0,0 +1,53 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + T400 uController test suite for COP410/420 series CPUs + + http://opencores.org/project,t400 + +*/ + +#include "emu.h" +#include "cpu/cop400/cop400.h" + +class t400_test_suite_state : public driver_device +{ +public: + t400_test_suite_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_WRITE8_MEMBER( port_l_w ); + required_device m_maincpu; +}; + +WRITE8_MEMBER( t400_test_suite_state::port_l_w ) +{ +// printf("L: %u\n", data); +} + +static MACHINE_CONFIG_START( test_t410, t400_test_suite_state ) + MCFG_CPU_ADD("maincpu", COP410, 1000000) + MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) + MCFG_COP400_WRITE_L_CB(WRITE8(t400_test_suite_state, port_l_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( test_t420, t400_test_suite_state ) + MCFG_CPU_ADD("maincpu", COP420, 1000000) + MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) + MCFG_COP400_WRITE_L_CB(WRITE8(t400_test_suite_state, port_l_w)) +MACHINE_CONFIG_END + +ROM_START( test410 ) + ROM_REGION( 0x200, "maincpu", 0 ) + ROM_LOAD( "rom_41x.bin", 0x000, 0x200, NO_DUMP ) +ROM_END + +ROM_START( test420 ) + ROM_REGION( 0x400, "maincpu", 0 ) + ROM_LOAD( "rom_42x.bin", 0x000, 0x400, BAD_DUMP CRC(e4e80001) SHA1(8fdca9d08de1cc83387a7d141f6b254117902442) ) +ROM_END + +COMP( 2008, test410, 0, 0, test_t410, 0, driver_device, 0, "T400 uController project", "T410 test suite", MACHINE_NO_SOUND_HW ) +COMP( 2008, test420, test410, 0, test_t420, 0, driver_device, 0, "T400 uController project", "T420 test suite", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/thomson.c b/src/mame/drivers/thomson.c new file mode 100644 index 00000000000..33112623a19 --- /dev/null +++ b/src/mame/drivers/thomson.c @@ -0,0 +1,2451 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Thomson 8-bit micro-computers. + + A 6809E-based French family of personal computers developed in the 80's. + Despite their rather high price and poor design , they were quite popular + in France, probably due to the government plan "Informatique pour tous" + (Computer Science for Everyone) to put a network of MO5 computers in every + school during 1984-1986. And maybe their very popular light-pen. + + Drivers + - t9000 Thomson T9000 (early TO7 prototype, oct 1980) + - to7 Thomson TO7 (nov 1982) + - to770 Thomson TO7/70 (scarcely enhanced TO7, 1984) + - mo5 Thomson MO5 (entry-game, TO7-incompatible, jun 1984) + - to9 Thomson TO9 (high-end TO7/70 successor, sep 1985) + - mo5e Thomson MO5E (export MO5 version, 1986) + - to8 Thomson TO8 (next generation of TO7/70, sep 1986) + - to9p Thomson TO9+ (improved TO9 with TO8 technology, sep 1986) + - mo6 Thomson MO6 (improved MO5 with TO8 technology, sep 1986) + - mo5nr Thomson MO5NR (network-enhanced MO6, 1986) + - to8d Thomson TO8D (TO8 with integrated floppy, dec 1987) + - pro128 Olivetti Prodest PC 128 (Italian MO6, built by Thomson, 1986) + + We do not consider here the few 16-bit computers built by Thomson + (68000-based Micromega 32, 8088-based Micromega 16 or the TO16: Thomson's own + 8088-based PC). + + You may distinguish three families: + * TO7,TO7/70,TO8,TO8D (family computers) + * TO9,TO9+ (professional desktop look with separate keyboard and monitor) + * MO5,MO5E,MO5NR,MO6 (cheaper, less extensible family) + Computers in both TO families are compatible. Computers in the MO family are + compatible. However, the TO and MO families are incompatible + (different memory-mapping). + + Note that the TO8, TO9+ and MO6 were produced at the same time, using very + similar technologies, but with different cost/feature trade-offs and + different compatibility (MO6 is MO5-compatible, TO9+ is TO9-compatible and + TO8 and TO9+ are TO7-compatible). + Also note that the MO5NR is actually based on MO6 design, not MO5 + (although both MO5NR and MO6 are MO5-compatible) + + Also of interest are the Platini and Hinault versions of the MO5 + (plain MO5 inside, but with custom, signed box-case). + There were several versions of TO7/70 and MO5 with alternate keyboards. + + Thomson stopped producing micro-computers in jan 1990. + +**********************************************************************/ + +/* TODO (roughly in decreasing priority order): + ---- + + - internal, keyboard-attached TO9 mouse port (untested) + - floppy: 2-sided or 4-sided .fd images + - printer post-processing => postscript + - RS232 serial port extensions: CC 90-232, RF 57-932 + - modem, teltel extension: MD 90-120 / MD 90-333 (need controller ROM?) + - IEEE extension + - TV overlay (IN 57-001) (@) + - digitisation extension (DI 90-011) (@) + - barcode reader (@) + + (@) means MESS is lacking support for this kind of device / feature anyway + +*/ + +#include "includes/thomson.h" +#include "bus/rs232/rs232.h" +#include "machine/6821pia.h" +#include "machine/wd_fdc.h" +#include "machine/clock.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/flopdrv.h" +#include "formats/cd90_640_dsk.h" +#include "formats/basicdsk.h" +#include "machine/ram.h" + + +/**************************** common *******************************/ + +/* layout */ +static const char layout_thomson[] = "thomson"; + +#define KEY(pos,name,key) \ + PORT_BIT ( 1<<(pos), IP_ACTIVE_LOW, IPT_KEYBOARD ) \ + PORT_NAME ( name ) \ + PORT_CODE ( KEYCODE_##key ) + +#define PAD(mask,player,name,port,dir,key) \ + PORT_BIT ( mask, IP_ACTIVE_LOW, IPT_##port ) \ + PORT_NAME ( "P" #player " " name ) \ + PORT_CODE( KEYCODE_##key ) \ + PORT_PLAYER ( player ) + + +/* ------------- game port ------------- */ + +/* + Two generations of game port extensions were developped + + - CM 90-112 (model 1) + connect up to two 8-position 1-button game pads + + - SX 90-018 (model 2) + connect either two 8-position 2-button game pads + or a 2-button mouse (not both at the same time!) + + We emulate the SX 90-018 as it is fully compatible with the CM 90-112. + + Notes: + * all extensions are compatible with all Thomson computers. + * the SX 90-018 extension is integrated within the TO8(D) + * the TO9 has its own, different mouse port + * all extensions are based on a Motorola 6821 PIA + * all extensions include a 6-bit sound DAC + * most pre-TO8 software (including TO9) do not recognise the mouse nor the + second button of each pad + * the mouse cannot be used at the same time as the pads: they use the same + 6821 input ports & physical port; we use a config switch to tell MESS + whether pads or a mouse is connected + * the mouse should not be used at the same time as the sound DAC: they use + the same 6821 ports, either as input or output; starting from the TO8, + there is a 'mute' signal to cut the DAC output and avoid producing an + audible buzz whenever the mouse is moved; unfortunately, mute is not + available on the TO7(/70), TO9 and MO5. +*/ + +static INPUT_PORTS_START( thom_game_port ) + +/* joysticks, common to CM 90-112 & SX 90-018 */ + PORT_START ( "game_port_directions" ) + PAD ( 0x01, 1, UTF8_UP, JOYSTICK_UP, UP, UP) + PAD ( 0x02, 1, UTF8_DOWN, JOYSTICK_DOWN, DOWN, DOWN ) + PAD ( 0x04, 1, UTF8_LEFT, JOYSTICK_LEFT, LEFT, LEFT ) + PAD ( 0x08, 1, UTF8_RIGHT, JOYSTICK_RIGHT, RIGHT, RIGHT ) + PAD ( 0x10, 2, UTF8_UP, JOYSTICK_UP, UP, 8_PAD ) + PAD ( 0x20, 2, UTF8_DOWN, JOYSTICK_DOWN, DOWN, 2_PAD ) + PAD ( 0x40, 2, UTF8_LEFT, JOYSTICK_LEFT, LEFT, 4_PAD ) + PAD ( 0x80, 2, UTF8_RIGHT, JOYSTICK_RIGHT, RIGHT, 6_PAD ) + + PORT_START ( "game_port_buttons" ) + PAD ( 0x40, 1, "Action A", BUTTON1, BUTTON1, LCONTROL ) + PAD ( 0x80, 2, "Action A", BUTTON1, BUTTON1, RCONTROL ) + +/* joysticks, SX 90-018 specific */ + PAD ( 0x04, 1, "Action B", BUTTON2, BUTTON2, LALT ) + PAD ( 0x08, 2, "Action B", BUTTON2, BUTTON2, RALT ) + PORT_BIT ( 0x30, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT ( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) /* ? */ + +/* mouse, SX 90-018 specific */ + PORT_START ( "mouse_x" ) + PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_X ) + PORT_NAME ( "Mouse X" ) + PORT_SENSITIVITY ( 150 ) + PORT_PLAYER (1) + + PORT_START ( "mouse_y" ) + PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_Y ) + PORT_NAME ( "Mouse Y" ) + PORT_SENSITIVITY ( 150 ) + PORT_PLAYER (1) + + PORT_START ( "mouse_button" ) + PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_NAME ( "Left Mouse Button" ) + PORT_CODE( MOUSECODE_BUTTON1 ) + PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_NAME ( "Right Mouse Button" ) + +INPUT_PORTS_END + + +/* ------------ lightpen ------------ */ + +static INPUT_PORTS_START( thom_lightpen ) + + PORT_START ( "lightpen_x" ) + PORT_BIT ( 0xffff, THOM_TOTAL_WIDTH/2, IPT_LIGHTGUN_X ) + PORT_NAME ( "Lightpen X" ) + PORT_MINMAX( 0, THOM_TOTAL_WIDTH ) + PORT_SENSITIVITY( 50 ) + PORT_CROSSHAIR(X, 1.0, 0.0, 0) + + PORT_START ( "lightpen_y" ) + PORT_BIT ( 0xffff, THOM_TOTAL_HEIGHT/2, IPT_LIGHTGUN_Y ) + PORT_NAME ( "Lightpen Y" ) + PORT_MINMAX ( 0, THOM_TOTAL_HEIGHT ) + PORT_SENSITIVITY( 50 ) + PORT_CROSSHAIR(Y, 1.0, 0.0, 0) + + PORT_START ( "lightpen_button" ) + PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_NAME ( "Lightpen Button" ) + PORT_CODE( MOUSECODE_BUTTON1 ) + +INPUT_PORTS_END + +/************************** T9000 / TO7 ******************************* + +TO7 (1982) +--- + +First computer by Thomson. +Note that the computer comes with only a minimal BIOS and requires an +external cartridge to be usable. +Most software are distributed on cassette and require the BASIC 1.0 cartridge +to be present (-cart basic.m7), as only it provides the necessary OS +capabilities (e.g., a cassette loader). +To use disks, you will need both a BASIC 1.0 cartridge and a BASIC DOS +boot floppy. + +* chips: + - 1 MHz Motorola 6809E CPU + - 1 Motorola 6821 PIA (+3 for I/O, game, and modem extensions) + - 1 Motorola 6846 timer, I/O, ROM + +* memory: + - 8 KB base user RAM + + 16 KB extended user RAM (EM 90-016) = 24 KB total user RAM emulated + + homebrew 8 KB RAM extension (Theophile magazine 6, sept 1984) + - 6 KB BIOS ROM + - 6-bit x 8 K color RAM + 8-bit x 8 K point RAM, bank switched + - 2 to 8 KB ROM comes with the floppy drive / network controller + +* video: + 320x200 pixels with color constraints (2 colors per horizontal + 8-pixel span), 8-color pixel palette, + 50 Hz (tweaked SECAM) + +* devices: + - AZERTY keyboard, 58-keys, French with accents + - cartridge 16 KB (up to 64 KB using bank-switching), + the MESS cartridge device is named -cart + - cassette 900 bauds (frequency signals: 0=4.5 kHz, 1=6.3 kHz) + the MESS cassette device is named -cass + - 1-bit internal buzzer + - lightpen, with 8-pixel horizontal resolution, 1-pixel vertical + - SX 90-018 game & music extension + . 6-bit DAC sound + . two 8-position 2-button game pads + . 2-button mouse + . based on a Motorola 6821 PIA + - CC 90-232 I/O extension: + . CENTRONICS (printer) + . RS232 (unemulated) + . based on a Motorola 6821 PIA + . NOTE: you cannot use the CENTRONICS and RS232 at the same time + - RF 57-932: RS232 extension, based on a SY 6551 ACIA (unemulated) + - MD 90-120: MODEM, TELETEL extension (unemulated) + . 1 Motorola 6850 ACIA + . 1 Motorola 6821 PIA + . 1 EFB 7513 MODEM FSK V13, full duplex + . PTT-, VELI7Y-, and V23-compatible MODEM (up to 1200 bauds) + . seems to come with an extra ROM + - 5"1/2 floppy drive extension + . CD 90-640 floppy controller, based on a Western Digital 2793 + . DD 90-320 double-density double-sided 5"1/4 floppy + (2 drives considered as 4 simple-face drives: 0/1 for the first drive, + 2/3 for the second drive, 1 and 3 for upper sides, 0 and 2 for lower + sides) + . floppies are 40 tracks/side, 16 sectors/track, 128 or 256 bytes/sector + = from 80 KB one-sided single-density, to 320 KB two-sided double-density + . MESS floppy devices are named -flop0 to -flop3 + - alternate 5"1/2 floppy drive extension + . CD 90-015 floppy controller, based on a HD 46503 S + . UD 90-070 5"1/4 single-sided single density floppy drive + - alternate 3"1/2 floppy drive extension + . CD 90-351 floppy controller, based on a custom Thomson gate-array + . DD 90-352 3"1/2 floppy drives + - alternate QDD floppy drive extension + . CQ 90-028 floppy controller, based on a Motorola 6852 SSDA + . QD 90-028 quickdrive 2"8 (QDD), only one drive, signe side + - speech synthesis extension: based on a Philips / Signetics MEA 8000 + (cannot be used with the MODEM) + - MIDIPAK MIDI extension, uses a EF 6850 ACIA + - NR 07-005: network extension, MC 6854 based, 2 KB ROM & 64 KB RAM + (build by the French Leanord company) + + +T9000 (1980) +----- + +Early TO7 prototype. +The hardware seems to be the exactly same. Only the BIOS is different. +It has some bug that were corrected later for the TO7. +Actually, the two computers are undistinguishable, except for the different +startup screen, and a couple BIOS addresses. +They can run the same software and accept the same devices and extensions. + + +**********************************************************************/ + +/* ------------ address maps ------------ */ + +static ADDRESS_MAP_START ( to7, AS_PROGRAM, 8, thomson_state ) + + AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK ) AM_WRITE(to7_cartridge_w ) /* 4 * 16 KB */ + AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK ) AM_WRITE(to7_vram_w ) + AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 1 * 8 KB */ + AM_RANGE ( 0x8000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 16 or 24 KB (for extension) */ + AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) + AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) + AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE(to7_floppy_r, to7_floppy_w ) + AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_DEVREADWRITE( "to7_io:pia_2", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) + AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) + AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) + AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ + +/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ +/* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ + +/* RAM mapping: + 0x0000 - 0x3fff: 16 KB video RAM (actually 8 K x 8 bits + 8 K x 6 bits) + 0x4000 - 0x5fff: 8 KB base RAM + 0x6000 - 0x9fff: 16 KB extended RAM + 0xa000 - 0xbfff: 8 KB more extended RAM + */ +ADDRESS_MAP_END + + + +/* ------------ ROMS ------------ */ + +/* external floppy controllers */ +#define ROM_FLOPPY( base ) \ + /* no controller */ \ + ROM_FILL( base, 0x800, 0x39 ) \ + /* CD 90-015 (5"1/4) */ \ + ROM_LOAD ( "cd90-015.rom", base+0x800, 0x7c0, \ + CRC(821d34c1) \ + SHA1(31a6bb81baaeec5fc8de457c97264f9dfa92c18b) ) \ + /* CD 90-640 (5"1/4) */ \ + ROM_LOAD ( "cd90-640.rom", base+0x1000, 0x7c0, \ + CRC(5114c0a5) \ + SHA1(5c72566c22d8160ef0c75959e1863a1309bbbe49) ) \ + /* CD 90-351 (3"1/2) */ \ + ROM_LOAD ( "cd-351-0.rom", base+0x1800, 0x7c0, \ + CRC(2c0159fd) \ + SHA1(bab5395ed8bc7c06f9897897f836054e6546e8e8) ) \ + ROM_LOAD ( "cd-351-1.rom", base+0x2000, 0x7c0, \ + CRC(8e58d159) \ + SHA1(dcf992c96e7556b2faee6bacd3f744e56998e6ea) ) \ + ROM_LOAD ( "cd-351-2.rom", base+0x2800, 0x7c0, \ + CRC(c9228b60) \ + SHA1(179e10107d5be91e684069dee80f94847b83201f) ) \ + ROM_LOAD ( "cd-351-3.rom", base+0x3000, 0x7c0, \ + CRC(3ca8e5dc) \ + SHA1(7118636fb5c597c78c2fce17b02aed5e4ba38635) ) \ + /* CQ 90-028 (2"8, aka QDD) */ \ + ROM_LOAD ( "cq90-028.rom", base+0x3800, 0x7c0, \ + CRC(ca4dba3d) \ + SHA1(949c1f777c892da62c242215d79757d61e71e62b) ) + +/* external floppy / network controller: 9 banks */ +#define ROM_FLOPPY5( base ) \ + ROM_FLOPPY( base ) \ + ROM_LOAD ( "nano5.rom", base+0x4000, 0x7c0, \ + CRC(2f756868) \ + SHA1(b5b7cb6d12493d849330b6b5628efd1a83a4bbf5) ) + +#define ROM_FLOPPY7( base ) \ + ROM_FLOPPY( base ) \ + ROM_LOAD ( "nano7.rom", base+0x4000, 0x7c0, \ + CRC(42a1d1a6) \ + SHA1(973209f4baa5e81bf7885c0602949e064bac7862) ) + + +ROM_START ( to7 ) + ROM_REGION ( 0x24800, "maincpu", 0 ) + ROM_LOAD ( "to7.rom", 0xe800, 0x1800, + CRC(0e7826da) + SHA1(23a2f84b03c01d385cc1923c8ece95c43756297a) ) + ROM_FILL ( 0x10000, 0x10000, 0x39 ) + ROM_FLOPPY7 ( 0x20000 ) +ROM_END + +ROM_START ( t9000 ) + ROM_REGION ( 0x24800, "maincpu", 0 ) + ROM_LOAD ( "t9000.rom", 0xe800, 0x1800, + CRC(daa8cfbf) + SHA1(a5735db1ad4e529804fc46603f838d3f4ccaf5cf) ) + ROM_FILL ( 0x10000, 0x10000, 0x39 ) + ROM_FLOPPY7 ( 0x20000 ) +ROM_END + + +/* ------------ inputs ------------ */ + +static INPUT_PORTS_START ( to7_config ) + PORT_START ( "config" ) + + PORT_CONFNAME ( 0x01, 0x00, "Game Port" ) + PORT_CONFSETTING ( 0x00, DEF_STR( Joystick ) ) + PORT_CONFSETTING ( 0x01, "Mouse" ) + +INPUT_PORTS_END + +static INPUT_PORTS_START ( to7_vconfig ) + PORT_START ( "vconfig" ) + + PORT_CONFNAME ( 0x03, 0x00, "Border" ) + PORT_CONFSETTING ( 0x00, "Normal (56x47)" ) + PORT_CONFSETTING ( 0x01, "Small (16x16)" ) + PORT_CONFSETTING ( 0x02, DEF_STR ( None ) ) + + PORT_CONFNAME ( 0x0c, 0x08, "Resolution" ) + PORT_CONFSETTING ( 0x00, DEF_STR ( Low ) ) + PORT_CONFSETTING ( 0x04, DEF_STR ( High ) ) + PORT_CONFSETTING ( 0x08, "Auto" ) + +INPUT_PORTS_END + +static INPUT_PORTS_START ( to7_mconfig ) + PORT_START ( "mconfig" ) + + PORT_CONFNAME ( 0x01, 0x01, "E7FE-F port" ) + PORT_CONFSETTING ( 0x00, "Modem (unemulated)" ) + PORT_CONFSETTING ( 0x01, "Speech" ) + +INPUT_PORTS_END + +static INPUT_PORTS_START ( to7_fconfig ) + PORT_START ( "fconfig" ) + + PORT_CONFNAME ( 0x07, 0x03, "Floppy (reset)" ) + PORT_CONFSETTING ( 0x00, DEF_STR ( None ) ) + PORT_CONFSETTING ( 0x01, "CD 90-015 (5\"1/4 SD)" ) + PORT_CONFSETTING ( 0x02, "CD 90-640 (5\"1/4 DD)" ) + PORT_CONFSETTING ( 0x03, "CD 90-351 (3\"1/2)" ) + PORT_CONFSETTING ( 0x04, "CQ 90-028 (2\"8 QDD)" ) + PORT_CONFSETTING ( 0x05, "Network" ) + + PORT_CONFNAME ( 0xf8, 0x08, "Network ID" ) + PORT_CONFSETTING ( 0x00, "0 (Master)" ) + PORT_CONFSETTING ( 0x08, "1" ) + PORT_CONFSETTING ( 0x10, "2" ) + PORT_CONFSETTING ( 0x18, "3" ) + PORT_CONFSETTING ( 0x20, "4" ) + PORT_CONFSETTING ( 0x28, "5" ) + PORT_CONFSETTING ( 0x30, "6" ) + PORT_CONFSETTING ( 0x38, "7" ) + PORT_CONFSETTING ( 0x40, "8" ) + PORT_CONFSETTING ( 0x48, "9" ) + PORT_CONFSETTING ( 0x50, "10" ) + PORT_CONFSETTING ( 0x58, "11" ) + PORT_CONFSETTING ( 0x60, "12" ) + PORT_CONFSETTING ( 0x68, "13" ) + PORT_CONFSETTING ( 0x70, "14" ) + PORT_CONFSETTING ( 0x78, "15" ) + PORT_CONFSETTING ( 0x80, "16" ) + PORT_CONFSETTING ( 0x88, "17" ) + PORT_CONFSETTING ( 0x90, "18" ) + PORT_CONFSETTING ( 0x98, "19" ) + PORT_CONFSETTING ( 0xa0, "20" ) + PORT_CONFSETTING ( 0xa8, "21" ) + PORT_CONFSETTING ( 0xb0, "22" ) + PORT_CONFSETTING ( 0xb8, "23" ) + PORT_CONFSETTING ( 0xc0, "24" ) + PORT_CONFSETTING ( 0xc8, "25" ) + PORT_CONFSETTING ( 0xd0, "26" ) + PORT_CONFSETTING ( 0xd8, "27" ) + PORT_CONFSETTING ( 0xe0, "28" ) + PORT_CONFSETTING ( 0xe8, "29" ) + PORT_CONFSETTING ( 0xf0, "30" ) + PORT_CONFSETTING ( 0xf8, "31" ) + +INPUT_PORTS_END + + +static INPUT_PORTS_START ( to7_keyboard ) + PORT_START ( "keyboard.0" ) + KEY ( 0, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT ( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START ( "keyboard.1" ) + KEY ( 0, "W", W ) PORT_CHAR('W') + KEY ( 1, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) + KEY ( 2, "C \303\247", C ) PORT_CHAR('C') + KEY ( 3, "Clear", ESC ) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + KEY ( 4, "Enter", ENTER ) PORT_CHAR(13) + KEY ( 5, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) + KEY ( 7, "Stop", TAB ) PORT_CHAR(27) + PORT_START ( "keyboard.2" ) + KEY ( 0, "X", X ) PORT_CHAR('X') + KEY ( 1, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + KEY ( 2, "V", V ) PORT_CHAR('V') + KEY ( 3, "Q", Q ) PORT_CHAR('Q') + KEY ( 4, "* :", QUOTE ) PORT_CHAR('*') PORT_CHAR(':') + KEY ( 5, "A", A ) PORT_CHAR('A') + KEY ( 6, "+ ;", EQUALS ) PORT_CHAR('+') PORT_CHAR(';') + KEY ( 7, "1 !", 1 ) PORT_CHAR('1') PORT_CHAR('!') + PORT_START ( "keyboard.3" ) + KEY ( 0, "Space Caps-Lock", SPACE ) PORT_CHAR(' ') PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + KEY ( 1, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + KEY ( 2, "B", B ) PORT_CHAR('B') + KEY ( 3, "S", S ) PORT_CHAR('S') + KEY ( 4, "/ ?", SLASH ) PORT_CHAR('/') PORT_CHAR('?') + KEY ( 5, "Z \305\223", Z) PORT_CHAR('Z') + KEY ( 6, "- =", MINUS ) PORT_CHAR('-') PORT_CHAR('=') + KEY ( 7, "2 \" \302\250", 2 ) PORT_CHAR('2') PORT_CHAR('"') + PORT_START ( "keyboard.4" ) + KEY ( 0, "@ \342\206\221", TILDE ) PORT_CHAR('@') + KEY ( 1, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + KEY ( 2, "M", M ) PORT_CHAR('M') + KEY ( 3, "D", D ) PORT_CHAR('D') + KEY ( 4, "P", P ) PORT_CHAR('P') + KEY ( 5, "E", E ) PORT_CHAR('E') + KEY ( 6, "0 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) + KEY ( 7, "3 #", 3 ) PORT_CHAR('3') PORT_CHAR('#') + PORT_START ( "keyboard.5" ) + KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') + KEY ( 1, "Home", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + KEY ( 2, "L", L ) PORT_CHAR('L') + KEY ( 3, "F", F ) PORT_CHAR('F') + KEY ( 4, "O", O ) PORT_CHAR('O') + KEY ( 5, "R", R ) PORT_CHAR('R') + KEY ( 6, "9 )", 9 ) PORT_CHAR('9') PORT_CHAR(')') + KEY ( 7, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') + PORT_START ( "keyboard.6" ) + KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') + KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + KEY ( 2, "K", K ) PORT_CHAR('K') + KEY ( 3, "G", G ) PORT_CHAR('G') + KEY ( 4, "I", I ) PORT_CHAR('I') + KEY ( 5, "T", T ) PORT_CHAR('T') + KEY ( 6, "8 (", 8 ) PORT_CHAR('8') PORT_CHAR('(') + KEY ( 7, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') + PORT_START ( "keyboard.7" ) + KEY ( 0, "N", N ) PORT_CHAR('N') + KEY ( 1, "Delete", DEL ) PORT_CHAR(8) + KEY ( 2, "J \305\222", J ) PORT_CHAR('J') + KEY ( 3, "H \302\250", H ) PORT_CHAR('H') + KEY ( 4, "U", U ) PORT_CHAR('U') + KEY ( 5, "Y", Y ) PORT_CHAR('Y') + KEY ( 6, "7 ' \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') + KEY ( 7, "6 &", 6 ) PORT_CHAR('6') PORT_CHAR('&') + + /* unused */ + PORT_START ( "keyboard.8" ) + PORT_START ( "keyboard.9" ) + +INPUT_PORTS_END + +static INPUT_PORTS_START ( to7 ) + PORT_INCLUDE ( thom_lightpen ) + PORT_INCLUDE ( thom_game_port ) + PORT_INCLUDE ( to7_keyboard ) + PORT_INCLUDE ( to7_config ) + PORT_INCLUDE ( to7_fconfig ) + PORT_INCLUDE ( to7_vconfig ) + PORT_INCLUDE ( to7_mconfig ) +INPUT_PORTS_END + +static INPUT_PORTS_START ( t9000 ) + PORT_INCLUDE ( to7 ) +INPUT_PORTS_END + +WRITE_LINE_MEMBER( thomson_state::fdc_index_0_w ) +{ + thomson_index_callback(machine().device(FLOPPY_0), state); +} + +WRITE_LINE_MEMBER( thomson_state::fdc_index_1_w ) +{ + thomson_index_callback(machine().device(FLOPPY_1), state); +} + +WRITE_LINE_MEMBER( thomson_state::fdc_index_2_w ) +{ + thomson_index_callback(machine().device(FLOPPY_2), state); +} + +WRITE_LINE_MEMBER( thomson_state::fdc_index_3_w ) +{ + thomson_index_callback(machine().device(FLOPPY_3), state); +} + +static const floppy_interface thomson_floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(thomson), + NULL +}; + +FLOPPY_FORMATS_MEMBER( thomson_state::cd90_640_formats ) + FLOPPY_CD90_640_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( cd90_640_floppies ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) + SLOT_INTERFACE("sd", FLOPPY_525_SD) + SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END + + +/* ------------ driver ------------ */ + +static MACHINE_CONFIG_START( to7, thomson_state ) + + MCFG_MACHINE_START_OVERRIDE( thomson_state, to7 ) + MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to7 ) + +/* cpu */ + MCFG_CPU_ADD ( "maincpu", M6809, 1000000 ) + MCFG_CPU_PROGRAM_MAP ( to7) + +/* video */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE ( /*50*/ 1./0.019968 ) + MCFG_SCREEN_SIZE ( THOM_TOTAL_WIDTH * 2, THOM_TOTAL_HEIGHT ) + MCFG_SCREEN_VISIBLE_AREA ( 0, THOM_TOTAL_WIDTH * 2 - 1, + 0, THOM_TOTAL_HEIGHT - 1 ) + MCFG_SCREEN_UPDATE_DRIVER( thomson_state, screen_update_thom ) + MCFG_SCREEN_VBLANK_DRIVER( thomson_state, thom_vblank ) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD ( "palette", 4097 ) /* 12-bit color + transparency */ + MCFG_PALETTE_INIT_OWNER(thomson_state, thom) + MCFG_VIDEO_START_OVERRIDE( thomson_state, thom ) + MCFG_DEFAULT_LAYOUT( layout_thomson ) + +/* sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD ( "buzzer", DAC, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* 1-bit buzzer */ + MCFG_SOUND_ADD ( "dac", DAC, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* 6-bit game extention DAC */ + MCFG_SOUND_ADD ( "speech", DAC, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* speech synthesis */ + +/* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(to7_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + +/* timer */ + MCFG_DEVICE_ADD("mc6846", MC6846, 0) + MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to7_timer_port_out)) + MCFG_MC6846_OUT_CP2_CB(WRITE8(thomson_state, to7_timer_cp2_out)) + MCFG_MC6846_IN_PORT_CB(READ8(thomson_state, to7_timer_port_in)) + MCFG_MC6846_OUT_CTO_CB(WRITE8(thomson_state, to7_timer_tco_out)) + MCFG_MC6846_IRQ_CB(WRITELINE(thomson_state, thom_dev_irq_0)) + +/* speech synthesis */ + MCFG_DEVICE_ADD("mea8000", MEA8000, 0) + MCFG_MEA8000_DAC("speech") + +/* floppy */ + MCFG_DEVICE_ADD("mc6843", MC6843, 0) + + MCFG_WD2793_ADD("wd2793", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("wd2793:0", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) + MCFG_FLOPPY_DRIVE_ADD("wd2793:1", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) + + MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0) + MCFG_DEVICE_CONFIG(thomson_floppy_interface) + MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_0_w)) + MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0) + MCFG_DEVICE_CONFIG(thomson_floppy_interface) + MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_1_w)) + MCFG_DEVICE_ADD(FLOPPY_2, LEGACY_FLOPPY, 0) + MCFG_DEVICE_CONFIG(thomson_floppy_interface) + MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_2_w)) + MCFG_DEVICE_ADD(FLOPPY_3, LEGACY_FLOPPY, 0) + MCFG_DEVICE_CONFIG(thomson_floppy_interface) + MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_3_w)) + +/* network */ + MCFG_DEVICE_ADD( "mc6854", MC6854, 0 ) + MCFG_MC6854_OUT_FRAME_CB(thomson_state, to7_network_got_frame) + + +/* pia */ + MCFG_DEVICE_ADD(THOM_PIA_SYS, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to7_sys_porta_in)) + MCFG_PIA_READPB_HANDLER(READ8(thomson_state, to7_sys_portb_in)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to7_sys_portb_out)) + MCFG_PIA_CA2_HANDLER(WRITELINE(thomson_state, to7_set_cassette_motor)) + MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, to7_sys_cb2_out)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(thomson_state, thom_firq_1)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_firq_1)) + + MCFG_DEVICE_ADD(THOM_PIA_GAME, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to7_game_porta_in)) + MCFG_PIA_READPB_HANDLER(READ8(thomson_state, to7_game_portb_in)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to7_game_portb_out)) + MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, to7_game_cb2_out)) + MCFG_PIA_IRQA_HANDLER(WRITELINE(thomson_state, thom_irq_1)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) + +/* TODO: CONVERT THIS TO A SLOT DEVICE (RF 57-932) */ + MCFG_DEVICE_ADD("acia", MOS6551, 0) + MCFG_MOS6551_XTAL(XTAL_1_8432MHz) + MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + + /// 2400 7N2 + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dcd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", mos6551_device, write_cts)) + + +/* TODO: CONVERT THIS TO A SLOT DEVICE (CC 90-232) */ + MCFG_TO7_IO_LINE_ADD("to7_io") + + +/* TODO: CONVERT THIS TO A SLOT DEVICE (MD 90-120) */ + MCFG_DEVICE_ADD(THOM_PIA_MODEM, PIA6821, 0) + + MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(WRITELINE(thomson_state, to7_modem_tx_w)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(thomson_state, to7_modem_cb)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 1200) /* 1200 bauds, might be divided by 16 */ + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(thomson_state, write_acia_clock)) + + +/* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "to7_cart") + MCFG_GENERIC_EXTENSIONS("m7,rom") + MCFG_GENERIC_LOAD(thomson_state, to7_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list","to7_cart") + +/* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("40K") + MCFG_RAM_EXTRA_OPTIONS("24K,48K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( t9000, to7 ) +MACHINE_CONFIG_END + + +COMP ( 1982, to7, 0, 0, to7, to7, driver_device, 0, "Thomson", "TO7", 0 ) + +COMP ( 1980, t9000, to7, 0, t9000, t9000, driver_device, 0, "Thomson", "T9000", 0 ) + + +/***************************** TO7/70 ********************************* + +TO7/70 ( 1984) +------ + +Enhanced TO7. +The TO7/70 supports virtually all TO7 software and most TO7 devices and +extensions (floppy, game, communucation, etc.). +As the TO7, it is only usable with a cartridge, and most software require +the BASIC 1.0 cartridge to be present. +Though, you may also use the more advanced BASIC 128 (-cart basic128.m7): +it allows BASIC programs to access all the memory and the video capabilities, +includes its own DOS (no need for a boot disk), but may not be compatible +with all games. + +It has the following modifications: + +* chips: + - custom logics for video, lightpen, address map has been replaced with an + integrated Gate-Array (Motorola MC 1300 ALS) + +* memory: + - 48 KB user base RAM (16 KB unswitchable + 2 switchable banks of 16 KB) + + 64 KB user extended RAM (EM 97-064, as 4 extra 16 KB banks) + = 112 KB total user RAM emulated + - now 8-bit x 8 K color RAM (instead of 6-bit x 8 K) + +* video: + - 16-color fixed palette instead of 8-color (but same constraints) + - IN 57-001: TV overlay extension, not implemented + (black becomes transparent and shows the TV image) + +* devices: + - lightpen management has changed, it now has 1-pixel horizontal resolution + - keyboard management has changed (but the keys are the same) + + +TO7/70 arabic (198?) +------------- + +TO7/70 with an alternate ROM. +Together with a special (64 KB) BASIC 128 cartridge (-cart basic128a.m7), +it allows typing in arabic. +Use Ctrl+W to switch to arabic, and Ctrl+F to switch back to latin. +In latin mode, Ctrl+U / Ctrl+X to start / stop typing in-line arabic. +In arabic mode, Ctrl+E / Ctrl+X to start / stop typing in-line latin. + +**********************************************************************/ + +static ADDRESS_MAP_START ( to770, AS_PROGRAM, 8, thomson_state ) + + AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE(to7_cartridge_w ) /* 4 * 16 KB */ + AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) + AM_RANGE ( 0x6000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 16 KB */ + AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 6 * 16 KB */ + AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) + AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) + AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE(to7_floppy_r, to7_floppy_w ) + AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_DEVREADWRITE( "to7_io:pia_2", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE(to770_gatearray_r, to770_gatearray_w ) + AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) + AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) + AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) + AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ + +/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ +/* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ + +/* RAM mapping: + 0x00000 - 0x03fff: 16 KB video RAM + 0x04000 - 0x07fff: 16 KB unbanked base RAM + 0x08000 - 0x1ffff: 6 * 16 KB banked extended RAM + */ + +ADDRESS_MAP_END + + + +/* ------------ ROMS ------------ */ + +ROM_START ( to770 ) + ROM_REGION ( 0x24800, "maincpu", 0 ) + ROM_LOAD ( "to770.rom", 0xe800, 0x1800, /* BIOS */ + CRC(89518862) + SHA1(cd34474c0bcc758f6d71c90fbd40cef379d61374) ) + ROM_FLOPPY7 ( 0x20000 ) + ROM_FILL ( 0x10000, 0x10000, 0x39 ) +ROM_END + +ROM_START ( to770a ) + ROM_REGION ( 0x24800, "maincpu", 0 ) + ROM_LOAD ( "to770a.rom", 0xe800, 0x1800, + CRC(378ea808) + SHA1(f4575b537dfdb46ff2a0e7cbe8dfe4ba63161b8e) ) + ROM_FLOPPY7 ( 0x20000 ) + ROM_FILL ( 0x10000, 0x10000, 0x39 ) +ROM_END + + +/* ------------ inputs ------------ */ + +static INPUT_PORTS_START ( to770 ) + PORT_INCLUDE ( to7 ) + + PORT_MODIFY ( "keyboard.1" ) + KEY ( 2, "C \302\250 \303\247", C ) PORT_CHAR('C') + PORT_MODIFY ( "keyboard.4" ) + KEY ( 6, "0 \140 \303\240", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) + PORT_MODIFY ( "keyboard.5" ) + KEY ( 6, "9 ) \303\247", 9 ) PORT_CHAR('9') PORT_CHAR(')') + PORT_MODIFY ( "keyboard.6" ) + KEY ( 6, "8 ( \303\271", 8 ) PORT_CHAR('8') PORT_CHAR('(') + PORT_MODIFY ( "keyboard.7" ) + KEY ( 6, "7 ' \303\250 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') + KEY ( 7, "6 & \303\251", 6 ) PORT_CHAR('6') PORT_CHAR('&') + +INPUT_PORTS_END + +/* arabic version (QWERTY keyboard) */ +static INPUT_PORTS_START ( to770a ) + PORT_INCLUDE ( to770 ) + + PORT_MODIFY ( "keyboard.1" ) + KEY ( 0, "Z", Z ) PORT_CHAR('Z') + PORT_MODIFY ( "keyboard.2" ) + KEY ( 3, "A", A ) PORT_CHAR('A') + KEY ( 4, "/ ?", QUOTE ) PORT_CHAR('/') PORT_CHAR('?') + KEY ( 5, "Q", Q ) PORT_CHAR('Q') + PORT_MODIFY ( "keyboard.3" ) + KEY ( 4, "* :", SLASH ) PORT_CHAR('*') PORT_CHAR(':') + KEY ( 5, "W", W) PORT_CHAR('W') + PORT_MODIFY ( "keyboard.4" ) + KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') + KEY ( 2, "@ \342\206\221", TILDE ) PORT_CHAR('@') PORT_CHAR('^') + KEY ( 6, "0 \302\243 \302\260 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) + PORT_MODIFY ( "keyboard.5" ) + KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') + KEY ( 6, "9 ) \303\261", 9 ) PORT_CHAR('9') PORT_CHAR(')') + PORT_MODIFY ( "keyboard.6" ) + KEY ( 0, "M", M ) PORT_CHAR('M') + KEY ( 6, "8 ( \303\274", 8 ) PORT_CHAR('8') PORT_CHAR('(') + PORT_MODIFY ( "keyboard.7" ) + KEY ( 6, "7 ' \303\266 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') + KEY ( 7, "6 & \303\244", 6 ) PORT_CHAR('6') PORT_CHAR('&') + +INPUT_PORTS_END + + +/* ------------ driver ------------ */ + +static MACHINE_CONFIG_DERIVED( to770, to7 ) + MCFG_MACHINE_START_OVERRIDE( thomson_state, to770 ) + MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to770 ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP ( to770) + + MCFG_DEVICE_MODIFY(THOM_PIA_SYS) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to770_sys_porta_in)) + MCFG_PIA_READPB_HANDLER(NULL) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to770_sys_portb_out)) + MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, to770_sys_cb2_out)) + + MCFG_DEVICE_MODIFY("mc6846") + MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to770_timer_port_out)) + + MCFG_DEVICE_REMOVE("cartslot") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "to770_cart") + MCFG_GENERIC_EXTENSIONS("m7,rom") + MCFG_GENERIC_LOAD(thomson_state, to7_cartridge) + + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list","to770_cart") + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("64K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( to770a, to770 ) +MACHINE_CONFIG_END + +COMP ( 1984, to770, 0, 0, to770, to770, driver_device, 0, "Thomson", "TO7/70", 0 ) + +COMP ( 1984, to770a, to770, 0, to770a, to770a, driver_device, 0, "Thomson", "TO7/70 (Arabic)", 0 ) + + +/************************* MO5 / MO5E ********************************* + +MO5 (1984) +--- + +The MO5 is Thomson's attempt to provide a less costly micro-computer, using +the same technology as the TO7/70. +It has less memory and is less expandable. The MC6846 timer has disappeared. +The BIOS has been throughly rewritten and uses a more compact call scheme. +This, and the fact that the address map has changed, makes the MO5 completely +TO7 software incompatible (except for pure BASIC programs). +Moreover, the MO5 has incompatible cassette and cartridge formats. +Unlike the TO7, the BASIC 1.0 is integrated and the MO5 can be used "as-is". + +* chips: + - 1 MHz Motorola 6809E CPU + - 1 Motorola 6821 PIA (+3 for I/O, game, and modem extensions) + - Motorola 1300 ALS Gate-Array + +* memory: + - 32 KB base user RAM + - 64 KB extended user RAM (4 x 16 KB banks) with the network extension + (no available to BASIC programs) + - 16 KB combined BASIC and BIOS ROM + - 8 KB color RAM + 8 KB point RAM, bank switched + - 2 to 8 KB floppy ROM comes with the floppy drive / network extension + +* video: + - as the TO7/70 but with different color encoding, + 320x200 pixels with color constraints, 16-color fixed palette + - IN 57-001: TV overlay extension (not implemented) + +* devices: + - AZERTY keyboard, 58-keys, slightlty different from the TO7 + . the right SHIFT key has been replaced with a BASIC key + . no caps-lock led + - the famous lightpen is optional + - cassette 1200 bauds (frequency signals: 0=4.5kHz, 1=6.3kHz), + TO7-incompatible + - optional cartridge, up to 64 KB, incompatible with TO7, + masks the integrated BASIC ROM + - game & music, I/O, floppy, network extensions: identical to TO7 + - speech synthesis extension: identical to TO7 + - MIDIPAK MIDI extension: identical to TO7 + +MO5E (1986) +---- + +This is a special MO5 version for the export market (mainly Germany). +Although coming in a different (nicer) case, it is internally similar to +the MO5 and is fully compatible. +Differences include: + - much better keyboard; some are QWERTY instead of AZERTY (we emulate QWERTY) + - a different BIOS and integrated BASIC + - the game extension is integrated + + +**********************************************************************/ + +static ADDRESS_MAP_START ( mo5, AS_PROGRAM, 8, thomson_state ) + + AM_RANGE ( 0x0000, 0x1fff ) AM_READ_BANK ( THOM_VRAM_BANK ) AM_WRITE(to770_vram_w ) + AM_RANGE ( 0x2000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) + AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) + AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE(mo5_ext_w ) + AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xa7d0, 0xa7df ) AM_READWRITE(to7_floppy_r, to7_floppy_w ) + AM_RANGE ( 0xa7e0, 0xa7e3 ) AM_DEVREADWRITE( "to7_io:pia_2", pia6821_device, read_alt, write_alt ) + AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE(mo5_gatearray_r, mo5_gatearray_w ) + AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) + AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) + AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE("mea8000", mea8000_device, read, write) + AM_RANGE ( 0xb000, 0xefff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE(mo5_cartridge_w ) + AM_RANGE ( 0xf000, 0xffff ) AM_ROM /* system bios */ + +/* 0x10000 - 0x1ffff: 16 KB integrated BASIC / 64 KB external cartridge */ +/* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ + +/* RAM mapping: + 0x00000 - 0x03fff: 16 KB video RAM + 0x04000 - 0x0bfff: 32 KB unbanked base RAM + 0x0c000 - 0x1bfff: 4 * 16 KB bank extended RAM + */ + +ADDRESS_MAP_END + + + +/* ------------ ROMS ------------ */ + +ROM_START ( mo5 ) + ROM_REGION ( 0x24800, "maincpu", 0 ) + ROM_LOAD ( "mo5.rom", 0xf000, 0x1000, + CRC(f0ea9140) + SHA1(36ce2d3df1866ec2fe368c1c28757e2f5401cf44) ) + ROM_LOAD ( "basic5.rom", 0x11000, 0x3000, + CRC(c2c11b9d) + SHA1(512dd40fb45bc2b51a24c84b3723a32bc8e80c06) ) + ROM_FLOPPY5 ( 0x20000 ) +ROM_END + +ROM_START ( mo5e ) + ROM_REGION ( 0x24800, "maincpu", 0 ) + ROM_LOAD ( "mo5e.rom", 0xf000, 0x1000, + CRC(6520213a) + SHA1(f17a7a59baf2819ec80991b34b204795536a5e01) ) + ROM_LOAD ( "basic5e.rom", 0x11000, 0x3000, + CRC(934a72b2) + SHA1(b37e2b1afbfba368c19be87b3bf61dfe6ad8b0bb) ) + ROM_FLOPPY5 ( 0x20000 ) +ROM_END + + +/* ------------ inputs ------------ */ + +static INPUT_PORTS_START ( mo5 ) + PORT_INCLUDE ( to770 ) + + PORT_MODIFY ( "keyboard.0" ) + KEY ( 1, "BASIC", RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT ( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) + +INPUT_PORTS_END + +/* QWERTY version */ +static INPUT_PORTS_START ( mo5e ) + PORT_INCLUDE ( mo5 ) + + PORT_MODIFY ( "keyboard.1" ) + KEY ( 0, "Z", Z ) PORT_CHAR('Z') + PORT_MODIFY ( "keyboard.2" ) + KEY ( 3, "A", A ) PORT_CHAR('A') + KEY ( 5, "Q", Q ) PORT_CHAR('Q') + PORT_MODIFY ( "keyboard.3" ) + KEY ( 5, "W", W) PORT_CHAR('W') + PORT_MODIFY ( "keyboard.4" ) + KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') + KEY ( 2, "@ \342\206\221", TILDE ) PORT_CHAR('@') PORT_CHAR('^') + KEY ( 6, "0 \302\243 \302\260 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) + PORT_MODIFY ( "keyboard.5" ) + KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') + KEY ( 6, "9 ) \303\261", 9 ) PORT_CHAR('9') PORT_CHAR(')') + PORT_MODIFY ( "keyboard.6" ) + KEY ( 0, "M", M ) PORT_CHAR('M') + KEY ( 6, "8 ( \303\274", 8 ) PORT_CHAR('8') PORT_CHAR('(') + PORT_MODIFY ( "keyboard.7" ) + KEY ( 6, "7 ' \303\266 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') + KEY ( 7, "6 & \303\244", 6 ) PORT_CHAR('6') PORT_CHAR('&') + +INPUT_PORTS_END + +/* ------------ driver ------------ */ + +static MACHINE_CONFIG_DERIVED( mo5, to7 ) + MCFG_MACHINE_START_OVERRIDE( thomson_state, mo5 ) + MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo5 ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP ( mo5) + + MCFG_CASSETTE_MODIFY( "cassette" ) + MCFG_CASSETTE_FORMATS(mo5_cassette_formats) + + MCFG_DEVICE_REMOVE( "mc6846" ) + + MCFG_PALETTE_MODIFY( "palette" ) + MCFG_PALETTE_INIT_OWNER(thomson_state, mo5) + + MCFG_DEVICE_MODIFY(THOM_PIA_SYS) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, mo5_sys_porta_in)) + MCFG_PIA_READPB_HANDLER(READ8(thomson_state, mo5_sys_portb_in)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo5_sys_porta_out)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, mo5_sys_portb_out)) + MCFG_PIA_CA2_HANDLER(WRITELINE(thomson_state, mo5_set_cassette_motor)) + MCFG_PIA_CB2_HANDLER(NULL) + MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) /* WARNING: differs from TO7 ! */ + + MCFG_DEVICE_REMOVE("cartslot") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart") + MCFG_GENERIC_EXTENSIONS("m5,rom") + MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge) + + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list","mo5_cart") + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("112K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mo5e, mo5 ) +MACHINE_CONFIG_END + + +COMP ( 1984, mo5, 0, 0, mo5, mo5, driver_device, 0, "Thomson", "MO5", 0 ) + +COMP ( 1986, mo5e, mo5, 0, mo5e, mo5e, driver_device, 0, "Thomson", "MO5E", 0 ) + + +/********************************* TO9 ******************************* + +TO9 (1985) +--- + +The TO9 is the successor of the TO7/70. +It is a high-end product: it integrates 96 KB of base RAM, 128 KB of +software in ROM, a floppy drive. It has improved graphics capabilities +(several video modes, a palette of 4096 colors, thanks to the use of +a dedicated video gate-array). +The ROM contains the old BASIC 1.0 for compatibility and the newer BASIC 128. +It has a more professional, desktop look, with a separate keyboard, and an +optional mouse. +It is also quite compatible with the TO7 and TO7/70 (but not the MO5). +However, it also has many problems. The integrated BASIC 128 can only access +128 KB of memory, which forces the 64 KB extension to be managed as a virtual +disk. The early versions of the software ROM has many bugs. The integrated +floppy drive is one-sided. +It was replaced quickly with the improved TO9+. + +* chips: + - 1 MHz Motorola 6809E CPU + - 1 Motorola 6821 PIA (+2 for game, modem extensions) + - 1 Motorola 6846 timer, PIA + - 1 Motorola 6805 + 1 Motorola 6850 (keyboard & mouse control) + - 1 Western Digital 2793 (disk controller) + - 3 gate-arrays (address decoding, system, video) + +* memory: + - 112 KB base RAM + - 64 KB extension RAM (as virtual disk) + - 6 KB BIOS ROM + 2 KB floppy BIOS + - 128 KB software ROM (BASIC 1, BASIC 128, extended BIOS, + DOS and configuration GUI, two software: "Paragraphe" and + "Fiches et dossiers") + - 16 KB video RAM + +* video: + - 8 video modes: + o 320x200, 16 colors with constraints (TO7/70 compatible) + o 320x200, 4 colors without constraints + o 160x200, 16 colors without constraints + o 640x200, 2 colors + o 320x200, 2 colors, two pages + . page one + . page two + . pages overlaid + o 160x200, 2 colors, four pages overlaid + - palette: 16 colors can be chosen among 4096 + +* devices: + - AZERTY keyboard, 81-keys, French with accents, keypad & function keys + - cartridge, up to 64 KB, TO7 compatible + - two-button mouse connected to the keyboard (not working yet) + - lightpen, with 1-pixel vertical and horizontal resolution + - 1-bit internal buzzer + - cassette 900 bauds, TO7 compatible + - integrated parallel CENTRONICS (printer emulated) + - SX 90-018: game extension (identical to the TO7) + - RF 57-932: RS232 extension (identical to the TO7) + - MD 90-120: MODEM extension (identical to the TO7) + - IEEE extension ? (unemulated) + - floppy: + . integrated floppy controller, based on WD2793 + . integrated one-sided double-density 3''1/2 + . external two-sided double-density 3''1/2, 5''1/4 or QDD (extension) + . floppies are TO7 and MO5 compatible + - speech synthesis extension: identical to TO7 + - MIDIPAK MIDI extension: identical to TO7 + +**********************************************************************/ + +static ADDRESS_MAP_START ( to9, AS_PROGRAM, 8, thomson_state ) + + AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK ) AM_WRITE(to9_cartridge_w )/* 4 * 16 KB */ + AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK ) AM_WRITE(to770_vram_w ) + AM_RANGE ( 0x6000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 16 KB */ + AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 10 * 16 KB */ + AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) + AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) + AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE(to9_floppy_r, to9_floppy_w ) + AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE(to9_vreg_r, to9_vreg_w ) + AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE(to9_kbd_r, to9_kbd_w ) + AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE(to9_gatearray_r, to9_gatearray_w ) + AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) +/* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w ) */ + AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) + AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) + AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ + +/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ +/* 0x20000 - 0x3ffff: 128 KB internal software ROM */ +/* 0x40000 - 0x447ff: 18 KB external floppy / network ROM controllers */ + +/* RAM mapping: + 0x00000 - 0x03fff: 16 KB video RAM + 0x04000 - 0x07fff: 16 KB unbanked base RAM + 0x08000 - 0x2ffff: 10 * 16 KB banked extended RAM + */ + +ADDRESS_MAP_END + + + +/* ------------ ROMS ------------ */ + +/* NOT WORKING + these bios seem heavily patched (probably to work with specific emulators + that trap some bios calls) + */ + +ROM_START ( to9 ) + ROM_REGION ( 0x44800, "maincpu", 0 ) + ROM_LOAD ( "to9.rom", 0xe000, 0x2000, /* BIOS & floppy controller */ + CRC(f9278bf7) + SHA1(9e99e6ae0285950f007b19161de642a4031fe46e) ) + + /* BASIC & software */ + ROM_LOAD ( "basic9-0.rom", 0x20000, 0x4000, + CRC(c7bac620) + SHA1(4b2a8b30cf437858ce978ba7b0dfa2bbd57eb38a) ) + ROM_LOAD ( "basic9-1.rom", 0x24000, 0x4000, + CRC(ea5f3e43) + SHA1(5e58a29c2d117fcdb1f5e7ca31dbfffa0f9218f2) ) + ROM_LOAD ( "basic9-2.rom", 0x28000, 0x4000, + CRC(0f5581b3) + SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) + ROM_LOAD ( "basic9-3.rom", 0x2c000, 0x4000, + CRC(6b5b19e3) + SHA1(0e832670c185694d9abbcebcc3ad90e94eed585d) ) + ROM_LOAD ( "soft9-0a.rom", 0x30000, 0x4000, + CRC(8cee157e) + SHA1(f32fc39b95890c00571e9f3fbcc2d8e0596fc4a1) ) + ROM_LOAD ( "soft9-1a.rom", 0x34000, 0x4000, + CRC(cf39ac93) + SHA1(b97e6b7389398e5706624973c11ee7ddba323ce1) ) + ROM_LOAD ( "soft9-0b.rom", 0x38000, 0x4000, + CRC(033aee3f) + SHA1(f3604e500329ec0489b05dbab05530322e9463c5) ) + ROM_LOAD ( "soft9-1b.rom", 0x3c000, 0x4000, + CRC(214fe527) + SHA1(0d8e3f1ca347026e906c3d00a0371e8238c44a60) ) + + ROM_FLOPPY7( 0x40000 ) + + ROM_FILL( 0x10000, 0x10000, 0x39 ) +ROM_END + + +/* ------------ inputs ------------ */ + +static INPUT_PORTS_START ( to9_keyboard ) + PORT_START ( "keyboard.0" ) + KEY ( 0, "F2 F7", F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + KEY ( 1, "_ 6", 6 ) PORT_CHAR('_') PORT_CHAR('6') + KEY ( 2, "Y", Y ) PORT_CHAR('Y') + KEY ( 3, "H \302\250", H ) PORT_CHAR('H') + KEY ( 4, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) + KEY ( 5, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + KEY ( 6, "Home Clear", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + KEY ( 7, "N", N ) PORT_CHAR('N') + PORT_START ( "keyboard.1" ) + KEY ( 0, "F3 F8", F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + KEY ( 1, "( 5", 5 ) PORT_CHAR('(') PORT_CHAR('5') + KEY ( 2, "T", T ) PORT_CHAR('T') + KEY ( 3, "G", G ) PORT_CHAR('G') + KEY ( 4, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') + KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + KEY ( 6, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + KEY ( 7, "B \302\264", B ) PORT_CHAR('B') + PORT_START ( "keyboard.2" ) + KEY ( 0, "F4 F9", F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) + KEY ( 1, "' 4", 4 ) PORT_CHAR('\'') PORT_CHAR('4') + KEY ( 2, "R", R ) PORT_CHAR('R') + KEY ( 3, "F", F ) PORT_CHAR('F') + KEY ( 4, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) + KEY ( 5, "Keypad 1", 1_PAD ) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + KEY ( 6, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + KEY ( 7, "V", V ) PORT_CHAR('V') + PORT_START ( "keyboard.3" ) + KEY ( 0, "F5 F10", F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) + KEY ( 1, "\" 3", 3 ) PORT_CHAR('"') PORT_CHAR('3') + KEY ( 2, "E", E ) PORT_CHAR('E') + KEY ( 3, "D", D ) PORT_CHAR('D') + KEY ( 4, "Keypad 7", 7_PAD ) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + KEY ( 5, "Keypad 4", 4_PAD ) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + KEY ( 6, "Keypad 0", 0_PAD ) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + KEY ( 7, "C \136", C ) PORT_CHAR('C') + PORT_START ( "keyboard.4" ) + KEY ( 0, "F1 F6", F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + KEY ( 1, "\303\251 2", 2 ) PORT_CHAR( 0xe9 ) PORT_CHAR('2') + KEY ( 2, "Z", Z ) PORT_CHAR('Z') + KEY ( 3, "S", S ) PORT_CHAR('S') + KEY ( 4, "Keypad 8", 8_PAD ) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + KEY ( 5, "Keypad 2", 2_PAD ) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + KEY ( 6, "Keypad .", DEL_PAD ) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + KEY ( 7, "X", X ) PORT_CHAR('X') + PORT_START ( "keyboard.5" ) + KEY ( 0, "# @", TILDE ) PORT_CHAR('#') PORT_CHAR('@') + KEY ( 1, "* 1", 1 ) PORT_CHAR('*') PORT_CHAR('1') + KEY ( 2, "A \140", A ) PORT_CHAR('A') + KEY ( 3, "Q", Q ) PORT_CHAR('Q') + KEY ( 4, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') + KEY ( 5, "Keypad 5", 5_PAD ) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + KEY ( 6, "Keypad 6", 6_PAD ) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + KEY ( 7, "W", W ) PORT_CHAR('W') + PORT_START ( "keyboard.6" ) + KEY ( 0, "Stop", TAB ) PORT_CHAR(27) + KEY ( 1, "\303\250 7", 7 ) PORT_CHAR( 0xe8 ) PORT_CHAR('7') + KEY ( 2, "U", U ) PORT_CHAR('U') + KEY ( 3, "J", J ) PORT_CHAR('J') + KEY ( 4, "Space", SPACE ) PORT_CHAR(' ') + KEY ( 5, "Keypad 9", 9_PAD ) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + KEY ( 6, "Keypad Enter", ENTER_PAD ) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + KEY ( 7, ", ?", COMMA ) PORT_CHAR(',') PORT_CHAR('?') + PORT_START ( "keyboard.7" ) + KEY ( 0, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + KEY ( 1, "! 8", 8 ) PORT_CHAR('!') PORT_CHAR('8') + KEY ( 2, "I", I ) PORT_CHAR('I') + KEY ( 3, "K", K ) PORT_CHAR('K') + KEY ( 4, "$ &", CLOSEBRACE ) PORT_CHAR('$') PORT_CHAR('&') + KEY ( 5, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + KEY ( 6, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') + KEY ( 7, "; .", STOP ) PORT_CHAR(';') PORT_CHAR('.') + PORT_START ( "keyboard.8" ) + KEY ( 0, "Caps-Lock", CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + KEY ( 1, "\303\247 9", 9 ) PORT_CHAR( 0xe7 ) PORT_CHAR('9') + KEY ( 2, "O", O ) PORT_CHAR('O') + KEY ( 3, "L", L ) PORT_CHAR('L') + KEY ( 4, "- \\", BACKSPACE ) PORT_CHAR('-') PORT_CHAR('\\') + KEY ( 5, "\303\271 %", COLON ) PORT_CHAR( 0xf9 ) PORT_CHAR('%') + KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) + KEY ( 7, ": /", SLASH ) PORT_CHAR(':') PORT_CHAR('/') + PORT_START ( "keyboard.9" ) + KEY ( 0, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) + KEY ( 1, "\303\240 0", 0 ) PORT_CHAR( 0xe0 ) PORT_CHAR('0') + KEY ( 2, "P", P ) PORT_CHAR('P') + KEY ( 3, "M", M ) PORT_CHAR('M') + KEY ( 4, ") \302\260", MINUS ) PORT_CHAR(')') PORT_CHAR( 0xb0 ) + KEY ( 5, "\342\206\221 \302\250", OPENBRACE ) PORT_CHAR('^') PORT_CHAR( 0xa8 ) + KEY ( 6, "Keypad 3", 3_PAD ) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + KEY ( 7, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') +INPUT_PORTS_END + +static INPUT_PORTS_START ( to9_fconfig ) + PORT_START ( "fconfig" ) + + PORT_CONFNAME ( 0x07, 0x00, "External floppy (reset)" ) + PORT_CONFSETTING ( 0x00, "No external" ) + PORT_CONFSETTING ( 0x01, "CD 90-015 (5\"1/4 SD)" ) + PORT_CONFSETTING ( 0x02, "CD 90-640 (5\"1/4 DD)" ) + PORT_CONFSETTING ( 0x03, "CD 90-351 (3\"1/2)" ) + PORT_CONFSETTING ( 0x04, "CQ 90-028 (2\"8 QDD)" ) + PORT_CONFSETTING ( 0x05, "Network" ) + + PORT_CONFNAME ( 0xf8, 0x08, "Network ID" ) + PORT_CONFSETTING ( 0x00, "0 (Master)" ) + PORT_CONFSETTING ( 0x08, "1" ) + PORT_CONFSETTING ( 0x10, "2" ) + PORT_CONFSETTING ( 0x18, "3" ) + PORT_CONFSETTING ( 0x20, "4" ) + PORT_CONFSETTING ( 0x28, "5" ) + PORT_CONFSETTING ( 0x30, "6" ) + PORT_CONFSETTING ( 0x38, "7" ) + PORT_CONFSETTING ( 0x40, "8" ) + PORT_CONFSETTING ( 0x48, "9" ) + PORT_CONFSETTING ( 0x50, "10" ) + PORT_CONFSETTING ( 0x58, "11" ) + PORT_CONFSETTING ( 0x60, "12" ) + PORT_CONFSETTING ( 0x68, "13" ) + PORT_CONFSETTING ( 0x70, "14" ) + PORT_CONFSETTING ( 0x78, "15" ) + PORT_CONFSETTING ( 0x80, "16" ) + PORT_CONFSETTING ( 0x88, "17" ) + PORT_CONFSETTING ( 0x90, "18" ) + PORT_CONFSETTING ( 0x98, "19" ) + PORT_CONFSETTING ( 0xa0, "20" ) + PORT_CONFSETTING ( 0xa8, "21" ) + PORT_CONFSETTING ( 0xb0, "22" ) + PORT_CONFSETTING ( 0xb8, "23" ) + PORT_CONFSETTING ( 0xc0, "24" ) + PORT_CONFSETTING ( 0xc8, "25" ) + PORT_CONFSETTING ( 0xd0, "26" ) + PORT_CONFSETTING ( 0xd8, "27" ) + PORT_CONFSETTING ( 0xe0, "28" ) + PORT_CONFSETTING ( 0xe8, "29" ) + PORT_CONFSETTING ( 0xf0, "30" ) + PORT_CONFSETTING ( 0xf8, "31" ) + +INPUT_PORTS_END + +static INPUT_PORTS_START ( to9 ) + PORT_INCLUDE ( thom_lightpen ) + PORT_INCLUDE ( thom_game_port ) + PORT_INCLUDE ( to9_keyboard ) + PORT_INCLUDE ( to7_config ) + PORT_INCLUDE ( to9_fconfig ) + PORT_INCLUDE ( to7_vconfig ) + PORT_INCLUDE ( to7_mconfig ) +INPUT_PORTS_END + +/* ------------ driver ------------ */ + +static MACHINE_CONFIG_DERIVED( to9, to7 ) + MCFG_MACHINE_START_OVERRIDE( thomson_state, to9 ) + MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to9 ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP ( to9) + + MCFG_DEVICE_MODIFY(THOM_PIA_SYS) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to9_sys_porta_in)) + MCFG_PIA_READPB_HANDLER(NULL) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, to9_sys_porta_out)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to9_sys_portb_out)) + MCFG_PIA_CB2_HANDLER(NULL) + MCFG_PIA_IRQA_HANDLER(NULL) + + MCFG_DEVICE_MODIFY("mc6846") + MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to9_timer_port_out)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("192K") + MCFG_RAM_EXTRA_OPTIONS("128K") +MACHINE_CONFIG_END + + +COMP ( 1985, to9, 0, 0, to9, to9, driver_device, 0, "Thomson", "TO9", MACHINE_IMPERFECT_COLORS ) + + +/******************************** TO8 ******************************** + +TO8 (1986) +--- + +The TO8 was meant to replace the TO7/70 as a home-computer. +It includes and improves on the technology from the TO9 (improved video, +256 KB of RAM fully managed by the new BASIC 512, more integrated gate-array). +It has a more compact Amiga-like look, no separate keyboard, no integrated +floppy drive (although the controller is integrated), no software in ROM, +less extension slots. Also, the game & music extension is now integrated. +It is quite compatible with the TO7 and TO7/70, and with the TO9 to some +extent. +The TO8 was quite popular and became the de-facto gamming computer in the +Thomson family. + +* chips: + - 1 MHz Motorola 6809E CPU + - 2 Motorola 6821 PIAs (system, game, +1 in modem extension) + - 1 Motorola 6846 timer, PIA + - 1 Motorola 6804 (keyboard) + - 2 gate-arrays (system & video, floppy controller) + +* memory: + - 256 KB base RAM + + 256 KB extended RAM (EM 88-256) = 512 KB total RAM emulated + - 16 KB BIOS ROM + - 64 KB software ROM (BASIC 1, BASIC 512, extended BIOS) + - unified memory view via improved bank switching + +* video: + improved wrt TO9: a 9-th video mode, 4 video pages (shared with main RAM) + border color has its 4-th index bit inverted + +* devices: + - same keyboard as T09: AZERTY 81-keys + (but no 6850 controller, the 6804 is directly connected to the 6821 & 6846) + - cartridge, up to 64 KB, TO7 compatible + - two-button serial mouse (TO9-incompatible) + - lightpen, with 1-pixel vertical and horizontal resolution + - two 8-position 2-button game pads (SX 90-018 extension integrated) + - 6-bit DAC sound (NOTE: 1-bit buzzer is gone) + - cassette 900 bauds, TO7 compatible + - integrated parallel CENTRONICS (printer emulated) + - RF 57-932: RS232 extension (identical to the TO7) + - MD 90-120: MODEM extension (identical to the TO7?) + - IEEE extension ? + - floppy: + . integrated floppy controller, based on custom Thomson gate-array + . no integrated drive + . up to two external two-sided double-density 3"1/2, 5"1/4 or QDD drives + . floppies are TO7 and MO5 compatible + - speech synthesis extension: identical to TO7 + - MIDIPAK MIDI extension: identical to TO7 + +TO8D (1987) +---- + +The TO8D is simply a TO8 with an integrated 3"1/2 floppy drive. + +**********************************************************************/ + + +static ADDRESS_MAP_START ( to8, AS_PROGRAM, 8, thomson_state ) + + AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE(to8_cartridge_w ) /* 4 * 16 KB */ + AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) + AM_RANGE ( 0x6000, 0x7fff ) AM_READ_BANK ( TO8_SYS_LO) AM_WRITE(to8_sys_lo_w ) + AM_RANGE ( 0x8000, 0x9fff ) AM_READ_BANK ( TO8_SYS_HI) AM_WRITE(to8_sys_hi_w ) + AM_RANGE ( 0xa000, 0xbfff ) AM_READ_BANK ( TO8_DATA_LO) AM_WRITE(to8_data_lo_w ) + AM_RANGE ( 0xc000, 0xdfff ) AM_READ_BANK ( TO8_DATA_HI) AM_WRITE(to8_data_hi_w ) + AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) /* 2 * 2 KB */ + AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) + AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE(to8_floppy_r, to8_floppy_w ) + AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE(to8_vreg_r, to8_vreg_w ) + AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE(to8_gatearray_r, to8_gatearray_w ) + AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) +/* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w ) */ + AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) + AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) + AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) /* 2 * 6 KB */ + +/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ +/* 0x20000 - 0x2ffff: 64 KB internal software ROM */ +/* 0x30000 - 0x33fff: 16 KB BIOS ROM */ +/* 0x34000 - 0x387ff: 18 KB external floppy / network ROM controllers */ + +/* RAM mapping: 512 KB flat (including video) */ + +ADDRESS_MAP_END + + +/* ------------ ROMS ------------ */ + +ROM_START ( to8 ) + ROM_REGION ( 0x38800, "maincpu", 0 ) + + /* BIOS & floppy */ + ROM_LOAD ( "to8-0.rom", 0x30000, 0x2000, + CRC(3c4a640a) + SHA1(0a4952f0ca002d82ac83755e1f694d56399413b2) ) + ROM_LOAD ( "to8-1.rom", 0x32000, 0x2000, + CRC(cb9bae2d) + SHA1(a4a55a6e2c74bca15951158c5164970e922fc1c1) ) + + /* BASIC */ + ROM_LOAD ( "basic8-0.rom", 0x20000, 0x4000, + CRC(e5a00fb3) + SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) + ROM_LOAD ( "basic8-1.rom", 0x24000, 0x4000, + CRC(4b241e63) + SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) + ROM_LOAD ( "basic8-2.rom", 0x28000, 0x4000, + CRC(0f5581b3) + SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) + ROM_LOAD ( "basic8-3.rom", 0x2c000, 0x4000, + CRC(f552e7e3) + SHA1(3208e0d7d90241a327ed24e4921303f16e167bd5) ) + + ROM_FLOPPY7( 0x34000 ) + + ROM_FILL( 0x10000, 0x10000, 0x39 ) +ROM_END + +ROM_START ( to8d ) + ROM_REGION ( 0x38800, "maincpu", 0 ) + + /* BIOS & floppy */ + ROM_LOAD ( "to8d-0.rom", 0x30000, 0x2000, + CRC(30ea4950) + SHA1(6705100cd337fffb26ce999302b55fb71557b128) ) + ROM_LOAD ( "to8d-1.rom", 0x32000, 0x2000, + CRC(926cf0ca) + SHA1(8521613ac00e04dd94b69e771aeaefbf4fe97bf7) ) + + /* BASIC */ + ROM_LOAD ( "basic8-0.rom", 0x20000, 0x4000, + CRC(e5a00fb3) + SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) + ROM_LOAD ( "basic8-1.rom", 0x24000, 0x4000, + CRC(4b241e63) + SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) + ROM_LOAD ( "basic8-2.rom", 0x28000, 0x4000, + CRC(0f5581b3) + SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) + ROM_LOAD ( "basic8-3.rom", 0x2c000, 0x4000, + CRC(f552e7e3) + SHA1(3208e0d7d90241a327ed24e4921303f16e167bd5) ) + + ROM_FLOPPY7( 0x34000 ) + + ROM_FILL( 0x10000, 0x10000, 0x39 ) +ROM_END + + +/* ------------ inputs ------------ */ + +static INPUT_PORTS_START ( to8_config ) + PORT_START ( "config" ) + + PORT_CONFNAME ( 0x01, 0x00, "Game Port" ) + PORT_CONFSETTING ( 0x00, DEF_STR( Joystick ) ) + PORT_CONFSETTING ( 0x01, "Mouse" ) + + PORT_CONFNAME ( 0x02, 0x00, "Keyboard" ) + PORT_CONFSETTING ( 0x00, "Enabled" ) + PORT_CONFSETTING ( 0x02, "Disabled" ) + +INPUT_PORTS_END + + +static INPUT_PORTS_START ( to8 ) + PORT_INCLUDE ( thom_lightpen ) + PORT_INCLUDE ( thom_game_port ) + PORT_INCLUDE ( to9_keyboard ) + PORT_INCLUDE ( to8_config ) + PORT_INCLUDE ( to9_fconfig ) + PORT_INCLUDE ( to7_vconfig ) + PORT_INCLUDE ( to7_mconfig ) +INPUT_PORTS_END + + +static INPUT_PORTS_START ( to8d ) + PORT_INCLUDE ( to8 ) +INPUT_PORTS_END + +/* ------------ driver ------------ */ + +static MACHINE_CONFIG_DERIVED( to8, to7 ) + MCFG_MACHINE_START_OVERRIDE( thomson_state, to8 ) + MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to8 ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP ( to8) + + MCFG_DEVICE_MODIFY(THOM_PIA_SYS) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to8_sys_porta_in)) + MCFG_PIA_READPB_HANDLER(NULL) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, to9_sys_porta_out)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to8_sys_portb_out)) + MCFG_PIA_CB2_HANDLER(NULL) + MCFG_PIA_IRQA_HANDLER(NULL) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) + + MCFG_DEVICE_MODIFY("mc6846") + MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to8_timer_port_out)) + MCFG_MC6846_OUT_CP2_CB(WRITE8(thomson_state, to8_timer_cp2_out)) + MCFG_MC6846_IN_PORT_CB(READ8(thomson_state, to8_timer_port_in)) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") + MCFG_RAM_EXTRA_OPTIONS("256K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( to8d, to8 ) +MACHINE_CONFIG_END + + +COMP ( 1986, to8, 0, 0, to8, to8, driver_device, 0, "Thomson", "TO8", 0 ) + +COMP ( 1987, to8d, to8, 0, to8d, to8d, driver_device, 0, "Thomson", "TO8D", 0 ) + + +/******************************** TO9+ ******************************* + +TO9+ (1986) +---- + +The TO9+ is the direct successor of the T09 as Thomson's high-end +product: desktop look, 512 KB of RAM, integrated floppy drive and +modem. Some software integrated in ROM on the TO9 are now supplied on +floppies. +Internally, the TO9+ is based more on TO8 technology than T09 +(same gate-arrays). +It has enhanced communication capabilities by integrating either the +MODEM or the RS232 extension. +It should be compatible with the TO9 and, to some extent, with the TO7, TO7/70 +and TO8. +It uses the same video gate-array and floppy controller. + +The differences with the TO8 are: + +* chips: + - 1 Motorola 6805 + 1 Motorola 6850 (keyboard) + - 3 Motorola 6821 PIAs (system, game, modem) + +* memory: + - 512 KB RAM (not extendable) + +* devices: + - same keyboard as T08/TO9 (AZERTY 81-keys) but different controller + - RF 57-932: RS232 (identical to the TO7) sometimes integrated + - MD 90-120: MODEM (identical to the TO7?) sometimes integrated + - IEEE extension ? + - floppy: one two-sided double-density 3''1/2 floppy drive is integrated + - RS 52-932 RS232 extension ? + - digitisation extension + +**********************************************************************/ + +static ADDRESS_MAP_START ( to9p, AS_PROGRAM, 8, thomson_state ) + + AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE(to8_cartridge_w ) /* 4 * 16 KB */ + AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) + AM_RANGE ( 0x6000, 0x7fff ) AM_READ_BANK ( TO8_SYS_LO) AM_WRITE(to8_sys_lo_w ) + AM_RANGE ( 0x8000, 0x9fff ) AM_READ_BANK ( TO8_SYS_HI) AM_WRITE(to8_sys_hi_w ) + AM_RANGE ( 0xa000, 0xbfff ) AM_READ_BANK ( TO8_DATA_LO) AM_WRITE(to8_data_lo_w ) + AM_RANGE ( 0xc000, 0xdfff ) AM_READ_BANK ( TO8_DATA_HI) AM_WRITE(to8_data_hi_w ) + AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) /* 2 * 2 KB */ + AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) + AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE(to8_floppy_r, to8_floppy_w ) + AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE(to8_vreg_r, to8_vreg_w ) + AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE(to9_kbd_r, to9_kbd_w ) + AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE(to8_gatearray_r, to8_gatearray_w ) + AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) +/* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w ) */ + AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) + AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) + AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) /* 2 * 6 KB */ + +/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ +/* 0x20000 - 0x2ffff: 64 KB internal software ROM */ +/* 0x30000 - 0x33fff: 16 KB BIOS ROM */ +/* 0x34000 - 0x387ff: 18 KB external floppy / network ROM controllers */ + +/* RAM mapping: 512 KB flat (including video) */ + +ADDRESS_MAP_END + + +/* ------------ ROMS ------------ */ + +ROM_START ( to9p ) + ROM_REGION ( 0x38800, "maincpu", 0 ) + + /* BIOS & floppy */ + ROM_LOAD ( "to9p-0.rom", 0x30000, 0x2000, + CRC(a2731296) + SHA1(b30e06127d6e99d4ac5a5bb67881df27bbd9a7e5) ) + ROM_LOAD ( "to9p-1.rom", 0x32000, 0x2000, + CRC(c52ce315) + SHA1(7eacbd796e76bc72b872f9700c9b90414899ea0f) ) + + /* BASIC */ + ROM_LOAD ( "basicp-0.rom", 0x20000, 0x4000, + CRC(e5a00fb3) + SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) + ROM_LOAD ( "basicp-1.rom", 0x24000, 0x4000, + CRC(4b241e63) + SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) + ROM_LOAD ( "basicp-2.rom", 0x28000, 0x4000, + CRC(0f5581b3) + SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) + ROM_LOAD ( "basicp-3.rom", 0x2c000, 0x4000, + CRC(ebe9c8d9) + SHA1(b667ad09a1181f65059a2cbb4c95421bc544a334) ) + + ROM_FLOPPY7( 0x34000 ) + + ROM_FILL( 0x10000, 0x10000, 0x39 ) +ROM_END + + +/* ------------ inputs ------------ */ + +static INPUT_PORTS_START ( to9p ) + PORT_INCLUDE ( thom_lightpen ) + PORT_INCLUDE ( thom_game_port ) + PORT_INCLUDE ( to9_keyboard ) + PORT_INCLUDE ( to7_config ) + PORT_INCLUDE ( to9_fconfig ) + PORT_INCLUDE ( to7_vconfig ) + PORT_INCLUDE ( to7_mconfig ) +INPUT_PORTS_END + +/* ------------ driver ------------ */ + +static MACHINE_CONFIG_DERIVED( to9p, to7 ) + MCFG_MACHINE_START_OVERRIDE( thomson_state, to9p ) + MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to9p ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP ( to9p) + + MCFG_DEVICE_MODIFY(THOM_PIA_SYS) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to9_sys_porta_in)) + MCFG_PIA_READPB_HANDLER(NULL) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, to9_sys_porta_out)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to8_sys_portb_out)) + MCFG_PIA_CB2_HANDLER(NULL) + MCFG_PIA_IRQA_HANDLER(NULL) + MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_firq_1)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) + + MCFG_DEVICE_MODIFY("mc6846") + MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to9p_timer_port_out)) + MCFG_MC6846_OUT_CP2_CB(WRITE8(thomson_state, to8_timer_cp2_out)) + MCFG_MC6846_IN_PORT_CB(READ8(thomson_state, to9p_timer_port_in)) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("512K") +MACHINE_CONFIG_END + +COMP ( 1986, to9p, 0, 0, to9p, to9p, driver_device, 0, "Thomson", "TO9+", 0 ) + + + +/******************************** MO6 ******************************** + +MO6 (1986) +--- + +The MO6 is the (long awaited) successor to the MO5. +It is based on TO8 technology (same system & video gate-array). +However, it is lower-end and cheaper: less memory (128 KB RAM, not +extensible), no floppy controller but an integrated cassette recorder. +The MO6 is MO5 compatible, but not compatible with the TO family. + +* chips: + - 1 MHz Motorola 6809E CPU + - 2 Motorola 6821 PIAs (system, game) + - 1 gate-array (system & video, identical to the TO8) + +* memory: + - 128 KB RAM (not extendable) + - 8 KB BIOS ROM + - 24 KB BASIC 1 ROM + - 32 KB BASIC 128 & extended BIOS ROM + +* video: + all modes from the TO8, but the TO7/70-compatible mode is replaced with + an MO5-compatible one + +* devices: + - AZERTY keyboard, 69 keys, no keyboard controller (scanning is done + periodically by the 6809) + - MO5-compatible cartridge + - two-button mouse (TO8-like) + - optional lightpen + - integrated game port (similar to SX 90-018) + . 6-bit DAC sound + . two 8-position 2-button game pads + . two-button mouse + - integrated cassette reader 1200 bauds (MO5 compatible) and 2400 bauds + - parallel CENTRONICS (printer emulated) + - RF 57-932: RS232 extension (identical to the TO7), or RF 90-932 (???) + - IEEE extension ? + - no integrated controller, but external TO7 floppy controllers & drives + are possible + - speech synthesis extension: identical to TO7 ? + - MIDIPAK MIDI extension: identical to TO7 ? + + +Olivetti Prodest PC 128 (1986) +----------------------- + +Italian version of the MO6, built by Thomson and sold by Olivetti. +Except from the ROM, it is very similar to the MO6. +Do not confuse with the Olivetti Prodest PC 128 Systema (or 128s) which is +based on the Acorn BBC Master Compact. Or with the Olivetti PC 1, which is +a PC XT. + + +**********************************************************************/ + +static ADDRESS_MAP_START ( mo6, AS_PROGRAM, 8, thomson_state ) + + AM_RANGE ( 0x0000, 0x1fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) + AM_RANGE ( 0x2000, 0x3fff ) AM_READ_BANK ( TO8_SYS_LO) AM_WRITE(to8_sys_lo_w ) + AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( TO8_SYS_HI) AM_WRITE(to8_sys_hi_w ) + AM_RANGE ( 0x6000, 0x7fff ) AM_READ_BANK ( TO8_DATA_LO) AM_WRITE(to8_data_lo_w ) + AM_RANGE ( 0x8000, 0x9fff ) AM_READ_BANK ( TO8_DATA_HI) AM_WRITE(to8_data_hi_w ) + AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) + AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE(mo6_ext_w ) + AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE(to7_floppy_r, to7_floppy_w ) + AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE(mo6_vreg_r, mo6_vreg_w ) + AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE(mo6_gatearray_r, mo6_gatearray_w ) + AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) +/* AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w )*/ + AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) + AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE("mea8000", mea8000_device, read, write) + AM_RANGE ( 0xb000, 0xbfff ) AM_ROMBANK ( MO6_CART_LO ) + AM_WRITE ( mo6_cartridge_w ) + AM_RANGE ( 0xc000, 0xefff ) AM_ROMBANK ( MO6_CART_HI ) + AM_WRITE ( mo6_cartridge_w ) + AM_RANGE ( 0xf000, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) + +/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ +/* 0x20000 - 0x2ffff: 64 KB BIOS ROM */ +/* 0x30000 - 0x347ff: 16 KB floppy / network ROM controllers */ + +/* RAM mapping: 128 KB flat (including video) */ + +ADDRESS_MAP_END + + +/* ------------ ROMS ------------ */ + +ROM_START ( mo6 ) + ROM_REGION ( 0x34800, "maincpu", 0 ) + + /* BIOS */ + ROM_LOAD ( "mo6-0.rom", 0x23000, 0x1000, + CRC(0446eef6) + SHA1(b57fcda69c95f0c97c5cb0605d17c49a0c630300) ) + ROM_LOAD ( "mo6-1.rom", 0x27000, 0x1000, + CRC(eb6df8d4) + SHA1(24e2232f582ce04f260acd8e9ec710468a81505c) ) + + /* BASIC */ + ROM_LOAD ( "basic6-0.rom", 0x20000, 0x3000, + CRC(18789833) + SHA1(fccbf69cbc6deba45a767a26cd6454cf0eedfc2b) ) + ROM_LOAD ( "basic6-1.rom", 0x24000, 0x3000, + CRC(c9b4d6f4) + SHA1(47487d2bc4c9a9c09c733bd89c49693c52e262de) ) + ROM_LOAD ( "basic6-2.rom", 0x28000, 0x4000, + CRC(08eac9bb) + SHA1(c0231fdb3bcccbbb10c1f93cc529fc3b96dd3f4d) ) + ROM_LOAD ( "basic6-3.rom", 0x2c000, 0x4000, + CRC(19d66dc4) + SHA1(301b6366269181b74cb5d7ccdf5455b7290ae99b) ) + + ROM_FLOPPY5 ( 0x30000 ) + ROM_FILL ( 0x10000, 0x10000, 0x39 ) +ROM_END + +ROM_START ( pro128 ) + ROM_REGION ( 0x34800, "maincpu", 0 ) + + /* BIOS */ + ROM_LOAD ( "pro128-0.rom", 0x23000, 0x1000, + CRC(a8aef291) + SHA1(2685cca841f405a37ef48b0115f90c865ce79d0f) ) + ROM_LOAD ( "pro128-1.rom", 0x27000, 0x1000, + CRC(5b3340ec) + SHA1(269f2eb3e3452014b8d1f0f9e1c63fe56375a863) ) + + /* BASIC */ + ROM_LOAD ( "basico-0.rom", 0x20000, 0x3000, + CRC(98b10d5e) + SHA1(d6b77e694fa85e1114293448e5a64f6e2cf46c22) ) + ROM_LOAD ( "basico-1.rom", 0x24000, 0x3000, + CRC(721d2124) + SHA1(51db1cd03b3891e212a24aa6563b09968930d897) ) + ROM_LOAD ( "basico-2.rom", 0x28000, 0x4000, + CRC(135438ab) + SHA1(617d4e4979842bea2c21ef7f8c50f3b08b15239a) ) + ROM_LOAD ( "basico-3.rom", 0x2c000, 0x4000, + CRC(2c2befa6) + SHA1(3e94e182bacbb55bb07be2af4c76c0b0df47b3bf) ) + + ROM_FLOPPY5 ( 0x30000 ) + ROM_FILL ( 0x10000, 0x10000, 0x39 ) +ROM_END + + +/* ------------ inputs ------------ */ + +static INPUT_PORTS_START ( mo6_keyboard ) + + PORT_START ( "keyboard.0" ) + KEY ( 0, "N", N ) PORT_CHAR('N') + KEY ( 1, ", ?", COMMA ) PORT_CHAR(',') PORT_CHAR('?') + KEY ( 2, "; .", STOP ) PORT_CHAR(';') PORT_CHAR('.') + KEY ( 3, "# @", TILDE ) PORT_CHAR('#') PORT_CHAR('@') + KEY ( 4, "Space", SPACE ) PORT_CHAR(' ') + KEY ( 5, "X", X ) PORT_CHAR('X') + KEY ( 6, "W", W ) PORT_CHAR('W') + KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START ( "keyboard.1" ) + KEY ( 0, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + KEY ( 2, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') + KEY ( 3, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + KEY ( 4, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + KEY ( 6, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) + KEY ( 7, "BASIC", RCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_START ( "keyboard.2" ) + KEY ( 0, "J", J ) PORT_CHAR('J') + KEY ( 1, "K", K ) PORT_CHAR('K') + KEY ( 2, "L", L ) PORT_CHAR('L') + KEY ( 3, "M", M ) PORT_CHAR('M') + KEY ( 4, "B \302\264", B ) PORT_CHAR('B') + KEY ( 5, "V", V ) PORT_CHAR('V') + KEY ( 6, "C \136", C ) PORT_CHAR('C') + KEY ( 7, "Caps-Lock", CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_START ( "keyboard.3" ) + KEY ( 0, "H \302\250", H ) PORT_CHAR('H') + KEY ( 1, "G", G ) PORT_CHAR('G') + KEY ( 2, "F", F ) PORT_CHAR('F') + KEY ( 3, "D", D ) PORT_CHAR('D') + KEY ( 4, "S", S ) PORT_CHAR('S') + KEY ( 5, "Q", Q ) PORT_CHAR('Q') + KEY ( 6, "Home Clear", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + KEY ( 7, "F1 F6", F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_START ( "keyboard.4" ) + KEY ( 0, "U", U ) PORT_CHAR('U') + KEY ( 1, "I", I ) PORT_CHAR('I') + KEY ( 2, "O", O ) PORT_CHAR('O') + KEY ( 3, "P", P ) PORT_CHAR('P') + KEY ( 4, ": /", SLASH ) PORT_CHAR(':') PORT_CHAR('/') + KEY ( 5, "$ &", CLOSEBRACE ) PORT_CHAR('$') PORT_CHAR('&') + KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) + KEY ( 7, "F2 F7", F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_START ( "keyboard.5" ) + KEY ( 0, "Y", Y ) PORT_CHAR('Y') + KEY ( 1, "T", T ) PORT_CHAR('T') + KEY ( 2, "R", R ) PORT_CHAR('R') + KEY ( 3, "E", E ) PORT_CHAR('E') + KEY ( 4, "Z", Z ) PORT_CHAR('Z') + KEY ( 5, "A \140", A ) PORT_CHAR('A') + KEY ( 6, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + KEY ( 7, "F3 F8", F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_START ( "keyboard.6" ) + KEY ( 0, "7 \303\250", 7 ) PORT_CHAR('7') PORT_CHAR( 0xe8 ) + KEY ( 1, "8 !", 8 ) PORT_CHAR('8') PORT_CHAR('!') + KEY ( 2, "9 \303\247", 9 ) PORT_CHAR('9') PORT_CHAR( 0xe7 ) + KEY ( 3, "0 \303\240", 0 ) PORT_CHAR('0') PORT_CHAR( 0xe0 ) + KEY ( 4, "- \\", BACKSPACE ) PORT_CHAR('-') PORT_CHAR('\\') + KEY ( 5, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') + KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) + KEY ( 7, "F4 F9", F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_START ( "keyboard.7" ) + KEY ( 0, "6 _", 6 ) PORT_CHAR('6') PORT_CHAR('_') + KEY ( 1, "5 (", 5 ) PORT_CHAR('5') PORT_CHAR('(') + KEY ( 2, "4 '", 4 ) PORT_CHAR('4') PORT_CHAR('\'') + KEY ( 3, "3 \"", 3 ) PORT_CHAR('3') PORT_CHAR('"') + KEY ( 4, "2 \303\251", 2 ) PORT_CHAR('2') PORT_CHAR( 0xe9 ) + KEY ( 5, "1 *", 1 ) PORT_CHAR('1') PORT_CHAR('*') + KEY ( 6, "Stop", TAB ) PORT_CHAR(27) + KEY ( 7, "F5 F10", F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_START ( "keyboard.8" ) + KEY ( 0, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') + KEY ( 1, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') + KEY ( 2, ") \302\260", MINUS ) PORT_CHAR(')') PORT_CHAR( 0xb0 ) + KEY ( 3, "\342\206\221 \302\250", OPENBRACE ) PORT_CHAR('^') PORT_CHAR( 0xa8 ) + KEY ( 4, "\303\271 %", COLON ) PORT_CHAR( 0xf9 ) PORT_CHAR('%') + PORT_BIT ( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + /* unused */ + PORT_START ( "keyboard.9" ) + +INPUT_PORTS_END + +/* QWERTY version */ +static INPUT_PORTS_START ( pro128_keyboard ) + PORT_INCLUDE ( mo6_keyboard ) + + PORT_MODIFY ( "keyboard.0" ) + KEY ( 1, "M", M ) PORT_CHAR('M') + KEY ( 2, ", ;", COMMA ) PORT_CHAR(',') PORT_CHAR(';') + KEY ( 3, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') + KEY ( 6, "Z", Z ) PORT_CHAR('Z') + KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) + PORT_MODIFY ( "keyboard.1" ) + KEY ( 2, "- _", MINUS ) PORT_CHAR('-') PORT_CHAR('_') + PORT_MODIFY ( "keyboard.2" ) + KEY ( 3, "\303\221", TILDE ) PORT_CHAR( 0xd1 ) + PORT_MODIFY ( "keyboard.3" ) + KEY ( 5, "A \140", A ) PORT_CHAR('A') + PORT_MODIFY ( "keyboard.4" ) + KEY ( 4, ". :", STOP ) PORT_CHAR('.') PORT_CHAR(':') + KEY ( 5, "+ *", BACKSPACE ) PORT_CHAR('+') PORT_CHAR('*') + PORT_MODIFY ( "keyboard.5" ) + KEY ( 4, "W", W ) PORT_CHAR('W') + KEY ( 5, "Q", Q ) PORT_CHAR('Q') + PORT_MODIFY ( "keyboard.6" ) + KEY ( 0, "7 /", 7 ) PORT_CHAR('7') PORT_CHAR('/') + KEY ( 1, "8 (", 8 ) PORT_CHAR('8') PORT_CHAR('(') + KEY ( 2, "9 )", 9 ) PORT_CHAR('9') PORT_CHAR(')') + KEY ( 3, "0 =", 0 ) PORT_CHAR('0') PORT_CHAR('=') + KEY ( 4, "' \302\243", CLOSEBRACE ) PORT_CHAR('\'') PORT_CHAR( 0xa3 ) + KEY ( 5, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') + PORT_MODIFY ( "keyboard.7" ) + KEY ( 0, "6 &", 6 ) PORT_CHAR('6') PORT_CHAR('&') + KEY ( 1, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') + KEY ( 2, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') + KEY ( 3, "3 \302\247", 3 ) PORT_CHAR('3') PORT_CHAR( 0xa7 ) + KEY ( 4, "2 \"", 2 ) PORT_CHAR('2') PORT_CHAR('"') + KEY ( 5, "1 !", 1 ) PORT_CHAR('1') PORT_CHAR('!') + PORT_MODIFY ( "keyboard.8" ) + KEY ( 0, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') + KEY ( 1, "# \342\206\221", EQUALS ) PORT_CHAR('#') PORT_CHAR('^') + KEY ( 2, "\303\247 ?", COLON ) PORT_CHAR( 0xe7 ) PORT_CHAR('?') + KEY ( 3, "\302\277 @", SLASH ) PORT_CHAR( 0xbf ) PORT_CHAR('@') + KEY ( 4, "\302\241 \302\250", OPENBRACE ) PORT_CHAR( 0xa1 ) PORT_CHAR( 0xa8 ) + +INPUT_PORTS_END + + +static INPUT_PORTS_START ( mo6 ) + PORT_INCLUDE ( thom_lightpen ) + PORT_INCLUDE ( thom_game_port ) + PORT_INCLUDE ( mo6_keyboard ) + PORT_INCLUDE ( to7_config ) + PORT_INCLUDE ( to7_fconfig ) + PORT_INCLUDE ( to7_vconfig ) +INPUT_PORTS_END + +static INPUT_PORTS_START ( pro128 ) + PORT_INCLUDE ( thom_lightpen ) + PORT_INCLUDE ( thom_game_port ) + PORT_INCLUDE ( pro128_keyboard ) + PORT_INCLUDE ( to7_config ) + PORT_INCLUDE ( to7_fconfig ) + PORT_INCLUDE ( to7_vconfig ) +INPUT_PORTS_END + + +/* ------------ driver ------------ */ + +static MACHINE_CONFIG_DERIVED( mo6, to7 ) + MCFG_MACHINE_START_OVERRIDE( thomson_state, mo6 ) + MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo6 ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP ( mo6) + + MCFG_CASSETTE_MODIFY( "cassette" ) + MCFG_CASSETTE_FORMATS(mo5_cassette_formats) + + MCFG_DEVICE_REMOVE( "mc6846" ) + + MCFG_DEVICE_MODIFY(THOM_PIA_SYS) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, mo6_sys_porta_in)) + MCFG_PIA_READPB_HANDLER(READ8(thomson_state, mo6_sys_portb_in)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo6_sys_porta_out)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, mo6_sys_portb_out)) + MCFG_PIA_CA2_HANDLER(WRITELINE(thomson_state, mo5_set_cassette_motor)) + MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, mo6_sys_cb2_out)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) /* differs from TO */ + + MCFG_DEVICE_MODIFY(THOM_PIA_GAME) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo6_game_porta_out)) + MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, mo6_game_cb2_out)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_REMOVE("cartslot") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart") + MCFG_GENERIC_EXTENSIONS("m5,rom") + MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pro128, mo6 ) +MACHINE_CONFIG_END + +COMP ( 1986, mo6, 0, 0, mo6, mo6, driver_device, 0, "Thomson", "MO6", 0 ) + +COMP ( 1986, pro128, mo6, 0, pro128, pro128, driver_device, 0, "Olivetti / Thomson", "Prodest PC 128", 0 ) + + + + +/****************************** MO5NR ******************************** + +MO5 NR (1986) +------ + +Despite its name, the MO5 NR is much more related to the MO6 than to the MO5. +It can be though as the network-enhanced version of the MO6. +It is both MO5 and MO6 compatible (but not TO-compatible). + +Here are the differences between the MO6 and MO5NR: + +* chips: + - integrated MC 6854 network controller + +* memory: + - extra 2 KB ROM for the integrated network controller, + can be masked by the ROM from the external floppy controller + +* video: identical + +* devices: + - AZERTY keyboard has only 58 keys, and no caps-lock led + - CENTRONICS printer handled differently + - MO5-compatible network (probably identical to NR 07-005 extension) + - extern floppy controller & drive possible, masks the network + +**********************************************************************/ + +static ADDRESS_MAP_START ( mo5nr, AS_PROGRAM, 8, thomson_state ) + + AM_RANGE ( 0x0000, 0x1fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) + AM_RANGE ( 0x2000, 0x3fff ) AM_READ_BANK ( TO8_SYS_LO) AM_WRITE(to8_sys_lo_w ) + AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( TO8_SYS_HI) AM_WRITE(to8_sys_hi_w ) + AM_RANGE ( 0x6000, 0x7fff ) AM_READ_BANK ( TO8_DATA_LO) AM_WRITE(to8_data_lo_w ) + AM_RANGE ( 0x8000, 0x9fff ) AM_READ_BANK ( TO8_DATA_HI) AM_WRITE(to8_data_hi_w ) + AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) + AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE(mo6_ext_w ) + AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE(mo5nr_net_r, mo5nr_net_w ) + AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE(mo6_vreg_r, mo6_vreg_w ) + AM_RANGE ( 0xa7e1, 0xa7e1 ) AM_DEVREAD("cent_data_in", input_buffer_device, read) + AM_RANGE ( 0xa7e1, 0xa7e1 ) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE ( 0xa7e3, 0xa7e3 ) AM_READWRITE(mo5nr_prn_r, mo5nr_prn_w ) + AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE(mo6_gatearray_r, mo6_gatearray_w ) + AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) +/* AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w ) */ + AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) + AM_RANGE ( 0xa7f8, 0xa7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt) + AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE("mea8000", mea8000_device, read, write) + AM_RANGE ( 0xb000, 0xbfff ) AM_ROMBANK ( MO6_CART_LO ) + AM_WRITE ( mo6_cartridge_w ) + AM_RANGE ( 0xc000, 0xefff ) AM_ROMBANK ( MO6_CART_HI ) + AM_WRITE ( mo6_cartridge_w ) + AM_RANGE ( 0xf000, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) + +/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ +/* 0x20000 - 0x2ffff: 64 KB BIOS ROM */ +/* 0x30000 - 0x347ff: 16 KB floppy / network ROM controllers */ + +/* RAM mapping: 128 KB flat (including video) */ + +ADDRESS_MAP_END + + +/* ------------ ROMS ------------ */ + +ROM_START ( mo5nr ) + ROM_REGION ( 0x34800, "maincpu", 0 ) + + /* BIOS */ + ROM_LOAD ( "mo5nr-0.rom", 0x23000, 0x1000, + CRC(06e31115) + SHA1(7429cc0c15475398b5ab514cb3d3efdc71cf082f) ) + ROM_LOAD ( "mo5nr-1.rom", 0x27000, 0x1000, + CRC(7cda17c9) + SHA1(2ff6480ce9e30acc4c89b6113d7c8ea6095d90a5) ) + + /* BASIC */ + ROM_LOAD ( "basicn-0.rom", 0x20000, 0x3000, + CRC(fae9e691) + SHA1(62fbfd6d4ca837f6cb8ed37f828eca97f80e6200) ) + ROM_LOAD ( "basicn-1.rom", 0x24000, 0x3000, + CRC(cf134dd7) + SHA1(1bd961314e16e460d37a65f5e7f4acf5604fbb17) ) + ROM_LOAD ( "basicn-2.rom", 0x28000, 0x4000, + CRC(b69d2e0d) + SHA1(ea3220bbae991e08259d38a7ea24533b2bb86418) ) + ROM_LOAD ( "basicn-3.rom", 0x2c000, 0x4000, + CRC(7785610f) + SHA1(c38b0be404d8af6f409a1b52cb79a4e10fc33177) ) + + ROM_FLOPPY5 ( 0x30000 ) + ROM_FILL ( 0x10000, 0x10000, 0x39 ) /* TODO: network ROM */ +ROM_END + + + + +/* ------------ inputs ------------ */ + +static INPUT_PORTS_START ( mo5nr_keyboard ) + + PORT_START ( "keyboard.0" ) + KEY ( 0, "N", N ) PORT_CHAR('N') + KEY ( 1, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') + KEY ( 2, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') + KEY ( 3, "@ \342\206\221", TILDE ) PORT_CHAR('@') PORT_CHAR('^') + KEY ( 4, "Space Caps-Lock", SPACE ) PORT_CHAR(' ') PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + KEY ( 5, "X", X ) PORT_CHAR('X') + KEY ( 6, "W", W ) PORT_CHAR('W') + KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) + PORT_START ( "keyboard.1" ) + KEY ( 0, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + KEY ( 2, "Home", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + KEY ( 3, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + KEY ( 4, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + KEY ( 6, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) + KEY ( 7, "BASIC", RCONTROL ) + PORT_START ( "keyboard.2" ) + KEY ( 0, "J", J ) PORT_CHAR('J') + KEY ( 1, "K", K ) PORT_CHAR('K') + KEY ( 2, "L", L ) PORT_CHAR('L') + KEY ( 3, "M", M ) PORT_CHAR('M') + KEY ( 4, "B \140", B ) PORT_CHAR('B') + KEY ( 5, "V", V ) PORT_CHAR('V') + KEY ( 6, "C \136", C ) PORT_CHAR('C') + PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START ( "keyboard.3" ) + KEY ( 0, "H \302\250", H ) PORT_CHAR('H') + KEY ( 1, "G", G ) PORT_CHAR('G') + KEY ( 2, "F", F ) PORT_CHAR('F') + KEY ( 3, "D", D ) PORT_CHAR('D') + KEY ( 4, "S", S ) PORT_CHAR('S') + KEY ( 5, "Q", Q ) PORT_CHAR('Q') + KEY ( 6, "Clear", ESC ) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START ( "keyboard.4" ) + KEY ( 0, "U", U ) PORT_CHAR('U') + KEY ( 1, "I", I ) PORT_CHAR('I') + KEY ( 2, "O", O ) PORT_CHAR('O') + KEY ( 3, "P", P ) PORT_CHAR('P') + KEY ( 4, "/ ?", SLASH ) PORT_CHAR('/') PORT_CHAR('?') + KEY ( 5, "* :", QUOTE ) PORT_CHAR('*') PORT_CHAR(':') + KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) + PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START ( "keyboard.5" ) + KEY ( 0, "Y", Y ) PORT_CHAR('Y') + KEY ( 1, "T", T ) PORT_CHAR('T') + KEY ( 2, "R", R ) PORT_CHAR('R') + KEY ( 3, "E", E ) PORT_CHAR('E') + KEY ( 4, "Z", Z ) PORT_CHAR('Z') + KEY ( 5, "A \140", A ) PORT_CHAR('A') + KEY ( 6, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START ( "keyboard.6" ) + KEY ( 0, "7 ' \303\250", 7 ) PORT_CHAR('7') PORT_CHAR('\'' ) + KEY ( 1, "8 ( \303\271", 8 ) PORT_CHAR('8') PORT_CHAR('(') + KEY ( 2, "9 ) \303\247", 9 ) PORT_CHAR('9') PORT_CHAR(')') + KEY ( 3, "0 \303\240", 0 ) PORT_CHAR('0') PORT_CHAR( 0xe0 ) + KEY ( 4, "- =", MINUS ) PORT_CHAR('-') PORT_CHAR('=') + KEY ( 5, "+ ;", EQUALS ) PORT_CHAR('+') PORT_CHAR(';') + KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START ( "keyboard.7" ) + KEY ( 0, "6 & \303\251", 6 ) PORT_CHAR('6') PORT_CHAR('&') + KEY ( 1, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') + KEY ( 2, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') + KEY ( 3, "3 #", 3 ) PORT_CHAR('3') PORT_CHAR('#') + KEY ( 4, "2 \"", 2 ) PORT_CHAR('2') PORT_CHAR('"') + KEY ( 5, "1 !", 1 ) PORT_CHAR('1') PORT_CHAR('!') + KEY ( 6, "Stop", TAB ) PORT_CHAR(27) + PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + /* unused */ + PORT_START ( "keyboard.8" ) + PORT_START ( "keyboard.9" ) + +INPUT_PORTS_END + +static INPUT_PORTS_START ( mo5nr ) + PORT_INCLUDE ( thom_lightpen ) + PORT_INCLUDE ( thom_game_port ) + PORT_INCLUDE ( mo5nr_keyboard ) + PORT_INCLUDE ( to7_config ) + PORT_INCLUDE ( to7_fconfig ) + PORT_INCLUDE ( to7_vconfig ) +INPUT_PORTS_END + + +/* ------------ driver ------------ */ + +static MACHINE_CONFIG_DERIVED( mo5nr, to7 ) + MCFG_MACHINE_START_OVERRIDE( thomson_state, mo5nr ) + MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo5nr ) + + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP ( mo5nr) + + MCFG_DEVICE_REMOVE( "mc6846" ) + + MCFG_DEVICE_MODIFY(THOM_PIA_SYS) + MCFG_PIA_READPA_HANDLER(READ8(thomson_state, mo6_sys_porta_in)) + MCFG_PIA_READPB_HANDLER(READ8(thomson_state, mo5nr_sys_portb_in)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo5nr_sys_porta_out)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, mo6_sys_portb_out)) + MCFG_PIA_CA2_HANDLER(WRITELINE(thomson_state, mo5_set_cassette_motor)) + MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, mo6_sys_cb2_out)) + MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) /* differs from TO */ + + MCFG_DEVICE_MODIFY(THOM_PIA_GAME) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo6_game_porta_out)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) + + MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_REMOVE("cartslot") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart") + MCFG_GENERIC_EXTENSIONS("m5,rom") + MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + +COMP ( 1986, mo5nr, 0, 0, mo5nr, mo5nr, driver_device, 0, "Thomson", "MO5 NR", 0 ) diff --git a/src/mame/drivers/ti630.c b/src/mame/drivers/ti630.c new file mode 100644 index 00000000000..b92f03785d4 --- /dev/null +++ b/src/mame/drivers/ti630.c @@ -0,0 +1,212 @@ +// license:GPL-2.0+ +// copyright-holders: Felipe Sanches +/*************************************************************************** + + Intelbras TI630 telephone + Driver by Felipe Correa da Silva Sanches + + http://images.quebarato.com.br/T440x/telefone+ks+ti+630+seminovo+intelbras+sao+paulo+sp+brasil__2E255D_1.jpg + + Changelog: + + 2014 JUN 17 [Felipe Sanches]: + * Initial driver skeleton + * LCD works + +================ + Messages displayed on screen are in brazilian portuguese. + During boot, it says: + +"TI auto-test." +"Wait!" + + Then it says: + +"Initializing..." +"Wait!" + + And finally: + +"TI did not receive" +"the dial tone" + +It means we probably would have to emulate a modem device for it to treat communications with a PABX phone hub. +================ +*/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "video/hd44780.h" +#include "rendlay.h" + +class ti630_state : public driver_device +{ +public: + ti630_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_lcdc(*this, "hd44780") + { } + + DECLARE_WRITE8_MEMBER(ti630_io_w); + DECLARE_READ8_MEMBER(ti630_io_r); + DECLARE_DRIVER_INIT(ti630); + DECLARE_PALETTE_INIT(ti630); +private: + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_device m_lcdc; +}; + +#define LOG_IO_PORTS 0 + +static ADDRESS_MAP_START(i80c31_prg, AS_PROGRAM, 8, ti630_state) + AM_RANGE(0x0000, 0xffff) AM_ROM +ADDRESS_MAP_END + +DRIVER_INIT_MEMBER( ti630_state, ti630 ) +{ +} + +static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, ti630_state) + AM_RANGE(0x0000,0x0000) /*AM_MIRROR(?)*/ AM_DEVWRITE("hd44780", hd44780_device, control_write) + AM_RANGE(0x1000,0x1000) /*AM_MIRROR(?)*/ AM_DEVWRITE("hd44780", hd44780_device, data_write) + AM_RANGE(0x2000,0x2000) /*AM_MIRROR(?)*/ AM_DEVREAD("hd44780", hd44780_device, control_read) + AM_RANGE(0x8000,0xffff) AM_RAM /*TODO: verify the ammont of RAM and the correct address range to which it is mapped. This is just a first reasonable guess that apparently yields good results in the emulation */ + + AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(ti630_io_r, ti630_io_w) +ADDRESS_MAP_END + +void ti630_state::machine_start() +{ +} + +void ti630_state::machine_reset() +{ +} + +READ8_MEMBER(ti630_state::ti630_io_r) +{ + switch (offset) + { + case 0x01: + { + UINT8 value = 0; +#if LOG_IO_PORTS + printf("P1 read value:%02X\n", value); +#endif + return value; + } + default: +#if LOG_IO_PORTS + printf("Unhandled I/O Read at offset 0x%02X (return 0)\n", offset); +#endif + return 0; + } +} + +WRITE8_MEMBER(ti630_state::ti630_io_w) +{ + static UINT8 p0=0, p1=0, p2=0, p3=0; + switch (offset) + { + case 0x00: + { + if (data != p0) + { + p0=data; +#if LOG_IO_PORTS + printf("Write to P0: %02X\n", data); +#endif + } + break; + } + case 0x01: + { + if (data != p1) + { + p1=data; +#if LOG_IO_PORTS + printf("Write to P1: %02X\n", data); +#endif + } + break; + } + case 0x02: + { + if (data != p2) + { + p2=data; +#if LOG_IO_PORTS + printf("Write to P2: %02X\n", data); +#endif + } + break; + } + case 0x03: + { + if (data != p3) + { + p3=data; +#if LOG_IO_PORTS + printf("Write to P3: %02X\n", data); +#endif + } + break; + } + } +} + +PALETTE_INIT_MEMBER(ti630_state, ti630) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static const gfx_layout ti630_charlayout = +{ + 5, 8, /* 5 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 3, 4, 5, 6, 7}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( ti630 ) + GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, ti630_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( ti630, ti630_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80C31, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(i80c31_prg) + MCFG_CPU_IO_MAP(i80c31_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_SIZE(6*16, 9*2) + MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(ti630_state, ti630) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ti630) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 16) +MACHINE_CONFIG_END + +ROM_START( ti630 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "ti630.ci11", 0x00000, 0x10000, CRC(2602cbdc) SHA1(98266bea52a5893e0af0b5872eca0a0a1e0c5f9c) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1999, ti630, 0, 0, ti630, 0, ti630_state, ti630, "Intelbras", "TI630 telephone", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/ti74.c b/src/mame/drivers/ti74.c new file mode 100644 index 00000000000..4b2798ac3db --- /dev/null +++ b/src/mame/drivers/ti74.c @@ -0,0 +1,605 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + Texas Instruments TI-74 BASICALC + Texas Instruments TI-95 PROCALC + hardware family: CC-40 -> TI-74 BASICALC -> TI-95 PROCALC + + TI-74 PCB layout: + note: TI-95 PCB is nearly the same, just with a different size LCD screen, + its CPU is labeled C70011, and the system ROM is labeled HN61256PC95. + + DOCK-BUS + --||||||||--- + C == | + a == | + r == HN61256 | + t == ---------------------------- + | | + ------- C70009 4MHz | + | HM6264 RC4193N | + | | + | | + | | + | | + ---------------||||||||||||||||||||||||------- + |||||||||||||||||||||||| + ---------------||||||||||||||||||||||||------- + | *HD44100H *HD44780A00 | + | | + | | + | | + | | + ---------- | + | ----------------------------------| + | | || + | | LCD screen || + | | || + | ----------------------------------| + ------------------------------------- + + IC1 HN61256PC93 - Hitachi DIP-28 32KB CMOS Mask PROM + IC2 C70009 - Texas Instruments TMS70C46, 54 pins. Basically a TMS70C40 with some TI custom I/O mods. + 128 bytes internal RAM, 4KB internal ROM, running at max 4MHz. + IC3 HM6264LP-15 - Hitachi 8KB SRAM (battery backed) + RC4193N - Micropower Switching Regulator + HD44100H - 60-pin QFP Hitachi HD44100 LCD Driver + HD44780A00 - 80-pin TFP Hitachi HD44780 LCD Controller + + * - indicates that it's on the other side of the PCB + + + Overall, the hardware is very similar to TI CC-40. A lot has been shuffled around + to cut down on complexity (and probably for protection too). To reduce power usage + even more, the OS often idles while waiting for any keypress that triggers an interrupt + and wakes the processor up. + + The machine is powered by 4 AAA batteries. These will also save internal RAM, + provided that the machine is turned off properly. + + + TODO: + - it runs too fast due to missing clock divider emulation in TMS70C46 + - external ram cartridge + - DOCK-BUS interface and peripherals, compatible with both TI-74 and TI-95 + * CI-7 cassette interface + * PC-324 thermal printer + (+ old Hexbus devices can be connected via a converter cable) + +***************************************************************************/ + +#include "emu.h" +#include "cpu/tms7000/tms7000.h" +#include "video/hd44780.h" +#include "machine/nvram.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#include "ti74.lh" +#include "ti95.lh" + + +class ti74_state : public driver_device +{ +public: + ti74_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_key_matrix(*this, "IN"), + m_battery_inp(*this, "BATTERY") + { } + + required_device m_maincpu; + required_device m_cart; + required_ioport_array<8> m_key_matrix; + required_ioport m_battery_inp; + + UINT8 m_key_select; + UINT8 m_power; + + void update_lcd_indicator(UINT8 y, UINT8 x, int state); + void update_battery_status(int state); + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(keyboard_w); + DECLARE_WRITE8_MEMBER(bankswitch_w); + + virtual void machine_reset(); + virtual void machine_start(); + DECLARE_PALETTE_INIT(ti74); + DECLARE_INPUT_CHANGED_MEMBER(battery_status_changed); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ti74_cartridge); +}; + + + +/*************************************************************************** + + File Handling + +***************************************************************************/ + +DEVICE_IMAGE_LOAD_MEMBER(ti74_state, ti74_cartridge) +{ + UINT32 size = m_cart->common_get_size("rom"); + + // max size is 32KB + if (size > 0x8000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + + +/*************************************************************************** + + Video + +***************************************************************************/ + +PALETTE_INIT_MEMBER(ti74_state, ti74) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); // background + palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on + palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off +} + +void ti74_state::update_lcd_indicator(UINT8 y, UINT8 x, int state) +{ + // TI-74 ref._________________... + // output# |10 11 12 13 14 2 3 4 + // above | < SHIFT CTL FN I/O UCL _LOW > + // ---- raw lcd screen here ---- + // under | BASIC CALC DEG RAD GRAD STAT + // output# | 63 64 1 62 53 54 + // + // TI-95 ref._________________... + // output# | 40 43 41 44 42 12 11 10/13/14 0 1 2 + // above | _LOW _ERROR 2nd INV ALPHA LC INS DEGRAD HEX OCT I/O + // screen- | _P{70} <{71} RUN{3} + // area . SYS{4} + output_set_lamp_value(y * 10 + x, state); +} + +static HD44780_PIXEL_UPDATE(ti74_pixel_update) +{ + // char size is 5x7 + cursor + if (x > 4 || y > 7) + return; + + if (line == 1 && pos == 15) + { + // the last char is used to control the 14 lcd indicators + ti74_state *driver_state = device.machine().driver_data(); + driver_state->update_lcd_indicator(y, x, state); + } + else if (line < 2 && pos < 16) + { + // internal: 2*16, external: 1*31 + if (y == 7) y++; // the cursor is slightly below the character + bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; + } +} + +static HD44780_PIXEL_UPDATE(ti95_pixel_update) +{ + // char size is 5x7 + cursor + if (x > 4 || y > 7) + return; + + if (line == 1 && pos == 15) + { + // the last char is used to control the 17 lcd indicators + ti74_state *driver_state = device.machine().driver_data(); + driver_state->update_lcd_indicator(y, x, state); + } + else if (line == 0 && pos < 16) + { + // 1st line is simply 16 chars + if (y == 7) y++; // the cursor is slightly below the char + bitmap.pix16(10 + y, 1 + pos*6 + x) = state ? 1 : 2; + } + else if (line == 1 && pos < 15 && y < 7) + { + // 2nd line is segmented into 5 groups of 3 chars, there is no cursor + // note: the chars are smaller than on the 1st line (this is handled in .lay file) + const int gap = 9; + int group = pos / 3; + bitmap.pix16(1 + y, 1 + group*gap + pos*6 + x) = state ? 1 : 2; + } +} + + + +/*************************************************************************** + + I/O, Memory Maps + +***************************************************************************/ + +READ8_MEMBER(ti74_state::keyboard_r) +{ + UINT8 ret = 0; + + // read selected keyboard rows + for (int i = 0; i < 8; i++) + { + if (m_key_select >> i & 1) + ret |= m_key_matrix[i]->read(); + } + + return ret; +} + +WRITE8_MEMBER(ti74_state::keyboard_w) +{ + // d(0-7): select keyboard column + m_key_select = data; +} + +WRITE8_MEMBER(ti74_state::bankswitch_w) +{ + // d0-d1: system rom bankswitch + membank("sysbank")->set_entry(data & 3); + + // d2: power-on latch + if (~data & 4 && m_power) + { + m_power = 0; + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // stop running + } + + // d3: N/C +} + +static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, ti74_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) + AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("sysram.ic3") + //AM_RANGE(0x4000, 0xbfff) // mapped by the cartslot + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("sysbank") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( main_io_map, AS_IO, 8, ti74_state ) + AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(keyboard_r) + AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(bankswitch_w) + AM_RANGE(TMS7000_PORTE, TMS7000_PORTE) AM_WRITE(keyboard_w) AM_READNOP +ADDRESS_MAP_END + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +INPUT_CHANGED_MEMBER(ti74_state::battery_status_changed) +{ + if (machine().phase() == MACHINE_PHASE_RUNNING) + update_battery_status(newval); +} + +static INPUT_PORTS_START( ti74 ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ti74_state, battery_status_changed, 0) + PORT_CONFSETTING( 0x00, "Low" ) + PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) + + // 8x8 keyboard matrix, RESET and ON buttons are not on it. Unused entries are not connected, but some have a purpose for factory testing. + // For convenience, number keys are mapped to number row too. + // PORT_NAME lists functions under [SHIFT] and [MODE] or [STAT] as secondaries. + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_NAME("m M Frac") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_NAME("k K Frq") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_NAME("i I " UTF8_SQUAREROOT"x") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME(UTF8_LEFT" " UTF8_LEFT) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_NAME("u U x" UTF8_POW_2) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_NAME("j J nCr") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_NAME("n N Intg") + + PORT_START("IN.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_NAME("l L (x,y)") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_NAME("o O 1/x") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME(UTF8_RIGHT" EE") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_NAME("y Y log") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_NAME("h H nPr") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_NAME("b B EXC") + + PORT_START("IN.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('\'') PORT_NAME("SPACE ' " UTF8_CAPITAL_DELTA"%") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_NAME("; : " UTF8_CAPITAL_SIGMA"+") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_NAME("p P y" UTF8_POW_X) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('(') PORT_NAME(UTF8_UP" (") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_NAME("t T ln(x)") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_NAME("g G n!") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_NAME("v V SUM") + + PORT_START("IN.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) PORT_CHAR('=') PORT_NAME("ENTER =") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("CLR UCL CE/C") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(')') PORT_NAME(UTF8_DOWN" )") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("RUN x<>y") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_NAME("r R " UTF8_SMALL_PI) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_NAME("f F P>R") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_NAME("c C RCL") + + PORT_START("IN.4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('~') PORT_CHAR('?') PORT_NAME("+/- ? CSR") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_NAME("1 ! r") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_NAME("4 $ " UTF8_CAPITAL_SIGMA"x") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("7 DEL " UTF8_CAPITAL_SIGMA"x" UTF8_POW_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("BREAK") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_NAME("e E tan") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_NAME("d D DRG>") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_NAME("x X STO") + + PORT_START("IN.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('<') PORT_NAME("0 < x" UTF8_PRIME) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_NAME("2 \" a") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('&') PORT_NAME("5 & " UTF8_CAPITAL_SIGMA"y") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("8 INS " UTF8_CAPITAL_SIGMA"y" UTF8_POW_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_NAME("MODE") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_NAME("w W cos") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_NAME("s S DRG") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_NAME("z Z PRINT") + + PORT_START("IN.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_CHAR('>') PORT_NAME(". > y" UTF8_PRIME) // 2 on the keyboard, same scancode + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_NAME("3 # b") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_NAME("6 ^ n") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9 PB " UTF8_CAPITAL_SIGMA"xy") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_NAME("OFF") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_NAME("q Q sin") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_NAME("a A DMS>DD") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("+ s(y)") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("- s(x)") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME("* y" UTF8_NONSPACE_MACRON) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_NAME("/ x" UTF8_NONSPACE_MACRON) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("FN hyp") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("CTL STAT") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("SHIFT INV") +INPUT_PORTS_END + +static INPUT_PORTS_START( ti95 ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ti74_state, battery_status_changed, 0) + PORT_CONFSETTING( 0x00, "Low" ) + PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) + + // 8x8 keyboard matrix, RESET and ON buttons are not on it. + // For convenience, number keys are mapped to number row too. + // PORT_NAME lists functions under [ALPHA] and [2nd] as secondaries. + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("BREAK Q") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("SIN A") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_NAME("I/O Z") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("HELP ASM") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(')') PORT_NAME(") ] DRG") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_NAME(UTF8_DIVIDE" \\ DFN") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('=') PORT_NAME("= ~ TRACE") + + PORT_START("IN.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_NAME("EE { ENG") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_NAME("HALT W") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("COS S") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("FILES X") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_NAME("ALPHA PART") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_NAME("3 ; SBL") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("+ & RTN") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_NAME("2 : GTL") + + PORT_START("IN.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME(UTF8_CAPITAL_SIGMA"+ E") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_NAME("TAN D") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("STAT C") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("LEARN PC") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_NAME("6 @ CP") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("- _ 13d") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_NAME("5 % CMS") + + PORT_START("IN.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME("x~t R AH") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_NAME("LN F") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_NAME("CONV V") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("OLD NOP") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9 > x!") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME(UTF8_MULTIPLY" ^ " UTF8_SMALL_PI) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_NAME("8 < nCr") + + PORT_START("IN.4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("HYP T BH") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("LOG G") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_NAME("NUM B") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("RUN SPACE") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_NAME("0 $ PAUSE") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_NAME(". ? ADV") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("+/- ! PRINT") + + PORT_START("IN.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("INCR Y CH") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_NAME("x" UTF8_POW_2" H") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("FLAGS N") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_NAME(UTF8_LEFT" DEL") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("RCL O FH") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME("INV P") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_NAME("7 } nPr") + + PORT_START("IN.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_NAME("EXC U DH") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_NAME(UTF8_SQUAREROOT"x J") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("TESTS M") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_NAME(UTF8_RIGHT" INS") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("y" UTF8_POW_X" L") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("2nd") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4' )PORT_NAME("4 IND") + + PORT_START("IN.7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('(') PORT_NAME("( [ FIX") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_NAME("STO I EH") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_NAME("1/x K") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("FUNC , \"") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("CE F:CLR") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_NAME("LIST . '") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("CLEAR") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_NAME("1 # LBL") +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +void ti74_state::update_battery_status(int state) +{ + // battery ok/low status is on int1 line! + m_maincpu->set_input_line(TMS7000_INT1_LINE, state ? ASSERT_LINE : CLEAR_LINE); +} + +void ti74_state::machine_reset() +{ + m_power = 1; + + update_battery_status(m_battery_inp->read()); +} + +void ti74_state::machine_start() +{ + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + + membank("sysbank")->configure_entries(0, 4, memregion("system")->base(), 0x2000); + membank("sysbank")->set_entry(0); + + // zerofill + m_key_select = 0; + m_power = 0; + + // register for savestates + save_item(NAME(m_key_select)); + save_item(NAME(m_power)); +} + +static MACHINE_CONFIG_START( ti74, ti74_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS70C46, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(main_map) + MCFG_CPU_IO_MAP(main_io_map) + + MCFG_NVRAM_ADD_0FILL("sysram.ic3") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) // arbitrary + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(6*31+1, 9*1+1+1) + MCFG_SCREEN_VISIBLE_AREA(0, 6*31, 0, 9*1+1) + MCFG_DEFAULT_LAYOUT(layout_ti74) + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(ti74_state, ti74) + + MCFG_HD44780_ADD("hd44780") // 270kHz + MCFG_HD44780_LCD_SIZE(2, 16) // 2*16 internal + MCFG_HD44780_PIXEL_UPDATE_CB(ti74_pixel_update) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ti74_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom,256") + MCFG_GENERIC_LOAD(ti74_state, ti74_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "ti74_cart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ti95, ti74_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS70C46, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(main_map) + MCFG_CPU_IO_MAP(main_io_map) + + MCFG_NVRAM_ADD_0FILL("sysram.ic3") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(60) // arbitrary + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(200, 20) + MCFG_SCREEN_VISIBLE_AREA(0, 200-1, 0, 20-1) + MCFG_DEFAULT_LAYOUT(layout_ti95) + MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(ti74_state, ti74) + + MCFG_HD44780_ADD("hd44780") + MCFG_HD44780_LCD_SIZE(2, 16) + MCFG_HD44780_PIXEL_UPDATE_CB(ti95_pixel_update) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ti95_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom,256") + MCFG_GENERIC_LOAD(ti74_state, ti74_cartridge) + + //MCFG_SOFTWARE_LIST_ADD("cart_list", "ti95_cart") +MACHINE_CONFIG_END + + + +/*************************************************************************** + + ROM Definitions + +***************************************************************************/ + +ROM_START( ti74 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "c70009.ic2", 0xf000, 0x1000, CRC(55a2f7c0) SHA1(530e3de42f2e304c8f4805ad389f38a459ec4e33) ) // internal cpu rom + + ROM_REGION( 0x8000, "system", 0 ) + ROM_LOAD( "hn61256pc93.ic1", 0x0000, 0x8000, CRC(019aaa2f) SHA1(04a1e694a49d50602e45a7834846de4d9f7d587d) ) // system rom, banked +ROM_END + + +ROM_START( ti95 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "c70011.ic2", 0xf000, 0x1000, CRC(b4d0a5c1) SHA1(3ff41946d014f72220a88803023b6a06d5086ce4) ) // internal cpu rom + + ROM_REGION( 0x8000, "system", 0 ) + ROM_LOAD( "hn61256pc95.ic1", 0x0000, 0x8000, CRC(c46d29ae) SHA1(c653f08590dbc28241a9f5a6c2541641bdb0208b) ) // system rom, banked +ROM_END + + +COMP( 1985, ti74, 0, 0, ti74, ti74, driver_device, 0, "Texas Instruments", "TI-74 BASICALC", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1986, ti95, 0, 0, ti95, ti95, driver_device, 0, "Texas Instruments", "TI-95 PROCALC", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/ti85.c b/src/mame/drivers/ti85.c new file mode 100644 index 00000000000..179149c33d6 --- /dev/null +++ b/src/mame/drivers/ti85.c @@ -0,0 +1,931 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha,Jon Sturm +/*************************************************************************** +TI-85 and TI-86 drivers by Krzysztof Strzecha +TI-83 Plus, TI-84 Plus, and Siliver Edition support by Jon Sturm + +Notes: +1. After start TI-85 waits for ON key interrupt, so press ON key to start + calculator. ************* PRESS THE "Q" KEY TO TURN IT ON. ******************** +2. Only difference between all TI-85 drivers is ROM version. +3. TI-86 is TI-85 with more RAM and ROM. +4. Only difference between all TI-86 drivers is ROM version. +5. Video engine (with grayscale support) based on the idea found in VTI source + emulator written by Rusty Wagner. +6. NVRAM is saved properly only when calculator is turned off before exiting MESS. +7. To receive data from TI press "R" immediately after TI starts to send data. +8. To request screen dump from calculator press "S". +9. TI-81 does not have a serial link. + +Needed: +1. Info about ports 3 (bit 2 seems to be allways 0) and 4. +2. Any info on TI-81 hardware. +3. ROM dumps of unemulated models. +4. Artworks. + +New: +05/10/2002 TI-85 serial link works again. +17/09/2002 TI-85 snapshots loading fixed. Few code cleanups. + TI-86 SNAPSHOT LOADING DOESNT WORK. + TI-85, TI-86 SERIAL LINK DOESNT WORK. +08/09/2001 TI-81, TI-85, TI-86 modified to new core. + TI-81, TI-85, TI-86 reset corrected. +21/08/2001 TI-81, TI-85, TI-86 NVRAM corrected. +20/08/2001 TI-81 ON/OFF fixed. + TI-81 ROM bank switching added (port 5). + TI-81 NVRAM support added. +15/08/2001 TI-81 kayboard is now mapped as it should be. +14/08/2001 TI-81 preliminary driver added. +05/07/2001 Serial communication corrected (transmission works now after reset). +02/07/2001 Many source cleanups. + PCR added. +01/07/2001 Possibility to request screen dump from TI (received dumps are saved + as t85i file). +29/06/2001 Received variables can be saved now. +19/06/2001 Possibility to receive variables from calculator (they are nor saved + yet). +17/06/2001 TI-86 reset fixed. +15/06/2001 Possibility to receive memory backups from calculator. +07/06/2001 TI-85 reset fixed. + Work on receiving data from calculator started. +04/06/2001 TI-85 is able to receive variables and memory backups. +14/05/2001 Many source cleanups. +11/05/2001 Release years corrected. Work on serial link started. +26/04/2001 NVRAM support added. +25/04/2001 Video engine totally rewritten so grayscale works now. +17/04/2001 TI-86 snapshots loading added. + ti86grom driver added. +16/04/2001 Sound added. + Five TI-86 drivers added (all features of TI-85 drivers without + snapshot loading). +13/04/2001 Snapshot loading (VTI 2.0 save state files). +18/02/2001 Palette (not perfect). + Contrast control (port 2) implemented. + LCD ON/OFF implemented (port 3). + Interrupts corrected (port 3) - ON/OFF and APD works now. + Artwork added. +09/02/2001 Keypad added. + 200Hz timer interrupts implemented. + ON key and its interrupts implemented. + Calculator is now fully usable. +02/02/2001 Preliminary driver + +To do: +- port 7 (TI-86) +- port 4 (all models) +- artwork (all models) +- port 0 link (TI-82 and TI-83) +- add TI-73, TI-83+ and T84+ drivers + + +TI-81 memory map + + CPU: Z80 2MHz + 0000-7fff ROM + 8000-ffff RAM (?) + +TI-82 memory map + + CPU: Z80 6MHz + 0000-3fff ROM 0 + 4000-7fff ROM 1-7 (switched) + 8000-ffff RAM + +TI-83 memory map + + CPU: Z80 6MHz + 0000-3fff ROM 0 + 4000-7fff ROM 1-15 (switched) + 8000-ffff RAM + +TI-83Plus memory map + + CPU: Z80 8MHz (running at 6 MHz) + 0000-3fff ROM 0 + 4000-7fff ROM 0-31 or RAM 0-1 (switched) + 7000-bfff ROM 0-31 or RAM 0-1 (switched) + c000-ffff RAM 0-31 or RAM 0-1 (switched) + +TI-85 memory map + + CPU: Z80 6MHz + 0000-3fff ROM 0 + 4000-7fff ROM 1-7 (switched) + 8000-ffff RAM + +TI-86 memory map + + CPU: Z80 6MHz + 0000-3fff ROM 0 + 4000-7fff ROM 0-15 or RAM 0-7 (switched) + 7000-bfff ROM 0-15 or RAM 0-7 (switched) + c000-ffff RAM 0 + +Interrupts: + + IRQ: 200Hz timer + ON key + +TI-81 ports: + 0: Video buffer offset (write only) + 1: Keypad + 2: Contrast (write only) + 3: ON status, LCD power + 4: Video buffer width, interrupt control (write only) + 5: ? + 6: + 7: ? + +TI-82 ports: + 0: Link + 1: Keypad + 2: Memory page + 3: ON status, LCD power + 4: Video buffer width, interrupt control (write only) + 10: Control port for the display controller + 11: Data port for the display controller + +TI-83 ports: + 0: Link + Memory page + 1: Keypad + 2: Memory page + 3: ON status, LCD power + 4: Video buffer width, interrupt control (write only) + 10: Control port for the display controller + 11: Data port for the display controller + 14: Battery Status + +TI-83Plus ports: + 0: Link + 1: Keypad + 2: ? + 3: ON status, LCD power + 4: Interrupt status + 6: Memory page 1 + 7: Memory page 2 + 10: Control port for the display controller + 11: Data port for the display controller + +TI-83PlusSE ports: + 0: Link + 1: Keypad + 2: ? + 3: ON status, LCD power + 4: Interrupt status + 5: Memory page 3 + 6: Memory page 1 + 7: Memory page 2 + 10: Controll port for the display controller + 11: Data port for the display controller + 15: Asic Version + +TI-85 ports: + 0: Video buffer offset (write only) + 1: Keypad + 2: Contrast (write only) + 3: ON status, LCD power + 4: Video buffer width, interrupt control (write only) + 5: Memory page + 6: Power mode + 7: Link + +TI-86 ports: + 0: Video buffer offset (write only) + 1: Keypad + 2: Contrast (write only) + 3: ON status, LCD power + 4: Power mode + 5: Memory page + 6: Memory page + 7: Link + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "imagedev/snapquik.h" +#include "includes/ti85.h" +#include "machine/bankdev.h" + +/* port i/o functions */ + +static ADDRESS_MAP_START( ti81_io, AS_IO, 8, ti85_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti85_port_0000_r, ti85_port_0000_w ) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti85_port_0002_r, ti85_port_0002_w ) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) + AM_RANGE(0x0005, 0x0005) AM_READWRITE(ti85_port_0005_r, ti85_port_0005_w ) + AM_RANGE(0x0007, 0x0007) AM_WRITE(ti81_port_0007_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti85_io, AS_IO, 8, ti85_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti85_port_0000_r, ti85_port_0000_w ) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti85_port_0002_r, ti85_port_0002_w ) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) + AM_RANGE(0x0005, 0x0005) AM_READWRITE(ti85_port_0005_r, ti85_port_0005_w ) + AM_RANGE(0x0006, 0x0006) AM_READWRITE(ti85_port_0006_r, ti85_port_0006_w ) + AM_RANGE(0x0007, 0x0007) AM_READWRITE(ti8x_serial_r, ti8x_serial_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti82_io, AS_IO, 8, ti85_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti8x_serial_r, ti8x_serial_w ) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti82_port_0002_r, ti82_port_0002_w ) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) + AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) + AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti81v2_io, AS_IO, 8, ti85_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti82_port_0002_r, ti82_port_0002_w ) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) + AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) + AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti83_io, AS_IO, 8, ti85_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti83_port_0000_r, ti83_port_0000_w ) //TODO + AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti83_port_0002_r, ti83_port_0002_w ) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti83_port_0003_r, ti83_port_0003_w ) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) + AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) + AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) + AM_RANGE(0x0014, 0x0014) AM_READ_PORT( "BATTERY" ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti83p_io, AS_IO, 8, ti85_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti8x_plus_serial_r, ti8x_plus_serial_w) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) + AM_RANGE(0x0002, 0x0002) AM_READ(ti83p_port_0002_r) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti83_port_0003_r, ti83p_int_mask_w ) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti83p_port_0004_r, ti83p_port_0004_w ) + AM_RANGE(0x0006, 0x0006) AM_READWRITE(ti86_port_0005_r, ti83p_port_0006_w ) + AM_RANGE(0x0007, 0x0007) AM_READWRITE(ti86_port_0006_r, ti83p_port_0007_w ) + AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) + AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) + AM_RANGE(0x0007, 0x0007) AM_WRITE(ti83p_port_0014_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti83pse_io, AS_IO, 8, ti85_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti8x_plus_serial_r, ti8x_plus_serial_w) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti83pse_port_0002_r, ti83pse_int_ack_w ) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti83_port_0003_r, ti83p_int_mask_w ) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti83p_port_0004_r, ti83pse_port_0004_w ) + AM_RANGE(0x0005, 0x0005) AM_READWRITE(ti83pse_port_0005_r, ti83pse_port_0005_w ) + AM_RANGE(0x0006, 0x0006) AM_READWRITE(ti86_port_0005_r, ti83pse_port_0006_w ) + AM_RANGE(0x0007, 0x0007) AM_READWRITE(ti86_port_0006_r, ti83pse_port_0007_w ) + AM_RANGE(0x0009, 0x0009) AM_READ(ti83pse_port_0009_r) + AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) + AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) + AM_RANGE(0x0012, 0x0012) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) + AM_RANGE(0x0013, 0x0013) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) + AM_RANGE(0x0014, 0x0014) AM_WRITE(ti83p_port_0014_w ) + AM_RANGE(0x0015, 0x0015) AM_READ(ti83pse_port_0015_r) + AM_RANGE(0x0020, 0x0020) AM_READWRITE(ti83pse_port_0020_r, ti83pse_port_0020_w ) + AM_RANGE(0x0021, 0x0021) AM_READWRITE(ti83pse_port_0021_r, ti83pse_port_0021_w ) + + AM_RANGE(0x0030, 0x0030) AM_READWRITE(ti83pse_ctimer1_setup_r, ti83pse_ctimer1_setup_w ) + AM_RANGE(0x0031, 0x0031) AM_READWRITE(ti83pse_ctimer1_loop_r, ti83pse_ctimer1_loop_w ) + AM_RANGE(0x0032, 0x0032) AM_READWRITE(ti83pse_ctimer1_count_r, ti83pse_ctimer1_count_w ) + AM_RANGE(0x0033, 0x0033) AM_READWRITE(ti83pse_ctimer2_setup_r, ti83pse_ctimer2_setup_w ) + AM_RANGE(0x0034, 0x0034) AM_READWRITE(ti83pse_ctimer2_loop_r, ti83pse_ctimer2_loop_w ) + AM_RANGE(0x0035, 0x0035) AM_READWRITE(ti83pse_ctimer2_count_r, ti83pse_ctimer2_count_w ) + AM_RANGE(0x0036, 0x0036) AM_READWRITE(ti83pse_ctimer3_setup_r, ti83pse_ctimer3_setup_w ) + AM_RANGE(0x0037, 0x0037) AM_READWRITE(ti83pse_ctimer3_loop_r, ti83pse_ctimer3_loop_w ) + AM_RANGE(0x0038, 0x0038) AM_READWRITE(ti83pse_ctimer3_count_r, ti83pse_ctimer3_count_w ) + + AM_RANGE(0x0055, 0x0055) AM_READ(ti84pse_port_0055_r) + AM_RANGE(0x0056, 0x0056) AM_READ(ti84pse_port_0056_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti86_io, AS_IO, 8, ti85_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti85_port_0000_r, ti85_port_0000_w ) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti85_port_0002_r, ti85_port_0002_w ) + AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) + AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0006_r, ti85_port_0006_w ) + AM_RANGE(0x0005, 0x0005) AM_READWRITE(ti86_port_0005_r, ti86_port_0005_w ) + AM_RANGE(0x0006, 0x0006) AM_READWRITE(ti86_port_0006_r, ti86_port_0006_w ) + AM_RANGE(0x0007, 0x0007) AM_READWRITE(ti8x_serial_r, ti8x_serial_w ) +ADDRESS_MAP_END + +/* memory w/r functions */ + +static ADDRESS_MAP_START( ti81_mem , AS_PROGRAM, 8, ti85_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2") + AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti86_mem , AS_PROGRAM, 8, ti85_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti83pse_banked_mem , AS_PROGRAM, 8, ti85_state ) + AM_RANGE(0x0000, 0x1fffff) AM_DEVREADWRITE("flash", intelfsh8_device, read, write) + AM_RANGE(0x200000, 0x21BFFF) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( ti84p_banked_mem , AS_PROGRAM, 8, ti85_state ) + AM_RANGE(0x0000, 0xfffff) AM_DEVREADWRITE("flash", intelfsh8_device, read, write) + AM_RANGE(0x200000, 0x21BFFF) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti83p_banked_mem , AS_PROGRAM, 8, ti85_state ) + AM_RANGE(0x00000, 0x7ffff) AM_DEVREADWRITE("flash", intelfsh8_device, read, write) + AM_RANGE(0x100000, 0x107fff) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ti83p_asic_mem , AS_PROGRAM, 8, ti85_state ) + AM_RANGE(0x0000, 0x3fff) AM_DEVREADWRITE("membank1", address_map_bank_device, read8, write8) + AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("membank2", address_map_bank_device, read8, write8) + AM_RANGE(0x8000, 0xbfff) AM_DEVREADWRITE("membank3", address_map_bank_device, read8, write8) + AM_RANGE(0xc000, 0xffff) AM_DEVREADWRITE("membank4", address_map_bank_device, read8, write8) +ADDRESS_MAP_END + +/* keyboard input */ + +static INPUT_PORTS_START (ti81) + PORT_START("BIT0") /* bit 0 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-)") PORT_CODE(KEYCODE_M) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_F5) + PORT_START("BIT1") /* bit 1 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRACE") PORT_CODE(KEYCODE_F4) + PORT_START("BIT2") /* bit 2 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ZOOM") PORT_CODE(KEYCODE_F3) + PORT_START("BIT3") /* bit 3 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RANGE") PORT_CODE(KEYCODE_F2) + PORT_START("BIT4") /* bit 4 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE") PORT_CODE(KEYCODE_END) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y=") PORT_CODE(KEYCODE_F1) + PORT_START("BIT5") /* bit 5 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^-1") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) + PORT_START("BIT6") /* bit 6 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VARS") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRGM") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MATRX") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MATH") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_TILDE) + PORT_START("BIT7") /* bit 7 */ + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X|T") PORT_CODE(KEYCODE_X) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_START("ON") /* ON */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/OFF") PORT_CODE(KEYCODE_Q) +INPUT_PORTS_END + +static INPUT_PORTS_START (ti85) + PORT_START("BIT0") /* bit 0 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER (ENTRY)") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-) (ANS |_|)") PORT_CODE(KEYCODE_M) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (: Z)") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 (CHAR Y)") PORT_CODE(KEYCODE_0) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5 (M5)") PORT_CODE(KEYCODE_F5) + PORT_START("BIT1") /* bit 1 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ (MEM X)") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 (VARS W)") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 (TEST V)") PORT_CODE(KEYCODE_2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 (BASE U)") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE (RCL =)") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4 (M4)") PORT_CODE(KEYCODE_F4) + PORT_START("BIT2") /* bit 2 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- (LIST T)") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 (STRNG S)") PORT_CODE(KEYCODE_6) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 (CONV R)") PORT_CODE(KEYCODE_5) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 (CONS Q)") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", (ANGLE P)") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3 (M3)") PORT_CODE(KEYCODE_F3) + PORT_START("BIT3") /* bit 3 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* (MATH O)") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (CPLX N)") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (VECTR M)") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 (MATRX L)") PORT_CODE(KEYCODE_7) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2 (SQRT K)") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2 (M2)") PORT_CODE(KEYCODE_F2) + PORT_START("BIT4") /* bit 4 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ (CALC J)") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") (] I)") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( ([ H)") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE (X^-1 G)") PORT_CODE(KEYCODE_END) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN (e^x F)") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1 (M1)") PORT_CODE(KEYCODE_F1) + PORT_START("BIT5") /* bit 5 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^ (PI E)") PORT_CODE(KEYCODE_P) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN (TAN^-1 D)") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS (COS^-1 C)") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN (SIN^-1 B)") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG (10^x A)") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) + PORT_START("BIT6") /* bit 6 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR (TOLER)") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CUSTOM (CATALOG)") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRGM (POLY)") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STAT (SIMULT)") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GRAPH (SOLVER)") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXIT (QUIT)") PORT_CODE(KEYCODE_ESC) + PORT_START("BIT7") /* bit 7 */ + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL (INS)") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x-VAR (LINK x)") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA (alpha)") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MORE (MODE)") PORT_CODE(KEYCODE_TILDE) + PORT_START("ON") /* ON */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/OFF") PORT_CODE(KEYCODE_Q) +INPUT_PORTS_END + +static INPUT_PORTS_START (ti82) + PORT_START("BIT0") /* bit 0 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-)") PORT_CODE(KEYCODE_M) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_F5) + PORT_START("BIT1") /* bit 1 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_S) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRACE") PORT_CODE(KEYCODE_F4) + PORT_START("BIT2") /* bit 2 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ZOOM") PORT_CODE(KEYCODE_F3) + PORT_START("BIT3") /* bit 3 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("WINDOW") PORT_CODE(KEYCODE_F2) + PORT_START("BIT4") /* bit 4 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_END) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y=") PORT_CODE(KEYCODE_F1) + PORT_START("BIT5") /* bit 5 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^-1") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) + PORT_START("BIT6") /* bit 6 */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VARS") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRGM") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MATRX") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MATH") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_ESC) + PORT_START("BIT7") /* bit 7 */ + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STAT") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x-VAR") PORT_CODE(KEYCODE_X) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_START("ON") /* ON */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/OFF") PORT_CODE(KEYCODE_Q) +INPUT_PORTS_END + +static INPUT_PORTS_START (ti83) + PORT_INCLUDE( ti82 ) + + PORT_START("BATTERY") + PORT_DIPNAME( 0x01, 0x01, "Battery Status" ) + PORT_DIPSETTING( 0x01, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x00, "Low Battery" ) +INPUT_PORTS_END + +/* machine definition */ +static MACHINE_CONFIG_START( ti81, ti85_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 2000000) /* 2 MHz */ + MCFG_CPU_PROGRAM_MAP(ti81_mem) + MCFG_CPU_IO_MAP(ti81_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_SCREEN_SIZE(96, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 96-1, 0, 64-1) + MCFG_SCREEN_UPDATE_DRIVER(ti85_state, screen_update_ti85) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 224) + MCFG_PALETTE_INDIRECT_ENTRIES(224) + MCFG_PALETTE_INIT_OWNER(ti85_state, ti85) + + MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ti85, ti81 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(6000000) /* 6 MHz */ + MCFG_CPU_IO_MAP(ti85_io) + + MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti85 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(128, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 64-1) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ti85d, ti85 ) + MCFG_SNAPSHOT_ADD("snapshot", ti85_state, ti8x, "sav", 0) + //MCFG_TI85SERIAL_ADD( "tiserial" ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ti82, ti81 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(6000000) /* 6 MHz */ + MCFG_CPU_IO_MAP(ti82_io) + + MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti85 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(2) + MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 ) + + MCFG_DEVICE_ADD("t6a04", T6A04, 0) + MCFG_T6A04_SIZE(96, 64) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + //MCFG_TI82SERIAL_ADD( "tiserial" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ti81v2, ti82 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(ti81v2_io) + + //MCFG_DEVICE_REMOVE( "tiserial" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ti83, ti81 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(6000000) /* 6 MHz */ + MCFG_CPU_IO_MAP(ti83_io) + + MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti85 ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(2) + MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 ) + + MCFG_DEVICE_ADD("t6a04", T6A04, 0) + MCFG_T6A04_SIZE(96, 64) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ti86, ti85 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(ti86_mem) + MCFG_CPU_IO_MAP(ti86_io) + + MCFG_MACHINE_START_OVERRIDE(ti85_state, ti86 ) + MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti85 ) + + MCFG_SNAPSHOT_ADD("snapshot", ti85_state, ti8x, "sav", 0) + //MCFG_TI86SERIAL_ADD( "tiserial" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ti83p, ti81 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(6000000) /* 8 MHz running at 6 MHz */ + MCFG_CPU_PROGRAM_MAP(ti83p_asic_mem) + MCFG_CPU_IO_MAP(ti83p_io) + + MCFG_MACHINE_START_OVERRIDE(ti85_state, ti83p ) + MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti83p ) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(2) + MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 ) + + MCFG_DEVICE_ADD("membank1", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(ti83p_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_DEVICE_ADD("membank2", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(ti83p_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_DEVICE_ADD("membank3", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(ti83p_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_DEVICE_ADD("membank4", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(ti83p_banked_mem) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_DEVICE_ADD("t6a04", T6A04, 0) + MCFG_T6A04_SIZE(96, 64) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_AMD_29F400T_ADD("flash") + + //MCFG_TI83PSERIAL_ADD( "tiserial" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ti83pse, ti83p ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK( 15000000) + MCFG_CPU_IO_MAP(ti83pse_io) + + MCFG_DEVICE_MODIFY("membank1") + MCFG_DEVICE_PROGRAM_MAP(ti83pse_banked_mem) + + MCFG_DEVICE_MODIFY("membank2") + MCFG_DEVICE_PROGRAM_MAP(ti83pse_banked_mem) + + MCFG_DEVICE_MODIFY("membank3") + MCFG_DEVICE_PROGRAM_MAP(ti83pse_banked_mem) + + MCFG_DEVICE_MODIFY("membank4") + MCFG_DEVICE_PROGRAM_MAP(ti83pse_banked_mem) + + MCFG_MACHINE_START_OVERRIDE(ti85_state, ti83pse ) + MCFG_DEVICE_REPLACE("flash", FUJITSU_29F160T, 0) + + //MCFG_TI83PSERIAL_ADD( "tiserial" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ti84p, ti83pse ) + MCFG_DEVICE_MODIFY("membank1") + MCFG_DEVICE_PROGRAM_MAP(ti84p_banked_mem) + + MCFG_DEVICE_MODIFY("membank2") + MCFG_DEVICE_PROGRAM_MAP(ti84p_banked_mem) + + MCFG_DEVICE_MODIFY("membank3") + MCFG_DEVICE_PROGRAM_MAP(ti84p_banked_mem) + + MCFG_DEVICE_MODIFY("membank4") + MCFG_DEVICE_PROGRAM_MAP(ti84p_banked_mem) + + MCFG_MACHINE_START_OVERRIDE(ti85_state, ti84p ) + MCFG_DEVICE_REPLACE("flash", AMD_29F800T , 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ti84pse, ti83pse ) + MCFG_MACHINE_START_OVERRIDE(ti85_state, ti84pse ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ti73, ti83p ) + //MCFG_DEVICE_REMOVE( "tiserial" ) + //MCFG_TI73SERIAL_ADD( "tiserial" ) +MACHINE_CONFIG_END + +ROM_START (ti73) + ROM_REGION (0x80000, "flash",0) + ROM_DEFAULT_BIOS("v16") + ROM_SYSTEM_BIOS( 0, "v16", "V 1.6" ) + ROMX_LOAD( "ti73v160.rom", 0x00000, 0x80000, CRC(bb0e3a16) SHA1(d62c2c7532698962818a747a7f32e35e41dfe338), ROM_BIOS(1) ) +ROM_END + +ROM_START (ti81) + ROM_REGION (0x08000, "bios",0) + ROM_DEFAULT_BIOS("v18") + ROM_SYSTEM_BIOS( 0, "v11", "V 1.1K" ) + ROMX_LOAD( "ti81v11k.bin", 0x00000, 0x8000, CRC(0b860a63) SHA1(84a71cfc8818ca4b7d0caa76ffbf6d0463eaf7c6), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v16", "V 1.6K" ) + ROMX_LOAD( "ti81v16k.bin", 0x00000, 0x8000, CRC(452ca838) SHA1(92649f0f3bce7d8829d950cecd6532d7f7db1297), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v18", "V 1.8K" ) + ROMX_LOAD( "ti81v18k.bin", 0x00000, 0x8000, CRC(94ac58e2) SHA1(ba915cfe2fe50a452ef8287db8f2244e29056d54), ROM_BIOS(3) ) + //No dumps 1.0, and 2.0 from ticalc.org, less sure about 1.6K +ROM_END + +ROM_START (ti81v2) + ROM_REGION (0x08000, "bios",0) + ROM_DEFAULT_BIOS("v20") + ROM_SYSTEM_BIOS( 0, "v20", "V 2.0V" ) + ROMX_LOAD( "ti81v20v.bin", 0x00000, 0x8000, CRC(cfbd12da) SHA1(d2a923526d98f1046fcb583e46951939ba66bdb9), ROM_BIOS(1) ) +ROM_END + +ROM_START (ti82) + ROM_REGION (0x20000, "bios",0) + ROM_DEFAULT_BIOS("v19") + ROM_SYSTEM_BIOS( 0, "v16", "V 16.0" ) + ROMX_LOAD( "ti82v16.bin", 0x00000, 0x20000, CRC(e2f5721c) SHA1(df300ae52e105faf2785a8ae9f42e84e4308d460), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v17", "V 17.0" ) + ROMX_LOAD( "ti82v17.bin", 0x00000, 0x20000, CRC(0fc956d4) SHA1(77eef7d2db5ad1fb5de9129086a18428ddf66195), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v18", "V 18.0" ) + ROMX_LOAD( "ti82v18.bin", 0x00000, 0x20000, CRC(6a320f03) SHA1(9ee15ebf0a1f8bde5bef982b5db4ce120c605d29), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "v19", "V 19.0" ) + ROMX_LOAD( "ti82v19.bin", 0x00000, 0x20000, CRC(ed4cf9ff) SHA1(10dc2d01c62b4e971a6ed7ebc75ca0f2e3dc4f95), ROM_BIOS(4) ) + //Rom versions according to ticalc.org 3*, 4*, 7*, 8.0, 10.0, 12.0, 15.0, 16.0, 17.0, 18.0, 19.0, 19.006 +ROM_END + +ROM_START (ti83) + ROM_REGION (0x40000, "bios",0) + ROM_DEFAULT_BIOS("v110") + ROM_SYSTEM_BIOS( 0, "v102", "V 1.02" ) + ROMX_LOAD( "ti83v102.bin", 0x00000, 0x40000, CRC(7ee5d27b) SHA1(ce08f6a808701fc6672230a790167ee485157561), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v103", "V 1.03" ) + ROMX_LOAD( "ti83v103.bin", 0x00000, 0x40000, CRC(926f72a4) SHA1(8399e384804d8d29866caa4c8763d7a61946a467), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v104", "V 1.04" ) + ROMX_LOAD( "ti83v104.bin", 0x00000, 0x40000, CRC(dccb73d3) SHA1(33877ff637dc5f4c5388799fd7e2159b48e72893), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "v106", "V 1.06" ) + ROMX_LOAD( "ti83v106.bin", 0x00000, 0x40000, CRC(2eae1cf0) SHA1(3d65c2a1b771ce8e5e5a0476ec1aa9c9cdc0e833), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "v107", "V 1.07" ) + ROMX_LOAD( "ti83v107.bin", 0x00000, 0x40000, CRC(4bf05697) SHA1(ef66dad3e7b2b6a86f326765e7dfd7d1a308ad8f), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "v108", "V 1.08" ) + ROMX_LOAD( "ti83v108.bin", 0x00000, 0x40000, CRC(0c6aafcc) SHA1(9c74f0b61655e9e160e92164db472ad7ee02b0f8), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 6, "v110", "V 1.10" ) + ROMX_LOAD( "ti83v110.bin", 0x00000, 0x40000, CRC(7faee2d2) SHA1(25b373b58523647bb7b904001d391615e0b79bee), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS( 7, "v110-2", "V 1.10 (2)" ) + ROMX_LOAD( "ti83v110-2.bin", 0x00000, 0x40000, CRC(56182912) SHA1(4c77fb77f023502b685a49a8013568b494384b25), ROM_BIOS(8) ) + //Rom versions according to ticalc.org 1.02, 1.03, 1.04, 1.06, 1.07, 1.08, 1.10 +ROM_END + +ROM_START (ti83p) + ROM_REGION (0x80000, "flash",0) + ROM_DEFAULT_BIOS("v116") + ROM_SYSTEM_BIOS( 0, "v103", "V 1.03" ) + ROMX_LOAD( "ti83pv103.bin", 0x00000, 0x80000, CRC(da466be0) SHA1(37eaeeb9fb5c18fb494e322b75070e80cc4d858e), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v103m", "V 1.03 [m]" ) + ROMX_LOAD( "ti83pv103m.bin", 0x00000, 0x80000, CRC(281c9375) SHA1(80d698fed42976015a3e53fd59ebe7f49699b27e), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v103m2", "V 1.03 [m2]" ) + ROMX_LOAD( "ti83pv103m2.bin", 0x00000, 0x80000, CRC(690d9d30) SHA1(d215d3880e06c2ae31ec24b21d542d5bb2f3935b), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "v110", "V 1.10" ) + ROMX_LOAD( "ti83pv110.bin", 0x00000, 0x80000, CRC(62683990) SHA1(f86cdefe4ed5ef9965cd9eb667cb859e2cb10e19), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "v112", "V 1.12" ) + ROMX_LOAD( "ti83pv112.bin", 0x00000, 0x80000, CRC(ddca5026) SHA1(6615df5554076b6b81bd128bf847d2ff046e556b), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "v110-2", "V 1.10-2" ) + ROMX_LOAD( "ti83pv110-2.bin", 0x00000, 0x80000, CRC(504b9879) SHA1(8841d501870e8fc7173642d8a438205a040640fc), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 6, "v112-2", "V 1.12-2" ) + ROMX_LOAD( "ti83pv112-2.bin", 0x00000, 0x80000, CRC(2126de12) SHA1(cbedc3a8cf8335eebf2b279d58720d8e7f86c569), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS( 7, "v113", "V 1.13" ) + ROMX_LOAD( "ti83pv113.bin", 0x00000, 0x80000, CRC(30a243aa) SHA1(9b79e994ea1ce7af05b68f8ecee8b1b1fc3f0810), ROM_BIOS(8) ) + ROM_SYSTEM_BIOS( 8, "v114", "V 1.14" ) + ROMX_LOAD( "ti83pv114.bin", 0x00000, 0x80000, CRC(b32059c7) SHA1(46c66ba0421c03fc42f5afb06c7d3af812786140), ROM_BIOS(9) ) + ROM_SYSTEM_BIOS( 9, "v115", "V 1.15" ) + ROMX_LOAD( "ti83pv115.bin", 0x00000, 0x80000, CRC(9288029b) SHA1(8bd05fd47cab4028f275d1cc5383fd4f0e193474), ROM_BIOS(10) ) + ROM_SYSTEM_BIOS( 10, "v116", "V 1.16" ) + ROMX_LOAD( "ti83pv116.bin", 0x00000, 0x80000, CRC(0b7cd006) SHA1(290bc81159ea061d8ccb56a6f63e042f150afb32), ROM_BIOS(11) ) +ROM_END + +ROM_START (ti85) + ROM_REGION (0x20000, "bios",0) + ROM_DEFAULT_BIOS("v100") + ROM_SYSTEM_BIOS( 0, "v30a", "V 3.0A" ) + ROMX_LOAD( "ti85v30a.bin", 0x00000, 0x20000, CRC(de4c0b1a) SHA1(f4cf4b8309372dbe26187bb279545f5d4bd48fc1), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v40", "V 4.0" ) + ROMX_LOAD( "ti85v40.bin", 0x00000, 0x20000, CRC(a1723a17) SHA1(ff5866636bb3f206a6bf39cc9c9dc8308332aaf0), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v50", "V 5.0" ) + ROMX_LOAD( "ti85v50.bin", 0x00000, 0x20000, CRC(781fa403) SHA1(bf20d520d8efd7e5ae269789ca4b3c71848ac32a), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "v60", "V 6.0" ) + ROMX_LOAD( "ti85v60.bin", 0x00000, 0x20000, CRC(b694a117) SHA1(36d58e2723e5ae4ffe0f8da691fa9a83bfe9e06b), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "v80", "V 8.0" ) + ROMX_LOAD( "ti85v80.bin", 0x00000, 0x20000, CRC(7f296338) SHA1(765d5c612b6ffc0d1ded8f79bcbe880b1b562a98), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "v90", "V 9.0" ) + ROMX_LOAD( "ti85v90.bin", 0x00000, 0x20000, CRC(6a0a94d0) SHA1(7742bf8a6929a21d06f306b494fc03b1fbdfe3e4), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 6, "v100", "V 10.0" ) + ROMX_LOAD( "ti85v100.bin", 0x00000, 0x20000, CRC(053325b0) SHA1(36da1080c34e7b53cbe8463be5804e30e4a50dc8), ROM_BIOS(7) ) + //No_dumps 1.0, 2.0 and 7.0 according to ticalc.org +ROM_END + +ROM_START (ti86) + ROM_REGION (0x40000, "bios",0) + ROM_DEFAULT_BIOS("v16") + ROM_SYSTEM_BIOS( 0, "v12", "V 1.2" ) + ROMX_LOAD( "ti86v12.bin", 0x00000, 0x40000, CRC(bdf16105) SHA1(e40b22421c31bf0af104518b748ae79cd21d9c57), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v13", "V 1.3" ) + ROMX_LOAD( "ti86v13.bin", 0x00000, 0x40000, CRC(073ef70f) SHA1(5702d4bb835bdcbfa8075ffd620fca0eaf3a1592), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v14", "V 1.4" ) + ROMX_LOAD( "ti86v14.bin", 0x00000, 0x40000, CRC(fe6e2986) SHA1(23e0fb9a1763d5b9a7b0e593f09c2ff30c760866), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "v15", "V 1.5" ) + ROMX_LOAD( "ti86v15.bin", 0x00000, 0x40000, BAD_DUMP CRC(e6e10546) SHA1(5ca63fdfc965ae3fb8e0695263cf9da41f6ecb90), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "v16", "V 1.6" ) + ROMX_LOAD( "ti86v16.bin", 0x00000, 0x40000, CRC(37e02acc) SHA1(b5ad204885e5dde23a22f18f8d5eaffca69d638d), ROM_BIOS(5) ) + //Rom versions according to ticalc.org 1.2, 1.3, 1.4, 1.5, 1.6 +ROM_END + + +ROM_START (ti83pse) + ROM_REGION (0x200000, "flash", 0) + ROM_DEFAULT_BIOS("v116") + ROM_SYSTEM_BIOS( 0, "v116", "V 1.16" ) + ROMX_LOAD( "ti83psev116.bin", 0x00000, 0x200000, CRC(d2570863) SHA1(d4214b3c0ebb26e10fe95294ac72a90d2ba99537), ROM_BIOS(1) ) +ROM_END + +ROM_START (ti84pse) + ROM_REGION (0x200000, "flash",0) + ROM_DEFAULT_BIOS("v241") + ROM_SYSTEM_BIOS( 0, "v241", "V 2.41" ) + ROMX_LOAD( "ti84sev241.bin", 0x00000, 0x200000, CRC(5758db36) SHA1(7daa4f22e9b5dc8a1cc8fd31bceece9fa8b43515), ROM_BIOS(1) ) +ROM_END + +ROM_START (ti84p) + ROM_REGION (0x100000, "flash",0) + ROM_DEFAULT_BIOS("b100v255mp") + ROM_SYSTEM_BIOS( 0, "b100v255mp", "Boot 1.00 OS V 2.55MP" ) + ROMX_LOAD( "ti84pb100v255mp.bin", 0x00000, 0x100000, CRC(4af31251) SHA1(8f67269346644b87e7cd0f353f5f4030e787cf57), ROM_BIOS(1) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1990, ti81, 0, 0, ti81, ti81, driver_device, 0, "Texas Instruments", "TI-81", MACHINE_NO_SOUND ) +COMP( 1992, ti85, 0, 0, ti85d, ti85, driver_device, 0, "Texas Instruments", "TI-85", MACHINE_NO_SOUND ) +COMP( 1993, ti82, 0, 0, ti82, ti82, driver_device, 0, "Texas Instruments", "TI-82", MACHINE_NO_SOUND ) +COMP( 1994, ti81v2, ti81, 0, ti81v2, ti81, driver_device, 0, "Texas Instruments", "TI-81 v2.0", MACHINE_NO_SOUND ) +COMP( 1996, ti83, 0, 0, ti83, ti83, driver_device, 0, "Texas Instruments", "TI-83", MACHINE_NO_SOUND ) +COMP( 1997, ti86, 0, 0, ti86, ti85, driver_device, 0, "Texas Instruments", "TI-86", MACHINE_NO_SOUND ) +COMP( 1998, ti73, 0, 0, ti73, ti82, driver_device, 0, "Texas Instruments", "TI-73", MACHINE_NO_SOUND ) +COMP( 1999, ti83p, 0, 0, ti83p, ti82, driver_device, 0, "Texas Instruments", "TI-83 Plus", MACHINE_NO_SOUND ) +COMP( 2001, ti83pse, 0, 0, ti83pse, ti82, driver_device, 0, "Texas Instruments", "TI-83 Plus Silver Edition", MACHINE_NO_SOUND ) +COMP( 2004, ti84p, 0, 0, ti84p, ti82, driver_device, 0, "Texas Instruments", "TI-84 Plus", MACHINE_NO_SOUND ) +COMP( 2004, ti84pse, 0, 0, ti84pse, ti82, driver_device, 0, "Texas Instruments", "TI-84 Plus Silver Edition", MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/ti89.c b/src/mame/drivers/ti89.c new file mode 100644 index 00000000000..9958d18ef83 --- /dev/null +++ b/src/mame/drivers/ti89.c @@ -0,0 +1,675 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + TI-89, TI-92, TI-92 plus, Voyage 200 PLT and TI-89 Titanium + + Driver by Sandro Ronco + + Note: + -NVRAM works only if the calculator is turned off (2nd + ON) before closing MESS + + TODO: + -Link + -HW 3 I/O port + -RTC + -LCD contrast + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "includes/ti89.h" +#include "machine/nvram.h" +#include "machine/intelfsh.h" +#include "rendlay.h" + +UINT8 ti68k_state::keypad_r() +{ + UINT8 bit, data = 0xff; + + for (bit = 0; bit < 10; bit++) + { + if (~m_kb_mask & (0x01 << bit)) + { + data ^= m_io_bit0->read() & (0x01 << bit) ? 0x01 : 0x00; + data ^= m_io_bit1->read() & (0x01 << bit) ? 0x02 : 0x00; + data ^= m_io_bit2->read() & (0x01 << bit) ? 0x04 : 0x00; + data ^= m_io_bit3->read() & (0x01 << bit) ? 0x08 : 0x00; + data ^= m_io_bit4->read() & (0x01 << bit) ? 0x10 : 0x00; + data ^= m_io_bit5->read() & (0x01 << bit) ? 0x20 : 0x00; + data ^= m_io_bit6->read() & (0x01 << bit) ? 0x40 : 0x00; + data ^= m_io_bit7->read() & (0x01 << bit) ? 0x80 : 0x00; + } + } + + return data; +} + + +WRITE16_MEMBER ( ti68k_state::ti68k_io_w ) +{ + switch(offset & 0x0f) + { + case 0x00: + m_lcd_contrast = (m_lcd_contrast & 0xfe) | BIT(data, 5); + break; + case 0x02: + if (!(data & 0x10) && data != m_io_hw1[offset]) + m_maincpu->suspend(SUSPEND_REASON_DISABLE, 1); + break; + case 0x08: + m_lcd_base = data << 3; + break; + case 0x09: + m_lcd_width = (0x40 - ((data >> 8) & 0xff)) * 0x10; + m_lcd_height = 0x100 - (data & 0xff); + break; + case 0x0a: + m_timer_on = BIT(data ,1); + switch((data >> 4) & 0x03) + { + case 0: m_timer_mask = 0x0000; break; + case 1: m_timer_mask = 0x000f; break; + case 2: m_timer_mask = 0x007f; break; + case 3: m_timer_mask = 0x1fff; break; + } + break; + case 0x0b: + m_timer_val = data & 0xff; + case 0x0c: + m_kb_mask = data & 0x03ff; + break; + case 0x0e: + m_lcd_on = (((data >> 8) & 0x3c) == 0x3c) ? 0 : 1; + m_lcd_contrast = (m_lcd_contrast & 0x01) | ((data & 0x0f) << 1); + break; + default: break; + } + m_io_hw1[offset & 0x0f] = data; +} + + +READ16_MEMBER ( ti68k_state::ti68k_io_r ) +{ + UINT16 data; + + switch (offset & 0x0f) + { + case 0x00: + data = 0x0400 | ((m_lcd_contrast & 1) << 13); + break; + case 0x0b: + data = m_timer_val; + break; + case 0x0d: + data = ((!m_on_key) << 9) | keypad_r(); + break; + default: + data= m_io_hw1[offset & 0x0f]; + } + return data; +} + + +WRITE16_MEMBER ( ti68k_state::ti68k_io2_w ) +{ + switch(offset & 0x7f) + { + case 0x0b: + m_lcd_base = 0x4c00 + 0x1000 * (data & 0x03); + break; + case 0x0e: + m_lcd_on = (data & 0x02) ? 1 : 0; + break; + default: break; + } + m_io_hw2[offset & 0x7f] = data; +} + + +READ16_MEMBER ( ti68k_state::ti68k_io2_r ) +{ + UINT16 data; + + switch (offset & 0x7f) + { + default: + data= m_io_hw2[offset & 0x7f]; + } + return data; +} + + +WRITE16_MEMBER ( ti68k_state::flash_w ) +{ + // verification if it is flash memory + if (m_flash_mem) + m_flash->write(offset, data); +} + +READ16_MEMBER ( ti68k_state::flash_r ) +{ + if (m_flash_mem) + { + return m_flash->read(offset); + } + else + { + return m_rom_base[offset]; + } +} + + +TIMER_DEVICE_CALLBACK_MEMBER(ti68k_state::ti68k_timer_callback) +{ + m_timer++; + + if (m_timer_on) + { + if (!(m_timer & m_timer_mask) && BIT(m_io_hw1[0x0a], 3)) + { + if (m_timer_val) + m_timer_val++; + else + m_timer_val = (m_io_hw1[0x0b]) & 0xff; + } + + if (!BIT(m_io_hw1[0x0a], 7) && ((m_hw_version == HW1) || (!BIT(m_io_hw1[0x0f], 2) && !BIT(m_io_hw1[0x0f], 1)))) + { + if (!(m_timer & 0x003f)) + m_maincpu->set_input_line(M68K_IRQ_1, HOLD_LINE); + + if (!(m_timer & 0x3fff) && !BIT(m_io_hw1[0x0a], 3)) + m_maincpu->set_input_line(M68K_IRQ_3, HOLD_LINE); + + if (!(m_timer & m_timer_mask) && BIT(m_io_hw1[0x0a], 3) && m_timer_val == 0) + m_maincpu->set_input_line(M68K_IRQ_5, HOLD_LINE); + } + } + + if (keypad_r() != 0xff) + m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); +} + + +static ADDRESS_MAP_START(ti92_mem, AS_PROGRAM, 16, ti68k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x200000, 0x5fffff) AM_UNMAP // ROM + AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(ti89_mem, AS_PROGRAM, 16, ti68k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x200000, 0x3fffff) AM_READWRITE(flash_r, flash_w) + AM_RANGE(0x400000, 0x5fffff) AM_NOP + AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) + AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(ti68k_io2_r, ti68k_io2_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(ti92p_mem, AS_PROGRAM, 16, ti68k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x200000, 0x3fffff) AM_NOP + AM_RANGE(0x400000, 0x5fffff) AM_READWRITE(flash_r, flash_w) + AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) + AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(ti68k_io2_r, ti68k_io2_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(v200_mem, AS_PROGRAM, 16, ti68k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x200000, 0x5fffff) AM_READWRITE(flash_r, flash_w) + AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) + AM_RANGE(0x700000, 0x70ffff) AM_READWRITE(ti68k_io2_r, ti68k_io2_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(ti89t_mem, AS_PROGRAM, 16, ti68k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_MIRROR(0x200000) AM_SHARE("nvram") + AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) + AM_RANGE(0x700000, 0x70ffff) AM_READWRITE(ti68k_io2_r, ti68k_io2_w) + AM_RANGE(0x800000, 0xbfffff) AM_READWRITE(flash_r, flash_w) + AM_RANGE(0xbf0000, 0xffffff) AM_NOP +ADDRESS_MAP_END + + +INPUT_CHANGED_MEMBER(ti68k_state::ti68k_on_key) +{ + m_on_key = newval; + + if (m_on_key) + { + if (m_maincpu->suspended(SUSPEND_REASON_DISABLE)) + m_maincpu->resume(SUSPEND_REASON_DISABLE); + + m_maincpu->set_input_line(M68K_IRQ_6, HOLD_LINE); + } +} + + +/* Input ports for TI-89 and TI-89 Titanium*/ +static INPUT_PORTS_START (ti8x) + PORT_START("BIT0") /* bit 0 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER (ENTRY)") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-)") PORT_CODE(KEYCODE_M) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("APPS") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + + PORT_START("BIT1") /* bit 1 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, ti68k_state, ti68k_on_key, 0) + + PORT_START("BIT2") /* bit 2 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE") PORT_CODE(KEYCODE_E) + + PORT_START("BIT3") /* bit 3 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_L) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("|") PORT_CODE(KEYCODE_COLON) + + PORT_START("BIT4") /* bit 4 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + + PORT_START("BIT5") /* bit 5 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + + PORT_START("BIT6") /* bit 6 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3nd") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CATALOG") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mode") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + + PORT_START("BIT7") /* bit 7 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) +INPUT_PORTS_END + +/* Input ports for TI-92 and TI92 Plus*/ +static INPUT_PORTS_START (ti9x) + PORT_START("BIT0") /* bit 0 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_UNUSED + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + + PORT_START("BIT1") /* bit 1 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3nd") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("BIT2") /* bit 2 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + + PORT_START("BIT3") /* bit 3 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clock") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + + PORT_START("BIT4") /* bit 4 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + + PORT_START("BIT5") /* bit 5 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + + PORT_START("BIT6") /* bit 6 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_END) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("APPS") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + + PORT_START("BIT7") /* bit 7 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, ti68k_state, ti68k_on_key, 0) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-)") PORT_CODE(KEYCODE_MINUS_PAD) +INPUT_PORTS_END + + +void ti68k_state::machine_start() +{ + int i; + + m_flash_mem = !((m_rom_base[0x32] & 0x0f) != 0); + + if (m_flash_mem) + { + UINT32 base = ((((m_rom_base[0x82]) << 16) | m_rom_base[0x83]) & 0xffff)>>1; + + if (m_rom_base[base] >= 8) + m_hw_version = ((m_rom_base[base + 0x0b]) << 16) | m_rom_base[base + 0x0c]; + + if (!m_hw_version) + m_hw_version = HW1; + + for (i = 0x9000; i < 0x100000; i++) + if (m_rom_base[i] == 0xcccc && m_rom_base[i + 1] == 0xcccc) + break; + + m_initial_pc = ((m_rom_base[i + 4]) << 16) | m_rom_base[i + 5]; + } + else + { + m_hw_version = HW1; + m_initial_pc = ((m_rom_base[2]) << 16) | m_rom_base[3]; + + m_maincpu->space(AS_PROGRAM).unmap_read(0x200000, 0x5fffff); + + if (m_initial_pc > 0x400000) + { + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x400000, 0x5fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this),write16_delegate(FUNC(ti68k_state::flash_w), this)); + } + else + { + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x200000, 0x3fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this), write16_delegate(FUNC(ti68k_state::flash_w), this)); + } + } + + logerror("HW=v%x, PC=%06x, Type=%s\n", m_hw_version, m_initial_pc, (m_flash_mem) ? "Flash" : "ROM"); +} + + +void ti68k_state::machine_reset() +{ + m_maincpu->set_state_int(M68K_PC, m_initial_pc); + + m_kb_mask = 0xff; + m_on_key = 0; + m_lcd_base = 0; + m_lcd_width = 0; + m_lcd_height = 0; + m_lcd_on = 0; + m_lcd_contrast = 0; + memset(m_io_hw1, 0, ARRAY_LENGTH(m_io_hw1) * sizeof(UINT16)); + memset(m_io_hw2, 0, ARRAY_LENGTH(m_io_hw2) * sizeof(UINT16)); + m_timer_on = 0; + m_timer_mask = 0xf; + m_timer_val = 0; +} + +/* video */ +UINT32 ti68k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + /* preliminary implementation, doesn't use the contrast value */ + UINT8 width = screen.width(); + UINT8 height = screen.height(); + UINT8 x, y, b; + + if (!m_lcd_on || !m_lcd_base) + bitmap.fill(0); + else + for (y = 0; y < height; y++) + for (x = 0; x < width / 8; x++) + { + UINT8 s_byte= m_maincpu->space(AS_PROGRAM).read_byte(m_lcd_base + y * (width/8) + x); + for (b = 0; b<8; b++) + bitmap.pix16(y, x * 8 + (7 - b)) = BIT(s_byte, b); + } + + return 0; +} + +PALETTE_INIT_MEMBER(ti68k_state, ti68k) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +static MACHINE_CONFIG_START( ti89, ti68k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(ti89_mem) + + MCFG_NVRAM_ADD_0FILL("nvram") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(ti68k_state, screen_update) + MCFG_SCREEN_SIZE(240, 128) + MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 100-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(ti68k_state, ti68k) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_SHARP_UNK128MBIT_ADD("flash") //should be LH28F320 for ti89t and v200 and LH28F160S3T for other models + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ti68k_timer", ti68k_state, ti68k_timer_callback, attotime::from_hz(1<<14)) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ti92, ti89 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(ti92_mem) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 128-1) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ti92p, ti92 ) + MCFG_CPU_REPLACE("maincpu", M68000, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(ti92p_mem) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( v200, ti92 ) + MCFG_CPU_REPLACE("maincpu", M68000, XTAL_12MHz) + MCFG_CPU_PROGRAM_MAP(v200_mem) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( ti89t, ti89 ) + MCFG_CPU_REPLACE("maincpu", M68000, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(ti89t_mem) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( ti89 ) + ROM_REGION( 0x200000, "flash", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v100", "V 1.00 - HW1" ) + ROMX_LOAD( "ti89v100.rom", 0x000000, 0x200000, CRC(264b34ad) SHA1(c87586a7e9b6d49fbe908fbb6f3c0038f3498573), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v100a", "V 1.00 [a] - HW1" ) + ROMX_LOAD( "ti89v100a.rom", 0x000000, 0x200000, CRC(95199934) SHA1(b8e3cdeb4705b0c7e0a15ab6c6f62bcde14a3a55), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v100m", "V 1.00 [m] - HW1" ) + ROMX_LOAD( "ti89v100m.rom", 0x000000, 0x200000, CRC(b9059e06) SHA1(b33a7c2935eb9f73b210bcf6e7c7f32d1548a9d5), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "v100m2", "V 1.00 [m2] - HW1" ) + ROMX_LOAD( "ti89v100m2.rom", 0x000000, 0x200000, CRC(cdd69d34) SHA1(1686362b0997bb9597f39b443490d4d8d85b56cc), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "v105", "V 1.05 - HW1" ) + ROMX_LOAD( "ti89v105.rom", 0x000000, 0x200000, CRC(3bc0b474) SHA1(46fe0cd511eb81d53dc12cc4bdacec8a5bba5171), ROM_BIOS(5)) + ROM_SYSTEM_BIOS( 5, "v201", "V 2.01 - HW1" ) + ROMX_LOAD( "ti89v201.rom", 0x000000, 0x200000, CRC(fa6745e9) SHA1(e4ee6067df9b975356cef6c5a81d0ec664371c1d), ROM_BIOS(6)) + ROM_SYSTEM_BIOS( 6, "v203", "V 2.03 - HW1" ) + ROMX_LOAD( "ti89v203.rom", 0x000000, 0x200000, CRC(a3a74eca) SHA1(55aae3561722a96973b430e3d4cb4f513298ea4e), ROM_BIOS(7)) + ROM_SYSTEM_BIOS( 7, "v203m", "V 2.03 [m] - HW 1" ) + ROMX_LOAD( "ti89v203m.rom", 0x000000, 0x200000, CRC(d79068f7) SHA1(5b6f571417889b11ae19eef99a5fda4f027d5ec2), ROM_BIOS(8)) + ROM_SYSTEM_BIOS( 8, "v209", "V 2.09 - HW 1" ) + ROMX_LOAD( "ti89v209.rom", 0x000000, 0x200000, CRC(f76f9c15) SHA1(66409ef4b20190a3b7c0d48cbd30257580b47dcd), ROM_BIOS(9)) + ROM_SYSTEM_BIOS( 9, "v105-2","V 1.05 - HW2" ) + ROMX_LOAD( "ti89v105-2.rom", 0x000000, 0x200000, CRC(83817402) SHA1(b2ddf785e973cc3f9a437d058a68abdf7ca52ea2), ROM_BIOS(10)) + ROM_SYSTEM_BIOS( 10, "v203-2", "V 2.03 - HW2" ) + ROMX_LOAD( "ti89v203-2.rom", 0x000000, 0x200000, CRC(5e0400a9) SHA1(43c608ee72f15aed56cb5762948ec6a3c93dd9d8), ROM_BIOS(11)) + ROM_SYSTEM_BIOS( 11, "v203m-2", "V 2.03 [m] - HW2" ) + ROMX_LOAD( "ti89v203m-2.rom", 0x000000, 0x200000, CRC(04d5d76d) SHA1(14ca44b64c29aa1bf274508ca40fe69224f5a7cc), ROM_BIOS(12)) + ROM_SYSTEM_BIOS( 12, "v205-2", "V 2.05 - HW2" ) + ROMX_LOAD( "ti89v205-2.rom", 0x000000, 0x200000, CRC(37c4653c) SHA1(f48d00a57430230e489e243383513485009b1b98), ROM_BIOS(13)) + ROM_SYSTEM_BIOS( 13, "v205-2m", "V 2.05 [m] - HW2" ) + ROMX_LOAD( "ti89v205m-2.rom", 0x000000, 0x200000, CRC(e58a23f9) SHA1(d4cb23fb4b414a43802c37dc3c572a8ede670e0f), ROM_BIOS(14)) + ROM_SYSTEM_BIOS( 14, "v205-2m2","V 2.05 [m2] - HW2" ) + ROMX_LOAD( "ti89v205m2-2.rom", 0x000000, 0x200000, CRC(a8ba976c) SHA1(38bd25ada5e2066c64761d1008a9327a37d68654), ROM_BIOS(15)) + ROM_SYSTEM_BIOS( 15,"v209-2", "V 2.09 - HW2" ) + ROMX_LOAD( "ti89v209-2.rom", 0x000000, 0x200000, CRC(242a238f) SHA1(9668df314a0180ef210796e9cb651c5e9f17eb07), ROM_BIOS(16)) +ROM_END + +ROM_START( ti92 ) + ROM_REGION( 0x200000, "flash", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v111", "V 1.11" ) + ROMX_LOAD( "ti92v111.rom", 0x000000, 0x100000, CRC(67878d52) SHA1(c0fdf162961922a76f286c93fd9b861ce20f23a3), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v13e", "V 1.3 [e]" ) + ROMX_LOAD( "ti92v13e.rom", 0x000000, 0x100000, CRC(316c8196) SHA1(82c8cd484c6aebe36f814a2023d2afad6d87f840), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v14e", "V 1.4 [e]" ) + ROMX_LOAD( "ti92v14e.rom", 0x000000, 0x100000, CRC(239e9405) SHA1(df2f1ab17d490fda43a02f5851b5a15052361b28), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "v17e", "V 1.7 [e]" ) + ROMX_LOAD( "ti92v17e.rom", 0x000000, 0x100000, CRC(83e27cc5) SHA1(aec5a6a6157ff94a4e665fa3fe747bacb6688cd4), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "v111e", "V 1.11 [e]" ) + ROMX_LOAD( "ti92v111e.rom", 0x000000, 0x100000, CRC(4a343833) SHA1(ab4eaacc8c83a861c8d37df5c10e532d0d580460), ROM_BIOS(5)) + ROM_SYSTEM_BIOS( 5, "v112e", "V 1.12 [e]" ) + ROMX_LOAD( "ti92v112e.rom", 0x000000, 0x100000, CRC(9a6947a0) SHA1(8bb0538ca98711e9ad46c56e4dfd609d4699be30), ROM_BIOS(6)) + ROM_SYSTEM_BIOS( 6, "v21e", "V 2.1 [e]" ) + ROMX_LOAD( "ti92v21e.rom", 0x000000, 0x200000, CRC(5afb5863) SHA1(bf7b260d37d1502cc4b08dea5e1d55b523f27925), ROM_BIOS(7)) + +ROM_END + +ROM_START( ti92p ) + ROM_REGION( 0x200000, "flash", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v100", "V 1.00 - HW1" ) + ROMX_LOAD( "ti92pv100.rom", 0x0000, 0x200000, CRC(c651a586) SHA1(fbbf7e053e70eefe517f9aae40c072036bc614ea), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v101", "V 1.01 - HW1" ) + ROMX_LOAD( "ti92pv101.rom", 0x0000, 0x200000, CRC(826b1539) SHA1(dd8969511fc6233bf2047f83c3306ac8d2be5644), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "v101a","V 1.01 [a] - HW1" ) + ROMX_LOAD( "ti92pv101a.rom", 0x0000, 0x200000, CRC(18f9002f) SHA1(2bf13ba7da0212a8706c5a43853dc2ccb8c2257d), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "v101m", "V 1.01 [m] - HW1" ) + ROMX_LOAD( "ti92pv101m.rom", 0x0000, 0x200000, CRC(fe2b6e77) SHA1(0e1bb8c677a726ee086c1a4280ab59de95b4abe2), ROM_BIOS(4)) + ROM_SYSTEM_BIOS( 4, "v105", "V 1.05 - HW1" ) + ROMX_LOAD( "ti92pv105.rom", 0x0000, 0x200000, CRC(cd945824) SHA1(6941aca243c6fd5c8a377253bffc2ffb5a84c41b), ROM_BIOS(5)) + ROM_SYSTEM_BIOS( 5, "v105-2", "V 1.05 - HW2" ) + ROMX_LOAD( "ti92pv105-2.rom", 0x0000, 0x200000, CRC(289aa84f) SHA1(c9395750e20d5a201401699d156b62f00530fcdd), ROM_BIOS(6)) + ROM_SYSTEM_BIOS( 6, "v203", "V 2.03 - HW2" ) + ROMX_LOAD( "ti92pv203.rom", 0x0000, 0x200000, CRC(1612213e) SHA1(1715dd5913bed12baedc4912e9abe0cb4e48cd45), ROM_BIOS(7)) + ROM_SYSTEM_BIOS( 7, "v204", "V 2.04 - HW2" ) + ROMX_LOAD( "ti92pv204.rom", 0x0000, 0x200000, CRC(86819be3) SHA1(78032a0f5f11d1e9a45ffbea91e7f9657fd1a8ae), ROM_BIOS(8)) + ROM_SYSTEM_BIOS( 8, "v205", "V 2.05 - HW2" ) + ROMX_LOAD( "ti92pv205.rom", 0x0000, 0x200000, CRC(9509c575) SHA1(703410d8bb98b8ec14277efcd8b7dda45a7cf358), ROM_BIOS(9)) + ROM_SYSTEM_BIOS( 9, "v205m", "V 2.05 [m] - HW2" ) + ROMX_LOAD( "ti92pv205m.rom", 0x000000, 0x200000, CRC(13ef4d57) SHA1(6ef290bb0dda72f645cd3eca9cc1185f6a2d32dc), ROM_BIOS(10)) + ROM_SYSTEM_BIOS( 10, "v209", "V 2.09 - HW2" ) + ROMX_LOAD( "ti92pv209.rom", 0x000000, 0x200000, CRC(4851ad52) SHA1(10e6c2cdc60623bf0be7ea72a9ec840259fb37c3), ROM_BIOS(11)) +ROM_END + +ROM_START( v200 ) + ROM_REGION( 0x400000, "flash", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v209", "V 2.09" ) + ROMX_LOAD( "voyage200v209.rom", 0x0000, 0x400000, CRC(f805c7a6) SHA1(818b919058ba3bd7d15604f11fff6740010d07fc), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v310", "V 3.10" ) + ROMX_LOAD( "voyage200v310.rom", 0x0000, 0x400000, CRC(ed4cbfd2) SHA1(39cdb9932f314ff792b1cc5e3fe041d98b9fd101), ROM_BIOS(2)) +ROM_END + +ROM_START( ti89t ) + ROM_REGION( 0x400000, "flash", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v300", "V 3.00" ) + ROMX_LOAD( "ti89tv300.rom", 0x0000, 0x400000, CRC(55eb4f5a) SHA1(4f919d7752caf2559a79883ec8711a9701d19513), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "v310", "V 3.10" ) + ROMX_LOAD( "ti89tv310.rom", 0x0000, 0x400000, CRC(b6967cca) SHA1(fb4f09e5c4500dee651b8de537e502ab97cb8328), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1998, ti89, 0, 0, ti89, ti8x, driver_device, 0, "Texas Instruments", "TI-89", MACHINE_NO_SOUND) +COMP( 1995, ti92, 0, 0, ti92, ti9x, driver_device, 0, "Texas Instruments", "TI-92", MACHINE_NO_SOUND) +COMP( 1999, ti92p, 0, 0, ti92p, ti9x, driver_device, 0, "Texas Instruments", "TI-92 Plus", MACHINE_NO_SOUND) +COMP( 2002, v200, 0, 0, v200, ti9x, driver_device, 0, "Texas Instruments", "Voyage 200 PLT",MACHINE_NO_SOUND) +COMP( 2004, ti89t, 0, 0, ti89t, ti8x, driver_device, 0, "Texas Instruments", "TI-89 Titanium",MACHINE_NO_SOUND) diff --git a/src/mame/drivers/ti990_10.c b/src/mame/drivers/ti990_10.c new file mode 100644 index 00000000000..21c0fe33010 --- /dev/null +++ b/src/mame/drivers/ti990_10.c @@ -0,0 +1,389 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + TI990/10 driver + + This driver boots the DX10 build tape and build a bootable system disk. + I have been able to run a few programs (including most games from the + "fun and games" tape), but I have been unable to perform system generation + and install BASIC/COBOL/PASCAL. + +TODO : +* programmer panel +* emulate TILINE fully: timings, tiline timeout, possibly memory error +* finish tape emulation (write support) +* add additional devices as need appears (931 VDT, FD800, card reader, ASR/KSR, printer) +* emulate 990/10A and 990/12 CPUs? +* find out why the computer locks when executing ALGS and BASIC/COBOL/PASCAL installation +*/ + +/* + CRU map: + + 990/10 CPU board: + 1fa0-1fbe: map file CRU interface + 1fc0-1fde: error interrupt register + 1fe0-1ffe: control panel + + optional hardware (default configuration): + 0000-001e: 733 ASR + 0020-003e: PROM programmer + 0040-005e: card reader + 0060-007e: line printer + 0080-00be: FD800 floppy disc + 00c0-00ee: 913 VDT, or 911 VDT + 0100-013e: 913 VDT #2, or 911 VDT + 0140-017e: 913 VDT #3, or 911 VDT + 1700-177e (0b00-0b7e, 0f00-0f7e): CI402 serial controller #0 (#1, #2) (for 931/940 VDT) + (note that CRU base 1700 is used by the integrated serial controller in newer S300, + S300A, 990/10A (and 990/5?) systems) + 1f00-1f1e: CRU expander #1 interrupt register + 1f20-1f3e: CRU expander #2 interrupt register + 1f40-1f5e: TILINE coupler interrupt control #1-8 + + + TPCS map: + 1ff800: disk controller #1 (system disk) + 1ff810->1ff870: extra disk controllers #2 through #8 + 1ff880 (1ff890): tape controller #1 (#2) + 1ff900->1ff950: communication controllers #1 through #6 + 1ff980 (1ff990, 1ff9A0): CI403/404 serial controller #1 (#2, #3) (for 931/940 VDT) + 1ffb00, 1ffb04, etc: ECC memory controller #1, #2, etc, diagnostic + 1ffb10, 1ffb14, etc: cache memory controller #1, #2, etc, diagnostic + + + interrupt map (default configuration): + 0,1,2: CPU board + 3: free + 4: card reader + 5: line clock + 6: 733 ASR/KSR + 7: FD800 floppy (or FD1000 floppy) + 8: free + 9: 913 VDT #3 + 10: 913 VDT #2 + 11: 913 VDT + 12: free + 13: hard disk + 14 line printer + 15: PROM programmer (actually not used) +*/ + +#include "emu.h" + +#include "cpu/tms9900/ti990_10.h" +#include "sound/beep.h" +#include "bus/ti99x/990_hd.h" +#include "bus/ti99x/990_tap.h" +#include "video/911_vdt.h" + + +class ti990_10_state : public driver_device +{ +public: + ti990_10_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_intlines(0), + m_ckon_state(0) { } + + device_t *m_terminal; + DECLARE_DRIVER_INIT(ti990_10); + virtual void machine_reset(); + virtual void video_start(); + + DECLARE_WRITE_LINE_MEMBER( key_interrupt ); + DECLARE_WRITE_LINE_MEMBER( line_interrupt ); + DECLARE_WRITE_LINE_MEMBER( tape_interrupt ); + void ti990_set_int_line(int line, int state); + WRITE_LINE_MEMBER(ti990_set_int13); + TIMER_CALLBACK_MEMBER(clear_load); + void ti990_hold_load(); + WRITE_LINE_MEMBER(ti990_ckon_ckof_callback); + READ8_MEMBER( ti990_panel_read ); + WRITE8_MEMBER( ti990_panel_write ); + + required_device m_maincpu; + UINT16 m_intlines; + int m_ckon_state; +}; + + +/* + Interrupt priority encoder. Actually part of the CPU board. +*/ + +void ti990_10_state::ti990_set_int_line(int line, int state) +{ + int level; + + + if (state) + m_intlines |= (1 << line); + else + m_intlines &= ~ (1 << line); + + if (m_intlines) + { + for (level = 0; ! (m_intlines & (1 << level)); level++) + ; + m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, level); /* interrupt it, baby */ + } + else + m_maincpu->set_input_line(0, CLEAR_LINE); +} + + +WRITE_LINE_MEMBER(ti990_10_state::ti990_set_int13) +{ + ti990_set_int_line(13, state); +} + +/* + hold and debounce load line (emulation is inaccurate) +*/ + +TIMER_CALLBACK_MEMBER(ti990_10_state::clear_load) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); +} + +void ti990_10_state::ti990_hold_load() +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(ti990_10_state::clear_load),this)); +} + +/* + line interrupt +*/ + +/* m_ckon_state: 1 if line clock active (RTCLR flip-flop on TI990/10 schematics - +SMI sheet 4) */ +WRITE_LINE_MEMBER(ti990_10_state::line_interrupt) +{ + // set_int10(state); + if (m_ckon_state) + ti990_set_int_line(5, 1); +} + +WRITE_LINE_MEMBER(ti990_10_state::ti990_ckon_ckof_callback) +{ + m_ckon_state = state; + if (! m_ckon_state) + ti990_set_int_line(5, 0); +} + + + +/* + Control panel emulation + + three panel types + * operator panel + * programmer panel + * MDU (external unit connected instead of the control panel, as seen in + 945401-9701 p. 2-5 though 2-15) + + Operator panel: + * Power led + * Fault led + * Off/On/Load switch + + Programmer panel: + * 16 status light, 32 switches, IDLE, RUN leds + * interface to a low-level debugger in ROMs + + * MDU: + * includes a programmer panel, a tape unit, and a few parts + (diagnostic tape, diagnostic ROMs, etc.) + + CRU output: + 0-7: lights 0-7 + 8: increment scan + 9: clear scan (according to 990 handbook) + A: run light (additionally sets all data LEDs to 1s, the scan count to 0b10 and enables the HALT/SIE switch) + B: fault light + C: Memory Error Interrupt clear + D: Start panel timer + E: Set SIE function (interrupt after 2 instructions are executed) + F: flag (according to 990 handbook) + + input : + 0-7: switches 0-7 (or data from MDU tape) + 8: scan count bit 1 + 9: scan count bit 0 + A: timer active + B: programmer panel not present or locked + C: char in MDU tape unit buffer? + D: unused? + E: if 0, MDU unit present + F: flag (according to 990 handbook) +*/ + +READ8_MEMBER( ti990_10_state::ti990_panel_read ) +{ + if (offset == 1) + return 0x48; + + return 0; +} + +WRITE8_MEMBER( ti990_10_state::ti990_panel_write ) +{ +} + + +void ti990_10_state::machine_reset() +{ + ti990_hold_load(); +} + +/* +void ti990_10_state::rset_callback) +{ + ti990_cpuboard_reset(); + + // clear controller panel and smi fault LEDs +} + +void ti990_10_state::lrex_callback) +{ + // right??? + ti990_hold_load(); +} +*/ + +/* + TI990/10 video emulation. + + We emulate a single VDT911 CRT terminal. +*/ + +void ti990_10_state::video_start() +{ + m_terminal = machine().device("vdt911"); +} + +WRITE_LINE_MEMBER(ti990_10_state::key_interrupt) +{ + // set_int10(state); +} + +/* + Memory map - see description above +*/ + +static ADDRESS_MAP_START(ti990_10_memmap, AS_PROGRAM, 16, ti990_10_state ) + + AM_RANGE(0x000000, 0x0fffff) AM_RAM /* let's say we have 1MB of RAM */ + AM_RANGE(0x100000, 0x1ff7ff) AM_NOP /* free TILINE space */ + AM_RANGE(0x1ff800, 0x1ff81f) AM_DEVREADWRITE("hdc", ti990_hdc_device, read, write) /* disk controller TPCS */ + AM_RANGE(0x1ff820, 0x1ff87f) AM_NOP /* free TPCS */ + AM_RANGE(0x1ff880, 0x1ff89f) AM_DEVREADWRITE("tpc", tap_990_device, read, write) /* tape controller TPCS */ + AM_RANGE(0x1ff8a0, 0x1ffbff) AM_NOP /* free TPCS */ + AM_RANGE(0x1ffc00, 0x1fffff) AM_ROM /* LOAD ROM */ + +ADDRESS_MAP_END + + +/* + CRU map +*/ + +static ADDRESS_MAP_START(ti990_10_io, AS_IO, 8, ti990_10_state ) + AM_RANGE(0x10, 0x11) AM_DEVREAD("vdt911", vdt911_device, cru_r) + AM_RANGE(0x80, 0x8f) AM_DEVWRITE("vdt911", vdt911_device, cru_w) + AM_RANGE(0x1fa, 0x1fb) AM_NOP // AM_READ(ti990_10_mapper_cru_r) + AM_RANGE(0x1fc, 0x1fd) AM_NOP // AM_READ(ti990_10_eir_cru_r) + AM_RANGE(0x1fe, 0x1ff) AM_READ(ti990_panel_read) + AM_RANGE(0xfd0, 0xfdf) AM_NOP // AM_WRITE(ti990_10_mapper_cru_w) + AM_RANGE(0xfe0, 0xfef) AM_NOP // AM_WRITE(ti990_10_eir_cru_w) + AM_RANGE(0xff0, 0xfff) AM_WRITE(ti990_panel_write) + +ADDRESS_MAP_END + +/* + Callback from the tape controller. +*/ +WRITE_LINE_MEMBER(ti990_10_state::tape_interrupt) +{ + // set_int9(state); +} + +static MACHINE_CONFIG_START( ti990_10, ti990_10_state ) + /* basic machine hardware */ + /* TI990/10 CPU @ 4.0(???) MHz */ + MCFG_TMS99xx_ADD("maincpu", TI990_10, 4000000, ti990_10_memmap, ti990_10_io ) + + // VDT 911 terminal + MCFG_DEVICE_ADD("vdt911", VDT911, 0) + MCFG_VDT911_KEYINT_HANDLER(WRITELINE(ti990_10_state, key_interrupt)) + MCFG_VDT911_LINEINT_HANDLER(WRITELINE(ti990_10_state, line_interrupt)) + + // Hard disk + MCFG_DEVICE_ADD("hdc", TI990_HDC, 0) + MCFG_TI990_HDC_INT_CALLBACK(WRITELINE(ti990_10_state, ti990_set_int13)) + + // Tape controller + MCFG_DEVICE_ADD("tpc", TI990_TAPE_CTRL, 0) + MCFG_TI990_TAPE_INT_HANDLER(WRITELINE(ti990_10_state, tape_interrupt)) +MACHINE_CONFIG_END + + +/* + ROM loading +*/ +ROM_START(ti990_10) + + /*CPU memory space*/ +#if 0 + + ROM_REGION16_BE(0x200000, "maincpu",0) + + /* TI990/10 : older boot ROMs for floppy-disk */ + ROM_LOAD16_BYTE("975383.31", 0x1FFC00, 0x100, CRC(64fcd040)) + ROM_LOAD16_BYTE("975383.32", 0x1FFC01, 0x100, CRC(64277276)) + ROM_LOAD16_BYTE("975383.29", 0x1FFE00, 0x100, CRC(af92e7bf)) + ROM_LOAD16_BYTE("975383.30", 0x1FFE01, 0x100, CRC(b7b40cdc)) + +#elif 1 + + ROM_REGION16_BE(0x200000, "maincpu",0) + + /* TI990/10 : newer "universal" boot ROMs */ + ROM_LOAD16_BYTE("975383.45", 0x1FFC00, 0x100, CRC(391943c7) SHA1(bbd4da60b221d146542a6b547ae1570024e41b8a)) + ROM_LOAD16_BYTE("975383.46", 0x1FFC01, 0x100, CRC(f40f7c18) SHA1(03613bbf2263a4335c25dfc63cf2878c06bfe280)) + ROM_LOAD16_BYTE("975383.47", 0x1FFE00, 0x100, CRC(1ba571d8) SHA1(adaa18f149b643cc842fea8d7107ee868d6ffaf4)) + ROM_LOAD16_BYTE("975383.48", 0x1FFE01, 0x100, CRC(8852b09e) SHA1(f0df2abb438716832c16ab111e475da3ae612673)) + +#else + + ROM_REGION16_BE(0x202000, "maincpu",0) + + /* TI990/12 ROMs - actually incompatible with TI990/10, but I just wanted to disassemble them. */ + ROM_LOAD16_BYTE("ti2025-7", 0x1FFC00, 0x1000, CRC(4824f89c)) + ROM_LOAD16_BYTE("ti2025-8", 0x1FFC01, 0x1000, CRC(51fef543)) + /* the other half of this ROM is not loaded - it makes no sense as TI990/12 machine code, as + it is microcode... */ + +#endif + + + /* VDT911 character definitions */ + ROM_REGION(vdt911_chr_region_len, vdt911_chr_region, ROMREGION_ERASEFF) + +ROM_END + +DRIVER_INIT_MEMBER(ti990_10_state,ti990_10) +{ +#if 0 + /* load specific ti990/12 rom page */ + const int page = 3; + + memmove(memregion("maincpu")->base()+0x1FFC00, memregion("maincpu")->base()+0x1FFC00+(page*0x400), 0x400); +#endif +} + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1975, ti990_10, 0, 0, ti990_10, 0, ti990_10_state, ti990_10, "Texas Instruments", "TI Model 990/10 Minicomputer System" , MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/ti990_4.c b/src/mame/drivers/ti990_4.c new file mode 100644 index 00000000000..b18fe23ff34 --- /dev/null +++ b/src/mame/drivers/ti990_4.c @@ -0,0 +1,367 @@ +// license:LGPL-2.1+ +// copyright-holders:Michael Zapf +/* + ti990/4 driver + + We emulate a basic ti990/4 board, with a FD800 disk controller and an 733 + ASR terminal. A little floppy-based software for this computer is + available thanks to efforts by Dave Pitts: mostly, Forth and TX990. + + + Board setup options: + 8kb of DRAM (onboard option, with optional parity): base 0x0000 or 0x2000 + 4 banks of 512 bytes of ROM or SRAM: base 0x0000, 0x0800, 0xF000 or 0xF800 + power-up vector: 0x0000 (level 0) or 0xFFFC (load) + optional memerr interrupt (level 2) + optional power fail interrupt (level 1) + optional real-time clock interrupt (level 5 or 7) + + + Setup for the emulated system: + 0x0000: 8kb on-board DRAM + 24kb extension RAM (total 32kb) + 0xF800: 512 bytes SRAM + 0xFA00: 512 bytes SRAM (or empty?) + 0xFC00: 512 bytes self-test ROM + 0xFE00: 512 bytes loader ROM + power-up vector: 0xFFFC (load) + + Note that only interrupt levels 3-7 are supported by the board (8-15 are not wired). + +TODO: +* finish ASR emulation +* programmer panel +* emulate other devices: card reader, printer + + Original implementation: Raphael Nabet + + Rewritten by Michael Zapf 2014 +*/ + +#include "emu.h" +#include "cpu/tms9900/tms9900.h" + +#include "video/911_vdt.h" +#include "sound/beep.h" +#include "video/733_asr.h" + +#include "bus/ti99x/990_dk.h" + + +class ti990_4_state : public driver_device +{ +public: + ti990_4_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_fd800(*this, "fd800") { } + + DECLARE_READ8_MEMBER( panel_read ); + DECLARE_WRITE8_MEMBER( panel_write ); + DECLARE_WRITE8_MEMBER( external_operation ); + DECLARE_READ8_MEMBER( interrupt_level ); + DECLARE_WRITE_LINE_MEMBER( fd_interrupt ); + DECLARE_WRITE_LINE_MEMBER( asrkey_interrupt ); + DECLARE_WRITE_LINE_MEMBER( vdtkey_interrupt ); + DECLARE_WRITE_LINE_MEMBER( line_interrupt ); + + DECLARE_DRIVER_INIT(ti990_4); + DECLARE_DRIVER_INIT(ti990_4v); + + DECLARE_MACHINE_RESET(ti990_4); + +private: + void hold_load(); + void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + int m_intlines; + int m_int_level; + emu_timer* m_nmi_timer; + void reset_int_lines(); + void set_int_line(int line, int state); + + bool m_ckon_state; + + // Connected devices + required_device m_maincpu; + required_device m_fd800; +}; + +enum +{ + NMI_TIMER_ID = 1 +}; + +void ti990_4_state::hold_load() +{ + m_maincpu->set_input_line(INT_9900_LOAD, ASSERT_LINE); + logerror("ti990_4: Triggering LOAD interrupt\n"); + m_nmi_timer->adjust(attotime::from_msec(100)); +} + +/* + LOAD interrupt trigger callback +*/ +void ti990_4_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_maincpu->set_input_line(INT_9900_LOAD, CLEAR_LINE); + logerror("ti990_4: Released LOAD interrupt\n"); +} + +READ8_MEMBER( ti990_4_state::panel_read ) +{ + if (offset == 1) + return 0x48; + + return 0; +} + +WRITE8_MEMBER( ti990_4_state::panel_write ) +{ + logerror("ti990_4: writing to panel @CRU %04x: %02x\n", offset<<1, data); +} + +void ti990_4_state::set_int_line(int line, int state) +{ + if (state) + m_intlines |= (1 << line); + else + m_intlines &= ~(1 << line); + + if (m_intlines != 0) + { + m_int_level = 0; + while ((m_intlines & (1 << m_int_level))==0) m_int_level++; + logerror("ti990_4: Setting int level to %x\n", m_int_level); + m_maincpu->set_input_line(INT_9900_INTREQ, ASSERT_LINE); + } + else + m_maincpu->set_input_line(INT_9900_INTREQ, CLEAR_LINE); +} + +void ti990_4_state::reset_int_lines() +{ + m_intlines = 0; +} + +/* + Callback from the floppy controller. +*/ +WRITE_LINE_MEMBER(ti990_4_state::fd_interrupt) +{ + set_int_line(7, state); +} + +/* + Connection to VDT +*/ +WRITE_LINE_MEMBER(ti990_4_state::vdtkey_interrupt) +{ + set_int_line(3, state); +} + +WRITE_LINE_MEMBER(ti990_4_state::line_interrupt) +{ + if (m_ckon_state) set_int_line(5, state); +} + +/* + Callback from the terminal. +*/ +WRITE_LINE_MEMBER(ti990_4_state::asrkey_interrupt) +{ + set_int_line(6, state); +} + +WRITE8_MEMBER( ti990_4_state::external_operation ) +{ + static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; + switch (offset) + { + case IDLE_OP: + return; + case RSET_OP: + m_ckon_state = false; + // clear controller panel and smi fault LEDs + break; + case CKON_OP: + m_ckon_state = true; + break; + case CKOF_OP: + m_ckon_state = false; + set_int_line(5, 0); + break; + case LREX_OP: + // TODO: Verify this + hold_load(); + break; + + default: + logerror("ti99_4x: External operation %s not implemented on TI-990/4 board\n", extop[offset]); + } +} + +READ8_MEMBER( ti990_4_state::interrupt_level ) +{ + return m_int_level; +} + +/* + Memory map - see description above +*/ + +static ADDRESS_MAP_START(memmap, AS_PROGRAM, 16, ti990_4_state ) + AM_RANGE(0x0000, 0x7fff) AM_RAM /* dynamic RAM */ + AM_RANGE(0x8000, 0xf7ff) AM_NOP /* reserved for expansion */ + AM_RANGE(0xf800, 0xfbff) AM_RAM /* static RAM? */ + AM_RANGE(0xfc00, 0xffff) AM_ROM /* LOAD ROM */ +ADDRESS_MAP_END + + +/* + CRU map + + 0x000-0xF7F: user devices + 0xF80-0xF9F: CRU interrupt + expansion control + 0xFA0-0xFAF: TILINE coupler interrupt control + 0xFB0-0xFCF: reserved + 0xFD0-0xFDF: memory mapping and memory protect + 0xFE0-0xFEF: internal interrupt control + 0xFF0-0xFFF: front panel + + Default user map: + 0x000-0x00f: 733 ASR (int 6) + 0x010-0x01f: PROM programmer (wired to int 15, unused) + 0x020-0x02f: 804 card reader (int 4) + 0x030-0x03f: line printer (wired to int 14, unused) + 0x040-0x05f: FD800 floppy controller (int 7) + 0x060-0x07f: VDT1 (int 3 - wired to int 11, unused) + 0x080-0x09f: VDT2, or CRU expansion (int ??? - wired to int 10, unused) + 0x0a0-0x0bf: VDT3 (int ??? - wired to int 9, unused) +*/ + +static ADDRESS_MAP_START(cru_map, AS_IO, 8, ti990_4_state ) + AM_RANGE(0x00, 0x01) AM_DEVREAD("asr733", asr733_device, cru_r) + AM_RANGE(0x00, 0x0f) AM_DEVWRITE("asr733", asr733_device, cru_w) + + AM_RANGE(0x08, 0x0b) AM_DEVREAD( "fd800", fd800_legacy_device, cru_r ) + AM_RANGE(0x40, 0x5f) AM_DEVWRITE( "fd800", fd800_legacy_device, cru_w ) + + AM_RANGE(0x1fe, 0x1ff) AM_READ( panel_read ) + AM_RANGE(0xff0, 0xfff) AM_WRITE( panel_write ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(cru_map_v, AS_IO, 8, ti990_4_state ) + AM_RANGE(0x10, 0x11) AM_DEVREAD("vdt911", vdt911_device, cru_r) + AM_RANGE(0x80, 0x8f) AM_DEVWRITE("vdt911", vdt911_device, cru_w) + + AM_RANGE(0x08, 0x0b) AM_DEVREAD( "fd800", fd800_legacy_device, cru_r ) + AM_RANGE(0x40, 0x5f) AM_DEVWRITE( "fd800", fd800_legacy_device, cru_w ) + + AM_RANGE(0x1fe, 0x1ff) AM_READ( panel_read ) + AM_RANGE(0xff0, 0xfff) AM_WRITE( panel_write ) +ADDRESS_MAP_END + + +/* static const floppy_interface ti990_4_floppy_interface = +{ + FLOPPY_STANDARD_8_DSSD, + LEGACY_FLOPPY_OPTIONS_NAME(fd800), + NULL +}; */ + +MACHINE_RESET_MEMBER(ti990_4_state,ti990_4) +{ + hold_load(); + reset_int_lines(); + m_ckon_state = false; + m_maincpu->set_ready(ASSERT_LINE); +} + +DRIVER_INIT_MEMBER(ti990_4_state, ti990_4) +{ + m_nmi_timer = timer_alloc(NMI_TIMER_ID); +} + +static MACHINE_CONFIG_START( ti990_4, ti990_4_state ) + /* basic machine hardware */ + /* TMS9900 CPU @ 3.0(???) MHz */ + MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) + MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti990_4_state, external_operation) ) + MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti990_4_state, interrupt_level) ) + + MCFG_MACHINE_RESET_OVERRIDE(ti990_4_state, ti990_4 ) + + // Terminal + MCFG_DEVICE_ADD("asr733", ASR733, 0) + MCFG_ASR733_KEYINT_HANDLER(WRITELINE(ti990_4_state, asrkey_interrupt)) + MCFG_ASR733_LINEINT_HANDLER(WRITELINE(ti990_4_state, line_interrupt)) + + // Floppy controller + MCFG_DEVICE_ADD("fd800", FD800, 0) + MCFG_FD800_INT_HANDLER(WRITELINE(ti990_4_state, fd_interrupt)) + +// MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(ti990_4_floppy_interface) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ti990_4v, ti990_4_state ) + /* basic machine hardware */ + /* TMS9900 CPU @ 3.0(???) MHz */ + MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map_v) + MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti990_4_state, external_operation) ) + MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti990_4_state, interrupt_level) ) + MCFG_MACHINE_RESET_OVERRIDE(ti990_4_state, ti990_4 ) + + // Terminal + MCFG_DEVICE_ADD("vdt911", VDT911, 0) + MCFG_VDT911_KEYINT_HANDLER(WRITELINE(ti990_4_state, vdtkey_interrupt)) + MCFG_VDT911_LINEINT_HANDLER(WRITELINE(ti990_4_state, line_interrupt)) + + // Floppy controller + MCFG_DEVICE_ADD("fd800", FD800, 0) + MCFG_FD800_INT_HANDLER(WRITELINE(ti990_4_state, fd_interrupt)) + +// MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(ti990_4_floppy_interface) +MACHINE_CONFIG_END + +/* + ROM loading +*/ +ROM_START(ti990_4) + /*CPU memory space*/ + ROM_REGION16_BE(0x10000, "maincpu",0) + +#if 0 + /* ROM set 945121-5: "733 ASR ROM loader with self test (prototyping)" + (cf 945401-9701 pp. 1-19) */ + + /* test ROM */ + ROMX_LOAD("94519209.u39", 0xFC00, 0x100, CRC(0a0b0c42), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + ROMX_LOAD("94519210.u55", 0xFC00, 0x100, CRC(d078af61), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + ROMX_LOAD("94519211.u61", 0xFC01, 0x100, CRC(6cf7d4a0), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + ROMX_LOAD("94519212.u78", 0xFC01, 0x100, CRC(d9522458), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + + /* LOAD ROM */ + ROMX_LOAD("94519113.u3", 0xFE00, 0x100, CRC(8719b04e), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + ROMX_LOAD("94519114.u4", 0xFE00, 0x100, CRC(72a040e0), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + ROMX_LOAD("94519115.u6", 0xFE01, 0x100, CRC(9ccf8cca), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + ROMX_LOAD("94519116.u7", 0xFE01, 0x100, CRC(fa387bf3), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + +#else + /* ROM set 945121-4(?): "Floppy disc loader with self test" (cf 945401-9701 pp. 1-19) */ + ROM_LOAD16_WORD("ti9904.rom", 0xFC00, 0x400, CRC(691e7d19) SHA1(58d9bed80490fdf71c743bfd3077c70840b7df8c)) +#endif + + ROM_REGION(asr733_chr_region_len, asr733_chr_region, ROMREGION_ERASEFF) +ROM_END + +ROM_START(ti990_4v) + /*CPU memory space*/ + ROM_REGION16_BE(0x10000, "maincpu",0) + ROM_LOAD16_WORD("ti9904.rom", 0xFC00, 0x400, CRC(691e7d19) SHA1(58d9bed80490fdf71c743bfd3077c70840b7df8c)) + + /* VDT911 character definitions */ + ROM_REGION(vdt911_chr_region_len, vdt911_chr_region, ROMREGION_ERASEFF) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1976, ti990_4, 0, 0, ti990_4, 0, ti990_4_state, ti990_4, "Texas Instruments", "TI Model 990/4 Microcomputer System" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1976, ti990_4v, ti990_4, 0, ti990_4v, 0, ti990_4_state, ti990_4, "Texas Instruments", "TI Model 990/4 Microcomputer System with Video Display Terminal" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/ti99_2.c b/src/mame/drivers/ti99_2.c new file mode 100644 index 00000000000..993b657f29b --- /dev/null +++ b/src/mame/drivers/ti99_2.c @@ -0,0 +1,416 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + Experimental ti99/2 driver + +TODO : + * find a TI99/2 ROM dump (some TI99/2 ARE in private hands) + * test the driver ! + * understand the "viden" pin + * implement cassette + * implement Hex-Bus + + Raphael Nabet (who really has too much time to waste), december 1999, 2000 +*/ + +/* + TI99/2 facts : + +References : +* TI99/2 main logic board schematics, 83/03/28-30 (on ftp.whtech.com, or just ask me) + (Thanks to Charles Good for posting this) + +general : +* prototypes in 1983 +* uses a 10.7MHz TMS9995 CPU, with the following features : + - 8-bit data bus + - 256 bytes 16-bit RAM (0xff00-0xff0b & 0xfffc-0xffff) + - only available int lines are INT4 (used by vdp), INT1*, and NMI* (both free for extension) + - on-chip decrementer (0xfffa-0xfffb) + - Unlike tms9900, CRU address range is full 0x0000-0xFFFE (A0 is not used as address). + This is possible because tms9995 uses d0-d2 instead of the address MSBits to support external + opcodes. + - quite more efficient than tms9900, and a few additionnal instructions and features +* 24 or 32kb ROM (16kb plain (1kb of which used by vdp), 16kb split into 2 8kb pages) +* 4kb 8-bit RAM, 256 bytes 16-bit RAM +* custom vdp shares CPU RAM/ROM. The display is quite alike to tms9928 graphics mode, except + that colors are a static B&W, and no sprite is displayed. The config (particularily the + table base addresses) cannot be changed. Since TI located the pattern generator table in + ROM, we cannot even redefine the char patterns (unless you insert a custom cartidge which + overrides the system ROMs). VBL int triggers int4 on tms9995. +* CRU is handled by one single custom chip, so the schematics don't show many details :-( . +* I/O : + - 48-key keyboard. Same as TI99/4a, without alpha lock, and with an additional break key. + Note that the hardware can make the difference between the two shift keys. + - cassette I/O (one unit) + - ALC bus (must be another name for Hex-Bus) +* 60-pin expansion/cartidge port on the back + +memory map : +* 0x0000-0x4000 : system ROM (0x1C00-0x2000 (?) : char ROM used by vdp) +* 0x4000-0x6000 : system ROM, mapped to either of two distinct 8kb pages according to the S0 + bit from the keyboard interface (!), which is used to select the first key row. + [only on second-generation TI99/2 protos, first generation protos only had 24kb of ROM] +* 0x6000-0xE000 : free for expansion +* 0xE000-0xF000 : 8-bit "system" RAM (0xEC00-0xEF00 used by vdp) +* 0xF000-0xF0FB : 16-bit processor RAM (on tms9995) +* 0xF0FC-0xFFF9 : free for expansion +* 0xFFFA-0xFFFB : tms9995 internal decrementer +* 0xFFFC-0xFFFF : 16-bit processor RAM (provides the NMI vector) + +CRU map : +* 0x0000-0x1EFC : reserved +* 0x1EE0-0x1EFE : tms9995 flag register +* 0x1F00-0x1FD8 : reserved +* 0x1FDA : tms9995 MID flag +* 0x1FDC-0x1FFF : reserved +* 0x2000-0xE000 : unaffected +* 0xE400-0xE40E : keyboard I/O (8 bits input, either 3 or 6 bit output) +* 0xE80C : cassette I/O +* 0xE80A : ALC BAV +* 0xE808 : ALC HSK +* 0xE800-0xE808 : ALC data (I/O) +* 0xE80E : video enable (probably input - seems to come from the VDP, and is present on the + expansion connector) +* 0xF000-0xFFFE : reserved +Note that only A15-A11 and A3-A1 (A15 = MSB, A0 = LSB) are decoded in the console, so the keyboard +is actually mapped to 0xE000-0xE7FE, and other I/O bits to 0xE800-0xEFFE. +Also, ti99/2 does not support external instructions better than ti99/4(a). This is crazy, it +would just have taken three extra tracks on the main board and a OR gate in an ASIC. +*/ + +#include "emu.h" +#include "machine/tms9901.h" +#include "cpu/tms9900/tms9995.h" + +class ti99_2_state : public driver_device +{ +public: + ti99_2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + required_shared_ptr m_videoram; + int m_ROM_paged; + int m_irq_state; + int m_KeyRow; + DECLARE_WRITE8_MEMBER(ti99_2_write_kbd); + DECLARE_WRITE8_MEMBER(ti99_2_write_misc_cru); + DECLARE_READ8_MEMBER(ti99_2_read_kbd); + DECLARE_READ8_MEMBER(ti99_2_read_misc_cru); + DECLARE_DRIVER_INIT(ti99_2_24); + DECLARE_DRIVER_INIT(ti99_2_32); + virtual void machine_reset(); + UINT32 screen_update_ti99_2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(ti99_2_vblank_interrupt); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; +}; + + + +DRIVER_INIT_MEMBER(ti99_2_state,ti99_2_24) +{ + /* no ROM paging */ + m_ROM_paged = 0; +} + +DRIVER_INIT_MEMBER(ti99_2_state,ti99_2_32) +{ + /* ROM paging enabled */ + m_ROM_paged = 1; +} + +#define TI99_2_32_ROMPAGE0 (memregion("maincpu")->base()+0x4000) +#define TI99_2_32_ROMPAGE1 (memregion("maincpu")->base()+0x10000) + +void ti99_2_state::machine_reset() +{ + m_irq_state = ASSERT_LINE; + if (! m_ROM_paged) + membank("bank1")->set_base(memregion("maincpu")->base()+0x4000); + else + membank("bank1")->set_base((memregion("maincpu")->base()+0x4000)); + + // Configure CPU to insert 1 wait state for each external memory access + // by lowering the READY line on reset + // TODO: Check with specs + static_cast(machine().device("maincpu"))->set_ready(CLEAR_LINE); +} + +INTERRUPT_GEN_MEMBER(ti99_2_state::ti99_2_vblank_interrupt) +{ + m_maincpu->set_input_line(INT_9995_INT1, m_irq_state); + m_irq_state = (m_irq_state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE; +} + + +/* + TI99/2 vdp emulation. + + Things could not be simpler. + We display 24 rows and 32 columns of characters. Each 8*8 pixel character pattern is defined + in a 128-entry table located in ROM. Character code for each screen position are stored + sequentially in RAM. Colors are a fixed Black on White. + + There is an EOL character that blanks the end of the current line, so that + the CPU can get more bus time. +*/ + + + +UINT32 ti99_2_state::screen_update_ti99_2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_videoram; + int i, sx, sy; + + + sx = sy = 0; + + for (i = 0; i < 768; i++) + { + /* Is the char code masked or not ??? */ + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, videoram[i] & 0x7F, 0, + 0, 0, sx, sy); + + sx += 8; + if (sx == 256) + { + sx = 0; + sy += 8; + } + } + + return 0; +} + +static const gfx_layout ti99_2_charlayout = +{ + 8,8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + /* x offsets */ + { 0,1,2,3,4,5,6,7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( ti99_2 ) + GFXDECODE_ENTRY( "maincpu", 0x1c00, ti99_2_charlayout, 0, 1 ) +GFXDECODE_END + + +/* + Memory map - see description above +*/ + +static ADDRESS_MAP_START( ti99_2_memmap, AS_PROGRAM, 8, ti99_2_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM /* system ROM */ + AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1") /* system ROM, banked on 32kb ROMs protos */ + AM_RANGE(0x6000, 0xdfff) AM_NOP /* free for expansion */ + AM_RANGE(0xe000, 0xebff) AM_RAM /* system RAM */ + AM_RANGE(0xec00, 0xeeff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0xef00, 0xefff) AM_RAM /* system RAM */ + AM_RANGE(0xf000, 0xffff) AM_NOP /* free for expansion (and internal processor RAM) */ +ADDRESS_MAP_END + + +/* + CRU map - see description above +*/ + +/* current keyboard row */ + +/* write the current keyboard row */ +WRITE8_MEMBER(ti99_2_state::ti99_2_write_kbd) +{ + offset &= 0x7; /* other address lines are not decoded */ + + if (offset <= 2) + { + /* this implementation is just a guess */ + if (data) + m_KeyRow |= 1 << offset; + else + m_KeyRow &= ~ (1 << offset); + } + /* now, we handle ROM paging */ + if (m_ROM_paged) + { /* if we have paged ROMs, page according to S0 keyboard interface line */ + membank("bank1")->set_base((m_KeyRow == 0) ? TI99_2_32_ROMPAGE1 : TI99_2_32_ROMPAGE0); + } +} + +WRITE8_MEMBER(ti99_2_state::ti99_2_write_misc_cru) +{ + offset &= 0x7; /* other address lines are not decoded */ + + switch (offset) + { + case 0: + case 1: + case 2: + case 3: + /* ALC I/O */ + break; + case 4: + /* ALC HSK */ + break; + case 5: + /* ALC BAV */ + break; + case 6: + /* cassette output */ + break; + case 7: + /* video enable */ + break; + } +} + +/* read keys in the current row */ +READ8_MEMBER(ti99_2_state::ti99_2_read_kbd) +{ + static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; + + return ioport(keynames[m_KeyRow])->read(); +} + +READ8_MEMBER(ti99_2_state::ti99_2_read_misc_cru) +{ + return 0; +} + +static ADDRESS_MAP_START(ti99_2_io, AS_IO, 8, ti99_2_state ) + AM_RANGE(0x0E00, 0x0E7f) AM_READ(ti99_2_read_kbd) + AM_RANGE(0x0E80, 0x0Eff) AM_READ(ti99_2_read_misc_cru) + AM_RANGE(0x7000, 0x73ff) AM_WRITE(ti99_2_write_kbd) + AM_RANGE(0x7400, 0x77ff) AM_WRITE(ti99_2_write_misc_cru) +ADDRESS_MAP_END + + +/* ti99/2 : 54-key keyboard */ +static INPUT_PORTS_START(ti99_2) + + PORT_START("LINE0") /* col 0 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! DEL") PORT_CODE(KEYCODE_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @ INS") PORT_CODE(KEYCODE_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLEAR") PORT_CODE(KEYCODE_4) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % BEGIN") PORT_CODE(KEYCODE_5) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^ PROC'D") PORT_CODE(KEYCODE_6) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 & AID") PORT_CODE(KEYCODE_7) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 * REDO") PORT_CODE(KEYCODE_8) + + PORT_START("LINE1") /* col 1 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w W ~") PORT_CODE(KEYCODE_W) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e E (UP)") PORT_CODE(KEYCODE_E) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r R [") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t T ]") PORT_CODE(KEYCODE_T) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i I ?") PORT_CODE(KEYCODE_I) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ( BACK") PORT_CODE(KEYCODE_9) + + PORT_START("LINE2") /* col 2 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s S (LEFT)") PORT_CODE(KEYCODE_S) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d D (RIGHT)") PORT_CODE(KEYCODE_D) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f F {") PORT_CODE(KEYCODE_F) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u U _") PORT_CODE(KEYCODE_U) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o O '") PORT_CODE(KEYCODE_O) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) + + PORT_START("LINE3") /* col 3 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z Z \\") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x X (DOWN)") PORT_CODE(KEYCODE_X) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c C `") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g G }") PORT_CODE(KEYCODE_G) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p P \"") PORT_CODE(KEYCODE_P) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= + QUIT") PORT_CODE(KEYCODE_EQUALS) + + PORT_START("LINE4") /* col 4 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT/*KEYCODE_CAPSLOCK*/) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ -") PORT_CODE(KEYCODE_SLASH) + + PORT_START("LINE5") /* col 5 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(SPACE)") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCTN") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + + PORT_START("LINE6") /* col 6 */ + PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE7") /* col 7 */ + PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) + +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ti99_2, ti99_2_state ) + // basic machine hardware + // TMS9995, standard variant + // We have no lines connected yet + MCFG_TMS99xx_ADD("maincpu", TMS9995, 10700000, ti99_2_memmap, ti99_2_io) + + MCFG_CPU_VBLANK_INT_DRIVER("screen", ti99_2_state, ti99_2_vblank_interrupt) + + /* video hardware */ + /*MCFG_TMS9928A( &tms9918_interface )*/ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 192) + MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 192-1) + MCFG_SCREEN_UPDATE_DRIVER(ti99_2_state, screen_update_ti99_2) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ti99_2) + MCFG_PALETTE_ADD_WHITE_AND_BLACK("palette") +MACHINE_CONFIG_END + + + +/* + ROM loading +*/ +ROM_START(ti99_224) + /*CPU memory space*/ + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("992rom.bin", 0x0000, 0x6000, NO_DUMP) /* system ROMs */ +ROM_END + +ROM_START(ti99_232) + /*64kb CPU memory space + 8kb to read the extra ROM page*/ + ROM_REGION(0x12000,"maincpu",0) + ROM_LOAD("992rom32.bin", 0x0000, 0x6000, NO_DUMP) /* system ROM - 32kb */ + ROM_CONTINUE(0x10000,0x2000) +ROM_END + +/* one expansion/cartridge port on the back */ +/* one cassette unit port */ +/* Hex-bus disk controller: supports up to 4 floppy disk drives */ +/* None of these is supported (tape should be easy to emulate) */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1983, ti99_224, 0, 0, ti99_2, ti99_2, ti99_2_state, ti99_2_24, "Texas Instruments", "TI-99/2 BASIC Computer (24kb ROMs)" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1983, ti99_232, ti99_224, 0, ti99_2, ti99_2, ti99_2_state, ti99_2_32, "Texas Instruments", "TI-99/2 BASIC Computer (32kb ROMs)" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/ti99_4p.c b/src/mame/drivers/ti99_4p.c new file mode 100644 index 00000000000..7122ab40a05 --- /dev/null +++ b/src/mame/drivers/ti99_4p.c @@ -0,0 +1,914 @@ +// license:LGPL-2.1+ +// copyright-holders:Michael Zapf +/**************************************************************************** + + SNUG SGCPU (a.k.a. 99/4p) system + + This system is a reimplementation of the old ti99/4a console. It is known + both as the 99/4p ("peripheral box", since the system is a card to be + inserted in the peripheral box, instead of a self contained console), and + as the SGCPU ("Second Generation CPU", which was originally the name used + in TI documentation to refer to either (or both) TI99/5 and TI99/8 + projects). + + The SGCPU was designed and built by the SNUG (System 99 Users Group), + namely by Michael Becker for the hardware part and Harald Glaab for the + software part. It has no relationship with TI. + + The card is architectured around a 16-bit bus (vs. an 8-bit bus in every + other TI99 system). It includes 64kb of ROM, including a GPL interpreter, + an internal DSR ROM which contains system-specific code, part of the TI + extended Basic interpreter, and up to 1Mbyte of RAM. It still includes a + 16-bit to 8-bit multiplexer in order to support extension cards designed + for TI99/4a, but it can support 16-bit cards, too. It does not include + GROMs, video or sound: instead, it relies on the HSGPL and EVPC cards to + do the job. + + IMPORTANT: The SGCPU card relies on a properly set up HSGPL flash memory + card; without, it will immediately lock up. It is impossible to set it up + from here (a bootstrap problem; you cannot start without the HSGPL). + The best chance is to start a ti99_4ev with a plugged-in HSGPL + and go through the setup process there. Copy the nvram files of the hsgpl into this + driver's nvram subdirectory. The contents will be directly usable for the SGCPU. + + Michael Zapf + + February 2012: Rewritten as class + +*****************************************************************************/ + +#include "emu.h" +#include "cpu/tms9900/tms9900.h" +#include "sound/wave.h" +#include "sound/dac.h" + +#include "machine/tms9901.h" +#include "imagedev/cassette.h" + +#include "bus/ti99x/videowrp.h" +#include "bus/ti99x/joyport.h" + +#include "bus/ti99_peb/peribox.h" + +#define TMS9901_TAG "tms9901" +#define SGCPU_TAG "sgcpu" + +#define VERBOSE 1 +#define LOG logerror + +class ti99_4p_state : public driver_device +{ +public: + ti99_4p_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cpu(*this, "maincpu"), + m_tms9901(*this, TMS9901_TAG), + m_sound(*this, TISOUND_TAG), + m_video(*this, VIDEO_SYSTEM_TAG), + m_cassette(*this, "cassette"), + m_peribox(*this, PERIBOX_TAG), + m_joyport(*this, JOYPORT_TAG) { } + + DECLARE_WRITE_LINE_MEMBER( console_ready ); + DECLARE_WRITE_LINE_MEMBER( console_ready_dmux ); + + DECLARE_WRITE_LINE_MEMBER( extint ); + DECLARE_WRITE_LINE_MEMBER( notconnected ); + DECLARE_READ8_MEMBER( interrupt_level ); + DECLARE_READ16_MEMBER( memread ); + DECLARE_WRITE16_MEMBER( memwrite ); + + DECLARE_READ16_MEMBER( samsmem_read ); + DECLARE_WRITE16_MEMBER( samsmem_write ); + + DECLARE_WRITE8_MEMBER(external_operation); + DECLARE_WRITE_LINE_MEMBER( clock_out ); + + void clock_in(int clock); + + // CRU (Communication Register Unit) handling + DECLARE_READ8_MEMBER( cruread ); + DECLARE_WRITE8_MEMBER( cruwrite ); + DECLARE_READ8_MEMBER( read_by_9901 ); + DECLARE_WRITE_LINE_MEMBER(keyC0); + DECLARE_WRITE_LINE_MEMBER(keyC1); + DECLARE_WRITE_LINE_MEMBER(keyC2); + DECLARE_WRITE_LINE_MEMBER(cs_motor); + DECLARE_WRITE_LINE_MEMBER(audio_gate); + DECLARE_WRITE_LINE_MEMBER(cassette_output); + DECLARE_WRITE8_MEMBER(tms9901_interrupt); + DECLARE_WRITE_LINE_MEMBER(handset_ack); + DECLARE_WRITE_LINE_MEMBER(alphaW); + virtual void machine_start(); + DECLARE_MACHINE_RESET(ti99_4p); + + DECLARE_WRITE_LINE_MEMBER(set_tms9901_INT2_from_v9938); + + required_device m_cpu; + required_device m_tms9901; + required_device m_sound; + required_device m_video; + required_device m_cassette; + required_device m_peribox; + required_device m_joyport; + + // Pointer to ROM0 + UINT16 *m_rom0; + + // Pointer to DSR ROM + UINT16 *m_dsr; + + // Pointer to ROM6, first bank + UINT16 *m_rom6a; + + // Pointer to ROM6, second bank + UINT16 *m_rom6b; + + // AMS RAM (1 Mib) + std::vector m_ram; + + // Scratch pad ram (1 KiB) + std::vector m_scratchpad; + + // First joystick. 6 for TI-99/4A + int m_firstjoy; + + // READY line + int m_ready_line, m_ready_line_dmux; + +private: + DECLARE_READ16_MEMBER( datamux_read ); + DECLARE_WRITE16_MEMBER( datamux_write ); + void set_keyboard_column(int number, int data); + + int m_keyboard_column; + int m_check_alphalock; + + // True if SGCPU DSR is enabled + bool m_internal_dsr; + + // True if SGCPU rom6 is enabled + bool m_internal_rom6; + + // Offset to the ROM6 bank. + int m_rom6_bank; + + // Wait states + int m_waitcount; + + // TRUE when mapper is active + bool m_map_mode; + + // TRUE when mapper registers are accessible + bool m_access_mapper; + + UINT8 m_lowbyte; + UINT8 m_highbyte; + UINT8 m_latch; + + // Mapper registers + UINT8 m_mapper[16]; + + // Latch for 9901 INT2, INT1 lines + int m_9901_int; + void set_9901_int(int line, line_state state); + + int m_ready_prev; // for debugging purposes only + +}; + +static ADDRESS_MAP_START(memmap, AS_PROGRAM, 16, ti99_4p_state) + AM_RANGE(0x0000, 0xffff) AM_READWRITE( memread, memwrite ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(cru_map, AS_IO, 8, ti99_4p_state) + AM_RANGE(0x0000, 0x003f) AM_DEVREAD(TMS9901_TAG, tms9901_device, read) + AM_RANGE(0x0000, 0x01ff) AM_READ( cruread ) + + AM_RANGE(0x0000, 0x01ff) AM_DEVWRITE(TMS9901_TAG, tms9901_device, write) + AM_RANGE(0x0000, 0x0fff) AM_WRITE( cruwrite ) +ADDRESS_MAP_END + +/* + Input ports, used by machine code for TI keyboard and joystick emulation. + + Since the keyboard microcontroller is not emulated, we use the TI99/4a 48-key keyboard, + plus two optional joysticks. +*/ + +static INPUT_PORTS_START(ti99_4p) + /* 4 ports for keyboard and joystick */ + PORT_START("COL0") // col 0 + PORT_BIT(0x88, IP_ACTIVE_LOW, IPT_UNUSED) + /* The original control key is located on the left, but we accept the right control key as well */ + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + /* TI99/4a has a second shift key which maps the same */ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + /* The original function key is located on the right, but we accept the left alt key as well */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCTN") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= + QUIT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR(UCHAR_MAMEKEY(F12)) + + PORT_START("COL1") // col 1 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR('~') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ( BACK") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("COL2") // col 2 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('`') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # ERASE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 * REDO") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR('?') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("COL3") // col 3 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('[') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLEAR") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 & AID") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("COL4") // col 4 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(']') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % BEGIN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^ PROC'D") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("COL5") // col 5 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR('\\') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('\"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('-') + + PORT_START("ALPHA") /* one more port for Alpha line */ + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + + +INPUT_PORTS_END + +/* + Memory access +*/ +READ16_MEMBER( ti99_4p_state::memread ) +{ + int addroff = offset << 1; + if (m_rom0 == NULL) return 0; // premature access + + UINT16 zone = addroff & 0xe000; + UINT16 value = 0; + + if (zone==0x0000) + { + // ROM0 + value = m_rom0[(addroff & 0x1fff)>>1]; + return value; + } + if (zone==0x2000 || zone==0xa000 || zone==0xc000 || zone==0xe000) + { + value = samsmem_read(space, offset, mem_mask); + return value; + } + + if (zone==0x4000) + { + if (m_internal_dsr) + { + value = m_dsr[(addroff & 0x1fff)>>1]; + return value; + } + else + { + if (m_access_mapper && ((addroff & 0xffe0)==0x4000)) + { + value = m_mapper[offset & 0x000f]<<8; + return value; + } + } + } + + if (zone==0x6000 && m_internal_rom6) + { + if (m_rom6_bank==0) + value = m_rom6a[(addroff & 0x1fff)>>1]; + else + value = m_rom6b[(addroff & 0x1fff)>>1]; + + return value; + } + + // Scratch pad RAM and sound + // speech is in peribox + // groms are in hsgpl in peribox + if (zone==0x8000) + { + if ((addroff & 0xfff0)==0x8400) // cannot read from sound + { + value = 0; + return value; + } + if ((addroff & 0xfc00)==0x8000) + { + value = m_scratchpad[(addroff & 0x03ff)>>1]; + return value; + } + // Video: 8800, 8802 + if ((addroff & 0xfffd)==0x8800) + { + value = m_video->read16(space, offset, mem_mask); + return value; + } + } + + // If we are here, check the peribox via the datamux + // catch-all for unmapped zones + value = datamux_read(space, offset, mem_mask); + return value; +} + +WRITE16_MEMBER( ti99_4p_state::memwrite ) +{ +// m_cpu->adjust_icount(-4); + + int addroff = offset << 1; + UINT16 zone = addroff & 0xe000; + + if (zone==0x0000) + { + // ROM0 + if (VERBOSE>4) LOG("sgcpu: ignoring ROM write access at %04x\n", addroff); + return; + } + + if (zone==0x2000 || zone==0xa000 || zone==0xc000 || zone==0xe000) + { + samsmem_write(space, offset, data, mem_mask); + return; + } + + if (zone==0x4000) + { + if (m_internal_dsr) + { + if (VERBOSE>4) LOG("sgcpu: ignoring DSR write access at %04x\n", addroff); + return; + } + else + { + if (m_access_mapper && ((addroff & 0xffe0)==0x4000)) + { + m_mapper[offset & 0x000f] = data; + return; + } + } + } + + if (zone==0x6000 && m_internal_rom6) + { + m_rom6_bank = offset & 0x0001; + return; + } + + // Scratch pad RAM and sound + // speech is in peribox + // groms are in hsgpl in peribox + if (zone==0x8000) + { + if ((addroff & 0xfff0)==0x8400) //sound write + { + m_sound->write(space, 0, (data >> 8) & 0xff); + return; + } + if ((addroff & 0xfc00)==0x8000) + { + m_scratchpad[(addroff & 0x03ff)>>1] = data; + return; + } + // Video: 8C00, 8C02 + if ((addroff & 0xfffd)==0x8c00) + { + m_video->write16(space, offset, data, mem_mask); + return; + } + } + + // If we are here, check the peribox via the datamux + // catch-all for unmapped zones + datamux_write(space, offset, data, mem_mask); +} + +/*************************************************************************** + Internal datamux; similar to TI-99/4A. However, here we have just + one device, the peripheral box, so it is much simpler. +***************************************************************************/ + +/* + The datamux is connected to the clock line in order to operate + the wait state counter. +*/ +void ti99_4p_state::clock_in(int clock) +{ + if (clock==ASSERT_LINE && m_waitcount!=0) + { + m_waitcount--; + if (m_waitcount==0) console_ready_dmux(ASSERT_LINE); + } +} + + +READ16_MEMBER( ti99_4p_state::datamux_read ) +{ + UINT8 hbyte = 0; + UINT16 addroff = (offset << 1); + + m_peribox->readz(space, addroff+1, &m_latch, mem_mask); + m_lowbyte = m_latch; + + m_peribox->readz(space, addroff, &hbyte, mem_mask); + m_highbyte = hbyte; + + // use the latch and the currently read byte and put it on the 16bit bus +// printf("read address = %04x, value = %04x, memmask = %4x\n", addroff, (hbyte<<8) | sgcpu->latch, mem_mask); + + // Insert four wait states and let CPU enter wait state + m_waitcount = 6; + console_ready_dmux(CLEAR_LINE); + + return (hbyte<<8) | m_latch ; +} + +/* + Write access. + TODO: use the 16-bit expansion in the box for suitable cards +*/ +WRITE16_MEMBER( ti99_4p_state::datamux_write ) +{ + UINT16 addroff = (offset << 1); +// printf("write address = %04x, value = %04x, memmask = %4x\n", addroff, data, mem_mask); + + // read more about the datamux in datamux.c + + // Write to the PEB + m_peribox->write(space, addroff+1, data & 0xff); + + // Write to the PEB + m_peribox->write(space, addroff, (data>>8) & 0xff); + + // Insert four wait states and let CPU enter wait state + m_waitcount = 6; + console_ready_dmux(CLEAR_LINE); +} + +/*************************************************************************** + CRU interface +***************************************************************************/ + +#define MAP_CRU_BASE 0x0f00 +#define SAMS_CRU_BASE 0x1e00 + +/* + CRU write +*/ +WRITE8_MEMBER( ti99_4p_state::cruwrite ) +{ + int addroff = offset<<1; + + if ((addroff & 0xff00)==MAP_CRU_BASE) + { + if ((addroff & 0x000e)==0) m_internal_dsr = data; + if ((addroff & 0x000e)==2) m_internal_rom6 = data; + if ((addroff & 0x000e)==4) m_peribox->senila((data!=0)? ASSERT_LINE : CLEAR_LINE); + if ((addroff & 0x000e)==6) m_peribox->senilb((data!=0)? ASSERT_LINE : CLEAR_LINE); + // TODO: more CRU bits? 8=Fast timing / a=KBENA + return; + } + if ((addroff & 0xff00)==SAMS_CRU_BASE) + { + if ((addroff & 0x000e)==0) m_access_mapper = data; + if ((addroff & 0x000e)==2) m_map_mode = data; + return; + } + + // No match - pass to peribox + m_peribox->cruwrite(space, addroff, data); +} + +READ8_MEMBER( ti99_4p_state::cruread ) +{ + UINT8 value = 0; + m_peribox->crureadz(space, offset<<4, &value); + return value; +} + +/*************************************************************************** + AMS Memory implementation +***************************************************************************/ + +/* + Memory read. The SAMS card has two address areas: The memory is at locations + 0x2000-0x3fff and 0xa000-0xffff, and the mapper area is at 0x4000-0x401e + (only even addresses). +*/ +READ16_MEMBER( ti99_4p_state::samsmem_read ) +{ + UINT32 address = 0; + int addroff = offset << 1; + + // select memory expansion + if (m_map_mode) + address = (m_mapper[(addroff>>12) & 0x000f] << 12) + (addroff & 0x0fff); + else // transparent mode + address = addroff; + + return m_ram[address>>1]; +} + +/* + Memory write +*/ +WRITE16_MEMBER( ti99_4p_state::samsmem_write ) +{ + UINT32 address = 0; + int addroff = offset << 1; + + // select memory expansion + if (m_map_mode) + address = (m_mapper[(addroff>>12) & 0x000f] << 12) + (addroff & 0x0fff); + else // transparent mode + address = addroff; + + m_ram[address>>1] = data; +} + +/*************************************************************************** + Keyboard/tape control +****************************************************************************/ +static const char *const column[] = { "COL0", "COL1", "COL2", "COL3", "COL4", "COL5" }; + +READ8_MEMBER( ti99_4p_state::read_by_9901 ) +{ + int answer=0; + + switch (offset & 0x03) + { + case TMS9901_CB_INT7: + // Read pins INT3*-INT7* of TI99's 9901. + // bit 1: INT1 status + // bit 2: INT2 status + // bit 3-7: keyboard status bits 0 to 4 + // + // |K|K|K|K|K|I2|I1|C| + // + if (m_keyboard_column >= m_firstjoy) // joy 1 and 2 + { + answer = m_joyport->read_port(); + } + else + { + answer = ioport(column[m_keyboard_column])->read(); + } + if (m_check_alphalock) + { + answer &= ~(ioport("ALPHA")->read()); + } + answer = (answer << 3) | m_9901_int; + break; + + case TMS9901_INT8_INT15: + // Read pins INT8*-INT15* of TI99's 9901. + // bit 0-2: keyboard status bits 5 to 7 + // bit 3: tape input mirror + // bit 5-7: weird, not emulated + + // |1|1|1|1|0|K|K|K| + if (m_keyboard_column >= m_firstjoy) answer = 0x07; + else answer = ((ioport(column[m_keyboard_column])->read())>>5) & 0x07; + answer |= 0xf0; + break; + + case TMS9901_P0_P7: + break; + + case TMS9901_P8_P15: + // Read pins P8-P15 of TI99's 9901. + // bit 26: high + // bit 27: tape input + answer = 4; + if (m_cassette->input() > 0) answer |= 8; + break; + } + return answer; +} + +/* + WRITE key column select (P2-P4) +*/ +void ti99_4p_state::set_keyboard_column(int number, int data) +{ + if (data!=0) m_keyboard_column |= 1 << number; + else m_keyboard_column &= ~(1 << number); + + if (m_keyboard_column >= m_firstjoy) + { + m_joyport->write_port(m_keyboard_column - m_firstjoy + 1); + } +} + +WRITE_LINE_MEMBER( ti99_4p_state::keyC0 ) +{ + set_keyboard_column(0, state); +} + +WRITE_LINE_MEMBER( ti99_4p_state::keyC1 ) +{ + set_keyboard_column(1, state); +} + +WRITE_LINE_MEMBER( ti99_4p_state::keyC2 ) +{ + set_keyboard_column(2, state); +} + +/* + WRITE alpha lock line (P5) +*/ +WRITE_LINE_MEMBER( ti99_4p_state::alphaW ) +{ + m_check_alphalock = (state==0); +} + +/* + command CS1 (only) tape unit motor (P6) +*/ +WRITE_LINE_MEMBER( ti99_4p_state::cs_motor ) +{ + m_cassette->change_state((state!=0)? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); +} + +/* + audio gate (P8) + + Set to 1 before using tape: this enables the mixing of tape input sound + with computer sound. + + We do not really need to emulate this as the tape recorder generates sound + on its own. +*/ +WRITE_LINE_MEMBER( ti99_4p_state::audio_gate ) +{ +} + +/* + tape output (P9) +*/ +WRITE_LINE_MEMBER( ti99_4p_state::cassette_output ) +{ + m_cassette->output((state!=0)? +1 : -1); +} + +/* +// TMS9901 setup. The callback functions pass a reference to the TMS9901 as device. +const tms9901_interface tms9901_wiring_sgcpu = +{ + TMS9901_INT1 | TMS9901_INT2 | TMS9901_INTC, // only input pins whose state is always known + + // read handler + DEVCB_DRIVER_MEMBER(ti99_4p_state, read_by_9901), + + { // write handlers + DEVCB_NULL, + DEVCB_NULL, + DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC0), + DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC1), + DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC2), + DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, alphaW), + DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, cs_motor), + DEVCB_NULL, + DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, audio_gate), + DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, cassette_output), + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL + }, + + // interrupt handler + DEVCB_DRIVER_MEMBER(ti99_4p_state, tms9901_interrupt) +}; + +*/ + +/*************************************************************************** + Control lines +****************************************************************************/ + +/* + We may have lots of devices pulling down this line; so we should use a AND + gate to do it right. On the other hand, when READY is down, there is just + no chance to make another device pull down the same line; the CPU just + won't access any other device in this time. +*/ +WRITE_LINE_MEMBER( ti99_4p_state::console_ready ) +{ + m_ready_line = state; + int combined = (m_ready_line == ASSERT_LINE && m_ready_line_dmux == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE; + + if (VERBOSE>6) + { + if (m_ready_prev != combined) LOG("ti99_4p: READY level = %d\n", combined); + } + m_ready_prev = combined; + m_cpu->set_ready(combined); +} + +/* + The exception of the above rule. Memory access over the datamux also operates + the READY line, and the datamux raises READY depending on the clock pulse. + So we must make sure this does not interfere. +*/ +WRITE_LINE_MEMBER( ti99_4p_state::console_ready_dmux ) +{ + m_ready_line_dmux = state; + int combined = (m_ready_line == ASSERT_LINE && m_ready_line_dmux == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE; + + if (VERBOSE>7) + { + if (m_ready_prev != combined) LOG("ti99_4p: READY dmux level = %d\n", state); + } + m_ready_prev = combined; + m_cpu->set_ready(combined); +} + +void ti99_4p_state::set_9901_int( int line, line_state state) +{ + m_tms9901->set_single_int(line, state); + // We latch the value for the read operation. Mind the negative logic. + if (state==CLEAR_LINE) m_9901_int |= (1<6) LOG("ti99_4p: EXTINT level = %02x\n", state); + set_9901_int(1, (line_state)state); +} + +WRITE_LINE_MEMBER( ti99_4p_state::notconnected ) +{ + if (VERBOSE>6) LOG("ti99_4p: Setting a not connected line ... ignored\n"); +} + +/* + Clock line from the CPU. Used to control wait state generation. +*/ +WRITE_LINE_MEMBER( ti99_4p_state::clock_out ) +{ + clock_in(state); +} + +WRITE8_MEMBER( ti99_4p_state::tms9901_interrupt ) +{ + // offset contains the interrupt level (0-15) + // However, the TI board just ignores that level and hardwires it to 1 + // See below (interrupt_level) + m_cpu->set_input_line(INT_9900_INTREQ, data); +} + +READ8_MEMBER( ti99_4p_state::interrupt_level ) +{ + // On the TI-99 systems these IC lines are not used; the input lines + // at the CPU are hardwired to level 1. + return 1; +} + +WRITE8_MEMBER( ti99_4p_state::external_operation ) +{ + static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; + if (VERBOSE>1) LOG("External operation %s not implemented on the SGCPU board\n", extop[offset]); +} + +/*****************************************************************************/ + +void ti99_4p_state::machine_start() +{ + m_ram.resize(0x80000/2); + m_scratchpad.resize(0x400/2); + + m_peribox->senila(CLEAR_LINE); + m_peribox->senilb(CLEAR_LINE); + + m_firstjoy = 6; + + m_ready_line = m_ready_line_dmux = ASSERT_LINE; + + UINT16 *rom = (UINT16*)(memregion("maincpu")->base()); + m_rom0 = rom + 0x2000; + m_dsr = rom + 0x6000; + m_rom6a = rom + 0x3000; + m_rom6b = rom + 0x7000; +} + +/* + set the state of int2 (called by the v9938) +*/ +WRITE_LINE_MEMBER(ti99_4p_state::set_tms9901_INT2_from_v9938) +{ + set_9901_int(2, (line_state)state); +} + +/* + Reset the machine. +*/ +MACHINE_RESET_MEMBER(ti99_4p_state,ti99_4p) +{ + set_9901_int(12, CLEAR_LINE); + + m_cpu->set_ready(ASSERT_LINE); + m_cpu->set_hold(CLEAR_LINE); + m_9901_int = 0x03; // INT2* and INT1* set to 1, i.e. inactive +} + + +/* + Machine description. +*/ +static MACHINE_CONFIG_START( ti99_4p_60hz, ti99_4p_state ) + /* basic machine hardware */ + /* TMS9900 CPU @ 3.0 MHz */ + MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) + MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti99_4p_state, external_operation) ) + MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti99_4p_state, interrupt_level) ) + MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4p_state, clock_out) ) + + /* video hardware */ + // Although we should have a 60 Hz screen rate, we have to set it to 30 here. + // The reason is that that the number of screen lines is counted twice for the + // interlace mode, but in non-interlace modes only half of the lines are + // painted. Accordingly, the full set of lines is refreshed at 30 Hz, + // not 60 Hz. This should be fixed in the v9938 emulation. + MCFG_TI_V9938_ADD(VIDEO_SYSTEM_TAG, 30, SCREEN_TAG, 2500, 512+32, (212+28)*2, ti99_4p_state, set_tms9901_INT2_from_v9938) + + // tms9901 + MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) + MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_4p_state, read_by_9901) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_4p_state, keyC0) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_4p_state, keyC1) ) + MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_4p_state, keyC2) ) + MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_4p_state, cs_motor) ) + MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_4p_state, audio_gate) ) + MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4p_state, cassette_output) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4p_state, tms9901_interrupt) ) + + // Peripheral expansion box (SGCPU composition) + MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_SG, 0) + MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_4p_state, extint) ) + MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4p_state, notconnected) ) + MCFG_PERIBOX_READY_HANDLER( WRITELINE(ti99_4p_state, console_ready) ) + + // sound hardware + MCFG_TI_SOUND_94624_ADD( TISOUND_TAG ) + MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4p_state, console_ready) ) + + // Cassette drives + MCFG_SPEAKER_STANDARD_MONO("cass_out") + MCFG_CASSETTE_ADD( "cassette" ) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) + + // Joystick port + MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG ) + +MACHINE_CONFIG_END + + +ROM_START(ti99_4p) + /*CPU memory space*/ + ROM_REGION16_BE(0x10000, "maincpu", 0) + ROM_LOAD16_BYTE("sgcpu_hb.bin", 0x0000, 0x8000, CRC(aa100730) SHA1(35e585b2dcd3f2a0005bebb15ede6c5b8c787366) ) /* system ROMs */ + ROM_LOAD16_BYTE("sgcpu_lb.bin", 0x0001, 0x8000, CRC(2a5dc818) SHA1(dec141fe2eea0b930859cbe1ebd715ac29fa8ecb) ) /* system ROMs */ +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1996, ti99_4p, 0, 0, ti99_4p_60hz, ti99_4p, driver_device, 0, "System 99 Users Group", "SGCPU (a.k.a. 99/4P)" , 0 ) diff --git a/src/mame/drivers/ti99_4x.c b/src/mame/drivers/ti99_4x.c new file mode 100644 index 00000000000..a90dc92aaf2 --- /dev/null +++ b/src/mame/drivers/ti99_4x.c @@ -0,0 +1,1179 @@ +// license:LGPL-2.1+ +// copyright-holders:Michael Zapf +/**************************************************************************** + + MESS Driver for TI-99/4 and TI-99/4A Home Computers. + TI99/4 info: + + Similar to TI99/4a, except for the following: + * tms9918/9928 has no bitmap mode + * smaller, 40-key keyboard + * many small differences in the contents of system ROMs + + Historical notes: TI made several last minute design changes. + * TI99/4 prototypes had an extra port for an I/R joystick and keypad interface. + * early TI99/4 prototypes were designed for a tms9985, not a tms9900. + + Emulation architecture: + (also see datamux.c, peribox.c) + + +---- video (upper 8 bits of databus) + | + CPU | + TMS9900 ==##== datamux --------+------ peribox ----------- [8] slots with peripheral devices + | || (16->8) | + | || +------ Console GROMs (0, 1, 2) + | ##=== Console ROM | + TMS9901 || +------ gromport (cartridge port) + (I/O) ##=== 256 byte RAM | + | || +------ sound + | ##=== 32KiB RAM + +---+--+ unofficial mod + | | (16 bit) + Cass joyport + + Raphael Nabet, 1999-2003. + Rewritten by Michael Zapf + February 2012: Rewritten as class + +*****************************************************************************/ + +#include "emu.h" +#include "cpu/tms9900/tms9900.h" + +#include "sound/wave.h" +#include "video/v9938.h" +#include "machine/tms9901.h" +#include "imagedev/cassette.h" + +#include "bus/ti99x/videowrp.h" +#include "bus/ti99x/datamux.h" +#include "bus/ti99x/grom.h" +#include "bus/ti99x/gromport.h" +#include "bus/ti99x/joyport.h" + +#include "bus/ti99_peb/peribox.h" + +// Debugging +#define TRACE_READY 0 +#define TRACE_INTERRUPTS 0 +#define TRACE_CRU 0 + +/* + The console. +*/ +class ti99_4x_state : public driver_device +{ +public: + ti99_4x_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cpu(*this, "maincpu"), + m_tms9901(*this, TMS9901_TAG), + m_gromport(*this, GROMPORT_TAG), + m_peribox(*this, PERIBOX_TAG), + m_joyport(*this, JOYPORT_TAG), + m_datamux(*this, DATAMUX_TAG), + m_video(*this, VIDEO_SYSTEM_TAG), + m_cassette1(*this, "cassette"), + m_cassette2(*this, "cassette2") + { } + + // Machine management + DECLARE_MACHINE_START(ti99_4); + DECLARE_MACHINE_START(ti99_4a); + DECLARE_MACHINE_START(ti99_4qi); + DECLARE_MACHINE_RESET(ti99_4); + DECLARE_MACHINE_RESET(ti99_4a); + + // Processor connections with the main board + DECLARE_READ8_MEMBER( cruread ); + DECLARE_READ8_MEMBER( interrupt_level ); + DECLARE_WRITE8_MEMBER( cruwrite ); + DECLARE_WRITE8_MEMBER( external_operation ); + DECLARE_WRITE_LINE_MEMBER( clock_out ); + DECLARE_WRITE_LINE_MEMBER( dbin_line ); + + // Connections from outside towards the CPU (callbacks) + DECLARE_WRITE_LINE_MEMBER( console_ready_dmux ); + DECLARE_WRITE_LINE_MEMBER( console_ready_sound ); + DECLARE_WRITE_LINE_MEMBER( console_ready_pbox ); + DECLARE_WRITE_LINE_MEMBER( console_ready_cart ); + DECLARE_WRITE_LINE_MEMBER( console_ready_grom ); + DECLARE_WRITE_LINE_MEMBER( console_reset ); + DECLARE_WRITE_LINE_MEMBER( notconnected ); + + // Connections with the system interface chip 9901 + DECLARE_WRITE_LINE_MEMBER( extint ); + DECLARE_WRITE_LINE_MEMBER( video_interrupt_in ); + DECLARE_WRITE_LINE_MEMBER( handset_interrupt_in ); + + // Connections with the system interface TMS9901 + DECLARE_READ8_MEMBER(read_by_9901); + DECLARE_WRITE_LINE_MEMBER(keyC0); + DECLARE_WRITE_LINE_MEMBER(keyC1); + DECLARE_WRITE_LINE_MEMBER(keyC2); + DECLARE_WRITE_LINE_MEMBER(cs1_motor); + DECLARE_WRITE_LINE_MEMBER(audio_gate); + DECLARE_WRITE_LINE_MEMBER(cassette_output); + DECLARE_WRITE8_MEMBER(tms9901_interrupt); + DECLARE_WRITE_LINE_MEMBER(handset_ack); + DECLARE_WRITE_LINE_MEMBER(cs2_motor); + DECLARE_WRITE_LINE_MEMBER(alphaW); + + // Interrupt triggers + DECLARE_INPUT_CHANGED_MEMBER( load_interrupt ); + +private: + void set_keyboard_column(int number, int data); + int m_keyboard_column; + int m_check_alphalock; + + // READY handling + int m_nready_combined; + int m_nready_prev; + void console_ready_join(int id, int state); + + // Console type + int m_model; + + // Latch for 9901 INT1, INT2, and INT12 lines + line_state m_int1; + line_state m_int2; + line_state m_int12; + + // Connected devices + required_device m_cpu; + required_device m_tms9901; + required_device m_gromport; + required_device m_peribox; + required_device m_joyport; + required_device m_datamux; + required_device m_video; + required_device m_cassette1; + required_device m_cassette2; +}; + +/* + Console models. +*/ +enum +{ + MODEL_4, + MODEL_4A, + MODEL_4QI +}; + +/* + READY bits. +*/ +enum +{ + READY_GROM = 1, + READY_DMUX = 2, + READY_PBOX = 4, + READY_SOUND = 8, + READY_CART = 16 +}; + +/* + Memory map. + Most of the work is done in the datamux (see datamux.c). We only keep ROM + and the small 256 byte PAD RAM here because they are directly connected + to the 16bit bus, and the wait state logic is not active during their + accesses. +*/ +static ADDRESS_MAP_START(memmap, AS_PROGRAM, 16, ti99_4x_state) + ADDRESS_MAP_GLOBAL_MASK(0xffff) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAM + AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(DATAMUX_TAG, ti99_datamux_device, read, write) AM_DEVSETOFFSET(DATAMUX_TAG, ti99_datamux_device, setoffset) +ADDRESS_MAP_END + +/* + CRU map + TMS9900 CRU address space is 12 bits wide, attached to A3-A14, A0-A2 must + be 000 (other values for external commands like RSET, LREX, CKON...), + A15 is used as CRUOUT + The TMS9901 is incompletely decoded + ---0 00xx xxcc ccc0 + causing 16 mirrors (0000, 0040, 0080, 00c0, ... , 03c0) + + Reading is done by transfering 8 successive bits, so addresses refer to + 8 bit groups; writing, however, is done using output lines. The CRU base + address in the ti99 systems is twice the bit address: + + (base=0, bit=0x10) == (base=0x20,bit=0) + + Read: 0000 - 003f translates to base addresses 0000 - 03fe + 0000 - 01ff is the complete CRU address space 0000 - 1ffe (for TMS9900) + + Write:0000 - 01ff corresponds to bit 0 of base address 0000 - 03fe +*/ +static ADDRESS_MAP_START(cru_map, AS_IO, 8, ti99_4x_state) + AM_RANGE(0x0000, 0x0003) AM_MIRROR(0x003c) AM_DEVREAD(TMS9901_TAG, tms9901_device, read) + AM_RANGE(0x0000, 0x01ff) AM_READ(cruread) + + AM_RANGE(0x0000, 0x001f) AM_MIRROR(0x01e0) AM_DEVWRITE(TMS9901_TAG, tms9901_device, write) + AM_RANGE(0x0000, 0x0fff) AM_WRITE(cruwrite) +ADDRESS_MAP_END + + +/***************************************************************************** + Input ports + ****************************************************************************/ + +static INPUT_PORTS_START(ti99_4) + PORT_START("COL0") // col 0 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q QUIT") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR(UCHAR_MAMEKEY(F12)) + /* TI99/4 has a second space key which maps the same */ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(' ') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P \"") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L =") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('=') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("COL1") // col 1 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W BEGIN") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A AID") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z BACK") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O +") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('+') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K /") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('/') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", .") PORT_CODE(KEYCODE_STOP) PORT_CHAR(',') PORT_CHAR('.') + + PORT_START("COL2") // col 2 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E UP") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S LEFT") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X DOWN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I -") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('-') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J ^") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('^') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M ;") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR(';') + /* col 3 */ + PORT_START("COL3") // col 3 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R REDO") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D RIGHT") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C CLEAR") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U _") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H <") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('<') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N :") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(':') + + PORT_START("COL4") // col 4 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T ERASE") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F DEL") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V PROC'D") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y >") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G INS") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ?") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('?') + +INPUT_PORTS_END + +/* TI99/4a: 48-key keyboard */ +static INPUT_PORTS_START(ti99_4a) + PORT_START( "ALPHABUG" ) + PORT_CONFNAME( 0x01, 0x01, "Alpha Lock blocks joystick up" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) + + PORT_START( "LOADINT ") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Load interrupt") PORT_CODE(KEYCODE_PRTSCR) PORT_CHANGED_MEMBER(DEVICE_SELF, ti99_4x_state, load_interrupt, 1) + + PORT_START("COL0") // col 0 + PORT_BIT(0x88, IP_ACTIVE_LOW, IPT_UNUSED) + /* The original control key is located on the left, but we accept the right control key as well */ + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + /* TI99/4a has a second shift key which maps the same */ + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + /* The original function key is located on the right, but we accept the left alt key as well */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCTN") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= + QUIT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR(UCHAR_MAMEKEY(F12)) + + PORT_START("COL1") // col 1 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR('~') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ( BACK") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("COL2") // col 2 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('`') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # ERASE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 * REDO") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR('?') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("COL3") // col 3 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('[') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLEAR") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 & AID") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("COL4") // col 4 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(']') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % BEGIN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^ PROC'D") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("COL5") // col 5 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR('\\') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('\"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('-') + + PORT_START("ALPHA") /* one more port for Alpha line */ + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + + /* another version of Alpha Lock which is non-toggling; this is useful when we want to attach + a real TI keyboard for input. For home computers, the Alpha Lock / Shift Lock was a physically + locking key. */ + PORT_START("ALPHA1") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alpha Lock non-toggle") PORT_CODE(KEYCODE_RWIN) + +INPUT_PORTS_END + + +/***************************************************************************** + Components +******************************************************************************/ + +static GROM_CONFIG(grom0_config) +{ + false, 0, region_grom, 0x0000, 0x1800, GROMFREQ +}; + +static GROM_CONFIG(grom1_config) +{ + false, 1, region_grom, 0x2000, 0x1800, GROMFREQ +}; + +static GROM_CONFIG(grom2_config) +{ + false, 2, region_grom, 0x4000, 0x1800, GROMFREQ +}; + +READ8_MEMBER( ti99_4x_state::cruread ) +{ +// if (TRACE_CRU) logerror("read access to CRU address %04x\n", offset << 4); + UINT8 value = 0; + + // Similar to the bus8z_devices, just let the gromport and the p-box + // decide whether they want to change the value at the CRU address + // Also, we translate the bit addresses to base addresses + + // The QI version does not propagate the CRU signals to the cartridge slot + if (m_model != MODEL_4QI) m_gromport->crureadz(space, offset<<4, &value); + m_peribox->crureadz(space, offset<<4, &value); + + return value; +} + +WRITE8_MEMBER( ti99_4x_state::cruwrite ) +{ + if (TRACE_CRU) logerror("ti99_4x: write access to CRU address %04x\n", offset << 1); + // The QI version does not propagate the CRU signals to the cartridge slot + if (m_model != MODEL_4QI) m_gromport->cruwrite(space, offset<<1, data); + m_peribox->cruwrite(space, offset<<1, data); +} + +WRITE8_MEMBER( ti99_4x_state::external_operation ) +{ + static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; + // Some games (e.g. Slymoids) actually use IDLE for synchronization + if (offset == IDLE_OP) return; + else + { + logerror("ti99_4x: External operation %s not implemented on TI-99 board\n", extop[offset]); + } +} + +/*************************************************************************** + TI99/4x-specific tms9901 I/O handlers + + See mess/machine/tms9901.c for generic tms9901 CRU handlers. + + TMS9901 interrupt handling on a TI99/4(a). + + TI99/4(a) uses the following interrupts: + INT1: external interrupt (used by RS232 controller, for instance) + INT2: VDP interrupt + TMS9901 timer interrupt (overrides INT3) + INT12: handset interrupt (only on a TI-99/4 with the handset prototypes) + + Three (occasionally four) interrupts are used by the system (INT1, INT2, + timer, and INT12 on a TI-99/4 with remote handset prototypes), out of 15/16 + possible interrupts. Keyboard pins can be used as interrupt pins, too, but + this is not emulated (it's a trick, anyway, and I don't know any program + which uses it). + + When an interrupt line is set (and the corresponding bit in the interrupt mask is set), + a level 1 interrupt is requested from the TMS9900. This interrupt request lasts as long as + the interrupt pin and the relevant bit in the interrupt mask are set. + +***************************************************************************/ + + +static const char *const column[] = { "COL0", "COL1", "COL2", "COL3", "COL4", "COL5" }; + +READ8_MEMBER( ti99_4x_state::read_by_9901 ) +{ + int answer=0; + + switch (offset & 0x03) + { + case TMS9901_CB_INT7: + // + // Read pins INT3*-INT7* of TI99's 9901. + // bit 1: INT1 status + // bit 2: INT2 status + // bit 3-7: keyboard status bits 0 to 4 + // + // |K|K|K|K|K|I2|I1|C| + // + if (m_keyboard_column >= (m_model==MODEL_4? 5:6)) // joy 1, 2, handset + { + answer = m_joyport->read_port(); + // The hardware bug of the TI-99/4A: you have to release the + // Alphalock key when using joysticks. This is a maldesign of the + // board: When none of the other keyboard lines are selected the + // depressed Alphalock key pulls up the /INT7 line which is also + // used for joystick up. The joystick switch then fails to lower + // the line enough to make the TMS9901 sense the low level. + // A reported, feasible fix was to cut the line and insert a diode + // below the Alphalock key. + if ((ioport("ALPHABUG")!=0) && (m_model!=MODEL_4)) answer |= (ioport("ALPHA")->read() | ioport("ALPHA1")->read()); + } + else + { + answer = ioport(column[m_keyboard_column])->read(); + } + if (m_check_alphalock) // never true for TI-99/4 + { + answer &= ~(ioport("ALPHA")->read() | ioport("ALPHA1")->read()); + } + answer = (answer << 3); + if (m_int1 == CLEAR_LINE) answer |= 0x02; + if (m_int2 == CLEAR_LINE) answer |= 0x04; + + break; + + case TMS9901_INT8_INT15: + // |1|1|1|INT12|0|K|K|K| + if (m_keyboard_column >= (m_model==MODEL_4? 5:6)) answer = 0x07; + else answer = ((ioport(column[m_keyboard_column])->read())>>5) & 0x07; + answer |= 0xe0; + if (m_model != MODEL_4 || m_int12==CLEAR_LINE) answer |= 0x10; + break; + + case TMS9901_P0_P7: + // Required for the handset (only on TI-99/4) + if ((m_joyport->read_port() & 0x20)!=0) answer |= 2; + break; + + case TMS9901_P8_P15: + // Preset to 1 + answer = 4; + + // Interrupt pin of the handset (only on TI-99/4) + // Negative logic (interrupt pulls line down) + if ((m_joyport->read_port() & 0x40)==0) answer = 0; + + // we don't take CS2 into account, as CS2 is a write-only unit + if (m_cassette1->input() > 0) + { + answer |= 8; + } + break; + } + return answer; +} + +/* + Handler for TMS9901 P0 pin (handset data acknowledge); only for 99/4 +*/ +WRITE_LINE_MEMBER( ti99_4x_state::handset_ack ) +{ + // Write a value to the joyport. If there is a handset this will set its + // ACK line. + m_joyport->write_port(state==ASSERT_LINE? 0x01 : 0x00); +} + +/* + WRITE key column select (P2-P4), TI-99/4 +*/ +void ti99_4x_state::set_keyboard_column(int number, int data) +{ + if (data != 0) + m_keyboard_column |= 1 << number; + else + m_keyboard_column &= ~ (1 << number); + + if (m_keyboard_column >= (m_model==MODEL_4? 5:6)) + { + m_joyport->write_port(m_keyboard_column - (m_model==MODEL_4? 5:6) + 1); + } + + // TI-99/4: joystick 1 = column 5 + // joystick 2 = column 6 + // (only for the prototype versions; the released versions had no IR + // handset and the board was already redesigned to use columns 6 and 7) + + // TI-99/4A: joystick 1 = column 6 + // joystick 2 = column 7 +} + +WRITE_LINE_MEMBER( ti99_4x_state::keyC0 ) +{ + set_keyboard_column(0, state); +} + +WRITE_LINE_MEMBER( ti99_4x_state::keyC1 ) +{ + set_keyboard_column(1, state); +} + +WRITE_LINE_MEMBER( ti99_4x_state::keyC2 ) +{ + set_keyboard_column(2, state); +} + +/* + Select alpha lock line - TI99/4a only (P5) +*/ +WRITE_LINE_MEMBER( ti99_4x_state::alphaW ) +{ + m_check_alphalock = (state==0); +} + +/* + Control CS1 tape unit motor (P6) +*/ +WRITE_LINE_MEMBER( ti99_4x_state::cs1_motor ) +{ + m_cassette1->change_state(state==ASSERT_LINE? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); +} + +/* + Control CS2 tape unit motor (P7) +*/ +WRITE_LINE_MEMBER( ti99_4x_state::cs2_motor ) +{ + m_cassette2->change_state(state==ASSERT_LINE? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); +} + +/* + Audio gate (P8) + Set to 1 before using tape: this enables the mixing of tape input sound + with computer sound. + We do not really need to emulate this as the tape recorder generates sound + on its own. +*/ +WRITE_LINE_MEMBER( ti99_4x_state::audio_gate ) +{ +} + +/* + Tape output (P9) + I think polarity is correct, but don't take my word for it. +*/ +WRITE_LINE_MEMBER( ti99_4x_state::cassette_output ) +{ + m_cassette1->output(state==ASSERT_LINE? +1 : -1); + m_cassette2->output(state==ASSERT_LINE? +1 : -1); +} + +WRITE8_MEMBER( ti99_4x_state::tms9901_interrupt ) +{ + // offset contains the interrupt level (0-15) + // However, the TI board just ignores that level and hardwires it to 1 + // See below (interrupt_level) + m_cpu->set_input_line(INT_9900_INTREQ, data); +} + +READ8_MEMBER( ti99_4x_state::interrupt_level ) +{ + // On the TI-99 systems these IC lines are not used; the input lines + // at the CPU are hardwired to level 1. + return 1; +} + +/* + Clock line from the CPU. Used to control wait state generation. +*/ +WRITE_LINE_MEMBER( ti99_4x_state::clock_out ) +{ + m_datamux->clock_in(state); +} + +/* + Data bus in (DBIN) line from the CPU. +*/ +WRITE_LINE_MEMBER( ti99_4x_state::dbin_line ) +{ + m_datamux->dbin_in(state); +} + +/*****************************************************************************/ + +/* + set the state of TMS9901's INT2 (called by the tms9928 core) +*/ +WRITE_LINE_MEMBER( ti99_4x_state::video_interrupt_in ) +{ + if (TRACE_INTERRUPTS) logerror("ti99_4x: VDP INT2 on tms9901, level=%d\n", state); + + // Pulse for the handset + if (m_model == MODEL_4) m_joyport->pulse_clock(); + + m_int2 = (line_state)state; + m_tms9901->set_single_int(2, state); +} + +/* + set the state of TMS9901's INT12 (called by the handset prototype of TI-99/4) +*/ +WRITE_LINE_MEMBER( ti99_4x_state::handset_interrupt_in) +{ + if (TRACE_INTERRUPTS) logerror("ti99_4x: joyport INT12 on tms9901, level=%d\n", state); + m_int12 = (line_state)state; + m_tms9901->set_single_int(12, state); +} + +/* + One of the common hardware mods was to add a switch to trigger a LOAD + interrupt +*/ +INPUT_CHANGED_MEMBER( ti99_4x_state::load_interrupt ) +{ + logerror("ti99_4x: LOAD interrupt, level=%d\n", newval); + m_cpu->set_input_line(INT_9900_LOAD, (newval==0)? ASSERT_LINE : CLEAR_LINE); +} + +/*********************************************************** + Links to external devices +***********************************************************/ + +/* + We combine the incoming READY signals and propagate them to the CPU. + An alternative would be to let the CPU get the READY state, but this would + be a much higher overhead, as this happens in each clock tick. +*/ +void ti99_4x_state::console_ready_join(int id, int state) +{ + if (state==CLEAR_LINE) + m_nready_combined |= id; + else + m_nready_combined &= ~id; + + if (TRACE_READY) + { + if (m_nready_prev != m_nready_combined) logerror("ti99_4x: READY bits = %04x\n", ~m_nready_combined); + } + + m_nready_prev = m_nready_combined; + m_cpu->set_ready(m_nready_combined==0); +} + +/* + Connections to the READY line. This might look a bit ugly; we need an + implementation of a "Wired AND" device. +*/ +WRITE_LINE_MEMBER( ti99_4x_state::console_ready_grom ) +{ + console_ready_join(READY_GROM, state); +} + +WRITE_LINE_MEMBER( ti99_4x_state::console_ready_dmux ) +{ + console_ready_join(READY_DMUX, state); +} + +WRITE_LINE_MEMBER( ti99_4x_state::console_ready_pbox ) +{ + console_ready_join(READY_PBOX, state); +} + +WRITE_LINE_MEMBER( ti99_4x_state::console_ready_sound ) +{ + console_ready_join(READY_SOUND, state); +} + +WRITE_LINE_MEMBER( ti99_4x_state::console_ready_cart ) +{ + console_ready_join(READY_CART, state); +} + +/* + The RESET line leading to a reset of the CPU. This is asserted when a + cartridge is plugged in. +*/ +WRITE_LINE_MEMBER( ti99_4x_state::console_reset ) +{ + if (machine().phase() != MACHINE_PHASE_INIT) + { + logerror("ti99_4x: Console reset line = %d\n", state); + m_cpu->set_input_line(INT_9900_RESET, state); + m_video->reset_vdp(state); + } +} + +WRITE_LINE_MEMBER( ti99_4x_state::extint ) +{ + if (TRACE_INTERRUPTS) logerror("ti99_4x: EXTINT level = %02x\n", state); + m_int1 = (line_state)state; + m_tms9901->set_single_int(1, state); +} + +WRITE_LINE_MEMBER( ti99_4x_state::notconnected ) +{ + if (TRACE_INTERRUPTS) logerror("ti99_4x: Setting a not connected line ... ignored\n"); +} + +/*****************************************************************************/ + +/* + Devices attached to the databus multiplexer. We cannot solve this with + the common address maps since the multiplexer also inserts wait states + that we want to emulate properly. Also, devices may reside on the same + memory locations (like GROMs) and select themselves according to some + inner state (e.g. GROMs have an own address counter and a given address + area). +*/ +static const dmux_device_list_entry dmux_devices[] = +{ + { VIDEO_SYSTEM_TAG, 0x8800, 0xfc01, 0x0400, NULL, 0, 0 }, + { GROM0_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, + { GROM1_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, + { GROM2_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, + { TISOUND_TAG, 0x8400, 0xfc01, 0x0000, NULL, 0, 0 }, + { GROMPORT_TAG, 0x9800, 0xfc01, 0x0400, NULL, 0, 0 }, + { GROMPORT_TAG, 0x6000, 0xe000, 0x0000, NULL, 0, 0 }, + { PERIBOX_TAG, 0x0000, 0x0000, 0x0000, NULL, 0, 0 }, // Peribox needs all addresses + { NULL, 0, 0, 0, NULL, 0, 0 } +}; + +static const dmux_device_list_entry dmux_devices_ev[] = +{ + { VIDEO_SYSTEM_TAG, 0x8800, 0xfc01, 0x0400, NULL, 0, 0 }, + { GROM0_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, + { GROM1_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, + { GROM2_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, + { TISOUND_TAG, 0x8400, 0xfc01, 0x0000, NULL, 0, 0 }, + { GROMPORT_TAG, 0x9800, 0xfc01, 0x0400, NULL, 0, 0 }, + { GROMPORT_TAG, 0x6000, 0xe000, 0x0000, NULL, 0, 0 }, + { PERIBOX_TAG, 0x0000, 0x0000, 0x0000, NULL, 0, 0 }, // Peribox needs all addresses + { NULL, 0, 0, 0, NULL, 0, 0 } +}; + +static DMUX_CONFIG( datamux_conf ) +{ + dmux_devices +}; + +static DMUX_CONFIG( datamux_conf_ev ) +{ + dmux_devices_ev +}; + +/****************************************************************************** + Machine definitions +******************************************************************************/ + +MACHINE_START_MEMBER(ti99_4x_state,ti99_4) +{ + m_peribox->senila(CLEAR_LINE); + m_peribox->senilb(CLEAR_LINE); + m_nready_combined = 0; + m_model = MODEL_4; +} + +MACHINE_RESET_MEMBER(ti99_4x_state,ti99_4) +{ + m_cpu->set_ready(ASSERT_LINE); + m_cpu->set_hold(CLEAR_LINE); + m_int1 = CLEAR_LINE; + m_int2 = CLEAR_LINE; + m_int12 = CLEAR_LINE; +} + +/********************************************************************** + TI-99/4 - predecessor of the more popular TI-99/4A +***********************************************************************/ + +static MACHINE_CONFIG_START( ti99_4, ti99_4x_state ) + // CPU + MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) + MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti99_4x_state, external_operation) ) + MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti99_4x_state, interrupt_level) ) + MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4x_state, clock_out) ) + MCFG_TMS99xx_DBIN_HANDLER( WRITELINE(ti99_4x_state, dbin_line) ) + + MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4 ) + MCFG_MACHINE_RESET_OVERRIDE(ti99_4x_state, ti99_4 ) + + /* Main board */ + MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) + MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_4x_state, read_by_9901) ) + MCFG_TMS9901_P0_HANDLER( WRITELINE( ti99_4x_state, handset_ack) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_4x_state, keyC0) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_4x_state, keyC1) ) + MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_4x_state, keyC2) ) + MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_4x_state, cs1_motor) ) + MCFG_TMS9901_P7_HANDLER( WRITELINE( ti99_4x_state, cs2_motor) ) + MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_4x_state, audio_gate) ) + MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) ) + + MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf ) + MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) ) + MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG ) + MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) ) + MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) ) + + /* Software list */ + MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") + + /* Peripheral expansion box */ + MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX, 0) + MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_4x_state, extint) ) + MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) ) + MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) ) + + /* sound hardware */ + MCFG_TI_SOUND_94624_ADD( TISOUND_TAG ) + MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) ) + + /* Cassette drives */ + MCFG_SPEAKER_STANDARD_MONO("cass_out") + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_ADD( "cassette2" ) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) + + /* GROM devices */ + MCFG_GROM_ADD( GROM0_TAG, grom0_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + MCFG_GROM_ADD( GROM1_TAG, grom1_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + MCFG_GROM_ADD( GROM2_TAG, grom2_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + + // Joystick port + MCFG_TI_JOYPORT4_ADD( JOYPORT_TAG ) + MCFG_JOYPORT_INT_HANDLER( WRITELINE(ti99_4x_state, handset_interrupt_in) ) +MACHINE_CONFIG_END + +/* + US version: 60 Hz, NTSC +*/ +static MACHINE_CONFIG_DERIVED( ti99_4_60hz, ti99_4 ) + MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918, 0x4000, ti99_4x_state, video_interrupt_in) +MACHINE_CONFIG_END + +/* + European version: 50 Hz, PAL +*/ +static MACHINE_CONFIG_DERIVED( ti99_4_50hz, ti99_4 ) + MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929, 0x4000, ti99_4x_state, video_interrupt_in) +MACHINE_CONFIG_END + +/********************************************************************** + TI-99/4A - replaced the 99/4 and became the standard TI-99 console +***********************************************************************/ + +MACHINE_START_MEMBER(ti99_4x_state,ti99_4a) +{ + m_peribox->senila(CLEAR_LINE); + m_peribox->senilb(CLEAR_LINE); + m_nready_combined = 0; + m_model = MODEL_4A; +} + +MACHINE_RESET_MEMBER(ti99_4x_state,ti99_4a) +{ + m_cpu->set_ready(ASSERT_LINE); + m_cpu->set_hold(CLEAR_LINE); + m_int1 = CLEAR_LINE; + m_int2 = CLEAR_LINE; + m_int12 = CLEAR_LINE; +} + +static MACHINE_CONFIG_START( ti99_4a, ti99_4x_state ) + /* CPU */ + MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) + MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti99_4x_state, external_operation) ) + MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti99_4x_state, interrupt_level) ) + MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4x_state, clock_out) ) + MCFG_TMS99xx_DBIN_HANDLER( WRITELINE(ti99_4x_state, dbin_line) ) + + MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4a ) + MCFG_MACHINE_RESET_OVERRIDE(ti99_4x_state, ti99_4a ) + + /* Main board */ + MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) + MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_4x_state, read_by_9901) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_4x_state, keyC0) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_4x_state, keyC1) ) + MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_4x_state, keyC2) ) + MCFG_TMS9901_P5_HANDLER( WRITELINE( ti99_4x_state, alphaW) ) + MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_4x_state, cs1_motor) ) + MCFG_TMS9901_P7_HANDLER( WRITELINE( ti99_4x_state, cs2_motor) ) + MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_4x_state, audio_gate) ) + MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) ) + + MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf ) + MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) ) + MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG ) + MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) ) + MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) ) + + /* Software list */ + MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") + + /* Peripheral expansion box */ + MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX, 0) + MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_4x_state, extint) ) + MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) ) + MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) ) + + /* sound hardware */ + MCFG_TI_SOUND_94624_ADD( TISOUND_TAG ) + MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) ) + + /* Cassette drives */ + MCFG_SPEAKER_STANDARD_MONO("cass_out") + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_ADD( "cassette2" ) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) + + /* GROM devices */ + MCFG_GROM_ADD( GROM0_TAG, grom0_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + MCFG_GROM_ADD( GROM1_TAG, grom1_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + MCFG_GROM_ADD( GROM2_TAG, grom2_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + + // Joystick port + MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG ) +MACHINE_CONFIG_END + +/* + US version: 60 Hz, NTSC +*/ +static MACHINE_CONFIG_DERIVED( ti99_4a_60hz, ti99_4a ) + MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918A, 0x4000, ti99_4x_state, video_interrupt_in) +MACHINE_CONFIG_END + +/* + European version: 50 Hz, PAL +*/ +static MACHINE_CONFIG_DERIVED( ti99_4a_50hz, ti99_4a ) + MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929A, 0x4000, ti99_4x_state, video_interrupt_in) +MACHINE_CONFIG_END + +/************************************************************************ + TI-99/4QI - the final version of the TI-99/4A + This was a last modification of the console. One purpose was to lower + production costs by a redesigned board layout. The other was that TI + removed the ROM search for cartridges so that only cartridges with GROMs + could be started, effectively kicking out all third-party cartridges like + those from Atarisoft. +*************************************************************************/ + +MACHINE_START_MEMBER(ti99_4x_state, ti99_4qi) +{ + m_peribox->senila(CLEAR_LINE); + m_peribox->senilb(CLEAR_LINE); + m_model = MODEL_4QI; + m_nready_combined = 0; +} + +static MACHINE_CONFIG_DERIVED( ti99_4qi, ti99_4a ) + MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4qi ) +MACHINE_CONFIG_END + +/* + US version: 60 Hz, NTSC +*/ +static MACHINE_CONFIG_DERIVED( ti99_4qi_60hz, ti99_4qi ) + MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918A, 0x4000, ti99_4x_state, video_interrupt_in) +MACHINE_CONFIG_END + +/* + European version: 50 Hz, PAL +*/ +static MACHINE_CONFIG_DERIVED( ti99_4qi_50hz, ti99_4qi ) + MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929A, 0x4000, ti99_4x_state, video_interrupt_in) +MACHINE_CONFIG_END + +/************************************************************************ + TI-99/4A with 80-column support. Actually a separate expansion card (EVPC), + replacing the console video processor. +*************************************************************************/ + +static MACHINE_CONFIG_START( ti99_4ev_60hz, ti99_4x_state ) + /* CPU */ + MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) + MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti99_4x_state, external_operation) ) + MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti99_4x_state, interrupt_level) ) + MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4x_state, clock_out) ) + MCFG_TMS99xx_DBIN_HANDLER( WRITELINE(ti99_4x_state, dbin_line) ) + + MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4a ) + + /* video hardware */ + // Although we should have a 60 Hz screen rate, we have to set it to 30 here. + // The reason is that that the number of screen lines is counted twice for the + // interlace mode, but in non-interlace modes only half of the lines are + // painted. Accordingly, the full set of lines is refreshed at 30 Hz, + // not 60 Hz. This should be fixed in the v9938 emulation. + MCFG_TI_V9938_ADD(VIDEO_SYSTEM_TAG, 30, SCREEN_TAG, 2500, 512+32, (212+28)*2, ti99_4x_state, video_interrupt_in) + + /* Main board */ + MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) + MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_4x_state, read_by_9901) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_4x_state, keyC0) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_4x_state, keyC1) ) + MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_4x_state, keyC2) ) + MCFG_TMS9901_P5_HANDLER( WRITELINE( ti99_4x_state, alphaW) ) + MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_4x_state, cs1_motor) ) + MCFG_TMS9901_P7_HANDLER( WRITELINE( ti99_4x_state, cs2_motor) ) + MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_4x_state, audio_gate) ) + MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) ) + + MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf_ev ) + MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) ) + MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG ) + MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) ) + MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) ) + + /* Software list */ + MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") + + /* Peripheral expansion box */ + MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_EV, 0) + MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_4x_state, extint) ) + MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) ) + MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) ) + + /* sound hardware */ + MCFG_TI_SOUND_94624_ADD( TISOUND_TAG ) + MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) ) + + /* Cassette drives */ + MCFG_SPEAKER_STANDARD_MONO("cass_out") + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_ADD( "cassette2" ) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) + + /* GROM devices */ + MCFG_GROM_ADD( GROM0_TAG, grom0_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + MCFG_GROM_ADD( GROM1_TAG, grom1_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + MCFG_GROM_ADD( GROM2_TAG, grom2_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) + + // Joystick port + MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG ) + +MACHINE_CONFIG_END + +/***************************************************************************** + ROM loading + Note that we use the same ROMset for 50Hz and 60Hz versions. + ROMs for peripheral equipment have been moved to the respective files. +******************************************************************************/ +#define rom_ti99_4e rom_ti99_4 +#define rom_ti99_4ae rom_ti99_4a +#define rom_ti99_4qe rom_ti99_4qi + +ROM_START(ti99_4) + // CPU memory space + ROM_REGION16_BE(0x2000, "maincpu", 0) + ROM_LOAD16_BYTE("u610.bin", 0x0000, 0x1000, CRC(6fcf4b15) SHA1(d085213c64701d429ae535f9a4ac8a50427a8343)) /* CPU ROMs high */ + ROM_LOAD16_BYTE("u611.bin", 0x0001, 0x1000, CRC(491c21d1) SHA1(7741ae9294c51a44a78033d1b77c01568a6bbfb9)) /* CPU ROMs low */ + + // GROM memory space + ROM_REGION(0x10000, region_grom, 0) + ROM_LOAD("u500.bin", 0x0000, 0x1800, CRC(aa757e13) SHA1(4658d3d01c0131c283a30cebd12e76754d41a84a)) /* system GROM 0 */ + ROM_LOAD("u501.bin", 0x2000, 0x1800, CRC(c863e460) SHA1(6d849a76011273a069a98ed0c3feaf13831c942f)) /* system GROM 1 */ + ROM_LOAD("u502.bin", 0x4000, 0x1800, CRC(b0eda548) SHA1(725e3f26f8c819f356e4bb405b4102b5ae1e0e70)) /* system GROM 2 */ +ROM_END + +ROM_START(ti99_4a) + // CPU memory space + ROM_REGION16_BE(0x2000, "maincpu", 0) + ROM_LOAD16_WORD("994arom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */ + + // GROM memory space + ROM_REGION(0x10000, region_grom, 0) + ROM_LOAD("994agrom.bin", 0x0000, 0x6000, CRC(af5c2449) SHA1(0c5eaad0093ed89e9562a2c0ee6a370bdc9df439)) /* system GROMs */ +ROM_END + +ROM_START(ti99_4qi) + // CPU memory space + ROM_REGION16_BE(0x2000, "maincpu", 0) + ROM_LOAD16_WORD("994qirom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */ + + // GROM memory space + ROM_REGION(0x10000, region_grom, 0) + ROM_LOAD("994qigr0.bin", 0x0000, 0x1800, CRC(8b07772d) SHA1(95dcf5b7350ade65297eadd2d680c27561cc975c)) /* system GROM 0 */ + ROM_LOAD("994qigr1.bin", 0x2000, 0x1800, CRC(b8f367ab) SHA1(3ecead4b83ec525084c70b6123d4053f8a80e1f7)) /* system GROM 1 */ + ROM_LOAD("994qigr2.bin", 0x4000, 0x1800, CRC(e0bb5341) SHA1(e255f0d65d69b927cecb8fcfac7a4c17d585ea96)) /* system GROM 2 */ +ROM_END + + +ROM_START(ti99_4ev) + /*CPU memory space*/ + ROM_REGION16_BE(0x2000, "maincpu", 0) + ROM_LOAD16_WORD("994arom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */ + + /*GROM memory space*/ + ROM_REGION(0x10000, region_grom, 0) + ROM_LOAD("994agr38.bin", 0x0000, 0x6000, CRC(bdd9f09b) SHA1(9b058a55d2528d2a6a69d7081aa296911ed7c0de)) /* system GROMs */ +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1979, ti99_4, 0, 0, ti99_4_60hz, ti99_4, driver_device, 0, "Texas Instruments", "TI-99/4 Home Computer (US)" , 0) +COMP( 1980, ti99_4e, ti99_4, 0, ti99_4_50hz, ti99_4, driver_device, 0, "Texas Instruments", "TI-99/4 Home Computer (Europe)" , 0) +COMP( 1981, ti99_4a, 0, 0, ti99_4a_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer (US)" , 0) +COMP( 1981, ti99_4ae, ti99_4a, 0, ti99_4a_50hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer (Europe)" , 0) +COMP( 1983, ti99_4qe, ti99_4qi, 0, ti99_4qi_50hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4QI Home Computer (Europe)" , 0) +COMP( 1983, ti99_4qi, 0, 0, ti99_4qi_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4QI Home Computer" , 0) +COMP( 1994, ti99_4ev, ti99_4a, 0, ti99_4ev_60hz,ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer with EVPC" , 0) diff --git a/src/mame/drivers/ti99_8.c b/src/mame/drivers/ti99_8.c new file mode 100644 index 00000000000..eeaacff3591 --- /dev/null +++ b/src/mame/drivers/ti99_8.c @@ -0,0 +1,1124 @@ +// license:LGPL-2.1+ +// copyright-holders:Michael Zapf +/**************************************************************************** + + The MESS TI-99/8 emulation driver + + The TI-99/8 was the envisaged successor to the TI-99/4A but never passed + its prototype state. Only a few dozens of consoles were built. The ROMs + were not even finalized, so the few available consoles have different + operating system versions and capabilities. + + + Characteristics + --------------- + + Name: "Texas Instruments Computer TI-99/8" (no "Home") + + Inofficial nickname: "Armadillo" + + CPU: Single-CPU system using a TMS9995, but as a variant named MP9537. This + variant does not offer on-chip RAM or decrementer. + + Video: TMS9118 Video Display Processor with 16 KiB RAM. The 9118 has the + same capabilities as the 9918/28 in the TI-99/4A, except for the + missing GROM clock (which must be provided separately) and the + different DRAM type (2 chips TMS 4416 16K*4). Delivers a 60 Hz + interrupt to the CPU via the PSI. + + Keyboard: 50-key keyboard, slightly different to the TI-99/4A, but also with + modifiers Control, Function, Shift, Caps Lock. Connects to the TMS 9901 + PSI like in the TI-99/4A, but the pin assignment and key matrix + are different: + - P0-P3: column select + - INT6*-INT11*: row inputs (INT6* is only used for joystick fire) + + Cassette: Identical to TI-99/4A, except that the CS2 unit is not implemented + + Sound: SN94624 as used in the TI-99/4A + + Speech: TMS5200C, a rare variant of the TMS52xx family. Compatible to the + speech data for the separate speech synthesizer for the TI-99/4A. + Speech ROMs CD2325A, CD2326A (total 128K*1) + + ROM: TMS4764 (8K*8), called "ROM0" in the specifications [1] + TMS47256 (32K*8), called "ROM1" [1] + TMS47128 (16K*8), "P-Code ROM" (only available in late prototypes) + See below for contents + + GROMs: TI-specific ROM circuits with internal address counter and 6 KiB + capacity (see grom.c) + 3 GROMs (system GROMs, access via port at logical address F830) + 8 GROMs (Pascal / Text-to-speech GROMs, port at logical address F840) + 8 GROMs (Pascal GROMs, port at logical address F850) + 3 GROMs (Pascal GROMs, access via port at logical address F860) + (total of 132 KiB GROM) + + RAM: 1 TMS4016 (SRAM 2K*8) + 8 TMS4164 (DRAM 64K*1) + + PSI: (programmable system interface) TMS9901 with connections to + keyboard, joystick port, cassette port, and external interrupt lines + (video, peripheral devices) + + External connectors: + - Joystick port (compatible to TI-99/4A joystick slot) + - Cassette port + - Cartridge port (compatible to TI-99/4A cartridge slot, but vertically + orientated, so cartridges are plugged in from the top) + - I/O port (not compatible to TI-99/4A I/O port, needs a special P-Box + card called "Armadillo interface") + - Hexbus port (new peripheral system, also seen with later TI designs) + - Video port (composite) + + Custom chips: Five custom chips contain mapping and selection logic + - "Vaquerro": Logical address space decoder + - "Mofetta" : Physical address space decoder + - "Amigo" : Mapper + - "Pollo" : DRAM controller + - "Oso" : Hexbus interface + + Modes: + - Compatibility mode (TI-99/4A mode): Memory-mapped devices are + placed at the same location as found in the TI-99/4A, thereby + providing a good downward compatibility. + The console starts up in compatibility mode. + - Native mode (Armadillo mode): Devices are located at positions above + 0xF000 that allow for a contiguous usage of memory. + + + ROM contents + ------------ + The ROM0 chip is accessible at addresses 0000-1FFF in the logical address + space of the compatibility mode. It contains the GPL interpreter. In + native mode the ROM0 chip is invisible. + + ROM0 + offset Logical address Name + ----------------------------------- + 0000 0000-1FFF ROM0 + + + The ROM1 chip contains 32 KiB of various system software. It is located in + the physical address space, so it must be mapped into the logical address + space by defining an appropriate map. + + ROM1 + offset Physical address Name + ---------------------------------------------------------- + 0000 FFA000-FFDFFF ROM1 + 4000 FF4000-FF5FFF @CRU>2700 Text-to-speech ROM/DSR + 6000 FF4000-FF5FFF @CRU>1700 Hexbus DSR + + The DSR portions have to be selected via the CRU bits >1700 or >2700. + + + Mapper + ------ + The mapper uses 4K pages (unlike the Geneve mapper with 8K pages) which + are defined by a 32 bit word. The address bits A0-A3 serve as the page + index, whereas bits A4-A15 are the offset in the page. + From the 32 bits, 24 bits define the physical address, so this allows for + a maximum of 16 MiB of mapped-addressable memory. + + See more about the mapper in the file mapper8.c. + + + Availability of ROMs and documentation + -------------------------------------- + By written consent, TI granted free use of all software and documentation + concerning the TI-99/8, including all specifications, ROMs, and source code + of ROMs. + + + Acknowledgements + ---------------- + Special thanks go to Ciro Barile of the TI99 Italian User Club + (www.ti99iuc.it): By his courtesy we have a consistent dump of ROMs for + one of the most evolved versions of the TI-99/8 with + + - complete GROM set (with Pascal) + - complete ROM set (with Hexbus DSR and TTS) + - complete speech ROM set + + Also, by applying test programs on his real console, many unclear + specifications were resolved. + + + References + ---------- + [1] Texas Instruments: Armadillo Product Specifications, July 1983 + [2] Source code (Assembler and GPL) of the TI-99/8 ROMs and GROMs + [3] Schematics of the TI-99/8 + + + Implementation + -------------- + Initial version by Raphael Nabet, 2003. + + February 2012: Rewritten as class [Michael Zapf] + November 2013: Included new dumps [Michael Zapf] + +=========================================================================== +Known Issues (MZ, 2010-11-07) + + KEEP IN MIND THAT TEXAS INSTRUMENTS NEVER RELEASED THE TI-99/8 AND THAT + THERE ARE ONLY A FEW PROTOTYPES OF THE TI-99/8 AVAILABLE. ALL SOFTWARE + MUST BE ASSUMED TO HAVE REMAINED IN A PRELIMINARY STATE. + +- Extended Basic II does not start when a floppy controller is present. This is + a problem of the prototypical XB II which we cannot solve. It seems as if only + hexbus devices are properly supported, but we currently do not have an + emulation for those. Thus you can currently only use cassette to load and + save programs. You MUST not plug in any floppy controller when you intend to + start XB II. Other cartridges (like Editor/Assembler) + seem to be unaffected by this problem and can make use of the floppy + controllers. + Technical detail: The designers of XB II seem to have decided to put PABs + (Peripheral access block; contains pointers to buffers, the file name, and + the access modes) into CPU RAM instead of the traditional storage in VDP + RAM. The existing peripheral cards are hard-coded to interpret the given + pointer to the PAB as pointing to a VDP RAM address. That is, as soon as + the card is found, control is passed to the DSR (device service routine), + the file name will not be found, and control returns with an error. It seems + as if XB II does not properly handle this situation and may lock up + (sometimes it starts up, but file access is still not possible). + + TODO: Emulate a Hexbus floppy. + +- Multiple cartridges are not shown in the startup screen; only one + cartridge is presented. You have to manually select the cartridges with the + dip switch. + +- SAVE and OLD MINIMEM do not work properly in XB II. It seems as if the + mapper shadows the NVRAM of the cartridge. You will lose the contents when + you turn off the machine. + +*****************************************************************************/ + + +#include "emu.h" +#include "cpu/tms9900/tms9995.h" + +#include "sound/sn76496.h" +#include "sound/wave.h" +#include "machine/tms9901.h" +#include "imagedev/cassette.h" + +#include "bus/ti99x/998board.h" +#include "bus/ti99x/videowrp.h" +#include "bus/ti99x/grom.h" +#include "bus/ti99x/gromport.h" +#include "bus/ti99x/joyport.h" + +#include "bus/ti99_peb/peribox.h" + +// Debugging +#define TRACE_READY 0 +#define TRACE_INTERRUPTS 0 +#define TRACE_CRU 0 + +/* + READY bits. +*/ +enum +{ + READY_GROM = 1, + READY_MAPPER = 2, + READY_PBOX = 4, + READY_SOUND = 8, + READY_CART = 16, + READY_SPEECH = 32 +}; + +class ti99_8_state : public driver_device +{ +public: + ti99_8_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cpu(*this, "maincpu"), + m_tms9901(*this, TMS9901_TAG), + m_gromport(*this, GROMPORT_TAG), + m_peribox(*this, PERIBOX_TAG), + m_mainboard(*this, MAINBOARD8_TAG), + m_joyport(*this, JOYPORT_TAG), + m_video(*this, VIDEO_SYSTEM_TAG), + m_cassette(*this, "cassette") { } + + // Machine management + DECLARE_MACHINE_START(ti99_8); + DECLARE_MACHINE_RESET(ti99_8); + + // Processor connections with the main board + DECLARE_READ8_MEMBER( cruread ); + DECLARE_WRITE8_MEMBER( cruwrite ); + DECLARE_WRITE8_MEMBER( external_operation ); + DECLARE_WRITE_LINE_MEMBER( clock_out ); + + // Connections from outside towards the CPU (callbacks) + DECLARE_WRITE_LINE_MEMBER( console_ready_mapper ); + DECLARE_WRITE_LINE_MEMBER( console_ready_sound ); + DECLARE_WRITE_LINE_MEMBER( console_ready_pbox ); + DECLARE_WRITE_LINE_MEMBER( console_ready_cart ); + DECLARE_WRITE_LINE_MEMBER( console_ready_grom ); + DECLARE_WRITE_LINE_MEMBER( console_ready_speech ); + DECLARE_WRITE_LINE_MEMBER( console_reset ); + DECLARE_WRITE_LINE_MEMBER( notconnected ); + + // Connections with the system interface chip 9901 + DECLARE_WRITE_LINE_MEMBER( extint ); + DECLARE_WRITE_LINE_MEMBER( video_interrupt ); + + // Connections with the system interface TMS9901 + DECLARE_READ8_MEMBER(read_by_9901); + DECLARE_WRITE_LINE_MEMBER(keyC0); + DECLARE_WRITE_LINE_MEMBER(keyC1); + DECLARE_WRITE_LINE_MEMBER(keyC2); + DECLARE_WRITE_LINE_MEMBER(keyC3); + DECLARE_WRITE_LINE_MEMBER(CRUS); + DECLARE_WRITE_LINE_MEMBER(PTGEN); + DECLARE_WRITE_LINE_MEMBER(audio_gate); + DECLARE_WRITE_LINE_MEMBER(cassette_output); + DECLARE_WRITE_LINE_MEMBER(cassette_motor); + DECLARE_WRITE8_MEMBER(tms9901_interrupt); + +private: + // Keyboard support + void set_keyboard_column(int number, int data); + int m_keyboard_column; + + // READY handling + int m_nready_combined; + int m_nready_prev; + void console_ready_join(int id, int state); + + // Latch for 9901 INT2, INT1 lines + line_state m_int1; + line_state m_int2; + + // Connected devices + required_device m_cpu; + required_device m_tms9901; + required_device m_gromport; + required_device m_peribox; + required_device m_mainboard; + required_device m_joyport; + required_device m_video; + required_device m_cassette; +}; + +/* + Memory map. We have a configurable mapper, so we need to delegate the + job to the mapper completely. +*/ +static ADDRESS_MAP_START(memmap, AS_PROGRAM, 8, ti99_8_state) + AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(MAINBOARD8_TAG, mainboard8_device, readm, writem ) +ADDRESS_MAP_END + +/* + CRU map - see description above + The TMS9901 is fully decoded according to the specification, so we only + have 32 bits for it; the rest goes to the CRU bus + (decoded by the "Vaquerro" chip, signal NNOICS*) +*/ + +static ADDRESS_MAP_START(crumap, AS_IO, 8, ti99_8_state) + AM_RANGE(0x0000, 0x0003) AM_DEVREAD(TMS9901_TAG, tms9901_device, read) + AM_RANGE(0x0000, 0x02ff) AM_READ(cruread) + + AM_RANGE(0x0000, 0x001f) AM_DEVWRITE(TMS9901_TAG, tms9901_device, write) + AM_RANGE(0x0000, 0x17ff) AM_WRITE(cruwrite) +ADDRESS_MAP_END + +/* ti99/8 : 54-key keyboard */ +static INPUT_PORTS_START(ti99_8) + + /* 16 ports for keyboard and joystick */ + PORT_START("COL0") /* col 0 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALPHA LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCTN") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL1") /* col 1 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! DEL") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL2") /* col 2 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @ INS") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s S (LEFT)") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x X (DOWN)") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL3") /* col 3 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e E (UP)") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d D (RIGHT)") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL4") /* col 4 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLEAR") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL5") /* col 5 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % BEGIN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL6") /* col 6 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^ PROC'D") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL7") /* col 7 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 & AID") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL8") /* col 8 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 * REDO") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL9") /* col 9 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ( BACK") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL10") /* col 10 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL11") /* col 11 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= + QUIT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL12") /* col 12 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(SPACE)") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COL13") /* col 13 */ + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) + +INPUT_PORTS_END + +/***************************************************************************** + Components +******************************************************************************/ +#define region_sysgrom "sysgrom" + +static GROM_CONFIG(grom0_config) +{ + false, 0, region_sysgrom, 0x0000, 0x1800, GROMFREQ +}; + +static GROM_CONFIG(grom1_config) +{ + false, 1, region_sysgrom, 0x2000, 0x1800, GROMFREQ +}; + +static GROM_CONFIG(grom2_config) +{ + false, 2, region_sysgrom, 0x4000, 0x1800, GROMFREQ +}; + +/**************************************************** + PASCAL groms, 3 libraries @ 8 GROMs + Do some macro tricks to keep writing effort low +*****************************************************/ + +#define region_gromlib1 "gromlib1" +#define region_gromlib2 "gromlib2" +#define region_gromlib3 "gromlib3" + +#define MCFG_GROM_LIBRARY_ADD8(_tag, _config) \ + MCFG_DEVICE_ADD(#_tag "0", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##0) \ + MCFG_DEVICE_ADD(#_tag "1", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##1) \ + MCFG_DEVICE_ADD(#_tag "2", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##2) \ + MCFG_DEVICE_ADD(#_tag "3", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##3) \ + MCFG_DEVICE_ADD(#_tag "4", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##4) \ + MCFG_DEVICE_ADD(#_tag "5", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##5) \ + MCFG_DEVICE_ADD(#_tag "6", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##6) \ + MCFG_DEVICE_ADD(#_tag "7", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##7) + +#define MCFG_GROM_LIBRARY_ADD3(_tag, _config) \ + MCFG_DEVICE_ADD(#_tag "0", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##0) \ + MCFG_DEVICE_ADD(#_tag "1", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##1) \ + MCFG_DEVICE_ADD(#_tag "2", GROM, 0) \ + MCFG_DEVICE_CONFIG(_config##2) + +#define GROM_LIBRARY_CONFIG8(_conf, _region) \ +static GROM_CONFIG(_conf##0) \ +{ false, 0, _region, 0x0000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##1) \ +{ false, 1, _region, 0x2000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##2) \ +{ false, 2, _region, 0x4000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##3) \ +{ false, 3, _region, 0x6000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##4) \ +{ false, 4, _region, 0x8000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##5) \ +{ false, 5, _region, 0xa000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##6) \ +{ false, 6, _region, 0xc000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##7) \ +{ false, 7, _region, 0xe000, 0x1800, GROMFREQ }; + +#define GROM_LIBRARY_CONFIG3(_conf, _region) \ +static GROM_CONFIG(_conf##0) \ +{ false, 0, _region, 0x0000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##1) \ +{ false, 1, _region, 0x2000, 0x1800, GROMFREQ }; \ +static GROM_CONFIG(_conf##2) \ +{ false, 2, _region, 0x4000, 0x1800, GROMFREQ }; +GROM_LIBRARY_CONFIG8(pascal1, region_gromlib1) +GROM_LIBRARY_CONFIG8(pascal2, region_gromlib2) +GROM_LIBRARY_CONFIG3(pascal3, region_gromlib3) + +READ8_MEMBER( ti99_8_state::cruread ) +{ +// if (VERBOSE>6) logerror("read access to CRU address %04x\n", offset << 4); + UINT8 value = 0; + + // Similar to the bus8z_devices, just let the mapper, the gromport, and the p-box + // decide whether they want to change the value at the CRU address + // Also, we translate the bit addresses to base addresses + m_mainboard->crureadz(space, offset<<4, &value); + m_gromport->crureadz(space, offset<<4, &value); + m_peribox->crureadz(space, offset<<4, &value); + + if (TRACE_CRU) logerror("ti99_8: CRU %04x -> %02x\n", offset<<4, value); + return value; +} + +WRITE8_MEMBER( ti99_8_state::cruwrite ) +{ + if (TRACE_CRU) logerror("ti99_8: CRU %04x <- %x\n", offset<<1, data); + m_mainboard->cruwrite(space, offset<<1, data); + m_gromport->cruwrite(space, offset<<1, data); + m_peribox->cruwrite(space, offset<<1, data); +} + +/*************************************************************************** + TI99/8-specific tms9901 I/O handlers + These methods are callbacks from the TMS9901 system interface. That is, + they deliver the values queried via the TMS9901, and they represent + console functions which are under control of the TMS9901 (like the + keyboard column selection.) +***************************************************************************/ + +static const char *const column[] = { + "COL0", "COL1", "COL2", "COL3", "COL4", "COL5", "COL6", "COL7", + "COL8", "COL9", "COL10", "COL11", "COL12", "COL13" +}; + +READ8_MEMBER( ti99_8_state::read_by_9901 ) +{ + int answer=0; + UINT8 joyst; + switch (offset & 0x03) + { + case TMS9901_CB_INT7: + // Read pins INT3*-INT7* of TI99's 9901. + // + // bit 1: INT1 status + // bit 2: INT2 status + // bits 3-4: unused? + // bit 5: ??? + // bit 6-7: keyboard status bits 0 through 1 + + // |K|K|-|-|-|I2|I1|C| + if (m_keyboard_column >= 14) + { + // TI-99/8's wiring differs from the TI-99/4A + joyst = m_joyport->read_port(); + answer = (joyst & 0x01) | ((joyst & 0x10)>>3); + } + else + { + answer = ioport(column[m_keyboard_column])->read(); + } + answer = (answer << 6); + if (m_int1 == CLEAR_LINE) answer |= 0x02; + if (m_int2 == CLEAR_LINE) answer |= 0x04; + + break; + + case TMS9901_INT8_INT15: + // Read pins INT8*-INT15* of TI99's 9901. + // + // bit 0-2: keyboard status bits 2 to 4 + // bit 3: tape input mirror + // bit 4: unused + // bit 5-7: weird, not emulated + + // |0|0|0|0|0|K|K|K| + + if (m_keyboard_column >= 14) + { + joyst = m_joyport->read_port(); + answer = joyst << 1; + } + else + { + answer = ioport(column[m_keyboard_column])->read(); + } + answer = (answer >> 2) & 0x07; + break; + + case TMS9901_P0_P7: + // Read pins P0-P7 of TI99's 9901. None here. + break; + + case TMS9901_P8_P15: + // Read pins P8-P15 of TI99's 9901. (TI-99/8) + // + // bit 26: high + // bit 27: tape input + answer = 4; + if (m_cassette->input() > 0) + answer |= 8; + break; + } + return answer; +} + +/* + WRITE key column select (P2-P4), TI-99/8 +*/ +void ti99_8_state::set_keyboard_column(int number, int data) +{ + if (data != 0) + m_keyboard_column |= 1 << number; + else + m_keyboard_column &= ~(1 << number); + + if (m_keyboard_column >= 14) + { + m_joyport->write_port(m_keyboard_column - 13); + } +} + +WRITE_LINE_MEMBER( ti99_8_state::keyC0 ) +{ + set_keyboard_column(0, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::keyC1 ) +{ + set_keyboard_column(1, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::keyC2 ) +{ + set_keyboard_column(2, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::keyC3 ) +{ + set_keyboard_column(3, state); +} + +/* + Set 99/4A compatibility mode (CRUS=1) +*/ +WRITE_LINE_MEMBER( ti99_8_state::CRUS ) +{ + m_mainboard->CRUS_set(state==ASSERT_LINE); + + // In Armadillo mode, GROMs are located at f830; accordingly, the + // gromport must be reconfigured + if (state==ASSERT_LINE) + { + m_gromport->set_grom_base(0x9800, 0xfbf1); + } + else + { + m_gromport->set_grom_base(0xf830, 0xfff1); + } +} + +/* + Set mapper /PTGEN. This is negative logic; we use PTGE as the positive logic signal. +*/ +WRITE_LINE_MEMBER( ti99_8_state::PTGEN ) +{ + m_mainboard->PTGE_set(state==CLEAR_LINE); +} + +/* + Control cassette tape unit motor (P6) +*/ +WRITE_LINE_MEMBER( ti99_8_state::cassette_motor ) +{ + m_cassette->change_state(state==ASSERT_LINE? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); +} + +/* + Audio gate (P8) + Set to 1 before using tape: this enables the mixing of tape input sound + with computer sound. + We do not really need to emulate this as the tape recorder generates sound + on its own. +*/ +WRITE_LINE_MEMBER( ti99_8_state::audio_gate ) +{ +} + +/* + Tape output (P9) + I think polarity is correct, but don't take my word for it. +*/ +WRITE_LINE_MEMBER( ti99_8_state::cassette_output ) +{ + m_cassette->output(state==ASSERT_LINE? +1 : -1); +} + +WRITE8_MEMBER( ti99_8_state::tms9901_interrupt ) +{ + m_cpu->set_input_line(INT_9995_INT1, data); +} + +/*****************************************************************************/ + +/* + set the state of TMS9901's INT2 (called by the tms9928 core) +*/ +WRITE_LINE_MEMBER( ti99_8_state::video_interrupt ) +{ + if (TRACE_INTERRUPTS) logerror("ti99_8: VDP int 2 on tms9901, level=%02x\n", state); + m_int2 = (line_state)state; + m_tms9901->set_single_int(2, state); +} + +/*********************************************************** + Links to external devices +***********************************************************/ + +/* + We combine the incoming READY signals and propagate them to the CPU. + An alternative would be to let the CPU get the READY state, but this would + be a much higher overhead, as this happens in each clock tick. +*/ +void ti99_8_state::console_ready_join(int id, int state) +{ + if (state==CLEAR_LINE) + m_nready_combined |= id; + else + m_nready_combined &= ~id; + + if (TRACE_READY) + { + if (m_nready_prev != m_nready_combined) logerror("ti99_8: READY bits = %04x\n", ~m_nready_combined); + } + + m_nready_prev = m_nready_combined; + m_cpu->set_ready(m_nready_combined==0); +} + +/* + Connections to the READY line. This might look a bit ugly; we need an + implementation of a "Wired AND" device. +*/ +WRITE_LINE_MEMBER( ti99_8_state::console_ready_grom ) +{ + console_ready_join(READY_GROM, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::console_ready_mapper ) +{ + console_ready_join(READY_MAPPER, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::console_ready_pbox ) +{ + console_ready_join(READY_PBOX, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::console_ready_sound ) +{ + console_ready_join(READY_SOUND, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::console_ready_cart ) +{ + console_ready_join(READY_CART, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::console_ready_speech ) +{ + console_ready_join(READY_SPEECH, state); +} + +/* + The RESET line leading to a reset of the CPU. +*/ +WRITE_LINE_MEMBER( ti99_8_state::console_reset ) +{ + if (machine().phase() != MACHINE_PHASE_INIT) + { + m_cpu->set_input_line(INT_9995_RESET, state); + m_video->reset_vdp(state); + } +} + +WRITE_LINE_MEMBER( ti99_8_state::extint ) +{ + if (TRACE_READY) logerror("ti99_8: EXTINT level = %02x\n", state); + m_int1 = (line_state)state; + m_tms9901->set_single_int(1, state); +} + +WRITE_LINE_MEMBER( ti99_8_state::notconnected ) +{ + if (TRACE_READY) logerror("ti99_8: Setting a not connected line ... ignored\n"); +} + +WRITE8_MEMBER( ti99_8_state::external_operation ) +{ + static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; + if (offset == IDLE_OP) return; + else + { + logerror("ti99_4x: External operation %s not implemented on TI-99/8 board\n", extop[offset]); + } +} + +/* + Clock line from the CPU. Used to control wait state generation. +*/ +WRITE_LINE_MEMBER( ti99_8_state::clock_out ) +{ + m_mainboard->clock_in(state); +} + +/*****************************************************************************/ + +/* + Format: + Name, mode, stop, mask, select, write, read8z function, write8 function + + Multiple devices may have the same select pattern; as in the real hardware, + care must be taken that only one device actually responds. In the case of + GROMs, each chip has an internal address counter and an ID, and the chip + only responds when the ID and the most significant 3 bits match. + + NATIVE <-> CRUS=0 + TI99EM <-> CRUS=1 + + PATGEN <-> PTGEN=1 + + CONT: Mapper continues iterating through devices + STOP: Mapper stops iterating when found + + Access to the mapper registers is done directly in the mapper, not via + this list. + + TODO: This should (must) be improved in terms of performance. Every single + memory access goes through the mapper. Either we use an ordered search list, + or we order the entries according to their frequency. + (I did this right now, putting the Pascal GROMs at the end.) + We should think about a set entry where devices with the same address + are collected as one single entry (think about the Pascal lib with 21 GROMs, + twice eight and once three of them on the same address). +*/ + +#define PASCAL_GROM_LIB8(_tag, _addr) \ + { _tag "0", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "1", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "2", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "3", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "4", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "5", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "6", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "7", PATGEN, CONT, _addr, 0xfff1, 0x0000 } + +#define PASCAL_GROM_LIB3(_tag, _addr) \ + { _tag "0", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "1", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ + { _tag "2", PATGEN, CONT, _addr, 0xfff1, 0x0000 } + + +static const mapper8_list_entry mapper_devices[] = +{ + // TI-99/4A mode (CRUS=1) + // Full/partial decoding has been verified on a real machine + // GROMs: According to the spec, the 99/8 supports up to 4 GROM libraries + // (99/4A supports 256 libraries) + // at 9800, 9804, 9808, 980c. Address counter access is at 9802,6,a,e. Write access +0400. + { ROM0NAME, TI99EM, STOP, 0x0000, 0xe000, 0x0000 }, // 0000-1fff + { TISOUND_TAG, TI99EM, STOP, 0x8400, 0xfff1, 0x0000 }, // 8400-840f + { VIDEO_SYSTEM_TAG, TI99EM, STOP, 0x8800, 0xfff1, 0x0400 }, // 8800,8802 / 8c00,8c02 + { SPEECH_TAG, TI99EM, STOP, 0x9000, 0xfff1, 0x0400 }, // 9000-900f / 9400-940f + { SRAMNAME, TI99EM, STOP, 0x8000, 0xf800, 0x0000 }, // 8000-87ff; must follow the sound generator + { MAINBOARD8_TAG, TI99EM, STOP, 0x8810, 0xfff0, 0x0000 }, + + { GROM0_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // 9800,2,4,...e/9c00,2,4,...e + { GROM1_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto. + { GROM2_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto. (GROMs are connected in parallel, + { GROMPORT_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto. use internal address counter and id) + + // TI-99/8 mode + // Full/partial decoding has been verified on a real machine + // Sound ports are at f800, f802, f804, ..., f80e + // VDP ports are (f810,f812), (f814,f816), (f818,f81a), (f81c,f81e) + // Note that unmapped GROM accesses (odd addresses like F831) return FF, + // not 00 as in our emulation, so that is not quite consistent, but tolerable ... I guess + + { SRAMNAME, NATIVE, STOP, 0xf000, 0xf800, 0x0000 }, // f000-f7ff + { TISOUND_TAG, NATIVE, STOP, 0xf800, 0xfff1, 0x0000 }, // f800-f80e (even addresses) + { VIDEO_SYSTEM_TAG, NATIVE, STOP, 0xf810, 0xfff1, 0x0000 }, // f810,2 (unlike 99/4A, no different read/write ports) + { SPEECH_TAG, NATIVE, STOP, 0xf820, 0xfff1, 0x0000 }, // f820-f82f + { MAINBOARD8_TAG, NATIVE, STOP, 0xf870, 0xfff0, 0x0000 }, + + { GROM0_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, // f830-f83e (4 banks), no different read/write ports + { GROM1_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, + { GROM2_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, + { GROMPORT_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, + + PASCAL_GROM_LIB8("pascal1_grom", 0xf840), + PASCAL_GROM_LIB8("pascal2_grom", 0xf850), + PASCAL_GROM_LIB3("pascal3_grom", 0xf860), + + // Physical (need to pack this in here as well to keep config simple) + // but these lines will be put into a separate list + { DRAMNAME, PHYSIC, STOP, 0x000000, 0xff0000, 0x000000 }, // 000000-00ffff 64 KiB DRAM + { PCODENAME, PHYSIC, STOP, 0xf00000, 0xffc000, 0x000000 }, // f00000-f03fff P-Code ROM + { MAINBOARD8_TAG, PHYSIC, CONT, 0xff4000, 0xffe000, 0x000000 }, // ff4000-ff5fff Internal DSR + { GROMPORT_TAG, PHYSIC, STOP, 0xff6000, 0xffe000, 0x000000 }, // ff6000-ff7fff Cartridge ROM space + { GROMPORT_TAG, PHYSIC, STOP, 0xff8000, 0xffe000, 0x000000 }, // ff8000-ff9fff Cartridge ROM space + { ROM1A0NAME, PHYSIC, STOP, 0xffa000, 0xffe000, 0x000000 }, // ffa000-ffbfff ROM1 + { ROM1C0NAME, PHYSIC, STOP, 0xffc000, 0xffe000, 0x000000 }, // ffc000-ffdfff ROM1 + { INTSNAME, PHYSIC, STOP, 0xffe000, 0xfffff0, 0x000000 }, // ffe000-ffe00f Interrupt level sense + { PERIBOX_TAG, PHYSIC, STOP, 0x000000, 0x000000, 0x000000 }, // Peripheral Expansion Box + + { NULL, 0, 0, 0, 0, 0 } +}; + +static MAPPER8_CONFIG( mapper_conf ) +{ + mapper_devices +}; + +MACHINE_START_MEMBER(ti99_8_state,ti99_8) +{ + m_nready_combined = 0; + m_peribox->senila(CLEAR_LINE); + m_peribox->senilb(CLEAR_LINE); +} + +MACHINE_RESET_MEMBER(ti99_8_state, ti99_8) +{ + m_cpu->set_hold(CLEAR_LINE); + + // Pulling down the line on RESET configures the CPU to insert one wait + // state on external memory accesses + m_cpu->set_ready(CLEAR_LINE); + + // But we assert the line here so that the system starts running + m_nready_combined = 0; + m_gromport->set_grom_base(0x9800, 0xfff1); + + // Clear INT1 and INT2 latch + m_int1 = CLEAR_LINE; + m_int2 = CLEAR_LINE; +} + +static MACHINE_CONFIG_START( ti99_8, ti99_8_state ) + // basic machine hardware */ + // TMS9995-MP9537 CPU @ 10.7 MHz + // MP9537 mask: This variant of the TMS9995 does not contain on-chip RAM + MCFG_TMS99xx_ADD("maincpu", TMS9995_MP9537, XTAL_10_738635MHz, memmap, crumap) + MCFG_TMS9995_EXTOP_HANDLER( WRITE8(ti99_8_state, external_operation) ) + MCFG_TMS9995_CLKOUT_HANDLER( WRITELINE(ti99_8_state, clock_out) ) + + MCFG_MACHINE_START_OVERRIDE(ti99_8_state, ti99_8 ) + MCFG_MACHINE_RESET_OVERRIDE(ti99_8_state, ti99_8 ) + + /* Main board */ + MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, XTAL_10_738635MHz/4.0) + MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_8_state, read_by_9901) ) + MCFG_TMS9901_P0_HANDLER( WRITELINE( ti99_8_state, keyC0) ) + MCFG_TMS9901_P1_HANDLER( WRITELINE( ti99_8_state, keyC1) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_8_state, keyC2) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_8_state, keyC3) ) + MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_8_state, CRUS) ) + MCFG_TMS9901_P5_HANDLER( WRITELINE( ti99_8_state, PTGEN) ) + MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_8_state, cassette_motor) ) + MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_8_state, audio_gate) ) + MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_8_state, cassette_output) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_8_state, tms9901_interrupt) ) + + MCFG_MAINBOARD8_ADD( MAINBOARD8_TAG, mapper_conf ) + MCFG_MAINBOARD8_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_mapper)) + MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG ) + MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_cart) ) + MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_8_state, console_reset) ) + + /* Peripheral expansion box */ + MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_998, 0) + MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_8_state, extint) ) + MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_8_state, notconnected) ) + MCFG_PERIBOX_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_pbox) ) + + /* Sound hardware */ + MCFG_TI_SOUND_76496_ADD( TISOUND_TAG ) + MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_sound) ) + + /* Cassette drives */ + MCFG_SPEAKER_STANDARD_MONO("cass_out") + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) + + /* Console GROMs */ + MCFG_GROM_ADD( GROM0_TAG, grom0_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom)) + MCFG_GROM_ADD( GROM1_TAG, grom1_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom)) + MCFG_GROM_ADD( GROM2_TAG, grom2_config ) + MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom)) + + /* Pascal GROM libraries. */ + MCFG_GROM_LIBRARY_ADD8(pascal1_grom, pascal1) + MCFG_GROM_LIBRARY_ADD8(pascal2_grom, pascal2) + MCFG_GROM_LIBRARY_ADD3(pascal3_grom, pascal3) + + /* Devices */ + MCFG_DEVICE_ADD(SPEECH_TAG, SPEECH8, 0) + MCFG_SPEECH8_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_speech)) + + // Joystick port + MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG ) +MACHINE_CONFIG_END + +/* + TI-99/8 US version (NTSC, 60 Hz) +*/ +static MACHINE_CONFIG_DERIVED( ti99_8_60hz, ti99_8 ) + MCFG_TI998_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9118, 0x4000, ti99_8_state, video_interrupt) +MACHINE_CONFIG_END + +/* + TI-99/8 European version (PAL, 50 Hz) +*/ +static MACHINE_CONFIG_DERIVED( ti99_8_50hz, ti99_8 ) + MCFG_TI998_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9129, 0x4000, ti99_8_state, video_interrupt) +MACHINE_CONFIG_END + +/* + All ROM dumps except the speech ROM have a CRC16 checksum as the final two + bytes. ROM1 contains four 8K chunks of ROM contents with an own CRC at their + ends. All GROMs, ROM0, and the four ROM1 parts were successfully + validated. +*/ +ROM_START(ti99_8) + // Logical (CPU) memory space: ROM0 + ROM_REGION(0x2000, ROM0_TAG, 0) + ROM_LOAD("u4_rom0.bin", 0x0000, 0x2000, CRC(901eb8d6) SHA1(13190c5e834baa9c0a70066b566cfcef438ed88a)) + + // Physical memory space (mapped): ROM1 + ROM_REGION(0x8000, ROM1_TAG, 0) + ROM_LOAD("u25_rom1.bin", 0x0000, 0x8000, CRC(b574461a) SHA1(42c6aed44802cfabdd26b565d6e5ddfcd689f11e)) + + // Physical memory space (mapped): P-Code ROM + // This circuit is only available in later versions of the console and seems + // to be picky-backed on ROM1. + // To make things worse, the decoding logic of the custom chips do not show + // the required select line for this ROM on the available schematics, so + // they seem to be from the earlier version. The location in the address + // space was determined by ROM disassembly. + ROM_REGION(0x8000, PCODEROM_TAG, 0) + ROM_LOAD("u25a_pas.bin", 0x0000, 0x4000, CRC(d7ed6dd6) SHA1(32212ce6426ceccbff73d342d4a3ef699c0ae1e4)) + + // System GROMs. 3 chips @ f830 + // The schematics do not enumerate the circuits but only talk about + // "circuits on board" (COB) so we name the GROMs as gM_N.bin where M is the + // ID (0-7) and N is the access port in the logical address space. + ROM_REGION(0x6000, region_sysgrom, 0) + ROM_LOAD("g0_f830.bin", 0x0000, 0x1800, CRC(1026db60) SHA1(7327095bf4f390476e69d9fd8424e98ea1f2325a)) + ROM_LOAD("g1_f830.bin", 0x2000, 0x1800, CRC(93a43d65) SHA1(19be8a07d674bc7554c2bc9c7a5725d81e888e6e)) + ROM_LOAD("g2_f830.bin", 0x4000, 0x1800, CRC(06f2b901) SHA1(f65e0fcb2c63e230b4a9563c72f91259b94ce955)) + + // TTS & Pascal library. 8 chips @ f840 + ROM_REGION(0x10000, region_gromlib1, 0) + ROM_LOAD("g0_f840.bin", 0x0000, 0x1800, CRC(44501071) SHA1(4b5ef7f1aa43a87e7ae4f02090944be5c39b1f26)) + ROM_LOAD("g1_f840.bin", 0x2000, 0x1800, CRC(5a271d9e) SHA1(bb95befa2ffba2cc17ac437386e069e8ff621248)) + ROM_LOAD("g2_f840.bin", 0x4000, 0x1800, CRC(d52502df) SHA1(17063e33ee8709d0df8030f38bb92c4322d55e1e)) + ROM_LOAD("g3_f840.bin", 0x6000, 0x1800, CRC(86c12396) SHA1(119b6df9211b5399245e017721fc51b88b60879f)) + ROM_LOAD("g4_f840.bin", 0x8000, 0x1800, CRC(f17a2ef8) SHA1(dcb044f71d7f8a165b41f39e35a368d8f2d63b67)) + ROM_LOAD("g5_f840.bin", 0xA000, 0x1800, CRC(7dc41301) SHA1(dff714da68de352db93fba309db8e5a8ae7cab1a)) + ROM_LOAD("g6_f840.bin", 0xC000, 0x1800, CRC(7e310a90) SHA1(e927d8b3f8b32aa4fb9f7d080d5262c566a77fc7)) + ROM_LOAD("g7_f840.bin", 0xE000, 0x1800, CRC(3a9d20df) SHA1(1e6f9f8ec7df4b997a7579be742d0a7d54bc8763)) + + // Pascal library. 8 chips @ f850 + ROM_REGION(0x10000, region_gromlib2, 0) + ROM_LOAD("g0_f850.bin", 0x0000, 0x1800, CRC(2d948672) SHA1(cf15912d6dae5a450e0cfd796aa36ea5e521dc56)) + ROM_LOAD("g1_f850.bin", 0x2000, 0x1800, CRC(7d64a842) SHA1(d5884bb2af21c8027311478ee506beac6f46203d)) + ROM_LOAD("g2_f850.bin", 0x4000, 0x1800, CRC(e5ed8900) SHA1(03826882ce10fb5a6b3a9ccc85d3d1fe51979d0b)) + ROM_LOAD("g3_f850.bin", 0x6000, 0x1800, CRC(87aaf19e) SHA1(fdbe163773b8a30fa6b9508e679be6fa4f99bf7a)) + ROM_LOAD("g4_f850.bin", 0x8000, 0x1800, CRC(d3e789a5) SHA1(5ab06aa75ca694b1035ce5ac0bebacc928721388)) + ROM_LOAD("g5_f850.bin", 0xA000, 0x1800, CRC(49fd90bd) SHA1(44b2cef29c2d5304a0dcfedbdcdf9f21f2201bf9)) + ROM_LOAD("g6_f850.bin", 0xC000, 0x1800, CRC(31bac4ab) SHA1(e29049f0597d5de0bfd5c9c7bfea902abe858010)) + ROM_LOAD("g7_f850.bin", 0xE000, 0x1800, CRC(71534098) SHA1(75e87123efde885e27dd749e07cb189eb2cc45a8)) + + // Pascal library. 3 chips @ f860 + ROM_REGION(0x6000, region_gromlib3, 0) + ROM_LOAD("g0_f860.bin", 0x0000, 0x1800, CRC(0ceef210) SHA1(b89957fbff094b758746391a69dea6907c66b950)) + ROM_LOAD("g1_f860.bin", 0x2000, 0x1800, CRC(fc87de25) SHA1(4695b7f979f59a01ec16c55e4587c3379482b658)) + ROM_LOAD("g2_f860.bin", 0x4000, 0x1800, CRC(e833e350) SHA1(6ffe501981a1112be1af596a489d96e287fc6be5)) + + // Built-in RAM + ROM_REGION(SRAM_SIZE, SRAM_TAG, 0) + ROM_FILL(0x0000, SRAM_SIZE, 0x00) + + ROM_REGION(DRAM_SIZE, DRAM_TAG, 0) + ROM_FILL(0x0000, DRAM_SIZE, 0x00) +ROM_END + +#define rom_ti99_8e rom_ti99_8 + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1983, ti99_8, 0, 0, ti99_8_60hz,ti99_8, driver_device, 0, "Texas Instruments", "TI-99/8 Computer (US)" , 0) +COMP( 1983, ti99_8e, ti99_8, 0, ti99_8_50hz,ti99_8, driver_device, 0, "Texas Instruments", "TI-99/8 Computer (Europe)" , 0 ) diff --git a/src/mame/drivers/ticalc1x.c b/src/mame/drivers/ticalc1x.c new file mode 100644 index 00000000000..f043f634f17 --- /dev/null +++ b/src/mame/drivers/ticalc1x.c @@ -0,0 +1,1316 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Sean Riddle +/*************************************************************************** + + ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** + + Texas Instruments TMS1xxx family handheld calculators (mostly single-chip) + + Refer to their official manuals on how to use them. + + + TODO: + - MCU clocks are unknown where noted + +***************************************************************************/ + +#include "includes/hh_tms1k.h" + +// internal artwork +#include "dataman.lh" +#include "ti1270.lh" +#include "ti30.lh" +#include "tisr16.lh" +#include "wizatron.lh" + + +class ticalc1x_state : public hh_tms1k_state +{ +public: + ticalc1x_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + +protected: + virtual void machine_start(); +}; + + +void ticalc1x_state::machine_start() +{ + hh_tms1k_state::machine_start(); + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! +} + + + +/*************************************************************************** + + Minidrivers (subclass, I/O, Inputs, Machine Config) + +***************************************************************************/ + +/*************************************************************************** + + TI SR-16, SR-16 II + * SR-16: TMS1000 MCU labeled TMS1001NL. die labeled 1000, 1001A + * SR-16 II: TMS1000 MCU labeled TMS1016NL. die labeled 1000B, 1016A + * 12-digit 7seg LED display + + SR-16 II is a cost-reduced 'sequel', [10^x] was removed, and [pi] was added. + +***************************************************************************/ + +class tisr16_state : public ticalc1x_state +{ +public: + tisr16_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tisr16_state::prepare_display() +{ + // update leds state + for (int y = 0; y < 11; y++) + m_display_state[y] = (m_r >> y & 1) ? m_o : 0; + + // exponent sign is from R10 O1, and R10 itself only uses segment G + m_display_state[11] = m_display_state[10] << 5 & 0x40; + m_display_state[10] &= 0x40; + + set_display_size(8, 12); + display_update(); +} + +WRITE16_MEMBER(tisr16_state::write_r) +{ + // R0-R10: input mux + // R0-R10: select digit (right-to-left) + m_r = m_inp_mux = data; + prepare_display(); +} + +WRITE16_MEMBER(tisr16_state::write_o) +{ + // O0-O7: digit segments + m_o = data; + prepare_display(); +} + +READ8_MEMBER(tisr16_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(11); +} + + +// config + +static INPUT_PORTS_START( tisr16 ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("CE") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("EE") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME(UTF8_CAPITAL_SIGMA) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + + PORT_START("IN.6") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + + PORT_START("IN.7") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + + PORT_START("IN.8") // R8 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("10" UTF8_POW_X) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("e" UTF8_POW_X) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + + PORT_START("IN.9") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + + PORT_START("IN.10") // R10 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("C") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("log") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +static INPUT_PORTS_START( tisr16ii ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("C") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("CD") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("log") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("EE") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + + PORT_START("IN.6") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + + PORT_START("IN.7") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + + PORT_START("IN.8") // R8 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + + PORT_START("IN.9") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("e" UTF8_POW_X) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME(UTF8_CAPITAL_SIGMA) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + + PORT_START("IN.10") // R10 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME(UTF8_SMALL_PI) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( tisr16, tisr16_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1000, 300000) // RC osc. R=43K, C=68pf -> ~300kHz (note: tisr16ii MCU RC osc. is different: R=30K, C=100pf -> also ~300kHz) + MCFG_TMS1XXX_READ_K_CB(READ8(tisr16_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tisr16_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tisr16_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tisr16) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + TI-1270 + * TMS0970 MCU labeled TMC0974NL ZA0355, DP0974A. die labeled 0970D-74A + * 8-digit 7seg LED display + +***************************************************************************/ + +class ti1270_state : public ticalc1x_state +{ +public: + ti1270_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(ti1270_state::write_r) +{ + // R0-R7: select digit (right-to-left) + display_matrix_seg(8, 8, m_o, data, 0xff); +} + +WRITE16_MEMBER(ti1270_state::write_o) +{ + // O1-O5,O7: input mux + // O0-O7: digit segments + m_inp_mux = (data >> 1 & 0x1f) | (data >> 2 & 0x20); + m_o = data; +} + +READ8_MEMBER(ti1270_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(6); +} + + +// config + +static INPUT_PORTS_START( ti1270 ) + PORT_START("IN.0") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("CE/C") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + + PORT_START("IN.1") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + + PORT_START("IN.2") // O3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + + PORT_START("IN.3") // O4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + + PORT_START("IN.4") // O5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME(UTF8_SMALL_PI) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + + PORT_START("IN.5") // O7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ti1270, ti1270_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed + MCFG_TMS1XXX_READ_K_CB(READ8(ti1270_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1270_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1270_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ti1270) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + TI-1000 + * TMS1990 MCU labeled TMC1991NL, die labeled 1991-91A + * 8-digit 7seg LED display + +***************************************************************************/ + +class ti1000_state : public ticalc1x_state +{ +public: + ti1000_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(ti1000_state::write_r) +{ + // R0-R7: select digit (right-to-left) + UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5); + display_matrix_seg(8, 8, o, data, 0xff); +} + +WRITE16_MEMBER(ti1000_state::write_o) +{ + // O0-O3,O5(?): input mux + // O0-O7: digit segments + m_inp_mux = (data & 0xf) | (data >> 1 & 0x10); + m_o = data; +} + +READ8_MEMBER(ti1000_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( ti1000 ) + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + + PORT_START("IN.1") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + + PORT_START("IN.2") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + + // note: even though power buttons are on the matrix, they are not CPU-controlled + PORT_START("IN.3") // O3 or O4? + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("%") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + + PORT_START("IN.4") // O5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( ti1000, ti1000_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1990, 250000) // guessed + MCFG_TMS1XXX_READ_K_CB(READ8(ti1000_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1000_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1000_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ti1270) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + TI WIZ-A-TRON + * TMS0970 MCU labeled TMC0907NL ZA0379, DP0907BS. die labeled 0970F-07B + * 9-digit 7seg LED display(one custom digit) + +***************************************************************************/ + +class wizatron_state : public ticalc1x_state +{ +public: + wizatron_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE16_MEMBER(write_o); + virtual DECLARE_WRITE16_MEMBER(write_r); + virtual DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(wizatron_state::write_r) +{ + // 6th digit is custom(not 7seg), for math symbols, like this: + // \./ GAB + // --- F + // /.\ EDC + + // 3rd digit only has A and G for =, though some newer hardware revisions + // (goes for both wizatron and lilprof) use a custom equals-sign digit here + m_display_segmask[3] = 0x41; + + // R0-R8: select digit (right-to-left) + display_matrix_seg(7, 9, m_o, data, 0x7f); +} + +WRITE16_MEMBER(wizatron_state::write_o) +{ + // O1-O4: input mux + // O0-O6: digit segments A-G + // O7: N/C + m_inp_mux = data >> 1 & 0xf; + m_o = data & 0x7f; +} + +READ8_MEMBER(wizatron_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(4); +} + + +// config + +static INPUT_PORTS_START( wizatron ) + PORT_START("IN.0") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + + PORT_START("IN.1") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + + PORT_START("IN.2") // O3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + + PORT_START("IN.3") // O4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( wizatron, wizatron_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed + MCFG_TMS1XXX_READ_K_CB(READ8(wizatron_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(wizatron_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(wizatron_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_wizatron) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + TI Little Professor (1976 version) + * TMS0970 MCU labeled TMS0975NL ZA0356, GP0975CS. die labeled 0970D-75C + * 9-digit 7seg LED display(one custom digit) + + The hardware is nearly identical to Wiz-A-Tron (or vice versa, since this + one is older). + +***************************************************************************/ + +class lilprof_state : public wizatron_state +{ +public: + lilprof_state(const machine_config &mconfig, device_type type, const char *tag) + : wizatron_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE16_MEMBER(write_o); + virtual DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(lilprof_state::write_o) +{ + // O1-O4,O7: input mux + // O0-O6: digit segments A-G + m_inp_mux = (data >> 1 & 0xf) | (data >> 3 & 0x10); + m_o = data; +} + +READ8_MEMBER(lilprof_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( lilprof ) + PORT_INCLUDE( wizatron ) + + PORT_MODIFY("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_CODE(KEYCODE_DEL) PORT_NAME("Set") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") + + PORT_START("IN.4") // O7 + PORT_CONFNAME( 0x0f, 0x01, "Level") + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x02, "2" ) + PORT_CONFSETTING( 0x04, "3" ) + PORT_CONFSETTING( 0x08, "4" ) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( lilprof, lilprof_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed + MCFG_TMS1XXX_READ_K_CB(READ8(lilprof_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lilprof_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(wizatron_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_wizatron) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + TI Little Professor (1978 version) + * TMS1990 MCU labeled TMC1993NL. die labeled 1990C-c3C + * 9-digit 7seg LED display(one custom digit) + + 1978 re-release, with on/off and level select on buttons instead of + switches. The casing was slightly revised in 1980 again, but same rom. + +***************************************************************************/ + +class lilprof78_state : public ticalc1x_state +{ +public: + lilprof78_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(lilprof78_state::write_r) +{ + // update leds state + UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f; + UINT16 r = (data & 7) | (data << 1 & 0x1f0); + + for (int y = 0; y < 9; y++) + m_display_state[y] = (r >> y & 1) ? o : 0; + + // 3rd digit A/G(equals sign) is from O7 + m_display_state[3] = (r && m_o & 0x80) ? 0x41 : 0; + + // 6th digit is a custom 7seg for math symbols (see wizatron_state write_r) + m_display_state[6] = BITSWAP8(m_display_state[6],7,6,1,4,2,3,5,0); + + set_display_size(7, 9); + display_update(); +} + +WRITE16_MEMBER(lilprof78_state::write_o) +{ + // O0-O3,O5(?): input mux + // O0-O6: digit segments A-G + // O7: 6th digit + m_inp_mux = (data & 0xf) | (data >> 1 & 0x10); + m_o = data; +} + +READ8_MEMBER(lilprof78_state::read_k) +{ + // K: multiplexed inputs + return read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( lilprof78 ) + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + + PORT_START("IN.1") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + + PORT_START("IN.2") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + + // note: even though power buttons are on the matrix, they are not CPU-controlled + PORT_START("IN.3") // O3 or O4? + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Set") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("Level") + + PORT_START("IN.4") // O5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( lilprof78, lilprof78_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1990, 250000) // guessed + MCFG_TMS1XXX_READ_K_CB(READ8(lilprof78_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lilprof78_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(lilprof78_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_wizatron) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + TI DataMan + * TMS1980 MCU labeled TMC1982NL. die labeled 1980A 82B + * 10-digit cyan VFD display(3 digits are custom) + +***************************************************************************/ + +class dataman_state : public ticalc1x_state +{ +public: + dataman_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void dataman_state::prepare_display() +{ + // note the extra segment on R9 + display_matrix_seg(8, 9, m_o | (m_r >> 2 & 0x80), m_r & 0x1ff, 0x7f); +} + +WRITE16_MEMBER(dataman_state::write_r) +{ + // R0-R4: input mux + // R0-R8: select digit + // R9: =(equals sign) segment + m_r = m_inp_mux = data; + prepare_display(); +} + +WRITE16_MEMBER(dataman_state::write_o) +{ + // O0-O6: digit segments A-G + m_o = BITSWAP8(data,7,1,6,5,4,3,2,0) & 0x7f; + prepare_display(); +} + +READ8_MEMBER(dataman_state::read_k) +{ + // K: multiplexed inputs (note: the Vss row is always on) + return m_inp_matrix[5]->read() | read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( dataman ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Memory Bank") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Go") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Force Out") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("Number Guesser") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Wipe Out") + + // note: even though power buttons are on the matrix, they are not CPU-controlled + PORT_START("IN.5") // Vss! + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_U) PORT_NAME("On/User Entry") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("?") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Electro Flash") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( dataman, dataman_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1980, 300000) // patent says 300kHz + MCFG_TMS1XXX_READ_K_CB(READ8(dataman_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(dataman_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(dataman_state, write_r)) + MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_dataman) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Majestic-line calculators: + * TI-30(aka SR-40): TMS0980 MCU labeled TMC0981NL. die labeled 0980B-81F + * TI Programmer: TMS0980 MCU labeled ZA0675NL, JP0983AT. die labeled 0980B-83 + * TI Business Analyst-I: TMS0980 MCU labeled TMC0982NL. die labeled 0980B-82F + * 9-digit 7seg LED display + + Of note is a peripheral by Schoenherr, called the Braillotron. It acts as + a docking station to the TI-30, with an additional display made of magnetic + refreshable Braille cells. The TI-30 itself is slightly modified to wire + the original LED display to a 25-pin D-Sub connector. + +***************************************************************************/ + +class majestic_state : public ticalc1x_state +{ +public: + majestic_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(majestic_state::write_r) +{ + // note: 1st digit only has segments B,F,G,DP + m_display_segmask[0] = 0xe2; + + // R0-R8: select digit + UINT8 o = BITSWAP8(m_o,7,5,2,1,4,0,6,3); + display_matrix_seg(8, 9, o, data, 0xff); +} + +WRITE16_MEMBER(majestic_state::write_o) +{ + // O0-O2,O4-O7: input mux + // O0-O7: digit segments + m_inp_mux = (data & 7) | (data >> 1 & 0x78); + m_o = data; +} + +READ8_MEMBER(majestic_state::read_k) +{ + // K: multiplexed inputs (note: the Vss row is always on) + return m_inp_matrix[7]->read() | read_inputs(7); +} + + +// config + +static INPUT_PORTS_START( ti30 ) + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_NAME("K") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("log") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("EE" UTF8_DOWN) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)") + + PORT_START("IN.1") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + + PORT_START("IN.2") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + + PORT_START("IN.3") // O4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME(UTF8_SMALL_PI) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("%") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")") + + PORT_START("IN.4") // O5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("SUM") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + + PORT_START("IN.5") // O6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_NAME("DRG") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_NAME("INV") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("cos") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("sin") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("tan") + + PORT_START("IN.6") // O7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("EXC") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") + + // note: even though power buttons are on the matrix, they are not CPU-controlled + PORT_START("IN.7") // Vss! + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) +INPUT_PORTS_END + + +static INPUT_PORTS_START( tiprog ) + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_NAME("K") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("SHF") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("E") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_NAME("d") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_NAME("F") + + PORT_START("IN.1") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("OR") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + + PORT_START("IN.2") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("AND") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + + PORT_START("IN.3") // O4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("1'sC") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_NAME("b") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("A") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("C") + + PORT_START("IN.4") // O5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("XOR") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + + PORT_START("IN.5") // O6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("SUM") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(") + + PORT_START("IN.6") // O7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("CE") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") + + // note: even though power buttons are on the matrix, they are not CPU-controlled + PORT_START("IN.7") // Vss! + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_PGUP) PORT_NAME("C/ON") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("DEC") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_NAME("OCT") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_NAME("HEX") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) +INPUT_PORTS_END + + +static INPUT_PORTS_START( tibusan1 ) + // PORT_NAME lists functions under [2nd] as secondaries. + PORT_START("IN.0") // O0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X" " UTF8_POW_X"" UTF8_SQUAREROOT"y") // 2nd one implies xth root of y + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("% " UTF8_CAPITAL_DELTA"%") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("SEL") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("CST") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("MAR") + + PORT_START("IN.1") // O1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO m") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + + PORT_START("IN.2") // O2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL b") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + + PORT_START("IN.3") // O4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME(UTF8_CAPITAL_SIGMA"+ " UTF8_CAPITAL_SIGMA"-") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("( AN-CI\"") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("x<>y L.R.") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(") 1/x") + + PORT_START("IN.4") // O5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("SUM x" UTF8_PRIME) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + + PORT_START("IN.5") // O6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_NAME("FV") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("N") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME("PMT") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_NAME("%i") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_NAME("PV") + + PORT_START("IN.6") // O7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("EXC x" UTF8_PRIME) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") + + // note: even though power buttons are on the matrix, they are not CPU-controlled + PORT_START("IN.7") // Vss! + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("2nd") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2" " UTF8_SQUAREROOT"x") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x) e" UTF8_POW_X) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) +INPUT_PORTS_END + + +static MACHINE_CONFIG_START( majestic, majestic_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0980, 400000) // guessed + MCFG_TMS1XXX_READ_K_CB(READ8(majestic_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(majestic_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(majestic_state, write_r)) + MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_ti30) + + /* no video! */ + + /* no sound! */ +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( tisr16 ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "tms1001nl", 0x0000, 0x0400, CRC(b7ce3c1d) SHA1(95cdb0c6be31043f4fe06314ed41c0ca1337bc46) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1000_sr16_micro.pla", 0, 867, CRC(5b35019c) SHA1(730d3b9041ed76d57fbedd73b009477fe432b386) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1000_sr16_output.pla", 0, 365, CRC(29b08739) SHA1(d55f01e40a2d493d45ea422f12e63b01bcde08fb) ) +ROM_END + + +ROM_START( tisr16ii ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "tms1016nl", 0x0000, 0x0400, CRC(c07a7b27) SHA1(34ea4d3b59871e08db74f8c5bfb7ff00d1f0adc7) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1000_sr16ii_micro.pla", 0, 867, CRC(31b43e95) SHA1(6864e4c20f3affffcd3810dcefbc9484dd781547) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1000_sr16ii_output.pla", 0, 365, CRC(c45dfbd0) SHA1(5d588c1abc317134b51eb08ac3953f1009d80056) ) +ROM_END + + +ROM_START( ti1270 ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "za0355", 0x0000, 0x0400, CRC(48e09b4b) SHA1(17f27167164df223f9f06082ece4c3fc3900eda3) ) + + ROM_REGION( 782, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) + ROM_REGION( 860, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0970_ti1270_micro.pla", 0, 860, CRC(6ff5d51d) SHA1(59d3e5de290ba57694068ddba78d21a0c1edf427) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0970_ti1270_output.pla", 0, 352, CRC(f39bf0a4) SHA1(160341490043eb369720d5f487cf0f59f458a93e) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0970_common2_segment.pla", 0, 157, CRC(56c37a4f) SHA1(18ecc20d2666e89673739056483aed5a261ae927) ) +ROM_END + + +ROM_START( ti1000 ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "tmc1991nl", 0x0000, 0x0400, CRC(2da5381d) SHA1(b5dc14553db2068ed48e130e5ec9109930d8cda9) ) + + ROM_REGION( 782, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) + ROM_REGION( 860, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0970_common1_micro.pla", 0, 860, CRC(7f50ab2e) SHA1(bff3be9af0e322986f6e545b567c97d70e135c93) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0970_ti1000_output.pla", 0, 352, CRC(1d82061a) SHA1(90e4a4b0fb3b4ae5965da90479b7fed737ad8831) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0970_ti1000_segment.pla", 0, 157, CRC(234ca3a8) SHA1(76844dd87cb380a07c8fcbef143038087e98f138) ) +ROM_END + + +ROM_START( wizatron ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "za0379", 0x0000, 0x0400, CRC(5a6af094) SHA1(b1f27e1f13f4db3b052dd50fb08dbf9c4d8db26e) ) + + ROM_REGION( 782, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) + ROM_REGION( 860, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0970_common1_micro.pla", 0, 860, CRC(7f50ab2e) SHA1(bff3be9af0e322986f6e545b567c97d70e135c93) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0970_wizatron_output.pla", 0, 352, CRC(745a3900) SHA1(031b55a0cf783c8a88eec4289d4373eb8538f374) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0970_common2_segment.pla", 0, 157, CRC(56c37a4f) SHA1(18ecc20d2666e89673739056483aed5a261ae927) ) +ROM_END + + +ROM_START( lilprof ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "za0356", 0x0000, 0x0400, CRC(fef9dd39) SHA1(5c9614c9c5092d55dabeee2d6e0387d50d6ad4d5) ) + + ROM_REGION( 782, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) + ROM_REGION( 860, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0970_lilprof_micro.pla", 0, 860, CRC(6ff5d51d) SHA1(59d3e5de290ba57694068ddba78d21a0c1edf427) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0970_lilprof_output.pla", 0, 352, CRC(c74daf97) SHA1(c4948000196171b34d4fe9cdd2962a945da9883d) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0970_common2_segment.pla", 0, 157, CRC(56c37a4f) SHA1(18ecc20d2666e89673739056483aed5a261ae927) ) +ROM_END + +ROM_START( lilprof78 ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "tmc1993nl", 0x0000, 0x0400, CRC(e941316b) SHA1(7e1542045d1e731cea81a639c9ac9e91bb233b15) ) + + ROM_REGION( 782, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) + ROM_REGION( 860, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0970_common1_micro.pla", 0, 860, CRC(7f50ab2e) SHA1(bff3be9af0e322986f6e545b567c97d70e135c93) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0970_lilprof78_output.pla", 0, 352, CRC(03f509c4) SHA1(691554a55db0c5950df848077095f23a991b1909) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0970_lilprof78_segment.pla", 0, 157, CRC(234ca3a8) SHA1(76844dd87cb380a07c8fcbef143038087e98f138) ) +ROM_END + + +ROM_START( dataman ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD16_WORD( "tmc1982nl", 0x0000, 0x1000, CRC(3521f53f) SHA1(c46fe7fe20715fdf5aed65833fb867cfd3938062) ) // it matches with source code in patent US4340374 + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2056, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1980_dataman_micro.pla", 0, 2056, CRC(b733b621) SHA1(7897d7db72c0c24555e58738a09ebe0f7f7689b0) ) + ROM_REGION( 525, "maincpu:opla", 0 ) + ROM_LOAD( "tms1980_dataman_output.pla", 0, 525, CRC(5fc6f451) SHA1(11475c785c34eab5b13c5dc67f413c709cd4bd4d) ) +ROM_END + + +ROM_START( ti30 ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD16_WORD( "tmc0981nl", 0x0000, 0x1000, CRC(41298a14) SHA1(06f654c70add4044a612d3a38b0c2831c188fd0c) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 1982, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0980_ti30_output.pla", 0, 352, CRC(38788410) SHA1(cb3d1a61190b887cd2e6d9c60b4fdb9b901f7eed) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) +ROM_END + + +ROM_START( tibusan1 ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD16_WORD( "tmc0982nl", 0x0000, 0x1000, CRC(6954560a) SHA1(6c153a0c9239a811e3514a43d809964c06f8f88e) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 1982, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0980_tibusan1_output.pla", 0, 352, CRC(38788410) SHA1(cb3d1a61190b887cd2e6d9c60b4fdb9b901f7eed) ) + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) +ROM_END + + +ROM_START( tiprog ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD16_WORD( "za0675nl", 0x0000, 0x1000, CRC(82355854) SHA1(03fab373bce04df8ea3fe25352525e8539213626) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 1982, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0980_tiprog_micro.pla", 0, 1982, CRC(57043284) SHA1(0fa06d5865830ecdb3d870271cb92ac917bed3ca) ) + ROM_REGION( 352, "maincpu:opla", 0 ) + ROM_LOAD( "tms0980_tiprog_output.pla", 0, 352, BAD_DUMP CRC(2a63956f) SHA1(26a62ca2b5973d8564e580e12230292f6d2888d9) ) // corrected by hand + ROM_REGION( 157, "maincpu:spla", 0 ) + ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1974, tisr16, 0, 0, tisr16, tisr16, driver_device, 0, "Texas Instruments", "SR-16", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1975, tisr16ii, 0, 0, tisr16, tisr16ii, driver_device, 0, "Texas Instruments", "SR-16 II", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) + +COMP( 1976, ti1270, 0, 0, ti1270, ti1270, driver_device, 0, "Texas Instruments", "TI-1270", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1977, ti1000, 0, 0, ti1000, ti1000, driver_device, 0, "Texas Instruments", "TI-1000", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1977, wizatron, 0, 0, wizatron, wizatron, driver_device, 0, "Texas Instruments", "Wiz-A-Tron", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1976, lilprof, 0, 0, lilprof, lilprof, driver_device, 0, "Texas Instruments", "Little Professor (1976 version)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1978, lilprof78, lilprof, 0, lilprof78, lilprof78, driver_device, 0, "Texas Instruments", "Little Professor (1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) + +COMP( 1977, dataman, 0, 0, dataman, dataman, driver_device, 0, "Texas Instruments", "DataMan", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) + +COMP( 1976, ti30, 0, 0, majestic, ti30, driver_device, 0, "Texas Instruments", "TI-30", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1977, tiprog, 0, 0, majestic, tiprog, driver_device, 0, "Texas Instruments", "TI Programmer", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1979, tibusan1, 0, 0, majestic, tibusan1, driver_device, 0, "Texas Instruments", "TI Business Analyst-I", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/tiki100.c b/src/mame/drivers/tiki100.c new file mode 100644 index 00000000000..d15fa011db3 --- /dev/null +++ b/src/mame/drivers/tiki100.c @@ -0,0 +1,745 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Tiki 100 + + 12/05/2009 Skeleton driver. + + http://www.djupdal.org/tiki/ + +****************************************************************************/ + +/* + + TODO: + + - 3 expansion slots + - palette RAM should be written during HBLANK + - DART clocks + - winchester hard disk + - analog/digital I/O + - light pen + - 8088 CPU card + - 360KB floppy format + +*/ + +#include "includes/tiki100.h" +#include "bus/rs232/rs232.h" + +/* Memory Banking */ + +READ8_MEMBER( tiki100_state::gfxram_r ) +{ + UINT16 addr = (offset + (m_scroll << 7)) & TIKI100_VIDEORAM_MASK; + + return m_video_ram[addr]; +} + +WRITE8_MEMBER( tiki100_state::gfxram_w ) +{ + UINT16 addr = (offset + (m_scroll << 7)) & TIKI100_VIDEORAM_MASK; + + m_video_ram[addr] = data; +} + +void tiki100_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + if (m_vire) + { + if (!m_rome) + { + /* reserved */ + program.unmap_readwrite(0x0000, 0xffff); + } + else + { + /* GFXRAM, GFXRAM, RAM */ + program.install_readwrite_handler(0x0000, 0x7fff, READ8_DELEGATE(tiki100_state, gfxram_r), WRITE8_DELEGATE(tiki100_state, gfxram_w)); + program.install_readwrite_bank(0x8000, 0xffff, "bank3"); + + membank("bank1")->set_entry(BANK_VIDEO_RAM); + membank("bank2")->set_entry(BANK_VIDEO_RAM); + membank("bank3")->set_entry(BANK_RAM); + } + } + else + { + if (!m_rome) + { + /* ROM, RAM, RAM */ + program.install_read_bank(0x0000, 0x3fff, "bank1"); + program.unmap_write(0x0000, 0x3fff); + program.install_readwrite_bank(0x4000, 0x7fff, "bank2"); + program.install_readwrite_bank(0x8000, 0xffff, "bank3"); + + membank("bank1")->set_entry(BANK_ROM); + membank("bank2")->set_entry(BANK_RAM); + membank("bank3")->set_entry(BANK_RAM); + } + else + { + /* RAM, RAM, RAM */ + program.install_readwrite_bank(0x0000, 0x3fff, "bank1"); + program.install_readwrite_bank(0x4000, 0x7fff, "bank2"); + program.install_readwrite_bank(0x8000, 0xffff, "bank3"); + + membank("bank1")->set_entry(BANK_RAM); + membank("bank2")->set_entry(BANK_RAM); + membank("bank3")->set_entry(BANK_RAM); + } + } +} + +/* Read/Write Handlers */ + +READ8_MEMBER( tiki100_state::keyboard_r ) +{ + UINT8 data = 0xff; + + switch (m_keylatch) + { + case 0: data = m_y1->read(); break; + case 1: data = m_y2->read(); break; + case 2: data = m_y3->read(); break; + case 3: data = m_y4->read(); break; + case 4: data = m_y5->read(); break; + case 5: data = m_y6->read(); break; + case 6: data = m_y7->read(); break; + case 7: data = m_y8->read(); break; + case 8: data = m_y9->read(); break; + case 9: data = m_y10->read(); break; + case 10: data = m_y11->read(); break; + case 11: data = m_y12->read(); break; + } + + m_keylatch++; + if (m_keylatch == 12) m_keylatch = 0; + + return data; +} + +WRITE8_MEMBER( tiki100_state::keyboard_w ) +{ + m_keylatch = 0; +} + +WRITE8_MEMBER( tiki100_state::video_mode_w ) +{ + /* + + bit description + + 0 palette entry bit 0 + 1 palette entry bit 1 + 2 palette entry bit 2 + 3 palette entry bit 3 + 4 mode select bit 0 + 5 mode select bit 1 + 6 unused + 7 write color during HBLANK + + */ + + m_mode = data; + + if (BIT(data, 7)) + { + int color = data & 0x0f; + UINT8 colordata = ~m_palette_val; + + m_palette->set_pen_color(color, pal3bit(colordata >> 5), pal3bit(colordata >> 2), pal2bit(colordata >> 0)); + } +} + +WRITE8_MEMBER( tiki100_state::palette_w ) +{ + /* + + bit description + + 0 blue intensity bit 0 + 1 blue intensity bit 1 + 2 green intensity bit 0 + 3 green intensity bit 1 + 4 green intensity bit 2 + 5 red intensity bit 0 + 6 red intensity bit 1 + 7 red intensity bit 2 + + */ + + m_palette_val = data; +} + +WRITE8_MEMBER( tiki100_state::system_w ) +{ + /* + + bit signal description + + 0 DRIS0 drive select 0 + 1 DRIS1 drive select 1 + 2 _ROME enable ROM at 0000-3fff + 3 VIRE enable video RAM at 0000-7fff + 4 SDEN single density select (0=DD, 1=SD) + 5 _LMP0 GRAFIKK key led + 6 MOTON floppy motor + 7 _LMP1 LOCK key led + + */ + + // drive select + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + + // density select + m_fdc->dden_w(BIT(data, 4)); + + // floppy motor + if (floppy) floppy->mon_w(!BIT(data, 6)); + + /* GRAFIKK key led */ + set_led_status(machine(), 1, BIT(data, 5)); + + /* LOCK key led */ + set_led_status(machine(), 2, BIT(data, 7)); + + /* bankswitch */ + m_rome = BIT(data, 2); + m_vire = BIT(data, 3); + + bankswitch(); +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( tiki100_mem, AS_PROGRAM, 8, tiki100_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank3") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tiki100_io, AS_IO, 8, tiki100_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_MIRROR(0x03) AM_READWRITE(keyboard_r, keyboard_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, cd_ba_r, cd_ba_w) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x03) AM_WRITE(video_mode_w) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(FD1797_TAG, fd1797_t, read, write) + AM_RANGE(0x14, 0x14) AM_MIRROR(0x01) AM_WRITE(palette_w) + AM_RANGE(0x16, 0x16) AM_DEVWRITE(AY8912_TAG, ay8910_device, address_w) + AM_RANGE(0x17, 0x17) AM_DEVREADWRITE(AY8912_TAG, ay8910_device, data_r, data_w) + AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x1c, 0x1c) AM_MIRROR(0x03) AM_WRITE(system_w) +// AM_RANGE(0x20, 0x27) AM_NOP // winchester controller +// AM_RANGE(0x60, 0x6f) analog I/O (SINTEF) +// AM_RANGE(0x60, 0x67) digital I/O (RVO) +// AM_RANGE(0x70, 0x77) analog/digital I/O +// AM_RANGE(0x78, 0x7b) light pen +// AM_RANGE(0x7e, 0x7f) 8088/87 processor w/128KB RAM +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( tiki100 ) +/* + | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | + ----+---------+---------+---------+---------+---------+---------+---------+---------+ + 1 | CTRL | SHIFT | BRYT | RETUR | MLMROM | / (num) | SLETT | | + 2 | GRAFIKK | 1 | ANGRE | a | < | z | q | LOCK | + 3 | 2 | w | s | x | 3 | e | d | c | + 4 | 4 | r | f | v | 5 | t | g | b | + 5 | 6 | y | h | n | 7 | u | j | m | + 6 | 8 | i | k | , | 9 | o | l | . | + 7 | 0 | p | ? | - | + | ? | ? | HJELP | + 8 | @ | ^ | ' | VENSTRE | UTVID | F1 | F4 | SIDEOPP | + 9 | F2 | F3 | F5 | F6 | OPP | SIDENED | VTAB | NED | + 10 | + (num) | - (num) | * (num) | 7 (num) | 8 (num) | 9 (num) | % (num) | = (num) | + 11 | 4 (num) | 5 (num) | 6 (num) | HTAB | 1 (num) | 0 (num) | . (num) | | + 12 | HJEM | H?YRE | 2 (num) | 3 (num) | ENTER | | | | + ----+---------+---------+---------+---------+---------+---------+---------+---------+ +*/ + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BRYTT") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MLMROM") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad /") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SLETT") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAFIKK") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ANGRE") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\xB8 \xC3\x98") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\xA5 \xC3\x85") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\xA6 \xC3\x86") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HJELP") + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('^') PORT_CHAR('|') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\'') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UTVID") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SIDEOPP") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SIDENED") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("VTAB") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("Y10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad %") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") + + PORT_START("Y11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HTAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) PORT_CHAR('\t') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y12") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HJEM") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +/* Video */ + +UINT32 tiki100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT16 addr = (m_scroll << 7); + int sx, y, pixel, mode = (m_mode >> 4) & 0x03; + + for (y = 0; y < 256; y++) + { + for (sx = 0; sx < 128; sx++) + { + UINT8 data = m_video_ram[addr & TIKI100_VIDEORAM_MASK]; + + switch (mode) + { + case 0: + for (pixel = 0; pixel < 8; pixel++) + { + int x = (sx * 8) + pixel; + + bitmap.pix32(y, x) = palette[0]; + } + break; + + case 1: /* 1024x256x2 */ + for (pixel = 0; pixel < 8; pixel++) + { + int x = (sx * 8) + pixel; + int color = BIT(data, 0); + + bitmap.pix32(y, x) = palette[color]; + + data >>= 1; + } + break; + + case 2: /* 512x256x4 */ + for (pixel = 0; pixel < 4; pixel++) + { + int x = (sx * 8) + (pixel * 2); + int color = data & 0x03; + + bitmap.pix32(y, x) = palette[color]; + bitmap.pix32(y, x + 1) = palette[color]; + + data >>= 2; + } + break; + + case 3: /* 256x256x16 */ + for (pixel = 0; pixel < 2; pixel++) + { + int x = (sx * 8) + (pixel * 4); + int color = data & 0x0f; + + bitmap.pix32(y, x) = palette[color]; + bitmap.pix32(y, x + 1) = palette[color]; + bitmap.pix32(y, x + 2) = palette[color]; + bitmap.pix32(y, x + 3) = palette[color]; + + data >>= 4; + } + break; + } + + addr++; + } + } + + return 0; +} + +/* Z80-PIO Interface */ + +DECLARE_WRITE_LINE_MEMBER( tiki100_state::write_centronics_ack ) +{ + m_centronics_ack = state; +} + +DECLARE_WRITE_LINE_MEMBER( tiki100_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +DECLARE_WRITE_LINE_MEMBER( tiki100_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +READ8_MEMBER( tiki100_state::pio_pb_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 ACK + 5 BUSY + 6 NO PAPER + 7 UNIT SELECT, tape in + + */ + + UINT8 data = 0; + + // centronics + data |= m_centronics_ack << 4; + data |= m_centronics_busy << 5; + data |= m_centronics_perror << 6; + + // cassette + data |= (m_cassette->input() > 0.0) << 7; + + return data; +} + +WRITE8_MEMBER( tiki100_state::pio_pb_w ) +{ + /* + + bit description + + 0 STRB + 1 + 2 + 3 + 4 + 5 + 6 tape out + 7 + + */ + + // centronics + m_centronics->write_strobe(BIT(data, 0)); + + // cassette + m_cassette->output(BIT(data, 6) ? -1 : 1); +} + +/* Z80-CTC Interface */ + +TIMER_DEVICE_CALLBACK_MEMBER(tiki100_state::ctc_tick) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); + + m_ctc->trg1(1); + m_ctc->trg1(0); +} + +WRITE_LINE_MEMBER( tiki100_state::ctc_z0_w ) +{ + m_ctc->trg2(state); + + m_dart->rxca_w(state); + m_dart->txca_w(state); +} + +WRITE_LINE_MEMBER( tiki100_state::ctc_z2_w ) +{ + m_ctc->trg3(state); +} + +/* FD1797 Interface */ + +FLOPPY_FORMATS_MEMBER( tiki100_state::floppy_formats ) + FLOPPY_TIKI100_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( tiki100_floppies ) + SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) // Tead FD-55A + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Teac FD-55F +SLOT_INTERFACE_END + +/* AY-3-8912 Interface */ + +WRITE8_MEMBER( tiki100_state::video_scroll_w ) +{ + m_scroll = data; +} + +/* Z80 Daisy Chain */ + +static const z80_daisy_config tiki100_daisy_chain[] = +{ + { Z80CTC_TAG }, + { Z80DART_TAG }, + { Z80PIO_TAG }, + { NULL } +}; + + + +TIMER_DEVICE_CALLBACK_MEMBER( tiki100_state::tape_tick ) +{ + m_pio->port_b_write((m_cassette->input() > 0.0) << 7); +} + +/* Machine Start */ + +void tiki100_state::machine_start() +{ + /* allocate video RAM */ + m_video_ram.allocate(TIKI100_VIDEORAM_SIZE); + + /* setup memory banking */ + UINT8 *ram = m_ram->pointer(); + + membank("bank1")->configure_entry(BANK_ROM, m_rom->base()); + membank("bank1")->configure_entry(BANK_RAM, ram); + membank("bank1")->configure_entry(BANK_VIDEO_RAM, m_video_ram); + + membank("bank2")->configure_entry(BANK_RAM, ram + 0x4000); + membank("bank2")->configure_entry(BANK_VIDEO_RAM, m_video_ram + 0x4000); + + membank("bank3")->configure_entry(BANK_RAM, ram + 0x8000); + + bankswitch(); + + /* register for state saving */ + save_item(NAME(m_rome)); + save_item(NAME(m_vire)); + save_item(NAME(m_scroll)); + save_item(NAME(m_mode)); + save_item(NAME(m_palette_val)); + save_item(NAME(m_keylatch)); +} + +void tiki100_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + system_w(space, 0, 0); +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( tiki100, tiki100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) + MCFG_CPU_PROGRAM_MAP(tiki100_mem) + MCFG_CPU_IO_MAP(tiki100_io) + MCFG_CPU_CONFIG(tiki100_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(tiki100_state, screen_update) + MCFG_SCREEN_SIZE(1024, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 256-1) + + MCFG_PALETTE_ADD("palette", 16) + // pixel clock 20.01782 MHz + + /* devices */ + MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_8MHz/4, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_8MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_IN_PB_CB(READ8(tiki100_state, pio_pb_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(tiki100_state, pio_pb_w)) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_8MHz/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(tiki100_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(tiki100_state, ctc_z2_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", tiki100_state, ctc_tick, attotime::from_hz(XTAL_8MHz/4)) + + MCFG_FD1797_ADD(FD1797_TAG, XTAL_8MHz/8) // FD1767PL-02 or FD1797-PL + MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":0", tiki100_floppies, "525qd", tiki100_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":1", tiki100_floppies, "525qd", tiki100_state::floppy_formats) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(tiki100_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(tiki100_state, write_centronics_busy)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(tiki100_state, write_centronics_perror)) + + MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_CASSETTE_ADD(CASSETTE_TAG) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", tiki100_state, tape_tick, attotime::from_hz(44100)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(AY8912_TAG, AY8912, XTAL_8MHz/4) + MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(tiki100_state, video_scroll_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "tiki100") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( kontiki ) + ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF ) + ROM_LOAD( "tikirom-1.30.u10", 0x0000, 0x2000, CRC(c482dcaf) SHA1(d140706bb7fc8b1fbb37180d98921f5bdda73cf9) ) + + ROM_REGION( 0x100, "proms", 0 ) + ROM_LOAD( "63ls140.u4", 0x000, 0x100, NO_DUMP ) +ROM_END + +ROM_START( tiki100 ) + ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS( "v203w" ) + + ROM_SYSTEM_BIOS( 0, "v135", "TIKI ROM v1.35" ) + ROMX_LOAD( "tikirom-1.35.u10", 0x0000, 0x2000, CRC(7dac5ee7) SHA1(14d622fd843833faec346bf5357d7576061f5a3d), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v203w", "TIKI ROM v2.03 W" ) + ROMX_LOAD( "tikirom-2.03w.u10", 0x0000, 0x2000, CRC(79662476) SHA1(96336633ecaf1b2190c36c43295ac9f785d1f83a), ROM_BIOS(2) ) + + ROM_REGION( 0x100, "proms", 0 ) + ROM_LOAD( "63ls140.u4", 0x000, 0x100, NO_DUMP ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, kontiki, 0, 0, tiki100, tiki100, driver_device, 0, "Kontiki Data A/S", "KONTIKI 100", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, tiki100, kontiki, 0, tiki100, tiki100, driver_device, 0, "Tiki Data A/S", "TIKI 100", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tim011.c b/src/mame/drivers/tim011.c new file mode 100644 index 00000000000..005efa249a2 --- /dev/null +++ b/src/mame/drivers/tim011.c @@ -0,0 +1,165 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + TIM-011 + + 04/09/2010 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z180/z180.h" +#include "machine/upd765.h" + +#define FDC9266_TAG "u43" + +class tim011_state : public driver_device +{ +public: + tim011_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_fdc(*this, FDC9266_TAG), + m_floppy0(*this, FDC9266_TAG ":0:35dd"), + m_floppy1(*this, FDC9266_TAG ":1:35dd"), + m_floppy2(*this, FDC9266_TAG ":2:35dd"), + m_floppy3(*this, FDC9266_TAG ":3:35dd") { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_tim011(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE8_MEMBER(print_w); + DECLARE_WRITE8_MEMBER(scroll_w); + DECLARE_WRITE8_MEMBER(fdc_dma_w); + DECLARE_READ8_MEMBER(print_r); + DECLARE_READ8_MEMBER(scroll_r); + UINT8 m_scroll; + + required_device m_maincpu; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; +}; + + +static ADDRESS_MAP_START(tim011_mem, AS_PROGRAM, 8, tim011_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x01fff) AM_ROM AM_MIRROR(0x3e000) + AM_RANGE(0x40000, 0x7ffff) AM_RAM // 256KB RAM 8 * 41256 DRAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tim011_io, AS_IO, 8, tim011_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x007f) AM_RAM /* Z180 internal registers */ + AM_RANGE(0x0080, 0x009f) AM_DEVICE(FDC9266_TAG, upd765a_device, map) + //AM_RANGE(0x00a0, 0x00a0) AM_MIRROR(0x001f) AM_WRITE(fdc_dma_w) + //AM_RANGE(0x00c0, 0x00c1) AM_MIRROR(0x000e) AM_READWRITE(print_r,print_w) + //AM_RANGE(0x00d0, 0x00d0) AM_MIRROR(0x000f) AM_READWRITE(scroll_r,scroll_w) + AM_RANGE(0x8000, 0xffff) AM_RAM // Video RAM 43256 SRAM (32KB) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( tim011 ) +INPUT_PORTS_END + +void tim011_state::machine_reset() +{ + // motor is actually connected on TXS pin of CPU + m_floppy0->mon_w(0); + m_floppy1->mon_w(0); + m_floppy2->mon_w(0); + m_floppy3->mon_w(0); +} + +void tim011_state::video_start() +{ +} + +UINT32 tim011_state::screen_update_tim011(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +WRITE8_MEMBER(tim011_state::fdc_dma_w) +{ + printf("fdc_dma_w :%02x\n",data); +} + +WRITE8_MEMBER(tim011_state::print_w) +{ + //printf("print_w :%02x\n",data); +} + +READ8_MEMBER(tim011_state::print_r) +{ + //printf("print_r\n"); + return 0; +} + +WRITE8_MEMBER(tim011_state::scroll_w) +{ + m_scroll = data; +} + +READ8_MEMBER(tim011_state::scroll_r) +{ + return m_scroll; +} + +static SLOT_INTERFACE_START( tim011_floppies ) + SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) +SLOT_INTERFACE_END + +static const floppy_format_type tim011_floppy_formats[] = { + FLOPPY_IMD_FORMAT, + FLOPPY_MFI_FORMAT, + FLOPPY_MFM_FORMAT, + NULL +}; + +static MACHINE_CONFIG_START( tim011,tim011_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z180, XTAL_12_288MHz / 2) // location U17 HD64180 + MCFG_CPU_PROGRAM_MAP(tim011_mem) + MCFG_CPU_IO_MAP(tim011_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", tim011_state, irq0_line_hold) + +// MCFG_CPU_ADD("keyboard",CDP1802, XTAL_1_75MHz) // CDP1802, uknown clock + + // FDC9266 location U43 XTAL_8MHz + MCFG_UPD765A_ADD(FDC9266_TAG, true, true) + MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ2)) + + /* floppy drives */ + MCFG_FLOPPY_DRIVE_ADD(FDC9266_TAG ":0", tim011_floppies, "35dd", tim011_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC9266_TAG ":1", tim011_floppies, "35dd", tim011_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC9266_TAG ":2", tim011_floppies, "35dd", tim011_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC9266_TAG ":3", tim011_floppies, "35dd", tim011_floppy_formats) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) + MCFG_SCREEN_UPDATE_DRIVER(tim011_state, screen_update_tim011) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( tim011 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "sys_tim011.u16", 0x0000, 0x2000, CRC(5b4f1300) SHA1(d324991c4292d7dcde8b8d183a57458be8a2be7b)) + ROM_REGION( 0x10000, "keyboard", ROMREGION_ERASEFF ) + ROM_LOAD( "keyb_tim011.bin", 0x0000, 0x1000, CRC(a99c40a6) SHA1(d6d505271d91df4e079ec3c0a4abbe75ae9d649b)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, tim011, 0, 0, tim011, tim011, driver_device, 0, "Mihajlo Pupin Institute", "TIM-011", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/tim100.c b/src/mame/drivers/tim100.c new file mode 100644 index 00000000000..212a2e60f39 --- /dev/null +++ b/src/mame/drivers/tim100.c @@ -0,0 +1,168 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + TIM-100 Terminal + Mihajlo Pupin Institute + + 21/12/2012 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8251.h" +#include "video/i8275.h" + +class tim100_state : public driver_device +{ +public: + tim100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_palette; + virtual void machine_start(); + virtual void machine_reset(); + I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); + +private: + UINT8 *m_charmap; +}; + +static ADDRESS_MAP_START(tim100_mem, AS_PROGRAM, 8, tim100_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM // 2764 at U16 + AM_RANGE(0x2000, 0x27ff) AM_RAM // 2KB static ram CDM6116A at U15 + + AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("i8276", i8275_device, read, write) + + AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("uart_u17", i8251_device, status_r, control_w) + AM_RANGE(0x6001, 0x6001) AM_DEVREADWRITE("uart_u17", i8251_device, data_r, data_w) + + AM_RANGE(0x8000, 0x8000) AM_DEVREADWRITE("uart_u18", i8251_device, status_r, control_w) + AM_RANGE(0x8001, 0x8001) AM_DEVREADWRITE("uart_u18", i8251_device, data_r, data_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tim100_io, AS_IO, 8, tim100_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( tim100 ) +INPUT_PORTS_END + +static const rgb_t tim100_palette[3] = { + rgb_t(0x00, 0x00, 0x00), // black + rgb_t(0xa0, 0xa0, 0xa0), // white + rgb_t(0xff, 0xff, 0xff) // highlight +}; + +void tim100_state::machine_start() +{ + m_charmap = memregion("chargen")->base(); +} + +void tim100_state::machine_reset() +{ + m_palette->set_pen_colors(0, tim100_palette, ARRAY_LENGTH(tim100_palette)); +} + +const gfx_layout tim100_charlayout = +{ + 12, 16, /* 8x16 characters */ + 256, /* 128 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {0,1,2,3,4,5,0x8000,0x8001,0x8002,0x8003,0x8004,0x8005}, + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, + 8 * 8, 9 * 8, 10 * 8, 11 * 8, 12 * 8, 13 * 8, 14 * 8, 15 * 8}, + 8*16 /* space between characters */ +}; + +static GFXDECODE_START( tim100 ) + GFXDECODE_ENTRY( "chargen", 0x0000, tim100_charlayout, 0, 1 ) +GFXDECODE_END + + +// this gets called via a (i8275_dack_w), so does nothing currently +// once fixed, pixel count needs adjusting +I8275_DRAW_CHARACTER_MEMBER( tim100_state::crtc_display_pixels ) +{ + int i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 pixels = m_charmap[(linecount & 15) + (charcode << 4)]; + if (vsp) + { + pixels = 0; + } + + if (lten) + { + pixels = 0xff; + } + + if (rvv) + { + pixels ^= 0xff; + } + + for(i=0;i<8;i++) // 6 pixels + { + bitmap.pix32(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + } +} + +static MACHINE_CONFIG_START( tim100, tim100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8085A, XTAL_4_9152MHz) // divider unknown + MCFG_CPU_PROGRAM_MAP(tim100_mem) + MCFG_CPU_IO_MAP(tim100_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DEVICE("i8276", i8275_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(40*16, 16*16) + MCFG_SCREEN_VISIBLE_AREA(0, 40*16-1, 0, 16*16-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", tim100 ) + + MCFG_DEVICE_ADD("i8276", I8275, XTAL_4_9152MHz) + MCFG_I8275_CHARACTER_WIDTH(16) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(tim100_state, crtc_display_pixels) + MCFG_I8275_IRQ_CALLBACK(INPUTLINE("maincpu", I8085_RST65_LINE)) + + MCFG_PALETTE_ADD("palette", 3) + + MCFG_DEVICE_ADD("uart_u17", I8251, 0) + MCFG_DEVICE_ADD("uart_u18", I8251, 0) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( tim100 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "tim 100 v.3.2.0.u16", 0x0000, 0x2000, CRC(4de9c8ad) SHA1(b0914d6e8d618e92a87b4b39c35391541251e8cc)) + + // The first and 2nd halves of these roms are identical, confirmed ok + ROM_REGION( 0x2000, "chargen", ROMREGION_INVERT ) + ROM_SYSTEM_BIOS( 0, "212", "v 2.1.2" ) + ROMX_LOAD( "tim 100kg v.2.1.2.u12", 0x0000, 0x0800, CRC(faf5743c) SHA1(310b662e9535878210f8aaab3e2b846fade60642),ROM_BIOS(1)) + ROM_CONTINUE (0x1000, 0x0800) + ROM_CONTINUE (0x0800, 0x0800) + ROM_CONTINUE (0x1800, 0x0800) + ROM_SYSTEM_BIOS( 1, "220", "v 2.2.0" ) + ROMX_LOAD( "tim 100kg v.2.2.0.u12", 0x0000, 0x0800, CRC(358dbbd3) SHA1(14b7d6ee41b19bedf2f070f5b28b03aaff2cac4f),ROM_BIOS(2)) + ROM_CONTINUE (0x1000, 0x0800) + ROM_CONTINUE (0x0800, 0x0800) + ROM_CONTINUE (0x1800, 0x0800) +ROM_END + +/* Driver */ +COMP( 1985, tim100, 0, 0, tim100, tim100, driver_device, 0, "Mihajlo Pupin Institute", "TIM-100", MACHINE_IS_SKELETON) diff --git a/src/mame/drivers/timex.c b/src/mame/drivers/timex.c new file mode 100644 index 00000000000..806b6887571 --- /dev/null +++ b/src/mame/drivers/timex.c @@ -0,0 +1,781 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/*************************************************************************** + + NOTE: ****** Specbusy: press N, R, or E to boot ************* + + + Spectrum/Inves/TK90X etc. memory map: + + CPU: + 0000-3fff ROM + 4000-ffff RAM + + Spectrum 128/+2/+2a/+3 memory map: + + CPU: + 0000-3fff Banked ROM/RAM (banked rom only on 128/+2) + 4000-7fff Banked RAM + 8000-bfff Banked RAM + c000-ffff Banked RAM + + TS2068 memory map: (Can't have both EXROM and DOCK active) + The 8K EXROM can be loaded into multiple pages. + + CPU: + 0000-1fff ROM / EXROM / DOCK (Cartridge) + 2000-3fff ROM / EXROM / DOCK + 4000-5fff \ + 6000-7fff \ + 8000-9fff |- RAM / EXROM / DOCK + a000-bfff | + c000-dfff / + e000-ffff / + + +Interrupts: + +Changes: + +29/1/2000 KT - Implemented initial +3 emulation. +30/1/2000 KT - Improved input port decoding for reading and therefore + correct keyboard handling for Spectrum and +3. +31/1/2000 KT - Implemented buzzer sound for Spectrum and +3. + Implementation copied from Paul Daniel's Jupiter driver. + Fixed screen display problems with dirty chars. + Added support to load .Z80 snapshots. 48k support so far. +13/2/2000 KT - Added Interface II, Kempston, Fuller and Mikrogen + joystick support. +17/2/2000 DJR - Added full key descriptions and Spectrum+ keys. + Fixed Spectrum +3 keyboard problems. +17/2/2000 KT - Added tape loading from WAV/Changed from DAC to generic + speaker code. +18/2/2000 KT - Added tape saving to WAV. +27/2/2000 KT - Took DJR's changes and added my changes. +27/2/2000 KT - Added disk image support to Spectrum +3 driver. +27/2/2000 KT - Added joystick I/O code to the Spectrum +3 I/O handler. +14/3/2000 DJR - Tape handling dipswitch. +26/3/2000 DJR - Snapshot files are now classifed as snapshots not + cartridges. +04/4/2000 DJR - Spectrum 128 / +2 Support. +13/4/2000 DJR - +4 Support (unofficial 48K hack). +13/4/2000 DJR - +2a Support (rom also used in +3 models). +13/4/2000 DJR - TK90X, TK95 and Inves support (48K clones). +21/4/2000 DJR - TS2068 and TC2048 support (TC2048 Supports extra video + modes but doesn't have bank switching or sound chip). +09/5/2000 DJR - Spectrum +2 (France, Spain), +3 (Spain). +17/5/2000 DJR - Dipswitch to enable/disable disk drives on +3 and clones. +27/6/2000 DJR - Changed 128K/+3 port decoding (sound now works in Zub 128K). +06/8/2000 DJR - Fixed +3 Floppy support +10/2/2001 KT - Re-arranged code and split into each model emulated. + Code is split into 48k, 128k, +3, tc2048 and ts2048 + segments. 128k uses some of the functions in 48k, +3 + uses some functions in 128, and tc2048/ts2048 use some + of the functions in 48k. The code has been arranged so + these functions come in some kind of "override" order, + read functions changed to use READ8_HANDLER and write + functions changed to use WRITE8_HANDLER. + Added Scorpion256 preliminary. +18/6/2001 DJR - Added support for Interface 2 cartridges. +xx/xx/2001 KS - TS-2068 sound fixed. + Added support for DOCK cartridges for TS-2068. + Added Spectrum 48k Psycho modified rom driver. + Added UK-2086 driver. +23/12/2001 KS - 48k machines are now able to run code in screen memory. + Programs which keep their code in screen memory + like monitors, tape copiers, decrunchers, etc. + works now. + Fixed problem with interrupt vector set to 0xffff (much + more 128k games works now). + A useful used trick on the Spectrum is to set + interrupt vector to 0xffff (using the table + which contain 0xff's) and put a byte 0x18 hex, + the opcode for JR, at this address. The first + byte of the ROM is a 0xf3 (DI), so the JR will + jump to 0xfff4, where a long JP to the actual + interrupt routine is put. Due to unideal + bankswitching in MAME this JP were to 0001 what + causes Spectrum to reset. Fixing this problem + made much more software runing (i.e. Paperboy). + Corrected frames per second value for 48k and 128k + Sincalir machines. + There are 50.08 frames per second for Spectrum + 48k what gives 69888 cycles for each frame and + 50.021 for Spectrum 128/+2/+2A/+3 what gives + 70908 cycles for each frame. + Remaped some Spectrum+ keys. + Presing F3 to reset was seting 0xf7 on keyboard + input port. Problem occurred for snapshots of + some programms where it was readed as pressing + key 4 (which is exit in Tapecopy by R. Dannhoefer + for example). + Added support to load .SP snapshots. + Added .BLK tape images support. + .BLK files are identical to .TAP ones, extension + is an only difference. +08/03/2002 KS - #FF port emulation added. + Arkanoid works now, but is not playable due to + completly messed timings. + +Initialisation values used when determining which model is being emulated: + 48K Spectrum doesn't use either port. + 128K/+2 Bank switches with port 7ffd only. + +3/+2a Bank switches with both ports. + +Notes: + 1. No contented memory. + 2. No hi-res colour effects (need contended memory first for accurate timing). + 3. Multiface 1 and Interface 1 not supported. + 4. Horace and the Spiders cartridge doesn't run properly. + 5. Tape images not supported: + .TZX, .SPC, .ITM, .PAN, .TAP(Warajevo), .VOC, .ZXS. + 6. Snapshot images not supported: + .ACH, .PRG, .RAW, .SEM, .SIT, .SNX, .ZX, .ZXS, .ZX82. + 7. 128K emulation is not perfect - the 128K machines crash and hang while + running quite a lot of games. + 8. Disk errors occur on some +3 games. + 9. Video hardware of all machines is timed incorrectly. +10. EXROM and HOME cartridges are not emulated. +11. The TK90X and TK95 roms output 0 to port #df on start up. +12. The purpose of this port is unknown (probably display mode as TS2068) and + thus is not emulated. + +Very detailed infos about the ZX Spectrum +3e can be found at + +http://www.z88forever.org.uk/zxplus3e/ + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "includes/spectrum.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" +#include "sound/ay8910.h" +#include "formats/tzx_cas.h" +#include "machine/spec_snqk.h" +#include "machine/beta.h" +#include "machine/ram.h" + +/****************************************************************************************************/ +/* TS2048 specific functions */ + + +READ8_MEMBER( spectrum_state::ts2068_port_f4_r ) +{ + return m_port_f4_data; +} + +WRITE8_MEMBER( spectrum_state::ts2068_port_f4_w ) +{ + m_port_f4_data = data; + ts2068_update_memory(); +} + +READ8_MEMBER( spectrum_state::ts2068_port_ff_r ) +{ + return m_port_ff_data; +} + +WRITE8_MEMBER( spectrum_state::ts2068_port_ff_w ) +{ + /* Bits 0-2 Video Mode Select + Bits 3-5 64 column mode ink/paper selection + (See ts2068_vh_screenrefresh for more info) + Bit 6 17ms Interrupt Inhibit + Bit 7 Cartridge (0) / EXROM (1) select + */ + m_port_ff_data = data; + ts2068_update_memory(); + logerror("Port %04x write %02x\n", offset, data); +} + +/******************************************************************* + * + * Bank switch between the 3 internal memory banks HOME, EXROM + * and DOCK (Cartridges). The HOME bank contains 16K ROM in the + * 0-16K area and 48K RAM fills the rest. The EXROM contains 8K + * ROM and can appear in every 8K segment (ie 0-8K, 8-16K etc). + * The DOCK is empty and is meant to be occupied by cartridges + * you can plug into the cartridge dock of the 2068. + * + * The address space is divided into 8 8K chunks. Bit 0 of port + * #f4 corresponds to the 0-8K chunk, bit 1 to the 8-16K chunk + * etc. If the bit is 0 then the chunk is controlled by the HOME + * bank. If the bit is 1 then the chunk is controlled by either + * the DOCK or EXROM depending on bit 7 of port #ff. Note this + * means that that the Z80 can't see chunks of the EXROM and DOCK + * at the same time. + * + *******************************************************************/ +void spectrum_state::ts2068_update_memory() +{ + UINT8 *messram = m_ram->pointer(); + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *DOCK = m_dock_crt->base(); + UINT8 *ExROM = memregion("maincpu")->base() + 0x014000; + UINT8 *ChosenROM; + + if (m_port_f4_data & 0x01) + { + if (m_port_ff_data & 0x80) + { + space.install_read_bank(0x0000, 0x1fff, "bank1"); + space.unmap_write(0x0000, 0x1fff); + membank("bank1")->set_base(ExROM); + logerror("0000-1fff EXROM\n"); + } + else + { + if (m_dock_cart_type == TIMEX_CART_DOCK) + { + membank("bank1")->set_base(DOCK); + space.install_read_bank(0x0000, 0x1fff, "bank1"); + if (m_ram_chunks & 0x01) + space.install_write_bank(0x0000, 0x1fff, "bank9"); + else + space.unmap_write(0x0000, 0x1fff); + + + } + else + { + space.nop_read(0x0000, 0x1fff); + space.unmap_write(0x0000, 0x1fff); + } + logerror("0000-1fff Cartridge\n"); + } + } + else + { + ChosenROM = memregion("maincpu")->base() + 0x010000; + membank("bank1")->set_base(ChosenROM); + space.install_read_bank(0x0000, 0x1fff, "bank1"); + space.unmap_write(0x0000, 0x1fff); + logerror("0000-1fff HOME\n"); + } + + if (m_port_f4_data & 0x02) + { + if (m_port_ff_data & 0x80) + { + membank("bank2")->set_base(ExROM); + space.install_read_bank(0x2000, 0x3fff, "bank2"); + space.unmap_write(0x2000, 0x3fff); + logerror("2000-3fff EXROM\n"); + } + else + { + if (m_dock_cart_type == TIMEX_CART_DOCK) + { + membank("bank2")->set_base(DOCK+0x2000); + space.install_read_bank(0x2000, 0x3fff, "bank2"); + if (m_ram_chunks & 0x02) + space.install_write_bank(0x2000, 0x3fff, "bank10"); + else + space.unmap_write(0x2000, 0x3fff); + + } + else + { + space.nop_read(0x2000, 0x3fff); + space.unmap_write(0x2000, 0x3fff); + } + logerror("2000-3fff Cartridge\n"); + } + } + else + { + ChosenROM = memregion("maincpu")->base() + 0x012000; + membank("bank2")->set_base(ChosenROM); + space.install_read_bank(0x2000, 0x3fff, "bank2"); + space.unmap_write(0x2000, 0x3fff); + logerror("2000-3fff HOME\n"); + } + + if (m_port_f4_data & 0x04) + { + if (m_port_ff_data & 0x80) + { + membank("bank3")->set_base(ExROM); + space.install_read_bank(0x4000, 0x5fff, "bank3"); + space.unmap_write(0x4000, 0x5fff); + logerror("4000-5fff EXROM\n"); + } + else + { + if (m_dock_cart_type == TIMEX_CART_DOCK) + { + membank("bank3")->set_base(DOCK+0x4000); + space.install_read_bank(0x4000, 0x5fff, "bank3"); + if (m_ram_chunks & 0x04) + space.install_write_bank(0x4000, 0x5fff, "bank11"); + else + space.unmap_write(0x4000, 0x5fff); + } + else + { + space.nop_read(0x4000, 0x5fff); + space.unmap_write(0x4000, 0x5fff); + } + logerror("4000-5fff Cartridge\n"); + } + } + else + { + membank("bank3")->set_base(messram); + membank("bank11")->set_base(messram); + space.install_read_bank(0x4000, 0x5fff, "bank3"); + space.install_write_bank(0x4000, 0x5fff, "bank11"); + logerror("4000-5fff RAM\n"); + } + + if (m_port_f4_data & 0x08) + { + if (m_port_ff_data & 0x80) + { + membank("bank4")->set_base(ExROM); + space.install_read_bank(0x6000, 0x7fff, "bank4"); + space.unmap_write(0x6000, 0x7fff); + logerror("6000-7fff EXROM\n"); + } + else + { + if (m_dock_cart_type == TIMEX_CART_DOCK) + { + membank("bank4")->set_base(DOCK+0x6000); + space.install_read_bank(0x6000, 0x7fff, "bank4"); + if (m_ram_chunks & 0x08) + space.install_write_bank(0x6000, 0x7fff, "bank12"); + else + space.unmap_write(0x6000, 0x7fff); + } + else + { + space.nop_read(0x6000, 0x7fff); + space.unmap_write(0x6000, 0x7fff); + } + logerror("6000-7fff Cartridge\n"); + } + } + else + { + membank("bank4")->set_base(messram + 0x2000); + membank("bank12")->set_base(messram + 0x2000); + space.install_read_bank(0x6000, 0x7fff, "bank4"); + space.install_write_bank(0x6000, 0x7fff, "bank12"); + logerror("6000-7fff RAM\n"); + } + + if (m_port_f4_data & 0x10) + { + if (m_port_ff_data & 0x80) + { + membank("bank5")->set_base(ExROM); + space.install_read_bank(0x8000, 0x9fff, "bank5"); + space.unmap_write(0x8000, 0x9fff); + logerror("8000-9fff EXROM\n"); + } + else + { + if (m_dock_cart_type == TIMEX_CART_DOCK) + { + membank("bank5")->set_base(DOCK+0x8000); + space.install_read_bank(0x8000, 0x9fff,"bank5"); + if (m_ram_chunks & 0x10) + space.install_write_bank(0x8000, 0x9fff,"bank13"); + else + space.unmap_write(0x8000, 0x9fff); + } + else + { + space.nop_read(0x8000, 0x9fff); + space.unmap_write(0x8000, 0x9fff); + } + logerror("8000-9fff Cartridge\n"); + } + } + else + { + membank("bank5")->set_base(messram + 0x4000); + membank("bank13")->set_base(messram + 0x4000); + space.install_read_bank(0x8000, 0x9fff,"bank5"); + space.install_write_bank(0x8000, 0x9fff,"bank13"); + logerror("8000-9fff RAM\n"); + } + + if (m_port_f4_data & 0x20) + { + if (m_port_ff_data & 0x80) + { + membank("bank6")->set_base(ExROM); + space.install_read_bank(0xa000, 0xbfff, "bank6"); + space.unmap_write(0xa000, 0xbfff); + logerror("a000-bfff EXROM\n"); + } + else + { + if (m_dock_cart_type == TIMEX_CART_DOCK) + { + membank("bank6")->set_base(DOCK+0xa000); + space.install_read_bank(0xa000, 0xbfff, "bank6"); + if (m_ram_chunks & 0x20) + space.install_write_bank(0xa000, 0xbfff, "bank14"); + else + space.unmap_write(0xa000, 0xbfff); + + } + else + { + space.nop_read(0xa000, 0xbfff); + space.unmap_write(0xa000, 0xbfff); + } + logerror("a000-bfff Cartridge\n"); + } + } + else + { + membank("bank6")->set_base(messram + 0x6000); + membank("bank14")->set_base(messram + 0x6000); + space.install_read_bank(0xa000, 0xbfff, "bank6"); + space.install_write_bank(0xa000, 0xbfff, "bank14"); + logerror("a000-bfff RAM\n"); + } + + if (m_port_f4_data & 0x40) + { + if (m_port_ff_data & 0x80) + { + membank("bank7")->set_base(ExROM); + space.install_read_bank(0xc000, 0xdfff, "bank7"); + space.unmap_write(0xc000, 0xdfff); + logerror("c000-dfff EXROM\n"); + } + else + { + if (m_dock_cart_type == TIMEX_CART_DOCK) + { + membank("bank7")->set_base(DOCK+0xc000); + space.install_read_bank(0xc000, 0xdfff, "bank7"); + if (m_ram_chunks & 0x40) + space.install_write_bank(0xc000, 0xdfff, "bank15"); + else + space.unmap_write(0xc000, 0xdfff); + } + else + { + space.nop_read(0xc000, 0xdfff); + space.unmap_write(0xc000, 0xdfff); + } + logerror("c000-dfff Cartridge\n"); + } + } + else + { + membank("bank7")->set_base(messram + 0x8000); + membank("bank15")->set_base(messram + 0x8000); + space.install_read_bank(0xc000, 0xdfff, "bank7"); + space.install_write_bank(0xc000, 0xdfff, "bank15"); + logerror("c000-dfff RAM\n"); + } + + if (m_port_f4_data & 0x80) + { + if (m_port_ff_data & 0x80) + { + membank("bank8")->set_base(ExROM); + space.install_read_bank(0xe000, 0xffff, "bank8"); + space.unmap_write(0xe000, 0xffff); + logerror("e000-ffff EXROM\n"); + } + else + { + if (m_dock_cart_type == TIMEX_CART_DOCK) + { + membank("bank8")->set_base(DOCK+0xe000); + space.install_read_bank(0xe000, 0xffff, "bank8"); + if (m_ram_chunks & 0x80) + space.install_write_bank(0xe000, 0xffff, "bank16"); + else + space.unmap_write(0xe000, 0xffff); + } + else + { + space.nop_read(0xe000, 0xffff); + space.unmap_write(0xe000, 0xffff); + } + logerror("e000-ffff Cartridge\n"); + } + } + else + { + membank("bank8")->set_base(messram + 0xa000); + membank("bank16")->set_base(messram + 0xa000); + space.install_read_bank(0xe000, 0xffff, "bank8"); + space.install_write_bank(0xe000, 0xffff, "bank16"); + logerror("e000-ffff RAM\n"); + } +} + +static ADDRESS_MAP_START(ts2068_io, AS_IO, 8, spectrum_state ) + AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r ) AM_MIRROR(0xff00) + AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r ) AM_MIRROR(0xff00) + AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r ) AM_MIRROR(0xff00) + AM_RANGE(0xf4, 0xf4) AM_READWRITE(ts2068_port_f4_r,ts2068_port_f4_w ) AM_MIRROR(0xff00) + AM_RANGE(0xf5, 0xf5) AM_DEVWRITE("ay8912", ay8910_device, address_w ) AM_MIRROR(0xff00) + AM_RANGE(0xf6, 0xf6) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, data_w ) AM_MIRROR(0xff00) + AM_RANGE(0xfe, 0xfe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w ) AM_MIRROR(0xff00) AM_MASK(0xffff) + AM_RANGE(0xff, 0xff) AM_READWRITE(ts2068_port_ff_r,ts2068_port_ff_w ) AM_MIRROR(0xff00) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ts2068_mem, AS_PROGRAM, 8, spectrum_state ) + AM_RANGE(0x0000, 0x1fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank9") + AM_RANGE(0x2000, 0x3fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank10") + AM_RANGE(0x4000, 0x5fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank11") + AM_RANGE(0x6000, 0x7fff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank12") + AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank13") + AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank14") + AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank7") AM_WRITE_BANK("bank15") + AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank16") +ADDRESS_MAP_END + + +MACHINE_RESET_MEMBER(spectrum_state,ts2068) +{ + m_port_ff_data = 0; + m_port_f4_data = 0; + + std::string region_tag; + m_dock_crt = memregion(region_tag.assign(m_dock->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + m_dock_cart_type = m_dock_crt ? TIMEX_CART_DOCK : TIMEX_CART_NONE; + + ts2068_update_memory(); + MACHINE_RESET_CALL_MEMBER(spectrum); +} + + +/****************************************************************************************************/ +/* TC2048 specific functions */ + + +WRITE8_MEMBER( spectrum_state::tc2048_port_ff_w ) +{ + m_port_ff_data = data; + logerror("Port %04x write %02x\n", offset, data); +} + +static ADDRESS_MAP_START(tc2048_io, AS_IO, 8, spectrum_state ) + AM_RANGE(0x00, 0x00) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) + AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) + AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) + AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) + AM_RANGE(0xff, 0xff) AM_READWRITE(ts2068_port_ff_r,tc2048_port_ff_w) AM_MIRROR(0xff00) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tc2048_mem, AS_PROGRAM, 8, spectrum_state ) + AM_RANGE( 0x0000, 0x3fff) AM_ROM + AM_RANGE( 0x4000, 0xffff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") +ADDRESS_MAP_END + +MACHINE_RESET_MEMBER(spectrum_state,tc2048) +{ + UINT8 *messram = m_ram->pointer(); + + membank("bank1")->set_base(messram); + membank("bank2")->set_base(messram); + m_port_ff_data = 0; + m_port_f4_data = -1; + MACHINE_RESET_CALL_MEMBER(spectrum); +} + + +DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart ) +{ + UINT32 size = m_dock->common_get_size("rom"); + + if (image.software_entry() == NULL) + { + UINT8 *DOCK; + int chunks_in_file = 0; + dynamic_buffer header; + header.resize(9); + + if (size % 0x2000 != 9) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted"); + return IMAGE_INIT_FAIL; + } + if (image.software_entry() != NULL) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Loading from softlist is not supported yet"); + return IMAGE_INIT_FAIL; + } + + m_dock->rom_alloc(0x10000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + DOCK = m_dock->get_rom_base(); + + // check header + image.fread(&header[0], 9); + + for (int i = 0; i < 8; i++) + if (header[i + 1] & 0x02) chunks_in_file++; + + if (chunks_in_file * 0x2000 + 0x09 != size) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted"); + return IMAGE_INIT_FAIL; + } + + switch (header[0]) + { + case 0x00: logerror ("DOCK cart\n"); + m_ram_chunks = 0; + for (int i = 0; i < 8; i++) + { + m_ram_chunks = m_ram_chunks | ((header[i + 1] & 0x01) << i); + if (header[i + 1] & 0x02) + image.fread(DOCK + i * 0x2000, 0x2000); + else + { + if (header[i + 1] & 0x01) + memset(DOCK + i * 0x2000, 0x00, 0x2000); + else + memset(DOCK + i * 0x2000, 0xff, 0x2000); + } + } + break; + + default: + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cart type not supported"); + return IMAGE_INIT_FAIL; + } + + logerror ("Cart loaded [Chunks %02x]\n", m_ram_chunks); + } + else + { + m_dock->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + memcpy(m_dock->get_rom_base(), image.get_software_region("rom"), size); + } + + return IMAGE_INIT_PASS; +} + + +/* F4 Character Displayer - tc2048 code is inherited from the spectrum */ +static const gfx_layout ts2068_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 96, /* 96 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( ts2068 ) + GFXDECODE_ENTRY( "maincpu", 0x13d00, ts2068_charlayout, 0, 8 ) +GFXDECODE_END + +static MACHINE_CONFIG_DERIVED( ts2068, spectrum_128 ) + MCFG_CPU_REPLACE("maincpu", Z80, XTAL_14_112MHz/4) /* From Schematic; 3.528 MHz */ + MCFG_CPU_PROGRAM_MAP(ts2068_mem) + MCFG_CPU_IO_MAP(ts2068_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", spectrum_state, spec_interrupt) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, ts2068 ) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(TS2068_SCREEN_WIDTH, TS2068_SCREEN_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, TS2068_SCREEN_WIDTH-1, 0, TS2068_SCREEN_HEIGHT-1) + MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_ts2068) + MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_timex) + + MCFG_GFXDECODE_MODIFY("gfxdecode", ts2068) + + MCFG_VIDEO_START_OVERRIDE(spectrum_state, ts2068 ) + + /* sound */ + MCFG_SOUND_REPLACE("ay8912", AY8912, XTAL_14_112MHz/8) /* From Schematic; 1.764 MHz */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* cartridge */ + MCFG_DEVICE_REMOVE("cartslot") + MCFG_GENERIC_CARTSLOT_ADD("dockslot", generic_plain_slot, "timex_cart") + MCFG_GENERIC_EXTENSIONS("dck,bin") + MCFG_GENERIC_LOAD(spectrum_state, timex_cart) + + /* Software lists */ + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list", "timex_dock") + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( uk2086, ts2068 ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(50) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( tc2048, spectrum ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(tc2048_mem) + MCFG_CPU_IO_MAP(tc2048_io) + + MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, tc2048 ) + + /* video hardware */ + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(TS2068_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, TS2068_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1) + MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_tc2048) + MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_timex) + + MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum_128 ) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("48K") +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(tc2048) + ROM_REGION(0x10000,"maincpu",0) + ROM_LOAD("tc2048.rom",0x0000,0x4000, CRC(f1b5fa67) SHA1(febb2d495b6eda7cdcb4074935d6e9d9f328972d)) +ROM_END + +ROM_START(ts2068) + ROM_REGION(0x16000,"maincpu",0) + ROM_LOAD("ts2068_h.rom",0x10000,0x4000, CRC(bf44ec3f) SHA1(1446cb2780a9dedf640404a639fa3ae518b2d8aa)) + ROM_LOAD("ts2068_x.rom",0x14000,0x2000, CRC(ae16233a) SHA1(7e265a2c1f621ed365ea23bdcafdedbc79c1299c)) +ROM_END + +ROM_START(uk2086) + ROM_REGION(0x16000,"maincpu",0) + ROM_LOAD("uk2086_h.rom",0x10000,0x4000, CRC(5ddc0ca2) SHA1(1d525fe5cdc82ab46767f665ad735eb5363f1f51)) + ROM_LOAD("ts2068_x.rom",0x14000,0x2000, CRC(ae16233a) SHA1(7e265a2c1f621ed365ea23bdcafdedbc79c1299c)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1984, tc2048, spectrum, 0, tc2048, spectrum, driver_device, 0, "Timex of Portugal", "TC-2048" , 0) +COMP( 1983, ts2068, spectrum, 0, ts2068, spectrum, driver_device, 0, "Timex Sinclair", "TS-2068" , 0) +COMP( 1986, uk2086, spectrum, 0, uk2086, spectrum, driver_device, 0, "Unipolbrit", "UK-2086 ver. 1.2" , 0) diff --git a/src/mame/drivers/tispeak.c b/src/mame/drivers/tispeak.c new file mode 100644 index 00000000000..2e66df4a007 --- /dev/null +++ b/src/mame/drivers/tispeak.c @@ -0,0 +1,1339 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Jonathan Gevaryahu, Sean Riddle +/*************************************************************************** + + ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** + + Texas Instruments 1st-gen. handheld speech devices. + + These devices, mostly edu-toys, are based around an MCU(TMS0270/TMS1100), + TMS51xx speech, and VSM ROM(s). Newer devices, such as Speak & Music, + are based around the TMP50C40 and belong in another driver, probably. + + note: except for tntell, MAME external artwork is not required. But it + is objectively a large improvement. + +---------------------------------------------------------------------------- + +Known devices on this hardware: (* denotes not dumped, ** denotes pending dump) + + +ROM (and/or source) code obtained from patents: +Some of these may have pre-release bugs. + + Speak & Spell: US4189779 + Speak & Math: US4946391 + Touch & Tell: US4403965, EP0048835A2 (patent calls it "Speak & Seek") + Language Translator: US4631748 + + +Speak & Spell: + +This is the original Speak & Spell. TI had done educational toys before, like +Wiz-A-Tron or Little Professor. But the popularity of this product was much +above expectations. TI continued to manufacture many products for this line. + + Speak & Spell (US), 1978 + - MCU: TMC0271* + - TMS51xx: TMC0281 + - VSM(1/2): 16KB TMC0351NL + - VSM(2/2): 16KB TMC0352NL + - VFD: NEC FIP8A5AR no. 3A + - notes: keyboard has buttons instead of cheap membrane + + Speak & Spell (US), 1979 + - MCU: TMC0271* (different from 1978 version) + - TMS51xx: TMC0281 + - VSM(1/2): 16KB TMC0351N2L + - VSM(2/2): 16KB TMC0352N2L + - notes: fixed a funny bug with gibberish-talk when Module button is pressed + with no module inserted + + Speak & Spell (US), 1980 + - MCU: same as 1979 version + - TMS51xx: TMC0281D + - VSM: 16KB CD2350(rev.A) + - notes: only 1 VSM, meaning much smaller internal vocabulary + + Speak & Spell (Japan), 1980 + - MCU: TMC0271* (assume same as US 1978 or 1979 version) + - TMS51xx: TMC0281 + - VSM(1/2): 16KB CD2321 + - VSM(2/2): 16KB CD2322 + - notes: no local name for the product, words are in English but very low difficulty + + Speak & Spell (UK), 1978 + - MCU: TMC0271* (assume same as US 1978 version) + - TMS51xx: TMC0281 + - VSM(1/2): 16KB CD2303 + - VSM(2/2): 16KB CD2304 + - notes: voice data was manually altered to give it a UK accent, + here's a small anecdote from developer: + "(...) I cannot bear to listen the product even now. I remember the + word 'butcher' took 3 days - I still don't know if it sounds right." + + Speak & Spell (UK), 1981 + - MCU: TMC0271* (assume same as US 1979 version) + - TMS51xx: CD2801 + - VSM: 16KB CD62175 + - VFD: same as Speak & Math(!) + - notes: this one has a dedicated voice actor + + Speak & Spell (France) "La Dictee Magique", 1980 + - MCU: CD2702** + - TMS51xx: CD2801 + - VSM: 16KB CD2352 + + Speak & Spell (Germany) "Buddy", 1980 + - MCU & TMS51xx: same as French 1980 version + - VSM(1/2): 16KB CD2345* + - VSM(2/2): 16KB CD2346* + + Speak & Spell (Italy) "Grillo Parlante", 1982 + - MCU & TMS51xx: same as French 1980 version + - VSM: 16KB CD62190 + - VFD: same as Speak & Math + - notes: it appears that TI ran out of original snspell VFDs in the early 80s? + + Speak & Spell Compact (US), 1981 + - MCU: CD8011** + - TMS51xx: TMC0281D + - VSM: 16KB CD2354, CD2354(rev.A) + - notes: no display, MCU is TMS1100 instead of TMS0270, overall similar to Touch & Tell + + Speak & Spell Compact (UK) "Speak & Write", 1981 + - MCU & TMS51xx: same as US 1981 version + - VSM: 16KB CD62174(rev.A) + - notes: anecdotes from the developer, the same person working on the original UK version: + "We included a pencil and writing pad - it was now about 'writing'.", + and one about the welcome message: + "I had to manually create a sentence of digital speech from thin air. + I had to write down a 20 character code which would create each 10/s + sound bite that made up the phrase "Welcome to Speak and Write". + It took me 1 week. (...) Even Larry Brantingham was amazed." + +Speak & Spell modules: +Note that they are interchangeable, eg. you can use a French module on a US Speak & Spell. + + English: + - Vowel Power: VSM: 16KB CD2302 + - Number Stumpers 4-6: VSM: 16KB CD2305 + - Number Stumpers 7-8: VSM: 16KB CD2307(rev.A) + - Basic Builders: VSM: 16KB CD2308 + - Mighty Verbs: VSM: 16KB CD2309(rev.B) + - Homonym Heroes: VSM: 16KB CD2310 + - Vowel Ventures: VSM: 16KB CD2347(rev.C) + - Noun Endings: VSM: 16KB CD2348 + - Magnificent Modifiers: VSM: 16KB CD2349 + - E.T. Fantasy: VSM: 16KB CD2360 + + French: + - No.1: Les Mots de Base: VSM: 16KB CD2353 (1st release was called "Module No. 1 de Jacques Capelovici") + - No.2: Les Mots Difficilies: VSM: 16KB? CD62177* + - No.3: Les Animaux Familiers: VSM: 16KB? CD62047* + - No.4: Les Magasins De La Rue: VSM: 16KB CD62048 + - No.5: Les Extra-Terrestres: VSM: 16KB? CD62178* + + Italian: + - Super Modulo: VSM: 16KB? CD62313* + + +Speak & Math: + + Speak & Math (US), 1980 (renamed to "Speak & Maths" in UK, but is the same product) + - MCU: CD2704* + - TMS51xx: CD2801 + - VSM(1/2): 16KB CD2392 + - VSM(2/2): 16KB CD2393 + - VFD: Futaba 9SY -02Z 7E + - notes: As with the Speak & Spell, the voice actor was a radio announcer. + However, the phrase "is greater than or less than" had to be added in a + hurry by one of the TI employees in a hurry, the day before a demo. + Apparently QA never found out and it ended up in the final product. + + Speak & Math (US), 1986 + - MCU: CD2708, labeled CD2708N2L (die labeled TMC0270F 2708A) + - TMS51xx: CD2801 + - VSM(1/2): 16KB CD2381 + - VSM(2/2): 4KB CD2614 + + Speak & Math 'Compact' (France) "Les Maths Magiques", 1986? + - MCU: CP3447-NL* (TMS1100?) + - TMS51xx: CD2801 + - VSM: 16KB? CD62173* + - notes: this is not the same as "Le Calcul Magique", that's from a + series centered around a TMS50C40 instead of MCU+TMS51xx + + +Speak & Read: + + Speak & Read (US), 1980 + - MCU: CD2705, labeled CD2705B-N2L (die labeled TMC0270E 2705B) - 2nd revision? + - TMS51xx: CD2801 + - VSM(1/2): 16KB CD2394(rev.A) + - VSM(2/2): 16KB CD2395(rev.A) + - VFD: same as Language Tutor, rightmost digit unused + +Speak & Read modules: + + English: + - Sea Sights: VSM: 16KB CD2396(rev.A) + - Who's Who at the Zoo: VSM: 16KB CD2397 + - A Dog on a Log: VSM: 16KB CD3534(rev.A) + - The Seal That Could Fly: VSM: 16KB CD3535 + - A Ghost in the House: VSM: 16KB CD3536* + - On the Track: VSM: 16KB CD3538 + - The Third Circle: VSM: 16KB CD3539* + - The Millionth Knight: VSM: 16KB CD3540 + + +Touch & Tell: + + Touch & Tell (US), 1981 + - MCU: CD8012 + - TMS51xx: CD2802 + - VSM: 4KB CD2610 + - notes: MCU is TMS1100 instead of TMS0270. CD8010 is seen in some devices + too, maybe an earlier version? + + Touch & Tell (UK), 1981 + - MCU & TMS51xx: same as US version + - VSM: 16KB CD62170 + + Touch & Tell (France) "Le Livre Magique", 1981 + - MCU & TMS51xx: same as US version + - VSM: 16KB CD62171 + + Touch & Tell (Germany) "Tipp & Sprich", 1981 + - MCU & TMS51xx: same as US version + - VSM: ?KB CD62172* + + Touch & Tell (Italy) "Libro Parlante", 1982 + - MCU & TMS51xx: same as US version + - VSM: ?KB CD62176* + + Vocaid (US), 1982 + - MCU & TMS51xx: same as Touch & Tell (US) + - VSM: 16KB CD2357 + - notes: MCU is the same as in Touch & Tell, but instead of a toddler's toy, + you get a serious medical aid device for the voice-impaired. The PCB is + identical, it includes the edge connector for modules but no external slot. + +Touch & Tell modules: + + English: + - Alphabet Fun: VSM: 4KB CD2611 + - Animal Friends: VSM: 16KB CD2355 + - Number Fun: VSM: 4KB CD2612*, CD2612(rev.A) + - All About Me: VSM: 4KB CD2613 + - World of Transportation: VSM: 16KB CD2361 + - Little Creatures: VSM: 16KB CD2362 + - E.T.: VSM: 16KB CD2363 + +Touch & Tell/Vocaid overlay reference: + + tntell CD2610: + - 04: a - Colors + - 01: b - Objects + - 05: c - Shapes + - 09: d - Home Scene + tntelluk CD62170, tntellfr CD62171: + - see tntell + - see numfun(not A) + - see animalfr + - 08: ? - Clown Face + - 0B: ? - Body Parts + vocaid CD2357: + - 1C: 1 - Leisure + - 1E: 2 - Telephone + - 1B: 3 - Bedside + - 1D: 4 - Alphabet + alphabet CD2611: + - 0E: 1a - Alphabet A-M + - 0D: 1b - Alphabet N-Z + - 0C: 1c - Letter Jumble A-M + - 0B: 1d - Letter Jumble N-Z + animalfr CD2355: + - 0A: 2a - Farm Animals + - 0F: 2b - At The Farm + - 0E: 2c - Animal Babies + - 0D: 2d - In The Jungle + numfun CD2612: + - 02/0A(rev.A): 3a - Numbers 1-10 + - 03/0F(rev.A): 3b - Numbers 11-30 + - 07/0D(rev.A): 3c - How Many? + - 06/0E(rev.A): 3d - Hidden Numbers + aboutme CD2613: + - 0E: 4a - Clown Face + - 0B: 4b - Body Parts + - 0D: 4c - Things to Wear + - 0C: 4d - Just For Me + wot CD2361: + - 0A: 5a - On Land + - 0B: 5b - In The Air + - 0C: 5c - On The Water + - 0D: 5d - In Space + - 10: 5e - What Belongs Here? + - 11: 5f - How It Used To Be + - 12: 5g - Word Fun + - 13: 5h - In the Surprise Garage + lilcreat CD2362: + - 14: 6a - In The Park + - 15: 6b - In The Sea + - 16: 6c - In The Woods + - 17: 6d - Whose House? + - 18: 6e - Hide & Seek + - 1A: 6f - Who Is It? + - 19: 6g - But It's Not + - 1B: 6h - Word Fun + et CD2363: + - 0F: 7a - The Adventure On Earth I + - 10: 7b - The Adventure On Earth II + - 11: 7c - Fun And Friendship I + - 12: 7d - Fun And Friendship II + - 13: 7e - E.T. The Star I + - 14: 7f - E.T. The Star II + - 15: 7g - Do You Remember? I + - 16: 7h - Do You Remember? II + + +Language Tutor/Translator: + +A later device, called Language Teacher, was released without speech hardware. + + Language Tutor (US), 1978 + - MCU: TMC0275* + - TMS51xx: CD2801 + - VFD: NEC FIP10xxx? + - notes: external module is required (see below) + +Language Tutor modules: + + - Ingles(1/4): VSM: 16KB CD2311 + - Ingles(2/4): VSM: 16KB CD2312 + - Ingles(3/4): VSM: 16KB CD2313 + - Ingles(4/4): VSM: 16KB CD2314 + + - Spanish(1/4): VSM: 16KB CD2315 + - Spanish(2/4): VSM: 16KB CD2316 + - Spanish(3/4): VSM: 16KB CD2317 + - Spanish(4/4): VSM: 16KB CD2318 + + - French(1/4): VSM: 16KB CD2327 + - French(2/4): VSM: 16KB CD2328 + - French(3/4): VSM: 16KB CD2329 + - French(4/4): VSM: 16KB CD2330 + + - German(1/4): VSM: 16KB CD2331 + - German(2/4): VSM: 16KB CD2332 + - German(3/4): VSM: 16KB CD2333 + - German(4/4): VSM: 16KB CD2334 + + - English(1/4): VSM: 16KB CD3526 + - English(2/4): VSM: 16KB CD3527 + - English(3/4): VSM: 16KB CD3528 + - English(4/4): VSM: 16KB CD3529 + + +---------------------------------------------------------------------------- + + TODO: + - why doesn't lantutor work? + - emulate other known devices + + +***************************************************************************/ + +#include "includes/hh_tms1k.h" +#include "sound/tms5110.h" +#include "machine/tms6100.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +// internal artwork +#include "lantutor.lh" +#include "snmath.lh" +#include "snspell.lh" +#include "tntell.lh" // keyboard overlay + +// The master clock is a single stage RC oscillator into TMS5100 RCOSC: +// In an early 1979 Speak & Spell, C is 68pf, R is a 50kohm trimpot which is set to around 33.6kohm +// (measured in-circuit). CPUCLK is this osc freq /2, ROMCLK is this osc freq /4. +// The typical osc freq curve for TMS5100 is unknown. Let's assume it is set to the default frequency, +// which is 640kHz for 8KHz according to the TMS5100 documentation. + +#define MASTER_CLOCK (640000) + + +class tispeak_state : public hh_tms1k_state +{ +public: + tispeak_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag), + m_tms5100(*this, "tms5100"), + m_tms6100(*this, "tms6100"), + m_cart(*this, "cartslot") + { } + + // devices + required_device m_tms5100; + required_device m_tms6100; + optional_device m_cart; + + DECLARE_INPUT_CHANGED_MEMBER(snspell_power_button); + void snspell_power_off(); + void prepare_display(); + + DECLARE_READ8_MEMBER(snspell_read_k); + DECLARE_WRITE16_MEMBER(snmath_write_o); + DECLARE_WRITE16_MEMBER(snspell_write_o); + DECLARE_WRITE16_MEMBER(snspell_write_r); + DECLARE_WRITE16_MEMBER(lantutor_write_r); + + DECLARE_READ8_MEMBER(tntell_read_k); + DECLARE_WRITE16_MEMBER(tntell_write_o); + DECLARE_WRITE16_MEMBER(tntell_write_r); + + // cartridge + UINT32 m_cart_max_size; + UINT8* m_cart_base; + void init_cartridge(); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(tispeak_cartridge); + DECLARE_DRIVER_INIT(snspell); + DECLARE_DRIVER_INIT(tntell); + DECLARE_DRIVER_INIT(lantutor); + + UINT8 m_overlay; + TIMER_DEVICE_CALLBACK_MEMBER(tntell_get_overlay); + +protected: + virtual void machine_start(); +}; + + +void tispeak_state::machine_start() +{ + hh_tms1k_state::machine_start(); + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! + + init_cartridge(); +} + + + +/*************************************************************************** + + Cartridge Handling + +***************************************************************************/ + +void tispeak_state::init_cartridge() +{ + m_overlay = 0; + + if (m_cart != NULL && m_cart->exists()) + { + std::string region_tag; + memory_region *src = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + if (src) + memcpy(m_cart_base, src->base(), src->bytes()); + } +} + +DEVICE_IMAGE_LOAD_MEMBER(tispeak_state, tispeak_cartridge) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size > m_cart_max_size) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + +DRIVER_INIT_MEMBER(tispeak_state, snspell) +{ + m_cart_max_size = 0x4000; + m_cart_base = memregion("tms6100")->base() + 0x8000; +} + +DRIVER_INIT_MEMBER(tispeak_state, tntell) +{ + m_cart_max_size = 0x4000; + m_cart_base = memregion("tms6100")->base() + 0x4000; +} + +DRIVER_INIT_MEMBER(tispeak_state, lantutor) +{ + m_cart_max_size = 0x10000; + m_cart_base = memregion("tms6100")->base(); +} + + + +/*************************************************************************** + + I/O + +***************************************************************************/ + +// common/snspell + +void tispeak_state::prepare_display() +{ + UINT16 gridmask = (m_display_decay[15][16] != 0) ? 0xffff : 0x8000; + display_matrix_seg(16+1, 16, m_plate | 0x10000, m_grid & gridmask, 0x3fff); +} + +WRITE16_MEMBER(tispeak_state::snspell_write_r) +{ + // R13: power-off request, on falling edge + if ((m_r >> 13 & 1) && !(data >> 13 & 1)) + snspell_power_off(); + + // R0-R7: input mux and select digit (+R8 if the device has 9 digits) + // R15: filament on + // other bits: MCU internal use + m_r = m_inp_mux = data; + m_grid = data & 0x81ff; + prepare_display(); +} + +WRITE16_MEMBER(tispeak_state::snspell_write_o) +{ + // reorder opla to led14seg, plus DP as d14 and AP as d15: + // note: lantutor and snread VFD has an accent triangle instead of DP, and no AP + // E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK) + m_plate = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5); + prepare_display(); +} + +READ8_MEMBER(tispeak_state::snspell_read_k) +{ + // note: the Vss row is always on + return m_inp_matrix[8]->read() | read_inputs(8); +} + + +void tispeak_state::snspell_power_off() +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_tms5100->reset(); + m_tms6100->reset(); + + m_power_on = false; +} + + +// snmath specific + +WRITE16_MEMBER(tispeak_state::snmath_write_o) +{ + // reorder opla to led14seg, plus DP as d14 and CT as d15: + // [DP],D,C,H,F,B,I,M,L,K,N,J,[CT],E,G,A (sidenote: TI KLMN = MAME MLNK) + m_plate = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15); + prepare_display(); +} + + +// lantutor specific + +WRITE16_MEMBER(tispeak_state::lantutor_write_r) +{ + // same as default, except R13 is used for an extra digit + m_r = m_inp_mux = data; + m_grid = data & 0xa1ff; + prepare_display(); +} + + +// tntell specific + +WRITE16_MEMBER(tispeak_state::tntell_write_r) +{ + // R10: CD2802 PDC pin + m_tms5100->pdc_w(data >> 10); + + // R9: power-off request, on falling edge + if ((m_r >> 9 & 1) && !(data >> 9 & 1)) + snspell_power_off(); + + // R0-R8: input mux + m_r = m_inp_mux = data; +} + +WRITE16_MEMBER(tispeak_state::tntell_write_o) +{ + // O3210: CD2802 CTL8124 + m_o = BITSWAP8(data,7,6,5,4,3,0,1,2); + m_tms5100->ctl_w(space, 0, m_o & 0xf); +} + +READ8_MEMBER(tispeak_state::tntell_read_k) +{ + // multiplexed inputs (and K2 from on-button) + UINT8 k = m_inp_matrix[9]->read() | read_inputs(9); + + // K4: CD2802 CTL1 + if (m_tms5100->ctl_r(space, 0) & 1) + k |= 4; + + // K8: overlay code from R5,O4-O7 + if (((m_r >> 1 & 0x10) | (m_o >> 4 & 0xf)) & m_overlay) + k |= 8; + + return k; +} + +TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::tntell_get_overlay) +{ + // Each keyboard overlay insert has 5 holes, used by the game to determine + // which one is active(if any). If it matches with the internal ROM or + // external module, the game continues. + // 00 for none, 1F for diagnostics, see comment section above for a list + + // try to get overlay code from artwork file(in decimal), otherwise pick the + // one that was selected in machine configuration + m_overlay = output_get_value("overlay_code") & 0x1f; + if (m_overlay == 0) + m_overlay = m_inp_matrix[10]->read(); + + for (int i = 0; i < 5; i++) + output_set_indexed_value("ol", i+1, m_overlay >> i & 1); +} + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +INPUT_CHANGED_MEMBER(tispeak_state::snspell_power_button) +{ + int on = (int)(FPTR)param; + + if (on && !m_power_on) + { + m_power_on = true; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } + else if (!on && m_power_on) + snspell_power_off(); +} + +static INPUT_PORTS_START( snspell ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_NAME("Module") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Erase") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Enter") + + PORT_START("IN.6") // R6 + PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.7") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_NAME("Go") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_NAME("Replay") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("Repeat") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_NAME("Clue") + + PORT_START("IN.8") // Vss! + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_NAME("Mystery Word") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("Secret Code") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("Letter") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("Say It") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Spell/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) +INPUT_PORTS_END + + +static INPUT_PORTS_START( snmath ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Go") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("<") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_STOP) PORT_NAME(">") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Repeat") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) // / + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Mix It") + + PORT_START("IN.6") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("Number Stumper") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("Write It") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Greater/Less") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Word Problems") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Solve It/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) + + PORT_START("IN.7") + PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.8") + PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +static INPUT_PORTS_START( snread ) + PORT_INCLUDE( snspell ) + + PORT_MODIFY("IN.7") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("Word Zapper") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_NAME("Word Maker") + + PORT_MODIFY("IN.8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_NAME("Read It") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("Picture Read") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("Letter Stumper") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("Hear It") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Word Zap/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) +INPUT_PORTS_END + + +static INPUT_PORTS_START( lantutor ) + PORT_INCLUDE( snspell ) + + PORT_MODIFY("IN.5") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("Diacritical") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Space") + + PORT_MODIFY("IN.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_NAME("4") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_NAME("5") + + PORT_MODIFY("IN.7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("6") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("7") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("8") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_NAME("9") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_NAME("0") + + PORT_MODIFY("IN.8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_NAME("Translate") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("Learn") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("Phrase") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("Link") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_NAME("Repeat") +INPUT_PORTS_END + + +static INPUT_PORTS_START( tntell ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("Grid 1-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("Grid 1-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_NAME("Grid 1-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("Grid 1-3") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Grid 2-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Grid 2-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Grid 2-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Grid 2-3") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Grid 3-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Grid 3-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Grid 3-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Grid 3-3") + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Grid 4-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Grid 4-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_V) PORT_NAME("Grid 4-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Grid 4-3") + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_NAME("Grid 5-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_NAME("Grid 5-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("Grid 5-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_NAME("Grid 5-3") + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_NAME("Grid 5-6") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("Grid 6-5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("Grid 5-5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) // overlay code + + PORT_START("IN.6") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Grid 3-5") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Grid 2-5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Grid 4-5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_NAME("Grid 1-5") + + PORT_START("IN.7") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("Grid 3-6") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Grid 2-6") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("Grid 4-6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_NAME("Grid 1-6") + + PORT_START("IN.8") // R8 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Grid 6-1 (Off)") // -> auto_power_off + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("Grid 6-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Grid 6-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("Grid 6-3") + + PORT_START("IN.9") // Vss! + PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Grid 6-6 (On)") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) + + PORT_START("IN.10") + PORT_CONFNAME( 0x1f, 0x04, "Overlay Code" ) // only if not provided by external artwork + PORT_CONFSETTING( 0x00, "00 (None)" ) + PORT_CONFSETTING( 0x01, "01" ) + PORT_CONFSETTING( 0x02, "02" ) + PORT_CONFSETTING( 0x03, "03" ) + PORT_CONFSETTING( 0x04, "04" ) + PORT_CONFSETTING( 0x05, "05" ) + PORT_CONFSETTING( 0x06, "06" ) + PORT_CONFSETTING( 0x07, "07" ) + PORT_CONFSETTING( 0x08, "08" ) + PORT_CONFSETTING( 0x09, "09" ) + PORT_CONFSETTING( 0x0a, "0A" ) + PORT_CONFSETTING( 0x0b, "0B" ) + PORT_CONFSETTING( 0x0c, "0C" ) + PORT_CONFSETTING( 0x0d, "0D" ) + PORT_CONFSETTING( 0x0e, "0E" ) + PORT_CONFSETTING( 0x0f, "0F" ) + PORT_CONFSETTING( 0x10, "10" ) + PORT_CONFSETTING( 0x11, "11" ) + PORT_CONFSETTING( 0x12, "12" ) + PORT_CONFSETTING( 0x13, "13" ) + PORT_CONFSETTING( 0x14, "14" ) + PORT_CONFSETTING( 0x15, "15" ) + PORT_CONFSETTING( 0x16, "16" ) + PORT_CONFSETTING( 0x17, "17" ) + PORT_CONFSETTING( 0x18, "18" ) + PORT_CONFSETTING( 0x19, "19" ) + PORT_CONFSETTING( 0x1a, "1A" ) + PORT_CONFSETTING( 0x1b, "1B" ) + PORT_CONFSETTING( 0x1c, "1C" ) + PORT_CONFSETTING( 0x1d, "1D" ) + PORT_CONFSETTING( 0x1e, "1E" ) + PORT_CONFSETTING( 0x1f, "1F (Diagnostic)" ) +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +static MACHINE_CONFIG_FRAGMENT( tms5110_route ) + + /* sound hardware */ + MCFG_TMS5110_M0_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m0_w)) + MCFG_TMS5110_M1_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m1_w)) + MCFG_TMS5110_ADDR_CB(DEVWRITE8("tms6100", tms6100_device, tms6100_addr_w)) + MCFG_TMS5110_DATA_CB(DEVREADLINE("tms6100", tms6100_device, tms6100_data_r)) + MCFG_TMS5110_ROMCLK_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_romclock_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( snmath, tispeak_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS0270, MASTER_CLOCK/2) + MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, snspell_read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snmath_write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, snspell_write_r)) + + MCFG_TMS0270_READ_CTL_CB(DEVREAD8("tms5100", tms5110_device, ctl_r)) + MCFG_TMS0270_WRITE_CTL_CB(DEVWRITE8("tms5100", tms5110_device, ctl_w)) + MCFG_TMS0270_WRITE_PDC_CB(DEVWRITELINE("tms5100", tms5110_device, pdc_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_snmath) + + /* no video! */ + + /* sound hardware */ + MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("tms5100", CD2801, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( sns_cd2801, snmath ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o)) + + MCFG_DEFAULT_LAYOUT(layout_snspell) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "snspell") + MCFG_GENERIC_EXTENSIONS("vsm") + MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "snspell") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sns_tmc0281, sns_cd2801 ) + + /* sound hardware */ + MCFG_SOUND_REPLACE("tms5100", TMC0281, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sns_tmc0281d, sns_cd2801 ) + + /* sound hardware */ + MCFG_SOUND_REPLACE("tms5100", TMC0281D, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sns_cd2801_m, sns_cd2801 ) + + /* basic machine hardware */ + MCFG_DEFAULT_LAYOUT(layout_snmath) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( snread, snmath ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o)) + + MCFG_DEFAULT_LAYOUT(layout_lantutor) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "snread") + MCFG_GENERIC_EXTENSIONS("vsm") + MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "snread") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( lantutor, snmath ) + + /* basic machine hardware */ + MCFG_CPU_MODIFY("maincpu") + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, lantutor_write_r)) + + MCFG_DEFAULT_LAYOUT(layout_lantutor) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "lantutor") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_EXTENSIONS("vsm,bin") + MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "lantutor") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_START( vocaid, tispeak_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, MASTER_CLOCK/2) + MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, tntell_read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, tntell_write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, tntell_write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ol_timer", tispeak_state, tntell_get_overlay, attotime::from_msec(50)) + MCFG_DEFAULT_LAYOUT(layout_tntell) + + /* no video! */ + + /* sound hardware */ + MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("tms5100", CD2802, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tntell, vocaid ) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "tntell") + MCFG_GENERIC_EXTENSIONS("vsm") + MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "tntell") +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +#define rom_snspellp rom_snspell // until we have a correct dump + +ROM_START( snspell ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // typed in from patent US4189779, verified by 2 sources + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge + ROM_LOAD( "tmc0351nl.vsm", 0x0000, 0x4000, CRC(beea3373) SHA1(8b0f7586d2f12c3d4a885fdb528cf23feffa1a3b) ) + ROM_LOAD( "tmc0352nl.vsm", 0x4000, 0x4000, CRC(d51f0587) SHA1(ddaa484be1bba5fef46b481cafae517e4acaa8ed) ) +ROM_END + +ROM_START( snspella ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge + ROM_LOAD( "tmc0351n2l.vsm", 0x0000, 0x4000, CRC(2d03b292) SHA1(a3e9a365307ae936c7472f720a7a8240741531d6) ) + ROM_LOAD( "tmc0352n2l.vsm", 0x4000, 0x4000, CRC(a6d56883) SHA1(eebf9c07f2f9001679dec06c2367d4a50596d04b) ) +ROM_END + +ROM_START( snspellb ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge + ROM_LOAD( "cd2350a.vsm", 0x0000, 0x4000, CRC(2adda742) SHA1(3f868ed8284b723c815a30343057e03467c043b5) ) +ROM_END + +ROM_START( snspelluk ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge + ROM_LOAD( "cd2303.vsm", 0x0000, 0x4000, CRC(0fae755c) SHA1(b68c3120a63a61db474feb5d71a6e5dd67910d80) ) + ROM_LOAD( "cd2304.vsm", 0x4000, 0x4000, CRC(e2a270eb) SHA1(c13c95ad15f1923a4841f66504e0f22646e71d99) ) +ROM_END + +ROM_START( snspelluka ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge + ROM_LOAD( "cd62175.vsm", 0x0000, 0x4000, CRC(6e1063d4) SHA1(b5c66c51148c5921ecb8ffccd7a460ae639cdb68) ) +ROM_END + +ROM_START( snspelljp ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge + ROM_LOAD( "cd2321.vsm", 0x0000, 0x4000, CRC(ac010cce) SHA1(c0200d857b62be696248ac2d684a390c66ab0c31) ) + ROM_LOAD( "cd2322.vsm", 0x4000, 0x4000, CRC(b6f4bba4) SHA1(65d686a9385b5ef3f080a5f47c6b2418bb9455b0) ) +ROM_END + +ROM_START( snspellfr ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, BAD_DUMP CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // placeholder, use the one we have + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge + ROM_LOAD( "cd2352.vsm", 0x0000, 0x4000, CRC(181a239e) SHA1(e16043766c385e152b7005c1c010be4c5fccdd9b) ) +ROM_END + +ROM_START( snspellit ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, BAD_DUMP CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // placeholder, use the one we have + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge + ROM_LOAD( "cd62190.vsm", 0x0000, 0x4000, CRC(63832002) SHA1(ea8124b2bf0f5908c5f1a56d60063f2468a10143) ) +ROM_END + + +ROM_START( snmath ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "cd2708n2l", 0x0000, 0x1000, CRC(35937360) SHA1(69c362c75bb459056c09c7fab37c91040485474b) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_cd2708_output.pla", 0, 1246, CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) + ROM_LOAD( "cd2381.vsm", 0x0000, 0x4000, CRC(f048dc81) SHA1(e97667d1002de40ab3d702c63b82311480032e0f) ) + ROM_LOAD( "cd2614.vsm", 0x4000, 0x1000, CRC(11989074) SHA1(0e9cf906de9bcdf4acb425535dc442846fc48fa2) ) + ROM_RELOAD( 0x5000, 0x1000 ) + ROM_RELOAD( 0x6000, 0x1000 ) + ROM_RELOAD( 0x7000, 0x1000 ) +ROM_END + +ROM_START( snmathp ) + ROM_REGION( 0x1000, "maincpu", 0 ) + // typed in from patent 4946391, verified with source code + // BTANB note: Mix It does not work at all, this is an original bug in the patent listing. There are probably other minor bugs too. + ROM_LOAD( "us4946391_t2074", 0x0000, 0x1000, CRC(011f0c2d) SHA1(d2e14d72e03ca864abd51da78ffb71a9da82f624) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_cd2708_output.pla", 0, 1246, BAD_DUMP CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) // taken from cd2708, need to verify if it's same as cd2704 + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) + ROM_LOAD( "cd2392.vsm", 0x0000, 0x4000, CRC(4ed2e920) SHA1(8896f29e25126c1e4d9a47c9a325b35dddecc61f) ) + ROM_LOAD( "cd2393.vsm", 0x4000, 0x4000, CRC(571d5b5a) SHA1(83284755d9b77267d320b5b87fdc39f352433715) ) +ROM_END + + +ROM_START( snread ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "cd2705b-n2l", 0x0000, 0x1000, CRC(c235636e) SHA1(57b24dd8414bf76ec786a51d10cb8a5898b60e18) ) + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_cd2705_output.pla", 0, 1246, CRC(bf859848) SHA1(66b297fbf534968fa6db7413b99ef0e81cc35ddc) ) + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge + ROM_LOAD( "cd2394a.vsm", 0x0000, 0x4000, CRC(cbb0e2b1) SHA1(5e322c683baf806523de171310258ae371671327) ) + ROM_LOAD( "cd2395a.vsm", 0x4000, 0x4000, CRC(3d519504) SHA1(76b19ba5a9a3486005e09c98e8a6abc8b88288dd) ) +ROM_END + + +ROM_START( lantutor ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4631748_tmc0275", 0x0000, 0x1000, CRC(22818845) SHA1(1a84f15fb18ca66b1f2bf7491d76fbc56068984d) ) // extracted visually from patent US4631748, verified with source code + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, BAD_DUMP CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // taken from snspell, mostly looks correct + + ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // cartridge area +ROM_END + + +ROM_START( tntell ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge + ROM_LOAD( "cd2610.vsm", 0x0000, 0x1000, CRC(6db34e5a) SHA1(10fa5db20fdcba68034058e7194f35c90b9844e6) ) +ROM_END + +ROM_START( tntelluk ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge + ROM_LOAD( "cd62170.vsm", 0x0000, 0x4000, CRC(6dc9d072) SHA1(9d2c9ff57c4f8fe69768666ffa41fcac649279ef) ) +ROM_END + +ROM_START( tntellfr ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge + ROM_LOAD( "cd62171.vsm", 0x0000, 0x4000, CRC(cc26f7d1) SHA1(2b03e37b3bf3cbeca36980acfc45246dac706b83) ) +ROM_END + +ROM_START( tntellp ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "us4403965_cd1100", 0x0000, 0x0800, BAD_DUMP CRC(863a1c9e) SHA1(f2f9eb0ae17eedd4ef2b887b34601e75b4f6c720) ) // typed in from patent US4403965/EP0048835A2, may have errors + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) // from cd8012, matches patent source code + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_us4403965_output.pla", 0, 365, CRC(66cfb3c3) SHA1(80a05e5d729518e1f35d8f26438f56e80ffbd003) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge + ROM_LOAD( "cd2610.vsm", 0x0000, 0x1000, CRC(6db34e5a) SHA1(10fa5db20fdcba68034058e7194f35c90b9844e6) ) +ROM_END + + +ROM_START( vocaid ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // same hw as tntell, but no external slot + ROM_LOAD( "cd2357.vsm", 0x0000, 0x4000, CRC(19c251fa) SHA1(8f8163069f32413379e7e1681ce6a4d0819d4ebc) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1978, snspell, 0, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, uses patent MCU ROM +COMP( 1978, snspellp, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1979, snspella, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1980, snspellb, snspell, 0, sns_tmc0281d,snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1980 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1978, snspelluk, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1981, snspelluka, snspell, 0, sns_cd2801_m,snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1979, snspelljp, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1980, snspellfr, snspell, 0, sns_cd2801, snspell, tispeak_state, snspell, "Texas Instruments", "La Dictee Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // doesn't work due to missing CD2702 MCU dump, German/Italian version has CD2702 too +COMP( 1982, snspellit, snspell, 0, sns_cd2801_m,snspell, tispeak_state, snspell, "Texas Instruments", "Grillo Parlante (Italy)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " + +COMP( 1986, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1986 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1980 version/patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) + +COMP( 1980, snread, 0, 0, snread, snread, tispeak_state, snspell, "Texas Instruments", "Speak & Read (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) + +COMP( 1979, lantutor, 0, 0, lantutor, lantutor, tispeak_state, lantutor, "Texas Instruments", "Language Tutor (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) + +COMP( 1981, tntell, 0, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (US, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) // assume there is an older version too, with CD8010 MCU +COMP( 1980, tntellp, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +COMP( 1981, tntelluk, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (UK)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) +COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Le Livre Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) + +COMP( 1982, vocaid, 0, 0, vocaid, tntell, driver_device, 0, "Texas Instruments", "Vocaid", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mame/drivers/tk2000.c b/src/mame/drivers/tk2000.c new file mode 100644 index 00000000000..6a5cd4a276c --- /dev/null +++ b/src/mame/drivers/tk2000.c @@ -0,0 +1,608 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + tk2000.c - Microdigital TK2000 + + Driver by R. Belmont + + This system is only vaguely Apple II compatible. + The keyboard works entirely differently, which is a big deal. + + $C05A - banks RAM from c100-ffff + $C05B - banks ROM from c100-ffff + +************************************************************************/ + +#include "emu.h" +#include "machine/bankdev.h" +#include "machine/ram.h" +#include "sound/speaker.h" +#include "imagedev/flopdrv.h" +#include "imagedev/cassette.h" +#include "formats/ap2_dsk.h" +#include "cpu/m6502/m6502.h" +#include "video/apple2.h" + +#define A2_CPU_TAG "maincpu" +#define A2_BUS_TAG "a2bus" +#define A2_SPEAKER_TAG "speaker" +#define A2_CASSETTE_TAG "tape" +#define A2_UPPERBANK_TAG "inhbank" +#define A2_VIDEO_TAG "a2video" + +class tk2000_state : public driver_device +{ +public: + tk2000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, A2_CPU_TAG), + m_ram(*this, RAM_TAG), + m_video(*this, A2_VIDEO_TAG), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_kbspecial(*this, "keyb_special"), + m_sysconfig(*this, "a2_config"), + m_speaker(*this, A2_SPEAKER_TAG), + m_cassette(*this, A2_CASSETTE_TAG), + m_upperbank(*this, A2_UPPERBANK_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_video; + required_ioport m_row0, m_row1, m_row2, m_row3, m_row4, m_row5, m_row6, m_row7; + required_ioport m_kbspecial; + required_ioport m_sysconfig; + required_device m_speaker; + required_device m_cassette; + required_device m_upperbank; + + TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_PALETTE_INIT(tk2000); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER(ram_r); + DECLARE_WRITE8_MEMBER(ram_w); + DECLARE_READ8_MEMBER(c000_r); + DECLARE_WRITE8_MEMBER(c000_w); + DECLARE_READ8_MEMBER(c080_r); + DECLARE_WRITE8_MEMBER(c080_w); + DECLARE_READ8_MEMBER(c100_r); + DECLARE_WRITE8_MEMBER(c100_w); + +private: + int m_speaker_state; + int m_cassette_state; + + UINT8 m_strobe; + + bool m_page2; + + UINT8 *m_ram_ptr; + int m_ram_size; + + void do_io(address_space &space, int offset); + UINT8 read_floatingbus(); +}; + +/*************************************************************************** + START/RESET +***************************************************************************/ + +void tk2000_state::machine_start() +{ + m_ram_ptr = m_ram->pointer(); + m_ram_size = m_ram->size(); + m_speaker_state = 0; + m_speaker->level_w(m_speaker_state); + m_cassette_state = 0; + m_cassette->output(-1.0f); + m_upperbank->set_bank(0); + + // setup save states + save_item(NAME(m_speaker_state)); + save_item(NAME(m_cassette_state)); + save_item(NAME(m_strobe)); + save_item(NAME(m_page2)); + + // setup video pointers + m_video->m_ram_ptr = m_ram_ptr; + m_video->m_aux_ptr = m_ram_ptr; + m_video->m_char_ptr = NULL; + m_video->m_char_size = 0; +} + +void tk2000_state::machine_reset() +{ + m_page2 = false; + m_strobe = 0; +} + +/*************************************************************************** + VIDEO +***************************************************************************/ + +TIMER_DEVICE_CALLBACK_MEMBER(tk2000_state::apple2_interrupt) +{ + int scanline = param; + + if((scanline % 8) == 0) + machine().first_screen()->update_partial(machine().first_screen()->vpos()); + + // update the video system's shadow copy of the system config at the end of the frame + if (scanline == 192) + { + m_video->m_sysconfig = m_sysconfig->read(); + } +} + +PALETTE_INIT_MEMBER(tk2000_state, tk2000) +{ + m_video->palette_init_apple2(palette); +} + +UINT32 tk2000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_video->hgr_update(screen, bitmap, cliprect, 0, 191); + return 0; +} + +/*************************************************************************** + I/O +***************************************************************************/ +// most softswitches don't care about read vs write, so handle them here +void tk2000_state::do_io(address_space &space, int offset) +{ + if(space.debugger_access()) + { + return; + } + + switch (offset) + { + case 0x20: + m_cassette_state ^= 1; + m_cassette->output(m_cassette_state ? 1.0f : -1.0f); + break; + + case 0x30: + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + break; + + case 0x50: // monochrome + break; + + case 0x51: // color + break; + + case 0x54: // set page 1 + m_page2 = false; + m_video->m_page2 = false; + break; + + case 0x55: // set page 2 + m_page2 = true; + m_video->m_page2 = true; + break; + + case 0x5a: // ROM + m_upperbank->set_bank(0); + break; + + case 0x5b: // RAM + m_upperbank->set_bank(1); + break; + + case 0x5e: + break; + + default: + printf("do_io: unk access @ $C0%02X\n", offset & 0xff); + break; + } +} + +READ8_MEMBER(tk2000_state::c000_r) +{ + switch (offset) + { + case 0x00: + return 0; + + case 0x10: // keyboard strobe + return m_strobe; + + case 0x60: // cassette in + case 0x68: + return m_cassette->input() > 0.0 ? 0x80 : 0; + + default: + do_io(space, offset); + break; + } + + return read_floatingbus(); +} + +WRITE8_MEMBER(tk2000_state::c000_w) +{ + switch (offset) + { + case 0x00: // write row mask for keyboard scan + switch (data) + { + case 0: + break; + + case 0x01: m_strobe = m_row0->read(); break; + case 0x02: m_strobe = m_row1->read(); break; + case 0x04: m_strobe = m_row2->read(); break; + case 0x08: m_strobe = m_row3->read(); break; + case 0x10: m_strobe = m_row4->read(); break; + case 0x20: m_strobe = m_row5->read(); break; + case 0x40: m_strobe = m_row6->read(); break; + case 0x80: m_strobe = m_row7->read(); break; + } + break; + + case 0x5f: + m_strobe = m_kbspecial->read(); + break; + + default: + do_io(space, offset); + break; + } +} + +READ8_MEMBER(tk2000_state::c080_r) +{ + return read_floatingbus(); +} + +WRITE8_MEMBER(tk2000_state::c080_w) +{ +} + +READ8_MEMBER(tk2000_state::c100_r) +{ + return m_ram_ptr[offset + 0xc100]; +} + +WRITE8_MEMBER(tk2000_state::c100_w) +{ + m_ram_ptr[offset + 0xc100] = data; +} + +// floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter +UINT8 tk2000_state::read_floatingbus() +{ + enum + { + // scanner types + kScannerNone = 0, kScannerApple2, kScannerApple2e, + + // scanner constants + kHBurstClock = 53, // clock when Color Burst starts + kHBurstClocks = 4, // clocks per Color Burst duration + kHClock0State = 0x18, // H[543210] = 011000 + kHClocks = 65, // clocks per horizontal scan (including HBL) + kHPEClock = 40, // clock when HPE (horizontal preset enable) goes low + kHPresetClock = 41, // clock when H state presets + kHSyncClock = 49, // clock when HSync starts + kHSyncClocks = 4, // clocks per HSync duration + kNTSCScanLines = 262, // total scan lines including VBL (NTSC) + kNTSCVSyncLine = 224, // line when VSync starts (NTSC) + kPALScanLines = 312, // total scan lines including VBL (PAL) + kPALVSyncLine = 264, // line when VSync starts (PAL) + kVLine0State = 0x100, // V[543210CBA] = 100000000 + kVPresetLine = 256, // line when V state presets + kVSyncLines = 4, // lines per VSync duration + kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? + }; + + // vars + // + int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ + h_clock, h_state, h_0, h_1, h_2, h_3, h_4, h_5, + v_line, v_state, v_A, v_B, v_C, v_0, v_1, v_2, v_3, v_4, /* v_5, */ + _hires, addend0, addend1, addend2, sum, address; + + // video scanner data + // + i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync + + // machine state switches + // + Hires = 1; //m_video->m_hires ? 1 : 0; + Mixed = 0; //m_video->m_mix ? 1 : 0; + Page2 = m_page2 ? 1 : 0; + _80Store = 0; + + // calculate video parameters according to display standard + // + ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? + // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? + // ScanCycles = ScanLines * kHClocks; + + // calculate horizontal scanning state + // + h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock + h_state = kHClock0State + h_clock; // H state bits + if (h_clock >= kHPresetClock) // check for horizontal preset + { + h_state -= 1; // correct for state preset (two 0 states) + } + h_0 = (h_state >> 0) & 1; // get horizontal state bits + h_1 = (h_state >> 1) & 1; + h_2 = (h_state >> 2) & 1; + h_3 = (h_state >> 3) & 1; + h_4 = (h_state >> 4) & 1; + h_5 = (h_state >> 5) & 1; + + // calculate vertical scanning state + // + v_line = i / kHClocks; // which vertical scanning line + v_state = kVLine0State + v_line; // V state bits + if ((v_line >= kVPresetLine)) // check for previous vertical state preset + { + v_state -= ScanLines; // compensate for preset + } + v_A = (v_state >> 0) & 1; // get vertical state bits + v_B = (v_state >> 1) & 1; + v_C = (v_state >> 2) & 1; + v_0 = (v_state >> 3) & 1; + v_1 = (v_state >> 4) & 1; + v_2 = (v_state >> 5) & 1; + v_3 = (v_state >> 6) & 1; + v_4 = (v_state >> 7) & 1; + //v_5 = (v_state >> 8) & 1; + + // calculate scanning memory address + // + _hires = Hires; + if (Hires && Mixed && (v_4 & v_2)) + { + _hires = 0; // (address is in text memory) + } + + addend0 = 0x68; // 1 1 0 1 + addend1 = (h_5 << 5) | (h_4 << 4) | (h_3 << 3); + addend2 = (v_4 << 6) | (v_3 << 5) | (v_4 << 4) | (v_3 << 3); + sum = (addend0 + addend1 + addend2) & (0x0F << 3); + + address = 0; + address |= h_0 << 0; // a0 + address |= h_1 << 1; // a1 + address |= h_2 << 2; // a2 + address |= sum; // a3 - aa6 + address |= v_0 << 7; // a7 + address |= v_1 << 8; // a8 + address |= v_2 << 9; // a9 + address |= ((_hires) ? v_A : (1 ^ (Page2 & (1 ^ _80Store)))) << 10; // a10 + address |= ((_hires) ? v_B : (Page2 & (1 ^ _80Store))) << 11; // a11 + if (_hires) // hires? + { + // Y: insert hires only address bits + // + address |= v_C << 12; // a12 + address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 + address |= (Page2 & (1 ^ _80Store)) << 14; // a14 + } + else + { + // N: text, so no higher address bits unless Apple ][, not Apple //e + // + if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) + (kHPEClock <= h_clock) && // Y: HBL? + (h_clock <= (kHClocks - 1))) + { + address |= 1 << 12; // Y: a12 (add $1000 to address!) + } + } + + return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? +} + +/*************************************************************************** + ADDRESS MAP +***************************************************************************/ + +READ8_MEMBER(tk2000_state::ram_r) +{ + if (offset < m_ram_size) + { + return m_ram_ptr[offset]; + } + + return 0xff; +} + +WRITE8_MEMBER(tk2000_state::ram_w) +{ + if (offset < m_ram_size) + { + m_ram_ptr[offset] = data; + } +} + +static ADDRESS_MAP_START( apple2_map, AS_PROGRAM, 8, tk2000_state ) + AM_RANGE(0x0000, 0xbfff) AM_READWRITE(ram_r, ram_w) + AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) + AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) + AM_RANGE(0xc100, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( inhbank_map, AS_PROGRAM, 8, tk2000_state ) + AM_RANGE(0x0000, 0x3eff) AM_ROM AM_REGION("maincpu", 0x100) + AM_RANGE(0x4000, 0x7eff) AM_READWRITE(c100_r, c100_w) +ADDRESS_MAP_END + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +/* + TK2000 matrix: + + 0 1 2 3 4 5 6 7 + 0SHIF B V C X Z + 1 G F D S A + 2 SPC T R E W Q + 3 LFT 5 4 3 2 1 + 4 RGT 6 7 8 9 0 + 5 DWN Y U I O P + 6 UP H J K L : + 7 RTN N M , . ? + + write row mask 1/2/4/8/10/20/40/80 to $C000 + read column at $C010 + + If $C05F is written, the Ctrl key is read in bit 0 of $C010 immediately afterwards. +*/ +static INPUT_PORTS_START( tk2000 ) + PORT_START("ROW0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + + PORT_START("ROW1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + + PORT_START("ROW2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + + PORT_START("ROW3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("ROW4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + + PORT_START("ROW5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + + PORT_START("ROW6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + + PORT_START("ROW7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("a2_config") + PORT_CONFNAME(0x03, 0x00, "Composite monitor type") + PORT_CONFSETTING(0x00, "Color") + PORT_CONFSETTING(0x01, "B&W") + PORT_CONFSETTING(0x02, "Green") + PORT_CONFSETTING(0x03, "Amber") +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tk2000, tk2000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(A2_CPU_TAG, M6502, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_CPU_PROGRAM_MAP(apple2_map) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tk2000_state, apple2_interrupt, "screen", 0, 1) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_DEVICE_ADD(A2_VIDEO_TAG, APPLE2_VIDEO, XTAL_14_31818MHz) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(280*2, 262) + MCFG_SCREEN_VISIBLE_AREA(0, (280*2)-1,0,192-1) + MCFG_SCREEN_UPDATE_DRIVER(tk2000_state, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(tk2000_state, tk2000) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(A2_SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* /INH banking */ + MCFG_DEVICE_ADD(A2_UPPERBANK_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(inhbank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + MCFG_CASSETTE_ADD(A2_CASSETTE_TAG) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ +ROM_START(tk2000) + ROM_REGION(0x4000,"maincpu",0) + ROM_LOAD( "tk2000.rom", 0x000000, 0x004000, CRC(dfdbacc3) SHA1(bb37844c31616046630868a4399ee3d55d6df277) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1984, tk2000, 0, 0, tk2000, tk2000, driver_device, 0, "Microdigital", "TK2000", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/tk80.c b/src/mame/drivers/tk80.c new file mode 100644 index 00000000000..c6b79cc7d54 --- /dev/null +++ b/src/mame/drivers/tk80.c @@ -0,0 +1,344 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + + +NEC TK80 / MIKROLAB KR580IK80 +***************************** +TK80 driver by Robbbert +Mikrolab driver by Micko +Merged by Robbbert. + +TK80 (Training Kit 80) considered to be Japan's first home computer. +It consisted of 25 keys and 8 LED digits, and was programmed in hex. +The Mikrolab is a Russian clone which appears to be almost completely identical. + +TK85 seems to be the same as TK80, except is has a larger ROM. No +schematics etc are available. Thanks to 'Nama' who dumped the rom. +It has 25 keys, so a few aren't defined yet. + +ND-80Z : http://www.alles.or.jp/~thisida/nd80z3syokai.html (newer version) +Like the TK85, it has a 2KB rom. Thanks again to 'Nama' who dumped it. + +When booted, the system begins at 0000 which is ROM. You need to change the +address to 8000 before entering a program. Here is a test to paste in: +8000-11^22^33^44^55^66^77^88^99^8000- +Press the right-arrow to confirm data has been entered. + +Operation: +4 digits at left is the address; 2 digits at right is the data. +As you increment addresses, the middle 2 digits show the previous byte. +You can enter 4 digits, and pressing 'ADRS SET' will transfer this info +to the left, thus setting the address to this value. Press 'WRITE INCR' to +store new data and increment the address. Press 'READ INCR' and 'READ DECR' +to scan through data without updating it. Other keys unknown/not implemented. + +ToDo: +- Add storage + + + +ICS8080 +- Keys labels are correct, but which key is which is not known +- Character B is corrupt +- Operation is different to the other systems + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "machine/keyboard.h" +#include "tk80.lh" + + +class tk80_state : public driver_device +{ +public: + tk80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + + DECLARE_READ8_MEMBER(key_matrix_r); + DECLARE_READ8_MEMBER(nd80z_key_r); + DECLARE_READ8_MEMBER(serial_r); + DECLARE_WRITE8_MEMBER(serial_w); + DECLARE_WRITE8_MEMBER(mikrolab_serial_w); + DECLARE_READ8_MEMBER(display_r); + DECLARE_WRITE8_MEMBER(display_w); + UINT8 m_term_data; + UINT8 m_keyb_press; + UINT8 m_keyb_press_flag; + UINT8 m_shift_press_flag; + UINT8 m_ppi_portc; + required_device m_maincpu; +}; + + +READ8_MEMBER( tk80_state::display_r ) +{ + return output_get_digit_value(offset); +} + +WRITE8_MEMBER( tk80_state::display_w ) +{ + output_set_digit_value(offset, data); +} + +static ADDRESS_MAP_START(tk80_mem, AS_PROGRAM, 8, tk80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x83ff) // A10-14 not connected + AM_RANGE(0x0000, 0x02ff) AM_ROM + AM_RANGE(0x0300, 0x03ff) AM_RAM // EEPROM + AM_RANGE(0x8000, 0x83f7) AM_RAM // RAM + AM_RANGE(0x83f8, 0x83ff) AM_RAM AM_READWRITE(display_r,display_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tk85_mem, AS_PROGRAM, 8, tk80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x87ff) // A10-14 not connected + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x8000, 0x83f7) AM_RAM + AM_RANGE(0x83f8, 0x83ff) AM_RAM AM_READWRITE(display_r,display_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ics8080_mem, AS_PROGRAM, 8, tk80_state) + ADDRESS_MAP_UNMAP_HIGH + //ADDRESS_MAP_GLOBAL_MASK(0x87ff) // A10-14 not connected + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x8000, 0x83f7) AM_RAM + AM_RANGE(0x83f8, 0x83ff) AM_RAM AM_READWRITE(display_r,display_w) + AM_RANGE(0x8400, 0x8fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tk80_io, AS_IO, 8, tk80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x03) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(mikrolab_io, AS_IO, 8, tk80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x03) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(nd80z_io, AS_IO, 8, tk80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x03) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( tk80 ) + PORT_START("X0") /* KEY ROW 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("X1") /* KEY ROW 1 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("X2") /* KEY ROW 2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RET") PORT_CODE(KEYCODE_W) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADRS SET") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("READ DECR") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("READ INCR") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("WRITE INCR") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STORE DATA") PORT_CODE(KEYCODE_I) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOAD DATA") PORT_CODE(KEYCODE_O) +INPUT_PORTS_END + +INPUT_PORTS_START( mikrolab ) + PORT_INCLUDE( tk80 ) + PORT_MODIFY("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESUME") PORT_CODE(KEYCODE_W) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADDRESS") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SAVE") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("END") PORT_CODE(KEYCODE_I) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_O) +INPUT_PORTS_END + +INPUT_PORTS_START( ics8080 ) + PORT_INCLUDE( tk80 ) + PORT_MODIFY("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADDR") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_T) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLR") PORT_CODE(KEYCODE_U) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_I) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_O) +INPUT_PORTS_END + +READ8_MEMBER( tk80_state::key_matrix_r ) +{ +// PA0-7 keyscan in + + UINT8 data = 0xff; + + if (BIT(m_ppi_portc, 4)) + data &= ioport("X0")->read(); + if (BIT(m_ppi_portc, 5)) + data &= ioport("X1")->read(); + if (BIT(m_ppi_portc, 6)) + data &= ioport("X2")->read(); + + return data; +} + +READ8_MEMBER( tk80_state::nd80z_key_r ) +{ +// PA0-7 keyscan in + + UINT8 data = 0xff, row = m_ppi_portc & 7; + if (row == 6) + data &= ioport("X0")->read(); + else + if (row == 5) + data &= ioport("X1")->read(); + else + if (row == 3) + data &= ioport("X2")->read(); + + return data; +} + +READ8_MEMBER( tk80_state::serial_r ) +{ +// PB0 - serial in + //printf("B R\n"); + + return 0; +} + +WRITE8_MEMBER( tk80_state::serial_w ) +{ +// PC0 - serial out +// PC4-6 keyscan out +// PC7 - display on/off + m_ppi_portc = data ^ 0x70; +} + +WRITE8_MEMBER( tk80_state::mikrolab_serial_w ) +{ +// PC0 - serial out +// PC4-6 keyscan out +// PC7 - display on/off + m_ppi_portc = data; +} + +static MACHINE_CONFIG_START( tk80, tk80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_1MHz) // 18.432 / 9 + MCFG_CPU_PROGRAM_MAP(tk80_mem) + MCFG_CPU_IO_MAP(tk80_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_tk80) + + /* Devices */ + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(tk80_state, key_matrix_r)) + MCFG_I8255_IN_PORTB_CB(READ8(tk80_state, serial_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(tk80_state, serial_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mikrolab, tk80 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(tk85_mem) + MCFG_CPU_IO_MAP(mikrolab_io) + + /* Devices */ + MCFG_DEVICE_REMOVE("ppi8255") + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(tk80_state, key_matrix_r)) + MCFG_I8255_IN_PORTB_CB(READ8(tk80_state, serial_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(tk80_state, mikrolab_serial_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( nd80z, tk80 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(tk85_mem) + MCFG_CPU_IO_MAP(nd80z_io) + + /* Devices */ + MCFG_DEVICE_REMOVE("ppi8255") + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(tk80_state, nd80z_key_r)) + MCFG_I8255_IN_PORTB_CB(READ8(tk80_state, serial_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(tk80_state, mikrolab_serial_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tk85, tk80 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(tk85_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ics8080, tk80 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(ics8080_mem) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( tk80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "tk80-1.bin", 0x0000, 0x0100, CRC(897295e4) SHA1(50fb42b07252fc48044830e2f228e218fc59481c)) + ROM_LOAD( "tk80-2.bin", 0x0100, 0x0100, CRC(d54480c3) SHA1(354962aca1710ac75b40c8c23a6c303938f9d596)) + ROM_LOAD( "tk80-3.bin", 0x0200, 0x0100, CRC(8d4b02ef) SHA1(2b5a1ee8f97db23ffec48b96f12986461024c995)) +ROM_END + +ROM_START( ics8080 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "amtsmnonv27.rom1", 0x0000, 0x0800, CRC(82d40dc5) SHA1(9215457101c3b9b8706dbebe902196494993a282) ) + ROM_LOAD( "thmcplv11.rom2", 0x0800, 0x0800, CRC(51784f70) SHA1(c05c75d566c4ff8f681eba29cd48e72b95be89e0) ) + ROM_LOAD( "tunev08.rom3", 0x1000, 0x0800, CRC(aae2344b) SHA1(b02b22cadb43c7ac26c43d443688b9b19d465973) ) + ROM_LOAD( "mtrspdv12.rom4", 0x1800, 0x0800, CRC(920dda33) SHA1(631ee5e6314d9788e7be0ae00a97b55693eeb855) ) +ROM_END + +ROM_START( mikrolab ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + /* these dumps are taken from PDF so need check with real device */ + ROM_LOAD( "rom-1.bin", 0x0000, 0x0200, BAD_DUMP CRC(eed5f23b) SHA1(c82f7a16ce44c4fcbcb333245555feae1fcdf058)) + ROM_LOAD( "rom-2.bin", 0x0200, 0x0200, BAD_DUMP CRC(726a224f) SHA1(7ed8d2c6dd4fb7836475e207e1972e33a6a91d2f)) +ROM_END + +ROM_START( nectk85 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "tk85.bin", 0x0000, 0x0800, CRC(8a0b6d7e) SHA1(6acc8c04990692b08929043ccf638761b7301def)) +ROM_END + +ROM_START( nd80z ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "nd80z.bin", 0x0000, 0x0800, CRC(fe829f1d) SHA1(6fff31884b8d984076d4450ca3a3e48efadeb648)) +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1976, tk80, 0, 0, tk80, tk80, driver_device, 0, "Nippon Electronic Company", "TK-80", MACHINE_NO_SOUND_HW) +COMP( 1980, nectk85, tk80, 0, tk85, tk80, driver_device, 0, "Nippon Electronic Company", "TK-85", MACHINE_NO_SOUND_HW) +COMP( 19??, nd80z, tk80, 0, nd80z, tk80, driver_device, 0, "Chunichi", "ND-80Z", MACHINE_NO_SOUND_HW) +COMP( 19??, mikrolab, tk80, 0, mikrolab, mikrolab, driver_device, 0, "", "Mikrolab KR580IK80", MACHINE_NO_SOUND_HW) +COMP( 19??, ics8080, tk80, 0, ics8080, ics8080, driver_device, 0, "", "ICS8080", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/tk80bs.c b/src/mame/drivers/tk80bs.c new file mode 100644 index 00000000000..99d6f1f1db5 --- /dev/null +++ b/src/mame/drivers/tk80bs.c @@ -0,0 +1,225 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese, Robbbert +/*************************************************************************** + + +NEC TK80BS +********** +TK-80BS (c) 1980 NEC + +Preliminary driver by Angelo Salese +Various additions by Robbbert + +The TK80BS (Basic Station) has a plugin keyboard, BASIC in rom, +and connected to a tv. + +TODO: + - (try to) dump proper roms, the whole driver is based off fake roms; + - bios 0 BASIC doesn't seem to work properly; (It does if you type NEW first) + - bios 1 does not boot up because it runs off into the weeds + - bios 2 also does that, somehow it starts up anyway, but no commands work + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "machine/keyboard.h" + +#define KEYBOARD_TAG "keyboard" + +class tk80bs_state : public driver_device +{ +public: + tk80bs_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_ppi(*this, "ppi"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { + } + + DECLARE_READ8_MEMBER(ppi_custom_r); + DECLARE_WRITE8_MEMBER(ppi_custom_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(port_a_r); + DECLARE_READ8_MEMBER(port_b_r); + UINT32 screen_update_tk80bs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; +private: + UINT8 m_term_data; + required_device m_maincpu; + required_device m_ppi; + required_device m_gfxdecode; + required_device m_palette; +}; + + +UINT32 tk80bs_state::screen_update_tk80bs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + int count; + + count = 0; + + for(y=0;y<16;y++) + { + for(x=0;x<32;x++) + { + int tile = m_p_videoram[count++]; + + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*8); + } + } + + return 0; +} + +/* A0 and A1 are swapped at the 8255 chip */ +READ8_MEMBER( tk80bs_state::ppi_custom_r ) +{ + switch(offset) + { + case 1: + return m_ppi->read(space, 2); + case 2: + return m_ppi->read(space, 1); + default: + return m_ppi->read(space, offset); + } +} + +WRITE8_MEMBER( tk80bs_state::ppi_custom_w ) +{ + switch(offset) + { + case 1: + m_ppi->write(space, 2, data); + break; + case 2: + m_ppi->write(space, 1, data); + break; + default: + m_ppi->write(space, offset, data); + } +} + +static ADDRESS_MAP_START(tk80bs_mem, AS_PROGRAM, 8, tk80bs_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM +// AM_RANGE(0x0c00, 0x7bff) AM_ROM // ext + AM_RANGE(0x7df8, 0x7df9) AM_NOP // i8251 sio + AM_RANGE(0x7dfc, 0x7dff) AM_READWRITE(ppi_custom_r,ppi_custom_w) + AM_RANGE(0x7e00, 0x7fff) AM_RAM AM_SHARE("videoram") // video ram + AM_RANGE(0x8000, 0xcfff) AM_RAM // RAM + AM_RANGE(0xd000, 0xefff) AM_ROM // BASIC + AM_RANGE(0xf000, 0xffff) AM_ROM // BSMON +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( tk80bs ) +INPUT_PORTS_END + +READ8_MEMBER( tk80bs_state::port_a_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + + +READ8_MEMBER( tk80bs_state::port_b_r ) +{ + if (m_term_data) + { + m_ppi->pc4_w(0); // send a strobe pulse + return 0x20; + } + else + return 0; +} + +WRITE8_MEMBER( tk80bs_state::kbd_put ) +{ + data &= 0x7f; + if (data > 0x5f) data-=0x20; + m_term_data = data; +} + +/* F4 Character Displayer */ +static const gfx_layout tk80bs_charlayout = +{ + 8, 8, + 512, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( tk80bs ) + GFXDECODE_ENTRY( "chargen", 0x0000, tk80bs_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( tk80bs, tk80bs_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_1MHz) //unknown clock + MCFG_CPU_PROGRAM_MAP(tk80bs_mem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256, 128) + MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 128-1) + MCFG_SCREEN_UPDATE_DRIVER(tk80bs_state, screen_update_tk80bs) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", tk80bs) + + /* Devices */ + MCFG_DEVICE_ADD("ppi", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(tk80bs_state, port_a_r)) + MCFG_I8255_IN_PORTB_CB(READ8(tk80bs_state, port_b_r)) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(tk80bs_state, kbd_put)) +MACHINE_CONFIG_END + + +ROM_START( tk80bs ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + /* all of these aren't taken from an original machine*/ + ROM_SYSTEM_BIOS(0, "psedo", "Pseudo LEVEL 1") + ROMX_LOAD( "tk80.dummy", 0x0000, 0x0800, BAD_DUMP CRC(553b25ca) SHA1(939350d7fa56ce567ddf393c9f4b9db6ebc18a2c), ROM_BIOS(1)) + ROMX_LOAD( "ext.l1", 0x0c00, 0x6e46, BAD_DUMP CRC(d05ed3ff) SHA1(8544aa2cb58df9edf221f5be2cdafa248dd33828), ROM_BIOS(1)) + ROMX_LOAD( "lv1basic.l1",0xe000, 0x09a2, BAD_DUMP CRC(3ff67a71) SHA1(528c9331740637e853c099e1739ecdea6dd200bc), ROM_BIOS(1)) + ROMX_LOAD( "bsmon.l1", 0xf000, 0x0db0, BAD_DUMP CRC(5daa599b) SHA1(7e6ec5bfb3eea114f7ee9ef589a89246b8533b2f), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "psedo10", "Pseudo LEVEL 2 1.0") + ROMX_LOAD( "tk80.dummy", 0x0000, 0x0800, BAD_DUMP CRC(553b25ca) SHA1(939350d7fa56ce567ddf393c9f4b9db6ebc18a2c), ROM_BIOS(2)) + ROMX_LOAD( "ext.10", 0x0c00, 0x3dc2, BAD_DUMP CRC(3c64d488) SHA1(919180d5b34b981ab3dd8b2885d3c0933203f355), ROM_BIOS(2)) + ROMX_LOAD( "lv2basic.10",0xd000, 0x2000, BAD_DUMP CRC(594fe70e) SHA1(5854c1be5fa78c1bfee365379495f14bc23e15e7), ROM_BIOS(2)) + ROMX_LOAD( "bsmon.10", 0xf000, 0x0daf, BAD_DUMP CRC(d0047983) SHA1(79e2b5dc47b574b55375cbafffff144744093ec1), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(2, "psedo11", "Pseudo LEVEL 2 1.1") + ROMX_LOAD( "tk80.dummy", 0x0000, 0x0800, BAD_DUMP CRC(553b25ca) SHA1(939350d7fa56ce567ddf393c9f4b9db6ebc18a2c), ROM_BIOS(3)) + ROMX_LOAD( "ext.11", 0x0c00, 0x3dd4, BAD_DUMP CRC(bd5c5169) SHA1(2ad70828348372328b76bac0fa93d3f6f17ade34), ROM_BIOS(3)) + ROMX_LOAD( "lv2basic.11",0xd000, 0x2000, BAD_DUMP CRC(3df9a3bd) SHA1(9539409c876bce27d630fe47d07a4316d2ce09cb), ROM_BIOS(3)) + ROMX_LOAD( "bsmon.11", 0xf000, 0x0ff6, BAD_DUMP CRC(fca7a609) SHA1(7c7eb5e5e4cf1e0021383bdfc192b88262aba6f5), ROM_BIOS(3)) + + ROM_REGION( 0x1000, "chargen", ROMREGION_ERASEFF ) + ROM_LOAD( "font.rom", 0x0000, 0x1000, BAD_DUMP CRC(94d95199) SHA1(9fe741eab866b0c520d4108bccc6277172fa190c)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, tk80bs, tk80, 0, tk80bs, tk80bs, driver_device, 0, "Nippon Electronic Company", "TK-80BS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/tm990189.c b/src/mame/drivers/tm990189.c new file mode 100644 index 00000000000..f6c778dd305 --- /dev/null +++ b/src/mame/drivers/tm990189.c @@ -0,0 +1,1051 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet, Robbbert +/* + Experimental tm990/189 ("University Module") driver. + + The tm990/189 is a simple board built around a tms9980 at 2.0 MHz. + The board features: + * a calculator-like alphanumeric keyboard, a 10-digit 8-segment display, + a sound buzzer and 4 status LEDs + * a 4kb ROM socket (0x3000-0x3fff), and a 2kb ROM socket (0x0800-0x0fff) + * 1kb of RAM expandable to 2kb (0x0000-0x03ff and 0x0400-0x07ff) + * a tms9901 controlling a custom parallel I/O port (available for + expansion) + * an optional on-board serial interface (either TTY or RS232): TI ROMs + support a terminal connected to this port + * an optional tape interface + * an optional bus extension port for adding additional custom devices (TI + sold a video controller expansion built around a tms9918, which was + supported by University Basic) + + One tms9901 is set up so that it handles tms9980 interrupts. The other + tms9901, the tms9902, and extension cards can trigger interrupts on the + interrupt-handling tms9901. + + TI sold two ROM sets for this machine: a monitor and assembler ("UNIBUG", + packaged as one 4kb EPROM) and a Basic interpreter ("University BASIC", + packaged as a 4kb and a 2kb EPROM). Users could burn and install custom + ROM sets, too. + + This board was sold to universities to learn either assembly language or + BASIC programming. + + A few hobbyists may have bought one of these, too. This board can actually + be used as a development kit for the tms9980, but it was not supported as + such (there was no EPROM programmer or mass storage system for the + tm990/189, though you could definitively design your own and attach them to + the extension port). + + - Raphael Nabet 2003 + + Bug - The input buffer of character segments isn't fully cleared. If you + press Shift, then Z enough times, garbage appears. This is because + the boot process should have set 18C-1CB to FF, but only sets up to 1B3. + + Need a dump of the UNIBUG rom. + + Demo programs for the 990189v: You can get impressive colour displays (with + sprites) from the 4 included demos. Press the Enter key after each instruction, + and wait for the READY prompt before proceeding to the next. + + NEW + LOADx (where x = 0,1,2,3) + RUN + + University BASIC fully supports the tms9918 videocard option. For example, enter + COLOR x (where x = 1 to 15), to get a coloured background. + + - Robbbert 2011 + +******************************************************************************************/ + +#include "emu.h" +#include "cpu/tms9900/tms9980a.h" +#include "machine/tms9901.h" +#include "machine/tms9902.h" +#include "video/tms9928a.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "tm990189.lh" +#include "tm990189v.lh" + +#define TMS9901_0_TAG "tms9901_usr" +#define TMS9901_1_TAG "tms9901_sys" + +class tm990189_state : public driver_device +{ +public: + tm990189_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_tms9980a(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cass(*this, "cassette"), + m_tms9918(*this, "tms9918" ), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_tms9901_usr(*this, TMS9901_0_TAG), + m_tms9901_sys(*this, TMS9901_1_TAG) { } + + required_device m_tms9980a; + required_device m_speaker; + required_device m_cass; + optional_device m_tms9918; + + DECLARE_READ8_MEMBER( interrupt_level ); + + DECLARE_READ8_MEMBER(video_vdp_r); + DECLARE_WRITE8_MEMBER(video_vdp_w); + DECLARE_READ8_MEMBER(video_joy_r); + DECLARE_WRITE8_MEMBER(video_joy_w); + int m_load_state; + + int m_digitsel; + int m_segment; + emu_timer *m_displayena_timer; + UINT8 m_segment_state[10]; + UINT8 m_old_segment_state[10]; + UINT8 m_LED_state; + emu_timer *m_joy1x_timer; + emu_timer *m_joy1y_timer; + emu_timer *m_joy2x_timer; + emu_timer *m_joy2y_timer; + device_image_interface *m_rs232_fp; + UINT8 m_rs232_rts; + emu_timer *m_rs232_input_timer; + UINT8 m_bogus_read_save; + + DECLARE_WRITE8_MEMBER( external_operation ); + + DECLARE_INPUT_CHANGED_MEMBER( load_interrupt ); + + DECLARE_WRITE_LINE_MEMBER(usr9901_led0_w); + DECLARE_WRITE_LINE_MEMBER(usr9901_led1_w); + DECLARE_WRITE_LINE_MEMBER(usr9901_led2_w); + DECLARE_WRITE_LINE_MEMBER(usr9901_led3_w); + DECLARE_WRITE8_MEMBER(usr9901_interrupt_callback); + + DECLARE_WRITE8_MEMBER(sys9901_interrupt_callback); + DECLARE_READ8_MEMBER(sys9901_r); + DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel0_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel1_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel2_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel3_w); + + DECLARE_WRITE_LINE_MEMBER(sys9901_segment0_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_segment1_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_segment2_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_segment3_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_segment4_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_segment5_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_segment6_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_segment7_w); + + DECLARE_WRITE_LINE_MEMBER(sys9901_dsplytrgr_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_shiftlight_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_spkrdrive_w); + DECLARE_WRITE_LINE_MEMBER(sys9901_tapewdata_w); + + DECLARE_WRITE8_MEMBER( xmit_callback ); + DECLARE_MACHINE_START(tm990_189); + DECLARE_MACHINE_RESET(tm990_189); + DECLARE_MACHINE_START(tm990_189_v); + DECLARE_MACHINE_RESET(tm990_189_v); + + TIMER_DEVICE_CALLBACK_MEMBER(display_callback); + TIMER_CALLBACK_MEMBER(clear_load); + void hold_load(); +private: + void draw_digit(void); + void led_set(int number, bool state); + void segment_set(int offset, bool state); + void digitsel(int offset, bool state); + required_device m_maincpu; + required_device m_cassette; + required_device m_tms9901_usr; + required_device m_tms9901_sys; +}; + + +#define displayena_duration attotime::from_usec(4500) /* Can anyone confirm this? 74LS123 connected to C=0.1uF and R=100kOhm */ + +MACHINE_RESET_MEMBER(tm990189_state,tm990_189) +{ + m_tms9980a->set_ready(ASSERT_LINE); + m_tms9980a->set_hold(CLEAR_LINE); + hold_load(); +} + +MACHINE_START_MEMBER(tm990189_state,tm990_189) +{ + m_displayena_timer = machine().scheduler().timer_alloc(FUNC_NULL); +} + +MACHINE_START_MEMBER(tm990189_state,tm990_189_v) +{ + m_displayena_timer = machine().scheduler().timer_alloc(FUNC_NULL); + + m_joy1x_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_joy1y_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_joy2x_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_joy2y_timer = machine().scheduler().timer_alloc(FUNC_NULL); +} + +MACHINE_RESET_MEMBER(tm990189_state,tm990_189_v) +{ + m_tms9980a->set_ready(ASSERT_LINE); + m_tms9980a->set_hold(CLEAR_LINE); + hold_load(); +} + +/* + hold and debounce load line (emulation is inaccurate) +*/ + +TIMER_CALLBACK_MEMBER(tm990189_state::clear_load) +{ + m_load_state = FALSE; + m_tms9980a->set_input_line(INT_9980A_LOAD, CLEAR_LINE); +} + +void tm990189_state::hold_load() +{ + m_load_state = TRUE; + m_tms9980a->set_input_line(INT_9980A_LOAD, ASSERT_LINE); + machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(tm990189_state::clear_load),this)); +} + +/* + LOAD interrupt switch +*/ +INPUT_CHANGED_MEMBER( tm990189_state::load_interrupt ) +{ + // When depressed, fire LOAD (neg logic) + if (newval==CLEAR_LINE) hold_load(); +} + + +/* + tm990_189 video emulation. + + Has an integrated 10 digit 8-segment display. + Supports EIA and TTY terminals, and an optional 9918 controller. +*/ + +void tm990189_state::draw_digit() +{ + m_segment_state[m_digitsel] |= ~m_segment; +} + + +TIMER_DEVICE_CALLBACK_MEMBER(tm990189_state::display_callback) +{ + UINT8 i; + char ledname[8]; + // since the segment data is cleared after being used, the old_segment is there + // in case the segment data hasn't been refreshed yet. + for (i = 0; i < 10; i++) + { + m_old_segment_state[i] |= m_segment_state[i]; + sprintf(ledname,"digit%d",i); + output_set_digit_value(i, m_old_segment_state[i]); + m_old_segment_state[i] = m_segment_state[i]; + m_segment_state[i] = 0; + } + + for (i = 0; i < 7; i++) + { + sprintf(ledname,"led%d",i); + output_set_value(ledname, !BIT(m_LED_state, i)); + } +} + +/* + tms9901 code +*/ + +WRITE8_MEMBER( tm990189_state::usr9901_interrupt_callback ) +{ + // Triggered by internal timer (set by ROM to 1.6 ms cycle) on level 3 + // or by keyboard interrupt (level 6) + if (!m_load_state) + { + m_tms9980a->set_input_line(offset & 7, ASSERT_LINE); + } +} + +void tm990189_state::led_set(int offset, bool state) +{ + if (state) + m_LED_state |= (1 << offset); + else + m_LED_state &= ~(1 << offset); +} + +WRITE_LINE_MEMBER( tm990189_state::usr9901_led0_w ) +{ + led_set(0, state); +} + +WRITE_LINE_MEMBER( tm990189_state::usr9901_led1_w ) +{ + led_set(1, state); +} + +WRITE_LINE_MEMBER( tm990189_state::usr9901_led2_w ) +{ + led_set(2, state); +} + +WRITE_LINE_MEMBER( tm990189_state::usr9901_led3_w ) +{ + led_set(3, state); +} + +WRITE8_MEMBER( tm990189_state::sys9901_interrupt_callback ) +{ + // machine().device("tms9901_0")->set_single_int(5, (data!=0)? ASSERT_LINE:CLEAR_LINE); + // TODO: Check this + m_tms9901_usr->set_single_int(5, (data!=0)? ASSERT_LINE:CLEAR_LINE); +} + +READ8_MEMBER( tm990189_state::sys9901_r ) +{ + UINT8 data = 0; + if (offset == TMS9901_CB_INT7) + { + static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8" }; + + /* keyboard read */ + if (m_digitsel < 9) + data |= ioport(keynames[m_digitsel])->read() << 1; + + /* tape input */ + if (m_cass->input() > 0.0) + data |= 0x40; + } + + return data; +} + +void tm990189_state::digitsel(int offset, bool state) +{ + if (state) + m_digitsel |= 1 << offset; + else + m_digitsel &= ~ (1 << offset); +} + +WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel0_w ) +{ + digitsel(0, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel1_w ) +{ + digitsel(1, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel2_w ) +{ + digitsel(2, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel3_w ) +{ + digitsel(3, state); +} + + +void tm990189_state::segment_set(int offset, bool state) +{ + if (state) + m_segment |= 1 << offset; + else + { + m_segment &= ~ (1 << offset); + if ((m_displayena_timer->remaining() > attotime::zero) && (m_digitsel < 10)) + draw_digit(); + } +} + +WRITE_LINE_MEMBER( tm990189_state::sys9901_segment0_w ) +{ + segment_set(0, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_segment1_w ) +{ + segment_set(1, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_segment2_w ) +{ + segment_set(2, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_segment3_w ) +{ + segment_set(3, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_segment4_w ) +{ + segment_set(4, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_segment5_w ) +{ + segment_set(5, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_segment6_w ) +{ + segment_set(6, state); +} +WRITE_LINE_MEMBER( tm990189_state::sys9901_segment7_w ) +{ + segment_set(7, state); +} + +WRITE_LINE_MEMBER( tm990189_state::sys9901_dsplytrgr_w ) +{ + if ((!state) && (m_digitsel < 10)) + { + m_displayena_timer->reset(displayena_duration); + draw_digit(); + } +} + +WRITE_LINE_MEMBER( tm990189_state::sys9901_shiftlight_w ) +{ + if (state) + m_LED_state |= 0x10; + else + m_LED_state &= ~0x10; +} + +WRITE_LINE_MEMBER( tm990189_state::sys9901_spkrdrive_w ) +{ + m_speaker->level_w(state); +} + +WRITE_LINE_MEMBER( tm990189_state::sys9901_tapewdata_w ) +{ + m_cassette->output(state ? +1.0 : -1.0); +} + +class tm990_189_rs232_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + tm990_189_rs232_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_SERIAL; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return ""; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +}; + +const device_type TM990_189_RS232 = &device_creator; + +tm990_189_rs232_image_device::tm990_189_rs232_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TM990_189_RS232, "TM990/189 RS232 port", tag, owner, clock, "tm990_189_rs232_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +void tm990_189_rs232_image_device::device_config_complete() +{ + update_names(); +} + +void tm990_189_rs232_image_device::device_start() +{ +} + +void tm990_189_rs232_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + //tm990189_state *state = machine.driver_data(); + UINT8 buf; + if (/*state->m_rs232_rts &&*/ /*(mame_ftell(state->m_rs232_fp) < mame_fsize(state->m_rs232_fp))*/1) + { + tms9902_device* tms9902 = static_cast(machine().device("tms9902")); + if (fread(&buf, 1) == 1) + tms9902->rcv_data(buf); + } +} + +bool tm990_189_rs232_image_device::call_load() +{ + tm990189_state *state = machine().driver_data(); + tms9902_device* tms9902 = static_cast(machine().device("tms9902")); + tms9902->rcv_dsr(ASSERT_LINE); + state->m_rs232_input_timer = timer_alloc(); + state->m_rs232_input_timer->adjust(attotime::zero, 0, attotime::from_msec(10)); + return IMAGE_INIT_PASS; +} + + +void tm990_189_rs232_image_device::call_unload() +{ + tm990189_state *state = machine().driver_data(); + tms9902_device* tms9902 = static_cast(machine().device("tms9902")); + tms9902->rcv_dsr(CLEAR_LINE); + + state->m_rs232_input_timer->reset(); /* FIXME - timers should only be allocated once */ +} + +#define MCFG_TM990_189_RS232_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, TM990_189_RS232, 0) + + +/* static TMS9902_RTS_CALLBACK( rts_callback ) +{ + tm990189 *state = device->machine().driver_data(); + state->m_rs232_rts = RTS; + tms9902->set_cts(RTS); +} */ + +WRITE8_MEMBER( tm990189_state::xmit_callback ) +{ + UINT8 buf = data; + if (m_rs232_fp) m_rs232_fp->fwrite(&buf, 1); +} + +/* + External instruction decoding +*/ +WRITE8_MEMBER( tm990189_state::external_operation ) +{ + switch (offset) + { + case 2: // IDLE + if (data) + m_LED_state |= 0x40; + else + m_LED_state &= ~0x40; + break; + case 3: // RSET + // Not used on the default board + break; + case 5: // CKON: set DECKCONTROL + m_LED_state |= 0x20; + m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + break; + case 6: // CKOF: clear DECKCONTROL + m_LED_state &= ~0x20; + m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + break; + case 7: // LREX: trigger LOAD + hold_load(); + break; + default: // undefined + break; + } +} + +/* + Video Board handling +*/ + +READ8_MEMBER( tm990189_state::video_vdp_r ) +{ + int reply = 0; + + /* When the tms9980 reads @>2000 or @>2001, it actually does a word access: + it reads @>2000 first, then @>2001. According to schematics, both access + are decoded to the VDP: read accesses are therefore bogus, all the more so + since the two reads are too close (1us) for the VDP to be able to reload + the read buffer: the read address pointer is probably incremented by 2, but + only the first byte is valid. There is a work around for this problem: all + you need is reloading the address pointer before each read. However, + software always uses the second byte, which is very weird, particularly + for the status port. Presumably, since the read buffer has not been + reloaded, the second byte read from the memory read port is equal to the + first; however, this explanation is not very convincing for the status + port. Still, I do not have any better explanation, so I will stick with + it. */ + + if (offset & 2) + reply = m_tms9918->register_read(space, 0); + else + reply = m_tms9918->vram_read(space, 0); + + if (!(offset & 1)) + m_bogus_read_save = reply; + else + reply = m_bogus_read_save; + + return reply; +} + +WRITE8_MEMBER( tm990189_state::video_vdp_w ) +{ + if (offset & 1) + { + if (offset & 2) + m_tms9918->register_write(space, 0, data); + else + m_tms9918->vram_write(space, 0, data); + } +} + +READ8_MEMBER( tm990189_state::video_joy_r ) +{ + UINT8 data = ioport("BUTTONS")->read(); + + if (m_joy1x_timer->remaining() < attotime::zero) + data |= 0x01; + + if (m_joy1y_timer->remaining() < attotime::zero) + data |= 0x02; + + if (m_joy2x_timer->remaining() < attotime::zero) + data |= 0x08; + + if (m_joy2y_timer->remaining() < attotime::zero) + data |= 0x10; + + return data; +} + +WRITE8_MEMBER( tm990189_state::video_joy_w ) +{ + m_joy1x_timer->reset(attotime::from_usec(ioport("JOY1_X")->read()*28+28)); + m_joy1y_timer->reset(attotime::from_usec(ioport("JOY1_Y")->read()*28+28)); + m_joy2x_timer->reset(attotime::from_usec(ioport("JOY2_X")->read()*28+28)); + m_joy2y_timer->reset(attotime::from_usec(ioport("JOY2_Y")->read()*28+28)); +} + +/* +// user tms9901 setup +static const tms9901_interface usr9901reset_param = +{ + TMS9901_INT1 | TMS9901_INT2 | TMS9901_INT3 | TMS9901_INT4 | TMS9901_INT5 | TMS9901_INT6, // only input pins whose state is always known + + // Read handler. Covers all input lines (see tms9901.h) + DEVCB_NULL, + + // write handlers + { + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led0_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led1_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led2_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led3_w), + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL, + DEVCB_NULL + }, + + // interrupt handler + DEVCB_DRIVER_MEMBER(tm990189_state, usr9901_interrupt_callback) +}; +*/ + +/* +// system tms9901 setup +static const tms9901_interface sys9901reset_param = +{ + 0, // only input pins whose state is always known + + // Read handler. Covers all input lines (see tms9901.h) + DEVCB_DRIVER_MEMBER(tm990189_state, sys9901_r), + + // write handlers + { + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel0_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel1_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel2_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel3_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment0_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment1_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment2_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment3_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment4_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment5_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment6_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment7_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_dsplytrgr_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_shiftlight_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_spkrdrive_w), + DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_tapewdata_w) + }, + + // interrupt handler + DEVCB_DRIVER_MEMBER(tm990189_state, sys9901_interrupt_callback) +}; + +*/ + +/* + Memory map: + + 0x0000-0x03ff: 1kb RAM + 0x0400-0x07ff: 1kb onboard expansion RAM + 0x0800-0x0bff or 0x0800-0x0fff: 1kb or 2kb onboard expansion ROM + 0x1000-0x2fff: reserved for offboard expansion + Only known card: Color Video Board + 0x1000-0x17ff (R): Video board ROM 1 + 0x1800-0x1fff (R): Video board ROM 2 + 0x2000-0x27ff (R): tms9918 read ports (bogus) + (address & 2) == 0: data port (bogus) + (address & 2) == 1: status register (bogus) + 0x2800-0x2fff (R): joystick read port + d2: joy 2 switch + d3: joy 2 Y (length of pulse after retrigger is proportional to axis position) + d4: joy 2 X (length of pulse after retrigger is proportional to axis position) + d2: joy 1 switch + d3: joy 1 Y (length of pulse after retrigger is proportional to axis position) + d4: joy 1 X (length of pulse after retrigger is proportional to axis position) + 0x1801-0x1fff ((address & 1) == 1) (W): joystick write port (retrigger) + 0x2801-0x2fff ((address & 1) == 1) (W): tms9918 write ports + (address & 2) == 0: data port + (address & 2) == 1: control register + 0x3000-0x3fff: 4kb onboard ROM +*/ + +static ADDRESS_MAP_START( tm990_189_memmap, AS_PROGRAM, 8, tm990189_state ) + AM_RANGE(0x0000, 0x07ff) AM_RAM /* RAM */ + AM_RANGE(0x0800, 0x0fff) AM_ROM /* extra ROM - application programs with unibug, remaining 2kb of program for university basic */ + AM_RANGE(0x1000, 0x2fff) AM_NOP /* reserved for expansion (RAM and/or tms9918 video controller) */ + AM_RANGE(0x3000, 0x3fff) AM_ROM /* main ROM - unibug or university basic */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tm990_189_v_memmap, AS_PROGRAM, 8, tm990189_state ) + AM_RANGE(0x0000, 0x07ff) AM_RAM /* RAM */ + AM_RANGE(0x0800, 0x0fff) AM_ROM /* extra ROM - application programs with unibug, remaining 2kb of program for university basic */ + + AM_RANGE(0x1000, 0x17ff) AM_ROM AM_WRITENOP /* video board ROM 1 */ + AM_RANGE(0x1800, 0x1fff) AM_ROM AM_WRITE(video_joy_w) /* video board ROM 2 and joystick write port*/ + AM_RANGE(0x2000, 0x27ff) AM_READ(video_vdp_r) AM_WRITENOP /* video board tms9918 read ports (bogus) */ + AM_RANGE(0x2800, 0x2fff) AM_READWRITE(video_joy_r, video_vdp_w) /* video board joystick read port and tms9918 write ports */ + + AM_RANGE(0x3000, 0x3fff) AM_ROM /* main ROM - unibug or university basic */ +ADDRESS_MAP_END + +/* + CRU map + + The board features one tms9901 for keyboard and sound I/O, another tms9901 + to drive the parallel port and a few LEDs and handle tms9980 interrupts, + and one optional tms9902 for serial I/O. + + * bits >000->1ff (R12=>000->3fe): first TMS9901: parallel port, a few LEDs, + interrupts + - CRU bits 1-5: UINT1* through UINT5* (jumper connectable to parallel + port or COMINT from tms9902) + - CRU bit 6: KBINT (interrupt request from second tms9901) + - CRU bits 7-15: mirrors P15-P7 + - CRU bits 16-31: P0-P15 (parallel port) + (bits 16, 17, 18 and 19 control LEDs numbered 1, 2, 3 and 4, too) + * bits >200->3ff (R12=>400->7fe): second TMS9901: display, keyboard and + sound + - CRU bits 1-5: KB1*-KB5* (inputs from current keyboard row) + - CRU bit 6: RDATA (tape in) + - CRU bits 7-15: mirrors P15-P7 + - CRU bits 16-19: DIGITSELA-DIGITSELD (select current display digit and + keyboard row) + - CRU bits 20-27: SEGMENTA*-SEGMENTG* and SEGMENTP* (drives digit + segments) + - CRU bit 28: DSPLYTRGR*: used as an alive signal for a watchdog circuit + which turns off the display when the program hangs and + LED segments would continuously emit light + + - bit 29: SHIFTLIGHT (controls shift light) + - bit 30: SPKRDRIVE (controls buzzer) + - bit 31: WDATA (tape out) + * bits >400->5ff (R12=>800->bfe): optional TMS9902 + * bits >600->7ff (R12=>c00->ffe): reserved for expansion + * write 0 to bits >1000->17ff: IDLE: flash IDLE LED + * write 0 to bits >1800->1fff: RSET: not connected, but it is decoded and + hackers can connect any device they like to this pin + * write 1 to bits >0800->0fff: CKON: light FWD LED and activates + DECKCONTROL* signal (part of tape interface) + * write 1 to bits >1000->17ff: CKOF: light off FWD LED and deactivates + DECKCONTROL* signal (part of tape interface) + * write 1 to bits >1800->1fff: LREX: trigger load interrupt + + Keyboard map: see input ports + + Display segment designation: + a + ___ + | | + f| |b + |___| + | g | + e| |c + |___| .p + d +*/ + +static ADDRESS_MAP_START( tm990_189_cru_map, AS_IO, 8, tm990189_state ) + AM_RANGE(0x0000, 0x003f) AM_DEVREAD(TMS9901_0_TAG, tms9901_device, read) /* user I/O tms9901 */ + AM_RANGE(0x0040, 0x006f) AM_DEVREAD(TMS9901_1_TAG, tms9901_device, read) /* system I/O tms9901 */ + AM_RANGE(0x0080, 0x00cf) AM_DEVREAD("tms9902", tms9902_device, cruread) /* optional tms9902 */ + + AM_RANGE(0x0000, 0x01ff) AM_DEVWRITE(TMS9901_0_TAG, tms9901_device, write) /* user I/O tms9901 */ + AM_RANGE(0x0200, 0x03ff) AM_DEVWRITE(TMS9901_1_TAG, tms9901_device, write) /* system I/O tms9901 */ + AM_RANGE(0x0400, 0x05ff) AM_DEVWRITE("tms9902", tms9902_device, cruwrite) /* optional tms9902 */ +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( tm990_189, tm990189_state ) + /* basic machine hardware */ + MCFG_TMS99xx_ADD("maincpu", TMS9980A, 2000000, tm990_189_memmap, tm990_189_cru_map) + MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(tm990189_state, external_operation) ) + + MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189 ) + MCFG_MACHINE_RESET_OVERRIDE(tm990189_state, tm990_189 ) + + /* Video hardware */ + MCFG_DEFAULT_LAYOUT(layout_tm990189) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_CASSETTE_ADD( "cassette" ) + + MCFG_DEVICE_ADD(TMS9901_0_TAG, TMS9901, 2000000) + MCFG_TMS9901_P0_HANDLER( WRITELINE( tm990189_state, usr9901_led0_w) ) + MCFG_TMS9901_P1_HANDLER( WRITELINE( tm990189_state, usr9901_led1_w) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( tm990189_state, usr9901_led2_w) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( tm990189_state, usr9901_led3_w) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( tm990189_state, usr9901_interrupt_callback) ) + + MCFG_DEVICE_ADD(TMS9901_1_TAG, TMS9901, 2000000) + MCFG_TMS9901_READBLOCK_HANDLER( READ8(tm990189_state, sys9901_r) ) + MCFG_TMS9901_P0_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel0_w) ) + MCFG_TMS9901_P1_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel1_w) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel2_w) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel3_w) ) + MCFG_TMS9901_P4_HANDLER( WRITELINE( tm990189_state, sys9901_segment0_w) ) + MCFG_TMS9901_P5_HANDLER( WRITELINE( tm990189_state, sys9901_segment1_w) ) + MCFG_TMS9901_P6_HANDLER( WRITELINE( tm990189_state, sys9901_segment2_w) ) + MCFG_TMS9901_P7_HANDLER( WRITELINE( tm990189_state, sys9901_segment3_w) ) + MCFG_TMS9901_P8_HANDLER( WRITELINE( tm990189_state, sys9901_segment4_w) ) + MCFG_TMS9901_P9_HANDLER( WRITELINE( tm990189_state, sys9901_segment5_w) ) + MCFG_TMS9901_P10_HANDLER( WRITELINE( tm990189_state, sys9901_segment6_w) ) + MCFG_TMS9901_P11_HANDLER( WRITELINE( tm990189_state, sys9901_segment7_w) ) + MCFG_TMS9901_P12_HANDLER( WRITELINE( tm990189_state, sys9901_dsplytrgr_w) ) + MCFG_TMS9901_P13_HANDLER( WRITELINE( tm990189_state, sys9901_shiftlight_w) ) + MCFG_TMS9901_P14_HANDLER( WRITELINE( tm990189_state, sys9901_spkrdrive_w) ) + MCFG_TMS9901_P15_HANDLER( WRITELINE( tm990189_state, sys9901_tapewdata_w) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( tm990189_state, sys9901_interrupt_callback) ) + + MCFG_DEVICE_ADD("tms9902", TMS9902, 2000000) // MZ: needs to be fixed once the RS232 support is complete + MCFG_TMS9902_XMIT_CB(WRITE8(tm990189_state, xmit_callback)) /* called when a character is transmitted */ + MCFG_TM990_189_RS232_ADD("rs232") + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_timer", tm990189_state, display_callback, attotime::from_hz(30)) + // Need to delay the timer, or it will spoil the initial LOAD + // TODO: Fix this, probably inside CPU + MCFG_TIMER_START_DELAY(attotime::from_msec(150)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( tm990_189_v, tm990189_state ) + /* basic machine hardware */ + MCFG_TMS99xx_ADD("maincpu", TMS9980A, 2000000, tm990_189_v_memmap, tm990_189_cru_map) + MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(tm990189_state, external_operation) ) + + MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189_v ) + MCFG_MACHINE_RESET_OVERRIDE(tm990189_state, tm990_189_v ) + + /* video hardware */ + MCFG_DEVICE_ADD( "tms9918", TMS9918, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9918", tms9918_device, screen_update ) + MCFG_DEFAULT_LAYOUT(layout_tm990189v) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) /* one two-level buzzer */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_DEVICE_ADD(TMS9901_0_TAG, TMS9901, 2000000) + MCFG_TMS9901_P0_HANDLER( WRITELINE( tm990189_state, usr9901_led0_w) ) + MCFG_TMS9901_P1_HANDLER( WRITELINE( tm990189_state, usr9901_led1_w) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( tm990189_state, usr9901_led2_w) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( tm990189_state, usr9901_led3_w) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( tm990189_state, usr9901_interrupt_callback) ) + + MCFG_DEVICE_ADD(TMS9901_1_TAG, TMS9901, 2000000) + MCFG_TMS9901_READBLOCK_HANDLER( READ8(tm990189_state, sys9901_r) ) + MCFG_TMS9901_P0_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel0_w) ) + MCFG_TMS9901_P1_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel1_w) ) + MCFG_TMS9901_P2_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel2_w) ) + MCFG_TMS9901_P3_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel3_w) ) + MCFG_TMS9901_P4_HANDLER( WRITELINE( tm990189_state, sys9901_segment0_w) ) + MCFG_TMS9901_P5_HANDLER( WRITELINE( tm990189_state, sys9901_segment1_w) ) + MCFG_TMS9901_P6_HANDLER( WRITELINE( tm990189_state, sys9901_segment2_w) ) + MCFG_TMS9901_P7_HANDLER( WRITELINE( tm990189_state, sys9901_segment3_w) ) + MCFG_TMS9901_P8_HANDLER( WRITELINE( tm990189_state, sys9901_segment4_w) ) + MCFG_TMS9901_P9_HANDLER( WRITELINE( tm990189_state, sys9901_segment5_w) ) + MCFG_TMS9901_P10_HANDLER( WRITELINE( tm990189_state, sys9901_segment6_w) ) + MCFG_TMS9901_P11_HANDLER( WRITELINE( tm990189_state, sys9901_segment7_w) ) + MCFG_TMS9901_P12_HANDLER( WRITELINE( tm990189_state, sys9901_dsplytrgr_w) ) + MCFG_TMS9901_P13_HANDLER( WRITELINE( tm990189_state, sys9901_shiftlight_w) ) + MCFG_TMS9901_P14_HANDLER( WRITELINE( tm990189_state, sys9901_spkrdrive_w) ) + MCFG_TMS9901_P15_HANDLER( WRITELINE( tm990189_state, sys9901_tapewdata_w) ) + MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( tm990189_state, sys9901_interrupt_callback) ) + + MCFG_DEVICE_ADD("tms9902", TMS9902, 2000000) // MZ: needs to be fixed once the RS232 support is complete + MCFG_TMS9902_XMIT_CB(WRITE8(tm990189_state, xmit_callback)) /* called when a character is transmitted */ + MCFG_TM990_189_RS232_ADD("rs232") + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_timer", tm990189_state, display_callback, attotime::from_hz(30)) + MCFG_TIMER_START_DELAY(attotime::from_msec(150)) +MACHINE_CONFIG_END + + +/* + ROM loading +*/ +ROM_START(990189) + /*CPU memory space*/ + ROM_REGION(0x4000, "maincpu", 0 ) + + /* extra ROM */ + ROM_LOAD("990-469.u32", 0x0800, 0x0800, CRC(08df7edb) SHA1(fa9751fd2e3e5d7ae03819fc9c7099e2ddd9fb53)) + + /* boot ROM */ + ROM_LOAD("990-469.u33", 0x3000, 0x1000, CRC(e9b4ac1b) SHA1(96e88f4cb7a374033cdf3af0dc26ca5b1d55b9f9)) +ROM_END + +ROM_START(990189v) + /*CPU memory space*/ + ROM_REGION(0x4000, "maincpu", 0 ) + + /* extra ROM */ + ROM_LOAD("990-469.u32", 0x0800, 0x0800, CRC(08df7edb) SHA1(fa9751fd2e3e5d7ae03819fc9c7099e2ddd9fb53)) + + /* extension ROM */ + ROM_LOAD_OPTIONAL("demo1000.u13", 0x1000, 0x0800, CRC(c0e16685) SHA1(d0d314134c42fa4682aafbace67f539f67f6ba65)) + + /* extension ROM */ + ROM_LOAD_OPTIONAL("demo1800.u11", 0x1800, 0x0800, CRC(8737dc4b) SHA1(b87da7aa4d3f909e70f885c4b36999cc1abf5764)) + + /* boot ROM */ + ROM_LOAD("990-469.u33", 0x3000, 0x1000, CRC(e9b4ac1b) SHA1(96e88f4cb7a374033cdf3af0dc26ca5b1d55b9f9)) + /*ROM_LOAD("unibasic.bin", 0x3000, 0x1000, CRC(de4d9744))*/ /* older, partial dump of university BASIC */ +ROM_END + +#define JOYSTICK_DELTA 10 +#define JOYSTICK_SENSITIVITY 100 + +static INPUT_PORTS_START(tm990_189) + + PORT_START( "LOADINT ") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Load interrupt") PORT_CODE(KEYCODE_PRTSCR) PORT_CHANGED_MEMBER(DEVICE_SELF, tm990189_state, load_interrupt, 1) + + /* 45-key calculator-like alphanumeric keyboard... */ + PORT_START("LINE0") /* row 0 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sp *") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('*') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ret '") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR('\'') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("$ =") PORT_CODE(KEYCODE_STOP) PORT_CHAR('$') PORT_CHAR('=') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("LINE1") /* row 1 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+ (") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('+') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- )") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('-') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ /") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('@') PORT_CHAR('/') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("> %") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('>') PORT_CHAR('%') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('^') + + PORT_START("LINE2") /* row 2 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 .") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('.') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 ;") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(';') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 :") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 ?") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('?') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 !") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('!') + + PORT_START("LINE3") /* row 3 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 _") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \"") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\"') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 #") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (ESC)") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A (SOH)") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + + PORT_START("LINE4") /* row 4 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B (STH)") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C (ETX)") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D (EOT)") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E (ENQ)") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F (ACK)") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("LINE5") /* row 5 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G (BEL)") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H (BS)") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I (HT)") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J (LF)") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K (VT)") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + + PORT_START("LINE6") /* row 6 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L (FF)") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M (DEL)") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N (SO)") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O (SI)") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P (DLE)") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + + PORT_START("LINE7") /* row 7 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q (DC1)") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R (DC2)") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S (DC3)") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T (DC4)") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U (NAK)") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + + PORT_START("LINE8") /* row 8 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V <-D") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W (ETB)") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X (CAN)") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y (EM)") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z ->D") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + + /* analog joysticks (video board only) */ + + PORT_START("BUTTONS") /* joystick 1 & 2 buttons */ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) + + PORT_START("JOY1_X") /* joystick 1, X axis */ + PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(1) + + PORT_START("JOY1_Y") /* joystick 1, Y axis */ + PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(1) PORT_REVERSE + + PORT_START("JOY2_X") /* joystick 2, X axis */ + PORT_BIT( 0x3ff, 0x180, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x180 ) PORT_PLAYER(2) + + PORT_START("JOY2_Y") /* joystick 2, Y axis */ + PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(2) PORT_REVERSE +INPUT_PORTS_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1978, 990189, 0, 0, tm990_189, tm990_189, driver_device, 0, "Texas Instruments", "TM 990/189 University Board microcomputer" , 0) +COMP( 1980, 990189v, 990189, 0, tm990_189_v, tm990_189, driver_device, 0, "Texas Instruments", "TM 990/189 University Board microcomputer with Video Board Interface" , 0) diff --git a/src/mame/drivers/tmc1800.c b/src/mame/drivers/tmc1800.c new file mode 100644 index 00000000000..728ec7ee446 --- /dev/null +++ b/src/mame/drivers/tmc1800.c @@ -0,0 +1,884 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Telmac 2000 + +PCB Layout +---------- + +|-----------------------------------------------------------| +| | +| | 4051 4042 2114 2114 | +| CN1 | +| | 4051 4042 2114 2114 | +| | +| 4011 4013 |--------| 2114 2114 | +| | 4515 | | +| 4013 |--------| 2114 2114 | +| 4042 | +| 4011 2114 2114 | +| 4011 | +| 4011 2114 2114 | +|SW1 | +| 4011 |--------| 2114 2114 | +| | PROM | | +| 40107 |--------| 2114 2114 | +| 4050 1.75MHz | +| |-------------| 2114 2114 | +| | CDP1802 | | +| |-------------| 2114 2114 | +| 4049 | +| |-------------| 2114 2114 | +| 4.43MHz | CDP1864 | | +| |-------------| 2114 2114 | +| | +| 741 4502 2114 2114 | +| - | +| | 2114 2114 2114 | +| CN2 | +| | 4001 4051 2114 2114 | +| - | +| 2114 2114 | +|-----------------------------------------------------------| + +Notes: + All IC's shown. + + PROM - MMI6341 + 2114 - 2114 4096 Bit (1024x4) NMOS Static RAM + CDP1802 - RCA CDP1802 CMOS 8-Bit Microprocessor @ 1.75 MHz + CDP1864 - RCA CDP1864CE COS/MOS PAL Compatible Color TV Interface @ 1.75 MHz + CN1 - keyboard connector + CN2 - ASTEC RF modulator connector + SW1 - Run/Reset switch + +*/ + +/* + +OSCOM Nano + +PCB Layout +---------- + +OK 30379 + +|-------------------------------------------------| +| CN1 CN2 CN3 7805 | +| 1.75MHz | +| 741 | +| |-------------| - | +| 741 741 4011 | CDP1864 | | | +| |-------------| | | +| 4013 |-------------| | | +| | CDP1802 | | | +| 4093 |-------------| | | +| C | +| 4051 4042 4017 4042 N | +| |-------| 4 | +| | ROM | 14556 | | +| |-------| | | +| 2114 2114 | | +| | | +| 2114 2114 | | +| - | +| 2114 2114 | +| | +| 2114 2114 | +|-------------------------------------------------| + +Notes: + All IC's shown. + + ROM - Intersil 5504? + 2114 - 2114UCB 4096 Bit (1024x4) NMOS Static RAM + CDP1802 - RCA CDP1802E CMOS 8-Bit Microprocessor @ 1.75 MHz + CDP1864 - RCA CDP1864CE COS/MOS PAL Compatible Color TV Interface @ 1.75 MHz + CN1 - tape connector + CN2 - video connector + CN3 - power connector + CN4 - expansion connector + +*/ + +/* + + TODO: + + - tape input/output + - tmc2000: add missing keys + - tmc2000: TOOL-2000 rom banking + - nano: correct time constant for EF4 RC circuit + +*/ + +#include "includes/tmc1800.h" +#include "sound/beep.h" + +/* Read/Write Handlers */ + +WRITE8_MEMBER( tmc1800_state::keylatch_w ) +{ + m_keylatch = data; +} + +WRITE8_MEMBER( osc1000b_state::keylatch_w ) +{ + m_keylatch = data; +} + +WRITE8_MEMBER( tmc2000_state::keylatch_w ) +{ + /* + + bit description + + 0 X0 + 1 X1 + 2 X2 + 3 Y0 + 4 Y1 + 5 Y2 + 6 EXP1 + 7 EXP2 + + */ + + m_keylatch = data & 0x3f; +} + +WRITE8_MEMBER( nano_state::keylatch_w ) +{ + /* + + bit description + + 0 A + 1 B + 2 C + 3 NY0 + 4 NY1 + 5 + 6 + 7 + + */ + + m_keylatch = data & 0x1f; +} + +void tmc2000_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + UINT8 *rom = m_rom->base(); + + if (m_roc) + { + // monitor ROM + program.install_rom(0x0000, 0x01ff, 0, 0x7e00, rom); + } + else + { + // RAM + switch (m_ram->size()) + { + case 4 * 1024: + program.install_ram(0x0000, 0x0fff, 0, 0x7000, ram); + break; + + case 16 * 1024: + program.install_ram(0x0000, 0x3fff, 0, 0x4000, ram); + break; + + case 32 * 1024: + program.install_ram(0x0000, 0x7fff, ram); + break; + } + } + + if (m_rac) + { + // color RAM + program.install_ram(0x8000, 0x81ff, 0, 0x7e00, m_colorram); + program.unmap_read(0x8000, 0x81ff, 0, 0x7e00); + } + else + { + // monitor ROM + program.install_rom(0x8000, 0x81ff, 0, 0x7e00, rom); + } +} + +WRITE8_MEMBER( tmc2000_state::bankswitch_w ) +{ + m_roc = 0; + m_rac = BIT(data, 0); + bankswitch(); + + m_cti->tone_latch_w(space, 0, data); +} + +WRITE8_MEMBER( nano_state::bankswitch_w ) +{ + /* enable RAM */ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + program.install_ram(0x0000, 0x0fff, 0, 0x7000, ram); + + /* write to CDP1864 tone latch */ + m_cti->tone_latch_w(space, 0, data); +} + +READ8_MEMBER( tmc1800_state::dispon_r ) +{ + m_vdc->disp_on_w(1); + m_vdc->disp_on_w(0); + + return 0xff; +} + +WRITE8_MEMBER( tmc1800_state::dispoff_w ) +{ + m_vdc->disp_off_w(1); + m_vdc->disp_off_w(0); +} + +/* Memory Maps */ + +// Telmac 1800 + +static ADDRESS_MAP_START( tmc1800_map, AS_PROGRAM, 8, tmc1800_state ) + AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x7800) AM_RAM + AM_RANGE(0x8000, 0x81ff) AM_MIRROR(0x7e00) AM_ROM AM_REGION(CDP1802_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tmc1800_io_map, AS_IO, 8, tmc1800_state ) + AM_RANGE(0x01, 0x01) AM_READWRITE(dispon_r, dispoff_w) + AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) +ADDRESS_MAP_END + +// OSCOM 1000B + +static ADDRESS_MAP_START( osc1000b_map, AS_PROGRAM, 8, osc1000b_state ) + AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x7800) AM_RAM + AM_RANGE(0x8000, 0x81ff) AM_MIRROR(0x7e00) AM_ROM AM_REGION(CDP1802_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( osc1000b_io_map, AS_IO, 8, osc1000b_state ) + AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) +ADDRESS_MAP_END + +// Telmac 2000 + +static ADDRESS_MAP_START( tmc2000_map, AS_PROGRAM, 8, tmc2000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x7fff) // RAM / monitor ROM + AM_RANGE(0x8000, 0xffff) // color RAM / monitor ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tmc2000_io_map, AS_IO, 8, tmc2000_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispon_r, step_bgcolor_w) + AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) + AM_RANGE(0x04, 0x04) AM_DEVREAD(CDP1864_TAG, cdp1864_device, dispoff_r) AM_WRITE(bankswitch_w) +ADDRESS_MAP_END + +// OSCOM Nano + +static ADDRESS_MAP_START( nano_map, AS_PROGRAM, 8, nano_state ) + AM_RANGE(0x0000, 0x7fff) // RAM / monitor ROM + AM_RANGE(0x8000, 0x81ff) AM_MIRROR(0x7e00) AM_ROM AM_REGION(CDP1802_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( nano_io_map, AS_IO, 8, nano_state ) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispon_r, step_bgcolor_w) + AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) + AM_RANGE(0x04, 0x04) AM_DEVREAD(CDP1864_TAG, cdp1864_device, dispoff_r) AM_WRITE(bankswitch_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( tmc1800 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("RUN") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Run/Reset") PORT_CODE(KEYCODE_R) PORT_TOGGLE +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER( tmc2000_state::run_pressed ) +{ + if (oldval && !newval) + { + machine_reset(); + } +} + +static INPUT_PORTS_START( tmc2000 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("RUN") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Run/Reset") PORT_CODE(KEYCODE_R) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, tmc2000_state, run_pressed, 0) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER( nano_state::run_pressed ) +{ + if (oldval && !newval) + { + machine_reset(); + } +} + +INPUT_CHANGED_MEMBER( nano_state::monitor_pressed ) +{ + if (oldval && !newval) + { + machine_reset(); + + m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, CLEAR_LINE); + } + else if (!oldval && newval) + { + // TODO: what are the correct values? + int t = RES_K(27) * CAP_U(1) * 1000; // t = R26 * C1 + timer_set(attotime::from_msec(t), TIMER_ID_EF4); + } +} + +static INPUT_PORTS_START( nano ) + PORT_START("NY0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + + PORT_START("NY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("RUN") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, nano_state, run_pressed, 0) + + PORT_START("MONITOR") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("MONITOR") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, nano_state, monitor_pressed, 0) +INPUT_PORTS_END + +/* CDP1802 Interfaces */ + +// Telmac 1800 + +READ_LINE_MEMBER( tmc1800_state::clear_r ) +{ + return BIT(m_run->read(), 0); +} + +READ_LINE_MEMBER( tmc1800_state::ef2_r ) +{ + return m_cassette->input() < 0; +} + +READ_LINE_MEMBER( tmc1800_state::ef3_r ) +{ + return CLEAR_LINE; // TODO +} + +WRITE_LINE_MEMBER( tmc1800_state::q_w ) +{ + m_cassette->output(state ? 1.0 : -1.0); +} + +// Oscom 1000B + +READ_LINE_MEMBER( osc1000b_state::clear_r ) +{ + return BIT(m_run->read(), 0); +} + +READ_LINE_MEMBER( osc1000b_state::ef2_r ) +{ + return m_cassette->input() < 0; +} + +READ_LINE_MEMBER( osc1000b_state::ef3_r ) +{ + return CLEAR_LINE; // TODO +} + +WRITE_LINE_MEMBER( osc1000b_state::q_w ) +{ + m_cassette->output(state ? 1.0 : -1.0); +} + +// Telmac 2000 + +READ_LINE_MEMBER( tmc2000_state::clear_r ) +{ + return BIT(m_run->read(), 0); +} + +READ_LINE_MEMBER( tmc2000_state::ef2_r ) +{ + return (m_cassette)->input() < 0; +} + +READ_LINE_MEMBER( tmc2000_state::ef3_r ) +{ + UINT8 data = ~m_key_row[m_keylatch / 8]->read(); + + return BIT(data, m_keylatch % 8); +} + +WRITE_LINE_MEMBER( tmc2000_state::q_w ) +{ + /* CDP1864 audio output enable */ + m_cti->aoe_w(state); + + /* set Q led status */ + set_led_status(machine(), 1, state); + + /* tape output */ + m_cassette->output(state ? 1.0 : -1.0); +} + +WRITE8_MEMBER( tmc2000_state::dma_w ) +{ + m_color = ~(m_colorram[offset & 0x1ff]) & 0x07; + + m_cti->con_w(0); // HACK + m_cti->dma_w(space, offset, data); +} + +// OSCOM Nano + +READ_LINE_MEMBER( nano_state::clear_r ) +{ + int run = BIT(m_run->read(), 0); + int monitor = BIT(m_monitor->read(), 0); + + return run && monitor; +} + +READ_LINE_MEMBER( nano_state::ef2_r ) +{ + return m_cassette->input() < 0; +} + +READ_LINE_MEMBER( nano_state::ef3_r ) +{ + UINT8 data = 0xff; + + if (!BIT(m_keylatch, 3)) data &= m_ny0->read(); + if (!BIT(m_keylatch, 4)) data &= m_ny1->read(); + + return !BIT(data, m_keylatch & 0x07); +} + +WRITE_LINE_MEMBER( nano_state::q_w ) +{ + /* CDP1864 audio output enable */ + m_cti->aoe_w(state); + + /* set Q led status */ + set_led_status(machine(), 1, state); + + /* tape output */ + m_cassette->output(state ? 1.0 : -1.0); +} + +/* Machine Initialization */ + +// Telmac 1800 + +void tmc1800_state::machine_start() +{ + /* register for state saving */ + save_item(NAME(m_keylatch)); +} + +void tmc1800_state::machine_reset() +{ + /* reset CDP1861 */ + m_vdc->reset(); +} + +// OSCOM 1000B + +void osc1000b_state::machine_start() +{ + /* register for state saving */ + save_item(NAME(m_keylatch)); +} + +void osc1000b_state::machine_reset() +{ +} + +// Telmac 2000 + +void tmc2000_state::machine_start() +{ + UINT16 addr; + + m_colorram.allocate(TMC2000_COLORRAM_SIZE); + + // randomize color RAM contents + for (addr = 0; addr < TMC2000_COLORRAM_SIZE; addr++) + { + m_colorram[addr] = machine().rand() & 0xff; + } + + // find keyboard rows + m_key_row[0] = m_y0; + m_key_row[1] = m_y1; + m_key_row[2] = m_y2; + m_key_row[3] = m_y3; + m_key_row[4] = m_y4; + m_key_row[5] = m_y5; + m_key_row[6] = m_y6; + m_key_row[7] = m_y7; + + // state saving + save_item(NAME(m_keylatch)); + save_item(NAME(m_rac)); + save_item(NAME(m_roc)); +} + +void tmc2000_state::machine_reset() +{ + // reset CDP1864 + m_cti->reset(); + + // banking + m_roc = 1; + m_rac = 0; + bankswitch(); +} + +// OSCOM Nano + +void nano_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_ID_EF4: + m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, ASSERT_LINE); + break; + } +} + +void nano_state::machine_start() +{ + /* register for state saving */ + save_item(NAME(m_keylatch)); +} + +void nano_state::machine_reset() +{ + /* assert EF4 */ + m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, ASSERT_LINE); + + /* reset CDP1864 */ + m_cti->reset(); + + /* enable ROM */ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *rom = m_rom->base(); + program.install_rom(0x0000, 0x01ff, 0, 0x7e00, rom); +} + +/* Machine Drivers */ + +QUICKLOAD_LOAD_MEMBER( tmc1800_base_state, tmc1800 ) +{ + UINT8 *ptr = m_rom->base(); + int size = image.length(); + + if (size > m_ram->size()) + { + return IMAGE_INIT_FAIL; + } + + image.fread( ptr, size); + + return IMAGE_INIT_PASS; +} + +static MACHINE_CONFIG_START( tmc1800, tmc1800_state ) + // basic system hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) + MCFG_CPU_PROGRAM_MAP(tmc1800_map) + MCFG_CPU_IO_MAP(tmc1800_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(tmc1800_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(tmc1800_state, ef2_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(tmc1800_state, ef3_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(tmc1800_state, q_w)) + MCFG_COSMAC_DMAW_CALLBACK(DEVWRITE8(CDP1861_TAG, cdp1861_device, dma_w)) + + // video hardware + MCFG_FRAGMENT_ADD(tmc1800_video) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_QUICKLOAD_ADD("quickload", tmc1800_base_state, tmc1800, "bin", 0) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") + MCFG_RAM_EXTRA_OPTIONS("4K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( osc1000b, osc1000b_state ) + // basic system hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) + MCFG_CPU_PROGRAM_MAP(osc1000b_map) + MCFG_CPU_IO_MAP(osc1000b_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(osc1000b_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(osc1000b_state, ef2_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(osc1000b_state, ef3_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(osc1000b_state, q_w)) + + // video hardware + MCFG_FRAGMENT_ADD(osc1000b_video) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_QUICKLOAD_ADD("quickload", tmc1800_base_state, tmc1800, "bin", 0) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") + MCFG_RAM_EXTRA_OPTIONS("4K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( tmc2000, tmc2000_state ) + // basic system hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) + MCFG_CPU_PROGRAM_MAP(tmc2000_map) + MCFG_CPU_IO_MAP(tmc2000_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(tmc2000_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(tmc2000_state, ef2_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(tmc2000_state, ef3_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(tmc2000_state, q_w)) + MCFG_COSMAC_DMAW_CALLBACK(WRITE8(tmc2000_state, dma_w)) + + // video hardware + MCFG_FRAGMENT_ADD(tmc2000_video) + + // devices + MCFG_QUICKLOAD_ADD("quickload", tmc1800_base_state, tmc1800, "bin", 0) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") + MCFG_RAM_EXTRA_OPTIONS("16K,32K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( nano, nano_state ) + // basic system hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) + MCFG_CPU_PROGRAM_MAP(nano_map) + MCFG_CPU_IO_MAP(nano_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(nano_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(nano_state, ef2_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(nano_state, ef3_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(nano_state, q_w)) + MCFG_COSMAC_DMAW_CALLBACK(DEVWRITE8(CDP1864_TAG, cdp1864_device, dma_w)) + + // video hardware + MCFG_FRAGMENT_ADD(nano_video) + + // devices + MCFG_QUICKLOAD_ADD("quickload", tmc1800_base_state, tmc1800, "bin", 0) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( tmc1800 ) + ROM_REGION( 0x200, CDP1802_TAG, 0 ) + ROM_LOAD( "mmi6341-1.ic2", 0x000, 0x200, NO_DUMP ) // equivalent to 82S141 +ROM_END + +ROM_START( osc1000b ) + ROM_REGION( 0x200, CDP1802_TAG, 0 ) + ROM_LOAD( "mmi6341-1.ic2", 0x000, 0x0200, NO_DUMP ) // equivalent to 82S141 + + ROM_REGION( 0x400, "gfx1", 0 ) + ROM_LOAD( "mmi6349.5d", 0x000, 0x200, NO_DUMP ) // equivalent to 82S147 + ROM_LOAD( "mmi6349.5c", 0x200, 0x200, NO_DUMP ) // equivalent to 82S147 +ROM_END + +ROM_START( tmc2000 ) + ROM_REGION( 0x800, CDP1802_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "prom200", "PROM N:o 200" ) + ROMX_LOAD( "200.m5", 0x000, 0x200, BAD_DUMP CRC(79da3221) SHA1(008da3ef4f69ab1a493362dfca856375b19c94bd), ROM_BIOS(1) ) // typed in from the manual + ROM_SYSTEM_BIOS( 1, "prom202", "PROM N:o 202" ) + ROMX_LOAD( "202.m5", 0x000, 0x200, NO_DUMP, ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "tool2000", "TOOL-2000" ) + ROMX_LOAD( "tool2000", 0x000, 0x800, NO_DUMP, ROM_BIOS(3) ) +ROM_END + +ROM_START( nano ) + ROM_REGION( 0x200, CDP1802_TAG, 0 ) + ROM_LOAD( "mmi6349.ic", 0x000, 0x200, BAD_DUMP CRC(1ec1b432) SHA1(ac41f5e38bcd4b80bd7a5b277a2c600899fd5fb8) ) // equivalent to 82S141 +ROM_END + +/* Driver Initialization */ + +void tmc1800_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SETUP_BEEP: + m_beeper->set_state(0); + m_beeper->set_frequency(0); + break; + default: + assert_always(FALSE, "Unknown id in tmc1800_state::device_timer"); + } +} + +DRIVER_INIT_MEMBER(tmc1800_state,tmc1800) +{ + timer_set(attotime::zero, TIMER_SETUP_BEEP); +} + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1977, tmc1800, 0, 0, tmc1800, tmc1800, tmc1800_state, tmc1800, "Telercas Oy", "Telmac 1800", MACHINE_NOT_WORKING ) +COMP( 1977, osc1000b, tmc1800,0, osc1000b, tmc1800, driver_device, 0, "OSCOM Oy", "OSCOM 1000B", MACHINE_NOT_WORKING ) +COMP( 1980, tmc2000, 0, 0, tmc2000, tmc2000, driver_device, 0, "Telercas Oy", "Telmac 2000", MACHINE_SUPPORTS_SAVE ) +COMP( 1980, nano, tmc2000,0, nano, nano, driver_device, 0, "OSCOM Oy", "OSCOM Nano", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tmc2000e.c b/src/mame/drivers/tmc2000e.c new file mode 100644 index 00000000000..c3691141631 --- /dev/null +++ b/src/mame/drivers/tmc2000e.c @@ -0,0 +1,328 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Telmac 2000E + ------------ + (c) 1980 Telercas Oy, Finland + + CPU: CDP1802A 1.75 MHz + RAM: 8 KB + ROM: 8 KB + + Video: CDP1864 1.75 MHz + Color RAM: 1 KB + + Colors: 8 fg, 4 bg + Resolution: 64x192 + Sound: frequency control, volume on/off + Keyboard: ASCII (RCA VP-601/VP-611), KB-16/KB-64 + + SBASIC: 24.0 + + + Telmac TMC-121/111/112 + ---------------------- + (c) 198? Telercas Oy, Finland + + CPU: CDP1802A ? MHz + + Built from Telmac 2000 series cards. Huge metal box. + +*/ + +#include "includes/tmc2000e.h" + +/* Read/Write Handlers */ + +READ8_MEMBER( tmc2000e_state::vismac_r ) +{ + return 0; +} + +WRITE8_MEMBER( tmc2000e_state::vismac_w ) +{ +} + +READ8_MEMBER( tmc2000e_state::floppy_r ) +{ + return 0; +} + +WRITE8_MEMBER( tmc2000e_state::floppy_w ) +{ +} + +READ8_MEMBER( tmc2000e_state::ascii_keyboard_r ) +{ + return 0; +} + +READ8_MEMBER( tmc2000e_state::io_r ) +{ + return 0; +} + +WRITE8_MEMBER( tmc2000e_state::io_w ) +{ +} + +WRITE8_MEMBER( tmc2000e_state::io_select_w ) +{ +} + +WRITE8_MEMBER( tmc2000e_state::keyboard_latch_w ) +{ + m_keylatch = data; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( tmc2000e_map, AS_PROGRAM, 8, tmc2000e_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAM + AM_RANGE(0xc000, 0xdfff) AM_ROM + AM_RANGE(0xfc00, 0xffff) AM_WRITEONLY AM_SHARE("colorram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tmc2000e_io_map, AS_IO, 8, tmc2000e_state ) + AM_RANGE(0x01, 0x01) AM_DEVWRITE(CDP1864_TAG, cdp1864_device, tone_latch_w) + AM_RANGE(0x02, 0x02) AM_DEVWRITE(CDP1864_TAG, cdp1864_device, step_bgcolor_w) + AM_RANGE(0x03, 0x03) AM_READWRITE(ascii_keyboard_r, keyboard_latch_w) + AM_RANGE(0x04, 0x04) AM_READWRITE(io_r, io_w) + AM_RANGE(0x05, 0x05) AM_READWRITE(vismac_r, vismac_w) + AM_RANGE(0x06, 0x06) AM_READWRITE(floppy_r, floppy_w) + AM_RANGE(0x07, 0x07) AM_READ_PORT("DSW0") AM_WRITE(io_select_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( tmc2000e ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("DSW0") // System Configuration DIPs + PORT_DIPNAME( 0x80, 0x00, "Keyboard Type" ) + PORT_DIPSETTING( 0x00, "ASCII" ) + PORT_DIPSETTING( 0x80, "Matrix" ) + PORT_DIPNAME( 0x40, 0x00, "Operating System" ) + PORT_DIPSETTING( 0x00, "TOOL-2000-E" ) + PORT_DIPSETTING( 0x40, "Load from disk" ) + PORT_DIPNAME( 0x30, 0x00, "Display Interface" ) + PORT_DIPSETTING( 0x00, "PAL" ) + PORT_DIPSETTING( 0x10, "CDG-80" ) + PORT_DIPSETTING( 0x20, "VISMAC" ) + PORT_DIPSETTING( 0x30, "UART" ) + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("RUN") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Run/Reset") PORT_CODE(KEYCODE_R) PORT_TOGGLE +INPUT_PORTS_END + +/* Video */ + +READ_LINE_MEMBER( tmc2000e_state::rdata_r ) +{ + return BIT(m_color, 2); +} + +READ_LINE_MEMBER( tmc2000e_state::bdata_r ) +{ + return BIT(m_color, 1); +} + +READ_LINE_MEMBER( tmc2000e_state::gdata_r ) +{ + return BIT(m_color, 0); +} + +/* CDP1802 Interface */ + +READ_LINE_MEMBER( tmc2000e_state::clear_r ) +{ + return BIT(m_run->read(), 0); +} + +READ_LINE_MEMBER( tmc2000e_state::ef2_r ) +{ + return m_cassette->input() < 0; +} + +READ_LINE_MEMBER( tmc2000e_state::ef3_r ) +{ + UINT8 data = ~(m_key_row[m_keylatch / 8])->read(); + + return BIT(data, m_keylatch % 8); +} + +WRITE_LINE_MEMBER( tmc2000e_state::q_w ) +{ + // turn CDP1864 sound generator on/off + m_cti->aoe_w(state); + + // set Q led status + set_led_status(machine(), 1, state); + + // tape out + m_cassette->output(state ? -1.0 : +1.0); + + // floppy control (FDC-6) +} + +WRITE8_MEMBER( tmc2000e_state::dma_w ) +{ + m_color = (m_colorram[offset & 0x3ff]) & 0x07; // 0x04 = R, 0x02 = B, 0x01 = G + + m_cti->con_w(0); // HACK + m_cti->dma_w(space, offset, data); +} + + +/* Machine Initialization */ + +void tmc2000e_state::machine_start() +{ + // find keyboard rows + m_key_row[0] = m_y0; + m_key_row[1] = m_y1; + m_key_row[2] = m_y2; + m_key_row[3] = m_y3; + m_key_row[4] = m_y4; + m_key_row[5] = m_y5; + m_key_row[6] = m_y6; + m_key_row[7] = m_y7; + + /* register for state saving */ + save_item(NAME(m_cdp1864_efx)); + save_item(NAME(m_keylatch)); +} + +void tmc2000e_state::machine_reset() +{ + m_cti->reset(); + + // reset program counter to 0xc000 +} + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( tmc2000e, tmc2000e_state ) + // basic system hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) + MCFG_CPU_PROGRAM_MAP(tmc2000e_map) + MCFG_CPU_IO_MAP(tmc2000e_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(tmc2000e_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(tmc2000e_state, ef2_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(tmc2000e_state, ef3_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(tmc2000e_state, q_w)) + MCFG_COSMAC_DMAW_CALLBACK(WRITE8(tmc2000e_state, dma_w)) + + // video hardware + MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) + MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(tmc2000e_state, rdata_r), READLINE(tmc2000e_state, bdata_r), READLINE(tmc2000e_state, gdata_r)) + MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(5.1), RES_K(4.7)) // unverified + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8K") + MCFG_RAM_EXTRA_OPTIONS("40K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( tmc2000e ) + ROM_REGION( 0x10000, CDP1802_TAG, 0 ) + ROM_LOAD( "1", 0xc000, 0x0800, NO_DUMP ) + ROM_LOAD( "2", 0xc800, 0x0800, NO_DUMP ) + ROM_LOAD( "3", 0xd000, 0x0800, NO_DUMP ) + ROM_LOAD( "4", 0xd800, 0x0800, NO_DUMP ) +ROM_END + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME +COMP( 1980, tmc2000e, 0, 0, tmc2000e, tmc2000e, driver_device, 0, "Telercas Oy", "Telmac 2000E", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tmc600.c b/src/mame/drivers/tmc600.c new file mode 100644 index 00000000000..5b0f73c05dc --- /dev/null +++ b/src/mame/drivers/tmc600.c @@ -0,0 +1,314 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Telmac TMC-600 + +PCB Layout +---------- + +HP14782-1 + + CN2 CN3 + |---------| |------------------------| +|-------|---------|-----|------------------------|------------------------------------------| +| CN1 CN4 SW1 CN5 CN6 P1 SW2 CN7 | +| |-------| 4049 T3 | +| T1 K1 |CDP1852| 4050 4050 4050 40107 T2 C1 C2 8.867238MHz | +| |-------| |-------| 5.6260MHz T4 | +| MC1374 |CDP1852| ROM5 |---------| | +| |-------| | CDP1870 | | +| K2 ROM4 |---------| | +| |-------------| 4050 5114 5114 | +| 4013 | CDP1802 | 4050 5114 5114 ROM3 4030 ROM6 4060| +| 4013 |-------------| 4050 5114 5114 | +| 4081 40106 4051 5114 5114 ROM2 4076 5114 4011| +| 4556 5114 5114 CDP1856 5114 | +| |-------| 5114 5114 ROM1 CDP1856 5114 4076| +| LS1 |CDP1852| CDP1853 CDP1856 5114 5114 | +| |-------| CDP1856 5114 5114 ROM0 |---------| 4011| +| | CDP1869 | | +| 7805 4051 4051 |---------| | +| | +| |--CN8--| | +|-------------------------------------------------------------------------------------------| + +Notes: + All IC's shown. TMCP-300 and TMC-700 expansions have been installed. + + ROM0-5 - Toshiba TMM2732DI 4Kx8 EPROM + ROM6 - Hitachi HN462732G 4Kx8 EPROM + 5114 - RCA MWS5114E1 1024-Word x 4-Bit LSI Static RAM + MC1374 - Motorola MC1374P TV Modulator + CDP1802 - RCA CDP1802BE CMOS 8-Bit Microprocessor running at ? MHz + CDP1852 - RCA CDP1852CE Byte-Wide Input/Output Port + CDP1853 - RCA CDP1853CE N-Bit 1 of 8 Decoder + CDP1856 - RCA CDP1856CE 4-Bit Memory Buffer + CDP1869 - RCA CDP1869CE Video Interface System (VIS) Address and Sound Generator + CDP1870 - RCA CDP1870CE Video Interface System (VIS) Color Video (DOT XTAL at 5.6260MHz, CHROM XTAL at 8.867238MHz) + CN1 - RF connector [TMC-700] + CN2 - printer connector [TMC-700] + CN3 - EURO connector + CN4 - tape connector + CN5 - video connector + CN6 - power connector + CN7 - audio connector [TMCP-300] + CN8 - keyboard connector + SW1 - RUN/STOP switch + SW2 - internal speaker/external audio switch [TMCP-300] + P1 - color phase lock adjustment + C1 - dot oscillator adjustment + C2 - chrom oscillator adjustment + T1 - RF signal strength adjustment [TMC-700] + T2 - tape recording level adjustment (0.57 Vpp) + T3 - video output level adjustment (1 Vpp) + T4 - video synchronization pulse adjustment + K1 - RF signal quality adjustment [TMC-700] + K2 - RF channel adjustment (VHF I) [TMC-700] + LS1 - loudspeaker + +*/ + +/* + + TODO: + + - proper emulation of the VISMAC interface (cursor blinking, color RAM), schematics are needed + - disk interface + - CPU frequency needs to be derived from the schematics + - serial interface expansion card + - centronics printer handshaking + +*/ + +#include "includes/tmc600.h" + +/* Read/Write Handlers */ + +WRITE8_MEMBER( tmc600_state::keyboard_latch_w ) +{ + m_keylatch = data; +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( tmc600_map, AS_PROGRAM, 8, tmc600_state ) + AM_RANGE(0x0000, 0x4fff) AM_ROM + AM_RANGE(0x6000, 0xbfff) AM_RAM + AM_RANGE(0xf400, 0xf7ff) AM_DEVICE(CDP1869_TAG, cdp1869_device, char_map) + AM_RANGE(0xf800, 0xffff) AM_DEVICE(CDP1869_TAG, cdp1869_device, page_map) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tmc600_io_map, AS_IO, 8, tmc600_state ) + AM_RANGE(0x03, 0x03) AM_WRITE(keyboard_latch_w) + AM_RANGE(0x04, 0x04) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x05, 0x05) AM_WRITE(vismac_data_w) +// AM_RANGE(0x06, 0x06) AM_WRITE(floppy_w) + AM_RANGE(0x07, 0x07) AM_WRITE(vismac_register_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( tmc600 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHAR('/') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('\\') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x85") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00C5) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x84") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x96") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E2") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL1") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL2") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E1") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("(unknown)") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(10) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("RUN") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Run/Stop") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_TOGGLE +INPUT_PORTS_END + +/* CDP1802 Interface */ + +READ_LINE_MEMBER( tmc600_state::clear_r ) +{ + return BIT(m_run->read(), 0); +} + +READ_LINE_MEMBER( tmc600_state::ef2_r ) +{ + return m_cassette->input() < 0; +} + +READ_LINE_MEMBER( tmc600_state::ef3_r ) +{ + UINT8 data = ~m_key_row[m_keylatch / 8]->read(); + + return BIT(data, m_keylatch % 8); +} + +WRITE_LINE_MEMBER( tmc600_state::q_w ) +{ + m_cassette->output(state ? +1.0 : -1.0); +} + +/* Machine Initialization */ + +void tmc600_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + /* configure RAM */ + switch (m_ram->size()) + { + case 8*1024: + program.unmap_readwrite(0x8000, 0xbfff); + break; + + case 16*1024: + program.unmap_readwrite(0xa000, 0xbfff); + break; + } + + // find keyboard rows + m_key_row[0] = m_y0; + m_key_row[1] = m_y1; + m_key_row[2] = m_y2; + m_key_row[3] = m_y3; + m_key_row[4] = m_y4; + m_key_row[5] = m_y5; + m_key_row[6] = m_y6; + m_key_row[7] = m_y7; + + /* register for state saving */ + save_item(NAME(m_keylatch)); +} + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( tmc600, tmc600_state ) + // basic system hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, 3579545) // ??? + MCFG_CPU_PROGRAM_MAP(tmc600_map) + MCFG_CPU_IO_MAP(tmc600_io_map) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(tmc600_state, clear_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(tmc600_state, ef2_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(tmc600_state, ef3_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(tmc600_state, q_w)) + + // sound and video hardware + MCFG_FRAGMENT_ADD(tmc600_video) + + /* devices */ + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("8K") + MCFG_RAM_EXTRA_OPTIONS("16K,24K") +MACHINE_CONFIG_END + +/* ROMs */ + +#if 0 +ROM_START( tmc600s1 ) + ROM_REGION( 0x5000, CDP1802_TAG, 0 ) + ROM_LOAD( "sb20", 0x0000, 0x1000, NO_DUMP ) + ROM_LOAD( "sb21", 0x1000, 0x1000, NO_DUMP ) + ROM_LOAD( "sb22", 0x2000, 0x1000, NO_DUMP ) + ROM_LOAD( "sb23", 0x3000, 0x1000, NO_DUMP ) + ROM_LOAD( "190482_2", 0x4000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "chargen", 0x0000, 0x1000, NO_DUMP ) +ROM_END +#endif + +ROM_START( tmc600s2 ) + ROM_REGION( 0x5000, CDP1802_TAG, 0 ) + ROM_LOAD( "sb30", 0x0000, 0x1000, CRC(95d1292a) SHA1(1fa52d59d3005f8ac74a32c2164fdb22947c2748) ) + ROM_LOAD( "sb31", 0x1000, 0x1000, CRC(2c8f3d17) SHA1(f14e8adbcddeaeaa29b1e7f3dfa741f4e230f599) ) + ROM_LOAD( "sb32", 0x2000, 0x1000, CRC(dd58a128) SHA1(be9bdb0fc5e0cc3dcc7f2fb7ccab69bf5b043803) ) + ROM_LOAD( "sb33", 0x3000, 0x1000, CRC(b7d241fa) SHA1(6f3eadf86c4e3aaf93d123e302a18dc4d9db964b) ) + ROM_LOAD( "151182", 0x4000, 0x1000, CRC(c1a8d9d8) SHA1(4552e1f06d0e338ba7b0f1c3a20b8a51c27dafde) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "chargen", 0x0000, 0x1000, CRC(93f92cbf) SHA1(371156fb38fa5319c6fde537ccf14eed94e7adfb) ) +ROM_END + +/* System Drivers */ +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME +//COMP( 1982, tmc600s1, 0, 0, tmc600, tmc600, driver_device, 0, "Telercas Oy", "Telmac TMC-600 (Sarja I)", MACHINE_NOT_WORKING ) +COMP( 1982, tmc600s2, 0, 0, tmc600, tmc600, driver_device, 0, "Telercas Oy", "Telmac TMC-600 (Sarja II)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tricep.c b/src/mame/drivers/tricep.c new file mode 100644 index 00000000000..728f8496177 --- /dev/null +++ b/src/mame/drivers/tricep.c @@ -0,0 +1,94 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Morrow Tricep + + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class tricep_state : public driver_device +{ +public: + tricep_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + , + m_p_ram(*this, "p_ram"){ } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ16_MEMBER(tricep_terminal_r); + DECLARE_WRITE16_MEMBER(tricep_terminal_w); + DECLARE_WRITE8_MEMBER(kbd_put); + required_shared_ptr m_p_ram; + virtual void machine_reset(); +}; + + + +READ16_MEMBER( tricep_state::tricep_terminal_r ) +{ + return 0xffff; +} + +WRITE16_MEMBER( tricep_state::tricep_terminal_w ) +{ + m_terminal->write(space, 0, data >> 8); +} + +static ADDRESS_MAP_START(tricep_mem, AS_PROGRAM, 16, tricep_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_SHARE("p_ram") + AM_RANGE(0x00fd0000, 0x00fd1fff) AM_ROM AM_REGION("user1",0) + AM_RANGE(0x00ff0028, 0x00ff0029) AM_READWRITE(tricep_terminal_r,tricep_terminal_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( tricep ) +INPUT_PORTS_END + + +void tricep_state::machine_reset() +{ + UINT8* user1 = memregion("user1")->base(); + + memcpy((UINT8*)m_p_ram.target(),user1,0x2000); + + m_maincpu->reset(); +} + +WRITE8_MEMBER( tricep_state::kbd_put ) +{ +} + +static MACHINE_CONFIG_START( tricep, tricep_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",M68000, XTAL_8MHz) + MCFG_CPU_PROGRAM_MAP(tricep_mem) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(tricep_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( tricep ) + ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "tri2.4_odd.u37", 0x0000, 0x1000, CRC(31eb2dcf) SHA1(2d9df9262ee1096d0398505e10d209201ac49a5d)) + ROM_LOAD16_BYTE( "tri2.4_even.u36", 0x0001, 0x1000, CRC(4414dcdc) SHA1(00a3d293617dc691748ae85b6ccdd6723daefc0a)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, tricep, 0, 0, tricep, tricep, driver_device, 0, "Morrow Designs", "Tricep", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/trs80.c b/src/mame/drivers/trs80.c new file mode 100644 index 00000000000..8a9c0c3af24 --- /dev/null +++ b/src/mame/drivers/trs80.c @@ -0,0 +1,927 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert and unknown others +/*************************************************************************** +TRS80 memory map + +0000-2fff ROM R D0-D7 +3000-37ff ROM on Model III R D0-D7 + unused on Model I +37de UART status R/W D0-D7 +37df UART data R/W D0-D7 +37e0 interrupt latch address (lnw80 = for the realtime clock) +37e1 select disk drive 0 W +37e2 cassette drive latch address W +37e3 select disk drive 1 W +37e4 select which cassette unit W D0-D1 (D0 selects unit 1, D1 selects unit 2) +37e5 select disk drive 2 W +37e7 select disk drive 3 W +37e0-37e3 floppy motor W D0-D3 + or floppy head select W D3 +37e8 send a byte to printer W D0-D7 +37e8 read printer status R D7 +37ec-37ef FDC WD179x R/W D0-D7 +37ec command W D0-D7 +37ec status R D0-D7 +37ed track R/W D0-D7 +37ee sector R/W D0-D7 +37ef data R/W D0-D7 +3800-38ff keyboard matrix R D0-D7 +3900-3bff unused - kbd mirrored +3c00-3fff video RAM R/W D0-D5,D7 (or D0-D7) +4000-ffff RAM + +Interrupts: +IRQ mode 1 +NMI + +Printer: Level II usually 37e8; System80 uses port FD; Model 4 uses port F8. +Uart: TR1602, equivalent to the uart used in the Exidy Sorcerer. +System80 has non-addressable dip switches to set the UART control register. +System80 and LNW80 have non-addressable links to set the baud rate. Receive and Transmit clocks are tied together. +It is assumed that the TRS80L2 UART setup is identical to the System80, apart from the address ports used. +Due to the above, the only working emulated UART is for the Model 3. + +Cassette baud rates: Model I level I - 250 baud + Model I level II and all clones - 500 baud + Model III/4 - 500 and 1500 baud selectable at boot time + - When it says "Cass?" press L for 500 baud, or Enter otherwise. + LNW-80 - 500 baud @1.77MHz and 1000 baud @4MHz. + +I/O ports +FF: +- bits 0 and 1 are for writing a cassette +- bit 2 must be high to turn the cassette motor on, enables cassette data paths on a system-80 +- bit 3 switches the display between 64 or 32 characters per line +- bit 6 remembers the 32/64 screen mode (inverted) +- bit 7 is for reading from a cassette + +FE: +- bit 0 is for selecting inverse video of the whole screen on a lnw80 +- bit 2 enables colour on a lnw80 +- bit 3 is for selecting roms (low) or 16k hires area (high) on a lnw80 +- bit 4 selects internal cassette player (low) or external unit (high) on a system-80 + +FD: +- Read printer status on a system-80 +- Write to printer on a system-80 + +F9: +- UART data (write) status (read) on a system-80 + +F8: +- UART data (read) status (write) on a system-80 +- Write to printer (Model III/4) +- Read printer status (Model III/4) + +EB: +- UART data (read and write) on a Model III/4 + +EA: +- UART status (read and write) on a Model III/4 + +E9: +- UART Configuration jumpers (read) on a Model III/4 +- Set baud rate (Model III/4) + +E8: +- UART Modem Status register (read) on a Model III/4 +- UART Master Reset (write) on a Model III/4 + +Model 4 - C0-CF = hard drive (optional) + - 90-93 write sound (optional) + - 80-8F hires graphics (optional) + +About the ht1080z - This was made for schools in Hungary. Each comes with a BASIC extension roms + which activated Hungarian features. To activate - start emulation - enter SYSTEM + Enter /12288 and the extensions will be installed and you are returned to READY. + The ht1080z is identical to the System 80, apart from the character rom. + The ht1080z2 has a modified extension rom and character generator. + +About the RTC - The time is incremented while ever the cursor is flashing. It is stored in a series + of bytes in the computer's work area. The bytes are in a certain order, this is: + seconds, minutes, hours, year, day, month. On a model 1, the seconds are stored at + 0x4041, while on the model 4 it is 0x4217. A reboot always sets the time to zero. + +Model 4 memory organisation - + Mode 0: ROM=0-37E7 and 37EA-3FFF; Printer=37E8-37E9; Keyboard=3800-3BFF; Video=3C00-3FFF + Mode 1: Keyboard and Video as above; 0-3FFF read=ROM and write=RAM + Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM + Mode 3: All RAM + In the "maincpu" memory map, the first 64k is given to the ROM, keyboard, printer and video, + while the second 64k is RAM that is switched in as needed. The area from 4800-FFFF + is considered a "black hole", any writes to there will disappear. + The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous. + +Model 4P - is the same as Model 4 except: + - ROM is only 0000-0FFF, while 1000-37FF is given over to RAM + - There is no cassette support in hardware. + +*************************************************************************** + +Not dumped (to our knowledge): + TRS80 Japanese bios + TRS80 Katakana Character Generator + TRS80 Small English Character Generator + TRS80 Model III old version Character Generator + TRS80 Model II bios and boot disk + +Not emulated: + TRS80 Japanese kana/ascii switch and alternate keyboard + TRS80 Model III/4 Hard drive, Graphics board, Alternate Character set + LNW80 1.77 / 4.0 MHz switch (this is a physical switch) + +Virtual floppy disk formats are JV1, JV3, and DMK. Only the JV1 is emulated. +There don't seem to be any JV1 boot disks for Model III/4. + +***************************************************************************/ + +#include "includes/trs80.h" +#include "formats/trs80_dsk.h" +#include "formats/dmk_dsk.h" + + +static ADDRESS_MAP_START( trs80_map, AS_PROGRAM, 8, trs80_state ) + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x3800, 0x38ff) AM_READ(trs80_keyboard_r) + AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(trs80_videoram_r, trs80_videoram_w) AM_SHARE("p_videoram") + AM_RANGE(0x4000, 0x7fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( trs80_io, AS_IO, 8, trs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( model1_map, AS_PROGRAM, 8, trs80_state ) + AM_RANGE(0x0000, 0x377f) AM_ROM // sys80,ht1080 needs up to 375F + AM_RANGE(0x37de, 0x37de) AM_READWRITE(sys80_f9_r, sys80_f8_w) + AM_RANGE(0x37df, 0x37df) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) + AM_RANGE(0x37e0, 0x37e3) AM_READWRITE(trs80_irq_status_r, trs80_motor_w) + AM_RANGE(0x37e4, 0x37e7) AM_WRITE(trs80_cassunit_w) + AM_RANGE(0x37e8, 0x37eb) AM_READWRITE(trs80_printer_r, trs80_printer_w) + AM_RANGE(0x37ec, 0x37ec) AM_READ(trs80_wd179x_r) + AM_RANGE(0x37ec, 0x37ec) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0x37ed, 0x37ed) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0x37ee, 0x37ee) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0x37ef, 0x37ef) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) + AM_RANGE(0x3800, 0x38ff) AM_MIRROR(0x300) AM_READ(trs80_keyboard_r) + AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(trs80_videoram_r, trs80_videoram_w) AM_SHARE("p_videoram") + AM_RANGE(0x4000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( model1_io, AS_IO, 8, trs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( sys80_io, AS_IO, 8, trs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xf8, 0xf8) AM_READWRITE(trs80m4_eb_r, sys80_f8_w) + AM_RANGE(0xf9, 0xf9) AM_READWRITE(sys80_f9_r, trs80m4_eb_w) + AM_RANGE(0xfd, 0xfd) AM_READWRITE(trs80_printer_r, trs80_printer_w) + AM_RANGE(0xfe, 0xfe) AM_WRITE(sys80_fe_w) + AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( lnw80_map, AS_PROGRAM, 8, trs80_state ) + AM_RANGE(0x4000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( lnw80_io, AS_IO, 8, trs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) + AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") + AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) + AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) + AM_RANGE(0xfe, 0xfe) AM_READWRITE(lnw80_fe_r, lnw80_fe_w) + AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( model3_map, AS_PROGRAM, 8, trs80_state ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( model3_io, AS_IO, 8, trs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80m4_e0_r, trs80m4_e0_w) + AM_RANGE(0xe4, 0xe4) AM_READWRITE(trs80m4_e4_r, trs80m4_e4_w) + AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) + AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") AM_WRITE(trs80m4_e9_w) + AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) + AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) + AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) + AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) + AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) + AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) + AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( model4_io, AS_IO, 8, trs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x84, 0x87) AM_WRITE(trs80m4_84_w) + AM_RANGE(0x88, 0x89) AM_WRITE(trs80m4_88_w) + AM_RANGE(0x90, 0x93) AM_WRITE(trs80m4_90_w) + AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80m4_e0_r, trs80m4_e0_w) + AM_RANGE(0xe4, 0xe4) AM_READWRITE(trs80m4_e4_r, trs80m4_e4_w) + AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) + AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") AM_WRITE(trs80m4_e9_w) + AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) + AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) + AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) + AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) + AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) + AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) + AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( model4p_io, AS_IO, 8, trs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x84, 0x87) AM_WRITE(trs80m4_84_w) + AM_RANGE(0x88, 0x89) AM_WRITE(trs80m4_88_w) + AM_RANGE(0x90, 0x93) AM_WRITE(trs80m4_90_w) + AM_RANGE(0x9c, 0x9f) AM_WRITE(trs80m4p_9c_w) + AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80m4_e0_r, trs80m4_e0_w) + AM_RANGE(0xe4, 0xe4) AM_READWRITE(trs80m4_e4_r, trs80m4_e4_w) + AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) + AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") AM_WRITE(trs80m4_e9_w) + AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) + AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) + AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) + AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) + AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) + AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) + AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( meritum_map, AS_PROGRAM, 8, trs80_state ) + AM_RANGE(0x0000, 0x37ff) AM_ROM + AM_RANGE(0x3800, 0x38ff) AM_MIRROR(0x300) AM_READ(trs80_keyboard_r) + AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(trs80_videoram_r, trs80_videoram_w) AM_SHARE("p_videoram") + AM_RANGE(0x4000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( meritum_io, AS_IO, 8, trs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + // There are specific writes to ports 03, F3, F7, F8, FA, FB, FD + // so perhaps this system uses devices at these locations. + // The disk input expects values that are different to the usual, + // eg. port F0 should be 5, port F2 should have bit 3 set. + //AM_RANGE(0x03, 0x03) unknown + AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) + AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) + AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) + AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) + AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) + AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) + AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) + //AM_RANGE(0xfc, 0xfd) unknown + AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) +ADDRESS_MAP_END + +/************************************************************************** + w/o SHIFT with SHIFT + +-------------------------------+ +-------------------------------+ + | 0 1 2 3 4 5 6 7 | | 0 1 2 3 4 5 6 7 | ++--+---+---+---+---+---+---+---+---+ +--+---+---+---+---+---+---+---+---+ +|0 | @ | A | B | C | D | E | F | G | |0 | ` | a | b | c | d | e | f | g | +| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ +|1 | H | I | J | K | L | M | N | O | |1 | h | i | j | k | l | m | n | o | +| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ +|2 | P | Q | R | S | T | U | V | W | |2 | p | q | r | s | t | u | v | w | +| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ +|3 | X | Y | Z | [ | \ | ] | ^ | _ | |3 | x | y | z | { | | | } | ~ | | +| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ +|4 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |4 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | +| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ +|5 | 8 | 9 | : | ; | , | - | . | / | |5 | 8 | 9 | * | + | < | = | > | ? | +| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ +|6 |ENT|CLR|BRK|UP |DN |LFT|RGT|SPC| |6 |ENT|CLR|BRK|UP |DN |LFT|RGT|SPC| +| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ +|7 |SHF|ALT|PUP|PDN|INS|DEL|CTL|END| |7 |SHF|ALT|PUP|PDN|INS|DEL|CTL|END| ++--+---+---+---+---+---+---+---+---+ +--+---+---+---+---+---+---+---+---+ +NB: row 7 contains some originally unused bits + only the shift bit was there in the TRS80 + +2008-05 FP: +NB2: 3:3 -> 3:7 have no correspondent keys (see + below) in the usual 53-keys keyboard ( + + 12-keys keypad) for Model I, III and 4. Where + are the symbols above coming from? +NB3: the 12-keys keypad present in later models + is mapped to the corrispondent keys of the + keyboard: '0' -> '9', 'Enter', '.' +NB4: when it was added a 15-key keypad, there were + three functions key 'F1', 'F2', 'F3'. I found no + doc about their position in the matrix above, + but the schematics of the clone System-80 MkII + (which had 4 function keys) put these keys in + 3:4 -> 3:7. Right now they're not implemented + below. + +***************************************************************************/ + +static INPUT_PORTS_START( trs80 ) + PORT_START("CONFIG") /* IN0 */ + PORT_CONFNAME( 0x80, 0x00, "Floppy Disc Drives") + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x80, DEF_STR( On ) ) + PORT_BIT(0x7f, 0x7f, IPT_UNUSED) + + PORT_START("LINE0") /* KEY ROW 0 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("LINE1") /* KEY ROW 1 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("LINE2") /* KEY ROW 2 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + + PORT_START("LINE3") /* KEY ROW 3 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + /* on Model I and Model III keyboards, there are only 53 keys (+ 12 keypad keys) and these are not connected: + on Model I, they produce arrows and '_', on Model III either produce garbage or overlap with other keys; + on Model 4 (which has a 15-key with 3 function keys) here are mapped 'F1', 'F2', 'F3' */ + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") + + PORT_START("LINE4") /* KEY ROW 4 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_START("LINE5") /* KEY ROW 5 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("LINE6") /* KEY ROW 6 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F8)) // 3rd line, 1st key from right + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F9)) // 1st line, 1st key from right + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + /* backspace do the same as cursor left */ + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE7") /* KEY ROW 7 */ + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + /* These keys are only on a Model 4. The one marked CTL seems to be another shift key (4 in total). */ + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("CTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x80, 0x00, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( trs80m3 ) + PORT_INCLUDE (trs80) + PORT_START("E9") // these are the power-on uart settings + PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x88, 0x08, "Parity") + PORT_DIPSETTING( 0x08, DEF_STR(None)) + PORT_DIPSETTING( 0x00, "Odd") + PORT_DIPSETTING( 0x80, "Even") + PORT_DIPNAME( 0x10, 0x10, "Stop Bits") + PORT_DIPSETTING( 0x10, "2") + PORT_DIPSETTING( 0x00, "1") + PORT_DIPNAME( 0x60, 0x60, "Bits") + PORT_DIPSETTING( 0x00, "5") + PORT_DIPSETTING( 0x20, "6") + PORT_DIPSETTING( 0x40, "7") + PORT_DIPSETTING( 0x60, "8") +INPUT_PORTS_END + + +/**************************** F4 CHARACTER DISPLAYER ***********************************************************/ +static const gfx_layout trs80_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout ht1080z_charlayout = +{ + 5, 12, /* 5 x 12 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static const gfx_layout trs80m4_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout lnw80_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 5, 6, 1, 0, 2, 4, 3 }, + /* y offsets */ + { 0*8, 512*8, 256*8, 768*8, 1*8, 513*8, 257*8, 769*8 }, + 8*2 /* every char takes 8 bytes */ +}; + +static const gfx_layout radionic_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 2048*8, 2049*8, 2050*8, 2051*8, 2052*8, 2053*8, 2054*8, 2055*8 }, + 8*8 /* every char takes 16 bytes */ +}; + +static const gfx_layout meritum_charlayout = +{ + 6, 11, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 }, + 8*16 /* every char takes 16 bytes (unused scanlines are blank) */ +}; + +static GFXDECODE_START(trs80) + GFXDECODE_ENTRY( "chargen", 0, trs80_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START(ht1080z) + GFXDECODE_ENTRY( "chargen", 0, ht1080z_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START(trs80m4) + GFXDECODE_ENTRY( "chargen", 0, trs80m4_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START(lnw80) + GFXDECODE_ENTRY( "chargen", 0, lnw80_charlayout, 0, 4 ) +GFXDECODE_END + +static GFXDECODE_START(radionic) + GFXDECODE_ENTRY( "chargen", 0, radionic_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START(meritum) + GFXDECODE_ENTRY( "chargen", 0, meritum_charlayout, 0, 1 ) +GFXDECODE_END + + +FLOPPY_FORMATS_MEMBER( trs80_state::floppy_formats ) + FLOPPY_TRS80_FORMAT, + FLOPPY_DMK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( trs80_floppies ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( trs80, trs80_state ) // the original model I, level I, with no extras + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 1796000) /* 1.796 MHz */ + MCFG_CPU_PROGRAM_MAP(trs80_map) + MCFG_CPU_IO_MAP(trs80_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(64*6, 16*12) + MCFG_SCREEN_VISIBLE_AREA(0,64*6-1,0,16*12-1) + MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_trs80) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", trs80) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( model1, trs80 ) // model I, level II + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( model1_map) + MCFG_CPU_IO_MAP( model1_io) + MCFG_CPU_PERIODIC_INT_DRIVER(trs80_state, trs80_rtc_interrupt, 40) + + /* devices */ + MCFG_CASSETTE_MODIFY( "cassette" ) + MCFG_CASSETTE_FORMATS(trs80l2_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + + MCFG_QUICKLOAD_ADD("quickload", trs80_state, trs80_cmd, "cmd", 0.5) + + MCFG_FD1793_ADD("fdc", XTAL_1MHz) // todo: should be fd1771 + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(trs80_state,trs80_fdc_intrq_w)) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", trs80_floppies, "sssd", trs80_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", trs80_floppies, "sssd", trs80_state::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", trs80_floppies, "", trs80_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", trs80_floppies, "", trs80_state::floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) + MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit6)) + MCFG_CENTRONICS_SELECT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) + MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) + + MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD( "tr1602", AY31015, 0 ) + MCFG_AY31015_RX_CLOCK(0.0) + MCFG_AY31015_TX_CLOCK(0.0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( model3, model1 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( model3_map) + MCFG_CPU_IO_MAP( model3_io) + MCFG_CPU_PERIODIC_INT_DRIVER(trs80_state, trs80_rtc_interrupt, 30) + + MCFG_MACHINE_RESET_OVERRIDE(trs80_state, trs80m4 ) + + MCFG_GFXDECODE_MODIFY("gfxdecode",trs80m4) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_trs80m4) + MCFG_SCREEN_SIZE(80*8, 240) + MCFG_SCREEN_VISIBLE_AREA(0,80*8-1,0,239) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( model4, model3 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_IO_MAP( model4_io) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( model4p, model3 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_IO_MAP( model4p_io) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sys80, model1 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_IO_MAP( sys80_io) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ht1080z, sys80 ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_ht1080z) + MCFG_GFXDECODE_MODIFY("gfxdecode", ht1080z) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( lnw80, model1 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( lnw80_map) + MCFG_CPU_IO_MAP( lnw80_io) + MCFG_MACHINE_RESET_OVERRIDE(trs80_state, lnw80 ) + + MCFG_GFXDECODE_MODIFY("gfxdecode",lnw80) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(8) + MCFG_PALETTE_INIT_OWNER(trs80_state,lnw80) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(80*6, 16*12) + MCFG_SCREEN_VISIBLE_AREA(0,80*6-1,0,16*12-1) + MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_lnw80) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( radionic, model1 ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_SIZE(64*8, 16*16) + MCFG_SCREEN_VISIBLE_AREA(0,64*8-1,0,16*16-1) + MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_radionic) + MCFG_GFXDECODE_MODIFY("gfxdecode", radionic) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( meritum, sys80 ) + MCFG_CPU_MODIFY( "maincpu" ) + MCFG_CPU_PROGRAM_MAP( meritum_map) + MCFG_CPU_IO_MAP( meritum_io) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_meritum) + MCFG_GFXDECODE_MODIFY("gfxdecode", meritum) +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(trs80) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("level1.rom", 0x0000, 0x1000, CRC(70d06dff) SHA1(20d75478fbf42214381e05b14f57072f3970f765)) + + ROM_REGION(0x00400, "chargen",0) + ROM_LOAD("trs80m1.chr", 0x0000, 0x0400, CRC(0033f2b9) SHA1(0d2cd4197d54e2e872b515bbfdaa98efe502eda7)) +ROM_END + +ROM_START(trs80l2) + ROM_REGION(0x10000, "maincpu",0) + ROM_SYSTEM_BIOS(0, "level2", "Radio Shack Level II Basic") + ROMX_LOAD("trs80.z33", 0x0000, 0x1000, CRC(37c59db2) SHA1(e8f8f6a4460a6f6755873580be6ff70cebe14969), ROM_BIOS(1)) + ROMX_LOAD("trs80.z34", 0x1000, 0x1000, CRC(05818718) SHA1(43c538ca77623af6417474ca5b95fb94205500c1), ROM_BIOS(1)) + ROMX_LOAD("trs80.zl2", 0x2000, 0x1000, CRC(306e5d66) SHA1(1e1abcfb5b02d4567cf6a81ffc35318723442369), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "rsl2", "R/S L2 Basic") + ROMX_LOAD("trs80alt.z33",0x0000, 0x1000, CRC(be46faf5) SHA1(0e63fc11e207bfd5288118be5d263e7428cc128b), ROM_BIOS(2)) + ROMX_LOAD("trs80alt.z34",0x1000, 0x1000, CRC(6c791c2d) SHA1(2a38e0a248f6619d38f1a108eea7b95761cf2aee), ROM_BIOS(2)) + ROMX_LOAD("trs80alt.zl2",0x2000, 0x1000, CRC(55b3ad13) SHA1(6279f6a68f927ea8628458b278616736f0b3c339), ROM_BIOS(2)) + + ROM_REGION(0x00400, "chargen",0) + ROM_LOAD("trs80m1.chr", 0x0000, 0x0400, CRC(0033f2b9) SHA1(0d2cd4197d54e2e872b515bbfdaa98efe502eda7)) +ROM_END + +ROM_START(radionic) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("ep1.bin", 0x0000, 0x1000, CRC(e8908f44) SHA1(7a5a60c3afbeb6b8434737dd302332179a7fca59)) + ROM_LOAD("ep2.bin", 0x1000, 0x1000, CRC(46e88fbf) SHA1(a3ca32757f269e09316e1e91ba1502774e2f5155)) + ROM_LOAD("ep3.bin", 0x2000, 0x1000, CRC(306e5d66) SHA1(1e1abcfb5b02d4567cf6a81ffc35318723442369)) + ROM_LOAD("ep4.bin", 0x3000, 0x0400, CRC(70f90f26) SHA1(cbee70da04a3efac08e50b8e3a270262c2440120)) + ROM_CONTINUE(0x3000, 0x400) + ROM_CONTINUE(0x3000, 0x600) + ROM_IGNORE(0x200) + + ROM_REGION(0x01000, "chargen",0) + ROM_LOAD("trschar.bin", 0x0000, 0x1000, CRC(02e767b6) SHA1(c431fcc6bd04ce2800ca8c36f6f8aeb2f91ce9f7)) +ROM_END + +ROM_START(sys80) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("sys80rom.1", 0x0000, 0x1000, CRC(8f5214de) SHA1(d8c052be5a2d0ec74433043684791d0554bf203b)) + ROM_LOAD("sys80rom.2", 0x1000, 0x1000, CRC(46e88fbf) SHA1(a3ca32757f269e09316e1e91ba1502774e2f5155)) + ROM_LOAD("trs80.zl2", 0x2000, 0x1000, CRC(306e5d66) SHA1(1e1abcfb5b02d4567cf6a81ffc35318723442369)) + /* This rom turns the system80 into the "blue label" version. SYSTEM then /12288 to activate. */ + ROM_LOAD("sys80.ext", 0x3000, 0x0800, CRC(2a851e33) SHA1(dad21ec60973eb66e499fe0ecbd469118826a715)) + + ROM_REGION(0x00400, "chargen",0) + ROM_LOAD("trs80m1.chr", 0x0000, 0x0400, CRC(0033f2b9) SHA1(0d2cd4197d54e2e872b515bbfdaa98efe502eda7)) +ROM_END + +ROM_START(lnw80) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("lnw_a.bin", 0x0000, 0x0800, CRC(e09f7e91) SHA1(cd28e72efcfebde6cf1c7dbec4a4880a69e683da)) + ROM_LOAD("lnw_a1.bin", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0)) + ROM_LOAD("lnw_b.bin", 0x1000, 0x0800, CRC(c4303568) SHA1(13e3d81c6f0de0e93956fa58c465b5368ea51682)) + ROM_LOAD("lnw_b1.bin", 0x1800, 0x0800, CRC(3a5ea239) SHA1(8c489670977892d7f2bfb098f5df0b4dfa8fbba6)) + ROM_LOAD("lnw_c.bin", 0x2000, 0x0800, CRC(2ba025d7) SHA1(232efbe23c3f5c2c6655466ebc0a51cf3697be9b)) + ROM_LOAD("lnw_c1.bin", 0x2800, 0x0800, CRC(ed547445) SHA1(20102de89a3ee4a65366bc2d62be94da984a156b)) + + ROM_REGION(0x00800, "chargen",0) + ROM_LOAD("lnw_chr.bin", 0x0000, 0x0800, CRC(c89b27df) SHA1(be2a009a07e4378d070002a558705e9a0de59389)) + + ROM_REGION(0x04400, "gfx2", ROMREGION_ERASEFF) /* 0x4000 for trs80_gfxram + 0x400 for videoram */ +ROM_END + +ROM_START(trs80m3) +/* ROMS we have and are missing: +HAVE TRS-80 Model III Level 1 ROM (U104) +MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC BBC4 +MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC DA75 +HAVE TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC 9639 +HAVE TRS-80 Model III Level 2 (ENGLISH) ROM B (U105) ver. CRC 407C +MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2B91 - early mfg. #80040316 +MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 278A - no production REV A +HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2EF8 - Manufacturing #80040316 REV B +HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2F84 - Manufacturing #80040316 REV C +MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 2764 - Network III v1 +HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 276A - Network III v2 +MISSING TRS-80 Model III Level 2 (BELGIUM) CRC ???? +Note: Be careful when dumping rom C: if dumped on the trs-80 m3 with software, bytes 0x7e8 and 0x7e9 (addresses 0x37e8, 0x0x37e9) + will read as 0xFF 0xFF; on the original rom, these bytes are 0x00 0x00 (for eproms) or 0xAA 0xAA (for mask roms), those two bytes are used for printer status on the trs-80 and are mapped on top of the rom; This problem should be avoided by pulling the rom chips and dumping them directly. +*/ + ROM_REGION(0x20000, "maincpu",0) + ROM_SYSTEM_BIOS(0, "trs80m3_revc", "Level 2 bios, RomC Rev C") + ROMX_LOAD("8041364.u104", 0x0000, 0x2000, CRC(ec0c6daa) SHA1(257cea6b9b46912d4681251019ec2b84f1b95fc8), ROM_BIOS(1)) // Label: "SCM91248C // Tandy (c) 80 // 8041364 // 8134" (Level 2 bios ROM A '9639') + ROMX_LOAD("8040332.u105", 0x2000, 0x1000, CRC(ed4ee921) SHA1(ec0a19d4b72f71e51965de63250009c3c4e4cab3), ROM_BIOS(1)) // Label: "SCM91619P // Tandy (c) 80 // 8040332 // QQ8117", (Level 2 bios ROM B '407c') + ROMX_LOAD("8040316c.u106", 0x3000, 0x0800, CRC(c8f79433) SHA1(6f395bba822d39d3cd2b73c8ea25aab4c4c26da7), ROM_BIOS(1)) // Label: "SCM91692P // Tandy (c) 81 // 8040316-C // QQ8220" (Level 2 bios ROM C REV C '2f84') + ROM_SYSTEM_BIOS(1, "trs80m3_revb", "Level 2 bios, RomC Rev B") + ROMX_LOAD("8041364.u104", 0x0000, 0x2000, CRC(ec0c6daa) SHA1(257cea6b9b46912d4681251019ec2b84f1b95fc8), ROM_BIOS(2)) // Label: "SCM91248C // Tandy (c) 80 // 8041364 // 8134" (Level 2 bios ROM A '9639') + ROMX_LOAD("8040332.u105", 0x2000, 0x1000, CRC(ed4ee921) SHA1(ec0a19d4b72f71e51965de63250009c3c4e4cab3), ROM_BIOS(2)) // Label: "SCM91619P // Tandy (c) 80 // 8040332 // QQ8117", (Level 2 bios ROM B '407c') + ROMX_LOAD("8040316b.u106", 0x3000, 0x0800, CRC(84a5702d) SHA1(297dca756a9d3c6fd13e0fa6f93d172ff795b520), ROM_BIOS(2)) // Label: "SCM91692P // Tandy (c) 80 // 8040316B // QQ8040" (Level 2 bios ROM C REV B '2ef8') + ROM_SYSTEM_BIOS(2, "trs80m3_n3v2", "Level 2 bios, Network III v2 (student)") + ROMX_LOAD("8041364.u104", 0x0000, 0x2000, CRC(ec0c6daa) SHA1(257cea6b9b46912d4681251019ec2b84f1b95fc8), ROM_BIOS(3)) // Label: "SCM91248C // Tandy (c) 80 // 8041364 // 8134" (Level 2 bios ROM A '9639') + ROMX_LOAD("8040332.u105", 0x2000, 0x1000, CRC(ed4ee921) SHA1(ec0a19d4b72f71e51965de63250009c3c4e4cab3), ROM_BIOS(3)) // Label: "SCM91619P // Tandy (c) 80 // 8040332 // QQ8117" (Level 2 bios ROM B '407c') + ROMX_LOAD("276a.u106", 0x3000, 0x0800, CRC(7d38720a) SHA1(bef621e5ae2a8c1f9e7f6325b7841f5ab8ab7e6a), ROM_BIOS(3)) // 2716 EPROM Label: "MOD.III // ROM C // (276A)" (Network III v2 ROM C '276a') + ROM_SYSTEM_BIOS(3, "trs80m3_l1", "Level 1 bios") + ROMX_LOAD("8040032.u104", 0x0000, 0x1000, CRC(6418d641) SHA1(f823ab6ceb102588d27e5f5c751e31175289291c), ROM_BIOS(4) ) // Label: "8040032 // (M) QQ8028 // SCM91616P"; Silkscreen: "TANDY // (C) '80"; (Level 1 bios) + + ROM_REGION(0x00800, "chargen",0) /* correct for later systems; the trs80m3_l1 bios uses the non-a version of this rom, dump is pending */ + ROM_LOAD("8044316.u36", 0x0000, 0x0800, NO_DUMP) // Label: "(M) // SCM91665P // 8044316 // QQ8029" ('no-letter' revision) + ROM_LOAD("8044316a.u36", 0x0000, 0x0800, CRC(444c8b60) SHA1(c52ee41439bd5e57c3b113ebfd61c951e2af4446)) // Label: "Tandy (C) 81 // 8044316A // 8206" (rev A) +ROM_END + +// for model 4 and 4p info, see http://vt100.net/mirror/harte/Radio%20Shack/TRS-80%20Model%204_4P%20Soft%20Tech%20Ref.pdf +ROM_START(trs80m4) + ROM_REGION(0x20000, "maincpu",0) + ROM_LOAD("trs80m4.rom", 0x0000, 0x3800, BAD_DUMP CRC(1a92d54d) SHA1(752555fdd0ff23abc9f35c6e03d9d9b4c0e9677b)) // should be split into 3 roms, roms A, B, C, exactly like trs80m3; in fact, roms A and B are shared between both systems. + + ROM_REGION(0x00800, "chargen",0) + ROM_LOAD("8044316a.u36", 0x0000, 0x0800, CRC(444c8b60) SHA1(c52ee41439bd5e57c3b113ebfd61c951e2af4446)) // according to parts catalog, this is the correct rom for both model 3 and 4 +ROM_END + +ROM_START(trs80m4p) // uses a completely different memory map scheme to the others; the trs-80 model 3 roms are loaded from a boot disk, the only rom on the machine is a bootloader; bootloader can be banked out of 0x0000-0x1000 space which is replaced with ram; see the tech ref pdf, pdf page 62 + ROM_REGION(0x20000, "maincpu",0) + ROM_SYSTEM_BIOS(0, "trs80m4p", "Level 2 bios, gate array machine") + ROMX_LOAD("8075332.u69", 0x0000, 0x1000, CRC(3a738aa9) SHA1(6393396eaa10a84b9e9f0cf5930aba73defc5c52), ROM_BIOS(1)) // Label: "SCM95060P // 8075332 // TANDY (C) 1983 // 8421" at location U69 (may be located at U70 on some pcb revisions) + ROM_SYSTEM_BIOS(1, "trs80m4p_hack", "Disk loader hack") + ROMX_LOAD("trs80m4p_loader_hack.rom", 0x0000, 0x01f8, CRC(7ff336f4) SHA1(41184f5240b4b54f3804f5a22b4d78bbba52ed1d), ROM_BIOS(2)) + + ROM_REGION(0x00800, "chargen",0) + ROM_LOAD("8049007.u103", 0x0000, 0x0800, CRC(1ac44bea) SHA1(c9426ab2b2aa5380dc97a7b9c048ccd1bbde92ca)) // Label: "SCM95987P // 8049007 // TANDY (C) 1983 // 8447" at location U103 (may be located at U43 on some pcb revisions) +ROM_END + +ROM_START(ht1080z) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("ht1080z.rom", 0x0000, 0x3000, CRC(2bfef8f7) SHA1(7a350925fd05c20a3c95118c1ae56040c621be8f)) + ROM_LOAD("sys80.ext", 0x3000, 0x0800, CRC(2a851e33) SHA1(dad21ec60973eb66e499fe0ecbd469118826a715)) + + ROM_REGION(0x00800, "chargen",0) + ROM_LOAD("ht1080z.chr", 0x0000, 0x0800, CRC(e8c59d4f) SHA1(a15f30a543e53d3e30927a2e5b766fcf80f0ae31)) +ROM_END + +ROM_START(ht1080z2) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("ht1080z.rom", 0x0000, 0x3000, CRC(2bfef8f7) SHA1(7a350925fd05c20a3c95118c1ae56040c621be8f)) + ROM_LOAD("ht1080z2.ext", 0x3000, 0x0800, CRC(07415ac6) SHA1(b08746b187946e78c4971295c0aefc4e3de97115)) + + ROM_REGION(0x00800, "chargen",0) + ROM_LOAD("ht1080z2.chr", 0x0000, 0x0800, CRC(6728f0ab) SHA1(1ba949f8596f1976546f99a3fdcd3beb7aded2c5)) +ROM_END + +ROM_START(ht108064) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD("ht108064.rom", 0x0000, 0x3000, CRC(48985a30) SHA1(e84cf3121f9e0bb9e1b01b095f7a9581dcfaaae4)) + ROM_LOAD("ht108064.ext", 0x3000, 0x0800, CRC(fc12bd28) SHA1(0da93a311f99ec7a1e77486afe800a937778e73b)) + + ROM_REGION(0x00800, "chargen",0) + ROM_LOAD("ht108064.chr", 0x0000, 0x0800, CRC(e76b73a4) SHA1(6361ee9667bf59d50059d09b0baf8672fdb2e8af)) +ROM_END + +ROM_START( meritum) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD( "01.bin", 0x0000, 0x0800, CRC(ed705a47) SHA1(dae8b14eb2ddb2a8b4458215180ebc0fb781816a)) + ROM_LOAD( "02.bin", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0)) + ROM_LOAD( "03.bin", 0x1000, 0x0800, CRC(a21d0d62) SHA1(6dfdf3806ed2b6502e09a1b6922f21494134cc05)) + ROM_LOAD( "04.bin", 0x1800, 0x0800, CRC(3610bdda) SHA1(602f0ba1e1267f24620f993acac019ac6342a594)) + ROM_LOAD( "05.bin", 0x2000, 0x0800, CRC(461fbf0d) SHA1(bd19187dd992168af43bd68055343d515f152624)) + ROM_LOAD( "06.bin", 0x2800, 0x0800, CRC(ed547445) SHA1(20102de89a3ee4a65366bc2d62be94da984a156b)) + ROM_LOAD( "07.bin", 0x3000, 0x0800, CRC(044b1459) SHA1(faace7353ffbef6587b1b9e7f8b312e0892e3427)) + ROM_REGION(0x1000, "chargen", ROMREGION_INVERT) + ROM_LOAD( "chargen.bin", 0x0000, 0x1000, CRC(3dfc6439) SHA1(6e45a27f68c3491c403b4eafe45a108f348dd2fd)) +ROM_END + +ROM_START( meritum_net ) + ROM_REGION(0x10000, "maincpu",0) + ROM_LOAD( "01_447_m07_015m.bin", 0x0000, 0x0800, CRC(6d30cb49) SHA1(558241340a84eebcbbf8d92540e028e9164b6f8a)) + ROM_LOAD( "02_440_m08_01.bin", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0)) + ROM_LOAD( "03_440_m09_015m.bin", 0x1000, 0x0800, CRC(88e267da) SHA1(9cb8626801f8e969f35291de43c1b643c809a3c3)) + ROM_LOAD( "04_447_m10_015m.bin", 0x1800, 0x0800, CRC(e51991e4) SHA1(a7d42436da1af405970f9f99ab34b6d9abd05adf)) + ROM_LOAD( "05_440_m11_02.bin", 0x2000, 0x0800, CRC(461fbf0d) SHA1(bd19187dd992168af43bd68055343d515f152624)) + ROM_LOAD( "06_440_m12_01.bin", 0x2800, 0x0800, CRC(ed547445) SHA1(20102de89a3ee4a65366bc2d62be94da984a156b)) + ROM_LOAD( "07_447_m13_015m.bin", 0x3000, 0x0800, CRC(789f6964) SHA1(9b2231ca7ffd82bbca1f53988a7df833290ddbf2)) + ROM_REGION(0x1000, "chargen", ROMREGION_INVERT) + ROM_LOAD( "char.bin", 0x0000, 0x1000, CRC(2c09a5a7) SHA1(146891b3ddfc2de95e6a5371536394a657880054)) +ROM_END + +DRIVER_INIT_MEMBER(trs80_state,trs80) +{ + m_mode = 0; + m_model4 = 0; +} + +DRIVER_INIT_MEMBER(trs80_state,trs80l2) +{ + m_mode = 2; + m_model4 = 0; +} + +DRIVER_INIT_MEMBER(trs80_state,trs80m4) +{ + m_mode = 0; + m_model4 = 2; + m_p_videoram.set_target(memregion("maincpu")->base()+0x4000,m_p_videoram.bytes()); +} + +DRIVER_INIT_MEMBER(trs80_state,trs80m4p) +{ + m_mode = 0; + m_model4 = 4; + m_p_videoram.set_target(memregion("maincpu")->base()+0x4000,m_p_videoram.bytes()); +} + +DRIVER_INIT_MEMBER(trs80_state,lnw80) +{ + m_mode = 0; + m_model4 = 0; + m_p_gfxram = memregion("gfx2")->base(); + m_p_videoram.set_target(memregion("maincpu")->base()+0x4000,m_p_videoram.bytes()); +} + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1977, trs80, 0, 0, trs80, trs80, trs80_state, trs80, "Tandy Radio Shack", "TRS-80 Model I (Level I Basic)", 0 ) +COMP( 1978, trs80l2, trs80, 0, model1, trs80, trs80_state, trs80l2, "Tandy Radio Shack", "TRS-80 Model I (Level II Basic)", 0 ) +COMP( 1983, radionic, trs80, 0, radionic, trs80, trs80_state, trs80, "Komtek", "Radionic", 0 ) +COMP( 1980, sys80, trs80, 0, sys80, trs80, trs80_state, trs80l2, "EACA Computers Ltd", "System-80", 0 ) +COMP( 1981, lnw80, trs80, 0, lnw80, trs80m3, trs80_state, lnw80, "LNW Research", "LNW-80", 0 ) +COMP( 1980, trs80m3, trs80, 0, model3, trs80m3, trs80_state, trs80m4, "Tandy Radio Shack", "TRS-80 Model III", 0 ) +COMP( 1980, trs80m4, trs80, 0, model4, trs80m3, trs80_state, trs80m4, "Tandy Radio Shack", "TRS-80 Model 4", 0 ) +COMP( 1983, trs80m4p, trs80, 0, model4p, trs80m3, trs80_state, trs80m4p, "Tandy Radio Shack", "TRS-80 Model 4P", 0 ) +COMP( 1983, ht1080z, trs80, 0, ht1080z, trs80, trs80_state, trs80l2, "Hiradastechnika Szovetkezet", "HT-1080Z Series I", 0 ) +COMP( 1984, ht1080z2, trs80, 0, ht1080z, trs80, trs80_state, trs80l2, "Hiradastechnika Szovetkezet", "HT-1080Z Series II", 0 ) +COMP( 1985, ht108064, trs80, 0, ht1080z, trs80, trs80_state, trs80, "Hiradastechnika Szovetkezet", "HT-1080Z/64", 0 ) +COMP( 1985, meritum, trs80, 0, meritum, trs80, trs80_state, trs80l2, "Mera-Elzab", "Meritum I (Model 2)", 0 ) +COMP( 1985, meritum_net, trs80, 0, meritum, trs80, trs80_state, trs80l2, "Mera-Elzab", "Meritum I (Model 2) (network)", 0 ) diff --git a/src/mame/drivers/trs80m2.c b/src/mame/drivers/trs80m2.c new file mode 100644 index 00000000000..57b2e20bcff --- /dev/null +++ b/src/mame/drivers/trs80m2.c @@ -0,0 +1,953 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Tandy Radio Shack TRS-80 Model II/12/16/16B/6000 + + http://home.iae.nl/users/pb0aia/cm/modelii.html + +*/ + +/* + + TODO: + + - CP/M won't load prompt (z80dma_do_operation: invalid mode 0 when reading track 0) + - keyboard CPU ROM + - graphics board + - Tandy 6000 HD + + chdman -createblankhd tandy6000hd.chd 306 6 34 256 + +*/ + +#include "includes/trs80m2.h" + +#define KEYBOARD_TAG "keyboard" + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +READ8_MEMBER( trs80m2_state::read ) +{ + UINT8 data = 0; + + if (offset < 0x800) + { + if (m_boot_rom) + { + data = m_rom->base()[offset]; + } + else + { + data = m_ram->pointer()[offset]; + } + } + else if (offset < 0x8000) + { + data = m_ram->pointer()[offset]; + } + else + { + if (m_msel && offset >= 0xf800) + { + data = m_video_ram[offset & 0x7ff]; + } + else if (m_bank) + { + offs_t addr = (m_bank << 15) | (offset & 0x7fff); + + if (addr < m_ram->size()) + { + data = m_ram->pointer()[addr]; + } + } + } + + return data; +} + +WRITE8_MEMBER( trs80m2_state::write ) +{ + if (offset < 0x8000) + { + m_ram->pointer()[offset] = data; + } + else + { + if (m_msel && offset >= 0xf800) + { + m_video_ram[offset & 0x7ff] = data; + } + else if (m_bank) + { + offs_t addr = (m_bank << 15) | (offset & 0x7fff); + + if (addr < m_ram->size()) + { + m_ram->pointer()[addr] = data; + } + } + } +} + +WRITE8_MEMBER( trs80m2_state::rom_enable_w ) +{ + /* + + bit description + + 0 BOOT ROM + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + m_boot_rom = BIT(data, 0); +} + +WRITE8_MEMBER( trs80m2_state::drvslt_w ) +{ + /* + + bit signal + + 0 DS1 + 1 DS2 + 2 DS3 + 3 DS4 + 4 + 5 + 6 SDSEL + 7 FM/MFM + + */ + + // drive select + m_floppy = NULL; + + if (!BIT(data, 0)) m_floppy = m_floppy0->get_device(); + if (!BIT(data, 1)) m_floppy = m_floppy1->get_device(); + if (!BIT(data, 2)) m_floppy = m_floppy2->get_device(); + if (!BIT(data, 3)) m_floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + { + // side select + m_floppy->ss_w(!BIT(data, 6)); + } + + // FM/MFM + m_fdc->dden_w(!BIT(data, 7)); +} + +READ8_MEMBER( trs80m2_state::keyboard_r ) +{ + // clear keyboard interrupt + if (!m_kbirq) + { + m_kbirq = 1; + m_ctc->trg3(m_kbirq); + m_kb->busy_w(m_kbirq); + } + + m_key_bit = 0; + + return m_key_data; +} + +READ8_MEMBER( trs80m2_state::rtc_r ) +{ + // clear RTC interrupt + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + + return 0; +} + +READ8_MEMBER( trs80m2_state::nmi_r ) +{ + /* + + bit signal description + + 0 + 1 + 2 + 3 + 4 80/40 CHAR EN 80/40 character mode + 5 ENABLE RTC INT RTC interrupt enable + 6 DE display enabled + 7 KBIRQ keyboard interrupt + + */ + + UINT8 data = 0; + + // 80/40 character mode*/ + data |= m_80_40_char_en << 4; + + // RTC interrupt enable + data |= m_enable_rtc_int << 5; + + // display enabled + data |= m_de << 6; + + // keyboard interrupt + data |= !m_kbirq << 7; + + return data; +} + +WRITE8_MEMBER( trs80m2_state::nmi_w ) +{ + /* + + bit signal description + + 0 memory bank select bit 0 + 1 memory bank select bit 1 + 2 memory bank select bit 2 + 3 memory bank select bit 3 + 4 80/40 CHAR EN 80/40 character mode + 5 ENABLE RTC INT RTC interrupt enable + 6 BLNKVID video display enable + 7 video RAM enable + + */ + + // memory bank select + m_bank = data & 0x0f; + + // 80/40 character mode + m_80_40_char_en = BIT(data, 4); + m_crtc->set_clock(m_80_40_char_en ? XTAL_12_48MHz/16 : XTAL_12_48MHz/8); + + // RTC interrupt enable + m_enable_rtc_int = BIT(data, 5); + + if (m_enable_rtc_int && m_rtc_int) + { + // trigger RTC interrupt + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + } + + // video display enable + m_blnkvid = BIT(data, 6); + + // video RAM enable + m_msel = BIT(data, 7); +} + +READ8_MEMBER( trs80m2_state::fdc_r ) +{ + return m_fdc->gen_r(offset) ^ 0xff; +} + +WRITE8_MEMBER( trs80m2_state::fdc_w ) +{ + m_fdc->gen_w(offset, data ^ 0xff); +} + +WRITE8_MEMBER( trs80m16_state::tcl_w ) +{ + /* + + bit description + + 0 CONT0 + 1 CONT1 + 2 HALT + 3 RESET + 4 CONT4 + 5 CONT5 + 6 CONT6 + 7 A14 + + */ + + m_subcpu->set_input_line(INPUT_LINE_HALT, BIT(data, 2) ? ASSERT_LINE : CLEAR_LINE); + m_subcpu->set_input_line(INPUT_LINE_RESET, BIT(data, 3) ? ASSERT_LINE : CLEAR_LINE); + + m_pic->ir0_w(BIT(data, 4)); + m_pic->ir1_w(BIT(data, 5)); + m_pic->ir2_w(BIT(data, 6)); + + m_ual = (m_ual & 0x1fe) | BIT(data, 7); +} + +WRITE8_MEMBER( trs80m16_state::ual_w ) +{ + /* + + bit description + + 0 A15 + 1 A16 + 2 A17 + 3 A18 + 4 A19 + 5 A20 + 6 A21 + 7 A22 + + */ + + m_ual = (data << 1) | BIT(m_ual, 0); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( z80_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, trs80m2_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( z80_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( z80_io, AS_IO, 8, trs80m2_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) + AM_RANGE(0xe4, 0xe7) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0xef, 0xef) AM_WRITE(drvslt_w) + AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, cd_ba_r, cd_ba_w) + AM_RANGE(0xf8, 0xf8) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) + AM_RANGE(0xf9, 0xf9) AM_WRITE(rom_enable_w) + AM_RANGE(0xfc, 0xfc) AM_READ(keyboard_r) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) + AM_RANGE(0xfd, 0xfd) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r, register_w) + AM_RANGE(0xfe, 0xfe) AM_READ(rtc_r) + AM_RANGE(0xff, 0xff) AM_READWRITE(nmi_r, nmi_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( m16_z80_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( m16_z80_io, AS_IO, 8, trs80m16_state ) + AM_IMPORT_FROM(z80_io) + AM_RANGE(0xde, 0xde) AM_WRITE(tcl_w) + AM_RANGE(0xdf, 0xdf) AM_WRITE(ual_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( m68000_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( m68000_mem, AS_PROGRAM, 16, trs80m2_state ) +// AM_RANGE(0x7800d0, 0x7800d1) PIC +// AM_RANGE(0x7800d2, 0x7800d3) limit/offset 2 +// AM_RANGE(0x7800d4, 0x7800d5) limit/offset 1 +// AM_RANGE(0x7800d6, 0x7800d7) Z80 IRQ +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( trs80m2 ) +//------------------------------------------------- + +static INPUT_PORTS_START( trs80m2 ) +INPUT_PORTS_END + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +MC6845_UPDATE_ROW( trs80m2_state::crtc_update_row ) +{ + const pen_t *pen = m_palette->pens(); + + int x = 0; + + for (int column = 0; column < x_count; column++) + { + UINT8 code = m_video_ram[(ma + column) & 0x7ff]; + offs_t address = ((code & 0x7f) << 4) | (ra & 0x0f); + UINT8 data = m_char_rom->base()[address]; + + int dcursor = (column == cursor_x); + int drevid = BIT(code, 7); + + for (int bit = 0; bit < 8; bit++) + { + int dout = BIT(data, 7); + int color = (dcursor ^ drevid ^ dout) && de; + + bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + + data <<= 1; + } + } +} + +WRITE_LINE_MEMBER( trs80m2_state::de_w ) +{ + m_de = state; +} + +WRITE_LINE_MEMBER( trs80m2_state::vsync_w ) +{ + if (state) + { + m_rtc_int = !m_rtc_int; + + if (m_enable_rtc_int && m_rtc_int) + { + // trigger RTC interrupt + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + } + } +} + +void trs80m2_state::video_start() +{ + // allocate memory + m_video_ram.allocate(0x800); +} + +UINT32 trs80m2_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (m_blnkvid) + { + bitmap.fill(rgb_t::black, cliprect); + } + else + { + m_crtc->screen_update(screen, bitmap, cliprect); + } + + return 0; +} + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// TRS80M2_KEYBOARD_INTERFACE( kb_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( trs80m2_state::kb_clock_w ) +{ + int kbdata = m_kb->data_r(); + + if (m_key_bit == 8) + { + if (!m_kbdata && kbdata) + { + // trigger keyboard interrupt + m_kbirq = 0; + m_ctc->trg3(m_kbirq); + m_kb->busy_w(m_kbirq); + } + } + else + { + if (!m_kbclk && state) + { + // shift in keyboard data bit + m_key_data <<= 1; + m_key_data |= kbdata; + m_key_bit++; + } + } + + m_kbdata = kbdata; + m_kbclk = state; +} + +WRITE8_MEMBER( trs80m2_state::kbd_w ) +{ + // latch key data + m_key_data = data; + + // trigger keyboard interrupt + m_kbirq = 0; + m_ctc->trg3(m_kbirq); +} + +//------------------------------------------------- +// Z80DMA +//------------------------------------------------- + +READ8_MEMBER(trs80m2_state::io_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(trs80m2_state::io_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.write_byte(offset, data); +} + +//------------------------------------------------- +// Z80PIO +//------------------------------------------------- + +WRITE_LINE_MEMBER( trs80m2_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( trs80m2_state::write_centronics_fault ) +{ + m_centronics_fault = state; +} + +WRITE_LINE_MEMBER( trs80m2_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +READ8_MEMBER( trs80m2_state::pio_pa_r ) +{ + /* + + bit signal description + + 0 INTRQ FDC INT request + 1 _TWOSID 2-sided diskette + 2 _DSKCHG disk change + 3 PRIME prime + 4 FAULT printer fault + 5 PSEL printer select + 6 PE paper empty + 7 BUSY printer busy + + */ + + UINT8 data = 0; + + // floppy interrupt + data |= (m_fdc->intrq_r() ? 0x01 : 0x00); + + // 2-sided diskette + data |= (m_floppy ? m_floppy->twosid_r() : 1) << 1; + + // disk change + data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 2; + + // printer fault + data |= m_centronics_fault << 4; + + // paper empty + data |= m_centronics_perror << 6; + + // printer busy + data |= m_centronics_busy << 7; + + return data; +} + +WRITE8_MEMBER( trs80m2_state::pio_pa_w ) +{ + /* + + bit signal description + + 0 INTRQ FDC INT request + 1 _TWOSID 2-sided diskette + 2 _DSKCHG disk change + 3 PRIME prime + 4 FAULT printer fault + 5 PSEL printer select + 6 PE paper empty + 7 BUSY printer busy + + */ + + // prime + m_centronics->write_init(BIT(data, 3)); +} + +WRITE_LINE_MEMBER( trs80m2_state::strobe_w ) +{ + m_centronics->write_strobe(!state); +} + +//------------------------------------------------- +// Z80CTC +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(trs80m2_state::ctc_tick) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); + + m_ctc->trg1(1); + m_ctc->trg1(0); + + m_ctc->trg2(1); + m_ctc->trg2(0); +} + +static SLOT_INTERFACE_START( trs80m2_floppies ) + SLOT_INTERFACE( "8ssdd", FLOPPY_8_SSDD ) // Shugart SA-800 + SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) // Shugart SA-850 +SLOT_INTERFACE_END + + +//------------------------------------------------- +// z80_daisy_config trs80m2_daisy_chain +//------------------------------------------------- + +static const z80_daisy_config trs80m2_daisy_chain[] = +{ + { Z80CTC_TAG }, + { Z80SIO_TAG }, + { Z80DMA_TAG }, + { Z80PIO_TAG }, + { NULL } +}; + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// machine_start +//------------------------------------------------- + +void trs80m2_state::machine_start() +{ + // register for state saving + save_item(NAME(m_boot_rom)); + save_item(NAME(m_bank)); + save_item(NAME(m_msel)); + save_item(NAME(m_key_latch)); + save_item(NAME(m_key_data)); + save_item(NAME(m_key_bit)); + save_item(NAME(m_kbclk)); + save_item(NAME(m_kbdata)); + save_item(NAME(m_kbirq)); + save_item(NAME(m_blnkvid)); + save_item(NAME(m_80_40_char_en)); + save_item(NAME(m_de)); + save_item(NAME(m_rtc_int)); + save_item(NAME(m_enable_rtc_int)); +} + +void trs80m16_state::machine_start() +{ + trs80m2_state::machine_start(); + + // register for state saving + save_item(NAME(m_ual)); + save_item(NAME(m_limit)); + save_item(NAME(m_offset)); +} + + +//------------------------------------------------- +// machine_reset +//------------------------------------------------- + +void trs80m2_state::machine_reset() +{ + // clear keyboard interrupt + m_kbirq = 1; + m_ctc->trg3(m_kbirq); + m_kb->busy_w(m_kbirq); + + // enable boot ROM + m_boot_rom = 1; + + // disable video RAM + m_msel = 0; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( trs80m2 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( trs80m2, trs80m2_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) + MCFG_CPU_CONFIG(trs80m2_daisy_chain) + MCFG_CPU_PROGRAM_MAP(z80_mem) + MCFG_CPU_IO_MAP(z80_io) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_UPDATE_DRIVER(trs80m2_state, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_12_48MHz/8) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(trs80m2_state, crtc_update_row) + MCFG_MC6845_OUT_DE_CB(WRITELINE(trs80m2_state, de_w)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(trs80m2_state, vsync_w)) + + // devices + MCFG_FD1791_ADD(FD1791_TAG, XTAL_8MHz/4) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITE8(Z80PIO_TAG, z80pio_device, pa_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(Z80DMA_TAG, z80dma_device, rdy_w)) + MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":0", trs80m2_floppies, "8dsdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":1", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_8MHz/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxca_w)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, txca_w)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", trs80m2_state, ctc_tick, attotime::from_hz(XTAL_8MHz/2/2)) + + MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_8MHz/2) + MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(trs80m2_state, read)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(trs80m2_state, write)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(trs80m2_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(trs80m2_state, io_write_byte)) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_8MHz/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(trs80m2_state, pio_pa_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(trs80m2_state, pio_pa_w)) + MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(trs80m2_state, strobe_w)) + + MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_8MHz/2, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(Z80PIO_TAG, z80pio_device, strobe_b)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(trs80m2_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(trs80m2_state, write_centronics_fault)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(trs80m2_state, write_centronics_perror)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_DEVICE_ADD(TRS80M2_KEYBOARD_TAG, TRS80M2_KEYBOARD, 0) + MCFG_TRS80M2_KEYBOARD_CLOCK_CALLBACK(WRITELINE(trs80m2_state, kb_clock_w)) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(trs80m2_state, kbd_w)) + + // internal RAM + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("32K,96K,128K,160K,192K,224K,256K,288K,320K,352K,384K,416K,448K,480K,512K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "trs80m2") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( trs80m16 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( trs80m16, trs80m16_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) + MCFG_CPU_CONFIG(trs80m2_daisy_chain) + MCFG_CPU_PROGRAM_MAP(z80_mem) + MCFG_CPU_IO_MAP(m16_z80_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(AM9519A_TAG, pic8259_device, inta_cb) + + MCFG_CPU_ADD(M68000_TAG, M68000, XTAL_24MHz/4) + MCFG_CPU_PROGRAM_MAP(m68000_mem) + MCFG_DEVICE_DISABLE() + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_UPDATE_DRIVER(trs80m2_state, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_12_48MHz/8) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(trs80m2_state, crtc_update_row) + MCFG_MC6845_OUT_DE_CB(WRITELINE(trs80m2_state, de_w)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(trs80m2_state, vsync_w)) + + // devices + MCFG_FD1791_ADD(FD1791_TAG, XTAL_8MHz/4) + MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITE8(Z80PIO_TAG, z80pio_device, pa_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(Z80DMA_TAG, z80dma_device, rdy_w)) + MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":0", trs80m2_floppies, "8dsdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":1", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_8MHz/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxca_w)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, txca_w)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", trs80m2_state, ctc_tick, attotime::from_hz(XTAL_8MHz/2/2)) + + MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_8MHz/2) + MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(trs80m2_state, read)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(trs80m2_state, write)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(trs80m2_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(trs80m2_state, io_write_byte)) + + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_8MHz/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(trs80m2_state, pio_pa_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(trs80m2_state, pio_pa_w)) + MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(trs80m2_state, strobe_w)) + + MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_8MHz/2, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_PIC8259_ADD(AM9519A_TAG, INPUTLINE(M68000_TAG, M68K_IRQ_5), VCC, NULL ) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(Z80PIO_TAG, z80pio_device, strobe_b)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(trs80m2_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(trs80m2_state, write_centronics_fault)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(trs80m2_state, write_centronics_perror)) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_DEVICE_ADD(TRS80M2_KEYBOARD_TAG, TRS80M2_KEYBOARD, 0) + MCFG_TRS80M2_KEYBOARD_CLOCK_CALLBACK(WRITELINE(trs80m2_state, kb_clock_w)) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(trs80m2_state, kbd_w)) + + // internal RAM + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") + MCFG_RAM_EXTRA_OPTIONS("512K,768K,1M") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "trs80m2") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +/* + + TRS-80 Model II/16 Z80 CPU Board ROM + + It would seem that every processor board I find has a different ROM on it! It seems that the early ROMs + don't boot directly from a hard drive. But there seems to be many versions of ROMs. I've placed them in + order of serial number in the list below. There also appears to be at least two board revisions, "C" and "D". + + cpu_c8ff.bin/hex: + Mask Programmable PROM, Equivilant to Intel 2716 EPROM, with checksum C8FF came from a cpu board with + serial number 120353 out of a Model II with serial number 2002102 and catalog number 26-6002. The board + was labeled, "Revision C". This appears to be an early ROM and according to a very helpful fellow + collector, Aaron in Australia, doesn't allow boot directly from a hard disk. + + cpu_9733.bin/hex: + An actual SGS-Ates (Now STMicroelectronics) 2716 EPROM, with checksum 9733 came from a cpu board with + serial number 161993 out of a pile of random cards that I have. I don't know what machine it originated + from. The board was labeled, "Revision C". This appears to be a later ROM in that it is able to boot + directly from an 8MB hard disk. The EPROM had a windows sticker on it labeled, "U54". + + cpu_2119.bin/hex: + An actual Texas Instruments TMS2516 EPROM, with checksum 2119 came from a cpu board with serial number + 178892 out of a Model 16 with serial number 64014509 and catalog number 26-4002. The board was labeled, + "Revision D". This appears to be a later ROM and does appear to allow boot directly from an 8MB hard disk. + + cpu_2bff.bin/hex: + Mask Programmable PROM, Equivilant to Intel 2716 EPROM, with checksum 2BFF came from a cpu board with + serial number 187173 our of a pile of random cards that I have. I don't know what machine it originated + from. The board was labeled, "Revision D". This appears to be a later ROM in that it is able to boot + directly from an 8MB hard disk. + +*/ + +//------------------------------------------------- +// ROM( trs80m2 ) +//------------------------------------------------- + +ROM_START( trs80m2 ) + ROM_REGION( 0x800, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "9733" ) + ROM_SYSTEM_BIOS( 0, "c8ff", "Version 1" ) + ROMX_LOAD( "8043216.u11", 0x0000, 0x0800, CRC(7017a373) SHA1(1c7127fcc99fc351a40d3a3199ba478e783c452e), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "2bff", "Version 2 (1981-07-29)" ) + ROMX_LOAD( "8047316.u11", 0x0000, 0x0800, CRC(c6c71d8b) SHA1(7107e2cbbe769851a4460680c2deff8e76a101b5), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "2119", "Version 3 (1982-05-07)" ) + ROMX_LOAD( "cpu_2119.u11", 0x0000, 0x0800, CRC(7a663049) SHA1(f308439ce266df717bfe79adcdad6024b4faa141), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "1bbe", "Version 3 (1982-05-07, Alt)" ) + ROMX_LOAD( "cpu_11be.u11", 0x0000, 0x0800, CRC(8edceea7) SHA1(3d797acedd8a71a82c695129ca764f85aa9022b2), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "fc86", "Version 4 (1982-11-18)" ) + ROMX_LOAD( "cpu_fc86.u11", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 5, "9733", "Version 5 (1983-07-29)" ) + ROMX_LOAD( "u54.u11", 0x0000, 0x0800, CRC(823924b1) SHA1(aee0625bcbd8620b28ab705e15ad9bea804c8476), ROM_BIOS(6) ) + + ROM_REGION( 0x800, MC6845_TAG, 0 ) + ROM_LOAD( "8043316.u9", 0x0000, 0x0800, CRC(04425b03) SHA1(32a29dc202b7fcf21838289cc3bffc51ef943dab) ) +ROM_END + + +//------------------------------------------------- +// ROM( trs80m16 ) +//------------------------------------------------- + +#define rom_trs80m16 rom_trs80m2 + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1979, trs80m2, 0, 0, trs80m2, trs80m2, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model II", MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) +COMP( 1982, trs80m16, trs80m2, 0, trs80m16, trs80m2, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) +//COMP( 1983, trs80m12, trs80m2, 0, trs80m16, trs80m2, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 12", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) +//COMP( 1984, trs80m16b,trs80m2, 0, trs80m16, trs80m2, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 16B", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) +//COMP( 1985, tandy6k, trs80m2, 0, tandy6k, trs80m2, driver_device, 0, "Tandy Radio Shack", "Tandy 6000 HD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) diff --git a/src/mame/drivers/ts802.c b/src/mame/drivers/ts802.c new file mode 100644 index 00000000000..19680c956cb --- /dev/null +++ b/src/mame/drivers/ts802.c @@ -0,0 +1,242 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Skeleton driver for Televideo TS802 + + 2012-11-06 Skeleton + 2014-02-07 Started adding devices + + Status: + - TS802: After 5 seconds, Slowly prints dots + - TS802H: After 5 seconds, type in any 5 characters, then you get a prompt. + + TODO: + - Almost everything + + Technical manual at: + http://bitsavers.org/pdf/televideo/TS800A_TS802_TS802H_Maintenance_Manual_1982.pdf + + includes in-depth discussion of the inner workings of the WD1000 HDD controller. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/terminal.h" +#include "machine/z80dma.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/wd_fdc.h" + +#define TERMINAL_TAG "terminal" + +class ts802_state : public driver_device +{ +public: + ts802_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_DRIVER_INIT(ts802); + DECLARE_MACHINE_RESET(ts802); + DECLARE_READ8_MEMBER(port00_r) { return 0x80; }; + DECLARE_READ8_MEMBER(port0c_r) { return 1; }; + DECLARE_READ8_MEMBER(port0e_r) { return 0; }; + DECLARE_READ8_MEMBER(port0f_r) { return (m_term_data) ? 5 : 4; }; + DECLARE_READ8_MEMBER(port0d_r); + DECLARE_WRITE8_MEMBER(port04_w); + DECLARE_WRITE8_MEMBER(port18_w); + DECLARE_WRITE8_MEMBER(port80_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + DECLARE_WRITE8_MEMBER( kbd_put ); +private: + UINT8 m_term_data; + address_space *m_mem; + address_space *m_io; + required_device m_maincpu; + required_device m_terminal; +}; + +static ADDRESS_MAP_START(ts802_mem, AS_PROGRAM, 8, ts802_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x1000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ts802_io, AS_IO, 8, ts802_state) + //ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_READ(port00_r) // DIP switches + // 04 - written once after OS boot to bank in RAM from 0000-3FFF instead of ROM. 4000-FFFF is always RAM. + AM_RANGE(0x04, 0x07) AM_WRITE(port04_w) + // 08-0B: Z80 CTC + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + // 0C-0F: Z80 SIO #1 + //AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80dart1", z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x0c, 0x0c) AM_READ(port0c_r) + AM_RANGE(0x0d, 0x0d) AM_READ(port0d_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x0e, 0x0e) AM_READ(port0e_r) + AM_RANGE(0x0f, 0x0f) AM_READ(port0f_r) + // 10: Z80 DMA + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("z80dma", z80dma_device, read, write) + // 14-17: WD 1793 + AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("fdc", fd1793_t, read, write) + // 18: floppy misc. + AM_RANGE(0x18, 0x1c) AM_WRITE(port18_w) + // 20-23: Z80 SIO #2 + AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80dart2", z80dart_device, ba_cd_r, ba_cd_w) + // 48-4F: WD1000 harddisk controller + // 80: LEDs + AM_RANGE(0x80, 0x80) AM_WRITE(port80_w) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( ts802 ) +INPUT_PORTS_END + +WRITE8_MEMBER( ts802_state::port04_w ) +{ + membank("bankr0")->set_entry(1); +} + +WRITE8_MEMBER( ts802_state::port18_w ) +{ +} + +WRITE8_MEMBER( ts802_state::port80_w ) +{ +} + +READ8_MEMBER( ts802_state::memory_read_byte ) +{ + return m_mem->read_byte(offset); +} + +WRITE8_MEMBER( ts802_state::memory_write_byte ) +{ + m_mem->write_byte(offset, data); +} + +READ8_MEMBER( ts802_state::io_read_byte ) +{ + return m_io->read_byte(offset); +} + +WRITE8_MEMBER( ts802_state::io_write_byte ) +{ + m_io->write_byte(offset, data); +} + +static SLOT_INTERFACE_START( ts802_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +MACHINE_RESET_MEMBER( ts802_state, ts802 ) +{ + membank("bankr0")->set_entry(0); // point at rom + membank("bankw0")->set_entry(0); // always write to ram +} + +READ8_MEMBER( ts802_state::port0d_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +WRITE8_MEMBER( ts802_state::kbd_put ) +{ + m_term_data = data; +} + +#if 0 +// not correct +static const z80_daisy_config daisy_chain_intf[] = +{ + { "z80dart1" }, + { "z80dart2" }, + { "z80dma" }, + { "z80ctc" }, + { NULL } +}; +#endif + +DRIVER_INIT_MEMBER( ts802_state, ts802 ) +{ + m_mem = &m_maincpu->space(AS_PROGRAM); + m_io = &m_maincpu->space(AS_IO); + + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(1, &main[0x0000]); + membank("bankr0")->configure_entry(0, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); +} + +static MACHINE_CONFIG_START( ts802, ts802_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(ts802_mem) + MCFG_CPU_IO_MAP(ts802_io) + //MCFG_CPU_CONFIG(daisy_chain_intf) // causes problems + MCFG_MACHINE_RESET_OVERRIDE(ts802_state, ts802) + + /* Devices */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ts802_state, kbd_put)) + + MCFG_DEVICE_ADD("z80dma", Z80DMA, XTAL_16MHz / 4) + MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(ts802_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(ts802_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(ts802_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(ts802_state, io_write_byte)) + + MCFG_Z80DART_ADD("z80dart1", XTAL_16MHz / 4, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_Z80DART_ADD("z80dart2", XTAL_16MHz / 4, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_FD1793_ADD("fdc", XTAL_4MHz / 2) // unknown clock + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ts802_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ts802 ) + ROM_REGION(0x11000, "maincpu", 0) + ROM_LOAD( "ts802.rom", 0x10000, 0x1000, CRC(60bd086a) SHA1(82c5b60223e0d895683d3592a56684ef2dabfba6) ) +ROM_END + +ROM_START( ts802h ) + ROM_REGION(0x11000, "maincpu", 0) + ROM_LOAD( "8000050 050 2732", 0x10000, 0x1000, CRC(7054f384) SHA1(cf0a01a32283272532ed4890c3a3c2082f1618bf) ) + + ROM_REGION(0x2000, "roms", 0) // not Z80 code + ROM_LOAD( "i800000 047d.a53", 0x0000, 0x1000, CRC(94bfcbc1) SHA1(87c5f8898b0041d012e142ee7f559cb8a90f4dc1) ) + ROM_LOAD( "a64", 0x1000, 0x1000, CRC(41b5feda) SHA1(c9435a97c032ffe457bdb84d5dde8ecf3677b56c) ) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "800000-003a.a68", 0x0000, 0x0800, CRC(24eeb74d) SHA1(77900937f1492b4c5a70ba3aac55da322d403fbd) ) + ROM_LOAD( "800000-002a.a67", 0x0800, 0x0800, CRC(4b6c6e29) SHA1(c236e4625bc16062154cbebc4dbc8d62183ef9ab) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, ts802, 0, 0, ts802, ts802, ts802_state, ts802, "Televideo", "TS802", MACHINE_IS_SKELETON ) +COMP( 1982, ts802h, ts802, 0, ts802, ts802, ts802_state, ts802, "Televideo", "TS802H", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/ts803.c b/src/mame/drivers/ts803.c new file mode 100644 index 00000000000..4bcfc4922bd --- /dev/null +++ b/src/mame/drivers/ts803.c @@ -0,0 +1,68 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Skeleton driver for Televideo TS803 + + TODO: + - Everything - this is just a skeleton + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" + + +class ts803_state : public driver_device +{ +public: + ts803_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + required_device m_maincpu; + + virtual void machine_reset(); +}; + +static ADDRESS_MAP_START(ts803_mem, AS_PROGRAM, 8, ts803_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ts803_io, AS_IO, 8, ts803_state) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( ts803 ) +INPUT_PORTS_END + + +void ts803_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( ts803, ts803_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(ts803_mem) + MCFG_CPU_IO_MAP(ts803_io) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ts803h ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "180001-37 rev d 803 5 23 84", 0x0000, 0x2000, CRC(0aa658a7) SHA1(42d0a89c2ff9b6588cd88bdb1f800fac540dccbb) ) + + ROM_REGION(0x10000, "proms", 0) + ROM_LOAD( "8000134.bin", 0x000, 0x100, CRC(231fe6d6) SHA1(3c052ba4b74547e0e2451fa1ae67bbcb83a18bab) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, ts803h, 0, 0, ts803, ts803, driver_device, 0, "Televideo", "TS803H", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/ts816.c b/src/mame/drivers/ts816.c new file mode 100644 index 00000000000..c9cfd795665 --- /dev/null +++ b/src/mame/drivers/ts816.c @@ -0,0 +1,109 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + 2013-09-10 Skeleton driver for Televideo ts816 + + TODO: + - Everything - this is just a skeleton + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class ts816_state : public driver_device +{ +public: + ts816_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(keyin_r); + DECLARE_READ8_MEMBER(status_r); + +private: + UINT8 m_term_data; + UINT8 m_status; + virtual void machine_reset(); + required_device m_maincpu; + required_device m_terminal; +}; + +static ADDRESS_MAP_START(ts816_mem, AS_PROGRAM, 8, ts816_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM + AM_RANGE(0x1000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(ts816_io, AS_IO, 8, ts816_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x50, 0x50) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x52, 0x52) AM_READ(status_r) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( ts816 ) +INPUT_PORTS_END + + +READ8_MEMBER( ts816_state::keyin_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( ts816_state::status_r ) +{ + if (m_status) + { + m_status--; + return 5; + } + else + return 4; +} + +WRITE8_MEMBER( ts816_state::kbd_put ) +{ + m_term_data = data; + m_status = 3; +} + +void ts816_state::machine_reset() +{ + m_term_data = 0; + m_status = 1; +} + +static MACHINE_CONFIG_START( ts816, ts816_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 4000000) + MCFG_CPU_PROGRAM_MAP(ts816_mem) + MCFG_CPU_IO_MAP(ts816_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ts816_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ts816 ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "81640v11.rom", 0x0000, 0x1000, CRC(295a15e7) SHA1(6f49078ab3cd49aecd2afafcbed3af0e3bcfd48c) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, ts816, 0, 0, ts816, ts816, driver_device, 0, "Televideo", "TS816", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/tsispch.c b/src/mame/drivers/tsispch.c new file mode 100644 index 00000000000..4a1cc037fe8 --- /dev/null +++ b/src/mame/drivers/tsispch.c @@ -0,0 +1,548 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/****************************************************************************** +* +* Telesensory Systems Inc./Speech Plus +* 1500 and 2000 series +* Prose 2020 +* Copyright (C) 2011-2013 Jonathan Gevaryahu AKA Lord Nightmare and Kevin 'kevtris' Horton +* +* The Prose 2000 card is an IEEE 796 Multibus card, with additional connectors to facilitate power and serial input other than via multibus. +* There are two hardware versions of the card: +* - The 1981 Telesensory Systems Inc copyrighted version +* (lacks U82, has some rework on the power input to add a bypass capacitor and an extra power line to the 8086) +* - The 1986 Speech Plus copyrighted version +* (adds U82 as an extra buffer for status (not sure)? integrates the greenwire fixes from the above board, minor reorganizations of passives) +* Both versions encountered have been in non-multibus enclosures: +* - The 1981 Version appeared on a 'Voice V4' Speech board scrapped from a "Kurzweil Reading Machine" Talking Scanner (predecessor to the TSI/Kurzweil/Xerox 'Reading Edge' scanner which is SPARC based) [I'm very sorry I didn't get the OCR computing guts of the scanner itself too :( ] +* - The 1986 Version appeared in a 'Prose 2020' under-monitor RS232 speech unit. +* +* DONE: +* Skeleton Written +* Load cpu and dsp roms and mapper proms +* Successful compile +* Successful run +* Correctly Interleave 8086 CPU roms +* Debug LEDs hooked to popmessage +* Correctly load UPD7720 roms as UPD7725 data - done; this is utterly disgusting code, but appears to work. +* Attached i8251a uart at u15 +* Added dipswitch array S4 +* Attached 8259 PIC + * IR0 = upd7720 p0 pin masked by (probably peripheral bit 8) + * IR1 = i8251 rxrdy + * IR2 = i8251 txempty + * IR3 = i8251 txrdy + * IR4,5,6,7 unknown so far, not hooked up yet +* Hooked the terminal to the i8251a uart at u15 +* Hooked up upd7720 reset line +* Verified CPU and DSP clocks +* +* TODO: +* UPD7720: hook up serial output and SCK, and hook SO to the DAC; this requires fixing the upd7725 core to actually support SCK and serial output/SO! +* Attach the other i8251a uart (assuming it is hooked to the main hardware at all!) +* Correctly implement UPD7720 cpu core to avoid needing revolting conversion code; this probably involves overriding and duplicating much of the exec_xx sections of the 7725 core +* Correct memory maps and io maps, and figure out what all the proms do - mostly done +* 8259 PIC: figure out where IR4-7 come from, if anywhere. +* UPD7720 and 8259: hook up p0 and p1 as outputs, and figure out how 8259 IR0 is masked from 7720 p0. +* Add other dipswitches and jumpers (these may actually just control clock dividers for the two 8251s) +* Older v1.1 set gets stuck forever waiting for upd7720 status port to equal 0x20, which never happens. +* Everything else +* +* Notes: +* Text in rom indicates there is a test mode 'activated by switch s4 dash 7' +* When switch s4-7 is switched on, the hardware says, over and over: +* "This is version 3.4.1 test mode, activated by switch s4 dash 7" +* +* 0x03400: the peripheral register +* the low 8 bits (7-0) are Sw4 +* the high 8 bits: +* Bit F E D C B A 9 8 +* | | | | | | | \- unknown but used, probably control (1=allow 0=mask?) 7720 p0 int to 8259 ir0? +* | | | | | | \--- LED 6 control (0 = on) +* | | | | | \----- LED 5 control (0 = on) +* | | | | \------- LED 4 control (0 = on) +* | | | \--------- LED 3 control (0 = on) +* | | \----------- unknown, possibly unused? +* | \------------- UPD7720 RESET line (0 = high/in reset, 1 = low/running) +* \--------------- unknown, possibly unused? but might possibly related to 7720 p0->8259 as well? +* +* When the unit is idle, leds 5 and 3 are on and upd7720 reset is low (write of 0b?1?0101?. +* On all character writes from i8251, bit 8 is unset, then set again, possibly to avoid interrupt clashes? +* +* Bootup notes v3.4.1: +* D3109: checks if 0x80 (S4-8) is set: if set, continue, else jump to D3123 +* D3123: write 0x1C (0 0 0 [1 1 1 0] 0) to 3401 +* then jump to D32B0 +* D32B0: memory test routine: +* This routine flood-fills memory from 0000-2FFF with 0xFF, +* then, bytewise starting from 0000, shifts the value progresively +* right by one, writes it and checks that it still matches, +* i.e. read 0xFF, write 0x7f, read 0x7f, write 0x3f... etc. +* Loop at D32E4. +* D32E6: similar to D32B0, but rotates in 1 bits to 16 bit words, +* though only the low byte is written, and only fills the 2BFF +* down to 0000 region. (seems rather redundant, actually) +* Loop at D3301. +* D3311: write 0x0A (0 0 0 [0 1 0 1] 0) to 3401 +* then jump to D3330 +* D3330: jump back to D312E +* D312E: this is some unknown conditional code, usually goes to D314E +* if BP is not 1, go to D314E and don't update leds (usually taken?) +* if BP is 1 and SI is 0, delay for 8*65536 cycles. no delay if si!=0 +* write 0x0C (0 0 0 [0 1 1 0] 0) to 3401 +* D314E: floodfill 0000-2BFF with 0x55 (rep at D315C) +* check if bp was 1 and jump to D318F if it was +* write 0x14 (0 0 0 [1 0 1 0] 0) to 3401 +* call E3987: initialize UPD7720, return +* D33D2: checksum the roms in 5? passes, loop at D33DA, test at D33E6 (which passes) +* if test DID fail: write 0x10 (0 0 0 [1 0 0 0] 0) to 3401 +* more stuff +* write 0xFF to 3401 +* more stuff +* set up word table? not sure what its doing here... +* if test does NOT fail (and it doesn't): +* D3414: write 0x08 (0 0 0 [0 1 0 0] 0) to 3400 +* D5E14: initialize PIC8259 +* +* D338A: write 0x12 0 0 0 [1 0 0 1] 0 to 3401 +* +* F44B4: general in-operation LED status write +******************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "includes/tsispch.h" +#include "cpu/upd7725/upd7725.h" +#include "cpu/i86/i86.h" +#include "machine/i8251.h" +#include "machine/pic8259.h" +#include "machine/terminal.h" + +// defines +#define DEBUG_PARAM 1 +#undef DEBUG_DSP +#undef DEBUG_DSP_W + +/* + Devices and handlers + */ + +/***************************************************************************** + USART 8251 and Terminal stuff +*****************************************************************************/ +WRITE_LINE_MEMBER(tsispch_state::i8251_rxrdy_int) +{ + machine().device("pic8259")->ir1_w(state); +} + +WRITE_LINE_MEMBER(tsispch_state::i8251_txempty_int) +{ + machine().device("pic8259")->ir2_w(state); +} + +WRITE_LINE_MEMBER(tsispch_state::i8251_txrdy_int) +{ + machine().device("pic8259")->ir3_w(state); +} + +WRITE8_MEMBER( tsispch_state::i8251_rxd ) +{ + i8251_device *uart = machine().device("i8251a_u15"); + uart->receive_character(data); +} + +/***************************************************************************** + LED/dipswitch stuff +*****************************************************************************/ +READ8_MEMBER( tsispch_state::dsw_r ) +{ + /* the only dipswitch I'm really sure about is s4-7 which enables the test mode + * The switches are, for normal operation on my unit (and the older unit as well): + * 1 2 3 4 5 6 7 8 + * ON ON OFF OFF OFF OFF OFF OFF + * which makes this register read 0xFC + * When s4-7 is turned on, it reads 0xBC + */ + return ioport("s4")->read(); +} + +WRITE8_MEMBER( tsispch_state::peripheral_w ) +{ + /* This controls the four LEDS, the RESET line for the upd77p20, + and (probably) the p0-to-ir0 masking of the upd77p20; there are two + unknown and seemingly unused bits as well. + see the top of the file for more info. + */ + m_paramReg = data; + m_dsp->set_input_line(INPUT_LINE_RESET, BIT(data,6)?CLEAR_LINE:ASSERT_LINE); +#ifdef DEBUG_PARAM + //fprintf(stderr,"8086: Parameter Reg written: UNK7: %d, DSPRST6: %d; UNK5: %d; LED4: %d; LED3: %d; LED2: %d; LED1: %d; DSPIRQMASK: %d\n", BIT(data,7), BIT(data,6), BIT(data,5), BIT(data,4), BIT(data,3), BIT(data,2), BIT(data,1), BIT(data,0)); + logerror("8086: Parameter Reg written: UNK7: %d, DSPRST6: %d; UNK5: %d; LED4: %d; LED3: %d; LED2: %d; LED1: %d; DSPIRQMASK: %d\n", BIT(data,7), BIT(data,6), BIT(data,5), BIT(data,4), BIT(data,3), BIT(data,2), BIT(data,1), BIT(data,0)); +#endif + popmessage("LEDS: 6/Talking:%d 5:%d 4:%d 3:%d\n", 1-BIT(data,1), 1-BIT(data,2), 1-BIT(data,3), 1-BIT(data,4)); +} + +/***************************************************************************** + UPD77P20 stuff +*****************************************************************************/ +READ16_MEMBER( tsispch_state::dsp_data_r ) +{ + upd7725_device *upd7725 = machine().device("dsp"); +#ifdef DEBUG_DSP + UINT8 temp; + temp = upd7725->snesdsp_read(true); + fprintf(stderr, "dsp data read: %02x\n", temp); + return temp; +#else + return upd7725->snesdsp_read(true); +#endif +} + +WRITE16_MEMBER( tsispch_state::dsp_data_w ) +{ + upd7725_device *upd7725 = machine().device("dsp"); +#ifdef DEBUG_DSP_W + fprintf(stderr, "dsp data write: %02x\n", data); +#endif + upd7725->snesdsp_write(true, data); +} + +READ16_MEMBER( tsispch_state::dsp_status_r ) +{ + upd7725_device *upd7725 = machine().device("dsp"); +#ifdef DEBUG_DSP + UINT8 temp; + temp = upd7725->snesdsp_read(false); + fprintf(stderr, "dsp status read: %02x\n", temp); + return temp; +#else + return upd7725->snesdsp_read(false); +#endif +} + +WRITE16_MEMBER( tsispch_state::dsp_status_w ) +{ + fprintf(stderr, "warning: upd772x status register should never be written to!\n"); + upd7725_device *upd7725 = machine().device("dsp"); + upd7725->snesdsp_write(false, data); +} + +WRITE_LINE_MEMBER( tsispch_state::dsp_to_8086_p0_w ) +{ + fprintf(stderr, "upd772x changed p0 state to %d!\n",state); + //TODO: do stuff here! +} + +WRITE_LINE_MEMBER( tsispch_state::dsp_to_8086_p1_w ) +{ + fprintf(stderr, "upd772x changed p1 state to %d!\n",state); + //TODO: do stuff here! +} + +/***************************************************************************** + Reset and Driver Init +*****************************************************************************/ +void tsispch_state::machine_reset() +{ + fprintf(stderr,"machine reset\n"); +} + +DRIVER_INIT_MEMBER(tsispch_state,prose2k) +{ + UINT8 *dspsrc = (UINT8 *)(memregion("dspprgload")->base()); + UINT32 *dspprg = (UINT32 *)(memregion("dspprg")->base()); + fprintf(stderr,"driver init\n"); + // unpack 24 bit 7720 data into 32 bit space and shuffle it so it can run as 7725 code + // data format as-is in dspsrc: (L = always 0, X = doesn't matter) + // source upd7720 dest upd7725 + // bit 7 6 5 4 3 2 1 0 bit 7 6 5 4 3 2 1 0 + // for OP/RT: + // b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15 + // b2 L 8 9 10 11 12 13 14 -> 14 13 12 L 11 10 9 8 + // b3 0 1 2 3 4 5 6 7 -> 7 6 5 4 3 2 1 0 + // for JP: + // b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15 + // b2 L 8 9 10 11 12 13 14 -> 14 13 L L L 12 11 10 + // b3 0 1 2 3 4 5 6 7 -> 9 8 7 6 5 4 X X + // for LD: + // b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15 + // b2 L 8 9 10 11 12 13 14 -> 14 13 12 11 10 9 8 7 + // b3 0 1 2 3 4 5 6 7 -> 6 5 X X 3 2 1 0 + UINT8 byte1t; + UINT16 byte23t; + for (int i = 0; i < 0x600; i+= 3) + { + byte1t = BITSWAP8(dspsrc[0+i], 0, 1, 2, 3, 4, 5, 6, 7); + // here's where things get disgusting: if the first byte was an OP or RT, do the following: + if ((byte1t&0x80) == 0x00) // op or rt instruction + { + byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 15, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7); + } + else if ((byte1t&0xC0) == 0x80) // jp instruction + { + byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 15, 15, 15, 10, 11, 12, 13, 14, 0, 1, 2, 3, 6, 7); + } + else // ld instruction + { + byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 3, 4, 5, 6, 7); + } + + *dspprg = byte1t<<24 | byte23t<<8; + dspprg++; + } + m_paramReg = 0x00; // on power up, all leds on, reset to upd7720 is high + m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // starts in reset +} + +/****************************************************************************** + Address Maps +******************************************************************************/ +/* The address map of the prose 2020 is controlled by 2 proms, see the rom section + for details on those. + (x = ignored; * = selects address within this range; s = selects one of a pair of chips) + A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 + 0 0 x x 0 x 0 * * * * * * * * * * * * s 6264*2 SRAM first half + 0 0 x x 0 x 1 0 * * * * * * * * * * * s 6264*2 SRAM 3rd quarter + 0 0 x x 0 x 1 1 0 0 0 x x x x x x x * x iP8251A @ U15 + 0 0 x x 0 x 1 1 0 0 1 x x x x x x x * x AMD P8259A PIC + 0 0 x x 0 x 1 1 0 1 0 x x x x x x x x * LEDS, dipswitches, and UPD77P20 control lines + 0 0 x x 0 x 1 1 0 1 1 x x x x x x x * x UPD77P20 data/status + 0 0 x x 0 x 1 1 1 x x Open bus, verified (returns 0x00EA) + 0 0 x x 1 x Open bus? (or maybe communication with multibus connector?) (returns 0xFA,B,C,FFF) + 0 1 Open bus, verified (returns 0x00EA) + 1 0 Open bus, verified (returns 0x00EA) + 1 1 0 * * * * * * * * * * * * * * * * s ROMs 2 and 3 + 1 1 1 * * * * * * * * * * * * * * * * s ROMs 0 and 1 +*/ +static ADDRESS_MAP_START(i8086_mem, AS_PROGRAM, 16, tsispch_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x02FFF) AM_MIRROR(0x34000) AM_RAM // verified; 6264*2 sram, only first 3/4 used + AM_RANGE(0x03000, 0x03001) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("i8251a_u15", i8251_device, data_r, data_w, 0x00FF) + AM_RANGE(0x03002, 0x03003) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("i8251a_u15", i8251_device, status_r, control_w, 0x00FF) + AM_RANGE(0x03200, 0x03203) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00FF) // AMD P8259 PIC @ U5 (reads as 04 and 7c, upper byte is open bus) + AM_RANGE(0x03400, 0x03401) AM_MIRROR(0x341FE) AM_READ8(dsw_r, 0x00FF) // verified, read from dipswitch s4 + AM_RANGE(0x03400, 0x03401) AM_MIRROR(0x341FE) AM_WRITE8(peripheral_w, 0xFF00) // verified, write to the 4 leds, plus 4 control bits + AM_RANGE(0x03600, 0x03601) AM_MIRROR(0x341FC) AM_READWRITE(dsp_data_r, dsp_data_w) // verified; UPD77P20 data reg r/w + AM_RANGE(0x03602, 0x03603) AM_MIRROR(0x341FC) AM_READWRITE(dsp_status_r, dsp_status_w) // verified; UPD77P20 status reg r + AM_RANGE(0xc0000, 0xfffff) AM_ROM // verified +ADDRESS_MAP_END + +// Technically the IO line of the i8086 is completely ignored (it is running in 8086 MIN mode,I believe, which may ignore IO) +static ADDRESS_MAP_START(i8086_io, AS_IO, 16, tsispch_state) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +static ADDRESS_MAP_START(dsp_prg_map, AS_PROGRAM, 32, tsispch_state) + AM_RANGE(0x0000, 0x01ff) AM_ROM AM_REGION("dspprg", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(dsp_data_map, AS_DATA, 16, tsispch_state) + AM_RANGE(0x0000, 0x01ff) AM_ROM AM_REGION("dspdata", 0) +ADDRESS_MAP_END + + +/****************************************************************************** + Input Ports +******************************************************************************/ +static INPUT_PORTS_START( prose2k ) +PORT_START("s4") // dipswitch array s4 + PORT_DIPNAME( 0x01, 0x00, "S4-1") PORT_DIPLOCATION("SW4:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, "S4-2") PORT_DIPLOCATION("SW4:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, "S4-3") PORT_DIPLOCATION("SW4:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "S4-4") PORT_DIPLOCATION("SW4:4") + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "S4-5") PORT_DIPLOCATION("SW4:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "S4-6") PORT_DIPLOCATION("SW4:6") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "S4-7: Self Test") PORT_DIPLOCATION("SW4:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "S4-8") PORT_DIPLOCATION("SW4:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +/****************************************************************************** + Machine Drivers +******************************************************************************/ +static MACHINE_CONFIG_START( prose2k, tsispch_state ) + /* basic machine hardware */ + /* There are two crystals on the board: a 24MHz xtal at Y2 and a 16MHz xtal at Y1 */ + MCFG_CPU_ADD("maincpu", I8086, 8000000) /* VERIFIED clock, unknown divider */ + MCFG_CPU_PROGRAM_MAP(i8086_mem) + MCFG_CPU_IO_MAP(i8086_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) + + /* TODO: the UPD7720 has a 10KHz clock to its INT pin */ + /* TODO: the UPD7720 has a 2MHz clock to its SCK pin */ + /* TODO: hook up p0, p1, int */ + MCFG_CPU_ADD("dsp", UPD7725, 8000000) /* VERIFIED clock, unknown divider; correct dsp type is UPD77P20 */ + MCFG_CPU_PROGRAM_MAP(dsp_prg_map) + MCFG_CPU_DATA_MAP(dsp_data_map) + MCFG_NECDSP_OUT_P0_CB(WRITELINE(tsispch_state, dsp_to_8086_p0_w)) + MCFG_NECDSP_OUT_P1_CB(WRITELINE(tsispch_state, dsp_to_8086_p1_w)) + + /* PIC 8259 */ + MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) + + /* uarts */ + MCFG_DEVICE_ADD("i8251a_u15", I8251, 0) + // (todo: proper hookup, currently using hack w/i8251_receive_character()) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(tsispch_state, i8251_rxrdy_int)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(tsispch_state, i8251_txrdy_int)) + MCFG_I8251_TXEMPTY_HANDLER(WRITELINE(tsispch_state, i8251_txempty_int)) + + /* sound hardware */ + //MCFG_SPEAKER_STANDARD_MONO("mono") + //MCFG_SOUND_ADD("dac", DAC, 0) /* TODO: correctly figure out how the DAC works; apparently it is connected to the serial output of the upd7720, which will be "fun" to connect up */ + //MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(tsispch_state, i8251_rxd)) +MACHINE_CONFIG_END + +/****************************************************************************** + ROM Definitions +******************************************************************************/ +ROM_START( prose2k ) + ROM_REGION(0x100000,"maincpu", 0) + // prose 2000/2020 firmware version 3.4.1 + ROMX_LOAD( "v3.4.1__2000__2.u22", 0xc0000, 0x10000, CRC(201d3114) SHA1(549ef1aa28d5664d4198cbc1826b31020d6c4870),ROM_SKIP(1)) + ROMX_LOAD( "v3.4.1__2000__3.u45", 0xc0001, 0x10000, CRC(190c77b6) SHA1(2b90b3c227012f2085719e6283da08afb36f394f),ROM_SKIP(1)) + ROMX_LOAD( "v3.4.1__2000__0.u21", 0xe0000, 0x10000, CRC(3fae874a) SHA1(e1d3e7ba309b29a9c3edbe3d22becf82eae50a31),ROM_SKIP(1)) + ROMX_LOAD( "v3.4.1__2000__1.u44", 0xe0001, 0x10000, CRC(bdbb0785) SHA1(6512a8c2641e032ef6bb0889490d82f5d4399575),ROM_SKIP(1)) + + // TSI/Speech plus DSP firmware v3.12 8/9/88, NEC UPD77P20 + ROM_REGION( 0x600, "dspprgload", 0) // packed 24 bit data + ROM_LOAD( "v3.12__8-9-88__dsp_prog.u29", 0x0000, 0x0600, CRC(9e46425a) SHA1(80a915d731f5b6863aeeb448261149ff15e5b786)) + ROM_REGION( 0x800, "dspprg", ROMREGION_ERASEFF) // for unpacking 24 bit data into 32 bit data which cpu core can understand + ROM_REGION( 0x400, "dspdata", 0) + ROM_LOAD( "v3.12__8-9-88__dsp_data.u29", 0x0000, 0x0400, CRC(f4e4dd16) SHA1(6e184747db2f26e45d0e02907105ff192e51baba)) + + // mapping proms: + // All are am27s19 32x8 TriState PROMs (equivalent to 82s123/6331) + // L - always low; H - always high + // U77: unknown (what does this do? likely as to do with multibus and possibly waitstates?) + // input is A19 for I4, A18 for I3, A15 for I2, A13 for I1, A12 for I0 + // output bits 0bLLLLzyxH (TODO: recheck) + // bit - function + // 7, 6, 5, 4 - seem unconnected? + // 3 - connection unknown, low in the RAM, ROM, and Peripheral memory areas + // 2 - connection unknown, low in the RAM and ROM memory areas + // 1 - unknown, always high (TODO: recheck) + // 0 - unknown, always high + // + // U79: SRAM and peripheral mapping: + // input is A19 for I4, A18 for I3, A15 for I2, A13 for I1, A12 for I0, same as U77 + // On the Prose 2000 later board dumped, only bits 3 and 0 are used; + // bits 7-4 are always low, bits 2 and 1 are always high. + // SRAMS are only populated in U61 and U64. + // On the Prose 2000 earlier board dumped, bits 3,2,1,0 are all used; + // bits 7-4 are always low. sram is in 6 6116s, mapped the same as the 2 6264s on the later board. + // output bits 0bLLLL3210 + // 7,6,5,4 - seem unconnected? + // 3 - to /EN3 (pin 4) of 74S138N at U80 + // AND to EN1 (pin 6) of 74S138N at U78 + // i.e. one is activated when pin is high and other when pin is low + // The 74S138N at U80: [*ENABLED ONLY WITHIN/CONTROLS THE 3000-3FFF AREA*] + // /EN2 - pulled to GND + // EN1 - pulled to VCC through resistor R5 + // inputs: S0 - A9; S1 - A10; S2 - A11 + // /Y0 - /CS (pin 11) of iP8251A at U15 [0x3000-0x31FF] + // /Y1 - /CS (pin 1) of AMD 8259A at U4 [0x3200-0x33FF] + // /Y2 - pins 1, 4, 9 (1A, 2A, 3A inputs) of 74HCT32 Quad OR gate at U58 [0x3400-0x35FF] + // /Y3 - pin 26 (/CS) of UPD77P20 at U29 [0x3600-0x37FF] + // /Y4 through /Y7 - seem unconnected? [0x3800-0x3FFF] + // The 74S138N at U78: [*ENABLED IN ALL AREAS EXCEPT 3000-3FFF*] + // /EN3 - ? (TODO: figure these out) + // /EN2 - ? + // inputs: S0 - A18; S1 - A19; S2 - Pulled to GND + // /Y0 - ? + // /Y1 - ? + // /Y2 - ? + // /Y3 - connects somewhere, only active when A18 and A19 are high, possibly a rom bus buffer enable? (TODO: figure out what this does) + // /Y4-/Y7 - never used since S2 is pulled to GND + // 2 - to /CS1 on 6264 SRAMs at U63 and U66 + // 1 - to /CS1 on 6264 SRAMs at U62 and U65 + // 0 - to /CS1 on 6264 SRAMs at U61 and U64 + // + // U81: (OPTIONAL) maps ROMS: input is A19-A15 for I4,3,2,1,0 + // On the Prose 2000 board dumped, only bits 6 and 5 are used, + // the rest are always high; maps roms 0,1,2,3 to C0000-FFFFF. + // The Prose 2000 board has empty unpopulated sockets for roms 4-15; + // if present these would be driven by a different prom in this location. + // bit - function + // 7 - to /CE of ROMs 14(U28) and 15(U51) + // 6 - to /CE of ROMs 0(U21) and 1(U44) + // 5 - to /CE of ROMs 2(U22) and 3(U45) + // 4 - to /CE of ROMs 4(U23) and 5(U46) + // 3 - to /CE of ROMs 6(U24) and 7(U47) + // 2 - to /CE of ROMs 8(U25) and 9(U48) + // 1 - to /CE of ROMs 10(U26) and 11(U49) + // 0 - to /CE of ROMs 12(U27) and 13(U50) + // + // Note U81 is optional; it can be replaced by a 74s138 instead of a prom, + // with A19, A18, A17 as inputs, for decoding the roms as: + // 7 - to /CE of ROMs 0(U21) and 1(U44) (0xE0000-0xE3FFF) + // 6 - to /CE of ROMs 2(U22) and 3(U45) (0xE4000-0xE7FFF) + // 5 - to /CE of ROMs 4(U23) and 5(U46) (0xE8000-0xEBFFF) + // 4 - to /CE of ROMs 6(U24) and 7(U47) (0xEC000-0xEFFFF) + // 3 - to /CE of ROMs 8(U25) and 9(U48) (0xF0000-0xF3FFF) + // 2 - to /CE of ROMs 10(U26) and 11(U49) (0xF4000-0xF7FFF) + // 1 - to /CE of ROMs 12(U27) and 13(U50) (0xF8000-0xFBFFF) + // 0 - to /CE of ROMs 14(U28) and 15(U51) (0xFC000-0xFFFFF) + + ROM_REGION(0x1000, "proms", 0) + ROM_LOAD( "am27s19.u77", 0x0000, 0x0020, CRC(a88757fc) SHA1(9066d6dbc009d7a126d75b8461ca464ddf134412)) + ROM_LOAD( "am27s19.u79", 0x0020, 0x0020, CRC(a165b090) SHA1(bfc413c79915c68906033741318c070ad5dd0f6b)) + ROM_LOAD( "am27s19.u81", 0x0040, 0x0020, CRC(62e1019b) SHA1(acade372edb08fd0dcb1fa3af806c22c47081880)) + ROM_END + +ROM_START( prose2ko ) + // 'Older' prose2k set + ROM_REGION(0x100000,"maincpu", 0) + // prose 2000 firmware version 1.1 + ROMX_LOAD( "v1.1__6__speech__plus__(c)1983.am2764.6.u24", 0xec000, 0x2000, CRC(c881f92d) SHA1(2d4eb96360adac54d4f0110595bfaf682280c1ca),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__7__speech__plus__(c)1983.am2764.7.u47", 0xec001, 0x2000, CRC(4d5771cb) SHA1(55ed59ad1cad154804dbeeebed98f062783c33c3),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__8__speech__plus__(c)1983.am2764.8.u25", 0xf0000, 0x2000, CRC(adf9bfb8) SHA1(0b73561b52b388b740fabf07ada2d70a52f22037),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__9__speech__plus__(c)1983.am2764.9.u48", 0xf0001, 0x2000, CRC(355f97d2) SHA1(7655fc55b577821e0bd8bf81fb74b8a20b1df098),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__10__speech__plus__(c)1983.am2764.10.u26", 0xf4000, 0x2000, CRC(949a0344) SHA1(8e33c69dfc413aea95f166b08902ad97b1e3e980),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__11__speech__plus__(c)1983.am2764.11.u49", 0xf4001, 0x2000, CRC(ad9a0670) SHA1(769f2f8696c7b6907706466aa9ab7a897ed9f889),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__12__speech__plus__(c)1983.am2764.12.u27", 0xf8000, 0x2000, CRC(9eaf9378) SHA1(d296b1d347c03e6123c38c208ead25b1f43b9859),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__13__speech__plus__(c)1983.am2764.13.u50", 0xf8001, 0x2000, CRC(5e173667) SHA1(93230c2fede5095f56e10d20ea36a5a45a1e7356),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__14__speech__plus__(c)1983.am2764.14.u28", 0xfc000, 0x2000, CRC(e616bd6e) SHA1(5dfae2c5079d89f791c9d7166f9504231a464203),ROM_SKIP(1)) + ROMX_LOAD( "v1.1__15__speech__plus__(c)1983.am2764.15.u51", 0xfc001, 0x2000, CRC(beb1fa19) SHA1(72130fe45c3fd3de7cf794936dc68ed2d4193daf),ROM_SKIP(1)) + + // TSI/Speech plus DSP firmware v?.? (no sticker, but S140025 printed on chip), unlabeled chip, but clearly a NEC UPD7720C ceramic + // NOT DUMPED YET, using the 3.12 dsp firmware as a placeholder, since the dsp on the older board is MASK ROM and doesn't dump easily + ROM_REGION( 0x600, "dspprgload", 0) // packed 24 bit data + ROM_LOAD( "s140025__dsp_prog.u29", 0x0000, 0x0600, NO_DUMP) + ROM_LOAD( "v3.12__8-9-88__dsp_prog.u29", 0x0000, 0x0600, CRC(9e46425a) SHA1(80a915d731f5b6863aeeb448261149ff15e5b786)) // temp placeholder + ROM_REGION( 0x800, "dspprg", ROMREGION_ERASEFF) // for unpacking 24 bit data into 32 bit data which cpu core can understand + ROM_REGION( 0x400, "dspdata", 0) + ROM_LOAD( "s140025__dsp_data.u29", 0x0000, 0x0400, NO_DUMP) + ROM_LOAD( "v3.12__8-9-88__dsp_data.u29", 0x0000, 0x0400, CRC(f4e4dd16) SHA1(6e184747db2f26e45d0e02907105ff192e51baba)) // temp placeholder + + ROM_REGION(0x1000, "proms", 0) + ROM_LOAD( "dm74s288n.u77", 0x0000, 0x0020, CRC(a88757fc) SHA1(9066d6dbc009d7a126d75b8461ca464ddf134412)) // == am27s19.u77 + ROM_LOAD( "dm74s288n.whitespot.u79", 0x0020, 0x0020, CRC(7faee6cb) SHA1(b6dd2a6909dac9e89e7317c006a013ff0866382d)) + // no third prom in this set, a 74S138 is used instead for e0000-fffff rom mapping + ROM_END + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, prose2k, 0, 0, prose2k, prose2k, tsispch_state, prose2k, "Telesensory Systems Inc/Speech Plus", "Prose 2000/2020 v3.4.1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1985, prose2ko, prose2k, 0, prose2k, prose2k, tsispch_state, prose2k, "Telesensory Systems Inc/Speech Plus", "Prose 2000/2020 v1.1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/tutor.c b/src/mame/drivers/tutor.c new file mode 100644 index 00000000000..1978e64fdb0 --- /dev/null +++ b/src/mame/drivers/tutor.c @@ -0,0 +1,796 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + Experimental Tomy Tutor driver + + This computer is known as Tomy Tutor in US, and as Grandstand Tutor in UK. + It was initially released in Japan in 1982 or 1983 under the name of Pyuuta + (Pi-yu-u-ta, with a Kanji for the "ta"). The Japanese versions are + different from the English-language versions, as they have different ROMs + with Japanese messages and support for the katakana syllabus. There are at + least 4 versions: + * original Pyuuta (1982 or 1983) with title screens in Japanese but no + Basic + * Pyuuta Jr. (1983?) which is a console with a simplified keyboard + * Tomy/Grandstand Tutor (circa October 1983?) with title screens in English + and integrated Basic + * Pyuuta Mk. 2 (1984?) with a better-looking keyboard and integrated Basic + + The Tomy Tutor features a TMS9995 CPU @10.7MHz (which includes a + timer/counter and 256 bytes of 16-bit RAM), 48kb of ROM (32kb on early + models that did not have the BASIC interpreter), a tms9918a/9929a VDP (or + equivalent?) with 16kb of VRAM, and a sn76489an sound generator. + There is a tape interface, a 56-key keyboard, an interface for two + joysticks, a cartridge port and an extension port. The OS design does not + seem to be particularly expandable (I don't see any hook for additional + DSRs), but there were prototypes for a parallel port (emulated) + and a speech synthesizer unit (not emulated). + + + The Tutor appears to be related to Texas Instruments' TI99 series. + + The general architecture is relatively close to the ti99/4(a): arguably, + the Tutor does not include any GROM (it uses regular CPU ROMs for GPL + code), and its memory map is quite different due to the fact it was + designed with a tms9995 in mind (vs. a tms9985 for ti99/4), but, apart from + that, it has a similar architecture with only 256 bytes of CPU RAM and 16kb + of VRAM. + + While the OS is not derived directly from the TI99/4(a) OS, there are + disturbing similarities: the Japanese title screen is virtually identical + to the TI-99 title screen. Moreover, the Tutor BASIC seems to be be + derived from TI Extended BASIC, as both BASIC uses similar tokens and + syntax, and are partially written in GPL (there is therefore a GPL + interpreter in Tutor ROMs, although the Tutor GPL is incompatible with TI + GPL, does not seem to be used by any program other than Tutor Basic, and it + seems unlikely that the original Pyuuta had this GPL interpreter in ROMs). + + It appears that TI has sold the licence of the TI BASIC to Tomy, probably + after it terminated its TI99 series. It is not impossible that the entire + Tutor concept is derived from a TI project under licence: this machine + looks like a crossbreed of the TI99/2 and the TI99/4 (or /4a, /4b, /5), and + it could either have been an early version of the TI99/2 project with a + tms9918a/99289a VDP instead of the DMA video controller, or a "TI99/3" that + would have closed the gap between the extremely low-end TI99/2 and the + relatively mid-range TI99/5. + + + Raphael Nabet, 2003 + + +TODO : + * debug the tape interface (Saved tapes sound OK, both Verify and Load + recognize the tape as a Tomy tape, but the data seems to be corrupted and + we end with a read error.) + * guess which device is located at the >e600 base + * find info about other Tutor variants + + + Interrupts: + + Interrupt levels 1 (external interrupt 1) and 2 (error interrupt) do not + seem to be used: triggering these seems to cause a soft reset. XOPs are + not used at all: the ROM area where these vectors should be defined is used + by a ROM branch table. + + +Memory Map found at http://www.floodgap.com/retrobits/tomy/mmap.html + + *** $0000-$7FFF is the 32K BIOS *** + it is also possible to replace the BIOS with an external ROM (see $E000 range) + +0000 + reset vector (level 0) + 0000-0001: WP 0002-0003: PC (%) +0004 + level 1 and 2 IRQ vectors (%) + idem. These just seem to reset the system. +000C + additional vectors +0040 + XOP vectors (%) + The BIOS doesn't seem to use these for XOPs. + Instead, this is a branch table. +0080 + BIOS code + (CRU only: $1EE0-FE: 9995 flag register; + $1FDA: MID flag) +4000 + GBASIC + (on the American v2.3 firmware, the GPL + interpreter and VDP RAMLUT co-exist + with GBASIC in this range) + + *** $8000-$BFFF is the 16K option ROM area *** + +8000 + BASIC (Tutor only) and/or cartridge ROM + (controlled by $E100) + To be recognized, a cartridge must have a + $55, $66 or $aa header sequence. + + *** end ROM *** +C000 + unmapped (possible use in 24K cartridges) +E000 + I/O range + --------- + 9918A VDP data/register ports: $E000, E002 + "MMU" banking controls: $E100-E1FF + $E100 write: enable cartridge, disable + BIOS at $0000 (???) -- magic + required at $E110 for this + $E108 write: enable BASIC ROM, disable + cartridge at $8000 + $E10C write: enable cartridge, disable + BASIC ROM at $8000 + $E110 must be $42 to enable $E100 + and to replace the BIOS with + an installed cartridge ROM. + BLWP assumed at $0000 (??). + SN76489AN sound data port: $E200 + Device handshaking: $E600 + Unknown purpose, disk drive maybe? + Printer handshaking: $E800 + This is a standard Centronics port. + $E810 write: parallel data bus + $E820 read: parallel port busy + $E840 write: port handshake output + Keyboard lines: $EC00-$EC7E (*CRU*) + (CRU physical address $7600-$763F) + Cassette lines: $ED00-$EEFF + $ED00 (*CRU*): input level + (physical address $7680) + $EE00 write: tape output zero + $EE20 write: tape output one + $EE40 write: tape IRQ on + $EE60 write: tape IRQ off + $EE80, A0, C0, E0: ??? + +F000 + TMS9995 RAM (*) +F0FC + ?? +FFFA + decrementer (*) +FFFC + NMI vector (*) +FFFF + + + +PYUUTAJR +******** + +This is a handheld unit with 12 'chiclet' buttons. The keyboard has E800, EA00, EC00, EE00 scanned, +although 2 of these rows have no keys. TUTOR carts will run, however since most of them ask for +A=AMA, P=PRO, these keys don't exist, and so the games cannot be played. + +*********************************************************************************************************/ + +#include "emu.h" +#include "cpu/tms9900/tms9995.h" +#include "sound/wave.h" +#include "video/tms9928a.h" +#include "imagedev/cassette.h" +#include "sound/sn76496.h" +#include "bus/centronics/ctronics.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class tutor_state : public driver_device +{ +public: + tutor_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_cass(*this, "cassette"), + m_centronics(*this, "centronics"), + m_cent_data_out(*this, "cent_data_out"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank1_switching(0) + { + } + + required_device m_maincpu; + required_device m_cart; + optional_device m_cass; + optional_device m_centronics; + optional_device m_cent_data_out; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + memory_region *m_cart_rom; + + int m_bank1_switching; + DECLARE_READ8_MEMBER(key_r); + DECLARE_READ8_MEMBER(tutor_mapper_r); + DECLARE_WRITE8_MEMBER(tutor_mapper_w); + DECLARE_READ8_MEMBER(tutor_cassette_r); + DECLARE_WRITE8_MEMBER(tutor_cassette_w); + DECLARE_READ8_MEMBER(tutor_printer_r); + DECLARE_WRITE8_MEMBER(tutor_printer_w); + + DECLARE_READ8_MEMBER(tutor_highmem_r); + int m_tape_interrupt_enable; + emu_timer *m_tape_interrupt_timer; + virtual void machine_start(); + virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(tape_interrupt_handler); + + int m_centronics_busy; + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); +}; + + +void tutor_state::machine_start() +{ + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this)); + + m_bank1->configure_entry(0, memregion("maincpu")->base() + 0x4000); + m_bank1->set_entry(0); + m_bank2->configure_entry(0, memregion("maincpu")->base() + 0x8000); + m_bank2->set_entry(0); + + if (m_cart_rom) + { + if (m_cart_rom->bytes() > 0x4000) + { + m_bank1_switching = 1; + m_bank1->configure_entry(1, m_cart_rom->base()); + m_bank1->set_entry(1); + m_bank2->configure_entry(1, m_cart_rom->base() + 0x4000); + m_bank2->set_entry(1); + } + else + { + m_bank2->configure_entry(1, m_cart_rom->base()); + m_bank2->set_entry(1); + } + } +} + +void tutor_state::machine_reset() +{ + m_tape_interrupt_enable = 0; + m_centronics_busy = 0; + + // Enable auto wait states by lowering READY during reset + m_maincpu->set_ready(CLEAR_LINE); +} + +/* + Keyboard: + + Keyboard ports are located at CRU logical address >ec00->ec7e (CRU physical + address >7600->763f). There is one bit per key (bit >00 for keycode >00, + bit >01 for keycode >01, etc.), each bit is set to one when the key is + down. + + Joystick: + + Joystick ports seem to overlap keyboard ports, i.e. some CRU bits are + mapped to both a keyboard key and a joystick switch. +*/ + +READ8_MEMBER( tutor_state::key_r ) +{ + char port[12]; + UINT8 value; + + snprintf(port, ARRAY_LENGTH(port), "LINE%d", offset); + value = ioport(port)->read(); + + /* hack for ports overlapping with joystick */ + if (offset == 4 || offset == 5) + { + snprintf(port, ARRAY_LENGTH(port), "LINE%d_alt", offset); + value |= ioport(port)->read(); + } + + return value; +} + + +/* + Cartridge mapping: + + Cartridges share the >8000 address base with BASIC. A write to @>e10c + disables the BASIC ROM and enable the cartridge. A write to @>e108 + disables the cartridge and enables the BASIC ROM. + + In order to be recognized by the system ROM, a cartridge should start with + >55, >66 or >aa. This may may correspond to three different ROM header + versions (I am not sure). + + Cartridge may also define a boot ROM at base >0000 (see below). +*/ + +READ8_MEMBER( tutor_state::tutor_mapper_r ) +{ + int reply; + + switch (offset) + { + case 0x10: + /* return 0x42 if we have a cartridge with an alternate boot ROM */ + reply = 0; + break; + + default: + logerror("unknown port in %s %d\n", __FILE__, __LINE__); + reply = 0; + break; + } + + return reply; +} + +WRITE8_MEMBER( tutor_state::tutor_mapper_w ) +{ + switch (offset) + { + case 0x00: + /* disable system ROM, enable alternate boot ROM in cartridge */ + break; + + case 0x08: + /* disable cartridge ROM, enable BASIC ROM at base >8000 */ + m_bank1->set_entry(0); + m_bank2->set_entry(0); + break; + + case 0x0c: + /* enable cartridge ROM, disable BASIC ROM at base >8000 */ + if (m_cart_rom) + { + if (m_bank1_switching) + m_bank1->set_entry(1); + m_bank2->set_entry(1); + } + break; + + default: + if (!(offset & 1)) + logerror("unknown port in %s %d\n", __FILE__, __LINE__); + break; + } +} + +/* + This is only called from the debugger; the on-chip memory is handled + within the CPU itself. +*/ +READ8_MEMBER( tutor_state::tutor_highmem_r ) +{ + if (m_maincpu->is_onchip(offset | 0xf000)) return m_maincpu->debug_read_onchip_memory(offset&0xff); + return 0; +} + +/* + Cassette interface: + + The cassette interface uses several ports in the >e000 range. + + Writing to *CPU* address @>ee00 will set the tape output to 0. Writing to + *CPU* address @>ee20 will set the tape output to 1. + + Tape input level can be read from *CRU* logical address >ed00 (CRU physical + address >7680). + + Writing to @>ee40 enables tape interrupts; writing to @>ee60 disables tape + interrupts. Tape interrupts are level-4 interrupt that occur when the tape + input level is high(?). + + There are other output ports: @>ee80, @>eea0, @>eec0 & @>eee0. I don't + know their exact meaning. +*/ + +TIMER_CALLBACK_MEMBER(tutor_state::tape_interrupt_handler) +{ + //assert(m_tape_interrupt_enable); + m_maincpu->set_input_line(INT_9995_INT4, (m_cass->input() > 0.0) ? ASSERT_LINE : CLEAR_LINE); +} + +/* CRU handler */ +READ8_MEMBER( tutor_state::tutor_cassette_r ) +{ + return (m_cass->input() > 0.0) ? 1 : 0; +} + +/* memory handler */ +WRITE8_MEMBER( tutor_state::tutor_cassette_w ) +{ + if (offset & /*0x1f*/0x1e) + logerror("unknown port in %s %d\n", __FILE__, __LINE__); + + if ((offset & 0x1f) == 0) + { + data = BIT(offset, 5); + + switch ((offset >> 6) & 3) + { + case 0: + /* data out */ + m_cass->output((data) ? +1.0 : -1.0); + break; + case 1: + /* interrupt control??? */ + //logerror("ignoring write of %d to cassette port 1\n", data); + if (m_tape_interrupt_enable != data) + { + m_tape_interrupt_enable = data; + if (!m_tape_interrupt_enable) + m_tape_interrupt_timer->adjust(/*attotime::from_hz(44100)*/attotime::zero, 0, attotime::from_hz(44100)); + else + { + m_tape_interrupt_timer->adjust(attotime::never); + m_maincpu->set_input_line(INT_9995_INT4, CLEAR_LINE); + } + } + break; + case 2: + /* ??? */ + logerror("ignoring write of %d to cassette port 2\n", data); + break; + case 3: + /* ??? */ + logerror("ignoring write of %d to cassette port 3\n", data); + break; + } + } +} + +WRITE_LINE_MEMBER( tutor_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +/* memory handlers */ +READ8_MEMBER( tutor_state::tutor_printer_r ) +{ + int reply; + + switch (offset) + { + case 0x20: + /* busy */ + reply = m_centronics_busy ? 0x00 : 0xff; + break; + + default: + if (! (offset & 1)) + logerror("unknown port in %s %d\n", __FILE__, __LINE__); + reply = 0; + break; + } + + return reply; +} + +WRITE8_MEMBER( tutor_state::tutor_printer_w ) +{ + switch (offset) + { + case 0x10: + /* data */ + m_cent_data_out->write(space, 0, data); + break; + + case 0x40: + /* strobe */ + m_centronics->write_strobe(BIT(data, 7)); + break; + + default: + if (! (offset & 1)) + logerror("unknown port in %s %d\n", __FILE__, __LINE__); + break; + } +} + +/* + Memory map summary: + + @>0000-@>7fff: system ROM (can be paged out, see above). + @>8000-@>bfff: basic ROM (can be paged out, see above). + @>c000-@>dfff: free for future expansion? Used by 24kb cartridges? + + @>e000(r/w): VDP data + @>e002(r/w): VDP register + + @>e100(w): enable cart and disable system ROM at base >0000??? (the system will only link to such a ROM if @>e110 is >42???) + @>e108(w): disable cart and enable BASIC ROM at base >8000? + @>e10c(w): enable cart and disable BASIC ROM at base >8000? + @>e110(r): cartridges should return >42 if they have a ROM at base >0000 and they want the Tutor to boot from this ROM (with a blwp@>0000)??? + + @>e200(w): sound write + + @>e600(r): handshake in from whatever device??? + @>e610(w): ??? + @>e620(w): ??? + @>e680(w): handshake out to this device??? + + @>e810(w): parallel port data bus + @>e820(r): parallel port busy input + @>e840(w): parallel port strobe output + + @>ee00-@>eee0(w): tape interface (see above) + + @>f000-@>f0fb: tms9995 internal RAM 1 + @>fffa-@>fffb: tms9995 internal decrementer + @>f000-@>f0fb: tms9995 internal RAM 2 +*/ + +#ifdef UNUSED_FUNCTION +WRITE8_MEMBER( tutor_state::test_w ) +{ + switch (offset) + { + default: + logerror("unmapped write %d %d\n", offset, data); + break; + } +} +#endif + +static ADDRESS_MAP_START(tutor_memmap, AS_PROGRAM, 8, tutor_state) + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") AM_WRITENOP + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") AM_WRITENOP + AM_RANGE(0xc000, 0xdfff) AM_NOP /*free for expansion, or cartridge ROM?*/ + + AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) /*VDP data*/ + AM_RANGE(0xe002, 0xe002) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)/*VDP status*/ + AM_RANGE(0xe100, 0xe1ff) AM_READWRITE(tutor_mapper_r, tutor_mapper_w) /*cartridge mapper*/ + AM_RANGE(0xe200, 0xe200) AM_DEVWRITE("sn76489a", sn76489a_device, write) /*sound chip*/ + AM_RANGE(0xe800, 0xe8ff) AM_READWRITE(tutor_printer_r, tutor_printer_w) /*printer*/ + AM_RANGE(0xee00, 0xeeff) AM_READNOP AM_WRITE( tutor_cassette_w) /*cassette interface*/ + + AM_RANGE(0xf000, 0xffff) AM_READ(tutor_highmem_r) AM_WRITENOP /*free for expansion (and internal processor RAM)*/ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(pyuutajr_mem, AS_PROGRAM, 8, tutor_state) + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") AM_WRITENOP + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") AM_WRITENOP + AM_RANGE(0xc000, 0xdfff) AM_NOP /*free for expansion, or cartridge ROM?*/ + + AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) /*VDP data*/ + AM_RANGE(0xe002, 0xe002) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)/*VDP status*/ + AM_RANGE(0xe100, 0xe1ff) AM_READWRITE(tutor_mapper_r, tutor_mapper_w) /*cartridge mapper*/ + AM_RANGE(0xe200, 0xe200) AM_DEVWRITE("sn76489a", sn76489a_device, write) /*sound chip*/ + AM_RANGE(0xe800, 0xe800) AM_READ_PORT("LINE0") + AM_RANGE(0xea00, 0xea00) AM_READ_PORT("LINE1") + AM_RANGE(0xec00, 0xec00) AM_READ_PORT("LINE2") + AM_RANGE(0xee00, 0xee00) AM_READ_PORT("LINE3") + + AM_RANGE(0xf000, 0xffff) AM_READ(tutor_highmem_r) AM_WRITENOP /*free for expansion (and internal processor RAM)*/ +ADDRESS_MAP_END + +/* + CRU map summary: + + >1ee0->1efe: tms9995 flag register + >1fda: tms9995 MID flag + + >ec00->ec7e(r): keyboard interface + >ed00(r): tape input +*/ + +static ADDRESS_MAP_START(tutor_io, AS_IO, 8, tutor_state) + AM_RANGE(0xec0, 0xec7) AM_READ(key_r) /*keyboard interface*/ + AM_RANGE(0xed0, 0xed0) AM_READ(tutor_cassette_r) /*cassette interface*/ +ADDRESS_MAP_END + +/* tutor keyboard: 56 keys + +2008-05 FP: +Small note about natural keyboard support: currently, +- "MON" is mapped to 'F1' +- "MOD" is mapped to 'F2' +- A, S, D, F, G, R seem to have problems in natural mode +*/ + +static INPUT_PORTS_START(tutor) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- b") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("LINE4_alt") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_CODE(KEYCODE_6_PAD) + + PORT_START("LINE5") + /* Unused? */ + PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("o ^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('_') PORT_CHAR('@') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') // this one is 4th line, 4th key after 'M' + + PORT_START("LINE5_alt") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + + PORT_START("LINE6") + /* Unused? */ + PORT_BIT(0x21, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + /* only one shift key located on the left, but we support both for emulation to be friendlier */ + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mon") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mod") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + /* Unused? */ + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +// Unit only has 12 buttons. LINE0 & 3 are scanned with the others, but have nothing connected? +static INPUT_PORTS_START(pyuutajr) + PORT_START("LINE0") + PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PALLET") PORT_CODE(KEYCODE_P) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_M) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MONITOR") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + + PORT_START("LINE3") + PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tutor, tutor_state ) + // basic machine hardware + // TMS9995 CPU @ 10.7 MHz + // No lines connected yet + MCFG_TMS99xx_ADD("maincpu", TMS9995, XTAL_10_738635MHz, tutor_memmap, tutor_io) + + /* video hardware */ + MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) + MCFG_TMS9928A_VRAM_SIZE(0x4000) + MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) + MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) + + /* sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("sn76489a", SN76489A, 3579545) /* 3.579545 MHz */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(tutor_state, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_CASSETTE_ADD( "cassette" ) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "tutor_cart") + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","tutor") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pyuutajr, tutor ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(pyuutajr_mem) + //MCFG_DEVICE_REMOVE("centronics") + //MCFG_DEVICE_REMOVE("cassette") +MACHINE_CONFIG_END + +/* + ROM loading +*/ + +ROM_START(tutor) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("tutor1.bin", 0x0000, 0x8000, CRC(702c38ba) SHA1(ce60607c3038895e31915d41bb5cf71cb8522d7a)) /* system ROM */ + ROM_LOAD("tutor2.bin", 0x8000, 0x4000, CRC(05f228f5) SHA1(46a14a45f6f9e2c30663a2b87ce60c42768a78d0)) /* BASIC ROM */ +ROM_END + + +ROM_START(pyuuta) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("tomy29.7", 0x0000, 0x8000, CRC(7553bb6a) SHA1(fa41c45cb6d3daf7435f2a82f77dfa286003255e)) /* system ROM */ +ROM_END + +ROM_START(pyuutajr) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD( "ipl.rom", 0x0000, 0x4000, CRC(2ca37e62) SHA1(eebdc5c37d3b532edd5e5ca65eb785269ebd1ac0)) /* system ROM */ +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP(1983?, tutor, 0, 0, tutor, tutor, driver_device, 0, "Tomy", "Tomy Tutor" , 0) +COMP(1982, pyuuta, tutor, 0, tutor, tutor, driver_device, 0, "Tomy", "Tomy Pyuuta" , 0) +COMP(1983, pyuutajr, tutor, 0, pyuutajr, pyuutajr, driver_device, 0, "Tomy", "Tomy Pyuuta Jr." , 0) diff --git a/src/mame/drivers/tv950.c b/src/mame/drivers/tv950.c new file mode 100644 index 00000000000..eeddfa630e9 --- /dev/null +++ b/src/mame/drivers/tv950.c @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + 2013-09-10 Skeleton driver for Televideo TV950 + + TODO: + - Everything - this is just a skeleton + + Seems there should be a few more roms. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" + + +class tv950_state : public driver_device +{ +public: + tv950_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + +private: + virtual void machine_reset(); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(tv950_mem, AS_PROGRAM, 8, tv950_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(tv950_io, AS_IO, 8, tv950_state) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( tv950 ) +INPUT_PORTS_END + + +void tv950_state::machine_reset() +{ +} + +static MACHINE_CONFIG_START( tv950, tv950_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6502, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(tv950_mem) + MCFG_CPU_IO_MAP(tv950_io) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( tv950 ) + ROM_REGION(0x10000, "maincpu", 0) + ROM_SYSTEM_BIOS( 0, "8000043", "8000043") + ROMX_LOAD( "tv-043h.rom", 0xf000, 0x1000, CRC(89b826be) SHA1(fd5575be04317682d0c9062702b5932b46f89926), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "8000044", "8000044") + ROMX_LOAD( "tv-044h.rom", 0xf000, 0x1000, CRC(24b0383d) SHA1(71cabb7f3da8652a36afdf3d505ab8a41651e801), ROM_BIOS(2) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, tv950, 0, 0, tv950, tv950, driver_device, 0, "Televideo", "TV950", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/tvc.c b/src/mame/drivers/tvc.c new file mode 100644 index 00000000000..7199ef354e8 --- /dev/null +++ b/src/mame/drivers/tvc.c @@ -0,0 +1,876 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic,Sandro Ronco +/*************************************************************************** + + Videoton TVC 32/64 driver + + 12/05/2009 Skeleton driver. + + TODO: + - UPM crashes when formatting a floppy + - overscan and mid-frame changes + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "machine/ram.h" +#include "audio/tvc_snd.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "formats/tvc_cas.h" + +#include "bus/tvc/tvc.h" +#include "bus/tvc/hbf.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define TVC_RAM_BANK 1 +#define TVC_ROM_BANK 2 + +#define CENTRONICS_TAG "centronics" + + +class tvc_state : public driver_device +{ +public: + tvc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_sound(*this, "custom"), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_centronics(*this, CENTRONICS_TAG), + m_palette(*this, "palette"), + m_keyboard(*this, "LINE") + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_sound; + required_device m_cassette; + required_device m_cart; + required_device m_centronics; + required_device m_palette; + required_ioport_array<16> m_keyboard; + + tvcexp_slot_device *m_expansions[4]; + memory_region *m_bios_rom; + memory_region *m_cart_rom; + memory_region *m_ext; + memory_region *m_vram; + + void machine_start(); + void machine_reset(); + + void set_mem_page(UINT8 data); + DECLARE_WRITE8_MEMBER(bank_w); + DECLARE_WRITE8_MEMBER(vram_bank_w); + DECLARE_WRITE8_MEMBER(palette_w); + DECLARE_WRITE8_MEMBER(keyboard_w); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_READ8_MEMBER(int_state_r); + DECLARE_WRITE8_MEMBER(flipflop_w); + DECLARE_WRITE8_MEMBER(border_color_w); + DECLARE_WRITE8_MEMBER(sound_w); + DECLARE_WRITE8_MEMBER(cassette_w); + DECLARE_READ8_MEMBER(_5b_r); + DECLARE_WRITE_LINE_MEMBER(int_ff_set); + DECLARE_WRITE_LINE_MEMBER(centronics_ack); + + // expansions + DECLARE_WRITE8_MEMBER(expansion_w); + DECLARE_READ8_MEMBER(expansion_r); + DECLARE_READ8_MEMBER(exp_id_r); + DECLARE_WRITE8_MEMBER(expint_ack_w); + + DECLARE_QUICKLOAD_LOAD_MEMBER( tvc64); + + MC6845_UPDATE_ROW(crtc_update_row); + + UINT8 m_video_mode; + UINT8 m_keyline; + UINT8 m_active_slot; + UINT8 m_int_flipflop; + UINT8 m_col[4]; + UINT8 m_bank_type[4]; + UINT8 m_bank; + UINT8 m_vram_bank; + UINT8 m_cassette_ff; + UINT8 m_centronics_ff; + DECLARE_PALETTE_INIT(tvc); +}; + + + +#define TVC_INSTALL_ROM_BANK(_bank,_tag,_start,_end) \ + if (m_bank_type[_bank] != TVC_ROM_BANK) \ + { \ + space.install_read_bank(_start, _end, _tag); \ + space.unmap_write(_start, _end); \ + m_bank_type[_bank] = TVC_ROM_BANK; \ + } +#define TVC_INSTALL_RAM_BANK(_bank,_tag,_start,_end) \ + if (m_bank_type[_bank] != TVC_RAM_BANK) \ + { \ + space.install_readwrite_bank(_start, _end, _tag); \ + m_bank_type[_bank] = TVC_RAM_BANK; \ + } + +void tvc_state::set_mem_page(UINT8 data) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + switch (data & 0x18) + { + case 0x00 : // system ROM selected + TVC_INSTALL_ROM_BANK(0, "bank1", 0x0000, 0x3fff); + membank("bank1")->set_base(m_bios_rom->base()); + break; + case 0x08 : // Cart ROM selected + if (m_cart_rom) + { + TVC_INSTALL_ROM_BANK(0, "bank1", 0x0000, 0x3fff); + membank("bank1")->set_base(m_cart_rom->base()); + } + break; + case 0x10 : // RAM selected + TVC_INSTALL_RAM_BANK(0, "bank1", 0x0000, 0x3fff); + membank("bank1")->set_base(m_ram->pointer()); + break; + case 0x18 : // Video RAM + if (m_vram->bytes() > 0x4000) + { + // TVC 64+ only + TVC_INSTALL_RAM_BANK(0, "bank1", 0x0000, 0x3fff); + membank("bank1")->set_base(m_vram->base() + ((m_vram_bank & 0x03)<<14)); + } + else + { + space.unmap_readwrite(0x0000, 0x3fff); + m_bank_type[0] = -1; + } + break; + } + + if ((data & 0x20)==0) // Video RAM + { + TVC_INSTALL_RAM_BANK(2, "bank3", 0x8000, 0xbfff); + membank("bank3")->set_base(m_vram->base() + ((m_vram_bank & 0x0c)<<12)); + } + else // System RAM page 3 + { + if (m_ram->size() > 0x8000) + { + TVC_INSTALL_RAM_BANK(2, "bank3", 0x8000, 0xbfff); + membank("bank3")->set_base(m_ram->pointer() + 0x8000); + } + else + { + space.unmap_readwrite(0x8000, 0xbfff); + m_bank_type[2] = -1; + } + } + + switch(data & 0xc0) + { + case 0x00 : // Cart ROM selected + if (m_cart_rom) + { + TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff); + membank("bank4")->set_base(m_cart_rom->base()); + } + break; + case 0x40 : // System ROM selected + TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff); + membank("bank4")->set_base(m_bios_rom->base()); + break; + case 0x80 : // RAM selected + if (m_ram->size() > 0x8000) + { + TVC_INSTALL_RAM_BANK(3, "bank4", 0xc000, 0xffff); + membank("bank4")->set_base(m_ram->pointer() + 0xc000); + } + else + { + space.unmap_readwrite(0xc000, 0xffff); + m_bank_type[3] = -1; + } + break; + case 0xc0 : // External ROM selected + TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff); + membank("bank4")->set_base(m_ext->base()); + space.install_readwrite_handler (0xc000, 0xdfff, 0, 0, read8_delegate(FUNC(tvc_state::expansion_r), this), write8_delegate(FUNC(tvc_state::expansion_w), this), 0); + m_bank_type[3] = -1; + break; + } +} + + +WRITE8_MEMBER(tvc_state::expansion_w) +{ + m_expansions[m_active_slot & 3]->write(space, offset, data); +} + + +READ8_MEMBER(tvc_state::expansion_r) +{ + return m_expansions[m_active_slot & 3]->read(space, offset); +} + +WRITE8_MEMBER(tvc_state::bank_w) +{ + m_bank = data; + set_mem_page(data); +} + +WRITE8_MEMBER(tvc_state::vram_bank_w) +{ + // TVC 64+ only + if (m_vram->bytes() > 0x4000) + { + // bit 4-5 - screen video RAM + // bit 2-3 - video RAM active in bank 3 + // bit 0-1 - video RAM active in bank 1 + + m_vram_bank = data; + set_mem_page(m_bank); + } +} + +WRITE8_MEMBER(tvc_state::palette_w) +{ + // 0 I 0 G | 0 R 0 B + // 0 0 0 0 | I G R B + int i = ((data&0x40)>>3) | ((data&0x10)>>2) | ((data&0x04)>>1) | (data&0x01); + + m_col[offset] = i; +} + +WRITE8_MEMBER(tvc_state::keyboard_w) +{ + // bit 6-7 - expansion select + // bit 0-3 - keyboard scan + + m_keyline = data & 0x0f; + m_active_slot = (data>>6) & 0x03; +} + +READ8_MEMBER(tvc_state::keyboard_r) +{ + return m_keyboard[m_keyline & 0x0f]->read(); +} + +READ8_MEMBER(tvc_state::int_state_r) +{ + /* + x--- ---- centronics ACK flipflop + -x-- ---- colour + --x- ---- cassette input + ---x ---- vblank or tone interrupt + ---- xxxx expansions interrupt (active low) + */ + + double level = m_cassette->input(); + + UINT8 expint = (m_expansions[0]->int_r()<<0) | (m_expansions[1]->int_r()<<1) | + (m_expansions[2]->int_r()<<2) | (m_expansions[3]->int_r()<<3); + + return 0x40 | (m_int_flipflop << 4) | (level > 0.01 ? 0x20 : 0x00) | (m_centronics_ff << 7) | (expint & 0x0f); +} + +WRITE8_MEMBER(tvc_state::flipflop_w) +{ + // every write here clears the vblank flipflop + m_int_flipflop = 1; + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +READ8_MEMBER(tvc_state::exp_id_r) +{ + // expansion slots ID + return (m_expansions[0]->id_r()<<0) | (m_expansions[1]->id_r()<<2) | + (m_expansions[2]->id_r()<<4) | (m_expansions[3]->id_r()<<6); +} + +WRITE8_MEMBER(tvc_state::expint_ack_w) +{ + m_expansions[offset & 3]->int_ack(); +} + +WRITE8_MEMBER(tvc_state::border_color_w) +{ + // x-x- x-x- border color (I G R B) +} + + +WRITE8_MEMBER(tvc_state::sound_w) +{ + switch(offset) + { + case 1: + // bit 6-7 - cassette motors + m_cassette->change_state(BIT(data, 6) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + //m_cassette2->change_state(BIT(data, 7) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_cassette->output(m_cassette_ff ? +1 : -1); + break; + case 2: + // bit 0-1 - video mode + // bit 7 - centronics STROBE + m_video_mode = data & 0x03; + m_centronics->write_strobe(BIT(data, 7)); + if (!BIT(data, 7)) + m_centronics_ff = 0; + break; + } + + // sound ports + m_sound->write(space, offset, data); +} + +READ8_MEMBER(tvc_state::_5b_r) +{ + m_sound->reset_divider(); + return 0xff; +} + +WRITE8_MEMBER(tvc_state::cassette_w) +{ + // writig here cause the toggle of the cassette flipflop + m_cassette_ff = !m_cassette_ff; + m_cassette->output(m_cassette_ff ? +1 : -1); +} + +static ADDRESS_MAP_START(tvc_mem, AS_PROGRAM, 8, tvc_state ) + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tvc_io , AS_IO, 8, tvc_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_WRITE(border_color_w) + AM_RANGE(0x01, 0x01) AM_DEVWRITE("cent_data_out", output_latch_device, write) + AM_RANGE(0x02, 0x02) AM_WRITE(bank_w) + AM_RANGE(0x03, 0x03) AM_WRITE(keyboard_w) + AM_RANGE(0x04, 0x06) AM_WRITE(sound_w) + AM_RANGE(0x07, 0x07) AM_WRITE(flipflop_w) + AM_RANGE(0x0f, 0x0f) AM_WRITE(vram_bank_w) + AM_RANGE(0x10, 0x1f) AM_DEVREADWRITE("exp1", tvcexp_slot_device, io_read, io_write) + AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("exp2", tvcexp_slot_device, io_read, io_write) + AM_RANGE(0x30, 0x3f) AM_DEVREADWRITE("exp3", tvcexp_slot_device, io_read, io_write) + AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("exp4", tvcexp_slot_device, io_read, io_write) + AM_RANGE(0x50, 0x50) AM_WRITE(cassette_w) + AM_RANGE(0x58, 0x58) AM_READ(keyboard_r) + AM_RANGE(0x59, 0x59) AM_READ(int_state_r) + AM_RANGE(0x5a, 0x5a) AM_READ(exp_id_r) + AM_RANGE(0x5b, 0x5b) AM_READ(_5b_r) + AM_RANGE(0x58, 0x5b) AM_WRITE(expint_ack_w) + AM_RANGE(0x60, 0x63) AM_WRITE(palette_w) + AM_RANGE(0x70, 0x70) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0x71, 0x71) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( tvc ) + PORT_START("LINE.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('+') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('&') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('/') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\x8d") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(0x00cd) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('\'') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('!') + + PORT_START("LINE.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('^') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xbc") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(0x00fc) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(0x00f3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb6") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(0x00f6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('=') + + PORT_START("LINE.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_HOME) PORT_CHAR('@') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + + PORT_START("LINE.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc5\x91") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(0x0151) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xba") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(0x00fa) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + + PORT_START("LINE.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_END) PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + + PORT_START("LINE.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa1") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(0x00e1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc5\xb1") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(0x0171) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(0x00e9) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START("LINE.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("LINE.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("LINE.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fire") PORT_CODE(KEYCODE_PGUP) //PORT_CHAR(UCHAR_MAMEKEY()) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Acc") PORT_CODE(KEYCODE_PGDN) //PORT_CHAR(UCHAR_MAMEKEY()) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.9") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.10") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.11") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.12") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.13") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.14") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.15") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( tvc64pru ) + PORT_START("LINE.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x0436) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DL") PORT_CODE(KEYCODE_HOME) // delete line + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DC") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START("LINE.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("IL") PORT_CODE(KEYCODE_END) // insert line + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + + PORT_START("LINE.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("LINE.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("LINE.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START("LINE.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("LINE.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('^') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("LINE.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('@') PORT_CHAR('\'') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("LINE.8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Up") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Down") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Fire") PORT_CODE(KEYCODE_PGUP) //PORT_CHAR(UCHAR_MAMEKEY()) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Acc") PORT_CODE(KEYCODE_PGDN) //PORT_CHAR(UCHAR_MAMEKEY()) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Right") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Left") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("LINE.9") + PORT_BIT(0x7f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_START("LINE.10") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.11") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.12") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.13") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.14") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE.15") + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +void tvc_state::machine_start() +{ + for (int i = 0; i < 4; i++) + m_col[i] = i; + + m_int_flipflop = 0; + + m_expansions[0] = machine().device("exp1"); + m_expansions[1] = machine().device("exp2"); + m_expansions[2] = machine().device("exp3"); + m_expansions[3] = machine().device("exp4"); + + m_bios_rom = memregion("sys"); + m_ext = memregion("ext"); + m_vram = memregion("vram"); + + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); +} + +void tvc_state::machine_reset() +{ + memset(m_ram->pointer(), 0, m_ram->size()); + set_mem_page(0); + m_video_mode = 0; + m_cassette_ff = 1; + m_centronics_ff = 1; + m_bank = 0; + m_vram_bank = 0; + memset(m_bank_type, 0, sizeof(m_bank_type)); + m_active_slot = 0; + + // Bank 2 is always RAM + membank("bank2")->set_base(m_ram->pointer() + 0x4000); +} + +MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + UINT8 *vram = m_vram->base() + ((m_vram_bank & 0x30)<<10); + UINT16 offset = ((ma*4 + ra*0x40) & 0x3fff); + int i; + + switch(m_video_mode) { + case 0 : + // 2 colors mode + for ( i = 0; i < x_count; i++ ) + { + UINT8 data = vram[offset + i]; + *p++ = palette[m_col[BIT(data,7)]]; + *p++ = palette[m_col[BIT(data,6)]]; + *p++ = palette[m_col[BIT(data,5)]]; + *p++ = palette[m_col[BIT(data,4)]]; + *p++ = palette[m_col[BIT(data,3)]]; + *p++ = palette[m_col[BIT(data,2)]]; + *p++ = palette[m_col[BIT(data,1)]]; + *p++ = palette[m_col[BIT(data,0)]]; + } + break; + case 1 : + // 4 colors mode + // a0 b0 c0 d0 a1 b1 c1 d1 + for ( i = 0; i < x_count; i++ ) + { + UINT8 data = vram[offset + i]; + *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; + *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; + *p++ = palette[m_col[BIT(data,2)*2 + BIT(data,6)]]; + *p++ = palette[m_col[BIT(data,2)*2 + BIT(data,6)]]; + *p++ = palette[m_col[BIT(data,1)*2 + BIT(data,5)]]; + *p++ = palette[m_col[BIT(data,1)*2 + BIT(data,5)]]; + *p++ = palette[m_col[BIT(data,0)*2 + BIT(data,4)]]; + *p++ = palette[m_col[BIT(data,0)*2 + BIT(data,4)]]; + } + break; + default: + // 16 colors mode + // IIGG RRBB + for ( i = 0; i < x_count; i++ ) + { + UINT8 data = vram[offset + i]; + UINT8 col0 = ((data & 0x80)>>4) | ((data & 0x20)>>3) | ((data & 0x08)>>2) | ((data & 0x02)>>1); + UINT8 col1 = ((data & 0x40)>>3) | ((data & 0x10)>>2) | ((data & 0x04)>>1) | (data & 0x01); + *p++ = palette[col0]; + *p++ = palette[col0]; + *p++ = palette[col0]; + *p++ = palette[col0]; + *p++ = palette[col1]; + *p++ = palette[col1]; + *p++ = palette[col1]; + *p++ = palette[col1]; + } + break; + + } +} + +PALETTE_INIT_MEMBER(tvc_state, tvc) +{ + const static unsigned char tvc_palette[16][3] = + { + { 0x00,0x00,0x00 }, + { 0x00,0x00,0x7f }, + { 0x7f,0x00,0x00 }, + { 0x7f,0x00,0x7f }, + { 0x00,0x7f,0x00 }, + { 0x00,0x7f,0x7f }, + { 0x7f,0x7f,0x00 }, + { 0x7f,0x7f,0x7f }, + { 0x00,0x00,0x00 }, + { 0x00,0x00,0xff }, + { 0xff,0x00,0x00 }, + { 0xff,0x00,0xff }, + { 0x00,0xff,0x00 }, + { 0x00,0xff,0xff }, + { 0xff,0xff,0x00 }, + { 0xff,0xff,0xff } + }; + int i; + + for(i = 0; i < 16; i++) + palette.set_pen_color(i, tvc_palette[i][0], tvc_palette[i][1], tvc_palette[i][2]); +} + +WRITE_LINE_MEMBER(tvc_state::int_ff_set) +{ + if (state) + { + m_int_flipflop = 0; + m_maincpu->set_input_line(0, ASSERT_LINE); + } +} + +WRITE_LINE_MEMBER(tvc_state::centronics_ack) +{ + if (state) + m_centronics_ff = 1; +} + +QUICKLOAD_LOAD_MEMBER( tvc_state, tvc64) +{ + UINT8 first_byte; + + image.fread(&first_byte, 1); + if (first_byte == 0x11) + { + image.fseek(0x90, SEEK_SET); + image.fread(m_ram->pointer() + 0x19ef, image.length() - 0x90); + return IMAGE_INIT_PASS; + } + else + { + return IMAGE_INIT_FAIL; + } +} + + +extern SLOT_INTERFACE_START(tvc_exp) + SLOT_INTERFACE("hbf", TVC_HBF) // Videoton HBF floppy interface +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( tvc, tvc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, 3125000) + MCFG_CPU_PROGRAM_MAP(tvc_mem) + MCFG_CPU_IO_MAP(tvc_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(512, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 512 - 1, 0, 240 - 1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + + MCFG_PALETTE_ADD( "palette", 16 ) + MCFG_PALETTE_INIT_OWNER(tvc_state, tvc) + + MCFG_MC6845_ADD("crtc", MC6845, "screen", 3125000/2) // clk taken from schematics + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) /*?*/ + MCFG_MC6845_UPDATE_ROW_CB(tvc_state, crtc_update_row) + MCFG_MC6845_OUT_CUR_CB(WRITELINE(tvc_state, int_ff_set)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("32K") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("custom", TVC_SOUND, 0) + MCFG_TVC_SOUND_SNDINT_CALLBACK(WRITELINE(tvc_state, int_ff_set)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(tvc_state, centronics_ack)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "tvc_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom,crt") + + /* expansion interface */ + MCFG_DEVICE_ADD("exp1", TVCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) + MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_DEVICE_ADD("exp2", TVCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) + MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_DEVICE_ADD("exp3", TVCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) + MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_DEVICE_ADD("exp4", TVCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) + MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + + /* cassette */ + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(tvc64_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED) + MCFG_CASSETTE_INTERFACE("tvc_cass") + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", tvc_state, tvc64, "cas", 6) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "tvc_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "tvc_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "tvc_flop") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( tvc64 ) + ROM_REGION( 0x4000, "sys", ROMREGION_ERASEFF ) + ROM_LOAD( "tvc12_d4.64k", 0x0000, 0x2000, CRC(834ca9be) SHA1(c333318c1c6185aae2d3dfb86d55e3a4a3071a73)) + ROM_LOAD( "tvc12_d3.64k", 0x2000, 0x2000, CRC(71753d02) SHA1(d9a1905cf55c532b3380c83158fb5254ee503829)) + + ROM_REGION( 0x4000, "ext", ROMREGION_ERASEFF ) + ROM_LOAD( "tvc12_d7.64k", 0x2000, 0x2000, CRC(1cbbeac6) SHA1(54b29c9ca9942f04620fbf3edab3b8e3cd21c194)) + + ROM_REGION( 0x4000, "vram", ROMREGION_ERASE ) +ROM_END + +ROM_START( tvc64p ) + ROM_REGION( 0x4000, "sys", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v22", "v2.2") + ROMX_LOAD( "tvc22_d6.64k", 0x0000, 0x2000, CRC(05ac3a34) SHA1(bdc7eda5fd53f806dca8c4929ee498e8e59eb787), ROM_BIOS(1) ) + ROMX_LOAD( "tvc22_d4.64k", 0x2000, 0x2000, CRC(ba6ad589) SHA1(e5c8a6db506836a327d901387a8dc8c681a272db), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v21", "v2.1") + ROMX_LOAD( "tvc21_d6.64k", 0x0000, 0x2000, CRC(f197ffce) SHA1(7b27a91504dd864170451949ada5f938d6532cae), ROM_BIOS(2) ) + ROMX_LOAD( "tvc21_d4.64k", 0x2000, 0x2000, CRC(b054c0b2) SHA1(c8ca8d5a4d092604de01e2cafc2a2dabe94e6380), ROM_BIOS(2) ) + + ROM_REGION( 0x4000, "ext", ROMREGION_ERASEFF ) + ROM_LOAD( "tvc22_d7.64k", 0x2000, 0x2000, CRC(05e1c3a8) SHA1(abf119cf947ea32defd08b29a8a25d75f6bd4987)) + + ROM_REGION( 0x10000, "vram", ROMREGION_ERASE ) +ROM_END + +ROM_START( tvc64pru ) + ROM_REGION( 0x4000, "sys", ROMREGION_ERASEFF ) + ROM_LOAD( "tvcru_d6.bin", 0x0000, 0x2000, CRC(1e0fa0b8) SHA1(9bebb6c8f03f9641bd35c9fd45ffc13a48e5c572)) + ROM_LOAD( "tvcru_d4.bin", 0x2000, 0x2000, CRC(bac5dd4f) SHA1(665a1b8c80b6ad82090803621f0c73ef9243c7d4)) + + ROM_REGION( 0x4000, "ext", ROMREGION_ERASEFF ) + ROM_LOAD( "tvcru_d7.bin", 0x2000, 0x2000, CRC(70cde756) SHA1(c49662af9f6653347ead641e85777c3463cc161b)) + + ROM_REGION( 0x10000, "vram", ROMREGION_ERASE ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, tvc64, 0, 0, tvc, tvc, driver_device, 0, "Videoton", "TVC 64", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1985, tvc64p, tvc64, 0, tvc, tvc, driver_device, 0, "Videoton", "TVC 64+", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1985, tvc64pru, tvc64, 0, tvc, tvc64pru, driver_device, 0, "Videoton", "TVC 64+ (Russian)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/tvgame.c b/src/mame/drivers/tvgame.c new file mode 100644 index 00000000000..44ede341caf --- /dev/null +++ b/src/mame/drivers/tvgame.c @@ -0,0 +1,133 @@ +// license:BSD-3-Clause +// copyright-holders: Robbbert +/*************************************************************************** + + Homebrew Z80-based TV Game computer by Mr. Isizu + + http://w01.tp1.jp/~a571632211/z80tvgame/index.html + + 2015-06-12 Driver by Robbbert + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "sound/speaker.h" + + +class tvgame_state : public driver_device +{ +public: + tvgame_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_speaker(*this, "speaker") + , m_p_videoram(*this, "videoram") + { } + + DECLARE_WRITE8_MEMBER(speaker_w); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +private: + required_device m_maincpu; + required_device m_speaker; + required_shared_ptr m_p_videoram; +}; + +static ADDRESS_MAP_START( tvgame_mem, AS_PROGRAM, 8, tvgame_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x7fff ) AM_ROM + AM_RANGE( 0x8000, 0xbfff ) AM_RAM + AM_RANGE( 0xc000, 0xdfff ) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tvgame_io, AS_IO, 8, tvgame_state ) + ADDRESS_MAP_GLOBAL_MASK(3) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x0003) AM_DEVREADWRITE("ppi", i8255_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( tvgame ) + PORT_START("LINE0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +WRITE8_MEMBER( tvgame_state::speaker_w ) +{ + m_speaker->level_w(BIT(data, 0)); +} + +UINT32 tvgame_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,gfx; + UINT16 sy=0,ma=241,x; + + for (y = 0; y < 213; y++) + { + UINT16 *p = &bitmap.pix16(sy++); + for (x = ma; x < ma+27; x++) + { + gfx = m_p_videoram[x]; + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 0); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 7); + } + ma+=30; + } + return 0; +} + +static MACHINE_CONFIG_START( tvgame, tvgame_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(tvgame_mem) + MCFG_CPU_IO_MAP(tvgame_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(tvgame_state, screen_update) + MCFG_SCREEN_SIZE(216, 213) + MCFG_SCREEN_VISIBLE_AREA(0, 215, 0, 212) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + // Devices + MCFG_DEVICE_ADD("ppi", I8255, 0) + MCFG_I8255_IN_PORTA_CB(IOPORT("LINE0")) + MCFG_I8255_OUT_PORTC_CB(WRITE8(tvgame_state, speaker_w)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( tvgame ) + ROM_REGION( 0x8000, "maincpu", 0 ) + ROM_LOAD( "tvgame_all.ppi", 0x0000, 0x8000, CRC(b61d17bd) SHA1(bb92d6679370fc31d67cc334807d88d7288c7cfa) ) + + ROM_REGION(0x1000, "proms", 0) + ROM_LOAD( "video32.bin", 0x0000, 0x1000, CRC(516006e3) SHA1(942b31acccf833cd722cbcb739eb87673dc633d7) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +CONS( 2011, tvgame, 0, 0, tvgame, tvgame, driver_device, 0, "Mr. Isizu", "Z80 TV Game System", 0 ) diff --git a/src/mame/drivers/tx0.c b/src/mame/drivers/tx0.c new file mode 100644 index 00000000000..d2a2865572e --- /dev/null +++ b/src/mame/drivers/tx0.c @@ -0,0 +1,1625 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + TX-0 + + Raphael Nabet, 2004 +*/ + +#include "emu.h" +#include "cpu/pdp1/tx0.h" +#include "includes/tx0.h" +#include "video/crt.h" + + +/* + driver init function +*/ +DRIVER_INIT_MEMBER(tx0_state,tx0) +{ + UINT8 *dst; + + static const unsigned char fontdata6x8[tx0_fontdata_size] = + { /* ASCII characters */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00, + 0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08, + 0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00, + 0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00, + 0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00, + 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00, + 0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00, + 0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, + 0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00, + 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00, + 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60, + 0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, + 0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, + 0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, + 0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, + 0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, + 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00, + 0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, + 0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08, + 0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, + 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00, + 0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00, + 0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00, + 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00, + 0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc, + 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, + 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00, + 0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, + 0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, + 0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00, + 0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00, + 0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, + 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, + 0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, + 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00, + 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00, + 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, + 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, + 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00, + }; + + /* set up our font */ + dst = memregion("gfx1")->base(); + + memcpy(dst, fontdata6x8, tx0_fontdata_size); +} + + +static ADDRESS_MAP_START(tx0_64kw_map, AS_PROGRAM, 32, tx0_state ) + AM_RANGE(0x0000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(tx0_8kw_map, AS_PROGRAM, 32, tx0_state ) + AM_RANGE(0x0000, 0x1fff) AM_RAM +ADDRESS_MAP_END + + +static INPUT_PORTS_START( tx0 ) + + PORT_START("CSW") /* 0: various tx0 operator control panel switches */ + PORT_BIT(tx0_control, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(tx0_stop_cyc0, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop at cycle 0") PORT_CODE(KEYCODE_Q) + PORT_BIT(tx0_stop_cyc1, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop at cycle 1") PORT_CODE(KEYCODE_W) + PORT_BIT(tx0_gbl_cm_sel, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CM select") PORT_CODE(KEYCODE_E) + PORT_BIT(tx0_stop, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop") PORT_CODE(KEYCODE_P) + PORT_BIT(tx0_restart, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("restart") PORT_CODE(KEYCODE_O) + PORT_BIT(tx0_read_in, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("read in") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(tx0_toggle_dn, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("edit next toggle switch register") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(tx0_toggle_up, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("edit previous toggle switch register") PORT_CODE(KEYCODE_UP) + PORT_BIT(tx0_cm_sel, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TSS CM switch") PORT_CODE(KEYCODE_A) + PORT_BIT(tx0_lr_sel, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TSS LR switch") PORT_CODE(KEYCODE_SLASH) + + PORT_START("MSW") /* 1: operator control panel toggle switch register switches MS */ + PORT_BIT( 0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 0") PORT_CODE(KEYCODE_S) + PORT_BIT( 0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 1") PORT_CODE(KEYCODE_D) + + PORT_START("LSW") /* 2: operator control panel toggle switch register switches LS */ + PORT_BIT( 0100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 2") PORT_CODE(KEYCODE_F) + PORT_BIT( 0040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 3") PORT_CODE(KEYCODE_G) + PORT_BIT( 0020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 4") PORT_CODE(KEYCODE_H) + PORT_BIT( 0010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 5") PORT_CODE(KEYCODE_J) + PORT_BIT( 0004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 6") PORT_CODE(KEYCODE_K) + PORT_BIT( 0002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 7") PORT_CODE(KEYCODE_L) + PORT_BIT( 0001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 8") PORT_CODE(KEYCODE_COLON) + PORT_BIT( 0000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 9") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 10") PORT_CODE(KEYCODE_X) + PORT_BIT( 0000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 11") PORT_CODE(KEYCODE_C) + PORT_BIT( 0000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 12") PORT_CODE(KEYCODE_V) + PORT_BIT( 0000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 13") PORT_CODE(KEYCODE_B) + PORT_BIT( 0000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 14") PORT_CODE(KEYCODE_N) + PORT_BIT( 0000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 15") PORT_CODE(KEYCODE_M) + PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 16") PORT_CODE(KEYCODE_COMMA) + PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 17") PORT_CODE(KEYCODE_STOP) + + PORT_START("TWR.0") /* 3: typewriter codes 00-17 */ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| _") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(Space)") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= :") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ /") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + + PORT_START("TWR.1") /* 4: typewriter codes 20-37 */ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". )") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + + PORT_START("TWR.2") /* 5: typewriter codes 40-57 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab Key") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + + PORT_START("TWR.3") /* 6: typewriter codes 60-77 */ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upper case") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lower Case") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + +INPUT_PORTS_END + + +static const gfx_layout fontlayout = +{ + 6, 8, /* 6*8 characters */ + tx0_charnum, /* 96+xx characters */ + 1, /* 1 bit per pixel */ + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 consecutive bytes */ +}; + + +/* + The static palette only includes the pens for the control panel and + the typewriter, as the CRT palette is generated dynamically. + + The CRT palette defines various levels of intensity between white and + black. Grey levels follow an exponential law, so that decrementing the + color index periodically will simulate the remanence of a cathode ray tube. +*/ +static const UINT8 tx0_colors[] = +{ + 0x00,0x00,0x00, /* black */ + 0xFF,0xFF,0xFF, /* white */ + 0x00,0xFF,0x00, /* green */ + 0x00,0x40,0x00, /* dark green */ + 0xFF,0x00,0x00, /* red */ + 0x80,0x80,0x80 /* light gray */ +}; + +static const UINT8 tx0_palette[] = +{ + pen_panel_bg, pen_panel_caption, /* captions */ + pen_typewriter_bg, pen_black, /* black typing in typewriter */ + pen_typewriter_bg, pen_red /* red typing in typewriter */ +}; + +static const UINT8 total_colors_needed = pen_crt_num_levels + sizeof(tx0_colors) / 3; + +static GFXDECODE_START( tx0 ) + GFXDECODE_ENTRY( "gfx1", 0, fontlayout, pen_crt_num_levels + sizeof(tx0_colors) / 3, 3 ) +GFXDECODE_END + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(tx0_state, tx0) +{ + /* rgb components for the two color emissions */ + const double r1 = .1, g1 = .1, b1 = .924, r2 = .7, g2 = .7, b2 = .076; + /* half period in seconds for the two color emissions */ + const double half_period_1 = .05, half_period_2 = .20; + /* refresh period in seconds */ + const double update_period = 1./refresh_rate; + double decay_1, decay_2; + double cur_level_1, cur_level_2; +#if 0 +#ifdef MAME_DEBUG + /* level at which we stop emulating the decay and say the pixel is black */ + double cut_level = .02; +#endif +#endif + UINT8 i, r, g, b; + + /* initialize CRT palette */ + + /* compute the decay factor per refresh frame */ + decay_1 = pow(.5, update_period / half_period_1); + decay_2 = pow(.5, update_period / half_period_2); + + cur_level_1 = cur_level_2 = 255.; /* start with maximum level */ + + for (i=pen_crt_max_intensity; i>0; i--) + { + /* compute the current color */ + r = (int) ((r1*cur_level_1 + r2*cur_level_2) + .5); + g = (int) ((g1*cur_level_1 + g2*cur_level_2) + .5); + b = (int) ((b1*cur_level_1 + b2*cur_level_2) + .5); + /* write color in palette */ + palette.set_indirect_color(i, rgb_t(r, g, b)); + /* apply decay for next iteration */ + cur_level_1 *= decay_1; + cur_level_2 *= decay_2; + } +#if 0 +#ifdef MAME_DEBUG + { + int recommended_pen_crt_num_levels; + if (decay_1 > decay_2) + recommended_pen_crt_num_levels = ceil(log(cut_level)/log(decay_1))+1; + else + recommended_pen_crt_num_levels = ceil(log(cut_level)/log(decay_2))+1; + if (recommended_pen_crt_num_levels != pen_crt_num_levels) + osd_printf_debug("File %s line %d: recommended value for pen_crt_num_levels is %d\n", __FILE__, __LINE__, recommended_pen_crt_num_levels); + } + /*if ((cur_level_1 > 255.*cut_level) || (cur_level_2 > 255.*cut_level)) + osd_printf_debug("File %s line %d: Please take higher value for pen_crt_num_levels or smaller value for decay\n", __FILE__, __LINE__);*/ +#endif +#endif + palette.set_indirect_color(0, rgb_t(0, 0, 0)); + + /* load static palette */ + for ( i = 0; i < 6; i++ ) + { + r = tx0_colors[i*3]; g = tx0_colors[i*3+1]; b = tx0_colors[i*3+2]; + palette.set_indirect_color(pen_crt_num_levels + i, rgb_t(r, g, b)); + } + + /* copy colortable to palette */ + for( i = 0; i < total_colors_needed; i++ ) + palette.set_pen_indirect(i, i); + + /* set up palette for text */ + for( i = 0; i < 6; i++ ) + palette.set_pen_indirect(total_colors_needed + i, tx0_palette[i]); +} + + + +/* + TX-0 +* + Raphael Nabet, 2004 +*/ + + + +/* crt display timer */ + + + +enum +{ + PF_RWC = 040, + PF_EOR = 020, + PF_PC = 010, + PF_EOT = 004 +}; + + +void tx0_state::machine_reset() +{ + /* reset device state */ + m_tape_reader.rcl = m_tape_reader.rc = 0; +} + + +void tx0_state::tx0_machine_stop() +{ + /* the core will take care of freeing the timers, BUT we must set the variables + to NULL if we don't want to risk confusing the tape image init function */ + m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.prt_timer = m_dis_timer = NULL; +} + + +void tx0_state::machine_start() +{ + m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::reader_callback),this)); + m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::puncher_callback),this)); + m_typewriter.prt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::prt_callback),this)); + m_dis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::dis_callback),this)); + + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_state::tx0_machine_stop),this)); +} + + +/* + perforated tape handling +*/ + +class tx0_readtape_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + tx0_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 0; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "tap,rim"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type TX0_READTAPE = &device_creator; + +tx0_readtape_image_device::tx0_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TX0_READTAPE, "TX0 Tape Reader", tag, owner, clock, "tx0_readtape_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +class tx0_punchtape_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + tx0_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } + + virtual bool is_readable() const { return 0; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "tap,rim"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type TX0_PUNCHTAPE = &device_creator; + +tx0_punchtape_image_device::tx0_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TX0_PUNCHTAPE, "TX0 Tape Puncher", tag, owner, clock, "tx0_punchtape_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + + +class tx0_printer_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + tx0_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_PRINTER; } + + virtual bool is_readable() const { return 0; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "typ"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start() { } +}; + +const device_type TX0_PRINTER = &device_creator; + +tx0_printer_image_device::tx0_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TX0_PRINTER, "TX0 Typewriter", tag, owner, clock, "tx0_printer_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +class tx0_magtape_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + tx0_magtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_MAGTAPE; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "tap"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); +protected: + // device-level overrides + virtual void device_config_complete() { update_names(); } + virtual void device_start(); +}; + +const device_type TX0_MAGTAPE = &device_creator; + +tx0_magtape_image_device::tx0_magtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TX0_MAGTAPE, "TX0 Magnetic Tape", tag, owner, clock, "tx0_magtape_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +/* + Open a perforated tape image + + unit 0 is reader (read-only), unit 1 is puncher (write-only) +*/ +bool tx0_readtape_image_device::call_load() +{ + tx0_state *state = machine().driver_data(); + + /* reader unit */ + state->m_tape_reader.fd = this; + + /* start motor */ + state->m_tape_reader.motor_on = 1; + + /* restart reader IO when necessary */ + /* note that this function may be called before tx0_init_machine, therefore + before tape_reader.timer is allocated. It does not matter, as the clutch is never + down at power-up, but we must not call timer_enable with a NULL parameter! */ + + if (state->m_tape_reader.timer) + { + if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl) + { + /* delay is approximately 1/400s */ + state->m_tape_reader.timer->adjust(attotime::from_usec(2500)); + } + else + { + state->m_tape_reader.timer->enable(0); + } + } + + return IMAGE_INIT_PASS; +} + +void tx0_readtape_image_device::call_unload() +{ + tx0_state *state = machine().driver_data(); + + /* reader unit */ + state->m_tape_reader.fd = NULL; + + /* stop motor */ + state->m_tape_reader.motor_on = 0; + + if (state->m_tape_reader.timer) + state->m_tape_reader.timer->enable(0); +} + +/* + Read a byte from perforated tape +*/ +int tx0_state::tape_read(UINT8 *reply) +{ + if (m_tape_reader.fd && (m_tape_reader.fd->fread(reply, 1) == 1)) + return 0; /* unit OK */ + else + return 1; /* unit not ready */ +} + +/* + Write a byte to perforated tape +*/ +void tx0_state::tape_write(UINT8 data) +{ + if (m_tape_puncher.fd) + m_tape_puncher.fd->fwrite(& data, 1); +} + +/* + common code for tape read commands (R1C, R3C, and read-in mode) +*/ +void tx0_state::begin_tape_read(int binary) +{ + m_tape_reader.rcl = 1; + m_tape_reader.rc = (binary) ? 1 : 3; + + /* set up delay if tape is advancing */ + if (m_tape_reader.motor_on && m_tape_reader.rcl) + { + /* delay is approximately 1/400s */ + m_tape_reader.timer->adjust(attotime::from_usec(2500)); + } + else + { + m_tape_reader.timer->enable(0); + } +} + + +/* + timer callback to simulate reader IO +*/ +TIMER_CALLBACK_MEMBER(tx0_state::reader_callback) +{ + int not_ready; + UINT8 data; + int ac; + + if (m_tape_reader.rc) + { + not_ready = tape_read( & data); + if (not_ready) + { + m_tape_reader.motor_on = 0; /* let us stop the motor */ + } + else + { + if (data & 0100) + { + /* read current AC */ + ac = m_maincpu->state_int(TX0_AC); + /* cycle right */ + ac = (ac >> 1) | ((ac & 1) << 17); + /* shuffle and insert data into AC */ + ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3); + /* write modified AC */ + m_maincpu->set_state_int(TX0_AC, ac); + + m_tape_reader.rc = (m_tape_reader.rc+1) & 3; + + if (m_tape_reader.rc == 0) + { /* IO complete */ + m_tape_reader.rcl = 0; + m_maincpu->set_state_int(TX0_IOS,1); + } + } + } + } + + if (m_tape_reader.motor_on && m_tape_reader.rcl) + /* delay is approximately 1/400s */ + m_tape_reader.timer->adjust(attotime::from_usec(2500)); + else + m_tape_reader.timer->enable(0); +} + +/* + timer callback to generate punch completion pulse +*/ +bool tx0_punchtape_image_device::call_load() +{ + tx0_state *state = machine().driver_data(); + + /* punch unit */ + state->m_tape_puncher.fd = this; + + return IMAGE_INIT_PASS; +} + +void tx0_punchtape_image_device::call_unload() +{ + tx0_state *state = machine().driver_data(); + + /* punch unit */ + state->m_tape_puncher.fd = NULL; +} + +TIMER_CALLBACK_MEMBER(tx0_state::puncher_callback) +{ + m_maincpu->set_state_int(TX0_IOS,1); +} + +/* + Initiate read of a 6-bit word from tape +*/ +WRITE_LINE_MEMBER( tx0_state::tx0_io_r1l ) +{ + begin_tape_read( 0); +} + +/* + Initiate read of a 18-bit word from tape (used in read-in mode) +*/ +WRITE_LINE_MEMBER( tx0_state::tx0_io_r3l ) +{ + begin_tape_read(1); +} + +/* + Write a 7-bit word to tape (7th bit clear) +*/ +WRITE_LINE_MEMBER( tx0_state::tx0_io_p6h ) +{ + int ac; + + /* read current AC */ + ac = m_maincpu->state_int(TX0_AC); + /* shuffle and punch 6-bit word */ + tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5)); + + m_tape_puncher.timer->adjust(attotime::from_usec(15800)); +} + +/* + Write a 7-bit word to tape (7th bit set) +*/ +WRITE_LINE_MEMBER( tx0_state::tx0_io_p7h ) +{ + int ac; + + /* read current AC */ + ac = m_maincpu->state_int(TX0_AC); + /* shuffle and punch 6-bit word */ + tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100); + + m_tape_puncher.timer->adjust(attotime::from_usec(15800)); +} + + +/* + Typewriter handling + + The alphanumeric on-line typewriter is a standard device on tx-0: it can + both handle keyboard input and print output text. +*/ + +/* + Open a file for typewriter output +*/ +bool tx0_printer_image_device::call_load() +{ + tx0_state *state = machine().driver_data(); + /* open file */ + state->m_typewriter.fd = this; + + return IMAGE_INIT_PASS; +} + +void tx0_printer_image_device::call_unload() +{ + tx0_state *state = machine().driver_data(); + state->m_typewriter.fd = NULL; +} + +/* + Write a character to typewriter +*/ +void tx0_state::typewriter_out(UINT8 data) +{ + tx0_typewriter_drawchar(data); + if (m_typewriter.fd) + m_typewriter.fd->fwrite(& data, 1); +} + +/* + timer callback to generate typewriter completion pulse +*/ +TIMER_CALLBACK_MEMBER(tx0_state::prt_callback) +{ + m_maincpu->io_complete(); +} + +/* + prt io callback +*/ +WRITE_LINE_MEMBER( tx0_state::tx0_io_prt ) +{ + int ac; + int ch; + + /* read current AC */ + ac = m_maincpu->state_int(TX0_AC); + /* shuffle and print 6-bit word */ + ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5); + typewriter_out(ch); + + m_typewriter.prt_timer->adjust(attotime::from_msec(100)); +} + + +/* + timer callback to generate crt completion pulse +*/ +TIMER_CALLBACK_MEMBER(tx0_state::dis_callback) +{ + m_maincpu->io_complete(); +} + +/* + Plot one point on crt +*/ +WRITE_LINE_MEMBER( tx0_state::tx0_io_dis ) +{ + int ac; + int x; + int y; + + ac = m_maincpu->state_int(TX0_AC); + x = ac >> 9; + y = ac & 0777; + tx0_plot(x, y); + + m_dis_timer->adjust(attotime::from_usec(50)); +} + + +/* + Magtape support + + Magtape format: + + 7-track tape, 6-bit data, 1-bit parity + + +*/ + +void tx0_state::schedule_select() +{ + attotime delay = attotime::zero; + + switch (m_magtape.command) + { + case 0: /* backspace */ + delay = attotime::from_usec(4600); + break; + case 1: /* read */ + delay = attotime::from_usec(8600); + break; + case 2: /* rewind */ + delay = attotime::from_usec(12000); + break; + case 3: /* write */ + delay = attotime::from_usec(4600); + break; + } + m_magtape.timer->adjust(delay); +} + +void tx0_state::schedule_unselect() +{ + attotime delay = attotime::zero; + + switch (m_magtape.command) + { + case 0: /* backspace */ + delay = attotime::from_usec(5750); + break; + case 1: /* read */ + delay = attotime::from_usec(1750); + break; + case 2: /* rewind */ + delay = attotime::from_usec(0); + break; + case 3: /* write */ + delay = attotime::from_usec(5750); + break; + } + m_magtape.timer->adjust(delay); +} + +void tx0_magtape_image_device::device_start() +{ + tx0_state *state = machine().driver_data(); + state->m_magtape.img = this; +} + +/* + Open a magnetic tape image +*/ +bool tx0_magtape_image_device::call_load() +{ + tx0_state *state = machine().driver_data(); + state->m_magtape.img = this; + + state->m_magtape.irg_pos = MTIRGP_END; + + /* restart IO when necessary */ + /* note that this function may be called before tx0_init_machine, therefore + before magtape.timer is allocated. We must not call timer_enable with a + NULL parameter! */ + if (state->m_magtape.timer) + { + if (state->m_magtape.state == MTS_SELECTING) + state->schedule_select(); + } + + return IMAGE_INIT_PASS; +} + +void tx0_magtape_image_device::call_unload() +{ + tx0_state *state = machine().driver_data(); + state->m_magtape.img = NULL; + + if (state->m_magtape.timer) + { + if (state->m_magtape.state == MTS_SELECTING) + /* I/O has not actually started, we can cancel the selection */ + state->m_tape_reader.timer->enable(0); + if ((state->m_magtape.state == MTS_SELECTED) || ((state->m_magtape.state == MTS_SELECTING) && (state->m_magtape.command == 2))) + { /* unit has become unavailable */ + state->m_magtape.state = MTS_UNSELECTING; + state->m_maincpu->set_state_int(TX0_PF, state->m_maincpu->state_int(TX0_PF) | PF_RWC); + state->schedule_unselect(); + } + } +} + +void tx0_state::magtape_callback() +{ + UINT8 buf = 0; + int lr; + + switch (m_magtape.state) + { + case MTS_UNSELECTING: + m_magtape.state = MTS_UNSELECTED; + + case MTS_UNSELECTED: + if (m_magtape.sel_pending) + { + int mar; + + mar = m_maincpu->state_int(TX0_MAR); + + if ((mar & 03) != 1) + { /* unimplemented device: remain in unselected state and set rwc + flag? */ + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_RWC); + } + else + { + m_magtape.state = MTS_SELECTING; + + m_magtape.command = (mar & 014 >> 2); + + m_magtape.binary_flag = (mar & 020 >> 4); + + if (m_magtape.img) + schedule_select(); + } + + m_magtape.sel_pending = FALSE; + m_maincpu->io_complete(); + } + break; + + case MTS_SELECTING: + m_magtape.state = MTS_SELECTED; + switch (m_magtape.command) + { + case 0: /* backspace */ + m_magtape.long_parity = 0177; + m_magtape.u.backspace_state = MTBSS_STATE0; + break; + case 1: /* read */ + m_magtape.long_parity = 0177; + m_magtape.u.read.state = MTRDS_STATE0; + break; + case 2: /* rewind */ + break; + case 3: /* write */ + m_magtape.long_parity = 0177; + m_magtape.u.write.state = MTWTS_STATE0; + switch (m_magtape.irg_pos) + { + case MTIRGP_START: + m_magtape.u.write.counter = 150; + break; + case MTIRGP_ENDMINUS1: + m_magtape.u.write.counter = 1; + break; + case MTIRGP_END: + m_magtape.u.write.counter = 0; + break; + } + break; + } + + case MTS_SELECTED: + switch (m_magtape.command) + { + case 0: /* backspace */ + if (m_magtape.img->ftell() == 0) + { /* tape at ldp */ + m_magtape.state = MTS_UNSELECTING; + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_RWC); + schedule_unselect(); + } + else if (m_magtape.img->fseek( -1, SEEK_CUR)) + { /* eject tape */ + m_magtape.img->unload(); + } + else if (m_magtape.img->fread(&buf, 1) != 1) + { /* eject tape */ + m_magtape.img->unload(); + } + else if (m_magtape.img->fseek( -1, SEEK_CUR)) + { /* eject tape */ + m_magtape.img->unload(); + } + else + { + buf &= 0x7f; /* 7-bit tape, ignore 8th bit */ + m_magtape.long_parity ^= buf; + switch (m_magtape.u.backspace_state) + { + case MTBSS_STATE0: + /* STATE0 -> initial interrecord gap, longitudinal parity; + if longitudinal parity was all 0s, gap between longitudinal + parity and data, first byte of data */ + if (buf != 0) + m_magtape.u.backspace_state = MTBSS_STATE1; + break; + case MTBSS_STATE1: + /* STATE1 -> first byte of gap between longitudinal parity and + data, second byte of data */ + if (buf == 0) + m_magtape.u.backspace_state = MTBSS_STATE2; + else + m_magtape.u.backspace_state = MTBSS_STATE5; + break; + case MTBSS_STATE2: + /* STATE2 -> second byte of gap between longitudinal parity and + data */ + if (buf == 0) + m_magtape.u.backspace_state = MTBSS_STATE3; + else + { + logerror("tape seems to be corrupt\n"); + /* eject tape */ + m_magtape.img->unload(); + } + break; + case MTBSS_STATE3: + /* STATE3 -> third byte of gap between longitudinal parity and + data */ + if (buf == 0) + m_magtape.u.backspace_state = MTBSS_STATE4; + else + { + logerror("tape seems to be corrupt\n"); + /* eject tape */ + m_magtape.img->unload(); + } + break; + case MTBSS_STATE4: + /* STATE4 -> first byte of data word, first byte of + interrecord gap after data */ + if (buf == 0) + { + if (m_magtape.long_parity) + logerror("invalid longitudinal parity\n"); + /* set EOR and unselect... */ + m_magtape.state = MTS_UNSELECTING; + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_EOR); + schedule_unselect(); + m_magtape.irg_pos = MTIRGP_ENDMINUS1; + } + else + m_magtape.u.backspace_state = MTBSS_STATE5; + break; + case MTBSS_STATE5: + /* STATE5 -> second byte of data word */ + if (buf == 0) + { + logerror("tape seems to be corrupt\n"); + /* eject tape */ + m_magtape.img->unload(); + } + else + m_magtape.u.backspace_state = MTBSS_STATE6; + break; + case MTBSS_STATE6: + /* STATE6 -> third byte of data word */ + if (buf == 0) + { + logerror("tape seems to be corrupt\n"); + /* eject tape */ + m_magtape.img->unload(); + } + else + m_magtape.u.backspace_state = MTBSS_STATE6; + break; + } + if (m_magtape.state != MTS_UNSELECTING) + m_magtape.timer->adjust(attotime::from_usec(66)); + } + break; + + case 1: /* read */ + if (m_magtape.img->fread(&buf, 1) != 1) + { /* I/O error or EOF? */ + /* The MAME fileio layer makes it very hard to make the + difference... MAME seems to assume that I/O errors never + happen, whereas it is really easy to cause one by + deconnecting an external drive the image is located on!!! */ + UINT64 offs; + offs = m_magtape.img->ftell(); + if (m_magtape.img->fseek( 0, SEEK_END) || (offs != m_magtape.img->ftell())) + { /* I/O error */ + /* eject tape */ + m_magtape.img->unload(); + } + else + { /* end of tape -> ??? */ + /* maybe we run past end of tape, so that tape is ejected from + upper reel and unit becomes unavailable??? */ + /*m_magtape.img->unload();*/ + /* Or do we stop at EOT mark??? */ + m_magtape.state = MTS_UNSELECTING; + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_EOT); + schedule_unselect(); + } + } + else + { + buf &= 0x7f; /* 7-bit tape, ignore 8th bit */ + m_magtape.long_parity ^= buf; + switch (m_magtape.u.read.state) + { + case MTRDS_STATE0: + /* STATE0 -> interrecord blank or first byte of data */ + if (buf != 0) + { + if (m_magtape.cpy_pending) + { /* read command */ + m_magtape.u.read.space_flag = FALSE; + m_maincpu->set_state_int(TX0_IOS,1); + m_maincpu->set_state_int(TX0_LR, ((m_maincpu->state_int(TX0_LR) >> 1) & 0333333) + | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); + /* check parity */ + if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ m_magtape.binary_flag)) + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); + } + else + { /* space command */ + m_magtape.u.read.space_flag = TRUE; + } + m_magtape.u.read.state = MTRDS_STATE1; + } + break; + case MTRDS_STATE1: + /* STATE1 -> second byte of data word */ + if (buf == 0) + { + logerror("tape seems to be corrupt\n"); + /* eject tape */ + m_magtape.img->unload(); + } + if (!m_magtape.u.read.space_flag) + { + m_maincpu->set_state_int(TX0_LR, ((m_maincpu->state_int(TX0_LR) >> 1) & 0333333) + | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); + /* check parity */ + if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ m_magtape.binary_flag)) + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); + } + m_magtape.u.read.state = MTRDS_STATE2; + break; + case MTRDS_STATE2: + /* STATE2 -> third byte of data word */ + if (buf == 0) + { + logerror("tape seems to be corrupt\n"); + /* eject tape */ + m_magtape.img->unload(); + } + if (!m_magtape.u.read.space_flag) + { + m_maincpu->set_state_int(TX0_LR, ((m_maincpu->state_int(TX0_LR) >> 1) & 0333333) + | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); + /* check parity */ + if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ m_magtape.binary_flag)) + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); + /* synchronize with cpy instruction */ + if (m_magtape.cpy_pending) + m_maincpu->set_state_int(TX0_IOS,1); + else + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_RWC); + } + m_magtape.u.read.state = MTRDS_STATE3; + break; + case MTRDS_STATE3: + /* STATE3 -> first byte of new word of data, or first byte + of gap between data and longitudinal parity */ + if (buf != 0) + { + m_magtape.u.read.state = MTRDS_STATE1; + if (!m_magtape.u.read.space_flag) + { + m_maincpu->set_state_int(TX0_LR, ((m_maincpu->state_int(TX0_LR) >> 1) & 0333333) + | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); + /* check parity */ + if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ m_magtape.binary_flag)) + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); + } + } + else + m_magtape.u.read.state = MTRDS_STATE4; + break; + case MTRDS_STATE4: + /* STATE4 -> second byte of gap between data and + longitudinal parity */ + if (buf != 0) + { + logerror("tape seems to be corrupt\n"); + /* eject tape */ + m_magtape.img->unload(); + } + else + m_magtape.u.read.state = MTRDS_STATE5; + break; + + case MTRDS_STATE5: + /* STATE5 -> third byte of gap between data and + longitudinal parity */ + if (buf != 0) + { + logerror("tape seems to be corrupt\n"); + /* eject tape */ + m_magtape.img->unload(); + } + else + m_magtape.u.read.state = MTRDS_STATE6; + break; + + case MTRDS_STATE6: + /* STATE6 -> longitudinal parity */ + /* check parity */ + if (m_magtape.long_parity) + { + logerror("invalid longitudinal parity\n"); + /* no idea if the original tx-0 magtape controller + checks parity, but can't harm if we do */ + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); + } + /* set EOR and unselect... */ + m_magtape.state = MTS_UNSELECTING; + m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_EOR); + schedule_unselect(); + m_magtape.irg_pos = MTIRGP_START; + break; + } + if (m_magtape.state != MTS_UNSELECTING) + m_magtape.timer->adjust(attotime::from_usec(66)); + } + break; + + case 2: /* rewind */ + m_magtape.state = MTS_UNSELECTING; + /* we rewind at 10*read speed (I don't know the real value) */ + m_magtape.timer->adjust((attotime::from_nsec(6600) * m_magtape.img->ftell())); + //schedule_unselect(state); + m_magtape.img->fseek( 0, SEEK_END); + m_magtape.irg_pos = MTIRGP_END; + break; + + case 3: /* write */ + switch (m_magtape.u.write.state) + { + case MTWTS_STATE0: + if (m_magtape.u.write.counter != 0) + { + m_magtape.u.write.counter--; + buf = 0; + break; + } + else + { + m_magtape.u.write.state = MTWTS_STATE1; + } + + case MTWTS_STATE1: + if (m_magtape.u.write.counter) + { + m_magtape.u.write.counter--; + lr = m_maincpu->state_int(TX0_LR); + buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001); + buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!m_magtape.binary_flag) << 6)) & 0100; + m_maincpu->set_state_int(TX0_LR, lr >> 1); + } + else + { + if (m_magtape.cpy_pending) + { + m_maincpu->set_state_int(TX0_IOS,1); + lr = m_maincpu->state_int(TX0_LR); + buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001); + buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!m_magtape.binary_flag) << 6)) & 0100; + m_maincpu->set_state_int(TX0_LR, lr >> 1); + m_magtape.u.write.counter = 2; + break; + } + else + { + m_magtape.u.write.state = MTWTS_STATE2; + m_magtape.u.write.counter = 3; + } + } + + case MTWTS_STATE2: + if (m_magtape.u.write.counter != 0) + { + m_magtape.u.write.counter--; + buf = 0; + break; + } + else + { + buf = m_magtape.long_parity; + m_magtape.state = (state_t)MTWTS_STATE3; + m_magtape.u.write.counter = 150; + } + break; + + case MTWTS_STATE3: + if (m_magtape.u.write.counter != 0) + { + m_magtape.u.write.counter--; + buf = 0; + break; + } + else + { + m_magtape.state = MTS_UNSELECTING; + schedule_unselect(); + m_magtape.irg_pos = MTIRGP_END; + } + break; + } + if (m_magtape.state != MTS_UNSELECTING) + { /* write data word */ + m_magtape.long_parity ^= buf; + if (m_magtape.img->fwrite(&buf, 1) != 1) + { /* I/O error */ + /* eject tape */ + m_magtape.img->unload(); + } + else + m_magtape.timer->adjust(attotime::from_usec(66)); + } + break; + } + break; + } +} + +WRITE_LINE_MEMBER( tx0_state::tx0_sel ) +{ + m_magtape.sel_pending = TRUE; + + if (m_magtape.state == MTS_UNSELECTED) + { + if (0) + magtape_callback(); + m_magtape.timer->adjust(attotime::zero); + } +} + +WRITE_LINE_MEMBER( tx0_state::tx0_io_cpy ) +{ + switch (m_magtape.state) + { + case MTS_UNSELECTED: + case MTS_UNSELECTING: + /* ignore instruction and set rwc flag? */ + m_maincpu->io_complete(); + break; + + case MTS_SELECTING: + case MTS_SELECTED: + switch (m_magtape.command) + { + case 0: /* backspace */ + case 2: /* rewind */ + /* ignore instruction and set rwc flag? */ + m_maincpu->io_complete(); + break; + case 1: /* read */ + case 3: /* write */ + m_magtape.cpy_pending = TRUE; + break; + } + break; + } +} + + +/* + callback which is called when reset line is pulsed + + IO devices should reset +*/ +WRITE_LINE_MEMBER( tx0_state::tx0_io_reset_callback ) +{ + m_tape_reader.rcl = m_tape_reader.rc = 0; + if (m_tape_reader.timer) + m_tape_reader.timer->enable(0); + + if (m_tape_puncher.timer) + m_tape_puncher.timer->enable(0); + + if (m_typewriter.prt_timer) + m_typewriter.prt_timer->enable(0); + + if (m_dis_timer) + m_dis_timer->enable(0); +} + + +/* + typewriter keyboard handler +*/ +void tx0_state::tx0_keyboard() +{ + int i; + int j; + + int typewriter_keys[4]; + + int typewriter_transitions; + int charcode, lr; + + for (i=0; i<4; i++) + { + typewriter_keys[i] = m_twr[i]->read(); + } + + for (i=0; i<4; i++) + { + typewriter_transitions = typewriter_keys[i] & (~ m_old_typewriter_keys[i]); + if (typewriter_transitions) + { + for (j=0; (((typewriter_transitions >> j) & 1) == 0) /*&& (j<16)*/; j++) + ; + charcode = (i << 4) + j; + /* shuffle and insert data into LR */ + /* BTW, I am not sure how the char code is combined with the + previous LR */ + lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); + /* write modified LR */ + m_maincpu->set_state_int(TX0_LR, lr); + tx0_typewriter_drawchar(charcode); /* we want to echo input */ + break; + } + } + + for (i=0; i<4; i++) + m_old_typewriter_keys[i] = typewriter_keys[i]; +} + +/* + Not a real interrupt - just handle keyboard input +*/ +INTERRUPT_GEN_MEMBER(tx0_state::tx0_interrupt) +{ + int control_keys; + int tsr_keys; + + int control_transitions; + int tsr_transitions; + + + /* read new state of control keys */ + control_keys = m_csw->read(); + + if (control_keys & tx0_control) + { + /* compute transitions */ + control_transitions = control_keys & (~ m_old_control_keys); + + if (control_transitions & tx0_stop_cyc0) + { + m_maincpu->set_state_int(TX0_STOP_CYC0, !m_maincpu->state_int(TX0_STOP_CYC0)); + } + if (control_transitions & tx0_stop_cyc1) + { + m_maincpu->set_state_int(TX0_STOP_CYC1, !m_maincpu->state_int(TX0_STOP_CYC1)); + } + if (control_transitions & tx0_gbl_cm_sel) + { + m_maincpu->set_state_int(TX0_GBL_CM_SEL, !m_maincpu->state_int(TX0_GBL_CM_SEL)); + } + if (control_transitions & tx0_stop) + { + m_maincpu->set_state_int(TX0_RUN, (UINT64)0); + m_maincpu->set_state_int(TX0_RIM, (UINT64)0); + } + if (control_transitions & tx0_restart) + { + m_maincpu->set_state_int(TX0_RUN, 1); + m_maincpu->set_state_int(TX0_RIM, (UINT64)0); + } + if (control_transitions & tx0_read_in) + { /* set cpu to read instructions from perforated tape */ + m_maincpu->pulse_reset(); + m_maincpu->set_state_int(TX0_RUN, (UINT64)0); + m_maincpu->set_state_int(TX0_RIM, 1); + } + if (control_transitions & tx0_toggle_dn) + { + m_tsr_index++; + if (m_tsr_index == 18) + m_tsr_index = 0; + } + if (control_transitions & tx0_toggle_up) + { + m_tsr_index--; + if (m_tsr_index == -1) + m_tsr_index = 17; + } + if (control_transitions & tx0_cm_sel) + { + if (m_tsr_index >= 2) + { + UINT32 cm_sel = (UINT32) m_maincpu->state_int(TX0_CM_SEL); + m_maincpu->set_state_int(TX0_CM_SEL, cm_sel ^ (1 << (m_tsr_index - 2))); + } + } + if (control_transitions & tx0_lr_sel) + { + if (m_tsr_index >= 2) + { + UINT32 lr_sel = (UINT32) m_maincpu->state_int(TX0_LR_SEL); + m_maincpu->set_state_int(TX0_LR_SEL, (lr_sel ^ (1 << (m_tsr_index - 2)))); + } + } + + /* remember new state of control keys */ + m_old_control_keys = control_keys; + + + /* handle toggle switch register keys */ + tsr_keys = (ioport("MSW")->read() << 16) | ioport("LSW")->read(); + + /* compute transitions */ + tsr_transitions = tsr_keys & (~ m_old_tsr_keys); + + /* update toggle switch register */ + if (tsr_transitions) + m_maincpu->set_state_int(TX0_TBR+m_tsr_index, m_maincpu->state_int(TX0_TBR+m_tsr_index) ^ tsr_transitions); + + /* remember new state of toggle switch register keys */ + m_old_tsr_keys = tsr_keys; + } + else + { + m_old_control_keys = 0; + m_old_tsr_keys = 0; + + tx0_keyboard(); + } +} + +static MACHINE_CONFIG_START( tx0_64kw, tx0_state ) + /* basic machine hardware */ + /* TX0 CPU @ approx. 167 kHz (no master clock, but the memory cycle time is approximately 6usec) */ + MCFG_CPU_ADD("maincpu", TX0_64KW, 166667) + MCFG_TX0_CONFIG( + WRITELINE( tx0_state, tx0_io_cpy ), + WRITELINE( tx0_state, tx0_io_r1l ), + WRITELINE( tx0_state, tx0_io_dis ), + WRITELINE( tx0_state, tx0_io_r3l ), + WRITELINE( tx0_state, tx0_io_prt ), + NULL, + WRITELINE( tx0_state, tx0_io_p6h ), + WRITELINE( tx0_state, tx0_io_p7h ), + WRITELINE( tx0_state, tx0_sel ), + WRITELINE( tx0_state, tx0_io_reset_callback ) + ) + MCFG_CPU_PROGRAM_MAP(tx0_64kw_map) + /* dummy interrupt: handles input */ + MCFG_CPU_VBLANK_INT_DRIVER("screen", tx0_state, tx0_interrupt) + + /* video hardware (includes the control panel and typewriter output) */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(refresh_rate) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(virtual_width, virtual_height) + MCFG_SCREEN_VISIBLE_AREA(0, virtual_width-1, 0, virtual_height-1) + MCFG_SCREEN_UPDATE_DRIVER(tx0_state, screen_update_tx0) + MCFG_SCREEN_VBLANK_DRIVER(tx0_state, screen_eof_tx0) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEVICE_ADD("crt", CRT, 0) + MCFG_CRT_NUM_LEVELS(pen_crt_num_levels) + MCFG_CRT_OFFSETS(crt_window_offset_x, crt_window_offset_y) + MCFG_CRT_SIZE(crt_window_width, crt_window_height) + + MCFG_DEVICE_ADD("readt", TX0_READTAPE, 0) + MCFG_DEVICE_ADD("punch", TX0_PUNCHTAPE, 0) + MCFG_DEVICE_ADD("typewriter", TX0_PRINTER, 0) + MCFG_DEVICE_ADD("magtape", TX0_MAGTAPE, 0) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", tx0) + MCFG_PALETTE_ADD("palette", total_colors_needed + sizeof(tx0_palette)) + MCFG_PALETTE_INDIRECT_ENTRIES(total_colors_needed) + MCFG_PALETTE_INIT_OWNER(tx0_state, tx0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tx0_8kw, tx0_64kw ) + + /* basic machine hardware */ + /* TX0 CPU @ approx. 167 kHz (no master clock, but the memory cycle time is + approximately 6usec) */ + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(tx0_8kw_map) + /*MCFG_CPU_PORTS(readport, writeport)*/ +MACHINE_CONFIG_END + +ROM_START(tx0_64kw) + /*CPU memory space*/ + ROM_REGION(0x10000 * sizeof(UINT32),"maincpu",ROMREGION_ERASEFF) + /* Note this computer has no ROM... */ + + ROM_REGION(tx0_fontdata_size, "gfx1", ROMREGION_ERASEFF) + /* space filled with our font */ +ROM_END + +ROM_START(tx0_8kw) + /*CPU memory space*/ + ROM_REGION(0x2000 * sizeof(UINT32),"maincpu",ROMREGION_ERASEFF) + /* Note this computer has no ROM... */ + + ROM_REGION(tx0_fontdata_size, "gfx1", ROMREGION_ERASEFF) + /* space filled with our font */ +ROM_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1956, tx0_64kw, 0, 0, tx0_64kw, tx0, tx0_state, tx0, "MIT", "TX-0 original demonstrator (64 kWords of RAM)" , MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING) +COMP( 1962, tx0_8kw, tx0_64kw, 0, tx0_8kw, tx0, tx0_state, tx0, "MIT", "TX-0 upgraded system (8 kWords of RAM)" , MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/uknc.c b/src/mame/drivers/uknc.c new file mode 100644 index 00000000000..13b266ccb2b --- /dev/null +++ b/src/mame/drivers/uknc.c @@ -0,0 +1,93 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + UKNC + + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/t11/t11.h" + + +class uknc_state : public driver_device +{ +public: + uknc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_uknc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(uknc_mem, AS_PROGRAM, 16, uknc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x7fff ) AM_RAM // RAM + AM_RANGE( 0x8000, 0xffff ) AM_ROM // ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(uknc_sub_mem, AS_PROGRAM, 16, uknc_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x7fff ) AM_RAM // RAM + AM_RANGE( 0x8000, 0xffff ) AM_ROM // ROM +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( uknc ) +INPUT_PORTS_END + + +void uknc_state::machine_reset() +{ +} + +void uknc_state::video_start() +{ +} + +UINT32 uknc_state::screen_update_uknc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( uknc, uknc_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", K1801VM2, 8000000) + MCFG_T11_INITIAL_MODE(0x8000) + MCFG_CPU_PROGRAM_MAP(uknc_mem) + + MCFG_CPU_ADD("subcpu", K1801VM2, 6000000) + MCFG_T11_INITIAL_MODE(0x8000) + MCFG_CPU_PROGRAM_MAP(uknc_sub_mem) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(uknc_state, screen_update_uknc) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( uknc ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "uknc.rom", 0x8000, 0x8000, CRC(a1536994) SHA1(b3c7c678c41ffa9b37f654fbf20fef7d19e6407b)) + + ROM_REGION( 0x10000, "subcpu", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, uknc, 0, 0, uknc, uknc, driver_device, 0, "", "UKNC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/unior.c b/src/mame/drivers/unior.c new file mode 100644 index 00000000000..e3013d53955 --- /dev/null +++ b/src/mame/drivers/unior.c @@ -0,0 +1,463 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Unior + + 2009-05-12 Skeleton driver. + 2013-10-09 Added DMA and CRTC + 2013-10-11 Added PPI, PIT, UART, sound + + Some info obtained from EMU-80. + The schematic is difficult to read, and some code is guesswork. + +The monitor will only allow certain characters to be typed, thus the +modifier keys appear to do nothing. There is no need to use the enter +key; using spacebar and the correct parameters is enough. + +If you press Shift, indicators for numlock and capslock will appear. + +Monitor commands: +C +D - hex dump +E - save +F +G +H - set register +I - load +J - modify memory +K +L - list registers +M + +ToDo: +- Cassette +- Colour + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8251.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "machine/i8257.h" +#include "video/i8275.h" +#include "sound/speaker.h" + + +class unior_state : public driver_device +{ +public: + unior_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pit(*this, "pit"), + m_dma(*this, "dma"), + m_uart(*this, "uart"), + m_palette(*this, "palette") + { + } + + DECLARE_WRITE8_MEMBER(vram_w); + DECLARE_WRITE8_MEMBER(scroll_w); + DECLARE_WRITE_LINE_MEMBER(write_uart_clock); + DECLARE_READ8_MEMBER(ppi0_b_r); + DECLARE_WRITE8_MEMBER(ppi0_b_w); + DECLARE_READ8_MEMBER(ppi1_a_r); + DECLARE_READ8_MEMBER(ppi1_b_r); + DECLARE_READ8_MEMBER(ppi1_c_r); + DECLARE_WRITE8_MEMBER(ppi1_a_w); + DECLARE_WRITE8_MEMBER(ppi1_c_w); + DECLARE_WRITE_LINE_MEMBER(hrq_w); + DECLARE_PALETTE_INIT(unior); + DECLARE_READ8_MEMBER(dma_r); + I8275_DRAW_CHARACTER_MEMBER(display_pixels); + + UINT8 *m_p_vram; + UINT8 *m_p_chargen; +private: + UINT8 m_4c; + UINT8 m_4e; + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; + required_device m_pit; + required_device m_dma; + required_device m_uart; +public: + required_device m_palette; +}; + +static ADDRESS_MAP_START( unior_mem, AS_PROGRAM, 8, unior_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xffff) AM_ROM AM_WRITE(vram_w) // main video +ADDRESS_MAP_END + +static ADDRESS_MAP_START( unior_io, AS_IO, 8, unior_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x30, 0x38) AM_DEVREADWRITE("dma", i8257_device, read, write) // dma data + AM_RANGE(0x3c, 0x3f) AM_DEVREADWRITE("ppi0", i8255_device, read, write) // cassette player control + AM_RANGE(0x4c, 0x4f) AM_DEVREADWRITE("ppi1", i8255_device, read, write) + AM_RANGE(0x50, 0x50) AM_WRITE(scroll_w) + AM_RANGE(0x60, 0x61) AM_DEVREADWRITE("crtc", i8275_device, read, write) + AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE("pit", pit8253_device, read, write ) + AM_RANGE(0xec, 0xec) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) + AM_RANGE(0xed, 0xed) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( unior ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // nothing + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // nothing + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) // cancel input + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) // Russian little M + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLK") PORT_CODE(KEYCODE_NUMLOCK) // switches 1st indicator between N and B - numlock? rctrl + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') // ; + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) // switches 2nd indicator between U and B - capslock? rshift + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) // A + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') // ^ (') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) // B + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) // H + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) // I + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) // C + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) // G + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_HOME) PORT_CHAR(10) // line feed? + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') // I then hangs + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) // Russian A + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) // ? (/) + + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) // D + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) // Russian bl + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) // Russian signpost + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // } (<>) + + PORT_START("X8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) // E + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') // > + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= :") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') // : + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') // = + + PORT_START("X9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) // Russian U + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_START("XA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') // (`) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') // < + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') +INPUT_PORTS_END + + +/************************************************* + + Video + +*************************************************/ + +/* F4 Character Displayer */ +static const gfx_layout unior_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( unior ) + GFXDECODE_ENTRY( "chargen", 0x0000, unior_charlayout, 0, 1 ) +GFXDECODE_END + +WRITE8_MEMBER( unior_state::vram_w ) +{ + m_p_vram[offset] = data; +} + +// pulses a 1 to scroll +WRITE8_MEMBER( unior_state::scroll_w ) +{ + if (data) + memcpy(m_p_vram, m_p_vram+80, 24*80); +} + +I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 gfx = m_p_chargen[(linecount & 7) | (charcode << 3)]; + + if(linecount == 8) + gfx = 0; + + if (vsp) + gfx = 0; + + if (lten) + gfx = 0xff; + + if (rvv) + gfx ^= 0xff; + + for(UINT8 i=0;i<6;i++) + bitmap.pix32(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0]; +} + +static const rgb_t unior_palette[3] = +{ + rgb_t(0x00, 0x00, 0x00), // black + rgb_t(0xa0, 0xa0, 0xa0), // white + rgb_t(0xff, 0xff, 0xff) // highlight +}; + +PALETTE_INIT_MEMBER(unior_state,unior) +{ + palette.set_pen_colors(0, unior_palette, ARRAY_LENGTH(unior_palette)); +} + + +/************************************************* + + i8255 + +*************************************************/ + + +WRITE_LINE_MEMBER(unior_state::write_uart_clock) +{ + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + +READ8_MEMBER( unior_state::ppi0_b_r ) +{ + return 0; +} + +WRITE8_MEMBER( unior_state::ppi0_b_w ) +{ +} + +READ8_MEMBER( unior_state::ppi1_a_r ) +{ + return m_4c; +} + +READ8_MEMBER( unior_state::ppi1_b_r ) +{ + char kbdrow[6]; + sprintf(kbdrow,"X%X", m_4c&15); + return ioport(kbdrow)->read(); +} + +READ8_MEMBER( unior_state::ppi1_c_r ) +{ + return m_4e; +} + +WRITE8_MEMBER( unior_state::ppi1_a_w ) +{ + m_4c = data; +} + +/* +d0,1,2 = connect to what might be a 74LS138, then to an external slot +d4 = speaker gate +d5 = unknown +d6 = connect to A7 of the palette prom +d7 = not used +*/ +WRITE8_MEMBER( unior_state::ppi1_c_w ) +{ + m_4e = data; + m_pit->write_gate2(BIT(data, 4)); +} + +/************************************************* + + i8257 + +*************************************************/ + +READ8_MEMBER(unior_state::dma_r) +{ + if (offset < 0xf800) + return m_maincpu->space(AS_PROGRAM).read_byte(offset); + else + return m_p_vram[offset & 0x7ff]; +} + +WRITE_LINE_MEMBER( unior_state::hrq_w ) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state); + m_dma->hlda_w(state); +} + + +/************************************************* + + Machine + +*************************************************/ + +void unior_state::machine_reset() +{ + m_maincpu->set_state_int(I8085_PC, 0xF800); +} + +void unior_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); + m_p_vram = memregion("vram")->base(); +} + +static MACHINE_CONFIG_START( unior, unior_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_20MHz / 9) + MCFG_CPU_PROGRAM_MAP(unior_mem) + MCFG_CPU_IO_MAP(unior_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", unior) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(unior_state,unior) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD("uart", I8251, 0) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_20MHz / 12) + MCFG_PIT8253_CLK1(XTAL_20MHz / 9) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(unior_state, write_uart_clock)) + MCFG_PIT8253_CLK2(XTAL_16MHz / 9 / 64) // unknown frequency + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) + + MCFG_DEVICE_ADD("ppi0", I8255, 0) + // ports a & c connect to an external slot + MCFG_I8255_IN_PORTB_CB(READ8(unior_state, ppi0_b_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(unior_state, ppi0_b_w)) + + MCFG_DEVICE_ADD("ppi1", I8255, 0) + // ports a & b are for the keyboard + // port c operates various control lines for mostly unknown purposes + MCFG_I8255_IN_PORTA_CB(READ8(unior_state, ppi1_a_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(unior_state, ppi1_a_w)) + MCFG_I8255_IN_PORTB_CB(READ8(unior_state, ppi1_b_r)) + MCFG_I8255_IN_PORTC_CB(READ8(unior_state, ppi1_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(unior_state, ppi1_c_w)) + + MCFG_DEVICE_ADD("dma", I8257, XTAL_20MHz / 9) + MCFG_I8257_OUT_HRQ_CB(WRITELINE(unior_state, hrq_w)) + MCFG_I8257_IN_MEMR_CB(READ8(unior_state, dma_r)) + MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("crtc", i8275_device, dack_w)) + + MCFG_DEVICE_ADD("crtc", I8275, XTAL_20MHz / 12) + MCFG_I8275_CHARACTER_WIDTH(6) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(unior_state, display_pixels) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma",i8257_device, dreq2_w)) + MCFG_VIDEO_SET_SCREEN("screen") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( unior ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "unior.rom", 0xf800, 0x0800, CRC(23a347e8) SHA1(2ef3134e2f4a696c3b52a145fa5a2d4c3487194b)) + + ROM_REGION( 0x0840, "chargen", ROMREGION_ERASEFF ) + ROM_LOAD( "unior.fnt", 0x0000, 0x0800, CRC(4f654828) SHA1(8c0ac11ea9679a439587952e4908940b67c4105e)) + // according to schematic this should be 256 bytes + ROM_LOAD( "palette.rom", 0x0800, 0x0040, CRC(b4574ceb) SHA1(f7a82c61ab137de8f6a99b0c5acf3ac79291f26a)) + + ROM_REGION( 0x0800, "vram", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, unior, radio86, 0, unior, unior, driver_device, 0, "", "Unior", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/unistar.c b/src/mame/drivers/unistar.c new file mode 100644 index 00000000000..6fe5817fe7c --- /dev/null +++ b/src/mame/drivers/unistar.c @@ -0,0 +1,125 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Callan Unistar Terminal + + 2009-12-09 Skeleton driver. + + Chips used: i8275, AM9513, i8085, i8237, i8255, 2x 2651. XTAL 20MHz + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" + + +class unistar_state : public driver_device +{ +public: + unistar_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(unistar); + UINT32 screen_update_unistar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + const UINT8 *m_p_chargen; +private: + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(unistar_mem, AS_PROGRAM, 8, unistar_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x2fff) AM_ROM + AM_RANGE(0x8000, 0x8fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(unistar_io, AS_IO, 8, unistar_state) + //ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // ports used: 00,02,03(W),08(RW),09,0A,0B,0D,0F(W),80,81(R),82,83(W),84(R),8C,8D(W),94(R),97,98(W),99(RW) + // if nonzero returned from port 94, it goes into test mode. +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( unistar ) +INPUT_PORTS_END + + +void unistar_state::machine_reset() +{ + m_p_chargen = memregion("chargen")->base(); +} + +PALETTE_INIT_MEMBER( unistar_state, unistar ) +{ + palette.set_pen_color(0, 0, 0, 0 ); /* Black */ + palette.set_pen_color(1, 0, 255, 0 ); /* Full */ + palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */ +} + +void unistar_state::video_start() +{ +} + +UINT32 unistar_state::screen_update_unistar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout unistar_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( unistar ) + GFXDECODE_ENTRY( "chargen", 0x0000, unistar_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( unistar, unistar_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8085A, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(unistar_mem) + MCFG_CPU_IO_MAP(unistar_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(unistar_state, screen_update_unistar) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", unistar) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(unistar_state, unistar) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( unistar ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "280010c.u48", 0x0000, 0x1000, CRC(613ef521) SHA1(a77459e91617d2882778ab2dada74fcb5f44e949)) + ROM_LOAD( "280011c.u49", 0x1000, 0x1000, CRC(6cc5e704) SHA1(fb93645f51d5ad0635cbc8a9174c61f96799313d)) + ROM_LOAD( "280012c.u50", 0x2000, 0x1000, CRC(0b9ca5a5) SHA1(20bf4aeacda14ff7a3cf988c7c0bff6ec60406c7)) + + ROM_REGION( 0x0800, "chargen", ROMREGION_ERASEFF ) + ROM_LOAD( "280014a.u1", 0x0000, 0x0800, CRC(a9e1b5b2) SHA1(6f5b597ee1417f1108ac5957b005a927acb5314a)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, unistar, 0, 0, unistar, unistar, driver_device, 0, "Callan Data Systems", "Unistar 200 Terminal", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/univac.c b/src/mame/drivers/univac.c new file mode 100644 index 00000000000..d26216c3bc5 --- /dev/null +++ b/src/mame/drivers/univac.c @@ -0,0 +1,214 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Univac Terminals + + The terminals are models UTS20, UTS30, UTS40, UTS50 and SVT1120, + however only the UTS20 is dumped (program roms only). + + 25/05/2009 Skeleton driver + + The terminal has 2 screens selectable by the operator with the Fn + 1-2 + buttons. Thus the user can have two sessions open at once, to different + mainframes or applications. + + Sound is a beeper. + + This driver is all guesswork; Unisys never released technical info + to customers. All parts on the PCBs have internal Unisys part numbers + instead of the manufacturer's numbers. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/nvram.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" + + +class univac_state : public driver_device +{ +public: + univac_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_p_videoram(*this, "videoram") + , m_nvram(*this, "nvram") + , m_ctc(*this, "ctc") + , m_dart(*this, "dart") + { } + + DECLARE_READ8_MEMBER(vram_r); + DECLARE_WRITE8_MEMBER(vram_w); + DECLARE_WRITE8_MEMBER(port43_w); + INTERRUPT_GEN_MEMBER(vblank_irq); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +private: + const UINT8 *m_p_chargen; + bool m_screen_num; + UINT8 m_framecnt; + virtual void machine_start(); + virtual void machine_reset(); + required_device m_maincpu; + required_shared_ptr m_p_videoram; + required_device m_nvram; + required_device m_ctc; + required_device m_dart; +}; + + + +WRITE8_MEMBER( univac_state::port43_w ) +{ + m_screen_num = BIT(data, 0); +} + +READ8_MEMBER( univac_state::vram_r ) +{ + offs_t offs = (offset & 0x1fff) ^ (BIT(offset, 13) ? 0x2000 : 0) ^ (m_screen_num ? 0x2000 : 0); + return m_p_videoram[offs]; +} + +WRITE8_MEMBER( univac_state::vram_w ) +{ + offs_t offs = (offset & 0x1fff) ^ (BIT(offset, 13) ? 0x2000 : 0) ^ (m_screen_num ? 0x2000 : 0); + m_p_videoram[offs] = data; +} + + +static ADDRESS_MAP_START(uts20_mem, AS_PROGRAM, 8, univac_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x4fff ) AM_ROM AM_REGION("roms", 0) + AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(vram_r,vram_w) + AM_RANGE( 0xc000, 0xffff ) AM_RAM AM_SHARE("videoram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( uts20_io, AS_IO, 8, univac_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + //AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("dart", z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("dart", z80dart_device, cd_ba_r, cd_ba_w) // ?? no idea + AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) + AM_RANGE(0x43, 0x43) AM_WRITE(port43_w) + AM_RANGE(0x80, 0xbf) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( uts20 ) +INPUT_PORTS_END + + +void univac_state::machine_start() +{ +// D7DC and D7DD are checked for valid RID and SID (usually 21 and 51) if not valid then NVRAM gets initialised. +} + +void univac_state::machine_reset() +{ + m_screen_num = 0; + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 univac_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // this is used to get the ctc to pass the test + bool state = BIT(m_framecnt,0); + m_ctc->trg0(state); + m_ctc->trg1(state); + m_ctc->trg2(state); + m_ctc->trg3(state); + + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + UINT8 *videoram = m_p_videoram;//+(m_screen_num ? 0x2000 : 0); + + m_framecnt++; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 80; x++) + { + chr = videoram[x]; + + /* Take care of 'corner' characters */ + if (((chr == 0x1c) || (chr == 0x1d)) && (m_framecnt & 16)) + chr = 0x20; + + gfx = (ra ? m_p_chargen[((chr & 0x7f)<<4) | (ra-1) ] : 0) ^ (BIT(chr, 7) ? 0xff : 0); + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=80; + } + return 0; +} + +static const z80_daisy_config daisy_chain[] = +{ + { "dart" }, + { "ctc" }, + { NULL } +}; + +static MACHINE_CONFIG_START( uts20, univac_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) // unknown clock + MCFG_CPU_PROGRAM_MAP(uts20_mem) + MCFG_CPU_IO_MAP(uts20_io) + MCFG_CPU_CONFIG(daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(univac_state, screen_update) + MCFG_SCREEN_SIZE(640, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) + MCFG_SCREEN_PALETTE("palette") + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_NVRAM_ADD_1FILL("nvram") + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_4MHz) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DART_ADD("dart", XTAL_4MHz, 0, 0, 0, 0 ) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( uts20 ) + ROM_REGION( 0x5000, "roms", ROMREGION_ERASEFF ) + ROM_LOAD( "uts20a.rom", 0x0000, 0x1000, CRC(1a7b4b4e) SHA1(c3732e25b4b7c7a80172e3fe55c77b923cf511eb) ) + ROM_LOAD( "uts20b.rom", 0x1000, 0x1000, CRC(7f8de87b) SHA1(a85f404ad9d560df831cc3e651a4b45e4ed30130) ) + ROM_LOAD( "uts20c.rom", 0x2000, 0x1000, CRC(4e334705) SHA1(ff1a730551b42f29d20af8ecc4495fd30567d35b) ) + ROM_LOAD( "uts20d.rom", 0x3000, 0x1000, CRC(76757cf7) SHA1(b0509d9a35366b21955f83ec3685163844c4dbf1) ) + ROM_LOAD( "uts20e.rom", 0x4000, 0x1000, CRC(0dfc8062) SHA1(cd681020bfb4829d4cebaf1b5bf618e67b55bda3) ) + ROM_FILL(0x2bd,1,0xaf) // test 2 + ROM_FILL(0x3c1,2,0xaf) // test 5 + ROM_FILL(0x928,1,0) + + /* character generator not dumped, using the one from 'c10' for now */ + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD("c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, uts20, 0, 0, uts20, uts20, driver_device, 0, "Sperry Univac", "UTS-20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/unixpc.c b/src/mame/drivers/unixpc.c new file mode 100644 index 00000000000..0372d6493d2 --- /dev/null +++ b/src/mame/drivers/unixpc.c @@ -0,0 +1,235 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + AT&T Unix PC series + + Skeleton driver + + Note: The 68k core needs restartable instruction support for this + to have a chance to run. + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "unixpc.lh" + + +/*************************************************************************** + DRIVER STATE +***************************************************************************/ + +class unixpc_state : public driver_device +{ +public: + unixpc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_wd2797(*this, "wd2797"), + m_floppy(*this, "wd2797:0:525dd"), + m_mapram(*this, "mapram"), + m_videoram(*this, "videoram"){ } + + required_device m_maincpu; + required_device m_ram; + required_device m_wd2797; + required_device m_floppy; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + virtual void machine_reset(); + + DECLARE_READ16_MEMBER( line_printer_r ); + DECLARE_WRITE16_MEMBER( misc_control_w ); + DECLARE_WRITE16_MEMBER( disk_control_w ); + DECLARE_WRITE16_MEMBER( romlmap_w ); + + DECLARE_WRITE_LINE_MEMBER( wd2797_intrq_w ); + DECLARE_WRITE_LINE_MEMBER( wd2797_drq_w ); + + required_shared_ptr m_mapram; + required_shared_ptr m_videoram; +}; + + +/*************************************************************************** + MEMORY +***************************************************************************/ + +WRITE16_MEMBER( unixpc_state::romlmap_w ) +{ + if (BIT(data, 15)) + space.install_ram(0x000000, 0x3fffff, m_ram->pointer()); + else + space.install_rom(0x000000, 0x3fffff, memregion("bootrom")->base()); +} + +void unixpc_state::machine_reset() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + // force ROM into lower mem on reset + romlmap_w(program, 0, 0, 0xffff); + + // reset cpu so that it can pickup the new values + m_maincpu->reset(); +} + + +/*************************************************************************** + MISC +***************************************************************************/ + +READ16_MEMBER( unixpc_state::line_printer_r ) +{ + UINT16 data = 0; + + data |= 1; // no dial tone detected + data |= 1 << 1; // no parity error + data |= 0 << 2; // hdc intrq + data |= m_wd2797->intrq_r() << 3; + + logerror("line_printer_r: %04x\n", data); + + return data; +} + +WRITE16_MEMBER( unixpc_state::misc_control_w ) +{ + logerror("misc_control_w: %04x\n", data); + + output_set_value("led_0", !BIT(data, 8)); + output_set_value("led_1", !BIT(data, 9)); + output_set_value("led_2", !BIT(data, 10)); + output_set_value("led_3", !BIT(data, 11)); +} + + +/*************************************************************************** + FLOPPY +***************************************************************************/ + +WRITE16_MEMBER( unixpc_state::disk_control_w ) +{ + logerror("disk_control_w: %04x\n", data); + + m_floppy->mon_w(!BIT(data, 5)); + + // bit 6 = floppy selected / not selected + if (BIT(data, 6)) + m_wd2797->set_floppy(m_floppy); + else + m_wd2797->set_floppy(NULL); +} + +WRITE_LINE_MEMBER( unixpc_state::wd2797_intrq_w ) +{ + logerror("wd2797_intrq_w: %d\n", state); +} + +WRITE_LINE_MEMBER( unixpc_state::wd2797_drq_w ) +{ + logerror("wd2797_drq_w: %d\n", state); +} + + +/*************************************************************************** + VIDEO +***************************************************************************/ + +UINT32 unixpc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int y = 0; y < 348; y++) + for (int x = 0; x < 720/16; x++) + for (int b = 0; b < 16; b++) + bitmap.pix16(y, x * 16 + b) = BIT(m_videoram[y * (720/16) + x], b); + + return 0; +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( unixpc_mem, AS_PROGRAM, 16, unixpc_state ) + AM_RANGE(0x000000, 0x3fffff) AM_RAMBANK("bank1") + AM_RANGE(0x400000, 0x4007ff) AM_RAM AM_SHARE("mapram") + AM_RANGE(0x420000, 0x427fff) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x470000, 0x470001) AM_READ(line_printer_r) + AM_RANGE(0x4a0000, 0x4a0001) AM_WRITE(misc_control_w) + AM_RANGE(0x4e0000, 0x4e0001) AM_WRITE(disk_control_w) + AM_RANGE(0x800000, 0xbfffff) AM_MIRROR(0x7fc000) AM_ROM AM_REGION("bootrom", 0) + AM_RANGE(0xe10000, 0xe10007) AM_DEVREADWRITE8("wd2797", wd_fdc_t, read, write, 0x00ff) + AM_RANGE(0xe43000, 0xe43001) AM_WRITE(romlmap_w) +ADDRESS_MAP_END + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START( unixpc ) +INPUT_PORTS_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static SLOT_INTERFACE_START( unixpc_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( unixpc, unixpc_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", M68010, XTAL_10MHz) + MCFG_CPU_PROGRAM_MAP(unixpc_mem) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_UPDATE_DRIVER(unixpc_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_20MHz, 896, 0, 720, 367, 0, 348) + MCFG_SCREEN_PALETTE("palette") + // vsync should actually last 17264 pixels + + MCFG_DEFAULT_LAYOUT(layout_unixpc) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1M") + MCFG_RAM_EXTRA_OPTIONS("2M") + + // floppy + MCFG_DEVICE_ADD("wd2797", WD2797, 1000000) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(unixpc_state, wd2797_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(unixpc_state, wd2797_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("wd2797:0", unixpc_floppies, "525dd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +// ROMs were provided by Michael Lee und imaged by Philip Pemberton +ROM_START( 3b1 ) + ROM_REGION16_BE(0x400000, "bootrom", 0) + ROM_LOAD16_BYTE("72-00617.15c", 0x000000, 0x002000, CRC(4e93ff40) SHA1(1a97c8d32ec862f7f5fa1032f1688b76ea0672cc)) + ROM_LOAD16_BYTE("72-00616.14c", 0x000001, 0x002000, CRC(c61f7ae0) SHA1(ab3ac29935a2a587a083c4d175a5376badd39058)) +ROM_END + + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1985, 3b1, 0, 0, unixpc, unixpc, driver_device, 0, "AT&T", "3B1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/ut88.c b/src/mame/drivers/ut88.c new file mode 100644 index 00000000000..029f929febe --- /dev/null +++ b/src/mame/drivers/ut88.c @@ -0,0 +1,264 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + UT88 driver by Miodrag Milanovic + + 09/03/2008 Keyboard fixed, sound added. + 06/03/2008 Preliminary driver. + +UT88MINI +******** +Need instructions... +When started you enter a one-key command, followed by whatever parameters +are needed. + +Pressing 1 will allow entry of bytes into RAM, however the system doesn't +allow you to view memory (afaik). + +Command 3 does a test of the display, however the rest are a mystery. + +Paste facility was tested but doesn't work, so all code remnants removed. + +****************************************************************************/ + +#include "includes/ut88.h" +#include "formats/rk_cas.h" +#include "ut88mini.lh" + +static GFXDECODE_START( ut88 ) + GFXDECODE_ENTRY( "chargen", 0x0000, ut88_charlayout, 0, 1 ) +GFXDECODE_END + +/* Address maps */ +static ADDRESS_MAP_START( ut88mini_mem, AS_PROGRAM, 8, ut88_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x03ff ) AM_ROM // System ROM + AM_RANGE( 0xc000, 0xc3ff ) AM_RAM // RAM + AM_RANGE( 0x9000, 0x9fff ) AM_WRITE(ut88mini_write_led) // 7seg LED +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ut88_mem, AS_PROGRAM, 8, ut88_state ) + AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("bank1") // First bank + AM_RANGE( 0x0800, 0xdfff ) AM_RAM // RAM + AM_RANGE( 0xe000, 0xe7ff ) AM_RAM // Video RAM (not used) + AM_RANGE( 0xe800, 0xefff ) AM_RAM AM_SHARE("p_videoram") // Video RAM + AM_RANGE( 0xf400, 0xf7ff ) AM_RAM // System RAM + AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ut88mini_io, AS_IO, 8, ut88_state ) + AM_RANGE( 0xA0, 0xA0) AM_READ(ut88mini_keyboard_r) + AM_RANGE( 0xA1, 0xA1) AM_READ(ut88_tape_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ut88_io, AS_IO, 8, ut88_state ) + AM_RANGE( 0x04, 0x07) AM_READWRITE(ut88_keyboard_r, ut88_keyboard_w) + AM_RANGE( 0xA1, 0xA1) AM_READWRITE(ut88_tape_r, ut88_sound_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( ut88 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( ut88mini ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_7) + + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_9) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_B) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_D) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_E) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_F) + + PORT_START("LINE2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) +INPUT_PORTS_END + +/* Machine driver */ +static MACHINE_CONFIG_START( ut88, ut88_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(ut88_mem) + MCFG_CPU_IO_MAP(ut88_io) + MCFG_MACHINE_RESET_OVERRIDE(ut88_state, ut88 ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(64*8, 28*8) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 28*8-1) + MCFG_VIDEO_START_OVERRIDE(ut88_state,ut88) + MCFG_SCREEN_UPDATE_DRIVER(ut88_state, screen_update_ut88) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", ut88 ) + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* Devices */ + MCFG_DEVICE_ADD("ppi8255", I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(ut88_state, ut88_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(ut88_state, ut88_8255_portb_r)) + MCFG_I8255_IN_PORTC_CB(READ8(ut88_state, ut88_8255_portc_r)) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rku_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("ut88_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","ut88") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( ut88mini, ut88_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 2000000) + MCFG_CPU_PROGRAM_MAP(ut88mini_mem) + MCFG_CPU_IO_MAP(ut88mini_io) + MCFG_MACHINE_START_OVERRIDE(ut88_state,ut88mini) + MCFG_MACHINE_RESET_OVERRIDE(ut88_state, ut88mini ) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_ut88mini) + + /* Cassette */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(rku_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("ut88_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","ut88") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( ut88 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ut88.rom", 0xf800, 0x0800, CRC(f433202e) SHA1(a5808a4f68fb10eb7f17f2a05c3b8479fec0e05d) ) + ROM_REGION(0x0800, "chargen",0) + ROM_LOAD ("ut88.fnt", 0x0000, 0x0800, CRC(874b4d29) SHA1(357efbb295cd9e47fa97d4d03f4f1859a915b5c3) ) +ROM_END + +ROM_START( ut88mini ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ut88mini.rom", 0x0000, 0x0400, CRC(ce9213ee) SHA1(16b71b3051a800386d664dbcc5983b783475d0c6) ) + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD( "ut88key1.rom", 0x0000, 0x0100, CRC(ecfe42c7) SHA1(d7f10bbb05934150c1a258db1c8b4eb65771af59) ) + ROM_LOAD( "ut88key2.rom", 0x0100, 0x0100, CRC(96324d23) SHA1(9dca3f639fc29d87df56505b3dde668ef2849da3) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, ut88mini, 0, 0, ut88mini, ut88mini, ut88_state, ut88mini, "", "UT-88 mini", 0) +COMP( 1989, ut88, ut88mini, 0, ut88, ut88, ut88_state, ut88, "", "UT-88", 0) diff --git a/src/mame/drivers/uzebox.c b/src/mame/drivers/uzebox.c new file mode 100644 index 00000000000..383e674be50 --- /dev/null +++ b/src/mame/drivers/uzebox.c @@ -0,0 +1,310 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Belogic Uzebox + + driver by Sandro Ronco + + TODO: + - Sound + - SDCard + +****************************************************************************/ + +#include "emu.h" +#include "cpu/avr8/avr8.h" +#include "sound/speaker.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "bus/snes_ctrl/ctrl.h" + +// overclocked to 8 * NTSC burst frequency +#define MASTER_CLOCK 28618180 + +#define INTERLACED 0 + +class uzebox_state : public driver_device +{ +public: + uzebox_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_ctrl1(*this, "ctrl1"), + m_ctrl2(*this, "ctrl2"), + m_speaker(*this, "speaker") + { } + + required_device m_maincpu; + required_device m_cart; + required_device m_ctrl1; + required_device m_ctrl2; + required_device m_speaker; + + DECLARE_READ8_MEMBER(port_a_r); + DECLARE_WRITE8_MEMBER(port_a_w); + DECLARE_READ8_MEMBER(port_b_r); + DECLARE_WRITE8_MEMBER(port_b_w); + DECLARE_READ8_MEMBER(port_c_r); + DECLARE_WRITE8_MEMBER(port_c_w); + DECLARE_READ8_MEMBER(port_d_r); + DECLARE_WRITE8_MEMBER(port_d_w); + + virtual void machine_start(); + virtual void machine_reset(); + void line_update(); + UINT32 screen_update_uzebox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(uzebox_cart); + +private: + int m_vpos; + UINT64 m_line_start_cycles; + UINT32 m_line_pos_cycles; + UINT8 m_port_a; + UINT8 m_port_b; + UINT8 m_port_c; + UINT8 m_port_d; + bitmap_rgb32 m_bitmap; +}; + +void uzebox_state::machine_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0xffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +void uzebox_state::machine_reset() +{ + m_vpos = 0; + m_line_start_cycles = 0; + m_line_pos_cycles = 0; + m_port_a = 0; + m_port_b = 0; + m_port_c = 0; + m_port_d = 0; +} + + +WRITE8_MEMBER(uzebox_state::port_a_w) +{ + // xxxx ---- NC + // ---- x--- SNES controller clk + // ---- -x-- SNES controller latch + // ---- --x- SNES controller P2 data + // ---- ---x SNES controller P1 data + + m_ctrl1->write_strobe(BIT(data, 2)); + m_ctrl2->write_strobe(BIT(data, 2)); + + UINT8 changed = m_port_a ^ data; + if ((changed & data & 0x08) || (changed & (~data) & 0x04)) + { + m_port_a &= ~0x03; + m_port_a |= m_ctrl1->read_pin4() ? 0 : 0x01; + m_port_a |= m_ctrl2->read_pin4() ? 0 : 0x02; + } + + m_port_a = (data & 0x0c) | (m_port_a & 0x03); +} + +READ8_MEMBER(uzebox_state::port_a_r) +{ + return m_port_a | 0xf0; +} + +WRITE8_MEMBER(uzebox_state::port_b_w) +{ + // xxx- ---- SDCard + // ---x ---- AD725 CE + // ---- x--- AD725 4FSC + // ---- -xx- NC + // ---- ---x AD725 HSYNC + + // AD725 CE is hard-wired to VCC in early revisions (C1, D1 and E1) + if ((m_port_b & 0x10) || ioport("AD725_CE")->read() == 0) + if ((m_port_b ^ data) & m_port_b & 0x01) + { + line_update(); + + UINT32 cycles = (UINT32)(m_maincpu->get_elapsed_cycles() - m_line_start_cycles); + if (cycles < 1000 && m_vpos >= 448) + m_vpos = INTERLACED ? ((m_vpos ^ 0x01) & 0x01) : 0; + else if (cycles > 1000) + m_vpos += 2; + + m_line_start_cycles = m_maincpu->get_elapsed_cycles(); + m_line_pos_cycles = 0; + } + + m_port_b = data; +} + +READ8_MEMBER(uzebox_state::port_b_r) +{ + return m_port_b; +} + +WRITE8_MEMBER(uzebox_state::port_c_w) +{ + // xx-- ---- blue + // --xx x--- green + // ---- -xxx red + + line_update(); + m_port_c = data; +} + +READ8_MEMBER(uzebox_state::port_c_r) +{ + return m_port_c; +} + +WRITE8_MEMBER(uzebox_state::port_d_w) +{ + // x--- ---- sound + // -x-- ---- SDCard CS + // ---x ---- LED + // --x- x--- NC + // ---- -x-- power + // ---- --xx UART MIDI + if ((m_port_d ^ data) & 0x80) + { + m_speaker->level_w(data & 0x80); + } + m_port_d = data; +} + +READ8_MEMBER(uzebox_state::port_d_r) +{ + return m_port_d; +} + + +/****************************************************\ +* Address maps * +\****************************************************/ + +static ADDRESS_MAP_START( uzebox_prg_map, AS_PROGRAM, 8, uzebox_state ) + AM_RANGE(0x0000, 0xffff) AM_ROM // 64 KB internal eprom ATmega644 +ADDRESS_MAP_END + +static ADDRESS_MAP_START( uzebox_data_map, AS_DATA, 8, uzebox_state ) + AM_RANGE(0x0100, 0x10ff) AM_RAM // 4KB RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( uzebox_io_map, AS_IO, 8, uzebox_state ) + AM_RANGE(AVR8_REG_A, AVR8_REG_A) AM_READWRITE( port_a_r, port_a_w ) + AM_RANGE(AVR8_REG_B, AVR8_REG_B) AM_READWRITE( port_b_r, port_b_w ) + AM_RANGE(AVR8_REG_C, AVR8_REG_C) AM_READWRITE( port_c_r, port_c_w ) + AM_RANGE(AVR8_REG_D, AVR8_REG_D) AM_READWRITE( port_d_r, port_d_w ) +ADDRESS_MAP_END + +/****************************************************\ +* Input ports * +\****************************************************/ + +static INPUT_PORTS_START( uzebox ) + PORT_START("AD725_CE") + PORT_CONFNAME( 0x01, 0x00, "AD725 CE" ) + PORT_CONFSETTING( 0x00, "VCC" ) + PORT_CONFSETTING( 0x01, "PB4" ) +INPUT_PORTS_END + +/****************************************************\ +* Video hardware * +\****************************************************/ + +void uzebox_state::line_update() +{ + UINT32 cycles = (UINT32)(m_maincpu->get_elapsed_cycles() - m_line_start_cycles) / 2; + rgb_t color = rgb_t(pal3bit(m_port_c >> 0), pal3bit(m_port_c >> 3), pal2bit(m_port_c >> 6)); + + for (UINT32 x = m_line_pos_cycles; x < cycles; x++) + { + if (m_bitmap.cliprect().contains(x, m_vpos)) + m_bitmap.pix32(m_vpos, x) = color; + if (!INTERLACED) + if (m_bitmap.cliprect().contains(x, m_vpos + 1)) + m_bitmap.pix32(m_vpos + 1, x) = color; + } + + m_line_pos_cycles = cycles; +} + +UINT32 uzebox_state::screen_update_uzebox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + +DEVICE_IMAGE_LOAD_MEMBER(uzebox_state, uzebox_cart) +{ + UINT32 size = m_cart->common_get_size("rom"); + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + + if (image.software_entry() == NULL) + { + dynamic_buffer data(size); + image.fread(&data[0], size); + + if (!strncmp((const char*)&data[0], "UZEBOX", 6)) + memcpy(m_cart->get_rom_base(), &data[0x200], size - 0x200); + else + memcpy(m_cart->get_rom_base(), &data[0], size); + } + else + memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size); + + return IMAGE_INIT_PASS; +} + + +/****************************************************\ +* Machine definition * +\****************************************************/ + +static MACHINE_CONFIG_START( uzebox, uzebox_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", ATMEGA644, MASTER_CLOCK) + MCFG_CPU_PROGRAM_MAP(uzebox_prg_map) + MCFG_CPU_DATA_MAP(uzebox_data_map) + MCFG_CPU_IO_MAP(uzebox_io_map) + MCFG_CPU_AVR8_EEPROM("eeprom") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(59.99) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1395)) + MCFG_SCREEN_SIZE(870, 525) + MCFG_SCREEN_VISIBLE_AREA(150, 870-1, 40, 488-1) + MCFG_SCREEN_UPDATE_DRIVER(uzebox_state, screen_update_uzebox) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(0, "mono", 1.00) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "uzebox") + MCFG_GENERIC_EXTENSIONS("bin,uze") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(uzebox_state, uzebox_cart) + + MCFG_SNES_CONTROL_PORT_ADD("ctrl1", snes_control_port_devices, "joypad") + MCFG_SNES_CONTROL_PORT_ADD("ctrl2", snes_control_port_devices, "joypad") + + MCFG_SOFTWARE_LIST_ADD("eprom_list","uzebox") +MACHINE_CONFIG_END + +ROM_START( uzebox ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) /* Main program store */ + + ROM_REGION( 0x800, "eeprom", ROMREGION_ERASE00 ) /* on-die eeprom */ +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS(2010, uzebox, 0, 0, uzebox, uzebox, driver_device, 0, "Belogic", "Uzebox", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/v1050.c b/src/mame/drivers/v1050.c new file mode 100644 index 00000000000..8461bb815fc --- /dev/null +++ b/src/mame/drivers/v1050.c @@ -0,0 +1,1148 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Visual 1050 + +PCB Layout +---------- + +REV B-1 + +|---------------------------------------------------------------------------------------------------| +| |----------| | +| 9216 | ROM0 | LS74 | +| |----------| | +-- LS00 7406 LS255 LS393 4164 4164 | +|| |-----------| |----------| | +|| | WD1793 | LS14 7407 - LS393 LS74 | 8251A | 4164 4164 | +|| |-----------| | |----------| | +|C | 4164 4164 | +|N 7406 LS00 LS74 LS14 |C LS20 LS08 LS75 | +|1 |N 4164 4164 | +|| |5 | +|| 7406 LS195 LS244 | LS04 LS32 LS08 4164 4164 | +|| - | +|| |------------| |--------| 4164 4164 | +-- BAT | 8255A | | 8214 | LS139 LS32 LS138 LS17 | +-- |------------| |--------| - 4164 4164 | +|| |C | +|| |--------| LS00 LS00 |N LS00 LS32 LS138 4164 4164 | +|C | 8251A | |6 | +|N |--------| |------------| - |------------| | +|2 | 8255A | | Z80A | | +|| 1488 1489 RTC |------------| LS00 LS32 |------------| LS257 LS257 | +|| | +-- |------------| |------------| | +| LS04 | 8255A | | 8255A | | +| |------------| |------------| | +| | +| 7404 LS257 LS257 | +| 16MHz | +| LS04 LS74 LS257 9016 9016 | +| | +-- LS74 LS04 LS74 LS163 9016 9016 | +|| | +|| 9016 9016 | +|| LS02 LS163 LS74 7404 7404 | +|| 9016 9016 | +|| | +|C LS244 LS10 LS257 LS362 |----------| 9016 9016 | +|N | ROM1 | | +|3 LS245 7404 LS273 LS32 |----------| 9016 9016 | +|| | +|| 7407 LS174 LS32 9016 9016 | +|| 15.36MHz | +|| |------------| 9016 9016 | +-- LS09 LS04 LS12 | 6502 | | +| |------------| 9016 9016 | +-- | +|C LS175 LS86 LS164 LS164 9016 9016 | +|N |------------| | +|4 | 6845 | LS253 LS253 | +-- 7426 LS02 LS74 LS00 LS164 |------------| | +| LS253 LS253 | +| REV B-1 W/O 1059 S/N 492 | +|---------------------------------------------------------------------------------------------------| + +Notes: + All IC's shown. + + ROM0 - "IC 244-032 V1.0" + ROM1 - "IC 244-033 V1.0" + Z80A - Zilog Z8400APS Z80A CPU + 6502 - Synertek SY6502A CPU + 4164 - NEC D4164-2 64Kx1 Dynamic RAM + 9016 - AMD AM9016EPC 16Kx1 Dynamic RAM + 8214 - NEC uPB8214C Priority Interrupt Control Unit + 8255A - NEC D8255AC-5 Programmable Peripheral Interface + 8251A - NEC D8251AC Programmable Communication Interface + WD1793 - Mitsubishi MB8877 Floppy Disc Controller + 9216 - SMC FDC9216 Floppy Disk Data Separator + 1488 - Motorola MC1488 Quad Line EIA-232D Driver + 1489 - Motorola MC1489 Quad Line Receivers + 6845 - Hitachi HD46505SP CRT Controller + RTC - OKI MSM58321RS Real Time Clock + BAT - 3.4V battery + CN1 - parallel connector + CN2 - serial connector + CN3 - winchester connector + CN4 - monitor connector + CN5 - floppy data connector + CN6 - floppy power connector + +*/ + +/* + + Using the hard disk + ------------------- + + Use the chdman utility to create a Tandon TM501 (5MB) or CMI CM-5412 (10MB) hard disk image: + + $ chdman createhd -chs 306,2,32 -ss 256 -o tm501.chd + $ chdman createhd -chs 306,4,32 -ss 256 -o cm5412.chd + + Start the Visual 1050 emulator with the floppy and hard disk images mounted: + + $ mess v1050 -flop1 cpm3:flop2 -hard tm501.chd + $ mess v1050 -flop1 cpm3:flop2 -hard cm5412.chd + + Start the Winchester Format Program from the CP/M prompt: + + A>fmtwinch + + Enter Y to continue. + Enter A for 5MB, or B for 10MB hard disk. + Enter C to start formatting. + + Once the formatting is complete, the CP/M system files need to be copied over to the hard disk: + + A>copysys + + Enter source drive name "a" and press RETURN. + Enter target drive name "c" and press RETURN. + Enter "y" at the prompt for CPM3.SYS. + Enter "y" at the prompt for CCP.COM. + Press RETURN to return to CP/M. + + You can now boot from the hard disk with: + + $ mess v1050 -hard tm501.chd + $ mess v1050 -hard cm5412.chd + + Or skip all of the above and use the preformatted images in the software list: + + $ mess v1050 -hard cpm3hd5 + $ mess v1050 -hard cpm3hd10 + +*/ + +/* + + TODO: + + - floppy 1 is broken + - write to banked RAM at 0x0000-0x1fff when ROM is active + - real keyboard w/i8049 + - keyboard beeper (NE555 wired in strange mix of astable/monostable modes) + +*/ + +#include "includes/v1050.h" +#include "bus/rs232/rs232.h" + +void v1050_state::set_interrupt(UINT8 mask, int state) +{ + if (state) + { + m_int_state |= mask; + } + else + { + m_int_state &= ~mask; + } + + m_pic->r_w(~(m_int_state & m_int_mask)); +} + +void v1050_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + int bank = (m_bank >> 1) & 0x03; + + if (BIT(m_bank, 0)) + { + program.install_readwrite_bank(0x0000, 0x1fff, "bank1"); + membank("bank1")->set_entry(bank); + } + else + { + program.install_read_bank(0x0000, 0x1fff, "bank1"); + program.unmap_write(0x0000, 0x1fff); + membank("bank1")->set_entry(3); + } + + membank("bank2")->set_entry(bank); + + if (bank == 2) + { + program.unmap_readwrite(0x4000, 0xbfff); + } + else + { + program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); + program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); + membank("bank3")->set_entry(bank); + membank("bank4")->set_entry(bank); + } + + membank("bank5")->set_entry(bank); +} + +// Keyboard HACK + +static const UINT8 V1050_KEYCODES[4][12][8] = +{ + { // unshifted + { 0xc0, 0xd4, 0xd8, 0xdc, 0xe0, 0xe4, 0xe8, 0xec }, + { 0xf0, 0xfc, 0x90, 0xf4, 0xf8, 0x94, 0xc4, 0xc8 }, + { 0xcc, 0xd0, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35 }, + { 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x60 }, + { 0x08, 0x88, 0x8c, 0x71, 0x77, 0x65, 0x72, 0x74 }, + { 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d }, + { 0x7f, 0x00, 0x80, 0x61, 0x73, 0x64, 0x66, 0x67 }, + { 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27, 0x5c, 0x84 }, + { 0x00, 0x7a, 0x78, 0x63, 0x76, 0x62, 0x6e, 0x6d }, + { 0x2c, 0x2e, 0x2f, 0x00, 0x0a, 0x20, 0x81, 0x82 }, + { 0xb7, 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac }, + { 0xb1, 0xb2, 0xb3, 0x83, 0xb0, 0xae, 0x00, 0x00 }, + }, + + { // shifted + { 0xc1, 0xd5, 0xd9, 0xdd, 0xe1, 0xe5, 0xe9, 0xed }, + { 0xf1, 0xfd, 0x91, 0xf5, 0xf9, 0x95, 0xc5, 0xc9 }, + { 0xcd, 0xd1, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25 }, + { 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x7e }, + { 0x08, 0x89, 0x8d, 0x51, 0x57, 0x45, 0x52, 0x54 }, + { 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d, 0x0d }, + { 0x7f, 0x00, 0x80, 0x41, 0x53, 0x44, 0x46, 0x47 }, + { 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22, 0x7c, 0x85 }, + { 0x00, 0x5a, 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d }, + { 0x3c, 0x3e, 0x3f, 0x0a, 0x20, 0x81, 0x82, 0xb7 }, + { 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac, 0xb1 }, + { 0xb2, 0xb3, 0x83, 0xb0, 0xa0, 0x00, 0x00, 0x00 }, + }, + + { // control + { 0xc2, 0xd6, 0xda, 0xde, 0xe2, 0xe6, 0xea, 0xee }, + { 0xf2, 0xfe, 0x92, 0xf6, 0xfa, 0x96, 0xc6, 0xca }, + { 0xce, 0xd2, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35 }, + { 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x00 }, + { 0x08, 0x8a, 0x8e, 0x11, 0x17, 0x05, 0x12, 0x14 }, + { 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d, 0x0d }, + { 0x7f, 0x00, 0x80, 0x01, 0x13, 0x04, 0x06, 0x07 }, + { 0x08, 0x0a, 0x0b, 0x0c, 0x3b, 0x27, 0x1c, 0x86 }, + { 0x00, 0x1a, 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d }, + { 0x2c, 0x2e, 0x2f, 0x0a, 0x20, 0x81, 0x82, 0xb7 }, + { 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac, 0xb1 }, + { 0xb2, 0xb3, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 }, + }, + + { // shift & control + { 0xc3, 0xd7, 0xdb, 0xdf, 0xe3, 0xe7, 0xeb, 0xef }, + { 0xf3, 0xff, 0x93, 0xf7, 0xfb, 0x97, 0xc7, 0xcb }, + { 0xcf, 0xd3, 0x1b, 0x21, 0x00, 0x23, 0x24, 0x25 }, + { 0x1e, 0x26, 0x2a, 0x28, 0x29, 0x1f, 0x2b, 0x1e }, + { 0x08, 0x8b, 0x8f, 0x11, 0x17, 0x05, 0x12, 0x14 }, + { 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d, 0x0d }, + { 0x7f, 0x00, 0x80, 0x01, 0x13, 0x04, 0x06, 0x07 }, + { 0x08, 0x0a, 0x0b, 0x0c, 0x3a, 0x22, 0x1c, 0x87 }, + { 0x00, 0x1a, 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d }, + { 0x3c, 0x3e, 0x3f, 0x0a, 0x20, 0x81, 0x82, 0xb7 }, + { 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac, 0xb1 }, + { 0xb2, 0xb3, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 }, + } +}; + +void v1050_state::scan_keyboard() +{ + static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9", "ROW10", "ROW11" }; + int table = 0, row, col; + int keydata = 0xff; + + UINT8 line_mod = ioport("ROW12")->read(); + + if((line_mod & 0x07) && (line_mod & 0x18)) + { + table = 3; // shift & control + } + else if (line_mod & 0x07) + { + table = 1; // shifted + } + else if (line_mod & 0x18) + { + table = 2; // ctrl + } + + // scan keyboard + for (row = 0; row < 12; row++) + { + UINT8 data = ioport(keynames[row])->read(); + + for (col = 0; col < 8; col++) + { + if (!BIT(data, col)) + { + // latch key data + keydata = V1050_KEYCODES[table][row][col]; + + if (m_keydata != keydata) + { + m_keydata = keydata; + m_keyavail = 1; + + set_interrupt(INT_KEYBOARD, 1); + return; + } + } + } + } + + m_keydata = keydata; +} + +TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::v1050_keyboard_tick) +{ + scan_keyboard(); +} + +READ8_MEMBER( v1050_state::kb_data_r ) +{ + m_keyavail = 0; + + set_interrupt(INT_KEYBOARD, 0); + + return m_keydata; +} + +READ8_MEMBER( v1050_state::kb_status_r ) +{ + UINT8 val = m_uart_kb->status_r(space, 0); + + return val | (m_keyavail ? 0x02 : 0x00); +} + +// Z80 Read/Write Handlers + +WRITE8_MEMBER( v1050_state::v1050_i8214_w ) +{ + m_pic->b_w((data >> 1) & 0x07); + m_pic->sgs_w(BIT(data, 4)); +} + +READ8_MEMBER( v1050_state::vint_clr_r ) +{ + set_interrupt(INT_VSYNC, 0); + + return 0xff; +} + +WRITE8_MEMBER( v1050_state::vint_clr_w ) +{ + set_interrupt(INT_VSYNC, 0); +} + +READ8_MEMBER( v1050_state::dint_clr_r ) +{ + set_interrupt(INT_DISPLAY, 0); + + return 0xff; +} + +WRITE8_MEMBER( v1050_state::dint_clr_w ) +{ + set_interrupt(INT_DISPLAY, 0); +} + +WRITE8_MEMBER( v1050_state::bank_w ) +{ + m_bank = data; + + bankswitch(); +} + +// SY6502A Read/Write Handlers + +WRITE8_MEMBER( v1050_state::dint_w ) +{ + set_interrupt(INT_DISPLAY, 1); +} + +WRITE8_MEMBER( v1050_state::dvint_clr_w ) +{ + m_subcpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); +} + +WRITE8_MEMBER( v1050_state::sasi_data_w ) +{ + m_sasi_data = data; + + if (m_sasi_data_enable) + { + m_sasi_data_out->write(m_sasi_data); + } +} + +WRITE_LINE_MEMBER( v1050_state::write_sasi_io ) +{ + m_sasi_ctrl_in->write_bit4(state); + + m_sasi_data_enable = state; + + if (m_sasi_data_enable) + { + m_sasi_data_out->write(m_sasi_data); + } + else + { + m_sasi_data_out->write(0); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sasi_ack_tick) +{ + m_sasibus->write_ack(0); +} + +TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sasi_rst_tick) +{ + m_sasibus->write_rst(0); +} + +WRITE8_MEMBER( v1050_state::sasi_ctrl_w ) +{ + /* + + bit description + + 0 SEL + 1 ACK + 2 + 3 + 4 + 5 + 6 + 7 RST + + */ + + m_sasibus->write_sel(BIT(data, 0)); + + if (BIT(data, 1)) + { + // send acknowledge pulse + m_sasibus->write_ack(1); + + m_timer_ack->adjust(attotime::from_nsec(100)); + } + + if (BIT(data, 7)) + { + // send reset pulse + m_sasibus->write_rst(1); + + m_timer_rst->adjust(attotime::from_nsec(100)); + } +} + +// Memory Maps + +static ADDRESS_MAP_START( v1050_mem, AS_PROGRAM, 8, v1050_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") + AM_RANGE(0x2000, 0x3fff) AM_RAMBANK("bank2") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank3") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank4") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank5") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( v1050_io, AS_IO, 8, v1050_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(I8255A_DISP_TAG, i8255_device, read, write) +// AM_RANGE(0x88, 0x88) AM_DEVREADWRITE(I8251A_KB_TAG, i8251_device, data_r, data_w) +// AM_RANGE(0x89, 0x89) AM_DEVREADWRITE(I8251A_KB_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x88, 0x88) AM_READ(kb_data_r) AM_DEVWRITE(I8251A_KB_TAG, i8251_device, data_w) + AM_RANGE(0x89, 0x89) AM_READ(kb_status_r) AM_DEVWRITE(I8251A_KB_TAG, i8251_device, control_w) + AM_RANGE(0x8c, 0x8c) AM_DEVREADWRITE(I8251A_SIO_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x8d, 0x8d) AM_DEVREADWRITE(I8251A_SIO_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x90, 0x93) AM_DEVREADWRITE(I8255A_MISC_TAG, i8255_device, read, write) + AM_RANGE(0x94, 0x97) AM_DEVREADWRITE(MB8877_TAG, mb8877_t, read, write) + AM_RANGE(0x9c, 0x9f) AM_DEVREADWRITE(I8255A_RTC_TAG, i8255_device, read, write) + AM_RANGE(0xa0, 0xa0) AM_READWRITE(vint_clr_r, vint_clr_w) + AM_RANGE(0xb0, 0xb0) AM_READWRITE(dint_clr_r, dint_clr_w) + AM_RANGE(0xc0, 0xc0) AM_WRITE(v1050_i8214_w) + AM_RANGE(0xd0, 0xd0) AM_WRITE(bank_w) + AM_RANGE(0xe0, 0xe0) AM_WRITE(sasi_data_w) AM_DEVREAD("scsi_data_in", input_buffer_device, read) + AM_RANGE(0xe1, 0xe1) AM_DEVREAD("scsi_ctrl_in", input_buffer_device, read) AM_WRITE(sasi_ctrl_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( v1050_crt_mem, AS_PROGRAM, 8, v1050_state ) + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(videoram_r, videoram_w) AM_SHARE("video_ram") + AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(H46505_TAG, mc6845_device, address_w) + AM_RANGE(0x8001, 0x8001) AM_DEVREADWRITE(H46505_TAG, mc6845_device, register_r, register_w) + AM_RANGE(0x9000, 0x9003) AM_DEVREADWRITE(I8255A_M6502_TAG, i8255_device, read, write) + AM_RANGE(0xa000, 0xa000) AM_READWRITE(attr_r, attr_w) + AM_RANGE(0xb000, 0xb000) AM_WRITE(dint_w) + AM_RANGE(0xc000, 0xc000) AM_WRITE(dvint_clr_w) + AM_RANGE(0xe000, 0xffff) AM_ROM +ADDRESS_MAP_END + +// Input Ports + +static INPUT_PORTS_START( v1050 ) + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // HELP + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F14) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F15) + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // F16 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) // F17 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_PAUSE) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SCRLOCK) + + PORT_START("ROW8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SHIFT + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("ROW9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SHIFT + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) // DOWN + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) // UP + + PORT_START("ROW10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("ROW11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("ROW12") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) +INPUT_PORTS_END + +// 8214 Interface + +WRITE_LINE_MEMBER(v1050_state::pic_int_w) +{ + if (state == ASSERT_LINE) + { + m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + } +} + +// Display 8255A Interface + +WRITE8_MEMBER(v1050_state::disp_ppi_pc_w) +{ + m_ppi_6502->pc2_w(BIT(data, 6)); + m_ppi_6502->pc4_w(BIT(data, 7)); +} + +WRITE8_MEMBER(v1050_state::m6502_ppi_pc_w) +{ + m_ppi_disp->pc2_w(BIT(data, 7)); + m_ppi_disp->pc4_w(BIT(data, 6)); +} + +// Miscellanous 8255A Interface + +WRITE8_MEMBER( v1050_state::misc_ppi_pa_w ) +{ + /* + + bit signal description + + PA0 f_ds<0> drive 0 select + PA1 f_ds<1> drive 1 select + PA2 f_ds<2> drive 2 select + PA3 f_ds<3> drive 3 select + PA4 f_side_1 floppy side select + PA5 f_pre_comp precompensation + PA6 f_motor_on* floppy motor + PA7 f_dden* double density select + + */ + + // floppy drive select + floppy_image_device *floppy = NULL; + + if (!BIT(data, 0)) floppy = m_floppy0->get_device(); + if (!BIT(data, 1)) floppy = m_floppy1->get_device(); + if (!BIT(data, 2)) floppy = m_floppy2->get_device(); + if (!BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + + // floppy side select + if (floppy) floppy->ss_w(BIT(data, 4)); + + // floppy motor + if (floppy) floppy->mon_w(BIT(data, 6)); + + // density select + m_fdc->dden_w(BIT(data, 7)); +} + +WRITE_LINE_MEMBER(v1050_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER(v1050_state::write_centronics_perror) +{ + m_centronics_perror = state; +} + +READ8_MEMBER(v1050_state::misc_ppi_pc_r) +{ + /* + + bit signal description + + PC0 pr_strobe printer strobe + PC1 f_int_enb floppy interrupt enable + PC2 baud_sel_a + PC3 baud_sel_b + PC4 pr_busy* printer busy + PC5 pr_pe* printer paper end + PC6 + PC7 + + */ + + UINT8 data = 0; + + data |= m_centronics_busy << 4; + data |= m_centronics_perror << 5; + + return data; +} + +void v1050_state::set_baud_sel(int baud_sel) +{ + if (baud_sel != m_baud_sel) + { + int divider = 1; + + switch (baud_sel) + { + case 0: + divider = 13 * 16; // 19200 + break; + + case 1: + divider = 13 * 8; // 38400 + break; + + case 2: + divider = 8; // 500000 + break; + + case 3: + divider = 13 * 2; // 153600 + break; + } + + m_clock_sio->set_clock_scale((double) 1 / divider); + + m_baud_sel = baud_sel; + } +} + +WRITE8_MEMBER( v1050_state::misc_ppi_pc_w ) +{ + /* + + bit signal description + + PC0 pr_strobe printer strobe + PC1 f_int_enb floppy interrupt enable + PC2 baud_sel_a + PC3 baud_sel_b + PC4 pr_busy* printer busy + PC5 pr_pe* printer paper end + PC6 + PC7 + + */ + + // printer strobe + m_centronics->write_strobe(BIT(data, 0)); + + // floppy interrupt enable + m_f_int_enb = BIT(data, 1); + update_fdc(); + + // baud select + set_baud_sel((data >> 2) & 0x03); +} + +// Real Time Clock 8255A Interface + +WRITE8_MEMBER( v1050_state::rtc_ppi_pb_w ) +{ + /* + + bit signal description + + PB0 RS-232 + PB1 Winchester + PB2 keyboard + PB3 floppy disk interrupt + PB4 vertical interrupt + PB5 display interrupt + PB6 expansion B + PB7 expansion A + + */ + + m_int_mask = data; +} + +READ8_MEMBER( v1050_state::rtc_ppi_pa_r ) +{ + return m_rtc_ppi_pa; +} + +WRITE8_MEMBER( v1050_state::rtc_ppi_pa_w ) +{ + m_rtc->d0_w((data >> 0) & 1); + m_rtc->d1_w((data >> 1) & 1); + m_rtc->d2_w((data >> 2) & 1); + m_rtc->d3_w((data >> 3) & 1); +} + +READ8_MEMBER( v1050_state::rtc_ppi_pc_r ) +{ + /* + + bit signal description + + PC0 + PC1 + PC2 + PC3 clock busy + PC4 + PC5 + PC6 + PC7 + + */ + + return m_rtc_ppi_pc; +} + +WRITE8_MEMBER( v1050_state::rtc_ppi_pc_w ) +{ + /* + + bit signal description + + PC0 + PC1 + PC2 + PC3 + PC4 clock address write + PC5 clock data write + PC6 clock data read + PC7 clock device select + + */ + + m_rtc->address_write_w(BIT(data, 4)); + m_rtc->write_w(BIT(data, 5)); + m_rtc->read_w(BIT(data, 6)); + m_rtc->cs2_w(BIT(data, 7)); +} + +// Keyboard 8251A Interface + +WRITE_LINE_MEMBER(v1050_state::write_keyboard_clock) +{ + m_uart_kb->write_txc(state); + m_uart_kb->write_rxc(state); +} + +WRITE_LINE_MEMBER( v1050_state::kb_rxrdy_w ) +{ + set_interrupt(INT_KEYBOARD, state); +} + +// Serial 8251A Interface + +WRITE_LINE_MEMBER(v1050_state::write_sio_clock) +{ + m_uart_sio->write_txc(state); + m_uart_sio->write_rxc(state); +} + +WRITE_LINE_MEMBER( v1050_state::sio_rxrdy_w ) +{ + m_rxrdy = state; + + set_interrupt(INT_RS_232, m_rxrdy || m_txrdy); +} + +WRITE_LINE_MEMBER( v1050_state::sio_txrdy_w ) +{ + m_txrdy = state; + + set_interrupt(INT_RS_232, m_rxrdy || m_txrdy); +} + +// MB8877 Interface + +void v1050_state::update_fdc() +{ + if (m_f_int_enb) + { + set_interrupt(INT_FLOPPY, m_fdc_irq ? 1 : 0); + m_maincpu->set_input_line(INPUT_LINE_NMI, m_fdc_drq ? ASSERT_LINE : CLEAR_LINE); + } + else + { + set_interrupt(INT_FLOPPY, 0); + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + } +} + +// disk format: 80 tracks, 1 head, 10 sectors, 512 bytes sector length, first sector id 1 + +static SLOT_INTERFACE_START( v1050_floppies ) + SLOT_INTERFACE( "525ssqd", FLOPPY_525_SSQD ) // Teac FD 55E-02-U + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Teac FD 55-FV-35-U +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER( v1050_state::fdc_intrq_w ) +{ + m_fdc_irq = state; + + update_fdc(); +} + +WRITE_LINE_MEMBER( v1050_state::fdc_drq_w ) +{ + m_fdc_drq = state; + + update_fdc(); +} + + +// Machine Initialization + +IRQ_CALLBACK_MEMBER(v1050_state::v1050_int_ack) +{ + UINT8 vector = 0xf0 | (m_pic->a_r() << 1); + + //logerror("Interrupt Acknowledge Vector: %02x\n", vector); + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + + return vector; +} + +void v1050_state::machine_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + // initialize I8214 + m_pic->etlg_w(1); + m_pic->inte_w(1); + + // initialize RTC + m_rtc->cs1_w(1); + + // setup memory banking + UINT8 *ram = m_ram->pointer(); + + membank("bank1")->configure_entries(0, 2, ram, 0x10000); + membank("bank1")->configure_entry(2, ram + 0x1c000); + membank("bank1")->configure_entry(3, m_rom->base()); + + program.install_readwrite_bank(0x2000, 0x3fff, "bank2"); + membank("bank2")->configure_entries(0, 2, ram + 0x2000, 0x10000); + membank("bank2")->configure_entry(2, ram + 0x1e000); + + program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); + membank("bank3")->configure_entries(0, 2, ram + 0x4000, 0x10000); + + program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); + membank("bank4")->configure_entries(0, 2, ram + 0x8000, 0x10000); + + program.install_readwrite_bank(0xc000, 0xffff, "bank5"); + membank("bank5")->configure_entries(0, 3, ram + 0xc000, 0); + + bankswitch(); + + // register for state saving + save_item(NAME(m_int_mask)); + save_item(NAME(m_int_state)); + save_item(NAME(m_f_int_enb)); + save_item(NAME(m_fdc_irq)); + save_item(NAME(m_fdc_drq)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_keydata)); + save_item(NAME(m_keyavail)); + save_item(NAME(m_rxrdy)); + save_item(NAME(m_txrdy)); + save_item(NAME(m_baud_sel)); + save_item(NAME(m_bank)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_perror)); +} + +void v1050_state::machine_reset() +{ + m_bank = 0; + bankswitch(); + + set_baud_sel(0); + + m_fdc->reset(); +} + +// Machine Driver + +static MACHINE_CONFIG_START( v1050, v1050_state ) + // basic machine hardware + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) + MCFG_CPU_PROGRAM_MAP(v1050_mem) + MCFG_CPU_IO_MAP(v1050_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(v1050_state,v1050_int_ack) + + MCFG_QUANTUM_PERFECT_CPU(Z80_TAG) + + MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_15_36MHz/16) + MCFG_CPU_PROGRAM_MAP(v1050_crt_mem) + MCFG_QUANTUM_PERFECT_CPU(M6502_TAG) + + // keyboard HACK + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", v1050_state, v1050_keyboard_tick, attotime::from_hz(60)) + + // video hardware + MCFG_FRAGMENT_ADD(v1050_video) + + // devices + MCFG_DEVICE_ADD(UPB8214_TAG, I8214, XTAL_16MHz/4) + MCFG_I8214_IRQ_CALLBACK(WRITELINE(v1050_state, pic_int_w)) + + MCFG_DEVICE_ADD(MSM58321RS_TAG, MSM58321, XTAL_32_768kHz) + MCFG_MSM58321_D0_HANDLER(WRITELINE(v1050_state, rtc_ppi_pa_0_w)) + MCFG_MSM58321_D1_HANDLER(WRITELINE(v1050_state, rtc_ppi_pa_1_w)) + MCFG_MSM58321_D2_HANDLER(WRITELINE(v1050_state, rtc_ppi_pa_2_w)) + MCFG_MSM58321_D3_HANDLER(WRITELINE(v1050_state, rtc_ppi_pa_3_w)) + MCFG_MSM58321_BUSY_HANDLER(WRITELINE(v1050_state, rtc_ppi_pc_3_w)) + + MCFG_DEVICE_ADD(I8255A_DISP_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(DEVREAD8(I8255A_M6502_TAG, i8255_device, pb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(v1050_state, disp_ppi_pc_w)) + + MCFG_DEVICE_ADD(I8255A_MISC_TAG, I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(v1050_state, misc_ppi_pa_w)) + MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_IN_PORTC_CB(READ8(v1050_state,misc_ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(v1050_state,misc_ppi_pc_w)) + + MCFG_DEVICE_ADD(I8255A_RTC_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(v1050_state, rtc_ppi_pa_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(v1050_state, rtc_ppi_pa_w)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(v1050_state, rtc_ppi_pb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(v1050_state, rtc_ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(v1050_state, rtc_ppi_pc_w)) + + MCFG_DEVICE_ADD(I8255A_M6502_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(DEVREAD8(I8255A_DISP_TAG, i8255_device, pb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(v1050_state, m6502_ppi_pc_w)) + + MCFG_DEVICE_ADD(I8251A_KB_TAG, I8251, 0/*XTAL_16MHz/8,*/) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(V1050_KEYBOARD_TAG, v1050_keyboard_device, si_w)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(v1050_state, kb_rxrdy_w)) + + MCFG_DEVICE_ADD(CLOCK_KB_TAG, CLOCK, XTAL_16MHz/4/13/8) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v1050_state, write_keyboard_clock)) + + // keyboard + MCFG_DEVICE_ADD(V1050_KEYBOARD_TAG, V1050_KEYBOARD, 0) + MCFG_V1050_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_KB_TAG, i8251_device, write_rxd)) + + MCFG_DEVICE_ADD(I8251A_SIO_TAG, I8251, 0/*XTAL_16MHz/8,*/) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(v1050_state, sio_rxrdy_w)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(v1050_state, sio_txrdy_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_SIO_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_SIO_TAG, i8251_device, write_dsr)) + + MCFG_DEVICE_ADD(CLOCK_SIO_TAG, CLOCK, XTAL_16MHz/4) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v1050_state, write_sio_clock)) + + MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(v1050_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(v1050_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", v1050_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":1", v1050_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":2", v1050_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":3", v1050_floppies, NULL, floppy_image_device::default_floppy_formats) + + // SASI bus + MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0) + MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") + MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit0)) MCFG_DEVCB_XOR(1) + MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit1)) + MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit2)) + MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3)) + MCFG_SCSI_IO_HANDLER(WRITELINE(v1050_state, write_sasi_io)) MCFG_DEVCB_XOR(1) // bit4 + MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", S1410, SCSI_ID_0) + + MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SASIBUS_TAG) + MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) + MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0) + + MCFG_TIMER_DRIVER_ADD(TIMER_ACK_TAG, v1050_state, sasi_ack_tick) + MCFG_TIMER_DRIVER_ADD(TIMER_RST_TAG, v1050_state, sasi_rst_tick) + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "v1050_flop") + MCFG_SOFTWARE_LIST_ADD("hdd_list", "v1050_hdd") + + // printer + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(v1050_state, write_centronics_busy)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(v1050_state, write_centronics_perror)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") +MACHINE_CONFIG_END + +// ROMs + +ROM_START( v1050 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "e244-032 rev 1.2.u86", 0x0000, 0x2000, CRC(46f847a7) SHA1(374db7a38a9e9230834ce015006e2f1996b9609a) ) + + ROM_REGION( 0x10000, M6502_TAG, 0 ) + ROM_LOAD( "e244-033 rev 1.1.u77", 0xe000, 0x2000, CRC(c0502b66) SHA1(bc0015f5b14f98110e652eef9f7c57c614683be5) ) +ROM_END + +// System Drivers + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, v1050, 0, 0, v1050, v1050, driver_device, 0, "Visual Technology Inc", "Visual 1050", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND | MACHINE_IMPERFECT_KEYBOARD ) diff --git a/src/mame/drivers/v6809.c b/src/mame/drivers/v6809.c new file mode 100644 index 00000000000..1b408d95335 --- /dev/null +++ b/src/mame/drivers/v6809.c @@ -0,0 +1,382 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Vegas 6809 + + Skeleton driver + +Devices: + +MC6809 cpu +MC6840 timer +MM58174 RTC +MB8876 (or FD1791) FDC +SY6545-1 CRTC +2x MC6821 PIA +2x MC6850 ACIA + +Memory ranges: + +0000-EFFF RAM +F000-F7FF Devices +F800-FFFF ROM + +Monitor commands: + +D boot from floppy (launch Flex OS) +F relaunch Flex +G go +M modify memory (. to exit) + +ToDo: + + - Colours (Looks like characters 0xc0-0xff produce coloured lores gfx). + + - Connect the RTC interrupt pin (not supported currently) + + - Find the missing character generator rom. + + - Enable sound, when what seems to be a 6840 bug is fixed. + + - Schematic is almost useless, riddled with omissions and errors. + All documents are in French, so no help there. The parts list + only has half of the parts. + + - Need software + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/6821pia.h" +#include "machine/6840ptm.h" +#include "machine/clock.h" +#include "video/mc6845.h" +#include "machine/6850acia.h" +#include "machine/mm58274c.h" +#include "machine/keyboard.h" +#include "sound/speaker.h" +#include "machine/wd_fdc.h" + +#define KEYBOARD_TAG "keyboard" + +class v6809_state : public driver_device +{ +public: + v6809_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_video_address(0), + m_pia0(*this, "pia0"), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "crtc"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_speaker(*this, "speaker"), + m_acia0(*this, "acia0"), + m_acia1(*this, "acia1"), + m_palette(*this, "palette") + { + } + + DECLARE_WRITE8_MEMBER(speaker_en_w); + DECLARE_WRITE8_MEMBER(speaker_w); + DECLARE_READ8_MEMBER(pb_r); + DECLARE_WRITE8_MEMBER(pa_w); + DECLARE_WRITE8_MEMBER(videoram_w); + DECLARE_WRITE8_MEMBER(v6809_address_w); + DECLARE_WRITE8_MEMBER(v6809_register_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + DECLARE_MACHINE_RESET(v6809); + MC6845_UPDATE_ROW(crtc_update_row); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); + + UINT8 *m_p_videoram; + const UINT8 *m_p_chargen; + UINT16 m_video_address; + +private: + bool m_speaker_en; + UINT8 m_video_index; + UINT8 m_term_data; + UINT8 m_vidbyte; + required_device m_pia0; + required_device m_maincpu; + required_device m_crtc; + required_device m_fdc; + required_device m_floppy0; + required_device m_speaker; + required_device m_acia0; + required_device m_acia1; +public: + required_device m_palette; +}; + + +static ADDRESS_MAP_START(v6809_mem, AS_PROGRAM, 8, v6809_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xf000) AM_MIRROR(0xfe) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(v6809_address_w) + AM_RANGE(0xf001, 0xf001) AM_MIRROR(0xfe) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(v6809_register_w) + AM_RANGE(0xf200, 0xf200) AM_MIRROR(0xff) AM_WRITE(videoram_w) + AM_RANGE(0xf504, 0xf504) AM_MIRROR(0x36) AM_DEVREADWRITE("acia0", acia6850_device, status_r, control_w) // modem + AM_RANGE(0xf505, 0xf505) AM_MIRROR(0x36) AM_DEVREADWRITE("acia0", acia6850_device, data_r, data_w) + AM_RANGE(0xf50c, 0xf50c) AM_MIRROR(0x36) AM_DEVREADWRITE("acia1", acia6850_device, status_r, control_w) // printer + AM_RANGE(0xf50d, 0xf50d) AM_MIRROR(0x36) AM_DEVREADWRITE("acia1", acia6850_device, data_r, data_w) + AM_RANGE(0xf600, 0xf603) AM_MIRROR(0x3c) AM_DEVREADWRITE("fdc", mb8876_t, read, write) + AM_RANGE(0xf640, 0xf64f) AM_MIRROR(0x30) AM_DEVREADWRITE("rtc", mm58274c_device, read, write) + AM_RANGE(0xf680, 0xf683) AM_MIRROR(0x3c) AM_DEVREADWRITE("pia0", pia6821_device, read, write) + AM_RANGE(0xf6c8, 0xf6cf) AM_MIRROR(0x08) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) + AM_RANGE(0xf6d0, 0xf6d3) AM_MIRROR(0x0c) AM_DEVREADWRITE("pia1", pia6821_device, read, write) + AM_RANGE(0xf800, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(v6809_io, AS_PROGRAM, 8, v6809_state) + AM_RANGE(0x0064, 0x0064) AM_WRITENOP +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( v6809 ) +INPUT_PORTS_END + +MACHINE_RESET_MEMBER( v6809_state, v6809) +{ + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("videoram")->base(); + m_term_data = 0; + m_pia0->cb1_w(1); +} + +// **** Video **** + +/* F4 Character Displayer */ +static const gfx_layout v6809_charlayout = +{ + 8, 10, /* 8 x 10 characters */ + 256, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( v6809 ) + GFXDECODE_ENTRY( "chargen", 0x0000, v6809_charlayout, 0, 1 ) +GFXDECODE_END + +MC6845_UPDATE_ROW( v6809_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + + /* Display a scanline of a character (8 pixels) */ + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} + +MC6845_ON_UPDATE_ADDR_CHANGED( v6809_state::crtc_update_addr ) +{ +/* not sure what goes in here - parameters passed are device, address, strobe */ + m_video_address = address & 0x7ff; +} + +WRITE8_MEMBER( v6809_state::videoram_w ) +{ + m_vidbyte = data; +} + +WRITE8_MEMBER( v6809_state::v6809_address_w ) +{ + m_crtc->address_w( space, 0, data ); + + m_video_index = data & 0x1f; + + if (m_video_index == 31) + m_p_videoram[m_video_address] = m_vidbyte; +} + +WRITE8_MEMBER( v6809_state::v6809_register_w ) +{ + UINT16 temp = m_video_address; + + m_crtc->register_w( space, 0, data ); + + // Get transparent address + if (m_video_index == 18) + m_video_address = ((data & 7) << 8 ) | (temp & 0xff); + else + if (m_video_index == 19) + m_video_address = data | (temp & 0xff00); +} + +// **** Keyboard **** + +WRITE8_MEMBER( v6809_state::kbd_put ) +{ + m_term_data = data; + m_pia0->cb1_w(0); + m_pia0->cb1_w(1); +} + +WRITE_LINE_MEMBER( v6809_state::write_acia_clock ) +{ + m_acia0->write_txc(state); + m_acia0->write_rxc(state); + m_acia1->write_txc(state); + m_acia1->write_rxc(state); +} + +READ8_MEMBER( v6809_state::pb_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +// can support 4 drives +WRITE8_MEMBER( v6809_state::pa_w ) +{ + floppy_image_device *floppy = NULL; + if ((data & 3) == 0) floppy = m_floppy0->get_device(); + //if ((data & 3) == 1) floppy = m_floppy1->get_device(); + //if ((data & 3) == 2) floppy = m_floppy2->get_device(); + //if ((data & 3) == 3) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + +// Bits 2 and 3 go to the floppy connector but are not documented + + if (floppy) + { + floppy->mon_w(0); + m_fdc->dden_w(BIT(data, 4)); + } +} + +// this should output 1 to enable sound, then output 0 after a short time +// however it continuously outputs 1 +WRITE8_MEMBER( v6809_state::speaker_en_w ) +{ + m_speaker_en = data; +} + +WRITE8_MEMBER( v6809_state::speaker_w ) +{ +// if (m_speaker_en) +// m_speaker->level_w(data); +} + +static SLOT_INTERFACE_START( v6809_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + + +// *** Machine **** + +static MACHINE_CONFIG_START( v6809, v6809_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6809, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(v6809_mem) + MCFG_CPU_IO_MAP(v6809_io) + MCFG_MACHINE_RESET_OVERRIDE(v6809_state, v6809) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", v6809) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_16MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(v6809_state, crtc_update_row) + MCFG_MC6845_ADDR_CHANGED_CB(v6809_state, crtc_update_addr) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(v6809_state, kbd_put)) + +// port A = drive select and 2 control lines ; port B = keyboard +// CB2 connects to the interrupt pin of the RTC (the rtc code doesn't support it) + MCFG_DEVICE_ADD("pia0", PIA6821, 0) + MCFG_PIA_READPB_HANDLER(READ8(v6809_state, pb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(v6809_state, pa_w)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) + +// no idea what this does + MCFG_DEVICE_ADD("pia1", PIA6821, 0) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) + + MCFG_DEVICE_ADD("ptm", PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(XTAL_16MHz / 4) + MCFG_PTM6840_EXTERNAL_CLOCKS(4000000/14, 4000000/14, 4000000/14/8) + MCFG_PTM6840_OUT1_CB(WRITE8(v6809_state, speaker_w)) + MCFG_PTM6840_OUT2_CB(WRITE8(v6809_state, speaker_en_w)) + MCFG_PTM6840_IRQ_CB(INPUTLINE("maincpu", M6809_IRQ_LINE)) + + MCFG_DEVICE_ADD("acia0", ACIA6850, 0) + + MCFG_DEVICE_ADD("acia1", ACIA6850, 0) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 10) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v6809_state, write_acia_clock)) + + MCFG_DEVICE_ADD("rtc", MM58274C, 0) +// this is all guess + MCFG_MM58274C_MODE24(0) // 12 hour + MCFG_MM58274C_DAY1(1) // monday + + MCFG_MB8876_ADD("fdc", XTAL_16MHz / 16) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", v6809_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( v6809 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "v6809.rom", 0xf800, 0x0800, CRC(54bf5f32) SHA1(10d1d70f0b51e2b90e5c29249d3eab4c6b0033a1) ) + + ROM_REGION( 0x800, "videoram", ROMREGION_ERASE00 ) + + /* character generator not dumped, using the one from 'h19' for now */ + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "2716_444-29_h19font.bin", 0x0000, 0x0800, BAD_DUMP CRC(d595ac1d) SHA1(130fb4ea8754106340c318592eec2d8a0deaf3d0)) + ROM_RELOAD(0x0800, 0x0800) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, v6809, 0, 0, v6809, v6809, driver_device, 0, "Microkit", "Vegas 6809", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/vax11.c b/src/mame/drivers/vax11.c new file mode 100644 index 00000000000..acf6e607316 --- /dev/null +++ b/src/mame/drivers/vax11.c @@ -0,0 +1,174 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + VAX-11 + + VAX-11/785 + ------- + M7459 TRS, TERMINATOR & SILO + M7460 KA785, SBL,CUP SBI LOW BITS + M7461 KA785, SBH,SBI + M7462 KA785, CAM, CACHE ADDRESS MATRIX + M7463 KA785, CDM, CACHE DATA MATRIX + M7464 KA785, TBM, CPU TRANSLATION BUFFER + M7465 KA785, IDP, CPU INSTRUCTION DATA + M7466 KA785, IRC, CPU INSTRUCTION DECODE + M7467 KA785, DPB, CPU DATA PATH B + M7468 KA785, DEP, CPU DATA PATH E + M7469 KA785, DDP, CPU DATA PATH D + M7470 KA785, DCP, CPU DATA PATH C + M7471 KA785, DAP, CPU DATA PATH A + M7472 KA785, CEW (CONDITION CODES, EXCEP + M7473 KA785, ICL (INTERRUPT CONTROL, LOW + M7474 KA785, CLK (CPU CLOCK) + M7475 KA785, JCS, JOINT CONTROL STORE + M7476 KA785, USC, MICRO SEQUENCER CONTROL + M7477 KA785, CIB, CPU CONSOLE INTERFACE + + +----------FP785--------+ + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 + M7459 M7460 M7461 M7462 M7463 M7464 M7465 M7466 M7467 M7468 M7469 M7470 M7471 M7472 M7473 M7474 M7475 M7475 UNUSED M7476 M7540 M7541 M7542 M7543 M7544 M7477 + TRS SBL SBH CAM CDM TBM IDP IRC DBP DEP DDP DCP DAP CEH ICL CLK JCS JCS USC FNM FMH FML FAD FCT CIB + + VAX-11/780 + ------- + M8237 TERMINATOR SILO + M8218 SBL LOW BIT INTERFACE + M8219 SBH HIGH BITS INTERFACE + M8220 CAM CPU CACHE ADAPTER MATRIX + M8221 CDM CPU CACHE DATA MATRIX + M8222 TBM CPU TRANSLATION BUFFER MATRIX + M8223 IRC CPU INSTRUCT DECODE&CLOCKS + M8224 IDP CPU INSTRUCTION DATA PATH + M8225 DBP DATA PATH B + M8226 DEP DATA PATH E + M8227 DDP DATA PATH D + M8228 DCP DATA PATH C + M8229 DAP DATA PATH A + M8230 CEH CPU CONDITION CODE + M8231 ICL CPU TRAPS AND INTERRUPT CONTROL + M8232 CLK CPU CLOCK + M8238 WCS KU780-A 2K WCS + M8234 PCS KA780-A PCS, PROM CONTROL STORE + M8235 USC MICRO SEQUENCE CONTROL + M8236 CIB CONSOLE INTERFACE + + +----------FP780--------+ + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 + M8237 M8218 M8219 M8220 M8221 M8222 M8223 M8224 M8225 M8226 M8227 M8228 M8229 M8230 M8231 M8232 M8233 M8233 M8234 M8235 M8285 M8286 M8287 M8288 M8289 M8236 + TRS SBL SBH CAM CDM TBM IDP IRC DBP DEP DDP DCP DAP CEH ICL CLK or or PCS USC FNM FMH FML FAD FCT CIB + M8238 M8238 + + + 02/08/2012 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/t11/t11.h" +#include "machine/terminal.h" +#include "machine/rx01.h" + +#define TERMINAL_TAG "terminal" + +class vax11_state : public driver_device +{ +public: + vax11_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ16_MEMBER( term_r ); + DECLARE_READ16_MEMBER( term_tx_status_r ); + DECLARE_READ16_MEMBER( term_rx_status_r ); + DECLARE_WRITE16_MEMBER( term_w ); + DECLARE_WRITE8_MEMBER( kbd_put ); + UINT8 m_term_data; + UINT16 m_term_status; +}; + +WRITE16_MEMBER(vax11_state::term_w) +{ + m_terminal->write(space, 0, data); +} + +READ16_MEMBER(vax11_state::term_r) +{ + m_term_status = 0x0000; + return m_term_data; +} + +READ16_MEMBER(vax11_state::term_tx_status_r) +{ // always ready + return 0xffff; +} + +READ16_MEMBER(vax11_state::term_rx_status_r) +{ + return m_term_status; +} + +static ADDRESS_MAP_START(vax11_mem, AS_PROGRAM, 16, vax11_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xbfff ) AM_RAM // RAM + AM_RANGE( 0xc000, 0xd7ff ) AM_ROM + + AM_RANGE( 0xfe78, 0xfe7b ) AM_DEVREADWRITE("rx01", rx01_device, read, write) + + AM_RANGE( 0xff70, 0xff71 ) AM_READ(term_rx_status_r) + AM_RANGE( 0xff72, 0xff73 ) AM_READ(term_r) + AM_RANGE( 0xff74, 0xff75 ) AM_READ(term_tx_status_r) + AM_RANGE( 0xff76, 0xff77 ) AM_WRITE(term_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vax11 ) +INPUT_PORTS_END + +WRITE8_MEMBER( vax11_state::kbd_put ) +{ + m_term_data = data; + m_term_status = 0xffff; +} + +static MACHINE_CONFIG_START( vax11, vax11_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) // Need proper CPU here + MCFG_T11_INITIAL_MODE(0 << 13) + MCFG_CPU_PROGRAM_MAP(vax11_mem) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(vax11_state, kbd_put)) + + MCFG_RX01_ADD("rx01") +MACHINE_CONFIG_END + +ROM_START( vax785 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // M7477 + ROMX_LOAD( "23-144f1-00.e56", 0xc000, 0x0400, CRC(99c1f117) SHA1(f05b6e97bf258392656058864abc1177379194da), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + ROMX_LOAD( "23-145f1-00.e68", 0xc000, 0x0400, CRC(098b63d2) SHA1(c2742aaccdac2921e1704c835ee5cef242cd7308), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + ROMX_LOAD( "23-146f1-00.e84", 0xc001, 0x0400, CRC(0f5f5d7b) SHA1(2fe325d2a78a8ce5146317cc39c084c4967c323c), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + ROMX_LOAD( "23-147f1-00.e72", 0xc001, 0x0400, CRC(bde386f2) SHA1(fcb5a1fa505912c5f44781619c9508cd142721e3), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + + ROMX_LOAD( "23-148f1-00.e58", 0xc800, 0x0400, CRC(fe4c61e3) SHA1(4641a236761692a8f45b14ed6a73f535d57c2daa), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + ROMX_LOAD( "23-149f1-00.e70", 0xc800, 0x0400, CRC(a13f5f8a) SHA1(6a9d3b5a71a3249f3b9491d541c9854e071a320c), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + ROMX_LOAD( "23-150f1-00.e87", 0xc801, 0x0400, CRC(ca8d6419) SHA1(6d9c3e1e2f5a35f92c82240fcede14645aa83340), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + ROMX_LOAD( "23-151f1-00.e74", 0xc801, 0x0400, CRC(58ce48d3) SHA1(230dbcab1470752befb6733a89e3612ad7fba10d), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + + ROMX_LOAD( "23-236f1-00.e57", 0xd000, 0x0400, CRC(6f23470a) SHA1(d90a0bc56f04c2830f8cfb6b870db207b96e75b1), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + ROMX_LOAD( "23-237f1-00.e69", 0xd000, 0x0400, CRC(2bf8cf0b) SHA1(6db79c5392b265e38b5b8b386528d7c138d995e9), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + ROMX_LOAD( "23-238f1-00.e85", 0xd001, 0x0400, CRC(ff569f71) SHA1(05985396047fb4639959000a1abe50d2f184deaa), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) + ROMX_LOAD( "23-239f1-00.e73", 0xd001, 0x0400, CRC(cec7abe3) SHA1(8b8b52bd46340c58efa5adef3f306e0cdcb77520), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) + +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, vax785, 0, 0, vax11, vax11, driver_device, 0, "Digital Equipment Corporation", "VAX-11/785", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/vboy.c b/src/mame/drivers/vboy.c new file mode 100644 index 00000000000..897c592231c --- /dev/null +++ b/src/mame/drivers/vboy.c @@ -0,0 +1,1397 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese, Miodrag Milanovic +/*************************************************************************** + + Nintendo Virtual Boy + + driver by Miodrag Milanovic & Angelo Salese + + Great info at http://www.goliathindustries.com/vb/ + and http://www.vr32.de/modules/dokuwiki/doku.php? + + TODO: + - sound is way incomplete + - various timing issues (irq & events aren't known) + - 3dtetris: missing gfxs on gameplay (writes to framebuffer) + - boundh: game is way too fast + - galactic: ball goes out of bounds sometimes? + - golf: missing gfxs on gameplay (writes to framebuffer) + - marioten: title screen logo is misplaced if Mario completes his animation + - nesterfb: once that you hit the pins, animation phase takes a while to start + - redalarm: gameplay doesn't work + - spaceinv: Taito logo only if you press the button, framebuffer? + - spaceinv: missing shots + - vlab: doesn't boot (irq issue?) + - wariolnd: brightness gets suddently darker during intro. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/v810/v810.h" +#include "audio/vboy.h" +#include "bus/vboy/slot.h" +#include "bus/vboy/rom.h" +#include "vboy.lh" + +#define READ_BGMAP(bgoffs) m_bgmap[(bgoffs) & 0xffff] +#define READ_WORLD(wldoffs) READ_BGMAP((0x1d800 >> 1) + wldoffs) +#define READ_COLTAB1(wldoffs) READ_BGMAP((0x1dc00 >> 1) + wldoffs) +#define READ_COLTAB2(wldoffs) READ_BGMAP((0x1de00 >> 1) + wldoffs) +#define READ_OBJECTS(wldoffs) READ_BGMAP((0x1e000 >> 1) + wldoffs) + +#define WRITE_OVR_TEMPDRAW_MAP(woffs, wdat) m_ovr_tempdraw_map[(woffs) & 0x3f] = wdat; +#define READ_OVR_TEMPDRAW_MAP(roffs) m_ovr_tempdraw_map[(roffs) & 0x3f]; + +#define READ_FONT(roffs) m_font[(roffs)&0x1ffff] + +// bit of magic here, we also write pre-flipped copies of the data to extra ram we've allocated +// to simplify the draw loop (we can just pass the flip / unused bits as the upper character bits) +// (all TILE words are in the format of ccxy -ttt tttt tttt +// where 'c' = palette, 'x/y' are flips, '-' is unused(?) and 't' is your basic tile number + +#define WRITE_FONT(woffs) \ + COMBINE_DATA(&m_font[woffs]); /* normal */ \ + UINT16 dat = m_font[woffs]; \ + m_font[((woffs) + 0x4000)] = dat; /* normal */ \ + m_font[((woffs) + 0x8000) ^ 7] = dat; /* flip y */ \ + m_font[((woffs) + 0xc000) ^ 7] = dat; /* flip y */ \ + dat = BITSWAP16(dat,1,0,3,2,5,4,7,6,9,8,11,10,13,12,15,14); \ + m_font[((woffs) + 0x10000)] = dat; /* flip x */ \ + m_font[((woffs) + 0x14000)] = dat; /* flip x */ \ + m_font[((woffs) + 0x18000) ^ 7] = dat; /* flip x+y */ \ + m_font[((woffs) + 0x1c000) ^ 7] = dat; /* flip x+y */ + + +/* FIXME: most if not all of these must be UINT8 */ +struct vboy_regs_t +{ + UINT32 lpc, lpc2, lpt, lpr; + UINT32 khb, klb; + UINT8 thb, tlb; + UINT32 tcr, wcr, kcr; +}; + +struct vip_regs_t +{ + UINT16 INTPND; + UINT16 INTENB; + UINT16 DPSTTS; + UINT16 DPCTRL; + UINT16 BRTA; + UINT16 BRTB; + UINT16 BRTC; + UINT16 REST; + UINT16 FRMCYC; + UINT16 CTA; + UINT16 XPSTTS; + UINT16 XPCTRL; + UINT16 VER; + UINT16 SPT[4]; + UINT16 GPLT[4]; + UINT16 JPLT[4]; + UINT16 BKCOL; +}; + +struct vboy_timer_t +{ + UINT16 count; + UINT16 latch; +}; + +struct vboy_timer_t; + +class vboy_state : public driver_device +{ +public: + vboy_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_maintimer(*this, "timer_main"), + m_palette(*this, "palette") + { + m_vip_regs.INTPND = 0; + m_vip_regs.INTENB = 0; + m_vip_regs.DPSTTS = 0; + m_vip_regs.DPCTRL = 0; + m_vip_regs.BRTA = 0; + m_vip_regs.BRTB = 0; + m_vip_regs.BRTC = 0; + m_vip_regs.REST = 0; + m_vip_regs.FRMCYC = 0; + m_vip_regs.CTA = 0; + m_vip_regs.XPSTTS = 0; + m_vip_regs.XPCTRL = 0; + m_vip_regs.VER = 0; + m_vip_regs.SPT[0] = 0; + m_vip_regs.SPT[1] = 0; + m_vip_regs.SPT[2] = 0; + m_vip_regs.SPT[3] = 0; + m_vip_regs.GPLT[0] = 0; + m_vip_regs.GPLT[1] = 0; + m_vip_regs.GPLT[2] = 0; + m_vip_regs.GPLT[3] = 0; + m_vip_regs.JPLT[0] = 0; + m_vip_regs.JPLT[1] = 0; + m_vip_regs.JPLT[2] = 0; + m_vip_regs.JPLT[3] = 0; + m_vip_regs.BKCOL = 0; + + m_vboy_regs.lpc = 0; + m_vboy_regs.lpc2 = 0; + m_vboy_regs.lpt = 0; + m_vboy_regs.lpr = 0; + m_vboy_regs.khb = 0; + m_vboy_regs.klb = 0; + m_vboy_regs.thb = 0; + m_vboy_regs.tlb = 0; + m_vboy_regs.tcr = 0; + m_vboy_regs.wcr = 0; + m_vboy_regs.kcr = 0x80; + + m_vboy_timer.count = 0; + m_vboy_timer.latch = 0; + } + + required_device m_maincpu; + required_device m_cart; + required_device m_maintimer; + required_device m_palette; + memory_region *m_cart_rom; + + DECLARE_READ32_MEMBER(io_r); + DECLARE_WRITE32_MEMBER(io_w); + DECLARE_READ16_MEMBER(vip_r); + DECLARE_WRITE16_MEMBER(vip_w); + DECLARE_WRITE16_MEMBER(font0_w); + DECLARE_WRITE16_MEMBER(font1_w); + DECLARE_WRITE16_MEMBER(font2_w); + DECLARE_WRITE16_MEMBER(font3_w); + DECLARE_READ16_MEMBER(font0_r); + DECLARE_READ16_MEMBER(font1_r); + DECLARE_READ16_MEMBER(font2_r); + DECLARE_READ16_MEMBER(font3_r); + DECLARE_WRITE16_MEMBER(vboy_bgmap_w); + DECLARE_READ16_MEMBER(vboy_bgmap_r); + DECLARE_READ8_MEMBER(lfb0_r); + DECLARE_READ8_MEMBER(lfb1_r); + DECLARE_READ8_MEMBER(rfb0_r); + DECLARE_READ8_MEMBER(rfb1_r); + DECLARE_WRITE8_MEMBER(lfb0_w); + DECLARE_WRITE8_MEMBER(lfb1_w); + DECLARE_WRITE8_MEMBER(rfb0_w); + DECLARE_WRITE8_MEMBER(rfb1_w); + UINT16 *m_font; + UINT16 *m_bgmap; + UINT8 *m_l_frame_0; + UINT8 *m_l_frame_1; + UINT8 *m_r_frame_0; + UINT8 *m_r_frame_1; + vboy_regs_t m_vboy_regs; + vip_regs_t m_vip_regs; + vboy_timer_t m_vboy_timer; + INT32 *m_ovr_tempdraw_map; + UINT16 m_frame_count; + UINT8 m_displayfb; + UINT8 m_drawfb; + UINT8 m_row_num; + attotime m_input_latch_time; + void m_timer_tick(void); + void m_scanline_tick(int scanline, UINT8 screen_type); + void m_set_irq(UINT16 irq_vector); + + void put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, UINT16 code, UINT8 pal); + void fill_ovr_char(UINT16 code, UINT8 pal); + INT8 get_bg_map_pixel(int num, int xpos, int ypos); + void draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 param_base, int mode, int gx, int gp, int gy, int mx, int mp, int my,int h, int w, + UINT16 x_mask, UINT16 y_mask, UINT8 ovr, bool right, int bg_map_num); + void draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 param_base, int gx, int gp, int gy, int h, int w, + UINT16 x_mask, UINT16 y_mask, UINT8 ovr, bool right, int bg_map_num); + UINT8 display_world(int num, bitmap_ind16 &bitmap, const rectangle &cliprect, bool right, int &cur_spt); + void m_set_brightness(void); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(vboy); + UINT32 screen_update_vboy_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_vboy_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(timer_main_tick); + TIMER_DEVICE_CALLBACK_MEMBER(timer_pad_tick); + TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineL); + TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineR); +}; + + +void vboy_state::video_start() +{ + // Allocate memory for temporary screens + m_ovr_tempdraw_map = auto_alloc_array_clear(machine(), INT32, 0x40); + + // Allocate memory for framebuffers + m_l_frame_0 = auto_alloc_array_clear(machine(), UINT8, 0x6000); + m_l_frame_1 = auto_alloc_array_clear(machine(), UINT8, 0x6000); + m_r_frame_0 = auto_alloc_array_clear(machine(), UINT8, 0x6000); + m_r_frame_1 = auto_alloc_array_clear(machine(), UINT8, 0x6000); + + m_font = auto_alloc_array_clear(machine(), UINT16, (0x8000 >> 1)*4 * 2); + m_bgmap = auto_alloc_array(machine(), UINT16, 0x20000 >> 1); + memset(m_bgmap, 0, sizeof(UINT16) * (0x20000 >> 1)); +} + +void vboy_state::put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, UINT16 code, UINT8 pal) +{ + UINT16 data; + UINT8 yi, xi, dat, col; + + for (yi = 0; yi < 8; yi++) + { + data = READ_FONT(code * 8 + yi); + + for (xi = 0; xi < 8; xi++) + { + int res_x,res_y; + + dat = ((data >> (xi << 1)) & 0x03); + + res_x = x + xi; + res_y = y + yi; + + col = (pal >> (dat*2)) & 3; + + if (dat) + { + if (cliprect.contains(res_x, res_y)) + bitmap.pix16((res_y), (res_x)) = m_palette->pen(col); + } + } + } +} + + + +void vboy_state::fill_ovr_char(UINT16 code, UINT8 pal) +{ + UINT16 data; + UINT8 yi, xi, dat; + int col; + + for (yi = 0; yi < 8; yi++) + { + data = READ_FONT(code * 8 + yi); + + for (xi = 0; xi < 8; xi++) + { + dat = ((data >> (xi << 1)) & 0x03); + col = (pal >> (dat*2)) & 3; + + if(dat == 0) + col = -1; + + WRITE_OVR_TEMPDRAW_MAP(yi*8+xi, col); + } + } +} + +inline INT8 vboy_state::get_bg_map_pixel(int num, int xpos, int ypos) +{ +// g_profiler.start(PROFILER_USER1); + int x, y; + UINT8 stepx, stepy; + + y = ypos >>3; + x = xpos >>3; + + stepx = (x & 0x1c0) >> 6; + stepy = ((y & 0x1c0) >> 6) * (stepx+1); + UINT16 val = READ_BGMAP((x & 0x3f) + (64 * (y & 0x3f)) + ((num + stepx + stepy) * 0x1000)); + int pal = m_vip_regs.GPLT[(val >> 14) & 3]; + int code = val & 0x3fff; + + UINT16 data; + UINT8 yi, xi, dat; + + yi = ypos & 7; + data = READ_FONT(code * 8 + yi); + xi = xpos & 7; + dat = ((data >> (xi << 1)) & 0x03); + + if(dat == 0) + { + //g_profiler.stop(); + return -1; + } + // g_profiler.stop(); + return (pal >> (dat*2)) & 3; +} + +void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 param_base, int mode, int gx, int gp, int gy, int mx, int mp, int my, int h, int w, + UINT16 x_mask, UINT16 y_mask, UINT8 ovr, bool right, int bg_map_num) +{ +// g_profiler.start(PROFILER_USER2); + int x,y; + + for(y=0;y<=h;y++) + { + INT32 y1 = (y+gy); + + if ((y1 < cliprect.min_y) || (y1 > cliprect.max_y)) + continue; + + int src_y = y+my; + + for(x=0;x<=w;x++) + { + INT32 x1 = (x+gx); + + x1 += right ? -gp : gp; + + if ((x1 < cliprect.min_x) || (x1 > cliprect.max_x)) + continue; + + int src_x; + src_x = x+mx; + if (mode==1) + src_x += (INT16)READ_BGMAP(param_base + (y*2+(right ^ 1))); + + src_x += right ? -mp : mp; + + + int pix = 0; + if(ovr) + { + if ((src_x > x_mask || src_y > y_mask || src_x < 0 || src_y < 0)) + { + g_profiler.start(PROFILER_USER3); + pix = READ_OVR_TEMPDRAW_MAP((src_y & 7)*8+(src_x & 7)); + g_profiler.stop(); + } + else + { + pix = get_bg_map_pixel(bg_map_num, src_x & x_mask, src_y & y_mask); + } + } + else + { + pix = get_bg_map_pixel(bg_map_num, src_x & x_mask, src_y & y_mask); + } + + if(pix != -1) + bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); + } + } +// g_profiler.stop(); +} + +void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 param_base, int gx, int gp, int gy, int h, int w, + UINT16 x_mask, UINT16 y_mask, UINT8 ovr, bool right, int bg_map_num) +{ +// g_profiler.start(PROFILER_USER3); + int x,y; + + for(y=0;y<=h;y++) + { + float h_skw = (INT16)READ_BGMAP(param_base + (y*8+0)) / 8.0; + float prlx = (INT16)READ_BGMAP(param_base + (y*8+1)) / 8.0; + float v_skw = (INT16)READ_BGMAP(param_base + (y*8+2)) / 8.0; + float h_scl = (INT16)READ_BGMAP(param_base + (y*8+3)) / 512.0; + float v_scl = (INT16)READ_BGMAP(param_base + (y*8+4)) / 512.0; + + h_skw += right ? -prlx : prlx; + + for(x=0;x<=w;x++) + { + INT32 src_x,src_y; + INT16 y1 = (y+gy); + INT16 x1 = (x+gx); + int pix = 0; + + x1 += right ? -gp : gp; + + src_x = (INT32)((h_skw) + (h_scl * x)); + src_y = (INT32)((v_skw) + (v_scl * x)); + + if(ovr && (src_y > y_mask || src_x > x_mask || src_x < 0 || src_y < 0)) + { + pix = READ_OVR_TEMPDRAW_MAP((src_y & 7)*8+(src_x & 7)); + } + else + { + pix = get_bg_map_pixel(bg_map_num, src_x & x_mask, src_y & y_mask); + } + + if(pix != -1) + if (cliprect.contains(x1, y1)) + bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); + } + } +// g_profiler.stop(); +} + +/* +x--- ---- ---- ---- [0] LON +-x-- ---- ---- ---- RON +--xx ---- ---- ---- BGM type +---- xx-- ---- ---- SCX +---- --xx ---- ---- SCY +---- ---- x--- ---- OVR +---- ---- -x-- ---- END +---- ---- --00 ---- +---- ---- ---- xxxx BGMAP_BASE +*/ + +UINT8 vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle &cliprect, bool right, int &cur_spt) +{ + num <<= 4; + UINT16 def = READ_WORLD(num); + UINT8 lon = (def >> 15) & 1; + UINT8 ron = (def >> 14) & 1; + UINT8 mode = (def >> 12) & 3; + UINT16 scx = 64 << ((def >> 10) & 3); + UINT16 scy = 64 << ((def >> 8) & 3); + UINT8 ovr = (def >> 7) & 1; + UINT8 end = (def >> 6) & 1; + INT16 gx = READ_WORLD(num+1); + INT16 gp = READ_WORLD(num+2); + INT16 gy = READ_WORLD(num+3); + INT16 mx = READ_WORLD(num+4); + INT16 mp = READ_WORLD(num+5); + INT16 my = READ_WORLD(num+6); + UINT16 w = READ_WORLD(num+7); + UINT16 h = READ_WORLD(num+8); + UINT16 param_base = READ_WORLD(num+9) & 0xfff0; + UINT16 ovr_char = READ_BGMAP(READ_WORLD(num+10)); + UINT8 bg_map_num = def & 0x0f; + int i; + + if(end) + return 1; + + if (mode < 2) // Normal / HBias Mode + { + if(ovr) + fill_ovr_char(ovr_char & 0x3fff, m_vip_regs.GPLT[(ovr_char >> 14) & 3]); + + if (lon && (!right)) + { + draw_bg_map(bitmap, cliprect, param_base, mode, gx, gp, gy, mx, mp, my, h,w, scx*8-1, scy*8-1, ovr, right, bg_map_num); + } + + if (ron && (right)) + { + draw_bg_map(bitmap, cliprect, param_base, mode, gx, gp, gy, mx, mp, my, h,w, scx*8-1, scy*8-1, ovr, right, bg_map_num); + } + } + else if (mode==2) // Affine Mode + { + if(ovr) + fill_ovr_char(ovr_char & 0x3fff, m_vip_regs.GPLT[(ovr_char >> 14) & 3]); + + if (lon && (!right)) + { + draw_affine_map(bitmap, cliprect, param_base, gx, gp, gy, h,w, scx*8-1, scy*8-1, ovr, right, bg_map_num); + } + + if (ron && (right)) + { + draw_affine_map(bitmap, cliprect, param_base, gx, gp, gy, h,w, scx*8-1, scy*8-1, ovr, right, bg_map_num); + } + } + else if (mode==3) // OBJ Mode + { + int start_offs, end_offs; + + if(cur_spt == -1) + { + popmessage("Cur spt used with -1 pointer!"); + return 0; + } + + start_offs = m_vip_regs.SPT[cur_spt]; + + end_offs = 0x3ff; + if(cur_spt != 0) + end_offs = m_vip_regs.SPT[cur_spt-1]; + + i = start_offs; + do + { + UINT16 start_ndx = i * 4; + INT16 jx = READ_OBJECTS(start_ndx+0); + INT16 jp = READ_OBJECTS(start_ndx+1) & 0x3fff; + INT16 jy = READ_OBJECTS(start_ndx+2) & 0x1ff; + UINT16 val = READ_OBJECTS(start_ndx+3); + UINT8 jlon = (READ_OBJECTS(start_ndx+1) & 0x8000) >> 15; + UINT8 jron = (READ_OBJECTS(start_ndx+1) & 0x4000) >> 14; + + if (!right && jlon) + put_obj(bitmap, cliprect, (jx-jp) & 0x1ff, jy, val & 0x3fff, m_vip_regs.JPLT[(val>>14) & 3]); + + if(right && jron) + put_obj(bitmap, cliprect, (jx+jp) & 0x1ff, jy, val & 0x3fff, m_vip_regs.JPLT[(val>>14) & 3]); + + i --; + i &= 0x3ff; + }while(i != end_offs); + + if((lon && !right) || (ron && right)) + cur_spt --; + } + + return 0; +} + +UINT32 vboy_state::screen_update_vboy_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(m_palette->pen(m_vip_regs.BKCOL), cliprect); + int cur_spt; + + if(!(m_vip_regs.DPCTRL & 2)) /* Don't bother if screen is off */ + return 0; + + cur_spt = 3; + for(int i=31; i>=0; i--) + if (display_world(i, bitmap, cliprect, false, cur_spt)) break; + + if(0) + { + int x,y; + + for(y=0;y<224;y++) + { + for(x=0;x<384;x++) + { + UINT8 pen; + UINT8 pix; + int yi; + + pen = m_l_frame_1[(x*0x40)+(y >> 2)]; + yi = ((y & 0x3)*2); + pix = (pen >> yi) & 3; + + bitmap.pix16(y, x) = m_palette->pen(pix & 3); + } + } + } + + return 0; +} + +UINT32 vboy_state::screen_update_vboy_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(m_palette->pen(m_vip_regs.BKCOL), cliprect); + int cur_spt; + + if(!(m_vip_regs.DPCTRL & 2)) /* Don't bother if screen is off */ + return 0; + + cur_spt = 3; + for(int i=31; i>=0; i--) + if (display_world(i, bitmap, cliprect, true, cur_spt)) break; + + return 0; +} + +/********************************** + * + * I/O + * + *********************************/ + +READ32_MEMBER( vboy_state::io_r ) +{ + UINT32 value = 0x00; + + switch ((offset << 2)) + { + case 0x10: // KLB (Keypad Low Byte) + value = m_vboy_regs.klb; // 0x02 is always 1 + break; + case 0x14: // KHB (Keypad High Byte) + value = m_vboy_regs.khb; + break; + case 0x18: // TLB (Timer Low Byte) + value = m_vboy_regs.tlb; + break; + case 0x1c: // THB (Timer High Byte) + value = m_vboy_regs.thb; + break; + case 0x20: // TCR (Timer Control Reg) + value = m_vboy_regs.tcr; + break; + case 0x24: // WCR (Wait State Control Reg) + value = m_vboy_regs.wcr; + break; + case 0x28: // KCR (Keypad Control Reg) + { +// attotime new_time = machine().time(); + +// if((new_time - m_input_latch_time) < m_maincpu->cycles_to_attotime(640)) + value |= machine().rand() & 2; + + value = m_vboy_regs.kcr | 0x4c; + } + break; + case 0x00: // LPC (Link Port Control Reg) + case 0x04: // LPC2 (Link Port Control Reg) + case 0x08: // LPT (Link Port Transmit) + case 0x0c: // LPR (Link Port Receive) + default: + logerror("Unemulated read: offset %08x\n", 0x02000000 + (offset << 2)); + break; + } + return value; +} + +WRITE32_MEMBER( vboy_state::io_w ) +{ + switch (offset<<2) + { + case 0x0c: // LPR (Link Port Receive) + case 0x10: // KLB (Keypad Low Byte) + case 0x14: // KHB (Keypad High Byte) + //logerror("Ilegal write: offset %02x should be only read\n", offset); + break; + case 0x18: // TLB (Timer Low Byte) + m_vboy_regs.tlb = data; + m_vboy_timer.latch = m_vboy_regs.tlb | (m_vboy_timer.latch & 0xff00); + break; + case 0x1c: // THB (Timer High Byte) + m_vboy_regs.thb = data; + m_vboy_timer.latch = (m_vboy_regs.thb<<8) | (m_vboy_timer.latch & 0xff); + break; + case 0x20: // TCR (Timer Control Reg) + /* + 111- ---- always 1 + ---x ---- timer select (1=20 us, 0=100 us) + ---- x--- timer irq + ---- -x-- resets timer zero flag + ---- --x- timer is zero flag + ---- ---x enables timer + */ + if (!(data & 0x08)) + { + m_maincpu->set_input_line(1, CLEAR_LINE); + } + + if (data & 1) + { + m_vboy_regs.tlb = m_vboy_timer.latch & 0xff; + m_vboy_regs.thb = m_vboy_timer.latch >> 8; + m_vboy_timer.count = m_vboy_timer.latch; + + // only start timer if tcr & 1 is 1 and wasn't before? + if (!(m_vboy_regs.tcr & 1)) + { + if (data & 0x10) + { + m_maintimer->adjust(attotime::from_hz(50000)); + } + else + { + m_maintimer->adjust(attotime::from_hz(10000)); + } + + } + } + + m_vboy_regs.tcr = (data & 0xfd) | (0xe4) | (m_vboy_regs.tcr & 2); // according to docs: bits 5, 6 & 7 are unused and set to 1, bit 1 is read only. + if(data & 4) + m_vboy_regs.tcr &= 0xfd; + break; + case 0x24: // WCR (Wait State Control Reg) + m_vboy_regs.wcr = data | 0xfc; // according to docs: bits 2 to 7 are unused and set to 1. + break; + case 0x28: // KCR (Keypad Control Reg) + if (data & 0x04 ) + { + m_vboy_regs.klb = (ioport("INPUT")->read() & 0x00ff); + m_vboy_regs.khb = (ioport("INPUT")->read() & 0xff00) >> 8; + //m_input_latch_time = machine().time(); + } + + if (data & 1) + { + m_vboy_regs.klb = 0; + m_vboy_regs.khb = 0; + //m_input_latch_time = attotime::zero; + } + + + m_vboy_regs.kcr = (data | 0x48) & 0xfd; // according to docs: bit 6 & bit 3 are unused and set to 1, bit 1 is read only. + break; + case 0x00: // LPC (Link Port Control Reg) + case 0x04: // LPC2 (Link Port Control Reg) + case 0x08: // LPT (Link Port Transmit) + default: + logerror("Unemulated write: offset %08x, data %04x\n", 0x02000000 + (offset << 2), data); + break; + } +} + + +/********************************** + * + * VIP + * + *********************************/ +/* +TODO: brightness presumably isn't a linear algorythm, also REST needs to be taken into account (needs a working example) +*/ +void vboy_state::m_set_brightness(void) +{ + int a,b,c; + + //d = (m_vip_regs.BRTA + m_vip_regs.BRTB + m_vip_regs.BRTC + m_vip_regs.REST); + a = (0xff * (m_vip_regs.BRTA)) / 0x80; + b = (0xff * (m_vip_regs.BRTA + m_vip_regs.BRTB)) / 0x80; + c = (0xff * (m_vip_regs.BRTA + m_vip_regs.BRTB + m_vip_regs.BRTC)) / 0x80; + + if(a < 0) { a = 0; } + if(b < 0) { b = 0; } + if(c < 0) { c = 0; } + if(a > 0xff) { a = 0xff; } + if(b > 0xff) { b = 0xff; } + if(c > 0xff) { c = 0xff; } + +// popmessage("%02x %02x %02x %02x",m_vip_regs.BRTA,m_vip_regs.BRTB,m_vip_regs.BRTC,m_vip_regs.REST); + m_palette->set_pen_color(1, a,0,0); + m_palette->set_pen_color(2, b,0,0); + m_palette->set_pen_color(3, c,0,0); +} + +READ16_MEMBER( vboy_state::vip_r ) +{ + switch(offset << 1) { + case 0x00: //INTPND + return m_vip_regs.INTPND; + case 0x02: //INTENB + return m_vip_regs.INTENB; + case 0x04: //INTCLR + logerror("Error reading INTCLR\n"); + break; +/* + ---- -x-- ---- ---- LOCK (status column table address (CTA) lock) + ---- --x- ---- ---- SYNCE (status of sync signal enable) + ---- ---x ---- ---- RE (status of memory refresh cycle) + ---- ---- x--- ---- FCLK + ---- ---- -x-- ---- SCANRDY (active low) + ---- ---- --xx xx-- DPBSY (current framebuffer displayed) + ---- ---- --10 00-- RFB1 + ---- ---- --01 00-- LFB1 + ---- ---- --00 10-- RFB0 + ---- ---- --00 01-- LFB0 + ---- ---- ---- --x- DISP +*/ + case 0x20: //DPSTTS + { + UINT16 res; + + res = m_vip_regs.DPCTRL & 0x0702; + + if(m_vip_regs.DPCTRL & 2) + { + if(m_row_num < 224/8) + { + if(m_displayfb == 0) + res |= 0x0c; + else + res |= 0x30; + } + } + + res |= 0x40; + //printf("%04x\n",res); + return res; + } + case 0x22: //DPCTRL + return m_vip_regs.DPCTRL; + case 0x24: //BRTA + return m_vip_regs.BRTA; + case 0x26: //BRTB + return m_vip_regs.BRTB; + case 0x28: //BRTC + return m_vip_regs.BRTC; + case 0x2A: //REST + return m_vip_regs.REST; + case 0x2E: //FRMCYC + return m_vip_regs.FRMCYC; + case 0x30: //CTA + printf("Read CTA\n"); + return m_vip_regs.CTA; + case 0x40: //XPSTTS, piXel Processor STaTuS + { + /* + x--- ---- ---- ---- SBOUT + ---x xxxx ---- ---- SBCOUNT + ---- ---- ---x ---- OVERTIME (process overflow) + ---- ---- ---- x--- XPBSY1 (second framebuffer busy flag) + ---- ---- ---- -x-- XPBSY0 (first framebfuffer busy flag) + ---- ---- ---- --x- XPEN (starts drawing at beginning of game frame) + ---- ---- ---- ---x XPRST (force drawing process to idle) + */ + UINT16 res; + + //printf("%d\n",row_num); + + res = m_vip_regs.XPSTTS & 0x00f3; // empty ^^' + res |= m_drawfb << 2; + + if(m_row_num < 224/8) + { + res |= 0x8000; + res |= m_row_num<<8; + } + + return res; + } + case 0x42: //XPCTRL + return m_vip_regs.XPCTRL; + case 0x44: //VER + printf("%08x read VER\n",m_maincpu->pc()); + return m_vip_regs.VER; + case 0x48: //SPT0 + return m_vip_regs.SPT[0]; + case 0x4A: //SPT1 + return m_vip_regs.SPT[1]; + case 0x4C: //SPT2 + return m_vip_regs.SPT[2]; + case 0x4E: //SPT3 + return m_vip_regs.SPT[3]; + case 0x60: //GPLT0 + return m_vip_regs.GPLT[0]; + case 0x62: //GPLT1 + return m_vip_regs.GPLT[1]; + case 0x64: //GPLT2 + return m_vip_regs.GPLT[2]; + case 0x66: //GPLT3 + return m_vip_regs.GPLT[3]; + case 0x68: //JPLT0 + return m_vip_regs.JPLT[0]; + case 0x6A: //JPLT1 + return m_vip_regs.JPLT[1]; + case 0x6C: //JPLT2 + return m_vip_regs.JPLT[2]; + case 0x6E: //JPLT3 + return m_vip_regs.JPLT[3]; + case 0x70: //BKCOL + return m_vip_regs.BKCOL; + default: + logerror("Unemulated read: addr %08x\n", offset * 2 + 0x0005f800); + break; + } + return 0xffff; +} + +WRITE16_MEMBER( vboy_state::vip_w ) +{ + if(mem_mask != 0xffff) + printf("%04x %02x\n",mem_mask,offset*2); + + switch(offset << 1) { + /* + x--- ---- ---- ---- TIME_ERR + -x-- ---- ---- ---- XP_END + --x- ---- ---- ---- SB_HIT + ---- ---- ---x ---- FRAME_START + ---- ---- ---- x--- GAME_START + ---- ---- ---- -x-- RFB_END + ---- ---- ---- --x- LFB_END + ---- ---- ---- ---x SCAN_ERR + */ + case 0x00: //INTPND + logerror("Error writing INTPND\n"); + break; + case 0x02: //INTENB + m_vip_regs.INTENB = data; + m_set_irq(0); + //printf("%04x ENB\n",data); + break; + case 0x04: //INTCLR + m_vip_regs.INTPND &= ~data; + m_set_irq(0); + //else + // printf("%04x\n",m_vip_regs.INTPND); + break; + case 0x20: //DPSTTS + logerror("Error writing DPSTTS\n"); + break; +/* + ---- -x-- ---- ---- LOCK (status column table address (CTA) lock) + ---- --x- ---- ---- SYNCE (status of sync signal enable) + ---- ---x ---- ---- RE (status of memory refresh cycle) + ---- ---- ---- --x- DISP + ---- ---- ---- ---x DPRST (Resets the VIP internal counter) +*/ + case 0x22: //DPCTRL + m_vip_regs.DPCTRL = data & 0x0702; + + if(data & 1) + { + m_vip_regs.INTPND &= 0xe000; // reset FRAME_START, GAME_START, RFB_END, LFB_END and SCAN_ERR irqs + m_set_irq(0); + } + break; + case 0x24: //BRTA + m_vip_regs.BRTA = data; + m_set_brightness(); + break; + case 0x26: //BRTB + m_vip_regs.BRTB = data; + m_set_brightness(); + break; + case 0x28: //BRTC + m_vip_regs.BRTC = data; + m_set_brightness(); + break; + case 0x2A: //REST + m_vip_regs.REST = data; + m_set_brightness(); + if(data) + printf("%04x REST\n",data); + break; + case 0x2E: //FRMCYC + //printf("%d\n",data); + m_vip_regs.FRMCYC = data; + break; + case 0x30: //CTA + m_vip_regs.CTA = data; + printf("%04x CTA\n",data); + break; + case 0x40: //XPSTTS + logerror("Error writing XPSTTS\n"); + break; + case 0x42: //XPCTRL, w/o + /* + ---- ---- ---- --x- + ---- ---- ---- ---x Reset Pixel Processor + */ + m_vip_regs.XPCTRL = data & 0x1f02; + + //if(data & 0x1f00) + // printf("%04x SBCMP\n",data); + + if(data & 1) + { + m_vip_regs.INTPND &= 0x1fff; // reset SB_HIT, XP_END and TIME_ERR irqs + m_set_irq(0); + } + break; + case 0x44: //VER + //m_vip_regs.VER = data; + break; + case 0x48: //SPT0 + m_vip_regs.SPT[0] = data & 0x3ff; + break; + case 0x4A: //SPT1 + m_vip_regs.SPT[1] = data & 0x3ff; + break; + case 0x4C: //SPT2 + m_vip_regs.SPT[2] = data & 0x3ff; + break; + case 0x4E: //SPT3 + m_vip_regs.SPT[3] = data & 0x3ff; + break; + case 0x60: //GPLT0 + m_vip_regs.GPLT[0] = data; + break; + case 0x62: //GPLT1 + m_vip_regs.GPLT[1] = data; + break; + case 0x64: //GPLT2 + m_vip_regs.GPLT[2] = data; + break; + case 0x66: //GPLT3 + m_vip_regs.GPLT[3] = data; + break; + case 0x68: //JPLT0 + m_vip_regs.JPLT[0] = data & 0xfc; + break; + case 0x6A: //JPLT1 + m_vip_regs.JPLT[1] = data & 0xfc; + break; + case 0x6C: //JPLT2 + m_vip_regs.JPLT[2] = data & 0xfc; + break; + case 0x6E: //JPLT3 + m_vip_regs.JPLT[3] = data & 0xfc; + break; + case 0x70: //BKCOL + m_vip_regs.BKCOL = data & 3; + break; + default: + logerror("Unemulated write: addr %08x, data %04x\n", offset * 2 + 0x0005f800, data); + break; + } +} + + + +WRITE16_MEMBER( vboy_state::font0_w ) +{ + WRITE_FONT(offset); +} + +WRITE16_MEMBER( vboy_state::font1_w ) +{ + WRITE_FONT(offset+0x1000); +} + +WRITE16_MEMBER( vboy_state::font2_w ) +{ + WRITE_FONT(offset+0x2000); +} + +WRITE16_MEMBER( vboy_state::font3_w ) +{ + WRITE_FONT(offset+0x3000); +} + +READ16_MEMBER( vboy_state::font0_r ) +{ + return READ_FONT(offset); +} + +READ16_MEMBER( vboy_state::font1_r ) +{ + return READ_FONT(offset + 0x1000); +} + +READ16_MEMBER( vboy_state::font2_r ) +{ + return READ_FONT(offset + 0x2000); +} + +READ16_MEMBER( vboy_state::font3_r ) +{ + return READ_FONT(offset + 0x3000); +} + +WRITE16_MEMBER( vboy_state::vboy_bgmap_w ) +{ + m_bgmap[offset] = data | (m_bgmap[offset] & (mem_mask ^ 0xffff)); +} + +READ16_MEMBER( vboy_state::vboy_bgmap_r ) +{ + return m_bgmap[offset]; +} + +READ8_MEMBER( vboy_state::lfb0_r ) { return m_l_frame_0[offset]; } +READ8_MEMBER( vboy_state::lfb1_r ) { return m_l_frame_1[offset]; } +READ8_MEMBER( vboy_state::rfb0_r ) { return m_r_frame_0[offset]; } +READ8_MEMBER( vboy_state::rfb1_r ) { return m_r_frame_1[offset]; } +WRITE8_MEMBER( vboy_state::lfb0_w ) { m_l_frame_0[offset] = data; } +WRITE8_MEMBER( vboy_state::lfb1_w ) { m_l_frame_1[offset] = data; } +WRITE8_MEMBER( vboy_state::rfb0_w ) { m_r_frame_0[offset] = data; } +WRITE8_MEMBER( vboy_state::rfb1_w ) { m_r_frame_1[offset] = data; } + + +static ADDRESS_MAP_START( vboy_mem, AS_PROGRAM, 32, vboy_state ) + ADDRESS_MAP_GLOBAL_MASK(0x07ffffff) + AM_RANGE( 0x00000000, 0x00005fff ) AM_READWRITE8(lfb0_r, lfb0_w,0xffffffff) // L frame buffer 0 + AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 + AM_RANGE( 0x00008000, 0x0000dfff ) AM_READWRITE8(lfb1_r, lfb1_w,0xffffffff) // L frame buffer 1 + AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 + AM_RANGE( 0x00010000, 0x00015fff ) AM_READWRITE8(rfb0_r, rfb0_w,0xffffffff) // R frame buffer 0 + AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 + AM_RANGE( 0x00018000, 0x0001dfff ) AM_READWRITE8(rfb1_r, rfb1_w,0xffffffff) // R frame buffer 1 + AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 + + AM_RANGE( 0x00020000, 0x0003ffff ) AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory + + //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC + AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff) + + AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 mirror + AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 mirror + AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 mirror + AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 mirror + + AM_RANGE( 0x01000000, 0x010005ff ) AM_DEVREADWRITE8("vbsnd", vboysnd_device, read, write, 0xffffffff) + AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff + //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area + AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram")// Main RAM - 64K mask 0xffff + AM_RANGE( 0x06000000, 0x06003fff ) AM_DEVREADWRITE("cartslot", vboy_cart_slot_device, read_eeprom, write_eeprom) // Cart RAM - 8K NVRAM +// AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( vboy_io, AS_IO, 32, vboy_state ) + ADDRESS_MAP_GLOBAL_MASK(0x07ffffff) + AM_RANGE( 0x00000000, 0x00005fff ) AM_RAM AM_SHARE("l_frame_0") // L frame buffer 0 + AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 + AM_RANGE( 0x00008000, 0x0000dfff ) AM_RAM AM_SHARE("l_frame_1") // L frame buffer 1 + AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 + AM_RANGE( 0x00010000, 0x00015fff ) AM_RAM AM_SHARE("r_frame_0") // R frame buffer 0 + AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 + AM_RANGE( 0x00018000, 0x0001dfff ) AM_RAM AM_SHARE("r_frame_1") // R frame buffer 1 + AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 + + AM_RANGE( 0x00020000, 0x0003ffff ) AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory + + //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC + AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff) + + AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 mirror + AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 mirror + AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 mirror + AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 mirror + + AM_RANGE( 0x01000000, 0x010005ff ) AM_DEVREADWRITE8("vbsnd", vboysnd_device, read, write, 0xffffffff) + AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff +// AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area + AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram") // Main RAM - 64K mask 0xffff + AM_RANGE( 0x06000000, 0x06003fff ) AM_NOP // Cart RAM - 8K NVRAM ? +// AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vboy ) + PORT_START("INPUT") + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("L") PORT_PLAYER(1) // Left button on back + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("R") PORT_PLAYER(1) // Right button on back + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") PORT_PLAYER(1) // B button (Mario Clash Jump button) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") PORT_PLAYER(1) // A button + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED ) // Always 1 + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // Battery low +INPUT_PORTS_END + + +void vboy_state::machine_start() +{ + // install the cart ROM as a bank into the address map. + // this speeds up the rom access, by skipping the m_cart->read_rom + // trampoline (but forces us to alloc always a 0x200000-wide region) + if (m_cart->exists()) + { + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(VBOYSLOT_ROM_REGION_TAG).c_str()); + + m_maincpu->space(AS_PROGRAM).install_read_bank(0x07000000, 0x071fffff, 0, 0x0e00000, "prog_cart_bank"); + m_maincpu->space(AS_IO).install_read_bank(0x07000000, 0x071fffff, 0, 0x0e00000, "io_cart_bank"); + membank("prog_cart_bank")->set_base(m_cart_rom->base()); + membank("io_cart_bank")->set_base(m_cart_rom->base()); + + m_cart->save_eeprom(); + } +} + +void vboy_state::machine_reset() +{ + /* Initial values taken from Reality Boy, to be verified when emulation improves */ + m_vboy_regs.lpc = 0x6d; + m_vboy_regs.lpc2 = 0xff; + m_vboy_regs.lpt = 0x00; + m_vboy_regs.lpr = 0x00; + m_vboy_regs.klb = 0x00; + m_vboy_regs.khb = 0x00; + m_vboy_regs.tlb = 0xff; + m_vboy_regs.thb = 0xff; + m_vboy_regs.tcr = 0xe4; + m_vboy_regs.wcr = 0xfc; + m_vboy_regs.kcr = 0x4c | 0x80; + m_vip_regs.DPCTRL = 2; // ssquash relies on this at boot otherwise no frame_start irq is fired + m_displayfb = 0; + m_drawfb = 0; + + m_vboy_timer.count = 0; + m_maintimer->adjust(attotime::never); +} + + +void vboy_state::m_timer_tick() +{ + if(m_vboy_timer.count > 0) + { + m_vboy_timer.count--; + m_vboy_regs.tlb = m_vboy_timer.count & 0xff; + m_vboy_regs.thb = m_vboy_timer.count >> 8; + } + + if (m_vboy_timer.count == 0) + { + m_vboy_timer.count = m_vboy_timer.latch; + m_vboy_regs.tcr |= 0x02; + if(m_vboy_regs.tcr & 8) + { + m_maincpu->set_input_line(1, ASSERT_LINE); + } + } + + if (m_vboy_regs.tcr & 0x10) + { + m_maintimer->adjust(attotime::from_hz(50000)); + } + else + { + m_maintimer->adjust(attotime::from_hz(10000)); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::timer_main_tick) +{ + m_timer_tick(); +} + +TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::timer_pad_tick) +{ + if((m_vboy_regs.kcr & 0x80) == 0) + m_maincpu->set_input_line(0, HOLD_LINE); +} + +PALETTE_INIT_MEMBER(vboy_state, vboy) +{ + palette.set_pen_color(0, rgb_t::black); + palette.set_pen_color(1, rgb_t::black); + palette.set_pen_color(2, rgb_t::black); + palette.set_pen_color(3, rgb_t::black); +} + +void vboy_state::m_set_irq(UINT16 irq_vector) +{ + m_vip_regs.INTPND |= irq_vector; + + if(m_vip_regs.INTENB & m_vip_regs.INTPND) + m_maincpu->set_input_line(4, ASSERT_LINE); + + if((m_vip_regs.INTENB & m_vip_regs.INTPND) == 0) + m_maincpu->set_input_line(4, CLEAR_LINE); +} + +/* TODO: obviously all of this needs clean-ups and better implementation ... */ +void vboy_state::m_scanline_tick(int scanline, UINT8 screen_type) +{ + //int frame_num = machine().first_screen()->frame_number(); + + if(screen_type == 0) + m_row_num = (scanline / 8) & 0x1f; + + if(scanline == 0) + { + if(m_vip_regs.DPCTRL & 2) + m_set_irq(0x0010); // FRAME_START + + m_frame_count++; + + if(m_frame_count > m_vip_regs.FRMCYC) + { + m_set_irq(0x0008); // GAME_START + m_frame_count = 0; + } + + if(m_vip_regs.DPCTRL & 2) + m_displayfb ^= 1; + } + + if(scanline == 224) + { + if(m_displayfb) + m_drawfb = 1; + else + m_drawfb = 2; + m_set_irq(0x4000); // XPEND + } + + if(scanline == 232) + { + m_drawfb = 0; + m_set_irq(0x0002); // LFBEND + } + + if(scanline == 240) + { + m_set_irq(0x0004); // RFBEND + } + + if(m_row_num == ((m_vip_regs.XPCTRL & 0x1f00) >> 8)) + { + m_set_irq(0x2000); // SBHIT + } + +} + +TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::vboy_scanlineL) +{ + int scanline = param; + + m_scanline_tick(scanline,0); +} + +#if 0 +TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::vboy_scanlineR) +{ + int scanline = param; + + //m_scanline_tick(scanline,1); +} +#endif + + +static SLOT_INTERFACE_START(vboy_cart) + SLOT_INTERFACE_INTERNAL("vb_rom", VBOY_ROM_STD) + SLOT_INTERFACE_INTERNAL("vb_eeprom", VBOY_ROM_EEPROM) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( vboy, vboy_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD( "maincpu", V810, XTAL_20MHz ) + MCFG_CPU_PROGRAM_MAP(vboy_mem) + MCFG_CPU_IO_MAP(vboy_io) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_l", vboy_state, vboy_scanlineL, "3dleft", 0, 1) + //MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_r", vboy_state, vboy_scanlineR, "3dright", 0, 1) + + // programmable timer + MCFG_TIMER_DRIVER_ADD("timer_main", vboy_state, timer_main_tick) + + // pad ready, which should be once per VBL + MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_pad", vboy_state, timer_pad_tick, attotime::from_hz(50.038029f)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_vboy) + MCFG_PALETTE_ADD("palette", 4) + MCFG_PALETTE_INIT_OWNER(vboy_state, vboy) + + /* Left screen */ + MCFG_SCREEN_ADD("3dleft", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_20MHz/2,757,0,384,264,0,224) + MCFG_SCREEN_UPDATE_DRIVER(vboy_state, screen_update_vboy_left) + MCFG_SCREEN_PALETTE("palette") + + /* Right screen */ + MCFG_SCREEN_ADD("3dright", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_20MHz/2,757,0,384,264,0,224) + MCFG_SCREEN_UPDATE_DRIVER(vboy_state, screen_update_vboy_right) + MCFG_SCREEN_PALETTE("palette") + + /* cartridge */ + MCFG_VBOY_CARTRIDGE_ADD("cartslot", vboy_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","vboy") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_VBOYSND_ADD("vbsnd") + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( vboy ) + ROM_REGION( 0x2000000, "maincpu", ROMREGION_ERASEFF ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 1995, vboy, 0, 0, vboy, vboy, driver_device, 0, "Nintendo", "Virtual Boy", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/vc4000.c b/src/mame/drivers/vc4000.c new file mode 100644 index 00000000000..8e3c8d106fb --- /dev/null +++ b/src/mame/drivers/vc4000.c @@ -0,0 +1,715 @@ +// license:??? +// copyright-holders:Peter Trauner, Manfred Schneider, Robbbert +/****************************************************************************** + Peter Trauner May 2001 + + Paul Robson's Emulator at www.classicgaming.com/studio2 made it possible +******************************************************************************/ + +/***************************************************************************** +Additional Notes by Manfred Schneider +Memory Map +Memory mapping is done in two steps. The PVI(2636) provides the chip select signals +according to signals provided by the CPU address lines. +The PVI has 12 address line (A0-A11) which give him control over 4K. A11 of the PVI is not +connected to A11 of the CPU, but connected to the cartridge slot. On the cartridge it is +connected to A12 of the CPU which extends the addressable Range to 8K. This is also the +maximum usable space, because A13 and A14 of the CPU are not used. +With the above in mind address range will look like this: +$0000 - $15FF ROM, RAM +$1600 - $167F unused +$1680 - $16FF used for I/O Control on main PCB +$1700 - $17FF PVI internal Registers and RAM +$1800 - $1DFF ROM, RAM +$1E00 - $1E7F unused +$1E80 - $1EFF mirror of $1680 - $167F +$1F00 - $1FFF mirror of $1700 - $17FF +$2000 - $3FFF mirror of $0000 - $1FFF +$4000 - $5FFF mirror of $0000 - $1FFF +$6000 - $7FFF mirror of $0000 - $1FFF +On all cartridges for the Interton A11 from PVI is connected to A12 of the CPU. +There are four different types of Cartridges with the following memory mapping. +Type 1: 2K Rom or EPROM mapped from $0000 - $07FF +Type 2: 4K Rom or EPROM mapped from $0000 - $0FFF +Type 3: 4K Rom + 1K Ram + Rom is mapped from $0000 - $0FFF + Ram is mapped from $1000 - $13FF and mirrored from $1800 - $1BFF +Type 4: 6K Rom + 1K Ram + Rom is mapped from $0000 - $15FF (only 5,5K ROM visible to the CPU) + Ram is mapped from $1800 - $1BFF + +One other type is known for Radofin (rom compatible to VC4000, but not the Cartridge connector). +It consisted of a 2K ROM and 2K RAM which are most likely mapped as follows (needs to be confirmed): +2K Rom mapped from $0000 - $07FF +2K Ram mapped from $0800 - $0FFF +The Cartridge is called Hobby Module and the Rom is probably the same as used in +elektor TV Game Computer which is a kind of developer machine for the VC4000. + +****************************************************************************** + +Elektor TV Games Computer +This is much the same as the vc4000, however it has its own ROM (with inbuilt +monitor program similar to the Signetics Instructor 50), and 2K of ram. No cart +slot, no joystick, but has a cassette interface. + +ToDo: +- Most quickloads don't work too well +- Might need to rework keyboard, again + +When booted you get the familiar 00 00 pattern. Pressing Q gives a display of +IIII. Now, you enter a command. + +Key Command Purpose +------------------------ +Q Start Boot up system +L RCAS Load a tape +S WCAS Save a tape +W BP1/2 Set a breakpoint +R REG View/Set registers +X PC Go ++pad + Enter data and do next thing +-pad - Decrement +- MEM Specify an address +0-9 0-9 Hex digits +A-F A-F Hex digits + +Keyboard layout when using the Monitor on real hardware (n/a = key not assigned) + +n/a RCAS WCAS C D E F +Start BP1/2 REG 8 9 A B +n/a PC MEM 4 5 6 7 +Reset - + 0 1 2 3 + +This wouldn't fit too well on our keyboard with any chance of remembering +it, so I've hooked it much the same as the Instructor. + +The Select key (Z) and the joystick don't actually exist, but I've left them +in the keyboard matrix for now. + + +Quickloads +---------- +You can load pgm and tvc files with the quickload facility. The quickloads +are meant for the ElektorTVGC, however with a bit a trickery they can be made +to work on the vc4000 as well. Procedure: + +- Get a copy of the Elektor bios and rename it to ELEKTOR.BIN then save it + with the rest of your vc4000 carts. + +- Start vc4000, and load ELEKTOR.BIN into the cartslot. Now your vc4000 + thinks it is an Elektor. + +- Load a quickload file. Some of them will work, and in some cases, better + than on the Elektor system. + + +Pasting +------- +This system uses the standard trainer paste codes: + 0-F : as is + + : ^ + - : V + MEM : - + MON : Q + +Here's a sample from the manual, page 34/35 (down-arrow to escape) +Q-0900^762005CA06CA0D4A00CD7F00FA780C1E88441099791F0000040005CA06CACD4A00FA7B +04FFCC0AC8CC0AC90409CC0AC60402CC0AC01F0900 +-0A00^F15155757FFFFFC3A52480FF4FFF-0AC0^C018P0900^ + +Another sample, from page 94 (Q to escape) +Q-0900^76203F0161063005080E492DCD4890597877103F020E75105A0A0C1E89F4101879 +1F003877103F02CF75101B5A +17A2A2A2A2A2A217 +17171000000D1717 +0A171100BC17000F +17170D000E051717 +14150A0CBC120C0E +0A171112BCBC110EP0900^ + + +******************************************************************************/ + +#include "includes/vc4000.h" + +READ8_MEMBER( vc4000_state::vc4000_key_r ) +{ + UINT8 data=0; + switch(offset & 0x0f) + { + case 0x08: + data = m_keypad1_1->read(); + break; + case 0x09: + data = m_keypad1_2->read(); + break; + case 0x0a: + data = m_keypad1_3->read(); + break; + case 0x0b: + data = m_panel->read(); + break; + case 0x0c: + data = m_keypad2_1->read(); + break; + case 0x0d: + data = m_keypad2_2->read(); + break; + case 0x0e: + data = m_keypad2_3->read(); + break; + } + return data; +} + +WRITE8_MEMBER( vc4000_state::vc4000_sound_ctl ) +{ + logerror("Write to sound control register offset= %d value= %d\n", offset, data); +} + +// Write cassette - Address 0x1DFF +WRITE8_MEMBER( vc4000_state::elektor_cass_w ) +{ + m_cassette->output(BIT(data, 7) ? -1.0 : +1.0); +} + +// Read cassette - Address 0x1DBF +READ8_MEMBER( vc4000_state::elektor_cass_r ) +{ + return (m_cassette->input() > 0.03) ? 0xff : 0x7f; +} + +static ADDRESS_MAP_START( vc4000_mem, AS_PROGRAM, 8, vc4000_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x1680, 0x16ff) AM_READWRITE(vc4000_key_r, vc4000_sound_ctl) AM_MIRROR(0x0800) + AM_RANGE(0x1700, 0x17ff) AM_READWRITE(vc4000_video_r, vc4000_video_w) AM_MIRROR(0x0800) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( vc4000_io, AS_IO, 8, vc4000_state ) + AM_RANGE( S2650_SENSE_PORT,S2650_SENSE_PORT) AM_READ(vc4000_vsync_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(elektor_mem, AS_PROGRAM, 8, vc4000_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x0800, 0x15ff) AM_RAM + AM_RANGE(0x1d80, 0x1dff) AM_MIRROR(0x400) AM_READWRITE(elektor_cass_r,elektor_cass_w) + AM_RANGE(0x1e80, 0x1e8f) AM_MIRROR(0x800) AM_READWRITE(vc4000_key_r,vc4000_sound_ctl) + AM_RANGE(0x1f00, 0x1fff) AM_MIRROR(0x800) AM_READWRITE(vc4000_video_r, vc4000_video_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( vc4000 ) + PORT_START("PANEL") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Game Select") + + PORT_START("KEYPAD1_1") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Enter") PORT_CODE(KEYCODE_PLUS_PAD) + + PORT_START("KEYPAD1_2") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 0") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("KEYPAD1_3") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Clear") PORT_CODE(KEYCODE_MINUS_PAD) + + PORT_START("KEYPAD2_1") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Enter") PORT_CODE(KEYCODE_V) + + PORT_START("KEYPAD2_2") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 0") PORT_CODE(KEYCODE_F) + + PORT_START("KEYPAD2_3") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Clear") PORT_CODE(KEYCODE_R) +#ifndef ANALOG_HACK + // auto centering too slow, so only using 5 bits, and scaling at videoside + PORT_START("JOY1_X") +PORT_BIT(0xff,0x70,IPT_AD_STICK_X) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) + PORT_START("JOY1_Y") +PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) + PORT_START("JOY2_X") +PORT_BIT(0xff,0x70,IPT_AD_STICK_X) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_DEL) PORT_CODE_INC(KEYCODE_PGDN) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) + PORT_START("JOY2_Y") +PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_HOME) PORT_CODE_INC(KEYCODE_END) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) +#else + PORT_START("JOYS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CODE(KEYCODE_DEL) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CODE(KEYCODE_PGDN) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CODE(KEYCODE_END) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CODE(KEYCODE_HOME) PORT_PLAYER(2) + + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x00, "Treat Joystick as...") + PORT_CONFSETTING( 0x00, "Buttons") + PORT_CONFSETTING( 0x01, "Paddle") +#endif +INPUT_PORTS_END + +INPUT_PORTS_START( elektor ) + PORT_START("PANEL") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MON") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Game Select") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + + PORT_START("KEYPAD1_1") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RCAS") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BP1/2") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + + PORT_START("KEYPAD1_2") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("WCAS") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + + PORT_START("KEYPAD1_3") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + + PORT_START("KEYPAD2_1") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + + PORT_START("KEYPAD2_2") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + + PORT_START("KEYPAD2_3") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') +#ifndef ANALOG_HACK + // auto centering too slow, so only using 5 bits, and scaling at videoside + PORT_START("JOY1_X") +PORT_BIT(0xff,0x70,IPT_AD_STICK_X) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) + PORT_START("JOY1_Y") +PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) + PORT_START("JOY2_X") +PORT_BIT(0xff,0x70,IPT_AD_STICK_X) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_DEL) PORT_CODE_INC(KEYCODE_PGDN) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) + PORT_START("JOY2_Y") +PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_HOME) PORT_CODE_INC(KEYCODE_END) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) +#else + PORT_START("JOYS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CODE(KEYCODE_DEL) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CODE(KEYCODE_PGDN) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CODE(KEYCODE_END) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CODE(KEYCODE_HOME) PORT_PLAYER(2) + + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x00, "Treat Joystick as...") + PORT_CONFSETTING( 0x00, "Buttons") + PORT_CONFSETTING( 0x01, "Paddle") +#endif +INPUT_PORTS_END + +static const rgb_t vc4000_palette[] = +{ + // background colors + rgb_t(0, 0, 0), // black + rgb_t(0, 0, 175), // blue + rgb_t(0, 175, 0), // green + rgb_t(0, 255, 255), // cyan + rgb_t(255, 0, 0), // red + rgb_t(255, 0, 255), // magenta + rgb_t(200, 200, 0), // yellow + rgb_t(200, 200, 200), // white + /* sprite colors + The control line simply inverts the RGB lines all at once. + We can do that in the code with ^7 */ +}; + +PALETTE_INIT_MEMBER(vc4000_state, vc4000) +{ + palette.set_pen_colors(0, vc4000_palette, ARRAY_LENGTH(vc4000_palette)); +} + + +void vc4000_state::machine_start() +{ + if (m_cart->exists()) + { + // extra handler + switch (m_cart->get_type()) + { + case VC4000_STD: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x07ff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); + break; + case VC4000_ROM4K: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); + break; + case VC4000_RAM1K: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x15ff, read8_delegate(FUNC(vc4000_cart_slot_device::read_ram),(vc4000_cart_slot_device*)m_cart), write8_delegate(FUNC(vc4000_cart_slot_device::write_ram),(vc4000_cart_slot_device*)m_cart)); + break; + case VC4000_CHESS2: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x15ff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1800, 0x1bff, read8_delegate(FUNC(vc4000_cart_slot_device::read_ram),(vc4000_cart_slot_device*)m_cart), write8_delegate(FUNC(vc4000_cart_slot_device::write_ram),(vc4000_cart_slot_device*)m_cart)); + break; + // undumped Radofin Hobby Module +// case VC4000_HOBBY: +// m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x07ff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); +// m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0800, 0x0fff, read8_delegate(FUNC(vc4000_cart_slot_device::read_ram),(vc4000_cart_slot_device*)m_cart), write8_delegate(FUNC(vc4000_cart_slot_device::write_ram),(vc4000_cart_slot_device*)m_cart)); +// break; + } + + m_cart->save_ram(); + } +} + + +QUICKLOAD_LOAD_MEMBER( vc4000_state,vc4000) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int i; + int exec_addr; + int quick_length; + dynamic_buffer quick_data; + int read_; + int result = IMAGE_INIT_FAIL; + + quick_length = image.length(); + quick_data.resize(quick_length); + read_ = image.fread( &quick_data[0], quick_length); + if (read_ != quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); + image.message(" Cannot read the file"); + } + else + { + if (core_stricmp(image.filetype(), "tvc")==0) + { + if (quick_data[0] != 2) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.message(" Invalid header"); + } + else + { + int quick_addr = quick_data[1] * 256 + quick_data[2]; + exec_addr = quick_data[3] * 256 + quick_data[4]; + + if (quick_length < 0x5) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.message(" File too short"); + } + else + if ((quick_length + quick_addr - 5) > 0x1600) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.message(" File too long"); + } + else + { + space.write_byte(0x08be, quick_data[3]); + space.write_byte(0x08bf, quick_data[4]); + + for (i = 5; i < quick_length; i++) + space.write_byte(i - 5 + quick_addr, quick_data[i]); + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length-5,quick_addr,quick_addr+quick_length-5,exec_addr); + + // Start the quickload + m_maincpu->set_state_int(S2650_PC, exec_addr); + result = IMAGE_INIT_PASS; + } + } + } + else + if (core_stricmp(image.filetype(), "pgm")==0) + { + if (quick_data[0] != 0) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); + image.message(" Invalid header"); + } + else + { + exec_addr = quick_data[1] * 256 + quick_data[2]; + + if (exec_addr >= quick_length) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); + image.message(" Exec address beyond end of file"); + } + else + if (quick_length < 0x904) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); + image.message(" File too short"); + } + else + if (quick_length > 0x2000) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); + image.message(" File too long"); + } + else + { + space.write_byte(0x08be, quick_data[1]); + space.write_byte(0x08bf, quick_data[2]); + + // load to 08C0-15FF (standard ram + extra) + int read_ = 0x1600; + if (quick_length < 0x1600) + read_ = quick_length; + for (i = 0x8c0; i < read_; i++) + space.write_byte(i, quick_data[i]); + + // load to 1F50-1FAF (PVI regs) + read_ = 0x1FB0; + if (quick_length < 0x1FB0) + read_ = quick_length; + if (quick_length > 0x1FC0) + for (i = 0x1F50; i < read_; i++) + vc4000_video_w(space, i-0x1f00, quick_data[i]); + + /* display a message about the loaded quickload */ + image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); + + // Start the quickload + m_maincpu->set_state_int(S2650_PC, exec_addr); + result = IMAGE_INIT_PASS; + } + } + } + } + return result; +} + +static SLOT_INTERFACE_START(vc4000_cart) + SLOT_INTERFACE_INTERNAL("std", VC4000_ROM_STD) + SLOT_INTERFACE_INTERNAL("rom4k", VC4000_ROM_ROM4K) + SLOT_INTERFACE_INTERNAL("ram1k", VC4000_ROM_RAM1K) + SLOT_INTERFACE_INTERNAL("chess2", VC4000_ROM_CHESS2) +SLOT_INTERFACE_END + + +static MACHINE_CONFIG_START( vc4000, vc4000_state ) + /* basic machine hardware */ +// MCFG_CPU_ADD("maincpu", S2650, 865000) /* 3550000/4, 3580000/3, 4430000/3 */ + MCFG_CPU_ADD("maincpu", S2650, 3546875/4) + MCFG_CPU_PROGRAM_MAP(vc4000_mem) + MCFG_CPU_IO_MAP(vc4000_io) + MCFG_CPU_PERIODIC_INT_DRIVER(vc4000_state, vc4000_video_line, 312*53) // GOLF needs this exact value + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(226, 312) + MCFG_SCREEN_VISIBLE_AREA(8, 184, 0, 269) + MCFG_SCREEN_UPDATE_DRIVER(vc4000_state, screen_update_vc4000) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(vc4000_state, vc4000) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("custom", VC4000_SND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", vc4000_state, vc4000, "pgm,tvc", 0) + + /* cartridge */ + MCFG_VC4000_CARTRIDGE_ADD("cartslot", vc4000_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "vc4000") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( cx3000tc, vc4000 ) + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list", "cx3000tc") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( mpu1000, vc4000 ) + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list", "mpu1000") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( database, vc4000 ) + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list", "database") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( rwtrntcs, vc4000 ) + MCFG_DEVICE_REMOVE("cart_list") + MCFG_SOFTWARE_LIST_ADD("cart_list", "rwtrntcs") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( elektor, vc4000 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(elektor_mem) + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +ROM_START( vc4000 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( spc4000 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( cx3000tc ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( tvc4000 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( 1292apvs ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( 1392apvs ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( mpu1000 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( mpu2000 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( pp1292 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( pp1392 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( f1392 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( fforce2 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( hmg1292 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( hmg1392 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( lnsy1392 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( vc6000 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( database ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( vmdtbase ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( rwtrntcs ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( telngtcs ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( krvnjvtv ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( oc2000 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( mpt05 ) + ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) +ROM_END + +ROM_START( elektor ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "elektor.rom", 0x0000, 0x0800, CRC(e6ef1ee1) SHA1(6823b5a22582344016415f2a37f9f3a2dc75d2a7)) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +CONS(1978, vc4000, 0, 0, vc4000, vc4000, driver_device, 0, "Interton", "Interton Electronic VC 4000", MACHINE_IMPERFECT_GRAPHICS ) /* Germany, Austria, UK, Australia */ +CONS(1979, spc4000, vc4000, 0, vc4000, vc4000, driver_device, 0, "Grundig", "Super Play Computer 4000", MACHINE_IMPERFECT_GRAPHICS ) /* Germany, Austria */ +CONS(1979, cx3000tc, vc4000, 0, cx3000tc, vc4000, driver_device, 0, "Palson", "CX 3000 Tele Computer", MACHINE_IMPERFECT_GRAPHICS ) /* Spain */ +CONS(1979, tvc4000, vc4000, 0, vc4000, vc4000, driver_device, 0, "Koerting", "TVC-4000", MACHINE_IMPERFECT_GRAPHICS ) /* Argentina */ +CONS(1976, 1292apvs, 0, vc4000, vc4000, vc4000, driver_device, 0, "Radofin", "1292 Advanced Programmable Video System", MACHINE_IMPERFECT_GRAPHICS )/* Europe */ +CONS(1976, 1392apvs, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Radofin", "1392 Advanced Programmable Video System", MACHINE_IMPERFECT_GRAPHICS )/* Europe */ +CONS(1979, mpu1000, 1292apvs, 0, mpu1000, vc4000, driver_device, 0, "Acetronic", "MPU-1000", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ +CONS(1979, mpu2000, 1292apvs, 0, mpu1000, vc4000, driver_device, 0, "Acetronic", "MPU-2000", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ +CONS(1978, pp1292, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Audio Sonic", "PP-1292 Advanced Programmable Video System", MACHINE_IMPERFECT_GRAPHICS )/* Europe */ +CONS(1978, pp1392, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Audio Sonic", "PP-1392 Advanced Programmable Video System", MACHINE_IMPERFECT_GRAPHICS )/* Europe */ +CONS(1979, f1392, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Fountain", "Fountain 1392", MACHINE_IMPERFECT_GRAPHICS ) /* New Zealand */ +CONS(1979, fforce2, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Fountain", "Fountain Force 2", MACHINE_IMPERFECT_GRAPHICS ) /* New Zealand, Australia */ +CONS(1979, hmg1292, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Hanimex", "HMG 1292", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ +CONS(1979, hmg1392, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Hanimex", "HMG 1392", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ +CONS(1979, lnsy1392, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Lansay", "Lansay 1392", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ +CONS(1979, vc6000, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Prinztronic", "VC 6000", MACHINE_IMPERFECT_GRAPHICS ) /* UK */ +CONS(1979, database, 0, vc4000, database, vc4000, driver_device, 0, "Voltmace", "Voltmace Database", MACHINE_IMPERFECT_GRAPHICS ) /* UK */ +CONS(1979, vmdtbase, database, 0, database, vc4000, driver_device, 0, "Videomaster", "Videomaster Database Games-Computer", MACHINE_IMPERFECT_GRAPHICS )/* UK */ +CONS(1979, rwtrntcs, 0, vc4000, rwtrntcs, vc4000, driver_device, 0, "Rowtron", "Rowtron Television Computer System", MACHINE_IMPERFECT_GRAPHICS )/* UK */ +CONS(1979, telngtcs, rwtrntcs, 0, rwtrntcs, vc4000, driver_device, 0, "Teleng", "Teleng Television Computer System", MACHINE_IMPERFECT_GRAPHICS )/* UK */ +CONS(1979, krvnjvtv, 0, vc4000, vc4000, vc4000, driver_device, 0, "SOE", "OC Jeu Video TV Karvan", MACHINE_IMPERFECT_GRAPHICS ) /* France */ +CONS(1979, oc2000, krvnjvtv, 0, vc4000, vc4000, driver_device, 0, "SOE", "OC-2000", MACHINE_IMPERFECT_GRAPHICS ) /* France */ +CONS(1980, mpt05, 0, vc4000, vc4000, vc4000, driver_device, 0, "ITMC", "MPT-05", MACHINE_IMPERFECT_GRAPHICS ) /* France */ +CONS(1979, elektor, 0, 0, elektor, elektor, driver_device, 0, "Elektor", "Elektor TV Games Computer", MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/vcs80.c b/src/mame/drivers/vcs80.c new file mode 100644 index 00000000000..cd6e9512825 --- /dev/null +++ b/src/mame/drivers/vcs80.c @@ -0,0 +1,257 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + VCS-80 + + 12/05/2009 Skeleton driver. + + http://hc-ddr.hucki.net/entwicklungssysteme.htm#VCS_80_von_Eckhard_Schiller + +This system is heavily based on the tk80. The display and keyboard matrix +are very similar, while the operation is easier in the vcs80. The hardware +is completely different however. + +Pasting: + 0-F : as is + A+ : ^ + A- : V + MA : - + GO : X + +When booted, the system begins at 0000 which is ROM. You need to change the +address to 0400 before entering a program. Here is a test to paste in: +0400-11^22^33^44^55^66^77^88^99^0400- +Press the up-arrow to confirm data has been entered. + +Operation: +4 digits at left is the address; 2 digits at right is the data. +As you increment addresses, the middle 2 digits show the previous byte. +You can enter 4 digits, and pressing 'MA' will transfer this info +to the left, thus setting the address to this value. Press 'A+' to +store new data and increment the address. + +****************************************************************************/ + +#include "includes/vcs80.h" +#include "vcs80.lh" + +/* Read/Write Handlers */ + +READ8_MEMBER( vcs80_state::pio_r ) +{ + switch (offset) + { + case 0: return m_pio->control_read(); + case 1: return m_pio->control_read(); + case 2: return m_pio->data_read(1); + case 3: return m_pio->data_read(0); + } + + return 0; +} + +WRITE8_MEMBER( vcs80_state::pio_w ) +{ + switch (offset) + { + case 0: m_pio->control_write(1, data); break; + case 1: m_pio->control_write(0, data); break; + case 2: m_pio->data_write(1, data); break; + case 3: m_pio->data_write(0, data); break; + } +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( vcs80_mem, AS_PROGRAM, 8, vcs80_state ) + AM_RANGE(0x0000, 0x01ff) AM_ROM + AM_RANGE(0x0400, 0x07ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( vcs80_io, AS_IO, 8, vcs80_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x04, 0x07) AM_READWRITE(pio_r, pio_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( vcs80 ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MA") PORT_CODE(KEYCODE_M) PORT_CHAR('-') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TR") PORT_CODE(KEYCODE_T) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ST") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PE") PORT_CODE(KEYCODE_P) +INPUT_PORTS_END + +/* Z80-PIO Interface */ + +TIMER_DEVICE_CALLBACK_MEMBER(vcs80_state::vcs80_keyboard_tick) +{ + if (m_keyclk) + { + m_keylatch++; + m_keylatch &= 7; + } + + m_pio->port_a_write(m_keyclk << 7); + + m_keyclk = !m_keyclk; +} + +READ8_MEMBER( vcs80_state::pio_pa_r ) +{ + /* + + bit description + + PA0 keyboard and led latch bit 0 + PA1 keyboard and led latch bit 1 + PA2 keyboard and led latch bit 2 + PA3 GND + PA4 keyboard row input 0 + PA5 keyboard row input 1 + PA6 keyboard row input 2 + PA7 demultiplexer clock input + + */ + + UINT8 data = 0; + + /* keyboard and led latch */ + data |= m_keylatch; + + /* keyboard rows */ + data |= BIT(m_y0->read(), m_keylatch) << 4; + data |= BIT(m_y1->read(), m_keylatch) << 5; + data |= BIT(m_y2->read(), m_keylatch) << 6; + + /* demultiplexer clock */ + data |= (m_keyclk << 7); + + return data; +} + +WRITE8_MEMBER( vcs80_state::pio_pb_w ) +{ + /* + + bit description + + PB0 VQD30 segment A + PB1 VQD30 segment B + PB2 VQD30 segment C + PB3 VQD30 segment D + PB4 VQD30 segment E + PB5 VQD30 segment G + PB6 VQD30 segment F + PB7 _A0 + + */ + + UINT8 led_data = BITSWAP8(data & 0x7f, 7, 5, 6, 4, 3, 2, 1, 0); + int digit = m_keylatch; + + /* skip middle digit */ + if (digit > 3) digit++; + + output_set_digit_value(8 - digit, led_data); +} + +/* Z80 Daisy Chain */ + +static const z80_daisy_config vcs80_daisy_chain[] = +{ + { Z80PIO_TAG }, + { NULL } +}; + +/* Machine Initialization */ + +void vcs80_state::machine_start() +{ + m_pio->strobe_a(1); + m_pio->strobe_b(1); + + /* register for state saving */ + save_item(NAME(m_keylatch)); + save_item(NAME(m_keyclk)); +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( vcs80, vcs80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_5MHz/2) /* U880D */ + MCFG_CPU_PROGRAM_MAP(vcs80_mem) + MCFG_CPU_IO_MAP(vcs80_io) + MCFG_CPU_CONFIG(vcs80_daisy_chain) + + /* keyboard timer */ + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", vcs80_state, vcs80_keyboard_tick, attotime::from_hz(1000)) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT( layout_vcs80 ) + + /* devices */ + MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_5MHz/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(vcs80_state, pio_pa_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(vcs80_state, pio_pb_w)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( vcs80 ) + ROM_REGION( 0x10000, Z80_TAG, 0 ) + ROM_LOAD( "monitor.rom", 0x0000, 0x0200, CRC(44aff4e9) SHA1(3472e5a9357eaba3ed6de65dee2b1c6b29349dd2) ) +ROM_END + +/* Driver Initialization */ + +DIRECT_UPDATE_MEMBER(vcs80_state::vcs80_direct_update_handler) +{ + /* _A0 is connected to PIO PB7 */ + m_pio->port_b_write((!BIT(address, 0)) << 7); + + return address; +} + +DRIVER_INIT_MEMBER(vcs80_state,vcs80) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(vcs80_state::vcs80_direct_update_handler), this)); + m_maincpu->space(AS_IO).set_direct_update_handler(direct_update_delegate(FUNC(vcs80_state::vcs80_direct_update_handler), this)); +} + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, vcs80, 0, 0, vcs80, vcs80, vcs80_state, vcs80, "Eckhard Schiller", "VCS-80", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/vector06.c b/src/mame/drivers/vector06.c new file mode 100644 index 00000000000..8546573f221 --- /dev/null +++ b/src/mame/drivers/vector06.c @@ -0,0 +1,233 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Vector06c driver by Miodrag Milanovic + + 10/07/2008 Preliminary driver. + +****************************************************************************/ + +#include "includes/vector06.h" +#include "formats/vector06_dsk.h" + + +/* Address maps */ +static ADDRESS_MAP_START(vector06_mem, AS_PROGRAM, 8, vector06_state) + AM_RANGE( 0x0000, 0x7fff ) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") + AM_RANGE( 0x8000, 0xffff ) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vector06_io, AS_IO, 8, vector06_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x00, 0x03) AM_READWRITE(vector06_8255_1_r, vector06_8255_1_w ) + AM_RANGE( 0x04, 0x07) AM_READWRITE(vector06_8255_2_r, vector06_8255_2_w ) + AM_RANGE( 0x0C, 0x0C) AM_WRITE(vector06_color_set) + AM_RANGE( 0x18, 0x18) AM_DEVREADWRITE("wd1793", fd1793_t, data_r, data_w) + AM_RANGE( 0x19, 0x19) AM_DEVREADWRITE("wd1793", fd1793_t, sector_r, sector_w) + AM_RANGE( 0x1a, 0x1a) AM_DEVREADWRITE("wd1793", fd1793_t, track_r, track_w) + AM_RANGE( 0x1b, 0x1b) AM_DEVREADWRITE("wd1793", fd1793_t, status_r, cmd_w) + AM_RANGE( 0x1C, 0x1C) AM_WRITE(vector06_disc_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vector06 ) + PORT_START("LINE.0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BkSp") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_START("LINE.1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_START("LINE.2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_START("LINE.3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_START("LINE.4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_START("LINE.5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_START("LINE.6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_START("LINE.7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_START("LINE.8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) + PORT_START("RESET") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset 2") PORT_CODE(KEYCODE_F12) + +INPUT_PORTS_END + + +FLOPPY_FORMATS_MEMBER( vector06_state::floppy_formats ) + FLOPPY_VECTOR06_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( vector06_floppies ) + SLOT_INTERFACE("qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + + +/* Machine driver */ +static MACHINE_CONFIG_START( vector06, vector06_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8080, 3000000) +// MCFG_CPU_ADD("maincpu", Z80, 3000000) + MCFG_CPU_PROGRAM_MAP(vector06_mem) + MCFG_CPU_IO_MAP(vector06_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", vector06_state, vector06_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vector06_state,vector06_irq_callback) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(256+64, 256+64) + MCFG_SCREEN_VISIBLE_AREA(0, 256+64-1, 0, 256+64-1) + MCFG_SCREEN_UPDATE_DRIVER(vector06_state, screen_update_vector06) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(vector06_state, vector06) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD("ppi8255", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(vector06_state, vector06_8255_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(vector06_state, vector06_8255_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(vector06_state, vector06_8255_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(vector06_state, vector06_8255_portc_r)) + + MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + MCFG_I8255_OUT_PORTA_CB(WRITE8(vector06_state, vector06_romdisk_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(vector06_state, vector06_romdisk_portb_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(vector06_state, vector06_romdisk_portc_w)) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_FD1793_ADD("wd1793", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("wd1793:0", vector06_floppies, "qd", vector06_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1793:1", vector06_floppies, "qd", vector06_state::floppy_formats) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vector06_cart") + MCFG_GENERIC_EXTENSIONS("bin,emr") + + MCFG_SOFTWARE_LIST_ADD("cart_list", "vector06_cart") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_DEFAULT_VALUE(0) +MACHINE_CONFIG_END + +/* ROM definition */ + +ROM_START( vector06 ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "unboot32k", "Universal Boot 32K") + ROMX_LOAD( "unboot32k.rt", 0x10000, 0x8000, CRC(28c9b5cd) SHA1(8cd7fb658896a7066ae93b10eaafa0f12139ad81), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "unboot2k", "Universal Boot 2K") + ROMX_LOAD( "unboot2k.rt", 0x10000, 0x0800, CRC(4c80dc31) SHA1(7e5e3acfdbea2e52b0d64c5868821deaec383815), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(2, "coman", "Boot Coman") + ROMX_LOAD( "coman.rt", 0x10000, 0x0800, CRC(f8c4a85a) SHA1(47fa8b02f09a1d06aa63a2b90b2597b1d93d976f), ROM_BIOS(3)) + ROM_SYSTEM_BIOS(3, "bootbyte", "Boot Byte") + ROMX_LOAD( "bootbyte.rt", 0x10000, 0x0800, CRC(3b42fd9d) SHA1(a112f4fe519bc3dbee85b09040d4804a17c9eda2), ROM_BIOS(4)) + ROM_SYSTEM_BIOS(4, "bootos", "Boot OS") + ROMX_LOAD( "bootos.rt", 0x10000, 0x0200, CRC(46bef038) SHA1(6732f4a360cd38112c53c458842d31f5b035cf59), ROM_BIOS(5)) + ROM_SYSTEM_BIOS(5, "boot512", "Boot 512") + ROMX_LOAD( "boot512.rt", 0x10000, 0x0200, CRC(a0b1c6b2) SHA1(f6fe15cb0974aed30f9b7aa72133324a66d1ed3f), ROM_BIOS(6)) +ROM_END + +ROM_START( vec1200 ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "vec1200.bin", 0x10000, 0x2000, CRC(37349224) SHA1(060fbb2c1a89040c929521cfd58cb6f1431a8b75)) + + ROM_REGION( 0x0200, "palette", 0 ) + ROM_LOAD( "palette.bin", 0x0000, 0x0200, CRC(74b7376b) SHA1(fb56b60babd7e6ed68e5f4e791ad2800d7ef6729)) +ROM_END + +ROM_START( pk6128c ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "6128.bin", 0x10000, 0x4000, CRC(d4f68433) SHA1(ef5ac75f9240ca8996689c23642d4e47e5e774d8)) +ROM_END + +ROM_START( krista2 ) + ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "krista2.epr", 0x10000, 0x0200, CRC(df5440b0) SHA1(bcbbb3cc10aeb17c1262b45111d20279266b9ba4)) + ROM_LOAD( "krista2.pal", 0x0000, 0x0200, CRC(b243da33) SHA1(9af7873e6f8bf452c8d831833ffb02dce833c095)) +ROM_END +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, vector06, 0, 0, vector06, vector06, driver_device, 0, "", "Vector 06c", MACHINE_NOT_WORKING) +COMP( 1987, vec1200, vector06, 0, vector06, vector06, driver_device, 0, "", "Vector 1200", MACHINE_NOT_WORKING) +COMP( 1987, pk6128c, vector06, 0, vector06, vector06, driver_device, 0, "", "PK-6128c", MACHINE_NOT_WORKING) +COMP( 1987, krista2, vector06, 0, vector06, vector06, driver_device, 0, "", "Krista-2", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/vector4.c b/src/mame/drivers/vector4.c new file mode 100644 index 00000000000..52a1e8c5938 --- /dev/null +++ b/src/mame/drivers/vector4.c @@ -0,0 +1,120 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Vector 4 + + 08/12/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class vector4_state : public driver_device +{ +public: + vector4_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + DECLARE_READ8_MEMBER(vector4_02_r); + DECLARE_READ8_MEMBER(vector4_03_r); + DECLARE_WRITE8_MEMBER(vector4_02_w); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_term_data; + virtual void machine_reset(); +}; + + + +WRITE8_MEMBER( vector4_state::vector4_02_w ) +{ + if (data < 0xff) + m_terminal->write(space, 0, data); +} + +READ8_MEMBER( vector4_state::vector4_03_r ) +{ + return (m_term_data) ? 3 : 1; +} + +READ8_MEMBER( vector4_state::vector4_02_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +static ADDRESS_MAP_START(vector4_mem, AS_PROGRAM, 8, vector4_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xf8ff) AM_ROM + AM_RANGE(0xfc00, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vector4_io, AS_IO, 8, vector4_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x02, 0x02) AM_READWRITE(vector4_02_r,vector4_02_w) + AM_RANGE(0x03, 0x03) AM_READ(vector4_03_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vector4 ) +INPUT_PORTS_END + + +void vector4_state::machine_reset() +{ + m_term_data = 0; + m_maincpu->set_state_int(Z80_PC, 0xe000); +} + +WRITE8_MEMBER( vector4_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( vector4, vector4_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(vector4_mem) + MCFG_CPU_IO_MAP(vector4_io) + + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(vector4_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( vector4 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + + ROM_SYSTEM_BIOS( 0, "v4c", "ver 4.0c" ) + ROMX_LOAD( "vg40cl_ihl.bin", 0xe000, 0x0400, CRC(dcaf79e6) SHA1(63619ddb12ff51e5862902fb1b33a6630f555ad7), ROM_BIOS(1)) + ROMX_LOAD( "vg40ch_ihl.bin", 0xe400, 0x0400, CRC(3ff97d70) SHA1(b401e49aa97ac106c2fd5ee72d89e683ebe34e34), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "v43", "ver 4.3" ) + ROMX_LOAD( "vg-em-43.bin", 0xe000, 0x1000, CRC(29a0fcee) SHA1(ca44de527f525b72f78b1c084c39aa6ce21731b5), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS( 2, "v5", "ver 5.0" ) + ROMX_LOAD( "vg-zcb50.bin", 0xe000, 0x1000, CRC(22d692ce) SHA1(cbb21b0acc98983bf5febd59ff67615d71596e36), ROM_BIOS(3)) + ROM_LOAD( "mfdc.bin", 0xf800, 0x0100, CRC(d82a40d6) SHA1(cd1ef5fb0312cd1640e0853d2442d7d858bc3e3b)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, vector4, 0, 0, vector4, vector4, driver_device, 0, "Vector Graphics", "Vector 4", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/vg5k.c b/src/mame/drivers/vg5k.c new file mode 100644 index 00000000000..8cbf24c352f --- /dev/null +++ b/src/mame/drivers/vg5k.c @@ -0,0 +1,421 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Philips VG-5000mu + + Driver by Sandro Ronco with help from Daniel Coulom + + 05/2010 (Sandro Ronco) + - EF9345 video controller + - keyboard input ports + 05/2009 Skeleton driver. + + Known issues: + - 1200 bauds cassette don't works + - BASIC games hangs in default BIOS but works in alternative version + + Informations ( see the very informative http://vg5k.free.fr/ ): + - Variants: Radiola VG5000 and Schneider VG5000 + - CPU: Zilog Z80 running at 4MHz + - ROM: 18KB (16 KB BASIC + 2 KB charset ) + - RAM: 24 KB + - Video: SGS Thomson EF9345 processor + - Text mode: 25 rows x 40 columns + - Character matrix: 8 x 10 + - ASCII characters set, 128 graphics mode characters, 192 user characters. + - Graphics mode: not available within basic, only semi graphic is available. + - Colors: 8 + - Sound: Synthesizer, 4 Octaves + - Keyboard: 63 keys AZERTY, Caps Lock, CTRL key to access 33 BASIC instructions + - I/O: Tape recorder connector (1200/2400 bauds), Scart connector to TV (RGB), + External PSU (VU0022) connector, Bus connector (2x25 pins) + - There are 2 versions of the VG5000 ROM, one with Basic v1.0, + contained in two 8 KB ROMs, and one with Basic 1.1, contained in + a single 16 KB ROM. + - RAM: 24 KB (3 x 8 KB) type SRAM D4168C, more precisely: + 2 x 8 KB, used by the system + 1 x 8 KB, used by the video processor + - Memory Map: + $0000 - $3fff BASIC + monitor + $4000 - $47cf Screen + $47d0 - $7fff reserved area for BASIC, variables, etc + $8000 - $bfff Memory Expansion 16K or ROM cart + $c000 - $ffff Memory Expansion 32K or ROM cart + - This computer was NOT MSX-compatible! + + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "imagedev/printer.h" +#include "video/ef9345.h" +#include "sound/dac.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "formats/vg5k_cas.h" + + +class vg5k_state : public driver_device +{ +public: + vg5k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ef9345(*this, "ef9345"), + m_dac(*this, "dac"), + m_printer(*this, "printer"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG) + { } + + required_device m_maincpu; + required_device m_ef9345; + required_device m_dac; + required_device m_printer; + required_device m_cassette; + required_device m_ram; + + offs_t m_ef9345_offset; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( printer_r ); + DECLARE_WRITE8_MEMBER( printer_w ); + DECLARE_WRITE8_MEMBER ( ef9345_offset_w ); + DECLARE_READ8_MEMBER ( ef9345_io_r ); + DECLARE_WRITE8_MEMBER ( ef9345_io_w ); + DECLARE_READ8_MEMBER ( cassette_r ); + DECLARE_WRITE8_MEMBER ( cassette_w ); + DECLARE_DRIVER_INIT(vg5k); + TIMER_CALLBACK_MEMBER(z80_irq_clear); + TIMER_DEVICE_CALLBACK_MEMBER(z80_irq); + TIMER_DEVICE_CALLBACK_MEMBER(vg5k_scanline); +}; + + +READ8_MEMBER( vg5k_state::printer_r ) +{ + return (m_printer->is_ready() ? 0x00 : 0xff); +} + + +WRITE8_MEMBER( vg5k_state::printer_w ) +{ + m_printer->output(data); +} + + +WRITE8_MEMBER ( vg5k_state::ef9345_offset_w ) +{ + m_ef9345_offset = data; +} + + +READ8_MEMBER ( vg5k_state::ef9345_io_r ) +{ + return m_ef9345->data_r(space, m_ef9345_offset, 0xff); +} + + +WRITE8_MEMBER ( vg5k_state::ef9345_io_w ) +{ + m_ef9345->data_w(space, m_ef9345_offset, data, 0xff); +} + + +READ8_MEMBER ( vg5k_state::cassette_r ) +{ + double level = m_cassette->input(); + + return (level > 0.03) ? 0xff : 0x00; +} + + +WRITE8_MEMBER ( vg5k_state::cassette_w ) +{ + m_dac->write_unsigned8(data <<2); + + if (data == 0x03) + m_cassette->output(+1); + else if (data == 0x02) + m_cassette->output(-1); + else + m_cassette->output(0); +} + + +static ADDRESS_MAP_START( vg5k_mem, AS_PROGRAM, 8, vg5k_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x3fff ) AM_ROM + AM_RANGE( 0x4000, 0x7fff ) AM_RAM + AM_RANGE( 0x8000, 0xffff ) AM_NOP /* messram expansion memory */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( vg5k_io , AS_IO, 8, vg5k_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK (0xff) + + /* joystick */ + AM_RANGE( 0x07, 0x07 ) AM_READ_PORT("JOY0") + AM_RANGE( 0x08, 0x08 ) AM_READ_PORT("JOY1") + + /* printer */ + AM_RANGE( 0x10, 0x10 ) AM_READ(printer_r) + AM_RANGE( 0x11, 0x11 ) AM_WRITE(printer_w) + + /* keyboard */ + AM_RANGE( 0x80, 0x80 ) AM_READ_PORT("ROW1") + AM_RANGE( 0x81, 0x81 ) AM_READ_PORT("ROW2") + AM_RANGE( 0x82, 0x82 ) AM_READ_PORT("ROW3") + AM_RANGE( 0x83, 0x83 ) AM_READ_PORT("ROW4") + AM_RANGE( 0x84, 0x84 ) AM_READ_PORT("ROW5") + AM_RANGE( 0x85, 0x85 ) AM_READ_PORT("ROW6") + AM_RANGE( 0x86, 0x86 ) AM_READ_PORT("ROW7") + AM_RANGE( 0x87, 0x87 ) AM_READ_PORT("ROW8") + + /* EF9345 */ + AM_RANGE( 0x8f, 0x8f ) AM_WRITE(ef9345_offset_w) + AM_RANGE( 0xcf, 0xcf ) AM_READWRITE(ef9345_io_r, ef9345_io_w) + + /* cassette */ + AM_RANGE( 0xaf,0xaf ) AM_READWRITE(cassette_r, cassette_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vg5k ) + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("HOME") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("SHIFT") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_NAME("LEFT") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("RIGHT") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_NAME("DOWN") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_NAME("CTRL") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INS") + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("RUN") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("CAPSLOCK") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("ENTER") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_NAME("UP") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("..") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("PRINT") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_START("ROW8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("<--") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_START("JOY0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED + PORT_START("JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED +INPUT_PORTS_END + + +TIMER_CALLBACK_MEMBER(vg5k_state::z80_irq_clear) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); +} + + +TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::z80_irq) +{ + m_maincpu->set_input_line(0, ASSERT_LINE); + + machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(vg5k_state::z80_irq_clear),this)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::vg5k_scanline) +{ + m_ef9345->update_scanline((UINT16)param); +} + + +void vg5k_state::machine_start() +{ + save_item(NAME(m_ef9345_offset)); +} + +void vg5k_state::machine_reset() +{ + m_ef9345_offset = 0; +} + +/* F4 Character Displayer */ +static const gfx_layout vg5k_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( vg5k ) + GFXDECODE_ENTRY( "ef9345", 0x2000, vg5k_charlayout, 0, 4 ) +GFXDECODE_END + +DRIVER_INIT_MEMBER(vg5k_state,vg5k) +{ + UINT8 *FNT = memregion("ef9345")->base(); + UINT16 a,b,c,d,dest=0x2000; + + /* Unscramble the chargen rom as the format is too complex for gfxdecode to handle unaided */ + for (a = 0; a < 8192; a+=4096) + for (b = 0; b < 2048; b+=64) + for (c = 0; c < 4; c++) + for (d = 0; d < 64; d+=4) + FNT[dest++]=FNT[a|b|c|d]; + + + /* install expansion memory*/ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + UINT16 ram_size = m_ram->size(); + + if (ram_size > 0x4000) + program.install_ram(0x8000, 0x3fff + ram_size, ram); +} + + +static MACHINE_CONFIG_START( vg5k, vg5k_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(vg5k_mem) + MCFG_CPU_IO_MAP(vg5k_io) + + MCFG_TIMER_DRIVER_ADD_SCANLINE("vg5k_scanline", vg5k_state, vg5k_scanline, "screen", 0, 10) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", vg5k_state, z80_irq, attotime::from_msec(20)) + + MCFG_DEVICE_ADD("ef9345", EF9345, 0) + MCFG_EF9345_PALETTE("palette") + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("ef9345", ef9345_device, screen_update) + MCFG_SCREEN_SIZE(336, 300) + MCFG_SCREEN_VISIBLE_AREA(00, 336-1, 00, 270-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", vg5k) + MCFG_PALETTE_ADD("palette", 8) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("dac", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + /* cassette */ + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(0, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(vg5k_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MASK_SPEAKER) + MCFG_CASSETTE_INTERFACE("vg5k_cass") + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("32K,48k") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cass_list", "vg5k") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( vg5k ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS(0, "v11", "BASIC v1.1") + ROMX_LOAD( "vg5k11.bin", 0x0000, 0x4000, CRC(a6998ff8) SHA1(881ba594be0a721a999378312aea0c3c1c7b2b58), ROM_BIOS(1) ) // dumped from a Radiola VG-5000 + ROM_SYSTEM_BIOS(1, "v11a", "BASIC v1.1 (alt)") + ROMX_LOAD( "vg5k11a.bin", 0x0000, 0x4000, BAD_DUMP CRC(a6f4a0ea) SHA1(58eccce33cc21fc17bc83921018f531b8001eda3), ROM_BIOS(2) ) // from dcvg5k + ROM_SYSTEM_BIOS(2, "v10", "BASIC v1.0") + ROMX_LOAD( "vg5k10.bin", 0x0000, 0x4000, BAD_DUMP CRC(57983260) SHA1(5ad1787a6a597b5c3eedb7c3704b649faa9be4ca), ROM_BIOS(3) ) + + ROM_REGION( 0x4000, "ef9345", 0 ) + ROM_LOAD( "charset.rom", 0x0000, 0x2000, BAD_DUMP CRC(b2f49eb3) SHA1(d0ef530be33bfc296314e7152302d95fdf9520fc) ) // from dcvg5k +ROM_END + +/* Driver */ +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, vg5k, 0, 0, vg5k, vg5k, vg5k_state, vg5k, "Philips", "VG-5000", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/vic10.c b/src/mame/drivers/vic10.c new file mode 100644 index 00000000000..d34232c93bd --- /dev/null +++ b/src/mame/drivers/vic10.c @@ -0,0 +1,678 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + TODO: + + - memory mapping with PLA + - PLA dump + +*/ + + + +#include "includes/vic10.h" + + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// check_interrupts - +//------------------------------------------------- + +void vic10_state::check_interrupts() +{ + m_maincpu->set_input_line(M6502_IRQ_LINE, m_cia_irq || m_vic_irq || m_exp_irq); +} + + + +//************************************************************************** +// MEMORY MANAGEMENT +//************************************************************************** + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( vic10_state::read ) +{ + // TODO this is really handled by the PLA + + UINT8 data = m_vic->bus_r(); + int lorom = 1, uprom = 1, exram = 1; + + if (offset < 0x800) + { + data = m_ram->pointer()[offset]; + } + else if (offset < 0x1000) + { + exram = 0; + } + else if (offset >= 0x8000 && offset < 0xa000) + { + lorom = 0; + } + else if (offset >= 0xd000 && offset < 0xd400) + { + data = m_vic->read(space, offset & 0x3f); + } + else if (offset >= 0xd400 && offset < 0xd800) + { + data = m_sid->read(space, offset & 0x1f); + } + else if (offset >= 0xd800 && offset < 0xdc00) + { + data = m_color_ram[offset & 0x3ff]; + } + else if (offset >= 0xdc00 && offset < 0xe000) + { + data = m_cia->read(space, offset & 0x0f); + } + else if (offset >= 0xe000) + { + uprom = 0; + } + + return m_exp->cd_r(space, offset, data, lorom, uprom, exram); +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( vic10_state::write ) +{ + // TODO this is really handled by the PLA + + int lorom = 1, uprom = 1, exram = 1; + + if (offset < 0x800) + { + m_ram->pointer()[offset] = data; + } + else if (offset < 0x1000) + { + exram = 0; + } + else if (offset >= 0xd000 && offset < 0xd400) + { + m_vic->write(space, offset & 0x3f, data); + } + else if (offset >= 0xd400 && offset < 0xd800) + { + m_sid->write(space, offset & 0x1f, data); + } + else if (offset >= 0xd800 && offset < 0xdc00) + { + m_color_ram[offset & 0x3ff] = data & 0x0f; + } + else if (offset >= 0xdc00 && offset < 0xe000) + { + m_cia->write(space, offset & 0x0f, data); + } + + m_exp->cd_w(space, offset, data, lorom, uprom, exram); +} + + +//------------------------------------------------- +// vic_videoram_r - +//------------------------------------------------- + +READ8_MEMBER( vic10_state::vic_videoram_r ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + if (offset < 0x3000) + return program.read_byte(offset); + + return program.read_byte(0xe000 + (offset & 0x1fff)); +} + + +//------------------------------------------------- +// vic_colorram_r - +//------------------------------------------------- + +READ8_MEMBER( vic10_state::vic_colorram_r ) +{ + return m_color_ram[offset]; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( vic10_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic10_mem, AS_PROGRAM, 8, vic10_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_videoram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, vic10_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_colorram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, vic10_state ) + AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( vic10 ) +//------------------------------------------------- + +static INPUT_PORTS_START( vic10 ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START( "RESTORE" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) + + PORT_START( "LOCK" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// vic2_interface vic_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( vic10_state::vic_irq_w ) +{ + m_vic_irq = state; + + check_interrupts(); +} + + +//------------------------------------------------- +// sid6581_interface sid_intf +//------------------------------------------------- + +READ8_MEMBER( vic10_state::sid_potx_r ) +{ + UINT8 data = 0xff; + + switch (m_cia->pa_r() >> 6) + { + case 1: data = m_joy1->pot_x_r(); break; + case 2: data = m_joy2->pot_x_r(); break; + case 3: + if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) + { + data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); + } + else if (m_joy1->has_pot_x()) + { + data = m_joy1->pot_x_r(); + } + else if (m_joy2->has_pot_x()) + { + data = m_joy2->pot_x_r(); + } + break; + } + + return data; +} + +READ8_MEMBER( vic10_state::sid_poty_r ) +{ + UINT8 data = 0xff; + + switch (m_cia->pa_r() >> 6) + { + case 1: data = m_joy1->pot_y_r(); break; + case 2: data = m_joy2->pot_y_r(); break; + case 3: + if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) + { + data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); + } + else if (m_joy1->has_pot_y()) + { + data = m_joy1->pot_y_r(); + } + else if (m_joy2->has_pot_y()) + { + data = m_joy2->pot_y_r(); + } + break; + } + + return data; +} + + +//------------------------------------------------- +// MOS6526_INTERFACE( cia_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( vic10_state::cia_irq_w ) +{ + m_cia_irq = state; + + check_interrupts(); +} + +READ8_MEMBER( vic10_state::cia_pa_r ) +{ + /* + + bit description + + PA0 COL0, JOY B0 + PA1 COL1, JOY B1 + PA2 COL2, JOY B2 + PA3 COL3, JOY B3 + PA4 COL4, BTNB + PA5 COL5 + PA6 COL6 + PA7 COL7 + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy_b = m_joy2->joy_r(); + + data &= (0xf0 | (joy_b & 0x0f)); + data &= ~(!BIT(joy_b, 5) << 4); + + // keyboard + UINT8 cia_pb = m_cia->pb_r(); + UINT8 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), + m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; + + for (int i = 0; i < 8; i++) + { + if (!BIT(cia_pb, i)) + { + if (!BIT(row[7], i)) data &= ~0x80; + if (!BIT(row[6], i)) data &= ~0x40; + if (!BIT(row[5], i)) data &= ~0x20; + if (!BIT(row[4], i)) data &= ~0x10; + if (!BIT(row[3], i)) data &= ~0x08; + if (!BIT(row[2], i)) data &= ~0x04; + if (!BIT(row[1], i)) data &= ~0x02; + if (!BIT(row[0], i)) data &= ~0x01; + } + } + + return data; +} + +READ8_MEMBER( vic10_state::cia_pb_r ) +{ + /* + + bit description + + PB0 JOY A0 + PB1 JOY A1 + PB2 JOY A2 + PB3 JOY A3 + PB4 BTNA/_LP + PB5 + PB6 + PB7 + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy_a = m_joy1->joy_r(); + + data &= (0xf0 | (joy_a & 0x0f)); + data &= ~(!BIT(joy_a, 5) << 4); + + // keyboard + UINT8 cia_pa = m_cia->pa_r(); + + if (!BIT(cia_pa, 7)) data &= m_row7->read(); + if (!BIT(cia_pa, 6)) data &= m_row6->read(); + if (!BIT(cia_pa, 5)) data &= m_row5->read(); + if (!BIT(cia_pa, 4)) data &= m_row4->read(); + if (!BIT(cia_pa, 3)) data &= m_row3->read(); + if (!BIT(cia_pa, 2)) data &= m_row2->read(); + if (!BIT(cia_pa, 1)) data &= m_row1->read() & m_lock->read(); + if (!BIT(cia_pa, 0)) data &= m_row0->read(); + + return data; +} + +WRITE8_MEMBER( vic10_state::cia_pb_w ) +{ + /* + + bit description + + PB0 ROW0 + PB1 ROW1 + PB2 ROW2 + PB3 ROW3 + PB4 ROW4 + PB5 ROW5 + PB6 ROW6 + PB7 ROW7 + + */ + + m_vic->lp_w(BIT(data, 4)); +} + + +//------------------------------------------------- +// M6510_INTERFACE( cpu_intf ) +//------------------------------------------------- + +READ8_MEMBER( vic10_state::cpu_r ) +{ + /* + + bit description + + P0 EXPANSION PORT + P1 + P2 + P3 + P4 CASS SENS + P5 0 + + */ + + UINT8 data = 0; + + // expansion port + data |= m_exp->p0_r(); + + // cassette sense + data |= m_cassette->sense_r() << 4; + + return data; +} + +WRITE8_MEMBER( vic10_state::cpu_w ) +{ + /* + + bit description + + P0 EXPANSION PORT + P1 + P2 + P3 CASS WRT + P4 + P5 CASS MOTOR + + */ + + if (BIT(offset, 0)) + { + m_exp->p0_w(BIT(data, 0)); + } + + // cassette write + m_cassette->write(BIT(data, 3)); + + // cassette motor + m_cassette->motor_w(BIT(data, 5)); +} + + +//------------------------------------------------- +// VIC10_EXPANSION_INTERFACE( expansion_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( vic10_state::exp_irq_w ) +{ + m_exp_irq = state; + + check_interrupts(); +} + +WRITE_LINE_MEMBER( vic10_state::exp_reset_w ) +{ + if (state == ASSERT_LINE) + { + machine_reset(); + } +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( vic10 ) +//------------------------------------------------- + +void vic10_state::machine_start() +{ + // allocate memory + m_color_ram.allocate(0x400); + + // initialize memory + UINT8 data = 0xff; + + for (offs_t offset = 0; offset < m_ram->size(); offset++) + { + m_ram->pointer()[offset] = data; + if (!(offset % 64)) data ^= 0xff; + } + + // state saving + save_item(NAME(m_cia_irq)); + save_item(NAME(m_vic_irq)); + save_item(NAME(m_exp_irq)); +} + + +void vic10_state::machine_reset() +{ + m_maincpu->reset(); + + m_vic->reset(); + m_sid->reset(); + m_cia->reset(); + + m_exp->reset(); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( vic10 ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( vic10, vic10_state ) + // basic hardware + MCFG_CPU_ADD(M6510_TAG, M6510, XTAL_8MHz/8) + MCFG_CPU_PROGRAM_MAP(vic10_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + MCFG_M6510_PORT_CALLBACKS(READ8(vic10_state, cpu_r), WRITE8(vic10_state, cpu_w)) + MCFG_M6510_PORT_PULLS(0x10, 0x20) + MCFG_QUANTUM_PERFECT_CPU(M6510_TAG) + + // video hardware + MCFG_DEVICE_ADD(MOS6566_TAG, MOS6566, XTAL_8MHz/8) + MCFG_MOS6566_CPU(M6510_TAG) + MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(vic10_state, vic_irq_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) + MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(VIC6566_VRETRACERATE) + MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) + MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) + MCFG_SCREEN_UPDATE_DEVICE(MOS6566_TAG, mos6566_device, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_8MHz/8) + MCFG_MOS6581_POTX_CALLBACK(READ8(vic10_state, sid_potx_r)) + MCFG_MOS6581_POTY_CALLBACK(READ8(vic10_state, sid_poty_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + // devices + MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526, XTAL_8MHz/8) + MCFG_MOS6526_TOD(60) + MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(vic10_state, cia_irq_w)) + MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, cnt_w)) + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, sp_w)) + MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(vic10_state, cia_pa_r)) + MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(vic10_state, cia_pb_r)) + MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(vic10_state, cia_pb_w)) + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6566_TAG, mos6566_device, lp_w)) + MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") + MCFG_VIC10_EXPANSION_SLOT_ADD(VIC10_EXPANSION_SLOT_TAG, XTAL_8MHz/8, vic10_expansion_cards, NULL) + MCFG_VIC10_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(vic10_state, exp_irq_w)) + MCFG_VIC10_EXPANSION_SLOT_RES_CALLBACK(WRITELINE(vic10_state, exp_reset_w)) + MCFG_VIC10_EXPANSION_SLOT_CNT_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w)) + MCFG_VIC10_EXPANSION_SLOT_SP_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w)) + + // software list + MCFG_SOFTWARE_LIST_ADD("cart_list", "vic10") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +ROM_START( vic10 ) + ROM_REGION( 0x100, "pla", 0 ) + ROM_LOAD( "6703.u4", 0x000, 0x100, NO_DUMP ) +ROM_END + + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +COMP( 1982, vic10, 0, 0, vic10, vic10, driver_device, 0, "Commodore Business Machines", "VIC-10 / Max Machine / UltiMax (NTSC)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/vic20.c b/src/mame/drivers/vic20.c new file mode 100644 index 00000000000..498e22c9b11 --- /dev/null +++ b/src/mame/drivers/vic20.c @@ -0,0 +1,859 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + TODO: + + - C1540 is not working currently + - mos6560_port_r/w should respond at 0x1000-0x100f + - VIC21 (built in 21K ram) + +*/ + +#include "includes/vic20.h" + + + +QUICKLOAD_LOAD_MEMBER( vic20_state, cbm_vc20 ) +{ + return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress); +} + +//************************************************************************** +// MEMORY MANAGEMENT +//************************************************************************** + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( vic20_state::read ) +{ + UINT8 data = m_vic->bus_r(); + + int ram1 = 1, ram2 = 1, ram3 = 1; + int blk1 = 1, blk2 = 1, blk3 = 1, blk5 = 1; + int io2 = 1, io3 = 1; + + switch ((offset >> 13) & 0x07) + { + case BLK0: + switch ((offset >> 10) & 0x07) + { + case RAM0: + data = m_ram->pointer()[offset & 0x3ff]; + break; + + case RAM1: ram1 = 0; break; + case RAM2: ram2 = 0; break; + case RAM3: ram3 = 0; break; + + default: + data = m_ram->pointer()[0x400 + (offset & 0xfff)]; + break; + } + break; + + case BLK1: blk1 = 0; break; + case BLK2: blk2 = 0; break; + case BLK3: blk3 = 0; break; + + case BLK4: + switch ((offset >> 10) & 0x07) + { + default: + data = m_charom[offset & 0xfff]; + break; + + case IO0: + if (BIT(offset, 4)) + { + data = m_via1->read(space, offset & 0x0f); + } + else if (BIT(offset, 5)) + { + data = m_via2->read(space, offset & 0x0f); + } + else if (offset >= 0x9000 && offset < 0x9010) + { + data = m_vic->read(space, offset & 0x0f); + } + break; + + case COLOR: + data = m_color_ram[offset & 0x3ff]; + break; + + case IO2: io2 = 0; break; + case IO3: io3 = 0; break; + } + break; + + case BLK5: blk5 = 0; break; + + case BLK6: + data = m_basic[offset & 0x1fff]; + break; + + case BLK7: + data = m_kernal[offset & 0x1fff]; + break; + } + + return m_exp->cd_r(space, offset & 0x1fff, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( vic20_state::write ) +{ + int ram1 = 1, ram2 = 1, ram3 = 1; + int blk1 = 1, blk2 = 1, blk3 = 1, blk5 = 1; + int io2 = 1, io3 = 1; + + switch ((offset >> 13) & 0x07) + { + case BLK0: + switch ((offset >> 10) & 0x07) + { + case RAM0: + m_ram->pointer()[offset] = data; + break; + + case RAM1: ram1 = 0; break; + case RAM2: ram2 = 0; break; + case RAM3: ram3 = 0; break; + + default: + m_ram->pointer()[0x400 + (offset & 0xfff)] = data; + break; + } + break; + + case BLK1: blk1 = 0; break; + case BLK2: blk2 = 0; break; + case BLK3: blk3 = 0; break; + + case BLK4: + switch ((offset >> 10) & 0x07) + { + case IO0: + if (BIT(offset, 4)) + { + m_via1->write(space, offset & 0x0f, data); + } + else if (BIT(offset, 5)) + { + m_via2->write(space, offset & 0x0f, data); + } + else if (offset >= 0x9000 && offset < 0x9010) + { + m_vic->write(space, offset & 0x0f, data); + } + break; + + case COLOR: + m_color_ram[offset & 0x3ff] = data & 0x0f; + break; + + case IO2: io2 = 0; break; + case IO3: io3 = 0; break; + } + break; + + case BLK5: blk5 = 0; break; + } + + m_exp->cd_w(space, offset & 0x1fff, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); +} + + +//------------------------------------------------- +// vic_videoram_r - +//------------------------------------------------- + +READ8_MEMBER( vic20_state::vic_videoram_r ) +{ + int ram1 = 1, ram2 = 1, ram3 = 1; + int blk1 = 1, blk2 = 1, blk3 = 1, blk5 = 1; + int io2 = 1, io3 = 1; + + UINT8 data = 0; + + if (BIT(offset, 13)) + { + switch ((offset >> 10) & 0x07) + { + case RAM0: + data = m_ram->pointer()[offset & 0x3ff]; + break; + + case RAM1: ram1 = 0; break; + case RAM2: ram2 = 0; break; + case RAM3: ram3 = 0; break; + + default: + data = m_ram->pointer()[0x400 + (offset & 0xfff)]; + break; + } + } + else + { + data = m_charom[offset & 0xfff]; + } + + return m_exp->cd_r(space, offset & 0x1fff, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( vic20_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic20_mem, AS_PROGRAM, 8, vic20_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_videoram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, vic20_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vic_colorram_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, vic20_state ) + AM_RANGE(0x000, 0x3ff) AM_RAM AM_SHARE("color_ram") +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( vic20 ) +//------------------------------------------------- + +static INPUT_PORTS_START( vic20 ) + PORT_START( "ROW0" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START( "ROW1" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + + PORT_START( "ROW2" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START( "ROW3" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_HOME) + + PORT_START( "ROW4" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START( "ROW5" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LCONTROL) + + PORT_START( "ROW6" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + + PORT_START( "ROW7" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + + PORT_START( "RESTORE" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(M6522_1_TAG, via6522_device, write_ca1) + + PORT_START( "LOCK" ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( vic1001 ) +//------------------------------------------------- + +static INPUT_PORTS_START( vic1001 ) + PORT_INCLUDE( vic20 ) + + PORT_MODIFY( "ROW0" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('\xA5') +INPUT_PORTS_END + + +//------------------------------------------------- +// INPUT_PORTS( vic20s ) +//------------------------------------------------- + +static INPUT_PORTS_START( vic20s ) + PORT_INCLUDE( vic20 ) + + PORT_MODIFY( "ROW0" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + + PORT_MODIFY( "ROW1" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('@') + + PORT_MODIFY( "ROW2" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) + + PORT_MODIFY( "ROW5" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) + + PORT_MODIFY( "ROW6" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00C5) + + PORT_MODIFY( "ROW7" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +READ8_MEMBER( vic20_state::via1_pa_r ) +{ + /* + + bit description + + PA0 SERIAL CLK IN + PA1 SERIAL DATA IN + PA2 JOY 0 (UP) + PA3 JOY 1 (DOWN) + PA4 JOY 2 (LEFT) + PA5 LITE PEN (FIRE) + PA6 CASS SWITCH + PA7 + + */ + + UINT8 data = 0; + + // serial clock in + data |= m_iec->clk_r(); + + // serial data in + data |= m_iec->data_r() << 1; + + // joystick / user port + UINT8 joy = m_joy->joy_r(); + + data |= (m_user_joy0 && BIT(joy, 0)) << 2; + data |= (m_user_joy1 && BIT(joy, 1)) << 3; + data |= (m_user_joy2 && BIT(joy, 2)) << 4; + data |= (m_user_light_pen && BIT(joy, 5)) << 5; + + // cassette switch + data |= (m_user_cassette_switch && m_cassette->sense_r()) << 6; + + return data; +} + +WRITE8_MEMBER( vic20_state::via1_pa_w ) +{ + /* + + bit description + + PA0 + PA1 + PA2 + PA3 + PA4 + PA5 LITE PEN (FIRE) + PA6 + PA7 SERIAL ATN OUT + + */ + + // light pen strobe + m_user->write_7(BIT(data, 5)); + m_vic->lp_w(BIT(data, 5)); + + // serial attention out + m_user->write_9(!BIT(data, 7)); + m_iec->atn_w(!BIT(data, 7)); +} + +WRITE8_MEMBER( vic20_state::via1_pb_w ) +{ + m_user->write_c((data>>0)&1); + m_user->write_d((data>>1)&1); + m_user->write_e((data>>2)&1); + m_user->write_f((data>>3)&1); + m_user->write_h((data>>4)&1); + m_user->write_j((data>>5)&1); + m_user->write_k((data>>6)&1); + m_user->write_l((data>>7)&1); +} + +READ8_MEMBER( vic20_state::via2_pa_r ) +{ + /* + + bit description + + PA0 ROW 0 + PA1 ROW 1 + PA2 ROW 2 + PA3 ROW 3 + PA4 ROW 4 + PA5 ROW 5 + PA6 ROW 6 + PA7 ROW 7 + + */ + + UINT8 data = 0xff; + + if (!BIT(m_key_col, 0)) data &= m_row0->read(); + if (!BIT(m_key_col, 1)) data &= m_row1->read(); + if (!BIT(m_key_col, 2)) data &= m_row2->read(); + if (!BIT(m_key_col, 3)) data &= m_row3->read(); + if (!BIT(m_key_col, 4)) data &= m_row4->read(); + if (!BIT(m_key_col, 5)) data &= m_row5->read(); + if (!BIT(m_key_col, 6)) data &= m_row6->read(); + if (!BIT(m_key_col, 7)) data &= m_row7->read(); + + return data; +} + +READ8_MEMBER( vic20_state::via2_pb_r ) +{ + /* + + bit description + + PB0 COL 0 + PB1 COL 1 + PB2 COL 2 + PB3 COL 3 + PB4 COL 4 + PB5 COL 5 + PB6 COL 6 + PB7 COL 7, JOY 3 (RIGHT) + + */ + + UINT8 data = 0xff; + + // joystick + UINT8 joy = m_joy->joy_r(); + + data &= BIT(joy, 3) << 7; + + return data; +} + +WRITE8_MEMBER( vic20_state::via2_pb_w ) +{ + /* + + bit description + + PB0 COL 0 + PB1 COL 1 + PB2 COL 2 + PB3 COL 3, CASS WRITE + PB4 COL 4 + PB5 COL 5 + PB6 COL 6 + PB7 COL 7 + + */ + + // cassette write + m_cassette->write(BIT(data, 3)); + + // keyboard column + m_key_col = data; +} + +WRITE_LINE_MEMBER( vic20_state::via2_ca2_w ) +{ + // serial clock out + m_iec->clk_w(!state); +} + +WRITE_LINE_MEMBER( vic20_state::via2_cb2_w ) +{ + // serial data out + m_iec->data_w(!state); +} + + +//------------------------------------------------- +// VIC20_EXPANSION_INTERFACE( expansion_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( vic20_state::exp_reset_w ) +{ + if (!state) + { + machine_reset(); + } +} + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( vic20 ) +//------------------------------------------------- + +void vic20_state::machine_start() +{ + // initialize memory + UINT8 data = 0xff; + + for (offs_t offset = 0; offset < m_ram->size(); offset++) + { + m_ram->pointer()[offset] = data; + if (!(offset % 64)) data ^= 0xff; + } + + // state saving + save_item(NAME(m_key_col)); + save_item(NAME(m_light_pen)); + save_item(NAME(m_user_joy0)); + save_item(NAME(m_user_joy1)); + save_item(NAME(m_user_joy2)); + save_item(NAME(m_user_light_pen)); + save_item(NAME(m_user_cassette_switch)); +} + + +void vic20_state::machine_reset() +{ + m_maincpu->reset(); + + m_vic->reset(); + m_via1->reset(); + m_via2->reset(); + + m_iec->reset(); + m_exp->reset(); + + m_user->write_3(0); + m_user->write_3(1); +} + +WRITE_LINE_MEMBER(vic20_state::write_user_joy0) +{ + m_user_joy0 = state; +} + +WRITE_LINE_MEMBER(vic20_state::write_user_joy1) +{ + m_user_joy1 = state; +} + +WRITE_LINE_MEMBER(vic20_state::write_user_joy2) +{ + m_user_joy2 = state; +} + +WRITE_LINE_MEMBER(vic20_state::write_light_pen) +{ + m_light_pen = state; + m_vic->lp_w(m_light_pen && m_user_light_pen); +} + +WRITE_LINE_MEMBER(vic20_state::write_user_light_pen) +{ + m_user_light_pen = state; + m_vic->lp_w(m_light_pen && m_user_light_pen); +} + +WRITE_LINE_MEMBER(vic20_state::write_user_cassette_switch) +{ + m_user_cassette_switch = state; +} + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( vic20_common ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( vic20, vic20_state ) + // devices + MCFG_DEVICE_ADD(M6522_1_TAG, VIA6522, 0) + MCFG_VIA6522_READPA_HANDLER(READ8(vic20_state, via1_pa_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(vic20_state, via1_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(vic20_state, via1_pb_w)) + MCFG_VIA6522_CB1_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_b)) + MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, motor_w)) + MCFG_VIA6522_CB2_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_m)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(M6502_TAG, m6502_device, nmi_line)) + + MCFG_DEVICE_ADD(M6522_2_TAG, VIA6522, 0) + MCFG_VIA6522_READPA_HANDLER(READ8(vic20_state, via2_pa_r)) + MCFG_VIA6522_READPB_HANDLER(READ8(vic20_state, via2_pb_r)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(vic20_state, via2_pb_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(vic20_state, via2_ca2_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(vic20_state, via2_cb2_w)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(M6502_TAG, m6502_device, irq_line)) + + MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(M6522_2_TAG, via6522_device, write_ca1)) + MCFG_CBM_IEC_ADD("c1541") + MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(M6522_2_TAG, via6522_device, write_cb1)) + + MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, "joy") + MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(WRITELINE(vic20_state, write_light_pen)) + + MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, vic20_user_port_cards, NULL) + MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(vic20_state, exp_reset_w)) + MCFG_PET_USER_PORT_4_HANDLER(WRITELINE(vic20_state, write_user_joy0)) + MCFG_PET_USER_PORT_5_HANDLER(WRITELINE(vic20_state, write_user_joy1)) + MCFG_PET_USER_PORT_6_HANDLER(WRITELINE(vic20_state, write_user_joy2)) + MCFG_PET_USER_PORT_7_HANDLER(WRITELINE(vic20_state, write_user_light_pen)) + MCFG_PET_USER_PORT_8_HANDLER(WRITELINE(vic20_state, write_user_cassette_switch)) + MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_cb1)) + MCFG_PET_USER_PORT_C_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb0)) + MCFG_PET_USER_PORT_D_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb1)) + MCFG_PET_USER_PORT_E_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb2)) + MCFG_PET_USER_PORT_F_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb3)) + MCFG_PET_USER_PORT_H_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb4)) + MCFG_PET_USER_PORT_J_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb5)) + MCFG_PET_USER_PORT_K_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb6)) + MCFG_PET_USER_PORT_L_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb7)) + MCFG_PET_USER_PORT_M_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_cb2)) + + MCFG_QUICKLOAD_ADD("quickload", vic20_state, cbm_vc20, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list", "vic1001_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "vic1001_cass") + MCFG_SOFTWARE_LIST_ADD("flop_list", "vic1001_flop") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("5K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( ntsc ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( ntsc, vic20 ) + // basic machine hardware + MCFG_CPU_ADD(M6502_TAG, M6502, MOS6560_CLOCK) + MCFG_CPU_PROGRAM_MAP(vic20_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + + // video/sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_MOS6560_ADD(M6560_TAG, SCREEN_TAG, MOS6560_CLOCK, vic_videoram_map, vic_colorram_map) + MCFG_MOS6560_POTX_CALLBACK(DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_x_r)) + MCFG_MOS6560_POTY_CALLBACK(DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_y_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, MOS6560_CLOCK, vic20_expansion_cards, NULL) + MCFG_VIC20_EXPANSION_SLOT_IRQ_CALLBACK(INPUTLINE(M6502_TAG, M6502_IRQ_LINE)) + MCFG_VIC20_EXPANSION_SLOT_NMI_CALLBACK(INPUTLINE(M6502_TAG, M6502_NMI_LINE)) + MCFG_VIC20_EXPANSION_SLOT_RES_CALLBACK(WRITELINE(vic20_state, exp_reset_w)) + + // software lists + MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("cass_list", "NTSC") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( pal ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( pal, vic20 ) + // basic machine hardware + MCFG_CPU_ADD(M6502_TAG, M6502, MOS6561_CLOCK) + MCFG_CPU_PROGRAM_MAP(vic20_mem) + MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks + + // video/sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_MOS6561_ADD(M6560_TAG, SCREEN_TAG, MOS6561_CLOCK, vic_videoram_map, vic_colorram_map) + MCFG_MOS6560_POTX_CALLBACK(DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_x_r)) + MCFG_MOS6560_POTY_CALLBACK(DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_y_r)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, MOS6561_CLOCK, vic20_expansion_cards, NULL) + MCFG_VIC20_EXPANSION_SLOT_IRQ_CALLBACK(INPUTLINE(M6502_TAG, M6502_IRQ_LINE)) + MCFG_VIC20_EXPANSION_SLOT_NMI_CALLBACK(INPUTLINE(M6502_TAG, M6502_NMI_LINE)) + MCFG_VIC20_EXPANSION_SLOT_RES_CALLBACK(WRITELINE(vic20_state, exp_reset_w)) + + // software lists + MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") + MCFG_SOFTWARE_LIST_FILTER("cass_list", "PAL") + MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +//------------------------------------------------- +// ROM( vic1001 ) +//------------------------------------------------- + +ROM_START( vic1001 ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901486-01", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "901486-02", 0x0000, 0x2000, CRC(336900d7) SHA1(c9ead45e6674d1042ca6199160e8583c23aeac22) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901460-02", 0x0000, 0x1000, CRC(fcfd8a4b) SHA1(dae61ac03065aa2904af5c123ce821855898c555) ) +ROM_END + + +//------------------------------------------------- +// ROM( vic20 ) +//------------------------------------------------- + +ROM_START( vic20 ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901486-01.ue11", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_SYSTEM_BIOS( 0, "cbm", "Original" ) + ROMX_LOAD( "901486-06.ue12", 0x0000, 0x2000, CRC(e5e7c174) SHA1(06de7ec017a5e78bd6746d89c2ecebb646efeb19), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "jiffydos", "JiffyDOS" ) + ROMX_LOAD( "jiffydos vic-20 ntsc.ue12", 0x0000, 0x2000, CRC(683a757f) SHA1(83fb83e97b5a840311dbf7e1fe56fe828f41936d), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901460-03.ud7", 0x0000, 0x1000, CRC(83e032a6) SHA1(4fd85ab6647ee2ac7ba40f729323f2472d35b9b4) ) +ROM_END + + +//------------------------------------------------- +// ROM( vic20p ) +//------------------------------------------------- + +ROM_START( vic20p ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901486-01.ue11", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_SYSTEM_BIOS( 0, "cbm", "Original" ) + ROMX_LOAD( "901486-07.ue12", 0x0000, 0x2000, CRC(4be07cb4) SHA1(ce0137ed69f003a299f43538fa9eee27898e621e), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "jiffydos", "JiffyDOS" ) + ROMX_LOAD( "jiffydos vic-20 pal.ue12", 0x0000, 0x2000, CRC(705e7810) SHA1(5a03623a4b855531b8bffd756f701306f128be2d), ROM_BIOS(2) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901460-03.ud7", 0x0000, 0x1000, CRC(83e032a6) SHA1(4fd85ab6647ee2ac7ba40f729323f2472d35b9b4) ) +ROM_END + + +//------------------------------------------------- +// ROM( vic20_se ) +//------------------------------------------------- + +ROM_START( vic20_se ) + ROM_REGION( 0x2000, "basic", 0 ) + ROM_LOAD( "901486-01.ue11", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) ) + + ROM_REGION( 0x2000, "kernal", 0 ) + ROM_LOAD( "nec22081.206", 0x0000, 0x2000, CRC(b2a60662) SHA1(cb3e2f6e661ea7f567977751846ce9ad524651a3) ) + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "nec22101.207", 0x0000, 0x1000, CRC(d808551d) SHA1(f403f0b0ce5922bd61bbd768bdd6f0b38e648c9f) ) +ROM_END + + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1980, vic1001, 0, 0, ntsc, vic1001, driver_device, 0, "Commodore Business Machines", "VIC-1001 (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +COMP( 1981, vic20, vic1001, 0, ntsc, vic20, driver_device, 0, "Commodore Business Machines", "VIC-20 (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +COMP( 1981, vic20p, vic1001, 0, pal, vic20, driver_device, 0, "Commodore Business Machines", "VIC-20 / VC-20 (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +COMP( 1981, vic20_se, vic1001, 0, pal, vic20s, driver_device, 0, "Commodore Business Machines", "VIC-20 (Sweden/Finland)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/victor9k.c b/src/mame/drivers/victor9k.c new file mode 100644 index 00000000000..a67c97c101f --- /dev/null +++ b/src/mame/drivers/victor9k.c @@ -0,0 +1,601 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Victor 9000 / ACT Sirius 1 emulation + +**********************************************************************/ + +/* + + TODO: + + - expansion bus + - Z80 card + - Winchester DMA card (Xebec S1410 + Tandon TM502/TM603SE) + - RAM cards + - clock cards + - floppy 8048 + - hires graphics + - brightness/contrast + - MC6852 + - codec sound + +*/ + +#include "includes/victor9k.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( victor9k_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( victor9k_mem, AS_PROGRAM, 8, victor9k_state ) + AM_RANGE(0x00000, 0x1ffff) AM_RAM + AM_RANGE(0x20000, 0xdffff) AM_NOP + AM_RANGE(0xe0000, 0xe0001) AM_MIRROR(0x7f00) AM_DEVREADWRITE(I8259A_TAG, pic8259_device, read, write) + AM_RANGE(0xe0020, 0xe0023) AM_MIRROR(0x7f00) AM_DEVREADWRITE(I8253_TAG, pit8253_device, read, write) + AM_RANGE(0xe0040, 0xe0043) AM_MIRROR(0x7f00) AM_DEVREADWRITE(UPD7201_TAG, upd7201_device, cd_ba_r, cd_ba_w) + AM_RANGE(0xe8000, 0xe8000) AM_MIRROR(0x7f00) AM_DEVREADWRITE(HD46505S_TAG, mc6845_device, status_r, address_w) + AM_RANGE(0xe8001, 0xe8001) AM_MIRROR(0x7f00) AM_DEVREADWRITE(HD46505S_TAG, mc6845_device, register_r, register_w) + AM_RANGE(0xe8020, 0xe802f) AM_MIRROR(0x7f00) AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write) + AM_RANGE(0xe8040, 0xe804f) AM_MIRROR(0x7f00) AM_DEVREADWRITE(M6522_2_TAG, via6522_device, read, write) + AM_RANGE(0xe8060, 0xe8061) AM_MIRROR(0x7f00) AM_DEVREADWRITE(MC6852_TAG, mc6852_device, read, write) + AM_RANGE(0xe8080, 0xe808f) AM_MIRROR(0x7f00) AM_DEVREADWRITE(M6522_3_TAG, via6522_device, read, write) + AM_RANGE(0xe80a0, 0xe80af) AM_MIRROR(0x7f00) AM_DEVREADWRITE(FDC_TAG, victor_9000_fdc_t, cs5_r, cs5_w) + AM_RANGE(0xe80c0, 0xe80cf) AM_MIRROR(0x7f00) AM_DEVREADWRITE(FDC_TAG, victor_9000_fdc_t, cs6_r, cs6_w) + AM_RANGE(0xe80e0, 0xe80ef) AM_MIRROR(0x7f00) AM_DEVREADWRITE(FDC_TAG, victor_9000_fdc_t, cs7_r, cs7_w) + AM_RANGE(0xf0000, 0xf0fff) AM_MIRROR(0x1000) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0xf8000, 0xf9fff) AM_MIRROR(0x6000) AM_ROM AM_REGION(I8088_TAG, 0) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( victor9k ) +//------------------------------------------------- + +static INPUT_PORTS_START( victor9k ) + // defined in machine/victor9kb.c +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MC6845 +//------------------------------------------------- + +#define CODE_NON_DISPLAY 0x1000 +#define CODE_UNDERLINE 0x2000 +#define CODE_LOW_INTENSITY 0x4000 +#define CODE_REVERSE_VIDEO 0x8000 + +MC6845_UPDATE_ROW( victor9k_state::crtc_update_row ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + if (BIT(ma, 13)) + { + fatalerror("Graphics mode not supported!\n"); + } + else + { + UINT16 video_ram_addr = (ma & 0xfff) << 1; + + for (int sx = 0; sx < x_count; sx++) + { + UINT16 code = (m_video_ram[video_ram_addr + 1] << 8) | m_video_ram[video_ram_addr]; + UINT32 char_ram_addr = (BIT(ma, 12) << 16) | ((code & 0xff) << 5) | (ra << 1); + UINT16 data = program.read_word(char_ram_addr); + + if (code & CODE_REVERSE_VIDEO) data ^= 0xffff; + if (code & CODE_NON_DISPLAY) data = 0; + if (sx == cursor_x) data = 0xffff; + + for (int x = 0; x <= 10; x++) + { + int pixel = BIT(data, x); + int color = palette[pixel && de]; + if (!(code & CODE_LOW_INTENSITY) && color) color = 2; + + bitmap.pix32(vbp + y, hbp + x + sx*10) = color; + } + + video_ram_addr += 2; + video_ram_addr &= 0xfff; + } + } +} + +WRITE_LINE_MEMBER(victor9k_state::vert_w) +{ + m_via2->write_pa7(state); + m_pic->ir7_w(state); +} + + + +WRITE_LINE_MEMBER(victor9k_state::mux_serial_b_w) +{ +} + +WRITE_LINE_MEMBER(victor9k_state::mux_serial_a_w) +{ +} + +//------------------------------------------------- +// PIC8259 +//------------------------------------------------- + +/* + + pin signal description + + IR0 SYN sync detect + IR1 COMM serial communications (7201) + IR2 TIMER 8253 timer + IR3 PARALLEL all 6522 IRQ (including disk) + IR4 IR4 expansion IR4 + IR5 IR5 expansion IR5 + IR6 KBINT keyboard data ready + IR7 VINT vertical sync or nonspecific interrupt + +*/ + +//------------------------------------------------- +// MC6852_INTERFACE( ssda_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( victor9k_state::ssda_irq_w ) +{ + m_ssda_irq = state; + + m_pic->ir3_w(m_ssda_irq || m_via1_irq || m_via3_irq || m_fdc_irq); +} + + +WRITE8_MEMBER( victor9k_state::via1_pa_w ) +{ + /* + + bit description + + PA0 DIO1 + PA1 DIO2 + PA2 DIO3 + PA3 DIO4 + PA4 DIO5 + PA5 DIO6 + PA6 DIO7 + PA7 DIO8 + + */ + + // centronics + m_centronics->write_data0(BIT(data, 0)); + m_centronics->write_data1(BIT(data, 1)); + m_centronics->write_data2(BIT(data, 2)); + m_centronics->write_data3(BIT(data, 3)); + m_centronics->write_data4(BIT(data, 4)); + m_centronics->write_data5(BIT(data, 5)); + m_centronics->write_data6(BIT(data, 6)); + m_centronics->write_data7(BIT(data, 7)); + + // IEEE-488 + m_ieee488->dio_w(data); +} + +DECLARE_WRITE_LINE_MEMBER( victor9k_state::write_nfrd ) +{ + m_via1->write_pb6(state); + m_via1->write_ca1(state); +} + +DECLARE_WRITE_LINE_MEMBER( victor9k_state::write_ndac ) +{ + m_via1->write_pb7(state); + m_via1->write_ca2(state); +} + +WRITE8_MEMBER( victor9k_state::via1_pb_w ) +{ + /* + + bit description + + PB0 STROBE/DAV + PB1 PI/EOI + PB2 REN + PB3 ATN + PB4 IFC + PB5 SRQ/BUSY SRQ + PB6 NRFD/ACK RFD + PB7 SEL/DAC + + */ + + // centronics + m_centronics->write_strobe(BIT(data, 0)); + + // IEEE-488 + m_ieee488->dav_w(BIT(data, 0)); + m_ieee488->eoi_w(BIT(data, 1)); + m_ieee488->ren_w(BIT(data, 2)); + m_ieee488->atn_w(BIT(data, 3)); + m_ieee488->ifc_w(BIT(data, 4)); + m_ieee488->srq_w(BIT(data, 5)); + m_ieee488->nrfd_w(BIT(data, 6)); + m_ieee488->ndac_w(BIT(data, 7)); +} + +WRITE_LINE_MEMBER( victor9k_state::codec_vol_w ) +{ +} + +WRITE_LINE_MEMBER( victor9k_state::via1_irq_w ) +{ + m_via1_irq = state; + + m_pic->ir3_w(m_ssda_irq || m_via1_irq || m_via3_irq || m_fdc_irq); +} + +WRITE8_MEMBER( victor9k_state::via2_pa_w ) +{ + /* + + bit description + + PA0 _INT/EXTA + PA1 _INT/EXTB + PA2 + PA3 + PA4 + PA5 + PA6 + PA7 + + */ +} + +void victor9k_state::update_kback() +{ + int kback = !(!(m_kbrdy && !m_via2_irq) && !(m_kbackctl && m_via2_irq)); + + m_kb->kback_w(kback); +} + +WRITE8_MEMBER( victor9k_state::via2_pb_w ) +{ + /* + + bit description + + PB0 TALK/LISTEN + PB1 KBACKCTL + PB2 BRT0 + PB3 BRT1 + PB4 BRT2 + PB5 CONT0 + PB6 CONT1 + PB7 CONT2 + + */ + + // keyboard acknowledge + m_kbackctl = BIT(data, 1); + update_kback(); + + // brightness + m_brt = (data >> 2) & 0x07; + + // contrast + m_cont = data >> 5; +} + +WRITE_LINE_MEMBER( victor9k_state::via2_irq_w ) +{ + m_via2_irq = state; + + m_pic->ir6_w(m_via2_irq); + update_kback(); +} + + +WRITE_LINE_MEMBER( victor9k_state::write_ria ) +{ + m_upd7201->ria_w(state); + m_via2->write_pa2(state); +} + + +WRITE_LINE_MEMBER( victor9k_state::write_rib ) +{ + m_upd7201->rib_w(state); + m_via2->write_pa4(state); +} + + +/* + bit description + + PA0 J5-16 + PA1 J5-18 + PA2 J5-20 + PA3 J5-22 + PA4 J5-24 + PA5 J5-26 + PA6 J5-28 + PA7 J5-30 + PB0 J5-32 + PB1 J5-34 + PB2 J5-36 + PB3 J5-38 + PB4 J5-40 + PB5 J5-42 + PB6 J5-44 + PB7 J5-46 + CA1 J5-12 + CB1 J5-48 + CA2 J5-14 + CB2 J5-50 +*/ + +WRITE8_MEMBER( victor9k_state::via3_pb_w ) +{ + // codec clock output + m_ssda->rx_clk_w(BIT(data, 7)); + m_ssda->tx_clk_w(BIT(data, 7)); +} + +WRITE_LINE_MEMBER( victor9k_state::via3_irq_w ) +{ + m_via3_irq = state; + + m_pic->ir3_w(m_ssda_irq || m_via1_irq || m_via3_irq || m_fdc_irq); +} + + +//------------------------------------------------- +// VICTOR9K_KEYBOARD_INTERFACE( kb_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( victor9k_state::kbrdy_w ) +{ + if (LOG) logerror("KBRDY %u\n", state); + + m_via2->write_cb1(state); + + m_kbrdy = state; + update_kback(); +} + +WRITE_LINE_MEMBER( victor9k_state::kbdata_w ) +{ + if (LOG) logerror("KBDATA %u\n", state); + + m_via2->write_cb2(state); + m_via2->write_pa6(state); +} + + +WRITE_LINE_MEMBER( victor9k_state::fdc_irq_w ) +{ + m_fdc_irq = state; + + m_pic->ir3_w(m_ssda_irq || m_via1_irq || m_via3_irq || m_fdc_irq); +} + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +void victor9k_state::machine_start() +{ + // state saving + save_item(NAME(m_brt)); + save_item(NAME(m_cont)); + save_item(NAME(m_via1_irq)); + save_item(NAME(m_via2_irq)); + save_item(NAME(m_via3_irq)); + save_item(NAME(m_fdc_irq)); + save_item(NAME(m_ssda_irq)); + save_item(NAME(m_kbrdy)); + save_item(NAME(m_kbackctl)); + + // patch out SCP self test + m_rom->base()[0x11ab] = 0xc3; + + // patch out ROM checksum error + m_rom->base()[0x1d51] = 0x90; + m_rom->base()[0x1d52] = 0x90; + m_rom->base()[0x1d53] = 0x90; + m_rom->base()[0x1d54] = 0x90; +} + +void victor9k_state::machine_reset() +{ + m_maincpu->reset(); + m_upd7201->reset(); + m_ssda->reset(); + m_via1->reset(); + m_via2->reset(); + m_via3->reset(); + m_crtc->reset(); + m_fdc->reset(); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( victor9k ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( victor9k, victor9k_state ) + // basic machine hardware + MCFG_CPU_ADD(I8088_TAG, I8088, XTAL_30MHz/6) + MCFG_CPU_PROGRAM_MAP(victor9k_mem) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A_TAG, pic8259_device, inta_cb) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate + MCFG_SCREEN_UPDATE_DEVICE(HD46505S_TAG, hd6845_device, screen_update) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + MCFG_MC6845_ADD(HD46505S_TAG, HD6845, SCREEN_TAG, XTAL_30MHz/11) // HD6845 == HD46505S + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(10) + MCFG_MC6845_UPDATE_ROW_CB(victor9k_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(victor9k_state, vert_w)) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(HC55516_TAG, HC55516, 100000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_IEEE488_BUS_ADD() + MCFG_IEEE488_DAV_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb0)) + MCFG_IEEE488_EOI_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb1)) + MCFG_IEEE488_REN_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb2)) + MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb3)) + MCFG_IEEE488_IFC_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb4)) + MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb5)) + MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(victor9k_state, write_nfrd)) + MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(victor9k_state, write_ndac)) + + MCFG_PIC8259_ADD(I8259A_TAG, INPUTLINE(I8088_TAG, INPUT_LINE_IRQ0), VCC, NULL) + + MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(2500000) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(victor9k_state, mux_serial_b_w)) + MCFG_PIT8253_CLK1(2500000) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(victor9k_state, mux_serial_a_w)) + MCFG_PIT8253_CLK2(100000) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE(I8259A_TAG, pic8259_device, ir2_w)) + + MCFG_UPD7201_ADD(UPD7201_TAG, XTAL_30MHz/30, 0, 0, 0, 0) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir1_w)) + + MCFG_DEVICE_ADD(MC6852_TAG, MC6852, XTAL_30MHz/30) + MCFG_MC6852_TX_DATA_CALLBACK(DEVWRITELINE(HC55516_TAG, hc55516_device, digit_w)) + MCFG_MC6852_IRQ_CALLBACK(WRITELINE(victor9k_state, ssda_irq_w)) + + MCFG_DEVICE_ADD(M6522_1_TAG, VIA6522, XTAL_30MHz/30) + MCFG_VIA6522_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(victor9k_state, via1_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor9k_state, via1_pb_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(victor9k_state, codec_vol_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor9k_state, via1_irq_w)) + + MCFG_DEVICE_ADD(M6522_2_TAG, VIA6522, XTAL_30MHz/30) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(victor9k_state, via2_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor9k_state, via2_pb_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor9k_state, via2_irq_w)) + + MCFG_DEVICE_ADD(M6522_3_TAG, VIA6522, XTAL_30MHz/30) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor9k_state, via3_pb_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor9k_state, via3_irq_w)) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb5)) + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb6)) + MCFG_CENTRONICS_SELECT_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb7)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, dcda_w)) + MCFG_RS232_RI_HANDLER(WRITELINE(victor9k_state, write_ria)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, ctsa_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(M6522_2_TAG, via6522_device, write_pa3)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, dcdb_w)) + MCFG_RS232_RI_HANDLER(WRITELINE(victor9k_state, write_ria)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, ctsb_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(M6522_2_TAG, via6522_device, write_pa5)) + + MCFG_DEVICE_ADD(KB_TAG, VICTOR9K_KEYBOARD, 0) + MCFG_VICTOR9K_KBRDY_HANDLER(WRITELINE(victor9k_state, kbrdy_w)) + MCFG_VICTOR9K_KBDATA_HANDLER(WRITELINE(victor9k_state, kbdata_w)) + + MCFG_DEVICE_ADD(FDC_TAG, VICTOR_9000_FDC, 0) + MCFG_VICTOR_9000_FDC_IRQ_CB(WRITELINE(victor9k_state, fdc_irq_w)) + MCFG_VICTOR_9000_FDC_SYN_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir0_w)) MCFG_DEVCB_XOR(1) + MCFG_VICTOR_9000_FDC_LBRDY_CB(INPUTLINE(I8088_TAG, INPUT_LINE_TEST)) MCFG_DEVCB_XOR(1) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "victor9k_flop") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( victor9k ) +//------------------------------------------------- + +ROM_START( victor9k ) + ROM_REGION( 0x2000, I8088_TAG, 0 ) + ROM_DEFAULT_BIOS( "univ" ) + ROM_SYSTEM_BIOS( 0, "old", "Older" ) + ROMX_LOAD( "102320.7j", 0x0000, 0x1000, CRC(3d615fd7) SHA1(b22f7e5d66404185395d8effbf57efded0079a92), ROM_BIOS(1) ) + ROMX_LOAD( "102322.8j", 0x1000, 0x1000, CRC(9209df0e) SHA1(3ee8e0c15186bbd5768b550ecc1fa3b6b1dbb928), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "univ", "Universal" ) + ROMX_LOAD( "v9000 univ. fe f3f7 13db.7j", 0x0000, 0x1000, CRC(25c7a59f) SHA1(8784e9aa7eb9439f81e18b8e223c94714e033911), ROM_BIOS(2) ) + ROMX_LOAD( "v9000 univ. ff f3f7 39fe.8j", 0x1000, 0x1000, CRC(496c7467) SHA1(eccf428f62ef94ab85f4a43ba59ae6a066244a66), ROM_BIOS(2) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1982, victor9k, 0, 0, victor9k, victor9k, driver_device, 0, "Victor Business Products", "Victor 9000", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/vidbrain.c b/src/mame/drivers/vidbrain.c new file mode 100644 index 00000000000..7612dc337db --- /dev/null +++ b/src/mame/drivers/vidbrain.c @@ -0,0 +1,601 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + VideoBrain FamilyComputer + + http://www.atariprotos.com/othersystems/videobrain/videobrain.htm + http://www.seanriddle.com/vbinfo.html + http://www.seanriddle.com/videobrain.html + http://www.google.com/patents/US4232374 + http://www.google.com/patents/US4177462 + http://www.orphanedgames.com/videobrain/ + http://www.datalytixllc.com/videobrain/ + http://blog.kevtris.org/blogfiles/videobrain/videobrain_unwrapped.txt + +****************************************************************************/ + +/* + + TODO: + + - wait states (UV201: 2.9us, memory except RES1: 1.65us) + - interlaced video? + - pinball background colors + - Y-zoom starting on odd scanline only 1 line high + - object height 0 glitch + - object column 0xff glitch + - video interrupts + - R-2R ladder DAC + - reset on cartridge unload + - use machine/f3853.h + - joystick scan timer 555 + - expander 1 (F3870 CPU, cassette, RS-232) + - expander 2 (modem) + +*/ + +#include "includes/vidbrain.h" +#include "vidbrain.lh" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 1 + + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// keyboard_w - keyboard column write +//------------------------------------------------- + +WRITE8_MEMBER( vidbrain_state::keyboard_w ) +{ + /* + + bit description + + 0 keyboard column 0, sound data 0 + 1 keyboard column 1, sound data 1 + 2 keyboard column 2 + 3 keyboard column 3 + 4 keyboard column 4 + 5 keyboard column 5 + 6 keyboard column 6 + 7 keyboard column 7 + + */ + + if (LOG) logerror("Keyboard %02x\n", data); + + m_keylatch = data; +} + + +//------------------------------------------------- +// keyboard_r - keyboard row read +//------------------------------------------------- + +READ8_MEMBER( vidbrain_state::keyboard_r ) +{ + /* + + bit description + + 0 keyboard row 0, joystick 1 fire + 1 keyboard row 1, joystick 2 fire + 2 keyboard row 2, joystick 3 fire + 3 keyboard row 3, joystick 4 fire + 4 + 5 + 6 + 7 + + */ + + UINT8 data = m_joy_r->read(); + + if (BIT(m_keylatch, 0)) data |= m_io00->read(); + if (BIT(m_keylatch, 1)) data |= m_io01->read(); + if (BIT(m_keylatch, 2)) data |= m_io02->read(); + if (BIT(m_keylatch, 3)) data |= m_io03->read(); + if (BIT(m_keylatch, 4)) data |= m_io04->read(); + if (BIT(m_keylatch, 5)) data |= m_io05->read(); + if (BIT(m_keylatch, 6)) data |= m_io06->read(); + if (BIT(m_keylatch, 7)) data |= m_io07->read(); + if (!m_uv->kbd_r()) data |= m_uv201_31->read(); + + return data; +} + + +//------------------------------------------------- +// sound_w - sound clock write +//------------------------------------------------- + +WRITE8_MEMBER( vidbrain_state::sound_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 sound clock + 5 accessory jack pin 5 + 6 accessory jack pin 1 + 7 joystick enable + + */ + + if (LOG) logerror("Sound %02x\n", data); + + // sound clock + int sound_clk = BIT(data, 4); + + if (!m_sound_clk && sound_clk) + { + //m_discrete->write(space, NODE_01, m_keylatch & 0x03); + + UINT8 dac_data = 0; + + switch (m_keylatch & 0x03) + { + case 0: dac_data = 0x00; break; + case 1: dac_data = 0x55; break; + case 2: dac_data = 0xaa; break; + case 3: dac_data = 0xff; break; + } + + m_dac->write_unsigned8(dac_data); + } + + m_sound_clk = sound_clk; + + // joystick enable + m_joy_enable = BIT(data, 7); +} + + +//------------------------------------------------- +// interrupt_check - check interrupts +//------------------------------------------------- + +void vidbrain_state::interrupt_check() +{ + int interrupt = CLEAR_LINE; + + switch (m_int_enable) + { + case 1: + if (m_ext_int_latch) interrupt = ASSERT_LINE; + break; + + case 3: + if (m_timer_int_latch) interrupt = ASSERT_LINE; + break; + } + + m_maincpu->set_input_line(F8_INPUT_LINE_INT_REQ, interrupt); +} + + +//------------------------------------------------- +// f3853_w - F3853 SMI write +//------------------------------------------------- + +WRITE8_MEMBER( vidbrain_state::f3853_w ) +{ + switch (offset) + { + case 0: + // interrupt vector address high + m_vector = (data << 8) | (m_vector & 0xff); + logerror("%s: F3853 Interrupt Vector %04x\n", machine().describe_context(), m_vector); + break; + + case 1: + // interrupt vector address low + m_vector = (m_vector & 0xff00) | data; + logerror("%s: F3853 Interrupt Vector %04x\n", machine().describe_context(), m_vector); + break; + + case 2: + // interrupt control + m_int_enable = data & 0x03; + logerror("%s: F3853 Interrupt Control %u\n", machine().describe_context(), m_int_enable); + interrupt_check(); + + if (m_int_enable == 0x03) fatalerror("F3853 Timer not supported!\n"); + break; + + case 3: + // timer 8-bit polynomial counter + fatalerror("%s: F3853 Timer not supported!\n", machine().describe_context()); + } +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( vidbrain_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vidbrain_mem, AS_PROGRAM, 8, vidbrain_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("res1", 0) + AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x2300) AM_DEVREADWRITE(UV201_TAG, uv201_device, read, write) + AM_RANGE(0x0c00, 0x0fff) AM_MIRROR(0x2000) AM_RAM + AM_RANGE(0x1000, 0x17ff) AM_DEVREADWRITE(VIDEOBRAIN_EXPANSION_SLOT_TAG, videobrain_expansion_slot_device, cs1_r, cs1_w) + AM_RANGE(0x1800, 0x1fff) AM_DEVREADWRITE(VIDEOBRAIN_EXPANSION_SLOT_TAG, videobrain_expansion_slot_device, cs2_r, cs2_w) + AM_RANGE(0x2000, 0x27ff) AM_ROM AM_REGION("res2", 0) + AM_RANGE(0x3000, 0x3fff) AM_DEVREADWRITE(VIDEOBRAIN_EXPANSION_SLOT_TAG, videobrain_expansion_slot_device, unmap_r, unmap_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vidbrain_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vidbrain_io, AS_IO, 8, vidbrain_state ) + AM_RANGE(0x00, 0x00) AM_WRITE(keyboard_w) + AM_RANGE(0x01, 0x01) AM_READWRITE(keyboard_r, sound_w) + AM_RANGE(0x0c, 0x0f) AM_WRITE(f3853_w) +// AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(F3853_TAG, f3853_device, read, write) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_CHANGED_MEMBER( trigger_reset ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( vidbrain_state::trigger_reset ) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); +} + + +//------------------------------------------------- +// INPUT_PORTS( vidbrain ) +//------------------------------------------------- + +static INPUT_PORTS_START( vidbrain ) + PORT_START("IO00") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P \xC2\xA2") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR(0x00a2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; \xC2\xB6") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(0x00b6) + + PORT_START("IO01") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('$') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('\'') PORT_CHAR('*') + + PORT_START("IO02") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y \xC3\xB7") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR(0x00f7) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR(':') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("IO03") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T \xC3\x97") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR(0x00d7) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('/') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(',') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ERASE RESTART") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_START("IO04") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('9') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('-') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('=') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE RUN/STOP") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("IO05") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('6') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPECIAL ALARM") PORT_CODE(KEYCODE_F4) + + PORT_START("IO06") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('7') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('5') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('3') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT CLOCK") PORT_CODE(KEYCODE_F3) + + PORT_START("IO07") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('4') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PREVIOUS COLOR") PORT_CODE(KEYCODE_F2) + + PORT_START("UV201-31") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('.') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('0') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BACK TEXT") PORT_CODE(KEYCODE_F1) + + PORT_START("RESET") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MASTER CONTROL") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, vidbrain_state, trigger_reset, 0) + + PORT_START("JOY1-X") + PORT_BIT( 0xff, 50, IPT_AD_STICK_X ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(1) + + PORT_START("JOY1-Y") + PORT_BIT( 0xff, 50, IPT_AD_STICK_Y ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(1) + + PORT_START("JOY2-X") + PORT_BIT( 0xff, 50, IPT_AD_STICK_X ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(2) + + PORT_START("JOY2-Y") + PORT_BIT( 0xff, 50, IPT_AD_STICK_Y ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(2) + + PORT_START("JOY3-X") + PORT_BIT( 0xff, 50, IPT_AD_STICK_X ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(3) + + PORT_START("JOY3-Y") + PORT_BIT( 0xff, 50, IPT_AD_STICK_Y ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(3) + + PORT_START("JOY4-X") + PORT_BIT( 0xff, 50, IPT_AD_STICK_X ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(4) + + PORT_START("JOY4-Y") + PORT_BIT( 0xff, 70, IPT_AD_STICK_Y ) PORT_MINMAX(0, 139) PORT_SENSITIVITY(25) PORT_PLAYER(4) + + PORT_START("JOY-R") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) +INPUT_PORTS_END + + + +//************************************************************************** +// SOUND +//************************************************************************** + +//------------------------------------------------- +// DISCRETE_SOUND( vidbrain ) +//------------------------------------------------- + +static const discrete_dac_r1_ladder vidbrain_dac = +{ + 2, + { RES_K(120), RES_K(120) }, // R=56K, 2R=120K + 0, 0, RES_K(120), 0 +}; + +static DISCRETE_SOUND_START( vidbrain ) + DISCRETE_INPUT_DATA(NODE_01) + DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &vidbrain_dac) + DISCRETE_OUTPUT(NODE_02, 5000) +DISCRETE_SOUND_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// f3853 interrupt request callback +//------------------------------------------------- + +F3853_INTERRUPT_REQ_CB(vidbrain_state::f3853_int_req_w) +{ + m_vector = addr; + m_maincpu->set_input_line(F8_INPUT_LINE_INT_REQ, level); +} + +//------------------------------------------------- +// UV201_INTERFACE( uv_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( vidbrain_state::ext_int_w ) +{ + if (state) + { + m_ext_int_latch = state; + interrupt_check(); + } +} + +WRITE_LINE_MEMBER( vidbrain_state::hblank_w ) +{ + if (state && m_joy_enable && !m_timer_ne555->enabled()) + { + UINT8 joydata = 0; + + if (!BIT(m_keylatch, 0)) joydata = m_joy1_x->read(); + if (!BIT(m_keylatch, 1)) joydata = m_joy1_y->read(); + if (!BIT(m_keylatch, 2)) joydata = m_joy2_x->read(); + if (!BIT(m_keylatch, 3)) joydata = m_joy2_y->read(); + if (!BIT(m_keylatch, 4)) joydata = m_joy3_x->read(); + if (!BIT(m_keylatch, 5)) joydata = m_joy3_y->read(); + if (!BIT(m_keylatch, 6)) joydata = m_joy4_x->read(); + if (!BIT(m_keylatch, 7)) joydata = m_joy4_y->read(); + + // NE555 in monostable mode + // R = 3K9 + 100K linear pot + // C = 0.003uF + // t = 1.1 * R * C + double t = 1.1 * (RES_K(3.9) + RES_K(joydata)) * 3; + + timer_set(attotime::from_nsec(t), TIMER_JOYSTICK); + } +} + +READ8_MEMBER(vidbrain_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// IRQ_CALLBACK_MEMBER(vidbrain_int_ack) +//------------------------------------------------- + +IRQ_CALLBACK_MEMBER(vidbrain_state::vidbrain_int_ack) +{ + UINT16 vector = m_vector; + + switch (m_int_enable) + { + case 1: + vector |= 0x80; + m_ext_int_latch = 0; + break; + + case 3: + vector &= ~0x80; + m_timer_int_latch = 0; + break; + } + + interrupt_check(); + + return vector; +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void vidbrain_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_uv->ext_int_w(0); + + m_ext_int_latch = 1; + interrupt_check(); +} + + +//------------------------------------------------- +// MACHINE_START( vidbrain ) +//------------------------------------------------- + +void vidbrain_state::machine_start() +{ + // allocate timers + m_timer_ne555 = timer_alloc(TIMER_JOYSTICK); + + // register for state saving + save_item(NAME(m_vector)); + save_item(NAME(m_int_enable)); + save_item(NAME(m_ext_int_latch)); + save_item(NAME(m_timer_int_latch)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_joy_enable)); + save_item(NAME(m_sound_clk)); +} + + +void vidbrain_state::machine_reset() +{ + m_int_enable = 0; + m_ext_int_latch = 0; + m_timer_int_latch = 0; +} + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( vidbrain ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( vidbrain, vidbrain_state ) + // basic machine hardware + MCFG_CPU_ADD(F3850_TAG, F8, XTAL_4MHz/2) + MCFG_CPU_PROGRAM_MAP(vidbrain_mem) + MCFG_CPU_IO_MAP(vidbrain_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vidbrain_state,vidbrain_int_ack) + + // video hardware + MCFG_DEFAULT_LAYOUT(layout_vidbrain) + + MCFG_UV201_ADD(UV201_TAG, SCREEN_TAG, 3636363, uv_intf) + MCFG_UV201_EXT_INT_CALLBACK(WRITELINE(vidbrain_state, ext_int_w)) + MCFG_UV201_HBLANK_CALLBACK(WRITELINE(vidbrain_state, hblank_w)) + MCFG_UV201_DB_CALLBACK(READ8(vidbrain_state, memory_read_byte)) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(vidbrain) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MCFG_SOUND_ADD(DAC_TAG, DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + // devices + MCFG_DEVICE_ADD(F3853_TAG, F3853, XTAL_4MHz/2) + MCFG_F3853_EXT_INPUT_CB(vidbrain_state, f3853_int_req_w) + + // cartridge + MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(VIDEOBRAIN_EXPANSION_SLOT_TAG, vidbrain_expansion_cards, NULL) + + // software lists + MCFG_SOFTWARE_LIST_ADD("cart_list", "vidbrain") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( vidbrain ) +//------------------------------------------------- + +ROM_START( vidbrain ) + ROM_REGION( 0x800, "res1", 0 ) + ROM_LOAD( "uvres 1n.d67", 0x000, 0x800, CRC(065fe7c2) SHA1(9776f9b18cd4d7142e58eff45ac5ee4bc1fa5a2a) ) + + ROM_REGION( 0x800, "res2", 0 ) + ROM_LOAD( "resn2.e5", 0x000, 0x800, CRC(1d85d7be) SHA1(26c5a25d1289dedf107fa43aa8dfc14692fd9ee6) ) + + ROM_REGION( 0x800, F3870_TAG, 0 ) + ROM_LOAD( "expander1.bin", 0x0000, 0x0800, CRC(dac31abc) SHA1(e1ac7a9d654c2a70979effc744d98f21d13b4e05) ) +ROM_END + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1977, vidbrain, 0, 0, vidbrain, vidbrain, driver_device, 0, "VideoBrain Computer Company", "VideoBrain FamilyComputer", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/vii.c b/src/mame/drivers/vii.c new file mode 100644 index 00000000000..8b845590826 --- /dev/null +++ b/src/mame/drivers/vii.c @@ -0,0 +1,1234 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz, Robbbert +/****************************************************************************** + + + Sport Vii / The Batman + ---------------------- + + MESS driver by Harmony + Based largely off of Unununium, by Segher + + +******************************************************************************* + + Short Description: + + Systems run on the SPG243 SoC + + Status: + + Mostly working + + To-Do: + + Audio (SPG243) + Motion controls (Vii) + + Known u'nSP-Based Systems: + + ND - SPG243 - Some form of Leapfrog "edutainment" system + ND - SPG243 - Star Wars: Clone Wars + ND - SPG243 - Toy Story + ND - SPG243 - Animal Art Studio + ND - SPG243 - Finding Nemo + D - SPG243 - The Batman + D - SPG243 - Wall-E + D - SPG243 - Chintendo / KenSingTon / Siatronics / Jungle Soft Vii + Partial D - SPG200 - V-Tech V-Smile + ND - Likely many more + + +Similar Systems: ( from http://en.wkikpedia.org/wiki/V.Smile ) +- V.Smile by Vtech, a system designed for children under the age of 10 +- V.Smile Pocket (2 versions) +- V.SMile Cyber Pocket +- V.Smile PC Pal +- V-Motion Active Learning System +- Leapster +- V.Smile Baby Infant Development System +- V.Flash + +Detailed list of bugs: +- When loading a cart from file manager, sometimes it will crash +- On 'vii_vc1' & 'vii_vc2' cart, the left-right keys are transposed with the up-down keys +- The game 'Jewel Master' on both above carts displays a priority error at top of screen +- In the default bios (no cart loaded): +-- In the menu, when 'Come On!' is selected, a graphics error appears +-- Catch Fish, black screen +-- Come On! freezes at the high score screen, controls seem haywire +-- Bird Knight, no controls +-- Lucky Dice, the dice never stop spinning +-- Fever Move, after pressing A it freezes +-- Alacrity Golf, black screen +-- Smart Dart, black screen +-- Happy Tennis, controls are haywire +-- Bowling, freezes at the high score screen + + +*******************************************************************************/ + +#include "emu.h" +#include "cpu/unsp/unsp.h" +#include "machine/i2cmem.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +#define PAGE_ENABLE_MASK 0x0008 + +#define PAGE_DEPTH_FLAG_MASK 0x3000 +#define PAGE_DEPTH_FLAG_SHIFT 12 +#define PAGE_TILE_HEIGHT_MASK 0x00c0 +#define PAGE_TILE_HEIGHT_SHIFT 6 +#define PAGE_TILE_WIDTH_MASK 0x0030 +#define PAGE_TILE_WIDTH_SHIFT 4 +#define TILE_X_FLIP 0x0004 +#define TILE_Y_FLIP 0x0008 + +class vii_state : public driver_device +{ +public: + vii_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_p_ram(*this, "p_ram"), + m_p_rowscroll(*this, "p_rowscroll"), + m_p_palette(*this, "p_palette"), + m_p_spriteram(*this, "p_spriteram"), + m_bios_rom(*this, "bios"), + m_io_p1(*this, "P1") + { } + + required_device m_maincpu; + optional_device m_cart; + DECLARE_READ16_MEMBER(video_r); + DECLARE_WRITE16_MEMBER(video_w); + DECLARE_READ16_MEMBER(audio_r); + DECLARE_WRITE16_MEMBER(audio_w); + DECLARE_READ16_MEMBER(io_r); + DECLARE_WRITE16_MEMBER(io_w); + DECLARE_WRITE16_MEMBER(rowscroll_w); + DECLARE_WRITE16_MEMBER(spriteram_w); + DECLARE_READ16_MEMBER(rom_r); + required_shared_ptr m_p_ram; + required_shared_ptr m_p_rowscroll; + required_shared_ptr m_p_palette; + required_shared_ptr m_p_spriteram; + + std::vector m_p_cart; + + UINT32 m_current_bank; + + UINT16 m_video_regs[0x100]; + UINT32 m_centered_coordinates; + void test_centered(UINT8 *ROM); + + struct + { + UINT8 r, g, b; + } + m_screenram[320*240]; + + UINT16 m_io_regs[0x200]; + UINT16 m_uart_rx_count; + UINT8 m_controller_input[8]; + UINT32 m_spg243_mode; + + emu_timer *m_tmb1; + emu_timer *m_tmb2; + void do_dma(UINT32 len); + void do_gpio(UINT32 offset); + void switch_bank(UINT32 bank); + void do_i2c(); + void spg_do_dma(UINT32 len); + DECLARE_DRIVER_INIT(vsmile); + DECLARE_DRIVER_INIT(walle); + DECLARE_DRIVER_INIT(vii); + DECLARE_DRIVER_INIT(batman); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vii_vblank); + TIMER_CALLBACK_MEMBER(tmb1_tick); + TIMER_CALLBACK_MEMBER(tmb2_tick); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vii_cart); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vsmile_cart); + +protected: + optional_memory_region m_bios_rom; + required_ioport m_io_p1; + + memory_region *m_cart_rom; + + void blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile); + void blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs); + void blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr); + void blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth); + inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); + inline UINT8 expand_rgb5_to_rgb8(UINT8 val); + inline UINT8 mix_channel(UINT8 a, UINT8 b); + void mix_pixel(UINT32 offset, UINT16 rgb); + void set_pixel(UINT32 offset, UINT16 rgb); +}; + +enum +{ + SPG243_VII = 0, + SPG243_BATMAN, + SPG243_VSMILE, + + SPG243_MODEL_COUNT +}; + + +#define VII_CTLR_IRQ_ENABLE m_io_regs[0x21] +#define VII_VIDEO_IRQ_ENABLE m_video_regs[0x62] +#define VII_VIDEO_IRQ_STATUS m_video_regs[0x63] + + +#define VERBOSE_LEVEL (3) + +#define ENABLE_VERBOSE_LOG (1) + +inline void vii_state::verboselog(int n_level, const char *s_fmt, ...) +{ +#if ENABLE_VERBOSE_LOG + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + } +#endif +} + +/************************* +* Video Hardware * +*************************/ + +void vii_state::video_start() +{ +} + +inline UINT8 vii_state::expand_rgb5_to_rgb8(UINT8 val) +{ + UINT8 temp = val & 0x1f; + return (temp << 3) | (temp >> 2); +} + +// Perform a lerp between a and b +inline UINT8 vii_state::mix_channel(UINT8 a, UINT8 b) +{ + UINT8 alpha = m_video_regs[0x1c] & 0x00ff; + return ((64 - alpha) * a + alpha * b) / 64; +} + +void vii_state::mix_pixel(UINT32 offset, UINT16 rgb) +{ + m_screenram[offset].r = mix_channel(m_screenram[offset].r, expand_rgb5_to_rgb8(rgb >> 10)); + m_screenram[offset].g = mix_channel(m_screenram[offset].g, expand_rgb5_to_rgb8(rgb >> 5)); + m_screenram[offset].b = mix_channel(m_screenram[offset].b, expand_rgb5_to_rgb8(rgb)); +} + +void vii_state::set_pixel(UINT32 offset, UINT16 rgb) +{ + m_screenram[offset].r = expand_rgb5_to_rgb8(rgb >> 10); + m_screenram[offset].g = expand_rgb5_to_rgb8(rgb >> 5); + m_screenram[offset].b = expand_rgb5_to_rgb8(rgb); +} + +void vii_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + UINT32 h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT); + UINT32 w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT); + + UINT32 yflipmask = attr & TILE_Y_FLIP ? h - 1 : 0; + UINT32 xflipmask = attr & TILE_X_FLIP ? w - 1 : 0; + + UINT32 nc = ((attr & 0x0003) + 1) << 1; + + UINT32 palette_offset = (attr & 0x0f00) >> 4; + palette_offset >>= nc; + palette_offset <<= nc; + + UINT32 m = bitmap_addr + nc*w*h/16*tile; + UINT32 bits = 0; + UINT32 nbits = 0; + + UINT32 x, y; + + for(y = 0; y < h; y++) + { + UINT32 yy = (yoff + (y ^ yflipmask)) & 0x1ff; + + for(x = 0; x < w; x++) + { + UINT32 xx = (xoff + (x ^ xflipmask)) & 0x1ff; + UINT32 pal; + + bits <<= nc; + if(nbits < nc) + { + UINT16 b = space.read_word((m++ & 0x3fffff) << 1); + b = (b << 8) | (b >> 8); + bits |= b << (nc - nbits); + nbits += 16; + } + nbits -= nc; + + pal = palette_offset | (bits >> 16); + bits &= 0xffff; + + if((ctrl & 0x0010) && yy < 240) + { + xx = (xx - (INT16)m_p_rowscroll[yy]) & 0x01ff; + } + + if(xx < 320 && yy < 240) + { + UINT16 rgb = m_p_palette[pal]; + if(!(rgb & 0x8000)) + { + if (attr & 0x4000) + { + mix_pixel(xx + 320*yy, rgb); + } + else + { + set_pixel(xx + 320*yy, rgb); + } + } + } + } + } +} + +void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs) +{ + UINT32 x0, y0; + UINT32 xscroll = regs[0]; + UINT32 yscroll = regs[1]; + UINT32 attr = regs[2]; + UINT32 ctrl = regs[3]; + UINT32 tilemap = regs[4]; + UINT32 palette_map = regs[5]; + UINT32 h, w, hn, wn; + address_space &space = m_maincpu->space(AS_PROGRAM); + + if(!(ctrl & PAGE_ENABLE_MASK)) + { + return; + } + + if(((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth) + { + return; + } + + h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT); + w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT); + + hn = 256 / h; + wn = 512 / w; + + for(y0 = 0; y0 < hn; y0++) + { + for(x0 = 0; x0 < wn; x0++) + { + UINT16 tile = space.read_word((tilemap + x0 + wn * y0) << 1); + UINT16 palette = 0; + UINT32 xx, yy; + + if(!tile) + { + continue; + } + + palette = space.read_word((palette_map + (x0 + wn * y0) / 2) << 1); + if(x0 & 1) + { + palette >>= 8; + } + + UINT32 tileattr = attr; + UINT32 tilectrl = ctrl; + if ((ctrl & 2) == 0) + { // -(1) bld(1) flip(2) pal(4) + tileattr &= ~0x000c; + tileattr |= (palette >> 2) & 0x000c; // flip + + tileattr &= ~0x0f00; + tileattr |= (palette << 8) & 0x0f00; // palette + + tileattr &= ~0x0100; + tileattr |= (palette << 2) & 0x0100; // blend + } + + yy = ((h*y0 - yscroll + 0x10) & 0xff) - 0x10; + xx = (w*x0 - xscroll) & 0x1ff; + + blit(bitmap, cliprect, xx, yy, tileattr, tilectrl, bitmap_addr, tile); + } + } +} + +void vii_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT16 tile, attr; + INT16 x, y; + UINT32 h, w; + UINT32 bitmap_addr = 0x40 * m_video_regs[0x22]; + + tile = space.read_word((base_addr + 0) << 1); + x = space.read_word((base_addr + 1) << 1); + y = space.read_word((base_addr + 2) << 1); + attr = space.read_word((base_addr + 3) << 1); + + if(!tile) + { + return; + } + + if(((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth) + { + return; + } + + if(m_centered_coordinates) + { + x = 160 + x; + y = 120 - y; + + h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT); + w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT); + + x -= (w/2); + y -= (h/2) - 8; + } + + x &= 0x01ff; + y &= 0x01ff; + + blit(bitmap, cliprect, x, y, attr, 0, bitmap_addr, tile); +} + +void vii_state::blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth) +{ + UINT32 n; + + if (!(m_video_regs[0x42] & 1)) + { + return; + } + + for(n = 0; n < 256; n++) + { + //if(space.read_word((0x2c00 + 4*n) << 1)) + { + blit_sprite(bitmap, cliprect, depth, 0x2c00 + 4*n); + } + } +} + +UINT32 vii_state::screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int i, x, y; + + bitmap.fill(0, cliprect); + + memset(m_screenram, 0, sizeof(m_screenram)); + + for(i = 0; i < 4; i++) + { + blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x20], m_video_regs + 0x10); + blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x21], m_video_regs + 0x16); + blit_sprites(bitmap, cliprect, i); + } + + for(y = 0; y < 240; y++) + { + for(x = 0; x < 320; x++) + { + bitmap.pix32(y, x) = (m_screenram[x + 320*y].r << 16) | (m_screenram[x + 320*y].g << 8) | m_screenram[x + 320*y].b; + } + } + + return 0; +} + +/************************* +* Machine Hardware * +*************************/ + +void vii_state::do_dma(UINT32 len) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + UINT32 src = m_video_regs[0x70]; + UINT32 dst = m_video_regs[0x71] + 0x2c00; + UINT32 j; + + for(j = 0; j < len; j++) + { + mem.write_word((dst+j) << 1, mem.read_word((src+j) << 1)); + } + + m_video_regs[0x72] = 0; + m_video_regs[0x63] |= 4; +} + +READ16_MEMBER( vii_state::video_r ) +{ + switch(offset) + { + case 0x62: // Video IRQ Enable + verboselog(0, "video_r: Video IRQ Enable: %04x\n", VII_VIDEO_IRQ_ENABLE); + return VII_VIDEO_IRQ_ENABLE; + + case 0x63: // Video IRQ Status + verboselog(0, "video_r: Video IRQ Status: %04x\n", VII_VIDEO_IRQ_STATUS); + return VII_VIDEO_IRQ_STATUS; + + default: + verboselog(0, "video_r: Unknown register %04x = %04x\n", 0x2800 + offset, m_video_regs[offset]); + break; + } + return m_video_regs[offset]; +} + +WRITE16_MEMBER( vii_state::video_w ) +{ + switch(offset) + { + case 0x10: case 0x16: // page 1,2 X scroll + data &= 0x01ff; + COMBINE_DATA(&m_video_regs[offset]); + break; + + case 0x11: case 0x17: // page 1,2 Y scroll + data &= 0x00ff; + COMBINE_DATA(&m_video_regs[offset]); + break; + case 0x36: // IRQ pos V + case 0x37: // IRQ pos H + data &= 0x01ff; + COMBINE_DATA(&m_video_regs[offset]); + break; + case 0x62: // Video IRQ Enable + verboselog(0, "video_w: Video IRQ Enable = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&VII_VIDEO_IRQ_ENABLE); + break; + + case 0x63: // Video IRQ Acknowledge + verboselog(0, "video_w: Video IRQ Acknowledge = %04x (%04x)\n", data, mem_mask); + VII_VIDEO_IRQ_STATUS &= ~data; + if(!VII_VIDEO_IRQ_STATUS) + { + m_maincpu->set_input_line(UNSP_IRQ0_LINE, CLEAR_LINE); + } + break; + + case 0x70: // Video DMA Source + verboselog(0, "video_w: Video DMA Source = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_video_regs[offset]); + break; + + case 0x71: // Video DMA Dest + verboselog(0, "video_w: Video DMA Dest = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_video_regs[offset]); + break; + + case 0x72: // Video DMA Length + verboselog(0, "video_w: Video DMA Length = %04x (%04x)\n", data, mem_mask); + do_dma(data); + break; + + default: + verboselog(0, "video_w: Unknown register %04x = %04x (%04x)\n", 0x2800 + offset, data, mem_mask); + COMBINE_DATA(&m_video_regs[offset]); + break; + } +} + +READ16_MEMBER( vii_state::audio_r ) +{ + switch(offset) + { + default: + verboselog(4, "audio_r: Unknown register %04x\n", 0x3000 + offset); + break; + } + return 0; +} + +WRITE16_MEMBER( vii_state::audio_w ) +{ + switch(offset) + { + default: + verboselog(4, "audio_w: Unknown register %04x = %04x (%04x)\n", 0x3000 + offset, data, mem_mask); + break; + } +} + +void vii_state::switch_bank(UINT32 bank) +{ + if (bank != m_current_bank) + { + m_current_bank = bank; + if (m_cart_rom) + memcpy(&m_p_cart[0], m_cart_rom->base() + 0x400000 * bank * 2, 0x400000 * 2); + else + memcpy(&m_p_cart[0], m_bios_rom->base() + 0x400000 * bank * 2, 0x400000 * 2); + } +} + +void vii_state::do_gpio(UINT32 offset) +{ + UINT32 index = (offset - 1) / 5; + UINT16 buffer = m_io_regs[5*index + 2]; + UINT16 dir = m_io_regs[5*index + 3]; + UINT16 attr = m_io_regs[5*index + 4]; + UINT16 special= m_io_regs[5*index + 5]; + + UINT16 push = dir; + UINT16 pull = (~dir) & (~attr); + UINT16 what = (buffer & (push | pull)); + what ^= (dir & ~attr); + what &= ~special; + + if (m_spg243_mode == SPG243_VII) + { + if(index == 1) + { + UINT32 bank = ((what & 0x80) >> 7) | ((what & 0x20) >> 4); + switch_bank(bank); + } + } + else if (m_spg243_mode == SPG243_BATMAN) + { + if(index == 0) + { + UINT16 temp = m_io_p1->read(); + what |= (temp & 0x0001) ? 0x8000 : 0; + what |= (temp & 0x0002) ? 0x4000 : 0; + what |= (temp & 0x0004) ? 0x2000 : 0; + what |= (temp & 0x0008) ? 0x1000 : 0; + what |= (temp & 0x0010) ? 0x0800 : 0; + what |= (temp & 0x0020) ? 0x0400 : 0; + what |= (temp & 0x0040) ? 0x0200 : 0; + what |= (temp & 0x0080) ? 0x0100 : 0; + } + + if(index == 2) + { + } + } + else if (m_spg243_mode == SPG243_VSMILE) + { + // TODO: find out how vsmile accesses these GPIO regs! + } + + m_io_regs[5*index + 1] = what; +} + +void vii_state::do_i2c() +{ +} + +void vii_state::spg_do_dma(UINT32 len) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + + UINT32 src = ((m_io_regs[0x101] & 0x3f) << 16) | m_io_regs[0x100]; + UINT32 dst = m_io_regs[0x103] & 0x3fff; + UINT32 j; + + for(j = 0; j < len; j++) + mem.write_word((dst+j) << 1, mem.read_word((src+j) << 1)); + + m_io_regs[0x102] = 0; +} + +READ16_MEMBER( vii_state::io_r ) +{ + static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" }; + static const char gpioports[] = { 'A', 'B', 'C' }; + + UINT16 val = m_io_regs[offset]; + + switch(offset) + { + case 0x01: case 0x06: case 0x0b: // GPIO Data Port A/B/C + do_gpio(offset); + verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask); + val = m_io_regs[offset]; + break; + + case 0x02: case 0x03: case 0x04: case 0x05: + case 0x07: case 0x08: case 0x09: case 0x0a: + case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Other GPIO regs + verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask); + break; + + case 0x1c: // Random + val = machine().rand() & 0x00ff; + verboselog(3, "io_r: Random = %04x (%04x)\n", val, mem_mask); + break; + + case 0x21: // IRQ Control + verboselog(3, "io_r: Controller IRQ Control = %04x (%04x)\n", val, mem_mask); + break; + + case 0x22: // IRQ Status + verboselog(3, "io_r: Controller IRQ Status = %04x (%04x)\n", val, mem_mask); + break; + + case 0x2c: case 0x2d: // Timers? + val = machine().rand() & 0x0000ffff; + verboselog(3, "io_r: Unknown Timer %d Register = %04x (%04x)\n", offset - 0x2c, val, mem_mask); + break; + + case 0x2f: // Data Segment + val = m_maincpu->state_int(UNSP_SR) >> 10; + verboselog(3, "io_r: Data Segment = %04x (%04x)\n", val, mem_mask); + break; + + case 0x31: // Unknown, UART Status? + verboselog(3, "io_r: Unknown (UART Status?) = %04x (%04x)\n", 3, mem_mask); + val = 3; + break; + + case 0x36: // UART RX Data + val = m_controller_input[m_uart_rx_count]; + m_uart_rx_count = (m_uart_rx_count + 1) % 8; + verboselog(3, "io_r: UART RX Data = %04x (%04x)\n", val, mem_mask); + break; + + case 0x59: // I2C Status + verboselog(3, "io_r: I2C Status = %04x (%04x)\n", val, mem_mask); + break; + + case 0x5e: // I2C Data In + verboselog(3, "io_r: I2C Data In = %04x (%04x)\n", val, mem_mask); + break; + + default: + verboselog(3, "io_r: Unknown register %04x\n", 0x3d00 + offset); + break; + } + + return val; +} + +WRITE16_MEMBER( vii_state::io_w ) +{ + static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" }; + static const char gpioports[3] = { 'A', 'B', 'C' }; + + UINT16 temp = 0; + + switch(offset) + { + case 0x00: // GPIO special function select + verboselog(3, "io_w: GPIO Function Select = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x01: case 0x06: case 0x0b: // GPIO data, port A/B/C + offset++; + // Intentional fallthrough + + case 0x02: case 0x03: case 0x04: case 0x05: // Port A + case 0x07: case 0x08: case 0x09: case 0x0a: // Port B + case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Port C + verboselog(3, "io_w: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + do_gpio(offset); + break; + + case 0x10: // timebase control + if ((m_io_regs[offset] & 0x0003) != (data & 0x0003)) { + UINT16 hz = 8 << (data & 0x0003); + verboselog(3, "*** TMB1 FREQ set to %dHz\n", hz); + m_tmb1->adjust(attotime::zero, 0, attotime::from_hz( hz )); + } + if ((m_io_regs[offset] & 0x000c) != (data & 0x000c)) { + UINT16 hz = 128 << ((data & 0x000c) >> 2); + verboselog(3, "*** TMB2 FREQ set to %dHz\n", hz); + m_tmb2->adjust(attotime::zero, 0, attotime::from_hz( hz )); + } + COMBINE_DATA(&m_io_regs[offset]); + break; + case 0x21: // IRQ Enable + verboselog(3, "io_w: Controller IRQ Control = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&VII_CTLR_IRQ_ENABLE); + if(!VII_CTLR_IRQ_ENABLE) + { + m_maincpu->set_input_line(UNSP_IRQ3_LINE, CLEAR_LINE); + } + break; + + case 0x22: // IRQ Acknowledge + verboselog(3, "io_w: Controller IRQ Acknowledge = %04x (%04x)\n", data, mem_mask); + m_io_regs[0x22] &= ~data; + if(!m_io_regs[0x22]) + { + m_maincpu->set_input_line(UNSP_IRQ3_LINE, CLEAR_LINE); + } + break; + + case 0x2f: // Data Segment + temp = m_maincpu->state_int(UNSP_SR); + m_maincpu->set_state_int(UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10)); + verboselog(3, "io_w: Data Segment = %04x (%04x)\n", data, mem_mask); + break; + + case 0x31: // Unknown UART + verboselog(3, "io_w: Unknown UART = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x32: // UART Reset + verboselog(3, "io_w: UART Reset\n"); + break; + + case 0x33: // UART Baud Rate + verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (m_io_regs[0x34] << 8) - data)); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x35: // UART TX Data + verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (data << 8) - m_io_regs[0x33])); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5a: // I2C Access Mode + verboselog(3, "io_w: I2C Access Mode = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5b: // I2C Device Address + verboselog(3, "io_w: I2C Device Address = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5c: // I2C Sub-Address + verboselog(3, "io_w: I2C Sub-Address = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5d: // I2C Data Out + verboselog(3, "io_w: I2C Data Out = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5e: // I2C Data In + verboselog(3, "io_w: I2C Data In = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5f: // I2C Controller Mode + verboselog(3, "io_w: I2C Controller Mode = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x58: // I2C Command + verboselog(3, "io_w: I2C Command = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + do_i2c(); + break; + + case 0x59: // I2C Status / IRQ Acknowledge(?) + verboselog(3, "io_w: I2C Status / Ack = %04x (%04x)\n", data, mem_mask); + m_io_regs[offset] &= ~data; + break; + + case 0x100: // DMA Source (L) + case 0x101: // DMA Source (H) + case 0x103: // DMA Destination + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x102: // DMA Length + spg_do_dma(data); + break; + + default: + verboselog(3, "io_w: Unknown register %04x = %04x (%04x)\n", 0x3d00 + offset, data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + } +} + +/* +WRITE16_MEMBER( vii_state::rowscroll_w ) +{ + switch(offset) + { + default: + verboselog(0, "rowscroll_w: %04x = %04x (%04x)\n", 0x2900 + offset, data, mem_mask); + break; + } +} + +WRITE16_MEMBER( vii_state::spriteram_w ) +{ + switch(offset) + { + default: + verboselog(0, "spriteram_w: %04x = %04x (%04x)\n", 0x2c00 + offset, data, mem_mask); + break; + } +} +*/ + +READ16_MEMBER( vii_state::rom_r ) +{ + return m_p_cart[offset + 0x4000]; +} + +static ADDRESS_MAP_START( vii_mem, AS_PROGRAM, 16, vii_state ) + AM_RANGE( 0x000000, 0x0027ff ) AM_RAM AM_SHARE("p_ram") + AM_RANGE( 0x002800, 0x0028ff ) AM_READWRITE(video_r, video_w) + AM_RANGE( 0x002900, 0x002aff ) AM_RAM AM_SHARE("p_rowscroll") + AM_RANGE( 0x002b00, 0x002bff ) AM_RAM AM_SHARE("p_palette") + AM_RANGE( 0x002c00, 0x002fff ) AM_RAM AM_SHARE("p_spriteram") + AM_RANGE( 0x003000, 0x0037ff ) AM_READWRITE(audio_r, audio_w) + AM_RANGE( 0x003d00, 0x003eff ) AM_READWRITE(io_r, io_w) + AM_RANGE( 0x004000, 0x3fffff ) AM_READ(rom_r) +ADDRESS_MAP_END + +static INPUT_PORTS_START( vii ) + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Button A") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Button B") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Button C") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Button D") +INPUT_PORTS_END + +static INPUT_PORTS_START( batman ) + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Menu") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("B Button") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("X Button") +INPUT_PORTS_END + +static INPUT_PORTS_START( vsmile ) + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Menu") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("B Button") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("X Button") +INPUT_PORTS_END + +static INPUT_PORTS_START( walle ) + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("B Button") +INPUT_PORTS_END + + +void vii_state::test_centered(UINT8 *ROM) +{ + if (ROM[0x3cd808] == 0x99 && + ROM[0x3cd809] == 0x99 && + ROM[0x3cd80a] == 0x83 && + ROM[0x3cd80b] == 0x5e && + ROM[0x3cd80c] == 0x52 && + ROM[0x3cd80d] == 0x6b && + ROM[0x3cd80e] == 0x78 && + ROM[0x3cd80f] == 0x7f) + { + m_centered_coordinates = 0; + } +} + +DEVICE_IMAGE_LOAD_MEMBER( vii_state, vii_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size < 0x800000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + test_centered(m_cart->get_rom_base()); + + return IMAGE_INIT_PASS; +} + +DEVICE_IMAGE_LOAD_MEMBER( vii_state, vsmile_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + + +TIMER_CALLBACK_MEMBER(vii_state::tmb1_tick) +{ + m_io_regs[0x22] |= 1; +} + +TIMER_CALLBACK_MEMBER(vii_state::tmb2_tick) +{ + m_io_regs[0x22] |= 2; +} + +void vii_state::machine_start() +{ + memset(m_video_regs, 0, 0x100 * sizeof(UINT16)); + memset(m_io_regs, 0, 0x100 * sizeof(UINT16)); + m_current_bank = 0; + + m_controller_input[0] = 0; + m_controller_input[4] = 0; + m_controller_input[6] = 0xff; + m_controller_input[7] = 0; + + m_p_cart.resize(0x400000); + + if (m_cart && m_cart->exists()) + { + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + memcpy(&m_p_cart[0], m_cart_rom->base(), 0x400000 * 2); + } + else if (m_spg243_mode == SPG243_VII) // Vii bios is banked + memcpy(&m_p_cart[0], m_bios_rom->base(), 0x400000 * 2); + else + memcpy(&m_p_cart[0], memregion("maincpu")->base(), 0x400000 * 2); + + m_video_regs[0x36] = 0xffff; + m_video_regs[0x37] = 0xffff; + + m_tmb1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb1_tick),this)); + m_tmb2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb2_tick),this)); + m_tmb1->reset(); + m_tmb2->reset(); +} + +void vii_state::machine_reset() +{ +} + +INTERRUPT_GEN_MEMBER(vii_state::vii_vblank) +{ + UINT32 x = machine().rand() & 0x3ff; + UINT32 y = machine().rand() & 0x3ff; + UINT32 z = machine().rand() & 0x3ff; + + + m_controller_input[0] = m_io_p1->read(); + m_controller_input[1] = (UINT8)x; + m_controller_input[2] = (UINT8)y; + m_controller_input[3] = (UINT8)z; + m_controller_input[4] = 0; + x >>= 8; + y >>= 8; + z >>= 8; + m_controller_input[5] = (z << 4) | (y << 2) | x; + m_controller_input[6] = 0xff; + m_controller_input[7] = 0; + + m_uart_rx_count = 0; + + VII_VIDEO_IRQ_STATUS = VII_VIDEO_IRQ_ENABLE & 1; + if(VII_VIDEO_IRQ_STATUS) + { + verboselog(0, "Video IRQ\n"); + m_maincpu->set_input_line(UNSP_IRQ0_LINE, ASSERT_LINE); + } + +// { +// verboselog(0, "audio 1 IRQ\n"); +// m_maincpu->set_input_line(UNSP_IRQ1_LINE, ASSERT_LINE); +// } + if(m_io_regs[0x22] & m_io_regs[0x21] & 0x0c00) + { + verboselog(0, "timerA, timer B IRQ\n"); + m_maincpu->set_input_line(UNSP_IRQ2_LINE, ASSERT_LINE); + } + + //if(m_io_regs[0x22] & m_io_regs[0x21] & 0x2100) + // For now trigger always if any enabled + if(VII_CTLR_IRQ_ENABLE) + { + verboselog(0, "UART, ADC IRQ\n"); + m_maincpu->set_input_line(UNSP_IRQ3_LINE, ASSERT_LINE); + } +// { +// verboselog(0, "audio 4 IRQ\n"); +// m_maincpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE); +// } + + if(m_io_regs[0x22] & m_io_regs[0x21] & 0x1200) + { + verboselog(0, "External IRQ\n"); + m_maincpu->set_input_line(UNSP_IRQ5_LINE, ASSERT_LINE); + } + if(m_io_regs[0x22] & m_io_regs[0x21] & 0x0070) + { + verboselog(0, "1024Hz, 2048HZ, 4096HZ IRQ\n"); + m_maincpu->set_input_line(UNSP_IRQ6_LINE, ASSERT_LINE); + } + if(m_io_regs[0x22] & m_io_regs[0x21] & 0x008b) + { + verboselog(0, "TMB1, TMB2, 4Hz, key change IRQ\n"); + m_maincpu->set_input_line(UNSP_IRQ7_LINE, ASSERT_LINE); + } + +} + +static MACHINE_CONFIG_START( vii, vii_state ) + + MCFG_CPU_ADD( "maincpu", UNSP, XTAL_27MHz) + MCFG_CPU_PROGRAM_MAP( vii_mem ) + MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) + + + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(320, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) + MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vii_cart") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_LOAD(vii_state, vii_cart) + + MCFG_SOFTWARE_LIST_ADD("vii_cart","vii") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( vsmile, vii_state ) + + MCFG_CPU_ADD( "maincpu", UNSP, XTAL_27MHz) + MCFG_CPU_PROGRAM_MAP( vii_mem ) + MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) + + + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(320, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) + MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) + MCFG_PALETTE_ADD("palette", 32768) + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vsmile_cart") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_LOAD(vii_state, vsmile_cart) + + MCFG_SOFTWARE_LIST_ADD("cart_list","vsmile_cart") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( batman, vii_state ) + + MCFG_CPU_ADD( "maincpu", UNSP, XTAL_27MHz) + MCFG_CPU_PROGRAM_MAP( vii_mem ) + MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) + + + MCFG_I2CMEM_ADD("i2cmem") + MCFG_I2CMEM_DATA_SIZE(0x200) + + MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_SIZE(320, 240) + MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) + MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) + MCFG_PALETTE_ADD("palette", 32768) +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER(vii_state,vii) +{ + m_spg243_mode = SPG243_VII; + m_centered_coordinates = 1; +} + +DRIVER_INIT_MEMBER(vii_state,batman) +{ + m_spg243_mode = SPG243_BATMAN; + m_centered_coordinates = 1; +} + +DRIVER_INIT_MEMBER(vii_state,vsmile) +{ + m_spg243_mode = SPG243_VSMILE; + m_centered_coordinates = 1; +} + +DRIVER_INIT_MEMBER(vii_state,walle) +{ + m_spg243_mode = SPG243_BATMAN; + m_centered_coordinates = 0; +} + +ROM_START( vii ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + + ROM_REGION( 0x2000000, "bios", 0 ) + ROM_LOAD( "vii.bin", 0x0000, 0x2000000, CRC(04627639) SHA1(f883a92d31b53c9a5b0cdb112d07cd793c95fc43)) +ROM_END + +ROM_START( batmantv ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_LOAD16_WORD_SWAP( "batman.bin", 0x000000, 0x400000, CRC(46f848e5) SHA1(5875d57bb3fe0cac5d20e626e4f82a0e5f9bb94c) ) +ROM_END + +ROM_START( vsmile ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_LOAD16_WORD_SWAP( "bios german.bin", 0x000000, 0x200000, CRC(205c5296) SHA1(7fbcf761b5885c8b1524607aabaf364b4559c8cc) ) +ROM_END + +ROM_START( vsmilef ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_LOAD16_WORD_SWAP( "sysrom_france", 0x000000, 0x200000, CRC(0cd0bdf5) SHA1(5c8d1eada1b6b545555b8d2b09325d7127681af8) ) +ROM_END + +ROM_START( walle ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_LOAD16_WORD_SWAP( "walle.bin", 0x000000, 0x400000, BAD_DUMP CRC(bd554cba) SHA1(6cd06a036ab12e7b0e1fd8003db873b0bb783868) ) + // Alternate dump, we need to decide which one is correct. + //ROM_LOAD16_WORD_SWAP( "walle.bin", 0x000000, 0x400000, CRC(6bc90b16) SHA1(184d72de059057aae7800da510fcf05ed1da9ec9)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +CONS( 2004, batmantv, vii, 0, batman, batman, vii_state, batman, "JAKKS Pacific Inc / HotGen Ltd", "The Batman", MACHINE_NO_SOUND ) +CONS( 2005, vsmile, 0, 0, vsmile, vsmile, vii_state, vsmile, "V-Tech", "V-Smile (Germany)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) +CONS( 2005, vsmilef, vsmile, 0, vsmile, vsmile, vii_state, vsmile, "V-Tech", "V-Smile (France)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) +CONS( 2007, vii, 0, 0, vii, vii, vii_state, vii, "Jungle Soft / KenSingTon / Chintendo / Siatronics", "Vii", MACHINE_NO_SOUND ) +CONS( 2008, walle, vii, 0, batman, walle, vii_state, walle, "JAKKS Pacific Inc", "Wall-E", MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/vip.c b/src/mame/drivers/vip.c new file mode 100644 index 00000000000..f47528f5e07 --- /dev/null +++ b/src/mame/drivers/vip.c @@ -0,0 +1,810 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +RCA COSMAC VIP + +PCB Layout +---------- + +|-------------------------------------------------------------------------------| +| |---------------CN1---------------| |---------------CN2---------------| | +|CN6 | +| |---------| |---------| 4050 4050 | +| | CDPR566 | | CDP1861 | CN3 | +| |---------| |---------| | +| CN4 | +| 7805 |---------| |--------| | +| 2114 3.521280MHz | 4508 | | 4508 | CN5 | +| |---------| |--------| | +| 2114 |--------| | +| 7474 7400 4049 4051 4028 | 4515 | CA3401 | +| 2114 |--------| | +| |-------------| | +| 2114 | CDP1802 | | +| |-------------| LED1 | +| 2114 | +| LED2 | +| 2114 4556 4042 | +| LED3 | +| 555 2114 4011 4013 | +| SW1 | +| 2114 | +| | +|-------------------------------------------------------------------------------| + +Notes: + All IC's shown. + + CDPR566 - Programmed CDP1832 512 x 8-Bit Static ROM + 2114 - 2114 4096 Bit (1024x4) NMOS Static RAM + CDP1802 - RCA CDP1802 CMOS 8-Bit Microprocessor + CDP1861 - RCA CDP1861 Video Display Controller + CA3401 - Quad Single-Supply Op-Amp + CN1 - expansion interface connector + CN2 - parallel I/O interface connector + CN3 - video connector + CN4 - tape in connector + CN5 - tape out connector + CN6 - power connector + LED1 - power led + LED2 - Q led + LED3 - tape led + SW1 - Run/Reset switch + +*/ + +/* + + TODO: + + - ASCII keyboard + - cassette loading + - 20K RAM for Floating Point BASIC + - VP-111 has 1K RAM, no byte I/O, no expansion + - VP-601/611 ASCII Keyboard (VP-601 58 keys, VP611 58 keys + 16 keys numerical keypad) + - VP-700 Expanded Tiny Basic Board (4 KB ROM expansion) + +*/ + +/* + + VP-711 COSMAC MicroComputer $199 + (CDP18S711) Features RCA COSMAC microprocessor. 2K RAM, expandable to + 32K (4K on-board). Built-in cassette interface and video interface. + 16 key hexidecimal keypad. ROM operating system. CHIP-8 language and + machine language. Tone generator and speaker. 8-bit input port, 8-bit + output port, and full system expansion connector. Power supply and 3 + manuals (VP-311, VP-320, MPM201 B) included. Completely assembled. + + VP-44 VP-711 RAM On-Board Expansion Kit $36 + Four type 2114 RAM IC's for expanding VP-711 on-board memory + to 4K bytes. + + VP-111 MicroComputer $99 + RCA COSMAC microprocessor. 1 K RAM expandable to 32K (4K On- + board). Built-in cassette interface and video interface. 16 key + Hexidecimal keypad. ROM operating system. CHIP-8 language and Machine + language. Tone generator. Assembled - user must install Cables + (supplied) and furnish 5 volt power supply and speaker. + + VP-114 VP-111 Expansion Kit $76 + Includes I/O ports, system expansion connector and additional + 3K of RAM. Expands VP-111 to VP-711 capability. + + VP-155 VP-111 Cover $12 + Attractive protective plastic cover for VP-111. + + VP-3301 Interactive Data Terminal Available Approx. 6 Months + Microprocessor Based Computer Terminal with keyboard, video + Interface and color graphics - includes full resident and user + Definable character font, switch selectable configuration, cursor + Control, reverse video and many other features. + + VP-590 Color Board $69 + Displays VP-711 output in color! Program control of four + Background colors and eight foreground colors. CHIP-8X language + Adds color commands. Includes two sockets for VP-580 Expansion + Keyboards. + + VP-595 Simple Sound Board $30 + Provides 256 different frequencies in place of VP-711 single- + tone Output. Use with VP-590 Color Board for simultaneous color and + Sound. Great for simple music or sound effects! Includes speaker. + + VP-550 Super Sound Board $49 + Turn your VP-711 into a music synthesizer! Two independent + sound Channels. Frequency, duration and amplitude envelope (voice) of + Each channel under program control. On-board tempo control. Provision + for multi-track recording or slaving VP-711's. Output drives audio + preamp. Does not permit simultaneous video display. + + VP-551 Super Sound 4-Channel Expander Package $74 + VP-551 provides four (4) independent sound channels with + frequency duration and amplitude envelope for each channel. Package + includes modified VP-550 super sound board, VP-576 two board + expander, data cassette with 4-channel PIN-8 program, and instruction + manual. Requires 4K RAM system and your VP-550 Super Sound Board. + + VP-570 Memory Expansion Board $95 + Plug-in 4K static RAM memory. Jumper locates RAM in any 4K + block in first 32K of VP-711 memory space. + + VP-580 Auxiliary Keyboard $20 + Adds two-player interactive game capability to VP-711 16-key + keypad with cable. Connects to sockets on VP-590 Color Board or VP- + 585 Keyboard Interface. + + VP-585 Keyboard Interface Board $15 + Interfaces two VP-580 Expansion Keyboards directly to the VP- + 711. Not required when VP-590 Color Board is used. + + VP-560 EPROM Board $34 + Interfaces two Intel 2716 EPROMs to VP-711. Places EPROMs any- + where in memory space. Can also re-allocate on-board RAM in memory + space. + + VP-565 EPROM Programmer Board $99 + Programs Intel 2716 EPROMs with VP-711. Complete with software + to program, copy, and verify. On-board generation of all programming + voltages. + + VP-575 Expansion Board $59 + Plug-in board with 4 buffered and one unbuffered socket. + Permits use of up to 5 Accessory Boards in VP-711 Expansion Socket. + + VP-576 Two-Board Expander $20 + Plug-in board for VP-711 I/O or Expansion Socket permits use + of two Accessory Boards in either location. + + VP-601* ASCII Keyboard. 7-Bit Parallel Output $69 + Fully encoded, 128-character ASCII alphanumeric keyboard. 58 + light touch keys (2 user defined). Selectable "Upper-Case-Only". + + VP-606* ASCII Keyboard - Serial Output $99 + Same as VP-601. EIA RS232C compatible, 20 mA current loop and + TTL outputs. Six selectable baud rates. Available mid-1980. + + VP-611* ASCII/Numeric Keyboard. 7-Bit Parallel Output $89 + ASCII Keyboard identical to VP-601 plus 16 key numeric entry + keyboard for easier entry of numbers. + + VP-616* ASCII/Numeric Keyboard - Serial Output $119 + Same as VP-611. EIA RS232C compatible, 20 mA current loop and + TTL outputs. Six selectable baud rates. Available mid-1980. + + VP-620 Cable: ASCII Keyboards to VP-711 $20 + Flat ribbon cable, 24" length, for connecting VP-601 or VP- + 611 and VP-711. Includes matching connector on both ends. + + VP-623 Cable: Parallel Output ASCII Keyboards $20 + Flat ribbon cable, 36" length with mating connector for VP- + 601 or VP-611 Keyboards. Other end is unterminated. + + VP-626 Connector: Serial Output ASCII Keyboards & Terminal $7 + 25 pin solderable male "D" connector mates to VP-606, VP-616 + or VP-3301. + + TC1210 9" Video Monitor $195 + Ideal, low-cost monochrome monitor for displaying the video + output from your microcomputer or terminal. + + TC1217 17" Video Monitor $480 + A really BIG monochrome monitor for use with your + microcomputer or terminal 148 sq. in. pictures. + + VP-700 Tiny BASIC ROM Board $39 + Run Tiny BASIC on your VP-711! All BASIC code stored in ROM. + Requires separate ASCII keyboard. + + VP-701 Floating Point BASIC for VP-711 $49 + 16K bytes on cassette tape, includes floating point and + integer math, string capability and color graphics. More than 70 + commands and statements. Available mid-1980. + + VP-710 Game Manual $10 + More exciting games for your VP-711! Includes Blackjack, + Biorythm, Pinball, Bowling and 10 others. + + VP-720 Game Manual II More exciting games. Available mid-1980. $15 + + VP-311 VP-711 Instruction Manual (Included with VP-711) $5 + + VP-320 VP-711 User Guide Manual (Included with VP-711) $5 + + MPM-201B CDP1802 User Manual (Included with VP-711) $5 + + * Quantities of 15 or more available less case and speaker (Assembled + keypad and circut board only). Price on request. + +*/ + +#include "includes/vip.h" + + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +enum +{ + LED_POWER = 0, + LED_Q, + LED_TAPE +}; + + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +//------------------------------------------------- +// update_interrupts - +//------------------------------------------------- + +void vip_state::update_interrupts() +{ + int irq = m_vdc_int || m_exp_int; + int dma_in = m_exp_dma_in; + int dma_out = m_vdc_dma_out || m_exp_dma_out; + + m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, irq); + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, dma_in); + m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAOUT, dma_out); +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( vip_state::read ) +{ + int cs = BIT(offset, 15) || m_8000; + int cdef = !((offset >= 0xc00) && (offset < 0x1000)); + int minh = 0; + + UINT8 data = m_exp->program_r(space, offset, cs, cdef, &minh); + + if (cs) + { + data = m_rom->base()[offset & 0x1ff]; + } + else if (!minh) + { + data = m_ram->pointer()[offset & m_ram->mask()]; + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( vip_state::write ) +{ + int cs = BIT(offset, 15) || m_8000; + int cdef = !((offset >= 0xc00) && (offset < 0x1000)); + int minh = 0; + + m_exp->program_w(space, offset, data, cdef, &minh); + + if (!cs && !minh) + { + m_ram->pointer()[offset & m_ram->mask()] = data; + } +} + + +//------------------------------------------------- +// io_r - +//------------------------------------------------- + +READ8_MEMBER( vip_state::io_r ) +{ + UINT8 data = m_exp->io_r(space, offset); + + switch (offset) + { + case 1: + m_vdc->disp_on_w(1); + m_vdc->disp_on_w(0); + break; + + case 3: + data = m_byteio_data; + break; + } + + if (BIT(offset, 2)) + { + m_8000 = 0; + } + + return data; +} + + +//------------------------------------------------- +// io_w - +//------------------------------------------------- + +WRITE8_MEMBER( vip_state::io_w ) +{ + m_exp->io_w(space, offset, data); + + switch (offset) + { + case 1: + m_vdc->disp_off_w(1); + m_vdc->disp_off_w(0); + break; + + case 2: + m_keylatch = data & 0x0f; + break; + + case 3: + m_byteio->out_w(data); + break; + } + + if (BIT(offset, 2)) + { + m_8000 = 0; + } +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( vip_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vip_mem, AS_PROGRAM, 8, vip_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vip_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vip_io, AS_IO, 8, vip_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x07) AM_READWRITE(io_r, io_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( vip ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( vip_state::reset_w ) +{ + m_exp->run_w(newval); + + if (oldval && !newval) + { + machine_reset(); + } +} + +INPUT_CHANGED_MEMBER( vip_state::beeper_w ) +{ + m_beeper->set_output_gain(0, newval ? 0.80 : 0); +} + +static INPUT_PORTS_START( vip ) + PORT_START("KEYPAD") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 MW") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("A MR") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("B TR") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("F TW") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + + PORT_START("RUN") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Run/Reset") PORT_CODE(KEYCODE_R) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, vip_state, reset_w, 0) + + PORT_START("BEEPER") + PORT_CONFNAME( 0x01, 0x01, "Internal Speaker" ) PORT_CHANGED_MEMBER(DEVICE_SELF, vip_state, beeper_w, 0) + PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x01, DEF_STR( On ) ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// COSMAC_INTERFACE( cosmac_intf ) +//------------------------------------------------- + +READ_LINE_MEMBER( vip_state::clear_r ) +{ + return BIT(m_run->read(), 0); +} + +READ_LINE_MEMBER( vip_state::ef1_r ) +{ + return m_vdc_ef1 || m_exp->ef1_r(); +} + +READ_LINE_MEMBER( vip_state::ef2_r ) +{ + set_led_status(machine(), LED_TAPE, m_cassette->input() > 0); + + return (m_cassette->input() < 0) ? ASSERT_LINE : CLEAR_LINE; +} + +READ_LINE_MEMBER( vip_state::ef3_r ) +{ + return !BIT(m_keypad->read(), m_keylatch) || m_byteio_ef3 || m_exp_ef3; +} + +READ_LINE_MEMBER( vip_state::ef4_r ) +{ + return m_byteio_ef4 || m_exp_ef4; +} + +WRITE_LINE_MEMBER( vip_state::q_w ) +{ + // sound output + m_beeper->write(machine().driver_data()->generic_space(), NODE_01, state); + + // Q led + set_led_status(machine(), LED_Q, state); + + // tape output + m_cassette->output(state ? 1.0 : -1.0); + + // expansion + m_exp->q_w(state); +} + +READ8_MEMBER( vip_state::dma_r ) +{ + return m_exp->dma_r(space, offset); +} + +WRITE8_MEMBER( vip_state::dma_w ) +{ + m_vdc->dma_w(space, offset, data); + + m_exp->dma_w(space, offset, data); +} + +WRITE8_MEMBER( vip_state::sc_w ) +{ + m_exp->sc_w(data); +} + + +//------------------------------------------------- +// CDP1861_INTERFACE( vdc_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( vip_state::vdc_int_w ) +{ + m_vdc_int = state; + + update_interrupts(); +} + +WRITE_LINE_MEMBER( vip_state::vdc_dma_out_w ) +{ + m_vdc_dma_out = state; + + update_interrupts(); +} + +WRITE_LINE_MEMBER( vip_state::vdc_ef1_w ) +{ + m_vdc_ef1 = state; +} + +UINT32 vip_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_vdc->screen_update(screen, bitmap, cliprect); + + m_exp->screen_update(screen, bitmap, cliprect); + + return 0; +} + + +//------------------------------------------------- +// DISCRETE_SOUND( vip ) +//------------------------------------------------- + +static const discrete_555_desc vip_ca555_a = +{ + DISC_555_OUT_SQW | DISC_555_OUT_DC, + 5, // B+ voltage of 555 + DEFAULT_555_VALUES +}; + +static DISCRETE_SOUND_START( vip ) + DISCRETE_INPUT_LOGIC(NODE_01) + DISCRETE_555_ASTABLE_CV(NODE_02, NODE_01, 470, (int) RES_M(1), (int) CAP_P(470), NODE_01, &vip_ca555_a) + DISCRETE_OUTPUT(NODE_02, 5000) +DISCRETE_SOUND_END + + +//------------------------------------------------- +// VIP_BYTEIO_PORT_INTERFACE( byteio_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( vip_state::byteio_inst_w ) +{ + if (!state) + { + m_byteio_data = m_byteio->in_r(); + } +} + + +//------------------------------------------------- +// VIP_EXPANSION_INTERFACE( expansion_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( vip_state::exp_int_w ) +{ + m_exp_int = state; + + update_interrupts(); +} + +WRITE_LINE_MEMBER( vip_state::exp_dma_out_w ) +{ + m_exp_dma_out = state; + + update_interrupts(); +} + +WRITE_LINE_MEMBER( vip_state::exp_dma_in_w ) +{ + m_exp_dma_in = state; + + update_interrupts(); +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( vip ) +//------------------------------------------------- + +void vip_state::machine_start() +{ + UINT8 *ram = m_ram->pointer(); + + // randomize RAM contents + for (UINT16 addr = 0; addr < m_ram->size(); addr++) + { + ram[addr] = machine().rand() & 0xff; + } + + // turn on power LED + set_led_status(machine(), LED_POWER, 1); + + // reset sound + m_beeper->write(machine().driver_data()->generic_space(), NODE_01, 0); + + // state saving + save_item(NAME(m_8000)); + save_item(NAME(m_vdc_int)); + save_item(NAME(m_vdc_dma_out)); + save_item(NAME(m_vdc_ef1)); + save_item(NAME(m_exp_int)); + save_item(NAME(m_exp_dma_out)); + save_item(NAME(m_exp_dma_in)); + save_item(NAME(m_byteio_ef3)); + save_item(NAME(m_byteio_ef4)); + save_item(NAME(m_exp_ef1)); + save_item(NAME(m_exp_ef3)); + save_item(NAME(m_exp_ef4)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_byteio_data)); +} + + +void vip_state::machine_reset() +{ + // reset the VDC + m_vdc->reset(); + + // force map ROM + m_8000 = 1; + + // internal speaker + m_beeper->set_output_gain(0, m_io_beeper->read() ? 0.80 : 0); + + // clear byte I/O latch + m_byteio_data = 0; +} + + +//------------------------------------------------- +// QUICKLOAD_LOAD_MEMBER( vip_state, vip ) +//------------------------------------------------- + +QUICKLOAD_LOAD_MEMBER( vip_state, vip ) +{ + UINT8 *ram = m_ram->pointer(); + UINT8 *chip8_ptr = NULL; + int chip8_size = 0; + int size = image.length(); + + if (strcmp(image.filetype(), "c8") == 0) + { + /* CHIP-8 program */ + chip8_ptr = m_chip8->base(); + chip8_size = m_chip8->bytes(); + } + else if (strcmp(image.filename(), "c8x") == 0) + { + /* CHIP-8X program */ + chip8_ptr = m_chip8x->base(); + chip8_size = m_chip8x->bytes(); + } + + if ((size + chip8_size) > m_ram->size()) + { + return IMAGE_INIT_FAIL; + } + + if (chip8_size > 0) + { + /* copy CHIP-8 interpreter to RAM */ + memcpy(ram, chip8_ptr, chip8_size); + } + + /* load image to RAM */ + image.fread(ram + chip8_size, size); + + return IMAGE_INIT_PASS; +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( vip ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( vip, vip_state ) + // basic machine hardware + MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_3_52128MHz/2) + MCFG_CPU_PROGRAM_MAP(vip_mem) + MCFG_CPU_IO_MAP(vip_io) + MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_CLEAR_CALLBACK(READLINE(vip_state, clear_r)) + MCFG_COSMAC_EF1_CALLBACK(READLINE(vip_state, ef1_r)) + MCFG_COSMAC_EF2_CALLBACK(READLINE(vip_state, ef2_r)) + MCFG_COSMAC_EF3_CALLBACK(READLINE(vip_state, ef3_r)) + MCFG_COSMAC_EF4_CALLBACK(READLINE(vip_state, ef4_r)) + MCFG_COSMAC_Q_CALLBACK(WRITELINE(vip_state, q_w)) + MCFG_COSMAC_DMAR_CALLBACK(READ8(vip_state, dma_r)) + MCFG_COSMAC_DMAW_CALLBACK(WRITE8(vip_state, dma_w)) + MCFG_COSMAC_SC_CALLBACK(WRITE8(vip_state, sc_w)) + + // video hardware + MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, XTAL_3_52128MHz/2) + MCFG_CDP1861_IRQ_CALLBACK(WRITELINE(vip_state, vdc_int_w)) + MCFG_CDP1861_DMA_OUT_CALLBACK(WRITELINE(vip_state, vdc_dma_out_w)) + MCFG_CDP1861_EFX_CALLBACK(WRITELINE(vip_state, vdc_ef1_w)) + MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_52128MHz/2) + MCFG_SCREEN_UPDATE_DRIVER(vip_state, screen_update) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(vip) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + MCFG_VIP_BYTEIO_PORT_ADD(VIP_BYTEIO_PORT_TAG, vip_byteio_cards, NULL, WRITELINE(vip_state, byteio_inst_w)) + MCFG_VIP_EXPANSION_SLOT_ADD(VIP_EXPANSION_SLOT_TAG, XTAL_3_52128MHz/2, vip_expansion_cards, NULL) + MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(vip_state, exp_int_w)) + MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(vip_state, exp_dma_out_w)) + MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(vip_state, exp_dma_in_w)) + + // devices + MCFG_QUICKLOAD_ADD("quickload", vip_state, vip, "bin,c8,c8x", 0) + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) + MCFG_CASSETTE_INTERFACE("vip_cass") + + // software lists + MCFG_SOFTWARE_LIST_ADD("cass_list", "vip") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") + MCFG_RAM_EXTRA_OPTIONS("4K") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// MACHINE_CONFIG( vp111 ) +//------------------------------------------------- + +static MACHINE_CONFIG_DERIVED( vp111, vip ) + // internal ram + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") + MCFG_RAM_EXTRA_OPTIONS("2K,4K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( vip ) +//------------------------------------------------- + +ROM_START( vip ) + ROM_REGION( 0x200, CDP1802_TAG, 0 ) + ROM_LOAD( "cdpr566.u10", 0x0000, 0x0200, CRC(5be0a51f) SHA1(40266e6d13e3340607f8b3dcc4e91d7584287c06) ) + + ROM_REGION( 0x200, "chip8", 0 ) + ROM_LOAD( "chip8.bin", 0x0000, 0x0200, CRC(438ec5d5) SHA1(8aa634c239004ff041c9adbf9144bd315ab5fc77) ) + + ROM_REGION( 0x300, "chip8x", 0 ) + ROM_LOAD( "chip8x.bin", 0x0000, 0x0300, CRC(79c5f6f8) SHA1(ed438747b577399f6ccbf20fe14156f768842898) ) +ROM_END + + +//------------------------------------------------- +// ROM( vp111 ) +//------------------------------------------------- + +#define rom_vp111 rom_vip + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1977, vip, 0, 0, vip, vip, driver_device, 0, "RCA", "Cosmac VIP (VP-711)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_COLORS ) +COMP( 1977, vp111, vip, 0, vp111, vip, driver_device, 0, "RCA", "Cosmac VIP (VP-111)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_COLORS ) diff --git a/src/mame/drivers/vixen.c b/src/mame/drivers/vixen.c new file mode 100644 index 00000000000..c4db7010fd4 --- /dev/null +++ b/src/mame/drivers/vixen.c @@ -0,0 +1,877 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + +Osborne 4 Vixen + +Main PCB Layout +--------------- + +TODO + +Notes: + Relevant IC's shown. + + CPU - Zilog Z8400APS Z80A CPU + FDC - SMC FDC1797 + 8155 - Intel P8155H + ROM0 - + ROM1,2 - AMD AM2732-1DC 4Kx8 EPROM + CN1 - keyboard connector + CN2 - + CN3 - + CN4 - floppy connector + CN5 - power connector + CN6 - composite video connector + SW1 - reset switch + SW2 - + + +I/O PCB Layout +-------------- + +TODO + +Notes: + Relevant IC's shown. + + 8155 - Intel P8155H + 8251 - AMD P8251A + CN1 - IEEE488 connector + CN2 - RS232 connector + CN3 - + +*/ + +/* + + TODO: + + - video line buffer + - floppy + - keyboard + - RS232 RI interrupt + - PCB layouts + +*/ + + +#include "includes/vixen.h" + + + +//************************************************************************** +// INTERRUPTS +//************************************************************************** + +//------------------------------------------------- +// update_interrupt - +//------------------------------------------------- + +void vixen_state::update_interrupt() +{ + int state = (m_cmd_d1 && m_fdint) || m_vsync;// || (!m_enb_srq_int && !m_srq) || (!m_enb_atn_int && !m_atn) || (!m_enb_xmt_int && m_txrdy) || (!m_enb_rcv_int && m_rxrdy); + + m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); +} + + +//------------------------------------------------- +// ctl_w - command write +//------------------------------------------------- + +WRITE8_MEMBER( vixen_state::ctl_w ) +{ + logerror("CTL %u\n", data); + + membank("bank3")->set_entry(BIT(data, 0)); +} + + +//------------------------------------------------- +// status_r - status read +//------------------------------------------------- + +READ8_MEMBER( vixen_state::status_r ) +{ + /* + + bit description + + 0 VSYNC enable + 1 FDINT enable + 2 VSYNC + 3 1 + 4 1 + 5 1 + 6 1 + 7 1 + + */ + + UINT8 data = 0xf8; + + // vertical sync interrupt enable + data |= m_cmd_d0; + + // floppy interrupt enable + data |= m_cmd_d1 << 1; + + // vertical sync + data |= m_vsync << 2; + + return data; +} + + +//------------------------------------------------- +// cmd_w - command write +//------------------------------------------------- + +WRITE8_MEMBER( vixen_state::cmd_w ) +{ + /* + + bit description + + 0 VSYNC enable + 1 FDINT enable + 2 + 3 + 4 + 5 + 6 + 7 + + */ + +// logerror("CMD %u\n", data); + + // vertical sync interrupt enable + m_cmd_d0 = BIT(data, 0); + + if (!m_cmd_d0) + { + // clear vertical sync + m_vsync = 0; + } + + // floppy interrupt enable + m_cmd_d1 = BIT(data, 1); + + update_interrupt(); +} + + +//------------------------------------------------- +// ieee488_r - IEEE488 bus read +//------------------------------------------------- + +READ8_MEMBER( vixen_state::ieee488_r ) +{ + /* + + bit description + + 0 ATN + 1 DAV + 2 NDAC + 3 NRFD + 4 EOI + 5 SRQ + 6 IFC + 7 REN + + */ + + UINT8 data = 0; + + /* attention */ + data |= m_ieee488->atn_r(); + + /* data valid */ + data |= m_ieee488->dav_r() << 1; + + /* data not accepted */ + data |= m_ieee488->ndac_r() << 2; + + /* not ready for data */ + data |= m_ieee488->nrfd_r() << 3; + + /* end or identify */ + data |= m_ieee488->eoi_r() << 4; + + /* service request */ + data |= m_ieee488->srq_r() << 5; + + /* interface clear */ + data |= m_ieee488->ifc_r() << 6; + + /* remote enable */ + data |= m_ieee488->ren_r() << 7; + + return data; +} + + +//------------------------------------------------- +// port3_r - serial status read +//------------------------------------------------- + +READ8_MEMBER( vixen_state::port3_r ) +{ + /* + + bit description + + 0 RI + 1 DCD + 2 1 + 3 1 + 4 1 + 5 1 + 6 1 + 7 1 + + */ + + UINT8 data = 0xfc; + + // ring indicator + data |= m_rs232->ri_r(); + + // data carrier detect + data |= m_rs232->dcd_r() << 1; + + return data; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( vixen_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vixen_mem, AS_PROGRAM, 8, vixen_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xefff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") + AM_RANGE(0xf000, 0xffff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4") AM_SHARE("video_ram") +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( vixen_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( vixen_io, AS_IO, 8, vixen_state ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(FDC1797_TAG, fd1797_t, read, write) + AM_RANGE(0x04, 0x04) AM_MIRROR(0x03) AM_READWRITE(status_r, cmd_w) + AM_RANGE(0x08, 0x08) AM_MIRROR(0x01) AM_DEVREADWRITE(P8155H_TAG, i8155_device, read, write) + AM_RANGE(0x0c, 0x0d) AM_DEVWRITE(P8155H_TAG, i8155_device, ale_w) + AM_RANGE(0x10, 0x10) AM_MIRROR(0x07) AM_DEVREAD(IEEE488_TAG, ieee488_device, dio_r) + AM_RANGE(0x18, 0x18) AM_MIRROR(0x07) AM_READ(ieee488_r) + AM_RANGE(0x20, 0x21) AM_MIRROR(0x04) AM_DEVWRITE(P8155H_IO_TAG, i8155_device, ale_w) + AM_RANGE(0x28, 0x28) AM_MIRROR(0x05) AM_DEVREADWRITE(P8155H_IO_TAG, i8155_device, read, write) + AM_RANGE(0x30, 0x30) AM_MIRROR(0x06) AM_DEVREADWRITE(P8251A_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x31, 0x31) AM_MIRROR(0x06) AM_DEVREADWRITE(P8251A_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x38, 0x38) AM_MIRROR(0x07) AM_READ(port3_r) +// AM_RANGE(0xf0, 0xff) Hard Disk? +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( vixen ) +//------------------------------------------------- + +INPUT_PORTS_START( vixen ) + PORT_START("KEY.0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("KEY.1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("KEY.2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("KEY.3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("KEY.4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("KEY.5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("KEY.6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("KEY.7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) +INPUT_PORTS_END + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +//------------------------------------------------- +// TIMER_DEVICE_CALLBACK_MEMBER( vsync_tick ) +//------------------------------------------------- + +TIMER_DEVICE_CALLBACK_MEMBER(vixen_state::vsync_tick) +{ + if (m_cmd_d0) + { + m_vsync = 1; + update_interrupt(); + } +} + + +void vixen_state::video_start() +{ + // register for state saving + save_item(NAME(m_alt)); + save_item(NAME(m_256)); + save_item(NAME(m_vsync)); +} + + +//------------------------------------------------- +// SCREEN_UPDATE( vixen ) +//------------------------------------------------- + +UINT32 vixen_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const pen_t *pen = m_palette->pens(); + + for (int txadr = 0; txadr < 26; txadr++) + { + for (int scan = 0; scan < 10; scan++) + { + for (int chadr = 0; chadr < 128; chadr++) + { + UINT16 sync_addr = (txadr << 7) | chadr; + UINT8 sync_data = m_sync_rom[sync_addr]; + int blank = BIT(sync_data, 4); + /* + int clrchadr = BIT(sync_data, 7); + int hsync = BIT(sync_data, 6); + int clrtxadr = BIT(sync_data, 5); + int vsync = BIT(sync_data, 3); + int comp_sync = BIT(sync_data, 2); + + logerror("SYNC %03x:%02x TXADR %u SCAN %u CHADR %u : COMPSYNC %u VSYNC %u BLANK %u CLRTXADR %u HSYNC %u CLRCHADR %u\n", + sync_addr,sync_data,txadr,scan,chadr,comp_sync,vsync,blank,clrtxadr,hsync,clrchadr); + */ + + int reverse = 0; + + UINT16 video_addr = (txadr << 7) | chadr; + UINT8 video_data = m_video_ram[video_addr]; + UINT16 char_addr = 0; + + if (m_256) + { + char_addr = (BIT(video_data, 7) << 11) | (scan << 7) | (video_data & 0x7f); + reverse = m_alt; + } + else + { + char_addr = (scan << 7) | (video_data & 0x7f); + reverse = BIT(video_data, 7); + } + + UINT8 char_data = m_char_rom[char_addr]; + + for (int x = 0; x < 8; x++) + { + int color = (BIT(char_data, 7 - x) ^ reverse) & !blank; + + bitmap.pix32((txadr * 10) + scan, (chadr * 8) + x) = pen[color]; + } + } + } + } + + return 0; +} + + + +//************************************************************************** +// SOUND +//************************************************************************** + +//------------------------------------------------- +// DISCRETE_SOUND( vixen ) +//------------------------------------------------- + +static DISCRETE_SOUND_START( vixen ) + DISCRETE_INPUT_LOGIC(NODE_01) + DISCRETE_SQUAREWAVE(NODE_02, NODE_01, XTAL_23_9616MHz/15360, 100, 50, 0, 90) + DISCRETE_OUTPUT(NODE_02, 2000) +DISCRETE_SOUND_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// I8155 interface +//------------------------------------------------- + +READ8_MEMBER( vixen_state::i8155_pa_r ) +{ + UINT8 data = 0xff; + + for (int i = 0; i < 8; i++) + if (!BIT(m_col, i)) data &= m_key[i]->read(); + + return data; +} + +WRITE8_MEMBER( vixen_state::i8155_pb_w ) +{ + m_col = data; +} + +WRITE8_MEMBER( vixen_state::i8155_pc_w ) +{ + /* + + bit description + + 0 DSEL1/ + 1 DSEL2/ + 2 DDEN/ + 3 ALT CHARSET/ + 4 256 CHARS + 5 BEEP ENB + 6 + 7 + + */ + + // drive select + floppy_image_device *floppy = NULL; + + if (!BIT(data, 0)) floppy = m_floppy0->get_device(); + if (!BIT(data, 1)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) floppy->mon_w(0); + + // density select + m_fdc->dden_w(BIT(data, 2)); + + // charset + m_alt = BIT(data, 3); + m_256 = BIT(data, 4); + + // beep enable + m_discrete->write(space, NODE_01, BIT(data, 5)); +} + +//------------------------------------------------- +// I8155 IO interface +//------------------------------------------------- + +WRITE8_MEMBER( vixen_state::io_i8155_pb_w ) +{ + /* + + bit description + + PB0 ATN + PB1 DAV + PB2 NDAC + PB3 NRFD + PB4 EOI + PB5 SRQ + PB6 IFC + PB7 REN + + */ + + /* data valid */ + m_ieee488->atn_w(BIT(data, 0)); + + /* end or identify */ + m_ieee488->dav_w(BIT(data, 1)); + + /* remote enable */ + m_ieee488->ndac_w(BIT(data, 2)); + + /* attention */ + m_ieee488->nrfd_w(BIT(data, 3)); + + /* interface clear */ + m_ieee488->eoi_w(BIT(data, 4)); + + /* service request */ + m_ieee488->srq_w(BIT(data, 5)); + + /* not ready for data */ + m_ieee488->ifc_w(BIT(data, 6)); + + /* data not accepted */ + m_ieee488->ren_w(BIT(data, 7)); +} + +WRITE8_MEMBER( vixen_state::io_i8155_pc_w ) +{ + /* + + bit description + + PC0 select internal clock + PC1 ENB RING INT + PC2 ENB RCV INT + PC3 ENB XMT INT + PC4 ENB ATN INT + PC5 ENB SRQ INT + PC6 + PC7 + + */ + + m_int_clk = BIT(data, 0); + m_enb_ring_int = BIT(data, 1); + m_enb_rcv_int = BIT(data, 2); + m_enb_xmt_int = BIT(data, 3); + m_enb_atn_int = BIT(data, 4); + m_enb_srq_int = BIT(data, 5); +} + +WRITE_LINE_MEMBER( vixen_state::io_i8155_to_w ) +{ + if (m_int_clk) + { + m_usart->write_txc(state); + m_usart->write_rxc(state); + } +} + +//------------------------------------------------- +// i8251_interface usart_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( vixen_state::rxrdy_w ) +{ + m_rxrdy = state; + update_interrupt(); +} + +WRITE_LINE_MEMBER( vixen_state::txrdy_w ) +{ + m_txrdy = state; + update_interrupt(); +} + +//------------------------------------------------- +// IEEE488_INTERFACE( ieee488_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( vixen_state::srq_w ) +{ + m_srq = state; + update_interrupt(); +} + +WRITE_LINE_MEMBER( vixen_state::atn_w ) +{ + m_atn = state; + update_interrupt(); +} + +static SLOT_INTERFACE_START( vixen_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +WRITE_LINE_MEMBER( vixen_state::fdc_intrq_w ) +{ + m_fdint = state; + update_interrupt(); +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// IRQ_CALLBACK_MEMBER( vixen_int_ack ) +//------------------------------------------------- + +IRQ_CALLBACK_MEMBER(vixen_state::vixen_int_ack) +{ + // D0 is pulled low + return 0xfe; +} + + +//------------------------------------------------- +// MACHINE_START( vixen ) +//------------------------------------------------- + +void vixen_state::machine_start() +{ + // configure memory banking + UINT8 *ram = m_ram->pointer(); + + membank("bank1")->configure_entry(0, ram); + membank("bank1")->configure_entry(1, m_rom); + + membank("bank2")->configure_entry(0, ram); + membank("bank2")->configure_entry(1, m_video_ram); + + membank("bank3")->configure_entry(0, m_video_ram); + membank("bank3")->configure_entry(1, m_rom); + + membank("bank4")->configure_entry(0, m_video_ram); + + // register for state saving + save_item(NAME(m_reset)); + save_item(NAME(m_col)); + save_item(NAME(m_cmd_d0)); + save_item(NAME(m_cmd_d1)); + save_item(NAME(m_fdint)); +} + + +void vixen_state::machine_reset() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + program.install_read_bank(0x0000, 0xefff, 0xfff, 0, "bank1"); + program.install_write_bank(0x0000, 0xefff, 0xfff, 0, "bank2"); + + membank("bank1")->set_entry(1); + membank("bank2")->set_entry(1); + membank("bank3")->set_entry(1); + + m_reset = 1; + + m_vsync = 0; + m_cmd_d0 = 0; + m_cmd_d1 = 0; + update_interrupt(); + + m_fdc->reset(); + m_io_i8155->reset(); + m_usart->reset(); +} + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( vixen ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( vixen, vixen_state ) + // basic machine hardware + MCFG_CPU_ADD(Z8400A_TAG, Z80, XTAL_23_9616MHz/6) + MCFG_CPU_PROGRAM_MAP(vixen_mem) + MCFG_CPU_IO_MAP(vixen_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vixen_state,vixen_int_ack) + + // video hardware + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(vixen_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_23_9616MHz/2, 96*8, 0*8, 81*8, 27*10, 0*10, 26*10) + + MCFG_TIMER_DRIVER_ADD_SCANLINE("vsync", vixen_state, vsync_tick, SCREEN_TAG, 26*10, 27*10) + + MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(vixen) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) + + // devices + MCFG_DEVICE_ADD(P8155H_TAG, I8155, XTAL_23_9616MHz/6) + MCFG_I8155_IN_PORTA_CB(READ8(vixen_state, i8155_pa_r)) + MCFG_I8155_OUT_PORTB_CB(WRITE8(vixen_state, i8155_pb_w)) + MCFG_I8155_OUT_PORTC_CB(WRITE8(vixen_state, i8155_pc_w)) + + MCFG_DEVICE_ADD(P8155H_IO_TAG, I8155, XTAL_23_9616MHz/6) + MCFG_I8155_OUT_PORTA_CB(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) + MCFG_I8155_OUT_PORTB_CB(WRITE8(vixen_state, io_i8155_pb_w)) + MCFG_I8155_OUT_PORTC_CB(WRITE8(vixen_state, io_i8155_pc_w)) + MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(vixen_state, io_i8155_to_w)) + + MCFG_DEVICE_ADD(P8251A_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(vixen_state, rxrdy_w)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(vixen_state, txrdy_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_dsr)) + + MCFG_FD1797_ADD(FDC1797_TAG, XTAL_23_9616MHz/24) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(vixen_state, fdc_intrq_w)) + MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":0", vixen_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":1", vixen_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_IEEE488_BUS_ADD() + MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(vixen_state, srq_w)) + MCFG_IEEE488_ATN_CALLBACK(WRITELINE(vixen_state, atn_w)) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("disk_list", "vixen") + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROMS +//************************************************************************** + +//------------------------------------------------- +// ROM( vixen ) +//------------------------------------------------- + +ROM_START( vixen ) + ROM_REGION( 0x1000, Z8400A_TAG, 0 ) + ROM_LOAD( "osborne 4 mon rom v1.04 3p40082-03 a0a9.4c", 0x0000, 0x1000, CRC(5f1038ce) SHA1(e6809fac23650bbb4689e58edc768d917d80a2df) ) // OSBORNE 4 MON ROM / V1.04 3P40082-03 / A0A9 (c) OCC 1985 + + ROM_REGION( 0x1000, "video", 0 ) + ROM_LOAD( "v1.10.3j", 0x0000, 0x1000, CRC(1f93e2d7) SHA1(0c479bfd3ac8d9959c285c020d0096930a9c6867) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "v1.00 l.1j", 0x0000, 0x1000, CRC(f97c50d9) SHA1(39f73afad68508c4b8a4d241c064f9978098d8f2) ) +ROM_END + + + +//************************************************************************** +// DRIVER INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// DRIVER_INIT( vixen ) +//------------------------------------------------- + +DIRECT_UPDATE_MEMBER(vixen_state::vixen_direct_update_handler) +{ + if (address >= 0xf000) + { + if (m_reset) + { + address_space &program = m_maincpu->space(AS_PROGRAM); + + program.install_read_bank(0x0000, 0xefff, "bank1"); + program.install_write_bank(0x0000, 0xefff, "bank2"); + + membank("bank1")->set_entry(0); + membank("bank2")->set_entry(0); + + m_reset = 0; + } + + direct.explicit_configure(0xf000, 0xffff, 0xfff, m_rom); + + return ~0; + } + + return address; +} + +DRIVER_INIT_MEMBER(vixen_state,vixen) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(vixen_state::vixen_direct_update_handler), this)); +} + + + +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1984, vixen, 0, 0, vixen, vixen, vixen_state, vixen, "Osborne", "Vixen", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/vk100.c b/src/mame/drivers/vk100.c new file mode 100644 index 00000000000..376b54efbcb --- /dev/null +++ b/src/mame/drivers/vk100.c @@ -0,0 +1,1265 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/*************************************************************************** + + DEC VK100 'GIGI' + + 12/05/2009 Skeleton driver. + 28/07/2009 added Guru-readme(TM) + 08/01/2012 Fleshed out driver. + + Todo: + * fix vector generator hardware enough to pass the startup self test + the tests are described on page 6-5 thru 6-8 of the tech reference + * hook up the bresenham DU/DVM/ERR stuff, currently only simple directional vectors work + * hook up the vector and sync proms to the sync counter + * figure out how the erase prom actually works at a hardware level + * redump the vector prom, the first two bytes look bad + * figure out the correct meaning of systat b register - needed for communications selftest + * hook up smc com5016t baud generator to i8251 rx and tx clocks - begun + + Notes: + The directions for the DIR value are arranged, starting from the * + as the vector origin: + 3 2 1 + \ | / + \|/ + 4--*--0 + /|\ + / | \ + 5 6 7 + + The X and Y counters are techincally 12 bits long each, though + only the low 9 and 10 bits respectively are used for ram addressing. + The MSB bit of each counter does have a special purpose with + regards to the RAS/ERASE prom though, perhaps to detect an + underflow 000->FFF + + Tony DiCenzo, now the director of standards and architecture at Oracle, was on the team that developed the VK100 + see http://startup.nmnaturalhistory.org/visitorstories/view.php?ii=79 + Robert "Bob" C. Quinn was definitely lead engineer on the VT125 + Robert "Bob" T. Collins was the lead engineer on the VK100 + Pedro Ortiz (https://www.linkedin.com/pub/pedro-ortiz/16/68b/196) did the drafting for the enclosure and case + + The prototype name for the VK100 was 'SMAKY' (Smart Keyboard) + +****************************************************************************/ +/* +DEC VK100 +DEC, 1982 + +This is a VK100 terminal, otherwise known as a DEC Gigi graphics terminal. +There's a technical manual dated 1982 here: +http://web.archive.org/web/20091015205827/http://www.computer.museum.uq.edu.au/pdf/EK-VK100-TM-001%20VK100%20Technical%20Manual.pdf +Installation and owner's manual is at: +http://www.bitsavers.org/pdf/dec/terminal/gigi/EK-VK100-IN-002_GIGI_Terminal_Installation_and_Owners_Manual_Apr81.pdf +An enormous amount of useful info can be derived from the VT125 technical manual: +http://www.bitsavers.org/pdf/dec/terminal/vt100/EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf starting on page 6-70, pdf page 316 +And its schematics: +http://bitsavers.org/pdf/dec/terminal/vt125/MP01053_VT125_Mar82.pdf + +PCB Layout +---------- + +VK100 LOGICBOARD + |-------| |---------| |---------| |-| |-| |-| |-| +|---|-20 mA-|----|---EIA---|--|HARD-COPY|----|B|-|G|-|R|--|-|--DSW(8)--| +| BW | +| POWER | +| PR2 | +| HD46505SP 4116 4116 4116 4116 | +| | +| 4116 4116 4116 4116 | +| PR5 INTEL ROM1 | +| PR1 PR6 P8251A 4116 4116 4116 4116 | +| 45.6192MHz ROM2 PR3 | +| 4116 4116 4116 4116 | +| 4116 4116 4116 INTEL ROM3 | +| D8202A | +| 4116 4116 4116 5.0688MHz ROM4 PR4 | +| | +| 4116 4116 INTEL SMC_5016T PIEZO | +| D8085A IDC40 LM556 75452 | +|----------------------------------------------------------------------| +Notes: + ROM1 - TP-01 (C) DEC 23-031E4-00 (M) SCM91276L 8114 + ROM2 - TP-01 (C) DEC 1980 23-017E4-00 MOSTEK MK36444N 8116 + ROM3 - TP-01 (C) MICROSOFT 1979 23-018E4-00 MOSTEK MK36445N 8113 + ROM4 - TP-01 (C) DEC 1980 23-190E2-00 P8316E AMD 35517 8117DPP + + LED meanings: + The LEDS on the vk100 (there are 7) are set up above the keyboard as: + Label: ON LINE LOCAL NO SCROLL BASIC HARD-COPY L1 L2 + Bit: !d5 d5 !d4 !d3 !d2 !d1 !d0 (of port 0x68) +according to manual from http://www.bitsavers.org/pdf/dec/terminal/gigi/EK-VK100-IN-002_GIGI_Terminal_Installation_and_Owners_Manual_Apr81.pdf +where X = on, 0 = off, ? = variable (- = off) + - X 0 0 0 0 0 (0x1F) = Microprocessor error + X - 0 X X X X (0x30) " + + - X 0 0 0 0 X (0x1E) = ROM error + X - 0 0 ? ? ? (0x3x) " +1E 3F = rom error, rom 1 (0000-0fff) +1E 3E = rom error, rom 1 (1000-1fff) +1E 3D = rom error, rom 2 (2000-2fff) +1E 3C = rom error, rom 2 (3000-3fff) +1E 3B = rom error, rom 3 (4000-4fff) +1E 3A = rom error, rom 3 (5000-5fff) +1E 39 = rom error, rom 4 (6000-6fff) + + - X 0 0 0 X 0 (0x1D) = RAM error + X - 0 ? ? ? ? (0x3x) " + + - X 0 0 0 X X (0x1C) = CRT Controller error + X - 0 X X X X (0x30) " +This test writes 0xF to port 00 (crtc address reg) and writes a pattern to it +via port 01 (crtc data reg) then reads it back and checks to be sure the data +matches. + + - X 0 0 X 0 0 (0x1B) = CRT Controller time-out + X - 0 X X X X (0x30) " +This test writes 00 to all the crtc registers and checks to be sure an rst7.5 +(vblank) interrupt fires on the 8085 within a certain time period. + + - X 0 0 X 0 X (0x1A) = Vector time-out error + X - 0 X X X X (0x30) " +Not sure exactly what this tests, likely tries firing the vector generator +state machine and sees if the GO bit ever finishes and goes back to 0 +*/ + +// named timer IDs +#define TID_I8251_RX 1 +#define TID_I8251_TX 2 +#define TID_SYNC 3 + +// show messages related to writes to the 0x4x VG registers +#undef VG40_VERBOSE +// show messages related to writes to the 0x6x VG registers +#undef VG60_VERBOSE +// show messages related to LED/beeper writes +#undef LED_VERBOSE +// show messages related to KYBD writes +#undef KBD_VERBOSE +// debug the pattern reg +#undef PAT_DEBUG +// show reads from the two systat registers +#undef SYSTAT_A_VERBOSE +#undef SYSTAT_B_VERBOSE + +// debug state dump for the vector generator +#undef DEBUG_VG_STATE + +#include "bus/rs232/rs232.h" +#include "cpu/i8085/i8085.h" +#include "sound/beep.h" +#include "video/mc6845.h" +#include "machine/com8116.h" +#include "machine/i8251.h" +#include "vk100.lh" + +#define RS232_TAG "rs232" +#define COM5016T_TAG "com5016t" + +class vk100_state : public driver_device +{ +public: + enum + { + TIMER_EXECUTE_VG + }; + + vk100_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "crtc"), + m_speaker(*this, "beeper"), + m_uart(*this, "i8251"), + m_dbrg(*this, COM5016T_TAG), + //m_i8251_rx_timer(NULL), + //m_i8251_tx_timer(NULL), + //m_sync_timer(NULL), + + m_capsshift(*this, "CAPSSHIFT"), + m_dipsw(*this, "SWITCHES") + { + } + + required_device m_maincpu; + required_device m_crtc; + required_device m_speaker; + required_device m_uart; + required_device m_dbrg; + //required_device<> m_i8251_rx_timer; + //required_device<> m_i8251_tx_timer; + //required_device<> m_sync_timer; + + required_ioport m_capsshift; + required_ioport m_dipsw; + + UINT8* m_vram; + UINT8* m_trans; + UINT8* m_pattern; + UINT8* m_dir; + UINT8* m_sync; + UINT8* m_vector; + UINT8* m_ras_erase; + UINT8 m_dir_a6; // latched a6 of dir rom + UINT8 m_cout; // carry out from vgERR adder + UINT8 m_vsync; // vsync pin of crtc + UINT16 m_vgX; // 12 bit X value for vector draw position + UINT16 m_vgY; // 12 bit Y value for vector draw position + UINT16 m_vgERR; // error register can cause carries which need to be caught + UINT8 m_vgSOPS; + UINT8 m_vgPAT; + UINT16 m_vgPAT_Mask; // current mask for PAT + UINT8 m_vgPMUL; // reload value for PMUL_Count + UINT8 m_vgPMUL_Count; + UINT8 m_vgDownCount; // down counter = number of pixels, loaded from vgDU on execute +#define VG_DU m_vgRegFile[0] +#define VG_DVM m_vgRegFile[1] +#define VG_DIR m_vgRegFile[2] +#define VG_WOPS m_vgRegFile[3] + UINT8 m_vgRegFile[4]; + UINT8 m_VG_MODE; // 2 bits, latched on EXEC + UINT8 m_vgGO; // activated on next SYNC pulse after EXEC + UINT8 m_ACTS; + UINT8 m_ADSR; + ioport_port* m_col_array[16]; + + DECLARE_WRITE8_MEMBER(vgLD_X); + DECLARE_WRITE8_MEMBER(vgLD_Y); + DECLARE_WRITE8_MEMBER(vgERR); + DECLARE_WRITE8_MEMBER(vgSOPS); + DECLARE_WRITE8_MEMBER(vgPAT); + DECLARE_WRITE8_MEMBER(vgPMUL); + DECLARE_WRITE8_MEMBER(vgREG); + DECLARE_WRITE8_MEMBER(vgEX); + DECLARE_WRITE8_MEMBER(KBDW); + DECLARE_WRITE8_MEMBER(BAUD); + DECLARE_READ8_MEMBER(vk100_keyboard_column_r); + DECLARE_READ8_MEMBER(SYSTAT_A); + DECLARE_READ8_MEMBER(SYSTAT_B); + DECLARE_DRIVER_INIT(vk100); + virtual void machine_start(); + virtual void video_start(); + TIMER_CALLBACK_MEMBER(execute_vg); + DECLARE_WRITE_LINE_MEMBER(crtc_vsync); + DECLARE_WRITE_LINE_MEMBER(i8251_rxrdy_int); + DECLARE_WRITE_LINE_MEMBER(i8251_txrdy_int); + DECLARE_WRITE_LINE_MEMBER(i8251_rts); + UINT8 vram_read(); + UINT8 vram_attr_read(); + MC6845_UPDATE_ROW(crtc_update_row); + void vram_write(UINT8 data); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +// vram access functions: + /* figure out vram address based on tech manual page 5-24: + * real address to 16-bit chunk a13 a12 | a11 a10 a9 a8 | a7 a6 a5 a4 | a3 a2 a1 a0 + * X+Y input Y8 Y7 | Y6 Y5 Y4 Y3 | Y2 Y1 X9' X8'| X7' X6' X5' X4' + * X3' and X2' choose a 4-bit block, X1 and X0 choose a bit within that. + * Figure out the ram address in address space "vram" based on this: + * vram is 0x8000 long (0x4000 16-bit blocks in sequence) + * so: + * vram: a14 a13 a12 | a11 a10 a9 a8 | a7 a6 a5 a4 | a3 a2 a1 a0 + * vg: Y8 Y7 Y6 | Y5 Y4 Y3 Y2 | Y1 X9' X8' X7'| X6' X5' X4'(x3') x2' x1 x0 + * X3' is handled by the nybbleNum statement, as is X2' + * X1 and X0 are handled by the pattern rom directly: + * x0 -> a0, x1 -> a1 + * this handles bits like: + * x1 x0 + * 0 0 -> bit 0 + * 0 1 -> bit 1 + * 1 0 -> bit 2 + * 1 1 -> bit 3 + */ + +// returns one nybble from vram array based on X and Y regs +UINT8 vk100_state::vram_read() +{ + // XFinal is (X'&0x3FC)|(X&0x3) + UINT16 XFinal = m_trans[(m_vgX&0x3FC)>>2]<<2|(m_vgX&0x3); // appears correct + // EA is the effective ram address for a 16-bit block + UINT16 EA = ((m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct + // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte) + UINT16 block = m_vram[(EA<<1)+1] | (m_vram[(EA<<1)]<<8); + // nybbleNum is which of the four nybbles within the block to address. should NEVER be 3! + UINT8 nybbleNum = (XFinal&0xC)>>2; + return (block>>(4*nybbleNum))&0xF; +} + +// returns the attribute nybble for the current pixel based on X and Y regs +UINT8 vk100_state::vram_attr_read() +{ + // XFinal is (X'&0x3FC)|(X&0x3) + UINT16 XFinal = m_trans[(m_vgX&0x3FC)>>2]<<2|(m_vgX&0x3); // appears correct + // EA is the effective ram address for a 16-bit block + UINT16 EA = ((m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct + // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte) + UINT16 block = m_vram[(EA<<1)+1] | (m_vram[(EA<<1)]<<8); + // nybbleNum is the attribute nybble, which in this case is always 3 + UINT8 nybbleNum = 3; + return (block>>(4*nybbleNum))&0xF; +} + +// writes one nybble to vram array based on X and Y regs, and updates the attrib ram if needed +void vk100_state::vram_write(UINT8 data) +{ + // XFinal is (X'&0x3FC)|(X&0x3) + UINT16 XFinal = m_trans[(m_vgX&0x3FC)>>2]<<2|(m_vgX&0x3); // appears correct + // EA is the effective ram address for a 16-bit block + UINT16 EA = ((m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct + // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte) + UINT16 block = m_vram[(EA<<1)+1] | (m_vram[(EA<<1)]<<8); + // nybbleNum is which of the four nybbles within the block to address. should NEVER be 3! + UINT8 nybbleNum = (XFinal&0xC)>>2; + block &= ~((UINT16)0xF<<(nybbleNum*4)); // mask out the part we want to replace + block |= data<<(nybbleNum*4); // write the new part + // NOTE: this next part may have to be made conditional on VG_MODE + // check if the attribute nybble is supposed to be modified, and if so do so + if (VG_WOPS&0x08) block = (block&0x0FFF)|(((UINT16)VG_WOPS&0xF0)<<8); + m_vram[(EA<<1)+1] = block&0xFF; // write block back to vram + m_vram[(EA<<1)] = (block&0xFF00)>>8; // '' +} + +void vk100_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_EXECUTE_VG: + execute_vg(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in vk100_state::device_timer"); + } +} + +/* this is the "DIRECTION ROM" == mb6309 (256x8, 82s135) + * see figure 5-24 on page 5-39 + * It tells the direction and enable for counting on the X and Y counters + * and also handles the non-math related parts of the bresenham line algorithm + * control bits: + * /CE1 ----- DCOUNT 0 H [verified via tracing] + * /CE2 ----- ENA ERROR L [verified via tracing] + * addr bits: 76543210 + * ||||\\\\-- DIR (vgDIR register low 4 bits) + * |||\------ C OUT aka ERROR CARRY (strobed in by STROBE L from the error counter's adder) [verified via tracing] + * ||\------- Y0 (the otherwise unused lsb of the Y register, used for bresenham) [verified via tracing] + * |\-------- feedback bit from d5 strobed by V CLK [verified via tracing] + * \--------- GND; the second half of the prom is blank (0x00) + * data bits: 76543210 + * |||||||\-- ENA Y (enables change on Y counter) + * ||||||\--- ENA X (enables change on X counter) + * |||||\---- Y DIRECTION (high is count down, low is count up) + * ||||\----- X DIRECTION (high is count down, low is count up) + * |||\------ PIXEL WRT + * ||\------- feedback bit to a6, this bit is held in PRESET/1 condition by GO being inactive, and if the vector prom is disabled it is pulled to 1 [verified via tracing and schematics] + * |\-------- UNUSED, always 0 + * \--------- UNUSED, always 0 + * The VT125 prom @ E41 is literally identical to this, the same exact part: 23-059B1 + */ +TIMER_CALLBACK_MEMBER(vk100_state::execute_vg) +{ + m_cout = 1; // hack for now + UINT8 dirbyte = m_dir[(m_dir_a6<<6)|((m_vgY&1)<<5)|(m_cout<<4)|VG_DIR]; +#ifdef DEBUG_VG_STATE + static const char *const vg_functions[] = { "Move", "Dot", "Vector", "Erase" }; + fprintf(stderr, "VGMODE: %s; DIR: A:%02x; D:%02x; X: %03X; Y: %03X; DownCount: %02X\n", vg_functions[m_VG_MODE], ((m_dir_a6<<6)|((m_vgY&1)<<5)|(m_cout<<4)|VG_DIR), dirbyte, m_vgX, m_vgY, m_vgDownCount); +#endif + m_dir_a6 = m_vgGO?((dirbyte&0x20)>>5):1; + if (dirbyte&2) // ena_x is active + { + if (dirbyte&0x80) m_vgX--; + else m_vgX++; + } + if (dirbyte&1) // ena_y is active + { + if (dirbyte&0x40) m_vgY--; + else m_vgY++; + } + if (dirbyte&0x10) m_vgDownCount--; // decrement the down counter + UINT8 thisNyb = vram_read(); // read in the nybble + // pattern rom addressing is a complex mess. see the pattern rom def later in this file. + UINT8 newNyb = m_pattern[((m_vgPAT&m_vgPAT_Mask)?0x200:0)|((VG_WOPS&7)<<6)|((m_vgX&3)<<4)|thisNyb]; // calculate new nybble based on pattern rom + // finally write the block back to ram depending on the VG_MODE (sort of a hack until we get the vector and sync and dir roms all hooked up) + // but only do it if the direction rom said so! + switch (m_VG_MODE) + { + case 0: // move; adjusts the x and y but doesn't write anything. do nothing + break; + case 1: // dot: only write the LAST pixel in the chain? TODO: some fallthrough magic here? + if ((m_vgDownCount) == 0x00) + { + if (dirbyte&0x10) vram_write(newNyb); // write out the modified nybble + } + break; + case 2: // vec: draw the vector + if (dirbyte&0x10) vram_write(newNyb); // write out the modified nybble + break; + case 3: // er: erase: special case here: wipe the entire screen (except for color/attrib?) and then set done. + for (int i = 0; i < 0x8000; i++) + { + if (!(i&1)) // avoid stomping attribute + m_vram[i] = m_vram[i]&0xF0; + else // (i&1) + m_vram[i] = 0; + } + m_vgGO = 0; // done + break; + } + if ((m_vgDownCount) == 0x00) m_vgGO = 0; // check if the down counter hit terminal count (0), if so we're done. + if (((++m_vgPMUL_Count)&0xF)==0) // if pattern multiplier counter overflowed + { + m_vgPMUL_Count = m_vgPMUL; // reload counter + m_vgPAT_Mask >>= 1; // shift the mask + if (m_vgPAT_Mask == 0) m_vgPAT_Mask = 0x80; // reset mask if it hits 0 + } + if (m_vgGO) timer_set(attotime::from_hz(XTAL_45_6192Mhz/3/12/2), TIMER_EXECUTE_VG); // /3/12/2 is correct. the sync counter is clocked by the dot clock, despite the error on figure 5-21 +} + +/* ports 0x40 and 0x41: load low and high bytes of vector gen X register */ +WRITE8_MEMBER(vk100_state::vgLD_X) +{ + m_vgX &= 0xFF << ((1-offset)*8); + m_vgX |= ((UINT16)data) << (offset*8); +#ifdef VG40_VERBOSE + logerror("VG: 0x%02X: X Reg loaded with %04X, new X value is %04X\n", 0x40+offset, ((UINT16)data) << (offset*8), m_vgX); +#endif +} + +/* ports 0x42 and 0x43: load low and high bytes of vector gen Y register */ +WRITE8_MEMBER(vk100_state::vgLD_Y) +{ + m_vgY &= 0xFF << ((1-offset)*8); + m_vgY |= ((UINT16)data) << (offset*8); +#ifdef VG40_VERBOSE + logerror("VG: 0x%02X: Y Reg loaded with %04X, new Y value is %04X\n", 0x42+offset, ((UINT16)data) << (offset*8), m_vgY); +#endif +} + +/* port 0x44: "ERR" load bresenham line algorithm 'error' count */ +WRITE8_MEMBER(vk100_state::vgERR) +{ + m_vgERR = data; +#ifdef VG40_VERBOSE + logerror("VG: 0x44: ERR Reg loaded with %02X\n", m_vgERR); +#endif +} + +/* port 0x45: "SOPS" screen options + * (handled by 74LS273 @ E55, schematic sheet 10, all signals called 'VVG1 BDx' where x is 7 to 0) + * Blink --Background color-- Blink Serial Serial Reverse + * Enable Green Red Blue Control SL1 SL0 BG/FG + * d7 d6 d5 d4 d3 d2 d1 d0 + * apparently, SLx: 00 = rs232/eia(J6), 01 = 20ma(J1), 10 = hardcopy(J7), 11 = test/loopback + * Serial Select (SLx) routing controls are rather complex, shown on schematic + * page 9: + * VDC2 | I8251 pins | SYSTAT_B bits + * SL1 SL0 | 8251RXD 8251RTS 8251TXD 8251/DTR 8251/DSR 8251CTS | SYSTATB_ACTS SYSTATB_ADSR + * 0 0 J6 /RXD J6 /RTS J6 TXD J6 /DTR J7 URTS GND J6 /CTS J6 /DSR + * 0 1 J1 +-R ACTS(loop) J1 +-T J6 /DTR J7 URTS GND 8251RTS(loop) J6 /DSR + * 1 0 J7 DRXD J7 DRTS* J7 DTXD J6 /DTR J7 URTS GND J7 /DCTS J6 /DSR + * 1 1 8251TXD ACTS(loop) 8251RXD J6 /DTR J7 URTS GND 8251RTS(loop) J6 /DSR + * * and UCTS, the pin drives both pins on J7 + */ +WRITE8_MEMBER(vk100_state::vgSOPS) +{ + m_vgSOPS = data; +#ifdef VG40_VERBOSE + static const char *const serialDest[4] = { "EIA232", "20ma", "Hardcopy", "Loopback/test" }; + logerror("VG: 0x45: SOPS Reg loaded with %02X: Background KGRB: %d%d%d%d, Blink: %d, Serial select: %s, Reverse BG/FG: %d\n", m_vgSOPS, (m_vgSOPS>>7)&1, (m_vgSOPS>>6)&1, (m_vgSOPS>>5)&1, (m_vgSOPS>>4)&1, (m_vgSOPS>>3)&1, serialDest[(m_vgSOPS>>1)&3], m_vgSOPS&1); +#endif +} + +/* port 0x46: "PAT" load vg Pattern register */ +WRITE8_MEMBER(vk100_state::vgPAT) +{ + m_vgPAT = data; +#ifdef PAT_DEBUG + for (int i = 7; i >= 0; i--) + { + printf("%s", (data&(1<>7)&1, (VG_WOPS>>6)&1, (VG_WOPS>>5)&1, (VG_WOPS>>4)&1, (VG_WOPS>>3)&1, wopsFunctions[(VG_WOPS>>1)&3], VG_WOPS&1); +#endif +} + + +/* port 0x64: "EX MOV" execute a move (relative move of x and y using du/dvm/dir/err, no writing) */ +/* port 0x65: "EX DOT" execute a dot (draw a dot at x,y?) */ +/* port 0x66: "EX VEC" execute a vector (draw a vector from x,y to a destination using du/dvm/dir/err ) */ +/* port 0x67: "EX ER" execute an erase (clear the screen to the bg color, i.e. fill vram with zeroes) */ +WRITE8_MEMBER(vk100_state::vgEX) +{ +#ifdef VG60_VERBOSE + static const char *const ex_functions[] = { "Move", "Dot", "Vector", "Erase" }; + logerror("VG Execute %s 0x%02X written with %d\n", ex_functions[offset&3], 0x67+offset, data); + //fprintf(stderr, "VG Execute %s 0x%02X written with %d\n", ex_functions[offset&3], 0x67+offset, data); +#endif + m_vgPMUL_Count = m_vgPMUL; // load PMUL_Count + m_vgPAT_Mask = 0x80; + m_vgDownCount = VG_DU; // set down counter to length of major vector + m_VG_MODE = offset&3; + m_vgGO = 1; + timer_set(attotime::zero, TIMER_EXECUTE_VG); +} + + +/* port 0x68: "KBDW" d7 is beeper, d6 is keyclick, d5-d0 are keyboard LEDS */ +WRITE8_MEMBER(vk100_state::KBDW) +{ + output_set_value("online_led",BIT(data, 5) ? 1 : 0); + output_set_value("local_led", BIT(data, 5) ? 0 : 1); + output_set_value("noscroll_led",BIT(data, 4) ? 1 : 0); + output_set_value("basic_led", BIT(data, 3) ? 1 : 0); + output_set_value("hardcopy_led", BIT(data, 2) ? 1 : 0); + output_set_value("l1_led", BIT(data, 1) ? 1 : 0); + output_set_value("l2_led", BIT(data, 0) ? 1 : 0); +#ifdef LED_VERBOSE + if (BIT(data, 6)) logerror("kb keyclick bit 6 set: not emulated yet (multivibrator)!\n"); +#endif + m_speaker->set_state(BIT(data, 7)); +#ifdef LED_VERBOSE + logerror("LED state: %02X: %s %s %s %s %s %s\n", data&0xFF, (data&0x20)?"------- LOCAL ":"ON LINE ----- ", (data&0x10)?"--------- ":"NO SCROLL ", (data&0x8)?"----- ":"BASIC ", (data&0x4)?"--------- ":"HARD-COPY ", (data&0x2)?"-- ":"L1 ", (data&0x1)?"-- ":"L2 "); +#endif +} + +/* port 0x6C: "BAUD" controls the smc com5016t dual baud generator which + * controls the divisors for the rx and tx clocks on the 8251 from the + 5.0688Mhz cpu xtal. + It has 5v,12v on pins 2 and 9, pin 10 is NC. + * A later part that replaced this on the market is SMC COM8116(T)/8136(T), which + was a 5v-only part (pin 9 and 10 are NC, 10 is a clock out on the 8136. + * Note that even on the SMC COM5016T version, SMC would allow the user + to mask their own dividers on custom ordered chips if desired. + * The COM8116(T)/8136(T) came it at least 4 mask rom types meant for different + input clocks: + -000 or no mark for 5.0688Mhz (which exactly matches the table below) (synertek sy2661-3 also matches this exactly) + -003 is for 6.01835MHz + -005 is for 4.915200Mhz + -006 is for 5.0688Mhz but omits the 2000 baud entry, instead has 200, + and output frequencies are 2x as fast (meant for a 32X clock uart) + -013 is for 2.76480MHz + -013A is for 5.52960MHz + (several other unknown refclock masks appear on partscalper sites) + GI also made a clone of the 8116 5v chip called the AY-5-8116(T)/8136(T) + which had at least two masks: -000/no mark and -005, matching speeds above + WD made the WD1943 which is similarly 5v compatible, with -00, -05, -06 masks + The COM8046(T) has 5 bits for selection instead of 4, but still expects + a 5.0688MHz reference clock, and the second half of the table matches the + values below; the first half of the table is the values below /2, rounded + down (for uarts which need a clock rate of 32x baud instead of 16x). + WD's BR1941 is also functionally compatible but uses 5v,12v,-5v on pins 2,9,10 + * The baud divisor lookup table has 16 entries, but only entries 2,5,6,7,A,C,E,F are documented/used in the vk100 tech manual + * The others are based on page 13 of http://www.hartetechnologies.com/manuals/Tarbell/Tarbell%20Z80%20CPU%20Board%20Model%203033.pdf + * D C B A Divisor Expected Baud + * 0 0 0 0 - 6336 (5068800 / 6336 = 16*50 = 50 baud + * 0 0 0 1 - 4224 (5068800 / 4224 = 16*75) = 75 baud + * 0 0 1 0 - 2880 (5068800 / 2880 = 16*110) = 110 baud + * 0 0 1 1 - 2355 (5068800 / 2355 = 16*134.5223) ~= 134.5 baud + * 0 1 0 0 - 2112 (5068800 / 2112 = 16*150) = 150 baud + * 0 1 0 1 - 1056 (5068800 / 1056 = 16*300) = 300 baud + * 0 1 1 0 - 528 (5068800 / 528 = 16*600) = 600 baud + * 0 1 1 1 - 264 (5068800 / 264 = 16*1200) = 1200 baud + * 1 0 0 0 - 176 (5068800 / 176 = 16*1800) = 1800 baud + * 1 0 0 1 - 158 (5068800 / 158 = 16*2005.0633) ~= 2000 baud + * 1 0 1 0 - 132 (5068800 / 132 = 16*2400) = 2400 baud + * 1 0 1 1 - 88 (5068800 / 88 = 16*3600) = 3600 baud + * 1 1 0 0 - 66 (5068800 / 66 = 16*4800) = 4800 baud + * 1 1 0 1 - 44 (5068800 / 44 = 16*7200) = 7200 baud + * 1 1 1 0 - 33 (5068800 / 33 = 16*9600) = 9600 baud + * 1 1 1 1 - 16 (5068800 / 16 = 16*19800) ~= 19200 baud + */ +WRITE8_MEMBER(vk100_state::BAUD) +{ + m_dbrg->str_w(data & 0x0f); + m_dbrg->stt_w(data >> 4); +} + +/* port 0x40-0x47: "SYSTAT A"; various status bits, poorly documented in the tech manual + * /GO VDM1 VDM1 VDM1 VDM1 Dip RST7.5 GND*** + * BIT3 BIT2 BIT1 BIT0 Switch VSYNC + * d7 d6 d5 d4 d3 d2 d1 d0 + bit3, 2, 1, 0 are the 4 bits output from the VRAM 12->4 multiplexer + which are also inputs to the pattern rom; they are constantly updated + by the sync rom and related circuitry. + This is the only way the vram can be read by the cpu. + d7 is from the /Q output of the GO latch + d6,5,4,3 are from the 74ls298 at ic4 (right edge of pcb) + d2 is where the dipswitch values are read from, based on the offset + d1 is connected to 8085 rst7.5 (pin 7) and crtc pin 40 (VSYNC) [verified via tracing] + d0 is tied to GND [verified via tracing] but the schematics both tie it to GND + and call it LP FLAG, may be a leftover from development. + + 31D reads and checks d7 in a loop + 205 reads, xors with 0x55 (from reg D), ANDS result with 0x78 and branches if it is not zero (checking for bit pattern 1010?) + 299 reads, rotates result right 3 times and ANDs the result with 0x0F + 2A4 reads, rotates result left 1 time and ANDS the result with 0xF0 +*/ +READ8_MEMBER(vk100_state::SYSTAT_A) +{ + UINT8 dipswitchLUT[8] = { 1,3,5,7,6,4,2,0 }; // the dipswitches map in a weird order to offsets +#ifdef SYSTAT_A_VERBOSE + if (m_maincpu->pc() != 0x31D) logerror("0x%04X: SYSTAT_A Read!\n", m_maincpu->pc()); +#endif + return ((m_vgGO?0:1)<<7)|(vram_read()<<3)|(((m_dipsw->read()>>dipswitchLUT[offset])&1)?0x4:0)|(m_vsync?0x2:0); +} + +/* port 0x48: "SYSTAT B"; NOT documented in the tech manual at all. + * when in loopback/test mode, SYSTAT_B is read and expected the following, around 0x606: + * reset 8751, modewrite of 0x5E + * write command -> 0x20 (normal, normal, /RTS is 0, normal, normal, receive off, /DTR is 1, transmit off) + * read SYSTAT B (and xor with 0xe), expect d7 to be CLEAR or jump to error + * write command -> 0x05 (normal, normal, /RTS is 1, normal, normal, receive ON, /DTR is 0, transmit off) + * read SYSTAT B (and xor with 0xe), expect d7 to be SET or jump to error + * after this it does something and waits for an rxrdy interrupt + + shows the results of: + * ACTS (/CTS) ADSR (/DSR) GND GND ATTR3 ATTR2 ATTR1 ATTR0 + * d7 d6 d5 d4 d3 d2 d1 d0 + * the ACTS (inverse of DCTS) signal lives in one of these bits (see 5-62) + * it XORs the read of systat_b with the E register (which holds 0x6) + * and checks the result + * The 4 attribute ram bits for the cell being pointed at by the X and Y regs are readable as the low nybble. + * The DSR pin is readable as bit 6. + */ +READ8_MEMBER(vk100_state::SYSTAT_B) +{ +#ifdef SYSTAT_B_VERBOSE + logerror("0x%04X: SYSTAT_B Read!\n", m_maincpu->pc()); +#endif + return (m_ACTS<<7)|(m_ADSR<<6)|vram_attr_read(); +} + +READ8_MEMBER(vk100_state::vk100_keyboard_column_r) +{ + UINT8 code = m_col_array[offset&0xF]->read() | m_capsshift->read(); +#ifdef KBD_VERBOSE + logerror("Keyboard column %X read, returning %02X\n", offset&0xF, code); +#endif + return code; +} + +static ADDRESS_MAP_START(vk100_mem, AS_PROGRAM, 8, vk100_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x6fff ) AM_ROM + AM_RANGE( 0x7000, 0x700f ) AM_MIRROR(0x0ff0) AM_READ(vk100_keyboard_column_r) + AM_RANGE( 0x8000, 0xbfff ) AM_RAM +ADDRESS_MAP_END + +/* + * 8085 IO address map (x = ignored; * = selects address within this range; ? = not sure; ** = subparts check this bit) + * (a15 to a8 are latched the same value as a7-a0 on the 8080 and 8085) + * [this map is derived from extensive tracing as well as some guesswork, noted for the crtc, systat_b and the uart] + a7 a6 a5 a4 a3 a2 a1 a0 + x 0 x x x x x 0 W CRTC address + x 0 x x x x x 1 RW CRTC register r/w + x 1 * * * ** ** ** read area (rightmost 74ls138): + x 1 0 0 0 * * * R SYSTAT_A (a0-a3 chooses the bit of the dipswitches read via d3) + x 1 0 0 1 x x x R SYSTAT_B + x 1 0 1 0 x x 0 R i8251 UART data + x 1 0 1 0 x x 1 R i8251 UART status + x 1 0 1 1 x x x R unused + x 1 1 0 0 x x x R unused + x 1 1 0 1 x x x R unused + x 1 1 1 0 x x x R unused + x 1 1 1 1 x x x R unused + x 1 0 x x * * * write area (right 74ls138): + x 1 0 x x 0 0 0 W X (low 8 bits) + x 1 0 x x 0 0 1 W X (high 4 bits) + x 1 0 x x 0 1 0 W Y (low 8 bits) + x 1 0 x x 0 1 1 W Y (high 4 bits) + x 1 0 x x 1 0 0 W ERR + x 1 0 x x 1 0 1 W SOPS + x 1 0 x x 1 1 0 W PAT + x 1 0 x x 1 1 1 W PMUL + x 1 1 * * * ** ** write area (middle 74ls138): + x 1 1 0 0 0 ** ** write to register file 2x 74ls670: + x 1 1 0 0 0 0 0 W DU + x 1 1 0 0 0 0 1 W DVM + x 1 1 0 0 0 1 0 W DIR + x 1 1 0 0 0 1 1 W WOPS + x 1 1 0 0 1 * * W set VG_MODE to * * XOR 3 and Execute (if GO is not active) + x 1 1 0 1 0 x x W KYBDW + x 1 1 0 1 1 x x W BAUD + x 1 1 1 0 0 x 0 W i8251 UART data + x 1 1 1 0 0 x 1 W i8251 UART control + x 1 1 1 0 1 x x W unused + x 1 1 1 1 0 x x W unused + x 1 1 1 1 1 x x W unused +*/ +static ADDRESS_MAP_START(vk100_io, AS_IO, 8, vk100_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x7f) // guess, probably correct + AM_RANGE(0x00, 0x00) AM_MIRROR(0xBE) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0x01, 0x01) AM_MIRROR(0xBE) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + // Comments are from page 118 (5-14) of http://web.archive.org/web/20091015205827/http://www.computer.museum.uq.edu.au/pdf/EK-VK100-TM-001%20VK100%20Technical%20Manual.pdf + AM_RANGE (0x40, 0x41) AM_MIRROR(0x98) AM_WRITE(vgLD_X) //LD X LO + HI 12 bits + AM_RANGE (0x42, 0x43) AM_MIRROR(0x98) AM_WRITE(vgLD_Y) //LD Y LO + HI 12 bits + AM_RANGE (0x44, 0x44) AM_MIRROR(0x98) AM_WRITE(vgERR) //LD ERR ('error' in bresenham algorithm) + AM_RANGE (0x45, 0x45) AM_MIRROR(0x98) AM_WRITE(vgSOPS) //LD SOPS (screen options (plus uart dest)) + AM_RANGE (0x46, 0x46) AM_MIRROR(0x98) AM_WRITE(vgPAT) //LD PAT (pattern register) + AM_RANGE (0x47, 0x47) AM_MIRROR(0x98) AM_WRITE(vgPMUL) //LD PMUL (pattern multiplier) + AM_RANGE (0x60, 0x63) AM_MIRROR(0x80) AM_WRITE(vgREG) //LD DU, DVM, DIR, WOPS (register file) + AM_RANGE (0x64, 0x67) AM_MIRROR(0x80) AM_WRITE(vgEX) //EX MOV, DOT, VEC, ER + AM_RANGE (0x68, 0x68) AM_MIRROR(0x83) AM_WRITE(KBDW) //KBDW (probably AM_MIRROR(0x03)) + AM_RANGE (0x6C, 0x6C) AM_MIRROR(0x83) AM_WRITE(BAUD) //LD BAUD (baud rate clock divider setting for i8251 tx and rx clocks) (probably AM_MIRROR(0x03)) + AM_RANGE (0x70, 0x70) AM_MIRROR(0x82) AM_DEVWRITE("i8251", i8251_device, data_w) //LD COMD (i8251 data reg) + AM_RANGE (0x71, 0x71) AM_MIRROR(0x82) AM_DEVWRITE("i8251", i8251_device, control_w) //LD COM (i8251 control reg) + //AM_RANGE (0x74, 0x74) AM_MIRROR(0x83) AM_WRITE(unknown_74) + //AM_RANGE (0x78, 0x78) AM_MIRROR(0x83) AM_WRITE(kbdw) //KBDW ?(mirror?) + //AM_RANGE (0x7C, 0x7C) AM_MIRROR(0x83) AM_WRITE(unknown_7C) + AM_RANGE (0x40, 0x47) AM_MIRROR(0x80) AM_READ(SYSTAT_A) // SYSTAT A (state machine done and last 4 bits of vram, as well as dipswitches) + AM_RANGE (0x48, 0x48) AM_MIRROR(0x87/*0x80*/) AM_READ(SYSTAT_B) // SYSTAT B (uart stuff) + AM_RANGE (0x50, 0x50) AM_MIRROR(0x86) AM_DEVREAD("i8251", i8251_device, data_r) // UART O + AM_RANGE (0x51, 0x51) AM_MIRROR(0x86) AM_DEVREAD("i8251", i8251_device, status_r) // UAR + //AM_RANGE (0x58, 0x58) AM_MIRROR(0x87) AM_READ(unknown_58) + //AM_RANGE (0x60, 0x60) AM_MIRROR(0x87) AM_READ(unknown_60) + //AM_RANGE (0x68, 0x68) AM_MIRROR(0x87) AM_READ(unknown_68) // NOT USED + //AM_RANGE (0x70, 0x70) AM_MIRROR(0x87) AM_READ(unknown_70) + //AM_RANGE (0x78, 0x7f) AM_MIRROR(0x87) AM_READ(unknown_78) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vk100 ) + // the dipswitches are common ground: when open (upward) the lines are pulled to 5v, otherwise they read as 0 + PORT_START("SWITCHES") + PORT_DIPNAME( 0x01, 0x00, "Power Frequency" ) PORT_DIPLOCATION("SW:!1") + PORT_DIPSETTING( 0x00, "60Hz" ) + PORT_DIPSETTING( 0x01, "50Hz" ) + PORT_DIPNAME( 0x02, 0x00, "Default Serial Port" ) PORT_DIPLOCATION("SW:!2") + PORT_DIPSETTING( 0x00, "EIA port" ) + PORT_DIPSETTING( 0x02, "20ma port" ) + PORT_DIPNAME( 0x04, 0x00, "Default US/UK" ) PORT_DIPLOCATION("SW:!3") + PORT_DIPSETTING( 0x00, "US" ) + PORT_DIPSETTING( 0x04, "UK" ) + PORT_DIPNAME( 0x18, 0x00, "Default Parity" ) PORT_DIPLOCATION("SW:!4,!5") + PORT_DIPSETTING( 0x00, "Off" ) + PORT_DIPSETTING( 0x10, "Even" ) + PORT_DIPSETTING( 0x08, "Odd" ) + PORT_DIPSETTING( 0x18, "Do Not Use This Setting" ) + PORT_DIPNAME( 0xe0, 0x00, "Default Baud Rate" ) PORT_DIPLOCATION("SW:!6,!7,!8") + PORT_DIPSETTING( 0x00, "110" ) + PORT_DIPSETTING( 0x80, "300" ) + PORT_DIPSETTING( 0x40, "600" ) + PORT_DIPSETTING( 0xc0, "1200" ) + PORT_DIPSETTING( 0x20, "2400" ) + PORT_DIPSETTING( 0xa0, "4800" ) + PORT_DIPSETTING( 0x60, "9600" ) + PORT_DIPSETTING( 0xe0, "19200" ) + + PORT_START("CAPSSHIFT") // CAPS LOCK and SHIFT appear as the high 2 bits on all rows + PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_TOGGLE PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_START("COL0") + PORT_BIT(0x1f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) // row 0 bit 6 is always low, checked by keyboard test + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) // all rows have these bits left low to save a mask op later + PORT_START("COL1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Set Up") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF1/Hardcopy") PORT_CODE(KEYCODE_F1) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("No scroll") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF2/Locator") PORT_CODE(KEYCODE_F2) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF3/Text") PORT_CODE(KEYCODE_F3) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF4/Reset") PORT_CODE(KEYCODE_F4) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COL9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLB") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLC") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLD") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLE") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line feed") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START("COLF") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x18, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + + +void vk100_state::machine_start() +{ + m_speaker->set_frequency(116); //116 hz (page 172 of TM), but duty cycle is wrong here! + output_set_value("online_led",1); + output_set_value("local_led", 0); + output_set_value("noscroll_led",1); + output_set_value("basic_led", 1); + output_set_value("hardcopy_led", 1); + output_set_value("l1_led", 1); + output_set_value("l2_led", 1); + m_vsync = 0; + m_dir_a6 = 1; + m_cout = 0; + m_vgX = 0; + m_vgY = 0; + m_vgERR = 0; + m_vgSOPS = 0; + m_vgPAT = 0; + m_vgPAT_Mask = 0x80; + m_vgPMUL = 0; + m_vgPMUL_Count = 0; + m_vgDownCount = 0; + VG_DU = 0; + VG_DVM = 0; + VG_DIR = 0; + VG_WOPS = 0; + m_VG_MODE = 0; + m_vgGO = 0; + m_ACTS = 1; + m_ADSR = 1; + char kbdcol[8]; + // look up all 16 tags 'the slow way' but only once on reset + for (int i = 0; i < 16; i++) + { + sprintf(kbdcol,"COL%X", i); + m_col_array[i] = ioport(kbdcol); + } +} + +WRITE_LINE_MEMBER(vk100_state::crtc_vsync) +{ + m_maincpu->set_input_line(I8085_RST75_LINE, state? ASSERT_LINE : CLEAR_LINE); + m_vsync = state; +} + +WRITE_LINE_MEMBER(vk100_state::i8251_rxrdy_int) +{ + m_maincpu->set_input_line(I8085_RST65_LINE, state?ASSERT_LINE:CLEAR_LINE); +} + +WRITE_LINE_MEMBER(vk100_state::i8251_txrdy_int) +{ + m_maincpu->set_input_line(I8085_RST55_LINE, state?ASSERT_LINE:CLEAR_LINE); +} + +WRITE_LINE_MEMBER(vk100_state::i8251_rts) +{ + logerror("callback: RTS state changed to %d\n", state); + // TODO: only change this during loopback mode! + m_ACTS = state; +} + +DRIVER_INIT_MEMBER(vk100_state,vk100) +{ + // figure out how the heck to initialize the timers here + //m_i8251_rx_timer = timer_alloc(TID_I8251_RX); + //m_i8251_tx_timer = timer_alloc(TID_I8251_TX); + //m_i8251_sync_timer = timer_alloc(TID_SYNC); + //machine().scheduler().timer_set(attotime::from_hz(10000), FUNC(i8251_rx_clk)); +} + +void vk100_state::video_start() +{ + m_vram = memregion("vram")->base(); + m_trans = memregion("trans")->base(); + m_pattern = memregion("pattern")->base(); + m_dir = memregion("dir")->base(); + m_sync = memregion("sync")->base(); + m_vector = memregion("vector")->base(); + m_ras_erase = memregion("ras_erase")->base(); +} + +MC6845_UPDATE_ROW( vk100_state::crtc_update_row ) +{ + static const UINT32 colorTable[16] = { + 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF, + 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF }; + static const UINT32 colorTable2[16] = { + 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 }; + //printf("y=%d, ma=%04x, ra=%02x, x_count=%02x ", y, ma, ra, x_count); + /* figure out ram address based on tech manual page 5-23: + * real address to 16-bit chunk a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 + * crtc input MA11 MA10 MA9 MA8 MA7 MA6 RA1 RA0 MA5 MA4 MA3 MA2 MA1 MA0 + */ + UINT16 EA = ((ma&0xfc0)<<2)|((ra&0x3)<<6)|(ma&0x3F); + // display the 64 different 12-bit-wide chunks + for (int i = 0; i < 64; i++) + { + UINT16 block = m_vram[(EA<<1)+(2*i)+1] | (m_vram[(EA<<1)+(2*i)]<<8); + UINT32 fgColor = (m_vgSOPS&0x08)?colorTable[(block&0xF000)>>12]:colorTable2[(block&0xF000)>>12]; + UINT32 bgColor = (m_vgSOPS&0x08)?colorTable[(m_vgSOPS&0xF0)>>4]:colorTable2[(m_vgSOPS&0xF0)>>4]; + // display a 12-bit wide chunk + for (int j = 0; j < 12; j++) + { + bitmap.pix32(y, (12*i)+j) = (((block&(0x0001< timer0 = baud clock + timer1 = pitch (duty cycle output to modify RC) + timer2 = volume (duty cycle output to control trans. gate which does vol. control) + portb: pin 6 through pin 13 of parallel port + portc 0 = NC, 1 = GND, 2 = pin 5, 3 = /RXINTEN, 4 = pin 15, 5 = pin 14 through inverter, 6 = 8910 enable, 7 = from pin 4 through inverter (I believe that's for the parallel port) + porta: pin 16 through 23 of parallel port + that's the 8255 + on the AY-3-8910: + IOA0-A5 = phoneme # + IOA6 = strobe (SC-01) + IOA7 = vochord control, 0 = off, 1 = on + IOB0-IOB7 = dip switches + there ya go, complete IO port map + cool :) + I pinned the IO to the serial port from the 8251 but I don't think it's too useful + eh, its useful + I drew out the schematic for the analog section + oh that will be useful + but I didn't draw out the digital part, just made an I/O and memory map but I can't find them + i also see the ay is running at 2 MHz + sounds about right + got it + I drew out the clocking section too + 8MHz xtal + 4MHz for the Z80 + 2MHz for the 8253 and '8910 + then the dividers also generate the system reset signals for the 8251 + and a periodic IRQ + on the z80? + ok how does that work? + IRQ rate is umm + 122Hz + (8MHz / 65536) + oh the 8251 is not reset by the counters + it just takes a positive reset off an inverter that resets the counters + PIT2 is gated by 8MHz / 256 + PIT1 is gated by 8MHz / 4096 + PIT0 is not gated + (i.e. it always runs) + oh boy, this is sounding more fun by the minute + aaand your luck is about to run out + that's all I got + thats good enough, saved me a lot of work + but that's everything you need + yeah + + +Things to be looked at: +- Serial doesn't work, so has been disabled. +- Bottom 3 dips must be off/serial/off, or else nothing works. +- No sound at all. +- volume and pitch should be controlled by ppi outputs +- pit to be hooked up +- bit 0 of portc is not connected according to text above, but it + completely changes the irq operation. + +******************************************************************************/ + +/* Core includes */ +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +//#include "votrpss.lh" + +/* Components */ +#include "sound/ay8910.h" +#include "sound/votrax.h" +#include "machine/clock.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/i8251.h" + +/* For testing */ +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class votrpss_state : public driver_device +{ +public: + votrpss_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_ppi(*this, "ppi"), + m_uart(*this, "uart") + { + } + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(ppi_pa_r); + DECLARE_READ8_MEMBER(ppi_pb_r); + DECLARE_READ8_MEMBER(ppi_pc_r); + DECLARE_WRITE8_MEMBER(ppi_pa_w); + DECLARE_WRITE8_MEMBER(ppi_pb_w); + DECLARE_WRITE8_MEMBER(ppi_pc_w); + TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); + DECLARE_WRITE_LINE_MEMBER(write_uart_clock); + IRQ_CALLBACK_MEMBER(irq_ack); +private: + UINT8 m_term_data; + UINT8 m_porta; + UINT8 m_portb; + UINT8 m_portc; + virtual void machine_start(); + required_device m_maincpu; + required_device m_terminal; + required_device m_ppi; + required_device m_uart; +}; + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(votrpss_mem, AS_PROGRAM, 8, votrpss_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROM /* main roms (in potted module) */ + AM_RANGE(0x4000, 0x7fff) AM_NOP /* open bus/space for expansion rom (reads as 0xFF) */ + AM_RANGE(0x8000, 0x8fff) AM_RAM /* onboard memory (2x 6116) */ + AM_RANGE(0x9000, 0xbfff) AM_NOP /* open bus (space for memory expansion, checked by main roms, will be used if found)*/ + AM_RANGE(0xc000, 0xdfff) AM_ROM /* 'personality rom', containing self-test code and optional user code */ + AM_RANGE(0xe000, 0xffff) AM_NOP /* open bus (space for more personality rom, not normally used) */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START(votrpss_io, AS_IO, 8, votrpss_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_MIRROR(0x3c) AM_DEVREADWRITE("ppi", i8255_device, read, write) + AM_RANGE(0x40, 0x40) AM_MIRROR(0x3e) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x41, 0x41) AM_MIRROR(0x3e) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE("pit", pit8253_device, read, write) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3e) AM_DEVREADWRITE("ay", ay8910_device, data_r, address_w) + AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x3e) AM_DEVREADWRITE("ay", ay8910_device, data_r, data_w) +ADDRESS_MAP_END + + +/****************************************************************************** + Input Ports +******************************************************************************/ + +static INPUT_PORTS_START(votrpss) + PORT_START("DSW1") + PORT_DIPNAME( 0x07, 0x00, "Baud Rate" ) PORT_DIPLOCATION("SW1:1,2,3") + PORT_DIPSETTING( 0x00, "9600" ) + PORT_DIPSETTING( 0x01, "4800" ) + PORT_DIPSETTING( 0x02, "2400" ) + PORT_DIPSETTING( 0x03, "1200" ) + PORT_DIPSETTING( 0x04, "600" ) + PORT_DIPSETTING( 0x05, "300" ) + PORT_DIPSETTING( 0x06, "150" ) + PORT_DIPSETTING( 0x07, "75" ) + PORT_DIPNAME( 0x08, 0x00, "Serial Handshaking" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x00, "RTS/CTS" ) + PORT_DIPSETTING( 0x08, "XON/XOFF" ) + PORT_DIPNAME( 0x10, 0x00, "Parity bit behavior" ) PORT_DIPLOCATION("SW1:5") /* note: only firmware 3.C (1984?) and up handle this bit; on earlier firmwares, its function is 'unused' */ + PORT_DIPSETTING( 0x00, "Bit 8 ignored/zeroed" ) + PORT_DIPSETTING( 0x10, "Bit 8 treated as data" ) + PORT_DIPNAME( 0x20, 0x20, "Startup Message" ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x00, DEF_STR ( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR ( On ) ) + PORT_DIPNAME( 0x40, 0x00, "Default Communications Port" ) PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x00, "Serial/RS-232" ) + PORT_DIPSETTING( 0x40, "Parallel" ) + PORT_DIPNAME( 0x80, 0x00, "Self Test Mode" ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x00, DEF_STR ( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR ( On ) ) +INPUT_PORTS_END + +void votrpss_state::machine_start() +{ +} + +TIMER_DEVICE_CALLBACK_MEMBER( votrpss_state::irq_timer ) +{ + m_maincpu->set_input_line(0, ASSERT_LINE); +} + +IRQ_CALLBACK_MEMBER( votrpss_state::irq_ack ) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); + return 0x38; +} + +READ8_MEMBER( votrpss_state::ppi_pa_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( votrpss_state::ppi_pb_r ) +{ + return m_portb; +} + +// Bit 0 controls what happens at interrupt time. See code around 518. +READ8_MEMBER( votrpss_state::ppi_pc_r ) +{ + UINT8 data = 0; + + if (m_term_data) + { + m_ppi->pc4_w(0); // send a strobe pulse + data |= 0x20; + } + + return (m_portc & 0xdb) | data; + //return data; +} + +WRITE8_MEMBER( votrpss_state::ppi_pa_w ) +{ + m_porta = data; +} + +WRITE8_MEMBER( votrpss_state::ppi_pb_w ) +{ + m_portb = data; + m_terminal->write(space, offset, data&0x7f); +} + +WRITE8_MEMBER( votrpss_state::ppi_pc_w ) +{ + m_portc = data; +} + +WRITE8_MEMBER( votrpss_state::kbd_put ) +{ + m_term_data = data; +} + +DECLARE_WRITE_LINE_MEMBER( votrpss_state::write_uart_clock ) +{ + m_uart->write_txc(state); + m_uart->write_rxc(state); +} + +/****************************************************************************** + Machine Drivers +******************************************************************************/ + +static MACHINE_CONFIG_START( votrpss, votrpss_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz/2) /* 4.000 MHz, verified */ + MCFG_CPU_PROGRAM_MAP(votrpss_mem) + MCFG_CPU_IO_MAP(votrpss_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(votrpss_state,irq_ack) + + /* video hardware */ + //MCFG_DEFAULT_LAYOUT(layout_votrpss) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("ay", AY8910, XTAL_8MHz/4) /* 2.000 MHz, verified */ + MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1")) // port B read + MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("votrax", votrax_sc01_device, write)) // port A write + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720 kHz? needs verify */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* Devices */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(votrpss_state, kbd_put)) + + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart", i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart", i8251_device, write_dsr)) + + MCFG_DEVICE_ADD("pit", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_8MHz) /* Timer 0: baud rate gen for 8251 */ + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(votrpss_state, write_uart_clock)) + MCFG_PIT8253_CLK1(XTAL_8MHz / 256) /* Timer 1: Pitch */ + MCFG_PIT8253_CLK2(XTAL_8MHz / 4096) /* Timer 2: Volume */ + + MCFG_DEVICE_ADD("ppi", I8255, 0) + MCFG_I8255_IN_PORTA_CB(READ8(votrpss_state, ppi_pa_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(votrpss_state, ppi_pa_w)) + MCFG_I8255_IN_PORTB_CB(READ8(votrpss_state, ppi_pb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(votrpss_state, ppi_pb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(votrpss_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(votrpss_state, ppi_pc_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", votrpss_state, irq_timer, attotime::from_msec(10)) +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START(votrpss) + ROM_REGION(0x10000, "maincpu", 0) + /* old logo PSS, version 3.A (1982), selftest 3.0? (1982) */ + //ROM_LOAD("u-2.3.A.bin", 0x0000, 0x2000, NO_DUMP )) /* 3.A 1982 */ + //ROM_LOAD("u-3.3.A.bin", 0x2000, 0x2000, NO_DUMP )) /* 3.A 1982 */ + //ROM_LOAD("u-4.3.0.bin", 0xc000, 0x2000, NO_DUMP )) /* 3.0? */ + + /* old logo PSS, version 3.B (late 82/early83), selftest 3.0? (1982) */ + //ROM_LOAD("u-2.3.B.bin", 0x0000, 0x2000, NO_DUMP )) /* 3.B 1983? */ + //ROM_LOAD("u-3.3.B.bin", 0x2000, 0x2000, NO_DUMP )) /* 3.B 1983? */ + //ROM_LOAD("u-4.3.0.bin", 0xc000, 0x2000, NO_DUMP )) /* 3.0? */ + + /* old or new logo PSS, Version 3.C (1984?), selftest 3.1 (1985?) */ + ROM_LOAD("u-2.1985.bin", 0x0000, 0x2000, CRC(410c58cf) SHA1(6e181e61ab9c268e3772fbeba101302fd40b09a2)) /* 3.C 1984?; The 1987/1988 version marked "U-2 // 090788" matches this rom */ + ROM_LOAD("u-3.1985.bin", 0x2000, 0x2000, CRC(1439492e) SHA1(46af8ccac6fdb93cbeb8a6d57dce5898e0e0d623)) /* 3.C 1984? */ + ROM_LOAD("u-4.100985.bin", 0xc000, 0x2000, CRC(0b7c4260) SHA1(56f0b6b1cd7b1104e09a9962583121c112337984)) /* 3.1 10/09/85 */ + +ROM_END + + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, votrpss, 0, 0, votrpss, votrpss, driver_device, 0, "Votrax", "Personal Speech System", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/votrtnt.c b/src/mame/drivers/votrtnt.c new file mode 100644 index 00000000000..65c1e79dddf --- /dev/null +++ b/src/mame/drivers/votrtnt.c @@ -0,0 +1,151 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/****************************************************************************** +* +* Votrax Type 'N Talk Driver +* By Jonathan Gevaryahu AKA Lord Nightmare +* with loads of help (dumping, code disassembly, schematics, and other +* documentation) from Kevin 'kevtris' Horton +* +* The Votrax TNT was sold from some time in early 1981 until at least 1983. +* +* 2011-02-27 The TNT communicates with its host via serial (RS-232) by +* using a 6850 ACIA. It will echo whatever is sent, back to the +* host. In order that we can examine it, I have connected the +* 'terminal' so we can enter data, and see what gets sent back. +* I've also connected the 'votrax' device, but it is far from +* complete (the sounds are not understandable). +* +* ACIA status code is set to E2 for no data and E3 for data. +* +* On the CPU, A12 and A15 are not connected. A13 and A14 are used +* to select devices. A0-A9 address RAM. A0-A11 address ROM. +* A0 switches the ACIA between status/command, and data in/out. +* +* Special codes: The Type 'N Talk will take notice of certain codes. They +* are: 08, 0D, 1B, 20. I didn't investigate what the codes do. +* +* ToDo: +* - Votrax device needs considerable improvement in sound quality. +* +* +******************************************************************************/ + +/* Core includes */ +#include "bus/rs232/rs232.h" +#include "cpu/m6800/m6800.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "sound/votrax.h" +#include "votrtnt.lh" + + +class votrtnt_state : public driver_device +{ +public: + votrtnt_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_votrax(*this, "votrax"), + m_acia(*this, "acia") + { + } + + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + +private: + required_device m_maincpu; + required_device m_votrax; + required_device m_acia; +}; + + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(6802_mem, AS_PROGRAM, 8, votrtnt_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0x6fff) + AM_RANGE(0x0000, 0x03ff) AM_RAM AM_MIRROR(0xc00)/* RAM, 2114*2 (0x400 bytes) mirrored 4x */ + AM_RANGE(0x2000, 0x2000) AM_MIRROR(0xffe) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) + AM_RANGE(0x2001, 0x2001) AM_MIRROR(0xffe) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) + AM_RANGE(0x4000, 0x5fff) AM_DEVWRITE("votrax", votrax_sc01_device, write) /* low 6 bits write to 6 bit input of sc-01-a; high 2 bits are ignored (but by adding a buffer chip could be made to control the inflection bits of the sc-01-a which are normally grounded on the tnt) */ + AM_RANGE(0x6000, 0x6fff) AM_ROM /* ROM in potted block */ +ADDRESS_MAP_END + + +/****************************************************************************** + Input Ports +******************************************************************************/ + +static INPUT_PORTS_START(votrtnt) + PORT_START("DSW1") /* not connected to cpu, each switch is connected directly to the output of a 4040 counter dividing the cpu m1? clock to feed the 6850 ACIA. Setting more than one switch on is a bad idea. see tnt_schematic.jpg */ + PORT_DIPNAME( 0xFF, 0x80, "Baud Rate" ) PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8") + PORT_DIPSETTING( 0x01, "75" ) + PORT_DIPSETTING( 0x02, "150" ) + PORT_DIPSETTING( 0x04, "300" ) + PORT_DIPSETTING( 0x08, "600" ) + PORT_DIPSETTING( 0x10, "1200" ) + PORT_DIPSETTING( 0x20, "2400" ) + PORT_DIPSETTING( 0x40, "4800" ) + PORT_DIPSETTING( 0x80, "9600" ) +INPUT_PORTS_END + + +WRITE_LINE_MEMBER(votrtnt_state::write_acia_clock) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + + +/****************************************************************************** + Machine Drivers +******************************************************************************/ + +static MACHINE_CONFIG_START( votrtnt, votrtnt_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M6802, XTAL_2_4576MHz) /* 2.4576MHz XTAL, verified; divided by 4 inside the m6802*/ + MCFG_CPU_PROGRAM_MAP(6802_mem) + + /* video hardware */ + //MCFG_DEFAULT_LAYOUT(layout_votrtnt) + + /* serial hardware */ + MCFG_DEVICE_ADD("acia", ACIA6850, 0) + MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) + + MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(votrtnt_state, write_acia_clock)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720kHz? needs verify */ + MCFG_VOTRAX_SC01_REQUEST_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START(votrtnt) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("cn49752n.bin", 0x6000, 0x1000, CRC(a44e1af3) SHA1(af83b9e84f44c126b24ee754a22e34ca992a8d3d)) /* 2332 mask rom inside potted brick */ +ROM_END + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, votrtnt, 0, 0, votrtnt, votrtnt, driver_device, 0, "Votrax", "Type 'N Talk", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/vt100.c b/src/mame/drivers/vt100.c new file mode 100644 index 00000000000..561de2441e0 --- /dev/null +++ b/src/mame/drivers/vt100.c @@ -0,0 +1,862 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu +/*************************************************************************** + + DEC VT100 driver by Miodrag Milanovic + + 29/04/2009 Preliminary driver. + + TODO: keyboard doesn't work properly, kb uart comms issue? + TODO: split keyboard off as a synchronous serial device? + TODO: vt100 gives a '2' error on startup indicating bad nvram checksum + adding the serial nvram support should fix this + TODO: support for the on-AVO character set roms + TODO: finish support for the on-cpu board alternate character set rom + + An enormous amount of useful info can be derived from the VT125 technical manual: + http://www.bitsavers.org/pdf/dec/terminal/vt100/EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf starting on page 6-70, pdf page 316 + And its schematics: + http://bitsavers.org/pdf/dec/terminal/vt125/MP01053_VT125_Mar82.pdf +****************************************************************************/ + +#include "bus/rs232/rs232.h" +#include "cpu/i8085/i8085.h" +#include "cpu/z80/z80.h" +#include "machine/com8116.h" +#include "machine/i8251.h" +#include "sound/beep.h" +#include "video/vtvideo.h" +#include "vt100.lh" + +#define RS232_TAG "rs232" +#define COM5016T_TAG "com5016t" + +class vt100_state : public driver_device +{ +public: + vt100_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "vt100_video"), + m_speaker(*this, "beeper"), + m_uart(*this, "i8251"), + m_dbrg(*this, COM5016T_TAG), + m_p_ram(*this, "p_ram") + { + } + + required_device m_maincpu; + required_device m_crtc; + required_device m_speaker; + required_device m_uart; + required_device m_dbrg; + DECLARE_READ8_MEMBER(vt100_flags_r); + DECLARE_WRITE8_MEMBER(vt100_keyboard_w); + DECLARE_READ8_MEMBER(vt100_keyboard_r); + DECLARE_WRITE8_MEMBER(vt100_baud_rate_w); + DECLARE_WRITE8_MEMBER(vt100_nvr_latch_w); + DECLARE_READ8_MEMBER(vt100_read_video_ram_r); + DECLARE_WRITE_LINE_MEMBER(vt100_clear_video_interrupt); + required_shared_ptr m_p_ram; + bool m_keyboard_int; + bool m_receiver_int; + bool m_vertical_int; + bool m_key_scan; + UINT8 m_key_code; + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update_vt100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vt100_vertical_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); + IRQ_CALLBACK_MEMBER(vt100_irq_callback); + UINT8 bit_sel(UINT8 data); +}; + + + + +static ADDRESS_MAP_START(vt100_mem, AS_PROGRAM, 8, vt100_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x1fff ) AM_ROM // ROM ( 4 * 2K) + AM_RANGE( 0x2000, 0x2bff ) AM_RAM AM_SHARE("p_ram") // Screen and scratch RAM + AM_RANGE( 0x2c00, 0x2fff ) AM_RAM // AVO Screen RAM + AM_RANGE( 0x3000, 0x3fff ) AM_RAM // AVO Attribute RAM (4 bits wide) + // 0x4000, 0x7fff is unassigned + AM_RANGE( 0x8000, 0x9fff ) AM_ROM // Program memory expansion ROM (4 * 2K) + AM_RANGE( 0xa000, 0xbfff ) AM_ROM // Program memory expansion ROM (1 * 8K) + // 0xc000, 0xffff is unassigned +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vt180_mem, AS_PROGRAM, 8, vt100_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x1fff ) AM_ROM + AM_RANGE( 0x2000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vt180_io, AS_IO, 8, vt100_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_END + +// 0 - XMIT flag H +// 1 - Advance Video L +// 2 - Graphics Flag L +// 3 - Option present H +// 4 - Even field L +// 5 - NVR data H +// 6 - LBA 7 H +// 7 - Keyboard TBMT H +READ8_MEMBER( vt100_state::vt100_flags_r ) +{ + UINT8 ret = 0; + ret |= m_crtc->lba7_r(space, 0) << 6; + ret |= m_keyboard_int << 7; + return ret; +} + +UINT8 vt100_state::bit_sel(UINT8 data) +{ + if (!BIT(data,7)) return 0x70; + if (!BIT(data,6)) return 0x60; + if (!BIT(data,5)) return 0x50; + if (!BIT(data,4)) return 0x40; + if (!BIT(data,3)) return 0x30; + if (!BIT(data,2)) return 0x20; + if (!BIT(data,1)) return 0x10; + if (!BIT(data,0)) return 0x00; + return 0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(vt100_state::keyboard_callback) +{ + UINT8 i, code; + char kbdrow[8]; + if (m_key_scan) + { + for(i = 0; i < 16; i++) + { + sprintf(kbdrow,"LINE%X", i); + code = ioport(kbdrow)->read(); + if (code < 0xff) + { + m_keyboard_int = 1; + m_key_code = i | bit_sel(code); + m_maincpu->set_input_line(0, HOLD_LINE); + break; + } + } + } +} + + +WRITE8_MEMBER( vt100_state::vt100_keyboard_w ) +{ + m_speaker->set_frequency(786); // 7.945us per serial clock = ~125865.324hz, / 160 clocks per char = ~ 786 hz + output_set_value("online_led",BIT(data, 5) ? 0 : 1); + output_set_value("local_led", BIT(data, 5)); + output_set_value("locked_led",BIT(data, 4) ? 0 : 1); + output_set_value("l1_led", BIT(data, 3) ? 0 : 1); + output_set_value("l2_led", BIT(data, 2) ? 0 : 1); + output_set_value("l3_led", BIT(data, 1) ? 0 : 1); + output_set_value("l4_led", BIT(data, 0) ? 0 : 1); + m_key_scan = BIT(data, 6); + m_speaker->set_state(BIT(data, 7)); +} + +READ8_MEMBER( vt100_state::vt100_keyboard_r ) +{ + return m_key_code; +} + +WRITE8_MEMBER( vt100_state::vt100_baud_rate_w ) +{ + m_dbrg->str_w(data & 0x0f); + m_dbrg->stt_w(data >> 4); +} + +WRITE8_MEMBER( vt100_state::vt100_nvr_latch_w ) +{ +} + +static ADDRESS_MAP_START(vt100_io, AS_IO, 8, vt100_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + // 0x00, 0x01 PUSART (Intel 8251) + AM_RANGE (0x00, 0x00) AM_DEVREADWRITE("i8251", i8251_device, data_r, data_w) + AM_RANGE (0x01, 0x01) AM_DEVREADWRITE("i8251", i8251_device, status_r, control_w) + // 0x02 Baud rate generator + AM_RANGE (0x02, 0x02) AM_WRITE(vt100_baud_rate_w) + // 0x22 Modem buffer + // AM_RANGE (0x22, 0x22) + // 0x42 Flags buffer + AM_RANGE (0x42, 0x42) AM_READ(vt100_flags_r) + // 0x42 Brightness D/A latch + AM_RANGE (0x42, 0x42) AM_DEVWRITE("vt100_video", vt100_video_device, brightness_w) + // 0x62 NVR latch + AM_RANGE (0x62, 0x62) AM_WRITE(vt100_nvr_latch_w) + // 0x82 Keyboard UART data output + AM_RANGE (0x82, 0x82) AM_READ(vt100_keyboard_r) + // 0x82 Keyboard UART data input + AM_RANGE (0x82, 0x82) AM_WRITE(vt100_keyboard_w) + // 0xA2 Video processor DC012 + AM_RANGE (0xa2, 0xa2) AM_DEVWRITE("vt100_video", vt100_video_device, dc012_w) + // 0xC2 Video processor DC011 + AM_RANGE (0xc2, 0xc2) AM_DEVWRITE("vt100_video", vt100_video_device, dc011_w) + // 0xE2 Graphics port + // AM_RANGE (0xe2, 0xe2) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vt100 ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_START("LINE4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Return") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line feed") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("LINE5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_START("LINE6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_START("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_START("LINE8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_START("LINE9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_START("LINEA") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("No scroll") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_START("LINEB") + PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Setup") PORT_CODE(KEYCODE_F5) + PORT_START("LINEC") + PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_START("LINED") + PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_START("LINEE") + PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_START("LINEF") + PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) // Always return 0x7f on last scan line +INPUT_PORTS_END + +UINT32 vt100_state::screen_update_vt100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_crtc->video_update(bitmap, cliprect); + return 0; +} + + +//Interrupts +// in latch A3 - keyboard +// A4 - receiver +// A5 - vertical fequency +// all other set to 1 +IRQ_CALLBACK_MEMBER(vt100_state::vt100_irq_callback) +{ + UINT8 ret = 0xc7 | (m_keyboard_int << 3) | (m_receiver_int << 4) | (m_vertical_int << 5); + m_receiver_int = 0; + return ret; +} + +void vt100_state::machine_start() +{ +} + +void vt100_state::machine_reset() +{ + m_keyboard_int = 0; + m_receiver_int = 0; + m_vertical_int = 0; + m_speaker->set_frequency(786); // 7.945us per serial clock = ~125865.324hz, / 160 clocks per char = ~ 786 hz + output_set_value("online_led",1); + output_set_value("local_led", 0); + output_set_value("locked_led",1); + output_set_value("l1_led", 1); + output_set_value("l2_led", 1); + output_set_value("l3_led", 1); + output_set_value("l4_led", 1); + + m_key_scan = 0; +} + +READ8_MEMBER( vt100_state::vt100_read_video_ram_r ) +{ + return m_p_ram[offset]; +} + +WRITE_LINE_MEMBER( vt100_state::vt100_clear_video_interrupt ) +{ + m_vertical_int = 0; +} + +INTERRUPT_GEN_MEMBER(vt100_state::vt100_vertical_interrupt) +{ + m_vertical_int = 1; + device.execute().set_input_line(0, HOLD_LINE); +} + +/* F4 Character Displayer */ +static const gfx_layout vt100_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 256, /* 2 x 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( vt100 ) + GFXDECODE_ENTRY( "chargen", 0x0000, vt100_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( vt100, vt100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_24_8832MHz / 9) + MCFG_CPU_PROGRAM_MAP(vt100_mem) + MCFG_CPU_IO_MAP(vt100_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", vt100_state, vt100_vertical_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vt100_state,vt100_irq_callback) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(80*10, 25*10) + MCFG_SCREEN_VISIBLE_AREA(0, 80*10-1, 0, 25*10-1) + MCFG_SCREEN_UPDATE_DRIVER(vt100_state, screen_update_vt100) + MCFG_SCREEN_PALETTE("vt100_video:palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "vt100_video:palette", vt100) +// MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_DEFAULT_LAYOUT( layout_vt100 ) + + MCFG_DEVICE_ADD("vt100_video", VT100_VIDEO, 0) + MCFG_VT_SET_SCREEN("screen") + MCFG_VT_CHARGEN("chargen") + MCFG_VT_VIDEO_RAM_CALLBACK(READ8(vt100_state, vt100_read_video_ram_r)) + MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(vt100_state, vt100_clear_video_interrupt)) + + MCFG_DEVICE_ADD("i8251", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_dsr)) + + MCFG_DEVICE_ADD(COM5016T_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxc)) + MCFG_COM8116_FT_HANDLER(DEVWRITELINE("i8251", i8251_device, write_txc)) + + /* audio hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", vt100_state, keyboard_callback, attotime::from_hz(800)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( vt180, vt100 ) + MCFG_CPU_ADD("z80cpu", Z80, XTAL_24_8832MHz / 9) + MCFG_CPU_PROGRAM_MAP(vt180_mem) + MCFG_CPU_IO_MAP(vt180_io) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( vt102, vt100 ) + MCFG_CPU_REPLACE("maincpu",I8085A, XTAL_24_8832MHz / 9) + MCFG_CPU_PROGRAM_MAP(vt100_mem) + MCFG_CPU_IO_MAP(vt100_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", vt100_state, vt100_vertical_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vt100_state,vt100_irq_callback) +MACHINE_CONFIG_END + +/* VT1xx models: + * VT100 - 1978 base model. the 'later' rom is from 1979 or 1980. + * The vt100 had a whole series of -XX models branching off of it; the + ones I know of are described here, as well as anything special about + them: + * VT100-AA - standard model with 120vac cable \__voltage can be switched + * VT100-AB - standard model with 240vac cable / inside any VT100 unit + * VT100-W* - word processing series: + * VT100-WA/WB - has special LA120 AVO board preinstalled, WP romset?, + English WP keyboard, no alt charset rom, LA120? 23-069E2 AVO rom. + (The WA and WB variants are called the '-02' variant on the schematics) + * VT100-WC through WZ: foreign language word processing series: + (The WC through WK variants are called the '-03' variant on the schematics) + * VT100-WC/WD - has AVO board preinstalled, WP romset?, French Canadian + WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. + * VT100-WE/WF - has AVO board preinstalled, WP romset?, French + WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. + * VT100-WG/WH - has AVO board preinstalled, WP romset?, Dutch + WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. + * VT100-WJ/WK - has AVO board preinstalled, WP romset?, German + WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. + * VT100-WY/WZ - has AVO board preinstalled, WP romset?, English + WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. + The WP romset supports English, French, Dutch and German languages but + will only display text properly in the non-English languages if the + 23-094E2 alt charset rom AND the foreign language 23-093E2 + AVO rom are populated. + * VT100-NA/NB - ? romset with DECFORM keycaps + * VT100 with vt1xx-ac kit - adds serial printer interface (STP) + pcb, replaces roms with the 095e2/096e2/139e2/140e2 STP set + * VT101 - 1981 cost reduced unexpandable vt100; Is the same as a stock + unexpanded vt100. It has no AVO nor the upgrade connector for it, and no + video input port.) Has its own firmware. + Shares same pcb with vt102 and vt131, but STP/AVO are unpopulated; + * VT102 - 1981 cost reduced unexpandable vt100 with built in AVO and STP + Is the same as a stock vt100 with the AVO and STP expansions installed, + but all on one pcb. Does NOT support the AVO extended character roms, nor + the word processing rom set. Has its own firmware. + Shares same pcb with vt101 and vt131, has STP and AVO populated. + * VT103 - 1980 base model vt100 with an integrated TU58 tape drive, and an + LSI-11 backplane, which an LSI-11 cpu card is used in, hence the computer + is effectively a tiny lsi-11 (pdp-11) built in a vt100 case. uses same roms + as vt100 for the vt100 portion, and tu58 has its own cpu and rom. It can + have the normal vt100 romset variant, and also can have the multiple word + processing variations (which use the same roms as the vt100 ones do). + * VT104 doesn't exist. + * VT105 - 1978 vt100 with the WG waveform generator board installed + (for simple chart-type line-compare-made raster graphics using some built + in functions), AVO optional; was intended for use on the MINC analog data + acquisition computer. + * VT110 - 1978 vt100 with a DPM01 DECDataway serial multiplexer installed + The DPM01 supposedly has its own processor and roms. + * vt125 - 1982? base model (stock vt100 firmware plus extra gfx board + firmware and processor) vt100 with the ReGIS graphical language board + (aka GPO) installed (almost literally a vk100-on-a-board, but with added + backwards compatibility mode for vt105/WG, and 2 bits per pixel color), + AVO optional; Includes a custom 'dumb' STP board. + * vt131 - 1982 cost reduced version of vt132, no longer has the vt100 + expansion backplane; has the AVO advanced video board built in, as well + as the parallel port interface board, and supports serial block mode. + Shares same pcb with vt101 and vt102, has STP and AVO populated. + * vt132 - 1980? base vt100 with AVO, STP, and its own 23-099e2/23-100e2 + AVO character rom set. Has its own base firmware roms which support block + serial mode. + * vt180 - 1980 vt10x (w/vt100 expansion backplane) with a z80 daughterboard + installed; + The daughterboard has two roms on it: 23-017e3-00 and 23-021e3-00 + (both are 0x1000 long, 2332 mask roms) + * vk100 'gigi'- graphical terminal; the vt125 GPO board is a very close derivative; + relatively little info so far but progress has been made. + see vk100.c for current driver for this + + * Upgrade kits for vt1xx: + * VT1xx-AA : p/n 5413206 20ma current loop interface pcb for vt100 + * VT1xx-AB : p/n 5413097 AVO board (AVO roms could be optionally ordered along with + this board if needed) + * VT1xx-AC : STP serial printer board (includes a special romset) + * VT1xx-CA : p/n 5413206? 20ma current loop interface pcb for vt101/vt102/vt131 + * VT1xx-CB or CL: GPO "ReGIS" board vt100->vt125 upgrade kit (p/n 5414275 paddle board and 5414277 gpo board) + * VT1xx-CE : DECWord Conversion kit + * VT1xx-FB : Anti-glare kit + + * Info about mask roms and other nasties: + * A normal 2716 rom has pin 18: /CE; pin 20: /OE; pin 21: VPP (acts as CE2) + * The vt100 23-031e2/23-061e2, 23-032e2, 23-033e2, and 23-034e2 mask roms + have the follwing enables: + 23-031e2/23-061e2: pin 18: CS2; pin 20: CS1; pin 21: CS3 + 23-032e2: pin 18: /CS2; pin 20: CS1; pin 21: CS3 + 23-033e2: pin 18: CS2; pin 20: CS1; pin 21: /CS3 + 23-034e2: pin 18: /CS2; pin 20: CS1; pin 21: /CS3 + (This is cute because it technically means the roms can be put in the + 4 sockets in ANY ORDER and will still work properly since the cs2 and + cs3 pins make them self-decode and activate at their proper address) + (This same cute trick is almost certainly also done with the + 23-180e2, 181e2, 182e2 183e2 romset, as well as the + 23-095e2,096e2,139e2,140e2 set and probably others as well) + * The vt100/101/102/103/etc 23-018e2-00 character set rom at location e4 is a 24 pin 2316 mask rom with enables as such: pin 18: CS2; pin 20: /CS1; pin 21: /CS3 + * The optional 23-094e2-00 alternate character set rom at location e9 is a 24 pin 2316 mask rom with enables as such: pin 18: /CS2; pin 20: /CS1; pin 21: /CS3 + Supposedly the 23-094e2 rom is meant for vt100-WC or -WF systems, (which are French Canadian and French respectively), implying that it has European language specific accented characters on it. It is probably used in all the -W* systems. + Pin 21 can be jumpered to +5v for this socket at location e9 by removing jumper w4 and inserting jumper w5, allowing a normal 2716 eprom to be used. + * The optional AVO character set roms (see below) have: pin 18: /CS2*; pin 20: /CS1; pin 21: CS3 hence they match a normal 2716 + *(this is marked on the image as if it was CS2 but the input is tied to gnd meaning it must be /CS2) + + * The AVO itself can hold up to four roms on it (see http://www.bitsavers.org/pdf/dec/terminal/vt100/MP00633_VT100_Mar80.pdf + and http://vt100.net/dec/ek-vt1ac-ug-002.pdf ) + and these roms can depending on jumpers be mapped at 0x8000, OR overlay the main code roms at 0x0000-0x1fff! + They may even allow banking between the main code roms and the overlay roms, I haven't traced the schematic. + At least sixteen of these AVO roms were made, and are used as such: + (based on EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf) + * No roms - normal vt100 system with AVO installed + * 23-069E2 (location e21) - meant for vt100-wa and -wb 'LA120' 'word processing' systems (the mapping of the rom for this system is different than for the ones below) + * 23-099E2 (location e21) and 23-100E2 (location e17) - meant for vt132 but only with the OLD vt132 main romset of 095,096,097,098E2 + * 23-093E2 (location e21) - meant for vt100 wc through wz 'foreign language' word processing systems + * 23-184E2 and 23-185E2 - meant for vt100 with STP printer option board installed, version 1, comes with vt1xx-ac kit + * 23-186E2 and 23-187E2 - meant for vt100 with STP printer option board installed, version 2, comes with vt1xx-ac kit + * 23-224E2, 23-225E2, 23-226E2, 23-227E2 - meant for vt132 but only with the NEW vt132 main romset of 180,181,182,183E2 + * 23-236E2, 23-237E2, 23-238E2, 23-239E2 - meant for vt132 but only with the NEW vt132 main romset of 180,181,182,183E2, unknown difference to above (PROM VS MASK ROM? same contents?) + */ + +/* ROM definition */ +ROM_START( vt100 ) // This is from the schematics at http://www.bitsavers.org/pdf/dec/terminal/vt100/MP00633_VT100_Mar80.pdf +// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated +// This romset is also used for the vt103, vt105, vt110, vt125, and vt180 + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS( "vt100" ) + ROM_SYSTEM_BIOS( 0, "vt100o", "VT100 older roms" ) + ROMX_LOAD( "23-031e2-00.e56", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(1)) // version 1 1978 'earlier rom', dump needed, correct for earlier vt100s + ROM_SYSTEM_BIOS( 1, "vt100", "VT100 newer roms" ) + ROMX_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15), ROM_BIOS(2)) // version 2 1979 or 1980 'later rom', correct for later vt100s + ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) + ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) + ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL("23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional ?word processing? alternate character set rom +ROM_END + +#if 0 +ROM_START( vt100wp ) // This is from the schematics at http://www.bitsavers.org/pdf/dec/terminal/vt100/MP00633_VT100_Mar80.pdf +// This is the standard vt100 cpu board, with the ?word processing? romset, included in the VT1xx-CE kit? +// the vt103 can also use this rom set (-04 and -05 revs have it by default, -05 rev also has the optional alt charset rom by default) +// NOTE: this is actually the same as the newer VT132 romset; vt132 has different AVO roms as well. + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-180e2-00.e56", 0x0000, 0x0800, NO_DUMP) + ROM_LOAD( "23-181e2-00.e52", 0x0800, 0x0800, NO_DUMP) + ROM_LOAD( "23-182e2-00.e45", 0x1000, 0x0800, NO_DUMP) + ROM_LOAD( "23-183e2-00.e40", 0x1800, 0x0800, NO_DUMP) + + ROM_REGION(0x1000, "avo", 0) + ROM_LOAD( "23-184e2-00.bin", 0x0000, 0x0800, NO_DUMP) + ROM_LOAD( "23-185e2-00.bin", 0x0800, 0x0800, NO_DUMP) + ROM_LOAD( "23-186e2-00.bin", 0x1000, 0x0800, NO_DUMP) + ROM_LOAD( "23-187e2-00.bin", 0x1800, 0x0800, NO_DUMP) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // REQUIRED foreign language alternate character set rom +ROM_END + +ROM_START( vt132 ) // This is from anecdotal evidence and vt100.net, as the vt132 schematics are not scanned +// but is pretty much confirmed by page 433 in http://bitsavers.trailing-edge.com/www.computer.museum.uq.edu.au/pdf/EK-VT100-TM-003%20VT100%20Series%20Video%20Terminal%20Technical%20Manual.pdf +// VT100 board with block serial roms, AVO with special roms, STP, custom firmware with block serial mode + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + // OLDER vt132 romset + ROM_LOAD( "23-095e2-00.e56", 0x0000, 0x0800, NO_DUMP) + ROM_LOAD( "23-096e2-00.e52", 0x0800, 0x0800, NO_DUMP) + ROM_LOAD( "23-097e2-00.e45", 0x1000, 0x0800, NO_DUMP) + ROM_LOAD( "23-098e2-00.e40", 0x1800, 0x0800, NO_DUMP) + + // NEWER vt132 (and STP?) romset + ROM_LOAD( "23-180e2-00.e56", 0x0000, 0x0800, NO_DUMP) + ROM_LOAD( "23-181e2-00.e52", 0x0800, 0x0800, NO_DUMP) + ROM_LOAD( "23-182e2-00.e45", 0x1000, 0x0800, NO_DUMP) + ROM_LOAD( "23-183e2-00.e40", 0x1800, 0x0800, NO_DUMP) + + // AVO roms for OLDER romset only + ROM_REGION(0x1000, "avo", 0) + ROM_LOAD( "23-099e2-00.e21", 0x0000, 0x0800, NO_DUMP) + ROM_LOAD( "23-100e2-00.e17", 0x0800, 0x0800, NO_DUMP) + // other 2 sockets are empty + + // AVO roms for NEWER romset only + ROM_LOAD( "23-224e2-00.e21", 0x0000, 0x0800, NO_DUMP) + ROM_LOAD( "23-225e2-00.e17", 0x0800, 0x0800, NO_DUMP) + ROM_LOAD( "23-226e2-00.e15", 0x1000, 0x0800, NO_DUMP) // loc is a guess + ROM_LOAD( "23-227e2-00.e13", 0x1800, 0x0800, NO_DUMP) // loc is a guess + // alt rev of newer avo roms, tech manual implies above are PROMS below are MASK ROMS? same data? + ROM_LOAD( "23-236e2-00.e21", 0x0000, 0x0800, NO_DUMP) + ROM_LOAD( "23-237e2-00.e17", 0x0800, 0x0800, NO_DUMP) + ROM_LOAD( "23-238e2-00.e15", 0x1000, 0x0800, NO_DUMP) // loc is a guess + ROM_LOAD( "23-239e2-00.e13", 0x1800, 0x0800, NO_DUMP) // loc is a guess + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom +ROM_END + +ROM_START( vt100stp ) // This is from the VT180 technical manual at http://www.bitsavers.org/pdf/dec/terminal/vt180/EK-VT18X-TM-001_VT180_Technical_Man_Feb83.pdf +// This is the standard vt100 cpu board, but with the rom set included with the VT1xx-AC kit +// which is only used when the part 54-14260-00 STP 'printer port expansion' card is installed into the terminal board. +// Or as http://bitsavers.trailing-edge.com/www.computer.museum.uq.edu.au/pdf/EK-VT100-TM-003%20VT100%20Series%20Video%20Terminal%20Technical%20Manual.pdf +// on page 433: VT100 WC or WK uses these as well. +// This romset adds the Set-up C page to the setup menu (press keypad 5 twice once you hit set-up) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-095e2-00.e56", 0x0000, 0x0800, NO_DUMP) + ROM_LOAD( "23-096e2-00.e52", 0x0800, 0x0800, NO_DUMP) + ROM_LOAD( "23-139e2-00.e45", 0x1000, 0x0800, NO_DUMP) // revision 2?; revision 1 is 23-097e2 + ROM_LOAD( "23-140e2-00.e40", 0x1800, 0x0800, NO_DUMP) // revision 2?; revision 1 is 23-098e2 + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional ?word processing? alternate character set rom + ROM_REGION(0x10000, "stpcpu",ROMREGION_ERASEFF) +// expansion board for a vt100 with a processor on it and dma, intended to act as a ram/send buffer for the STP printer board. +// It can be populated with two banks of two eproms each, each bank either contains 2k or 4k eproms depending on the w2/w3 and w4/w5 jumpers. +// It also has two proms on the cpu board. I don't know if it is technically necessary to have this board installed if an STP module is installed, but due to the alt stp romset, it probably is. + ROM_LOAD( "23-003e3-00.e10", 0x0000, 0x1000, NO_DUMP) // "EPROM 0" bank 0 + ROM_LOAD( "23-004e3-00.e4", 0x1000, 0x1000, NO_DUMP) // "EPROM 1" bank 0 + ROM_LOAD( "23-005e3-00.e9", 0x2000, 0x1000, NO_DUMP) // "EPROM 2" bank 1 + ROM_LOAD( "23-006e3-00.e3", 0x3000, 0x1000, NO_DUMP) // "EPROM 3" bank 1 + //ROM_REGION(0x0800, "avo",0) + //ROM_LOAD( "23-???e2-00.e34", 0x0000, 0x0800, NO_DUMP) // ? second gfx rom? + ROM_REGION(0x0400, "proms",0) + ROM_LOAD( "23-312a1-07.e26", 0x0000, 0x0200, NO_DUMP) // "PROM A"; handles 8085 i/o? mapping (usart, timer, dma, comm, etc) + ROM_LOAD( "23-313a1-07.e15", 0x0200, 0x0200, NO_DUMP) // "PROM B"; handles firmware rom mapping and memory size/page select; bit 0 = ram page, bits 1-3 unused, bits 4-7 select one eprom each +ROM_END + +ROM_START( vt103 ) // This is from the schematics at http://www.bitsavers.org/pdf/dec/terminal/vt103/MP00731_VT103_Aug80.pdf +// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with an +// LSI-11 backplane (instead of a normal VT100 one, hence it cannot use the AVO, WG, GPO, or VT180 Z80 boards) and +// DEC TU58 dual 256k tape drive integrated; It was intended that you would put an LSI-11 cpu card in there, which +// Would talk to the terminal as its input/output device. Several LSI-11 cpu cards were available? + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' + ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) + ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) + ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom + + ROM_REGION(0x0800, "tapecpu", 0) // rom for the 8085 cpu in the integrated serial tu58-xa drive + ROM_LOAD( "23-089e2.e1", 0x0000, 0x0800, CRC(8614dd4c) SHA1(1b554e6c98bddfc6bc48d81c990deea43cf9df7f)) // Label: "23-089E2 // P8316E - AMD // 35227 8008NPP" + + ROM_REGION(0x80000, "lsi11cpu", 0) // rom for the LSI-11 cpu board + ROM_LOAD_OPTIONAL( "unknown.bin", 0x00000, 0x80000, NO_DUMP) +ROM_END +#endif + +ROM_START( vt105 ) // This is from anecdotal evidence and vt100.net, as the vt105 schematics are not scanned +// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a +// WG waveform generator board factory installed; this makes the terminal act like a vt55 with vt100 terminal capability +// The VT105 was intended for use on the MINC analog data acquisition computer + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' + ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) + ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) + ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom +ROM_END + +#if 0 +ROM_START( vt110 ) +// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a +// DECDataway DPM01 board, which adds 4 or 5 special network-addressable 50ohm? current loop serial lines +// and may add its own processor and ram to control them. see http://bitsavers.org/pdf/dec/terminal/EK-VT110_UG-001_Dec78.pdf + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' + ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) + ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) + ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL ( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom +//DECDataway board roms go here! +ROM_END + +ROM_START( vt125 ) // This is from bitsavers and vt100.net, as the vt125 schematics are not scanned +// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a +// special "GPO" ReGIS cpu+ram card 54-14277 installed which provides a framebuffer, text rotation, custom ram fonts, and many other features. +// Comes with a custom 'dumb' STP card 54-14275 as well. +// VT125 upgrade kit (upgrade from vt100 or vt105) was called VT1xx-CB or CL + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' + ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) + ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) + ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL ( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom + + // "GPO" aka vt125 "mono board" roms and proms + ROM_REGION(0x10000, "monocpu", ROMREGION_ERASEFF) // roms for the 8085 subcpu + ROM_LOAD( "23-043e4-00.e22", 0x0000, 0x2000, NO_DUMP) // 2364/MK36xxx mask rom + ROM_LOAD( "23-044e4-00.e23", 0x2000, 0x2000, NO_DUMP) // 2364/MK36xxx mask rom + ROM_LOAD( "23-045e4-00.e24", 0x4000, 0x2000, NO_DUMP) // 2364/MK36xxx mask rom + // E25 socket is empty + + ROM_REGION(0x100, "dir", ROMREGION_ERASEFF ) // vt125 direction prom, same as on vk100, 82s135 equiv + ROM_LOAD( "23-059b1.e41", 0x0000, 0x0100, CRC(4b63857a) SHA1(3217247d983521f0b0499b5c4ef6b5de9844c465)) + + ROM_REGION(0x100, "trans", ROMREGION_ERASEFF ) // vt125 x translate prom, same as on vk100, 82s135 equiv + ROM_LOAD( "23-060b1.e60", 0x0000, 0x0100, CRC(198317fc) SHA1(00e97104952b3fbe03a4f18d800d608b837d10ae)) + + ROM_REGION(0x500, "proms", ROMREGION_ERASEFF) // vt125 mono board proms + ROM_LOAD( "23-067b1.e135", 0x0000, 0x0100, NO_DUMP) // 82s135, waitstate prom + ROM_LOAD( "23-068b1.e64", 0x0100, 0x0100, NO_DUMP) // 82s135, sync_a prom + ROM_LOAD( "23-069b1.e66", 0x0200, 0x0100, NO_DUMP) // 82s135, sync_b prom + ROM_LOAD( "23-070b1.e71", 0x0300, 0x0100, NO_DUMP) // 82s135, vector prom + ROM_LOAD( "23-582a2.e93", 0x0400, 0x0100, NO_DUMP) // 82s129, ras/erase prom +ROM_END +#endif + +ROM_START( vt101 ) // p/n 5414185-01 'unupgradable/low cost' vt101/vt102/vt131 mainboard +// does not have integrated STP or AVO populated +// 8085 based instead of I8080 + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-028e4-00.e71", 0x0000, 0x2000, CRC(fccce02c) SHA1(f3e3e93a857443685b816cab4fb52e34c0bc72b1)) // rom is unique to vt101; "CN55004N 8232 // DEC TP03 // 23-028E4-00" 24-pin mask rom (mc68764 pinout) + //e69 socket is empty/unpopulated on vt101? + //e67 socket is empty/unpopulated on vt101? + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e3", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL( "23-094e2-00.e4", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom +ROM_END + + +ROM_START( vt102 ) // p/n 5414185-01 'unupgradable/low cost' vt101/vt102/vt131 mainboard +// has integrated STP and AVO both populated +// ROMS have the set up page C in them +// 8085 based instead of I8080 + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS( "vt102" ) + ROM_SYSTEM_BIOS( 0, "vt102o", "VT102 older roms" ) + ROMX_LOAD( "23-042e4-00.e71", 0x0000, 0x2000, CRC(e8aa006c) SHA1(8ac2a84a8d2a9fa0c6cd583ae35e4c21f863b45b), ROM_BIOS(1)) // shared with vt131 + ROMX_LOAD( "23-041e4-00.e69", 0x8000, 0x2000, CRC(b11d331e) SHA1(8b0f885c7e032d1d709e3913d279d6950bbd4b6a), ROM_BIOS(1)) // shared with vt131 + ROM_SYSTEM_BIOS( 1, "vt102", "VT102 newer roms" ) + ROMX_LOAD( "23-226e4-00.e71", 0x0000, 0x2000, CRC(85c9279a) SHA1(3283d27e9c45d9e384227a7e6e98ee8d54b92bcb), ROM_BIOS(2)) // shared with vt131 + ROMX_LOAD( "23-225e4-00.e69", 0x8000, 0x2000, CRC(3567c760) SHA1(672473162e9c92cd237e4dbf92c2700a31c5374b), ROM_BIOS(2)) // shared with vt131 + //e67 socket is empty but populated on vt102 + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e3", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL( "23-094e2-00.e4", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom +ROM_END + +ROM_START( vt131 ) // p/n 5414185-01 'unupgradable/low cost' vt101/vt131 mainboard with vt132-style block serial mode +// has integrated STP and AVO both populated +// ROMS have the set up page C in them +// 8085 based instead of I8080 + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-226e4-00.e71", 0x0000, 0x2000, CRC(85c9279a) SHA1(3283d27e9c45d9e384227a7e6e98ee8d54b92bcb)) // shared with vt102 + ROM_LOAD( "23-225e4-00.e69", 0x8000, 0x2000, CRC(3567c760) SHA1(672473162e9c92cd237e4dbf92c2700a31c5374b)) // shared with vt102 + ROM_LOAD( "23-280e2-00.e67", 0xA000, 0x0800, CRC(71b4172e) SHA1(5a82c7dc313bb92b9829eb8350840e072825a797)) // called "VT131 ROM" in the vt101 quick reference guide; pins 20, 18 and 21 are /CE /CE2 and /CE3 on this mask rom + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e3", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL( "23-094e2-00.e4", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom +ROM_END + +ROM_START( vt180 ) +// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a +// Z80 daughterboard added to the expansion slot, and replacing the STP adapter (STP roms are replaced with the normal set) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' + ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) + ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) + ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) + + ROM_REGION(0x1000, "chargen", 0) + ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) + ROM_LOAD_OPTIONAL ( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom + + ROM_REGION(0x10000, "z80cpu", 0) // z80 daughterboard + ROM_LOAD( "23-021e3-00.bin", 0x0000, 0x1000, CRC(a2a575d2) SHA1(47a2c40aaec89e8476240f25515d75ab157f2911)) + ROM_LOAD( "23-017e3-00.bin", 0x1000, 0x1000, CRC(4bdd2398) SHA1(84f288def6c143a2d2ed9dedf947c862c66bb18e)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1978, vt100, 0, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT100",MACHINE_NOT_WORKING) +//COMP( 1978, vt100wp, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT100-Wx", MACHINE_NOT_WORKING) +//COMP( 1978, vt100stp, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT100 w/VT1xx-AC STP", MACHINE_NOT_WORKING) +COMP( 1981, vt101, vt102, 0, vt102, vt100, driver_device, 0, "Digital Equipment Corporation", "VT101", MACHINE_NOT_WORKING) +COMP( 1981, vt102, 0, 0, vt102, vt100, driver_device, 0, "Digital Equipment Corporation", "VT102", MACHINE_NOT_WORKING) +//COMP( 1979, vt103, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT103", MACHINE_NOT_WORKING) +COMP( 1978, vt105, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT105", MACHINE_NOT_WORKING) +//COMP( 1978, vt110, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT110", MACHINE_NOT_WORKING) +//COMP( 1981, vt125, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT125", MACHINE_NOT_WORKING) +COMP( 1981, vt131, vt102, 0, vt102, vt100, driver_device, 0, "Digital Equipment Corporation", "VT131", MACHINE_NOT_WORKING) +//COMP( 1979, vt132, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT132", MACHINE_NOT_WORKING) +COMP( 1983, vt180, vt100, 0, vt180, vt100, driver_device, 0, "Digital Equipment Corporation", "VT180", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/vt220.c b/src/mame/drivers/vt220.c new file mode 100644 index 00000000000..88984bf90f7 --- /dev/null +++ b/src/mame/drivers/vt220.c @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu +/*************************************************************************** + + DEC VT220 + + 30/06/2009 Skeleton driver. + + Schematics at www.bitsavers.org/pdf/dec/terminal/vt220/VT220_Schematic_Aug83.pdf + There is an X2212 NVRAM at E17 which needs hookup + +****************************************************************************/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "machine/ram.h" + + +class vt220_state : public driver_device +{ +public: + vt220_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG) { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_vt220(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + required_device m_ram; +}; + + +static ADDRESS_MAP_START(vt220_mem, AS_PROGRAM, 8, vt220_state) + AM_RANGE(0x0000, 0x7fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vt220_io, AS_IO, 8, vt220_state) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vt220 ) +INPUT_PORTS_END + +void vt220_state::machine_reset() +{ + memset(m_ram->pointer(),0,16*1024); +} + +void vt220_state::video_start() +{ +} + +UINT32 vt220_state::screen_update_vt220(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +static MACHINE_CONFIG_START( vt220, vt220_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8051, XTAL_11_0592MHz) // from schematic + MCFG_CPU_PROGRAM_MAP(vt220_mem) + MCFG_CPU_IO_MAP(vt220_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(vt220_state, screen_update_vt220) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( vt220 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS( "vt220" ) + ROM_SYSTEM_BIOS( 0, "vt220o", "VT220 from schematics" ) + ROMX_LOAD( "23-012e5.e3", 0x0000, 0x4000, NO_DUMP, ROM_BIOS(1)) // location e3 with jumper w7 present and w6 cut; the 8051 maps on top(?) of the first 0x1000 bytes of this rom, though this rom does seem to contain code there. + ROMX_LOAD( "23-012e5.e3", 0x4000, 0x4000, NO_DUMP, ROM_BIOS(1)) // the rom also maps to 4000-7fff as a14 is unconnected (do we have a ROMX_RELOAD I could use here instead of this?) + ROMX_LOAD( "23-248e4.e4", 0x8000, 0x2000, NO_DUMP, ROM_BIOS(1)) + // a000-bfff may be open bus or may be a mirror of above depending on whether the rom uses PGM/A13 as a secondary enable or not + ROMX_LOAD( "23-248e4.e4", 0xc000, 0x2000, NO_DUMP, ROM_BIOS(1)) + // e000-ffff may be open bus or may be a mirror of above depending on whether the rom uses PGM/A13 as a secondary enable or not + ROMX_LOAD( "23-011m1.e1", 0x0000, 0x1000, CRC(6c4930a9) SHA1(1200a5dbf431017a11a51b5c4c9b4e7952b0a2bb), ROM_BIOS(1)) // 8051 internal code, maps on top of the e3 rom at 0000-1000 + ROM_SYSTEM_BIOS( 1, "vt220v21", "VT220 Version 2.1" ) + ROMX_LOAD( "23-183e5.e3", 0x0000, 0x4000, CRC(2848db40) SHA1(b3b029ef964c86ede68ad1b2854cfad766f20af0), ROM_BIOS(2)) // location e3 with jumper w7 present and w6 cut; the 8051 maps on top(?) of the first 0x1000 bytes of this rom, though this rom does seem to contain code there. + ROMX_LOAD( "23-183e5.e3", 0x4000, 0x4000, CRC(2848db40) SHA1(b3b029ef964c86ede68ad1b2854cfad766f20af0), ROM_BIOS(2)) // the rom also maps to 4000-7fff as a14 is unconnected (do we have a ROMX_RELOAD I could use here instead of this?) + ROMX_LOAD( "23-182e5.e4", 0x8000, 0x4000, CRC(c759bf9f) SHA1(6fe21e8eb9576fbcda76d7909b07859db0793c4e), ROM_BIOS(2)) + ROMX_LOAD( "23-182e5.e4", 0xc000, 0x4000, CRC(c759bf9f) SHA1(6fe21e8eb9576fbcda76d7909b07859db0793c4e), ROM_BIOS(2)) // again a14 is unconnected here, so it maps at c000-ffff as well (do we have a ROMX_RELOAD I could use here instead of this?) + ROMX_LOAD( "23-011m1.e1", 0x0000, 0x1000, CRC(6c4930a9) SHA1(1200a5dbf431017a11a51b5c4c9b4e7952b0a2bb), ROM_BIOS(2)) // 8051 internal code, maps on top of the e3 rom at 0000-1000 + ROM_SYSTEM_BIOS( 2, "vt220", "VT220 Version 2.3" ) + ROMX_LOAD( "23-178e6.bin", 0x0000, 0x8000, CRC(cce5088c) SHA1(4638304729d1213658a96bb22c5211322b74d8fc), ROM_BIOS(3)) // probably location e3 with jumper w7 cut and w6 present, hence a14 connects to this rom. socket e4 would be empty so 8000-ffff is open bus + + ROM_REGION( 0x4000, "chargen", ROMREGION_ERASEFF ) + ROM_LOAD( "23-247e4.e13", 0x0000, 0x2000, NO_DUMP) // this is listed in the schematics + ROM_LOAD( "23-348e4.e13", 0x0000, 0x2000, CRC(994f3e37) SHA1(fe72a9fe9adb3a24743a6288d88ae07570cfea9a)) // this can maybe be read as well as a read/writable ram for custom characters which lives ?above? it in chargen address space by setting a bit in a config register. I haven't figured out where in 8051 address space it appears when readable nor where the ram appears. +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, vt220, 0, 0, vt220, vt220, driver_device, 0, "Digital Equipment Corporation", "VT220", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/vt240.c b/src/mame/drivers/vt240.c new file mode 100644 index 00000000000..80acf4e14ab --- /dev/null +++ b/src/mame/drivers/vt240.c @@ -0,0 +1,331 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu +/*************************************************************************** + + DEC VT240 + + 31/03/2010 Skeleton driver. + + TODO: + - understand how PCG works, it should be a funky i/o $30 to uPD7220 DMA + transfer; + - hook-up T11, rst65 irq + $20 reads are latches for that + + ROM POST notes: + 0x0139: ROM test + 0x015f: RAM test + 0x0071: RAM fill to 0x00 + 0x1c8f: UPD7220 + + // vt240: x2212 nvram at E56 +****************************************************************************/ + +#include "emu.h" + +#include "bus/rs232/rs232.h" +#include "cpu/i8085/i8085.h" +#include "cpu/t11/t11.h" +#include "machine/clock.h" +#include "machine/dec_lk201.h" +#include "machine/i8251.h" +#include "machine/mc68681.h" +#include "machine/ms7004.h" +#include "machine/ram.h" +#include "video/upd7220.h" + +#define VERBOSE_DBG 1 /* general debug messages */ + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \ + logerror A; \ + } \ + } while (0) + +class vt240_state : public driver_device +{ +public: + vt240_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_i8251(*this, "i8251"), + m_duart(*this, "duart"), + m_hgdc(*this, "upd7220"), + m_video_ram(*this, "video_ram"){ } + + required_device m_maincpu; + + required_device m_i8251; + DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); + + required_device m_duart; + + required_device m_hgdc; + DECLARE_READ8_MEMBER( test_r ); + DECLARE_READ8_MEMBER( pcg_r ); + DECLARE_WRITE8_MEMBER( pcg_w ); + + //UINT16 m_pcg_addr; + //UINT8 m_pcg_internal_addr; + //UINT8 *m_char_rom; + + required_shared_ptr m_video_ram; + + DECLARE_DRIVER_INIT(vt240); + virtual void machine_reset(); + INTERRUPT_GEN_MEMBER(vt240_irq); + UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); +}; + +WRITE_LINE_MEMBER(vt240_state::write_keyboard_clock) +{ + m_i8251->write_txc(state); + m_i8251->write_rxc(state); +} + +/* TODO */ +UPD7220_DRAW_TEXT_LINE_MEMBER( vt240_state::hgdc_draw_text ) +{ + //int x; + //int xi,yi; + //int tile,color; + //UINT8 tile_data; + + #if 0 + for( x = 0; x < pitch; x++ ) + { + tile = (vram[(addr+x)*2] & 0xff); + color = (vram[(addr+x)*2+1] & 0x0f); + + for( yi = 0; yi < lr; yi++) + { + tile_data = m_char_rom[(tile*8+yi) & 0x7ff]; + + if(cursor_on && cursor_addr == addr+x) //TODO + tile_data^=0xff; + + for( xi = 0; xi < 8; xi++) + { + int res_x,res_y; + int pen = (tile_data >> xi) & 1 ? color : 0; + + if(yi >= 8) { pen = 0; } + + res_x = x * 8 + xi; + res_y = y + yi; + + if(res_x > screen_max_x || res_y > screen_max_y) + continue; + + bitmap.pix16(res_y, res_x) = pen; + } + } + } + #endif +} + + +/* presumably communication with T11 */ +READ8_MEMBER( vt240_state::test_r ) +{ + //m_maincpu->set_input_line(I8085_RST65_LINE, CLEAR_LINE); + + return rand(); +} + + +// PDF page 78 (4-25) +static ADDRESS_MAP_START( vt240_mem, AS_PROGRAM, 16, vt240_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE (0000000, 0077777) AM_ROM + // 0170xxx MEM MAP/8085 decoder + AM_RANGE (0171000, 0171003) AM_DEVREADWRITE8("i8251", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE (0171004, 0171007) AM_DEVREADWRITE8("i8251", i8251_device, status_r, control_w, 0x00ff) + AM_RANGE (0172000, 0172077) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0xff) + // 0173000 Video logic + // 0174000 Video logic + // 017500x Video logic + // 0176xxx NVR + // 017700x System comm logic +ADDRESS_MAP_END + +// PDF page 134 (6-9) +#if 0 +static ADDRESS_MAP_START(vt240_char_mem, AS_PROGRAM, 8, vt240_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("charcpu", 0) + AM_RANGE(0x4000, 0x5fff) AM_ROM AM_REGION("charcpu", 0x8000) + AM_RANGE(0x8000, 0x87ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vt240_char_io, AS_IO, 8, vt240_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("upd7220", upd7220_device, read, write) + AM_RANGE(0x20, 0x20) AM_READ(test_r) + //AM_RANGE(0x30, 0x30) AM_READWRITE(pcg_r,pcg_w) // 0x30 PCG +ADDRESS_MAP_END +#endif + +static ADDRESS_MAP_START( upd7220_map, AS_0, 16, vt240_state) + AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vt240 ) +INPUT_PORTS_END + + +void vt240_state::machine_reset() +{ +} + +INTERRUPT_GEN_MEMBER(vt240_state::vt240_irq) +{ + //device.execute().set_input_line(I8085_RST65_LINE, ASSERT_LINE); +} + +static const gfx_layout vt240_chars_8x10 = +{ + 8,10, + RGN_FRAC(1,1), + 1, + { 0 }, + { STEP8(0,1) }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 8*10 +}; + +static GFXDECODE_START( vt240 ) + GFXDECODE_ENTRY( "charcpu", 0x338*10-2, vt240_chars_8x10, 0, 8 ) +GFXDECODE_END + +static MACHINE_CONFIG_FRAGMENT( vt240_motherboard ) + MCFG_CPU_ADD("maincpu", T11, XTAL_7_3728MHz) // confirm + MCFG_CPU_PROGRAM_MAP(vt240_mem) + MCFG_T11_INITIAL_MODE(5 << 13) + +/* + MCFG_CPU_ADD("charcpu", I8085A, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(vt240_char_mem) + MCFG_CPU_IO_MAP(vt240_char_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", vt240_state, vt240_irq) +*/ + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) +// MCFG_VIDEO_START_OVERRIDE(vt240_state,vt240) + MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_GFXDECODE_ADD("gfxdecode", "palette", vt240) + + MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4MHz / 4) + MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) + MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(vt240_state, hgdc_draw_text) + + MCFG_MC68681_ADD("duart", XTAL_3_6864MHz) /* 2681 duart (not 68681!) */ +// MCFG_MC68681_IRQ_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_irq_handler)) + MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) +// MCFG_MC68681_B_TX_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_txa)) +// MCFG_MC68681_INPORT_CALLBACK(READ8(dectalk_state, dectalk_duart_input)) +// MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(dectalk_state, dectalk_duart_output)) +// MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) +// MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) +// MCFG_RS232_DSR_HANDLER(DEVWRITELINE("duart", mc68681_device, ipX_w)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( mc7105, vt240_state ) + MCFG_FRAGMENT_ADD(vt240_motherboard) + + // serial connection to MS7004 keyboard + MCFG_DEVICE_ADD("i8251", I8251, 0) +// MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) + + MCFG_DEVICE_ADD("ms7004", MS7004, 0) + MCFG_MS7004_TX_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd)) + + // baud rate is supposed to be 4800 but keyboard is slightly faster + MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4960*16) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(vt240_state, write_keyboard_clock)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( mc7105 ) + ROM_REGION( 0x10000, "charcpu", ROMREGION_ERASEFF ) + ROM_LOAD( "027.bin", 0x8000, 0x8000, CRC(a159b412) SHA1(956097ccc2652d494258b3682498cfd3096d7d4f)) + ROM_LOAD( "028.bin", 0x0000, 0x8000, CRC(b253151f) SHA1(22ffeef8eb5df3c38bfe91266f26d1e7822cdb53)) + + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "029.bin", 0x00000, 0x8000, CRC(4a6db217) SHA1(47637325609ea19ffab61fe31e2700d72fa50729)) + ROM_LOAD16_BYTE( "031.bin", 0x00001, 0x8000, CRC(47129579) SHA1(39de9e2e26f90c5da5e72a09ff361c1a94b9008a)) + ROM_LOAD16_BYTE( "030.bin", 0x10000, 0x8000, CRC(05fd7b75) SHA1(2ad8c14e76accfa1b9b8748c58e9ebbc28844a47)) + ROM_LOAD16_BYTE( "032.bin", 0x10001, 0x8000, CRC(e81d93c4) SHA1(982412a7a6e65d6f6b4f66bd093e54ee16f31384)) +ROM_END + +/* ROM definition */ +ROM_START( vt240 ) + ROM_REGION( 0x10000, "charcpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-008e6-00.e100", 0x0000, 0x8000, CRC(ebc8a2fe) SHA1(70838175f8302fdc0dee79b2403fa95e6d989206)) + + ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS( "vt240" ) + // according to the schematics an even older set exists, variation 'E1' with roms: + // e100/8085: 23-003e6 + // e20: 23-001e6 + // e22: 23-002e6 + // e19: 23-048e5 + // e21: 23-049e5 + // but according to the Field Change Order below, the initial release is V2.1, so the above must be a prototype. + // DOL for v2.1 to v2.2 change: http://web.archive.org/web/20060905145200/http://cmcnabb.cc.vt.edu/dec94mds/vt240dol.txt + ROM_SYSTEM_BIOS( 0, "vt240v21", "VT240 V2.1" ) // initial factory release, FCO says this was 8 Feburary 1985 + ROMX_LOAD( "23-006e6-00.e20", 0x00000, 0x8000, CRC(79c11d82) SHA1(5a6fe5b75b6504a161f2c9b148c0fe9f19770837), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "23-004e6-00.e22", 0x00001, 0x8000, CRC(eba10fef) SHA1(c0ee4d8e4eeb70066f03f3d17a7e2f2bd0b5f8ad), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "23-007e6-00.e19", 0x10000, 0x8000, CRC(d18a2ab8) SHA1(37f448a332fc50298007ed39c8bf1ab1eb6d4cae), ROM_SKIP(1) | ROM_BIOS(1)) + ROMX_LOAD( "23-005e6-00.e21", 0x10001, 0x8000, CRC(558d0285) SHA1(e96a49bf9d55d8ab879d9b39aa380368c5c9ade0), ROM_SKIP(1) | ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "vt240", "VT240 V2.2" ) // Revised version, December 1985 + ROMX_LOAD( "23-058e6.e20", 0x00000, 0x8000, CRC(d2a56b90) SHA1(39cbb26134d7d8ba308df3a93228918a5945b45f), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "23-056e6.e22", 0x00001, 0x8000, CRC(c46e13c3) SHA1(0f2801fa7483d1f97708143cd81ae0816bf9a435), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "23-059e6.e19", 0x10000, 0x8000, CRC(f8393346) SHA1(1e28daf1b7f2bdabc47ce2f6fa99ef038b275a29), ROM_SKIP(1) | ROM_BIOS(2)) + ROMX_LOAD( "23-057e6.e21", 0x10001, 0x8000, CRC(7ce9dce9) SHA1(5a105e5bdca13910b3b79cc23567ce2dc36b844d), ROM_SKIP(1) | ROM_BIOS(2)) + // E39, E85, E131 are empty. + + ROM_REGION( 0x1000, "proms", ROMREGION_ERASEFF ) + ROM_LOAD( "23-351a1.e149", 0x0000, 0x0020, NO_DUMP) // 82s123; DRAM RAS/CAS Timing PROM + ROM_LOAD( "23-352a1.e187", 0x0020, 0x0020, NO_DUMP) // 82s123; "CT0" Timing PROM + ROM_LOAD( "23-369a1.e53", 0x0040, 0x0020, NO_DUMP) // 82s123; ROM and RAM mapping PROM + ROM_LOAD( "23-370a1.e188", 0x0060, 0x0020, NO_DUMP) // 82s123; "CT1" Timing PROM + ROM_LOAD( "23-994a9.e74", 0x0100, 0x0200, NO_DUMP) // 82s131; T11 Interrupt Encoder PROM + + ROM_REGION( 0x1000, "pals", 0 ) + ROM_LOAD( "23-087j5.e182.e183.jed", 0x0000, 0x1000, NO_DUMP ) // PAL16L8ACN; "Logic Unit" Character Pattern Related +ROM_END + +/* Driver */ +DRIVER_INIT_MEMBER(vt240_state,vt240) +{ + UINT8 *ROM = memregion("charcpu")->base(); + + /* patch T11 check */ + ROM[0x09d] = 0x00; + ROM[0x09e] = 0x00; + ROM[0x09f] = 0x00; + + /* ROM checksum */ + ROM[0x15c] = 0x00; + ROM[0x15d] = 0x00; + ROM[0x15e] = 0x00; +} + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, vt240, 0, 0, mc7105, vt240, vt240_state, vt240, "Digital Equipment Corporation", "VT240", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +//COMP( 1983, vt241, 0, 0, vt220, vt220, driver_device, 0, "Digital Equipment Corporation", "VT241", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +// NOTE: the only difference between VT240 and VT241 is the latter comes with a VR241 Color monitor, while the former comes with a mono display; the ROMs and operation are identical. +COMP( 1983, mc7105, 0, 0, mc7105, vt240, vt240_state, vt240, "Elektronika", "MC7105", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/vt320.c b/src/mame/drivers/vt320.c new file mode 100644 index 00000000000..ee452a5852d --- /dev/null +++ b/src/mame/drivers/vt320.c @@ -0,0 +1,125 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu +/*************************************************************************** + + DEC VT320 + + 30/06/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "machine/ram.h" + + +class vt320_state : public driver_device +{ +public: + vt320_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG) { } + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_vt320(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + required_device m_ram; +}; + +/* + +Partlist : + +Siemens SAB8031A-16-P +ROMless version of the 8051 microcontroller, running at 16 MHz. +Motorola MC2681P +Dual Universal Asynchronous Receiver/Transmitter (DUART), 40-pin package. +Toshiba TC53512AP +ROM, 512K bits = 64K bytes. 28-pin package. +Toshiba TC5565APL-12, 2 off +Static RAM, 64K bit = 8K byte. +ST TDA1170N +Vertical deflection system IC. +UC 80343Q +20 pins. Unknown. +UC 80068Q +20 pins. Unknown. +Motorola SN74LS157NQST +16 pins. Quad 2-to-1 multiplexer. +Microchip ER5911 +8 pins. Serial EEPROM. 1K bits = 128 bytes. +Texas Inst. 749X 75146 +8 pins. Unknown. +Signetics? 74LS373N +8-bit D-type latch. This has eight inputs and eight outputs. +*/ +static ADDRESS_MAP_START(vt320_mem, AS_PROGRAM, 8, vt320_state) + AM_RANGE(0x0000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vt320_io, AS_IO, 8, vt320_state) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vt320 ) +INPUT_PORTS_END + +void vt320_state::machine_reset() +{ + memset(m_ram->pointer(),0,16*1024); +} + +void vt320_state::video_start() +{ +} + +UINT32 vt320_state::screen_update_vt320(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +static MACHINE_CONFIG_START( vt320, vt320_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I8051, XTAL_16MHz) + MCFG_CPU_PROGRAM_MAP(vt320_mem) + MCFG_CPU_IO_MAP(vt320_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(vt320_state, screen_update_vt320) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( vt320 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS( "vt320" ) + //DOL: http://web.archive.org/web/20060905115711/http://cmcnabb.cc.vt.edu/dec94mds/vt320dol.txt + ROM_SYSTEM_BIOS( 0, "vt320v11", "VT320 V1.1" ) + // 23-054E7 below can also appear (same contents?) as 23-048E7 which is a mask rom + ROMX_LOAD( "23-054e7.e9", 0x0000, 0x10000, CRC(be98f9a4) SHA1(b8044d42ffaadb734fbd047fbca9c8aadeb0bf6c), ROM_BIOS(1)) // EPROM + ROM_SYSTEM_BIOS( 1, "vt320", "VT320 V1.2" ) + ROMX_LOAD( "23-104e7.e9", 0x0000, 0x10000, CRC(5f419b5a) SHA1(dbc429b32d6baefd8a56862717d6e7fea1fb0c1c), ROM_BIOS(2)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, vt320, 0, 0, vt320, vt320, driver_device, 0, "Digital Equipment Corporation", "VT320", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +//COMP( 1989?, vt330, 0, 0, vt320, vt320, driver_device, 0, "Digital Equipment Corporation", "VT330", MACHINE_NOT_WORKING) +//COMP( 1989?, vt340, 0, 0, vt320, vt320, driver_device, 0, "Digital Equipment Corporation", "VT340", MACHINE_NOT_WORKING) +//COMP( 1990?, vt340p, 0, 0, vt320, vt320, driver_device, 0, "Digital Equipment Corporation", "VT340+", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/vt520.c b/src/mame/drivers/vt520.c new file mode 100644 index 00000000000..9f4b0216587 --- /dev/null +++ b/src/mame/drivers/vt520.c @@ -0,0 +1,111 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu +/*************************************************************************** + + DEC VT520 + + 02/07/2009 Skeleton driver. + +****************************************************************************/ + +#include "emu.h" +#include "machine/ram.h" +#include "cpu/mcs51/mcs51.h" + + +class vt520_state : public driver_device +{ +public: + vt520_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu") { } + + DECLARE_READ8_MEMBER(vt520_some_r); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_vt520(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + + +static ADDRESS_MAP_START(vt520_mem, AS_PROGRAM, 8, vt520_state) + AM_RANGE(0x0000, 0xffff) AM_RAMBANK("bank1") +ADDRESS_MAP_END + +/* + On the board there is TC160G41AF (1222) custom chip + doing probably all video/uart logic + there is 43.430MHz xtal near by +*/ + +READ8_MEMBER( vt520_state::vt520_some_r ) +{ + //bit 5 0 + //bit 6 1 + return 0x40; +} + +static ADDRESS_MAP_START(vt520_io, AS_IO, 8, vt520_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x7ffb, 0x7ffb) AM_READ(vt520_some_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vt520 ) +INPUT_PORTS_END + + +void vt520_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *rom = memregion("maincpu")->base(); + space.unmap_write(0x0000, 0xffff); + membank("bank1")->set_base(rom + 0x70000); +} + +void vt520_state::video_start() +{ +} + +UINT32 vt520_state::screen_update_vt520(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static MACHINE_CONFIG_START( vt520, vt520_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8032, XTAL_20MHz) + MCFG_CPU_PROGRAM_MAP(vt520_mem) + MCFG_CPU_IO_MAP(vt520_io) + + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(802, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 802-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(vt520_state, screen_update_vt520) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + // On the board there are two M5M44256BJ-7 chips + // Which are DRAM 256K x 4bit + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("256K") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( vt520 ) + ROM_REGION( 0x80000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "23-010ed-00.e20", 0x0000, 0x80000, CRC(2502cc22) SHA1(0437c3107412f69e09d050fef003f2a81d8a3163)) // "(C)DEC94 23-010ED-00 // 9739 D" dumped from a VT520-A4 model +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +//COMP( 1993, vt510, 0, 0, vt520, vt520, driver_device, 0, "Digital Equipment Corporation", "VT510", MACHINE_NOT_WORKING) +COMP( 1994, vt520, 0, 0, vt520, vt520, driver_device, 0, "Digital Equipment Corporation", "VT520", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +//COMP( 1994, vt525, 0, 0, vt520, vt520, driver_device, 0, "Digital Equipment Corporation", "VT525", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/vta2000.c b/src/mame/drivers/vta2000.c new file mode 100644 index 00000000000..4f64a6ab490 --- /dev/null +++ b/src/mame/drivers/vta2000.c @@ -0,0 +1,195 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + VTA-2000 Terminal + + board images : http://fotki.yandex.ru/users/lodedome/album/93699?p=0 + + BDP-15 board only + + 29/11/2010 Skeleton driver. + +Better known on the net as BTA2000-15m. +It is a green-screen terminal, using RS232, and supposedly VT100 compatible. +The top line is a status line. + +Note: port 0 bit 4 is NOT a speaker bit. See code at 027B. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" + + +class vta2000_state : public driver_device +{ +public: + vta2000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_p_videoram(*this, "videoram") + , m_maincpu(*this, "maincpu") + { } + + const UINT8 *m_p_chargen; + UINT32 screen_update_vta2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_shared_ptr m_p_videoram; + DECLARE_PALETTE_INIT(vta2000); +private: + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; +}; + +static ADDRESS_MAP_START(vta2000_mem, AS_PROGRAM, 8, vta2000_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x5fff ) AM_ROM AM_REGION("roms", 0) + AM_RANGE( 0x8000, 0xc7ff ) AM_RAM AM_SHARE("videoram") + AM_RANGE( 0xc800, 0xc8ff ) AM_ROM AM_REGION("roms", 0x5000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vta2000_io, AS_IO, 8, vta2000_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( vta2000 ) +INPUT_PORTS_END + + +void vta2000_state::machine_reset() +{ +} + +void vta2000_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 vta2000_state::screen_update_vta2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +/* Cursor is missing. */ +{ + static UINT8 framecnt=0; + UINT8 y,ra,gfx,attr,fg,bg; + UINT16 sy=0,ma=0,x,xx=0,chr; + + framecnt++; + + for (y = 0; y < 25; y++) + { + for (ra = 0; ra < 12; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + xx = ma << 1; + for (x = ma; x < ma + 80; x++) + { + chr = m_p_videoram[xx++]; + attr = m_p_videoram[xx++]; + + if ((chr & 0x60)==0x60) + chr+=256; + + gfx = m_p_chargen[(chr<<4) | ra ]; + bg = 0; + + /* Process attributes */ + if (BIT(attr, 4)) + { + gfx ^= 0xff; // reverse video + bg = 2; + } + if (BIT(attr, 0)) + fg = 2; // highlight + else + fg = 1; + if ((BIT(attr, 1)) && (BIT(framecnt, 5))) + gfx = 0; // blink + if ((BIT(attr, 5)) && (ra == 10)) + { + gfx = 0xff; // underline + fg = 2; + } + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7) ? fg : bg; + *p++ = BIT(gfx, 6) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 0) ? fg : bg; + } + } + if (y) + ma+=132; + else + ma+=80; + } + return 0; +} + + +/* F4 Character Displayer */ +static const gfx_layout vta2000_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 512, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( vta2000 ) + GFXDECODE_ENTRY( "chargen", 0x0000, vta2000_charlayout, 0, 1 ) +GFXDECODE_END + +PALETTE_INIT_MEMBER(vta2000_state, vta2000) +{ + palette.set_pen_color(0, rgb_t::black); // black + palette.set_pen_color(1, 0x00, 0xc0, 0x00); // green + palette.set_pen_color(2, 0x00, 0xff, 0x00); // highlight +} + +static MACHINE_CONFIG_START( vta2000, vta2000_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8080, XTAL_4MHz / 4) + MCFG_CPU_PROGRAM_MAP(vta2000_mem) + MCFG_CPU_IO_MAP(vta2000_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(80*8, 25*12) + MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*12-1) + MCFG_SCREEN_UPDATE_DRIVER(vta2000_state, screen_update_vta2000) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(vta2000_state, vta2000) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", vta2000) +MACHINE_CONFIG_END + + +/* ROM definition */ +ROM_START( vta2000 ) + ROM_REGION( 0x6000, "roms", 0 ) + ROM_LOAD( "bdp-15_11.rom", 0x4000, 0x2000, CRC(d4abe3e9) SHA1(ab1973306e263b0f66f2e1ede50cb5230f8d69d5) ) + ROM_LOAD( "bdp-15_12.rom", 0x2000, 0x2000, CRC(4a5fe332) SHA1(f1401c26687236184fec0558cc890e796d7d5c77) ) + ROM_LOAD( "bdp-15_13.rom", 0x0000, 0x2000, CRC(b6b89d90) SHA1(0356d7ba77013b8a79986689fb22ef4107ef885b) ) + + ROM_REGION(0x2000, "chargen", ROMREGION_INVERT ) + ROM_LOAD( "bdp-15_14.rom", 0x0000, 0x2000, CRC(a1dc4f8e) SHA1(873fd211f44713b713d73163de2d8b5db83d2143) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 19??, vta2000, 0, 0, vta2000, vta2000, driver_device, 0, "", "VTA-2000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/vtech1.c b/src/mame/drivers/vtech1.c new file mode 100644 index 00000000000..d75006d4318 --- /dev/null +++ b/src/mame/drivers/vtech1.c @@ -0,0 +1,558 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Dirk Best +/*************************************************************************** + + Video Technology Laser 110 + Video Technology Laser 200 + Salora Fellow + Texet TX-8000 (?) + Video Technology VZ-200 + Video Technology Laser 210 + Dick Smith Electronics VZ-200 + Video Technology Laser 310 + Dick Smith Electronics VZ-300 + +Thanks go to: + + - Guy Thomason + - Jason Oakley + - Bushy Maunder + - and anybody else on the vzemu list :) + - Davide Moretti for the detailed description of the colors + - Leslie Milburn + +Todo: + + - Figure out which machines were shipped with which ROM version + where not known (currently only a guess) + - Lightpen support + - Rewrite floppy + +***************************************************************************/ + +#include "emu.h" +#include "formats/imageutl.h" +#include "cpu/z80/z80.h" +#include "video/mc6847.h" +#include "bus/vtech/ioexp/ioexp.h" +#include "bus/vtech/memexp/memexp.h" +#include "sound/wave.h" +#include "sound/speaker.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "formats/vt_cas.h" + + +/*************************************************************************** + CONSTANTS & MACROS +***************************************************************************/ + +#define LOG_VTECH1_LATCH 0 + +#define VTECH1_CLK 3579500 +#define VZ300_XTAL1_CLK XTAL_17_73447MHz + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +class vtech1_state : public driver_device +{ +public: + vtech1_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_mc6847(*this, "mc6847"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_ioexp(*this, "io"), + m_memexp(*this, "mem") + { + } + + DECLARE_DRIVER_INIT(vtech1); + DECLARE_DRIVER_INIT(vtech1h); + + DECLARE_READ8_MEMBER(vtech1_lightpen_r); + DECLARE_READ8_MEMBER(vtech1_keyboard_r); + DECLARE_WRITE8_MEMBER(vtech1_latch_w); + + DECLARE_WRITE8_MEMBER(vtech1_video_bank_w); + DECLARE_READ8_MEMBER(mc6847_videoram_r); + + DECLARE_SNAPSHOT_LOAD_MEMBER( vtech1 ); + +private: + static const UINT8 VZ_BASIC = 0xf0; + static const UINT8 VZ_MCODE = 0xf1; + + required_shared_ptr m_videoram; + + required_device m_maincpu; + required_device m_mc6847; + required_device m_speaker; + required_device m_cassette; + required_device m_ioexp; + required_device m_memexp; +}; + + +/*************************************************************************** + SNAPSHOT LOADING +***************************************************************************/ + +SNAPSHOT_LOAD_MEMBER( vtech1_state, vtech1 ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 header[24]; + char pgmname[18]; + + // get the header + image.fread(&header, sizeof(header)); + + // get image name + for (int i = 0; i < 16; i++) + pgmname[i] = header[i+4]; + pgmname[16] = '\0'; + + // get start and end addresses + UINT16 start = pick_integer_le(header, 22, 2); + UINT16 end = start + snapshot_size - sizeof(header); + UINT16 size = end - start; + + // write it to ram + UINT8 *ptr = (UINT8 *)image.ptr() + sizeof(header); + + for (UINT16 addr = start; addr <= end; addr++, ptr++) + { + UINT8 to_write = *ptr; + space.write_byte(addr, to_write); + + // verify + if (space.read_byte(addr) != to_write) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Insufficient RAM to load snapshot"); + image.message("Insufficient RAM to load snapshot (%d bytes needed) [%s]", size, pgmname); + + return IMAGE_INIT_FAIL; + } + } + + // patch variables depending on snapshot type + switch (header[21]) + { + case VZ_BASIC: + space.write_byte(0x78a4, start % 256); /* start of basic program */ + space.write_byte(0x78a5, start / 256); + space.write_byte(0x78f9, end % 256); /* end of basic program */ + space.write_byte(0x78fa, end / 256); + space.write_byte(0x78fb, end % 256); /* start variable table */ + space.write_byte(0x78fc, end / 256); + space.write_byte(0x78fd, end % 256); /* start free mem, end variable table */ + space.write_byte(0x78fe, end / 256); + image.message(" %s (B)\nsize=%04X : start=%04X : end=%04X", pgmname, size, start, end); + break; + + case VZ_MCODE: + space.write_byte(0x788e, start % 256); /* usr subroutine address */ + space.write_byte(0x788f, start / 256); + image.message(" %s (M)\nsize=%04X : start=%04X : end=%04X", pgmname, size, start, end); + m_maincpu->set_pc(start); /* start program */ + break; + + default: + image.seterror(IMAGE_ERROR_UNSUPPORTED, "Snapshot format not supported."); + image.message("Snapshot format not supported."); + return IMAGE_INIT_FAIL; + } + + return IMAGE_INIT_PASS; +} + + +/*************************************************************************** + INPUTS +***************************************************************************/ + +READ8_MEMBER( vtech1_state::vtech1_lightpen_r ) +{ + logerror("vtech1_lightpen_r(%d)\n", offset); + return 0xff; +} + +READ8_MEMBER( vtech1_state::vtech1_keyboard_r ) +{ + UINT8 result = 0x3f; + + // bit 0 to 5, keyboard input + if (!BIT(offset, 0)) result &= ioport("keyboard_0")->read(); + if (!BIT(offset, 1)) result &= ioport("keyboard_1")->read(); + if (!BIT(offset, 2)) result &= ioport("keyboard_2")->read(); + if (!BIT(offset, 3)) result &= ioport("keyboard_3")->read(); + if (!BIT(offset, 4)) result &= ioport("keyboard_4")->read(); + if (!BIT(offset, 5)) result &= ioport("keyboard_5")->read(); + if (!BIT(offset, 6)) result &= ioport("keyboard_6")->read(); + if (!BIT(offset, 7)) result &= ioport("keyboard_7")->read(); + + // bit 6, cassette input + result |= ((m_cassette->input()) > 0 ? 1 : 0) << 6; + + // bit 7, field sync + result |= m_mc6847->fs_r() << 7; + + return result; +} + + +/*************************************************************************** + I/O LATCH +***************************************************************************/ + +WRITE8_MEMBER( vtech1_state::vtech1_latch_w ) +{ + if (LOG_VTECH1_LATCH) + logerror("vtech1_latch_w $%02X\n", data); + + // bit 1, SHRG mod (if installed) + if (m_videoram.bytes() == 0x2000) + { + m_mc6847->gm0_w(BIT(data, 1)); + m_mc6847->gm2_w(BIT(data, 1)); + } + + // bit 2, cassette out (actually bits 1 and 2 perform this function, so either can be used) + m_cassette->output( BIT(data, 2) ? -1.0 : +1.0); + + // bit 3 and 4, vdc mode control lines + m_mc6847->ag_w(BIT(data, 3)); + m_mc6847->css_w(BIT(data, 4)); + + // bit 0 and 5, speaker + m_speaker->level_w((BIT(data, 5) << 1) | BIT(data, 0)); +} + + +/*************************************************************************** + MEMORY BANKING +***************************************************************************/ + +WRITE8_MEMBER( vtech1_state::vtech1_video_bank_w ) +{ + membank("bank4")->set_entry(data & 0x03); +} + + +/*************************************************************************** + VIDEO EMULATION +***************************************************************************/ + +READ8_MEMBER( vtech1_state::mc6847_videoram_r ) +{ + if (offset == ~0) return 0xff; + + m_mc6847->inv_w(BIT(m_videoram[offset], 6)); + m_mc6847->as_w(BIT(m_videoram[offset], 7)); + + return m_videoram[offset]; +} + + +/*************************************************************************** + DRIVER INIT +***************************************************************************/ + +DRIVER_INIT_MEMBER( vtech1_state, vtech1 ) +{ + // setup expansion slots + m_ioexp->set_io_space(&m_maincpu->space(AS_IO)); + m_memexp->set_program_space(&m_maincpu->space(AS_PROGRAM)); + m_memexp->set_io_space(&m_maincpu->space(AS_IO)); +} + +DRIVER_INIT_MEMBER( vtech1_state, vtech1h ) +{ + DRIVER_INIT_CALL(vtech1); + + // the SHRG mod replaces the standard videoram chip with an 8k chip + m_videoram.allocate(0x2000); + + m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x7000, 0x77ff, "bank4"); + membank("bank4")->configure_entries(0, 4, m_videoram, 0x800); + membank("bank4")->set_entry(0); +} + + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ + +static ADDRESS_MAP_START( laser110_mem, AS_PROGRAM, 8, vtech1_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM // basic rom + AM_RANGE(0x6800, 0x6fff) AM_READWRITE(vtech1_keyboard_r, vtech1_latch_w) + AM_RANGE(0x7000, 0x77ff) AM_RAM AM_SHARE("videoram") // 6847 + AM_RANGE(0x7800, 0x7fff) AM_RAM // 2k user ram +ADDRESS_MAP_END + +static ADDRESS_MAP_START( laser210_mem, AS_PROGRAM, 8, vtech1_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM // basic rom + AM_RANGE(0x6800, 0x6fff) AM_READWRITE(vtech1_keyboard_r, vtech1_latch_w) + AM_RANGE(0x7000, 0x77ff) AM_RAM AM_SHARE("videoram") // 6847 + AM_RANGE(0x7800, 0x8fff) AM_RAM // 6k user ram +ADDRESS_MAP_END + +static ADDRESS_MAP_START( laser310_mem, AS_PROGRAM, 8, vtech1_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM // basic rom + AM_RANGE(0x6800, 0x6fff) AM_READWRITE(vtech1_keyboard_r, vtech1_latch_w) + AM_RANGE(0x7000, 0x77ff) AM_RAM AM_SHARE("videoram") // 6847 + AM_RANGE(0x7800, 0xb7ff) AM_RAM // 16k user ram +ADDRESS_MAP_END + +static ADDRESS_MAP_START( vtech1_io, AS_IO, 8, vtech1_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x40, 0x4f) AM_READ(vtech1_lightpen_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( vtech1_shrg_io, AS_IO, 8, vtech1_state ) + AM_IMPORT_FROM(vtech1_io) + AM_RANGE(0xd0, 0xdf) AM_WRITE(vtech1_video_bank_w) +ADDRESS_MAP_END + + +/*************************************************************************** + INPUT PORTS +***************************************************************************/ + +static INPUT_PORTS_START(vtech1) + PORT_START("keyboard_0") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R RETURN LEFT$") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q FOR CHR$") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E NEXT LEN(") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W TO VAL(") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T THEN MID$") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + + PORT_START("keyboard_1") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F GOSUB RND(") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A MODE( ASC(") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DIM RESTORE") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S STEP STR$(") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G GOTO STOP") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + + PORT_START("keyboard_2") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V LPRINT USR") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z PEEK( INP") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C CONT COPY") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X POKE OUT") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B LLIST SOUND") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + + PORT_START("keyboard_3") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ VERIFY ATN(") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! CSAVE SIN(") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # CRUN TAN(") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \" CLOAD COS(") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % LIST LOG(") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START("keyboard_4") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M \\ \xE2\x86\x90") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('\\') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE \xE2\x86\x93") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", < \xE2\x86\x92") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". > \xE2\x86\x91") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N ^ COLOR USING") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('^') + + PORT_START("keyboard_5") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ' END SGN(") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 @ DATA INT(") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 ( NEW SQR(") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- = [Break]") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ) READ ABS(") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 & RUN EXP(") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + + PORT_START("keyboard_6") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U IF INKEY$") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P ] PRINT NOT") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR(']') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I INPUT AND") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN [Function]") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O [ LET OR") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('[') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y ELSE RIGHT$(") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + + PORT_START("keyboard_7") + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J REM RESET") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; + [Rubout]") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K / TAB( POINT") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('/') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": * [Inverse]") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L ? [Insert]") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('?') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H CLS SET") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + + /* Enhanced options not available on real hardware */ + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") + PORT_CONFSETTING( 0x00, DEF_STR(No)) + PORT_CONFSETTING( 0x01, DEF_STR(Yes)) +// PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") +// PORT_CONFSETTING( 0x08, DEF_STR(On)) +// PORT_CONFSETTING( 0x00, DEF_STR(Off)) +INPUT_PORTS_END + + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static const INT16 speaker_levels[] = {-32768, 0, 32767, 0}; + +static MACHINE_CONFIG_START( laser110, vtech1_state ) + + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, VTECH1_CLK) /* 3.57950 MHz */ + MCFG_CPU_PROGRAM_MAP(laser110_mem) + MCFG_CPU_IO_MAP(vtech1_io) + + // video hardware + MCFG_SCREEN_MC6847_PAL_ADD("screen", "mc6847") + + MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT + MCFG_MC6847_INPUT_CALLBACK(READ8(vtech1_state, mc6847_videoram_r)) + MCFG_MC6847_BW(true) + MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM1) + // GM2 = GND, GM0 = GND, INTEXT = GND + // other lines not connected + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SPEAKER_LEVELS(4, speaker_levels) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + // peripheral and memory expansion slots + MCFG_IOEXP_SLOT_ADD("io") + MCFG_MEMEXP_SLOT_ADD("mem") + + // snapshot + MCFG_SNAPSHOT_ADD("snapshot", vtech1_state, vtech1, "vz", 1.5) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(vtech1_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + MCFG_CASSETTE_INTERFACE("vtech1_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list", "vz_cass") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( laser200, laser110 ) + MCFG_DEVICE_REMOVE("mc6847") + MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT + MCFG_MC6847_INPUT_CALLBACK(READ8(vtech1_state, mc6847_videoram_r)) + MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM1) + // GM2 = GND, GM0 = GND, INTEXT = GND + // other lines not connected +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( laser210, laser200 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(laser210_mem) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( laser310, laser200 ) + MCFG_CPU_REPLACE("maincpu", Z80, VZ300_XTAL1_CLK / 5) /* 3.546894 MHz */ + MCFG_CPU_PROGRAM_MAP(laser310_mem) + MCFG_CPU_IO_MAP(vtech1_io) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( laser310h, laser310 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(vtech1_shrg_io) + + MCFG_DEVICE_REMOVE("mc6847") + MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT + MCFG_MC6847_INPUT_CALLBACK(READ8(vtech1_state, mc6847_videoram_r)) + MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM1) + // INTEXT = GND + // other lines not connected +MACHINE_CONFIG_END + + +/*************************************************************************** + ROM DEFINITIONS +***************************************************************************/ + +ROM_START( laser110 ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_LOAD("vtechv12.u09", 0x0000, 0x2000, CRC(99412d43) SHA1(6aed8872a0818be8e1b08ecdfd92acbe57a3c96d)) + ROM_LOAD("vtechv12.u10", 0x2000, 0x2000, CRC(e4c24e8b) SHA1(9d8fb3d24f3d4175b485cf081a2d5b98158ab2fb)) +ROM_END + +// The VZ-200 sold in Germany and the Netherlands came with BASIC V1.1, which is currently not dumped. +ROM_START( vz200de ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_LOAD("vtechv11.u09", 0x0000, 0x2000, NO_DUMP) + ROM_LOAD("vtechv11.u10", 0x2000, 0x2000, NO_DUMP) +ROM_END + +#define rom_laser200 rom_laser110 +#define rom_fellow rom_laser110 + +// It's possible that the Texet TX-8000 came with BASIC V1.0, but this needs to be verified +#define rom_tx8000 rom_laser110 + +ROM_START( laser210 ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_LOAD("vtechv20.u09", 0x0000, 0x2000, CRC(cc854fe9) SHA1(6e66a309b8e6dc4f5b0b44e1ba5f680467353d66)) + ROM_LOAD("vtechv20.u10", 0x2000, 0x2000, CRC(7060f91a) SHA1(8f3c8f24f97ebb98f3c88d4e4ba1f91ffd563440)) +ROM_END + +ROM_START( vz200 ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "basic20", "BASIC V2.0") + ROMX_LOAD("vtechv20.u09", 0x0000, 0x2000, CRC(cc854fe9) SHA1(6e66a309b8e6dc4f5b0b44e1ba5f680467353d66), ROM_BIOS(1)) + ROMX_LOAD("vtechv20.u10", 0x2000, 0x2000, CRC(7060f91a) SHA1(8f3c8f24f97ebb98f3c88d4e4ba1f91ffd563440), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "enhanced", "VZ-200 Enhanced BASIC V1.01") + ROMX_LOAD("vz200_v101.u9", 0x0000, 0x2000, CRC(70340b97) SHA1(eb3f3c8cf0cfa7acd646e89a90a3edf9e556cab6), ROM_BIOS(2)) + ROMX_LOAD("vtechv20.u10", 0x2000, 0x2000, CRC(7060f91a) SHA1(8f3c8f24f97ebb98f3c88d4e4ba1f91ffd563440), ROM_BIOS(2)) +ROM_END + +ROM_START( laser310 ) + ROM_REGION(0x4000, "maincpu", 0) + ROM_SYSTEM_BIOS(0, "basic20", "BASIC V2.0") + ROMX_LOAD("vtechv20.u12", 0x0000, 0x4000, CRC(613de12c) SHA1(f216c266bc09b0dbdbad720796e5ea9bc7d91e53), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(1, "basic21", "BASIC V2.1 (hack)") + ROMX_LOAD("vtechv21.u12", 0x0000, 0x4000, CRC(f7df980f) SHA1(5ba14a7a2eedca331b033901080fa5d205e245ea), ROM_BIOS(2)) +ROM_END + +#define rom_vz300 rom_laser310 +#define rom_laser310h rom_laser310 + + +/*************************************************************************** + GAME DRIVERS +***************************************************************************/ + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1983, laser110, 0, 0, laser110, vtech1, vtech1_state, vtech1, "Video Technology", "Laser 110", 0 ) +COMP( 1983, laser200, 0, 0, laser200, vtech1, vtech1_state, vtech1, "Video Technology", "Laser 200", 0 ) +COMP( 1983, vz200de, laser200, 0, laser200, vtech1, vtech1_state, vtech1, "Video Technology", "VZ-200 (Germany & Netherlands)", MACHINE_NOT_WORKING ) +COMP( 1983, fellow, laser200, 0, laser200, vtech1, vtech1_state, vtech1, "Salora", "Fellow (Finland)", 0 ) +COMP( 1983, tx8000, laser200, 0, laser200, vtech1, vtech1_state, vtech1, "Texet", "TX-8000 (UK)", 0 ) +COMP( 1984, laser210, 0, 0, laser210, vtech1, vtech1_state, vtech1, "Video Technology", "Laser 210", 0 ) +COMP( 1984, vz200, laser210, 0, laser210, vtech1, vtech1_state, vtech1, "Dick Smith Electronics", "VZ-200 (Oceania)", 0 ) +COMP( 1984, laser310, 0, 0, laser310, vtech1, vtech1_state, vtech1, "Video Technology", "Laser 310", 0 ) +COMP( 1984, vz300, laser310, 0, laser310, vtech1, vtech1_state, vtech1, "Dick Smith Electronics", "VZ-300 (Oceania)", 0 ) +COMP( 1984, laser310h, laser310, 0, laser310h, vtech1, vtech1_state, vtech1h, "Video Technology", "Laser 310 (SHRG)", MACHINE_UNOFFICIAL) diff --git a/src/mame/drivers/vtech2.c b/src/mame/drivers/vtech2.c new file mode 100644 index 00000000000..d5595320b72 --- /dev/null +++ b/src/mame/drivers/vtech2.c @@ -0,0 +1,506 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/*************************************************************************** + vtech2.c + + system driver + Juergen Buchmueller MESS driver, Jan 2000 + Davide Moretti ROM dump and hardware description + + LASER 350 (it has only 16K of RAM) + FFFF|-------| + | Empty | + | 5 | + C000|-------| + | RAM | + | 3 | + 8000|-------|-------|-------| + | ROM |Display| I/O | + | 1 | 3 | 2 | + 4000|-------|-------|-------| + | ROM | + | 0 | + 0000|-------| + + + Laser 500/700 with 64K of RAM and + Laser 350 with 64K RAM expansion module + FFFF|-------| + | RAM | + | 5 | + C000|-------| + | RAM | + | 4 | + 8000|-------|-------|-------| + | ROM |Display| I/O | + | 1 | 7 | 2 | + 4000|-------|-------|-------| + | ROM | + | 0 | + 0000|-------| + + + Bank "maincpu" Contents + 0 0x00000 - 0x03fff ROM 1st half + 1 0x04000 - 0x07fff ROM 2nd half + 2 n/a I/O 2KB area (mirrored 8 times?) + 3 0x0c000 - 0x0ffff Display RAM (16KB) present in Laser 350 only! + 4 0x10000 - 0x13fff RAM #4 + 5 0x14000 - 0x17fff RAM #5 + 6 0x18000 - 0x1bfff RAM #6 + 7 0x1c000 - 0x1ffff RAM #7 (Display RAM with 64KB) + 8 0x20000 - 0x23fff RAM #8 (Laser 700 or 128KB extension) + 9 0x24000 - 0x27fff RAM #9 + A 0x28000 - 0x2bfff RAM #A + B 0x2c000 - 0x2ffff RAM #B + C 0x30000 - 0x33fff ROM expansion + D 0x34000 - 0x34fff ROM expansion + E 0x38000 - 0x38fff ROM expansion + F 0x3c000 - 0x3ffff ROM expansion + + TODO: + Add ROMs and drivers for the Laser100, 110, + 210 and 310 machines and the Texet 8000. + They should probably go to the vtech1.c files, though. + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "includes/vtech2.h" +#include "imagedev/cassette.h" +#include "imagedev/flopdrv.h" +#include "formats/vt_cas.h" + +static ADDRESS_MAP_START(vtech2_mem, AS_PROGRAM, 8, vtech2_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") +ADDRESS_MAP_END + +static ADDRESS_MAP_START(vtech2_io, AS_IO, 8, vtech2_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x10, 0x1f) AM_READWRITE(laser_fdc_r, laser_fdc_w) + AM_RANGE(0x40, 0x43) AM_WRITE(laser_bank_select_w) + AM_RANGE(0x44, 0x44) AM_WRITE(laser_bg_mode_w) + AM_RANGE(0x45, 0x45) AM_WRITE(laser_two_color_w) +ADDRESS_MAP_END + +/* 2008-05 FP: +Small note about natural keyboard: currently, +- "Graph" is mapped to 'F11' +- "Del Line" is mapped to 'F12' +*/ +static INPUT_PORTS_START( laser500 ) + PORT_START("ROW0") /* KEY ROW 0 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("ROW1") /* KEY ROW 1 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + + PORT_START("ROW2") /* KEY ROW 2 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + + PORT_START("ROW3") /* KEY ROW 3 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + + PORT_START("ROW4") /* KEY ROW 4 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_START("ROW5") /* KEY ROW 5 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + + PORT_START("ROW6") /* KEY ROW 6 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START("ROW7") /* KEY ROW 7 */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("ROWA") /* KEY ROW A */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("ROWB") /* KEY ROW B */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("ROWC") /* KEY ROW C */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cap Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Line") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("ROWD") /* KEY ROW D */ + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mu \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\xA3') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) +INPUT_PORTS_END + +/* 2008-05 FP: I wasn't able to find a good picture of the laser 350 to verify the mapping of the emulated keyboard. +However, old-computers.com describes it as a laser 500/700 in a laser 300/310 case. The missing inputs seem to +confirm this. */ +static INPUT_PORTS_START( laser350 ) + PORT_INCLUDE( laser500 ) + + PORT_MODIFY("ROW2") /* KEY ROW 2 */ + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) /* TAB not on the Laser350 */ + + PORT_MODIFY("ROW3") /* KEY ROW 3 */ + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) /* ESC not on the Laser350 */ + + PORT_MODIFY("ROW5") /* KEY ROW 5 */ + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) /* BS not on the Laser350 */ + + PORT_MODIFY("ROW7") /* KEY ROW 7 */ + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) /* GRAPH not on the Laser350 */ + + PORT_MODIFY("ROWA") /* KEY ROW A */ + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) /* not on the Laser350 */ + + PORT_MODIFY("ROWB") /* KEY ROW B */ + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) /* not on the Laser350 */ + + PORT_MODIFY("ROWC") /* KEY ROW C */ + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) /* not on the Laser350 */ + + PORT_MODIFY("ROWD") /* KEY ROW D */ + PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) /* not on the Laser350 */ + + /* 2008-05 FP: This input_port seems never to be read. Is it a leftover of the old cassette code? */ + PORT_START("TAPE") /* Tape control */ + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Start") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Stop") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Rewind") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + + +static const gfx_layout charlayout_80 = +{ + 8,8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout charlayout_40 = +{ + 8*2,8, /* 8*2 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes; 1 bit per pixel */ + /* x offsets */ + { 0,0, 1,1, 2,2, 3,3, 4,4, 5,5, 6,6, 7,7 }, + /* y offsets */ + { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout gfxlayout_1bpp = +{ + 8,1, /* 8x1 pixels */ + 256, /* 256 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7,6,5,4,3,2,1,0 }, + /* y offsets */ + { 0 }, + 8 /* one byte per code */ +}; + +static const gfx_layout gfxlayout_1bpp_dw = +{ + 8*2,1, /* 8 times 2x1 pixels */ + 256, /* 256 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7,7,6,6,5,5,4,4,3,3,2,2,1,1,0,0 }, + /* y offsets */ + { 0 }, + 8 /* one byte per code */ +}; + +static const gfx_layout gfxlayout_1bpp_qw = +{ + 8*4,1, /* 8 times 4x1 pixels */ + 256, /* 256 codes */ + 1, /* 1 bit per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7,7,7,7,6,6,6,6,5,5,5,5,4,4,4,4,3,3,3,3,2,2,2,2,1,1,1,1,0,0,0,0 }, + /* y offsets */ + { 0 }, + 8 /* one byte per code */ +}; + +static const gfx_layout gfxlayout_4bpp = +{ + 2*4,1, /* 2 times 4x1 pixels */ + 256, /* 256 codes */ + 4, /* 4 bit per pixel */ + { 0,1,2,3 }, /* four bitplanes */ + /* x offsets */ + { 4,4,4,4, 0,0,0,0 }, + /* y offsets */ + { 0 }, + 2*4 /* one byte per code */ +}; + +static const gfx_layout gfxlayout_4bpp_dh = +{ + 2*4,2, /* 2 times 4x2 pixels */ + 256, /* 256 codes */ + 4, /* 4 bit per pixel */ + { 0,1,2,3 }, /* four bitplanes */ + /* x offsets */ + { 4,4,4,4, 0,0,0,0 }, + /* y offsets */ + { 0,0 }, + 2*4 /* one byte per code */ +}; + +static GFXDECODE_START( vtech2 ) + GFXDECODE_ENTRY( "gfx1", 0, charlayout_80, 0, 256 ) + GFXDECODE_ENTRY( "gfx1", 0, charlayout_40, 0, 256 ) + GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_1bpp, 0, 256 ) + GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_1bpp_dw, 0, 256 ) + GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_1bpp_qw, 0, 256 ) + GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_4bpp, 2*256, 1 ) + GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_4bpp_dh, 2*256, 1 ) +GFXDECODE_END + + +static const rgb_t vt_colors[] = +{ + rgb_t::black, + rgb_t(0x00, 0x00, 0x7f), /* blue */ + rgb_t(0x00, 0x7f, 0x00), /* green */ + rgb_t(0x00, 0x7f, 0x7f), /* cyan */ + rgb_t(0x7f, 0x00, 0x00), /* red */ + rgb_t(0x7f, 0x00, 0x7f), /* magenta */ + rgb_t(0x7f, 0x7f, 0x00), /* yellow */ + rgb_t(0xa0, 0xa0, 0xa0), /* bright grey */ + rgb_t(0x7f, 0x7f, 0x7f), /* dark grey */ + rgb_t(0x00, 0x00, 0xff), /* bright blue */ + rgb_t(0x00, 0xff, 0x00), /* bright green */ + rgb_t(0x00, 0xff, 0xff), /* bright cyan */ + rgb_t(0xff, 0x00, 0x00), /* bright red */ + rgb_t(0xff, 0x00, 0xff), /* bright magenta */ + rgb_t(0xff, 0xff, 0x00), /* bright yellow */ + rgb_t::white +}; + + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(vtech2_state, vtech2) +{ + int i; + + for ( i = 0; i < 16; i++ ) + palette.set_indirect_color(i, vt_colors[i]); + + for (i = 0; i < 256; i++) + { + palette.set_pen_indirect(2*i, i&15); + palette.set_pen_indirect(2*i+1, i>>4); + } + + for (i = 0; i < 16; i++) + palette.set_pen_indirect(512+i, i); +} + +INTERRUPT_GEN_MEMBER(vtech2_state::vtech2_interrupt) +{ + m_maincpu->set_input_line(0, HOLD_LINE); +} + +static const floppy_interface vtech2_floppy_interface = +{ + FLOPPY_STANDARD_5_25_SSDD_40, + LEGACY_FLOPPY_OPTIONS_NAME(default), + NULL +}; + +static MACHINE_CONFIG_START( laser350, vtech2_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, 3694700) /* 3.694700 MHz */ + MCFG_CPU_PROGRAM_MAP(vtech2_mem) + MCFG_CPU_IO_MAP(vtech2_io) + MCFG_CPU_VBLANK_INT_DRIVER("screen", vtech2_state, vtech2_interrupt) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_SCREEN_SIZE(88*8, 24*8+32) + MCFG_SCREEN_VISIBLE_AREA(0*8, 88*8-1, 0*8, 24*8+32-1) + MCFG_SCREEN_UPDATE_DRIVER(vtech2_state, screen_update_laser) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", vtech2 ) + MCFG_PALETTE_ADD("palette", 512+16) + MCFG_PALETTE_INDIRECT_ENTRIES(16) + MCFG_PALETTE_INIT_OWNER(vtech2_state, vtech2) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(vtech2_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vtech_cart") + MCFG_GENERIC_EXTENSIONS("rom,bin") + + /* 5.25" Floppy drive */ + MCFG_LEGACY_FLOPPY_DRIVE_ADD( FLOPPY_0, vtech2_floppy_interface ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( laser500, laser350 ) + MCFG_MACHINE_RESET_OVERRIDE(vtech2_state, laser500 ) +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( laser700, laser350 ) + MCFG_MACHINE_RESET_OVERRIDE(vtech2_state, laser700 ) + + /* Second 5.25" floppy drive */ + MCFG_LEGACY_FLOPPY_DRIVE_ADD( FLOPPY_1, vtech2_floppy_interface ) +MACHINE_CONFIG_END + + +ROM_START(laser350) + ROM_REGION(0x40000,"maincpu",0) + ROM_LOAD("laserv3.rom", 0x00000, 0x08000, CRC(9bed01f7) SHA1(3210fddfab2f4c7855fa902fb8e2fc18d10d48f1)) + ROM_REGION(0x00800,"gfx1",0) + ROM_LOAD("laser.fnt", 0x00000, 0x00800, CRC(ed6bfb2a) SHA1(95e247021a10167b9de1d6ffc91ec4ba83b0ec87)) + ROM_REGION(0x00100,"gfx2",ROMREGION_ERASEFF) + /* initialized in init_laser */ +ROM_END + + +ROM_START(laser500) // based on the picture at http://www.8bit-museum.de/hardware/laser500pcb-h.jpg +// There should be two roms, one 0x2000 long for the font at u10, and one longer one for the os rom at u6. + ROM_REGION(0x40000,"maincpu",0) + ROM_LOAD("27-0401-00-00.u6", 0x00000, 0x08000, CRC(9bed01f7) SHA1(3210fddfab2f4c7855fa902fb8e2fc18d10d48f1)) // may be dumped at wrong size; label is: "VTL 27-0401-00-00 // 6133-7081 // 8611MAK" + ROM_REGION(0x00800,"gfx1",0) + ROM_LOAD("27-393-00.u10", 0x00000, 0x00800, BAD_DUMP CRC(ed6bfb2a) SHA1(95e247021a10167b9de1d6ffc91ec4ba83b0ec87)) // dumped at wrong size; correct size is 0x2000; label is "TMS 2364-25NL // D8614L // ZA234015 // 27-393-00/VT 85 // SINGAPORE" + ROM_REGION(0x00100,"gfx2",ROMREGION_ERASEFF) + /* initialized in init_laser */ +ROM_END + +ROM_START(laser700) + ROM_REGION(0x40000,"maincpu",0) + ROM_LOAD("laserv3.rom", 0x00000, 0x08000, CRC(9bed01f7) SHA1(3210fddfab2f4c7855fa902fb8e2fc18d10d48f1)) + ROM_REGION(0x00800,"gfx1",0) + ROM_LOAD("laser.fnt", 0x00000, 0x00800, CRC(ed6bfb2a) SHA1(95e247021a10167b9de1d6ffc91ec4ba83b0ec87)) + ROM_REGION(0x00100,"gfx2",ROMREGION_ERASEFF) + /* initialized in init_laser */ +ROM_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1984?, laser350, 0, 0, laser350, laser350, vtech2_state, laser, "Video Technology", "Laser 350" , 0) +COMP( 1984?, laser500, laser350, 0, laser500, laser500, vtech2_state, laser, "Video Technology", "Laser 500" , 0) +COMP( 1984?, laser700, laser350, 0, laser700, laser500, vtech2_state, laser, "Video Technology", "Laser 700" , 0) diff --git a/src/mame/drivers/wangpc.c b/src/mame/drivers/wangpc.c new file mode 100644 index 00000000000..4ca371b4267 --- /dev/null +++ b/src/mame/drivers/wangpc.c @@ -0,0 +1,1194 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/* + + Wang Professional Computer + + http://www.seasip.info/VintagePC/wangpc.html + + chdman -createblankhd q540.chd 512 8 17 512 + +*/ + +/* + + TODO: + + - with quantum perfect cpu gets stuck @ 49c3 mov ss,cs:[52ah] + - hard disk + +*/ + +#include "includes/wangpc.h" +#include "bus/rs232/rs232.h" + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define LOG 0 + +enum +{ + LED_DIAGNOSTIC = 0 +}; + + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +void wangpc_state::select_drive() +{ + floppy_image_device *floppy = NULL; + + if (m_ds1) floppy = m_floppy0; + if (m_ds2) floppy = m_floppy1; + + m_fdc->set_floppy(floppy); +} + +WRITE8_MEMBER( wangpc_state::fdc_ctrl_w ) +{ + /* + + bit description + + 0 Enable /EOP + 1 Disable /DREQ2 + 2 Clear drive 1 door disturbed interrupt + 3 Clear drive 2 door disturbed interrupt + 4 + 5 + 6 + 7 + + */ + + m_enable_eop = BIT(data, 0); + m_disable_dreq2 = BIT(data, 1); + + if (BIT(data, 2)) m_fdc_dd0 = 0; + if (BIT(data, 3)) m_fdc_dd1 = 0; + + if (LOG) + { + logerror("%s: Enable /EOP %u\n", machine().describe_context(), m_enable_eop); + logerror("%s: Disable /DREQ2 %u\n", machine().describe_context(), m_disable_dreq2); + } + + update_fdc_tc(); + update_fdc_drq(); +} + + +READ8_MEMBER( wangpc_state::deselect_drive1_r ) +{ + m_ds1 = false; + select_drive(); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::deselect_drive1_w ) +{ + deselect_drive1_r(space, offset); +} + +READ8_MEMBER( wangpc_state::select_drive1_r ) +{ + m_ds1 = true; + select_drive(); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::select_drive1_w ) +{ + select_drive1_r(space, offset); +} + +READ8_MEMBER( wangpc_state::deselect_drive2_r ) +{ + m_ds2 = false; + select_drive(); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::deselect_drive2_w ) +{ + deselect_drive2_r(space, offset); +} + +READ8_MEMBER( wangpc_state::select_drive2_r ) +{ + m_ds2 = true; + select_drive(); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::select_drive2_w ) +{ + select_drive2_r(space, offset); +} + +READ8_MEMBER( wangpc_state::motor1_off_r ) +{ + if (LOG) logerror("%s: Drive 1 motor OFF\n", machine().describe_context()); + + m_floppy0->mon_w(1); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::motor1_off_w ) +{ + motor1_off_r(space, offset); +} + +READ8_MEMBER( wangpc_state::motor1_on_r ) +{ + if (LOG) logerror("%s: Drive 1 motor ON\n", machine().describe_context()); + + m_floppy0->mon_w(0); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::motor1_on_w ) +{ + motor1_on_r(space, offset); +} + +READ8_MEMBER( wangpc_state::motor2_off_r ) +{ + if (LOG) logerror("%s: Drive 2 motor OFF\n", machine().describe_context()); + + m_floppy1->mon_w(1); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::motor2_off_w ) +{ + motor2_off_r(space, offset); +} + +READ8_MEMBER( wangpc_state::motor2_on_r ) +{ + if (LOG) logerror("%s: Drive 2 motor ON\n", machine().describe_context()); + + m_floppy1->mon_w(0); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::motor2_on_w ) +{ + motor2_on_r(space, offset); +} + +READ8_MEMBER( wangpc_state::fdc_reset_r ) +{ + if (LOG) logerror("%s: FDC reset\n", machine().describe_context()); + + m_fdc->reset(); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::fdc_reset_w ) +{ + fdc_reset_r(space, offset); +} + +READ8_MEMBER( wangpc_state::fdc_tc_r ) +{ + if (LOG) logerror("%s: FDC TC\n", machine().describe_context()); + + m_fdc->tc_w(1); + m_fdc->tc_w(0); + + return 0xff; +} + +WRITE8_MEMBER( wangpc_state::fdc_tc_w ) +{ + fdc_tc_r(space, offset); +} + + +//------------------------------------------------- +// dma_page_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::dma_page_w ) +{ + if (LOG) logerror("%s: DMA page %u: %06x\n", machine().describe_context(), offset + 1, (data & 0x0f) << 16); + + m_dma_page[offset + 1] = data & 0x0f; +} + + +//------------------------------------------------- +// status_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::status_r ) +{ + /* + + bit description + + 0 Memory Parity Flag + 1 I/O Error Flag + 2 Unassigned + 3 FDC Interrupt Flag + 4 Door disturbed on drive 1 + 5 Door disturbed on drive 2 + 6 Door open on drive 1 + 7 Door open on drive 2 + + */ + + UINT8 data = 0x03; + + // floppy interrupts + data |= m_fdc->get_irq() << 3; + data |= m_fdc_dd0 << 4; + data |= m_fdc_dd1 << 5; + data |= m_floppy0->exists() ? 0 : 0x40; + data |= m_floppy1->exists() ? 0 : 0x80; + + return data; +} + + +//------------------------------------------------- +// timer0_int_clr_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::timer0_irq_clr_w ) +{ + //if (LOG) logerror("%s: Timer 0 IRQ clear\n", machine().describe_context()); + + m_pic->ir0_w(CLEAR_LINE); +} + + +//------------------------------------------------- +// timer2_irq_clr_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::timer2_irq_clr_r ) +{ + //if (LOG) logerror("%s: Timer 2 IRQ clear\n", machine().describe_context()); + + m_timer2_irq = 1; + check_level1_interrupts(); + + return 0xff; +} + + +//------------------------------------------------- +// nmi_mask_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::nmi_mask_w ) +{ + if (LOG) logerror("%s: NMI mask %02x\n", machine().describe_context(), data); +} + + +//------------------------------------------------- +// led_on_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::led_on_r ) +{ + if (LOG) logerror("%s: Diagnostic LED on\n", machine().describe_context()); + + output_set_led_value(LED_DIAGNOSTIC, 1); + + return 0xff; +} + + +//------------------------------------------------- +// fpu_mask_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::fpu_mask_w ) +{ + if (LOG) logerror("%s: FPU mask %02x\n", machine().describe_context(), data); +} + + +//------------------------------------------------- +// dma_eop_clr_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::dma_eop_clr_r ) +{ + if (LOG) logerror("%s: EOP clear\n", machine().describe_context()); + + m_dma_eop = 1; + + check_level2_interrupts(); + + return 0xff; +} + + +//------------------------------------------------- +// uart_tbre_clr_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::uart_tbre_clr_w ) +{ + if (LOG) logerror("%s: TBRE clear\n", machine().describe_context()); + + m_uart_tbre = 0; + + check_level2_interrupts(); +} + + +//------------------------------------------------- +// uart_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::uart_r ) +{ + m_uart_dr = 0; + + check_level2_interrupts(); + + UINT8 data = m_uart->read(space, 0); + + if (LOG) logerror("%s: UART read %02x\n", machine().describe_context(), data); + + return data; +} + + +//------------------------------------------------- +// uart_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::uart_w ) +{ + if (LOG) logerror("%s: UART write %02x\n", machine().describe_context(), data); + + switch (data) + { + case 0x10: m_led[0] = 1; break; + case 0x11: m_led[0] = 0; break; + case 0x12: m_led[1] = 1; break; + case 0x13: m_led[1] = 0; break; + case 0x14: m_led[2] = 1; break; + case 0x15: m_led[2] = 0; break; + case 0x16: m_led[3] = 1; break; + case 0x17: m_led[3] = 0; break; + case 0x18: m_led[4] = 1; break; + case 0x19: m_led[4] = 0; break; + case 0x1a: m_led[5] = 1; break; + case 0x1b: m_led[5] = 0; break; + case 0x1c: m_led[0] = m_led[1] = m_led[2] = m_led[3] = m_led[4] = m_led[5] = 1; break; + case 0x1d: m_led[0] = m_led[1] = m_led[2] = m_led[3] = m_led[4] = m_led[5] = 0; break; + } + + if (LOG) popmessage("%u%u%u%u%u%u", m_led[0], m_led[1], m_led[2], m_led[3], m_led[4], m_led[5]); + + m_uart_tbre = 0; + check_level2_interrupts(); + + m_uart->write(space, 0, data); +} + + +//------------------------------------------------- +// centronics_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::centronics_r ) +{ + m_dav = 1; + check_level1_interrupts(); + + return m_cent_data_in->read(); +} + + +//------------------------------------------------- +// centronics_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::centronics_w ) +{ + m_centronics_ack = 1; + check_level1_interrupts(); + + m_cent_data_out->write(data); + + m_centronics->write_strobe(0); + m_centronics->write_strobe(1); +} + + +//------------------------------------------------- +// busy_clr_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::busy_clr_r ) +{ + if (LOG) logerror("%s: BUSY clear\n", machine().describe_context()); + + m_centronics_busy = 1; + check_level1_interrupts(); + + return 0xff; +} + + +//------------------------------------------------- +// acknlg_clr_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::acknlg_clr_w ) +{ + if (LOG) logerror("%s: ACKNLG clear\n", machine().describe_context()); + + m_centronics_ack = 1; + check_level1_interrupts(); +} + + +//------------------------------------------------- +// led_off_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::led_off_r ) +{ + if (LOG) logerror("%s: Diagnostic LED off\n", machine().describe_context()); + + output_set_led_value(LED_DIAGNOSTIC, 0); + + return 0xff; +} + + +//------------------------------------------------- +// parity_nmi_clr_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_state::parity_nmi_clr_w ) +{ + if (LOG) logerror("%s: Parity NMI clear\n", machine().describe_context()); +} + + +//------------------------------------------------- +// option_id_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::option_id_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 FDC Interrupt Flag + + */ + + UINT8 data = 0; + + // FDC interrupt + data |= (m_fdc_dd0 || m_fdc_dd1 || (int) m_fdc->get_irq()) << 7; + + return data; +} + + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +//------------------------------------------------- +// ADDRESS_MAP( wangpc_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( wangpc_mem, AS_PROGRAM, 16, wangpc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000, 0x1ffff) AM_RAM + AM_RANGE(0x40000, 0xf3fff) AM_DEVREADWRITE(WANGPC_BUS_TAG, wangpcbus_device, mrdc_r, amwc_w) + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ADDRESS_MAP( wangpc_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( wangpc_io, AS_IO, 16, wangpc_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x1000, 0x1001) AM_WRITE8(fdc_ctrl_w, 0x00ff) + AM_RANGE(0x1004, 0x1005) AM_READWRITE8(deselect_drive1_r, deselect_drive1_w, 0x00ff) + AM_RANGE(0x1006, 0x1007) AM_READWRITE8(select_drive1_r, select_drive1_w, 0x00ff) + AM_RANGE(0x1008, 0x1009) AM_READWRITE8(deselect_drive2_r, deselect_drive2_w, 0x00ff) + AM_RANGE(0x100a, 0x100b) AM_READWRITE8(select_drive2_r, select_drive2_w, 0x00ff) + AM_RANGE(0x100c, 0x100d) AM_READWRITE8(motor1_off_r, motor1_off_w, 0x00ff) + AM_RANGE(0x100e, 0x100f) AM_READWRITE8(motor1_on_r, motor1_on_w, 0x00ff) + AM_RANGE(0x1010, 0x1011) AM_READWRITE8(motor2_off_r, motor2_off_w, 0x00ff) + AM_RANGE(0x1012, 0x1013) AM_READWRITE8(motor2_on_r, motor2_on_w, 0x00ff) + AM_RANGE(0x1014, 0x1017) AM_DEVICE8(UPD765_TAG, upd765a_device, map, 0x00ff) + AM_RANGE(0x1018, 0x1019) AM_MIRROR(0x0002) AM_READWRITE8(fdc_reset_r, fdc_reset_w, 0x00ff) + AM_RANGE(0x101c, 0x101d) AM_MIRROR(0x0002) AM_READWRITE8(fdc_tc_r, fdc_tc_w, 0x00ff) + AM_RANGE(0x1020, 0x1027) AM_DEVREADWRITE8(I8255A_TAG, i8255_device, read, write, 0x00ff) + AM_RANGE(0x1028, 0x1029) //AM_WRITE(?) + AM_RANGE(0x1040, 0x1047) AM_DEVREADWRITE8(I8253_TAG, pit8253_device, read, write, 0x00ff) + AM_RANGE(0x1060, 0x1063) AM_DEVREADWRITE8(I8259A_TAG, pic8259_device, read, write, 0x00ff) + AM_RANGE(0x1080, 0x1087) AM_DEVREAD8(SCN2661_TAG, mc2661_device, read, 0x00ff) + AM_RANGE(0x1088, 0x108f) AM_DEVWRITE8(SCN2661_TAG, mc2661_device, write, 0x00ff) + AM_RANGE(0x10a0, 0x10bf) AM_DEVREADWRITE8(AM9517A_TAG, am9517a_device, read, write, 0x00ff) + AM_RANGE(0x10c2, 0x10c7) AM_WRITE8(dma_page_w, 0x00ff) + AM_RANGE(0x10e0, 0x10e1) AM_READWRITE8(status_r, timer0_irq_clr_w, 0x00ff) + AM_RANGE(0x10e2, 0x10e3) AM_READWRITE8(timer2_irq_clr_r, nmi_mask_w, 0x00ff) + AM_RANGE(0x10e4, 0x10e5) AM_READWRITE8(led_on_r, fpu_mask_w, 0x00ff) + AM_RANGE(0x10e6, 0x10e7) AM_READWRITE8(dma_eop_clr_r, uart_tbre_clr_w, 0x00ff) + AM_RANGE(0x10e8, 0x10e9) AM_READWRITE8(uart_r, uart_w, 0x00ff) + AM_RANGE(0x10ea, 0x10eb) AM_READWRITE8(centronics_r, centronics_w, 0x00ff) + AM_RANGE(0x10ec, 0x10ed) AM_READWRITE8(busy_clr_r, acknlg_clr_w, 0x00ff) + AM_RANGE(0x10ee, 0x10ef) AM_READWRITE8(led_off_r, parity_nmi_clr_w, 0x00ff) + AM_RANGE(0x10fe, 0x10ff) AM_READ8(option_id_r, 0x00ff) + AM_RANGE(0x1100, 0x1fff) AM_DEVREADWRITE(WANGPC_BUS_TAG, wangpcbus_device, sad_r, sad_w) +ADDRESS_MAP_END + + + +//************************************************************************** +// INPUT PORTS +//************************************************************************** + +//------------------------------------------------- +// INPUT_PORTS( wangpc ) +//------------------------------------------------- + +static INPUT_PORTS_START( wangpc ) + // keyboard defined in machine/wangpckb.c + + PORT_START("SW") + PORT_DIPNAME( 0x0f, 0x0f, "CPU Baud Rate" ) PORT_DIPLOCATION("SW:1,2,3,4") + PORT_DIPSETTING( 0x0f, "19200" ) + PORT_DIPSETTING( 0x0e, "9600" ) + PORT_DIPSETTING( 0x0d, "7200" ) + PORT_DIPSETTING( 0x0c, "4800" ) + PORT_DIPSETTING( 0x0b, "3600" ) + PORT_DIPSETTING( 0x0a, "2400" ) + PORT_DIPSETTING( 0x09, "2000" ) + PORT_DIPSETTING( 0x08, "1800" ) + PORT_DIPSETTING( 0x07, "1200" ) + PORT_DIPSETTING( 0x06, "600" ) + PORT_DIPSETTING( 0x05, "300" ) + PORT_DIPSETTING( 0x04, "150" ) + PORT_DIPSETTING( 0x03, "134.5" ) + PORT_DIPSETTING( 0x02, "110" ) + PORT_DIPSETTING( 0x01, "75" ) + PORT_DIPSETTING( 0x00, "50 (Loop on Power-Up)" ) +INPUT_PORTS_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// I8237 +//------------------------------------------------- + +void wangpc_state::update_fdc_tc() +{ + if (m_enable_eop) + m_fdc->tc_w(m_fdc_tc); + else + m_fdc->tc_w(0); +} + +WRITE_LINE_MEMBER( wangpc_state::hrq_w ) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + m_dmac->hack_w(state); +} + +WRITE_LINE_MEMBER( wangpc_state::eop_w ) +{ + if (m_dack == 2) + { + m_fdc_tc = state; + update_fdc_tc(); + } + + if (state) + { + if (LOG) logerror("EOP set\n"); + + m_dma_eop = 0; + check_level2_interrupts(); + } + + m_bus->tc_w(state); +} + +READ8_MEMBER( wangpc_state::memr_r ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + offs_t addr = (m_dma_page[m_dack] << 16) | offset; + + return program.read_byte(addr); +} + +WRITE8_MEMBER( wangpc_state::memw_w ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + offs_t addr = (m_dma_page[m_dack] << 16) | offset; + + program.write_byte(addr, data); +} + +READ8_MEMBER( wangpc_state::ior2_r ) +{ + if (m_disable_dreq2) + return m_bus->dack_r(space, 2); + else + return m_fdc->dma_r(); +} + +WRITE8_MEMBER( wangpc_state::iow2_w ) +{ + if (m_disable_dreq2) + m_bus->dack_w(space, 2, data); + else + m_fdc->dma_w(data); +} + +WRITE_LINE_MEMBER( wangpc_state::dack0_w ) +{ + if (!state) m_dack = 0; +} + +WRITE_LINE_MEMBER( wangpc_state::dack1_w ) +{ + if (!state) m_dack = 1; +} + +WRITE_LINE_MEMBER( wangpc_state::dack2_w ) +{ + if (!state) m_dack = 2; +} + +WRITE_LINE_MEMBER( wangpc_state::dack3_w ) +{ + if (!state) m_dack = 3; +} + +//------------------------------------------------- +// pic8259_interface pic_intf +//------------------------------------------------- + +void wangpc_state::check_level1_interrupts() +{ + int state = !m_timer2_irq || m_epci->rxrdy_r() || m_epci->txemt_r() || !m_centronics_ack || !m_dav || !m_centronics_busy; + + m_pic->ir1_w(state); +} + +void wangpc_state::check_level2_interrupts() +{ + int state = !m_dma_eop || m_uart_dr || m_uart_tbre || m_fdc_dd0 || m_fdc_dd1 || m_fdc->get_irq() || m_fpu_irq || m_bus_irq2; + + m_pic->ir2_w(state); +} + +//------------------------------------------------- +// I8255A INTERFACE +//------------------------------------------------- + +READ8_MEMBER( wangpc_state::ppi_pa_r ) +{ + /* + + bit description + + 0 /POWER ON + 1 /SMART + 2 /DATA AVAILABLE + 3 SLCT + 4 BUSY + 5 /FAULT + 6 PE + 7 ACKNOWLEDGE + + */ + + UINT8 data = 0x08 | 0x02 | 0x01; + + data |= m_dav << 2; + data |= m_centronics_busy << 4; + data |= m_centronics_fault << 5; + data |= m_centronics_perror << 6; + data |= m_centronics_ack << 7; + + return data; +} + +READ8_MEMBER( wangpc_state::ppi_pb_r ) +{ + /* + + bit description + + 0 /TIMER 2 INTERRUPT + 1 /SERIAL INTERRUPT + 2 /PARALLEL PORT INTERRUPT + 3 /DMA INTERRUPT + 4 KBD INTERRUPT TRANSMIT + 5 KBD INTERRUPT RECEIVE + 6 FLOPPY DISK INTERRUPT + 7 8087 INTERRUPT + + */ + + UINT8 data = 0; + + // timer 2 interrupt + data |= m_timer2_irq; + + // serial interrupt + data |= !(m_epci->rxrdy_r() | m_epci->txemt_r()) << 1; + + // parallel port interrupt + data |= m_centronics_ack << 2; + + // DMA interrupt + data |= m_dma_eop << 3; + + // keyboard interrupt + data |= m_uart_tbre << 4; + data |= m_uart_dr << 5; + + // FDC interrupt + data |= m_fdc->get_irq() << 6; + + // 8087 interrupt + data |= m_fpu_irq << 7; + + return data; +} + +READ8_MEMBER( wangpc_state::ppi_pc_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 SW1 + 5 SW2 + 6 SW3 + 7 SW4 + + */ + + return m_sw->read() << 4; +} + +WRITE8_MEMBER( wangpc_state::ppi_pc_w ) +{ + /* + + bit description + + 0 /USR0 (pin 14) + 1 /USR1 (pin 36) + 2 /RESET (pin 31) + 3 Unassigned + 4 + 5 + 6 + 7 + + */ + + m_centronics->write_autofd(BIT(data, 0)); + m_centronics->write_select_in(BIT(data, 1)); + m_centronics->write_init(BIT(data, 2)); +} + +WRITE_LINE_MEMBER( wangpc_state::pit2_w ) +{ + if (state) + { + m_timer2_irq = 0; + check_level1_interrupts(); + } +} + +//------------------------------------------------- +// IM6402_INTERFACE( uart_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( wangpc_state::uart_dr_w ) +{ + if (state) + { + if (LOG) logerror("DR set\n"); + + m_uart_dr = 1; + check_level2_interrupts(); + } +} + +WRITE_LINE_MEMBER( wangpc_state::uart_tbre_w ) +{ + if (state) + { + if (LOG) logerror("TBRE set\n"); + + m_uart_tbre = 1; + check_level2_interrupts(); + } +} + + +//------------------------------------------------- +// SCN2661_INTERFACE( epci_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( wangpc_state::epci_irq_w ) +{ + check_level1_interrupts(); +} + + +//------------------------------------------------- +// upd765_interface fdc_intf +//------------------------------------------------- + +static SLOT_INTERFACE_START( wangpc_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( wangpc_state::floppy_formats ) + FLOPPY_PC_FORMAT +FLOPPY_FORMATS_END + +WRITE_LINE_MEMBER( wangpc_state::fdc_irq ) +{ + if (LOG) logerror("FDC INT %u\n", state); + + check_level2_interrupts(); +} + +WRITE_LINE_MEMBER( wangpc_state::fdc_drq ) +{ + if (LOG) logerror("FDC DRQ %u\n", state); + + m_fdc_drq = state; + update_fdc_drq(); +} + +void wangpc_state::update_fdc_drq() +{ + if (m_disable_dreq2) + m_dmac->dreq2_w(1); + else + m_dmac->dreq2_w(!m_fdc_drq); +} + + +//------------------------------------------------- +// centronics_interface centronics_intf +//------------------------------------------------- + +WRITE_LINE_MEMBER( wangpc_state::write_centronics_ack ) +{ + if (LOG) logerror("ACKNLG %u\n", state); + + m_centronics_ack = state; + + check_level1_interrupts(); +} + +WRITE_LINE_MEMBER( wangpc_state::write_centronics_busy ) +{ + if (LOG) logerror("BUSY %u\n", state); + + m_centronics_busy = state; + + check_level1_interrupts(); +} + +WRITE_LINE_MEMBER( wangpc_state::write_centronics_fault ) +{ + m_centronics_fault = state; +} + +WRITE_LINE_MEMBER( wangpc_state::write_centronics_perror ) +{ + m_centronics_perror = state; +} + +//------------------------------------------------- +// WANGPC_BUS_INTERFACE( kb_intf ) +//------------------------------------------------- + +WRITE_LINE_MEMBER( wangpc_state::bus_irq2_w ) +{ + if (LOG) logerror("Bus IRQ2 %u\n", state); + + m_bus_irq2 = state; + + check_level2_interrupts(); +} + + + +//************************************************************************** +// MACHINE INITIALIZATION +//************************************************************************** + +//------------------------------------------------- +// MACHINE_START( wangpc ) +//------------------------------------------------- + +void wangpc_state::machine_start() +{ + // connect floppy callbacks + m_floppy0->setup_load_cb(floppy_image_device::load_cb(FUNC(wangpc_state::on_disk0_load), this)); + m_floppy0->setup_unload_cb(floppy_image_device::unload_cb(FUNC(wangpc_state::on_disk0_unload), this)); + m_floppy1->setup_load_cb(floppy_image_device::load_cb(FUNC(wangpc_state::on_disk1_load), this)); + m_floppy1->setup_unload_cb(floppy_image_device::unload_cb(FUNC(wangpc_state::on_disk1_unload), this)); + + // state saving + save_item(NAME(m_dma_page)); + save_item(NAME(m_dack)); + save_item(NAME(m_timer2_irq)); + save_item(NAME(m_centronics_ack)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_fault)); + save_item(NAME(m_centronics_perror)); + save_item(NAME(m_dav)); + save_item(NAME(m_dma_eop)); + save_item(NAME(m_uart_dr)); + save_item(NAME(m_uart_tbre)); + save_item(NAME(m_fpu_irq)); + save_item(NAME(m_bus_irq2)); + save_item(NAME(m_enable_eop)); + save_item(NAME(m_disable_dreq2)); + save_item(NAME(m_fdc_drq)); + save_item(NAME(m_ds1)); + save_item(NAME(m_ds2)); +} + + +void wangpc_state::machine_reset() +{ + // initialize UART + m_uart->cls1_w(1); + m_uart->cls2_w(1); + m_uart->pi_w(1); + m_uart->sbs_w(1); + m_uart->crl_w(1); +} + + +//------------------------------------------------- +// on_disk0_change - +//------------------------------------------------- + +int wangpc_state::on_disk0_load(floppy_image_device *image) +{ + on_disk0_unload(image); + + return IMAGE_INIT_PASS; +} + +void wangpc_state::on_disk0_unload(floppy_image_device *image) +{ + if (LOG) logerror("Door 1 disturbed\n"); + + m_fdc_dd0 = 1; + check_level2_interrupts(); +} + + +//------------------------------------------------- +// on_disk1_change - +//------------------------------------------------- + +int wangpc_state::on_disk1_load(floppy_image_device *image) +{ + on_disk1_unload(image); + + return IMAGE_INIT_PASS; +} + +void wangpc_state::on_disk1_unload(floppy_image_device *image) +{ + if (LOG) logerror("Door 2 disturbed\n"); + + m_fdc_dd1 = 1; + check_level2_interrupts(); +} + + + +//************************************************************************** +// MACHINE DRIVERS +//************************************************************************** + +//------------------------------------------------- +// MACHINE_CONFIG( wangpc ) +//------------------------------------------------- + +static MACHINE_CONFIG_START( wangpc, wangpc_state ) + MCFG_CPU_ADD(I8086_TAG, I8086, 8000000) + MCFG_CPU_PROGRAM_MAP(wangpc_mem) + MCFG_CPU_IO_MAP(wangpc_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A_TAG, pic8259_device, inta_cb) + //MCFG_QUANTUM_PERFECT_CPU(I8086_TAG) + + // devices + MCFG_DEVICE_ADD(AM9517A_TAG, AM9517A, 4000000) + MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(wangpc_state, hrq_w)) + MCFG_AM9517A_OUT_EOP_CB(WRITELINE(wangpc_state, eop_w)) + MCFG_AM9517A_IN_MEMR_CB(READ8(wangpc_state, memr_r)) + MCFG_AM9517A_OUT_MEMW_CB(WRITE8(wangpc_state, memw_w)) + MCFG_AM9517A_IN_IOR_1_CB(DEVREAD8(WANGPC_BUS_TAG, wangpcbus_device, dack1_r)) + MCFG_AM9517A_IN_IOR_2_CB(READ8(wangpc_state, ior2_r)) + MCFG_AM9517A_IN_IOR_3_CB(DEVREAD8(WANGPC_BUS_TAG, wangpcbus_device, dack3_r)) + MCFG_AM9517A_OUT_IOW_1_CB(DEVWRITE8(WANGPC_BUS_TAG, wangpcbus_device, dack1_w)) + MCFG_AM9517A_OUT_IOW_2_CB(WRITE8(wangpc_state, iow2_w)) + MCFG_AM9517A_OUT_IOW_3_CB(DEVWRITE8(WANGPC_BUS_TAG, wangpcbus_device, dack3_w)) + MCFG_AM9517A_OUT_DACK_0_CB(WRITELINE(wangpc_state, dack0_w)) + MCFG_AM9517A_OUT_DACK_1_CB(WRITELINE(wangpc_state, dack1_w)) + MCFG_AM9517A_OUT_DACK_2_CB(WRITELINE(wangpc_state, dack2_w)) + MCFG_AM9517A_OUT_DACK_3_CB(WRITELINE(wangpc_state, dack3_w)) + + MCFG_PIC8259_ADD(I8259A_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(wangpc_state, ppi_pa_r)) + MCFG_I8255_IN_PORTB_CB(READ8(wangpc_state, ppi_pb_r)) + MCFG_I8255_IN_PORTC_CB(READ8(wangpc_state, ppi_pc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(wangpc_state, ppi_pc_w)) + + MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_PIT8253_CLK0(500000) + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259A_TAG, pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(2000000) + MCFG_PIT8253_CLK2(500000) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(wangpc_state, pit2_w)) + + MCFG_IM6402_ADD(IM6402_TAG, 0, 62500*16) // HACK for wangpckb in IM6402 derives clocks from data line + MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(WANGPC_KEYBOARD_TAG, wangpc_keyboard_device, write_rxd)) + MCFG_IM6402_DR_CALLBACK(WRITELINE(wangpc_state, uart_dr_w)) + MCFG_IM6402_TBRE_CALLBACK(WRITELINE(wangpc_state, uart_tbre_w)) + + MCFG_DEVICE_ADD(SCN2661_TAG, MC2661, 0) + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_MC2661_RXRDY_HANDLER(WRITELINE(wangpc_state, epci_irq_w)) + MCFG_MC2661_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_MC2661_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_MC2661_TXEMT_DSCHG_HANDLER(WRITELINE(wangpc_state, epci_irq_w)) + + MCFG_UPD765A_ADD(UPD765_TAG, false, false) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(wangpc_state, fdc_irq)) + MCFG_UPD765_DRQ_CALLBACK(WRITELINE(wangpc_state, fdc_drq)) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", wangpc_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", wangpc_floppies, "525dd", wangpc_state::floppy_formats) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") + MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(wangpc_state, write_centronics_ack)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(wangpc_state, write_centronics_busy)) + MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(wangpc_state, write_centronics_fault)) + MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(wangpc_state, write_centronics_perror)) + + MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(SCN2661_TAG, mc2661_device, rx_w)) + + MCFG_DEVICE_ADD(WANGPC_KEYBOARD_TAG, WANGPC_KEYBOARD, 0) + MCFG_WANGPCKB_TXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri)) + + // bus + MCFG_WANGPC_BUS_ADD() + MCFG_WANGPC_BUS_IRQ2_CALLBACK(WRITELINE(wangpc_state, bus_irq2_w)) + MCFG_WANGPC_BUS_IRQ3_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir3_w)) + MCFG_WANGPC_BUS_IRQ4_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir4_w)) + MCFG_WANGPC_BUS_IRQ5_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir5_w)) + MCFG_WANGPC_BUS_IRQ6_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir6_w)) + MCFG_WANGPC_BUS_IRQ7_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir7_w)) + MCFG_WANGPC_BUS_DRQ1_CALLBACK(DEVWRITELINE(AM9517A_TAG, am9517a_device, dreq1_w)) + MCFG_WANGPC_BUS_DRQ2_CALLBACK(DEVWRITELINE(AM9517A_TAG, am9517a_device, dreq2_w)) + MCFG_WANGPC_BUS_DRQ3_CALLBACK(DEVWRITELINE(AM9517A_TAG, am9517a_device, dreq3_w)) + MCFG_WANGPC_BUS_IOERROR_CALLBACK(INPUTLINE(I8086_TAG, INPUT_LINE_NMI)) + MCFG_WANGPC_BUS_SLOT_ADD("slot1", 1, wangpc_cards, NULL) + MCFG_WANGPC_BUS_SLOT_ADD("slot2", 2, wangpc_cards, "mvc") + MCFG_WANGPC_BUS_SLOT_ADD("slot3", 3, wangpc_cards, NULL) + MCFG_WANGPC_BUS_SLOT_ADD("slot4", 4, wangpc_cards, NULL) + MCFG_WANGPC_BUS_SLOT_ADD("slot5", 5, wangpc_cards, NULL) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + + // software list + MCFG_SOFTWARE_LIST_ADD("flop_list", "wangpc") +MACHINE_CONFIG_END + + + +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** + +//------------------------------------------------- +// ROM( wangpc ) +//------------------------------------------------- + +ROM_START( wangpc ) + ROM_REGION16_LE( 0x4000, I8086_TAG, 0) + ROM_LOAD16_BYTE( "0001 r2.l94", 0x0001, 0x2000, CRC(f9f41304) SHA1(1815295809ef11573d724ede47446f9ac7aee713) ) + ROM_LOAD16_BYTE( "379-0000 r2.l115", 0x0000, 0x2000, CRC(67b37684) SHA1(70d9f68eb88cc2bc9f53f949cc77411c09a4266e) ) +ROM_END + + + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +COMP( 1985, wangpc, 0, 0, wangpc, wangpc, driver_device, 0, "Wang Laboratories", "Wang Professional Computer", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/wicat.c b/src/mame/drivers/wicat.c new file mode 100644 index 00000000000..b9bba8cd301 --- /dev/null +++ b/src/mame/drivers/wicat.c @@ -0,0 +1,989 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert, Barry Rodewald +/*************************************************************************** + +Wicat - various systems. + +2013-09-01 Skeleton driver + +****************************************************************************/ + +/* + + TODO: + + - video DMA is done line by line and needs to be in perfect sync + +*/ + +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "cpu/z8000/z8000.h" +#include "cpu/8x300/8x300.h" +#include "machine/6522via.h" +#include "machine/mm58274c.h" +#include "machine/mc2661.h" +#include "machine/im6402.h" +#include "video/i8275.h" +#include "machine/am9517a.h" +#include "machine/x2212.h" +#include "machine/wd_fdc.h" +#include "wicat.lh" + +class wicat_state : public driver_device +{ +public: + wicat_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_vram(*this, "vram"), + m_maincpu(*this, "maincpu"), + m_rtc(*this, "rtc"), + m_via(*this, "via"), + m_uart0(*this,"uart0"), + m_uart1(*this,"uart1"), + m_uart2(*this,"uart2"), + m_uart3(*this,"uart3"), + m_uart4(*this,"uart4"), + m_uart5(*this,"uart5"), + m_uart6(*this,"uart6"), + m_videocpu(*this,"videocpu"), + m_videoctrl(*this,"video"), + m_videodma(*this,"videodma"), + m_videouart0(*this,"videouart0"), + m_videouart1(*this,"videouart1"), + m_videouart(*this,"videouart"), + m_videosram(*this,"vsram"), + m_palette(*this, "palette"), + m_chargen(*this,"g2char"), + m_fdc(*this,"fdc") + { + } + + DECLARE_READ16_MEMBER(invalid_r); + DECLARE_WRITE16_MEMBER(invalid_w); + DECLARE_READ16_MEMBER(memmap_r); + DECLARE_WRITE16_MEMBER(memmap_w); + DECLARE_WRITE16_MEMBER(parallel_led_w); + DECLARE_WRITE8_MEMBER(via_a_w); + DECLARE_WRITE8_MEMBER(via_b_w); + DECLARE_READ8_MEMBER(video_r); + DECLARE_WRITE8_MEMBER(video_w); + DECLARE_READ8_MEMBER(video_dma_r); + DECLARE_WRITE8_MEMBER(video_dma_w); + DECLARE_READ8_MEMBER(video_uart0_r); + DECLARE_WRITE8_MEMBER(video_uart0_w); + DECLARE_READ8_MEMBER(video_uart1_r); + DECLARE_WRITE8_MEMBER(video_uart1_w); + DECLARE_READ8_MEMBER(videosram_r); + DECLARE_WRITE8_MEMBER(videosram_w); + DECLARE_WRITE8_MEMBER(videosram_store_w); + DECLARE_WRITE8_MEMBER(videosram_recall_w); + DECLARE_READ8_MEMBER(video_timer_r); + DECLARE_WRITE8_MEMBER(video_timer_w); + DECLARE_READ8_MEMBER(vram_r); + DECLARE_WRITE8_MEMBER(vram_w); + DECLARE_READ8_MEMBER(video_ctrl_r); + DECLARE_WRITE8_MEMBER(video_ctrl_w); + DECLARE_READ8_MEMBER(video_status_r); + DECLARE_WRITE_LINE_MEMBER(dma_hrq_w); + DECLARE_WRITE_LINE_MEMBER(dma_nmi_cb); + DECLARE_WRITE_LINE_MEMBER(crtc_cb); + DECLARE_READ8_MEMBER(hdc_r); + DECLARE_WRITE8_MEMBER(hdc_w); + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); + DECLARE_READ16_MEMBER(via_r); + DECLARE_WRITE16_MEMBER(via_w); + DECLARE_WRITE_LINE_MEMBER(kb_data_ready); + I8275_DRAW_CHARACTER_MEMBER(wicat_display_pixels); + + required_shared_ptr m_vram; + required_device m_maincpu; + required_device m_rtc; + required_device m_via; + required_device m_uart0; + required_device m_uart1; + required_device m_uart2; + required_device m_uart3; + required_device m_uart4; + required_device m_uart5; + required_device m_uart6; + required_device m_videocpu; + required_device m_videoctrl; + required_device m_videodma; + required_device m_videouart0; + required_device m_videouart1; + required_device m_videouart; + required_device m_videosram; + required_device m_palette; + required_memory_region m_chargen; + required_device m_fdc; + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; } + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + +private: + virtual void machine_start(); + virtual void machine_reset(); + virtual void driver_start(); + + void poll_kb(); + void send_key(UINT8 val); + + emu_timer* m_video_timer; + emu_timer* m_kb_timer; + emu_timer* m_kb_serial_timer; + static const device_timer_id VIDEO_TIMER = 0; + static const device_timer_id KB_TIMER = 1; + static const device_timer_id KB_SERIAL_TIMER = 2; + + UINT8 m_portA; + UINT8 m_portB; + bool m_video_timer_irq; + bool m_video_kb_irq; + UINT8 m_nmi_enable; + UINT8 m_crtc_irq; + UINT16 m_kb_data; + UINT8 m_kb_bit; + UINT32 m_kb_keys[8]; +}; + + +static ADDRESS_MAP_START(wicat_mem, AS_PROGRAM, 16, wicat_state) + ADDRESS_MAP_UNMAP_LOW + ADDRESS_MAP_GLOBAL_MASK(0xffffff) + AM_RANGE(0x000000, 0x001fff) AM_ROM AM_REGION("c2", 0x0000) + AM_RANGE(0x020000, 0x1fffff) AM_RAM + AM_RANGE(0x200000, 0x2fffff) AM_RAM + AM_RANGE(0x300000, 0xdfffff) AM_READWRITE(invalid_r,invalid_w) + AM_RANGE(0xeff800, 0xeffbff) AM_RAM // memory mapping SRAM, used during boot sequence for storing various data (TODO) + AM_RANGE(0xeffc00, 0xeffc01) AM_READWRITE(memmap_r,memmap_w) + AM_RANGE(0xf00000, 0xf00007) AM_DEVREADWRITE8("uart0",mc2661_device,read,write,0xff00) // UARTs + AM_RANGE(0xf00008, 0xf0000f) AM_DEVREADWRITE8("uart1",mc2661_device,read,write,0xff00) + AM_RANGE(0xf00010, 0xf00017) AM_DEVREADWRITE8("uart2",mc2661_device,read,write,0xff00) + AM_RANGE(0xf00018, 0xf0001f) AM_DEVREADWRITE8("uart3",mc2661_device,read,write,0xff00) + AM_RANGE(0xf00020, 0xf00027) AM_DEVREADWRITE8("uart4",mc2661_device,read,write,0xff00) + AM_RANGE(0xf00028, 0xf0002f) AM_DEVREADWRITE8("uart5",mc2661_device,read,write,0xff00) + AM_RANGE(0xf00030, 0xf00037) AM_DEVREADWRITE8("uart6",mc2661_device,read,write,0xff00) + AM_RANGE(0xf00040, 0xf0005f) AM_READWRITE(via_r, via_w) + AM_RANGE(0xf00060, 0xf0007f) AM_DEVREADWRITE8("rtc",mm58274c_device,read,write,0xff00) + AM_RANGE(0xf000d0, 0xf000d1) AM_WRITE(parallel_led_w) + AM_RANGE(0xf00180, 0xf0018f) AM_READWRITE8(hdc_r,hdc_w,0xffff) // WD1000 + AM_RANGE(0xf00190, 0xf0019f) AM_READWRITE8(fdc_r,fdc_w,0xffff) // FD1795 + AM_RANGE(0xf00f00, 0xf00fff) AM_READWRITE(invalid_r,invalid_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(wicat_video_mem, AS_PROGRAM, 16, wicat_state) + AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("g1", 0x0000) + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(wicat_video_io, AS_IO, 8, wicat_state) + // these are largely wild guesses... + AM_RANGE(0x0000,0x0003) AM_READWRITE(video_timer_r,video_timer_w) // some sort of timer? + AM_RANGE(0x0100,0x0107) AM_READWRITE(video_uart0_r,video_uart0_w) // INS2651 UART #1 + AM_RANGE(0x0200,0x0207) AM_READWRITE(video_uart1_r,video_uart1_w) // INS2651 UART #2 + AM_RANGE(0x0304,0x0304) AM_READ(video_status_r) + AM_RANGE(0x0400,0x047f) AM_READWRITE(videosram_r,videosram_w) // XD2210 4-bit NOVRAM + AM_RANGE(0x0500,0x0500) AM_WRITE(videosram_recall_w) + AM_RANGE(0x0600,0x0600) AM_WRITE(videosram_store_w) + AM_RANGE(0x0800,0x080f) AM_READWRITE(video_ctrl_r,video_ctrl_w) + AM_RANGE(0x0a00,0x0a1f) AM_READWRITE(video_dma_r,video_dma_w) // AM9517A DMA + AM_RANGE(0x0b00,0x0b03) AM_READWRITE(video_r,video_w) // i8275 CRTC + AM_RANGE(0x0e00,0x0eff) AM_RAM + AM_RANGE(0x4000,0x5fff) AM_RAM AM_SHARE("vram") // video RAM? + AM_RANGE(0x8000,0x8fff) AM_ROM AM_REGION("g2char",0x0000) + AM_RANGE(0x9000,0x9fff) AM_ROM AM_REGION("g2char",0x0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(wicat_wd1000_mem, AS_PROGRAM, 16, wicat_state) + AM_RANGE(0x0000, 0x17ff) AM_ROM AM_REGION("wd3", 0x0000) + AM_RANGE(0x1800, 0x1fff) AM_NOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START(wicat_wd1000_io, AS_IO, 8, wicat_state) + AM_RANGE(0x0000, 0x00ff) AM_RAM // left bank - RAM + AM_RANGE(0x0100, 0x01ff) AM_RAM // right bank - I/O ports (TODO) +ADDRESS_MAP_END + + +/* Input ports */ +static INPUT_PORTS_START( wicat ) + PORT_START("kb0") + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(7) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Retrn") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("kb1") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + + PORT_START("kb2") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + + PORT_START("kb3") + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Unknown (7F)") PORT_CODE(KEYCODE_F4) + + PORT_START("kb4") + + PORT_START("kb5") + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Unknown (AA)") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Unknown (B0)") PORT_CODE(KEYCODE_F3) + + PORT_START("kb6") + + PORT_START("kb7") + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Set-up (FE)") PORT_CODE(KEYCODE_F1) + +INPUT_PORTS_END + +void wicat_state::driver_start() +{ + m_video_timer = timer_alloc(VIDEO_TIMER); + m_kb_timer = timer_alloc(KB_TIMER); + m_kb_serial_timer = timer_alloc(KB_SERIAL_TIMER); +} + +void wicat_state::machine_start() +{ +} + +void wicat_state::machine_reset() +{ + // on the terminal board /DCD on both INS2651s are tied to GND + m_videouart0->dcd_w(0); + m_videouart1->dcd_w(0); + m_uart0->dcd_w(0); + m_uart1->dcd_w(0); + m_uart2->dcd_w(0); + m_uart3->dcd_w(0); + m_uart4->dcd_w(0); + m_uart5->dcd_w(0); + + // initialise im6402 (terminal board) + m_videouart->cls1_w(1); + m_videouart->cls2_w(1); + m_videouart->pi_w(1); + m_videouart->sbs_w(0); + m_videouart->crl_w(1); + + m_video_timer_irq = false; + m_video_kb_irq = false; + m_video_timer->adjust(attotime::zero,0,attotime::from_hz(60)); + m_kb_timer->adjust(attotime::zero,0,attotime::from_msec(50)); + m_nmi_enable = 0; + m_crtc_irq = CLEAR_LINE; + for(int x=0;x<8;x++) + m_kb_keys[x] = 0; +} + +void wicat_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case VIDEO_TIMER: + m_video_timer_irq = true; + m_videocpu->set_input_line(INPUT_LINE_IRQ0,ASSERT_LINE); + break; + case KB_TIMER: + poll_kb(); + break; + case KB_SERIAL_TIMER: + m_videouart->write_rri((m_kb_data >> (m_kb_bit)) & 0x01); + m_kb_bit++; + if(m_kb_bit > 10) + { + m_kb_serial_timer->reset(); + } + break; + } +} + +void wicat_state::poll_kb() +{ + UINT8 line; + UINT8 val = 0; + UINT8 x; + UINT32 data; + char kbtag[8]; + + for(line=0;line<8;line++) + { + sprintf(kbtag,"kb%i",line); + data = ioport(kbtag)->read(); + for(x=0;x<32;x++) + { + if((data & (1<adjust(attotime::zero,0,attotime::from_hz(1200)); +} + +WRITE16_MEMBER( wicat_state::parallel_led_w ) +{ + // bit 0 - parallel port A direction (0 = input) + // bit 1 - parallel port B direction (0 = input) + output_set_value("led1",data & 0x0400); + output_set_value("led2",data & 0x0800); + output_set_value("led3",data & 0x1000); + output_set_value("led4",data & 0x2000); + output_set_value("led5",data & 0x4000); + output_set_value("led6",data & 0x8000); +} + +WRITE8_MEMBER( wicat_state::via_a_w ) +{ + m_portA = data; + logerror("VIA: write %02x to port A\n",data); +} + +WRITE8_MEMBER( wicat_state::via_b_w ) +{ + m_portB = data; + logerror("VIA: write %02x to port B\n",data); +} + +READ16_MEMBER( wicat_state::invalid_r ) +{ + if(!space.debugger_access()) + { + m_maincpu->set_buserror_details(0x300000+offset*2-2,0,m_maincpu->get_fc()); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + } + return 0xff; +} + +WRITE16_MEMBER( wicat_state::invalid_w ) +{ + if(!space.debugger_access()) + { + m_maincpu->set_buserror_details(0x300000+offset*2-2,1,m_maincpu->get_fc()); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + } +} + +// TODO +READ16_MEMBER(wicat_state::memmap_r) +{ + popmessage("Memory mapping register EFFC01 read!"); + return 0xff; +} + +WRITE16_MEMBER(wicat_state::memmap_w) +{ + popmessage("Memory mapping register EFFC01 written!"); +} + +// WD1000 Winchester Disk controller (10MB 5 1/4" HD) +// for now, we'll just try to tell the system there is no HD +READ8_MEMBER(wicat_state::hdc_r) +{ + switch(offset) + { + case 0x00: // Error register + return 0x00; + case 0x06: // Status register + return 0x05; + } + return 0x00; +} + +WRITE8_MEMBER(wicat_state::hdc_w) +{ + switch(offset) + { + case 0x00: // Write precomp / Error register + logerror("HDC: Write precomp %02x\n",data); + break; + case 0x01: // Data register + logerror("HDC: Data %02x\n",data); + break; + case 0x02: // Sector Number + logerror("HDC: Sector Number %02x\n",data); + break; + case 0x03: // Sector Count + logerror("HDC: Sector Count %02x\n",data); + break; + case 0x04: // Cylinder High + logerror("HDC: Cylinder High %02x\n",data); + break; + case 0x05: // Cylinder Low + logerror("HDC: Cylinder Low %02x\n",data); + break; + case 0x06: // Command register + logerror("HDC: Command %1x\n",(data & 0xf0) >> 4); + m_maincpu->set_input_line(M68K_IRQ_5,HOLD_LINE); + break; + case 0x07: // Size / Drive / Head + logerror("HDC: Size / Drive / Head %02x\n",data); + break; + case 0x0c: // DMA bits 9-16 + logerror("HDC: DMA address mid %02x\n",data); + break; + case 0x0d: // DMA bits 1-8 (bit 0 cannot be set) + logerror("HDC: DMA address low %02x\n",data); + break; + case 0x0e: // DMA R/W + logerror("HDC: DMA R/W %02x\n",data); + break; + case 0x0f: // DMA bits 17-23 + logerror("HDC: DMA address high %02x\n",data); + break; + default: + logerror("HDC: Write to unknown register %02x\n",data); + } +} + +READ8_MEMBER(wicat_state::fdc_r) +{ + UINT8 ret = 0x00; + + popmessage("FDC: read offset %02x",offset); + switch(offset) + { + case 0x00: + ret = m_fdc->status_r(space,0); + break; + case 0x01: + ret = m_fdc->track_r(space,0); + break; + case 0x02: + ret = m_fdc->sector_r(space,0); + break; + case 0x03: + ret = m_fdc->data_r(space,0); + break; + case 0x08: + // Interrupt status (TODO, not part of the FD1795) + break; + } + return ret; +} + +WRITE8_MEMBER(wicat_state::fdc_w) +{ + popmessage("FDC: write offset %02x data %02x",offset,data); + switch(offset) + { + case 0x00: + m_fdc->cmd_w(space,0,data); + break; + case 0x01: + m_fdc->track_w(space,0,data); + break; + case 0x02: + m_fdc->sector_w(space,0,data); + break; + case 0x03: + m_fdc->data_w(space,0,data); + break; + case 0x08: + // Interrupt disable / Drive select (TODO, not part of the FD1795) + break; + } +} + +READ16_MEMBER(wicat_state::via_r) +{ + if(ACCESSING_BITS_0_7) + return m_via->read(space,offset); + return 0x00; +} + +WRITE16_MEMBER(wicat_state::via_w) +{ + if(ACCESSING_BITS_0_7) + m_via->write(space,offset,data); + else if(ACCESSING_BITS_8_15) + m_via->write(space,offset,data>>8); +} + +READ8_MEMBER(wicat_state::video_r) +{ + switch(offset) + { + case 0x00: + return m_videoctrl->read(space,0); + case 0x02: + return m_videoctrl->read(space,1); + default: + return 0xff; + } +} + +WRITE8_MEMBER(wicat_state::video_w) +{ + switch(offset) + { + case 0x00: + m_videoctrl->write(space,0,data); + break; + case 0x02: + m_videoctrl->write(space,1,data); + break; + } +} + +READ8_MEMBER( wicat_state::vram_r ) +{ + return m_videocpu->space(AS_IO).read_byte(offset*2); +} + +WRITE8_MEMBER( wicat_state::vram_w ) +{ + m_videocpu->space(AS_IO).write_byte(offset*2,data); +} + +READ8_MEMBER(wicat_state::video_dma_r) +{ + return m_videodma->read(space,offset/2); +} + +WRITE8_MEMBER(wicat_state::video_dma_w) +{ + if(!(offset & 0x01)) + m_videodma->write(space,offset/2,data); +} + +READ8_MEMBER(wicat_state::video_uart0_r) +{ + UINT16 noff = offset >> 1; + return m_videouart0->read(space,noff); +} + +WRITE8_MEMBER(wicat_state::video_uart0_w) +{ + UINT16 noff = offset >> 1; + m_videouart0->write(space,noff,data); +} + +READ8_MEMBER(wicat_state::video_uart1_r) +{ + UINT16 noff = offset >> 1; + return m_videouart1->read(space,noff); +} + +WRITE8_MEMBER(wicat_state::video_uart1_w) +{ + UINT16 noff = offset >> 1; + m_videouart1->write(space,noff,data); +} + +// XD2210 64 x 4bit NOVRAM +READ8_MEMBER(wicat_state::videosram_r) +{ + if(offset & 0x01) + return 0xff; + else + return m_videosram->read(space,offset/2); +} + +WRITE8_MEMBER(wicat_state::videosram_w) +{ + if(!(offset & 0x01)) + m_videosram->write(space,offset/2,data); +} + +WRITE8_MEMBER(wicat_state::videosram_store_w) +{ + if(data & 0x01) // unsure of the actual bit checked, the terminal code just writes 0xff + { + m_videosram->store(1); + m_videosram->store(0); + logerror("XD2210: Store triggered.\n"); + } +} + +WRITE8_MEMBER(wicat_state::videosram_recall_w) +{ + if(data & 0x01) // unsure of the actual bit checked, the terminal code just writes 0xff + { + m_videosram->recall(1); + m_videosram->recall(0); + logerror("XD2210: Store triggered.\n"); + } +} + +READ8_MEMBER(wicat_state::video_timer_r) +{ + UINT8 ret = 0x00; + + if(offset == 0x00) + { + if(m_video_timer_irq) + { + ret |= 0x08; + m_video_timer_irq = false; + m_videocpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE); + } + if(m_video_kb_irq) + { + ret |= 0x10; + m_video_kb_irq = false; + m_videocpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE); + } + } + if(offset == 0x02) + return m_videouart->read(space,0); + return ret; +} + +WRITE8_MEMBER(wicat_state::video_timer_w) +{ + logerror("I/O port 0x%04x write %02x\n",offset,data); + if(offset == 0x02) + m_videouart->write(space,0,data); +} + +READ8_MEMBER(wicat_state::video_ctrl_r) +{ + return 0x00; // TODO +} + +WRITE8_MEMBER(wicat_state::video_ctrl_w) +{ + if(offset == 0x07) + m_nmi_enable = data; +} + +READ8_MEMBER(wicat_state::video_status_r) +{ + // this port is read in the NVI IRQ routine, which if bit 2 is set, will unmask DMA channel 0. But no idea what triggers it... + if(m_crtc_irq == ASSERT_LINE) + { + m_crtc_irq = CLEAR_LINE; + m_videocpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE); + return 0x04; + } + else + return 0x00; +} + +WRITE_LINE_MEMBER(wicat_state::dma_hrq_w) +{ + m_videocpu->set_input_line(INPUT_LINE_HALT,state ? ASSERT_LINE : CLEAR_LINE); + m_videodma->hack_w(state); +} + +WRITE_LINE_MEMBER(wicat_state::dma_nmi_cb) +{ + if(state) + { + if(m_nmi_enable != 0) + m_videocpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); + } +} + +WRITE_LINE_MEMBER(wicat_state::kb_data_ready) +{ + m_video_kb_irq = state ? ASSERT_LINE : CLEAR_LINE; + m_videocpu->set_input_line(INPUT_LINE_IRQ0,m_video_kb_irq); +} + +WRITE_LINE_MEMBER(wicat_state::crtc_cb) +{ + m_crtc_irq = state ? ASSERT_LINE : CLEAR_LINE; + m_videocpu->set_input_line(INPUT_LINE_IRQ0,m_crtc_irq); +} + +I8275_DRAW_CHARACTER_MEMBER(wicat_state::wicat_display_pixels) +{ + UINT8 romdata = m_chargen->base()[((charcode << 4) | linecount) + 1]; + const pen_t *pen = m_palette->pens(); + + for (int i = 0; i < 8; i++) + { + int color = (romdata >> (7-i)) & 0x01; + + if(vsp || linecount > 9) + color = 0; + + bitmap.pix32(y, x + i) = pen[color]; + } +} + +static MACHINE_CONFIG_START( wicat, wicat_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_8MHz) + MCFG_CPU_PROGRAM_MAP(wicat_mem) + + MCFG_DEVICE_ADD("via", VIA6522, XTAL_8MHz) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(wicat_state, via_a_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(wicat_state, via_b_w)) + MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M68K_IRQ_1)) + + MCFG_DEVICE_ADD("rtc", MM58274C, 0) // actually an MM58174AN, but should be compatible + MCFG_MM58274C_MODE24(0) // 12 hour + MCFG_MM58274C_DAY1(1) // monday + + // internal terminal + MCFG_DEVICE_ADD("uart0", MC2661, XTAL_5_0688MHz) // connected to terminal board + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("videouart0", mc2661_device, rx_w)) + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("videouart0", mc2661_device, cts_w)) + MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("videouart0", mc2661_device, dsr_w)) + + // RS232C ports (x5) + MCFG_DEVICE_ADD("uart1", MC2661, XTAL_5_0688MHz) + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial1", rs232_port_device, write_txd)) + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial1", rs232_port_device, write_rts)) + MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial1", rs232_port_device, write_dtr)) + MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + + MCFG_DEVICE_ADD("uart2", MC2661, XTAL_5_0688MHz) + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial2", rs232_port_device, write_txd)) + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial2", rs232_port_device, write_rts)) + MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial2", rs232_port_device, write_dtr)) + + MCFG_DEVICE_ADD("uart3", MC2661, XTAL_5_0688MHz) + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial3", rs232_port_device, write_txd)) + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial3", rs232_port_device, write_rts)) + MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial3", rs232_port_device, write_dtr)) + MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + + MCFG_DEVICE_ADD("uart4", MC2661, XTAL_5_0688MHz) + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial4", rs232_port_device, write_txd)) + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial4", rs232_port_device, write_rts)) + MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial4", rs232_port_device, write_dtr)) + MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + + MCFG_DEVICE_ADD("uart5", MC2661, XTAL_5_0688MHz) + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial5", rs232_port_device, write_txd)) + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial5", rs232_port_device, write_rts)) + MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial5", rs232_port_device, write_dtr)) + MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + + // modem + MCFG_DEVICE_ADD("uart6", MC2661, XTAL_5_0688MHz) // connected to modem port + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) + + MCFG_RS232_PORT_ADD("serial1",default_rs232_devices,NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart1",mc2661_device,rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart1",mc2661_device,dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart1",mc2661_device,dsr_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart1",mc2661_device,cts_w)) + + MCFG_RS232_PORT_ADD("serial2",default_rs232_devices,NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart2",mc2661_device,rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart2",mc2661_device,dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart2",mc2661_device,dsr_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart2",mc2661_device,cts_w)) + + MCFG_RS232_PORT_ADD("serial3",default_rs232_devices,NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart3",mc2661_device,rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart3",mc2661_device,dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart3",mc2661_device,dsr_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart3",mc2661_device,cts_w)) + + MCFG_RS232_PORT_ADD("serial4",default_rs232_devices,NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart4",mc2661_device,rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart4",mc2661_device,dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart4",mc2661_device,dsr_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart4",mc2661_device,cts_w)) + + MCFG_RS232_PORT_ADD("serial5",default_rs232_devices,NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart5",mc2661_device,rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart5",mc2661_device,dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart5",mc2661_device,dsr_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart5",mc2661_device,cts_w)) + + /* video hardware */ + MCFG_CPU_ADD("videocpu",Z8002,XTAL_8MHz/2) // AMD AMZ8002DC + MCFG_CPU_PROGRAM_MAP(wicat_video_mem) + MCFG_CPU_IO_MAP(wicat_video_io) + + MCFG_DEVICE_ADD("videodma", AM9517A, XTAL_8MHz) // clock is a bit of guess + MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(wicat_state, dma_hrq_w)) + MCFG_AM9517A_OUT_EOP_CB(WRITELINE(wicat_state, dma_nmi_cb)) + MCFG_AM9517A_IN_MEMR_CB(READ8(wicat_state, vram_r)) + MCFG_AM9517A_OUT_MEMW_CB(WRITE8(wicat_state, vram_w)) + MCFG_AM9517A_OUT_IOW_0_CB(DEVWRITE8("video", i8275_device, dack_w)) + MCFG_IM6402_ADD("videouart", 0, 0) + MCFG_IM6402_DR_CALLBACK(WRITELINE(wicat_state, kb_data_ready)) + + // terminal (2x INS2651, 1x IM6042 - one of these is for the keyboard, another communicates with the main board, the third is unknown) + MCFG_DEVICE_ADD("videouart0", MC2661, XTAL_5_0688MHz) // the INS2651 looks similar enough to the MC2661... + MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("uart0", mc2661_device, rx_w)) + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("videocpu", INPUT_LINE_IRQ0)) + MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("uart0", mc2661_device, cts_w)) + MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("uart0", mc2661_device, dsr_w)) + + MCFG_DEVICE_ADD("videouart1", MC2661, XTAL_5_0688MHz) + MCFG_MC2661_RXC(19200) + MCFG_MC2661_TXC(19200) + MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("videocpu", INPUT_LINE_IRQ0)) + + MCFG_X2210_ADD("vsram") // XD2210 + + MCFG_SCREEN_ADD("screen",RASTER) + MCFG_SCREEN_SIZE(720,300) + MCFG_SCREEN_VISIBLE_AREA(0,720-1,0,300-1) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DEVICE("video",i8275_device,screen_update) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_DEVICE_ADD("video", I8275, XTAL_19_6608MHz/8) + MCFG_I8275_CHARACTER_WIDTH(9) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(wicat_state, wicat_display_pixels) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("videodma",am9517a_device, dreq0_w)) + MCFG_I8275_IRQ_CALLBACK(WRITELINE(wicat_state,crtc_cb)) + MCFG_VIDEO_SET_SCREEN("screen") + + MCFG_DEFAULT_LAYOUT(layout_wicat) + + /* Winchester Disk Controller (WD1000 + FD1795) */ + MCFG_CPU_ADD("wd1kcpu",N8X300,XTAL_8MHz) + MCFG_CPU_PROGRAM_MAP(wicat_wd1000_mem) + MCFG_CPU_IO_MAP(wicat_wd1000_io) + MCFG_FD1795_ADD("fdc",XTAL_8MHz) + + +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( wicat ) + ROM_REGION16_BE(0x4000, "c1", 0) + ROM_LOAD16_BYTE("wiboot.e", 0x00000, 0x0800, CRC(6f0f73c6) SHA1(be635bf3ffa1301f844a3d5560e278de46740d19) ) + ROM_LOAD16_BYTE("wiboot.o", 0x00001, 0x0800, CRC(b9763bbd) SHA1(68f497be56ff69534e17b41a40737cd6f708d65e) ) + ROM_LOAD16_BYTE("tpcnif.e", 0x01000, 0x0800, CRC(fd1127ec) SHA1(7c6b436c0cea41dbb23cb6bd9b9a5c21fa61d232) ) + ROM_LOAD16_BYTE("tpcnif.o", 0x01001, 0x0800, CRC(caa16e2a) SHA1(b3e64b676f50b65b3e365fc5f17eb1759c1310df) ) + ROM_LOAD16_BYTE("tpcf.e", 0x02000, 0x0800, CRC(d34be25c) SHA1(1b167918cbc19c9364f020176f4cc3722cba8434) ) + ROM_LOAD16_BYTE("tpcf.o", 0x02001, 0x0800, CRC(7712c570) SHA1(8743b7c98190ecf3bf7e917e6143b47b3b36db8d) ) + ROM_REGION(0x0060, "c1proms", 0) + ROM_LOAD ("cpu.8b", 0x00000, 0x0020, CRC(99b90665) SHA1(8a4677ea814e1843001fe28b284226b7291cdf76) ) + ROM_LOAD ("cpu.8c", 0x00020, 0x0020, CRC(190a55ad) SHA1(de8a847bff8c343d69b853a215e6ee775ef2ef96) ) + ROM_LOAD ("cpu.15c", 0x00040, 0x0020, CRC(ba2dd77d) SHA1(eb693d6d30aa6a9dba61c6c41a75614ed4e9e69a) ) + + // System 150 CPU/MU board + ROM_REGION16_BE(0x2000, "c2", 0) + ROM_SYSTEM_BIOS( 0, "cms", "CMS HD / Floppy Boot / Boot v1.56" ) + ROMX_LOAD("s156.a5", 0x00000, 0x0800, CRC(2c1e9542) SHA1(50184e04f0c881818e96e2162111d16304e8762f), ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD("s156.a7", 0x00001, 0x0800, CRC(5a0cb30d) SHA1(aa106ad5a8b9e89613f7ea026d62832cfdb19fd0), ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD("37m.b5", 0x01000, 0x0800, CRC(831571fb) SHA1(fcc647b3ef9f0cca3e8212f850f96676d24cf318), ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD("37m.b7", 0x01001, 0x0800, CRC(3c346e8e) SHA1(d8ff8297d265b25655c854ed8515fa9e16c63f39), ROM_SKIP(1) | ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "wd3", "WD3 HD Boot / Boot v1.56" ) + ROMX_LOAD("boot156.a5", 0x00000, 0x0800, CRC(58510a52) SHA1(d2135b056a04ba830b0ae1cef539e4a9a1b58f82), ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD("boot156.a7", 0x00001, 0x0800, CRC(e53999f1) SHA1(9c6c6a3a56b5c16a35e1fe824f37c8ae739ebcb9), ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD("wd3_15.b5", 0x01000, 0x0800, CRC(a765899b) SHA1(8427c564029914b7dbc29768ce451604180e390f), ROM_SKIP(1) | ROM_BIOS(2) ) + ROMX_LOAD("wd3_15.b7", 0x01001, 0x0800, CRC(9d986585) SHA1(1ac7579c692f827b121c56dac0a77b15400caba1), ROM_SKIP(1) | ROM_BIOS(2) ) + + // Terminal CPU board (Graphical) + // "MG8000 VERSION 3.0" + ROM_REGION16_BE(0x8000, "g1", 0) + ROM_LOAD16_BYTE("1term0.e", 0x00000, 0x0800, CRC(a9aade37) SHA1(644e9362d5a9523be5c6f39a650b574735dbd4a2) ) + ROM_LOAD16_BYTE("1term0.o", 0x00001, 0x0800, CRC(8026b5b7) SHA1(cb93e0595b321889694cbb87f497d244e6a2d648) ) + ROM_LOAD16_BYTE("1term1.e", 0x01000, 0x0800, CRC(e6ce8016) SHA1(fae987f1ac26d027ed176f8886832e87d1feae60) ) + ROM_LOAD16_BYTE("1term1.o", 0x01001, 0x0800, CRC(d71f763e) SHA1(b0a7f4cc90ce267aec7e72ad22a227f0c8c1f650) ) + ROM_LOAD16_BYTE("1term2.e", 0x02000, 0x0800, CRC(c0e82703) SHA1(7a17da13c01e15b61eea65b06d988ab8ba7eaaf3) ) + ROM_LOAD16_BYTE("1term2.o", 0x02001, 0x0800, CRC(aa0d5b4f) SHA1(b37c2e5220f4838a805b20a0ef21689067f1a759) ) + ROM_LOAD16_BYTE("1term3.e", 0x03000, 0x0800, CRC(cd33f4c8) SHA1(6603c5f2330a9a5ec1121a367cebe6e900a00cb0) ) + ROM_LOAD16_BYTE("1term3.o", 0x03001, 0x0800, CRC(05e56714) SHA1(0c31be3c9ec90a0858fe04a208e2627e4beb12b0) ) + ROM_LOAD16_BYTE("1term4.e", 0x04000, 0x0800, CRC(a157c61f) SHA1(59b7be6cd696b2508b5c1fd7b6e6f7cb5a9f12ab) ) + ROM_LOAD16_BYTE("1term4.o", 0x04001, 0x0800, CRC(364c1a95) SHA1(bfd62a71c9d8f83dc12a7dbbf362d18819380ef3) ) + ROM_LOAD16_BYTE("1term5.e", 0x05000, 0x0800, CRC(c2b8bc9e) SHA1(cd054988a9694b3a211e1993da1b3dc2c5e6fdc2) ) + ROM_LOAD16_BYTE("1term5.o", 0x05001, 0x0800, CRC(421e0521) SHA1(29b87938f5c25c05920ca2c14893700bc45a86c5) ) + ROM_LOAD16_BYTE("1term6.e", 0x06000, 0x0800, CRC(f0d14ed6) SHA1(840acc2b90e8d16df7e5d60c399b08ec0e126a88) ) + ROM_LOAD16_BYTE("1term6.o", 0x06001, 0x0800, CRC(e245ff49) SHA1(9a34e6cf6013b1044cccf26371cc3a000f17b58c) ) + ROM_LOAD16_BYTE("1term7.e", 0x07000, 0x0800, CRC(0c918550) SHA1(2ef6ce41cc2643d45c4bae31ce151d8b6c363471) ) + ROM_LOAD16_BYTE("1term7.o", 0x07001, 0x0800, CRC(71fdc692) SHA1(d6f12ec20ff2e4948f54b0c79f11ccbdc9db865c) ) + ROM_REGION(0x40, "vsram", 0) + ROM_LOAD ("ee8-82.bin", 0x00000, 0x0040, CRC(dfb4b0fb) SHA1(12304f5c5236791f5e931d9e49b4a70dcbba55c0) ) + + // "MG8000 VERSION 1.1" + ROM_REGION16_BE(0x8000, "g2", 0) + ROM_LOAD16_BYTE("2term0.e", 0x00000, 0x0800, CRC(29e5dd68) SHA1(9023f53d554b9ef4f4efc731645ba42f728bcd2c) ) + ROM_LOAD16_BYTE("2term0.o", 0x00001, 0x0800, CRC(91edd05d) SHA1(378b06fc8316199b7c580a6e7f28368dacdac5a9) ) + ROM_LOAD16_BYTE("2term1.e", 0x01000, 0x0800, CRC(2b48abe4) SHA1(4c9b4db1c1408b6551d50172dda994b36a2ee4b1) ) + ROM_LOAD16_BYTE("2term1.o", 0x01001, 0x0800, CRC(4c0e4f95) SHA1(bd49bf71fea1acfd50781820f0a650411b6f996b) ) + ROM_LOAD16_BYTE("2term2.e", 0x02000, 0x0800, CRC(3251324b) SHA1(e8f52308c9cbb9bcb5adb2685609d6a69b9eec1d) ) + ROM_LOAD16_BYTE("2term2.o", 0x02001, 0x0800, CRC(3a49c9e7) SHA1(0718b029ed316bc8e7bf22b0e94b6b5628758580) ) + ROM_LOAD16_BYTE("2term3.e", 0x03000, 0x0800, CRC(0f17be85) SHA1(9c40b4d06f3fb8def88b87615a590bb03dcfc4f4) ) + ROM_LOAD16_BYTE("2term3.o", 0x03001, 0x0800, CRC(08ae31c5) SHA1(2e53f87b6a4e0b973f7918d97f57f6560c651ab6) ) + ROM_LOAD16_BYTE("2term4.e", 0x04000, 0x0800, CRC(413936e7) SHA1(ce9d8666ca4e6847514bcf4de5703f0845e72928) ) + ROM_LOAD16_BYTE("2term4.o", 0x04001, 0x0800, CRC(06deab4e) SHA1(af5be7105a24d81dcc539296631b4309f7b8cb3f) ) + ROM_LOAD16_BYTE("2term5.e", 0x05000, 0x0800, CRC(7979bf59) SHA1(1bc397c58ce026fb90a02714d42df8f179a4f50e) ) + ROM_LOAD16_BYTE("2term5.o", 0x05001, 0x0800, CRC(e1f738ca) SHA1(bd8d7f1acb243880fd364f71097b9711de496739) ) + ROM_LOAD16_BYTE("2term6.e", 0x06000, 0x0800, CRC(bb04d70c) SHA1(0b482c2f06fe5e042a5813f027f5cf034d72e0dd) ) + ROM_LOAD16_BYTE("2term6.o", 0x06001, 0x0800, CRC(0afb566c) SHA1(761455ced46b6fccd0be9c8fa920f7954a36972b) ) + ROM_LOAD16_BYTE("2term7.e", 0x07000, 0x0800, CRC(033ea830) SHA1(27c33eea2df812a1a96e2f47ba7993e2ca3675ad) ) + ROM_LOAD16_BYTE("2term7.o", 0x07001, 0x0800, CRC(e157c5d2) SHA1(3cd1ea0fb9df1358e8a358468a4df5e4eaaa86a2) ) + ROM_REGION(0x40, "g2novram", 0) + ROM_LOAD ("ee2-2.bin", 0x00000, 0x0040, CRC(8f265118) SHA1(6bd74e3d01cf85cca1abcc15cb229dbd63022978) ) + + // Terminal Video board + ROM_REGION(0x1000, "g2char", 0) + ROM_LOAD ("ascii.chr", 0x00000, 0x0800, CRC(43e26e37) SHA1(f3d5d16040c66f0e827f72a35d4694ca62950949) ) + ROM_LOAD ("apl.chr", 0x00800, 0x0800, CRC(8c6d698e) SHA1(147dd9296fe2efc6140fa148a6edf673c33f9371) ) + + // Winchester Disk Controller (WD1000 (comprised of an 8X300 + some WD1100-xx bits), FD1795 (FDC)) + ROM_REGION16_BE(0x1800, "wd3", 0) + ROM_LOAD16_BYTE("wd3.u96", 0x00000, 0x0800, CRC(52736e61) SHA1(71c7c9170c733c483393969cb1cb3798b3eb980c) ) // 8X300 code even + ROM_LOAD16_BYTE("wd3.u97", 0x00001, 0x0800, CRC(a66619ec) SHA1(5d091ac7c88f2f45b4a05e78bfc7a16c206b31ff) ) // 8X300 code odd + ROM_LOAD ("wd3.u95", 0x01000, 0x0800, CRC(80bb0617) SHA1(ac0f3194fcbef77532571baa3fec78b3010528bf) ) // "Fast IO select" bytes +ROM_END + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, wicat, 0, 0, wicat, wicat, driver_device, 0, "Millennium Systems", "Wicat System 150", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/wildfire.c b/src/mame/drivers/wildfire.c new file mode 100644 index 00000000000..992fcbc544c --- /dev/null +++ b/src/mame/drivers/wildfire.c @@ -0,0 +1,343 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + Parker Brothers Wildfire, by Bob and Holly Doyle (prototype), and Garry Kitchen + * AMI S2150, labeled C10641 + + This is an electronic handheld pinball game. It has dozens of small leds + to create the illusion of a moving ball, and even the flippers are leds. + A drawing of a pinball table is added as overlay. + + NOTE!: MAME external artwork is required + + + TODO: + - sound emulation could still be improved + - when the game strobes a led faster, it should appear brighter, for example when + the ball hits one of the bumpers + - 7seg decoder is guessed + - MCU clock is unknown + +***************************************************************************/ + +#include "emu.h" +#include "cpu/amis2000/amis2000.h" +#include "sound/speaker.h" + +#include "wildfire.lh" // this is a test layout, use external artwork + +// master clock is a single stage RC oscillator: R=?K, C=?pf, +// S2000 default frequency is 850kHz +#define MASTER_CLOCK (850000) + + +class wildfire_state : public driver_device +{ +public: + wildfire_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_a12_decay_timer(*this, "a12_decay") + { } + + required_device m_maincpu; + required_device m_speaker; + required_device m_a12_decay_timer; + + UINT8 m_d; + UINT16 m_a; + UINT8 m_q2; + UINT8 m_q3; + + UINT16 m_display_state[0x10]; + UINT16 m_display_cache[0x10]; + UINT8 m_display_decay[0x100]; + + DECLARE_WRITE8_MEMBER(write_d); + DECLARE_WRITE16_MEMBER(write_a); + DECLARE_WRITE_LINE_MEMBER(write_f); + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + bool index_is_7segled(int index); + void display_update(); + + TIMER_DEVICE_CALLBACK_MEMBER(reset_q2); + void write_a12(int state); + void sound_update(); + + virtual void machine_start(); +}; + + + +/*************************************************************************** + + LED Display + +***************************************************************************/ + +// The device strobes the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +// decay time, in steps of 1ms +#define DISPLAY_DECAY_TIME 40 + +inline bool wildfire_state::index_is_7segled(int index) +{ + // first 3 A are 7segleds + return (index < 3); +} + +// lamp translation table: Lzz from patent US4334679 FIG.4 = MAME lampxxy, +// where xx is led column and y is led row, eg. lamp103 is output A10 D3 +// (note: 2 mistakes in the patent: the L19 between L12 and L14 should be L13, and L84 should of course be L48) +/* + L0 = - L10 = lamp60 L20 = lamp41 L30 = lamp53 L40 = lamp57 L50 = lamp110 + L1 = lamp107 L11 = lamp50 L21 = lamp42 L31 = lamp43 L41 = lamp66 L51 = lamp111 + L2 = lamp106 L12 = lamp61 L22 = lamp52 L32 = lamp54 L42 = lamp76 L52 = lamp112 + L3 = lamp105 L13 = lamp71 L23 = lamp63 L33 = lamp55 L43 = lamp86 L53 = lamp113 + L4 = lamp104 L14 = lamp81 L24 = lamp73 L34 = lamp117 L44 = lamp96 L60 = lamp30 + L5 = lamp103 L15 = lamp92 L25 = lamp115 L35 = lamp75 L45 = lamp67 L61 = lamp30(!) + L6 = lamp102 L16 = lamp82 L26 = lamp93 L36 = lamp95 L46 = lamp77 L62 = lamp31 + L7 = lamp101 L17 = lamp72 L27 = lamp94 L37 = lamp56 L47 = lamp87 L63 = lamp31(!) + L8 = lamp80 L18 = lamp114 L28 = lamp84 L38 = lamp65 L48 = lamp97 L70 = lamp33 + L9 = lamp70 L19 = lamp51 L29 = lamp116 L39 = lamp85 L49 = - +*/ + +void wildfire_state::display_update() +{ + UINT16 active_state[0x10]; + + for (int i = 0; i < 0x10; i++) + { + // update current state + m_display_state[i] = (m_a >> i & 1) ? m_d : 0; + + active_state[i] = 0; + + for (int j = 0; j < 0x10; j++) + { + int di = j << 4 | i; + + // turn on powered segments + if (m_display_state[i] >> j & 1) + m_display_decay[di] = DISPLAY_DECAY_TIME; + + // determine active state + int ds = (m_display_decay[di] != 0) ? 1 : 0; + active_state[i] |= (ds << j); + } + } + + // on difference, send to output + for (int i = 0; i < 0x10; i++) + if (m_display_cache[i] != active_state[i]) + { + if (index_is_7segled(i)) + output_set_digit_value(i, BITSWAP8(active_state[i],7,0,1,2,3,4,5,6) & 0x7f); + + for (int j = 0; j < 8; j++) + output_set_lamp_value(i*10 + j, active_state[i] >> j & 1); + } + + memcpy(m_display_cache, active_state, sizeof(m_display_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(wildfire_state::display_decay_tick) +{ + // slowly turn off unpowered segments + for (int i = 0; i < 0x100; i++) + if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i]) + m_display_decay[i]--; + + display_update(); +} + + + +/*************************************************************************** + + Sound + +***************************************************************************/ + +// Sound output is via a speaker between transistors Q2(from A12) and Q3(from F_out) +// A12 to Q2 has a little electronic circuit going, causing a slight delay. +// (see patent US4334679 FIG.5, the 2 resistors are 10K and the cap is a 4.7uF electrolytic) + +// decay time, in steps of 1ms +#define A12_DECAY_TIME 5 /* a complete guess */ + +void wildfire_state::sound_update() +{ + m_speaker->level_w(m_q2 & m_q3); +} + +WRITE_LINE_MEMBER(wildfire_state::write_f) +{ + // F_out pin: speaker out + m_q3 = (state) ? 1 : 0; + sound_update(); +} + +TIMER_DEVICE_CALLBACK_MEMBER(wildfire_state::reset_q2) +{ + m_q2 = 0; + sound_update(); +} + +void wildfire_state::write_a12(int state) +{ + if (state) + { + m_a12_decay_timer->adjust(attotime::never); + m_q2 = state; + sound_update(); + } + else if (m_a >> 12 & 1) + { + // falling edge + m_a12_decay_timer->adjust(attotime::from_msec(A12_DECAY_TIME)); + } +} + + + +/*************************************************************************** + + I/O + +***************************************************************************/ + +WRITE8_MEMBER(wildfire_state::write_d) +{ + // D0-D7: leds out + m_d = data; + display_update(); +} + +WRITE16_MEMBER(wildfire_state::write_a) +{ + data ^= 0x1fff; // active-low + + // A12: enable speaker + write_a12(data >> 12 & 1); + + // A0-A2: select 7segleds + // A3-A11: select other leds + m_a = data; + display_update(); +} + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +static INPUT_PORTS_START( wildfire ) + PORT_START("IN1") // I + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Shooter Button") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Left Flipper") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Right Flipper") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +void wildfire_state::machine_start() +{ + // zerofill + memset(m_display_state, 0, sizeof(m_display_state)); + memset(m_display_cache, 0, sizeof(m_display_cache)); + memset(m_display_decay, 0, sizeof(m_display_decay)); + + m_d = 0; + m_a = 0; + m_q2 = 0; + m_q3 = 0; + + // register for savestates + save_item(NAME(m_display_state)); + save_item(NAME(m_display_cache)); + save_item(NAME(m_display_decay)); + + save_item(NAME(m_d)); + save_item(NAME(m_a)); + save_item(NAME(m_q2)); + save_item(NAME(m_q3)); +} + +// LED segments A-G +enum +{ + lA = 0x40, + lB = 0x20, + lC = 0x10, + lD = 0x08, + lE = 0x04, + lF = 0x02, + lG = 0x01 +}; + +static const UINT8 wildfire_7seg_table[0x10] = +{ + 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, // 0-9 unaltered + 0x77, // A -> unused? + lA+lB+lE+lF+lG, // b -> P + 0x4e, // C -> unused? + lD+lE+lF, // d -> L + 0x4f, // E -> unused? + lG // F -> - +}; + + +static MACHINE_CONFIG_START( wildfire, wildfire_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", AMI_S2152, MASTER_CLOCK) + MCFG_AMI_S2000_7SEG_DECODER(wildfire_7seg_table) + MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1")) + MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d)) + MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a)) + MCFG_AMI_S2152_FOUT_CB(WRITELINE(wildfire_state, write_f)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", wildfire_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD("a12_decay", wildfire_state, reset_q2) + + MCFG_DEFAULT_LAYOUT(layout_wildfire) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( wildfire ) + ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "us4341385", 0x0000, 0x0400, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums) + ROM_CONTINUE( 0x0600, 0x0200 ) +ROM_END + + +CONS( 1979, wildfire, 0, 0, wildfire, wildfire, driver_device, 0, "Parker Brothers", "Wildfire (patent)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) // note: pretty sure that it matches the commercial release diff --git a/src/mame/drivers/wswan.c b/src/mame/drivers/wswan.c new file mode 100644 index 00000000000..be33de5b961 --- /dev/null +++ b/src/mame/drivers/wswan.c @@ -0,0 +1,185 @@ +// license:BSD-3-Clause +// copyright-holders:Anthony Kruize,Wilbert Pol +/*************************************************************************** + + wswan.c + + Driver file to handle emulation of the Bandai WonderSwan + By: + + Anthony Kruize + Wilbert Pol + + Based on the WStech documentation by Judge and Dox. + + Known issues/TODOs: + - Get the V30MZ core into MAME, still need to remove some nec specific + instructions and fix the flags handling of the div/mul instructions. + - Add support for noise sound + - Add support for voice sound + - Add support for enveloped sound + - Perform video DMA at proper timing. + - Add sound DMA. + - Setup some reasonable values in the internal EEPROM area? + - Add (real/proper) RTC support. + - Look into timing issues like in Puzzle Bobble. VBlank interrupt lasts very long + which causes sprites to be disabled until about 10%-40% of drawing the screen. + The real unit seems to display things fine, need a real unit + real cart to + verify. + - Is background color setting really ok? + - Get a dump of the internal BIOSes. + - Swan Crystal can handle up to 512Mbit ROMs?????? + + +***************************************************************************/ + +#include "includes/wswan.h" +#include "wswan.lh" + +static ADDRESS_MAP_START (wswan_mem, AS_PROGRAM, 8, wswan_state) + AM_RANGE(0x00000, 0x03fff) AM_DEVREADWRITE("vdp", wswan_video_device, vram_r, vram_w) // 16kb RAM / 4 colour tiles + AM_RANGE(0x04000, 0x0ffff) AM_NOP // nothing + //AM_RANGE(0x10000, 0xeffff) // cart range, setup at machine_start + AM_RANGE(0xf0000, 0xfffff) AM_READ(bios_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START (wscolor_mem, AS_PROGRAM, 8, wswan_state) + AM_RANGE(0x00000, 0x0ffff) AM_DEVREADWRITE("vdp", wswan_video_device, vram_r, vram_w) // 16kb RAM / 4 colour tiles, 16 colour tiles + palettes + //AM_RANGE(0x10000, 0xeffff) // cart range, setup at machine_start + AM_RANGE(0xf0000, 0xfffff) AM_READ(bios_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START (wswan_io, AS_IO, 8, wswan_state) + AM_RANGE(0x00, 0xff) AM_READWRITE(port_r, port_w) // I/O ports +ADDRESS_MAP_END + +static INPUT_PORTS_START( wswan ) + PORT_START("CURSX") + PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("X1 - Up") + PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("X3 - Down") + PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("X4 - Left") + PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("X2 - Right") + + PORT_START("BUTTONS") + PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start") + PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Button A") + PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Button B") + + PORT_START("CURSY") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y1 - Up") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y3 - Down") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y4 - Left") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y2 - Right") PORT_CODE(KEYCODE_D) +INPUT_PORTS_END + +static GFXDECODE_START( wswan ) +GFXDECODE_END + +/* WonderSwan can display 16 shades of grey */ +PALETTE_INIT_MEMBER(wswan_state, wswan) +{ + for (int i = 0; i < 16; i++) + { + UINT8 shade = i * (256 / 16); + palette.set_pen_color(15 - i, shade, shade, shade); + } +} + +PALETTE_INIT_MEMBER(wswan_state, wscolor) +{ + for (int i = 0; i < 4096; i++) + { + int r = (i & 0x0f00) >> 8; + int g = (i & 0x00f0) >> 4; + int b = i & 0x000f; + palette.set_pen_color(i, r << 4, g << 4, b << 4); + } +} + +static SLOT_INTERFACE_START(wswan_cart) + SLOT_INTERFACE_INTERNAL("ws_rom", WS_ROM_STD) + SLOT_INTERFACE_INTERNAL("ws_sram", WS_ROM_SRAM) + SLOT_INTERFACE_INTERNAL("ws_eeprom", WS_ROM_EEPROM) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( wswan, wswan_state ) + /* Basic machine hardware */ + MCFG_CPU_ADD("maincpu", V30MZ, 3072000) + MCFG_CPU_PROGRAM_MAP(wswan_mem) + MCFG_CPU_IO_MAP(wswan_io) + + MCFG_DEVICE_ADD("vdp", WSWAN_VIDEO, 0) + MCFG_WSWAN_VIDEO_TYPE(VDP_TYPE_WSWAN) + MCFG_WSWAN_VIDEO_IRQ_CB(wswan_state, set_irq_line) + MCFG_WSWAN_VIDEO_DMASND_CB(wswan_state, dma_sound_cb) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(75) + MCFG_SCREEN_VBLANK_TIME(0) + MCFG_SCREEN_UPDATE_DEVICE("vdp", wswan_video_device, screen_update) + MCFG_SCREEN_SIZE(WSWAN_X_PIXELS, WSWAN_Y_PIXELS) + MCFG_SCREEN_VISIBLE_AREA(0*8, WSWAN_X_PIXELS - 1, 0, WSWAN_Y_PIXELS - 1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_wswan) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_NVRAM_ADD_1FILL("nvram") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", wswan) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_INIT_OWNER(wswan_state, wswan) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("custom", WSWAN_SND, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + + /* cartridge */ + MCFG_WSWAN_CARTRIDGE_ADD("cartslot", wswan_cart, NULL) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list","wswan") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("wsc_list","wscolor") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( wscolor, wswan ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(wscolor_mem) + MCFG_MACHINE_START_OVERRIDE(wswan_state, wscolor) + + MCFG_DEVICE_MODIFY("vdp") + MCFG_WSWAN_VIDEO_TYPE(VDP_TYPE_WSC) + + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_ENTRIES(4096) + MCFG_PALETTE_INIT_OWNER(wswan_state, wscolor) + + /* software lists */ + MCFG_DEVICE_REMOVE("cart_list") + MCFG_DEVICE_REMOVE("wsc_list") + MCFG_SOFTWARE_LIST_ADD("cart_list","wscolor") + MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ws_list","wswan") +MACHINE_CONFIG_END + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( wswan ) + ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) +// ROM_LOAD_OPTIONAL( "ws_bios.bin", 0x0000, 0x0001, NO_DUMP ) +ROM_END + +ROM_START( wscolor ) + ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) +// ROM_LOAD_OPTIONAL( "wsc_bios.bin", 0x0000, 0x0001, NO_DUMP ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME*/ +CONS( 1999, wswan, 0, 0, wswan, wswan, driver_device, 0, "Bandai", "WonderSwan", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +CONS( 2000, wscolor, wswan, 0, wscolor, wswan, driver_device, 0, "Bandai", "WonderSwan Color", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/x07.c b/src/mame/drivers/x07.c new file mode 100644 index 00000000000..c676cb42a27 --- /dev/null +++ b/src/mame/drivers/x07.c @@ -0,0 +1,1568 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Canon X-07 + + Driver by Sandro Ronco based on X-07 emu by J.Brigaud + + TODO: + - move T6834 in a device + - better emulation of the i/o ports + - external video (need X-720 dump) + - serial port + + Memory Map + + 0x0000 - 0x1fff Internal RAM + 0x2000 - 0x3fff External RAM Card + 0x4000 - 0x5fff Extension ROM/RAM + 0x6000 - 0x7fff ROM Card + 0x8000 - 0x97ff Video RAM + 0x9800 - 0x9fff ? + 0xa000 - 0xafff TV ROM (no dump) + 0xb000 - 0xffff ROM + + CPU was actually a NSC800 (Z80 compatible) + More info: http://www.silicium.org/oldskool/calc/x07/ + +****************************************************************************/ + +#include "includes/x07.h" + +/*************************************************************************** + T6834 IMPLEMENTATION +***************************************************************************/ + +void x07_state::t6834_cmd (UINT8 cmd) +{ + switch (cmd) + { + case 0x00: //NOP??? + break; + + case 0x01: //DATA$ TIME$ read + { + system_time systime; + machine().current_datetime(systime); + m_out.data[m_out.write++] = (systime.local_time.year>>8) & 0xff; + m_out.data[m_out.write++] = systime.local_time.year & 0xff; + m_out.data[m_out.write++] = systime.local_time.month + 1; + m_out.data[m_out.write++] = systime.local_time.mday; + m_out.data[m_out.write++] = ~(((0x01 << (7 - systime.local_time.weekday)) - 1) & 0xff); + m_out.data[m_out.write++] = systime.local_time.hour; + m_out.data[m_out.write++] = systime.local_time.minute; + m_out.data[m_out.write++] = systime.local_time.second; + } + break; + + case 0x02: //STICK + { + UINT8 data; + + switch (ioport("S1")->read() & 0x3c) + { + case 0x04: data = 0x33; break; //right + case 0x08: data = 0x37; break; //left + case 0x10: data = 0x31; break; //up + case 0x20: data = 0x35; break; //down + default: data = 0x30; break; + } + m_out.data[m_out.write++] = data; + } + break; + + case 0x03: //STRIG(0) + { + m_out.data[m_out.write++] = (ioport("S6")->read() & 0x20 ? 0x00 : 0xff); + } + break; + + case 0x04: //STRIG(1) + { + m_out.data[m_out.write++] = (ioport("S1")->read() & 0x40 ? 0x00 : 0xff); + } + break; + + case 0x05: //T6834 RAM read + { + UINT16 address; + UINT8 data; + address = m_in.data[m_in.read++]; + address |= (m_in.data[m_in.read++] << 8); + + if(address == 0xc00e) + data = 0x0a; + else if(address == 0xd000) + data = ioport("BATTERY")->read(); + else + data = m_t6834_ram[address & 0x7ff]; + + m_out.data[m_out.write++] = data; + } + break; + + case 0x06: //T6834 RAM write + { + UINT16 address; + UINT8 data; + data = m_in.data[m_in.read++]; + address = m_in.data[m_in.read++]; + address |= (m_in.data[m_in.read++] << 8); + + m_t6834_ram[address & 0x7ff] = data; + } + break; + + case 0x07: //scroll set + { + m_scroll_min = m_in.data[m_in.read++]; + m_scroll_max = m_in.data[m_in.read++]; + } + break; + + case 0x08: //scroll exec + { + if(m_scroll_min <= m_scroll_max && m_scroll_max < 4) + { + for(int i = m_scroll_min * 8; i < m_scroll_max * 8; i++) + memcpy(&m_lcd_map[i][0], &m_lcd_map[i + 8][0], 120); + + for(int i = m_scroll_max * 8; i < (m_scroll_max + 1) * 8; i++) + memset(&m_lcd_map[i][0], 0, 120); + } + } + break; + + case 0x09: //line clear + { + UINT8 line = m_in.data[m_in.read++] & 3; + for(UINT8 l = line * 8; l < (line + 1) * 8; l++) + memset(&m_lcd_map[l][0], 0, 120); + } + break; + + case 0x0a: //DATA$ TIME$ write + break; + + case 0x0b: //calendar + { + system_time systime; + machine().current_datetime(systime); + m_out.data[m_out.write++] = systime.local_time.weekday; + } + break; + + case 0x0c: //ALM$ write + { + for(int i = 0; i < 8; i++) + m_alarm[i] = m_in.data[m_in.read++]; + } + break; + + case 0x0d: //buzzer on + case 0x0e: //buzzer off + break; + + case 0x0f: //read LCD line + { + UINT8 line = m_in.data[m_in.read++]; + for(int i = 0; i < 120; i++) + m_out.data[m_out.write++] = (line < 32) ? m_lcd_map[line][i] : 0; + } + break; + + case 0x10: //read LCD point + { + UINT8 x = m_in.data[m_in.read++]; + UINT8 y = m_in.data[m_in.read++]; + if(x < 120 && y < 32) + m_out.data[m_out.write++] = (m_lcd_map[y][x] ? 0xff : 0); + else + m_out.data[m_out.write++] = 0; + } + break; + + case 0x11: //PSET + { + UINT8 x = m_in.data[m_in.read++]; + UINT8 y = m_in.data[m_in.read++]; + draw_point(x, y, 1); + } + break; + + case 0x12: //PRESET + { + UINT8 x = m_in.data[m_in.read++]; + UINT8 y = m_in.data[m_in.read++]; + draw_point(x, y, 0); + } + break; + + case 0x13: //PEOR + { + UINT8 x = m_in.data[m_in.read++]; + UINT8 y = m_in.data[m_in.read++]; + if(x < 120 && y < 32) + m_lcd_map[y][x] = !m_lcd_map[y][x]; + } + break; + + case 0x14: //Line + { + UINT8 delta_x, delta_y, step_x, step_y, next_x, next_y, p1, p2, p3, p4; + INT16 frac; + next_x = p1 = m_in.data[m_in.read++]; + next_y = p2 = m_in.data[m_in.read++]; + p3 = m_in.data[m_in.read++]; + p4 = m_in.data[m_in.read++]; + delta_x = abs(p3 - p1) * 2; + delta_y = abs(p4 - p2) * 2; + step_x = (p3 < p1) ? -1 : 1; + step_y = (p4 < p2) ? -1 : 1; + + if(delta_x > delta_y) + { + frac = delta_y - delta_x / 2; + while(next_x != p3) + { + if(frac >= 0) + { + next_y += step_y; + frac -= delta_x; + } + next_x += step_x; + frac += delta_y; + draw_point(next_x, next_y, 0x01); + } + } + else { + frac = delta_x - delta_y / 2; + while(next_y != p4) + { + if(frac >= 0) + { + next_x += step_x; + frac -= delta_y; + } + next_y += step_y; + frac += delta_x; + draw_point(next_x, next_y, 0x01); + } + } + draw_point(p1, p2, 0x01); + draw_point(p3, p4, 0x01); + } + break; + + case 0x15: //Circle + { + UINT8 p1 = m_in.data[m_in.read++]; + UINT8 p2 = m_in.data[m_in.read++]; + UINT8 p3 = m_in.data[m_in.read++]; + + for(int x = 0, y = p3; x <= sqrt((double)(p3 * p3) / 2) ; x++) + { + /* + * The old code produced results most likely not intended: + * UINT32 d1 = (x * x + y * y) - p3 * p3; + * UINT32 d2 = (x * x + (y - 1) * (y - 1)) - p3 * p3; + * if(abs((double)d1) > abs((double)d2)) + * + * (double)(-1) = 4294967294.000000 + * abs((double)(-1)) = -2147483648; + * + * Therefore changed. + */ + INT32 d1 = (x * x + y * y) - p3 * p3; + INT32 d2 = (x * x + (y - 1) * (y - 1)) - p3 * p3; + if (abs(d1) > abs(d2)) + y--; + draw_point(x + p1, y + p2, 0x01); + draw_point(x + p1, -y + p2, 0x01); + draw_point(-x + p1, y + p2, 0x01); + draw_point(-x + p1, -y + p2, 0x01); + draw_point(y + p1, x + p2, 0x01); + draw_point(y + p1, -x + p2, 0x01); + draw_point(-y + p1, x + p2, 0x01); + draw_point(-y + p1, -x + p2, 0x01); + } + } + break; + + case 0x16: //UDK write + { + UINT8 pos = m_in.data[m_in.read++] - 1; + UINT8 udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; + + for(int i = 0; i < udk_size; i++) + { + UINT8 udk_char = m_in.data[m_in.read++]; + m_t6834_ram[udk_offset[pos] + i] = udk_char; + if(!udk_char) break; + } + } + break; + + case 0x17: //UDK read + { + UINT8 pos = m_in.data[m_in.read++] - 1; + UINT8 udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; + + for(int i = 0; i < udk_size; i++) + { + UINT8 udk_char = m_t6834_ram[udk_offset[pos] + i]; + m_out.data[m_out.write++] = udk_char; + if(!udk_char) break; + } + } + break; + + case 0x18: //UDK on + case 0x19: //UDK off + m_udk_on = !BIT(cmd,0); + break; + + case 0x1a: //UDC write + { + UINT8 udc_code = m_in.data[m_in.read++]; + + if(udc_code>=128 && udc_code<=159) + for(int i = 0; i < 8; i++) + m_t6834_ram[(udc_code<<3) + i - 0x200] = m_in.data[m_in.read++]; + else if(udc_code>=224) + for(int i = 0; i < 8; i++) + m_t6834_ram[(udc_code<<3) + i - 0x400] = m_in.data[m_in.read++]; + } + break; + + case 0x1b: //UDC read + { + UINT16 address = m_in.data[m_in.read++] << 3; + for(int i = 0; i < 8; i++) + m_out.data[m_out.write++] = get_char(address + i); + } + break; + case 0x1c: //UDC Init + { + memcpy(m_t6834_ram + 0x200, (UINT8*)memregion("gfx1")->base() + 0x400, 0x100); + memcpy(m_t6834_ram + 0x300, (UINT8*)memregion("gfx1")->base() + 0x700, 0x100); + } + break; + + case 0x1d: //start program write + { + for(int i = 0; i < 0x80; i++) + { + UINT8 sp_char = m_in.data[m_in.read++]; + m_t6834_ram[0x500 + i] = sp_char; + if (!sp_char) break; + } + } + break; + + case 0x1e: //start program write cont + { + for(int i = (int)strlen((char*)&m_t6834_ram[0x500]); i < 0x80; i++) + { + UINT8 sp_char = m_in.data[m_in.read++]; + m_t6834_ram[0x500 + i] = sp_char; + if (!sp_char) break; + } + } + break; + + case 0x1f: //start program on + case 0x20: //start program off + m_sp_on = BIT(cmd, 0); + break; + + case 0x21: //start program read + { + for(int i = 0; i < 0x80; i++) + { + UINT8 sp_data = m_t6834_ram[0x500 + i]; + m_out.data[m_out.write++] = sp_data; + if (!sp_data) break; + } + } + break; + + case 0x22: //ON state + m_out.data[m_out.write++] = 0x04 | (m_sleep<<6) | m_warm_start; + break; + + case 0x23: //OFF + m_warm_start = 1; + m_sleep = 0; + m_lcd_on = 0; + break; + + case 0x24: //locate + { + UINT8 x = m_in.data[m_in.read++]; + UINT8 y = m_in.data[m_in.read++]; + UINT8 char_code = m_in.data[m_in.read++]; + m_locate.on = (m_locate.x != x || m_locate.y != y); + m_locate.x = m_cursor.x = x; + m_locate.y = m_cursor.y = y; + + if(char_code) + draw_char(x, y, char_code); + } + break; + + case 0x25: //cursor on + case 0x26: //cursor off + m_cursor.on = BIT(cmd, 0); + break; + + case 0x27: //test key + { + static const char *const lines[] = {"S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "BZ", "A1"}; + UINT16 matrix; + UINT8 data = 0; + matrix = m_in.data[m_in.read++]; + matrix |= (m_in.data[m_in.read++] << 8); + + for (int i=0 ;i<10; i++) + if (matrix & (1<read(); + + m_out.data[m_out.write++] = data; + } + break; + + case 0x28: //test chr + { + UINT8 idx = kb_get_index(m_in.data[m_in.read++]); + m_out.data[m_out.write++] = (ioport(x07_keycodes[idx].tag)->read() & x07_keycodes[idx].mask) ? 0x00 : 0xff; + } + break; + + case 0x29: //init sec + case 0x2a: //init date + break; + + case 0x2b: //LCD off + case 0x2c: //LCD on + m_lcd_on = !BIT(cmd,0); + break; + + case 0x2d: //KB buffer clear + memset(m_t6834_ram + 0x400, 0, 0x100); + m_kb_size = 0; + break; + + case 0x2e: //CLS + memset(m_lcd_map, 0, sizeof(m_lcd_map)); + break; + + case 0x2f: //home + m_cursor.x = m_cursor.y = 0; + break; + + case 0x30: //draw UDK on + case 0x31: //draw UDK off + { + m_draw_udk = !BIT(cmd,0); + + if (m_draw_udk) + draw_udk(); + else + for(UINT8 l = 3 * 8; l < (3 + 1) * 8; l++) + memset(&m_lcd_map[l][0], 0, 120); + } + break; + + case 0x32: //repeat key on + case 0x33: //repeat key off + m_repeat_key = !BIT(cmd,0); + break; + + case 0x34: //UDK KANA + break; + + case 0x35: //UDK cont write + { + UINT8 pos = m_in.data[m_in.read++] - 1; + UINT8 udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; + + for(int i = (int)strlen((char*)&m_t6834_ram[udk_offset[pos]]); i < udk_size; i++) + { + UINT8 udk_char = m_in.data[m_in.read++]; + m_t6834_ram[udk_offset[pos] + i] = udk_char; + if(!udk_char) break; + } + } + break; + + case 0x36: //alarm read + { + for(int i = 0; i < 8; i++) + m_out.data[m_out.write++] = m_alarm[i]; + } + break; + + case 0x37: // buzzer zero + m_out.data[m_out.write++] = 0xff; + break; + + case 0x38: //click off + case 0x39: //click on + break; + + case 0x3a: //Locate Close + break; + + case 0x3b: // keyboard on + case 0x3c: // keyboard off + m_kb_on = BIT(cmd, 0); + break; + + case 0x3d: //run start program after power on + case 0x3e: //run start program before power off + break; + + case 0x3f: //Sleep + m_warm_start = 1; + m_lcd_on = 0; + m_sleep = 1; + break; + + case 0x40: //UDK init + { + memset(m_t6834_ram, 0, 0x200); + for(int i = 0; i < 12; i++) + strcpy((char*)m_t6834_ram + udk_offset[i], udk_ini[i]); + } + break; + + case 0x41: //char wrire + { + for(int cy = 0; cy < 8; cy++) + { + UINT8 cl = m_in.data[m_in.read++]; + + for(int cx = 0; cx < 6; cx++) + m_lcd_map[m_cursor.y * 8 + cy][m_cursor.x * 6 + cx] = (cl & (0x80>>cx)) ? 1 : 0; + } + } + break; + + case 0x42: //char read + { + for(int cy = 0; cy < 8; cy++) + { + UINT8 cl = 0x00; + + for(int cx = 0; cx < 6; cx++) + cl |= (m_lcd_map[m_cursor.y * 8 + cy][m_cursor.x * 6 + cx] != 0) ? (1<<(7-cx)) : 0; + + m_out.data[m_out.write++] = cl; + } + } + break; + + case 0x43: //ScanR + case 0x44: //ScanL + { + m_out.data[m_out.write++] = 0; + m_out.data[m_out.write++] = 0; + } + break; + + case 0x45: //TimeChk + case 0x46: //AlmChk + m_out.data[m_out.write++] = 0; + break; + default: + logerror( "T6834 unimplemented command %02x encountered\n", cmd ); + } +} + + +void x07_state::t6834_r () +{ + m_out.read++; + m_regs_r[2] &= 0xfe; + if(m_out.write > m_out.read) + { + m_regs_r[0] = 0x40; + m_regs_r[1] = m_out.data[m_out.read]; + m_regs_r[2] |= 0x01; + m_maincpu->set_input_line(NSC800_RSTA, ASSERT_LINE); + m_rsta_clear->adjust(attotime::from_msec(50)); + } +} + + +void x07_state::t6834_w () +{ + if (!m_in.write) + { + if (m_locate.on && ((m_regs_w[1] & 0x7F) != 0x24) && ((m_regs_w[1]) >= 0x20) && ((m_regs_w[1]) < 0x80)) + { + m_cursor.x++; + draw_char(m_cursor.x, m_cursor.y, m_regs_w[1]); + } + else + { + m_locate.on = 0; + + if ((m_regs_w[1] & 0x7f) < 0x47) + { + m_in.data[m_in.write++] = m_regs_w[1] & 0x7f; + } + } + } + else + { + m_in.data[m_in.write++] = m_regs_w[1]; + + if (m_in.write == 2) + { + if (m_in.data[m_in.read] == 0x0c && m_regs_w [1] == 0xb0) + { + memset(m_lcd_map, 0, sizeof(m_lcd_map)); + m_in.write = 0; + m_in.read = 0; + m_in.data[m_in.write++] = m_regs_w[1] & 0x7f; + } + + if (m_in.data[m_in.read] == 0x07 && m_regs_w [1] > 4) + { + m_in.write = 0; + m_in.read = 0; + m_in.data[m_in.write++] = m_regs_w[1] & 0x7f; + } + } + } + + if (m_in.write) + { + UINT8 cmd_len = t6834_cmd_len[m_in.data[m_in.read]]; + if(cmd_len & 0x80) + { + if((cmd_len & 0x7f) < m_in.write && !m_regs_w[1]) + cmd_len = m_in.write; + } + + if(m_in.write == cmd_len) + { + m_out.write = 0; + m_out.read = 0; + t6834_cmd(m_in.data[m_in.read++]); + m_in.write = 0; + m_in.read = 0; + if(m_out.write) + { + m_regs_r[0] = 0x40; + m_regs_r[1] = m_out.data[m_out.read]; + m_regs_r[2] |= 0x01; + m_maincpu->set_input_line(NSC800_RSTA, ASSERT_LINE); + m_rsta_clear->adjust(attotime::from_msec(50)); + } + } + } +} + +void x07_state::cassette_r() +{ + m_regs_r[6] &= ~2; +} + +void x07_state::cassette_w() +{ + m_regs_r[6] &= ~1; + m_cass_data = m_regs_w[7]; +} + +TIMER_CALLBACK_MEMBER(x07_state::cassette_tick) +{ + m_cass_clk++; +} + +TIMER_CALLBACK_MEMBER(x07_state::cassette_poll) +{ + if ((m_cassette->get_state() & 0x03) == CASSETTE_PLAY) + cassette_load(); + else if ((m_cassette->get_state() & 0x03) == CASSETTE_RECORD) + cassette_save(); +} + +void x07_state::cassette_load() +{ + int cass = (m_cassette->input() >= 0) ? +1 : -1; + if (cass > 0 && m_cass_state < 0) + { + if ((m_cass_clk & 0x7f) >= 4 && (m_cass_clk & 0x7f) <= 6) + { + if (m_cass_clk & 0x80) + { + m_cass_clk = 0; + receive_bit(1); + } + else + { + m_cass_clk = 0x80; + } + } + else if ((m_cass_clk & 0x7f) >= 9 && (m_cass_clk & 0x7f) <= 11) + { + m_cass_clk = 0; + receive_bit(0); + } + else + { + m_cass_clk = 0; + logerror("Invalid data: %d %f\n", (m_cass_clk & 0x7f), m_cassette->get_position()); + } + + m_cass_tick->adjust(attotime::from_hz(12000), 0, attotime::from_hz(12000)); + } + + m_cass_state = cass; +} + + +void x07_state::cassette_save() +{ + int cass = m_cass_state; + + if (m_cass_clk % 10 == 0) + { + if (m_bit_count < 4) + { + switch (m_bit_count & 3) + { + case 0: case 1: cass = +1; break; + case 2: case 3: cass = -1; break; + } + + m_bit_count++; + } + else if (m_bit_count < 36) + { + switch (m_bit_count & 3) + { + case 0: cass = +1; break; + case 1: cass = (m_cass_data & 1) ? -1 : +1; break; + case 2: cass = (m_cass_data & 1) ? +1 : -1; break; + case 3: cass = -1; m_cass_data >>= 1; break; + } + + m_bit_count++; + } + else if (m_bit_count < 48) + { + switch (m_bit_count & 3) + { + case 0: case 2: cass = +1; break; + case 1: case 3: cass = -1; break; + } + + if (m_bit_count == 47) + m_regs_r[6] |= 1; + + m_bit_count++; + } + else + { + cass = (m_cass_state > 0) ? -1 : +1; + } + + m_cassette->output( cass ); + } + + // finish the current cycle before start the next + if ((m_cass_state <= 0) && !(m_regs_r[6] & 1) && m_bit_count >= 48) + m_bit_count = 0; + + m_cass_state = cass; + m_cass_clk++; +} + +void x07_state::receive_bit(int bit) +{ + if (m_bit_count == 0) + { + // wait for start bit + if (bit == 0) + m_bit_count++; + } + else if (m_bit_count < 9) + { + m_cass_data = (m_cass_data>>1) | (bit<<7); + m_bit_count++; + } + else if (m_bit_count < 12) + { + if (bit != 1) + logerror("Invalid stop bit: %f\n", m_cassette->get_position()); + + m_bit_count++; + } + + // every byte take 12 bit + if (m_bit_count == 12) + { + //printf("data: %02x %f\n", m_cass_data, m_cassette->get_position()); + m_regs_r[6] |= 2; + m_regs_r[7] = m_cass_data; + m_cass_data = 0; + m_bit_count = 0; + + m_maincpu->set_input_line(NSC800_RSTB, ASSERT_LINE); + m_rstb_clear->adjust(attotime::from_usec(200)); + + } +} + + +/**************************************************** + this function emulate the color printer X-710 + only the text functions are emulated +****************************************************/ +void x07_state::printer_w() +{ + UINT16 char_pos = 0; +// UINT16 text_color = 0; +// UINT16 text_size = 1; + + if (m_regs_r[4] & 0x20) + m_prn_char_code |= 1; + + m_prn_sendbit++; + + if (m_prn_sendbit == 8) + { + if (m_prn_char_code) + { + m_prn_buffer[m_prn_size++] = m_prn_char_code; + + if (m_prn_buffer[m_prn_size - 2] == 0x4f && m_prn_buffer[m_prn_size - 1] == 0xaf) + { + if (m_prn_buffer[0] == 0xff && m_prn_buffer[1] == 0xb7) + { + for (int i = 2; i < m_prn_size - 2; i++) + { +/* + if (m_prn_buffer[i - 1] == 0x4f && m_prn_buffer[i] == 0x3d) + text_color = printer_charcode[m_prn_buffer[i + 1]] - 0x30; + + if (m_prn_buffer[i - 1] == 0x4f && m_prn_buffer[i] == 0x35) + { + if (m_prn_buffer[i + 2] == 0x4f) + text_size = printer_charcode[m_prn_buffer[i + 1]] - 0x2f; + else + text_size = 0x0a + (printer_charcode[m_prn_buffer[i + 2]] - 0x2f); + } +*/ + if (m_prn_buffer[i - 1] == 0x4f && m_prn_buffer[i] == 0x77) + { + char_pos = i + 1 ; + break; + } + } + } + + //send the chars to the printer, color and size are not used + for (int i = char_pos ;i < m_prn_size ; i++) + m_printer->output(printer_charcode[m_prn_buffer[i]]); + + //clears the print buffer + memset(m_prn_buffer, 0, sizeof(m_prn_buffer)); + m_prn_size = 0; + } + } + + m_prn_sendbit = 0; + m_prn_char_code = 0; + m_regs_r[2] |= 0x80; + } + else + m_prn_char_code <<= 1; +} + +inline UINT8 x07_state::kb_get_index(UINT8 char_code) +{ + for(UINT8 i=0 ; i< ARRAY_LENGTH(x07_keycodes); i++) + if (x07_keycodes[i].codes[0] == char_code) + return i; + + return 0; +} + +inline UINT8 x07_state::get_char(UINT16 pos) +{ + UINT8 code = pos>>3; + + if(code>=128 && code<=159) //UDC 0 + { + return m_t6834_ram[pos - 0x200]; + } + else if(code>=224) //UDC 1 + { + return m_t6834_ram[pos - 0x400]; + } + else //charset + { + return memregion("gfx1")->base()[pos]; + } +} + +INPUT_CHANGED_MEMBER( x07_state::kb_func_keys ) +{ + UINT8 data = 0; + UINT8 idx = (UINT8)(FPTR)param; + + if (m_kb_on && newval) + { + UINT8 shift = (ioport("A1")->read() & 0x01); + UINT16 udk_s = udk_offset[(shift*6) + idx - 1]; + + /* First 3 chars are used for description */ + udk_s += 3; + + do + { + data = m_t6834_ram[udk_s++]; + + if (m_kb_size < 0xff && data != 0) + m_t6834_ram[0x400 + m_kb_size++] = data; + } while(data != 0); + + kb_irq(); + } +} + +INPUT_CHANGED_MEMBER( x07_state::kb_keys ) +{ + UINT8 modifier; + UINT8 a1 = ioport("A1")->read(); + UINT8 bz = ioport("BZ")->read(); + UINT8 keycode = (UINT8)(FPTR)param; + + if (m_kb_on && !newval) + { + if (a1 == 0x01 && bz == 0x00) //Shift + modifier = 1; + else if (a1 == 0x02 && bz == 0x00) //CTRL + modifier = 2; + else if (a1 == 0x00 && bz == 0x08) //Num + modifier = 3; + else if (a1 == 0x00 && bz == 0x02) //Kana + modifier = 4; + else if (a1 == 0x01 && bz == 0x02) //Shift+Kana + modifier = 5; + else if (a1 == 0x00 && bz == 0x04) //Graph + modifier = 6; + else + modifier = 0; + + if (m_kb_size < 0xff) + { + UINT8 idx = kb_get_index(keycode); + m_t6834_ram[0x400 + m_kb_size++] = x07_keycodes[idx].codes[modifier]; + } + + kb_irq(); + } +} + +INPUT_CHANGED_MEMBER( x07_state::kb_update_udk ) +{ + draw_udk(); +} + +INPUT_CHANGED_MEMBER( x07_state::kb_break ) +{ + if (newval) + { + if (!m_lcd_on) + { + m_lcd_on = 1; + m_maincpu->set_state_int(Z80_PC, 0xc3c3); + } + else + { + m_regs_r[0] = 0x80; + m_regs_r[1] = 0x05; + m_regs_r[2] |= 0x01; + m_maincpu->set_input_line(NSC800_RSTA, ASSERT_LINE ); + m_rsta_clear->adjust(attotime::from_msec(50)); + } + } +} + + +void x07_state::kb_irq() +{ + if (m_kb_size) + { + m_regs_r[0] = 0; + m_regs_r[1] = m_t6834_ram[0x400]; + memcpy(m_t6834_ram + 0x400, m_t6834_ram + 0x401, 0xff); + m_kb_size--; + m_regs_r[2] |= 0x01; + m_maincpu->set_input_line(NSC800_RSTA, ASSERT_LINE); + m_rsta_clear->adjust(attotime::from_msec(50)); + } +} + + +/*************************************************************************** + Video +***************************************************************************/ + +inline void x07_state::draw_char(UINT8 x, UINT8 y, UINT8 char_pos) +{ + if(x < 20 && y < 4) + for(int cy = 0; cy < 8; cy++) + for(int cx = 0; cx < 6; cx++) + m_lcd_map[y * 8 + cy][x * 6 + cx] = (get_char(((char_pos << 3) + cy) & 0x7ff) & (0x80>>cx)) ? 1 : 0; +} + + +inline void x07_state::draw_point(UINT8 x, UINT8 y, UINT8 color) +{ + if(x < 120 && y < 32) + m_lcd_map[y][x] = color; +} + + +inline void x07_state::draw_udk() +{ + UINT8 i, x, j; + + if (m_draw_udk) + for(i = 0, x = 0; i < 5; i++) + { + UINT16 ofs = udk_offset[i + ((ioport("A1")->read()&0x01) ? 6 : 0)]; + draw_char(x++, 3, 0x83); + for(j = 0; j < 3; j++) + draw_char(x++, 3, m_t6834_ram[ofs++]); + } +} + +DEVICE_IMAGE_LOAD_MEMBER( x07_state, x07_card ) +{ + UINT32 size = m_card->common_get_size("rom"); + + // check card type + if (image.software_entry() != NULL) + { + const char *card_type = image.get_feature("card_type"); + + if (strcmp(card_type, "xp140")) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported card type"); + return IMAGE_INIT_FAIL; + } + } + + m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG); + m_card->common_load_rom(m_card->get_rom_base(), size, "rom"); + + m_card->ram_alloc(0x1000); + + return IMAGE_INIT_PASS; +} + +PALETTE_INIT_MEMBER(x07_state, x07) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + + +UINT32 x07_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0); + + if (m_lcd_on) + { + for(int py = 0; py < 4; py++) + for(int px = 0; px < 20; px++) + for(int y = 0; y < 8; y++) + for (int x=0; x<6; x++) + if(m_cursor.on && m_blink && m_cursor.x == px && m_cursor.y == py) + bitmap.pix16(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; + else + bitmap.pix16(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; + + } + + return 0; +} + + +/*************************************************************************** + Machine +***************************************************************************/ + +READ8_MEMBER( x07_state::x07_io_r ) +{ + UINT8 data = 0xff; + + switch(offset) + { + case 0x80: + case 0x81: + case 0x82: + case 0x83: + case 0x84: + case 0x85: + case 0x86: + case 0x87: + case 0x88: + case 0x89: + case 0x8a: + case 0x8b: + case 0x8c: + data = ((offset & 0x0f) < 8) ? get_char((m_font_code << 3) | (offset & 7)) : 0; + break; + + case 0x90: + data = 0x00; + break; + case 0xf6: + if (m_cass_motor) m_regs_r[6] |= 4; + //fall through + case 0xf0: + case 0xf1: + case 0xf3: + case 0xf4: + case 0xf5: + case 0xf7: + data = m_regs_r[offset & 7]; + break; + + case 0xf2: + if(m_regs_w[5] & 4) + m_regs_r[2] |= 2; + else + m_regs_r[2] &= 0xfd; + data = m_regs_r[2] | 2; + break; + } + + return data; +} + + +WRITE8_MEMBER( x07_state::x07_io_w ) +{ + switch(offset) + { + case 0x80: + m_font_code = data; + break; + + case 0xf0: + case 0xf1: + case 0xf2: + case 0xf3: + case 0xf6: + case 0xf7: + m_regs_w[offset & 7] = data; + break; + + case 0xf4: + m_regs_r[4] = m_regs_w[4] = data; + m_cass_motor = ((data & 0x0d) == 0x09) ? 1 : 0; + + if (m_cass_motor) + { + m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_cass_poll->adjust(attotime::from_hz(48000), 0, attotime::from_hz(48000)); + } + else + { + m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_cass_poll->reset(); + m_cass_tick->reset(); + } + +#if(1) + if((data & 0x0e) == 0x0e) + { + m_beep->set_state(1); + m_beep->set_frequency(192000 / ((m_regs_w[2] | (m_regs_w[3] << 8)) & 0x0fff)); + + m_beep_stop->adjust(attotime::from_msec(m_ram->pointer()[0x450] * 0x20)); + } + else + m_beep->set_state(0); +#endif + break; + + case 0xf5: + if(data & 0x01) + t6834_r(); + if(data & 0x02) + t6834_w(); + if(data & 0x04) + cassette_r(); + if(data & 0x08) + cassette_w(); + if(data & 0x20) + printer_w(); + + m_regs_w[5] = data; + break; + } +} + +static ADDRESS_MAP_START(x07_mem, AS_PROGRAM, 8, x07_state) + ADDRESS_MAP_UNMAP_LOW + AM_RANGE(0x0000, 0x1fff) AM_NOP //RAM installed at runtime + AM_RANGE(0x2000, 0x7fff) AM_NOP //Memory Card RAM/ROM + AM_RANGE(0x8000, 0x97ff) AM_RAM //TV VRAM + AM_RANGE(0x9800, 0x9fff) AM_UNMAP //unused/unknown + AM_RANGE(0xa000, 0xafff) AM_ROM AM_REGION("x720", 0) //TV ROM + AM_RANGE(0xb000, 0xffff) AM_ROM AM_REGION("basic", 0) //BASIC ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( x07_io , AS_IO, 8, x07_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK (0xff) + AM_RANGE(0x00, 0xff) AM_READWRITE(x07_io_r, x07_io_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( x07 ) + PORT_START("BATTERY") + PORT_CONFNAME( 0x40, 0x30, "Battery Status" ) + PORT_CONFSETTING( 0x30, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x40, "Low Battery" ) + PORT_START("CARDBATTERY") + PORT_CONFNAME( 0x10, 0x00, "Card Battery Status" ) + PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) + PORT_CONFSETTING( 0x10, "Low Battery" ) + + PORT_START("S1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x12) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x16) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x1c) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x1d) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x1e) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x1f) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x20) + PORT_START("S2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x5a) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x58) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x43) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x56) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x42) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4e) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4d) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x2c) + PORT_START("S3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x41) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x53) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x44) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x46) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x47) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x48) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4a) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4b) + PORT_START("S4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x51) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x57) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x45) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x52) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x54) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x59) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x55) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x49) + PORT_START("S5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x31) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x32) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x33) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x34) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x35) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x36) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x37) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x38) + PORT_START("S6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 4) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 5) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 6) + PORT_START("S7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x2e) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x2f) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR('?') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x3f) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x0d) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4f) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x50) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR('@') PORT_CHAR('\'') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x40) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x5b) + PORT_START("S8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4c) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(';') PORT_CHAR('+') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x3b) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x3a) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x5d) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x39) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('|') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x30) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x2d) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('`') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x3d) + PORT_START("BZ") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x0b) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("KANA") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("GRPH") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NUM") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("OFF") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ON/BREAK") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_break, 0) + PORT_START("A1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_update_udk, 0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) +INPUT_PORTS_END + + +void x07_state::nvram_init(nvram_device &nvram, void *data, size_t size) +{ + memcpy(data, memregion("default")->base(), size); + m_warm_start = 0; +} + +TIMER_DEVICE_CALLBACK_MEMBER(x07_state::blink_timer) +{ + m_blink = !m_blink; +} + +TIMER_CALLBACK_MEMBER(x07_state::rsta_clear) +{ + m_maincpu->set_input_line(NSC800_RSTA, CLEAR_LINE); + + if (m_kb_size) + kb_irq(); +} + +TIMER_CALLBACK_MEMBER(x07_state::rstb_clear) +{ + m_maincpu->set_input_line(NSC800_RSTB, CLEAR_LINE); +} + +TIMER_CALLBACK_MEMBER(x07_state::beep_stop) +{ + m_beep->set_state(0); +} + +static const gfx_layout x07_charlayout = +{ + 6, 8, /* 6 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + { 0, 1, 2, 3, 4, 5}, + { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, + 8*8 /* 8 bytes */ +}; + +static GFXDECODE_START( x07 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, x07_charlayout, 0, 1 ) +GFXDECODE_END + +void x07_state::machine_start() +{ + UINT32 ram_size = m_ram->size(); + m_rsta_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rsta_clear),this)); + m_rstb_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rstb_clear),this)); + m_beep_stop = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::beep_stop),this)); + m_cass_poll = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_poll),this)); + m_cass_tick = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_tick),this)); + + m_nvram1->set_base(&m_t6834_ram, 0x800); + m_nvram2->set_base(m_ram->pointer(), ram_size); + + /* Save State */ + save_item(NAME(m_sleep)); + save_item(NAME(m_warm_start)); + save_item(NAME(m_udk_on)); + save_item(NAME(m_draw_udk)); + save_item(NAME(m_sp_on)); + save_item(NAME(m_font_code)); + save_item(NAME(m_lcd_on)); + save_item(NAME(m_scroll_min)); + save_item(NAME(m_scroll_max)); + save_item(NAME(m_blink)); + save_item(NAME(m_kb_on)); + save_item(NAME(m_repeat_key)); + save_item(NAME(m_kb_size)); + save_item(NAME(m_prn_sendbit)); + save_item(NAME(m_prn_char_code)); + save_item(NAME(m_prn_size)); + save_item(NAME(m_cass_motor)); + save_item(NAME(m_cass_data)); + save_item(NAME(m_cass_clk)); + save_item(NAME(m_cass_state)); + save_item(NAME(m_bit_count)); + save_item(NAME(m_t6834_ram)); + save_item(NAME(m_regs_r)); + save_item(NAME(m_regs_w)); + save_item(NAME(m_alarm)); + save_item(NAME(m_lcd_map)); + save_item(NAME(m_prn_buffer)); + save_item(NAME(m_in.read)); + save_item(NAME(m_in.write)); + save_item(NAME(m_in.data)); + save_item(NAME(m_out.read)); + save_item(NAME(m_out.write)); + save_item(NAME(m_out.data)); + save_item(NAME(m_locate.x)); + save_item(NAME(m_locate.y)); + save_item(NAME(m_locate.on)); + save_item(NAME(m_cursor.x)); + save_item(NAME(m_cursor.y)); + save_item(NAME(m_cursor.on)); + + // install RAM + address_space &program = m_maincpu->space(AS_PROGRAM); + program.install_ram(0x0000, ram_size - 1, m_ram->pointer()); + + // card + if (m_card->exists()) + { + // 0x4000 - 0x4fff 4KB RAM + // 0x6000 - 0x7fff 8KB ROM + program.install_read_handler(ram_size, ram_size + 0xfff, read8_delegate(FUNC(generic_slot_device::read_ram),(generic_slot_device*)m_card)); + program.install_write_handler(ram_size, ram_size + 0xfff, write8_delegate(FUNC(generic_slot_device::write_ram),(generic_slot_device*)m_card)); + program.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_card)); + + m_card->save_ram(); + } +} + +void x07_state::machine_reset() +{ + memset(m_regs_r, 0, sizeof(m_regs_r)); + memset(m_regs_w, 0, sizeof(m_regs_w)); + memset(m_alarm, 0, sizeof(m_alarm)); + memset(&m_in, 0, sizeof(m_in)); + memset(&m_out, 0, sizeof(m_out)); + memset(&m_locate, 0, sizeof(m_locate)); + memset(&m_cursor, 0, sizeof(m_cursor)); + memset(m_prn_buffer, 0, sizeof(m_prn_buffer)); + memset(m_lcd_map, 0, sizeof(m_lcd_map)); + + m_sleep = 0; + m_udk_on = 0; + m_draw_udk = 0; + m_sp_on = 0; + m_font_code = 0; + m_lcd_on = 1; + m_scroll_min = 0; + m_scroll_max = 3; + m_blink = 0; + m_kb_on = 0; + m_repeat_key = 0; + m_kb_size = 0; + m_repeat_key = 0; + m_prn_sendbit = 0; + m_prn_char_code = 0; + m_prn_size = 0; + + m_regs_r[2] = ioport("CARDBATTERY")->read(); + + m_maincpu->set_state_int(Z80_PC, 0xc3c3); +} + +static MACHINE_CONFIG_START( x07, x07_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NSC800, XTAL_15_36MHz / 4) + MCFG_CPU_PROGRAM_MAP(x07_mem) + MCFG_CPU_IO_MAP(x07_io) + + /* video hardware */ + MCFG_SCREEN_ADD("lcd", LCD) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(x07_state, screen_update) + MCFG_SCREEN_SIZE(120, 32) + MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 32-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(x07_state, x07) + MCFG_DEFAULT_LAYOUT(layout_lcd) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", x07) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO( "mono" ) + MCFG_SOUND_ADD( "beeper", BEEP, 0 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 0.50 ) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* printer */ + MCFG_DEVICE_ADD("printer", PRINTER, 0) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("blink_timer", x07_state, blink_timer, attotime::from_msec(300)) + + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram1", x07_state, nvram_init) // t6834 RAM + MCFG_NVRAM_ADD_0FILL("nvram2") // RAM banks + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + // 8KB no expansion + // 12KB XM-100 + // 16KB XR-100 or XM-101 + // 20KB XR-100 and XM-100 + // 24KB XR-100 and XM-101 + MCFG_RAM_DEFAULT_SIZE("16K") + MCFG_RAM_EXTRA_OPTIONS("8K,12K,20K,24k") + + /* Memory Card */ + MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_romram_plain_slot, "x07_card") + MCFG_GENERIC_EXTENSIONS("rom,bin") + MCFG_GENERIC_LOAD(x07_state, x07_card) + + /* cassette */ + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(x07_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("x07_cass") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("card_list", "x07_card") + MCFG_SOFTWARE_LIST_ADD("cass_list", "x07_cass") +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( x07 ) + ROM_REGION( 0x6000, "basic", ROMREGION_ERASEFF ) + ROM_LOAD( "x07.bin", 0x0000, 0x5001, BAD_DUMP CRC(61a6e3cc) SHA1(c53c22d33085ac7d5e490c5d8f41207729e5f08a) ) //very strange size... + + ROM_REGION( 0x1000, "x720", ROMREGION_ERASEFF ) + ROM_LOAD( "x720.bin", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x0800, "gfx1", 0 ) + ROM_LOAD( "charset.rom", 0x0000, 0x0800, BAD_DUMP CRC(b1e59a6e) SHA1(b0c06315a2d5c940a8f288fb6a3428d738696e69) ) + + ROM_REGION( 0x0800, "default", ROMREGION_ERASE00 ) +ROM_END + +DRIVER_INIT_MEMBER(x07_state, x07) +{ + UINT8 *RAM = memregion("default")->base(); + UINT8 *GFX = memregion("gfx1")->base(); + + for (int i = 0; i < 12; i++) + strcpy((char *)RAM + udk_offset[i], udk_ini[i]); + + //copy default chars in the UDC + memcpy(RAM + 0x200, GFX + 0x400, 0x100); + memcpy(RAM + 0x300, GFX + 0x700, 0x100); +} + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, x07, 0, 0, x07, x07, x07_state, x07, "Canon", "X-07", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/drivers/x1.c b/src/mame/drivers/x1.c new file mode 100644 index 00000000000..9bad6b21493 --- /dev/null +++ b/src/mame/drivers/x1.c @@ -0,0 +1,2649 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese, Barry Rodewald +/************************************************************************************************ + + Sharp X1 (c) 1983 Sharp Corporation + + driver by Angelo Salese & Barry Rodewald, + special thanks to Dirk Best for various wd17xx fixes + + TODO: + - Rewrite keyboard input hook-up and decap/dump the keyboard MCU if possible; + - Fix the 0xe80/0xe83 kanji ROM readback; + - x1turbo keyboard inputs are currently broken, use x1turbo40 for now; + - Hook-up remaining .tap image formats; + - Implement APSS tape commands; + - Sort out / redump the BIOS gfx roms; + - X1Turbo: Implement SIO. + - Implement true 400 lines mode (i.e. Chatnoir no Mahjong v2.1, Casablanca) + - Implement SASI HDD interface; + - clean-ups! + - There are various unclear video things, these are: + - Implement the remaining scrn regs; + - Implement the new features of the x1turboz, namely the 4096 color feature amongst other things + - (anything else?) + - Driver Configuration switches: + - OPN for X1 + - EMM, and hook-up for X1 too + - RAM size for EMM + - specific x1turboz features? + + per-game/program specific TODO: + - CZ8FB02 / CZ8FB03: doesn't load at all, they are 2hd floppies apparently; + - Chack'n Pop: game is too fast, presumably missing wait states; + - Dragon Buster: it crashed to me once with a obj flag hang; + - The Goonies (x1 only): goes offsync with the PCG beam positions; + - Graphtol: sets up x1turboz paletteram, graphic garbage due of it; + - Gyajiko2: hangs when it's supposed to load the character selection screen, FDC bug? + - Hydlide 3: can't get the user disk to work properly, could be a bad dump; + - Lupin the 3rd: don't know neither how to "data load" nor how to "create a character" ... does the game hangs? + - Might & Magic: uses 0xe80-3 kanji ports, should be a good test case for that; + - "newtype": trips a z80dma assert, worked around for now; + - Saziri: doesn't re-initialize the tilemap attribute vram when you start a play, making it to have missing colors if you don't start a play in time; + - Suikoden: shows a JP message error (DFJustin: "Problem with the disk device !! Please set a floppy disk properly and press the return key. Retrying.") + - Super Billiards (X1 Pack 14): has a slight PCG timing bug, that happens randomly; + - Trivia-Q: dunno what to do on the selection screen, missing inputs? + - Turbo Alpha: has z80dma / fdc bugs, doesn't show the presentation properly and then hangs; + - Will 2: doesn't load, fdc issue presumably (note: it's a x1turbo game ONLY); + - X1F Demo ("New X1 Demo"): needs partial updates, but they doesn't cope well with current video system; + - Ys 2: crashes after the disclaimer screen; + - Ys 3: missing user disk, to hack it (and play with x1turboz features): bp 81ca,pc += 2 + - Ys 3: never uploads a valid 4096 palette, probably related to the fact that we don't have an user disk + + Notes: + - An interesting feature of the Sharp X-1 is the extended i/o bank. When the ppi port c bit 5 + does a 1->0 transition, any write to the i/o space accesses 2 or 3 banks gradients of the bitmap RAM + with a single write (generally used for layer clearances and bitmap-style sprites). + Any i/o read disables this extended bitmap ram. + - I/O port $700 bit 7 of X1 Turbo is a sound (dip-)switch / jumper setting. I don't know yet what is for, + but King's Knight needs it to be active otherwise it refuses to boot. + - ROM format is: + 0x00 ROM id (must be 0x01) + 0x01 - 0x0e ROM header + 0xff16 - 0xff17 start-up vector + In theory, you can convert your tape / floppy games into ROM format easily, provided that you know what's the pinout of the + cartridge slot and it doesn't exceed 64k (0x10000) of size. + - Gruppe: shows a random bitmap graphic then returns "program load error" ... it wants that the floppy has write protection enabled (!) (btanb) + - Maidum: you need to load BOTH disk with write protection disabled, otherwise it refuses to run. (btanb) + - Marvelous: needs write protection disabled (btanb) + - Chack'n Pop: to load this game, do a files command on the "Jodan Dos" prompt then move the cursor up at the "Chack'n Pop" file. + Substitute bin with load and press enter. Finally, do a run once that it loaded correctly. + - Faeries Residence: to load this game, put a basic v2.0 in drive 0, then execute a NEWON command. Load game disks into drive 0 and 1 then + type run"START" (case sensitive) + - POPLEMON: same as above, but you need to type run"POP" + +================================================================================================= + + X1 (CZ-800C) - November, 1982 + * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) + * ROM: IPL (4KB) + chargen (2KB) + * RAM: Main memory (64KB) + VRAM (4KB) + RAM for PCG (6KB) + GRAM (48KB, Option) + * Text Mode: 80x25 or 40x25 + * Graphic Mode: 640x200 or 320x200, 8 colors + * Sound: PSG 8 octave + * I/O Ports: Centronic ports, 2 Joystick ports, Cassette port (2700 baud) + + X1C (CZ-801C) - October, 1983 + * same but only 48KB GRAM + + X1D (CZ-802C) - October, 1983 + * same as X1C but with a 3" floppy drive (notice: 3" not 3" 1/2!!) + + X1Cs (CZ-803C) - June, 1984 + * two expansion I/O ports + + X1Ck (CZ-804C) - June, 1984 + * same as X1Cs + * ROM: IPL (4KB) + chargen (2KB) + Kanji 1st level + + X1F Model 10 (CZ-811C) - July, 1985 + * Re-designed + * ROM: IPL (4KB) + chargen (2KB) + + X1F Model 20 (CZ-812C) - July, 1985 + * Re-designed (same as Model 10) + * ROM: IPL (4KB) + chargen (2KB) + Kanji + * Built Tape drive plus a 5" floppy drive was available + + X1G Model 10 (CZ-820C) - July, 1986 + * Re-designed again + * ROM: IPL (4KB) + chargen (2KB) + + X1G Model 30 (CZ-822C) - July, 1986 + * Re-designed again (same as Model 10) + * ROM: IPL (4KB) + chargen (2KB) + Kanji + * Built Tape drive plus a 5" floppy drive was available + + X1twin (CZ-830C) - December, 1986 + * Re-designed again (same as Model 10) + * ROM: IPL (4KB) + chargen (2KB) + Kanji + * Built Tape drive plus a 5" floppy drive was available + * It contains a PC-Engine + + ============= X1 Turbo series ============= + + X1turbo Model 30 (CZ-852C) - October, 1984 + * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) + * ROM: IPL (32KB) + chargen (8KB) + Kanji (128KB) + * RAM: Main memory (64KB) + VRAM (6KB) + RAM for PCG (6KB) + GRAM (96KB) + * Text Mode: 80xCh or 40xCh with Ch = 10, 12, 20, 25 (same for Japanese display) + * Graphic Mode: 640x200 or 320x200, 8 colors + * Sound: PSG 8 octave + * I/O Ports: Centronic ports, 2 Joystick ports, built-in Cassette interface, + 2 Floppy drive for 5" disks, two expansion I/O ports + + X1turbo Model 20 (CZ-851C) - October, 1984 + * same as Model 30, but only 1 Floppy drive is included + + X1turbo Model 10 (CZ-850C) - October, 1984 + * same as Model 30, but Floppy drive is optional and GRAM is 48KB (it can + be expanded to 96KB however) + + X1turbo Model 40 (CZ-862C) - July, 1985 + * same as Model 30, but uses tv screen (you could watch television with this) + + X1turboII (CZ-856C) - November, 1985 + * same as Model 30, but restyled, cheaper and sold with utility software + + X1turboIII (CZ-870C) - November, 1986 + * with two High Density Floppy driver + + X1turboZ (CZ-880C) - December, 1986 + * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) + * ROM: IPL (32KB) + chargen (8KB) + Kanji 1st & 2nd level + * RAM: Main memory (64KB) + VRAM (6KB) + RAM for PCG (6KB) + GRAM (96KB) + * Text Mode: 80xCh or 40xCh with Ch = 10, 12, 20, 25 (same for Japanese display) + * Graphic Mode: 640x200 or 320x200, 8 colors [in compatibility mode], + 640x400, 8 colors (out of 4096); 320x400, 64 colors (out of 4096); + 320x200, 4096 colors [in multimode], + * Sound: PSG 8 octave + FM 8 octave + * I/O Ports: Centronic ports, 2 Joystick ports, built-in Cassette interface, + 2 Floppy drive for HD 5" disks, two expansion I/O ports + + X1turboZII (CZ-881C) - December, 1987 + * same as turboZ, but added 64KB expansion RAM + + X1turboZIII (CZ-888C) - December, 1988 + * same as turboZII, but no more built-in cassette drive + + Please refer to http://www2s.biglobe.ne.jp/~ITTO/x1/x1menu.html for + more info + + BASIC has to be loaded from external media (tape or disk), the + computer only has an Initial Program Loader (IPL) + +================================================================================================= + + x1turbo specs (courtesy of Yasuhiro Ogawa): + + upper board: Z80A-CPU + Z80A-DMA + Z80A-SIO(O) + Z80A-CTC + uPD8255AC + LH5357(28pin mask ROM. for IPL?) + YM2149F + 16.000MHz(X1) + + lower board: IX0526CE(HN61364) (28pin mask ROM. for ANK font?) + MB83256x4 (Kanji ROMs) + HD46505SP (VDP) + M80C49-277 (MCU) + uPD8255AC + uPD1990 (RTC) + battery + 6.000MHz(X2) + 42.9545MHz(X3) + + FDD I/O board: MB8877A (FDC) + MB4107 (VFO) + + RAM banks: + upper board: MB8265A-15 x8 (main memory) + lower board: MB8416A-12 x3 (VRAM) + MB8416A-15 x3 (PCG RAM) + MB81416-10 x12 (GRAM) + +************************************************************************************************/ + +#include "includes/x1.h" +#include "formats/2d_dsk.h" + +#define MAIN_CLOCK XTAL_16MHz +#define VDP_CLOCK XTAL_42_9545MHz +#define MCU_CLOCK XTAL_6MHz + + + + +/************************************* + * + * Video Functions + * + *************************************/ + +VIDEO_START_MEMBER(x1_state,x1) +{ + m_avram = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_tvram = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_kvram = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_gfx_bitmap_ram = auto_alloc_array_clear(machine(), UINT8, 0xc000*2); + m_pal_4096 = auto_alloc_array_clear(machine(), UINT8, 0x1000*3); +} + +void x1_state::x1_draw_pixel(bitmap_rgb32 &bitmap,int y,int x,UINT16 pen,UINT8 width,UINT8 height) +{ + if(!machine().first_screen()->visible_area().contains(x, y)) + return; + + if(width && height) + { + bitmap.pix32(y+0+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix32(y+0+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix32(y+1+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix32(y+1+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + } + else if(width) + { + bitmap.pix32(y+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix32(y+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + } + else if(height) + { + bitmap.pix32(y+0+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix32(y+1+m_ystart, x+m_xstart) = m_palette->pen(pen); + } + else + bitmap.pix32(y+m_ystart, x+m_xstart) = m_palette->pen(pen); +} + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) + + +/* adjust tile index when we are under double height condition */ +UINT8 x1_state::check_prev_height(int x,int y,int x_size) +{ + UINT8 prev_tile = m_tvram[(x+((y-1)*x_size)+mc6845_start_addr) & 0x7ff]; + UINT8 cur_tile = m_tvram[(x+(y*x_size)+mc6845_start_addr) & 0x7ff]; + UINT8 prev_attr = m_avram[(x+((y-1)*x_size)+mc6845_start_addr) & 0x7ff]; + UINT8 cur_attr = m_avram[(x+(y*x_size)+mc6845_start_addr) & 0x7ff]; + + if(prev_tile == cur_tile && prev_attr == cur_attr) + return 8; + + return 0; +} + +/* Exoa II - Warroid: if double height isn't enabled on the first tile of the line then double height is disabled on everything else. */ +UINT8 x1_state::check_line_valid_height(int y,int x_size,int height) +{ + UINT8 line_attr = m_avram[(0+(y*x_size)+mc6845_start_addr) & 0x7ff]; + + if((line_attr & 0x40) == 0) + return 0; + + return height; +} + +void x1_state::draw_fgtilemap(bitmap_rgb32 &bitmap,const rectangle &cliprect) +{ + /* + attribute table: + x--- ---- double width + -x-- ---- double height + --x- ---- PCG select + ---x ---- color blinking + ---- x--- reverse color + ---- -xxx color pen + + x--- ---- select Kanji ROM + -x-- ---- Kanji side (0=left, 1=right) + --x- ---- Underline + ---x ---- Kanji ROM select (0=level 1, 1=level 2) (TODO: implement this) + ---- xxxx Kanji upper 4 bits + */ + + int y,x,res_x,res_y; + UINT32 tile_offset; + UINT8 x_size,y_size; + + x_size = mc6845_h_display; + y_size = mc6845_v_display; + + if(x_size == 0 || y_size == 0) + return; //don't bother if screen is off + + if(x_size != 80 && x_size != 40 && y_size != 25) + popmessage("%d %d",x_size,y_size); + + for (y=0;ybase(); + int knj_enable = 0; + int knj_side = 0; + int knj_bank = 0; + int knj_uline = 0; + if(m_is_turbo) + { + knj_enable = BIT(m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 7); + knj_side = BIT(m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 6); + knj_uline = BIT(m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 5); + //knj_lv2 = BIT(m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 4); + knj_bank = m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff] & 0x0f; + if(knj_enable) + { + gfx_data = m_kanji_rom; + tile = ((tile + (knj_bank << 8)) << 1) + (knj_side & 1); + } + } + + { + int pen[3],pen_mask,pcg_pen,xi,yi,dy; + + pen_mask = color & 7; + + dy = 0; + + height = check_line_valid_height(y,x_size,height); + + if(height && y) + dy = check_prev_height(x,y,x_size); + + /* guess: assume that Kanji VRAM doesn't double the vertical size */ + if(knj_enable) { height = 0; } + + for(yi=0;yi> (height+m_scrn_reg.v400_mode); + pen[0] = gfx_data[tile_offset+0x0000]>>(7-xi) & (pen_mask & 1)>>0; + pen[1] = gfx_data[tile_offset+0x0000]>>(7-xi) & (pen_mask & 2)>>1; + pen[2] = gfx_data[tile_offset+0x0000]>>(7-xi) & (pen_mask & 4)>>2; + + if(yi == mc6845_tile_height-1 && knj_uline) //underlined attribute + { + pen[0] = (pen_mask & 1)>>0; + pen[1] = (pen_mask & 2)>>1; + pen[2] = (pen_mask & 4)>>2; + } + + if((yi >= 16 && m_scrn_reg.v400_mode == 0) || (yi >= 32 && m_scrn_reg.v400_mode == 1)) + pen[0] = pen[1] = pen[2] = 0; + } + else if(pcg_bank) // PCG + { + tile_offset = tile * 8; + tile_offset += (yi+dy*(m_scrn_reg.v400_mode+1)) >> (height+m_scrn_reg.v400_mode); + + pen[0] = gfx_data[tile_offset+0x0000]>>(7-xi) & (pen_mask & 1)>>0; + pen[1] = gfx_data[tile_offset+0x0800]>>(7-xi) & (pen_mask & 2)>>1; + pen[2] = gfx_data[tile_offset+0x1000]>>(7-xi) & (pen_mask & 4)>>2; + + if((yi >= 8 && m_scrn_reg.v400_mode == 0) || (yi >= 16 && m_scrn_reg.v400_mode == 1)) + pen[0] = pen[1] = pen[2] = 0; + } + else + { + tile_offset = tile * (8*(m_scrn_reg.ank_sel+1)); + tile_offset += (yi+dy*(m_scrn_reg.v400_mode+1)) >> (height+m_scrn_reg.v400_mode); + + pen[0] = gfx_data[tile_offset+m_scrn_reg.ank_sel*0x0800]>>(7-xi) & (pen_mask & 1)>>0; + pen[1] = gfx_data[tile_offset+m_scrn_reg.ank_sel*0x0800]>>(7-xi) & (pen_mask & 2)>>1; + pen[2] = gfx_data[tile_offset+m_scrn_reg.ank_sel*0x0800]>>(7-xi) & (pen_mask & 4)>>2; + + if(m_scrn_reg.ank_sel) + { + if((yi >= 16 && m_scrn_reg.v400_mode == 0) || (yi >= 32 && m_scrn_reg.v400_mode == 1)) + pen[0] = pen[1] = pen[2] = 0; + } + else + { + if((yi >= 8 && m_scrn_reg.v400_mode == 0) || (yi >= 16 && m_scrn_reg.v400_mode == 1)) + pen[0] = pen[1] = pen[2] = 0; + } + } + + pcg_pen = pen[2]<<2|pen[1]<<1|pen[0]<<0; + + if(color & 0x10 && machine().first_screen()->frame_number() & 0x10) //reverse flickering + pcg_pen^=7; + + if(pcg_pen == 0 && (!(color & 8))) + continue; + + if(color & 8) //revert the used color pen + pcg_pen^=7; + + if((m_scrn_reg.blackclip & 8) && (color == (m_scrn_reg.blackclip & 7))) + pcg_pen = 0; // clip the pen to black + + res_x = x*8+xi*(width+1); + res_y = y*(mc6845_tile_height)+yi; + + if(res_y < cliprect.min_y || res_y > cliprect.max_y) // partial update, TODO: optimize + continue; + + x1_draw_pixel(bitmap,res_y,res_x,pcg_pen,width,0); + } + } + } + + if(width) //skip next char if we are under double width condition + x++; + } + } +} + +/* + * Priority Mixer Calculation (pri) + * + * If pri is 0xff then the bitmap entirely covers the tilemap, if it's 0x00 then + * the tilemap priority is entirely above the bitmap. Any other value mixes the + * bitmap and the tilemap priorities based on the pen value, bit 0 = entry 0 <-> bit 7 = entry 7 + * of the bitmap. + * + */ +int x1_state::priority_mixer_pri(int color) +{ + int pri_i,pri_mask_calc; + + pri_i = 0; + pri_mask_calc = 1; + + while(pri_i < 7) + { + if((color & 7) == pri_i) + break; + + pri_i++; + pri_mask_calc<<=1; + } + + return pri_mask_calc; +} + +void x1_state::draw_gfxbitmap(bitmap_rgb32 &bitmap,const rectangle &cliprect, int plane,int pri) +{ + int xi,yi,x,y; + int pen_r,pen_g,pen_b,color; + int pri_mask_val; + UINT8 x_size,y_size; + int gfx_offset; + + x_size = mc6845_h_display; + y_size = mc6845_v_display; + + if(x_size == 0 || y_size == 0) + return; //don't bother if screen is off + + if(x_size != 80 && x_size != 40 && y_size != 25) + popmessage("%d %d",x_size,y_size); + + //popmessage("%04x %02x",mc6845_start_addr,mc6845_tile_height); + + for (y=0;y> m_scrn_reg.v400_mode) * 0x800) & 0x3fff; + pen_b = (m_gfx_bitmap_ram[gfx_offset+0x0000+plane*0xc000]>>(7-xi)) & 1; + pen_r = (m_gfx_bitmap_ram[gfx_offset+0x4000+plane*0xc000]>>(7-xi)) & 1; + pen_g = (m_gfx_bitmap_ram[gfx_offset+0x8000+plane*0xc000]>>(7-xi)) & 1; + + color = (pen_g<<2 | pen_r<<1 | pen_b<<0) | 8; + + pri_mask_val = priority_mixer_pri(color); + if(pri_mask_val & pri) continue; + + if((color == 8 && m_scrn_reg.blackclip & 0x10) || (color == 9 && m_scrn_reg.blackclip & 0x20)) // bitmap color clip to black conditions + color = 0; + + if(y*(mc6845_tile_height)+yi < cliprect.min_y || y*(mc6845_tile_height)+yi > cliprect.max_y) // partial update TODO: optimize + continue; + + x1_draw_pixel(bitmap,y*(mc6845_tile_height)+yi,x*8+xi,color,0,0); + } + } + } + } +} + +UINT32 x1_state::screen_update_x1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(rgb_t(0xff,0x00,0x00,0x00), cliprect); + + /* TODO: correct calculation thru mc6845 regs */ + m_xstart = ((mc6845_h_char_total - mc6845_h_sync_pos) * 8) / 2; + m_ystart = ((mc6845_v_char_total - mc6845_v_sync_pos) * 8) / 2; + +// popmessage("%d %d %d %d",mc6845_h_sync_pos,mc6845_v_sync_pos,mc6845_h_char_total,mc6845_v_char_total); + + draw_gfxbitmap(bitmap,cliprect,m_scrn_reg.disp_bank,m_scrn_reg.pri); + draw_fgtilemap(bitmap,cliprect); + draw_gfxbitmap(bitmap,cliprect,m_scrn_reg.disp_bank,m_scrn_reg.pri^0xff); + + return 0; +} + + +/************************************* + * + * Keyboard MCU simulation + * + *************************************/ + + +UINT16 x1_state::check_keyboard_press() +{ + static const char *const portnames[3] = { "key1","key2","key3" }; + int i,port_i,scancode; + UINT8 keymod = ioport("key_modifiers")->read() & 0x1f; + UINT32 pad = ioport("tenkey")->read(); + UINT32 f_key = ioport("f_keys")->read(); + scancode = 0; + + for(port_i=0;port_i<3;port_i++) + { + for(i=0;i<32;i++) + { + if((ioport(portnames[port_i])->read()>>i) & 1) + { + //key_flag = 1; + if(keymod & 0x02) // shift not pressed + { + if(scancode >= 0x41 && scancode < 0x5a) + scancode += 0x20; // lowercase + } + else + { + if(scancode >= 0x31 && scancode < 0x3a) + scancode -= 0x10; + if(scancode == 0x30) + { + scancode = 0x3d; + } + } + if((keymod & 0x10) == 0) // graph on + scancode |= 0x80; + + return scancode; + } + scancode++; + } + } + + // check numpad + scancode = 0x30; + for(i=0;i<10;i++) + { + if((pad >> i) & 0x01) + { + return scancode | 0x100; + } + scancode++; + } + + // check function keys + scancode = 0x71; + for(i=0;i<5;i++) + { + if((f_key >> i) & 0x01) + { + return (scancode + ((keymod & 0x02) ? 0 : 5)) | 0x100; + } + scancode++; + } + + return 0; +} + +UINT8 x1_state::check_keyboard_shift() +{ + UINT8 val = 0xe0; + /* + all of those are active low + x--- ---- TEN: Numpad, Function key, special input key + -x-- ---- KIN: Valid key + --x- ---- REP: Key repeat + ---x ---- GRAPH key ON + ---- x--- CAPS lock ON + ---- -x-- KANA lock ON + ---- --x- SHIFT ON + ---- ---x CTRL ON + */ + + val |= ioport("key_modifiers")->read() & 0x1f; + + if(check_keyboard_press() != 0) + val &= ~0x40; + + if(check_keyboard_press() & 0x100) //function keys + val &= ~0x80; + + return val; +} + +UINT8 x1_state::get_game_key(UINT8 port) +{ + // key status returned by sub CPU function 0xE3. + // in order from bit 7 to 0: + // port 0: Q,W,E,A,D,Z,X,C + // port 1: numpad 7,4,1,8,2,9,6,3 + // port 2: ESC,1,[-],[+],[*],TAB,SPC,RET ([] = numpad) + // bits are active high + UINT8 ret = 0; + + if (port == 0) + { + UINT32 key3 = ioport("key3")->read(); + if(key3 & 0x00020000) ret |= 0x80; // Q + if(key3 & 0x00800000) ret |= 0x40; // W + if(key3 & 0x00000020) ret |= 0x20; // E + if(key3 & 0x00000002) ret |= 0x10; // A + if(key3 & 0x00000010) ret |= 0x08; // D + if(key3 & 0x04000000) ret |= 0x04; // Z + if(key3 & 0x01000000) ret |= 0x02; // X + if(key3 & 0x00000008) ret |= 0x01; // C + } + else + if (port == 1) + { + UINT32 pad = ioport("tenkey")->read(); + if(pad & 0x00000080) ret |= 0x80; // Tenkey 7 + if(pad & 0x00000010) ret |= 0x40; // Tenkey 4 + if(pad & 0x00000002) ret |= 0x20; // Tenkey 1 + if(pad & 0x00000100) ret |= 0x10; // Tenkey 8 + if(pad & 0x00000004) ret |= 0x08; // Tenkey 2 + if(pad & 0x00000200) ret |= 0x04; // Tenkey 9 + if(pad & 0x00000040) ret |= 0x02; // Tenkey 6 + if(pad & 0x00000008) ret |= 0x01; // Tenkey 3 + } + else + if (port == 2) + { + UINT32 key1 = ioport("key1")->read(); + UINT32 key2 = ioport("key2")->read(); + UINT32 pad = ioport("tenkey")->read(); + if(key1 & 0x08000000) ret |= 0x80; // ESC + if(key2 & 0x00020000) ret |= 0x40; // 1 + if(pad & 0x00000400) ret |= 0x20; // Tenkey - + if(pad & 0x00000800) ret |= 0x10; // Tenkey + + if(pad & 0x00001000) ret |= 0x08; // Tenkey * + if(key1 & 0x00000200) ret |= 0x04; // TAB + if(key2 & 0x00000001) ret |= 0x02; // SPC + if(key1 & 0x00002000) ret |= 0x01; // RET + } + + return ret; +} + +READ8_MEMBER( x1_state::x1_sub_io_r ) +{ + UINT8 ret,bus_res; + + /* Looks like that the HW retains the latest data putted on the bus here, behaviour confirmed by Rally-X */ + if(m_sub_obf) + { + bus_res = m_sub_val[m_key_i]; + /* FIXME: likely to be different here. */ + m_key_i++; + if(m_key_i >= 2) + m_key_i = 0; + + return bus_res; + } + +#if 0 + if(key_flag == 1) + { + key_flag = 0; + return 0x82; //TODO: this is for shift/ctrl/kana lock etc. + } +#endif + + m_sub_cmd_length--; + m_sub_obf = (m_sub_cmd_length) ? 0x00 : 0x20; + + ret = m_sub_val[m_sub_val_ptr]; + + m_sub_val_ptr++; + if(m_sub_cmd_length <= 0) + m_sub_val_ptr = 0; + + return ret; +} + +void x1_state::cmt_command( UINT8 cmd ) +{ + // CMT deck control command (E9 xx) + // E9 00 - Eject + // E9 01 - Stop + // E9 02 - Play + // E9 03 - Fast Forward + // E9 04 - Rewind + // E9 05 - APSS Fast Forward + // E9 06 - APSS Rewind + // E9 0A - Record + /* + APSS is a Sharp invention and stands for Automatic Program Search System, it scans the tape for silent parts that are bigger than 4 seconds. + It's basically used for audio tapes in order to jump over the next/previous "track". + */ + m_cmt_current_cmd = cmd; + + if(m_cassette->get_image() == NULL) //avoid a crash if a disk game tries to access this + return; + + switch(cmd) + { + case 0x01: // Stop + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + m_cmt_test = 1; + popmessage("CMT: Stop"); + break; + case 0x02: // Play + m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); + popmessage("CMT: Play"); + break; + case 0x03: // Fast Forward + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + popmessage("CMT: Fast Forward"); + break; + case 0x04: // Rewind + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + popmessage("CMT: Rewind"); + break; + case 0x05: // APSS Fast Forward + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + popmessage("CMT: APSS Fast Forward"); + break; + case 0x06: // APSS Rewind + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + popmessage("CMT: APSS Rewind"); + break; + case 0x0a: // Record + m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_RECORD,CASSETTE_MASK_UISTATE); + popmessage("CMT: Record"); + break; + default: + logerror("Unimplemented or invalid CMT command (0x%02x)\n",cmd); + } + logerror("CMT: Command 0xe9-0x%02x received.\n",cmd); +} + +TIMER_DEVICE_CALLBACK_MEMBER(x1_state::x1_cmt_wind_timer) +{ + if(m_cassette->get_image() == NULL) //avoid a crash if a disk game tries to access this + return; + + switch(m_cmt_current_cmd) + { + case 0x03: + case 0x05: // Fast Forwarding tape + m_cassette->seek(1,SEEK_CUR); + if(m_cassette->get_position() >= m_cassette->get_length()) // at end? + cmt_command(0x01); // Stop tape + break; + case 0x04: + case 0x06: // Rewinding tape + m_cassette->seek(-1,SEEK_CUR); + if(m_cassette->get_position() <= 0) // at beginning? + cmt_command(0x01); // Stop tape + break; + } +} + +WRITE8_MEMBER( x1_state::x1_sub_io_w ) +{ + /* sub-routine at $10e sends to these sub-routines when a keyboard input is triggered: + $17a -> floppy + $094 -> ROM + $0c0 -> timer + $052 -> cmt + $0f5 -> reload sub-routine? */ + + if(m_sub_cmd == 0xe4) + { + m_key_irq_vector = data; + logerror("Key vector set to 0x%02x\n",data); + data = 0; + } + + if(m_sub_cmd == 0xe9) + { + cmt_command(data); + data = 0; + } + + if((data & 0xf0) == 0xd0) //reads here tv recording timer data. (Timer set (0xd0) / Timer readout (0xd8)) + { + /* + xx-- ---- mode + --xx xxxx interval + */ + m_sub_val[0] = 0; + /* + xxxx xxxx command code: + 00 timer disabled + 01 TV command + 10 interrupt + 11 Cassette deck + */ + m_sub_val[1] = 0; + /* + ---x xxxx minute + */ + m_sub_val[2] = 0; + /* + ---- xxxx hour + */ + m_sub_val[3] = 0; + /* + xxxx ---- month + ---- -xxx day of the week + */ + m_sub_val[4] = 0; + /* + --xx xxxx day + */ + m_sub_val[5] = 0; + m_sub_cmd_length = 6; + } + + switch(data) + { + case 0xe3: //game key obtaining + m_sub_cmd_length = 3; + m_sub_val[0] = get_game_key(0); + m_sub_val[1] = get_game_key(1); + m_sub_val[2] = get_game_key(2); + break; + case 0xe4: //irq vector setting + break; + //case 0xe5: //timer irq clear + // break; + case 0xe6: //key data readout + m_sub_val[0] = check_keyboard_shift() & 0xff; + m_sub_val[1] = check_keyboard_press() & 0xff; + m_sub_cmd_length = 2; + break; +// case 0xe7: // TV Control +// break; + case 0xe8: // TV Control read-out + m_sub_val[0] = m_sub_cmd; + m_sub_cmd_length = 1; + break; + case 0xe9: // CMT Control + break; + case 0xea: // CMT Control status + m_sub_val[0] = m_cmt_current_cmd; + m_sub_cmd_length = 1; + logerror("CMT: Command 0xEA received, returning 0x%02x.\n",m_sub_val[0]); + break; + case 0xeb: // CMT Tape status + // bit 0 = tape end (0=end of tape) + // bit 1 = tape inserted + // bit 2 = record status (1=OK, 0=write protect) + m_sub_val[0] = 0x05; + if(m_cassette->get_image() != NULL) + m_sub_val[0] |= 0x02; + m_sub_cmd_length = 1; + logerror("CMT: Command 0xEB received, returning 0x%02x.\n",m_sub_val[0]); + break; +// case 0xec: //set date +// break; + case 0xed: //get date + m_sub_val[0] = m_rtc.day; + m_sub_val[1] = (m_rtc.month<<4) | (m_rtc.wday & 0xf); + m_sub_val[2] = m_rtc.year; + m_sub_cmd_length = 3; + break; +// case 0xee: //set time +// break; + case 0xef: //get time + m_sub_val[0] = m_rtc.hour; + m_sub_val[1] = m_rtc.min; + m_sub_val[2] = m_rtc.sec; + m_sub_cmd_length = 3; + break; + } + + m_sub_cmd = data; + + m_sub_obf = (m_sub_cmd_length) ? 0x00 : 0x20; + + if(data != 0xe6) + logerror("SUB: Command byte 0x%02x\n",data); +} + +/************************************* + * + * ROM Image / Banking Handling + * + *************************************/ + + +READ8_MEMBER( x1_state::x1_rom_r ) +{ +// printf("%06x\n",m_rom_index[0]<<16|m_rom_index[1]<<8|m_rom_index[2]<<0); + if (m_cart->exists()) + return m_cart->read_rom(space, (m_rom_index[0] << 16) | (m_rom_index[1] << 8) | (m_rom_index[2] << 0)); + else + return 0; +} + +WRITE8_MEMBER( x1_state::x1_rom_w ) +{ + m_rom_index[offset] = data; +} + +WRITE8_MEMBER( x1_state::x1_rom_bank_0_w ) +{ + m_ram_bank = 0x10; +} + +WRITE8_MEMBER( x1_state::x1_rom_bank_1_w ) +{ + m_ram_bank = 0x00; +} + +/************************************* + * + * MB8877A FDC (wd17XX compatible) + * + *************************************/ + +READ8_MEMBER( x1_state::x1_fdc_r ) +{ + //UINT8 ret = 0; + + switch(offset+0xff8) + { + case 0x0ff8: + return m_fdc->status_r(space, offset); + case 0x0ff9: + return m_fdc->track_r(space, offset); + case 0x0ffa: + return m_fdc->sector_r(space, offset); + case 0x0ffb: + return m_fdc->data_r(space, offset); + case 0x0ffc: + printf("FDC: read FM type\n"); + return 0xff; + case 0x0ffd: + printf("FDC: read MFM type\n"); + return 0xff; + case 0x0ffe: + printf("FDC: read 1.6M type\n"); + return 0xff; + case 0x0fff: + printf("FDC: switching between 500k/1M\n"); + return 0xff; + } + + return 0x00; +} + +WRITE8_MEMBER( x1_state::x1_fdc_w ) +{ + floppy_image_device *floppy = NULL; + + switch(offset+0xff8) + { + case 0x0ff8: + m_fdc->cmd_w(space, offset,data); + break; + case 0x0ff9: + m_fdc->track_w(space, offset,data); + break; + case 0x0ffa: + m_fdc->sector_w(space, offset,data); + break; + case 0x0ffb: + m_fdc->data_w(space, offset,data); + break; + + case 0x0ffc: + switch (data & 0x03) + { + case 0: floppy = m_floppy0->get_device(); break; + case 1: floppy = m_floppy1->get_device(); break; + case 2: floppy = m_floppy2->get_device(); break; + case 3: floppy = m_floppy3->get_device(); break; + } + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->ss_w(BIT(data, 4)); + floppy->mon_w(!BIT(data, 7)); + } + break; + + case 0x0ffd: + case 0x0ffe: + case 0x0fff: + logerror("FDC: undefined write to %04x = %02x\n",offset+0xff8,data); + break; + } +} + +WRITE_LINE_MEMBER(x1_state::fdc_drq_w) +{ + m_dma->rdy_w(state ^ 1); +} + +/************************************* + * + * Programmable Character Generator + * + *************************************/ + +UINT16 x1_state::check_pcg_addr() +{ + if(m_avram[0x7ff] & 0x20) return 0x7ff; + if(m_avram[0x3ff] & 0x20) return 0x3ff; + if(m_avram[0x5ff] & 0x20) return 0x5ff; + if(m_avram[0x1ff] & 0x20) return 0x1ff; + + return 0x3ff; +} + +UINT16 x1_state::check_chr_addr() +{ + if(!(m_avram[0x7ff] & 0x20)) return 0x7ff; + if(!(m_avram[0x3ff] & 0x20)) return 0x3ff; + if(!(m_avram[0x5ff] & 0x20)) return 0x5ff; + if(!(m_avram[0x1ff] & 0x20)) return 0x1ff; + + return 0x3ff; +} + +UINT16 x1_state::get_pcg_addr( UINT16 width, UINT8 y_char_size ) +{ + int hbeam = machine().first_screen()->hpos() >> 3; + int vbeam = machine().first_screen()->vpos() / y_char_size; + UINT16 pcg_offset = ((hbeam + vbeam*width) + (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff))) & 0x7ff; + + //printf("%08x %d %d %d %d\n",(hbeam+vbeam*width),hbeam,vbeam,machine.first_screen()->vpos() & 7,width); + + return pcg_offset; +} + +READ8_MEMBER( x1_state::x1_pcg_r ) +{ + int addr; + int pcg_offset; + UINT8 res; + UINT8 *gfx_data; + + addr = (offset & 0x300) >> 8; + + if(addr == 0 && m_scrn_reg.pcg_mode) // Kanji ROM read, X1Turbo only + { + gfx_data = m_kanji_rom; + pcg_offset = (m_tvram[check_chr_addr()]+(m_kvram[check_chr_addr()]<<8)) & 0xfff; + pcg_offset*=0x20; + pcg_offset+=(offset & 0x0f); + pcg_offset+=(m_kvram[check_chr_addr()] & 0x40) >> 2; //left-right check + + res = gfx_data[pcg_offset]; + } + else + { + UINT8 y_char_size; + + /* addr == 0 reads from the ANK rom */ + gfx_data = addr == 0 ? m_cg_rom : m_pcg_ram; + y_char_size = ((m_crtc_vreg[9]+1) > 8) ? 8 : m_crtc_vreg[9]+1; + if(y_char_size == 0) { y_char_size = 1; } + pcg_offset = m_tvram[get_pcg_addr(m_crtc_vreg[1], y_char_size)]*8; + pcg_offset+= machine().first_screen()->vpos() & (y_char_size-1); + if(addr) { pcg_offset+= ((addr-1)*0x800); } + res = gfx_data[pcg_offset]; + } + + return res; +} + +WRITE8_MEMBER( x1_state::x1_pcg_w ) +{ + int addr,pcg_offset; + + addr = (offset & 0x300) >> 8; + + if(addr == 0) + { + /* NOP */ + logerror("Warning: write to the ANK area! %04x %02x\n",offset,data); + } + else + { + if(m_scrn_reg.pcg_mode) // Hi-Speed Mode, X1Turbo only + { + pcg_offset = m_tvram[check_pcg_addr()]*8; + pcg_offset+= (offset & 0xe) >> 1; + pcg_offset+=((addr-1)*0x800); + m_pcg_ram[pcg_offset] = data; + + pcg_offset &= 0x7ff; + + m_gfxdecode->gfx(3)->mark_dirty(pcg_offset >> 3); + } + else // Compatible Mode + { + UINT8 y_char_size; + + /* TODO: Brain Breaker doesn't work with this arrangement in high resolution mode, check out why */ + y_char_size = (m_crtc_vreg[9]+1) > 8 ? (m_crtc_vreg[9]+1)-8 : m_crtc_vreg[9]+1; + if(y_char_size == 0) { y_char_size = 1; } + pcg_offset = m_tvram[get_pcg_addr(m_crtc_vreg[1], y_char_size)]*8; + pcg_offset+= machine().first_screen()->vpos() & (y_char_size-1); + pcg_offset+= ((addr-1)*0x800); + + m_pcg_ram[pcg_offset] = data; + + pcg_offset &= 0x7ff; + + m_gfxdecode->gfx(3)->mark_dirty(pcg_offset >> 3); + } + } +} + +/************************************* + * + * Other Video-related functions + * + *************************************/ + +/* for bitmap mode */ +void x1_state::set_current_palette() +{ + UINT8 addr,r,g,b; + + for(addr=0;addr<8;addr++) + { + r = ((m_x_r)>>(addr)) & 1; + g = ((m_x_g)>>(addr)) & 1; + b = ((m_x_b)>>(addr)) & 1; + + m_palette->set_pen_color(addr|8, pal1bit(r), pal1bit(g), pal1bit(b)); + } +} + +WRITE8_MEMBER( x1_state::x1turboz_4096_palette_w ) +{ + UINT32 pal_entry; + UINT8 r,g,b; + + pal_entry = ((offset & 0xff) << 4) | ((data & 0xf0) >> 4); + + m_pal_4096[pal_entry+((offset & 0x300)<<4)] = data & 0xf; + + r = m_pal_4096[pal_entry+(1<<12)]; + g = m_pal_4096[pal_entry+(2<<12)]; + b = m_pal_4096[pal_entry+(0<<12)]; + + m_palette->set_pen_color(pal_entry+16, pal3bit(r), pal3bit(g), pal3bit(b)); +} + +/* Note: docs claims that reading the palette ports makes the value to change somehow in X1 mode ... + In 4096 color mode, it's used for reading the value back. */ +WRITE8_MEMBER( x1_state::x1_pal_r_w ) +{ + if(m_turbo_reg.pal & 0x80) //AEN bit, Turbo Z + { + if(m_turbo_reg.gfx_pal & 0x80) //APEN bit + x1turboz_4096_palette_w(space,offset & 0x3ff,data); + } + else //compatible mode + { + m_x_r = data; + set_current_palette(); + //if(m_old_vpos != machine().first_screen()->vpos()) + //{ + // machine().first_screen()->update_partial(machine().first_screen()->vpos()); + // m_old_vpos = machine().first_screen()->vpos(); + //} + } +} + +WRITE8_MEMBER( x1_state::x1_pal_g_w ) +{ + if(m_turbo_reg.pal & 0x80) //AEN bit, Turbo Z + { + if(m_turbo_reg.gfx_pal & 0x80) //APEN bit + x1turboz_4096_palette_w(space,offset & 0x3ff,data); + } + else + { + m_x_g = data; + set_current_palette(); + //if(m_old_vpos != machine().first_screen()->vpos()) + //{ + machine().first_screen()->update_partial(machine().first_screen()->vpos()); + // m_old_vpos = machine().first_screen()->vpos(); + //} + } +} + +WRITE8_MEMBER( x1_state::x1_pal_b_w ) +{ + if(m_turbo_reg.pal & 0x80) //AEN bit, Turbo Z + { + if(m_turbo_reg.gfx_pal & 0x80) //APEN bit + x1turboz_4096_palette_w(space,offset & 0x3ff,data); + } + else + { + m_x_b = data; + set_current_palette(); + //if(m_old_vpos != machine().first_screen()->vpos()) + //{ + // machine().first_screen()->update_partial(machine().first_screen()->vpos()); + // m_old_vpos = machine().first_screen()->vpos(); + //} + } +} + +WRITE8_MEMBER( x1_state::x1_ex_gfxram_w ) +{ + UINT8 ex_mask; + + if ( offset <= 0x3fff) { ex_mask = 7; } + else if(offset >= 0x4000 && offset <= 0x7fff) { ex_mask = 6; } + else if(offset >= 0x8000 && offset <= 0xbfff) { ex_mask = 5; } + else { ex_mask = 3; } + + if(ex_mask & 1) { m_gfx_bitmap_ram[(offset & 0x3fff)+0x0000+(m_scrn_reg.gfx_bank*0xc000)] = data; } + if(ex_mask & 2) { m_gfx_bitmap_ram[(offset & 0x3fff)+0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; } + if(ex_mask & 4) { m_gfx_bitmap_ram[(offset & 0x3fff)+0x8000+(m_scrn_reg.gfx_bank*0xc000)] = data; } +} + +/* + SCRN flags + + d0(01) = 0:low resolution (15KHz) 1: high resolution (24KHz) + d1(02) = 0:1 raster / pixel 1:2 raster / pixel + d2(04) = 0:8 rasters / CHR 1:16 rasters / CHR + d3(08) = 0:bank 0 0:bank 1 <- display + d4(10) = 0:bank 0 0:bank 1 <- access + d5(20) = 0:compatibility 1:high speed <- define PCG mode + d6(40) = 0:8-raster graphics 1:16-raster graphics + d7(80) = 0:don't display 1:display <- underline (when 1, graphics are not displayed) +*/ +WRITE8_MEMBER( x1_state::x1_scrn_w ) +{ + m_scrn_reg.pcg_mode = BIT(data, 5); + m_scrn_reg.gfx_bank = BIT(data, 4); + m_scrn_reg.disp_bank = BIT(data, 3); + m_scrn_reg.ank_sel = BIT(data, 2); + m_scrn_reg.v400_mode = ((data & 0x03) == 3) ? 1 : 0; + + if(data & 0x80) + printf("SCRN = %02x\n",data & 0x80); + if((data & 0x03) == 1) + printf("SCRN sets true 400 lines mode\n"); +} + +WRITE8_MEMBER( x1_state::x1_pri_w ) +{ + m_scrn_reg.pri = data; +// printf("PRI = %02x\n",data); +} + +WRITE8_MEMBER( x1_state::x1_6845_w ) +{ + if(offset == 0) + { + m_crtc_index = data & 31; + machine().device("crtc")->address_w(space, offset, data); + } + else + { + m_crtc_vreg[m_crtc_index] = data; + machine().device("crtc")->register_w(space, offset, data); + } +} + +READ8_MEMBER( x1_state::x1turboz_blackclip_r ) +{ + /* TODO: this returns only on x1turboz */ + return m_scrn_reg.blackclip; +} + +WRITE8_MEMBER( x1_state::x1turbo_blackclip_w ) +{ + /* + -x-- ---- replace blanking duration with black + --x- ---- replace bitmap palette 1 with black + ---x ---- replace bitmap palette 0 with black + ---- x--- enable text blackclip + ---- -xxx palette color number for text black + */ + m_scrn_reg.blackclip = data; + if(data & 0x40) + printf("Blackclip data access %02x\n",data); +} + +READ8_MEMBER( x1_state::x1turbo_pal_r ) +{ + return m_turbo_reg.pal; +} + +READ8_MEMBER( x1_state::x1turbo_txpal_r ) +{ + return m_turbo_reg.txt_pal[offset]; +} + +READ8_MEMBER( x1_state::x1turbo_txdisp_r ) +{ + return m_turbo_reg.txt_disp; +} + +READ8_MEMBER( x1_state::x1turbo_gfxpal_r ) +{ + return m_turbo_reg.gfx_pal; +} + +WRITE8_MEMBER( x1_state::x1turbo_pal_w ) +{ + printf("TURBO PAL %02x\n",data); + m_turbo_reg.pal = data; +} + +WRITE8_MEMBER( x1_state::x1turbo_txpal_w ) +{ + int r,g,b; + + printf("TURBO TEXT PAL %02x %02x\n",data,offset); + m_turbo_reg.txt_pal[offset] = data; + + if(m_turbo_reg.pal & 0x80) + { + r = (data & 0x0c) >> 2; + g = (data & 0x30) >> 4; + b = (data & 0x03) >> 0; + + m_palette->set_pen_color(offset, pal2bit(r), pal2bit(g), pal2bit(b)); + } +} + +WRITE8_MEMBER( x1_state::x1turbo_txdisp_w ) +{ + printf("TURBO TEXT DISPLAY %02x\n",data); + m_turbo_reg.txt_disp = data; +} + +WRITE8_MEMBER( x1_state::x1turbo_gfxpal_w ) +{ + printf("TURBO GFX PAL %02x\n",data); + m_turbo_reg.gfx_pal = data; +} + + +/* + * FIXME: bit-wise this doesn't make any sense, I guess that it uses the lv 2 kanji roms + * Test cases for this port so far are Hyper Olympics '84 disk version and Might & Magic. + */ +UINT16 x1_state::jis_convert(int kanji_addr) +{ + if(kanji_addr >= 0x0e00 && kanji_addr <= 0x0e9f) { kanji_addr -= 0x0e00; kanji_addr &= 0x0ff; return ((0x0e0) + (kanji_addr >> 3)) << 4; } // numbers + if(kanji_addr >= 0x0f00 && kanji_addr <= 0x109f) { kanji_addr -= 0x0f00; kanji_addr &= 0x1ff; return ((0x4c0) + (kanji_addr >> 3)) << 4; } // lower case chars + if(kanji_addr >= 0x1100 && kanji_addr <= 0x129f) { kanji_addr -= 0x1100; kanji_addr &= 0x1ff; return ((0x2c0) + (kanji_addr >> 3)) << 4; } // upper case chars + if(kanji_addr >= 0x0100 && kanji_addr <= 0x01ff) { kanji_addr -= 0x0100; kanji_addr &= 0x0ff; return ((0x040) + (kanji_addr >> 3)) << 4; } // grammar symbols + if(kanji_addr >= 0x0500 && kanji_addr <= 0x06ff) { kanji_addr -= 0x0500; kanji_addr &= 0x1ff; return ((0x240) + (kanji_addr >> 3)) << 4; } // math symbols + if(kanji_addr >= 0x0300 && kanji_addr <= 0x04ff) { kanji_addr -= 0x0300; kanji_addr &= 0x1ff; return ((0x440) + (kanji_addr >> 3)) << 4; } // parentesis + + if(kanji_addr != 0x0720 && kanji_addr != 0x0730) + printf("%08x\n",kanji_addr); + + return 0x0000; +} + +READ8_MEMBER( x1_state::x1_kanji_r ) +{ + UINT8 res; + + res = m_kanji_rom[jis_convert(m_kanji_addr & 0xfff0)+(offset*0x10)+(m_kanji_addr & 0xf)]; + + if(offset == 1) + m_kanji_addr_latch++; + + return res; +} + +WRITE8_MEMBER( x1_state::x1_kanji_w ) +{ +// if(offset < 2) + + switch(offset) + { + case 0: m_kanji_addr_latch = (data & 0xff)|(m_kanji_addr_latch&0xff00); break; + case 1: m_kanji_addr_latch = (data<<8)|(m_kanji_addr_latch&0x00ff); + //if(m_kanji_addr_latch != 0x720 && m_kanji_addr_latch != 0x730) + // printf("%08x\n",m_kanji_addr_latch); + break; + case 2: + { + /* 0 -> selects Expanded EEPROM */ + /* 1 -> selects Kanji ROM */ + /* 0 -> 1 -> latches Kanji ROM data */ + + if(((m_kanji_eksel & 1) == 0) && ((data & 1) == 1)) + { + m_kanji_addr = (m_kanji_addr_latch); + //m_kanji_addr &= 0x3fff; //<- temp kludge until the rom is redumped. + //printf("%08x\n",m_kanji_addr); + //m_kanji_addr+= m_kanji_count; + } + m_kanji_eksel = data & 1; + } + break; + } +} + +READ8_MEMBER( x1_state::x1_emm_r ) +{ + UINT8 res; + + if(offset & ~3) + { + printf("Warning: read EMM BASIC area [%02x]\n",offset & 0xff); + return 0xff; + } + + if(offset != 3) + printf("Warning: read EMM address [%02x]\n",offset); + + res = 0xff; + + if(offset == 3) + { + res = m_emm_ram[m_emm_addr]; + m_emm_addr++; + } + + return res; +} + +WRITE8_MEMBER( x1_state::x1_emm_w ) +{ + if(offset & ~3) + { + printf("Warning: write EMM BASIC area [%02x] %02x\n",offset & 0xff,data); + return; + } + + switch(offset) + { + case 0: m_emm_addr = (m_emm_addr & 0xffff00) | (data & 0xff); break; + case 1: m_emm_addr = (m_emm_addr & 0xff00ff) | (data << 8); break; + case 2: m_emm_addr = (m_emm_addr & 0x00ffff) | (data << 16); break; //TODO: this has a max size limit, check exactly how much + case 3: + m_emm_ram[m_emm_addr] = data; + m_emm_addr++; + break; + } +} + +/* + CZ-141SF, CZ-127MF, X1turboZII, X1turboZ3 boards +*/ +READ8_MEMBER( x1_state::x1turbo_bank_r ) +{ +// printf("BANK access read\n"); + return m_ex_bank & 0x3f; +} + +WRITE8_MEMBER( x1_state::x1turbo_bank_w ) +{ + //UINT8 *RAM = memregion("x1_cpu")->base(); + /* + --x- ---- BML5: latch bit (doesn't have any real function) + ---x ---- BMCS: select bank RAM, active low + ---- xxxx BMNO: Bank memory ID + */ + + m_ex_bank = data & 0x3f; +// printf("BANK access write %02x\n",data); +} + +/* TODO: waitstate penalties */ +READ8_MEMBER( x1_state::x1_mem_r ) +{ + if((offset & 0x8000) == 0 && (m_ram_bank == 0)) + { + return m_ipl_rom[offset]; //ROM + } + + return m_work_ram[offset]; //RAM +} + +WRITE8_MEMBER( x1_state::x1_mem_w ) +{ + m_work_ram[offset] = data; //RAM +} + +READ8_MEMBER( x1_state::x1turbo_mem_r ) +{ + if((m_ex_bank & 0x10) == 0) + return m_work_ram[offset+((m_ex_bank & 0xf)*0x10000)]; + + return x1_mem_r(space,offset); +} + +WRITE8_MEMBER( x1_state::x1turbo_mem_w ) +{ + if((m_ex_bank & 0x10) == 0) + m_work_ram[offset+((m_ex_bank & 0xf)*0x10000)] = data; //RAM + else + x1_mem_w(space,offset,data); +} + +/************************************* + * + * Memory maps + * + *************************************/ + +READ8_MEMBER( x1_state::x1_io_r ) +{ + m_io_bank_mode = 0; //any read disables the extended mode. + + if(offset == 0x0e03) { return x1_rom_r(space, 0); } + // TODO: user could install ym2151 on plain X1 too + //0x700, 0x701 + //if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(m_ctc, offset-0x0704); } + else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } + else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } + else if(offset >= 0x1900 && offset <= 0x19ff) { return x1_sub_io_r(space, 0); } + else if(offset >= 0x1a00 && offset <= 0x1aff) { return machine().device("ppi8255_0")->read(space, (offset-0x1a00) & 3); } + else if(offset >= 0x1b00 && offset <= 0x1bff) { return machine().device("ay")->data_r(space, 0); } +// else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(machine().device("dma"), 0); } +// else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(machine().device("sio"), (offset-0x1f90) & 1); } +// else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(machine().device("sio"), (offset-0x1f92) & 1); } + else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return m_ctc->read(space,offset-0x1fa0); } + else if(offset >= 0x1fa8 && offset <= 0x1fab) { return m_ctc->read(space,offset-0x1fa8); } +// else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } +// else if(offset == 0x1fe0) { return x1turboz_blackclip_r(space,0); } + else if(offset >= 0x2000 && offset <= 0x2fff) { return m_avram[offset & 0x7ff]; } + else if(offset >= 0x3000 && offset <= 0x3fff) { return m_tvram[offset & 0x7ff]; } // Ys checks if it's a x1/x1turbo machine by checking if this area is a mirror + else if(offset >= 0x4000 && offset <= 0xffff) { return m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)]; } + else + { + //logerror("(PC=%06x) Read i/o address %04x\n",space.device().safe_pc(),offset); + } + return 0xff; +} + +WRITE8_MEMBER( x1_state::x1_io_w ) +{ + if(m_io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } + // TODO: user could install ym2151 on plain X1 too + //0x700, 0x701 +// else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(m_ctc, offset-0x0704,data); } +// else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(machine(), 0, data); } + else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } +// else if(offset >= 0x0e80 && offset <= 0x0e82) { x1_kanji_w(machine(), offset-0xe80,data); } + else if(offset >= 0x0ff8 && offset <= 0x0fff) { x1_fdc_w(space, offset-0xff8,data); } + else if(offset >= 0x1000 && offset <= 0x10ff) { x1_pal_b_w(space, 0,data); } + else if(offset >= 0x1100 && offset <= 0x11ff) { x1_pal_r_w(space, 0,data); } + else if(offset >= 0x1200 && offset <= 0x12ff) { x1_pal_g_w(space, 0,data); } + else if(offset >= 0x1300 && offset <= 0x13ff) { x1_pri_w(space, 0,data); } + else if(offset >= 0x1400 && offset <= 0x17ff) { x1_pcg_w(space, offset-0x1400,data); } + else if(offset == 0x1800 || offset == 0x1801) { x1_6845_w(space, offset-0x1800, data); } + else if(offset >= 0x1900 && offset <= 0x19ff) { x1_sub_io_w(space, 0,data); } + else if(offset >= 0x1a00 && offset <= 0x1aff) { machine().device("ppi8255_0")->write(space, (offset-0x1a00) & 3,data); } + else if(offset >= 0x1b00 && offset <= 0x1bff) { machine().device("ay")->data_w(space, 0,data); } + else if(offset >= 0x1c00 && offset <= 0x1cff) { machine().device("ay")->address_w(space, 0,data); } + else if(offset >= 0x1d00 && offset <= 0x1dff) { x1_rom_bank_1_w(space,0,data); } + else if(offset >= 0x1e00 && offset <= 0x1eff) { x1_rom_bank_0_w(space,0,data); } +// else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(machine().device("dma"), 0,data); } +// else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(machine().device("sio"), (offset-0x1f90) & 1,data); } +// else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(machine().device("sio"), (offset-0x1f92) & 1,data); } + else if(offset >= 0x1fa0 && offset <= 0x1fa3) { m_ctc->write(space,offset-0x1fa0,data); } + else if(offset >= 0x1fa8 && offset <= 0x1fab) { m_ctc->write(space,offset-0x1fa8,data); } +// else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } +// else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } +// else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } +// else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } +// else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } +// else if(offset == 0x1fe0) { x1turbo_blackclip_w(space,0,data); } + else if(offset >= 0x2000 && offset <= 0x2fff) { m_avram[offset & 0x7ff] = data; } + else if(offset >= 0x3000 && offset <= 0x3fff) { m_tvram[offset & 0x7ff] = data; } + else if(offset >= 0x4000 && offset <= 0xffff) { m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; } + else + { + //logerror("(PC=%06x) Write %02x at i/o address %04x\n",space.device().safe_pc(),data,offset); + } +} + +/* TODO: I should actually simplify this, by just overwriting X1 Turbo specifics here, and call plain X1 functions otherwise */ +READ8_MEMBER( x1_state::x1turbo_io_r ) +{ + m_io_bank_mode = 0; //any read disables the extended mode. + + // a * at the end states devices used on plain X1 too + if(offset == 0x0700) { return (machine().device("ym")->read(space, offset-0x0700) & 0x7f) | (ioport("SOUND_SW")->read() & 0x80); } + else if(offset == 0x0701) { return machine().device("ym")->read(space, offset-0x0700); } + //0x704 is FM sound detection port on X1 turboZ + else if(offset >= 0x0704 && offset <= 0x0707) { return m_ctc->read(space,offset-0x0704); } + else if(offset == 0x0801) { printf("Color image board read\n"); return 0xff; } // * + else if(offset == 0x0803) { printf("Color image board 2 read\n"); return 0xff; } // * + else if(offset >= 0x0a00 && offset <= 0x0a07) { printf("Stereoscopic board read %04x\n",offset); return 0xff; } // * + else if(offset == 0x0b00) { return x1turbo_bank_r(space,0); } + else if(offset >= 0x0c00 && offset <= 0x0cff) { printf("RS-232C read %04x\n",offset); return 0; } // * + else if(offset >= 0x0d00 && offset <= 0x0dff) { return x1_emm_r(space,offset & 0xff); } // * + else if(offset == 0x0e03) { return x1_rom_r(space, 0); } + else if(offset >= 0x0e80 && offset <= 0x0e81) { return x1_kanji_r(space, offset-0xe80); } + else if(offset >= 0x0fd0 && offset <= 0x0fd3) { /* printf("SASI HDD read %04x\n",offset); */ return 0xff; } // * + else if(offset >= 0x0fe8 && offset <= 0x0fef) { printf("8-inch FD read %04x\n",offset); return 0xff; } // * + else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } + else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } + else if(offset >= 0x1900 && offset <= 0x19ff) { return x1_sub_io_r(space, 0); } + else if(offset >= 0x1a00 && offset <= 0x1aff) { return machine().device("ppi8255_0")->read(space, (offset-0x1a00) & 3); } + else if(offset >= 0x1b00 && offset <= 0x1bff) { return machine().device("ay")->data_r(space, 0); } + else if(offset >= 0x1f80 && offset <= 0x1f8f) { return m_dma->read(space, 0); } + else if(offset >= 0x1f90 && offset <= 0x1f93) { return machine().device("sio")->ba_cd_r(space, (offset-0x1f90) & 3); } + else if(offset >= 0x1f98 && offset <= 0x1f9f) { printf("Extended SIO/CTC read %04x\n",offset); return 0xff; } + else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return m_ctc->read(space,offset-0x1fa0); } + else if(offset >= 0x1fa8 && offset <= 0x1fab) { return m_ctc->read(space,offset-0x1fa8); } + else if(offset == 0x1fb0) { return x1turbo_pal_r(space,0); } // Z only! + else if(offset >= 0x1fb8 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb8); } //Z only! + else if(offset == 0x1fc0) { return x1turbo_txdisp_r(space,0); } // Z only! + else if(offset == 0x1fc5) { return x1turbo_gfxpal_r(space,0); } // Z only! +// else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } //Z only + else if(offset == 0x1fe0) { return x1turboz_blackclip_r(space,0); } + else if(offset == 0x1ff0) { return ioport("X1TURBO_DSW")->read(); } + else if(offset >= 0x2000 && offset <= 0x2fff) { return m_avram[offset & 0x7ff]; } + else if(offset >= 0x3000 && offset <= 0x37ff) { return m_tvram[offset & 0x7ff]; } + else if(offset >= 0x3800 && offset <= 0x3fff) { return m_kvram[offset & 0x7ff]; } + else if(offset >= 0x4000 && offset <= 0xffff) { return m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)]; } + else + { + //logerror("(PC=%06x) Read i/o address %04x\n",space.device().safe_pc(),offset); + } + return 0xff; +} + +WRITE8_MEMBER( x1_state::x1turbo_io_w ) +{ + // a * at the end states devices used on plain X1 too + if(m_io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } + else if(offset == 0x0700 || offset == 0x0701) { machine().device("ym")->write(space, offset-0x0700,data); } + //0x704 is FM sound detection port on X1 turboZ + else if(offset >= 0x0704 && offset <= 0x0707) { m_ctc->write(space,offset-0x0704,data); } + else if(offset == 0x0800) { printf("Color image board write %02x\n",data); } // * + else if(offset == 0x0802) { printf("Color image board 2 write %02x\n",data); } // * + else if(offset >= 0x0a00 && offset <= 0x0a07) { printf("Stereoscopic board write %04x %02x\n",offset,data); } // * + else if(offset == 0x0b00) { x1turbo_bank_w(space,0,data); } + else if(offset >= 0x0c00 && offset <= 0x0cff) { printf("RS-232C write %04x %02x\n",offset,data); } // * + else if(offset >= 0x0d00 && offset <= 0x0dff) { x1_emm_w(space,offset & 0xff,data); } // * + else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } + else if(offset >= 0x0e80 && offset <= 0x0e83) { x1_kanji_w(space, offset-0xe80,data); } + else if(offset >= 0x0fd0 && offset <= 0x0fd3) { printf("SASI HDD write %04x %02x\n",offset,data); } // * + else if(offset >= 0x0fe8 && offset <= 0x0fef) { printf("8-inch FD write %04x %02x\n",offset,data); } // * + else if(offset >= 0x0ff8 && offset <= 0x0fff) { x1_fdc_w(space, offset-0xff8,data); } + else if(offset >= 0x1000 && offset <= 0x10ff) { x1_pal_b_w(space, offset & 0x3ff,data); } + else if(offset >= 0x1100 && offset <= 0x11ff) { x1_pal_r_w(space, offset & 0x3ff,data); } + else if(offset >= 0x1200 && offset <= 0x12ff) { x1_pal_g_w(space, offset & 0x3ff,data); } + else if(offset >= 0x1300 && offset <= 0x13ff) { x1_pri_w(space, 0,data); } + else if(offset >= 0x1400 && offset <= 0x17ff) { x1_pcg_w(space, offset-0x1400,data); } + else if(offset == 0x1800 || offset == 0x1801) { x1_6845_w(space, offset-0x1800, data); } + else if(offset >= 0x1900 && offset <= 0x19ff) { x1_sub_io_w(space, 0,data); } + else if(offset >= 0x1a00 && offset <= 0x1aff) { machine().device("ppi8255_0")->write(space, (offset-0x1a00) & 3,data); } + else if(offset >= 0x1b00 && offset <= 0x1bff) { machine().device("ay")->data_w(space, 0,data); } + else if(offset >= 0x1c00 && offset <= 0x1cff) { machine().device("ay")->address_w(space, 0,data); } + else if(offset >= 0x1d00 && offset <= 0x1dff) { x1_rom_bank_1_w(space,0,data); } + else if(offset >= 0x1e00 && offset <= 0x1eff) { x1_rom_bank_0_w(space,0,data); } + else if(offset >= 0x1f80 && offset <= 0x1f8f) { m_dma->write(space, 0,data); } + else if(offset >= 0x1f90 && offset <= 0x1f93) { machine().device("sio")->ba_cd_w(space, (offset-0x1f90) & 3,data); } + else if(offset >= 0x1f98 && offset <= 0x1f9f) { printf("Extended SIO/CTC write %04x %02x\n",offset,data); } + else if(offset >= 0x1fa0 && offset <= 0x1fa3) { m_ctc->write(space,offset-0x1fa0,data); } + else if(offset >= 0x1fa8 && offset <= 0x1fab) { m_ctc->write(space,offset-0x1fa8,data); } + else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } // Z only! + else if(offset >= 0x1fb8 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb8,data); } //Z only! + else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } //Z only! + else if(offset == 0x1fc1) { printf("Z image capturing access %02x\n",data); } // Z only! + else if(offset == 0x1fc2) { printf("Z mosaic effect access %02x\n",data); } // Z only! + else if(offset == 0x1fc3) { printf("Z Chroma key access %02x\n",data); } // Z only! + else if(offset == 0x1fc4) { printf("Z Extra scroll config access %02x\n",data); } // Z only! + else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } // Z only! + else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } + else if(offset == 0x1fe0) { x1turbo_blackclip_w(space,0,data); } + else if(offset >= 0x2000 && offset <= 0x2fff) { m_avram[offset & 0x7ff] = data; } + else if(offset >= 0x3000 && offset <= 0x37ff) { m_tvram[offset & 0x7ff] = data; } + else if(offset >= 0x3800 && offset <= 0x3fff) { m_kvram[offset & 0x7ff] = data; } + else if(offset >= 0x4000 && offset <= 0xffff) { m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; } + else + { + //logerror("(PC=%06x) Write %02x at i/o address %04x\n",space.device().safe_pc(),data,offset); + } +} + +static ADDRESS_MAP_START( x1_mem, AS_PROGRAM, 8, x1_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_mem_r,x1_mem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( x1turbo_mem, AS_PROGRAM, 8, x1_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1turbo_mem_r,x1turbo_mem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( x1_io, AS_IO, 8, x1_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_io_r, x1_io_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( x1turbo_io, AS_IO, 8, x1_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1turbo_io_r, x1turbo_io_w) +ADDRESS_MAP_END + +/************************************* + * + * PPI8255 + * + *************************************/ + +READ8_MEMBER( x1_state::x1_porta_r ) +{ + printf("PPI Port A read\n"); + return 0xff; +} + +/* this port is system related */ +READ8_MEMBER( x1_state::x1_portb_r ) +{ + //printf("PPI Port B read\n"); + /* + x--- ---- "v disp" + -x-- ---- "sub cpu ibf" + --x- ---- "sub cpu obf" + ---x ---- ROM/RAM flag (0=ROM, 1=RAM) + ---- x--- "busy" <- allow printer data output + ---- -x-- "v sync" + ---- --x- "cmt read" + ---- ---x "cmt test" (active low) <- actually this is "Sub CPU detected BREAK" + */ + UINT8 res = 0; + int vblank_line = m_crtc_vreg[6] * (m_crtc_vreg[9]+1); + int vsync_line = m_crtc_vreg[7] * (m_crtc_vreg[9]+1); + m_vdisp = (machine().first_screen()->vpos() < vblank_line) ? 0x80 : 0x00; + m_vsync = (machine().first_screen()->vpos() < vsync_line) ? 0x00 : 0x04; + +// popmessage("%d",vsync_line); +// popmessage("%d",vblank_line); + + res = m_ram_bank | m_sub_obf | m_vsync | m_vdisp; + + if(m_cassette->input() > 0.03) + res |= 0x02; + +// if(cassette_get_state(m_cassette) & CASSETTE_MOTOR_DISABLED) +// res &= ~0x02; // is zero if not playing + + // CMT test bit is set low when the CMT Stop command is issued, and becomes + // high again when this bit is read. + res |= 0x01; + if(m_cmt_test != 0) + { + m_cmt_test = 0; + res &= ~0x01; + } + + return res; +} + +/* I/O system port */ +READ8_MEMBER( x1_state::x1_portc_r ) +{ + //printf("PPI Port C read\n"); + /* + x--- ---- Printer port output + -x-- ---- 320 mode (r/w), divider for the pixel clock + --x- ---- i/o mode (r/w) + ---x ---- smooth scroll enabled (?) + ---- ---x cassette output data + */ + return (m_io_sys & 0x9f) | m_hres_320 | ~m_io_switch; +} + +WRITE8_MEMBER( x1_state::x1_porta_w ) +{ + //printf("PPI Port A write %02x\n",data); +} + +WRITE8_MEMBER( x1_state::x1_portb_w ) +{ + //printf("PPI Port B write %02x\n",data); +} + +WRITE8_MEMBER( x1_state::x1_portc_w ) +{ + m_hres_320 = data & 0x40; + + /* set up the pixel clock according to the above divider */ + m_crtc->set_clock(VDP_CLOCK/((m_hres_320) ? 48 : 24)); + + if(!BIT(data, 5) && BIT(m_io_switch, 5)) + m_io_bank_mode = 1; + + m_io_switch = data & 0x20; + m_io_sys = data & 0xff; + + m_cassette->output(BIT(data, 0) ? +1.0 : -1.0); +} + +READ8_MEMBER(x1_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(x1_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.write_byte(offset, data); +} + +READ8_MEMBER(x1_state::io_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(x1_state::io_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.write_byte(offset, data); +} + +/************************************* + * + * Inputs + * + *************************************/ + +INPUT_CHANGED_MEMBER(x1_state::ipl_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); + + m_ram_bank = 0x00; + if(m_is_turbo) { m_ex_bank = 0x10; } + //anything else? +} + +/* Apparently most games doesn't support this (not even the Konami ones!), one that does is...177 :o */ +INPUT_CHANGED_MEMBER(x1_state::nmi_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_PORTS_START( x1 ) + PORT_START("FP_SYS") //front panel buttons, hard-wired with the soft reset/NMI lines + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, x1_state, ipl_reset,0) PORT_NAME("IPL reset") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, x1_state, nmi_reset,0) PORT_NAME("NMI reset") + + PORT_START("SOUND_SW") //FIXME: this is X1Turbo specific + PORT_DIPNAME( 0x80, 0x80, "OPM Sound Setting?" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("IOSYS") //TODO: implement front-panel DIP-SW here + PORT_DIPNAME( 0x01, 0x01, "IOSYS" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Sound Setting?" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("key1") //0x00-0x1f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-8") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-8") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + + PORT_START("key2") //0x20-0x3f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2b + + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2e . + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2f / + + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3c < + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? + + PORT_START("key3") //0x40-0x5f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") + + PORT_START("f_keys") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + + PORT_START("tenkey") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) + // TODO: add other numpad keys + + PORT_START("key_modifiers") + PORT_BIT(0x00000001,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x00000002,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00000004,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x00000008,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x00000010,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) + +#if 0 + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") + + PORT_START("key3") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey ,") + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("EL") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DUP") PORT_CODE(KEYCODE_END) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) + +#endif +INPUT_PORTS_END + +INPUT_PORTS_START( x1turbo ) + PORT_INCLUDE( x1 ) + + PORT_START("X1TURBO_DSW") + PORT_DIPNAME( 0x01, 0x01, "Interlace mode" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x0e, 0x00, "Default Auto-boot Device" ) // this selects what kind of device is loaded at start-up + PORT_DIPSETTING( 0x00, "5/3-inch 2D" ) + PORT_DIPSETTING( 0x02, "5/3-inch 2DD" ) + PORT_DIPSETTING( 0x04, "5/3-inch 2HD" ) + PORT_DIPSETTING( 0x06, "5/3-inch 2DD (IBM)" ) + PORT_DIPSETTING( 0x08, "8-inch 2D256" ) + PORT_DIPSETTING( 0x0a, "8-inch 2D256 (IBM)" ) + PORT_DIPSETTING( 0x0c, "8-inch 1S128 (IBM)" ) + PORT_DIPSETTING( 0x0e, "SASI HDD" ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) //this is a port conditional of some sort ... + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +/************************************* + * + * GFX decoding + * + *************************************/ + +static const gfx_layout x1_chars_8x8 = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout x1_chars_8x16 = +{ + 8,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, + 8*16 +}; + +static const gfx_layout x1_chars_16x16 = +{ + 8,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 +}; + +/* decoded for debugging purpose, this will be nuked in the end... */ +static GFXDECODE_START( x1 ) + GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8, 0, 1 ) + GFXDECODE_ENTRY( "font", 0x00000, x1_chars_8x16, 0, 1 ) + GFXDECODE_ENTRY( "kanji", 0x00000, x1_chars_16x16, 0, 1 ) +// GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8, 0, 1 ) +GFXDECODE_END + +static const z80_daisy_config x1_daisy[] = +{ + { "x1kb" }, + { "ctc" }, + { NULL } +}; + +static const z80_daisy_config x1turbo_daisy[] = +{ + { "x1kb" }, + { "ctc" }, + { "dma" }, + { "sio" }, + { NULL } +}; + +/************************************* + * + * Machine Functions + * + *************************************/ + +#ifdef UNUSED_FUNCTION +IRQ_CALLBACK_MEMBER(x1_state::x1_irq_callback) +{ + if(m_ctc_irq_flag != 0) + { + m_ctc_irq_flag = 0; + if(m_key_irq_flag == 0) // if no other devices are pulling the IRQ line high + device.execute().set_input_line(0, CLEAR_LINE); + return m_irq_vector; + } + if(m_key_irq_flag != 0) + { + m_key_irq_flag = 0; + if(m_ctc_irq_flag == 0) // if no other devices are pulling the IRQ line high + device.execute().set_input_line(0, CLEAR_LINE); + return m_key_irq_vector; + } + return m_irq_vector; +} +#endif + +TIMER_DEVICE_CALLBACK_MEMBER(x1_state::x1_keyboard_callback) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT32 key1 = ioport("key1")->read(); + UINT32 key2 = ioport("key2")->read(); + UINT32 key3 = ioport("key3")->read(); + UINT32 key4 = ioport("tenkey")->read(); + UINT32 f_key = ioport("f_keys")->read(); + + if(m_key_irq_vector) + { + //if(key1 == 0 && key2 == 0 && key3 == 0 && key4 == 0 && f_key == 0) + // return; + + if((key1 != m_old_key1) || (key2 != m_old_key2) || (key3 != m_old_key3) || (key4 != m_old_key4) || (f_key != m_old_fkey)) + { + // generate keyboard IRQ + x1_sub_io_w(space,0,0xe6); + m_irq_vector = m_key_irq_vector; + m_key_irq_flag = 1; + m_maincpu->set_input_line(0,ASSERT_LINE); + m_old_key1 = key1; + m_old_key2 = key2; + m_old_key3 = key3; + m_old_key4 = key4; + m_old_fkey = f_key; + } + } +} + +TIMER_CALLBACK_MEMBER(x1_state::x1_rtc_increment) +{ + static const UINT8 dpm[12] = { 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31 }; + + m_rtc.sec++; + + if((m_rtc.sec & 0x0f) >= 0x0a) { m_rtc.sec+=0x10; m_rtc.sec&=0xf0; } + if((m_rtc.sec & 0xf0) >= 0x60) { m_rtc.min++; m_rtc.sec = 0; } + if((m_rtc.min & 0x0f) >= 0x0a) { m_rtc.min+=0x10; m_rtc.min&=0xf0; } + if((m_rtc.min & 0xf0) >= 0x60) { m_rtc.hour++; m_rtc.min = 0; } + if((m_rtc.hour & 0x0f) >= 0x0a) { m_rtc.hour+=0x10; m_rtc.hour&=0xf0; } + if((m_rtc.hour & 0xff) >= 0x24) { m_rtc.day++; m_rtc.wday++; m_rtc.hour = 0; } + if((m_rtc.wday & 0x0f) >= 0x07) { m_rtc.wday = 0; } + if((m_rtc.day & 0x0f) >= 0x0a) { m_rtc.day+=0x10; m_rtc.day&=0xf0; } + /* FIXME: very crude leap year support (i.e. it treats the RTC to be with a 2000-2099 timeline), dunno how the real x1 supports this, + maybe it just have a 1980-1999 timeline since year 0x00 shows as a XX on display */ + if(((m_rtc.year % 4) == 0) && m_rtc.month == 2) + { + if((m_rtc.day & 0xff) >= dpm[m_rtc.month-1]+1+1) + { m_rtc.month++; m_rtc.day = 0x01; } + } + else if((m_rtc.day & 0xff) >= dpm[m_rtc.month-1]+1){ m_rtc.month++; m_rtc.day = 0x01; } + if(m_rtc.month > 12) { m_rtc.year++; m_rtc.month = 0x01; } + if((m_rtc.year & 0x0f) >= 0x0a) { m_rtc.year+=0x10; m_rtc.year&=0xf0; } + if((m_rtc.year & 0xf0) >= 0xa0) { m_rtc.year = 0; } //roll over +} + +MACHINE_RESET_MEMBER(x1_state,x1) +{ + //UINT8 *ROM = memregion("x1_cpu")->base(); + int i; + + memset(m_gfx_bitmap_ram,0x00,0xc000*2); + + for(i=0;i<0x1800;i++) + { + m_pcg_ram[i] = 0; + m_gfxdecode->gfx(3)->mark_dirty(i >> 3); + } + + m_is_turbo = 0; + + m_io_bank_mode = 0; + + //m_x1_cpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(x1_state::x1_irq_callback),this)); + + m_cmt_current_cmd = 0; + m_cmt_test = 0; + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + + m_key_irq_flag = m_ctc_irq_flag = 0; + m_sub_cmd = 0; + m_key_irq_vector = 0; + m_sub_cmd_length = 0; + m_sub_val[0] = 0; + m_sub_val[1] = 0; + m_sub_val[2] = 0; + m_sub_val[3] = 0; + m_sub_val[4] = 0; + m_sub_obf = (m_sub_cmd_length) ? 0x00 : 0x20; + + m_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1)); + + /* Reinitialize palette here if there's a soft reset for the Turbo PAL stuff*/ + for(i=0;i<0x10;i++) + m_palette->set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); + + m_ram_bank = 0; +// m_old_vpos = -1; +} + +MACHINE_RESET_MEMBER(x1_state,x1turbo) +{ + MACHINE_RESET_CALL_MEMBER( x1 ); + m_is_turbo = 1; + m_ex_bank = 0x10; + + m_scrn_reg.blackclip = 0; +} + +static const gfx_layout x1_pcg_8x8 = +{ + 8,8, + 0x100, + 3, + { 0x1000*8,0x800*8, 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +MACHINE_START_MEMBER(x1_state,x1) +{ + /* set up RTC */ + { + system_time systime; + machine().base_datetime(systime); + + m_rtc.day = ((systime.local_time.mday / 10)<<4) | ((systime.local_time.mday % 10) & 0xf); + m_rtc.month = ((systime.local_time.month+1)); + m_rtc.wday = ((systime.local_time.weekday % 10) & 0xf); + m_rtc.year = (((systime.local_time.year % 100)/10)<<4) | ((systime.local_time.year % 10) & 0xf); + m_rtc.hour = ((systime.local_time.hour / 10)<<4) | ((systime.local_time.hour % 10) & 0xf); + m_rtc.min = ((systime.local_time.minute / 10)<<4) | ((systime.local_time.minute % 10) & 0xf); + m_rtc.sec = ((systime.local_time.second / 10)<<4) | ((systime.local_time.second % 10) & 0xf); + + m_rtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x1_state::x1_rtc_increment),this)); + } + + m_ipl_rom = memregion("ipl")->base(); + m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000*0x10); + m_emm_ram = auto_alloc_array_clear(machine(), UINT8, 0x1000000); + m_pcg_ram = auto_alloc_array_clear(machine(), UINT8, 0x1800); + m_cg_rom = memregion("cgrom")->base(); + m_kanji_rom = memregion("kanji")->base(); + + save_pointer(NAME(m_work_ram), 0x10000*0x10); + save_pointer(NAME(m_emm_ram), 0x1000000); + save_pointer(NAME(m_pcg_ram), 0x1800); + + m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, x1_pcg_8x8, (UINT8 *)m_pcg_ram, 0, 1, 0))); +} + +PALETTE_INIT_MEMBER(x1_state,x1) +{ + int i; + + for(i=0;i<(0x10+0x1000);i++) + palette.set_pen_color(i,rgb_t(0x00,0x00,0x00)); +} + +FLOPPY_FORMATS_MEMBER( x1_state::floppy_formats ) + FLOPPY_2D_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( x1_floppies ) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( x1, x1_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("x1_cpu", Z80, MAIN_CLOCK/4) + MCFG_CPU_PROGRAM_MAP(x1_mem) + MCFG_CPU_IO_MAP(x1_io) + MCFG_CPU_CONFIG(x1_daisy) + + MCFG_DEVICE_ADD("ctc", Z80CTC, MAIN_CLOCK/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("ctc", z80ctc_device, trg3)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("ctc", z80ctc_device, trg1)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("ctc", z80ctc_device, trg2)) + + MCFG_DEVICE_ADD("x1kb", X1_KEYBOARD, 0) + + MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(x1_state, x1_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(x1_state, x1_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(x1_state, x1_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(x1_state, x1_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(x1_state, x1_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(x1_state, x1_portc_w)) + + MCFG_MACHINE_START_OVERRIDE(x1_state,x1) + MCFG_MACHINE_RESET_OVERRIDE(x1_state,x1) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(x1_state, screen_update_x1) + + MCFG_MC6845_ADD("crtc", H46505, "screen", (VDP_CLOCK/48)) //unknown divider + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_PALETTE_ADD("palette", 0x10+0x1000) + MCFG_PALETTE_INIT_OWNER(x1_state,x1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", x1) + + MCFG_VIDEO_START_OVERRIDE(x1_state,x1) + + MCFG_MB8877_ADD("fdc", MAIN_CLOCK / 16) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", x1_floppies, "dd", x1_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "x1_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + /* TODO:is the AY mono or stereo? Also volume balance isn't right. */ + MCFG_SOUND_ADD("ay", AY8910, MAIN_CLOCK/8) + MCFG_AY8910_PORT_A_READ_CB(IOPORT("P1")) + MCFG_AY8910_PORT_B_READ_CB(IOPORT("P2")) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) + MCFG_SOUND_ROUTE(0, "rspeaker", 0.25) + MCFG_SOUND_ROUTE(1, "lspeaker", 0.5) + MCFG_SOUND_ROUTE(2, "rspeaker", 0.5) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(x1_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("x1_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","x1_cass") + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", x1_state, x1_keyboard_callback, attotime::from_hz(250)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cmt_wind_timer", x1_state, x1_cmt_wind_timer, attotime::from_hz(16)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( x1turbo, x1 ) + MCFG_CPU_MODIFY("x1_cpu") + MCFG_CPU_PROGRAM_MAP(x1turbo_mem) + MCFG_CPU_IO_MAP(x1turbo_io) + MCFG_CPU_CONFIG(x1turbo_daisy) + MCFG_MACHINE_RESET_OVERRIDE(x1_state,x1turbo) + + MCFG_Z80SIO0_ADD("sio", MAIN_CLOCK/4 , 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("dma", Z80DMA, MAIN_CLOCK/4) + MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE("x1_cpu", INPUT_LINE_HALT)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) + MCFG_Z80DMA_IN_MREQ_CB(READ8(x1_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(x1_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(x1_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(x1_state, io_write_byte)) + + MCFG_DEVICE_MODIFY("fdc") + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(x1_state, fdc_drq_w)) + + MCFG_YM2151_ADD("ym", MAIN_CLOCK/8) //option board + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) +MACHINE_CONFIG_END + +/************************************* + * + * ROM definitions + * + *************************************/ + +ROM_START( x1 ) + ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.x1", 0x0000, 0x1000, CRC(7b28d9de) SHA1(c4db9a6e99873808c8022afd1c50fef556a8b44d) ) + + ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu" + ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION(0x2000, "font", 0) //TODO: this contains 8x16 charset only, maybe it's possible that it derivates a 8x8 charset by skipping gfx lines? + ROM_LOAD( "ank.fnt", 0x0000, 0x2000, BAD_DUMP CRC(19689fbd) SHA1(0d4e072cd6195a24a1a9b68f1d37500caa60e599) ) + + ROM_REGION(0x1800, "cgrom", 0) + ROM_LOAD("fnt0808.x1", 0x00000, 0x00800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) ) + ROM_COPY("font", 0x1000, 0x00800, 0x1000 ) + + ROM_REGION(0x20000, "kanji", ROMREGION_ERASEFF) + + ROM_REGION(0x20000, "raw_kanji", ROMREGION_ERASEFF) +ROM_END + +ROM_START( x1turbo ) + ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.x1t", 0x0000, 0x8000, CRC(2e8b767c) SHA1(44620f57a25f0bcac2b57ca2b0f1ebad3bf305d3) ) + + ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu" + ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION(0x2000, "font", 0) //TODO: this contains 8x16 charset only, maybe it's possible that it derivates a 8x8 charset by skipping gfx lines? + ROM_LOAD( "ank.fnt", 0x0000, 0x2000, CRC(19689fbd) SHA1(0d4e072cd6195a24a1a9b68f1d37500caa60e599) ) + + ROM_REGION(0x4800, "cgrom", 0) + ROM_LOAD("fnt0808_turbo.x1", 0x00000, 0x00800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) ) + ROM_COPY("font", 0x01000, 0x00800, 0x1000 ) + + ROM_REGION(0x20000, "kanji", ROMREGION_ERASEFF) + + ROM_REGION(0x20000, "raw_kanji", ROMREGION_ERASEFF) + ROM_LOAD("kanji4.rom", 0x00000, 0x8000, CRC(3e39de89) SHA1(d3fd24892bb1948c4697dedf5ff065ff3eaf7562) ) + ROM_LOAD("kanji2.rom", 0x08000, 0x8000, CRC(e710628a) SHA1(103bbe459dc8da27a9400aa45b385255c18fcc75) ) + ROM_LOAD("kanji3.rom", 0x10000, 0x8000, CRC(8cae13ae) SHA1(273f3329c70b332f6a49a3a95e906bbfe3e9f0a1) ) + ROM_LOAD("kanji1.rom", 0x18000, 0x8000, CRC(5874f70b) SHA1(dad7ada1b70c45f1e9db11db273ef7b385ef4f17) ) +ROM_END + +ROM_START( x1turbo40 ) + ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.bin", 0x0000, 0x8000, CRC(112f80a2) SHA1(646cc3fb5d2d24ff4caa5167b0892a4196e9f843) ) + + ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu" + ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION(0x2000, "font", 0) //TODO: this contains 8x16 charset only, maybe it's possible that it derivates a 8x8 charset by skipping gfx lines? + ROM_LOAD( "ank.fnt", 0x0000, 0x2000, CRC(19689fbd) SHA1(0d4e072cd6195a24a1a9b68f1d37500caa60e599) ) + + ROM_REGION(0x4800, "cgrom", 0) + ROM_LOAD("fnt0808_turbo.x1",0x00000, 0x0800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) ) + ROM_COPY("font", 0x01000, 0x0800, 0x1000 ) + + ROM_REGION(0x20000, "kanji", ROMREGION_ERASEFF) + + ROM_REGION(0x20000, "raw_kanji", ROMREGION_ERASEFF) + ROM_LOAD("kanji4.rom", 0x00000, 0x8000, CRC(3e39de89) SHA1(d3fd24892bb1948c4697dedf5ff065ff3eaf7562) ) + ROM_LOAD("kanji2.rom", 0x08000, 0x8000, CRC(e710628a) SHA1(103bbe459dc8da27a9400aa45b385255c18fcc75) ) + ROM_LOAD("kanji3.rom", 0x10000, 0x8000, CRC(8cae13ae) SHA1(273f3329c70b332f6a49a3a95e906bbfe3e9f0a1) ) + ROM_LOAD("kanji1.rom", 0x18000, 0x8000, CRC(5874f70b) SHA1(dad7ada1b70c45f1e9db11db273ef7b385ef4f17) ) +ROM_END + + +/* Convert the ROM interleaving into something usable by the write handlers */ +DRIVER_INIT_MEMBER(x1_state,x1_kanji) +{ + UINT32 i,j,k,l; + UINT8 *kanji = memregion("kanji")->base(); + UINT8 *raw_kanji = memregion("raw_kanji")->base(); + + k = 0; + for(l=0;l<2;l++) + { + for(j=l*16;j<(l*16)+0x10000;j+=32) + { + for(i=0;i<16;i++) + { + kanji[j+i] = raw_kanji[k]; + kanji[j+i+0x10000] = raw_kanji[0x10000+k]; + k++; + } + } + } +} + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, x1, 0, 0, x1, x1, driver_device, 0, "Sharp", "X1 (CZ-800C)", 0 ) +// x1twin in x1twin.c +COMP( 1984, x1turbo, x1, 0, x1turbo, x1turbo, x1_state, x1_kanji, "Sharp", "X1 Turbo (CZ-850C)", MACHINE_NOT_WORKING ) //model 10 +COMP( 1985, x1turbo40, x1, 0, x1turbo, x1turbo, x1_state, x1_kanji, "Sharp", "X1 Turbo (CZ-862C)", 0 ) //model 40 +//COMP( 1986, x1turboz, x1, 0, x1turbo, x1turbo, x1_state, x1_kanji, "Sharp", "X1 TurboZ", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/x1twin.c b/src/mame/drivers/x1twin.c new file mode 100644 index 00000000000..30d98a6a2eb --- /dev/null +++ b/src/mame/drivers/x1twin.c @@ -0,0 +1,540 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese +/************************************************************************************************ + + Sharp X1Twin = Sharp X1 + NEC PC Engine All-in-One + + Both systems doesn't interact at all, according to info on the net they just shares the + same "house". It doesn't even do super-imposing, not even with the in-built X1 feature apparently + + TODO: + - Find 100% trusted info about it. + - inherit pce_state into x1twin_state + - Needs video mods + +************************************************************************************************/ + +#include "includes/x1.h" + +#include "includes/pce.h" +//#include "cpu/h6280/h6280.h" +//#include "sound/c6280.h" + +#include "rendlay.h" + +class x1twin_state : public x1_state +{ + public: + x1twin_state(const machine_config &mconfig, device_type type, const char *tag) + : x1_state(mconfig, type, tag) + { } + UINT32 screen_update_x1pce(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_INPUT_CHANGED_MEMBER(ipl_reset); + DECLARE_INPUT_CHANGED_MEMBER(nmi_reset); +}; + + +#define X1_MAIN_CLOCK XTAL_16MHz +#define VDP_CLOCK XTAL_42_9545MHz +#define MCU_CLOCK XTAL_6MHz +#define PCE_MAIN_CLOCK VDP_CLOCK / 2 + +UINT32 x1twin_state::screen_update_x1pce(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +static ADDRESS_MAP_START( x1_mem, AS_PROGRAM, 8, x1twin_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_mem_r,x1_mem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( x1_io, AS_IO, 8, x1twin_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_io_r, x1_io_w) +ADDRESS_MAP_END + +#if 0 +static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8, x1twin_state ) + AM_RANGE( 0x000000, 0x09FFFF) AM_ROM + AM_RANGE( 0x1F0000, 0x1F1FFF) AM_RAM AM_MIRROR(0x6000) + AM_RANGE( 0x1FE000, 0x1FE3FF) AM_READWRITE( vdc_r, vdc_w ) + AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE( vce_r, vce_w ) + AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE( "c6280", c6280_device, c6280_r, c6280_w ) + AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE( h6280_timer_r, h6280_timer_w ) + AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( pce_joystick_r, pce_joystick_w ) + AM_RANGE( 0x1FF400, 0x1FF7FF) AM_DEVREADWRITE( "maincpu", h6280_device, irq_status_r, irq_status_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pce_io, AS_IO, 8, x1twin_state ) + AM_RANGE( 0x00, 0x03) AM_READWRITE( vdc_r, vdc_w ) +ADDRESS_MAP_END +#endif + +/************************************* + * + * Inputs + * + *************************************/ + +INPUT_CHANGED_MEMBER(x1twin_state::ipl_reset) +{ + //address_space &space = m_maincpu->space(AS_PROGRAM); + + m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); + + m_ram_bank = 0x00; + if(m_is_turbo) { m_ex_bank = 0x10; } + //anything else? +} + +/* Apparently most games doesn't support this (not even the Konami ones!), one that does is...177 :o */ +INPUT_CHANGED_MEMBER(x1twin_state::nmi_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); +} + +INPUT_PORTS_START( x1twin ) + PORT_START("FP_SYS") //front panel buttons, hard-wired with the soft reset/NMI lines + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, x1twin_state, ipl_reset,0) PORT_NAME("IPL reset") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, x1twin_state, nmi_reset,0) PORT_NAME("NMI reset") + + PORT_START("SOUND_SW") //FIXME: this is X1Turbo specific + PORT_DIPNAME( 0x80, 0x80, "OPM Sound Setting?" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("IOSYS") //TODO: implement front-panel DIP-SW here + PORT_DIPNAME( 0x01, 0x01, "IOSYS" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Sound Setting?" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("key1") //0x00-0x1f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-8") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-8") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + + PORT_START("key2") //0x20-0x3f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2b + + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2e . + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2f / + + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3c < + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? + + PORT_START("key3") //0x40-0x5f + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") + + PORT_START("f_keys") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + + PORT_START("tenkey") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) + // TODO: add other numpad keys + + PORT_START("key_modifiers") + PORT_BIT(0x00000001,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x00000002,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00000004,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x00000008,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x00000010,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) + +#if 0 + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") + + PORT_START("key3") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey ,") + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("EL") PORT_CODE(KEYCODE_PGUP) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DUP") PORT_CODE(KEYCODE_END) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) + +#endif +INPUT_PORTS_END + + +/************************************* + * + * GFX decoding + * + *************************************/ + +static const gfx_layout x1_chars_8x8 = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout x1_chars_8x16 = +{ + 8,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, + 8*16 +}; + +static const gfx_layout x1_pcg_8x8 = +{ + 8,8, + RGN_FRAC(1,3), + 3, + { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static const gfx_layout x1_chars_16x16 = +{ + 8,16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 +}; + +/* decoded for debugging purpose, this will be nuked in the end... */ +static GFXDECODE_START( x1 ) + GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8, 0, 1 ) + GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8, 0, 1 ) + GFXDECODE_ENTRY( "font", 0x00000, x1_chars_8x16, 0, 1 ) + GFXDECODE_ENTRY( "kanji", 0x00000, x1_chars_16x16, 0, 1 ) +GFXDECODE_END + +static const z80_daisy_config x1_daisy[] = +{ + { "x1kb" }, + { "ctc" }, + { NULL } +}; + +static SLOT_INTERFACE_START( x1_floppies ) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( x1twin, x1twin_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("x1_cpu", Z80, X1_MAIN_CLOCK/4) + MCFG_CPU_PROGRAM_MAP(x1_mem) + MCFG_CPU_IO_MAP(x1_io) + MCFG_CPU_CONFIG(x1_daisy) + + MCFG_DEVICE_ADD("ctc", Z80CTC, MAIN_CLOCK/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("ctc", z80ctc_device, trg3)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("ctc", z80ctc_device, trg1)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("ctc", z80ctc_device, trg2)) + + MCFG_DEVICE_ADD("x1kb", X1_KEYBOARD, 0) + + MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(x1_state, x1_porta_r)) + MCFG_I8255_OUT_PORTA_CB(WRITE8(x1_state, x1_porta_w)) + MCFG_I8255_IN_PORTB_CB(READ8(x1_state, x1_portb_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(x1_state, x1_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(x1_state, x1_portc_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(x1_state, x1_portc_w)) + + MCFG_MACHINE_START_OVERRIDE(x1twin_state,x1) + MCFG_MACHINE_RESET_OVERRIDE(x1twin_state,x1) + + #if 0 + MCFG_CPU_ADD("pce_cpu", H6280, PCE_MAIN_CLOCK/3) + MCFG_CPU_PROGRAM_MAP(pce_mem) + MCFG_CPU_IO_MAP(pce_io) + MCFG_TIMER_ADD_SCANLINE("scantimer", pce_interrupt, "pce_screen", 0, 1) + #endif + + MCFG_DEFAULT_LAYOUT(layout_dualhsxs) + /* video hardware */ + MCFG_SCREEN_ADD("x1_screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(x1twin_state, screen_update_x1) + + MCFG_SCREEN_ADD("pce_screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK/2, HUC6260_WPF, 70, 70 + 512 + 32, HUC6260_LPF, 14, 14+242) + MCFG_SCREEN_UPDATE_DRIVER(x1twin_state, screen_update_x1pce) + + MCFG_MC6845_ADD("crtc", H46505, "x1_screen", (VDP_CLOCK/48)) //unknown divider + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_PALETTE_ADD("palette", 0x10+0x1000) + MCFG_PALETTE_INIT_OWNER(x1twin_state,x1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", x1) + + MCFG_VIDEO_START_OVERRIDE(x1twin_state,x1) + + MCFG_MB8877_ADD("fdc", MAIN_CLOCK / 16) + + MCFG_FLOPPY_DRIVE_ADD("fdc:0", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:2", x1_floppies, "dd", x1_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:3", x1_floppies, "dd", x1_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") + + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "x1_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") + + MCFG_SPEAKER_ADD("x1_l",-0.2, 0.0, 1.0) + MCFG_SPEAKER_ADD("x1_r",0.2, 0.0, 1.0) + MCFG_SPEAKER_ADD("pce_l",-0.2, 0.0, 1.0) + MCFG_SPEAKER_ADD("pce_r",0.2, 0.0, 1.0) + +// MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + /* TODO:is the AY mono or stereo? Also volume balance isn't right. */ + MCFG_SOUND_ADD("ay", AY8910, MAIN_CLOCK/8) + MCFG_AY8910_PORT_A_READ_CB(IOPORT("P1")) + MCFG_AY8910_PORT_B_READ_CB(IOPORT("P2")) + MCFG_SOUND_ROUTE(0, "x1_l", 0.25) + MCFG_SOUND_ROUTE(0, "x1_r", 0.25) + MCFG_SOUND_ROUTE(1, "x1_l", 0.5) + MCFG_SOUND_ROUTE(2, "x1_r", 0.5) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "x1_l", 0.25) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "x1_r", 0.10) + + MCFG_CASSETTE_ADD("cassette") + MCFG_CASSETTE_FORMATS(x1_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_CASSETTE_INTERFACE("x1_cass") + + MCFG_SOFTWARE_LIST_ADD("cass_list","x1_cass") + +#if 0 + MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6) + MCFG_C6280_CPU("pce_cpu") + MCFG_SOUND_ROUTE(0, "pce_l", 0.5) + MCFG_SOUND_ROUTE(1, "pce_r", 0.5) +#endif + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", x1twin_state, x1_keyboard_callback, attotime::from_hz(250)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cmt_wind_timer", x1twin_state, x1_cmt_wind_timer, attotime::from_hz(16)) +MACHINE_CONFIG_END + +ROM_START( x1twin ) + ROM_REGION( 0x10000, "x1_cpu", ROMREGION_ERASEFF ) + + ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "ipl.rom", 0x0000, 0x1000, CRC(e70011d3) SHA1(d3395e9aeb5b8bbba7654dd471bcd8af228ee69a) ) + + ROM_REGION( 0x10000, "wram", ROMREGION_ERASE00 ) + + ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu" + ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x1000000, "emm", ROMREGION_ERASEFF ) + + ROM_REGION(0x1800, "pcg", ROMREGION_ERASEFF) + + ROM_REGION(0x1000, "font", 0) //TODO: this contains 8x16 charset only, maybe it's possible that it derivates a 8x8 charset by skipping gfx lines? + ROM_LOAD( "ank16.rom", 0x0000, 0x1000, CRC(8f9fb213) SHA1(4f06d20c997a79ee6af954b69498147789bf1847) ) + + ROM_REGION(0x1800, "cgrom", 0) + ROM_LOAD("ank8.rom", 0x00000, 0x00800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) ) + ROM_COPY("font", 0x00000, 0x00800, 0x1000 ) + + ROM_REGION(0x20000, "kanji", ROMREGION_ERASEFF) + + ROM_REGION(0x20000, "raw_kanji", ROMREGION_ERASEFF) // these comes from x1 turbo + ROM_LOAD("kanji4.rom", 0x00000, 0x8000, BAD_DUMP CRC(3e39de89) SHA1(d3fd24892bb1948c4697dedf5ff065ff3eaf7562) ) + ROM_LOAD("kanji2.rom", 0x08000, 0x8000, BAD_DUMP CRC(e710628a) SHA1(103bbe459dc8da27a9400aa45b385255c18fcc75) ) + ROM_LOAD("kanji3.rom", 0x10000, 0x8000, BAD_DUMP CRC(8cae13ae) SHA1(273f3329c70b332f6a49a3a95e906bbfe3e9f0a1) ) + ROM_LOAD("kanji1.rom", 0x18000, 0x8000, BAD_DUMP CRC(5874f70b) SHA1(dad7ada1b70c45f1e9db11db273ef7b385ef4f17) ) +ROM_END + +COMP( 1986, x1twin, x1, 0, x1twin, x1twin, x1_state, x1_kanji,"Sharp", "X1 Twin (CZ-830C)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/x68k.c b/src/mame/drivers/x68k.c new file mode 100644 index 00000000000..af0a91a4948 --- /dev/null +++ b/src/mame/drivers/x68k.c @@ -0,0 +1,1854 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald,Carl + +// Preliminary X68000 driver for MESS +// Started 18/11/2006 +// Written by Barry Rodewald + +/* + *** Basic memory map + + 0x000000 - 0xbfffff RAM (Max 12MB), vector table from ROM at 0xff0000 maps to 0x000000 at reset only + 0xc00000 - 0xdfffff Graphic VRAM + 0xe00000 - 0xe1ffff Text VRAM Plane 1 + 0xe20000 - 0xe3ffff Text VRAM Plane 2 + 0xe40000 - 0xe5ffff Text VRAM Plane 3 + 0xe60000 - 0xe7ffff Text VRAM Plane 4 + 0xe80000 CRTC + 0xe82000 Video Controller + 0xe84000 DMA Controller + 0xe86000 Supervisor Area set + 0xe88000 MFP + 0xe8a000 RTC + 0xe8c000 Printer + 0xe8e000 System Port (?) + 0xe90000 FM Sound source + 0xe92000 ADPCM + 0xe94000 FDC + 0xe96000 HDC + 0xe96021 SCSI (internal model) + 0xe98000 SCC + 0xe9a000 Serial I/O (PPI) + 0xe9c000 I/O controller + + [Expansions] + 0xe9c000 / 0xe9e000 FPU (Optional, X68000 only) + 0xea0000 SCSI + 0xeaf900 FAX + 0xeafa00 / 0xeafa10 MIDI (1st/2nd) + 0xeafb00 Serial + 0xeafc00/10/20/30 EIA232E + 0xeafd00 EIA232E + 0xeafe00 GPIB (?) + 0xec0000 - 0xecffff User I/O Expansion + + 0xeb0000 - 0xeb7fff Sprite registers + 0xeb8000 - 0xebffff Sprite VRAM + 0xed0000 - 0xed3fff SRAM + 0xf00000 - 0xfb0000 ROM (CGROM.DAT) + 0xfe0000 - 0xffffff ROM (IPLROM.DAT) + + + *** System hardware + + CPU : X68000: 68000 at 10MHz + X68000 XVI: 68000 at 16MHz + X68030: 68EC030 at 25MHz + + RAM : between 1MB and 4MB stock, expandable to 12MB + + FDD : 2x 5.25", Compact models use 2x 3.5" drives. + FDC : NEC uPD72065 + + HDD : HD models have up to an 81MB HDD. + HDC : Fujitsu MB89352A (SCSI) + + SCC : Serial controller - Zilog z85C30 (Dual channel, 1 for RS232, 1 for mouse) + PPI : Parallel controller - NEC 8255 (Printer, Joystick) + + Sound : FM - YM2151, with YM3012 DAC + ADPCM - Okidata MSM6258 + + DMA : Hitachi HD63450, DMA I/O for FDD, HDD, Expansion slots, and ADPCM + + MFP : Motorola MC68901 - monitor sync, serial port, RTC, soft power, FM synth, IRQs, keyboard + + RTC : Ricoh RP5C15 + + ...plus a number of custom chips for video and other stuff... + + + *** Current status (28/12/08) + MFP : Largely works, as far as the X68000 goes. + + PPI : Joystick controls work okay. + + HDC/HDD : SCSI is not implemented, not a requirement at this point. + + RTC : Seems to work. (Tested using SX-Window's Timer application) + + DMA : Works fine. + + Sound : FM works, ADPCM mostly works (timing(?) issues in a few games). + + SCC : Works enough to get the mouse running, although only with the IPL v1.0 BIOS + + Video : Text mode works, but is rather slow, especially scrolling up (uses multple "raster copy" commands). + Graphic layers work. + BG tiles and sprites work, but many games have the sprites offset by a small amount (some by a lot :)) + Still a few minor priority issues around. + + Other issues: + Bus error exceptions are a bit late at times. Currently using a fake bus error for MIDI expansion checks. These + are used determine if a piece of expansion hardware is present. + Keyboard doesn't work properly (MFP USART). + Supervisor area set isn't implemented. + + Some minor game-specific issues: + Salamander: System error when using keys in-game. No error if a joystick is used. + Some text is drawn incorrectly. + Dragon Buster: Text is black and unreadable. (Text layer actually covers it) + Tetris: Black dots over screen (text layer). + Parodius Da!: Black squares in areas. + + More detailed documentation at http://x68kdev.emuvibes.com/iomap.html - if you can stand broken english :) + +*/ + +#include "emu.h" +#include "machine/mc68901.h" +#include "machine/upd765.h" +#include "sound/okim6258.h" +#include "machine/rp5c15.h" +#include "machine/mb89352.h" +#include "formats/xdf_dsk.h" +#include "formats/dim_dsk.h" +#include "machine/x68k_hdc.h" +#include "machine/x68k_kbd.h" +#include "includes/x68k.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "bus/x68k/x68kexp.h" +#include "bus/x68k/x68k_neptunex.h" +#include "bus/x68k/x68k_scsiext.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" +#include "x68000.lh" + + + +void x68k_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_X68K_LED: + x68k_led_callback(ptr, param); + break; + case TIMER_X68K_SCC_ACK: + x68k_scc_ack(ptr, param); + break; + case TIMER_MD_6BUTTON_PORT1_TIMEOUT: + md_6button_port1_timeout(ptr, param); + break; + case TIMER_MD_6BUTTON_PORT2_TIMEOUT: + md_6button_port2_timeout(ptr, param); + break; + case TIMER_X68K_BUS_ERROR: + x68k_bus_error(ptr, param); + break; + case TIMER_X68K_NET_IRQ: + x68k_net_irq(ptr, param); + break; + case TIMER_X68K_CRTC_OPERATION_END: + x68k_crtc_operation_end(ptr, param); + break; + case TIMER_X68K_HSYNC: + x68k_hsync(ptr, param); + break; + case TIMER_X68K_CRTC_RASTER_END: + x68k_crtc_raster_end(ptr, param); + break; + case TIMER_X68K_CRTC_RASTER_IRQ: + x68k_crtc_raster_irq(ptr, param); + break; + case TIMER_X68K_CRTC_VBLANK_IRQ: + x68k_crtc_vblank_irq(ptr, param); + break; + case TIMER_X68K_FDC_TC: + m_upd72065->tc_w(ASSERT_LINE); + m_upd72065->tc_w(CLEAR_LINE); + break; + case TIMER_X68K_ADPCM: + m_hd63450->drq3_w(1); + m_hd63450->drq3_w(0); + break; + default: + assert_always(FALSE, "Unknown id in x68k_state::device_timer"); + } +} + +// LED timer callback +TIMER_CALLBACK_MEMBER(x68k_state::x68k_led_callback) +{ + int drive; + if(m_led_state == 0) + m_led_state = 1; + else + m_led_state = 0; + if(m_led_state == 1) + { + for(drive=0;drive<4;drive++) + output_set_indexed_value("ctrl_drv",drive,m_fdc.led_ctrl[drive] ? 0 : 1); + } + else + { + for(drive=0;drive<4;drive++) + output_set_indexed_value("ctrl_drv",drive,1); + } + +} + + +// mouse input +// port B of the Z8530 SCC +// typically read from the SCC data port on receive buffer full interrupt per byte +int x68k_state::x68k_read_mouse() +{ + char val = 0; + char ipt = 0; + + if(!(m_scc->get_reg_b(5) & 0x02)) + return 0xff; + + switch(m_mouse.inputtype) + { + case 0: + ipt = m_mouse1->read(); + break; + case 1: + val = m_mouse2->read(); + ipt = val - m_mouse.last_mouse_x; + m_mouse.last_mouse_x = val; + break; + case 2: + val = m_mouse3->read(); + ipt = val - m_mouse.last_mouse_y; + m_mouse.last_mouse_y = val; + break; + } + m_mouse.inputtype++; + if(m_mouse.inputtype > 2) + { + int i_val = m_scc->get_reg_b(0); + m_mouse.inputtype = 0; + m_mouse.bufferempty = 1; + i_val &= ~0x01; + m_scc->set_reg_b(0, i_val); + logerror("SCC: mouse buffer empty\n"); + } + + return ipt; +} + +/* + 0xe98001 - Z8530 command port B + 0xe98003 - Z8530 data port B (mouse input) + 0xe98005 - Z8530 command port A + 0xe98007 - Z8530 data port A (RS232) +*/ +READ16_MEMBER(x68k_state::x68k_scc_r ) +{ + offset %= 4; + switch(offset) + { + case 0: + return m_scc->reg_r(space, 0); + case 1: + return x68k_read_mouse(); + case 2: + return m_scc->reg_r(space, 1); + case 3: + return m_scc->reg_r(space, 3); + default: + return 0xff; + } +} + +WRITE16_MEMBER(x68k_state::x68k_scc_w ) +{ + offset %= 4; + + switch(offset) + { + case 0: + m_scc->reg_w(space, 0,(UINT8)data); + if((m_scc->get_reg_b(5) & 0x02) != m_scc_prev) + { + if(m_scc->get_reg_b(5) & 0x02) // Request to Send + { + int val = m_scc->get_reg_b(0); + m_mouse.bufferempty = 0; + val |= 0x01; + m_scc->set_reg_b(0,val); + } + } + break; + case 1: + m_scc->reg_w(space, 2,(UINT8)data); + break; + case 2: + m_scc->reg_w(space, 1,(UINT8)data); + break; + case 3: + m_scc->reg_w(space, 3,(UINT8)data); + break; + } + m_scc_prev = m_scc->get_reg_b(5) & 0x02; +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_scc_ack) +{ + if(m_mouse.bufferempty != 0) // nothing to do if the mouse data buffer is empty + return; + +// if((m_ioc.irqstatus & 0xc0) != 0) +// return; + + // hard-code the IRQ vector for now, until the SCC code is more complete + if((m_scc->get_reg_a(9) & 0x08) || (m_scc->get_reg_b(9) & 0x08)) // SCC reg WR9 is the same for both channels + { + if((m_scc->get_reg_b(1) & 0x18) != 0) // if bits 3 and 4 of WR1 are 0, then Rx IRQs are disabled on this channel + { + if(m_scc->get_reg_b(5) & 0x02) // RTS signal + { + m_mouse.irqactive = 1; + m_current_vector[5] = 0x54; + m_current_irq_line = 5; + m_maincpu->set_input_line_and_vector(5,ASSERT_LINE,0x54); + } + } + } +} + +void x68k_state::x68k_set_adpcm() +{ + UINT32 rate = 0; + + switch(m_adpcm.rate & 0x0c) + { + case 0x00: + rate = 7812/2; + break; + case 0x04: + rate = 10417/2; + break; + case 0x08: + rate = 15625/2; + break; + default: + logerror("PPI: Invalid ADPCM sample rate set.\n"); + rate = 15625/2; + } + if(m_adpcm.clock != 0) + rate = rate/2; + m_adpcm_timer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); +} + +// Megadrive 3 button gamepad +// According to XM6, bits 4 and 7 are always 1 (is this correct?) +// Bits 4 and 5 of PPI port C control each controller's multiplexer +// Button inputs (Start, A, B and C) are read in bits 5 and 6 (rather than 4 +// and 5 like on a Megadrive) + +UINT8 x68k_state::md_3button_r(int port) +{ + if(port == 1) + { + UINT8 porta = m_md3b->read() & 0xff; + UINT8 portb = (m_md3b->read() >> 8) & 0xff; + if(m_mdctrl.mux1 & 0x10) + { + return porta | 0x90; + } + else + { + return (portb & 0x60) | (porta & 0x03) | 0x90; + } + } + if(port == 2) + { + UINT8 porta = (m_md3b->read() >> 16) & 0xff; + UINT8 portb = (m_md3b->read() >> 24) & 0xff; + if(m_mdctrl.mux2 & 0x20) + { + return porta | 0x90; + } + else + { + return (portb & 0x60) | (porta & 0x03) | 0x90; + } + } + return 0xff; +} + +// Megadrive 6 button gamepad +TIMER_CALLBACK_MEMBER(x68k_state::md_6button_port1_timeout) +{ + m_mdctrl.seq1 = 0; +} + +TIMER_CALLBACK_MEMBER(x68k_state::md_6button_port2_timeout) +{ + m_mdctrl.seq2 = 0; +} + +void x68k_state::md_6button_init() +{ + m_mdctrl.io_timeout1 = timer_alloc(TIMER_MD_6BUTTON_PORT1_TIMEOUT); + m_mdctrl.io_timeout2 = timer_alloc(TIMER_MD_6BUTTON_PORT2_TIMEOUT); +} + +UINT8 x68k_state::md_6button_r(int port) +{ + if(port == 1) + { + UINT8 porta = m_md6b->read() & 0xff; + UINT8 portb = (m_md6b->read() >> 8) & 0xff; + UINT8 extra = m_md6b_extra->read() & 0x0f; + + switch(m_mdctrl.seq1) + { + case 1: + default: + if(m_mdctrl.mux1 & 0x10) + { + return porta | 0x90; + } + else + { + return (portb & 0x60) | (porta & 0x03) | 0x90; + } + case 2: + if(m_mdctrl.mux1 & 0x10) + { + return porta | 0x90; + } + else + { + return (portb & 0x60) | 0x90; + } + case 3: + if(m_mdctrl.mux1 & 0x10) + { + return (porta & 0x60) | (extra & 0x0f) | 0x90; + } + else + { + return (portb & 0x60) | 0x9f; + } + } + } + if(port == 2) + { + UINT8 porta = (m_md6b->read() >> 16) & 0xff; + UINT8 portb = (m_md6b->read() >> 24) & 0xff; + UINT8 extra = (m_md6b_extra->read() >> 4) & 0x0f; + + switch(m_mdctrl.seq2) + { + case 1: + default: + if(m_mdctrl.mux2 & 0x20) + { + return porta | 0x90; + } + else + { + return (portb & 0x60) | (porta & 0x03) | 0x90; + } + case 2: + if(m_mdctrl.mux2 & 0x20) + { + return porta | 0x90; + } + else + { + return (portb & 0x60) | 0x90; + } + case 3: + if(m_mdctrl.mux2 & 0x20) + { + return (porta & 0x60) | (extra & 0x0f) | 0x90; + } + else + { + return (portb & 0x60) | 0x9f; + } + } + } + return 0xff; +} + +// XPD-1LR dual D-pad controller. +// Sold with Video Game Anthology Vol 4: Libble Rabble. +// Also compatible with Video Game Anthology Vol 5: Crazy Climber 1 & 2 +// Uses the same input multiplexer hardware as Megadrive controllers +// Output is the same as for standard controllers, but when ctl is high, +// the directions refer to the right D-pad, and when low, the left D-pad +// The buttons are read the same as normal, regardless of ctl. +UINT8 x68k_state::xpd1lr_r(int port) +{ + if(port == 1) + { + UINT8 porta = m_xpd1lr->read() & 0xff; + UINT8 portb = (m_xpd1lr->read() >> 8) & 0xff; + if(m_mdctrl.mux1 & 0x10) + { + return porta; + } + else + { + return portb | (porta & 0x60); + } + } + if(port == 2) + { + UINT8 porta = (m_xpd1lr->read() >> 16) & 0xff; + UINT8 portb = (m_xpd1lr->read() >> 24) & 0xff; + if(m_mdctrl.mux2 & 0x20) + { + return porta; + } + else + { + return portb | (porta & 0x60); + } + } + return 0xff; +} + +// Judging from the XM6 source code, PPI ports A and B are joystick inputs +READ8_MEMBER(x68k_state::ppi_port_a_r) +{ + int ctrl = m_ctrltype->read() & 0x0f; + + switch(ctrl) + { + case 0x00: // standard MSX/FM-Towns joystick + if(m_joy.joy1_enable == 0) + return m_joy1->read(); + else + return 0xff; + case 0x01: // 3-button Megadrive gamepad + return md_3button_r(1); + case 0x02: // 6-button Megadrive gamepad + return md_6button_r(1); + case 0x03: // XPD-1LR + return xpd1lr_r(1); + } + + return 0xff; +} + +READ8_MEMBER(x68k_state::ppi_port_b_r) +{ + int ctrl = m_ctrltype->read() & 0xf0; + + switch(ctrl) + { + case 0x00: // standard MSX/FM-Towns joystick + if(m_joy.joy2_enable == 0) + return m_joy2->read(); + else + return 0xff; + case 0x10: // 3-button Megadrive gamepad + return md_3button_r(2); + case 0x20: // 6-button Megadrive gamepad + return md_6button_r(2); + case 0x30: // XPD-1LR + return xpd1lr_r(2); + } + + return 0xff; +} + +READ8_MEMBER(x68k_state::ppi_port_c_r) +{ + return m_ppi_port[2]; +} + +/* PPI port C (Joystick control, R/W) + bit 7 - IOC7 - Function B operation of joystick 1 (?) + bit 6 - IOC6 - Function A operation of joystick 1 (?) + bit 5 - IOC5 - Enable Joystick 2 + bit 4 - IOC4 - Enable Joystick 1 + bits 3,2 - ADPCM Sample rate + bits 1,0 - ADPCM Pan +*/ +WRITE8_MEMBER(x68k_state::ppi_port_c_w) +{ + // ADPCM / Joystick control + m_ppi_port[2] = data; + if((data & 0x0f) != (m_ppi_prev & 0x0f)) + { + m_adpcm.pan = data & 0x03; + m_adpcm.rate = data & 0x0c; + x68k_set_adpcm(); + m_okim6258->set_divider((data >> 2) & 3); + } + + // The joystick enable bits also handle the multiplexer for various controllers + m_joy.joy1_enable = data & 0x10; + m_mdctrl.mux1 = data & 0x10; + if((m_ppi_prev & 0x10) == 0x00 && (data & 0x10) == 0x10) + { + m_mdctrl.seq1++; + m_mdctrl.io_timeout1->adjust(m_maincpu->cycles_to_attotime(8192)); + } + + m_joy.joy2_enable = data & 0x20; + m_mdctrl.mux2 = data & 0x20; + if((m_ppi_prev & 0x20) == 0x00 && (data & 0x20) == 0x20) + { + m_mdctrl.seq2++; + m_mdctrl.io_timeout2->adjust(m_maincpu->cycles_to_attotime(8192)); + } + m_ppi_prev = data; + + m_joy.ioc6 = data & 0x40; + m_joy.ioc7 = data & 0x80; +} + + +// NEC uPD72065 at 0xe94000 +WRITE16_MEMBER(x68k_state::x68k_fdc_w) +{ + unsigned int drive, x; + switch(offset) + { + case 0x00: // drive option signal control + x = data & 0x0f; + for(drive=0;drive<4;drive++) + { + if(m_fdc.control_drives & (1 << drive)) + { + if(!(x & (1 << drive))) // functions take place on 1->0 transitions of drive bits only + { + m_fdc.led_ctrl[drive] = data & 0x80; // blinking drive LED if no disk inserted + m_fdc.led_eject[drive] = data & 0x40; // eject button LED (on when set to 0) + output_set_indexed_value("eject_drv",drive,(data & 0x40) ? 1 : 0); + if((data & 0x60) == 0x20) // ejects disk + m_fdc.floppy[drive]->unload(); + } + } + } + m_fdc.control_drives = data & 0x0f; + logerror("FDC: signal control set to %02x\n",data); + break; + case 0x01: { + x = data & 3; + m_upd72065->set_floppy(m_fdc.floppy[x]); + m_upd72065->set_rate((data & 0x10) ? 300000 : 500000); + m_fdc.motor = data & 0x80; + + for(int i = 0; i < 4; i++) + if(m_fdc.floppy[i]->exists()) + m_fdc.floppy[i]->mon_w(!BIT(data, 7)); + + output_set_indexed_value("access_drv",x,0); + if(x != m_fdc.select_drive) + output_set_indexed_value("access_drv",m_fdc.select_drive,1); + m_fdc.select_drive = x; + logerror("FDC: Drive #%i: Drive selection set to %02x\n",x,data); + break; + } + } +} + +READ16_MEMBER(x68k_state::x68k_fdc_r) +{ + unsigned int ret; + int x; + + switch(offset) + { + case 0x00: + ret = 0x00; + for(x=0;x<4;x++) + { + if(m_fdc.control_drives & (1 << x)) + { + ret = 0x00; + if(m_fdc.floppy[x]->exists()) + { + ret |= 0x80; + } + // bit 7 = disk inserted + // bit 6 = disk error (in insertion, presumably) + logerror("FDC: Drive #%i Disk check - returning %02x\n",x,ret); + } + } + return ret; + case 0x01: + logerror("FDC: IOC selection is write-only\n"); + return 0xff; + } + return 0xff; +} + +WRITE_LINE_MEMBER( x68k_state::fdc_irq ) +{ + if((m_ioc.irqstatus & 0x04) && state) + { + m_current_vector[1] = m_ioc.fdcvector; + m_ioc.irqstatus |= 0x80; + m_current_irq_line = 1; + logerror("FDC: IRQ triggered\n"); + m_maincpu->set_input_line_and_vector(1, ASSERT_LINE, m_current_vector[1]); + } + else + m_maincpu->set_input_line(1, CLEAR_LINE); +} + +WRITE8_MEMBER(x68k_state::x68k_ct_w) +{ + // CT1 and CT2 bits from YM2151 port 0x1b + // CT1 - ADPCM clock - 0 = 8MHz, 1 = 4MHz + // CT2 - 1 = Set ready state of FDC + if(data & 1) + { + m_upd72065->set_ready_line_connected(0); + m_upd72065->ready_w(0); + } + else + m_upd72065->set_ready_line_connected(1); + + m_adpcm.clock = data & 0x02; + x68k_set_adpcm(); + m_okim6258->set_clock(data & 0x02 ? 4000000 : 8000000); +} + +/* + Custom I/O controller at 0xe9c000 + 0xe9c001 (R) - Interrupt status + 0xe9c001 (W) - Interrupt mask (low nibble only) + - bit 7 = FDC interrupt + - bit 6 = FDD interrupt + - bit 5 = Printer Busy signal + - bit 4 = HDD interrupt + - bit 3 = HDD interrupts enabled + - bit 2 = FDC interrupts enabled + - bit 1 = FDD interrupts enabled + - bit 0 = Printer interrupts enabled + 0xe9c003 (W) - Interrupt vector + - bits 7-2 = vector + - bits 1,0 = device (00 = FDC, 01 = FDD, 10 = HDD, 11 = Printer) +*/ +WRITE16_MEMBER(x68k_state::x68k_ioc_w) +{ + switch(offset) + { + case 0x00: + m_ioc.irqstatus = data & 0x0f; + logerror("I/O: Status register write %02x\n",data); + break; + case 0x01: + switch(data & 0x03) + { + case 0x00: + m_ioc.fdcvector = data & 0xfc; + logerror("IOC: FDC IRQ vector = 0x%02x\n",data & 0xfc); + break; + case 0x01: + m_ioc.fddvector = data & 0xfc; + logerror("IOC: FDD IRQ vector = 0x%02x\n",data & 0xfc); + break; + case 0x02: + m_ioc.hdcvector = data & 0xfc; + logerror("IOC: HDD IRQ vector = 0x%02x\n",data & 0xfc); + break; + case 0x03: + m_ioc.prnvector = data & 0xfc; + logerror("IOC: Printer IRQ vector = 0x%02x\n",data & 0xfc); + break; + } + break; + } +} + +READ16_MEMBER(x68k_state::x68k_ioc_r) +{ + switch(offset) + { + case 0x00: + logerror("I/O: Status register read\n"); + return (m_ioc.irqstatus & 0xdf) | 0x20; + default: + return 0x00; + } +} + +/* + System ports at 0xe8e000 + Port 1 (0xe8e001) - Monitor contrast (bits 3-0) + Port 2 (0xe8e003) - Display / 3D scope control + - bit 3 - Display control signal (0 = on) + - bit 1 - 3D scope left shutter (0 = closed) + - bit 0 - 3D scope right shutter + Port 3 (0xe8e005) - Colour image unit control (bits 3-0) + Port 4 (0xe8e007) - Keyboard/NMI/Dot clock + - bit 3 - (R) 1 = Keyboard connected, (W) 1 = Key data can be transmitted + - bit 1 - NMI Reset + - bit 0 - HRL - high resolution dot clock - 1 = 1/2, 1/4, 1/8, 0 = 1/2, 1/3, 1/6 (normal) + Port 5 (0xe8e009) - ROM (bits 7-4)/DRAM (bits 3-0) wait, X68030 only + Port 6 (0xe8e00b) - CPU type and clock speed (XVI or later only, X68000 returns 0xFF) + - bits 7-4 - CPU Type (1100 = 68040, 1101 = 68030, 1110 = 68020, 1111 = 68000) + - bits 3-0 - clock speed (1001 = 50MHz, 40, 33, 25, 20, 16, 1111 = 10MHz) + Port 7 (0xe8e00d) - SRAM write enable - if 0x31 is written to this port, writing to SRAM is allowed. + Any other value, then SRAM is read only. + Port 8 (0xe8e00f) - Power off control - write 0x00, 0x0f, 0x0f sequentially to switch power off. +*/ +WRITE16_MEMBER(x68k_state::x68k_sysport_w) +{ + switch(offset) + { + case 0x00: + m_sysport.contrast = data & 0x0f; // often used for screen fades / blanking + m_screen->set_brightness(m_sysport.contrast * 0x11); + break; + case 0x01: + m_sysport.monitor = data & 0x08; + break; + case 0x03: + m_sysport.keyctrl = data & 0x08; // bit 3 = enable keyboard data transmission + break; + case 0x06: + COMBINE_DATA(&m_sysport.sram_writeprotect); + break; + default: +// logerror("SYS: [%08x] Wrote %04x to invalid or unimplemented system port %04x\n",space.device().safe_pc(),data,offset); + break; + } +} + +READ16_MEMBER(x68k_state::x68k_sysport_r) +{ + int ret = 0; + switch(offset) + { + case 0x00: // monitor contrast setting (bits3-0) + return m_sysport.contrast; + case 0x01: // monitor control (bit3) / 3D Scope (bits1,0) + ret |= m_sysport.monitor; + return ret; + case 0x03: // bit 3 = key control (is 1 if keyboard is connected) + return 0x08; + case 0x05: // CPU type and speed + return m_sysport.cputype; + default: + logerror("Read from invalid or unimplemented system port %04x\n",offset); + return 0xff; + } +} + +WRITE16_MEMBER(x68k_state::x68k_ppi_w) +{ + m_ppi->write(space,offset & 0x03,data); +} + +READ16_MEMBER(x68k_state::x68k_ppi_r) +{ + return m_ppi->read(space,offset & 0x03); +} + + +WRITE16_MEMBER(x68k_state::x68k_sram_w) +{ + if(m_sysport.sram_writeprotect == 0x31) + { + COMBINE_DATA(&m_nvram[offset]); + } +} + +READ16_MEMBER(x68k_state::x68k_sram_r) +{ + // HACKS! +// if(offset == 0x5a/2) // 0x5a should be 0 if no SASI HDs are present. +// return 0x0000; + if(offset == 0x08/2) + return m_ram->size() >> 16; // RAM size + return m_nvram[offset]; +} + +WRITE16_MEMBER(x68k_state::x68k_vid_w) +{ + switch(offset) + { + case 0x000: + COMBINE_DATA(m_video.reg); + break; + case 0x080: // priority levels + COMBINE_DATA(m_video.reg+1); + if(ACCESSING_BITS_0_7) + { + m_video.gfxlayer_pri[0] = data & 0x0003; + m_video.gfxlayer_pri[1] = (data & 0x000c) >> 2; + m_video.gfxlayer_pri[2] = (data & 0x0030) >> 4; + m_video.gfxlayer_pri[3] = (data & 0x00c0) >> 6; + } + if(ACCESSING_BITS_8_15) + { + m_video.gfx_pri = (data & 0x0300) >> 8; + m_video.text_pri = (data & 0x0c00) >> 10; + m_video.sprite_pri = (data & 0x3000) >> 12; + if(m_video.gfx_pri == 3) + m_video.gfx_pri--; + if(m_video.text_pri == 3) + m_video.text_pri--; + if(m_video.sprite_pri == 3) + m_video.sprite_pri--; + } + break; + case 0x100: + COMBINE_DATA(m_video.reg+2); + break; + default: + logerror("VC: Invalid video controller write (offset = 0x%04x, data = %04x)\n",offset,data); + } +} + +READ16_MEMBER(x68k_state::x68k_vid_r) +{ + switch(offset) + { + case 0x000: + return m_video.reg[0]; + case 0x080: + return m_video.reg[1]; + case 0x100: + return m_video.reg[2]; + default: + logerror("VC: Invalid video controller read (offset = 0x%04x)\n",offset); + } + + return 0xff; +} + +READ16_MEMBER(x68k_state::x68k_areaset_r) +{ + // register is write-only + return 0xffff; +} + +WRITE16_MEMBER(x68k_state::x68k_areaset_w) +{ + // TODO + logerror("SYS: Supervisor area set: 0x%02x\n",data & 0xff); +} + +WRITE16_MEMBER(x68k_state::x68k_enh_areaset_w ) +{ + // TODO + logerror("SYS: Enhanced Supervisor area set (from %iMB): 0x%02x\n",(offset + 1) * 2,data & 0xff); +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_bus_error) +{ + m_bus_error = false; +} + +void x68k_state::set_bus_error(UINT32 address, bool write, UINT16 mem_mask) +{ + if(m_bus_error) + return; + if(!ACCESSING_BITS_8_15) + address++; + m_bus_error = true; + m_maincpu->set_buserror_details(address, write, m_maincpu->get_fc()); + m_maincpu->mmu_tmp_buserror_address = address; // Hack for x68030 + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + m_bus_error_timer->adjust(m_maincpu->cycles_to_attotime(16)); // let rmw cycles complete + logerror("%s: Bus error: Unused RAM access [%08x]\n", machine().describe_context(), address); +} + +READ16_MEMBER(x68k_state::x68k_rom0_r) +{ + /* this location contains the address of some expansion device ROM, if no ROM exists, + then access causes a bus error */ + if((m_options->read() & 0x02) && !space.debugger_access()) + set_bus_error((offset << 1) + 0xbffffc, 0, mem_mask); + return 0xff; +} + +WRITE16_MEMBER(x68k_state::x68k_rom0_w) +{ + /* this location contains the address of some expansion device ROM, if no ROM exists, + then access causes a bus error */ + if((m_options->read() & 0x02) && !space.debugger_access()) + set_bus_error((offset << 1) + 0xbffffc, 1, mem_mask); +} + +READ16_MEMBER(x68k_state::x68k_emptyram_r) +{ + /* this location is unused RAM, access here causes a bus error + Often a method for detecting amount of installed RAM, is to read or write at 1MB intervals, until a bus error occurs */ + if((m_options->read() & 0x02) && !space.debugger_access()) + set_bus_error((offset << 1), 0, mem_mask); + return 0xff; +} + +WRITE16_MEMBER(x68k_state::x68k_emptyram_w) +{ + /* this location is unused RAM, access here causes a bus error + Often a method for detecting amount of installed RAM, is to read or write at 1MB intervals, until a bus error occurs */ + if((m_options->read() & 0x02) && !space.debugger_access()) + set_bus_error((offset << 1), 1, mem_mask); +} + +READ16_MEMBER(x68k_state::x68k_exp_r) +{ + /* These are expansion devices, if not present, they cause a bus error */ + if((m_options->read() & 0x02) && !space.debugger_access()) + set_bus_error((offset << 1) + 0xeafa00, 0, mem_mask); + return 0xff; +} + +WRITE16_MEMBER(x68k_state::x68k_exp_w) +{ + /* These are expansion devices, if not present, they cause a bus error */ + if((m_options->read() & 0x02) && !space.debugger_access()) + set_bus_error((offset << 1) + 0xeafa00, 1, mem_mask); +} + +void x68k_state::dma_irq(int channel) +{ + m_current_vector[3] = m_hd63450->get_vector(channel); + m_current_irq_line = 3; + logerror("DMA#%i: DMA End (vector 0x%02x)\n",channel,m_current_vector[3]); + m_maincpu->set_input_line_and_vector(3,ASSERT_LINE,m_current_vector[3]); +} + +WRITE8_MEMBER(x68k_state::dma_end) +{ + if(data != 0) + { + dma_irq(offset); + } + if(offset == 0) + { + m_fdc_tc->adjust(attotime::from_usec(1), 0, attotime::never); + } +} + +WRITE8_MEMBER(x68k_state::dma_error) +{ + if(data != 0) + { + m_current_vector[3] = m_hd63450->get_error_vector(offset); + m_current_irq_line = 3; + logerror("DMA#%i: DMA Error (vector 0x%02x)\n",offset,m_current_vector[3]); + m_maincpu->set_input_line_and_vector(3,ASSERT_LINE,m_current_vector[3]); + } +} + +WRITE_LINE_MEMBER(x68k_state::x68k_fm_irq) +{ + if(state == CLEAR_LINE) + { + m_mfpdev->i3_w(1); + } + else + { + m_mfpdev->i3_w(0); + } +} + +WRITE8_MEMBER(x68k_state::x68030_adpcm_w) +{ + switch(offset) + { + case 0x00: + m_okim6258->okim6258_ctrl_w(space,0,data); + break; + case 0x01: + m_okim6258->okim6258_data_w(space,0,data); + break; + } +} + +WRITE_LINE_MEMBER(x68k_state::mfp_irq_callback) +{ + if(m_mfp_prev == CLEAR_LINE && state == CLEAR_LINE) // eliminate unnecessary calls to set the IRQ line for speed reasons + return; + if(state != CLEAR_LINE) + state = HOLD_LINE; // to get around erroneous spurious interrupt +// if((m_ioc.irqstatus & 0xc0) != 0) // if the FDC is busy, then we don't want to miss that IRQ +// return; + m_maincpu->set_input_line(6, state); + m_current_vector[6] = 0; + m_mfp_prev = state; +} + +IRQ_CALLBACK_MEMBER(x68k_state::x68k_int_ack) +{ + if(irqline == 6) // MFP + { + if(m_current_vector[6] != 0x4b && m_current_vector[6] != 0x4c) + m_current_vector[6] = m_mfpdev->get_vector(); + else + m_maincpu->set_input_line_and_vector(irqline,CLEAR_LINE,m_current_vector[irqline]); + logerror("SYS: IRQ acknowledged (vector=0x%02x, line = %i)\n",m_current_vector[6],irqline); + return m_current_vector[6]; + } + + m_maincpu->set_input_line_and_vector(irqline,CLEAR_LINE,m_current_vector[irqline]); + if(irqline == 1) // IOSC + { + m_ioc.irqstatus &= ~0xf0; + } + if(irqline == 5) // SCC + { + m_mouse.irqactive = 0; + } + + logerror("SYS: IRQ acknowledged (vector=0x%02x, line = %i)\n",m_current_vector[irqline],irqline); + return m_current_vector[irqline]; +} + +WRITE_LINE_MEMBER(x68k_state::x68k_scsi_irq) +{ + // TODO : Internal SCSI IRQ vector 0x6c, External SCSI IRQ vector 0xf6, IRQs go through the IOSC (IRQ line 1) + if(state != 0) + { + m_current_vector[1] = 0x6c; + m_current_irq_line = 1; + m_maincpu->set_input_line_and_vector(1,ASSERT_LINE,m_current_vector[1]); + } +} + +WRITE_LINE_MEMBER(x68k_state::x68k_scsi_drq) +{ + // TODO +} + +static ADDRESS_MAP_START(x68k_map, AS_PROGRAM, 16, x68k_state ) + AM_RANGE(0x000000, 0xbffffb) AM_READWRITE(x68k_emptyram_r, x68k_emptyram_w) + AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE(x68k_rom0_r, x68k_rom0_w) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(x68k_gvram_r, x68k_gvram_w) + AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE(x68k_tvram_r, x68k_tvram_w) + AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE(x68k_crtc_r, x68k_crtc_w) + AM_RANGE(0xe82000, 0xe821ff) AM_DEVREADWRITE("gfxpalette", palette_device, read, write) AM_SHARE("gfxpalette") + AM_RANGE(0xe82200, 0xe823ff) AM_DEVREADWRITE("pcgpalette", palette_device, read, write) AM_SHARE("pcgpalette") + AM_RANGE(0xe82400, 0xe83fff) AM_READWRITE(x68k_vid_r, x68k_vid_w) + AM_RANGE(0xe84000, 0xe85fff) AM_DEVREADWRITE("hd63450", hd63450_device, read, write) + AM_RANGE(0xe86000, 0xe87fff) AM_READWRITE(x68k_areaset_r, x68k_areaset_w) + AM_RANGE(0xe88000, 0xe89fff) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff) + AM_RANGE(0xe8a000, 0xe8bfff) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff) +// AM_RANGE(0xe8c000, 0xe8dfff) AM_READWRITE(x68k_printer_r, x68k_printer_w) + AM_RANGE(0xe8e000, 0xe8ffff) AM_READWRITE(x68k_sysport_r, x68k_sysport_w) + AM_RANGE(0xe90000, 0xe91fff) AM_DEVREADWRITE8("ym2151", ym2151_device, read, write, 0x00ff) + AM_RANGE(0xe92000, 0xe92001) AM_DEVREADWRITE8("okim6258", okim6258_device, okim6258_status_r, okim6258_ctrl_w, 0x00ff) + AM_RANGE(0xe92002, 0xe92003) AM_DEVREADWRITE8("okim6258", okim6258_device, okim6258_status_r, okim6258_data_w, 0x00ff) + AM_RANGE(0xe94000, 0xe94003) AM_DEVICE8("upd72065", upd72065_device, map, 0x00ff) + AM_RANGE(0xe94004, 0xe94007) AM_READWRITE(x68k_fdc_r, x68k_fdc_w) + AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE("x68k_hdc", x68k_hdc_image_device, hdc_r, hdc_w) + AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE(x68k_scc_r, x68k_scc_w) + AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE(x68k_ppi_r, x68k_ppi_w) + AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE(x68k_ioc_r, x68k_ioc_w) + AM_RANGE(0xe9e000, 0xe9e3ff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // FPU (Optional) + AM_RANGE(0xea0000, 0xea1fff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // external SCSI ROM and controller + AM_RANGE(0xeafa00, 0xeafa1f) AM_READWRITE(x68k_exp_r, x68k_exp_w) + AM_RANGE(0xeafa80, 0xeafa89) AM_READWRITE(x68k_areaset_r, x68k_enh_areaset_w) + AM_RANGE(0xeb0000, 0xeb7fff) AM_READWRITE(x68k_spritereg_r, x68k_spritereg_w) + AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE(x68k_spriteram_r, x68k_spriteram_w) + AM_RANGE(0xece000, 0xece3ff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // User I/O + AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE(x68k_sram_r, x68k_sram_w) + AM_RANGE(0xed4000, 0xefffff) AM_NOP + AM_RANGE(0xf00000, 0xfbffff) AM_ROM + AM_RANGE(0xfc0000, 0xfdffff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // internal SCSI ROM + AM_RANGE(0xfe0000, 0xffffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(x68kxvi_map, AS_PROGRAM, 16, x68k_state ) + AM_RANGE(0x000000, 0xbffffb) AM_READWRITE(x68k_emptyram_r, x68k_emptyram_w) + AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE(x68k_rom0_r, x68k_rom0_w) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(x68k_gvram_r, x68k_gvram_w) + AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE(x68k_tvram_r, x68k_tvram_w) + AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE(x68k_crtc_r, x68k_crtc_w) + AM_RANGE(0xe82000, 0xe821ff) AM_DEVREADWRITE("gfxpalette", palette_device, read, write) AM_SHARE("gfxpalette") + AM_RANGE(0xe82200, 0xe823ff) AM_DEVREADWRITE("pcgpalette", palette_device, read, write) AM_SHARE("pcgpalette") + AM_RANGE(0xe82400, 0xe83fff) AM_READWRITE(x68k_vid_r, x68k_vid_w) + AM_RANGE(0xe84000, 0xe85fff) AM_DEVREADWRITE("hd63450", hd63450_device, read, write) + AM_RANGE(0xe86000, 0xe87fff) AM_READWRITE(x68k_areaset_r, x68k_areaset_w) + AM_RANGE(0xe88000, 0xe89fff) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff) + AM_RANGE(0xe8a000, 0xe8bfff) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff) +// AM_RANGE(0xe8c000, 0xe8dfff) AM_READWRITE(x68k_printer_r, x68k_printer_w) + AM_RANGE(0xe8e000, 0xe8ffff) AM_READWRITE(x68k_sysport_r, x68k_sysport_w) + AM_RANGE(0xe90000, 0xe91fff) AM_DEVREADWRITE8("ym2151", ym2151_device, read, write, 0x00ff) + AM_RANGE(0xe92000, 0xe92001) AM_DEVREADWRITE8("okim6258", okim6258_device, okim6258_status_r, okim6258_ctrl_w, 0x00ff) + AM_RANGE(0xe92002, 0xe92003) AM_DEVREADWRITE8("okim6258", okim6258_device, okim6258_status_r, okim6258_data_w, 0x00ff) + AM_RANGE(0xe94000, 0xe94003) AM_DEVICE8("upd72065", upd72065_device, map, 0x00ff) + AM_RANGE(0xe94004, 0xe94007) AM_READWRITE(x68k_fdc_r, x68k_fdc_w) +// AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE("x68k_hdc", x68k_hdc_image_device, hdc_r, hdc_w) + AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff) + AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE(x68k_scc_r, x68k_scc_w) + AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE(x68k_ppi_r, x68k_ppi_w) + AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE(x68k_ioc_r, x68k_ioc_w) + AM_RANGE(0xe9e000, 0xe9e3ff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // FPU (Optional) + AM_RANGE(0xea0000, 0xea1fff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // external SCSI ROM and controller + AM_RANGE(0xeafa00, 0xeafa1f) AM_READWRITE(x68k_exp_r, x68k_exp_w) + AM_RANGE(0xeafa80, 0xeafa89) AM_READWRITE(x68k_areaset_r, x68k_enh_areaset_w) + AM_RANGE(0xeb0000, 0xeb7fff) AM_READWRITE(x68k_spritereg_r, x68k_spritereg_w) + AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE(x68k_spriteram_r, x68k_spriteram_w) + AM_RANGE(0xece000, 0xece3ff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // User I/O + AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE(x68k_sram_r, x68k_sram_w) + AM_RANGE(0xed4000, 0xefffff) AM_NOP + AM_RANGE(0xf00000, 0xfbffff) AM_ROM + AM_RANGE(0xfc0000, 0xfdffff) AM_ROM // internal SCSI ROM + AM_RANGE(0xfe0000, 0xffffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(x68030_map, AS_PROGRAM, 32, x68k_state ) + ADDRESS_MAP_GLOBAL_MASK(0x00ffffff) // Still only has 24-bit address space + AM_RANGE(0x000000, 0xbffffb) AM_READWRITE16(x68k_emptyram_r, x68k_emptyram_w,0xffffffff) + AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE16(x68k_rom0_r, x68k_rom0_w,0xffffffff) + AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(x68k_gvram_r, x68k_gvram_w, 0xffffffff) + AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE16(x68k_tvram_r, x68k_tvram_w, 0xffffffff) + AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE16(x68k_crtc_r, x68k_crtc_w,0xffffffff) + AM_RANGE(0xe82000, 0xe821ff) AM_DEVREADWRITE("gfxpalette", palette_device, read, write) AM_SHARE("gfxpalette") + AM_RANGE(0xe82200, 0xe823ff) AM_DEVREADWRITE("pcgpalette", palette_device, read, write) AM_SHARE("pcgpalette") + AM_RANGE(0xe82400, 0xe83fff) AM_READWRITE16(x68k_vid_r, x68k_vid_w,0xffffffff) + AM_RANGE(0xe84000, 0xe85fff) AM_DEVREADWRITE16("hd63450", hd63450_device, read, write, 0xffffffff) + AM_RANGE(0xe86000, 0xe87fff) AM_READWRITE16(x68k_areaset_r, x68k_areaset_w,0xffffffff) + AM_RANGE(0xe88000, 0xe89fff) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff00ff) + AM_RANGE(0xe8a000, 0xe8bfff) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff00ff) +// AM_RANGE(0xe8c000, 0xe8dfff) AM_READWRITE(x68k_printer_r, x68k_printer_w) + AM_RANGE(0xe8e000, 0xe8ffff) AM_READWRITE16(x68k_sysport_r, x68k_sysport_w,0xffffffff) + AM_RANGE(0xe90000, 0xe91fff) AM_DEVREADWRITE8("ym2151", ym2151_device, read, write, 0x00ff00ff) + AM_RANGE(0xe92000, 0xe92003) AM_DEVREAD8("okim6258", okim6258_device, okim6258_status_r, 0x00ff00ff) AM_WRITE8(x68030_adpcm_w, 0x00ff00ff) + AM_RANGE(0xe94000, 0xe94003) AM_DEVICE8("upd72065", upd72065_device, map, 0x00ff00ff) + AM_RANGE(0xe94004, 0xe94007) AM_READWRITE16(x68k_fdc_r, x68k_fdc_w,0xffffffff) +// AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE16("x68k_hdc", x68k_hdc_image_device, hdc_r, hdc_w, 0xffffffff) + AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff00ff) + AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE16(x68k_scc_r, x68k_scc_w,0xffffffff) + AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE16(x68k_ppi_r, x68k_ppi_w,0xffffffff) + AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE16(x68k_ioc_r, x68k_ioc_w,0xffffffff) + AM_RANGE(0xe9e000, 0xe9e3ff) AM_READWRITE16(x68k_exp_r, x68k_exp_w,0xffffffff) // FPU (Optional) + AM_RANGE(0xea0000, 0xea1fff) AM_NOP//AM_READWRITE16(x68k_exp_r, x68k_exp_w,0xffffffff) // external SCSI ROM and controller + AM_RANGE(0xeafa00, 0xeafa1f) AM_READWRITE16(x68k_exp_r, x68k_exp_w,0xffffffff) + AM_RANGE(0xeafa80, 0xeafa8b) AM_READWRITE16(x68k_areaset_r, x68k_enh_areaset_w,0xffffffff) + AM_RANGE(0xeb0000, 0xeb7fff) AM_READWRITE16(x68k_spritereg_r, x68k_spritereg_w,0xffffffff) + AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE16(x68k_spriteram_r, x68k_spriteram_w,0xffffffff) + AM_RANGE(0xece000, 0xece3ff) AM_READWRITE16(x68k_exp_r, x68k_exp_w,0xffffffff) // User I/O + AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE16(x68k_sram_r, x68k_sram_w, 0xffffffff) + AM_RANGE(0xed4000, 0xefffff) AM_NOP + AM_RANGE(0xf00000, 0xfbffff) AM_ROM + AM_RANGE(0xfc0000, 0xfdffff) AM_ROM // internal SCSI ROM + AM_RANGE(0xfe0000, 0xffffff) AM_ROM +ADDRESS_MAP_END + +static INPUT_PORTS_START( x68000 ) + PORT_START("ctrltype") + PORT_CONFNAME(0x0f, 0x00, "Joystick Port 1") + PORT_CONFSETTING(0x00, "Standard 2-button MSX/FM-Towns joystick") + PORT_CONFSETTING(0x01, "3-button Megadrive gamepad") + PORT_CONFSETTING(0x02, "6-button Megadrive gamepad") + PORT_CONFSETTING(0x03, "XPD-1LR dual D-pad gamepad") + PORT_CONFNAME(0xf0, 0x00, "Joystick Port 2") + PORT_CONFSETTING(0x00, "Standard 2-button MSX/FM-Towns joystick") + PORT_CONFSETTING(0x10, "3-button Megadrive gamepad") + PORT_CONFSETTING(0x20, "6-button Megadrive gamepad") + PORT_CONFSETTING(0x30, "XPD-1LR dual D-pad gamepad") +// TODO: Sharp Cyber Stick (CZ-8NJ2) support + + PORT_START( "joy1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) + + PORT_START( "joy2" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) + + PORT_START("options") + PORT_CONFNAME( 0x02, 0x02, "Enable fake bus errors") + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( 0x02, DEF_STR( On )) + PORT_CONFNAME( 0x04, 0x04, "Enable partial updates on each HSync") + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( 0x04, DEF_STR( On )) + + PORT_START("mouse1") // mouse buttons + PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) + PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) + + PORT_START("mouse2") // X-axis + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START("mouse3") // Y-axis + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + + // 3-button Megadrive gamepad + PORT_START("md3b") + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 1 Up") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("MD Pad 1 Down") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("MD Pad 1 Left") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("MD Pad 1 Right") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 B Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 C Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + + PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 A Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Start Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) + + PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 2 Up") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("MD Pad 2 Down") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("MD Pad 2 Left") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("MD Pad 2 Right") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 B Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 C Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + + PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x10000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 A Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Start Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) + + // 6-button Megadrive gamepad + PORT_START("md6b") + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 1 Up") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("MD Pad 1 Down") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("MD Pad 1 Left") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("MD Pad 1 Right") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 B Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 C Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + + PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 A Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Start Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + + PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 2 Up") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("MD Pad 2 Down") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("MD Pad 2 Left") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("MD Pad 2 Right") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 B Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 C Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + + PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x10000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 A Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Start Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + + // extra inputs + PORT_START("md6b_extra") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Z Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Y Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 X Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Mode Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) + + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Z Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Y Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 X Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Mode Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) + + // Dempa/Micomsoft XPD-1LR (dual D-pad gamepad sold with Libble Rabble) + PORT_START("xpd1lr") + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_NAME("XPD Pad 1 Left/Up") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_NAME("XPD Pad 1 Left/Down") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_NAME("XPD Pad 1 Left/Left") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_NAME("XPD Pad 1 Left/Right") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("XPD Pad 1 B Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("XPD Pad 1 A Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + + PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_NAME("XPD Pad 1 Right/Up") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_NAME("XPD Pad 1 Right/Down") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_NAME("XPD Pad 1 Right/Left") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_NAME("XPD Pad 1 Right/Right") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) + + PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_NAME("XPD Pad 2 Left/Up") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_NAME("XPD Pad 2 Left/Down") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_NAME("XPD Pad 2 Left/Left") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_NAME("XPD Pad 2 Left/Right") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("XPD Pad 2 B Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("XPD Pad 2 A Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + + PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_NAME("XPD Pad 2 Right/Up") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_NAME("XPD Pad 2 Right/Down") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_NAME("XPD Pad 2 Right/Left") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_NAME("XPD Pad 2 Right/Right") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x10000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) + +INPUT_PORTS_END + +void x68k_state::floppy_load_unload(bool load, floppy_image_device *dev) +{ + dev->mon_w(m_fdc.motor && !load); + if(m_ioc.irqstatus & 0x02) + { + m_current_vector[1] = 0x61; + m_ioc.irqstatus |= 0x40; + m_current_irq_line = 1; + m_maincpu->set_input_line_and_vector(1,ASSERT_LINE,m_current_vector[1]); // Disk insert/eject interrupt + logerror("IOC: Disk image inserted\n"); + } +} + +int x68k_state::floppy_load(floppy_image_device *dev) +{ + floppy_load_unload(true, dev); + return IMAGE_INIT_PASS; +} + +void x68k_state::floppy_unload(floppy_image_device *dev) +{ + floppy_load_unload(false, dev); +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_net_irq) +{ + m_current_vector[2] = 0xf9; + m_current_irq_line = 2; + m_maincpu->set_input_line_and_vector(2,ASSERT_LINE,m_current_vector[2]); +} + +WRITE_LINE_MEMBER(x68k_state::x68k_irq2_line) +{ + if(state==ASSERT_LINE) + { + m_net_timer->adjust(attotime::from_usec(16)); + } + else + m_maincpu->set_input_line_and_vector(2,CLEAR_LINE,m_current_vector[2]); + logerror("EXP: IRQ2 set to %i\n",state); + +} + +static SLOT_INTERFACE_START(x68000_exp_cards) + SLOT_INTERFACE("neptunex",X68K_NEPTUNEX) // Neptune-X ethernet adapter (ISA NE2000 bridge) + SLOT_INTERFACE("cz6bs1",X68K_SCSIEXT) // Sharp CZ-6BS1 SCSI-1 controller +SLOT_INTERFACE_END + +MACHINE_RESET_MEMBER(x68k_state,x68000) +{ + /* The last half of the IPLROM is mapped to 0x000000 on reset only + Just copying the inital stack pointer and program counter should + more or less do the same job */ + + int drive; + UINT8* romdata = memregion("user2")->base(); + attotime irq_time; + + memset(m_ram->pointer(),0,m_ram->size()); + memcpy(m_ram->pointer(),romdata,8); + + // initialise CRTC, set registers to defaults for the standard text mode (768x512) + m_crtc.reg[0] = 137; // Horizontal total (in characters) + m_crtc.reg[1] = 14; // Horizontal sync end + m_crtc.reg[2] = 28; // Horizontal start + m_crtc.reg[3] = 124; // Horizontal end + m_crtc.reg[4] = 567; // Vertical total + m_crtc.reg[5] = 5; // Vertical sync end + m_crtc.reg[6] = 40; // Vertical start + m_crtc.reg[7] = 552; // Vertical end + m_crtc.reg[8] = 27; // Horizontal adjust + + m_scanline = machine().first_screen()->vpos();// = m_crtc.reg[6]; // Vertical start + + // start VBlank timer + m_crtc.vblank = 1; + irq_time = m_screen->time_until_pos(m_crtc.reg[6],2); + m_vblank_irq->adjust(irq_time); + + // start HBlank timer + m_scanline_timer->adjust(m_screen->scan_period(), 1); + + /// TODO: get callbacks to trigger these + m_mfpdev->i0_w(1); // alarm + m_mfpdev->i1_w(1); // expon + m_mfpdev->i2_w(0); // pow sw + m_mfpdev->i3_w(1); // fmirq + m_mfpdev->i4_w(1); // v-disp + m_mfpdev->i5_w(1); // unused (always set) + m_mfpdev->i6_w(1); // cirq + m_mfpdev->i7_w(1); // h-sync + + // reset output values + output_set_value("key_led_kana",1); + output_set_value("key_led_romaji",1); + output_set_value("key_led_code",1); + output_set_value("key_led_caps",1); + output_set_value("key_led_insert",1); + output_set_value("key_led_hiragana",1); + output_set_value("key_led_fullsize",1); + for(drive=0;drive<4;drive++) + { + output_set_indexed_value("eject_drv",drive,1); + output_set_indexed_value("ctrl_drv",drive,1); + output_set_indexed_value("access_drv",drive,1); + } + m_fdc.select_drive = 0; + + // reset CPU + m_maincpu->reset(); +} + +MACHINE_START_MEMBER(x68k_state,x68000) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + /* Install RAM handlers */ + m_spriteram = (UINT16*)(memregion("user1")->base()); + space.install_readwrite_bank(0x000000,m_ram->size()-1,0xffffffff,0,"bank1"); + membank("bank1")->set_base(m_ram->pointer()); + + // start mouse timer + m_mouse_timer->adjust(attotime::zero, 0, attotime::from_msec(1)); // a guess for now + m_mouse.inputtype = 0; + + // start LED timer + m_led_timer->adjust(attotime::zero, 0, attotime::from_msec(400)); + + for(int drive=0;drive<4;drive++) + { + char devname[16]; + sprintf(devname, "%d", drive); + floppy_image_device *floppy = m_upd72065->subdevice(devname)->get_device(); + m_fdc.floppy[drive] = floppy; + if(floppy) { + floppy->setup_load_cb(floppy_image_device::load_cb(FUNC(x68k_state::floppy_load), this)); + floppy->setup_unload_cb(floppy_image_device::unload_cb(FUNC(x68k_state::floppy_unload), this)); + } + } + m_fdc.motor = 0; +} + +DRIVER_INIT_MEMBER(x68k_state,x68000) +{ + unsigned char* rom = memregion("maincpu")->base(); + unsigned char* user2 = memregion("user2")->base(); + + machine().device("nvram")->set_base(&m_nvram[0], m_nvram.size()*sizeof(m_nvram[0])); + +#ifdef USE_PREDEFINED_SRAM + { + unsigned char* ramptr = memregion("user3")->base(); + memcpy(m_sram,ramptr,0x4000); + } +#endif + + // copy last half of BIOS to a user region, to use for inital startup + memcpy(user2,(rom+0xff0000),0x10000); + + m_scanline_timer = timer_alloc(TIMER_X68K_HSYNC); + m_raster_irq = timer_alloc(TIMER_X68K_CRTC_RASTER_IRQ); + m_vblank_irq = timer_alloc(TIMER_X68K_CRTC_VBLANK_IRQ); + m_mouse_timer = timer_alloc(TIMER_X68K_SCC_ACK); + m_led_timer = timer_alloc(TIMER_X68K_LED); + m_net_timer = timer_alloc(TIMER_X68K_NET_IRQ); + m_fdc_tc = timer_alloc(TIMER_X68K_FDC_TC); + m_adpcm_timer = timer_alloc(TIMER_X68K_ADPCM); + m_bus_error_timer = timer_alloc(TIMER_X68K_BUS_ERROR); + + // Initialise timers for 6-button MD controllers + md_6button_init(); + + m_sysport.cputype = 0xff; // 68000, 10MHz + m_is_32bit = false; + + save_item(NAME(m_tvram)); + save_item(NAME(m_gvram)); + save_item(NAME(m_spritereg)); +} + +DRIVER_INIT_MEMBER(x68k_state,x68kxvi) +{ + DRIVER_INIT_CALL( x68000 ); + m_sysport.cputype = 0xfe; // 68000, 16MHz + m_is_32bit = false; +} + +DRIVER_INIT_MEMBER(x68k_state,x68030) +{ + DRIVER_INIT_CALL( x68000 ); + m_sysport.cputype = 0xdc; // 68030, 25MHz + m_is_32bit = true; +} + +FLOPPY_FORMATS_MEMBER( x68k_state::floppy_formats ) + FLOPPY_XDF_FORMAT, + FLOPPY_DIM_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( x68k_floppies ) + SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) +SLOT_INTERFACE_END + +static SLOT_INTERFACE_START(keyboard) + SLOT_INTERFACE("x68k", X68K_KEYBOARD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( x68000, x68k_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", M68000, 10000000) /* 10 MHz */ + MCFG_CPU_PROGRAM_MAP(x68k_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(x68k_state,x68k_int_ack) + + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + MCFG_MACHINE_START_OVERRIDE(x68k_state, x68000 ) + MCFG_MACHINE_RESET_OVERRIDE(x68k_state, x68000 ) + + /* device hardware */ + MCFG_DEVICE_ADD(MC68901_TAG, MC68901, 4000000) + MCFG_MC68901_TIMER_CLOCK(4000000) + MCFG_MC68901_RX_CLOCK(0) + MCFG_MC68901_TX_CLOCK(0) + MCFG_MC68901_OUT_IRQ_CB(WRITELINE(x68k_state, mfp_irq_callback)) + MCFG_MC68901_OUT_TBO_CB(DEVWRITELINE(MC68901_TAG, mc68901_device, clock_w)) + MCFG_MC68901_OUT_SO_CB(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD("keyboard", keyboard, "x68k") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) + + MCFG_DEVICE_ADD("ppi8255", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(x68k_state, ppi_port_a_r)) + MCFG_I8255_IN_PORTB_CB(READ8(x68k_state, ppi_port_b_r)) + MCFG_I8255_IN_PORTC_CB(READ8(x68k_state, ppi_port_c_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(x68k_state, ppi_port_c_w)) + + MCFG_DEVICE_ADD("hd63450", HD63450, 0) + MCFG_HD63450_CPU("maincpu") // CPU - 68000 + MCFG_HD63450_CLOCKS(attotime::from_usec(2), attotime::from_nsec(450), attotime::from_usec(4), attotime::from_hz(15625/2)) + MCFG_HD63450_BURST_CLOCKS(attotime::from_usec(2), attotime::from_nsec(450), attotime::from_nsec(50), attotime::from_nsec(50)) + MCFG_HD63450_DMA_END_CB(WRITE8(x68k_state, dma_end)) + MCFG_HD63450_DMA_ERROR_CB(WRITE8(x68k_state, dma_error)) + MCFG_HD63450_DMA_READ_0_CB(DEVREAD8("upd72065", upd72065_device, mdma_r)) + MCFG_HD63450_DMA_WRITE_0_CB(DEVWRITE8("upd72065", upd72065_device, mdma_w)) + + MCFG_DEVICE_ADD("scc", SCC8530, 5000000) + + MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) + MCFG_RP5C15_OUT_ALARM_CB(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(55.45) + MCFG_SCREEN_SIZE(1096, 568) // inital setting + MCFG_SCREEN_VISIBLE_AREA(0, 767, 0, 511) + MCFG_SCREEN_UPDATE_DRIVER(x68k_state, screen_update_x68000) + + MCFG_GFXDECODE_ADD("gfxdecode", "pcgpalette", empty) + + MCFG_PALETTE_ADD("gfxpalette", 256) + MCFG_PALETTE_FORMAT_CLASS(2, x68k_state, GGGGGRRRRRBBBBBI) + MCFG_PALETTE_ADD("pcgpalette", 256) + MCFG_PALETTE_FORMAT_CLASS(2, x68k_state, GGGGGRRRRRBBBBBI) + + MCFG_VIDEO_START_OVERRIDE(x68k_state, x68000 ) + + MCFG_DEFAULT_LAYOUT( layout_x68000 ) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_YM2151_ADD("ym2151", 4000000) + MCFG_YM2151_IRQ_HANDLER(WRITELINE(x68k_state,x68k_fm_irq)) + MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(x68k_state,x68k_ct_w)) // CT1, CT2 from YM2151 port 0x1b + MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + + MCFG_OKIM6258_ADD("okim6258", 4000000) + MCFG_OKIM6258_DIVIDER(FOSC_DIV_BY_512) + MCFG_OKIM6258_ADPCM_TYPE(TYPE_4BITS) + MCFG_OKIM6258_OUT_BITS(OUTPUT_10BITS) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) + + MCFG_UPD72065_ADD("upd72065", true, false) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(x68k_state, fdc_irq)) + MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("hd63450", hd63450_device, drq0_w)) + MCFG_FLOPPY_DRIVE_ADD("upd72065:0", x68k_floppies, "525hd", x68k_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd72065:1", x68k_floppies, "525hd", x68k_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd72065:2", x68k_floppies, "525hd", x68k_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("upd72065:3", x68k_floppies, "525hd", x68k_state::floppy_formats) + + MCFG_SOFTWARE_LIST_ADD("flop_list","x68k_flop") + + MCFG_DEVICE_ADD("exp", X68K_EXPANSION_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(x68000_exp_cards, NULL, false) + MCFG_X68K_EXPANSION_SLOT_OUT_IRQ2_CB(WRITELINE(x68k_state, x68k_irq2_line)) + MCFG_X68K_EXPANSION_SLOT_OUT_IRQ4_CB(INPUTLINE("maincpu", M68K_IRQ_4)) + MCFG_X68K_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("1M,2M,3M,5M,6M,7M,8M,9M,10M,11M,12M") + + MCFG_NVRAM_ADD_0FILL("nvram") + + MCFG_X68KHDC_ADD( "x68k_hdc" ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( x68ksupr, x68000 ) + MCFG_DEVICE_REMOVE("x68k_hdc") + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(x68kxvi_map) + + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE6, "harddisk", SCSIHD, SCSI_ID_5) + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE7, "harddisk", SCSIHD, SCSI_ID_6) + + MCFG_DEVICE_ADD("mb89352", MB89352A, 0) + MCFG_LEGACY_SCSI_PORT("scsi") + MCFG_MB89352A_IRQ_CB(WRITELINE(x68k_state, x68k_scsi_irq)) + MCFG_MB89352A_DRQ_CB(WRITELINE(x68k_state, x68k_scsi_drq)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( x68kxvi, x68ksupr ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_CLOCK(16000000) /* 16 MHz */ +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( x68030, x68ksupr ) + MCFG_CPU_REPLACE("maincpu", M68030, 25000000) /* 25 MHz 68EC030 */ + MCFG_CPU_PROGRAM_MAP(x68030_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(x68k_state,x68k_int_ack) +MACHINE_CONFIG_END + +ROM_START( x68000 ) + ROM_REGION16_BE(0x1000000, "maincpu", 0) // 16MB address space + ROM_DEFAULT_BIOS("ipl10") + ROM_LOAD( "cgrom.dat", 0xf00000, 0xc0000, CRC(9f3195f1) SHA1(8d72c5b4d63bb14c5dbdac495244d659aa1498b6) ) + ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0 (87/05/07)") + ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1 (91/01/11)") + ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2 (91/10/24)") + ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") + ROMX_LOAD( "iplrom30.dat", 0xfe0000, 0x020000, CRC(e8f8fdad) SHA1(239e9124568c862c31d9ec0605e32373ea74b86a), ROM_BIOS(4) ) + ROM_REGION(0x8000, "user1",0) // For Background/Sprite decoding + ROM_FILL(0x0000,0x8000,0x00) + ROM_REGION(0x20000, "user2", 0) + ROM_FILL(0x000,0x20000,0x00) +ROM_END + +ROM_START( x68ksupr ) + ROM_REGION16_BE(0x1000000, "maincpu", 0) // 16MB address space + ROM_DEFAULT_BIOS("ipl11") + ROM_LOAD( "cgrom.dat", 0xf00000, 0xc0000, CRC(9f3195f1) SHA1(8d72c5b4d63bb14c5dbdac495244d659aa1498b6) ) + ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0 (87/05/07)") + ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1 (91/01/11)") + ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2 (91/10/24)") + ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") + ROMX_LOAD( "iplrom30.dat", 0xfe0000, 0x020000, CRC(e8f8fdad) SHA1(239e9124568c862c31d9ec0605e32373ea74b86a), ROM_BIOS(4) ) + ROM_LOAD("scsiinsu.bin",0xfc0000, 0x002000, CRC(f65a3e24) SHA1(15a17798839a3f7f361119205aebc301c2df5967) ) // Dumped from an X68000 Super HD +// ROM_LOAD("scsiexrom.dat",0xea0000, 0x002000, NO_DUMP ) + ROM_REGION(0x8000, "user1",0) // For Background/Sprite decoding + ROM_FILL(0x0000,0x8000,0x00) + ROM_REGION(0x20000, "user2", 0) + ROM_FILL(0x000,0x20000,0x00) +ROM_END + +ROM_START( x68kxvi ) + ROM_REGION16_BE(0x1000000, "maincpu", 0) // 16MB address space + ROM_DEFAULT_BIOS("ipl11") + ROM_LOAD( "cgrom.dat", 0xf00000, 0xc0000, CRC(9f3195f1) SHA1(8d72c5b4d63bb14c5dbdac495244d659aa1498b6) ) + ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0 (87/05/07)") + ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1 (91/01/11)") + ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2 (91/10/24)") + ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") + ROMX_LOAD( "iplrom30.dat", 0xfe0000, 0x020000, CRC(e8f8fdad) SHA1(239e9124568c862c31d9ec0605e32373ea74b86a), ROM_BIOS(4) ) + ROM_LOAD("scsiinco.bin",0xfc0000, 0x002000, CRC(2485e14d) SHA1(101a9bba8ea4bb90965c144bcfd7182f889ab958) ) // Dumped from an X68000 XVI Compact +// ROM_LOAD("scsiexrom.dat",0xea0000, 0x002000, NO_DUMP ) + ROM_REGION(0x8000, "user1",0) // For Background/Sprite decoding + ROM_FILL(0x0000,0x8000,0x00) + ROM_REGION(0x20000, "user2", 0) + ROM_FILL(0x000,0x20000,0x00) +ROM_END + +ROM_START( x68030 ) + ROM_REGION16_BE(0x1000000, "maincpu", 0) // 16MB address space + ROM_DEFAULT_BIOS("ipl13") + ROM_LOAD( "cgrom.dat", 0xf00000, 0xc0000, CRC(9f3195f1) SHA1(8d72c5b4d63bb14c5dbdac495244d659aa1498b6) ) + ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0 (87/05/07)") + ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1 (91/01/11)") + ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2 (91/10/24)") + ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") + ROMX_LOAD( "iplrom30.dat", 0xfe0000, 0x020000, CRC(e8f8fdad) SHA1(239e9124568c862c31d9ec0605e32373ea74b86a), ROM_BIOS(4) ) + ROM_LOAD("scsiinrom.dat",0xfc0000, 0x002000, CRC(1c6c889e) SHA1(3f063d4231cdf53da6adc4db96533725e260076a) BAD_DUMP ) +// ROM_LOAD("scsiexrom.dat",0xea0000, 0x002000, NO_DUMP ) + ROM_REGION(0x8000, "user1",0) // For Background/Sprite decoding + ROM_FILL(0x0000,0x8000,0x00) + ROM_REGION(0x20000, "user2", 0) + ROM_FILL(0x000,0x20000,0x00) +ROM_END + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1987, x68000, 0, 0, x68000, x68000, x68k_state, x68000, "Sharp", "X68000", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1990, x68ksupr,x68000, 0, x68ksupr,x68000, x68k_state,x68000, "Sharp", "X68000 Super", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) +COMP( 1991, x68kxvi,x68000, 0, x68kxvi,x68000, x68k_state, x68kxvi,"Sharp", "X68000 XVI", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) +COMP( 1993, x68030, x68000, 0, x68030, x68000, x68k_state, x68030, "Sharp", "X68030", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/xavix.c b/src/mame/drivers/xavix.c new file mode 100644 index 00000000000..36f5efe2fa1 --- /dev/null +++ b/src/mame/drivers/xavix.c @@ -0,0 +1,179 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Skeleton driver for XaviX TV PNP console and childs (Let's! Play TV Classic) + + CPU is M6502 derivative, almost likely to be a G65816 + + TODO: + - understand how to map ROM at 0x800000-0x9fffff / 0xc00000 / 0xdfffff + banks (granted that we have the ROM for that, of course) + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/m6502/m6502.h" +//#include "sound/ay8910.h" +#include "cpu/g65816/g65816.h" + +#define MAIN_CLOCK XTAL_21_4772MHz + +class xavix_state : public driver_device +{ +public: + xavix_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + // devices + required_device m_maincpu; + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); +}; + +void xavix_state::video_start() +{ +} + +UINT32 xavix_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + return 0; +} + +static ADDRESS_MAP_START( xavix_map, AS_PROGRAM, 8, xavix_state ) + AM_RANGE(0x000000, 0x0001ff) AM_RAM + AM_RANGE(0x00f000, 0x00ffff) AM_ROM AM_REGION("bios", 0x00f000) + AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("bios", 0x000000) // wrong +ADDRESS_MAP_END + +static INPUT_PORTS_START( xavix ) + /* dummy active high structure */ + PORT_START("SYSA") + PORT_DIPNAME( 0x01, 0x00, "SYSA" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + /* dummy active low structure */ + PORT_START("DSWA") + PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +/* correct, 4bpp gfxs */ +static const gfx_layout charlayout = +{ + 8,8, + RGN_FRAC(1,1), + 4, + { STEP4(0,1) }, + { 1*4,0*4,3*4,2*4,5*4,4*4,7*4,6*4 }, + { STEP8(0,4*8) }, + 8*8*4 +}; + +static GFXDECODE_START( xavix ) + GFXDECODE_ENTRY( "bios", 0, charlayout, 0, 1 ) +GFXDECODE_END + + +void xavix_state::machine_start() +{ +} + +void xavix_state::machine_reset() +{ +} + + +static MACHINE_CONFIG_START( xavix, xavix_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",G65816,MAIN_CLOCK/4) + MCFG_CPU_PROGRAM_MAP(xavix_map) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_UPDATE_DRIVER(xavix_state, screen_update) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", xavix) + + MCFG_PALETTE_ADD("palette", 16) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( taitons1 ) + ROM_REGION( 0x200000, "bios", ROMREGION_ERASE00 ) + ROM_LOAD( "taitonostalgia1.u3", 0x000000, 0x200000, CRC(25bd8c67) SHA1(a109cd2da6aa4596e3ca3abd1afce2d0001a473f) ) +ROM_END + +CONS( 2006, taitons1, 0, 0, xavix, xavix, driver_device, 0, "Bandai / SSD Company LTD / Taito", "Let's! TV Play Classic - Taito Nostalgia 1", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/xbox.c b/src/mame/drivers/xbox.c new file mode 100644 index 00000000000..b337b3a8a94 --- /dev/null +++ b/src/mame/drivers/xbox.c @@ -0,0 +1,254 @@ +// license:BSD-3-Clause +// copyright-holders:? +/*************************************************************************** + + XBOX (c) 2001 Microsoft + + Skeleton driver + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/i386/i386.h" +#include "machine/lpci.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/idectrl.h" +#include "machine/idehd.h" +#include "machine/atapicdr.h" +#include "video/poly.h" +#include "bitmap.h" +#include "debug/debugcon.h" +#include "debug/debugcmd.h" +#include "debug/debugcpu.h" +#include "includes/chihiro.h" +#include "includes/xbox.h" + +#define CPU_DIV 64 + +class xbox_state : public xbox_base_state +{ +public: + xbox_state(const machine_config &mconfig, device_type type, const char *tag) : + xbox_base_state(mconfig, type, tag), + usbhack_index(-1), + usbhack_counter(0) + { } + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + + virtual void hack_eeprom(); + virtual void hack_usb(); + + struct chihiro_devices { + bus_master_ide_controller_device *ide; + } xbox_devs; + int usbhack_index; + int usbhack_counter; +}; + +void xbox_state::video_start() +{ +} + +static ADDRESS_MAP_START(xbox_map, AS_PROGRAM, 32, xbox_state) + AM_IMPORT_FROM(xbox_base_map) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(xbox_map_io, AS_IO, 32, xbox_state) + AM_IMPORT_FROM(xbox_base_map_io) +ADDRESS_MAP_END + +static INPUT_PORTS_START( xbox ) + /* dummy active high structure */ + PORT_START("SYSA") + PORT_DIPNAME( 0x01, 0x00, "SYSA" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + /* dummy active low structure */ + PORT_START("DSWA") + PORT_DIPNAME( 0x01, 0x01, "DSWA" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + + +void xbox_state::hack_eeprom() +{ + // 8004e5da,4e5da=0xc3 + m_maincpu->space(0).write_byte(0x4e5da, 0xc3); // remove audio wait + // 8006e654,6e654=0 + m_maincpu->space(0).write_byte(0x6e654, 0); // disable boot animation +} + +/*static const struct { + const char *game_name; + struct { + UINT32 address; + UINT8 write_byte; + } modify[16]; +} hacks[] = { { "chihiro",{ { 0x6a79f, 0x01 },{ 0x6a7a0, 0x00 },{ 0x6b575, 0x00 },{ 0x6b576, 0x00 },{ 0x6b5af, 0x75 },{ 0x6b78a, 0x75 },{ 0x6b7ca, 0x00 },{ 0x6b7b8, 0x00 },{ 0x8f5b2, 0x75 },{ 0x79a9e, 0x74 },{ 0x79b80, 0x74 },{ 0x79b97, 0x74 },{ 0, 0 } } }, +{ "outr2",{ { 0x12e4cf, 0x01 },{ 0x12e4d0, 0x00 },{ 0x4793e, 0x01 },{ 0x4793f, 0x00 },{ 0x47aa3, 0x01 },{ 0x47aa4, 0x00 },{ 0x14f2b6, 0x84 },{ 0x14f2d1, 0x75 },{ 0x8732f, 0x7d },{ 0x87384, 0x7d },{ 0x87388, 0xeb },{ 0, 0 } } } };*/ + +void xbox_state::hack_usb() +{ + int p; + + if (usbhack_counter == 0) + p = 0; + else if (usbhack_counter == 1) // after game loaded + p = usbhack_index; + else + p = -1; + if (p >= 0) { + /*for (int a = 0; a < 16; a++) { + if (hacks[p].modify[a].address == 0) + break; + m_maincpu->space(0).write_byte(hacks[p].modify[a].address, hacks[p].modify[a].write_byte); + }*/ + } + usbhack_counter++; +} + +void xbox_state::machine_start() +{ + xbox_base_state::machine_start(); + xbox_devs.ide = machine().device("ide"); + usbhack_index = -1; + /*for (int a = 1; a < 2; a++) + if (strcmp(machine().basename(), hacks[a].game_name) == 0) { + usbhack_index = a; + break; + }*/ + usbhack_counter = 0; + // savestates + save_item(NAME(usbhack_counter)); +} + +void xbox_state::machine_reset() +{ + ata_mass_storage_device *devh; + atapi_cdrom_device *devc; + UINT16 *id; + + // set some neede parameters + devh = machine().device("ide:0:hdd"); + id = devh->identify_device_buffer(); + id[88] |= (1 << 2); // ultra dma mode 2 supported + id[128] |= 2; // bits 2-1=01 drive already unlocked + devc = machine().device("ide:1:cdrom"); + id = devc->identify_device_buffer(); + id[64] |= (1 << 1); + id[88] |= (1 << 2); // ultra dma mode 2 supported +} + +SLOT_INTERFACE_START(xbox_ata_devices) +SLOT_INTERFACE("hdd", IDE_HARDDISK) +SLOT_INTERFACE("cdrom", ATAPI_CDROM) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_DERIVED_CLASS(xbox, xbox_base, xbox_state) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(xbox_map) + MCFG_CPU_IO_MAP(xbox_map_io) + + MCFG_DEVICE_MODIFY("ide:0") + MCFG_DEVICE_SLOT_INTERFACE(xbox_ata_devices, "hdd", true) + MCFG_DEVICE_MODIFY("ide:1") + MCFG_DEVICE_SLOT_INTERFACE(xbox_ata_devices, "cdrom", true) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Machine driver(s) + +***************************************************************************/ + +ROM_START( xbox ) + ROM_REGION( 0x400, "mcpx", 0 ) + // mcpx_1_0.bin is bad, first byte (0x7f) sould be removed and a byte with value 0xee added at the end + ROM_LOAD( "mcpx_1_0.bin", 0, 0x200, CRC(f31429fc) SHA1(a9ecbf8896d10db81594923e485862aa3aac7b58) ) + ROM_LOAD( "mcpx_1_1.bin", 0x200, 0x200, CRC(94ce376b) SHA1(6c875f17f773aaec51eb434068bb6c657c4343c0) ) + + ROM_REGION( 0x100000, "bios", 0) + ROM_LOAD( "4134_1024k.bin", 0x000000, 0x100000, CRC(49d8055a) SHA1(d46cef771a63dc8024fe36d7ab5b959087ac999f) ) + ROM_COPY( "mcpx", 1, 0x7fe00, 0x1ff) + + + ROM_REGION( 0x1000000, "tbp", 0 ) // To Be Processed, of course + ROM_LOAD( "3944_1024k.bin", 0x000000, 0x100000, CRC(32a9ecb6) SHA1(67054fc88bda94e33e86f1b19be60efec0724fb6) ) + ROM_LOAD( "4034_1024k.bin", 0x000000, 0x100000, CRC(0d6fc88f) SHA1(ab676b712204fb1728bf89f9cd541a8f5a64ab97) ) + ROM_LOAD( "4817_1024k.bin", 0x000000, 0x100000, CRC(3f30863a) SHA1(dc955bd4d3ca71e01214a49e5d0aba615270c03c) ) + ROM_LOAD( "5101_256k.bin", 0x000000, 0x040000, CRC(e8a9224e) SHA1(5108e1025f48071c07a6823661d708c66dee97a9) ) + ROM_LOAD( "xbox-5530.bin", 0x000000, 0x040000, CRC(9569c4d3) SHA1(40fa73277013be3168135e1768b09623a987ff63) ) + ROM_LOAD( "xbox-5713.bin", 0x040000, 0x040000, CRC(58fd8173) SHA1(8b7ccc4648ccd78cdb7b65cfca09621eaf2d4238) ) + ROM_LOAD( "5838_256k.bin", 0x000000, 0x040000, CRC(5be2413d) SHA1(b9489e883c650b5e5fe2f83a32237dbf74f0e9f1) ) +ROM_END +// See src/emu/gamedrv.h for details +// For a game: +// GAME(YEAR,NAME,PARENT,MACHINE,INPUT,CLASS,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) + +// For a console: +// CONS(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) + +// For a computer: +// COMP(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) + +// For a generic system: +// SYST(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) + +CONS( 2001, xbox, 0, 0, xbox, xbox, driver_device, 0, "Microsoft", "XBOX", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/xerox820.c b/src/mame/drivers/xerox820.c new file mode 100644 index 00000000000..bd7756004d3 --- /dev/null +++ b/src/mame/drivers/xerox820.c @@ -0,0 +1,833 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*************************************************************************** + + Xerox 820 + + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +/* + + TODO: + + - Xerox 820 + - floppy format has 3xcd at the end of track data + :u109: write track 0 + :u109: track description 16xff ... 109xff 3xcd + - Xerox 820-II + - floppy (read/write to FDC triggers Z80 WAIT) + - Winchester + - Shugart SA1004 (chs=256,4,40 ss=256) + - Shugart SA606 (chs=160,6, ss=256) + - Shugart SA1403D controller + - Xerox 16/8 + - Emerald Microware X120 board + - type in Monitor v1.0 from manual + - ASCII keyboard + - low-profile keyboard + + http://users.telenet.be/lust/Xerox820/index.htm + http://www.classiccmp.org/dunfield/img41867/system.htm + http://www.microcodeconsulting.com/z80/plus2.htm + + Note: + - MK-82 have same roms as original Big Board + - MK-83 have 256K of RAM + + 8-inch formats + 77 tracks, 1 head, 26 sectors, 128 bytes sector length, first sector id 1 + 77 tracks, 1 head, 26 sectors, 256 bytes sector length, first sector id 1 + + 5.25-inch formats + 40 tracks, 1 head, 18 sectors, 128 bytes sector length, first sector id 1 + 40 tracks, 2 heads, 18 sectors, 128 bytes sector length, first sector id 1 + +*/ + + +#include "includes/xerox820.h" + +/* Read/Write Handlers */ + +void xerox820_state::bankswitch(int bank) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + if (bank) + { + /* ROM */ + program.install_rom(0x0000, 0x0fff, m_rom->base()); + program.unmap_readwrite(0x1000, 0x1fff); + program.install_ram(0x3000, 0x3fff, m_video_ram); + } + else + { + /* RAM */ + program.install_ram(0x0000, 0x3fff, ram); + } +} + +void xerox820ii_state::bankswitch(int bank) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + if (bank) + { + /* ROM */ + program.install_rom(0x0000, 0x1fff, m_rom->base()); + program.unmap_readwrite(0x2000, 0x2fff); + program.install_ram(0x3000, 0x3fff, m_video_ram); + program.unmap_readwrite(0x4000, 0xbfff); + } + else + { + /* RAM */ + program.install_ram(0x0000, 0xbfff, ram); + } +} + +READ8_MEMBER( xerox820_state::fdc_r ) +{ + return m_fdc->gen_r(offset) ^ 0xff; +} + +WRITE8_MEMBER( xerox820_state::fdc_w ) +{ + m_fdc->gen_w(offset, data ^ 0xff); +} + +WRITE8_MEMBER( xerox820_state::scroll_w ) +{ + m_scroll = (offset >> 8) & 0x1f; +} + +#ifdef UNUSED_CODE +WRITE8_MEMBER( xerox820_state::x120_system_w ) +{ + /* + + bit signal description + + 0 DSEL0 drive select bit 0 (01=A, 10=B, 00=C, 11=D) + 1 DSEL1 drive select bit 1 + 2 SIDE side select + 3 VATT video attribute (0=inverse, 1=blinking) + 4 BELL bell trigger + 5 DENSITY density (0=double, 1=single) + 6 _MOTOR disk motor (0=on, 1=off) + 7 BANK memory bank switch (0=RAM, 1=ROM/video) + + */ +} +#endif + +WRITE8_MEMBER( xerox820ii_state::bell_w ) +{ + m_speaker->level_w(offset); +} + +WRITE8_MEMBER( xerox820ii_state::slden_w ) +{ + m_fdc->dden_w(offset); +} + +WRITE8_MEMBER( xerox820ii_state::chrom_w ) +{ + m_chrom = offset; +} + +WRITE8_MEMBER( xerox820ii_state::lowlite_w ) +{ + m_lowlite = data; +} + +WRITE8_MEMBER( xerox820ii_state::sync_w ) +{ + if (offset) + { + /* set external clocks for synchronous sio A */ + } + else + { + /* set internal clocks for asynchronous sio A */ + } +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( xerox820_mem, AS_PROGRAM, 8, xerox820_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x3000, 0x3fff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0x4000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( xerox820_io, AS_IO, 8, xerox820_state ) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff03) AM_DEVWRITE(COM8116_TAG, com8116_device, str_w) + AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x08, 0x0b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80PIO_GP_TAG, z80pio_device, read_alt, write_alt) + AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff03) AM_DEVWRITE(COM8116_TAG, com8116_device, stt_w) + AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0x14, 0x14) AM_MIRROR(0xff03) AM_MASK(0xff00) AM_WRITE(scroll_w) + AM_RANGE(0x18, 0x1b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0x1c, 0x1f) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80PIO_KB_TAG, z80pio_device, read_alt, write_alt) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( xerox820ii_mem, AS_PROGRAM, 8, xerox820ii_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x3000, 0x3fff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0xc000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( xerox820ii_io, AS_IO, 8, xerox820ii_state ) + AM_IMPORT_FROM(xerox820_io) + AM_RANGE(0x28, 0x29) AM_MIRROR(0xff00) AM_WRITE(bell_w) + AM_RANGE(0x30, 0x31) AM_MIRROR(0xff00) AM_WRITE(slden_w) + AM_RANGE(0x34, 0x35) AM_MIRROR(0xff00) AM_WRITE(chrom_w) + AM_RANGE(0x36, 0x36) AM_MIRROR(0xff00) AM_WRITE(lowlite_w) + AM_RANGE(0x68, 0x69) AM_MIRROR(0xff00) AM_WRITE(sync_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( xerox168_mem, AS_PROGRAM, 16, xerox820ii_state ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM + AM_RANGE(0xff000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mk83_mem, AS_PROGRAM, 8, xerox820_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x3000, 0x6fff) AM_RAM + AM_RANGE(0x7000, 0x7fff) AM_RAM AM_SHARE("video_ram") + AM_RANGE(0x8000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +/* Input Ports */ + +static INPUT_PORTS_START( xerox820 ) + // inputs defined in machine/keyboard.c +INPUT_PORTS_END + +TIMER_CALLBACK_MEMBER( bigboard_state::bigboard_beepoff ) +{ + m_beeper->set_state(0); +} + +/* Z80 PIO */ + +READ8_MEMBER( xerox820_state::kbpio_pa_r ) +{ + /* + + bit signal description + + 0 + 1 + 2 + 3 PBRDY keyboard data available + 4 8/N5 8"/5.25" disk select (0=5.25", 1=8") + 5 400/460 double sided disk detect (only on Etch 2 PCB) (0=SS, 1=DS) + 6 + 7 + + */ + + UINT8 data = 0; + + // keyboard + data |= m_kbpio->rdy_b() << 3; + + // floppy + data |= m_8n5 << 4; + data |= m_400_460 << 5; + + return data; +} + +WRITE8_MEMBER( xerox820_state::kbpio_pa_w ) +{ + /* + + bit signal description + + 0 _DVSEL1 drive select 1 + 1 _DVSEL2 drive select 2 + 2 SIDE side select + 3 + 4 + 5 + 6 NCSET2 display character set (inverted and connected to chargen A10) + 7 BANK bank switching (0=RAM, 1=ROM/videoram) + + */ + + /* drive select */ + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + int _8n5 = (floppy->get_form_factor() == floppy_image::FF_8); + + if (m_8n5 != _8n5) + { + m_8n5 = _8n5; + + m_fdc->set_unscaled_clock(m_8n5 ? XTAL_20MHz/10 : XTAL_20MHz/20); + } + + m_400_460 = !floppy->twosid_r(); + + floppy->mon_w(0); + + floppy->ss_w(BIT(data, 2)); + } + + /* display character set */ + m_ncset2 = !BIT(data, 6); + + /* bank switching */ + bankswitch(BIT(data, 7)); +} + +WRITE8_MEMBER( bigboard_state::kbpio_pa_w ) +{ + xerox820_state::kbpio_pa_w(space, offset, data); + + /* beeper on bigboard */ + if (BIT(data, 5) & (!m_bit5)) + { + machine().scheduler().timer_set(attotime::from_msec(40), timer_expired_delegate(FUNC(bigboard_state::bigboard_beepoff),this)); + m_beeper->set_state(1); + } + m_bit5 = BIT(data, 5); +} + +READ8_MEMBER( xerox820_state::kbpio_pb_r ) +{ + /* + + bit description + + 0 KB0 + 1 KB1 + 2 KB2 + 3 KB3 + 4 KB4 + 5 KB5 + 6 KB6 + 7 KB7 + + */ + + return m_kb->read() ^ 0xff; +} + +WRITE8_MEMBER( xerox820ii_state::rdpio_pb_w ) +{ + /* + + bit description + + 0 NBSY + 1 NMSG + 2 NC/D + 3 NREQ + 4 NI/O + 5 NSEL + 6 LS74 Q + 7 NRST + */ + + m_sasibus->write_sel(!BIT(data, 5)); + m_sasibus->write_rst(!BIT(data, 7)); + // TODO: LS74 Q +} + +WRITE_LINE_MEMBER( xerox820ii_state::rdpio_pardy_w ) +{ + // TODO +} + +/* Z80 CTC */ + +TIMER_DEVICE_CALLBACK_MEMBER( xerox820_state::ctc_tick ) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); +} + +/* Z80 Daisy Chain */ + +static const z80_daisy_config xerox820_daisy_chain[] = +{ + { Z80SIO_TAG }, + { Z80PIO_KB_TAG }, + { Z80PIO_GP_TAG }, + { Z80CTC_TAG }, + { NULL } +}; + +/* WD1771 Interface */ + +static SLOT_INTERFACE_START( xerox820_floppies ) + SLOT_INTERFACE( "sa400", FLOPPY_525_SSSD_35T ) // Shugart SA-400 + SLOT_INTERFACE( "sa450", FLOPPY_525_DD ) // Shugart SA-450 + SLOT_INTERFACE( "sa800", FLOPPY_8_SSDD ) // Shugart SA-800 + SLOT_INTERFACE( "sa850", FLOPPY_8_DSDD ) // Shugart SA-850 +SLOT_INTERFACE_END + +void xerox820_state::update_nmi() +{ + int halt = m_maincpu->state_int(Z80_HALT); + int state = (halt && (m_fdc_irq || m_fdc_drq)) ? ASSERT_LINE : CLEAR_LINE; + + m_maincpu->set_input_line(INPUT_LINE_NMI, state); +} + +WRITE_LINE_MEMBER( xerox820_state::fdc_intrq_w ) +{ + m_fdc_irq = state; + + update_nmi(); +} + +WRITE_LINE_MEMBER( xerox820_state::fdc_drq_w ) +{ + m_fdc_drq = state; + + update_nmi(); +} + +/* COM8116 Interface */ + +WRITE_LINE_MEMBER( xerox820_state::fr_w ) +{ + m_sio->rxca_w(state); + m_sio->txca_w(state); +} + +/* Video */ + +UINT32 xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=(m_scroll + 1) * 0x80,x; + const pen_t *pen=m_palette->pens(); + + m_framecnt++; + + for (y = 0; y < 24; y++) + { + if (ma > 0xb80) ma = 0; + + for (ra = 0; ra < 10; ra++) + { + UINT32 *p = &bitmap.pix32(sy++); + + for (x = ma; x < ma + 80; x++) + { + if (ra < 8) + { + chr = m_video_ram[x & XEROX820_VIDEORAM_MASK] ^ 0x80; + + /* Take care of flashing characters */ + if ((chr < 0x80) && (m_framecnt & 0x08)) + chr |= 0x80; + + /* get pattern of pixels for that character scanline */ + gfx = m_char_rom->base()[(m_ncset2 << 10) | (chr<<3) | ra ]; + } + else + gfx = 0xff; + + /* Display a scanline of a character (7 pixels) */ + *p++ = pen[0]; + *p++ = pen[BIT(gfx, 4) ^ 1]; + *p++ = pen[BIT(gfx, 3) ^ 1]; + *p++ = pen[BIT(gfx, 2) ^ 1]; + *p++ = pen[BIT(gfx, 1) ^ 1]; + *p++ = pen[BIT(gfx, 0) ^ 1]; + *p++ = pen[0]; + } + } + ma+=128; + } + return 0; +} + +/* Machine Initialization */ + +void xerox820_state::machine_start() +{ + // state saving + save_item(NAME(m_scroll)); + save_item(NAME(m_ncset2)); + save_item(NAME(m_vatt)); + save_item(NAME(m_fdc_irq)); + save_item(NAME(m_fdc_drq)); + save_item(NAME(m_8n5)); + save_item(NAME(m_400_460)); +} + +void xerox820_state::machine_reset() +{ + bankswitch(1); + + m_fdc->reset(); +} + +void bigboard_state::machine_reset() +{ + bankswitch(1); + + /* bigboard has a one-pulse output to drive a user-supplied beeper */ + m_beeper->set_state(0); + m_beeper->set_frequency(950); + + m_fdc->reset(); +} + +void xerox820ii_state::machine_reset() +{ + bankswitch(1); + + m_fdc->reset(); +} + + +/* F4 Character Displayer */ +static const gfx_layout xerox820_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static const gfx_layout xerox820_gfxlayout = +{ + 8, 8, /* 8 x 8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( xerox820 ) + GFXDECODE_ENTRY( "chargen", 0x0000, xerox820_charlayout, 0, 1 ) +GFXDECODE_END + +static GFXDECODE_START( xerox820ii ) + GFXDECODE_ENTRY( "chargen", 0x0000, xerox820_charlayout, 0, 1 ) + GFXDECODE_ENTRY( "chargen", 0x0800, xerox820_gfxlayout, 0, 1 ) +GFXDECODE_END + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( xerox820, xerox820_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_20MHz/8) + MCFG_CPU_PROGRAM_MAP(xerox820_mem) + MCFG_CPU_IO_MAP(xerox820_io) + MCFG_CPU_CONFIG(xerox820_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(xerox820_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_10_69425MHz, 700, 0, 560, 260, 0, 240) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", xerox820) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* devices */ + MCFG_DEVICE_ADD(Z80PIO_KB_TAG, Z80PIO, XTAL_20MHz/8) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(xerox820_state, kbpio_pa_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(xerox820_state, kbpio_pa_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(xerox820_state, kbpio_pb_r)) + + MCFG_DEVICE_ADD(Z80PIO_GP_TAG, Z80PIO, XTAL_20MHz/8) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_20MHz/8) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg1)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + //MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(XTAL_20MHz/8)) + + MCFG_FD1771_ADD(FD1771_TAG, XTAL_20MHz/20) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(xerox820_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(xerox820_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(FD1771_TAG":0", xerox820_floppies, "sa400", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1771_TAG":1", xerox820_floppies, "sa400", floppy_image_device::default_floppy_formats) + + MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_20MHz/8, 0, 0, 0, 0) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80sio0_device, rxa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80sio0_device, rxb_w)) + + MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(xerox820_state, fr_w)) + MCFG_COM8116_FT_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, XEROX_820_KEYBOARD, 0) + MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(DEVWRITELINE(Z80PIO_KB_TAG, z80pio_device, strobe_b)) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "xerox820") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( bigboard, xerox820, bigboard_state ) + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) /* bigboard only */ +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( xerox820ii, xerox820ii_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) + MCFG_CPU_PROGRAM_MAP(xerox820ii_mem) + MCFG_CPU_IO_MAP(xerox820ii_io) + MCFG_CPU_CONFIG(xerox820_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(xerox820ii_state, screen_update) + MCFG_SCREEN_RAW_PARAMS(XTAL_10_69425MHz, 700, 0, 560, 260, 0, 240) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", xerox820ii) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* devices */ + MCFG_DEVICE_ADD(Z80PIO_KB_TAG, Z80PIO, XTAL_16MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(READ8(xerox820_state, kbpio_pa_r)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(xerox820_state, kbpio_pa_w)) + MCFG_Z80PIO_IN_PB_CB(READ8(xerox820_state, kbpio_pb_r)) + + MCFG_DEVICE_ADD(Z80PIO_GP_TAG, Z80PIO, XTAL_16MHz/4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD(Z80PIO_RD_TAG, Z80PIO, XTAL_20MHz/8) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(DEVREAD8("sasi_data_in", input_buffer_device, read)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("sasi_data_out", output_latch_device, write)) + MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(xerox820ii_state, rdpio_pardy_w)) + MCFG_Z80PIO_IN_PB_CB(DEVREAD8("sasi_ctrl_in", input_buffer_device, read)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(xerox820ii_state, rdpio_pb_w)) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/4) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg1)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) + //MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(XTAL_16MHz/4)) + + MCFG_FD1797_ADD(FD1797_TAG, XTAL_16MHz/8) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(xerox820_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(xerox820_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":0", xerox820_floppies, "sa450", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":1", xerox820_floppies, "sa450", floppy_image_device::default_floppy_formats) + + MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_16MHz/4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80sio0_device, rxa_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80sio0_device, rxb_w)) + + MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(xerox820_state, fr_w)) + MCFG_COM8116_FT_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) + + MCFG_DEVICE_ADD(KEYBOARD_TAG, XEROX_820_KEYBOARD, 0) + MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(DEVWRITELINE(Z80PIO_KB_TAG, z80pio_device, strobe_b)) + + // SASI bus + MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0) + MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in") + MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit0)) MCFG_DEVCB_XOR(1) + MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit1)) MCFG_DEVCB_XOR(1) + MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit2)) MCFG_DEVCB_XOR(1) + MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) MCFG_DEVCB_XOR(1) + MCFG_SCSI_IO_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) MCFG_DEVCB_XOR(1) + + MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SA1403D, SCSI_ID_0) + + MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG) + MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0) + MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + + // software lists + MCFG_SOFTWARE_LIST_ADD("flop_list", "xerox820ii") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( xerox168, xerox820ii ) + MCFG_CPU_ADD(I8086_TAG, I8086, 4770000) + MCFG_CPU_PROGRAM_MAP(xerox168_mem) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("192K") + MCFG_RAM_EXTRA_OPTIONS("320K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( mk83, xerox820 ) + MCFG_CPU_MODIFY(Z80_TAG) + MCFG_CPU_PROGRAM_MAP(mk83_mem) +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( bigboard ) + ROM_REGION( 0x1000, Z80_TAG, 0 ) + ROM_LOAD( "bigboard.u67", 0x0000, 0x0800, CRC(5a85a228) SHA1(d51a2cbd0aae80315bda9530275aabfe8305364e) ) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "bigboard.u73", 0x0000, 0x0800, CRC(10bf0d81) SHA1(7ec73670a4d9d6421a5d6a4c4edc8b7c87923f6c) ) +ROM_END + +#define rom_mk82 rom_bigboard + +ROM_START( x820 ) + ROM_REGION( 0x1000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "v20" ) + ROM_SYSTEM_BIOS( 0, "v10", "Xerox Monitor v1.0" ) + ROMX_LOAD( "x820v10.u64", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(1) ) + ROMX_LOAD( "x820v10.u63", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v20", "Xerox Monitor v2.0" ) + ROMX_LOAD( "x820v20.u64", 0x0000, 0x0800, CRC(2fc227e2) SHA1(b4ea0ae23d281a687956e8a514cb364a1372678e), ROM_BIOS(2) ) + ROMX_LOAD( "x820v20.u63", 0x0800, 0x0800, CRC(bc11f834) SHA1(4fd2b209a6e6ff9b0c41800eb5228c34a0d7f7ef), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "smart23", "MICROCode SmartROM v2.3" ) + ROMX_LOAD( "mxkx25a.u64", 0x0000, 0x0800, CRC(7ec5f100) SHA1(5d0ff35a51aa18afc0d9c20ef99ff5d9d3f2075b), ROM_BIOS(3) ) + ROMX_LOAD( "mxkx25b.u63", 0x0800, 0x0800, CRC(a7543798) SHA1(886e617e1003d13f86f33085cbd49391b77291a3), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "plus2", "MICROCode Plus2 v0.2a" ) + ROMX_LOAD( "p2x25a.u64", 0x0000, 0x0800, CRC(3ccd7a8f) SHA1(6e46c88f03fc7289595dd6bec95e23bb13969525), ROM_BIOS(4) ) + ROMX_LOAD( "p2x25b.u63", 0x0800, 0x0800, CRC(1e580391) SHA1(e91f8ce82586df33c0d6d02eb005e8079f4de67d), ROM_BIOS(4) ) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "x820.u92", 0x0000, 0x0800, CRC(b823fa98) SHA1(ad0ea346aa257a53ad5701f4201896a2b3a0f928) ) +ROM_END + +ROM_START( x820ii ) + ROM_REGION( 0x2000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "v404" ) + ROM_SYSTEM_BIOS( 0, "v400", "Balcones Operating System v4.00" ) // Initial U.S. 3-ROM set: support for double density disks + ROMX_LOAD( "v400.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(1) ) + ROMX_LOAD( "v400.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(1) ) + ROMX_LOAD( "v400.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v401", "Balcones Operating System v4.01" ) // Corrected overflow problem with large data files + ROMX_LOAD( "v401.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(2) ) + ROMX_LOAD( "v401.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(2) ) + ROMX_LOAD( "v401.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v402", "Balcones Operating System v4.02" ) // Rank Xerox (European) boot ROM version of US 4.01 + ROMX_LOAD( "v402.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(3) ) + ROMX_LOAD( "v402.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(3) ) + ROMX_LOAD( "v402.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 3, "v403", "Balcones Operating System v4.03" ) // Incorporate programmable communications option and support for the low-profile keyboard (4-ROM set and type-ahead input buffer) + ROMX_LOAD( "v403.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(4) ) + ROMX_LOAD( "v403.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(4) ) + ROMX_LOAD( "v403.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(4) ) + ROMX_LOAD( "v403.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 4, "v404", "Balcones Operating System v4.04" ) // Changes sign-on message from Xerox 820-II to Xerox + ROMX_LOAD( "537p3652.u33", 0x0000, 0x0800, CRC(7807cfbb) SHA1(bd3cc5cc5c59c84a50747aae5c17eb4617b0dbc3), ROM_BIOS(5) ) + ROMX_LOAD( "537p3653.u34", 0x0800, 0x0800, CRC(a9c6c0c3) SHA1(c2da9d1bf0da96e6b8bfa722783e411d2fe6deb9), ROM_BIOS(5) ) + ROMX_LOAD( "537p3654.u35", 0x1000, 0x0800, CRC(a8a07223) SHA1(e8ae1ebf2d7caf76771205f577b88ae493836ac9), ROM_BIOS(5) ) + ROMX_LOAD( "v404.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(5) ) // fitted for low-profile keyboard only + ROM_SYSTEM_BIOS( 5, "v50", "Balcones Operating System v5.0" ) // Operating system modifications for DEM and new 5.25" disk controller (4 new boot ROMs) + ROMX_LOAD( "v50.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(6) ) + ROMX_LOAD( "v50.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(6) ) + ROMX_LOAD( "v50.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(6) ) + ROMX_LOAD( "v50.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(6) ) // fitted for low-profile keyboard only + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "x820ii.u57", 0x0000, 0x0800, CRC(1a50f600) SHA1(df4470c80611c14fa7ea8591f741fbbecdfe4fd9) ) + ROM_LOAD( "x820ii.u58", 0x0800, 0x0800, CRC(aca4b9b3) SHA1(77f41470b0151945b8d3c3a935fc66409e9157b3) ) +ROM_END + +ROM_START( x168 ) + ROM_REGION( 0x2000, Z80_TAG, 0 ) + ROM_DEFAULT_BIOS( "v404" ) + ROM_SYSTEM_BIOS( 0, "v404", "Balcones Operating System v4.04" ) // Changes sign-on message from Xerox 820-II to Xerox + ROMX_LOAD( "537p3652.u33", 0x0000, 0x0800, CRC(7807cfbb) SHA1(bd3cc5cc5c59c84a50747aae5c17eb4617b0dbc3), ROM_BIOS(1) ) + ROMX_LOAD( "537p3653.u34", 0x0800, 0x0800, CRC(a9c6c0c3) SHA1(c2da9d1bf0da96e6b8bfa722783e411d2fe6deb9), ROM_BIOS(1) ) + ROMX_LOAD( "537p3654.u35", 0x1000, 0x0800, CRC(a8a07223) SHA1(e8ae1ebf2d7caf76771205f577b88ae493836ac9), ROM_BIOS(1) ) + ROMX_LOAD( "v404.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(1) ) // fitted for low-profile keyboard only + ROM_SYSTEM_BIOS( 1, "v50", "Balcones Operating System v5.0" ) // Operating system modifications for DEM and new 5.25" disk controller (4 new boot ROMs) + ROMX_LOAD( "v50.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(2) ) + ROMX_LOAD( "v50.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(2) ) + ROMX_LOAD( "v50.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(2) ) + ROMX_LOAD( "v50.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(2) ) // fitted for low-profile keyboard only + + ROM_REGION( 0x1000, I8086_TAG, 0 ) + ROM_LOAD( "8086.u33", 0x0000, 0x1000, CRC(ee49e3dc) SHA1(a5f20c74fc53f9d695d8894534ab69a39e2c38d8) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "x820ii.u57", 0x0000, 0x0800, CRC(1a50f600) SHA1(df4470c80611c14fa7ea8591f741fbbecdfe4fd9) ) + ROM_LOAD( "x820ii.u58", 0x0800, 0x0800, CRC(aca4b9b3) SHA1(77f41470b0151945b8d3c3a935fc66409e9157b3) ) +ROM_END + +ROM_START( mk83 ) + ROM_REGION( 0x1000, Z80_TAG, 0 ) + ROM_LOAD( "2732mk83.bin", 0x0000, 0x1000, CRC(a845c7e1) SHA1(3ccf629c5cd384953794ac4a1d2b45678bd40e92) ) + + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "2716mk83.bin", 0x0000, 0x0800, CRC(10bf0d81) SHA1(7ec73670a4d9d6421a5d6a4c4edc8b7c87923f6c) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, bigboard, 0, 0, bigboard, xerox820, driver_device, 0, "Digital Research Computers", "Big Board", 0 ) +COMP( 1981, x820, bigboard, 0, xerox820, xerox820, driver_device, 0, "Xerox", "Xerox 820", MACHINE_NO_SOUND_HW ) +COMP( 1982, mk82, bigboard, 0, bigboard, xerox820, driver_device, 0, "Scomar", "MK-82", 0 ) +COMP( 1983, x820ii, 0, 0, xerox820ii, xerox820, driver_device, 0, "Xerox", "Xerox 820-II", MACHINE_NOT_WORKING ) +COMP( 1983, x168, x820ii, 0, xerox168, xerox820, driver_device, 0, "Xerox", "Xerox 16/8", MACHINE_NOT_WORKING ) +COMP( 1983, mk83, x820ii, 0, mk83, xerox820, driver_device, 0, "Scomar", "MK-83", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/xor100.c b/src/mame/drivers/xor100.c new file mode 100644 index 00000000000..8c2e544c544 --- /dev/null +++ b/src/mame/drivers/xor100.c @@ -0,0 +1,599 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/**************************************************************************************************** + + XOR S-100-12 + +***************************************************************************************************** + + All input must be in upper case. + Summary of Monitor commands: + + D xxxx yyyy = dump memory to screen + F xxxx yyyy zz = fill memory from xxxx to yyyy-1 with zz + G xxxx = execute program at xxxx + H xxxx yyyy aa bb... = Search memory for a string of bytes + L xxxx = edit memory (. to exit) + M xxxx yyyy zzzz = Move (copy) memory + V xxxx = Ascii dump of memory to the screen (cr to continue, space to exit) + X n = Select a bank (0 works, others freeze) + + Note some of the commands are a bit buggy, eg F doesn't fill the last byte + +*****************************************************************************************************/ + +/* + + TODO: + + - cannot boot from floppy (at prompt press ^C, wait, it says 'Drive not ready') + - honor jumper settings + - CTC signal header + - serial printer + - cassette? (no mention of it in the manuals) + +*/ + + +#include "includes/xor100.h" +#include "bus/rs232/rs232.h" + +/* Read/Write Handlers */ + +enum +{ + EPROM_0000 = 0, + EPROM_F800, + EPROM_OFF +}; + +void xor100_state::bankswitch() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + int banks = m_ram->size() / 0x10000; + + switch (m_mode) + { + case EPROM_0000: + if (m_bank < banks) + { + program.install_write_bank(0x0000, 0xffff, "bank1"); + membank("bank1")->set_entry(1 + m_bank); + } + else + { + program.unmap_write(0x0000, 0xffff); + } + + program.install_read_bank(0x0000, 0xf7ff, 0x07ff, 0, "bank2"); + program.install_read_bank(0xf800, 0xffff, "bank3"); + membank("bank2")->set_entry(0); + membank("bank3")->set_entry(0); + break; + + case EPROM_F800: + if (m_bank < banks) + { + program.install_write_bank(0x0000, 0xffff, "bank1"); + program.install_read_bank(0x0000, 0xf7ff, "bank2"); + membank("bank1")->set_entry(1 + m_bank); + membank("bank2")->set_entry(1 + m_bank); + } + else + { + program.unmap_write(0x0000, 0xffff); + program.unmap_read(0x0000, 0xf7ff); + } + + program.install_read_bank(0xf800, 0xffff, "bank3"); + membank("bank3")->set_entry(0); + break; + + case EPROM_OFF: + if (m_bank < banks) + { + program.install_write_bank(0x0000, 0xffff, "bank1"); + program.install_read_bank(0x0000, 0xf7ff, "bank2"); + program.install_read_bank(0xf800, 0xffff, "bank3"); + membank("bank1")->set_entry(1 + m_bank); + membank("bank2")->set_entry(1 + m_bank); + membank("bank3")->set_entry(1 + m_bank); + } + else + { + program.unmap_write(0x0000, 0xffff); + program.unmap_read(0x0000, 0xf7ff); + program.unmap_read(0xf800, 0xffff); + } + break; + } +} + +WRITE8_MEMBER( xor100_state::mmu_w ) +{ + /* + + bit description + + 0 A16 + 1 A17 + 2 A18 + 3 A19 + 4 + 5 + 6 + 7 + + */ + + m_bank = data & 0x07; + + bankswitch(); +} + +WRITE8_MEMBER( xor100_state::prom_toggle_w ) +{ + switch (m_mode) + { + case EPROM_OFF: m_mode = EPROM_F800; break; + case EPROM_F800: m_mode = EPROM_OFF; break; + } + + bankswitch(); +} + +READ8_MEMBER( xor100_state::prom_disable_r ) +{ + m_mode = EPROM_F800; + + bankswitch(); + + return 0xff; +} + +WRITE8_MEMBER( xor100_state::baud_w ) +{ + m_dbrg->str_w(data & 0x0f); + m_dbrg->stt_w(data >> 4); +} + +READ8_MEMBER( xor100_state::fdc_r ) +{ + return m_fdc->gen_r(offset) ^ 0xff; +} + +WRITE8_MEMBER( xor100_state::fdc_w ) +{ + m_fdc->gen_w(offset, data ^ 0xff); +} + +READ8_MEMBER( xor100_state::fdc_wait_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 FDC IRQ + + */ + + if (!space.debugger_access()) + { + if (!m_fdc_irq && !m_fdc_drq) + { + fatalerror("Z80 WAIT not supported by MAME core\n"); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + } + } + + return !m_fdc_irq << 7; +} + +WRITE8_MEMBER( xor100_state::fdc_dcont_w ) +{ + /* + + bit description + + 0 DS0 + 1 DS1 + 2 DS2 + 3 DS3 + 4 + 5 + 6 + 7 _HLSTB + + */ + + // drive select + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) floppy->mon_w(0); +} + +WRITE8_MEMBER( xor100_state::fdc_dsel_w ) +{ + /* + + bit description + + 0 J + 1 K + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + switch (data & 0x03) + { + case 0: break; + case 1: m_fdc_dden = 1; break; + case 2: m_fdc_dden = 0; break; + case 3: m_fdc_dden = !m_fdc_dden; break; + } + + m_fdc->dden_w(m_fdc_dden); +} + +/* Memory Maps */ + +static ADDRESS_MAP_START( xor100_mem, AS_PROGRAM, 8, xor100_state ) + AM_RANGE(0x0000, 0xffff) AM_WRITE_BANK("bank1") + AM_RANGE(0x0000, 0xf7ff) AM_READ_BANK("bank2") + AM_RANGE(0xf800, 0xffff) AM_READ_BANK("bank3") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( xor100_io, AS_IO, 8, xor100_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(I8251_A_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(I8251_A_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x02, 0x02) AM_DEVREADWRITE(I8251_B_TAG, i8251_device, data_r, data_w) + AM_RANGE(0x03, 0x03) AM_DEVREADWRITE(I8251_B_TAG, i8251_device, status_r, control_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) + AM_RANGE(0x08, 0x08) AM_WRITE(mmu_w) + AM_RANGE(0x09, 0x09) AM_WRITE(prom_toggle_w) + AM_RANGE(0x0a, 0x0a) AM_READ(prom_disable_r) + AM_RANGE(0x0b, 0x0b) AM_READ_PORT("DSW0") AM_WRITE(baud_w) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) + AM_RANGE(0xf8, 0xfb) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0xfc, 0xfc) AM_READWRITE(fdc_wait_r, fdc_dcont_w) + AM_RANGE(0xfd, 0xfd) AM_WRITE(fdc_dsel_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( xor100 ) + + PORT_START("DSW0") + PORT_DIPNAME( 0x0f, 0x05, "Serial Port A" ) + PORT_DIPSETTING( 0x00, "50 baud" ) + PORT_DIPSETTING( 0x01, "75 baud" ) + PORT_DIPSETTING( 0x02, "110 baud" ) + PORT_DIPSETTING( 0x03, "134.5 baud" ) + PORT_DIPSETTING( 0x04, "150 baud" ) + PORT_DIPSETTING( 0x05, "300 baud" ) + PORT_DIPSETTING( 0x06, "600 baud" ) + PORT_DIPSETTING( 0x07, "1200 baud" ) + PORT_DIPSETTING( 0x08, "1800 baud" ) + PORT_DIPSETTING( 0x09, "2000 baud" ) + PORT_DIPSETTING( 0x0a, "2400 baud" ) + PORT_DIPSETTING( 0x0b, "3600 baud" ) + PORT_DIPSETTING( 0x0c, "4800 baud" ) + PORT_DIPSETTING( 0x0d, "7200 baud" ) + PORT_DIPSETTING( 0x0e, "9600 baud" ) + PORT_DIPSETTING( 0x0f, "19200 baud" ) + PORT_DIPNAME( 0xf0, 0xe0, "Serial Port B" ) + PORT_DIPSETTING( 0x00, "50 baud" ) + PORT_DIPSETTING( 0x10, "75 baud" ) + PORT_DIPSETTING( 0x20, "110 baud" ) + PORT_DIPSETTING( 0x30, "134.5 baud" ) + PORT_DIPSETTING( 0x40, "150 baud" ) + PORT_DIPSETTING( 0x50, "300 baud" ) + PORT_DIPSETTING( 0x60, "600 baud" ) + PORT_DIPSETTING( 0x70, "1200 baud" ) + PORT_DIPSETTING( 0x80, "1800 baud" ) + PORT_DIPSETTING( 0x90, "2000 baud" ) + PORT_DIPSETTING( 0xa0, "2400 baud" ) + PORT_DIPSETTING( 0xb0, "3600 baud" ) + PORT_DIPSETTING( 0xc0, "4800 baud" ) + PORT_DIPSETTING( 0xd0, "7200 baud" ) + PORT_DIPSETTING( 0xe0, "9600 baud" ) + PORT_DIPSETTING( 0xf0, "19200 baud" ) + + PORT_START("J1") + PORT_CONFNAME( 0x01, 0x01, "J1 Wait State") + PORT_CONFSETTING( 0x00, "No Wait States" ) + PORT_CONFSETTING( 0x01, "1 M1 Wait State" ) + + PORT_START("J2") + PORT_CONFNAME( 0x01, 0x01, "J2 CPU Speed") + PORT_CONFSETTING( 0x00, "2 MHz" ) + PORT_CONFSETTING( 0x01, "4 MHz" ) + + PORT_START("J3") + PORT_CONFNAME( 0x01, 0x00, "J3") + PORT_CONFSETTING( 0x00, "" ) + PORT_CONFSETTING( 0x01, "" ) + + PORT_START("J4-J5") + PORT_CONFNAME( 0x01, 0x01, "J4/J5 EPROM Type") + PORT_CONFSETTING( 0x00, "2708" ) + PORT_CONFSETTING( 0x01, "2716" ) + + PORT_START("J6") + PORT_CONFNAME( 0x01, 0x01, "J6 EPROM") + PORT_CONFSETTING( 0x00, "Disabled" ) + PORT_CONFSETTING( 0x01, "Enabled" ) + + PORT_START("J7") + PORT_CONFNAME( 0x01, 0x00, "J7 I/O Port Addresses") + PORT_CONFSETTING( 0x00, "00-0F" ) + PORT_CONFSETTING( 0x01, "10-1F" ) + + PORT_START("J8") + PORT_CONFNAME( 0x01, 0x00, "J8") + PORT_CONFSETTING( 0x00, "" ) + PORT_CONFSETTING( 0x01, "" ) + + PORT_START("J9") + PORT_CONFNAME( 0x01, 0x01, "J9 Power On RAM") + PORT_CONFSETTING( 0x00, "Enabled" ) + PORT_CONFSETTING( 0x01, "Disabled" ) +INPUT_PORTS_END + +/* COM5016 Interface */ + +WRITE_LINE_MEMBER( xor100_state::com5016_fr_w ) +{ + m_uart_a->write_txc(state); + m_uart_a->write_rxc(state); +} + +WRITE_LINE_MEMBER( xor100_state::com5016_ft_w ) +{ + m_uart_b->write_txc(state); + m_uart_b->write_rxc(state); +} + +/* Printer 8255A Interface */ + +WRITE_LINE_MEMBER( xor100_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER( xor100_state::write_centronics_select ) +{ + m_centronics_select = state; +} + +READ8_MEMBER(xor100_state::i8255_pc_r) +{ + /* + + bit description + + PC0 + PC1 + PC2 + PC3 + PC4 ON LINE + PC5 BUSY + PC6 _ACK + PC7 + + */ + + UINT8 data = 0; + + /* on line */ + data |= m_centronics_select << 4; + + /* busy */ + data |= m_centronics_busy << 5; + + return data; +} + +/* Z80-CTC Interface */ + +WRITE_LINE_MEMBER( xor100_state::ctc_z0_w ) +{ +} + +WRITE_LINE_MEMBER( xor100_state::ctc_z1_w ) +{ +} + +WRITE_LINE_MEMBER( xor100_state::ctc_z2_w ) +{ +} + +/* WD1795-02 Interface */ + +static SLOT_INTERFACE_START( xor100_floppies ) + SLOT_INTERFACE( "8ssdd", FLOPPY_8_SSDD ) // Shugart SA-100 +SLOT_INTERFACE_END + +void xor100_state::fdc_intrq_w(bool state) +{ + m_fdc_irq = state; + m_ctc->trg0(state); + + if (state) + { + fatalerror("Z80 WAIT not supported by MAME core\n"); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + } +} + +void xor100_state::fdc_drq_w(bool state) +{ + m_fdc_drq = state; + + if (state) + { + fatalerror("Z80 WAIT not supported by MAME core\n"); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + } +} + + +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +static SLOT_INTERFACE_START( xor100_s100_cards ) +SLOT_INTERFACE_END + +/* Machine Initialization */ + +void xor100_state::machine_start() +{ + int banks = m_ram->size() / 0x10000; + UINT8 *ram = m_ram->pointer(); + UINT8 *rom = m_rom->base(); + + /* setup memory banking */ + membank("bank1")->configure_entries(1, banks, ram, 0x10000); + membank("bank2")->configure_entry(0, rom); + membank("bank2")->configure_entries(1, banks, ram, 0x10000); + membank("bank3")->configure_entry(0, rom); + membank("bank3")->configure_entries(1, banks, ram + 0xf800, 0x10000); + + machine().save().register_postload(save_prepost_delegate(FUNC(xor100_state::post_load), this)); + + /* register for state saving */ + save_item(NAME(m_mode)); + save_item(NAME(m_bank)); + save_item(NAME(m_fdc_irq)); + save_item(NAME(m_fdc_drq)); + save_item(NAME(m_fdc_dden)); + save_item(NAME(m_centronics_busy)); + save_item(NAME(m_centronics_select)); +} + +void xor100_state::machine_reset() +{ + m_mode = EPROM_0000; + + bankswitch(); +} + +void xor100_state::post_load() +{ + bankswitch(); +} + +/* Machine Driver */ + +static MACHINE_CONFIG_START( xor100, xor100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) + MCFG_CPU_PROGRAM_MAP(xor100_mem) + MCFG_CPU_IO_MAP(xor100_io) + + /* devices */ + MCFG_DEVICE_ADD(I8251_A_TAG, I8251, 0/*XTAL_8MHz/2,*/) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_A_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_A_TAG, i8251_device, write_dsr)) + + MCFG_DEVICE_ADD(I8251_B_TAG, I8251, 0/*XTAL_8MHz/2,*/) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_B_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_B_TAG, i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) + + MCFG_DEVICE_ADD(COM5016_TAG, COM8116, XTAL_5_0688MHz) + MCFG_COM8116_FR_HANDLER(WRITELINE(xor100_state, com5016_fr_w)) + MCFG_COM8116_FT_HANDLER(WRITELINE(xor100_state, com5016_ft_w)) + + MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) + MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_I8255_OUT_PORTB_CB(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) + MCFG_I8255_IN_PORTC_CB(READ8(xor100_state, i8255_pc_r)) + + MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_8MHz/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(xor100_state, ctc_z0_w)) + MCFG_Z80CTC_ZC1_CB(WRITELINE(xor100_state, ctc_z1_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(xor100_state, ctc_z2_w)) + + MCFG_FD1795_ADD(WD1795_TAG, XTAL_8MHz/4) + MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":0", xor100_floppies, "8ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":1", xor100_floppies, "8ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":2", xor100_floppies, NULL, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":3", xor100_floppies, NULL, floppy_image_device::default_floppy_formats) + + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(I8255A_TAG, i8255_device, pc4_w)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(xor100_state, write_centronics_busy)) + MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(xor100_state, write_centronics_select)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + // S-100 + MCFG_S100_BUS_ADD() + MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) + MCFG_S100_SLOT_ADD("s100_1", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_2", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_3", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_4", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_5", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_6", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_7", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_8", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_9", xor100_s100_cards, NULL) + MCFG_S100_SLOT_ADD("s100_10", xor100_s100_cards, NULL) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("64K") + MCFG_RAM_EXTRA_OPTIONS("128K,192K,256K,320K,384K,448K,512K") +MACHINE_CONFIG_END + +/* ROMs */ + +ROM_START( xor100 ) + ROM_REGION( 0x800, Z80_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "v185", "v1.85" ) + ROMX_LOAD( "xp 185.8b", 0x000, 0x800, CRC(0d0bda8d) SHA1(11c83f7cd7e6a570641b44a2f2cc5737a7dd8ae3), ROM_BIOS(1) ) +ROM_END + +/* System Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, xor100, 0, 0, xor100, xor100, driver_device, 0, "Xor Data Science", "XOR S-100-12", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/ymmu100.c b/src/mame/drivers/ymmu100.c new file mode 100644 index 00000000000..2273fdb827a --- /dev/null +++ b/src/mame/drivers/ymmu100.c @@ -0,0 +1,499 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont, Olivier Galibert +/************************************************************************************* + + Yamaha MU-100 : 32-voice polyphonic/multitimbral General MIDI/GS/XG tone module + Preliminary driver by R. Belmont and O. Galibert + + CPU: Hitachi H8S/2655 (HD6432655F), strapped for mode 4 (24-bit address, 16-bit data, no internal ROM) + Sound ASIC: Yamaha XS725A0 + RAM: 1 MSM51008 (1 meg * 1 bit = 128KBytes) + + I/O ports from service manual: + + Port 1: + 0 - LCD data, SW data, LED 1 + 1 - LCD data, SW data, LED 2 + 2 - LCD data, SW data, LED 3 + 3 - LCD data, SW data, LED 4 + 4 - LCD data, SW data, LED 5 + 5 - LCD data, SW strobe data + 6 - LCD data, SW strobe data + 7 - LCD data, SW data, LED 6 + + Port 2: + 0 - (out) LCD control RS + 1 - (out) LCD control R/W + 2 - (out) LCD control E + 3 - (out) LCD contrast A + 4 - (out) LCD contrast B + 5 - (out) LCD contrast C + 6 - (out) 1 MHz clock for serial + 7 - NC + + Port 3: + 4 - (out) A/D gain control 1 + 5 - (out) A/D gain control 2 + + Port 5: + 3 - (out) Reset signal for rotary encoder + + Port 6: + 1 - NC + 2 - (out) PB select (SW1) + 3 - (out) PB select (SW2) + 4 - (out) reset PB + 5 - (out) reset SWP30 (sound chip) + 6 - NC + 7 - (in) Plug detection for A/D input + + Port A: + 5 - (in) Off Line Detection + 6 - (out) Signal for rotary encoder (REB) + 7 - (out) Signal for rotary encoder (REA) + + Port F: + 0 - (out) (sws) LED,SW Strobe data latch + 1 - (out) (swd) SW data read control + 2 - (out) PB select (SW4) + + Port G: + 0 - (out) PB select (SW3) + + Analog input channels: + 0 - level input R + 2 - level output L + 4 - host SW type switch position + 6 - battery voltage + 7 - model check (0 for MU100, 0.5 for OEM, 1 for MU100R) + + Switch map at the connector (17=ground) + 09 8 play + 10 8 edit + 11 8 mute/solo + 12 8 part - + 13 8 part + + 14 8 util + 15 8 effect + 16 8 enter + 12 7 select < + 13 7 select > + 16 7 mode + 15 7 eq + 14 7 exit + 10 7 value - + 11 7 value + + 2 led play + 3 led edit + 4 led util + 5 led effect + 6 led mode + 1 led eq + + IC32: + 1 p10 c.2 + 2 p11 c.3 + 3 p12 c.4 + 4 p13 c.5 + 5 p14 c.6 + 6 p15 c.7 + 7 p16 c.8 + 8 p17 c.1 + g sws + + IC33 + 1 p17 c.09 + 2 p16 c.10 + 3 p15 c.11 + 4 p14 c.12 + 5 p13 c.13 + 6 p12 c.14 + 7 p11 c.15 + 8 p10 c.16 + g swd + +**************************************************************************************/ + +#include "emu.h" +#include "debugger.h" +#include "cpu/h8/h8s2655.h" +#include "video/hd44780.h" +#include "rendlay.h" +#include "bus/midi/midiinport.h" +#include "bus/midi/midioutport.h" + +static INPUT_PORTS_START( mu100 ) + PORT_START("P7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Effect") PORT_CODE(KEYCODE_F) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Util") PORT_CODE(KEYCODE_U) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part +") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part -") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mute/Solo") PORT_CODE(KEYCODE_S) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Edit") PORT_CODE(KEYCODE_E) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Play") PORT_CODE(KEYCODE_A) + + PORT_START("P8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mode") PORT_CODE(KEYCODE_M) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Eq") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Exit") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select >") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select <") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Value +") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Value -") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +class mu100_state : public driver_device +{ +public: + enum { + P2_LCD_RS = 0x01, + P2_LCD_RW = 0x02, + P2_LCD_ENABLE = 0x04 + }; + + mu100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_lcd(*this, "lcd"), + m_ioport_p7(*this, "P7"), + m_ioport_p8(*this, "P8") + { } + + required_device m_maincpu; + required_device m_lcd; + required_ioport m_ioport_p7; + required_ioport m_ioport_p8; + + UINT8 cur_p1, cur_p2, cur_p3, cur_p5, cur_p6, cur_pa, cur_pf, cur_pg; + UINT8 cur_ic32; + float contrast; + + DECLARE_READ16_MEMBER(adc0_r); + DECLARE_READ16_MEMBER(adc2_r); + DECLARE_READ16_MEMBER(adc4_r); + DECLARE_READ16_MEMBER(adc6_r); + virtual DECLARE_READ16_MEMBER(adc7_r); + + DECLARE_WRITE16_MEMBER(p1_w); + DECLARE_READ16_MEMBER(p1_r); + DECLARE_WRITE16_MEMBER(p2_w); + DECLARE_WRITE16_MEMBER(p3_w); + DECLARE_WRITE16_MEMBER(p5_w); + DECLARE_WRITE16_MEMBER(p6_w); + DECLARE_READ16_MEMBER(p6_r); + DECLARE_WRITE16_MEMBER(pa_w); + DECLARE_READ16_MEMBER(pa_r); + DECLARE_WRITE16_MEMBER(pf_w); + DECLARE_WRITE16_MEMBER(pg_w); + + DECLARE_READ16_MEMBER(snd_r); + DECLARE_WRITE16_MEMBER(snd_w); + + float lightlevel(const UINT8 *src, const UINT8 *render); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + virtual void machine_start(); +}; + +class mu100r_state : public mu100_state { +public: + mu100r_state(const machine_config &mconfig, device_type type, const char *tag) + : mu100_state(mconfig, type, tag) + { } + + virtual DECLARE_READ16_MEMBER(adc7_r); +}; + +#include "../drivers/ymmu100.inc" + +void mu100_state::machine_start() +{ + cur_p1 = cur_p2 = cur_p3 = cur_p5 = cur_p6 = cur_pa = cur_pf = cur_pg = cur_ic32 = 0xff; + contrast = 1.0; +} + +float mu100_state::lightlevel(const UINT8 *src, const UINT8 *render) +{ + UINT8 l = *src; + if(l == 0) + return 1.0; + int slot = (src[1] << 8) | src[2]; + if(slot >= 0xff00) + return (255-l)/255.0; + + int bit = slot & 7; + int adr = (slot >> 3); + if(render[adr] & (1 << bit)) + return 1-(1-(255-l)/255.0f)*contrast; + return 0.95f; +} + +UINT32 mu100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const UINT8 *render = m_lcd->render(); + const UINT8 *src = ymmu100_bkg + 15; + + for(int y=0; y<241; y++) { + UINT32 *pix = reinterpret_cast(bitmap.raw_pixptr(y)); + for(int x=0; x<800; x++) { + float light = lightlevel(src, render); + UINT32 col = (int(0xef*light) << 16) | (int(0xf5*light) << 8); + *pix++ = col; + src += 3; + } + for(int x=800; x<900; x++) + *pix++ = 0; + } + + for(int i=0; i<6; i++) + if(cur_ic32 & (1 << (i == 5 ? 7 : i))) { + int x = 830 + 40*(i & 1); + int y = 55 + 65*(i >> 1); + for(int yy=-9; yy <= 9; yy++) { + int dx = int(sqrt((float)(99-yy*yy))); + UINT32 *pix = reinterpret_cast(bitmap.raw_pixptr(y+yy)) + (x-dx); + for(int xx=0; xx<2*dx+1; xx++) + *pix++ = 0x00ff00; + } + } + return 0; +} + +static ADDRESS_MAP_START( mu100_map, AS_PROGRAM, 16, mu100_state ) + AM_RANGE(0x000000, 0x1fffff) AM_ROM AM_REGION("maincpu", 0) + AM_RANGE(0x200000, 0x21ffff) AM_RAM // 128K work RAM + AM_RANGE(0x400000, 0x401fff) AM_READWRITE(snd_r, snd_w) +ADDRESS_MAP_END + +READ16_MEMBER(mu100_state::snd_r) +{ + int chan = (offset >> 6) & 0x3f; + int slot = offset & 0x3f; + logerror("snd_r %02x.%02x (%06x)\n", chan, slot, m_maincpu->pc()); + return 0x0000; +} + +WRITE16_MEMBER(mu100_state::snd_w) +{ + int chan = (offset >> 6) & 0x3f; + int slot = offset & 0x3f; + logerror("snd_w %02x.%02x, %04x (%06x)\n", chan, slot, data, m_maincpu->pc()); +} + +READ16_MEMBER(mu100_state::adc0_r) +{ + logerror("adc0_r\n"); + return 0; +} + +READ16_MEMBER(mu100_state::adc2_r) +{ + logerror("adc2_r\n"); + return 0; +} + +// Put the host switch to pure midi +READ16_MEMBER(mu100_state::adc4_r) +{ + return 0; +} + +// Battery level +READ16_MEMBER(mu100_state::adc6_r) +{ + logerror("adc6_r\n"); + return 0x3ff; +} + +// model detect. pulled to GND (0) on MU100, to 0.5Vcc on the card version, to Vcc on MU100R +READ16_MEMBER(mu100_state::adc7_r) +{ + return 0; +} + +READ16_MEMBER(mu100r_state::adc7_r) +{ + return 0x3ff; +} + +WRITE16_MEMBER(mu100_state::p1_w) +{ + cur_p1 = data; +} + +READ16_MEMBER(mu100_state::p1_r) +{ + if((cur_p2 & P2_LCD_ENABLE)) { + if(cur_p2 & P2_LCD_RW) { + if(cur_p2 & P2_LCD_RS) + return m_lcd->data_read(space, offset); + else + return m_lcd->control_read(space, offset); + } else + return 0x00; + } + + if(!(cur_pf & 0x02)) { + UINT8 val = 0xff; + if(!(cur_ic32 & 0x20)) + val &= m_ioport_p7->read(); + if(!(cur_ic32 & 0x40)) + val &= m_ioport_p8->read(); + return val; + } + + return 0xff; +} + +WRITE16_MEMBER(mu100_state::p2_w) +{ + // LCB enable edge + if(!(cur_p2 & P2_LCD_ENABLE) && (data & P2_LCD_ENABLE)) { + if(!(cur_p2 & P2_LCD_RW)) { + if(cur_p2 & P2_LCD_RS) + m_lcd->data_write(space, offset, cur_p1); + else + m_lcd->control_write(space, offset, cur_p1); + } + } + contrast = (8 - ((cur_p2 >> 3) & 7))/8.0; + cur_p2 = data; +} + +WRITE16_MEMBER(mu100_state::p3_w) +{ + cur_p3 = data; + logerror("A/D gain control %d\n", (data >> 4) & 3); +} + +WRITE16_MEMBER(mu100_state::p5_w) +{ + cur_p5 = data; + logerror("Rotary reset %d\n", (data >> 3) & 1); +} + +WRITE16_MEMBER(mu100_state::p6_w) +{ + cur_p6 = data; + logerror("pbsel %d pbreset %d soundreset %d\n", (data >> 2) & 3, (data >> 4) & 1, (data >> 5) & 1); +} + +READ16_MEMBER(mu100_state::p6_r) +{ + logerror("plug in detect read\n"); + return 0x00; +} + +WRITE16_MEMBER(mu100_state::pa_w) +{ + cur_pa = data; + logerror("rotary encoder %d\n", (data >> 6) & 3); +} + +READ16_MEMBER(mu100_state::pa_r) +{ + logerror("offline detect read\n"); + return 0x00; +} + +WRITE16_MEMBER(mu100_state::pf_w) +{ + if(!(cur_pf & 0x01) && (data & 0x01)) + cur_ic32 = cur_p1; + cur_pf = data; +} + +WRITE16_MEMBER(mu100_state::pg_w) +{ + cur_pg = data; + logerror("pbsel3 %d\n", data & 1); +} + +static ADDRESS_MAP_START( mu100_iomap, AS_IO, 16, mu100_state ) + AM_RANGE(h8_device::PORT_1, h8_device::PORT_1) AM_READWRITE(p1_r, p1_w) + AM_RANGE(h8_device::PORT_2, h8_device::PORT_2) AM_WRITE(p2_w) + AM_RANGE(h8_device::PORT_3, h8_device::PORT_3) AM_WRITE(p3_w) + AM_RANGE(h8_device::PORT_5, h8_device::PORT_5) AM_WRITE(p5_w) + AM_RANGE(h8_device::PORT_6, h8_device::PORT_6) AM_READWRITE(p6_r, p6_w) + AM_RANGE(h8_device::PORT_A, h8_device::PORT_A) AM_READWRITE(pa_r, pa_w) + AM_RANGE(h8_device::PORT_F, h8_device::PORT_F) AM_WRITE(pf_w) + AM_RANGE(h8_device::PORT_G, h8_device::PORT_G) AM_WRITE(pg_w) + AM_RANGE(h8_device::ADC_0, h8_device::ADC_0) AM_READ(adc0_r) + AM_RANGE(h8_device::ADC_2, h8_device::ADC_2) AM_READ(adc2_r) + AM_RANGE(h8_device::ADC_4, h8_device::ADC_4) AM_READ(adc4_r) + AM_RANGE(h8_device::ADC_6, h8_device::ADC_6) AM_READ(adc6_r) + AM_RANGE(h8_device::ADC_7, h8_device::ADC_7) AM_READ(adc7_r) +ADDRESS_MAP_END + +static MACHINE_CONFIG_START( mu100, mu100_state ) + MCFG_CPU_ADD( "maincpu", H8S2655, XTAL_16MHz ) + MCFG_CPU_PROGRAM_MAP( mu100_map ) + MCFG_CPU_IO_MAP( mu100_iomap ) + + MCFG_HD44780_ADD("lcd") + MCFG_HD44780_LCD_SIZE(4, 20) + + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate, asynchronous updating anyway */ + MCFG_SCREEN_UPDATE_DRIVER(mu100_state, screen_update) + MCFG_SCREEN_SIZE(900, 241) + MCFG_SCREEN_VISIBLE_AREA(0, 899, 0, 240) + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE("maincpu:sci0", h8_sci_device, rx_w)) + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + MCFG_DEVICE_MODIFY("maincpu:sci0") + MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE(":mdout", midi_port_device, write_txd)) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED_CLASS( mu100r, mu100, mu100r_state ) +MACHINE_CONFIG_END + +#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \ + ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios+1)) /* Note '+1' */ + +ROM_START( mu100 ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "bios0", "xu50720 (v1.11, Aug. 3, 1999)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 0, "xu50720.ic11", 0x000000, 0x200000, CRC(1126a8a4) SHA1(e90b8bd9d14297da26ba12f4d9a4f2d22cd7d34a) ) + ROM_SYSTEM_BIOS( 1, "bios1", "xt71420 (v1.05, Sep. 19, 1997)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 1, "xt71420.ic11", 0x000000, 0x200000, CRC(0e5b3bae) SHA1(3148c5bd59a3d00809d3ab1921216215fe2582c5) ) + + ROM_REGION( 0x2800000, "waverom", 0 ) + ROM_LOAD32_WORD( "sx518b0.ic34", 0x000000, 0x400000, CRC(2550d44f) SHA1(fd3cce228c7d389a2fde25c808a5b26080588cba) ) + ROM_LOAD32_WORD( "sx743b0.ic35", 0x000002, 0x400000, CRC(a9109a6c) SHA1(a67bb49378a38a2d809bd717d286e18bc6496db0) ) + ROM_LOAD32_WORD( "xt445a0-828.ic36", 0x800000, 0x1000000, CRC(d4483a43) SHA1(5bfd0762dea8598eda19db20251dac20e31fa02c) ) + ROM_LOAD32_WORD( "xt461a0-829.ic37", 0x800002, 0x1000000, CRC(c5af4501) SHA1(1c88de197c36382311053add8b19a5740802cb78) ) + + ROM_REGION( 0x1000, "lcd", 0) + // Hand made, 3 characters unused + ROM_LOAD( "mu100-font.bin", 0x0000, 0x1000, BAD_DUMP CRC(a7d6c1d6) SHA1(9f0398d678bdf607cb34d83ee535f3b7fcc97c41) ) +ROM_END + +// Identical to the mu100 +ROM_START( mu100r ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_SYSTEM_BIOS( 0, "bios0", "xu50720 (v1.11, Aug. 3, 1999)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 0, "xu50720.ic11", 0x000000, 0x200000, CRC(1126a8a4) SHA1(e90b8bd9d14297da26ba12f4d9a4f2d22cd7d34a) ) + ROM_SYSTEM_BIOS( 1, "bios1", "xt71420 (v1.05, Sep. 19, 1997)" ) + ROM_LOAD16_WORD_SWAP_BIOS( 1, "xt71420.ic11", 0x000000, 0x200000, CRC(0e5b3bae) SHA1(3148c5bd59a3d00809d3ab1921216215fe2582c5) ) + + ROM_REGION( 0x2800000, "waverom", 0 ) + ROM_LOAD32_WORD( "sx518b0.ic34", 0x000000, 0x400000, CRC(2550d44f) SHA1(fd3cce228c7d389a2fde25c808a5b26080588cba) ) + ROM_LOAD32_WORD( "sx743b0.ic35", 0x000002, 0x400000, CRC(a9109a6c) SHA1(a67bb49378a38a2d809bd717d286e18bc6496db0) ) + ROM_LOAD32_WORD( "xt445a0-828.ic36", 0x800000, 0x1000000, CRC(d4483a43) SHA1(5bfd0762dea8598eda19db20251dac20e31fa02c) ) + ROM_LOAD32_WORD( "xt461a0-829.ic37", 0x800002, 0x1000000, CRC(c5af4501) SHA1(1c88de197c36382311053add8b19a5740802cb78) ) + + ROM_REGION( 0x1000, "lcd", 0) + // Hand made, 3 characters unused + ROM_LOAD( "mu100-font.bin", 0x0000, 0x1000, BAD_DUMP CRC(a7d6c1d6) SHA1(9f0398d678bdf607cb34d83ee535f3b7fcc97c41) ) +ROM_END + +CONS( 1997, mu100, 0, 0, mu100, mu100, driver_device, 0, "Yamaha", "MU100", MACHINE_NOT_WORKING ) +CONS( 1997, mu100r, mu100, 0, mu100r, mu100, driver_device, 0, "Yamaha", "MU100 Rackable version", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/ymmu100.ppm b/src/mame/drivers/ymmu100.ppm new file mode 100644 index 00000000000..7a826314f7e Binary files /dev/null and b/src/mame/drivers/ymmu100.ppm differ diff --git a/src/mame/drivers/z100.c b/src/mame/drivers/z100.c new file mode 100644 index 00000000000..016c86b4334 --- /dev/null +++ b/src/mame/drivers/z100.c @@ -0,0 +1,731 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + Zenith Z-100 + + 15/07/2011 Skeleton driver. + + Commands: + Press H to list all the commands. + + TODO: + - remove parity check IRQ patch (understand what it really wants there!) + - implement S-100 bus features; + - irqs needs 8259 "auto-ack"-ing in order to work properly; + - vertical scrolling isn't understood; + +============================================================================ + +Z207A EQU 0B0H ; Z-207 disk controller base port + ; (See DEFZ207 to program controller) +Z217A EQU 0AEH ; Z-217 disk controller base port + ; (See DEFZ217 to program controller) +ZGRNSEG EQU 0E000H ; Segment of green video plane +ZREDSEG EQU 0D000H ; Segment of red video plane +ZBLUSEG EQU 0C000H ; Segment of blue video plane +ZVIDEO EQU 0D8H ; Video 68A21 port + ; PA0 -> enable red display + ; PA1 -> enable green display + ; PA2 -> enable blue display + ; PA3 -> not flash screen + ; PA4 -> not write multiple red + ; PA5 -> not write multiple green + ; PA6 -> not write multiple blue + ; PA7 -> disable video RAM + ; PB7-PB0 -> LA15-LA8 + ; CA1 - not used + ; CA2 -> clear screen + ; CB1 - not used + ; CB2 -> value to write (0 or 1) on clear screen + ; (see DEF6821 to program the 6821) +ZCRTC EQU 0DCH ; Video 6845 CRT-C port + ; (see DEF6845 to program the 6845) +ZLPEN EQU 0DEH ; Light pen latch + ZLPEN_BIT EQU 00000111B ; Bit hit by pen + ZLPEN_ROW EQU 11110000B ; Row hit by pen +ZPIA EQU 0E0H ; Parallel printer plus light pen and + ; video vertical retrace 68A21 port + ; PA0 -> PDATA1 + ; PA1 -> PDATA2 + ; PA2 -> not STROBE + ; PA3 -> not INIT + ; PA4 <- VSYNC + ; PA5 -> clear VSYNC flip flop + ; PA6 <- light pen switch + ; PA7 -> clear light pen flip flop + ; PB0 <- BUSY + ; PB1 <- not ERROR + ; PB2 -> PDATA3 + ; PB3 -> PDATA4 + ; PB4 -> PDATA5 + ; PB5 -> PDATA6 + ; PB6 -> PDATA7 + ; PB7 -> PDATA8 + ; CA1 <- light pen hit (from flip flop) + ; CA2 <- VSYNC (from flip flop) + ; CB1 <- not ACKNLG + ; CB2 <- BUSY + ; (See DEF6821 to program the PIA) +ZTIMER EQU 0E4H ; Timer 8253 port + ZTIMEVAL EQU 2500 ; 100ms divide by N value + ; (See DEF8253 to program the 8253) +ZTIMERS EQU 0FBH ; Timer interrupt status port + ZTIMERS0 EQU 001H ; Timer 0 interrupt + ZTIMERS2 EQU 002H ; Timer 2 interrupt +ZSERA EQU 0E8H ; First 2661-2 serial port +ZSERB EQU 0ECH ; Second 2661-2 serial port + ; (See DEFEP2 to program 2661-2) +ZM8259A EQU 0F2H ; Master 8259A interrupt controller port + ZINTEI EQU 0 ; Parity error or S-100 pin 98 interrupt + ZINTPS EQU 1 ; Processor swap interrupt + ZINTTIM EQU 2 ; Timer interrupt + ZINTSLV EQU 3 ; Slave 8259A interrupt + ZINTSA EQU 4 ; Serial port A interrupt + ZINTSB EQU 5 ; Serial port B interrupt + ZINTKD EQU 6 ; Keyboard, Display, or Light pen interrupt + ZINTPP EQU 7 ; Parallel port interrupt + ; (See DEF8259A to program the 8259A) + ZM8259AI EQU 64 ; Base interrupt number for master +ZS8259A EQU 0F0H ; Secondary 8259A interrupt controller port + ZS8259AI EQU 72 ; Base interrupt number for slave + BIOSAI EQU ZS8259AI+8 ; Base of BIOS generated interrupts +ZKEYBRD EQU 0F4H ; Keyboard port + ZKEYBRDD EQU ZKEYBRD+0 ; Keyboard data port + ZKEYBRDC EQU ZKEYBRD+1 ; Keyboard command port + ZKEYRES EQU 0 ; Reset command + ZKEYARD EQU 1 ; Autorepeat on command + ZKEYARF EQU 2 ; Autorepeat off command + ZKEYKCO EQU 3 ; Key click on command + ZKEYKCF EQU 4 ; Key click off command + ZKEYCF EQU 5 ; Clear keyboard FIFO command + ZKEYCLK EQU 6 ; Generate a click sound command + ZKEYBEP EQU 7 ; Generate a beep sound command + ZKEYEK EQU 8 ; Enable keyboard command + ZKEYDK EQU 9 ; Disable keyboard command + ZKEYUDM EQU 10 ; Enter UP/DOWN mode command + ZKEYNSM EQU 11 ; Enter normal scan mode command + ZKEYEI EQU 12 ; Enable keyboard interrupts command + ZKEYDI EQU 13 ; Disable keyboard interrupts command + ZKEYBRDS EQU ZKEYBRD+1 ; Keyboard status port + ZKEYOBF EQU 001H ; Output buffer not empty + ZKEYIBF EQU 002H ; Input buffer full +ZMCL EQU 0FCH ; Memory control latch + ZMCLMS EQU 00000011B ; Map select mask + ZSM0 EQU 0 ; Map select 0 + ZSM1 EQU 1 ; Map select 1 + ZSM2 EQU 2 ; Map select 2 + ZSM3 EQU 3 ; Map select 3 + ZMCLRM EQU 00001100B ; Monitor ROM mapping mask + ZRM0 EQU 0*4 ; Power up mode - ROM everywhere on reads + ZRM1 EQU 1*4 ; ROM at top of every 64K page + ZRM2 EQU 2*4 ; ROM at top of 8088's addr space + ZRM3 EQU 3*4 ; Disable ROM + ZMCLPZ EQU 00010000B ; 0=Set Parity to the zero state + ZMCLPK EQU 00100000B ; 0=Disable parity checking circuity + ZMCLPF EQU 01000000B ; 0=Disable parity error flag +Z205BA EQU 098H ; Base address for Z-205 boards + Z205BMC EQU 8 ; Maximum of 8 Z-205 boards installed +ZHAL EQU 0FDH ; Hi-address latch + ZHAL85 EQU 0FFH ; 8085 Mask + ZHAL88 EQU 0F0H ; 8088 Mask +ZPSP EQU 0FEH ; Processor swap port + ZPSPPS EQU 10000000B ; Processor select (0=8085, 1=8088) + ZPSPPS5 EQU 00000000B ; Select 8085 + ZPSPPS8 EQU 10000000B ; Select 8088 + ZPSPSI EQU 00000010B ; Generate interrupt on swapping + ZPSPI8 EQU 00000001B ; 8088 processes all interrupts +ZDIPSW EQU 0FFH ; Configuration dip switches + ZDIPSWBOOT EQU 00000111B ; Boot device field + ZDIPSWAB EQU 00001000B ; 1=Auto boot(0=Manual boot) + ZDIPSWRES EQU 01110000B ; Reserved + ZDIPSWHZ EQU 10000000B ; 1=50Hz(0=60HZ) + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "video/mc6845.h" +#include "machine/pic8259.h" +#include "machine/6821pia.h" +#include "machine/wd_fdc.h" +#include "imagedev/flopdrv.h" + +class z100_state : public driver_device +{ +public: + z100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pia0(*this, "pia0"), + m_pia1(*this, "pia1"), + m_picm(*this, "pic8259_master"), + m_pics(*this, "pic8259_slave"), + m_fdc(*this, "z207_fdc"), + m_floppy0(*this, "z207_fdc:0"), + m_floppy1(*this, "z207_fdc:1"), + m_floppy2(*this, "z207_fdc:2"), + m_floppy3(*this, "z207_fdc:3"), + m_crtc(*this, "crtc"), + m_palette(*this, "palette"), + m_floppy(NULL) + { } + + required_device m_maincpu; + required_device m_pia0; + required_device m_pia1; + required_device m_picm; + required_device m_pics; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_device m_crtc; + required_device m_palette; + + DECLARE_READ8_MEMBER(z100_vram_r); + DECLARE_WRITE8_MEMBER(z100_vram_w); + DECLARE_READ8_MEMBER(keyb_data_r); + DECLARE_READ8_MEMBER(keyb_status_r); + DECLARE_WRITE8_MEMBER(keyb_command_w); + DECLARE_WRITE8_MEMBER(z100_6845_address_w); + DECLARE_WRITE8_MEMBER(z100_6845_data_w); + DECLARE_WRITE8_MEMBER(floppy_select_w); + DECLARE_WRITE8_MEMBER(floppy_motor_w); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE8_MEMBER(video_pia_A_w); + DECLARE_WRITE8_MEMBER(video_pia_B_w); + DECLARE_WRITE_LINE_MEMBER(video_pia_CA2_w); + DECLARE_WRITE_LINE_MEMBER(video_pia_CB2_w); + UINT8 *m_gvram; + UINT8 m_keyb_press,m_keyb_status; + UINT8 m_vram_enable; + UINT8 m_gbank; + UINT8 m_display_mask; + UINT8 m_flash; + UINT8 m_clr_val; + UINT8 m_crtc_vreg[0x100],m_crtc_index; + UINT16 m_start_addr; + + floppy_image_device *m_floppy; + + mc6845_device *m_mc6845; + DECLARE_DRIVER_INIT(z100); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_z100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); +}; + +#define mc6845_h_char_total (m_crtc_vreg[0]) +#define mc6845_h_display (m_crtc_vreg[1]) +#define mc6845_h_sync_pos (m_crtc_vreg[2]) +#define mc6845_sync_width (m_crtc_vreg[3]) +#define mc6845_v_char_total (m_crtc_vreg[4]) +#define mc6845_v_total_adj (m_crtc_vreg[5]) +#define mc6845_v_display (m_crtc_vreg[6]) +#define mc6845_v_sync_pos (m_crtc_vreg[7]) +#define mc6845_mode_ctrl (m_crtc_vreg[8]) +#define mc6845_tile_height (m_crtc_vreg[9]+1) +#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) +#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) +#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0xff00) | (m_crtc_vreg[0x0d] & 0xff)) +#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0xff00) | (m_crtc_vreg[0x0f] & 0xff)) +#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0xff00) | (m_crtc_vreg[0x11] & 0xff)) +#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0xff00) | (m_crtc_vreg[0x13] & 0xff)) + + +void z100_state::video_start() +{ + m_gvram = auto_alloc_array_clear(machine(), UINT8, 0x30000); +} + +UINT32 z100_state::screen_update_z100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,xi,yi; + int dot; + int i; + + bitmap.fill(0, cliprect); + + for(y=0;y> (7-xi)) & 1) << i; // b, r, g + + dot &= m_display_mask; + + /* overwrite */ + if(m_flash) + dot = m_display_mask; + + if(y*mc6845_tile_height+yi < 216 && x*8+xi < 640) /* TODO: safety check */ + bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(dot); + } + } + } + } + + return 0; +} + +READ8_MEMBER( z100_state::z100_vram_r ) +{ + return m_gvram[offset]; +} + +WRITE8_MEMBER( z100_state::z100_vram_w ) +{ + if(m_vram_enable) + { + int i; + + m_gvram[offset] = data; + + for(i=0;i<3;i++) + { + if(m_gbank & (1 << i)) + m_gvram[((offset) & 0xffff)+0x10000*i] = data; + } + } +} + +static ADDRESS_MAP_START(z100_mem, AS_PROGRAM, 8, z100_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00000,0x3ffff) AM_RAM // 128*2 KB RAM +// AM_RANGE(0xb0000,0xbffff) AM_ROM // expansion ROM + AM_RANGE(0xc0000,0xeffff) AM_READWRITE(z100_vram_r,z100_vram_w) // Blue / Red / Green +// AM_RANGE(0xf0000,0xf0fff) // network card (NET-100) +// AM_RANGE(0xf4000,0xf7fff) // MTRET-100 Firmware I expansion ROM +// AM_RANGE(0xf8000,0xfbfff) // MTRET-100 Firmware II expansion ROM check ID 0x4550 + AM_RANGE(0xfc000,0xfffff) AM_ROM AM_REGION("ipl", 0) +ADDRESS_MAP_END + +READ8_MEMBER( z100_state::keyb_data_r ) +{ + if(m_keyb_press) + { + UINT8 res; + + res = m_keyb_press; + + m_keyb_press = 0; + return res; + } + + return m_keyb_press; +} + +READ8_MEMBER( z100_state::keyb_status_r ) +{ + if(m_keyb_status) + { + m_keyb_status = 0; + return 1; + } + + return m_keyb_status; +} + +WRITE8_MEMBER( z100_state::keyb_command_w ) +{ + // ... +} + +WRITE8_MEMBER( z100_state::z100_6845_address_w ) +{ + data &= 0x1f; + m_crtc_index = data; + m_crtc->address_w( space, offset, data ); +} + +WRITE8_MEMBER( z100_state::z100_6845_data_w ) +{ + m_crtc_vreg[m_crtc_index] = data; + m_crtc->register_w(space, offset, data); +} + +// todo: side select? + +WRITE8_MEMBER( z100_state::floppy_select_w ) +{ + switch (data & 0x03) + { + case 0: m_floppy = m_floppy0->get_device(); break; + case 1: m_floppy = m_floppy1->get_device(); break; + case 2: m_floppy = m_floppy2->get_device(); break; + case 3: m_floppy = m_floppy3->get_device(); break; + } + + m_fdc->set_floppy(m_floppy); +} + +WRITE8_MEMBER( z100_state::floppy_motor_w ) +{ + if (m_floppy) + m_floppy->mon_w(!BIT(data, 1)); +} + +static ADDRESS_MAP_START(z100_io, AS_IO, 8, z100_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) +// AM_RANGE (0x00, 0x3f) reserved for non-ZDS vendors +// AM_RANGE (0x40, 0x5f) secondary Multiport card (Z-204) +// AM_RANGE (0x60, 0x7f) primary Multiport card (Z-204) +// AM_RANGE (0x80, 0x83) development board +// AM_RANGE (0x98, 0x9f) Z-205 expansion memory boards +// AM_RANGE (0xa0, 0xa3) network card (NET-100) +// AM_RANGE (0xa4, 0xa7) gateway (reserved) +// AM_RANGE (0xac, 0xad) Z-217 secondary disk controller (winchester) +// AM_RANGE (0xae, 0xaf) Z-217 primary disk controller (winchester) + AM_RANGE (0xb0, 0xb3) AM_DEVREADWRITE("z207_fdc", fd1797_t, read, write) + AM_RANGE (0xb4, 0xb4) AM_WRITE(floppy_select_w) + AM_RANGE (0xb5, 0xb5) AM_WRITE(floppy_motor_w) +// z-207 secondary disk controller (wd1797) +// AM_RANGE (0xcd, 0xce) ET-100 CRT Controller +// AM_RANGE (0xd4, 0xd7) ET-100 Trainer Parallel I/O + AM_RANGE (0xd8, 0xdb) AM_DEVREADWRITE("pia0", pia6821_device, read, write) //video board + AM_RANGE (0xdc, 0xdc) AM_WRITE(z100_6845_address_w) + AM_RANGE (0xdd, 0xdd) AM_WRITE(z100_6845_data_w) +// AM_RANGE (0xde, 0xde) light pen + AM_RANGE (0xe0, 0xe3) AM_DEVREADWRITE("pia1", pia6821_device, read, write) //main board +// AM_RANGE (0xe4, 0xe7) 8253 PIT +// AM_RANGE (0xe8, 0xeb) First 2661-2 serial port (printer) +// AM_RANGE (0xec, 0xef) Second 2661-2 serial port (modem) + AM_RANGE (0xf0, 0xf1) AM_DEVREADWRITE("pic8259_slave", pic8259_device, read, write) + AM_RANGE (0xf2, 0xf3) AM_DEVREADWRITE("pic8259_master", pic8259_device, read, write) + AM_RANGE (0xf4, 0xf4) AM_READ(keyb_data_r) // -> 8041 MCU + AM_RANGE (0xf5, 0xf5) AM_READWRITE(keyb_status_r,keyb_command_w) +// AM_RANGE (0xf6, 0xf6) expansion ROM is present (bit 0, active low) +// AM_RANGE (0xfb, 0xfb) timer irq status +// AM_RANGE (0xfc, 0xfc) memory latch +// AM_RANGE (0xfd, 0xfd) Hi-address latch +// AM_RANGE (0xfe, 0xfe) Processor swap port + AM_RANGE (0xff, 0xff) AM_READ_PORT("DSW101") +ADDRESS_MAP_END + +INPUT_CHANGED_MEMBER(z100_state::key_stroke) +{ + if(newval && !oldval) + { + /* TODO: table */ + m_keyb_press = (UINT8)(FPTR)(param) & 0xff; + //pic8259_ir6_w(m_picm, 1); + m_keyb_status = 1; + } + + if(oldval && !newval) + { + m_keyb_press = 0; + m_keyb_status = 0; + } +} + +/* Input ports */ +INPUT_PORTS_START( z100 ) + PORT_START("KEY0") // 0x00 - 0x07 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x01) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x02) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x03) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x04) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x05) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x06) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x07) + + PORT_START("KEY1") // 0x08 - 0x0f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x08) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x09) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0f) + + PORT_START("KEY2") // 0x10 - 0x17 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x10) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x11) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x12) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x13) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x14) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x15) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x16) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x17) + + PORT_START("KEY3") // 0x18 - 0x1f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x18) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x19) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1f) + + PORT_START("KEY4") // 0x20 - 0x27 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x20) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x21) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x22) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x23) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x24) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x25) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x26) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x27) + + PORT_START("KEY5") // 0x28 - 0x2f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x28) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x29) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2f) + + PORT_START("KEY6") // 0x30 - 0x37 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_IMPULSE(1) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x30) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x31) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x32) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x33) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x34) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x35) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x36) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x37) + + PORT_START("KEY7") // 0x38 - 0x3f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x38) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x39) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3f) + + PORT_START("KEY8") // 0x40 - 0x47 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x60) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x61) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x62) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x63) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x64) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x65) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x66) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x67) + + PORT_START("KEY9") // 0x48 - 0x4f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x68) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x69) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6f) + + PORT_START("KEYA") // 0x50 - 0x57 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x70) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x71) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x72) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x73) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x74) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x75) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x76) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x77) + + PORT_START("KEYB") // 0x58 - 0x5f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x78) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x79) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DELETE key") PORT_CODE(KEYCODE_DEL) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7f) + + PORT_START("KEYC") // 0x58 - 0x5f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HELP key") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x95) + + PORT_START("DSW101") + PORT_DIPNAME( 0x07, 0x00, "Default Auto-boot Device" ) + PORT_DIPSETTING( 0x00, "0" ) + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x03, "3" ) + PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x05, "5" ) + PORT_DIPSETTING( 0x06, "6" ) + PORT_DIPSETTING( 0x07, "7" ) + PORT_DIPNAME( 0x08, 0x08, "Auto-boot" ) + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) // Reserved + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) // Reserved + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) // Reserved + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, "Monitor" ) + PORT_DIPSETTING( 0x80, "PAL 50 Hz" ) + PORT_DIPSETTING( 0x00, "NTSC 60 Hz" ) + + PORT_START("CONFIG") + PORT_CONFNAME( 0x01, 0x01, "Video Board" ) + PORT_CONFSETTING( 0x00, "Monochrome" ) + PORT_CONFSETTING( 0x01, "Color" ) +INPUT_PORTS_END + +READ8_MEMBER( z100_state::get_slave_ack ) +{ + if (offset==7) { // IRQ = 7 + return m_pics->acknowledge(); + } + return 0; +} + +WRITE8_MEMBER( z100_state::video_pia_A_w ) +{ + /* + all bits are active low + x--- ---- -> disable video RAM + -x-- ---- -> not write multiple blue + --x- ---- -> not write multiple green + ---x ---- -> not write multiple red + ---- x--- -> not flash screen + ---- -x-- -> enable blue display + ---- --x- -> enable green display + ---- ---x -> enable red display + */ + + m_vram_enable = ((data & 0x80) >> 7) ^ 1; + m_gbank = BITSWAP8(((data & 0x70) >> 4) ^ 0x7,7,6,5,4,3,1,0,2); + m_flash = ((data & 8) >> 3) ^ 1; + m_display_mask = BITSWAP8((data & 7) ^ 7,7,6,5,4,3,1,0,2); +} + +WRITE8_MEMBER( z100_state::video_pia_B_w ) +{ + m_start_addr = data << 4; //<- TODO +} + +/* clear screen */ +WRITE_LINE_MEMBER( z100_state::video_pia_CA2_w ) +{ + int i; + + for(i=0; i<0x30000; i++) + m_gvram[i] = m_clr_val; +} + +WRITE_LINE_MEMBER( z100_state::video_pia_CB2_w ) +{ + m_clr_val = (state & 1) ? 0x00 : 0xff; +} + +void z100_state::machine_start() +{ + m_mc6845 = machine().device("crtc"); +} + +void z100_state::machine_reset() +{ + int i; + + if(ioport("CONFIG")->read() & 1) + { + for(i=0;i<8;i++) + m_palette->set_pen_color(i,pal1bit(i >> 1),pal1bit(i >> 2),pal1bit(i >> 0)); + } + else + { + for(i=0;i<8;i++) + m_palette->set_pen_color(i,pal3bit(0),pal3bit(i),pal3bit(0)); + } +} + +static SLOT_INTERFACE_START( z100_floppies ) + SLOT_INTERFACE("dd", FLOPPY_525_DD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( z100, z100_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",I8088, XTAL_14_31818MHz/3) + MCFG_CPU_PROGRAM_MAP(z100_mem) + MCFG_CPU_IO_MAP(z100_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DRIVER(z100_state, screen_update_z100) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8) + + /* devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_14_31818MHz/8) /* unknown clock, hand tuned to get ~50/~60 fps */ + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + + MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(z100_state, get_slave_ack) ) + MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir3_w), GND, NULL ) + + MCFG_DEVICE_ADD("pia0", PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(z100_state, video_pia_A_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(z100_state, video_pia_B_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(z100_state, video_pia_CA2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(z100_state, video_pia_CB2_w)) + + MCFG_DEVICE_ADD("pia1", PIA6821, 0) + + MCFG_FD1797_ADD("z207_fdc", XTAL_1MHz) + + MCFG_FLOPPY_DRIVE_ADD("z207_fdc:0", z100_floppies, "dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("z207_fdc:1", z100_floppies, "dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("z207_fdc:2", z100_floppies, "", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("z207_fdc:3", z100_floppies, "", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( z100 ) + ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) + ROM_LOAD( "intel-d27128-1.bin", 0x0000, 0x4000, CRC(b21f0392) SHA1(69e492891cceb143a685315efe0752981a2d8143)) + + ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) //8041 + ROM_LOAD( "mcu", 0x0000, 0x1000, NO_DUMP ) +ROM_END + +DRIVER_INIT_MEMBER(z100_state,z100) +{ + UINT8 *ROM = memregion("ipl")->base(); + + ROM[0xfc116 & 0x3fff] = 0x90; // patch parity IRQ check + ROM[0xfc117 & 0x3fff] = 0x90; + + ROM[0xfc0d4 & 0x3fff] = 0x75; // patch checksum +} + + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, z100, 0, 0, z100, z100, z100_state, z100, "Zenith", "Z-100", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/z1013.c b/src/mame/drivers/z1013.c new file mode 100644 index 00000000000..6c22545ed7b --- /dev/null +++ b/src/mame/drivers/z1013.c @@ -0,0 +1,468 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + Z1013 driver by Miodrag Milanovic + + 22/04/2009 Preliminary driver. + +The 8x4 keyboard contains letters A-W, enter, cursor right/left, space, and +4 shift keys. +S1 - X-Z, numbers +S2 - a-w +S3 - x-z, punctuation +S4 - control keys + +Control Keys: +G - Graphics +A - Alpha +T - clear screen +U - enter +P - cursor left +Q - cursor right + +Monitor commands (debug) +R - registers +B - breakpoint +E - execute +G - resume after breakpoint +N - single-step + +Monitor commands (general) +H - switch to hex keyboard (H to Q become 0 to 9) +A - switch back to normal alpha keyboard +C - Compare memory blocks +D - Dump memory +F - Find bytes in memory +T - Copy memory block +M - Modify bytes (; to exit) +I - reboot +J - Jump to address +K - Fill memory (K by itself fills all of memory) +L - Load Cassette +S - Save Cassette +W - window (example: W EF00 EFFF) + +Due to no input checking, misuse of commands can crash the system. + + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80pio.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" + + +class z1013_state : public driver_device +{ +public: + z1013_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cass(*this, "cassette"), + m_p_videoram(*this, "videoram"){ } + + required_device m_maincpu; + required_device m_cass; + DECLARE_WRITE8_MEMBER(z1013_keyboard_w); + DECLARE_READ8_MEMBER(port_b_r); + DECLARE_WRITE8_MEMBER(port_b_w); + DECLARE_READ8_MEMBER(k7659_port_b_r); + required_shared_ptr m_p_videoram; + const UINT8 *m_p_chargen; + UINT8 m_keyboard_line; + bool m_keyboard_part; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_z1013(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_SNAPSHOT_LOAD_MEMBER( z1013 ); +}; + + +/* Address maps */ +static ADDRESS_MAP_START(z1013_mem, AS_PROGRAM, 8, z1013_state) + AM_RANGE( 0x0000, 0xebff ) AM_RAM + AM_RANGE( 0xec00, 0xefff ) AM_RAM AM_SHARE("videoram") + AM_RANGE( 0xf000, 0xffff ) AM_ROM // ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(z1013_io, AS_IO, 8, z1013_state) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) + AM_RANGE( 0x08, 0x08 ) AM_WRITE(z1013_keyboard_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( z1013_8x4 ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_LSHIFT) + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S2") PORT_CODE(KEYCODE_LCONTROL) + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S3") PORT_CODE(KEYCODE_RSHIFT) + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S4") PORT_CODE(KEYCODE_RCONTROL) + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER) +INPUT_PORTS_END + +static INPUT_PORTS_START( z1013_8x8 ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS) + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) +INPUT_PORTS_END + +static INPUT_PORTS_START( z1013 ) +INPUT_PORTS_END + + +void z1013_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 z1013_state::screen_update_z1013(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 32; y++) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma+32; x++) + { + chr = m_p_videoram[x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<3) | ra]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=32; + } + return 0; +} + +void z1013_state::machine_reset() +{ + m_maincpu->set_state_int(Z80_PC, 0xF000); + m_keyboard_part = 0; + m_keyboard_line = 0; +} + +WRITE8_MEMBER( z1013_state::z1013_keyboard_w ) +{ + m_keyboard_line = data; +} + +READ8_MEMBER( z1013_state::port_b_r ) +{ + char kbdrow[6]; + sprintf(kbdrow,"X%d", m_keyboard_line & 7); + UINT8 data = ioport(kbdrow)->read(); + + if (m_keyboard_part) + data >>= 4; + + data &= 0x0f; + + if (m_cass->input() > 0.03) + data |= 0x40; + + return data; +} + +WRITE8_MEMBER( z1013_state::port_b_w ) +{ + m_keyboard_part = BIT(data, 4); // for z1013a2 only + m_cass->output(BIT(data, 7) ? -1.0 : +1.0); +} + +READ8_MEMBER( z1013_state::k7659_port_b_r ) +{ + return 0xff; +} + +SNAPSHOT_LOAD_MEMBER( z1013_state, z1013 ) +{ +/* header layout +0000,0001 - load address +0002,0003 - end address +0004,0005 - exec address +0006-000B - unknown +000C - Filetype (appears B=Basic, C=Machine Language, I=?, could be more) +000D-000F - bytes D3, D3, D3 +0010-001F - Filename +0020 up - Program to load +*/ + + UINT8* data= auto_alloc_array(machine(), UINT8, snapshot_size); + UINT16 startaddr,endaddr,runaddr; + + image.fread( data, snapshot_size); + + startaddr = data[0] + data[1]*256; + endaddr = data[2] + data[3]*256; + runaddr = data[4] + data[5]*256; + + if ((data[13]==data[14]) && (data[14]==data[15])) + { } + else + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Not a Z1013 image"); + image.message(" Not a Z1013 image"); + return IMAGE_INIT_FAIL; + } + + memcpy (m_maincpu->space(AS_PROGRAM).get_read_ptr(startaddr), + data+0x20, endaddr - startaddr + 1); + + if (runaddr) + m_maincpu->set_state_int(Z80_PC, runaddr); + else + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Loaded but cannot run"); + image.message(" Loaded but cannot run"); + } + + return IMAGE_INIT_PASS; +} + +/* F4 Character Displayer */ +static const gfx_layout z1013_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 512, /* 2 x 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +static GFXDECODE_START( z1013 ) + GFXDECODE_ENTRY( "chargen", 0x0000, z1013_charlayout, 0, 1 ) +GFXDECODE_END + +/* Machine driver */ +static MACHINE_CONFIG_START( z1013, z1013_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_1MHz ) + MCFG_CPU_PROGRAM_MAP(z1013_mem) + MCFG_CPU_IO_MAP(z1013_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 32*8-1) + MCFG_SCREEN_UPDATE_DRIVER(z1013_state, screen_update_z1013) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", z1013) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + /* devices */ + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_1MHz) + MCFG_Z80PIO_IN_PB_CB(READ8(z1013_state, port_b_r)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(z1013_state, port_b_w)) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_SNAPSHOT_ADD("snapshot", z1013_state, z1013, "z80", 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( z1013k76, z1013 ) + MCFG_DEVICE_REMOVE("z80pio") + MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_1MHz) + MCFG_Z80PIO_IN_PB_CB(READ8(z1013_state, k7659_port_b_r)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( z1013 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "202", "Original" ) + ROMX_LOAD( "mon_202.bin", 0xf000, 0x0800, CRC(5884edab) SHA1(c3a45ea5cc4da2b7c270068ba1e2d75916960709), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "jm", "Jens Muller version" ) + ROMX_LOAD( "mon_jm_1992.bin", 0xf000, 0x0800, CRC(186d2888) SHA1(b52ccb557c41c96bace7db4c4f5031a0cd736168), ROM_BIOS(2)) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) + ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) +ROM_END + +ROM_START( z1013a2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mon_a2.bin", 0xf000, 0x0800, CRC(98b19b10) SHA1(97e158f589198cb96aae1567ee0aa6e47824027e)) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) + ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) +ROM_END + +ROM_START( z1013k76 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "mon_rb_k7659.bin", 0xf000, 0x1000, CRC(b3d88c45) SHA1(0bcd20338cf0706b384f40901b7f8498c6f6c320)) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) + ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) + + ROM_REGION(0x1000, "k7659",0) + ROM_LOAD ("k7659n.bin", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) +ROM_END + +ROM_START( z1013s60 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) + ROMX_LOAD( "mon_rb_s6009.bin", 0xf000, 0x1000, CRC(b37faeed) SHA1(ce2e69af5378d39284e8b3be23da50416a0b0fbe), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) + ROMX_LOAD( "4k-moni-k7652.bin", 0xf000, 0x1000, CRC(a1625fce) SHA1(f0847399502b38a73ad26b38ee2d85ba04ab85ec), ROM_BIOS(2)) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) + ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) +ROM_END + +ROM_START( z1013k69 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "4k-moni-k7669.bin", 0xf000, 0x1000, CRC(09cd2a7a) SHA1(0b8500320d464469868a6b48db31105f34710c41)) + + ROM_REGION(0x1000, "chargen",0) + ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) + ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) +ROM_END +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1985, z1013, 0, 0, z1013, z1013_8x4, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (matrix 8x4)", 0 ) +COMP( 1985, z1013a2, z1013, 0, z1013, z1013_8x8, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (matrix 8x8)", 0 ) +COMP( 1985, z1013k76, z1013, 0, z1013k76, z1013, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (K7659)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1985, z1013s60, z1013, 0, z1013k76, z1013_8x8, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (K7652/S6009)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1985, z1013k69, z1013, 0, z1013k76, z1013, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (K7669)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/z80dev.c b/src/mame/drivers/z80dev.c new file mode 100644 index 00000000000..aa9377a2ca1 --- /dev/null +++ b/src/mame/drivers/z80dev.c @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Z80 dev board (unknown) + + http://retro.hansotten.nl/index.php?page=z80-dev-kit + + 23/04/2010 Skeleton driver. + +Pasting: + 0-F : as is + MEM --> (inc) : ^ + MEM <-- (dec) : V + GO : X + To set an address, paste R0
, so R01040 to select 1040 + +Example paste: R01040^11^22^33^44^55^66^77^88^99^^R01040^ +Press the up-arrow key to confirm data has been entered. + + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "z80dev.lh" + +class z80dev_state : public driver_device +{ +public: + z80dev_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + required_device m_maincpu; + DECLARE_WRITE8_MEMBER( display_w ); + DECLARE_READ8_MEMBER( test_r ); +}; + +WRITE8_MEMBER( z80dev_state::display_w ) +{ + // ---- xxxx digit + // xxxx ---- ??? + static const UINT8 hex_7seg[] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71}; + + output_set_digit_value(offset, hex_7seg[data&0x0f]); +} + +READ8_MEMBER( z80dev_state::test_r ) +{ + return space.machine().rand(); +} + +static ADDRESS_MAP_START(z80dev_mem, AS_PROGRAM, 8, z80dev_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x07ff) AM_ROM + AM_RANGE(0x1000, 0x10ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80dev_io , AS_IO, 8, z80dev_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK (0xff) + AM_RANGE(0x20, 0x20) AM_READ_PORT("LINE0") + AM_RANGE(0x21, 0x21) AM_READ_PORT("LINE1") + AM_RANGE(0x22, 0x22) AM_READ_PORT("LINE2") + AM_RANGE(0x23, 0x23) AM_READ_PORT("LINE3") + AM_RANGE(0x20, 0x25) AM_WRITE(display_w) + + AM_RANGE(0x13, 0x13) AM_READ(test_r) +ADDRESS_MAP_END + +/* Input ports */ +INPUT_PORTS_START( z80dev ) + PORT_START("LINE0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_T) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BK") PORT_CODE(KEYCODE_K) + PORT_START("LINE1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEM <--") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEM -->") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') + PORT_START("LINE2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MV") PORT_CODE(KEYCODE_M) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EI") PORT_CODE(KEYCODE_I) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I/O") PORT_CODE(KEYCODE_O) + PORT_START("LINE3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SV") PORT_CODE(KEYCODE_S) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LD") PORT_CODE(KEYCODE_L) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( z80dev, z80dev_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) + MCFG_CPU_PROGRAM_MAP(z80dev_mem) + MCFG_CPU_IO_MAP(z80dev_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_z80dev) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( z80dev ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "z80dev.bin", 0x0000, 0x0800, CRC(dd5b9cd9) SHA1(97c176fcb63674f0592851b7858cb706886b5857)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 198?, z80dev, 0, 0, z80dev, z80dev, driver_device, 0, "", "Z80 dev board", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/z80ne.c b/src/mame/drivers/z80ne.c new file mode 100644 index 00000000000..1c0fcd7851f --- /dev/null +++ b/src/mame/drivers/z80ne.c @@ -0,0 +1,601 @@ +// license:BSD-3-Clause +// copyright-holders:Roberto Lavarone +/****************************************************************************** + Nuova Elettronica Z80NE system driver + + Preliminary driver + + Roberto Lavarone, 2009-01-05 + + Thanks go to: + Roberto Bazzano: www.z80ne.com + + Z80NE memory map + + LX.382 CPU board + range short description + 0000-03FF RAM + 8000-83FF EPROM firmware + + LX.383 HEX keyboard and display controller for LX.384 hex keyboard and display + range short description + F0-F7 I/O 7-segment LED dual-port RAM write + F0 I/O keyboard read + F8 I/O enable single step for next instruction + + LX.385 Cassette interface + range short description + EE I/O UART Data Read/Write + EF I/O UART Status/Control - Cassette Tape Control + + LX.392 32K Memory expansion board + range short description + + + LX.389 Printer Interface + range short description + 02-03 + 06-07 + 0A-0B + 0E-0F + 12-13 + 16-17 + 1A-1B + 1E-1F + + LX.548 16K Basic eprom + range short description + 0000-3FFF EPROM firmware + + LX.388 Video Interface + range short description + EC00-EDFF RAM + EA I/O keyboard + EB I/O video retrace + + LX.529 Graphics Video and Printer Interface + range short description + 80 I/O PIO 0 port A data (ram 0) + 81 I/O PIO 0 port A control (ram 0) + 82 I/O PIO 0 port B data (printer) + 83 I/O PIO 0 port B control (printer) + 84 I/O PIO 1 port A data (ram 1) + 85 I/O PIO 1 port A control (ram 1) + 86 I/O PIO 1 port B data (keyboard) + 87 I/O PIO 1 port B control (keyboard) + 88 I/O PIO 2 port A data (ram 2) + 89 I/O PIO 2 port A control (ram 2) + 8A I/O PIO 2 port B data (printer busy + 40/80 video chars) + 8B I/O PIO 2 port B control (printer busy + 40/40 video chars) + 8C I/O SY6845 address and status register + 8D I/O SY6845 data register + 8E I/O RAM 3 character attribute + 8F I/O beeper + + LX.390 Floppy Interface + range short description + F000-F3FF EPROM firmware + D0 I/O command/status register + D1 I/O trace register + D2 I/O sector register + D3 I/O data register (write only if controller idle) + D6 I/O drive select / drive side one select + D7 I/O data register (write always) + + LX.394-395 EPROM Programmer + range short description + 9000-9FFF EPROM EPROM to be written + 8400-8FFF EPROM firmware + + +******************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "cpu/z80/z80.h" +#include "includes/z80ne.h" +#include "imagedev/flopdrv.h" +#include "formats/dmk_dsk.h" +#include "machine/ram.h" + +/* Layout */ +#include "z80ne.lh" +#include "z80net.lh" +#include "z80netb.lh" +#include "z80netf.lh" + + +/****************************************************************************** + Memory Maps +******************************************************************************/ + + +/* LX.382 CPU Board RAM */ +/* LX.382 CPU Board EPROM */ +static ADDRESS_MAP_START( z80ne_mem, AS_PROGRAM, 8, z80ne_state ) + AM_RANGE( 0x0000, 0x03ff ) AM_RAMBANK("bank1") + AM_RANGE( 0x0400, 0x7fff ) AM_RAM + AM_RANGE( 0x8000, 0x83ff ) AM_ROMBANK("bank2") + AM_RANGE( 0x8400, 0xffff ) AM_READNOP AM_WRITENOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80net_mem, AS_PROGRAM, 8, z80ne_state ) + AM_RANGE( 0x0000, 0x03ff ) AM_RAMBANK("bank1") + AM_RANGE( 0x0400, 0x7fff ) AM_RAM + AM_RANGE( 0x8000, 0x83ff ) AM_ROMBANK("bank2") + AM_RANGE( 0x8400, 0xebff ) AM_RAM + AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_SHARE("videoram") /* (6847) */ + AM_RANGE( 0xee00, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80netb_mem, AS_PROGRAM, 8, z80ne_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_ROM + AM_RANGE( 0x4000, 0xebff ) AM_RAM + AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_SHARE("videoram") /* (6847) */ + AM_RANGE( 0xee00, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80ne_io, AS_IO, 8, z80ne_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xee, 0xee) AM_READWRITE(lx385_data_r, lx385_data_w ) + AM_RANGE(0xef, 0xef) AM_READWRITE(lx385_ctrl_r, lx385_ctrl_w ) + AM_RANGE(0xf0, 0xff) AM_READWRITE(lx383_r, lx383_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80net_io, AS_IO, 8, z80ne_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xea, 0xea) AM_READ(lx388_data_r ) + AM_RANGE(0xeb, 0xeb) AM_READ(lx388_read_field_sync ) + AM_RANGE(0xee, 0xee) AM_READWRITE(lx385_data_r, lx385_data_w ) + AM_RANGE(0xef, 0xef) AM_READWRITE(lx385_ctrl_r, lx385_ctrl_w ) + AM_RANGE(0xf0, 0xff) AM_READWRITE(lx383_r, lx383_w ) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80netf_mem, AS_PROGRAM, 8, z80ne_state ) + AM_RANGE( 0x0000, 0x03ff ) AM_RAMBANK("bank1") + AM_RANGE( 0x0400, 0x3fff ) AM_RAMBANK("bank2") + AM_RANGE( 0x4000, 0x7fff ) AM_RAM + AM_RANGE( 0x8000, 0x83ff ) AM_RAMBANK("bank3") + AM_RANGE( 0x8400, 0xdfff ) AM_RAM + AM_RANGE( 0xe000, 0xebff ) AM_READNOP AM_WRITENOP + AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_SHARE("videoram") /* (6847) */ + AM_RANGE( 0xee00, 0xefff ) AM_READNOP AM_WRITENOP + AM_RANGE( 0xf000, 0xf3ff ) AM_RAMBANK("bank4") + AM_RANGE( 0xf400, 0xffff ) AM_READNOP AM_WRITENOP +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80netf_io, AS_IO, 8, z80ne_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0xd0, 0xd7) AM_READWRITE(lx390_fdc_r, lx390_fdc_w) + AM_RANGE(0xea, 0xea) AM_READ(lx388_data_r ) + AM_RANGE(0xeb, 0xeb) AM_READ(lx388_read_field_sync ) + AM_RANGE(0xee, 0xee) AM_READWRITE(lx385_data_r, lx385_data_w ) + AM_RANGE(0xef, 0xef) AM_READWRITE(lx385_ctrl_r, lx385_ctrl_w ) + AM_RANGE(0xf0, 0xff) AM_READWRITE(lx383_r, lx383_w ) +ADDRESS_MAP_END + + + +/****************************************************************************** + Input Ports +******************************************************************************/ + + +static INPUT_PORTS_START( z80ne ) +/* LX.384 Hex Keyboard and Display */ +/* + * In natural mode the CTRL key is mapped on shift + */ +PORT_START("ROW0") /* IN0 keys row 0 */ +PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 0") PORT_CODE(KEYCODE_0) //PORT_CHAR('0') PORT_CHAR('=') +PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 1") PORT_CODE(KEYCODE_1) //PORT_CHAR('1') PORT_CHAR('!') +PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 2") PORT_CODE(KEYCODE_2) //PORT_CHAR('2') PORT_CHAR('"') +PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 3") PORT_CODE(KEYCODE_3) //PORT_CHAR('3') PORT_CHAR(0x00a3) // ?? +PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 4") PORT_CODE(KEYCODE_4) //PORT_CHAR('4') PORT_CHAR('$') +PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 5") PORT_CODE(KEYCODE_5) //PORT_CHAR('5') PORT_CHAR('%') +PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 6") PORT_CODE(KEYCODE_6) //PORT_CHAR('6') PORT_CHAR('&') +PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 7") PORT_CODE(KEYCODE_7) //PORT_CHAR('7') PORT_CHAR('/') + +PORT_START("ROW1") /* IN1 keys row 1 */ +PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 8") PORT_CODE(KEYCODE_8) //PORT_CHAR('8') PORT_CHAR('(') +PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 9") PORT_CODE(KEYCODE_9) //PORT_CHAR('9') PORT_CHAR(')') +PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 A") PORT_CODE(KEYCODE_A) //PORT_CHAR('a') PORT_CHAR('A') +PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 B") PORT_CODE(KEYCODE_B) //PORT_CHAR('b') PORT_CHAR('B') +PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 C") PORT_CODE(KEYCODE_C) //PORT_CHAR('c') PORT_CHAR('C') +PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 D") PORT_CODE(KEYCODE_D) //PORT_CHAR('d') PORT_CHAR('D') +PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 E") PORT_CODE(KEYCODE_E) //PORT_CHAR('e') PORT_CHAR('E') +PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 F") PORT_CODE(KEYCODE_F) //PORT_CHAR('f') PORT_CHAR('F') + +PORT_START("CTRL") /* CONTROL key */ +PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) +PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) +PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) //PORT_CHAR(UCHAR_SHIFT_1) +PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) +PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) +PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) +PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + +PORT_START("RST") /* RESET key */ +PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, z80ne_state, z80ne_reset, NULL) + +/* Settings */ +PORT_START("LX.385") +PORT_CONFNAME(0x07, 0x01 , "LX.385 Cassette: P1,P3 Data Rate") +PORT_CONFSETTING( 0x01, "A-B: 300 bps") +PORT_CONFSETTING( 0x02, "A-C: 600 bps") +PORT_CONFSETTING( 0x04, "A-D: 1200 bps") +PORT_CONFNAME( 0x08, 0x00, "LX.385: P4 Parity Check") +PORT_CONFSETTING( 0x00, "Parity Check Enabled") +PORT_CONFSETTING( 0x08, "Parity Check Disabled") + +INPUT_PORTS_END + + +static INPUT_PORTS_START( z80net ) + +PORT_INCLUDE( z80ne ) + +/* LX.388 Keyboard BREAK key */ +PORT_START("LX388_BRK") +PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHANGED_MEMBER(DEVICE_SELF, z80ne_state, z80ne_nmi, NULL) + +/* LX.388 Keyboard (Encoded by KR2376) */ + +PORT_START("X0") +PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED ) + +PORT_START("X1") +PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED ) + + +PORT_START("X2") +PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') +PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') +PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('_') + +PORT_START("X3") +PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') +PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') +PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') +PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('`') PORT_CHAR('@') +PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_NAME("Del") +PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') +PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') +PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_NAME("CR") +PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(10) PORT_NAME("LF") +PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED ) + +PORT_START("X4") +PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') +PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') +PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') +PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') +PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') +PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') +PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') +PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') +PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') +PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') +PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + +PORT_START("X5") +PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') +PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') +PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') +PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') +PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('c') PORT_CHAR('G') +PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') +PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') +PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') +PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') +PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED ) +PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + +PORT_START("X6") +PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') +PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') +PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') +PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') +PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') +PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') +PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') +PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') +PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + +PORT_START("X7") +PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') +PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') +PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') +PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') +PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') +PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') +PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') +PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') +PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') +PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') +PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + +PORT_START("MODIFIERS") +PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) +PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + +INPUT_PORTS_END + + +static INPUT_PORTS_START( z80netf ) + +PORT_INCLUDE( z80net ) + +/* Settings */ +PORT_START("CONFIG") +PORT_CONFNAME(0x07, 0x01, "Boot EPROM") +PORT_CONFSETTING( 0x01, "EP382 Hex Monitor") +PORT_CONFSETTING( 0x02, "EP548 16k BASIC") +PORT_CONFSETTING( 0x03, "EP390 Boot Loader for 5.5k floppy BASIC") +PORT_CONFSETTING( 0x04, "EP1390 Boot Loader for NE DOS 1.0/1.5") +PORT_CONFSETTING( 0x05, "EP2390 Boot Loader for NE DOS G.1") +PORT_BIT(0xf8, 0xf8, IPT_UNUSED) + +INPUT_PORTS_END + + + + +/****************************************************************************** + Machine Drivers +******************************************************************************/ +#if 0 +static const UINT32 lx388palette[] = +{ + rgb_t(0x00, 0xff, 0x00), /* GREEN */ + rgb_t(0x00, 0xff, 0x00), /* YELLOW in original, here GREEN */ + rgb_t(0x00, 0x00, 0xff), /* BLUE */ + rgb_t(0xff, 0x00, 0x00), /* RED */ + rgb_t(0xff, 0xff, 0xff), /* BUFF */ + rgb_t(0x00, 0xff, 0xff), /* CYAN */ + rgb_t(0xff, 0x00, 0xff), /* MAGENTA */ + rgb_t(0xff, 0x80, 0x00), /* ORANGE */ + + rgb_t(0x00, 0x20, 0x00), /* BLACK in original, here DARK green */ + rgb_t(0x00, 0xff, 0x00), /* GREEN */ + rgb_t(0x00, 0x00, 0x00), /* BLACK */ + rgb_t(0xff, 0xff, 0xff), /* BUFF */ + + rgb_t(0x00, 0x20, 0x00), /* ALPHANUMERIC DARK GREEN */ + rgb_t(0x00, 0xff, 0x00), /* ALPHANUMERIC BRIGHT GREEN */ + rgb_t(0x40, 0x10, 0x00), /* ALPHANUMERIC DARK ORANGE */ + rgb_t(0xff, 0xc4, 0x18) /* ALPHANUMERIC BRIGHT ORANGE */ +}; +#endif + +FLOPPY_FORMATS_MEMBER( z80ne_state::floppy_formats ) + FLOPPY_DMK_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( z80ne_floppies ) + SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( z80ne, z80ne_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ) + MCFG_CPU_PROGRAM_MAP(z80ne_mem) + MCFG_CPU_IO_MAP(z80ne_io) + + MCFG_MACHINE_START_OVERRIDE(z80ne_state,z80ne) + MCFG_MACHINE_RESET_OVERRIDE(z80ne_state,z80ne) + + MCFG_DEVICE_ADD( "ay_3_1015", AY31015, 0 ) + MCFG_AY31015_TX_CLOCK(4800.0) + MCFG_AY31015_RX_CLOCK(4800.0) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_CASSETTE_ADD( "cassette2" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_DEFAULT_LAYOUT(layout_z80ne) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( z80net, z80ne ) + + MCFG_CPU_MODIFY("z80ne") + MCFG_CPU_PROGRAM_MAP(z80net_mem) + MCFG_CPU_IO_MAP(z80net_io) + + MCFG_MACHINE_START_OVERRIDE(z80ne_state, z80net ) + MCFG_MACHINE_RESET_OVERRIDE(z80ne_state, z80net ) + + MCFG_DEVICE_ADD("lx388_kr2376", KR2376, 50000) + + /* video hardware */ + MCFG_SCREEN_MC6847_PAL_ADD("lx388", "mc6847") + + MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_INPUT_CALLBACK(READ8(z80ne_state, lx388_mc6847_videoram_r)) + // AG = GND, GM2 = GND, GM1 = GND, GM0 = GND, CSS = GND + // other lines not connected + + MCFG_DEFAULT_LAYOUT(layout_z80net) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("1K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( z80netb, z80ne_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ) + MCFG_CPU_PROGRAM_MAP(z80netb_mem) + MCFG_CPU_IO_MAP(z80net_io) + + MCFG_MACHINE_START_OVERRIDE(z80ne_state,z80netb) + MCFG_MACHINE_RESET_OVERRIDE(z80ne_state,z80netb) + + MCFG_DEVICE_ADD( "ay_3_1015", AY31015, 0 ) + MCFG_AY31015_TX_CLOCK(4800.0) + MCFG_AY31015_RX_CLOCK(4800.0) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_CASSETTE_ADD( "cassette2" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_DEVICE_ADD("lx388_kr2376", KR2376, 50000) + + /* video hardware */ + MCFG_SCREEN_MC6847_PAL_ADD("lx388", "mc6847") + + MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_INPUT_CALLBACK(READ8(z80ne_state, lx388_mc6847_videoram_r)) + // AG = GND, GM2 = GND, GM1 = GND, GM0 = GND, CSS = GND + // other lines not connected + + MCFG_DEFAULT_LAYOUT(layout_z80netb) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("32K") + MCFG_RAM_EXTRA_OPTIONS("1K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_START( z80netf, z80ne_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ) + MCFG_CPU_PROGRAM_MAP(z80netf_mem) + MCFG_CPU_IO_MAP(z80netf_io) + + MCFG_MACHINE_START_OVERRIDE(z80ne_state,z80netf) + MCFG_MACHINE_RESET_OVERRIDE(z80ne_state,z80netf) + + MCFG_DEVICE_ADD( "ay_3_1015", AY31015, 0 ) + MCFG_AY31015_TX_CLOCK(4800.0) + MCFG_AY31015_RX_CLOCK(4800.0) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_CASSETTE_ADD( "cassette2" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) + + MCFG_DEVICE_ADD("lx388_kr2376", KR2376, 50000) + + /* video hardware */ + MCFG_SCREEN_MC6847_PAL_ADD("lx388", "mc6847") + + MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) + MCFG_MC6847_INPUT_CALLBACK(READ8(z80ne_state, lx388_mc6847_videoram_r)) + // AG = GND, GM2 = GND, GM1 = GND, GM0 = GND, CSS = GND + // other lines not connected + + MCFG_FD1771_ADD("wd1771", XTAL_2MHz / 2) + MCFG_FLOPPY_DRIVE_ADD("wd1771:0", z80ne_floppies, "sssd", z80ne_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1771:1", z80ne_floppies, "sssd", z80ne_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1771:2", z80ne_floppies, NULL, z80ne_state::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd1771:3", z80ne_floppies, NULL, z80ne_state::floppy_formats) + + MCFG_DEFAULT_LAYOUT(layout_z80netf) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("56K") +MACHINE_CONFIG_END + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + + +ROM_START( z80ne ) + ROM_REGION(0x20000, "z80ne", 0) + ROM_LOAD( "ep382.ic5", 0x14000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) ) +ROM_END + +ROM_START( z80net ) + ROM_REGION(0x20000, "z80ne", 0) + ROM_LOAD( "ep382.ic5", 0x14000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) ) +ROM_END + +ROM_START( z80netb ) +/* + * 16k Basic + */ + ROM_REGION(0x10000, "z80ne", 0) + ROM_LOAD( "548-1.ic1", 0x0000, 0x0800, CRC(868cad39) SHA1(0ea8af010786a080f823a879a4211f5712d260da) ) + ROM_LOAD( "548-2.ic2", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0) ) + ROM_LOAD( "548-3.ic3", 0x1000, 0x0800, CRC(9c1fe511) SHA1(ff5b6e49a137c2ff9cb760c39bfd85ce4b52bb7d) ) + ROM_LOAD( "548-4.ic4", 0x1800, 0x0800, CRC(cb5e0de3) SHA1(0beaa8927faaf61f6c3fc0ea1d3d5670f901aae3) ) + ROM_LOAD( "548-5.ic5", 0x2000, 0x0800, CRC(0bd4559c) SHA1(e736a3124819ffb43e96a8114cd188f18d538053) ) + ROM_LOAD( "548-6.ic6", 0x2800, 0x0800, CRC(6d663034) SHA1(57588be4e360658dbb313946d7a608e36c1fdd68) ) + ROM_LOAD( "548-7.ic7", 0x3000, 0x0800, CRC(0bab06c0) SHA1(d52f1519c798e91f25648e996b1db174d90ce0f5) ) + ROM_LOAD( "548-8.ic8", 0x3800, 0x0800, CRC(f381b594) SHA1(2de7a8941ba48d463974c73d62e994d3cbe2868d) ) +ROM_END + +ROM_START( z80netf ) + ROM_REGION(0x20000, "z80ne", 0) /* 64k for code 64k for banked code */ + /* ep548 banked at 0x0000 - 0x3FFF */ + ROM_LOAD( "548-1.ic1", 0x10000, 0x0800, CRC(868cad39) SHA1(0ea8af010786a080f823a879a4211f5712d260da) ) + ROM_LOAD( "548-2.ic2", 0x10800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0) ) + ROM_LOAD( "548-3.ic3", 0x11000, 0x0800, CRC(9c1fe511) SHA1(ff5b6e49a137c2ff9cb760c39bfd85ce4b52bb7d) ) + ROM_LOAD( "548-4.ic4", 0x11800, 0x0800, CRC(cb5e0de3) SHA1(0beaa8927faaf61f6c3fc0ea1d3d5670f901aae3) ) + ROM_LOAD( "548-5.ic5", 0x12000, 0x0800, CRC(0bd4559c) SHA1(e736a3124819ffb43e96a8114cd188f18d538053) ) + ROM_LOAD( "548-6.ic6", 0x12800, 0x0800, CRC(6d663034) SHA1(57588be4e360658dbb313946d7a608e36c1fdd68) ) + ROM_LOAD( "548-7.ic7", 0x13000, 0x0800, CRC(0bab06c0) SHA1(d52f1519c798e91f25648e996b1db174d90ce0f5) ) + ROM_LOAD( "548-8.ic8", 0x13800, 0x0800, CRC(f381b594) SHA1(2de7a8941ba48d463974c73d62e994d3cbe2868d) ) + + /* ep382 - banked at 0x0000 - 0x03FF */ + ROM_LOAD( "ep382.ic5", 0x14000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) ) + + /* ep390 - banked at 0x0000 - 0x03FF */ + ROM_LOAD( "ep390.ic6", 0x14400, 0x0400, CRC(e4dd7de9) SHA1(523caa97112a9e67cc078c1a70ceee94ec232093) ) + /* ep1390 - banked at 0x0000 - 0x03FF */ + ROM_LOAD( "ep1390.ic6", 0x14800, 0x0400, CRC(dc2cbc1d) SHA1(e23418b8f8261a17892f3a73ec09c72bb02e1d0b) ) + /* ep2390 - banked at 0x0000 - 0x03FF */ + ROM_LOAD( "ep2390.ic6", 0x14C00, 0x0400, CRC(28d28eee) SHA1(b80f75c1ac4905ae369ecbc9b9ce120cc85502ed) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, z80ne, 0, 0, z80ne, z80ne, z80ne_state, z80ne, "Nuova Elettronica", "Z80NE", MACHINE_NO_SOUND_HW) +COMP( 1980, z80net, z80ne, 0, z80net, z80net, z80ne_state, z80net, "Nuova Elettronica", "Z80NE + LX.388", MACHINE_NO_SOUND_HW) +COMP( 1980, z80netb, z80ne, 0, z80netb, z80net, z80ne_state, z80netb, "Nuova Elettronica", "Z80NE + LX.388 + Basic 16k", MACHINE_NO_SOUND_HW) +COMP( 1980, z80netf, z80ne, 0, z80netf, z80netf, z80ne_state, z80netf, "Nuova Elettronica", "Z80NE + LX.388 + LX.390", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/z88.c b/src/mame/drivers/z88.c new file mode 100644 index 00000000000..4dcef312899 --- /dev/null +++ b/src/mame/drivers/z88.c @@ -0,0 +1,758 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/****************************************************************************** + + z88.c + + z88 Notepad computer + + system driver + + TODO: + - speaker controlled by txd + - expansion interface + - serial port + + Kevin Thacker [MESS driver] + +*******************************************************************************/ + +#include "includes/z88.h" + + +/* Assumption: + +all banks can access the same memory blocks in the same way. +bank 0 is special. If a bit is set in the com register, +the lower 8k is replaced with the rom. Bank 0 has been split +into 2 8k chunks, and all other banks into 16k chunks. +I wanted to handle all banks in the code below, and this +explains why the extra checks are done + + + bank 0 0x0000-0x3FFF + bank 1 0x4000-0x7FFF + bank 2 0x8000-0xBFFF + bank 3 0xC000-0xFFFF + + pages 0x00 - 0x1f internal ROM + pages 0x20 - 0x3f 512KB internal RAM + pages 0x40 - 0x7f Slot 1 + pages 0x80 - 0xbf Slot 2 + pages 0xc0 - 0xff Slot 3 + +*/ + +// cartridges read +READ8_MEMBER(z88_state::bank0_cart_r) { return m_carts[m_bank[0].slot]->read(space, (m_bank[0].page<<14) + offset); } +READ8_MEMBER(z88_state::bank1_cart_r) { return m_carts[m_bank[1].slot]->read(space, (m_bank[1].page<<14) + offset); } +READ8_MEMBER(z88_state::bank2_cart_r) { return m_carts[m_bank[2].slot]->read(space, (m_bank[2].page<<14) + offset); } +READ8_MEMBER(z88_state::bank3_cart_r) { return m_carts[m_bank[3].slot]->read(space, (m_bank[3].page<<14) + offset); } + +// cartridges write +WRITE8_MEMBER(z88_state::bank0_cart_w) { m_carts[m_bank[0].slot]->write(space, (m_bank[0].page<<14) + offset, data); } +WRITE8_MEMBER(z88_state::bank1_cart_w) { m_carts[m_bank[1].slot]->write(space, (m_bank[1].page<<14) + offset, data); } +WRITE8_MEMBER(z88_state::bank2_cart_w) { m_carts[m_bank[2].slot]->write(space, (m_bank[2].page<<14) + offset, data); } +WRITE8_MEMBER(z88_state::bank3_cart_w) { m_carts[m_bank[3].slot]->write(space, (m_bank[3].page<<14) + offset, data); } + + +UPD65031_MEMORY_UPDATE(z88_state::bankswitch_update) +{ + char bank_tag[6]; + sprintf(bank_tag, "bank%d", bank + 2); + + // bank 0 is always even + if (bank == 0) page &= 0xfe; + + if (page < 0x20) // internal ROM + { + // install read bank + if (m_bank_type[bank] != Z88_BANK_ROM) + { + m_maincpu->space(AS_PROGRAM).install_read_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag); + m_maincpu->space(AS_PROGRAM).unmap_write(bank<<14, (bank<<14) + 0x3fff); + m_bank_type[bank] = Z88_BANK_ROM; + } + + membank(bank_tag)->set_entry(page); + } + else if (page < 0x40) // internal RAM + { + if((page & 0x1f) < (m_ram->size()>>14)) + { + // install readwrite bank + if (m_bank_type[bank] != Z88_BANK_RAM) + { + m_maincpu->space(AS_PROGRAM).install_readwrite_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag); + m_bank_type[bank] = Z88_BANK_RAM; + } + + // set the bank + membank(bank_tag)->set_entry(page); + } + else + { + if (m_bank_type[bank] != Z88_BANK_UNMAP) + { + m_maincpu->space(AS_PROGRAM).unmap_readwrite(bank<<14, (bank<<14) + 0x3fff); + m_bank_type[bank] = Z88_BANK_UNMAP; + } + } + } + else // cartridges + { + m_bank[bank].slot = (page >> 6) & 3; + m_bank[bank].page = page & 0x3f; + + if (m_bank_type[bank] != Z88_BANK_CART) + { + switch (bank) + { + case 0: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0000, 0x3fff, 0, 0, read8_delegate(FUNC(z88_state::bank0_cart_r), this), write8_delegate(FUNC(z88_state::bank0_cart_w), this)); + break; + case 1: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(z88_state::bank1_cart_r), this), write8_delegate(FUNC(z88_state::bank1_cart_w), this)); + break; + case 2: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(z88_state::bank2_cart_r), this), write8_delegate(FUNC(z88_state::bank2_cart_w), this)); + break; + case 3: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(z88_state::bank3_cart_r), this), write8_delegate(FUNC(z88_state::bank3_cart_w), this)); + break; + } + + m_bank_type[bank] = Z88_BANK_CART; + } + } + + + // override setting for lower 8k of bank 0 + if (bank == 0) + { + m_maincpu->space(AS_PROGRAM).install_read_bank(0, 0x1fff, "bank1"); + + // enable RAM + if (rams) + m_maincpu->space(AS_PROGRAM).install_write_bank(0, 0x1fff, "bank1"); + else + m_maincpu->space(AS_PROGRAM).unmap_write(0, 0x1fff); + + membank("bank1")->set_entry(rams & 1); + } +} + + +static ADDRESS_MAP_START(z88_mem, AS_PROGRAM, 8, z88_state ) + AM_RANGE(0x0000, 0x1fff) AM_READWRITE_BANK("bank1") + AM_RANGE(0x2000, 0x3fff) AM_READWRITE_BANK("bank2") + AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank3") + AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank4") + AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("bank5") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z88_io, AS_IO, 8, z88_state ) + AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE("blink", upd65031_device, read, write) +ADDRESS_MAP_END + + + +/* +------------------------------------------------------------------------- + | D7 D6 D5 D4 D3 D2 D1 D0 +------------------------------------------------------------------------- +A15 (#7) | RSH SQR ESC INDEX CAPS . / ?? +A14 (#6) | HELP LSH TAB DIA MENU , ; ' +A13 (#5) | [ SPACE 1 Q A Z L 0 +A12 (#4) | ] LFT 2 W S X M P +A11 (#3) | - RGT 3 E D C K 9 +A10 (#2) | = DWN 4 R F V J O +A9 (#1) | \ UP 5 T G B U I +A8 (#0) | DEL ENTER 6 Y H N 7 8 +------------------------------------------------------------------------- + +2008-05 FP: +Small note about natural keyboard: currently, +- "Square" is mapped to 'F1' +- "Diamond" is mapped to 'Left Control' +- "Index" is mapped to 'F2' +- "Menu" is mapped to 'F3' +- "Help" is mapped to 'F4' +*/ + +static INPUT_PORTS_START( z88 ) + PORT_START("LINE0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + + PORT_START("LINE1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + + PORT_START("LINE2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("LINE3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + + PORT_START("LINE4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + + PORT_START("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + + PORT_START("LINE6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Diamond") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + + PORT_START("LINE7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Square") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Index") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xA3') PORT_CHAR('~') +INPUT_PORTS_END + +static INPUT_PORTS_START( z88de ) + PORT_INCLUDE(z88) + + PORT_MODIFY("LINE0") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(0x00B0) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR('{') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR('}') + + PORT_MODIFY("LINE1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('~') + + PORT_MODIFY("LINE2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('\'') PORT_CHAR('`') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR('|') + + PORT_MODIFY("LINE3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x00DF) PORT_CHAR('?') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00A7) PORT_CHAR(0x00A3) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR('[') + + PORT_MODIFY("LINE4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_CHAR('@') + + PORT_MODIFY("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR('\\') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR(']') + + PORT_MODIFY("LINE6") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) + + PORT_MODIFY("LINE7") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('^') +INPUT_PORTS_END + +static INPUT_PORTS_START( z88fr ) + PORT_INCLUDE(z88) + + PORT_MODIFY("LINE0") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR(0x00A7) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR(0x00E8) PORT_CHAR('7') PORT_CHAR('{') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('!') PORT_CHAR('8') PORT_CHAR('}') + + PORT_MODIFY("LINE1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') PORT_CHAR('~') + + PORT_MODIFY("LINE2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') PORT_CHAR('|') + + PORT_MODIFY("LINE3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(')') PORT_CHAR(0x00B0) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('\"') PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR(0x00E7) PORT_CHAR('9') PORT_CHAR('[') + + PORT_MODIFY("LINE4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR(0x00E9) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') + + PORT_MODIFY("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('*') PORT_CHAR(0x00A8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('&') PORT_CHAR('1') PORT_CHAR('\\') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(0x00E0) PORT_CHAR('0') PORT_CHAR(']') + + PORT_MODIFY("LINE6") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('.') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F9) PORT_CHAR('%') + + PORT_MODIFY("LINE7") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('$') PORT_CHAR(0x00A3) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) +INPUT_PORTS_END + +static INPUT_PORTS_START( z88es ) + PORT_INCLUDE(z88) + + PORT_MODIFY("LINE0") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('/') PORT_CHAR('^') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR('{') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR('}') + + PORT_MODIFY("LINE1") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('~') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0x00E7) PORT_CHAR(0x00C7) + + PORT_MODIFY("LINE2") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR('|') + + PORT_MODIFY("LINE3") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(0x00A3) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('[') + + PORT_MODIFY("LINE4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(0x00BF) PORT_CHAR('@') + + PORT_MODIFY("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR(0x00A1) PORT_CHAR('\\') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(']') + + PORT_MODIFY("LINE6") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0x00F1) PORT_CHAR(0x00D1) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + + PORT_MODIFY("LINE7") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') +INPUT_PORTS_END + +static INPUT_PORTS_START( z88it ) + PORT_INCLUDE(z88) + + PORT_MODIFY("LINE0") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_MODIFY("LINE1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0x00F9) PORT_CHAR('|') PORT_CHAR('\\') + + PORT_MODIFY("LINE3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('{') + + PORT_MODIFY("LINE4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00EC) PORT_CHAR('~') PORT_CHAR(']') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(0x00A3) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + + PORT_MODIFY("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E8) PORT_CHAR(0x00E9) PORT_CHAR('[') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR('}') + + PORT_MODIFY("LINE6") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F2) PORT_CHAR('\'') PORT_CHAR('@') + + PORT_MODIFY("LINE7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00E0) PORT_CHAR('\"') PORT_CHAR('`') +INPUT_PORTS_END + +static INPUT_PORTS_START( z88se ) + PORT_INCLUDE(z88) + + PORT_MODIFY("LINE1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_MODIFY("LINE2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('+') PORT_CHAR('>') + + PORT_MODIFY("LINE3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('<') + + PORT_MODIFY("LINE4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') PORT_CHAR('`') + + PORT_MODIFY("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) PORT_CHAR('\\') + + PORT_MODIFY("LINE6") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) PORT_CHAR('{') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) PORT_CHAR('}') + + PORT_MODIFY("LINE7") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00A3) PORT_CHAR('~') +INPUT_PORTS_END + +static INPUT_PORTS_START( z88no ) + PORT_INCLUDE(z88se) + + PORT_MODIFY("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) PORT_CHAR('}') + + PORT_MODIFY("LINE6") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E6) PORT_CHAR(0x00C6) PORT_CHAR('{') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00F8) PORT_CHAR(0x00D8) PORT_CHAR('|') +INPUT_PORTS_END + +static INPUT_PORTS_START( z88ch ) + PORT_INCLUDE(z88) + + PORT_MODIFY("LINE0") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR('^') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR('{') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR('[') + + PORT_MODIFY("LINE1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('~') + + PORT_MODIFY("LINE2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00FA) PORT_CHAR(0x00F9) PORT_CHAR('`') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x00E7) PORT_CHAR(0x00C7) + + PORT_MODIFY("LINE3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('?') PORT_CHAR('|') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('*') PORT_CHAR('#') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(']') + + PORT_MODIFY("LINE4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00A8) PORT_CHAR('!') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_CHAR('@') + + PORT_MODIFY("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E8) PORT_CHAR(0x00FC) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('+') PORT_CHAR('\\') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR('}') + + PORT_MODIFY("LINE6") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00E9) PORT_CHAR(0x00F6) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0x00E0) PORT_CHAR(0x00E4) + + PORT_MODIFY("LINE7") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('$') PORT_CHAR(0x00A3) +INPUT_PORTS_END + +static INPUT_PORTS_START( z88tr ) + PORT_INCLUDE(z88) + + PORT_MODIFY("LINE0") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('?') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR('{') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR('}') + + PORT_MODIFY("LINE1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') PORT_CHAR('`') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('<') + + PORT_MODIFY("LINE2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('^') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR('~') + + PORT_MODIFY("LINE3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHAR('\\') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(0x00A3) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('[') + + PORT_MODIFY("LINE4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('&') PORT_CHAR('@') + + PORT_MODIFY("LINE5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x011F) PORT_CHAR(0x011E) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR('|') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(']') + + PORT_MODIFY("LINE6") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x015F) PORT_CHAR(0x015E) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0x0131) PORT_CHAR(0x0130) + + PORT_MODIFY("LINE7") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0x00E7) PORT_CHAR(0x00C7) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') +INPUT_PORTS_END + + +void z88_state::machine_start() +{ + m_bios = (UINT8*)memregion("bios")->base(); + m_ram_base = (UINT8*)m_ram->pointer(); + + // configure the memory banks + membank("bank1")->configure_entry(0, m_bios); + membank("bank1")->configure_entry(1, m_ram_base); + membank("bank2")->configure_entries(0, 32, m_bios, 0x4000); + membank("bank3")->configure_entries(0, 32, m_bios, 0x4000); + membank("bank4")->configure_entries(0, 32, m_bios, 0x4000); + membank("bank5")->configure_entries(0, 32, m_bios, 0x4000); + membank("bank2")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000); + membank("bank3")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000); + membank("bank4")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000); + membank("bank5")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000); + + m_carts[1] = machine().device("slot1"); + m_carts[2] = machine().device("slot2"); + m_carts[3] = machine().device("slot3"); +} + +void z88_state::machine_reset() +{ + m_bank_type[0] = m_bank_type[1] = m_bank_type[2] = m_bank_type[3] = 0; +} + +READ8_MEMBER(z88_state::kb_r) +{ + UINT8 data = 0xff; + + if (!(offset & 0x80)) + data &= ioport("LINE7")->read(); + + if (!(offset & 0x40)) + data &= ioport("LINE6")->read(); + + if (!(offset & 0x20)) + data &= ioport("LINE5")->read(); + + if (!(offset & 0x10)) + data &= ioport("LINE4")->read(); + + if (!(offset & 0x08)) + data &= ioport("LINE3")->read(); + + if (!(offset & 0x04)) + data &= ioport("LINE2")->read(); + + if (!(offset & 0x02)) + data &= ioport("LINE1")->read(); + + if (!(offset & 0x01)) + data &= ioport("LINE0")->read(); + + return data; +} + +static SLOT_INTERFACE_START(z88_cart) + SLOT_INTERFACE("32krom", Z88_32K_ROM) // 32KB ROM cart + SLOT_INTERFACE("128krom", Z88_128K_ROM) // 128KB ROM cart + SLOT_INTERFACE("256krom", Z88_256K_ROM) // 256KB ROM cart + SLOT_INTERFACE("32kram", Z88_32K_RAM) // 32KB RAM cart + SLOT_INTERFACE("128kram", Z88_128K_RAM) // 128KB RAM cart + SLOT_INTERFACE("512kram", Z88_512K_RAM) // 512KB RAM cart + SLOT_INTERFACE("1024kram",Z88_1024K_RAM) // 1024KB RAM cart + SLOT_INTERFACE("1024kflash",Z88_1024K_FLASH) // 1024KB Flash cart +SLOT_INTERFACE_END + +static MACHINE_CONFIG_START( z88, z88_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_9_8304MHz/3) // divided by 3 through the uPD65031 + MCFG_CPU_PROGRAM_MAP(z88_mem) + MCFG_CPU_IO_MAP(z88_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", LCD) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(Z88_SCREEN_WIDTH, Z88_SCREEN_HEIGHT) + MCFG_SCREEN_VISIBLE_AREA(0, (Z88_SCREEN_WIDTH - 1), 0, (Z88_SCREEN_HEIGHT - 1)) + MCFG_SCREEN_UPDATE_DEVICE("blink", upd65031_device, screen_update) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", Z88_NUM_COLOURS) + MCFG_PALETTE_INIT_OWNER(z88_state, z88) + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_DEVICE_ADD("blink", UPD65031, XTAL_9_8304MHz) + MCFG_UPD65031_KB_CALLBACK(READ8(z88_state, kb_r)) + MCFG_UPD65031_INT_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_UPD65031_NMI_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_UPD65031_SPKR_CALLBACK(DEVWRITELINE("speaker", speaker_sound_device, level_w)) + MCFG_UPD65031_SCR_UPDATE_CB(z88_state, lcd_update) + MCFG_UPD65031_MEM_UPDATE_CB(z88_state, bankswitch_update) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + // internal ram + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("32K,64K,256K,512k") + + // cartridges + MCFG_DEVICE_ADD("slot1", Z88CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) + MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) + MCFG_DEVICE_ADD("slot2", Z88CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) + MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) + MCFG_DEVICE_ADD("slot3", Z88CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) + MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START(z88) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_DEFAULT_BIOS("v40uk") + ROM_SYSTEM_BIOS( 0, "v220uk", "Version 2.20 UK") + ROMX_LOAD("z88v220.rom", 0x00000, 0x20000, CRC(0ae7d0fc) SHA1(5d89e8d98d2cc0acb8cd42dbfca601b7bd09c51e), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v30uk", "Version 3.0 UK") + ROMX_LOAD("z88v300.rom" , 0x00000, 0x20000, CRC(802cb9aa) SHA1(ceb688025b79454cf229cae4dbd0449df2747f79), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 2, "v40uk", "Version 4.0 UK") + ROMX_LOAD("z88v400.rom", 0x00000, 0x20000, CRC(1356d440) SHA1(23c63ceced72d0a9031cba08d2ebc72ca336921d), ROM_BIOS(3) ) +ROM_END + +ROM_START(z88de) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v318de", "Version 3.18 German") + ROMX_LOAD("z88v318de.rom", 0x00000, 0x20000, CRC(d7eaf937) SHA1(5acbfa324e2a6582ffd1af5f2e28086318d2ed27), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88es) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v319es", "Version 3.19 Spanish") + ROMX_LOAD("z88v319es.rom", 0x00000, 0x20000, CRC(7a08af73) SHA1(a99a7581f47a032e1ec3b4f534c06f00f67647df), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88fr) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v326fr", "Version 3.26 French") + ROMX_LOAD("z88v326fr.rom", 0x00000, 0x20000, CRC(218fbb72) SHA1(6e4c590f40f5b14d66e6559807f538fb5fa91474), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88it) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v323it", "Version 3.23 Italian") + ROMX_LOAD("z88v323it.rom", 0x00000, 0x20000, CRC(13f54308) SHA1(29bda04ae803f2dff6357d81b3894db669d12dbf), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88se) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v250se", "Version 2.50 Swedish") + ROMX_LOAD("z88v250sw.rom", 0x00000, 0x20000, CRC(dad01338) SHA1(3825eee346b692b16215a500250cc0c76d2d8f0b), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88fi) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v401fi", "Version 4.01 Finnish") + ROMX_LOAD("z88v401fi.rom", 0x00000, 0x20000, CRC(ecd7f3f6) SHA1(bf8d3e083f1959e5a0d7e9c8d2ad0c14abd46381), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88no) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v260no", "Version 2.60 Norwegian") + ROMX_LOAD("z88v260nr.rom", 0x00000, 0x20000, CRC(293f35c8) SHA1(b68b8f5bb1f69fe7a24897933b1464dc79e96d80), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88dk) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v321dk", "Version 3.21 Danish") + ROMX_LOAD("z88v321dk.rom", 0x00000, 0x20000, CRC(baa80408) SHA1(7b0d44af2688d0fe47667e0424860aafa0948dae), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88ch) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v313ch", "Version 3.13 Swiss") + ROMX_LOAD("z88v313he.rom", 0x00000, 0x20000, CRC(a56d732c) SHA1(c2276a12d457f01a8fd2e2ac238aff2b5c3559d8), ROM_BIOS(1) ) +ROM_END + +ROM_START(z88tr) + ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) + ROM_SYSTEM_BIOS( 0, "v317tk", "Version 3.17 Turkish") + ROMX_LOAD("z88v317tk.rom", 0x00000, 0x20000, CRC(9468d677) SHA1(8d76e94f43846c736bf257d15d531c2df1e20fae), ROM_BIOS(1) ) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ +COMP( 1988, z88 , 0, 0, z88, z88 , driver_device, 0, "Cambridge Computers", "Z88" , MACHINE_NOT_WORKING) +COMP( 1988, z88de, z88, 0, z88, z88de, driver_device, 0, "Cambridge Computers", "Z88 (German)" , MACHINE_NOT_WORKING) +COMP( 1988, z88es, z88, 0, z88, z88es, driver_device, 0, "Cambridge Computers", "Z88 (Spanish)" , MACHINE_NOT_WORKING) +COMP( 1988, z88fr, z88, 0, z88, z88fr, driver_device, 0, "Cambridge Computers", "Z88 (French)" , MACHINE_NOT_WORKING) +COMP( 1988, z88it, z88, 0, z88, z88it, driver_device, 0, "Cambridge Computers", "Z88 (Italian)" , MACHINE_NOT_WORKING) +COMP( 1988, z88se, z88, 0, z88, z88se, driver_device, 0, "Cambridge Computers", "Z88 (Swedish)" , MACHINE_NOT_WORKING) +COMP( 1988, z88fi, z88, 0, z88, z88se, driver_device, 0, "Cambridge Computers", "Z88 (Finnish)" , MACHINE_NOT_WORKING) +COMP( 1988, z88no, z88, 0, z88, z88no, driver_device, 0, "Cambridge Computers", "Z88 (Norwegian)", MACHINE_NOT_WORKING) +COMP( 1988, z88dk, z88, 0, z88, z88no, driver_device, 0, "Cambridge Computers", "Z88 (Danish)" , MACHINE_NOT_WORKING) +COMP( 1988, z88ch, z88, 0, z88, z88ch, driver_device, 0, "Cambridge Computers", "Z88 (Swiss)" , MACHINE_NOT_WORKING) +COMP( 1988, z88tr, z88, 0, z88, z88tr, driver_device, 0, "Cambridge Computers", "Z88 (Turkish)" , MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/z9001.c b/src/mame/drivers/z9001.c new file mode 100644 index 00000000000..91ab13e2e03 --- /dev/null +++ b/src/mame/drivers/z9001.c @@ -0,0 +1,317 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic , Robbbert +/*************************************************************************** + + Robotron Z9001 (KC85/1) + + 12/05/2009 Skeleton driver. + 13/07/2011 Notes added. You can enter text via terminal input. + Colour and flashing added. + +The only kind of acceptable input is a filename that is in 8.3 format and +begins with a letter. It will say 'start tape'. You can press ^C here to +escape, or any key to continue. + +Some other control keys: +^B clear input line +^C break +^F toggle flashing attribute +^H backspace +^L clear screen + + +ToDo: +- cassette in +- proper keyboard +- get rid of temporary code + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80pio.h" +#include "machine/z80ctc.h" +#include "cpu/z80/z80daisy.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "sound/beep.h" + +// temporary +#include "machine/keyboard.h" + +#define KEYBOARD_TAG "keyboard" + +class z9001_state : public driver_device +{ +public: + z9001_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_framecnt(0), + m_beeper(*this, "beeper"), + m_cass(*this, "cassette"), + m_p_colorram(*this, "colorram"), + m_p_videoram(*this, "videoram") + { + } + + required_device m_maincpu; + UINT8 m_framecnt; + required_device m_beeper; + required_device m_cass; + required_shared_ptr m_p_colorram; + required_shared_ptr m_p_videoram; + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE8_MEMBER(port88_w); + DECLARE_WRITE_LINE_MEMBER(cass_w); + const UINT8 *m_p_chargen; + bool m_cassbit; + virtual void machine_reset(); + //virtual void machine_start(); + virtual void video_start(); + UINT32 screen_update_z9001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(timer_callback); +}; + +static ADDRESS_MAP_START(z9001_mem, AS_PROGRAM, 8, z9001_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0xe7ff ) AM_RAM + AM_RANGE( 0xe800, 0xebff ) AM_RAM AM_SHARE("colorram") + AM_RANGE( 0xec00, 0xefff ) AM_RAM AM_SHARE("videoram") + AM_RANGE( 0xf000, 0xffff ) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z9001_io, AS_IO, 8, z9001_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x80, 0x83) AM_MIRROR(4) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) + AM_RANGE(0x88, 0x8B) AM_MIRROR(4) AM_DEVREADWRITE("z80pio1", z80pio_device, read, write) + AM_RANGE(0x90, 0x93) AM_MIRROR(4) AM_DEVREADWRITE("z80pio2", z80pio_device, read, write) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( z9001 ) +INPUT_PORTS_END + +static const z80_daisy_config z9001_daisy_chain[] = +{ + { "z80pio2" }, + { "z80pio1" }, + { "z80ctc" }, + { NULL } +}; + +//Bits0,1 not connected; 2,3,4,5 go to a connector; 6 goes to 'graphics' LED; 7 goes to speaker. +WRITE8_MEMBER( z9001_state::port88_w ) +{ + m_beeper->set_state(BIT(data, 7)); +} + +WRITE_LINE_MEMBER( z9001_state::cass_w ) +{ + if (state) + { + m_cassbit ^= 1; + m_cass->output( m_cassbit ? -1.0 : +1.0); + } +} + + +// temporary (prevent freezing when you type an invalid filename) +TIMER_DEVICE_CALLBACK_MEMBER(z9001_state::timer_callback) +{ + m_maincpu->space(AS_PROGRAM).write_byte(0x006a, 0); +} + +void z9001_state::machine_reset() +{ + m_beeper->set_frequency(800); + m_maincpu->set_state_int(Z80_PC, 0xf000); +} + +void z9001_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 z9001_state::screen_update_z9001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,col,fg,bg; + UINT16 sy=0,ma=0,x; + m_framecnt++; + + for(y = 0; y < 24; y++ ) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 40; x++) + { + chr = m_p_videoram[x]; // get char in videoram + gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen + col = m_p_colorram[x]; + fg = col>>4; + bg = col&15; + + /* Check for flashing - swap bg & fg */ + if ((BIT(col, 7)) && (m_framecnt & 0x10)) + { + bg = fg; + fg = col&15; + } + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7) ? fg : bg; + *p++ = BIT(gfx, 6) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 0) ? fg : bg; + } + } + ma+=40; + } + return 0; +} + +/* F4 Character Displayer */ +static const gfx_layout z9001_charlayout = +{ + 8, 8, /* 8 x 8 characters */ + 1024, /* 4 x 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 bytes */ +}; + +WRITE8_MEMBER( z9001_state::kbd_put ) +{ + m_maincpu->space(AS_PROGRAM).write_byte(0x0025, data); +} + +static GFXDECODE_START( z9001 ) + GFXDECODE_ENTRY( "chargen", 0x0000, z9001_charlayout, 0, 1 ) +GFXDECODE_END + + +static MACHINE_CONFIG_START( z9001, z9001_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_9_8304MHz / 4) + MCFG_CPU_PROGRAM_MAP(z9001_mem) + MCFG_CPU_IO_MAP(z9001_io) + MCFG_CPU_CONFIG(z9001_daisy_chain) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(40*8, 24*8) + MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 24*8-1) + MCFG_SCREEN_UPDATE_DRIVER(z9001_state, screen_update_z9001) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", z9001) + MCFG_PALETTE_ADD("palette", 16) + + /* Sound */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(z9001_state, kbd_put)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("z9001_timer", z9001_state, timer_callback, attotime::from_msec(10)) + + MCFG_DEVICE_ADD("z80pio1", Z80PIO, XTAL_9_8304MHz / 4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(z9001_state, port88_w)) + + MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_9_8304MHz / 4) // keyboard PIO + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_9_8304MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(z9001_state, cass_w)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) + + MCFG_CASSETTE_ADD( "cassette" ) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( z9001 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "orig", "Original" ) + ROMX_LOAD( "os____f0.851", 0xf000, 0x1000, CRC(9fe60a92) SHA1(553609631f5eaa7d6758a73f56c613e280a5b310), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "rb20", "ROM-Bank System without menu" ) + ROMX_LOAD( "os_rb20.rom", 0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) + ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) + + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) + ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) + ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) + ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) +ROM_END + +#define rom_kc85_111 rom_z9001 + +ROM_START( kc87_10 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "orig", "Original" ) + ROMX_LOAD( "os____f0.851", 0xf000, 0x1000, CRC(9fe60a92) SHA1(553609631f5eaa7d6758a73f56c613e280a5b310), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "rb20", "ROM-Bank System without menu" ) + ROMX_LOAD( "os_rb20.rom", 0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) + ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) + + ROM_LOAD( "basic_c0.87a", 0xc000, 0x2800, CRC(c508d45e) SHA1(ea85b53e21429c4cb85cdb81b92f278a8f4eb574)) + + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) + ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) + ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) + ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) +ROM_END + +#define rom_kc87_11 rom_kc87_10 + +ROM_START( kc87_20 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "orig", "Original" ) + ROMX_LOAD( "os____f0.87b", 0xf000, 0x1000, CRC(a357d093) SHA1(b1df6b499517c8366a0795030ee800e8a258e938), ROM_BIOS(1)) + ROM_SYSTEM_BIOS( 1, "rb20", "ROM-Bank System without menu" ) + ROMX_LOAD( "os_rb20.rom", 0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) + ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) + + ROM_LOAD( "basic_c0.87b", 0xc000, 0x2800, CRC(9e8f6380) SHA1(8ffecc64ba35c953c93738f8568c83dc6af1ae72)) + + ROM_REGION( 0x2000, "chargen", 0 ) + ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) + ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) + ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) + ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) +ROM_END + +#define rom_kc87_21 rom_kc87_20 + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, z9001, 0, 0, z9001, z9001, driver_device, 0, "Robotron", "Z9001 (KC 85/1.10)", MACHINE_NOT_WORKING ) +COMP( 1986, kc85_111, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 85/1.11", MACHINE_NOT_WORKING ) +COMP( 1987, kc87_10, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 87.10", MACHINE_NOT_WORKING ) +COMP( 1987, kc87_11, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 87.11", MACHINE_NOT_WORKING ) +COMP( 1987, kc87_20, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 87.20", MACHINE_NOT_WORKING ) +COMP( 1987, kc87_21, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 87.21", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/zapcomputer.c b/src/mame/drivers/zapcomputer.c new file mode 100644 index 00000000000..a2a81a32d64 --- /dev/null +++ b/src/mame/drivers/zapcomputer.c @@ -0,0 +1,156 @@ +// license:GPL2+ +// copyright-holders:FelipeSanches +/* + ZAP - Z80 Applications Processor + + driver by: Felipe Correa da Silva Sanches + + Based on the technical descriptions and + assembly listings of the book: + + "Build Your Own Z80 Microcomputer" + by Steve Ciarcia (1981) + published by BYTE/McGRAW-HILL + + Basic usage instructions: + SHIFT + 0: view and edit memory values + SHIFT + 1: view and edit register values + SHIFT + 2: execution mode + + For more info, please check chapter 6 "Monitor software" in the book + and/or the assembly listings of the ZAP monitor software + avaliable at appendix D. + + Currently missing features in this driver: + * hookup RS232 support + * maybe also support video terminal described in chapter 9 +*/ + +#include "includes/zapcomputer.h" +#include "zapcomputer.lh" + +static unsigned char decode7seg(int data){ + //These are bit patterns representing the conversion of 4bit values + //into the status of the segments of the 7 segment displays + //controlled by a 82S23 PROM + + unsigned char patterns[16] = { + 0x77, 0x41, 0x6e, 0x6b, + 0x59, 0x3b, 0x3f, 0x61, + 0x7f, 0x79, 0x7d, 0x1f, + 0x36, 0x4f, 0x3e, 0x3c + }; + + // Bit order for the FAIRCHILD FND-70 + // 7-SEGMENT LCD: . g f e d c b a + return BITSWAP8(patterns[data & 0x0F], 7, 3, 4, 2, 1, 0, 6, 5); +} + +WRITE8_MEMBER(zapcomp_state::display_7seg_w){ + switch (offset){ + case 0: //Port 0x05 : address HI + output_set_digit_value(0, decode7seg(data >> 4)); + output_set_digit_value(1, decode7seg(data)); + break; + case 1: //Port 0x06 : address LOW + output_set_digit_value(2, decode7seg(data >> 4)); + output_set_digit_value(3, decode7seg(data)); + break; + case 2: //Port 0x07 : data + output_set_digit_value(4, decode7seg(data >> 4)); + output_set_digit_value(5, decode7seg(data)); + break; + default: + break; + } +} + +READ8_MEMBER(zapcomp_state::keyboard_r){ + unsigned char retval = 0x00; + unsigned char special = ioport("special_keys")->read(); + unsigned int hex_keys = (ioport("hex_keys_2")->read() << 8) | ioport("hex_keys_1")->read(); + + if (special & 0x04) /* "SHIFT" key is pressed */ + retval = 0x40; /* turn on the SHIFT bit but DO NOT turn on the strobe bit */ + + if (special & 0x02) /* "NEXT" key is pressed */ + retval |= 0xA0; /* turn on the strobe & NEXT bits */ + + if (special & 0x01) /* "EXEC" key is pressed */ + retval |= 0x90; /* turn on the strobe & EXEC bit */ + + for (int i=0; i<16; i++){ + if (hex_keys & (1 << i)){ + retval |= (0x80 | i); /* provide the key index in bits 3-0 + as well as turning on the strobe bit */ + } + } + return retval; +} + +static ADDRESS_MAP_START( zapcomp_mem, AS_PROGRAM, 8, zapcomp_state ) + AM_RANGE(0x0000, 0x03ff) AM_ROM /* system monitor */ + AM_RANGE(0x0400, 0x07ff) AM_RAM /* mandatory 1 kilobyte bank #0 */ + AM_RANGE(0x0800, 0x0bff) AM_RAM /* extra 1 kilobyte bank #1 (optional) */ + AM_RANGE(0x0c00, 0x0fff) AM_RAM /* extra 1 kilobyte bank #2 (optional) */ + AM_RANGE(0x1000, 0x13ff) AM_RAM /* extra 1 kilobyte bank #3 (optional) */ + AM_RANGE(0x1400, 0x17ff) AM_RAM /* extra 1 kilobyte bank #4 (optional) */ + AM_RANGE(0x1800, 0x1bff) AM_RAM /* extra 1 kilobyte bank #5 (optional) */ + AM_RANGE(0x1c00, 0x1fff) AM_RAM /* extra 1 kilobyte bank #6 (optional) */ + AM_RANGE(0x2000, 0x23ff) AM_RAM /* extra 1 kilobyte bank #7 (optional) */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( zapcomp_io, AS_IO, 8, zapcomp_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READ(keyboard_r) + AM_RANGE(0x05, 0x07) AM_WRITE(display_7seg_w) +ADDRESS_MAP_END + +static INPUT_PORTS_START( zapcomp ) + PORT_START("hex_keys_1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + + PORT_START("hex_keys_2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') + + PORT_START("special_keys") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("EXEC") PORT_CODE(KEYCODE_ENTER) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) +INPUT_PORTS_END + +void zapcomp_state::machine_start() +{ +} + +static MACHINE_CONFIG_START( zapcomp, zapcomp_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, XTAL_2MHz) + MCFG_CPU_PROGRAM_MAP(zapcomp_mem) + MCFG_CPU_IO_MAP(zapcomp_io) + + /* video hardware */ + MCFG_DEFAULT_LAYOUT(layout_zapcomputer) +MACHINE_CONFIG_END + +ROM_START( zapcomp ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD("zap.rom", 0x0000, 0x0400, CRC(cedad5d5) SHA1(576adfafbe5475004675638c1703415f8c468c6f)) +ROM_END + +// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS +COMP( 1981, zapcomp, 0, 0, zapcomp, zapcomp, driver_device, 0, "Steve Ciarcia / BYTE / McGRAW-HILL", "ZAP - Z80 Applications Processor", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/zaurus.c b/src/mame/drivers/zaurus.c new file mode 100644 index 00000000000..0fe4724067f --- /dev/null +++ b/src/mame/drivers/zaurus.c @@ -0,0 +1,1815 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/**************************************************************************************************************************************** + + Sharp Zaurus PDA skeleton driver (SL, ARM/Linux based, 4th generation) + + TODO: + - PXA-255 ID opcode fails on this + - ARM TLB look-up errors? + - RTC irq doesn't fire? + - For whatever reason, after RTC check ARM executes invalid code at 0-0x200 + - Dumps are questionable to say the least + +========================================================================================================================================= +Sharp Zaurus +------------ + +Personal Information (PI) Series +-------------------------------- + +Model: Pi^2 T (proof-of-concept model) +Manufacturer: Sharp +Nickname/Series: +Demo/Press Release Date: April 1992 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 288 KB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix DSFTN mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA +Keyboard: No +Features: handwriting recognition +Note: + +Model: PI-3000 +Manufacturer: Sharp +Nickname/Series: +Release Date: October 1, 1993 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 288 KB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix DSFTN mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA +Keyboard: No +Features: handwriting recognition, external faxmodem adapter (optional) +Note: + +Model: PI-4000 +Manufacturer: Sharp +Nickname/Series: +Release Date: June 1994 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 544 KB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA +Keyboard: No +Features: handwriting recognition, external faxmodem adapter (optional), "ink capabilities"? +Note: + +Model: PI-4000FX +Manufacturer: Sharp +Nickname/Series: +Release Date: June 1994 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 544 KB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA +Keyboard: No +Features: handwriting recognition, included external faxmodem adapter +Note: + +Model: PI-5000 +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: November 1994 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: No +Features: handwriting recognition, external faxmodem adapter (optional), email, add-in software capabilities +Note: + +Model: PI-5000FX +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: November 1994 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: No +Features: handwriting recognition, included external faxmodem adapter, email, add-in software capabilities +Note: + +Model: PI-5000DA +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: November 1994 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: No +Features: handwriting recognition, email, included digital mobile phone adapter, add-in software capabilities +Note: + +Model: PI-4500 +Manufacturer: Sharp +Nickname/Series: +Release Date: January 1995 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 544 KB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: No +Features: handwriting recognition, included external faxmodem adapter, email, add-in software capabilities +Note: + +Model: PI-6000 +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: August 25, 1995 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB +Flash (Internal): none +Other Storage: none +Slots: Flash IC card slot +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: No +Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email, add-in software capabilities +Note: + +Model: PI-6000FX +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: August 25, 1995 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB +Flash (Internal): none +Other Storage: none +Slots: Flash IC card slot +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: No +Features: upgraded handwriting recognition (over PI-4xxx/5xxx), included external faxmodem adapter, email +Note: + +Model: PI-6000DA +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: December 16, 1995 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB +Flash (Internal): none +Slots: Flash IC card slot +Other Storage: none +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: No +Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email, included digital mobile phone adapter +Note: + +Model: PI-7000 +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: February 1996 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB +Flash (Internal): 2 MB +Slots: no IC card slot +Other Storage: none +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, internal faxmodem, I/O Port - serial PC Link +Keyboard: No +Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email +Note: + +Model: PI-6500 +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: November 22, 1996 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB (715 KB user addressable) +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: No +Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email +Note: + +Model: PI-8000 +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: January 24, 1997 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible for handwriting recognition +Memory: 1 MB (711 KB user addressable) +Flash (Internal): none +Other Storage: none +Slots: +Display: 319x168 dot matrix mono "widescreen" LCD touchscreen +OS: Sharp Synergy +I/O: IrDA, internal faxmodem, I/O Port - serial PC Link +Keyboard: No +Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email +Note: + +Model: PI-6600 +Manufacturer: Sharp +Nickname/Series: AccessZaurus +Release Date: September 25, 1997 +Availability: Japan +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB +Flash (Internal): none +Other Storage: none +Slots: +Display: 239x168 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, internal faxmodem, I/O Port - serial PC Link +Keyboard: Yes +Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email, included external digital mobile phone adapter, PC PIM software PowerPIMM ver 2.0, Microsoft Excel PC Viewer software +Note: + +============================================================================================ + +PI-B Series (Business/Commercial) +--------------------------------- + +Model: PI-B304 +Manufacturer: Sharp +Nickname/Series: +Release Date: October 1995 +Availability: Japan +CPU: NEC V30 (low-power version) 16-bit CPU +Memory: 2 MB RAM +Flash (Internal): 2 MB +Other Storage: none +Slots: +Display: 480x320 dot matrix reflective mono LCD touchscreen +OS: MS-DOS +I/O: IrDA, I/O Port - serial PC Link +Keyboard: +Features: +Note: + +Model: PI-B308 +Manufacturer: Sharp +Nickname/Series: +Release Date: October 1995 +Availability: Japan +CPU: NEC V30 (low-power version) 16-bit CPU +Memory: 2 MB RAM +Flash (Internal): 6 MB +Other Storage: none +Slots: +Display: 480x320 dot matrix reflective mono LCD touchscreen +OS: MS-DOS +I/O: IrDA, I/O Port - serial PC Link +Keyboard: +Features: +Note: + +============================================================================================ + +K-PDA (ZR) Series +----------------- + +Model: ZR-5000 +Manufacturer: Sharp +Nickname/Series: K-PDA +Release Date: January 1995 +Availability: US, Euro +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB RAM +Flash (Internal): none +Other Storage: none +Slots: PCMCIA Type II +Display: 320x240 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: Yes +Features: handwriting recognition, email +Note: + +Model: ZR-5000/FX +Manufacturer: Sharp +Nickname/Series: K-PDA +Release Date: January 1995 +Availability: US, Euro +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB RAM +Flash (Internal): none +Other Storage: none +Slots: PCMCIA Type II +Display: 320x240 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email +Note: + +Model: ZR-5700 +Manufacturer: Sharp +Nickname/Series: K-PDA +Release Date: 1995/1996? +Availability: US, Euro +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB RAM (user area: approx. 600K) +Flash (Internal): none +Other Storage: none +Slots: PCMCIA Type II +Display: 320x240 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: Yes +Features: handwriting recognition, email +Note: + +Model: ZR-5700 +Manufacturer: Sharp +Nickname/Series: K-PDA +Release Date: 1995/1996? +Availability: US, Euro +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB RAM (user area: approx. 600K) +Flash (Internal): none +Other Storage: none +Slots: PCMCIA Type II +Display: 320x240 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email +Note: + +Model: ZR-5800 +Manufacturer: Sharp +Nickname/Series: K-PDA +Release Date: 1996 +Availability: US, Euro +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 2 MB RAM (user area: approx. 1624K) +Flash (Internal): none +Other Storage: none +Slots: PCMCIA Type II +Display: 320x240 backlit dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: Yes +Features: upgraded handwriting recognition, email, digital mobile phone adapter (optional) +Note: + +Model: ZR-5800/FX +Manufacturer: Sharp +Nickname/Series: K-PDA +Release Date: 1996 +Availability: US, Euro +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 2 MB RAM (user area: approx. 1624K) +Flash (Internal): none +Other Storage: none +Slots: PCMCIA Type II +Display: 320x240 backlit dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: upgraded handwriting recognition, email, digital mobile phone adapter (optional) +Note: + +Model: ZR-3000 +Manufacturer: Sharp +Nickname/Series: K-PDA +Release Date: 1996 +Availability: US, Euro +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB RAM (user area approx. 650K) +Flash (Internal): none +Other Storage: none +Slots: +Display: 320x240 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link +Keyboard: Yes +Features: handwriting recognition, external faxmodem adapter (optional), email +Note: + +Model: ZR-3500X +Manufacturer: Sharp +Nickname/Series: K-PDA +Release Date: 1996 +Availability: US, Euro +Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU +Sub CPU: Z80-compatible co-processor for handwriting recognition +Memory: 1 MB RAM (user area approx. 650K) +Flash (Internal): 1 MB +Other Storage: none +Slots: +Display: 320x240 dot matrix mono LCD touchscreen +OS: Sharp Synergy +I/O: ASK/IrDA, I/O Port - serial PC Link, internal faxmodem (14.4/9.6 kbit/s) +Keyboard: Yes +Features: handwriting recognition, email +Note: + +============================================================================================ + +MI Series +--------- + +Model: MI-10 +Manufacturer: Sharp +Nickname/Series: ColorZaurus +Release Date: June 25, 1996 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: unknown +Flash (Internal): none +Other Storage: none +Slots: +Display: 320x240 16-bit color TFT LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-10DC +Manufacturer: Sharp +Nickname/Series: ColorZaurus +Release Date: June 25, 1996 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: unknown +Flash (Internal): none +Other Storage: none +Slots: +Display: 320x240 16-bit color TFT LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, digital camera +Note: + +Model: MI-504 +Manufacturer: Sharp +Nickname/Series: PowerZaurus +Release Date: July 17, 1997 +Availability: Japan +CPU: 30 MHz Hitachi SH3 32-bit CPU +Memory: 1.4 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 16-bit color LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-506 +Manufacturer: Sharp +Nickname/Series: PowerZaurus +Release Date: July 17, 1997 +Availability: Japan +CPU: 30 MHz Hitachi SH3 32-bit CPU +Memory: 3.4 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 16-bit color LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-506DC +Manufacturer: Sharp +Nickname/Series: PowerZaurus +Release Date: July 17, 1997 +Availability: Japan +CPU: 30 MHz Hitachi SH3 32-bit CPU +Memory: 3.4 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 16-bit color LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, digital camera +Note: + +Model: MI-106 +Manufacturer: Sharp +Nickname/Series: ZaurusPocket +Release Date: November 28, 1997 +Availability: Japan +CPU: 30 MHz Hitachi SH3 32-bit CPU +Memory: 6 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-106M +Manufacturer: Sharp +Nickname/Series: ZaurusPocket +Release Date: November 28, 1997 +Availability: Japan +CPU: 30 MHz Hitachi SH3 32-bit CPU +Memory: 6 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-110M +Manufacturer: Sharp +Nickname/Series: ZaurusPocket +Release Date: November 28, 1997 +Availability: Japan +CPU: 30 MHz Hitachi SH3 32-bit CPU +Memory: 10 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-610 +Manufacturer: Sharp +Nickname/Series: PowerZaurus +Release Date: March 3, 1998 +Availability: Japan +CPU: 60 MHz Hitachi SH3 32-bit CPU +Memory: 10 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 16-bit color TFT LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-610DC +Manufacturer: Sharp +Nickname/Series: PowerZaurus +Release Date: March 3, 1998 +Availability: Japan +CPU: 60 MHz Hitachi SH3 32-bit CPU +Memory: 10 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 16-bit color TFT LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, digital camera +Note: + +Model: MI-310 +Manufacturer: Sharp +Nickname/Series: PowerZaurus +Release Date: September 4, 1998 +Availability: Japan +CPU: 66 MHz Hitachi SH3 32-bit CPU +Memory: 10 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 16-bit color reflective TFT LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: No +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-P1-LA +Manufacturer: Sharp +Nickname/Series: Zaurus i-Geti +Release Date: March 20, 1999 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 6 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-P1-A +Manufacturer: Sharp +Nickname/Series: Zaurus i-Geti +Release Date: March 20, 1999 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 6 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-P1-W +Manufacturer: Sharp +Nickname/Series: Zaurus i-Geti +Release Date: March 20, 1999 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 6 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-EX1 +Manufacturer: Sharp +Nickname/Series: Zaurus i-Cruise +Release Date: April 16, 1999 +Availability: Japan +CPU: 120 MHz Hitachi SH3 32-bit CPU +Memory: 8 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 640x480 VGA 16-bit color TFT LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +=== Note: Every MI-series after this point _might_ not be a Hitachi SH3 CPU, best references so far call them RISC 32-bit CPUs... === + +Model: MI-P2-B +Manufacturer: Sharp +Nickname/Series: Zaurus i-Geti +Release Date: July 9, 1999 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 10 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, more internal software +Note: + +Model: MI-TR1 +Manufacturer: Sharp +Nickname/Series: Zaurus i-Cruise (customized) +Release Date: August 1999 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 16 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 640x480 VGA 16-bit color TFT LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-C1-S +Manufacturer: Sharp +Nickname/Series: PowerZaurus +Release Date: December 7, 1999 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 16 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 Super Mobile 16-bit color reflective LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-C1-A +Manufacturer: Sharp +Nickname/Series: PowerZaurus +Release Date: December 7, 1999 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 16 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 Super Mobile 16-bit color reflective LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-P10-S +Manufacturer: Sharp +Nickname/Series: Zaurus i-Geti +Release Date: July 14, 2000 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 16 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen (not backlit) +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, more internal software +Note: + +Model: MI-J1 +Manufacturer: Sharp +Nickname/Series: Internet Dictionary Zaurus +Release Date: August 4, 2000 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 6 MB +Flash (Internal): +Other Storage: none +Slots: +Display: 320x240 grayscale LCD touchscreen +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, more internal software, larger dictionary +Note: + +Model: MI-E1 +Manufacturer: Sharp +Nickname/Series: +Release Date: December 15, 2000 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 16 MB +Flash (Internal): +Other Storage: none +Slots: Smart Disk/Secure Digital/MMC, CompactFlash +Display: 240x320 16-bit color backlit TFT LCD touchscreen (vertical display) +Audio Controller: +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, MP3 player, MPEG4 video playback, headphone jack +Note: + +Model: MI-L1 +Manufacturer: Sharp +Nickname/Series: +Release Date: May 21, 2001 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: 16 MB +Flash (Internal): +Other Storage: none +Slots: Smart Disk/Secure Digital/MMC, CompactFlash +Display: 240x320 16-bit color LCD touchscreen (not backlit, vertical display) +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording +Note: + +Model: MI-E21 +Manufacturer: Sharp +Nickname/Series: +Release Date: September 7, 2001 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU (faster than MI-E1 CPU) +Memory: 32 MB +Flash (Internal): +Other Storage: none +Slots: Smart Disk/Secure Digital/MMC, CompactFlash +Display: 240x320 16-bit color backlit TFT LCD touchscreen (vertical display) +Audio Controller: +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, MP3 player, MPEG4 video playback, headphone jack +Note: + +Model: MI-E25DC +Manufacturer: Sharp +Nickname/Series: +Release Date: March 15, 2002 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU (same as MI-E21) +Memory: 32 MB +Flash (Internal): +Other Storage: none +Slots: Smart Disk/Secure Digital/MMC, CompactFlash +Display: 240x320 16-bit color backlit TFT LCD touchscreen (vertical display) +Audio Controller: +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: IrDA, I/O Port - serial PC Link, internal faxmodem +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, MP3 player, MPEG4 video playback, headphone jack, 640x480 digital camera +Note: + +============================================================================================ + +MT Series +--------- + +Model: MT-200 +Manufacturer: Sharp +Nickname/Series: +Release Date: December 4, 1998 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: unknown +Flash (Internal): +Other Storage: +Slots: +Display: +Audio Controller: +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: +Keyboard: +Features: +Note: The "Communication Pals" or "Browser Boards", not technically Zaurus, basically MI technology with a keyboard on top + +Model: MT-200SA +Manufacturer: Sharp +Nickname/Series: +Release Date: +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: unknown +Flash (Internal): +Other Storage: +Slots: +Display: +Audio Controller: +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: +Keyboard: +Features: +Note: The "Communication Pals" or "Browser Boards", not technically Zaurus, basically MI technology with a keyboard on top + +Model: MT-300 +Manufacturer: Sharp +Nickname/Series: +Release Date: September 9, 1999 +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: unknown +Flash (Internal): +Other Storage: +Slots: +Display: +Audio Controller: +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: +Keyboard: +Features: +Note: The "Communication Pals" or "Browser Boards", not technically Zaurus, basically MI technology with a keyboard on top + +Model: MT-300C +Manufacturer: Sharp +Nickname/Series: +Release Date: +Availability: Japan +CPU: unknown MHz Hitachi SH3 32-bit CPU +Memory: unknown +Flash (Internal): +Other Storage: +Slots: +Display: +Audio Controller: +OS: Sharp ZaurusOS (Axe XTAL microkernel) +I/O: +Keyboard: +Features: +Note: The "Communication Pals" or "Browser Boards", not technically Zaurus, basically MI technology with a keyboard on top + +============================================================================================ + +SL Series +--------- + +Model: SL-5000D +Manufacturer: Sharp +Nickname/Series: Developer Edition +Release Date: 2001 +Availability: World +CPU: 206 MHz Intel SA-1110 StrongARM 32-bit CPU +Memory: 32 MB DRAM +Flash (Internal): 16 MB +Other Storage: none +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 240x320 16-bit color reflective TFT LCD touchscreen +Audio Controller: +OS: Lineo Embedix Plus PDA OS (Linux 2.4), Qtopia GUI, Jeode Java VM +I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, headphone jack +Note: + +Model: SL-5500 +Manufacturer: Sharp +Nickname/Series: Collie +Release Date: March 11, 2002 +Availability: World +CPU: 206 MHz Intel SA-1110 StrongARM 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 16 MB +Other Storage: none +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 240x320 16-bit color reflective TFT LCD touchscreen with front light +Audio Controller: +OS: Lineo Embedix Plus PDA OS (Linux 2.4), Qtopia GUI, Jeode Java VM +I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, headphone jack +Note: + +Model: SL-5500G +Manufacturer: Sharp +Nickname/Series: Collie +Release Date: March 11, 2002 +Availability: Germany? +CPU: 206 MHz Intel SA-1110 StrongARM 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 16 MB +Other Storage: none +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 240x320 16-bit color reflective TFT LCD touchscreen with front light +Audio Controller: +OS: Lineo Embedix Plus PDA OS (Linux 2.4), Qtopia GUI, Jeode Java VM +I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, headphone jack +Note: + +Model: SL-A300 +Manufacturer: Sharp +Nickname/Series: Discovery +Release Date: July 12, 2002 +Availability: Japan +CPU: 200 MHz Intel XScale PXA210 32-bit CPU +Memory: 64 MB DRAM (approx. 32 MB user area) +Flash (Internal): 16 MB +Other Storage: none +Slots: Secure Digital/MMC +Display: 240x320 16-bit color backlit TFT LCD touchscreen +Audio Controller: +OS: Lineo Embedix Plus PDA OS (Linux 2.4), Qtopia GUI, Jeode Java VM +I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link +Keyboard: No +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, headphone jack +Note: + +Model: SL-B500 +Manufacturer: Sharp +Nickname/Series: Poodle +Release Date: December 14, 2002 +Availability: Japan +CPU: 400MHz Intel XScale PXA250 32-bit CPU +Memory: 32 MB DRAM +Flash (Internal): 64 MB +Other Storage: 512KB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 240x320 16-bit color backlit TFT LCD touchscreen +Audio Controller: +OS: Lineo Embedix OS (Linux 2.4), Qtopia GUI +I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack +Note: + +Model: SL-5600 +Manufacturer: Sharp +Nickname/Series: Poodle +Release Date: April 2?, 2002 +Availability: World +CPU: 400MHz Intel XScale PXA250 32-bit CPU +Memory: 32 MB DRAM +Flash (Internal): 64 MB (approx. 33 MB user area) +Other Storage: 512KB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 240x320 16-bit color relective TFT LCD touchscreen with front light +Audio Controller: +OS: Lineo Embedix3 OS (Linux 2.4.18), Qtopia GUI 1.5.0 +I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack +Note: Some have an easily-fixed cache bug on the PXA-250 + +Model: SL-C700 +Manufacturer: Sharp +Nickname/Series: Corgi +Release Date: December 14, 2002 +Availability: Japan +CPU: 206 MHz Intel XScale PXA250 32-bit CPU (underclocked to similar speed as SL-5500?) +Memory: 32 MB DRAM +Flash (Internal): 64 MB +Other Storage: 512KB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: +OS: Lineo Embedix OS (Linux 2.4.18), Qtopia GUI +I/O: IrDA, internal faxmodem, I/O Port - USB PC Link +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, internal speaker/microphone, headphone jack +Note: + +Model: SL-C750 +Manufacturer: Sharp +Nickname/Series: Shepherd +Release Date: 2003 +Availability: Japan +CPU: 400 MHz Intel XScale PXA255 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 64 MB (user area: approx. 30 MB) +Other Storage: 512KB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: +OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM +I/O: IrDA, internal faxmodem, I/O Port - USB PC Link +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, updated software, internal speaker/microphone, headphone jack +Note: + +Model: SL-C760 +Manufacturer: Sharp +Nickname/Series: Husky +Release Date: 2003 +Availability: Japan +CPU: 400 MHz Intel XScale PXA255 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 128 MB (user area: approx. 65 MB) +Other Storage: 512KB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC (possibly SDIO-compatible), CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: +OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM +I/O: IrDA, internal faxmodem, I/O Port - USB PC Link +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, internal speaker/microphone, headphone jack +Note: + +Model: SL-C860 +Manufacturer: Sharp +Nickname/Series: Boxer +Release Date: 2003 +Availability: Japan +CPU: 400 MHz Intel XScale PXA255 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 128 MB (user area: approx. 65 MB) +Other Storage: 512KB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC (possibly SDIO-compatible), CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: +OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM +I/O: IrDA, internal faxmodem, USB Device, I/O Port - USB PC Link +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, English-Japanese translation software, internal speaker/microphone, headphone jack +Note: + +Model: SL-6000N +Manufacturer: Sharp +Nickname/Series: Tosa +Release Date: early 2004 +Availability: World +CPU: 400 MHz Intel XScale PXA255 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 64 MB +Other Storage: 8 MB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: Wolfson WM9712 +OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack +Note: + +Model: HC-6000N +Manufacturer: Sharp +Nickname/Series: +Release Date: early 2004 +Availability: World +CPU: 400 MHz Intel XScale PXA255 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 64 MB +Other Storage: 8 MB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: Wolfson WM9712 +OS: Microsoft Windows Mobile 2003 Second Edition +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack +Note: Clone - Hitachi FLORA-ie MX1 + +Model: SL-6000D +Manufacturer: Sharp +Nickname/Series: Tosa +Release Date: early 2004 +Availability: World +CPU: 400 MHz Intel XScale PXA255 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 64 MB +Other Storage: 8 MB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: Wolfson WM9712 +OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack +Note: + +Model: SL-6000L +Manufacturer: Sharp +Nickname/Series: Tosa +Release Date: early 2004 +Availability: World +CPU: 400 MHz Intel XScale PXA255 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 128 MB +Other Storage: 8 MB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: Wolfson WM9712 +OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack +Note: + +Model: SL-6000W +Manufacturer: Sharp +Nickname/Series: Tosa +Release Date: early 2004 +Availability: World +CPU: 400 MHz Intel XScale PXA255 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 64 MB +Other Storage: 8 MB "rescue" mode NOR P2ROM +Slots: Secure Digital/MMC, CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: Wolfson WM9712 +OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 +Keyboard: Yes +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack +Note: + +Model: SL-C3000 +Manufacturer: Sharp +Nickname/Series: Spitz +Release Date: October 2004 +Availability: Japan +CPU: 416 MHz Intel XScale PXA270 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 16 MB +Other Storage: 4 GB Hitachi MicroDrive +Slots: Secure Digital/MMC (SDIO), CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: Wolfson WM8750 +OS: Lineo uLinux OS, Qtopia GUI +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, overclockable, internal speaker/microphone, headphone jack +Note: + +Model: SL-C1000 +Manufacturer: Sharp +Nickname/Series: Akita +Release Date: March 2005 +Availability: World +CPU: 416 MHz Intel XScale PXA270 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 128 MB +Other Storage: none +Slots: Secure Digital/MMC (possibly SDIO-compatible), CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: +OS: Lineo uLinux OS, Qtopia GUI +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, overclockable, internal speaker/microphone, headphone jack +Note: + +Model: SL-C3100 +Manufacturer: Sharp +Nickname/Series: Borzoi +Release Date: June 2005 +Availability: World +CPU: 416 MHz Intel XScale PXA270 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 128 MB +Other Storage: 8 MB "rescue" mode NOR P2ROM, 4 GB Hitachi MicroDrive +Slots: Secure Digital/MMC (SDIO), CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: Wolfson WM8750 +OS: Lineo uLinux OS, Qtopia GUI +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, overclockable, internal speaker/microphone, headphone jack, dictionary, map, electronic library +Note: + +Model: SL-C3200 +Manufacturer: Sharp +Nickname/Series: Terrier +Release Date: March 17, 2006 +Availability: World +CPU: 416 MHz Intel XScale PXA270 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 128 MB +Other Storage: 6 GB Hitachi MicroDrive +Slots: Secure Digital/MMC (SDIO) up to 4 GB, CompactFlash Type II +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: Wolfson WM8750 +OS: Lineo uLinux OS, Qtopia GUI +I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, overclockable, Nuance text-to-speech, updated dictionary, TOEIC, internal speaker/microphone, headphone jack +Note: + +============================================================================================ + +RD Series +--------- + +Model: RD-CMP2000R +Manufacturer: Sharp +Nickname/Series: +Demo/Press Release Date: October 2006 +Availability: Korea +CPU: unknown 32-bit CPU +Memory: +Flash (Internal): +Other Storage: +Slots: Secure Digital/MMC up to 4 GB +Display: 320x240 16-bit color LCD touchscreen +Audio Controller: +OS: Linux, unknown GUI +I/O: +Keyboard: Yes +Features: 1280x960 1.33 MP camera, electronic dictionary, e-Book reader, FM radio, music player +Note: + +============================================================================================ + +"WS Series" +----------- + +Model: W-ZERO3 WS003SH +Manufacturer: Willcom (mfg. by Sharp) +Nickname/Series: +Release Date: after January 2007 +Availability: Japan +CPU: 416 MHz Intel XScale PXA270 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 128 MB +Other Storage: +Slots: miniSD, W-SIM +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: +OS: Microsoft Windows Mobile 5.0 +I/O: USB PC Link, USB Host, 802.11b WiFi +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, 1280x960 1.33 MP camera, wireless/cellular phone/data features, Internet, email +Note: + +Model: W-ZERO3 WS004SH +Manufacturer: Willcom (mfg. by Sharp) +Nickname/Series: +Release Date: after January 2007 +Availability: Japan +CPU: 416 MHz Intel XScale PXA270 32-bit CPU +Memory: 64 MB DRAM +Flash (Internal): 256 MB (user area about 197MB) +Other Storage: +Slots: miniSD, W-SIM +Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen +Audio Controller: +OS: Microsoft Windows Mobile 5.0 +I/O: USB PC Link, USB Host, 802.11b WiFi +Keyboard: Yes (mini-keyboard) +Features: handwriting recognition, 1280x960 1.33 MP camera, wireless/cellular phone/data features, Internet, email, English-Japanese translation dictionary +Note: + + + +*****************************************************************************************************************************************/ + + +#include "emu.h" +#include "cpu/arm7/arm7.h" +#include "cpu/arm7/arm7core.h" +#include "machine/pxa255.h" + +#define MAIN_CLOCK XTAL_8MHz + +class zaurus_state : public driver_device +{ +public: + zaurus_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, "ram") + { } + + // devices + required_device m_maincpu; + required_shared_ptr m_ram; + + UINT8 m_rtc_tick; + DECLARE_READ32_MEMBER(pxa255_ostimer_r); + DECLARE_WRITE32_MEMBER(pxa255_ostimer_w); + DECLARE_READ32_MEMBER(pxa255_rtc_r); + DECLARE_WRITE32_MEMBER(pxa255_rtc_w); + DECLARE_READ32_MEMBER(pxa255_intc_r); + DECLARE_WRITE32_MEMBER(pxa255_intc_w); + PXA255_OSTMR_Regs m_ostimer_regs; + PXA255_INTC_Regs m_intc_regs; + + void pxa255_ostimer_irq_check(); + void pxa255_update_interrupts(); + void pxa255_set_irq_line(UINT32 line, int irq_state); + TIMER_DEVICE_CALLBACK_MEMBER(rtc_irq_callback); + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +protected: + // driver_device overrides + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); +}; + +#define VERBOSE_LEVEL ( 5 ) + +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine& machine, int n_level, const char* s_fmt, ... ) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[32768]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%s: %s", machine.describe_context(), buf ); + //printf( "%s: %s", machine.describe_context(), buf ); + } +} + + +void zaurus_state::video_start() +{ +} + +UINT32 zaurus_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) +{ + return 0; +} + +void zaurus_state::pxa255_update_interrupts() +{ + PXA255_INTC_Regs *intc_regs = &m_intc_regs; + + intc_regs->icfp = (intc_regs->icpr & intc_regs->icmr) & intc_regs->iclr; + intc_regs->icip = (intc_regs->icpr & intc_regs->icmr) & (~intc_regs->iclr); + m_maincpu->set_input_line(ARM7_FIRQ_LINE, intc_regs->icfp ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(ARM7_IRQ_LINE, intc_regs->icip ? ASSERT_LINE : CLEAR_LINE); +} + +void zaurus_state::pxa255_set_irq_line(UINT32 line, int irq_state) +{ + PXA255_INTC_Regs *intc_regs = &m_intc_regs; + + intc_regs->icpr &= ~line; + intc_regs->icpr |= irq_state ? line : 0; + //printf( "Setting IRQ line %08x to %d\n", line, irq_state ); + pxa255_update_interrupts(); +} + +void zaurus_state::pxa255_ostimer_irq_check() +{ + PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; + +// logerror("%08x OStimer irq check\n",ostimer_regs->oier); + + pxa255_set_irq_line(PXA255_INT_OSTIMER0, (ostimer_regs->oier & PXA255_OIER_E0) ? ((ostimer_regs->ossr & PXA255_OSSR_M0) ? 1 : 0) : 0); + //pxa255_set_irq_line(PXA255_INT_OSTIMER1, (ostimer_regs->oier & PXA255_OIER_E1) ? ((ostimer_regs->ossr & PXA255_OSSR_M1) ? 1 : 0) : 0); + //pxa255_set_irq_line(PXA255_INT_OSTIMER2, (ostimer_regs->oier & PXA255_OIER_E2) ? ((ostimer_regs->ossr & PXA255_OSSR_M2) ? 1 : 0) : 0); + //pxa255_set_irq_line(PXA255_INT_OSTIMER3, (ostimer_regs->oier & PXA255_OIER_E3) ? ((ostimer_regs->ossr & PXA255_OSSR_M3) ? 1 : 0) : 0); +} + +READ32_MEMBER(zaurus_state::pxa255_ostimer_r) +{ + PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; + + switch(PXA255_OSTMR_BASE_ADDR | (offset << 2)) + { + case PXA255_OSMR0: + if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Match Register 0: %08x & %08x\n", ostimer_regs->osmr[0], mem_mask ); + return ostimer_regs->osmr[0]; + case PXA255_OSMR1: + if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Match Register 1: %08x & %08x\n", ostimer_regs->osmr[1], mem_mask ); + return ostimer_regs->osmr[1]; + case PXA255_OSMR2: + if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Match Register 2: %08x & %08x\n", ostimer_regs->osmr[2], mem_mask ); + return ostimer_regs->osmr[2]; + case PXA255_OSMR3: + if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Match Register 3: %08x & %08x\n", ostimer_regs->osmr[3], mem_mask ); + return ostimer_regs->osmr[3]; + case PXA255_OSCR: + if (0) verboselog( machine(), 4, "pxa255_ostimer_r: OS Timer Count Register: %08x & %08x\n", ostimer_regs->oscr, mem_mask ); + // free-running 3.something MHz counter. this is a complete hack. + ostimer_regs->oscr += 0x300; + return ostimer_regs->oscr; + case PXA255_OSSR: + if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Status Register: %08x & %08x\n", ostimer_regs->ossr, mem_mask ); + return ostimer_regs->ossr; + case PXA255_OWER: + if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Watchdog Match Enable Register: %08x & %08x\n", ostimer_regs->ower, mem_mask ); + return ostimer_regs->ower; + case PXA255_OIER: + if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Interrupt Enable Register: %08x & %08x\n", ostimer_regs->oier, mem_mask ); + return ostimer_regs->oier; + default: + if (0) verboselog( machine(), 0, "pxa255_ostimer_r: Unknown address: %08x\n", PXA255_OSTMR_BASE_ADDR | (offset << 2)); + break; + } + return 0; +} + +WRITE32_MEMBER(zaurus_state::pxa255_ostimer_w) +{ + PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; + + switch(PXA255_OSTMR_BASE_ADDR | (offset << 2)) + { + case PXA255_OSMR0: + if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Match Register 0: %08x & %08x\n", data, mem_mask ); + ostimer_regs->osmr[0] = data; + if(ostimer_regs->oier & PXA255_OIER_E0) + { + attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[0] - ostimer_regs->oscr); + + //printf( "Adjusting one-shot timer to 200MHz * %08x\n", ostimer_regs->osmr[0]); + ostimer_regs->timer[0]->adjust(period); + } + break; + case PXA255_OSMR1: + if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Match Register 1: %08x & %08x\n", data, mem_mask ); + ostimer_regs->osmr[1] = data; + if(ostimer_regs->oier & PXA255_OIER_E1) + { + attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[1] - ostimer_regs->oscr); + + ostimer_regs->timer[1]->adjust(period, 1); + } + break; + case PXA255_OSMR2: + if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Match Register 2: %08x & %08x\n", data, mem_mask ); + ostimer_regs->osmr[2] = data; + if(ostimer_regs->oier & PXA255_OIER_E2) + { + attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[2] - ostimer_regs->oscr); + + ostimer_regs->timer[2]->adjust(period, 2); + } + break; + case PXA255_OSMR3: + if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Match Register 3: %08x & %08x\n", data, mem_mask ); + ostimer_regs->osmr[3] = data; + if(ostimer_regs->oier & PXA255_OIER_E3) + { + //attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[3] - ostimer_regs->oscr); + + //ostimer_regs->timer[3]->adjust(period, 3); + } + break; + case PXA255_OSCR: + if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Count Register: %08x & %08x\n", data, mem_mask ); + ostimer_regs->oscr = data; + break; + case PXA255_OSSR: + if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Status Register: %08x & %08x\n", data, mem_mask ); + ostimer_regs->ossr &= ~data; + pxa255_ostimer_irq_check(); + break; + case PXA255_OWER: + if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Watchdog Enable Register: %08x & %08x\n", data, mem_mask ); + ostimer_regs->ower = data & 0x00000001; + break; + case PXA255_OIER: + { + int index = 0; + if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Interrupt Enable Register: %08x & %08x\n", data, mem_mask ); + ostimer_regs->oier = data & 0x0000000f; + for(index = 0; index < 4; index++) + { + if(ostimer_regs->oier & (1 << index)) + { + //attotime period = attotime::from_hz(200000000) * ostimer_regs->osmr[index]; + + //ostimer_regs->timer[index]->adjust(period, index); + } + } + + break; + } + default: + verboselog( machine(), 0, "pxa255_ostimer_w: Unknown address: %08x = %08x & %08x\n", PXA255_OSTMR_BASE_ADDR | (offset << 2), data, mem_mask); + break; + } +} + +READ32_MEMBER(zaurus_state::pxa255_intc_r) +{ + PXA255_INTC_Regs *intc_regs = &m_intc_regs; + + switch(PXA255_INTC_BASE_ADDR | (offset << 2)) + { + case PXA255_ICIP: + if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller IRQ Pending Register: %08x & %08x\n", intc_regs->icip, mem_mask ); + return intc_regs->icip; + case PXA255_ICMR: + if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller Mask Register: %08x & %08x\n", intc_regs->icmr, mem_mask ); + return intc_regs->icmr; + case PXA255_ICLR: + if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller Level Register: %08x & %08x\n", intc_regs->iclr, mem_mask ); + return intc_regs->iclr; + case PXA255_ICFP: + if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller FIQ Pending Register: %08x & %08x\n", intc_regs->icfp, mem_mask ); + return intc_regs->icfp; + case PXA255_ICPR: + if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller Pending Register: %08x & %08x\n", intc_regs->icpr, mem_mask ); + return intc_regs->icpr; + case PXA255_ICCR: + if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller Control Register: %08x & %08x\n", intc_regs->iccr, mem_mask ); + return intc_regs->iccr; + default: + verboselog( machine(), 0, "pxa255_intc_r: Unknown address: %08x\n", PXA255_INTC_BASE_ADDR | (offset << 2)); + break; + } + return 0; +} + +WRITE32_MEMBER(zaurus_state::pxa255_intc_w) +{ + PXA255_INTC_Regs *intc_regs = &m_intc_regs; + + switch(PXA255_INTC_BASE_ADDR | (offset << 2)) + { + case PXA255_ICIP: + verboselog( machine(), 3, "pxa255_intc_w: (Invalid Write) Interrupt Controller IRQ Pending Register: %08x & %08x\n", data, mem_mask ); + break; + case PXA255_ICMR: + if (0) verboselog( machine(), 3, "pxa255_intc_w: Interrupt Controller Mask Register: %08x & %08x\n", data, mem_mask ); + intc_regs->icmr = data & 0xfffe7f00; + break; + case PXA255_ICLR: + if (0) verboselog( machine(), 3, "pxa255_intc_w: Interrupt Controller Level Register: %08x & %08x\n", data, mem_mask ); + intc_regs->iclr = data & 0xfffe7f00; + break; + case PXA255_ICFP: + if (0) verboselog( machine(), 3, "pxa255_intc_w: (Invalid Write) Interrupt Controller FIQ Pending Register: %08x & %08x\n", data, mem_mask ); + break; + case PXA255_ICPR: + if (0) verboselog( machine(), 3, "pxa255_intc_w: (Invalid Write) Interrupt Controller Pending Register: %08x & %08x\n", data, mem_mask ); + break; + case PXA255_ICCR: + if (0) verboselog( machine(), 3, "pxa255_intc_w: Interrupt Controller Control Register: %08x & %08x\n", data, mem_mask ); + intc_regs->iccr = data & 0x00000001; + break; + default: + verboselog( machine(), 0, "pxa255_intc_w: Unknown address: %08x = %08x & %08x\n", PXA255_INTC_BASE_ADDR | (offset << 2), data, mem_mask); + break; + } +} + +READ32_MEMBER(zaurus_state::pxa255_rtc_r) +{ + printf("%08x\n",offset << 2); + + return 0; +} + +WRITE32_MEMBER(zaurus_state::pxa255_rtc_w) +{ + printf("%08x %08x\n",offset << 2,data); + +} + +static ADDRESS_MAP_START( zaurus_map, AS_PROGRAM, 32, zaurus_state ) + AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_REGION("firmware", 0) + AM_RANGE(0x40900000, 0x4090000f) AM_READWRITE(pxa255_rtc_r,pxa255_rtc_w) + AM_RANGE(0x40a00000, 0x40a0001f) AM_READWRITE(pxa255_ostimer_r, pxa255_ostimer_w ) + AM_RANGE(0x40d00000, 0x40d00017) AM_READWRITE(pxa255_intc_r, pxa255_intc_w ) + AM_RANGE(0xa0000000, 0xa07fffff) AM_RAM AM_SHARE("ram") +ADDRESS_MAP_END + + +static INPUT_PORTS_START( zaurus ) +INPUT_PORTS_END + + + +void zaurus_state::machine_start() +{ +} + +void zaurus_state::machine_reset() +{ +} + + +/* TODO: Hack */ +TIMER_DEVICE_CALLBACK_MEMBER(zaurus_state::rtc_irq_callback) +{ + #if 0 + m_rtc_tick++; + m_rtc_tick&=1; + + if(m_rtc_tick & 1) + pxa255_set_irq_line(PXA255_INT_RTC_HZ,1); + else + pxa255_set_irq_line(PXA255_INT_RTC_HZ,0); + #endif +} + +// TODO: main CPU differs greatly between versions! +static MACHINE_CONFIG_START( zaurus, zaurus_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",PXA255,MAIN_CLOCK) + MCFG_CPU_PROGRAM_MAP(zaurus_map) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("rtc_timer", zaurus_state, rtc_irq_callback, attotime::from_hz(XTAL_32_768kHz)) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_UPDATE_DRIVER(zaurus_state, screen_update) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + + MCFG_PALETTE_ADD("palette", 8) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") +// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) +// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +/* was labeled SL-C500 */ +ROM_START( zsl5500 ) + ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) + ROM_LOAD( "sl-c500 v1.20 (zimage).bin", 0x000000, 0x13c000, BAD_DUMP CRC(dc1c259f) SHA1(8150744196a72821ae792462d0381182274c2ce0) ) +ROM_END + +ROM_START( zsl5600 ) + ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) + ROM_LOAD( "zaurus sl-b500 - 5600 (zimage).bin", 0x000000, 0x11b6b0, BAD_DUMP CRC(779c70a1) SHA1(26824e3dc563b681f195029f220dfaa405613f9e) ) +ROM_END + +ROM_START( zslc750 ) + ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) + ROM_LOAD( "zaurus sl-c750 (zimage).bin", 0x000000, 0x121544, BAD_DUMP CRC(56353f4d) SHA1(8e1fff6e93d560bd6572c5c163bbd81378693f68) ) +ROM_END + +ROM_START( zslc760 ) + ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) + ROM_LOAD( "zaurus sl-c760 (zimage).bin", 0x000000, 0x120b44, BAD_DUMP CRC(feedcba3) SHA1(1821ad0fc03a8c3832ad5fe2221c21c1ca277508) ) +ROM_END + +ROM_START( zslc3000 ) + ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) + ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c3000-20050428091110.bin", 0x000000, 0x12828c, BAD_DUMP CRC(fd94510d) SHA1(901f8154b4228a448f5551f0c9f21c2153e1e3a1) ) +ROM_END + +ROM_START( zslc1000 ) + ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) + ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c1000-20050427214434.bin", 0x000000, 0x128980, BAD_DUMP CRC(1e1a9279) SHA1(909ac3f00385eced55822d6a155b79d9d25f43b3) ) +ROM_END + +COMP( 2002, zsl5500, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-5500 \"Collie\"", MACHINE_IS_SKELETON ) +COMP( 2002, zsl5600, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-5600 / SL-B500 \"Poodle\"", MACHINE_IS_SKELETON ) +COMP( 2003, zslc750, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-C750 \"Shepherd\" (Japan)", MACHINE_IS_SKELETON ) +COMP( 2004, zslc760, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-C760 \"Husky\" (Japan)", MACHINE_IS_SKELETON ) +COMP( 200?, zslc3000, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-C3000 \"Spitz\" (Japan)", MACHINE_IS_SKELETON ) +COMP( 200?, zslc1000, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-C3000 \"Akita\" (Japan)", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/zexall.c b/src/mame/drivers/zexall.c new file mode 100644 index 00000000000..553f65613f7 --- /dev/null +++ b/src/mame/drivers/zexall.c @@ -0,0 +1,171 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu, Robbbert +/****************************************************************************** +* +* Self Contained zexall 'Z80 instruction exerciser' test driver +* Zexall originally written by Frank Cringle for ZX Spectrum +* Modularized Spectrum-independent Zexall binary supplied by Blargg +* Serial interface binary/preloader at 0x0000-0x00FF written by Kevin 'kevtris' Horton +* +* +* mem map: +Ram 0000-FFFF (preloaded with binary) +Special calls take place for three ram values (this interface was designed by kevtris): +FFFD - 'ack' - shared ram with output device; z80 reads from here and considers the byte at FFFF read if this value incremented +FFFE - 'req' - shared ram with output device; z80 writes an incrementing value to FFFE to indicate that there is a byte waiting at FFFF and hence requesting the output device on the other end do something about it, until FFFD is incremented by the output device to acknowledge receipt +FFFF - 'data' - shared ram with output device; z80 writes the data to be sent to output device here +One i/o port is used: +0001 - bit 0 controls whether interrupt timer is enabled (1) or not (0), this is a holdover from a project of kevtris' and can be ignored. + +******************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class zexall_state : public driver_device +{ +public: + zexall_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_main_ram(*this, "main_ram") + { + } + + DECLARE_READ8_MEMBER( zexall_output_ack_r ); + DECLARE_READ8_MEMBER( zexall_output_req_r ); + DECLARE_READ8_MEMBER( zexall_output_data_r ); + DECLARE_WRITE8_MEMBER( zexall_output_ack_w ); + DECLARE_WRITE8_MEMBER( zexall_output_req_w ); + DECLARE_WRITE8_MEMBER( zexall_output_data_w ); + DECLARE_DRIVER_INIT(zexall); +private: + required_device m_maincpu; + required_device m_terminal; + required_shared_ptr m_main_ram; + UINT8 m_out_data; // byte written to 0xFFFF + UINT8 m_out_req; // byte written to 0xFFFE + UINT8 m_out_req_last; // old value at 0xFFFE before the most recent write + UINT8 m_out_ack; // byte written to 0xFFFC + virtual void machine_reset(); +}; + +DRIVER_INIT_MEMBER(zexall_state,zexall) +{ + m_out_ack = 0; + m_out_req = 0; + m_out_req_last = 0; + m_out_data = 0; +} + +void zexall_state::machine_reset() +{ +// rom is self-modifying, so need to refresh it on each run + UINT8 *rom = memregion("romcode")->base(); + UINT8 *ram = m_main_ram; + /* fill main ram with zexall code */ + memcpy(ram, rom, 0x228a); +} + +READ8_MEMBER( zexall_state::zexall_output_ack_r ) +{ +// spit out the byte in out_byte if out_req is not equal to out_req_last + if (m_out_req != m_out_req_last) + { + m_terminal->write(space,0,m_out_data); + fprintf(stderr,"%c",m_out_data); + m_out_req_last = m_out_req; + m_out_ack++; + } + return m_out_ack; +} + +WRITE8_MEMBER( zexall_state::zexall_output_ack_w ) +{ + m_out_ack = data; +} + +READ8_MEMBER( zexall_state::zexall_output_req_r ) +{ + return m_out_req; +} + +WRITE8_MEMBER( zexall_state::zexall_output_req_w ) +{ + m_out_req_last = m_out_req; + m_out_req = data; +} + +READ8_MEMBER( zexall_state::zexall_output_data_r ) +{ + return m_out_data; +} + +WRITE8_MEMBER( zexall_state::zexall_output_data_w ) +{ + m_out_data = data; +} + +/****************************************************************************** + Address Maps +******************************************************************************/ + +static ADDRESS_MAP_START(z80_mem, AS_PROGRAM, 8, zexall_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0xfffc) AM_RAM AM_SHARE("main_ram") + AM_RANGE(0xfffd, 0xfffd) AM_READWRITE(zexall_output_ack_r,zexall_output_ack_w) + AM_RANGE(0xfffe, 0xfffe) AM_READWRITE(zexall_output_req_r,zexall_output_req_w) + AM_RANGE(0xffff, 0xffff) AM_READWRITE(zexall_output_data_r,zexall_output_data_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(z80_io, AS_IO, 8, zexall_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0001, 0x0001) AM_NOP // really a disable/enable for some sort of interrupt timer on kev's hardware, which is completely irrelevant for the zexall test +ADDRESS_MAP_END + + +/****************************************************************************** + Input Ports +******************************************************************************/ +static INPUT_PORTS_START( zexall ) +INPUT_PORTS_END + +/****************************************************************************** + Machine Drivers +******************************************************************************/ + +static MACHINE_CONFIG_START( zexall, zexall_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz*10) + MCFG_CPU_PROGRAM_MAP(z80_mem) + MCFG_CPU_IO_MAP(z80_io) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) +MACHINE_CONFIG_END + + + +/****************************************************************************** + ROM Definitions +******************************************************************************/ + +ROM_START(zexall) + ROM_REGION(0x22ff, "romcode", 0) + ROM_LOAD("zex.bin", 0x0000, 0x2289, CRC(77e0a1df) SHA1(cc8f84724e3837783816d92a6dfb8e5975232c66)) +ROM_END + + + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 2009, zexall, 0, 0, zexall, zexall, zexall_state, zexall, "Frank Cringle & MESSDEV", "ZEXALL Z80 instruction set exerciser (modified for MESS)", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/zorba.c b/src/mame/drivers/zorba.c new file mode 100644 index 00000000000..2b0a9aed58d --- /dev/null +++ b/src/mame/drivers/zorba.c @@ -0,0 +1,432 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/************************************************************************************************************ + +Telcon Zorba + +2013-08-25 Skeleton + +This was one of the last CP/M-based systems, already out of date when it was released. +Because it doesn't use the standard Z80 peripherals, it uses a homebrew interrupt controller to make use + of the Z80's IM2. + +The keyboard is an intelligent serial device like the Kaypro's keyboard. They even have the same plug, +and might be swappable. Need a schematic. + +Instead of using a daisy chain, the IM2 vectors are calculated by a prom (u77). Unfortunately, the prom +contents make no sense at all (mostly FF), so the vectors for IRQ0 and IRQ2 are hard-coded. Other IRQ +vectors are not used as yet. + +Status: +- Boots up, and the keyboard works + +ToDo: +- Need software that does more than plain text (such as games) +- Add masking feature (only used for the UARTs) +- Connect devices to the above hardware +- Fix the display +- Connect the PIT to the UARTs +- Replace the ascii keyboard with the real one, if possible +- Probably lots of other things + + +*************************************************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/m6805/m6805.h" +#include "machine/i8251.h" +#include "machine/6821pia.h" +#include "machine/z80dma.h" +#include "machine/pit8253.h" +#include "video/i8275.h" +#include "sound/beep.h" +#include "machine/keyboard.h" +#include "machine/wd_fdc.h" + + +class zorba_state : public driver_device +{ +public: + zorba_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_beep(*this, "beeper") + , m_dma(*this, "dma") + , m_u0(*this, "uart0") + , m_u1(*this, "uart1") + , m_u2(*this, "uart2") + , m_pia0(*this, "pia0") + , m_pia1(*this, "pia1") + , m_crtc(*this, "crtc") + , m_fdc (*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + {} + +public: + const UINT8 *m_p_chargen; + DECLARE_DRIVER_INIT(zorba); + DECLARE_MACHINE_RESET(zorba); + DECLARE_READ8_MEMBER(ram_r); + DECLARE_WRITE8_MEMBER(ram_w); + DECLARE_READ8_MEMBER(rom_r); + DECLARE_WRITE8_MEMBER(rom_w); + DECLARE_WRITE8_MEMBER(intmask_w); + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + DECLARE_WRITE8_MEMBER(pia0_porta_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE_LINE_MEMBER(irq0_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + I8275_DRAW_CHARACTER_MEMBER(zorba_update_chr); + required_device m_palette; + +private: + UINT8 m_term_data; + UINT8 m_fdc_rq; + required_device m_maincpu; + required_device m_beep; + required_device m_dma; + required_device m_u0; + required_device m_u1; + required_device m_u2; + required_device m_pia0; + required_device m_pia1; + required_device m_crtc; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; +}; + +static ADDRESS_MAP_START( zorba_mem, AS_PROGRAM, 8, zorba_state ) + AM_RANGE( 0x0000, 0x3fff ) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE( 0x4000, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( zorba_kbdmem, AS_PROGRAM, 8, zorba_state ) + ADDRESS_MAP_GLOBAL_MASK(0x7ff) + AM_RANGE( 0x000, 0x07f ) AM_RAM // internal RAM + AM_RANGE( 0x080, 0x7ff ) AM_ROM // internal EPROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( zorba_io, AS_IO, 8, zorba_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit", pit8254_device, read, write) + AM_RANGE(0x04, 0x04) AM_READWRITE(rom_r,rom_w) + AM_RANGE(0x05, 0x05) AM_READWRITE(ram_r,ram_w) + AM_RANGE(0x10, 0x11) AM_DEVREADWRITE("crtc", i8275_device, read, write) + AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("uart0", i8251_device, data_r, data_w) + AM_RANGE(0x21, 0x21) AM_DEVREADWRITE("uart0", i8251_device, status_r, control_w) + AM_RANGE(0x22, 0x22) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) + AM_RANGE(0x23, 0x23) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) + //AM_RANGE(0x24, 0x24) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w) + //AM_RANGE(0x25, 0x25) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w) + AM_RANGE(0x24, 0x25) AM_READ(keyboard_r) AM_WRITENOP + AM_RANGE(0x26, 0x26) AM_WRITE(intmask_w) + AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("dma", z80dma_device, read, write) + AM_RANGE(0x40, 0x43) AM_DEVREADWRITE("fdc", fd1793_t, read, write) + AM_RANGE(0x50, 0x53) AM_DEVREADWRITE("pia0", pia6821_device, read, write) + AM_RANGE(0x60, 0x63) AM_DEVREADWRITE("pia1", pia6821_device, read, write) +ADDRESS_MAP_END + +READ8_MEMBER( zorba_state::ram_r ) +{ + membank("bankr0")->set_entry(0); + return 0; +} + +WRITE8_MEMBER( zorba_state::ram_w ) +{ + membank("bankr0")->set_entry(0); +} + +READ8_MEMBER( zorba_state::rom_r ) +{ + membank("bankr0")->set_entry(1); + return 0; +} + +WRITE8_MEMBER( zorba_state::rom_w ) +{ + membank("bankr0")->set_entry(1); +} + +WRITE_LINE_MEMBER( zorba_state::irq0_w ) +{ + if (state) + { + m_maincpu->set_input_line_vector(0, 0x88); + m_maincpu->set_input_line(0, ASSERT_LINE); + } + else + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +WRITE_LINE_MEMBER( zorba_state::fdc_intrq_w ) +{ + m_fdc_rq = (m_fdc_rq & 2) | state; + if (m_fdc_rq == 1) + { + m_maincpu->set_input_line_vector(0, 0x80); + m_maincpu->set_input_line(0, ASSERT_LINE); + } + else + if (m_fdc_rq == 0) + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +WRITE_LINE_MEMBER( zorba_state::fdc_drq_w ) +{ + m_fdc_rq = (m_fdc_rq & 1) | (state << 1); + if (m_fdc_rq == 2) + { + m_maincpu->set_input_line_vector(0, 0x80); + m_maincpu->set_input_line(0, ASSERT_LINE); + } + else + if (m_fdc_rq == 0) + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +WRITE8_MEMBER( zorba_state::intmask_w ) +{ +} + +static INPUT_PORTS_START( zorba ) +INPUT_PORTS_END + +DRIVER_INIT_MEMBER( zorba_state, zorba ) +{ + UINT8 *main = memregion("maincpu")->base(); + + membank("bankr0")->configure_entry(0, &main[0x0000]); + membank("bankr0")->configure_entry(1, &main[0x10000]); + membank("bankw0")->configure_entry(0, &main[0x0000]); +} + +//------------------------------------------------- +// Z80DMA +//------------------------------------------------- + +WRITE_LINE_MEMBER( zorba_state::busreq_w ) +{ +// since our Z80 has no support for BUSACK, we assume it is granted immediately + m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); + m_dma->bai_w(state); // tell dma that bus has been granted +} + +READ8_MEMBER(zorba_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(zorba_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset, data); +} + +READ8_MEMBER(zorba_state::io_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(zorba_state::io_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + + if (offset == 0x10) + { + m_crtc->dack_w(space, 0, data); + } + else + { + prog_space.write_byte(offset, data); + } +} + + +static SLOT_INTERFACE_START( zorba_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + +WRITE8_MEMBER( zorba_state::pia0_porta_w ) +{ + m_beep->set_state(BIT(data, 7)); + m_fdc->dden_w(BIT(data, 6)); + + floppy_image_device *floppy = NULL; + if (!BIT(data, 0)) floppy = m_floppy0->get_device(); + if (!BIT(data, 1)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + floppy->ss_w(!BIT(data, 5)); + + m_floppy0->get_device()->mon_w(BIT(data, 4)); + m_floppy1->get_device()->mon_w(BIT(data, 4)); +} + +I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) +{ + int i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + UINT8 gfx = m_p_chargen[(linecount & 15) + (charcode << 4) + ((gpa & 1) << 11)]; + + if (vsp) + gfx = 0; + + if (lten) + gfx = 0xff; + + if (rvv) + gfx ^= 0xff; + + for(i=0;i<8;i++) + bitmap.pix32(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; +} + + +/* F4 Character Displayer */ +static const gfx_layout u5_charlayout = +{ + 8, 11, /* 8 x 11 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( zorba ) + GFXDECODE_ENTRY( "chargen", 0x0000, u5_charlayout, 0, 1 ) +GFXDECODE_END + +MACHINE_RESET_MEMBER( zorba_state, zorba ) +{ + m_fdc_rq = 0; + m_beep->set_frequency(800); + m_p_chargen = memregion("chargen")->base(); + membank("bankr0")->set_entry(1); // point at rom + membank("bankw0")->set_entry(0); // always write to ram + m_maincpu->reset(); +} + +READ8_MEMBER( zorba_state::keyboard_r ) +{ + if (offset) + return (m_term_data) ? 0x87 : 0x85; + + UINT8 data = m_term_data; + m_term_data = 0; + return data; +} + +WRITE8_MEMBER( zorba_state::kbd_put ) +{ + m_term_data = data; +} + +static MACHINE_CONFIG_START( zorba, zorba_state ) + // basic machine hardware + MCFG_CPU_ADD("maincpu", Z80, XTAL_24MHz / 6) + MCFG_CPU_PROGRAM_MAP(zorba_mem) + MCFG_CPU_IO_MAP(zorba_io) + MCFG_MACHINE_RESET_OVERRIDE(zorba_state, zorba) + + /* keyboard */ + MCFG_CPU_ADD("kbdcpu", M68705, XTAL_3_579545MHz) // MC68705P3S (0x80 bytes ram, 0x780 bytes of rom) + MCFG_CPU_PROGRAM_MAP(zorba_kbdmem) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", zorba) + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_24MHz/6) + // busack on cpu connects to bai pin + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(zorba_state, busreq_w)) //connects to busreq on cpu + MCFG_Z80DMA_OUT_INT_CB(WRITELINE(zorba_state, irq0_w)) // connects to IRQ0 on IM2 controller + //ba0 - not connected + MCFG_Z80DMA_IN_MREQ_CB(READ8(zorba_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(zorba_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(zorba_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(zorba_state, io_write_byte)) + + MCFG_DEVICE_ADD("uart0", I8251, 0) // U32 COM port J2 + + MCFG_DEVICE_ADD("uart1", I8251, 0) // U31 printer port J3 + + MCFG_DEVICE_ADD("uart2", I8251, 0) // U30 serial keyboard J6 + + // port A - disk select etc, beeper + // port B - parallel interface + MCFG_DEVICE_ADD("pia0", PIA6821, 0) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(zorba_state, pia0_porta_w)) + + // IEEE488 interface + MCFG_DEVICE_ADD("pia1", PIA6821, 0) + + MCFG_DEVICE_ADD("pit", PIT8254, 0) + MCFG_PIT8253_CLK0(XTAL_24MHz / 3) /* Timer 0: clock to J2 comm port */ + MCFG_PIT8253_CLK1(XTAL_24MHz / 3) /* Timer 1: clock to U31 */ + MCFG_PIT8253_CLK2(XTAL_24MHz / 3) /* Timer 2: clock to U30 */ + + MCFG_DEVICE_ADD("crtc", I8275, XTAL_14_31818MHz/7) + MCFG_I8275_CHARACTER_WIDTH(8) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(zorba_state, zorba_update_chr) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) + MCFG_I8275_IRQ_CALLBACK(WRITELINE(zorba_state, irq0_w)) + MCFG_FD1793_ADD("fdc", XTAL_24MHz / 24) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(zorba_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(zorba_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + /* Keyboard */ + MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(zorba_state, kbd_put)) +MACHINE_CONFIG_END + +ROM_START( zorba ) + ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "780000.u47", 0x10000, 0x1000, CRC(6d58f2c5) SHA1(7763f08c801cd36e5a761c6dc9f30a50b3bc482d) ) + + ROM_REGION( 0x800, "kbdcpu", 0 ) + ROM_LOAD( "8999-1 3-28-83", 0x080, 0x780, CRC(79fe6c0d) SHA1(4b6fca9379d5199d1347ad1187cbfdebfc4c73e7) ) + + ROM_REGION( 0x1000, "chargen", 0 ) + ROM_LOAD( "773000.u5", 0x0000, 0x1000, CRC(d0a2f8fc) SHA1(29aee7ee657778c46e9800abd4955e6d4b33ef68) ) + + ROM_REGION( 0x60, "proms", 0 ) + ROM_LOAD( "74ls288.u37", 0x0000, 0x0020, CRC(0a67edd6) SHA1(c1ece8978a3a061e0130d43907fa63a71e75e75d) ) + ROM_LOAD( "74ls288.u38", 0x0020, 0x0020, CRC(5ec93ea7) SHA1(3a84c098474b05d5cbe1939a3e15f66d06470581) ) + ROM_LOAD( "74ls288.u77", 0x0040, 0x0020, CRC(946e03b0) SHA1(24240bdd7bdf507a5b51628fb36ad1266fc53a28) ) // suspected bad dump +ROM_END + +COMP( 1982, zorba, 0, 0, zorba, zorba, zorba_state, zorba, "Telcon Industries", "Zorba", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/zrt80.c b/src/mame/drivers/zrt80.c new file mode 100644 index 00000000000..fa192a2050a --- /dev/null +++ b/src/mame/drivers/zrt80.c @@ -0,0 +1,323 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + DEC ZRT-80 + + 12/05/2009 Skeleton driver. + + 16/02/2011 Working. + + The beeper is external, frequency not known. I've made a reasonable + assumption of frequency and lengths. + + Make sure 'mode' dipswitch is set to 'local' so you can see your + typing. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/mc6845.h" +#include "machine/ins8250.h" +#include "machine/keyboard.h" +#include "sound/beep.h" + +#define KEYBOARD_TAG "keyboard" + +class zrt80_state : public driver_device +{ +public: + enum + { + TIMER_BEEP_OFF + }; + + zrt80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "crtc"), + m_8250(*this, "ins8250"), + m_beep(*this, "beeper"), + m_palette(*this, "palette") + { + } + + DECLARE_READ8_MEMBER(zrt80_10_r); + DECLARE_WRITE8_MEMBER(zrt80_30_w); + DECLARE_WRITE8_MEMBER(zrt80_38_w); + DECLARE_WRITE8_MEMBER(kbd_put); + MC6845_UPDATE_ROW(crtc_update_row); + const UINT8 *m_p_chargen; + required_shared_ptr m_p_videoram; +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +private: + UINT8 m_term_data; + virtual void machine_reset(); + virtual void video_start(); + required_device m_maincpu; + required_device m_crtc; + required_device m_8250; + required_device m_beep; +public: + required_device m_palette; +}; + + +READ8_MEMBER( zrt80_state::zrt80_10_r ) +{ + UINT8 ret = m_term_data; + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + return ret; +} + +void zrt80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BEEP_OFF: + m_beep->set_state(0); + break; + default: + assert_always(FALSE, "Unknown id in zrt80_state::device_timer"); + } +} + + +WRITE8_MEMBER(zrt80_state::zrt80_30_w) +{ + timer_set(attotime::from_msec(100), TIMER_BEEP_OFF); + m_beep->set_state(1); +} + +WRITE8_MEMBER(zrt80_state::zrt80_38_w) +{ + timer_set(attotime::from_msec(400), TIMER_BEEP_OFF); + m_beep->set_state(1); +} + +static ADDRESS_MAP_START(zrt80_mem, AS_PROGRAM, 8, zrt80_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x0fff) AM_ROM // Z25 - Main firmware + AM_RANGE(0x1000, 0x1fff) AM_ROM // Z24 - Expansion + AM_RANGE(0x4000, 0x43ff) AM_RAM // Board RAM + // Normally video RAM is 0x800 but could be expanded up to 8K + AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("videoram") // Video RAM + +ADDRESS_MAP_END + +static ADDRESS_MAP_START( zrt80_io, AS_IO, 8, zrt80_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x07) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w ) + AM_RANGE(0x08, 0x08) AM_DEVWRITE("crtc", mc6845_device, address_w) + AM_RANGE(0x09, 0x09) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0x10, 0x17) AM_READ(zrt80_10_r) + AM_RANGE(0x18, 0x1F) AM_READ_PORT("DIPSW2") + AM_RANGE(0x20, 0x27) AM_READ_PORT("DIPSW3") + AM_RANGE(0x30, 0x37) AM_WRITE(zrt80_30_w) + AM_RANGE(0x38, 0x3F) AM_WRITE(zrt80_38_w) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( zrt80 ) + PORT_START("DIPSW1") + PORT_DIPNAME( 0x01, 0x01, "Composite Sync" ) + PORT_DIPSETTING( 0x01, "Negative" ) + PORT_DIPSETTING( 0x00, "Positive" ) + PORT_DIPNAME( 0x02, 0x02, "Vertical Sync" ) + PORT_DIPSETTING( 0x02, "Negative" ) + PORT_DIPSETTING( 0x00, "Positive" ) + PORT_DIPNAME( 0x04, 0x00, "Video" ) + PORT_DIPSETTING( 0x04, "Negative" ) + PORT_DIPSETTING( 0x00, "Positive" ) + PORT_DIPNAME( 0x08, 0x08, "Keypad" ) + PORT_DIPSETTING( 0x08, "Numeric" ) + PORT_DIPSETTING( 0x00, "Alternate Keyboard" ) + PORT_DIPNAME( 0x10, 0x10, "Horizontal Sync" ) + PORT_DIPSETTING( 0x10, "Negative" ) + PORT_DIPSETTING( 0x00, "Positive" ) + PORT_DIPNAME( 0x20, 0x20, "CPU" ) + PORT_DIPSETTING( 0x20, "Operating" ) + PORT_DIPSETTING( 0x00, "Reset" ) + PORT_DIPNAME( 0x40, 0x40, "Keyboard strobe" ) + PORT_DIPSETTING( 0x40, "Negative" ) + PORT_DIPSETTING( 0x00, "Positive" ) + PORT_DIPNAME( 0x80, 0x00, "Beeper" ) + PORT_DIPSETTING( 0x80, "Silent" ) + PORT_DIPSETTING( 0x00, "Enable" ) + PORT_START("DIPSW2") + PORT_DIPNAME( 0x0f, 0x05, "Baud rate" ) + PORT_DIPSETTING( 0x00, "50" ) + PORT_DIPSETTING( 0x01, "75" ) + PORT_DIPSETTING( 0x02, "110" ) + PORT_DIPSETTING( 0x03, "134.5" ) + PORT_DIPSETTING( 0x04, "150" ) + PORT_DIPSETTING( 0x05, "300" ) + PORT_DIPSETTING( 0x06, "600" ) + PORT_DIPSETTING( 0x07, "1200" ) + PORT_DIPSETTING( 0x08, "1800" ) + PORT_DIPSETTING( 0x09, "2000" ) + PORT_DIPSETTING( 0x0a, "2400" ) + PORT_DIPSETTING( 0x0b, "3600" ) + PORT_DIPSETTING( 0x0c, "4800" ) + PORT_DIPSETTING( 0x0d, "7200" ) + PORT_DIPSETTING( 0x0e, "9600" ) + PORT_DIPSETTING( 0x0f, "19200" ) + PORT_DIPNAME( 0x30, 0x20, "Parity" ) + PORT_DIPSETTING( 0x00, "Odd" ) + PORT_DIPSETTING( 0x10, "Even" ) + PORT_DIPSETTING( 0x20, "Marking" ) + PORT_DIPSETTING( 0x30, "Spacing" ) + PORT_DIPNAME( 0x40, 0x40, "Handshake" ) + PORT_DIPSETTING( 0x40, "CTS" ) + PORT_DIPSETTING( 0x00, "XON/XOFF" ) + PORT_DIPNAME( 0x80, 0x80, "Line Feed" ) + PORT_DIPSETTING( 0x80, "No LF on CR" ) + PORT_DIPSETTING( 0x00, "Auto" ) + PORT_START("DIPSW3") + PORT_DIPNAME( 0x07, 0x07, "Display" ) + PORT_DIPSETTING( 0x00, "96 x 24 15750Hz, 50Hz" ) + PORT_DIPSETTING( 0x01, "80 x 48 15750Hz, 50Hz" ) + PORT_DIPSETTING( 0x02, "80 x 24 15750Hz, 50Hz" ) + PORT_DIPSETTING( 0x03, "96 x 24 15750Hz, 60Hz" ) + PORT_DIPSETTING( 0x04, "80 x 48 18700Hz, 50Hz" ) + PORT_DIPSETTING( 0x05, "80 x 24 17540Hz, 60Hz" ) + PORT_DIPSETTING( 0x06, "80 x 48 15750Hz, 60Hz" ) + PORT_DIPSETTING( 0x07, "80 x 24 15750Hz, 60Hz" ) + PORT_DIPNAME( 0x18, 0x18, "Emulation" ) + PORT_DIPSETTING( 0x00, "Adds" ) + PORT_DIPSETTING( 0x08, "Beehive" ) + PORT_DIPSETTING( 0x10, "LSI ADM-3" ) + PORT_DIPSETTING( 0x18, "Heath H-19" ) + PORT_DIPNAME( 0x20, 0x00, "Mode" ) + PORT_DIPSETTING( 0x20, "Line" ) + PORT_DIPSETTING( 0x00, "Local" ) + PORT_DIPNAME( 0x40, 0x40, "Duplex" ) + PORT_DIPSETTING( 0x40, "Full" ) + PORT_DIPSETTING( 0x00, "Half" ) + PORT_DIPNAME( 0x80, 0x80, "Wraparound" ) + PORT_DIPSETTING( 0x80, "Disabled" ) + PORT_DIPSETTING( 0x00, "Enabled" ) +INPUT_PORTS_END + + +void zrt80_state::machine_reset() +{ + m_beep->set_frequency(800); + m_term_data = 0; +} + +void zrt80_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +MC6845_UPDATE_ROW( zrt80_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,inv; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + UINT8 polarity = ioport("DIPSW1")->read() & 4 ? 0xff : 0; + + for (x = 0; x < x_count; x++) + { + inv = polarity; + if (x == cursor_x) inv ^= 0xff; + mem = (ma + x) & 0x1fff; + chr = m_p_videoram[mem]; + + if BIT(chr, 7) + { + inv ^= 0xff; + chr &= 0x7f; + } + + gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + + /* Display a scanline of a character */ + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} + +WRITE8_MEMBER( zrt80_state::kbd_put ) +{ + m_term_data = data; + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); +} + +/* F4 Character Displayer */ +static const gfx_layout zrt80_charlayout = +{ + 8, 16, /* 8 x 16 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( zrt80 ) + GFXDECODE_ENTRY( "chargen", 0x0000, zrt80_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_START( zrt80, zrt80_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) + MCFG_CPU_PROGRAM_MAP(zrt80_mem) + MCFG_CPU_IO_MAP(zrt80_io) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_SCREEN_SIZE(640, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", zrt80) + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + /* Devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_20MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) /*?*/ + MCFG_MC6845_UPDATE_ROW_CB(zrt80_state, crtc_update_row) + + MCFG_DEVICE_ADD( "ins8250", INS8250, 2457600 ) + MCFG_INS8250_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(zrt80_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( zrt80 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD("zrt80mon.z25", 0x0000, 0x1000, CRC(e6ea96dc) SHA1(e3075e30bb2b85f9288d0b8b8cdf1d2b4f7586fd) ) + //z24 is 2nd chip, used as expansion + + ROM_REGION( 0x0800, "chargen", 0 ) + ROM_LOAD("zrt80chr.z30", 0x0000, 0x0800, CRC(4dbdc60f) SHA1(20e393f7207a8440029c8290cdf2f121d317a37e) ) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1982, zrt80, 0, 0, zrt80, zrt80, driver_device, 0, "Digital Research Computers", "ZRT-80", 0) diff --git a/src/mame/drivers/zsbc3.c b/src/mame/drivers/zsbc3.c new file mode 100644 index 00000000000..65efc05856b --- /dev/null +++ b/src/mame/drivers/zsbc3.c @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + Digital Microsystems ZSBC-3 + + 11/01/2010 Skeleton driver. + 28/11/2010 Connected to a terminal + 11/01/2011 Converted to Modern. + +**************************************************************************** + + Monitor commands: [] indicates optional + + Bx = Boot from device x (0 to 7) + Dx [y] = Dump memory (hex and ascii) in range x [to y] + Fx y z = Fill memory x to y with z + Gx = Execute program at address x + Ix = Display IN of port x + Ox y = Output y to port x + Sx = Enter memory editing mode, press enter for next address + Mx y = unknown (affects memory) + Tx = unknown (does strange things) + enter = dump memory from 9000 to 907F (why?) + +**************************************************************************** + + TODO: + Everything really... + + Devices of all kinds; + Use the other rom for something.. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class zsbc3_state : public driver_device +{ +public: + zsbc3_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + DECLARE_READ8_MEMBER(zsbc3_28_r); + DECLARE_READ8_MEMBER(zsbc3_2a_r); + DECLARE_WRITE8_MEMBER(kbd_put); +private: + UINT8 m_term_data; + virtual void machine_reset(); + required_device m_maincpu; + required_device m_terminal; +}; + + +READ8_MEMBER( zsbc3_state::zsbc3_28_r ) +{ + UINT8 ret = m_term_data; + m_term_data = 0; + return ret; +} + +READ8_MEMBER( zsbc3_state::zsbc3_2a_r ) +{ + return (m_term_data) ? 5 : 4; +} + +static ADDRESS_MAP_START(zsbc3_mem, AS_PROGRAM, 8, zsbc3_state) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE( 0x0000, 0x07ff ) AM_ROM + AM_RANGE( 0x0800, 0xffff ) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START(zsbc3_io, AS_IO, 8, zsbc3_state) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x28, 0x28) AM_READ(zsbc3_28_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) + AM_RANGE(0x2a, 0x2a) AM_READ(zsbc3_2a_r) +ADDRESS_MAP_END + +/* Input ports */ +static INPUT_PORTS_START( zsbc3 ) +INPUT_PORTS_END + + +void zsbc3_state::machine_reset() +{ +} + +WRITE8_MEMBER( zsbc3_state::kbd_put ) +{ + m_term_data = data; +} + + +static MACHINE_CONFIG_START( zsbc3, zsbc3_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz /4) + MCFG_CPU_PROGRAM_MAP(zsbc3_mem) + MCFG_CPU_IO_MAP(zsbc3_io) + + /* video hardware */ + MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) + MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(zsbc3_state, kbd_put)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( zsbc3 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "54-3002_zsbc_monitor_1.09.bin", 0x0000, 0x0800, CRC(628588e9) SHA1(8f0d489147ec8382ca007236e0a95a83b6ebcd86)) + + ROM_REGION( 0x10000, "hdc", ROMREGION_ERASEFF ) + ROM_LOAD( "54-8622_hdc13.bin", 0x0000, 0x0400, CRC(02c7cd6d) SHA1(494281ba081a0f7fbadfc30a7d2ea18c59e55101)) +ROM_END + +/* Driver */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, zsbc3, 0, 0, zsbc3, zsbc3, driver_device, 0, "Digital Microsystems", "ZSBC-3", MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/zx.c b/src/mame/drivers/zx.c new file mode 100644 index 00000000000..467d515aacb --- /dev/null +++ b/src/mame/drivers/zx.c @@ -0,0 +1,544 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Krzysztof Strzecha, Robbbert +/*************************************************************************** + zx.c + + Original driver by: + Juergen Buchmueller, Dec 1999 + + Fixes and additions by Krzysztof Strzecha: + 07.06.2004 Tape loading added. Some cleanups of debug code. + Fixed stupid bug in timings (vblank duration). + MACHINE_NOT_WORKING flag removed. + 29.05.2004 CPU clock, number of scanlines, vblank duration corrected. + Some cleanups. Two non-working TESTDRIVERS added. + 14.05.2004 Finally fixed and readded. + + Changes done by Robbbert in Jan 2009: + - Added the NTSC/PAL diode to all systems except pc8300 which doesn't support it. + - Applied NTSC timings to pc8300 only, all others depend on the diode. + - Many keyboard fixes, and descriptions added to keys. + - Fixed .O files from causing an access violation. + - Enabled cassette saving. + - Many general fixes to pow3000/lambda. + - Added sound to pc8300/pow3000/lambda. + + 24/12/2009 (Robbbert) + - Added rom mirror, this fixes ringo470 + - Added back the F4 character display + + 14/08/2011 (Robbbert) + - Modernised. + + To do / problems: + - Some memory areas are not mirrored as they should. + - Video hardware is not fully emulated, so it does not support pseudo hi-res and hi-res modes. + - The screen in pc8300/pow3000/lambda jumps when you type something. + - lambda/pow3000 32k memory pack is unemulated, because where is the upper 16k mirror going to be? + - h4th and tree4th need their address maps worked out (eg, the stack is set to FB80) + - lambda/pow3000 joystick, connected in parallel with the 4,R,F,7,U keys, but the directions are unknown. + - Many games don't work. + + +****************************************************************************/ + +#include "includes/zx.h" + +/* Memory Maps */ + +static ADDRESS_MAP_START( zx80_map, AS_PROGRAM, 8, zx_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_MIRROR(0x2000) + AM_RANGE(0xc000, 0xffff) AM_RAM_READ(zx_ram_r) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( zx80_io_map, AS_IO, 8, zx_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(zx80_io_r, zx80_io_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( zx81_io_map, AS_IO, 8, zx_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(zx81_io_r, zx81_io_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8300_io_map, AS_IO, 8, zx_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(pc8300_io_r, zx81_io_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pow3000_io_map, AS_IO, 8, zx_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(pow3000_io_r, zx81_io_w) +ADDRESS_MAP_END + +/* Input Ports */ + +static INPUT_PORTS_START( zx80 ) +/* PORT_NAME = Key Mode (Press Key) Shift Mode (Press Key+Shift) BASIC Mode (Press Key at BASIC) */ +/* Some keys (e.g. A,S,D,F,G etc.) produce glyphs when used in Shift Mode. MESS currently cannot show +these functions in Input (This System) menu, hence we live some empty space in the menu */ + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z :") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR(':') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X ; CLEAR") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR(';') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C ? CLS") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('?') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V / GOSUB") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('/') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A LIST") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S STOP") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DIM") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F FOR") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q NEW") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W LOAD") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E SAVE") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R RUN") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T CONT") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 NOT") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 AND") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 THEN") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 TO") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 Left") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 RUBOUT") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(8) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 HOME") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 Right") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 Up") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 Down") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P *") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O ) PRINT") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I ( INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U $ IF") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y \" REM") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('"') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEWLINE EDIT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L =") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K + LET") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J - RAND") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('-') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H ** POKE") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE \xC2\xA3 BREAK") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('\xA3') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". ,") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(',') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M >") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N < NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B OR RET") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("CONFIG") /* config diode on main board */ + PORT_CONFNAME( 0x40, 0x40, "TV system") + PORT_CONFSETTING( 0x00, "NTSC") + PORT_CONFSETTING( 0x40, "PAL") +INPUT_PORTS_END + +static INPUT_PORTS_START( pc8300 ) +/* PORT_NAME = Key Mode (Press Key) Shift Mode (Press Key+Shift) BASIC Mode (Press Key at BASIC) */ + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z :") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR(':') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X ;") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR(';') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C ?") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('?') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V /") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('/') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A STOP NEW") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S LPRINT SAVE") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D SLOW DIM") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F FAST FOR") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G LLIST GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q \"\" PLOT") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W OR UNPLOT") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E STEP REM") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R <= RUN") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T <> RAND") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 EDIT") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 AND") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 THEN") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 TO") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 Left") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 DELETE") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(8) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 GRAPHICS") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 Right") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 Up") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 Down") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P \" PRINT") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O ) POKE") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I ( INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U $ IF") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y >= RETURN") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER FUNCTION") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L = LET") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K + LIST") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J - LOAD") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('-') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H ** GOSUB") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE \xC2\xA3") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('\xA3') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". ,") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(',') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M > PAUSE") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N < NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B * SCROLL") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('*') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +static INPUT_PORTS_START( zx81 ) + PORT_INCLUDE(pc8300) + + PORT_START("CONFIG") /* config diode on main board */ + PORT_CONFNAME( 0x40, 0x40, "TV system") + PORT_CONFSETTING( 0x00, "NTSC") + PORT_CONFSETTING( 0x40, "PAL") +INPUT_PORTS_END + +static INPUT_PORTS_START( pow3000 ) + PORT_START("ROW0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z PRINT") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X AUTO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C Up") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V Down") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A ASN") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S ACS") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D ATN") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F EXP") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G ABS") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q SIN") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W COS") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E TAN") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R LOG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T SGN") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 \"") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('"') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 =") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ,") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(',') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ;") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(';') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P >") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('>') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O <") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('<') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I PI") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U RND") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y SQR") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER GRAPHICS") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L +") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('+') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K -") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('-') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J *") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H /") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('/') + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("ROW7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE BREAK") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". DELETE") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(8) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M EDIT") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N Right") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B Left") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("CONFIG") /* config diode on main board */ + PORT_CONFNAME( 0x01, 0x00, "TV system") + PORT_CONFSETTING( 0x00, "NTSC") + PORT_CONFSETTING( 0x01, "PAL") +INPUT_PORTS_END + + +/* F4 character display */ + +static const gfx_layout zx_gfx_layout = +{ + 8, 8, /* 8x8 pixels */ + 64, /* 64 codes */ + 1, /* 1 bit per pixel */ + {0}, /* no bitplanes */ + /* x offsets */ + {0, 1, 2, 3, 4, 5, 6, 7}, + /* y offsets */ + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, + 8 * 8 /* eight bytes per code */ +}; + + +/* Graphics Decode Information */ + +static GFXDECODE_START( zx80 ) + GFXDECODE_ENTRY( "maincpu", 0x0e00, zx_gfx_layout, 0, 2 ) +GFXDECODE_END + +static GFXDECODE_START( zx81 ) + GFXDECODE_ENTRY( "maincpu", 0x1e00, zx_gfx_layout, 0, 2 ) +GFXDECODE_END + +static GFXDECODE_START( pc8300 ) + GFXDECODE_ENTRY( "gfx1", 0, zx_gfx_layout, 0, 2 ) +GFXDECODE_END + + + +/* Palette Initialization */ + + +PALETTE_INIT_MEMBER(zx_state, zx) +{ + palette.set_pen_color(0,rgb_t::white); /* white */ + palette.set_pen_color(1,rgb_t::black); /* black */ + palette.set_pen_color(2,rgb_t::black); /* black */ + palette.set_pen_color(3,rgb_t::white); /* white */ +} + +PALETTE_INIT_MEMBER(zx_state,ts1000) +{ + palette.set_pen_color(0,rgb_t(64, 244, 244)); /* cyan */ + palette.set_pen_color(1,rgb_t::black); /* black */ + palette.set_pen_color(2,rgb_t::black); /* black */ + palette.set_pen_color(3,rgb_t(64, 244, 244)); /* cyan */ +} + + +#define ZX81_CPU_CLOCK 3250000 +#define ZX81_CYCLES_PER_SCANLINE 207 +#define ZX81_PIXELS_PER_SCANLINE 256 +#define ZX81_CYCLES_PER_VBLANK 1235 +#define ZX81_VBLANK_DURATION (1.0*ZX81_CYCLES_PER_VBLANK/ZX81_CPU_CLOCK*1000*1000) + +#define ZX81_PAL_SCANLINES 304 +#define ZX81_PAL_FRAMES_PER_SECOND (1.0*ZX81_CPU_CLOCK/(ZX81_PAL_SCANLINES*ZX81_CYCLES_PER_SCANLINE+ZX81_CYCLES_PER_VBLANK)) + +#define ZX81_NTSC_SCANLINES 256 +#define ZX81_NTSC_FRAMES_PER_SECOND (1.0*ZX81_CPU_CLOCK/(ZX81_NTSC_SCANLINES*ZX81_CYCLES_PER_SCANLINE+ZX81_CYCLES_PER_VBLANK)) + +/* Machine Drivers */ + +static MACHINE_CONFIG_START( zx80, zx_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, ZX81_CPU_CLOCK) + MCFG_CPU_PROGRAM_MAP(zx80_map) + MCFG_CPU_IO_MAP(zx80_io_map) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(ZX81_PAL_FRAMES_PER_SECOND) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(ZX81_VBLANK_DURATION)) + + + /* video hardware */ + MCFG_SCREEN_UPDATE_DRIVER(zx_state, screen_update) + MCFG_SCREEN_SIZE(ZX81_PIXELS_PER_SCANLINE, ZX81_PAL_SCANLINES) + MCFG_SCREEN_VISIBLE_AREA(0, ZX81_PIXELS_PER_SCANLINE-1, 0, ZX81_PAL_SCANLINES-1) + MCFG_SCREEN_VBLANK_DRIVER(zx_state, screen_eof_zx) + MCFG_SCREEN_PALETTE("palette") + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", zx80) + MCFG_PALETTE_ADD("palette", 4) + MCFG_PALETTE_INIT_OWNER(zx_state,zx) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) /* Used by pc8300/lambda/pow3000 */ + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_FORMATS(zx80_o_format) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("1K") + MCFG_RAM_EXTRA_OPTIONS("16K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( zx81, zx80 ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(zx81_io_map) + + MCFG_GFXDECODE_MODIFY("gfxdecode", zx81) + + MCFG_CASSETTE_MODIFY( "cassette" ) + MCFG_CASSETTE_FORMATS(zx81_p_format) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ts1000, zx81 ) + MCFG_PALETTE_MODIFY("palette") + MCFG_PALETTE_INIT_OWNER(zx_state,ts1000) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( ts1500, ts1000 ) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pc8300, zx81 ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(pc8300_io_map) + + MCFG_MACHINE_RESET_OVERRIDE(zx_state,pc8300) + + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_REFRESH_RATE(ZX81_NTSC_FRAMES_PER_SECOND) + MCFG_SCREEN_SIZE(ZX81_PIXELS_PER_SCANLINE, ZX81_NTSC_SCANLINES) + MCFG_SCREEN_VISIBLE_AREA(0, ZX81_PIXELS_PER_SCANLINE-1, 0, ZX81_NTSC_SCANLINES-1) + + MCFG_GFXDECODE_MODIFY("gfxdecode", pc8300) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("16K") +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pow3000, zx81 ) + + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(pow3000_io_map) + + MCFG_MACHINE_RESET_OVERRIDE(zx_state,pow3000) + + MCFG_GFXDECODE_MODIFY("gfxdecode", pc8300) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("2K") + MCFG_RAM_EXTRA_OPTIONS("16K") +MACHINE_CONFIG_END + + +/* ROMs */ + +ROM_START(zx80) + ROM_REGION( 0x10000, "maincpu",0 ) + ROM_SYSTEM_BIOS(0, "default", "BASIC") + ROMX_LOAD( "zx80.rom", 0x0000, 0x1000, CRC(4c7fc597) SHA1(b6769a3197c77009e0933e038c15b43cf4c98c7a), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "aszmic", "ASZMIC") + ROMX_LOAD( "aszmic.rom", 0x0000, 0x1000, CRC(6c123536) SHA1(720867cbfafafc8c7438bbc325a77eaef571e5c0), ROM_BIOS(2) ) +ROM_END + +ROM_START(zx81) + ROM_REGION( 0x10000, "maincpu",0 ) + ROM_SYSTEM_BIOS(0, "3rd", "3rd rev.") + ROMX_LOAD( "zx81b.rom", 0x0000, 0x2000, CRC(522c37b8) SHA1(c6d8e06cb936989f6e1cc7a56d1f092da854a515), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS(1, "1st", "1st rev.") + ROMX_LOAD( "zx81.rom", 0x0000, 0x2000, CRC(fcbbd617) SHA1(a0ade36540561cc1691bb6f0c42ceae12484a102), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS(2, "2nd", "2nd rev.") + ROMX_LOAD( "zx81a.rom", 0x0000, 0x2000, CRC(4b1dd6eb) SHA1(7b143ee964e9ada89d1f9e88f0bd48d919184cfc), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS(3, "hforth", "Forth by David Husband") + ROMX_LOAD( "h4th.rom", 0x0000, 0x2000, CRC(257d5a32) SHA1(03809a6b464609ff924f7e55a85eef875cd47ae8), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS(4, "tforth", "Forth by Tree Systems") + ROMX_LOAD( "tree4th.rom", 0x0000, 0x2000, CRC(71616238) SHA1(3ee15779e03482b10fc59eb4df2446376c56b00d), ROM_BIOS(5) ) +ROM_END + +ROM_START(ts1000) + ROM_REGION( 0x10000, "maincpu",0 ) + ROM_LOAD( "zx81a.rom", 0x0000, 0x2000, CRC(4b1dd6eb) SHA1(7b143ee964e9ada89d1f9e88f0bd48d919184cfc) ) +ROM_END + +ROM_START(ts1500) + ROM_REGION( 0x10000, "maincpu",0 ) + ROM_LOAD( "d2364c_649.u2", 0x0000, 0x2000, CRC(7dd19c48) SHA1(3eb437359221b4406d236085ec66fa02278e7495) ) +ROM_END + +ROM_START(ringo470) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "ringo470.rom", 0x0000, 0x2000, CRC(b9c5abec) SHA1(191c4994adfffe4f83b98dc3959dde2724b1dbac) ) +ROM_END + +ROM_START(pc8300) + ROM_REGION( 0x10000, "maincpu",0 ) + ROM_LOAD( "8300_org.rom", 0x0000, 0x2000, CRC(a350f2b1) SHA1(6a9be484556cc27a9cd9d71085d2027c6243333f) ) + + ROM_REGION( 0x200, "gfx1", 0 ) + ROM_LOAD( "8300_fnt.bin", 0x0000, 0x0200, CRC(6bd0408c) SHA1(34a7a5afee511dc8bba28eccf305c873d80a557a) ) +ROM_END + +ROM_START(pow3000) + ROM_REGION( 0x10000, "maincpu",0 ) + ROM_LOAD( "pow3000.rom", 0x0000, 0x2000, CRC(8a49b2c3) SHA1(9b22daf2f3a991aa6a358ef95b091654c3ca1bdf) ) + + ROM_REGION( 0x200, "gfx1", 0 ) + ROM_LOAD( "pow3000.chr", 0x0000, 0x0200, CRC(1c42fe46) SHA1(5b30ba77c8f57065d106db69964c9ff2e4221760) ) +ROM_END + +ROM_START(lambda) + ROM_REGION( 0x10000, "maincpu",0 ) + ROM_LOAD( "lambda.rom", 0x0000, 0x2000, CRC(8a49b2c3) SHA1(9b22daf2f3a991aa6a358ef95b091654c3ca1bdf) ) + + ROM_REGION( 0x200, "gfx1", 0 ) + ROM_LOAD( "8300_fnt.bin", 0x0000, 0x0200, CRC(6bd0408c) SHA1(34a7a5afee511dc8bba28eccf305c873d80a557a) ) +ROM_END + +ROM_START( tk85 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "tk85.rom", 0x0000, 0x2800, CRC(8972d756) SHA1(7b961a1733fc047eb682150a32e17bca10a018d2) ) +ROM_END + +/* This homebrew has 192k of RAM and 32k of ROM via bankswitching. One of the primary bankswitching lines is /M1, + which is not emulated by MAME's z80. */ +ROM_START( zx97 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "zx97.rom", 0x0000, 0x2000, CRC(5cf49744) SHA1(b2a486efdc7b2bc3dc8e5a441ea5532bfa3207bd) ) + ROM_IGNORE( 0x6000 ) /* Unemulated bankswitched part */ +ROM_END + +/* Game Drivers */ + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1980, zx80, 0, 0, zx80, zx80, zx_state, zx, "Sinclair Research Ltd", "ZX-80", 0 ) +COMP( 1981, zx81, 0, 0, zx81, zx81, zx_state, zx, "Sinclair Research Ltd", "ZX-81", 0 ) +COMP( 1982, ts1000, zx81, 0, ts1000, zx81, zx_state, zx, "Timex Sinclair", "Timex Sinclair 1000", 0 ) +COMP( 1983, ts1500, zx81, 0, ts1500, zx81, zx_state, zx, "Timex Sinclair", "Timex Sinclair 1500", 0 ) +COMP( 1983, tk85, zx81, 0, ts1000, zx81, zx_state, zx, "Microdigital", "TK85", 0 ) +COMP( 1983, ringo470, zx81, 0, ts1000, zx81, zx_state, zx, "Ritas do Brasil Ltda", "Ringo 470", 0 ) +COMP( 1984, pc8300, zx81, 0, pc8300, pc8300, zx_state, zx, "Your Computer", "PC8300", 0 ) +COMP( 1983, pow3000, zx81, 0, pow3000, pow3000, zx_state, zx, "Creon Enterprises", "Power 3000", 0 ) +COMP( 1982, lambda, zx81, 0, pow3000, pow3000, zx_state, zx, "Lambda Electronics Ltd", "Lambda 8300", 0 ) +COMP( 1997, zx97, zx81, 0, zx81, zx81, zx_state, zx, "Wilf Rigter", "ZX97", MACHINE_NOT_WORKING | MACHINE_UNOFFICIAL ) diff --git a/src/mame/includes/abc1600.h b/src/mame/includes/abc1600.h new file mode 100644 index 00000000000..9e32684766f --- /dev/null +++ b/src/mame/includes/abc1600.h @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __ABC1600__ +#define __ABC1600__ + +#include "bus/abcbus/abcbus.h" +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "machine/8530scc.h" +#include "bus/abckb/abckb.h" +#include "machine/abc1600mac.h" +#include "machine/e0516.h" +#include "machine/nmc9306.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "machine/z80dart.h" +#include "machine/z80dma.h" +#include "machine/z8536.h" +#include "video/abc1600.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define MC68008P8_TAG "3f" +#define Z8410AB1_0_TAG "5g" +#define Z8410AB1_1_TAG "7g" +#define Z8410AB1_2_TAG "9g" +#define Z8470AB1_TAG "17b" +#define Z8530B1_TAG "2a" +#define Z8536B1_TAG "15b" +#define SAB1797_02P_TAG "5a" +#define FDC9229BT_TAG "7a" +#define E050_C16PC_TAG "13b" +#define NMC9306_TAG "14c" +#define SCREEN_TAG "screen" +#define BUS0I_TAG "bus0i" +#define BUS0X_TAG "bus0x" +#define BUS1_TAG "bus1" +#define BUS2_TAG "bus2" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" +#define ABC_KEYBOARD_PORT_TAG "kb" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> abc1600_state + +class abc1600_state : public driver_device +{ +public: + abc1600_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, MC68008P8_TAG), + m_dma0(*this, Z8410AB1_0_TAG), + m_dma1(*this, Z8410AB1_1_TAG), + m_dma2(*this, Z8410AB1_2_TAG), + m_dart(*this, Z8470AB1_TAG), + m_scc(*this, Z8530B1_TAG), + m_cio(*this, Z8536B1_TAG), + m_fdc(*this, SAB1797_02P_TAG), + m_rtc(*this, E050_C16PC_TAG), + m_nvram(*this, NMC9306_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, SAB1797_02P_TAG":0"), + m_floppy1(*this, SAB1797_02P_TAG":1"), + m_floppy2(*this, SAB1797_02P_TAG":2"), + m_bus0i(*this, BUS0I_TAG), + m_bus0x(*this, BUS0X_TAG), + m_bus1(*this, BUS1_TAG), + m_bus2(*this, BUS2_TAG) + { } + + required_device m_maincpu; + required_device m_dma0; + required_device m_dma1; + required_device m_dma2; + required_device m_dart; + required_device m_scc; + required_device m_cio; + required_device m_fdc; + required_device m_rtc; + required_device m_nvram; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_bus0i; + required_device m_bus0x; + required_device m_bus1; + required_device m_bus2; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( bus_r ); + DECLARE_WRITE8_MEMBER( bus_w ); + DECLARE_READ8_MEMBER( dart_r ); + DECLARE_WRITE8_MEMBER( dart_w ); + DECLARE_READ8_MEMBER( scc_r ); + DECLARE_WRITE8_MEMBER( scc_w ); + DECLARE_READ8_MEMBER( cio_r ); + DECLARE_WRITE8_MEMBER( cio_w ); + DECLARE_WRITE8_MEMBER( fw0_w ); + DECLARE_WRITE8_MEMBER( fw1_w ); + DECLARE_WRITE8_MEMBER( spec_contr_reg_w ); + + DECLARE_WRITE_LINE_MEMBER( dbrq_w ); + + DECLARE_READ8_MEMBER( cio_pa_r ); + DECLARE_READ8_MEMBER( cio_pb_r ); + DECLARE_WRITE8_MEMBER( cio_pb_w ); + DECLARE_READ8_MEMBER( cio_pc_r ); + DECLARE_WRITE8_MEMBER( cio_pc_w ); + + DECLARE_WRITE_LINE_MEMBER( nmi_w ); + + IRQ_CALLBACK_MEMBER( abc1600_int_ack ); + + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + + UINT8 read_io(offs_t offset); + void write_io(offs_t offset, UINT8 data); + UINT8 read_internal_io(offs_t offset); + void write_internal_io(offs_t offset, UINT8 data); + UINT8 read_external_io(offs_t offset); + void write_external_io(offs_t offset, UINT8 data); + + void update_drdy0(); + void update_drdy1(); + void update_drdy2(); + + // DMA + int m_dmadis; + int m_sysscc; + int m_sysfs; + UINT8 m_cause; + int m_partst; // parity test + + // peripherals + int m_cs7; // card select address bit 7 + int m_bus0; // BUS 0 selected + UINT8 m_csb; // card select + int m_atce; // V.24 channel A external clock enable + int m_btce; // V.24 channel B external clock enable +}; + + + +#endif diff --git a/src/mame/includes/abc80.h b/src/mame/includes/abc80.h new file mode 100644 index 00000000000..253ed7e757d --- /dev/null +++ b/src/mame/includes/abc80.h @@ -0,0 +1,184 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/***************************************************************************** + * + * includes/abc80.h + * + ****************************************************************************/ + +#ifndef __ABC80__ +#define __ABC80__ + +#include "bus/abcbus/abcbus.h" +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "imagedev/flopdrv.h" +#include "imagedev/printer.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "machine/abc80kb.h" +#include "machine/keyboard.h" +#include "machine/ram.h" +#include "machine/z80pio.h" +#include "sound/sn76477.h" +#include "sound/wave.h" + +#define ABC80_HTOTAL 384 +#define ABC80_HBEND 35 +#define ABC80_HBSTART 384 +#define ABC80_VTOTAL 312 +#define ABC80_VBEND 15 +#define ABC80_VBSTART 312 + +#define ABC80_K5_HSYNC 0x01 +#define ABC80_K5_DH 0x02 +#define ABC80_K5_LINE_END 0x04 +#define ABC80_K5_ROW_START 0x08 + +#define ABC80_K2_VSYNC 0x01 +#define ABC80_K2_DV 0x02 +#define ABC80_K2_FRAME_END 0x04 +#define ABC80_K2_FRAME_RESET 0x08 + +#define ABC80_J3_BLANK 0x01 +#define ABC80_J3_TEXT 0x02 +#define ABC80_J3_GRAPHICS 0x04 +#define ABC80_J3_VERSAL 0x08 + +#define ABC80_E7_VIDEO_RAM 0x01 +#define ABC80_E7_INT_RAM 0x02 +#define ABC80_E7_31K_EXT_RAM 0x04 +#define ABC80_E7_16K_INT_RAM 0x08 + +#define ABC80_CHAR_CURSOR 0x80 + +#define SCREEN_TAG "screen" +#define Z80_TAG "ab67" +#define Z80PIO_TAG "cd67" +#define SN76477_TAG "g8" +#define RS232_TAG "ser" +#define CASSETTE_TAG "cassette" +#define KEYBOARD_TAG "keyboard" +#define TIMER_CASSETTE_TAG "cass" + +class abc80_state : public driver_device +{ +public: + abc80_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_pio(*this, Z80PIO_TAG), + m_psg(*this, SN76477_TAG), + m_cassette(*this, "cassette"), + m_bus(*this, ABCBUS_TAG), + m_kb(*this, ABC80_KEYBOARD_TAG), + m_ram(*this, RAM_TAG), + m_rs232(*this, RS232_TAG), + m_palette(*this, "palette"), + m_rom(*this, Z80_TAG), + m_mmu_rom(*this, "mmu"), + m_char_rom(*this, "chargen"), + m_hsync_prom(*this, "hsync"), + m_vsync_prom(*this, "vsync"), + m_line_prom(*this, "line"), + m_attr_prom(*this, "attr"), + m_video_ram(*this, "video_ram"), + m_motor(false), + m_tape_in(1), + m_tape_in_latch(1) + { } + + required_device m_maincpu; + required_device m_pio; + required_device m_psg; + required_device m_cassette; + required_device m_bus; + required_device m_kb; + required_device m_ram; + required_device m_rs232; + required_device m_palette; + required_memory_region m_rom; + required_memory_region m_mmu_rom; + required_memory_region m_char_rom; + required_memory_region m_hsync_prom; + required_memory_region m_vsync_prom; + required_memory_region m_line_prom; + required_memory_region m_attr_prom; + optional_shared_ptr m_video_ram; + + enum + { + TIMER_ID_PIO, + TIMER_ID_CASSETTE, + TIMER_ID_BLINK, + TIMER_ID_VSYNC_ON, + TIMER_ID_VSYNC_OFF, + TIMER_ID_FAKE_KEYBOARD_CLEAR + }; + + enum + { + BOFA = 0xfe1c, + EOFA = 0xfe1e, + HEAD = 0xfe20 + }; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + virtual void machine_start(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE_LINE_MEMBER( vco_voltage_w ); + + DECLARE_READ8_MEMBER( pio_pa_r ); + DECLARE_READ8_MEMBER( pio_pb_r ); + DECLARE_WRITE8_MEMBER( pio_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( keydown_w ); + DECLARE_WRITE8_MEMBER( kbd_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( bac ); + + enum + { + MMU_XM = 0x01, + MMU_ROM = 0x02, + MMU_VRAMS = 0x04, + MMU_RAM = 0x08 + }; + + // keyboard state + int m_key_data; + int m_key_strobe; + int m_pio_astb; + + // video state + UINT8 m_latch; + int m_blink; + + // cassette state + bool m_motor; + int m_tape_in; + int m_tape_in_latch; + + // timers + emu_timer *m_pio_timer; + emu_timer *m_cassette_timer; + emu_timer *m_blink_timer; + emu_timer *m_vsync_on_timer; + emu_timer *m_vsync_off_timer; +}; + +//----------- defined in video/abc80.c ----------- + +MACHINE_CONFIG_EXTERN( abc80_video ); + +#endif diff --git a/src/mame/includes/abc80x.h b/src/mame/includes/abc80x.h new file mode 100644 index 00000000000..86a54269778 --- /dev/null +++ b/src/mame/includes/abc80x.h @@ -0,0 +1,356 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __ABC800__ +#define __ABC800__ + +#include "bus/abcbus/abcbus.h" +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "cpu/mcs48/mcs48.h" +#include "imagedev/cassette.h" +#include "bus/abckb/abckb.h" +#include "bus/abckb/abc800kb.h" +#include "machine/e0516.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/ram.h" +#include "sound/discrete.h" +#include "video/mc6845.h" +#include "video/saa5050.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define ABC800_X01 XTAL_12MHz +#define ABC806_X02 XTAL_32_768kHz + +#define ABC802_AT0 0x01 +#define ABC802_AT1 0x02 +#define ABC802_ATD 0x40 +#define ABC802_ATE 0x80 +#define ABC802_INV 0x80 + +#define ABC800C_CHAR_RAM_SIZE 0x400 +#define ABC800M_CHAR_RAM_SIZE 0x800 +#define ABC800_VIDEO_RAM_SIZE 0x4000 +#define ABC802_CHAR_RAM_SIZE 0x800 +#define ABC806_CHAR_RAM_SIZE 0x800 +#define ABC806_ATTR_RAM_SIZE 0x800 +#define ABC806_VIDEO_RAM_SIZE 0x20000 + +#define ABC800_CHAR_WIDTH 6 +#define ABC800_CCLK ABC800_X01/ABC800_CHAR_WIDTH + +#define SCREEN_TAG "screen" +#define Z80_TAG "z80" +#define E0516_TAG "j13" +#define MC6845_TAG "b12" +#define SAA5052_TAG "5c" +#define Z80CTC_TAG "z80ctc" +#define Z80SIO_TAG "z80sio" +#define Z80DART_TAG "z80dart" +#define DISCRETE_TAG "discrete" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" +#define ABC_KEYBOARD_PORT_TAG "kb" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> abc800_state + +class abc800_state : public driver_device +{ +public: + abc800_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ctc(*this, Z80CTC_TAG), + m_dart(*this, Z80DART_TAG), + m_sio(*this, Z80SIO_TAG), + m_discrete(*this, "discrete"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_rom(*this, Z80_TAG), + m_video_ram(*this, "video_ram"), + m_char_ram(*this, "char_ram"), + m_io_sb(*this, "SB"), + m_ctc_z0(0), + m_sio_txcb(0), + m_sio_txdb(1), + m_sio_rtsb(1), + m_dfd_out(0), + m_tape_ctr(4) + { } + + required_device m_maincpu; + required_device m_ctc; + required_device m_dart; + required_device m_sio; + optional_device m_discrete; + optional_device m_cassette; + required_device m_ram; + required_memory_region m_rom; + optional_shared_ptr m_video_ram; + optional_shared_ptr m_char_ram; + required_ioport m_io_sb; + + enum + { + TIMER_ID_CTC, + TIMER_ID_CASSETTE + }; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + + void bankswitch(); + void clock_cassette(int state); + + DECLARE_READ8_MEMBER( pling_r ); + DECLARE_READ8_MEMBER( keyboard_col_r ); + DECLARE_WRITE8_MEMBER( keyboard_row_w ); + DECLARE_WRITE8_MEMBER( keyboard_ctrl_w ); + DECLARE_READ8_MEMBER( keyboard_t1_r ); + DECLARE_WRITE8_MEMBER( hrs_w ); + DECLARE_WRITE8_MEMBER( hrc_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); + DECLARE_WRITE_LINE_MEMBER( sio_txdb_w ); + DECLARE_WRITE_LINE_MEMBER( sio_dtrb_w ); + DECLARE_WRITE_LINE_MEMBER( sio_rtsb_w ); + + // memory state + int m_fetch_charram; // opcode fetched from character RAM region (0x7800-0x7fff) + + // sound state + int m_pling; + + // serial state + UINT8 m_sb; + int m_ctc_z0; + int m_sio_txcb; + int m_sio_txdb; + int m_sio_rtsb; + int m_dfd_out; + int m_dfd_in; + int m_tape_ctr; + + // video state + UINT8 m_hrs; // HR picture start scanline + UINT8 m_fgctl; // HR foreground control + + // timers + emu_timer *m_ctc_timer; + emu_timer *m_cassette_timer; +}; + + +// ======================> abc800m_state + +class abc800m_state : public abc800_state +{ +public: + abc800m_state(const machine_config &mconfig, device_type type, const char *tag) : + abc800_state(mconfig, type, tag), + m_crtc(*this, MC6845_TAG), + m_palette(*this, "palette"), + m_fgctl_prom(*this, "hru2"), + m_char_rom(*this, MC6845_TAG) + { } + + required_device m_crtc; + required_device m_palette; + required_memory_region m_fgctl_prom; + required_memory_region m_char_rom; + + DECLARE_DRIVER_INIT(driver_init); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); + MC6845_UPDATE_ROW( abc800m_update_row ); +}; + + +// ======================> abc800c_state + +class abc800c_state : public abc800_state +{ +public: + abc800c_state(const machine_config &mconfig, device_type type, const char *tag) : + abc800_state(mconfig, type, tag), + m_trom(*this, SAA5052_TAG), + m_palette(*this, "palette"), + m_fgctl_prom(*this, "hru2") + { } + + required_device m_trom; + required_device m_palette; + required_memory_region m_fgctl_prom; + + DECLARE_DRIVER_INIT(driver_init); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + offs_t translate_trom_offset(offs_t offset); + void hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( char_ram_r ); + DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); + DECLARE_PALETTE_INIT( abc800c ); +}; + + +// ======================> abc802_state + +class abc802_state : public abc800_state +{ +public: + abc802_state(const machine_config &mconfig, device_type type, const char *tag) : + abc800_state(mconfig, type, tag), + m_crtc(*this, MC6845_TAG), + m_palette(*this, "palette"), + m_char_rom(*this, MC6845_TAG), + m_config(*this, "CONFIG") + { } + + required_device m_crtc; + required_device m_palette; + required_memory_region m_char_rom; + required_ioport m_config; + + DECLARE_DRIVER_INIT(driver_init); + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void bankswitch(); + + DECLARE_READ8_MEMBER( pling_r ); + DECLARE_WRITE_LINE_MEMBER( lrs_w ); + DECLARE_WRITE_LINE_MEMBER( mux80_40_w ); + DECLARE_WRITE_LINE_MEMBER( vs_w ); + DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); + MC6845_UPDATE_ROW( abc802_update_row ); + + // cpu state + int m_lrs; // low RAM select + + // video state + int m_flshclk_ctr; // flash clock counter + int m_flshclk; // flash clock + int m_80_40_mux; // 40/80 column mode +}; + + +// ======================> abc806_state + +class abc806_state : public abc800_state +{ +public: + abc806_state(const machine_config &mconfig, device_type type, const char *tag) : + abc800_state(mconfig, type, tag), + m_crtc(*this, MC6845_TAG), + m_palette(*this, "palette"), + m_rtc(*this, E0516_TAG), + m_rad_prom(*this, "rad"), + m_hru2_prom(*this, "hru"), + m_char_rom(*this, MC6845_TAG), + m_attr_ram(*this, "attr_ram") + { } + + required_device m_crtc; + required_device m_palette; + required_device m_rtc; + required_memory_region m_rad_prom; + required_memory_region m_hru2_prom; + required_memory_region m_char_rom; + optional_shared_ptr m_attr_ram; + + DECLARE_DRIVER_INIT(driver_init); + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void bankswitch(); + void hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( mai_r ); + DECLARE_WRITE8_MEMBER( mao_w ); + DECLARE_WRITE8_MEMBER( hrs_w ); + DECLARE_WRITE8_MEMBER( hrc_w ); + DECLARE_READ8_MEMBER( charram_r ); + DECLARE_WRITE8_MEMBER( charram_w ); + DECLARE_READ8_MEMBER( ami_r ); + DECLARE_WRITE8_MEMBER( amo_w ); + DECLARE_READ8_MEMBER( cli_r ); + DECLARE_WRITE8_MEMBER( sso_w ); + DECLARE_READ8_MEMBER( sti_r ); + DECLARE_WRITE8_MEMBER( sto_w ); + DECLARE_WRITE_LINE_MEMBER( keydtr_w ); + DECLARE_WRITE_LINE_MEMBER( hs_w ); + DECLARE_WRITE_LINE_MEMBER( vs_w ); + DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); + DECLARE_PALETTE_INIT( abc806 ); + MC6845_UPDATE_ROW( abc806_update_row ); + + // memory state + int m_keydtr; // keyboard DTR + int m_eme; // extended memory enable + UINT8 m_map[16]; // memory page register + + // video state + int m_txoff; // text display enable + int m_40; // 40/80 column mode + int m_flshclk_ctr; // flash clock counter + int m_flshclk; // flash clock + UINT8 m_attr_data; // attribute data latch + UINT8 m_hrc[16]; // HR palette + UINT8 m_sync; // line synchronization delay + UINT8 m_v50_addr; // vertical sync PROM address + int m_hru2_a8; // HRU II PROM address line 8 + UINT32 m_vsync_shift; // vertical sync shift register + int m_vsync; // vertical sync + int m_d_vsync; // delayed vertical sync +}; + + + +//************************************************************************** +// MACHINE CONFIGURATION +//************************************************************************** + +/*----------- defined in video/abc800.c -----------*/ + +MACHINE_CONFIG_EXTERN(abc800m_video); +MACHINE_CONFIG_EXTERN(abc800c_video); + +/*----------- defined in video/abc802.c -----------*/ + +MACHINE_CONFIG_EXTERN(abc802_video); + +/*----------- defined in video/abc806.c -----------*/ + +MACHINE_CONFIG_EXTERN(abc806_video); + +#endif diff --git a/src/mame/includes/ac1.h b/src/mame/includes/ac1.h new file mode 100644 index 00000000000..b18cad87b24 --- /dev/null +++ b/src/mame/includes/ac1.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/ac1.h + * + ****************************************************************************/ + +#ifndef AC1_H_ +#define AC1_H_ + +#include "machine/z80pio.h" +#include "imagedev/cassette.h" + +class ac1_state : public driver_device +{ +public: + ac1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cassette(*this, "cassette"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_io_line(*this, "LINE") + { } + + DECLARE_DRIVER_INIT(ac1); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_ac1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_ac1_32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER(ac1_port_b_r); + DECLARE_READ8_MEMBER(ac1_port_a_r); + DECLARE_WRITE8_MEMBER(ac1_port_a_w); + DECLARE_WRITE8_MEMBER(ac1_port_b_w); + +private: + required_device m_cassette; + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_ioport_array<7> m_io_line; +}; + +/*----------- defined in video/ac1.c -----------*/ +extern const gfx_layout ac1_charlayout; + +#endif /* AC1_h_ */ diff --git a/src/mame/includes/adam.h b/src/mame/includes/adam.h new file mode 100644 index 00000000000..1705011db88 --- /dev/null +++ b/src/mame/includes/adam.h @@ -0,0 +1,118 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef ADAM_H_ +#define ADAM_H_ + +#include "emu.h" +#include "bus/adam/exp.h" +#include "bus/adamnet/adamnet.h" +#include "bus/coleco/ctrl.h" +#include "bus/coleco/exp.h" +#include "cpu/z80/z80.h" +#include "cpu/m6800/m6800.h" +#include "machine/coleco.h" +#include "machine/ram.h" +#include "sound/sn76496.h" +#include "video/tms9928a.h" + +#define Z80_TAG "u1" +#define M6801_TAG "u6" +#define SN76489A_TAG "u20" +#define TMS9928A_TAG "tms9928a" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" + +class adam_state : public driver_device +{ +public: + adam_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_netcpu(*this, M6801_TAG), + m_vdc(*this, TMS9928A_TAG), + m_psg(*this, SN76489A_TAG), + m_ram(*this, RAM_TAG), + m_adamnet(*this, ADAMNET_TAG), + m_slot1(*this, ADAM_LEFT_EXPANSION_SLOT_TAG), + m_slot2(*this, ADAM_CENTER_EXPANSION_SLOT_TAG), + m_slot3(*this, ADAM_RIGHT_EXPANSION_SLOT_TAG), + m_cart(*this, COLECOVISION_CARTRIDGE_SLOT_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_boot_rom(*this, "boot"), + m_os7_rom(*this, "os7"), + m_mioc(0), + m_game(0), + m_an(0), + m_dma(1), + m_bwr(1), + m_spindis(1) + { } + + required_device m_maincpu; + required_device m_netcpu; + required_device m_vdc; + required_device m_psg; + required_device m_ram; + required_device m_adamnet; + required_device m_slot1; + required_device m_slot2; + required_device m_slot3; + required_device m_cart; + required_device m_joy1; + required_device m_joy2; + required_memory_region m_boot_rom; + required_memory_region m_os7_rom; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( mreq_r ); + DECLARE_WRITE8_MEMBER( mreq_w ); + DECLARE_READ8_MEMBER( iorq_r ); + DECLARE_WRITE8_MEMBER( iorq_w ); + + DECLARE_READ8_MEMBER( adamnet_r ); + DECLARE_WRITE8_MEMBER( adamnet_w ); + DECLARE_READ8_MEMBER( mioc_r ); + DECLARE_WRITE8_MEMBER( mioc_w ); + + DECLARE_WRITE8_MEMBER( m6801_p1_w ); + DECLARE_READ8_MEMBER( m6801_p2_r ); + DECLARE_WRITE8_MEMBER( m6801_p2_w ); + DECLARE_READ8_MEMBER( m6801_p3_r ); + DECLARE_WRITE8_MEMBER( m6801_p3_w ); + DECLARE_WRITE8_MEMBER( m6801_p4_w ); + + DECLARE_WRITE_LINE_MEMBER( vdc_int_w ); + + DECLARE_WRITE_LINE_MEMBER( os3_w ); + + DECLARE_WRITE_LINE_MEMBER( joy1_irq_w ); + DECLARE_WRITE_LINE_MEMBER( joy2_irq_w ); + + // memory state + UINT8 m_mioc; + int m_game; + + // ADAMnet state + UINT8 m_an; + + // DMA state + UINT16 m_ba; + int m_dma; + int m_bwr; + UINT8 m_data_in; + UINT8 m_data_out; + + // paddle state + int m_spindis; + + // video state + int m_vdp_nmi; +}; + +#endif diff --git a/src/mame/includes/advision.h b/src/mame/includes/advision.h new file mode 100644 index 00000000000..3aa523c56df --- /dev/null +++ b/src/mame/includes/advision.h @@ -0,0 +1,87 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/***************************************************************************** + * + * includes/advision.h + * + ****************************************************************************/ + +#ifndef __ADVISION__ +#define __ADVISION__ + +#include "sound/dac.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define SCREEN_TAG "screen" +#define I8048_TAG "i8048" +#define COP411_TAG "cop411" + +class advision_state : public driver_device +{ +public: + advision_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I8048_TAG), + m_soundcpu(*this, COP411_TAG), + m_dac(*this, "dac"), + m_cart(*this, "cartslot"), + m_bank1(*this, "bank1"), + m_joy(*this, "joystick"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_soundcpu; + required_device m_dac; + required_device m_cart; + required_memory_bank m_bank1; + required_ioport m_joy; + required_device m_palette; + + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void update_dac(); + void vh_write(int data); + void vh_update(int x); + + DECLARE_READ8_MEMBER( rom_r ); + DECLARE_READ8_MEMBER( ext_ram_r ); + DECLARE_WRITE8_MEMBER( ext_ram_w ); + DECLARE_READ8_MEMBER( controller_r ); + DECLARE_WRITE8_MEMBER( bankswitch_w ); + DECLARE_WRITE8_MEMBER( av_control_w ); + DECLARE_READ8_MEMBER( vsync_r ); + DECLARE_READ8_MEMBER( sound_cmd_r ); + DECLARE_WRITE8_MEMBER( sound_g_w ); + DECLARE_WRITE8_MEMBER( sound_d_w ); + + memory_region *m_cart_rom; + + int m_ea_bank; + + /* external RAM state */ + dynamic_buffer m_ext_ram; + int m_rambank; + + /* video state */ + int m_frame_count; + int m_frame_start; + int m_video_enable; + int m_video_bank; + int m_video_hpos; + UINT8 m_led_latch[8]; + dynamic_buffer m_display; + + /* sound state */ + int m_sound_cmd; + int m_sound_d; + int m_sound_g; + DECLARE_PALETTE_INIT(advision); +}; + +#endif diff --git a/src/mame/includes/aim65.h b/src/mame/includes/aim65.h new file mode 100644 index 00000000000..724fe61cb4c --- /dev/null +++ b/src/mame/includes/aim65.h @@ -0,0 +1,99 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner, Dan Boris, Dirk Best, Robbbert +/***************************************************************************** + * + * includes/aim65.h + * + * Rockwell AIM-65 + * + ****************************************************************************/ + +#ifndef AIM65_H_ +#define AIM65_H_ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "video/dl1416.h" +#include "machine/6522via.h" +#include "machine/mos6530n.h" +#include "machine/6821pia.h" +#include "machine/ram.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +/** R6502 Clock. + * + * The R6502 on AIM65 operates at 1 MHz. The frequency reference is a 4 MHz + * crystal controlled oscillator. Dual D-type flip-flop Z10 divides the 4 MHz + * signal by four to drive the R6502 phase 0 (O0) input with a 1 MHz clock. + */ +#define AIM65_CLOCK XTAL_4MHz/4 + + +class aim65_state : public driver_device +{ +public: + aim65_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette1(*this, "cassette"), + m_cassette2(*this, "cassette2"), + m_z24(*this, "z24"), + m_z25(*this, "z25"), + m_z26(*this, "z26"), + m_ram(*this, RAM_TAG), + m_ds1(*this, "ds1"), + m_ds2(*this, "ds2"), + m_ds3(*this, "ds3"), + m_ds4(*this, "ds4"), + m_ds5(*this, "ds5") + { } + + DECLARE_WRITE8_MEMBER(aim65_pia_a_w); + DECLARE_WRITE8_MEMBER(aim65_pia_b_w); + DECLARE_READ8_MEMBER(aim65_riot_b_r); + DECLARE_WRITE8_MEMBER(aim65_riot_a_w); + DECLARE_WRITE8_MEMBER(aim65_pa_w); + DECLARE_WRITE8_MEMBER(aim65_pb_w); + DECLARE_WRITE8_MEMBER(aim65_printer_on); + DECLARE_READ8_MEMBER(aim65_pb_r); + UINT8 m_pia_a; + UINT8 m_pia_b; + UINT8 m_riot_port_a; + UINT8 m_pb_save; + + required_device m_maincpu; + required_device m_cassette1; + required_device m_cassette2; + required_device m_z24; + required_device m_z25; + required_device m_z26; + required_device m_ram; + required_device m_ds1; + required_device m_ds2; + required_device m_ds3; + required_device m_ds4; + required_device m_ds5; + virtual void machine_start(); + TIMER_CALLBACK_MEMBER(aim65_printer_timer); + void aim65_pia(); + + DECLARE_WRITE16_MEMBER(aim65_update_ds1); + DECLARE_WRITE16_MEMBER(aim65_update_ds2); + DECLARE_WRITE16_MEMBER(aim65_update_ds3); + DECLARE_WRITE16_MEMBER(aim65_update_ds4); + DECLARE_WRITE16_MEMBER(aim65_update_ds5); + + void dl1416_update(dl1416_device *device, int index); + + int load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z24_load) { return load_cart(image, m_z24, "z24"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z25_load) { return load_cart(image, m_z25, "z25"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z26_load) { return load_cart(image, m_z26, "z26"); } +}; + + +#endif /* AIM65_H_ */ diff --git a/src/mame/includes/alesis.h b/src/mame/includes/alesis.h new file mode 100644 index 00000000000..a0acc3db8f4 --- /dev/null +++ b/src/mame/includes/alesis.h @@ -0,0 +1,115 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Alesis HR-16 and SR-16 drum machines + +****************************************************************************/ + +#pragma once + +#ifndef _ALESIS_H_ +#define _ALESIS_H_ + +#include "cpu/mcs51/mcs51.h" +#include "machine/nvram.h" +#include "sound/dac.h" +#include "video/hd44780.h" +#include "imagedev/cassette.h" +#include "rendlay.h" + +#define MCFG_ALESIS_DM3AG_ADD(_tag,_clock) \ + MCFG_DEVICE_ADD( _tag, ALESIS_DM3AG, _clock ) + + +// ======================> alesis_dm3ag_device + +class alesis_dm3ag_device : public device_t +{ +public: + // construction/destruction + alesis_dm3ag_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + + // device interface + DECLARE_WRITE8_MEMBER(write); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + static const device_timer_id TIMER_DAC_UPDATE = 1; + required_device m_dac; + required_region_ptr m_samples; + + emu_timer * m_dac_update_timer; + bool m_output_active; + int m_count; + int m_shift; + UINT32 m_cur_sample; + UINT8 m_cmd[5]; +}; + + +// ======================> alesis_state + +class alesis_state : public driver_device +{ +public: + alesis_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_lcdc(*this, "hd44780"), + m_cassette(*this, "cassette"), + m_maincpu(*this, "maincpu"), + m_col1(*this, "COL1"), + m_col2(*this, "COL2"), + m_col3(*this, "COL3"), + m_col4(*this, "COL4"), + m_col5(*this, "COL5"), + m_col6(*this, "COL6"), + m_select(*this, "SELECT") + { } + + required_device m_lcdc; + optional_device m_cassette; + + DECLARE_PALETTE_INIT(alesis); + virtual void machine_reset(); + + void update_lcd_symbols(bitmap_ind16 &bitmap, UINT8 pos, UINT8 y, UINT8 x, int state); + DECLARE_DRIVER_INIT(hr16); + DECLARE_WRITE8_MEMBER( led_w ); + DECLARE_WRITE8_MEMBER( mmt8_led_w ); + DECLARE_READ8_MEMBER( mmt8_led_r ); + DECLARE_WRITE8_MEMBER( track_led_w ); + DECLARE_WRITE8_MEMBER( kb_matrix_w ); + DECLARE_READ8_MEMBER( kb_r ); + DECLARE_READ8_MEMBER( p3_r ); + DECLARE_WRITE8_MEMBER( p3_w ); + DECLARE_READ8_MEMBER( mmt8_p3_r ); + DECLARE_WRITE8_MEMBER( mmt8_p3_w ); + DECLARE_WRITE8_MEMBER( sr16_lcd_w ); + +private: + UINT8 m_kb_matrix; + UINT8 m_leds; + UINT8 m_lcd_digits[5]; + required_device m_maincpu; + required_ioport m_col1; + required_ioport m_col2; + required_ioport m_col3; + required_ioport m_col4; + required_ioport m_col5; + required_ioport m_col6; + optional_ioport m_select; +}; + +// device type definition +extern const device_type ALESIS_DM3AG; + +#endif // _ALESIS_H_ diff --git a/src/mame/includes/amstrad.h b/src/mame/includes/amstrad.h new file mode 100644 index 00000000000..40c798ccbdb --- /dev/null +++ b/src/mame/includes/amstrad.h @@ -0,0 +1,325 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Barry Rodewald +/***************************************************************************** + * + * includes/amstrad.h + * + ****************************************************************************/ + +#ifndef AMSTRAD_H_ +#define AMSTRAD_H_ + +#include "cpu/z80/z80.h" +#include "sound/ay8910.h" +#include "machine/upd765.h" +#include "video/mc6845.h" +#include "machine/i8255.h" +#include "machine/mc146818.h" +#include "imagedev/snapquik.h" +#include "bus/cpc/cpcexp.h" +#include "bus/cpc/ddi1.h" +#include "bus/cpc/cpc_ssa1.h" +#include "bus/cpc/cpc_rom.h" +#include "bus/cpc/mface2.h" +#include "bus/cpc/cpc_pds.h" +#include "bus/cpc/cpc_rs232.h" +#include "bus/cpc/symbfac2.h" +#include "bus/cpc/amdrum.h" +#include "bus/cpc/playcity.h" +#include "bus/cpc/smartwatch.h" +#include "bus/cpc/brunword4.h" +#include "bus/cpc/hd20.h" +#include "bus/cpc/magicsound.h" +#include "machine/ram.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "bus/centronics/comxpl80.h" +#include "bus/centronics/epson_ex800.h" +#include "bus/centronics/epson_lx800.h" +#include "bus/centronics/epson_lx810l.h" +#include "bus/centronics/printer.h" +#include "bus/centronics/digiblst.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +/**************************** + * Gate Array data (CPC) - + ****************************/ +struct gate_array_t +{ + bitmap_ind16 *bitmap; /* The bitmap we work on */ + UINT8 pen_selected; /* Pen selection */ + UINT8 mrer; /* Mode and ROM Enable Register */ + UINT8 upper_bank; + UINT8 romdis; // ROMDIS signal from the expansion port + + /* input signals from CRTC */ + int vsync; + int hsync; + int de; + int ma; + int ra; + + /* used for timing */ + int hsync_after_vsync_counter; + int hsync_counter; /* The gate array counts CRTC HSYNC pulses using an internal 6-bit counter. */ + + /* used for drawing the screen */ + attotime last_draw_time; + int y; + UINT16 *draw_p; /* Position in the bitmap where we are currently drawing */ + UINT16 colour; + UINT16 address; + UINT8 *mode_lookup; + UINT8 data; + UINT8 ticks; + UINT8 ticks_increment; + UINT16 line_ticks; + UINT8 colour_ticks; + UINT8 max_colour_ticks; +}; + +/**************************** + * ASIC data (CPC plus) + ****************************/ +struct asic_t +{ + UINT8 *ram; /* pointer to RAM used for the CPC+ ASIC memory-mapped registers */ + UINT8 enabled; /* Are CPC plus features enabled/unlocked */ + UINT8 pri; /* Programmable raster interrupt */ + UINT8 seqptr; /* Current position in the ASIC unlocking sequence */ + UINT8 rmr2; /* ROM mapping register 2 */ + UINT16 split_ma_base; /* Used to handle split screen support */ + UINT16 split_ma_started; /* Used to handle split screen support */ + UINT16 vpos; /* Current logical scanline */ + UINT16 h_start; /* Position where DE became active */ + UINT16 h_end; /* Position where DE became inactive */ + UINT8 addr_6845; /* We need these to store a shadow copy of R1 of the mc6845 */ + UINT8 horiz_disp; + UINT8 hscroll; + UINT8 de_start; /* flag to check if DE is been enabled this frame yet */ + + /* DMA */ + UINT8 dma_status; + UINT8 dma_clear; /* Set if DMA interrupts are to be cleared automatically */ + UINT8 dma_prescaler[3]; /* DMA channel prescaler */ + UINT16 dma_repeat[3]; /* Location of the DMA channel's last repeat */ + UINT16 dma_addr[3]; /* DMA channel address */ + UINT16 dma_loopcount[3]; /* Count loops taken on this channel */ + UINT16 dma_pause[3]; /* DMA pause count */ +}; + + +class amstrad_state : public driver_device +{ +public: + enum + { + TIMER_PC2_LOW, + TIMER_VIDEO_UPDATE, + TIMER_SET_RESOLUTION + }; + + amstrad_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ay(*this, "ay"), + m_fdc(*this, "upd765"), + m_crtc(*this, "mc6845"), + m_ppi(*this, "ppi8255"), + m_centronics(*this, "centronics"), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_ram(*this, RAM_TAG), + m_exp(*this, "exp"), + m_rtc(*this, "rtc"), + m_region_maincpu(*this, "maincpu"), + m_region_user1(*this, "user1"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_bank5(*this, "bank5"), + m_bank6(*this, "bank6"), + m_bank7(*this, "bank7"), + m_bank8(*this, "bank8"), + m_bank9(*this, "bank9"), + m_bank10(*this, "bank10"), + m_bank11(*this, "bank11"), + m_bank12(*this, "bank12"), + m_bank13(*this, "bank13"), + m_bank14(*this, "bank14"), + m_bank15(*this, "bank15"), + m_bank16(*this, "bank16"), + m_io_kbrow(*this, "kbrow"), + m_io_analog(*this, "analog"), + m_io_mouse1(*this,"mouse_input1"), + m_io_mouse2(*this,"mouse_input2"), + m_io_mouse3(*this,"mouse_input3"), + m_io_solder_links(*this, "solder_links"), + m_io_green_display(*this, "green_display"), + m_io_ctrltype(*this,"controller_type"), + m_screen(*this, "screen"), + m_palette(*this, "palette") { } + + required_device m_maincpu; + required_device m_ay; + optional_device m_fdc; // not on a GX4000 + required_device m_crtc; + required_device m_ppi; + optional_device m_centronics; // not on a GX4000 + optional_device m_cassette; // not on a GX4000, (or technically, the 6128+) + optional_device m_cart; // only on 664+, 6128+ and GX4000 + required_device m_ram; + optional_device m_exp; // not on a GX4000 + optional_device m_rtc; // Aleste 520EX only + + int m_system_type; + UINT8 m_aleste_mode; + int m_plus_irq_cause; + gate_array_t m_gate_array; + asic_t m_asic; + int m_GateArray_RamConfiguration; + unsigned char *m_AmstradCPC_RamBanks[4]; + unsigned char *m_Aleste_RamBanks[4]; + int m_aleste_active_page[4]; + unsigned char *m_Amstrad_ROM_Table[256]; + UINT8 m_ppi_port_inputs[3]; + UINT8 m_ppi_port_outputs[3]; + int m_aleste_rtc_function; + int m_prev_reg; + UINT16 m_GateArray_render_colours[17]; + UINT8 m_mode0_lookup[256]; + UINT8 m_mode1_lookup[256]; + UINT8 m_mode2_lookup[256]; + int m_prev_data; + int m_printer_bit8_selected; + unsigned char m_Psg_FunctionSelected; + int m_previous_ppi_portc_w; + UINT8 m_amx_mouse_data; + DECLARE_WRITE8_MEMBER(amstrad_plus_asic_4000_w); + DECLARE_WRITE8_MEMBER(amstrad_plus_asic_6000_w); + DECLARE_READ8_MEMBER(amstrad_plus_asic_4000_r); + DECLARE_READ8_MEMBER(amstrad_plus_asic_6000_r); + DECLARE_WRITE8_MEMBER(aleste_msx_mapper); + DECLARE_READ8_MEMBER(amstrad_cpc_io_r); + DECLARE_WRITE8_MEMBER(amstrad_cpc_io_w); + DECLARE_READ8_MEMBER(amstrad_psg_porta_read); + void amstrad_plus_seqcheck(int data); + DECLARE_MACHINE_START(amstrad); + DECLARE_MACHINE_RESET(amstrad); + DECLARE_VIDEO_START(amstrad); + DECLARE_PALETTE_INIT(amstrad_cpc); + DECLARE_PALETTE_INIT(amstrad_cpc_green); + DECLARE_MACHINE_START(plus); + DECLARE_MACHINE_RESET(plus); + DECLARE_PALETTE_INIT(amstrad_plus); + DECLARE_MACHINE_START(gx4000); + DECLARE_MACHINE_RESET(gx4000); + DECLARE_MACHINE_START(kccomp); + DECLARE_MACHINE_RESET(kccomp); + DECLARE_PALETTE_INIT(kccomp); + DECLARE_MACHINE_START(aleste); + DECLARE_MACHINE_RESET(aleste); + DECLARE_PALETTE_INIT(aleste); + UINT32 screen_update_amstrad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_amstrad(screen_device &screen, bool state); + DECLARE_INPUT_CHANGED_MEMBER(cpc_monitor_changed); + TIMER_CALLBACK_MEMBER(amstrad_pc2_low); + TIMER_CALLBACK_MEMBER(amstrad_video_update_timer); + TIMER_CALLBACK_MEMBER(cb_set_resolution); + DECLARE_WRITE_LINE_MEMBER(amstrad_hsync_changed); + DECLARE_WRITE_LINE_MEMBER(amstrad_plus_hsync_changed); + DECLARE_WRITE_LINE_MEMBER(amstrad_vsync_changed); + DECLARE_WRITE_LINE_MEMBER(amstrad_plus_vsync_changed); + DECLARE_WRITE_LINE_MEMBER(amstrad_de_changed); + DECLARE_WRITE_LINE_MEMBER(amstrad_plus_de_changed); + DECLARE_READ8_MEMBER(amstrad_ppi_porta_r); + DECLARE_WRITE8_MEMBER(amstrad_ppi_porta_w); + DECLARE_READ8_MEMBER(amstrad_ppi_portb_r); + DECLARE_WRITE8_MEMBER(amstrad_ppi_portc_w); + + DECLARE_WRITE_LINE_MEMBER( cpc_romdis ); + DECLARE_WRITE_LINE_MEMBER( cpc_romen ); + DECLARE_WRITE8_MEMBER(rom_select); + + DECLARE_FLOPPY_FORMATS( aleste_floppy_formats ); + + IRQ_CALLBACK_MEMBER(amstrad_cpu_acknowledge_int); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( amstrad_plus_cartridge ); + + void amstrad_handle_snapshot(unsigned char *pSnapshot); + void amstrad_rethinkMemory(); + DECLARE_SNAPSHOT_LOAD_MEMBER( amstrad ); + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + +protected: + required_memory_region m_region_maincpu; + optional_memory_region m_region_user1; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_memory_bank m_bank5; + required_memory_bank m_bank6; + required_memory_bank m_bank7; + required_memory_bank m_bank8; + required_memory_bank m_bank9; + required_memory_bank m_bank10; + required_memory_bank m_bank11; + required_memory_bank m_bank12; + required_memory_bank m_bank13; + required_memory_bank m_bank14; + required_memory_bank m_bank15; + required_memory_bank m_bank16; + optional_ioport_array<11> m_io_kbrow; + optional_ioport_array<4> m_io_analog; + optional_ioport m_io_mouse1; + optional_ioport m_io_mouse2; + optional_ioport m_io_mouse3; + required_ioport m_io_solder_links; + required_ioport m_io_green_display; + optional_ioport m_io_ctrltype; + required_device m_screen; + required_device m_palette; + + memory_region *m_region_cart; + + void amstrad_init_lookups(); + void amstrad_vh_update_mode(); + void amstrad_plus_dma_parse(int channel); + void amstrad_plus_handle_dma(); + void amstrad_vh_update_colour(int PenIndex, UINT16 hw_colour_index); + void aleste_vh_update_colour(int PenIndex, UINT16 hw_colour_index); + void amstrad_gate_array_get_video_data(); + void amstrad_update_video(); + void amstrad_plus_gate_array_get_video_data(); + void amstrad_plus_update_video(); + void amstrad_plus_update_video_sprites(); + void amstrad_setLowerRom(); + void amstrad_setUpperRom(); + void AmstradCPC_GA_SetRamConfiguration(); + void AmstradCPC_PALWrite(int data); + void amstrad_GateArray_write(UINT8 dataToGateArray); + void amstrad_reset_machine(); + void kccomp_reset_machine(); + void update_psg(); + void amstrad_common_init(); + void enumerate_roms(); + unsigned char kccomp_get_colour_element(int colour_value); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + int m_centronics_busy; +}; + + +/*----------- defined in machine/amstrad.c -----------*/ + + +SLOT_INTERFACE_EXTERN(cpc_exp_cards); +SLOT_INTERFACE_EXTERN(cpcplus_exp_cards); + +#endif /* AMSTRAD_H_ */ diff --git a/src/mame/includes/apollo.h b/src/mame/includes/apollo.h new file mode 100644 index 00000000000..41b0f04e6ff --- /dev/null +++ b/src/mame/includes/apollo.h @@ -0,0 +1,602 @@ +// license:BSD-3-Clause +// copyright-holders:Hans Ostermeyer, R. Belmont +/* + * apollo.h - APOLLO DN3500/DN3000 driver includes + * + * Created on: May 12, 2010 + * Author: Hans Ostermeyer + * + */ + +#pragma once + +#ifndef APOLLO_H_ +#define APOLLO_H_ + +#include "emu.h" + +#include "cpu/m68000/m68000.h" +#include "bus/rs232/rs232.h" +#include "machine/terminal.h" +#include "machine/ram.h" +#include "machine/6840ptm.h" +#include "machine/mc68681.h" +#include "machine/am9517a.h" +#include "machine/pic8259.h" +#include "machine/mc146818.h" +#include "machine/apollo_kbd.h" +#include "machine/clock.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "bus/isa/3c505.h" + +#ifndef VERBOSE +#define VERBOSE 0 +#endif + +#define LOG(x) { logerror x; logerror ("\n"); apollo_check_log(); } +#define LOG1(x) { if (VERBOSE > 0) LOG(x) } +#define LOG2(x) { if (VERBOSE > 1) LOG(x) } +#define CLOG(x) { logerror ("%s - %s: ", apollo_cpu_context(machine().device(MAINCPU)), tag()); LOG(x) } +#define CLOG1(x) { if (VERBOSE > 0) CLOG(x) } +#define CLOG2(x) { if (VERBOSE > 1) CLOG(x) } +#define DLOG(x) { logerror ("%s - %s: ", apollo_cpu_context(device->machine().device(MAINCPU)), device->tag()); LOG(x) } +#define DLOG1(x) { if (VERBOSE > 0) DLOG(x) } +#define DLOG2(x) { if (VERBOSE > 1) DLOG(x) } +#define MLOG(x) { logerror ("%s: ", apollo_cpu_context(machine().device(MAINCPU))); LOG(x) } +#define MLOG1(x) { if (VERBOSE > 0) MLOG(x) } +#define MLOG2(x) { if (VERBOSE > 1) MLOG(x) } +#define SLOG(x) { logerror ("%s: ", apollo_cpu_context(&space.device())); LOG(x) } +#define SLOG1(x) { if (VERBOSE > 0) SLOG(x) } +#define SLOG2(x) { if (VERBOSE > 1) SLOG(x) } + +#define MAINCPU "maincpu" + +/*----------- machine/apollo_dbg.c -----------*/ + +int apollo_debug_instruction_hook(m68000_base_device *device, offs_t curpc); + +/*----------- drivers/apollo.c -----------*/ + +// return the current CPU context for log file entries +const char *apollo_cpu_context(device_t *cpu); + +// enable/disable the FPU +void apollo_set_cpu_has_fpu(m68000_base_device *device, int onoff); + +// check for excessive logging +void apollo_check_log(); + +// return 1 if node is DN3000 or DSP3000, 0 otherwise +int apollo_is_dn3000(void); + +// return 1 if node is DSP3000 or DSP3500, 0 otherwise +int apollo_is_dsp3x00(void); + +// get the ram configuration byte +UINT8 apollo_get_ram_config_byte(void); + +//apollo_get_node_id - get the node id +UINT32 apollo_get_node_id(void); + + // should be called by the CPU core before executing each instruction +int apollo_instruction_hook(m68000_base_device *device, offs_t curpc); + +void apollo_set_cache_status_register(UINT8 mask, UINT8 data); + +/*----------- machine/apollo.c -----------*/ + +#define APOLLO_CONF_TAG "conf" +#define APOLLO_DMA1_TAG "dma8237_1" +#define APOLLO_DMA2_TAG "dma8237_2" +#define APOLLO_KBD_TAG "kbd" +#define APOLLO_STDIO_TAG "stdio" +#define APOLLO_PIC1_TAG "pic8259_master" +#define APOLLO_PIC2_TAG "pic8259_slave" +#define APOLLO_PTM_TAG "ptm" +#define APOLLO_RTC_TAG "rtc" +#define APOLLO_SIO_TAG "sio" +#define APOLLO_SIO2_TAG "sio2" +#define APOLLO_ETH_TAG "3c505" +#define APOLLO_ISA_TAG "isabus" + +// forward declaration +class apollo_sio; + +class apollo_state : public driver_device +{ +public: + apollo_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, MAINCPU), + m_messram_ptr(*this, "messram"), + m_dma8237_1(*this, APOLLO_DMA1_TAG), + m_dma8237_2(*this, APOLLO_DMA2_TAG), + m_pic8259_master(*this, APOLLO_PIC1_TAG), + m_pic8259_slave(*this, APOLLO_PIC2_TAG), + m_ptm(*this, APOLLO_PTM_TAG), + m_sio(*this, APOLLO_SIO_TAG), + m_sio2(*this, APOLLO_SIO2_TAG), + m_rtc(*this, APOLLO_RTC_TAG), + m_isa(*this, APOLLO_ISA_TAG) + { } + + required_device m_maincpu; + required_shared_ptr m_messram_ptr; + + required_device m_dma8237_1; + required_device m_dma8237_2; + required_device m_pic8259_master; + required_device m_pic8259_slave; + required_device m_ptm; + required_device m_sio; + optional_device m_sio2; + required_device m_rtc; + required_device m_isa; + + DECLARE_WRITE16_MEMBER(apollo_csr_status_register_w); + DECLARE_READ16_MEMBER(apollo_csr_status_register_r); + DECLARE_WRITE16_MEMBER(apollo_csr_control_register_w); + DECLARE_READ16_MEMBER(apollo_csr_control_register_r); + DECLARE_WRITE8_MEMBER(apollo_dma_1_w); + DECLARE_READ8_MEMBER(apollo_dma_1_r); + DECLARE_WRITE8_MEMBER(apollo_dma_2_w); + DECLARE_READ8_MEMBER(apollo_dma_2_r); + DECLARE_WRITE8_MEMBER(apollo_dma_page_register_w); + DECLARE_READ8_MEMBER(apollo_dma_page_register_r); + DECLARE_WRITE16_MEMBER(apollo_address_translation_map_w); + DECLARE_READ16_MEMBER(apollo_address_translation_map_r); + DECLARE_READ8_MEMBER(apollo_dma_read_byte); + DECLARE_WRITE8_MEMBER(apollo_dma_write_byte); + DECLARE_READ8_MEMBER(apollo_dma_read_word); + DECLARE_WRITE8_MEMBER(apollo_dma_write_word); + DECLARE_WRITE8_MEMBER(apollo_rtc_w); + DECLARE_READ8_MEMBER(apollo_rtc_r); + DECLARE_WRITE8_MEMBER(cache_control_register_w); + DECLARE_READ8_MEMBER(cache_status_register_r); + DECLARE_WRITE8_MEMBER(task_alias_register_w); + DECLARE_READ8_MEMBER(task_alias_register_r); + DECLARE_WRITE16_MEMBER(apollo_node_id_w); + DECLARE_READ16_MEMBER(apollo_node_id_r); + DECLARE_WRITE16_MEMBER(latch_page_on_parity_error_register_w); + DECLARE_READ16_MEMBER(latch_page_on_parity_error_register_r); + DECLARE_WRITE8_MEMBER(master_req_register_w); + DECLARE_READ8_MEMBER(master_req_register_r); + DECLARE_WRITE16_MEMBER(selective_clear_locations_w); + DECLARE_READ16_MEMBER(selective_clear_locations_r); + DECLARE_READ32_MEMBER(ram_with_parity_r); + DECLARE_WRITE32_MEMBER(ram_with_parity_w); + DECLARE_READ32_MEMBER(apollo_unmapped_r); + DECLARE_WRITE32_MEMBER(apollo_unmapped_w); + DECLARE_WRITE32_MEMBER(apollo_rom_w); + DECLARE_READ16_MEMBER(apollo_atbus_io_r); + DECLARE_WRITE16_MEMBER(apollo_atbus_io_w); + DECLARE_READ16_MEMBER(apollo_atbus_memory_r); + DECLARE_WRITE16_MEMBER(apollo_atbus_memory_w); + DECLARE_WRITE8_MEMBER(dn5500_memory_present_register_w); + DECLARE_READ8_MEMBER(dn5500_memory_present_register_r); + DECLARE_WRITE8_MEMBER(dn5500_11500_w); + DECLARE_READ8_MEMBER(dn5500_11500_r); + DECLARE_WRITE8_MEMBER(dn5500_io_protection_map_w); + DECLARE_READ8_MEMBER(dn5500_io_protection_map_r); + DECLARE_READ32_MEMBER(apollo_f8_r); + DECLARE_WRITE32_MEMBER(apollo_f8_w); + DECLARE_DRIVER_INIT(dsp3000); + DECLARE_DRIVER_INIT(dsp5500); + DECLARE_DRIVER_INIT(dn3500); + DECLARE_DRIVER_INIT(dn3000); + DECLARE_DRIVER_INIT(dsp3500); + DECLARE_DRIVER_INIT(dn5500); + DECLARE_DRIVER_INIT(apollo); + + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_MACHINE_RESET(apollo); + DECLARE_MACHINE_START(apollo); + + IRQ_CALLBACK_MEMBER(apollo_irq_acknowledge); + IRQ_CALLBACK_MEMBER(apollo_pic_acknowledge); + void apollo_bus_error(); + DECLARE_WRITE8_MEMBER( apollo_kbd_putchar ); + DECLARE_READ_LINE_MEMBER( apollo_kbd_is_german ); + DECLARE_WRITE_LINE_MEMBER( apollo_dma8237_out_eop ); + DECLARE_WRITE_LINE_MEMBER( apollo_dma_1_hrq_changed ); + DECLARE_WRITE_LINE_MEMBER( apollo_dma_2_hrq_changed ); + DECLARE_WRITE_LINE_MEMBER( apollo_pic8259_master_set_int_line ); + DECLARE_WRITE_LINE_MEMBER( apollo_pic8259_slave_set_int_line ); + DECLARE_WRITE_LINE_MEMBER( sio_irq_handler ); + DECLARE_WRITE8_MEMBER( sio_output ); + DECLARE_WRITE_LINE_MEMBER( sio2_irq_handler ); + DECLARE_WRITE_LINE_MEMBER( apollo_ptm_irq_function ); + DECLARE_WRITE_LINE_MEMBER( apollo_ptm_timer_tick ); + DECLARE_READ8_MEMBER( apollo_pic8259_get_slave_ack ); + + DECLARE_READ8_MEMBER(pc_dma8237_0_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_1_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_2_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_3_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_5_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_6_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_7_dack_r); + DECLARE_WRITE8_MEMBER(pc_dma8237_0_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_1_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_2_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_3_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_5_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_6_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_7_dack_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack0_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack1_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack2_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack3_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack4_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack5_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack6_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack7_w); + TIMER_CALLBACK_MEMBER( apollo_rtc_timer ); + + void apollo_pic_set_irq_line(int irq, int state); + void select_dma_channel(int channel, bool state); + + DECLARE_WRITE_LINE_MEMBER(apollo_reset_instr_callback); + DECLARE_READ32_MEMBER(apollo_instruction_hook); + +private: + UINT32 ptm_counter; + UINT8 sio_output_data; + int m_dma_channel; + bool m_cur_eop; + emu_timer *m_dn3000_timer; +}; + +MACHINE_CONFIG_EXTERN( apollo ); +MACHINE_CONFIG_EXTERN( apollo_terminal ); + +/*----------- machine/apollo_config.c -----------*/ + +// configuration bit definitions + +#define APOLLO_CONF_SERVICE_MODE 0x0001 +#define APOLLO_CONF_DISPLAY 0x001e +#define APOLLO_CONF_8_PLANES 0x0002 +#define APOLLO_CONF_4_PLANES 0x0004 +#define APOLLO_CONF_MONO_15I 0x0008 +#define APOLLO_CONF_MONO_19I 0x0010 +#define APOLLO_CONF_GERMAN_KBD 0x0020 +#define APOLLO_CONF_20_YEARS_AGO 0x0040 +#define APOLLO_CONF_25_YEARS_AGO 0x0080 +#define APOLLO_CONF_NODE_ID 0x0100 +#define APOLLO_CONF_IDLE_SLEEP 0x0200 +#define APOLLO_CONF_TRAP_TRACE 0x0400 +#define APOLLO_CONF_FPU_TRACE 0x0800 +#define APOLLO_CONF_DISK_TRACE 0x1000 +#define APOLLO_CONF_NET_TRACE 0x2000 + +// check configuration setting +int apollo_config(int mask); + +INPUT_PORTS_EXTERN(apollo_config); + +/*----------- machine/apollo_csr.c -----------*/ + +#define APOLLO_CSR_SR_SERVICE 0x0001 +#define APOLLO_CSR_SR_ATBUS_IO_TIMEOUT 0x0002 +#define APOLLO_CSR_SR_FP_TRAP 0x0004 +#define APOLLO_CSR_SR_INTERRUPT_PENDING 0x0008 // DN3000 only +#define APOLLO_CSR_SR_PARITY_BYTE_MASK 0x00f0 +#define APOLLO_CSR_SR_CPU_TIMEOUT 0x0100 +#define APOLLO_CSR_SR_ATBUS_MEM_TIMEOUT 0x2000 +#define APOLLO_CSR_SR_BIT15 0x8000 +#define APOLLO_CSR_SR_CLEAR_ALL 0x3ffe + +#define APOLLO_CSR_CR_INTERRUPT_ENABLE 0x0001 +#define APOLLO_CSR_CR_RESET_DEVICES 0x0002 +#define APOLLO_CSR_CR_FPU_TRAP_ENABLE 0x0004 +#define APOLLO_CSR_CR_FORCE_BAD_PARITY 0x0008 +#define APOLLO_CSR_CR_PARITY_BYTE_MASK 0x00f0 + +UINT16 apollo_csr_get_control_register(void); +UINT16 apollo_csr_get_status_register(void); +void apollo_csr_set_status_register(UINT16 mask, UINT16 data); + +/*----------- machine/apollo_sio.c -----------*/ + +#define MCFG_APOLLO_SIO_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, APOLLO_SIO, _clock) + +#define MCFG_APOLLO_SIO_IRQ_CALLBACK(_cb) \ + devcb = &apollo_sio::set_irq_cb(*device, DEVCB_##_cb); + +#define MCFG_APOLLO_SIO_A_TX_CALLBACK(_cb) \ + devcb = &apollo_sio::set_a_tx_cb(*device, DEVCB_##_cb); + +#define MCFG_APOLLO_SIO_B_TX_CALLBACK(_cb) \ + devcb = &apollo_sio::set_b_tx_cb(*device, DEVCB_##_cb); + +#define MCFG_APOLLO_SIO_OUTPORT_CALLBACK(_cb) \ + devcb = &apollo_sio::set_outport_cb(*device, DEVCB_##_cb); + +class apollo_sio: public mc68681_device +{ +public: + apollo_sio(const machine_config &mconfig, const char *tag, + device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER(read); + DECLARE_WRITE8_MEMBER(write); + +protected: + virtual void device_reset(); + +private: + UINT8 m_csrb; + UINT8 m_ip6; +}; + +extern const device_type APOLLO_SIO; + +/*----------- video/apollo.c -----------*/ + +#define APOLLO_SCREEN_TAG "apollo_screen" + +class apollo_graphics_15i : public device_t +{ +public: + apollo_graphics_15i(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + apollo_graphics_15i(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, device_type type, const char *name, const char *shortname, const char *source); + ~apollo_graphics_15i(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + // monochrome control + DECLARE_READ8_MEMBER( apollo_mcr_r ); + DECLARE_WRITE8_MEMBER( apollo_mcr_w ); + + // monochrome and color memory + DECLARE_READ16_MEMBER( apollo_mem_r ); + DECLARE_WRITE16_MEMBER( apollo_mem_w ); + + // color control + DECLARE_READ8_MEMBER( apollo_ccr_r ); + DECLARE_WRITE8_MEMBER( apollo_ccr_w ); + + DECLARE_READ16_MEMBER( apollo_mgm_r ); + DECLARE_WRITE16_MEMBER( apollo_mgm_w ); + + DECLARE_READ16_MEMBER( apollo_cgm_r ); + DECLARE_WRITE16_MEMBER( apollo_cgm_w ); + + void vblank_state_changed(screen_device &screen, bool vblank_state); + + int is_mono() { return m_n_planes == 1; } + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +protected: + class lut_fifo; + class bt458; + + const char *cr_text(offs_t offset, UINT8 data, UINT8 rw); + + void increment_h_clock(); + void increment_v_clock(); + void increment_p_clock(); + + void log_cr1(const char * text); + void set_cr1(UINT8 data); + void set_cr3a(UINT8 data); + void set_cr3b(UINT8 data); + void set_lut_cr(UINT8 data); + + void register_vblank_callback(); + + UINT32 set_msb0(UINT32 value, UINT8 data) + { + return (value & 0xffffff00) | data; + } + UINT32 set_lsb0(UINT32 value, UINT8 data) + { + return (value & 0xffff00ff) | (data << 8); + } + UINT32 set_msb1(UINT32 value, UINT8 data) + { + return (value & 0xff00ffff) | (data << 16); + } + UINT32 set_lsb1(UINT32 value, UINT8 data) + { + return (value & 0x00ffffff) | (data << 24); + } + UINT8 get_msb1(UINT32 value) + { + return (value >> 16) & 0xff; + } + UINT8 get_lsb1(UINT32 value) + { + return (value >> 24) & 0xff; + } + + void set_status_rmw(); + UINT16 rop(UINT16 dest_data, UINT16 src_data, UINT8 plane); + void set_source_data(UINT32 offset); + UINT32 get_source_data(UINT8 plane); + void blt(UINT32 dest_addr, UINT16 mem_mask); + + UINT8 get_pixel(UINT32 offset, UINT16 mask); + UINT8 c4p_read_adc(UINT8 data); + UINT8 c8p_read_adc(UINT8 data); + + void screen_update1(bitmap_rgb32 &bitmap, const rectangle &cliprect); +protected: + UINT16 m_n_planes; + UINT16 m_width; + UINT16 m_height; + UINT16 m_buffer_width; + UINT16 m_buffer_height; + + UINT8 m_sr; + UINT8 m_device_id; + UINT16 m_write_enable_register; + UINT32 m_rop_register; + UINT16 m_diag_mem_request; + UINT8 m_cr0; + UINT8 m_cr1; + UINT8 m_cr2; + UINT8 m_cr2b; + UINT8 m_cr2_s_data; + UINT8 m_cr2_s_plane; + UINT8 m_cr2_d_plane; + UINT8 m_cr3a; + UINT8 m_cr3b; + UINT8 m_ad_result; + UINT8 m_ad_pending; + + UINT8 m_lut_control; + UINT8 m_lut_data; + + UINT8 m_update_flag; + UINT8 m_update_pending; + + UINT8 m_blt_cycle_count; + UINT32 m_image_offset; + UINT32 m_guard_latch[8]; + + int m_h_clock; + int m_v_clock; + int m_p_clock; + int m_data_clock; + + UINT16 *m_image_memory; + int m_image_plane_size; + int m_image_memory_size; + + UINT32 m_color_lookup_table[16]; + + lut_fifo *m_lut_fifo; + bt458 *m_bt458; +}; + + +#define LUT_FIFO_SIZE 1024 + + +//************************************************************************** +// class LUT Fifo +//************************************************************************** + +class apollo_graphics_15i::lut_fifo +{ +public: + lut_fifo() + { + reset(); + } + + void reset() + { + m_size = LUT_FIFO_SIZE; + m_get_index = 0; + m_put_index = 0; + } + + void put(const UINT8 data) + { + if (!is_full()) + { + m_data[m_put_index] = data; + m_put_index = (m_put_index + 1) % m_size; + } + } + + UINT8 get() + { + UINT8 data = is_empty() ? 0xff : m_data[m_get_index]; + m_get_index = (m_get_index + 1) % m_size; + return data; + } + + int is_empty() + { + return m_get_index == m_put_index; + } + + int is_full() + { + return ((m_put_index + 1) % m_size) == m_get_index; + } + +private: + UINT16 m_size; + UINT16 m_get_index; + UINT16 m_put_index; + UINT8 m_data[LUT_FIFO_SIZE]; +}; + +//************************************************************************** +// class Brooktree Bt458 +//************************************************************************** + +class apollo_graphics_15i::bt458 +{ +public: + bt458(running_machine &running_machine); + void start(); + void reset(); + UINT8 read(UINT8 c10); + void write(UINT8 data, UINT8 c10); + UINT32 get_rgb(UINT8 index); + +private: + running_machine &machine() const + { + assert(m_machine != NULL); + return *m_machine; + } + + UINT8 m_color_counter; + UINT8 m_red; + UINT8 m_green; + + UINT8 m_address_register; + UINT32 m_color_palette_RAM[256]; + UINT32 m_overlay_color[4]; + UINT8 m_read_mask_register; + UINT8 m_blink_mask_register; + UINT8 m_command_register; + UINT8 m_control_test_register; + + running_machine *m_machine; +}; + +extern const device_type APOLLO_GRAPHICS; + +#define MCFG_APOLLO_GRAPHICS_ADD( _tag) \ + MCFG_FRAGMENT_ADD(apollo_graphics) \ + MCFG_DEVICE_ADD(_tag, APOLLO_GRAPHICS, 0) + +MACHINE_CONFIG_EXTERN( apollo_graphics ); + +class apollo_graphics_19i : public apollo_graphics_15i +{ +public: + apollo_graphics_19i(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state +}; + +extern const device_type APOLLO_MONO19I; + +#define MCFG_APOLLO_MONO19I_ADD(_tag) \ + MCFG_FRAGMENT_ADD(apollo_mono19i) \ + MCFG_DEVICE_ADD(_tag, APOLLO_MONO19I, 0) + +MACHINE_CONFIG_EXTERN( apollo_mono19i ); + +#endif /* APOLLO_H_ */ diff --git a/src/mame/includes/apple1.h b/src/mame/includes/apple1.h new file mode 100644 index 00000000000..220200ade56 --- /dev/null +++ b/src/mame/includes/apple1.h @@ -0,0 +1,92 @@ +// license:??? +// copyright-holders:Paul Daniels, Colin Howell, R. Belmont +/***************************************************************************** + * + * includes/apple1.h + * + ****************************************************************************/ + +#ifndef APPLE1_H_ +#define APPLE1_H_ + +#include "imagedev/snapquik.h" +#include "machine/ram.h" + +typedef short termchar_t; + +struct terminal_t +{ + tilemap_t *tm; + int gfx; + int blank_char; + int char_bits; + int num_cols; + int num_rows; + int (*getcursorcode)(int original_code); + int cur_offset; + int cur_hidden; + termchar_t mem[1]; +}; + + +class apple1_state : public driver_device +{ +public: + apple1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen") { } + + int m_vh_clrscrn_pressed; + int m_kbd_data; + UINT32 m_kbd_last_scan[4]; + int m_reset_flag; + terminal_t *m_current_terminal; + terminal_t *m_terminal; + int m_blink_on; + DECLARE_DRIVER_INIT(apple1); + TILE_GET_INFO_MEMBER(terminal_gettileinfo); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(apple1_kbd_poll); + TIMER_CALLBACK_MEMBER(apple1_kbd_strobe_end); + TIMER_CALLBACK_MEMBER(apple1_dsp_ready_start); + TIMER_CALLBACK_MEMBER(apple1_dsp_ready_end); + DECLARE_READ8_MEMBER(apple1_pia0_kbdin); + DECLARE_WRITE8_MEMBER(apple1_pia0_dspout); + DECLARE_WRITE_LINE_MEMBER(apple1_pia0_dsp_write_signal); + required_device m_maincpu; + void terminal_draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal); + void verify_coords(terminal_t *terminal, int x, int y); + void terminal_putchar(terminal_t *terminal, int x, int y, int ch); + int terminal_getchar(terminal_t *terminal, int x, int y); + void terminal_putblank(terminal_t *terminal, int x, int y); + void terminal_dirtycursor(terminal_t *terminal); + void terminal_setcursor(terminal_t *terminal, int x, int y); + void terminal_hidecursor(terminal_t *terminal); + void terminal_showcursor(terminal_t *terminal); + void terminal_getcursor(terminal_t *terminal, int *x, int *y); + void terminal_fill(terminal_t *terminal, int val); + void terminal_clear(terminal_t *terminal); + void apple1_vh_dsp_w (int data); + void apple1_vh_dsp_clr (); + void apple1_vh_cursor_blink (); + int apple1_verify_header (UINT8 *data); + terminal_t *terminal_create(int gfx, int blank_char, int char_bits,int (*getcursorcode)(int original_code),int num_cols, int num_rows); + attotime apple1_vh_dsp_time_to_ready(); + DECLARE_SNAPSHOT_LOAD_MEMBER( apple1 ); + required_device m_ram; + required_device m_gfxdecode; + required_device m_screen; +}; + + +/*----------- defined in drivers/apple1.c -----------*/ + +extern const gfx_layout apple1_charlayout; + + +#endif /* APPLE1_H_ */ diff --git a/src/mame/includes/apple2.h b/src/mame/includes/apple2.h new file mode 100644 index 00000000000..ec8b9963db5 --- /dev/null +++ b/src/mame/includes/apple2.h @@ -0,0 +1,382 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + includes/apple2.h + + Include file to handle emulation of the Apple II series. + +***************************************************************************/ + +#ifndef APPLE2_H_ +#define APPLE2_H_ + +#include "cpu/m6502/m6502.h" +#include "cpu/m6502/m65c02.h" +#include "bus/a2bus/a2bus.h" +#include "bus/a2bus/a2eauxslot.h" +#include "machine/applefdc.h" +#include "machine/ram.h" +#include "imagedev/cassette.h" +#include "machine/kb3600.h" +#include "sound/speaker.h" +#include "machine/ram.h" +#include "bus/rs232/rs232.h" +#include "machine/mos6551.h" + +#define AUXSLOT_TAG "auxbus" + +#define IIC_ACIA1_TAG "acia1" +#define IIC_ACIA2_TAG "acia2" +#define IICP_IWM_TAG "iwm" + +#define LASER128_UDC_TAG "l128udc" + +#define PRINTER_PORT_TAG "printer" +#define MODEM_PORT_TAG "modem" + +/*************************************************************************** + SOFTSWITCH VALUES +***************************************************************************/ + +#define VAR_80STORE 0x000001 +#define VAR_RAMRD 0x000002 +#define VAR_RAMWRT 0x000004 +#define VAR_INTCXROM 0x000008 +#define VAR_ALTZP 0x000010 +#define VAR_SLOTC3ROM 0x000020 +#define VAR_80COL 0x000040 +#define VAR_ALTCHARSET 0x000080 +#define VAR_TEXT 0x000100 +#define VAR_MIXED 0x000200 +#define VAR_PAGE2 0x000400 +#define VAR_HIRES 0x000800 +#define VAR_AN0 0x001000 +#define VAR_AN1 0x002000 +#define VAR_AN2 0x004000 +#define VAR_AN3 0x008000 +#define VAR_LCRAM 0x010000 +#define VAR_LCRAM2 0x020000 +#define VAR_LCWRITE 0x040000 +#define VAR_ROMSWITCH 0x080000 +#define VAR_TK2000RAM 0x100000 // ROM/RAM switch for TK2000 + +#define VAR_DHIRES VAR_AN3 + +/*************************************************************************** + OTHER +***************************************************************************/ + +/* ----------------------------------------------------------------------- + * New Apple II memory manager + * ----------------------------------------------------------------------- */ + +#define APPLE2_MEM_AUX 0x40000000 +#define APPLE2_MEM_SLOT 0x80000000 +#define APPLE2_MEM_ROM 0xC0000000 +#define APPLE2_MEM_FLOATING 0xFFFFFFFF +#define APPLE2_MEM_MASK 0x00FFFFFF + +enum machine_type_t +{ + APPLE_II, // Apple II/II+ + APPLE_IIE, // Apple IIe with aux slots + APPLE_IIGS, // Apple IIgs + APPLE_IIC, // Apple IIc + APPLE_IICPLUS, // Apple IIc+ + TK2000, // Microdigital TK2000 + TK3000, // Microdigital TK3000 + LASER128, // Laser 128/128EX/128EX2 + SPACE84, // "Space 84" with flipped text mode + LABA2P // lab equipment (?) II Plus with flipped text mode +}; + +enum bank_disposition_t +{ + A2MEM_IO = 0, /* this is always handlers; never banked memory */ + A2MEM_MONO = 1, /* this is a bank where read and write are always in unison */ + A2MEM_DUAL = 2 /* this is a bank where read and write can go different places */ +}; + +struct apple2_meminfo +{ + UINT32 read_mem; + read8_delegate *read_handler; + UINT32 write_mem; + write8_delegate *write_handler; +}; + +struct apple2_memmap_entry +{ + offs_t begin; + offs_t end; + void (*get_meminfo)(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo); + bank_disposition_t bank_disposition; +}; + +struct apple2_memmap_config +{ + int first_bank; + UINT8 *auxmem; + UINT32 auxmem_length; + const apple2_memmap_entry *memmap; +}; + +class apple2_state : public driver_device +{ +public: + apple2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_ay3600(*this, "ay3600"), + m_a2bus(*this, "a2bus"), + m_a2eauxslot(*this, AUXSLOT_TAG), + m_joy1x(*this, "joystick_1_x"), + m_joy1y(*this, "joystick_1_y"), + m_joy2x(*this, "joystick_2_x"), + m_joy2y(*this, "joystick_2_y"), + m_joybuttons(*this, "joystick_buttons"), + m_kbdrom(*this, "keyboard"), + m_kbspecial(*this, "keyb_special"), + m_kbrepeat(*this, "keyb_repeat"), + m_resetdip(*this, "reset_dip"), + m_sysconfig(*this, "a2_config"), + m_cassette(*this, "cassette"), + m_acia1(*this, IIC_ACIA1_TAG), + m_acia2(*this, IIC_ACIA2_TAG), + m_laserudc(*this, LASER128_UDC_TAG), + m_iicpiwm(*this, IICP_IWM_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_ay3600; + required_device m_a2bus; + optional_device m_a2eauxslot; + + optional_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons; + optional_memory_region m_kbdrom; + required_ioport m_kbspecial; + optional_ioport m_kbrepeat; + optional_ioport m_resetdip; + optional_ioport m_sysconfig; + optional_device m_cassette; + + optional_device m_acia1, m_acia2; + optional_device m_laserudc; + optional_device m_iicpiwm; + + UINT32 m_flags, m_flags_mask; + INT32 m_a2_cnxx_slot; + UINT32 m_a2_mask; + UINT32 m_a2_set; + int m_a2_speaker_state; + double m_joystick_x1_time; + double m_joystick_y1_time; + double m_joystick_x2_time; + double m_joystick_y2_time; + apple2_memmap_config m_mem_config; + apple2_meminfo *m_current_meminfo; + int m_fdc_diskreg; + const UINT8 *m_a2_videoram, *m_a2_videoaux, *m_textgfx_data; + UINT32 m_a2_videomask, m_textgfx_datalen; + UINT32 m_old_a2; + int m_fgcolor; + int m_bgcolor; + int m_flash; + int m_alt_charset_value; + UINT16 *m_hires_artifact_map; + UINT16 *m_dhires_artifact_map; + bool m_monochrome_dhr; + int m_inh_slot; + int m_reset_flag; + + UINT8 *m_rambase; + + UINT8 *m_rom, *m_slot_ram; + UINT32 m_rom_length, m_slot_length; + + machine_type_t m_machinetype; + + device_a2eauxslot_card_interface *m_auxslotdevice; + + UINT16 m_lastchar, m_strobe; + UINT8 m_transchar; + + READ8_MEMBER(apple2_c0xx_r); + WRITE8_MEMBER(apple2_c0xx_w); + READ8_MEMBER(apple2_c080_r); + WRITE8_MEMBER(apple2_c080_w); + + READ8_MEMBER ( apple2_c00x_r ); + READ8_MEMBER ( apple2_c01x_r ); + READ8_MEMBER ( apple2_c02x_r ); + READ8_MEMBER ( apple2_c03x_r ); + READ8_MEMBER ( apple2_c05x_r ); + READ8_MEMBER ( apple2_c06x_r ); + READ8_MEMBER ( apple2_c07x_r ); + WRITE8_MEMBER ( apple2_c00x_w ); + WRITE8_MEMBER ( apple2_c01x_w ); + WRITE8_MEMBER ( apple2_c02x_w ); + WRITE8_MEMBER ( apple2_c03x_w ); + WRITE8_MEMBER ( apple2_c05x_w ); + WRITE8_MEMBER ( apple2_c07x_w ); + + READ8_MEMBER ( apple2_mainram0000_r ); + READ8_MEMBER ( apple2_mainram0200_r ); + READ8_MEMBER ( apple2_mainram0400_r ); + READ8_MEMBER ( apple2_mainram0800_r ); + READ8_MEMBER ( apple2_mainram2000_r ); + READ8_MEMBER ( apple2_mainram4000_r ); + READ8_MEMBER ( apple2_mainramc000_r ); + READ8_MEMBER ( apple2_mainramd000_r ); + READ8_MEMBER ( apple2_mainrame000_r ); + READ8_MEMBER ( apple2_auxram0000_r ); + READ8_MEMBER ( apple2_auxram0200_r ); + READ8_MEMBER ( apple2_auxram0400_r ); + READ8_MEMBER ( apple2_auxram0800_r ); + READ8_MEMBER ( apple2_auxram2000_r ); + READ8_MEMBER ( apple2_auxram4000_r ); + READ8_MEMBER ( apple2_auxramc000_r ); + READ8_MEMBER ( apple2_auxramd000_r ); + READ8_MEMBER ( apple2_auxrame000_r ); + + WRITE8_MEMBER ( apple2_mainram0000_w ); + WRITE8_MEMBER ( apple2_mainram0200_w ); + WRITE8_MEMBER ( apple2_mainram0400_w ); + WRITE8_MEMBER ( apple2_mainram0800_w ); + WRITE8_MEMBER ( apple2_mainram2000_w ); + WRITE8_MEMBER ( apple2_mainram4000_w ); + WRITE8_MEMBER ( apple2_mainramc000_w ); + WRITE8_MEMBER ( apple2_mainramd000_w ); + WRITE8_MEMBER ( apple2_mainrame000_w ); + WRITE8_MEMBER ( apple2_auxram0000_w ); + WRITE8_MEMBER ( apple2_auxram0200_w ); + WRITE8_MEMBER ( apple2_auxram0400_w ); + WRITE8_MEMBER ( apple2_auxram0800_w ); + WRITE8_MEMBER ( apple2_auxram2000_w ); + WRITE8_MEMBER ( apple2_auxram4000_w ); + WRITE8_MEMBER ( apple2_auxramc000_w ); + WRITE8_MEMBER ( apple2_auxramd000_w ); + WRITE8_MEMBER ( apple2_auxrame000_w ); + + READ8_MEMBER ( apple2_c1xx_r ); + WRITE8_MEMBER ( apple2_c1xx_w ); + READ8_MEMBER ( apple2_c3xx_r ); + WRITE8_MEMBER ( apple2_c3xx_w ); + READ8_MEMBER ( apple2_c4xx_r ); + WRITE8_MEMBER ( apple2_c4xx_w ); + + READ8_MEMBER ( apple2_c800_r ); + WRITE8_MEMBER ( apple2_c800_w ); + READ8_MEMBER ( apple2_ce00_r ); + WRITE8_MEMBER ( apple2_ce00_w ); + + READ8_MEMBER ( apple2_inh_d000_r ); + WRITE8_MEMBER ( apple2_inh_d000_w ); + READ8_MEMBER ( apple2_inh_e000_r ); + WRITE8_MEMBER ( apple2_inh_e000_w ); + + READ8_MEMBER(read_floatingbus); + + READ8_MEMBER(apple2_cfff_r); + WRITE8_MEMBER(apple2_cfff_w); + + void apple2_refresh_delegates(); + int apple2_pressed_specialkey(UINT8 key); + + read8_delegate read_delegates_master[4]; + write8_delegate write_delegates_master[3]; + write8_delegate write_delegates_0000[2]; + write8_delegate write_delegates_0200[2]; + write8_delegate write_delegates_0400[2]; + write8_delegate write_delegates_0800[2]; + write8_delegate write_delegates_2000[2]; + write8_delegate write_delegates_4000[2]; + write8_delegate write_delegates_c000[2]; + write8_delegate write_delegates_d000[2]; + write8_delegate write_delegates_e000[2]; + read8_delegate read_delegates_0000[2]; + read8_delegate read_delegates_0200[2]; + read8_delegate read_delegates_0400[2]; + read8_delegate read_delegates_0800[2]; + read8_delegate read_delegates_2000[2]; + read8_delegate read_delegates_4000[2]; + read8_delegate read_delegates_c000[2]; + read8_delegate read_delegates_d000[2]; + read8_delegate read_delegates_e000[2]; + read8_delegate rd_c000; + write8_delegate wd_c000; + read8_delegate rd_c080; + write8_delegate wd_c080; + read8_delegate rd_cfff; + write8_delegate wd_cfff; + read8_delegate rd_c800; + write8_delegate wd_c800; + read8_delegate rd_ce00; + write8_delegate wd_ce00; + read8_delegate rd_inh_d000; + write8_delegate wd_inh_d000; + read8_delegate rd_inh_e000; + write8_delegate wd_inh_e000; + DECLARE_MACHINE_START(apple2orig); + DECLARE_MACHINE_START(apple2e); + DECLARE_MACHINE_START(apple2c); + DECLARE_MACHINE_START(apple2cp); + DECLARE_MACHINE_START(tk2000); + DECLARE_MACHINE_START(tk3000); + DECLARE_MACHINE_START(laser128); + DECLARE_MACHINE_START(space84); + DECLARE_MACHINE_START(laba2p); + DECLARE_VIDEO_START(apple2); + DECLARE_PALETTE_INIT(apple2); + DECLARE_VIDEO_START(apple2p); + DECLARE_VIDEO_START(apple2e); + DECLARE_VIDEO_START(apple2c); + UINT32 screen_update_apple2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); + DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); + DECLARE_READ_LINE_MEMBER(ay3600_shift_r); + DECLARE_READ_LINE_MEMBER(ay3600_control_r); + DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); + DECLARE_WRITE_LINE_MEMBER(ay3600_iie_data_ready_w); + void apple2_update_memory_postload(); + virtual void machine_reset(); + void apple2_setup_memory(const apple2_memmap_config *config); + void apple2_update_memory(); + inline UINT32 effective_a2(); + UINT32 compute_video_address(int col, int row); + void adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow); + inline void apple2_plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, + const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2); + void apple2_text_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); + void apple2_lores_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); + void apple2_hires_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); + void apple2_video_start(const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo); + void apple2_setvar(UINT32 val, UINT32 mask); + UINT8 apple2_getfloatingbusvalue(); + int apple2_fdc_has_35(); + int apple2_fdc_has_525(); + void apple2_iwm_setdiskreg(UINT8 data); + void apple2_init_common(); + void apple2eplus_init_common(void *apple2cp_ce00_ram); + INT8 apple2_slotram_r(address_space &space, int slotnum, int offset); + int a2_no_ctrl_reset(); + +private: + // Laser 128EX2 slot 5 Apple Memory Expansion emulation vars + UINT8 m_exp_bankhior; + int m_exp_addrmask; + UINT8 m_exp_regs[0x10]; + UINT8 *m_exp_ram; + int m_exp_wptr, m_exp_liveptr; +}; +/*----------- defined in drivers/apple2.c -----------*/ +INPUT_PORTS_EXTERN( apple2ep ); +/*----------- defined in machine/apple2.c -----------*/ +extern const applefdc_interface apple2_fdc_interface; + +#endif /* APPLE2_H_ */ diff --git a/src/mame/includes/apple2gs.h b/src/mame/includes/apple2gs.h new file mode 100644 index 00000000000..eddd8445cd5 --- /dev/null +++ b/src/mame/includes/apple2gs.h @@ -0,0 +1,267 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,R. Belmont +/***************************************************************************** + * + * includes/apple2gs.h + * + * Apple IIgs + * + ****************************************************************************/ + +#ifndef APPLE2GS_H_ +#define APPLE2GS_H_ + +#define RUN_ADB_MICRO (0) + +#include "includes/apple2.h" +#include "sound/es5503.h" +#include "machine/nvram.h" +#include "cpu/g65816/g65816.h" +#include "cpu/m6502/m5074x.h" + +#define ADBMICRO_TAG "adbmicro" + +// IIgs clocks as marked on the schematics +#define APPLE2GS_28M (XTAL_28_63636MHz) // IIGS master clock +#define APPLE2GS_14M (APPLE2GS_28M/2) +#define APPLE2GS_7M (APPLE2GS_28M/4) + +// screen dimensions +#define BORDER_LEFT (32) +#define BORDER_RIGHT (32) +#define BORDER_TOP (16) // (plus bottom) + +// these are numbered as seen from the MCU +enum glu_reg_names +{ + GLU_KEY_DATA = 0, // MCU W + GLU_COMMAND, // MCU R + GLU_MOUSEX, // MCU W + GLU_MOUSEY, // MCU W + GLU_KG_STATUS, // MCU R + GLU_ANY_KEY_DOWN, // MCU W + GLU_KEYMOD, // MCU W + GLU_DATA, // MCU W + + GLU_C000, // 816 R + GLU_C010, // 816 RW + GLU_SYSSTAT // 816 R/(limited) W +}; + +enum glu_kg_status +{ + KGS_ANY_KEY_DOWN = 0x01, + KGS_KEYSTROBE = 0x10, + KGS_DATA_FULL = 0x20, + KGS_COMMAND_FULL = 0x40, + KGS_MOUSEX_FULL = 0x80 +}; + +enum apple2gs_clock_mode +{ + CLOCKMODE_IDLE, + CLOCKMODE_TIME, + CLOCKMODE_INTERNALREGS, + CLOCKMODE_BRAM1, + CLOCKMODE_BRAM2 +}; + + +enum adbstate_t +{ + ADBSTATE_IDLE, + ADBSTATE_INCOMMAND, + ADBSTATE_INRESPONSE +}; + +#define IRQ_KBD_SRQ 0x01 +#define IRQ_ADB_DATA 0x02 +#define IRQ_ADB_MOUSE 0x04 +#define IRQ_VGC_SCANLINE 0x08 +#define IRQ_VGC_SECOND 0x10 +#define IRQ_INTEN_QSECOND 0x20 +#define IRQ_INTEN_VBL 0x40 +#define IRQ_DOC 0x80 +#define IRQ_SLOT 0x100 + +void apple2gs_add_irq(running_machine &machine, UINT16 irq_mask); +void apple2gs_remove_irq(running_machine &machine, UINT16 irq_mask); + +class apple2gs_state : public apple2_state +{ +public: + apple2gs_state(const machine_config &mconfig, device_type type, const char *tag) + : apple2_state(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_es5503(*this, "es5503"), + m_fdc(*this, "fdc"), + #if RUN_ADB_MICRO + m_adbmicro(*this, ADBMICRO_TAG), + #endif + m_adb_mousex(*this, "adb_mouse_x"), + m_adb_mousey(*this, "adb_mouse_y"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_es5503; + required_device m_fdc; + #if RUN_ADB_MICRO + optional_device m_adbmicro; + #endif + + required_ioport m_adb_mousex, m_adb_mousey; + required_device m_palette; + + UINT8 *m_slowmem; + UINT8 m_newvideo; + UINT16 m_bordercolor; + UINT8 m_vgcint; + UINT8 m_langsel; + UINT8 m_sltromsel; + UINT8 m_cyareg; + UINT8 m_inten; + UINT8 m_intflag; + UINT8 m_shadow; + UINT16 m_pending_irqs; + UINT8 m_mouse_x; + UINT8 m_mouse_y; + INT8 m_mouse_dx; + INT8 m_mouse_dy; + device_t *m_cur_slot6_image; + emu_timer *m_scanline_timer; + emu_timer *m_clock_timer; + emu_timer *m_qsecond_timer; + UINT8 m_clock_data; + UINT8 m_clock_control; + UINT8 m_clock_read; + UINT8 m_clock_reg1; + apple2gs_clock_mode m_clock_mode; + UINT32 m_clock_curtime; + seconds_t m_clock_curtime_interval; + UINT8 m_clock_bram[256]; + #if !RUN_ADB_MICRO + adbstate_t m_adb_state; + UINT8 m_adb_command; + UINT8 m_adb_mode; + UINT8 m_adb_kmstatus; + UINT8 m_adb_latent_result; + INT32 m_adb_command_length; + INT32 m_adb_command_pos; + UINT8 m_adb_command_bytes[8]; + UINT8 m_adb_response_bytes[8]; + UINT8 m_adb_response_length; + INT32 m_adb_response_pos; + UINT8 m_adb_memory[0x100]; + int m_adb_address_keyboard; + int m_adb_address_mouse; + #endif + UINT8 m_sndglu_ctrl; + int m_sndglu_addr; + int m_sndglu_dummy_read; + bitmap_ind16 *m_legacy_gfx; + bool m_is_rom3; + UINT8 m_echo_bank; + UINT64 m_last_adb_time; + int m_adb_dtime; + UINT32 m_a2_palette[16]; + UINT32 m_shr_palette[256]; + + READ8_MEMBER( apple2gs_c0xx_r ); + WRITE8_MEMBER( apple2gs_c0xx_w ); + WRITE8_MEMBER( apple2gs_main0400_w ); + WRITE8_MEMBER( apple2gs_aux0400_w ); + WRITE8_MEMBER( apple2gs_main2000_w ); + WRITE8_MEMBER( apple2gs_aux2000_w ); + WRITE8_MEMBER( apple2gs_main4000_w ); + WRITE8_MEMBER( apple2gs_aux4000_w ); + + UINT8 adb_read_datareg(); + UINT8 adb_read_kmstatus(); + + void apple2gs_refresh_delegates(); + + write8_delegate write_delegates_2gs0400[2]; + write8_delegate write_delegates_2gs2000[2]; + write8_delegate write_delegates_2gs4000[2]; + DECLARE_MACHINE_START(apple2gs); + DECLARE_MACHINE_RESET(apple2gs); + DECLARE_VIDEO_START(apple2gs); + DECLARE_PALETTE_INIT(apple2gs); + DECLARE_MACHINE_START(apple2gsr1); + DECLARE_MACHINE_START(apple2gscommon); + UINT32 screen_update_apple2gs(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(apple2gs_clock_tick); + TIMER_CALLBACK_MEMBER(apple2gs_qsecond_tick); + TIMER_CALLBACK_MEMBER(apple2gs_scanline_tick); + DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); + DECLARE_READ8_MEMBER(apple2gs_read_vector); + + // ADB MCU and ADB GLU stuff + #if RUN_ADB_MICRO + UINT8 m_glu_regs[8], m_glu_bus, m_glu_sysstat; + bool m_glu_mcu_read_kgs, m_glu_816_read_dstat, m_glu_mouse_read_stat, m_adb_line; + + UINT8 keyglu_mcu_read(UINT8 offset); + void keyglu_mcu_write(UINT8 offset, UINT8 data); + UINT8 keyglu_816_read(UINT8 offset); + void keyglu_816_write(UINT8 offset, UINT8 data); + + DECLARE_READ8_MEMBER(adbmicro_p0_in); + DECLARE_READ8_MEMBER(adbmicro_p1_in); + DECLARE_READ8_MEMBER(adbmicro_p2_in); + DECLARE_READ8_MEMBER(adbmicro_p3_in); + DECLARE_WRITE8_MEMBER(adbmicro_p0_out); + DECLARE_WRITE8_MEMBER(adbmicro_p1_out); + DECLARE_WRITE8_MEMBER(adbmicro_p2_out); + DECLARE_WRITE8_MEMBER(adbmicro_p3_out); + #endif + void process_clock(); + const char *apple2gs_irq_name(UINT16 irq_mask); + void apple2gs_add_irq(UINT16 irq_mask); + void apple2gs_remove_irq(UINT16 irq_mask); + UINT8 adb_read_memory(UINT32 address); + void adb_write_memory(UINT32 address, UINT8 data); + void adb_set_mode(UINT8 mode); + void adb_set_config(UINT8 b1, UINT8 b2, UINT8 b3); + void adb_post_response(const UINT8 *bytes, size_t length); + void adb_post_response_1(UINT8 b); + void adb_post_response_2(UINT8 b1, UINT8 b2); + void adb_do_command(); + void adb_write_datareg(UINT8 data); + void adb_write_kmstatus(UINT8 data); + UINT8 adb_read_mousedata(); + INT8 seven_bit_diff(UINT8 v1, UINT8 v2); + void adb_check_mouse(); + void apple2gs_set_scanint(UINT8 data); + int apple2gs_get_vpos(); + UINT8 *apple2gs_getslotmem(offs_t address); + UINT8 apple2gs_xxCxxx_r(address_space &space, offs_t address); + void apple2gs_xxCxxx_w(address_space &space, offs_t address, UINT8 data); + void apple2gs_setup_memory(); + + DECLARE_READ8_MEMBER( gssnd_r ); + DECLARE_WRITE8_MEMBER( gssnd_w ); + DECLARE_READ8_MEMBER( apple2gs_00Cxxx_r ); + DECLARE_READ8_MEMBER( apple2gs_01Cxxx_r ); + DECLARE_READ8_MEMBER( apple2gs_E0Cxxx_r ); + DECLARE_READ8_MEMBER( apple2gs_E1Cxxx_r ); + DECLARE_WRITE8_MEMBER( apple2gs_00Cxxx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_01Cxxx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_E0Cxxx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_E1Cxxx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_Exxxxx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_E004xx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_E02xxx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_E104xx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_E12xxx_w ); + DECLARE_WRITE8_MEMBER( apple2gs_slowmem_w ); + DECLARE_READ8_MEMBER(apple2gs_bank_echo_r); + DECLARE_WRITE_LINE_MEMBER( apple2gs_doc_irq); + DECLARE_READ8_MEMBER(apple2gs_adc_read); + +}; + +#endif /* APPLE2GS_H_ */ diff --git a/src/mame/includes/apple3.h b/src/mame/includes/apple3.h new file mode 100644 index 00000000000..1d389c0b435 --- /dev/null +++ b/src/mame/includes/apple3.h @@ -0,0 +1,173 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,R. Belmont +/***************************************************************************** + * + * includes/apple3.h + * + * Apple /// + * + ****************************************************************************/ + +#ifndef APPLE3_H_ +#define APPLE3_H_ + +#include "cpu/m6502/m6502.h" +#include "includes/apple2.h" +#include "machine/ram.h" +#include "bus/a2bus/a2bus.h" +#include "machine/mos6551.h" +#include "machine/6522via.h" +#include "machine/kb3600.h" +#include "machine/mm58167.h" +#include "sound/speaker.h" +#include "sound/dac.h" +#include "machine/wozfdc.h" +#include "imagedev/floppy.h" +#include "formats/flopimg.h" + +#define VAR_VM0 0x0001 +#define VAR_VM1 0x0002 +#define VAR_VM2 0x0004 +#define VAR_VM3 0x0008 +#define VAR_EXTA0 0x0010 +#define VAR_EXTA1 0x0020 +#define VAR_EXTPOWER 0x0040 +#define VAR_EXTSIDE 0x0080 + +#define SPEAKER_TAG "a3spkr" +#define DAC_TAG "a3dac" + +class apple3_state : public driver_device +{ +public: + apple3_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_via_0(*this, "via6522_0"), + m_via_1(*this, "via6522_1"), + m_acia(*this, "acia"), + m_fdc(*this, "fdc"), + m_ay3600(*this, "ay3600"), + m_a2bus(*this, "a2bus"), + m_rtc(*this, "rtc"), + m_speaker(*this, SPEAKER_TAG), + m_dac(*this, DAC_TAG), + m_kbspecial(*this, "keyb_special"), + m_palette(*this, "palette"), + m_joy1x(*this, "joy_1_x"), + m_joy1y(*this, "joy_1_y"), + m_joy2x(*this, "joy_2_x"), + m_joy2y(*this, "joy_2_y"), + m_joybuttons(*this, "joy_buttons"), + m_pdltimer(*this, "pdltimer"), + floppy0(*this, "0"), + floppy1(*this, "1"), + floppy2(*this, "2"), + floppy3(*this, "3") + { + } + + required_device m_maincpu; + required_device m_ram; + required_device m_via_0; + required_device m_via_1; + required_device m_acia; + required_device m_fdc; + required_device m_ay3600; + required_device m_a2bus; + required_device m_rtc; + required_device m_speaker; + required_device m_dac; + required_ioport m_kbspecial; + required_device m_palette; + required_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons; + required_device m_pdltimer; + required_device floppy0; + required_device floppy1; + required_device floppy2; + required_device floppy3; + + DECLARE_READ8_MEMBER(apple3_memory_r); + DECLARE_WRITE8_MEMBER(apple3_memory_w); + DECLARE_WRITE_LINE_MEMBER(apple3_sync_w); + DECLARE_READ8_MEMBER(apple3_c0xx_r); + DECLARE_WRITE8_MEMBER(apple3_c0xx_w); + DECLARE_READ8_MEMBER(apple3_00xx_r); + DECLARE_WRITE8_MEMBER(apple3_00xx_w); + DECLARE_DRIVER_INIT(apple3); + DECLARE_MACHINE_RESET(apple3); + DECLARE_VIDEO_START(apple3); + UINT32 screen_update_apple3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(apple3_interrupt); + DECLARE_WRITE_LINE_MEMBER(apple3_acia_irq_func); + DECLARE_WRITE8_MEMBER(apple3_via_0_out_a); + DECLARE_WRITE8_MEMBER(apple3_via_0_out_b); + DECLARE_WRITE8_MEMBER(apple3_via_1_out_a); + DECLARE_WRITE8_MEMBER(apple3_via_1_out_b); + DECLARE_WRITE_LINE_MEMBER(apple3_via_0_irq_func); + DECLARE_WRITE_LINE_MEMBER(apple3_via_1_irq_func); + void apple3_write_charmem(); + void apple3_video_text40(bitmap_ind16 &bitmap); + void apple3_video_text80(bitmap_ind16 &bitmap); + void apple3_video_graphics_hgr(bitmap_ind16 &bitmap); + UINT8 swap_bits(UINT8 b); + void apple3_video_graphics_chgr(bitmap_ind16 &bitmap); + void apple3_video_graphics_shgr(bitmap_ind16 &bitmap); + void apple3_video_graphics_chires(bitmap_ind16 &bitmap); + UINT8 *apple3_bankaddr(UINT16 bank, offs_t offset); + UINT8 *apple3_get_zpa_addr(offs_t offset); + void apple3_update_memory(); + void apple3_via_out(UINT8 *var, UINT8 data); + UINT8 *apple3_get_indexed_addr(offs_t offset); + TIMER_DEVICE_CALLBACK_MEMBER(apple3_c040_tick); + DECLARE_PALETTE_INIT(apple3); + void apple3_irq_update(); + DECLARE_READ_LINE_MEMBER(ay3600_shift_r); + DECLARE_READ_LINE_MEMBER(ay3600_control_r); + DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); + void apple3_postload(); + TIMER_DEVICE_CALLBACK_MEMBER(paddle_timer); + void pdl_handler(int offset); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); + + // these need to be public for now + UINT32 m_flags; + int m_enable_mask; + +private: + int m_acia_irq; + UINT8 m_via_0_a; + UINT8 m_via_0_b; + UINT8 m_via_1_a; + UINT8 m_via_1_b; + int m_via_0_irq; + int m_via_1_irq; + offs_t m_zpa; + UINT8 m_last_n; + UINT8 m_char_mem[0x800]; + UINT32 *m_hgr_map; + + bool m_sync; + bool m_rom_has_been_disabled; + int m_cnxx_slot; + UINT8 m_indir_bank; + + UINT8 *m_bank2, *m_bank3, *m_bank4, *m_bank5, *m_bank8, *m_bank9; + UINT8 *m_bank10, *m_bank11; + UINT8 *m_bank6, *m_bank7rd, *m_bank7wr; + int m_speaker_state; + int m_c040_time; + UINT16 m_lastchar, m_strobe; + UINT8 m_transchar; + + int m_analog_sel; + bool m_ramp_active; + int m_pdl_charge; + int m_va, m_vb, m_vc; + int m_smoothscr; +}; + +#endif /* APPLE3_H_ */ diff --git a/src/mame/includes/aquarius.h b/src/mame/includes/aquarius.h new file mode 100644 index 00000000000..1375aa6015c --- /dev/null +++ b/src/mame/includes/aquarius.h @@ -0,0 +1,89 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/***************************************************************************** + * + * includes/aquarius.h + * + ****************************************************************************/ + +#ifndef __AQUARIUS__ +#define __AQUARIUS__ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "video/tea1002.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "sound/ay8910.h" +#include "sound/speaker.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +class aquarius_state : public driver_device +{ +public: + aquarius_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_speaker(*this, "speaker"), + m_cart(*this, "cartslot"), + m_ram(*this, RAM_TAG), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_tea1002(*this, "encoder"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_cassette; + required_device m_speaker; + required_device m_cart; + required_device m_ram; + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_device m_gfxdecode; + required_device m_screen; + required_device m_tea1002; + required_device m_palette; + + UINT8 m_scrambler; + tilemap_t *m_tilemap; + + DECLARE_WRITE8_MEMBER(aquarius_videoram_w); + DECLARE_WRITE8_MEMBER(aquarius_colorram_w); + DECLARE_READ8_MEMBER(cassette_r); + DECLARE_WRITE8_MEMBER(cassette_w); + DECLARE_READ8_MEMBER(vsync_r); + DECLARE_WRITE8_MEMBER(mapper_w); + DECLARE_READ8_MEMBER(printer_r); + DECLARE_WRITE8_MEMBER(printer_w); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(scrambler_w); + DECLARE_READ8_MEMBER(cartridge_r); + DECLARE_DRIVER_INIT(aquarius); + TILE_GET_INFO_MEMBER(aquarius_gettileinfo); + virtual void video_start(); + DECLARE_PALETTE_INIT(aquarius); + UINT32 screen_update_aquarius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_INPUT_CHANGED_MEMBER(aquarius_reset); +}; +#endif /* AQUARIUS_H_ */ diff --git a/src/mame/includes/arcadia.h b/src/mame/includes/arcadia.h new file mode 100644 index 00000000000..f7bf608bb42 --- /dev/null +++ b/src/mame/includes/arcadia.h @@ -0,0 +1,128 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/arcadia.h + * + ****************************************************************************/ + +#ifndef ARCADIA_H_ +#define ARCADIA_H_ + +#include "emu.h" +#include "cpu/s2650/s2650.h" +#include "audio/arcadia.h" + +#include "bus/arcadia/slot.h" +#include "bus/arcadia/rom.h" + +// space vultures sprites above +// combat below and invisible +#define YPOS 0 +//#define YBOTTOM_SIZE 24 +// grand slam sprites left and right +// space vultures left +// space attack left +#define XPOS 32 + + +class arcadia_state : public driver_device +{ +public: + arcadia_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_custom(*this, "custom"), + m_panel(*this, "panel"), + m_controller1_col1(*this, "controller1_col1"), + m_controller1_col2(*this, "controller1_col2"), + m_controller1_col3(*this, "controller1_col3"), + m_controller1_extra(*this, "controller1_extra"), + m_controller2_col1(*this, "controller2_col1"), + m_controller2_col2(*this, "controller2_col2"), + m_controller2_col3(*this, "controller2_col3"), + m_controller2_extra(*this, "controller2_extra"), + m_joysticks(*this, "joysticks") , + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_screen(*this, "screen") { } + + DECLARE_READ8_MEMBER(vsync_r); + DECLARE_READ8_MEMBER(video_r); + DECLARE_WRITE8_MEMBER(video_w); + int m_line; + int m_charline; + int m_shift; + int m_ad_delay; + int m_ad_select; + int m_ypos; + int m_graphics; + int m_doublescan; + int m_lines26; + int m_multicolor; + struct { int x, y; } m_pos[4]; + UINT8 m_bg[262][16+2*XPOS/8]; + UINT8 m_rectangle[0x40][8]; + UINT8 m_chars[0x40][8]; + int m_breaker; + union + { + UINT8 data[0x400]; + struct + { + // 0x1800 + UINT8 chars1[13][16]; + UINT8 ram1[2][16]; + struct { UINT8 y,x; } pos[4]; + UINT8 ram2[4]; + UINT8 vpos; + UINT8 sound1, sound2; + UINT8 char_line; + // 0x1900 + UINT8 pad1a, pad1b, pad1c, pad1d; + UINT8 pad2a, pad2b, pad2c, pad2d; + UINT8 keys, unmapped3[0x80-9]; + UINT8 chars[8][8]; + UINT8 unknown[0x38]; + UINT8 pal[4]; + UINT8 collision_bg, + collision_sprite; + UINT8 ad[2]; + // 0x1a00 + UINT8 chars2[13][16]; + UINT8 ram3[3][16]; + } d; + } m_reg; + bitmap_ind16 *m_bitmap; + DECLARE_DRIVER_INIT(arcadia); + virtual void machine_start(); + virtual void video_start(); + DECLARE_PALETTE_INIT(arcadia); + UINT32 screen_update_arcadia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(video_line); + +protected: + required_device m_custom; + required_ioport m_panel; + required_ioport m_controller1_col1; + required_ioport m_controller1_col2; + required_ioport m_controller1_col3; + required_ioport m_controller1_extra; + required_ioport m_controller2_col1; + required_ioport m_controller2_col2; + required_ioport m_controller2_col3; + required_ioport m_controller2_extra; + required_ioport m_joysticks; + + void draw_char(UINT8 *ch, int charcode, int y, int x); + void vh_draw_line(int y, UINT8 chars1[16]); + int sprite_collision(int n1, int n2); + void draw_sprites(); + required_device m_maincpu; + required_device m_cart; + required_device m_gfxdecode; + required_device m_palette; + required_device m_screen; +}; +#endif /* ARCADIA_H_ */ diff --git a/src/mame/includes/at.h b/src/mame/includes/at.h new file mode 100644 index 00000000000..63391195f90 --- /dev/null +++ b/src/mame/includes/at.h @@ -0,0 +1,200 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Miodrag Milanovic +/***************************************************************************** + * + * includes/at.h + * + * IBM AT Compatibles + * + ****************************************************************************/ + +#ifndef AT_H_ +#define AT_H_ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "cpu/i86/i286.h" +#include "cpu/i386/i386.h" + +#include "machine/ins8250.h" +#include "machine/mc146818.h" +#include "machine/ds128x.h" +#include "machine/pic8259.h" +#include "bus/lpci/i82371ab.h" +#include "bus/lpci/i82371sb.h" +#include "bus/lpci/i82439tx.h" +#include "bus/lpci/vt82c505.h" +#include "machine/vt82c496.h" +#include "machine/cs8221.h" +#include "machine/pit8253.h" +#include "machine/wd7600.h" + +#include "machine/idectrl.h" +#include "machine/at_keybc.h" + +#include "imagedev/harddriv.h" +#include "machine/am9517a.h" +#include "bus/lpci/pci.h" + +#include "sound/dac.h" +#include "sound/speaker.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" + +#include "machine/pc_lpt.h" +#include "bus/pc_kbd/pc_kbdc.h" + + +class at586_state : public driver_device +{ +public: + at586_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") { } + required_device m_maincpu; + + DECLARE_DRIVER_INIT(at586); +}; + +class at_state : public driver_device +{ +public: + at_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pic8259_master(*this, "pic8259_master"), + m_pic8259_slave(*this, "pic8259_slave"), + m_dma8237_1(*this, "dma8237_1"), + m_dma8237_2(*this, "dma8237_2"), + m_pit8254(*this, "pit8254"), + m_cs8221(*this, "cs8221"), + m_ide(*this, "ide"), + m_keybc(*this, "keybc"), + m_isabus(*this, "isabus"), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG), + m_mc146818(*this, "rtc"), + m_pc_kbdc(*this, "pc_kbdc") + { } + + required_device m_maincpu; + optional_device m_pic8259_master; + optional_device m_pic8259_slave; + optional_device m_dma8237_1; + optional_device m_dma8237_2; + optional_device m_pit8254; + optional_device m_cs8221; + optional_device m_ide; + optional_device m_keybc; + optional_device m_isabus; + required_device m_speaker; + optional_device m_ram; + optional_device m_mc146818; + optional_device m_pc_kbdc; + DECLARE_READ8_MEMBER(at_page8_r); + DECLARE_WRITE8_MEMBER(at_page8_w); + DECLARE_READ8_MEMBER(at_portb_r); + DECLARE_WRITE8_MEMBER(at_portb_w); + DECLARE_READ8_MEMBER(ps2_portb_r); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE_LINE_MEMBER(at_pit8254_out0_changed); + DECLARE_WRITE_LINE_MEMBER(at_pit8254_out2_changed); + DECLARE_WRITE_LINE_MEMBER(pc_dma_hrq_changed); + DECLARE_READ8_MEMBER(pc_dma8237_0_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_1_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_2_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_3_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_5_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_6_dack_r); + DECLARE_READ8_MEMBER(pc_dma8237_7_dack_r); + DECLARE_WRITE8_MEMBER(pc_dma8237_0_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_1_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_2_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_3_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_5_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_6_dack_w); + DECLARE_WRITE8_MEMBER(pc_dma8237_7_dack_w); + DECLARE_WRITE_LINE_MEMBER(at_dma8237_out_eop); + DECLARE_WRITE_LINE_MEMBER(pc_dack0_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack1_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack2_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack3_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack4_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack5_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack6_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack7_w); + DECLARE_READ32_MEMBER(ide_r); + DECLARE_WRITE32_MEMBER(ide_w); + DECLARE_READ8_MEMBER(at_dma8237_2_r); + DECLARE_WRITE8_MEMBER(at_dma8237_2_w); + DECLARE_READ8_MEMBER(at_keybc_r); + DECLARE_WRITE8_MEMBER(at_keybc_w); + DECLARE_READ16_MEMBER(neat_chipset_r); + DECLARE_WRITE16_MEMBER(neat_chipset_w); + DECLARE_WRITE_LINE_MEMBER(at_mc146818_irq); + DECLARE_WRITE8_MEMBER(write_rtc); + UINT8 m_at_spkrdata; + UINT8 m_pit_out2; + int m_dma_channel; + bool m_cur_eop; + UINT8 m_dma_offset[2][4]; + UINT8 m_at_pages[0x10]; + UINT16 m_dma_high_byte; + UINT8 m_at_speaker; + UINT16 m_ps1_reg[2]; + DECLARE_READ16_MEMBER(ps1_unk_r); + DECLARE_WRITE16_MEMBER(ps1_unk_w); + DECLARE_READ8_MEMBER(ps1_kbdc_r); + + void at_speaker_set_spkrdata(UINT8 data); + DECLARE_WRITE_LINE_MEMBER(at_shutdown); + + UINT8 m_channel_check; + UINT8 m_nmi_enabled; + DECLARE_READ8_MEMBER(pc_dma_read_byte); + DECLARE_WRITE8_MEMBER(pc_dma_write_byte); + DECLARE_READ8_MEMBER(pc_dma_read_word); + DECLARE_WRITE8_MEMBER(pc_dma_write_word); + + DECLARE_DRIVER_INIT(atcga); + DECLARE_DRIVER_INIT(atvga); + DECLARE_DRIVER_INIT(megapcpla); + DECLARE_DRIVER_INIT(atpci); + DECLARE_MACHINE_START(at); + DECLARE_MACHINE_RESET(at); + void pc_set_dma_channel(int channel, int state); + void init_at_common(int xmsbase); + UINT32 at_286_a20(bool state); +}; + +class megapc_state : public driver_device +{ +public: + megapc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_wd7600(*this, "wd7600"), + m_isabus(*this, "isabus"), + m_speaker(*this, "speaker") + { } + +public: + required_device m_maincpu; + required_device m_wd7600; + required_device m_isabus; + required_device m_speaker; + + DECLARE_DRIVER_INIT(megapc); + DECLARE_DRIVER_INIT(megapcpl); + + DECLARE_READ16_MEMBER( wd7600_ior ); + DECLARE_WRITE16_MEMBER( wd7600_iow ); + DECLARE_WRITE_LINE_MEMBER( wd7600_hold ); + DECLARE_WRITE8_MEMBER( wd7600_tc ) { m_isabus->eop_w(offset, data); } + DECLARE_WRITE_LINE_MEMBER( wd7600_spkr ) { m_speaker->level_w(state); } +}; + + +#endif /* AT_H_ */ diff --git a/src/mame/includes/atarist.h b/src/mame/includes/atarist.h new file mode 100644 index 00000000000..2e153b4a59a --- /dev/null +++ b/src/mame/includes/atarist.h @@ -0,0 +1,469 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Olivier Galibert +#pragma once + +#ifndef __ATARI_ST__ +#define __ATARI_ST__ + +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "cpu/m6800/m6800.h" +#include "machine/6850acia.h" +#include "machine/8530scc.h" +#include "bus/centronics/ctronics.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "machine/mc68901.h" +#include "machine/ram.h" +#include "machine/rescap.h" +#include "machine/rp5c15.h" +#include "machine/wd_fdc.h" +#include "sound/ay8910.h" +#include "sound/lmc1992.h" + +#define M68000_TAG "m68000" +#define HD6301V1_TAG "hd6301" +#define YM2149_TAG "ym2149" +#define MC6850_0_TAG "mc6850_0" +#define MC6850_1_TAG "mc6850_1" +#define Z8530_TAG "z8530" +#define COP888_TAG "u703" +#define RP5C15_TAG "rp5c15" +#define YM3439_TAG "ym3439" +#define MC68901_TAG "mc68901" +#define LMC1992_TAG "lmc1992" +#define WD1772_TAG "wd1772" +#define SCREEN_TAG "screen" +#define CENTRONICS_TAG "centronics" +#define RS232_TAG "rs232" + +// Atari ST + +#define Y1 XTAL_2_4576MHz + +// STBook + +#define U517 XTAL_16MHz +#define Y200 XTAL_2_4576MHz +#define Y700 XTAL_10MHz + +#define DMA_STATUS_DRQ 0x04 +#define DMA_STATUS_SECTOR_COUNT 0x02 +#define DMA_STATUS_ERROR 0x01 + +#define DMA_MODE_READ_WRITE 0x100 +#define DMA_MODE_FDC_HDC_ACK 0x080 +#define DMA_MODE_ENABLED 0x040 +#define DMA_MODE_SECTOR_COUNT 0x010 +#define DMA_MODE_FDC_HDC_CS 0x008 +#define DMA_MODE_A1 0x004 +#define DMA_MODE_A0 0x002 +#define DMA_MODE_ADDRESS_MASK 0x006 + +#define DMA_SECTOR_SIZE 512 + +enum +{ + IKBD_MOUSE_PHASE_STATIC = 0, + IKBD_MOUSE_PHASE_POSITIVE, + IKBD_MOUSE_PHASE_NEGATIVE +}; + +class st_state : public driver_device +{ +public: + enum + { + TIMER_MOUSE_TICK, + TIMER_SHIFTER_TICK, + TIMER_GLUE_TICK, + TIMER_BLITTER_TICK + }; + + st_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M68000_TAG), + m_fdc(*this, WD1772_TAG), + m_mfp(*this, MC68901_TAG), + m_acia0(*this, MC6850_0_TAG), + m_acia1(*this, MC6850_1_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_cart(*this, "cartslot"), + m_ram(*this, RAM_TAG), + m_rs232(*this, RS232_TAG), + m_p31(*this, "P31"), + m_p32(*this, "P32"), + m_p33(*this, "P33"), + m_p34(*this, "P34"), + m_p35(*this, "P35"), + m_p36(*this, "P36"), + m_p37(*this, "P37"), + m_p40(*this, "P40"), + m_p41(*this, "P41"), + m_p42(*this, "P42"), + m_p43(*this, "P43"), + m_p44(*this, "P44"), + m_p45(*this, "P45"), + m_p46(*this, "P46"), + m_p47(*this, "P47"), + m_joy0(*this, "IKBD_JOY0"), + m_joy1(*this, "IKBD_JOY1"), + m_mousex(*this, "IKBD_MOUSEX"), + m_mousey(*this, "IKBD_MOUSEY"), + m_config(*this, "config"), + m_acia_ikbd_irq(1), + m_acia_midi_irq(1), + m_ikbd_mouse_x(0), + m_ikbd_mouse_y(0), + m_ikbd_mouse_px(IKBD_MOUSE_PHASE_STATIC), + m_ikbd_mouse_py(IKBD_MOUSE_PHASE_STATIC), + m_ikbd_mouse_pc(0), + m_ikbd_joy(1), + m_monochrome(1), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_fdc; + required_device m_mfp; + required_device m_acia0; + required_device m_acia1; + required_device m_centronics; + required_device m_cart; + required_device m_ram; + required_device m_rs232; + required_ioport m_p31; + required_ioport m_p32; + required_ioport m_p33; + required_ioport m_p34; + required_ioport m_p35; + required_ioport m_p36; + required_ioport m_p37; + required_ioport m_p40; + required_ioport m_p41; + required_ioport m_p42; + required_ioport m_p43; + required_ioport m_p44; + required_ioport m_p45; + required_ioport m_p46; + required_ioport m_p47; + optional_ioport m_joy0; + optional_ioport m_joy1; + optional_ioport m_mousex; + optional_ioport m_mousey; + optional_ioport m_config; + + void machine_start(); + + void video_start(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + // video + DECLARE_READ8_MEMBER( shifter_base_r ); + DECLARE_READ8_MEMBER( shifter_counter_r ); + DECLARE_READ8_MEMBER( shifter_sync_r ); + DECLARE_READ16_MEMBER( shifter_palette_r ); + DECLARE_READ8_MEMBER( shifter_mode_r ); + + DECLARE_WRITE8_MEMBER( shifter_base_w ); + DECLARE_WRITE8_MEMBER( shifter_sync_w ); + DECLARE_WRITE16_MEMBER( shifter_palette_w ); + DECLARE_WRITE8_MEMBER( shifter_mode_w ); + + DECLARE_READ16_MEMBER( blitter_halftone_r ); + DECLARE_READ16_MEMBER( blitter_src_inc_x_r ); + DECLARE_READ16_MEMBER( blitter_src_inc_y_r ); + DECLARE_READ16_MEMBER( blitter_src_r ); + DECLARE_READ16_MEMBER( blitter_end_mask_r ); + DECLARE_READ16_MEMBER( blitter_dst_inc_x_r ); + DECLARE_READ16_MEMBER( blitter_dst_inc_y_r ); + DECLARE_READ16_MEMBER( blitter_dst_r ); + DECLARE_READ16_MEMBER( blitter_count_x_r ); + DECLARE_READ16_MEMBER( blitter_count_y_r ); + DECLARE_READ16_MEMBER( blitter_op_r ); + DECLARE_READ16_MEMBER( blitter_ctrl_r ); + + DECLARE_WRITE16_MEMBER( blitter_halftone_w ); + DECLARE_WRITE16_MEMBER( blitter_src_inc_x_w ); + DECLARE_WRITE16_MEMBER( blitter_src_inc_y_w ); + DECLARE_WRITE16_MEMBER( blitter_src_w ); + DECLARE_WRITE16_MEMBER( blitter_end_mask_w ); + DECLARE_WRITE16_MEMBER( blitter_dst_inc_x_w ); + DECLARE_WRITE16_MEMBER( blitter_dst_inc_y_w ); + DECLARE_WRITE16_MEMBER( blitter_dst_w ); + DECLARE_WRITE16_MEMBER( blitter_count_x_w ); + DECLARE_WRITE16_MEMBER( blitter_count_y_w ); + DECLARE_WRITE16_MEMBER( blitter_op_w ); + DECLARE_WRITE16_MEMBER( blitter_ctrl_w ); + + void mouse_tick(); + inline pen_t shift_mode_0(); + inline pen_t shift_mode_1(); + inline pen_t shift_mode_2(); + void shifter_tick(); + inline void shifter_load(); + void glue_tick(); + void set_screen_parameters(); + void blitter_source(); + UINT16 blitter_hop(); + void blitter_op(UINT16 s, UINT32 dstaddr, UINT16 mask); + void blitter_tick(); + + // driver + DECLARE_READ16_MEMBER( fdc_data_r ); + DECLARE_WRITE16_MEMBER( fdc_data_w ); + DECLARE_READ16_MEMBER( dma_status_r ); + DECLARE_WRITE16_MEMBER( dma_mode_w ); + DECLARE_READ8_MEMBER( dma_counter_r ); + DECLARE_WRITE8_MEMBER( dma_base_w ); + DECLARE_READ8_MEMBER( mmu_r ); + DECLARE_WRITE8_MEMBER( mmu_w ); + DECLARE_READ16_MEMBER( berr_r ); + DECLARE_WRITE16_MEMBER( berr_w ); + DECLARE_READ8_MEMBER( ikbd_port1_r ); + DECLARE_READ8_MEMBER( ikbd_port2_r ); + DECLARE_WRITE8_MEMBER( ikbd_port2_w ); + DECLARE_WRITE8_MEMBER( ikbd_port3_w ); + DECLARE_READ8_MEMBER( ikbd_port4_r ); + DECLARE_WRITE8_MEMBER( ikbd_port4_w ); + + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + + DECLARE_WRITE8_MEMBER( psg_pa_w ); + + DECLARE_WRITE_LINE_MEMBER( ikbd_tx_w ); + DECLARE_WRITE_LINE_MEMBER( acia_ikbd_irq_w ); + DECLARE_WRITE_LINE_MEMBER( acia_midi_irq_w ); + + DECLARE_READ8_MEMBER( mfp_gpio_r ); + DECLARE_WRITE_LINE_MEMBER( mfp_tdo_w ); + + DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); + + void toggle_dma_fifo(); + void flush_dma_fifo(); + void fill_dma_fifo(); + void fdc_dma_transfer(); + + void configure_memory(); + void state_save(); + + /* memory state */ + UINT8 m_mmu; + + /* keyboard state */ + int m_acia_ikbd_irq; + int m_acia_midi_irq; + UINT16 m_ikbd_keylatch; + UINT8 m_ikbd_mouse; + UINT8 m_ikbd_mouse_x; + UINT8 m_ikbd_mouse_y; + UINT8 m_ikbd_mouse_px; + UINT8 m_ikbd_mouse_py; + UINT8 m_ikbd_mouse_pc; + int m_ikbd_tx; + int m_ikbd_joy; + int m_midi_tx; + + /* floppy state */ + UINT32 m_dma_base; + UINT16 m_dma_error; + UINT16 m_fdc_mode; + UINT8 m_fdc_sectors; + UINT16 m_fdc_fifo[2][8]; + int m_fdc_fifo_sel; + int m_fdc_fifo_index; + int m_fdc_fifo_msb; + int m_fdc_fifo_empty[2]; + int m_fdc_dmabytes; + + /* shifter state */ + UINT32 m_shifter_base; + UINT32 m_shifter_ofs; + UINT8 m_shifter_sync; + UINT8 m_shifter_mode; + UINT16 m_shifter_palette[16]; + UINT16 m_shifter_rr[4]; + UINT16 m_shifter_ir[4]; + int m_shifter_bitplane; + int m_shifter_shift; + int m_shifter_h; + int m_shifter_v; + int m_shifter_de; + int m_shifter_x_start; + int m_shifter_x_end; + int m_shifter_y_start; + int m_shifter_y_end; + int m_shifter_hblank_start; + int m_shifter_vblank_start; + + /* blitter state */ + UINT16 m_blitter_halftone[16]; + INT16 m_blitter_src_inc_x; + INT16 m_blitter_src_inc_y; + INT16 m_blitter_dst_inc_x; + INT16 m_blitter_dst_inc_y; + UINT32 m_blitter_src; + UINT32 m_blitter_dst; + UINT16 m_blitter_endmask1; + UINT16 m_blitter_endmask2; + UINT16 m_blitter_endmask3; + UINT16 m_blitter_xcount; + UINT16 m_blitter_ycount; + UINT16 m_blitter_xcountl; + UINT8 m_blitter_hop; + UINT8 m_blitter_op; + UINT8 m_blitter_ctrl; + UINT8 m_blitter_skew; + UINT32 m_blitter_srcbuf; + + /* timers */ + emu_timer *m_mouse_timer; + emu_timer *m_glue_timer; + emu_timer *m_shifter_timer; + + bitmap_rgb32 m_bitmap; + + floppy_image_device *floppy_devices[2]; + + DECLARE_FLOPPY_FORMATS(floppy_formats); + IRQ_CALLBACK_MEMBER(atarist_int_ack); + + int m_monochrome; + required_device m_palette; + DECLARE_WRITE_LINE_MEMBER( write_monochrome ); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +class megast_state : public st_state +{ +public: + megast_state(const machine_config &mconfig, device_type type, const char *tag) + : st_state(mconfig, type, tag) + { } + + DECLARE_READ16_MEMBER( fpu_r ); + DECLARE_WRITE16_MEMBER( fpu_w ); +}; + +class ste_state : public st_state +{ +public: + enum + { + TIMER_DMASOUND_TICK, + TIMER_MICROWIRE_TICK + }; + + ste_state(const machine_config &mconfig, device_type type, const char *tag) + : st_state(mconfig, type, tag), + m_lmc1992(*this, LMC1992_TAG) + { } + + optional_device m_lmc1992; + + void machine_start(); + + void video_start(); + + DECLARE_READ8_MEMBER( shifter_base_low_r ); + DECLARE_WRITE8_MEMBER( shifter_base_low_w ); + DECLARE_READ8_MEMBER( shifter_counter_r ); + DECLARE_WRITE8_MEMBER( shifter_counter_w ); + DECLARE_WRITE16_MEMBER( shifter_palette_w ); + DECLARE_READ8_MEMBER( shifter_lineofs_r ); + DECLARE_WRITE8_MEMBER( shifter_lineofs_w ); + DECLARE_READ8_MEMBER( shifter_pixelofs_r ); + DECLARE_WRITE8_MEMBER( shifter_pixelofs_w ); + + DECLARE_READ8_MEMBER( sound_dma_control_r ); + DECLARE_READ8_MEMBER( sound_dma_base_r ); + DECLARE_READ8_MEMBER( sound_dma_counter_r ); + DECLARE_READ8_MEMBER( sound_dma_end_r ); + DECLARE_READ8_MEMBER( sound_mode_r ); + DECLARE_WRITE8_MEMBER( sound_dma_control_w ); + DECLARE_WRITE8_MEMBER( sound_dma_base_w ); + DECLARE_WRITE8_MEMBER( sound_dma_end_w ); + DECLARE_WRITE8_MEMBER( sound_mode_w ); + DECLARE_READ16_MEMBER( microwire_data_r ); + DECLARE_WRITE16_MEMBER( microwire_data_w ); + DECLARE_READ16_MEMBER( microwire_mask_r ); + DECLARE_WRITE16_MEMBER( microwire_mask_w ); + + DECLARE_READ8_MEMBER( mfp_gpio_r ); + DECLARE_WRITE_LINE_MEMBER( write_monochrome ); + + void dmasound_set_state(int level); + void dmasound_tick(); + void microwire_shift(); + void microwire_tick(); + void state_save(); + + // shifter state + UINT8 m_shifter_lineofs; + UINT8 m_shifter_pixelofs; + + /* microwire state */ + UINT16 m_mw_data; + UINT16 m_mw_mask; + int m_mw_shift; + + /* DMA sound state */ + UINT32 m_dmasnd_base; + UINT32 m_dmasnd_end; + UINT32 m_dmasnd_cntr; + UINT32 m_dmasnd_baselatch; + UINT32 m_dmasnd_endlatch; + UINT8 m_dmasnd_ctrl; + UINT8 m_dmasnd_mode; + UINT8 m_dmasnd_fifo[8]; + UINT8 m_dmasnd_samples; + int m_dmasnd_active; + + // timers + emu_timer *m_microwire_timer; + emu_timer *m_dmasound_timer; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +class megaste_state : public ste_state +{ +public: + megaste_state(const machine_config &mconfig, device_type type, const char *tag) + : ste_state(mconfig, type, tag) + { } + + void machine_start(); + + DECLARE_READ16_MEMBER( cache_r ); + DECLARE_WRITE16_MEMBER( cache_w ); + + UINT16 m_cache; +}; + +class stbook_state : public ste_state +{ +public: + stbook_state(const machine_config &mconfig, device_type type, const char *tag) + : ste_state(mconfig, type, tag), + m_sw400(*this, "SW400") + { } + + required_ioport m_sw400; + + void machine_start(); + void video_start(); + + DECLARE_READ16_MEMBER( config_r ); + DECLARE_WRITE16_MEMBER( lcd_control_w ); + + DECLARE_WRITE8_MEMBER( psg_pa_w ); + DECLARE_READ8_MEMBER( mfp_gpio_r ); +}; + +#endif diff --git a/src/mame/includes/atom.h b/src/mame/includes/atom.h new file mode 100644 index 00000000000..bd7b2427897 --- /dev/null +++ b/src/mame/includes/atom.h @@ -0,0 +1,169 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +#pragma once + +#ifndef __ATOM__ +#define __ATOM__ + + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "imagedev/cassette.h" +#include "imagedev/flopdrv.h" +#include "machine/ram.h" +#include "imagedev/snapquik.h" +#include "formats/atom_tap.h" +#include "formats/atom_dsk.h" +#include "formats/uef_cas.h" +#include "bus/centronics/ctronics.h" +#include "machine/6522via.h" +#include "machine/i8255.h" +#include "machine/i8271.h" +#include "sound/speaker.h" +#include "video/mc6847.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define SY6502_TAG "ic22" +#define INS8255_TAG "ic25" +#define MC6847_TAG "ic31" +#define R6522_TAG "ic1" +#define I8271_TAG "ic13" +#define MC6854_TAG "econet_ic1" +#define SCREEN_TAG "screen" +#define CENTRONICS_TAG "centronics" +#define BASERAM_TAG "baseram" + + +#define X1 XTAL_3_579545MHz // MC6847 Clock +#define X2 XTAL_4MHz // CPU Clock - a divider reduces it to 1MHz + +class atom_state : public driver_device +{ +public: + atom_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, SY6502_TAG), + m_vdg(*this, MC6847_TAG), + m_cassette(*this, "cassette"), + m_fdc(*this, I8271_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_speaker(*this, "speaker"), + m_cart(*this, "cartslot"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_y10(*this, "Y10"), + m_rpt(*this, "RPT"), + m_video_ram(*this, "video_ram") + { } + + required_device m_maincpu; + required_device m_vdg; + required_device m_cassette; + optional_device m_fdc; + required_device m_centronics; + required_device m_speaker; + optional_device m_cart; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_y10; + required_ioport m_rpt; + + virtual void machine_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void bankswitch(); + + DECLARE_WRITE8_MEMBER( ppi_pa_w ); + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_READ8_MEMBER( ppi_pc_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + DECLARE_READ8_MEMBER( vdg_videoram_r ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + DECLARE_WRITE_LINE_MEMBER( atom_8271_interrupt_callback ); + DECLARE_WRITE_LINE_MEMBER( motor_w ); + + /* video state */ + required_shared_ptr m_video_ram; + + /* keyboard state */ + int m_keylatch; + + /* cassette state */ + int m_hz2400; + int m_pc0; + int m_pc1; + + /* devices */ + int m_previous_i8271_int_state; + DECLARE_FLOPPY_FORMATS(floppy_formats); + TIMER_DEVICE_CALLBACK_MEMBER(cassette_output_tick); + + int load_cart(device_image_interface &image, generic_slot_device *slot); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load) { return load_cart(image, m_cart); } + DECLARE_QUICKLOAD_LOAD_MEMBER(atom_atm); +}; + +class atomeb_state : public atom_state +{ +public: + atomeb_state(const machine_config &mconfig, device_type type, const char *tag) + : atom_state(mconfig, type, tag), + m_e0(*this, "rom_e0"), + m_e1(*this, "rom_e1") + { + } + + virtual void machine_start(); + + DECLARE_READ8_MEMBER(eprom_r); + DECLARE_WRITE8_MEMBER(eprom_w); + DECLARE_READ8_MEMBER(ext_r); + DECLARE_READ8_MEMBER(dos_r); + + DECLARE_DRIVER_INIT(atomeb); + + /* eprom state */ + int m_eprom; + + generic_slot_device *m_ext[16]; + required_device m_e0; + required_device m_e1; + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a0_load) { return load_cart(image, m_ext[0x0]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a1_load) { return load_cart(image, m_ext[0x1]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a2_load) { return load_cart(image, m_ext[0x2]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a3_load) { return load_cart(image, m_ext[0x3]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a4_load) { return load_cart(image, m_ext[0x4]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a5_load) { return load_cart(image, m_ext[0x5]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a6_load) { return load_cart(image, m_ext[0x6]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a7_load) { return load_cart(image, m_ext[0x7]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a8_load) { return load_cart(image, m_ext[0x8]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a9_load) { return load_cart(image, m_ext[0x9]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(aa_load) { return load_cart(image, m_ext[0xa]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ab_load) { return load_cart(image, m_ext[0xb]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ac_load) { return load_cart(image, m_ext[0xc]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ad_load) { return load_cart(image, m_ext[0xd]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ae_load) { return load_cart(image, m_ext[0xe]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(af_load) { return load_cart(image, m_ext[0xf]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(e0_load) { return load_cart(image, m_e0); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(e1_load) { return load_cart(image, m_e1); } +}; + +#endif diff --git a/src/mame/includes/aussiebyte.h b/src/mame/includes/aussiebyte.h new file mode 100644 index 00000000000..0f798e1a99f --- /dev/null +++ b/src/mame/includes/aussiebyte.h @@ -0,0 +1,126 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert + +/*********************************************************** + + Includes + +************************************************************/ +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/z80dma.h" +#include "bus/centronics/ctronics.h" +#include "sound/speaker.h" +#include "sound/votrax.h" +#include "video/mc6845.h" +#include "bus/rs232/rs232.h" +#include "machine/wd_fdc.h" +#include "machine/msm5832.h" + + +/*********************************************************** + + Class + +************************************************************/ +class aussiebyte_state : public driver_device +{ +public: + aussiebyte_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_ctc(*this, "ctc") + , m_dma(*this, "dma") + , m_pio1(*this, "pio1") + , m_pio2(*this, "pio2") + , m_sio1(*this, "sio1") + , m_sio2(*this, "sio2") + , m_centronics(*this, "centronics") + , m_rs232(*this, "rs232") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_crtc(*this, "crtc") + , m_speaker(*this, "speaker") + , m_votrax(*this, "votrax") + {} + + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE8_MEMBER(port15_w); + DECLARE_WRITE8_MEMBER(port16_w); + DECLARE_WRITE8_MEMBER(port17_w); + DECLARE_WRITE8_MEMBER(port18_w); + DECLARE_READ8_MEMBER(port19_r); + DECLARE_WRITE8_MEMBER(port1a_w); + DECLARE_WRITE8_MEMBER(port1b_w); + DECLARE_WRITE8_MEMBER(port1c_w); + DECLARE_WRITE8_MEMBER(port20_w); + DECLARE_READ8_MEMBER(port28_r); + DECLARE_READ8_MEMBER(port33_r); + DECLARE_WRITE8_MEMBER(port34_w); + DECLARE_WRITE8_MEMBER(port35_w); + DECLARE_READ8_MEMBER(port36_r); + DECLARE_READ8_MEMBER(port37_r); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_WRITE_LINE_MEMBER(votrax_w); + DECLARE_WRITE_LINE_MEMBER(sio1_rdya_w); + DECLARE_WRITE_LINE_MEMBER(sio1_rdyb_w); + DECLARE_WRITE_LINE_MEMBER(sio2_rdya_w); + DECLARE_WRITE_LINE_MEMBER(sio2_rdyb_w); + DECLARE_MACHINE_RESET(aussiebyte); + DECLARE_DRIVER_INIT(aussiebyte); + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); + DECLARE_WRITE8_MEMBER(address_w); + DECLARE_WRITE8_MEMBER(register_w); + MC6845_UPDATE_ROW(crtc_update_row); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); + int m_centronics_busy; + required_device m_palette; + +private: + UINT8 crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16 ac_cnt, bool ac_curs); + bool m_port15; // rom switched in (0), out (1) + UINT8 m_port17; + UINT8 m_port17_rdy; + UINT8 m_port19; + UINT8 m_port1a; // bank to switch to when write to port 15 happens + UINT8 m_port28; + UINT8 m_port34; + UINT8 m_port35; // byte to be written to vram or aram + UINT8 m_video_index; + UINT16 m_cnt; + UINT8 *m_p_videoram; + UINT8 *m_p_attribram; + const UINT8 *m_p_chargen; + UINT16 m_alpha_address; + UINT16 m_graph_address; + required_device m_maincpu; + required_device m_ctc; + required_device m_dma; + required_device m_pio1; + required_device m_pio2; + required_device m_sio1; + required_device m_sio2; + required_device m_centronics; + required_device m_rs232; + required_device m_fdc; + required_device m_floppy0; + optional_device m_floppy1; + required_device m_crtc; + required_device m_speaker; + required_device m_votrax; +}; diff --git a/src/mame/includes/avigo.h b/src/mame/includes/avigo.h new file mode 100644 index 00000000000..b06dab92c65 --- /dev/null +++ b/src/mame/includes/avigo.h @@ -0,0 +1,116 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/***************************************************************************** + * + * includes/avigo.h + * + ****************************************************************************/ + +#ifndef AVIGO_H_ +#define AVIGO_H_ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "machine/rp5c01.h" +#include "machine/ins8250.h" +#include "machine/intelfsh.h" +#include "machine/nvram.h" +#include "sound/speaker.h" +#include "machine/ram.h" +#include "imagedev/snapquik.h" + +#define AVIGO_NUM_COLOURS 2 + +#define AVIGO_SCREEN_WIDTH 160 +#define AVIGO_SCREEN_HEIGHT 240 +#define AVIGO_PANEL_HEIGHT 26 + + +class avigo_state : public driver_device +{ +public: + avigo_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_speaker(*this, "speaker"), + m_uart(*this, "ns16550"), + m_serport(*this, "serport"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_speaker; + required_device m_uart; + required_device m_serport; + required_device m_palette; + + // defined in drivers/avigo.c + virtual void machine_start(); + virtual void machine_reset(); + void postload(); + void refresh_memory(UINT8 bank, UINT8 chip_select); + void refresh_ints(); + void nvram_init(nvram_device &nvram, void *base, size_t size); + + DECLARE_WRITE_LINE_MEMBER( tc8521_alarm_int ); + DECLARE_WRITE_LINE_MEMBER( com_interrupt ); + + DECLARE_READ8_MEMBER(flash_0x0000_read_handler); + DECLARE_WRITE8_MEMBER(flash_0x0000_write_handler); + DECLARE_READ8_MEMBER(flash_0x4000_read_handler); + DECLARE_WRITE8_MEMBER(flash_0x4000_write_handler); + DECLARE_READ8_MEMBER(flash_0x8000_read_handler); + DECLARE_WRITE8_MEMBER(flash_0x8000_write_handler); + + DECLARE_READ8_MEMBER(key_data_read_r); + DECLARE_WRITE8_MEMBER(set_key_line_w); + DECLARE_WRITE8_MEMBER(port2_w); + DECLARE_READ8_MEMBER(irq_r); + DECLARE_WRITE8_MEMBER(irq_w); + DECLARE_READ8_MEMBER(bank1_r); + DECLARE_READ8_MEMBER(bank2_r); + DECLARE_WRITE8_MEMBER(bank1_w); + DECLARE_WRITE8_MEMBER(bank2_w); + DECLARE_READ8_MEMBER(ad_control_status_r); + DECLARE_WRITE8_MEMBER(ad_control_status_w); + DECLARE_READ8_MEMBER(ad_data_r); + DECLARE_WRITE8_MEMBER(speaker_w); + DECLARE_READ8_MEMBER(port_04_r); + + DECLARE_INPUT_CHANGED_MEMBER(pen_irq); + DECLARE_INPUT_CHANGED_MEMBER(pen_move_irq); + DECLARE_INPUT_CHANGED_MEMBER(kb_irq); + DECLARE_INPUT_CHANGED_MEMBER(power_down_irq); + + // defined in video/avigo.c + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER(vid_memory_r); + DECLARE_WRITE8_MEMBER(vid_memory_w); + + // driver state + UINT8 m_key_line; + UINT8 m_irq; + UINT8 m_port2; + UINT8 m_bank2_l; + UINT8 m_bank2_h; + UINT8 m_bank1_l; + UINT8 m_bank1_h; + UINT8 m_ad_control_status; + intelfsh8_device * m_flashes[3]; + int m_flash_at_0x4000; + int m_flash_at_0x8000; + UINT16 m_ad_value; + UINT8 * m_video_memory; + UINT8 m_screen_column; + UINT8 m_warm_start; + UINT8 * m_ram_base; + DECLARE_PALETTE_INIT(avigo); + TIMER_DEVICE_CALLBACK_MEMBER(avigo_scan_timer); + TIMER_DEVICE_CALLBACK_MEMBER(avigo_1hz_timer); + + DECLARE_QUICKLOAD_LOAD_MEMBER( avigo); +}; +#endif /* AVIGO_H_ */ diff --git a/src/mame/includes/b2m.h b/src/mame/includes/b2m.h new file mode 100644 index 00000000000..86bd3162114 --- /dev/null +++ b/src/mame/includes/b2m.h @@ -0,0 +1,81 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/b2m.h + * + ****************************************************************************/ + +#ifndef B2M_H_ +#define B2M_H_ + +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/wd_fdc.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "machine/ram.h" + +class b2m_state : public driver_device +{ +public: + b2m_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_pit(*this, "pit8253"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette") { } + + UINT8 m_b2m_8255_porta; + UINT8 m_b2m_video_scroll; + UINT8 m_b2m_8255_portc; + + UINT8 m_b2m_video_page; + UINT8 m_b2m_drive; + UINT8 m_b2m_side; + + UINT8 m_b2m_romdisk_lsb; + UINT8 m_b2m_romdisk_msb; + + UINT8 m_b2m_color[4]; + UINT8 m_b2m_localmachine; + UINT8 m_vblank_state; + required_device m_maincpu; + required_device m_speaker; + required_device m_pit; + required_device m_ram; + required_device m_palette; + + /* devices */ + fd1793_t *m_fdc; + pic8259_device *m_pic; + DECLARE_READ8_MEMBER(b2m_keyboard_r); + DECLARE_WRITE8_MEMBER(b2m_palette_w); + DECLARE_READ8_MEMBER(b2m_palette_r); + DECLARE_WRITE8_MEMBER(b2m_localmachine_w); + DECLARE_READ8_MEMBER(b2m_localmachine_r); + DECLARE_DRIVER_INIT(b2m); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(b2m); + UINT32 screen_update_b2m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(b2m_vblank_interrupt); + DECLARE_WRITE_LINE_MEMBER(bm2_pit_out1); + DECLARE_WRITE8_MEMBER(b2m_8255_porta_w); + DECLARE_WRITE8_MEMBER(b2m_8255_portb_w); + DECLARE_WRITE8_MEMBER(b2m_8255_portc_w); + DECLARE_READ8_MEMBER(b2m_8255_portb_r); + DECLARE_WRITE8_MEMBER(b2m_ext_8255_portc_w); + DECLARE_READ8_MEMBER(b2m_romdisk_porta_r); + DECLARE_WRITE8_MEMBER(b2m_romdisk_portb_w); + DECLARE_WRITE8_MEMBER(b2m_romdisk_portc_w); + DECLARE_WRITE_LINE_MEMBER(b2m_fdc_drq); + DECLARE_FLOPPY_FORMATS( b2m_floppy_formats ); + void b2m_postload(); + void b2m_set_bank(int bank); +}; + +#endif diff --git a/src/mame/includes/banctec.h b/src/mame/includes/banctec.h new file mode 100644 index 00000000000..5a048ee6680 --- /dev/null +++ b/src/mame/includes/banctec.h @@ -0,0 +1,38 @@ +// license:GPL-2.0+ +// copyright-holders:Felipe Sanches +/***************************************************************************** + * + * includes/banctec.h + * + ****************************************************************************/ + +#ifndef BANCTEC_H_ +#define BANCTEC_H_ + +#include "video/mc6845.h" + +class banctec_state : public driver_device +{ +public: + banctec_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_videoram(*this, "videoram") { } + + DECLARE_READ8_MEMBER(banctec_read); + DECLARE_WRITE8_MEMBER(banctec_write); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_banctec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + required_device m_maincpu; + required_device m_gfxdecode; + required_shared_ptr m_videoram; + + tilemap_t *m_bg_tilemap; +}; + +#endif /* BANCTEC_H_ */ diff --git a/src/mame/includes/bbc.h b/src/mame/includes/bbc.h new file mode 100644 index 00000000000..5b8e56d25e5 --- /dev/null +++ b/src/mame/includes/bbc.h @@ -0,0 +1,439 @@ +// license:BSD-3-Clause +// copyright-holders:Gordon Jefferyes, Nigel Barnes +/***************************************************************************** + * + * includes/bbc.h + * + * BBC Model B + * + * Driver by Gordon Jefferyes + * + ****************************************************************************/ + +#ifndef BBC_H_ +#define BBC_H_ + +#include "bus/rs232/rs232.h" +#include "machine/6522via.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "machine/mc6854.h" +#include "machine/ram.h" +#include "machine/i8271.h" +#include "machine/wd_fdc.h" +#include "machine/upd7002.h" +#include "machine/mc146818.h" +#include "video/mc6845.h" +#include "video/saa5050.h" +#include "sound/sn76496.h" +#include "sound/tms5220.h" +#include "imagedev/cassette.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define RS232_TAG "rs232" + +class bbc_state : public driver_device +{ +public: + bbc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_mc6845(*this, "mc6845"), + m_adlc(*this, "mc6854"), + m_sn(*this, "sn76489"), + m_trom(*this, "saa5050"), + m_tms(*this, "tms5220"), + m_cassette(*this, "cassette"), + m_acia(*this, "acia6850"), + m_acia_clock(*this, "acia_clock"), + m_rs232(*this, RS232_TAG), + m_via6522_0(*this, "via6522_0"), + m_via6522_1(*this, "via6522_1"), + m_upd7002(*this, "upd7002"), + m_rtc(*this, "rtc"), + m_i8271(*this, "i8271"), + m_wd1770(*this, "wd1770"), + m_wd1772(*this, "wd1772"), + m_exp1(*this, "exp_rom1"), + m_exp2(*this, "exp_rom2"), + m_exp3(*this, "exp_rom3"), + m_exp4(*this, "exp_rom4"), + m_joy0(*this, "JOY0"), + m_joy1(*this, "JOY1"), + m_joy2(*this, "JOY2"), + m_joy3(*this, "JOY3"), + m_region_maincpu(*this, "maincpu"), + m_region_os(*this, "os"), + m_region_opt(*this, "option"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_bank5(*this, "bank5"), + m_bank6(*this, "bank6"), + m_bank7(*this, "bank7"), + m_bank8(*this, "bank8"), + m_ACCCON_IRR(CLEAR_LINE), + m_via_system_irq(CLEAR_LINE), + m_via_user_irq(CLEAR_LINE), + m_acia_irq(CLEAR_LINE), + m_palette(*this, "palette") + { } + + DECLARE_FLOPPY_FORMATS(floppy_formats_525sd); + DECLARE_FLOPPY_FORMATS(floppy_formats_525dd); + DECLARE_FLOPPY_FORMATS(floppy_formats_35dd); + + DECLARE_WRITE8_MEMBER(bbc_page_selecta_w); + DECLARE_WRITE8_MEMBER(bbc_memorya1_w); + DECLARE_WRITE8_MEMBER(bbc_page_selectb_w); + DECLARE_WRITE8_MEMBER(bbc_memoryb3_w); + DECLARE_WRITE8_MEMBER(bbc_memoryb4_w); + DECLARE_WRITE8_MEMBER(bbc_page_selectbp_w); + DECLARE_WRITE8_MEMBER(bbc_memorybp1_w); + DECLARE_WRITE8_MEMBER(bbc_memorybp2_w); + DECLARE_WRITE8_MEMBER(bbc_memorybp4_w); + DECLARE_WRITE8_MEMBER(bbc_memorybp4_128_w); + DECLARE_WRITE8_MEMBER(bbc_memorybp6_128_w); + DECLARE_READ8_MEMBER(bbcm_ACCCON_read); + DECLARE_WRITE8_MEMBER(bbcm_ACCCON_write); + DECLARE_WRITE8_MEMBER(page_selectbm_w); + DECLARE_WRITE8_MEMBER(bbc_memorybm1_w); + DECLARE_WRITE8_MEMBER(bbc_memorybm2_w); + DECLARE_WRITE8_MEMBER(bbc_memorybm4_w); + DECLARE_WRITE8_MEMBER(bbc_memorybm5_w); + DECLARE_WRITE8_MEMBER(bbc_memorybm7_w); + DECLARE_READ8_MEMBER(bbcm_r); + DECLARE_WRITE8_MEMBER(bbcm_w); + DECLARE_WRITE8_MEMBER(bbc_SerialULA_w); + + DECLARE_WRITE8_MEMBER(bbc_wd1770_status_w); + DECLARE_READ8_MEMBER(bbcm_wd177xl_read); + DECLARE_WRITE8_MEMBER(bbcm_wd1770l_write); + DECLARE_WRITE8_MEMBER(bbcm_wd1772l_write); + DECLARE_WRITE8_MEMBER(bbc_videoULA_w); + DECLARE_READ8_MEMBER(bbc_fe_r); + DECLARE_DIRECT_UPDATE_MEMBER(bbcbp_direct_handler); + DECLARE_DIRECT_UPDATE_MEMBER(bbcm_direct_handler); + + DECLARE_DRIVER_INIT(bbc); + + DECLARE_MACHINE_START(bbca); + DECLARE_MACHINE_RESET(bbca); + DECLARE_VIDEO_START(bbca); + + DECLARE_MACHINE_START(bbcb); + DECLARE_MACHINE_RESET(bbcb); + DECLARE_VIDEO_START(bbcb); + + DECLARE_MACHINE_START(bbcbp); + DECLARE_MACHINE_RESET(bbcbp); + DECLARE_VIDEO_START(bbcbp); + + DECLARE_MACHINE_START(bbcm); + DECLARE_MACHINE_RESET(bbcm); + DECLARE_VIDEO_START(bbcm); + + DECLARE_PALETTE_INIT(bbc); + UINT32 screen_update_bbc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(bbcb_vsync); + INTERRUPT_GEN_MEMBER(bbcb_keyscan); + INTERRUPT_GEN_MEMBER(bbcm_keyscan); + TIMER_CALLBACK_MEMBER(bbc_tape_timer_cb); + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + DECLARE_WRITE_LINE_MEMBER(bbcb_acia6850_irq_w); + DECLARE_WRITE_LINE_MEMBER(econet_clk_w); + DECLARE_WRITE8_MEMBER(bbcb_via_system_write_porta); + DECLARE_WRITE8_MEMBER(bbcb_via_system_write_portb); + DECLARE_READ8_MEMBER(bbcb_via_system_read_porta); + DECLARE_READ8_MEMBER(bbcb_via_system_read_portb); + DECLARE_WRITE_LINE_MEMBER(bbcb_via_system_irq_w); + DECLARE_READ8_MEMBER(bbcb_via_user_read_portb); + DECLARE_WRITE8_MEMBER(bbcb_via_user_write_portb); + DECLARE_WRITE_LINE_MEMBER(bbcb_via_user_irq_w); + DECLARE_WRITE_LINE_MEMBER(bbc_wd177x_intrq_w); + DECLARE_WRITE_LINE_MEMBER(bbc_wd177x_drq_w); + DECLARE_WRITE_LINE_MEMBER(bbc_vsync); + void update_acia_rxd(); + void update_acia_dcd(); + void update_acia_cts(); + DECLARE_WRITE_LINE_MEMBER(bbc_rts_w); + DECLARE_WRITE_LINE_MEMBER(bbc_txd_w); + DECLARE_WRITE_LINE_MEMBER(write_rxd_serial); + DECLARE_WRITE_LINE_MEMBER(write_dcd_serial); + DECLARE_WRITE_LINE_MEMBER(write_cts_serial); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + DECLARE_WRITE_LINE_MEMBER(bbc_i8271_interrupt); + DECLARE_WRITE_LINE_MEMBER(motor_w); + + UPD7002_GET_ANALOGUE(BBC_get_analogue_input); + UPD7002_EOC(BBC_uPD7002_EOC); + + void bbc_setup_banks(memory_bank *membank, int banks, UINT32 shift, UINT32 size); + void bbcm_setup_banks(memory_bank *membank, int banks, UINT32 shift, UINT32 size); + + int bbc_load_cart(device_image_interface &image, generic_slot_device *slot); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp1_load) { return bbc_load_cart(image, m_exp1); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp2_load) { return bbc_load_cart(image, m_exp2); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp3_load) { return bbc_load_cart(image, m_exp3); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp4_load) { return bbc_load_cart(image, m_exp4); } + + int bbcm_load_cart(device_image_interface &image, generic_slot_device *slot); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(bbcm_exp1_load) { return bbcm_load_cart(image, m_exp1); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(bbcm_exp2_load) { return bbcm_load_cart(image, m_exp2); } + + MC6845_UPDATE_ROW(crtc_update_row); + +private: + required_device m_maincpu; + required_device m_ram; + required_device m_mc6845; + optional_device m_adlc; + optional_device m_sn; +public: // HACK FOR MC6845 + optional_device m_trom; + optional_device m_tms; + optional_device m_cassette; + optional_device m_acia; + optional_device m_acia_clock; + optional_device m_rs232; + required_device m_via6522_0; + optional_device m_via6522_1; + optional_device m_upd7002; + optional_device m_rtc; + optional_device m_i8271; + optional_device m_wd1770; + optional_device m_wd1772; + required_device m_exp1; + required_device m_exp2; + optional_device m_exp3; + optional_device m_exp4; + optional_ioport m_joy0, m_joy1, m_joy2, m_joy3; + + required_memory_region m_region_maincpu; + required_memory_region m_region_os; + required_memory_region m_region_opt; + required_memory_bank m_bank1; // bbca bbcb bbcbp bbcbp128 bbcm + optional_memory_bank m_bank2; // bbcbp bbcbp128 bbcm + optional_memory_bank m_bank3; // bbca bbcb + required_memory_bank m_bank4; // bbca bbcb bbcbp bbcbp128 bbcm + optional_memory_bank m_bank5; // bbcm + optional_memory_bank m_bank6; // bbcbp bbcbp128 + required_memory_bank m_bank7; // bbca bbcb bbcbp bbcbp128 bbcm + optional_memory_bank m_bank8; // bbcm + + void check_interrupts(); + + int m_SWRAMtype; // this stores the DIP switch setting for the SWRAM type being used + int m_Speech; // this stores the CONF setting for Speech enabled/disabled + + int m_ACCCON_IRR; // IRQ inputs + + int m_rombank; // This is the latch that holds the sideways ROM bank to read + + int m_userport; // This stores the sideways RAM latch type. + // Acorn and others use the bbc_rombank latch to select the write bank to be used.(type 0) + // Solidisc use the BBC's userport to select the write bank to be used (type 1) + + int m_pagedRAM; // BBC B+ memory handling + int m_vdusel; // BBC B+ memory handling + + /* + ACCCON + + b7 IRR 1=Causes an IRQ to the processor + b6 TST 1=Selects &FC00-&FEFF read from OS-ROM + b5 IFJ 1=Internal 1 MHz bus + 0=External 1MHz bus + b4 ITU 1=Internal Tube + 0=External Tube + b3 Y 1=Read/Write HAZEL &C000-&DFFF RAM + 0=Read/Write ROM &C000-&DFFF OS-ROM + b2 X 1=Read/Write LYNNE + 0=Read/WRITE main memory &3000-&8000 + b1 E 1=Causes shadow if VDU code + 0=Main all the time + b0 D 1=Display LYNNE as screen + 0=Display main RAM screen + + ACCCON is a read/write register + */ + + int m_ACCCON; + int m_ACCCON_TST; + int m_ACCCON_IFJ; + int m_ACCCON_ITU; + int m_ACCCON_Y; + int m_ACCCON_X; + int m_ACCCON_E; + int m_ACCCON_D; + + + /* + The addressable latch + This 8 bit addressable latch is operated from port B lines 0-3. + PB0-PB2 are set to the required address of the output bit to be set. + PB3 is set to the value which should be programmed at that bit. + The function of the 8 output bits from this latch are:- + + B0 - Write Enable to the sound generator IC + B1 - READ select on the speech processor + B2 - WRITE select on the speech processor + B3 - Keyboard write enable + B4,B5 - these two outputs define the number to be added to the + start of screen address in hardware to control hardware scrolling:- + Mode Size Start of screen Number to add B5 B4 + 0,1,2 20K &3000 12K 1 1 + 3 16K &4000 16K 0 0 + 4,5 10K &5800 (or &1800) 22K 1 0 + 6 8K &6000 (or &2000) 24K 0 1 + B6 - Operates the CAPS lock LED (Pin 17 keyboard connector) + B7 - Operates the SHIFT lock LED (Pin 16 keyboard connector) + */ + + int m_b0_sound; + int m_b1_speech_read; + int m_b2_speech_write; + int m_b3_keyboard; + int m_b4_video0; + int m_b5_video1; + int m_b6_caps_lock_led; + int m_b7_shift_lock_led; + + int m_MC146818_WR; // FE30 bit 1 replaces b1_speech_read + int m_MC146818_DS; // FE30 bit 2 replaces b2_speech_write + int m_MC146818_AS; // 6522 port b bit 7 + int m_MC146818_CE; // 6522 port b bit 6 + + int m_via_system_porta; + int m_via_system_irq; + int m_via_user_irq; + int m_acia_irq; + + int m_column; // this is a counter in the keyboard circuit + + + /*************************************** + BBC 2C199 Serial Interface Cassette + ****************************************/ + + double m_last_dev_val; + int m_wav_len; + int m_len0; + int m_len1; + int m_len2; + int m_len3; + int m_mc6850_clock; + UINT8 m_serproc_data; + int m_rxd_serial; + int m_dcd_serial; + int m_cts_serial; + int m_dcd_cass; + int m_rxd_cass; + int m_cass_out_enabled; + int m_txd; + UINT32 m_nr_high_tones; + int m_cass_out_samples_to_go; + int m_cass_out_bit; + int m_cass_out_phase; + emu_timer *m_tape_timer; + + + /************************************** + i8271 disc control + ***************************************/ + + int m_previous_i8271_int_state; // 8271 interrupt status + + /************************************** + WD1770 disc control + ***************************************/ + + int m_drive_control; + int m_wd177x_irq_state; + int m_wd177x_drq_state; + int m_previous_wd177x_int_state; + int m_177x_IntEnabled; + + /************************************** + Video Code + ***************************************/ + + int m_memorySize; + + +// this is the real location of the start of the BBC's ram in the emulation +// it can be changed if shadow ram is being used to point at the upper 32K of RAM + +// this is the screen memory location of the next pixels to be drawn + +// this is a more global variable to store the bitmap variable passed in in the bbc_vh_screenrefresh function + +// this is the X and Y screen location in emulation pixels of the next pixels to be drawn + + + unsigned char *m_BBC_Video_RAM; + UINT16 *m_BBC_display; + UINT16 *m_BBC_display_left; + UINT16 *m_BBC_display_right; + bitmap_ind16 *m_BBC_bitmap; + int m_y_screen_pos; + unsigned char m_pixel_bits[256]; + int m_BBC_HSync; + int m_BBC_VSync; + + + int m_Teletext_Latch; + int m_VideoULA_CR; + int m_VideoULA_CR_counter; + int m_videoULA_Reg; + int m_videoULA_master_cursor_size; + int m_videoULA_width_of_cursor; + int m_videoULA_6845_clock_rate; + int m_videoULA_characters_per_line; + int m_videoULA_teletext_normal_select; + int m_videoULA_flash_colour_select; + + + int m_pixels_per_byte; + int m_emulation_pixels_per_real_pixel; + int m_emulation_pixels_per_byte; + + int m_emulation_cursor_size; + int m_cursor_state; + + int m_videoULA_pallet0[16]; + int m_videoULA_pallet1[16]; + int *m_videoULA_pallet_lookup; + + void (*m_draw_function)(running_machine &machine); + + void bbcbp_setvideoshadow(int vdusel); + void common_init(int memorySize); + void set_pixel_lookup(); + void set_cursor(bbc_state *state); + void BBC_Clock_CR(bbc_state *state); + void BBC_draw_teletext(); + void BBC_ula_drawpixel(bbc_state *state, int col, int number_of_pixels); + void BBC_draw_hi_res(); + void BBC_Set_HSync(int offset, int data); + void BBC_Set_VSync(int offset, int data); + void BBC_Set_CRE(int offset, int data); + void bbc_frameclock(); + int vdudriverset(); + int bbcm_vdudriverset(); + int bbc_keyboard(address_space &space, int data); + void bbcb_IC32_initialise(bbc_state *state); + void MC146818_set(address_space &space); + void bbc_TMSint(int status); + void MC6850_Receive_Clock(int new_clock); + void BBC_Cassette_motor(unsigned char status); + void bbc_update_fdq_int(int state); + unsigned int calculate_video_address(int ma,int ra); + required_device m_palette; +}; + +#endif /* BBC_H_ */ diff --git a/src/mame/includes/bebox.h b/src/mame/includes/bebox.h new file mode 100644 index 00000000000..d9909a67b44 --- /dev/null +++ b/src/mame/includes/bebox.h @@ -0,0 +1,136 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, R. Belmont +/***************************************************************************** + * + * includes/bebox.h + * + * BeBox + * + ****************************************************************************/ + +#ifndef BEBOX_H_ +#define BEBOX_H_ + +#include "emu.h" +#include "machine/53c810.h" +#include "machine/am9517a.h" +#include "machine/idectrl.h" +#include "machine/ins8250.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "machine/upd765.h" +#include "machine/intelfsh.h" +#include "bus/lpci/pci.h" + + +class bebox_state : public driver_device +{ +public: + enum + { + TIMER_GET_DEVICES + }; + + bebox_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_ppc1(*this, "ppc1"), + m_ppc2(*this, "ppc2"), + m_lsi53c810(*this, "lsi53c810"), + m_dma8237_1(*this, "dma8237_1"), + m_dma8237_2(*this, "dma8237_2"), + m_pic8259_1(*this, "pic8259_1"), + m_pic8259_2(*this, "pic8259_2"), + m_pit8254(*this, "pit8254"), + m_ram(*this, RAM_TAG), + m_smc37c78(*this, "smc37c78"), + m_flash(*this, "flash"), + m_pcibus(*this, "pcibus") + { + } + + required_device m_ppc1; + required_device m_ppc2; + required_device m_lsi53c810; + required_device m_dma8237_1; + required_device m_dma8237_2; + required_device m_pic8259_1; + required_device m_pic8259_2; + required_device m_pit8254; + required_device m_ram; + required_device m_smc37c78; + required_device m_flash; + required_device m_pcibus; + UINT32 m_cpu_imask[2]; + UINT32 m_interrupts; + UINT32 m_crossproc_interrupts; + int m_dma_channel; + UINT16 m_dma_offset[2][4]; + UINT8 m_at_pages[0x10]; + UINT32 m_scsi53c810_data[0x100 / 4]; + DECLARE_DRIVER_INIT(bebox); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_WRITE_LINE_MEMBER(bebox_pic8259_master_set_int_line); + DECLARE_WRITE_LINE_MEMBER(bebox_pic8259_slave_set_int_line); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE_LINE_MEMBER(bebox_dma_hrq_changed); + DECLARE_READ8_MEMBER(bebox_dma8237_fdc_dack_r); + DECLARE_WRITE8_MEMBER(bebox_dma8237_fdc_dack_w); + DECLARE_WRITE_LINE_MEMBER(bebox_dma8237_out_eop); + DECLARE_WRITE_LINE_MEMBER(pc_dack0_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack1_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack2_w); + DECLARE_WRITE_LINE_MEMBER(pc_dack3_w); + DECLARE_WRITE_LINE_MEMBER(bebox_timer0_w); + DECLARE_READ64_MEMBER(bebox_cpu0_imask_r); + DECLARE_READ64_MEMBER(bebox_cpu1_imask_r); + DECLARE_READ64_MEMBER(bebox_interrupt_sources_r); + DECLARE_READ64_MEMBER(bebox_crossproc_interrupts_r); + DECLARE_READ64_MEMBER(bebox_interrupt_ack_r); + DECLARE_READ8_MEMBER(bebox_page_r); + DECLARE_READ8_MEMBER(bebox_80000480_r); + DECLARE_READ8_MEMBER(bebox_flash_r); + + DECLARE_WRITE64_MEMBER(bebox_cpu0_imask_w); + DECLARE_WRITE64_MEMBER(bebox_cpu1_imask_w); + DECLARE_WRITE64_MEMBER(bebox_crossproc_interrupts_w); + DECLARE_WRITE64_MEMBER(bebox_processor_resets_w); + DECLARE_WRITE8_MEMBER(bebox_800001F0_w); + DECLARE_WRITE64_MEMBER(bebox_800003F0_w); + DECLARE_WRITE8_MEMBER(bebox_page_w); + DECLARE_WRITE8_MEMBER(bebox_80000480_w); + DECLARE_WRITE8_MEMBER(bebox_flash_w); + DECLARE_READ8_MEMBER(at_dma8237_1_r); + DECLARE_WRITE8_MEMBER(at_dma8237_1_w); + DECLARE_READ8_MEMBER(bebox_dma_read_byte); + DECLARE_WRITE8_MEMBER(bebox_dma_write_byte); + DECLARE_READ64_MEMBER(scsi53c810_r); + DECLARE_WRITE64_MEMBER(scsi53c810_w); + DECLARE_READ64_MEMBER(bb_slave_64be_r); + + DECLARE_WRITE_LINE_MEMBER(bebox_ide_interrupt); + + DECLARE_WRITE_LINE_MEMBER(bebox_keyboard_interrupt); + + DECLARE_WRITE_LINE_MEMBER( fdc_interrupt ); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + LSI53C810_FETCH_CB(scsi_fetch); + LSI53C810_IRQ_CB(scsi_irq_callback); + LSI53C810_DMA_CB(scsi_dma_callback); + + void bebox_set_irq_bit(unsigned int interrupt_bit, int val); + void bebox_update_interrupts(); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +/*----------- defined in machine/bebox.c -----------*/ + +UINT32 scsi53c810_pci_read(device_t *busdevice, device_t *device, int function, int offset, UINT32 mem_mask); +void scsi53c810_pci_write(device_t *busdevice, device_t *device, int function, int offset, UINT32 data, UINT32 mem_mask); + +#endif /* BEBOX_H_ */ diff --git a/src/mame/includes/bk.h b/src/mame/includes/bk.h new file mode 100644 index 00000000000..c40b6078e56 --- /dev/null +++ b/src/mame/includes/bk.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/bk.h + * + ****************************************************************************/ + +#ifndef BK_H_ +#define BK_H_ +#include "imagedev/cassette.h" + +class bk_state : public driver_device +{ +public: + bk_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_bk0010_video_ram(*this, "video_ram"), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette") { } + + UINT16 m_scrool; + required_shared_ptr m_bk0010_video_ram; + UINT16 m_kbd_state; + UINT16 m_key_code; + UINT16 m_key_pressed; + UINT16 m_key_irq_vector; + UINT16 m_drive; + DECLARE_READ16_MEMBER(bk_key_state_r); + DECLARE_READ16_MEMBER(bk_key_code_r); + DECLARE_READ16_MEMBER(bk_vid_scrool_r); + DECLARE_READ16_MEMBER(bk_key_press_r); + DECLARE_WRITE16_MEMBER(bk_key_state_w); + DECLARE_WRITE16_MEMBER(bk_vid_scrool_w); + DECLARE_WRITE16_MEMBER(bk_key_press_w); + DECLARE_READ16_MEMBER(bk_floppy_cmd_r); + DECLARE_WRITE16_MEMBER(bk_floppy_cmd_w); + DECLARE_READ16_MEMBER(bk_floppy_data_r); + DECLARE_WRITE16_MEMBER(bk_floppy_data_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_bk0010(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(keyboard_callback); + IRQ_CALLBACK_MEMBER(bk0010_irq_callback); + required_device m_maincpu; + required_device m_cassette; +}; + +#endif /* BK_H_ */ diff --git a/src/mame/includes/bullet.h b/src/mame/includes/bullet.h new file mode 100644 index 00000000000..390aac07ad8 --- /dev/null +++ b/src/mame/includes/bullet.h @@ -0,0 +1,184 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __BULLET__ +#define __BULLET__ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "bus/centronics/ctronics.h" +#include "machine/ram.h" +#include "bus/scsi/scsi.h" +#include "machine/wd_fdc.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/z80dma.h" +#include "machine/z80pio.h" + +#define Z80_TAG "u20" +#define Z80CTC_TAG "u1" +#define Z80DMA_TAG "u50" +#define Z80DART_TAG "u45" +#define Z80PIO_TAG "z80pio" +#define MB8877_TAG "u55" +#define CENTRONICS_TAG "centronics" +#define SCSIBUS_TAG "scsi" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" + +class bullet_state : public driver_device +{ +public: + bullet_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ctc(*this, Z80CTC_TAG), + m_dart(*this, Z80DART_TAG), + m_dmac(*this, Z80DMA_TAG), + m_fdc(*this, MB8877_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, MB8877_TAG":0"), + m_floppy1(*this, MB8877_TAG":1"), + m_floppy2(*this, MB8877_TAG":2"), + m_floppy3(*this, MB8877_TAG":3"), + m_floppy4(*this, MB8877_TAG":4"), + m_floppy5(*this, MB8877_TAG":5"), + m_floppy6(*this, MB8877_TAG":6"), + m_floppy7(*this, MB8877_TAG":7"), + m_floppy(NULL), + m_centronics(*this, CENTRONICS_TAG), + m_rom(*this, Z80_TAG), + m_sw1(*this, "SW1"), + m_fdrdy(0), + m_exdsk_sw(false), + m_hdcon_sw(false) + { + } + + required_device m_maincpu; + required_device m_ctc; + required_device m_dart; + required_device m_dmac; + required_device m_fdc; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_device m_floppy4; + required_device m_floppy5; + required_device m_floppy6; + required_device m_floppy7; + floppy_image_device *m_floppy; + required_device m_centronics; + required_memory_region m_rom; + required_ioport m_sw1; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( mreq_r ); + DECLARE_WRITE8_MEMBER( mreq_w ); + DECLARE_READ8_MEMBER( info_r ); + DECLARE_READ8_MEMBER( brom_r ); + DECLARE_WRITE8_MEMBER( brom_w ); + DECLARE_READ8_MEMBER( win_r ); + DECLARE_WRITE8_MEMBER( wstrobe_w ); + DECLARE_WRITE8_MEMBER( exdsk_w ); + DECLARE_WRITE8_MEMBER( exdma_w ); + DECLARE_WRITE8_MEMBER( hdcon_w ); + DECLARE_WRITE8_MEMBER( segst_w ); + DECLARE_WRITE8_MEMBER( dart_w ); + DECLARE_READ8_MEMBER( dma_mreq_r ); + DECLARE_WRITE8_MEMBER( dma_mreq_w ); + DECLARE_READ8_MEMBER( pio_pb_r ); + DECLARE_WRITE_LINE_MEMBER( dartardy_w ); + DECLARE_WRITE_LINE_MEMBER( dartbrdy_w ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_perror ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_fault ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + + void bankswitch(); + void update_dma_rdy(); + + // memory state + int m_segst; + int m_brom; + + // DMA state + UINT8 m_exdma; + int m_buf; + bool m_fdrdy; + int m_dartardy; + int m_dartbrdy; + int m_winrdy; + int m_exrdy1; + int m_exrdy2; + bool m_exdsk_sw; + bool m_hdcon_sw; + + int m_centronics_busy; + int m_centronics_perror; + int m_centronics_select; + int m_centronics_fault; + + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + DECLARE_WRITE_LINE_MEMBER(dart_rxtxca_w); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); +}; + +class bulletf_state : public bullet_state +{ +public: + bulletf_state(const machine_config &mconfig, device_type type, const char *tag) : + bullet_state(mconfig, type, tag), + m_floppy8(*this, MB8877_TAG":8"), + m_floppy9(*this, MB8877_TAG":9"), + m_scsibus(*this, SCSIBUS_TAG), + m_scsi_data_in(*this, "scsi_data_in"), + m_scsi_data_out(*this, "scsi_data_out"), + m_scsi_ctrl_in(*this, "scsi_ctrl_in") + { + } + + required_device m_floppy8; + required_device m_floppy9; + required_device m_scsibus; + required_device m_scsi_data_in; + required_device m_scsi_data_out; + required_device m_scsi_ctrl_in; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( mreq_r ); + DECLARE_WRITE8_MEMBER( mreq_w ); + DECLARE_WRITE8_MEMBER( xdma0_w ); + DECLARE_WRITE8_MEMBER( xfdc_w ); + DECLARE_WRITE8_MEMBER( mbank_w ); + DECLARE_READ8_MEMBER( hwsts_r ); + DECLARE_READ8_MEMBER( scsi_r ); + DECLARE_WRITE8_MEMBER( scsi_w ); + + DECLARE_READ8_MEMBER( dma_mreq_r ); + DECLARE_WRITE8_MEMBER( dma_mreq_w ); + DECLARE_WRITE8_MEMBER( pio_pa_w ); + DECLARE_WRITE_LINE_MEMBER( cstrb_w ); + DECLARE_WRITE_LINE_MEMBER( req_w ); + + void fdc_intrq_w(bool state); + + void update_dma_rdy(); + + int m_rome; + UINT8 m_xdma0; + UINT8 m_mbank; + int m_wack; + int m_wrdy; +}; + +#endif diff --git a/src/mame/includes/busicom.h b/src/mame/includes/busicom.h new file mode 100644 index 00000000000..5a589036db9 --- /dev/null +++ b/src/mame/includes/busicom.h @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/busicom.h + * + ****************************************************************************/ + +#ifndef BUSICOM_H_ +#define BUSICOM_H_ + +#include "cpu/i4004/i4004.h" + +class busicom_state : public driver_device +{ +public: + busicom_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") { } + + UINT8 m_drum_index; + UINT16 m_keyboard_shifter; + UINT32 m_printer_shifter; + UINT8 m_timer; + UINT8 m_printer_line[11][17]; + UINT8 m_printer_line_color[11]; + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_READ8_MEMBER(printer_r); + DECLARE_WRITE8_MEMBER(shifter_w); + DECLARE_WRITE8_MEMBER(printer_w); + DECLARE_WRITE8_MEMBER(status_w); + DECLARE_WRITE8_MEMBER(printer_ctrl_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(busicom); + UINT32 screen_update_busicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(timer_callback); + required_device m_maincpu; + required_device m_palette; + UINT8 get_bit_selected(UINT32 val,int num); +}; + +#endif /* BUSICOM_H_ */ diff --git a/src/mame/includes/bw12.h b/src/mame/includes/bw12.h new file mode 100644 index 00000000000..474d4b2ad70 --- /dev/null +++ b/src/mame/includes/bw12.h @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __BW12__ +#define __BW12__ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "formats/bw12_dsk.h" +#include "machine/6821pia.h" +#include "bus/centronics/ctronics.h" +#include "machine/kb3600.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "machine/rescap.h" +#include "machine/upd765.h" +#include "machine/z80dart.h" +#include "video/mc6845.h" +#include "sound/dac.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "ic35" +#define MC6845_TAG "ic14" +#define UPD765_TAG "ic45" +#define Z80SIO_TAG "ic15" +#define PIT8253_TAG "ic34" +#define PIA6821_TAG "ic16" +#define MC1408_TAG "ic4" +#define AY3600PRO002_TAG "ic74" +#define CENTRONICS_TAG "centronics" +#define FLOPPY_TIMER_TAG "motor_off" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" + +#define BW12_VIDEORAM_MASK 0x7ff +#define BW12_CHARROM_MASK 0xfff + +class bw12_state : public driver_device +{ +public: + bw12_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_pia(*this, PIA6821_TAG), + m_sio(*this, Z80SIO_TAG), + m_fdc(*this, UPD765_TAG), + m_kbc(*this, AY3600PRO002_TAG), + m_crtc(*this, MC6845_TAG), + m_pit(*this, PIT8253_TAG), + m_palette(*this, "palette"), + m_centronics(*this, CENTRONICS_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, UPD765_TAG ":1:525dd"), + m_floppy1(*this, UPD765_TAG ":2:525dd"), + m_floppy_timer(*this, FLOPPY_TIMER_TAG), + m_rom(*this, Z80_TAG), + m_char_rom(*this, "chargen"), + m_video_ram(*this, "video_ram"), + m_modifiers(*this, "MODIFIERS") + { } + + required_device m_maincpu; + required_device m_pia; + required_device m_sio; + required_device m_fdc; + required_device m_kbc; + required_device m_crtc; + required_device m_pit; + required_device m_palette; + required_device m_centronics; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy_timer; + required_memory_region m_rom; + required_memory_region m_char_rom; + required_shared_ptr m_video_ram; + required_ioport m_modifiers; + + virtual void machine_start(); + virtual void machine_reset(); + + void bankswitch(); + void floppy_motor_off(); + void set_floppy_motor_off_timer(); + void ls259_w(int address, int data); + + DECLARE_READ8_MEMBER( ls259_r ); + DECLARE_WRITE8_MEMBER( ls259_w ); + DECLARE_READ8_MEMBER( pia_pa_r ); + DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); + DECLARE_WRITE_LINE_MEMBER( pit_out2_w ); + DECLARE_READ_LINE_MEMBER( ay3600_shift_r ); + DECLARE_READ_LINE_MEMBER( ay3600_control_r ); + DECLARE_WRITE_LINE_MEMBER( ay3600_data_ready_w ); + MC6845_UPDATE_ROW( crtc_update_row ); + + /* memory state */ + int m_bank; + + /* PIT state */ + int m_pit_out2; + + /* keyboard state */ + int m_key_data[9]; + int m_key_sin; + int m_key_stb; + int m_key_shift; + + /* floppy state */ + int m_motor_on; + int m_motor0; + int m_motor1; + TIMER_DEVICE_CALLBACK_MEMBER(floppy_motor_off_tick); + DECLARE_WRITE_LINE_MEMBER(pit_out0_w); + DECLARE_FLOPPY_FORMATS( bw12_floppy_formats ); + DECLARE_FLOPPY_FORMATS( bw14_floppy_formats ); + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + int m_centronics_busy; + int m_centronics_fault; + int m_centronics_perror; +}; + +#endif diff --git a/src/mame/includes/bw2.h b/src/mame/includes/bw2.h new file mode 100644 index 00000000000..563ce4b4acd --- /dev/null +++ b/src/mame/includes/bw2.h @@ -0,0 +1,118 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __BW2__ +#define __BW2__ + +#include "emu.h" +#include "bus/bw2/exp.h" +#include "cpu/z80/z80.h" +#include "formats/bw2_dsk.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8251.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "video/msm6255.h" +#include "rendlay.h" + +#define Z80_TAG "ic1" +#define I8255A_TAG "ic4" +#define WD2797_TAG "ic5" +#define I8253_TAG "ic6" +#define I8251_TAG "ic7" +#define MSM6255_TAG "ic49" +#define CENTRONICS_TAG "centronics" +#define RS232_TAG "rs232" +#define SCREEN_TAG "screen" + +class bw2_state : public driver_device +{ +public: + bw2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_uart(*this, I8251_TAG), + m_fdc(*this, WD2797_TAG), + m_lcdc(*this, MSM6255_TAG), + m_pit(*this, I8253_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_exp(*this, BW2_EXPANSION_SLOT_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, WD2797_TAG":0"), + m_floppy1(*this, WD2797_TAG":1"), + m_floppy(NULL), + m_rom(*this, Z80_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_video_ram(*this, "videoram") + { } + + required_device m_maincpu; + required_device m_uart; + required_device m_fdc; + required_device m_lcdc; + required_device m_pit; + required_device m_centronics; + required_device m_exp; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + floppy_image_device *m_floppy; + required_memory_region m_rom; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE8_MEMBER( ppi_pa_w ); + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + DECLARE_READ8_MEMBER( ppi_pc_r ); + + DECLARE_WRITE_LINE_MEMBER( pit_out0_w ); + DECLARE_WRITE_LINE_MEMBER( mtron_w ); + + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + // keyboard state + UINT8 m_kb; + + // memory state + UINT8 m_bank; + + // floppy state + int m_mtron; + int m_mfdbk; + + // video state + optional_shared_ptr m_video_ram; + DECLARE_PALETTE_INIT(bw2); + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + int m_centronics_busy; +}; + +#endif diff --git a/src/mame/includes/c128.h b/src/mame/includes/c128.h new file mode 100644 index 00000000000..c32b2afd726 --- /dev/null +++ b/src/mame/includes/c128.h @@ -0,0 +1,253 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __C128__ +#define __C128__ + +#include "emu.h" +#include "bus/cbmiec/cbmiec.h" +#include "bus/c64/exp.h" +#include "bus/vic20/user.h" +#include "bus/pet/cass.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "imagedev/snapquik.h" +#include "cpu/m6502/m8502.h" +#include "machine/mos6526.h" +#include "machine/mos8722.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/mos6581.h" +#include "video/mc6845.h" +#include "video/mos6566.h" + +#define Z80A_TAG "u10" +#define M8502_TAG "u6" +#define MOS8563_TAG "u22" +#define MOS8564_TAG "u21" +#define MOS8566_TAG "u21" +#define MOS6581_TAG "u5" +#define MOS6526_1_TAG "u1" +#define MOS6526_2_TAG "u4" +#define MOS8721_TAG "u11" +#define MOS8722_TAG "u7" +#define SCREEN_VIC_TAG "screen" +#define SCREEN_VDC_TAG "screen80" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" +#define PET_USER_PORT_TAG "user" + +class c128_state : public driver_device +{ +public: + c128_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80A_TAG), + m_subcpu(*this, M8502_TAG), + m_mmu(*this, MOS8722_TAG), + m_pla(*this, MOS8721_TAG), + m_vdc(*this, MOS8563_TAG), + m_vic(*this, MOS8564_TAG), + m_sid(*this, MOS6581_TAG), + m_cia1(*this, MOS6526_1_TAG), + m_cia2(*this, MOS6526_2_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, C64_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_from(*this, "from"), + m_rom(*this, M8502_TAG), + m_charom(*this, "charom"), + m_color_ram(*this, "color_ram"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_k0(*this, "K0"), + m_k1(*this, "K1"), + m_k2(*this, "K2"), + m_lock(*this, "LOCK"), + m_caps(*this, "CAPS"), + m_40_80(*this, "40_80"), + m_z80en(0), + m_loram(1), + m_hiram(1), + m_charen(1), + m_game(1), + m_exrom(1), + m_va14(1), + m_va15(1), + m_clrbank(0), + m_cnt1(1), + m_sp1(1), + m_iec_data_out(1), + m_restore(1), + m_cia1_irq(CLEAR_LINE), + m_cia2_irq(CLEAR_LINE), + m_vic_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE), + m_exp_nmi(CLEAR_LINE), + m_cass_rd(1), + m_iec_srq(1), + m_vic_k(0x07), + m_caps_lock(1) + { } + + required_device m_maincpu; + required_device m_subcpu; + required_device m_mmu; + required_device m_pla; + required_device m_vdc; + required_device m_vic; + required_device m_sid; + required_device m_cia1; + required_device m_cia2; + required_device m_iec; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + required_device m_user; + required_device m_ram; + required_device m_cassette; + required_device m_from; + required_memory_region m_rom; + required_memory_region m_charom; + optional_shared_ptr m_color_ram; + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + required_ioport m_row3; + required_ioport m_row4; + required_ioport m_row5; + required_ioport m_row6; + required_ioport m_row7; + required_ioport m_k0; + required_ioport m_k1; + required_ioport m_k2; + required_ioport m_lock; + required_ioport m_caps; + required_ioport m_40_80; + + virtual void machine_start(); + virtual void machine_reset(); + + inline void check_interrupts(); + int read_pla(offs_t offset, offs_t ca, offs_t vma, int ba, int rw, int aec, int z80io, int ms3, int ms2, int ms1, int ms0); + UINT8 read_memory(address_space &space, offs_t offset, offs_t vma, int ba, int aec, int z80io); + void write_memory(address_space &space, offs_t offset, offs_t vma, UINT8 data, int ba, int aec, int z80io); + inline void update_iec(); + + DECLARE_READ8_MEMBER( z80_r ); + DECLARE_WRITE8_MEMBER( z80_w ); + DECLARE_READ8_MEMBER( z80_io_r ); + DECLARE_WRITE8_MEMBER( z80_io_w ); + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_colorram_r ); + + DECLARE_WRITE_LINE_MEMBER( mmu_z80en_w ); + DECLARE_WRITE_LINE_MEMBER( mmu_fsdir_w ); + DECLARE_READ_LINE_MEMBER( mmu_game_r ); + DECLARE_READ_LINE_MEMBER( mmu_exrom_r ); + DECLARE_READ_LINE_MEMBER( mmu_sense40_r ); + + DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); + DECLARE_WRITE8_MEMBER( vic_k_w ); + + DECLARE_READ8_MEMBER( sid_potx_r ); + DECLARE_READ8_MEMBER( sid_poty_r ); + + DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); + DECLARE_WRITE_LINE_MEMBER( cia1_cnt_w ); + DECLARE_WRITE_LINE_MEMBER( cia1_sp_w ); + DECLARE_READ8_MEMBER( cia1_pa_r ); + DECLARE_WRITE8_MEMBER( cia1_pa_w ); + DECLARE_READ8_MEMBER( cia1_pb_r ); + DECLARE_WRITE8_MEMBER( cia1_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( cia2_irq_w ); + DECLARE_READ8_MEMBER( cia2_pa_r ); + DECLARE_WRITE8_MEMBER( cia2_pa_w ); + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_WRITE_LINE_MEMBER( iec_srq_w ); + DECLARE_WRITE_LINE_MEMBER( iec_data_w ); + + DECLARE_READ8_MEMBER( exp_dma_cd_r ); + DECLARE_WRITE8_MEMBER( exp_dma_cd_w ); + DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); + DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); + DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); + DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); + + DECLARE_WRITE_LINE_MEMBER( write_restore ); + DECLARE_INPUT_CHANGED_MEMBER( caps_lock ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); + + DECLARE_READ8_MEMBER( cia2_pb_r ); + DECLARE_WRITE8_MEMBER( cia2_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( write_user_pa2 ) { m_user_pa2 = state; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb0 ) { if (state) m_user_pb |= 1; else m_user_pb &= ~1; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb1 ) { if (state) m_user_pb |= 2; else m_user_pb &= ~2; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb2 ) { if (state) m_user_pb |= 4; else m_user_pb &= ~4; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb3 ) { if (state) m_user_pb |= 8; else m_user_pb &= ~8; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb4 ) { if (state) m_user_pb |= 16; else m_user_pb &= ~16; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb5 ) { if (state) m_user_pb |= 32; else m_user_pb &= ~32; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb6 ) { if (state) m_user_pb |= 64; else m_user_pb &= ~64; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb7 ) { if (state) m_user_pb |= 128; else m_user_pb &= ~128; } + + // memory state + int m_z80en; + int m_loram; + int m_hiram; + int m_charen; + int m_game; + int m_exrom; + int m_reset; + + // video state + int m_va14; + int m_va15; + int m_clrbank; + + // fast serial state + int m_cnt1; + int m_sp1; + int m_iec_data_out; + + // interrupt state + int m_restore; + int m_cia1_irq; + int m_cia2_irq; + int m_vic_irq; + int m_exp_irq; + int m_exp_nmi; + int m_exp_dma; + int m_cass_rd; + int m_iec_srq; + + // keyboard state + UINT8 m_vic_k; + int m_caps_lock; + + int m_user_pa2; + int m_user_pb; +}; + + + +#endif diff --git a/src/mame/includes/c64.h b/src/mame/includes/c64.h new file mode 100644 index 00000000000..787fe5a6f60 --- /dev/null +++ b/src/mame/includes/c64.h @@ -0,0 +1,216 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __C64__ +#define __C64__ + +#include "emu.h" +#include "bus/cbmiec/cbmiec.h" +#include "bus/c64/exp.h" +#include "bus/vic20/user.h" +#include "bus/pet/cass.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m6510.h" +#include "imagedev/snapquik.h" +#include "machine/mos6526.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/mos6581.h" +#include "video/mos6566.h" + +#define M6510_TAG "u7" +#define MOS6567_TAG "u19" +#define MOS6569_TAG "u19" +#define MOS6581_TAG "u18" +#define MOS6526_1_TAG "u1" +#define MOS6526_2_TAG "u2" +#define PLA_TAG "u17" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" +#define PET_USER_PORT_TAG "user" + +class c64_state : public driver_device +{ +public: + c64_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6510_TAG), + m_pla(*this, PLA_TAG), + m_vic(*this, MOS6569_TAG), + m_sid(*this, MOS6581_TAG), + m_cia1(*this, MOS6526_1_TAG), + m_cia2(*this, MOS6526_2_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, C64_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_color_ram(*this, "color_ram"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_lock(*this, "LOCK"), + m_loram(1), + m_hiram(1), + m_charen(1), + m_va14(1), + m_va15(1), + m_restore(1), + m_cia1_irq(CLEAR_LINE), + m_cia2_irq(CLEAR_LINE), + m_vic_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE), + m_exp_nmi(CLEAR_LINE) + { } + + // ROM + UINT8 *m_basic; + UINT8 *m_kernal; + UINT8 *m_charom; + + required_device m_maincpu; + required_device m_pla; + required_device m_vic; + required_device m_sid; + required_device m_cia1; + required_device m_cia2; + optional_device m_iec; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + required_device m_user; + required_device m_ram; + optional_device m_cassette; + optional_shared_ptr m_color_ram; + optional_ioport m_row0; + optional_ioport m_row1; + optional_ioport m_row2; + optional_ioport m_row3; + optional_ioport m_row4; + optional_ioport m_row5; + optional_ioport m_row6; + optional_ioport m_row7; + optional_ioport m_lock; + + virtual void machine_start(); + virtual void machine_reset(); + + void check_interrupts(); + int read_pla(offs_t offset, offs_t va, int rw, int aec, int ba); + UINT8 read_memory(address_space &space, offs_t offset, offs_t va, int aec, int ba); + void write_memory(address_space &space, offs_t offset, UINT8 data, int aec, int ba); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_colorram_r ); + DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); + + DECLARE_READ8_MEMBER( sid_potx_r ); + DECLARE_READ8_MEMBER( sid_poty_r ); + + DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); + DECLARE_READ8_MEMBER( cia1_pa_r ); + DECLARE_WRITE8_MEMBER( cia1_pa_w ); + DECLARE_READ8_MEMBER( cia1_pb_r ); + DECLARE_WRITE8_MEMBER( cia1_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( cia2_irq_w ); + DECLARE_READ8_MEMBER( cia2_pa_r ); + DECLARE_WRITE8_MEMBER( cia2_pa_w ); + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_WRITE_LINE_MEMBER( write_restore ); + DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); + DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); + DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); + DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); + + DECLARE_READ8_MEMBER( cia2_pb_r ); + DECLARE_WRITE8_MEMBER( cia2_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( write_user_pa2 ) { m_user_pa2 = state; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb0 ) { if (state) m_user_pb |= 1; else m_user_pb &= ~1; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb1 ) { if (state) m_user_pb |= 2; else m_user_pb &= ~2; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb2 ) { if (state) m_user_pb |= 4; else m_user_pb &= ~4; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb3 ) { if (state) m_user_pb |= 8; else m_user_pb &= ~8; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb4 ) { if (state) m_user_pb |= 16; else m_user_pb &= ~16; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb5 ) { if (state) m_user_pb |= 32; else m_user_pb &= ~32; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb6 ) { if (state) m_user_pb |= 64; else m_user_pb &= ~64; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb7 ) { if (state) m_user_pb |= 128; else m_user_pb &= ~128; } + + // memory state + int m_loram; + int m_hiram; + int m_charen; + + // video state + int m_va14; + int m_va15; + + // interrupt state + int m_restore; + int m_cia1_irq; + int m_cia2_irq; + int m_vic_irq; + int m_exp_irq; + int m_exp_nmi; + int m_exp_dma; + + int m_user_pa2; + int m_user_pb; +}; + + +class sx64_state : public c64_state +{ +public: + sx64_state(const machine_config &mconfig, device_type type, const char *tag) + : c64_state(mconfig, type, tag) + { } + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); +}; + + +class c64c_state : public c64_state +{ +public: + c64c_state(const machine_config &mconfig, device_type type, const char *tag) + : c64_state(mconfig, type, tag) + { } +}; + + +class c64gs_state : public c64c_state +{ +public: + c64gs_state(const machine_config &mconfig, device_type type, const char *tag) + : c64c_state(mconfig, type, tag) + { } + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_READ8_MEMBER( cia1_pa_r ); + DECLARE_READ8_MEMBER( cia1_pb_r ); +}; + + + +#endif diff --git a/src/mame/includes/c65.h b/src/mame/includes/c65.h new file mode 100644 index 00000000000..e8771e83fc1 --- /dev/null +++ b/src/mame/includes/c65.h @@ -0,0 +1,2 @@ +// license:LGPL-2.1+ +// copyright-holders: Angelo Salese diff --git a/src/mame/includes/c80.h b/src/mame/includes/c80.h new file mode 100644 index 00000000000..d2b461fb0a3 --- /dev/null +++ b/src/mame/includes/c80.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __C80__ +#define __C80__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80pio.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "d2" +#define Z80PIO1_TAG "d11" +#define Z80PIO2_TAG "d12" + +class c80_state : public driver_device +{ +public: + c80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_pio1(*this, Z80PIO1_TAG), + m_cassette(*this, "cassette"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2") + { } + + required_device m_maincpu; + required_device m_pio1; + required_device m_cassette; + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( pio1_pa_r ); + DECLARE_WRITE8_MEMBER( pio1_pa_w ); + DECLARE_WRITE8_MEMBER( pio1_pb_w ); + DECLARE_WRITE_LINE_MEMBER( pio1_brdy_w ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); + + /* keyboard state */ + int m_keylatch; + + /* display state */ + int m_digit; + int m_pio1_a5; + int m_pio1_brdy; +}; + +#endif diff --git a/src/mame/includes/cbm2.h b/src/mame/includes/cbm2.h new file mode 100644 index 00000000000..41ba6707dc8 --- /dev/null +++ b/src/mame/includes/cbm2.h @@ -0,0 +1,329 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __P500__ +#define __P500__ + +#include "emu.h" +#include "bus/cbm2/exp.h" +#include "bus/cbm2/user.h" +#include "bus/ieee488/ieee488.h" +#include "bus/pet/cass.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m6509.h" +#include "cpu/i86/i86.h" +#include "machine/cbm_snqk.h" +#include "machine/6525tpi.h" +#include "machine/ds75160a.h" +#include "machine/ds75161a.h" +#include "machine/mos6526.h" +#include "machine/mos6551.h" +#include "machine/pic8259.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/mos6581.h" +#include "video/mc6845.h" +#include "video/mos6566.h" + +#define M6509_TAG "u13" +#define PLA1_TAG "u78" +#define PLA2_TAG "u88" +#define MOS6567_TAG "u23" +#define MOS6569_TAG "u23" +#define MC68B45_TAG "u10" +#define MOS6581_TAG "u4" +#define MOS6525_1_TAG "u20" +#define MOS6525_2_TAG "u102" +#define MOS6551A_TAG "u19" +#define MOS6526_TAG "u2" +#define DS75160A_TAG "u3" +#define DS75161A_TAG "u7" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" +#define RS232_TAG "rs232" + +#define EXT_I8088_TAG "ext_u1" +#define EXT_I8087_TAG "ext_u4" +#define EXT_I8259A_TAG "ext_u3" +#define EXT_MOS6526_TAG "ext_u15" +#define EXT_MOS6525_TAG "ext_u16" + +class cbm2_state : public driver_device +{ +public: + cbm2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M6509_TAG), + m_pla1(*this, PLA1_TAG), + m_crtc(*this, MC68B45_TAG), + m_palette(*this, "palette"), + m_sid(*this, MOS6581_TAG), + m_tpi1(*this, MOS6525_1_TAG), + m_tpi2(*this, MOS6525_2_TAG), + m_acia(*this, MOS6551A_TAG), + m_cia(*this, MOS6526_TAG), + m_ieee1(*this, DS75160A_TAG), + m_ieee2(*this, DS75161A_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, CBM2_EXPANSION_SLOT_TAG), + m_user(*this, CBM2_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_ieee(*this, IEEE488_TAG), + m_ext_cpu(*this, EXT_I8088_TAG), + m_ext_pic(*this, EXT_I8259A_TAG), + m_ext_cia(*this, EXT_MOS6526_TAG), + m_ext_tpi(*this, EXT_MOS6525_TAG), + m_basic(*this, "basic"), + m_kernal(*this, "kernal"), + m_charom(*this, "charom"), + m_buffer_ram(*this, "buffer_ram"), + m_extbuf_ram(*this, "extbuf_ram"), + m_video_ram(*this, "video_ram"), + m_pa0(*this, "PA0"), + m_pa1(*this, "PA1"), + m_pa2(*this, "PA2"), + m_pa3(*this, "PA3"), + m_pa4(*this, "PA4"), + m_pa5(*this, "PA5"), + m_pa6(*this, "PA6"), + m_pa7(*this, "PA7"), + m_pb0(*this, "PB0"), + m_pb1(*this, "PB1"), + m_pb2(*this, "PB2"), + m_pb3(*this, "PB3"), + m_pb4(*this, "PB4"), + m_pb5(*this, "PB5"), + m_pb6(*this, "PB6"), + m_pb7(*this, "PB7"), + m_lock(*this, "LOCK"), + m_dramon(1), + m_video_ram_size(0x800), + m_graphics(1), + m_todclk(0), + m_tpi1_irq(CLEAR_LINE), + m_acia_irq(CLEAR_LINE), + m_user_irq(CLEAR_LINE), + m_tpi2_pa(0), + m_tpi2_pb(0) + { } + + required_device m_maincpu; + required_device m_pla1; + optional_device m_crtc; + optional_device m_palette; + required_device m_sid; + required_device m_tpi1; + required_device m_tpi2; + required_device m_acia; + required_device m_cia; + required_device m_ieee1; + required_device m_ieee2; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + required_device m_user; + required_device m_ram; + required_device m_cassette; + required_device m_ieee; + optional_device m_ext_cpu; + optional_device m_ext_pic; + optional_device m_ext_cia; + optional_device m_ext_tpi; + required_memory_region m_basic; + required_memory_region m_kernal; + required_memory_region m_charom; + optional_shared_ptr m_buffer_ram; + optional_shared_ptr m_extbuf_ram; + optional_shared_ptr m_video_ram; + required_ioport m_pa0; + required_ioport m_pa1; + required_ioport m_pa2; + required_ioport m_pa3; + required_ioport m_pa4; + required_ioport m_pa5; + required_ioport m_pa6; + required_ioport m_pa7; + required_ioport m_pb0; + required_ioport m_pb1; + required_ioport m_pb2; + required_ioport m_pb3; + required_ioport m_pb4; + required_ioport m_pb5; + required_ioport m_pb6; + required_ioport m_pb7; + required_ioport m_lock; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + DECLARE_MACHINE_START( cbm2 ); + DECLARE_MACHINE_START( cbm2_ntsc ); + DECLARE_MACHINE_START( cbm2_pal ); + DECLARE_MACHINE_START( cbm2x_ntsc ); + DECLARE_MACHINE_START( cbm2x_pal ); + DECLARE_MACHINE_RESET( cbm2 ); + + virtual void read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4); + + void bankswitch(offs_t offset, int eras, int ecas, int refen, int cas, int ras, int *sysioen, int *dramen, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *buframcs, int *extbufcs, int *vidramcs, + int *diskromcs, int *csbank1, int *csbank2, int *csbank3, int *basiccs, int *knbcs, int *kernalcs, + int *crtccs, int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs); + + UINT8 read_keyboard(); + void set_busy2(int state); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( ext_read ); + DECLARE_WRITE8_MEMBER( ext_write ); + + DECLARE_READ8_MEMBER( sid_potx_r ); + DECLARE_READ8_MEMBER( sid_poty_r ); + + DECLARE_WRITE_LINE_MEMBER( tpi1_irq_w ); + DECLARE_READ8_MEMBER( tpi1_pa_r ); + DECLARE_WRITE8_MEMBER( tpi1_pa_w ); + DECLARE_READ8_MEMBER( tpi1_pb_r ); + DECLARE_WRITE8_MEMBER( tpi1_pb_w ); + DECLARE_WRITE_LINE_MEMBER( tpi1_ca_w ); + DECLARE_WRITE_LINE_MEMBER( tpi1_cb_w ); + + DECLARE_WRITE8_MEMBER( tpi2_pa_w ); + DECLARE_WRITE8_MEMBER( tpi2_pb_w ); + DECLARE_READ8_MEMBER( tpi2_pc_r ); + + DECLARE_READ8_MEMBER( cia_pa_r ); + DECLARE_WRITE8_MEMBER( cia_pa_w ); + DECLARE_READ8_MEMBER( cia_pb_r ); + + DECLARE_WRITE_LINE_MEMBER( tape_read_w ); + + DECLARE_READ8_MEMBER( ext_tpi_pb_r ); + DECLARE_WRITE8_MEMBER( ext_tpi_pb_w ); + DECLARE_WRITE8_MEMBER( ext_tpi_pc_w ); + + DECLARE_WRITE_LINE_MEMBER( ext_cia_irq_w ); + DECLARE_READ8_MEMBER( ext_cia_pb_r ); + DECLARE_WRITE8_MEMBER( ext_cia_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( user_irq_w ); + + MC6845_UPDATE_ROW( crtc_update_row ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbmb ); + // memory state + int m_dramon; + int m_busen1; + int m_busy2; + + // video state + size_t m_video_ram_size; + int m_graphics; + int m_ntsc; + + // interrupt state + int m_todclk; + int m_tpi1_irq; + int m_acia_irq; + int m_user_irq; + + // keyboard state; + UINT8 m_tpi2_pa; + UINT8 m_tpi2_pb; + UINT8 m_cia_pa; + + UINT8 m_ext_cia_pb; + UINT8 m_ext_tpi_pb; + + // timers + emu_timer *m_todclk_timer; +}; + + +class cbm2hp_state : public cbm2_state +{ +public: + cbm2hp_state(const machine_config &mconfig, device_type type, const char *tag) + : cbm2_state(mconfig, type, tag) + { } + + virtual void read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4); + + DECLARE_READ8_MEMBER( tpi2_pc_r ); +}; + + +class p500_state : public cbm2_state +{ +public: + p500_state(const machine_config &mconfig, device_type type, const char *tag) + : cbm2_state(mconfig, type, tag), + m_pla2(*this, PLA2_TAG), + m_vic(*this, MOS6569_TAG), + m_color_ram(*this, "color_ram"), + m_statvid(1), + m_vicdotsel(1), + m_vicbnksel(0x03), + m_vic_irq(CLEAR_LINE) + { } + + required_device m_pla2; + required_device m_vic; + optional_shared_ptr m_color_ram; + + DECLARE_MACHINE_START( p500 ); + DECLARE_MACHINE_START( p500_ntsc ); + DECLARE_MACHINE_START( p500_pal ); + DECLARE_MACHINE_RESET( p500 ); + + void read_pla1(offs_t offset, int busy2, int clrnibcsb, int procvid, int refen, int ba, int aec, int srw, + int *datxen, int *dramxen, int *clrniben, int *segf, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr); + + void read_pla2(offs_t offset, offs_t va, int ba, int vicen, int ae, int segf, int bank0, + int *clrnibcsb, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *procvid, int *viccs, int *vidmatcs); + + void bankswitch(offs_t offset, offs_t va, int srw, int ba, int ae, int busy2, int refen, + int *datxen, int *dramxen, int *clrniben, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr, + int *clrnibcs, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *viccs, int *vidmatcs, + int *csbank1, int *csbank2, int *csbank3, int *basiclocs, int *basichics, int *kernalcs, + int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs, int *aec, int *vsysaden); + + UINT8 read_memory(address_space &space, offs_t offset, offs_t va, int ba, int ae); + void write_memory(address_space &space, offs_t offset, UINT8 data, int ba, int ae); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_colorram_r ); + DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); + + DECLARE_WRITE_LINE_MEMBER( tpi1_irq_w ); + DECLARE_WRITE_LINE_MEMBER( tpi1_ca_w ); + DECLARE_WRITE_LINE_MEMBER( tpi1_cb_w ); + + DECLARE_READ8_MEMBER( tpi2_pc_r ); + DECLARE_WRITE8_MEMBER( tpi2_pc_w ); + + DECLARE_WRITE_LINE_MEMBER( user_irq_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( p500 ); + // video state + int m_statvid; + int m_vicdotsel; + int m_vicbnksel; + + // interrupt state + int m_vic_irq; +}; + + + +#endif diff --git a/src/mame/includes/cgc7900.h b/src/mame/includes/cgc7900.h new file mode 100644 index 00000000000..d5b6dc86548 --- /dev/null +++ b/src/mame/includes/cgc7900.h @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __CGC7900__ +#define __CGC7900__ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/ram.h" +#include "machine/i8251.h" +#include "sound/ay8910.h" + +#define M68000_TAG "uh8" +#define INS8251_0_TAG "uc10" +#define INS8251_1_TAG "uc8" +#define MM58167_TAG "uc6" +#define AY8910_TAG "uc4" +#define K1135A_TAG "uc11" +#define I8035_TAG "i8035" +#define AM2910_TAG "11d" +#define SCREEN_TAG "screen" + +class cgc7900_state : public driver_device +{ +public: + cgc7900_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M68000_TAG), + m_palette(*this, "palette"), + m_char_rom(*this, "gfx1"), + m_chrom_ram(*this, "chrom_ram"), + m_plane_ram(*this, "plane_ram"), + m_clut_ram(*this, "clut_ram"), + m_overlay_ram(*this, "overlay_ram"), + m_roll_bitmap(*this, "roll_bitmap"), + m_pan_x(*this, "pan_x"), + m_pan_y(*this, "pan_y"), + m_zoom(*this, "zoom"), + m_blink_select(*this, "blink_select"), + m_plane_select(*this, "plane_select"), + m_plane_switch(*this, "plane_switch"), + m_color_status_fg(*this, "color_status_fg"), + m_color_status_bg(*this, "color_status_bg"), + m_roll_overlay(*this, "roll_overlay") + { } + + required_device m_maincpu; + required_device m_palette; + required_memory_region m_char_rom; + required_shared_ptr m_chrom_ram; + required_shared_ptr m_plane_ram; + required_shared_ptr m_clut_ram; + required_shared_ptr m_overlay_ram; + required_shared_ptr m_roll_bitmap; + required_shared_ptr m_pan_x; + required_shared_ptr m_pan_y; + required_shared_ptr m_zoom; + required_shared_ptr m_blink_select; + required_shared_ptr m_plane_select; + required_shared_ptr m_plane_switch; + required_shared_ptr m_color_status_fg; + required_shared_ptr m_color_status_bg; + required_shared_ptr m_roll_overlay; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_PALETTE_INIT(cgc7900); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ16_MEMBER( keyboard_r ); + DECLARE_WRITE16_MEMBER( keyboard_w ); + DECLARE_WRITE16_MEMBER( interrupt_mask_w ); + DECLARE_READ16_MEMBER( disk_data_r ); + DECLARE_WRITE16_MEMBER( disk_data_w ); + DECLARE_READ16_MEMBER( disk_status_r ); + DECLARE_WRITE16_MEMBER( disk_command_w ); + DECLARE_READ16_MEMBER( z_mode_r ); + DECLARE_WRITE16_MEMBER( z_mode_w ); + DECLARE_WRITE16_MEMBER( color_status_w ); + DECLARE_READ16_MEMBER( sync_r ); + + void update_clut(); + void draw_bitmap(screen_device *screen, bitmap_rgb32 &bitmap); + void draw_overlay(screen_device *screen, bitmap_rgb32 &bitmap); + + /* interrupt state */ + UINT16 m_int_mask; + + /* video state */ + rgb_t m_clut[256]; + int m_blink; + + TIMER_DEVICE_CALLBACK_MEMBER(blink_tick); +}; + +/*----------- defined in video/cgc7900.c -----------*/ + +MACHINE_CONFIG_EXTERN( cgc7900_video ); + +#endif diff --git a/src/mame/includes/channelf.h b/src/mame/includes/channelf.h new file mode 100644 index 00000000000..606e0a6abfb --- /dev/null +++ b/src/mame/includes/channelf.h @@ -0,0 +1,54 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle +/***************************************************************************** + * + * includes/channelf.h + * + ****************************************************************************/ + +#ifndef CHANNELF_H_ +#define CHANNELF_H_ + +#include "emu.h" +#include "cpu/f8/f8.h" +#include "audio/channelf.h" + +#include "bus/chanf/slot.h" +#include "bus/chanf/rom.h" + + +class channelf_state : public driver_device +{ +public: + channelf_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_custom(*this,"custom"), + m_cart(*this, "cartslot") + { } + + DECLARE_READ8_MEMBER(port_0_r); + DECLARE_READ8_MEMBER(port_1_r); + DECLARE_READ8_MEMBER(port_4_r); + DECLARE_READ8_MEMBER(port_5_r); + DECLARE_WRITE8_MEMBER(port_0_w); + DECLARE_WRITE8_MEMBER(port_1_w); + DECLARE_WRITE8_MEMBER(port_4_w); + DECLARE_WRITE8_MEMBER(port_5_w); + UINT8 *m_p_videoram; + UINT8 m_latch[6]; + UINT8 m_val_reg; + UINT8 m_row_reg; + UINT8 m_col_reg; + UINT8 port_read_with_latch(UINT8 ext, UINT8 latch_state); + virtual void video_start(); + virtual void machine_start(); + DECLARE_PALETTE_INIT(channelf); + UINT32 screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + required_device m_custom; + required_device m_cart; + int recalc_palette_offset(int reg1, int reg2); +}; + +#endif /* CHANNELF_H_ */ diff --git a/src/mame/includes/coco.h b/src/mame/includes/coco.h new file mode 100644 index 00000000000..363fcff5d2a --- /dev/null +++ b/src/mame/includes/coco.h @@ -0,0 +1,269 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco.h + + TRS-80 Radio Shack Color Computer Family + +***************************************************************************/ + +#pragma once + +#ifndef __COCO__ +#define __COCO__ + + +#include "emu.h" +#include "imagedev/cassette.h" +#include "bus/rs232/rs232.h" +#include "machine/6821pia.h" +#include "bus/coco/cococart.h" +#include "machine/coco_vhd.h" +#include "bus/coco/coco_dwsock.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/wave.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +INPUT_PORTS_EXTERN( coco_analog_control ); +INPUT_PORTS_EXTERN( coco_cart_autostart ); +INPUT_PORTS_EXTERN( coco_rtc ); +INPUT_PORTS_EXTERN( coco_beckerport ); + +SLOT_INTERFACE_EXTERN( coco_cart ); + +// constants +#define JOYSTICK_DELTA 10 +#define JOYSTICK_SENSITIVITY 100 + +// devices +#define MAINCPU_TAG "maincpu" +#define PIA0_TAG "pia0" +#define PIA1_TAG "pia1" +#define SAM_TAG "sam" +#define VDG_TAG "vdg" +#define SCREEN_TAG "screen" +#define DAC_TAG "dac" +#define CARTRIDGE_TAG "ext" +#define RS232_TAG "rs232" +#define DWSOCK_TAG "dwsock" +#define VHD0_TAG "vhd0" +#define VHD1_TAG "vhd1" + +// inputs +#define CTRL_SEL_TAG "ctrl_sel" +#define HIRES_INTF_TAG "hires_intf" +#define CART_AUTOSTART_TAG "cart_autostart" +#define BECKERPORT_TAG "beckerport" +#define JOYSTICK_RX_TAG "joystick_rx" +#define JOYSTICK_RY_TAG "joystick_ry" +#define JOYSTICK_LX_TAG "joystick_lx" +#define JOYSTICK_LY_TAG "joystick_ly" +#define JOYSTICK_BUTTONS_TAG "joystick_buttons" +#define RAT_MOUSE_RX_TAG "rat_mouse_rx" +#define RAT_MOUSE_RY_TAG "rat_mouse_ry" +#define RAT_MOUSE_LX_TAG "rat_mouse_lx" +#define RAT_MOUSE_LY_TAG "rat_mouse_ly" +#define RAT_MOUSE_BUTTONS_TAG "rat_mouse_buttons" +#define DIECOM_LIGHTGUN_RX_TAG "dclg_rx" +#define DIECOM_LIGHTGUN_RY_TAG "dclg_ry" +#define DIECOM_LIGHTGUN_LX_TAG "dclg_lx" +#define DIECOM_LIGHTGUN_LY_TAG "dclg_ly" +#define DIECOM_LIGHTGUN_BUTTONS_TAG "dclg_triggers" + +MACHINE_CONFIG_EXTERN( coco_sound ); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class coco_state : public driver_device +{ +public: + coco_state(const machine_config &mconfig, device_type type, const char *tag); + + required_device m_maincpu; + required_device m_pia_0; + required_device m_pia_1; + required_device m_dac; + required_device m_wave; + required_device m_cococart; + required_device m_ram; + required_device m_cassette; + optional_device m_rs232; + optional_device m_vhd_0; + optional_device m_vhd_1; + optional_device m_beckerport; + optional_ioport m_beckerportconfig; + + // driver update handlers + DECLARE_INPUT_CHANGED_MEMBER(keyboard_changed); + DECLARE_INPUT_CHANGED_MEMBER(joystick_mode_changed); + + // IO + virtual DECLARE_READ8_MEMBER( ff00_read ); + virtual DECLARE_WRITE8_MEMBER( ff00_write ); + virtual DECLARE_READ8_MEMBER( ff20_read ); + virtual DECLARE_WRITE8_MEMBER( ff20_write ); + virtual DECLARE_READ8_MEMBER( ff40_read ); + virtual DECLARE_WRITE8_MEMBER( ff40_write ); + DECLARE_READ8_MEMBER( ff60_read ); + DECLARE_WRITE8_MEMBER( ff60_write ); + + // PIA0 + DECLARE_WRITE8_MEMBER( pia0_pa_w ); + DECLARE_WRITE8_MEMBER( pia0_pb_w ); + DECLARE_WRITE_LINE_MEMBER( pia0_ca2_w ); + DECLARE_WRITE_LINE_MEMBER( pia0_cb2_w ); + DECLARE_WRITE_LINE_MEMBER( pia0_irq_a ); + DECLARE_WRITE_LINE_MEMBER( pia0_irq_b ); + + // PIA1 + DECLARE_READ8_MEMBER( pia1_pa_r ); + DECLARE_READ8_MEMBER( pia1_pb_r ); + DECLARE_WRITE8_MEMBER( pia1_pa_w ); + DECLARE_WRITE8_MEMBER( pia1_pb_w ); + DECLARE_WRITE_LINE_MEMBER( pia1_ca2_w ); + DECLARE_WRITE_LINE_MEMBER( pia1_cb2_w ); + DECLARE_WRITE_LINE_MEMBER( pia1_firq_a ); + DECLARE_WRITE_LINE_MEMBER( pia1_firq_b ); + + // floating bus + DECLARE_READ8_MEMBER( floating_bus_read ) { return floating_bus_read(); } + + DECLARE_WRITE_LINE_MEMBER( cart_w ) { cart_w((bool) state); } +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // interrupts + virtual bool firq_get_line(void); + virtual bool irq_get_line(void); + void recalculate_irq(void); + void recalculate_firq(void); + + // changed handlers + virtual void pia1_pa_changed(UINT8 data); + virtual void pia1_pb_changed(UINT8 data); + + // miscellaneous + virtual void update_keyboard_input(UINT8 value, UINT8 z); + virtual void cart_w(bool state); + virtual void update_cart_base(UINT8 *cart_base) = 0; + +private: + // timer constants + static const device_timer_id TIMER_HIRES_JOYSTICK_X = 0; + static const device_timer_id TIMER_HIRES_JOYSTICK_Y = 1; + static const device_timer_id TIMER_DIECOM_LIGHTGUN = 2; + + enum soundmux_status_t + { + SOUNDMUX_SEL1 = 1, + SOUNDMUX_SEL2 = 2, + SOUNDMUX_ENABLE = 4 + }; + + enum joystick_type_t + { + JOYSTICK_NONE = 0x00, + JOYSTICK_NORMAL = 0x01, + JOYSTICK_RAT_MOUSE = 0x02, + JOYSTICK_DIECOM_LIGHT_GUN = 0x03 + }; + + enum hires_type_t + { + HIRES_NONE = 0x00, + HIRES_RIGHT = 0x01, + HIRES_RIGHT_COCOMAX3 = 0x02, + HIRES_LEFT = 0x03, + HIRES_LEFT_COCOMAX3 = 0x04 + }; + + struct analog_input_t + { + ioport_port *m_input[2][2]; + ioport_port *m_buttons; + + UINT8 input(int joystick, int axis) const { return m_input[joystick][axis] ? m_input[joystick][axis]->read() : 0x00; } + UINT8 buttons(void) const { return m_buttons ? m_buttons->read() : 0x00; } + }; + + void analog_port_start(analog_input_t *analog, const char *rx_tag, const char *ry_tag, const char *lx_tag, const char *ly_tag, const char *buttons_tag); + + // wrappers for configuration + joystick_type_t joystick_type(int index); + hires_type_t hires_interface_type(void); + bool is_joystick_hires(int joystick_index); + + soundmux_status_t soundmux_status(void); + void update_sound(void); + bool joyin(void); + void poll_joystick(bool *joyin, UINT8 *buttons); + void poll_keyboard(void); + void poll_hires_joystick(void); + void update_cassout(int cassout); + void update_prinout(bool prinout); + void diecom_lightgun_clock(void); + + // thin wrappers for PIA output + UINT8 dac_output(void) { return m_dac_output; } // PA drives the DAC + bool sel1(void) { return m_pia_0->ca2_output() ? true : false; } + bool sel2(void) { return m_pia_0->cb2_output() ? true : false; } + bool snden(void) { return m_pia_1->cb2_output() ? true : false; } + + // VHD selection + coco_vhd_image_device *current_vhd(void); + + // floating bus + UINT8 floating_bus_read(void); + + // disassembly override + static offs_t dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); + + // input ports + ioport_port *m_keyboard[7]; + ioport_port *m_joystick_type_control; + ioport_port *m_joystick_hires_control; + analog_input_t m_joystick; + analog_input_t m_rat_mouse; + analog_input_t m_diecom_lightgun; + + // DAC output + UINT8 m_dac_output; + + // remember the last audio sample level from the analog sources (DAC, cart, cassette) so that we don't + // introduce step changes when the audio output is enabled/disabled via PIA1 CB2 + UINT8 m_analog_audio_level; + + // hires interface + emu_timer *m_hiresjoy_transition_timer[2]; + bool m_hiresjoy_ca; + + // diecom lightgun + emu_timer *m_diecom_lightgun_timer; + bool m_dclg_previous_bit; + UINT8 m_dclg_output_h; + UINT8 m_dclg_output_v; + UINT8 m_dclg_state; + UINT16 m_dclg_timer; + + // VHD selection + UINT8 m_vhd_select; + + // safety to prevent stack overflow when reading floating bus + bool m_in_floating_bus_read; +}; + +#endif // __COCO__ diff --git a/src/mame/includes/coco12.h b/src/mame/includes/coco12.h new file mode 100644 index 00000000000..030adc35b25 --- /dev/null +++ b/src/mame/includes/coco12.h @@ -0,0 +1,67 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco12.h + + TRS-80 Radio Shack Color Computer 1/2 Family + +***************************************************************************/ + +#pragma once + +#ifndef __COCO12__ +#define __COCO12__ + + +#include "includes/coco.h" +#include "machine/6883sam.h" +#include "video/mc6847.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define SAM_TAG "sam" +#define VDG_TAG "vdg" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class coco12_state : public coco_state +{ +public: + coco12_state(const machine_config &mconfig, device_type type, const char *tag) + : coco_state(mconfig, type, tag), + m_sam(*this, SAM_TAG), + m_vdg(*this, VDG_TAG) + { + } + + + required_device m_sam; + required_device m_vdg; + + DECLARE_READ8_MEMBER( sam_read ); + + DECLARE_WRITE_LINE_MEMBER( horizontal_sync ); + DECLARE_WRITE_LINE_MEMBER( field_sync ); +protected: + virtual void device_start(); + virtual void update_cart_base(UINT8 *cart_base); + + /* PIA1 */ + virtual void pia1_pb_changed(UINT8 data); + +private: + + void configure_sam(void); +}; + + +#endif /* __COCO12__ */ diff --git a/src/mame/includes/coco3.h b/src/mame/includes/coco3.h new file mode 100644 index 00000000000..8ac863fa6b3 --- /dev/null +++ b/src/mame/includes/coco3.h @@ -0,0 +1,67 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco3.h + + TRS-80 Radio Shack Color Computer 1/2 Family + +***************************************************************************/ + +#pragma once + +#ifndef __COCO3__ +#define __COCO3__ + + +#include "includes/coco.h" +#include "video/gime.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define GIME_TAG "gime" +#define VDG_TAG "vdg" +#define COMPOSITE_SCREEN_TAG "composite" +#define RGB_SCREEN_TAG "rgb" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class coco3_state : public coco_state +{ +public: + coco3_state(const machine_config &mconfig, device_type type, const char *tag) + : coco_state(mconfig, type, tag), + m_gime(*this, GIME_TAG) { } + + required_device m_gime; + + virtual DECLARE_WRITE8_MEMBER( ff20_write ); + virtual DECLARE_READ8_MEMBER( ff40_read ); + virtual DECLARE_WRITE8_MEMBER( ff40_write ); + + DECLARE_WRITE_LINE_MEMBER(gime_firq_w) { recalculate_firq(); } + DECLARE_WRITE_LINE_MEMBER(gime_irq_w) { recalculate_irq(); } + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +protected: + virtual void update_cart_base(UINT8 *cart_base); + + /* interrupts */ + virtual bool firq_get_line(void); + virtual bool irq_get_line(void); + + /* miscellaneous */ + virtual void update_keyboard_input(UINT8 value, UINT8 z); + virtual void cart_w(bool line); +}; + +#endif // __COCO3__ diff --git a/src/mame/includes/coleco.h b/src/mame/includes/coleco.h new file mode 100644 index 00000000000..ab6e1379663 --- /dev/null +++ b/src/mame/includes/coleco.h @@ -0,0 +1,99 @@ +// license:BSD-3-Clause +// copyright-holders:Mike Balfour, Ben Bruscella, Sean Young +#pragma once + +#ifndef __COLECO__ +#define __COLECO__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/sn76496.h" +#include "video/tms9928a.h" +#include "machine/coleco.h" +#include "bus/coleco/exp.h" + +class coleco_state : public driver_device +{ +public: + coleco_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cart(*this, COLECOVISION_CARTRIDGE_SLOT_TAG), + m_ram(*this, "ram"), + m_ctrlsel(*this, "CTRLSEL"), + m_std_keypad1(*this, "STD_KEYPAD1"), + m_std_joy1(*this, "STD_JOY1"), + m_std_keypad2(*this, "STD_KEYPAD2"), + m_std_joy2(*this, "STD_JOY2"), + m_sac_keypad1(*this, "SAC_KEYPAD1"), + m_sac_joy1(*this, "SAC_JOY1"), + m_sac_slide1(*this, "SAC_SLIDE1"), + m_sac_keypad2(*this, "SAC_KEYPAD2"), + m_sac_joy2(*this, "SAC_JOY2"), + m_sac_slide2(*this, "SAC_SLIDE2"), + m_driv_wheel1(*this, "DRIV_WHEEL1"), + m_driv_pedal1(*this, "DRIV_PEDAL1"), + m_driv_wheel2(*this, "DRIV_WHEEL2"), + m_driv_pedal2(*this, "DRIV_PEDAL2"), + m_roller_x(*this, "ROLLER_X"), + m_roller_y(*this, "ROLLER_Y") + { } + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( cart_r ); + DECLARE_READ8_MEMBER( paddle_1_r ); + DECLARE_READ8_MEMBER( paddle_2_r ); + DECLARE_WRITE8_MEMBER( paddle_off_w ); + DECLARE_WRITE8_MEMBER( paddle_on_w ); + + TIMER_CALLBACK_MEMBER(paddle_d7reset_callback); + TIMER_CALLBACK_MEMBER(paddle_irqreset_callback); + TIMER_CALLBACK_MEMBER(paddle_pulse_callback); + TIMER_DEVICE_CALLBACK_MEMBER(paddle_update_callback); + DECLARE_WRITE_LINE_MEMBER(coleco_vdp_interrupt); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(czz50_cart); + + UINT8 coleco_paddle_read(int port, int joy_mode, UINT8 joy_status); + UINT8 coleco_scan_paddles(UINT8 *joy_status0, UINT8 *joy_status1); + +private: + required_device m_maincpu; + required_device m_cart; + required_shared_ptr m_ram; + + int m_joy_mode; + int m_last_nmi_state; + + // analog controls + attotime m_joy_pulse_reload[2]; + emu_timer *m_joy_pulse_timer[2]; + emu_timer *m_joy_irq_timer[2]; + emu_timer *m_joy_d7_timer[2]; + int m_joy_irq_state[2]; + int m_joy_d7_state[2]; + UINT8 m_joy_analog_state[2]; + UINT8 m_joy_analog_reload[2]; + + optional_ioport m_ctrlsel; + required_ioport m_std_keypad1; + required_ioport m_std_joy1; + required_ioport m_std_keypad2; + required_ioport m_std_joy2; + optional_ioport m_sac_keypad1; + optional_ioport m_sac_joy1; + optional_ioport m_sac_slide1; + optional_ioport m_sac_keypad2; + optional_ioport m_sac_joy2; + optional_ioport m_sac_slide2; + optional_ioport m_driv_wheel1; + optional_ioport m_driv_pedal1; + optional_ioport m_driv_wheel2; + optional_ioport m_driv_pedal2; + optional_ioport m_roller_x; + optional_ioport m_roller_y; +}; + +#endif diff --git a/src/mame/includes/compis.h b/src/mame/includes/compis.h new file mode 100644 index 00000000000..fbb562b4b90 --- /dev/null +++ b/src/mame/includes/compis.h @@ -0,0 +1,135 @@ +// license:??? +// copyright-holders:Per Ola Ingvarsson, Tomas Karlsson +/***************************************************************************** + * + * includes/compis.h + * + * machine driver header + * + * Per Ola Ingvarsson + * Tomas Karlsson + * + ****************************************************************************/ + +#pragma once + +#ifndef __COMPIS__ +#define __COMPIS__ + +#include "emu.h" +#include "bus/isbx/isbx.h" +#include "cpu/i86/i186.h" +#include "cpu/mcs48/mcs48.h" +#include "imagedev/cassette.h" +#include "machine/compiskb.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8251.h" +#include "machine/i8255.h" +#include "machine/i80130.h" +#include "machine/mm58274c.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "machine/z80dart.h" +#include "video/upd7220.h" + +#define I80186_TAG "ic1" +#define I80130_TAG "ic15" +#define I8251A_TAG "ic59" +#define I8253_TAG "ic60" +#define I8274_TAG "ic65" +#define MM58174A_TAG "ic66" +#define I8255_TAG "ic69" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" +#define CASSETTE_TAG "cassette" +#define CENTRONICS_TAG "centronics" +#define ISBX_0_TAG "isbx0" +#define ISBX_1_TAG "isbx1" +#define SCREEN_TAG "screen" +#define COMPIS_KEYBOARD_TAG "compiskb" + +class compis_state : public driver_device +{ +public: + compis_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I80186_TAG), + m_osp(*this, I80130_TAG), + m_pit(*this, I8253_TAG), + m_ppi(*this, I8255_TAG), + m_mpsc(*this, I8274_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_uart(*this, I8251A_TAG), + m_rtc(*this, MM58174A_TAG), + m_crtc(*this, "upd7220"), + m_palette(*this, "palette"), + m_cassette(*this, CASSETTE_TAG), + m_isbx0(*this, ISBX_0_TAG), + m_isbx1(*this, ISBX_1_TAG), + m_ram(*this, RAM_TAG), + m_video_ram(*this, "video_ram"), + m_s8(*this, "S8") + { } + + required_device m_maincpu; + required_device m_osp; + required_device m_pit; + required_device m_ppi; + required_device m_mpsc; + required_device m_centronics; + required_device m_uart; + required_device m_rtc; + required_device m_crtc; + required_device m_palette; + required_device m_cassette; + required_device m_isbx0; + required_device m_isbx1; + required_device m_ram; + required_shared_ptr m_video_ram; + required_ioport m_s8; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( tape_mon_w ); + DECLARE_READ16_MEMBER( isbx0_tdma_r ); + DECLARE_WRITE16_MEMBER( isbx0_tdma_w ); + DECLARE_READ16_MEMBER( isbx1_tdma_r ); + DECLARE_WRITE16_MEMBER( isbx1_tdma_w ); + DECLARE_READ16_MEMBER( isbx0_cs_r ); + DECLARE_WRITE16_MEMBER( isbx0_cs_w ); + DECLARE_READ16_MEMBER( isbx0_dack_r ); + DECLARE_WRITE16_MEMBER( isbx0_dack_w ); + DECLARE_READ16_MEMBER( isbx1_cs_r ); + DECLARE_WRITE16_MEMBER( isbx1_cs_w ); + DECLARE_READ16_MEMBER( isbx1_dack_r ); + DECLARE_WRITE16_MEMBER( isbx1_dack_w ); + + DECLARE_READ8_MEMBER( compis_irq_callback ); + + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + + DECLARE_WRITE_LINE_MEMBER( tmr0_w ); + DECLARE_WRITE_LINE_MEMBER( tmr1_w ); + DECLARE_WRITE_LINE_MEMBER( tmr2_w ); + DECLARE_WRITE_LINE_MEMBER( tmr5_w ); + + TIMER_DEVICE_CALLBACK_MEMBER( tape_tick ); + + int m_centronics_busy; + int m_centronics_select; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_select); + + int m_tmr0; + int m_unk_video; + + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); +}; + + + +#endif diff --git a/src/mame/includes/comquest.h b/src/mame/includes/comquest.h new file mode 100644 index 00000000000..5b36a3efefe --- /dev/null +++ b/src/mame/includes/comquest.h @@ -0,0 +1,34 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/comquest.h + * + ****************************************************************************/ + +#ifndef COMQUEST_H_ +#define COMQUEST_H_ + + +class comquest_state : public driver_device +{ +public: + comquest_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") { } + + UINT8 m_data[128][8]; + void *m_timer; + int m_line; + int m_dma_activ; + int m_state; + int m_count; + DECLARE_READ8_MEMBER(comquest_read); + DECLARE_WRITE8_MEMBER(comquest_write); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_comquest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + +#endif /* COMQUEST_H_ */ diff --git a/src/mame/includes/comx35.h b/src/mame/includes/comx35.h new file mode 100644 index 00000000000..93bc60a84e8 --- /dev/null +++ b/src/mame/includes/comx35.h @@ -0,0 +1,106 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __COMX35__ +#define __COMX35__ + +#include "emu.h" +#include "bus/comx35/exp.h" +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "imagedev/printer.h" +#include "imagedev/snapquik.h" +#include "machine/cdp1871.h" +#include "machine/ram.h" +#include "machine/rescap.h" +#include "sound/cdp1869.h" +#include "sound/wave.h" + +#define SCREEN_TAG "screen" + +#define CDP1870_TAG "u1" +#define CDP1869_TAG "u2" +#define CDP1802_TAG "u3" +#define CDP1871_TAG "u4" +#define EXPANSION_TAG "exp" + +#define COMX35_CHARRAM_SIZE 0x800 +#define COMX35_CHARRAM_MASK 0x7ff + +class comx35_state : public driver_device +{ +public: + comx35_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_vis(*this, CDP1869_TAG), + m_kbe(*this, CDP1871_TAG), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_exp(*this, EXPANSION_TAG), + m_rom(*this, CDP1802_TAG), + m_char_ram(*this, "char_ram"), + m_d6(*this, "D6"), + m_modifiers(*this, "MODIFIERS") + { } + + required_device m_maincpu; + required_device m_vis; + required_device m_kbe; + required_device m_cassette; + required_device m_ram; + required_device m_exp; + required_memory_region m_rom; + optional_shared_ptr m_char_ram; + required_ioport m_d6; + required_ioport m_modifiers; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + + enum + { + TIMER_ID_RESET + }; + + void check_interrupt(); + + DECLARE_READ8_MEMBER( mem_r ); + DECLARE_WRITE8_MEMBER( mem_w ); + DECLARE_READ8_MEMBER( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + DECLARE_WRITE8_MEMBER( cdp1869_w ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef4_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_WRITE8_MEMBER( sc_w ); + DECLARE_WRITE_LINE_MEMBER( irq_w ); + DECLARE_WRITE_LINE_MEMBER( prd_w ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + DECLARE_QUICKLOAD_LOAD_MEMBER( comx35_comx ); + void image_fread_memory(device_image_interface &image, UINT16 addr, UINT32 count); + CDP1869_CHAR_RAM_READ_MEMBER(comx35_charram_r); + CDP1869_CHAR_RAM_WRITE_MEMBER(comx35_charram_w); + CDP1869_PCB_READ_MEMBER(comx35_pcb_r); + + // processor state + int m_clear; // CPU mode + int m_q; // Q flag + int m_iden; // interrupt/DMA enable + int m_dma; // memory refresh DMA + int m_int; // interrupt request + int m_prd; // predisplay + int m_cr1; // interrupt enable +}; + +// ---------- defined in video/comx35.c ---------- + +MACHINE_CONFIG_EXTERN( comx35_pal_video ); +MACHINE_CONFIG_EXTERN( comx35_ntsc_video ); + +#endif diff --git a/src/mame/includes/concept.h b/src/mame/includes/concept.h new file mode 100644 index 00000000000..c9759c893a8 --- /dev/null +++ b/src/mame/includes/concept.h @@ -0,0 +1,71 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet, Brett Wyer +/***************************************************************************** + * + * includes/concept.h + * + * Corvus Concept driver + * + * Raphael Nabet, 2003 + * + ****************************************************************************/ + +#ifndef CONCEPT_H_ +#define CONCEPT_H_ + +#include "cpu/m68000/m68000.h" +#include "machine/6522via.h" +#include "machine/mos6551.h" +#include "machine/mm58274c.h" /* mm58274 seems to be compatible with mm58174 */ +#include "sound/speaker.h" +#include "bus/a2bus/a2bus.h" + +#define ACIA_0_TAG "acia0" +#define ACIA_1_TAG "acia1" +#define KBD_ACIA_TAG "kbacia" +#define SPEAKER_TAG "spkr" +#define A2BUS_TAG "a2bus" + +class concept_state : public driver_device +{ +public: + concept_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_acia0(*this, ACIA_0_TAG), + m_acia1(*this, ACIA_1_TAG), + m_kbdacia(*this, KBD_ACIA_TAG), + m_speaker(*this, SPEAKER_TAG), + m_mm58274(*this,"mm58274c"), + m_a2bus(*this, A2BUS_TAG), + m_videoram(*this,"videoram") { } + + required_device m_maincpu; + required_device m_acia0; + required_device m_acia1; + required_device m_kbdacia; + required_device m_speaker; + required_device m_mm58274; + required_device m_a2bus; + required_shared_ptr m_videoram; + + UINT8 m_pending_interrupts; + bool m_clock_enable; + UINT8 m_clock_address; + DECLARE_READ16_MEMBER(concept_io_r); + DECLARE_WRITE16_MEMBER(concept_io_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_concept(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER(via_in_a); + DECLARE_WRITE8_MEMBER(via_out_a); + DECLARE_READ8_MEMBER(via_in_b); + DECLARE_WRITE8_MEMBER(via_out_b); + DECLARE_WRITE_LINE_MEMBER(via_out_cb2); + DECLARE_WRITE_LINE_MEMBER(via_irq_func); + void concept_set_interrupt(int level, int state); +}; + +#endif /* CONCEPT_H_ */ diff --git a/src/mame/includes/cosmicos.h b/src/mame/includes/cosmicos.h new file mode 100644 index 00000000000..9941d4b732f --- /dev/null +++ b/src/mame/includes/cosmicos.h @@ -0,0 +1,147 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __COSMICOS__ +#define __COSMICOS__ + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "imagedev/snapquik.h" +#include "machine/rescap.h" +#include "sound/cdp1864.h" +#include "sound/speaker.h" +#include "video/dm9368.h" + +#define CDP1802_TAG "ic19" +#define CDP1864_TAG "ic3" +#define DM9368_TAG "ic10" +#define SCREEN_TAG "screen" + +enum +{ + LED_RUN = 0, + LED_LOAD, + LED_PAUSE, + LED_RESET, + LED_D7, + LED_D6, + LED_D5, + LED_D4, + LED_D3, + LED_D2, + LED_D1, + LED_D0, + LED_Q, + LED_CASSETTE +}; + +class cosmicos_state : public driver_device +{ +public: + cosmicos_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_cti(*this, CDP1864_TAG), + m_led(*this, DM9368_TAG), + m_cassette(*this, "cassette"), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG), + m_rom(*this, CDP1802_TAG), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_io_data(*this, "DATA"), + m_special(*this, "SPECIAL"), + m_buttons(*this, "BUTTONS") + { } + + required_device m_maincpu; + required_device m_cti; + required_device m_led; + required_device m_cassette; + required_device m_speaker; + required_device m_ram; + required_memory_region m_rom; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_io_data; + required_ioport m_special; + required_ioport m_buttons; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( video_off_r ); + DECLARE_READ8_MEMBER( video_on_r ); + DECLARE_WRITE8_MEMBER( audio_latch_w ); + DECLARE_READ8_MEMBER( hex_keyboard_r ); + DECLARE_WRITE8_MEMBER( hex_keylatch_w ); + DECLARE_READ8_MEMBER( reset_counter_r ); + DECLARE_WRITE8_MEMBER( segment_w ); + DECLARE_READ8_MEMBER( data_r ); + DECLARE_WRITE8_MEMBER( display_w ); + DECLARE_WRITE_LINE_MEMBER( dmaout_w ); + DECLARE_WRITE_LINE_MEMBER( efx_w ); + DECLARE_READ_LINE_MEMBER( wait_r ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef1_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_READ_LINE_MEMBER( ef4_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_READ8_MEMBER( dma_r ); + DECLARE_WRITE8_MEMBER( sc_w ); + DECLARE_INPUT_CHANGED_MEMBER( data ); + DECLARE_INPUT_CHANGED_MEMBER( enter ); + DECLARE_INPUT_CHANGED_MEMBER( single_step ); + DECLARE_INPUT_CHANGED_MEMBER( run ); + DECLARE_INPUT_CHANGED_MEMBER( load ); + DECLARE_INPUT_CHANGED_MEMBER( cosmicos_pause ); + DECLARE_INPUT_CHANGED_MEMBER( reset ); + DECLARE_INPUT_CHANGED_MEMBER( clear_data ); + DECLARE_INPUT_CHANGED_MEMBER( memory_protect ); + DECLARE_INPUT_CHANGED_MEMBER( memory_disable ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cosmicos ); + + void set_cdp1802_mode(int mode); + void clear_input_data(); + + /* CPU state */ + int m_wait; + int m_clear; + int m_sc1; + + /* memory state */ + UINT8 m_data; + int m_boot; + int m_ram_protect; + int m_ram_disable; + + /* keyboard state */ + ioport_port* m_key_row[4]; + UINT8 m_keylatch; + + /* display state */ + UINT8 m_segment; + int m_digit; + int m_counter; + int m_q; + int m_dmaout; + int m_efx; + int m_video_on; + + DECLARE_DRIVER_INIT(cosmicos); + TIMER_DEVICE_CALLBACK_MEMBER(digit_tick); + TIMER_DEVICE_CALLBACK_MEMBER(int_tick); +}; + +#endif diff --git a/src/mame/includes/crvision.h b/src/mame/includes/crvision.h new file mode 100644 index 00000000000..0956119c4c7 --- /dev/null +++ b/src/mame/includes/crvision.h @@ -0,0 +1,114 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Curt Coder + +#ifndef __CRVISION__ +#define __CRVISION__ + + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "imagedev/cassette.h" +#include "machine/6821pia.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "bus/crvision/slot.h" +#include "bus/crvision/rom.h" +#include "machine/ram.h" +#include "sound/sn76496.h" +#include "sound/wave.h" +#include "video/tms9928a.h" + +#define SCREEN_TAG "screen" +#define M6502_TAG "u2" +#define TMS9929_TAG "u3" +#define PIA6821_TAG "u21" +#define SN76489_TAG "u22" +#define CENTRONICS_TAG "centronics" + +#define BANK_ROM1 "bank1" +#define BANK_ROM2 "bank2" + +class crvision_state : public driver_device +{ +public: + crvision_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M6502_TAG), + m_pia(*this, PIA6821_TAG), + m_psg(*this, SN76489_TAG), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_cent_data_out(*this, "cent_data_out"), + m_ram(*this, RAM_TAG), + m_inp_pa0(*this, "PA0"), + m_inp_pa1(*this, "PA1"), + m_inp_pa2(*this, "PA2"), + m_inp_pa3(*this, "PA3") + { } + + required_device m_maincpu; + required_device m_pia; + required_device m_psg; + required_device m_cassette; + required_device m_cart; + required_device m_cent_data_out; + required_device m_ram; + optional_ioport_array<8> m_inp_pa0; + optional_ioport_array<8> m_inp_pa1; + optional_ioport_array<8> m_inp_pa2; + optional_ioport_array<8> m_inp_pa3; + + UINT8 m_keylatch; + UINT8 read_keyboard(int pa); + + DECLARE_WRITE8_MEMBER( pia_pa_w ); + DECLARE_READ8_MEMBER( pia_pa_r ); + DECLARE_READ8_MEMBER( pia_pb_r ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); + +protected: + virtual void machine_start(); +}; + +class crvision_pal_state : public crvision_state +{ +public: + crvision_pal_state(const machine_config &mconfig, device_type type, const char *tag) + : crvision_state(mconfig, type, tag) + { } +}; + +class laser2001_state : public crvision_state +{ +public: + laser2001_state(const machine_config &mconfig, device_type type, const char *tag) + : crvision_state(mconfig, type, tag), + m_centronics(*this, CENTRONICS_TAG), + m_inp_y(*this, "Y"), + m_inp_joy(*this, "JOY") + { } + + required_device m_centronics; + required_ioport_array<8> m_inp_y; + required_ioport_array<4> m_inp_joy; + + UINT8 m_joylatch; + int m_centronics_busy; + int m_psg_ready; + + DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); + DECLARE_WRITE_LINE_MEMBER( write_psg_ready ); + DECLARE_READ8_MEMBER( pia_pa_r ); + DECLARE_WRITE8_MEMBER( pia_pa_w ); + DECLARE_READ8_MEMBER( pia_pb_r ); + DECLARE_WRITE8_MEMBER( pia_pb_w ); + DECLARE_READ_LINE_MEMBER( pia_ca1_r ); + DECLARE_WRITE_LINE_MEMBER( pia_ca2_w ); + DECLARE_READ_LINE_MEMBER( pia_cb1_r ); + DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); + +protected: + virtual void machine_start(); +}; + +#endif // __CRVISION__ diff --git a/src/mame/includes/cxhumax.h b/src/mame/includes/cxhumax.h new file mode 100644 index 00000000000..1fd1e4d7568 --- /dev/null +++ b/src/mame/includes/cxhumax.h @@ -0,0 +1,281 @@ +// license:BSD-3-Clause +// copyright-holders:Lukasz Markowski +#ifndef CXHUMAX_H_ +#define CXHUMAX_H_ + +#include "cpu/arm7/arm7.h" +#include "cpu/arm7/arm7core.h" +#include "machine/intelfsh.h" +#include "machine/i2cmem.h" +#include "machine/terminal.h" + +#define MAX_CX_TIMERS 16 + +struct cx_timer_t +{ + UINT32 value; + UINT32 limit; + UINT32 mode; + UINT32 timebase; + emu_timer *timer; +}; + +struct cx_timer_regs_t +{ + cx_timer_t timer[MAX_CX_TIMERS]; + UINT32 timer_irq; +}; + +#define TERMINAL_TAG "terminal" + +class cxhumax_state : public driver_device +{ +public: + cxhumax_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_flash(*this, "flash"), + m_ram(*this, "ram"), + m_terminal(*this, TERMINAL_TAG), + m_i2cmem(*this, "eeprom") + { + } + + required_device m_maincpu; + required_device m_flash; + required_shared_ptr m_ram; + required_device m_terminal; + + DECLARE_WRITE32_MEMBER ( flash_w ); + DECLARE_READ32_MEMBER ( flash_r ); + + DECLARE_WRITE32_MEMBER ( cx_hsx_w ); + DECLARE_READ32_MEMBER ( cx_hsx_r ); + + DECLARE_WRITE32_MEMBER ( cx_romdescr_w ); + DECLARE_READ32_MEMBER ( cx_romdescr_r ); + DECLARE_WRITE32_MEMBER ( cx_isaromdescr_w ); + DECLARE_READ32_MEMBER ( cx_isaromdescr_r ); + DECLARE_WRITE32_MEMBER ( cx_isadescr_w ); + DECLARE_READ32_MEMBER ( cx_isadescr_r ); + DECLARE_WRITE32_MEMBER ( cx_rommap_w ); + DECLARE_READ32_MEMBER ( cx_rommap_r ); + DECLARE_WRITE32_MEMBER ( cx_rommode_w ); + DECLARE_READ32_MEMBER ( cx_rommode_r ); + DECLARE_WRITE32_MEMBER ( cx_xoemask_w ); + DECLARE_READ32_MEMBER ( cx_xoemask_r ); + DECLARE_WRITE32_MEMBER ( cx_pci_w ); + DECLARE_READ32_MEMBER ( cx_pci_r ); + DECLARE_WRITE32_MEMBER ( cx_extdesc_w ); + DECLARE_READ32_MEMBER ( cx_extdesc_r ); + + DECLARE_WRITE32_MEMBER ( cx_remap_w ); + DECLARE_WRITE32_MEMBER ( cx_scratch_w ); + DECLARE_READ32_MEMBER ( cx_scratch_r ); + + DECLARE_WRITE32_MEMBER ( cx_timers_w ); + DECLARE_READ32_MEMBER ( cx_timers_r ); + + DECLARE_WRITE32_MEMBER ( cx_uart2_w ); + DECLARE_READ32_MEMBER ( cx_uart2_r ); + + DECLARE_WRITE32_MEMBER ( cx_pll_w ); + DECLARE_READ32_MEMBER ( cx_pll_r ); + DECLARE_WRITE32_MEMBER ( cx_clkdiv_w ); + DECLARE_READ32_MEMBER ( cx_clkdiv_r ); + DECLARE_WRITE32_MEMBER ( cx_pllprescale_w ); + DECLARE_READ32_MEMBER ( cx_pllprescale_r ); + + DECLARE_WRITE32_MEMBER ( cx_chipcontrol_w ); + DECLARE_READ32_MEMBER ( cx_chipcontrol_r ); + + DECLARE_WRITE32_MEMBER ( cx_intctrl_w ); + DECLARE_READ32_MEMBER ( cx_intctrl_r ); + + DECLARE_WRITE32_MEMBER ( cx_ss_w ); + DECLARE_READ32_MEMBER ( cx_ss_r ); + + DECLARE_WRITE32_MEMBER ( cx_i2c0_w ); + DECLARE_READ32_MEMBER ( cx_i2c0_r ); + DECLARE_WRITE32_MEMBER ( cx_i2c1_w ); + DECLARE_READ32_MEMBER ( cx_i2c1_r ); + DECLARE_WRITE32_MEMBER ( cx_i2c2_w ); + DECLARE_READ32_MEMBER ( cx_i2c2_r ); + + DECLARE_WRITE32_MEMBER ( cx_mc_cfg_w ); + DECLARE_READ32_MEMBER ( cx_mc_cfg_r ); + + DECLARE_WRITE32_MEMBER ( cx_drm0_w ); + DECLARE_READ32_MEMBER ( cx_drm0_r ); + DECLARE_WRITE32_MEMBER ( cx_drm1_w ); + DECLARE_READ32_MEMBER ( cx_drm1_r ); + + DECLARE_WRITE32_MEMBER ( cx_hdmi_w ); + DECLARE_READ32_MEMBER ( cx_hdmi_r ); + + DECLARE_WRITE32_MEMBER ( cx_gxa_w ); + DECLARE_READ32_MEMBER ( cx_gxa_r ); + + DECLARE_READ32_MEMBER ( dummy_flash_r ); + + UINT32 m_romdescr_reg; + UINT32 m_isaromdescr_regs[0x0C/4]; + UINT32 m_isadescr_regs[0x10/4]; + UINT32 m_rommode_reg; + UINT32 m_xoemask_reg; + UINT32 m_pci_regs[0x08/4]; + UINT32 m_extdesc_regs[0x80/4]; + + UINT32 m_scratch_reg; + cx_timer_regs_t m_timer_regs; + + UINT32 m_uart2_regs[0x30/4]; + + UINT32 m_pll_regs[0x14/4]; + UINT32 m_clkdiv_regs[0x18/4]; + UINT32 m_pllprescale_reg; + + UINT32 m_intctrl_regs[0x38/4]; + + UINT32 m_ss_regs[0x18/4]; + UINT8 m_ss_tx_fifo[8]; // 8 entries (size hardcoded to 8 bits per entry - TODO) + + UINT32 m_i2c0_regs[0x20/4]; + UINT32 m_i2c1_regs[0x20/4]; + required_device m_i2cmem; + UINT32 m_i2c2_regs[0x20/4]; + + void i2cmem_start(); + void i2cmem_stop(); + UINT8 i2cmem_read_byte(int last); + void i2cmem_write_byte(UINT8 data); + + UINT32 m_mccfg_regs[0x0C/4]; + + UINT32 m_chipcontrol_regs[0x74/4]; + + UINT32 m_drm0_regs[0xfc/4]; + UINT32 m_drm1_regs[0xfc/4]; + + UINT32 m_hdmi_regs[0x400/4]; + + UINT32 m_gxa_cmd_regs[0x130/4]; + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_cxhumax(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(timer_tick); +}; + +#define INTDEST 0 // Interrupt destination (1=IRQ, 0=FIQ) +#define INTENABLE 1 // Enables the interrupt generation +#define INTIRQ 2 // Normal interrupt +#define INTFIQ 3 // Fast interrupt +#define INTSTATCLR 4 // Read: interrupt status, Write: clear pending interrupt +#define INTSTATSET 5 // Read: interrupt status, Write: sets a pending interrupt +#define INTGROUP1 0 +#define INTGROUP2 1 + +#define INTREG(group, index) (((group) << 3) | (index)) + +#define GXA_CMD_RW_REGISTER 0x00 +#define GXA_CMD_QMARK 0x02 +#define GXA_CMD_PALETTE_FETCH 0x03 +#define GXA_CMD_VFILTER_COEFF_FETCH 0x04 +#define GXA_CMD_HFILTER_COEFF_FETCH 0x05 +#define GXA_CMD_BLT_21 0x21 +#define GXA_CMD_BLT_23 0x23 +#define GXA_CMD_BLT_25 0x25 +#define GXA_CMD_BLT_27 0x27 +#define GXA_CMD_BLT_2B 0x2b +#define GXA_CMD_BLT_2F 0x2f +#define GXA_CMD_LINE_30 0x30 +#define GXA_CMD_LINE_32 0x32 +#define GXA_CMD_BLT_31 0x31 +#define GXA_CMD_BLT 0x33 +#define GXA_CMD_LINE_34 0x34 +#define GXA_CMD_LINE_36 0x36 +#define GXA_CMD_BLT_35 0x35 +#define GXA_CMD_BLT_37 0x37 +#define GXA_CMD_LINE_3A 0x3a +#define GXA_CMD_BLT_3B 0x3b +#define GXA_CMD_LINE_3E 0x3e +#define GXA_CMD_BLT_3F 0x3f +#define GXA_CMD_SBLT_ABLEND 0x71 +#define GXA_CMD_SBLT_ROP 0x7b + +#define GXA_CMD_REG 0x07 + +#define GXA_CFG2_REG 0x3f +#define IRQ_STAT_QMARK 21 +#define IRQ_EN_QMARK 17 + +#define INT_UART2_BIT (1<<1) +#define INT_TIMER_BIT (1<<7) +#define INT_PWM_BIT (1 << 14) +#define INT_PIO103_BIT (1 << 15) + +#define PCI_CFG_ADDR_REG 0 +#define PCI_CFG_DATA_REG 1 + +#define TIMER_VALUE 0 +#define TIMER_LIMIT 1 +#define TIMER_MODE 2 +#define TIMER_TIMEBASE 3 + +#define UART_FIFO_REG 0 +#define UART_IRQE_REG 1 +#define UART_IRQE_TIDE_BIT (1<<6) +#define UART_BRDL_REG 0 +#define UART_BRDU_REG 1 +#define UART_FIFC_REG 2 +#define UART_FRMC_REG 3 +#define UART_FRMC_BDS_BIT (1<<7) +#define UART_STAT_REG 5 +#define UART_STAT_TSR_BIT (1<<5) +#define UART_STAT_TID_BIT (1<<6) + +#define SREG_MPG_0_INTFRAC_REG 0 +#define SREG_MPG_1_INTFRAC_REG 1 +#define SREG_ARM_INTFRAC_REG 2 +#define SREG_MEM_INTFRAC_REG 3 +#define SREG_USB_INTFRAC_REG 4 + +#define SREG_DIV_0_REG 0 +#define SREG_DIV_1_REG 1 +#define SREG_DIV_2_REG 2 +#define SREG_DIV_3_REG 3 +#define SREG_DIV_4_REG 4 +#define SREG_DIV_5_REG 5 + +#define PIN_CONFIG_0_REG 0 // Pin Configuration 0 Register +#define SREG_MODE_REG 3 // SREG Mode Register +#define PIN_ALT_FUNC_REG 4 // Alternate Pin Function Select Register +#define PLL_LOCK_STAT_0_REG 9 // Resource Lock Register +#define PLL_IO_CTL_REG 20 // IO Control Register +#define SREG_TEST_REG 28 // Test Register + +#define I2C_MODE_REG 0 +#define I2C_CTRL_REG 1 +#define I2C_STAT_REG 2 +#define I2C_RDATA_REG 3 + +#define I2C_WACK_BIT (1<<1) +#define I2C_INT_BIT (1<<0) + +#define SS_CNTL_REG 0 +#define SS_FIFC_REG 1 +#define SS_BAUD_REG 2 +#define SS_FIFO_REG 4 +#define SS_STAT_REG 5 + +#define MC_CFG0 0 +#define MC_CFG1 1 +#define MC_CFG2 2 + +#define DRM_ACTIVE_X_REG 1 +#define DRM_ACTIVE_Y_REG 2 +#define DRM_BCKGND_REG 3 +#define DRM_OSD_PTR_REG 32 + +#endif /* CXHUMAX_H_ */ diff --git a/src/mame/includes/cybiko.h b/src/mame/includes/cybiko.h new file mode 100644 index 00000000000..7bf4e0834de --- /dev/null +++ b/src/mame/includes/cybiko.h @@ -0,0 +1,106 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/***************************************************************************** + * + * includes/cybiko.h + * + * Cybiko Wireless Inter-tainment System + * + * (c) 2001-2007 Tim Schuerewegen + * + * Cybiko Classic (V1) + * Cybiko Classic (V2) + * Cybiko Xtreme + * + ****************************************************************************/ + +#ifndef CYBIKO_H_ +#define CYBIKO_H_ + +/* Core includes */ +#include "emu.h" +#include "emuopts.h" +#include "sound/speaker.h" + +/* Components */ +#include "cpu/h8/h8s2320.h" +#include "cpu/h8/h8s2245.h" +#include "video/hd66421.h" +#include "machine/pcf8593.h" +#include "machine/at45dbxx.h" +#include "machine/intelfsh.h" +#include "machine/ram.h" +#include "imagedev/snapquik.h" +#include "machine/nvram.h" + +struct CYBIKO_RS232_PINS +{ + int sck; // serial clock + int txd; // transmit data + int rxd; // receive data +}; + +struct CYBIKO_RS232 +{ + CYBIKO_RS232_PINS pin; + UINT8 rx_bits, rx_byte, tx_byte, tx_bits; +}; + +class cybiko_state : public driver_device +{ +public: + cybiko_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_crtc(*this, "hd66421"), + m_speaker(*this, "speaker"), + m_rtc(*this, "rtc"), + m_ram(*this, RAM_TAG), + m_flash1(*this, "flash1"), + m_nvram(*this, "nvram"), + m_input(*this, "A") + { } + + DECLARE_READ16_MEMBER(serflash_r); + DECLARE_WRITE16_MEMBER(serflash_w); + DECLARE_READ16_MEMBER(clock_r); + DECLARE_WRITE16_MEMBER(clock_w); + DECLARE_READ16_MEMBER(xtclock_r); + DECLARE_WRITE16_MEMBER(xtclock_w); + DECLARE_READ16_MEMBER(xtpower_r); + + CYBIKO_RS232 m_rs232; + DECLARE_READ16_MEMBER(cybiko_lcd_r); + DECLARE_WRITE16_MEMBER(cybiko_lcd_w); + DECLARE_READ16_MEMBER(cybikov1_key_r); + DECLARE_READ16_MEMBER(cybikov2_key_r); + DECLARE_READ16_MEMBER(cybikoxt_key_r); + DECLARE_WRITE16_MEMBER(cybiko_usb_w); + int cybiko_key_r( offs_t offset, int mem_mask); + void cybiko_rs232_write_byte(int data); + void cybiko_rs232_pin_sck(int data); + void cybiko_rs232_pin_txd(int data); + int cybiko_rs232_pin_rxd(); + int cybiko_rs232_rx_queue(); + void cybiko_rs232_init(); + void cybiko_rs232_exit(); + void cybiko_rs232_reset(); + + required_device m_maincpu; + required_device m_crtc; + required_device m_speaker; + required_device m_rtc; + required_device m_ram; + optional_device m_flash1; + required_device m_nvram; + optional_ioport_array<15> m_input; + DECLARE_DRIVER_INIT(cybikoxt); + DECLARE_DRIVER_INIT(cybiko); + virtual void machine_start(); + virtual void machine_reset(); + void machine_stop_cybiko(); + DECLARE_QUICKLOAD_LOAD_MEMBER( cybiko ); + DECLARE_QUICKLOAD_LOAD_MEMBER( cybikoxt ); +}; + +#endif /* CYBIKO_H_ */ diff --git a/src/mame/includes/dai.h b/src/mame/includes/dai.h new file mode 100644 index 00000000000..2eb2d403979 --- /dev/null +++ b/src/mame/includes/dai.h @@ -0,0 +1,81 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha, Nathan Woods +/***************************************************************************** + * + * includes/dai.h + * + ****************************************************************************/ + +#ifndef DAI_H_ +#define DAI_H_ + +#include "cpu/i8085/i8085.h" +#include "audio/dai_snd.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "machine/tms5501.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" + + +class dai_state : public driver_device +{ +public: + enum + { + TIMER_BOOTSTRAP, + TIMER_TMS5501 + }; + + dai_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pit(*this, "pit8253"), + m_tms5501(*this, "tms5501"), + m_sound(*this, "custom"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette") { } + + required_device m_maincpu; + required_device m_pit; + required_device m_tms5501; + required_device m_sound; + required_device m_cassette; + required_device m_ram; + required_device m_palette; + + UINT8 m_paddle_select; + UINT8 m_paddle_enable; + UINT8 m_cassette_motor[2]; + UINT8 m_keyboard_scan_mask; + unsigned short m_4_colours_palette[4]; + DECLARE_WRITE8_MEMBER(dai_stack_interrupt_circuit_w); + DECLARE_READ8_MEMBER(dai_io_discrete_devices_r); + DECLARE_WRITE8_MEMBER(dai_io_discrete_devices_w); + DECLARE_READ8_MEMBER(dai_amd9511_r); + DECLARE_WRITE8_MEMBER(dai_amd9511_w); + DECLARE_READ8_MEMBER(dai_pit_r); + DECLARE_WRITE8_MEMBER(dai_pit_w); + DECLARE_READ8_MEMBER(dai_keyboard_r); + DECLARE_WRITE8_MEMBER(dai_keyboard_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(dai); + UINT32 screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void dai_update_memory(int dai_rom_bank); + IRQ_CALLBACK_MEMBER(int_ack); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +/*----------- defined in video/dai.c -----------*/ + +extern const unsigned char dai_palette[16*3]; + + +#endif /* DAI_H_ */ diff --git a/src/mame/includes/dccons.h b/src/mame/includes/dccons.h new file mode 100644 index 00000000000..47b47d72f6c --- /dev/null +++ b/src/mame/includes/dccons.h @@ -0,0 +1,48 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese, R. Belmont +#include "imagedev/chd_cd.h" +#include "machine/gdrom.h" +#include "machine/ataintf.h" +#include "machine/intelfsh.h" + +class dc_cons_state : public dc_state +{ +public: + dc_cons_state(const machine_config &mconfig, device_type type, const char *tag) + : dc_state(mconfig, type, tag), + m_ata(*this, "ata") +// m_dcflash(*this, "dcflash") + { } + + required_device m_ata; +// required_device m_dcflash; + + DECLARE_DRIVER_INIT(dc); + DECLARE_DRIVER_INIT(dcus); + DECLARE_DRIVER_INIT(dcjp); + + DECLARE_READ64_MEMBER(dcus_idle_skip_r); + DECLARE_READ64_MEMBER(dcjp_idle_skip_r); + + DECLARE_MACHINE_RESET(dc_console); + DECLARE_READ64_MEMBER(dc_pdtra_r); + DECLARE_WRITE64_MEMBER(dc_pdtra_w); + DECLARE_READ64_MEMBER(dc_arm_r); + DECLARE_WRITE64_MEMBER(dc_arm_w); + DECLARE_WRITE_LINE_MEMBER(aica_irq); + DECLARE_WRITE_LINE_MEMBER(sh4_aica_irq); + DECLARE_WRITE_LINE_MEMBER(ata_interrupt); + + TIMER_CALLBACK_MEMBER( atapi_xfer_end ); + + void dreamcast_atapi_init(); + DECLARE_READ32_MEMBER( dc_mess_g1_ctrl_r ); + DECLARE_WRITE32_MEMBER( dc_mess_g1_ctrl_w ); +// DECLARE_READ8_MEMBER( dc_flash_r ); +// DECLARE_WRITE8_MEMBER( dc_flash_w ); + +private: + UINT64 PDTRA, PCTRA; + emu_timer *atapi_timer; + int atapi_xferlen, atapi_xferbase; +}; diff --git a/src/mame/includes/dgn_beta.h b/src/mame/includes/dgn_beta.h new file mode 100644 index 00000000000..3869f71fffc --- /dev/null +++ b/src/mame/includes/dgn_beta.h @@ -0,0 +1,226 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/***************************************************************************** + * + * includes/dgn_beta.h + * + ****************************************************************************/ + +#ifndef DGN_BETA_H_ +#define DGN_BETA_H_ + +#include "video/mc6845.h" +#include "machine/wd_fdc.h" +#include "machine/6821pia.h" +#include "machine/ram.h" + +/* Tags */ + +#define MAINCPU_TAG "maincpu" +#define DMACPU_TAG "dmacpu" +#define PIA_0_TAG "pia_0" +#define PIA_1_TAG "pia_1" +#define PIA_2_TAG "pia_2" +#define FDC_TAG "wd2797" + + +#define DGNBETA_CPU_SPEED_HZ 2000000 /* 2MHz */ +#define DGNBETA_FRAMES_PER_SECOND 50 + +#define RamSize 256 /* 256K by default */ +#define RamPageSize 4096 /* ram pages are 4096 bytes */ + +#define MaxTasks 16 /* Tasks 0..15 */ +#define MaxPage 16 /* 16 4K pages */ +#define NoPagingTask MaxTasks /* Task registers to use when paging disabled 16 */ + +#define RAMPage 0 /* Page with RAM in at power on */ +#define VideoPage 6 /* Page where video ram mapped */ +#define IOPage MaxPage-1 /* Page for I/O */ +#define ROMPage MaxPage-2 /* Page for ROM */ +#define LastPage MaxPage-1 + +#define RAMPageValue 0x00 /* page with RAM at power on */ +#define VideoPageValue 0x1F /* Default page for video ram */ +#define NoMemPageValue 0xC0 /* Page guaranteed not to have memory in */ +#define ROMPageValue 0xFE /* Page with boot ROM */ +#define IOPageValue 0xFF /* Page with I/O & Boot ROM */ + +#define TextVidBasePage 0x18 /* Base page of text video ram */ + +/***** Keyboard stuff *****/ +#define NoKeyrows 0x0a /* Number of rows in keyboard */ + +/* From Dragon Beta OS9 keyboard driver */ +#define KAny 0x04 /* Any key pressed mask PB2 */ +#define KOutClk 0x08 /* Ouput shift register clock */ +#define KInClk 0x10 /* Input shift register clock */ +#define KOutDat KInClk /* Also used for data into output shifter */ +#define KInDat 0x20 /* Keyboard data in from keyboard (serial stream) */ + +/***** Video Modes *****/ + +enum BETA_VID_MODES +{ + TEXT_40x25, /* Text mode 40x25 */ + TEXT_80x25, /* Text mode 80x25 */ + GRAPH_320x256x4, /* Graphics 320x256x4 */ + GRAPH_320x256x16, /* Graphics 320x256x16 */ + GRAPH_640x512x2 /* Graphics 640X512X2 */ +}; + +#define iosize (0xfEFF-0xfc00) + +struct PageReg +{ + int value; /* Value of the page register */ + UINT8 *memory; /* The memory it actually points to */ +}; + + +class dgn_beta_state : public driver_device +{ +public: + dgn_beta_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_mc6845(*this, "crtc"), + m_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_fdc(*this, FDC_TAG), + m_floppy0(*this, FDC_TAG ":0"), + m_floppy1(*this, FDC_TAG ":1"), + m_floppy2(*this, FDC_TAG ":2"), + m_floppy3(*this, FDC_TAG ":3"), + m_palette(*this, "palette") { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_mc6845; + required_shared_ptr m_videoram; + + UINT8 *m_system_rom; + int m_LogDatWrites; + int m_Keyboard[NoKeyrows]; + int m_RowShifter; + int m_Keyrow; + int m_d_pia0_pb_last; + int m_d_pia0_cb2_last; + int m_KInDat_next; + int m_KAny_next; + int m_d_pia1_pa_last; + int m_d_pia1_pb_last; + int m_DMA_NMI_LAST; + int m_wd2797_written; + int m_TaskReg; + int m_PIATaskReg; + int m_EnableMapRegs; + PageReg m_PageRegs[MaxTasks+1][MaxPage+1]; + int m_beta_6845_RA; + int m_beta_scr_x; + int m_beta_scr_y; + int m_beta_HSync; + int m_beta_VSync; + int m_beta_DE; + int m_LogRegWrites; + int m_BoxColour; + int m_BoxMinX; + int m_BoxMinY; + int m_BoxMaxX; + int m_BoxMaxY; + int m_HSyncMin; + int m_VSyncMin; + int m_DEPos; + int m_NoScreen; + bitmap_ind16 *m_bit; + int m_MinAddr; + int m_MaxAddr; + int m_MinX; + int m_MaxX; + int m_MinY; + int m_MaxY; + int m_VidAddr; + int m_ClkMax; + int m_GCtrl; + int m_FlashCount; + int m_FlashBit; + int m_s_DoubleY; + int m_DoubleHL; + int m_ColourRAM[4]; + int m_Field; + int m_DrawInterlace; + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(dgn); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b0_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b1_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b2_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b3_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b4_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b5_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b6_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b7_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b8_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_b9_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_bA_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_bB_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_bC_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_bD_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_bE_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_bF_w); + DECLARE_WRITE8_MEMBER(dgnbeta_ram_bG_w); + DECLARE_READ8_MEMBER(d_pia0_pa_r); + DECLARE_WRITE8_MEMBER(d_pia0_pa_w); + DECLARE_READ8_MEMBER(d_pia0_pb_r); + DECLARE_WRITE8_MEMBER(d_pia0_pb_w); + DECLARE_WRITE_LINE_MEMBER(d_pia0_cb2_w); + DECLARE_WRITE_LINE_MEMBER(d_pia0_irq_a); + DECLARE_WRITE_LINE_MEMBER(d_pia0_irq_b); + DECLARE_READ8_MEMBER(d_pia1_pa_r); + DECLARE_WRITE8_MEMBER(d_pia1_pa_w); + DECLARE_READ8_MEMBER(d_pia1_pb_r); + DECLARE_WRITE8_MEMBER(d_pia1_pb_w); + DECLARE_WRITE_LINE_MEMBER(d_pia1_irq_a); + DECLARE_WRITE_LINE_MEMBER(d_pia1_irq_b); + DECLARE_READ8_MEMBER(d_pia2_pa_r); + DECLARE_WRITE8_MEMBER(d_pia2_pa_w); + DECLARE_READ8_MEMBER(d_pia2_pb_r); + DECLARE_WRITE8_MEMBER(d_pia2_pb_w); + DECLARE_WRITE_LINE_MEMBER(d_pia2_irq_a); + DECLARE_WRITE_LINE_MEMBER(d_pia2_irq_b); + DECLARE_WRITE_LINE_MEMBER(dgnbeta_fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(dgnbeta_fdc_drq_w); + DECLARE_WRITE_LINE_MEMBER(dgnbeta_vsync_changed); + /* 74HC670 4x4bit colour ram */ + DECLARE_WRITE8_MEMBER(dgnbeta_colour_ram_w); + // Page IO at FE00 + DECLARE_READ8_MEMBER(dgn_beta_page_r); + DECLARE_WRITE8_MEMBER(dgn_beta_page_w); + MC6845_UPDATE_ROW(crtc_update_row); + + /* WD2797 FDC */ + DECLARE_READ8_MEMBER(dgnbeta_wd2797_r); + DECLARE_WRITE8_MEMBER(dgnbeta_wd2797_w); + required_device m_maincpu; + void dgnbeta_vid_set_gctrl(int data); + void UpdateBanks(int first, int last); + void SetDefaultTask(); + void dgn_beta_bank_memory(int offset, int data, int bank); + int SelectedKeyrow(dgn_beta_state *state, int Rows); + int GetKeyRow(dgn_beta_state *state, int RowNo); + void cpu0_recalc_irq(int state); + void cpu0_recalc_firq(int state); + void cpu1_recalc_firq(int state); + void ScanInKeyboard(void); + void dgn_beta_frame_interrupt (int data); + void dgn_beta_line_interrupt (int data); + required_device m_ram; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_device m_palette; +}; + +#endif /* DGN_BETA_H_ */ diff --git a/src/mame/includes/dgnalpha.h b/src/mame/includes/dgnalpha.h new file mode 100644 index 00000000000..402de4f846f --- /dev/null +++ b/src/mame/includes/dgnalpha.h @@ -0,0 +1,97 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + dgnalpha.h + + Dragon Alpha + +***************************************************************************/ + +#pragma once + +#ifndef __DGNALPHA__ +#define __DGNALPHA__ + + +#include "includes/dragon.h" +#include "sound/ay8910.h" +#include "machine/wd_fdc.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +/* devices */ +#define PIA2_TAG "pia2" +#define AY8912_TAG "ay8912" +#define WD2797_TAG "wd2797" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class dragon_alpha_state : public dragon64_state +{ +public: + dragon_alpha_state(const machine_config &mconfig, device_type type, const char *tag) + : dragon64_state(mconfig, type, tag), + m_pia_2(*this, PIA2_TAG), + m_ay8912(*this, AY8912_TAG), + m_fdc(*this, WD2797_TAG), + m_floppy0(*this, WD2797_TAG ":0"), + m_floppy1(*this, WD2797_TAG ":1"), + m_floppy2(*this, WD2797_TAG ":2"), + m_floppy3(*this, WD2797_TAG ":3") + { + } + + DECLARE_FLOPPY_FORMATS(dragon_formats); + + required_device m_pia_2; + required_device m_ay8912; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + + + /* pia2 */ + DECLARE_WRITE8_MEMBER( pia2_pa_w ); + DECLARE_WRITE_LINE_MEMBER( pia2_firq_a ); + DECLARE_WRITE_LINE_MEMBER( pia2_firq_b ); + + /* psg */ + DECLARE_READ8_MEMBER( psg_porta_read ); + DECLARE_WRITE8_MEMBER( psg_porta_write ); + + /* fdc */ + DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + +protected: + /* driver overrides */ + virtual void device_start(void); + virtual void device_reset(void); + + /* interrupts */ + virtual bool firq_get_line(void); + + /* PIA1 */ + virtual DECLARE_READ8_MEMBER( ff20_read ); + virtual DECLARE_WRITE8_MEMBER( ff20_write ); + +private: + UINT8 m_just_reset; + + /* modem */ + UINT8 modem_r(offs_t offset); + void modem_w(offs_t offset, UINT8 data); +}; + +#endif /* __DGNALPHA__ */ diff --git a/src/mame/includes/dm7000.h b/src/mame/includes/dm7000.h new file mode 100644 index 00000000000..241ba0d31b6 --- /dev/null +++ b/src/mame/includes/dm7000.h @@ -0,0 +1,94 @@ +// license:BSD-3-Clause +// copyright-holders:Lukasz Markowski +#ifndef DM7000_H_ +#define DM7000_H_ + +#include "emu.h" +#include "cpu/powerpc/ppc.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class dm7000_state : public driver_device +{ +public: + dm7000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG) + { + } + + required_device m_maincpu; + required_device m_terminal; + + DECLARE_WRITE8_MEMBER ( dm7000_iic0_w ); + DECLARE_READ8_MEMBER ( dm7000_iic0_r ); + DECLARE_WRITE8_MEMBER ( dm7000_iic1_w ); + DECLARE_READ8_MEMBER ( dm7000_iic1_r ); + + DECLARE_WRITE8_MEMBER ( dm7000_scc0_w ); + DECLARE_READ8_MEMBER ( dm7000_scc0_r ); + DECLARE_WRITE8_MEMBER(kbd_put); + UINT8 m_scc0_lcr; + UINT8 m_scc0_lsr; + UINT8 m_term_data; + + + DECLARE_WRITE8_MEMBER ( dm7000_gpio0_w ); + DECLARE_READ8_MEMBER ( dm7000_gpio0_r ); + + DECLARE_WRITE8_MEMBER ( dm7000_scp0_w ); + DECLARE_READ8_MEMBER ( dm7000_scp0_r ); + + DECLARE_WRITE16_MEMBER ( dm7000_enet_w ); + DECLARE_READ16_MEMBER ( dm7000_enet_r ); + + DECLARE_READ32_MEMBER( dcr_r ); + DECLARE_WRITE32_MEMBER( dcr_w ); + + + UINT16 m_enet_regs[32]; + + UINT32 dcr[1024]; + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_dm7000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +}; + +/* */ +#define UART_DLL 0 +#define UART_RBR 0 +#define UART_THR 0 +#define UART_DLH 1 +#define UART_IER 1 +#define UART_IIR 2 +#define UART_FCR 2 +#define UART_LCR 3 +#define UART_LCR_DLAB 0x80 +#define UART_MCR 4 +#define UART_LSR 5 +#define UART_LSR_TEMT 0x20 +#define UART_LSR_THRE 0x40 +#define UART_MSR 6 +#define UART_SCR 7 + +/* */ +#define SCP_SPMODE 0 +#define SCP_RXDATA 1 +#define SCP_TXDATA 2 +#define SCP_SPCOM 3 +#define SCP_STATUS 4 +#define SCP_STATUS_RXRDY 1 +#define SCP_CDM 6 + +/* STB045xxx DCRs */ + +#define DCRSTB045_CICVCR 0x033 /* CIC Video Control Register */ +#define DCRSTB045_SCCR 0x120 /* Serial Clock Control Register */ +#define DCRSTB045_VIDEO_CNTL 0x140 /* Video Control Register */ +#define DCRSTB045_CMD_STAT 0x14a /* Command status */ +#define DCRSTB045_DISP_MODE 0x154 /* Display Mode Register */ +#define DCRSTB045_FRAME_BUFR_BASE 0x179 /* Frame Buffers Base Address Register */ + +#endif /* DM7000_H_ */ diff --git a/src/mame/includes/dragon.h b/src/mame/includes/dragon.h new file mode 100644 index 00000000000..7006d37e68d --- /dev/null +++ b/src/mame/includes/dragon.h @@ -0,0 +1,72 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + dragon.h + + Dragon Family + +***************************************************************************/ + +#pragma once + +#ifndef __DRAGON__ +#define __DRAGON__ + + +#include "includes/coco12.h" +#include "imagedev/printer.h" +#include "machine/mos6551.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define PRINTER_TAG "printer" +#define ACIA_TAG "acia" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class dragon_state : public coco12_state +{ +public: + dragon_state(const machine_config &mconfig, device_type type, const char *tag) + : coco12_state(mconfig, type, tag), + m_printer(*this, PRINTER_TAG) + { + } + + required_device m_printer; + +protected: + virtual void pia1_pa_changed(UINT8 data); +}; + + +/* dragon64 has an ACIA chip */ +class dragon64_state : public dragon_state +{ +public: + dragon64_state(const machine_config &mconfig, device_type type, const char *tag) + : dragon_state(mconfig, type, tag), + m_acia(*this, ACIA_TAG) + { + } + + required_device m_acia; + +protected: + virtual DECLARE_READ8_MEMBER( ff00_read ); + virtual DECLARE_WRITE8_MEMBER( ff00_write ); + + virtual void pia1_pb_changed(UINT8 data); + void page_rom(bool romswitch); +}; + +#endif /* __DRAGON__ */ diff --git a/src/mame/includes/ec184x.h b/src/mame/includes/ec184x.h new file mode 100644 index 00000000000..7921bf5b97e --- /dev/null +++ b/src/mame/includes/ec184x.h @@ -0,0 +1,43 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/***************************************************************************** + * + * includes/ec184x.h + * + ****************************************************************************/ + +#ifndef EC184X_H_ +#define EC184X_H_ + +#include "includes/genpc.h" + +#define MCFG_EC1841_MOTHERBOARD_ADD(_tag, _cputag) \ + MCFG_DEVICE_ADD(_tag, EC1841_MOTHERBOARD, 0) \ + ec1841_mb_device::static_set_cputag(*device, _cputag); + +// ======================> ibm5150_mb_device +class ec1841_mb_device : public ibm5160_mb_device +{ +public: + // construction/destruction + ec1841_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +public: + virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r ); + virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w ); +}; + + +// device type definition +extern const device_type EC1841_MOTHERBOARD; + +#endif /* EC184X_H_ */ diff --git a/src/mame/includes/einstein.h b/src/mame/includes/einstein.h new file mode 100644 index 00000000000..c027a36701e --- /dev/null +++ b/src/mame/includes/einstein.h @@ -0,0 +1,221 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Dirk Best, Phill Harvey-Smith +/*************************************************************************** + + Tatung Einstein + +***************************************************************************/ + +#ifndef EINSTEIN_H_ +#define EINSTEIN_H_ + +#include "emu.h" +#include "video/mc6845.h" +#include "cpu/z80/z80daisy.h" +#include "machine/wd_fdc.h" +#include "machine/z80ctc.h" +#include "video/tms9928a.h" +#include "machine/ram.h" +#include "machine/i8251.h" +#include "bus/centronics/ctronics.h" + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +/* xtals */ +#define XTAL_X001 XTAL_10_738635MHz +#define XTAL_X002 XTAL_8MHz + +/* integrated circuits */ +#define IC_I001 "i001" /* Z8400A */ +#define IC_I030 "i030" /* AY-3-8910 */ +#define IC_I038 "i038" /* TMM9129 */ +#define IC_I042 "i042" /* WD1770-PH */ +#define IC_I050 "i050" /* ADC0844CCN */ +#define IC_I058 "i058" /* Z8430A */ +#define IC_I060 "i060" /* uPD8251A */ +#define IC_I063 "i063" /* Z8420A */ + +/* interrupt sources */ +#define EINSTEIN_KEY_INT (1<<0) +#define EINSTEIN_ADC_INT (1<<1) +#define EINSTEIN_FIRE_INT (1<<2) + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +class einstein_state : public driver_device +{ +public: + einstein_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_fdc(*this, IC_I042), + m_color_screen(*this, "screen"), + m_ctc(*this, IC_I058), + m_tms9929a(*this, "tms9929a"), + m_region_gfx1(*this, "gfx1"), + m_mc6845(*this, "crtc"), + m_crtc_screen(*this, "80column"), + m_uart(*this, IC_I060), + m_ram(*this, RAM_TAG), + m_centronics(*this, "centronics"), + m_region_bios(*this, "bios"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1"), + m_line2(*this, "LINE2"), + m_line3(*this, "LINE3"), + m_line4(*this, "LINE4"), + m_line5(*this, "LINE5"), + m_line6(*this, "LINE6"), + m_line7(*this, "LINE7"), + m_extra(*this, "EXTRA"), + m_buttons(*this, "BUTTONS"), + m_config(*this, "config"), + m_80column_dips(*this, "80column_dips"), + m_palette(*this, "palette") { } + + required_device m_fdc; + required_device m_color_screen; + required_device m_ctc; + required_device m_tms9929a; + optional_memory_region m_region_gfx1; + + int m_rom_enabled; + int m_interrupt; + int m_interrupt_mask; + int m_ctc_trigger; + + /* keyboard */ + UINT8 m_keyboard_line; + UINT8 m_keyboard_data; + + /* 80 column device */ + optional_device m_mc6845; + optional_device m_crtc_screen; + UINT8 *m_crtc_ram; + UINT8 m_de; + + int m_centronics_busy; + int m_centronics_perror; + int m_centronics_fault; + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + DECLARE_WRITE8_MEMBER(einstein_80col_ram_w); + DECLARE_READ8_MEMBER(einstein_80col_ram_r); + DECLARE_READ8_MEMBER(einstein_80col_state_r); + DECLARE_WRITE8_MEMBER(einstein_keyboard_line_write); + DECLARE_READ8_MEMBER(einstein_keyboard_data_read); + DECLARE_WRITE8_MEMBER(einstein_rom_w); + DECLARE_READ8_MEMBER(einstein_kybintmsk_r); + DECLARE_WRITE8_MEMBER(einstein_kybintmsk_w); + DECLARE_WRITE8_MEMBER(einstein_adcintmsk_w); + DECLARE_WRITE8_MEMBER(einstein_fire_int_w); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_MACHINE_START(einstein2); + DECLARE_MACHINE_RESET(einstein2); + UINT32 screen_update_einstein2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(einstein_keyboard_timer_callback); + TIMER_DEVICE_CALLBACK_MEMBER(einstein_ctc_trigger_callback); + DECLARE_WRITE_LINE_MEMBER(einstein_6845_de_changed); + DECLARE_WRITE8_MEMBER(einstein_drsel_w); + DECLARE_WRITE_LINE_MEMBER(einstein_serial_transmit_clock); + DECLARE_WRITE_LINE_MEMBER(einstein_serial_receive_clock); + MC6845_UPDATE_ROW(crtc_update_row); + +protected: + required_device m_uart; + required_device m_ram; + required_device m_centronics; + required_memory_region m_region_bios; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_ioport m_line0; + required_ioport m_line1; + required_ioport m_line2; + required_ioport m_line3; + required_ioport m_line4; + required_ioport m_line5; + required_ioport m_line6; + required_ioport m_line7; + required_ioport m_extra; + required_ioport m_buttons; + required_ioport m_config; + optional_ioport m_80column_dips; +public: + optional_device m_palette; + + void einstein_scan_keyboard(); + void einstein_page_rom(); +}; + + +// ======================> einstein_keyboard_daisy_device + +class einstein_keyboard_daisy_device : public device_t, + public device_z80daisy_interface +{ +public: + // construction/destruction + einstein_keyboard_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +private: + virtual void device_start(); + // z80daisy_interface overrides + virtual int z80daisy_irq_state(); + virtual int z80daisy_irq_ack(); + virtual void z80daisy_irq_reti(); +}; + +extern const device_type EINSTEIN_KEYBOARD_DAISY; + + +// ======================> einstein_adc_daisy_device + +class einstein_adc_daisy_device : public device_t, + public device_z80daisy_interface +{ +public: + // construction/destruction + einstein_adc_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +private: + virtual void device_start(); + // z80daisy_interface overrides + virtual int z80daisy_irq_state(); + virtual int z80daisy_irq_ack(); + virtual void z80daisy_irq_reti(); + +}; + +extern const device_type EINSTEIN_ADC_DAISY; + +// ======================> einstein_fire_daisy_device + +class einstein_fire_daisy_device : public device_t, + public device_z80daisy_interface +{ +public: + // construction/destruction + einstein_fire_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +private: + virtual void device_start(); + // z80daisy_interface overrides + virtual int z80daisy_irq_state(); + virtual int z80daisy_irq_ack(); + virtual void z80daisy_irq_reti(); +}; + +extern const device_type EINSTEIN_FIRE_DAISY; + +#endif /* EINSTEIN_H_ */ diff --git a/src/mame/includes/electron.h b/src/mame/includes/electron.h new file mode 100644 index 00000000000..d9623923f17 --- /dev/null +++ b/src/mame/includes/electron.h @@ -0,0 +1,117 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/***************************************************************************** + * + * includes/electron.h + * + * Acorn Electron + * + * Driver by Wilbert Pol + * + ****************************************************************************/ + +#ifndef ELECTRON_H_ +#define ELECTRON_H_ + +#include "imagedev/cassette.h" +#include "sound/beep.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +/* Interrupts */ +#define INT_HIGH_TONE 0x40 +#define INT_TRANSMIT_EMPTY 0x20 +#define INT_RECEIVE_FULL 0x10 +#define INT_RTC 0x08 +#define INT_DISPLAY_END 0x04 +#define INT_SET 0x100 +#define INT_CLEAR 0x200 + +/* ULA context */ + +struct ULA +{ + UINT8 interrupt_status; + UINT8 interrupt_control; + UINT8 rompage; + UINT16 screen_start; + UINT16 screen_base; + int screen_size; + UINT16 screen_addr; + UINT8 *vram; + int current_pal[16]; + int communication_mode; + int screen_mode; + int cassette_motor_mode; + int capslock_mode; +// int scanline; + /* tape reading related */ + UINT32 tape_value; + int tape_steps; + int bit_count; + int high_tone_set; + int start_bit; + int stop_bit; + int tape_running; + UINT8 tape_byte; +}; + + +class electron_state : public driver_device +{ +public: + enum + { + TIMER_TAPE_HANDLER, + TIMER_SETUP_BEEP, + TIMER_SCANLINE_INTERRUPT + }; + + electron_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_beeper(*this, "beeper"), + m_cart(*this, "cartslot"), + m_keybd(*this, "LINE") + { } + + ULA m_ula; + emu_timer *m_tape_timer; + int m_map4[256]; + int m_map16[256]; + emu_timer *m_scanline_timer; + DECLARE_READ8_MEMBER(electron_read_keyboard); + DECLARE_READ8_MEMBER(electron_jim_r); + DECLARE_WRITE8_MEMBER(electron_jim_w); + DECLARE_READ8_MEMBER(electron_1mhz_r); + DECLARE_WRITE8_MEMBER(electron_1mhz_w); + DECLARE_READ8_MEMBER(electron_ula_r); + DECLARE_WRITE8_MEMBER(electron_ula_w); + void electron_tape_start(); + void electron_tape_stop(); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(electron); + UINT32 screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(electron_tape_timer_handler); + TIMER_CALLBACK_MEMBER(setup_beep); + TIMER_CALLBACK_MEMBER(electron_scanline_interrupt); + required_device m_maincpu; + required_device m_cassette; + required_device m_beeper; + required_device m_cart; + required_ioport_array<14> m_keybd; + inline UINT8 read_vram( UINT16 addr ); + inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void electron_interrupt_handler(int mode, int interrupt); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( electron_cart ); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +#endif /* ELECTRON_H_ */ diff --git a/src/mame/includes/elf.h b/src/mame/includes/elf.h new file mode 100644 index 00000000000..d3dbc3d685e --- /dev/null +++ b/src/mame/includes/elf.h @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __INCLUDES_ELF__ +#define __INCLUDES_ELF__ + + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "machine/mm74c922.h" +#include "video/cdp1861.h" +#include "video/dm9368.h" +#include "machine/rescap.h" +#include "machine/ram.h" + +#define SCREEN_TAG "screen" +#define CDP1802_TAG "a6" +#define CDP1861_TAG "a14" +#define MM74C923_TAG "a10" +#define DM9368_L_TAG "a12" +#define DM9368_H_TAG "a8" + +class elf2_state : public driver_device +{ +public: + elf2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_vdc(*this, CDP1861_TAG), + m_kb(*this, MM74C923_TAG), + m_led_l(*this, DM9368_L_TAG), + m_led_h(*this, DM9368_H_TAG), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_special(*this, "SPECIAL") + { } + + required_device m_maincpu; + required_device m_vdc; + required_device m_kb; + required_device m_led_l; + required_device m_led_h; + required_device m_cassette; + required_device m_ram; + required_ioport m_special; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( dispon_r ); + DECLARE_READ8_MEMBER( data_r ); + DECLARE_WRITE8_MEMBER( data_w ); + DECLARE_WRITE8_MEMBER( memory_w ); + DECLARE_READ_LINE_MEMBER( wait_r ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef4_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_READ8_MEMBER( dma_r ); + DECLARE_WRITE8_MEMBER( sc_w ); + DECLARE_WRITE_LINE_MEMBER( da_w ); + DECLARE_INPUT_CHANGED_MEMBER( input_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( elf ); + // display state + UINT8 m_data; +}; + +#endif diff --git a/src/mame/includes/ep64.h b/src/mame/includes/ep64.h new file mode 100644 index 00000000000..42dd9115e35 --- /dev/null +++ b/src/mame/includes/ep64.h @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Enterprise Sixty Four / One Two Eight emulation + +**********************************************************************/ + +#pragma once + +#ifndef __EP64__ +#define __EP64__ + +#include "audio/dave.h" +#include "bus/rs232/rs232.h" +#include "bus/ep64/exp.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "machine/ram.h" +#include "video/nick.h" + +#define Z80_TAG "u1" +#define DAVE_TAG "u3" +#define NICK_TAG "u4" +#define CENTRONICS_TAG "centronics" +#define RS232_TAG "rs232" +#define CASSETTE1_TAG "cassette1" +#define CASSETTE2_TAG "cassette2" +#define SCREEN_TAG "screen" + +class ep64_state : public driver_device +{ +public: + ep64_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_dave(*this, DAVE_TAG), + m_nick(*this, NICK_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_rs232(*this, RS232_TAG), + m_cassette1(*this, CASSETTE1_TAG), + m_cassette2(*this, CASSETTE2_TAG), + m_cart(*this, "cartslot"), + m_ram(*this, RAM_TAG), + m_rom(*this, Z80_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9") + { } + + required_device m_maincpu; + required_device m_dave; + required_device m_nick; + required_device m_centronics; + required_device m_rs232; + required_device m_cassette1; + required_device m_cassette2; + required_device m_cart; + required_device m_ram; + required_memory_region m_rom; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( rd0_r ); + DECLARE_WRITE8_MEMBER( wr0_w ); + DECLARE_READ8_MEMBER( rd1_r ); + DECLARE_WRITE8_MEMBER( wr1_w ); + DECLARE_READ8_MEMBER( rd2_r ); + DECLARE_WRITE8_MEMBER( wr2_w ); + + UINT8 m_key; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + int m_centronics_busy; +}; + +#endif diff --git a/src/mame/includes/eti660.h b/src/mame/includes/eti660.h new file mode 100644 index 00000000000..6298475d66a --- /dev/null +++ b/src/mame/includes/eti660.h @@ -0,0 +1,75 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __ETI660__ +#define __ETI660__ + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "machine/6821pia.h" +#include "machine/rescap.h" +#include "sound/cdp1864.h" + +#define SCREEN_TAG "screen" +#define CDP1802_TAG "ic3" +#define CDP1864_TAG "ic4" +#define MC6821_TAG "ic5" + +enum +{ + LED_POWER = 0, + LED_PULSE +}; + +class eti660_state : public driver_device +{ +public: + eti660_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_cti(*this, CDP1864_TAG), + m_pia(*this, MC6821_TAG), + m_cassette(*this, "cassette"), + m_pa0(*this, "PA0"), + m_pa1(*this, "PA1"), + m_pa2(*this, "PA2"), + m_pa3(*this, "PA3"), + m_special(*this, "SPECIAL") + { } + + required_device m_maincpu; + required_device m_cti; + required_device m_pia; + required_device m_cassette; + required_ioport m_pa0; + required_ioport m_pa1; + required_ioport m_pa2; + required_ioport m_pa3; + required_ioport m_special; + + DECLARE_READ8_MEMBER( pia_r ); + DECLARE_WRITE8_MEMBER( pia_w ); + DECLARE_WRITE8_MEMBER( colorram_w ); + DECLARE_READ_LINE_MEMBER( rdata_r ); + DECLARE_READ_LINE_MEMBER( bdata_r ); + DECLARE_READ_LINE_MEMBER( gdata_r ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef4_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_WRITE8_MEMBER( dma_w ); + DECLARE_READ8_MEMBER( pia_pa_r ); + DECLARE_WRITE8_MEMBER( pia_pa_w ); + + /* keyboard state */ + UINT8 m_keylatch; + + /* video state */ + UINT8 m_color_ram[0x100]; + UINT8 m_color; +}; + +#endif diff --git a/src/mame/includes/exp85.h b/src/mame/includes/exp85.h new file mode 100644 index 00000000000..b5a57422d2e --- /dev/null +++ b/src/mame/includes/exp85.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __EXP85__ +#define __EXP85__ + +#include "bus/rs232/rs232.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" + +#define SCREEN_TAG "screen" +#define I8085A_TAG "u100" +#define I8155_TAG "u106" +#define I8355_TAG "u105" + +class exp85_state : public driver_device +{ +public: + exp85_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I8085A_TAG), + m_rs232(*this, "rs232"), + m_cassette(*this, "cassette"), + m_speaker(*this, "speaker"), + m_rom(*this, I8085A_TAG), + m_tape_control(0) + { } + + required_device m_maincpu; + required_device m_rs232; + required_device m_cassette; + required_device m_speaker; + required_memory_region m_rom; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( i8355_a_r ); + DECLARE_WRITE8_MEMBER( i8355_a_w ); + DECLARE_READ_LINE_MEMBER( sid_r ); + DECLARE_WRITE_LINE_MEMBER( sod_w ); + DECLARE_WRITE_LINE_MEMBER( terminal_w ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_rst75 ); + + /* cassette state */ + int m_tape_control; +}; + +#endif diff --git a/src/mame/includes/fidelz80.h b/src/mame/includes/fidelz80.h new file mode 100644 index 00000000000..64f47809e4c --- /dev/null +++ b/src/mame/includes/fidelz80.h @@ -0,0 +1,79 @@ +// license:BSD-3-Clause +// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco +/*************************************************************************** + + fidelz80.h + +****************************************************************************/ + +#pragma once + +#ifndef _FIDELZ80_H_ +#define _FIDELZ80_H_ + +#include "sound/beep.h" +#include "sound/s14001a.h" + +class fidelz80_state : public driver_device +{ +public: + fidelz80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speech(*this, "speech"), + m_beep(*this, "beeper"), + m_i8041(*this, "mcu"), + m_i8243(*this, "i8243") + { } + + required_device m_maincpu; + optional_device m_speech; + optional_device m_beep; + optional_device m_i8041; + optional_device m_i8243; + + UINT16 m_kp_matrix; // keypad/leds matrix + UINT8 m_led_data; // data for the two individual leds, in 0bxxxx12xx format + UINT8 m_led_selected; // 5 bit selects for 7 seg leds and for common other leds, bits are (7seg leds are 0 1 2 3, common other leds are C) 0bxx3210xc + UINT16 m_digit_data; // data for seg leds + UINT8 m_digit_line_status[4]; // prevent overwrite of m_digit_data + + virtual void machine_reset(); + + //model VCC/UVC + void update_display(); + DECLARE_READ8_MEMBER( fidelz80_portc_r ); + DECLARE_WRITE8_MEMBER( fidelz80_portb_w ); + DECLARE_WRITE8_MEMBER( fidelz80_portc_w ); + DECLARE_WRITE8_MEMBER( cc10_porta_w ); + DECLARE_READ8_MEMBER( vcc_portb_r ); + DECLARE_WRITE8_MEMBER( vcc_porta_w ); + + //model 7014 and VBC + DECLARE_WRITE8_MEMBER(bridgec_speech_w ); + DECLARE_WRITE8_MEMBER(kp_matrix_w); + DECLARE_READ8_MEMBER(unknown_r); + DECLARE_READ8_MEMBER(unknown2_r); + DECLARE_READ8_MEMBER(exp_i8243_p2_r); + DECLARE_WRITE8_MEMBER(exp_i8243_p2_w); + DECLARE_WRITE8_MEMBER(mcu_data_w); + DECLARE_WRITE8_MEMBER(mcu_command_w); + DECLARE_READ8_MEMBER(mcu_data_r); + DECLARE_READ8_MEMBER(mcu_status_r); + DECLARE_INPUT_CHANGED_MEMBER(bridgec_trigger_reset); + + //model VSC + DECLARE_WRITE8_MEMBER(vsc_porta_w); + DECLARE_WRITE8_MEMBER(vsc_portb_w); + DECLARE_WRITE8_MEMBER(vsc_portc_w); + DECLARE_READ8_MEMBER(vsc_pio_porta_r); + DECLARE_READ8_MEMBER(vsc_pio_portb_r); + DECLARE_WRITE8_MEMBER(vsc_pio_portb_w); + DECLARE_INPUT_CHANGED_MEMBER(fidelz80_trigger_reset); + TIMER_DEVICE_CALLBACK_MEMBER(nmi_timer); + + DECLARE_WRITE8_MEMBER(digit_w); +}; + + +#endif // _FIDELZ80_H_ diff --git a/src/mame/includes/fm7.h b/src/mame/includes/fm7.h new file mode 100644 index 00000000000..797d19657f0 --- /dev/null +++ b/src/mame/includes/fm7.h @@ -0,0 +1,390 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/cassette.h" +#include "sound/beep.h" +#include "sound/2203intf.h" +#include "machine/wd_fdc.h" +#include "machine/bankdev.h" + +/* + * + * FM-7 header file + * + */ + +#ifndef FM7_H_ +#define FM7_H_ + +// Interrupt flags +#define IRQ_FLAG_KEY 0x01 +#define IRQ_FLAG_PRINTER 0x02 +#define IRQ_FLAG_TIMER 0x04 +#define IRQ_FLAG_OTHER 0x08 +// the following are not read in port 0xfd03 +#define IRQ_FLAG_MFD 0x10 +#define IRQ_FLAG_TXRDY 0x20 +#define IRQ_FLAG_RXRDY 0x40 +#define IRQ_FLAG_SYNDET 0x80 + +// system types +#define SYS_FM7 1 +#define SYS_FM77AV 2 +#define SYS_FM77AV40EX 3 +#define SYS_FM11 4 +#define SYS_FM16 5 + +// keyboard scancode formats +#define KEY_MODE_FM7 0 // FM-7 ASCII type code +#define KEY_MODE_FM16B 1 // FM-16B (FM-77AV and later only) +#define KEY_MODE_SCAN 2 // Scancode Make/Break (PC-like) + +struct fm7_encoder_t +{ + UINT8 buffer[12]; + UINT8 tx_count; + UINT8 rx_count; + UINT8 command_length; + UINT8 answer_length; + UINT8 latch; // 0=ready to receive + UINT8 ack; + UINT8 position; +}; + +struct fm7_mmr_t +{ + UINT8 bank_addr[8][16]; + UINT8 segment; + UINT8 window_offset; + UINT8 enabled; + UINT8 mode; +}; + +struct fm7_video_t +{ + UINT8 sub_busy; + UINT8 sub_halt; + UINT8 sub_reset; // high if reset caused by subrom change + UINT8 attn_irq; + UINT8 vram_access; // VRAM access flag + UINT8 crt_enable; + UINT16 vram_offset; + UINT16 vram_offset2; + UINT8 fm7_pal[8]; + UINT16 fm77av_pal_selected; + UINT8 subrom; // currently active sub CPU ROM (AV only) + UINT8 cgrom; // currently active CGROM (AV only) + UINT8 modestatus; + UINT8 multi_page; + UINT8 fine_offset; + UINT8 nmi_mask; + UINT8 active_video_page; + UINT8 display_video_page; + UINT8 vsync_flag; +}; + +struct fm7_alu_t +{ + UINT8 command; + UINT8 lcolour; + UINT8 mask; + UINT8 compare_data; + UINT8 compare[8]; + UINT8 bank_disable; + UINT8 tilepaint_b; + UINT8 tilepaint_r; + UINT8 tilepaint_g; + UINT16 addr_offset; + UINT16 line_style; + UINT16 x0; + UINT16 x1; + UINT16 y0; + UINT16 y1; + UINT8 busy; +}; + + +class fm7_state : public driver_device +{ +public: + enum + { + TIMER_FM7_BEEPER_OFF, + TIMER_FM77AV_ENCODER_ACK, + TIMER_FM7_IRQ, + TIMER_FM7_SUBTIMER_IRQ, + TIMER_FM7_KEYBOARD_POLL, + TIMER_FM77AV_ALU_TASK_END, + TIMER_FM77AV_VSYNC + }; + + fm7_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_shared_ram(*this, "shared_ram"), + m_boot_ram(*this, "boot_ram"), + m_maincpu(*this, "maincpu"), + m_sub(*this, "sub"), + m_x86(*this, "x86"), + m_cassette(*this, "cassette"), + m_beeper(*this, "beeper"), + m_ym(*this, "ym"), + m_psg(*this, "psg"), + m_centronics(*this, "centronics"), + m_cent_data_out(*this, "cent_data_out"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_floppy(NULL), + m_kanji(*this, "kanji1"), + m_key1(*this, "key1"), + m_key2(*this, "key2"), + m_key3(*this, "key3"), + m_keymod(*this, "key_modifiers"), + m_joy1(*this, "joy1"), + m_joy2(*this, "joy2"), + m_dsw(*this, "DSW"), + m_palette(*this, "palette"), + m_av_palette(*this, "av_palette"), + m_avbank1(*this, "av_bank1"), + m_avbank2(*this, "av_bank2"), + m_avbank3(*this, "av_bank3"), + m_avbank4(*this, "av_bank4"), + m_avbank5(*this, "av_bank5"), + m_avbank6(*this, "av_bank6"), + m_avbank7(*this, "av_bank7"), + m_avbank8(*this, "av_bank8"), + m_avbank9(*this, "av_bank9"), + m_avbank10(*this, "av_bank10"), + m_avbank11(*this, "av_bank11"), + m_avbank12(*this, "av_bank12"), + m_avbank13(*this, "av_bank13"), + m_avbank14(*this, "av_bank14"), + m_avbank15(*this, "av_bank15"), + m_avbank16(*this, "av_bank16") + { + } + + optional_shared_ptr m_shared_ram; + optional_shared_ptr m_boot_ram; + + UINT8 m_irq_flags; + UINT8 m_irq_mask; + emu_timer* m_timer; + emu_timer* m_subtimer; + emu_timer* m_keyboard_timer; + UINT8 m_basic_rom_en; + UINT8 m_init_rom_en; + unsigned int m_key_delay; + unsigned int m_key_repeat; + UINT16 m_current_scancode; + UINT32 m_key_data[4]; + UINT32 m_mod_data; + UINT8 m_key_scan_mode; + UINT8 m_break_flag; + UINT8 m_psg_regsel; + UINT8 m_psg_data; + UINT8 m_fdc_side; + UINT8 m_fdc_drive; + UINT8 m_fdc_irq_flag; + UINT8 m_fdc_drq_flag; + UINT8 m_fm77av_ym_irq; + UINT8 m_speaker_active; + UINT16 m_kanji_address; + fm7_encoder_t m_encoder; + fm7_mmr_t m_mmr; + UINT8 m_cp_prev; + UINT8* m_video_ram; + emu_timer* m_fm77av_vsync_timer; + UINT8 m_type; + fm7_video_t m_video; + fm7_alu_t m_alu; + int m_sb_prev; + DECLARE_READ8_MEMBER(fm7_subintf_r); + DECLARE_WRITE8_MEMBER(fm7_subintf_w); + DECLARE_READ8_MEMBER(fm7_sub_busyflag_r); + DECLARE_WRITE8_MEMBER(fm7_sub_busyflag_w); + DECLARE_READ8_MEMBER(fm7_cancel_ack); + DECLARE_READ8_MEMBER(fm7_attn_irq_r); + DECLARE_READ8_MEMBER(fm7_vram_access_r); + DECLARE_WRITE8_MEMBER(fm7_vram_access_w); + DECLARE_READ8_MEMBER(fm7_vram_r); + DECLARE_WRITE8_MEMBER(fm7_vram_w); + DECLARE_WRITE8_MEMBER(fm7_vram_banked_w); + DECLARE_READ8_MEMBER(fm7_vram0_r); + DECLARE_READ8_MEMBER(fm7_vram1_r); + DECLARE_READ8_MEMBER(fm7_vram2_r); + DECLARE_READ8_MEMBER(fm7_vram3_r); + DECLARE_READ8_MEMBER(fm7_vram4_r); + DECLARE_READ8_MEMBER(fm7_vram5_r); + DECLARE_READ8_MEMBER(fm7_vram6_r); + DECLARE_READ8_MEMBER(fm7_vram7_r); + DECLARE_READ8_MEMBER(fm7_vram8_r); + DECLARE_READ8_MEMBER(fm7_vram9_r); + DECLARE_READ8_MEMBER(fm7_vramA_r); + DECLARE_READ8_MEMBER(fm7_vramB_r); + DECLARE_WRITE8_MEMBER(fm7_vram0_w); + DECLARE_WRITE8_MEMBER(fm7_vram1_w); + DECLARE_WRITE8_MEMBER(fm7_vram2_w); + DECLARE_WRITE8_MEMBER(fm7_vram3_w); + DECLARE_WRITE8_MEMBER(fm7_vram4_w); + DECLARE_WRITE8_MEMBER(fm7_vram5_w); + DECLARE_WRITE8_MEMBER(fm7_vram6_w); + DECLARE_WRITE8_MEMBER(fm7_vram7_w); + DECLARE_WRITE8_MEMBER(fm7_vram8_w); + DECLARE_WRITE8_MEMBER(fm7_vram9_w); + DECLARE_WRITE8_MEMBER(fm7_vramA_w); + DECLARE_WRITE8_MEMBER(fm7_vramB_w); + DECLARE_READ8_MEMBER(fm7_crt_r); + DECLARE_WRITE8_MEMBER(fm7_crt_w); + DECLARE_WRITE8_MEMBER(fm7_vram_offset_w); + DECLARE_WRITE8_MEMBER(fm7_multipage_w); + DECLARE_READ8_MEMBER(fm7_palette_r); + DECLARE_WRITE8_MEMBER(fm7_palette_w); + DECLARE_WRITE8_MEMBER(fm77av_analog_palette_w); + DECLARE_READ8_MEMBER(fm77av_video_flags_r); + DECLARE_WRITE8_MEMBER(fm77av_video_flags_w); + DECLARE_READ8_MEMBER(fm77av_sub_modestatus_r); + DECLARE_WRITE8_MEMBER(fm77av_sub_modestatus_w); + DECLARE_WRITE8_MEMBER(fm77av_sub_bank_w); + DECLARE_READ8_MEMBER(fm77av_alu_r); + DECLARE_WRITE8_MEMBER(fm77av_alu_w); + DECLARE_READ8_MEMBER(fm7_sub_ram_ports_banked_r); + DECLARE_WRITE8_MEMBER(fm7_sub_ram_ports_banked_w); + DECLARE_READ8_MEMBER(fm7_console_ram_banked_r); + DECLARE_WRITE8_MEMBER(fm7_console_ram_banked_w); + DECLARE_WRITE8_MEMBER(fm7_irq_mask_w); + DECLARE_READ8_MEMBER(fm7_irq_cause_r); + DECLARE_WRITE8_MEMBER(fm7_beeper_w); + DECLARE_READ8_MEMBER(fm7_sub_beeper_r); + DECLARE_READ8_MEMBER(vector_r); + DECLARE_WRITE8_MEMBER(vector_w); + DECLARE_READ8_MEMBER(fm7_fd04_r); + DECLARE_READ8_MEMBER(fm7_rom_en_r); + DECLARE_WRITE8_MEMBER(fm7_rom_en_w); + DECLARE_WRITE8_MEMBER(fm7_init_en_w); + DECLARE_READ8_MEMBER(fm7_fdc_r); + DECLARE_WRITE8_MEMBER(fm7_fdc_w); + DECLARE_READ8_MEMBER(fm7_keyboard_r); + DECLARE_READ8_MEMBER(fm7_sub_keyboard_r); + DECLARE_READ8_MEMBER(fm77av_key_encoder_r); + DECLARE_WRITE8_MEMBER(fm77av_key_encoder_w); + DECLARE_READ8_MEMBER(fm7_cassette_printer_r); + DECLARE_WRITE8_MEMBER(fm7_cassette_printer_w); + DECLARE_READ8_MEMBER(fm77av_boot_mode_r); + DECLARE_READ8_MEMBER(fm7_psg_select_r); + DECLARE_WRITE8_MEMBER(fm7_psg_select_w); + DECLARE_WRITE8_MEMBER(fm77av_ym_select_w); + DECLARE_READ8_MEMBER(fm7_psg_data_r); + DECLARE_WRITE8_MEMBER(fm7_psg_data_w); + DECLARE_WRITE8_MEMBER(fm77av_bootram_w); + DECLARE_READ8_MEMBER(fm7_main_shared_r); + DECLARE_WRITE8_MEMBER(fm7_main_shared_w); + DECLARE_READ8_MEMBER(fm7_fmirq_r); + DECLARE_READ8_MEMBER(fm7_unknown_r); + DECLARE_READ8_MEMBER(fm7_mmr_r); + DECLARE_WRITE8_MEMBER(fm7_mmr_w); + DECLARE_READ8_MEMBER(fm7_kanji_r); + DECLARE_WRITE8_MEMBER(fm7_kanji_w); + void fm77av_encoder_setup_command(); + void fm77av_encoder_handle_command(); + DECLARE_DRIVER_INIT(fm7); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_MACHINE_START(fm7); + DECLARE_MACHINE_START(fm77av); + DECLARE_MACHINE_START(fm11); + DECLARE_MACHINE_START(fm16); + UINT32 screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(fm7_beeper_off); + TIMER_CALLBACK_MEMBER(fm77av_encoder_ack); + TIMER_CALLBACK_MEMBER(fm7_timer_irq); + TIMER_CALLBACK_MEMBER(fm7_subtimer_irq); + TIMER_CALLBACK_MEMBER(fm7_keyboard_poll); + TIMER_CALLBACK_MEMBER(fm77av_alu_task_end); + TIMER_CALLBACK_MEMBER(fm77av_vsync); + DECLARE_WRITE_LINE_MEMBER(fm7_fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(fm7_fdc_drq_w); + DECLARE_READ8_MEMBER(fm77av_joy_1_r); + DECLARE_READ8_MEMBER(fm77av_joy_2_r); + IRQ_CALLBACK_MEMBER(fm7_irq_ack); + IRQ_CALLBACK_MEMBER(fm7_sub_irq_ack); + DECLARE_WRITE_LINE_MEMBER(fm77av_fmirq); + required_device m_maincpu; + required_device m_sub; + optional_device m_x86; + required_device m_cassette; + required_device m_beeper; + optional_device m_ym; + optional_device m_psg; + required_device m_centronics; + required_device m_cent_data_out; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + + floppy_image_device *m_floppy; + + void fm7_alu_mask_write(UINT32 offset, int bank, UINT8 dat); + void fm7_alu_function_compare(UINT32 offset); + void fm7_alu_function_pset(UINT32 offset); + void fm7_alu_function_or(UINT32 offset); + void fm7_alu_function_and(UINT32 offset); + void fm7_alu_function_xor(UINT32 offset); + void fm7_alu_function_not(UINT32 offset); + void fm7_alu_function_invalid(UINT32 offset); + void fm7_alu_function_tilepaint(UINT32 offset); + void fm7_alu_function(UINT32 offset); + UINT32 fm7_line_set_pixel(int x, int y); + void fm77av_line_draw(); + void main_irq_set_flag(UINT8 flag); + void main_irq_clear_flag(UINT8 flag); + void fm7_update_psg(); + void fm7_update_bank(address_space & space, int bank, UINT8 physical); + void fm7_mmr_refresh(address_space& space); + void key_press(UINT16 scancode); + void fm7_keyboard_poll_scan(); + + int m_centronics_busy; + int m_centronics_fault; + int m_centronics_ack; + int m_centronics_perror; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + + optional_memory_region m_kanji; + required_ioport m_key1; + required_ioport m_key2; + required_ioport m_key3; + required_ioport m_keymod; + required_ioport m_joy1; + required_ioport m_joy2; + required_ioport m_dsw; + required_device m_palette; + optional_device m_av_palette; + + optional_device m_avbank1; + optional_device m_avbank2; + optional_device m_avbank3; + optional_device m_avbank4; + optional_device m_avbank5; + optional_device m_avbank6; + optional_device m_avbank7; + optional_device m_avbank8; + optional_device m_avbank9; + optional_device m_avbank10; + optional_device m_avbank11; + optional_device m_avbank12; + optional_device m_avbank13; + optional_device m_avbank14; + optional_device m_avbank15; + optional_device m_avbank16; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /*FM7_H_*/ diff --git a/src/mame/includes/fmtowns.h b/src/mame/includes/fmtowns.h new file mode 100644 index 00000000000..fb521304d8d --- /dev/null +++ b/src/mame/includes/fmtowns.h @@ -0,0 +1,384 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +#ifndef FMTOWNS_H_ +#define FMTOWNS_H_ + + +#include "emu.h" +#include "cpu/i386/i386.h" +#include "sound/2612intf.h" +#include "sound/rf5c68.h" +#include "sound/cdda.h" +#include "sound/speaker.h" +#include "imagedev/chd_cd.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/wd_fdc.h" +#include "imagedev/floppy.h" +#include "formats/fmtowns_dsk.h" +#include "machine/upd71071.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "machine/fm_scsi.h" + +#define IRQ_LOG 0 // set to 1 to log IRQ line activity + +struct towns_cdrom_controller +{ + UINT8 command; + UINT8 status; + UINT8 cmd_status[4]; + UINT8 cmd_status_ptr; + UINT8 extra_status; + UINT8 parameter[8]; + UINT8 mpu_irq_enable; + UINT8 dma_irq_enable; + UINT8 buffer[2048]; + INT32 buffer_ptr; + UINT32 lba_current; + UINT32 lba_last; + UINT32 cdda_current; + UINT32 cdda_length; + bool software_tx; + emu_timer* read_timer; +}; + +struct towns_video_controller +{ + UINT8 towns_vram_wplane; + UINT8 towns_vram_rplane; + UINT8 towns_vram_page_sel; + UINT8 towns_palette_select; + UINT8 towns_palette_r[256]; + UINT8 towns_palette_g[256]; + UINT8 towns_palette_b[256]; + UINT8 towns_degipal[8]; + UINT8 towns_dpmd_flag; + UINT8 towns_crtc_mix; + UINT8 towns_crtc_sel; // selected CRTC register + UINT16 towns_crtc_reg[32]; + UINT8 towns_video_sel; // selected video register + UINT8 towns_video_reg[2]; + UINT8 towns_sprite_sel; // selected sprite register + UINT8 towns_sprite_reg[8]; + UINT8 towns_sprite_flag; // sprite drawing flag + UINT8 towns_sprite_page; // VRAM page (not layer) sprites are drawn to + UINT8 towns_tvram_enable; + UINT16 towns_kanji_offset; + UINT8 towns_kanji_code_h; + UINT8 towns_kanji_code_l; + rectangle towns_crtc_layerscr[2]; // each layer has independent sizes + UINT8 towns_display_plane; + UINT8 towns_display_page_sel; + UINT8 towns_vblank_flag; + UINT8 towns_layer_ctrl; + emu_timer* sprite_timer; +}; + +class towns_state : public driver_device +{ + public: + towns_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_pic_master(*this, "pic8259_master"), + m_pic_slave(*this, "pic8259_slave"), + m_pit(*this, "pit"), + m_dma_1(*this, "dma_1"), + m_dma_2(*this, "dma_2"), + m_palette(*this, "palette"), + m_ram(*this, RAM_TAG), + m_fdc(*this, "fdc"), + m_flop0(*this, "fdc:0"), + m_flop1(*this, "fdc:1"), + m_nvram(*this, "nvram"), + m_nvram16(*this, "nvram16"), + m_ctrltype(*this, "ctrltype"), + m_key1(*this, "key1"), + m_key2(*this, "key2"), + m_key3(*this, "key3"), + m_key4(*this, "key4"), + m_joy1(*this, "joy1"), + m_joy2(*this, "joy2"), + m_joy1_ex(*this, "joy1_ex"), + m_joy2_ex(*this, "joy2_ex"), + m_6b_joy1(*this, "6b_joy1"), + m_6b_joy2(*this, "6b_joy2"), + m_6b_joy1_ex(*this, "6b_joy1_ex"), + m_6b_joy2_ex(*this, "6b_joy2_ex"), + m_mouse1(*this, "mouse1"), + m_mouse2(*this, "mouse2"), + m_mouse3(*this, "mouse3"), + m_user(*this,"user"), + m_serial(*this,"serial") + { } + + /* devices */ + required_device m_maincpu; + required_device m_speaker; + required_device m_pic_master; + required_device m_pic_slave; + required_device m_pit; + required_device m_dma_1; + required_device m_dma_2; + required_device m_palette; + required_device m_ram; + required_device m_fdc; + required_device m_flop0; + required_device m_flop1; + ram_device* m_messram; + cdrom_image_device* m_cdrom; + cdda_device* m_cdda; + class fmscsi_device* m_scsi; + + UINT16 m_ftimer; + UINT16 m_freerun_timer; + emu_timer* m_towns_freerun_counter; + UINT16 m_intervaltimer2_period; + UINT8 m_intervaltimer2_irqmask; + UINT8 m_intervaltimer2_timeout_flag; + UINT8 m_intervaltimer2_timeout_flag2; + emu_timer* m_towns_intervaltimer2; + UINT8 m_nmi_mask; + UINT8 m_compat_mode; + UINT8 m_towns_system_port; + UINT32 m_towns_ankcg_enable; + UINT32 m_towns_mainmem_enable; + UINT32 m_towns_ram_enable; + UINT32* m_towns_vram; + UINT8* m_towns_gfxvram; + UINT8* m_towns_txtvram; + int m_towns_selected_drive; + UINT8 m_towns_fdc_irq6mask; + UINT8* m_towns_serial_rom; + int m_towns_srom_position; + UINT8 m_towns_srom_clk; + UINT8 m_towns_srom_reset; + UINT8 m_towns_rtc_select; + UINT8 m_towns_rtc_data; + UINT8 m_towns_rtc_reg[16]; + emu_timer* m_towns_rtc_timer; + UINT8 m_towns_timer_mask; + UINT16 m_towns_machine_id; // default is 0x0101 + UINT8 m_towns_kb_status; + UINT8 m_towns_kb_irq1_enable; + UINT8 m_towns_kb_output; // key output + UINT8 m_towns_kb_extend; // extended key output + emu_timer* m_towns_kb_timer; + emu_timer* m_towns_mouse_timer; + UINT8 m_towns_fm_irq_flag; + UINT8 m_towns_pcm_irq_flag; + UINT8 m_towns_pcm_channel_flag; + UINT8 m_towns_pcm_channel_mask; + UINT8 m_towns_pad_mask; + UINT8 m_towns_mouse_output; + UINT8 m_towns_mouse_x; + UINT8 m_towns_mouse_y; + UINT8 m_towns_volume[8]; // volume ports + UINT8 m_towns_volume_select; + UINT8 m_towns_scsi_control; + UINT8 m_towns_scsi_status; + UINT8 m_towns_spkrdata; + UINT8 m_pit_out0; + UINT8 m_pit_out1; + UINT8 m_pit_out2; + UINT8 m_timer0; + UINT8 m_timer1; + + emu_timer* m_towns_wait_timer; + emu_timer* m_towns_status_timer; + emu_timer* m_towns_cdda_timer; + struct towns_cdrom_controller m_towns_cd; + struct towns_video_controller m_video; + + UINT32 m_kb_prev[4]; + UINT8 m_prev_pad_mask; + UINT8 m_prev_x; + UINT8 m_prev_y; + + optional_shared_ptr m_nvram; + optional_shared_ptr m_nvram16; + + virtual void driver_start(); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + DECLARE_READ8_MEMBER(towns_system_r); + DECLARE_WRITE8_MEMBER(towns_system_w); + DECLARE_READ8_MEMBER(towns_intervaltimer2_r); + DECLARE_WRITE8_MEMBER(towns_intervaltimer2_w); + DECLARE_READ8_MEMBER(towns_sys6c_r); + DECLARE_WRITE8_MEMBER(towns_sys6c_w); + DECLARE_READ8_MEMBER(towns_dma1_r); + DECLARE_WRITE8_MEMBER(towns_dma1_w); + DECLARE_READ8_MEMBER(towns_dma2_r); + DECLARE_WRITE8_MEMBER(towns_dma2_w); + DECLARE_READ8_MEMBER(towns_floppy_r); + DECLARE_WRITE8_MEMBER(towns_floppy_w); + DECLARE_READ8_MEMBER(towns_keyboard_r); + DECLARE_WRITE8_MEMBER(towns_keyboard_w); + DECLARE_READ8_MEMBER(towns_port60_r); + DECLARE_WRITE8_MEMBER(towns_port60_w); + DECLARE_READ8_MEMBER(towns_sys5e8_r); + DECLARE_WRITE8_MEMBER(towns_sys5e8_w); + DECLARE_READ8_MEMBER(towns_sound_ctrl_r); + DECLARE_WRITE8_MEMBER(towns_sound_ctrl_w); + DECLARE_READ8_MEMBER(towns_padport_r); + DECLARE_WRITE8_MEMBER(towns_pad_mask_w); + DECLARE_READ8_MEMBER(towns_cmos8_r); + DECLARE_WRITE8_MEMBER(towns_cmos8_w); + DECLARE_READ8_MEMBER(towns_cmos_low_r); + DECLARE_WRITE8_MEMBER(towns_cmos_low_w); + DECLARE_READ8_MEMBER(towns_cmos_r); + DECLARE_WRITE8_MEMBER(towns_cmos_w); + DECLARE_READ8_MEMBER(towns_sys480_r); + DECLARE_WRITE8_MEMBER(towns_sys480_w); + DECLARE_READ8_MEMBER(towns_video_404_r); + DECLARE_WRITE8_MEMBER(towns_video_404_w); + DECLARE_READ8_MEMBER(towns_cdrom_r); + DECLARE_WRITE8_MEMBER(towns_cdrom_w); + DECLARE_READ8_MEMBER(towns_rtc_r); + DECLARE_WRITE8_MEMBER(towns_rtc_w); + DECLARE_WRITE8_MEMBER(towns_rtc_select_w); + DECLARE_READ8_MEMBER(towns_volume_r); + DECLARE_WRITE8_MEMBER(towns_volume_w); + DECLARE_READ8_MEMBER(towns_41ff_r); + + DECLARE_READ8_MEMBER(towns_gfx_high_r); + DECLARE_WRITE8_MEMBER(towns_gfx_high_w); + DECLARE_READ8_MEMBER(towns_gfx_r); + DECLARE_WRITE8_MEMBER(towns_gfx_w); + DECLARE_READ8_MEMBER(towns_video_cff80_r); + DECLARE_WRITE8_MEMBER(towns_video_cff80_w); + DECLARE_READ8_MEMBER(towns_video_cff80_mem_r); + DECLARE_WRITE8_MEMBER(towns_video_cff80_mem_w); + DECLARE_READ8_MEMBER(towns_video_440_r); + DECLARE_WRITE8_MEMBER(towns_video_440_w); + DECLARE_READ8_MEMBER(towns_video_5c8_r); + DECLARE_WRITE8_MEMBER(towns_video_5c8_w); + DECLARE_READ8_MEMBER(towns_video_fd90_r); + DECLARE_WRITE8_MEMBER(towns_video_fd90_w); + DECLARE_READ8_MEMBER(towns_video_ff81_r); + DECLARE_READ8_MEMBER(towns_video_unknown_r); + DECLARE_WRITE8_MEMBER(towns_video_ff81_w); + DECLARE_READ8_MEMBER(towns_spriteram_low_r); + DECLARE_WRITE8_MEMBER(towns_spriteram_low_w); + DECLARE_READ8_MEMBER(towns_spriteram_r); + DECLARE_WRITE8_MEMBER(towns_spriteram_w); + + DECLARE_WRITE_LINE_MEMBER(mb8877a_irq_w); + DECLARE_WRITE_LINE_MEMBER(mb8877a_drq_w); + DECLARE_WRITE_LINE_MEMBER(pit_out2_changed); + + RF5C68_SAMPLE_END_CB_MEMBER(towns_pcm_irq); + + void towns_update_video_banks(address_space&); + void init_serial_rom(); + void init_rtc(); + void kb_sendcode(UINT8 scancode, int release); + UINT8 speaker_get_spk(); + void speaker_set_spkrdata(UINT8 data); + void speaker_set_input(UINT8 data); + UINT8 towns_cdrom_read_byte_software(); + + required_ioport m_ctrltype; + required_ioport m_key1; + required_ioport m_key2; + required_ioport m_key3; + required_ioport m_key4; + required_ioport m_joy1; + required_ioport m_joy2; + required_ioport m_joy1_ex; + required_ioport m_joy2_ex; + required_ioport m_6b_joy1; + required_ioport m_6b_joy2; + required_ioport m_6b_joy1_ex; + required_ioport m_6b_joy2_ex; + required_ioport m_mouse1; + required_ioport m_mouse2; + required_ioport m_mouse3; + required_memory_region m_user; + optional_memory_region m_serial; + +private: + static const device_timer_id TIMER_RTC = 0; + static const device_timer_id TIMER_FREERUN = 1; + static const device_timer_id TIMER_INTERVAL2 = 2; + static const device_timer_id TIMER_KEYBOARD = 3; + static const device_timer_id TIMER_MOUSE = 4; + static const device_timer_id TIMER_WAIT = 5; + static const device_timer_id TIMER_CDSTATUS = 6; + static const device_timer_id TIMER_CDDA = 7; + void rtc_second(); + void freerun_inc(); + void intervaltimer2_timeout(); + void poll_keyboard(); + void mouse_timeout(); + void wait_end(); + void towns_cd_set_status(UINT8 st0, UINT8 st1, UINT8 st2, UINT8 st3); + void towns_cdrom_execute_command(cdrom_image_device* device); + void towns_cdrom_play_cdda(cdrom_image_device* device); + void towns_cdrom_read(cdrom_image_device* device); + void towns_cd_status_ready(); + void towns_delay_cdda(cdrom_image_device* dev); +public: + INTERRUPT_GEN_MEMBER(towns_vsync_irq); + TIMER_CALLBACK_MEMBER(towns_cdrom_read_byte); + TIMER_CALLBACK_MEMBER(towns_sprite_done); + TIMER_CALLBACK_MEMBER(towns_vblank_end); + DECLARE_WRITE_LINE_MEMBER(towns_scsi_irq); + DECLARE_WRITE_LINE_MEMBER(towns_scsi_drq); + DECLARE_WRITE_LINE_MEMBER(towns_pit_out0_changed); + DECLARE_WRITE_LINE_MEMBER(towns_pit_out1_changed); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE_LINE_MEMBER(towns_fm_irq); + DECLARE_FLOPPY_FORMATS(floppy_formats); + void towns_crtc_refresh_mode(); + void towns_update_kanji_offset(); + void towns_update_palette(); + void render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect); + void render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect); + void draw_sprites(const rectangle* rect); + void towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); + void towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); + void towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); + void towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer); + void render_text_char(UINT8 x, UINT8 y, UINT8 ascii, UINT16 jis, UINT8 attr); + void draw_text_layer(); + inline UINT8 byte_to_bcd(UINT8 val); + inline UINT8 bcd_to_byte(UINT8 val); + inline UINT32 msf_to_lbafm(UINT32 val); // because the CDROM core doesn't provide this; + DECLARE_READ16_MEMBER(towns_fdc_dma_r); + DECLARE_WRITE16_MEMBER(towns_fdc_dma_w); + void towns_cdrom_set_irq(int line,int state); + UINT8 towns_cd_get_track(); + DECLARE_READ16_MEMBER(towns_cdrom_dma_r); + void rtc_hour(); + void rtc_minute(); + DECLARE_READ16_MEMBER(towns_scsi_dma_r); + DECLARE_WRITE16_MEMBER(towns_scsi_dma_w); +}; + +class towns16_state : public towns_state +{ + public: + towns16_state(const machine_config &mconfig, device_type type, const char *tag) + : towns_state(mconfig, type, tag) + { } +}; + +class marty_state : public towns_state +{ + public: + marty_state(const machine_config &mconfig, device_type type, const char *tag) + : towns_state(mconfig, type, tag) + { } + + virtual void driver_start(); +}; + +#endif /*FMTOWNS_H_*/ diff --git a/src/mame/includes/galaxy.h b/src/mame/includes/galaxy.h new file mode 100644 index 00000000000..a115eb146f1 --- /dev/null +++ b/src/mame/includes/galaxy.h @@ -0,0 +1,58 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha, Miodrag Milanovic +/***************************************************************************** + * + * includes/galaxy.h + * + ****************************************************************************/ + +#ifndef GALAXY_H_ +#define GALAXY_H_ + +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" + + +class galaxy_state : public driver_device +{ +public: + galaxy_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_region_gfx1(*this, "gfx1") { } + + int m_interrupts_enabled; + UINT8 m_latch_value; + UINT32 m_gal_cnt; + UINT8 m_code; + UINT8 m_first; + UINT32 m_start_addr; + emu_timer *m_gal_video_timer; + bitmap_ind16 m_bitmap; + DECLARE_READ8_MEMBER(galaxy_keyboard_r); + DECLARE_WRITE8_MEMBER(galaxy_latch_w); + DECLARE_DRIVER_INIT(galaxy); + DECLARE_DRIVER_INIT(galaxyp); + virtual void video_start(); + DECLARE_MACHINE_RESET(galaxy); + DECLARE_MACHINE_RESET(galaxyp); + UINT32 screen_update_galaxy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(galaxy_interrupt); + TIMER_CALLBACK_MEMBER(gal_video); + IRQ_CALLBACK_MEMBER(galaxy_irq_callback); + void galaxy_set_timer(); + void galaxy_setup_snapshot (const UINT8 * data, UINT32 size); + required_device m_maincpu; + DECLARE_SNAPSHOT_LOAD_MEMBER( galaxy ); +protected: + required_device m_cassette; + required_device m_ram; + required_memory_region m_region_gfx1; + ioport_port *m_io_ports[8]; +}; + + +#endif /* GALAXY_H_ */ diff --git a/src/mame/includes/galeb.h b/src/mame/includes/galeb.h new file mode 100644 index 00000000000..a510622818d --- /dev/null +++ b/src/mame/includes/galeb.h @@ -0,0 +1,36 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/galeb.h + * + ****************************************************************************/ + +#ifndef GALEB_H_ +#define GALEB_H_ + + +class galeb_state : public driver_device +{ +public: + galeb_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_video_ram(*this, "video_ram"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + required_shared_ptr m_video_ram; + DECLARE_READ8_MEMBER(galeb_keyboard_r); + virtual void video_start(); + UINT32 screen_update_galeb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; +}; + +/*----------- defined in video/galeb.c -----------*/ + +extern const gfx_layout galeb_charlayout; + +#endif /* GALEB_H_ */ diff --git a/src/mame/includes/gamate.h b/src/mame/includes/gamate.h new file mode 100644 index 00000000000..0a662e60436 --- /dev/null +++ b/src/mame/includes/gamate.h @@ -0,0 +1,100 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/gamate.h + * + ****************************************************************************/ + +#ifndef GAMATE_H_ +#define GAMATE_H_ + +#include "cpu/m6502/m6502.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +// ======================> gamate_sound_device + +class gamate_sound_device : public device_t, public device_sound_interface +{ +public: + gamate_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~gamate_sound_device() { } + + DECLARE_WRITE8_MEMBER( device_w ); + DECLARE_READ8_MEMBER( device_r ); + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + + static const int DAConverter[]; + static int Value2Volume(int volume) { return DAConverter[volume]*1; } + + sound_stream *m_mixer_channel; + struct Tone + { + Tone() : + envelope_on(false), + level(false), + tone(false), full_cycle(false), + volume(0), + pos(0), + size(0) + {} + + bool envelope_on, level; + bool tone/*else noise*/, full_cycle/* else square signal/pulse */; + int volume; + int pos, size; + }; + + enum + { + Right, + Left, + Both + }; + + Tone m_channels[3]; + + struct Noise + { + Noise(): + state(1), + level(false), + step(0.0), + pos(0.0) + {} + + int state; + bool level; + double step, pos; + } noise; + + struct Envelope + { + Envelope(): + control(0), + index(0), + first(false) + {} + + int control; + int index; + bool first; + double step, pos; + } envelope; + + UINT8 reg[14]; +}; + +extern const device_type GAMATE_SND; + +#endif /* GAMATE_H_ */ diff --git a/src/mame/includes/gamecom.h b/src/mame/includes/gamecom.h new file mode 100644 index 00000000000..cbac6041120 --- /dev/null +++ b/src/mame/includes/gamecom.h @@ -0,0 +1,290 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Robbbert +/***************************************************************************** + * + * includes/gamecom.h + * + * Tiger Game.com + * + * Driver by Wilbert Pol + * + ****************************************************************************/ + +#ifndef GAMECOM_H_ +#define GAMECOM_H_ + +#include "emu.h" +#include "cpu/sm8500/sm8500.h" +#include "sound/dac.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "machine/nvram.h" + +/* SM8521 register addresses */ +enum +{ + SM8521_R0 = 0x00, + SM8521_R1 = 0x01, + SM8521_R2 = 0x02, + SM8521_R3 = 0x03, + SM8521_R4 = 0x04, + SM8521_R5 = 0x05, + SM8521_R6 = 0x06, + SM8521_R7 = 0x07, + SM8521_R8 = 0x08, + SM8521_R9 = 0x09, + SM8521_R10 = 0x0A, + SM8521_R11 = 0x0B, + SM8521_R12 = 0x0C, + SM8521_R13 = 0x0D, + SM8521_R14 = 0x0E, + SM8521_R15 = 0x0F, + SM8521_IE0 = 0x10, + SM8521_IE1 = 0x11, + SM8521_IR0 = 0x12, + SM8521_IR1 = 0x13, + SM8521_P0 = 0x14, + SM8521_P1 = 0x15, + SM8521_P2 = 0x16, + SM8521_P3 = 0x17, + SM8521_18 = 0x18, /* reserved */ + SM8521_SYS = 0x19, + SM8521_CKC = 0x1A, + SM8521_1B = 0x1B, /* reserved */ + SM8521_SPH = 0x1C, + SM8521_SPL = 0x1D, + SM8521_PS0 = 0x1E, + SM8521_PS1 = 0x1F, + SM8521_P0C = 0x20, + SM8521_P1C = 0x21, + SM8521_P2C = 0x22, + SM8521_P3C = 0x23, + SM8521_MMU0 = 0x24, + SM8521_MMU1 = 0x25, + SM8521_MMU2 = 0x26, + SM8521_MMU3 = 0x27, + SM8521_MMU4 = 0x28, + SM8521_29 = 0x29, /* reserved */ + SM8521_2A = 0x2A, /* reserved */ + SM8521_URTT = 0x2B, + SM8521_URTR = 0x2C, + SM8521_URTS = 0x2D, + SM8521_URTC = 0x2E, + SM8521_2F = 0x2F, /* reserved */ + SM8521_LCDC = 0x30, + SM8521_LCH = 0x31, + SM8521_LCV = 0x32, + SM8521_33 = 0x33, /* reserved */ + SM8521_DMC = 0x34, + SM8521_DMX1 = 0x35, + SM8521_DMY1 = 0x36, + SM8521_DMDX = 0x37, + SM8521_DMDY = 0x38, + SM8521_DMX2 = 0x39, + SM8521_DMY2 = 0x3A, + SM8521_DMPL = 0x3B, + SM8521_DMBR = 0x3C, + SM8521_DMVP = 0x3D, + SM8521_3E = 0x3E, /* reserved */ + SM8521_3F = 0x3F, /* reserved */ + SM8521_SGC = 0x40, + SM8521_41 = 0x41, /* reserved */ + SM8521_SG0L = 0x42, + SM8521_43 = 0x43, /* reserved */ + SM8521_SG1L = 0x44, + SM8521_45 = 0x45, /* reserved */ + SM8521_SG0TH = 0x46, + SM8521_SG0TL = 0x47, + SM8521_SG1TH = 0x48, + SM8521_SG1TL = 0x49, + SM8521_SG2L = 0x4A, + SM8521_4B = 0x4B, /* reserved */ + SM8521_SG2TH = 0x4C, + SM8521_SG2TL = 0x4D, + SM8521_SGDA = 0x4E, + SM8521_4F = 0x4F, /* reserved */ + SM8521_TM0C = 0x50, + SM8521_TM0D = 0x51, + SM8521_TM1C = 0x52, + SM8521_TM1D = 0x53, + SM8521_CLKT = 0x54, + SM8521_55 = 0x55, /* reserved */ + SM8521_56 = 0x56, /* reserved */ + SM8521_57 = 0x57, /* reserved */ + SM8521_58 = 0x58, /* reserved */ + SM8521_59 = 0x59, /* reserved */ + SM8521_5A = 0x5A, /* reserved */ + SM8521_5B = 0x5B, /* reserved */ + SM8521_5C = 0x5C, /* reserved */ + SM8521_5D = 0x5D, /* reserved */ + SM8521_WDT = 0x5E, + SM8521_WDTC = 0x5F, + SM8521_SG0W0 = 0x60, + SM8521_SG0W1 = 0x61, + SM8521_SG0W2 = 0x62, + SM8521_SG0W3 = 0x63, + SM8521_SG0W4 = 0x64, + SM8521_SG0W5 = 0x65, + SM8521_SG0W6 = 0x66, + SM8521_SG0W7 = 0x67, + SM8521_SG0W8 = 0x68, + SM8521_SG0W9 = 0x69, + SM8521_SG0W10 = 0x6A, + SM8521_SG0W11 = 0x6B, + SM8521_SG0W12 = 0x6C, + SM8521_SG0W13 = 0x6D, + SM8521_SG0W14 = 0x6E, + SM8521_SG0W15 = 0x6F, + SM8521_SG1W0 = 0x70, + SM8521_SG1W1 = 0x71, + SM8521_SG1W2 = 0x72, + SM8521_SG1W3 = 0x73, + SM8521_SG1W4 = 0x74, + SM8521_SG1W5 = 0x75, + SM8521_SG1W6 = 0x76, + SM8521_SG1W7 = 0x77, + SM8521_SG1W8 = 0x78, + SM8521_SG1W9 = 0x79, + SM8521_SG1W10 = 0x7A, + SM8521_SG1W11 = 0x7B, + SM8521_SG1W12 = 0x7C, + SM8521_SG1W13 = 0x7D, + SM8521_SG1W14 = 0x7E, + SM8521_SG1W15 = 0x7F +}; + +struct GAMECOM_DMA +{ + int enabled; + int transfer_mode; + int decrement_y; + int decrement_x; + int overwrite_mode; + int width_x; + int width_y; + int width_x_count; + int width_y_count; + int source_x; + int source_x_current; + int source_y; + int source_width; + int dest_x; + int dest_x_current; + int dest_y; + int dest_width; + int state_count; + int state_pixel; + int state_limit; + UINT8 palette[4]; + UINT8 *source_bank; + unsigned int source_current; + unsigned int source_line; + unsigned int source_mask; + UINT8 *dest_bank; + unsigned int dest_current; + unsigned int dest_line; + unsigned int dest_mask; +}; + +struct GAMECOM_TIMER +{ + int enabled; + int state_count; + int state_limit; + int check_value; +}; + +struct gamecom_sound_t +{ + UINT8 sgc; + UINT8 sg0l; + UINT8 sg1l; + UINT8 sg2l; + UINT16 sg0t; + UINT16 sg1t; + UINT16 sg2t; + UINT8 sgda; + UINT8 sg0w[16]; + UINT8 sg1w[16]; +}; + + +class gamecom_state : public driver_device +{ +public: + gamecom_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_p_videoram(*this,"videoram") + , m_p_nvram(*this,"nvram") + , m_maincpu(*this, "maincpu") + , m_dac(*this, "dac") + , m_cart1(*this, "cartslot1") + , m_cart2(*this, "cartslot2") + , m_bank1(*this, "bank1") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_bank4(*this, "bank4") + , m_region_maincpu(*this, "maincpu") + , m_region_kernel(*this, "kernel") + , m_io_in0(*this, "IN0") + , m_io_in1(*this, "IN1") + , m_io_in2(*this, "IN2") + , m_io_grid(*this, "GRID") + { } + + DECLARE_READ8_MEMBER( gamecom_internal_r ); + DECLARE_READ8_MEMBER( gamecom_pio_r ); + DECLARE_WRITE8_MEMBER( gamecom_internal_w ); + DECLARE_WRITE8_MEMBER( gamecom_pio_w ); + DECLARE_DRIVER_INIT(gamecom); + DECLARE_PALETTE_INIT(gamecom); + INTERRUPT_GEN_MEMBER(gamecom_interrupt); + TIMER_CALLBACK_MEMBER(gamecom_clock_timer_callback); + TIMER_CALLBACK_MEMBER(gamecom_scanline); + DECLARE_WRITE8_MEMBER( gamecom_handle_dma ); + DECLARE_WRITE8_MEMBER( gamecom_update_timers ); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( gamecom_cart1 ); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( gamecom_cart2 ); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +private: + UINT8 *m_p_ram; + UINT8 *m_cart_ptr; + UINT8 m_lcdc_reg; + UINT8 m_lch_reg; + UINT8 m_lcv_reg; + UINT16 m_scanline; + UINT16 m_base_address; + memory_region *m_cart1_rom; + memory_region *m_cart2_rom; + emu_timer *m_clock_timer; + emu_timer *m_scanline_timer; + GAMECOM_DMA m_dma; + GAMECOM_TIMER m_timer[2]; + gamecom_sound_t m_sound; + bitmap_ind16 m_bitmap; + void gamecom_set_mmu(UINT8 mmu, UINT8 data); + void handle_stylus_press(int column); + void recompute_lcd_params(); + void handle_input_press(UINT16 mux_data); + int common_load(device_image_interface &image, generic_slot_device *slot); + virtual void machine_reset(); + virtual void video_start(); + required_shared_ptr m_p_videoram; + required_shared_ptr m_p_nvram; + required_device m_maincpu; + required_device m_dac; + required_device m_cart1; + required_device m_cart2; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_memory_region m_region_maincpu; + required_memory_region m_region_kernel; + required_ioport m_io_in0; + required_ioport m_io_in1; + required_ioport m_io_in2; + required_ioport_array<13> m_io_grid; +}; + +#endif /* GAMECOM_H_ */ diff --git a/src/mame/includes/gamepock.h b/src/mame/includes/gamepock.h new file mode 100644 index 00000000000..678db1dc9f4 --- /dev/null +++ b/src/mame/includes/gamepock.h @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef _GAMEPOCK_H_ +#define _GAMEPOCK_H_ +#include "sound/speaker.h" +#include "bus/generic/slot.h" + +struct HD44102CH { + UINT8 enabled; + UINT8 start_page; + UINT8 address; + UINT8 y_inc; + UINT8 ram[256]; /* There are actually 50 x 4 x 8 bits. This just makes addressing easier. */ +}; + +class gamepock_state : public driver_device +{ +public: + gamepock_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cart(*this, "cartslot") + { } + + virtual void machine_reset(); + + UINT8 m_port_a; + UINT8 m_port_b; + HD44102CH m_hd44102ch[3]; + + void hd44102ch_w( int which, int c_d, UINT8 data ); + void hd44102ch_init( int which ); + void lcd_update(); + + DECLARE_WRITE8_MEMBER( port_a_w ); + DECLARE_READ8_MEMBER( port_b_r ); + DECLARE_WRITE8_MEMBER( port_b_w ); + DECLARE_READ8_MEMBER( port_c_r ); + UINT32 screen_update_gamepock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + required_device m_speaker; + required_device m_cart; + DECLARE_WRITE_LINE_MEMBER(gamepock_to_w); +}; + +#endif diff --git a/src/mame/includes/gb.h b/src/mame/includes/gb.h new file mode 100644 index 00000000000..714daafa832 --- /dev/null +++ b/src/mame/includes/gb.h @@ -0,0 +1,171 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/***************************************************************************** + * + * includes/gb.h + * + ****************************************************************************/ + +#ifndef GB_H_ +#define GB_H_ + +#include "audio/gb.h" +#include "cpu/lr35902/lr35902.h" +#include "bus/gameboy/gb_slot.h" +#include "machine/ram.h" +#include "video/gb_lcd.h" + +/* Interrupts */ +#define VBL_INT 0 /* V-Blank */ +#define LCD_INT 1 /* LCD Status */ +#define TIM_INT 2 /* Timer */ +#define SIO_INT 3 /* Serial I/O */ +#define EXT_INT 4 /* Joypad */ + +#ifdef TIMER +#undef TIMER +#endif + +/* Cartridge types */ +#define CART_RAM 0x01 /* Cartridge has RAM */ +#define BATTERY 0x02 /* Cartridge has a battery to save RAM */ +#define TIMER 0x04 /* Cartridge has a real-time-clock (MBC3 only) */ +#define RUMBLE 0x08 /* Cartridge has a rumble motor (MBC5 only) */ +#define SRAM 0x10 /* Cartridge has SRAM */ +#define UNKNOWN 0x80 /* Cartridge is of an unknown type */ + +#define DMG_FRAMES_PER_SECOND 59.732155 +#define SGB_FRAMES_PER_SECOND 61.17 + + +#define MAX_ROMBANK 512 +#define MAX_RAMBANK 256 + + + +class gb_state : public driver_device +{ +public: + gb_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cartslot(*this, "gbslot"), + m_maincpu(*this, "maincpu"), + m_custom(*this, "custom"), + m_region_maincpu(*this, "maincpu"), + m_rambank(*this, "cgb_ram"), + m_inputs(*this, "INPUTS"), + m_bios_hack(*this, "SKIP_CHECK"), + m_ram(*this, RAM_TAG), + m_lcd(*this, "lcd") { } + + //gb_state driver_data; + UINT8 m_gb_io[0x10]; + + /* Timer related */ + UINT16 m_divcount; + UINT8 m_shift; + UINT16 m_shift_cycles; + UINT8 m_triggering_irq; + UINT8 m_reloading; + + /* Serial I/O related */ + UINT32 m_sio_count; /* Serial I/O counter */ + emu_timer *m_gb_serial_timer; + + /* SGB variables */ + INT8 m_sgb_packets; + UINT8 m_sgb_bitcount; + UINT8 m_sgb_bytecount; + UINT8 m_sgb_start; + UINT8 m_sgb_rest; + UINT8 m_sgb_controller_no; + UINT8 m_sgb_controller_mode; + UINT8 m_sgb_data[0x100]; + + /* CGB variables */ + UINT8 *m_gbc_rammap[8]; /* (CGB) Addresses of internal RAM banks */ + UINT8 m_gbc_rambank; /* (CGB) Current CGB RAM bank */ + + int m_bios_disable; + + DECLARE_WRITE8_MEMBER(gb_io_w); + DECLARE_WRITE8_MEMBER(gb_io2_w); + DECLARE_WRITE8_MEMBER(sgb_io_w); + DECLARE_READ8_MEMBER(gb_ie_r); + DECLARE_WRITE8_MEMBER(gb_ie_w); + DECLARE_READ8_MEMBER(gb_io_r); + DECLARE_WRITE8_MEMBER(gbc_io2_w); + DECLARE_READ8_MEMBER(gbc_io2_r); + DECLARE_PALETTE_INIT(gb); + DECLARE_MACHINE_START(sgb); + DECLARE_MACHINE_RESET(sgb); + DECLARE_PALETTE_INIT(sgb); + DECLARE_PALETTE_INIT(gbp); + DECLARE_MACHINE_START(gbc); + DECLARE_MACHINE_RESET(gbc); + DECLARE_PALETTE_INIT(gbc); + TIMER_CALLBACK_MEMBER(gb_serial_timer_proc); + DECLARE_WRITE8_MEMBER(gb_timer_callback); + + DECLARE_READ8_MEMBER(gb_cart_r); + DECLARE_READ8_MEMBER(gbc_cart_r); + DECLARE_WRITE8_MEMBER(gb_bank_w); + DECLARE_READ8_MEMBER(gb_ram_r); + DECLARE_WRITE8_MEMBER(gb_ram_w); + DECLARE_READ8_MEMBER(gb_echo_r); + DECLARE_WRITE8_MEMBER(gb_echo_w); + optional_device m_cartslot; + +protected: + required_device m_maincpu; + required_device m_custom; + required_memory_region m_region_maincpu; + optional_memory_bank m_rambank; // cgb + required_ioport m_inputs; + required_ioport m_bios_hack; + optional_device m_ram; + required_device m_lcd; + + void gb_timer_increment(); + void gb_timer_check_irq(); + void gb_init(); + void gb_init_regs(); + void gb_video_reset(int mode); + void gb_video_start(int mode); + + void save_gb_base(); + void save_gbc_only(); + void save_sgb_only(); + + virtual void machine_start(); + virtual void machine_reset(); +}; + + +class megaduck_state : public gb_state +{ +public: + megaduck_state(const machine_config &mconfig, device_type type, const char *tag) + : gb_state(mconfig, type, tag) + , m_cartslot(*this, "duckslot") + { } + + DECLARE_READ8_MEMBER(megaduck_video_r); + DECLARE_WRITE8_MEMBER(megaduck_video_w); + DECLARE_WRITE8_MEMBER(megaduck_sound_w1); + DECLARE_READ8_MEMBER(megaduck_sound_r1); + DECLARE_WRITE8_MEMBER(megaduck_sound_w2); + DECLARE_READ8_MEMBER(megaduck_sound_r2); + DECLARE_MACHINE_START(megaduck); + DECLARE_MACHINE_RESET(megaduck); + DECLARE_PALETTE_INIT(megaduck); + + DECLARE_READ8_MEMBER(cart_r); + DECLARE_WRITE8_MEMBER(bank1_w); + DECLARE_WRITE8_MEMBER(bank2_w); + optional_device m_cartslot; +}; + + + +#endif /* GB_H_ */ diff --git a/src/mame/includes/gba.h b/src/mame/includes/gba.h new file mode 100644 index 00000000000..58637b0275f --- /dev/null +++ b/src/mame/includes/gba.h @@ -0,0 +1,279 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont,Ryan Holtz +#ifndef _GBA_H_ +#define _GBA_H_ + +#include "audio/gb.h" +#include "machine/intelfsh.h" +#include "bus/gba/gba_slot.h" +#include "sound/dac.h" + +#define DISPSTAT_VBL 0x0001 +#define DISPSTAT_HBL 0x0002 +#define DISPSTAT_VCNT 0x0004 +#define DISPSTAT_VBL_IRQ_EN 0x0008 +#define DISPSTAT_HBL_IRQ_EN 0x0010 +#define DISPSTAT_VCNT_IRQ_EN 0x0020 +#define DISPSTAT_VCNT_VALUE 0xff00 + +#define INT_VBL 0x0001 +#define INT_HBL 0x0002 +#define INT_VCNT 0x0004 +#define INT_TM0_OVERFLOW 0x0008 +#define INT_TM1_OVERFLOW 0x0010 +#define INT_TM2_OVERFLOW 0x0020 +#define INT_TM3_OVERFLOW 0x0040 +#define INT_SIO 0x0080 +#define INT_DMA0 0x0100 +#define INT_DMA1 0x0200 +#define INT_DMA2 0x0400 +#define INT_DMA3 0x0800 +#define INT_KEYPAD 0x1000 +#define INT_GAMEPAK 0x2000 + +#define DISPCNT_MODE 0x0007 +#define DISPCNT_FRAMESEL 0x0010 +#define DISPCNT_HBL_FREE 0x0020 + +#define DISPCNT_VRAM_MAP 0x0040 +#define DISPCNT_VRAM_MAP_2D 0x0000 +#define DISPCNT_VRAM_MAP_1D 0x0040 + +#define DISPCNT_BLANK 0x0080 +#define DISPCNT_BG0_EN 0x0100 +#define DISPCNT_BG1_EN 0x0200 +#define DISPCNT_BG2_EN 0x0400 +#define DISPCNT_BG3_EN 0x0800 +#define DISPCNT_OBJ_EN 0x1000 +#define DISPCNT_WIN0_EN 0x2000 +#define DISPCNT_WIN1_EN 0x4000 +#define DISPCNT_OBJWIN_EN 0x8000 + +#define OBJ_Y_COORD 0x00ff +#define OBJ_ROZMODE 0x0300 +#define OBJ_ROZMODE_NONE 0x0000 +#define OBJ_ROZMODE_ROZ 0x0100 +#define OBJ_ROZMODE_DISABLE 0x0200 +#define OBJ_ROZMODE_DBLROZ 0x0300 + +#define OBJ_MODE 0x0c00 +#define OBJ_MODE_NORMAL 0x0000 +#define OBJ_MODE_ALPHA 0x0400 +#define OBJ_MODE_WINDOW 0x0800 +#define OBJ_MODE_UNDEFINED 0x0c00 + +#define OBJ_MOSAIC 0x1000 + +#define OBJ_PALMODE 0x2000 +#define OBJ_PALMODE_16 0x0000 +#define OBJ_PALMODE_256 0x2000 + +#define OBJ_SHAPE 0xc000 +#define OBJ_SHAPE_SQR 0x0000 +#define OBJ_SHAPE_HORIZ 0x4000 +#define OBJ_SHAPE_VERT 0x8000 + +#define OBJ_X_COORD 0x01ff +#define OBJ_SCALE_PARAM 0x3e00 +#define OBJ_SCALE_PARAM_SHIFT 9 +#define OBJ_HFLIP 0x1000 +#define OBJ_VFLIP 0x2000 +#define OBJ_SIZE 0xc000 +#define OBJ_SIZE_8 0x0000 +#define OBJ_SIZE_16 0x4000 +#define OBJ_SIZE_32 0x8000 +#define OBJ_SIZE_64 0xc000 + +#define OBJ_TILENUM 0x03ff +#define OBJ_PRIORITY 0x0c00 +#define OBJ_PRIORITY_SHIFT 10 +#define OBJ_PALNUM 0xf000 +#define OBJ_PALNUM_SHIFT 12 + +#define BGCNT_SCREENSIZE 0xc000 +#define BGCNT_SCREENSIZE_SHIFT 14 +#define BGCNT_PALETTESET_WRAP 0x2000 +#define BGCNT_SCREENBASE 0x1f00 +#define BGCNT_SCREENBASE_SHIFT 8 +#define BGCNT_PALETTE256 0x0080 +#define BGCNT_MOSAIC 0x0040 +#define BGCNT_CHARBASE 0x003c +#define BGCNT_CHARBASE_SHIFT 2 +#define BGCNT_PRIORITY 0x0003 + +#define BLDCNT_BG0TP1 0x0001 +#define BLDCNT_BG1TP1 0x0002 +#define BLDCNT_BG2TP1 0x0004 +#define BLDCNT_BG3TP1 0x0008 +#define BLDCNT_OBJTP1 0x0010 +#define BLDCNT_BDTP1 0x0020 +#define BLDCNT_SFX 0x00c0 +#define BLDCNT_SFX_NONE 0x0000 +#define BLDCNT_SFX_ALPHA 0x0040 +#define BLDCNT_SFX_LIGHTEN 0x0080 +#define BLDCNT_SFX_DARKEN 0x00c0 +#define BLDCNT_BG0TP2 0x0100 +#define BLDCNT_BG1TP2 0x0200 +#define BLDCNT_BG2TP2 0x0400 +#define BLDCNT_BG3TP2 0x0800 +#define BLDCNT_OBJTP2 0x1000 +#define BLDCNT_BDTP2 0x2000 +#define BLDCNT_TP2_SHIFT 8 + +#define TILEOBJ_TILE 0x03ff +#define TILEOBJ_HFLIP 0x0400 +#define TILEOBJ_VFLIP 0x0800 +#define TILEOBJ_PALETTE 0xf000 + +/* driver state */ +class gba_state : public driver_device +{ +public: + gba_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gba_pram(*this, "gba_pram"), + m_gba_vram(*this, "gba_vram"), + m_gba_oam(*this, "gba_oam"), + m_ladac(*this, "direct_a_left"), + m_radac(*this, "direct_a_right"), + m_lbdac(*this, "direct_b_left"), + m_rbdac(*this, "direct_b_right"), + m_gbsound(*this, "custom"), + m_cart(*this, "cartslot"), + m_region_maincpu(*this, "maincpu"), + m_io_inputs(*this, "INPUTS"), + m_bios_hack(*this, "SKIP_CHECK") + { } + + required_device m_maincpu; + required_shared_ptr m_gba_pram; + required_shared_ptr m_gba_vram; + required_shared_ptr m_gba_oam; + required_device m_ladac; + required_device m_radac; + required_device m_lbdac; + required_device m_rbdac; + required_device m_gbsound; + required_device m_cart; + + void request_irq(UINT32 int_type); + void dma_exec(FPTR ch); + void audio_tick(int ref); + + // video-related + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + bitmap_ind16 m_bitmap; + + UINT32 m_DISPSTAT; + UINT32 m_BG2X, m_BG2Y, m_BG3X, m_BG3Y; + UINT16 m_DISPCNT, m_GRNSWAP; + UINT16 m_BG0CNT, m_BG1CNT, m_BG2CNT, m_BG3CNT; + UINT16 m_BG0HOFS, m_BG0VOFS, m_BG1HOFS, m_BG1VOFS, m_BG2HOFS, m_BG2VOFS, m_BG3HOFS, m_BG3VOFS; + UINT16 m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, m_BG3PA, m_BG3PB, m_BG3PC, m_BG3PD; + UINT16 m_WIN0H, m_WIN1H, m_WIN0V, m_WIN1V, m_WININ, m_WINOUT; + UINT16 m_MOSAIC; + UINT16 m_BLDCNT; + UINT16 m_BLDALPHA; + UINT16 m_BLDY; + UINT8 m_SOUNDCNT_X; + UINT16 m_SOUNDCNT_H; + UINT16 m_SOUNDBIAS; + UINT16 m_SIOMULTI0, m_SIOMULTI1, m_SIOMULTI2, m_SIOMULTI3; + UINT16 m_SIOCNT, m_SIODATA8; + UINT16 m_KEYCNT; + UINT16 m_RCNT; + UINT16 m_JOYCNT; + UINT32 m_JOY_RECV, m_JOY_TRANS; + UINT16 m_JOYSTAT; + UINT16 m_IR, m_IE, m_IF, m_IME; + UINT16 m_WAITCNT; + UINT8 m_POSTFLG; + UINT8 m_HALTCNT; + + UINT8 m_windowOn; + UINT8 m_fxOn; + UINT8 m_gfxBG2Changed; + UINT8 m_gfxBG3Changed; + INT32 m_gfxBG2X; + INT32 m_gfxBG2Y; + INT32 m_gfxBG3X; + INT32 m_gfxBG3Y; + + // DMA + emu_timer *m_dma_timer[4]; + UINT32 m_dma_regs[16]; + UINT32 m_dma_src[4]; + UINT32 m_dma_dst[4]; + UINT32 m_dma_cnt[4]; + UINT32 m_dma_srcadd[4]; + UINT32 m_dma_dstadd[4]; + + // Timers + UINT32 m_timer_regs[4]; + UINT16 m_timer_reload[4]; + int m_timer_recalc[4]; + + emu_timer *m_tmr_timer[4], *m_irq_timer; + emu_timer *m_scan_timer, *m_hbl_timer; + + double m_timer_hz[4]; + + int m_fifo_a_ptr; + int m_fifo_b_ptr; + int m_fifo_a_in; + int m_fifo_b_in; + UINT8 m_fifo_a[20]; + UINT8 m_fifo_b[20]; + UINT32 m_xferscan[7][240+2048]; + + UINT32 m_bios_last_address; + int m_bios_protected; + + DIRECT_UPDATE_MEMBER(gba_direct); + DECLARE_READ32_MEMBER(gba_io_r); + DECLARE_WRITE32_MEMBER(gba_io_w); + DECLARE_WRITE32_MEMBER(gba_pram_w); + DECLARE_WRITE32_MEMBER(gba_vram_w); + DECLARE_WRITE32_MEMBER(gba_oam_w); + DECLARE_READ32_MEMBER(gba_bios_r); + DECLARE_READ32_MEMBER(gba_10000000_r); + DECLARE_READ32_MEMBER(sram_r); + DECLARE_WRITE32_MEMBER(sram_w); + DECLARE_READ32_MEMBER(flash_r); + DECLARE_WRITE32_MEMBER(flash_w); + DECLARE_READ32_MEMBER(eeprom_r); + DECLARE_WRITE32_MEMBER(eeprom_w); + DECLARE_DRIVER_INIT(gbadv); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(gba); + TIMER_CALLBACK_MEMBER(dma_complete); + TIMER_CALLBACK_MEMBER(timer_expire); + TIMER_CALLBACK_MEMBER(handle_irq); + TIMER_CALLBACK_MEMBER(perform_hbl); + TIMER_CALLBACK_MEMBER(perform_scan); + + // video related + void draw_scanline(int y); + + void draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth); + void draw_roz_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed); + void draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, UINT32 hofs, UINT32 vofs); + void draw_gba_oam_window(UINT32 *scanline, int y); + void draw_gba_oam(UINT32 *scanline, int y); + + inline int is_in_window(int x, int window); + + inline void update_mask(UINT8* mask, int mode, int submode, UINT32* obj_win, UINT8 inwin0, UINT8 inwin1, UINT8 in0_mask, UINT8 in1_mask, UINT8 out_mask); + void draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); + +protected: + required_region_ptr m_region_maincpu; + required_ioport m_io_inputs; + required_ioport m_bios_hack; +}; + + +#endif diff --git a/src/mame/includes/genpc.h b/src/mame/includes/genpc.h new file mode 100644 index 00000000000..08cc742aa7f --- /dev/null +++ b/src/mame/includes/genpc.h @@ -0,0 +1,202 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Miodrag Milanovic +/***************************************************************************** + * + * includes/pc.h + * + ****************************************************************************/ + +#ifndef GENPC_H_ +#define GENPC_H_ + +#include "machine/ins8250.h" +#include "machine/i8255.h" +#include "machine/am9517a.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "bus/pc_kbd/pc_kbdc.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "sound/speaker.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" + +#define MCFG_IBM5160_MOTHERBOARD_ADD(_tag, _cputag) \ + MCFG_DEVICE_ADD(_tag, IBM5160_MOTHERBOARD, 0) \ + ibm5160_mb_device::static_set_cputag(*device, _cputag); +// ======================> ibm5160_mb_device +class ibm5160_mb_device : public device_t +{ +public: + // construction/destruction + ibm5160_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + // inline configuration + static void static_set_cputag(device_t &device, const char *tag); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler); +public: + required_device m_maincpu; + required_device m_pic8259; + required_device m_dma8237; + required_device m_pit8253; + optional_device m_ppi8255; + required_device m_speaker; + required_device m_isabus; + optional_device m_pc_kbdc; + required_device m_ram; + + /* U73 is an LS74 - dual flip flop */ + /* Q2 is set by OUT1 from the 8253 and goes to DRQ1 on the 8237 */ + UINT8 m_u73_q2; + UINT8 m_out1; + int m_dma_channel; + UINT8 m_dma_offset[4]; + UINT8 m_pc_spkrdata; + UINT8 m_pit_out2; + bool m_cur_eop; + + UINT8 m_nmi_enabled; + + int m_ppi_portc_switch_high; + int m_ppi_speaker; + int m_ppi_keyboard_clear; + UINT8 m_ppi_keyb_clock; + UINT8 m_ppi_portb; + UINT8 m_ppi_clock_signal; + UINT8 m_ppi_data_signal; + UINT8 m_ppi_shift_register; + UINT8 m_ppi_shift_enable; + + // interface to the keyboard + virtual DECLARE_WRITE_LINE_MEMBER( keyboard_clock_w ); + DECLARE_WRITE_LINE_MEMBER( keyboard_data_w ); + + virtual DECLARE_READ8_MEMBER ( pc_ppi_porta_r ); + virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r ); + virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w ); + + DECLARE_WRITE_LINE_MEMBER( pc_pit8253_out1_changed ); + DECLARE_WRITE_LINE_MEMBER( pc_pit8253_out2_changed ); + + DECLARE_WRITE_LINE_MEMBER( pc_dma_hrq_changed ); + DECLARE_WRITE_LINE_MEMBER( pc_dma8237_out_eop ); + DECLARE_READ8_MEMBER( pc_dma_read_byte ); + DECLARE_WRITE8_MEMBER( pc_dma_write_byte ); + DECLARE_READ8_MEMBER( pc_dma8237_1_dack_r ); + DECLARE_READ8_MEMBER( pc_dma8237_2_dack_r ); + DECLARE_READ8_MEMBER( pc_dma8237_3_dack_r ); + DECLARE_WRITE8_MEMBER( pc_dma8237_1_dack_w ); + DECLARE_WRITE8_MEMBER( pc_dma8237_2_dack_w ); + DECLARE_WRITE8_MEMBER( pc_dma8237_3_dack_w ); + DECLARE_WRITE8_MEMBER( pc_dma8237_0_dack_w ); + DECLARE_WRITE_LINE_MEMBER( pc_dack0_w ); + DECLARE_WRITE_LINE_MEMBER( pc_dack1_w ); + DECLARE_WRITE_LINE_MEMBER( pc_dack2_w ); + DECLARE_WRITE_LINE_MEMBER( pc_dack3_w ); + + DECLARE_WRITE_LINE_MEMBER( pc_speaker_set_spkrdata ); + + DECLARE_READ8_MEMBER(pc_page_r); + DECLARE_WRITE8_MEMBER(pc_page_w); + DECLARE_WRITE8_MEMBER(nmi_enable_w); + + const char *m_cputag; + +private: + void pc_select_dma_channel(int channel, bool state); +}; + + +// device type definition +extern const device_type IBM5160_MOTHERBOARD; + + +#define MCFG_IBM5150_MOTHERBOARD_ADD(_tag, _cputag) \ + MCFG_DEVICE_ADD(_tag, IBM5150_MOTHERBOARD, 0) \ + ibm5150_mb_device::static_set_cputag(*device, _cputag); + +// ======================> ibm5150_mb_device +class ibm5150_mb_device : public ibm5160_mb_device +{ +public: + // construction/destruction + ibm5150_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + + virtual DECLARE_WRITE_LINE_MEMBER( keyboard_clock_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + required_device m_cassette; +public: + virtual DECLARE_READ8_MEMBER ( pc_ppi_porta_r ); + virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r ); + virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w ); +}; + + +// device type definition +extern const device_type IBM5150_MOTHERBOARD; + + +#define MCFG_EC1841_MOTHERBOARD_ADD(_tag, _cputag) \ + MCFG_DEVICE_ADD(_tag, EC1841_MOTHERBOARD, 0) \ + ec1841_mb_device::static_set_cputag(*device, _cputag); + +class ec1841_mb_device : public ibm5160_mb_device +{ +public: + // construction/destruction + ec1841_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +public: + virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r ); + virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w ); + + virtual DECLARE_WRITE_LINE_MEMBER( keyboard_clock_w ); +}; + +extern const device_type EC1841_MOTHERBOARD; + +#define MCFG_PCNOPPI_MOTHERBOARD_ADD(_tag, _cputag) \ + MCFG_DEVICE_ADD(_tag, PCNOPPI_MOTHERBOARD, 0) \ + pc_noppi_mb_device::static_set_cputag(*device, _cputag); + +class pc_noppi_mb_device : public ibm5160_mb_device +{ +public: + // construction/destruction + pc_noppi_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; +protected: + // device-level overrides + void device_start(); +}; + +extern const device_type PCNOPPI_MOTHERBOARD; + +#endif /* GENPC_H_ */ diff --git a/src/mame/includes/gp32.h b/src/mame/includes/gp32.h new file mode 100644 index 00000000000..a3754f5b9aa --- /dev/null +++ b/src/mame/includes/gp32.h @@ -0,0 +1,250 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +#ifndef _GP32_H_ +#define _GP32_H_ + +#include "machine/smartmed.h" +#include "sound/dac.h" +#include "machine/nvram.h" + + +#define INT_ADC 31 +#define INT_RTC 30 +#define INT_UTXD1 29 +#define INT_UTXD0 28 +#define INT_IIC 27 +#define INT_USBH 26 +#define INT_USBD 25 +#define INT_URXD1 24 +#define INT_URXD0 23 +#define INT_SPI 22 +#define INT_MMC 21 +#define INT_DMA3 20 +#define INT_DMA2 19 +#define INT_DMA1 18 +#define INT_DMA0 17 +#define INT_RESERVED 16 +#define INT_UERR 15 +#define INT_TIMER4 14 +#define INT_TIMER3 13 +#define INT_TIMER2 12 +#define INT_TIMER1 11 +#define INT_TIMER0 10 +#define INT_WDT 9 +#define INT_TICK 8 +#define INT_EINT7 7 +#define INT_EINT6 6 +#define INT_EINT5 5 +#define INT_EINT4 4 +#define INT_EINT3 3 +#define INT_EINT2 2 +#define INT_EINT1 1 +#define INT_EINT0 0 + +struct s3c240x_lcd_t +{ + UINT32 vramaddr_cur; + UINT32 vramaddr_max; + UINT32 offsize; + UINT32 pagewidth_cur; + UINT32 pagewidth_max; + UINT32 bppmode; + UINT32 bswp, hwswp; + UINT32 hozval, lineval; + int vpos, hpos; +}; + +struct smc_t +{ + int add_latch; + int chip; + int cmd_latch; + int do_read; + int do_write; + int read; + int wp; + int busy; + UINT8 datarx; + UINT8 datatx; +}; + +struct i2s_t +{ + int l3d; + int l3m; + int l3c; +}; + +struct s3c240x_iic_t +{ + UINT8 data[4]; + int data_index; + UINT16 address; +}; + +struct s3c240x_iis_t +{ + UINT16 fifo[16/2]; + int fifo_index; +}; + + +class gp32_state : public driver_device +{ +public: + gp32_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_s3c240x_ram(*this, "s3c240x_ram"), + m_maincpu(*this, "maincpu"), + m_smartmedia(*this, "smartmedia"), + m_dac1(*this, "dac1"), + m_dac2(*this, "dac2"), + m_nvram(*this, "nvram"), + m_io_in0(*this, "IN0"), + m_io_in1(*this, "IN1"), + m_palette(*this, "palette") { } + + virtual void video_start(); + + required_shared_ptr m_s3c240x_ram; + UINT8 *m_eeprom_data; + UINT32 m_s3c240x_lcd_regs[0x400/4]; + emu_timer *m_s3c240x_lcd_timer; + s3c240x_lcd_t m_s3c240x_lcd; + UINT32 m_s3c240x_lcd_palette[0x400/4]; + UINT32 m_s3c240x_clkpow_regs[0x18/4]; + UINT32 m_s3c240x_irq_regs[0x18/4]; + emu_timer *m_s3c240x_pwm_timer[5]; + UINT32 m_s3c240x_pwm_regs[0x44/4]; + emu_timer *m_s3c240x_dma_timer[4]; + UINT32 m_s3c240x_dma_regs[0x7c/4]; + smc_t m_smc; + i2s_t m_i2s; + UINT32 m_s3c240x_gpio[0x60/4]; + UINT32 m_s3c240x_memcon_regs[0x34/4]; + UINT32 m_s3c240x_usb_host_regs[0x5C/4]; + UINT32 m_s3c240x_uart_0_regs[0x2C/4]; + UINT32 m_s3c240x_uart_1_regs[0x2C/4]; + UINT32 m_s3c240x_usb_device_regs[0xBC/4]; + UINT32 m_s3c240x_watchdog_regs[0x0C/4]; + s3c240x_iic_t m_s3c240x_iic; + emu_timer *m_s3c240x_iic_timer; + UINT32 m_s3c240x_iic_regs[0x10/4]; + s3c240x_iis_t m_s3c240x_iis; + emu_timer *m_s3c240x_iis_timer; + UINT32 m_s3c240x_iis_regs[0x14/4]; + UINT32 m_s3c240x_rtc_regs[0x4C/4]; + UINT32 m_s3c240x_adc_regs[0x08/4]; + UINT32 m_s3c240x_spi_regs[0x18/4]; + UINT32 m_s3c240x_mmc_regs[0x40/4]; + bitmap_rgb32 m_bitmap; + DECLARE_READ32_MEMBER(s3c240x_lcd_r); + DECLARE_WRITE32_MEMBER(s3c240x_lcd_w); + DECLARE_READ32_MEMBER(s3c240x_lcd_palette_r); + DECLARE_WRITE32_MEMBER(s3c240x_lcd_palette_w); + DECLARE_READ32_MEMBER(s3c240x_clkpow_r); + DECLARE_WRITE32_MEMBER(s3c240x_clkpow_w); + DECLARE_READ32_MEMBER(s3c240x_irq_r); + DECLARE_WRITE32_MEMBER(s3c240x_irq_w); + DECLARE_READ32_MEMBER(s3c240x_pwm_r); + DECLARE_WRITE32_MEMBER(s3c240x_pwm_w); + DECLARE_READ32_MEMBER(s3c240x_dma_r); + DECLARE_WRITE32_MEMBER(s3c240x_dma_w); + DECLARE_READ32_MEMBER(s3c240x_gpio_r); + DECLARE_WRITE32_MEMBER(s3c240x_gpio_w); + DECLARE_READ32_MEMBER(s3c240x_memcon_r); + DECLARE_WRITE32_MEMBER(s3c240x_memcon_w); + DECLARE_READ32_MEMBER(s3c240x_usb_host_r); + DECLARE_WRITE32_MEMBER(s3c240x_usb_host_w); + DECLARE_READ32_MEMBER(s3c240x_uart_0_r); + DECLARE_WRITE32_MEMBER(s3c240x_uart_0_w); + DECLARE_READ32_MEMBER(s3c240x_uart_1_r); + DECLARE_WRITE32_MEMBER(s3c240x_uart_1_w); + DECLARE_READ32_MEMBER(s3c240x_usb_device_r); + DECLARE_WRITE32_MEMBER(s3c240x_usb_device_w); + DECLARE_READ32_MEMBER(s3c240x_watchdog_r); + DECLARE_WRITE32_MEMBER(s3c240x_watchdog_w); + DECLARE_READ32_MEMBER(s3c240x_iic_r); + DECLARE_WRITE32_MEMBER(s3c240x_iic_w); + DECLARE_READ32_MEMBER(s3c240x_iis_r); + DECLARE_WRITE32_MEMBER(s3c240x_iis_w); + DECLARE_READ32_MEMBER(s3c240x_rtc_r); + DECLARE_WRITE32_MEMBER(s3c240x_rtc_w); + DECLARE_READ32_MEMBER(s3c240x_adc_r); + DECLARE_WRITE32_MEMBER(s3c240x_adc_w); + DECLARE_READ32_MEMBER(s3c240x_spi_r); + DECLARE_WRITE32_MEMBER(s3c240x_spi_w); + DECLARE_READ32_MEMBER(s3c240x_mmc_r); + DECLARE_WRITE32_MEMBER(s3c240x_mmc_w); + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update_gp32(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(s3c240x_lcd_timer_exp); + TIMER_CALLBACK_MEMBER(s3c240x_pwm_timer_exp); + TIMER_CALLBACK_MEMBER(s3c240x_dma_timer_exp); + TIMER_CALLBACK_MEMBER(s3c240x_iic_timer_exp); + TIMER_CALLBACK_MEMBER(s3c240x_iis_timer_exp); +protected: + required_device m_maincpu; + required_device m_smartmedia; + required_device m_dac1; + required_device m_dac2; + required_device m_nvram; + required_ioport m_io_in0; + required_ioport m_io_in1; + required_device m_palette; + + UINT32 s3c240x_get_fclk(int reg); + UINT32 s3c240x_get_hclk(int reg); + UINT32 s3c240x_get_pclk(int reg); + void s3c240x_lcd_dma_reload(); + void s3c240x_lcd_dma_init(); + void s3c240x_lcd_configure(); + void s3c240x_lcd_start(); + void s3c240x_lcd_stop(); + void s3c240x_lcd_recalc(); + void s3c240x_check_pending_irq(); + void s3c240x_request_irq(UINT32 int_type); + void s3c240x_dma_reload(int dma); + void s3c240x_dma_trigger(int dma); + void s3c240x_dma_request_iis(); + void s3c240x_dma_request_pwm(); + void s3c240x_dma_start(int dma); + void s3c240x_dma_stop(int dma); + void s3c240x_dma_recalc(int dma); + void s3c240x_pwm_start(int timer); + void s3c240x_pwm_stop(int timer); + void s3c240x_pwm_recalc(int timer); + void s3c240x_iis_start(); + void s3c240x_iis_stop(); + void s3c240x_iis_recalc(); + void smc_reset(); + void smc_init(); + UINT8 smc_read(); + void smc_write(UINT8 data); + void smc_update(); + void i2s_reset(); + void i2s_init(); + void i2s_write(int line, int data); + UINT8 eeprom_read(UINT16 address); + void eeprom_write(UINT16 address, UINT8 data); + void iic_start(); + void iic_stop(); + void iic_resume(); + void s3c240x_machine_start(); + void s3c240x_machine_reset(); + inline rgb_t s3c240x_get_color_5551( UINT16 data); + UINT32 s3c240x_lcd_dma_read( ); + void s3c240x_lcd_render_01( ); + void s3c240x_lcd_render_02( ); + void s3c240x_lcd_render_04( ); + void s3c240x_lcd_render_08( ); + void s3c240x_lcd_render_16( ); + UINT8 i2cmem_read_byte( int last); + void i2cmem_write_byte( UINT8 data); + void i2cmem_start( ); + void i2cmem_stop( ); +}; + + +#endif diff --git a/src/mame/includes/hec2hrp.h b/src/mame/includes/hec2hrp.h new file mode 100644 index 00000000000..c30b7bfccd3 --- /dev/null +++ b/src/mame/includes/hec2hrp.h @@ -0,0 +1,199 @@ +// license:BSD-3-Clause +// copyright-holders:JJ Stacino +///////////////////////////////////////////////////////////////////// +////// HECTOR HEADER FILE ///////////////////////////////////////// +///////////////////////////////////////////////////////////////////// +/* + Hector 2HR+ + Victor + Hector 2HR + Hector HRX + Hector MX40c + Hector MX80c + Hector 1 + Interact + + 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com + 31/06/2009 Video - Robbbert + + 29/10/2009 Update skeleton to functional machine + by yo_fr (jj.stac @ aliceadsl.fr) + + => add Keyboard, + => add color, + => add cassette, + => add sn76477 sound and 1bit sound, + => add joysticks (stick, pot, fire) + => add BR/HR switching + => add bank switch for HRX + => add device MX80c and bank switching for the ROM + 03/01/2010 Update and clean prog by yo_fr (jj.stac@aliceadsl.fr) + => add the port mapping for keyboard + 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M runnig! JJStacino + 11/11/2011 : add the minidisque support -3 pouces 1/2 driver- JJStacino (jj.stac @ aliceadsl.fr) + + don't forget to keep some information about these machine see DChector project : http://dchector.free.fr/ made by DanielCoulom + (and thank's to Daniel!) and Yves site : http://hectorvictor.free.fr/ (thank's too Yves!) + + TODO : Add the cartridge function, + Adjust the one shot and A/D timing (sn76477) +*/ + +#include "machine/upd765.h" +#include "machine/wd_fdc.h" +#include "imagedev/flopdrv.h" +#include "imagedev/cassette.h" +#include "sound/sn76477.h" /* for sn sound*/ + +/* Enum status for high memory bank (c000 - ffff)*/ +enum +{ + HECTOR_BANK_PROG = 0, /* first BANK is program ram*/ + HECTOR_BANK_VIDEO /* second BANK is Video ram */ +}; +/* Status for rom memory bank (0000 - 3fff) in MX machine*/ +enum +{ + HECTORMX_BANK_PAGE0 = 0, /* first BANK is base rom*/ + HECTORMX_BANK_PAGE1, /* second BANK is basic rom */ + HECTORMX_BANK_PAGE2 /* 3 BANK is monitrix / assemblex rom */ +}; +/* Status for rom memory bank (0000 - 3fff) in Mini Disc machine*/ +enum +{ + HECTOR_BANK_BASE = 0, /* first BANK is normal rom*/ + HECTOR_BANK_DISC /* second BANK is extra rom for mini disc use*/ +}; +/* Enum status for low memory bank (00000 - 0fff) for DISC II*/ +enum +{ + DISCII_BANK_RAM = 0, /* first BANK is program ram*/ + DISCII_BANK_ROM /* second BANK is ROM */ +}; + +class hec2hrp_state : public driver_device +{ +public: + hec2hrp_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_disc2cpu(*this, "disc2cpu"), + m_cassette(*this, "cassette"), + m_sn(*this, "sn76477"), + m_palette(*this, "palette"), + m_videoram(*this,"videoram"), + m_hector_videoram(*this,"hector_videoram") , + m_keyboard(*this, "KEY"), + m_minidisc_fdc(*this, "wd179x"), + m_floppy0(*this, "wd179x:0") + {} + + DECLARE_FLOPPY_FORMATS(minidisc_formats); + + required_device m_maincpu; + optional_device m_disc2cpu; + required_device m_cassette; + required_device m_sn; + required_device m_palette; + optional_shared_ptr m_videoram; + optional_shared_ptr m_hector_videoram; + required_ioport_array<9> m_keyboard; + + optional_device m_minidisc_fdc; + optional_device m_floppy0; + + UINT8 m_hector_flag_hr; + UINT8 m_hector_flag_80c; + UINT8 m_hector_color[4]; + UINT8 m_hector_disc2_data_r_ready; + UINT8 m_hector_disc2_data_w_ready; + UINT8 m_hector_disc2_data_read; + UINT8 m_hector_disc2_data_write; + UINT8 m_hector_disc2_RNMI; + UINT8 m_state3000; + UINT8 m_write_cassette; + emu_timer *m_Cassette_timer; + UINT8 m_CK_signal ; + UINT8 m_flag_clk; + double m_Pin_Value[29][2]; + int m_AU[17]; + int m_ValMixer; + int m_oldstate3000; + int m_oldstate1000; + UINT8 m_pot0; + UINT8 m_pot1; + UINT8 m_actions; + UINT8 m_hector_port_a; + UINT8 m_hector_port_b; + UINT8 m_hector_port_c_h; + UINT8 m_hector_port_c_l; + UINT8 m_hector_port_cmd; + UINT8 m_cassette_bit; + UINT8 m_cassette_bit_mem; + UINT8 m_Data_K7; + int m_counter_write; + int m_IRQ_current_state; + int m_NMI_current_state; + int m_hector_cmd[10]; + int m_hector_nb_cde; + int m_hector_flag_result; + int m_print; + UINT8 m_hector_videoram_hrx[0x04000]; + + DECLARE_WRITE8_MEMBER(minidisc_control_w); + + DECLARE_WRITE8_MEMBER(hector_switch_bank_w); + DECLARE_WRITE8_MEMBER(hector_keyboard_w); + DECLARE_READ8_MEMBER(hector_keyboard_r); + DECLARE_WRITE8_MEMBER(hector_sn_2000_w); + DECLARE_WRITE8_MEMBER(hector_sn_2800_w); + DECLARE_READ8_MEMBER(hector_cassette_r); + DECLARE_WRITE8_MEMBER(hector_sn_3000_w); + DECLARE_WRITE8_MEMBER(hector_color_a_w); + DECLARE_WRITE8_MEMBER(hector_color_b_w); + DECLARE_READ8_MEMBER(hector_io_8255_r); + DECLARE_WRITE8_MEMBER(hector_io_8255_w); + DECLARE_WRITE8_MEMBER(hector_mx40_io_port_w); + DECLARE_WRITE8_MEMBER(hector_mx80_io_port_w); + DECLARE_MACHINE_START(hec2hrp); + DECLARE_MACHINE_RESET(hec2hrp); + DECLARE_VIDEO_START(hec2hrp); + DECLARE_MACHINE_START(hec2hrx); + DECLARE_MACHINE_RESET(hec2hrx); + DECLARE_MACHINE_START(hec2mdhrx); + DECLARE_MACHINE_RESET(hec2mdhrx); + UINT32 screen_update_hec2hrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(Callback_CK); + + DECLARE_WRITE_LINE_MEMBER( disc2_fdc_interrupt ); + DECLARE_WRITE_LINE_MEMBER( disc2_fdc_dma_irq ); + int isHectorWithDisc2(); + int isHectorWithMiniDisc(); + int isHectorHR(); + int isHectoreXtend(); + void Mise_A_Jour_Etat(int Adresse, int Value ); + void Init_Value_SN76477_Hector(); + void Update_Sound(address_space &space, UINT8 data); + void hector_reset(int hr, int with_D2 ); + void hector_init(); + void Init_Hector_Palette(); + void hector_80c(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) ; + void hector_hr(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) ; + /*----------- defined in machine/hecdisk2.c -----------*/ + + // disc2 handling + DECLARE_READ8_MEMBER( hector_disc2_io00_port_r); + DECLARE_WRITE8_MEMBER( hector_disc2_io00_port_w); + DECLARE_READ8_MEMBER( hector_disc2_io20_port_r); + DECLARE_WRITE8_MEMBER( hector_disc2_io20_port_w); + DECLARE_READ8_MEMBER( hector_disc2_io30_port_r); + DECLARE_WRITE8_MEMBER( hector_disc2_io30_port_w); + DECLARE_READ8_MEMBER( hector_disc2_io40_port_r); + DECLARE_WRITE8_MEMBER( hector_disc2_io40_port_w); + DECLARE_READ8_MEMBER( hector_disc2_io50_port_r); + DECLARE_WRITE8_MEMBER( hector_disc2_io50_port_w); + + void hector_disc2_reset(); +}; + +MACHINE_CONFIG_EXTERN( hector_audio ); diff --git a/src/mame/includes/hh_tms1k.h b/src/mame/includes/hh_tms1k.h new file mode 100644 index 00000000000..edcea970b64 --- /dev/null +++ b/src/mame/includes/hh_tms1k.h @@ -0,0 +1,86 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Sean Riddle, Kevin Horton +/* + + TMS1000 MCU series tabletops/handhelds or other simple devices. + +*/ + +#ifndef _HH_TMS1K_H_ +#define _HH_TMS1K_H_ + + +#include "emu.h" +#include "cpu/tms0980/tms0980.h" +#include "sound/speaker.h" + + +class hh_tms1k_state : public driver_device +{ +public: + hh_tms1k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN"), + m_speaker(*this, "speaker"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices + required_device m_maincpu; + optional_ioport_array<11> m_inp_matrix; // max 11 + optional_device m_speaker; + + // misc common + UINT16 m_r; // MCU R-pins data + UINT16 m_o; // MCU O-pins data + UINT16 m_inp_mux; // multiplexed inputs mask + bool m_power_on; + bool m_power_led; + + UINT8 read_inputs(int columns); + DECLARE_INPUT_CHANGED_MEMBER(power_button); + DECLARE_WRITE_LINE_MEMBER(auto_power_off); + + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) + + UINT32 m_grid; // VFD current row data + UINT32 m_plate; // VFD current column data + + UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + UINT32 m_display_cache[0x20]; // (internal use) + UINT8 m_display_decay[0x20][0x20]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); + void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask); + +protected: + virtual void machine_start(); + virtual void machine_reset(); +}; + + +// LED segments +enum +{ + lA = 0x01, + lB = 0x02, + lC = 0x04, + lD = 0x08, + lE = 0x10, + lF = 0x20, + lG = 0x40, + lDP = 0x80 +}; + + +#endif /* _HH_TMS1K_H_ */ diff --git a/src/mame/includes/hh_ucom4.h b/src/mame/includes/hh_ucom4.h new file mode 100644 index 00000000000..79d51afccb9 --- /dev/null +++ b/src/mame/includes/hh_ucom4.h @@ -0,0 +1,66 @@ +// license:BSD-3-Clause +// copyright-holders:hap, Kevin Horton +/* + + NEC uCOM4 MCU tabletops/handhelds or other simple devices, + +*/ + +#ifndef _HH_UCOM4_H_ +#define _HH_UCOM4_H_ + + +#include "emu.h" +#include "cpu/ucom4/ucom4.h" +#include "sound/speaker.h" + + +class hh_ucom4_state : public driver_device +{ +public: + hh_ucom4_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_inp_matrix(*this, "IN"), + m_speaker(*this, "speaker"), + m_display_wait(33), + m_display_maxy(1), + m_display_maxx(0) + { } + + // devices + required_device m_maincpu; + optional_ioport_array<5> m_inp_matrix; // max 5 + optional_device m_speaker; + + // misc common + UINT8 m_port[9]; // MCU port A-I write data (optional) + UINT16 m_inp_mux; // multiplexed inputs mask + + UINT8 read_inputs(int columns); + + // display common + int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) + int m_display_maxy; // display matrix number of rows + int m_display_maxx; // display matrix number of columns (max 31 for now) + + UINT32 m_grid; // VFD current row data + UINT32 m_plate; // VFD current column data + + UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) + UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments + UINT32 m_display_cache[0x20]; // (internal use) + UINT8 m_display_decay[0x20][0x20]; // (internal use) + + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + void display_update(); + void set_display_size(int maxx, int maxy); + void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); + +protected: + virtual void machine_start(); + virtual void machine_reset(); +}; + + +#endif /* _HH_UCOM4_H_ */ diff --git a/src/mame/includes/hp48.h b/src/mame/includes/hp48.h new file mode 100644 index 00000000000..70780f2817d --- /dev/null +++ b/src/mame/includes/hp48.h @@ -0,0 +1,219 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2008 + + Hewlett Packard HP48 S/SX & G/GX and HP49 G + +**********************************************************************/ + +#include "sound/dac.h" +/* model */ +typedef enum { + HP48_S, + HP48_SX, + HP48_G, + HP48_GX, + HP48_GP, + HP49_G +} hp48_models; + +/* memory module configuration */ +typedef struct +{ + /* static part */ + UINT32 off_mask; /* offset bit-mask, indicates the real size */ + read8_delegate read; + const char *read_name; + write8_delegate write; + void* data; /* non-NULL for banks */ + int isnop; + + /* configurable part */ + UINT8 state; /* one of HP48_MODULE_ */ + UINT32 base; /* base address */ + UINT32 mask; /* often improperly called size, it is an address select mask */ + +} hp48_module; + + +/* screen image averaging */ +#define HP48_NB_SCREENS 3 + +class hp48_state : public driver_device +{ +public: + hp48_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dac(*this, "dac"), + m_palette(*this, "palette") { } + + UINT8 *m_videoram; + UINT8 m_io[64]; + hp48_models m_model; + + /* OUT register from SATURN (actually 12-bit) */ + UINT16 m_out; + + /* keyboard interrupt */ + UINT8 m_kdn; + + /* from highest to lowest priority: HDW, NCE2, CE1, CE2, NCE3, NCE1 */ + hp48_module m_modules[6]; + + /* RAM/ROM extensions, GX/SX only (each UINT8 stores one nibble) + port1: SX/GX: 32/128 KB + port2: SX:32/128KB, GX:128/512/4096 KB + */ + UINT32 m_port_size[2]; + UINT8 m_port_write[2]; + UINT8* m_port_data[2]; + + UINT32 m_bank_switch; + UINT32 m_io_addr; + UINT16 m_crc; + UINT8 m_timer1; + UINT32 m_timer2; + UINT8 m_screens[ HP48_NB_SCREENS ][ 64 ][ 144 ]; + int m_cur_screen; + UINT8* m_rom; + + DECLARE_DRIVER_INIT(hp48); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(hp48); + DECLARE_MACHINE_START(hp49g); + DECLARE_MACHINE_START(hp48gx); + DECLARE_MACHINE_START(hp48g); + DECLARE_MACHINE_START(hp48gp); + DECLARE_MACHINE_START(hp48sx); + DECLARE_MACHINE_START(hp48s); + UINT32 screen_update_hp48(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void hp48_machine_start(hp48_models model); + DECLARE_WRITE8_MEMBER(hp48_io_w); + DECLARE_READ8_MEMBER(hp48_io_r); + DECLARE_READ8_MEMBER(hp48_bank_r); + DECLARE_WRITE8_MEMBER(hp49_bank_w); + TIMER_CALLBACK_MEMBER(hp48_rs232_byte_recv_cb); + TIMER_CALLBACK_MEMBER(hp48_rs232_byte_sent_cb); + TIMER_CALLBACK_MEMBER(hp48_chardev_byte_recv_cb); + TIMER_CALLBACK_MEMBER(hp48_kbd_cb); + TIMER_CALLBACK_MEMBER(hp48_timer1_cb); + TIMER_CALLBACK_MEMBER(hp48_timer2_cb); + void hp48_update_annunciators(); + void hp48_apply_modules(); + required_device m_maincpu; + required_device m_dac; + required_device m_palette; + void hp48_pulse_irq( int irq_line); + void hp48_rs232_start_recv_byte( UINT8 data ); + void hp48_rs232_send_byte( ); + int hp48_get_in( ); + void hp48_update_kdn( ); + void hp48_reset_modules( ); + void hp48_decode_nibble( UINT8* dst, UINT8* src, int size ); + void hp48_encode_nibble( UINT8* dst, UINT8* src, int size ); + + /* memory controller */ + DECLARE_WRITE_LINE_MEMBER( hp48_mem_reset ); + DECLARE_WRITE32_MEMBER( hp48_mem_config ); + DECLARE_WRITE32_MEMBER( hp48_mem_unconfig ); + DECLARE_READ32_MEMBER( hp48_mem_id ); + + /* CRC computation */ + DECLARE_WRITE32_MEMBER( hp48_mem_crc ); + + /* IN/OUT registers */ + DECLARE_READ32_MEMBER( hp48_reg_in ); + DECLARE_WRITE32_MEMBER( hp48_reg_out ); + + /* keybord interrupt system */ + DECLARE_WRITE_LINE_MEMBER( hp48_rsi ); +}; + + +/*************************************************************************** + MACROS +***************************************************************************/ + +/* read from I/O memory */ +#define HP48_IO_4(x) (m_io[(x)]) +#define HP48_IO_8(x) (m_io[(x)] | (m_io[(x)+1] << 4)) +#define HP48_IO_12(x) (m_io[(x)] | (m_io[(x)+1] << 4) | (m_io[(x)+2] << 8)) +#define HP48_IO_20(x) (m_io[(x)] | (m_io[(x)+1] << 4) | (m_io[(x)+2] << 8) | \ + (m_io[(x)+3] << 12) | (m_io[(x)+4] << 16)) + + +/*----------- defined in machine/hp48.c -----------*/ + +/*************************************************************************** + GLOBAL VARIABLES & CONSTANTS +***************************************************************************/ + +/* I/O memory */ + + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +/* list of memory modules from highest to lowest priority */ +#define HP48_HDW 0 +#define HP48_NCE2 1 +#define HP48_CE1 2 +#define HP48_CE2 3 +#define HP48_NCE3 4 +#define HP48_NCE1 5 + +/****************************** cards ********************************/ + +class hp48_port_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + hp48_port_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + static void set_port_config(device_t &device, int port, int module, int max_size) + { + downcast(device).m_port = port; + downcast(device).m_module = module; + downcast(device).m_max_size = max_size; + } + + // image-level overrides + virtual iodevice_t image_type() const { return IO_MEMCARD; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "crd"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); + virtual bool call_create(int format_type, option_resolution *format_options); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + void hp48_fill_port(); + void hp48_unfill_port(); + + int m_port; /* port index: 0 or 1 (for port 1 and 2) */ + int m_module; /* memory module where the port is visible */ + int m_max_size; /* maximum size, in bytes 128 KB or 4 GB */ +}; + +// device type definition +extern const device_type HP48_PORT; + +#define MCFG_HP48_PORT_ADD(_tag, _port, _module, _max_size) \ + MCFG_DEVICE_ADD(_tag, HP48_PORT, 0) \ + hp48_port_image_device::set_port_config(*device, _port, _module, _max_size); diff --git a/src/mame/includes/huebler.h b/src/mame/includes/huebler.h new file mode 100644 index 00000000000..eb49ae03f07 --- /dev/null +++ b/src/mame/includes/huebler.h @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __HUEBLER__ +#define __HUEBLER__ + +#define SCREEN_TAG "screen" +#define Z80_TAG "z80" +#define Z80CTC_TAG "z80ctc" +#define Z80SIO_TAG "z80sio" +#define Z80PIO1_TAG "z80pio1" +#define Z80PIO2_TAG "z80pio2" + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/z80ctc.h" + +class amu880_state : public driver_device +{ +public: + amu880_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cassette(*this, "cassette"), + m_z80sio(*this, Z80SIO_TAG), + m_palette(*this, "palette"), + m_kb_rom(*this, "keyboard"), + m_char_rom(*this, "chargen"), + m_video_ram(*this, "video_ram"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_y10(*this, "Y10"), + m_y11(*this, "Y11"), + m_y12(*this, "Y12"), + m_y13(*this, "Y13"), + m_y14(*this, "Y14"), + m_y15(*this, "Y15"), + m_special(*this, "SPECIAL"), + m_key_d6(0), + m_key_d7(0), + m_key_a8(1) + { } + + required_device m_cassette; + required_device m_z80sio; + required_device m_palette; + required_memory_region m_kb_rom; + required_memory_region m_char_rom; + required_shared_ptr m_video_ram; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_y10; + required_ioport m_y11; + required_ioport m_y12; + required_ioport m_y13; + required_ioport m_y14; + required_ioport m_y15; + required_ioport m_special; + + virtual void machine_start(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( keyboard_r ); + TIMER_DEVICE_CALLBACK_MEMBER( tape_tick ); + + void scan_keyboard(); + + // keyboard state + ioport_port* m_key_row[16]; + int m_key_d6; + int m_key_d7; + int m_key_a4; + int m_key_a5; + int m_key_a8; + + // video state + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); + DECLARE_READ_LINE_MEMBER(cassette_r); + DECLARE_WRITE_LINE_MEMBER(cassette_w); +}; + +#endif diff --git a/src/mame/includes/hx20.h b/src/mame/includes/hx20.h new file mode 100644 index 00000000000..11fefd77b62 --- /dev/null +++ b/src/mame/includes/hx20.h @@ -0,0 +1,139 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __HX20__ +#define __HX20__ + +#include "bus/rs232/rs232.h" +#include "cpu/m6800/m6800.h" +#include "imagedev/cassette.h" +#include "bus/epson_sio/epson_sio.h" +#include "machine/mc146818.h" +#include "machine/ram.h" +#include "video/upd7227.h" +#include "sound/speaker.h" +#include "rendlay.h" + +#define HD6301V1_MAIN_TAG "8g" +#define HD6301V1_SLAVE_TAG "6d" +#define MC146818_TAG "6g" +#define UPD7227_0_TAG "lcdc0" +#define UPD7227_1_TAG "lcdc1" +#define UPD7227_2_TAG "lcdc2" +#define UPD7227_3_TAG "lcdc3" +#define UPD7227_4_TAG "lcdc4" +#define UPD7227_5_TAG "lcdc5" +#define SPEAKER_TAG "speaker" +#define CASSETTE_TAG "cassette" +#define RS232_TAG "rs232" +#define SCREEN_TAG "screen" + +class hx20_state : public driver_device +{ +public: + hx20_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, HD6301V1_MAIN_TAG), + m_subcpu(*this, HD6301V1_SLAVE_TAG), + m_rtc(*this, MC146818_TAG), + m_lcdc0(*this, UPD7227_0_TAG), + m_lcdc1(*this, UPD7227_1_TAG), + m_lcdc2(*this, UPD7227_2_TAG), + m_lcdc3(*this, UPD7227_3_TAG), + m_lcdc4(*this, UPD7227_4_TAG), + m_lcdc5(*this, UPD7227_5_TAG), + m_speaker(*this, SPEAKER_TAG), + m_cassette(*this, CASSETTE_TAG), + m_rs232(*this, RS232_TAG), + m_sio(*this, "sio"), + m_ksc0(*this, "KSC0"), + m_ksc1(*this, "KSC1"), + m_ksc2(*this, "KSC2"), + m_ksc3(*this, "KSC3"), + m_ksc4(*this, "KSC4"), + m_ksc5(*this, "KSC5"), + m_ksc6(*this, "KSC6"), + m_ksc7(*this, "KSC7"), + m_sw6(*this, "SW6"), + m_slave_rx(1), + m_slave_tx(1), + m_slave_flag(1), + m_rtc_irq(CLEAR_LINE), + m_kbrequest(1) + { } + + required_device m_maincpu; + required_device m_subcpu; + required_device m_rtc; + required_device m_lcdc0; + required_device m_lcdc1; + required_device m_lcdc2; + required_device m_lcdc3; + required_device m_lcdc4; + required_device m_lcdc5; + required_device m_speaker; + required_device m_cassette; + required_device m_rs232; + required_device m_sio; + required_ioport m_ksc0; + required_ioport m_ksc1; + required_ioport m_ksc2; + required_ioport m_ksc3; + required_ioport m_ksc4; + required_ioport m_ksc5; + required_ioport m_ksc6; + required_ioport m_ksc7; + required_ioport m_sw6; + + virtual void machine_start(); + DECLARE_PALETTE_INIT(hx20); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE8_MEMBER( ksc_w ); + DECLARE_READ8_MEMBER( krtn07_r ); + DECLARE_READ8_MEMBER( krtn89_r ); + DECLARE_WRITE8_MEMBER( lcd_cs_w ); + DECLARE_WRITE8_MEMBER( lcd_data_w ); + + DECLARE_READ8_MEMBER( main_p1_r ); + DECLARE_WRITE8_MEMBER( main_p1_w ); + DECLARE_READ8_MEMBER( main_p2_r ); + DECLARE_WRITE8_MEMBER( main_p2_w ); + + DECLARE_READ8_MEMBER( slave_p1_r ); + DECLARE_WRITE8_MEMBER( slave_p1_w ); + DECLARE_READ8_MEMBER( slave_p2_r ); + DECLARE_WRITE8_MEMBER( slave_p2_w ); + DECLARE_READ8_MEMBER( slave_p3_r ); + DECLARE_WRITE8_MEMBER( slave_p3_w ); + DECLARE_READ8_MEMBER( slave_p4_r ); + DECLARE_WRITE8_MEMBER( slave_p4_w ); + + DECLARE_WRITE_LINE_MEMBER( rtc_irq_w ); + + DECLARE_WRITE_LINE_MEMBER( sio_rx_w ) { m_sio_rx = state; } + DECLARE_WRITE_LINE_MEMBER( sio_pin_w ) { m_sio_pin = state; } + + void update_interrupt(); + + // CPU state + int m_slave_sio; + int m_slave_rx; + int m_slave_tx; + int m_slave_flag; + int m_rtc_irq; + + // keyboard state + UINT8 m_ksc; + int m_kbrequest; + + // video state + UINT8 m_lcd_data; + + // sio state + int m_sio_rx; + int m_sio_pin; +}; + +#endif diff --git a/src/mame/includes/imds2.h b/src/mame/includes/imds2.h new file mode 100644 index 00000000000..298b808be82 --- /dev/null +++ b/src/mame/includes/imds2.h @@ -0,0 +1,145 @@ +// license:BSD-3-Clause +// copyright-holders:F. Ulivi +// Driver for Intel Intellec MDS series-II + +#ifndef _IMDS2_H_ +#define _IMDS2_H_ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/i8257.h" +#include "video/i8275.h" +#include "sound/beep.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/i8271.h" +#include "imagedev/flopdrv.h" +#include "bus/centronics/ctronics.h" + +class imds2_state : public driver_device +{ + public: + imds2_state(const machine_config &mconfig, device_type type, const char *tag); + + DECLARE_READ8_MEMBER(ipc_mem_read); + DECLARE_WRITE8_MEMBER(ipc_mem_write); + DECLARE_WRITE8_MEMBER(imds2_ipc_control_w); + DECLARE_WRITE_LINE_MEMBER(imds2_ipc_intr); + DECLARE_READ8_MEMBER(imds2_ipcsyspic_r); + DECLARE_READ8_MEMBER(imds2_ipclocpic_r); + DECLARE_WRITE8_MEMBER(imds2_ipcsyspic_w); + DECLARE_WRITE8_MEMBER(imds2_ipclocpic_w); + + DECLARE_WRITE8_MEMBER(imds2_miscout_w); + DECLARE_READ8_MEMBER(imds2_miscin_r); + DECLARE_WRITE_LINE_MEMBER(imds2_beep_timer_w); + DECLARE_WRITE8_MEMBER(imds2_start_timer_w); + DECLARE_READ8_MEMBER(imds2_kb_read); + DECLARE_READ8_MEMBER(imds2_kb_port_p2_r); + DECLARE_WRITE8_MEMBER(imds2_kb_port_p1_w); + DECLARE_READ8_MEMBER(imds2_kb_port_t0_r); + DECLARE_READ8_MEMBER(imds2_kb_port_t1_r); + DECLARE_WRITE8_MEMBER(imds2_ioc_dbbout_w); + DECLARE_WRITE8_MEMBER(imds2_ioc_f0_w); + DECLARE_WRITE8_MEMBER(imds2_ioc_set_f1_w); + DECLARE_WRITE8_MEMBER(imds2_ioc_reset_f1_w); + DECLARE_READ8_MEMBER(imds2_ioc_status_r); + DECLARE_READ8_MEMBER(imds2_ioc_dbbin_r); + DECLARE_READ8_MEMBER(imds2_ipc_dbbout_r); + DECLARE_READ8_MEMBER(imds2_ipc_status_r); + DECLARE_WRITE8_MEMBER(imds2_ipc_dbbin_data_w); + DECLARE_WRITE8_MEMBER(imds2_ipc_dbbin_cmd_w); + DECLARE_WRITE_LINE_MEMBER(imds2_hrq_w); + + DECLARE_READ8_MEMBER(imds2_ioc_mem_r); + DECLARE_WRITE8_MEMBER(imds2_ioc_mem_w); + DECLARE_READ8_MEMBER(imds2_pio_port_p1_r); + DECLARE_WRITE8_MEMBER(imds2_pio_port_p1_w); + DECLARE_READ8_MEMBER(imds2_pio_port_p2_r); + DECLARE_WRITE8_MEMBER(imds2_pio_port_p2_w); + DECLARE_WRITE_LINE_MEMBER(imds2_pio_lpt_ack_w); + DECLARE_WRITE_LINE_MEMBER(imds2_pio_lpt_busy_w); + DECLARE_WRITE_LINE_MEMBER(imds2_pio_lpt_select_w); + + I8275_DRAW_CHARACTER_MEMBER(crtc_display_pixels); + + virtual void driver_start(); + virtual void machine_start(); + virtual void video_start(); + virtual void machine_reset(); + + private: + required_device m_ipccpu; + required_device m_ipcsyspic; + required_device m_ipclocpic; + required_device m_ioccpu; + required_device m_iocdma; + required_device m_ioccrtc; + required_device m_iocbeep; + required_device m_ioctimer; + required_device m_iocfdc; + required_device m_flop0; + required_device m_flop1; + required_device m_iocpio; + required_device m_kbcpu; + required_device m_palette; + required_device m_gfxdecode; + required_device m_centronics; + required_ioport m_io_key0; + required_ioport m_io_key1; + required_ioport m_io_key2; + required_ioport m_io_key3; + required_ioport m_io_key4; + required_ioport m_io_key5; + required_ioport m_io_key6; + required_ioport m_io_key7; + required_ioport m_ioc_options; + + std::vector m_ipc_ram; + + bool imds2_in_ipc_rom(offs_t offset) const; + + void imds2_update_beeper(void); + void imds2_update_printer(void); + int floppy_load(floppy_image_device *dev); + void floppy_unload(floppy_image_device *dev); + + // IPC control port + UINT8 m_ipc_control; + + // IPC ROM content + const UINT8 *m_ipc_rom; + + // Character generator + const UINT8 *m_chargen; + + // MISCOUT state + UINT8 m_miscout; + + // Beeper timer line + int m_beeper_timer; + + // Keyboard state + UINT8 m_kb_p1; + + // IPC to IOC buffer + UINT8 m_ioc_ibf; + + // IOC to IPC buffer + UINT8 m_ioc_obf; + + // IPC/IOC status + UINT8 m_ipc_ioc_status; + + // PIO port 1 + UINT8 m_pio_port1; + + // PIO port 2 + UINT8 m_pio_port2; + + // PIO device status byte + UINT8 m_device_status_byte; +}; + +#endif /* _IMDS2_H_ */ diff --git a/src/mame/includes/intv.h b/src/mame/includes/intv.h new file mode 100644 index 00000000000..952844a2022 --- /dev/null +++ b/src/mame/includes/intv.h @@ -0,0 +1,155 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,Frank Palazzolo +/***************************************************************************** + * + * includes/intv.h + * + ****************************************************************************/ + +#ifndef INTV_H_ +#define INTV_H_ + +#include "sound/ay8910.h" +#include "video/stic.h" +#include "bus/intv/slot.h" +#include "bus/intv/voice.h" +#include "bus/intv/ecs.h" +//#include "bus/intv/keycomp.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class intv_state : public driver_device +{ +public: + enum + { + TIMER_INTV_INTERRUPT2_COMPLETE, + TIMER_INTV_INTERRUPT_COMPLETE, + TIMER_INTV_BTB_FILL + }; + + intv_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_sound(*this, "ay8914"), + m_stic(*this, "stic"), + m_cart(*this, "cartslot"), + m_intvkbd_dualport_ram(*this, "dualport_ram"), + m_videoram(*this, "videoram"), + m_keyboard(*this, "keyboard"), + m_iocart1(*this, "ioslot1"), + m_iocart2(*this, "ioslot2"), + m_region_maincpu(*this, "maincpu"), + m_region_keyboard(*this, "keyboard"), + m_io_options(*this, "OPTIONS"), + m_io_test(*this, "TEST"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_sound; + required_device m_stic; + optional_device m_cart; + optional_shared_ptr m_intvkbd_dualport_ram; + optional_shared_ptr m_videoram; + + DECLARE_READ16_MEMBER(intv_stic_r); + DECLARE_WRITE16_MEMBER(intv_stic_w); + DECLARE_READ16_MEMBER(intv_gram_r); + DECLARE_WRITE16_MEMBER(intv_gram_w); + DECLARE_READ16_MEMBER(intv_ram8_r); + DECLARE_WRITE16_MEMBER(intv_ram8_w); + DECLARE_READ16_MEMBER(intv_ram16_r); + DECLARE_WRITE16_MEMBER(intv_ram16_w); + DECLARE_READ8_MEMBER(intvkb_iocart_r); + + DECLARE_READ8_MEMBER(intv_right_control_r); + DECLARE_READ8_MEMBER(intv_left_control_r); + + UINT8 m_bus_copy_mode; + UINT8 m_backtab_row; + UINT16 m_ram16[0x160]; + int m_sr1_int_pending; + UINT8 m_ram8[256]; + + // Keyboard Component + DECLARE_READ8_MEMBER(intvkbd_tms9927_r); + DECLARE_WRITE8_MEMBER(intvkbd_tms9927_w); + DECLARE_WRITE16_MEMBER(intvkbd_dualport16_w); + DECLARE_READ8_MEMBER(intvkbd_dualport8_lsb_r); + DECLARE_WRITE8_MEMBER(intvkbd_dualport8_lsb_w); + DECLARE_READ8_MEMBER(intvkbd_dualport8_msb_r); + DECLARE_WRITE8_MEMBER(intvkbd_dualport8_msb_w); + + UINT8 m_tms9927_num_rows; + UINT8 m_tms9927_cursor_col; + UINT8 m_tms9927_cursor_row; + UINT8 m_tms9927_last_row; + + int m_intvkbd_text_blanked; + int m_intvkbd_keyboard_col; + int m_tape_int_pending; + int m_tape_interrupts_enabled; + int m_tape_unknown_write[6]; + int m_tape_motor_mode; + DECLARE_DRIVER_INIT(intvecs); + DECLARE_DRIVER_INIT(intvkbd); + DECLARE_DRIVER_INIT(intv); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(intv); + void ecs_banks_restore(); + UINT32 screen_update_intv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_intvkbd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(intv_interrupt2); + INTERRUPT_GEN_MEMBER(intv_interrupt); + TIMER_CALLBACK_MEMBER(intv_interrupt2_complete); + TIMER_CALLBACK_MEMBER(intv_interrupt_complete); + TIMER_CALLBACK_MEMBER(intv_btb_fill); + +protected: + int m_is_keybd; + + optional_device m_keyboard; + optional_device m_iocart1; + optional_device m_iocart2; + required_memory_region m_region_maincpu; + optional_memory_region m_region_keyboard; + required_ioport m_io_options; + optional_ioport m_io_test; + + optional_device m_gfxdecode; + required_device m_palette; + + ioport_port *m_keypad[4]; + ioport_port *m_disc[4]; + ioport_port *m_discx[4]; + ioport_port *m_discy[4]; + ioport_port *m_intv_keyboard[10]; + + int intv_load_rom_file(device_image_interface &image); + UINT8 intv_control_r(int hand); + void intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + UINT32 intv_get_pixel(bitmap_ind16 &bitmap, int x, int y); + void intv_plot_box(bitmap_ind16 &bm, int x, int y, int w, int h, int color); + int sprites_collide(int spriteNum1, int spriteNum2); + void determine_sprite_collisions(); + void render_sprites(); + void render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor); + void render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3); + void render_color_stack_mode(bitmap_ind16 &bitmap); + void render_fg_bg_mode(bitmap_ind16 &bitmap); + void copy_sprites_to_background(bitmap_ind16 &bitmap); + void render_background(bitmap_ind16 &bitmap); + void draw_borders(bitmap_ind16 &bm); + void intv_stic_screenrefresh(); + void draw_background(bitmap_ind16 &bitmap, int transparency); + void draw_sprites(bitmap_ind16 &bitmap, int behind_foreground); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* INTV_H_ */ diff --git a/src/mame/includes/jupiter.h b/src/mame/includes/jupiter.h new file mode 100644 index 00000000000..03ffa92de5e --- /dev/null +++ b/src/mame/includes/jupiter.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Robbbert +#pragma once + +#ifndef __JUPITER__ +#define __JUPITER__ + +#define MCM6571AP_TAG "vid125_6c" +#define S6820_TAG "vid125_4a" +#define Z80_TAG "cpu126_4c" +#define INS1771N1_TAG "fdi027_4c" +#define MC6820P_TAG "fdi027_4b" +#define MC6850P_TAG "rsi068_6a" +#define MC6821P_TAG "sdm058_4b" + +class jupiter2_state : public driver_device +{ +public: + jupiter2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, MCM6571AP_TAG) + { } + + required_device m_maincpu; + + virtual void machine_start(); + DECLARE_DRIVER_INIT(jupiter); +}; + +class jupiter3_state : public driver_device +{ +public: + jupiter3_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_p_videoram(*this, "p_videoram"), + m_p_ram(*this, "p_ram") + { } + + required_device m_maincpu; + + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(status_r); + DECLARE_READ8_MEMBER(key_r); + DECLARE_READ8_MEMBER(ff_r); + UINT8 m_term_data; + + required_shared_ptr m_p_videoram; + required_shared_ptr m_p_ram; + const UINT8 *m_p_chargen; + + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_DRIVER_INIT(jupiter3); +}; + +#endif diff --git a/src/mame/includes/kaypro.h b/src/mame/includes/kaypro.h new file mode 100644 index 00000000000..ef5d5ab008a --- /dev/null +++ b/src/mame/includes/kaypro.h @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/com8116.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/snapquik.h" +#include "sound/beep.h" +#include "video/mc6845.h" +#include "machine/wd_fdc.h" + +struct kay_kbd_t; + +class kaypro_state : public driver_device +{ +public: + enum + { + TIMER_FLOPPY + }; + + kaypro_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_pio_g(*this, "z80pio_g") + , m_pio_s(*this, "z80pio_s") + , m_sio(*this, "z80sio") + , m_sio2x(*this, "z80sio_2x") + , m_centronics(*this, "centronics") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_crtc(*this, "crtc") + , m_beep(*this, "beeper") + {} + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_READ8_MEMBER(kaypro2x_87_r); + DECLARE_READ8_MEMBER(kaypro2x_system_port_r); + DECLARE_READ8_MEMBER(kaypro2x_status_r); + DECLARE_READ8_MEMBER(kaypro2x_videoram_r); + DECLARE_WRITE8_MEMBER(kaypro2x_system_port_w); + DECLARE_WRITE8_MEMBER(kaypro2x_index_w); + DECLARE_WRITE8_MEMBER(kaypro2x_register_w); + DECLARE_WRITE8_MEMBER(kaypro2x_videoram_w); + DECLARE_READ8_MEMBER(pio_system_r); + DECLARE_WRITE8_MEMBER(common_pio_system_w); + DECLARE_WRITE8_MEMBER(kayproii_pio_system_w); + DECLARE_WRITE8_MEMBER(kaypro4_pio_system_w); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_READ8_MEMBER(kaypro_videoram_r); + DECLARE_WRITE8_MEMBER(kaypro_videoram_w); + DECLARE_MACHINE_START(kayproii); + DECLARE_MACHINE_RESET(kaypro); + DECLARE_VIDEO_START(kaypro); + DECLARE_PALETTE_INIT(kaypro); + DECLARE_MACHINE_RESET(kay_kbd); + DECLARE_DRIVER_INIT(kaypro); + DECLARE_FLOPPY_FORMATS(kayproii_floppy_formats); + DECLARE_FLOPPY_FORMATS(kaypro2x_floppy_formats); + UINT32 screen_update_kayproii(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_kaypro2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(kay_kbd_interrupt); + DECLARE_READ8_MEMBER(kaypro_sio_r); + DECLARE_WRITE8_MEMBER(kaypro_sio_w); + MC6845_UPDATE_ROW(kaypro2x_update_row); + DECLARE_QUICKLOAD_LOAD_MEMBER(kaypro); + const UINT8 *m_p_chargen; + UINT8 m_mc6845_cursor[16]; + UINT8 m_mc6845_reg[32]; + UINT8 m_mc6845_ind; + UINT8 m_framecnt; + UINT8 *m_p_videoram; + kay_kbd_t *m_kbd; + int m_centronics_busy; + required_device m_palette; + +private: + bool m_is_motor_off; + UINT8 m_fdc_rq; + UINT8 m_system_port; + UINT16 m_mc6845_video_address; + floppy_image_device *m_floppy; + void mc6845_cursor_configure(); + void mc6845_screen_configure(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + required_device m_maincpu; + optional_device m_pio_g; + optional_device m_pio_s; + required_device m_sio; + optional_device m_sio2x; + required_device m_centronics; + required_device m_fdc; + required_device m_floppy0; + optional_device m_floppy1; + optional_device m_crtc; + required_device m_beep; +}; + + +/*----------- defined in machine/kay_kbd.c -----------*/ + +UINT8 kay_kbd_c_r( running_machine &machine ); +UINT8 kay_kbd_d_r( running_machine &machine ); +void kay_kbd_d_w( running_machine &machine, UINT8 data ); + +INPUT_PORTS_EXTERN( kay_kbd ); diff --git a/src/mame/includes/kc.h b/src/mame/includes/kc.h new file mode 100644 index 00000000000..46f1cd93d1e --- /dev/null +++ b/src/mame/includes/kc.h @@ -0,0 +1,189 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/***************************************************************************** + * + * includes/kc.h + * + ****************************************************************************/ + +#ifndef KC_H_ +#define KC_H_ + +/* Devices */ +#include "imagedev/cassette.h" +#include "machine/ram.h" + +// Components +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/ram.h" +#include "machine/kc_keyb.h" +#include "machine/rescap.h" +#include "cpu/z80/z80daisy.h" +#include "sound/speaker.h" +#include "sound/wave.h" + +// Devices +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" + +// Formats +#include "formats/kc_cas.h" + +// Expansions +#include "bus/kc/kc.h" +#include "bus/kc/ram.h" +#include "bus/kc/rom.h" +#include "bus/kc/d002.h" +#include "bus/kc/d004.h" + +// from service manual +#define KC85_3_CLOCK 1751938 +#define KC85_4_CLOCK 1773447 + +#define KC85_4_SCREEN_PIXEL_RAM_SIZE 0x04000 +#define KC85_4_SCREEN_COLOUR_RAM_SIZE 0x04000 + +#define KC85_PALETTE_SIZE 24 +#define KC85_SCREEN_WIDTH 320 +#define KC85_SCREEN_HEIGHT 256 + +// cassette input polling frequency +#define KC_CASSETTE_TIMER_FREQUENCY attotime::from_hz(44100) + + +class kc_state : public driver_device +{ +public: + kc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_z80pio(*this, "z80pio"), + m_z80ctc(*this, "z80ctc"), + m_ram(*this, RAM_TAG), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette") + { } + + required_device m_maincpu; + required_device m_z80pio; + required_device m_z80ctc; + required_device m_ram; + required_device m_speaker; + required_device m_cassette; + + // defined in machine/kc.c + virtual void machine_start(); + virtual void machine_reset(); + + // modules read/write + DECLARE_READ8_MEMBER ( expansion_read ); + DECLARE_WRITE8_MEMBER( expansion_write ); + DECLARE_READ8_MEMBER ( expansion_4000_r ); + DECLARE_WRITE8_MEMBER( expansion_4000_w ); + DECLARE_READ8_MEMBER ( expansion_8000_r ); + DECLARE_WRITE8_MEMBER( expansion_8000_w ); + DECLARE_READ8_MEMBER ( expansion_c000_r ); + DECLARE_WRITE8_MEMBER( expansion_c000_w ); + DECLARE_READ8_MEMBER ( expansion_e000_r ); + DECLARE_WRITE8_MEMBER( expansion_e000_w ); + DECLARE_READ8_MEMBER ( expansion_io_read ); + DECLARE_WRITE8_MEMBER( expansion_io_write ); + + // bankswitch + virtual void update_0x00000(); + virtual void update_0x04000(); + virtual void update_0x08000(); + virtual void update_0x0c000(); + virtual void update_0x0e000(); + + // PIO callback + DECLARE_READ8_MEMBER( pio_porta_r ); + DECLARE_READ8_MEMBER( pio_portb_r ); + DECLARE_WRITE_LINE_MEMBER( pio_ardy_cb); + DECLARE_WRITE_LINE_MEMBER( pio_brdy_cb); + DECLARE_WRITE8_MEMBER( pio_porta_w ); + DECLARE_WRITE8_MEMBER( pio_portb_w ); + + // CTC callback + DECLARE_WRITE_LINE_MEMBER( ctc_zc0_callback ); + DECLARE_WRITE_LINE_MEMBER( ctc_zc1_callback ); + DECLARE_WRITE_LINE_MEMBER( ctc_zc2_callback ); + + // keyboard + DECLARE_WRITE_LINE_MEMBER( keyboard_cb ); + + // cassette + void update_cassette(int state); + void cassette_set_motor(int motor_state); + + // speaker + void speaker_update(); + + // defined in video/kc.c + virtual void video_start(); + virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER( video_toggle_blink_state ); + void video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, UINT8 colour_byte, UINT8 gfx_byte); + + // driver state + UINT8 * m_ram_base; + UINT8 * m_video_ram; + int m_pio_data[2]; + int m_high_resolution; + UINT8 m_ardy; + UINT8 m_brdy; + int m_kc85_blink_state; + int m_k0_line; + int m_k1_line; + UINT8 m_speaker_level; + + // cassette + emu_timer * m_cassette_timer; + emu_timer * m_cassette_oneshot_timer; + int m_astb; + int m_cassette_in; + + kcexp_slot_device * m_expansions[3]; + DECLARE_PALETTE_INIT(kc85); + TIMER_CALLBACK_MEMBER(kc_cassette_oneshot_timer); + TIMER_CALLBACK_MEMBER(kc_cassette_timer_callback); + TIMER_DEVICE_CALLBACK_MEMBER(kc_scanline); + + DECLARE_QUICKLOAD_LOAD_MEMBER( kc ); +}; + + +class kc85_4_state : public kc_state +{ +public: + kc85_4_state(const machine_config &mconfig, device_type type, const char *tag) + : kc_state(mconfig, type, tag) + { } + + // defined in machine/kc.c + virtual void machine_reset(); + + virtual void update_0x04000(); + virtual void update_0x08000(); + virtual void update_0x0c000(); + + DECLARE_READ8_MEMBER( kc85_4_86_r ); + DECLARE_READ8_MEMBER( kc85_4_84_r ); + DECLARE_WRITE8_MEMBER( kc85_4_86_w ); + DECLARE_WRITE8_MEMBER( kc85_4_84_w ); + + // defined in video/kc.c + virtual void video_start(); + virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void video_control_w(int data); + + // driver state + UINT8 m_port_84_data; + UINT8 m_port_86_data; + UINT8 * m_display_video_ram; +}; + +#endif /* KC_H_ */ diff --git a/src/mame/includes/kramermc.h b/src/mame/includes/kramermc.h new file mode 100644 index 00000000000..87222f7e578 --- /dev/null +++ b/src/mame/includes/kramermc.h @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/kramermc.h + * + ****************************************************************************/ + +#ifndef KRAMERMC_H_ +#define KRAMERMC_H_ + +#include "machine/z80pio.h" + +class kramermc_state : public driver_device +{ +public: + kramermc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + UINT8 m_key_row; + DECLARE_DRIVER_INIT(kramermc); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_kramermc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER(kramermc_port_a_r); + DECLARE_READ8_MEMBER(kramermc_port_b_r); + DECLARE_WRITE8_MEMBER(kramermc_port_a_w); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; +}; + +/*----------- defined in video/kramermc.c -----------*/ + +extern const gfx_layout kramermc_charlayout; + + +#endif /* KRAMERMC_h_ */ diff --git a/src/mame/includes/kyocera.h b/src/mame/includes/kyocera.h new file mode 100644 index 00000000000..ef5e5737dea --- /dev/null +++ b/src/mame/includes/kyocera.h @@ -0,0 +1,291 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __KYOCERA__ +#define __KYOCERA__ + + +#include "bus/rs232/rs232.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8155.h" +#include "machine/i8251.h" +#include "machine/im6402.h" +#include "machine/ram.h" +#include "machine/rp5c01.h" +#include "machine/upd1990a.h" +#include "video/hd44102.h" +#include "video/hd61830.h" +#include "sound/speaker.h" +#include "rendlay.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define SCREEN_TAG "screen" +#define I8085_TAG "m19" +#define I8155_TAG "m25" +#define UPD1990A_TAG "m18" +#define IM6402_TAG "m22" +#define MC14412_TAG "m31" +#define HD44102_0_TAG "m1" +#define HD44102_1_TAG "m2" +#define HD44102_2_TAG "m3" +#define HD44102_3_TAG "m4" +#define HD44102_4_TAG "m5" +#define HD44102_5_TAG "m6" +#define HD44102_6_TAG "m7" +#define HD44102_7_TAG "m8" +#define HD44102_8_TAG "m9" +#define HD44102_9_TAG "m10" +#define CENTRONICS_TAG "centronics" +#define RS232_TAG "rs232" + +//#define I8085_TAG "m19" +//#define I8155_TAG "m12" +//#define MC14412_TAG "m8" +#define RP5C01A_TAG "m301" +#define TCM5089_TAG "m11" +#define I8251_TAG "m20" +#define HD61830_TAG "m18" + +class kc85_state : public driver_device +{ +public: + kc85_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I8085_TAG), + m_rtc(*this, UPD1990A_TAG), + m_uart(*this, IM6402_TAG), + m_lcdc0(*this, HD44102_0_TAG), + m_lcdc1(*this, HD44102_1_TAG), + m_lcdc2(*this, HD44102_2_TAG), + m_lcdc3(*this, HD44102_3_TAG), + m_lcdc4(*this, HD44102_4_TAG), + m_lcdc5(*this, HD44102_5_TAG), + m_lcdc6(*this, HD44102_6_TAG), + m_lcdc7(*this, HD44102_7_TAG), + m_lcdc8(*this, HD44102_8_TAG), + m_lcdc9(*this, HD44102_9_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_opt_cart(*this, "opt_cartslot"), + m_ram(*this, RAM_TAG), + m_rs232(*this, RS232_TAG), + m_rom(*this, I8085_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_battery(*this, "BATTERY") + { } + + required_device m_maincpu; + required_device m_rtc; + optional_device m_uart; + required_device m_lcdc0; + required_device m_lcdc1; + required_device m_lcdc2; + required_device m_lcdc3; + required_device m_lcdc4; + required_device m_lcdc5; + required_device m_lcdc6; + required_device m_lcdc7; + required_device m_lcdc8; + required_device m_lcdc9; + required_device m_centronics; + required_device m_speaker; + required_device m_cassette; + required_device m_opt_cart; + required_device m_ram; + required_device m_rs232; + required_memory_region m_rom; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_battery; + + virtual void machine_start(); + memory_region *m_opt_region; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( uart_status_r ); + DECLARE_WRITE8_MEMBER( uart_ctrl_w ); + DECLARE_WRITE8_MEMBER( modem_w ); + DECLARE_WRITE8_MEMBER( ctrl_w ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_READ8_MEMBER( lcd_r ); + DECLARE_WRITE8_MEMBER( lcd_w ); + DECLARE_WRITE8_MEMBER( i8155_pa_w ); + DECLARE_WRITE8_MEMBER( i8155_pb_w ); + DECLARE_READ8_MEMBER( i8155_pc_r ); + DECLARE_WRITE_LINE_MEMBER( i8155_to_w ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); + + /* memory state */ + UINT8 m_bank; /* memory bank selection */ + + /* keyboard state */ + UINT16 m_keylatch; /* keyboard latch */ + + /* sound state */ + int m_buzzer; /* buzzer select */ + int m_bell; /* bell output */ + + int m_centronics_busy; + int m_centronics_select; + + DECLARE_PALETTE_INIT(kc85); + DECLARE_WRITE_LINE_MEMBER(kc85_sod_w); + DECLARE_READ_LINE_MEMBER(kc85_sid_r); +}; + +class trsm100_state : public kc85_state +{ +public: + trsm100_state(const machine_config &mconfig, device_type type, const char *tag) + : kc85_state(mconfig, type, tag) { } + + virtual void machine_start(); +}; + +class pc8201_state : public kc85_state +{ +public: + pc8201_state(const machine_config &mconfig, device_type type, const char *tag) + : kc85_state(mconfig, type, tag), + m_cas_cart(*this, "cas_cartslot") + { } + + virtual void machine_start(); + required_device m_cas_cart; + + DECLARE_READ8_MEMBER( bank_r ); + DECLARE_WRITE8_MEMBER( bank_w ); + DECLARE_WRITE8_MEMBER( scp_w ); + DECLARE_READ8_MEMBER( uart_status_r ); + DECLARE_WRITE8_MEMBER( romah_w ); + DECLARE_WRITE8_MEMBER( romal_w ); + DECLARE_WRITE8_MEMBER( romam_w ); + DECLARE_READ8_MEMBER( romrd_r ); + + void bankswitch(UINT8 data); + + // ROM cassette + int m_rom_sel; + UINT32 m_rom_addr; + + /* peripheral state */ + int m_iosel; /* serial interface select */ +}; + +class tandy200_state : public driver_device +{ +public: + tandy200_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I8085_TAG), + m_rtc(*this, RP5C01A_TAG), + m_lcdc(*this, HD61830_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_cent_data_out(*this, "cent_data_out"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_opt_cart(*this, "opt_cartslot"), + m_ram(*this, RAM_TAG), + m_rs232(*this, RS232_TAG), + m_rom(*this, I8085_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8") + { } + + required_device m_maincpu; + required_device m_rtc; + required_device m_lcdc; + required_device m_centronics; + required_device m_cent_data_out; + required_device m_speaker; + required_device m_cassette; + required_device m_opt_cart; + required_device m_ram; + required_device m_rs232; + required_memory_region m_rom; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + + virtual void machine_start(); + memory_region *m_opt_region; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( bank_r ); + DECLARE_WRITE8_MEMBER( bank_w ); + DECLARE_READ8_MEMBER( stbk_r ); + DECLARE_WRITE8_MEMBER( stbk_w ); + DECLARE_WRITE8_MEMBER( i8155_pa_w ); + DECLARE_WRITE8_MEMBER( i8155_pb_w ); + DECLARE_READ8_MEMBER( i8155_pc_r ); + DECLARE_WRITE_LINE_MEMBER( i8155_to_w ); + DECLARE_WRITE_LINE_MEMBER(kc85_sod_w); + DECLARE_READ_LINE_MEMBER(kc85_sid_r); + DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); + + DECLARE_PALETTE_INIT(tandy200); + + TIMER_DEVICE_CALLBACK_MEMBER(tandy200_tp_tick); + + void bankswitch(UINT8 data); + + /* memory state */ + UINT8 m_bank; /* memory bank selection */ + + /* keyboard state */ + UINT16 m_keylatch; /* keyboard latch */ + int m_tp; /* timing pulse */ + + /* sound state */ + int m_buzzer; /* buzzer select */ + int m_bell; /* bell output */ + + int m_centronics_busy; + int m_centronics_select; +}; + +/* ---------- defined in video/kyocera.c ---------- */ + +MACHINE_CONFIG_EXTERN( kc85_video ); +MACHINE_CONFIG_EXTERN( tandy200_video ); + +#endif diff --git a/src/mame/includes/lc80.h b/src/mame/includes/lc80.h new file mode 100644 index 00000000000..bf54ed9ed95 --- /dev/null +++ b/src/mame/includes/lc80.h @@ -0,0 +1,68 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __LC80__ +#define __LC80__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "machine/z80pio.h" +#include "machine/z80ctc.h" +#include "sound/speaker.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "d201" +#define Z80CTC_TAG "d208" +#define Z80PIO1_TAG "d206" +#define Z80PIO2_TAG "d207" +//#define SPEAKER_TAG "b237" + +class lc80_state : public driver_device +{ +public: + lc80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_pio2(*this, Z80PIO2_TAG), + m_cassette(*this, "cassette"), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3") + { } + + required_device m_maincpu; + required_device m_pio2; + required_device m_cassette; + required_device m_speaker; + required_device m_ram; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + + virtual void machine_start(); + + DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); + DECLARE_WRITE8_MEMBER( pio1_pa_w ); + DECLARE_READ8_MEMBER( pio1_pb_r ); + DECLARE_WRITE8_MEMBER( pio1_pb_w ); + DECLARE_READ8_MEMBER( pio2_pb_r ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); + + void update_display(); + + // display state + UINT8 m_digit; + UINT8 m_segment; +}; + +#endif diff --git a/src/mame/includes/lisa.h b/src/mame/includes/lisa.h new file mode 100644 index 00000000000..c52c53fb833 --- /dev/null +++ b/src/mame/includes/lisa.h @@ -0,0 +1,237 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/***************************************************************************** + * + * includes/lisa.h + * + * Lisa driver declarations + * + ****************************************************************************/ + +#ifndef LISA_H_ +#define LISA_H_ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/6522via.h" +#include "machine/8530scc.h" +#include "machine/6522via.h" +#include "machine/nvram.h" +#include "machine/applefdc.h" +#include "machine/sonydriv.h" +#include "sound/speaker.h" + +#define COP421_TAG "u9f" +#define KB_COP421_TAG "kbcop" + +/* lisa MMU segment regs */ +struct real_mmu_entry +{ + UINT16 sorg; + UINT16 slim; +}; + +/* MMU regs translated into a more efficient format */ +enum mmu_entry_t { RAM_stack_r, RAM_r, RAM_stack_rw, RAM_rw, IO, invalid, special_IO }; + +struct mmu_entry +{ + offs_t sorg; /* (real_sorg & 0x0fff) << 9 */ + mmu_entry_t type; /* <-> (real_slim & 0x0f00) */ + int slim; /* (~ ((real_slim & 0x00ff) << 9)) & 0x01ffff */ +}; + +enum floppy_hardware_t +{ + twiggy, /* twiggy drives (Lisa 1) */ + sony_lisa2, /* 3.5'' drive with LisaLite adapter (Lisa 2) */ + sony_lisa210 /* 3.5'' drive with modified fdc hardware (Lisa 2/10, Mac XL) */ +}; + +enum clock_mode_t +{ + clock_timer_disable = 0, + timer_disable = 1, + timer_interrupt = 2, /* timer underflow generates interrupt */ + timer_power_on = 3 /* timer underflow turns system on if it is off and gens interrupt */ +}; /* clock mode */ + +/* clock registers */ +struct clock_regs_t +{ + long alarm; /* alarm (20-bit binary) */ + int years; /* years (4-bit binary ) */ + int days1; /* days (BCD : 1-366) */ + int days2; + int days3; + int hours1; /* hours (BCD : 0-23) */ + int hours2; + int minutes1; /* minutes (BCD : 0-59) */ + int minutes2; + int seconds1; /* seconds (BCD : 0-59) */ + int seconds2; + int tenths; /* tenths of second (BCD : 0-9) */ + + int clock_write_ptr; /* clock byte to be written next (-1 if clock write disabled) */ + + enum clock_mode_t clock_mode; +}; + +struct lisa_features_t +{ + unsigned int has_fast_timers : 1; /* I/O board VIAs are clocked at 1.25 MHz (?) instead of .5 MHz (?) (Lisa 2/10, Mac XL) */ + /* Note that the beep routine in boot ROMs implies that + VIA clock is 1.25 times faster with fast timers than with + slow timers. I read the schematics again and again, and + I simply don't understand : in one case the VIA is + connected to the 68k E clock, which is CPUCK/10, and in + another case, to a generated PH2 clock which is CPUCK/4, + with additionnal logic to keep it in phase with the 68k + memory cycle. After hearing the beep when MacWorks XL + boots, I bet the correct values are .625 MHz and .5 MHz. + Maybe the schematics are wrong, and PH2 is CPUCK/8. + Maybe the board uses a 6522 variant with different + timings. */ + floppy_hardware_t floppy_hardware; + unsigned int has_double_sided_floppy : 1; /* true on lisa 1 and *hacked* lisa 2/10 / Mac XL */ + unsigned int has_mac_xl_video : 1; /* modified video for MacXL */ +}; + + +class lisa_state : public driver_device +{ +public: + lisa_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_via0(*this, "via6522_0"), + m_via1(*this, "via6522_1"), + m_fdc(*this, "fdc"), + m_scc(*this, "scc"), + m_speaker(*this, "speaker"), + m_nvram(*this, "nvram"), + m_fdc_rom(*this,"fdc_rom"), + m_fdc_ram(*this,"fdc_ram"), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_line4(*this, "LINE4"), + m_io_line5(*this, "LINE5"), + m_io_line6(*this, "LINE6"), + m_io_line7(*this, "LINE7"), + m_io_mouse_x(*this, "MOUSE_X"), + m_io_mouse_y(*this, "MOUSE_Y"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_via0; + required_device m_via1; + optional_device m_fdc; + required_device m_scc; + required_device m_speaker; + required_device m_nvram; + + required_shared_ptr m_fdc_rom; + required_shared_ptr m_fdc_ram; + + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_ioport m_io_line3; + required_ioport m_io_line4; + required_ioport m_io_line5; + required_ioport m_io_line6; + required_ioport m_io_line7; + required_ioport m_io_mouse_x; + required_ioport m_io_mouse_y; + + required_device m_palette; + + UINT8 *m_ram_ptr; + UINT8 *m_rom_ptr; + UINT8 *m_videoROM_ptr; + int m_setup; + int m_seg; + real_mmu_entry m_real_mmu_regs[4][128]; + mmu_entry m_mmu_regs[4][128]; + int m_diag2; + int m_test_parity; + UINT16 m_mem_err_addr_latch; + int m_parity_error_pending; + int m_bad_parity_count; + UINT8 *m_bad_parity_table; + int m_VTMSK; + int m_VTIR; + UINT16 m_video_address_latch; + UINT16 *m_videoram_ptr; + int m_KBIR; + int m_FDIR; + int m_DISK_DIAG; + int m_MT1; + int m_PWM_floppy_motor_speed; + int m_model; + lisa_features_t m_features; + int m_COPS_Ready; + int m_COPS_command; + int m_fifo_data[8]; + int m_fifo_size; + int m_fifo_head; + int m_fifo_tail; + int m_mouse_data_offset; + int m_COPS_force_unplug; + emu_timer *m_mouse_timer; + int m_hold_COPS_data; + int m_NMIcode; + clock_regs_t m_clock_regs; + int m_key_matrix[8]; + int m_last_mx; + int m_last_my; + int m_frame_count; + int m_videoROM_address; + DECLARE_READ8_MEMBER(lisa_fdc_io_r); + DECLARE_WRITE8_MEMBER(lisa_fdc_io_w); + DECLARE_READ8_MEMBER(lisa_fdc_r); + DECLARE_READ8_MEMBER(lisa210_fdc_r); + DECLARE_WRITE8_MEMBER(lisa_fdc_w); + DECLARE_WRITE8_MEMBER(lisa210_fdc_w); + DECLARE_READ16_MEMBER(lisa_r); + DECLARE_WRITE16_MEMBER(lisa_w); + DECLARE_READ16_MEMBER(lisa_IO_r); + DECLARE_WRITE16_MEMBER(lisa_IO_w); + + DECLARE_DRIVER_INIT(lisa210); + DECLARE_DRIVER_INIT(mac_xl); + DECLARE_DRIVER_INIT(lisa2); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + void nvram_init(nvram_device &nvram, void *data, size_t size); + UINT32 screen_update_lisa(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(lisa_interrupt); + TIMER_CALLBACK_MEMBER(handle_mouse); + TIMER_CALLBACK_MEMBER(read_COPS_command); + TIMER_CALLBACK_MEMBER(set_COPS_ready); + DECLARE_WRITE8_MEMBER(COPS_via_out_a); + DECLARE_WRITE_LINE_MEMBER(COPS_via_out_ca2); + DECLARE_WRITE8_MEMBER(COPS_via_out_b); + DECLARE_WRITE_LINE_MEMBER(COPS_via_out_cb2); + + void field_interrupts(); + void set_parity_error_pending(int value); + void set_VTIR(int value); + void cpu_board_control_access(offs_t offset); + void init_COPS(); + void reset_COPS(); + void lisa_fdc_ttl_glue_access(offs_t offset); + void COPS_send_data_if_possible(); + void COPS_queue_data(const UINT8 *data, int len); + void COPS_via_irq_func(int val); + void scan_keyboard(); + void unplug_keyboard(); + void plug_keyboard(); + void init_lisa1(void); +}; + +#endif /* LISA_H_ */ diff --git a/src/mame/includes/llc.h b/src/mame/includes/llc.h new file mode 100644 index 00000000000..c98a7484146 --- /dev/null +++ b/src/mame/includes/llc.h @@ -0,0 +1,64 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/***************************************************************************** + * + * includes/llc.h + * + ****************************************************************************/ + +#ifndef LLC_H_ +#define LLC_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80pio.h" +#include "machine/z80ctc.h" +#include "machine/ram.h" +#include "machine/k7659kb.h" +#include "sound/speaker.h" + +class llc_state : public driver_device +{ +public: + llc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_speaker(*this, "speaker"), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG) { } + + DECLARE_WRITE8_MEMBER(llc2_rom_disable_w); + DECLARE_WRITE8_MEMBER(llc2_basic_enable_w); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_READ8_MEMBER(llc1_port1_a_r); + DECLARE_READ8_MEMBER(llc1_port2_a_r); + DECLARE_READ8_MEMBER(llc1_port2_b_r); + DECLARE_WRITE8_MEMBER(llc1_port1_a_w); + DECLARE_WRITE8_MEMBER(llc1_port1_b_w); + DECLARE_READ8_MEMBER(llc2_port1_b_r); + DECLARE_READ8_MEMBER(llc2_port2_a_r); + DECLARE_WRITE8_MEMBER(llc2_port1_b_w); + const UINT8 *m_p_chargen; + optional_device m_speaker; + optional_shared_ptr m_p_videoram; + bool m_rv; + UINT8 m_term_status; + UINT8 m_llc1_key; +private: + UINT8 m_porta; + UINT8 m_term_data; +public: + DECLARE_DRIVER_INIT(llc2); + DECLARE_DRIVER_INIT(llc1); + virtual void video_start(); + DECLARE_MACHINE_START(llc1); + DECLARE_MACHINE_RESET(llc1); + DECLARE_MACHINE_RESET(llc2); + UINT32 screen_update_llc1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_llc2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; + optional_device m_ram; +}; + +#endif diff --git a/src/mame/includes/lviv.h b/src/mame/includes/lviv.h new file mode 100644 index 00000000000..363948263e2 --- /dev/null +++ b/src/mame/includes/lviv.h @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/***************************************************************************** + * + * includes/lviv.h + * + ****************************************************************************/ + +#ifndef LVIV_H_ +#define LVIV_H_ + +#include "imagedev/snapquik.h" +#include "machine/i8255.h" +#include "sound/speaker.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" + +class lviv_state : public driver_device +{ +public: + lviv_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette") { } + + unsigned char * m_video_ram; + unsigned short m_colortable[1][4]; + UINT8 m_ppi_port_outputs[2][3]; + UINT8 m_startup_mem_map; + DECLARE_READ8_MEMBER(lviv_io_r); + DECLARE_WRITE8_MEMBER(lviv_io_w); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(lviv); + UINT32 screen_update_lviv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER(lviv_ppi_0_porta_r); + DECLARE_READ8_MEMBER(lviv_ppi_0_portb_r); + DECLARE_READ8_MEMBER(lviv_ppi_0_portc_r); + DECLARE_WRITE8_MEMBER(lviv_ppi_0_porta_w); + DECLARE_WRITE8_MEMBER(lviv_ppi_0_portb_w); + DECLARE_WRITE8_MEMBER(lviv_ppi_0_portc_w); + DECLARE_READ8_MEMBER(lviv_ppi_1_porta_r); + DECLARE_READ8_MEMBER(lviv_ppi_1_portb_r); + DECLARE_READ8_MEMBER(lviv_ppi_1_portc_r); + DECLARE_WRITE8_MEMBER(lviv_ppi_1_porta_w); + DECLARE_WRITE8_MEMBER(lviv_ppi_1_portb_w); + DECLARE_WRITE8_MEMBER(lviv_ppi_1_portc_w); + required_device m_maincpu; + required_device m_speaker; + required_device m_cassette; + required_device m_ram; + required_device m_palette; + void lviv_update_palette(UINT8 pal); + void lviv_update_memory (); + void lviv_setup_snapshot (UINT8 * data); + void dump_registers(); + int lviv_verify_snapshot (UINT8 * data, UINT32 size); + DECLARE_SNAPSHOT_LOAD_MEMBER( lviv ); + DECLARE_INPUT_CHANGED_MEMBER(lviv_reset); +}; + +/*----------- defined in video/lviv.c -----------*/ + +extern const unsigned char lviv_palette[8*3]; + + +#endif /* LVIV_H_ */ diff --git a/src/mame/includes/lynx.h b/src/mame/includes/lynx.h new file mode 100644 index 00000000000..9d45fa13467 --- /dev/null +++ b/src/mame/includes/lynx.h @@ -0,0 +1,295 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/lynx.h + * + ****************************************************************************/ + +#ifndef LYNX_H_ +#define LYNX_H_ + +#include "audio/lynx.h" +#include "imagedev/snapquik.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define LYNX_CART 0 +#define LYNX_QUICKLOAD 1 + + +struct BLITTER +{ + // global + UINT16 screen; + UINT16 colbuf; + UINT16 colpos; // byte where value of collision is written + INT16 xoff, yoff; + // in command + int mode; + UINT8 spr_coll; + UINT8 spritenr; + INT16 x_pos,y_pos; + UINT16 width, height; // uint16 important for blue lightning + INT16 tilt_accumulator; + UINT16 height_accumulator, width_accumulator; + UINT16 width_offset, height_offset; + INT16 stretch, tilt; + UINT8 color[16]; // or stored + UINT16 bitmap; + int use_rle; + int line_color; + + UINT8 spr_ctl0; + UINT8 spr_ctl1; + UINT16 scb; + UINT16 scb_next; + UINT8 sprite_collide; + + int everon; + UINT8 fred; + int memory_accesses; + attotime time; + + int no_collide; + int vstretch; + int lefthanded; + int busy; +}; + +struct UART +{ + UINT8 serctl; + UINT8 data_received, data_to_send, buffer; + int received; + int sending; + int buffer_loaded; +}; + +struct SUZY +{ + UINT8 data[0x100]; + UINT8 high; + int low; + int signed_math; + int accumulate; + int accumulate_overflow; +}; + +struct MIKEY +{ + UINT8 data[0x100]; + UINT16 disp_addr; + UINT8 vb_rest; +}; + +struct LYNX_TIMER +{ + UINT8 bakup; + UINT8 cntrl1; + UINT8 cntrl2; + UINT8 counter; + emu_timer *timer; + int timer_active; +}; + +#define NR_LYNX_TIMERS 8 + +class lynx_state : public driver_device +{ +public: + enum + { + TIMER_BLITTER, + TIMER_SHOT, + TIMER_UART_LOOPBACK, + TIMER_UART + }; + + lynx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_mem_0000(*this, "mem_0000"), + m_mem_fc00(*this, "mem_fc00"), + m_mem_fd00(*this, "mem_fd00"), + m_mem_fe00(*this, "mem_fe00"), + m_mem_fffa(*this, "mem_fffa"), + m_maincpu(*this, "maincpu"), + m_sound(*this, "custom"), + m_cart(*this, "cartslot"), + m_palette(*this, "palette") { } + + virtual void video_start(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + required_shared_ptr m_mem_0000; + required_shared_ptr m_mem_fc00; + required_shared_ptr m_mem_fd00; + required_shared_ptr m_mem_fe00; + required_shared_ptr m_mem_fffa; + required_device m_maincpu; + required_device m_sound; + required_device m_cart; + required_device m_palette; + UINT16 m_granularity; + int m_sign_AB; + int m_sign_CD; + UINT32 m_lynx_palette[0x10]; + int m_rotate; + UINT8 m_memory_config; + + BLITTER m_blitter; + SUZY m_suzy; + MIKEY m_mikey; + UART m_uart; + LYNX_TIMER m_timer[NR_LYNX_TIMERS]; + + bitmap_ind16 m_bitmap; + bitmap_ind16 m_bitmap_temp; + DECLARE_READ8_MEMBER(suzy_read); + DECLARE_WRITE8_MEMBER(suzy_write); + DECLARE_WRITE8_MEMBER(lynx_uart_w); + DECLARE_READ8_MEMBER(lynx_uart_r); + DECLARE_READ8_MEMBER(mikey_read); + DECLARE_WRITE8_MEMBER(mikey_write); + DECLARE_READ8_MEMBER(lynx_memory_config_r); + DECLARE_WRITE8_MEMBER(lynx_memory_config_w); + void lynx_divide(); + void lynx_multiply(); + UINT8 lynx_timer_read(int which, int offset); + void lynx_timer_write(int which, int offset, UINT8 data); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(lynx); + void sound_cb(); + TIMER_CALLBACK_MEMBER(lynx_blitter_timer); + TIMER_CALLBACK_MEMBER(lynx_timer_shot); + TIMER_CALLBACK_MEMBER(lynx_uart_loopback_timer); + TIMER_CALLBACK_MEMBER(lynx_uart_timer); + void lynx_postload(); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( lynx_cart ); + UINT8 lynx_read_ram(UINT16 address); + void lynx_write_ram(UINT16 address, UINT8 data); + inline void lynx_plot_pixel(const int mode, const INT16 x, const int y, const int color); + void lynx_blit_do_work(const int y, const int xdir, const int bits_per_pixel, const int mask ); + void lynx_blit_rle_do_work( const INT16 y, const int xdir, const int bits_per_pixel, const int mask ); + void lynx_blit_lines(); + void lynx_blitter(); + void lynx_draw_line(); + void lynx_timer_init(int which); + void lynx_timer_signal_irq(int which); + void lynx_timer_count_down(int which); + UINT32 lynx_time_factor(int val); + void lynx_uart_reset(); + int lynx_verify_cart (char *header, int kind); + DECLARE_QUICKLOAD_LOAD_MEMBER( lynx ); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +/*---------- suzy registers ------------- */ +#define TMPADRL 0x00 // Temporary address (not sure what this is used for) +#define TMPADRH 0x01 +#define TILTACUML 0x02 // Tilt accumulator (signed fixed-point, eight bits to the left of decimal) +#define TILTACUMH 0x03 +#define HOFFL 0x04 // X offset to edge of visible window +#define HOFFH 0x05 +#define VOFFL 0x06 // Y offset to edge of visible window +#define VOFFH 0x07 +#define VIDBASL 0x08 // Video buffer address +#define VIDBASH 0x09 +#define COLLBASL 0x0A // Collision buffer address +#define COLLBASH 0x0B +#define VIDADRL 0x0C // Current Video Build Address +#define VIDADRH 0x0D +#define COLLADRL 0x0E // Current Collision Build Address +#define COLLADRH 0x0F +#define SCBNEXTL 0x10 // Address of next SCB +#define SCBNEXTH 0x11 +#define SPRDLINEL 0x12 // Sprite data start address +#define SPRDLINEH 0x13 +#define HPOSSTRTL 0x14 // Starting Hpos +#define HPOSSTRTH 0x15 +#define VPOSSTRTL 0x16 // Starting Vpos +#define VPOSSTRTH 0x17 +#define SPRHSIZL 0x18 // H Size +#define SPRHSIZH 0x19 +#define SPRVSIZL 0x1A // V Size +#define SPRVSIZH 0x1B +#define STRETCHL 0x1C // H/V Size Adder (signed fixed-point) +#define STRETCHH 0x1D +#define TILTL 0x1E // H Position Adder (signed fixed-point) +#define TILTH 0x1F +#define SPRDOFFL 0x20 // Offset to Next Sprite Data Line +#define SPRDOFFH 0x21 +#define SPRVPOSL 0x22 // Current Vpos +#define SPRVPOSH 0x23 +#define COLLOFFL 0x24 // Offset to Collision Depository +#define COLLOFFH 0x25 +#define VSIZACUML 0x26 // Vertical Size Accumulator +#define VSIZACUMH 0x27 +#define HSIZOFFL 0x28 // Horizontal Size Offset +#define HSIZOFFH 0x29 +#define VSIZOFFL 0x2A // Vertical Size Offset +#define VSIZOFFH 0x2B +#define SCBADRL 0x2C // Address of Current SCB +#define SCBADRH 0x2D +#define PROCADRL 0x2E // Current Spr Data Proc Address + +#define MATH_D 0x52 +#define MATH_C 0x53 +#define MATH_B 0x54 +#define MATH_A 0x55 +#define MATH_P 0x56 +#define MATH_N 0x57 +#define MATH_H 0x60 +#define MATH_G 0x61 +#define MATH_F 0x62 +#define MATH_E 0x63 + +#define MATH_M 0x6c +#define MATH_L 0x6d +#define MATH_K 0x6e +#define MATH_J 0x6f + +#define SPRCTL0 0x80 // Sprite Control Bits 0 (W)(U) +#define SPRCTL1 0x81 // Sprite Control Bits 1 (W)(U) +#define SPRCOLL 0x82 // Sprite Collision Number (W) +#define SPRINIT 0x83 // Sprite Initialization Bits (W)(U) + +#define SUZYHREV 0x88 // Suzy Hardware Revision (R) = '01' + +#define SUZYBUSEN 0x90 // Suzy Bus Enable (W) +#define SPRGO 0x91 // Sprite Process Start Bit (W) +#define SPRSYS 0x92 // System Control Bits (R/W) + +#define JOYSTICK 0xB0 // Read Joystick and Switches(R) +#define SWITCHES 0xB1 // Read Other Switches (R) +#define RCART 0xB2 // Read / Write Cartridge Bank 0 (R/W) +#define RCART_BANK1 0xB3 // Read / Write Cartridge Bank 1 (R/W) (Unused in existing cartridges?) + +//0xC0 LEDs (W) +//0xC2 Parallel Port Status(R/W) +//0xC3 Parallel Port Data (R/W) +//0xC4 Howie (R/W) + +// SCB offsets + +//8-bit +#define SCB_SPRCTL0 0x00 // 8 bit +#define SCB_SPRCTL1 0x01 // 8 bit +#define SCB_SPRCOLL 0x02 // 4 bit + +//16-bit +#define SCB_SCBNEXT 0x03 // L,H Address of Next SCB +#define SCB_SPRDLINE 0x05 // L,H Start of Sprite Data Line Address +#define SCB_HPOSSTRT 0x07 // L,H Starting Hpos +#define SCB_VPOSSTRT 0x09 // L,H Starting Vpos +#define SCB_SPRHSIZ 0x0B // L,H H Size +#define SCB_SPRVSIZ 0x0D // L,H V Size +#define SCB_STRETCH 0x0F // L H H/V Size Adder +#define SCB_TILT 0x11 // L,H H Position Adder + +#endif /* LYNX_H_ */ diff --git a/src/mame/includes/m5.h b/src/mame/includes/m5.h new file mode 100644 index 00000000000..6d95a69a6c5 --- /dev/null +++ b/src/mame/includes/m5.h @@ -0,0 +1,87 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __M5__ +#define __M5__ + +#include "machine/z80ctc.h" + +#define Z80_TAG "ic17" +#define Z80CTC_TAG "ic19" +#define SN76489AN_TAG "ic15" +#define TMS9918A_TAG "ic10" +#define TMS9929A_TAG "ic10" +#define I8255A_TAG "i8255a" +#define Z80_FD5_TAG "z80fd5" +#define UPD765_TAG "upd765" +#define CENTRONICS_TAG "centronics" +#define SCREEN_TAG "screen" + +class m5_state : public driver_device +{ +public: + m5_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_fd5cpu(*this, Z80_FD5_TAG), + m_ctc(*this, Z80CTC_TAG), + m_ppi(*this, I8255A_TAG), + m_fdc(*this, UPD765_TAG), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_centronics(*this, CENTRONICS_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, UPD765_TAG ":0:525dd"), + m_reset(*this, "RESET") + { } + + required_device m_maincpu; + required_device m_fd5cpu; + required_device m_ctc; + required_device m_ppi; + required_device m_fdc; + required_device m_cassette; + required_device m_cart; + required_device m_centronics; + required_device m_ram; + required_device m_floppy0; + required_ioport m_reset; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( sts_r ); + DECLARE_WRITE8_MEMBER( com_w ); + + DECLARE_READ8_MEMBER( ppi_pa_r ); + DECLARE_WRITE8_MEMBER( ppi_pa_w ); + DECLARE_WRITE8_MEMBER( ppi_pb_w ); + DECLARE_READ8_MEMBER( ppi_pc_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + + DECLARE_READ8_MEMBER( fd5_data_r ); + DECLARE_WRITE8_MEMBER( fd5_data_w ); + DECLARE_READ8_MEMBER( fd5_com_r ); + DECLARE_WRITE8_MEMBER( fd5_com_w ); + DECLARE_WRITE8_MEMBER( fd5_ctrl_w ); + DECLARE_WRITE8_MEMBER( fd5_tc_w ); + + // video state +// const TMS9928a_interface *m_vdp_intf; + + int m_centronics_busy; + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + + // floppy state + UINT8 m_fd5_data; + UINT8 m_fd5_com; + int m_intra; + int m_ibfa; + int m_obfa; + DECLARE_DRIVER_INIT(pal); + DECLARE_DRIVER_INIT(ntsc); + DECLARE_WRITE_LINE_MEMBER(sordm5_video_interrupt_callback); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); +}; + +#endif diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h new file mode 100644 index 00000000000..6b0092501fd --- /dev/null +++ b/src/mame/includes/mac.h @@ -0,0 +1,562 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/***************************************************************************** + * + * includes/mac.h + * + * Macintosh driver declarations + * + ****************************************************************************/ + +#ifndef MAC_H_ +#define MAC_H_ + +#include "machine/8530scc.h" +#include "machine/6522via.h" +#include "machine/ram.h" +#include "machine/egret.h" +#include "machine/cuda.h" +#include "bus/nubus/nubus.h" +#include "bus/macpds/macpds.h" +#include "machine/ncr539x.h" +#include "machine/ncr5380.h" +#include "machine/mackbd.h" +#include "machine/macrtc.h" +#include "sound/asc.h" +#include "sound/awacs.h" +#include "cpu/m68000/m68000.h" + +#define MAC_SCREEN_NAME "screen" +#define MAC_539X_1_TAG "539x_1" +#define MAC_539X_2_TAG "539x_2" +#define MACKBD_TAG "mackbd" + +// uncomment to run i8021 keyboard in original Mac/512(e)/Plus +//#define MAC_USE_EMULATED_KBD (1) + +// model helpers +#define ADB_IS_BITBANG ((mac->m_model == MODEL_MAC_SE || mac->m_model == MODEL_MAC_CLASSIC) || (mac->m_model >= MODEL_MAC_II && mac->m_model <= MODEL_MAC_IICI) || (mac->m_model == MODEL_MAC_SE30) || (mac->m_model == MODEL_MAC_QUADRA_700)) +#define ADB_IS_BITBANG_CLASS ((m_model == MODEL_MAC_SE || m_model == MODEL_MAC_CLASSIC) || (m_model >= MODEL_MAC_II && m_model <= MODEL_MAC_IICI) || (m_model == MODEL_MAC_SE30) || (m_model == MODEL_MAC_QUADRA_700)) +#define ADB_IS_EGRET (m_model >= MODEL_MAC_LC && m_model <= MODEL_MAC_CLASSIC_II) || ((m_model >= MODEL_MAC_IISI) && (m_model <= MODEL_MAC_IIVI)) +#define ADB_IS_EGRET_NONCLASS (mac->m_model >= MODEL_MAC_LC && mac->m_model <= MODEL_MAC_CLASSIC_II) || ((mac->m_model >= MODEL_MAC_IISI) && (mac->m_model <= MODEL_MAC_IIVI)) +#define ADB_IS_CUDA ((m_model >= MODEL_MAC_COLOR_CLASSIC && m_model <= MODEL_MAC_LC_580) || ((m_model >= MODEL_MAC_QUADRA_660AV) && (m_model <= MODEL_MAC_QUADRA_630)) || (m_model >= MODEL_MAC_POWERMAC_6100)) +#define ADB_IS_CUDA_NONCLASS ((mac->m_model >= MODEL_MAC_COLOR_CLASSIC && mac->m_model <= MODEL_MAC_LC_580) || ((mac->m_model >= MODEL_MAC_QUADRA_660AV) && (mac->m_model <= MODEL_MAC_QUADRA_630)) || (mac->m_model >= MODEL_MAC_POWERMAC_6100)) +#define ADB_IS_PM_VIA1_CLASS (m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100) +#define ADB_IS_PM_VIA2_CLASS (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c) +#define ADB_IS_PM_CLASS ((m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100) || (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c)) + +/* for Egret and CUDA streaming MCU commands, command types */ +enum mac_streaming_t +{ + MCU_STREAMING_NONE = 0, + MCU_STREAMING_PRAMRD, + MCU_STREAMING_PRAMWR, + MCU_STREAMING_WRAMRD, + MCU_STREAMING_WRAMWR +}; + +enum +{ + RBV_TYPE_RBV = 0, + RBV_TYPE_V8, + RBV_TYPE_SONORA, + RBV_TYPE_DAFB +}; + +/* tells which model is being emulated (set by macxxx_init) */ +enum model_t +{ + MODEL_MAC_128K512K, // 68000 machines + MODEL_MAC_512KE, + MODEL_MAC_PLUS, + MODEL_MAC_SE, + MODEL_MAC_CLASSIC, + + MODEL_MAC_PORTABLE, // Portable/PB100 are sort of hybrid classic and Mac IIs + MODEL_MAC_PB100, + + MODEL_MAC_II, // Mac II class 68020/030 machines + MODEL_MAC_II_FDHD, + MODEL_MAC_IIX, + MODEL_MAC_IICX, + MODEL_MAC_IICI, + MODEL_MAC_IISI, + MODEL_MAC_IIVX, + MODEL_MAC_IIVI, + MODEL_MAC_IIFX, + MODEL_MAC_SE30, + + MODEL_MAC_LC, // LC class 68030 machines, generally using a V8 or compatible gate array + MODEL_MAC_LC_II, + MODEL_MAC_LC_III, + MODEL_MAC_LC_III_PLUS, + MODEL_MAC_CLASSIC_II, + MODEL_MAC_COLOR_CLASSIC, + + MODEL_MAC_LC_475, // LC III clones with Cuda instead of Egret and 68LC040 on most models + MODEL_MAC_LC_520, + MODEL_MAC_LC_550, + MODEL_MAC_TV, + MODEL_MAC_LC_575, + MODEL_MAC_LC_580, + + MODEL_MAC_PB140, // 68030 PowerBooks. 140/145/145B/170 all have the same machine ID + MODEL_MAC_PB160, // 160/180/165 all have the same machine ID too + MODEL_MAC_PB165c, + MODEL_MAC_PB180c, + MODEL_MAC_PB150, // 150 is fairly radically different from the other 1x0s + + MODEL_MAC_PBDUO_210, // 68030 PowerBook Duos + MODEL_MAC_PBDUO_230, + MODEL_MAC_PBDUO_250, + MODEL_MAC_PBDUO_270c, + + MODEL_MAC_QUADRA_700, // 68(LC)040 desktops + MODEL_MAC_QUADRA_610, + MODEL_MAC_QUADRA_650, + MODEL_MAC_QUADRA_800, + MODEL_MAC_QUADRA_900, + MODEL_MAC_QUADRA_950, + MODEL_MAC_QUADRA_660AV, + MODEL_MAC_QUADRA_840AV, + MODEL_MAC_QUADRA_605, + MODEL_MAC_QUADRA_630, + + MODEL_MAC_PB550c, // 68(LC)040 PowerBooks + MODEL_MAC_PB520, + MODEL_MAC_PB520c, + MODEL_MAC_PB540, + MODEL_MAC_PB540c, + MODEL_MAC_PB190, + MODEL_MAC_PB190cs, + + MODEL_MAC_POWERMAC_6100, // NuBus PowerMacs + MODEL_MAC_POWERMAC_7100, + MODEL_MAC_POWERMAC_8100 +}; + +// video parameters for classic Macs +#define MAC_H_VIS (512) +#define MAC_V_VIS (342) +#define MAC_H_TOTAL (704) // (512+192) +#define MAC_V_TOTAL (370) // (342+28) + +/*----------- defined in machine/mac.c -----------*/ + +void mac_fdc_set_enable_lines(device_t *device, int enable_mask); + +/*----------- defined in audio/mac.c -----------*/ + +class mac_sound_device : public device_t, + public device_sound_interface +{ +public: + mac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mac_sound_device() {} + + void enable_sound(int on); + void set_sound_buffer(int buffer); + void set_volume(int volume); + void sh_updatebuffer(); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + + ram_device *m_ram; + model_t m_mac_model; + + sound_stream *m_mac_stream; + int m_sample_enable; + UINT16 *m_mac_snd_buf_ptr; + UINT8 *m_snd_cache; + int m_snd_cache_len; + int m_snd_cache_head; + int m_snd_cache_tail; + int m_indexx; +}; + +extern const device_type MAC_SOUND; + + +/* Mac driver data */ + +class mac_state : public driver_device +{ +public: + mac_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_via1(*this, "via6522_0"), + m_via2(*this, "via6522_1"), + m_asc(*this, "asc"), + m_awacs(*this, "awacs"), + m_egret(*this, EGRET_TAG), + m_cuda(*this, CUDA_TAG), + m_ram(*this, RAM_TAG), + m_539x_1(*this, MAC_539X_1_TAG), + m_539x_2(*this, MAC_539X_2_TAG), + m_ncr5380(*this, "ncr5380"), + m_mackbd(*this, MACKBD_TAG), + m_rtc(*this,"rtc"), + m_mouse0(*this, "MOUSE0"), + m_mouse1(*this, "MOUSE1"), + m_mouse2(*this, "MOUSE2"), + m_key0(*this, "KEY0"), + m_key1(*this, "KEY1"), + m_key2(*this, "KEY2"), + m_key3(*this, "KEY3"), + m_key4(*this, "KEY4"), + m_key5(*this, "KEY5"), + m_key6(*this, "KEY6"), + m_montype(*this, "MONTYPE"), + m_vram(*this,"vram"), + m_vram16(*this,"vram16"), + m_via2_ca1_hack(0), + m_screen(*this, "screen"), + m_palette(*this, "palette") + { + } + + required_device m_maincpu; + required_device m_via1; + optional_device m_via2; + optional_device m_asc; + optional_device m_awacs; + optional_device m_egret; + optional_device m_cuda; + required_device m_ram; + optional_device m_539x_1; + optional_device m_539x_2; + optional_device m_ncr5380; + optional_device m_mackbd; + optional_device m_rtc; + + required_ioport m_mouse0, m_mouse1, m_mouse2; + required_ioport m_key0, m_key1, m_key2, m_key3, m_key4, m_key5; + optional_ioport m_key6, m_montype; + + virtual void machine_start(); + virtual void machine_reset(); + + model_t m_model; + + UINT32 m_overlay; + int m_drive_select; + int m_scsiirq_enable; + + UINT32 m_via2_vbl; + UINT32 m_se30_vbl_enable; + UINT8 m_nubus_irq_state; + +#ifndef MAC_USE_EMULATED_KBD + /* used to store the reply to most keyboard commands */ + int m_keyboard_reply; + + /* Keyboard communication in progress? */ + int m_kbd_comm; + int m_kbd_receive; + /* timer which is used to time out inquiry */ + emu_timer *m_inquiry_timeout; + + int m_kbd_shift_reg; + int m_kbd_shift_count; + + /* keycode buffer (used for keypad/arrow key transition) */ + int m_keycode_buf[2]; + int m_keycode_buf_index; +#endif + + /* keyboard matrix to detect transition - macadb needs to stop relying on this */ + int m_key_matrix[7]; + + int m_mouse_bit_x; + int m_mouse_bit_y; + int last_mx, last_my; + int count_x, count_y; + int m_last_was_x; + int m_screen_buffer; + + int irq_count, ca1_data, ca2_data; + + // Mac ADB state + INT32 m_adb_irq_pending, m_adb_waiting_cmd, m_adb_datasize, m_adb_buffer[257]; + INT32 m_adb_state, m_adb_command, m_adb_send, m_adb_timer_ticks, m_adb_extclock, m_adb_direction; + INT32 m_adb_listenreg, m_adb_listenaddr, m_adb_last_talk, m_adb_srq_switch; + INT32 m_adb_streaming, m_adb_stream_ptr; + INT32 m_adb_linestate; + bool m_adb_srqflag; +#define kADBKeyBufSize 32 + UINT8 m_adb_keybuf[kADBKeyBufSize]; + UINT8 m_adb_keybuf_start; + UINT8 m_adb_keybuf_end; + + // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition) + UINT8 m_pm_data_send, m_pm_data_recv, m_pm_ack, m_pm_req, m_pm_cmd[32], m_pm_out[32], m_pm_dptr, m_pm_sptr, m_pm_slen, m_pm_state; + UINT8 m_pmu_int_status, m_pmu_last_adb_command, m_pmu_poll; + emu_timer *m_pmu_send_timer; + + // 60.15 Hz timer for RBV/V8/Sonora/Eagle/VASP/etc. + emu_timer *m_6015_timer; + + // RBV and friends (V8, etc) + UINT8 m_rbv_regs[256], m_rbv_ier, m_rbv_ifr, m_rbv_type, m_rbv_montype, m_rbv_vbltime; + UINT32 m_rbv_colors[3], m_rbv_count, m_rbv_clutoffs, m_rbv_immed10wr; + UINT32 m_rbv_palette[256]; + UINT8 m_sonora_vctl[8]; + emu_timer *m_vbl_timer, *m_cursor_timer; + UINT16 m_cursor_line; + UINT16 m_dafb_int_status; + int m_dafb_scsi1_drq, m_dafb_scsi2_drq; + UINT8 m_dafb_mode; + UINT32 m_dafb_base, m_dafb_stride; + + // this is shared among all video setups with vram + optional_shared_ptr m_vram; + optional_shared_ptr m_vram16; + + // interrupts + int m_scc_interrupt, m_via_interrupt, m_via2_interrupt, m_scsi_interrupt, m_asc_interrupt, m_last_taken_interrupt; + + // defined in machine/mac.c + void v8_resize(); + void set_memory_overlay(int overlay); + void scc_mouse_irq( int x, int y ); + void nubus_slot_interrupt(UINT8 slot, UINT32 state); + DECLARE_WRITE_LINE_MEMBER(set_scc_interrupt); + void set_via_interrupt(int value); + void set_via2_interrupt(int value); + void field_interrupts(); + void rtc_write_rTCEnb(int data); + void rtc_shift_data(int data); + void vblank_irq(); + void rtc_incticks(); + void adb_talk(); + void mouse_callback(); + void rbv_recalc_irqs(); + void pmu_exec(); + void mac_adb_newaction(int state); + void set_adb_line(int linestate); + + DECLARE_READ16_MEMBER ( mac_via_r ); + DECLARE_WRITE16_MEMBER ( mac_via_w ); + DECLARE_READ16_MEMBER ( mac_via2_r ); + DECLARE_WRITE16_MEMBER ( mac_via2_w ); + DECLARE_READ16_MEMBER ( mac_autovector_r ); + DECLARE_WRITE16_MEMBER ( mac_autovector_w ); + DECLARE_READ16_MEMBER ( mac_iwm_r ); + DECLARE_WRITE16_MEMBER ( mac_iwm_w ); + DECLARE_READ16_MEMBER ( mac_scc_r ); + DECLARE_WRITE16_MEMBER ( mac_scc_w ); + DECLARE_WRITE16_MEMBER ( mac_scc_2_w ); + DECLARE_READ16_MEMBER ( macplus_scsi_r ); + DECLARE_WRITE16_MEMBER ( macplus_scsi_w ); + DECLARE_WRITE16_MEMBER ( macii_scsi_w ); + DECLARE_READ32_MEMBER (macii_scsi_drq_r); + DECLARE_WRITE32_MEMBER (macii_scsi_drq_w); + + DECLARE_READ32_MEMBER( rbv_ramdac_r ); + DECLARE_WRITE32_MEMBER( rbv_ramdac_w ); + DECLARE_WRITE32_MEMBER( ariel_ramdac_w ); + DECLARE_READ8_MEMBER( mac_sonora_vctl_r ); + DECLARE_WRITE8_MEMBER( mac_sonora_vctl_w ); + DECLARE_READ8_MEMBER ( mac_rbv_r ); + DECLARE_WRITE8_MEMBER ( mac_rbv_w ); + + DECLARE_READ32_MEMBER(mac_read_id); + + DECLARE_READ16_MEMBER(mac_config_r); + + DECLARE_READ32_MEMBER(biu_r); + DECLARE_WRITE32_MEMBER(biu_w); + DECLARE_READ8_MEMBER(oss_r); + DECLARE_WRITE8_MEMBER(oss_w); + DECLARE_READ32_MEMBER(buserror_r); + DECLARE_READ8_MEMBER(swimiop_r); + DECLARE_WRITE8_MEMBER(swimiop_w); + DECLARE_READ8_MEMBER(scciop_r); + DECLARE_WRITE8_MEMBER(scciop_w); + + DECLARE_READ8_MEMBER(hmc_r); + DECLARE_WRITE8_MEMBER(hmc_w); + DECLARE_READ8_MEMBER(amic_dma_r); + DECLARE_WRITE8_MEMBER(amic_dma_w); + DECLARE_READ8_MEMBER(pmac_diag_r); + + DECLARE_READ8_MEMBER(mac_gsc_r); + DECLARE_WRITE8_MEMBER(mac_gsc_w); + + DECLARE_READ8_MEMBER(mac_5396_r); + DECLARE_WRITE8_MEMBER(mac_5396_w); + + DECLARE_READ32_MEMBER(dafb_r); + DECLARE_WRITE32_MEMBER(dafb_w); + DECLARE_READ32_MEMBER(dafb_dac_r); + DECLARE_WRITE32_MEMBER(dafb_dac_w); + + DECLARE_READ32_MEMBER(macwd_r); + DECLARE_WRITE32_MEMBER(macwd_w); + + DECLARE_WRITE_LINE_MEMBER(nubus_irq_9_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_a_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_b_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_c_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_d_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_e_w); + + DECLARE_WRITE_LINE_MEMBER(irq_539x_1_w); + DECLARE_WRITE_LINE_MEMBER(drq_539x_1_w); + + DECLARE_WRITE_LINE_MEMBER(cuda_reset_w); + DECLARE_WRITE_LINE_MEMBER(adb_linechange_w); + + DECLARE_WRITE_LINE_MEMBER(mac_scsi_irq); + DECLARE_WRITE_LINE_MEMBER(mac_asc_irq); + + DECLARE_DIRECT_UPDATE_MEMBER(overlay_opbaseoverride); +private: + int has_adb(); + void adb_reset(); + void adb_vblank(); + int adb_pollkbd(int update); + int adb_pollmouse(); + void adb_accummouse( UINT8 *MouseX, UINT8 *MouseY ); + void pmu_one_byte_reply(UINT8 result); + void pmu_three_byte_reply(UINT8 result1, UINT8 result2, UINT8 result3); + + // wait states for accessing the VIA + int m_via_cycles; + + // ADB mouse state + int m_adb_mouseaddr; + int m_adb_lastmousex, m_adb_lastmousey, m_adb_lastbutton, m_adb_mouse_initialized; + + // ADB keyboard state + int m_adb_keybaddr; + int m_adb_keybinitialized, m_adb_currentkeys[2], m_adb_modifiers; + + // PRAM for ADB MCU HLEs (mostly unused now) + UINT8 m_adb_pram[256]; + + UINT8 m_oss_regs[0x400]; + + // AMIC for x100 PowerMacs + UINT8 m_amic_regs[0x200]; + + // HMC for x100 PowerMacs + UINT64 m_hmc_reg, m_hmc_shiftout; + + int m_via2_ca1_hack; + optional_device m_screen; + optional_device m_palette; +public: + emu_timer *m_scanline_timer; + emu_timer *m_adb_timer; + DECLARE_DRIVER_INIT(maclc2); + DECLARE_DRIVER_INIT(maciifdhd); + DECLARE_DRIVER_INIT(macse30); + DECLARE_DRIVER_INIT(macprtb); + DECLARE_DRIVER_INIT(maciivx); + DECLARE_DRIVER_INIT(macpd210); + DECLARE_DRIVER_INIT(macii); + DECLARE_DRIVER_INIT(macclassic); + DECLARE_DRIVER_INIT(macquadra700); + DECLARE_DRIVER_INIT(macclassic2); + DECLARE_DRIVER_INIT(maciifx); + DECLARE_DRIVER_INIT(maclc); + DECLARE_DRIVER_INIT(macpb160); + DECLARE_DRIVER_INIT(macplus); + DECLARE_DRIVER_INIT(macse); + DECLARE_DRIVER_INIT(macpb140); + DECLARE_DRIVER_INIT(mac128k512k); + DECLARE_DRIVER_INIT(macpm6100); + DECLARE_DRIVER_INIT(mac512ke); + DECLARE_DRIVER_INIT(maclc520); + DECLARE_DRIVER_INIT(maciici); + DECLARE_DRIVER_INIT(maciix); + DECLARE_DRIVER_INIT(maclrcclassic); + DECLARE_DRIVER_INIT(maciisi); + DECLARE_DRIVER_INIT(maciicx); + DECLARE_DRIVER_INIT(maclc3); + DECLARE_DRIVER_INIT(maclc3plus); + DECLARE_DRIVER_INIT(macpm7100); + DECLARE_DRIVER_INIT(macpm8100); + DECLARE_DRIVER_INIT(macpb100); + DECLARE_VIDEO_START(mac); + DECLARE_PALETTE_INIT(mac); + DECLARE_VIDEO_START(macprtb); + DECLARE_PALETTE_INIT(macgsc); + DECLARE_VIDEO_START(macsonora); + DECLARE_VIDEO_RESET(macrbv); + DECLARE_VIDEO_START(macdafb); + DECLARE_VIDEO_RESET(macdafb); + DECLARE_VIDEO_START(macv8); + DECLARE_VIDEO_RESET(macsonora); + DECLARE_VIDEO_RESET(maceagle); + DECLARE_VIDEO_START(macrbv); + UINT32 screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macprtb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macse30(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(mac_rbv_vbl); +#ifndef MAC_USE_EMULATED_KBD + TIMER_CALLBACK_MEMBER(kbd_clock); + TIMER_CALLBACK_MEMBER(inquiry_timeout_func); +#endif + TIMER_CALLBACK_MEMBER(mac_6015_tick); + TIMER_CALLBACK_MEMBER(mac_scanline_tick); + TIMER_CALLBACK_MEMBER(dafb_vbl_tick); + TIMER_CALLBACK_MEMBER(dafb_cursor_tick); + DECLARE_WRITE_LINE_MEMBER(mac_via_out_cb2); + DECLARE_WRITE_LINE_MEMBER(mac_adb_via_out_cb2); + DECLARE_READ8_MEMBER(mac_via_in_a); + DECLARE_READ8_MEMBER(mac_via_in_b); + DECLARE_WRITE8_MEMBER(mac_via_out_a); + DECLARE_WRITE8_MEMBER(mac_via_out_b); + DECLARE_READ8_MEMBER(mac_via_in_a_pmu); + DECLARE_READ8_MEMBER(mac_via_in_b_pmu); + DECLARE_WRITE8_MEMBER(mac_via_out_a_pmu); + DECLARE_WRITE8_MEMBER(mac_via_out_b_pmu); + DECLARE_WRITE8_MEMBER(mac_via_out_b_bbadb); + DECLARE_WRITE8_MEMBER(mac_via_out_b_egadb); + DECLARE_WRITE8_MEMBER(mac_via_out_b_cdadb); + DECLARE_READ8_MEMBER(mac_via_in_b_via2pmu); + DECLARE_WRITE8_MEMBER(mac_via_out_b_via2pmu); + DECLARE_READ8_MEMBER(mac_via2_in_a); + DECLARE_READ8_MEMBER(mac_via2_in_b); + DECLARE_WRITE8_MEMBER(mac_via2_out_a); + DECLARE_WRITE8_MEMBER(mac_via2_out_b); + DECLARE_READ8_MEMBER(mac_via2_in_a_pmu); + DECLARE_READ8_MEMBER(mac_via2_in_b_pmu); + DECLARE_WRITE8_MEMBER(mac_via2_out_a_pmu); + DECLARE_WRITE8_MEMBER(mac_via2_out_b_pmu); + DECLARE_WRITE_LINE_MEMBER(mac_kbd_clk_in); + void mac_state_load(); + DECLARE_WRITE_LINE_MEMBER(mac_via_irq); + DECLARE_WRITE_LINE_MEMBER(mac_via2_irq); + void dafb_recalc_ints(); + void set_scc_waitrequest(int waitrequest); + int scan_keyboard(); + void keyboard_init(); + void kbd_shift_out(int data); + void keyboard_receive(int val); + void mac_driver_init(model_t model); + void mac_tracetrap(const char *cpu_name_local, int addr, int trap); + void mac_install_memory(offs_t memory_begin, offs_t memory_end, + offs_t memory_size, void *memory_data, int is_rom, const char *bank); +}; + +#endif /* MAC_H_ */ diff --git a/src/mame/includes/macpci.h b/src/mame/includes/macpci.h new file mode 100644 index 00000000000..56f7d066431 --- /dev/null +++ b/src/mame/includes/macpci.h @@ -0,0 +1,169 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/***************************************************************************** + * + * includes/macpci.h + * + * PCI-based Power Macintosh driver declarations + * + ****************************************************************************/ + +#ifndef MACPCI_H_ +#define MACPCI_H_ + +#include "machine/8530scc.h" +#include "machine/6522via.h" +#include "machine/ram.h" +#include "machine/cuda.h" +#include "machine/ncr539x.h" +#include "sound/awacs.h" + +#define C7M (7833600) +#define C15M (C7M*2) + +#define MAC_SCREEN_NAME "screen" +#define MAC_539X_1_TAG "539x_1" +#define MAC_539X_2_TAG "539x_2" + +/* tells which model is being emulated (set by macxxx_init) */ +enum model_t +{ + PCIMODEL_MAC_PM5200, + PCIMODEL_MAC_PM6200, + PCIMODEL_MAC_PM5300, + PCIMODEL_MAC_PM7200, + PCIMODEL_MAC_PM7500, + PCIMODEL_MAC_PM8500, + PCIMODEL_MAC_PM9500, + PCIMODEL_MAC_PM7215, + PCIMODEL_MAC_PM5260, + PCIMODEL_MAC_PM5400, + PCIMODEL_MAC_PM7600, + PCIMODEL_MAC_PM8200, + PCIMODEL_MAC_PM6300, + PCIMODEL_MAC_PM6400, + PCIMODEL_MAC_PM4400, + PCIMODEL_MAC_PM5500, + PCIMODEL_MAC_PM7220, + PCIMODEL_MAC_PM7300, + PCIMODEL_MAC_PM6500, + PCIMODEL_MAC_PM8600, + PCIMODEL_MAC_PM9600, + + PCIMODEL_MAC_20TH, + + PCIMODEL_MAC_G3_GOSSAMER, + PCIMODEL_MAC_G3_ALLINONE, + + PCIMODEL_MAC_PB5x0PPC, + PCIMODEL_MAC_PB1400, + PCIMODEL_MAC_PB2300, + PCIMODEL_MAC_PB2400, + PCIMODEL_MAC_PB3400, + PCIMODEL_MAC_PB5300, + + PCIMODEL_MAC_PBG3KANGA, + PCIMODEL_MAC_PBG3WALLST1, + PCIMODEL_MAC_PBG3WALLST2, + + PCIMODEL_MAC_PIPPIN // Apple/Bandai Pippin + +}; + + +/* Mac driver data */ + +class macpci_state : public driver_device +{ +public: + macpci_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_via1(*this, "via6522_0"), + m_awacs(*this, "awacs"), + m_cuda(*this, CUDA_TAG), + m_ram(*this, RAM_TAG), + m_539x_1(*this, MAC_539X_1_TAG), + m_539x_2(*this, MAC_539X_2_TAG) + { } + + required_device m_maincpu; + required_device m_via1; + optional_device m_awacs; + required_device m_cuda; + required_device m_ram; + optional_device m_539x_1; + optional_device m_539x_2; + + virtual void machine_start(); + virtual void machine_reset(); + + model_t m_model; + + // 60.15 Hz timer for RBV/V8/Sonora/Eagle/VASP/etc. + emu_timer *m_6015_timer; + + // RBV and friends (V8, etc) + UINT8 m_rbv_regs[256], m_rbv_ier, m_rbv_ifr, m_rbv_type, m_rbv_montype, m_rbv_vbltime; + UINT32 m_rbv_colors[3], m_rbv_count, m_rbv_clutoffs, m_rbv_immed10wr; + UINT32 m_rbv_palette[256]; + UINT8 m_sonora_vctl[8]; + emu_timer *m_vbl_timer, *m_cursor_timer; + UINT16 m_cursor_line; + UINT16 m_dafb_int_status; + int m_dafb_scsi1_drq, m_dafb_scsi2_drq; + UINT8 m_dafb_mode; + UINT32 m_dafb_base, m_dafb_stride; + + // this is shared among all video setups with vram + UINT32 *m_vram; + + // defined in machine/mac.c + void set_via_interrupt(int value); + void vblank_irq(); + void mac_adb_newaction(int state); + + DECLARE_READ16_MEMBER ( mac_via_r ); + DECLARE_WRITE16_MEMBER ( mac_via_w ); + DECLARE_READ16_MEMBER ( mac_scc_r ); + DECLARE_WRITE16_MEMBER ( mac_scc_w ); + DECLARE_WRITE16_MEMBER ( mac_scc_2_w ); + + DECLARE_READ32_MEMBER(mac_read_id); + + DECLARE_READ8_MEMBER(mac_5396_r); + DECLARE_WRITE8_MEMBER(mac_5396_w); + + DECLARE_WRITE_LINE_MEMBER(irq_539x_1_w); + DECLARE_WRITE_LINE_MEMBER(drq_539x_1_w); + + DECLARE_WRITE_LINE_MEMBER(cuda_reset_w); + DECLARE_WRITE_LINE_MEMBER(cuda_adb_linechange_w); + + // hack functions + DECLARE_READ64_MEMBER ( unk1_r ); + DECLARE_READ64_MEMBER ( unk2_r ); + + DECLARE_DRIVER_INIT(pippin); +private: + // wait states for accessing the VIA + int m_via_cycles; + + // hack + UINT16 m_unk1_test; + +public: + emu_timer *m_scanline_timer; + UINT32 screen_update_pippin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(mac_6015_tick); + DECLARE_READ8_MEMBER(mac_via_in_a); + DECLARE_READ8_MEMBER(mac_via_in_b); + DECLARE_WRITE8_MEMBER(mac_via_out_a); + DECLARE_WRITE8_MEMBER(mac_via_out_b); + DECLARE_READ_LINE_MEMBER(mac_adb_via_in_cb2); + DECLARE_WRITE_LINE_MEMBER(mac_adb_via_out_cb2); + DECLARE_WRITE_LINE_MEMBER(mac_via_irq); + void mac_driver_init(model_t model); +}; + +#endif /* PCIMAC_H_ */ diff --git a/src/mame/includes/mbc55x.h b/src/mame/includes/mbc55x.h new file mode 100644 index 00000000000..d0578708939 --- /dev/null +++ b/src/mame/includes/mbc55x.h @@ -0,0 +1,221 @@ +// license:BSD-3-Clause +// copyright-holders:Phill Harvey-Smith +/* + mbc55x.h + Includes for the Sanyo MBC-550, MBC-555. + + Phill Harvey-Smith + 2011-01-29. +*/ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "machine/ram.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/wd_fdc.h" +#include "machine/i8251.h" +#include "sound/speaker.h" +#include "video/mc6845.h" +#include "imagedev/flopdrv.h" +#include "formats/pc_dsk.h" +#include "debugger.h" +#include "debug/debugcon.h" + +#define MAINCPU_TAG "maincpu" + +#define SCREEN_TAG "screen" +#define SCREEN_WIDTH_PIXELS 640 +#define SCREEN_HEIGHT_LINES 250 +#define SCREEN_NO_COLOURS 8 + +#define VIDEO_MEM_SIZE (32*1024) +#define VID_MC6845_NAME "mc6845" + +// Red and blue colour planes sit at a fixed location, green +// is in main memory. + +#define COLOUR_PLANE_SIZE 0x4000 + +#define RED_PLANE_OFFSET (0*COLOUR_PLANE_SIZE) +#define BLUE_PLANE_OFFSET (1*COLOUR_PLANE_SIZE) + +#define COLOUR_PLANE_MEMBASE 0xF0000 +#define RED_PLANE_MEMBASE (COLOUR_PLANE_MEMBASE+RED_PLANE_OFFSET) +#define BLUE_PLANE_MEMBASE (COLOUR_PLANE_MEMBASE+BLUE_PLANE_OFFSET) + +#define RED_PLANE_TAG "red" +#define BLUE_PLANE_TAG "blue" + +// Keyboard + +#define MBC55X_KEYROWS 7 +#define KEYBOARD_QUEUE_SIZE 32 + +#define KB_BITMASK 0x1000 +#define KB_SHIFTS 12 + +#define KEY_SPECIAL_TAG "KEY_SPECIAL" +#define KEY_BIT_LSHIFT 0x01 +#define KEY_BIT_RSHIFT 0x02 +#define KEY_BIT_CTRL 0x04 +#define KEY_BIT_GRAPH 0x08 + +#define PPI8255_TAG "ppi8255" +#define PIC8259_TAG "pic8259" + +// From tech manual clock c1 is fed from c0, but it approx 100Hz +#define PIT8253_TAG "pit8253" +#define PIT_C0_CLOCK 78600 +#define PIT_C1_CLOCK 100 +#define PIT_C2_CLOCK 1789770 + +#define MONO_TAG "mono" +#define I8251A_KB_TAG "i8251a_kb" +#define FDC_TAG "wd1793" + + +struct keyboard_t +{ + UINT8 keyrows[MBC55X_KEYROWS]; + emu_timer *keyscan_timer; + + UINT8 key_special; +}; + + +class mbc55x_state : public driver_device +{ +public: + mbc55x_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, MAINCPU_TAG), + m_crtc(*this, VID_MC6845_NAME), + m_kb_uart(*this, I8251A_KB_TAG), + m_pit(*this, PIT8253_TAG), + m_ppi(*this, PPI8255_TAG), + m_pic(*this, PIC8259_TAG), + m_fdc(*this, FDC_TAG), + m_floppy0(*this, FDC_TAG ":0"), + m_floppy1(*this, FDC_TAG ":1"), + m_floppy2(*this, FDC_TAG ":2"), + m_floppy3(*this, FDC_TAG ":3"), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette") + { + } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_maincpu; + required_device m_crtc; + required_device m_kb_uart; + required_device m_pit; + required_device m_ppi; + required_device m_pic; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_device m_speaker; + required_device m_ram; + required_device m_palette; + //DECLARE_READ8_MEMBER(pic8259_r); + //DECLARE_WRITE8_MEMBER(pic8259_w); + //DECLARE_READ8_MEMBER(mbc55x_disk_r); + //DECLARE_WRITE8_MEMBER(mbc55x_disk_w); + DECLARE_READ8_MEMBER(mbc55x_usart_r); + DECLARE_WRITE8_MEMBER(mbc55x_usart_w); + //DECLARE_READ8_MEMBER(mbc55x_kb_usart_r); + //DECLARE_WRITE8_MEMBER(mbc55x_kb_usart_w); + DECLARE_READ8_MEMBER(vram_page_r); + DECLARE_WRITE8_MEMBER(vram_page_w); + DECLARE_READ8_MEMBER(ppi8255_r); + DECLARE_WRITE8_MEMBER(ppi8255_w); + //DECLARE_READ8_MEMBER(pit8253_r); + //DECLARE_WRITE8_MEMBER(pit8253_w); + DECLARE_READ16_MEMBER(mbc55x_io_r); + DECLARE_WRITE16_MEMBER(mbc55x_io_w); + DECLARE_READ8_MEMBER(mbc55x_ppi_porta_r); + DECLARE_READ8_MEMBER(mbc55x_ppi_portb_r); + DECLARE_READ8_MEMBER(mbc55x_ppi_portc_r); + DECLARE_WRITE8_MEMBER(mbc55x_ppi_porta_w); + DECLARE_WRITE8_MEMBER(mbc55x_ppi_portb_w); + DECLARE_WRITE8_MEMBER(mbc55x_ppi_portc_w); + DECLARE_WRITE_LINE_MEMBER(vid_hsync_changed); + DECLARE_WRITE_LINE_MEMBER(vid_vsync_changed); + DECLARE_WRITE_LINE_MEMBER(pit8253_t2); + + UINT32 m_debug_machine; + UINT32 m_debug_video; + UINT8 m_video_mem[VIDEO_MEM_SIZE]; + UINT8 m_vram_page; + + keyboard_t m_keyboard; + DECLARE_READ8_MEMBER(mbcpic8259_r); + DECLARE_WRITE8_MEMBER(mbcpic8259_w); + DECLARE_READ8_MEMBER(mbcpit8253_r); + DECLARE_WRITE8_MEMBER(mbcpit8253_w); + DECLARE_READ8_MEMBER(mbc55x_disk_r); + DECLARE_WRITE8_MEMBER(mbc55x_disk_w); + DECLARE_READ8_MEMBER(mbc55x_kb_usart_r); + DECLARE_WRITE8_MEMBER(mbc55x_kb_usart_w); + DECLARE_DRIVER_INIT(mbc55x); + MC6845_UPDATE_ROW(crtc_update_row); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + virtual void video_reset(); + DECLARE_PALETTE_INIT(mbc55x); + void screen_eof_mbc55x(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(keyscan_callback); + void keyboard_reset(); + void scan_keyboard(); + void set_ram_size(); +}; + +/*----------- defined in drivers/mbc55x.c -----------*/ + +extern const unsigned char mbc55x_palette[SCREEN_NO_COLOURS][3]; + + +/*----------- defined in machine/mbc55x.c -----------*/ + +/* Memory controller */ +#define RAM_BANK00_TAG "bank0" +#define RAM_BANK01_TAG "bank1" +#define RAM_BANK02_TAG "bank2" +#define RAM_BANK03_TAG "bank3" +#define RAM_BANK04_TAG "bank4" +#define RAM_BANK05_TAG "bank5" +#define RAM_BANK06_TAG "bank6" +#define RAM_BANK07_TAG "bank7" +#define RAM_BANK08_TAG "bank8" +#define RAM_BANK09_TAG "bank9" +#define RAM_BANK0A_TAG "banka" +#define RAM_BANK0B_TAG "bankb" +#define RAM_BANK0C_TAG "bankc" +#define RAM_BANK0D_TAG "bankd" +#define RAM_BANK0E_TAG "banke" + +#define RAM_BANK_SIZE (64*1024) +#define RAM_BANK_COUNT 15 + +/* Floppy drive interface */ + +#define FDC_PAUSE 10000 + + +/*----------- defined in video/mbc55x.c -----------*/ + +#define RED 0 +#define GREEN 1 +#define BLUE 2 + +#define LINEAR_ADDR(seg,ofs) ((seg<<4)+ofs) + +#define OUTPUT_SEGOFS(mess,seg,ofs) logerror("%s=%04X:%04X [%08X]\n",mess,seg,ofs,((seg<<4)+ofs)) diff --git a/src/mame/includes/mbee.h b/src/mame/includes/mbee.h new file mode 100644 index 00000000000..53ea3282d37 --- /dev/null +++ b/src/mame/includes/mbee.h @@ -0,0 +1,171 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/***************************************************************************** + * + * includes/mbee.h + * + ****************************************************************************/ + +#ifndef MBEE_H_ +#define MBEE_H_ + +#include "emu.h" +#include "imagedev/snapquik.h" +#include "machine/z80pio.h" +#include "machine/8530scc.h" +#include "imagedev/cassette.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "machine/mc146818.h" +#include "video/mc6845.h" +#include "sound/speaker.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "sound/wave.h" +#include "machine/wd_fdc.h" + + +class mbee_state : public driver_device +{ +public: + enum + { + TIMER_MBEE_NEWKB + }; + + mbee_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_pio(*this, "z80pio") + , m_cassette(*this, "cassette") + , m_wave(*this, WAVE_TAG) + , m_speaker(*this, "speaker") + , m_centronics(*this, "centronics") + , m_cent_data_out(*this, "cent_data_out") + , m_crtc(*this, "crtc") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_rtc(*this, "rtc") + , m_pak(*this, "pak") + , m_telcom(*this, "telcom") + , m_basic(*this, "basic") + , m_io_x7(*this, "X.7") + , m_io_oldkb(*this, "X") + , m_io_newkb(*this, "Y") + , m_io_config(*this, "CONFIG") + , m_screen(*this, "screen") + { } + + DECLARE_WRITE8_MEMBER(port04_w); + DECLARE_WRITE8_MEMBER(port06_w); + DECLARE_READ8_MEMBER(port07_r); + DECLARE_READ8_MEMBER(port08_r); + DECLARE_WRITE8_MEMBER(port08_w); + DECLARE_WRITE8_MEMBER(port0a_w); + DECLARE_WRITE8_MEMBER(port0b_w); + DECLARE_READ8_MEMBER(port18_r); + DECLARE_READ8_MEMBER(port1c_r); + DECLARE_WRITE8_MEMBER(port1c_w); + DECLARE_WRITE8_MEMBER(mbee128_50_w); + DECLARE_WRITE8_MEMBER(mbee256_50_w); + DECLARE_READ8_MEMBER(telcom_low_r); + DECLARE_READ8_MEMBER(telcom_high_r); + DECLARE_READ8_MEMBER(speed_low_r); + DECLARE_READ8_MEMBER(speed_high_r); + DECLARE_WRITE8_MEMBER(m6545_index_w); + DECLARE_WRITE8_MEMBER(m6545_data_w); + DECLARE_READ8_MEMBER(video_low_r); + DECLARE_READ8_MEMBER(video_high_r); + DECLARE_WRITE8_MEMBER(video_low_w); + DECLARE_WRITE8_MEMBER(video_high_w); + DECLARE_WRITE8_MEMBER(pio_port_b_w); + DECLARE_READ8_MEMBER(pio_port_b_r); + DECLARE_WRITE_LINE_MEMBER(pio_ardy); + DECLARE_WRITE_LINE_MEMBER(crtc_vs); + DECLARE_READ8_MEMBER(fdc_status_r); + DECLARE_WRITE8_MEMBER(fdc_motor_w); + DECLARE_DRIVER_INIT(mbeepc85); + DECLARE_DRIVER_INIT(mbee256); + DECLARE_DRIVER_INIT(mbee56); + DECLARE_DRIVER_INIT(mbeett); + DECLARE_DRIVER_INIT(mbeeppc); + DECLARE_DRIVER_INIT(mbee); + DECLARE_DRIVER_INIT(mbeepc); + DECLARE_DRIVER_INIT(mbeeic); + DECLARE_DRIVER_INIT(mbee128); + DECLARE_MACHINE_RESET(mbee); + DECLARE_VIDEO_START(mono); + DECLARE_VIDEO_START(standard); + DECLARE_VIDEO_START(premium); + DECLARE_PALETTE_INIT(standard); + DECLARE_PALETTE_INIT(premium); + DECLARE_MACHINE_RESET(mbee56); + DECLARE_MACHINE_RESET(mbee128); + DECLARE_MACHINE_RESET(mbee256); + DECLARE_MACHINE_RESET(mbeett); + UINT32 screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(timer_newkb); + DECLARE_QUICKLOAD_LOAD_MEMBER(mbee); + DECLARE_QUICKLOAD_LOAD_MEMBER(mbee_z80bin); + WRITE_LINE_MEMBER(rtc_irq_w); + WRITE_LINE_MEMBER(fdc_intrq_w); + WRITE_LINE_MEMBER(fdc_drq_w); + MC6845_UPDATE_ROW(crtc_update_row); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); + + required_device m_palette; +private: + UINT8 *m_p_videoram; + UINT8 *m_p_gfxram; + UINT8 *m_p_colorram; + UINT8 *m_p_attribram; + bool m_is_premium; + bool m_has_oldkb; + size_t m_size; + bool m_b7_rtc; + bool m_b7_vs; + bool m_b2; + UINT8 m_framecnt; + UINT8 m_08; + UINT8 m_0a; + UINT8 m_0b; + UINT8 m_1c; + UINT8 m_sy6545_cursor[16]; + UINT8 m_mbee256_was_pressed[15]; + UINT8 m_mbee256_q[20]; + UINT8 m_mbee256_q_pos; + UINT8 m_sy6545_reg[32]; + UINT8 m_sy6545_ind; + UINT8 m_fdc_rq; + UINT8 m_bank_array[33]; + void setup_banks(UINT8 data, bool first_time, UINT8 b_mask); + void sy6545_cursor_configure(); + void oldkb_scan(UINT16 param); + void oldkb_matrix_r(UINT16 offs); + void machine_reset_common(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + required_device m_maincpu; + required_device m_pio; + required_device m_cassette; + required_device m_wave; + required_device m_speaker; + required_device m_centronics; + required_device m_cent_data_out; + required_device m_crtc; + optional_device m_fdc; + optional_device m_floppy0; + optional_device m_floppy1; + optional_device m_rtc; + optional_memory_bank m_pak; + optional_memory_bank m_telcom; + optional_memory_bank m_basic; + optional_ioport m_io_x7; + optional_ioport_array<8> m_io_oldkb; + optional_ioport_array<15> m_io_newkb; + required_ioport m_io_config; + required_device m_screen; +}; + +#endif /* MBEE_H_ */ diff --git a/src/mame/includes/mboard.h b/src/mame/includes/mboard.h new file mode 100644 index 00000000000..b6e8c5028f4 --- /dev/null +++ b/src/mame/includes/mboard.h @@ -0,0 +1,122 @@ +// license:??? +// copyright-holders:Ralf Schaefer, Cowering +/********************************************************************** + + Mephisto Chess Computers + +**********************************************************************/ + +#ifndef __MBOARD_H__ +#define __MBOARD_H__ + +/*************************************************************************** + MACROS +***************************************************************************/ + +enum +{ + EM, /*No piece*/ + BP, + BN, + BB, + BR, + BQ, + BK, + WP, + WN, + WB, + WR, + WQ, + WK +}; + +#define NOT_VALID 99 +#define BORDER_PIECE 64 + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +class mboard_state : public driver_device +{ +public: + mboard_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_line(*this, "LINE"), + m_line10(*this, "LINE10"), + m_b_white(*this, "B_WHITE"), + m_b_black(*this, "B_BLACK"), + m_b_buttons(*this, "B_BUTTONS"), + m_mouse_x(*this, "MOUSE_X"), + m_mouse_y(*this, "MOUSE_Y"), + m_button_l(*this, "BUTTON_L"), + m_button_r(*this, "BUTTON_R") + { } + + DECLARE_READ8_MEMBER(mboard_read_board_8); + DECLARE_WRITE8_MEMBER(mboard_write_board_8); + DECLARE_WRITE8_MEMBER(mboard_write_LED_8); + + DECLARE_READ16_MEMBER(mboard_read_board_16); + DECLARE_WRITE16_MEMBER(mboard_write_board_16); + DECLARE_WRITE16_MEMBER(mboard_write_LED_16); + + DECLARE_READ32_MEMBER(mboard_read_board_32); + DECLARE_WRITE32_MEMBER(mboard_write_board_32); + DECLARE_WRITE32_MEMBER(mboard_write_LED_32); + + TIMER_DEVICE_CALLBACK_MEMBER( mboard_update_artwork); + + void mboard_savestate_register(); + + void mboard_set_board(); + void mboard_set_border_pieces(); + + inline UINT8 pos_to_num(UINT8 val); + + UINT8 mboard_lcd_invert; + UINT8 mboard_key_select; + UINT8 mboard_key_selector; + + int get_first_cleared_bit(UINT8 data); +private: + static const int start_board[64]; + static UINT8 border_pieces[12]; + + int m_board[64]; + int save_board[64]; + UINT16 Line18_LED; + UINT16 Line18_REED; + + int mouse_hold_border_piece; + UINT8 mouse_hold_from; + UINT8 mouse_hold_piece; + + int read_board_flag; + int get_first_bit(UINT8 data); + UINT8 read_board(); + void write_board(UINT8 data); + void write_LED(UINT8 data); + void board_presave(); + void board_postload(); + void clear_board(); + void set_artwork(); + void check_board_buttons(); +public: + required_device m_maincpu; + required_ioport_array<8> m_line; + required_ioport m_line10; + required_ioport m_b_white; + required_ioport m_b_black; + required_ioport m_b_buttons; + required_ioport m_mouse_x; + required_ioport m_mouse_y; + required_ioport m_button_l; + required_ioport m_button_r; +}; + + + +#endif /* __MBOARD_H__ */ diff --git a/src/mame/includes/mc1000.h b/src/mame/includes/mc1000.h new file mode 100644 index 00000000000..b39932b290e --- /dev/null +++ b/src/mame/includes/mc1000.h @@ -0,0 +1,120 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __MC1000__ +#define __MC1000__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "video/mc6845.h" +#include "video/mc6847.h" +#include "sound/ay8910.h" +#include "bus/centronics/ctronics.h" +#include "machine/rescap.h" +#include "machine/ram.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "u13" +#define AY8910_TAG "u21" +#define MC6845_TAG "mc6845" +#define MC6847_TAG "u19" +#define CENTRONICS_TAG "centronics" + +#define MC1000_MC6845_VIDEORAM_SIZE 0x800 +#define MC1000_MC6847_VIDEORAM_SIZE 0x1800 + +class mc1000_state : public driver_device +{ +public: + mc1000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_vdg(*this, MC6847_TAG), + m_crtc(*this, MC6845_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_rom(*this, Z80_TAG), + m_mc6845_video_ram(*this, "mc6845_vram"), + m_mc6847_video_ram(*this, "mc6847_vram"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_joya(*this, "JOYA"), + m_joyb(*this, "JOYB"), + m_modifiers(*this, "MODIFIERS"), + m_joyakeymap(*this, "JOYAKEYMAP"), + m_joybkeymap(*this, "JOYBKEYMAP") + { } + + required_device m_maincpu; + required_device m_vdg; + optional_device m_crtc; + required_device m_centronics; + required_device m_cassette; + required_device m_ram; + required_memory_region m_rom; + required_shared_ptr m_mc6845_video_ram; + required_shared_ptr m_mc6847_video_ram; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_joya; + required_ioport m_joyb; + required_ioport m_modifiers; + required_ioport m_joyakeymap; + required_ioport m_joybkeymap; + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( printer_r ); + DECLARE_WRITE8_MEMBER( printer_w ); + DECLARE_WRITE8_MEMBER( mc6845_ctrl_w ); + DECLARE_WRITE8_MEMBER( mc6847_attr_w ); + DECLARE_WRITE_LINE_MEMBER( fs_w ); + DECLARE_WRITE_LINE_MEMBER( hs_w ); + DECLARE_READ8_MEMBER( videoram_r ); + DECLARE_WRITE8_MEMBER( keylatch_w ); + DECLARE_READ8_MEMBER( keydata_r ); + DIRECT_UPDATE_MEMBER(mc1000_direct_update_handler); + + void bankswitch(); + + /* cpu state */ + int m_ne555_int; + + /* memory state */ + int m_rom0000; + int m_mc6845_bank; + int m_mc6847_bank; + + /* keyboard state */ + int m_keylatch; + + /* video state */ + int m_hsync; + int m_vsync; + UINT8 m_mc6847_attr; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + int m_centronics_busy; + + DECLARE_DRIVER_INIT(mc1000); + TIMER_DEVICE_CALLBACK_MEMBER(ne555_tick); +}; + +#endif diff --git a/src/mame/includes/mc1502.h b/src/mame/includes/mc1502.h new file mode 100644 index 00000000000..28b38aca85e --- /dev/null +++ b/src/mame/includes/mc1502.h @@ -0,0 +1,84 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/***************************************************************************** + * + * includes/mc1502.h + * + ****************************************************************************/ + +#ifndef MC1502_H_ +#define MC1502_H_ + +#include "imagedev/cassette.h" +#include "machine/i8251.h" +#include "machine/i8255.h" +#include "bus/isa/isa.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "bus/isa/xsu_cards.h" +#include "sound/speaker.h" +#include "bus/centronics/ctronics.h" + +class mc1502_state : public driver_device +{ +public: + mc1502_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_upd8251(*this, "upd8251"), + m_pic8259(*this, "pic8259"), + m_pit8253(*this, "pit8253"), + m_ppi8255n1(*this, "ppi8255n1"), + m_ppi8255n2(*this, "ppi8255n2"), + m_isabus(*this, "isa"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_centronics(*this, "centronics"), + m_ram(*this, RAM_TAG) { } + + required_device m_maincpu; + required_device m_upd8251; + required_device m_pic8259; + required_device m_pit8253; + required_device m_ppi8255n1; + required_device m_ppi8255n2; + required_device m_isabus; + required_device m_speaker; + required_device m_cassette; + required_device m_centronics; + required_device m_ram; + + DECLARE_DRIVER_INIT(mc1502); + DECLARE_MACHINE_START(mc1502); + DECLARE_MACHINE_RESET(mc1502); + + TIMER_CALLBACK_MEMBER(keyb_signal_callback); + + struct { + UINT8 pulsing; + UINT16 mask; /* input lines */ + emu_timer *keyb_signal_timer; + } m_kbd; + + UINT8 m_ppi_portb; + UINT8 m_ppi_portc; + UINT8 m_spkrdata; + + DECLARE_WRITE_LINE_MEMBER(mc1502_pit8253_out1_changed); + DECLARE_WRITE_LINE_MEMBER(mc1502_pit8253_out2_changed); + DECLARE_WRITE_LINE_MEMBER(mc1502_speaker_set_spkrdata); + DECLARE_WRITE_LINE_MEMBER(mc1502_i8251_syndet); + + DECLARE_WRITE8_MEMBER(mc1502_ppi_portb_w); + DECLARE_WRITE8_MEMBER(mc1502_ppi_portc_w); + DECLARE_READ8_MEMBER(mc1502_ppi_portc_r); + DECLARE_READ8_MEMBER(mc1502_kppi_porta_r); + DECLARE_WRITE8_MEMBER(mc1502_kppi_portb_w); + DECLARE_WRITE8_MEMBER(mc1502_kppi_portc_w); + +private: + int m_pit_out2; +}; + +#endif /* MC1502_H_ */ diff --git a/src/mame/includes/mc80.h b/src/mame/includes/mc80.h new file mode 100644 index 00000000000..74699a2327c --- /dev/null +++ b/src/mame/includes/mc80.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/mc80.h + * + ****************************************************************************/ + +#ifndef MC80_H_ +#define MC80_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" + +class mc80_state : public driver_device +{ +public: + mc80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_p_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu") { } + + DECLARE_WRITE8_MEMBER(mc8030_zve_write_protect_w); + DECLARE_WRITE8_MEMBER(mc8030_vis_w); + DECLARE_WRITE8_MEMBER(mc8030_eprom_prog_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_READ8_MEMBER(mc80_port_b_r); + DECLARE_READ8_MEMBER(mc80_port_a_r); + DECLARE_WRITE8_MEMBER(mc80_port_a_w); + DECLARE_WRITE8_MEMBER(mc80_port_b_w); + DECLARE_READ8_MEMBER(zve_port_a_r); + DECLARE_READ8_MEMBER(zve_port_b_r); + DECLARE_WRITE8_MEMBER(zve_port_a_w); + DECLARE_WRITE8_MEMBER(zve_port_b_w); + DECLARE_READ8_MEMBER(asp_port_a_r); + DECLARE_READ8_MEMBER(asp_port_b_r); + DECLARE_WRITE8_MEMBER(asp_port_a_w); + DECLARE_WRITE8_MEMBER(asp_port_b_w); + optional_shared_ptr m_p_videoram; + DECLARE_MACHINE_RESET(mc8020); + DECLARE_VIDEO_START(mc8020); + DECLARE_MACHINE_RESET(mc8030); + DECLARE_VIDEO_START(mc8030); + UINT32 screen_update_mc8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_mc8030(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(mc8020_kbd); + DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); + IRQ_CALLBACK_MEMBER(mc8020_irq_callback); + IRQ_CALLBACK_MEMBER(mc8030_irq_callback); + required_device m_maincpu; +}; + +#endif diff --git a/src/mame/includes/md_cons.h b/src/mame/includes/md_cons.h new file mode 100644 index 00000000000..b2904a4134a --- /dev/null +++ b/src/mame/includes/md_cons.h @@ -0,0 +1,49 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +#include "includes/megadriv.h" +#include "bus/megadrive/md_slot.h" +#include "bus/megadrive/md_carts.h" +#include "machine/mega32x.h" +#include "machine/megacd.h" + + +class md_cons_state : public md_base_state +{ +public: + md_cons_state(const machine_config &mconfig, device_type type, const char *tag) + : md_base_state(mconfig, type, tag), + m_32x(*this,"sega32x"), + m_segacd(*this,"segacd"), + m_cart(*this, "mdslot") + { } + + ioport_port *m_io_ctrlr; + ioport_port *m_io_pad3b[4]; + ioport_port *m_io_pad6b[2][4]; + + optional_device m_32x; + optional_device m_segacd; + optional_device m_cart; + + DECLARE_DRIVER_INIT(mess_md_common); + DECLARE_DRIVER_INIT(genesis); + DECLARE_DRIVER_INIT(md_eur); + DECLARE_DRIVER_INIT(md_jpn); + + READ8_MEMBER(mess_md_io_read_data_port); + WRITE16_MEMBER(mess_md_io_write_data_port); + + DECLARE_MACHINE_START( md_common ); // setup ioport_port + DECLARE_MACHINE_START( ms_megadriv ); // setup ioport_port + install cartslot handlers + DECLARE_MACHINE_START( ms_megacd ); // setup ioport_port + dma delay for cd + DECLARE_MACHINE_RESET( ms_megadriv ); + + void screen_eof_console(screen_device &screen, bool state); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( _32x_cart ); + + void _32x_scanline_callback(int x, UINT32 priority, UINT16 &lineptr); + void _32x_interrupt_callback(int scanline, int irq6); + void _32x_scanline_helper_callback(int scanline); +}; diff --git a/src/mame/includes/micronic.h b/src/mame/includes/micronic.h new file mode 100644 index 00000000000..f55fe9bb586 --- /dev/null +++ b/src/mame/includes/micronic.h @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/***************************************************************************** + + includes/micronic.h + +*****************************************************************************/ + +#ifndef __MICRONIC__ +#define __MICRONIC__ + +#include "cpu/z80/z80.h" +#include "video/hd61830.h" +#include "machine/mc146818.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "sound/beep.h" +#include "imagedev/cassette.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "z80" +#define MC146818_TAG "mc146818" +#define HD61830_TAG "hd61830" + +class micronic_state : public driver_device +{ +public: + micronic_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_lcdc(*this, HD61830_TAG), + m_beep(*this, "beeper"), + m_rtc(*this, MC146818_TAG), + m_nvram1(*this, "nvram1"), + m_nvram2(*this, "nvram2"), + m_ram(*this, RAM_TAG), + m_ram_base(*this, "ram_base"), + m_status_flag(1), + m_bank1(*this, "bank1"), + m_bit0(*this, "BIT0"), + m_bit1(*this, "BIT1"), + m_bit2(*this, "BIT2"), + m_bit3(*this, "BIT3"), + m_bit4(*this, "BIT4"), + m_bit5(*this, "BIT5"), + m_backbattery(*this, "BACKBATTERY"), + m_mainbattery(*this, "MAINBATTERY"), + m_cassette(*this, "cassette") + { } + + required_device m_maincpu; + required_device m_lcdc; + required_device m_beep; + required_device m_rtc; + required_device m_nvram1; + required_device m_nvram2; + required_device m_ram; + + virtual void machine_start(); + virtual void machine_reset(); + void nvram_init(nvram_device &nvram, void *data, size_t size); + + DECLARE_READ8_MEMBER( keypad_r ); + DECLARE_READ8_MEMBER( status_flag_r ); + DECLARE_WRITE8_MEMBER( status_flag_w ); + DECLARE_WRITE8_MEMBER( kp_matrix_w ); + DECLARE_WRITE8_MEMBER( beep_w ); + DECLARE_READ8_MEMBER( irq_flag_r ); + DECLARE_WRITE8_MEMBER( port_2c_w ); + DECLARE_WRITE8_MEMBER( bank_select_w ); + DECLARE_WRITE8_MEMBER( lcd_contrast_w ); + DECLARE_WRITE8_MEMBER( rtc_address_w ); + DECLARE_READ8_MEMBER( rtc_data_r ); + DECLARE_WRITE8_MEMBER( rtc_data_w ); + DECLARE_WRITE_LINE_MEMBER( mc146818_irq ); + + required_shared_ptr m_ram_base; + UINT8 m_banks_num; + UINT8 m_kp_matrix; + UINT8 m_lcd_contrast; + int m_lcd_backlight; + UINT8 m_status_flag; + DECLARE_PALETTE_INIT(micronic); + +protected: + required_memory_bank m_bank1; + required_ioport m_bit0; + required_ioport m_bit1; + required_ioport m_bit2; + required_ioport m_bit3; + required_ioport m_bit4; + required_ioport m_bit5; + required_ioport m_backbattery; + required_ioport m_mainbattery; + optional_device m_cassette; +}; + +#endif diff --git a/src/mame/includes/microtan.h b/src/mame/includes/microtan.h new file mode 100644 index 00000000000..29640649763 --- /dev/null +++ b/src/mame/includes/microtan.h @@ -0,0 +1,103 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/****************************************************************************** + * Microtan 65 + * + * variables and function prototypes + * + * Juergen Buchmueller , Jul 2000 + * + * Thanks go to Geoff Macdonald + * for his site http://www.geo255.redhotant.com + * and to Fabrice Frances + * for his site http://www.ifrance.com/oric/microtan.html + * + ******************************************************************************/ + +#ifndef MICROTAN_H_ +#define MICROTAN_H_ + +#include "imagedev/snapquik.h" +#include "machine/6522via.h" +#include "imagedev/cassette.h" + +class microtan_state : public driver_device +{ +public: + enum + { + TIMER_READ_CASSETTE, + TIMER_PULSE_NMI + }; + + microtan_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_via6522_0(*this, "via6522_0"), + m_via6522_1(*this, "via6522_1"), + m_gfxdecode(*this, "gfxdecode") + { } + + required_shared_ptr m_videoram; + UINT8 m_chunky_graphics; + UINT8 *m_chunky_buffer; + UINT8 m_keypad_column; + UINT8 m_keyboard_ascii; + emu_timer *m_timer; + int m_via_0_irq_line; + int m_via_1_irq_line; + int m_kbd_irq_line; + UINT8 m_keyrows[10]; + int m_lastrow; + int m_mask; + int m_key; + int m_repeat; + int m_repeater; + tilemap_t *m_bg_tilemap; + DECLARE_READ8_MEMBER(microtan_sound_r); + DECLARE_WRITE8_MEMBER(microtan_sound_w); + DECLARE_READ8_MEMBER(microtan_bffx_r); + DECLARE_WRITE8_MEMBER(microtan_bffx_w); + DECLARE_WRITE8_MEMBER(microtan_videoram_w); + DECLARE_DRIVER_INIT(microtan); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_microtan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(microtan_interrupt); + TIMER_CALLBACK_MEMBER(microtan_read_cassette); + TIMER_CALLBACK_MEMBER(microtan_pulse_nmi); + DECLARE_READ8_MEMBER(via_0_in_a); + DECLARE_WRITE8_MEMBER(via_0_out_a); + DECLARE_WRITE8_MEMBER(via_0_out_b); + DECLARE_WRITE_LINE_MEMBER(via_0_out_ca2); + DECLARE_WRITE_LINE_MEMBER(via_0_out_cb2); + DECLARE_WRITE8_MEMBER(via_1_out_a); + DECLARE_WRITE8_MEMBER(via_1_out_b); + DECLARE_WRITE_LINE_MEMBER(via_1_out_ca2); + DECLARE_WRITE_LINE_MEMBER(via_1_out_cb2); + DECLARE_WRITE_LINE_MEMBER(via_0_irq); + DECLARE_WRITE_LINE_MEMBER(via_1_irq); + required_device m_maincpu; + required_device m_cassette; + required_device m_via6522_0; + required_device m_via6522_1; + required_device m_gfxdecode; + UINT8 read_dsw(); + void microtan_set_irq_line(); + void store_key(int key); + int microtan_verify_snapshot(UINT8 *data, int size); + int parse_intel_hex(UINT8 *snapshot_buff, char *src); + int parse_zillion_hex(UINT8 *snapshot_buff, char *src); + void microtan_set_cpu_regs(const UINT8 *snapshot_buff, int base); + void microtan_snapshot_copy(UINT8 *snapshot_buff, int snapshot_size); + DECLARE_SNAPSHOT_LOAD_MEMBER( microtan ); + DECLARE_QUICKLOAD_LOAD_MEMBER( microtan ); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* MICROTAN_H_ */ diff --git a/src/mame/includes/mikro80.h b/src/mame/includes/mikro80.h new file mode 100644 index 00000000000..99ca55e3692 --- /dev/null +++ b/src/mame/includes/mikro80.h @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/mikro80.h + * + ****************************************************************************/ + +#ifndef MIKRO80_H_ +#define MIKRO80_H_ + +#include "machine/i8255.h" +#include "imagedev/cassette.h" + +class mikro80_state : public driver_device +{ +public: + enum + { + TIMER_RESET + }; + + mikro80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cursor_ram(*this, "cursor_ram"), + m_video_ram(*this, "video_ram"), + m_ppi8255(*this, "ppi8255"), + m_cassette(*this, "cassette"), + m_region_maincpu(*this, "maincpu"), + m_region_gfx1(*this, "gfx1"), + m_bank1(*this, "bank1"), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_line4(*this, "LINE4"), + m_io_line5(*this, "LINE5"), + m_io_line6(*this, "LINE6"), + m_io_line7(*this, "LINE7"), + m_io_line8(*this, "LINE8") , + m_maincpu(*this, "maincpu") { } + + required_shared_ptr m_cursor_ram; + required_shared_ptr m_video_ram; + int m_keyboard_mask; + int m_key_mask; + DECLARE_READ8_MEMBER(mikro80_8255_portb_r); + DECLARE_READ8_MEMBER(mikro80_8255_portc_r); + DECLARE_WRITE8_MEMBER(mikro80_8255_porta_w); + DECLARE_WRITE8_MEMBER(mikro80_8255_portc_w); + DECLARE_READ8_MEMBER(mikro80_keyboard_r); + DECLARE_WRITE8_MEMBER(mikro80_keyboard_w); + DECLARE_WRITE8_MEMBER(mikro80_tape_w); + DECLARE_READ8_MEMBER(mikro80_tape_r); + DECLARE_DRIVER_INIT(radio99); + DECLARE_DRIVER_INIT(mikro80); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_mikro80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + required_device m_ppi8255; + required_device m_cassette; + required_memory_region m_region_maincpu; + required_memory_region m_region_gfx1; + required_memory_bank m_bank1; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_ioport m_io_line3; + required_ioport m_io_line4; + required_ioport m_io_line5; + required_ioport m_io_line6; + required_ioport m_io_line7; + required_ioport m_io_line8; + required_device m_maincpu; +}; + +#endif /* UT88_H_ */ diff --git a/src/mame/includes/mikromik.h b/src/mame/includes/mikromik.h new file mode 100644 index 00000000000..3565d77e8de --- /dev/null +++ b/src/mame/includes/mikromik.h @@ -0,0 +1,138 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __MIKROMIKKO__ +#define __MIKROMIKKO__ + +#include "bus/rs232/rs232.h" +#include "cpu/i8085/i8085.h" +#include "formats/mm_dsk.h" +#include "machine/am9517a.h" +#include "machine/i8212.h" +#include "machine/mm1kb.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "machine/z80dart.h" +#include "machine/upd765.h" +#include "video/i8275.h" +#include "video/upd7220.h" + +#define SCREEN_TAG "screen" +#define I8085A_TAG "ic40" +#define I8212_TAG "ic12" +#define I8237_TAG "ic45" +#define I8253_TAG "ic6" +#define UPD765_TAG "ic15" +#define I8275_TAG "ic59" +#define UPD7201_TAG "ic11" +#define UPD7220_TAG "ic101" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" +#define RS232_C_TAG "rs232c" +#define KB_TAG "kb" + +class mm1_state : public driver_device +{ +public: + mm1_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, I8085A_TAG), + m_iop(*this, I8212_TAG), + m_dmac(*this, I8237_TAG), + m_pit(*this, I8253_TAG), + m_crtc(*this, I8275_TAG), + m_fdc(*this, UPD765_TAG), + m_mpsc(*this, UPD7201_TAG), + m_hgdc(*this, UPD7220_TAG), + m_palette(*this, "palette"), + m_floppy0(*this, UPD765_TAG ":0:525qd"), + m_floppy1(*this, UPD765_TAG ":1:525qd"), + m_rs232a(*this, RS232_A_TAG), + m_rs232b(*this, RS232_B_TAG), + m_rs232c(*this, RS232_C_TAG), + m_ram(*this, RAM_TAG), + m_rom(*this, I8085A_TAG), + m_mmu_rom(*this, "address"), + m_char_rom(*this, "chargen"), + m_video_ram(*this, "video_ram"), + m_a8(0), + m_recall(0), + m_dack3(1), + m_tc(CLEAR_LINE), + m_fdc_tc(0) + { } + + required_device m_maincpu; + required_device m_iop; + required_device m_dmac; + required_device m_pit; + required_device m_crtc; + required_device m_fdc; + required_device m_mpsc; + required_device m_hgdc; + required_device m_palette; + required_device m_floppy0; + required_device m_floppy1; + required_device m_rs232a; + required_device m_rs232b; + required_device m_rs232c; + required_device m_ram; + required_memory_region m_rom; + required_memory_region m_mmu_rom; + required_memory_region m_char_rom; + required_shared_ptr m_video_ram; + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_WRITE8_MEMBER( ls259_w ); + DECLARE_WRITE_LINE_MEMBER( dma_hrq_w ); + DECLARE_READ8_MEMBER( mpsc_dack_r ); + DECLARE_WRITE8_MEMBER( mpsc_dack_w ); + DECLARE_WRITE_LINE_MEMBER( dma_eop_w ); + DECLARE_WRITE_LINE_MEMBER( dack3_w ); + DECLARE_WRITE_LINE_MEMBER( itxc_w ); + DECLARE_WRITE_LINE_MEMBER( irxc_w ); + DECLARE_WRITE_LINE_MEMBER( auxc_w ); + DECLARE_WRITE_LINE_MEMBER( drq2_w ); + DECLARE_WRITE_LINE_MEMBER( drq1_w ); + DECLARE_READ_LINE_MEMBER( dsra_r ); + + void update_tc(); + void fdc_intrq_w(bool state); + void fdc_drq_w(bool state); + + int m_a8; + + // video state + int m_llen; + + // serial state + int m_intc; + int m_rx21; + int m_tx21; + int m_rcl; + + // floppy state + int m_recall; + int m_dack3; + int m_tc; + int m_fdc_tc; + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); + UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); +}; + + +//----------- defined in video/mikromik.c ----------- + +MACHINE_CONFIG_EXTERN( mm1m6_video ); + + +#endif diff --git a/src/mame/includes/mpf1.h b/src/mame/includes/mpf1.h new file mode 100644 index 00000000000..e4d6a19b628 --- /dev/null +++ b/src/mame/includes/mpf1.h @@ -0,0 +1,78 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Curt Coder +#pragma once + +#ifndef __MPF1__ +#define __MPF1__ + + +#include "emu.h" +#include "machine/spchrom.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "imagedev/cassette.h" +#include "machine/i8255.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "sound/speaker.h" +#include "sound/tms5220.h" + +#define Z80_TAG "u1" +#define Z80CTC_TAG "u11" +#define Z80PIO_TAG "u10" +#define I8255A_TAG "u14" +#define TMS5220_TAG "tms5220" + +class mpf1_state : public driver_device +{ +public: + mpf1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ctc(*this, Z80CTC_TAG), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_pc0(*this, "PC0"), + m_pc1(*this, "PC1"), + m_pc2(*this, "PC2"), + m_pc3(*this, "PC3"), + m_pc4(*this, "PC4"), + m_pc5(*this, "PC5"), + m_special(*this, "SPECIAL") + { } + + required_device m_maincpu; + required_device m_ctc; + required_device m_speaker; + required_device m_cassette; + required_ioport m_pc0; + required_ioport m_pc1; + required_ioport m_pc2; + required_ioport m_pc3; + required_ioport m_pc4; + required_ioport m_pc5; + required_ioport m_special; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( ppi_pa_r ); + DECLARE_WRITE8_MEMBER( ppi_pb_w ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_irq ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_res ); + DECLARE_DIRECT_UPDATE_MEMBER(mpf1_direct_update_handler); + + int m_break; + int m_m1; + + UINT8 m_lednum; + + emu_timer *m_led_refresh_timer; + DECLARE_DRIVER_INIT(mpf1); + TIMER_CALLBACK_MEMBER(led_refresh); + TIMER_DEVICE_CALLBACK_MEMBER(check_halt_callback); +}; + +#endif diff --git a/src/mame/includes/mpz80.h b/src/mame/includes/mpz80.h new file mode 100644 index 00000000000..8802273b5a3 --- /dev/null +++ b/src/mame/includes/mpz80.h @@ -0,0 +1,99 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __MPZ80__ +#define __MPZ80__ + +#include "emu.h" +#include "bus/s100/s100.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" + +#define Z80_TAG "17a" +#define AM9512_TAG "17d" + +class mpz80_state : public driver_device +{ +public: + mpz80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ram(*this, RAM_TAG), + m_s100(*this, S100_TAG), + m_rom(*this, Z80_TAG), + m_map_ram(*this, "map_ram"), + m_16c(*this, "16C"), + m_nmi(1), + m_pint(1), + m_int_pend(0), + m_pretrap(0), + m_trap(0), + m_trap_reset(0), + m_trap_void(1), + m_trap_halt(1), + m_trap_int(1), + m_trap_stop(1), + m_trap_aux(1) + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_s100; + required_memory_region m_rom; + optional_shared_ptr m_map_ram; + required_ioport m_16c; + + virtual void machine_start(); + virtual void machine_reset(); + + inline offs_t get_address(offs_t offset); + inline offs_t get_io_address(offs_t offset); + + inline void check_traps(); + inline void check_interrupt(); + + DECLARE_READ8_MEMBER( mmu_r ); + DECLARE_WRITE8_MEMBER( mmu_w ); + DECLARE_READ8_MEMBER( mmu_io_r ); + DECLARE_WRITE8_MEMBER( mmu_io_w ); + DECLARE_READ8_MEMBER( trap_addr_r ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_READ8_MEMBER( switch_r ); + DECLARE_READ8_MEMBER( status_r ); + DECLARE_WRITE8_MEMBER( disp_seg_w ); + DECLARE_WRITE8_MEMBER( disp_col_w ); + DECLARE_WRITE8_MEMBER( task_w ); + DECLARE_WRITE8_MEMBER( mask_w ); + DECLARE_WRITE8_MEMBER( terminal_w ); + DECLARE_WRITE_LINE_MEMBER( s100_pint_w ); + DECLARE_WRITE_LINE_MEMBER( s100_nmi_w ); + DECLARE_DIRECT_UPDATE_MEMBER(mpz80_direct_update_handler); + + // memory state + UINT32 m_addr; + UINT8 m_task; + UINT8 m_mask; + + // interrupt state + int m_nmi; + int m_pint; + int m_int_pend; + + // trap state + UINT8 m_pretrap_addr; + UINT8 m_trap_addr; + UINT8 m_status; + UINT16 m_trap_start; + int m_pretrap; + int m_trap; + int m_trap_reset; + int m_trap_void; + int m_trap_halt; + int m_trap_int; + int m_trap_stop; + int m_trap_aux; + DECLARE_DRIVER_INIT(mpz80); +}; + +#endif diff --git a/src/mame/includes/msbc1.h b/src/mame/includes/msbc1.h new file mode 100644 index 00000000000..870e0d65167 --- /dev/null +++ b/src/mame/includes/msbc1.h @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Curt Coder +#pragma once + +#ifndef __MSBC1__ +#define __MSBC1__ + +#define MC68000R12_TAG "u50" +#define MK68564_0_TAG "u14" +#define MK68564_1_TAG "u15" +#define MC68230L10_TAG "u16" + +class msbc1_state : public driver_device +{ +public: + msbc1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this,MC68000R12_TAG) + { + } + + virtual void machine_reset(); + +private: + required_device m_maincpu; +}; + +#endif diff --git a/src/mame/includes/msx.h b/src/mame/includes/msx.h new file mode 100644 index 00000000000..d849693ec14 --- /dev/null +++ b/src/mame/includes/msx.h @@ -0,0 +1,265 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/***************************************************************************** + * + * includes/msx.h + * + ****************************************************************************/ + +#ifndef __MSX_H__ +#define __MSX_H__ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/rp5c01.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "sound/ay8910.h" +#include "sound/dac.h" +#include "sound/wave.h" +#include "sound/2413intf.h" +#include "video/v9938.h" +#include "video/tms9928a.h" +#include "imagedev/flopdrv.h" +#include "imagedev/cassette.h" +#include "formats/fmsx_cas.h" +#include "formats/msx_dsk.h" +#include "hashfile.h" +#include "machine/wd_fdc.h" +#include "imagedev/floppy.h" +#include "bus/msx_slot/slot.h" +#include "bus/msx_slot/rom.h" +#include "bus/msx_slot/ram.h" +#include "bus/msx_slot/cartridge.h" +#include "bus/msx_slot/ram_mm.h" +#include "bus/msx_slot/disk.h" +#include "bus/msx_slot/music.h" +#include "bus/msx_slot/bunsetsu.h" +#include "bus/msx_slot/fs4600.h" +#include "bus/msx_slot/panasonic08.h" +#include "bus/msx_slot/sony08.h" + + +#define TC8521_TAG "rtc" + +#define MCFG_MSX_LAYOUT_ROM(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_ROM_ADD(_tag, _page, _numpages, _region, _offset) \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_RAM(_tag, _prim, _sec, _page, _numpages) \ + MCFG_MSX_SLOT_RAM_ADD(_tag, _page, _numpages) \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_CARTRIDGE(_tag, _prim, _sec) \ + MCFG_MSX_SLOT_CARTRIDGE_ADD(_tag, WRITELINE(msx_state, msx_irq_source1)) \ + msx_state::install_slot_pages(*owner, _prim, _sec, 0, 4, device); + +#define MCFG_MSX_LAYOUT_YAMAHA_EXPANSION(_tag, _prim, _sec, _default) \ + MCFG_MSX_SLOT_YAMAHA_EXPANSION_ADD(_tag, WRITELINE(msx_state, msx_irq_source2), _default) \ + msx_state::install_slot_pages(*owner, _prim, _sec, 0, 4, device); + +#define MCFG_MSX_LAYOUT_RAM_MM(_tag, _prim, _sec, _total_size) \ + MCFG_MSX_SLOT_RAM_MM_ADD(_tag, _total_size) \ + msx_state::install_slot_pages(*owner, _prim, _sec, 0, 4, device); + +#define MCFG_MSX_RAMIO_SET_BITS(_ramio_set_bits) \ + MCFG_MSX_SLOT_RAMM_SET_RAMIO_BITS(_ramio_set_bits) + +#define MCFG_MSX_LAYOUT_DISK1(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_DISK1_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages + 1, device); /* Memory mapped FDC registers are also accessible through page 2 */ + +#define MCFG_MSX_LAYOUT_DISK2(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_DISK2_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages + 1, device); /* Memory mapped FDC registers are also accessible through page 2 */ + +#define MCFG_MSX_LAYOUT_DISK3(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_DISK3_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_DISK4(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_DISK4_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_DISK5(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_DISK5_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1", "fdc:2", "fdc:3") \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_DISK6(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_DISK6_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_MUSIC(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_MUSIC_ADD(_tag, _page, _numpages, _region, _offset, "ym2413" ) \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_BUNSETSU(_tag, _prim, _sec, _page, _numpages, _region, _offset, _bunsetsu_tag) \ + MCFG_MSX_SLOT_BUNSETSU_ADD(_tag, _page, _numpages, _region, _offset, _bunsetsu_tag) \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_FS4600(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_FS4600_ADD(_tag, _page, _numpages, _region, _offset) \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_PANASONIC08(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_PANASONIC08_ADD(_tag, _page, _numpages, _region, _offset) \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + +#define MCFG_MSX_LAYOUT_SONY08(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ + MCFG_MSX_SLOT_SONY08_ADD(_tag, _page, _numpages, _region, _offset) \ + msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); + + +class msx_state : public driver_device +{ +public: + msx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_v9938(*this, "v9938") + , m_v9958(*this, "v9958") + , m_cassette(*this, "cassette") + , m_ay8910(*this, "ay8910") + , m_dac(*this, "dac") + , m_rtc(*this, TC8521_TAG) + , m_switched_device_as_config("switched_device", ENDIANNESS_LITTLE, 8, 16, 0, address_map_delegate(FUNC(msx_state::switched_device_map), this)) + , m_region_maincpu(*this, "maincpu") + , m_region_kanji(*this, "kanji") + , m_io_joy0(*this, "JOY0") + , m_io_joy1(*this, "JOY1") + , m_io_dsw(*this, "DSW") + , m_io_mouse0(*this, "MOUSE0") + , m_io_mouse1(*this, "MOUSE1") + , m_io_key0(*this, "KEY0") + , m_io_key1(*this, "KEY1") + , m_io_key2(*this, "KEY2") + , m_io_key3(*this, "KEY3") + , m_io_key4(*this, "KEY4") + , m_io_key5(*this, "KEY5") + , m_psg_b(0) + , m_rtc_latch(0) + , m_kanji_latch(0) + , m_primary_slot(0) + , m_port_c_old(0) + , m_keylatch(0) + , m_current_switched_device(0) + { + for (int prim = 0; prim < 4; prim++ ) + { + m_slot_expanded[prim] = false; + m_secondary_slot[prim] = 0; + for (int sec = 0; sec < 4; sec++ ) + { + for (int page = 0; page < 4; page++ ) + { + m_all_slots[prim][sec][page] = NULL; + } + } + } + m_mouse[0] = m_mouse[1] = 0; + m_mouse_stat[0] = m_mouse_stat[1] = 0; + for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + { + m_irq_state[i] = CLEAR_LINE; + } + } + + // static configuration helpers + static void install_slot_pages(device_t &owner, UINT8 prim, UINT8 sec, UINT8 page, UINT8 numpages, device_t *device); + + virtual void driver_start(); + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_ADDRESS_MAP(switched_device_map, 8); + DECLARE_WRITE8_MEMBER(msx_sec_slot_w); + DECLARE_READ8_MEMBER(msx_sec_slot_r); + DECLARE_READ8_MEMBER(msx_kanji_r); + DECLARE_WRITE8_MEMBER(msx_kanji_w); + DECLARE_WRITE8_MEMBER(msx_ppi_port_a_w); + DECLARE_WRITE8_MEMBER(msx_ppi_port_c_w); + DECLARE_READ8_MEMBER(msx_ppi_port_b_r); + DECLARE_READ8_MEMBER(msx_rtc_reg_r); + DECLARE_WRITE8_MEMBER(msx_rtc_reg_w); + DECLARE_WRITE8_MEMBER(msx_rtc_latch_w); + DECLARE_READ8_MEMBER(msx_mem_read); + DECLARE_WRITE8_MEMBER(msx_mem_write); + DECLARE_READ8_MEMBER(msx_switched_r); + DECLARE_WRITE8_MEMBER(msx_switched_w); + DECLARE_WRITE_LINE_MEMBER(turbo_w); + + void msx_memory_map_all(); + void msx_memory_map_page(UINT8 page); + void msx_memory_reset(); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + DECLARE_READ8_MEMBER(msx_psg_port_a_r); + DECLARE_READ8_MEMBER(msx_psg_port_b_r); + DECLARE_WRITE8_MEMBER(msx_psg_port_a_w); + DECLARE_WRITE8_MEMBER(msx_psg_port_b_w); + INTERRUPT_GEN_MEMBER(msx_interrupt); + DECLARE_WRITE8_MEMBER(msx_ay8910_w); + void msx_memory_init(); + void post_load(); + + DECLARE_WRITE_LINE_MEMBER(msx_irq_source0) { msx_irq_source(0, state); } // usually tms9918/v9938/v9958 + DECLARE_WRITE_LINE_MEMBER(msx_irq_source1) { msx_irq_source(1, state); } // usually first cartridge slot + DECLARE_WRITE_LINE_MEMBER(msx_irq_source2) { msx_irq_source(2, state); } // usually second cartridge slot + DECLARE_WRITE_LINE_MEMBER(msx_irq_source3) { msx_irq_source(3, state); } // sometimes expansion slot + +protected: + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == 0) ? &m_switched_device_as_config : NULL; } + +private: + required_device m_maincpu; + optional_device m_v9938; + optional_device m_v9958; + required_device m_cassette; + required_device m_ay8910; + required_device m_dac; + optional_device m_rtc; + address_space_config m_switched_device_as_config; + required_memory_region m_region_maincpu; + optional_memory_region m_region_kanji; + required_ioport m_io_joy0; + required_ioport m_io_joy1; + required_ioport m_io_dsw; + required_ioport m_io_mouse0; + required_ioport m_io_mouse1; + required_ioport m_io_key0; + required_ioport m_io_key1; + required_ioport m_io_key2; + required_ioport m_io_key3; + required_ioport m_io_key4; + required_ioport m_io_key5; + + /* PSG */ + int m_psg_b; + /* mouse */ + UINT16 m_mouse[2]; + int m_mouse_stat[2]; + /* rtc */ + int m_rtc_latch; + /* kanji */ + int m_kanji_latch; + /* memory */ + msx_internal_slot_interface m_empty_slot; + msx_internal_slot_interface *m_all_slots[4][4][4]; + msx_internal_slot_interface *m_current_page[4]; + bool m_slot_expanded[4]; + UINT8 m_primary_slot; + UINT8 m_secondary_slot[4]; + int m_port_c_old; + int m_keylatch; + UINT8 m_current_switched_device; + + int m_irq_state[4]; + + void msx_irq_source(int source, int level); + void check_irq(); +}; + + +#endif /* __MSX_H__ */ diff --git a/src/mame/includes/mtx.h b/src/mame/includes/mtx.h new file mode 100644 index 00000000000..5558e1fcd15 --- /dev/null +++ b/src/mame/includes/mtx.h @@ -0,0 +1,99 @@ +// license:BSD-3-Clause +// copyright-holders:Lee Ward, Dirk Best, Curt Coder +/************************************************************************* + + Memotech MTX 500, MTX 512 and RS 128 + +*************************************************************************/ + +#ifndef __MTX__ +#define __MTX__ + +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "machine/z80dart.h" +#include "machine/z80ctc.h" +#include "sound/sn76496.h" +#include "machine/ram.h" + +#define Z80_TAG "z80" +#define Z80CTC_TAG "z80ctc" +#define Z80DART_TAG "z80dart" +#define FD1793_TAG "fd1793" // SDX +#define FD1791_TAG "fd1791" // FDX +#define SN76489A_TAG "sn76489a" +#define MC6845_TAG "mc6845" +#define SCREEN_TAG "screen" +#define CENTRONICS_TAG "centronics" + +class mtx_state : public driver_device +{ +public: + mtx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_sn(*this, SN76489A_TAG), + m_z80ctc(*this, Z80CTC_TAG), + m_z80dart(*this, Z80DART_TAG), + m_cassette(*this, "cassette"), + m_centronics(*this, CENTRONICS_TAG), + m_ram(*this, RAM_TAG) + { } + + required_device m_maincpu; + required_device m_sn; + required_device m_z80ctc; + optional_device m_z80dart; + required_device m_cassette; + required_device m_centronics; + required_device m_ram; + + /* keyboard state */ + UINT8 m_key_sense; + + /* video state */ + UINT8 *m_video_ram; + UINT8 *m_attr_ram; + + /* sound state */ + UINT8 m_sound_latch; + + /* timers */ + device_t *m_cassette_timer; + + int m_centronics_busy; + int m_centronics_fault; + int m_centronics_perror; + int m_centronics_select; + + DECLARE_WRITE8_MEMBER(mtx_bankswitch_w); + DECLARE_WRITE8_MEMBER(mtx_sound_latch_w); + DECLARE_WRITE8_MEMBER(mtx_sense_w); + DECLARE_READ8_MEMBER(mtx_key_lo_r); + DECLARE_READ8_MEMBER(mtx_key_hi_r); + DECLARE_WRITE8_MEMBER(hrx_address_w); + DECLARE_READ8_MEMBER(hrx_data_r); + DECLARE_WRITE8_MEMBER(hrx_data_w); + DECLARE_READ8_MEMBER(hrx_attr_r); + DECLARE_WRITE8_MEMBER(hrx_attr_w); + DECLARE_MACHINE_START(mtx512); + DECLARE_MACHINE_RESET(mtx512); + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + TIMER_DEVICE_CALLBACK_MEMBER(cassette_tick); + DECLARE_WRITE_LINE_MEMBER(ctc_trg1_w); + DECLARE_WRITE_LINE_MEMBER(ctc_trg2_w); + DECLARE_WRITE_LINE_MEMBER(mtx_tms9929a_interrupt); + DECLARE_READ8_MEMBER(mtx_strobe_r); + DECLARE_READ8_MEMBER(mtx_sound_strobe_r); + DECLARE_WRITE8_MEMBER(mtx_cst_w); + DECLARE_READ8_MEMBER(mtx_prt_r); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + DECLARE_WRITE_LINE_MEMBER(write_centronics_select); + void bankswitch(UINT8 data); + DECLARE_SNAPSHOT_LOAD_MEMBER( mtx ); +}; + +#endif /* __MTX_H__ */ diff --git a/src/mame/includes/mz700.h b/src/mame/includes/mz700.h new file mode 100644 index 00000000000..6558180dbbd --- /dev/null +++ b/src/mame/includes/mz700.h @@ -0,0 +1,119 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Dirk Best +/****************************************************************************** + * Sharp MZ700 + * + * Reference: http://sharpmz.computingmuseum.com + * + ******************************************************************************/ + +#ifndef MZ700_H_ +#define MZ700_H_ + +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/z80pio.h" +#include "sound/speaker.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "machine/ram.h" + +class mz_state : public driver_device +{ +public: + mz_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_pit(*this, "pit8253"), + m_ppi(*this, "ppi8255"), + m_cassette(*this, "cassette"), + m_centronics(*this, "centronics"), + m_ram(*this, RAM_TAG), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + int m_mz700; /* 1 if running on an mz700 */ + + int m_cursor_timer; + int m_other_timer; + + int m_intmsk; /* PPI8255 pin PC2 */ + + int m_mz700_ram_lock; /* 1 if ram lock is active */ + int m_mz700_ram_vram; /* 1 if vram is banked in */ + + /* mz800 specific */ + UINT8 *m_cgram; + + int m_mz700_mode; /* 1 if in mz700 mode */ + int m_mz800_ram_lock; /* 1 if lock is active */ + int m_mz800_ram_monitor; /* 1 if monitor rom banked in */ + + int m_hires_mode; /* 1 if in 640x200 mode */ + int m_screennum; /* screen designation */ + + int m_centronics_busy; + int m_centronics_perror; + + UINT8 *m_colorram; + UINT8 *m_videoram; + UINT8 m_speaker_level; + UINT8 m_prev_state; + UINT16 m_mz800_ramaddr; + UINT8 m_mz800_palette[4]; + UINT8 m_mz800_palette_bank; + DECLARE_READ8_MEMBER(mz700_e008_r); + DECLARE_WRITE8_MEMBER(mz700_e008_w); + DECLARE_READ8_MEMBER(mz800_bank_0_r); + DECLARE_WRITE8_MEMBER(mz700_bank_0_w); + DECLARE_WRITE8_MEMBER(mz800_bank_0_w); + DECLARE_READ8_MEMBER(mz800_bank_1_r); + DECLARE_WRITE8_MEMBER(mz700_bank_1_w); + DECLARE_WRITE8_MEMBER(mz700_bank_2_w); + DECLARE_WRITE8_MEMBER(mz700_bank_3_w); + DECLARE_WRITE8_MEMBER(mz700_bank_4_w); + DECLARE_WRITE8_MEMBER(mz700_bank_5_w); + DECLARE_WRITE8_MEMBER(mz700_bank_6_w); + DECLARE_READ8_MEMBER(mz800_crtc_r); + DECLARE_WRITE8_MEMBER(mz800_write_format_w); + DECLARE_WRITE8_MEMBER(mz800_read_format_w); + DECLARE_WRITE8_MEMBER(mz800_display_mode_w); + DECLARE_WRITE8_MEMBER(mz800_scroll_border_w); + DECLARE_READ8_MEMBER(mz800_ramdisk_r); + DECLARE_WRITE8_MEMBER(mz800_ramdisk_w); + DECLARE_WRITE8_MEMBER(mz800_ramaddr_w); + DECLARE_WRITE8_MEMBER(mz800_palette_w); + DECLARE_WRITE8_MEMBER(mz800_cgram_w); + DECLARE_DRIVER_INIT(mz800); + DECLARE_DRIVER_INIT(mz700); + virtual void machine_start(); + DECLARE_PALETTE_INIT(mz); + DECLARE_VIDEO_START(mz800); + UINT32 screen_update_mz700(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_mz800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(ne556_cursor_callback); + TIMER_DEVICE_CALLBACK_MEMBER(ne556_other_callback); + DECLARE_WRITE_LINE_MEMBER(pit_out0_changed); + DECLARE_WRITE_LINE_MEMBER(pit_irq_2); + DECLARE_READ8_MEMBER(pio_port_b_r); + DECLARE_READ8_MEMBER(pio_port_c_r); + DECLARE_WRITE8_MEMBER(pio_port_a_w); + DECLARE_WRITE8_MEMBER(pio_port_c_w); + DECLARE_WRITE_LINE_MEMBER(mz800_z80pio_irq); + DECLARE_READ8_MEMBER(mz800_z80pio_port_a_r); + DECLARE_WRITE8_MEMBER(mz800_z80pio_port_a_w); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + required_device m_maincpu; + required_device m_speaker; + required_device m_pit; + required_device m_ppi; + required_device m_cassette; + optional_device m_centronics; + required_device m_ram; + required_device m_gfxdecode; + required_device m_palette; +}; + +#endif /* MZ700_H_ */ diff --git a/src/mame/includes/mz80.h b/src/mame/includes/mz80.h new file mode 100644 index 00000000000..ac973027482 --- /dev/null +++ b/src/mame/includes/mz80.h @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/mz80.h + * + ****************************************************************************/ + +#ifndef MZ80_H_ +#define MZ80_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" +#include "sound/wave.h" + +class mz80_state : public driver_device +{ +public: + mz80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pit(*this, "pit8253"), + m_ppi(*this, "ppi8255"), + m_cassette(*this, "cassette"), + m_speaker(*this, "speaker"), + m_p_ram(*this, "p_ram"), + m_p_videoram(*this, "p_videoram"){ } + + required_device m_maincpu; + required_device m_pit; + required_device m_ppi; + required_device m_cassette; + required_device m_speaker; + DECLARE_READ8_MEMBER(mz80k_strobe_r); + DECLARE_WRITE8_MEMBER(mz80k_strobe_w); + DECLARE_READ8_MEMBER(mz80k_8255_portb_r); + DECLARE_READ8_MEMBER(mz80k_8255_portc_r); + DECLARE_WRITE8_MEMBER(mz80k_8255_porta_w); + DECLARE_WRITE8_MEMBER(mz80k_8255_portc_w); + DECLARE_WRITE_LINE_MEMBER(pit_out0_changed); + DECLARE_WRITE_LINE_MEMBER(pit_out2_changed); + bool m_mz80k_vertical; + bool m_mz80k_tempo_strobe; + UINT8 m_speaker_level; + bool m_prev_state; + UINT8 m_mz80k_cursor_cnt; + UINT8 m_mz80k_keyboard_line; + required_shared_ptr m_p_ram; + const UINT8 *m_p_chargen; + required_shared_ptr m_p_videoram; + DECLARE_DRIVER_INIT(mz80k); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_mz80k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_mz80kj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_mz80a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(ne555_tempo_callback); +}; + + +/*----------- defined in video/mz80.c -----------*/ + +extern const gfx_layout mz80k_charlayout; +extern const gfx_layout mz80kj_charlayout; + +#endif /* MZ80_H_ */ diff --git a/src/mame/includes/nc.h b/src/mame/includes/nc.h new file mode 100644 index 00000000000..e640ee3927d --- /dev/null +++ b/src/mame/includes/nc.h @@ -0,0 +1,155 @@ +// license:GPL-2.0+ +// copyright-holders:Wilbert Pol, Kevin Thacker +/***************************************************************************** + * + * includes/nc.h + * + ****************************************************************************/ + +#ifndef NC_H_ +#define NC_H_ + +#include "bus/centronics/ctronics.h" +#include "machine/i8251.h" +#include "machine/clock.h" +#include "machine/ram.h" +#include "machine/nvram.h" +#include "sound/beep.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define NC_NUM_COLOURS 4 + +#define NC_SCREEN_WIDTH 480 +#define NC_SCREEN_HEIGHT 64 + +#define NC200_SCREEN_WIDTH 480 +#define NC200_SCREEN_HEIGHT 128 + +#define NC200_NUM_COLOURS 4 + +enum +{ + NC_TYPE_1xx, /* nc100/nc150 */ + NC_TYPE_200 /* nc200 */ +}; + + +class nc_state : public driver_device +{ +public: + nc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_beeper1(*this, "beep.1"), + m_beeper2(*this, "beep.2"), + m_centronics(*this, "centronics"), + m_card(*this, "cardslot"), + m_uart(*this, "uart"), + m_uart_clock(*this, "uart_clock"), + m_nvram(*this, "nvram") + { + } + + DECLARE_READ8_MEMBER(nc_memory_management_r); + DECLARE_WRITE8_MEMBER(nc_memory_management_w); + DECLARE_WRITE8_MEMBER(nc_irq_mask_w); + DECLARE_WRITE8_MEMBER(nc_irq_status_w); + DECLARE_READ8_MEMBER(nc_irq_status_r); + DECLARE_READ8_MEMBER(nc_key_data_in_r); + DECLARE_WRITE8_MEMBER(nc_sound_w); + DECLARE_WRITE8_MEMBER(nc_uart_control_w); + DECLARE_WRITE8_MEMBER(nc100_display_memory_start_w); + DECLARE_WRITE8_MEMBER(nc100_uart_control_w); + DECLARE_WRITE8_MEMBER(nc100_poweroff_control_w); + DECLARE_READ8_MEMBER(nc100_card_battery_status_r); + DECLARE_WRITE8_MEMBER(nc100_memory_card_wait_state_w); + DECLARE_WRITE8_MEMBER(nc200_display_memory_start_w); + DECLARE_READ8_MEMBER(nc200_card_battery_status_r); + DECLARE_READ8_MEMBER(nc200_printer_status_r); + DECLARE_WRITE8_MEMBER(nc200_uart_control_w); + DECLARE_WRITE8_MEMBER(nc200_memory_card_wait_state_w); + DECLARE_WRITE8_MEMBER(nc200_poweroff_control_w); + + DECLARE_PALETTE_INIT(nc); + DECLARE_MACHINE_START(nc200); + DECLARE_MACHINE_RESET(nc200); + UINT32 screen_update_nc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(nc_keyboard_timer_callback); + TIMER_CALLBACK_MEMBER(nc_serial_timer_callback); + TIMER_DEVICE_CALLBACK_MEMBER(dummy_timer_callback); + DECLARE_WRITE_LINE_MEMBER(nc100_tc8521_alarm_callback); + DECLARE_WRITE_LINE_MEMBER(nc100_txrdy_callback); + DECLARE_WRITE_LINE_MEMBER(nc100_rxrdy_callback); + DECLARE_WRITE_LINE_MEMBER(write_uart_clock); + DECLARE_WRITE_LINE_MEMBER(write_nc100_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_nc200_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(nc200_txrdy_callback); + DECLARE_WRITE_LINE_MEMBER(nc200_rxrdy_callback); + DECLARE_WRITE_LINE_MEMBER(nc200_fdc_interrupt); + + DECLARE_DRIVER_INIT( nc ); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( nc_pcmcia_card ); + DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( nc_pcmcia_card ); + +protected: + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + +private: + void nc200_video_set_backlight(int state); + int card_calculate_mask(int size); + void set_card_present_state(int state); + void nc_update_interrupts(); + void nc_refresh_memory_bank_config(int bank); + void nc_refresh_memory_config(); + void nc_common_init_machine(); + void nc_sound_update(int channel); + void nc150_init_machine(); + void nc200_refresh_uart_interrupt(); + void nc200_floppy_drive_index_callback(int drive_id); + +public: // HACK FOR MC6845 + required_device m_maincpu; + required_device m_ram; + required_device m_beeper1; + required_device m_beeper2; + required_device m_centronics; + required_device m_card; + required_device m_uart; + required_device m_uart_clock; + required_device m_nvram; + + char m_memory_config[4]; + emu_timer *m_keyboard_timer; + int m_membank_rom_mask; + int m_membank_internal_ram_mask; + UINT8 m_poweroff_control; + int m_card_status; + unsigned char m_uart_control; + int m_irq_mask; + int m_irq_status; + int m_irq_latch; + int m_irq_latch_mask; + int m_sound_channel_periods[2]; + int m_previous_inputport_10_state; + int m_previous_alarm_state; + UINT8 m_nc200_uart_interrupt_irq; + memory_region *m_card_ram; + int m_membank_card_ram_mask; + int m_card_size; + unsigned long m_display_memory_start; + UINT8 m_type; + int m_nc200_backlight; + + int m_centronics_ack; + int m_centronics_busy; +}; + + + +#endif /* NC_H_ */ diff --git a/src/mame/includes/nes.h b/src/mame/includes/nes.h new file mode 100644 index 00000000000..49d8b51df12 --- /dev/null +++ b/src/mame/includes/nes.h @@ -0,0 +1,120 @@ +// license:BSD-3-Clause +// copyright-holders:Brad Oliver,Fabio Priuli +/***************************************************************************** + + nes.h + + Nintendo Entertainment System / Famicom + + ****************************************************************************/ + +#ifndef NES_H_ +#define NES_H_ + + +#include "video/ppu2c0x.h" +#include "bus/nes/nes_slot.h" +#include "bus/nes/nes_carts.h" +#include "bus/nes_ctrl/ctrl.h" +#include "sound/nes_apu.h" + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define NTSC_CLOCK N2A03_DEFAULTCLOCK /* 1.789772 MHz */ +#define PAL_CLOCK (26601712.0/16) /* 1.662607 MHz */ + +#define NES_BATTERY_SIZE 0x2000 + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +/*PPU fast banking constants and structures */ + +#define CHRROM 0 +#define CHRRAM 1 + + +/*PPU nametable fast banking constants and structures */ + +#define CIRAM 0 +#define ROM 1 +#define EXRAM 2 +#define MMC5FILL 3 +#define CART_NTRAM 4 + +#define NES_BATTERY 0 +#define NES_WRAM 1 + + +class nes_state : public driver_device +{ +public: + nes_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ppu(*this, "ppu"), + m_sound(*this, "nessound"), + m_ctrl1(*this, "ctrl1"), + m_ctrl2(*this, "ctrl2"), + m_exp(*this, "exp"), + m_cartslot(*this, "nes_slot"), + m_disk(*this, "disk") + { } + + /* video-related */ + int m_last_frame_flip; + + /* misc */ + ioport_port *m_io_disksel; + + UINT8 *m_vram; + UINT8 *m_ciram; //PPU nametable RAM - external to PPU! + + required_device m_maincpu; + required_device m_ppu; + required_device m_sound; + required_device m_ctrl1; + required_device m_ctrl2; + optional_device m_exp; + optional_device m_cartslot; + optional_device m_disk; + + int nes_ppu_vidaccess(int address, int data); + void ppu_nmi(int *ppu_regs); + + DECLARE_READ8_MEMBER(nes_in0_r); + DECLARE_READ8_MEMBER(nes_in1_r); + DECLARE_WRITE8_MEMBER(nes_in0_w); + DECLARE_READ8_MEMBER(fc_in0_r); + DECLARE_READ8_MEMBER(fc_in1_r); + DECLARE_WRITE8_MEMBER(fc_in0_w); + DECLARE_WRITE8_MEMBER(nes_vh_sprite_dma_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + virtual void video_reset(); + DECLARE_PALETTE_INIT(nes); + UINT32 screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER(psg_4015_r); + DECLARE_WRITE8_MEMBER(psg_4015_w); + DECLARE_WRITE8_MEMBER(psg_4017_w); + NESCTRL_BRIGHTPIXEL_CB(bright_pixel); + + DECLARE_DRIVER_INIT(famicom); + + // these are needed until we modernize the FDS controller + DECLARE_MACHINE_START(fds); + DECLARE_MACHINE_START(famitwin); + DECLARE_MACHINE_RESET(fds); + DECLARE_MACHINE_RESET(famitwin); + void setup_disk(nes_disksys_device *slot); + +private: + memory_bank *m_prg_bank_mem[5]; +}; + +#endif /* NES_H_ */ diff --git a/src/mame/includes/newbrain.h b/src/mame/includes/newbrain.h new file mode 100644 index 00000000000..6819aef9729 --- /dev/null +++ b/src/mame/includes/newbrain.h @@ -0,0 +1,274 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __NEWBRAIN__ +#define __NEWBRAIN__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "cpu/cop400/cop400.h" +#include "imagedev/cassette.h" +#include "machine/6850acia.h" +#include "machine/adc0808.h" +#include "machine/z80ctc.h" +#include "machine/rescap.h" +#include "machine/ram.h" +#include "machine/upd765.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "409" +#define COP420_TAG "419" +#define MC6850_TAG "459" +#define ADC0809_TAG "427" +#define DAC0808_TAG "461" +#define Z80CTC_TAG "458" +#define FDC_Z80_TAG "416" +#define UPD765_TAG "418" + +#define NEWBRAIN_EIM_RAM_SIZE 0x10000 + +#define NEWBRAIN_ENRG1_CLK 0x01 +#define NEWBRAIN_ENRG1_TVP 0x04 +#define NEWBRAIN_ENRG1_CTS 0x10 +#define NEWBRAIN_ENRG1_DO 0x20 +#define NEWBRAIN_ENRG1_PO 0x80 +#define NEWBRAIN_ENRG1_UST_BIT_1_MASK 0x30 +#define NEWBRAIN_ENRG1_UST_BIT_0_MASK 0xc0 + +#define NEWBRAIN_ENRG2_USERP 0x01 +#define NEWBRAIN_ENRG2_ANP 0x02 +#define NEWBRAIN_ENRG2_MLTMD 0x04 +#define NEWBRAIN_ENRG2_MSPD 0x08 +#define NEWBRAIN_ENRG2_ENOR 0x10 +#define NEWBRAIN_ENRG2_ANSW 0x20 +#define NEWBRAIN_ENRG2_ENOT 0x40 +#define NEWBRAIN_ENRG2_CENTRONICS_OUT 0x80 + +#define NEWBRAIN_VIDEO_RV 0x01 +#define NEWBRAIN_VIDEO_FS 0x02 +#define NEWBRAIN_VIDEO_32_40 0x04 +#define NEWBRAIN_VIDEO_UCR 0x08 +#define NEWBRAIN_VIDEO_80L 0x40 + +class newbrain_state : public driver_device +{ +public: + newbrain_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_copcpu(*this, COP420_TAG), + m_palette(*this, "palette"), + m_cassette1(*this, "cassette"), + m_cassette2(*this, "cassette2"), + m_rom(*this, Z80_TAG), + m_eim_rom(*this, "eim"), + m_char_rom(*this, "chargen"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_y10(*this, "Y10"), + m_y11(*this, "Y11"), + m_y12(*this, "Y12"), + m_y13(*this, "Y13"), + m_y14(*this, "Y14"), + m_y15(*this, "Y15") + { + } + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE8_MEMBER( enrg1_w ); + DECLARE_WRITE8_MEMBER( a_enrg1_w ); + DECLARE_READ8_MEMBER( ust_r ); + DECLARE_READ8_MEMBER( a_ust_r ); + DECLARE_READ8_MEMBER( user_r ); + DECLARE_WRITE8_MEMBER( user_w ); + DECLARE_READ8_MEMBER( clclk_r ); + DECLARE_WRITE8_MEMBER( clclk_w ); + DECLARE_READ8_MEMBER( clusr_r ); + DECLARE_WRITE8_MEMBER( clusr_w ); + DECLARE_READ8_MEMBER( cop_l_r ); + DECLARE_WRITE8_MEMBER( cop_l_w ); + DECLARE_WRITE8_MEMBER( cop_g_w ); + DECLARE_READ8_MEMBER( cop_g_r ); + DECLARE_WRITE8_MEMBER( cop_d_w ); + DECLARE_READ8_MEMBER( cop_in_r ); + DECLARE_WRITE_LINE_MEMBER( cop_sk_w ); + DECLARE_READ_LINE_MEMBER( cop_si_r ); + DECLARE_WRITE_LINE_MEMBER( cop_so_w ); + DECLARE_READ8_MEMBER( tvl_r ); + DECLARE_WRITE8_MEMBER( tvl_w ); + DECLARE_WRITE8_MEMBER( tvctl_w ); + DECLARE_READ8_MEMBER( cop_r ); + DECLARE_WRITE8_MEMBER( cop_w ); + + INTERRUPT_GEN_MEMBER(newbrain_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(cop_regint_tick); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + + enum + { + TIMER_ID_RESET, + TIMER_ID_PWRUP + }; + + void check_interrupt(); + void bankswitch(); + void tvram_w(UINT8 data, int a6); + inline int get_reset_t(); + inline int get_pwrup_t(); + void screen_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); + + required_device m_maincpu; + required_device m_copcpu; + required_device m_palette; + required_device m_cassette1; + required_device m_cassette2; + required_memory_region m_rom; + optional_memory_region m_eim_rom; + required_memory_region m_char_rom; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_y10; + required_ioport m_y11; + required_ioport m_y12; + required_ioport m_y13; + required_ioport m_y14; + required_ioport m_y15; + + // processor state + int m_pwrup; // power up + int m_userint; // user interrupt + int m_userint0; // parallel port interrupt + int m_clkint; // clock interrupt + int m_aciaint; // ACIA interrupt + int m_copint; // COP interrupt + int m_anint; // A/DC interrupt + int m_bee; // identity + UINT8 m_enrg1; // enable register 1 + UINT8 m_enrg2; // enable register 2 + int m_acia_txd; // ACIA transmit + + // COP420 state + UINT8 m_cop_bus; // data bus + int m_cop_so; // serial out + int m_cop_tdo; // tape data output + int m_cop_tdi; // tape data input + int m_cop_rd; // memory read + int m_cop_wr; // memory write + int m_cop_access; // COP access + + // keyboard state + ioport_port* m_key_row[16]; + int m_keylatch; // keyboard row + int m_keydata; // keyboard column + + // video state + int m_segment_data[16]; // VF segment data + int m_tvcnsl; // TV console required + int m_tvctl; // TV control register + UINT16 m_tvram; // TV start address + + // user bus state + UINT8 m_user; + + // devices + UINT8 m_copdata; + int m_copstate; + int m_copbytes; + int m_copregint; +}; + +class newbrain_eim_state : public newbrain_state +{ +public: + newbrain_eim_state(const machine_config &mconfig, device_type type, const char *tag) + : newbrain_state(mconfig, type, tag), + m_fdccpu(*this, FDC_Z80_TAG), + m_ctc(*this, Z80CTC_TAG), + m_acia(*this, MC6850_TAG), + m_fdc(*this, UPD765_TAG), + m_floppy(*this, UPD765_TAG ":0:525dd"), + m_eim_ram(*this, "eim_ram") + { } + + required_device m_fdccpu; + required_device m_ctc; + required_device m_acia; + required_device m_fdc; + required_device m_floppy; + optional_shared_ptr m_eim_ram; + + virtual void machine_start(); + + DECLARE_WRITE8_MEMBER( fdc_auxiliary_w ); + DECLARE_READ8_MEMBER( fdc_control_r ); + DECLARE_READ8_MEMBER( ust2_r ); + DECLARE_WRITE8_MEMBER( enrg2_w ); + DECLARE_WRITE8_MEMBER( pr_w ); + DECLARE_READ8_MEMBER( user_r ); + DECLARE_WRITE8_MEMBER( user_w ); + DECLARE_READ8_MEMBER( anout_r ); + DECLARE_WRITE8_MEMBER( anout_w ); + DECLARE_READ8_MEMBER( anin_r ); + DECLARE_WRITE8_MEMBER( anio_w ); + DECLARE_READ8_MEMBER( st0_r ); + DECLARE_READ8_MEMBER( st1_r ); + DECLARE_READ8_MEMBER( st2_r ); + DECLARE_READ8_MEMBER( usbs_r ); + DECLARE_WRITE8_MEMBER( usbs_w ); + DECLARE_WRITE8_MEMBER( paging_w ); + DECLARE_WRITE_LINE_MEMBER( acia_tx ); + DECLARE_WRITE_LINE_MEMBER( acia_interrupt ); + DECLARE_WRITE_LINE_MEMBER( fdc_interrupt ); + DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); + DECLARE_WRITE_LINE_MEMBER( adc_eoc_w ); + + ADC0808_ANALOG_READ_CB(adc_vref_pos_r); + ADC0808_ANALOG_READ_CB(adc_vref_neg_r); + ADC0808_ANALOG_READ_CB(adc_input_r); + + TIMER_DEVICE_CALLBACK_MEMBER(ctc_c2_tick); + + void bankswitch(); + + // paging state + int m_paging; // paging enabled + int m_mpm; // multi paging mode ? + int m_a16; // address line 16 + UINT8 m_pr[16]; // expansion interface paging register + + // floppy state + int m_fdc_int; // interrupt + int m_fdc_att; // attention +}; + +// ---------- defined in video/newbrain.c ---------- + +MACHINE_CONFIG_EXTERN( newbrain_video ); + +#endif diff --git a/src/mame/includes/next.h b/src/mame/includes/next.h new file mode 100644 index 00000000000..25bc09cdaa5 --- /dev/null +++ b/src/mame/includes/next.h @@ -0,0 +1,190 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +#pragma once + +#ifndef __NEXT__ +#define __NEXT__ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/nscsi_bus.h" +#include "machine/mccs1850.h" +#include "machine/8530scc.h" +#include "machine/nextkbd.h" +#include "machine/upd765.h" +#include "machine/ncr5390.h" +#include "machine/mb8795.h" +#include "machine/nextmo.h" +#include "imagedev/chd_cd.h" +#include "imagedev/harddriv.h" + +class next_state : public driver_device +{ +public: + next_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + maincpu(*this, "maincpu"), + rtc(*this, "rtc"), + scc(*this, "scc"), + keyboard(*this, "keyboard"), + scsibus(*this, "scsibus"), + scsi(*this, "scsibus:7:ncr5390"), + net(*this, "net"), + mo(*this, "mo"), + fdc(*this, "fdc"), + vram(*this, "vram"), + m_maincpu(*this, "maincpu") { } + + required_device maincpu; + required_device rtc; + required_device scc; + required_device keyboard; + required_device scsibus; + required_device scsi; + required_device net; + required_device mo; + optional_device fdc; // 040 only + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void setup(UINT32 scr1, int size_x, int size_y, int skip, bool color); + + DECLARE_READ8_MEMBER( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + DECLARE_READ32_MEMBER( rom_map_r ); + DECLARE_READ32_MEMBER( scr2_r ); + DECLARE_WRITE32_MEMBER( scr2_w ); + DECLARE_READ32_MEMBER( scr1_r ); + DECLARE_READ32_MEMBER( irq_status_r ); + DECLARE_READ32_MEMBER( irq_mask_r ); + DECLARE_WRITE32_MEMBER( irq_mask_w ); + DECLARE_READ32_MEMBER( modisk_r ); + DECLARE_READ32_MEMBER( network_r ); + DECLARE_READ32_MEMBER( event_counter_r ); + DECLARE_READ32_MEMBER( dsp_r ); + DECLARE_READ32_MEMBER( fdc_control_r ); + DECLARE_WRITE32_MEMBER( fdc_control_w ); + DECLARE_READ32_MEMBER( dma_ctrl_r ); + DECLARE_WRITE32_MEMBER( dma_ctrl_w ); + DECLARE_WRITE32_MEMBER( dma_040_ctrl_w ); + DECLARE_READ32_MEMBER( dma_regs_r ); + DECLARE_WRITE32_MEMBER( dma_regs_w ); + DECLARE_READ32_MEMBER( scsictrl_r ); + DECLARE_WRITE32_MEMBER( scsictrl_w ); + DECLARE_READ32_MEMBER( phy_r ); + DECLARE_WRITE32_MEMBER( phy_w ); + DECLARE_READ32_MEMBER( timer_data_r ); + DECLARE_WRITE32_MEMBER( timer_data_w ); + DECLARE_READ32_MEMBER( timer_ctrl_r ); + DECLARE_WRITE32_MEMBER( timer_ctrl_w ); + DECLARE_WRITE8_MEMBER( ramdac_w ); + + UINT32 scr1; + UINT32 scr2; + UINT32 irq_status; + UINT32 irq_mask; + int irq_level; + required_shared_ptr vram; + UINT8 scsictrl, scsistat; + + UINT32 phy[2]; + + attotime timer_tbase; + UINT16 timer_vbase; + UINT32 timer_data, timer_next_data; + UINT32 timer_ctrl; + emu_timer *timer_tm; + + UINT32 eventc_latch; + + DECLARE_WRITE_LINE_MEMBER(scc_irq); + DECLARE_WRITE_LINE_MEMBER(keyboard_irq); + DECLARE_WRITE_LINE_MEMBER(power_irq); + DECLARE_WRITE_LINE_MEMBER(nmi_irq); + + DECLARE_WRITE_LINE_MEMBER(scsi_irq); + DECLARE_WRITE_LINE_MEMBER(scsi_drq); + + DECLARE_WRITE_LINE_MEMBER(fdc_irq); + DECLARE_WRITE_LINE_MEMBER(fdc_drq); + + DECLARE_WRITE_LINE_MEMBER(net_tx_irq); + DECLARE_WRITE_LINE_MEMBER(net_rx_irq); + DECLARE_WRITE_LINE_MEMBER(net_tx_drq); + DECLARE_WRITE_LINE_MEMBER(net_rx_drq); + + DECLARE_WRITE_LINE_MEMBER(mo_irq); + DECLARE_WRITE_LINE_MEMBER(mo_drq); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + void vblank_w(screen_device &screen, bool vblank_state); + +protected: + struct dma_slot { + UINT32 start, limit, chain_start, chain_limit, current; + UINT8 state; + bool supdate, restart, drq; + }; + + enum { + // write bits + DMA_SETENABLE = 0x01, + DMA_SETSUPDATE = 0x02, + DMA_SETREAD = 0x04, + DMA_CLRCOMPLETE = 0x08, + DMA_RESET = 0x10, + DMA_INITBUF = 0x20, + DMA_INITBUFTURBO = 0x40, + + // read bits + DMA_ENABLE = 0x01, + DMA_SUPDATE = 0x02, + DMA_READ = 0x04, + DMA_COMPLETE = 0x08, + DMA_BUSEXC = 0x10 + }; + + static const char *dma_targets[0x20]; + static const int dma_irqs[0x20]; + static const bool dma_has_saved[0x20]; + static const int scsi_clocks[4]; + + dma_slot dma_slots[0x20]; + UINT32 esp; + + int screen_sx, screen_sy, screen_skip; + bool screen_color; + bool vbl_enabled; + + virtual void machine_start(); + virtual void machine_reset(); + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + void timer_start(); + void timer_update(); + + void irq_set(int id, bool raise); + void irq_check(); + const char *dma_name(int slot); + void dma_do_ctrl_w(int slot, UINT8 data); + void dma_drq_w(int slot, bool state); + void dma_read(int slot, UINT8 &val, bool &eof, bool &err); + void dma_write(int slot, UINT8 val, bool eof, bool &err); + void dma_check_update(int slot); + void dma_check_end(int slot, bool eof); + void dma_done(int slot); + void dma_end(int slot); + +public: + DECLARE_DRIVER_INIT(nexts2); + DECLARE_DRIVER_INIT(next); + DECLARE_DRIVER_INIT(nextsc); + DECLARE_DRIVER_INIT(nextst); + DECLARE_DRIVER_INIT(nextct); + DECLARE_DRIVER_INIT(nextstc); + DECLARE_DRIVER_INIT(nextctc); + DECLARE_DRIVER_INIT(nexts); + required_device m_maincpu; +}; + +#endif diff --git a/src/mame/includes/ob68k1a.h b/src/mame/includes/ob68k1a.h new file mode 100644 index 00000000000..4f0560273fd --- /dev/null +++ b/src/mame/includes/ob68k1a.h @@ -0,0 +1,62 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __OB68K1A__ +#define __OB68K1A__ + +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "machine/6821pia.h" +#include "machine/6840ptm.h" +#include "machine/6850acia.h" +#include "machine/com8116.h" +#include "machine/ram.h" + +#define MC68000L10_TAG "u50" +#define MC6821_0_TAG "u32" +#define MC6821_1_TAG "u33" +#define MC6840_TAG "u35" +#define MC6850_0_TAG "u34" +#define MC6850_1_TAG "u26" +#define COM8116_TAG "u56" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" + +class ob68k1a_state : public driver_device +{ +public: + ob68k1a_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, MC68000L10_TAG), + m_dbrg(*this, COM8116_TAG), + m_acia0(*this, MC6850_0_TAG), + m_acia1(*this, MC6850_1_TAG), + m_pia0(*this, MC6821_0_TAG), + m_pia1(*this, MC6821_1_TAG), + m_rs232a(*this, RS232_A_TAG), + m_rs232b(*this, RS232_B_TAG), + m_ram(*this, RAM_TAG) + { } + + required_device m_maincpu; + required_device m_dbrg; + required_device m_acia0; + required_device m_acia1; + required_device m_pia0; + required_device m_pia1; + required_device m_rs232a; + required_device m_rs232b; + required_device m_ram; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( com8116_w ); + DECLARE_READ8_MEMBER( pia_r ); + DECLARE_WRITE8_MEMBER( pia_w ); + DECLARE_WRITE_LINE_MEMBER( rx_tx_0_w ); + DECLARE_WRITE_LINE_MEMBER( rx_tx_1_w ); +}; + +#endif diff --git a/src/mame/includes/ondra.h b/src/mame/includes/ondra.h new file mode 100644 index 00000000000..f0bae4768fa --- /dev/null +++ b/src/mame/includes/ondra.h @@ -0,0 +1,76 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/ondra.h + * + ****************************************************************************/ + +#ifndef ONDRA_H_ +#define ONDRA_H_ + +#include "imagedev/cassette.h" +#include "machine/ram.h" + +class ondra_state : public driver_device +{ +public: + ondra_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_region_maincpu(*this, "maincpu"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1"), + m_line2(*this, "LINE2"), + m_line3(*this, "LINE3"), + m_line4(*this, "LINE4"), + m_line5(*this, "LINE5"), + m_line6(*this, "LINE6"), + m_line7(*this, "LINE7"), + m_line8(*this, "LINE8"), + m_line9(*this, "LINE9"), + m_nmi(*this, "NMI") { } + + UINT8 m_video_enable; + UINT8 m_bank1_status; + UINT8 m_bank2_status; + DECLARE_READ8_MEMBER(ondra_keyboard_r); + DECLARE_WRITE8_MEMBER(ondra_port_03_w); + DECLARE_WRITE8_MEMBER(ondra_port_09_w); + DECLARE_WRITE8_MEMBER(ondra_port_0a_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_ondra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(ondra_interrupt); + TIMER_CALLBACK_MEMBER(nmi_check_callback); + +protected: + required_device m_maincpu; + required_device m_cassette; + required_device m_ram; + required_memory_region m_region_maincpu; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_ioport m_line0; + required_ioport m_line1; + required_ioport m_line2; + required_ioport m_line3; + required_ioport m_line4; + required_ioport m_line5; + required_ioport m_line6; + required_ioport m_line7; + required_ioport m_line8; + required_ioport m_line9; + required_ioport m_nmi; + + void ondra_update_banks(); +}; + +#endif diff --git a/src/mame/includes/orao.h b/src/mame/includes/orao.h new file mode 100644 index 00000000000..abd6a619529 --- /dev/null +++ b/src/mame/includes/orao.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/orao.h + * + ****************************************************************************/ + +#ifndef ORAO_H_ +#define ORAO_H_ +#include "sound/speaker.h" +#include "imagedev/cassette.h" + +class orao_state : public driver_device +{ +public: + orao_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_memory(*this, "memory"), + m_video_ram(*this, "video_ram"), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_line(*this, "LINE"), + m_beep(0) + { } + + DECLARE_READ8_MEMBER(orao_io_r); + DECLARE_WRITE8_MEMBER(orao_io_w); + DECLARE_DRIVER_INIT(orao); + DECLARE_DRIVER_INIT(orao103); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_orao(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + required_shared_ptr m_memory; + required_shared_ptr m_video_ram; + required_device m_maincpu; + required_device m_speaker; + required_device m_cassette; + required_ioport_array<20> m_line; + UINT8 m_beep; +}; + +#endif /* ORAO_H_ */ diff --git a/src/mame/includes/orion.h b/src/mame/includes/orion.h new file mode 100644 index 00000000000..5d6a57058be --- /dev/null +++ b/src/mame/includes/orion.h @@ -0,0 +1,125 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/orion.h + * + ****************************************************************************/ + +#ifndef ORION_H_ +#define ORION_H_ + +#include "machine/wd_fdc.h" +#include "includes/radio86.h" +#include "cpu/z80/z80.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "machine/ram.h" +#include "machine/mc146818.h" +#include "sound/speaker.h" +#include "sound/ay8910.h" +#include "sound/wave.h" + + +class orion_state : public radio86_state +{ +public: + orion_state(const machine_config &mconfig, device_type type, const char *tag) + : radio86_state(mconfig, type, tag) + , m_fdc(*this, "fd1793") + , m_ram(*this, RAM_TAG) + , m_fd0(*this, "fd0") + , m_fd1(*this, "fd1") + , m_fd2(*this, "fd2") + , m_fd3(*this, "fd3") + , m_rtc(*this, "rtc") + , m_speaker(*this, "speaker") + , m_ay8912(*this, "ay8912") + , m_bank2(*this, "bank2") + , m_bank3(*this, "bank3") + , m_bank4(*this, "bank4") + , m_bank5(*this, "bank5") + , m_bank6(*this, "bank6") + , m_bank7(*this, "bank7") + , m_bank8(*this, "bank8") + { } + + UINT8 m_orion128_video_mode; + UINT8 m_orion128_video_page; + UINT8 m_orion128_video_width; + UINT8 m_video_mode_mask; + UINT8 m_orionpro_pseudo_color; + UINT8 m_romdisk_lsb; + UINT8 m_romdisk_msb; + UINT8 m_orion128_memory_page; + UINT8 m_orionz80_memory_page; + UINT8 m_orionz80_dispatcher; + UINT8 m_speaker_data; + UINT8 m_orionpro_ram0_segment; + UINT8 m_orionpro_ram1_segment; + UINT8 m_orionpro_ram2_segment; + UINT8 m_orionpro_page; + UINT8 m_orionpro_128_page; + UINT8 m_orionpro_rom2_segment; + UINT8 m_orionpro_dispatcher; + + required_device m_fdc; + + DECLARE_READ8_MEMBER(orion128_system_r); + DECLARE_WRITE8_MEMBER(orion128_system_w); + DECLARE_READ8_MEMBER(orion128_romdisk_r); + DECLARE_WRITE8_MEMBER(orion128_romdisk_w); + DECLARE_WRITE8_MEMBER(orion128_video_mode_w); + DECLARE_WRITE8_MEMBER(orion128_video_page_w); + DECLARE_WRITE8_MEMBER(orion128_memory_page_w); + DECLARE_WRITE8_MEMBER(orion_disk_control_w); + DECLARE_READ8_MEMBER(orion128_floppy_r); + DECLARE_WRITE8_MEMBER(orion128_floppy_w); + DECLARE_READ8_MEMBER(orionz80_floppy_rtc_r); + DECLARE_WRITE8_MEMBER(orionz80_floppy_rtc_w); + DECLARE_WRITE8_MEMBER(orionz80_sound_w); + DECLARE_WRITE8_MEMBER(orionz80_sound_fe_w); + DECLARE_WRITE8_MEMBER(orionz80_memory_page_w); + DECLARE_WRITE8_MEMBER(orionz80_dispatcher_w); + DECLARE_READ8_MEMBER(orionz80_io_r); + DECLARE_WRITE8_MEMBER(orionz80_io_w); + DECLARE_WRITE8_MEMBER(orionpro_memory_page_w); + DECLARE_READ8_MEMBER(orionpro_io_r); + DECLARE_WRITE8_MEMBER(orionpro_io_w); + DECLARE_MACHINE_START(orion128); + DECLARE_MACHINE_RESET(orion128); + DECLARE_VIDEO_START(orion128); + DECLARE_PALETTE_INIT(orion128); + DECLARE_MACHINE_START(orionz80); + DECLARE_MACHINE_RESET(orionz80); + DECLARE_MACHINE_RESET(orionpro); + UINT32 screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(orionz80_interrupt); + DECLARE_READ8_MEMBER(orion_romdisk_porta_r); + DECLARE_WRITE8_MEMBER(orion_romdisk_portb_w); + DECLARE_WRITE8_MEMBER(orion_romdisk_portc_w); + DECLARE_FLOPPY_FORMATS( orion_floppy_formats ); + +protected: + required_device m_ram; + required_device m_fd0; + required_device m_fd1; + required_device m_fd2; + required_device m_fd3; + optional_device m_rtc; + optional_device m_speaker; + optional_device m_ay8912; + required_memory_bank m_bank2; + optional_memory_bank m_bank3; + optional_memory_bank m_bank4; + optional_memory_bank m_bank5; + optional_memory_bank m_bank6; + optional_memory_bank m_bank7; + optional_memory_bank m_bank8; + + void orionz80_switch_bank(); + void orion_set_video_mode(int width); + void orionpro_bank_switch(); +}; + +#endif /* ORION_H_ */ diff --git a/src/mame/includes/osborne1.h b/src/mame/includes/osborne1.h new file mode 100644 index 00000000000..52d39a09461 --- /dev/null +++ b/src/mame/includes/osborne1.h @@ -0,0 +1,147 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/***************************************************************************** + * + * includes/osborne1.h + * + ****************************************************************************/ + +#ifndef OSBORNE1_H_ +#define OSBORNE1_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "sound/beep.h" +#include "machine/6821pia.h" +#include "machine/6850acia.h" +#include "bus/ieee488/ieee488.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" + +class osborne1_state : public driver_device +{ +public: + enum + { + TIMER_VIDEO, + TIMER_SETUP + }; + + osborne1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pia0(*this, "pia_0"), + m_pia1(*this, "pia_1"), + m_fdc(*this, "mb8877"), + m_beep(*this, "beeper"), + m_ram(*this, RAM_TAG), + m_ieee(*this, IEEE488_TAG), + m_floppy0(*this, "mb8877:0:525ssdd"), + m_floppy1(*this, "mb8877:1:525ssdd"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_region_maincpu(*this, "maincpu") { } + + virtual void video_start(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + bitmap_ind16 m_bitmap; + + required_device m_maincpu; + required_device m_pia0; + required_device m_pia1; + required_device m_fdc; + required_device m_beep; + required_device m_ram; + required_device m_ieee; + required_device m_floppy0; + required_device m_floppy1; + + DECLARE_WRITE8_MEMBER(osborne1_0000_w); + DECLARE_WRITE8_MEMBER(osborne1_1000_w); + DECLARE_READ8_MEMBER(osborne1_2000_r); + DECLARE_WRITE8_MEMBER(osborne1_2000_w); + DECLARE_WRITE8_MEMBER(osborne1_3000_w); + DECLARE_WRITE8_MEMBER(osborne1_videoram_w); + DECLARE_WRITE8_MEMBER(osborne1_bankswitch_w); + DECLARE_WRITE_LINE_MEMBER(ieee_pia_irq_a_func); + DECLARE_READ8_MEMBER(ieee_pia_pb_r); + DECLARE_WRITE8_MEMBER(ieee_pia_pb_w); + DECLARE_WRITE_LINE_MEMBER(video_pia_out_cb2_dummy); + DECLARE_WRITE8_MEMBER(video_pia_port_a_w); + DECLARE_WRITE8_MEMBER(video_pia_port_b_w); + DECLARE_WRITE_LINE_MEMBER(video_pia_irq_a_func); + DECLARE_DIRECT_UPDATE_MEMBER(osborne1_opbase); + + bool m_bank2_enabled; + bool m_bank3_enabled; + UINT8 *m_bank4_ptr; + UINT8 *m_empty_4K; + /* IRQ states */ + bool m_pia_0_irq_state; + bool m_pia_1_irq_state; + /* video related */ + UINT8 m_new_start_x; + UINT8 m_new_start_y; + emu_timer *m_video_timer; + UINT8 *m_p_chargen; + /* bankswitch setting */ + UINT8 m_bankswitch; + bool m_in_irq_handler; + bool m_beep_state; + DECLARE_DRIVER_INIT(osborne1); + virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(osborne1_video_callback); + TIMER_CALLBACK_MEMBER(setup_osborne1); + +protected: + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + required_ioport m_row3; + required_ioport m_row4; + required_ioport m_row5; + required_ioport m_row6; + required_ioport m_row7; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_memory_region m_region_maincpu; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +// ======================> osborne1_daisy_device + +class osborne1_daisy_device : public device_t, + public device_z80daisy_interface +{ +public: + // construction/destruction + osborne1_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +private: + virtual void device_start(); + // z80daisy_interface overrides + virtual int z80daisy_irq_state(); + virtual int z80daisy_irq_ack(); + virtual void z80daisy_irq_reti(); +}; + +extern const device_type OSBORNE1_DAISY; + +#endif /* OSBORNE1_H_ */ diff --git a/src/mame/includes/osi.h b/src/mame/includes/osi.h new file mode 100644 index 00000000000..735b511fc37 --- /dev/null +++ b/src/mame/includes/osi.h @@ -0,0 +1,167 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Robbbert, Wilbert Pol +#pragma once + +#ifndef __OSI__ +#define __OSI__ + + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "formats/basicdsk.h" +#include "imagedev/cassette.h" +#include "imagedev/floppy.h" +#include "machine/6850acia.h" +#include "machine/6821pia.h" +#include "machine/ram.h" +#include "sound/discrete.h" +#include "sound/beep.h" + +#define SCREEN_TAG "screen" +#define M6502_TAG "m6502" +#define DISCRETE_TAG "discrete" + +#define X1 3932160 +#define UK101_X1 XTAL_8MHz + +#define OSI600_VIDEORAM_SIZE 0x400 +#define OSI630_COLORRAM_SIZE 0x400 + +class sb2m600_state : public driver_device +{ +public: + sb2m600_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6502_TAG), + m_acia_0(*this, "acia_0"), + m_cassette(*this, "cassette"), + m_discrete(*this, DISCRETE_TAG), + m_ram(*this, RAM_TAG), + m_video_ram(*this, "video_ram"), + m_color_ram(*this, "color_ram"), + m_io_row0(*this, "ROW0"), + m_io_row1(*this, "ROW1"), + m_io_row2(*this, "ROW2"), + m_io_row3(*this, "ROW3"), + m_io_row4(*this, "ROW4"), + m_io_row5(*this, "ROW5"), + m_io_row6(*this, "ROW6"), + m_io_row7(*this, "ROW7"), + m_io_sound(*this, "Sound"), + m_io_reset(*this, "Reset"), + m_beeper(*this, "beeper") + { + } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_WRITE8_MEMBER( keyboard_w ); + DECLARE_WRITE8_MEMBER( ctrl_w ); + DECLARE_WRITE_LINE_MEMBER( cassette_tx ); + DECLARE_WRITE_LINE_MEMBER( write_cassette_clock ); + + void floppy_index_callback(floppy_image_device *floppy, int state); + + DECLARE_PALETTE_INIT(osi630); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void machine_start(); + virtual void video_start(); + + enum + { + TIMER_SETUP_BEEP + }; + + required_device m_maincpu; + required_device m_acia_0; + required_device m_cassette; + optional_device m_discrete; + required_device m_ram; + required_shared_ptr m_video_ram; + optional_shared_ptr m_color_ram; + required_ioport m_io_row0; + required_ioport m_io_row1; + required_ioport m_io_row2; + required_ioport m_io_row3; + required_ioport m_io_row4; + required_ioport m_io_row5; + required_ioport m_io_row6; + required_ioport m_io_row7; + required_ioport m_io_sound; + required_ioport m_io_reset; + optional_device m_beeper; + + /* floppy state */ + int m_fdc_index; + + /* keyboard state */ + UINT8 m_keylatch; + + /* video state */ + int m_32; + int m_coloren; + UINT8 *m_p_chargen; +}; + +class c1p_state : public sb2m600_state +{ +public: + c1p_state(const machine_config &mconfig, device_type type, const char *tag) : + sb2m600_state(mconfig, type, tag), + m_beep(*this, "beeper") + { + } + + required_device m_beep; + + virtual void machine_start(); + + DECLARE_WRITE8_MEMBER( osi630_ctrl_w ); + DECLARE_WRITE8_MEMBER( osi630_sound_w ); + DECLARE_DRIVER_INIT(c1p); +}; + +class c1pmf_state : public c1p_state +{ +public: + c1pmf_state(const machine_config &mconfig, device_type type, const char *tag) : + c1p_state(mconfig, type, tag), + m_floppy0(*this, "floppy0"), + m_floppy1(*this, "floppy1") + { } + + DECLARE_READ8_MEMBER( osi470_pia_pa_r ); + DECLARE_WRITE8_MEMBER( osi470_pia_pa_w ); + DECLARE_WRITE8_MEMBER( osi470_pia_pb_w ); + DECLARE_WRITE_LINE_MEMBER( osi470_pia_cb2_w ); + +protected: + virtual void machine_start(); + +private: + required_device m_floppy0; + required_device m_floppy1; +}; + +class uk101_state : public sb2m600_state +{ +public: + uk101_state(const machine_config &mconfig, device_type type, const char *tag) : + sb2m600_state(mconfig, type, tag) + { + } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE8_MEMBER( keyboard_w ); +}; + +/* ---------- defined in video/osi.c ---------- */ + +MACHINE_CONFIG_EXTERN( osi600_video ); +MACHINE_CONFIG_EXTERN( uk101_video ); +MACHINE_CONFIG_EXTERN( osi630_video ); + +#endif diff --git a/src/mame/includes/p2000t.h b/src/mame/includes/p2000t.h new file mode 100644 index 00000000000..0548f661356 --- /dev/null +++ b/src/mame/includes/p2000t.h @@ -0,0 +1,57 @@ +// license:??? +// copyright-holders:Paul Daniels +/***************************************************************************** + * + * includes/p2000t.h + * + ****************************************************************************/ + +#ifndef P2000T_H_ +#define P2000T_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "video/saa5050.h" + + +class p2000t_state : public driver_device +{ +public: + p2000t_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_videoram(*this, "videoram"), + m_keyboard(*this, "KEY") { } + + required_device m_maincpu; + required_device m_speaker; + optional_device m_gfxdecode; + optional_device m_palette; + required_shared_ptr m_videoram; + required_ioport_array<10> m_keyboard; + DECLARE_READ8_MEMBER(p2000t_port_000f_r); + DECLARE_READ8_MEMBER(p2000t_port_202f_r); + DECLARE_WRITE8_MEMBER(p2000t_port_101f_w); + DECLARE_WRITE8_MEMBER(p2000t_port_303f_w); + DECLARE_WRITE8_MEMBER(p2000t_port_505f_w); + DECLARE_WRITE8_MEMBER(p2000t_port_707f_w); + DECLARE_WRITE8_MEMBER(p2000t_port_888b_w); + DECLARE_WRITE8_MEMBER(p2000t_port_8c90_w); + DECLARE_WRITE8_MEMBER(p2000t_port_9494_w); + DECLARE_READ8_MEMBER(videoram_r); + UINT8 m_port_101f; + UINT8 m_port_202f; + UINT8 m_port_303f; + UINT8 m_port_707f; + INT8 m_frame_count; + DECLARE_VIDEO_START(p2000m); + DECLARE_PALETTE_INIT(p2000m); + UINT32 screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(p2000_interrupt); +}; + +#endif /* P2000T_H_ */ diff --git a/src/mame/includes/partner.h b/src/mame/includes/partner.h new file mode 100644 index 00000000000..f5eba1168f8 --- /dev/null +++ b/src/mame/includes/partner.h @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/partner.h + * + ****************************************************************************/ + +#ifndef partner_H_ +#define partner_H_ + +#include "machine/i8255.h" +#include "machine/wd_fdc.h" +#include "machine/ram.h" + +class partner_state : public radio86_state +{ +public: + partner_state(const machine_config &mconfig, device_type type, const char *tag) + : radio86_state(mconfig, type, tag), + m_ram(*this, RAM_TAG), + m_fdc(*this, "wd1793") { } + + UINT8 m_mem_page; + UINT8 m_win_mem_page; + DECLARE_READ8_MEMBER(partner_floppy_r); + DECLARE_WRITE8_MEMBER(partner_floppy_w); + DECLARE_WRITE8_MEMBER(partner_win_memory_page_w); + DECLARE_WRITE8_MEMBER(partner_mem_page_w); + DECLARE_DRIVER_INIT(partner); + DECLARE_MACHINE_START(partner); + DECLARE_MACHINE_RESET(partner); + I8275_DRAW_CHARACTER_MEMBER(display_pixels); + + void partner_window_1(UINT8 bank_num, UINT16 offset,UINT8 *rom); + void partner_window_2(UINT8 bank_num, UINT16 offset,UINT8 *rom); + void partner_iomap_bank(UINT8 *rom); + void partner_bank_switch(); + required_device m_ram; + required_device m_fdc; + DECLARE_FLOPPY_FORMATS( floppy_formats ); +}; + + +#endif /* partner_H_ */ diff --git a/src/mame/includes/pasopia.h b/src/mame/includes/pasopia.h new file mode 100644 index 00000000000..80902e20682 --- /dev/null +++ b/src/mame/includes/pasopia.h @@ -0,0 +1,137 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +#define PASOPIA_KEYBOARD \ + PORT_START("KEY0") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) \ + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) \ + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KANA LOCK") \ + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) \ + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ + PORT_START("KEY1") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) \ + PORT_START("KEY2") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Home") \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) \ + PORT_START("KEY3") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("RIGHT") \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Status?") \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("BACKSPACE") PORT_CHAR(8) \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) \ + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) \ + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) \ + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) \ + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ + PORT_START("KEY4") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("StatusLine") \ + PORT_DIPNAME( 0x02, 0x00, "4" ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) \ + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) \ + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) \ + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("LEFT") \ + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) \ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("SPACE") PORT_CHAR(' ') \ + PORT_START("KEY5") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("F6") \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("F7") \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("F8") \ + PORT_START("KEY6") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHAR('1') PORT_CHAR('1') \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHAR('0') PORT_CHAR('0') \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHAR('4') PORT_CHAR('O') \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('r') PORT_CHAR('O') \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('y') PORT_CHAR('O') \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("_") PORT_CHAR('_') \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("^") \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Yen") \ + PORT_START("KEY7") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHAR('2') PORT_CHAR('"') \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHAR('3') PORT_CHAR('#') \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHAR('8') PORT_CHAR('(') \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('T') PORT_CHAR('t') \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('U') PORT_CHAR('u') \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHAR('7') PORT_CHAR('\'') \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_NAME("@") PORT_CHAR('@') \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("[ {") PORT_CHAR('[') PORT_CHAR('{') \ + PORT_START("KEY8") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHAR('-') PORT_CHAR('=') \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHAR('5') PORT_CHAR('%') \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHAR('6') PORT_CHAR('&') \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('F') PORT_CHAR('f') \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('H') PORT_CHAR('h') \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHAR('9') PORT_CHAR(')') \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_NAME(": *") PORT_CHAR(':') PORT_CHAR('*') \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("] }") PORT_CHAR(']') PORT_CHAR('}') \ + PORT_START("KEY9") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('Q') PORT_CHAR('q') \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('W') PORT_CHAR('w') \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('E') PORT_CHAR('e') \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('G') PORT_CHAR('g') \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('J') PORT_CHAR('j') \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('I') PORT_CHAR('i') \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('O') PORT_CHAR('o') \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('P') PORT_CHAR('p') \ + PORT_START("KEYA") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('A') PORT_CHAR('a') \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('S') PORT_CHAR('s') \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('D') PORT_CHAR('d') \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('V') PORT_CHAR('v') \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('N') PORT_CHAR('n') \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('K') PORT_CHAR('k') \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('L') PORT_CHAR('l') \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME("; +") PORT_CHAR(';') PORT_CHAR('+') \ + PORT_START("KEYB") \ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('Z') PORT_CHAR('z') \ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('X') PORT_CHAR('x') \ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('C') PORT_CHAR('c') \ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('B') PORT_CHAR('b') \ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('M') PORT_CHAR('m') \ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(", <") PORT_CHAR(',') PORT_CHAR('<') \ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(". >") PORT_CHAR('.') PORT_CHAR('>') \ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/ ?") PORT_CHAR('/') PORT_CHAR('?') diff --git a/src/mame/includes/pc1251.h b/src/mame/includes/pc1251.h new file mode 100644 index 00000000000..d03a4524bf5 --- /dev/null +++ b/src/mame/includes/pc1251.h @@ -0,0 +1,62 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/pc1251.h + * + * Pocket Computer 1251 + * + ****************************************************************************/ + +#ifndef PC1251_H_ +#define PC1251_H_ + +#include "pocketc.h" +#include "cpu/sc61860/sc61860.h" +#include "machine/nvram.h" + +#define PC1251_CONTRAST (ioport("DSW0")->read() & 0x07) + + +class pc1251_state : public pocketc_state +{ +public: + enum + { + TIMER_POWER_UP + }; + + pc1251_state(const machine_config &mconfig, device_type type, const char *tag) + : pocketc_state(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + UINT8 m_outa; + UINT8 m_outb; + int m_power; + UINT8 m_reg[0x100]; + + DECLARE_DRIVER_INIT(pc1251); + UINT32 screen_update_pc1251(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE8_MEMBER(pc1251_outa); + DECLARE_WRITE8_MEMBER(pc1251_outb); + DECLARE_WRITE8_MEMBER(pc1251_outc); + + DECLARE_READ_LINE_MEMBER(pc1251_reset); + DECLARE_READ_LINE_MEMBER(pc1251_brk); + DECLARE_READ8_MEMBER(pc1251_ina); + DECLARE_READ8_MEMBER(pc1251_inb); + DECLARE_READ8_MEMBER(pc1251_lcd_read); + DECLARE_WRITE8_MEMBER(pc1251_lcd_write); + virtual void machine_start(); + DECLARE_MACHINE_START(pc1260); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* PC1251_H_ */ diff --git a/src/mame/includes/pc1350.h b/src/mame/includes/pc1350.h new file mode 100644 index 00000000000..b50758c5917 --- /dev/null +++ b/src/mame/includes/pc1350.h @@ -0,0 +1,60 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/pc1350.h + * + * Pocket Computer 1350 + * + ****************************************************************************/ + +#ifndef PC1350_H_ +#define PC1350_H_ + +#include "pocketc.h" +#include "cpu/sc61860/sc61860.h" +#include "machine/nvram.h" +#include "machine/ram.h" + +#define PC1350_CONTRAST (ioport("DSW0")->read() & 0x07) + + +class pc1350_state : public pocketc_state +{ +public: + enum + { + TIMER_POWER_UP + }; + + pc1350_state(const machine_config &mconfig, device_type type, const char *tag) + : pocketc_state(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG) { } + + UINT8 m_outa; + UINT8 m_outb; + int m_power; + UINT8 m_reg[0x1000]; + UINT32 screen_update_pc1350(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE8_MEMBER(pc1350_outa); + DECLARE_WRITE8_MEMBER(pc1350_outb); + DECLARE_WRITE8_MEMBER(pc1350_outc); + + DECLARE_READ_LINE_MEMBER(pc1350_brk); + DECLARE_READ8_MEMBER(pc1350_ina); + DECLARE_READ8_MEMBER(pc1350_inb); + DECLARE_READ8_MEMBER(pc1350_lcd_read); + DECLARE_WRITE8_MEMBER(pc1350_lcd_write); + DECLARE_READ8_MEMBER(pc1350_keyboard_line_r); + + virtual void machine_start(); + required_device m_maincpu; + required_device m_ram; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* PC1350_H_ */ diff --git a/src/mame/includes/pc1401.h b/src/mame/includes/pc1401.h new file mode 100644 index 00000000000..00797e2fe17 --- /dev/null +++ b/src/mame/includes/pc1401.h @@ -0,0 +1,60 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/pc1401.h + * + * Pocket Computer 1401 + * + ****************************************************************************/ + +#ifndef PC1401_H_ +#define PC1401_H_ + +#include "pocketc.h" +#include "cpu/sc61860/sc61860.h" +#include "machine/nvram.h" + +#define CONTRAST (ioport("DSW0")->read() & 0x07) + + +class pc1401_state : public pocketc_state +{ +public: + enum + { + TIMER_POWER_UP + }; + + pc1401_state(const machine_config &mconfig, device_type type, const char *tag) + : pocketc_state(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + UINT8 m_portc; + UINT8 m_outa; + UINT8 m_outb; + int m_power; + UINT8 m_reg[0x100]; + DECLARE_DRIVER_INIT(pc1401); + UINT32 screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ_LINE_MEMBER(pc1401_reset); + DECLARE_READ_LINE_MEMBER(pc1401_brk); + DECLARE_WRITE8_MEMBER(pc1401_outa); + DECLARE_WRITE8_MEMBER(pc1401_outb); + DECLARE_WRITE8_MEMBER(pc1401_outc); + DECLARE_READ8_MEMBER(pc1401_ina); + DECLARE_READ8_MEMBER(pc1401_inb); + DECLARE_READ8_MEMBER(pc1401_lcd_read); + DECLARE_WRITE8_MEMBER(pc1401_lcd_write); + + virtual void machine_start(); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* PC1401_H_ */ diff --git a/src/mame/includes/pc1403.h b/src/mame/includes/pc1403.h new file mode 100644 index 00000000000..d40b2bb2bce --- /dev/null +++ b/src/mame/includes/pc1403.h @@ -0,0 +1,65 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/pc1403.h + * + * Pocket Computer 1403 + * + ****************************************************************************/ + +#ifndef PC1403_H_ +#define PC1403_H_ + +#include "pocketc.h" +#include "cpu/sc61860/sc61860.h" +#include "machine/nvram.h" + +#define CONTRAST (ioport("DSW0")->read() & 0x07) + + +class pc1403_state : public pocketc_state +{ +public: + enum + { + TIMER_POWER_UP + }; + + pc1403_state(const machine_config &mconfig, device_type type, const char *tag) + : pocketc_state(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + UINT8 m_portc; + UINT8 m_outa; + int m_power; + UINT8 m_asic[4]; + int m_DOWN; + int m_RIGHT; + UINT8 m_reg[0x100]; + + DECLARE_DRIVER_INIT(pc1403); + UINT32 screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ_LINE_MEMBER(pc1403_reset); + DECLARE_READ_LINE_MEMBER(pc1403_brk); + DECLARE_WRITE8_MEMBER(pc1403_outa); + DECLARE_WRITE8_MEMBER(pc1403_outc); + DECLARE_READ8_MEMBER(pc1403_ina); + + DECLARE_READ8_MEMBER(pc1403_asic_read); + DECLARE_WRITE8_MEMBER(pc1403_asic_write); + DECLARE_READ8_MEMBER(pc1403_lcd_read); + DECLARE_WRITE8_MEMBER(pc1403_lcd_write); + virtual void video_start(); + virtual void machine_start(); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* PC1403_H_ */ diff --git a/src/mame/includes/pc1512.h b/src/mame/includes/pc1512.h new file mode 100644 index 00000000000..218a3d5599e --- /dev/null +++ b/src/mame/includes/pc1512.h @@ -0,0 +1,258 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __PC1512__ +#define __PC1512__ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "cpu/mcs48/mcs48.h" +#include "formats/pc_dsk.h" +#include "machine/am9517a.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "machine/ins8250.h" +#include "bus/isa/isa.h" +#include "bus/isa/isa_cards.h" +#include "machine/mc146818.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/pc1512kb.h" +#include "machine/pc_fdc.h" +#include "machine/ram.h" +#include "sound/speaker.h" +#include "video/mc6845.h" +#include "bus/isa/pc1640_iga.h" + +#define I8086_TAG "ic120" +#define I8087_TAG "ic119" +#define I8048_TAG "i8048" +#define I8237A5_TAG "ic130" +#define I8259A2_TAG "ic109" +#define I8253_TAG "ic114" +#define MC146818_TAG "ic134" +#define PC_FDC_XT_TAG "ic112" +#define INS8250_TAG "ic106" +#define AMS40041_TAG "ic126" +#define CENTRONICS_TAG "centronics" +#define SPEAKER_TAG "speaker" +#define ISA_BUS_TAG "isa" +#define RS232_TAG "rs232" +#define SCREEN_TAG "screen" + +class pc1512_state : public driver_device +{ +public: + pc1512_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, I8086_TAG), + m_dmac(*this, I8237A5_TAG), + m_pic(*this, I8259A2_TAG), + m_pit(*this, I8253_TAG), + m_rtc(*this, MC146818_TAG), + m_fdc(*this, PC_FDC_XT_TAG), + m_uart(*this, INS8250_TAG), + m_vdu(*this, AMS40041_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_cent_data_out(*this, "cent_data_out"), + m_speaker(*this, SPEAKER_TAG), + m_kb(*this, PC1512_KEYBOARD_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, PC_FDC_XT_TAG ":0:525dd" ), + m_floppy1(*this, PC_FDC_XT_TAG ":1:525dd" ), + m_bus(*this, ISA_BUS_TAG), + m_char_rom(*this, AMS40041_TAG), + m_video_ram(*this, "video_ram"), + m_lk(*this, "LK"), + m_pit1(0), + m_pit2(0), + m_status1(0), + m_status2(0), + m_port61(0), + m_nmi_enable(0), + m_kb_bits(0), + m_kbclk(1), + m_kbdata(1), + m_dreq0(0), + m_nden(1), + m_dint(0), + m_ddrq(0), + m_fdc_dsr(0), + m_neop(0), + m_ack_int_enable(1), + m_centronics_ack(0), + m_speaker_drive(0) + { } + + required_device m_maincpu; + required_device m_dmac; + required_device m_pic; + required_device m_pit; + required_device m_rtc; + required_device m_fdc; + required_device m_uart; + optional_device m_vdu; + required_device m_centronics; + required_device m_cent_data_out; + required_device m_speaker; + required_device m_kb; + required_device m_ram; + required_device m_floppy0; + optional_device m_floppy1; + required_device m_bus; + optional_memory_region m_char_rom; + optional_shared_ptr m_video_ram; + required_ioport m_lk; + + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void update_speaker(); + void update_fdc_int(); + void update_fdc_drq(); + void update_fdc_tc(); + void update_ack(); + void set_fdc_dsr(UINT8 data); + int get_display_mode(UINT8 mode); + offs_t get_char_rom_offset(); + int get_color(UINT8 data); + MC6845_UPDATE_ROW(draw_alpha); + MC6845_UPDATE_ROW(draw_graphics_1); + MC6845_UPDATE_ROW(draw_graphics_2); + + DECLARE_READ8_MEMBER( video_ram_r ); + DECLARE_WRITE8_MEMBER( video_ram_w ); + DECLARE_READ8_MEMBER( system_r ); + DECLARE_WRITE8_MEMBER( system_w ); + DECLARE_READ8_MEMBER( mouse_r ); + DECLARE_WRITE8_MEMBER( mouse_w ); + DECLARE_WRITE8_MEMBER( dma_page_w ); + DECLARE_WRITE8_MEMBER( nmi_mask_w ); + DECLARE_READ8_MEMBER( printer_r ); + DECLARE_WRITE8_MEMBER( printer_w ); + DECLARE_READ8_MEMBER( fdc_r ); + DECLARE_WRITE8_MEMBER( fdc_w ); + DECLARE_READ8_MEMBER( vdu_r ); + DECLARE_WRITE8_MEMBER( vdu_w ); + DECLARE_WRITE_LINE_MEMBER( kbdata_w ); + DECLARE_WRITE_LINE_MEMBER( kbclk_w ); + DECLARE_WRITE_LINE_MEMBER( pit1_w ); + DECLARE_WRITE_LINE_MEMBER( pit2_w ); + DECLARE_WRITE_LINE_MEMBER( ack_w ); + DECLARE_WRITE_LINE_MEMBER( hrq_w ); + DECLARE_WRITE_LINE_MEMBER( eop_w ); + DECLARE_READ8_MEMBER( memr_r ); + DECLARE_WRITE8_MEMBER( memw_w ); + DECLARE_READ8_MEMBER( ior1_r ); + DECLARE_READ8_MEMBER( ior2_r ); + DECLARE_READ8_MEMBER( ior3_r ); + DECLARE_WRITE8_MEMBER( iow0_w ); + DECLARE_WRITE8_MEMBER( iow1_w ); + DECLARE_WRITE8_MEMBER( iow2_w ); + DECLARE_WRITE8_MEMBER( iow3_w ); + DECLARE_WRITE_LINE_MEMBER( dack0_w ); + DECLARE_WRITE_LINE_MEMBER( dack1_w ); + DECLARE_WRITE_LINE_MEMBER( dack2_w ); + DECLARE_WRITE_LINE_MEMBER( dack3_w ); + DECLARE_INPUT_CHANGED_MEMBER( mouse_button_1_changed ); + DECLARE_INPUT_CHANGED_MEMBER( mouse_button_2_changed ); + DECLARE_INPUT_CHANGED_MEMBER( mouse_x_changed ); + DECLARE_INPUT_CHANGED_MEMBER( mouse_y_changed ); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + DECLARE_WRITE_LINE_MEMBER( fdc_int_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + DECLARE_WRITE_LINE_MEMBER(write_centronics_select); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + MC6845_UPDATE_ROW(crtc_update_row); + + // system status register + int m_pit1; + int m_pit2; + UINT8 m_status1; + UINT8 m_status2; + UINT8 m_port61; + + // interrupt state + int m_nmi_enable; + + // keyboard state + UINT8 m_kbd; + int m_kb_bits; + int m_kbclk; + int m_kbdata; + + // mouse state + UINT8 m_mouse_x; + UINT8 m_mouse_y; + + // DMA state + UINT8 m_dma_page[4]; + int m_dma_channel; + int m_dreq0; + + // floppy state + int m_nden; + int m_dint; + int m_ddrq; + UINT8 m_fdc_dsr; + int m_neop; + + // printer state + int m_ack_int_enable; + int m_centronics_ack; + int m_centronics_busy; + int m_centronics_perror; + int m_centronics_select; + int m_centronics_fault; + UINT8 m_printer_data; + UINT8 m_printer_control; + + // video state + int m_toggle; + int m_lpen; + int m_blink; + int m_cursor; + int m_blink_ctr; + UINT8 m_vdu_mode; + UINT8 m_vdu_color; + UINT8 m_vdu_plane; + UINT8 m_vdu_rdsel; + UINT8 m_vdu_border; + + // sound state + int m_speaker_drive; +}; + +class pc1640_state : public pc1512_state +{ +public: + pc1640_state(const machine_config &mconfig, device_type type, const char *tag) + : pc1512_state(mconfig, type, tag), + m_sw(*this, "SW"), + m_opt(0) + { } + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( io_r ); + DECLARE_READ8_MEMBER( printer_r ); + + required_ioport m_sw; + + int m_opt; +}; + +// ---------- defined in video/pc1512.c ---------- + +MACHINE_CONFIG_EXTERN( pc1512_video ); + +#endif diff --git a/src/mame/includes/pc4.h b/src/mame/includes/pc4.h new file mode 100644 index 00000000000..003669597b8 --- /dev/null +++ b/src/mame/includes/pc4.h @@ -0,0 +1,76 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + VTech Laser PC4 + +****************************************************************************/ + +#pragma once + +#ifndef _PC4_H_ +#define _PC4_H_ + + +#include "sound/beep.h" + +class pc4_state : public driver_device +{ +public: + pc4_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_beep(*this, "beeper"), + m_region_charset(*this, "charset"), + m_rombank(*this, "rombank") { } + + required_device m_maincpu; + required_device m_beep; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + virtual void machine_start(); + + DECLARE_WRITE8_MEMBER( beep_w ); + DECLARE_WRITE8_MEMBER( bank_w ); + DECLARE_READ8_MEMBER( kb_r ); + + //LCD controller + void update_ac(void); + void set_busy_flag(UINT16 usec); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + DECLARE_WRITE8_MEMBER(lcd_control_w); + DECLARE_READ8_MEMBER(lcd_control_r); + DECLARE_WRITE8_MEMBER(lcd_data_w); + DECLARE_READ8_MEMBER(lcd_data_r); + DECLARE_WRITE8_MEMBER( lcd_offset_w ); + + static const device_timer_id BUSY_TIMER = 0; + static const device_timer_id BLINKING_TIMER = 1; + + emu_timer *m_blink_timer; + emu_timer *m_busy_timer; + + UINT8 m_busy_flag; + UINT8 m_ddram[0xa0]; + UINT8 m_cgram[0x40]; + INT16 m_ac; + UINT8 m_ac_mode; + UINT8 m_data_bus_flag; + INT16 m_cursor_pos; + UINT8 m_display_on; + UINT8 m_cursor_on; + UINT8 m_blink_on; + UINT8 m_shift_on; + INT8 m_disp_shift; + INT8 m_direction; + UINT8 m_blink; + DECLARE_PALETTE_INIT(pc4); + +protected: + required_memory_region m_region_charset; + required_memory_bank m_rombank; + ioport_port *io_port[8]; +}; + +#endif // _PC4_H_ diff --git a/src/mame/includes/pc8001.h b/src/mame/includes/pc8001.h new file mode 100644 index 00000000000..524adfba29c --- /dev/null +++ b/src/mame/includes/pc8001.h @@ -0,0 +1,96 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __PC8001__ +#define __PC8001__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8257.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "machine/ram.h" +#include "machine/upd1990a.h" +#include "sound/speaker.h" +#include "video/upd3301.h" + +#define Z80_TAG "z80" +#define I8251_TAG "i8251" +#define I8255A_TAG "i8255" +#define I8257_TAG "i8257" +#define UPD1990A_TAG "upd1990a" +#define UPD3301_TAG "upd3301" +#define CENTRONICS_TAG "centronics" +#define SCREEN_TAG "screen" + +class pc8001_state : public driver_device +{ +public: + pc8001_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_rtc(*this, UPD1990A_TAG), + m_dma(*this, I8257_TAG), + m_crtc(*this, UPD3301_TAG), + m_cassette(*this, "cassette"), + m_centronics(*this, CENTRONICS_TAG), + m_cent_data_out(*this, "cent_data_out"), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG), + m_rom(*this, Z80_TAG), + m_char_rom(*this, UPD3301_TAG) + { } + + required_device m_maincpu; + required_device m_rtc; + required_device m_dma; + required_device m_crtc; + required_device m_cassette; + required_device m_centronics; + required_device m_cent_data_out; + required_device m_speaker; + required_device m_ram; + required_memory_region m_rom; + required_memory_region m_char_rom; + + virtual void machine_start(); + + DECLARE_WRITE8_MEMBER( port10_w ); + DECLARE_WRITE8_MEMBER( port30_w ); + DECLARE_READ8_MEMBER( port40_r ); + DECLARE_WRITE8_MEMBER( port40_w ); + DECLARE_WRITE_LINE_MEMBER( crtc_drq_w ); + DECLARE_WRITE_LINE_MEMBER( hrq_w ); + DECLARE_READ8_MEMBER( dma_mem_r ); + + /* video state */ + int m_width80; + int m_color; + + int m_centronics_busy; + int m_centronics_ack; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + UPD3301_DRAW_CHARACTER_MEMBER( pc8001_display_pixels ); +}; + +class pc8001mk2_state : public pc8001_state +{ +public: + pc8001mk2_state(const machine_config &mconfig, device_type type, const char *tag) + : pc8001_state(mconfig, type, tag), + m_kanji_rom(*this, "kanji") + { } + + required_memory_region m_kanji_rom; + + DECLARE_WRITE8_MEMBER( port31_w ); +}; + +#endif diff --git a/src/mame/includes/pc8401a.h b/src/mame/includes/pc8401a.h new file mode 100644 index 00000000000..10e99652cd1 --- /dev/null +++ b/src/mame/includes/pc8401a.h @@ -0,0 +1,115 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __PC8401A__ +#define __PC8401A__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "machine/ram.h" +#include "machine/upd1990a.h" +#include "video/mc6845.h" +#include "video/sed1330.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define SCREEN_TAG "screen" +#define CRT_SCREEN_TAG "screen2" + +#define Z80_TAG "z80" +#define I8255A_TAG "i8255a" +#define UPD1990A_TAG "upd1990a" +#define AY8910_TAG "ay8910" +#define SED1330_TAG "sed1330" +#define MC6845_TAG "mc6845" +#define I8251_TAG "i8251" +#define RS232_TAG "rs232" + +#define PC8401A_CRT_VIDEORAM_SIZE 0x2000 + +class pc8401a_state : public driver_device +{ +public: + pc8401a_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_rtc(*this, UPD1990A_TAG), + m_lcdc(*this, SED1330_TAG), + m_crtc(*this, MC6845_TAG), + m_screen_lcd(*this, SCREEN_TAG), + m_cart(*this, "cartslot"), + m_io_cart(*this, "io_cart"), + m_ram(*this, RAM_TAG), + m_rom(*this, Z80_TAG), + m_crt_ram(*this, "crt_ram"), + m_io_y(*this, "Y") + { } + + required_device m_maincpu; + required_device m_rtc; + required_device m_lcdc; + optional_device m_crtc; + required_device m_screen_lcd; + required_device m_cart; + required_device m_io_cart; + required_device m_ram; + required_memory_region m_rom; + optional_shared_ptr m_crt_ram; + required_ioport_array<10> m_io_y; + + memory_region *m_cart_rom; + + virtual void machine_start(); + virtual void video_start(); + + DECLARE_WRITE8_MEMBER( mmr_w ); + DECLARE_READ8_MEMBER( mmr_r ); + DECLARE_READ8_MEMBER( rtc_r ); + DECLARE_WRITE8_MEMBER( rtc_cmd_w ); + DECLARE_WRITE8_MEMBER( rtc_ctrl_w ); + DECLARE_READ8_MEMBER( io_rom_data_r ); + DECLARE_WRITE8_MEMBER( io_rom_addr_w ); + DECLARE_READ8_MEMBER( port70_r ); + DECLARE_READ8_MEMBER( port71_r ); + DECLARE_WRITE8_MEMBER( port70_w ); + DECLARE_WRITE8_MEMBER( port71_w ); + DECLARE_READ8_MEMBER( ppi_pc_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + DECLARE_PALETTE_INIT(pc8401a); + + void scan_keyboard(); + void bankswitch(UINT8 data); + + // keyboard state + int m_key_strobe; // key pressed + + // memory state + UINT8 m_mmr; // memory mapping register + UINT32 m_io_addr; // I/O ROM address counter + + UINT8 m_key_latch; + TIMER_DEVICE_CALLBACK_MEMBER(pc8401a_keyboard_tick); +}; + +class pc8500_state : public pc8401a_state +{ +public: + pc8500_state(const machine_config &mconfig, device_type type, const char *tag) + : pc8401a_state(mconfig, type, tag) + { } + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + +// ---------- defined in video/pc8401a.c ---------- + +MACHINE_CONFIG_EXTERN( pc8401a_video ); +MACHINE_CONFIG_EXTERN( pc8500_video ); + +#endif diff --git a/src/mame/includes/pce.h b/src/mame/includes/pce.h new file mode 100644 index 00000000000..9d9a7d34b56 --- /dev/null +++ b/src/mame/includes/pce.h @@ -0,0 +1,82 @@ +// license:BSD-3-Clause +// copyright-holders:Charles MacDonald, Wilbert Pol, Angelo Salese +/***************************************************************************** + * + * includes/pce.h + * + * NEC PC Engine/TurboGrafx16 + * + ****************************************************************************/ + +#ifndef PCE_H_ +#define PCE_H_ + +#include "cdrom.h" +#include "cpu/h6280/h6280.h" +#include "bus/pce/pce_slot.h" +#include "machine/pce_cd.h" +#include "video/huc6260.h" + +#define C6280_TAG "c6280" + +#define MAIN_CLOCK 21477270 + +#define TG_16_JOY_SIG 0x00 +#define PCE_JOY_SIG 0x40 +#define NO_CD_SIG 0x80 +#define CD_SIG 0x00 +/* these might be used to indicate something, but they always seem to return 1 */ +#define CONST_SIG 0x30 + + + +class pce_state : public driver_device +{ +public: + pce_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cd_ram(*this, "cd_ram"), + m_user_ram(*this, "user_ram"), + m_huc6260(*this, "huc6260"), + m_cartslot(*this, "cartslot"), + m_cd(*this, "pce_cd"), + m_joy(*this, "JOY_P"), + m_joy6b(*this, "JOY6B_P"), + m_joy_type(*this, "JOY_TYPE"), + m_a_card(*this, "A_CARD") + { } + + required_device m_maincpu; + required_shared_ptr m_cd_ram; + required_shared_ptr m_user_ram; + optional_device m_huc6260; + required_device m_cartslot; + optional_device m_cd; + required_ioport_array<5> m_joy; + required_ioport_array<5> m_joy6b; + required_ioport m_joy_type; + required_ioport m_a_card; + + UINT8 m_io_port_options; + UINT8 m_sys3_card; + UINT8 m_acard; + int m_joystick_port_select; + int m_joystick_data_select; + UINT8 m_joy_6b_packet[5]; + DECLARE_WRITE8_MEMBER(mess_pce_joystick_w); + DECLARE_READ8_MEMBER(mess_pce_joystick_r); + DECLARE_WRITE8_MEMBER(pce_cd_intf_w); + DECLARE_READ8_MEMBER(pce_cd_intf_r); + DECLARE_READ8_MEMBER(pce_cd_acard_wram_r); + DECLARE_WRITE8_MEMBER(pce_cd_acard_wram_w); + DECLARE_DRIVER_INIT(sgx); + DECLARE_DRIVER_INIT(tg16); + DECLARE_DRIVER_INIT(mess_pce); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_MACHINE_START(pce); + DECLARE_MACHINE_RESET(mess_pce); + DECLARE_WRITE_LINE_MEMBER(pce_irq_changed); +}; + +#endif /* PCE_H_ */ diff --git a/src/mame/includes/pcw.h b/src/mame/includes/pcw.h new file mode 100644 index 00000000000..ef81c98bc82 --- /dev/null +++ b/src/mame/includes/pcw.h @@ -0,0 +1,140 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/***************************************************************************** + * + * includes/pcw.h + * + ****************************************************************************/ + +#ifndef PCW_H_ +#define PCW_H_ + +#include "machine/upd765.h" +#include "machine/ram.h" +#include "sound/beep.h" + +#define PCW_BORDER_HEIGHT 8 +#define PCW_BORDER_WIDTH 8 +#define PCW_NUM_COLOURS 2 +#define PCW_DISPLAY_WIDTH 720 +#define PCW_DISPLAY_HEIGHT 256 + +#define PCW_SCREEN_WIDTH (PCW_DISPLAY_WIDTH + (PCW_BORDER_WIDTH<<1)) +#define PCW_SCREEN_HEIGHT (PCW_DISPLAY_HEIGHT + (PCW_BORDER_HEIGHT<<1)) +#define PCW_PRINTER_WIDTH (80*16) +#define PCW_PRINTER_HEIGHT (20*16) + + +class pcw_state : public driver_device +{ +public: + pcw_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_fdc(*this, "upd765"), + m_ram(*this, RAM_TAG), + m_beeper(*this, "beeper"), + m_screen(*this, "screen"), + m_palette(*this, "palette") + { } + + int m_boot; + int m_system_status; + int m_fdc_interrupt_code; + int m_interrupt_counter; + UINT8 m_banks[4]; + unsigned char m_bank_force; + UINT8 m_timer_irq_flag; + UINT8 m_nmi_flag; + UINT8 m_printer_command; + UINT8 m_printer_data; + UINT8 m_printer_status; + INT16 m_printer_headpos; + UINT16 m_kb_scan_row; + UINT8 m_mcu_keyboard_data[16]; + UINT8 m_mcu_transmit_reset_seq; + UINT8 m_mcu_transmit_count; + UINT8 m_mcu_selected; + UINT8 m_mcu_buffer; + UINT8 m_mcu_prev; + unsigned int m_roller_ram_addr; + unsigned short m_roller_ram_offset; + unsigned char m_vdu_video_control_register; + UINT8 m_printer_serial; // value if shift/store data pin + UINT8 m_printer_shift; // state of shift register + UINT8 m_printer_shift_output; // output presented to the paper feed motor and print head motor + UINT8 m_head_motor_state; + UINT8 m_linefeed_motor_state; + UINT16 m_printer_pins; + UINT8 m_printer_p2; // MCU port P2 state + UINT32 m_paper_feed; // amount of paper fed through printer, by n/360 inches. One line feed is 61/360in (from the linefeed command in CP/M;s ptr menu) + bitmap_ind16* m_prn_output; + UINT8 m_printer_p2_prev; + emu_timer* m_prn_stepper; + emu_timer* m_prn_pins; + DECLARE_READ8_MEMBER(pcw_keyboard_r); + DECLARE_READ8_MEMBER(pcw_keyboard_data_r); + DECLARE_READ8_MEMBER(pcw_interrupt_counter_r); + DECLARE_WRITE8_MEMBER(pcw_bank_select_w); + DECLARE_WRITE8_MEMBER(pcw_bank_force_selection_w); + DECLARE_WRITE8_MEMBER(pcw_roller_ram_addr_w); + DECLARE_WRITE8_MEMBER(pcw_pointer_table_top_scan_w); + DECLARE_WRITE8_MEMBER(pcw_vdu_video_control_register_w); + DECLARE_WRITE8_MEMBER(pcw_system_control_w); + DECLARE_READ8_MEMBER(pcw_system_status_r); + DECLARE_READ8_MEMBER(pcw_expansion_r); + DECLARE_WRITE8_MEMBER(pcw_expansion_w); + DECLARE_WRITE8_MEMBER(pcw_printer_data_w); + DECLARE_WRITE8_MEMBER(pcw_printer_command_w); + DECLARE_READ8_MEMBER(pcw_printer_data_r); + DECLARE_READ8_MEMBER(pcw_printer_status_r); + DECLARE_READ8_MEMBER(mcu_printer_p1_r); + DECLARE_WRITE8_MEMBER(mcu_printer_p1_w); + DECLARE_READ8_MEMBER(mcu_printer_p2_r); + DECLARE_WRITE8_MEMBER(mcu_printer_p2_w); + DECLARE_READ8_MEMBER(mcu_printer_t1_r); + DECLARE_READ8_MEMBER(mcu_printer_t0_r); + DECLARE_READ8_MEMBER(mcu_kb_scan_r); + DECLARE_WRITE8_MEMBER(mcu_kb_scan_w); + DECLARE_READ8_MEMBER(mcu_kb_scan_high_r); + DECLARE_WRITE8_MEMBER(mcu_kb_scan_high_w); + DECLARE_READ8_MEMBER(mcu_kb_data_r); + DECLARE_READ8_MEMBER(mcu_kb_t1_r); + DECLARE_READ8_MEMBER(mcu_kb_t0_r); + DECLARE_READ8_MEMBER(pcw9512_parallel_r); + DECLARE_WRITE8_MEMBER(pcw9512_parallel_w); + void mcu_transmit_serial(UINT8 bit); + DECLARE_DRIVER_INIT(pcw); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(pcw); + UINT32 screen_update_pcw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_pcw_printer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pcw_timer_pulse); + TIMER_CALLBACK_MEMBER(pcw_stepper_callback); + TIMER_CALLBACK_MEMBER(pcw_pins_callback); + TIMER_CALLBACK_MEMBER(setup_beep); + TIMER_DEVICE_CALLBACK_MEMBER(pcw_timer_interrupt); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + DECLARE_WRITE_LINE_MEMBER( pcw_fdc_interrupt ); + required_device m_maincpu; + required_device m_fdc; + required_device m_ram; + required_device m_beeper; + required_device m_screen; + required_device m_palette; + + inline void pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void pcw_update_interrupt_counter(); + void pcw_update_irqs(); + void pcw_update_read_memory_block(int block, int bank); + void pcw_update_write_memory_block(int block, int bank); + void pcw_update_mem(int block, int data); + int pcw_get_sys_status(); + void pcw_printer_fire_pins(UINT16 pins); +}; + +#endif /* PCW_H_ */ diff --git a/src/mame/includes/pcw16.h b/src/mame/includes/pcw16.h new file mode 100644 index 00000000000..2321267578c --- /dev/null +++ b/src/mame/includes/pcw16.h @@ -0,0 +1,160 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/***************************************************************************** + * + * includes/pcw16.h + * + ****************************************************************************/ + +#ifndef PCW16_H_ +#define PCW16_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/upd765.h" /* FDC superio */ +#include "machine/pc_lpt.h" /* PC-Parallel Port */ +#include "machine/pckeybrd.h" /* PC-AT keyboard */ +#include "machine/upd765.h" /* FDC superio */ +#include "machine/ins8250.h" /* pc com port */ +#include "sound/beep.h" /* pcw/pcw16 beeper */ +#include "machine/intelfsh.h" +#include "formats/pc_dsk.h" +#include "machine/ram.h" + +#define PCW16_BORDER_HEIGHT 8 +#define PCW16_BORDER_WIDTH 8 +#define PCW16_NUM_COLOURS 32 +#define PCW16_DISPLAY_WIDTH 640 +#define PCW16_DISPLAY_HEIGHT 480 + +#define PCW16_SCREEN_WIDTH (PCW16_DISPLAY_WIDTH + (PCW16_BORDER_WIDTH<<1)) +#define PCW16_SCREEN_HEIGHT (PCW16_DISPLAY_HEIGHT + (PCW16_BORDER_HEIGHT<<1)) + + +class pcw16_state : public driver_device +{ +public: + pcw16_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_flash0(*this, "flash0"), + m_flash1(*this, "flash1"), + m_fdc(*this, "fdc"), + m_uart2(*this, "ns16550_2"), + m_beeper(*this, "beeper"), + m_ram(*this, RAM_TAG), + m_keyboard(*this, "at_keyboard"), + m_region_rom(*this, "maincpu"), + m_io_extra(*this, "EXTRA") + { } + + required_device m_maincpu; + required_device m_flash0; + required_device m_flash1; + required_device m_fdc; + required_device m_uart2; + required_device m_beeper; + required_device m_ram; + required_device m_keyboard; + required_memory_region m_region_rom; + required_ioport m_io_extra; + + unsigned long m_interrupt_counter; + int m_banks[4]; + int m_4_bit_port; + int m_fdc_int_code; + int m_system_status; + char *m_mem_ptr[4]; + unsigned char m_keyboard_data_shift; + int m_keyboard_parity_table[256]; + int m_keyboard_bits; + int m_keyboard_bits_output; + int m_keyboard_state; + int m_keyboard_previous_state; + unsigned char m_rtc_seconds; + unsigned char m_rtc_minutes; + unsigned char m_rtc_hours; + unsigned char m_rtc_days_max; + unsigned char m_rtc_days; + unsigned char m_rtc_months; + unsigned char m_rtc_years; + unsigned char m_rtc_control; + unsigned char m_rtc_256ths_seconds; + int m_previous_fdc_int_state; + int m_colour_palette[16]; + int m_video_control; + DECLARE_WRITE8_MEMBER(pcw16_palette_w); + DECLARE_READ8_MEMBER(pcw16_bankhw_r); + DECLARE_WRITE8_MEMBER(pcw16_bankhw_w); + DECLARE_WRITE8_MEMBER(pcw16_video_control_w); + DECLARE_READ8_MEMBER(pcw16_keyboard_data_shift_r); + DECLARE_WRITE8_MEMBER(pcw16_keyboard_data_shift_w); + DECLARE_READ8_MEMBER(pcw16_keyboard_status_r); + DECLARE_WRITE8_MEMBER(pcw16_keyboard_control_w); + DECLARE_READ8_MEMBER(rtc_year_invalid_r); + DECLARE_READ8_MEMBER(rtc_month_r); + DECLARE_READ8_MEMBER(rtc_days_r); + DECLARE_READ8_MEMBER(rtc_hours_r); + DECLARE_READ8_MEMBER(rtc_minutes_r); + DECLARE_READ8_MEMBER(rtc_seconds_r); + DECLARE_READ8_MEMBER(rtc_256ths_seconds_r); + DECLARE_WRITE8_MEMBER(rtc_control_w); + DECLARE_WRITE8_MEMBER(rtc_seconds_w); + DECLARE_WRITE8_MEMBER(rtc_minutes_w); + DECLARE_WRITE8_MEMBER(rtc_hours_w); + DECLARE_WRITE8_MEMBER(rtc_days_w); + DECLARE_WRITE8_MEMBER(rtc_month_w); + DECLARE_WRITE8_MEMBER(rtc_year_w); + DECLARE_READ8_MEMBER(pcw16_system_status_r); + DECLARE_READ8_MEMBER(pcw16_timer_interrupt_counter_r); + DECLARE_WRITE8_MEMBER(pcw16_system_control_w); + DECLARE_WRITE8_MEMBER(pcw16_superio_fdc_datarate_w); + DECLARE_WRITE8_MEMBER(pcw16_superio_fdc_digital_output_register_w); + DECLARE_WRITE8_MEMBER(pcw16_superio_fdc_data_w); + DECLARE_READ8_MEMBER(pcw16_superio_fdc_data_r); + DECLARE_READ8_MEMBER(pcw16_superio_fdc_main_status_register_r); + DECLARE_READ8_MEMBER(pcw16_superio_fdc_digital_input_register_r); + DECLARE_READ8_MEMBER(pcw16_mem_r); + DECLARE_WRITE8_MEMBER(pcw16_mem_w); + void pcw16_keyboard_init(); + void pcw16_keyboard_refresh_outputs(); + void pcw16_keyboard_set_clock_state(int state); + void pcw16_keyboard_int(int state); + void pcw16_keyboard_reset(); + int pcw16_keyboard_can_transmit(); + void pcw16_keyboard_signal_byte_received(int data); + void pcw16_refresh_ints(); + void rtc_setup_max_days(); + UINT8 pcw16_read_mem(UINT8 bank, UINT16 offset); + void pcw16_write_mem(UINT8 bank, UINT16 offset, UINT8 data); + UINT8 read_bank_data(UINT8 type, UINT16 offset); + void write_bank_data(UINT8 type, UINT16 offset, UINT8 data); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(pcw16); + UINT32 screen_update_pcw16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(pcw16_timer_callback); + TIMER_DEVICE_CALLBACK_MEMBER(rtc_timer_callback); + DECLARE_WRITE_LINE_MEMBER(pcw16_com_interrupt_1); + DECLARE_WRITE_LINE_MEMBER(pcw16_com_interrupt_2); + DECLARE_WRITE_LINE_MEMBER(pcw16_com_tx_0); + DECLARE_WRITE_LINE_MEMBER(pcw16_com_dtr_0); + DECLARE_WRITE_LINE_MEMBER(pcw16_com_rts_0); + DECLARE_WRITE_LINE_MEMBER(pcw16_com_tx_1); + DECLARE_WRITE_LINE_MEMBER(pcw16_com_dtr_1); + DECLARE_WRITE_LINE_MEMBER(pcw16_com_rts_1); + DECLARE_WRITE_LINE_MEMBER(pcw16_keyboard_callback); + INPUT_CHANGED_MEMBER(power); + + void trigger_fdc_int(); + DECLARE_WRITE_LINE_MEMBER( fdc_interrupt ); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + inline void pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); + void pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); + void pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); + void pcw16_begin_byte_transfer(); +}; + +#endif /* PCW16_H_ */ diff --git a/src/mame/includes/pdp1.h b/src/mame/includes/pdp1.h new file mode 100644 index 00000000000..074c907a489 --- /dev/null +++ b/src/mame/includes/pdp1.h @@ -0,0 +1,336 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/***************************************************************************** + * + * includes/pdp1.h + * + ****************************************************************************/ + +#ifndef PDP1_H_ +#define PDP1_H_ + +#include "cpu/pdp1/pdp1.h" +#include "video/crt.h" + +/* defines for each bit and mask in input port "CSW" */ +enum +{ + /* bit numbers */ + pdp1_control_bit = 0, + + pdp1_extend_bit = 1, + pdp1_start_nobrk_bit= 2, + pdp1_start_brk_bit = 3, + pdp1_stop_bit = 4, + pdp1_continue_bit = 5, + pdp1_examine_bit = 6, + pdp1_deposit_bit = 7, + pdp1_read_in_bit = 8, + pdp1_reader_bit = 9, + pdp1_tape_feed_bit = 10, + pdp1_single_step_bit= 11, + pdp1_single_inst_bit= 12, + + /* masks */ + pdp1_control = (1 << pdp1_control_bit), + pdp1_extend = (1 << pdp1_extend_bit), + pdp1_start_nobrk = (1 << pdp1_start_nobrk_bit), + pdp1_start_brk = (1 << pdp1_start_brk_bit), + pdp1_stop = (1 << pdp1_stop_bit), + pdp1_continue = (1 << pdp1_continue_bit), + pdp1_examine = (1 << pdp1_examine_bit), + pdp1_deposit = (1 << pdp1_deposit_bit), + pdp1_read_in = (1 << pdp1_read_in_bit), + pdp1_reader = (1 << pdp1_reader_bit), + pdp1_tape_feed = (1 << pdp1_tape_feed_bit), + pdp1_single_step = (1 << pdp1_single_step_bit), + pdp1_single_inst = (1 << pdp1_single_inst_bit) +}; + +/* defines for each bit in input port pdp1_spacewar_controllers*/ +#define ROTATE_LEFT_PLAYER1 0x01 +#define ROTATE_RIGHT_PLAYER1 0x02 +#define THRUST_PLAYER1 0x04 +#define FIRE_PLAYER1 0x08 +#define ROTATE_LEFT_PLAYER2 0x10 +#define ROTATE_RIGHT_PLAYER2 0x20 +#define THRUST_PLAYER2 0x40 +#define FIRE_PLAYER2 0x80 +#define HSPACE_PLAYER1 0x100 +#define HSPACE_PLAYER2 0x200 + +/* defines for each field in input port pdp1_config */ +enum +{ + pdp1_config_extend_bit = 0, + pdp1_config_extend_mask = 0x3, /* 2 bits */ + pdp1_config_hw_mul_div_bit = 2, + pdp1_config_hw_mul_div_mask = 0x1, + /*pdp1_config_hw_obsolete_bit = 3, + pdp1_config_hw_obsolete_mask = 0x1,*/ + pdp1_config_type_20_sbs_bit = 4, + pdp1_config_type_20_sbs_mask = 0x1, + pdp1_config_lightpen_bit = 5, + pdp1_config_lightpen_mask = 0x1 +}; + +/* defines for each field in input port pdp1_lightpen_state */ +enum +{ + pdp1_lightpen_down_bit = 0, + pdp1_lightpen_smaller_bit = 1, + pdp1_lightpen_larger_bit = 2, + + pdp1_lightpen_down = (1 << pdp1_lightpen_down_bit), + pdp1_lightpen_smaller = (1 << pdp1_lightpen_smaller_bit), + pdp1_lightpen_larger = (1 << pdp1_lightpen_larger_bit) +}; + +/* defines for our font */ +enum +{ + pdp1_charnum = /*104*/128, /* ASCII set + 8 special characters */ + /* for whatever reason, 104 breaks some characters */ + + pdp1_fontdata_size = 8 * pdp1_charnum +}; + +enum +{ + /* size and position of crt window */ + crt_window_width = 512, + crt_window_height = 512, + crt_window_offset_x = 0, + crt_window_offset_y = 0, + /* size and position of operator control panel window */ + panel_window_width = 384, + panel_window_height = 128, + panel_window_offset_x = crt_window_width, + panel_window_offset_y = 0, + /* size and position of typewriter window */ + typewriter_window_width = 640, + typewriter_window_height = 160, + typewriter_window_offset_x = 0, + typewriter_window_offset_y = crt_window_height +}; + +enum +{ + total_width = crt_window_width + panel_window_width, + total_height = crt_window_height + typewriter_window_height, + + /* respect 4:3 aspect ratio to keep pixels square */ + virtual_width_1 = ((total_width+3)/4)*4, + virtual_height_1 = ((total_height+2)/3)*3, + virtual_width_2 = virtual_height_1*4/3, + virtual_height_2 = virtual_width_1*3/4, + virtual_width = (virtual_width_1 > virtual_width_2) ? virtual_width_1 : virtual_width_2, + virtual_height = (virtual_height_1 > virtual_height_2) ? virtual_height_1 : virtual_height_2 +}; + +enum +{ /* refresh rate in Hz: can be changed at will */ + refresh_rate = 60 +}; + +/* Color codes */ +enum +{ + /* first pen_crt_num_levels colors used for CRT (with remanence) */ + pen_crt_num_levels = 69, + pen_crt_max_intensity = pen_crt_num_levels-1, + + /* next colors used for control panel and typewriter */ + pen_black = pen_crt_num_levels, + pen_white, + pen_green, + pen_dk_green, + pen_red, + pen_lt_gray, + + /* color constants for control panel */ + pen_panel_bg = pen_black, + pen_panel_caption = pen_white, + color_panel_caption = 0, + pen_switch_nut = pen_lt_gray, + pen_switch_button = pen_white, + pen_lit_lamp = pen_green, + pen_unlit_lamp = pen_dk_green, + + /* color constants for typewriter */ + pen_typewriter_bg = pen_white, + color_typewriter_black = 1, + color_typewriter_red = 2, + + /* color constants used for light pen */ + pen_lightpen_nonpressed = pen_red, + pen_lightpen_pressed = pen_green +}; + +/* tape reader registers */ +struct tape_reader_t +{ + device_image_interface *fd; /* file descriptor of tape image */ + + int motor_on; /* 1-bit reader motor on */ + + int rb; /* 18-bit reader buffer */ + int rcl; /* 1-bit reader clutch */ + int rc; /* 2-bit reader counter */ + int rby; /* 1-bit reader binary mode flip-flop */ + int rcp; /* 1-bit reader "need a completion pulse" flip-flop */ + + emu_timer *timer; /* timer to simulate reader timing */ +}; + + + +/* tape puncher registers */ +struct tape_puncher_t +{ + device_image_interface *fd; /* file descriptor of tape image */ + + emu_timer *timer; /* timer to generate completion pulses */ +}; + + + +/* typewriter registers */ +struct typewriter_t +{ + device_image_interface *fd; /* file descriptor of output image */ + + int tb; /* typewriter buffer */ + + emu_timer *tyo_timer;/* timer to generate completion pulses */ +}; + +/* MIT parallel drum (mostly similar to type 23) */ +struct parallel_drum_t +{ + device_image_interface *fd; /* file descriptor of drum image */ + + int il; /* initial location (12-bit) */ + int wc; /* word counter (12-bit) */ + int wcl; /* word core location counter (16-bit) */ + int rfb; /* read field buffer (5-bit) */ + int wfb; /* write field buffer (5-bit) */ + + int dba; + + emu_timer *rotation_timer; /* timer called each time dc is 0 */ + emu_timer *il_timer; /* timer called each time dc is il */ +}; + + +struct lightpen_t +{ + char active; + char down; + short x, y; + short radius; +}; + + +class pdp1_state : public driver_device +{ +public: + pdp1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_crt(*this, "crt"), + m_spacewar(*this, "SPACEWAR"), + m_csw(*this, "CSW"), + m_sense(*this, "SENSE"), + m_tstadd(*this, "TSTADD"), + m_twdmsb(*this, "TWDMSB"), + m_twdlsb(*this, "TWDLSB"), + m_twr(*this, "TWR"), + m_cfg(*this, "CFG"), + m_io_lightpen(*this, "LIGHTPEN"), + m_lightx(*this, "LIGHTX"), + m_lighty(*this, "LIGHTY") + { } + + int m_io_status; + tape_reader_t m_tape_reader; + tape_puncher_t m_tape_puncher; + typewriter_t m_typewriter; + emu_timer *m_dpy_timer; + lightpen_t m_lightpen; + parallel_drum_t m_parallel_drum; + required_device m_maincpu; + + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(pdp1); + UINT32 screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_pdp1(screen_device &screen, bool state); + INTERRUPT_GEN_MEMBER(pdp1_interrupt); + TIMER_CALLBACK_MEMBER(reader_callback); + TIMER_CALLBACK_MEMBER(puncher_callback); + TIMER_CALLBACK_MEMBER(tyo_callback); + TIMER_CALLBACK_MEMBER(dpy_callback); + TIMER_CALLBACK_MEMBER(il_timer_callback); + void pdp1_machine_stop(); + inline void pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void pdp1_plot(int x, int y); + void pdp1_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); + void pdp1_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); + void pdp1_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state); + void pdp1_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); + void pdp1_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color); + void pdp1_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color); + void pdp1_draw_panel_backdrop(bitmap_ind16 &bitmap); + void pdp1_draw_panel(bitmap_ind16 &bitmap); + void pdp1_typewriter_linefeed(); + void pdp1_typewriter_drawchar(int character); + void pdp1_update_lightpen_state(const lightpen_t *new_state); + void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_); + void pdp1_erase_lightpen(bitmap_ind16 &bitmap); + void pdp1_draw_lightpen(bitmap_ind16 &bitmap); + int tape_read(UINT8 *reply); + void begin_tape_read(int binary, int nac); + void tape_write(UINT8 data); + void typewriter_out(UINT8 data); + void parallel_drum_set_il(int il); + void parallel_drum_init(); + UINT32 drum_read(int field, int position); + void drum_write(int field, int position, UINT32 data); + void pdp1_keyboard(); + void pdp1_lightpen(); + int read_spacewar() { return m_spacewar->read(); } + +private: + pdp1_reset_param_t m_reset_param; + int m_old_typewriter_keys[4]; + int m_old_lightpen; + int m_old_control_keys; + int m_old_tw_keys; + int m_old_ta_keys; + int m_typewriter_color; + bitmap_ind16 m_panel_bitmap; + bitmap_ind16 m_typewriter_bitmap; + lightpen_t m_lightpen_state; + lightpen_t m_previous_lightpen_state; + int m_pos; + int m_case_shift; + required_device m_gfxdecode; + required_device m_palette; + required_device m_crt; + required_ioport m_spacewar; + required_ioport m_csw; + required_ioport m_sense; + required_ioport m_tstadd; + required_ioport m_twdmsb; + required_ioport m_twdlsb; + required_ioport_array<4> m_twr; + required_ioport m_cfg; + required_ioport m_io_lightpen; + required_ioport m_lightx; + required_ioport m_lighty; +}; +#endif /* PDP1_H_ */ diff --git a/src/mame/includes/pecom.h b/src/mame/includes/pecom.h new file mode 100644 index 00000000000..0cbe6111337 --- /dev/null +++ b/src/mame/includes/pecom.h @@ -0,0 +1,76 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +#ifndef __PECOM__ +#define __PECOM__ + +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" + +#define SCREEN_TAG "screen" +#define CDP1802_TAG "cdp1802" +#define CDP1869_TAG "cdp1869" + +#define PECOM_CHAR_RAM_SIZE 0x800 + +class pecom_state : public driver_device +{ +public: + pecom_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cdp1802(*this, CDP1802_TAG), + m_cdp1869(*this, CDP1869_TAG), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_io_cnt(*this, "CNT") { } + + required_device m_cdp1802; + required_device m_cdp1869; + + UINT8 *m_charram; /* character generator ROM */ + int m_reset; /* CPU mode */ + int m_dma; /* memory refresh DMA */ + + /* timers */ + emu_timer *m_reset_timer; /* power on reset timer */ + + DECLARE_READ8_MEMBER(pecom_cdp1869_charram_r); + DECLARE_WRITE8_MEMBER(pecom_cdp1869_charram_w); + DECLARE_READ8_MEMBER(pecom_cdp1869_pageram_r); + DECLARE_WRITE8_MEMBER(pecom_cdp1869_pageram_w); + DECLARE_WRITE8_MEMBER(pecom_bank_w); + DECLARE_READ8_MEMBER(pecom_keyboard_r); + DECLARE_WRITE8_MEMBER(pecom_cdp1869_w); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_VIDEO_START(pecom); + DECLARE_INPUT_CHANGED_MEMBER(ef_w); + TIMER_CALLBACK_MEMBER(reset_tick); + DECLARE_READ_LINE_MEMBER(clear_r); + DECLARE_READ_LINE_MEMBER(ef2_r); + DECLARE_WRITE_LINE_MEMBER(q_w); + DECLARE_WRITE8_MEMBER( sc_w ); + DECLARE_WRITE_LINE_MEMBER(pecom_prd_w); + CDP1869_CHAR_RAM_READ_MEMBER(pecom_char_ram_r); + CDP1869_CHAR_RAM_WRITE_MEMBER(pecom_char_ram_w); + CDP1869_PCB_READ_MEMBER(pecom_pcb_r); +protected: + required_device m_cassette; + required_device m_ram; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_ioport m_io_cnt; + ioport_port *m_io_ports[26]; +}; + +/* ---------- defined in video/pecom.c ---------- */ + +MACHINE_CONFIG_EXTERN( pecom_video ); + +#endif diff --git a/src/mame/includes/pes.h b/src/mame/includes/pes.h new file mode 100644 index 00000000000..2130901cb3d --- /dev/null +++ b/src/mame/includes/pes.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/*************************************************************************** + + pes.h + +****************************************************************************/ + +#pragma once + +#ifndef _PES_H_ +#define _PES_H_ + +#include "machine/terminal.h" +#include "sound/tms5220.h" +#include "cpu/mcs51/mcs51.h" + +#define TERMINAL_TAG "terminal" + +class pes_state : public driver_device +{ +public: + pes_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_terminal(*this, TERMINAL_TAG), + m_speech(*this, "tms5220") + { + } + + required_device m_maincpu; + required_device m_terminal; + required_device m_speech; + + UINT8 m_wsstate; // /WS + UINT8 m_rsstate; // /RS + UINT8 m_port3_state; // Port3 state as last written + UINT8 m_infifo[32]; // input fifo + UINT8 m_infifo_tail_ptr; // " tail + UINT8 m_infifo_head_ptr; // " head + + virtual void machine_reset(); + DECLARE_WRITE8_MEMBER(rsws_w); + DECLARE_WRITE8_MEMBER(port1_w); + DECLARE_WRITE8_MEMBER(port3_w); + DECLARE_READ8_MEMBER(port1_r); + DECLARE_READ8_MEMBER(port3_r); + DECLARE_DRIVER_INIT(pes); + DECLARE_WRITE8_MEMBER(pes_kbd_input); + DECLARE_READ8_MEMBER(data_to_i8031); + DECLARE_WRITE8_MEMBER(data_from_i8031); +}; + + +#endif // _PES_H_ diff --git a/src/mame/includes/pet.h b/src/mame/includes/pet.h new file mode 100644 index 00000000000..d4572a99c05 --- /dev/null +++ b/src/mame/includes/pet.h @@ -0,0 +1,284 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __PET__ +#define __PET__ + +#include "emu.h" +#include "bus/ieee488/c8050.h" +#include "bus/ieee488/ieee488.h" +#include "bus/pet/cass.h" +#include "bus/pet/exp.h" +#include "bus/pet/user.h" +#include "cpu/m6502/m6502.h" +#include "machine/6522via.h" +#include "machine/6821pia.h" +#include "imagedev/snapquik.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/speaker.h" +#include "video/mc6845.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define M6502_TAG "f3" +#define M6522_TAG "a5" +#define M6520_1_TAG "g8" +#define M6520_2_TAG "b8" +#define MC6845_TAG "ub13" +#define SCREEN_TAG "screen" +#define PLA1_TAG "ue6" +#define PLA2_TAG "ue5" +#define PET_USER_PORT_TAG "user" + +class pet_state : public driver_device +{ +public: + pet_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6502_TAG), + m_via(*this, M6522_TAG), + m_pia1(*this, M6520_1_TAG), + m_pia2(*this, M6520_2_TAG), + m_crtc(*this, MC6845_TAG), + m_ieee(*this, IEEE488_TAG), + m_palette(*this, "palette"), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_cassette2(*this, PET_DATASSETTE_PORT2_TAG), + m_exp(*this, PET_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_speaker(*this, "speaker"), + m_cart_9000(*this, "cart_9000"), + m_cart_a000(*this, "cart_a000"), + m_cart_b000(*this, "cart_b000"), + m_ram(*this, RAM_TAG), + m_rom(*this, M6502_TAG), + m_char_rom(*this, "charom"), + m_video_ram(*this, "video_ram"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_row8(*this, "ROW8"), + m_row9(*this, "ROW9"), + m_lock(*this, "LOCK"), + m_key(0), + m_sync(0), + m_graphic(0), + m_blanktv(0), + m_via_irq(CLEAR_LINE), + m_pia1a_irq(CLEAR_LINE), + m_pia1b_irq(CLEAR_LINE), + m_pia2a_irq(CLEAR_LINE), + m_pia2b_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE), + m_user_diag(1) + { } + + required_device m_maincpu; + required_device m_via; + required_device m_pia1; + required_device m_pia2; + optional_device m_crtc; + required_device m_ieee; + required_device m_palette; + required_device m_cassette; + required_device m_cassette2; + required_device m_exp; + required_device m_user; + optional_device m_speaker; + optional_device m_cart_9000; + optional_device m_cart_a000; + optional_device m_cart_b000; + required_device m_ram; + required_memory_region m_rom; + required_memory_region m_char_rom; + optional_shared_ptr m_video_ram; + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + required_ioport m_row3; + required_ioport m_row4; + required_ioport m_row5; + required_ioport m_row6; + required_ioport m_row7; + required_ioport m_row8; + required_ioport m_row9; + required_ioport m_lock; + + DECLARE_MACHINE_START( pet ); + DECLARE_MACHINE_START( pet2001 ); + DECLARE_MACHINE_RESET( pet ); + DECLARE_MACHINE_START( pet40 ); + DECLARE_MACHINE_RESET( pet40 ); + + MC6845_BEGIN_UPDATE( pet_begin_update ); + MC6845_UPDATE_ROW( pet40_update_row ); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void check_interrupts(); + void update_speaker(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE_LINE_MEMBER( via_irq_w ); + DECLARE_WRITE8_MEMBER( via_pa_w ); + DECLARE_READ8_MEMBER( via_pb_r ); + DECLARE_WRITE8_MEMBER( via_pb_w ); + DECLARE_WRITE_LINE_MEMBER( via_ca2_w ); + DECLARE_WRITE_LINE_MEMBER( via_cb2_w ); + + DECLARE_WRITE_LINE_MEMBER( pia1_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( pia1_irqb_w ); + DECLARE_READ8_MEMBER( pia1_pa_r ); + DECLARE_READ8_MEMBER( pia1_pb_r ); + DECLARE_WRITE8_MEMBER( pia1_pa_w ); + DECLARE_WRITE_LINE_MEMBER( pia1_ca2_w ); + + DECLARE_WRITE_LINE_MEMBER( pia2_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( pia2_irqb_w ); + + DECLARE_WRITE_LINE_MEMBER( user_diag_w ); + + TIMER_DEVICE_CALLBACK_MEMBER( sync_tick ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_pet ); + + enum + { + SEL0 = 0, + SEL1, + SEL2, + SEL3, + SEL4, + SEL5, + SEL6, + SEL7, + SEL8, + SEL9, + SELA, + SELB, + SELC, + SELD, + SELE, + SELF + }; + + // keyboard state + UINT8 m_key; + + // video state + int m_sync; + int m_graphic; + int m_blanktv; + int m_video_ram_size; + + // sound state + int m_via_cb2; + int m_pia1_pa7; + + UINT8 m_via_pa; + + // interrupt state + int m_via_irq; + int m_pia1a_irq; + int m_pia1b_irq; + int m_pia2a_irq; + int m_pia2b_irq; + int m_exp_irq; + int m_user_diag; +}; + + +class pet2001b_state : public pet_state +{ +public: + pet2001b_state(const machine_config &mconfig, device_type type, const char *tag) : + pet_state(mconfig, type, tag) + { } + + DECLARE_READ8_MEMBER( pia1_pb_r ); +}; + + +class pet80_state : public pet2001b_state +{ +public: + pet80_state(const machine_config &mconfig, device_type type, const char *tag) : + pet2001b_state(mconfig, type, tag) + { } + + DECLARE_MACHINE_START( pet80 ); + DECLARE_MACHINE_RESET( pet80 ); + + MC6845_UPDATE_ROW( pet80_update_row ); + MC6845_UPDATE_ROW( cbm8296_update_row ); +}; + + +class superpet_state : public pet80_state +{ +public: + superpet_state(const machine_config &mconfig, device_type type, const char *tag) + : pet80_state(mconfig, type, tag) + { } +}; + + +class cbm8096_state : public pet80_state +{ +public: + cbm8096_state(const machine_config &mconfig, device_type type, const char *tag) : + pet80_state(mconfig, type, tag) + { } +}; + + +class cbm8296_state : public pet80_state +{ +public: + cbm8296_state(const machine_config &mconfig, device_type type, const char *tag) : + pet80_state(mconfig, type, tag), + m_basic_rom(*this, "basic"), + m_editor_rom(*this, "editor"), + m_ue5_rom(*this, "ue5_eprom"), + m_ue6_rom(*this, "ue6_eprom"), + m_pla1(*this, PLA1_TAG), + m_pla2(*this, PLA2_TAG) + { } + + required_memory_region m_basic_rom; + required_memory_region m_editor_rom; + required_memory_region m_ue5_rom; + required_memory_region m_ue6_rom; + required_device m_pla1; + required_device m_pla2; + + DECLARE_MACHINE_START( cbm8296 ); + DECLARE_MACHINE_RESET( cbm8296 ); + + void read_pla1(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, + int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1); + void read_pla2(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15); + + void read_pla1_eprom(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, + int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1); + void read_pla2_eprom(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + UINT8 m_cr; +}; + + + +#endif diff --git a/src/mame/includes/phc25.h b/src/mame/includes/phc25.h new file mode 100644 index 00000000000..482a543b83b --- /dev/null +++ b/src/mame/includes/phc25.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Robbbert +#pragma once + +#ifndef __PHC25__ +#define __PHC25__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "machine/ram.h" +#include "bus/centronics/ctronics.h" +#include "video/mc6847.h" +#include "sound/ay8910.h" +#include "formats/phc25_cas.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "z80" +#define AY8910_TAG "ay8910" +#define MC6847_TAG "mc6847" +#define CENTRONICS_TAG "centronics" + +#define PHC25_VIDEORAM_SIZE 0x1800 + +class phc25_state : public driver_device +{ +public: + phc25_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_video_ram(*this, "video_ram") + , m_maincpu(*this, Z80_TAG) + , m_vdg(*this, MC6847_TAG) + , m_centronics(*this, CENTRONICS_TAG) + , m_cassette(*this, "cassette") + { } + + DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); + DECLARE_READ8_MEMBER( port40_r ); + DECLARE_WRITE8_MEMBER( port40_w ); + DECLARE_WRITE_LINE_MEMBER(irq_w); + DECLARE_READ8_MEMBER( video_ram_r ); + MC6847_GET_CHARROM_MEMBER(ntsc_char_rom_r); + MC6847_GET_CHARROM_MEMBER(pal_char_rom_r); + +private: + virtual void video_start(); + UINT8 *m_char_rom; + UINT8 m_port40; + required_shared_ptr m_video_ram; + required_device m_maincpu; + required_device m_vdg; + required_device m_centronics; + required_device m_cassette; + int m_centronics_busy; +}; + +#endif diff --git a/src/mame/includes/pk8020.h b/src/mame/includes/pk8020.h new file mode 100644 index 00000000000..e73fa870187 --- /dev/null +++ b/src/mame/includes/pk8020.h @@ -0,0 +1,108 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/pk8020.h + * + ****************************************************************************/ + +#ifndef PK8020_H_ +#define PK8020_H_ + +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/i8251.h" +#include "machine/wd_fdc.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "machine/ram.h" + + +class pk8020_state : public driver_device +{ +public: + pk8020_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ppi8255_1(*this, "ppi8255_1"), + m_ppi8255_2(*this, "ppi8255_2"), + m_ppi8255_3(*this, "ppi8255_3"), + m_rs232(*this, "rs232"), + m_lan(*this, "lan"), + m_ram(*this, RAM_TAG), + m_wd1793(*this, "wd1793"), + m_floppy0(*this, "wd1793:0"), + m_floppy1(*this, "wd1793:1"), + m_floppy2(*this, "wd1793:2"), + m_floppy3(*this, "wd1793:3"), + m_pit8253(*this, "pit8253"), + m_pic8259(*this, "pic8259"), + m_speaker(*this, "speaker"), + m_region_maincpu(*this, "maincpu"), + m_region_gfx1(*this, "gfx1"), + m_palette(*this, "palette") { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + UINT8 m_color; + UINT8 m_video_page; + UINT8 m_wide; + UINT8 m_font; + UINT8 m_attr; + UINT8 m_text_attr; + UINT8 m_takt; + UINT8 m_video_page_access; + UINT8 m_portc_data; + UINT8 m_sound_gate; + UINT8 m_sound_level; + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_READ8_MEMBER(sysreg_r); + DECLARE_WRITE8_MEMBER(sysreg_w); + DECLARE_READ8_MEMBER(text_r); + DECLARE_WRITE8_MEMBER(text_w); + DECLARE_READ8_MEMBER(gzu_r); + DECLARE_WRITE8_MEMBER(gzu_w); + DECLARE_READ8_MEMBER(devices_r); + DECLARE_WRITE8_MEMBER(devices_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(pk8020); + UINT32 screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(pk8020_interrupt); + DECLARE_READ8_MEMBER(pk8020_porta_r); + DECLARE_WRITE8_MEMBER(pk8020_portc_w); + DECLARE_WRITE8_MEMBER(pk8020_portb_w); + DECLARE_READ8_MEMBER(pk8020_portc_r); + DECLARE_WRITE8_MEMBER(pk8020_2_portc_w); + DECLARE_WRITE_LINE_MEMBER(pk8020_pit_out0); + DECLARE_WRITE_LINE_MEMBER(pk8020_pit_out1); + DECLARE_WRITE_LINE_MEMBER(pk8020_pic_set_int_line); + IRQ_CALLBACK_MEMBER(pk8020_irq_callback); + +protected: + required_device m_maincpu; + required_device m_ppi8255_1; + required_device m_ppi8255_2; + required_device m_ppi8255_3; + required_device m_rs232; + required_device m_lan; + required_device m_ram; + required_device m_wd1793; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_device m_pit8253; + required_device m_pic8259; + required_device m_speaker; + required_memory_region m_region_maincpu; + required_memory_region m_region_gfx1; + ioport_port *m_io_port[16]; + required_device m_palette; + void pk8020_set_bank(UINT8 data); +}; + +#endif /* pk8020_H_ */ diff --git a/src/mame/includes/plus4.h b/src/mame/includes/plus4.h new file mode 100644 index 00000000000..adadf6e19ec --- /dev/null +++ b/src/mame/includes/plus4.h @@ -0,0 +1,176 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __PLUS4__ +#define __PLUS4__ + +#include "emu.h" +#include "bus/cbmiec/cbmiec.h" +#include "bus/pet/cass.h" +#include "bus/plus4/exp.h" +#include "bus/plus4/user.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m7501.h" +#include "imagedev/snapquik.h" +#include "machine/mos6529.h" +#include "machine/mos6551.h" +#include "machine/mos8706.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/mos7360.h" + +#define MOS7501_TAG "u2" +#define MOS7360_TAG "u1" +#define MOS6551_TAG "u3" +#define MOS6529_USER_TAG "u5" +#define MOS6529_KB_TAG "u27" +#define T6721A_TAG "t6721a" +#define MOS8706_TAG "mos8706" +#define PLA_TAG "u19" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" +#define PET_USER_PORT_TAG "user" + +class plus4_state : public driver_device +{ +public: + plus4_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, MOS7501_TAG), + m_pla(*this, PLA_TAG), + m_ted(*this, MOS7360_TAG), + m_acia(*this, MOS6551_TAG), + m_spi_user(*this, MOS6529_USER_TAG), + m_spi_kb(*this, MOS6529_KB_TAG), + m_vslsi(*this, MOS8706_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, PLUS4_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_kernal(*this, "kernal"), + m_function(*this, "function"), + m_c2(*this, "c2"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_lock(*this, "LOCK"), + m_addr(0), + m_ted_irq(CLEAR_LINE), + m_acia_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE) + { } + + required_device m_maincpu; + required_device m_pla; + required_device m_ted; + optional_device m_acia; + optional_device m_spi_user; + required_device m_spi_kb; + optional_device m_vslsi; + required_device m_iec; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + optional_device m_user; + required_device m_ram; + required_device m_cassette; + required_memory_region m_kernal; + optional_memory_region m_function; + optional_memory_region m_c2; + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + required_ioport m_row3; + required_ioport m_row4; + required_ioport m_row5; + required_ioport m_row6; + required_ioport m_row7; + required_ioport m_lock; + + virtual void machine_start(); + virtual void machine_reset(); + + void check_interrupts(); + void bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal); + UINT8 read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal); + UINT8 read_keyboard(UINT8 databus); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( ted_videoram_r ); + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_WRITE_LINE_MEMBER( ted_irq_w ); + DECLARE_READ8_MEMBER( ted_ram_r ); + DECLARE_READ8_MEMBER( ted_rom_r ); + DECLARE_READ8_MEMBER( ted_k_r ); + + DECLARE_WRITE_LINE_MEMBER( write_kb0 ) { if (state) m_kb |= 1; else m_kb &= ~1; } + DECLARE_WRITE_LINE_MEMBER( write_kb1 ) { if (state) m_kb |= 2; else m_kb &= ~2; } + DECLARE_WRITE_LINE_MEMBER( write_kb2 ) { if (state) m_kb |= 4; else m_kb &= ~4; } + DECLARE_WRITE_LINE_MEMBER( write_kb3 ) { if (state) m_kb |= 8; else m_kb &= ~8; } + DECLARE_WRITE_LINE_MEMBER( write_kb4 ) { if (state) m_kb |= 16; else m_kb &= ~16; } + DECLARE_WRITE_LINE_MEMBER( write_kb5 ) { if (state) m_kb |= 32; else m_kb &= ~32; } + DECLARE_WRITE_LINE_MEMBER( write_kb6 ) { if (state) m_kb |= 64; else m_kb &= ~64; } + DECLARE_WRITE_LINE_MEMBER( write_kb7 ) { if (state) m_kb |= 128; else m_kb &= ~128; } + + DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); + + DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c16 ); + + enum + { + CS0_BASIC = 0, + CS0_FUNCTION_LO, + CS0_C1_LOW, + CS0_C2_LOW + }; + + enum + { + CS1_KERNAL = 0, + CS1_FUNCTION_HI, + CS1_C1_HIGH, + CS1_C2_HIGH + }; + + // memory state + UINT8 m_addr; + + // interrupt state + int m_ted_irq; + int m_acia_irq; + int m_exp_irq; + + // keyboard state + UINT8 m_kb; +}; + + +class c16_state : public plus4_state +{ +public: + c16_state(const machine_config &mconfig, device_type type, const char *tag) + : plus4_state(mconfig, type, tag) + { } + + DECLARE_READ8_MEMBER( cpu_r ); +}; + + + +#endif diff --git a/src/mame/includes/pmd85.h b/src/mame/includes/pmd85.h new file mode 100644 index 00000000000..07d9986994b --- /dev/null +++ b/src/mame/includes/pmd85.h @@ -0,0 +1,155 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/***************************************************************************** + * + * includes/pmd85.h + * + ****************************************************************************/ + +#ifndef PMD85_H_ +#define PMD85_H_ + +#include "machine/i8251.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" + + +class pmd85_state : public driver_device +{ +public: + enum + { + TIMER_CASSETTE + }; + + pmd85_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_cassette(*this, "cassette"), + m_pit8253(*this, "pit8253"), + m_uart(*this, "uart"), + m_ppi8255_0(*this, "ppi8255_0"), + m_ppi8255_1(*this, "ppi8255_1"), + m_ppi8255_2(*this, "ppi8255_2"), + m_ppi8255_3(*this, "ppi8255_3"), + m_region_maincpu(*this, "maincpu"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_bank5(*this, "bank5"), + m_bank6(*this, "bank6"), + m_bank7(*this, "bank7"), + m_bank8(*this, "bank8"), + m_bank9(*this, "bank9"), + m_bank10(*this, "bank10"), + m_bank11(*this, "bank11"), + m_bank12(*this, "bank12"), + m_bank13(*this, "bank13"), + m_bank14(*this, "bank14"), + m_bank15(*this, "bank15"), + m_bank16(*this, "bank16"), + m_io_dsw0(*this, "DSW0"), + m_palette(*this, "palette") { } + + UINT8 m_rom_module_present; + UINT8 m_ppi_port_outputs[4][3]; + UINT8 m_startup_mem_map; + UINT8 m_pmd853_memory_mapping; + int m_previous_level; + int m_clk_level; + int m_clk_level_tape; + UINT8 m_model; + emu_timer * m_cassette_timer; + void (pmd85_state::*update_memory)(); + DECLARE_READ8_MEMBER(pmd85_io_r); + DECLARE_WRITE8_MEMBER(pmd85_io_w); + DECLARE_READ8_MEMBER(mato_io_r); + DECLARE_WRITE8_MEMBER(mato_io_w); + DECLARE_DRIVER_INIT(mato); + DECLARE_DRIVER_INIT(pmd852a); + DECLARE_DRIVER_INIT(pmd851); + DECLARE_DRIVER_INIT(pmd853); + DECLARE_DRIVER_INIT(alfa); + DECLARE_DRIVER_INIT(c2717); + virtual void machine_reset(); + UINT32 screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback); + DECLARE_WRITE_LINE_MEMBER(write_cas_tx); + DECLARE_READ8_MEMBER(pmd85_ppi_0_porta_r); + DECLARE_READ8_MEMBER(pmd85_ppi_0_portb_r); + DECLARE_READ8_MEMBER(pmd85_ppi_0_portc_r); + DECLARE_WRITE8_MEMBER(pmd85_ppi_0_porta_w); + DECLARE_WRITE8_MEMBER(pmd85_ppi_0_portb_w); + DECLARE_WRITE8_MEMBER(pmd85_ppi_0_portc_w); + DECLARE_READ8_MEMBER(mato_ppi_0_portb_r); + DECLARE_READ8_MEMBER(mato_ppi_0_portc_r); + DECLARE_WRITE8_MEMBER(mato_ppi_0_portc_w); + DECLARE_READ8_MEMBER(pmd85_ppi_1_porta_r); + DECLARE_READ8_MEMBER(pmd85_ppi_1_portb_r); + DECLARE_READ8_MEMBER(pmd85_ppi_1_portc_r); + DECLARE_WRITE8_MEMBER(pmd85_ppi_1_porta_w); + DECLARE_WRITE8_MEMBER(pmd85_ppi_1_portb_w); + DECLARE_WRITE8_MEMBER(pmd85_ppi_1_portc_w); + DECLARE_READ8_MEMBER(pmd85_ppi_2_porta_r); + DECLARE_READ8_MEMBER(pmd85_ppi_2_portb_r); + DECLARE_READ8_MEMBER(pmd85_ppi_2_portc_r); + DECLARE_WRITE8_MEMBER(pmd85_ppi_2_porta_w); + DECLARE_WRITE8_MEMBER(pmd85_ppi_2_portb_w); + DECLARE_WRITE8_MEMBER(pmd85_ppi_2_portc_w); + DECLARE_READ8_MEMBER(pmd85_ppi_3_porta_r); + DECLARE_READ8_MEMBER(pmd85_ppi_3_portb_r); + DECLARE_READ8_MEMBER(pmd85_ppi_3_portc_r); + DECLARE_WRITE8_MEMBER(pmd85_ppi_3_porta_w); + DECLARE_WRITE8_MEMBER(pmd85_ppi_3_portb_w); + DECLARE_WRITE8_MEMBER(pmd85_ppi_3_portc_w); + DECLARE_INPUT_CHANGED_MEMBER(pmd85_reset); + +protected: + required_device m_maincpu; + required_device m_ram; + required_device m_cassette; + required_device m_pit8253; + optional_device m_uart; + optional_device m_ppi8255_0; + optional_device m_ppi8255_1; + optional_device m_ppi8255_2; + optional_device m_ppi8255_3; + required_memory_region m_region_maincpu; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + optional_memory_bank m_bank5; + optional_memory_bank m_bank6; + optional_memory_bank m_bank7; + optional_memory_bank m_bank8; + optional_memory_bank m_bank9; + optional_memory_bank m_bank10; + optional_memory_bank m_bank11; + optional_memory_bank m_bank12; + optional_memory_bank m_bank13; + optional_memory_bank m_bank14; + optional_memory_bank m_bank15; + optional_memory_bank m_bank16; + optional_ioport m_io_dsw0; + ioport_port *m_io_port[16]; + required_device m_palette; + + void pmd851_update_memory(); + void pmd852a_update_memory(); + void pmd853_update_memory(); + void alfa_update_memory(); + void mato_update_memory(); + void c2717_update_memory(); + void pmd85_common_driver_init(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + int m_cas_tx; +}; + + +#endif /* PMD85_H_ */ diff --git a/src/mame/includes/pocketc.h b/src/mame/includes/pocketc.h new file mode 100644 index 00000000000..5edc361dc70 --- /dev/null +++ b/src/mame/includes/pocketc.h @@ -0,0 +1,26 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/pocketc.h + * + ****************************************************************************/ + +#ifndef POCKETC_H_ +#define POCKETC_H_ + +typedef const char *POCKETC_FIGURE[]; + +class pocketc_state : public driver_device +{ +public: + pocketc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) { } + + DECLARE_PALETTE_INIT(pocketc); + + static const unsigned short pocketc_colortable[8][2]; + void pocketc_draw_special(bitmap_ind16 &bitmap,int x, int y, const POCKETC_FIGURE fig, int color); +}; + +#endif /* POCKETC_H_ */ diff --git a/src/mame/includes/poisk1.h b/src/mame/includes/poisk1.h new file mode 100644 index 00000000000..023b4d5afd9 --- /dev/null +++ b/src/mame/includes/poisk1.h @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/***************************************************************************** + * + * includes/poisk1.h + * + ****************************************************************************/ + +#ifndef POISK1_H_ +#define POISK1_H_ + +#include "imagedev/cassette.h" +#include "machine/i8255.h" +#include "bus/isa/isa.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/ram.h" +#include "bus/isa/xsu_cards.h" +#include "sound/speaker.h" + +#define POISK1_UPDATE_ROW(name) \ + void name(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 *videoram, UINT16 ma, UINT8 ra, UINT8 stride) + +class p1_state : public driver_device +{ +public: + p1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pic8259(*this, "pic8259"), + m_pit8253(*this, "pit8253"), + m_ppi8255n1(*this, "ppi8255n1"), + m_ppi8255n2(*this, "ppi8255n2"), + m_isabus(*this, "isa"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette") { } + + required_device m_maincpu; + required_device m_pic8259; + required_device m_pit8253; + required_device m_ppi8255n1; + required_device m_ppi8255n2; + required_device m_isabus; + required_device m_speaker; + required_device m_cassette; + required_device m_ram; + + DECLARE_DRIVER_INIT(poisk1); + DECLARE_MACHINE_START(poisk1); + DECLARE_MACHINE_RESET(poisk1); + + DECLARE_PALETTE_INIT(p1); + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void set_palette_luts(); + POISK1_UPDATE_ROW(cga_gfx_2bpp_update_row); + POISK1_UPDATE_ROW(cga_gfx_1bpp_update_row); + POISK1_UPDATE_ROW(poisk1_gfx_1bpp_update_row); + + DECLARE_WRITE_LINE_MEMBER(p1_pit8253_out2_changed); + DECLARE_WRITE_LINE_MEMBER(p1_speaker_set_spkrdata); + UINT8 m_p1_spkrdata; + UINT8 m_p1_input; + + UINT8 m_kbpoll_mask; + + struct + { + UINT8 trap[4]; + UINT8 *videoram_base; + UINT8 *videoram; + UINT8 mode_control_6a; + UINT8 color_select_68; + UINT8 palette_lut_2bpp[4]; + int stride; + void *update_row(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 *videoram, UINT16 ma, UINT8 ra, UINT8 stride); + } m_video; + + DECLARE_READ8_MEMBER(p1_trap_r); + DECLARE_WRITE8_MEMBER(p1_trap_w); + DECLARE_READ8_MEMBER(p1_cga_r); + DECLARE_WRITE8_MEMBER(p1_cga_w); + DECLARE_WRITE8_MEMBER(p1_vram_w); + + DECLARE_READ8_MEMBER(p1_ppi_r); + DECLARE_WRITE8_MEMBER(p1_ppi_w); + DECLARE_WRITE8_MEMBER(p1_ppi_porta_w); + DECLARE_READ8_MEMBER(p1_ppi_porta_r); + DECLARE_READ8_MEMBER(p1_ppi_portb_r); + DECLARE_READ8_MEMBER(p1_ppi_portc_r); + DECLARE_WRITE8_MEMBER(p1_ppi_portc_w); + DECLARE_WRITE8_MEMBER(p1_ppi2_porta_w); + DECLARE_WRITE8_MEMBER(p1_ppi2_portb_w); + DECLARE_READ8_MEMBER(p1_ppi2_portc_r); + required_device m_palette; + const char *m_cputag; +}; + +#endif /* POISK1_H_ */ diff --git a/src/mame/includes/poly88.h b/src/mame/includes/poly88.h new file mode 100644 index 00000000000..1cdc53463b6 --- /dev/null +++ b/src/mame/includes/poly88.h @@ -0,0 +1,85 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/poly88.h + * + ****************************************************************************/ + +#ifndef POLY88_H_ +#define POLY88_H_ + +#include "machine/i8251.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" + +class poly88_state : public driver_device +{ +public: + enum + { + TIMER_USART, + TIMER_KEYBOARD, + TIMER_CASSETTE + }; + + poly88_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_video_ram(*this, "video_ram"), + m_maincpu(*this, "maincpu"), + m_uart(*this, "uart"), + m_cassette(*this, "cassette"), + m_linec(*this, "LINEC"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1"), + m_line2(*this, "LINE2"), + m_line3(*this, "LINE3"), + m_line4(*this, "LINE4"), + m_line5(*this, "LINE5"), + m_line6(*this, "LINE6") { } + + required_shared_ptr m_video_ram; + UINT8 *m_FNT; + UINT8 m_intr; + UINT8 m_last_code; + UINT8 m_int_vector; + emu_timer * m_cassette_timer; + emu_timer * m_usart_timer; + int m_previous_level; + int m_clk_level; + int m_clk_level_tape; + DECLARE_WRITE8_MEMBER(poly88_baud_rate_w); + DECLARE_READ8_MEMBER(poly88_keyboard_r); + DECLARE_WRITE8_MEMBER(poly88_intr_w); + DECLARE_DRIVER_INIT(poly88); + virtual void machine_reset(); + virtual void video_start(); + UINT32 screen_update_poly88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(poly88_interrupt); + TIMER_CALLBACK_MEMBER(poly88_usart_timer_callback); + TIMER_CALLBACK_MEMBER(keyboard_callback); + TIMER_CALLBACK_MEMBER(poly88_cassette_timer_callback); + DECLARE_WRITE_LINE_MEMBER(write_cas_tx); + DECLARE_WRITE_LINE_MEMBER(poly88_usart_rxready); + IRQ_CALLBACK_MEMBER(poly88_irq_callback); + DECLARE_SNAPSHOT_LOAD_MEMBER( poly88 ); + +protected: + required_device m_maincpu; + required_device m_uart; + required_device m_cassette; + required_ioport m_linec; + required_ioport m_line0; + required_ioport m_line1; + required_ioport m_line2; + required_ioport m_line3; + required_ioport m_line4; + required_ioport m_line5; + required_ioport m_line6; + UINT8 row_number(UINT8 code); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + int m_cas_tx; +}; + +#endif /* POLY88_H_ */ diff --git a/src/mame/includes/poly880.h b/src/mame/includes/poly880.h new file mode 100644 index 00000000000..b92ed0a92f4 --- /dev/null +++ b/src/mame/includes/poly880.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __POLY880__ +#define __POLY880__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "imagedev/cassette.h" +#include "machine/z80pio.h" +#include "machine/z80ctc.h" +#include "machine/ram.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "i1" +#define Z80CTC_TAG "i4" +#define Z80PIO1_TAG "i2" +#define Z80PIO2_TAG "i3" + +class poly880_state : public driver_device +{ +public: + poly880_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_cassette(*this, "cassette"), + m_ki1(*this, "KI1"), + m_ki2(*this, "KI2"), + m_ki3(*this, "KI3") + { } + + required_device m_maincpu; + required_device m_cassette; + required_ioport m_ki1; + required_ioport m_ki2; + required_ioport m_ki3; + + virtual void machine_start(); + + DECLARE_WRITE8_MEMBER( cldig_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); + DECLARE_WRITE8_MEMBER( pio1_pa_w ); + DECLARE_READ8_MEMBER( pio1_pb_r ); + DECLARE_WRITE8_MEMBER( pio1_pb_w ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); + + void update_display(); + + /* display state */ + UINT8 m_digit; + UINT8 m_segment; +}; + +#endif diff --git a/src/mame/includes/portfoli.h b/src/mame/includes/portfoli.h new file mode 100644 index 00000000000..e02a206f0e4 --- /dev/null +++ b/src/mame/includes/portfoli.h @@ -0,0 +1,123 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __PORTFOLIO__ +#define __PORTFOLIO__ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8255.h" +#include "machine/ins8250.h" +#include "machine/nvram.h" +#include "machine/ram.h" +#include "sound/speaker.h" +#include "video/hd61830.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define M80C88A_TAG "u1" +#define M82C55A_TAG "hpc101_u1" +#define M82C50A_TAG "hpc102_u1" +#define HD61830_TAG "hd61830" +#define CENTRONICS_TAG "centronics" +#define TIMER_TICK_TAG "tick" +#define SCREEN_TAG "screen" +#define RS232_TAG "rs232" + +class portfolio_state : public driver_device +{ +public: + portfolio_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M80C88A_TAG), + m_lcdc(*this, HD61830_TAG), + m_ppi(*this, M82C55A_TAG), + m_uart(*this, M82C50A_TAG), + m_speaker(*this, "speaker"), + m_timer_tick(*this, TIMER_TICK_TAG), + m_rom(*this, M80C88A_TAG), + m_char_rom(*this, HD61830_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_battery(*this, "BATTERY"), + m_contrast(*this, "contrast"), + m_ram(*this, RAM_TAG) + { } + + required_device m_maincpu; + required_device m_lcdc; + required_device m_ppi; + required_device m_uart; + required_device m_speaker; + required_device m_timer_tick; + required_region_ptr m_rom; + required_region_ptr m_char_rom; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_battery; + + virtual void machine_start(); + virtual void machine_reset(); + + void check_interrupt(); + void trigger_interrupt(int level); + void scan_keyboard(); + + DECLARE_READ8_MEMBER( irq_status_r ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_READ8_MEMBER( battery_r ); + DECLARE_READ8_MEMBER( counter_r ); + DECLARE_READ8_MEMBER( pid_r ); + + DECLARE_WRITE8_MEMBER( irq_mask_w ); + DECLARE_WRITE8_MEMBER( sivr_w ); + DECLARE_WRITE8_MEMBER( speaker_w ); + DECLARE_WRITE8_MEMBER( power_w ); + DECLARE_WRITE8_MEMBER( unknown_w ); + DECLARE_WRITE8_MEMBER( counter_w ); + DECLARE_WRITE8_MEMBER( ncc1_w ); + + DECLARE_WRITE_LINE_MEMBER( i8250_intrpt_w ); + + /* interrupt state */ + UINT8 m_ip; /* interrupt pending */ + UINT8 m_ie; /* interrupt enable */ + UINT8 m_sivr; /* serial interrupt vector register */ + + /* counter state */ + UINT16 m_counter; + + /* keyboard state */ + UINT8 m_keylatch; + + /* video state */ + required_shared_ptr m_contrast; + + /* peripheral state */ + UINT8 m_pid; /* peripheral identification */ + DECLARE_PALETTE_INIT(portfolio); + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick); + TIMER_DEVICE_CALLBACK_MEMBER(system_tick); + TIMER_DEVICE_CALLBACK_MEMBER(counter_tick); + DECLARE_READ8_MEMBER(hd61830_rd_r); + IRQ_CALLBACK_MEMBER(portfolio_int_ack); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( portfolio_cart ); + required_device m_ram; +}; + +#endif diff --git a/src/mame/includes/pp01.h b/src/mame/includes/pp01.h new file mode 100644 index 00000000000..d405563bcdc --- /dev/null +++ b/src/mame/includes/pp01.h @@ -0,0 +1,66 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/pp01.h + * + ****************************************************************************/ + +#ifndef PP01_H_ +#define PP01_H_ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/ram.h" +#include "machine/i8251.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "sound/speaker.h" +//#include "sound/wave.h" +//#include "imagedev/cassette.h" + +class pp01_state : public driver_device +{ +public: + pp01_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pit(*this, "pit8253"), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG) { } + + required_device m_maincpu; + required_device m_pit; + required_device m_speaker; + required_device m_ram; + UINT8 m_video_scroll; + UINT8 m_memory_block[16]; + UINT8 m_video_write_mode; + UINT8 m_key_line; + DECLARE_WRITE8_MEMBER(pp01_video_write_mode_w); + DECLARE_WRITE8_MEMBER(pp01_video_r_1_w); + DECLARE_WRITE8_MEMBER(pp01_video_g_1_w); + DECLARE_WRITE8_MEMBER(pp01_video_b_1_w); + DECLARE_WRITE8_MEMBER(pp01_video_r_2_w); + DECLARE_WRITE8_MEMBER(pp01_video_g_2_w); + DECLARE_WRITE8_MEMBER(pp01_video_b_2_w); + DECLARE_WRITE8_MEMBER(pp01_mem_block_w); + DECLARE_READ8_MEMBER(pp01_mem_block_r); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(pp01); + UINT32 screen_update_pp01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(pp01_pit_out0); + DECLARE_WRITE_LINE_MEMBER(pp01_pit_out1); + DECLARE_READ8_MEMBER(pp01_8255_porta_r); + DECLARE_WRITE8_MEMBER(pp01_8255_porta_w); + DECLARE_READ8_MEMBER(pp01_8255_portb_r); + DECLARE_WRITE8_MEMBER(pp01_8255_portb_w); + DECLARE_WRITE8_MEMBER(pp01_8255_portc_w); + DECLARE_READ8_MEMBER(pp01_8255_portc_r); + void pp01_video_w(UINT8 block,UINT16 offset,UINT8 data,UINT8 part); + void pp01_set_memory(UINT8 block, UINT8 data); +}; + +#endif diff --git a/src/mame/includes/primo.h b/src/mame/includes/primo.h new file mode 100644 index 00000000000..ef58558bc7f --- /dev/null +++ b/src/mame/includes/primo.h @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/***************************************************************************** + * + * includes/primo.h + * + ****************************************************************************/ + +#ifndef PRIMO_H_ +#define PRIMO_H_ + +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "bus/cbmiec/cbmiec.h" +#include "sound/speaker.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +class primo_state : public driver_device +{ +public: + primo_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_iec(*this, CBM_IEC_TAG), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_cart1(*this, "cartslot1"), + m_cart2(*this, "cartslot2") + { } + + required_device m_maincpu; + required_device m_iec; + required_device m_speaker; + required_device m_cassette; + required_device m_cart1; + required_device m_cart2; + + memory_region *m_cart1_rom; + memory_region *m_cart2_rom; + + UINT16 m_video_memory_base; + UINT8 m_port_FD; + int m_nmi; + DECLARE_READ8_MEMBER(primo_be_1_r); + DECLARE_READ8_MEMBER(primo_be_2_r); + DECLARE_WRITE8_MEMBER(primo_ki_1_w); + DECLARE_WRITE8_MEMBER(primo_ki_2_w); + DECLARE_WRITE8_MEMBER(primo_FD_w); + DECLARE_DRIVER_INIT(primo48); + DECLARE_DRIVER_INIT(primo64); + DECLARE_DRIVER_INIT(primo32); + virtual void machine_reset(); + virtual void machine_start(); + DECLARE_MACHINE_RESET(primob); + UINT32 screen_update_primo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(primo_vblank_interrupt); + void primo_draw_scanline(bitmap_ind16 &bitmap, int primo_scanline); + void primo_update_memory(); + void primo_common_driver_init (primo_state *state); + void primo_common_machine_init (); + void primo_setup_pss (UINT8* snapshot_data, UINT32 snapshot_size); + void primo_setup_pp (UINT8* quickload_data, UINT32 quickload_size); + DECLARE_SNAPSHOT_LOAD_MEMBER( primo ); + DECLARE_QUICKLOAD_LOAD_MEMBER( primo ); +}; + + +#endif /* PRIMO_H_ */ diff --git a/src/mame/includes/prof180x.h b/src/mame/includes/prof180x.h new file mode 100644 index 00000000000..0c38e6d183f --- /dev/null +++ b/src/mame/includes/prof180x.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __PROF180X__ +#define __PROF180X__ + +#define HD64180_TAG "hd64180" +#define FDC9268_TAG "fdc9268" +#define FDC9229_TAG "fdc9229" +#define MK3835_TAG "mk3835" +#define SCREEN_TAG "screen" +#define CENTRONICS_TAG "centronics" + +class prof180x_state : public driver_device +{ +public: + prof180x_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_centronics(*this, CENTRONICS_TAG) + { + } + + required_device m_centronics; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE8_MEMBER( flr_w ); + DECLARE_READ8_MEMBER( status0_r ); + DECLARE_READ8_MEMBER( status1_r ); + DECLARE_READ8_MEMBER( status_r ); + + void ls259_w(int flag, int value); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + int m_c0; + int m_c1; + int m_c2; + int m_mm0; + int m_mm1; +}; + +#endif diff --git a/src/mame/includes/prof80.h b/src/mame/includes/prof80.h new file mode 100644 index 00000000000..5a48f376196 --- /dev/null +++ b/src/mame/includes/prof80.h @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __PROF80__ +#define __PROF80__ + +#include "bus/ecbbus/ecbbus.h" +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/prof80mmu.h" +#include "machine/ram.h" +#include "machine/rescap.h" +#include "machine/upd1990a.h" +#include "machine/upd765.h" + +#define Z80_TAG "z1" +#define MMU_TAG "mmu" +#define UPD765_TAG "z38" +#define UPD1990A_TAG "z43" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" + +// ------------------------------------------------------------------------ + +#define UNIO_Z80STI_TAG "z5" +#define UNIO_Z80SIO_TAG "z15" +#define UNIO_Z80PIO_TAG "z13" +#define UNIO_CENTRONICS1_TAG "n3" +#define UNIO_CENTRONICS2_TAG "n4" + +class prof80_state : public driver_device +{ +public: + prof80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_mmu(*this, MMU_TAG), + m_rtc(*this, UPD1990A_TAG), + m_fdc(*this, UPD765_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, UPD765_TAG":0"), + m_floppy1(*this, UPD765_TAG":1"), + m_ecb(*this, ECBBUS_TAG), + m_rs232a(*this, RS232_A_TAG), + m_rs232b(*this, RS232_B_TAG), + m_rom(*this, Z80_TAG), + m_j4(*this, "J4"), + m_j5(*this, "J5") + { } + + required_device m_maincpu; + required_device m_mmu; + required_device m_rtc; + required_device m_fdc; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_ecb; + required_device m_rs232a; + required_device m_rs232b; + required_memory_region m_rom; + required_ioport m_j4; + required_ioport m_j5; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void machine_start(); + virtual void machine_reset(); + + enum + { + TIMER_ID_MOTOR + }; + + DECLARE_WRITE8_MEMBER( flr_w ); + DECLARE_READ8_MEMBER( status_r ); + DECLARE_READ8_MEMBER( status2_r ); + + void ls259_w(int fa, int sa, int fb, int sb); + void motor(int mon); + + // RTC state + int m_c0; + int m_c1; + int m_c2; + + // floppy state + int m_motor; + int m_ready; + int m_select; + + // timers + emu_timer *m_floppy_motor_off_timer; + +}; + +#endif diff --git a/src/mame/includes/psion.h b/src/mame/includes/psion.h new file mode 100644 index 00000000000..65d5648f601 --- /dev/null +++ b/src/mame/includes/psion.h @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Psion Organiser II series + +****************************************************************************/ + +#pragma once + +#ifndef _PSION_H_ +#define _PSION_H_ + +#include "cpu/m6800/m6800.h" +#include "machine/nvram.h" +#include "machine/psion_pack.h" +#include "video/hd44780.h" +#include "sound/beep.h" + + +// ======================> psion_state + +class psion_state : public driver_device +{ +public: + psion_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_lcdc(*this, "hd44780"), + m_beep(*this, "beeper"), + m_pack1(*this, "pack1"), + m_pack2(*this, "pack2"), + m_nvram1(*this, "nvram1"), + m_nvram2(*this, "nvram2"), + m_nvram3(*this, "nvram3"), + m_sys_register(*this, "sys_register"), + m_stby_pwr(1), + m_ram(*this, "ram"){ } + + required_device m_maincpu; + required_device m_lcdc; + required_device m_beep; + required_device m_pack1; + required_device m_pack2; + required_device m_nvram1; + required_device m_nvram2; + optional_device m_nvram3; + + UINT16 m_kb_counter; + UINT8 m_enable_nmi; + optional_shared_ptr m_sys_register; + UINT8 m_tcsr_value; + UINT8 m_stby_pwr; + UINT8 m_pulse; + + UINT8 m_port2_ddr; // datapack i/o ddr + UINT8 m_port2; // datapack i/o data bus + UINT8 m_port6_ddr; // datapack control lines ddr + UINT8 m_port6; // datapack control lines + + // RAM/ROM banks + required_shared_ptr m_ram; + UINT8 *m_paged_ram; + UINT8 m_rom_bank; + UINT8 m_ram_bank; + UINT8 m_ram_bank_count; + UINT8 m_rom_bank_count; + + virtual void machine_start(); + virtual void machine_reset(); + void nvram_init(nvram_device &nvram, void *data, size_t size); + + UINT8 kb_read(); + void update_banks(); + DECLARE_WRITE8_MEMBER( hd63701_int_reg_w ); + DECLARE_READ8_MEMBER( hd63701_int_reg_r ); + void io_rw(address_space &space, UINT16 offset); + DECLARE_WRITE8_MEMBER( io_w ); + DECLARE_READ8_MEMBER( io_r ); + DECLARE_PALETTE_INIT(psion); + DECLARE_INPUT_CHANGED_MEMBER(psion_on); + TIMER_DEVICE_CALLBACK_MEMBER(nmi_timer); + + static HD44780_PIXEL_UPDATE(lz_pixel_update); +}; + + +class psion1_state : public psion_state +{ +public: + psion1_state(const machine_config &mconfig, device_type type, const char *tag) + : psion_state(mconfig, type, tag) + { } + + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( reset_kb_counter_r ); + DECLARE_READ8_MEMBER( inc_kb_counter_r ); + DECLARE_READ8_MEMBER( switchoff_r ); + + static HD44780_PIXEL_UPDATE(psion1_pixel_update); +}; + +#endif // _PSION_H_ diff --git a/src/mame/includes/px8.h b/src/mame/includes/px8.h new file mode 100644 index 00000000000..22034809b86 --- /dev/null +++ b/src/mame/includes/px8.h @@ -0,0 +1,87 @@ +// license:GPL-2.0+ +// copyright-holders:Curt Coder,Dirk Best +#pragma once + +#ifndef __PX8__ +#define __PX8__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/m6800/m6800.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "machine/i8251.h" +#include "bus/epson_sio/pf10.h" +#include "sound/wave.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define UPD70008_TAG "4a" +#define UPD7508_TAG "2e" +#define HD6303_TAG "13d" +#define SED1320_TAG "7c" +#define I8251_TAG "13e" +#define UPD7001_TAG "1d" +#define SCREEN_TAG "screen" + +#define PX8_VIDEORAM_MASK 0x17ff + +class px8_state : public driver_device +{ +public: + px8_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, UPD70008_TAG), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_video_ram(*this, "video_ram"){ } + + required_device m_maincpu; + required_device m_cassette; + required_device m_ram; + /* video state */ + required_shared_ptr m_video_ram; /* LCD video RAM */ + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( gah40m_r ); + DECLARE_WRITE8_MEMBER( gah40m_w ); + DECLARE_READ8_MEMBER( gah40s_r ); + DECLARE_WRITE8_MEMBER( gah40s_w ); + DECLARE_WRITE8_MEMBER( gah40s_ier_w ); + DECLARE_READ8_MEMBER( krtn_0_3_r ); + DECLARE_READ8_MEMBER( krtn_4_7_r ); + DECLARE_WRITE8_MEMBER( ksc_w ); + + void bankswitch(); + UINT8 krtn_read(); + + /* GAH40M state */ + UINT16 m_icr; /* input capture register */ + UINT16 m_frc; /* free running counter */ + UINT8 m_ier; /* interrupt acknowledge register */ + UINT8 m_isr; /* interrupt status register */ + UINT8 m_sio; /* serial I/O register */ + int m_bank0; /* */ + + /* GAH40S state */ + UINT16 m_cnt; /* microcassette tape counter */ + int m_swpr; /* P-ROM power switch */ + UINT16 m_pra; /* P-ROM address */ + UINT8 m_prd; /* P-ROM data */ + + /* memory state */ + int m_bk2; /* */ + + /* keyboard state */ + int m_ksc; /* keyboard scan column */ + DECLARE_PALETTE_INIT(px8); + UINT32 screen_update_px8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + +#endif diff --git a/src/mame/includes/ql.h b/src/mame/includes/ql.h new file mode 100644 index 00000000000..ad2b14039ac --- /dev/null +++ b/src/mame/includes/ql.h @@ -0,0 +1,143 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Phill Harvey-Smith +#pragma once + +#ifndef __QL__ +#define __QL__ + +#include "emu.h" +#include "bus/ql/exp.h" +#include "bus/ql/rom.h" +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/microdrv.h" +#include "machine/qimi.h" +#include "machine/ram.h" +#include "machine/zx8302.h" +#include "sound/speaker.h" +#include "video/zx8301.h" + +#define SCREEN_TAG "screen" + +#define M68008_TAG "ic18" +#define I8749_TAG "ic24" +#define I8051_TAG "i8051" +#define ZX8301_TAG "ic22" +#define ZX8302_TAG "ic23" +#define RS232_A_TAG "ser1" +#define RS232_B_TAG "ser2" +#define QIMI_TAG "qimi" + +#define X1 XTAL_15MHz +#define X2 XTAL_32_768kHz +#define X3 XTAL_4_436MHz +#define X4 XTAL_11MHz + +class ql_state : public driver_device +{ +public: + ql_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M68008_TAG), + m_ipc(*this, I8749_TAG), + m_zx8301(*this, ZX8301_TAG), + m_zx8302(*this, ZX8302_TAG), + m_speaker(*this, "speaker"), + m_mdv1(*this, MDV_1), + m_mdv2(*this, MDV_2), + m_ser1(*this, RS232_A_TAG), + m_ser2(*this, RS232_A_TAG), + m_ram(*this, RAM_TAG), + m_exp(*this, "exp"), + m_cart(*this, "rom"), + m_qimi(*this, QIMI_TAG), + m_rom(*this, M68008_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_joy0(*this, "JOY0"), + m_joy1(*this, "JOY1"), + m_config(*this, "config"), + m_extintl(CLEAR_LINE), + m_keylatch(0), + m_ipl(0), + m_comdata_to_ipc(0), + m_baudx4(0), + m_qimi_enabled(false), + m_qimi_extint(CLEAR_LINE) + { } + + required_device m_maincpu; + required_device m_ipc; + required_device m_zx8301; + required_device m_zx8302; + required_device m_speaker; + required_device m_mdv1; + required_device m_mdv2; + required_device m_ser1; + required_device m_ser2; + required_device m_ram; + required_device m_exp; + required_device m_cart; + optional_device m_qimi; + required_memory_region m_rom; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_joy0; + required_ioport m_joy1; + required_ioport m_config; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE8_MEMBER( ipc_w ); + DECLARE_WRITE8_MEMBER( ipc_port1_w ); + DECLARE_WRITE8_MEMBER( ipc_port2_w ); + DECLARE_READ8_MEMBER( ipc_port2_r ); + DECLARE_READ8_MEMBER( ipc_t1_r ); + DECLARE_READ8_MEMBER( ipc_bus_r ); + DECLARE_READ8_MEMBER( ql_ram_r ); + DECLARE_WRITE8_MEMBER( ql_ram_w ); + DECLARE_WRITE_LINE_MEMBER( ql_baudx4_w ); + DECLARE_WRITE_LINE_MEMBER( ql_comdata_w ); + DECLARE_WRITE_LINE_MEMBER( zx8302_mdselck_w ); + DECLARE_WRITE_LINE_MEMBER( zx8302_mdrdw_w ); + DECLARE_WRITE_LINE_MEMBER( zx8302_erase_w ); + DECLARE_WRITE_LINE_MEMBER( zx8302_raw1_w ); + DECLARE_READ_LINE_MEMBER( zx8302_raw1_r ); + DECLARE_WRITE_LINE_MEMBER( zx8302_raw2_w ); + DECLARE_READ_LINE_MEMBER( zx8302_raw2_r ); + DECLARE_WRITE_LINE_MEMBER( exp_extintl_w ); + DECLARE_WRITE_LINE_MEMBER( qimi_extintl_w ); + + void update_interrupt(); + + int m_extintl; + + // IPC + UINT8 m_keylatch; + int m_ipl; + int m_comdata_to_ipc; + int m_baudx4; + + // QIMI + bool m_qimi_enabled; + int m_qimi_extint; +}; + +#endif diff --git a/src/mame/includes/radio86.h b/src/mame/includes/radio86.h new file mode 100644 index 00000000000..2dd9f3298e8 --- /dev/null +++ b/src/mame/includes/radio86.h @@ -0,0 +1,129 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/radio86.h + * + ****************************************************************************/ + +#ifndef radio86_H_ +#define radio86_H_ + +#include "machine/i8255.h" +#include "machine/i8257.h" +#include "video/i8275.h" +#include "imagedev/cassette.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class radio86_state : public driver_device +{ +public: + enum + { + TIMER_RESET + }; + + radio86_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_dma8257(*this, "dma8257"), + m_ppi8255_1(*this, "ppi8255_1"), + m_ppi8255_2(*this, "ppi8255_2"), + m_region_maincpu(*this, "maincpu"), + m_bank1(*this, "bank1"), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_line4(*this, "LINE4"), + m_io_line5(*this, "LINE5"), + m_io_line6(*this, "LINE6"), + m_io_line7(*this, "LINE7"), + m_io_line8(*this, "LINE8"), + m_io_cline0(*this, "CLINE0"), + m_io_cline1(*this, "CLINE1"), + m_io_cline2(*this, "CLINE2"), + m_io_cline3(*this, "CLINE3"), + m_io_cline4(*this, "CLINE4"), + m_io_cline5(*this, "CLINE5"), + m_io_cline6(*this, "CLINE6"), + m_io_cline7(*this, "CLINE7"), + m_palette(*this, "palette") { } + + virtual void video_start(); + + UINT8 m_tape_value; + UINT8 m_mikrosha_font_page; + int m_keyboard_mask; + UINT8* m_radio_ram_disk; + UINT8 m_romdisk_lsb; + UINT8 m_romdisk_msb; + UINT8 m_disk_sel; + const UINT8 *m_charmap; + DECLARE_READ8_MEMBER(radio_cpu_state_r); + DECLARE_READ8_MEMBER(radio_io_r); + DECLARE_WRITE8_MEMBER(radio_io_w); + DECLARE_WRITE8_MEMBER(radio86_pagesel); + DECLARE_DRIVER_INIT(radioram); + DECLARE_DRIVER_INIT(radio86); + DECLARE_MACHINE_RESET(radio86); + DECLARE_PALETTE_INIT(radio86); + DECLARE_READ8_MEMBER(radio86_8255_portb_r2); + DECLARE_READ8_MEMBER(radio86_8255_portc_r2); + DECLARE_WRITE8_MEMBER(radio86_8255_porta_w2); + DECLARE_WRITE8_MEMBER(radio86_8255_portc_w2); + DECLARE_READ8_MEMBER(rk7007_8255_portc_r); + DECLARE_WRITE_LINE_MEMBER(hrq_w); + DECLARE_READ8_MEMBER(radio86rom_romdisk_porta_r); + DECLARE_READ8_MEMBER(radio86ram_romdisk_porta_r); + DECLARE_WRITE8_MEMBER(radio86_romdisk_portb_w); + DECLARE_WRITE8_MEMBER(radio86_romdisk_portc_w); + DECLARE_WRITE8_MEMBER(mikrosha_8255_font_page_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + I8275_DRAW_CHARACTER_MEMBER(display_pixels); + required_device m_maincpu; + +protected: + required_device m_cassette; + optional_device m_cart; // for ROMDisk - only Radio86K & Orion? + optional_device m_dma8257; + required_device m_ppi8255_1; + optional_device m_ppi8255_2; + required_memory_region m_region_maincpu; + required_memory_bank m_bank1; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_ioport m_io_line3; + required_ioport m_io_line4; + required_ioport m_io_line5; + required_ioport m_io_line6; + required_ioport m_io_line7; + required_ioport m_io_line8; + optional_ioport m_io_cline0; + optional_ioport m_io_cline1; + optional_ioport m_io_cline2; + optional_ioport m_io_cline3; + optional_ioport m_io_cline4; + optional_ioport m_io_cline5; + optional_ioport m_io_cline6; + optional_ioport m_io_cline7; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + void radio86_init_keyboard(); +public: + required_device m_palette; +}; + + +/*----------- defined in drivers/radio86.c -----------*/ + +INPUT_PORTS_EXTERN( radio86 ); +INPUT_PORTS_EXTERN( ms7007 ); + +#endif /* radio86_H_ */ diff --git a/src/mame/includes/rm380z.h b/src/mame/includes/rm380z.h new file mode 100644 index 00000000000..b3b47a23bfd --- /dev/null +++ b/src/mame/includes/rm380z.h @@ -0,0 +1,138 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol,Gabriele D'Antona + +/* + +Research Machines RM 380Z + +*/ + +#ifndef RM380Z_H_ +#define RM380Z_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "imagedev/flopdrv.h" +#include "machine/wd_fdc.h" +#include "machine/keyboard.h" + +// +// +// + +#define RM380Z_MAINCPU_TAG "maincpu" +#define RM380Z_PORTS_ENABLED_HIGH ( m_port0 & 0x80 ) +#define RM380Z_PORTS_ENABLED_LOW ( ( m_port0 & 0x80 ) == 0x00 ) + +#define RM380Z_VIDEOMODE_40COL 0x01 +#define RM380Z_VIDEOMODE_80COL 0x02 + +#define RM380Z_CHDIMX 5 +#define RM380Z_CHDIMY 9 +#define RM380Z_NCX 8 +#define RM380Z_NCY 16 +#define RM380Z_SCREENCOLS 80 +#define RM380Z_SCREENROWS 24 + +#define RM380Z_VIDEORAM_SIZE 0x600 +#define RM380Z_SCREENSIZE 0x1200 + + +// +// +// + + +class rm380z_state : public driver_device +{ +private: + + void put_point(int charnum,int x,int y,int col); + void init_graphic_chars(); + + void putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bitmap,unsigned char* chsb,int vmode); + void decode_videoram_char(int pos,UINT8& chr,UINT8& attrib); + void scroll_videoram(); + void config_videomode(); + void check_scroll_register(); + + int writenum; + +protected: + virtual void machine_reset(); + virtual void machine_start(); + +public: + + UINT8 m_port0; + UINT8 m_port0_kbd; + UINT8 m_port1; + UINT8 m_fbfd; + UINT8 m_fbfe; + + UINT8 m_graphic_chars[0x80][(RM380Z_CHDIMX+1)*(RM380Z_CHDIMY+1)]; + + UINT8 m_mainVideoram[RM380Z_VIDEORAM_SIZE]; + UINT8 m_vramchars[RM380Z_SCREENSIZE]; + UINT8 m_vramattribs[RM380Z_SCREENSIZE]; + UINT8 m_vram[RM380Z_SCREENSIZE]; + + int m_rasterlineCtr; + emu_timer* m_vblankTimer; + + int m_old_fbfd; + int m_old_old_fbfd; + + int m_videomode; + int m_old_videomode; + + required_device m_maincpu; + required_device m_messram; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + + rm380z_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, RM380Z_MAINCPU_TAG), + m_messram(*this, RAM_TAG), + m_fdc(*this, "wd1771"), + m_floppy0(*this, "wd1771:0"), + m_floppy1(*this, "wd1771:1") + { + } + + DECLARE_WRITE8_MEMBER( port_write ); + DECLARE_READ8_MEMBER( port_read ); + DECLARE_WRITE8_MEMBER( port_write_1b00 ); + DECLARE_READ8_MEMBER( port_read_1b00 ); + + DECLARE_READ8_MEMBER( main_read ); + DECLARE_WRITE8_MEMBER( main_write ); + + DECLARE_READ8_MEMBER( videoram_read ); + DECLARE_WRITE8_MEMBER( videoram_write ); + + UINT8 hiram[0x1000]; + DECLARE_READ8_MEMBER( hiram_read ); + DECLARE_WRITE8_MEMBER( hiram_write ); + + DECLARE_READ8_MEMBER( rm380z_portlow_r ); + DECLARE_WRITE8_MEMBER( rm380z_portlow_w ); + DECLARE_READ8_MEMBER( rm380z_porthi_r ); + DECLARE_WRITE8_MEMBER( rm380z_porthi_w ); + + DECLARE_WRITE8_MEMBER(disk_0_control); + + DECLARE_WRITE8_MEMBER( keyboard_put ); + + void config_memory_map(); + int keyboard_decode(); + void update_screen(bitmap_ind16 &bitmap); + UINT32 screen_update_rm380z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(static_vblank_timer); +}; + + +#endif diff --git a/src/mame/includes/rmnimbus.h b/src/mame/includes/rmnimbus.h new file mode 100644 index 00000000000..3d0cba8e05c --- /dev/null +++ b/src/mame/includes/rmnimbus.h @@ -0,0 +1,222 @@ +// license:BSD-3-Clause +// copyright-holders:Phill Harvey-Smith, Carl +/* + rmnimbus.c + Machine driver for the Research Machines Nimbus. + + Phill Harvey-Smith + 2009-11-29. +*/ +#include "emu.h" +#include "cpu/i86/i186.h" +#include "machine/z80dart.h" +#include "machine/wd_fdc.h" +#include "bus/scsi/scsi.h" +#include "machine/6522via.h" +#include "machine/ram.h" +#include "machine/eepromser.h" +#include "sound/ay8910.h" +#include "sound/msm5205.h" +#include "bus/centronics/ctronics.h" + +#define MAINCPU_TAG "maincpu" +#define IOCPU_TAG "iocpu" +#define Z80SIO_TAG "z80sio" +#define FDC_TAG "wd2793" +#define SCSIBUS_TAG "scsibus" +#define ER59256_TAG "er59256" +#define AY8910_TAG "ay8910" +#define MONO_TAG "mono" +#define MSM5205_TAG "msm5205" +#define VIA_TAG "via6522" +#define CENTRONICS_TAG "centronics" + +/* Mouse / Joystick */ + +#define JOYSTICK0_TAG "joystick0" +#define MOUSE_BUTTON_TAG "mousebtn" +#define MOUSEX_TAG "mousex" +#define MOUSEY_TAG "mousey" + +/* Memory controller */ +#define RAM_BANK00_TAG "bank0" +#define RAM_BANK01_TAG "bank1" +#define RAM_BANK02_TAG "bank2" +#define RAM_BANK03_TAG "bank3" +#define RAM_BANK04_TAG "bank4" +#define RAM_BANK05_TAG "bank5" +#define RAM_BANK06_TAG "bank6" +#define RAM_BANK07_TAG "bank7" + +class rmnimbus_state : public driver_device +{ +public: + rmnimbus_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_msm(*this, MSM5205_TAG), + m_scsibus(*this, SCSIBUS_TAG), + m_ram(*this, RAM_TAG), + m_eeprom(*this, ER59256_TAG), + m_via(*this, VIA_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_palette(*this, "palette"), + m_scsi_data_out(*this, "scsi_data_out"), + m_scsi_data_in(*this, "scsi_data_in"), + m_scsi_ctrl_out(*this, "scsi_ctrl_out"), + m_fdc(*this, FDC_TAG), + m_z80sio(*this, Z80SIO_TAG), + m_screen(*this, "screen"), + m_io_config(*this, "config"), + m_io_joystick0(*this, JOYSTICK0_TAG), + m_io_mouse_button(*this, MOUSE_BUTTON_TAG), + m_io_mousex(*this, MOUSEX_TAG), + m_io_mousey(*this, MOUSEY_TAG) + { + } + + required_device m_maincpu; + required_device m_msm; + required_device m_scsibus; + required_device m_ram; + required_device m_eeprom; + required_device m_via; + required_device m_centronics; + required_device m_palette; + required_device m_scsi_data_out; + required_device m_scsi_data_in; + required_device m_scsi_ctrl_out; + required_device m_fdc; + required_device m_z80sio; + required_device m_screen; + required_ioport m_io_config; + required_ioport m_io_joystick0; + required_ioport m_io_mouse_button; + required_ioport m_io_mousex; + required_ioport m_io_mousey; + + bitmap_ind16 m_video_mem; + + UINT32 m_debug_machine; + UINT8 m_mcu_reg080; + UINT8 m_iou_reg092; + UINT8 m_last_playmode; + UINT8 m_ay8910_a; + UINT16 m_x, m_y, m_yline; + UINT8 m_colours, m_mode, m_op; + UINT32 m_debug_video; + UINT8 m_vector; + UINT8 m_eeprom_bits; + UINT8 m_eeprom_state; + + DECLARE_READ8_MEMBER(nimbus_mcu_r); + DECLARE_WRITE8_MEMBER(nimbus_mcu_w); + DECLARE_READ8_MEMBER(scsi_r); + DECLARE_WRITE8_MEMBER(scsi_w); + DECLARE_WRITE8_MEMBER(fdc_ctl_w); + DECLARE_READ8_MEMBER(nimbus_pc8031_r); + DECLARE_WRITE8_MEMBER(nimbus_pc8031_w); + DECLARE_READ8_MEMBER(nimbus_pc8031_iou_r); + DECLARE_WRITE8_MEMBER(nimbus_pc8031_iou_w); + DECLARE_READ8_MEMBER(nimbus_pc8031_port_r); + DECLARE_WRITE8_MEMBER(nimbus_pc8031_port_w); + DECLARE_READ8_MEMBER(nimbus_iou_r); + DECLARE_WRITE8_MEMBER(nimbus_iou_w); + DECLARE_WRITE8_MEMBER(nimbus_sound_ay8910_porta_w); + DECLARE_WRITE8_MEMBER(nimbus_sound_ay8910_portb_w); + DECLARE_READ8_MEMBER(nimbus_mouse_js_r); + DECLARE_WRITE8_MEMBER(nimbus_mouse_js_w); + DECLARE_READ16_MEMBER(nimbus_video_io_r); + DECLARE_WRITE16_MEMBER(nimbus_video_io_w); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + virtual void video_reset(); + UINT32 screen_update_nimbus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(sio_interrupt); + DECLARE_WRITE_LINE_MEMBER(nimbus_fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(nimbus_fdc_drq_w); + DECLARE_WRITE8_MEMBER(nimbus_via_write_portb); + DECLARE_WRITE_LINE_MEMBER(write_scsi_bsy); + DECLARE_WRITE_LINE_MEMBER(write_scsi_cd); + DECLARE_WRITE_LINE_MEMBER(write_scsi_io); + DECLARE_WRITE_LINE_MEMBER(write_scsi_msg); + DECLARE_WRITE_LINE_MEMBER(write_scsi_req); + DECLARE_WRITE_LINE_MEMBER(nimbus_msm5205_vck); + DECLARE_WRITE_LINE_MEMBER(write_scsi_iena); + + UINT8 get_pixel(UINT16 x, UINT16 y); + UINT16 read_pixel_line(UINT16 x, UINT16 y, UINT8 pixels, UINT8 bpp); + UINT16 read_pixel_data(UINT16 x, UINT16 y); + void set_pixel(UINT16 x, UINT16 y, UINT8 colour); + void set_pixel40(UINT16 x, UINT16 y, UINT8 colour); + void write_pixel_line(UINT16 x, UINT16 y, UINT16, UINT8 pixels, UINT8 bpp); + void move_pixel_line(UINT16 x, UINT16 y, UINT8 width); + void write_pixel_data(UINT16 x, UINT16 y, UINT16 data); + void change_palette(UINT8 bank, UINT16 colours); + void external_int(UINT8 vector, bool state); + DECLARE_READ8_MEMBER(cascade_callback); + void nimbus_bank_memory(); + void memory_reset(); + void fdc_reset(); + UINT8 fdc_driveno(UINT8 drivesel); + void hdc_reset(); + void hdc_ctrl_write(UINT8 data); + void hdc_post_rw(); + void hdc_drq(bool state); + void pc8031_reset(); + //void ipc_dumpregs(); + void iou_reset(); + void rmni_sound_reset(); + void mouse_js_reset(); + void check_scsi_irq(); + + int m_scsi_iena; + int m_scsi_msg; + int m_scsi_bsy; + int m_scsi_io; + int m_scsi_cd; + int m_scsi_req; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + enum + { + TIMER_MOUSE + }; + + // Static data related to Floppy and SCSI hard disks + struct + { + UINT8 reg400; + } m_nimbus_drives; + + /* 8031 Peripheral controler */ + struct + { + UINT8 ipc_in; + UINT8 ipc_out; + UINT8 status_in; + UINT8 status_out; + } m_ipc_interface; + + /* Mouse/Joystick */ + struct + { + UINT8 m_mouse_px; + UINT8 m_mouse_py; + + UINT8 m_mouse_x; + UINT8 m_mouse_y; + UINT8 m_mouse_pc; + UINT8 m_mouse_pcx; + UINT8 m_mouse_pcy; + + UINT8 m_intstate_x; + UINT8 m_intstate_y; + + UINT8 m_reg0a4; + + emu_timer *m_mouse_timer; + } m_nimbus_mouse; +}; diff --git a/src/mame/includes/sage2.h b/src/mame/includes/sage2.h new file mode 100644 index 00000000000..a8138e3c716 --- /dev/null +++ b/src/mame/includes/sage2.h @@ -0,0 +1,99 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8251.h" +#include "machine/i8255.h" +#include "bus/ieee488/ieee488.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/ram.h" +#include "machine/upd765.h" + +#define M68000_TAG "u68" +#define I8255A_0_TAG "u22" +#define I8255A_1_TAG "u39" +#define I8253_0_TAG "u74" +#define I8253_1_TAG "u75" +#define I8259_TAG "u73" +#define I8251_0_TAG "u58" +#define I8251_1_TAG "u67" +#define UPD765_TAG "u21" +#define TMS9914_TAG "u6" +#define CENTRONICS_TAG "centronics" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" + +class sage2_state : public driver_device +{ +public: + sage2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M68000_TAG), + m_pic(*this, I8259_TAG), + m_usart0(*this, I8251_0_TAG), + m_usart1(*this, I8251_1_TAG), + m_fdc(*this, UPD765_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, UPD765_TAG ":0"), + m_floppy1(*this, UPD765_TAG ":1"), + m_floppy(NULL), + m_centronics(*this, CENTRONICS_TAG), + m_ieee488(*this, IEEE488_TAG), + m_reset(1), + m_fdc_int(0), + m_fdie(0) + { } + + required_device m_maincpu; + required_device m_pic; + required_device m_usart0; + required_device m_usart1; + required_device m_fdc; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + floppy_image_device *m_floppy; + required_device m_centronics; + required_device m_ieee488; + + virtual void machine_start(); + virtual void machine_reset(); + + void update_fdc_int(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_WRITE_LINE_MEMBER( br1_w ); + DECLARE_WRITE_LINE_MEMBER( br2_w ); + DECLARE_WRITE8_MEMBER( ppi0_pc_w ); + DECLARE_READ8_MEMBER( ppi1_pb_r ); + DECLARE_WRITE8_MEMBER( ppi1_pc_w ); + + DECLARE_WRITE8_MEMBER(kbd_put); + + DECLARE_DIRECT_UPDATE_MEMBER(sage2_direct_update_handler); + + DECLARE_WRITE_LINE_MEMBER( fdc_irq ); + + const UINT8 *m_rom; + int m_reset; + + // floppy state + int m_fdc_int; + int m_fdie; + DECLARE_DRIVER_INIT(sage2); + + int m_centronics_busy; + int m_centronics_perror; + int m_centronics_select; + int m_centronics_fault; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + DECLARE_WRITE_LINE_MEMBER(write_centronics_select); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); +}; diff --git a/src/mame/includes/samcoupe.h b/src/mame/includes/samcoupe.h new file mode 100644 index 00000000000..e576e32f782 --- /dev/null +++ b/src/mame/includes/samcoupe.h @@ -0,0 +1,203 @@ +// license:GPL-2.0+ +// copyright-holders:Lee Hammerton, Dirk Best +/***************************************************************************** + * + * includes/coupe.h + * + * SAM Coupe + * + * Driver by Lee Hammerton + * + ****************************************************************************/ + +#ifndef SAMCOUPE_H_ +#define SAMCOUPE_H_ + +#include "machine/wd_fdc.h" +#include "sound/speaker.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "machine/ram.h" +#include "machine/msm6242.h" + +/* screen dimensions */ +#define SAM_BLOCK 8 + +#define SAM_TOTAL_WIDTH SAM_BLOCK*96 +#define SAM_TOTAL_HEIGHT 312 +#define SAM_SCREEN_WIDTH SAM_BLOCK*64 +#define SAM_SCREEN_HEIGHT 192 +#define SAM_BORDER_LEFT SAM_BLOCK*4 +#define SAM_BORDER_RIGHT SAM_BLOCK*4 +#define SAM_BORDER_TOP 37 +#define SAM_BORDER_BOTTOM 46 + +/* interrupt sources */ +#define SAM_LINE_INT 0x01 +#define SAM_MOUSE_INT 0x02 +#define SAM_MIDIIN_INT 0x04 +#define SAM_FRAME_INT 0x08 +#define SAM_MIDIOUT_INT 0x10 + + +class samcoupe_state : public driver_device +{ +public: + enum + { + TIMER_IRQ_OFF, + TIMER_MOUSE_RESET, + TIMER_VIDEO_UPDATE + }; + + samcoupe_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_lpt1(*this, "lpt1"), + m_lpt2(*this, "lpt2"), + m_ram(*this, RAM_TAG), + m_rtc(*this, "sambus_clock"), + m_fdc(*this, "wd1772"), + m_wd1772_0(*this, "wd1772:0"), + m_wd1772_1(*this, "wd1772:1"), + m_region_maincpu(*this, "maincpu"), + m_keyboard_row_fe(*this, "keyboard_row_fe"), + m_keyboard_row_fd(*this, "keyboard_row_fd"), + m_keyboard_row_fb(*this, "keyboard_row_fb"), + m_keyboard_row_f7(*this, "keyboard_row_f7"), + m_keyboard_row_ef(*this, "keyboard_row_ef"), + m_keyboard_row_df(*this, "keyboard_row_df"), + m_keyboard_row_bf(*this, "keyboard_row_bf"), + m_keyboard_row_7f(*this, "keyboard_row_7f"), + m_keyboard_row_ff(*this, "keyboard_row_ff"), + m_mouse_buttons(*this, "mouse_buttons"), + m_io_mouse_x(*this, "mouse_x"), + m_io_mouse_y(*this, "mouse_y"), + m_config(*this, "config") + { + sam_bank_read_ptr[0] = NULL; + sam_bank_write_ptr[0] = NULL; + sam_bank_read_ptr[1] = NULL; + sam_bank_write_ptr[1] = NULL; + sam_bank_read_ptr[2] = NULL; + sam_bank_write_ptr[2] = NULL; + sam_bank_read_ptr[3] = NULL; + sam_bank_write_ptr[3] = NULL; + } + + virtual void video_start(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + bitmap_ind16 m_bitmap; + + emu_timer *m_video_update_timer; + + UINT8 m_lmpr, m_hmpr, m_vmpr; /* memory pages */ + UINT8 m_lext, m_hext; /* extended memory page */ + UINT8 m_border; /* border */ + UINT8 m_clut[16]; /* color lookup table, 16 entries */ + UINT8 m_line_int; /* line interrupt */ + UINT8 m_status; /* status register */ + + /* attribute */ + UINT8 m_attribute; + + /* mouse */ + int m_mouse_index; + emu_timer *m_mouse_reset; + UINT8 m_mouse_data[9]; + int m_mouse_x, m_mouse_y; + UINT8 *m_videoram; + DECLARE_WRITE8_MEMBER(samcoupe_ext_mem_w); + DECLARE_READ8_MEMBER(samcoupe_disk_r); + DECLARE_WRITE8_MEMBER(samcoupe_disk_w); + DECLARE_READ8_MEMBER(samcoupe_pen_r); + DECLARE_WRITE8_MEMBER(samcoupe_clut_w); + DECLARE_READ8_MEMBER(samcoupe_status_r); + DECLARE_WRITE8_MEMBER(samcoupe_line_int_w); + DECLARE_READ8_MEMBER(samcoupe_lmpr_r); + DECLARE_WRITE8_MEMBER(samcoupe_lmpr_w); + DECLARE_READ8_MEMBER(samcoupe_hmpr_r); + DECLARE_WRITE8_MEMBER(samcoupe_hmpr_w); + DECLARE_READ8_MEMBER(samcoupe_vmpr_r); + DECLARE_WRITE8_MEMBER(samcoupe_vmpr_w); + DECLARE_READ8_MEMBER(samcoupe_midi_r); + DECLARE_WRITE8_MEMBER(samcoupe_midi_w); + DECLARE_READ8_MEMBER(samcoupe_keyboard_r); + DECLARE_WRITE8_MEMBER(samcoupe_border_w); + DECLARE_READ8_MEMBER(samcoupe_attributes_r); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(samcoupe); + INTERRUPT_GEN_MEMBER(samcoupe_frame_interrupt); + TIMER_CALLBACK_MEMBER(irq_off); + TIMER_CALLBACK_MEMBER(samcoupe_mouse_reset); + TIMER_CALLBACK_MEMBER(sam_video_update_callback); + DECLARE_READ8_MEMBER(samcoupe_lpt1_busy_r); + DECLARE_WRITE8_MEMBER(samcoupe_lpt1_strobe_w); + DECLARE_READ8_MEMBER(samcoupe_lpt2_busy_r); + DECLARE_WRITE8_MEMBER(samcoupe_lpt2_strobe_w); + DECLARE_READ8_MEMBER(samcoupe_rtc_r); + DECLARE_WRITE8_MEMBER(samcoupe_rtc_w); + + DECLARE_READ8_MEMBER(sam_bank1_r); + DECLARE_WRITE8_MEMBER(sam_bank1_w); + DECLARE_READ8_MEMBER(sam_bank2_r); + DECLARE_WRITE8_MEMBER(sam_bank2_w); + DECLARE_READ8_MEMBER(sam_bank3_r); + DECLARE_WRITE8_MEMBER(sam_bank3_w); + DECLARE_READ8_MEMBER(sam_bank4_r); + DECLARE_WRITE8_MEMBER(sam_bank4_w); + + UINT8* sam_bank_read_ptr[4]; + UINT8* sam_bank_write_ptr[4]; + DECLARE_FLOPPY_FORMATS( floppy_formats ); + required_device m_maincpu; + required_device m_speaker; + required_device m_cassette; + required_device m_lpt1; + required_device m_lpt2; + required_device m_ram; + required_device m_rtc; + required_device m_fdc; + required_device m_wd1772_0; + required_device m_wd1772_1; + required_memory_region m_region_maincpu; + required_ioport m_keyboard_row_fe; + required_ioport m_keyboard_row_fd; + required_ioport m_keyboard_row_fb; + required_ioport m_keyboard_row_f7; + required_ioport m_keyboard_row_ef; + required_ioport m_keyboard_row_df; + required_ioport m_keyboard_row_bf; + required_ioport m_keyboard_row_7f; + required_ioport m_keyboard_row_ff; + required_ioport m_mouse_buttons; + required_ioport m_io_mouse_x; + required_ioport m_io_mouse_y; + required_ioport m_config; + + void draw_mode4_line(int y, int hpos); + void draw_mode3_line(int y, int hpos); + void draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask); + void draw_mode2_line(int y, int hpos); + void draw_mode1_line(int y, int hpos); + void samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memory, int is_readonly); + void samcoupe_install_ext_mem(address_space &space); + void samcoupe_update_memory(address_space &space); + UINT8 samcoupe_mouse_r(); + void samcoupe_irq(UINT8 src); + + DECLARE_WRITE_LINE_MEMBER(write_lpt1_busy); + DECLARE_WRITE_LINE_MEMBER(write_lpt2_busy); + + int m_lpt1_busy; + int m_lpt2_busy; +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* SAMCOUPE_H_ */ diff --git a/src/mame/includes/sg1000.h b/src/mame/includes/sg1000.h new file mode 100644 index 00000000000..47d9497f7db --- /dev/null +++ b/src/mame/includes/sg1000.h @@ -0,0 +1,149 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __SG1000__ +#define __SG1000__ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "formats/sc3000_bit.h" +#include "formats/sf7000_dsk.h" +#include "imagedev/cassette.h" +#include "imagedev/printer.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "machine/ram.h" +#include "bus/sega8/sega8_slot.h" +#include "machine/upd765.h" +#include "sound/sn76496.h" +#include "video/tms9928a.h" +#include "crsshair.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "z80" +#define SN76489AN_TAG "sn76489an" +#define UPD765_TAG "upd765" +#define UPD8251_TAG "upd8251" +#define UPD9255_TAG "upd9255" +#define UPD9255_0_TAG "upd9255_0" +#define UPD9255_1_TAG "upd9255_1" +#define CENTRONICS_TAG "centronics" +#define TMS9918A_TAG "tms9918a" +#define RS232_TAG "rs232" +#define CARTSLOT_TAG "slot" + + +INPUT_PORTS_EXTERN( sk1100 ); + +class sg1000_state : public driver_device +{ +public: + enum + { + TIMER_LIGHTGUN_TICK + }; + + sg1000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ram(*this, RAM_TAG), + m_rom(*this, Z80_TAG), + m_cart(*this, CARTSLOT_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + required_memory_region m_rom; + optional_device m_cart; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( joysel_r ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); + + DECLARE_READ8_MEMBER( omv_r ); + DECLARE_WRITE8_MEMBER( omv_w ); + + /* keyboard state */ + UINT8 m_keylatch; + + DECLARE_WRITE_LINE_MEMBER(sg1000_vdp_interrupt); +}; + +class sc3000_state : public sg1000_state +{ +public: + sc3000_state(const machine_config &mconfig, device_type type, const char *tag) + : sg1000_state(mconfig, type, tag), + m_cassette(*this, "cassette"), + m_pa0(*this, "PA0"), + m_pa1(*this, "PA1"), + m_pa2(*this, "PA2"), + m_pa3(*this, "PA3"), + m_pa4(*this, "PA4"), + m_pa5(*this, "PA5"), + m_pa6(*this, "PA6"), + m_pa7(*this, "PA7"), + m_pb0(*this, "PB0"), + m_pb1(*this, "PB1"), + m_pb2(*this, "PB2"), + m_pb3(*this, "PB3"), + m_pb4(*this, "PB4"), + m_pb5(*this, "PB5"), + m_pb6(*this, "PB6"), + m_pb7(*this, "PB7") + { } + + required_device m_cassette; + required_ioport m_pa0; + required_ioport m_pa1; + required_ioport m_pa2; + required_ioport m_pa3; + required_ioport m_pa4; + required_ioport m_pa5; + required_ioport m_pa6; + required_ioport m_pa7; + required_ioport m_pb0; + required_ioport m_pb1; + required_ioport m_pb2; + required_ioport m_pb3; + required_ioport m_pb4; + required_ioport m_pb5; + required_ioport m_pb6; + required_ioport m_pb7; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( ppi_pa_r ); + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + + ioport_port* m_key_row[16]; +}; + +class sf7000_state : public sc3000_state +{ +public: + sf7000_state(const machine_config &mconfig, device_type type, const char *tag) + : sc3000_state(mconfig, type, tag), + m_fdc(*this, UPD765_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_floppy0(*this, UPD765_TAG ":0:3ssdd") + { } + + required_device m_fdc; + required_device m_centronics; + required_device m_floppy0; + + virtual void machine_start(); + virtual void machine_reset(); + + int m_centronics_busy; + DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); + DECLARE_READ8_MEMBER( ppi_pa_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); +}; + +#endif diff --git a/src/mame/includes/sms.h b/src/mame/includes/sms.h new file mode 100644 index 00000000000..4f2efcdbbd3 --- /dev/null +++ b/src/mame/includes/sms.h @@ -0,0 +1,250 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Charles MacDonald,Mathis Rosenhauer,Brad Oliver,Michael Luong,Fabio Priuli,Enik Land +/***************************************************************************** + * + * includes/sms.h + * + ****************************************************************************/ + +#ifndef SMS_H_ +#define SMS_H_ + +#define LOG_REG +#define LOG_PAGING +#define LOG_COLOR + +#define NVRAM_SIZE (0x08000) +#define CPU_ADDRESSABLE_SIZE (0x10000) + +#define MAX_CARTRIDGES 16 + +#define CONTROL1_TAG "ctrl1" +#define CONTROL2_TAG "ctrl2" + +#include "bus/sega8/sega8_slot.h" +#include "bus/sms_exp/smsexp.h" +#include "bus/sms_ctrl/smsctrl.h" +#include "bus/gamegear/ggext.h" + + +class sms_state : public driver_device +{ +public: + sms_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_vdp(*this, "sms_vdp"), + m_main_scr(*this, "screen"), + m_psg_sms(*this, "segapsg"), + m_psg_gg(*this, "gamegear"), + m_ym(*this, "ym2413"), + m_port_ctrl1(*this, CONTROL1_TAG), + m_port_ctrl2(*this, CONTROL2_TAG), + m_port_gg_ext(*this, "ext"), + m_port_gg_dc(*this, "GG_PORT_DC"), + m_port_pause(*this, "PAUSE"), + m_port_reset(*this, "RESET"), + m_port_start(*this, "START"), + m_port_scope(*this, "SEGASCOPE"), + m_port_scope_binocular(*this, "SSCOPE_BINOCULAR"), + m_port_persist(*this, "PERSISTENCE"), + m_region_maincpu(*this, "maincpu"), + m_mainram(NULL), + m_is_gamegear(0), + m_is_gg_region_japan(0), + m_is_smsj(0), + m_is_mark_iii(0), + m_is_sdisp(0), + m_has_bios_0400(0), + m_has_bios_2000(0), + m_has_bios_full(0), + m_has_fm(0), + m_has_jpn_sms_cart_slot(0), + m_store_cart_selection_data(0) { } + + // devices + required_device m_maincpu; + required_device m_vdp; + required_device m_main_scr; + optional_device m_psg_sms; + optional_device m_psg_gg; + optional_device m_ym; + optional_device m_port_ctrl1; + optional_device m_port_ctrl2; + optional_device m_port_gg_ext; + + optional_ioport m_port_gg_dc; + optional_ioport m_port_pause; + optional_ioport m_port_reset; + optional_ioport m_port_start; + optional_ioport m_port_scope; + optional_ioport m_port_scope_binocular; + optional_ioport m_port_persist; + + required_memory_region m_region_maincpu; + address_space *m_space; + UINT8 *m_mainram; + UINT8 *m_BIOS; + + // for 3D glass binocular hack + device_t *m_left_lcd; + device_t *m_right_lcd; + bitmap_rgb32 m_prevleft_bitmap; + bitmap_rgb32 m_prevright_bitmap; + + // for gamegear LCD persistence hack + bitmap_rgb32 m_prev_bitmap; + bool m_prev_bitmap_copied; + + // for gamegear SMS mode scaling + bitmap_rgb32 m_gg_sms_mode_bitmap; + // line_buffer will be used to hold 4 lines of line data as a kind of cache for + // vertical scaling in the gamegear sms compatibility mode. + int *m_line_buffer; + + // model identifiers + UINT8 m_is_gamegear; + UINT8 m_is_gg_region_japan; + UINT8 m_is_smsj; + UINT8 m_is_mark_iii; + UINT8 m_is_sdisp; + UINT8 m_has_bios_0400; + UINT8 m_has_bios_2000; + UINT8 m_has_bios_full; + UINT8 m_has_fm; + UINT8 m_has_jpn_sms_cart_slot; + + // [0] for 0x400-0x3fff, [1] for 0x4000-0x7fff, [2] for 0x8000-0xffff, [3] for 0x0000-0x0400 + UINT8 m_bios_page[4]; + + UINT8 m_bios_page_count; + UINT8 m_mapper[4]; + UINT8 m_io_ctrl_reg; + UINT8 m_mem_ctrl_reg; + UINT8 m_mem_device_enabled; + UINT8 m_audio_control; + UINT8 m_port_dc_reg; + UINT8 m_port_dd_reg; + UINT8 m_gg_sio[5]; + int m_paused; + + UINT8 m_ctrl1_th_state; + UINT8 m_ctrl2_th_state; + UINT8 m_ctrl1_th_latch; + UINT8 m_ctrl2_th_latch; + + // Data needed for Light Phaser + int m_lphaser_x_offs; /* Needed to 'calibrate' lphaser; set at cart loading */ + + // Data needed for SegaScope (3D glasses) + UINT8 m_sscope_state; + UINT8 m_frame_sscope_state; + + // slot devices + sega8_cart_slot_device *m_cartslot; + sega8_card_slot_device *m_cardslot; + sms_expansion_slot_device *m_expslot; + + // these are only used by the Store Display unit, but we keep them here temporarily to avoid the need of separate start/reset + sega8_cart_slot_device *m_slots[16]; + sega8_card_slot_device *m_cards[16]; + UINT8 m_store_control; + UINT8 m_store_cart_selection_data; + void store_post_load(); + void store_select_cart(UINT8 data); + + DECLARE_READ8_MEMBER(read_0000); + DECLARE_READ8_MEMBER(read_4000); + DECLARE_READ8_MEMBER(read_8000); + DECLARE_READ8_MEMBER(read_ram); + DECLARE_WRITE8_MEMBER(write_ram); + DECLARE_WRITE8_MEMBER(write_cart); + + DECLARE_READ8_MEMBER(sms_mapper_r); + DECLARE_WRITE8_MEMBER(sms_mapper_w); + DECLARE_WRITE8_MEMBER(sms_mem_control_w); + DECLARE_WRITE8_MEMBER(sms_io_control_w); + DECLARE_READ8_MEMBER(sms_count_r); + DECLARE_READ8_MEMBER(sms_input_port_dc_r); + DECLARE_READ8_MEMBER(sms_input_port_dd_r); + DECLARE_READ8_MEMBER(gg_input_port_00_r); + DECLARE_READ8_MEMBER(gg_sio_r); + DECLARE_WRITE8_MEMBER(gg_sio_w); + DECLARE_WRITE8_MEMBER(gg_psg_stereo_w); + DECLARE_WRITE8_MEMBER(gg_psg_w); + DECLARE_WRITE8_MEMBER(sms_psg_w); + DECLARE_READ8_MEMBER(sms_audio_control_r); + DECLARE_WRITE8_MEMBER(sms_audio_control_w); + DECLARE_WRITE8_MEMBER(sms_ym2413_register_port_w); + DECLARE_WRITE8_MEMBER(sms_ym2413_data_port_w); + DECLARE_READ8_MEMBER(sms_sscope_r); + DECLARE_WRITE8_MEMBER(sms_sscope_w); + + DECLARE_WRITE_LINE_MEMBER(sms_int_callback); + DECLARE_WRITE_LINE_MEMBER(sms_pause_callback); + DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input); + DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input); + DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input); + DECLARE_READ32_MEMBER(sms_pixel_color); + + DECLARE_DRIVER_INIT(sg1000m3); + DECLARE_DRIVER_INIT(gamegear); + DECLARE_DRIVER_INIT(gamegeaj); + DECLARE_DRIVER_INIT(sms1krfm); + DECLARE_DRIVER_INIT(sms1kr); + DECLARE_DRIVER_INIT(smskr); + DECLARE_DRIVER_INIT(smsj); + DECLARE_DRIVER_INIT(sms1); + DECLARE_MACHINE_START(sms); + DECLARE_MACHINE_RESET(sms); + DECLARE_VIDEO_START(gamegear); + DECLARE_VIDEO_RESET(gamegear); + DECLARE_VIDEO_START(sms1); + DECLARE_VIDEO_RESET(sms1); + + UINT32 screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void screen_vblank_sms1(screen_device &screen, bool state); + +protected: + UINT8 read_bus(address_space &space, unsigned int bank, UINT16 base_addr, UINT16 offset); + void setup_bios(); + void setup_media_slots(); + void setup_enabled_slots(); + void lphaser_hcount_latch(); + void sms_get_inputs(); +}; + +class smssdisp_state : public sms_state +{ +public: + smssdisp_state(const machine_config &mconfig, device_type type, const char *tag) + : sms_state(mconfig, type, tag), + m_control_cpu(*this, "control") + { } + + required_device m_control_cpu; + + DECLARE_READ8_MEMBER(sms_store_cart_select_r); + DECLARE_WRITE8_MEMBER(sms_store_cart_select_w); + DECLARE_WRITE8_MEMBER(sms_store_control_w); + DECLARE_DRIVER_INIT(smssdisp); + + DECLARE_READ8_MEMBER(store_cart_peek); + + DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback); +}; + + +/*----------- defined in machine/sms.c -----------*/ + +#define IO_EXPANSION (0x80) /* Expansion slot enable (1= disabled, 0= enabled) */ +#define IO_CARTRIDGE (0x40) /* Cartridge slot enable (1= disabled, 0= enabled) */ +#define IO_CARD (0x20) /* Card slot disabled (1= disabled, 0= enabled) */ +#define IO_WORK_RAM (0x10) /* Work RAM disabled (1= disabled, 0= enabled) */ +#define IO_BIOS_ROM (0x08) /* BIOS ROM disabled (1= disabled, 0= enabled) */ +#define IO_CHIP (0x04) /* I/O chip disabled (1= disabled, 0= enabled) */ + +#endif /* SMS_H_ */ diff --git a/src/mame/includes/softbox.h b/src/mame/includes/softbox.h new file mode 100644 index 00000000000..2ad510fa682 --- /dev/null +++ b/src/mame/includes/softbox.h @@ -0,0 +1,68 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Mike Naberezny +#pragma once + +#ifndef __SOFTBOX__ +#define __SOFTBOX__ + +#include "emu.h" +#include "bus/ieee488/ieee488.h" +#include "bus/imi7000/imi7000.h" +#include "cpu/z80/z80.h" +#include "imagedev/harddriv.h" +#include "machine/corvushd.h" +#include "machine/com8116.h" +#include "machine/i8251.h" +#include "machine/i8255.h" + +#define Z80_TAG "z80" +#define I8251_TAG "ic15" +#define I8255_0_TAG "ic17" +#define I8255_1_TAG "ic16" +#define COM8116_TAG "ic14" +#define RS232_TAG "rs232" +#define CORVUS_HDC_TAG "corvus" + +class softbox_state : public driver_device +{ +public: + softbox_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_dbrg(*this, COM8116_TAG), + m_ieee(*this, IEEE488_TAG), + m_hdc(*this, CORVUS_HDC_TAG) + { } + + required_device m_maincpu; + required_device m_dbrg; + required_device m_ieee; + required_device m_hdc; + + virtual void machine_start(); + virtual void device_reset_after_children(); + + // device_ieee488_interface overrides + virtual void ieee488_ifc(int state); + + DECLARE_WRITE8_MEMBER( dbrg_w ); + + DECLARE_READ8_MEMBER( ppi0_pa_r ); + DECLARE_WRITE8_MEMBER( ppi0_pb_w ); + + DECLARE_READ8_MEMBER( ppi1_pa_r ); + DECLARE_WRITE8_MEMBER( ppi1_pb_w ); + DECLARE_READ8_MEMBER( ppi1_pc_r ); + DECLARE_WRITE8_MEMBER( ppi1_pc_w ); + + enum + { + LED_A, + LED_B, + LED_READY + }; + + int m_ifc; // Tracks previous state of IEEE-488 IFC line +}; + +#endif diff --git a/src/mame/includes/sorcerer.h b/src/mame/includes/sorcerer.h new file mode 100644 index 00000000000..3cff01cdc38 --- /dev/null +++ b/src/mame/includes/sorcerer.h @@ -0,0 +1,110 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Robbbert +/***************************************************************************** + * + * includes/sorcerer.h + * + ****************************************************************************/ + +#ifndef SORCERER_H_ +#define SORCERER_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/dac.h" +#include "sound/wave.h" +#include "machine/ay31015.h" +#include "bus/centronics/ctronics.h" +#include "machine/ram.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "imagedev/flopdrv.h" +#include "formats/sorc_dsk.h" +#include "formats/sorc_cas.h" +#include "machine/micropolis.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define SORCERER_USING_RS232 0 + +struct cass_data_t { + struct { + int length; /* time cassette level is at input.level */ + int level; /* cassette level */ + int bit; /* bit being read */ + } input; + struct { + int length; /* time cassette level is at output.level */ + int level; /* cassette level */ + int bit; /* bit to output */ + } output; +}; + + +class sorcerer_state : public driver_device +{ +public: + enum + { + TIMER_SERIAL, + TIMER_CASSETTE, + TIMER_RESET + }; + + sorcerer_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cassette1(*this, "cassette") + , m_cassette2(*this, "cassette2") + , m_wave1(*this, WAVE_TAG) + , m_wave2(*this, WAVE2_TAG) + , m_uart(*this, "uart") + , m_centronics(*this, "centronics") + , m_cart(*this, "cartslot") + , m_ram(*this, RAM_TAG) + , m_iop_config(*this, "CONFIG") + , m_iop_vs(*this, "VS") + , m_iop_x(*this, "X") + { } + + DECLARE_READ8_MEMBER(sorcerer_fc_r); + DECLARE_READ8_MEMBER(sorcerer_fd_r); + DECLARE_READ8_MEMBER(sorcerer_fe_r); + DECLARE_WRITE8_MEMBER(sorcerer_fc_w); + DECLARE_WRITE8_MEMBER(sorcerer_fd_w); + DECLARE_WRITE8_MEMBER(sorcerer_fe_w); + DECLARE_WRITE8_MEMBER(sorcerer_ff_w); + DECLARE_MACHINE_START(sorcererd); + DECLARE_DRIVER_INIT(sorcerer); + TIMER_CALLBACK_MEMBER(sorcerer_serial_tc); + TIMER_CALLBACK_MEMBER(sorcerer_cassette_tc); + TIMER_CALLBACK_MEMBER(sorcerer_reset); + DECLARE_SNAPSHOT_LOAD_MEMBER( sorcerer ); + DECLARE_QUICKLOAD_LOAD_MEMBER( sorcerer); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +private: + UINT8 m_fe; + UINT8 m_keyboard_line; + const UINT8 *m_p_videoram; + emu_timer *m_serial_timer; + emu_timer *m_cassette_timer; + cass_data_t m_cass_data; + virtual void video_start(); + virtual void machine_start(); + virtual void machine_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + required_device m_maincpu; + required_device m_cassette1; + required_device m_cassette2; + required_device m_wave1; + required_device m_wave2; + required_device m_uart; + required_device m_centronics; + required_device m_cart; + required_device m_ram; + required_ioport m_iop_config; + required_ioport m_iop_vs; + required_ioport_array<16> m_iop_x; +}; + +#endif /* SORCERER_H_ */ diff --git a/src/mame/includes/special.h b/src/mame/includes/special.h new file mode 100644 index 00000000000..56350a8bbc7 --- /dev/null +++ b/src/mame/includes/special.h @@ -0,0 +1,153 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/special.h + * + ****************************************************************************/ + +#ifndef SPECIAL_H_ +#define SPECIAL_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/i8085/i8085.h" +#include "audio/specimx_snd.h" +#include "sound/dac.h" +#include "sound/wave.h" +#include "machine/i8255.h" +#include "machine/pit8253.h" +#include "imagedev/cassette.h" +#include "formats/smx_dsk.h" +#include "formats/rk_cas.h" +#include "machine/wd_fdc.h" +#include "machine/ram.h" + + +class special_state : public driver_device +{ +public: + enum + { + TIMER_RESET, + TIMER_PIT8253_GATES + }; + + special_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ppi(*this, "ppi8255"), + m_fdc(*this, "fd1793"), + m_dac(*this, "dac"), + m_pit(*this, "pit8253"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_p_videoram(*this, "p_videoram"), + m_region_maincpu(*this, "maincpu"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_bank5(*this, "bank5"), + m_bank6(*this, "bank6"), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_line4(*this, "LINE4"), + m_io_line5(*this, "LINE5"), + m_io_line6(*this, "LINE6"), + m_io_line7(*this, "LINE7"), + m_io_line8(*this, "LINE8"), + m_io_line9(*this, "LINE9"), + m_io_line10(*this, "LINE10"), + m_io_line11(*this, "LINE11"), + m_io_line12(*this, "LINE12"), + m_palette(*this, "palette") { } + + DECLARE_WRITE8_MEMBER(specimx_select_bank); + DECLARE_WRITE8_MEMBER(video_memory_w); + DECLARE_WRITE8_MEMBER(specimx_video_color_w); + DECLARE_READ8_MEMBER(specimx_video_color_r); + DECLARE_READ8_MEMBER(specimx_disk_ctrl_r); + DECLARE_WRITE8_MEMBER(specimx_disk_ctrl_w); + DECLARE_READ8_MEMBER(erik_rr_reg_r); + DECLARE_WRITE8_MEMBER(erik_rr_reg_w); + DECLARE_READ8_MEMBER(erik_rc_reg_r); + DECLARE_WRITE8_MEMBER(erik_rc_reg_w); + DECLARE_READ8_MEMBER(erik_disk_reg_r); + DECLARE_WRITE8_MEMBER(erik_disk_reg_w); + DECLARE_READ8_MEMBER(specialist_8255_porta_r); + DECLARE_READ8_MEMBER(specialist_8255_portb_r); + DECLARE_READ8_MEMBER(specimx_8255_portb_r); + DECLARE_READ8_MEMBER(specialist_8255_portc_r); + DECLARE_WRITE8_MEMBER(specialist_8255_porta_w); + DECLARE_WRITE8_MEMBER(specialist_8255_portb_w); + DECLARE_WRITE8_MEMBER(specialist_8255_portc_w); + void specimx_set_bank(offs_t i, UINT8 data); + void erik_set_bank(); + UINT8 *m_specimx_colorram; + UINT8 m_erik_color_1; + UINT8 m_erik_color_2; + UINT8 m_erik_background; + UINT8 m_specimx_color; + int m_specialist_8255_porta; + int m_specialist_8255_portb; + int m_specialist_8255_portc; + UINT8 m_RR_register; + UINT8 m_RC_register; + required_device m_maincpu; + optional_device m_ppi; + optional_device m_fdc; + optional_device m_dac; + optional_device m_pit; + optional_device m_cassette; + optional_device m_ram; + optional_shared_ptr m_p_videoram; + int m_drive; + DECLARE_DRIVER_INIT(erik); + DECLARE_DRIVER_INIT(special); + DECLARE_MACHINE_RESET(special); + DECLARE_VIDEO_START(special); + DECLARE_MACHINE_RESET(erik); + DECLARE_VIDEO_START(erik); + DECLARE_PALETTE_INIT(erik); + DECLARE_VIDEO_START(specialp); + DECLARE_MACHINE_START(specimx); + DECLARE_MACHINE_RESET(specimx); + DECLARE_VIDEO_START(specimx); + DECLARE_PALETTE_INIT(specimx); + UINT32 screen_update_special(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_specialp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_specimx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(fdc_drq); + DECLARE_FLOPPY_FORMATS( specimx_floppy_formats ); + +protected: + required_memory_region m_region_maincpu; + required_memory_bank m_bank1; + optional_memory_bank m_bank2; + optional_memory_bank m_bank3; + optional_memory_bank m_bank4; + optional_memory_bank m_bank5; + optional_memory_bank m_bank6; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_ioport m_io_line3; + required_ioport m_io_line4; + required_ioport m_io_line5; + required_ioport m_io_line6; + required_ioport m_io_line7; + required_ioport m_io_line8; + required_ioport m_io_line9; + required_ioport m_io_line10; + required_ioport m_io_line11; + required_ioport m_io_line12; + + required_device m_palette; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* SPECIAL_H_ */ diff --git a/src/mame/includes/spectrum.h b/src/mame/includes/spectrum.h new file mode 100644 index 00000000000..2706e8223c7 --- /dev/null +++ b/src/mame/includes/spectrum.h @@ -0,0 +1,262 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/***************************************************************************** + * + * includes/spectrum.h + * + ****************************************************************************/ + +#ifndef __SPECTRUM_H__ +#define __SPECTRUM_H__ + +#include "machine/upd765.h" +#include "sound/speaker.h" +#include "machine/ram.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +/* Spectrum crystals */ + +#define X1 XTAL_14MHz // Main clock (48k Spectrum) +#define X1_128_AMSTRAD 35469000 // Main clock (Amstrad 128K model, +2A?) +#define X1_128_SINCLAIR 17734475 // Main clock (Sinclair 128K model) + +#define X2 XTAL_4_433619MHz // PAL color subcarrier + +/* Spectrum screen size in pixels */ +#define SPEC_UNSEEN_LINES 16 /* Non-visible scanlines before first border + line. Some of these may be vertical retrace. */ +#define SPEC_TOP_BORDER 48 /* Number of border lines before actual screen */ +#define SPEC_DISPLAY_YSIZE 192 /* Vertical screen resolution */ +#define SPEC_BOTTOM_BORDER 56 /* Number of border lines at bottom of screen */ +#define SPEC_SCREEN_HEIGHT (SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE + SPEC_BOTTOM_BORDER) + +#define SPEC_LEFT_BORDER 48 /* Number of left hand border pixels */ +#define SPEC_DISPLAY_XSIZE 256 /* Horizontal screen resolution */ +#define SPEC_RIGHT_BORDER 48 /* Number of right hand border pixels */ +#define SPEC_SCREEN_WIDTH (SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE + SPEC_RIGHT_BORDER) + +#define SPEC_LEFT_BORDER_CYCLES 24 /* Cycles to display left hand border */ +#define SPEC_DISPLAY_XSIZE_CYCLES 128 /* Horizontal screen resolution */ +#define SPEC_RIGHT_BORDER_CYCLES 24 /* Cycles to display right hand border */ +#define SPEC_RETRACE_CYCLES 48 /* Cycles taken for horizonal retrace */ +#define SPEC_CYCLES_PER_LINE 224 /* Number of cycles to display a single line */ + +/* 128K machines take an extra 4 cycles per scan line - add this to retrace */ +#define SPEC128_UNSEEN_LINES 15 +#define SPEC128_RETRACE_CYCLES 52 +#define SPEC128_CYCLES_PER_LINE 228 + +/* Border sizes for TS2068. These are guesses based on the number of cycles + available per frame. */ +#define TS2068_TOP_BORDER 32 +#define TS2068_BOTTOM_BORDER 32 +#define TS2068_SCREEN_HEIGHT (TS2068_TOP_BORDER + SPEC_DISPLAY_YSIZE + TS2068_BOTTOM_BORDER) + +/* Double the border sizes to maintain ratio of screen to border */ +#define TS2068_LEFT_BORDER 96 /* Number of left hand border pixels */ +#define TS2068_DISPLAY_XSIZE 512 /* Horizontal screen resolution */ +#define TS2068_RIGHT_BORDER 96 /* Number of right hand border pixels */ +#define TS2068_SCREEN_WIDTH (TS2068_LEFT_BORDER + TS2068_DISPLAY_XSIZE + TS2068_RIGHT_BORDER) + +struct EVENT_LIST_ITEM +{ + /* driver defined ID for this write */ + int Event_ID; + /* driver defined data for this write */ + int Event_Data; + /* time at which this write occurred */ + int Event_Time; +}; + + +enum +{ + TIMEX_CART_NONE, + TIMEX_CART_DOCK, + TIMEX_CART_EXROM, + TIMEX_CART_HOME +}; + + +class spectrum_state : public driver_device +{ +public: + spectrum_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_video_ram(*this, "video_ram"), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_speaker(*this, "speaker"), + m_cart(*this, "cartslot"), + m_dock(*this, "dockslot"), + m_upd765(*this, "upd765"), + m_upd765_0(*this, "upd765:0"), + m_upd765_1(*this, "upd765:1"), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_line4(*this, "LINE4"), + m_io_line5(*this, "LINE5"), + m_io_line6(*this, "LINE6"), + m_io_line7(*this, "LINE7"), + m_io_nmi(*this, "NMI"), + m_io_config(*this, "CONFIG"), + m_io_joy_intf(*this, "JOY_INTF"), + m_io_kempston(*this, "KEMPSTON"), + m_io_fuller(*this, "FULLER"), + m_io_mikrogen(*this, "MIKROGEN"), + m_io_plus0(*this, "PLUS0"), + m_io_plus1(*this, "PLUS1"), + m_io_plus2(*this, "PLUS2"), + m_io_plus3(*this, "PLUS3"), + m_io_plus4(*this, "PLUS4") { } + + int m_port_fe_data; + int m_port_7ffd_data; + int m_port_1ffd_data; /* scorpion and plus3 */ + int m_port_ff_data; /* Display enhancement control */ + int m_port_f4_data; /* Horizontal Select Register */ + + int m_floppy; + + /* video support */ + int m_frame_invert_count; + int m_frame_number; /* Used for handling FLASH 1 */ + int m_flash_invert; + optional_shared_ptr m_video_ram; + UINT8 *m_screen_location; + + int m_ROMSelection; + + + EVENT_LIST_ITEM *m_pCurrentItem; + int m_NumEvents; + int m_TotalEvents; + char *m_pEventListBuffer; + int m_LastFrameStartTime; + int m_CyclesPerFrame; + + UINT8 *m_ram_0000; + UINT8 m_ram_disabled_by_beta; + DECLARE_WRITE8_MEMBER(spectrum_port_fe_w); + DECLARE_READ8_MEMBER(spectrum_port_fe_r); + DECLARE_READ8_MEMBER(spectrum_port_1f_r); + DECLARE_READ8_MEMBER(spectrum_port_7f_r); + DECLARE_READ8_MEMBER(spectrum_port_df_r); + DECLARE_READ8_MEMBER(spectrum_port_ula_r); + + DECLARE_WRITE8_MEMBER(spectrum_128_port_7ffd_w); + DECLARE_READ8_MEMBER(spectrum_128_ula_r); + + DECLARE_WRITE8_MEMBER(spectrum_plus3_port_3ffd_w); + DECLARE_READ8_MEMBER(spectrum_plus3_port_3ffd_r); + DECLARE_READ8_MEMBER(spectrum_plus3_port_2ffd_r); + DECLARE_WRITE8_MEMBER(spectrum_plus3_port_7ffd_w); + DECLARE_WRITE8_MEMBER(spectrum_plus3_port_1ffd_w); + + DECLARE_READ8_MEMBER(ts2068_port_f4_r); + DECLARE_WRITE8_MEMBER(ts2068_port_f4_w); + DECLARE_READ8_MEMBER(ts2068_port_ff_r); + DECLARE_WRITE8_MEMBER(ts2068_port_ff_w); + DECLARE_WRITE8_MEMBER(tc2048_port_ff_w); + + DECLARE_DRIVER_INIT(spectrum); + DECLARE_DRIVER_INIT(plus2); + DECLARE_DRIVER_INIT(plus3); + DECLARE_MACHINE_RESET(spectrum); + DECLARE_VIDEO_START(spectrum); + DECLARE_PALETTE_INIT(spectrum); + DECLARE_MACHINE_RESET(tc2048); + DECLARE_VIDEO_START(spectrum_128); + DECLARE_MACHINE_RESET(spectrum_128); + DECLARE_MACHINE_RESET(spectrum_plus3); + DECLARE_MACHINE_RESET(ts2068); + DECLARE_VIDEO_START(ts2068); + UINT32 screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_tc2048(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_ts2068(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_spectrum(screen_device &screen, bool state); + void screen_eof_timex(screen_device &screen, bool state); + INTERRUPT_GEN_MEMBER(spec_interrupt); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( spectrum_cart ); + + // for timex cart only + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( timex_cart ); + int m_dock_cart_type, m_ram_chunks; + memory_region *m_dock_crt; + + unsigned int m_previous_border_x, m_previous_border_y; + bitmap_ind16 m_border_bitmap; + unsigned int m_previous_screen_x, m_previous_screen_y; + bitmap_ind16 m_screen_bitmap; + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + void spectrum_128_update_memory(); + void spectrum_plus3_update_memory(); + void ts2068_update_memory(); + + DECLARE_SNAPSHOT_LOAD_MEMBER( spectrum ); + DECLARE_QUICKLOAD_LOAD_MEMBER( spectrum ); + + required_device m_maincpu; + +protected: + required_device m_cassette; + required_device m_ram; + required_device m_speaker; + optional_device m_cart; + optional_device m_dock; + optional_device m_upd765; + optional_device m_upd765_0; + optional_device m_upd765_1; + + // Regular spectrum ports; marked as optional because of other subclasses + optional_ioport m_io_line0; + optional_ioport m_io_line1; + optional_ioport m_io_line2; + optional_ioport m_io_line3; + optional_ioport m_io_line4; + optional_ioport m_io_line5; + optional_ioport m_io_line6; + optional_ioport m_io_line7; + optional_ioport m_io_nmi; + optional_ioport m_io_config; + optional_ioport m_io_joy_intf; + optional_ioport m_io_kempston; + optional_ioport m_io_fuller; + optional_ioport m_io_mikrogen; + // Plus ports + optional_ioport m_io_plus0; + optional_ioport m_io_plus1; + optional_ioport m_io_plus2; + optional_ioport m_io_plus3; + optional_ioport m_io_plus4; + + void spectrum_UpdateBorderBitmap(); + void spectrum_UpdateScreenBitmap(bool eof = false); + inline unsigned char get_display_color(unsigned char color, int invert); + inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines); + void ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor); + void ts2068_lores_scanline(bitmap_ind16 &bitmap, int y, int borderlines, int screen); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + + +/*----------- defined in drivers/spectrum.c -----------*/ + +INPUT_PORTS_EXTERN( spectrum ); +INPUT_PORTS_EXTERN( spec_plus ); + +MACHINE_CONFIG_EXTERN( spectrum ); + +/*----------- defined in drivers/spec128.c -----------*/ + +MACHINE_CONFIG_EXTERN( spectrum_128 ); + +#endif /* __SPECTRUM_H__ */ diff --git a/src/mame/includes/ssystem3.h b/src/mame/includes/ssystem3.h new file mode 100644 index 00000000000..0367a8acb67 --- /dev/null +++ b/src/mame/includes/ssystem3.h @@ -0,0 +1,84 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/ssystem3.h + * + ****************************************************************************/ + +#ifndef SSYSTEM3_H_ +#define SSYSTEM3_H_ + +#include "machine/6522via.h" + + +struct playfield_t +{ + int signal; + // int on; + + int count, bit, started; + UINT8 data; + attotime time, high_time, low_time; + union { + struct { + UINT8 header[7]; + UINT8 field[8][8/2]; + UINT8 unknown[5]; + } s; + UINT8 data[7+8*8/2+5]; + } u; +}; + +struct lcd_t +{ + UINT8 data[5]; + int clock; + int count; +}; + + +class ssystem3_state : public driver_device +{ +public: + ssystem3_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_palette(*this, "palette") + , m_via6522_0(*this, "via6522_0") + , m_configuration(*this, "Configuration") + , m_matrix(*this, "matrix") + { } + + DECLARE_DRIVER_INIT(ssystem3); + virtual void video_start(); + DECLARE_PALETTE_INIT(ssystem3); + UINT32 screen_update_ssystem3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE8_MEMBER(ssystem3_via_write_a); + DECLARE_READ8_MEMBER(ssystem3_via_read_a); + DECLARE_READ8_MEMBER(ssystem3_via_read_b); + DECLARE_WRITE8_MEMBER(ssystem3_via_write_b); + void ssystem3_lcd_reset(); + void ssystem3_lcd_write(int clock, int data); + void ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y); + void ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch); + void ssystem3_playfield_getfigure(int x, int y, int *figure, int *black); + void ssystem3_playfield_reset(); + void ssystem3_playfield_write(int reset, int signal); + void ssystem3_playfield_read(int *on, int *ready); + +private: + UINT8 m_porta; + UINT8 *m_videoram; + playfield_t m_playfield; + lcd_t m_lcd; + + required_device m_maincpu; + required_device m_palette; + required_device m_via6522_0; + required_ioport m_configuration; + required_ioport_array<4> m_matrix; +}; + + +#endif /* SSYSTEM3_H_ */ diff --git a/src/mame/includes/super6.h b/src/mame/includes/super6.h new file mode 100644 index 00000000000..9367decda25 --- /dev/null +++ b/src/mame/includes/super6.h @@ -0,0 +1,89 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __SUPER6__ +#define __SUPER6__ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/com8116.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/z80dma.h" +#include "machine/z80pio.h" + +#define Z80_TAG "u30" +#define Z80CTC_TAG "u20" +#define Z80DART_TAG "u38" +#define Z80DMA_TAG "u21" +#define Z80PIO_TAG "u7" +#define WD2793_TAG "u27" +#define BR1945_TAG "u31" +#define SCREEN_TAG "screen" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" + +class super6_state : public driver_device +{ +public: + super6_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ctc(*this, Z80CTC_TAG), + m_dart(*this, Z80DART_TAG), + m_dma(*this, Z80DMA_TAG), + m_pio(*this, Z80PIO_TAG), + m_fdc(*this, WD2793_TAG), + m_brg(*this, BR1945_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, WD2793_TAG":0"), + m_floppy1(*this, WD2793_TAG":1"), + m_rom(*this, Z80_TAG), + m_j7(*this, "J7") + { } + + required_device m_maincpu; + required_device m_ctc; + required_device m_dart; + required_device m_dma; + required_device m_pio; + required_device m_fdc; + required_device m_brg; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_region_ptr m_rom; + required_ioport m_j7; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( fdc_r ); + DECLARE_WRITE8_MEMBER( fdc_w ); + DECLARE_WRITE8_MEMBER( s100_w ); + DECLARE_WRITE8_MEMBER( bank0_w ); + DECLARE_WRITE8_MEMBER( bank1_w ); + DECLARE_WRITE8_MEMBER( baud_w ); + DECLARE_WRITE_LINE_MEMBER( fr_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + + void bankswitch(); + + // memory state + UINT8 m_s100; + UINT8 m_bank0; + UINT8 m_bank1; + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + DECLARE_WRITE8_MEMBER(dummy_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); +}; + +#endif diff --git a/src/mame/includes/super80.h b/src/mame/includes/super80.h new file mode 100644 index 00000000000..30813f31015 --- /dev/null +++ b/src/mame/includes/super80.h @@ -0,0 +1,123 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "sound/wave.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "video/mc6845.h" +#include "machine/z80pio.h" +#include "machine/z80dma.h" +#include "machine/wd_fdc.h" + + +/* Bits in m_portf0 variable: + d5 cassette LED + d4 super80v rom or pcg bankswitch (1=pcg ram, 0=char gen rom) + d2 super80v video or colour bankswitch (1=video ram, 0=colour ram) + d2 super80 screen off (=2mhz) or on (bursts of 2mhz at 50hz = 1mhz) */ + +class super80_state : public driver_device +{ +public: + super80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_pio(*this, "z80pio") + , m_cassette(*this, "cassette") + , m_wave(*this, WAVE_TAG) + , m_speaker(*this, "speaker") + , m_centronics(*this, "centronics") + , m_cent_data_out(*this, "cent_data_out") + , m_io_dsw(*this, "DSW") + , m_io_config(*this, "CONFIG") + , m_io_keyboard(*this, "KEY") + , m_crtc(*this, "crtc") + , m_dma(*this, "dma") + , m_fdc (*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + { } + + DECLARE_READ8_MEMBER(super80v_low_r); + DECLARE_READ8_MEMBER(super80v_high_r); + DECLARE_WRITE8_MEMBER(super80v_low_w); + DECLARE_WRITE8_MEMBER(super80v_high_w); + DECLARE_WRITE8_MEMBER(super80v_10_w); + DECLARE_WRITE8_MEMBER(super80v_11_w); + DECLARE_READ8_MEMBER(port3e_r); + DECLARE_WRITE8_MEMBER(port3f_w); + DECLARE_WRITE8_MEMBER(super80_f1_w); + DECLARE_READ8_MEMBER(super80_dc_r); + DECLARE_READ8_MEMBER(super80_f2_r); + DECLARE_WRITE8_MEMBER(super80_dc_w); + DECLARE_WRITE8_MEMBER(super80_f0_w); + DECLARE_WRITE8_MEMBER(super80r_f0_w); + DECLARE_READ8_MEMBER(super80_read_ff); + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + DECLARE_WRITE8_MEMBER(pio_port_a_w); + DECLARE_READ8_MEMBER(pio_port_b_r); + DECLARE_DRIVER_INIT(super80); + DECLARE_VIDEO_START(super80); + DECLARE_VIDEO_START(super80v); + DECLARE_PALETTE_INIT(super80m); + DECLARE_QUICKLOAD_LOAD_MEMBER(super80); + MC6845_UPDATE_ROW(crtc_update_row); + UINT32 screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_super80d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_super80m(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(super80_reset); + TIMER_DEVICE_CALLBACK_MEMBER(timer_h); + TIMER_DEVICE_CALLBACK_MEMBER(timer_k); + TIMER_DEVICE_CALLBACK_MEMBER(timer_p); + UINT8 m_s_options; + UINT8 m_portf0; + UINT8 *m_p_videoram; + UINT8 *m_p_colorram; + UINT8 *m_p_pcgram; + UINT8 m_mc6845_cursor[16]; + UINT8 m_palette_index; + required_device m_palette; +private: + virtual void machine_reset(); + UINT8 m_keylatch; + UINT8 m_cass_data[4]; + UINT8 m_int_sw; + UINT8 m_last_data; + UINT8 m_key_pressed; + UINT16 m_vidpg; + UINT8 m_current_charset; + const UINT8 *m_p_chargen; + UINT8 m_mc6845_reg[32]; + UINT8 m_mc6845_ind; + UINT8 *m_p_ram; + void mc6845_cursor_configure(); + void super80_cassette_motor(UINT8 data); + required_device m_maincpu; + required_device m_pio; + required_device m_cassette; + required_device m_wave; + required_device m_speaker; + required_device m_centronics; + required_device m_cent_data_out; + required_ioport m_io_dsw; + required_ioport m_io_config; + required_ioport_array<8> m_io_keyboard; + optional_device m_crtc; + optional_device m_dma; + optional_device m_fdc; + optional_device m_floppy0; + optional_device m_floppy1; +}; diff --git a/src/mame/includes/superslave.h b/src/mame/includes/superslave.h new file mode 100644 index 00000000000..cfdc2f5d51d --- /dev/null +++ b/src/mame/includes/superslave.h @@ -0,0 +1,75 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __SUPERSLAVE__ +#define __SUPERSLAVE__ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/com8116.h" +#include "machine/pic8259.h" +#include "machine/ram.h" +#include "machine/z80dart.h" +#include "machine/z80pio.h" + +#define Z80_TAG "u45" +#define Z80DART_0_TAG "u14" +#define Z80DART_1_TAG "u30" +#define Z80PIO_TAG "u43" +#define AM9519_TAG "u13" +#define BR1941_TAG "u12" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" +#define RS232_C_TAG "rs232c" +#define RS232_D_TAG "rs232d" + +class superslave_state : public driver_device +{ +public: + superslave_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_dart0(*this, Z80DART_0_TAG), + m_dart1(*this, Z80DART_1_TAG), + m_dbrg(*this, BR1941_TAG), + m_ram(*this, RAM_TAG), + m_rs232a(*this, RS232_A_TAG), + m_rs232b(*this, RS232_B_TAG), + m_rs232c(*this, RS232_C_TAG), + m_rs232d(*this, RS232_D_TAG), + m_rom(*this, Z80_TAG), + m_memctrl(0x01), + m_cmd(0x01) + { } + + required_device m_maincpu; + required_device m_dart0; + required_device m_dart1; + required_device m_dbrg; + required_device m_ram; + required_device m_rs232a; + required_device m_rs232b; + required_device m_rs232c; + required_device m_rs232d; + required_memory_region m_rom; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_WRITE8_MEMBER( baud_w ); + DECLARE_WRITE8_MEMBER( memctrl_w ); + DECLARE_READ8_MEMBER( status_r ); + DECLARE_WRITE8_MEMBER( cmd_w ); + + DECLARE_WRITE_LINE_MEMBER( fr_w ); + DECLARE_WRITE_LINE_MEMBER( ft_w ); + + UINT8 m_memctrl; + UINT8 m_cmd; +}; + +#endif diff --git a/src/mame/includes/svi318.h b/src/mame/includes/svi318.h new file mode 100644 index 00000000000..a699f6e9bfb --- /dev/null +++ b/src/mame/includes/svi318.h @@ -0,0 +1,159 @@ +// license:??? +// copyright-holders:Sean Young,Tomas Karlsson +/***************************************************************************** + * + * includes/svi318.h + * + * Spectravideo SVI-318 and SVI-328 + * + ****************************************************************************/ + +#ifndef SVI318_H_ +#define SVI318_H_ + +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/ins8250.h" +#include "machine/wd_fdc.h" +#include "machine/ram.h" +#include "machine/buffer.h" +#include "imagedev/cassette.h" +#include "sound/dac.h" +#include "sound/ay8910.h" +#include "sound/wave.h" +#include "video/mc6845.h" +#include "video/tms9928a.h" +#include "bus/centronics/ctronics.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class svi318_state : public driver_device +{ +public: + svi318_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_dac(*this, "dac"), + m_ppi(*this, "ppi8255"), + m_ram(*this, RAM_TAG), + m_centronics(*this, "centronics"), + m_cent_data_out(*this, "cent_data_out"), + m_ins8250_0(*this, "ins8250_0"), + m_ins8250_1(*this, "ins8250_1"), + m_cart(*this, "cartslot"), + m_fd1793(*this, "wd179x"), + m_floppy0(*this, "wd179x:0"), + m_floppy1(*this, "wd179x:1"), + m_crtc(*this, "crtc"), + m_line(*this, "LINE"), + m_joysticks(*this, "JOYSTICKS"), + m_buttons(*this, "BUTTONS"), + m_palette(*this, "palette"), + m_floppy(NULL), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4") + { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + // FDC + int m_drq; + int m_irq; + + DECLARE_WRITE8_MEMBER(ppi_w); + DECLARE_READ8_MEMBER(psg_port_a_r); + DECLARE_WRITE8_MEMBER(psg_port_b_w); + DECLARE_WRITE8_MEMBER(fdc_drive_motor_w); + DECLARE_WRITE8_MEMBER(fdc_density_side_w); + DECLARE_READ8_MEMBER(fdc_irqdrq_r); + DECLARE_WRITE8_MEMBER(svi806_ram_enable_w); + DECLARE_WRITE8_MEMBER(writemem1); + DECLARE_WRITE8_MEMBER(writemem2); + DECLARE_WRITE8_MEMBER(writemem3); + DECLARE_WRITE8_MEMBER(writemem4); + DECLARE_READ8_MEMBER(io_ext_r); + DECLARE_WRITE8_MEMBER(io_ext_w); + DECLARE_DRIVER_INIT(svi318); + DECLARE_DRIVER_INIT(svi328_806); + DECLARE_WRITE_LINE_MEMBER(vdp_interrupt); + DECLARE_WRITE_LINE_MEMBER(ins8250_interrupt); + DECLARE_READ8_MEMBER(ppi_port_a_r); + DECLARE_READ8_MEMBER(ppi_port_b_r); + DECLARE_WRITE8_MEMBER(ppi_port_c_w); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + bool cart_verify(UINT8 *ROM); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(svi318_cart); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + + virtual void machine_start(); + virtual void machine_reset(); + + MC6845_UPDATE_ROW(crtc_update_row); + memory_region *m_cart_rom; + memory_region *m_bios_rom; + +protected: + required_device m_maincpu; + required_device m_cassette; + required_device m_dac; + required_device m_ppi; + required_device m_ram; + required_device m_centronics; + required_device m_cent_data_out; + required_device m_ins8250_0; + required_device m_ins8250_1; + required_device m_cart; + required_device m_fd1793; + required_device m_floppy0; + required_device m_floppy1; + optional_device m_crtc; + required_ioport_array<11> m_line; + required_ioport m_joysticks; + required_ioport m_buttons; + optional_device m_palette; + +private: + + void set_banks(); + void postload(); + + // memory banking + UINT8 m_bank_switch; + UINT8 m_bank_low; + UINT8 m_bank_high; + + UINT8 m_bank_low_read_only; + UINT8 m_bank_high1_read_only; + UINT8 m_bank_high2_read_only; + + UINT8 *m_empty_bank; + UINT8 *m_bank_low_ptr; + UINT8 *m_bank_high1_ptr; + UINT8 *m_bank_high2_ptr; + + // keyboard + UINT8 m_keyboard_row; + + floppy_image_device *m_floppy; + + // centronics + int m_centronics_busy; + + // SVI-806 80 column card + UINT8 m_svi806_present; + UINT8 m_svi806_ram_enabled; + dynamic_buffer m_svi806_ram; + UINT8 *m_svi806_gfx; + + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + optional_memory_bank m_bank4; +}; + +#endif /* SVI318_H_ */ diff --git a/src/mame/includes/svision.h b/src/mame/includes/svision.h new file mode 100644 index 00000000000..ab8ff9583e7 --- /dev/null +++ b/src/mame/includes/svision.h @@ -0,0 +1,92 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * includes/svision.h + * + ****************************************************************************/ + +#ifndef SVISION_H_ +#define SVISION_H_ + +#include "cpu/m6502/m65c02.h" +#include "audio/svis_snd.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +struct svision_t +{ + emu_timer *timer1; + int timer_shot; +}; + +struct svision_pet_t +{ + int state; + int on, clock, data; + UINT8 input; + emu_timer *timer; +}; + +struct tvlink_t +{ + UINT32 palette[4/*0x40?*/]; /* rgb8 */ + int palette_on; +}; + +class svision_state : public driver_device +{ +public: + svision_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_sound(*this, "custom"), + m_cart(*this, "cartslot"), + m_reg(*this, "reg"), + m_videoram(*this, "videoram"), + m_joy(*this, "JOY"), + m_joy2(*this, "JOY2"), + m_palette(*this, "palette") { } + + int *m_dma_finished; + svision_t m_svision; + svision_pet_t m_pet; + tvlink_t m_tvlink; + + DECLARE_READ8_MEMBER(svision_r); + DECLARE_WRITE8_MEMBER(svision_w); + DECLARE_READ8_MEMBER(tvlink_r); + DECLARE_WRITE8_MEMBER(tvlink_w); + DECLARE_DRIVER_INIT(svisions); + DECLARE_DRIVER_INIT(svision); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(svision); + DECLARE_PALETTE_INIT(svisionp); + DECLARE_PALETTE_INIT(svisionn); + DECLARE_MACHINE_RESET(tvlink); + UINT32 screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_tvlink(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(svision_frame_int); + TIMER_CALLBACK_MEMBER(svision_pet_timer); + TIMER_CALLBACK_MEMBER(svision_timer); + TIMER_DEVICE_CALLBACK_MEMBER(svision_pet_timer_dev); + void svision_irq(); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(svision_cart); + +protected: + required_device m_maincpu; + required_device m_sound; + required_device m_cart; + required_shared_ptr m_reg; + required_shared_ptr m_videoram; + required_ioport m_joy; + optional_ioport m_joy2; + required_device m_palette; + + memory_region *m_cart_rom; + memory_bank *m_bank1; + memory_bank *m_bank2; +}; + +#endif /* SVISION_H_ */ diff --git a/src/mame/includes/swtpc09.h b/src/mame/includes/swtpc09.h new file mode 100644 index 00000000000..222ffe5c11a --- /dev/null +++ b/src/mame/includes/swtpc09.h @@ -0,0 +1,150 @@ +// license:BSD-3-Clause +// copyright-holders:Robert Justice +/*************************************************************************** + swtpc09 include file + Robert Justice ,2009-2014 + +****************************************************************************/ + +#ifndef swtpc09_H_ +#define swtpc09_H_ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "video/generic.h" +#include "machine/wd_fdc.h" +#include "imagedev/flopdrv.h" +#include "machine/6840ptm.h" +#include "machine/6821pia.h" +#include "machine/6850acia.h" +#include "machine/6522via.h" +#include "machine/terminal.h" +#include "imagedev/harddriv.h" +#include "machine/idectrl.h" +#include "machine/clock.h" +#include "bus/rs232/rs232.h" + + + +class swtpc09_state : public driver_device +{ +public: + swtpc09_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_pia(*this, "pia"), + m_ptm(*this, "ptm"), + m_acia(*this, "acia"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_floppy2(*this, "fdc:2"), + m_floppy3(*this, "fdc:3"), + m_via(*this, "via"), + m_piaide(*this, "piaide"), + m_harddisk(*this, "harddisk"), + m_ide(*this, "ide") + { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_maincpu; + required_device m_pia; + required_device m_ptm; + required_device m_acia; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + optional_device m_via; + optional_device m_piaide; + optional_device m_harddisk; + optional_device m_ide; + + DECLARE_READ8_MEMBER(pia0_a_r); + DECLARE_READ8_MEMBER(pia0_ca1_r); + DECLARE_WRITE_LINE_MEMBER( pia0_irq_a ); + + DECLARE_WRITE8_MEMBER( ptm_o1_callback ); + DECLARE_WRITE8_MEMBER( ptm_o3_callback ); + DECLARE_WRITE_LINE_MEMBER( ptm_irq ); + + DECLARE_WRITE_LINE_MEMBER( acia_interrupt ); + DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); + + DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + + DECLARE_READ8_MEMBER( dmf3_via_read_porta ); + DECLARE_READ8_MEMBER( dmf3_via_read_portb ); + DECLARE_WRITE8_MEMBER( dmf3_via_write_porta ); + DECLARE_WRITE_LINE_MEMBER( dmf3_via_write_ca1 ); + DECLARE_WRITE_LINE_MEMBER( dmf3_via_irq ); + + DECLARE_READ8_MEMBER(piaide_a_r); + DECLARE_READ8_MEMBER(piaide_b_r); + DECLARE_WRITE8_MEMBER(piaide_a_w); + DECLARE_WRITE8_MEMBER(piaide_b_w); + + DECLARE_WRITE8_MEMBER(swtpc09_kbd_put); + + DECLARE_READ8_MEMBER ( dmf2_dma_address_reg_r ); + DECLARE_WRITE8_MEMBER ( dmf2_dma_address_reg_w ); + DECLARE_READ8_MEMBER ( dmf2_control_reg_r ); + DECLARE_WRITE8_MEMBER ( dmf2_control_reg_w ); + + DECLARE_READ8_MEMBER ( dmf3_dma_address_reg_r ); + DECLARE_WRITE8_MEMBER ( dmf3_dma_address_reg_w ); + DECLARE_READ8_MEMBER ( dmf3_control_reg_r ); + DECLARE_WRITE8_MEMBER ( dmf3_control_reg_w ); + + DECLARE_WRITE8_MEMBER ( dc4_control_reg_w ); + + DECLARE_WRITE8_MEMBER(dat_w); + + DECLARE_DRIVER_INIT( swtpc09 ); + DECLARE_DRIVER_INIT( swtpc09i ); + DECLARE_DRIVER_INIT( swtpc09u ); + DECLARE_DRIVER_INIT( swtpc09d3 ); + + void swtpc09_fdc_dma_transfer(); + void swtpc09_irq_handler(UINT8 peripheral, UINT8 state); + + UINT8 m_term_data; // terminal keyboard value + UINT8 m_pia_counter; // this is the counter on pia porta + UINT8 m_fdc_dma_address_reg; // dmf2 or dmf3 dma extended address reg + UINT8 m_system_type; // flag to indicate hw and rom combination + UINT8 m_fdc_status; // for floppy controller + UINT8 m_via_ca1_input; // dmf3 fdc interupt is connected here + UINT8 m_dmf3_via_porta; + UINT8 m_piaide_porta; + UINT8 m_piaide_portb; + UINT8 m_active_interrupt; + UINT8 m_interrupt; + + + // TODO: move this in proper device + + /* channel_data structure holds info about each 6844 DMA channel */ + typedef struct m6844_channel_data + { + int active; + int address; + int counter; + UINT8 control; + int start_address; + int start_counter; + } m6844_channel_data; + + /* 6844 description */ + m6844_channel_data m_m6844_channel[4]; + UINT8 m_m6844_priority; + UINT8 m_m6844_interrupt; + UINT8 m_m6844_chain; + DECLARE_READ8_MEMBER ( m6844_r ); + DECLARE_WRITE8_MEMBER ( m6844_w ); + +}; + +#endif /* swtpc09_H_ */ diff --git a/src/mame/includes/tandy2k.h b/src/mame/includes/tandy2k.h new file mode 100644 index 00000000000..761d2f0cb37 --- /dev/null +++ b/src/mame/includes/tandy2k.h @@ -0,0 +1,229 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __TANDY2K__ +#define __TANDY2K__ + +#include "emu.h" +#include "bus/centronics/ctronics.h" +#include "bus/rs232/rs232.h" +#include "cpu/i86/i186.h" +#include "cpu/mcs48/mcs48.h" +#include "formats/tandy2k_dsk.h" +#include "imagedev/harddriv.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/ram.h" +#include "machine/tandy2kb.h" +#include "machine/upd765.h" +#include "sound/speaker.h" +#include "video/crt9007.h" +#include "video/crt9021.h" +#include "video/crt9212.h" + +#define SCREEN_TAG "screen" +#define I80186_TAG "u76" +#define I8255A_TAG "u75" +#define I8251A_TAG "u41" +#define I8253_TAG "u40" +#define I8259A_0_TAG "u42" +#define I8259A_1_TAG "u43" +#define I8272A_TAG "u121" +#define CRT9007_TAG "u16" +#define CRT9212_0_TAG "u55" +#define CRT9212_1_TAG "u15" +#define CRT9021B_TAG "u14" +#define WD1010_TAG "u18" +#define WD1100_11_TAG "u12" +#define CENTRONICS_TAG "centronics" +#define RS232_TAG "rs232" + +class tandy2k_state : public driver_device +{ +public: + tandy2k_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, I80186_TAG), + m_uart(*this, I8251A_TAG), + m_i8255a(*this, I8255A_TAG), + m_pit(*this, I8253_TAG), + m_fdc(*this, I8272A_TAG), + m_pic0(*this, I8259A_0_TAG), + m_pic1(*this, I8259A_1_TAG), + m_vpac(*this, CRT9007_TAG), + m_drb0(*this, CRT9212_0_TAG), + m_drb1(*this, CRT9212_1_TAG), + m_vac(*this, CRT9021B_TAG), + m_palette(*this, "palette"), + m_timer_vidldsh(*this, "vidldsh"), + m_centronics(*this, CENTRONICS_TAG), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG), + m_floppy0(*this, I8272A_TAG ":0:525qd"), + m_floppy1(*this, I8272A_TAG ":1:525qd"), + m_rs232(*this, RS232_TAG), + m_kb(*this, TANDY2K_KEYBOARD_TAG), + m_hires_ram(*this, "hires_ram"), + m_char_ram(*this, "char_ram"), + m_dma_mux(0), + m_kbdclk(0), + m_kbddat(0), + m_kbdin(0), + m_extclk(0), + m_rxrdy(0), + m_txrdy(0), + m_pb_sel(0), + m_vram_base(0), + m_vidouts(0), + m_clkspd(-1), + m_clkcnt(-1), + m_blc(0), + m_bkc(0), + m_cblank(0), + m_dblc(0), + m_dbkc(0), + m_dblank(0), + m_slg(0), + m_sld(0), + m_cgra(0), + m_vidla(0), + m_outspkr(0), + m_spkrdata(0), + m_centronics_ack(0), + m_centronics_fault(0), + m_centronics_select(0), + m_centronics_perror(0), + m_centronics_busy(0) + { + for (int i = 0; i < 4; i++) + { + m_busdmarq[i] = CLEAR_LINE; + } + } + + required_device m_maincpu; + required_device m_uart; + required_device m_i8255a; + required_device m_pit; + required_device m_fdc; + required_device m_pic0; + required_device m_pic1; + required_device m_vpac; + required_device m_drb0; + required_device m_drb1; + required_device m_vac; + required_device m_palette; + required_device m_timer_vidldsh; + required_device m_centronics; + required_device m_speaker; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_rs232; + required_device m_kb; + required_shared_ptr m_hires_ram; + optional_shared_ptr m_char_ram; + + virtual void machine_start(); + virtual void device_reset_after_children(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void update_drq(); + void dma_request(int line, int state); + void speaker_update(); + + DECLARE_READ8_MEMBER( char_ram_r ); + DECLARE_WRITE8_MEMBER( char_ram_w ); + DECLARE_READ8_MEMBER( videoram_r ); + DECLARE_READ8_MEMBER( enable_r ); + DECLARE_WRITE8_MEMBER( enable_w ); + DECLARE_WRITE8_MEMBER( dma_mux_w ); + DECLARE_READ8_MEMBER( kbint_clr_r ); + DECLARE_READ16_MEMBER( vpac_r ); + DECLARE_WRITE16_MEMBER( vpac_w ); + DECLARE_READ8_MEMBER( fldtc_r ); + DECLARE_WRITE8_MEMBER( fldtc_w ); + DECLARE_WRITE8_MEMBER( addr_ctrl_w ); + DECLARE_WRITE_LINE_MEMBER( rxrdy_w ); + DECLARE_WRITE_LINE_MEMBER( txrdy_w ); + DECLARE_WRITE_LINE_MEMBER( outspkr_w ); + DECLARE_WRITE_LINE_MEMBER( intbrclk_w ); + DECLARE_WRITE_LINE_MEMBER( rfrqpulse_w ); + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + DECLARE_WRITE_LINE_MEMBER( vpac_vlt_w ); + DECLARE_WRITE_LINE_MEMBER( vpac_drb_w ); + DECLARE_WRITE_LINE_MEMBER( vpac_wben_w ); + DECLARE_WRITE_LINE_MEMBER( vpac_cblank_w ); + DECLARE_WRITE_LINE_MEMBER( vpac_slg_w ); + DECLARE_WRITE_LINE_MEMBER( vpac_sld_w ); + DECLARE_WRITE8_MEMBER( vidla_w ); + DECLARE_WRITE8_MEMBER( drb_attr_w ); + DECLARE_WRITE_LINE_MEMBER( kbdclk_w ); + DECLARE_WRITE_LINE_MEMBER( kbddat_w ); + DECLARE_READ8_MEMBER( irq_callback ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_hdl_w ); + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + DECLARE_WRITE_LINE_MEMBER(write_centronics_select); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + CRT9021_DRAW_CHARACTER_MEMBER( vac_draw_character ); + TIMER_DEVICE_CALLBACK_MEMBER( vidldsh_tick ); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + enum + { + LPINEN = 0, + KBDINEN, + PORTINEN + }; + + /* DMA state */ + UINT8 m_dma_mux; + int m_busdmarq[4]; + + /* keyboard state */ + int m_kbdclk; + int m_kbddat; + UINT8 m_kbdin; + + /* serial state */ + int m_extclk; + int m_rxrdy; + int m_txrdy; + + /* PPI state */ + int m_pb_sel; + + /* video state */ + UINT8 m_vram_base; + int m_vidouts; + int m_clkspd; + int m_clkcnt; + int m_blc; + int m_bkc; + int m_cblank; + UINT8 m_dblc; + UINT8 m_dbkc; + UINT8 m_dblank; + int m_slg; + int m_sld; + UINT8 m_cgra; + UINT8 m_vidla; + + /* sound state */ + int m_outspkr; + int m_spkrdata; + + int m_centronics_ack; + int m_centronics_fault; + int m_centronics_select; + int m_centronics_perror; + int m_centronics_busy; +}; + +#endif diff --git a/src/mame/includes/tdv2324.h b/src/mame/includes/tdv2324.h new file mode 100644 index 00000000000..7a2aaf91a22 --- /dev/null +++ b/src/mame/includes/tdv2324.h @@ -0,0 +1,87 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder,Jonathan Gevaryahu +#pragma once + +#ifndef __TDV2324__ +#define __TDV2324__ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "cpu/m6800/m6800.h" +#include "imagedev/harddriv.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "machine/z80dart.h" +#include "video/tms9927.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define P8085AH_0_TAG "17f" +#define P8259A_TAG "17d" +#define P8253_5_0_TAG "17c" +#define P8253_5_1_TAG "18c" +#define ER3400_TAG "12a" + +#define P8085AH_1_TAG "6c" +#define TMS9937NL_TAG "7e" +#define MK3887N4_TAG "15d" + +#define MC68B02P_TAG "12b" +#define FD1797PL02_TAG "fd1797" + +#define SCREEN_TAG "screen" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class tdv2324_state : public driver_device +{ +public: + tdv2324_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, P8085AH_0_TAG), + m_subcpu(*this, P8085AH_1_TAG), + m_fdccpu(*this, MC68B02P_TAG), + m_sio(*this, MK3887N4_TAG), + m_pic(*this, P8259A_TAG), + m_pit0(*this, P8253_5_0_TAG), + m_pit1(*this, P8253_5_1_TAG), + m_tms(*this, TMS9937NL_TAG), + m_video_ram(*this, "video_ram") + { } + + required_device m_maincpu; + required_device m_subcpu; + required_device m_fdccpu; + required_device m_sio; + required_device m_pic; + required_device m_pit0; + required_device m_pit1; + required_device m_tms; + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( tdv2324_main_io_30 ); + DECLARE_READ8_MEMBER( tdv2324_main_io_e6 ); + DECLARE_WRITE8_MEMBER( tdv2324_main_io_e2 ); + + UINT8 m_sub_status; + UINT8 m_sub_data; + + // video state + required_shared_ptr m_video_ram; +}; + + +#endif diff --git a/src/mame/includes/tek405x.h b/src/mame/includes/tek405x.h new file mode 100644 index 00000000000..f2a70fbd86e --- /dev/null +++ b/src/mame/includes/tek405x.h @@ -0,0 +1,162 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __TEK405X__ +#define __TEK405X__ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "machine/ram.h" +#include "machine/6821pia.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "bus/ieee488/ieee488.h" +#include "machine/ram.h" +#include "sound/speaker.h" +#include "video/vector.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define MC6800_TAG "u61" +#define MC6820_Y_TAG "u561" +#define MC6820_X_TAG "u565" +#define MC6820_TAPE_TAG "u361" +#define MC6820_KB_TAG "u461" +#define MC6820_GPIB_TAG "u265" +#define MC6820_COM_TAG "u5" +#define MC6850_TAG "u25" +#define RS232_TAG "rs232" +#define SCREEN_TAG "screen" + +#define AM2901A_TAG "am2901a" + +class tek4051_state : public driver_device +{ +public: + tek4051_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, MC6800_TAG), + m_gpib_pia(*this, MC6820_GPIB_TAG), + m_com_pia(*this, MC6820_COM_TAG), + m_acia(*this, MC6850_TAG), + m_acia_clock(*this, "acia_clock"), + m_gpib(*this, IEEE488_TAG), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG), + m_rom(*this, MC6800_TAG), + m_bsofl_rom(*this, "020_0147_00"), + m_bscom_rom(*this, "021_0188_00"), + m_special(*this, "SPECIAL") + { + } + + required_device m_maincpu; + required_device m_gpib_pia; + required_device m_com_pia; + required_device m_acia; + required_device m_acia_clock; + required_device m_gpib; + required_device m_speaker; + required_device m_ram; + required_memory_region m_rom; + required_memory_region m_bsofl_rom; + required_memory_region m_bscom_rom; + required_ioport m_special; + + virtual void machine_start(); + + virtual void video_start(); + + void bankswitch(UINT8 data); + void update_irq(); + void update_nmi(); + void scan_keyboard(); + + DECLARE_WRITE8_MEMBER( lbs_w ); + + DECLARE_READ8_MEMBER( x_pia_pa_r ); + DECLARE_WRITE8_MEMBER( x_pia_pa_w ); + DECLARE_WRITE8_MEMBER( x_pia_pb_w ); + DECLARE_WRITE_LINE_MEMBER( adot_w ); + DECLARE_WRITE_LINE_MEMBER( bufclk_w ); + DECLARE_WRITE_LINE_MEMBER( x_pia_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( x_pia_irqb_w ); + + DECLARE_READ8_MEMBER( sa_r ); + DECLARE_WRITE8_MEMBER( y_pia_pa_w ); + DECLARE_WRITE8_MEMBER( sb_w ); + DECLARE_WRITE_LINE_MEMBER( sot_w ); + DECLARE_WRITE_LINE_MEMBER( y_pia_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( y_pia_irqb_w ); + + DECLARE_READ8_MEMBER( kb_pia_pa_r ); + DECLARE_READ8_MEMBER( kb_pia_pb_r ); + DECLARE_WRITE8_MEMBER( kb_pia_pb_w ); + DECLARE_WRITE_LINE_MEMBER( kb_halt_w ); + DECLARE_WRITE_LINE_MEMBER( kb_pia_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( kb_pia_irqb_w ); + + DECLARE_READ8_MEMBER( tape_pia_pa_r ); + DECLARE_WRITE8_MEMBER( tape_pia_pa_w ); + DECLARE_WRITE8_MEMBER( tape_pia_pb_w ); + DECLARE_WRITE_LINE_MEMBER( tape_pia_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( tape_pia_irqb_w ); + + DECLARE_WRITE8_MEMBER( dio_w ); + DECLARE_READ8_MEMBER( gpib_pia_pb_r ); + DECLARE_WRITE8_MEMBER( gpib_pia_pb_w ); + DECLARE_WRITE_LINE_MEMBER( talk_w ); + DECLARE_WRITE_LINE_MEMBER( gpib_pia_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( gpib_pia_irqb_w ); + + DECLARE_WRITE8_MEMBER( com_pia_pa_w ); + DECLARE_READ8_MEMBER( com_pia_pb_r ); + DECLARE_WRITE8_MEMBER( com_pia_pb_w ); + DECLARE_WRITE_LINE_MEMBER( com_pia_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( com_pia_irqb_w ); + DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); + DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); + + // interrupts + int m_x_pia_irqa; + int m_x_pia_irqb; + int m_y_pia_irqa; + int m_y_pia_irqb; + int m_tape_pia_irqa; + int m_tape_pia_irqb; + int m_kb_pia_irqa; + int m_kb_pia_irqb; + int m_gpib_pia_irqa; + int m_gpib_pia_irqb; + int m_com_pia_irqa; + int m_com_pia_irqb; + int m_acia_irq; + + // keyboard + int m_kbhalt; + int m_kc; + + // GPIB + int m_talk; + TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick); +}; + +class tek4052_state : public driver_device +{ +public: + tek4052_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, AM2901A_TAG), + m_ram(*this, RAM_TAG) + { } + + required_device m_maincpu; + required_device m_ram; + + virtual void machine_start(); + + virtual void video_start(); +}; + +#endif diff --git a/src/mame/includes/thomson.h b/src/mame/includes/thomson.h new file mode 100644 index 00000000000..19c07cf763f --- /dev/null +++ b/src/mame/includes/thomson.h @@ -0,0 +1,713 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Thomson 8-bit computers + +**********************************************************************/ + +#ifndef _THOMSON_H_ +#define _THOMSON_H_ + +#include "emu.h" +#include "bus/rs232/rs232.h" +#include "cpu/m6809/m6809.h" +#include "machine/6821pia.h" +#include "machine/mc6846.h" +#include "machine/6850acia.h" +#include "machine/mos6551.h" +#include "sound/dac.h" +#include "audio/mea8000.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/cassette.h" +#include "machine/mc6843.h" +#include "machine/mc6846.h" +#include "machine/mc6854.h" +#include "formats/thom_cas.h" +#include "formats/thom_dsk.h" +#include "machine/thomflop.h" +#include "imagedev/floppy.h" +#include "machine/ram.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +/* 6821 PIAs */ +#define THOM_PIA_SYS "pia_0" /* system PIA */ +#define THOM_PIA_GAME "pia_1" /* music & game PIA (joypad + sound) */ +#define THOM_PIA_IO "pia_2" /* CC 90-232 I/O extension (parallel & RS-232) */ +#define THOM_PIA_MODEM "pia_3" /* MD 90-120 MODEM extension */ + +/* sound ports */ +#define THOM_SOUND_BUZ 0 /* 1-bit buzzer */ +#define THOM_SOUND_GAME 1 /* 6-bit game port DAC */ +#define THOM_SOUND_SPEECH 2 /* speech synthesis */ + +/* bank-switching */ +#define THOM_CART_BANK "bank2" /* cartridge ROM */ +#define THOM_RAM_BANK "bank3" /* data RAM */ +#define THOM_FLOP_BANK "bank4" /* external floppy controller ROM */ +#define THOM_BASE_BANK "bank5" /* system RAM */ + +/* bank-switching */ +#define TO8_SYS_LO "bank5" /* system RAM low 2 Kb */ +#define TO8_SYS_HI "bank6" /* system RAM hi 2 Kb */ +#define TO8_DATA_LO "bank7" /* data RAM low 2 Kb */ +#define TO8_DATA_HI "bank8" /* data RAM hi 2 Kb */ +#define TO8_BIOS_BANK "bank9" /* BIOS ROM */ +#define MO6_CART_LO "bank10" +#define MO6_CART_HI "bank11" + + +/* original screen dimension (may be different from emulated screen!) */ +#define THOM_ACTIVE_WIDTH 320 +#define THOM_BORDER_WIDTH 56 +#define THOM_ACTIVE_HEIGHT 200 +#define THOM_BORDER_HEIGHT 47 +#define THOM_TOTAL_WIDTH 432 +#define THOM_TOTAL_HEIGHT 294 + +/* Emulated screen dimension may be doubled to allow hi-res 640x200 mode. + Emulated screen can have smaller borders. + */ + +/* maximum number of video pages: + 1 for TO7 generation (including MO5) + 4 for TO8 generation (including TO9, MO6) + */ +#define THOM_NB_PAGES 4 + +/* page 0 is banked */ +#define THOM_VRAM_BANK "bank1" + + +struct thom_vsignal { + unsigned count; /* pixel counter */ + unsigned init; /* 1 -> active vertical windos, 0 -> border/VBLANK */ + unsigned inil; /* 1 -> active horizontal window, 0 -> border/HBLANK */ + unsigned lt3; /* bit 3 of us counter */ + unsigned line; /* line counter */ +}; + + +class thomson_state : public driver_device +{ +public: + thomson_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_mc6854(*this, "mc6854"), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_buzzer(*this, "buzzer"), + m_dac(*this, "dac"), + m_centronics(*this, "centronics"), + m_cent_data_out(*this, "cent_data_out"), + m_pia_sys(*this, THOM_PIA_SYS), + m_pia_game(*this, THOM_PIA_GAME), + m_acia(*this, "acia6850"), + m_mea8000(*this, "mea8000"), + m_ram(*this, RAM_TAG), + m_mc6846(*this, "mc6846"), + m_mc6843(*this, "mc6843"), + m_acia6850(*this, "acia6850"), + m_screen(*this, "screen"), + m_io_game_port_directions(*this, "game_port_directions"), + m_io_game_port_buttons(*this, "game_port_buttons"), + m_io_mouse_x(*this, "mouse_x"), + m_io_mouse_y(*this, "mouse_y"), + m_io_mouse_button(*this, "mouse_button"), + m_io_lightpen_x(*this, "lightpen_x"), + m_io_lightpen_y(*this, "lightpen_y"), + m_io_lightpen_button(*this, "lightpen_button"), + m_io_config(*this, "config"), + m_io_vconfig(*this, "vconfig"), + m_io_mconfig(*this, "mconfig"), + m_io_fconfig(*this, "fconfig"), + m_io_keyboard(*this, "keyboard"), + m_vrambank(*this, THOM_VRAM_BANK), + m_cartbank(*this, THOM_CART_BANK), + m_rambank(*this, THOM_RAM_BANK), + m_flopbank(*this, THOM_FLOP_BANK), + m_basebank(*this, THOM_BASE_BANK), + m_syslobank(*this, TO8_SYS_LO), + m_syshibank(*this, TO8_SYS_HI), + m_datalobank(*this, TO8_DATA_LO), + m_datahibank(*this, TO8_DATA_HI), + m_biosbank(*this, TO8_BIOS_BANK), + m_cartlobank(*this, MO6_CART_LO), + m_carthibank(*this, MO6_CART_HI) + { + } + + DECLARE_FLOPPY_FORMATS(cd90_640_formats); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( to7_cartridge ); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( mo5_cartridge ); + + DECLARE_WRITE_LINE_MEMBER( to7_set_cassette_motor ); + DECLARE_WRITE_LINE_MEMBER( mo5_set_cassette_motor ); + DECLARE_WRITE_LINE_MEMBER( thom_dev_irq_0 ); + DECLARE_WRITE_LINE_MEMBER( thom_irq_1 ); + DECLARE_WRITE_LINE_MEMBER( thom_firq_1 ); + DECLARE_WRITE8_MEMBER( to7_cartridge_w ); + DECLARE_READ8_MEMBER( to7_cartridge_r ); + DECLARE_WRITE8_MEMBER( to7_timer_port_out ); + DECLARE_WRITE8_MEMBER( to7_timer_cp2_out ); + DECLARE_READ8_MEMBER( to7_timer_port_in ); + DECLARE_WRITE8_MEMBER( to7_timer_tco_out ); + DECLARE_WRITE_LINE_MEMBER( to7_sys_cb2_out ); + DECLARE_WRITE8_MEMBER( to7_sys_portb_out ); + DECLARE_READ8_MEMBER( to7_sys_porta_in ); + DECLARE_READ8_MEMBER( to7_sys_portb_in ); + DECLARE_WRITE_LINE_MEMBER( to7_modem_cb ); + DECLARE_WRITE_LINE_MEMBER( to7_modem_tx_w ); + DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); + DECLARE_READ8_MEMBER( to7_modem_mea8000_r ); + DECLARE_WRITE8_MEMBER( to7_modem_mea8000_w ); + DECLARE_READ8_MEMBER( to7_game_porta_in ); + DECLARE_READ8_MEMBER( to7_game_portb_in ); + DECLARE_WRITE8_MEMBER( to7_game_portb_out ); + DECLARE_WRITE_LINE_MEMBER( to7_game_cb2_out ); + TIMER_CALLBACK_MEMBER( to7_game_update_cb ); + DECLARE_READ8_MEMBER( to7_midi_r ); + DECLARE_WRITE8_MEMBER( to7_midi_w ); + DECLARE_MACHINE_RESET( to7 ); + DECLARE_MACHINE_START( to7 ); + DECLARE_WRITE_LINE_MEMBER( to770_sys_cb2_out ); + DECLARE_READ8_MEMBER( to770_sys_porta_in ); + void to7_update_cart_bank_postload(); + void to770_update_ram_bank_postload(); + DECLARE_WRITE8_MEMBER( to770_sys_portb_out ); + DECLARE_WRITE8_MEMBER( to770_timer_port_out ); + DECLARE_READ8_MEMBER( to770_gatearray_r ); + DECLARE_WRITE8_MEMBER( to770_gatearray_w ); + DECLARE_MACHINE_RESET( to770 ); + DECLARE_MACHINE_START( to770 ); + void to7_lightpen_cb( int step ); + void mo5_lightpen_cb( int step ); + TIMER_CALLBACK_MEMBER( mo5_periodic_cb ); + DECLARE_WRITE8_MEMBER( mo5_sys_porta_out ); + DECLARE_READ8_MEMBER( mo5_sys_porta_in ); + DECLARE_WRITE8_MEMBER( mo5_sys_portb_out ); + DECLARE_READ8_MEMBER( mo5_sys_portb_in ); + DECLARE_READ8_MEMBER( mo5_gatearray_r ); + DECLARE_WRITE8_MEMBER( mo5_gatearray_w ); + void mo5_update_cart_bank_postload(); + DECLARE_WRITE8_MEMBER( mo5_cartridge_w ); + DECLARE_READ8_MEMBER( mo5_cartridge_r ); + DECLARE_WRITE8_MEMBER( mo5_ext_w ); + DECLARE_MACHINE_RESET( mo5 ); + DECLARE_MACHINE_START( mo5 ); + DECLARE_WRITE8_MEMBER( to9_ieee_w ); + DECLARE_READ8_MEMBER( to9_ieee_r ); + DECLARE_READ8_MEMBER( to9_gatearray_r ); + DECLARE_WRITE8_MEMBER( to9_gatearray_w ); + DECLARE_READ8_MEMBER( to9_vreg_r ); + DECLARE_WRITE8_MEMBER( to9_vreg_w ); + void to9_update_cart_bank_postload(); + DECLARE_WRITE8_MEMBER( to9_cartridge_w ); + DECLARE_READ8_MEMBER( to9_cartridge_r ); + void to9_update_ram_bank_postload(); + DECLARE_READ8_MEMBER( to9_kbd_r ); + DECLARE_WRITE8_MEMBER( to9_kbd_w ); + TIMER_CALLBACK_MEMBER( to9_kbd_timer_cb ); + DECLARE_READ8_MEMBER( to9_sys_porta_in ); + DECLARE_WRITE8_MEMBER( to9_sys_porta_out ); + DECLARE_WRITE8_MEMBER( to9_sys_portb_out ); + DECLARE_WRITE8_MEMBER( to9_timer_port_out ); + DECLARE_MACHINE_RESET( to9 ); + DECLARE_MACHINE_START( to9 ); + TIMER_CALLBACK_MEMBER( to8_kbd_timer_cb ); + void to8_update_floppy_bank_postload(); + void to8_update_ram_bank_postload(); + void to8_update_cart_bank_postload(); + DECLARE_WRITE8_MEMBER( to8_cartridge_w ); + DECLARE_READ8_MEMBER( to8_cartridge_r ); + DECLARE_READ8_MEMBER( to8_floppy_r ); + DECLARE_WRITE8_MEMBER( to8_floppy_w ); + DECLARE_READ8_MEMBER( to8_gatearray_r ); + DECLARE_WRITE8_MEMBER( to8_gatearray_w ); + DECLARE_READ8_MEMBER( to8_vreg_r ); + DECLARE_WRITE8_MEMBER( to8_vreg_w ); + DECLARE_READ8_MEMBER( to8_sys_porta_in ); + DECLARE_WRITE8_MEMBER( to8_sys_portb_out ); + DECLARE_READ8_MEMBER( to8_timer_port_in ); + DECLARE_WRITE8_MEMBER( to8_timer_port_out ); + DECLARE_WRITE8_MEMBER( to8_timer_cp2_out ); + void to8_lightpen_cb( int step ); + DECLARE_MACHINE_RESET( to8 ); + DECLARE_MACHINE_START( to8 ); + DECLARE_READ8_MEMBER( to9p_timer_port_in ); + DECLARE_WRITE8_MEMBER( to9p_timer_port_out ); + DECLARE_MACHINE_RESET( to9p ); + DECLARE_MACHINE_START( to9p ); + void mo6_update_ram_bank_postload(); + void mo6_update_cart_bank_postload(); + DECLARE_WRITE8_MEMBER( mo6_cartridge_w ); + DECLARE_READ8_MEMBER( mo6_cartridge_r ); + DECLARE_WRITE8_MEMBER( mo6_ext_w ); + DECLARE_WRITE_LINE_MEMBER( mo6_centronics_busy ); + DECLARE_WRITE8_MEMBER( mo6_game_porta_out ); + DECLARE_WRITE_LINE_MEMBER( mo6_game_cb2_out ); + TIMER_CALLBACK_MEMBER( mo6_game_update_cb ); + DECLARE_READ8_MEMBER( mo6_sys_porta_in ); + DECLARE_READ8_MEMBER( mo6_sys_portb_in ); + DECLARE_WRITE8_MEMBER( mo6_sys_porta_out ); + DECLARE_WRITE8_MEMBER( mo6_sys_portb_out ); + DECLARE_WRITE_LINE_MEMBER( mo6_sys_cb2_out ); + DECLARE_READ8_MEMBER( mo6_gatearray_r ); + DECLARE_WRITE8_MEMBER( mo6_gatearray_w ); + DECLARE_READ8_MEMBER( mo6_vreg_r ); + DECLARE_WRITE8_MEMBER( mo6_vreg_w ); + DECLARE_MACHINE_RESET( mo6 ); + DECLARE_MACHINE_START( mo6 ); + DECLARE_READ8_MEMBER( mo5nr_net_r ); + DECLARE_WRITE8_MEMBER( mo5nr_net_w ); + DECLARE_READ8_MEMBER( mo5nr_prn_r ); + DECLARE_WRITE8_MEMBER( mo5nr_prn_w ); + DECLARE_READ8_MEMBER( mo5nr_sys_portb_in ); + DECLARE_WRITE8_MEMBER( mo5nr_sys_porta_out ); + DECLARE_MACHINE_RESET( mo5nr ); + DECLARE_MACHINE_START( mo5nr ); + + TIMER_CALLBACK_MEMBER( thom_lightpen_step ); + TIMER_CALLBACK_MEMBER( thom_scanline_start ); + UINT32 screen_update_thom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_WRITE8_MEMBER( to7_vram_w ); + DECLARE_WRITE8_MEMBER( to770_vram_w ); + DECLARE_WRITE8_MEMBER( to8_sys_lo_w ); + DECLARE_WRITE8_MEMBER( to8_sys_hi_w ); + DECLARE_WRITE8_MEMBER( to8_data_lo_w ); + DECLARE_WRITE8_MEMBER( to8_data_hi_w ); + DECLARE_WRITE8_MEMBER( to8_vcart_w ); + DECLARE_WRITE8_MEMBER( mo6_vcart_lo_w ); + DECLARE_WRITE8_MEMBER( mo6_vcart_hi_w ); + TIMER_CALLBACK_MEMBER( thom_set_init ); + void to770_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void mo5_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void mo5alt_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void to9_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap4_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap4alt_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap4althalf_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap16_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void mode80_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void mode80_to9_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void page1_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void page2_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void overlay_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void overlayhalf_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void overlay3_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void to770_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void mo5_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void mo5alt_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void to9_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap4_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap4alt_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap4althalf_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap16_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void mode80_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void mode80_to9_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void page1_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void page2_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void overlay_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void overlayhalf_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void overlay3_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void thom_vblank( screen_device &screen, bool state ); + DECLARE_VIDEO_START( thom ); + + DECLARE_READ8_MEMBER( to7_5p14_r ); + DECLARE_WRITE8_MEMBER( to7_5p14_w ); + DECLARE_READ8_MEMBER( to7_5p14sd_r ); + DECLARE_WRITE8_MEMBER( to7_5p14sd_w ); + DECLARE_READ8_MEMBER( to7_qdd_r ); + DECLARE_WRITE8_MEMBER( to7_qdd_w ); + TIMER_CALLBACK_MEMBER( thmfc_floppy_cmd_complete_cb ); + DECLARE_READ8_MEMBER( thmfc_floppy_r ); + DECLARE_WRITE8_MEMBER( thmfc_floppy_w ); + TIMER_CALLBACK_MEMBER( ans4 ); + TIMER_CALLBACK_MEMBER( ans3 ); + TIMER_CALLBACK_MEMBER( ans2 ); + TIMER_CALLBACK_MEMBER( ans ); + DECLARE_READ8_MEMBER( to7_network_r ); + DECLARE_WRITE8_MEMBER( to7_network_w ); + DECLARE_READ8_MEMBER( to7_floppy_r ); + DECLARE_WRITE8_MEMBER( to7_floppy_w ); + DECLARE_READ8_MEMBER( to9_floppy_r ); + DECLARE_WRITE8_MEMBER( to9_floppy_w ); + WRITE_LINE_MEMBER( fdc_index_0_w ); + WRITE_LINE_MEMBER( fdc_index_1_w ); + WRITE_LINE_MEMBER( fdc_index_2_w ); + WRITE_LINE_MEMBER( fdc_index_3_w ); + void thomson_index_callback(legacy_floppy_image_device *device, int state); + DECLARE_PALETTE_INIT(thom); + DECLARE_PALETTE_INIT(mo5); + + optional_device m_mc6854; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + + int m_centronics_busy; + int m_centronics_perror; + + MC6854_OUT_FRAME_CB(to7_network_got_frame); + +protected: + required_device m_maincpu; + required_device m_cassette; + required_device m_buzzer; + required_device m_dac; + optional_device m_centronics; + optional_device m_cent_data_out; + required_device m_pia_sys; + required_device m_pia_game; + required_device m_acia; + required_device m_mea8000; + required_device m_ram; + optional_device m_mc6846; + optional_device m_mc6843; + optional_device m_acia6850; + required_device m_screen; + required_ioport m_io_game_port_directions; + required_ioport m_io_game_port_buttons; + required_ioport m_io_mouse_x; + required_ioport m_io_mouse_y; + required_ioport m_io_mouse_button; + required_ioport m_io_lightpen_x; + required_ioport m_io_lightpen_y; + required_ioport m_io_lightpen_button; + required_ioport m_io_config; + required_ioport m_io_vconfig; + optional_ioport m_io_mconfig; + required_ioport m_io_fconfig; + required_ioport_array<10> m_io_keyboard; + required_memory_bank m_vrambank; + optional_memory_bank m_cartbank; + optional_memory_bank m_rambank; + required_memory_bank m_flopbank; + required_memory_bank m_basebank; + required_memory_bank m_syslobank; + optional_memory_bank m_syshibank; + optional_memory_bank m_datalobank; + optional_memory_bank m_datahibank; + optional_memory_bank m_biosbank; + optional_memory_bank m_cartlobank; + optional_memory_bank m_carthibank; + + /* bank logging and optimisations */ + int m_old_cart_bank; + int m_old_cart_bank_was_read_only; + int m_old_ram_bank; + int m_old_floppy_bank; + /* buffer storing demodulated bits, only for k7 and with speed hack */ + UINT32 m_to7_k7_bitsize; + UINT8* m_to7_k7_bits; + /* several devices on the same irqs */ + UINT8 m_thom_irq; + UINT8 m_thom_firq; + /* ------------ cartridge ------------ */ + UINT8 m_thom_cart_nb_banks; /* number of 16 KB banks (up to 4) */ + UINT8 m_thom_cart_bank; /* current bank */ + UINT8 m_to7_lightpen_step; + UINT8 m_to7_lightpen; + UINT8 m_to7_modem_tx; + /* calls to7_game_update_cb periodically */ + emu_timer* m_to7_game_timer; + UINT8 m_to7_game_sound; + UINT8 m_to7_game_mute; + emu_timer* m_mo5_periodic_timer; + UINT8 m_mo5_reg_cart; /* 0xa7cb bank switch */ + UINT8 m_to9_palette_data[32]; + UINT8 m_to9_palette_idx; + UINT8 m_to9_soft_bank; + UINT8 m_to9_kbd_parity; /* 0=even, 1=odd, 2=no parity */ + UINT8 m_to9_kbd_intr; /* interrupt mode */ + UINT8 m_to9_kbd_in; /* data from keyboard */ + UINT8 m_to9_kbd_status; /* status */ + UINT8 m_to9_kbd_overrun; /* character lost */ + UINT8 m_to9_kbd_periph; /* peripherial mode */ + UINT8 m_to9_kbd_byte_count; /* byte-count in peripherial mode */ + UINT16 m_to9_mouse_x; + UINT16 m_to9_mouse_y; + UINT8 m_to9_kbd_last_key; /* for key repetition */ + UINT16 m_to9_kbd_key_count; + UINT8 m_to9_kbd_caps; /* caps-lock */ + UINT8 m_to9_kbd_pad; /* keypad outputs special codes */ + emu_timer* m_to9_kbd_timer; + UINT8 m_to8_kbd_ack; /* 1 = cpu inits / accepts transfers */ + UINT16 m_to8_kbd_data; /* data to transmit */ + UINT16 m_to8_kbd_step; /* transmission automaton state */ + UINT8 m_to8_kbd_last_key; /* last key (for repetition) */ + UINT32 m_to8_kbd_key_count; /* keypress time (for repetition) */ + UINT8 m_to8_kbd_caps; /* caps lock */ + emu_timer* m_to8_kbd_timer; /* bit-send */ + emu_timer* m_to8_kbd_signal; /* signal from CPU */ + UINT8 m_to8_data_vpage; + UINT8 m_to8_cart_vpage; + UINT8 m_to8_reg_ram; + UINT8 m_to8_reg_cart; + UINT8 m_to8_reg_sys1; + UINT8 m_to8_reg_sys2; + UINT8 m_to8_lightpen_intr; + UINT8 m_to8_soft_select; + UINT8 m_to8_soft_bank; + UINT8 m_to8_bios_bank; + + /* We allow choosing dynamically: + - the border size + - whether we use 640 pixels or 320 pixels in an active row + (now this is automatically choosen by default for each frame) + */ + UINT16 m_thom_bwidth; + UINT16 m_thom_bheight; + /* border size */ + UINT8 m_thom_hires; + /* 0 = low res: 320x200 active area (faster) + 1 = hi res: 640x200 active area (can represent all video modes) + */ + UINT8 m_thom_hires_better; + /* 1 = a 640 mode was used in the last frame */ + /* we use our own video timing to precisely cope with VBLANK and HBLANK */ + emu_timer* m_thom_video_timer; /* time elapsed from beginning of frame */ + /* number of lightpen call-backs per frame */ + int m_thom_lightpen_nb; + /* called thom_lightpen_nb times */ + emu_timer *m_thom_lightpen_timer; + /* lightpen callback function to call from timer */ + void (thomson_state::*m_thom_lightpen_cb)(int step); + UINT8* m_thom_vram; /* pointer to video memory */ + emu_timer* m_thom_scanline_timer; /* scan-line udpate */ + UINT16 m_thom_last_pal[16]; /* palette at last scanline start */ + UINT16 m_thom_pal[16]; /* current palette */ + UINT8 m_thom_pal_changed; /* whether pal != old_pal */ + UINT8 m_thom_border_index; /* current border color index */ + /* the left and right border color for each row (including top and bottom + border rows); -1 means unchanged wrt last scanline + */ + INT16 m_thom_border_l[THOM_TOTAL_HEIGHT+1]; + INT16 m_thom_border_r[THOM_TOTAL_HEIGHT+1]; + /* active area, updated one scan-line at a time every 64us, + then blitted in screen_update + */ + UINT16 m_thom_vbody[640*200]; + UINT8 m_thom_vmode; /* current vide mode */ + UINT8 m_thom_vpage; /* current video page */ + /* this stores the video mode & page at each GPL in the current line + (-1 means unchanged) + */ + INT16 m_thom_vmodepage[41]; + UINT8 m_thom_vmodepage_changed; + /* one dirty flag for each video memory line */ + UINT8 m_thom_vmem_dirty[205]; + /* set to 1 if undirty scanlines need to be redrawn due to other video state + changes */ + UINT8 m_thom_vstate_dirty; + UINT8 m_thom_vstate_last_dirty; + UINT32 m_thom_mode_point; + UINT32 m_thom_floppy_wcount; + UINT32 m_thom_floppy_rcount; + emu_timer *m_thom_init_timer; + void (thomson_state::*m_thom_init_cb)( int init ); + + int to7_get_cassette(); + void to7_set_cassette( int data ); + int mo5_get_cassette(); + void mo5_set_cassette( int data ); + void thom_set_irq( int line, int state ); + void thom_set_firq( int line, int state ); + void thom_irq_reset(); + void thom_irq_init(); + void thom_irq_0( int state ); + void thom_irq_3( int state ); + void thom_firq_2( int state ); + void thom_irq_4( int state ); + void thom_set_caps_led( int led ); + void to7_update_cart_bank(); + void to7_set_init( int init ); + void to7_modem_reset(); + void to7_modem_init(); + UINT8 to7_get_mouse_signal(); + void to7_game_sound_update(); + void to7_game_init(); + void to7_game_reset(); + void to7_midi_reset(); + void to7_midi_init(); + void to770_update_ram_bank(); + void mo5_init_timer(); + void mo5_update_cart_bank(); + void to9_set_video_mode( UINT8 data, int style ); + void to9_palette_init(); + void to9_update_cart_bank(); + void to9_update_ram_bank(); + int to9_kbd_ktest(); + void to9_kbd_update_irq(); + void to9_kbd_send( UINT8 data, int parity ); + int to9_kbd_get_key(); + void to9_kbd_reset(); + void to9_kbd_init(); + int to8_kbd_ktest(); + int to8_kbd_get_key(); + void to8_kbd_timer_func(); + void to8_kbd_set_ack( int data ); + void to8_kbd_reset(); + void to8_kbd_init(); + void to8_update_floppy_bank(); + void to8_update_ram_bank(); + void to8_update_cart_bank(); + void to8_floppy_init(); + void to8_floppy_reset(); + void mo6_update_ram_bank(); + void mo6_update_cart_bank(); + void mo6_game_init(); + void mo6_game_reset(); + void mo5nr_game_init(); + void mo5nr_game_reset(); + + int thom_update_screen_size(); + unsigned thom_video_elapsed(); + struct thom_vsignal thom_get_vsignal(); + void thom_get_lightpen_pos( int*x, int* y ); + struct thom_vsignal thom_get_lightpen_vsignal( int xdec, int ydec, int xdec2 ); + void thom_set_lightpen_callback( int nb ); + int thom_mode_is_hires( int mode ); + void thom_border_changed(); + void thom_gplinfo_changed(); + void thom_set_border_color( unsigned index ); + void thom_set_palette( unsigned index, UINT16 color ); + void thom_set_video_mode( unsigned mode ); + void thom_set_video_page( unsigned page ); + void thom_set_mode_point( int point ); + void thom_floppy_active( int write ); + unsigned to7_lightpen_gpl( int decx, int decy ); + void thom_configure_palette( double gamma, const UINT16* pal, palette_device& palette ); + + int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size ); + int thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, UINT8* dst, int sector_size ); + int thom_floppy_make_track( legacy_floppy_image_device* img, UINT8* dst, int sector_size, int side ); + int thom_qdd_make_addr( int sector, UINT8* dst ); + int thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, UINT8* dst ); + int thom_qdd_make_disk ( legacy_floppy_image_device* img, UINT8* dst ); + void to7_5p14_reset(); + void to7_5p14_init(); + void to7_5p14_index_pulse_callback( device_t *controller,legacy_floppy_image_device *image, int state ); + void to7_5p14sd_reset(); + void to7_5p14sd_init(); + void to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state ); + legacy_floppy_image_device * to7_qdd_image(); + void to7_qdd_stat_update(); + UINT8 to7_qdd_read_byte(); + void to7_qdd_write_byte( UINT8 data ); + void to7_qdd_reset(); + void to7_qdd_init(); + legacy_floppy_image_device * thmfc_floppy_image(); + int thmfc_floppy_is_qdd( legacy_floppy_image_device *image ); + void thmfc_floppy_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state ); + int thmfc_floppy_find_sector( chrn_id* dst ); + void thmfc_floppy_cmd_complete(); + UINT8 thmfc_floppy_read_byte(); + UINT8 thmfc_floppy_raw_read_byte(); + void thmfc_floppy_qdd_write_byte( UINT8 data ); + void thmfc_floppy_write_byte( UINT8 data ); + void thmfc_floppy_format_byte( UINT8 data ); + void thmfc_floppy_reset(); + void thmfc_floppy_init(); + void to7_network_init(); + void to7_network_reset(); + void to7_floppy_init( void* base ); + void to7_floppy_reset(); + void to9_floppy_init(void* int_base, void* ext_base); + void to9_floppy_reset(); + void to7_midi_update_irq ( ); + void to7_midi_ready_to_send_cb( ); +}; + +/*----------- defined in video/thomson.c -----------*/ + +/* + TO7 video: + one line (64 us) = + 56 left border pixels ( 7 us) + + 320 active pixels (40 us) + + 56 right border pixels ( 7 us) + + horizontal retrace (10 us) + + one image (20 ms) = + 47 top border lines (~3 ms) + + 200 active lines (12.8 ms) + + 47 bottom border lines (~3 ms) + + vertical retrace (~1 ms) + + TO9 and up introduced a half (160 pixels) and double (640 pixels) + horizontal mode, but still in 40 us (no change in refresh rate). +*/ + + +/***************************** dimensions **************************/ + + +/*********************** video signals *****************************/ + +/***************************** commons *****************************/ + + +/* video modes */ +#define THOM_VMODE_TO770 0 +#define THOM_VMODE_MO5 1 +#define THOM_VMODE_BITMAP4 2 +#define THOM_VMODE_BITMAP4_ALT 3 +#define THOM_VMODE_80 4 +#define THOM_VMODE_BITMAP16 5 +#define THOM_VMODE_PAGE1 6 +#define THOM_VMODE_PAGE2 7 +#define THOM_VMODE_OVERLAY 8 +#define THOM_VMODE_OVERLAY3 9 +#define THOM_VMODE_TO9 10 +#define THOM_VMODE_80_TO9 11 +#define THOM_VMODE_BITMAP4_ALT_HALF 12 +#define THOM_VMODE_MO5_ALT 13 +#define THOM_VMODE_OVERLAY_HALF 14 +#define THOM_VMODE_NB 15 + + +class to7_io_line_device : public device_t +{ +public: + // construction/destruction + to7_io_line_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + /* read data register */ + DECLARE_READ8_MEMBER(porta_in); + + /* write data register */ + DECLARE_WRITE8_MEMBER(porta_out); + + DECLARE_WRITE_LINE_MEMBER(write_rxd); + DECLARE_WRITE_LINE_MEMBER(write_cts); + DECLARE_WRITE_LINE_MEMBER(write_dsr); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + +protected: + // device-level overrides + virtual void device_start(); + machine_config_constructor device_mconfig_additions() const; + +private: + required_device m_pia_io; + required_device m_rs232; + int m_last_low; + int m_centronics_busy; + int m_rxd; + int m_cts; + int m_dsr; +}; + +extern const device_type TO7_IO_LINE; + +#define MCFG_TO7_IO_LINE_ADD(_tag) \ + MCFG_DEVICE_ADD((_tag), TO7_IO_LINE, 0) + +#endif /* _THOMSON_H_ */ diff --git a/src/mame/includes/ti85.h b/src/mame/includes/ti85.h new file mode 100644 index 00000000000..d77433eaf21 --- /dev/null +++ b/src/mame/includes/ti85.h @@ -0,0 +1,229 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha,Jon Sturm +/***************************************************************************** + * + * includes/ti85.h + * + ****************************************************************************/ + +#ifndef TI85_H_ +#define TI85_H_ + +#include "imagedev/snapquik.h" +#include "video/t6a04.h" +#include "machine/bankdev.h" +#include "sound/speaker.h" +#include "machine/nvram.h" +#include "machine/intelfsh.h" + + +/* model */ +enum ti85_model { + TI81, + TI81v2, + TI82, + TI83, + TI85, + TI86, + TI83P, + TI83PSE, + TI84P, + TI84PSE +}; + +typedef struct +{ + UINT8 loop; + UINT8 setup; + float divsor; + bool interrupt; + UINT8 max; + UINT8 count; +} ti83pse_timer; + +typedef enum TI83PSE_CTIMER +{ + CRYSTAL_TIMER1 = 0, + CRYSTAL_TIMER2, + CRYSTAL_TIMER3, + HW_TIMER1, + HW_TIMER2 +} ti83pse_ctimers; + +class ti85_state : public driver_device +{ +public: + ti85_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), +// m_serial(*this, "tiserial"), + m_nvram(*this, "nvram"), + m_flash(*this, "flash"), + m_membank1(*this, "membank1"), + m_membank2(*this, "membank2"), + m_membank3(*this, "membank3"), + m_membank4(*this, "membank4") + { } + + required_device m_maincpu; + optional_device m_speaker; + //optional_device<> m_serial; + optional_shared_ptr m_nvram; + optional_device m_flash; + optional_device m_membank1; + optional_device m_membank2; + optional_device m_membank3; + optional_device m_membank4; + + ti85_model m_model; + + UINT8 m_LCD_memory_base; + UINT8 m_LCD_contrast; + UINT8 m_LCD_status; + UINT8 m_timer_interrupt_mask; + UINT8 m_timer_interrupt_status; + UINT8 m_ctimer_interrupt_status; + UINT8 m_ON_interrupt_mask; + UINT8 m_ON_interrupt_status; + UINT8 m_ON_pressed; + UINT8 m_flash_unlocked; + UINT8 m_ti8x_memory_page_1; + UINT8 m_ti8x_memory_page_2; + UINT8 m_ti8x_memory_page_3; + bool m_booting; + UINT8 m_LCD_mask; + UINT8 m_power_mode; + UINT8 m_cpu_speed; + UINT8 m_keypad_mask; + UINT8 m_video_buffer_width; + UINT8 m_interrupt_speed; + UINT8 m_port4_bit0; + UINT8 m_ti81_port_7_data; + UINT8 *m_ti8x_ram; + UINT8 m_PCR; + UINT8 m_red_out; + UINT8 m_white_out; + UINT8 m_ti8x_port2; + UINT8 m_ti83p_port4; + UINT8 m_ti83pse_port21; + int m_ti_video_memory_size; + int m_ti_screen_x_size; + int m_ti_screen_y_size; + int m_ti_number_of_frames; + UINT8 * m_frames; + UINT8 * m_bios; + DECLARE_READ8_MEMBER(ti85_port_0000_r); + DECLARE_READ8_MEMBER(ti8x_keypad_r); + DECLARE_READ8_MEMBER(ti85_port_0006_r); + DECLARE_READ8_MEMBER(ti8x_serial_r); + DECLARE_READ8_MEMBER(ti86_port_0005_r); + DECLARE_READ8_MEMBER(ti83_port_0000_r); + DECLARE_READ8_MEMBER(ti8x_plus_serial_r); + DECLARE_WRITE8_MEMBER(ti81_port_0007_w); + DECLARE_WRITE8_MEMBER(ti85_port_0000_w); + DECLARE_WRITE8_MEMBER(ti8x_keypad_w); + DECLARE_WRITE8_MEMBER(ti85_port_0002_w); + DECLARE_WRITE8_MEMBER(ti85_port_0003_w); + DECLARE_WRITE8_MEMBER(ti85_port_0004_w); + DECLARE_WRITE8_MEMBER(ti85_port_0005_w); + DECLARE_WRITE8_MEMBER(ti85_port_0006_w); + DECLARE_WRITE8_MEMBER(ti8x_serial_w); + DECLARE_WRITE8_MEMBER(ti86_port_0005_w); + DECLARE_WRITE8_MEMBER(ti86_port_0006_w); + DECLARE_WRITE8_MEMBER(ti82_port_0002_w); + DECLARE_WRITE8_MEMBER(ti83_port_0000_w); + DECLARE_WRITE8_MEMBER(ti83_port_0002_w); + DECLARE_WRITE8_MEMBER(ti83_port_0003_w); + DECLARE_WRITE8_MEMBER(ti8x_plus_serial_w); + DECLARE_WRITE8_MEMBER(ti83p_int_mask_w); + DECLARE_WRITE8_MEMBER(ti83p_port_0004_w); + DECLARE_WRITE8_MEMBER(ti83p_port_0006_w); + DECLARE_WRITE8_MEMBER(ti83p_port_0007_w); + DECLARE_WRITE8_MEMBER(ti83pse_int_ack_w); + DECLARE_WRITE8_MEMBER(ti83pse_port_0004_w); + DECLARE_WRITE8_MEMBER(ti83pse_port_0005_w); + DECLARE_WRITE8_MEMBER(ti83pse_port_0006_w); + DECLARE_WRITE8_MEMBER(ti83pse_port_0007_w); + DECLARE_WRITE8_MEMBER(ti83p_port_0014_w); + DECLARE_WRITE8_MEMBER(ti83pse_port_0020_w); + DECLARE_WRITE8_MEMBER(ti83pse_port_0021_w); + DECLARE_READ8_MEMBER( ti85_port_0002_r ); + DECLARE_READ8_MEMBER( ti85_port_0003_r ); + DECLARE_READ8_MEMBER( ti85_port_0004_r ); + DECLARE_READ8_MEMBER( ti85_port_0005_r ); + DECLARE_READ8_MEMBER( ti86_port_0006_r ); + DECLARE_READ8_MEMBER( ti82_port_0002_r ); + DECLARE_READ8_MEMBER( ti83_port_0002_r ); + DECLARE_READ8_MEMBER( ti83_port_0003_r ); + DECLARE_READ8_MEMBER( ti83p_port_0002_r ); + DECLARE_READ8_MEMBER( ti83p_port_0004_r ); + DECLARE_READ8_MEMBER( ti83pse_port_0002_r ); + DECLARE_READ8_MEMBER( ti83pse_port_0005_r ); + DECLARE_READ8_MEMBER( ti83pse_port_0009_r ); + DECLARE_READ8_MEMBER( ti83pse_port_0015_r ); + DECLARE_READ8_MEMBER( ti83pse_port_0020_r ); + DECLARE_READ8_MEMBER( ti83pse_port_0021_r ); + DECLARE_READ8_MEMBER( ti84pse_port_0055_r ); + DECLARE_READ8_MEMBER( ti84pse_port_0056_r ); + virtual void machine_start(); + virtual void video_start(); + DECLARE_PALETTE_INIT(ti85); + DECLARE_MACHINE_RESET(ti85); + DECLARE_MACHINE_RESET(ti83p); + DECLARE_PALETTE_INIT(ti82); + DECLARE_MACHINE_START(ti86); + DECLARE_MACHINE_START(ti83p); + DECLARE_MACHINE_START(ti83pse); + DECLARE_MACHINE_START(ti84pse); + DECLARE_MACHINE_START(ti84p); + void ti8xpse_init_common(); + + UINT32 screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(ti85_timer_callback); + TIMER_CALLBACK_MEMBER(ti83_timer1_callback); + TIMER_CALLBACK_MEMBER(ti83_timer2_callback); + + //crystal timers + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + void ti83pse_count( UINT8 timer, UINT8 data); + + emu_timer *m_crystal_timer1; + emu_timer *m_crystal_timer2; + emu_timer *m_crystal_timer3; + DECLARE_READ8_MEMBER( ti83pse_ctimer1_setup_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer1_setup_w ); + DECLARE_READ8_MEMBER( ti83pse_ctimer1_loop_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer1_loop_w ); + DECLARE_READ8_MEMBER( ti83pse_ctimer1_count_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer1_count_w ); + DECLARE_READ8_MEMBER( ti83pse_ctimer2_setup_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer2_setup_w ); + DECLARE_READ8_MEMBER( ti83pse_ctimer2_loop_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer2_loop_w ); + DECLARE_READ8_MEMBER( ti83pse_ctimer2_count_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer2_count_w ); + DECLARE_READ8_MEMBER( ti83pse_ctimer3_setup_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer3_setup_w ); + DECLARE_READ8_MEMBER( ti83pse_ctimer3_loop_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer3_loop_w ); + DECLARE_READ8_MEMBER( ti83pse_ctimer3_count_r ); + DECLARE_WRITE8_MEMBER( ti83pse_ctimer3_count_w ); + + + void update_ti85_memory (); + void update_ti83p_memory (); + void update_ti83pse_memory (); + void update_ti86_memory (); + void ti8x_snapshot_setup_registers (UINT8 * data); + void ti85_setup_snapshot (UINT8 * data); + void ti86_setup_snapshot (UINT8 * data); + DECLARE_SNAPSHOT_LOAD_MEMBER( ti8x ); + DECLARE_DIRECT_UPDATE_MEMBER( ti83p_direct_update_handler ); + + ti83pse_timer m_ctimer[3]; + + //address_space &asic; +}; + +#endif /* TI85_H_ */ diff --git a/src/mame/includes/ti89.h b/src/mame/includes/ti89.h new file mode 100644 index 00000000000..83f83020513 --- /dev/null +++ b/src/mame/includes/ti89.h @@ -0,0 +1,89 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/***************************************************************************** + * + * includes/ti89.h + * + ****************************************************************************/ + +#ifndef TI89_H_ +#define TI89_H_ + +#include "machine/intelfsh.h" + +class ti68k_state : public driver_device +{ +public: + ti68k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_flash(*this, "flash"), + m_rom_base(*this, "flash"), + m_io_bit0(*this, "BIT0"), + m_io_bit1(*this, "BIT1"), + m_io_bit2(*this, "BIT2"), + m_io_bit3(*this, "BIT3"), + m_io_bit4(*this, "BIT4"), + m_io_bit5(*this, "BIT5"), + m_io_bit6(*this, "BIT6"), + m_io_bit7(*this, "BIT7") + { } + + required_device m_maincpu; + required_device m_flash; + required_region_ptr m_rom_base; + required_ioport m_io_bit0; + required_ioport m_io_bit1; + required_ioport m_io_bit2; + required_ioport m_io_bit3; + required_ioport m_io_bit4; + required_ioport m_io_bit5; + required_ioport m_io_bit6; + required_ioport m_io_bit7; + + // hardware versions + enum { HW1=1, HW2, HW3, HW4 }; + + // HW specifications + UINT8 m_hw_version; + bool m_flash_mem; + UINT32 m_initial_pc; + + // keyboard + UINT16 m_kb_mask; + UINT8 m_on_key; + + // LCD + UINT8 m_lcd_on; + UINT32 m_lcd_base; + UINT16 m_lcd_width; + UINT16 m_lcd_height; + UINT16 m_lcd_contrast; + + // I/O + UINT16 m_io_hw1[0x10]; + UINT16 m_io_hw2[0x80]; + + // Timer + UINT8 m_timer_on; + UINT8 m_timer_val; + UINT16 m_timer_mask; + + virtual void machine_start(); + virtual void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + UINT8 keypad_r(); + DECLARE_WRITE16_MEMBER ( ti68k_io_w ); + DECLARE_READ16_MEMBER ( ti68k_io_r ); + DECLARE_WRITE16_MEMBER ( ti68k_io2_w ); + DECLARE_READ16_MEMBER ( ti68k_io2_r ); + DECLARE_WRITE16_MEMBER ( flash_w ); + DECLARE_READ16_MEMBER ( flash_r ); + UINT64 m_timer; + DECLARE_PALETTE_INIT(ti68k); + DECLARE_INPUT_CHANGED_MEMBER(ti68k_on_key); + TIMER_DEVICE_CALLBACK_MEMBER(ti68k_timer_callback); +}; + +#endif // TI89_H_ diff --git a/src/mame/includes/tiki100.h b/src/mame/includes/tiki100.h new file mode 100644 index 00000000000..e66d1a6ff65 --- /dev/null +++ b/src/mame/includes/tiki100.h @@ -0,0 +1,146 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __TIKI100__ +#define __TIKI100__ + + +#include "emu.h" +#include "bus/centronics/ctronics.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "formats/tiki100_dsk.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/z80pio.h" +#include "machine/wd_fdc.h" +#include "sound/ay8910.h" + +#define Z80_TAG "z80" +#define Z80DART_TAG "z80dart" +#define Z80PIO_TAG "z80pio" +#define Z80CTC_TAG "z80ctc" +#define FD1797_TAG "fd1797" +#define AY8912_TAG "ay8912" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" +#define CASSETTE_TAG "cassette" +#define CENTRONICS_TAG "centronics" +#define SCREEN_TAG "screen" + +#define TIKI100_VIDEORAM_SIZE 0x8000 +#define TIKI100_VIDEORAM_MASK 0x7fff + +#define BANK_ROM 0 +#define BANK_RAM 1 +#define BANK_VIDEO_RAM 2 + +class tiki100_state : public driver_device +{ +public: + tiki100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ctc(*this, Z80CTC_TAG), + m_fdc(*this, FD1797_TAG), + m_pio(*this, Z80PIO_TAG), + m_dart(*this, Z80DART_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, FD1797_TAG":0"), + m_floppy1(*this, FD1797_TAG":1"), + m_cassette(*this, CASSETTE_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_rom(*this, Z80_TAG), + m_video_ram(*this, "video_ram"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_y10(*this, "Y10"), + m_y11(*this, "Y11"), + m_y12(*this, "Y12"), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_ctc; + required_device m_fdc; + required_device m_pio; + required_device m_dart; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_cassette; + required_device m_centronics; + required_memory_region m_rom; + optional_shared_ptr m_video_ram; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_y10; + required_ioport m_y11; + required_ioport m_y12; + required_device m_palette; + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( gfxram_r ); + DECLARE_WRITE8_MEMBER( gfxram_w ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_WRITE8_MEMBER( keyboard_w ); + DECLARE_WRITE8_MEMBER( video_mode_w ); + DECLARE_WRITE8_MEMBER( palette_w ); + DECLARE_WRITE8_MEMBER( system_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); + DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); + DECLARE_WRITE8_MEMBER( video_scroll_w ); + + DECLARE_READ8_MEMBER( pio_pb_r ); + DECLARE_WRITE8_MEMBER( pio_pb_w ); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + void bankswitch(); + + /* memory state */ + int m_rome; + int m_vire; + + /* video state */ + UINT8 m_scroll; + UINT8 m_mode; + UINT8 m_palette_val; + + /* keyboard state */ + int m_keylatch; + + TIMER_DEVICE_CALLBACK_MEMBER( ctc_tick ); + TIMER_DEVICE_CALLBACK_MEMBER( tape_tick ); + + DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + + int m_centronics_ack; + int m_centronics_busy; + int m_centronics_perror; +}; + +#endif diff --git a/src/mame/includes/tmc1800.h b/src/mame/includes/tmc1800.h new file mode 100644 index 00000000000..43d9c98daca --- /dev/null +++ b/src/mame/includes/tmc1800.h @@ -0,0 +1,209 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __TMC1800__ +#define __TMC1800__ + + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "machine/ram.h" +#include "machine/rescap.h" +#include "sound/cdp1864.h" +#include "video/cdp1861.h" +#include "sound/beep.h" + +#define TMC2000_COLORRAM_SIZE 0x200 + +#define SCREEN_TAG "screen" +#define CDP1802_TAG "cdp1802" +#define CDP1861_TAG "cdp1861" +#define CDP1864_TAG "m3" + +class tmc1800_base_state : public driver_device +{ +public: + tmc1800_base_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_cassette(*this, "cassette"), + m_rom(*this, CDP1802_TAG), + m_run(*this, "RUN"), + m_ram(*this, RAM_TAG), + m_beeper(*this, "beeper") + { } + + + required_device m_maincpu; + required_device m_cassette; + required_memory_region m_rom; + required_ioport m_run; + required_device m_ram; + optional_device m_beeper; + + DECLARE_QUICKLOAD_LOAD_MEMBER( tmc1800 ); +}; + +class tmc1800_state : public tmc1800_base_state +{ +public: + enum + { + TIMER_SETUP_BEEP + }; + + tmc1800_state(const machine_config &mconfig, device_type type, const char *tag) + : tmc1800_base_state(mconfig, type, tag), + m_vdc(*this, CDP1861_TAG) + { } + + required_device m_vdc; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( keylatch_w ); + DECLARE_READ8_MEMBER( dispon_r ); + DECLARE_WRITE8_MEMBER( dispoff_w ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + + /* keyboard state */ + int m_keylatch; /* key latch */ + DECLARE_DRIVER_INIT(tmc1800); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +class osc1000b_state : public tmc1800_base_state +{ +public: + osc1000b_state(const machine_config &mconfig, device_type type, const char *tag) + : tmc1800_base_state(mconfig, type, tag) + { } + + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_WRITE8_MEMBER( keylatch_w ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + + /* keyboard state */ + int m_keylatch; +}; + +class tmc2000_state : public tmc1800_base_state +{ +public: + tmc2000_state(const machine_config &mconfig, device_type type, const char *tag) + : tmc1800_base_state(mconfig, type, tag), + m_cti(*this, CDP1864_TAG), + m_colorram(*this, "color_ram"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7") + { } + + required_device m_cti; + optional_shared_ptr m_colorram; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( keylatch_w ); + DECLARE_WRITE8_MEMBER( bankswitch_w ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_WRITE8_MEMBER( dma_w ); + DECLARE_READ_LINE_MEMBER( rdata_r ); + DECLARE_READ_LINE_MEMBER( bdata_r ); + DECLARE_READ_LINE_MEMBER( gdata_r ); + DECLARE_INPUT_CHANGED_MEMBER( run_pressed ); + + void bankswitch(); + + // memory + int m_rac; + int m_roc; + + /* video state */ + UINT8 m_color; + + /* keyboard state */ + ioport_port* m_key_row[8]; + int m_keylatch; +}; + +class nano_state : public tmc1800_base_state +{ +public: + nano_state(const machine_config &mconfig, device_type type, const char *tag) + : tmc1800_base_state(mconfig, type, tag), + m_cti(*this, CDP1864_TAG), + m_ny0(*this, "NY0"), + m_ny1(*this, "NY1"), + m_monitor(*this, "MONITOR") + { } + + required_device m_cti; + required_ioport m_ny0; + required_ioport m_ny1; + required_ioport m_monitor; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void machine_start(); + virtual void machine_reset(); + + enum + { + TIMER_ID_EF4 + }; + + DECLARE_WRITE8_MEMBER( keylatch_w ); + DECLARE_WRITE8_MEMBER( bankswitch_w ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_INPUT_CHANGED_MEMBER( run_pressed ); + DECLARE_INPUT_CHANGED_MEMBER( monitor_pressed ); + + /* keyboard state */ + int m_keylatch; /* key latch */ +}; + +/* ---------- defined in video/tmc1800.c ---------- */ + +MACHINE_CONFIG_EXTERN( tmc1800_video ); +MACHINE_CONFIG_EXTERN( osc1000b_video ); +MACHINE_CONFIG_EXTERN( tmc2000_video ); +MACHINE_CONFIG_EXTERN( nano_video ); + +#endif diff --git a/src/mame/includes/tmc2000e.h b/src/mame/includes/tmc2000e.h new file mode 100644 index 00000000000..e54fffa67ab --- /dev/null +++ b/src/mame/includes/tmc2000e.h @@ -0,0 +1,87 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __TMC2000E__ +#define __TMC2000E__ + + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "machine/rescap.h" +#include "sound/cdp1864.h" + +#define SCREEN_TAG "screen" +#define CDP1802_TAG "cdp1802" +#define CDP1864_TAG "cdp1864" + +#define TMC2000E_COLORRAM_SIZE 0x100 // ??? + +class tmc2000e_state : public driver_device +{ +public: + tmc2000e_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_cti(*this, CDP1864_TAG), + m_cassette(*this, "cassette"), + m_colorram(*this, "colorram"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_run(*this, "RUN") + { } + + required_device m_maincpu; + required_device m_cti; + required_device m_cassette; + required_shared_ptr m_colorram; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_run; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( vismac_r ); + DECLARE_WRITE8_MEMBER( vismac_w ); + DECLARE_READ8_MEMBER( floppy_r ); + DECLARE_WRITE8_MEMBER( floppy_w ); + DECLARE_READ8_MEMBER( ascii_keyboard_r ); + DECLARE_READ8_MEMBER( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + DECLARE_WRITE8_MEMBER( io_select_w ); + DECLARE_WRITE8_MEMBER( keyboard_latch_w ); + DECLARE_READ_LINE_MEMBER( rdata_r ); + DECLARE_READ_LINE_MEMBER( bdata_r ); + DECLARE_READ_LINE_MEMBER( gdata_r ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_WRITE8_MEMBER( dma_w ); + + /* video state */ + int m_cdp1864_efx; /* EFx */ + UINT8 m_color; + + /* keyboard state */ + ioport_port* m_key_row[8]; + int m_keylatch; /* key latch */ + int m_reset; /* reset activated */ +}; + +#endif diff --git a/src/mame/includes/tmc600.h b/src/mame/includes/tmc600.h new file mode 100644 index 00000000000..67855119897 --- /dev/null +++ b/src/mame/includes/tmc600.h @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __TMC600__ +#define __TMC600__ + + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "bus/centronics/ctronics.h" +#include "machine/ram.h" +#include "sound/cdp1869.h" + +#define SCREEN_TAG "screen" +#define CDP1802_TAG "cdp1802" +#define CDP1869_TAG "cdp1869" +#define CENTRONICS_TAG "centronics" + +#define TMC600_PAGE_RAM_SIZE 0x400 +#define TMC600_PAGE_RAM_MASK 0x3ff + +class tmc600_state : public driver_device +{ +public: + tmc600_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_vis(*this, CDP1869_TAG), + m_cassette(*this, "cassette"), + m_centronics(*this, "centronics"), + m_ram(*this, RAM_TAG), + m_char_rom(*this, "chargen"), + m_page_ram(*this, "page_ram"), + m_color_ram(*this, "color_ram"), + m_run(*this, "RUN"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7") + { } + + required_device m_maincpu; + required_device m_vis; + required_device m_cassette; + required_device m_centronics; + required_device m_ram; + required_region_ptr m_char_rom; + required_shared_ptr m_page_ram; + optional_shared_ptr m_color_ram; + required_ioport m_run; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + + virtual void machine_start(); + + virtual void video_start(); + + DECLARE_WRITE8_MEMBER( keyboard_latch_w ); + DECLARE_WRITE8_MEMBER( vismac_register_w ); + DECLARE_WRITE8_MEMBER( vismac_data_w ); + DECLARE_WRITE8_MEMBER( page_ram_w ); + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + + UINT8 get_color(UINT16 pma); + + // video state + int m_vismac_reg_latch; // video register latch + int m_vismac_color_latch; // color latch + int m_vismac_bkg_latch; // background color latch + int m_blink; // cursor blink + + // keyboard state + ioport_port* m_key_row[8]; + int m_keylatch; // key latch + + TIMER_DEVICE_CALLBACK_MEMBER(blink_tick); + CDP1869_CHAR_RAM_READ_MEMBER(tmc600_char_ram_r); + CDP1869_PCB_READ_MEMBER(tmc600_pcb_r); +}; + +// ---------- defined in video/tmc600.c ---------- + +MACHINE_CONFIG_EXTERN( tmc600_video ); + +#endif diff --git a/src/mame/includes/trs80.h b/src/mame/includes/trs80.h new file mode 100644 index 00000000000..e4ced5999ab --- /dev/null +++ b/src/mame/includes/trs80.h @@ -0,0 +1,206 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert and unknown others +/***************************************************************************** + * + * includes/trs80.h + * + ****************************************************************************/ + +#ifndef TRS80_H_ +#define TRS80_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "machine/ay31015.h" +#include "machine/buffer.h" +#include "bus/centronics/ctronics.h" +#include "machine/wd_fdc.h" +#include "imagedev/cassette.h" +#include "imagedev/flopdrv.h" +#include "imagedev/snapquik.h" +#include "formats/trs_cas.h" + + +class trs80_state : public driver_device +{ +public: + trs80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_centronics(*this, "centronics"), + m_cent_data_out(*this, "cent_data_out"), + m_cent_status_in(*this, "cent_status_in"), + m_ay31015(*this, "tr1602"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_floppy2(*this, "fdc:2"), + m_floppy3(*this, "fdc:3"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_p_videoram(*this, "p_videoram"), + m_region_maincpu(*this, "maincpu"), + m_io_config(*this, "CONFIG"), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_line4(*this, "LINE4"), + m_io_line5(*this, "LINE5"), + m_io_line6(*this, "LINE6"), + m_io_line7(*this, "LINE7"), + m_bank1(NULL), + m_bank2(NULL), + m_bank3(NULL), + m_bank4(NULL), + m_bank5(NULL), + m_bank6(NULL), + m_bank7(NULL), + m_bank8(NULL), + m_bank9(NULL), + m_bank11(NULL), + m_bank12(NULL), + m_bank13(NULL), + m_bank14(NULL), + m_bank15(NULL), + m_bank16(NULL), + m_bank17(NULL), + m_bank18(NULL), + m_bank19(NULL) { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_maincpu; + optional_device m_centronics; + optional_device m_cent_data_out; + optional_device m_cent_status_in; + optional_device m_ay31015; + optional_device m_fdc; + optional_device m_floppy0; + optional_device m_floppy1; + optional_device m_floppy2; + optional_device m_floppy3; + required_device m_speaker; + required_device m_cassette; + DECLARE_WRITE8_MEMBER ( trs80_ff_w ); + DECLARE_WRITE8_MEMBER ( lnw80_fe_w ); + DECLARE_WRITE8_MEMBER ( sys80_fe_w ); + DECLARE_WRITE8_MEMBER ( sys80_f8_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_ff_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_f4_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_ec_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_eb_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_ea_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_e9_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_e8_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_e4_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_e0_w ); + DECLARE_WRITE8_MEMBER ( trs80m4p_9c_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_90_w ); + DECLARE_WRITE8_MEMBER ( trs80m4_84_w ); + DECLARE_READ8_MEMBER ( lnw80_fe_r ); + DECLARE_READ8_MEMBER ( trs80_ff_r ); + DECLARE_READ8_MEMBER ( sys80_f9_r ); + DECLARE_READ8_MEMBER ( trs80m4_ff_r ); + DECLARE_READ8_MEMBER ( trs80m4_ec_r ); + DECLARE_READ8_MEMBER ( trs80m4_eb_r ); + DECLARE_READ8_MEMBER ( trs80m4_ea_r ); + DECLARE_READ8_MEMBER ( trs80m4_e8_r ); + DECLARE_READ8_MEMBER ( trs80m4_e4_r ); + DECLARE_READ8_MEMBER ( trs80m4_e0_r ); + DECLARE_READ8_MEMBER( trs80_irq_status_r ); + DECLARE_READ8_MEMBER( trs80_printer_r ); + DECLARE_WRITE8_MEMBER( trs80_printer_w ); + DECLARE_WRITE8_MEMBER( trs80_cassunit_w ); + DECLARE_WRITE8_MEMBER( trs80_motor_w ); + DECLARE_READ8_MEMBER( trs80_keyboard_r ); + DECLARE_WRITE8_MEMBER ( trs80m4_88_w ); + DECLARE_READ8_MEMBER( trs80_videoram_r ); + DECLARE_WRITE8_MEMBER( trs80_videoram_w ); + DECLARE_READ8_MEMBER( trs80_gfxram_r ); + DECLARE_WRITE8_MEMBER( trs80_gfxram_w ); + DECLARE_READ8_MEMBER (trs80_wd179x_r); + const UINT8 *m_p_chargen; + optional_shared_ptr m_p_videoram; + UINT8 *m_p_gfxram; + UINT8 m_model4; + UINT8 m_mode; + UINT8 m_irq; + UINT8 m_mask; + UINT8 m_nmi_mask; + UINT8 m_port_ec; + UINT8 m_tape_unit; + UINT8 m_reg_load; + UINT8 m_nmi_data; +#ifdef USE_TRACK + UINT8 m_track[4]; +#endif + UINT8 m_head; +#ifdef USE_SECTOR + UINT8 m_sector[4]; +#endif + UINT8 m_cassette_data; + emu_timer *m_cassette_data_timer; + double m_old_cassette_val; + UINT16 m_start_address; + UINT8 m_crtc_reg; + UINT8 m_size_store; + DECLARE_DRIVER_INIT(trs80m4); + DECLARE_DRIVER_INIT(trs80l2); + DECLARE_DRIVER_INIT(trs80m4p); + DECLARE_DRIVER_INIT(lnw80); + DECLARE_DRIVER_INIT(trs80); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_MACHINE_RESET(trs80m4); + DECLARE_MACHINE_RESET(lnw80); + DECLARE_PALETTE_INIT(lnw80); + UINT32 screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_trs80m4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_lnw80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_radionic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_meritum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(trs80_rtc_interrupt); + INTERRUPT_GEN_MEMBER(trs80_fdc_interrupt); + TIMER_CALLBACK_MEMBER(cassette_data_callback); + DECLARE_WRITE_LINE_MEMBER(trs80_fdc_intrq_w); + DECLARE_QUICKLOAD_LOAD_MEMBER( trs80_cmd ); + +protected: + required_memory_region m_region_maincpu; + required_ioport m_io_config; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_ioport m_io_line3; + required_ioport m_io_line4; + required_ioport m_io_line5; + required_ioport m_io_line6; + required_ioport m_io_line7; + memory_bank *m_bank1; + memory_bank *m_bank2; + memory_bank *m_bank3; + memory_bank *m_bank4; + memory_bank *m_bank5; + memory_bank *m_bank6; + memory_bank *m_bank7; + memory_bank *m_bank8; + memory_bank *m_bank9; + memory_bank *m_bank11; + memory_bank *m_bank12; + memory_bank *m_bank13; + memory_bank *m_bank14; + memory_bank *m_bank15; + memory_bank *m_bank16; + memory_bank *m_bank17; + memory_bank *m_bank18; + memory_bank *m_bank19; + + void trs80_fdc_interrupt_internal(); +}; + +#endif /* TRS80_H_ */ diff --git a/src/mame/includes/trs80m2.h b/src/mame/includes/trs80m2.h new file mode 100644 index 00000000000..94a85e36038 --- /dev/null +++ b/src/mame/includes/trs80m2.h @@ -0,0 +1,168 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __TRS80M2__ +#define __TRS80M2__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "cpu/mcs48/mcs48.h" +#include "cpu/m68000/m68000.h" +#include "bus/centronics/ctronics.h" +#include "machine/keyboard.h" +#include "machine/pic8259.h" +#include "machine/ram.h" +#include "machine/trs80m2kb.h" +#include "machine/wd_fdc.h" +#include "machine/z80ctc.h" +#include "machine/z80dma.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "video/mc6845.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "u12" +#define Z80CTC_TAG "u19" +#define Z80DMA_TAG "u20" +#define Z80PIO_TAG "u22" +#define Z80SIO_TAG "u18" +#define FD1791_TAG "u6" +#define MC6845_TAG "u11" +#define CENTRONICS_TAG "j2" +#define M68000_TAG "m16_u22" +#define AM9519A_TAG "m16_u11" + +class trs80m2_state : public driver_device +{ +public: + trs80m2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ctc(*this, Z80CTC_TAG), + m_dmac(*this, Z80DMA_TAG), + m_pio(*this, Z80PIO_TAG), + m_crtc(*this, MC6845_TAG), + m_palette(*this, "palette"), + m_fdc(*this, FD1791_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_floppy0(*this, FD1791_TAG":0"), + m_floppy1(*this, FD1791_TAG":1"), + m_floppy2(*this, FD1791_TAG":2"), + m_floppy3(*this, FD1791_TAG":3"), + m_floppy(NULL), + m_ram(*this, RAM_TAG), + m_kb(*this, TRS80M2_KEYBOARD_TAG), + m_rom(*this, Z80_TAG), + m_char_rom(*this, MC6845_TAG), + m_video_ram(*this, "video_ram") + { + } + + required_device m_maincpu; + required_device m_ctc; + required_device m_dmac; + required_device m_pio; + required_device m_crtc; + required_device m_palette; + required_device m_fdc; + required_device m_centronics; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + floppy_image_device *m_floppy; + required_device m_ram; + required_device m_kb; + required_memory_region m_rom; + required_memory_region m_char_rom; + optional_shared_ptr m_video_ram; + + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_WRITE8_MEMBER( drvslt_w ); + DECLARE_WRITE8_MEMBER( rom_enable_w ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_READ8_MEMBER( rtc_r ); + DECLARE_READ8_MEMBER( nmi_r ); + DECLARE_WRITE8_MEMBER( nmi_w ); + DECLARE_READ8_MEMBER( keyboard_busy_r ); + DECLARE_READ8_MEMBER( keyboard_data_r ); + DECLARE_WRITE8_MEMBER( keyboard_ctrl_w ); + DECLARE_WRITE8_MEMBER( keyboard_latch_w ); + DECLARE_READ8_MEMBER( fdc_r ); + DECLARE_WRITE8_MEMBER( fdc_w ); + DECLARE_WRITE_LINE_MEMBER( de_w ); + DECLARE_WRITE_LINE_MEMBER( vsync_w ); + DECLARE_READ8_MEMBER( pio_pa_r ); + DECLARE_WRITE8_MEMBER( pio_pa_w ); + DECLARE_WRITE_LINE_MEMBER( strobe_w ); + DECLARE_WRITE_LINE_MEMBER( kb_clock_w ); + DECLARE_WRITE8_MEMBER( kbd_w ); + + MC6845_UPDATE_ROW( crtc_update_row ); + + // memory state + int m_boot_rom; + int m_bank; + int m_msel; + + // keyboard state + UINT8 m_key_latch; + UINT8 m_key_data; + int m_key_bit; + int m_kbclk; + int m_kbdata; + int m_kbirq; + + // video state + int m_blnkvid; + int m_80_40_char_en; + int m_de; + int m_rtc_int; + int m_enable_rtc_int; + + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + + int m_centronics_busy; + int m_centronics_fault; + int m_centronics_perror; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); +}; + +class trs80m16_state : public trs80m2_state +{ +public: + trs80m16_state(const machine_config &mconfig, device_type type, const char *tag) + : trs80m2_state(mconfig, type, tag), + m_subcpu(*this, M68000_TAG), + m_pic(*this, AM9519A_TAG) + { } + + required_device m_subcpu; + required_device m_pic; + + virtual void machine_start(); + + DECLARE_WRITE8_MEMBER( ual_w ); + DECLARE_WRITE8_MEMBER( tcl_w ); + + UINT16 m_ual; + UINT8 m_limit[2]; + UINT8 m_offset[2]; +}; + +#endif diff --git a/src/mame/includes/tsispch.h b/src/mame/includes/tsispch.h new file mode 100644 index 00000000000..25c7b088da6 --- /dev/null +++ b/src/mame/includes/tsispch.h @@ -0,0 +1,58 @@ +// license:BSD-3-Clause +// copyright-holders:Jonathan Gevaryahu +/*************************************************************************** + + tsispch.h + +****************************************************************************/ + +#pragma once + +#ifndef _TSISPCH_H_ +#define _TSISPCH_H_ + +#include "machine/i8251.h" +#include "machine/pic8259.h" +#include "machine/terminal.h" + +#define TERMINAL_TAG "terminal" + +class tsispch_state : public driver_device +{ +public: + tsispch_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_dsp(*this, "dsp"), + m_terminal(*this, TERMINAL_TAG), + m_uart(*this, "i8251a_u15"), + m_pic(*this, "pic8259") + { + } + + required_device m_maincpu; + required_device m_dsp; + required_device m_terminal; + required_device m_uart; + required_device m_pic; + + UINT8 m_paramReg; // status leds and resets and etc + + virtual void machine_reset(); + DECLARE_WRITE8_MEMBER(i8251_rxd); + DECLARE_READ8_MEMBER(dsw_r); + DECLARE_WRITE8_MEMBER(peripheral_w); + DECLARE_READ16_MEMBER(dsp_data_r); + DECLARE_WRITE16_MEMBER(dsp_data_w); + DECLARE_READ16_MEMBER(dsp_status_r); + DECLARE_WRITE16_MEMBER(dsp_status_w); + DECLARE_DRIVER_INIT(prose2k); + DECLARE_WRITE_LINE_MEMBER(i8251_rxrdy_int); + DECLARE_WRITE_LINE_MEMBER(i8251_txempty_int); + DECLARE_WRITE_LINE_MEMBER(i8251_txrdy_int); + DECLARE_WRITE_LINE_MEMBER(dsp_to_8086_p0_w); + DECLARE_WRITE_LINE_MEMBER(dsp_to_8086_p1_w); +}; + + +#endif // _TSISPCH_H_ diff --git a/src/mame/includes/tx0.h b/src/mame/includes/tx0.h new file mode 100644 index 00000000000..98d111d72ec --- /dev/null +++ b/src/mame/includes/tx0.h @@ -0,0 +1,329 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/***************************************************************************** + * + * includes/tx0.h + * + ****************************************************************************/ + +#ifndef TX0_H_ +#define TX0_H_ + +#include "video/crt.h" +#include "cpu/pdp1/tx0.h" + +enum state_t +{ + MTS_UNSELECTED, + MTS_SELECTING, + MTS_SELECTED, + MTS_UNSELECTING +}; + +enum backspace_state_t +{ + MTBSS_STATE0, + MTBSS_STATE1, + MTBSS_STATE2, + MTBSS_STATE3, + MTBSS_STATE4, + MTBSS_STATE5, + MTBSS_STATE6 +}; + +enum state_2_t +{ + MTRDS_STATE0, + MTRDS_STATE1, + MTRDS_STATE2, + MTRDS_STATE3, + MTRDS_STATE4, + MTRDS_STATE5, + MTRDS_STATE6 +}; + +enum state_3_t +{ + MTWTS_STATE0, + MTWTS_STATE1, + MTWTS_STATE2, + MTWTS_STATE3 +}; + +enum irg_pos_t +{ + MTIRGP_START, + MTIRGP_ENDMINUS1, + MTIRGP_END +}; + + + +/* tape reader registers */ +struct tx0_tape_reader_t +{ + device_image_interface *fd; /* file descriptor of tape image */ + + int motor_on; /* 1-bit reader motor on */ + + int rcl; /* 1-bit reader clutch */ + int rc; /* 2-bit reader counter */ + + emu_timer *timer; /* timer to simulate reader timing */ +}; + + + +/* tape puncher registers */ +struct tape_puncher_t +{ + device_image_interface *fd; /* file descriptor of tape image */ + + emu_timer *timer; /* timer to generate completion pulses */ +}; + + + +/* typewriter registers */ +struct tx0_typewriter_t +{ + device_image_interface *fd; /* file descriptor of output image */ + + emu_timer *prt_timer;/* timer to generate completion pulses */ +}; + + +/* magnetic tape unit registers */ +struct magtape_t +{ + device_image_interface *img; /* image descriptor */ + + state_t state; + + int command; + int binary_flag; + + union + { + backspace_state_t backspace_state; + struct + { + state_2_t state; + int space_flag; + } read; + struct + { + state_3_t state; + int counter; + } write; + } u; + + int sel_pending; + int cpy_pending; + + irg_pos_t irg_pos; /* position relative to inter-record gap */ + + int long_parity; + + emu_timer *timer; /* timer to simulate reader timing */ +}; + + +class tx0_state : public driver_device +{ +public: + tx0_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_crt(*this, "crt"), + m_csw(*this, "CSW"), + m_twr(*this, "TWR") + { } + + tx0_tape_reader_t m_tape_reader; + tape_puncher_t m_tape_puncher; + tx0_typewriter_t m_typewriter; + emu_timer *m_dis_timer; + magtape_t m_magtape; + int m_old_typewriter_keys[4]; + int m_old_control_keys; + int m_old_tsr_keys; + int m_tsr_index; + int m_typewriter_color; + bitmap_ind16 m_panel_bitmap; + bitmap_ind16 m_typewriter_bitmap; + int m_pos; + int m_case_shift; + DECLARE_DRIVER_INIT(tx0); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(tx0); + UINT32 screen_update_tx0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void screen_eof_tx0(screen_device &screen, bool state); + INTERRUPT_GEN_MEMBER(tx0_interrupt); + TIMER_CALLBACK_MEMBER(reader_callback); + TIMER_CALLBACK_MEMBER(puncher_callback); + TIMER_CALLBACK_MEMBER(prt_callback); + TIMER_CALLBACK_MEMBER(dis_callback); + void tx0_machine_stop(); + required_device m_maincpu; + inline void tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void tx0_plot(int x, int y); + void tx0_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); + void tx0_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); + void tx0_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state); + void tx0_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); + void tx0_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color); + void tx0_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color); + void tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color); + void tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color); + void tx0_draw_panel_backdrop(bitmap_ind16 &bitmap); + void tx0_draw_panel(bitmap_ind16 &bitmap); + void tx0_typewriter_linefeed(); + void tx0_typewriter_drawchar(int character); + int tape_read(UINT8 *reply); + void tape_write(UINT8 data); + void begin_tape_read(int binary); + void typewriter_out(UINT8 data); + void schedule_select(); + void schedule_unselect(); + void tx0_keyboard(); + DECLARE_WRITE_LINE_MEMBER(tx0_io_cpy); + DECLARE_WRITE_LINE_MEMBER(tx0_io_r1l); + DECLARE_WRITE_LINE_MEMBER(tx0_io_r3l); + DECLARE_WRITE_LINE_MEMBER(tx0_io_p6h); + DECLARE_WRITE_LINE_MEMBER(tx0_io_p7h); + DECLARE_WRITE_LINE_MEMBER(tx0_io_prt); + DECLARE_WRITE_LINE_MEMBER(tx0_io_dis); + DECLARE_WRITE_LINE_MEMBER(tx0_sel); + DECLARE_WRITE_LINE_MEMBER(tx0_io_reset_callback); + void magtape_callback(); + +private: + required_device m_gfxdecode; + required_device m_palette; + required_device m_crt; + required_ioport m_csw; + required_ioport_array<4> m_twr; +}; + +/* defines for each bit and mask in input port "CSW" */ +enum +{ + /* bit numbers */ + tx0_control_bit = 0, + + tx0_stop_c0_bit = 1, + tx0_stop_c1_bit = 2, + tx0_gbl_cm_sel_bit = 3, + tx0_stop_bit = 4, + tx0_restart_bit = 5, + tx0_read_in_bit = 6, + + tx0_toggle_dn_bit = 12, + tx0_toggle_up_bit = 13, + tx0_cm_sel_bit = 14, + tx0_lr_sel_bit = 15, + + /* masks */ + tx0_control = (1 << tx0_control_bit), + + tx0_stop_cyc0 = (1 << tx0_stop_c0_bit), + tx0_stop_cyc1 = (1 << tx0_stop_c1_bit), + tx0_gbl_cm_sel = (1 << tx0_gbl_cm_sel_bit), + tx0_stop = (1 << tx0_stop_bit), + tx0_restart = (1 << tx0_restart_bit), + tx0_read_in = (1 << tx0_read_in_bit), + + tx0_toggle_dn = (1 << tx0_toggle_dn_bit), + tx0_toggle_up = (1 << tx0_toggle_up_bit), + tx0_cm_sel = (1 << tx0_cm_sel_bit), + tx0_lr_sel = (1 << tx0_lr_sel_bit) +}; + +/* defines for our font */ +enum +{ + tx0_charnum = /*96*/128, /* ASCII set + xx special characters */ + /* for whatever reason, 96 breaks some characters */ + + tx0_fontdata_size = 8 * tx0_charnum +}; + +enum +{ + /* size and position of crt window */ + crt_window_width = /*511*/512, + crt_window_height = /*511*/512, + crt_window_offset_x = 0, + crt_window_offset_y = 0, + /* size and position of operator control panel window */ + panel_window_width = 272, + panel_window_height = 264, + panel_window_offset_x = crt_window_width, + panel_window_offset_y = 0, + /* size and position of typewriter window */ + typewriter_window_width = 640, + typewriter_window_height = 160, + typewriter_window_offset_x = 0, + typewriter_window_offset_y = crt_window_height +}; + +enum +{ + total_width = crt_window_width + panel_window_width, + total_height = crt_window_height + typewriter_window_height, + + /* respect 4:3 aspect ratio to keep pixels square */ + virtual_width_1 = ((total_width+3)/4)*4, + virtual_height_1 = ((total_height+2)/3)*3, + virtual_width_2 = virtual_height_1*4/3, + virtual_height_2 = virtual_width_1*3/4, + virtual_width = (virtual_width_1 > virtual_width_2) ? virtual_width_1 : virtual_width_2, + virtual_height = (virtual_height_1 > virtual_height_2) ? virtual_height_1 : virtual_height_2 +}; + +enum +{ /* refresh rate in Hz: can be changed at will */ + refresh_rate = 60 +}; + +/* Color codes */ +enum +{ + /* first pen_crt_num_levels colors used for CRT (with remanence) */ + pen_crt_num_levels = 69, + pen_crt_max_intensity = pen_crt_num_levels-1, + + /* next colors used for control panel and typewriter */ + pen_black = pen_crt_num_levels, + pen_white, + pen_green, + pen_dk_green, + pen_red, + pen_lt_gray, + + /* color constants for control panel */ + pen_panel_bg = pen_black, + pen_panel_caption = pen_white, + color_panel_caption = 0, + pen_switch_nut = pen_lt_gray, + pen_switch_button = pen_white, + pen_lit_lamp = pen_green, + pen_unlit_lamp = pen_dk_green, + + /* color constants for typewriter */ + pen_typewriter_bg = pen_white, + color_typewriter_black = 1, /* palette 1 = black on white */ + color_typewriter_red = 2, /* palette 2 = red on white */ + + /* color constants used for light pen */ + pen_lightpen_nonpressed = pen_red, + pen_lightpen_pressed = pen_green +}; + + +#endif /* TX0_H_ */ diff --git a/src/mame/includes/ut88.h b/src/mame/includes/ut88.h new file mode 100644 index 00000000000..757d1f7a98c --- /dev/null +++ b/src/mame/includes/ut88.h @@ -0,0 +1,100 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/ut88.h + * + ****************************************************************************/ + +#ifndef UT88_H_ +#define UT88_H_ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/dac.h" +#include "sound/wave.h" +#include "machine/i8255.h" +#include "imagedev/cassette.h" + + +class ut88_state : public driver_device +{ +public: + enum + { + TIMER_RESET, + TIMER_UPDATE_DISPLAY + }; + + ut88_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_cassette(*this, "cassette"), + m_ppi(*this, "ppi8255"), + m_dac(*this, "dac"), + m_p_videoram(*this, "p_videoram"), + m_region_maincpu(*this, "maincpu"), + m_region_proms(*this, "proms"), + m_bank1(*this, "bank1"), + m_io_line0(*this, "LINE0"), + m_io_line1(*this, "LINE1"), + m_io_line2(*this, "LINE2"), + m_io_line3(*this, "LINE3"), + m_io_line4(*this, "LINE4"), + m_io_line5(*this, "LINE5"), + m_io_line6(*this, "LINE6"), + m_io_line7(*this, "LINE7"), + m_io_line8(*this, "LINE8") , + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + required_device m_cassette; + optional_device m_ppi; + optional_device m_dac; + DECLARE_READ8_MEMBER(ut88_keyboard_r); + DECLARE_WRITE8_MEMBER(ut88_keyboard_w); + DECLARE_WRITE8_MEMBER(ut88_sound_w); + DECLARE_READ8_MEMBER(ut88_tape_r); + DECLARE_READ8_MEMBER(ut88mini_keyboard_r); + DECLARE_WRITE8_MEMBER(ut88mini_write_led); + DECLARE_READ8_MEMBER(ut88_8255_portb_r); + DECLARE_READ8_MEMBER(ut88_8255_portc_r); + DECLARE_WRITE8_MEMBER(ut88_8255_porta_w); + optional_shared_ptr m_p_videoram; + int m_keyboard_mask; + int m_lcd_digit[6]; + DECLARE_DRIVER_INIT(ut88); + DECLARE_DRIVER_INIT(ut88mini); + DECLARE_MACHINE_RESET(ut88); + DECLARE_VIDEO_START(ut88); + DECLARE_MACHINE_START(ut88mini); + DECLARE_MACHINE_RESET(ut88mini); + UINT32 screen_update_ut88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(ut88_reset); + TIMER_CALLBACK_MEMBER(update_display); + +protected: + required_memory_region m_region_maincpu; + optional_memory_region m_region_proms; + optional_memory_bank m_bank1; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + optional_ioport m_io_line3; + optional_ioport m_io_line4; + optional_ioport m_io_line5; + optional_ioport m_io_line6; + optional_ioport m_io_line7; + optional_ioport m_io_line8; + required_device m_maincpu; + optional_device m_gfxdecode; + optional_device m_palette; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +/*----------- defined in video/ut88.c -----------*/ + +extern const gfx_layout ut88_charlayout; + + +#endif /* UT88_H_ */ diff --git a/src/mame/includes/v1050.h b/src/mame/includes/v1050.h new file mode 100644 index 00000000000..429f032c38a --- /dev/null +++ b/src/mame/includes/v1050.h @@ -0,0 +1,235 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __V1050__ +#define __V1050__ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/m6502/m6502.h" +#include "bus/centronics/ctronics.h" +#include "bus/scsi/s1410.h" +#include "machine/clock.h" +#include "machine/i8214.h" +#include "machine/i8251.h" +#include "machine/i8255.h" +#include "machine/msm58321.h" +#include "machine/ram.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" +#include "machine/v1050kb.h" +#include "machine/wd_fdc.h" +#include "video/mc6845.h" + +#define SCREEN_TAG "screen" + +#define Z80_TAG "u80" +#define UPB8214_TAG "u38" +#define I8255A_DISP_TAG "u79" +#define I8255A_MISC_TAG "u10" +#define I8255A_RTC_TAG "u36" +#define I8251A_KB_TAG "u85" +#define I8251A_SIO_TAG "u8" +#define MSM58321RS_TAG "u26" +#define MB8877_TAG "u13" +#define FDC9216_TAG "u25" +#define M6502_TAG "u76" +#define I8255A_M6502_TAG "u101" +#define H46505_TAG "u75" +#define CENTRONICS_TAG "centronics" +#define CLOCK_KB_TAG "keyboard_clock" +#define CLOCK_SIO_TAG "sio_clock" +#define TIMER_ACK_TAG "timer_ack" +#define TIMER_RST_TAG "timer_rst" +#define SASIBUS_TAG "sasi" +#define RS232_TAG "rs232" +#define V1050_KEYBOARD_TAG "v1050kb" + +#define V1050_VIDEORAM_SIZE 0x8000 +#define V1050_VIDEORAM_MASK 0x7fff + +#define INT_RS_232 0x01 +#define INT_WINCHESTER 0x02 +#define INT_KEYBOARD 0x04 +#define INT_FLOPPY 0x08 +#define INT_VSYNC 0x10 +#define INT_DISPLAY 0x20 +#define INT_EXPANSION_B 0x40 +#define INT_EXPANSION_A 0x80 + +class v1050_state : public driver_device +{ +public: + v1050_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_subcpu(*this, M6502_TAG), + m_pic(*this, UPB8214_TAG), + m_ppi_disp(*this, I8255A_DISP_TAG), + m_ppi_6502(*this, I8255A_M6502_TAG), + m_rtc(*this, MSM58321RS_TAG), + m_uart_kb(*this, I8251A_KB_TAG), + m_uart_sio(*this, I8251A_SIO_TAG), + m_fdc(*this, MB8877_TAG), + m_crtc(*this, H46505_TAG), + m_palette(*this, "palette"), + m_centronics(*this, CENTRONICS_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, MB8877_TAG":0"), + m_floppy1(*this, MB8877_TAG":1"), + m_floppy2(*this, MB8877_TAG":2"), + m_floppy3(*this, MB8877_TAG":3"), + m_clock_sio(*this, CLOCK_SIO_TAG), + m_timer_ack(*this, TIMER_ACK_TAG), + m_timer_rst(*this, TIMER_RST_TAG), + m_sasibus(*this, SASIBUS_TAG), + m_sasi_data_out(*this, "scsi_data_out"), + m_sasi_data_in(*this, "scsi_data_in"), + m_sasi_ctrl_in(*this, "scsi_ctrl_in"), + m_rom(*this, Z80_TAG), + m_video_ram(*this, "video_ram"), + m_attr_ram(*this, "attr_ram"), + m_rtc_ppi_pa(0), + m_rtc_ppi_pc(0) + { + } + + DECLARE_READ8_MEMBER( kb_data_r ); + DECLARE_READ8_MEMBER( kb_status_r ); + DECLARE_WRITE8_MEMBER( v1050_i8214_w ); + DECLARE_READ8_MEMBER( vint_clr_r ); + DECLARE_WRITE8_MEMBER( vint_clr_w ); + DECLARE_READ8_MEMBER( dint_clr_r ); + DECLARE_WRITE8_MEMBER( dint_clr_w ); + DECLARE_WRITE8_MEMBER( bank_w ); + DECLARE_WRITE8_MEMBER( dint_w ); + DECLARE_WRITE8_MEMBER( dvint_clr_w ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_WRITE8_MEMBER( keyboard_w ); + DECLARE_WRITE8_MEMBER( p2_w ); + DECLARE_WRITE8_MEMBER( misc_ppi_pa_w ); + DECLARE_WRITE8_MEMBER( misc_ppi_pc_w ); + DECLARE_READ8_MEMBER( rtc_ppi_pa_r ); + DECLARE_WRITE8_MEMBER( rtc_ppi_pa_w ); + DECLARE_WRITE8_MEMBER( rtc_ppi_pb_w ); + DECLARE_READ8_MEMBER( rtc_ppi_pc_r ); + DECLARE_WRITE8_MEMBER( rtc_ppi_pc_w ); + DECLARE_WRITE_LINE_MEMBER( kb_rxrdy_w ); + DECLARE_WRITE_LINE_MEMBER( sio_rxrdy_w ); + DECLARE_WRITE_LINE_MEMBER( sio_txrdy_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + DECLARE_READ8_MEMBER( attr_r ); + DECLARE_WRITE8_MEMBER( attr_w ); + DECLARE_READ8_MEMBER( videoram_r ); + DECLARE_WRITE8_MEMBER( videoram_w ); + DECLARE_WRITE_LINE_MEMBER( crtc_vs_w ); + DECLARE_WRITE8_MEMBER(sasi_data_w); + DECLARE_WRITE_LINE_MEMBER(write_sasi_io); + DECLARE_READ8_MEMBER( sasi_status_r ); + DECLARE_WRITE8_MEMBER( sasi_ctrl_w ); + + WRITE_LINE_MEMBER( rtc_ppi_pa_0_w ){ m_rtc_ppi_pa = (m_rtc_ppi_pa & ~(1 << 0)) | ((state & 1) << 0); } + WRITE_LINE_MEMBER( rtc_ppi_pa_1_w ){ m_rtc_ppi_pa = (m_rtc_ppi_pa & ~(1 << 1)) | ((state & 1) << 1); } + WRITE_LINE_MEMBER( rtc_ppi_pa_2_w ){ m_rtc_ppi_pa = (m_rtc_ppi_pa & ~(1 << 2)) | ((state & 1) << 2); } + WRITE_LINE_MEMBER( rtc_ppi_pa_3_w ){ m_rtc_ppi_pa = (m_rtc_ppi_pa & ~(1 << 3)) | ((state & 1) << 3); } + WRITE_LINE_MEMBER( rtc_ppi_pc_3_w ){ m_rtc_ppi_pc = (m_rtc_ppi_pc & ~(1 << 3)) | ((state & 1) << 3); } + + TIMER_DEVICE_CALLBACK_MEMBER(v1050_keyboard_tick); + TIMER_DEVICE_CALLBACK_MEMBER(sasi_ack_tick); + TIMER_DEVICE_CALLBACK_MEMBER(sasi_rst_tick); + DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); + DECLARE_WRITE_LINE_MEMBER(write_sio_clock); + DECLARE_WRITE_LINE_MEMBER(pic_int_w); + DECLARE_WRITE8_MEMBER(disp_ppi_pc_w); + DECLARE_WRITE8_MEMBER(m6502_ppi_pc_w); + DECLARE_READ8_MEMBER(misc_ppi_pc_r); + IRQ_CALLBACK_MEMBER(v1050_int_ack); + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); + + MC6845_UPDATE_ROW(crtc_update_row); + +protected: + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + +private: + void bankswitch(); + void update_fdc(); + void set_interrupt(UINT8 mask, int state); + void scan_keyboard(); + void set_baud_sel(int sel); + +public: // HACK for MC6845 + required_device m_maincpu; + required_device m_subcpu; + required_device m_pic; + required_device m_ppi_disp; + required_device m_ppi_6502; + required_device m_rtc; + required_device m_uart_kb; + required_device m_uart_sio; + required_device m_fdc; + required_device m_crtc; + required_device m_palette; + required_device m_centronics; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_device m_clock_sio; + required_device m_timer_ack; + required_device m_timer_rst; + required_device m_sasibus; + required_device m_sasi_data_out; + required_device m_sasi_data_in; + required_device m_sasi_ctrl_in; + required_memory_region m_rom; + required_shared_ptr m_video_ram; + optional_shared_ptr m_attr_ram; + + // interrupt state + UINT8 m_int_mask; // interrupt mask + UINT8 m_int_state; // interrupt status + int m_f_int_enb; // floppy interrupt enable + bool m_fdc_irq; + bool m_fdc_drq; + + // keyboard state + UINT8 m_keylatch; // keyboard row select + UINT8 m_keydata; + int m_keyavail; + + // serial state + int m_rxrdy; // receiver ready + int m_txrdy; // transmitter ready + int m_baud_sel; // baud select + + // memory state + UINT8 m_bank; // bank register + + // video state + UINT8 m_attr; // attribute latch + + // sasi state + UINT8 m_sasi_data; + int m_sasi_data_enable; + + UINT8 m_rtc_ppi_pa; + UINT8 m_rtc_ppi_pc; + + int m_centronics_busy; + int m_centronics_perror; +}; + +//----------- defined in video/v1050.c ----------- + +MACHINE_CONFIG_EXTERN( v1050_video ); + +#endif diff --git a/src/mame/includes/vc4000.h b/src/mame/includes/vc4000.h new file mode 100644 index 00000000000..f0d0c95cab8 --- /dev/null +++ b/src/mame/includes/vc4000.h @@ -0,0 +1,157 @@ +// license:??? +// copyright-holders:Peter Trauner, Manfred Schneider, Robbbert +/***************************************************************************** + * + * includes/vc4000.h + * + ****************************************************************************/ + +#ifndef VC4000_H_ +#define VC4000_H_ + +#include "emu.h" +#include "audio/vc4000snd.h" +#include "cpu/s2650/s2650.h" +#include "imagedev/snapquik.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" + +#include "bus/vc4000/slot.h" +#include "bus/vc4000/rom.h" + +// define this to use digital inputs instead of the slow +// autocentering analog mame joys +#define ANALOG_HACK + + +struct SPRITE_HELPER +{ + UINT8 bitmap[10],x1,x2,y1,y2, res1, res2; +}; + +struct SPRITE +{ + const SPRITE_HELPER *data; + int mask; + int state; + int delay; + int size; + int y; + UINT8 scolor; + int finished; + int finished_now; +}; + +struct vc4000_video_t +{ + SPRITE sprites[4]; + int line; + UINT8 sprite_collision; + UINT8 background_collision; + union + { + UINT8 data[0x100]; + struct + { + SPRITE_HELPER sprites[3]; + UINT8 res[0x10]; + SPRITE_HELPER sprite4; + UINT8 res2[0x30]; + UINT8 grid[20][2]; + UINT8 grid_control[5]; + UINT8 res3[0x13]; + UINT8 sprite_sizes; + UINT8 sprite_colors[2]; + UINT8 score_control; + UINT8 res4[2]; + UINT8 background; + UINT8 sound; + UINT8 bcd[2]; + UINT8 background_collision; + UINT8 sprite_collision; + } d; + } reg; +} ; + +class vc4000_state : public driver_device +{ +public: + vc4000_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_screen(*this, "screen"), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_custom(*this, "custom"), + m_keypad1_1(*this, "KEYPAD1_1"), + m_keypad1_2(*this, "KEYPAD1_2"), + m_keypad1_3(*this, "KEYPAD1_3"), + m_panel(*this, "PANEL"), + m_keypad2_1(*this, "KEYPAD2_1"), + m_keypad2_2(*this, "KEYPAD2_2"), + m_keypad2_3(*this, "KEYPAD2_3"), +#ifndef ANALOG_HACK + m_io_joy1_x(*this, "JOY1_X"), + m_io_joy1_y(*this, "JOY1_Y"), + m_io_joy2_x(*this, "JOY2_X"), + m_io_joy2_y(*this, "JOY2_Y") +#else + m_joys(*this, "JOYS"), + m_config(*this, "CONFIG") +#endif + { } + + DECLARE_WRITE8_MEMBER(vc4000_sound_ctl); + DECLARE_READ8_MEMBER(vc4000_key_r); + DECLARE_READ8_MEMBER(vc4000_video_r); + DECLARE_WRITE8_MEMBER(vc4000_video_w); + DECLARE_READ8_MEMBER(vc4000_vsync_r); + DECLARE_READ8_MEMBER(elektor_cass_r); + DECLARE_WRITE8_MEMBER(elektor_cass_w); + vc4000_video_t m_video; + UINT8 m_sprite_collision[0x20]; + UINT8 m_background_collision[0x20]; + UINT8 m_joy1_x; + UINT8 m_joy1_y; + UINT8 m_joy2_x; + UINT8 m_joy2_y; + UINT8 m_objects[512]; + UINT8 m_irq_pause; + bitmap_ind16 *m_bitmap; + virtual void machine_start(); + virtual void video_start(); + DECLARE_PALETTE_INIT(vc4000); + UINT32 screen_update_vc4000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vc4000_video_line); + DECLARE_QUICKLOAD_LOAD_MEMBER(vc4000); + +protected: + required_device m_maincpu; + required_device m_screen; + optional_device m_cassette; + required_device m_cart; + required_device m_custom; + required_ioport m_keypad1_1; + required_ioport m_keypad1_2; + required_ioport m_keypad1_3; + required_ioport m_panel; + required_ioport m_keypad2_1; + required_ioport m_keypad2_2; + required_ioport m_keypad2_3; +#ifndef ANALOG_HACK + required_ioport m_io_joy1_x; + required_ioport m_io_joy1_y; + required_ioport m_io_joy2_x; + required_ioport m_io_joy2_y; +#else + required_ioport m_joys; + required_ioport m_config; +#endif + inline UINT8 vc4000_joystick_return_to_centre(UINT8 joy); + void vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line); + inline void vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale); + void vc4000_sprite_update(bitmap_ind16 &bitmap, UINT8 *collision, SPRITE *This); + inline void vc4000_draw_grid(UINT8 *collision); +}; + +#endif /* VC4000_H_ */ diff --git a/src/mame/includes/vcs80.h b/src/mame/includes/vcs80.h new file mode 100644 index 00000000000..7030bbc008d --- /dev/null +++ b/src/mame/includes/vcs80.h @@ -0,0 +1,52 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +#pragma once + +#ifndef __VCS80__ +#define __VCS80__ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80pio.h" +#include "machine/ram.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "z80" +#define Z80PIO_TAG "z80pio" + +class vcs80_state : public driver_device +{ +public: + vcs80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_pio(*this, Z80PIO_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2") + { } + + required_device m_maincpu; + required_device m_pio; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + + virtual void machine_start(); + + DECLARE_READ8_MEMBER( pio_r ); + DECLARE_WRITE8_MEMBER( pio_w ); + DECLARE_READ8_MEMBER( pio_pa_r ); + DECLARE_WRITE8_MEMBER( pio_pb_w ); + + DECLARE_DIRECT_UPDATE_MEMBER(vcs80_direct_update_handler); + /* keyboard state */ + int m_keylatch; + int m_keyclk; + DECLARE_DRIVER_INIT(vcs80); + TIMER_DEVICE_CALLBACK_MEMBER(vcs80_keyboard_tick); +}; + +#endif diff --git a/src/mame/includes/vector06.h b/src/mame/includes/vector06.h new file mode 100644 index 00000000000..959842aa3b6 --- /dev/null +++ b/src/mame/includes/vector06.h @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/***************************************************************************** + * + * includes/vector06.h + * + ****************************************************************************/ + +#ifndef VECTOR06_H_ +#define VECTOR06_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/i8085/i8085.h" +#include "sound/wave.h" +#include "machine/i8255.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "imagedev/cassette.h" +#include "imagedev/flopdrv.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +class vector06_state : public driver_device +{ +public: + vector06_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_fdc(*this, "wd1793"), + m_floppy0(*this, "wd1793:0"), + m_floppy1(*this, "wd1793:1"), + m_ppi(*this, "ppi8255"), + m_ppi2(*this, "ppi8255_2"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_region_maincpu(*this, "maincpu"), + m_line(*this, "LINE"), + m_reset(*this, "RESET") + { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + DECLARE_READ8_MEMBER(vector06_8255_portb_r); + DECLARE_READ8_MEMBER(vector06_8255_portc_r); + DECLARE_WRITE8_MEMBER(vector06_8255_porta_w); + DECLARE_WRITE8_MEMBER(vector06_8255_portb_w); + DECLARE_WRITE8_MEMBER(vector06_color_set); + DECLARE_READ8_MEMBER(vector06_romdisk_portb_r); + DECLARE_WRITE8_MEMBER(vector06_romdisk_porta_w); + DECLARE_WRITE8_MEMBER(vector06_romdisk_portc_w); + DECLARE_READ8_MEMBER(vector06_8255_1_r); + DECLARE_WRITE8_MEMBER(vector06_8255_1_w); + DECLARE_READ8_MEMBER(vector06_8255_2_r); + DECLARE_WRITE8_MEMBER(vector06_8255_2_w); + DECLARE_WRITE8_MEMBER(vector06_disc_w); + void vector06_set_video_mode(int width); + virtual void machine_start(); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(vector06); + UINT32 screen_update_vector06(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vector06_interrupt); + TIMER_CALLBACK_MEMBER(reset_check_callback); + IRQ_CALLBACK_MEMBER(vector06_irq_callback); + +private: + required_device m_maincpu; + required_device m_cassette; + required_device m_cart; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_ppi; + required_device m_ppi2; + required_device m_ram; + required_device m_palette; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_memory_region m_region_maincpu; + required_ioport_array<9> m_line; + required_ioport m_reset; + + UINT8 m_keyboard_mask; + UINT8 m_color_index; + UINT8 m_video_mode; + UINT8 m_romdisk_msb; + UINT8 m_romdisk_lsb; + UINT8 m_vblank_state; + +}; + +#endif /* VECTOR06_H_ */ diff --git a/src/mame/includes/vic10.h b/src/mame/includes/vic10.h new file mode 100644 index 00000000000..5068bca4454 --- /dev/null +++ b/src/mame/includes/vic10.h @@ -0,0 +1,118 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __VIC10__ +#define __VIC10__ + +#include "emu.h" +#include "bus/pet/cass.h" +#include "bus/vic10/exp.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m6510.h" +#include "machine/mos6526.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/mos6581.h" +#include "video/mos6566.h" + +#define M6510_TAG "u3" +#define MOS6566_TAG "u2" +#define MOS6581_TAG "u6" +#define MOS6526_TAG "u9" +#define SCREEN_TAG "screen" +#define TIMER_C1531_TAG "c1531" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" + +class vic10_state : public driver_device +{ +public: + vic10_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M6510_TAG), + m_vic(*this, MOS6566_TAG), + m_sid(*this, MOS6581_TAG), + m_cia(*this, MOS6526_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, VIC10_EXPANSION_SLOT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_color_ram(*this, "color_ram"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_restore(*this, "RESTORE"), + m_lock(*this, "LOCK"), + m_cia_irq(CLEAR_LINE), + m_vic_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE) + { } + + required_device m_maincpu; + required_device m_vic; + required_device m_sid; + required_device m_cia; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + required_device m_ram; + optional_device m_cassette; + optional_shared_ptr m_color_ram; + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + required_ioport m_row3; + required_ioport m_row4; + required_ioport m_row5; + required_ioport m_row6; + required_ioport m_row7; + required_ioport m_restore; + required_ioport m_lock; + + virtual void machine_start(); + virtual void machine_reset(); + + void check_interrupts(); + UINT8 paddle_read(address_space &space, int which); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_colorram_r ); + DECLARE_READ8_MEMBER( vic_lightpen_x_cb ); + DECLARE_READ8_MEMBER( vic_lightpen_y_cb ); + DECLARE_READ8_MEMBER( vic_lightpen_button_cb ); + DECLARE_READ8_MEMBER( vic_rdy_cb ); + + DECLARE_READ8_MEMBER( sid_potx_r ); + DECLARE_READ8_MEMBER( sid_poty_r ); + + DECLARE_WRITE_LINE_MEMBER( cia_irq_w ); + DECLARE_READ8_MEMBER( cia_pa_r ); + DECLARE_READ8_MEMBER( cia_pb_r ); + DECLARE_WRITE8_MEMBER( cia_pb_w ); + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); + DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); + + // interrupt state + int m_cia_irq; + int m_vic_irq; + int m_exp_irq; +}; + + + +#endif diff --git a/src/mame/includes/vic20.h b/src/mame/includes/vic20.h new file mode 100644 index 00000000000..1c900d91acd --- /dev/null +++ b/src/mame/includes/vic20.h @@ -0,0 +1,162 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __VIC20__ +#define __VIC20__ + +#include "emu.h" +#include "bus/cbmiec/cbmiec.h" +#include "bus/pet/cass.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "bus/vic20/exp.h" +#include "bus/vic20/user.h" +#include "cpu/m6502/m6510.h" +#include "machine/6522via.h" +#include "machine/cbm_snqk.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/mos6560.h" + +#define M6502_TAG "ue10" +#define M6522_1_TAG "uab3" +#define M6522_2_TAG "uab1" +#define M6560_TAG "ub7" +#define M6561_TAG "ub7" +#define IEC_TAG "iec" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define PET_USER_PORT_TAG "user" + +class vic20_state : public driver_device +{ +public: + vic20_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, M6502_TAG), + m_via1(*this, M6522_1_TAG), + m_via2(*this, M6522_2_TAG), + m_vic(*this, M6560_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy(*this, CONTROL1_TAG), + m_exp(*this, VIC20_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_ram(*this, RAM_TAG), + m_basic(*this, "basic"), + m_kernal(*this, "kernal"), + m_charom(*this, "charom"), + m_color_ram(*this, "color_ram"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_restore(*this, "RESTORE"), + m_lock(*this, "LOCK") + { } + + required_device m_maincpu; + required_device m_via1; + required_device m_via2; + required_device m_vic; + required_device m_iec; + required_device m_joy; + required_device m_exp; + required_device m_user; + required_device m_cassette; + required_device m_ram; + required_region_ptr m_basic; + required_region_ptr m_kernal; + required_region_ptr m_charom; + required_shared_ptr m_color_ram; + required_ioport m_row0; + required_ioport m_row1; + required_ioport m_row2; + required_ioport m_row3; + required_ioport m_row4; + required_ioport m_row5; + required_ioport m_row6; + required_ioport m_row7; + required_ioport m_restore; + required_ioport m_lock; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_lightx_cb ); + DECLARE_READ8_MEMBER( vic_lighty_cb ); + DECLARE_READ8_MEMBER( vic_lightbut_cb ); + + DECLARE_WRITE_LINE_MEMBER( write_light_pen ); + DECLARE_WRITE_LINE_MEMBER( write_user_joy0 ); + DECLARE_WRITE_LINE_MEMBER( write_user_joy1 ); + DECLARE_WRITE_LINE_MEMBER( write_user_joy2 ); + DECLARE_WRITE_LINE_MEMBER( write_user_light_pen ); + DECLARE_WRITE_LINE_MEMBER( write_user_cassette_switch ); + + DECLARE_READ8_MEMBER( via1_pa_r ); + DECLARE_WRITE8_MEMBER( via1_pa_w ); + DECLARE_WRITE8_MEMBER( via1_pb_w ); + + DECLARE_READ8_MEMBER( via2_pa_r ); + DECLARE_READ8_MEMBER( via2_pb_r ); + DECLARE_WRITE8_MEMBER( via2_pb_w ); + DECLARE_WRITE_LINE_MEMBER( via2_ca2_w ); + DECLARE_WRITE_LINE_MEMBER( via2_cb2_w ); + + DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_vc20 ); + // keyboard state + int m_key_col; + int m_light_pen; + int m_user_joy0; + int m_user_joy1; + int m_user_joy2; + int m_user_light_pen; + int m_user_cassette_switch; + + enum + { + BLK0 = 0, + BLK1, + BLK2, + BLK3, + BLK4, + BLK5, + BLK6, + BLK7 + }; + + + enum + { + RAM0 = 0, + RAM1, + RAM2, + RAM3, + RAM4, + RAM5, + RAM6, + RAM7 + }; + + + enum + { + IO0 = 4, + COLOR = 5, + IO2 = 6, + IO3 = 7 + }; +}; + +#endif diff --git a/src/mame/includes/victor9k.h b/src/mame/includes/victor9k.h new file mode 100644 index 00000000000..89c5c0b1c4b --- /dev/null +++ b/src/mame/includes/victor9k.h @@ -0,0 +1,156 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Victor 9000 / ACT Sirius 1 emulation + +**********************************************************************/ + +#pragma once + +#ifndef __VICTOR9K__ +#define __VICTOR9K__ + +#include "bus/rs232/rs232.h" +#include "bus/centronics/ctronics.h" +#include "cpu/i86/i86.h" +#include "formats/victor9k_dsk.h" +#include "imagedev/floppy.h" +#include "machine/ram.h" +#include "bus/centronics/ctronics.h" +#include "machine/6522via.h" +#include "bus/ieee488/ieee488.h" +#include "machine/mc6852.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/z80dart.h" +#include "machine/victor9kb.h" +#include "machine/victor9k_fdc.h" +#include "sound/hc55516.h" +#include "video/mc6845.h" + +#define I8088_TAG "8l" +#define I8253_TAG "13h" +#define I8259A_TAG "7l" +#define UPD7201_TAG "16e" +#define HD46505S_TAG "11a" +#define MC6852_TAG "11b" +#define HC55516_TAG "15c" +#define M6522_1_TAG "m6522_1" +#define M6522_2_TAG "m6522_2" +#define M6522_3_TAG "14l" +#define DAC0808_0_TAG "5b" +#define DAC0808_1_TAG "5c" +#define CENTRONICS_TAG "centronics" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" +#define SCREEN_TAG "screen" +#define KB_TAG "kb" +#define FDC_TAG "fdc" + +class victor9k_state : public driver_device +{ +public: + victor9k_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, I8088_TAG), + m_ieee488(*this, IEEE488_TAG), + m_pic(*this, I8259A_TAG), + m_upd7201(*this, UPD7201_TAG), + m_ssda(*this, MC6852_TAG), + m_via1(*this, M6522_1_TAG), + m_via2(*this, M6522_2_TAG), + m_via3(*this, M6522_3_TAG), + m_cvsd(*this, HC55516_TAG), + m_crtc(*this, HD46505S_TAG), + m_ram(*this, RAM_TAG), + m_kb(*this, KB_TAG), + m_fdc(*this, FDC_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_rs232a(*this, RS232_A_TAG), + m_rs232b(*this, RS232_B_TAG), + m_palette(*this, "palette"), + m_rom(*this, I8088_TAG), + m_video_ram(*this, "video_ram"), + m_brt(0), + m_cont(0), + m_via1_irq(CLEAR_LINE), + m_via2_irq(CLEAR_LINE), + m_via3_irq(CLEAR_LINE), + m_fdc_irq(CLEAR_LINE), + m_ssda_irq(CLEAR_LINE), + m_kbrdy(1), + m_kbackctl(0) + { } + + required_device m_maincpu; + required_device m_ieee488; + required_device m_pic; + required_device m_upd7201; + required_device m_ssda; + required_device m_via1; + required_device m_via2; + required_device m_via3; + required_device m_cvsd; + required_device m_crtc; + required_device m_ram; + required_device m_kb; + required_device m_fdc; + required_device m_centronics; + required_device m_rs232a; + required_device m_rs232b; + required_device m_palette; + required_memory_region m_rom; + required_shared_ptr m_video_ram; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( via1_pa_w ); + DECLARE_WRITE_LINE_MEMBER( write_nfrd ); + DECLARE_WRITE_LINE_MEMBER( write_ndac ); + DECLARE_WRITE8_MEMBER( via1_pb_w ); + DECLARE_WRITE_LINE_MEMBER( via1_irq_w ); + DECLARE_WRITE_LINE_MEMBER( codec_vol_w ); + + DECLARE_WRITE8_MEMBER( via2_pa_w ); + DECLARE_WRITE8_MEMBER( via2_pb_w ); + DECLARE_WRITE_LINE_MEMBER( write_ria ); + DECLARE_WRITE_LINE_MEMBER( write_rib ); + DECLARE_WRITE_LINE_MEMBER( via2_irq_w ); + + DECLARE_WRITE8_MEMBER( via3_pb_w ); + DECLARE_WRITE_LINE_MEMBER( via3_irq_w ); + + DECLARE_WRITE_LINE_MEMBER( fdc_irq_w ); + + DECLARE_WRITE_LINE_MEMBER( ssda_irq_w ); + + DECLARE_WRITE_LINE_MEMBER( kbrdy_w ); + DECLARE_WRITE_LINE_MEMBER( kbdata_w ); + DECLARE_WRITE_LINE_MEMBER( vert_w ); + + MC6845_UPDATE_ROW( crtc_update_row ); + + DECLARE_WRITE_LINE_MEMBER( mux_serial_b_w ); + DECLARE_WRITE_LINE_MEMBER( mux_serial_a_w ); + + // video state + int m_brt; + int m_cont; + + // interrupts + int m_via1_irq; + int m_via2_irq; + int m_via3_irq; + int m_fdc_irq; + int m_ssda_irq; + + // keyboard + int m_kbrdy; + int m_kbackctl; + + void update_kback(); +}; + +#endif diff --git a/src/mame/includes/vidbrain.h b/src/mame/includes/vidbrain.h new file mode 100644 index 00000000000..3bddb8542d7 --- /dev/null +++ b/src/mame/includes/vidbrain.h @@ -0,0 +1,126 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __VIDBRAIN__ +#define __VIDBRAIN__ + +#include "emu.h" +#include "bus/vidbrain/exp.h" +#include "cpu/f8/f8.h" +#include "machine/f3853.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/discrete.h" +#include "video/uv201.h" + +#define F3850_TAG "cd34" +#define F3853_TAG "cd5" +#define F3870_TAG "f3870" +#define UV201_TAG "uv201" +#define SCREEN_TAG "screen" +#define DISCRETE_TAG "discrete" +#define DAC_TAG "dac" + +class vidbrain_state : public driver_device +{ +public: + vidbrain_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, F3850_TAG), + m_smi(*this, F3853_TAG), + m_uv(*this, UV201_TAG), + m_discrete(*this, DISCRETE_TAG), + m_dac(*this, DAC_TAG), + m_exp(*this, VIDEOBRAIN_EXPANSION_SLOT_TAG), + m_io00(*this, "IO00"), + m_io01(*this, "IO01"), + m_io02(*this, "IO02"), + m_io03(*this, "IO03"), + m_io04(*this, "IO04"), + m_io05(*this, "IO05"), + m_io06(*this, "IO06"), + m_io07(*this, "IO07"), + m_uv201_31(*this, "UV201-31"), + m_joy_r(*this, "JOY-R"), + m_joy1_x(*this, "JOY1-X"), + m_joy1_y(*this, "JOY1-Y"), + m_joy2_x(*this, "JOY2-X"), + m_joy2_y(*this, "JOY2-Y"), + m_joy3_x(*this, "JOY3-X"), + m_joy3_y(*this, "JOY3-Y"), + m_joy4_x(*this, "JOY4-X"), + m_joy4_y(*this, "JOY4-Y") + { } + + required_device m_maincpu; + required_device m_smi; + required_device m_uv; + required_device m_discrete; + required_device m_dac; + required_device m_exp; + required_ioport m_io00; + required_ioport m_io01; + required_ioport m_io02; + required_ioport m_io03; + required_ioport m_io04; + required_ioport m_io05; + required_ioport m_io06; + required_ioport m_io07; + required_ioport m_uv201_31; + required_ioport m_joy_r; + required_ioport m_joy1_x; + required_ioport m_joy1_y; + required_ioport m_joy2_x; + required_ioport m_joy2_y; + required_ioport m_joy3_x; + required_ioport m_joy3_y; + required_ioport m_joy4_x; + required_ioport m_joy4_y; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void machine_start(); + virtual void machine_reset(); + + enum + { + TIMER_JOYSTICK + }; + + DECLARE_WRITE8_MEMBER( keyboard_w ); + DECLARE_READ8_MEMBER( keyboard_r ); + DECLARE_WRITE8_MEMBER( sound_w ); + DECLARE_WRITE8_MEMBER( f3853_w ); + DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); + DECLARE_WRITE_LINE_MEMBER( ext_int_w ); + DECLARE_WRITE_LINE_MEMBER( hblank_w ); + DECLARE_READ8_MEMBER(memory_read_byte); + + F3853_INTERRUPT_REQ_CB(f3853_int_req_w); + + IRQ_CALLBACK_MEMBER(vidbrain_int_ack); + + void interrupt_check(); + + // F3853 SMI state + UINT16 m_vector; + int m_int_enable; + int m_ext_int_latch; + int m_timer_int_latch; + + // keyboard state + UINT8 m_keylatch; + int m_joy_enable; + + // sound state + int m_sound_clk; + + // timers + emu_timer *m_timer_ne555; +}; + +//----------- defined in video/vidbrain.c ----------- + +MACHINE_CONFIG_EXTERN( vidbrain_video ); + +#endif diff --git a/src/mame/includes/vip.h b/src/mame/includes/vip.h new file mode 100644 index 00000000000..9d2baf33491 --- /dev/null +++ b/src/mame/includes/vip.h @@ -0,0 +1,129 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __VIP__ +#define __VIP__ + +#include "emu.h" +#include "bus/vip/byteio.h" +#include "bus/vip/exp.h" +#include "cpu/cosmac/cosmac.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "machine/ram.h" +#include "sound/discrete.h" +#include "video/cdp1861.h" + +#define SCREEN_TAG "screen" +#define CDP1802_TAG "u1" +#define CDP1861_TAG "u2" +#define DISCRETE_TAG "discrete" + + +class vip_state : public driver_device +{ +public: + vip_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, CDP1802_TAG), + m_vdc(*this, CDP1861_TAG), + m_cassette(*this, "cassette"), + m_beeper(*this, DISCRETE_TAG), + m_byteio(*this, VIP_BYTEIO_PORT_TAG), + m_exp(*this, VIP_EXPANSION_SLOT_TAG), + m_ram(*this, RAM_TAG), + m_rom(*this, CDP1802_TAG), + m_chip8(*this, "chip8"), + m_chip8x(*this, "chip8x"), + m_run(*this, "RUN"), + m_keypad(*this, "KEYPAD"), + m_io_beeper(*this, "BEEPER"), + m_8000(1), + m_vdc_int(CLEAR_LINE), + m_vdc_dma_out(CLEAR_LINE), + m_vdc_ef1(CLEAR_LINE), + m_exp_int(CLEAR_LINE), + m_exp_dma_out(CLEAR_LINE), + m_exp_dma_in(CLEAR_LINE), + m_byteio_ef3(CLEAR_LINE), + m_byteio_ef4(CLEAR_LINE), + m_exp_ef1(CLEAR_LINE), + m_exp_ef3(CLEAR_LINE), + m_exp_ef4(CLEAR_LINE) + { } + + required_device m_maincpu; + required_device m_vdc; + required_device m_cassette; + required_device m_beeper; + required_device m_byteio; + required_device m_exp; + required_device m_ram; + required_memory_region m_rom; + required_memory_region m_chip8; + required_memory_region m_chip8x; + required_ioport m_run; + required_ioport m_keypad; + required_ioport m_io_beeper; + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void update_interrupts(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + + DECLARE_READ_LINE_MEMBER( clear_r ); + DECLARE_READ_LINE_MEMBER( ef1_r ); + DECLARE_READ_LINE_MEMBER( ef2_r ); + DECLARE_READ_LINE_MEMBER( ef3_r ); + DECLARE_READ_LINE_MEMBER( ef4_r ); + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_READ8_MEMBER( dma_r ); + DECLARE_WRITE8_MEMBER( dma_w ); + DECLARE_WRITE8_MEMBER( sc_w ); + + DECLARE_WRITE_LINE_MEMBER( vdc_int_w ); + DECLARE_WRITE_LINE_MEMBER( vdc_dma_out_w ); + DECLARE_WRITE_LINE_MEMBER( vdc_ef1_w ); + + DECLARE_WRITE_LINE_MEMBER( byteio_inst_w ); + + DECLARE_WRITE_LINE_MEMBER( exp_int_w ); + DECLARE_WRITE_LINE_MEMBER( exp_dma_out_w ); + DECLARE_WRITE_LINE_MEMBER( exp_dma_in_w ); + + DECLARE_INPUT_CHANGED_MEMBER( reset_w ); + DECLARE_INPUT_CHANGED_MEMBER( beeper_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( vip ); + // memory state + int m_8000; + + // interrupt state + int m_vdc_int; + int m_vdc_dma_out; + int m_vdc_ef1; + int m_exp_int; + int m_exp_dma_out; + int m_exp_dma_in; + int m_byteio_ef3; + int m_byteio_ef4; + int m_exp_ef1; + int m_exp_ef3; + int m_exp_ef4; + + // keyboard state + int m_keylatch; + + // expansion state + UINT8 m_byteio_data; +}; + +#endif diff --git a/src/mame/includes/vixen.h b/src/mame/includes/vixen.h new file mode 100644 index 00000000000..73dc628b12d --- /dev/null +++ b/src/mame/includes/vixen.h @@ -0,0 +1,133 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __VIXEN__ +#define __VIXEN__ + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "machine/i8155.h" +#include "machine/i8251.h" +#include "bus/ieee488/ieee488.h" +#include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "sound/discrete.h" + +#define Z8400A_TAG "5f" +#define FDC1797_TAG "5n" +#define P8155H_TAG "2n" +#define P8155H_IO_TAG "c7" +#define P8251A_TAG "c3" +#define DISCRETE_TAG "discrete" +#define SCREEN_TAG "screen" +#define RS232_TAG "rs232" + +class vixen_state : public driver_device +{ +public: + vixen_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z8400A_TAG), + m_fdc(*this, FDC1797_TAG), + m_io_i8155(*this, P8155H_IO_TAG), + m_usart(*this, P8251A_TAG), + m_discrete(*this, DISCRETE_TAG), + m_ieee488(*this, IEEE488_TAG), + m_palette(*this, "palette"), + m_ram(*this, RAM_TAG), + m_floppy0(*this, FDC1797_TAG":0"), + m_floppy1(*this, FDC1797_TAG":1"), + m_rs232(*this, RS232_TAG), + m_rom(*this, Z8400A_TAG), + m_sync_rom(*this, "video"), + m_char_rom(*this, "chargen"), + m_video_ram(*this, "video_ram"), + m_key(*this, "KEY"), + m_cmd_d1(0), + m_fdint(0), + m_vsync(0), + m_srq(1), + m_atn(1), + m_rxrdy(0), + m_txrdy(0) + { } + + required_device m_maincpu; + required_device m_fdc; + required_device m_io_i8155; + required_device m_usart; + required_device m_discrete; + required_device m_ieee488; + required_device m_palette; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_rs232; + required_region_ptr m_rom; + required_region_ptr m_sync_rom; + required_region_ptr m_char_rom; + required_shared_ptr m_video_ram; + required_ioport_array<8> m_key; + + virtual void machine_start(); + virtual void machine_reset(); + + virtual void video_start(); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void update_interrupt(); + + DECLARE_WRITE8_MEMBER( ctl_w ); + DECLARE_READ8_MEMBER( status_r ); + DECLARE_WRITE8_MEMBER( cmd_w ); + DECLARE_READ8_MEMBER( ieee488_r ); + DECLARE_READ8_MEMBER( port3_r ); + DECLARE_READ8_MEMBER( i8155_pa_r ); + DECLARE_WRITE8_MEMBER( i8155_pb_w ); + DECLARE_WRITE8_MEMBER( i8155_pc_w ); + DECLARE_WRITE8_MEMBER( io_i8155_pb_w ); + DECLARE_WRITE8_MEMBER( io_i8155_pc_w ); + DECLARE_WRITE_LINE_MEMBER( io_i8155_to_w ); + DECLARE_WRITE_LINE_MEMBER( srq_w ); + DECLARE_WRITE_LINE_MEMBER( atn_w ); + DECLARE_WRITE_LINE_MEMBER( rxrdy_w ); + DECLARE_WRITE_LINE_MEMBER( txrdy_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); + DIRECT_UPDATE_MEMBER(vixen_direct_update_handler); + + // memory state + int m_reset; + + // keyboard state + UINT8 m_col; + + // interrupt state + int m_cmd_d0; + int m_cmd_d1; + + bool m_fdint; + int m_vsync; + + int m_srq; + int m_atn; + int m_enb_srq_int; + int m_enb_atn_int; + + int m_rxrdy; + int m_txrdy; + int m_int_clk; + int m_enb_xmt_int; + int m_enb_rcv_int; + int m_enb_ring_int; + + // video state + int m_alt; + int m_256; + + DECLARE_DRIVER_INIT(vixen); + TIMER_DEVICE_CALLBACK_MEMBER(vsync_tick); + IRQ_CALLBACK_MEMBER(vixen_int_ack); +}; + +#endif diff --git a/src/mame/includes/vtech2.h b/src/mame/includes/vtech2.h new file mode 100644 index 00000000000..9a7efd680b0 --- /dev/null +++ b/src/mame/includes/vtech2.h @@ -0,0 +1,96 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/***************************************************************************** + * + * includes/vtech2.h + * + ****************************************************************************/ + +#ifndef VTECH2_H_ +#define VTECH2_H_ +#include "sound/speaker.h" +#include "imagedev/cassette.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#define TRKSIZE_FM 3172 /* size of a standard FM mode track */ + +class vtech2_state : public driver_device +{ +public: + vtech2_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") { } + + UINT8 *m_videoram; + int m_laser_latch; + char m_laser_frame_message[64+1]; + int m_laser_frame_time; + UINT8 *m_mem; + int m_laser_bank_mask; + int m_laser_bank[4]; + int m_laser_video_bank; + UINT8 m_laser_track_x2[2]; + UINT8 m_laser_fdc_status; + UINT8 m_laser_fdc_data[TRKSIZE_FM]; + int m_laser_data; + int m_laser_fdc_edge; + int m_laser_fdc_bits; + int m_laser_drive; + int m_laser_fdc_start; + int m_laser_fdc_write; + int m_laser_fdc_offs; + int m_laser_fdc_latch; + int m_level_old; + int m_cassette_bit; + int m_row_a; + int m_row_b; + int m_row_c; + int m_row_d; + int m_laser_bg_mode; + int m_laser_two_color; + DECLARE_WRITE8_MEMBER(laser_bank_select_w); + DECLARE_WRITE8_MEMBER(laser_fdc_w); + DECLARE_WRITE8_MEMBER(laser_bg_mode_w); + DECLARE_WRITE8_MEMBER(laser_two_color_w); + DECLARE_READ8_MEMBER(laser_fdc_r); + DECLARE_DRIVER_INIT(laser); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(vtech2); + DECLARE_MACHINE_RESET(laser500); + DECLARE_MACHINE_RESET(laser700); + UINT32 screen_update_laser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vtech2_interrupt); + + int mra_bank(int bank, int offs); + void mwa_bank(int bank, int offs, int data); + memory_region *m_cart_rom; + + DECLARE_WRITE8_MEMBER(mwa_bank1); + DECLARE_WRITE8_MEMBER(mwa_bank2); + DECLARE_WRITE8_MEMBER(mwa_bank3); + DECLARE_WRITE8_MEMBER(mwa_bank4); + DECLARE_READ8_MEMBER(mra_bank1); + DECLARE_READ8_MEMBER(mra_bank2); + DECLARE_READ8_MEMBER(mra_bank3); + DECLARE_READ8_MEMBER(mra_bank4); + required_device m_maincpu; + required_device m_speaker; + required_device m_cassette; + required_device m_cart; + void laser_machine_init(int bank_mask, int video_mask); + void laser_get_track(); + void laser_put_track(); + device_t *laser_file(); + required_device m_gfxdecode; + required_device m_palette; +}; + + +#endif /* VTECH2_H_ */ diff --git a/src/mame/includes/wangpc.h b/src/mame/includes/wangpc.h new file mode 100644 index 00000000000..9a796d9524d --- /dev/null +++ b/src/mame/includes/wangpc.h @@ -0,0 +1,205 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __WANGPC__ +#define __WANGPC__ + +#include "emu.h" +#include "bus/wangpc/wangpc.h" +#include "cpu/i86/i86.h" +#include "formats/pc_dsk.h" +#include "machine/am9517a.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8255.h" +#include "machine/im6402.h" +#include "machine/mc2661.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" +#include "machine/ram.h" +#include "machine/upd765.h" +#include "machine/wangpckb.h" + +#define I8086_TAG "i8086" +#define AM9517A_TAG "am9517a" +#define I8259A_TAG "i8259" +#define I8255A_TAG "i8255a" +#define I8253_TAG "i8253" +#define IM6402_TAG "im6402" +#define SCN2661_TAG "scn2661" +#define UPD765_TAG "upd765" +#define CENTRONICS_TAG "centronics" +#define RS232_TAG "rs232" +#define WANGPC_KEYBOARD_TAG "wangpckb" + +class wangpc_state : public driver_device +{ +public: + // constructor + wangpc_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, I8086_TAG), + m_dmac(*this, AM9517A_TAG), + m_pic(*this, I8259A_TAG), + m_ppi(*this, I8255A_TAG), + m_pit(*this, I8253_TAG), + m_uart(*this, IM6402_TAG), + m_epci(*this, SCN2661_TAG), + m_fdc(*this, UPD765_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, UPD765_TAG ":0:525dd"), + m_floppy1(*this, UPD765_TAG ":1:525dd"), + m_centronics(*this, CENTRONICS_TAG), + m_cent_data_in(*this, "cent_data_in"), + m_cent_data_out(*this, "cent_data_out"), + m_bus(*this, WANGPC_BUS_TAG), + m_sw(*this, "SW"), + m_timer2_irq(1), + m_centronics_ack(1), + m_dav(1), + m_dma_eop(1), + m_uart_dr(0), + m_uart_tbre(0), + m_fpu_irq(0), + m_bus_irq2(0), + m_enable_eop(0), + m_disable_dreq2(0), + m_fdc_drq(0), + m_fdc_dd0(0), + m_fdc_dd1(0), + m_fdc_tc(0), + m_ds1(false), + m_ds2(false) + { + } + + required_device m_maincpu; + required_device m_dmac; + required_device m_pic; + required_device m_ppi; + required_device m_pit; + required_device m_uart; + required_device m_epci; + required_device m_fdc; + required_device m_ram; + required_device m_floppy0; + required_device m_floppy1; + required_device m_centronics; + required_device m_cent_data_in; + required_device m_cent_data_out; + required_device m_bus; + required_ioport m_sw; + + virtual void machine_start(); + virtual void machine_reset(); + + void select_drive(); + void check_level1_interrupts(); + void check_level2_interrupts(); + void update_fdc_drq(); + void update_fdc_tc(); + + DECLARE_WRITE8_MEMBER( fdc_ctrl_w ); + DECLARE_READ8_MEMBER( deselect_drive1_r ); + DECLARE_WRITE8_MEMBER( deselect_drive1_w ); + DECLARE_READ8_MEMBER( select_drive1_r ); + DECLARE_WRITE8_MEMBER( select_drive1_w ); + DECLARE_READ8_MEMBER( deselect_drive2_r ); + DECLARE_WRITE8_MEMBER( deselect_drive2_w ); + DECLARE_READ8_MEMBER( select_drive2_r ); + DECLARE_WRITE8_MEMBER( select_drive2_w ); + DECLARE_READ8_MEMBER( motor1_off_r ); + DECLARE_WRITE8_MEMBER( motor1_off_w ); + DECLARE_READ8_MEMBER( motor1_on_r ); + DECLARE_WRITE8_MEMBER( motor1_on_w ); + DECLARE_READ8_MEMBER( motor2_off_r ); + DECLARE_WRITE8_MEMBER( motor2_off_w ); + DECLARE_READ8_MEMBER( motor2_on_r ); + DECLARE_WRITE8_MEMBER( motor2_on_w ); + DECLARE_READ8_MEMBER( fdc_reset_r ); + DECLARE_WRITE8_MEMBER( fdc_reset_w ); + DECLARE_READ8_MEMBER( fdc_tc_r ); + DECLARE_WRITE8_MEMBER( fdc_tc_w ); + DECLARE_WRITE8_MEMBER( dma_page_w ); + DECLARE_READ8_MEMBER( status_r ); + DECLARE_WRITE8_MEMBER( timer0_irq_clr_w ); + DECLARE_READ8_MEMBER( timer2_irq_clr_r ); + DECLARE_WRITE8_MEMBER( nmi_mask_w ); + DECLARE_READ8_MEMBER( led_on_r ); + DECLARE_WRITE8_MEMBER( fpu_mask_w ); + DECLARE_READ8_MEMBER( dma_eop_clr_r ); + DECLARE_WRITE8_MEMBER( uart_tbre_clr_w ); + DECLARE_READ8_MEMBER( uart_r ); + DECLARE_WRITE8_MEMBER( uart_w ); + DECLARE_READ8_MEMBER( centronics_r ); + DECLARE_WRITE8_MEMBER( centronics_w ); + DECLARE_READ8_MEMBER( busy_clr_r ); + DECLARE_WRITE8_MEMBER( acknlg_clr_w ); + DECLARE_READ8_MEMBER( led_off_r ); + DECLARE_WRITE8_MEMBER( parity_nmi_clr_w ); + DECLARE_READ8_MEMBER( option_id_r ); + + DECLARE_WRITE_LINE_MEMBER( hrq_w ); + DECLARE_WRITE_LINE_MEMBER( eop_w ); + DECLARE_READ8_MEMBER( memr_r ); + DECLARE_WRITE8_MEMBER( memw_w ); + DECLARE_READ8_MEMBER( ior2_r ); + DECLARE_WRITE8_MEMBER( iow2_w ); + DECLARE_WRITE_LINE_MEMBER( dack0_w ); + DECLARE_WRITE_LINE_MEMBER( dack1_w ); + DECLARE_WRITE_LINE_MEMBER( dack2_w ); + DECLARE_WRITE_LINE_MEMBER( dack3_w ); + DECLARE_READ8_MEMBER( ppi_pa_r ); + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_READ8_MEMBER( ppi_pc_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + DECLARE_WRITE_LINE_MEMBER( pit0_w ); + DECLARE_WRITE_LINE_MEMBER( pit2_w ); + DECLARE_WRITE_LINE_MEMBER( uart_dr_w ); + DECLARE_WRITE_LINE_MEMBER( uart_tbre_w ); + DECLARE_WRITE_LINE_MEMBER( epci_irq_w ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_ack ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_fault ); + DECLARE_WRITE_LINE_MEMBER( write_centronics_perror ); + DECLARE_WRITE_LINE_MEMBER( bus_irq2_w ); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + DECLARE_WRITE_LINE_MEMBER( fdc_irq ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq ); + + int on_disk0_load(floppy_image_device *image); + void on_disk0_unload(floppy_image_device *image); + int on_disk1_load(floppy_image_device *image); + void on_disk1_unload(floppy_image_device *image); + + UINT8 m_dma_page[4]; + int m_dack; + + int m_timer2_irq; + int m_centronics_ack; + int m_centronics_busy; + int m_centronics_fault; + int m_centronics_perror; + int m_dav; + int m_dma_eop; + int m_uart_dr; + int m_uart_tbre; + int m_fpu_irq; + int m_bus_irq2; + + int m_enable_eop; + int m_disable_dreq2; + int m_fdc_drq; + int m_fdc_dd0; + int m_fdc_dd1; + int m_fdc_tc; + int m_ds1; + int m_ds2; + + int m_led[6]; +}; + + +#endif diff --git a/src/mame/includes/wswan.h b/src/mame/includes/wswan.h new file mode 100644 index 00000000000..42f8b2b0fa8 --- /dev/null +++ b/src/mame/includes/wswan.h @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/***************************************************************************** + * + * includes/wswan.h + * + ****************************************************************************/ + +#ifndef WSWAN_H_ +#define WSWAN_H_ + +#define WSWAN_TYPE_MONO 0 +#define WSWAN_TYPE_COLOR 1 + +#define INTERNAL_EEPROM_SIZE 1024 + +#include "emu.h" +#include "cpu/v30mz/v30mz.h" +#include "machine/nvram.h" +#include "audio/wswan_snd.h" +#include "video/wswan_video.h" +#include "bus/wswan/slot.h" +#include "bus/wswan/rom.h" + + +struct SoundDMA +{ + UINT32 source; /* Source address */ + UINT16 size; /* Size */ + UINT8 enable; /* Enabled */ +}; + + +class wswan_state : public driver_device +{ +public: + wswan_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_vdp(*this, "vdp"), + m_sound(*this, "custom"), + m_cart(*this, "cartslot"), + m_cursx(*this, "CURSX"), + m_cursy(*this, "CURSY"), + m_buttons(*this, "BUTTONS") + { } + + required_device m_maincpu; + required_device m_vdp; + required_device m_sound; + required_device m_cart; + DECLARE_READ8_MEMBER(bios_r); + DECLARE_READ8_MEMBER(port_r); + DECLARE_WRITE8_MEMBER(port_w); + + UINT8 m_ws_portram[256]; + UINT8 m_internal_eeprom[INTERNAL_EEPROM_SIZE]; + UINT8 m_system_type; + SoundDMA m_sound_dma; + UINT8 *m_ws_bios_bank; + UINT8 m_bios_disabled; + UINT8 m_rotate; + + void set_irq_line(int irq); + void dma_sound_cb(); + void common_start(); + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_PALETTE_INIT(wswan); + DECLARE_MACHINE_START(wscolor); + DECLARE_PALETTE_INIT(wscolor); + +protected: + /* Interrupt flags */ + static const UINT8 WSWAN_IFLAG_STX = 0x01; + static const UINT8 WSWAN_IFLAG_KEY = 0x02; + static const UINT8 WSWAN_IFLAG_RTC = 0x04; + static const UINT8 WSWAN_IFLAG_SRX = 0x08; + static const UINT8 WSWAN_IFLAG_LCMP = 0x10; + static const UINT8 WSWAN_IFLAG_VBLTMR = 0x20; + static const UINT8 WSWAN_IFLAG_VBL = 0x40; + static const UINT8 WSWAN_IFLAG_HBLTMR = 0x80; + + /* Interrupts */ + static const UINT8 WSWAN_INT_STX = 0; + static const UINT8 WSWAN_INT_KEY = 1; + static const UINT8 WSWAN_INT_RTC = 2; + static const UINT8 WSWAN_INT_SRX = 3; + static const UINT8 WSWAN_INT_LCMP = 4; + static const UINT8 WSWAN_INT_VBLTMR = 5; + static const UINT8 WSWAN_INT_VBL = 6; + static const UINT8 WSWAN_INT_HBLTMR = 7; + + required_ioport m_cursx; + required_ioport m_cursy; + required_ioport m_buttons; + + void register_save(); + void handle_irqs(); + void clear_irq_line(int irq); +}; + + +#endif /* WSWAN_H_ */ diff --git a/src/mame/includes/x07.h b/src/mame/includes/x07.h new file mode 100644 index 00000000000..2a7cd1e40e6 --- /dev/null +++ b/src/mame/includes/x07.h @@ -0,0 +1,285 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/********************************************************************* + + includes/x07.h + +*********************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/beep.h" +#include "machine/nvram.h" +#include "machine/ram.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "imagedev/printer.h" +#include "formats/x07_cas.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "rendlay.h" + +//default value for user defined keys, taken for official documentation +static const char *const udk_ini[12] = { + "tim?TIME$\r", + "cldCLOAD\"", + "locLOCATE ", + "lstLIST ", + "runRUN\r", + "", + "dat?DATE$\r", + "csvCSAVE\"", + "prtPRINT ", + "slpSLEEP", + "cntCONT\r", + "" +}; + +static const UINT16 udk_offset[12] = +{ + 0x0000, 0x002a, 0x0054, 0x007e, 0x00a8, 0x00d2, + 0x0100, 0x012a, 0x0154, 0x017e, 0x01a8, 0x01d2 +}; + +static const UINT8 printer_charcode[256] = +{ + 0xff, 0x7f, 0xbf, 0x3f, 0xdf, 0x5f, 0x9f, 0x1f, + 0xef, 0x6f, 0xaf, 0x2f, 0xcf, 0x4f, 0x8f, 0x0f, + 0xf7, 0x77, 0xb7, 0x37, 0xd7, 0x57, 0x97, 0x17, + 0xe7, 0x67, 0xa7, 0x27, 0xc7, 0x47, 0x87, 0x07, + 0xfb, 0x7b, 0xbb, 0x3b, 0xdb, 0x5b, 0x9b, 0x1b, + 0xeb, 0x6b, 0xab, 0x2b, 0xcb, 0x4b, 0x8b, 0x0b, + 0xf3, 0x73, 0xb3, 0x33, 0xd3, 0x53, 0x93, 0x13, + 0xe3, 0x63, 0xa3, 0x23, 0xc3, 0x43, 0x83, 0x03, + 0xfd, 0x7d, 0xbd, 0x3d, 0xdd, 0x5d, 0x9d, 0x1d, + 0xed, 0x6d, 0xad, 0x2d, 0xcd, 0x4d, 0x8d, 0x0d, + 0xf5, 0x75, 0xb5, 0x35, 0xd5, 0x55, 0x95, 0x15, + 0xe5, 0x65, 0xa5, 0x25, 0xc5, 0x45, 0x85, 0x05, + 0xf9, 0x79, 0xb9, 0x39, 0xd9, 0x59, 0x99, 0x19, + 0xe9, 0x69, 0xa9, 0x29, 0xc9, 0x49, 0x89, 0x09, + 0xf1, 0x71, 0xb1, 0x31, 0xd1, 0x51, 0x91, 0x11, + 0xe1, 0x61, 0xa1, 0x21, 0xc1, 0x41, 0x81, 0x01, + 0xfe, 0x7e, 0xbe, 0x3e, 0xde, 0x5e, 0x9e, 0x1e, + 0xee, 0x6e, 0xae, 0x2e, 0xce, 0x4e, 0x8e, 0x0e, + 0xf6, 0x76, 0xb6, 0x36, 0xd6, 0x56, 0x96, 0x16, + 0xe6, 0x66, 0xa6, 0x26, 0xc6, 0x46, 0x86, 0x06, + 0xfa, 0x7a, 0xba, 0x3a, 0xda, 0x5a, 0x9a, 0x1a, + 0xea, 0x6a, 0xaa, 0x2a, 0xca, 0x4a, 0x8a, 0x0a, + 0xf2, 0x72, 0xb2, 0x32, 0xd2, 0x52, 0x92, 0x12, + 0xe2, 0x62, 0xa2, 0x22, 0xc2, 0x42, 0x82, 0x02, + 0xfc, 0x7c, 0xbc, 0x3c, 0xdc, 0x5c, 0x9c, 0x1c, + 0xec, 0x6c, 0xac, 0x2c, 0xcc, 0x4c, 0x8c, 0x0c, + 0xf4, 0x74, 0xb4, 0x34, 0xd4, 0x54, 0x94, 0x14, + 0xe4, 0x64, 0xa4, 0x24, 0xc4, 0x44, 0x84, 0x04, + 0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18, + 0xe8, 0x68, 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08, + 0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10, + 0xe0, 0x60, 0xa0, 0x20, 0xc0, 0x40, 0x80, 0x00 +}; + +static const UINT8 t6834_cmd_len[0x47] = +{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x04, 0x03, + 0x01, 0x02, 0x09, 0x01, 0x09, 0x01, 0x01, 0x02, + 0x03, 0x03, 0x03, 0x03, 0x05, 0x04, 0x82, 0x02, + 0x01, 0x01, 0x0a, 0x02, 0x01, 0x81, 0x81, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x03, + 0x02, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x82, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x09, 0x01, 0x03, 0x03, 0x01, 0x01 +}; + +struct x07_kb +{ + const char *tag; //input port tag + UINT8 mask; //bit mask + UINT8 codes[7]; //port codes +}; + +static const x07_kb x07_keycodes[56] = +{ + {"BZ", 0x01, {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}}, + {"S1", 0x01, {0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12}}, + {"S1", 0x02, {0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16}}, + {"S1", 0x04, {0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c}}, + {"S1", 0x08, {0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d}}, + {"S1", 0x10, {0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e}}, + {"S1", 0x20, {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f}}, + {"S1", 0x40, {0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20}}, + {"S2", 0x01, {0x5a, 0x7a, 0x1a, 0x00, 0xc2, 0xaf, 0xe1}}, + {"S2", 0x02, {0x58, 0x78, 0x18, 0x00, 0xbb, 0x00, 0x98}}, + {"S2", 0x04, {0x43, 0x63, 0x03, 0x00, 0xbf, 0x00, 0xe4}}, + {"S2", 0x08, {0x56, 0x76, 0x16, 0x00, 0xcb, 0x00, 0x95}}, + {"S2", 0x10, {0x42, 0x62, 0x02, 0x00, 0xba, 0x00, 0xed}}, + {"S2", 0x20, {0x4e, 0x6e, 0x0e, 0x00, 0xd0, 0x00, 0x89}}, + {"S2", 0x40, {0x4d, 0x6d, 0x0d, 0x30, 0xd3, 0x00, 0xf5}}, + {"S2", 0x80, {0x2c, 0x3c, 0x00, 0x00, 0xc8, 0xa4, 0x9c}}, + {"S3", 0x01, {0x41, 0x61, 0x01, 0x00, 0xc1, 0x00, 0x88}}, + {"S3", 0x02, {0x53, 0x73, 0x13, 0x00, 0xc4, 0x00, 0x9f}}, + {"S3", 0x04, {0x44, 0x64, 0x04, 0x00, 0xbc, 0x00, 0xef}}, + {"S3", 0x08, {0x46, 0x66, 0x06, 0x00, 0xca, 0x00, 0xfd}}, + {"S3", 0x10, {0x47, 0x67, 0x07, 0x00, 0xb7, 0x00, 0x9d}}, + {"S3", 0x20, {0x48, 0x68, 0x08, 0x00, 0xb8, 0x00, 0xfe}}, + {"S3", 0x40, {0x4a, 0x6a, 0x0a, 0x31, 0xcf, 0x00, 0xe5}}, + {"S3", 0x80, {0x4b, 0x6b, 0x0b, 0x32, 0xc9, 0x00, 0x9b}}, + {"S4", 0x01, {0x51, 0x71, 0x11, 0x00, 0xc0, 0x00, 0x8b}}, + {"S4", 0x02, {0x57, 0x77, 0x17, 0x00, 0xc3, 0x00, 0xfb}}, + {"S4", 0x04, {0x45, 0x65, 0x05, 0x00, 0xb2, 0xa8, 0x99}}, + {"S4", 0x08, {0x52, 0x72, 0x12, 0x00, 0xbd, 0x00, 0xf6}}, + {"S4", 0x10, {0x54, 0x74, 0x14, 0x00, 0xb6, 0x00, 0x97}}, + {"S4", 0x20, {0x59, 0x79, 0x19, 0x35, 0xdd, 0x00, 0x96}}, + {"S4", 0x40, {0x55, 0x75, 0x15, 0x34, 0xc5, 0x00, 0x94}}, + {"S4", 0x80, {0x49, 0x69, 0x09, 0x00, 0xc6, 0x00, 0xf9}}, + {"S5", 0x01, {0x31, 0x21, 0x00, 0x00, 0xc7, 0x00, 0xe9}}, + {"S5", 0x02, {0x32, 0x22, 0x00, 0x00, 0xcc, 0x00, 0x90}}, + {"S5", 0x04, {0x33, 0x23, 0x00, 0x00, 0xb1, 0xa7, 0x91}}, + {"S5", 0x08, {0x34, 0x24, 0x00, 0x00, 0xb3, 0xa9, 0x92}}, + {"S5", 0x10, {0x35, 0x25, 0x00, 0x00, 0xb4, 0xaa, 0x93}}, + {"S5", 0x20, {0x36, 0x26, 0x00, 0x00, 0xb5, 0xab, 0xec}}, + {"S5", 0x40, {0x37, 0x27, 0x37, 0x00, 0xd4, 0xac, 0xe0}}, + {"S5", 0x80, {0x38, 0x28, 0x37, 0x00, 0xd5, 0xad, 0xf2}}, + {"S7", 0x01, {0x2e, 0x3e, 0x00, 0x2e, 0xd9, 0xa1, 0x9a}}, + {"S7", 0x02, {0x2f, 0x3f, 0x00, 0x00, 0xd2, 0xa5, 0x80}}, + {"S7", 0x04, {0x3f, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00}}, + {"S7", 0x08, {0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d}}, + {"S7", 0x10, {0x4f, 0x6f, 0x0f, 0x36, 0xd7, 0x00, 0x9e}}, + {"S7", 0x20, {0x50, 0x70, 0x10, 0x00, 0xbe, 0x00, 0xf7}}, + {"S7", 0x40, {0x40, 0x60, 0x00, 0x00, 0xde, 0x00, 0xe7}}, + {"S7", 0x80, {0x5b, 0x7b, 0x00, 0x00, 0xdf, 0xa2, 0x84}}, + {"S8", 0x01, {0x4c, 0x6c, 0x0c, 0x33, 0xd8, 0x00, 0xf4}}, + {"S8", 0x02, {0x3b, 0x2b, 0x00, 0x00, 0xda, 0x00, 0x82}}, + {"S8", 0x04, {0x3a, 0x2a, 0x00, 0x00, 0xb9, 0x00, 0x81}}, + {"S8", 0x08, {0x5d, 0x7d, 0x00, 0x00, 0xd1, 0xa3, 0x85}}, + {"S8", 0x10, {0x39, 0x29, 0x39, 0x00, 0xd6, 0xae, 0xf1}}, + {"S8", 0x20, {0x30, 0x7c, 0x00, 0x00, 0xdc, 0xa6, 0x8a}}, + {"S8", 0x40, {0x2d, 0x3d, 0x00, 0x00, 0xce, 0x00, 0xf0}}, + {"S8", 0x80, {0x3d, 0x7e, 0x00, 0x00, 0xcd, 0x00, 0xfc}} +}; + +class x07_state : public driver_device +{ +public: + x07_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_printer(*this, "printer"), + m_beep(*this, "beeper"), + m_ram(*this, RAM_TAG), + m_nvram1(*this, "nvram1"), + m_nvram2(*this, "nvram2"), + m_cassette(*this, "cassette"), + m_card(*this, "cardslot"), + m_warm_start(1) + { } + + required_device m_maincpu; + required_device m_printer; + required_device m_beep; + required_device m_ram; + required_device m_nvram1; + required_device m_nvram2; + required_device m_cassette; + required_device m_card; + + void machine_start(); + void machine_reset(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER( x07_io_r ); + DECLARE_WRITE8_MEMBER( x07_io_w ); + + DECLARE_INPUT_CHANGED_MEMBER( kb_keys ); + DECLARE_INPUT_CHANGED_MEMBER( kb_func_keys ); + DECLARE_INPUT_CHANGED_MEMBER( kb_break ); + DECLARE_INPUT_CHANGED_MEMBER( kb_update_udk ); + + DECLARE_DRIVER_INIT(x07); + void nvram_init(nvram_device &nvram, void *data, size_t size); + + void t6834_cmd(UINT8 cmd); + void t6834_r(); + void t6834_w(); + void cassette_w(); + void cassette_r(); + void printer_w(); + void kb_irq(); + void cassette_load(); + void cassette_save(); + void receive_bit(int bit); + + inline UINT8 get_char(UINT16 pos); + inline UINT8 kb_get_index(UINT8 char_code); + inline void draw_char(UINT8 x, UINT8 y, UINT8 char_pos); + inline void draw_point(UINT8 x, UINT8 y, UINT8 color); + inline void draw_udk(); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER( x07_card ); + + /* general */ + UINT8 m_sleep; + UINT8 m_warm_start; + UINT8 m_t6834_ram[0x800]; + UINT8 m_regs_r[8]; + UINT8 m_regs_w[8]; + UINT8 m_alarm[8]; + + struct fifo_buffer + { + UINT8 data[0x100]; + UINT8 read; + UINT8 write; + }; + fifo_buffer m_in; + fifo_buffer m_out; + + UINT8 m_udk_on; + UINT8 m_draw_udk; + UINT8 m_sp_on; + UINT8 m_font_code; + emu_timer *m_rsta_clear; + emu_timer *m_rstb_clear; + emu_timer *m_beep_stop; + + /* LCD */ + UINT8 m_lcd_on; + UINT8 m_lcd_map[32][120]; + UINT8 m_scroll_min; + UINT8 m_scroll_max; + UINT8 m_blink; + + struct lcd_position + { + UINT8 x; + UINT8 y; + UINT8 on; + }; + lcd_position m_locate; + lcd_position m_cursor; + + /* keyboard */ + UINT8 m_kb_on; + UINT8 m_repeat_key; //not supported + UINT8 m_kb_size; + + /* cassette */ + UINT8 m_cass_motor; + UINT8 m_cass_data; + UINT32 m_cass_clk; + UINT8 m_bit_count; + int m_cass_state; + emu_timer *m_cass_poll; + emu_timer *m_cass_tick; + + /* printer */ + UINT8 m_prn_sendbit; + UINT8 m_prn_char_code; + UINT8 m_prn_buffer[0x100]; + UINT8 m_prn_size; + DECLARE_PALETTE_INIT(x07); + TIMER_CALLBACK_MEMBER(cassette_tick); + TIMER_CALLBACK_MEMBER(cassette_poll); + TIMER_CALLBACK_MEMBER(rsta_clear); + TIMER_CALLBACK_MEMBER(rstb_clear); + TIMER_CALLBACK_MEMBER(beep_stop); + TIMER_DEVICE_CALLBACK_MEMBER(blink_timer); +}; diff --git a/src/mame/includes/x1.h b/src/mame/includes/x1.h new file mode 100644 index 00000000000..13ab9b6ce2e --- /dev/null +++ b/src/mame/includes/x1.h @@ -0,0 +1,303 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese, Barry Rodewald +/***************************************************************************** + * + * includes/x1.h + * + ****************************************************************************/ + +#ifndef X1_H_ +#define X1_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "machine/i8255.h" +#include "machine/wd_fdc.h" +#include "machine/z80dma.h" +#include "video/mc6845.h" +#include "sound/2151intf.h" +#include "sound/ay8910.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "imagedev/flopdrv.h" +#include "formats/x1_tap.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +// ======================> x1_keyboard_device + +class x1_keyboard_device : public device_t, + public device_z80daisy_interface +{ +public: + // construction/destruction + x1_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +private: + virtual void device_start(); + // z80daisy_interface overrides + virtual int z80daisy_irq_state(); + virtual int z80daisy_irq_ack(); + virtual void z80daisy_irq_reti(); +}; + +struct scrn_reg_t +{ + UINT8 gfx_bank; + UINT8 disp_bank; + UINT8 pcg_mode; + UINT8 v400_mode; + UINT8 ank_sel; + + UINT8 pri; + UINT8 blackclip; // x1 turbo specific +}; + +struct turbo_reg_t +{ + UINT8 pal; + UINT8 gfx_pal; + UINT8 txt_pal[8]; + UINT8 txt_disp; +}; + +struct x1_rtc_t +{ + UINT8 sec, min, hour, day, wday, month, year; +}; + + +class x1_state : public driver_device +{ +public: + x1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this,"x1_cpu"), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1"), + m_floppy2(*this, "fdc:2"), + m_floppy3(*this, "fdc:3"), + m_crtc(*this, "crtc"), + m_ctc(*this, "ctc"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_dma(*this, "dma") + { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_maincpu; + required_device m_cassette; + required_device m_cart; + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_device m_crtc; + required_device m_ctc; + + UINT8 *m_tvram; /**< Pointer for Text Video RAM */ + UINT8 *m_avram; /**< Pointer for Attribute Video RAM */ + UINT8 *m_kvram; /**< Pointer for Extended Kanji Video RAM (X1 Turbo) */ + UINT8 *m_ipl_rom; /**< Pointer for IPL ROM */ + UINT8 *m_work_ram; /**< Pointer for base work RAM */ + UINT8 *m_emm_ram; /**< Pointer for EMM RAM */ + UINT8 *m_pcg_ram; /**< Pointer for PCG GFX RAM */ + UINT8 *m_cg_rom; /**< Pointer for GFX ROM */ + UINT8 *m_kanji_rom; /**< Pointer for Kanji ROMs */ + int m_xstart, /**< Start X offset for screen drawing. */ + m_ystart; /**< Start Y offset for screen drawing. */ + UINT8 m_hres_320; /**< Pixel clock divider setting: (1) 48 (0) 24 */ + UINT8 m_io_switch; /**< Enable access for special bitmap RMW phase in isolated i/o. */ + UINT8 m_io_sys; /**< Read-back for PPI port C */ + UINT8 m_vsync; /**< Screen V-Sync bit, active low */ + UINT8 m_vdisp; /**< Screen V-Disp bit, active high */ + UINT8 m_io_bank_mode; /**< Helper for special bitmap RMW phase. */ + UINT8 *m_gfx_bitmap_ram; /**< Pointer for bitmap layer RAM. */ + UINT8 m_pcg_reset; /**< @todo Unused variable. */ + UINT8 m_sub_obf; /**< MCU side: OBF flag active low, indicates that there are parameters in comm buffer. */ + UINT8 m_ctc_irq_flag; /**< @todo Unused variable. */ + scrn_reg_t m_scrn_reg; /**< Base Video Registers. */ + turbo_reg_t m_turbo_reg; /**< Turbo Z Video Registers. */ + x1_rtc_t m_rtc; /**< Struct for RTC related variables */ + emu_timer *m_rtc_timer; /**< Pointer for RTC timer. */ + UINT8 m_pcg_write_addr; /**< @todo Unused variable. */ + UINT8 m_sub_cmd; /**< MCU side: current command issued from Main to Sub. */ + UINT8 m_sub_cmd_length; /**< MCU side: number of parameters, in bytes. */ + UINT8 m_sub_val[8]; /**< MCU side: parameters buffer. */ + int m_sub_val_ptr; /**< MCU side: index for parameter read-back */ + int m_key_i; /**< MCU side: index for keyboard read-back during OBF phase. */ + UINT8 m_irq_vector; /**< @todo Unused variable. */ + UINT8 m_cmt_current_cmd; /**< MCU side: CMT command issued. */ + UINT8 m_cmt_test; /**< MCU side: Tape BREAK status bit. */ + UINT8 m_rom_index[3]; /**< Current ROM address. */ + UINT32 m_kanji_offset; /**< @todo Unused variable. */ + UINT8 m_bios_offset; /**< @todo Unused variable. */ + UINT8 m_x_b; /**< Palette Register for Blue Gun */ + UINT8 m_x_g; /**< Palette Register for Green Gun */ + UINT8 m_x_r; /**< Palette Register for Red Gun */ + UINT16 m_kanji_addr_latch; /**< Internal Kanji ROM address. */ + UINT32 m_kanji_addr; /**< Latched Kanji ROM address. */ + UINT8 m_kanji_eksel; /**< Kanji ROM register bit for latch phase. */ + UINT8 m_pcg_reset_occurred; /**< @todo Unused variable. */ + UINT32 m_old_key1; /**< Keyboard read buffer for i/o port "key1" */ + UINT32 m_old_key2; /**< Keyboard read buffer for i/o port "key2" */ + UINT32 m_old_key3; /**< Keyboard read buffer for i/o port "key3" */ + UINT32 m_old_key4; /**< Keyboard read buffer for i/o port "tenkey" */ + UINT32 m_old_fkey; /**< Keyboard read buffer for i/o port "f_keys" */ + UINT8 m_key_irq_flag; /**< Keyboard IRQ pending. */ + UINT8 m_key_irq_vector; /**< Keyboard IRQ vector. */ + UINT32 m_emm_addr; /**< EMM RAM current address */ + UINT8 *m_pal_4096; /**< X1 Turbo Z: pointer for 4096 palette entries */ + UINT8 m_crtc_vreg[0x100], /**< CRTC register buffer. */ + m_crtc_index; /**< CRTC register index. */ + UINT8 m_is_turbo; /**< Machine type: (0) X1 Vanilla, (1) X1 Turbo */ + UINT8 m_ex_bank; /**< X1 Turbo Z: RAM bank register */ + UINT8 m_ram_bank; /**< Regular RAM bank for 0x0000-0x7fff memory window: (0) ROM/IPL (1) RAM */ + /** + @brief Refresh current bitmap palette. + */ + void set_current_palette(); + /** + @brief Retrieves the current PCG address. + + @param width Number of currently setted up CRTC characters + @param y_char_size Number of scanlines per character. + @return Destination PCG address. + */ + UINT16 get_pcg_addr(UINT16 width, UINT8 y_char_size); + /** + @brief X1 Turbo: Retrieves the current CHR ROM address in Hi-Speed Mode. + + @return Destination CHR address. + */ + UINT16 check_chr_addr(); + /** + @brief X1 Turbo: Retrieves the current PCG ROM address in Hi-Speed Mode. + + @return Destination CHR address. + */ + UINT16 check_pcg_addr(); + /** + @brief MCU side: retrieve keycode to game key conversion. + + @param port Address to convert. + @return The converted game key buffer + */ + UINT8 get_game_key(UINT8 port); + /** + @brief MCU side: retrieve keyboard special key register. + + @return + x--- ---- TEN: Numpad, Function key, special input key + -x-- ---- KIN: Valid key + --x- ---- REP: Key repeat + ---x ---- GRAPH key ON + ---- x--- CAPS lock ON + ---- -x-- KANA lock ON + ---- --x- SHIFT ON + ---- ---x CTRL ON + */ + UINT8 check_keyboard_shift(); + /** + @brief convert MAME input to raw scancode for keyboard. + + @return the converted scancode + @todo Unoptimized. + */ + UINT16 check_keyboard_press(); + + DECLARE_READ8_MEMBER(x1_mem_r); + DECLARE_WRITE8_MEMBER(x1_mem_w); + DECLARE_READ8_MEMBER(x1_io_r); + DECLARE_WRITE8_MEMBER(x1_io_w); + DECLARE_READ8_MEMBER(x1_sub_io_r); + DECLARE_WRITE8_MEMBER(x1_sub_io_w); + DECLARE_READ8_MEMBER(x1_rom_r); + DECLARE_WRITE8_MEMBER(x1_rom_w); + DECLARE_WRITE8_MEMBER(x1_rom_bank_0_w); + DECLARE_WRITE8_MEMBER(x1_rom_bank_1_w); + DECLARE_READ8_MEMBER(x1_fdc_r); + DECLARE_WRITE8_MEMBER(x1_fdc_w); + DECLARE_READ8_MEMBER(x1_pcg_r); + DECLARE_WRITE8_MEMBER(x1_pcg_w); + DECLARE_WRITE8_MEMBER(x1_pal_r_w); + DECLARE_WRITE8_MEMBER(x1_pal_g_w); + DECLARE_WRITE8_MEMBER(x1_pal_b_w); + DECLARE_WRITE8_MEMBER(x1_ex_gfxram_w); + DECLARE_WRITE8_MEMBER(x1_scrn_w); + DECLARE_WRITE8_MEMBER(x1_pri_w); + DECLARE_WRITE8_MEMBER(x1_6845_w); + DECLARE_READ8_MEMBER(x1_kanji_r); + DECLARE_WRITE8_MEMBER(x1_kanji_w); + DECLARE_READ8_MEMBER(x1_emm_r); + DECLARE_WRITE8_MEMBER(x1_emm_w); + DECLARE_READ8_MEMBER(x1turbo_pal_r); + DECLARE_READ8_MEMBER(x1turbo_txpal_r); + DECLARE_READ8_MEMBER(x1turbo_txdisp_r); + DECLARE_READ8_MEMBER(x1turbo_gfxpal_r); + DECLARE_WRITE8_MEMBER(x1turbo_pal_w); + DECLARE_WRITE8_MEMBER(x1turbo_txpal_w); + DECLARE_WRITE8_MEMBER(x1turbo_txdisp_w); + DECLARE_WRITE8_MEMBER(x1turbo_gfxpal_w); + DECLARE_WRITE8_MEMBER(x1turbo_blackclip_w); + DECLARE_READ8_MEMBER(x1turbo_mem_r); + DECLARE_WRITE8_MEMBER(x1turbo_mem_w); + DECLARE_READ8_MEMBER(x1turbo_io_r); + DECLARE_WRITE8_MEMBER(x1turbo_io_w); + DECLARE_WRITE8_MEMBER(x1turboz_4096_palette_w); + DECLARE_READ8_MEMBER(x1turboz_blackclip_r); + DECLARE_READ8_MEMBER(x1turbo_bank_r); + DECLARE_WRITE8_MEMBER(x1turbo_bank_w); + DECLARE_READ8_MEMBER(x1_porta_r); + DECLARE_READ8_MEMBER(x1_portb_r); + DECLARE_READ8_MEMBER(x1_portc_r); + DECLARE_WRITE8_MEMBER(x1_porta_w); + DECLARE_WRITE8_MEMBER(x1_portb_w); + DECLARE_WRITE8_MEMBER(x1_portc_w); + DECLARE_DRIVER_INIT(x1_kanji); + DECLARE_MACHINE_START(x1); + DECLARE_MACHINE_RESET(x1); + DECLARE_VIDEO_START(x1); + DECLARE_PALETTE_INIT(x1); + DECLARE_MACHINE_RESET(x1turbo); + UINT32 screen_update_x1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_INPUT_CHANGED_MEMBER(ipl_reset); + DECLARE_INPUT_CHANGED_MEMBER(nmi_reset); + TIMER_CALLBACK_MEMBER(x1_rtc_increment); + TIMER_DEVICE_CALLBACK_MEMBER(x1_cmt_wind_timer); + TIMER_DEVICE_CALLBACK_MEMBER(x1_keyboard_callback); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + + void x1_draw_pixel(bitmap_rgb32 &bitmap,int y,int x,UINT16 pen,UINT8 width,UINT8 height); + void draw_fgtilemap(bitmap_rgb32 &bitmap,const rectangle &cliprect); + void draw_gfxbitmap(bitmap_rgb32 &bitmap,const rectangle &cliprect, int plane,int pri); + UINT8 check_prev_height(int x,int y,int x_size); + UINT8 check_line_valid_height(int y,int x_size,int height); + + int priority_mixer_pri(int color); + void cmt_command( UINT8 cmd ); + UINT16 jis_convert(int kanji_addr); + + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + required_device m_gfxdecode; + required_device m_palette; + optional_device m_dma; +}; + +/*----------- defined in machine/x1.c -----------*/ + +extern const device_type X1_KEYBOARD; + +#endif /* X1_H_ */ diff --git a/src/mame/includes/x68k.h b/src/mame/includes/x68k.h new file mode 100644 index 00000000000..b9d34c61d91 --- /dev/null +++ b/src/mame/includes/x68k.h @@ -0,0 +1,362 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald,Carl +/***************************************************************************** + * + * includes/x68k.h + * + * Sharp X68000 + * + ****************************************************************************/ + +#ifndef X68K_H_ +#define X68K_H_ + +#include "cpu/m68000/m68000.h" +#include "machine/hd63450.h" +#include "machine/rp5c15.h" +#include "machine/upd765.h" +#include "sound/okim6258.h" +#include "machine/ram.h" +#include "machine/8530scc.h" +#include "sound/2151intf.h" +#include "machine/i8255.h" + +#define MC68901_TAG "mc68901" +#define RP5C15_TAG "rp5c15" + +#define GFX16 0 +#define GFX256 1 +#define GFX65536 2 + +class x68k_state : public driver_device +{ +public: + enum + { + TIMER_X68K_LED, + TIMER_X68K_SCC_ACK, + TIMER_MD_6BUTTON_PORT1_TIMEOUT, + TIMER_MD_6BUTTON_PORT2_TIMEOUT, + TIMER_X68K_BUS_ERROR, + TIMER_X68K_NET_IRQ, + TIMER_X68K_CRTC_OPERATION_END, + TIMER_X68K_HSYNC, + TIMER_X68K_CRTC_RASTER_END, + TIMER_X68K_CRTC_RASTER_IRQ, + TIMER_X68K_CRTC_VBLANK_IRQ, + TIMER_X68K_FDC_TC, + TIMER_X68K_ADPCM + }; + + x68k_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_okim6258(*this, "okim6258"), + m_hd63450(*this, "hd63450"), + m_ram(*this, RAM_TAG), + m_gfxdecode(*this, "gfxdecode"), + m_gfxpalette(*this, "gfxpalette"), + m_pcgpalette(*this, "pcgpalette"), + m_mfpdev(*this, MC68901_TAG), + m_rtc(*this, RP5C15_TAG), + m_scc(*this, "scc"), + m_ym2151(*this, "ym2151"), + m_ppi(*this, "ppi8255"), + m_screen(*this, "screen"), + m_upd72065(*this, "upd72065"), + m_options(*this, "options"), + m_mouse1(*this, "mouse1"), + m_mouse2(*this, "mouse2"), + m_mouse3(*this, "mouse3"), + m_xpd1lr(*this, "xpd1lr"), + m_ctrltype(*this, "ctrltype"), + m_joy1(*this, "joy1"), + m_joy2(*this, "joy2"), + m_md3b(*this, "md3b"), + m_md6b(*this, "md6b"), + m_md6b_extra(*this, "md6b_extra"), + m_nvram(0x4000/sizeof(UINT16)), + m_tvram(0x80000/sizeof(UINT16)), + m_gvram(0x80000/sizeof(UINT16)), + m_spritereg(0x8000/sizeof(UINT16), 0) + { } + + required_device m_maincpu; + required_device m_okim6258; + required_device m_hd63450; + required_device m_ram; + required_device m_gfxdecode; + required_device m_gfxpalette; + required_device m_pcgpalette; + required_device m_mfpdev; + required_device m_rtc; + required_device m_scc; + required_device m_ym2151; + required_device m_ppi; + required_device m_screen; + required_device m_upd72065; + + required_ioport m_options; + required_ioport m_mouse1; + required_ioport m_mouse2; + required_ioport m_mouse3; + required_ioport m_xpd1lr; + required_ioport m_ctrltype; + required_ioport m_joy1; + required_ioport m_joy2; + required_ioport m_md3b; + required_ioport m_md6b; + required_ioport m_md6b_extra; + + std::vector m_nvram; + std::vector m_tvram; + std::vector m_gvram; + std::vector m_spritereg; + + bitmap_ind16 *m_pcgbitmap; + bitmap_ind16 *m_gfxbitmap; + + void floppy_load_unload(bool load, floppy_image_device *dev); + int floppy_load(floppy_image_device *dev); + void floppy_unload(floppy_image_device *dev); + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + struct + { + int sram_writeprotect; + int monitor; + int contrast; + int keyctrl; + UINT16 cputype; + } m_sysport; + struct + { + floppy_image_device *floppy[4]; + int led_ctrl[4]; + int led_eject[4]; + int eject[4]; + int motor; + int control_drives; + int select_drive; + } m_fdc; + struct + { + int ioc7; // "Function B operation of joystick # one option" + int ioc6; // "Function A operation of joystick # one option" + int joy1_enable; // IOC4 + int joy2_enable; // IOC5 + } m_joy; + struct + { + int rate; // ADPCM sample rate + int pan; // ADPCM output switch + int clock; // ADPCM clock speed + } m_adpcm; + struct + { + unsigned short reg[24]; // registers + int operation; // operation port (0xe80481) + int vblank; // 1 if in VBlank + int hblank; // 1 if in HBlank + int htotal; // Horizontal Total (in characters) + int vtotal; // Vertical Total + int hbegin; // Horizontal Begin + int vbegin; // Vertical Begin + int hend; // Horizontal End + int vend; // Vertical End + int hsync_end; // Horizontal Sync End + int vsync_end; // Vertical Sync End + int hsyncadjust; // Horizontal Sync Adjustment + float hmultiple; // Horizontal pixel multiplier + float vmultiple; // Vertical scanline multiplier (x2 for doublescan modes) + int height; + int width; + int visible_height; + int visible_width; + int hshift; + int vshift; + int video_width; // horizontal total (in pixels) + int video_height; // vertical total + int bg_visible_height; + int bg_visible_width; + int bg_hshift; + int bg_vshift; + int bg_hvres; // bits 0,1 = H-Res, bits 2,3 = V-Res, bit 4 = L/H Freq (0=15.98kHz, 1=31.5kHz) + int bg_double; // 1 if PCG is to be doubled. + int interlace; // 1024 vertical resolution is interlaced + } m_crtc; // CRTC + struct + { // video controller at 0xe82000 + unsigned short reg[3]; + int text_pri; + int sprite_pri; + int gfx_pri; + int gfxlayer_pri[4]; // block displayed for each priority level + int tile8_dirty[1024]; + int tile16_dirty[256]; + } m_video; + struct + { + int irqstatus; + int fdcvector; + int fddvector; + int hdcvector; + int prnvector; + } m_ioc; + struct + { + int inputtype; // determines which input is to be received + int irqactive; // non-zero if IRQ is being serviced + char last_mouse_x; // previous mouse x-axis value + char last_mouse_y; // previous mouse y-axis value + int bufferempty; // non-zero if buffer is empty + } m_mouse; + struct + { + // port A + int mux1; // multiplexer value + int seq1; // part of 6-button input sequence. + emu_timer* io_timeout1; + // port B + int mux2; // multiplexer value + int seq2; // part of 6-button input sequence. + emu_timer* io_timeout2; + } m_mdctrl; + UINT8 m_ppi_port[3]; + int m_current_vector[8]; + UINT8 m_current_irq_line; + unsigned int m_scanline; + int m_led_state; + emu_timer* m_mouse_timer; + emu_timer* m_led_timer; + emu_timer* m_net_timer; + unsigned char m_scc_prev; + UINT16 m_ppi_prev; + int m_mfp_prev; + emu_timer* m_scanline_timer; + emu_timer* m_raster_irq; + emu_timer* m_vblank_irq; + emu_timer* m_fdc_tc; + emu_timer* m_adpcm_timer; + emu_timer* m_bus_error_timer; + UINT16* m_spriteram; + tilemap_t* m_bg0_8; + tilemap_t* m_bg1_8; + tilemap_t* m_bg0_16; + tilemap_t* m_bg1_16; + int m_sprite_shift; + int m_oddscanline; + bool m_is_32bit; + DECLARE_DRIVER_INIT(x68kxvi); + DECLARE_DRIVER_INIT(x68030); + DECLARE_DRIVER_INIT(x68000); + TILE_GET_INFO_MEMBER(x68k_get_bg0_tile); + TILE_GET_INFO_MEMBER(x68k_get_bg1_tile); + TILE_GET_INFO_MEMBER(x68k_get_bg0_tile_16); + TILE_GET_INFO_MEMBER(x68k_get_bg1_tile_16); + DECLARE_MACHINE_START(x68030); + DECLARE_MACHINE_RESET(x68000); + DECLARE_MACHINE_START(x68000); + DECLARE_VIDEO_START(x68000); + DECLARE_PALETTE_INIT(x68000); + UINT32 screen_update_x68000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(x68k_led_callback); + TIMER_CALLBACK_MEMBER(x68k_scc_ack); + TIMER_CALLBACK_MEMBER(md_6button_port1_timeout); + TIMER_CALLBACK_MEMBER(md_6button_port2_timeout); + TIMER_CALLBACK_MEMBER(x68k_bus_error); + TIMER_CALLBACK_MEMBER(x68k_net_irq); + TIMER_CALLBACK_MEMBER(x68k_crtc_operation_end); + TIMER_CALLBACK_MEMBER(x68k_hsync); + TIMER_CALLBACK_MEMBER(x68k_crtc_raster_end); + TIMER_CALLBACK_MEMBER(x68k_crtc_raster_irq); + TIMER_CALLBACK_MEMBER(x68k_crtc_vblank_irq); + DECLARE_READ8_MEMBER(ppi_port_a_r); + DECLARE_READ8_MEMBER(ppi_port_b_r); + DECLARE_READ8_MEMBER(ppi_port_c_r); + DECLARE_WRITE8_MEMBER(ppi_port_c_w); + DECLARE_WRITE_LINE_MEMBER(fdc_irq); + DECLARE_WRITE8_MEMBER(x68k_ct_w); + DECLARE_WRITE_LINE_MEMBER(x68k_rtc_alarm_irq); + DECLARE_WRITE8_MEMBER(x68030_adpcm_w); + DECLARE_WRITE_LINE_MEMBER(mfp_irq_callback); + DECLARE_WRITE_LINE_MEMBER(x68k_scsi_irq); + DECLARE_WRITE_LINE_MEMBER(x68k_scsi_drq); + + //dmac + void dma_irq(int channel); + DECLARE_WRITE8_MEMBER(dma_end); + DECLARE_WRITE8_MEMBER(dma_error); + + int x68k_read_mouse(); + void x68k_set_adpcm(); + UINT8 md_3button_r(int port); + void md_6button_init(); + UINT8 md_6button_r(int port); + UINT8 xpd1lr_r(int port); + + DECLARE_WRITE_LINE_MEMBER(x68k_fm_irq); + DECLARE_WRITE_LINE_MEMBER(x68k_irq2_line); + + DECLARE_WRITE16_MEMBER(x68k_scc_w); + DECLARE_WRITE16_MEMBER(x68k_fdc_w); + DECLARE_READ16_MEMBER(x68k_fdc_r); + DECLARE_WRITE16_MEMBER(x68k_ioc_w); + DECLARE_READ16_MEMBER(x68k_ioc_r); + DECLARE_WRITE16_MEMBER(x68k_sysport_w); + DECLARE_READ16_MEMBER(x68k_sysport_r); + DECLARE_WRITE16_MEMBER(x68k_ppi_w); + DECLARE_READ16_MEMBER(x68k_ppi_r); + DECLARE_WRITE16_MEMBER(x68k_sram_w); + DECLARE_READ16_MEMBER(x68k_sram_r); + DECLARE_WRITE16_MEMBER(x68k_vid_w); + DECLARE_READ16_MEMBER(x68k_vid_r); + DECLARE_READ16_MEMBER(x68k_areaset_r); + DECLARE_WRITE16_MEMBER(x68k_areaset_w); + DECLARE_WRITE16_MEMBER(x68k_enh_areaset_w); + DECLARE_READ16_MEMBER(x68k_rom0_r); + DECLARE_WRITE16_MEMBER(x68k_rom0_w); + DECLARE_READ16_MEMBER(x68k_emptyram_r); + DECLARE_WRITE16_MEMBER(x68k_emptyram_w); + DECLARE_READ16_MEMBER(x68k_exp_r); + DECLARE_WRITE16_MEMBER(x68k_exp_w); + DECLARE_READ16_MEMBER(x68k_scc_r); + + DECLARE_READ16_MEMBER(x68k_spritereg_r); + DECLARE_WRITE16_MEMBER(x68k_spritereg_w); + DECLARE_READ16_MEMBER(x68k_spriteram_r); + DECLARE_WRITE16_MEMBER(x68k_spriteram_w); + DECLARE_WRITE16_MEMBER(x68k_crtc_w); + DECLARE_READ16_MEMBER(x68k_crtc_r); + DECLARE_WRITE16_MEMBER(x68k_gvram_w); + DECLARE_READ16_MEMBER(x68k_gvram_r); + DECLARE_WRITE16_MEMBER(x68k_tvram_w); + DECLARE_READ16_MEMBER(x68k_tvram_r); + IRQ_CALLBACK_MEMBER(x68k_int_ack); + +private: + inline void x68k_plot_pixel(bitmap_rgb32 &bitmap, int x, int y, UINT32 color); + void x68k_crtc_text_copy(int src, int dest, UINT8 planes); + void x68k_crtc_refresh_mode(); + void x68k_draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle rect); + bool x68k_draw_gfx_scanline(bitmap_ind16 &bitmap, rectangle cliprect, UINT8 priority); + void x68k_draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect); + void x68k_draw_sprites(bitmap_ind16 &bitmap, int priority, rectangle cliprect); + +public: + bitmap_rgb32* x68k_get_gfx_page(int pri,int type); + attotime prescale(int val); + void mfp_trigger_irq(int irq); + void mfp_set_timer(int timer, unsigned char data); + void mfp_recv_data(int data); + DECLARE_PALETTE_DECODER(GGGGGRRRRRBBBBBI); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + void set_bus_error(UINT32 address, bool write, UINT16 mem_mask); + bool m_bus_error; +}; + + + +#endif /* X68K_H_ */ diff --git a/src/mame/includes/xerox820.h b/src/mame/includes/xerox820.h new file mode 100644 index 00000000000..797e5689b6e --- /dev/null +++ b/src/mame/includes/xerox820.h @@ -0,0 +1,166 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#ifndef __XEROX820__ +#define __XEROX820__ + +#include "emu.h" +#include "bus/scsi/sa1403d.h" +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "cpu/i86/i86.h" +#include "machine/com8116.h" +#include "machine/ram.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" +#include "machine/wd_fdc.h" +#include "machine/x820kb.h" +#include "machine/z80pio.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "sound/speaker.h" +#include "sound/beep.h" + +#define SCREEN_TAG "screen" + +#define Z80_TAG "u46" +#define Z80PIO_KB_TAG "u105" +#define Z80PIO_GP_TAG "u101" +#define Z80PIO_RD_TAG "u8" +#define Z80SIO_TAG "u96" +#define Z80CTC_TAG "u99" +#define FD1771_TAG "u109" +#define FD1797_TAG "u109" +#define COM8116_TAG "u76" +#define I8086_TAG "i8086" +#define SASIBUS_TAG "sasi" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" +#define KEYBOARD_TAG "kb" + +#define XEROX820_VIDEORAM_SIZE 0x1000 +#define XEROX820_VIDEORAM_MASK 0x0fff + +class xerox820_state : public driver_device +{ +public: + xerox820_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_kbpio(*this, Z80PIO_KB_TAG), + m_ctc(*this, Z80CTC_TAG), + m_sio(*this, Z80SIO_TAG), + m_fdc(*this, FD1771_TAG), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette"), + m_floppy0(*this, FD1771_TAG":0"), + m_floppy1(*this, FD1771_TAG":1"), + m_kb(*this, KEYBOARD_TAG), + m_rom(*this, Z80_TAG), + m_char_rom(*this, "chargen"), + m_video_ram(*this, "video_ram"), + m_fdc_irq(0), + m_fdc_drq(0), + m_8n5(0), + m_400_460(0) + { } + + virtual void machine_start(); + virtual void machine_reset(); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + required_device m_maincpu; + required_device m_kbpio; + required_device m_ctc; + required_device m_sio; + required_device m_fdc; + required_device m_ram; + required_device m_palette; + required_device m_floppy0; + required_device m_floppy1; + required_device m_kb; + required_memory_region m_rom; + required_memory_region m_char_rom; + required_shared_ptr m_video_ram; + + DECLARE_READ8_MEMBER( fdc_r ); + DECLARE_WRITE8_MEMBER( fdc_w ); + DECLARE_WRITE8_MEMBER( scroll_w ); + //DECLARE_WRITE8_MEMBER( x120_system_w ); + DECLARE_READ8_MEMBER( kbpio_pa_r ); + DECLARE_WRITE8_MEMBER( kbpio_pa_w ); + DECLARE_READ8_MEMBER( kbpio_pb_r ); + DECLARE_WRITE_LINE_MEMBER( intrq_w ); + DECLARE_WRITE_LINE_MEMBER( drq_w ); + DECLARE_WRITE_LINE_MEMBER( fr_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); + DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); + + virtual void bankswitch(int bank); + void update_nmi(); + + /* video state */ + UINT8 m_scroll; /* vertical scroll */ + UINT8 m_framecnt; + int m_ncset2; /* national character set */ + int m_vatt; /* X120 video attribute */ + int m_lowlite; /* low light attribute */ + int m_chrom; /* character ROM index */ + + /* floppy state */ + bool m_fdc_irq; /* interrupt request */ + bool m_fdc_drq; /* data request */ + int m_8n5; /* 5.25" / 8" drive select */ + int m_400_460; /* double sided disk detect */ + + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); +}; + +class bigboard_state : public xerox820_state +{ +public: + bigboard_state(const machine_config &mconfig, device_type type, const char *tag) + : xerox820_state(mconfig, type, tag), + m_beeper(*this, "beeper") + { } + + required_device m_beeper; + + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( kbpio_pa_w ); + + bool m_bit5; + + TIMER_CALLBACK_MEMBER(bigboard_beepoff); +}; + +class xerox820ii_state : public xerox820_state +{ +public: + xerox820ii_state(const machine_config &mconfig, device_type type, const char *tag) : + xerox820_state(mconfig, type, tag), + m_speaker(*this, "speaker"), + m_sasibus(*this, SASIBUS_TAG) + { + } + + required_device m_speaker; + required_device m_sasibus; + + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( bell_w ); + DECLARE_WRITE8_MEMBER( slden_w ); + DECLARE_WRITE8_MEMBER( chrom_w ); + DECLARE_WRITE8_MEMBER( lowlite_w ); + DECLARE_WRITE8_MEMBER( sync_w ); + + DECLARE_WRITE8_MEMBER( rdpio_pb_w ); + DECLARE_WRITE_LINE_MEMBER( rdpio_pardy_w ); + + void bankswitch(int bank); +}; + +#endif diff --git a/src/mame/includes/xor100.h b/src/mame/includes/xor100.h new file mode 100644 index 00000000000..63a63a21ea3 --- /dev/null +++ b/src/mame/includes/xor100.h @@ -0,0 +1,107 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#pragma once + +#ifndef __XOR100__ +#define __XOR100__ + +#include "emu.h" +#include "bus/s100/s100.h" +#include "cpu/z80/z80.h" +#include "machine/ram.h" +#include "machine/com8116.h" +#include "bus/centronics/ctronics.h" +#include "machine/i8255.h" +#include "machine/i8251.h" +#include "machine/wd_fdc.h" +#include "machine/z80ctc.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "5b" +#define I8251_A_TAG "12b" +#define I8251_B_TAG "14b" +#define I8255A_TAG "8a" +#define COM5016_TAG "15c" +#define Z80CTC_TAG "11b" +#define WD1795_TAG "wd1795" +#define CENTRONICS_TAG "centronics" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" + +class xor100_state : public driver_device +{ +public: + xor100_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_dbrg(*this, COM5016_TAG), + m_uart_a(*this, I8251_A_TAG), + m_uart_b(*this, I8251_B_TAG), + m_fdc(*this, WD1795_TAG), + m_ctc(*this, Z80CTC_TAG), + m_ram(*this, RAM_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_s100(*this, S100_TAG), + m_floppy0(*this, WD1795_TAG":0"), + m_floppy1(*this, WD1795_TAG":1"), + m_floppy2(*this, WD1795_TAG":2"), + m_floppy3(*this, WD1795_TAG":3"), + m_rom(*this, Z80_TAG) + { } + + required_device m_maincpu; + required_device m_dbrg; + required_device m_uart_a; + required_device m_uart_b; + required_device m_fdc; + required_device m_ctc; + required_device m_ram; + required_device m_centronics; + required_device m_s100; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; + required_memory_region m_rom; + + virtual void machine_start(); + virtual void machine_reset(); + + DECLARE_WRITE8_MEMBER( mmu_w ); + DECLARE_WRITE8_MEMBER( prom_toggle_w ); + DECLARE_READ8_MEMBER( prom_disable_r ); + DECLARE_WRITE8_MEMBER( baud_w ); + DECLARE_READ8_MEMBER( fdc_r ); + DECLARE_WRITE8_MEMBER( fdc_w ); + DECLARE_READ8_MEMBER( fdc_wait_r ); + DECLARE_WRITE8_MEMBER( fdc_dcont_w ); + DECLARE_WRITE8_MEMBER( fdc_dsel_w ); + void fdc_intrq_w(bool state); + void fdc_drq_w(bool state); + + void bankswitch(); + void post_load(); + + // memory state + int m_mode; + int m_bank; + + // floppy state + bool m_fdc_irq; + bool m_fdc_drq; + int m_fdc_dden; + DECLARE_WRITE_LINE_MEMBER(com5016_fr_w); + DECLARE_WRITE_LINE_MEMBER(com5016_ft_w); + DECLARE_READ8_MEMBER(i8255_pc_r); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); + DECLARE_WRITE8_MEMBER(xor100_kbd_put); + + int m_centronics_busy; + int m_centronics_select; + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE_LINE_MEMBER(write_centronics_select); +}; + +#endif diff --git a/src/mame/includes/z80ne.h b/src/mame/includes/z80ne.h new file mode 100644 index 00000000000..b6d77971981 --- /dev/null +++ b/src/mame/includes/z80ne.h @@ -0,0 +1,192 @@ +// license:BSD-3-Clause +// copyright-holders:Roberto Lavarone +/***************************************************************************** + * + * includes/z80ne.h + * + * Nuova Elettronica Z80NE + * + * http://www.z80ne.com/ + * + ****************************************************************************/ + +#ifndef Z80NE_H_ +#define Z80NE_H_ + +#include "video/mc6847.h" +#include "imagedev/cassette.h" +#include "machine/ay31015.h" +#include "machine/kr2376.h" +#include "machine/wd_fdc.h" + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define Z80NE_CPU_SPEED_HZ 1920000 /* 1.92 MHz */ + +#define LX383_KEYS 16 +#define LX383_DOWNSAMPLING 16 + +#define LX385_TAPE_SAMPLE_FREQ 38400 + +/* wave duration threshold */ +enum z80netape_speed +{ + TAPE_300BPS = 300, /* 300 bps */ + TAPE_600BPS = 600, /* 600 bps */ + TAPE_1200BPS = 1200 /* 1200 bps */ +}; + +struct z80ne_cass_data_t { + struct { + int length; /* time cassette level is at input.level */ + int level; /* cassette level */ + int bit; /* bit being read */ + } input; + struct { + int length; /* time cassette level is at output.level */ + int level; /* cassette level */ + int bit; /* bit to output */ + } output; + z80netape_speed speed; /* 300 - 600 - 1200 */ + int wave_filter; + int wave_length; + int wave_short; + int wave_long; +}; + +struct wd17xx_state_t { + int drq; + int intrq; + UINT8 drive; /* current drive */ + UINT8 head; /* current head */ +}; + + +class z80ne_state : public driver_device +{ +public: + z80ne_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_vdg(*this, "mc6847"), + m_videoram(*this, "videoram"), + m_ay31015(*this, "ay_3_1015"), + m_lx388_kr2376(*this, "lx388_kr2376"), + m_maincpu(*this, "z80ne"), + m_floppy0(*this, "wd1771:0"), + m_floppy1(*this, "wd1771:1"), + m_floppy2(*this, "wd1771:2"), + m_floppy3(*this, "wd1771:3"), + m_cassette1(*this, "cassette"), + m_cassette2(*this, "cassette2"), + m_wd1771(*this, "wd1771"), + m_region_z80ne(*this, "z80ne"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_io_row0(*this, "ROW0"), + m_io_row1(*this, "ROW1"), + m_io_ctrl(*this, "CTRL"), + m_io_rst(*this, "RST"), + m_io_lx_385(*this, "LX.385"), + m_io_lx388_brk(*this, "LX388_BRK"), + m_io_x0(*this, "X0"), + m_io_x1(*this, "X1"), + m_io_x2(*this, "X2"), + m_io_x3(*this, "X3"), + m_io_x4(*this, "X4"), + m_io_x5(*this, "X5"), + m_io_x6(*this, "X6"), + m_io_x7(*this, "X7"), + m_io_modifiers(*this, "MODIFIERS"), + m_io_config(*this, "CONFIG") { } + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + optional_device m_vdg; + optional_shared_ptr m_videoram; + required_device m_ay31015; + optional_device m_lx388_kr2376; + UINT8 m_lx383_scan_counter; + UINT8 m_lx383_key[LX383_KEYS]; + int m_lx383_downsampler; + int m_nmi_delay_counter; + int m_reset_delay_counter; + UINT8 m_lx385_ctrl; + emu_timer *m_cassette_timer; + z80ne_cass_data_t m_cass_data; + wd17xx_state_t m_wd17xx_state; + DECLARE_READ8_MEMBER(lx383_r); + DECLARE_WRITE8_MEMBER(lx383_w); + DECLARE_READ8_MEMBER(lx385_data_r); + DECLARE_READ8_MEMBER(lx385_ctrl_r); + DECLARE_WRITE8_MEMBER(lx385_data_w); + DECLARE_WRITE8_MEMBER(lx385_ctrl_w); + DECLARE_READ8_MEMBER(lx388_data_r); + DECLARE_READ8_MEMBER(lx388_read_field_sync); + DECLARE_DIRECT_UPDATE_MEMBER(z80ne_default); + DECLARE_DIRECT_UPDATE_MEMBER(z80ne_nmi_delay_count); + DECLARE_DIRECT_UPDATE_MEMBER(z80ne_reset_delay_count); + DECLARE_DRIVER_INIT(z80netf); + DECLARE_DRIVER_INIT(z80net); + DECLARE_DRIVER_INIT(z80netb); + DECLARE_DRIVER_INIT(z80ne); + DECLARE_MACHINE_START(z80ne); + DECLARE_MACHINE_RESET(z80ne); + DECLARE_MACHINE_START(z80netb); + DECLARE_MACHINE_RESET(z80netb); + DECLARE_MACHINE_START(z80netf); + DECLARE_MACHINE_RESET(z80netf); + DECLARE_MACHINE_START(z80net); + DECLARE_MACHINE_RESET(z80net); + DECLARE_MACHINE_RESET(z80ne_base); + DECLARE_INPUT_CHANGED_MEMBER(z80ne_reset); + DECLARE_INPUT_CHANGED_MEMBER(z80ne_nmi); + TIMER_CALLBACK_MEMBER(z80ne_cassette_tc); + TIMER_CALLBACK_MEMBER(z80ne_kbd_scan); + DECLARE_READ8_MEMBER(lx388_mc6847_videoram_r); + DECLARE_WRITE8_MEMBER(lx390_motor_w); + DECLARE_READ8_MEMBER(lx390_reset_bank); + DECLARE_READ8_MEMBER(lx390_fdc_r); + DECLARE_WRITE8_MEMBER(lx390_fdc_w); + +protected: + required_device m_maincpu; + optional_device m_floppy0; + optional_device m_floppy1; + optional_device m_floppy2; + optional_device m_floppy3; + required_device m_cassette1; + required_device m_cassette2; + optional_device m_wd1771; + required_memory_region m_region_z80ne; + optional_memory_bank m_bank1; + optional_memory_bank m_bank2; + optional_memory_bank m_bank3; + optional_memory_bank m_bank4; + required_ioport m_io_row0; + required_ioport m_io_row1; + required_ioport m_io_ctrl; + required_ioport m_io_rst; + required_ioport m_io_lx_385; + optional_ioport m_io_lx388_brk; + optional_ioport m_io_x0; + optional_ioport m_io_x1; + optional_ioport m_io_x2; + optional_ioport m_io_x3; + optional_ioport m_io_x4; + optional_ioport m_io_x5; + optional_ioport m_io_x6; + optional_ioport m_io_x7; + optional_ioport m_io_modifiers; + optional_ioport m_io_config; + + cassette_image_device *cassette_device_image(); + void reset_lx388(); + void reset_lx382_banking(); + void reset_lx390_banking(); +}; + +#endif /* Z80NE_H_ */ diff --git a/src/mame/includes/z88.h b/src/mame/includes/z88.h new file mode 100644 index 00000000000..99a26354f5a --- /dev/null +++ b/src/mame/includes/z88.h @@ -0,0 +1,95 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/***************************************************************************** + * + * includes/z88.h + * + ****************************************************************************/ + +#ifndef Z88_H_ +#define Z88_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/upd65031.h" +#include "machine/ram.h" +#include "bus/z88/z88.h" +#include "bus/z88/flash.h" +#include "bus/z88/ram.h" +#include "bus/z88/rom.h" +#include "sound/speaker.h" +#include "rendlay.h" + +#define Z88_NUM_COLOURS 3 + +#define Z88_SCREEN_WIDTH 640 +#define Z88_SCREEN_HEIGHT 64 + +#define Z88_SCR_HW_REV (1<<4) +#define Z88_SCR_HW_HRS (1<<5) +#define Z88_SCR_HW_UND (1<<1) +#define Z88_SCR_HW_FLS (1<<3) +#define Z88_SCR_HW_GRY (1<<2) +#define Z88_SCR_HW_CURS (Z88_SCR_HW_HRS|Z88_SCR_HW_FLS|Z88_SCR_HW_REV) +#define Z88_SCR_HW_NULL (Z88_SCR_HW_HRS|Z88_SCR_HW_GRY|Z88_SCR_HW_REV) + +enum +{ + Z88_BANK_ROM = 1, + Z88_BANK_RAM, + Z88_BANK_CART, + Z88_BANK_UNMAP +}; + + +class z88_state : public driver_device +{ +public: + z88_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette") + { } + + required_device m_maincpu; + required_device m_ram; + required_device m_palette; + + virtual void machine_start(); + virtual void machine_reset(); + DECLARE_READ8_MEMBER(kb_r); + UPD65031_MEMORY_UPDATE(bankswitch_update); + UPD65031_SCREEN_UPDATE(lcd_update); + + // cartridges read/write + DECLARE_READ8_MEMBER(bank0_cart_r); + DECLARE_READ8_MEMBER(bank1_cart_r); + DECLARE_READ8_MEMBER(bank2_cart_r); + DECLARE_READ8_MEMBER(bank3_cart_r); + DECLARE_WRITE8_MEMBER(bank0_cart_w); + DECLARE_WRITE8_MEMBER(bank1_cart_w); + DECLARE_WRITE8_MEMBER(bank2_cart_w); + DECLARE_WRITE8_MEMBER(bank3_cart_w); + + // defined in video/z88.c + inline void plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT16 color); + inline UINT8* convert_address(UINT32 offset); + void vh_render_8x8(bitmap_ind16 &bitmap, int x, int y, UINT16 pen0, UINT16 pen1, UINT8 *gfx); + void vh_render_6x8(bitmap_ind16 &bitmap, int x, int y, UINT16 pen0, UINT16 pen1, UINT8 *gfx); + void vh_render_line(bitmap_ind16 &bitmap, int x, int y, UINT16 pen); + + struct + { + UINT8 slot; + UINT8 page; + } m_bank[4]; + + int m_bank_type[4]; + UINT8 * m_bios; + UINT8 * m_ram_base; + z88cart_slot_device * m_carts[4]; + DECLARE_PALETTE_INIT(z88); +}; + +#endif /* Z88_H_ */ diff --git a/src/mame/includes/zapcomputer.h b/src/mame/includes/zapcomputer.h new file mode 100644 index 00000000000..e86ae010da3 --- /dev/null +++ b/src/mame/includes/zapcomputer.h @@ -0,0 +1,30 @@ +// license:GPL2+ +// copyright-holders:FelipeSanches +/***************************************************************************** + * + * includes/zapcomputer.h + * + ****************************************************************************/ + +#ifndef __ZAPCOMPUTER__ +#define __ZAPCOMPUTER__ + +#include "emu.h" +#include "cpu/z80/z80.h" + +class zapcomp_state : public driver_device +{ +public: + zapcomp_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + required_device m_maincpu; + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(display_7seg_w); + + virtual void machine_start(); +}; + +#endif // __ZAPCOMPUTER__ diff --git a/src/mame/includes/zx.h b/src/mame/includes/zx.h new file mode 100644 index 00000000000..c6165fd30d3 --- /dev/null +++ b/src/mame/includes/zx.h @@ -0,0 +1,112 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Krzysztof Strzecha, Robbbert +/***************************************************************************** + * + * includes/zx.h + * + ****************************************************************************/ + +#ifndef ZX_H_ +#define ZX_H_ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" +#include "sound/wave.h" +#include "imagedev/cassette.h" +#include "formats/zx81_p.h" +#include "machine/ram.h" + + +class zx_state : public driver_device +{ +public: + enum + { + TIMER_TAPE_PULSE, + TIMER_ULA_NMI, + TIMER_ULA_IRQ + }; + + zx_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_ram(*this, RAM_TAG), + m_cassette(*this, "cassette"), + m_speaker(*this, "speaker"), + m_region_maincpu(*this, "maincpu"), + m_region_gfx1(*this, "gfx1"), + m_io_row0(*this, "ROW0"), + m_io_row1(*this, "ROW1"), + m_io_row2(*this, "ROW2"), + m_io_row3(*this, "ROW3"), + m_io_row4(*this, "ROW4"), + m_io_row5(*this, "ROW5"), + m_io_row6(*this, "ROW6"), + m_io_row7(*this, "ROW7"), + m_io_config(*this, "CONFIG"), + m_screen(*this, "screen") { } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + bitmap_ind16 m_bitmap; + + DECLARE_READ8_MEMBER(zx_ram_r); + DECLARE_READ8_MEMBER(zx80_io_r); + DECLARE_READ8_MEMBER(zx81_io_r); + DECLARE_READ8_MEMBER(pc8300_io_r); + DECLARE_READ8_MEMBER(pow3000_io_r); + DECLARE_WRITE8_MEMBER(zx80_io_w); + DECLARE_WRITE8_MEMBER(zx81_io_w); + emu_timer *m_ula_nmi; + int m_ula_irq_active; + int m_ula_frame_vsync; + int m_ula_scanline_count; + UINT8 m_tape_bit; + UINT8 m_speaker_state; + int m_old_x; + int m_old_y; + UINT8 m_old_c; + UINT8 m_charline[32]; + UINT8 m_charline_ptr; + int m_offs1; + void zx_ula_bkgnd(UINT8 color); + DECLARE_WRITE8_MEMBER(zx_ram_w); + DECLARE_DIRECT_UPDATE_MEMBER(zx_setdirect); + DECLARE_DIRECT_UPDATE_MEMBER(pc8300_setdirect); + DECLARE_DIRECT_UPDATE_MEMBER(pow3000_setdirect); + DECLARE_DRIVER_INIT(zx); + virtual void machine_reset(); + virtual void video_start(); + DECLARE_PALETTE_INIT(zx); + DECLARE_PALETTE_INIT(ts1000); + DECLARE_MACHINE_RESET(pc8300); + DECLARE_MACHINE_RESET(pow3000); + void screen_eof_zx(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(zx_tape_pulse); + TIMER_CALLBACK_MEMBER(zx_ula_nmi); + TIMER_CALLBACK_MEMBER(zx_ula_irq); + +protected: + required_device m_maincpu; + required_device m_ram; + required_device m_cassette; + required_device m_speaker; + required_memory_region m_region_maincpu; + optional_memory_region m_region_gfx1; + required_ioport m_io_row0; + required_ioport m_io_row1; + required_ioport m_io_row2; + required_ioport m_io_row3; + required_ioport m_io_row4; + required_ioport m_io_row5; + required_ioport m_io_row6; + required_ioport m_io_row7; + optional_ioport m_io_config; + required_device m_screen; + + void zx_ula_r(int offs, memory_region *region, const UINT8 param); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +}; + +#endif /* ZX_H_ */ diff --git a/src/mame/layout/4004clk.lay b/src/mame/layout/4004clk.lay new file mode 100644 index 00000000000..e3ec9522743 --- /dev/null +++ b/src/mame/layout/4004clk.lay @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/abc1600.lay b/src/mame/layout/abc1600.lay new file mode 100644 index 00000000000..36ece9eb926 --- /dev/null +++ b/src/mame/layout/abc1600.lay @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/mame/layout/acrnsys1.lay b/src/mame/layout/acrnsys1.lay new file mode 100644 index 00000000000..84afbd9321e --- /dev/null +++ b/src/mame/layout/acrnsys1.lay @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/aim65.lay b/src/mame/layout/aim65.lay new file mode 100644 index 00000000000..b250dc48b35 --- /dev/null +++ b/src/mame/layout/aim65.lay @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/aim65_40.lay b/src/mame/layout/aim65_40.lay new file mode 100644 index 00000000000..1d9aa5b0421 --- /dev/null +++ b/src/mame/layout/aim65_40.lay @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/amaztron.lay b/src/mame/layout/amaztron.lay new file mode 100644 index 00000000000..8b31f239489 --- /dev/null +++ b/src/mame/layout/amaztron.lay @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/amico2k.lay b/src/mame/layout/amico2k.lay new file mode 100644 index 00000000000..7151895247f --- /dev/null +++ b/src/mame/layout/amico2k.lay @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/amiga.lay b/src/mame/layout/amiga.lay new file mode 100644 index 00000000000..44428fa3392 --- /dev/null +++ b/src/mame/layout/amiga.lay @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/apollo.lay b/src/mame/layout/apollo.lay new file mode 100644 index 00000000000..06c90f31baf --- /dev/null +++ b/src/mame/layout/apollo.lay @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/apollo_15i.lay b/src/mame/layout/apollo_15i.lay new file mode 100644 index 00000000000..f42e8329954 --- /dev/null +++ b/src/mame/layout/apollo_15i.lay @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/apollo_dsp.lay b/src/mame/layout/apollo_dsp.lay new file mode 100644 index 00000000000..2ee7b0fced1 --- /dev/null +++ b/src/mame/layout/apollo_dsp.lay @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/apricotp.lay b/src/mame/layout/apricotp.lay new file mode 100644 index 00000000000..95af108219e --- /dev/null +++ b/src/mame/layout/apricotp.lay @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/astro.lay b/src/mame/layout/astro.lay new file mode 100644 index 00000000000..978e522d543 --- /dev/null +++ b/src/mame/layout/astro.lay @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/avigo.lay b/src/mame/layout/avigo.lay new file mode 100644 index 00000000000..6db8cfcfd27 --- /dev/null +++ b/src/mame/layout/avigo.lay @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/babbage.lay b/src/mame/layout/babbage.lay new file mode 100644 index 00000000000..b493268fd4a --- /dev/null +++ b/src/mame/layout/babbage.lay @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/bankshot.lay b/src/mame/layout/bankshot.lay new file mode 100644 index 00000000000..8ddcf5c085b --- /dev/null +++ b/src/mame/layout/bankshot.lay @@ -0,0 +1,251 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/bbc.lay b/src/mame/layout/bbc.lay new file mode 100644 index 00000000000..0d1e4479146 --- /dev/null +++ b/src/mame/layout/bbc.lay @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/beta.lay b/src/mame/layout/beta.lay new file mode 100644 index 00000000000..dc9af5cfbf8 --- /dev/null +++ b/src/mame/layout/beta.lay @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/bigtrak.lay b/src/mame/layout/bigtrak.lay new file mode 100644 index 00000000000..c74d1d04e82 --- /dev/null +++ b/src/mame/layout/bigtrak.lay @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/bitgrpha.lay b/src/mame/layout/bitgrpha.lay new file mode 100644 index 00000000000..fa3235d9489 --- /dev/null +++ b/src/mame/layout/bitgrpha.lay @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/mame/layout/bitgrphb.lay b/src/mame/layout/bitgrphb.lay new file mode 100644 index 00000000000..8def87c47da --- /dev/null +++ b/src/mame/layout/bitgrphb.lay @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/mame/layout/bob85.lay b/src/mame/layout/bob85.lay new file mode 100644 index 00000000000..28e8392eec5 --- /dev/null +++ b/src/mame/layout/bob85.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/borisdpl.lay b/src/mame/layout/borisdpl.lay new file mode 100644 index 00000000000..2ca7ceae315 --- /dev/null +++ b/src/mame/layout/borisdpl.lay @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/bridgec3.lay b/src/mame/layout/bridgec3.lay new file mode 100644 index 00000000000..3fbbe99deb3 --- /dev/null +++ b/src/mame/layout/bridgec3.lay @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/c80.lay b/src/mame/layout/c80.lay new file mode 100644 index 00000000000..d12f973dfe1 --- /dev/null +++ b/src/mame/layout/c80.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/cc40.lay b/src/mame/layout/cc40.lay new file mode 100644 index 00000000000..ea366ddc0c1 --- /dev/null +++ b/src/mame/layout/cc40.lay @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/chessmst.lay b/src/mame/layout/chessmst.lay new file mode 100644 index 00000000000..40a623faf32 --- /dev/null +++ b/src/mame/layout/chessmst.lay @@ -0,0 +1,351 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/chesstrv.lay b/src/mame/layout/chesstrv.lay new file mode 100644 index 00000000000..34e9509d990 --- /dev/null +++ b/src/mame/layout/chesstrv.lay @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/cnsector.lay b/src/mame/layout/cnsector.lay new file mode 100644 index 00000000000..5bd9aaa0d48 --- /dev/null +++ b/src/mame/layout/cnsector.lay @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/coco3.lay b/src/mame/layout/coco3.lay new file mode 100644 index 00000000000..bebd45729eb --- /dev/null +++ b/src/mame/layout/coco3.lay @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/mame/layout/comp4.lay b/src/mame/layout/comp4.lay new file mode 100644 index 00000000000..5cca5e96dd9 --- /dev/null +++ b/src/mame/layout/comp4.lay @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/cosmicos.lay b/src/mame/layout/cosmicos.lay new file mode 100644 index 00000000000..68bb3a05370 --- /dev/null +++ b/src/mame/layout/cosmicos.lay @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/cp1.lay b/src/mame/layout/cp1.lay new file mode 100644 index 00000000000..b5dbfbc1789 --- /dev/null +++ b/src/mame/layout/cp1.lay @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/cvicny.lay b/src/mame/layout/cvicny.lay new file mode 100644 index 00000000000..9e41a6d4300 --- /dev/null +++ b/src/mame/layout/cvicny.lay @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/dataman.lay b/src/mame/layout/dataman.lay new file mode 100644 index 00000000000..fcfae353f4c --- /dev/null +++ b/src/mame/layout/dataman.lay @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/digel804.lay b/src/mame/layout/digel804.lay new file mode 100644 index 00000000000..5e4f498b46a --- /dev/null +++ b/src/mame/layout/digel804.lay @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/dmv.lay b/src/mame/layout/dmv.lay new file mode 100644 index 00000000000..4d5753fcb8b --- /dev/null +++ b/src/mame/layout/dmv.lay @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/dolphunk.lay b/src/mame/layout/dolphunk.lay new file mode 100644 index 00000000000..aebc190f91c --- /dev/null +++ b/src/mame/layout/dolphunk.lay @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/eacc.lay b/src/mame/layout/eacc.lay new file mode 100644 index 00000000000..b65f22a056a --- /dev/null +++ b/src/mame/layout/eacc.lay @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ebaskb2.lay b/src/mame/layout/ebaskb2.lay new file mode 100644 index 00000000000..5a0a3d376f7 --- /dev/null +++ b/src/mame/layout/ebaskb2.lay @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ebball.lay b/src/mame/layout/ebball.lay new file mode 100644 index 00000000000..48bcb51853b --- /dev/null +++ b/src/mame/layout/ebball.lay @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ebball2.lay b/src/mame/layout/ebball2.lay new file mode 100644 index 00000000000..91d3427f5e3 --- /dev/null +++ b/src/mame/layout/ebball2.lay @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ebball3.lay b/src/mame/layout/ebball3.lay new file mode 100644 index 00000000000..3e6a5df9031 --- /dev/null +++ b/src/mame/layout/ebball3.lay @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/efball.lay b/src/mame/layout/efball.lay new file mode 100644 index 00000000000..f46120fae29 --- /dev/null +++ b/src/mame/layout/efball.lay @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/efootb4.lay b/src/mame/layout/efootb4.lay new file mode 100644 index 00000000000..71266b11448 --- /dev/null +++ b/src/mame/layout/efootb4.lay @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/einvader.lay b/src/mame/layout/einvader.lay new file mode 100644 index 00000000000..81021899dbf --- /dev/null +++ b/src/mame/layout/einvader.lay @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/einvaderc.lay b/src/mame/layout/einvaderc.lay new file mode 100644 index 00000000000..0916b783796 --- /dev/null +++ b/src/mame/layout/einvaderc.lay @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/elecbowl.lay b/src/mame/layout/elecbowl.lay new file mode 100644 index 00000000000..1aab1670364 --- /dev/null +++ b/src/mame/layout/elecbowl.lay @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/elecdet.lay b/src/mame/layout/elecdet.lay new file mode 100644 index 00000000000..3024763cbcf --- /dev/null +++ b/src/mame/layout/elecdet.lay @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/elekscmp.lay b/src/mame/layout/elekscmp.lay new file mode 100644 index 00000000000..edea5e4c461 --- /dev/null +++ b/src/mame/layout/elekscmp.lay @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/elf2.lay b/src/mame/layout/elf2.lay new file mode 100644 index 00000000000..935ea70cd4b --- /dev/null +++ b/src/mame/layout/elf2.lay @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/esq1by22.lay b/src/mame/layout/esq1by22.lay new file mode 100644 index 00000000000..8667054f8eb --- /dev/null +++ b/src/mame/layout/esq1by22.lay @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/esq2by40.lay b/src/mame/layout/esq2by40.lay new file mode 100644 index 00000000000..26bba421d9f --- /dev/null +++ b/src/mame/layout/esq2by40.lay @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/et3400.lay b/src/mame/layout/et3400.lay new file mode 100644 index 00000000000..aef0cbeedc0 --- /dev/null +++ b/src/mame/layout/et3400.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/fb01.lay b/src/mame/layout/fb01.lay new file mode 100644 index 00000000000..f88d5f6de8b --- /dev/null +++ b/src/mame/layout/fb01.lay @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/fccpu1.lay b/src/mame/layout/fccpu1.lay new file mode 100644 index 00000000000..0655960a266 --- /dev/null +++ b/src/mame/layout/fccpu1.lay @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/fidelz80.lay b/src/mame/layout/fidelz80.lay new file mode 100644 index 00000000000..c9e2907e5bc --- /dev/null +++ b/src/mame/layout/fidelz80.lay @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/funjacks.lay b/src/mame/layout/funjacks.lay new file mode 100644 index 00000000000..924c03af199 --- /dev/null +++ b/src/mame/layout/funjacks.lay @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/funrlgl.lay b/src/mame/layout/funrlgl.lay new file mode 100644 index 00000000000..7af9fb61ce8 --- /dev/null +++ b/src/mame/layout/funrlgl.lay @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/gamecom.lay b/src/mame/layout/gamecom.lay new file mode 100644 index 00000000000..6cb50665d75 --- /dev/null +++ b/src/mame/layout/gamecom.lay @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/gjackpot.lay b/src/mame/layout/gjackpot.lay new file mode 100644 index 00000000000..84d57fc9745 --- /dev/null +++ b/src/mame/layout/gjackpot.lay @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/gl3000s.lay b/src/mame/layout/gl3000s.lay new file mode 100644 index 00000000000..e97b1544f03 --- /dev/null +++ b/src/mame/layout/gl3000s.lay @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/glasgow.lay b/src/mame/layout/glasgow.lay new file mode 100644 index 00000000000..53dd35a623c --- /dev/null +++ b/src/mame/layout/glasgow.lay @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/gpoker.lay b/src/mame/layout/gpoker.lay new file mode 100644 index 00000000000..25578e687f2 --- /dev/null +++ b/src/mame/layout/gpoker.lay @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/h2hbaseb.lay b/src/mame/layout/h2hbaseb.lay new file mode 100644 index 00000000000..ed35017c1b9 --- /dev/null +++ b/src/mame/layout/h2hbaseb.lay @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/h2hfootb.lay b/src/mame/layout/h2hfootb.lay new file mode 100644 index 00000000000..1bf59a074c9 --- /dev/null +++ b/src/mame/layout/h2hfootb.lay @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/h8.lay b/src/mame/layout/h8.lay new file mode 100644 index 00000000000..deb28c7690b --- /dev/null +++ b/src/mame/layout/h8.lay @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/hh_hmcs40_test.lay b/src/mame/layout/hh_hmcs40_test.lay new file mode 100644 index 00000000000..0a7960cee0e --- /dev/null +++ b/src/mame/layout/hh_hmcs40_test.lay @@ -0,0 +1,684 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/hh_melps4_test.lay b/src/mame/layout/hh_melps4_test.lay new file mode 100644 index 00000000000..8471c1c4989 --- /dev/null +++ b/src/mame/layout/hh_melps4_test.lay @@ -0,0 +1,556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/hh_sm510_test.lay b/src/mame/layout/hh_sm510_test.lay new file mode 100644 index 00000000000..f960f795acc --- /dev/null +++ b/src/mame/layout/hh_sm510_test.lay @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/hh_tms1k_test.lay b/src/mame/layout/hh_tms1k_test.lay new file mode 100644 index 00000000000..691c91e1aa1 --- /dev/null +++ b/src/mame/layout/hh_tms1k_test.lay @@ -0,0 +1,556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/hh_ucom4_test.lay b/src/mame/layout/hh_ucom4_test.lay new file mode 100644 index 00000000000..597af18b4e0 --- /dev/null +++ b/src/mame/layout/hh_ucom4_test.lay @@ -0,0 +1,556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ie15.lay b/src/mame/layout/ie15.lay new file mode 100644 index 00000000000..bbb21cbed10 --- /dev/null +++ b/src/mame/layout/ie15.lay @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/instruct.lay b/src/mame/layout/instruct.lay new file mode 100644 index 00000000000..302697dec84 --- /dev/null +++ b/src/mame/layout/instruct.lay @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/junior.lay b/src/mame/layout/junior.lay new file mode 100644 index 00000000000..65cbe26b5ff --- /dev/null +++ b/src/mame/layout/junior.lay @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/k1003.lay b/src/mame/layout/k1003.lay new file mode 100644 index 00000000000..ea96db032d8 --- /dev/null +++ b/src/mame/layout/k1003.lay @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/kim1.lay b/src/mame/layout/kim1.lay new file mode 100644 index 00000000000..65cbe26b5ff --- /dev/null +++ b/src/mame/layout/kim1.lay @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/lantutor.lay b/src/mame/layout/lantutor.lay new file mode 100644 index 00000000000..bfdf2189350 --- /dev/null +++ b/src/mame/layout/lantutor.lay @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/lc80.lay b/src/mame/layout/lc80.lay new file mode 100644 index 00000000000..bd07614e28d --- /dev/null +++ b/src/mame/layout/lc80.lay @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/lightfgt.lay b/src/mame/layout/lightfgt.lay new file mode 100644 index 00000000000..96a327b176e --- /dev/null +++ b/src/mame/layout/lightfgt.lay @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/llc1.lay b/src/mame/layout/llc1.lay new file mode 100644 index 00000000000..3bd3a42669b --- /dev/null +++ b/src/mame/layout/llc1.lay @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/lynx.lay b/src/mame/layout/lynx.lay new file mode 100644 index 00000000000..b5e76dc6ec2 --- /dev/null +++ b/src/mame/layout/lynx.lay @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mac.lay b/src/mame/layout/mac.lay new file mode 100644 index 00000000000..cbefc6620ee --- /dev/null +++ b/src/mame/layout/mac.lay @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/mame/layout/maniac.lay b/src/mame/layout/maniac.lay new file mode 100644 index 00000000000..a0376cfca75 --- /dev/null +++ b/src/mame/layout/maniac.lay @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mathmagi.lay b/src/mame/layout/mathmagi.lay new file mode 100644 index 00000000000..eb4e745c77b --- /dev/null +++ b/src/mame/layout/mathmagi.lay @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mbdtower.lay b/src/mame/layout/mbdtower.lay new file mode 100644 index 00000000000..7dc9b1b61e7 --- /dev/null +++ b/src/mame/layout/mbdtower.lay @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/megacd.lay b/src/mame/layout/megacd.lay new file mode 100644 index 00000000000..5a787335b34 --- /dev/null +++ b/src/mame/layout/megacd.lay @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/mekd2.lay b/src/mame/layout/mekd2.lay new file mode 100644 index 00000000000..2806b919e7b --- /dev/null +++ b/src/mame/layout/mekd2.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mephisto.lay b/src/mame/layout/mephisto.lay new file mode 100644 index 00000000000..ec5cf8c480a --- /dev/null +++ b/src/mame/layout/mephisto.lay @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/merlin.lay b/src/mame/layout/merlin.lay new file mode 100644 index 00000000000..32d5691e253 --- /dev/null +++ b/src/mame/layout/merlin.lay @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/minicom.lay b/src/mame/layout/minicom.lay new file mode 100644 index 00000000000..7c429bdeac1 --- /dev/null +++ b/src/mame/layout/minicom.lay @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mirage.lay b/src/mame/layout/mirage.lay new file mode 100644 index 00000000000..58d6102dee0 --- /dev/null +++ b/src/mame/layout/mirage.lay @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mk1.lay b/src/mame/layout/mk1.lay new file mode 100644 index 00000000000..532bd44a27b --- /dev/null +++ b/src/mame/layout/mk1.lay @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mk14.lay b/src/mame/layout/mk14.lay new file mode 100644 index 00000000000..edea5e4c461 --- /dev/null +++ b/src/mame/layout/mk14.lay @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mk2.lay b/src/mame/layout/mk2.lay new file mode 100644 index 00000000000..cf5b3fd7878 --- /dev/null +++ b/src/mame/layout/mk2.lay @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mkit09.lay b/src/mame/layout/mkit09.lay new file mode 100644 index 00000000000..47e6c0f6194 --- /dev/null +++ b/src/mame/layout/mkit09.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mmd1.lay b/src/mame/layout/mmd1.lay new file mode 100644 index 00000000000..5479074ee90 --- /dev/null +++ b/src/mame/layout/mmd1.lay @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/mmd2.lay b/src/mame/layout/mmd2.lay new file mode 100644 index 00000000000..e108623f704 --- /dev/null +++ b/src/mame/layout/mmd2.lay @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/mmerlin.lay b/src/mame/layout/mmerlin.lay new file mode 100644 index 00000000000..4538a482149 --- /dev/null +++ b/src/mame/layout/mmerlin.lay @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mpf1.lay b/src/mame/layout/mpf1.lay new file mode 100644 index 00000000000..22b0a8b42cb --- /dev/null +++ b/src/mame/layout/mpf1.lay @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mpf1b.lay b/src/mame/layout/mpf1b.lay new file mode 100644 index 00000000000..22b0a8b42cb --- /dev/null +++ b/src/mame/layout/mpf1b.lay @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mpf1p.lay b/src/mame/layout/mpf1p.lay new file mode 100644 index 00000000000..f697b7207f2 --- /dev/null +++ b/src/mame/layout/mpf1p.lay @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mvbfree.lay b/src/mame/layout/mvbfree.lay new file mode 100644 index 00000000000..29598b63efc --- /dev/null +++ b/src/mame/layout/mvbfree.lay @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/newbrain.lay b/src/mame/layout/newbrain.lay new file mode 100644 index 00000000000..09df5730d76 --- /dev/null +++ b/src/mame/layout/newbrain.lay @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/pairmtch.lay b/src/mame/layout/pairmtch.lay new file mode 100644 index 00000000000..81282cbe448 --- /dev/null +++ b/src/mame/layout/pairmtch.lay @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/pc1500.lay b/src/mame/layout/pc1500.lay new file mode 100644 index 00000000000..91d49eb7867 --- /dev/null +++ b/src/mame/layout/pc1500.lay @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/pc8500.lay b/src/mame/layout/pc8500.lay new file mode 100644 index 00000000000..67c7527e3b7 --- /dev/null +++ b/src/mame/layout/pc8500.lay @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/mame/layout/pcw.lay b/src/mame/layout/pcw.lay new file mode 100644 index 00000000000..a7d580b4d55 --- /dev/null +++ b/src/mame/layout/pcw.lay @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/pmi80.lay b/src/mame/layout/pmi80.lay new file mode 100644 index 00000000000..5767c3d1918 --- /dev/null +++ b/src/mame/layout/pmi80.lay @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/poly880.lay b/src/mame/layout/poly880.lay new file mode 100644 index 00000000000..fb90513ec1d --- /dev/null +++ b/src/mame/layout/poly880.lay @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/pro80.lay b/src/mame/layout/pro80.lay new file mode 100644 index 00000000000..46ae2019bfa --- /dev/null +++ b/src/mame/layout/pro80.lay @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/pve500.lay b/src/mame/layout/pve500.lay new file mode 100644 index 00000000000..e7c9fbef38b --- /dev/null +++ b/src/mame/layout/pve500.lay @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/px4.lay b/src/mame/layout/px4.lay new file mode 100644 index 00000000000..3f4f3324e24 --- /dev/null +++ b/src/mame/layout/px4.lay @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/px8.lay b/src/mame/layout/px8.lay new file mode 100644 index 00000000000..e3d7df9ac9e --- /dev/null +++ b/src/mame/layout/px8.lay @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/rainbow.lay b/src/mame/layout/rainbow.lay new file mode 100644 index 00000000000..bb72bbf21ec --- /dev/null +++ b/src/mame/layout/rainbow.lay @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ravens.lay b/src/mame/layout/ravens.lay new file mode 100644 index 00000000000..e57c5e8ea41 --- /dev/null +++ b/src/mame/layout/ravens.lay @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/savia84.lay b/src/mame/layout/savia84.lay new file mode 100644 index 00000000000..baf6a6ab2b7 --- /dev/null +++ b/src/mame/layout/savia84.lay @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sc1.lay b/src/mame/layout/sc1.lay new file mode 100644 index 00000000000..c6ed82b9123 --- /dev/null +++ b/src/mame/layout/sc1.lay @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sc2.lay b/src/mame/layout/sc2.lay new file mode 100644 index 00000000000..c68cee7e136 --- /dev/null +++ b/src/mame/layout/sc2.lay @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sdk85.lay b/src/mame/layout/sdk85.lay new file mode 100644 index 00000000000..5822262a995 --- /dev/null +++ b/src/mame/layout/sdk85.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sdk86.lay b/src/mame/layout/sdk86.lay new file mode 100644 index 00000000000..9f77b7200be --- /dev/null +++ b/src/mame/layout/sdk86.lay @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/selz80.lay b/src/mame/layout/selz80.lay new file mode 100644 index 00000000000..1284aaa84a0 --- /dev/null +++ b/src/mame/layout/selz80.lay @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/simon.lay b/src/mame/layout/simon.lay new file mode 100644 index 00000000000..2cb94ad8c01 --- /dev/null +++ b/src/mame/layout/simon.lay @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sitcom.lay b/src/mame/layout/sitcom.lay new file mode 100644 index 00000000000..fce04d7716e --- /dev/null +++ b/src/mame/layout/sitcom.lay @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/slc1.lay b/src/mame/layout/slc1.lay new file mode 100644 index 00000000000..92d032c4a80 --- /dev/null +++ b/src/mame/layout/slc1.lay @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sms1.lay b/src/mame/layout/sms1.lay new file mode 100644 index 00000000000..3275da610d6 --- /dev/null +++ b/src/mame/layout/sms1.lay @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/snmath.lay b/src/mame/layout/snmath.lay new file mode 100644 index 00000000000..ca1eb371aea --- /dev/null +++ b/src/mame/layout/snmath.lay @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/snspell.lay b/src/mame/layout/snspell.lay new file mode 100644 index 00000000000..e84c2e9fdfb --- /dev/null +++ b/src/mame/layout/snspell.lay @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/splitsec.lay b/src/mame/layout/splitsec.lay new file mode 100644 index 00000000000..80bc61a60ab --- /dev/null +++ b/src/mame/layout/splitsec.lay @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sr16.lay b/src/mame/layout/sr16.lay new file mode 100644 index 00000000000..8488e83ee3f --- /dev/null +++ b/src/mame/layout/sr16.lay @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ssimon.lay b/src/mame/layout/ssimon.lay new file mode 100644 index 00000000000..38540fbfaf4 --- /dev/null +++ b/src/mame/layout/ssimon.lay @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/starwbc.lay b/src/mame/layout/starwbc.lay new file mode 100644 index 00000000000..6469cb7dc9a --- /dev/null +++ b/src/mame/layout/starwbc.lay @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/stopthie.lay b/src/mame/layout/stopthie.lay new file mode 100644 index 00000000000..8efd28b6f8d --- /dev/null +++ b/src/mame/layout/stopthie.lay @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/super80.lay b/src/mame/layout/super80.lay new file mode 100644 index 00000000000..30bae4a87a2 --- /dev/null +++ b/src/mame/layout/super80.lay @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/svision.lay b/src/mame/layout/svision.lay new file mode 100644 index 00000000000..1b82689e655 --- /dev/null +++ b/src/mame/layout/svision.lay @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/svmu.lay b/src/mame/layout/svmu.lay new file mode 100644 index 00000000000..f4419de1b90 --- /dev/null +++ b/src/mame/layout/svmu.lay @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/sym1.lay b/src/mame/layout/sym1.lay new file mode 100644 index 00000000000..ad90e2a3ec5 --- /dev/null +++ b/src/mame/layout/sym1.lay @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tactix.lay b/src/mame/layout/tactix.lay new file mode 100644 index 00000000000..63afeac12a4 --- /dev/null +++ b/src/mame/layout/tactix.lay @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tama.lay b/src/mame/layout/tama.lay new file mode 100644 index 00000000000..e4a8c62aaab --- /dev/null +++ b/src/mame/layout/tama.lay @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tandy12.lay b/src/mame/layout/tandy12.lay new file mode 100644 index 00000000000..edb6fcb2f27 --- /dev/null +++ b/src/mame/layout/tandy12.lay @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tavernie.lay b/src/mame/layout/tavernie.lay new file mode 100644 index 00000000000..a3f1c440f26 --- /dev/null +++ b/src/mame/layout/tavernie.lay @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/mame/layout/tb303.lay b/src/mame/layout/tb303.lay new file mode 100644 index 00000000000..b68f4684da9 --- /dev/null +++ b/src/mame/layout/tb303.lay @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tbreakup.lay b/src/mame/layout/tbreakup.lay new file mode 100644 index 00000000000..f203a23fee9 --- /dev/null +++ b/src/mame/layout/tbreakup.lay @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tc4.lay b/src/mame/layout/tc4.lay new file mode 100644 index 00000000000..c0247704a83 --- /dev/null +++ b/src/mame/layout/tc4.lay @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tec1.lay b/src/mame/layout/tec1.lay new file mode 100644 index 00000000000..2806b919e7b --- /dev/null +++ b/src/mame/layout/tec1.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tecnbras.lay b/src/mame/layout/tecnbras.lay new file mode 100644 index 00000000000..bface68de71 --- /dev/null +++ b/src/mame/layout/tecnbras.lay @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ti1270.lay b/src/mame/layout/ti1270.lay new file mode 100644 index 00000000000..5c411ba99d8 --- /dev/null +++ b/src/mame/layout/ti1270.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ti30.lay b/src/mame/layout/ti30.lay new file mode 100644 index 00000000000..d106c98135c --- /dev/null +++ b/src/mame/layout/ti30.lay @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ti74.lay b/src/mame/layout/ti74.lay new file mode 100644 index 00000000000..16d6c1f55a0 --- /dev/null +++ b/src/mame/layout/ti74.lay @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ti95.lay b/src/mame/layout/ti95.lay new file mode 100644 index 00000000000..6ee4cd6db55 --- /dev/null +++ b/src/mame/layout/ti95.lay @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tisr16.lay b/src/mame/layout/tisr16.lay new file mode 100644 index 00000000000..90e582f832c --- /dev/null +++ b/src/mame/layout/tisr16.lay @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tk80.lay b/src/mame/layout/tk80.lay new file mode 100644 index 00000000000..f0ee0850a4e --- /dev/null +++ b/src/mame/layout/tk80.lay @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tm990189.lay b/src/mame/layout/tm990189.lay new file mode 100644 index 00000000000..52cdbb6427a --- /dev/null +++ b/src/mame/layout/tm990189.lay @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tm990189v.lay b/src/mame/layout/tm990189v.lay new file mode 100644 index 00000000000..5e39104fc46 --- /dev/null +++ b/src/mame/layout/tm990189v.lay @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/tntell.lay b/src/mame/layout/tntell.lay new file mode 100644 index 00000000000..629a79643c2 --- /dev/null +++ b/src/mame/layout/tntell.lay @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/unixpc.lay b/src/mame/layout/unixpc.lay new file mode 100644 index 00000000000..be594ed0637 --- /dev/null +++ b/src/mame/layout/unixpc.lay @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/ut88mini.lay b/src/mame/layout/ut88mini.lay new file mode 100644 index 00000000000..2058d885cf1 --- /dev/null +++ b/src/mame/layout/ut88mini.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/vboy.lay b/src/mame/layout/vboy.lay new file mode 100644 index 00000000000..c6f99f16113 --- /dev/null +++ b/src/mame/layout/vboy.lay @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/vcs80.lay b/src/mame/layout/vcs80.lay new file mode 100644 index 00000000000..d12f973dfe1 --- /dev/null +++ b/src/mame/layout/vcs80.lay @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/vidbrain.lay b/src/mame/layout/vidbrain.lay new file mode 100644 index 00000000000..ff7b440c31b --- /dev/null +++ b/src/mame/layout/vidbrain.lay @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/mame/layout/vk100.lay b/src/mame/layout/vk100.lay new file mode 100644 index 00000000000..3dedf312b6f --- /dev/null +++ b/src/mame/layout/vk100.lay @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/votrpss.lay b/src/mame/layout/votrpss.lay new file mode 100644 index 00000000000..3e4073e1e51 --- /dev/null +++ b/src/mame/layout/votrpss.lay @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/votrtnt.lay b/src/mame/layout/votrtnt.lay new file mode 100644 index 00000000000..3e4073e1e51 --- /dev/null +++ b/src/mame/layout/votrtnt.lay @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/vsc.lay b/src/mame/layout/vsc.lay new file mode 100644 index 00000000000..fdd03423e5b --- /dev/null +++ b/src/mame/layout/vsc.lay @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/vt100.lay b/src/mame/layout/vt100.lay new file mode 100644 index 00000000000..72ac0622aa2 --- /dev/null +++ b/src/mame/layout/vt100.lay @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/wicat.lay b/src/mame/layout/wicat.lay new file mode 100644 index 00000000000..10cf24c71e6 --- /dev/null +++ b/src/mame/layout/wicat.lay @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/wildfire.lay b/src/mame/layout/wildfire.lay new file mode 100644 index 00000000000..c2c5ef210be --- /dev/null +++ b/src/mame/layout/wildfire.lay @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/wizatron.lay b/src/mame/layout/wizatron.lay new file mode 100644 index 00000000000..8e5550757e9 --- /dev/null +++ b/src/mame/layout/wizatron.lay @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/wswan.lay b/src/mame/layout/wswan.lay new file mode 100644 index 00000000000..1247dbe200f --- /dev/null +++ b/src/mame/layout/wswan.lay @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/mame/layout/x68000.lay b/src/mame/layout/x68000.lay new file mode 100644 index 00000000000..7d399dcfe46 --- /dev/null +++ b/src/mame/layout/x68000.lay @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/layout/z80dev.lay b/src/mame/layout/z80dev.lay new file mode 100644 index 00000000000..46ae2019bfa --- /dev/null +++ b/src/mame/layout/z80dev.lay @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/z80ne.lay b/src/mame/layout/z80ne.lay new file mode 100644 index 00000000000..6485f490345 --- /dev/null +++ b/src/mame/layout/z80ne.lay @@ -0,0 +1,650 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/z80net.lay b/src/mame/layout/z80net.lay new file mode 100644 index 00000000000..3229af18adf --- /dev/null +++ b/src/mame/layout/z80net.lay @@ -0,0 +1,669 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/z80netb.lay b/src/mame/layout/z80netb.lay new file mode 100644 index 00000000000..ef14bec4198 --- /dev/null +++ b/src/mame/layout/z80netb.lay @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/z80netf.lay b/src/mame/layout/z80netf.lay new file mode 100644 index 00000000000..d86921ea3ba --- /dev/null +++ b/src/mame/layout/z80netf.lay @@ -0,0 +1,709 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/zapcomputer.lay b/src/mame/layout/zapcomputer.lay new file mode 100644 index 00000000000..a07d3e015f9 --- /dev/null +++ b/src/mame/layout/zapcomputer.lay @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/machine/6883sam.c b/src/mame/machine/6883sam.c new file mode 100644 index 00000000000..cb5d0685fba --- /dev/null +++ b/src/mame/machine/6883sam.c @@ -0,0 +1,557 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + 6883sam.c + + Motorola 6883 Synchronous Address Multiplexer + + The Motorola 6883 SAM has 16 bits worth of state, but the state is changed + by writing into a 32 byte address space; odd bytes set bits and even bytes + clear bits. Here is the layout: + + 31 Set TY Map Type 0: RAM/ROM 1: All RAM + 30 Clear TY Map Type + 29 Set M1 Memory Size 00: 4K 10: 64K Dynamic + 28 Clear M1 Memory Size 01: 16K 11: 64K Static + 27 Set M0 Memory Size + 26 Clear M0 Memory Size + 25 Set R1 MPU Rate 00: Slow 10: Fast + 24 Clear R1 MPU Rate 01: Dual 11: Fast + 23 Set R0 MPU Rate + 22 Clear R0 MPU Rate + 21 Set P1 Page #1 0: Low 1: High + 20 Clear P1 Page #1 + 19 Set F6 Display Offset + 18 Clear F6 Display Offset + 17 Set F5 Display Offset + 16 Clear F5 Display Offset + 15 Set F4 Display Offset + 14 Clear F4 Display Offset + 13 Set F3 Display Offset + 12 Clear F3 Display Offset + 11 Set F2 Display Offset + 10 Clear F2 Display Offset + 9 Set F1 Display Offset + 8 Clear F1 Display Offset + 7 Set F0 Display Offset + 6 Clear F0 Display Offset + 5 Set V2 VDG Mode + 4 Clear V2 VDG Mode + 3 Set V1 VDG Mode + 2 Clear V1 VDG Mode + 1 Set V0 VDG Mode + 0 Clear V0 VDG Mode + + All parts of the SAM are fully emulated except R1/R0 (the changes in the + MPU rate are approximated) and M1/M0 + +***************************************************************************/ + + +#include "machine/6883sam.h" + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define LOG_SAM 0 + +const device_type SAM6883 = &device_creator; + + + +//************************************************************************** +// DEVICE SETUP +//************************************************************************** + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SAM6883, "SAM6883", tag, owner, clock, "sam6883", __FILE__), + m_cpu_tag(NULL), + m_cpu_space_ref(AS_PROGRAM), + m_read_res(*this), + m_space_0000(*this), + m_space_8000(*this), + m_space_A000(*this), + m_space_C000(*this), + m_space_FF00(*this), + m_space_FF20(*this), + m_space_FF40(*this), + m_space_FF60(*this), + m_space_FFE0(*this) +{ + memset(m_banks, '\0', sizeof(m_banks)); +} + + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sam6883_device::device_start() +{ + // find the CPU + m_cpu = machine().device(m_cpu_tag); + m_cpu_space = &m_cpu->space(m_cpu_space_ref); + + // resolve callbacks + m_read_res.resolve_safe(0); + + // install SAM handlers + m_cpu_space->install_read_handler(0xFFC0, 0xFFDF, 0, 0, read8_delegate(FUNC(sam6883_device::read), this)); + m_cpu_space->install_write_handler(0xFFC0, 0xFFDF, 0, 0, write8_delegate(FUNC(sam6883_device::write), this)); + + // save state support + save_item(NAME(m_sam_state)); + save_item(NAME(m_counter)); + save_item(NAME(m_counter_xdiv)); + save_item(NAME(m_counter_ydiv)); +} + + + +//------------------------------------------------- +// configure_bank - bank configuration +//------------------------------------------------- + +void sam6883_device::configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only) +{ + configure_bank(bank, memory, memory_size, is_read_only, read8_delegate(), write8_delegate()); +} + + + +//------------------------------------------------- +// configure_bank - bank configuration +//------------------------------------------------- + +void sam6883_device::configure_bank(int bank, read8_delegate rhandler, write8_delegate whandler) +{ + configure_bank(bank, NULL, 0, false, rhandler, whandler); +} + + + +//------------------------------------------------- +// configure_bank - bank configuration +//------------------------------------------------- + +void sam6883_device::configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only, read8_delegate rhandler, write8_delegate whandler) +{ + assert((bank >= 0) && (bank < ARRAY_LENGTH(m_banks))); + m_banks[bank].m_memory = memory; + m_banks[bank].m_memory_size = memory_size; + m_banks[bank].m_memory_read_only = is_read_only; + m_banks[bank].m_rhandler = rhandler; + m_banks[bank].m_whandler = whandler; + + /* if we're configuring a bank that never changes, update it now */ + switch(bank) + { + case 4: + m_space_FF00.point(&m_banks[4], 0x0000, 0); + break; + case 5: + m_space_FF20.point(&m_banks[5], 0x0000, 0); + break; + case 6: + m_space_FF40.point(&m_banks[6], 0x0000, 0); + break; + case 7: + m_space_FF60.point(&m_banks[7], 0x0000, 0); + break; + case 2: + m_space_FFE0.point(&m_banks[2], 0x1FE0, 0); + break; + } +} + + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void sam6883_device::device_reset() +{ + m_counter = 0; + m_counter_xdiv = 0; + m_counter_ydiv = 0; + m_sam_state = 0x0000; + update_state(); +} + + + +//------------------------------------------------- +// device_post_load - device-specific post load +//------------------------------------------------- + +void sam6883_device::device_post_load() +{ + device_t::device_post_load(); + update_state(); +} + + + +//------------------------------------------------- +// update_state +//------------------------------------------------- + +void sam6883_device::update_state(void) +{ + update_memory(); + update_cpu_clock(); +} + + + +//------------------------------------------------- +// update_memory +//------------------------------------------------- + +void sam6883_device::update_memory(void) +{ + // Memory size - allowed restricting memory accesses to something less than + // 32k + // + // This was a SAM switch that occupied 4 addresses: + // + // $FFDD (set) R1 + // $FFDC (clear) R1 + // $FFDB (set) R0 + // $FFDA (clear) R0 + // + // R1:R0 formed the following states: + // 00 - 4k + // 01 - 16k + // 10 - 64k + // 11 - static RAM (??) + // + // If something less than 64k was set, the low RAM would be smaller and + // mirror the other parts of the RAM + // + // TODO: Find out what "static RAM" is + // TODO: This should affect _all_ memory accesses, not just video ram + // TODO: Verify that the CoCo 3 ignored this + + // for now, lets assume that the caller is nice and made m_memory_size + // a power of two + UINT16 ram_mask = (UINT16) m_banks[0].m_memory_size - 1; + + // switch depending on the M1/M0 variables + bool setup_rom = true; + switch(m_sam_state & (SAM_STATE_M1|SAM_STATE_M0)) + { + case 0: + // 4K mode + m_space_0000.point(&m_banks[0], 0x0000, ram_mask); + m_counter_mask = 0x0FFF; + m_counter_or = 0x0000; + break; + + case SAM_STATE_M0: + // 16K mode + m_space_0000.point(&m_banks[0], 0x0000, ram_mask); + m_counter_mask = 0x3FFF; + m_counter_or = 0x0000; + break; + + case SAM_STATE_M1: + case SAM_STATE_M1|SAM_STATE_M0: + // 64k mode + if (m_sam_state & SAM_STATE_TY) + { + // full 64k RAM + m_space_0000.point(&m_banks[0], 0x0000, ram_mask); + m_space_8000.point(&m_banks[0], 0x8000, 0); + m_space_A000.point(&m_banks[0], 0xA000, 0); + m_space_C000.point(&m_banks[0], 0xC000, 0); + m_counter_mask = 0xFFFF; + m_counter_or = 0x0000; + setup_rom = false; + } + else + { + // ROM/RAM + UINT16 ram_base = (m_sam_state & SAM_STATE_P1) ? 0x8000 : 0x0000; + m_space_0000.point(&m_banks[0], ram_base, ram_mask); + m_counter_mask = 0x7FFF; + m_counter_or = ram_base; + } + break; + } + + if (setup_rom) + { + m_space_8000.point(&m_banks[1], m_banks[1].m_memory_offset, 0); + m_space_A000.point(&m_banks[2], m_banks[2].m_memory_offset, 0); + m_space_C000.point(&m_banks[3], m_banks[3].m_memory_offset, 0); + } + + // update $FFE0-$FFFF + m_space_FFE0.point(&m_banks[2], m_banks[2].m_memory_offset + 0x1FE0, 0); +} + + + +//------------------------------------------------- +// update_cpu_clock - adjusts the speed of the CPU +// clock +//------------------------------------------------- + +void sam6883_friend_device::update_cpu_clock(void) +{ + // The infamous speed up poke. + // + // This was a SAM switch that occupied 4 addresses: + // + // $FFD9 (set) R1 + // $FFD8 (clear) R1 + // $FFD7 (set) R0 + // $FFD6 (clear) R0 + // + // R1:R0 formed the following states: + // 00 - slow 0.89 MHz + // 01 - dual speed ??? + // 1x - fast 1.78 MHz + // + // R1 controlled whether the video addressing was speeded up and R0 + // did the same for the CPU. On pre-CoCo 3 machines, setting R1 caused + // the screen to display garbage because the M6847 could not display + // fast enough. + // + // TODO: Make the overclock more accurate. In dual speed, ROM was a fast + // access but RAM was not. I don't know how to simulate this. + + int speed = (m_sam_state & (SAM_STATE_R1|SAM_STATE_R0)) / SAM_STATE_R0; + + // the line below is weird because we are not strictly emulating the M6809E with emphasis on the 'E' + m_cpu->set_clock_scale(speed ? 2 : 1); +} + + + +//------------------------------------------------- +// set_bank_offset +//------------------------------------------------- + +void sam6883_device::set_bank_offset(int bank, offs_t offset) +{ + if (m_banks[bank].m_memory_offset != offset) + { + m_banks[bank].m_memory_offset = offset; + update_memory(); + } +} + + + +//------------------------------------------------- +// read +//------------------------------------------------- + +READ8_MEMBER( sam6883_device::read ) +{ + return 0; +} + + + +//------------------------------------------------- +// write +//------------------------------------------------- + +WRITE8_MEMBER( sam6883_device::write ) +{ + /* alter the SAM state */ + UINT16 xorval = alter_sam_state(offset); + + /* based on the mask, apply effects */ + if (xorval & (SAM_STATE_TY|SAM_STATE_M1|SAM_STATE_M0|SAM_STATE_P1)) + update_memory(); + if (xorval & (SAM_STATE_R1|SAM_STATE_R0)) + update_cpu_clock(); +} + + + +//------------------------------------------------- +// horizontal_sync +//------------------------------------------------- + +void sam6883_device::horizontal_sync(void) +{ + bool carry; + + // When horizontal sync occurs, bits B1-B3 or B1-B4 may be cleared (except in DMA mode). The catch + // is that the SAM's counter is a chain of flip-flops. Clearing the counter can cause carries to + // occur just as they can when the counter is bumped. + // + // This is critical in getting certain semigraphics modes to work correctly. Guardian uses this + // mode (see bug #1153). Special thanks to Ciaran Anscomb and Phill Harvey-Smith for figuring this + // out + switch((m_sam_state & (SAM_STATE_V2|SAM_STATE_V1|SAM_STATE_V0)) / SAM_STATE_V0) + { + case 0x01: + case 0x03: + case 0x05: + /* these SAM modes clear bits B1-B3 */ + carry = (m_counter & 0x0008) ? true : false; + m_counter &= ~0x000F; + if (carry) + counter_carry_bit3(); + break; + + case 0x00: + case 0x02: + case 0x04: + case 0x06: + /* clear bits B1-B4 */ + carry = (m_counter & 0x0010) ? true : false; + m_counter &= ~0x001F; + if (carry) + counter_carry_bit4(); + break; + + case 0x07: + /* DMA mode - do nothing */ + break; + + default: + fatalerror("Should not get here\n"); + } +} + + + +//------------------------------------------------- +// hs_w +//------------------------------------------------- + +WRITE_LINE_MEMBER( sam6883_device::hs_w ) +{ + if (state) + { + horizontal_sync(); + } +} + + + +//------------------------------------------------- +// sam_space::ctor +//------------------------------------------------- + +template +sam6883_device::sam_space<_addrstart, _addrend>::sam_space(sam6883_device &owner) + : m_owner(owner) +{ + m_read_bank = NULL; + m_write_bank = NULL; + m_mask = 0; +} + + + +//------------------------------------------------- +// sam_space::cpu_space +//------------------------------------------------- + +template +address_space &sam6883_device::sam_space<_addrstart, _addrend>::cpu_space() const +{ + assert(m_owner.m_cpu_space != NULL); + return *m_owner.m_cpu_space; +} + + + +//------------------------------------------------- +// sam_space::point +//------------------------------------------------- + +template +void sam6883_device::sam_space<_addrstart, _addrend>::point(const sam_bank *bank, UINT16 offset, UINT16 mask) +{ + if (LOG_SAM) + { + logerror("sam6883_device::sam_space::point(): addrstart=0x%04X addrend=0x%04X offset=0x%04X mask=0x%04X bank->m_memory=0x%p bank->m_memory_read_only=%s\n", + (unsigned) _addrstart, + (unsigned) _addrend, + (unsigned) offset, + (unsigned) mask, + bank->m_memory, + bank->m_memory_read_only ? "true" : "false"); + } + + point_specific_bank(bank, offset, mask, m_read_bank, _addrstart, _addrend, false); + point_specific_bank(bank, offset, mask, m_write_bank, _addrstart, _addrend, true); +} + + + +//------------------------------------------------- +// sam_space::point_specific_bank +//------------------------------------------------- +template +void sam6883_device::sam_space<_addrstart, _addrend>::point_specific_bank(const sam_bank *bank, UINT16 offset, UINT16 mask, memory_bank *&memory_bank, INT32 addrstart, INT32 addrend, bool is_write) +{ + char buffer[16]; + + if (bank->m_memory != NULL) + { + // normalize offset + if (mask != 0) + offset &= mask; + + // this bank is a memory bank - first ensure that we have a bank + if (!memory_bank || !memory_bank->matches_exactly(addrstart, addrend) || (mask != m_mask)) + { + // name the bank + snprintf(buffer, ARRAY_LENGTH(buffer), "bank%04X_%c", addrstart, is_write ? 'w' : 'r'); + + // install it + if (is_write) + cpu_space().install_write_bank(addrstart, addrend, mask, 0, buffer); + else + cpu_space().install_read_bank(addrstart, addrend, mask, 0, buffer); + m_mask = mask; + + // and get it + memory_bank = cpu_space().device().owner()->membank(buffer); + } + + // point the bank + if (memory_bank != NULL) + { + if (is_write && bank->m_memory_read_only) + memory_bank->set_base(m_owner.m_dummy); + else + memory_bank->set_base(bank->m_memory + offset); + } + } + else + { + // this bank uses handlers + assert((offset == 0) && (mask == 0)); // changes to the offset are not supported + + if (is_write) + { + if (!bank->m_whandler.isnull()) + cpu_space().install_write_handler(addrstart, addrend, 0, 0, bank->m_whandler); + } + else + { + if (!bank->m_rhandler.isnull()) + cpu_space().install_read_handler(addrstart, addrend, 0, 0, bank->m_rhandler); + } + } +} diff --git a/src/mame/machine/6883sam.h b/src/mame/machine/6883sam.h new file mode 100644 index 00000000000..772fe38d63f --- /dev/null +++ b/src/mame/machine/6883sam.h @@ -0,0 +1,266 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + 6883sam.h + + Motorola 6883 Synchronous Address Multiplexer + +***************************************************************************/ + +#pragma once + +#ifndef __6883SAM__ +#define __6883SAM__ + +#include "emu.h" + +#define MCFG_SAM6883_ADD(_tag, _clock, _cputag, _cpuspace) \ + MCFG_DEVICE_ADD(_tag, SAM6883, _clock) \ + sam6883_device::configure_cpu(*device, _cputag, _cpuspace); + +#define MCFG_SAM6883_RES_CALLBACK(_read) \ + devcb = &sam6883_device::set_res_rd_callback(*device, DEVCB_##_read); + + +//************************************************************************** +// SAM6883 CORE +//************************************************************************** + +// base class so that GIME emulation can use some functionality +class sam6883_friend_device +{ +public: + sam6883_friend_device() { m_cpu = NULL; m_sam_state = 0x0000; } + +protected: + // SAM state constants + static const UINT16 SAM_STATE_TY = 0x8000; + static const UINT16 SAM_STATE_M1 = 0x4000; + static const UINT16 SAM_STATE_M0 = 0x2000; + static const UINT16 SAM_STATE_R1 = 0x1000; + static const UINT16 SAM_STATE_R0 = 0x0800; + static const UINT16 SAM_STATE_P1 = 0x0400; + static const UINT16 SAM_STATE_F6 = 0x0200; + static const UINT16 SAM_STATE_F5 = 0x0100; + static const UINT16 SAM_STATE_F4 = 0x0080; + static const UINT16 SAM_STATE_F3 = 0x0040; + static const UINT16 SAM_STATE_F2 = 0x0020; + static const UINT16 SAM_STATE_F1 = 0x0010; + static const UINT16 SAM_STATE_F0 = 0x0008; + static const UINT16 SAM_STATE_V2 = 0x0004; + static const UINT16 SAM_STATE_V1 = 0x0002; + static const UINT16 SAM_STATE_V0 = 0x0001; + + // incidentals + cpu_device * m_cpu; + + // device state + UINT16 m_sam_state; + + ATTR_FORCE_INLINE UINT16 display_offset(void) + { + return ((m_sam_state & (SAM_STATE_F0|SAM_STATE_F1|SAM_STATE_F2|SAM_STATE_F3|SAM_STATE_F4|SAM_STATE_F5|SAM_STATE_F6)) / SAM_STATE_F0) << 9; + } + + ATTR_FORCE_INLINE UINT16 alter_sam_state(offs_t offset) + { + /* determine the mask */ + UINT16 mask = 1 << (offset >> 1); + + /* determine the new state */ + UINT16 new_state; + if (offset & 0x0001) + new_state = m_sam_state | mask; + else + new_state = m_sam_state & ~mask; + + /* specify the new state */ + UINT16 xorval = m_sam_state ^ new_state; + m_sam_state = new_state; + return xorval; + } + + void update_cpu_clock(void); +}; + +class sam6883_device : public device_t, public sam6883_friend_device +{ +public: + sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_res_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_res.set_callback(object); } + + static void configure_cpu(device_t &device, const char *tag, address_spacenum space) + { + sam6883_device &dev = downcast(device); + dev.m_cpu_tag = tag; + dev.m_cpu_space_ref = space; + } + + // called to configure banks + void configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only); + void configure_bank(int bank, read8_delegate rhandler, write8_delegate whandler); + + // typically called by VDG + ATTR_FORCE_INLINE DECLARE_READ8_MEMBER( display_read ) + { + if (offset == (offs_t) ~0) + { + /* the VDG is telling the counter to reset */ + m_counter = display_offset(); + m_counter_xdiv = 0; + m_counter_ydiv = 0; + } + else if ((offset & 1) != (m_counter & 0x0001)) + { + /* DA0 has been toggled - first bump B0-B3 of the counter */ + bool bit3_carry = (m_counter & 0x000F) == 0x000F; + m_counter = (m_counter & ~0x000F) | ((m_counter + 1) & 0x000F); + + /* and apply the carry (if applicable */ + if (bit3_carry) + counter_carry_bit3(); + } + return m_read_res((m_counter & m_counter_mask) | m_counter_or); + } + + DECLARE_WRITE_LINE_MEMBER( hs_w ); + + // typically called by machine + address_space *mpu_address_space(void) const { return m_cpu_space; } + void set_bank_offset(int bank, offs_t offset); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_post_load(); + +private: + // represents an external memory bank - memory or IO that the SAM + // points to with the S2/S1/S0 output + struct sam_bank + { + UINT8 * m_memory; + UINT32 m_memory_size; + offs_t m_memory_offset; + bool m_memory_read_only; + read8_delegate m_rhandler; + write8_delegate m_whandler; + }; + + // represents one of the memory "spaces" (e.g. - $8000-$9FFF) that + // can ultimately point to a bank + template + class sam_space + { + public: + sam_space(sam6883_device &owner); + void point(const sam_bank *bank, UINT16 offset, UINT16 mask); + + private: + sam6883_device & m_owner; + memory_bank * m_read_bank; + memory_bank * m_write_bank; + UINT16 m_mask; + + address_space &cpu_space() const; + void point_specific_bank(const sam_bank *bank, UINT16 offset, UINT16 mask, memory_bank *&memory_bank, INT32 addrstart, INT32 addrend, bool is_write); + }; + + const char * m_cpu_tag; + address_spacenum m_cpu_space_ref; + + // incidentals + address_space * m_cpu_space; + devcb_read8 m_read_res; + sam_bank m_banks[8]; + sam_space<0x0000, 0x7FFF> m_space_0000; + sam_space<0x8000, 0x9FFF> m_space_8000; + sam_space<0xA000, 0xBFFF> m_space_A000; + sam_space<0xC000, 0xFEFF> m_space_C000; + sam_space<0xFF00, 0xFF1F> m_space_FF00; + sam_space<0xFF20, 0xFF3F> m_space_FF20; + sam_space<0xFF40, 0xFF5F> m_space_FF40; + sam_space<0xFF60, 0xFFBF> m_space_FF60; + sam_space<0xFFE0, 0xFFFF> m_space_FFE0; + UINT16 m_counter_mask; + UINT16 m_counter_or; + + // SAM state + UINT16 m_counter; + UINT8 m_counter_xdiv; + UINT8 m_counter_ydiv; + + // dummy scratch memory + UINT8 m_dummy[0x8000]; + + // typically called by CPU + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + // called when there is a carry out of bit 3 on the counter + ATTR_FORCE_INLINE void counter_carry_bit3(void) + { + UINT8 x_division; + switch((m_sam_state & (SAM_STATE_V2|SAM_STATE_V1|SAM_STATE_V0)) / SAM_STATE_V0) + { + case 0x00: x_division = 1; break; + case 0x01: x_division = 3; break; + case 0x02: x_division = 1; break; + case 0x03: x_division = 2; break; + case 0x04: x_division = 1; break; + case 0x05: x_division = 1; break; + case 0x06: x_division = 1; break; + case 0x07: x_division = 1; break; + default: + fatalerror("Should not get here\n"); + return; + } + + if (++m_counter_xdiv >= x_division) + { + m_counter_xdiv = 0; + m_counter ^= 0x0010; + if ((m_counter & 0x0010) == 0x0000) + counter_carry_bit4(); + } + } + + // called when there is a carry out of bit 4 on the counter + ATTR_FORCE_INLINE void counter_carry_bit4(void) + { + UINT8 y_division; + switch((m_sam_state & (SAM_STATE_V2|SAM_STATE_V1|SAM_STATE_V0)) / SAM_STATE_V0) + { + case 0x00: y_division = 12; break; + case 0x01: y_division = 1; break; + case 0x02: y_division = 3; break; + case 0x03: y_division = 1; break; + case 0x04: y_division = 2; break; + case 0x05: y_division = 1; break; + case 0x06: y_division = 1; break; + case 0x07: y_division = 1; break; + default: + fatalerror("Should not get here\n"); + return; + } + + if (++m_counter_ydiv >= y_division) + { + m_counter_ydiv = 0; + m_counter += 0x0020; + } + } + + // other members + void configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only, read8_delegate rhandler, write8_delegate whandler); + void horizontal_sync(void); + void update_state(void); + void update_memory(void); +}; + +extern const device_type SAM6883; + +#endif /* __6883SAM__ */ diff --git a/src/mame/machine/abc1600mac.c b/src/mame/machine/abc1600mac.c new file mode 100644 index 00000000000..b22f55708c6 --- /dev/null +++ b/src/mame/machine/abc1600mac.c @@ -0,0 +1,686 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Luxor ABC 1600 Memory Access Controller emulation + +**********************************************************************/ + +/* + + TODO: + + - segment/page RAM addresses are not correctly decoded, "sas/format/format" can't find the SASI interface because of this + forcetask0 1 t0 0 t1 0 t2 0 t3 0 + sega19 0 task 0 + sega 000 segd 00 pga 008 pgd 4058 virtual 02c730 (should be 004730) +*/ + +#include "abc1600mac.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + + +#define A0 BIT(offset, 0) +#define A1 BIT(offset, 1) +#define A2 BIT(offset, 2) +#define A4 BIT(offset, 4) +#define A7 BIT(offset, 7) +#define A8 BIT(offset, 8) +#define X11 BIT(offset, 11) +#define X12 BIT(offset, 12) +#define A17 BIT(offset, 17) +#define A18 BIT(offset, 18) +#define A19 BIT(offset, 19) + +#define A10_A9_A8 ((offset >> 8) & 0x07) +#define A2_A1_A0 (offset & 0x07) +#define A1_A2 ((A1 << 1) | A2) +#define A2_A1 ((offset >> 1) & 0x03) + +#define FC0 BIT(fc, 0) +#define FC1 BIT(fc, 1) +#define FC2 BIT(fc, 2) + +#define PAGE_WP BIT(page_data, 14) +#define PAGE_NONX BIT(page_data, 15) + +#define BOOTE BIT(m_task, 6) +#define MAGIC BIT(m_task, 7) +#define READ_MAGIC !MAGIC + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ABC1600_MAC = &device_creator; + + +DEVICE_ADDRESS_MAP_START( map, 8, abc1600_mac_device ) + AM_RANGE(0x00000, 0xfffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, abc1600_mac_device ) +ADDRESS_MAP_END + + +//------------------------------------------------- +// ROM( abc1600_mac ) +//------------------------------------------------- + +ROM_START( abc1600_mac ) + ROM_REGION( 0x4000, "boot", 0 ) + ROM_LOAD( "boot 6490356-04.1f", 0x0000, 0x4000, CRC(9372f6f2) SHA1(86f0681f7ef8dd190b49eda5e781881582e0c2a4) ) + + ROM_REGION( 0x104, "plds", 0 ) + ROM_LOAD( "1022 6490351-01.17e", 0x000, 0x104, CRC(5dd00d43) SHA1(a3871f0d796bea9df8f25d41b3169dd4b8ef65ab) ) // MAC register address decoder +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *abc1600_mac_device::device_rom_region() const +{ + return ROM_NAME( abc1600_mac ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// abc1600_mac_device - constructor +//------------------------------------------------- + +abc1600_mac_device::abc1600_mac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ABC1600_MAC, "ABC 1600 MAC", tag, owner, clock, "abc1600mac", __FILE__), + device_memory_interface(mconfig, *this), + m_space_config("program", ENDIANNESS_LITTLE, 8, 22, 0, *ADDRESS_MAP_NAME(program_map)), + m_rom(*this, "boot"), + m_segment_ram(*this, "segment_ram"), + m_page_ram(*this, "page_ram"), + m_task(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void abc1600_mac_device::device_start() +{ + // get the CPU device + m_cpu = machine().device(m_cpu_tag); + assert(m_cpu != NULL); + + // allocate memory + m_segment_ram.allocate(0x400); + m_page_ram.allocate(0x400); + + // HACK fill segment RAM or abcenix won't boot + memset(m_segment_ram, 0xcd, 0x400); + + // state saving + save_item(NAME(m_ifc2)); + save_item(NAME(m_task)); + save_item(NAME(m_dmamap)); + save_item(NAME(m_cause)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void abc1600_mac_device::device_reset() +{ + // clear task register + m_task = 0; +} + + +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *abc1600_mac_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == AS_PROGRAM) ? &m_space_config : NULL; +} + + +//------------------------------------------------- +// get_current_task - +//------------------------------------------------- + +int abc1600_mac_device::get_current_task(offs_t offset) +{ + int force_task0 = !(m_ifc2 || A19); + int t0 = !(BIT(m_task, 0) || force_task0); + int t1 = !(BIT(m_task, 1) || force_task0); + int t2 = !(BIT(m_task, 2) || force_task0); + int t3 = !(BIT(m_task, 3) || force_task0); + + return (t3 << 3) | (t2 << 2) | (t1 << 1) | t0; +} + + +//------------------------------------------------- +// get_segment_address - +//------------------------------------------------- + +offs_t abc1600_mac_device::get_segment_address(offs_t offset) +{ + int sega19 = !(!(A8 || m_ifc2) || !A19); + int task = get_current_task(offset); + + return (task << 5) | (sega19 << 4) | ((offset >> 15) & 0x0f); +} + + +//------------------------------------------------- +// get_page_address - +//------------------------------------------------- + +offs_t abc1600_mac_device::get_page_address(offs_t offset, UINT8 segd) +{ + return ((segd & 0x3f) << 4) | ((offset >> 11) & 0x0f); +} + + +//------------------------------------------------- +// translate_address - +//------------------------------------------------- + +offs_t abc1600_mac_device::translate_address(offs_t offset, int *nonx, int *wp) +{ + // segment + offs_t sega = get_segment_address(offset); + UINT8 segd = m_segment_ram[sega]; + + // page + offs_t pga = get_page_address(offset, segd); + UINT16 page_data = m_page_ram[pga]; + + offs_t virtual_offset = ((page_data & 0x3ff) << 11) | (offset & 0x7ff); + + if (PAGE_NONX) + { + //logerror("Bus error %06x : %06x\n", offset, virtual_offset); + //m_cpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + //m_cpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + } + + *nonx = PAGE_NONX; + *wp = PAGE_WP; + + return virtual_offset; +} + + +//------------------------------------------------- +// read_user_memory - +//------------------------------------------------- + +UINT8 abc1600_mac_device::read_user_memory(offs_t offset) +{ + int nonx = 0, wp = 0; + offs_t virtual_offset = translate_address(offset, &nonx, &wp); + + return space().read_byte(virtual_offset); +} + + +//------------------------------------------------- +// write_user_memory - +//------------------------------------------------- + +void abc1600_mac_device::write_user_memory(offs_t offset, UINT8 data) +{ + int nonx = 0, wp = 0; + offs_t virtual_offset = translate_address(offset, &nonx, &wp); + + //if (nonx || !wp) return; + + space().write_byte(virtual_offset, data); +} + + +//------------------------------------------------- +// read_supervisor_memory - +//------------------------------------------------- + +UINT8 abc1600_mac_device::read_supervisor_memory(address_space &space, offs_t offset) +{ + UINT8 data = 0; + + if (!A2 && !A1) + { + // _EP + data = page_r(space, offset); + } + else if (!A2 && A1 && A0) + { + // _ES + data = segment_r(space, offset); + } + else if (A2 && A1 && A0) + { + // _CAUSE + data = cause_r(space, offset); + } + + return data; +} + + +//------------------------------------------------- +// write_supervisor_memory - +//------------------------------------------------- + +void abc1600_mac_device::write_supervisor_memory(address_space &space, offs_t offset, UINT8 data) +{ + if (!A2 && !A1) + { + // _WEP + page_w(space, offset, data); + } + else if (!A2 && A1 && A0) + { + // _WES + segment_w(space, offset, data); + } + else if (A2 && !A1 && A0) + { + // W(C) + task_w(space, offset, data); + } +} + + +//------------------------------------------------- +// get_fc - +//------------------------------------------------- + +int abc1600_mac_device::get_fc() +{ + UINT16 fc = m_cpu->get_fc(); + + m_ifc2 = !(!(MAGIC || FC0) || FC2); + + return fc; +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( abc1600_mac_device::read ) +{ + int fc = get_fc(); + + UINT8 data = 0; + + if (!BOOTE && !A19 && !A18 && !A17) + { + // _BOOTCE + data = m_rom->base()[offset & 0x3fff]; + } + else if (A19 && !m_ifc2 && !FC1) + { + data = read_supervisor_memory(space, offset); + } + else + { + data = read_user_memory(offset); + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mac_device::write ) +{ + int fc = get_fc(); + + if (A19 && !m_ifc2 && !FC1) + { + write_supervisor_memory(space, offset, data); + } + else + { + write_user_memory(offset, data); + } +} + + +//------------------------------------------------- +// cause_r - +//------------------------------------------------- + +READ8_MEMBER( abc1600_mac_device::cause_r ) +{ + /* + + bit description + + 0 RSTBUT + 1 1 + 2 DMAOK + 3 X16 + 4 X17 + 5 X18 + 6 X19 + 7 X20 + + */ + + UINT8 data = 0x02; + + // DMA status + data |= m_cause; + + machine().watchdog_reset(); + + return data; +} + + +//------------------------------------------------- +// task_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mac_device::task_w ) +{ + /* + + bit description + + 0 TASKD0* (inverted SEGA5) + 1 TASKD1* (inverted SEGA6) + 2 TASKD2* (inverted SEGA7) + 3 TASKD3* (inverted SEGA8) + 4 + 5 + 6 BOOTE* + 7 MAGIC* + + */ + + m_task = data ^ 0xff; + + if (LOG) logerror("%s: %06x Task %u BOOTE %u MAGIC %u\n", machine().describe_context(), offset, get_current_task(offset), BOOTE, MAGIC); +} + + +//------------------------------------------------- +// segment_r - +//------------------------------------------------- + +READ8_MEMBER( abc1600_mac_device::segment_r ) +{ + /* + + bit description + + 0 SEGD0 + 1 SEGD1 + 2 SEGD2 + 3 SEGD3 + 4 SEGD4 + 5 SEGD5 + 6 SEGD6 + 7 READ_MAGIC + + */ + + offs_t sega = get_segment_address(offset); + UINT8 segd = m_segment_ram[sega]; + + return (READ_MAGIC << 7) | (segd & 0x7f); +} + + +//------------------------------------------------- +// segment_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mac_device::segment_w ) +{ + /* + + bit description + + 0 SEGD0 + 1 SEGD1 + 2 SEGD2 + 3 SEGD3 + 4 SEGD4 + 5 SEGD5 + 6 SEGD6 + 7 0 + + */ + + offs_t sega = get_segment_address(offset); + + m_segment_ram[sega] = data & 0x7f; + + if (LOG) logerror("%s: %06x Task %u Segment %03x : %02x\n", machine().describe_context(), offset, get_current_task(offset), sega, data); +} + + +//------------------------------------------------- +// page_r - +//------------------------------------------------- + +READ8_MEMBER( abc1600_mac_device::page_r ) +{ + /* + + bit description + + 0 X11 + 1 X12 + 2 X13 + 3 X14 + 4 X15 + 5 X16 + 6 X17 + 7 X18 + + 8 X19 + 9 X20 + 10 X20 + 11 X20 + 12 X20 + 13 X20 + 14 _WP + 15 NONX + + */ + + // segment + offs_t sega = get_segment_address(offset); + UINT8 segd = m_segment_ram[sega]; + + // page + offs_t pga = get_page_address(offset, segd); + UINT16 pgd = m_page_ram[pga]; + + UINT8 data = 0; + + if (A0) + { + data = pgd & 0xff; + } + else + { + int x20 = BIT(pgd, 9); + + data = (pgd >> 8) | (x20 << 2) | (x20 << 3) | (x20 << 4) | (x20 << 5); + } + + return data; +} + + +//------------------------------------------------- +// page_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mac_device::page_w ) +{ + /* + + bit description + + 0 X11 + 1 X12 + 2 X13 + 3 X14 + 4 X15 + 5 X16 + 6 X17 + 7 X18 + + 8 X19 + 9 X20 + 10 + 11 + 12 + 13 + 14 _WP + 15 NONX + + */ + + // segment + offs_t sega = get_segment_address(offset); + UINT8 segd = m_segment_ram[sega]; + + // page + offs_t pga = get_page_address(offset, segd); + + if (A0) + { + m_page_ram[pga] = (m_page_ram[pga] & 0xff00) | data; + } + else + { + m_page_ram[pga] = ((data & 0xc3) << 8) | (m_page_ram[pga] & 0xff); + } + + if (LOG) logerror("%s: %06x Task %u Segment %03x Page %03x : %02x -> %04x\n", machine().describe_context(), offset, get_current_task(offset), sega, pga, data, m_page_ram[pga]); +} + + +//------------------------------------------------- +// get_dma_address - +//------------------------------------------------- + +offs_t abc1600_mac_device::get_dma_address(int index, UINT16 offset) +{ + // A0 = DMA15, A1 = BA1, A2 = BA2 + UINT8 dmamap_addr = index | BIT(offset, 15); + UINT8 dmamap = m_dmamap[dmamap_addr]; + + m_cause = (dmamap & 0x1f) << 3; + + return ((dmamap & 0x1f) << 16) | offset; +} + + +//------------------------------------------------- +// dma_mreq_r - DMA memory read +//------------------------------------------------- + +UINT8 abc1600_mac_device::dma_mreq_r(int index, UINT16 offset) +{ + offs_t virtual_offset = get_dma_address(index, offset); + + return space().read_byte(virtual_offset); +} + + +//------------------------------------------------- +// dma_mreq_w - DMA memory write +//------------------------------------------------- + +void abc1600_mac_device::dma_mreq_w(int index, UINT16 offset, UINT8 data) +{ + offs_t virtual_offset = get_dma_address(index, offset); + + space().write_byte(virtual_offset, data); +} + + +//------------------------------------------------- +// dma_iorq_r - DMA I/O read +//------------------------------------------------- + +UINT8 abc1600_mac_device::dma_iorq_r(int index, UINT16 offset) +{ + offs_t virtual_offset = 0x1fe000 | get_dma_address(index, offset); + + return space().read_byte(virtual_offset); +} + + +//------------------------------------------------- +// dma_iorq_w - DMA I/O write +//------------------------------------------------- + +void abc1600_mac_device::dma_iorq_w(int index, UINT16 offset, UINT8 data) +{ + offs_t virtual_offset = 0x1fe000 | get_dma_address(index, offset); + + space().write_byte(virtual_offset, data); +} + + +//------------------------------------------------- +// dmamap_w - DMA map write +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mac_device::dmamap_w ) +{ + /* + + bit description + + 0 X16 + 1 X17 + 2 X18 + 3 X19 + 4 X20 + 5 + 6 + 7 _R/W + + */ + + if (LOG) logerror("DMAMAP %u %02x\n", offset & 7, data); + + m_dmamap[offset & 7] = data; +} diff --git a/src/mame/machine/abc1600mac.h b/src/mame/machine/abc1600mac.h new file mode 100644 index 00000000000..c26c2dc9b09 --- /dev/null +++ b/src/mame/machine/abc1600mac.h @@ -0,0 +1,136 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Luxor ABC 1600 Memory Access Controller emulation + +**********************************************************************/ + +#pragma once + +#ifndef __ABC1600_MAC__ +#define __ABC1600_MAC__ + +#include "emu.h" +#include "cpu/m68000/m68000.h" + + + +///************************************************************************* +// MACROS / CONSTANTS +///************************************************************************* + +#define ABC1600_MAC_TAG "mac" + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_ABC1600_MAC_ADD(_cpu_tag, _program_map) \ + MCFG_DEVICE_ADD(ABC1600_MAC_TAG, ABC1600_MAC, 0) \ + MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _program_map) \ + downcast(device)->set_cpu_tag(_cpu_tag); + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> abc1600_mac_device + +class abc1600_mac_device : public device_t, + public device_memory_interface +{ +public: + abc1600_mac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + + void set_cpu_tag(const char *cpu_tag) { m_cpu_tag = cpu_tag; } + + virtual DECLARE_ADDRESS_MAP(map, 8); + + DECLARE_READ8_MEMBER( cause_r ); + DECLARE_WRITE8_MEMBER( task_w ); + DECLARE_READ8_MEMBER( segment_r ); + DECLARE_WRITE8_MEMBER( segment_w ); + DECLARE_READ8_MEMBER( page_r ); + DECLARE_WRITE8_MEMBER( page_w ); + DECLARE_WRITE8_MEMBER( dmamap_w ); + + DECLARE_READ8_MEMBER( dma0_mreq_r ) { return dma_mreq_r(DMAMAP_R0_LO, offset); } + DECLARE_WRITE8_MEMBER( dma0_mreq_w ) { dma_mreq_w(DMAMAP_R0_LO, offset, data); } + DECLARE_READ8_MEMBER( dma0_iorq_r ) { return dma_iorq_r(DMAMAP_R0_LO, offset); } + DECLARE_WRITE8_MEMBER( dma0_iorq_w ) { dma_iorq_w(DMAMAP_R0_LO, offset, data); } + DECLARE_READ8_MEMBER( dma1_mreq_r ) { return dma_mreq_r(DMAMAP_R1_LO, offset); } + DECLARE_WRITE8_MEMBER( dma1_mreq_w ) { dma_mreq_w(DMAMAP_R1_LO, offset, data); } + DECLARE_READ8_MEMBER( dma1_iorq_r ) { return dma_iorq_r(DMAMAP_R1_LO, offset); } + DECLARE_WRITE8_MEMBER( dma1_iorq_w ) { dma_iorq_w(DMAMAP_R1_LO, offset, data); } + DECLARE_READ8_MEMBER( dma2_mreq_r ) { return dma_mreq_r(DMAMAP_R2_LO, offset); } + DECLARE_WRITE8_MEMBER( dma2_mreq_w ) { dma_mreq_w(DMAMAP_R2_LO, offset, data); } + DECLARE_READ8_MEMBER( dma2_iorq_r ) { return dma_iorq_r(DMAMAP_R2_LO, offset); } + DECLARE_WRITE8_MEMBER( dma2_iorq_w ) { dma_iorq_w(DMAMAP_R2_LO, offset, data); } + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const; + +private: + enum + { + DMAMAP_R2_LO = 0, + DMAMAP_R2_HI, + DMAMAP_R1_LO = 4, + DMAMAP_R1_HI, + DMAMAP_R0_LO, + DMAMAP_R0_HI + }; + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + int get_current_task(offs_t offset); + offs_t get_segment_address(offs_t offset); + offs_t get_page_address(offs_t offset, UINT8 segd); + offs_t translate_address(offs_t offset, int *nonx, int *wp); + UINT8 read_user_memory(offs_t offset); + void write_user_memory(offs_t offset, UINT8 data); + int get_fc(); + UINT8 read_supervisor_memory(address_space &space, offs_t offset); + void write_supervisor_memory(address_space &space, offs_t offset, UINT8 data); + offs_t get_dma_address(int index, UINT16 offset); + UINT8 dma_mreq_r(int index, UINT16 offset); + void dma_mreq_w(int index, UINT16 offset, UINT8 data); + UINT8 dma_iorq_r(int index, UINT16 offset); + void dma_iorq_w(int index, UINT16 offset, UINT8 data); + + const address_space_config m_space_config; + + required_memory_region m_rom; + optional_shared_ptr m_segment_ram; + optional_shared_ptr m_page_ram; + + const char *m_cpu_tag; + m68000_base_device *m_cpu; + + int m_ifc2; + UINT8 m_task; + UINT8 m_dmamap[8]; + UINT8 m_cause; +}; + + +// device type definition +extern const device_type ABC1600_MAC; + + + +#endif diff --git a/src/mame/machine/abc80kb.c b/src/mame/machine/abc80kb.c new file mode 100644 index 00000000000..dd9471f5ee4 --- /dev/null +++ b/src/mame/machine/abc80kb.c @@ -0,0 +1,205 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Luxor ABC-80 keyboard emulation + +**********************************************************************/ + +/* + +PCB Layout +---------- + +KTC 65-01870-001 (dated 1978) +PCB-002B + + |---------------| +|---| CN1 |---------------------------------------------------| +| | +| LS06 LS04 LS04 LS06 LS00 LS123 | +| LS74 PROM MCU 4051 900C | +| | +| | +| | +| | +| | +| | +| | +| | +|-----------------------------------------------------------------------| + +Notes: + All IC's shown. + + MCU - General Instruments 30293B-013 20-04592-013 (?) + PROM - Synertek N82S141N 512x8 bipolar PROM "053" + 900C - Ferranti Interdesign 900C custom (?) + CN1 - keyboard data connector + +*/ + +/* + +PCB Layout +---------- + +KTC A65-01870-001 (dated 1983) +PCB-201C + + |---------------| +|---| CN1 |---------------------------------------------------| +| | +| LS06 LS04 LS04 LS00 LS123 | +| MCU 4051 900C | +| | +| | +| | +| | +| | +| | +| | +| | +|-----------------------------------------------------------------------| + +Notes: + All IC's shown. + + MCU - General Instruments 30293B-047 20-04592-047 (?) + 900C - Ferranti Interdesign 900C custom (?) + CN1 - keyboard data connector + +*/ + +#include "abc80kb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8048_TAG "i8048" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ABC80_KEYBOARD = &device_creator; + + +//------------------------------------------------- +// ROM( abc80_keyboard ) +//------------------------------------------------- + +ROM_START( abc80_keyboard ) + ROM_REGION( 0x400, I8048_TAG, 0 ) + ROM_LOAD( "053.z5", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *abc80_keyboard_device::device_rom_region() const +{ + return ROM_NAME( abc80_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( abc80_keyboard_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( abc80_keyboard_io, AS_IO, 8, abc80_keyboard_device ) +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_DRIVER( abc80_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( abc80_keyboard ) + MCFG_CPU_ADD(I8048_TAG, I8048, 4000000) + MCFG_CPU_IO_MAP(abc80_keyboard_io) + MCFG_DEVICE_DISABLE() +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor abc80_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( abc80_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( abc80_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( abc80_keyboard ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor abc80_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( abc80_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// abc80_keyboard_device - constructor +//------------------------------------------------- + +abc80_keyboard_device::abc80_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ABC80_KEYBOARD, "ABC-80 Keyboard", tag, owner, clock, "abc80kb", __FILE__), + m_write_keydown(*this), + m_maincpu(*this, I8048_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void abc80_keyboard_device::device_start() +{ + // resolve callbacks + m_write_keydown.resolve_safe(); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void abc80_keyboard_device::device_reset() +{ +} + + +//------------------------------------------------- +// data_r - keyboard data read +//------------------------------------------------- + +UINT8 abc80_keyboard_device::data_r() +{ + return 0; +} diff --git a/src/mame/machine/abc80kb.h b/src/mame/machine/abc80kb.h new file mode 100644 index 00000000000..d4d9a7fc08b --- /dev/null +++ b/src/mame/machine/abc80kb.h @@ -0,0 +1,74 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Luxor ABC-80 keyboard emulation + +**********************************************************************/ + +#pragma once + +#ifndef __ABC80_KEYBOARD__ +#define __ABC80_KEYBOARD__ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define ABC80_KEYBOARD_TAG "abc80kb" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_ABC80_KEYBOARD_KEYDOWN_CALLBACK(_write) \ + devcb = &abc80_keyboard_device::set_keydown_wr_callback(*device, DEVCB_##_write); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> abc80_keyboard_device + +class abc80_keyboard_device : public device_t +{ +public: + // construction/destruction + abc80_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_keydown_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_keydown.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + UINT8 data_r(); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + devcb_write_line m_write_keydown; + + required_device m_maincpu; +}; + + +// device type definition +extern const device_type ABC80_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/ac1.c b/src/mame/machine/ac1.c new file mode 100644 index 00000000000..e504807ef96 --- /dev/null +++ b/src/mame/machine/ac1.c @@ -0,0 +1,108 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + AC1 video driver by Miodrag Milanovic + + 15/01/2009 Preliminary driver. + +****************************************************************************/ + +#include "emu.h" +#include "machine/z80pio.h" +#include "imagedev/cassette.h" +#include "includes/ac1.h" + +READ8_MEMBER(ac1_state::ac1_port_b_r) +{ + UINT8 data = 0x7f; + + if (m_cassette->input() > 0.03) + data |= 0x80; + + return data; +} + +#define BNOT(x) ((x) ? 0 : 1) + +READ8_MEMBER(ac1_state::ac1_port_a_r) +{ + UINT8 line0 = m_io_line[0]->read(); + UINT8 line1 = m_io_line[1]->read(); + UINT8 line2 = m_io_line[2]->read(); + UINT8 line3 = m_io_line[3]->read(); + UINT8 line4 = m_io_line[4]->read(); + UINT8 line5 = m_io_line[5]->read(); + UINT8 line6 = m_io_line[6]->read(); + + UINT8 SH = BNOT(BIT(line6,0)); + UINT8 CTRL = BNOT(BIT(line6,1)); + UINT8 SPACE = BIT(line6,2); + UINT8 ENTER = BIT(line6,3); + UINT8 BACK = BIT(line6,4); + + UINT8 all = line0 | line1 | line2 | line3 | line4 | line5; + UINT8 s1 = BNOT(BIT(all,0));UINT8 z1 = (line0 !=0) ? 0 : 1; + UINT8 s2 = BNOT(BIT(all,1));UINT8 z2 = (line1 !=0) ? 0 : 1; + UINT8 s3 = BNOT(BIT(all,2));UINT8 z3 = (line2 !=0) ? 0 : 1; + UINT8 s4 = BNOT(BIT(all,3));UINT8 z4 = (line3 !=0) ? 0 : 1; + UINT8 s5 = BNOT(BIT(all,4));UINT8 z5 = (line4 !=0) ? 0 : 1; + UINT8 s6 = BNOT(BIT(all,5));UINT8 z6 = (line5 !=0) ? 0 : 1; + UINT8 s7 = BNOT(BIT(all,6)); + UINT8 s8 = BNOT(BIT(all,7)); + UINT8 tast,td0,td1,td2,td3,td4,td5,td6,dg5; + + /* Additional double keys */ + if (SPACE) { + z1 = 0; s1 = 0; SH = 0; + } + if (ENTER) { + z4 = 0; s6 = 0; CTRL = 0; + } + if (BACK) { + z4 = 0; s1 = 0; CTRL = 0; + } + + tast = BNOT(s1 & s2 & s3 & s4 & s5 &s6 & s7 & s8); + td0 = BNOT(s2 & s4 & s6 & s8); + td1 = BNOT(s3 & s4 & s7 & s8); + td2 = BNOT(s5 & s6 & s7 & s8); + td3 = BNOT(z2 & z4 & z6); + td4 = BNOT(BNOT(BNOT(z1 & z2) & SH) & z5 & z6); + dg5 = BNOT(z3 & z4 & z5 & z6); + td5 = BNOT(BNOT(dg5 & BNOT(SH)) & z1 & z2); + td6 = (dg5 & CTRL); + return td0 + (td1 << 1) +(td2 << 2) +(td3 << 3) +(td4 << 4) +(td5 << 5) +(td6 << 6) +(tast << 7); +} + +WRITE8_MEMBER(ac1_state::ac1_port_a_w) +{ +} + +WRITE8_MEMBER(ac1_state::ac1_port_b_w) +{ + /* + + bit description + + 0 + 1 RTTY receive + 2 RTTY transmit + 3 RTTY PTT + 4 + 5 + 6 cassette out + 7 cassette in + + */ + m_cassette->output((data & 0x40) ? -1.0 : +1.0); +} + +/* Driver initialization */ +DRIVER_INIT_MEMBER(ac1_state,ac1) +{ +} + +void ac1_state::machine_reset() +{ +} diff --git a/src/mame/machine/advision.c b/src/mame/machine/advision.c new file mode 100644 index 00000000000..4f1f19b105e --- /dev/null +++ b/src/mame/machine/advision.c @@ -0,0 +1,193 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + advision.c + + Machine file to handle emulation of the AdventureVision. + +***************************************************************************/ + +#include "emu.h" +#include "includes/advision.h" +#include "cpu/mcs48/mcs48.h" +#include "sound/dac.h" + +/* + 8048 Ports: + + P1 Bit 0..1 - RAM bank select + Bit 3..7 - Keypad input + + P2 Bit 0..3 - A8-A11 + Bit 4..7 - Sound control/Video write address + + T1 Mirror sync pulse +*/ + +/* Machine Initialization */ + +void advision_state::machine_start() +{ + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + /* configure EA banking */ + m_bank1->configure_entry(0, memregion(I8048_TAG)->base()); + m_bank1->configure_entry(1, m_cart_rom->base()); + m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1"); + m_bank1->set_entry(0); + + /* allocate external RAM */ + m_ext_ram.resize(0x400); + save_item(NAME(m_ext_ram)); + + save_item(NAME(m_ea_bank)); + save_item(NAME(m_rambank)); + save_item(NAME(m_frame_count)); + save_item(NAME(m_frame_start)); + save_item(NAME(m_video_enable)); + save_item(NAME(m_video_bank)); + save_item(NAME(m_led_latch)); + save_item(NAME(m_sound_cmd)); + save_item(NAME(m_sound_d)); + save_item(NAME(m_sound_g)); +} + +void advision_state::machine_reset() +{ + m_ea_bank = 0; + m_rambank = 0x300; + m_frame_start = 0; + m_video_enable = 0; + m_sound_cmd = 0; + + /* enable internal ROM */ + m_maincpu->set_input_line(MCS48_INPUT_EA, CLEAR_LINE); + m_bank1->set_entry(m_ea_bank); + + /* reset sound CPU */ + m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); +} + +/* Bank Switching */ + +WRITE8_MEMBER( advision_state::bankswitch_w ) +{ + m_ea_bank = BIT(data, 2); + m_rambank = (data & 0x03) << 8; + + m_maincpu->set_input_line(MCS48_INPUT_EA, m_ea_bank ? ASSERT_LINE : CLEAR_LINE); + if (m_cart_rom) + m_bank1->set_entry(m_ea_bank); +} + +/* External RAM */ + +READ8_MEMBER( advision_state::ext_ram_r ) +{ + UINT8 data = m_ext_ram[m_rambank + offset]; + + if (!m_video_enable) + { + /* the video hardware interprets reads as writes */ + vh_write(data); + } + + if (m_video_bank == 0x06) + { + m_soundcpu->set_input_line(INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); + } + + return data; +} + +WRITE8_MEMBER( advision_state::ext_ram_w ) +{ + m_ext_ram[m_rambank + offset] = data; +} + +/* Sound */ + +READ8_MEMBER( advision_state::sound_cmd_r ) +{ + return m_sound_cmd; +} + +void advision_state::update_dac() +{ + if (m_sound_g == 0 && m_sound_d == 0) + m_dac->write_unsigned8(0xff); + else if (m_sound_g == 1 && m_sound_d == 1) + m_dac->write_unsigned8(0x80); + else + m_dac->write_unsigned8(0x00); +} + +WRITE8_MEMBER( advision_state::sound_g_w ) +{ + m_sound_g = data & 0x01; + + update_dac(); +} + +WRITE8_MEMBER( advision_state::sound_d_w ) +{ + m_sound_d = data & 0x01; + + update_dac(); +} + +/* Video */ + +WRITE8_MEMBER( advision_state::av_control_w ) +{ + m_sound_cmd = data >> 4; + + if ((m_video_enable == 0x00) && (data & 0x10)) + { + vh_update(m_video_hpos); + + m_video_hpos++; + + if (m_video_hpos > 255) + { + m_video_hpos = 0; + logerror("HPOS OVERFLOW\n"); + } + } + + m_video_enable = data & 0x10; + m_video_bank = (data & 0xe0) >> 5; +} + +READ8_MEMBER( advision_state::vsync_r ) +{ + if (m_frame_start) + { + m_frame_start = 0; + + return 0; + } + else + { + return 1; + } +} + +/* Input */ + +READ8_MEMBER( advision_state::controller_r ) +{ + // Get joystick switches + UINT8 in = m_joy->read(); + UINT8 data = in | 0x0f; + + // Get buttons + if (in & 0x02) data = data & 0xf7; /* Button 3 */ + if (in & 0x08) data = data & 0xcf; /* Button 1 */ + if (in & 0x04) data = data & 0xaf; /* Button 2 */ + if (in & 0x01) data = data & 0x6f; /* Button 4 */ + + return data & 0xf8; +} diff --git a/src/mame/machine/aim65.c b/src/mame/machine/aim65.c new file mode 100644 index 00000000000..3e7d4f2a309 --- /dev/null +++ b/src/mame/machine/aim65.c @@ -0,0 +1,424 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner, Dan Boris, Dirk Best, Robbbert +/****************************************************************************** + + AIM65 + +******************************************************************************/ + + +#include "includes/aim65.h" + + +/****************************************************************************** + Interrupt handling +******************************************************************************/ + +/* STEP/RUN + * + * Switch S2 (STEP/RUN) causes AIM 65 to operate either in the RUN mode or the + * single STEP mode. In the STEP mode, the NMI interrupt line is driven low + * when SYNC and O2 go high during instruction execution if the address lines + * are outside the A000-FFFF range. The NMI interrupt occurs on the high to + * low transition of the NMI line. The Monitor software will trace instructions + * and register, outside the Monitor instruction address range if the trace + * modes are selected and the NMI Interrupt Routine is not bypassed. + */ + + + +/****************************************************************************** + 6821 PIA +******************************************************************************/ + +/* PA0: A0 (Address) + * PA1: A1 (Address) + * PA2: CE1 (Chip enable) + * PA3: CE2 (Chip enable) + * PA4: CE3 (Chip enable) + * PA5: CE4 (Chip enable) + * PA6: CE5 (Chip enable) + * PA7: W (Write enable) + * PB0-6: D0-D6 (Data) + * PB7: CU (Cursor) + */ + +void aim65_state::dl1416_update(dl1416_device *device, int index) +{ + device->ce_w(m_pia_a & (0x04 << index)); + device->wr_w(BIT(m_pia_a, 7)); + device->cu_w(BIT(m_pia_b, 7)); + device->data_w(generic_space(), m_pia_a & 0x03, m_pia_b & 0x7f); +} + +void aim65_state::aim65_pia() +{ + dl1416_update(m_ds1, 0); + dl1416_update(m_ds2, 1); + dl1416_update(m_ds3, 2); + dl1416_update(m_ds4, 3); + dl1416_update(m_ds5, 4); +} + + +WRITE8_MEMBER( aim65_state::aim65_pia_a_w ) +{ + m_pia_a = data; + aim65_pia(); +} + + +WRITE8_MEMBER( aim65_state::aim65_pia_b_w ) +{ + m_pia_b = data; + aim65_pia(); +} + + +WRITE16_MEMBER( aim65_state::aim65_update_ds1) +{ + output_set_digit_value(0 + (offset ^ 3), data); +} + +WRITE16_MEMBER( aim65_state::aim65_update_ds2) +{ + output_set_digit_value(4 + (offset ^ 3), data); +} + +WRITE16_MEMBER( aim65_state::aim65_update_ds3) +{ + output_set_digit_value(8 + (offset ^ 3), data); +} + +WRITE16_MEMBER( aim65_state::aim65_update_ds4) +{ + output_set_digit_value(12 + (offset ^ 3), data); +} + +WRITE16_MEMBER( aim65_state::aim65_update_ds5) +{ + output_set_digit_value(16 + (offset ^ 3), data); +} + + + +/****************************************************************************** + 6532 RIOT +******************************************************************************/ + + +READ8_MEMBER( aim65_state::aim65_riot_b_r ) +{ + static const char *const keynames[] = + { + "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", + "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" + }; + + UINT8 row, data = 0xff; + + /* scan keyboard rows */ + for (row = 0; row < 8; row++) + { + if (!BIT(m_riot_port_a, row)) + data &= ioport(keynames[row])->read(); + } + + return data; +} + + +WRITE8_MEMBER( aim65_state::aim65_riot_a_w ) +{ + m_riot_port_a = data; +} + + + +/*************************************************************************** + DRIVER INIT +***************************************************************************/ + +void aim65_state::machine_start() +{ + ram_device *ram = m_ram; + address_space &space = m_maincpu->space(AS_PROGRAM); + + // Init ROM sockets + if (m_z24->exists()) + space.install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_z24)); + if (m_z25->exists()) + space.install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_z25)); + if (m_z26->exists()) + space.install_read_handler(0xb000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_z26)); + + // Init RAM + space.install_ram(0x0000, ram->size() - 1, ram->pointer()); + + m_pb_save = 0; +} + + +/* RESET + * + * Pushbutton switch S1 initiates RESET of the AIM65 hardware and software. + * Timer Z4 holds the RES low for at least 15 ms from the time the pushbutton + * is released. RES is routed to the R6502 CPU, the Monitor R6522 (Z32), the + * Monitor R6532 RIOT (Z33), the user R6522 VIA (Z1), and the display R6520 PIA + * (U1). To initiate the device RESET function is also routed to the expansion + * connector for off-board RESET functions. The Monitor performs a software + * reset when the RES line goes high. + */ + + +/****************************************************************************** + Cassette +******************************************************************************/ + +WRITE8_MEMBER( aim65_state::aim65_pb_w ) +{ +/* + d7 = cass out (both decks) + d5 = cass2 motor + d4 = cass1 motor + d2 = tty out (not emulated) + d0/1 = printer data (not emulated) +*/ + + UINT8 bits = data ^ m_pb_save; + m_pb_save = data; + + if (BIT(bits, 7)) + { + m_cassette1->output(BIT(data, 7) ? -1.0 : +1.0); + m_cassette2->output(BIT(data, 7) ? -1.0 : +1.0); + } + + if (BIT(bits, 5)) + { + if (BIT(data, 5)) + m_cassette2->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + else + m_cassette2->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + } + + if (BIT(bits, 4)) + { + if (BIT(data, 4)) + m_cassette1->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + else + m_cassette1->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + } +} + + +READ8_MEMBER( aim65_state::aim65_pb_r ) +{ +/* + d7 = cassette in (deck 1) + d6 = tty in (not emulated) + d3 = kb/tty switch +*/ + + UINT8 data = ioport("switches")->read(); + data |= (m_cassette1->input() > +0.03) ? 0x80 : 0; + data |= 0x40; // TTY must be H if not used. + data |= m_pb_save & 0x37; + return data; +} + + +/****************************************************************************** + Printer +******************************************************************************/ + +#ifdef UNUSED_FUNCTION +/* + +2012-01-24 Printer code removed [Robbbert] + +From here to the end is not compiled. It is the remnants of the old printer +code. Have a look at version 0.114 or 0.115 for the original working code. + +I've left it here for the idly curious. + +The system sends out the pattern of dots to the 'dot-matrix' print-head. + +This is why we can't simply replace it with a Centronics-like 'Printer' +device - the output will be gibberish. +*/ + + + +/* + aim65 thermal printer (20 characters) + 10 heat elements (place on 1 line, space between 2 characters(about 14dots)) + (pa0..pa7,pb0,pb1 1 heat element on) + + cb2 0 motor, heat elements on + cb1 output start!? + ca1 input + + normally printer 5x7 characters + (horizontal movement limits not known, normally 2 dots between characters) + + 3 dots space between lines? +*/ + + +/* Part of aim65_pb_w + + data &= 0x03; + + if (m_flag_b == 0) + { + printerRAM[(m_printer_y * 20) + m_printer_x ] |= (data << 8); + m_flag_b = 1; + } +*/ + + +/* Items for driver state + + emu_timer *m_print_timer; + int m_printer_x; + int m_printer_y; + bool m_printer_dir; + bool m_flag_a; + bool m_flag_b; + bool m_printer_level; + UINT16 *m_printerRAM; +*/ + + +/* Other items from H file + +VIDEO_UPDATE( aim65 ); +*/ + + +/* From 6522 config +DRIVER_MEMBER(aim65_state, aim65_pa_w), // out port A +DRIVER_MEMBER(aim65_state, aim65_printer_on), // out CB2 +*/ + + +/* From Machine Config + MCFG_VIDEO_START_OVERRIDE(aim65_state,aim65) + MCFG_VIDEO_UPDATE(aim65) +*/ + + +TIMER_CALLBACK_MEMBER(aim65_state::aim65_printer_timer) +{ + via6522_device *via_0 = machine().device("via6522_0"); + + via_0->write_cb1(m_printer_level); + via_0->write_cb1(!m_printer_level); + m_printer_level ^= 1; + + if (m_printer_dir) + { + if (m_printer_x > 0) + m_printer_x--; + else + { + m_printer_dir = 0; + m_printer_x++; + m_printer_y++; + } + } + else + { + if (m_printer_x < 9) + m_printer_x++; + else + { + m_printer_dir = 1; + m_printer_x--; + m_printer_y++; + } + } + + if (m_printer_y > 500) m_printer_y = 0; + + m_flag_a=0; + m_flag_b=0; +} + + +WRITE8_MEMBER( aim65_state::aim65_printer_on ) +{ + via6522_device *via_0 = machine().device("via6522_0"); + if (!data) + { + m_printer_x=0; + m_printer_y++; + if (m_printer_y > 500) m_printer_y = 0; + m_flag_a = m_flag_b=0; + via_0->write_cb1(0); + m_print_timer->adjust(attotime::zero, 0, attotime::from_usec(10)); + m_printer_level = 1; + } + else + m_print_timer->reset(); +} + + +WRITE8_MEMBER( aim65_state::aim65_pa_w ) +{ +// All bits are for printer data (not emulated) + if (m_flag_a == 0) + { + m_printerRAM[(m_printer_y * 20) + m_printer_x] |= data; + m_flag_a = 1; + } +} + +VIDEO_START_MEMBER(aim65_state,aim65) +{ + m_print_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aim65_state::aim65_printer_timer),this)); + m_printerRAM = auto_alloc_array(machine(), UINT16, (600 * 10 * 2) / 2); + memset(m_printerRAM, 0, videoram_size); + VIDEO_START_CALL_MEMBER(generic); + m_printer_x = 0; + m_printer_y = 0; + m_printer_dir = 0; + m_flag_a = 0; + m_flag_b = 0; + m_printer_level = 0; +} + +SCREEN_UPDATE( aim65 ) +{ + aim65_state *state = screen.machine().driver_data(); + /* Display printer output */ + bool dir = 1; + UINT8 b,x,pen; + UINT16 y; + + for (y = 0; y<500; y++) + { + for(x = 0; x< 10; x++) + { + if (dir == 1) + data = state->m_printerRAM[y * 10 + x]; + else + data = state->m_printerRAM[(y * 10) + (9 - x)]; + + + for (b = 0; b<10; b++) + { + pen = screen.m_palette->pen(BIT(data, 0) ? 2 : 0); + plot_pixel(bitmap,700 - ((b * 10) + x), y, pen); + data >>= 1; + } + } + + dir ^= 1; + } + return 0; +} + + +#endif diff --git a/src/mame/machine/amigakbd.c b/src/mame/machine/amigakbd.c new file mode 100644 index 00000000000..c6d1bb05d34 --- /dev/null +++ b/src/mame/machine/amigakbd.c @@ -0,0 +1,574 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Amiga Keyboard + + We currently emulate the Amiga 500 keyboard controller, which was + also used in later Amiga 2000 keyboards. + + TODO: - Natural keyboard mode doesn't work with shifted characters, + they get sent in the wrong order (core bug?) + - Move 6500/1 to its own CPU core so that it can be shared with + other systems + - Add support for more keyboard controllers (pending on them + getting dumped) + + Amiga 1000 keyboard part numbers (manufactured by Mitsumi): + + - 327063-01 R56-2144 English + - 327063-02 British + - 327063-03 R56-2153 German + - 327063-04 R56-2152 French + - 327063-05 R56-2154 Italian + +***************************************************************************/ + +#include "amigakbd.h" +#include "machine/rescap.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type AMIGAKBD = &device_creator; + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +static ADDRESS_MAP_START( mpu6500_map, AS_PROGRAM, 8, amigakbd_device ) + ADDRESS_MAP_GLOBAL_MASK(0xfff) + AM_RANGE(0x000, 0x03f) AM_RAM + AM_RANGE(0x080, 0x080) AM_READWRITE(port_a_r, port_a_w) + AM_RANGE(0x081, 0x081) AM_READ_PORT("special") AM_WRITE(port_b_w) + AM_RANGE(0x082, 0x082) AM_WRITE(port_c_w) + AM_RANGE(0x083, 0x083) AM_WRITE(port_d_w) + AM_RANGE(0x084, 0x085) AM_WRITE(latch_w) + AM_RANGE(0x086, 0x087) AM_READ(counter_r) + AM_RANGE(0x088, 0x088) AM_WRITE(transfer_latch_w) + AM_RANGE(0x089, 0x089) AM_WRITE(clear_pa0_detect) + AM_RANGE(0x08a, 0x08a) AM_WRITE(clear_pa1_detect) + AM_RANGE(0x08f, 0x08f) AM_READWRITE(control_r, control_w) + AM_RANGE(0x090, 0x0ff) AM_NOP + AM_RANGE(0x800, 0xfff) AM_ROM AM_REGION("mos6570_036", 0) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( a500_keyboard ) + MCFG_CPU_ADD("mos6570_036", M6502, XTAL_3MHz / 2) + MCFG_CPU_PROGRAM_MAP(mpu6500_map) +MACHINE_CONFIG_END + +machine_config_constructor amigakbd_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( a500_keyboard ); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( mos6570_036 ) + ROM_REGION(0x800, "mos6570_036", 0) + ROM_LOAD("328191-02.ic1", 0x000, 0x800, CRC(4a3fc332) SHA1(83b21d0c8b93fc9b9b3b287fde4ec8f3badac5a2)) +ROM_END + +const rom_entry *amigakbd_device::device_rom_region() const +{ + return ROM_NAME( mos6570_036 ); +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( a500_us_keyboard ) + PORT_START("special") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, NULL) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Ctrl") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, NULL) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, NULL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + + PORT_START("row_d6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("Unused") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_NAME("Caps Lock") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_d5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("(") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_d4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_d3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_d2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_d1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_d0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_c7") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME(")") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_c6") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_c5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_c4") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_c3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_c2") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Unused") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_c1") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("row_c0") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("Help") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +ioport_constructor amigakbd_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a500_us_keyboard ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// amigakbd_device - constructor +//------------------------------------------------- + +amigakbd_device::amigakbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, AMIGAKBD, "Amiga 500 Keyboard with 6570-036 MPU", tag, owner, clock, "amigakbd", __FILE__), + m_write_kclk(*this), + m_write_kdat(*this), + m_write_krst(*this), + m_mpu(*this, "mos6570_036"), + m_special(*this, "special"), + m_row_d6(*this, "row_d6"), + m_row_d5(*this, "row_d5"), + m_row_d4(*this, "row_d4"), + m_row_d3(*this, "row_d3"), + m_row_d2(*this, "row_d2"), + m_row_d1(*this, "row_d1"), + m_row_d0(*this, "row_d0"), + m_row_c7(*this, "row_c7"), + m_row_c6(*this, "row_c6"), + m_row_c5(*this, "row_c5"), + m_row_c4(*this, "row_c4"), + m_row_c3(*this, "row_c3"), + m_row_c2(*this, "row_c2"), + m_row_c1(*this, "row_c1"), + m_row_c0(*this, "row_c0"), + m_timer(NULL), + m_watchdog(NULL), + m_reset(NULL), + m_kdat(1), + m_kclk(1), + m_port_c(0xff), + m_port_d(0xff), + m_latch(0xffff), + m_counter(0xffff), + m_control(0x00) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void amigakbd_device::device_start() +{ + // resolve callbacks + m_write_kclk.resolve_safe(); + m_write_kdat.resolve_safe(); + m_write_krst.resolve_safe(); + + // allocate timers + m_timer = timer_alloc(0, NULL); + m_watchdog = timer_alloc(1, NULL); + m_reset = timer_alloc(2, NULL); + + // register for save states + save_item(NAME(m_kdat)); + save_item(NAME(m_kclk)); + save_item(NAME(m_port_c)); + save_item(NAME(m_port_d)); + save_item(NAME(m_latch)); + save_item(NAME(m_counter)); + save_item(NAME(m_control)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void amigakbd_device::device_reset() +{ + // stack starts 0 + m_mpu->set_state_int(M6502_S, 0); + + m_kdat = 1; + m_kclk = 1; + m_port_c = 0xff; + m_port_d = 0xff; + m_latch = 0xffff; // not initialized by hardware + m_counter = 0xffff; // not initialized by hardware + m_control = 0x00; + + m_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL_3MHz / 2)); + m_watchdog->adjust(attotime::from_msec(54)); +} + +void amigakbd_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +{ + switch (tid) + { + // 6500/1 internal timer + case 0: + switch (m_control & 0x03) + { + // interval timer, pulse width measurement (connected to gnd here) + case 0: + case 3: + if (m_counter-- == 0) + { + // counter overflow + m_control |= COUNTER_OVERFLOW; + m_counter = m_latch; + + // generate interrupt? + update_irqs(); + } + break; + + // pulse generator + case 1: + break; + + // event counter + case 2: + break; + } + break; + + // watchdog + case 1: + m_mpu->reset(); + m_watchdog->adjust(attotime::from_msec(54)); + break; + + // keyboard reset timer + case 2: + m_write_krst(1); + break; + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +INPUT_CHANGED_MEMBER( amigakbd_device::check_reset ) +{ + UINT8 keys = m_special->read(); + + // ctrl-amiga-amiga pressed? + if (!BIT(keys, 6) && !BIT(keys, 3) && !BIT(keys, 2)) + { + m_write_krst(0); + m_reset->adjust(PERIOD_OF_555_MONOSTABLE(RES_K(47), CAP_U(10))); + } +} + +void amigakbd_device::update_irqs() +{ + if ((m_control & PA1_INT_ENABLED) && (m_control & PA1_NEGATIVE_EDGE)) + m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + + else if ((m_control & PA0_INT_ENABLED) && (m_control & PA0_POSITIVE_EDGE)) + m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + + else if ((m_control & COUNTER_INT_ENABLED) && (m_control & COUNTER_OVERFLOW)) + m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + + else + m_mpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); +} + +READ8_MEMBER( amigakbd_device::port_a_r ) +{ + UINT8 data = 0xfc; + + // kdat & kclk + data |= m_kdat << 0; + data |= m_kclk << 1; + + // port d rows + if (!BIT(m_port_d, 6)) data &= m_row_d6->read(); + if (!BIT(m_port_d, 5)) data &= m_row_d5->read(); + if (!BIT(m_port_d, 4)) data &= m_row_d4->read(); + if (!BIT(m_port_d, 3)) data &= m_row_d3->read(); + if (!BIT(m_port_d, 2)) data &= m_row_d2->read(); + if (!BIT(m_port_d, 1)) data &= m_row_d1->read(); + if (!BIT(m_port_d, 0)) data &= m_row_d0->read(); + + // port c rows + if (!BIT(m_port_c, 7)) data &= m_row_c7->read(); + if (!BIT(m_port_c, 6)) data &= m_row_c6->read(); + if (!BIT(m_port_c, 5)) data &= m_row_c5->read(); + if (!BIT(m_port_c, 4)) data &= m_row_c4->read(); + if (!BIT(m_port_c, 3)) data &= m_row_c3->read(); + if (!BIT(m_port_c, 2)) data &= m_row_c2->read(); + if (!BIT(m_port_c, 1)) data &= m_row_c1->read(); + if (!BIT(m_port_c, 0)) data &= m_row_c0->read(); + + return data; +} + +WRITE8_MEMBER( amigakbd_device::port_a_w ) +{ + // look for pa0 edge + if (!m_kdat && BIT(data, 0)) + { + m_control |= PA0_POSITIVE_EDGE; + update_irqs(); + } + + // and pa1 edge + if (m_kclk && !BIT(data, 1)) + { + m_control |= PA1_NEGATIVE_EDGE; + update_irqs(); + } + + // update with new values and output + if (m_kdat != BIT(data, 0)) + { + m_kdat = BIT(data, 0); + m_write_kdat(m_kdat); + } + + if (m_kclk != BIT(data, 1)) + { + m_kclk = BIT(data, 1); + m_write_kclk(m_kclk); + } +} + +WRITE8_MEMBER( amigakbd_device::port_b_w ) +{ + // caps lock led + output_set_value("led0", BIT(data, 7)); +} + +WRITE8_MEMBER( amigakbd_device::port_c_w ) +{ + m_port_c = data; +} + +WRITE8_MEMBER( amigakbd_device::port_d_w ) +{ + // reset watchdog on 0 -> 1 transition + if (!BIT(m_port_d, 7) && BIT(data, 7)) + m_watchdog->adjust(attotime::from_msec(54)); + + m_port_d = data; +} + +WRITE8_MEMBER( amigakbd_device::latch_w ) +{ + if (offset == 0) + { + m_latch &= 0x00ff; + m_latch |= data << 8; + } + else + { + m_latch &= 0xff00; + m_latch |= data << 0; + } +} + +READ8_MEMBER( amigakbd_device::counter_r ) +{ + if (!space.debugger_access()) + { + m_control &= ~COUNTER_OVERFLOW; + update_irqs(); + } + + if (offset == 0) + return m_counter >> 8; + else + return m_counter >> 0; +} + +WRITE8_MEMBER( amigakbd_device::transfer_latch_w ) +{ + m_control &= ~COUNTER_OVERFLOW; + update_irqs(); + + m_latch &= 0x00ff; + m_latch |= data << 8; + + m_counter = m_latch; +} + +WRITE8_MEMBER( amigakbd_device::clear_pa0_detect ) +{ + m_control &= ~PA0_POSITIVE_EDGE; + update_irqs(); +} + +WRITE8_MEMBER( amigakbd_device::clear_pa1_detect ) +{ + m_control &= ~PA1_NEGATIVE_EDGE; + update_irqs(); +} + +READ8_MEMBER( amigakbd_device::control_r ) +{ + return m_control; +} + +WRITE8_MEMBER( amigakbd_device::control_w ) +{ + m_control = data; + update_irqs(); +} + +WRITE_LINE_MEMBER( amigakbd_device::kdat_w ) +{ + // detect positive edge + if (state && !m_kdat) + { + m_control |= PA0_POSITIVE_EDGE; + update_irqs(); + } + + m_kdat = state; +} diff --git a/src/mame/machine/amigakbd.h b/src/mame/machine/amigakbd.h new file mode 100644 index 00000000000..68ffdb42200 --- /dev/null +++ b/src/mame/machine/amigakbd.h @@ -0,0 +1,144 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + Amiga Keyboard + + We currently emulate the Amiga 500 keyboard controller, which was + also used in later Amiga 2000 keyboards. + +***************************************************************************/ + +#pragma once + +#ifndef __AMIGAKBD_H__ +#define __AMIGAKBD_H__ + +#include "emu.h" +#include "cpu/m6502/m6502.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(_write) \ + devcb = &amigakbd_device::set_kclk_wr_callback(*device, DEVCB_##_write); + +#define MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(_write) \ + devcb = &amigakbd_device::set_kdat_wr_callback(*device, DEVCB_##_write); + +#define MCFG_AMIGA_KEYBOARD_KRST_CALLBACK(_write) \ + devcb = &amigakbd_device::set_krst_wr_callback(*device, DEVCB_##_write); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> amigakbd_device + +class amigakbd_device : public device_t +{ +public: + // construction/destruction + amigakbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_kclk_wr_callback(device_t &device, _Object object) + { return downcast(device).m_write_kclk.set_callback(object); } + template static devcb_base &set_kdat_wr_callback(device_t &device, _Object object) + { return downcast(device).m_write_kdat.set_callback(object); } + template static devcb_base &set_krst_wr_callback(device_t &device, _Object object) + { return downcast(device).m_write_krst.set_callback(object); } + + DECLARE_WRITE_LINE_MEMBER( kdat_w ); + + // 6500/1 internal + DECLARE_READ8_MEMBER( port_a_r ); + DECLARE_WRITE8_MEMBER( port_a_w ); + DECLARE_READ8_MEMBER( port_b_r ); + DECLARE_WRITE8_MEMBER( port_b_w ); + DECLARE_WRITE8_MEMBER( port_c_w ); + DECLARE_WRITE8_MEMBER( port_d_w ); + DECLARE_WRITE8_MEMBER( latch_w ); + DECLARE_READ8_MEMBER( counter_r ); + DECLARE_WRITE8_MEMBER( transfer_latch_w ); + DECLARE_WRITE8_MEMBER( clear_pa0_detect ); + DECLARE_WRITE8_MEMBER( clear_pa1_detect ); + DECLARE_READ8_MEMBER( control_r ); + DECLARE_WRITE8_MEMBER( control_w ); + + DECLARE_INPUT_CHANGED_MEMBER( check_reset ); + +protected: + // device-level overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + enum + { + // counter modes + COUNTER_INTERVAL = 0x00, + COUNTER_PULSE = 0x01, + COUNTER_EVENT = 0x02, + COUNTER_PWM = 0x03, + + // interrupt enables + PA1_INT_ENABLED = 0x04, + PA0_INT_ENABLED = 0x08, + COUNTER_INT_ENABLED = 0x10, + + // status + PA1_NEGATIVE_EDGE = 0x20, + PA0_POSITIVE_EDGE = 0x40, + COUNTER_OVERFLOW = 0x80 + }; + + void update_irqs(); + + devcb_write_line m_write_kclk; + devcb_write_line m_write_kdat; + devcb_write_line m_write_krst; + + required_device m_mpu; + + required_ioport m_special; + required_ioport m_row_d6; + required_ioport m_row_d5; + required_ioport m_row_d4; + required_ioport m_row_d3; + required_ioport m_row_d2; + required_ioport m_row_d1; + required_ioport m_row_d0; + required_ioport m_row_c7; + required_ioport m_row_c6; + required_ioport m_row_c5; + required_ioport m_row_c4; + required_ioport m_row_c3; + required_ioport m_row_c2; + required_ioport m_row_c1; + required_ioport m_row_c0; + + emu_timer *m_timer; + emu_timer *m_watchdog; + emu_timer *m_reset; + + int m_kdat; + int m_kclk; + + UINT8 m_port_c; + UINT8 m_port_d; + UINT16 m_latch; + UINT16 m_counter; + UINT8 m_control; +}; + +// device type definition +extern const device_type AMIGAKBD; + +#endif // __AMIGAKBD_H__ diff --git a/src/mame/machine/amstrad.c b/src/mame/machine/amstrad.c new file mode 100644 index 00000000000..8dbe941af32 --- /dev/null +++ b/src/mame/machine/amstrad.c @@ -0,0 +1,3332 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Barry Rodewald +/*************************************************************************** + + machine.c + + Functions to emulate general aspects of the machine (RAM, ROM, interrupts, + I/O ports) + +Amstrad hardware consists of: + +- General Instruments AY-3-8912 (audio and keyboard scanning) +- Intel 8255PPI (keyboard, access to AY-3-8912, cassette etc) +- Z80A CPU +- 765 FDC (disc drive interface) +- "Gate Array" (custom chip by Amstrad controlling colour, mode, +rom/ram selection + + +On the Amstrad, any part of the 64k memory can be access by the video +hardware (GA and CRTC - the CRTC specifies the memory address to access, +and the GA fetches 2 bytes of data for each 1us cycle. + +The Z80 must also access the same ram. + +To maintain the screen display, the Z80 is halted on each memory access. + +The result is that timing for opcodes, appears to fall into a nice pattern, +where the time for each opcode can be measured in NOP cycles. NOP cycles is +the name I give to the time taken for one NOP command to execute. + +This happens to be 1us. + +From measurement, there are 64 NOPs per line, with 312 lines per screen. +This gives a total of 19968 NOPs per frame. + +***************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/i8255.h" +#include "machine/mc146818.h" +#include "machine/upd765.h" +#include "bus/centronics/ctronics.h" +#include "bus/cpc/cpc_rom.h" +#include "bus/cpc/mface2.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "includes/amstrad.h" +#include "sound/ay8910.h" +#include "machine/ram.h" + +#define MANUFACTURER_NAME 0x07 +#define TV_REFRESH_RATE 0x10 + +enum { + SYSTEM_CPC, + SYSTEM_ALESTE, + SYSTEM_PLUS, + SYSTEM_GX4000 +}; + + +/* originally from drivers/amstrad.c */ +// &ff,&77,&b3,&51,&a8,&d4,&62,&39,&9c,&46,&2b,&15,&8a,&cd,&ee +// This is the sequence for unlocking the ASIC in the CPC+/GX4000 +// These are outed to port &bc00, after syncing the lock by outing a non-zero value then a zero to &bc00 +// To lock the ASIC again, repeat the sequence without the last &ee +static const UINT8 asic_unlock_seq[15] = +{ + 0xff, 0x77, 0xb3, 0x51, 0xa8, 0xd4, 0x62, 0x39, 0x9c, 0x46, 0x2b, 0x15, 0x8a, 0xcd, 0xee +}; + + + + + +/* Ram configuration */ + +/* pointers to current ram configuration selected for banks */ + +/* the hardware allows selection of 256 ROMs. Rom 0 is usually BASIC and Rom 7 is AMSDOS */ +/* With the CPC hardware, if a expansion ROM is not connected, BASIC rom will be selected instead */ +/* data present on input of ppi, and data written to ppi output */ +#define amstrad_ppi_PortA 0 +#define amstrad_ppi_PortB 1 +#define amstrad_ppi_PortC 2 + + + +/*------------------ + - Ram Management - + ------------------*/ +/* There are 8 different ram configurations which work on the currently selected 64k logical block. + The following tables show the possible ram configurations :*/ +static const int RamConfigurations[8 * 4] = +{ + 0, 1, 2, 3, /* config 0 */ + 0, 1, 2, 7, /* config 1 */ + 4, 5, 6, 7, /* config 2 */ + 0, 3, 2, 7, /* config 3 */ + 0, 4, 2, 3, /* config 4 */ + 0, 5, 2, 3, /* config 5 */ + 0, 6, 2, 3, /* config 6 */ + 0, 7, 2, 3 /* config 7 */ +}; + + + +//static int amstrad_CRTC_CR = 0; /* CR = Cursor Enabled */ + +/* this contains the colours in machine.pens form.*/ +/* this is updated from the eventlist and reflects the current state +of the render colours - these may be different to the current colour palette values */ +/* colours can be changed at any time and will take effect immediatly */ + + + +/* The Amstrad CPC has a fixed palette of 27 colours generated from 3 levels of Red, Green and Blue. +The hardware allows selection of 32 colours, but these extra colours are copies of existing colours.*/ + +static const rgb_t amstrad_palette[32] = +{ + rgb_t(0x060, 0x060, 0x060), /* white */ + rgb_t(0x060, 0x060, 0x060), /* white */ + rgb_t(0x000, 0x0ff, 0x060), /* sea green */ + rgb_t(0x0ff, 0x0ff, 0x060), /* pastel yellow */ + rgb_t(0x000, 0x000, 0x060), /* blue */ + rgb_t(0x0ff, 0x000, 0x060), /* purple */ + rgb_t(0x000, 0x060, 0x060), /* cyan */ + rgb_t(0x0ff, 0x060, 0x060), /* pink */ + rgb_t(0x0ff, 0x000, 0x060), /* purple */ + rgb_t(0x0ff, 0x0ff, 0x060), /* pastel yellow */ + rgb_t(0x0ff, 0x0ff, 0x000), /* bright yellow */ + rgb_t(0x0ff, 0x0ff, 0x0ff), /* bright white */ + rgb_t(0x0ff, 0x000, 0x000), /* bright red */ + rgb_t(0x0ff, 0x000, 0x0ff), /* bright magenta */ + rgb_t(0x0ff, 0x060, 0x000), /* orange */ + rgb_t(0x0ff, 0x060, 0x0ff), /* pastel magenta */ + rgb_t(0x000, 0x000, 0x060), /* blue */ + rgb_t(0x000, 0x0ff, 0x060), /* sea green */ + rgb_t(0x000, 0x0ff, 0x000), /* bright green */ + rgb_t(0x000, 0x0ff, 0x0ff), /* bright cyan */ + rgb_t(0x000, 0x000, 0x000), /* black */ + rgb_t(0x000, 0x000, 0x0ff), /* bright blue */ + rgb_t(0x000, 0x060, 0x000), /* green */ + rgb_t(0x000, 0x060, 0x0ff), /* sky blue */ + rgb_t(0x060, 0x000, 0x060), /* magenta */ + rgb_t(0x060, 0x0ff, 0x060), /* pastel green */ + rgb_t(0x060, 0x0ff, 0x060), /* lime */ + rgb_t(0x060, 0x0ff, 0x0ff), /* pastel cyan */ + rgb_t(0x060, 0x000, 0x000), /* Red */ + rgb_t(0x060, 0x000, 0x0ff), /* mauve */ + rgb_t(0x060, 0x060, 0x000), /* yellow */ + rgb_t(0x060, 0x060, 0x0ff) /* pastel blue */ +}; + + +/* the green brightness is equal to the firmware colour index */ +static const rgb_t amstrad_green_palette[32] = +{ + rgb_t(0x000, 0x07F, 0x000), /*13*/ + rgb_t(0x000, 0x07F, 0x000), /*13*/ + rgb_t(0x000, 0x0BA, 0x000), /*19*/ + rgb_t(0x000, 0x0F5, 0x000), /*25*/ + rgb_t(0x000, 0x009, 0x000), /*1*/ + rgb_t(0x000, 0x044, 0x000), /*7*/ + rgb_t(0x000, 0x062, 0x000), /*10*/ + rgb_t(0x000, 0x09C, 0x000), /*16*/ + rgb_t(0x000, 0x044, 0x000), /*7*/ + rgb_t(0x000, 0x0F5, 0x000), /*25*/ + rgb_t(0x000, 0x0EB, 0x000), /*24*/ + rgb_t(0x000, 0x0FF, 0x000), /*26*/ + rgb_t(0x000, 0x03A, 0x000), /*6*/ + rgb_t(0x000, 0x04E, 0x000), /*8*/ + rgb_t(0x000, 0x093, 0x000), /*15*/ + rgb_t(0x000, 0x0A6, 0x000), /*17*/ + rgb_t(0x000, 0x009, 0x000), /*1*/ + rgb_t(0x000, 0x0BA, 0x000), /*19*/ + rgb_t(0x000, 0x0B0, 0x000), /*18*/ + rgb_t(0x000, 0x0C4, 0x000), /*20*/ + rgb_t(0x000, 0x000, 0x000), /*0*/ + rgb_t(0x000, 0x013, 0x000), /*2*/ + rgb_t(0x000, 0x058, 0x000), /*9*/ + rgb_t(0x000, 0x06B, 0x000), /*11*/ + rgb_t(0x000, 0x027, 0x000), /*4*/ + rgb_t(0x000, 0x0D7, 0x000), /*22*/ + rgb_t(0x000, 0x0CD, 0x000), /*21*/ + rgb_t(0x000, 0x0E1, 0x000), /*23*/ + rgb_t(0x000, 0x01D, 0x000), /*3*/ + rgb_t(0x000, 0x031, 0x000), /*5*/ + rgb_t(0x000, 0x075, 0x000), /*12*/ + rgb_t(0x000, 0x089, 0x000) /*14*/ +}; + + +/******************************************************************* + Prototypes +*******************************************************************/ + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(amstrad_state,amstrad_cpc) +{ + palette.set_pen_colors(0, amstrad_palette, ARRAY_LENGTH(amstrad_palette)); +} + + +PALETTE_INIT_MEMBER(amstrad_state,amstrad_cpc_green) +{ + palette.set_pen_colors(0, amstrad_green_palette, ARRAY_LENGTH(amstrad_green_palette)); +} + + +/* Some games set the 8255 to mode 1 and expect a strobe signal */ +/* on PC2. Apparently PC2 is always low on the CPC. ?!? */ +TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_pc2_low) +{ + m_ppi->pc2_w(0); +} + + +void amstrad_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_PC2_LOW: + amstrad_pc2_low(ptr, param); + break; + case TIMER_VIDEO_UPDATE: + amstrad_video_update_timer(ptr, param); + break; + case TIMER_SET_RESOLUTION: + cb_set_resolution(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in amstrad_state::device_timer"); + } +} + + +/*************************************************************************/ +/* KC Compact + +The palette is defined by a colour rom. The only rom dump that exists (from the KC-Club webpage) +is 2K, which seems correct. In this rom the same 32 bytes of data is repeated throughout the rom. + +When a I/O write is made to "Gate Array" to select the colour, Bit 7 and 6 are used by the +"Gate Array" to define the function, bit 7 = 0, bit 6 = 1. In the Amstrad CPC, bits 4..0 +define the hardware colour number, but in the KC Compact, it seems bits 5..0 +define the hardware colour number allowing 64 colours to be chosen. + +It is possible therefore that the colour rom could be reprogrammed, so that other colour +selections could be chosen allowing 64 different colours to be used. But this has not been tested +and co + +colour rom byte: + +Bit Function +7 not used +6 not used +5,4 Green value +3,2 Red value +1,0 Blue value + +Green value, Red value, Blue value: 0 = 0%, 01/10 = 50%, 11 = 100%. +The 01 case is not used, it is unknown if this produces a different amount of colour. +*/ + +unsigned char amstrad_state::kccomp_get_colour_element(int colour_value) +{ + switch (colour_value) + { + case 0: + return 0x00; + case 1: + return 0x60; + case 2: + return 0x60; + case 3: + return 0xff; + } + + return 0xff; +} + + +/* the colour rom has the same 32 bytes repeated, but it might be possible to put a new rom in +with different data and be able to select the other entries - not tested on a real kc compact yet +and not supported by this driver */ +PALETTE_INIT_MEMBER(amstrad_state,kccomp) +{ + const UINT8 *color_prom = memregion("proms")->base(); + int i; + + color_prom = color_prom+0x018000; + + for (i=0; i<32; i++) + { + palette.set_pen_color(i, + kccomp_get_colour_element((color_prom[i]>>2) & 0x03), + kccomp_get_colour_element((color_prom[i]>>4) & 0x03), + kccomp_get_colour_element((color_prom[i]>>0) & 0x03)); + } +} + + +/******************************************** +Amstrad Plus + +The Amstrad Plus has a 4096 colour palette +*********************************************/ + +PALETTE_INIT_MEMBER(amstrad_state,amstrad_plus) +{ + int i; + + palette.set_pen_colors(0, amstrad_palette, ARRAY_LENGTH(amstrad_palette) / 3); + for ( i = 0; i < 0x1000; i++ ) + { + int r, g, b; + + g = ( i >> 8 ) & 0x0f; + r = ( i >> 4 ) & 0x0f; + b = i & 0x0f; + + r = ( r << 4 ) | ( r ); + g = ( g << 4 ) | ( g ); + b = ( b << 4 ) | ( b ); + + palette.set_pen_color(i, r, g, b); + } +} + + +PALETTE_INIT_MEMBER(amstrad_state,aleste) +{ + int i; + + /* CPC Colour data is stored in the colour ROM (RFCOLDAT.BIN) at 0x140-0x17f */ + unsigned char* pal = memregion("user4")->base(); + + for(i=0; i<32; i++) + { + int r,g,b; + + b = (pal[0x140+i] >> 4) & 0x03; + g = (pal[0x140+i] >> 2) & 0x03; + r = pal[0x140+i] & 0x03; + + r = (r << 6); + g = (g << 6); + b = (b << 6); + + palette.set_pen_color(i, r, g, b); + } + + /* MSX colour palette is 6-bit RGB */ + for(i=0; i<64; i++) + { + int r,g,b; + + r = (i >> 4) & 0x03; + g = (i >> 2) & 0x03; + b = i & 0x03; + + r = (r << 6); + g = (g << 6); + b = (b << 6); + + palette.set_pen_color(i+32, r, g, b); + } +} + + +void amstrad_state::amstrad_init_lookups() +{ + int i; + + for ( i = 0; i < 256; i++ ) + { + m_mode0_lookup[i] = ( ( i & 0x80 ) >> 7 ) | ( ( i & 0x20 ) >> 3 ) | ( ( i & 0x08 ) >> 2 ) | ( ( i & 0x02 ) << 2 ); + m_mode1_lookup[i] = ( ( i & 0x80 ) >> 7 ) | ( ( i & 0x08 ) >> 2 ); + m_mode2_lookup[i] = ( ( i & 0x80 ) >> 7 ); + } +} + + +/* Set the new screen mode (0,1,2,4) from the GateArray */ +void amstrad_state::amstrad_vh_update_mode() +{ + if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) + { + /* select a cpc plus mode */ + switch ( m_gate_array.mrer & 0x03 ) + { + case 0: /* Mode 0: 160x200, 16 colours */ + m_gate_array.mode_lookup = m_mode0_lookup; + m_gate_array.max_colour_ticks = 4; + m_gate_array.ticks_increment = 1; + break; + + case 1: /* Mode 1: 320x200, 4 colous */ + m_gate_array.mode_lookup = m_mode1_lookup; + m_gate_array.max_colour_ticks = 2; + m_gate_array.ticks_increment = 1; + break; + + case 2: /* Mode 2: 640x200, 2 colours */ + m_gate_array.mode_lookup = m_mode2_lookup; + m_gate_array.max_colour_ticks = 1; + m_gate_array.ticks_increment = 1; + break; + + case 3: /* Mode 3: 160x200, 4 colours */ + m_gate_array.mode_lookup = m_mode0_lookup; + m_gate_array.max_colour_ticks = 4; + m_gate_array.ticks_increment = 1; + break; + } + } + else + { + if ( m_aleste_mode & 0x02 ) + { + /* select an aleste mode */ + switch ( m_gate_array.mrer & 0x03 ) + { + case 0: /* Aleste Mode 0 (= Amstrad CPC mode 2): 640x200, 2 colours */ + m_gate_array.mode_lookup = m_mode2_lookup; + m_gate_array.max_colour_ticks = 1; + m_gate_array.ticks_increment = 1; + break; + + case 1: /* Aleste mode 1 (= Amstrad CPC mode 1): 320x200, 4 colours */ + m_gate_array.mode_lookup = m_mode1_lookup; + m_gate_array.max_colour_ticks = 2; + m_gate_array.ticks_increment = 1; + break; + + case 2: /* Aleste mode 2: 4 colours */ + m_gate_array.mode_lookup = m_mode1_lookup; + m_gate_array.max_colour_ticks = 1; + m_gate_array.ticks_increment = 2; + break; + + case 3: /* Aleste mode 3: 16 colours */ + m_gate_array.mode_lookup = m_mode0_lookup; + m_gate_array.max_colour_ticks = 2; + m_gate_array.ticks_increment = 2; + break; + } + } + else + { + /* select an original cpc mode */ + switch ( m_gate_array.mrer & 0x03 ) + { + case 0: /* Mode 0: 160x200, 16 colours */ + m_gate_array.mode_lookup = m_mode0_lookup; + m_gate_array.max_colour_ticks = 4; + m_gate_array.ticks_increment = 1; + break; + + case 1: /* Mode 1: 320x200, 4 colous */ + m_gate_array.mode_lookup = m_mode1_lookup; + m_gate_array.max_colour_ticks = 2; + m_gate_array.ticks_increment = 1; + break; + + case 2: /* Mode 2: 640x200, 2 colours */ + m_gate_array.mode_lookup = m_mode2_lookup; + m_gate_array.max_colour_ticks = 1; + m_gate_array.ticks_increment = 1; + break; + + case 3: /* Mode 3: 160x200, 4 colours */ + m_gate_array.mode_lookup = m_mode0_lookup; + m_gate_array.max_colour_ticks = 4; + m_gate_array.ticks_increment = 1; + break; + } + } + } +} + + +/* +DMA commands + +0RDDh LOAD R,D Load 8 bit data D to PSG register R (0<=R<=15) +1NNNh PAUSE N Pause for N prescaled ticks (0pointer()[m_asic.dma_addr[channel]+1] << 8) + m_ram->pointer()[m_asic.dma_addr[channel]]; +// logerror("DMA #%i: address %04x: command %04x\n",channel,m_asic.dma_addr[channel],command); + switch (command & 0xf000) + { + case 0x0000: // Load PSG register + { + m_ay->address_w(generic_space(), 0, (command & 0x0f00) >> 8); + m_ay->data_w(generic_space(), 0, command & 0x00ff); + m_ay->address_w(generic_space(), 0, m_prev_reg); + } + logerror("DMA %i: LOAD %i, %i\n",channel,(command & 0x0f00) >> 8, command & 0x00ff); + break; + case 0x1000: // Pause for n HSYNCs (0 - 4095) + m_asic.dma_pause[channel] = (command & 0x0fff) - 1; + logerror("DMA %i: PAUSE %i\n",channel,command & 0x0fff); + break; + case 0x2000: // Beginning of repeat loop + m_asic.dma_repeat[channel] = m_asic.dma_addr[channel]; + m_asic.dma_loopcount[channel] = (command & 0x0fff); + logerror("DMA %i: REPEAT %i\n",channel,command & 0x0fff); + break; + case 0x4000: // Control functions + if (command & 0x01) // Loop back to last Repeat instruction + { + if (m_asic.dma_loopcount[channel] > 0) + { + m_asic.dma_addr[channel] = m_asic.dma_repeat[channel]; + logerror("DMA %i: LOOP (%i left)\n",channel,m_asic.dma_loopcount[channel]); + m_asic.dma_loopcount[channel]--; + } + else + logerror("DMA %i: LOOP (end)\n",channel); + } + if (command & 0x10) // Cause interrupt + { + m_plus_irq_cause = channel * 2; + m_asic.ram[0x2c0f] |= (0x40 >> channel); + m_maincpu->set_input_line(0, ASSERT_LINE); + logerror("DMA %i: INT\n",channel); + } + if (command & 0x20) // Stop processing on this channel + { + m_asic.dma_status &= ~(0x01 << channel); + logerror("DMA %i: STOP\n",channel); + } + break; + default: + logerror("DMA: Unknown DMA command - %04x - at address &%04x\n",command,m_asic.dma_addr[channel]); + } + m_asic.dma_addr[channel] += 2; // point to next DMA instruction +} + + +void amstrad_state::amstrad_plus_handle_dma() +{ + if ( m_asic.dma_status & 0x01 ) // DMA channel 0 + { + amstrad_plus_dma_parse( 0 ); + } + + if ( m_asic.dma_status & 0x02 ) // DMA channel 1 + { + amstrad_plus_dma_parse( 1 ); + } + + if ( m_asic.dma_status & 0x04 ) // DMA channel 2 + { + amstrad_plus_dma_parse( 2 ); + } +} + +TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_video_update_timer) +{ + if(param == 1) + { + amstrad_plus_update_video(); + } + else + { + amstrad_update_video(); + } +} + +/* Set the new colour from the GateArray */ +void amstrad_state::amstrad_vh_update_colour(int PenIndex, UINT16 hw_colour_index) +{ + if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) + { + int val; + + timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1); + + /* CPC+/GX4000 - normal palette changes through the Gate Array also makes the corresponding change in the ASIC palette */ + val = (amstrad_palette[hw_colour_index] & 0xf00000) >> 16; /* red */ + val |= (amstrad_palette[hw_colour_index] & 0x0000f0) >> 4; /* blue */ + m_asic.ram[0x2400+PenIndex*2] = val; + val = (amstrad_palette[hw_colour_index] & 0x00f000) >> 12; /* green */ + m_asic.ram[0x2401+PenIndex*2] = val; + } + else + { + timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); + } + m_GateArray_render_colours[PenIndex] = hw_colour_index; +} + + +void amstrad_state::aleste_vh_update_colour(int PenIndex, UINT16 hw_colour_index) +{ + timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); + m_GateArray_render_colours[PenIndex] = hw_colour_index+32; +} + + +void amstrad_state::amstrad_gate_array_get_video_data() +{ + if ( m_aleste_mode & 0x02 ) + { + m_gate_array.address = ( ( m_gate_array.ma & 0x2000 ) << 2 ) | ( ( m_gate_array.ra & 0x06 ) << 11 ) | ( ( m_gate_array.ra & 0x01 ) << 14 ) | ( ( m_gate_array.ma & 0x7ff ) << 1 ); + } + else + { + m_gate_array.address = ( ( m_gate_array.ma & 0x3000 ) << 2 ) | ( ( m_gate_array.ra & 0x07 ) << 11 ) | ( ( m_gate_array.ma & 0x3ff ) << 1 ); + } + m_gate_array.data = m_ram->pointer()[ m_gate_array.address ]; + m_gate_array.colour = m_GateArray_render_colours[ m_gate_array.mode_lookup[m_gate_array.data] ]; + m_gate_array.colour_ticks = m_gate_array.max_colour_ticks; + m_gate_array.ticks = 0; +} + + +void amstrad_state::amstrad_update_video() +{ + attotime now = machine().time(); + + + if ( m_gate_array.draw_p ) + { + UINT32 cycles_passed = (now - m_gate_array.last_draw_time ).as_ticks(XTAL_16MHz); + + while( cycles_passed ) + { + if ( ! m_gate_array.de || ( ( m_aleste_mode & 0x02 ) && ! ( m_aleste_mode & 0x08 ) ) ) + { + *m_gate_array.draw_p = m_GateArray_render_colours[ 16 ]; + } + else + { + *m_gate_array.draw_p = m_gate_array.colour; + m_gate_array.colour_ticks--; + if ( ! m_gate_array.colour_ticks ) + { + m_gate_array.data <<= 1; + m_gate_array.colour = m_GateArray_render_colours[ m_gate_array.mode_lookup[m_gate_array.data] ]; + m_gate_array.colour_ticks = m_gate_array.max_colour_ticks; + } + m_gate_array.ticks += m_gate_array.ticks_increment; + switch( m_gate_array.ticks) + { + case 8: + m_gate_array.data = m_ram->pointer()[ m_gate_array.address + 1 ]; + m_gate_array.colour = m_GateArray_render_colours[ m_gate_array.mode_lookup[m_gate_array.data] ]; + break; + case 16: + m_gate_array.ma += 1; /* If we were synced with the 6845 mc6845_get_ma should return this value */ + amstrad_gate_array_get_video_data(); + break; + } + } + m_gate_array.draw_p++; + cycles_passed--; + m_gate_array.line_ticks++; + if ( m_gate_array.line_ticks > m_gate_array.bitmap->width() ) + { + m_gate_array.draw_p = NULL; + cycles_passed = 0; + } + } + } + + m_gate_array.last_draw_time = now; +} + + +void amstrad_state::amstrad_plus_gate_array_get_video_data() +{ + UINT16 caddr; + UINT16 ma = ( m_gate_array.ma - m_asic.split_ma_started ) + m_asic.split_ma_base; + UINT16 ra = m_gate_array.ra + ( ( m_asic.ram[0x2804] >> 4 ) & 0x07 ); + + if ( ra > 7 ) + { + ma += m_asic.horiz_disp; + } + m_gate_array.address = ( ( ma & 0x3000 ) << 2 ) | ( ( m_gate_array.ra & 0x07 ) << 11 ) | ( ( ma & 0x3ff ) << 1 ); + m_gate_array.data = m_ram->pointer()[ m_gate_array.address ]; + caddr = 0x2400 + m_gate_array.mode_lookup[m_gate_array.data] * 2; + m_gate_array.colour = m_asic.ram[caddr] + ( m_asic.ram[caddr+1] << 8 ); + m_gate_array.colour_ticks = m_gate_array.max_colour_ticks; + m_gate_array.ticks = 0; +} + + +void amstrad_state::amstrad_plus_update_video() +{ + attotime now = machine().time(); + + if ( m_gate_array.draw_p ) + { + UINT32 cycles_passed = (now - m_gate_array.last_draw_time ).as_ticks(XTAL_16MHz); + + while( cycles_passed ) + { + if ( ! m_gate_array.de ) + { + *m_gate_array.draw_p = m_asic.ram[0x2420] + ( m_asic.ram[0x2421] << 8 ); + } + else + { + *m_gate_array.draw_p = m_gate_array.colour; + + if ( m_asic.hscroll ) + { + m_asic.hscroll--; + if ( m_asic.hscroll == 0 ) + amstrad_plus_gate_array_get_video_data(); + } + else + { + m_gate_array.colour_ticks--; + if ( ! m_gate_array.colour_ticks ) + { + UINT16 caddr; + + m_gate_array.data <<= 1; + caddr = 0x2400 + m_gate_array.mode_lookup[m_gate_array.data] * 2; + m_gate_array.colour = m_asic.ram[caddr] + ( m_asic.ram[caddr+1] << 8 ); + m_gate_array.colour_ticks = m_gate_array.max_colour_ticks; + } + m_gate_array.ticks += m_gate_array.ticks_increment; + switch( m_gate_array.ticks) + { + case 8: + { + UINT16 caddr; + + m_gate_array.data = m_ram->pointer()[ m_gate_array.address + 1 ]; + caddr = 0x2400 + m_gate_array.mode_lookup[m_gate_array.data] * 2; + m_gate_array.colour = m_asic.ram[caddr] + ( m_asic.ram[caddr+1] << 8 ); + } + break; + case 16: + m_gate_array.ma += 1; /* If we were synced with the 6845 mc6845_get_ma should return this value */ + amstrad_plus_gate_array_get_video_data(); + break; + } + } + } + m_gate_array.draw_p++; + cycles_passed--; + m_gate_array.line_ticks++; + if ( m_gate_array.line_ticks >= m_gate_array.bitmap->width() ) + { + m_gate_array.draw_p = NULL; + cycles_passed = 0; + } + } + } + + m_gate_array.last_draw_time = now; +} + + +void amstrad_state::amstrad_plus_update_video_sprites() +{ + UINT16 *p = &m_gate_array.bitmap->pix16(m_gate_array.y, m_asic.h_start ); + int i; + + if ( m_gate_array.y < 0 ) + return; + + for ( i = 15 * 8; i >= 0; i -= 8 ) + { + UINT8 xmag = ( m_asic.ram[ 0x2000 + i + 4 ] >> 2 ) & 0x03; + UINT8 ymag = m_asic.ram[ 0x2000 + i + 4 ] & 0x03; + + /* Check if sprite is enabled */ + if ( xmag && ymag ) + { + INT16 spr_x = m_asic.ram[ 0x2000 + i ] + ( m_asic.ram[ 0x2001 + i ] << 8 ); + INT16 spr_y = m_asic.ram[ 0x2002 + i ] + ( m_asic.ram[ 0x2003 + i ] << 8 ); + + xmag -= 1; + ymag -= 1; + + /* Check if sprite would appear on this scanline */ + if ( spr_y <= m_asic.vpos && m_asic.vpos < spr_y + ( 16 << ymag ) && spr_x < ( m_asic.h_end - m_asic.h_start ) && spr_x + ( 16 << xmag ) > 0 ) + { + UINT16 spr_addr = i * 32 + ( ( ( m_asic.vpos - spr_y ) >> ymag ) * 16 ); + int j, k; + + for ( j = 0; j < 16; j++ ) + { + for ( k = 0; k < ( 1 << xmag ); k++ ) + { + INT16 x = spr_x + ( j << xmag ) + k; + + if ( x >= 0 && x < ( m_asic.h_end - m_asic.h_start ) ) + { + UINT8 spr_col = ( m_asic.ram[ spr_addr + j ] & 0x0f ) * 2; + + if ( spr_col ) + p[x] = m_asic.ram[ 0x2420 + spr_col ] + ( m_asic.ram[ 0x2421 + spr_col ] << 8 ); + } + } + } + } + } + } +} + + +WRITE_LINE_MEMBER(amstrad_state::amstrad_hsync_changed) +{ + amstrad_update_video(); + + /* The gate array reacts to de-assertion of the hsycnc 6845 line */ + if ( m_gate_array.hsync && !state ) + { + m_gate_array.hsync_counter++; + /* Advance to next drawing line */ + m_gate_array.y++; + m_gate_array.line_ticks = 0; + if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) + { + m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); + } + else + { + m_gate_array.draw_p = NULL; + } + + if ( m_gate_array.hsync_after_vsync_counter != 0 ) // counters still operate regardless of PRI state + { + m_gate_array.hsync_after_vsync_counter--; + + if (m_gate_array.hsync_after_vsync_counter == 0) + { + if (m_gate_array.hsync_counter >= 32) + { + m_maincpu->set_input_line(0, ASSERT_LINE); + } + m_gate_array.hsync_counter = 0; + } + } + + if ( m_gate_array.hsync_counter >= 52 ) + { + m_gate_array.hsync_counter = 0; + m_maincpu->set_input_line(0, ASSERT_LINE); + } + } + m_gate_array.hsync = state ? 1 : 0; +} + + +WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_hsync_changed) +{ + amstrad_plus_update_video(); + + if ( m_gate_array.hsync && !state ) + { + m_gate_array.hsync_counter++; + /* Advance to next drawing line */ + m_gate_array.y++; + m_gate_array.line_ticks = 0; + if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) + { + m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); + } + else + { + m_gate_array.draw_p = NULL; + } + + if ( m_gate_array.hsync_after_vsync_counter != 0 ) // counters still operate regardless of PRI state + { + m_gate_array.hsync_after_vsync_counter--; + + if (m_gate_array.hsync_after_vsync_counter == 0) + { + if (m_gate_array.hsync_counter >= 32) + { + if( m_asic.pri == 0 || m_asic.enabled == 0) + { + m_maincpu->set_input_line(0, ASSERT_LINE); + } + } + m_gate_array.hsync_counter = 0; + } + } + + if ( m_gate_array.hsync_counter >= 52 ) + { + m_gate_array.hsync_counter = 0; + if ( m_asic.pri == 0 || m_asic.enabled == 0 ) + { + m_maincpu->set_input_line(0, ASSERT_LINE); + } + } + + if ( m_asic.enabled ) + { + // CPC+/GX4000 Programmable Raster Interrupt (disabled if &6800 in ASIC RAM is 0) + if ( m_asic.pri != 0 ) + { + if ( m_asic.pri == m_asic.vpos - 1 ) + { + logerror("PRI: triggered, scanline %d\n",m_asic.pri); + m_maincpu->set_input_line(0, ASSERT_LINE); + m_plus_irq_cause = 0x06; // raster interrupt vector + m_gate_array.hsync_counter &= ~0x20; // ASIC PRI resets the MSB of the raster counter + } + } + // CPC+/GX4000 Split screen registers (disabled if &6801 in ASIC RAM is 0) + if(m_asic.ram[0x2801] != 0) + { + if ( m_asic.ram[0x2801] == m_asic.vpos - 1 ) // split occurs here (hopefully) + { + logerror("SSCR: Split screen occurred at scanline %d\n",m_asic.ram[0x2801]); + } + } + // CPC+/GX4000 DMA channels + amstrad_plus_handle_dma(); // a DMA command is handled at the leading edge of HSYNC (every 64us) + m_asic.vpos++; + } + } + m_gate_array.hsync = state ? 1 : 0; +} + + +WRITE_LINE_MEMBER(amstrad_state::amstrad_vsync_changed) +{ + amstrad_update_video(); + + if ( ! m_gate_array.vsync && state ) + { + /* Reset the amstrad_CRTC_HS_After_VS_Counter */ + m_gate_array.hsync_after_vsync_counter = 3; + + /* Start of new frame */ + m_gate_array.y = -1; + m_asic.de_start = 0; + } + + m_gate_array.vsync = state ? 1 : 0; + + /* Schedule a write to PC2 */ + timer_set(attotime::zero, TIMER_PC2_LOW); +} + + +WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_vsync_changed) +{ + amstrad_plus_update_video(); + + if ( ! m_gate_array.vsync && state ) + { + /* Reset the amstrad_CRTC_HS_After_VS_Counter */ + m_gate_array.hsync_after_vsync_counter = 3; + + /* Start of new frame */ + m_gate_array.y = -1; + m_asic.de_start = 0; + } + + m_gate_array.vsync = state ? 1 : 0; + + /* Schedule a write to PC2 */ + timer_set(attotime::zero, TIMER_PC2_LOW); +} + + +WRITE_LINE_MEMBER(amstrad_state::amstrad_de_changed) +{ + amstrad_update_video(); + + if ( ! m_gate_array.de && state ) + { + /* DE became active, store the starting MA and RA signals */ + mc6845_device *mc6845 = m_crtc; + + if(m_asic.de_start == 0) + m_asic.vpos = 1; + + m_gate_array.ma = mc6845->get_ma(); + m_gate_array.ra = mc6845->get_ra(); +//logerror("y = %d; ma = %02x; ra = %02x, address = %04x\n", m_gate_array.y, m_gate_array.ma, m_gate_array.ra, ( ( m_gate_array.ma & 0x3000 ) << 2 ) | ( ( m_gate_array.ra & 0x07 ) << 11 ) | ( ( m_gate_array.ma & 0x3ff ) << 1 ) ); + amstrad_gate_array_get_video_data(); + m_asic.de_start = 1; + } + + m_gate_array.de = state ? 1 : 0; +} + + +WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_de_changed) +{ + amstrad_plus_update_video(); + + if ( ! m_gate_array.de && state ) + { + /* DE became active, store the starting MA and RA signals */ + m_gate_array.ma = m_crtc->get_ma(); + m_gate_array.ra = m_crtc->get_ra(); + m_asic.h_start = m_gate_array.line_ticks; + if(m_asic.de_start == 0) + m_asic.vpos = 1; + m_asic.de_start = 1; + + /* Start of screen */ + if ( m_asic.vpos == 1 ) + { + m_asic.split_ma_base = 0x0000; + m_asic.split_ma_started = 0x0000; + } + /* Start of split screen section */ + else if ( m_asic.enabled && m_asic.ram[0x2801] != 0 && m_asic.ram[0x2801] == m_asic.vpos - 1 ) + { + m_asic.split_ma_started = m_gate_array.ma; + m_asic.split_ma_base = ( m_asic.ram[0x2802] << 8 ) | m_asic.ram[0x2803]; + } + + m_gate_array.colour = m_asic.ram[0x2420] + ( m_asic.ram[0x2421] << 8 ); + m_asic.hscroll = m_asic.ram[0x2804] & 0x0f; + + if ( m_asic.hscroll == 0 ) + amstrad_plus_gate_array_get_video_data(); + } + + if ( m_gate_array.de && ! state ) + { + m_asic.h_end = m_gate_array.line_ticks; + amstrad_plus_update_video_sprites(); + } + + m_gate_array.de = state ? 1 : 0; +} + + +VIDEO_START_MEMBER(amstrad_state,amstrad) +{ + amstrad_init_lookups(); + + m_gate_array.bitmap = auto_bitmap_ind16_alloc( machine(), m_screen->width(), m_screen->height() ); + m_gate_array.hsync_after_vsync_counter = 3; +} + + +UINT32 amstrad_state::screen_update_amstrad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap( bitmap, *m_gate_array.bitmap, 0, 0, 0, 0, cliprect ); + return 0; +} + + +/* traverses the daisy-chain of expansion devices, looking for the specified device */ +static device_t* get_expansion_device(running_machine &machine, const char* tag) +{ + amstrad_state *state = machine.driver_data(); + cpc_expansion_slot_device* exp_port = state->m_exp; + + while(exp_port != NULL) + { + device_t* temp; + + // first, check if this expansion port has the device we want attached + temp = exp_port->subdevice(tag); + if(temp != NULL) + return temp; + + // if it's not what we're looking for, then check the expansion port on this expansion device. if it exists. + temp = dynamic_cast(exp_port->get_card_device()); + if(temp == NULL) + return NULL; // no device attached + exp_port = temp->subdevice("exp"); + if(exp_port == NULL) + return NULL; // we're at the end of the chain + } + return NULL; +} + +WRITE_LINE_MEMBER(amstrad_state::cpc_romdis) +{ + m_gate_array.romdis = state; + amstrad_rethinkMemory(); +} + + +/*-------------------------- + - Ram and Rom management - + --------------------------*/ +/*----------------- + - Set Lower Rom - + -----------------*/ +void amstrad_state::amstrad_setLowerRom() +{ + UINT8 *bank_base; + + /* b2 : "1" Lower rom area disable or "0" Lower rom area enable */ + if ( m_system_type == SYSTEM_CPC || m_system_type == SYSTEM_ALESTE ) + { + if ((m_gate_array.mrer & (1<<2)) == 0 && m_gate_array.romdis == 0) + { + bank_base = &m_region_maincpu->base()[0x010000]; + } + else + { + if(m_aleste_mode & 0x04) + bank_base = m_Aleste_RamBanks[0]; + else + bank_base = m_AmstradCPC_RamBanks[0]; + } + m_bank1->set_base(bank_base); + m_bank2->set_base(bank_base+0x02000); + } + else // CPC+/GX4000 + { + //address_space &space = state->m_maincpu->space(AS_PROGRAM); + +/* if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) + { + space.install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),this)); + space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),this)); + space.install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),this)); + space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this)); + } + else + { + space.install_read_bank(0x4000, 0x5fff, "bank3"); + space.install_read_bank(0x6000, 0x7fff, "bank4"); + space.install_write_bank(0x4000, 0x5fff, "bank11"); + space.install_write_bank(0x6000, 0x7fff, "bank12"); + } +*/ + if(m_AmstradCPC_RamBanks[0] != NULL) + { + m_bank1->set_base(m_AmstradCPC_RamBanks[0]); + m_bank2->set_base(m_AmstradCPC_RamBanks[0]+0x2000); + m_bank3->set_base(m_AmstradCPC_RamBanks[1]); + m_bank4->set_base(m_AmstradCPC_RamBanks[1]+0x2000); + m_bank5->set_base(m_AmstradCPC_RamBanks[2]); + m_bank6->set_base(m_AmstradCPC_RamBanks[2]+0x2000); + } + + if ( (m_gate_array.mrer & (1<<2)) == 0 && m_gate_array.romdis == 0) + { // ASIC secondary lower ROM selection (bit 5: 1 = enabled) + if ( m_asic.enabled ) + { +// logerror("L-ROM: Lower ROM enabled, cart bank %i\n", m_asic.rmr2 & 0x07 ); + bank_base = &m_region_cart->base()[0x4000 * (m_asic.rmr2 & 0x07)]; + switch( m_asic.rmr2 & 0x18 ) + { + case 0x00: +// logerror("L-ROM: located at &0000\n"); + m_bank1->set_base(bank_base); + m_bank2->set_base(bank_base+0x02000); + break; + case 0x08: +// logerror("L-ROM: located at &4000\n"); + m_bank3->set_base(bank_base); + m_bank4->set_base(bank_base+0x02000); + break; + case 0x10: +// logerror("L-ROM: located at &8000\n"); + m_bank5->set_base(bank_base); + m_bank6->set_base(bank_base+0x02000); + break; + case 0x18: +// logerror("L-ROM: located at &0000, ASIC registers enabled\n"); + m_bank1->set_base(bank_base); + m_bank2->set_base(bank_base+0x02000); + break; + } + } + else + { + m_bank1->set_base(m_region_cart->base()); + m_bank2->set_base(m_region_cart->base() + 0x2000); + } + } + } +} + + +/*----------------- + - Set Upper Rom - + -----------------*/ +void amstrad_state::amstrad_setUpperRom() +{ + UINT8 *bank_base = NULL; + + /* b3 : "1" Upper rom area disable or "0" Upper rom area enable */ + if ( ! ( m_gate_array.mrer & 0x08 ) && m_gate_array.romdis == 0) + { + bank_base = m_Amstrad_ROM_Table[ m_gate_array.upper_bank ]; + } + else + { + if(m_aleste_mode & 0x04) + bank_base = m_Aleste_RamBanks[3]; + else + bank_base = m_AmstradCPC_RamBanks[3]; + } + + if (bank_base) + { + m_bank7->set_base(bank_base); + m_bank8->set_base(bank_base+0x2000); + } +} + + +/*-------------------------- + - Ram and Rom management - + --------------------------*/ + +/* simplified ram configuration - e.g. only correct for 128k machines + +RAM Expansion Bits + 7 6 5 4 3 2 1 0 +CPC6128 1 1 - - - s2 s1 s0 +Dk'tronics 256K Silicon Disk 1 1 1 b1 b0 b2 - - + +"-" - this bit is ignored. The value of this bit is not important. +"0" - this bit must be set to "0" +"1" - this bit must be set to "1" +"b0,b1,b2" - this bit is used to define the logical 64k block that the ram configuration uses +"s0,s1,s2" - this bit is used to define the ram configuration + +The CPC6128 has a 64k ram expansion built-in, giving 128K of RAM in this system. +In the CPC464,CPC664 and KC compact if a ram expansion is not present, then writing to this port has no effect and the ram will be in the same arrangement as if configuration 0 had been selected. +*/ +void amstrad_state::AmstradCPC_GA_SetRamConfiguration() +{ + int ConfigurationIndex = m_GateArray_RamConfiguration & 0x07; + int BankIndex,i; + unsigned char *BankAddr; + UINT8 banknum = (m_GateArray_RamConfiguration & 0x38) >> 3; + +/* if b5 = 0 */ + if(m_ram->size() > 65536) + { + for (i=0;i<4;i++) + { + BankIndex = RamConfigurations[(ConfigurationIndex << 2) + i]; + if(BankIndex > 3) + { + UINT8 maxbank = ((m_ram->size()-65536) / 65536); + BankAddr = m_ram->pointer() + (BankIndex << 14) + ((banknum%maxbank)*0x10000); + } + else + BankAddr = m_ram->pointer() + (BankIndex << 14); + m_Aleste_RamBanks[i] = BankAddr; + m_AmstradCPC_RamBanks[i] = BankAddr; + } + } + else + { + // set normal 64k RAM mapping + for (i=0;i<4;i++) + { + BankAddr = m_ram->pointer() + (i << 14); + m_Aleste_RamBanks[i] = BankAddr; + m_AmstradCPC_RamBanks[i] = BankAddr; + } + } + amstrad_rethinkMemory(); +} + + +/* ASIC RAM */ +/* + ASIC RAM Layout. Always is mapped to &4000-&7fff + + Hardware sprites: 16 sprites, 16x16, basic zooming, 15 colour (12-bit palette) + Pixel data is 0 - 15 for sprite pen number, low 4 bits + &4000 - &400f Pixel data for first line of first sprite + &4010 - &401f Pixel data for second line of first sprite + ... ... + &40f0 - &40ff Pixel data for last (16th) line of first sprite + ... ... + &4100 - &41ff Pixel data for second sprite + &4200 - &42ff Third sprite + ... ... + &4f00 - &4fff Pixel data for last (16th) sprite + + &6000 - &607f Sprite properties (8 bytes each) + +0 Sprite X position LSB + +1 Sprite X position MSB + +2 Sprite Y position LSB (scanline) + +3 Sprite Y position MSB + +4 Sprite zoom - bits 3,2 X magnification, bits 1,0 Y magnification + Magnification: 00 = not displayed, 01 = x1, 10 = x2, 11 = x4 + + Palette: LSB first, presumably GGGGBBBBxxxxRRRR + &6400 - &641f Pen palette (12bpp, 2 bytes each, 16 total) + &6420 - &6421 Border palette (12bpp, 2 bytes) + &6422 - &643f Hardware sprite palette (12bpp, 2 bytes each, 15 total) + + Programmable Raster Interrupt: + &6800 Scanline for IRQ to be triggered after + If 0, raster interrupts and DMA interrupts occur + Otherwise, the PRI interrupt is triggered only + + Hardware split screen: + &6801 Scanline for split to occur at + &6802 LSB of screen address for split (like reg 12 of the 6845) + &6803 MSB of the above (like reg 13 of the 6845) + + Soft Scroll Control Register: + &6804 bits 3-0 - horizontal delay in mode 2 pixels (shifts display to the right) + bits 6-4 - added to the 3 LSBs for the scanline address (shifts display up) + bit 7 - extends the border by two bytes (16 mode 2 pixels), masking the bad data from the horizontal scroll + + Analogue paddle ports: + &6808 - &680f Analogue input, read-only, 6 bit + + PSG DMA channels: + &6c00 DMA channel 0 address LSB + &6c01 DMA channel 0 address MSB + &6c02 DMA channel 0 prescaler + &6c03 unused + &6c04-7 DMA channel 1 + &6c08-b DMA channel 2 + &6c0f Control and Status register + bit 7 - raster interrupt + bit 6 - DMA channel 0 interrupt + bit 5 - DMA channel 1 interrupt + bit 4 - DMA channel 2 interrupt + bit 3 - unused (write 0) + bit 2 - DMA channel 2 enable + bit 1 - DMA channel 1 enable + bit 0 - DMA channel 0 enable + + */ + +WRITE8_MEMBER(amstrad_state::amstrad_plus_asic_4000_w) +{ +// logerror("ASIC: Write to register at &%04x\n",offset+0x4000); + if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) + m_asic.ram[offset] = data & 0x0f; + else + { + UINT8* RAM = (UINT8*)m_bank11->base(); + RAM[offset] = data; + } +} + + +WRITE8_MEMBER(amstrad_state::amstrad_plus_asic_6000_w) +{ + if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) + { + m_asic.ram[offset+0x2000] = data; + if(offset >= 0x0400 && offset < 0x440 && ( offset & 0x01 ) ) // ASIC palette + { + m_asic.ram[ offset + 0x2000 ] = data & 0x0f; + } + if(offset == 0x0800) // Programmable raster interrupt + { + // logerror("ASIC: Wrote %02x to PRI\n",data); + m_asic.pri = data; + } + if(offset >= 0x0801 && offset <= 0x0803) // Split screen registers + { + logerror("ASIC: Split screen at line %i, address &%04x\n",m_asic.ram[0x2801],m_asic.ram[0x2803] + (m_asic.ram[0x2802] << 8)); + } + if(offset == 0x0804) // Soft scroll register + { + } + if(offset == 0x0805) // Interrupt vector register (for IM 2, used by Pang) + { + // high 5 bits go to interrupt vector + int vector; + + if ( m_asic.enabled ) + { + vector = (data & 0xf8) + (m_plus_irq_cause); + m_maincpu->set_input_line_vector(0, vector); + logerror("ASIC: IM 2 vector write %02x, data = &%02x\n",vector,data); + } + m_asic.dma_clear = data & 0x01; + } + // DMA channels + switch(offset) + { + case 0x0c00: + case 0x0c01: + m_asic.dma_addr[0] = (m_asic.ram[0x2c01] << 8) + m_asic.ram[0x2c00]; + m_asic.dma_status &= ~0x01; + logerror("ASIC: DMA 0 address set to &%04x\n",m_asic.dma_addr[0]); + break; + case 0x0c04: + case 0x0c05: + m_asic.dma_addr[1] = (m_asic.ram[0x2c05] << 8) + m_asic.ram[0x2c04]; + m_asic.dma_status &= ~0x02; + logerror("ASIC: DMA 1 address set to &%04x\n",m_asic.dma_addr[1]); + break; + case 0x0c08: + case 0x0c09: + m_asic.dma_addr[2] = (m_asic.ram[0x2c09] << 8) + m_asic.ram[0x2c08]; + m_asic.dma_status &= ~0x04; + logerror("ASIC: DMA 2 address set to &%04x\n",m_asic.dma_addr[2]); + break; + case 0x0c02: + m_asic.dma_prescaler[0] = data + 1; + logerror("ASIC: DMA 0 pause prescaler set to %i\n",data); + break; + case 0x0c06: + m_asic.dma_prescaler[1] = data + 1; + logerror("ASIC: DMA 1 pause prescaler set to %i\n",data); + break; + case 0x0c0a: + m_asic.dma_prescaler[2] = data + 1; + logerror("ASIC: DMA 2 pause prescaler set to %i\n",data); + break; + case 0x0c0f: + m_asic.dma_status = data; + logerror("ASIC: DMA status write - %02x\n",data); + if(data & 0x40) + { + logerror("ASIC: DMA 0 IRQ acknowledge\n"); + m_maincpu->set_input_line(0, CLEAR_LINE); + m_plus_irq_cause = 0x06; + m_asic.ram[0x2c0f] &= ~0x40; + } + if(data & 0x20) + { + logerror("ASIC: DMA 1 IRQ acknowledge\n"); + m_maincpu->set_input_line(0, CLEAR_LINE); + m_plus_irq_cause = 0x06; + m_asic.ram[0x2c0f] &= ~0x20; + } + if(data & 0x10) + { + logerror("ASIC: DMA 2 IRQ acknowledge\n"); + m_maincpu->set_input_line(0, CLEAR_LINE); + m_plus_irq_cause = 0x06; + m_asic.ram[0x2c0f] &= ~0x10; + } + m_asic.ram[0x2c0f] = (m_asic.ram[0x2c0f] & 0xf8) | (data & 0x07); + break; + } + } + else + { + UINT8* RAM = (UINT8*)m_bank12->base(); + RAM[offset] = data; + } +} + + +READ8_MEMBER(amstrad_state::amstrad_plus_asic_4000_r) +{ +// logerror("RAM: read from &%04x\n",offset+0x4000); + if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) + return m_asic.ram[offset]; + else + { + UINT8* RAM = (UINT8*)m_bank3->base(); + return RAM[offset]; + } +} + + +READ8_MEMBER(amstrad_state::amstrad_plus_asic_6000_r) +{ +// logerror("RAM: read from &%04x\n",offset+0x6000); + if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) + { + // Analogue ports + if(offset >= 0x0808 && offset < 0x080c) + { + return (m_io_analog[offset & 3]->read() & 0x3f); + } + if(offset == 0x080c || offset == 0x080e) + { + return 0x3f; + } + if(offset == 0x080d || offset == 0x080f) + { + return 0x00; + } + #if 0 + if(offset == 0x0c0f) // DMA status and control + { + int result = 0; + if(m_plus_irq_cause == 0x00) + result |= 0x40; + if(m_plus_irq_cause == 0x02) + result |= 0x20; + if(m_plus_irq_cause == 0x04) + result |= 0x10; + if(m_plus_irq_cause == 0x06) + result |= 0x80; + return result; + } + #endif + return m_asic.ram[offset+0x2000]; + } + else + { + UINT8* RAM = (UINT8*)m_bank4->base(); + return RAM[offset]; + } +} + + +/* used for loading snapshot only ! */ +void amstrad_state::AmstradCPC_PALWrite(int data) +{ + if ((data & 0x0c0)==0x0c0) + { + m_GateArray_RamConfiguration = data; + AmstradCPC_GA_SetRamConfiguration(); + } +} + + +/* ------------------- + - the Gate Array - + ------------------- +The gate array is controlled by I/O. The recommended I/O port address is &7Fxx. +The gate array is selected when bit 15 of the I/O port address is set to "0" and bit 14 of the I/O port address is set to "1". +The values of the other bits are ignored. +However, to avoid conflict with other devices in the system, these bits should be set to "1". + +The function to be performed is selected by writing data to the Gate-Array, bit 7 and 6 of the data define the function selected (see table below). +It is not possible to read from the Gate-Array. + +Bit 7 Bit 6 Function +0 0 Select pen +0 1 Select colour for selected pen +1 0 Select screen mode, rom configuration and interrupt control +1 1 Ram Memory Management (note 1) + +Note 1 : This function is not available in the Gate-Array, but is performed by a device at the same I/O port address location. In the CPC464,CPC664 and KC compact, this function is performed in a memory-expansion (e.g. Dk'Tronics 64K Ram Expansion), if this expansion is not present then the function is not available. In the CPC6128, this function is performed by a PAL located on the main PCB, or a memory-expansion. In the 464+ and 6128+ this function is performed by the ASIC or a memory expansion. Please read the document on Ram Management for more information.*/ + + +void amstrad_state::amstrad_GateArray_write(UINT8 dataToGateArray) +{ +/* Get Bit 7 and 6 of the dataToGateArray = Gate Array function selected */ + switch ((dataToGateArray & 0xc0)>>6) + { +/* Pen selection + ------------- +Bit Value Function Bit Value Function +5 x not used 5 x not used +4 1 Select border 4 0 Select pen +3 x | ignored 3 x | Pen Number +2 x | 2 x | +1 x | 1 x | +0 x | 0 x | +*/ + case 0x00: + /* Select Border Number, get b4 */ + /* if b4 = 0 : Select Pen Number, get b3-b0 */ + m_gate_array.pen_selected = ( dataToGateArray & 0x10 ) ? 0x10 : ( dataToGateArray & 0x0f ); + break; + +/* Colour selection + ---------------- +Even though there is provision for 32 colours, only 27 are possible. +The remaining colours are duplicates of those already in the colour palette. + +Bit Value Function +5 x not used +4 x | Colour number +3 x | +2 x | +1 x | +0 x |*/ + case 0x01: + amstrad_vh_update_colour( m_gate_array.pen_selected, (dataToGateArray & 0x1F)); + break; + +/* Select screen mode and rom configuration + ---------------------------------------- +Bit Value Function +5 x not used +4 x Interrupt generation control +3 1 Upper rom area disable or 0 Upper rom area enable +2 1 Lower rom area disable or 0 Lower rom area enable +1 x | Mode selection +0 x | + +Screen mode selection : The settings for bits 1 and 0 and the corresponding screen mode are given in the table below. +----------------------- +b1 b0 Screen mode +0 0 Mode 0, 160x200 resolution, 16 colours +0 1 Mode 1, 320x200 resolution, 4 colours +1 0 Mode 2, 640x200 resolution, 2 colours +1 1 Mode 3, 160x200 resolution, 4 colours (note 1) + +This mode is not official. From the combinations possible, we can see that 4 modes can be defined, although the Amstrad only has 3. Mode 3 is similar to mode 0, because it has the same resolution, but it is limited to only 4 colours. +Mode changing is synchronised with HSYNC. If the mode is changed, it will take effect from the next HSYNC. + +Rom configuration selection : +----------------------------- +Bit 2 is used to enable or disable the lower rom area. The lower rom area occupies memory addressess &0000-&3fff and is used to access the operating system rom. When the lower rom area is is enabled, reading from &0000-&3FFF will return data in the rom. When a value is written to &0000-&3FFF, it will be written to the ram underneath the rom. When it is disabled, data read from &0000-&3FFF will return the data in the ram. +Similarly, bit 3 controls enabling or disabling of the upper rom area. The upper rom area occupies memory addressess &C000-&FFFF and is BASIC or any expansion roms which may be plugged into a rom board/box. See the document on upper rom selection for more details. When the upper rom area enabled, reading from &c000-&ffff, will return data in the rom. When data is written to &c000-&FFFF, it will be written to the ram at the same address as the rom. When the upper rom area is disabled, and data is read from &c000-&ffff the data returned will be the data in the ram. + +Bit 4 controls the interrupt generation. It can be used to delay interrupts.*/ + case 0x02: + /* If bit 5 is enabled on a CPC Plus/GX4000 when the ASIC is unlocked, sets the lower ROM position and cart bank + b5 = 1, b4b3 = RAM position for lower ROM area and if the ASIC registers are visible at &4000, + b2b1b0 = cartridge bank to read from lower ROM area (0-7 only) */ + if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) + { + if ( m_asic.enabled && (dataToGateArray & 0x20) ) + { + m_asic.rmr2 = dataToGateArray; + } + else + { + m_gate_array.mrer = dataToGateArray; + } + } + else + { + m_gate_array.mrer = dataToGateArray; + } + + /* If bit 4 of the "Select screen mode and rom configuration" register of the Gate-Array is set to "1" + then the interrupt request is cleared and the 6-bit counter is reset to "0". */ + if ( m_gate_array.mrer & 0x10 ) + { + m_gate_array.hsync_counter = 0; + m_maincpu->set_input_line(0, CLEAR_LINE); + } + + /* b3b2 != 0 then change the state of upper or lower rom area and rethink memory */ + if (m_exp) + { + if((dataToGateArray & 0x0c) != 0) + m_exp->romen_w(0); // active low + else + m_exp->romen_w(1); + } + + amstrad_setLowerRom(); + amstrad_setUpperRom(); + + /* b1b0 mode */ + amstrad_vh_update_mode(); + + break; + +/* Ram Memory Management + --------------------- +This function is not available in the Gate-Array, but is performed by a device at the same I/O port address location. +In the CPC464,CPC664 and KC compact, this function is performed in a memory-expansion (e.g. Dk'Tronics 64K Ram Expansion), if this expansion is not present then the function is not available. +In the CPC6128, this function is performed by a PAL located on the main PCB, or a memory-expansion. +In the 464+ and 6128+ this function is performed by the ASIC or a memory expansion. +*/ + case 0x03: + m_GateArray_RamConfiguration = dataToGateArray; + break; + + default: + break; + } +} + + +WRITE8_MEMBER(amstrad_state::aleste_msx_mapper) +{ + int page = (offset & 0x0300) >> 8; + int ramptr = (data & 0x3f) * 0x4000; + int rampage = data & 0x3f; + int function = (data & 0xc0) >> 6; + UINT8 *ram = m_ram->pointer(); + + // It is assumed that functions are all mapped to each port &7cff-&7fff, and b8 and b9 are only used for RAM bank location + switch(function) + { + case 0: // Pen select (same as Gate Array?) + amstrad_GateArray_write(data); + break; + case 1: // Colour select (6-bit palette) + aleste_vh_update_colour( m_gate_array.pen_selected, data & 0x3f ); + break; + case 2: // Screen mode, Upper/Lower ROM select + amstrad_GateArray_write(data); + break; + case 3: // RAM banks + switch(page) + { + case 0: /* 0x0000 - 0x3fff */ + m_bank1->set_base(ram+ramptr); + m_bank2->set_base(ram+ramptr+0x2000); + m_bank9->set_base(ram+ramptr); + m_bank10->set_base(ram+ramptr+0x2000); + m_Aleste_RamBanks[0] = ram+ramptr; + m_aleste_active_page[0] = data; + logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x0000\n",ramptr,rampage); + break; + case 1: /* 0x4000 - 0x7fff */ + m_bank3->set_base(ram+ramptr); + m_bank4->set_base(ram+ramptr+0x2000); + m_bank11->set_base(ram+ramptr); + m_bank12->set_base(ram+ramptr+0x2000); + m_Aleste_RamBanks[1] = ram+ramptr; + m_aleste_active_page[1] = data; + logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x4000\n",ramptr,rampage); + break; + case 2: /* 0x8000 - 0xbfff */ + m_bank5->set_base(ram+ramptr); + m_bank6->set_base(ram+ramptr+0x2000); + m_bank13->set_base(ram+ramptr); + m_bank14->set_base(ram+ramptr+0x2000); + m_Aleste_RamBanks[2] = ram+ramptr; + m_aleste_active_page[2] = data; + logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x8000\n",ramptr,rampage); + break; + case 3: /* 0xc000 - 0xffff */ + m_bank7->set_base(ram+ramptr); + m_bank8->set_base(ram+ramptr+0x2000); + m_bank15->set_base(ram+ramptr); + m_bank16->set_base(ram+ramptr+0x2000); + m_Aleste_RamBanks[3] = ram+ramptr; + m_aleste_active_page[3] = data; + logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0xc000\n",ramptr,rampage); + break; + } + break; + } +} + + +/* CRTC Differences + ---------------- +The following tables list the functions that can be accessed for each type: + +Type 0 +b1 b0 Function Read/Write +0 0 Select internal 6845 register Write Only +0 1 Write to selected internal 6845 register Write Only +1 0 - - +1 1 Read from selected internal 6845 register Read only + +Type 1 +b1 b0 Function Read/Write +0 0 Select internal 6845 register Write Only +0 1 Write to selected internal 6845 register Write Only +1 0 Read Status Register Read Only +1 1 Read from selected internal 6845 register Read only + +Type 2 +b1 b0 Function Read/Write +0 0 Select internal 6845 register Write Only +0 1 Write to selected internal 6845 register Write Only +1 0 - - +1 1 Read from selected internal 6845 register Read only + +Type 3 and 4 +b1 b0 Function Read/Write +0 0 Select internal 6845 register Write Only +0 1 Write to selected internal 6845 register Write Only +1 0 Read from selected internal 6845 register Read Only +1 1 Read from selected internal 6845 register Read only +*/ + +/* I/O port allocation + ------------------- + +Many thanks to Mark Rison for providing the original information. Thankyou to Richard Wilson for his discoveries concerning RAM management I/O decoding. + +This document will explain the decoding of the I/O ports. The port address is not decoded fully which means a hardware device can be accessed through more than one address, in addition, using some addressess can access more than one element of the hardware at the same time. The CPC IN/OUT design differs from the norm in that port numbers are defined using 16 bits, as opposed to the traditional 8 bits. + +IN r,(C)/OUT (C),r instructions: Bits b15-b8 come from the B register, bits b7-b0 come from "r" +IN A,(n)/OUT (n),A instructions: Bits b15-b8 come from the A register, bits b7-b0 come from "n" +Listed below are the internal hardware devices and the bit fields to which they respond. In the table: + +"-" means this bit is ignored, +"0" means the bit must be set to "0" for the hardware device to respond, +"1" means the bit must be set to "1" for the hardware device to respond. +"r1" and "r0" mean a bit used to define a register + +Hardware device Read/Write Port bits + b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 +Gate-Array Write Only 0 1 - - - - - - - - - - - - - - +RAM Configuration Write Only 0 - - - - - - - - - - - - - - - +CRTC Read/Write - 0 - - - - r1 r0 - - - - - - - - +ROM select Write only - - 0 - - - - - - - - - - - - - +Printer port Write only - - - 0 - - - - - - - - - - - - +8255 PPI Read/Write - - - - 0 - r1 r0 - - - - - - - - +Expansion Peripherals Read/Write - - - - - 0 - - - - - - - - - - + +*/ + +READ8_MEMBER(amstrad_state::amstrad_cpc_io_r) +{ + unsigned char data = 0xFF; + unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8); +// m6845_personality_t crtc_type; + int page; + +// crtc_type = ioport("crtc"->read_safe(0)); +// m6845_set_personality(crtc_type); + + if(m_aleste_mode & 0x04) + { + if ((offset & (1<<15)) == 0) // Aleste Mapper is readable? + { + page = (offset & 0x0300) >> 8; + data = m_aleste_active_page[page]; + return data; + } + } + + /* if b14 = 0 : CRTC Read selected */ + if ((offset & (1<<14)) == 0) + { + switch(r1r0) + { + case 0x02: + data = m_crtc->status_r( space, 0 ); +#if 0 + /* CRTC Type 1 : Read Status Register + CRTC Type 3 or 4 : Read from selected internal 6845 register */ + switch(crtc_type) { + case M6845_PERSONALITY_UM6845R: + data = amstrad_CRTC_CR; /* Read Status Register */ + break; + case M6845_PERSONALITY_AMS40489: + case M6845_PERSONALITY_PREASIC: + data = m6845_register_r(0); + break; + default: + break; + } +#endif + break; + case 0x03: + /* All CRTC type : Read from selected internal 6845 register Read only */ + data = m_crtc->register_r( space, (offs_t)0 ); + break; + } + } + +/* if b11 = 0 : 8255 PPI Read selected - bits 9 and 8 then define the PPI function access as shown below: + +b9 b8 | PPI Function Read/Write status +0 0 | Port A data Read/Write +0 1 | Port B data Read/Write +1 0 | Port C data Read/Write +1 1 | Control Write Only +*/ + if ((offset & (1<<11)) == 0) + { + if (r1r0 < 0x03 ) + data = m_ppi->read(space, r1r0); + } + +/* if b10 = 0 : Expansion Peripherals Read selected + +bits b7-b5 are used to select an expansion peripheral. Again, this is done by resetting the peripheral's bit: +Bit | Device +b7 | FDC +b6 | Reserved (was it ever used?) +b5 | Serial port + +In the case of the FDC, bits b8 and b0 are used to select the specific mode of operation; all the other bits (b9,b4-b1) are ignored: +b8 b0 Function Read/Write state +0 0 FDD motor control Write Only +0 1 not used N/A +1 0 Main Status register of FDC (MSR) Read Only +1 1 Data register of FDC Read/Write + +If b10 is reset but none of b7-b5 are reset, user expansion peripherals are selected. +The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which causes the expansion peripherals to reset. + */ + if ( m_system_type != SYSTEM_GX4000 ) + { + if(m_fdc) // if FDC is present (it isn't on a 464) + { + if ( ( offset & (1<<10) ) == 0 ) + { + if ( ( offset & (1<<10) ) == 0 ) + { + int b8b0 = ( ( offset & (1<<8) ) >> (8 - 1) ) | ( offset & 0x01 ); + + switch (b8b0) + { + case 0x02: + data = m_fdc->msr_r(space, 0); + break; + case 0x03: + data = m_fdc->fifo_r(space, 0); + break; + default: + break; + } + } + } + } + } + return data; +} + + +// Handler for checking the ASIC unlocking sequence +void amstrad_state::amstrad_plus_seqcheck(int data) +{ + if(data == 0 && m_prev_data != 0) + { + m_asic.seqptr = 0; // non-zero value followed by zero will sync the locking mechanism + } + if(data == asic_unlock_seq[m_asic.seqptr]) + { + m_asic.seqptr++; + if ( m_asic.seqptr == 14 && m_asic.enabled ) + { + logerror("SYS: ASIC locked\n"); + m_asic.enabled = 0; + } + if ( m_asic.seqptr >= 15 ) // end of sequence + { + logerror("SYS: ASIC unlocked\n"); + m_asic.enabled = 1; + } + } + m_prev_data = data; +} + +WRITE8_MEMBER(amstrad_state::rom_select) +{ + m_gate_array.upper_bank = data; + // expansion devices know the selected ROM by monitoring I/O writes to DFxx + // there are no signals related to which ROM is selected + cpc_expansion_slot_device* exp_port = m_exp; + while(exp_port != NULL) + { + device_cpc_expansion_card_interface* temp; + device_t* temp_dev; + + temp = dynamic_cast(exp_port->get_card_device()); + temp_dev = dynamic_cast(exp_port->get_card_device()); + if(temp != NULL) + { + temp->set_rom_bank(data); + } + exp_port = temp_dev->subdevice("exp"); + } + + amstrad_setUpperRom(); +} + +/* Offset handler for write */ +WRITE8_MEMBER(amstrad_state::amstrad_cpc_io_w) +{ + cpc_multiface2_device* mface2; + + if ((offset & (1<<15)) == 0) + { + if(m_aleste_mode & 0x04) // Aleste mode + { + aleste_msx_mapper(space, offset, data); + } + else + { + /* if b15 = 0 and b14 = 1 : Gate-Array Write Selected*/ + if ((offset & (1<<14)) != 0) + amstrad_GateArray_write(data); + + /* if b15 = 0 : RAM Configuration Write Selected*/ + AmstradCPC_GA_SetRamConfiguration(); + } + } + + /*The Gate-Array and CRTC can't be selected simultaneously, which would otherwise cause potential display corruption.*/ + /* if b14 = 0 : CRTC Write Selected*/ + if ((offset & (1<<14)) == 0) + { + switch ((offset & 0x0300) >> 8) // r1r0 + { + case 0x00: /* Select internal 6845 register Write Only */ + m_crtc->address_w( space, 0, data ); + if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) + amstrad_plus_seqcheck(data); + + /* printer port d7 */ + if (data == 0x0c && m_system_type == SYSTEM_PLUS) + m_printer_bit8_selected = TRUE; + + m_asic.addr_6845 = data; + break; + case 0x01: /* Write to selected internal 6845 register Write Only */ + if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) + timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1); + else + timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); + m_crtc->register_w( space, 0, data ); + + /* printer port bit 8 */ + if (m_printer_bit8_selected && m_system_type == SYSTEM_PLUS) + { + m_centronics->write_data7(BIT(data, 3)); + m_printer_bit8_selected = FALSE; + } + + if ( m_asic.addr_6845 == 0x01 ) + m_asic.horiz_disp = data; + + break; + default: + break; + } + } + + /* ROM select before GateArrayWrite ?*/ + /* b13 = 0 : ROM select Write Selected*/ + if ((offset & (1<<13)) == 0) + { + rom_select(space,0,data); + } + + /* b12 = 0 : Printer port Write Selected*/ + if(m_system_type != SYSTEM_GX4000) + { + if ((offset & (1<<12)) == 0) + { + /* CPC has a 7-bit data port, bit 8 is the STROBE signal */ + m_centronics->write_data0(BIT(data, 0)); + m_centronics->write_data1(BIT(data, 1)); + m_centronics->write_data2(BIT(data, 2)); + m_centronics->write_data3(BIT(data, 3)); + m_centronics->write_data4(BIT(data, 4)); + m_centronics->write_data5(BIT(data, 5)); + m_centronics->write_data6(BIT(data, 6)); + m_centronics->write_strobe(BIT(data, 7)); + } + } + + /* if b11 = 0 : 8255 PPI Write selected - bits 9 and 8 then define the PPI function access as shown below: + b9 b8 | PPI Function Read/Write status + 0 0 | Port A data Read/Write + 0 1 | Port B data Read/Write + 1 0 | Port C data Read/Write + 1 1 | Control Write Only + */ + if ((offset & (1<<11)) == 0) + { + unsigned int Index = ((offset & 0x0300) >> 8); + + m_ppi->write(space, Index, data); + } + + /* if b10 = 0 : Expansion Peripherals Write selected */ + if ((offset & (1<<10)) == 0) + { +/* bits b7-b5 are used to select an expansion peripheral. This is done by resetting the peripheral's bit: +Bit | Device +b7 | FDC +b6 | Reserved (was it ever used?) +b5 | Serial port + +In the case of the FDC, bits b8 and b0 are used to select the specific mode of operation; +all the other bits (b9,b4-b1) are ignored: +b8 b0 Function Read/Write state +0 0 FDD motor control Write Only +0 1 not used N/A +1 0 Main Status register of FDC (MSR) Read Only +1 1 Data register of FDC Read/Write + +If b10 is reset but none of b7-b5 are reset, user expansion peripherals are selected. +The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which causes the expansion peripherals to reset. +*/ + if(m_system_type != SYSTEM_GX4000) + { + if(m_fdc) // if FDC is present (it isn't on a 464) + { + if ((offset & (1<<7)) == 0) + { + unsigned int b8b0 = ((offset & 0x0100) >> (8 - 1)) | (offset & 0x01); + + switch (b8b0) + { + case 0x00: + case 0x01: + { + /* FDC Motor Control - Bit 0 defines the state of the FDD motor: + * "1" the FDD motor will be active. + * "0" the FDD motor will be in-active.*/ + floppy_image_device *floppy; + floppy = machine().device(":upd765:0")->get_device(); + if(floppy) + floppy->mon_w(!BIT(data, 0)); + floppy = machine().device(":upd765:1")->get_device(); + if(floppy) + floppy->mon_w(!BIT(data, 0)); + break; + } + + case 0x03: /* Write Data register of FDC */ + m_fdc->fifo_w(space, 0,data); + break; + + default: + break; + } + } + } + } + } + + /* Aleste Extend Port: + D0 - VRAM Bank 0/1 (64K) + D1 - MODE 0-Norm ,1-High resolution + D2 - MAPMOD 0-Amstrad ,1-Yamaha mapper + D3 - MAP Page 0/1 (256K) + D4 - 580WI53 + D5 - 0-AY8910 ,1-512WI1 */ + if(offset == 0xfabf) + { + m_aleste_mode = data; + logerror("EXTEND: Port &FABF write 0x%02x\n",data); + m_crtc->set_clock( ( m_aleste_mode & 0x02 ) ? ( XTAL_16MHz / 8 ) : ( XTAL_16MHz / 16 ) ); + } + + mface2 = dynamic_cast(get_expansion_device(machine(),"multiface2")); + if(mface2 != NULL) + { + if(mface2->multiface_io_write(offset, data) != 0) + { + amstrad_rethinkMemory(); + } + } +} + + +/* load CPCEMU style snapshots */ +void amstrad_state::amstrad_handle_snapshot(unsigned char *pSnapshot) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int RegData; + int i; + + /* init Z80 */ + RegData = (pSnapshot[0x011] & 0x0ff) | ((pSnapshot[0x012] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_AF, RegData); + + RegData = (pSnapshot[0x013] & 0x0ff) | ((pSnapshot[0x014] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_BC, RegData); + + RegData = (pSnapshot[0x015] & 0x0ff) | ((pSnapshot[0x016] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_DE, RegData); + + RegData = (pSnapshot[0x017] & 0x0ff) | ((pSnapshot[0x018] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_HL, RegData); + + RegData = (pSnapshot[0x019] & 0x0ff) ; + m_maincpu->set_state_int(Z80_R, RegData); + + RegData = (pSnapshot[0x01a] & 0x0ff); + m_maincpu->set_state_int(Z80_I, RegData); + + if ((pSnapshot[0x01b] & 1)==1) + { + m_maincpu->set_state_int(Z80_IFF1, (UINT64)1); + } + else + { + m_maincpu->set_state_int(Z80_IFF1, (UINT64)0); + } + + if ((pSnapshot[0x01c] & 1)==1) + { + m_maincpu->set_state_int(Z80_IFF2, (UINT64)1); + } + else + { + m_maincpu->set_state_int(Z80_IFF2, (UINT64)0); + } + + RegData = (pSnapshot[0x01d] & 0x0ff) | ((pSnapshot[0x01e] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_IX, RegData); + + RegData = (pSnapshot[0x01f] & 0x0ff) | ((pSnapshot[0x020] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_IY, RegData); + + RegData = (pSnapshot[0x021] & 0x0ff) | ((pSnapshot[0x022] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_SP, RegData); + m_maincpu->set_state_int(STATE_GENSP, RegData); + + RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8); + + m_maincpu->set_state_int(Z80_PC, RegData); +// m_maincpu->set_state_int(REG_SP, RegData); + + RegData = (pSnapshot[0x025] & 0x0ff); + m_maincpu->set_state_int(Z80_IM, RegData); + + RegData = (pSnapshot[0x026] & 0x0ff) | ((pSnapshot[0x027] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_AF2, RegData); + + RegData = (pSnapshot[0x028] & 0x0ff) | ((pSnapshot[0x029] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_BC2, RegData); + + RegData = (pSnapshot[0x02a] & 0x0ff) | ((pSnapshot[0x02b] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_DE2, RegData); + + RegData = (pSnapshot[0x02c] & 0x0ff) | ((pSnapshot[0x02d] & 0x0ff)<<8); + m_maincpu->set_state_int(Z80_HL2, RegData); + + /* init GA */ + for (i=0; i<17; i++) + { + amstrad_GateArray_write(i); + + amstrad_GateArray_write(((pSnapshot[0x02f + i] & 0x01f) | 0x040)); + } + + amstrad_GateArray_write(pSnapshot[0x02e] & 0x01f); + + amstrad_GateArray_write(((pSnapshot[0x040] & 0x03f) | 0x080)); + + AmstradCPC_PALWrite(((pSnapshot[0x041] & 0x03f) | 0x0c0)); + + /* init CRTC */ + for (i=0; i<18; i++) + { + m_crtc->address_w( space, 0, i ); + m_crtc->register_w( space, 0, pSnapshot[0x043+i] & 0xff ); + } + + m_crtc->address_w( space, 0, i ); + + /* upper rom selection */ + m_gate_array.upper_bank = pSnapshot[0x055]; + + /* PPI */ + m_ppi->write(space, 3, pSnapshot[0x059] & 0x0ff); + + m_ppi->write(space, 0, pSnapshot[0x056] & 0x0ff); + m_ppi->write(space, 1, pSnapshot[0x057] & 0x0ff); + m_ppi->write(space, 2, pSnapshot[0x058] & 0x0ff); + + /* PSG */ + for (i=0; i<16; i++) + { + m_ay->address_w(space, 0, i); + m_ay->data_w(space, 0, pSnapshot[0x05b + i] & 0x0ff); + } + + m_ay->address_w(space, 0, pSnapshot[0x05a]); + + { + int MemSize; + int MemorySize; + + MemSize = (pSnapshot[0x06b] & 0x0ff) | ((pSnapshot[0x06c] & 0x0ff)<<8); + + if (MemSize==128) + { + MemorySize = 128*1024; + } + else + { + MemorySize = 64*1024; + } + + memcpy(m_ram->pointer(), &pSnapshot[0x0100], MemorySize); + } + amstrad_rethinkMemory(); +} + + +/* sets up for a machine reset +All hardware is reset and the firmware is completely initialized +Once all tables and jumpblocks have been set up, +control is passed to the default entry in rom 0*/ +void amstrad_state::amstrad_reset_machine() +{ + /* enable lower rom (OS rom) */ + amstrad_GateArray_write(0x089); + + /* set ram config 0 */ + amstrad_GateArray_write(0x0c0); + + // Get manufacturer name and TV refresh rate from PCB link (dipswitch for mess emulation) + m_ppi_port_inputs[amstrad_ppi_PortB] = (((m_io_solder_links->read()&MANUFACTURER_NAME)<<1) | (m_io_solder_links->read()&TV_REFRESH_RATE)); + + if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) + { + memset(m_asic.ram,0,16384); // clear ASIC RAM + } +} + + +/*------------------ + - Rethink Memory - + ------------------*/ +void amstrad_state::amstrad_rethinkMemory() +{ + cpc_multiface2_device* mface2; + /* the following is used for banked memory read/writes and for setting up + * opcode and opcode argument reads */ + + /* bank 0 - 0x0000..0x03fff */ + amstrad_setLowerRom(); + + /* bank 1 - 0x04000..0x07fff */ + if ( m_system_type == SYSTEM_CPC || m_system_type == SYSTEM_ALESTE || m_asic.enabled == 0 ) + { + if(m_aleste_mode & 0x04) + { + m_bank3->set_base(m_Aleste_RamBanks[1]); + m_bank4->set_base(m_Aleste_RamBanks[1]+0x2000); + /* bank 2 - 0x08000..0x0bfff */ + m_bank5->set_base(m_Aleste_RamBanks[2]); + m_bank6->set_base(m_Aleste_RamBanks[2]+0x2000); + } + else + { + m_bank3->set_base(m_AmstradCPC_RamBanks[1]); + m_bank4->set_base(m_AmstradCPC_RamBanks[1]+0x2000); + /* bank 2 - 0x08000..0x0bfff */ + m_bank5->set_base(m_AmstradCPC_RamBanks[2]); + m_bank6->set_base(m_AmstradCPC_RamBanks[2]+0x2000); + } + } + else + { + amstrad_setLowerRom(); + } + + /* bank 3 - 0x0c000..0x0ffff */ + amstrad_setUpperRom(); + + /* other banks */ + if(m_aleste_mode & 0x04) + { + m_bank9->set_base(m_Aleste_RamBanks[0]); + m_bank10->set_base(m_Aleste_RamBanks[0]+0x2000); + m_bank11->set_base(m_Aleste_RamBanks[1]); + m_bank12->set_base(m_Aleste_RamBanks[1]+0x2000); + m_bank13->set_base(m_Aleste_RamBanks[2]); + m_bank14->set_base(m_Aleste_RamBanks[2]+0x2000); + m_bank15->set_base(m_Aleste_RamBanks[3]); + m_bank16->set_base(m_Aleste_RamBanks[3]+0x2000); + } + else + { + m_bank9->set_base(m_AmstradCPC_RamBanks[0]); + m_bank10->set_base(m_AmstradCPC_RamBanks[0]+0x2000); + m_bank11->set_base(m_AmstradCPC_RamBanks[1]); + m_bank12->set_base(m_AmstradCPC_RamBanks[1]+0x2000); + m_bank13->set_base(m_AmstradCPC_RamBanks[2]); + m_bank14->set_base(m_AmstradCPC_RamBanks[2]+0x2000); + m_bank15->set_base(m_AmstradCPC_RamBanks[3]); + m_bank16->set_base(m_AmstradCPC_RamBanks[3]+0x2000); + } + + /* multiface hardware enabled? */ + mface2 = dynamic_cast(get_expansion_device(machine(),"multiface2")); + if(mface2 != NULL) + { + if (mface2->multiface_hardware_enabled()) + { + if((m_gate_array.mrer & 0x04) == 0) + { + mface2->multiface_rethink_memory(); + } + } + } + + /* mappings for other expansion devices */ + if (m_exp) + m_exp->set_mapping(); +} + + +void amstrad_state::kccomp_reset_machine() +{ + /* enable lower rom (OS rom) */ + amstrad_GateArray_write(0x089); + + /* set ram config 0 */ + amstrad_GateArray_write(0x0c0); +} + + +void amstrad_state::screen_eof_amstrad(screen_device &screen, bool state) +{ + // rising edge + if (state) + { + cpc_multiface2_device* mface2 = dynamic_cast(get_expansion_device(machine(),"multiface2")); + + if(mface2 != NULL) + { + mface2->check_button_state(); + } + } +} + + +/* --------------------------------------- + - 27.05.2004 - PSG function selection - + --------------------------------------- +The databus of the PSG is connected to PPI Port A. +Data is read from/written to the PSG through this port. + +The PSG function, defined by the BC1,BC2 and BDIR signals, is controlled by bit 7 and bit 6 of PPI Port C. + +PSG function selection: +----------------------- +Function + +BDIR = PPI Port C Bit 7 and BC1 = PPI Port C Bit 6 + +PPI Port C Bit | PSG Function +BDIR BC1 | +0 0 | Inactive +0 1 | Read from selected PSG register. When function is set, the PSG will make the register data available to PPI Port A +1 0 | Write to selected PSG register. When set, the PSG will take the data at PPI Port A and write it into the selected PSG register +1 1 | Select PSG register. When set, the PSG will take the data at PPI Port A and select a register +*/ +/* PSG function selected */ +void amstrad_state::update_psg() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + if(m_aleste_mode & 0x20) // RTC selected + { + switch(m_aleste_rtc_function) + { + case 0x02: // AS + m_rtc->write(space, 0,m_ppi_port_outputs[amstrad_ppi_PortA]); + break; + case 0x04: // DS write + m_rtc->write(space, 1,m_ppi_port_outputs[amstrad_ppi_PortA]); + break; + case 0x05: // DS read + m_ppi_port_inputs[amstrad_ppi_PortA] = m_rtc->read(space, 1); + break; + } + return; + } + switch (m_Psg_FunctionSelected) + { + case 0: + {/* Inactive */ + } break; + case 1: + {/* b6 = 1 ? : Read from selected PSG register and make the register data available to PPI Port A */ + m_ppi_port_inputs[amstrad_ppi_PortA] = m_ay->data_r(space, 0); + } + break; + case 2: + {/* b7 = 1 ? : Write to selected PSG register and write data to PPI Port A */ + m_ay->data_w(space, 0, m_ppi_port_outputs[amstrad_ppi_PortA]); + } + break; + case 3: + {/* b6 and b7 = 1 ? : The register will now be selected and the user can read from or write to it. The register will remain selected until another is chosen.*/ + m_ay->address_w(space, 0, m_ppi_port_outputs[amstrad_ppi_PortA]); + m_prev_reg = m_ppi_port_outputs[amstrad_ppi_PortA]; + } + break; + default: + { + } break; + } +} + + +/* Read/Write 8255 PPI port A (connected to AY-3-8912 databus) */ +READ8_MEMBER(amstrad_state::amstrad_ppi_porta_r) +{ + update_psg(); + return m_ppi_port_inputs[amstrad_ppi_PortA]; +} + + +WRITE8_MEMBER(amstrad_state::amstrad_ppi_porta_w) +{ + m_ppi_port_outputs[amstrad_ppi_PortA] = data; + update_psg(); +} + + +/* - Read PPI Port B - + ------------------- +Bit Description +7 Cassette read data +6 Parallel/Printer port ready signal ("1" = not ready, "0" = Ready) +5 /EXP signal on expansion port (note 6) +4 50/60 Hz (link on PCB. For this MESS driver I have used the dipswitch feature) (note 5) +3 | PCB links to define manufacturer name. For this MESS driver I have used the dipswitch feature. (note 1) (note 4) +2 | (note 2) +1 | (note 3) +0 VSYNC State from 6845. "1" = VSYNC active, "0" = VSYNC inactive + +Note: + +1 On CPC464,CPC664,CPC6128 and GX4000 this is LK3 on the PCB. On the CPC464+ and CPC6128+ this is LK103 on the PCB. On the KC compact this is "1". +2 On CPC464,CPC664,CPC6128 and GX4000 this is LK2 on the PCB. On the CPC464+ and CPC6128+ this is LK102 on the PCB. On the KC compact this is "0". +3 On CPC464,CPC664,CPC6128 and GX4000 this is LK1 on the PCB. On the CPC464+ and CPC6128+ this is LK101 on the PCB. On the KC compact this is /TEST signal from the expansion port. +4 On the CPC464,CPC664,CPC6128,CPC464+,CPC6128+ and GX4000 bits 3,2 and 1 define the manufacturer name. See below to see the options available. The manufacturer name is defined on the PCB and cannot be changed through software. +5 On the CPC464,CPC664,CPC6128,CPC464+,CPC6128+ and GX4000 bit 4 defines the Screen refresh frequency. "1" = 50 Hz, "0" = 60 Hz. This is defined on the PCB and cannot be changed with software. On the KC compact bit 4 is "1" +6 This bit is connected to /EXP signal on the expansion port. + On the KC Compact this bit is used to define bit 7 of the printer data. + On the CPC, it is possible to use this bit to define bit 7 of the printer data, so a 8-bit printer port is made, with a hardware modification, + On the CPC this can be used by a expansion device to report it's presence. "1" = device connected, "0" = device not connected. This is not always used by all expansion devices. +*/ + +WRITE_LINE_MEMBER(amstrad_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +READ8_MEMBER(amstrad_state::amstrad_ppi_portb_r) +{ + int data = 0; +/* Set b7 with cassette tape input */ + if(m_system_type != SYSTEM_GX4000) + { + if (m_cassette->input() > 0.03) + { + data |= (1<<7); + } + } +/* Set b6 with Parallel/Printer port ready */ + if(m_system_type != SYSTEM_GX4000) + { + data |= m_centronics_busy << 6; + } +/* Set b4-b1 50Hz/60Hz state and manufacturer name defined by links on PCB */ + data |= (m_ppi_port_inputs[amstrad_ppi_PortB] & 0x1e); + +/* Set b0 with VSync state from the CRTC */ + data |= m_gate_array.vsync; + + if(m_aleste_mode & 0x04) + { + if(m_fdc->get_irq() == 0) + data &= ~0x02; + else + data |= 0x02; + } + +//logerror("amstrad_ppi_portb_r\n"); + /* Schedule a write to PC2 */ + timer_set(attotime::zero, TIMER_PC2_LOW); + + return data; +} + + +/* 26-May-2005 - PPI Port C + ----------------------- +Bit Description Usage +7 PSG BDIR | PSG function selection +6 PSG BC1 | +5 Cassette Write data +4 Cassette Motor Control set bit to "1" for motor on, or "0" for motor off +3 | Keyboard line Select keyboard line to be scanned (0-15) +2 | +1 | +0 |*/ + +/* previous_ppi_portc_w value */ + +WRITE8_MEMBER(amstrad_state::amstrad_ppi_portc_w) +{ + int changed_data; + + m_previous_ppi_portc_w = m_ppi_port_outputs[amstrad_ppi_PortC]; +/* Write the data to Port C */ + changed_data = m_previous_ppi_portc_w^data; + + m_ppi_port_outputs[amstrad_ppi_PortC] = data; + +/* get b7 and b6 (PSG Function Selected */ + m_Psg_FunctionSelected = ((data & 0xC0)>>6); + + /* MC146818 function */ + m_aleste_rtc_function = data & 0x07; + + /* Perform PSG function */ + update_psg(); + + /* b5 Cassette Write data */ + if(m_system_type != SYSTEM_GX4000) + { + if ((changed_data & 0x20) != 0) + { + m_cassette->output(((data & 0x20) ? -1.0 : +1.0)); + } + } + + /* b4 Cassette Motor Control */ + if(m_system_type != SYSTEM_GX4000) + { + if ((changed_data & 0x10) != 0) + { + m_cassette->change_state( + ((data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED), + CASSETTE_MASK_MOTOR); + } + } +} + + +/* Additional notes for the AY-3-8912 in the CPC design +Port A of the AY-3-8912 is connected to the keyboard. +The data for a selected keyboard line can be read through Port A, as long as it is defined as input. +The operating system and I believe all programs assume this port has been defined as input. (NWC has found a bug in the Multiface 2 software. The Multiface does not reprogram the input/output state of the AY-3-8912's registers, therefore if port A is programmed as output, the keyboard will be unresponsive and it will not be possible to use the Multiface functions.) +When port B is defined as input (bit 7 of register 7 is set to "0"), a read of this port will return &FF. +*/ + +/* read PSG port A */ +READ8_MEMBER(amstrad_state::amstrad_psg_porta_read) +{ + /* Read CPC Keyboard + If keyboard matrix line 11-15 are selected, the byte is always &ff. + After testing on a real CPC, it is found that these never change, they always return &FF. */ + + if ( ( m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) > 10) + { + return 0xFF; + } + else + { + if(m_aleste_mode == 0x08 && ( m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) == 10) + return 0xff; + + if (m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]) + { + if(m_system_type != SYSTEM_GX4000) + { + if(m_io_ctrltype && (m_io_ctrltype->read() == 1) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) + { + return m_amx_mouse_data; + } + if(m_io_ctrltype && (m_io_ctrltype->read() == 2) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) + { + return (m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F] ? m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read() & 0x80 : 0) | 0x7f; + } + } + + return m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F] ? m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read() : 0; + } + return 0xFF; + } +} + + +/* called when cpu acknowledges int */ +/* reset top bit of interrupt line counter */ +/* this ensures that the next interrupt is no closer than 32 lines */ +IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int) +{ + // DMA interrupts can be automatically cleared if bit 0 of &6805 is set to 0 + if( m_asic.enabled && m_plus_irq_cause != 0x06 && m_asic.dma_clear & 0x01) + { + logerror("IRQ: Not cleared, IRQ was called by DMA [%i]\n",m_plus_irq_cause); + m_asic.ram[0x2c0f] &= ~0x80; // not a raster interrupt, so this bit is reset + return (m_asic.ram[0x2805] & 0xf8) | m_plus_irq_cause; + } + m_maincpu->set_input_line(0, CLEAR_LINE); + m_gate_array.hsync_counter &= 0x1F; + if ( m_asic.enabled ) + { + if(m_plus_irq_cause == 6) // bit 7 is set "if last interrupt acknowledge cycle was caused by a raster interrupt" + m_asic.ram[0x2c0f] |= 0x80; + else + { + m_asic.ram[0x2c0f] &= ~0x80; + m_asic.ram[0x2c0f] &= (0x40 >> m_plus_irq_cause/2); + } + return (m_asic.ram[0x2805] & 0xf8) | m_plus_irq_cause; + } + if(m_system_type != SYSTEM_GX4000) + { + // update AMX mouse inputs (normally done every 1/300th of a second) + if(m_io_ctrltype && m_io_ctrltype->read() == 1) + { + static UINT8 prev_x,prev_y; + UINT8 data_x, data_y; + + m_amx_mouse_data = 0x0f; + data_x = m_io_mouse1 ? m_io_mouse1->read() : 0; + data_y = m_io_mouse2 ? m_io_mouse2->read() : 0; + + if(data_x > prev_x) + m_amx_mouse_data &= ~0x08; + if(data_x < prev_x) + m_amx_mouse_data &= ~0x04; + if(data_y > prev_y) + m_amx_mouse_data &= ~0x02; + if(data_y < prev_y) + m_amx_mouse_data &= ~0x01; + m_amx_mouse_data |= ((m_io_mouse3 ? m_io_mouse3->read() : 0) << 4); + prev_x = data_x; + prev_y = data_y; + + m_amx_mouse_data |= ((m_io_kbrow[9] ? m_io_kbrow[9]->read() : 0) & 0x80); // DEL key + } + } + return 0xFF; +} + + +/* the following timings have been measured! */ +static const UINT8 amstrad_cycle_table_op[256] = { + 4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4, + 12, 12, 8, 8, 4, 4, 8, 4, 12, 12, 8, 8, 4, 4, 8, 4, + 8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4, + 8, 12, 16, 8, 12, 12, 12, 4, 8, 12, 16, 8, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 8, 8, 8, 8, 8, 8, 4, 8, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 4, 12, 20, 8, 16, + 8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16, + 8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16, + 8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16 +}; + +static const UINT8 amstrad_cycle_table_cb[256]= +{ + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, + 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4 +}; + +static const UINT8 amstrad_cycle_table_ed[256]= +{ + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 12, 12, 12, 20, 4, 12, 4, 8, 12, 12, 12, 20, 4, 12, 4, 8, + 12, 12, 12, 20, 4, 12, 4, 8, 12, 12, 12, 20, 4, 12, 4, 8, + 12, 12, 12, 20, 4, 12, 4, 16, 12, 12, 12, 20, 4, 12, 4, 16, + 12, 12, 12, 20, 4, 12, 4, 4, 12, 12, 12, 20, 4, 12, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 16, 12, 16, 16, 4, 4, 4, 4, 16, 12, 16, 16, 4, 4, 4, 4, + 16, 12, 16, 16, 4, 4, 4, 4, 16, 12, 16, 16, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 +}; + +static const UINT8 amstrad_cycle_table_xy[256]= +{ + 4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4, + 12, 12, 8, 8, 4, 4, 8, 4, 12, 12, 8, 8, 4, 4, 8, 4, + 8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4, + 8, 12, 16, 8, 20, 20, 20, 4, 8, 12, 16, 8, 4, 4, 8, 4, + 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, + 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, + 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, + 16, 16, 16, 16, 16, 16, 4, 16, 4, 4, 4, 4, 4, 4, 16, 4, + 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, + 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, + 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, + 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, + 8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 4, 12, 20, 8, 16, + 8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16, + 8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16, + 8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16 +}; + +static const UINT8 amstrad_cycle_table_xycb[256]= +{ + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 +}; + +static const UINT8 amstrad_cycle_table_ex[256]= +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 8, 4, 4, 0, 0, 0, 0, 4, 8, 4, 4, 0, 0, 0, 0, + 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, + 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, + 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, + 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0 +}; + +#define NEXT_ROM_SLOT m_rom_count++; \ + if(slot3 && m_rom_count == 3) m_rom_count++; \ + if(slot7 && m_rom_count == 7) m_rom_count++; + +void amstrad_state::enumerate_roms() +{ + UINT8 m_rom_count = 1; + device_t* romexp; + rom_image_device* romimage; + UINT8 *rom = m_region_maincpu->base(); + char str[20]; + int i; + bool slot3 = false,slot7 = false; + + if (m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000) + { + UINT8 *crt = m_region_cart->base(); + int bank_mask = (m_cart->get_rom_size() / 0x4000) - 1; + + /* ROMs are stored on the inserted cartridge in the Plus/GX4000 */ + for(i=0; i<128; i++) // fill ROM table + m_Amstrad_ROM_Table[i] = &crt[0x4000]; + for(i=128;i<160;i++) + m_Amstrad_ROM_Table[i] = &crt[((i - 128) & bank_mask) * 0x4000]; + m_Amstrad_ROM_Table[7] = &crt[0xc000]; + slot7 = true; + } + else + { + /* slot 0 is always BASIC, as is any unused slot */ + for(i=0; i<256; i++) + m_Amstrad_ROM_Table[i] = &rom[0x014000]; + /* AMSDOS ROM -- TODO: exclude from 464 unless a DDI-1 device is connected */ + m_Amstrad_ROM_Table[7] = &rom[0x018000]; + slot7 = true; + } + + /* MSX-DOS BIOS - Aleste MSX emulation */ + if(m_system_type == SYSTEM_ALESTE) + { + m_Amstrad_ROM_Table[3] = &rom[0x01c000]; + slot3 = true; + } + + /* enumerate expansion ROMs */ + + /* find any expansion devices that have a 'exp_rom' region */ + cpc_expansion_slot_device* exp_port = m_exp; + + while(exp_port != NULL) + { + device_t* temp; + + temp = dynamic_cast(exp_port->get_card_device()); + if(temp != NULL) + { + if(temp->memregion("exp_rom")->base() != NULL) + { + int num = temp->memregion("exp_rom")->bytes() / 0x4000; + for(i=0;imemregion("exp_rom")->base()+0x4000*i; + NEXT_ROM_SLOT + } + } + } + exp_port = temp->subdevice("exp"); + } + + + /* add ROMs from ROMbox expansion */ + romexp = get_expansion_device(machine(),"rom"); + if(romexp) + { + for(i=0;i<8;i++) + { + sprintf(str,"rom%i",i+1); + romimage = romexp->subdevice(str); + if(romimage->base() != NULL) + { + m_Amstrad_ROM_Table[m_rom_count] = romimage->base(); + NEXT_ROM_SLOT + } + } + } + +} + +void amstrad_state::amstrad_common_init() +{ +// address_space &space = m_maincpu->space(AS_PROGRAM); + + m_aleste_mode = 0; + + m_gate_array.mrer = 0; + m_gate_array.vsync = 0; + m_gate_array.hsync = 0; + m_GateArray_RamConfiguration = 0; + m_gate_array.hsync_counter = 2; + +/* space.install_read_bank(0x0000, 0x1fff, "bank1"); + space.install_read_bank(0x2000, 0x3fff, "bank2"); + + space.install_read_bank(0x4000, 0x5fff, "bank3"); + space.install_read_bank(0x6000, 0x7fff, "bank4"); + + space.install_read_bank(0x8000, 0x9fff, "bank5"); + space.install_read_bank(0xa000, 0xbfff, "bank6"); + + space.install_read_bank(0xc000, 0xdfff, "bank7"); + space.install_read_bank(0xe000, 0xffff, "bank8"); + + space.install_write_bank(0x0000, 0x1fff, "bank9"); + space.install_write_bank(0x2000, 0x3fff, "bank10"); + + space.install_write_bank(0x4000, 0x5fff, "bank11"); + space.install_write_bank(0x6000, 0x7fff, "bank12"); + + space.install_write_bank(0x8000, 0x9fff, "bank13"); + space.install_write_bank(0xa000, 0xbfff, "bank14"); + + space.install_write_bank(0xc000, 0xdfff, "bank15"); + space.install_write_bank(0xe000, 0xffff, "bank16"); +*/ + enumerate_roms(); + + m_maincpu->reset(); + if ( m_system_type == SYSTEM_CPC || m_system_type == SYSTEM_ALESTE ) + m_maincpu->set_input_line_vector(0, 0xff); + else + m_maincpu->set_input_line_vector(0, 0x00); + + /* The opcode timing in the Amstrad is different to the opcode + timing in the core for the Z80 CPU. + + The Amstrad hardware issues a HALT for each memory fetch. + This has the effect of stretching the timing for Z80 opcodes, + so that they are all multiple of 4 T states long. All opcode + timings are a multiple of 1us in length. */ + + /* Using the cool code Juergen has provided, I will override + the timing tables with the values for the amstrad */ + m_maincpu->z80_set_cycle_tables( + (const UINT8*)amstrad_cycle_table_op, + (const UINT8*)amstrad_cycle_table_cb, + (const UINT8*)amstrad_cycle_table_ed, + (const UINT8*)amstrad_cycle_table_xy, + (const UINT8*)amstrad_cycle_table_xycb, + (const UINT8*)amstrad_cycle_table_ex); + + /* Juergen is a cool dude! */ +} + +TIMER_CALLBACK_MEMBER(amstrad_state::cb_set_resolution) +{ + rectangle visarea; + attoseconds_t refresh; + int height; + + if ( m_io_solder_links->read() & 0x10 ) + { + /* PAL */ + visarea.set(0, 64 + 640 + 64 - 1, 34, 34 + 15 + 242 + 15 - 1); + height = 312; + } + else + { + /* NTSC */ + visarea.set(0, 64 + 640 + 64 - 1, 16, 16 + 15 + 200 + 15 - 1); + height = 262; + } + refresh = HZ_TO_ATTOSECONDS( XTAL_16MHz ) * 1024 * height; + m_screen->configure( 1024, height, visarea, refresh ); +} + + +MACHINE_START_MEMBER(amstrad_state,amstrad) +{ + m_system_type = SYSTEM_CPC; + m_centronics->write_data7(0); +} + + +MACHINE_RESET_MEMBER(amstrad_state,amstrad) +{ + amstrad_common_init(); + amstrad_reset_machine(); +// amstrad_init_palette(machine()); + + m_gate_array.de = 0; + m_gate_array.draw_p = NULL; + m_gate_array.hsync = 0; + m_gate_array.vsync = 0; + + timer_set(attotime::zero, TIMER_SET_RESOLUTION); +} + + +MACHINE_START_MEMBER(amstrad_state,plus) +{ + m_asic.ram = m_region_user1->base(); // 16kB RAM for ASIC, memory-mapped registers. + m_system_type = SYSTEM_PLUS; + m_centronics->write_data7(0); + + std::string region_tag; + m_region_cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + if (!m_region_cart) // this should never happen, since we make carts mandatory! + m_region_cart = memregion("maincpu"); +} + + +MACHINE_RESET_MEMBER(amstrad_state,plus) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + m_asic.enabled = 0; + m_asic.seqptr = 0; + m_asic.pri = 0; // disable PRI + m_asic.dma_status = 0; // disable all DMA channels + m_asic.dma_addr[0] = 0; + m_asic.dma_prescaler[0] = 0; + m_asic.dma_addr[1] = 0; + m_asic.dma_prescaler[1] = 0; + m_asic.dma_addr[2] = 0; + m_asic.dma_prescaler[2] = 0; + m_asic.dma_clear = 1; // by default, DMA interrupts must be cleared by writing to the DSCR (&6c0f) + m_plus_irq_cause = 6; + + amstrad_common_init(); + amstrad_reset_machine(); + m_asic.ram[0x2805] = 0x01; // interrupt vector is undefined at startup, except that bit 0 is always 1. + AmstradCPC_GA_SetRamConfiguration(); + amstrad_GateArray_write(0x081); // Epyx World of Sports requires upper ROM to be enabled by default + + space.install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),this)); + space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),this)); + space.install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),this)); + space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this)); + + // multiface_init(); + timer_set(attotime::zero, TIMER_SET_RESOLUTION); +} + +MACHINE_START_MEMBER(amstrad_state,gx4000) +{ + m_asic.ram = m_region_user1->base(); // 16kB RAM for ASIC, memory-mapped registers. + m_system_type = SYSTEM_GX4000; + + std::string region_tag; + m_region_cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + if (!m_region_cart) // this should never happen, since we make carts mandatory! + m_region_cart = memregion("maincpu"); +} + +MACHINE_RESET_MEMBER(amstrad_state,gx4000) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + m_asic.enabled = 0; + m_asic.seqptr = 0; + m_asic.pri = 0; // disable PRI + m_asic.dma_status = 0; // disable all DMA channels + m_asic.dma_addr[0] = 0; + m_asic.dma_prescaler[0] = 0; + m_asic.dma_addr[1] = 0; + m_asic.dma_prescaler[1] = 0; + m_asic.dma_addr[2] = 0; + m_asic.dma_prescaler[2] = 0; + m_asic.dma_clear = 1; // by default, DMA interrupts must be cleared by writing to the DSCR (&6c0f) + m_plus_irq_cause = 6; + + amstrad_common_init(); + amstrad_reset_machine(); + m_asic.ram[0x2805] = 0x01; // interrupt vector is undefined at startup, except that bit 0 is always 1. + AmstradCPC_GA_SetRamConfiguration(); + amstrad_GateArray_write(0x081); // Epyx World of Sports requires upper ROM to be enabled by default + // multiface_init(); + space.install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),this)); + space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),this)); + space.install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),this)); + space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this)); + + timer_set(attotime::zero, TIMER_SET_RESOLUTION); +} + +MACHINE_START_MEMBER(amstrad_state,kccomp) +{ + m_system_type = SYSTEM_CPC; + m_centronics->write_data7(0); + + m_gate_array.de = 0; + m_gate_array.draw_p = NULL; + m_gate_array.hsync = 0; + m_gate_array.vsync = 0; + + timer_set(attotime::zero, TIMER_SET_RESOLUTION); +} + + +MACHINE_RESET_MEMBER(amstrad_state,kccomp) +{ + amstrad_common_init(); + kccomp_reset_machine(); + + /* bit 1 = /TEST. When 0, KC compact will enter data transfer + sequence, where another system using the expansion port signals + DATA2,DATA1, /STROBE and DATA7 can transfer 256 bytes of program. + When the program has been transfered, it will be executed. This + is not supported in the driver */ + /* bit 3,4 are tied to +5V, bit 2 is tied to 0V */ + m_ppi_port_inputs[amstrad_ppi_PortB] = (1<<4) | (1<<3) | 2; +} + + +MACHINE_START_MEMBER(amstrad_state,aleste) +{ + m_system_type = SYSTEM_ALESTE; + m_centronics->write_data7(0); +} + +MACHINE_RESET_MEMBER(amstrad_state,aleste) +{ + amstrad_common_init(); + amstrad_reset_machine(); + + timer_set(attotime::zero, TIMER_SET_RESOLUTION); +} + + +/* load snapshot */ +SNAPSHOT_LOAD_MEMBER( amstrad_state,amstrad) +{ + dynamic_buffer snapshot; + + /* get file size */ + if (snapshot_size < 8) + return IMAGE_INIT_FAIL; + + snapshot.resize(snapshot_size); + + /* read whole file */ + image.fread(&snapshot[0], snapshot_size); + + if (memcmp(&snapshot[0], "MV - SNA", 8)) + { + return IMAGE_INIT_FAIL; + } + + amstrad_handle_snapshot(&snapshot[0]); + return IMAGE_INIT_PASS; +} + + +DEVICE_IMAGE_LOAD_MEMBER(amstrad_state, amstrad_plus_cartridge) +{ + UINT32 size = m_cart->common_get_size("rom"); + unsigned char header[12]; + bool is_cpr = FALSE; + logerror("IMG: loading CPC+ cartridge file\n"); + + // check for .CPR header + if (image.software_entry() == NULL) + { + image.fread(header, 12); + if (strncmp((char *)header, "RIFF", 4) != 0) + { + // not a CPR file, so rewind the image at start + image.fseek(0, SEEK_SET); + } + else + { + is_cpr = TRUE; + size -= 12; + } + } + + // alloc ROM + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + + // actually load the cart into ROM + if (image.software_entry() != NULL) + { + logerror("IMG: raw CPC+ cartridge from softlist\n"); + memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size); + } + else if (!is_cpr) + { + // not an RIFF format file, assume raw binary (*.bin) + logerror("IMG: raw CPC+ cartridge file\n"); + if (size % 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Attempt to load a raw binary with some block smaller than 16kB in size"); + return IMAGE_INIT_FAIL; + } + else + image.fread(m_cart->get_rom_base(), size); + } + else + { + // load CPC Plus / GX4000 cartridge image + // Format is RIFF: RIFF header chunk contains "AMS!" + // Chunks should be 16k, but may vary + // Chunks labeled 'cb00' represent Cartridge block 0, and is loaded to &0000-&3fff + // 'cb01' represent Cartridge block 1, and is loaded to &4000-&7fff + // ... and so on. + + UINT32 offset = 0; + UINT8 *crt = m_cart->get_rom_base(); + dynamic_buffer temp_copy; + temp_copy.resize(size); + image.fread(&temp_copy[0], size); + + // RIFF chunk bits + char chunkid[4]; // chunk ID (4 character code - cb00, cb01, cb02... upto cb31 (max 512kB), other chunks are ignored) + char chunklen[4]; // chunk length (always little-endian) + int chunksize; // chunk length, calcaulated from the above + int ramblock; // 16k RAM block chunk is to be loaded into + unsigned int bytes_to_read; // total bytes to read, as mame_feof doesn't react to EOF without trying to go past it. + + // Is RIFF format (*.cpr) + if (strncmp((char*)(header + 8), "AMS!", 4) != 0) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not an Amstrad CPC cartridge image (despite RIFF header)"); + return IMAGE_INIT_FAIL; + } + + bytes_to_read = header[4] + (header[5] << 8) + (header[6] << 16)+ (header[7] << 24); + bytes_to_read -= 4; // account for AMS! header + logerror("CPR: Data to read: %i bytes\n", bytes_to_read); + // read some chunks + while (bytes_to_read > 0) + { + memcpy(chunkid, &temp_copy[offset], 4); + bytes_to_read -= 4; + offset += 4; + + memcpy(chunklen, &temp_copy[offset], 4); + bytes_to_read -= 4; + offset += 4; + + // calculate little-endian value, just to be sure + chunksize = chunklen[0] + (chunklen[1] << 8) + (chunklen[2] << 16) + (chunklen[3] << 24); + + if (strncmp(chunkid, "cb", 2) == 0) + { + // load chunk into RAM + // find out what block this is + ramblock = (chunkid[2] - 0x30) * 10; + ramblock += chunkid[3] - 0x30; + logerror("CPR: Loading chunk into RAM block %i ['%4s']\n", ramblock, chunkid); + + // load block into ROM area (max 512K) + if (ramblock >= 0 && ramblock < 32) + { + if (chunksize > 0x4000) + chunksize = 0x4000; + + memcpy(crt + 0x4000 * ramblock, &temp_copy[offset], chunksize); + bytes_to_read -= chunksize; + offset += chunksize; + logerror("CPR: Loaded %i-byte chunk into RAM block %i\n", chunksize, ramblock); + } + } + else + { + logerror("CPR: Unknown chunk '%4s', skipping %i bytes\n", chunkid, chunksize); + if (chunksize != 0) + { + bytes_to_read -= chunksize; + offset += chunksize; + } + } + } + } + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/apollo.c b/src/mame/machine/apollo.c new file mode 100644 index 00000000000..568a9c08fc8 --- /dev/null +++ b/src/mame/machine/apollo.c @@ -0,0 +1,1042 @@ +// license:BSD-3-Clause +// copyright-holders:Hans Ostermeyer, R. Belmont +/* + * apollo.c - Apollo DS3500 CPU Board + * + * Created on: Jan 20, 2011 + * Author: Hans Ostermeyer + * + * Contains: + * - apollo_config.c - APOLLO DS3500 configuration + * - apollo_csr.c - APOLLO DS3500 CPU Control and Status registers + * - apollo_dma.c - APOLLO DS3500 DMA controllers + * - apollo_pic.c - APOLLO DS3500 PIC8259 controllers + * - apollo_ptm.c - APOLLO DS3500 Programmable Timer 6840 + * - apollo_rtc.c - APOLLO DS3500 RTC MC146818 + * - apollo_sio.c - APOLLO DS3500 SIO + * - apollo_sio2.c - APOLLO DS3500 SIO2 + * - apollo_stdio.c - stdio terminal for mess + * - apollo_3c505.h - Apollo 3C505 Ethernet controller + * + * see also: + * - http://www.bitsavers.org/pdf/apollo/008778-03_DOMAIN_Series_3000_4000_Technical_Reference_Aug87.pdf + * - http://www.freescale.com/files/32bit/doc/inactive/MC68681UM.pdf + * + * SIO usage: + * SIO: ch A keyboard, ch B serial console + * SIO2: modem/printer? + * + */ + +#include "includes/apollo.h" + +#include "bus/isa/omti8621.h" +#include "bus/isa/sc499.h" +#include "bus/isa/3c505.h" + +#define APOLLO_IRQ_VECTOR 0xa0 +#define APOLLO_IRQ_PTM 0 +#define APOLLO_IRQ_SIO1 1 +#define APOLLO_IRQ_PIC_SLAVE 3 +#define APOLLO_IRQ_CTAPE 5 +#define APOLLO_IRQ_FDC 6 +#define APOLLO_IRQ_RTC 8 // DN3000 only +#define APOLLO_IRQ_SIO2 8 // DN3500 +#define APOLLO_IRQ_ETH2 9 +#define APOLLO_IRQ_ETH1 10 +#define APOLLO_IRQ_DIAG 13 +#define APOLLO_IRQ_WIN1 14 + +#define APOLLO_DMA_ETH1 6 +#define APOLLO_DMA_ETH2 3 + +//########################################################################## +// machine/apollo_config.c - APOLLO DS3500 configuration +//########################################################################## + +#undef VERBOSE +#define VERBOSE 0 + +static UINT16 config = 0; + +/*************************************************************************** + apollo_config - check configuration setting + ***************************************************************************/ + +int apollo_config(int mask) +{ + return config & mask ? 1 : 0; +} + +/*************************************************************************** + Input Ports + ***************************************************************************/ + +INPUT_PORTS_START( apollo_config ) + PORT_START( "apollo_config" ) + PORT_CONFNAME(APOLLO_CONF_SERVICE_MODE, 0x00, "Normal/Service" ) + PORT_CONFSETTING(0x00, "Service" ) + PORT_CONFSETTING(APOLLO_CONF_SERVICE_MODE, "Normal " ) + + PORT_CONFNAME(APOLLO_CONF_DISPLAY, APOLLO_CONF_8_PLANES, "Graphics Controller") + PORT_CONFSETTING(APOLLO_CONF_8_PLANES, "8-Plane Color") + PORT_CONFSETTING(APOLLO_CONF_4_PLANES, "4-Plane Color") + PORT_CONFSETTING(APOLLO_CONF_MONO_15I, "15\" Monochrome") +// PORT_CONFSETTING(APOLLO_CONF_MONO_19I, "19\" Monochrome") + + PORT_CONFNAME(APOLLO_CONF_GERMAN_KBD, 0x00, "German Keyboard") + PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) + PORT_CONFSETTING(APOLLO_CONF_GERMAN_KBD, DEF_STR ( On ) ) + + PORT_CONFNAME(APOLLO_CONF_20_YEARS_AGO, APOLLO_CONF_20_YEARS_AGO, "20 Years Ago ...") + PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) + PORT_CONFSETTING(APOLLO_CONF_20_YEARS_AGO, DEF_STR ( On ) ) + + PORT_CONFNAME(APOLLO_CONF_25_YEARS_AGO, APOLLO_CONF_25_YEARS_AGO, "25 Years Ago ...") + PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) + PORT_CONFSETTING(APOLLO_CONF_25_YEARS_AGO, DEF_STR ( On ) ) + +// PORT_CONFNAME(APOLLO_CONF_NODE_ID, APOLLO_CONF_NODE_ID, "Node ID from Disk") +// PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) +// PORT_CONFSETTING(APOLLO_CONF_NODE_ID, DEF_STR ( On ) ) + +// PORT_CONFNAME(APOLLO_CONF_IDLE_SLEEP, 0x00, "Idle Sleep") +// PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) +// PORT_CONFSETTING(APOLLO_CONF_IDLE_SLEEP, DEF_STR ( On ) ) + + PORT_CONFNAME(APOLLO_CONF_TRAP_TRACE, 0x00, "Trap Trace") + PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) + PORT_CONFSETTING(APOLLO_CONF_TRAP_TRACE, DEF_STR ( On ) ) + + PORT_CONFNAME(APOLLO_CONF_FPU_TRACE, 0x00, "FPU Trace") + PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) + PORT_CONFSETTING(APOLLO_CONF_FPU_TRACE, DEF_STR ( On ) ) + +// PORT_CONFNAME(APOLLO_CONF_DISK_TRACE, 0x00, "Disk Trace") +// PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) +// PORT_CONFSETTING(APOLLO_CONF_DISK_TRACE, DEF_STR ( On ) ) + +// PORT_CONFNAME(APOLLO_CONF_NET_TRACE, 0x00, "Network Trace") +// PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) +// PORT_CONFSETTING(APOLLO_CONF_NET_TRACE, DEF_STR ( On ) ) + +INPUT_PORTS_END + +class apollo_config_device : public device_t +{ +public: + apollo_config_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state +}; + +extern const device_type APOLLO_CONF; + +const device_type APOLLO_CONF = &device_creator; + +apollo_config_device::apollo_config_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, APOLLO_CONF, "Apollo Configuration", tag, owner, clock, "apollo_config", __FILE__) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void apollo_config_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apollo_config_device::device_start() +{ + MLOG1(("start apollo_config")); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apollo_config_device::device_reset() +{ + MLOG1(("reset apollo_config")); + // load configuration + config = machine().root_device().ioport("apollo_config")->read(); +} + + + +//########################################################################## +// machine/apollo_csr.c - APOLLO DS3500 CPU Control and Status registers +//########################################################################## + +#undef VERBOSE +#define VERBOSE 0 + +#define CPU_CONTROL_REGISTER_ADDRESS 0x010100 + +static UINT16 cpu_status_register = APOLLO_CSR_SR_BIT15 | APOLLO_CSR_SR_SERVICE; +static UINT16 cpu_control_register = 0x0000; + +/*------------------------------------------------- + apollo_csr_get/set_servicemode + -------------------------------------------------*/ + +/*static int apollo_csr_get_servicemode() +{ + return cpu_status_register & APOLLO_CSR_SR_SERVICE ? 0 : 1; +}*/ + +static void apollo_csr_set_servicemode(int mode) +{ + apollo_csr_set_status_register(1, mode ? APOLLO_CSR_SR_SERVICE : 0); +} + +UINT16 apollo_csr_get_control_register(void) +{ + return cpu_control_register; +} + +UINT16 apollo_csr_get_status_register(void) +{ + return cpu_status_register; +} + +void apollo_csr_set_status_register(UINT16 mask, UINT16 data) +{ + UINT16 new_value = (cpu_status_register & ~mask) | (data & mask); + + if (new_value != cpu_status_register) + { + cpu_status_register = new_value; + LOG1(("#### setting CPU Status Register with data=%04x & %04x to %04x", data, mask, cpu_status_register)); + } +} + +/*------------------------------------------------- + DN3000/DN3500 CPU Status Register at 0x8000/0x10000 + -------------------------------------------------*/ + +WRITE16_MEMBER(apollo_state::apollo_csr_status_register_w){ + // To clear bus timeouts or parity conditions from status register, + // write to the status register. This register is readonly. + // in DN3500 bit 15 is always set (undocumented !?) + cpu_status_register &= (APOLLO_CSR_SR_BIT15 | APOLLO_CSR_SR_FP_TRAP | APOLLO_CSR_SR_SERVICE); + SLOG1(("writing CPU Status Register at offset %X = %04x & %04x (%04x)", offset, data, mem_mask, cpu_status_register)); +} + +READ16_MEMBER(apollo_state::apollo_csr_status_register_r){ + SLOG2(("reading CPU Status Register at offset %X = %04x & %04x", offset, cpu_status_register, mem_mask)); + return cpu_status_register & mem_mask; +} + +/*------------------------------------------------- + DN3000/DN3500 CPU Control Register at 0x8100/0x10100 + -------------------------------------------------*/ + +WRITE16_MEMBER(apollo_state::apollo_csr_control_register_w) +{ + int leds; + + if ((mem_mask & APOLLO_CSR_CR_FPU_TRAP_ENABLE) == 0) + { + // FPU Trap enable not involved + } + else if (((data ^ cpu_control_register) & APOLLO_CSR_CR_FPU_TRAP_ENABLE) == 0) + { + // FPU Trap enable remains unchanged + } + else if ((data & APOLLO_CSR_CR_FPU_TRAP_ENABLE) == 0) + { + // enable FPU (i.e. FPU opcodes in CPU) + apollo_set_cpu_has_fpu(m_maincpu, 1); + } + else + { + // disable FPU (i.e. FPU opcodes in CPU) + apollo_set_cpu_has_fpu(m_maincpu, 0); + + if (!apollo_is_dn3000()) + { + // hack: set APOLLO_CSR_SR_FP_TRAP in cpu status register for /sau7/self_test + // APOLLO_CSR_SR_FP_TRAP in status register should be set by next fmove instruction + // cpu_status_register |= APOLLO_CSR_SR_FP_TRAP; + } + } + + cpu_control_register = (cpu_control_register & ~mem_mask) | (data & mem_mask); + + output_set_value("internal_led_1", (cpu_control_register >> 15) & 1); + output_set_value("internal_led_2", (cpu_control_register >> 14) & 1); + output_set_value("internal_led_3", (cpu_control_register >> 13) & 1); + output_set_value("internal_led_4", (cpu_control_register >> 12) & 1); + output_set_value("external_led_a", (cpu_control_register >> 11) & 1); + output_set_value("external_led_b", (cpu_control_register >> 10) & 1); + output_set_value("external_led_c", (cpu_control_register >> 9) & 1); + output_set_value("external_led_d", (cpu_control_register >> 8) & 1); + + leds = ((cpu_control_register >> 8) & 0xff) ^ 0xff; + + SLOG1(("writing CPU Control Register at offset %X = %04x & %04x (%04x - %d%d%d%d %d%d%d%d)", + offset, data, mem_mask, cpu_control_register, + (leds >> 3) & 1,(leds >> 2) & 1, (leds >> 1) & 1, (leds >> 0) & 1, + (leds >> 7) & 1,(leds >> 6) & 1, (leds >> 5) & 1, (leds >> 4) & 1 )); + + if (data & APOLLO_CSR_CR_RESET_DEVICES) + { + // FIXME: reset all devices (but not SIO lines!) + } +} + +READ16_MEMBER(apollo_state::apollo_csr_control_register_r) +{ + SLOG1(("reading CPU Control Register at offset %X = %04x & %04x", offset, cpu_control_register, mem_mask)); + return cpu_control_register & mem_mask; +} + +//########################################################################## +// machine/apollo_dma.c - APOLLO DS3500 DMA +//########################################################################## + +#undef VERBOSE +#define VERBOSE 0 + +static UINT16 address_translation_map[0x400]; + +static UINT16 dma_page_register[16] = + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +static const UINT8 channel2page_register[8] = { 7, 3, 1, 2, 0, 11, 9, 10}; + +static UINT8 dn3000_dma_channel1 = 1; // 1 = memory/ctape, 2 = floppy dma channel +static UINT8 dn3000_dma_channel2 = 5; // 5 = memory dma channel + +/*------------------------------------------------- + DN3000/DN3500 DMA Controller 1 at 0x9000/0x10c00 + -------------------------------------------------*/ + +WRITE8_MEMBER(apollo_state::apollo_dma_1_w){ + SLOG1(("apollo_dma_1_w: writing DMA Controller 1 at offset %02x = %02x", offset, data)); + m_dma8237_1->write(space, offset, data); +} + +READ8_MEMBER(apollo_state::apollo_dma_1_r){ + UINT8 data = m_dma8237_1->read(space, offset); + SLOG1(("apollo_dma_1_r: reading DMA Controller 1 at offset %02x = %02x", offset, data)); + return data; +} + +/*------------------------------------------------- + DN3000/DN3500 DMA Controller 2 at 0x9100/0x10d00 + -------------------------------------------------*/ + +WRITE8_MEMBER(apollo_state::apollo_dma_2_w){ + SLOG1(("apollo_dma_2_w: writing DMA Controller 2 at offset %02x = %02x", offset/2, data)); + m_dma8237_2->write(space, offset / 2, data); +} + +READ8_MEMBER(apollo_state::apollo_dma_2_r){ + // Nasty hack (13-06-15 - ost): + // MD self_test will test wrong DMA register and + // mem-to-mem DMA in am9517a.c is often starting much too late (for MD self_test) + // (8237dma.c was always fast enough to omit these problems) + if (offset == 8) + { + switch (space.device().safe_pcbase()) + { + case 0x00102e22: // DN3000 + case 0x01002f3c: // DN3500 + case 0x010029a6: // DN5500 + offset = 16; + break; + } + } + UINT8 data = m_dma8237_2->read(space, offset / 2); + SLOG1(("apollo_dma_2_r: reading DMA Controller 2 at offset %02x = %02x", offset/2, data)); + return data; +} + +/*************************************************************************** + DN3000 DMA Page Register at 0x9200 + ***************************************************************************/ + +WRITE8_MEMBER(apollo_state::apollo_dma_page_register_w){ + dma_page_register[offset & 0x0f] = data; + SLOG1(("writing DMA Page Register at offset %02x = %02x", offset, data)); +} + +READ8_MEMBER(apollo_state::apollo_dma_page_register_r){ + UINT8 data = dma_page_register[offset & 0x0f]; + SLOG1(("reading DMA Page Register at offset %02x = %02x", offset, data)); + return data; +} + +/*------------------------------------------------- + DN3500 Address Translation Map at 0x017000 + -------------------------------------------------*/ + +WRITE16_MEMBER(apollo_state::apollo_address_translation_map_w){ + address_translation_map[offset & 0x3ff] = data; + SLOG2(("writing Address Translation Map at offset %02x = %04x", offset, data)); +} + +READ16_MEMBER(apollo_state::apollo_address_translation_map_r){ + UINT16 data = address_translation_map[offset & 0x3ff]; + SLOG2(("reading Address Translation Map at offset %02x = %04x", offset, data)); + return data; +} + +READ8_MEMBER(apollo_state::apollo_dma_read_byte){ + UINT8 data; + offs_t page_offset; + + if (apollo_is_dn3000()) { + page_offset = dma_page_register[channel2page_register[dn3000_dma_channel1]] << 16; + } else { + // FIXME: address_translation_map[0x200] ? + page_offset = (((offs_t) address_translation_map[0x200 + (offset >> 10)]) << 10) & 0x7FFFFC00; + offset &= 0x3ff; + } + + data = m_maincpu->space(AS_PROGRAM).read_byte(page_offset + offset); + + if (VERBOSE > 1 || offset < 4 || (offset & 0xff) == 0 || (offset & 0xff) == 0xff) + { + SLOG1(("dma read byte at offset %x+%03x = %02x", page_offset, offset, data)); + } +// logerror(" %02x", data); + return data; +} + +WRITE8_MEMBER(apollo_state::apollo_dma_write_byte){ + offs_t page_offset; + if (apollo_is_dn3000()) { + page_offset = dma_page_register[channel2page_register[dn3000_dma_channel1]] << 16; + } else { + // FIXME: address_translation_map[0x200] ? + page_offset = (((offs_t) address_translation_map[0x200 + (offset >> 10)]) << 10) & 0x7FFFFC00; + offset &= 0x3ff; + } + // FIXME: MSB not available, writing only LSB + m_maincpu->space(AS_PROGRAM).write_byte(page_offset + offset, data); + + if (VERBOSE > 1 || offset < 4 || (offset & 0xff) == 0 || (offset & 0xff) == 0xff) + { + SLOG1(("dma write byte at offset %x+%03x = %02x", page_offset, offset , data)); + } +// logerror(" %02x", data); +} + +READ8_MEMBER(apollo_state::apollo_dma_read_word){ + UINT16 data; + offs_t page_offset; + + if (apollo_is_dn3000()) { + page_offset = dma_page_register[channel2page_register[dn3000_dma_channel2]] << 16; + page_offset &= 0xfffe0000; + offset <<= 1; + } else { + // FIXME: address_translation_map[0x200] ? + page_offset = (((offs_t) address_translation_map[0x200 + (offset >> 9)]) << 10) & 0x7FFFFC00; + offset = (offset << 1) & 0x3ff; + } + + data = m_maincpu->space(AS_PROGRAM).read_byte(page_offset + offset); + + SLOG1(("dma read word at offset %x+%03x = %04x", page_offset, offset , data)); + // FIXME: MSB will get lost + return data; +} + +WRITE8_MEMBER(apollo_state::apollo_dma_write_word){ + offs_t page_offset; + + SLOG1(("dma write word at offset %x = %02x", offset, data)); + + if (apollo_is_dn3000()) { + page_offset = dma_page_register[channel2page_register[dn3000_dma_channel2]] << 16; + page_offset &= 0xfffe0000; + offset <<= 1; + } else { + // FIXME: address_translation_map[0x200] ? + page_offset + = (((offs_t) address_translation_map[0x200 + (offset >> 9)]) + << 10) & 0x7FFFFC00; + offset = (offset << 1) & 0x3ff; + } + + m_maincpu->space(AS_PROGRAM).write_byte(page_offset + offset, data); + SLOG1(("dma write word at offset %x+%03x = %02x", page_offset, offset, data)); +} + +WRITE_LINE_MEMBER(apollo_state::apollo_dma8237_out_eop ) { + CLOG1(("dma out eop state %02x", state)); + m_cur_eop = state == ASSERT_LINE; + if(m_dma_channel != -1) + m_isa->eop_w(m_dma_channel, m_cur_eop ? ASSERT_LINE : CLEAR_LINE ); +} + +WRITE_LINE_MEMBER(apollo_state::apollo_dma_1_hrq_changed ) { + CLOG2(("dma 1 hrq changed state %02x", state)); + m_dma8237_1->dreq0_w(state); + + /* Assert HLDA */ + m_dma8237_1->hack_w(state); + + // cascade mode? + // i8237_hlda_w(get_device_dma8237_2(device), state); +} + +WRITE_LINE_MEMBER(apollo_state::apollo_dma_2_hrq_changed ) { + CLOG2(("dma 2 hrq changed state %02x", state)); + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + /* Assert HLDA */ + m_dma8237_2->hack_w(state); +} + +READ8_MEMBER( apollo_state::pc_dma8237_0_dack_r ) { return m_isa->dack_r(0); } +READ8_MEMBER( apollo_state::pc_dma8237_1_dack_r ) { return m_isa->dack_r(1); } +READ8_MEMBER( apollo_state::pc_dma8237_2_dack_r ) { return m_isa->dack_r(2); } +READ8_MEMBER( apollo_state::pc_dma8237_3_dack_r ) { return m_isa->dack_r(3); } +READ8_MEMBER( apollo_state::pc_dma8237_5_dack_r ) { return m_isa->dack_r(5); } +READ8_MEMBER( apollo_state::pc_dma8237_6_dack_r ) { return m_isa->dack_r(6); } +READ8_MEMBER( apollo_state::pc_dma8237_7_dack_r ) { return m_isa->dack_r(7); } + +WRITE8_MEMBER( apollo_state::pc_dma8237_0_dack_w ){ m_isa->dack_w(0, data); } +WRITE8_MEMBER( apollo_state::pc_dma8237_1_dack_w ){ m_isa->dack_w(1, data); } +WRITE8_MEMBER( apollo_state::pc_dma8237_2_dack_w ){ m_isa->dack_w(2, data); } +WRITE8_MEMBER( apollo_state::pc_dma8237_3_dack_w ){ m_isa->dack_w(3, data); } +WRITE8_MEMBER( apollo_state::pc_dma8237_5_dack_w ){ m_isa->dack_w(5, data); } +WRITE8_MEMBER( apollo_state::pc_dma8237_6_dack_w ){ m_isa->dack_w(6, data); } +WRITE8_MEMBER( apollo_state::pc_dma8237_7_dack_w ){ m_isa->dack_w(7, data); } + +WRITE_LINE_MEMBER( apollo_state::pc_dack0_w ) { select_dma_channel(0, state); } +WRITE_LINE_MEMBER( apollo_state::pc_dack1_w ) { select_dma_channel(1, state); } +WRITE_LINE_MEMBER( apollo_state::pc_dack2_w ) { select_dma_channel(2, state); } +WRITE_LINE_MEMBER( apollo_state::pc_dack3_w ) { select_dma_channel(3, state); } +WRITE_LINE_MEMBER( apollo_state::pc_dack4_w ) { m_dma8237_1->hack_w( state ? 0 : 1); } // it's inverted +WRITE_LINE_MEMBER( apollo_state::pc_dack5_w ) { select_dma_channel(5, state); } +WRITE_LINE_MEMBER( apollo_state::pc_dack6_w ) { select_dma_channel(6, state); } +WRITE_LINE_MEMBER( apollo_state::pc_dack7_w ) { select_dma_channel(7, state); } + +void apollo_state::select_dma_channel(int channel, bool state) +{ + if(!state) { + m_dma_channel = channel; + if(m_cur_eop) + m_isa->eop_w(channel, ASSERT_LINE ); + + } else if(m_dma_channel == channel) { + m_dma_channel = -1; + if(m_cur_eop) + m_isa->eop_w(channel, CLEAR_LINE ); + } +} + +//########################################################################## +// machine/apollo_pic.c - APOLLO DS3500 PIC 8259 controllers +//########################################################################## + +#undef VERBOSE +#define VERBOSE 0 + +void apollo_state::apollo_pic_set_irq_line(int irq, int state) +{ + switch (irq) { + case 0: m_pic8259_master->ir0_w(state); break; + case 1: m_pic8259_master->ir1_w(state); break; + case 2: m_pic8259_master->ir2_w(state); break; + case 3: m_pic8259_master->ir3_w(state); break; + case 4: m_pic8259_master->ir4_w(state); break; + case 5: m_pic8259_master->ir5_w(state); break; + case 6: m_pic8259_master->ir6_w(state); break; + case 7: m_pic8259_master->ir7_w(state); break; + + case 8: m_pic8259_slave->ir0_w(state); break; + case 9: m_pic8259_slave->ir1_w(state); break; + case 10: m_pic8259_slave->ir2_w(state); break; + case 11: m_pic8259_slave->ir3_w(state); break; + case 12: m_pic8259_slave->ir4_w(state); break; + case 13: m_pic8259_slave->ir5_w(state); break; + case 14: m_pic8259_slave->ir6_w(state); break; + case 15: m_pic8259_slave->ir7_w(state); break; + } +} + +IRQ_CALLBACK_MEMBER(apollo_state::apollo_pic_acknowledge) +{ + UINT32 vector = m_pic8259_master->acknowledge(); + if ((vector & 0x0f) == APOLLO_IRQ_PIC_SLAVE) { + vector = m_pic8259_slave->acknowledge(); + } + + // don't log ptm interrupts + if (vector != APOLLO_IRQ_VECTOR+APOLLO_IRQ_PTM) { + MLOG1(("apollo_pic_acknowledge: irq=%d vector=%x", vector & 0x0f, vector)); + } + + if (apollo_is_dn3000()) { + apollo_csr_set_status_register(APOLLO_CSR_SR_INTERRUPT_PENDING, 0); + } else { + // clear bit Interrupt Pending in Cache Status Register + apollo_set_cache_status_register(0x10, 0x00); + } + return vector; +} + +/************************************************************* + * pic8259 configuration + *************************************************************/ + +READ8_MEMBER( apollo_state::apollo_pic8259_get_slave_ack ) +{ + MLOG1(("apollo_pic8259_get_slave_ack: offset=%x", offset)); + + return offset == 3 ? m_pic8259_slave->acknowledge() : 0; +} + +WRITE_LINE_MEMBER( apollo_state::apollo_pic8259_master_set_int_line ) { + static int interrupt_line = -1; + if (state != interrupt_line) { + device_t *device = m_pic8259_master; + DLOG1(("apollo_pic8259_master_set_int_line: %x", state)); + } + interrupt_line = state; + + if (apollo_is_dn3000()) { + apollo_csr_set_status_register(APOLLO_CSR_SR_INTERRUPT_PENDING, + state ? APOLLO_CSR_SR_INTERRUPT_PENDING : 0); + } else { + // set bit Interrupt Pending in Cache Status Register + apollo_set_cache_status_register(0x10, state ? 0x10 : 0x00); + } + + m_maincpu->set_input_line_and_vector(M68K_IRQ_6,state ? ASSERT_LINE : CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); +} + +WRITE_LINE_MEMBER( apollo_state::apollo_pic8259_slave_set_int_line ) { + static int interrupt_line = -1; + if (state != interrupt_line) { + device_t *device = m_pic8259_slave; + DLOG1(("apollo_pic8259_slave_set_int_line: %x", state)); + interrupt_line = state; + apollo_pic_set_irq_line(3, state); + } +} + +//########################################################################## +// machine/apollo_ptm.c - APOLLO DS3500 Programmable Timer 6840 +//########################################################################## + +#undef VERBOSE +#define VERBOSE 0 + +WRITE_LINE_MEMBER(apollo_state::apollo_ptm_timer_tick) +{ + if ((state) && (m_ptm->started())) + { + ptm_counter++; + m_ptm->set_c1( 1); + m_ptm->set_c1( 0); + m_ptm->set_c2(ptm_counter & 1); + + if ((ptm_counter & 1) == 0) + { + m_ptm->set_c3((ptm_counter >> 1) & 1); + } + } +} + +WRITE_LINE_MEMBER(apollo_state::apollo_ptm_irq_function) +{ + apollo_pic_set_irq_line(APOLLO_IRQ_PTM, state); +} + +// Timer 1's input is a 250-kHz (4-microsecond period) signal. +// Timer 2's input is a 125-kHz (8-microsecond period) signal. +// Timer 3's input is a 62.5-kHz (16-microsecond period) signal. +// The Timer 3 input may be prescaled to make the effective input signal have a 128-microsecond period. + + +//########################################################################## +// machine/apollo_rtc.c - APOLLO DS3500 RTC MC146818 +//########################################################################## + +#undef VERBOSE +#define VERBOSE 0 + +/*************************************************************************** + DN3000/DN3500 Realtime Calendar MC146818 at 0x8900/0x10900 + ***************************************************************************/ + +WRITE8_MEMBER(apollo_state::apollo_rtc_w) +{ + m_rtc->write(space, 0, offset); + m_rtc->write(space, 1, data); + if (offset >= 0x0b && offset <= 0x0c) + { + SLOG2(("writing MC146818 at offset %02x = %02x", offset, data)); + } +} + +READ8_MEMBER(apollo_state::apollo_rtc_r) +{ + UINT8 data; + m_rtc->write(space, 0, offset); + data = m_rtc->read(space, 1); + if (offset >= 0x0b && offset <= 0x0c) + { + SLOG2(("reading MC146818 at offset %02x = %02x", offset, data)); + } + return data; +} + +// TODO: this is covering for missing mc146818 functionality +TIMER_CALLBACK_MEMBER( apollo_state::apollo_rtc_timer ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + // FIXME: reading register 0x0c will clear all interrupt flags + if ((apollo_rtc_r(space, 0x0c) & 0x80)) + { + //SLOG2(("apollo_rtc_timer - set_irq_line %d", APOLLO_IRQ_RTC)); + apollo_pic_set_irq_line(APOLLO_IRQ_RTC, 1); + } +} + +//########################################################################## +// machine/apollo_sio.c - DN3000/DS3500 SIO at 0x8400/0x10400 +//########################################################################## + +#undef VERBOSE +#define VERBOSE 0 + +apollo_sio::apollo_sio(const machine_config &mconfig, const char *tag, + device_t *owner, UINT32 clock) : + mc68681_device(mconfig, tag, owner, clock), + m_csrb(0), + m_ip6(0) +{ +} + +void apollo_sio::device_reset() +{ + UINT8 input_data = apollo_get_ram_config_byte(); + ip0_w((input_data & 0x01) ? ASSERT_LINE : CLEAR_LINE); + ip1_w((input_data & 0x02) ? ASSERT_LINE : CLEAR_LINE); + ip2_w((input_data & 0x04) ? ASSERT_LINE : CLEAR_LINE); + ip3_w((input_data & 0x08) ? ASSERT_LINE : CLEAR_LINE); + ip4_w((input_data & 0x10) ? ASSERT_LINE : CLEAR_LINE); + ip5_w((input_data & 0x20) ? ASSERT_LINE : CLEAR_LINE); +// ip6_w((input_data & 0x40) ? ASSERT_LINE : CLEAR_LINE); + + // MC2681 has IP[6] (instead of /IACK on MC68681) + m_ip6 = (input_data & 0x40) ? ASSERT_LINE : CLEAR_LINE; +} + +READ8_MEMBER( apollo_sio::read ) +{ + static int last_read8_offset[2] = { -1, -1 }; + static int last_read8_value[2] = { -1, -1 }; + + static const char * const duart68681_reg_read_names[0x10] = { "MRA", "SRA", + "BRG Test", "RHRA", "IPCR", "ISR", "CTU", "CTL", "MRB", "SRB", + "1X/16X Test", "RHRB", "IVR", "Input Ports", "Start Counter", + "Stop Counter" }; + + int data = mc68681_device::read(space, offset/2, mem_mask); + + switch (offset / 2) + { + case 0x0b: /* RHRB */ + if (m_csrb == 0x77 && data == 0xfe) + { + // special fix for the MD ROM baudrate recognition + // fix data only if CR is entered while baudrate is set to 2000 Baud + + // Receive and transmit clock in diserial.c are not precise enough + // to support the baudrate recognition done in the Apollo MD ROM + // use 0xff instead of 0xfe to set the baudrate recognition for 9600 Bd + // (to prevent that the MD selftest or SK command will hang in Service mode) + data = 0xff; + } + break; + case 0x0d: /* IP */ + // MC2681 has IP[6] (instead of /IACK on MC68681) + data = (data & ~0x40) | (m_ip6 ? 0x40 : 0); + break; + } + + // omit logging if sio is being polled from the boot rom + if ((offset != last_read8_offset[1] || data != last_read8_value[1]) && \ + (offset != last_read8_offset[0] || data != last_read8_value[0])) + { + last_read8_offset[0] = last_read8_offset[1]; + last_read8_value[0] = last_read8_value[1]; + last_read8_offset[1] = offset; + last_read8_value[1] = data; + CLOG2(("reading MC2681 reg %02x (%s) returned %02x", + offset, duart68681_reg_read_names[(offset/2) & 15], data)); + } + + return data; +} + +WRITE8_MEMBER( apollo_sio::write ) +{ + static const char * const duart68681_reg_write_names[0x10] = { "MRA", + "CSRA", "CRA", "THRA", "ACR", "IMR", "CRUR", "CTLR", "MRB", "CSRB", + "CRB", "THRB", "IVR", "OPCR", "Set OP Bits", "Reset OP Bits" }; + + CLOG2(("writing MC2681 reg %02x (%s) with %02x", + offset, duart68681_reg_write_names[(offset/2) & 15], data)); + + switch (offset / 2) { + case 0x09: /* CSRB */ + // remember CSRB to handle MD selftest or SK command + m_csrb = data; + break; +#if 1 + case 0x0b: /* THRB */ + // tee output of SIO1 to stdout + // sad: ceterm will get confused from '\r' + if (apollo_is_dsp3x00() && data != '\r') ::putchar(data); + break; +#endif + } + mc68681_device::write(space, offset/2, data, mem_mask); +} + +// device type definition +const device_type APOLLO_SIO = &device_creator; + +WRITE_LINE_MEMBER(apollo_state::sio_irq_handler) +{ + apollo_pic_set_irq_line(APOLLO_IRQ_SIO1, state); +} + +WRITE8_MEMBER(apollo_state::sio_output) +{ +// CLOG2(("apollo_sio - sio_output %02x", data)); + + if ((data & 0x80) != (sio_output_data & 0x80)) + { + apollo_pic_set_irq_line(APOLLO_IRQ_DIAG, (data & 0x80) ? 1 : 0); + } + + // The counter/timer on the SIO chip is used for the RAM refresh count. + // This is set up in the timer mode to produce a square wave output on output OP3. + // The period of the output is 15 microseconds. + + if ((data & 0x08) != (sio_output_data & 0x08)) + { + m_sio->ip0_w((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); + } + + sio_output_data = data; +} + +//########################################################################## +// machine/apollo_sio2.c - APOLLO DS3500 SIO2 +//########################################################################## + +WRITE_LINE_MEMBER(apollo_state::sio2_irq_handler) +{ + apollo_pic_set_irq_line(APOLLO_IRQ_SIO2, state); +} + +//########################################################################## +// machine/apollo.c - APOLLO DS3500 CPU Board +//########################################################################## + +#undef VERBOSE +#define VERBOSE 0 + +static SLOT_INTERFACE_START(apollo_isa_cards) + SLOT_INTERFACE("wdc", ISA16_OMTI8621) // Combo ESDI/AT floppy controller + SLOT_INTERFACE("ctape", ISA8_SC499) // Archive SC499 cartridge tape + SLOT_INTERFACE("3c505", ISA16_3C505) // 3Com 3C505 Ethernet card +SLOT_INTERFACE_END + +MACHINE_CONFIG_FRAGMENT( common ) + // configuration MUST be reset first ! + MCFG_DEVICE_ADD(APOLLO_CONF_TAG, APOLLO_CONF, 0) + + MCFG_DEVICE_ADD( APOLLO_DMA1_TAG, AM9517A, XTAL_14_31818MHz/3 ) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(apollo_state, apollo_dma_1_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(apollo_state, apollo_dma8237_out_eop)) + MCFG_I8237_IN_MEMR_CB(READ8(apollo_state, apollo_dma_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(apollo_state, apollo_dma_write_byte)) + MCFG_I8237_IN_IOR_0_CB(READ8(apollo_state, pc_dma8237_0_dack_r)) + MCFG_I8237_IN_IOR_1_CB(READ8(apollo_state, pc_dma8237_1_dack_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(apollo_state, pc_dma8237_2_dack_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(apollo_state, pc_dma8237_3_dack_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(apollo_state, pc_dma8237_0_dack_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(apollo_state, pc_dma8237_1_dack_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(apollo_state, pc_dma8237_2_dack_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(apollo_state, pc_dma8237_3_dack_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(apollo_state, pc_dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(apollo_state, pc_dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(apollo_state, pc_dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(apollo_state, pc_dack3_w)) + MCFG_DEVICE_ADD( APOLLO_DMA2_TAG, AM9517A, XTAL_14_31818MHz/3 ) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(apollo_state, apollo_dma_2_hrq_changed)) + MCFG_I8237_IN_MEMR_CB(READ8(apollo_state, apollo_dma_read_word)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(apollo_state, apollo_dma_write_word)) + MCFG_I8237_IN_IOR_1_CB(READ8(apollo_state, pc_dma8237_5_dack_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(apollo_state, pc_dma8237_6_dack_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(apollo_state, pc_dma8237_7_dack_r)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(apollo_state, pc_dma8237_5_dack_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(apollo_state, pc_dma8237_6_dack_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(apollo_state, pc_dma8237_7_dack_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(apollo_state, pc_dack4_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(apollo_state, pc_dack5_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(apollo_state, pc_dack6_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(apollo_state, pc_dack7_w)) + MCFG_PIC8259_ADD( APOLLO_PIC1_TAG, WRITELINE(apollo_state,apollo_pic8259_master_set_int_line), VCC, READ8(apollo_state, apollo_pic8259_get_slave_ack)) + MCFG_PIC8259_ADD( APOLLO_PIC2_TAG, WRITELINE(apollo_state,apollo_pic8259_slave_set_int_line), GND, NULL) + + MCFG_DEVICE_ADD(APOLLO_PTM_TAG, PTM6840, 0) + MCFG_PTM6840_INTERNAL_CLOCK(0) + MCFG_PTM6840_EXTERNAL_CLOCKS(250000, 125000, 62500) + MCFG_PTM6840_IRQ_CB(WRITELINE(apollo_state, apollo_ptm_irq_function)) + MCFG_DEVICE_ADD("ptmclock", CLOCK, 250000) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(apollo_state, apollo_ptm_timer_tick)) + + MCFG_MC146818_ADD( APOLLO_RTC_TAG, XTAL_32_768kHz ) + MCFG_MC146818_UTC( true ) + + MCFG_APOLLO_SIO_ADD( APOLLO_SIO2_TAG, XTAL_3_6864MHz ) + MCFG_APOLLO_SIO_IRQ_CALLBACK(WRITELINE(apollo_state, sio2_irq_handler)) + + MCFG_DEVICE_ADD(APOLLO_ISA_TAG, ISA16, 0) + MCFG_ISA16_CPU(":" MAINCPU) + MCFG_ISA16_BUS_CUSTOM_SPACES() + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir2_w)) // in place of irq 2 on at irq 9 is used + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir7_w)) + MCFG_ISA_OUT_IRQ10_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir2_w)) + MCFG_ISA_OUT_IRQ11_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ12_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ14_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ15_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir7_w)) + MCFG_ISA_OUT_DRQ0_CB(DEVWRITELINE(APOLLO_DMA1_TAG, am9517a_device, dreq0_w)) + MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE(APOLLO_DMA1_TAG, am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE(APOLLO_DMA1_TAG, am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE(APOLLO_DMA1_TAG, am9517a_device, dreq3_w)) + MCFG_ISA_OUT_DRQ5_CB(DEVWRITELINE(APOLLO_DMA2_TAG, am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ6_CB(DEVWRITELINE(APOLLO_DMA2_TAG, am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ7_CB(DEVWRITELINE(APOLLO_DMA2_TAG, am9517a_device, dreq3_w)) + MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa1", apollo_isa_cards, "wdc", false) + MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa2", apollo_isa_cards, "ctape", false) + MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa3", apollo_isa_cards, "3c505", false) + MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa4", apollo_isa_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa5", apollo_isa_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa6", apollo_isa_cards, NULL, false) + MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa7", apollo_isa_cards, NULL, false) + + MCFG_SOFTWARE_LIST_ADD("ctape_list", "apollo_ctape") +MACHINE_CONFIG_END + +// for machines with the keyboard and a graphics head +MACHINE_CONFIG_FRAGMENT( apollo ) + MCFG_FRAGMENT_ADD(common) + MCFG_APOLLO_SIO_ADD( APOLLO_SIO_TAG, XTAL_3_6864MHz ) + MCFG_APOLLO_SIO_IRQ_CALLBACK(WRITELINE(apollo_state, sio_irq_handler)) + MCFG_APOLLO_SIO_OUTPORT_CALLBACK(WRITE8(apollo_state, sio_output)) + MCFG_APOLLO_SIO_A_TX_CALLBACK(DEVWRITELINE(APOLLO_KBD_TAG, apollo_kbd_device, rx_w)) +MACHINE_CONFIG_END + +static DEVICE_INPUT_DEFAULTS_START( apollo_terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +// for headless machines using a serial console +MACHINE_CONFIG_FRAGMENT( apollo_terminal ) + MCFG_FRAGMENT_ADD(common) + MCFG_APOLLO_SIO_ADD( APOLLO_SIO_TAG, XTAL_3_6864MHz ) + MCFG_APOLLO_SIO_IRQ_CALLBACK(WRITELINE(apollo_state, sio_irq_handler)) + MCFG_APOLLO_SIO_OUTPORT_CALLBACK(WRITE8(apollo_state, sio_output)) + MCFG_APOLLO_SIO_B_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_b_w)) + + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", apollo_terminal) +MACHINE_CONFIG_END + +DRIVER_INIT_MEMBER(apollo_state,apollo) +{ + MLOG1(("driver_init_apollo")); +} + +MACHINE_START_MEMBER(apollo_state,apollo) +{ + MLOG1(("machine_start_apollo")); + + if (apollo_is_dn3000()) + { + //MLOG1(("faking mc146818 interrupts (DN3000 only)")); + // fake mc146818 interrupts (DN3000 only) + m_dn3000_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_state::apollo_rtc_timer),this)); + } +} + +MACHINE_RESET_MEMBER(apollo_state,apollo) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 year = apollo_rtc_r(space, 9); + + m_dma_channel = -1; + m_cur_eop = false; + + MLOG1(("machine_reset_apollo")); + + // set configuration + apollo_csr_set_servicemode(apollo_config(APOLLO_CONF_SERVICE_MODE)); + + // change year according to configuration settings + if (year < 20 && apollo_config(APOLLO_CONF_20_YEARS_AGO)) + { + year+=80; + apollo_rtc_w(space, 9, year); + } + else if (year < 25 && apollo_config(APOLLO_CONF_25_YEARS_AGO)) + { + year += 75; + apollo_rtc_w(space, 9, year); + } + else if (year >= 80 && !apollo_config(APOLLO_CONF_20_YEARS_AGO) + && !apollo_config(APOLLO_CONF_25_YEARS_AGO)) + { + year -=80; + apollo_rtc_w(space, 9, year); + } + + ptm_counter = 0; + sio_output_data = 0xff; + + if (apollo_is_dn3000()) + { + m_dn3000_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); + } +} diff --git a/src/mame/machine/apollo_dbg.c b/src/mame/machine/apollo_dbg.c new file mode 100644 index 00000000000..7111526c17e --- /dev/null +++ b/src/mame/machine/apollo_dbg.c @@ -0,0 +1,1182 @@ +// license:BSD-3-Clause +// copyright-holders:Hans Ostermeyer +/* + * debug/apollo.c - APOLLO DN3500/DN3000 debug functions + * + * Created on: Nov. 21, 2010 + * Author: Hans Ostermeyer + * + */ + +#define VERBOSE 1 + +#include "includes/apollo.h" +#include "cpu/m68000/m68kcpu.h" + +//------------------------------------------------------ +// TRAP 0 +//------------------------------------------------------ + +static const char* trap0[] = { +/* 0x00 */NULL, NULL, +/* 0x01 */"FIM_$GET_FIM_ADDR", "", +/* 0x02 */NULL, NULL, +/* 0x03 */"DTTY_$RELOAD_FONT", "", +/* 0x04 */"FILE_$UNLOCK_ALL", "", +/* 0x05 */NULL, NULL, +/* 0x06 */NULL, NULL, +/* 0x07 */"PROC2_$MY_PID", "", +/* 0x08 */"SMD_$OP_WAIT_U", "", +/* 0x09 */"TPAD_$RE_RANGE", "", +/* 0x0a */NULL, NULL, +/* 0x0b */NULL, NULL, +/* 0x0c */NULL, NULL, +/* 0x0d */"ACL_$UP", "", +/* 0x0e */"ACL_$DOWN", "", +/* 0x0f */NULL, NULL, +/* 0x10 */"TPAD_$INQ_DTYPE", "", +/* 0x11 */NULL, NULL, +/* 0x12 */"CACHE_$CLEAR", "", +/* 0x13 */"RIP_$ANNOUNCE_NS", "", +/* 0x14 */NULL, NULL, +/* 0x15 */NULL, NULL, +/* 0x16 */NULL, NULL, +/* 0x17 */NULL, NULL, +/* 0x18 */"PROC2_$DELIVER_PENDING", "", +/* 0x19 */"PROC2_$COMPLETE_FORK", "", +/* 0x1a */"PACCT_$STOP", "", +/* 0x1b */"PACCT_$ON", "", +/* 0x1c */"ACL_$GET_LOCAL_LOCKSMITH", "", +/* 0x1d */"ACL_$IS_SUSER", "", +/* 0x1e */NULL, NULL, +/* 0x1f */"SMD_$N_DEVICES", "", +/* 0x20 */"PROC1_$GET_MAXID", "", +/* 0x21 */"THREAD_$DELETE", "", +/* 0x22 */"THREAD_$SELF_OS", "", +/* 0x23 */"THREAD_$NUMBER_THREADS", "", +/* 0x24 */"ACL_$GET_PROTECT_OPTION", "", +/* 0x25 */"ACL_$PROTECT_CHECK", "", +/* 0x26 */"THREAD_$YIELD", "" }; + +//------------------------------------------------------ +// TRAP1 +//------------------------------------------------------ + +static const char* trap1[] = { +/* 0x00 */NULL, NULL, +/* 0x01 */NULL, NULL, +/* 0x02 */"FIM_$INSTALL", "x", +/* 0x03 */"NETWORK_$READ_SERVICE", "x", +/* 0x04 */"PROC1_$GET_CPUT", "x", +/* 0x05 */"SET_LITES_LOC", "x", +/* 0x06 */"TIME_$CLOCK", "x", +/* 0x07 */"ASKNODE_$READ_FAILURE_REC", "x", +/* 0x08 */"CAL_$APPLY_LOCAL_OFFSET", "x", +/* 0x09 */"CAL_$GET_INFO", "x", +/* 0x0a */"CAL_$GET_LOCAL_TIME", "x", +/* 0x0b */"CAL_$REMOVE_LOCAL_OFFSET", "x", +/* 0x0c */"CAL_$SET_DRIFT", "x", +/* 0x0d */"DISK_$GET_ERROR_INFO", "x", +/* 0x0e */NULL, NULL, +/* 0x0f */"MSG_$CLOSE", "x", +/* 0x10 */"PROC2_$WHO_AM_I", "u", +/* 0x11 */"SMD_$CLEAR_KBD_CURSOR", "x", +/* 0x12 */NULL, NULL, +/* 0x13 */NULL, NULL, +/* 0x14 */"SMD_$SEND_RESPONSE", "x", +/* 0x15 */"SMD_$STOP_TP_CURSOR", "x", +/* 0x16 */NULL, NULL, +/* 0x17 */NULL, NULL, +/* 0x18 */"SMD_$UNMAP_DISPLAY_U", "x", +/* 0x19 */"UID_$GEN", "x", +/* 0x1a */"TONE_$TIME", "x", +/* 0x1b */"SMD_$INQ_DISP_TYPE", "x", +/* 0x1c */NULL, NULL, +/* 0x1d */NULL, NULL, +/* 0x1e */NULL, NULL, +/* 0x1f */"TPAD_$SET_CURSOR", "x", +/* 0x20 */NULL, NULL, +/* 0x21 */NULL, NULL, +/* 0x22 */"NAME_$GET_WDIR_UID", "u", +/* 0x23 */"NAME_$GET_NDIR_UID", "u", +/* 0x24 */"NAME_$GET_ROOT_UID", "u", +/* 0x25 */"NAME_$GET_NODE_UID", "u", +/* 0x26 */"NAME_$GET_NODE_DATA_UID", "u", +/* 0x27 */"NAME_$GET_CANNED_ROOT_UID", "u", +/* 0x28 */"MSG_$GET_MY_NET", "x", +/* 0x29 */"MSG_$GET_MY_NODE", "x", +/* 0x2a */NULL, NULL, +/* 0x2b */NULL, NULL, +/* 0x2c */NULL, NULL, +/* 0x2d */NULL, NULL, +/* 0x2e */NULL, NULL, +/* 0x2f */NULL, NULL, +/* 0x30 */"GPU_$INIT", "x", +/* 0x31 */NULL, NULL, +/* 0x32 */"SMD_$INIT_STATE", "x", +/* 0x33 */"SMD_$CLR_TRK_RECT", "x", +/* 0x34 */"PROC2_$GET_SIG_MASK", "x", +/* 0x35 */"FIM_$FRESTORE", "x", +/* 0x36 */"TIME_$GET_TIME_OF_DAY", "x", +/* 0x37 */"PROC1_$GET_LOADAV", "x", +/* 0x38 */"PROC2_$GET_BOOT_FLAGS", "x", +/* 0x39 */NULL, NULL, +/* 0x3a */"PROC2_$SET_TTY", "x", +/* 0x3b */"OS_$SHUTDOWN", "x", +/* 0x3c */"PBU_$FAULTED_UNITS", "x", +/* 0x3d */"PROC2_$GET_CPU_USAGE", "x", +/* 0x3e */NULL, NULL, +/* 0x3f */NULL, NULL, +/* 0x40 */NULL, NULL, +/* 0x41 */"TIME_$GET_ADJUST", "x", +/* 0x42 */"FILE_$SYNC", "x", +/* 0x43 */"XPAGE_$IS_MAPPED", "x", +/* 0x44 */"THREAD_$SUSPEND_FOR_FORK", "x", +/* 0x45 */"THREAD_$RESUME_FOR_FORK", "x" }; + +//------------------------------------------------------ +// TRAP2 +//------------------------------------------------------ + +static const char* trap2[] = { +/* 0x00 */NULL, NULL, +/* 0x01 */NULL, NULL, +/* 0x02 */"FILE_$DELETE", "x,x", +/* 0x03 */"EC2_$WAKEUP", "x,x", +/* 0x04 */NULL, NULL, +/* 0x05 */"ACL_$GET_SID", "x,x", +/* 0x06 */"FILE_$MK_PERMANENT", "x,x", +/* 0x07 */"FILE_$UNLOCK_VOL", "x,x", +/* 0x08 */"CAL_$READ_TIMEZONE", "x,x", +/* 0x09 */"CAL_$SEC_TO_CLOCK", "x,x", +/* 0x0a */"CAL_$WRITE_TIMEZONE", "x,x", +/* 0x0b */"DISK_$UNASSIGN", "x,x", +/* 0x0c */"FILE_$FORCE_UNLOCK", "x,x", +/* 0x0d */"FILE_$FW_FILE", "x,x", +/* 0x0e */"FILE_$MK_IMMUTABLE", "x,x", +/* 0x0f */"FILE_$PURIFY", "x,x", +/* 0x10 */"GET_BUILD_TIME", "x,x", +/* 0x11 */NULL, NULL, +/* 0x12 */NULL, NULL, +/* 0x13 */"MSG_$ALLOCATE", "x,x", +/* 0x14 */"MSG_$OPEN", "x,x", +/* 0x15 */"MSG_$WAIT", "x,x", +/* 0x16 */NULL, NULL, +/* 0x17 */NULL, NULL, +/* 0x18 */"PBU_$DEVICE_INTERRUPTING", "x,x", +/* 0x19 */"PBU_$DISABLE_DEVICE", "x,x", +/* 0x1a */"PBU_$ENABLE_DEVICE", "x,x", +/* 0x1b */"PBU_$FREE_MAP", "x,x", +/* 0x1c */"PROC2_$QUIT", "x,x", +/* 0x1d */"PROC2_$RESUME", "x,x", +/* 0x1e */"PROC2_$SUSPEND", "x,x", +/* 0x1f */NULL, NULL, +/* 0x20 */NULL, NULL, +/* 0x21 */NULL, NULL, +/* 0x22 */NULL, NULL, +/* 0x23 */NULL, NULL, +/* 0x24 */NULL, NULL, +/* 0x25 */NULL, NULL, +/* 0x26 */"SMD_$MAP_DISPLAY_U", "x,x", +/* 0x27 */"SMD_$MOVE_KBD_CURSOR", "x,x", +/* 0x28 */NULL, NULL, +/* 0x29 */"SMD_$RETURN_DISPLAY", "x,x", +/* 0x2a */NULL, NULL, +/* 0x2b */NULL, NULL, +/* 0x2c */NULL, NULL, +/* 0x2d */NULL, NULL, +/* 0x2e */"PEB_$GET_INFO", "x,x", +/* 0x2f */NULL, NULL, +/* 0x30 */"EC2_$GET_VAL", "x,x", +/* 0x31 */"AST_$ADD_ASTES", "x,x", +/* 0x32 */"PBU_$DISSOC", "x,x", +/* 0x33 */"PROC2_$MAKE_ORPHAN", "x,x", +/* 0x34 */"FILE_$DELETE_FORCE", "x,x", +/* 0x35 */"FILE_$DELETE_WHEN_UNLOCKED", "x,x", +/* 0x36 */"FILE_$MK_TEMPORARY", "x,x", +/* 0x37 */NULL, NULL, +/* 0x38 */NULL, NULL, +/* 0x39 */NULL, NULL, +/* 0x3a */NULL, NULL, +/* 0x3b */"SMD_$INQ_KBD_CURSOR", "x,x", +/* 0x3c */"ACL_$ENTER_SUBS", "u,x", +/* 0x3d */NULL, NULL, +/* 0x3e */NULL, NULL, +/* 0x3f */NULL, NULL, +/* 0x40 */NULL, NULL, +/* 0x41 */NULL, NULL, +/* 0x42 */"FILE_$DELETE_FORCE_WHEN_UNLOCKED", "x,x", +/* 0x43 */NULL, NULL, +/* 0x44 */"CT_$ACQUIRE", "x,x", +/* 0x45 */"HINT_$ADD", "x,x", +/* 0x46 */"DIR_$FIX_DIR", "x,x", +/* 0x47 */"NAME_$SET_WDIRUS", "u,x", +/* 0x48 */"NAME_$SET_NDIRUS", "u,x", +/* 0x49 */NULL, NULL, +/* 0x4a */NULL, NULL, +/* 0x4b */"MSG_$CLOSEI", "x,x", +/* 0x4c */"NETWORK_$ADD_PAGE_SERVERS", "x,x", +/* 0x4d */"NETWORK_$ADD_REQUEST_SERVERS", "x,x", +/* 0x4e */"ACL_$ADD_PROJ", "x,x", +/* 0x4f */"ACL_$DELETE_PROJ", "x,x", +/* 0x50 */NULL, NULL, +/* 0x51 */NULL, NULL, +/* 0x52 */"SMD_$SET_TP_REPORTING", "x,x", +/* 0x53 */"SMD_$DISABLE_TRACKING", "x,x", +/* 0x54 */NULL, NULL, +/* 0x55 */NULL, NULL, +/* 0x56 */NULL, NULL, +/* 0x57 */NULL, NULL, +/* 0x58 */"HINT_$ADDI", "x,x", +/* 0x59 */NULL, NULL, +/* 0x5a */NULL, NULL, +/* 0x5b */"PBU_$ALLOCATE_EC", "x,x", +/* 0x5c */"SMD_$SET_DISP_UNIT", "x,x", +/* 0x5d */"SMD_$VIDEO_CTL", "x,x", +/* 0x5e */"SMD_$SET_CURSOR_POS", "x,x", +/* 0x5f */"TERM_$SEND_KBD_STRING", "x,x", +/* 0x60 */"AUDIT_$CONTROL", "x,x", +/* 0x61 */"PROC2_$SIGBLOCK", "x,x", +/* 0x62 */"PROC2_$SIGSETMASK", "x,x", +/* 0x63 */"PROC2_$SIGPAUSE", "x,x", +/* 0x64 */"ACL_$FIPS_CTL", "x,x", +/* 0x65 */"AS_$GET_ADDR", "x,x", +/* 0x66 */"PROC2_$GET_ASID", "x,x", +/* 0x67 */"TTY_$K_FLUSH_INPUT", "x,x", +/* 0x68 */"TTY_$K_FLUSH_OUTPUT", "x,x", +/* 0x69 */"TTY_$K_DRAIN_OUTPUT", "x,x", +/* 0x6a */"PROC2_$DEBUG", "x,x", +/* 0x6b */"PROC2_$UNDEBUG", "x,x", +/* 0x6c */"ACL_$DEF_ACLDATA", "x,x", +/* 0x6d */"PROC2_$OVERRIDE_DEBUG", "x,x", +/* 0x6e */"TIME_$SET_TIME_OF_DAY", "x,x", +/* 0x6f */"CAL_$DECODE_TIME", "x,x", +/* 0x70 */"ACL_$INHERIT_SUBSYS", "x,x", +/* 0x71 */"ACL_$SET_LOCAL_LOCKSMITH", "x,x", +/* 0x72 */NULL, NULL, +/* 0x73 */"SMD_$DISSOC", "x,x", +/* 0x74 */"SMD_$BUSY_WAIT", "x,x", +/* 0x75 */"TTY_$K_OLD_RESET", "x,x", +/* 0x76 */NULL, NULL, +/* 0x77 */NULL, NULL, +/* 0x78 */NULL, NULL, +/* 0x79 */"SCSI_$ABORT_OPERATION", "x,x", +/* 0x7a */"SCSI_$RELEASE", "x,x", +/* 0x7b */"SCSI_$RESET_DEVICE", "x,x", +/* 0x7c */NULL, NULL, +/* 0x7d */"TPAD_$RE_RANGE_UNIT", "x,x", +/* 0x7e */"DISK_$FORMAT_WHOLE", "x,x", +/* 0x7f */NULL, NULL, +/* 0x80 */NULL, NULL, +/* 0x81 */NULL, NULL, +/* 0x82 */NULL, NULL, +/* 0x83 */NULL, NULL, +/* 0x84 */"SMD_$SEND_UNIT_RESPONSE", "x,x", +/* 0x85 */NULL, NULL, +/* 0x86 */"MST_$FW_XTAL", "x,x", +/* 0x87 */"THREAD_$TERMINATE", "x,x", +/* 0x88 */"THREAD_$TERMINATE_ALL", "u,x", +/* 0x89 */"THREAD_$SUSPEND", "x,x", +/* 0x8a */"THREAD_$RESUME", "x,x", +/* 0x8b */"THREAD_$HANDLE_SIGNALS", "x,x", +/* 0x8c */"THREAD_$ABORT", "x,x", +/* 0x8d */"ACL_$SET_PROTECT_OPTION", "x,x", +/* 0x8e */"TTY_$K_SUSPEND_INPUT", "x,x", +/* 0x8f */"TTY_$K_RESUME_INPUT", "x,x", +/* 0x90 */"TTY_$K_SUSPEND_OUTPUT", "x,x", +/* 0x91 */"TTY_$K_RESUME_OUTPUT", "x,x" }; + +//------------------------------------------------------ +// TRAP3 +//------------------------------------------------------ + +static const char* trap3[] = { +/* 0x00 */"PBU2_$DMA_STOP", "x,x,x", +/* 0x01 */NULL, NULL, +/* 0x02 */"FILE_$CREATE", "x,x,x", +/* 0x03 */"FILE_$UNLOCK", "u,x,x", +/* 0x04 */"FILE_$TRUNCATE", "u,x,x", +/* 0x05 */"MST_$UNMAPS", "x,x,x", +/* 0x06 */"VFMT_$WRITE", "s,x,x", +/* 0x07 */"FILE_$ATTRIBUTES", "x,x,x", +/* 0x08 */"FILE_$SET_LEN", "x,x,x", +/* 0x09 */"FILE_$SET_TYPE", "x,x,x", +/* 0x0a */NULL, NULL, +/* 0x0b */NULL, NULL, +/* 0x0c */NULL, NULL, +/* 0x0d */NULL, NULL, +/* 0x0e */"NETWORK_$SET_SERVICE", "x,x,x", +/* 0x0f */"ASKNODE_$WHO", "s,x,x", +/* 0x10 */"FILE_$ACT_ATTRIBUTES", "x,x,x", +/* 0x11 */"FILE_$LOCATE", "x,x,x", +/* 0x12 */"FILE_$NEIGHBORS", "x,x,x", +/* 0x13 */"FILE_$READ_LOCK_ENTRYU", "x,x,x", +/* 0x14 */"FILE_$SET_ACL", "x,x,x", +/* 0x15 */"FILE_$SET_DIRPTR", "x,x,x", +/* 0x16 */"FILE_$SET_TROUBLE", "x,x,x", +/* 0x17 */NULL, NULL, +/* 0x18 */NULL, NULL, +/* 0x19 */NULL, NULL, +/* 0x1a */NULL, NULL, +/* 0x1b */NULL, NULL, +/* 0x1c */"PBU_$DMA_STOP", "x,x,x", +/* 0x1d */"PBU_$SETDOWN", "x,x,x", +/* 0x1e */"PBU_$SETUP", "x,x,x", +/* 0x1f */"PROC2_$LIST", "x,x,x", +/* 0x20 */"FIM_$SINGLE_STEP", "x,x,x", +/* 0x21 */"SMD_$ASSOC", "x,x,x", +/* 0x22 */"SMD_$BORROW_DISPLAY", "x,x,x", +/* 0x23 */NULL, NULL, +/* 0x24 */NULL, NULL, +/* 0x25 */"SMD_$SET_TP_CURSOR", "x,x,x", +/* 0x26 */"TIME_$WAIT", "x,x,x", +/* 0x27 */"RINGLOG_$CNTL", "x,x,x", +/* 0x28 */"SMD_$ALLOC_HDM", "x,x,x", +/* 0x29 */"SMD_$FREE_HDM", "x,x,x", +/* 0x2a */NULL, NULL, +/* 0x2b */"OS_$GET_EC", "x,x,x", +/* 0x2c */"TIME_$GET_EC", "x,x,x", +/* 0x2d */NULL, NULL, +/* 0x2e */"PROC2_$UPID_TO_UID", "x,u,x", +/* 0x2f */"MSG_$GET_EC", "x,x,x", +/* 0x30 */"DISK_$AS_OPTIONS", "x,x,x", +/* 0x31 */"SMD_$GET_EC", "x,x,x", +/* 0x32 */"NAME_$SET_ACL", "x,x,x", +/* 0x33 */"FILE_$SET_REFCNT", "x,x,x", +/* 0x34 */NULL, NULL, +/* 0x35 */"PROC1_$GET_INFO", "x,x,x", +/* 0x36 */NULL, NULL, +/* 0x37 */NULL, NULL, +/* 0x38 */NULL, NULL, +/* 0x39 */NULL, NULL, +/* 0x3a */NULL, NULL, +/* 0x3b */NULL, NULL, +/* 0x3c */"AS_$GET_INFO", "x,x,x", +/* 0x3d */"FILE_$SET_DTM", "x,x,x", +/* 0x3e */"FILE_$SET_DTU", "x,x,x", +/* 0x3f */NULL, NULL, +/* 0x40 */"LOG_$READ", "x,x,x", +/* 0x41 */"PROC2_$SET_PGROUP", "x,x,x", +/* 0x42 */"SMD_$SET_BLANK_TIMEOUT", "x,x,x", +/* 0x43 */"SMD_$INQ_BLANK_TIMEOUT", "x,x,x", +/* 0x44 */"FILE_$REMOVE_WHEN_UNLOCKED", "x,x,x", +/* 0x45 */"CT_$RELEASE", "x,x,x", +/* 0x46 */"PROC2_$UPGID_TO_UID", "x,x,x", +/* 0x47 */"TIME_$GET_ITIMER", "x,x,x", +/* 0x48 */"DIR_$SET_DAD", "x,x,x", +/* 0x49 */NULL, NULL, +/* 0x4a */NULL, NULL, +/* 0x4b */NULL, NULL, +/* 0x4c */NULL, NULL, +/* 0x4d */NULL, NULL, +/* 0x4e */NULL, NULL, +/* 0x4f */"RIP_$TABLE", "x,x,x", +/* 0x50 */"FILE_$LOCATEI", "x,x,x", +/* 0x51 */"MSG_$OPENI", "x,x,x", +/* 0x52 */"MSG_$ALLOCATEI", "x,x,x", +/* 0x53 */"MSG_$WAITI", "x,x,x", +/* 0x54 */"ACL_$SET_PROJ_LIST", "x,x,x", +/* 0x55 */"ACL_$GET_RE_SIDS", "x,x,x", +/* 0x56 */NULL, NULL, +/* 0x57 */"MSG_$SET_HPIPC", "x,x,x", +/* 0x58 */"DIR_$VALIDATE_ROOT_ENTRY", "x,x,x", +/* 0x59 */"SMD_$ENABLE_TRACKING", "x,x,x", +/* 0x5a */"FILE_$READ_LOCK_ENTRYUI", "x,x,x", +/* 0x5b */NULL, NULL, +/* 0x5c */"ROUTE_$SERVICE", "x,x,x", +/* 0x5d */NULL, NULL, +/* 0x5e */NULL, NULL, +/* 0x5f */NULL, NULL, +/* 0x60 */"PBU_$ADVANCE_EC", "x,x,x", +/* 0x61 */"PBU_$RELEASE_EC", "x,x,x", +/* 0x62 */NULL, NULL, +/* 0x63 */"SMD_$GET_IDM_EVENT", "x,x,x", +/* 0x64 */"MSG_$TEST_FOR_MESSAGE", "x,x,x", +/* 0x65 */"SMD_$ADD_TRK_RECT", "x,x,x", +/* 0x66 */"SMD_$DEL_TRK_RECT", "x,x,x", +/* 0x67 */"SMD_$SET_KBD_TYPE", "x,x,x", +/* 0x68 */NULL, NULL, +/* 0x69 */"FILE_$SET_AUDITED", "x,x,x", +/* 0x6a */"PROC2_$ACKNOWLEDGE", "x,x,x", +/* 0x6b */"PROC2_$GET_MY_UPIDS", "x,x,x", +/* 0x6c */"TTY_$K_INQ_INPUT_FLAGS", "x,x,x", +/* 0x6d */"TTY_$K_INQ_OUTPUT_FLAGS", "x,x,x", +/* 0x6e */"TTY_$K_INQ_ECHO_FLAGS", "x,x,x", +/* 0x6f */"TTY_$K_SET_INPUT_BREAK_MODE", "x,x,x", +/* 0x70 */"TTY_$K_INQ_INPUT_BREAK_MODE", "x,x,x", +/* 0x71 */"TTY_$K_SET_PGROUP", "x,x,x", +/* 0x72 */"TTY_$K_INQ_PGROUP", "x,x,x", +/* 0x73 */"TTY_$K_SIMULATE_TERMINAL_INPUT", "x,x,x", +/* 0x74 */"TTY_$K_INQ_FUNC_ENABLED", "x,x,x", +/* 0x75 */"SIO_$K_TIMED_BREAK", "x,x,x", +/* 0x76 */"FILE_$SET_DEVNO", "x,x,x", +/* 0x77 */"XPD_$SET_PTRACE_OPTS", "x,x,x", +/* 0x78 */"XPD_$INQ_PTRACE_OPTS", "x,x,x", +/* 0x79 */"FILE_$SET_MAND_LOCK", "x,x,x", +/* 0x7a */"TIME_$SET_CPU_LIMIT", "x,x,x", +/* 0x7b */"CAL_$WEEKDAY", "x,x,x", +/* 0x7c */"SIO_$K_SIGNAL_WAIT", "x,x,x", +/* 0x7d */"TERM_$SET_DISCIPLINE", "x,x,x", +/* 0x7e */"PROC2_$SET_SERVER", "x,x,x", +/* 0x7f */"PACCT_$START", "x,x,x", +/* 0x80 */"FILE_$SET_DTU_F", "x,x,x", +/* 0x81 */"PROC2_$PGUID_TO_UPGID", "x,x,x", +/* 0x82 */"TERM_$INQ_DISCIPLINE", "x,x,x", +/* 0x83 */"PBU_$DMA_STATUS", "x,x,x", +/* 0x84 */NULL, NULL, +/* 0x85 */"MST_$UNMAPS_AND_FREE_AREA", "x,x,x", +/* 0x86 */"SMD_$ASSOC_CSRS", "x,x,x", +/* 0x87 */"SMD_$INQ_DISP_INFO", "x,x,x", +/* 0x88 */"SMD_$INQ_DISP_UID", "x,x,x", +/* 0x89 */"SMD_$DISPLAY_LOGO", "x,x,x", +/* 0x8a */"TERM_$SET_REAL_LINE_DISCIPLINE", "x,x,x", +/* 0x8b */"TIME_$ADJUST_TIME_OF_DAY", "x,x,x", +/* 0x8c */"PROC2_$UID_TO_UPID", "x,x,x", +/* 0x8d */"PROC2_$SET_SESSION_ID", "x,x,x", +/* 0x8e */"SMD_$GET_UNIT_EVENT", "x,x,x", +/* 0x8f */"TPAD_$SET_UNIT_CURSOR", "x,x,x", +/* 0x90 */"TPAD_$SET_PUNCH_IMPACT", "x,x,x", +/* 0x91 */"TPAD_$INQ_PUNCH_IMPACT", "x,x,x", +/* 0x92 */"TTY_$K_INQ_SESSION_ID", "x,x,x", +/* 0x93 */"TTY_$K_SET_SESSION_ID", "x,x,x", +/* 0x94 */NULL, NULL, +/* 0x95 */NULL, NULL, +/* 0x96 */NULL, NULL, +/* 0x97 */NULL, NULL, +/* 0x98 */"SMD_$SHARE_DEVICE", "x,x,x", +/* 0x99 */"SMD_$SET_UNIT_CURSOR_POS", "x,x,x", +/* 0x9a */"SMD_$CLR_AND_LOAD_TRK_RECT", "x,x,x", +/* 0x9b */"PROC2_$GET_PARM", "x,x,x", +/* 0x9c */NULL, NULL, +/* 0x9d */NULL, NULL, +/* 0x9e */NULL, NULL, +/* 0x9f */"FILE_$CW_READ", "x,x,x", +/* 0xa0 */"FILE_$CW_WRITE", "x,x,x", +/* 0xa1 */"MST_$TRUNC_XTAL", "x,x,x", +/* 0xa2 */"MST_$SET_LEN_XTAL", "x,x,x", +/* 0xa3 */"THREAD_$CREATE", "x,x,x", +/* 0xa4 */"THREAD_$CLEANUP", "x,x,x", +/* 0xa5 */"THREAD_$SET_INH_PTR", "x,x,x", +/* 0xa6 */"SMD_$BORROW_DISPLAY_AND_KBD", "x,x,x", +/* 0xa7 */"THREAD_$CLEANUP_ALL", "x,x,x", +/* 0xa8 */"DIR_$ADD_MOUNT", "x,x,x", +/* 0xa9 */"DIR_$REMOVE_MOUNT", "x,x,x", +/* 0xaa */NULL, NULL, +/* 0xab */"TTY_$K_RESET", "x,x,x", +/* 0xac */"MST_$SHADOW_MAP", "x,x,x", +/* 0xad */NULL, NULL }; + +//------------------------------------------------------ +// TRAP4 +//------------------------------------------------------ + +static const char* trap4[] = { +/* 0x00 */NULL, NULL, +/* 0x01 */"MST_$SET_GUARD", "u,x,x,x", +/* 0x02 */"MST_$UNMAP_GLOBAL", "u,x,x,x", +/* 0x03 */"MST_$GET_UID", "x,u,x,x", +/* 0x04 */"EC2_$WAIT", "x,x,x,x", +/* 0x05 */"FILE_$READ_LOCK_ENTRY", "x,x,x,x", +/* 0x06 */"MST_$UNMAP", "u,x,x,x", +/* 0x07 */"MST_$GROW_AREA", "x,x,x,x", +/* 0x08 */NULL, NULL, +/* 0x09 */NULL, NULL, +/* 0x0a */NULL, NULL, +/* 0x0b */NULL, NULL, +/* 0x0c */"TERM_$CONTROL", "x,x,x,x", +/* 0x0d */"TERM_$READ", "x,s,x,x", +/* 0x0e */"TERM_$WRITE", "x,x,x,x", +/* 0x0f */"DISK_$FORMAT", "x,x,x,x", +/* 0x10 */"DISK_$LV_ASSIGN", "x,x,x,x", +/* 0x11 */"FILE_$FW_PARTIAL", "x,x,x,x", +/* 0x12 */NULL, NULL, +/* 0x13 */NULL, NULL, +/* 0x14 */NULL, NULL, +/* 0x15 */NULL, NULL, +/* 0x16 */NULL, NULL, +/* 0x17 */NULL, NULL, +/* 0x18 */NULL, NULL, +/* 0x19 */NULL, NULL, +/* 0x1a */NULL, NULL, +/* 0x1b */NULL, NULL, +/* 0x1c */NULL, NULL, +/* 0x1d */NULL, NULL, +/* 0x1e */NULL, NULL, +/* 0x1f */NULL, NULL, +/* 0x20 */NULL, NULL, +/* 0x21 */NULL, NULL, +/* 0x22 */NULL, NULL, +/* 0x23 */"PBU_$WAIT", "x,x,x,x", +/* 0x24 */"PBU_$GET_PTR", "x,x,x,x", +/* 0x25 */"PCHIST_$CNTL", "x,x,x,x", +/* 0x26 */"PROC2_$GET_INFO", "u,x,x,x", +/* 0x27 */NULL, NULL, +/* 0x28 */NULL, NULL, +/* 0x29 */NULL, NULL, +/* 0x2a */"SMD_$SIGNAL", "x,x,x,x", +/* 0x2b */NULL, NULL, +/* 0x2c */NULL, NULL, +/* 0x2d */"TERM_$INQUIRE", "x,x,x,x", +/* 0x2e */NULL, NULL, +/* 0x2f */NULL, NULL, +/* 0x30 */NULL, NULL, +/* 0x31 */"TERM_$GET_EC", "x,x,x,x", +/* 0x32 */NULL, NULL, +/* 0x33 */"PBU_$GET_EC", "x,x,x,x", +/* 0x34 */NULL, NULL, +/* 0x35 */NULL, NULL, +/* 0x36 */NULL, NULL, +/* 0x37 */NULL, NULL, +/* 0x38 */"TERM_$READ_COND", "x,x,x,x", +/* 0x39 */NULL, NULL, +/* 0x3a */NULL, NULL, +/* 0x3b */"PBU2_$WIRE", "x,x,x,x", +/* 0x3c */"PROC2_$SET_NAME", "x,x,x,x", +/* 0x3d */"PROC2_$SET_PRIORITY", "x,x,x,x", +/* 0x3e */"PROC2_$GET_EC", "u,x,x,x", +/* 0x3f */"PROC2_$LIST_PGROUP", "x,x,x,x", +/* 0x40 */NULL, NULL, +/* 0x41 */NULL, NULL, +/* 0x42 */NULL, NULL, +/* 0x43 */"CT_$CONTROL", "x,x,x,x", +/* 0x44 */"CT_$WAIT", "x,x,x,x", +/* 0x45 */"DIR_$DROP_DIRU", "x,x,x,x", +/* 0x46 */"DIR_$SET_DEFAULT_ACL", "x,x,x,x", +/* 0x47 */"DIR_$GET_DEFAULT_ACL", "x,x,x,x", +/* 0x48 */"NAME_$READ_DIRS_PS", "x,x,x,x", +/* 0x49 */NULL, NULL, +/* 0x4a */"ACL_$GET_PROJ_LIST", "x,x,x,x", +/* 0x4b */"MST_$CHANGE_RIGHTS", "x,x,x,x", +/* 0x4c */NULL, NULL, +/* 0x4d */"FILE_$READ_LOCK_ENTRYI", "x,x,x,x", +/* 0x4e */"ROUTE_$INCOMING", "x,x,x,x", +/* 0x4f */NULL, NULL, +/* 0x50 */"SMD_$INQ_KBD_TYPE", "x,x,x,x", +/* 0x51 */"ROUTE_$GET_EC", "x,x,x,x", +/* 0x52 */NULL, NULL, +/* 0x53 */"SMD_$DM_COND_EVENT_WAIT", "x,x,x,x", +/* 0x54 */"DISK_$READ_MFG_BADSPOTS", "x,x,x,x", +/* 0x55 */"DISK_$GET_MNT_INFO", "x,x,x,x", +/* 0x56 */"PROC2_$SET_SIG_MASK", "x,x,x,x", +/* 0x57 */"PROC2_$SIGRETURN", "x,x,x,x", +/* 0x58 */"PROC2_$WAIT", "x,x,x,x", +/* 0x59 */"PROC2_$SIGNAL", "x,x,x,x", +/* 0x5a */"PROC2_$SIGNAL_PGROUP", "x,x,x,x", +/* 0x5b */"PROC2_$GET_CR_REC", "x,x,x,x", +/* 0x5c */"TTY_$K_SET_FUNC_CHAR", "x,x,x,x", +/* 0x5d */"TTY_$K_INQ_FUNC_CHAR", "x,x,x,x", +/* 0x5e */"TTY_$K_SET_INPUT_FLAG", "x,x,x,x", +/* 0x5f */"TTY_$K_SET_OUTPUT_FLAG", "x,x,x,x", +/* 0x60 */"TTY_$K_SET_ECHO_FLAG", "x,x,x,x", +/* 0x61 */"TTY_$K_ENABLE_FUNC", "x,x,x,x", +/* 0x62 */"SIO_$K_SET_PARAM", "x,x,x,x", +/* 0x63 */"SIO_$K_INQ_PARAM", "x,x,x,x", +/* 0x64 */"FILE_$SET_MGR_ATTR", "x,x,x,x", +/* 0x65 */"XPD_$GET_REGISTERS", "x,x,x,x", +/* 0x66 */"XPD_$PUT_REGISTERS", "x,x,x,x", +/* 0x67 */"FILE_$RESERVE", "u,x,x,x", +/* 0x68 */NULL, NULL, +/* 0x69 */"ACL_$GET_RES_SIDS", "x,x,x,x", +/* 0x6a */"FILE_$FW_PAGES", "x,x,x,x", +/* 0x6b */"PROC2_$SET_ACCT_INFO", "s,x,x,x", +/* 0x6c */"FILE_$IMPORT_LK", "x,x,x,x", +/* 0x6d */"FILE_$UNLOCK_D", "u,x,x,x", +/* 0x6e */"FILE_$SET_LEN_D", "x,x,x,x", +/* 0x6f */"FILE_$TRUNCATE_D", "x,x,x,x", +/* 0x70 */"FILE_$SET_DTM_F", "x,x,x,x", +/* 0x71 */"TTY_$K_SET_FLAG", "x,x,x,x", +/* 0x72 */NULL, NULL, +/* 0x73 */"MST_$UNMAP_AND_FREE_AREA", "x,x,x,x", +/* 0x74 */NULL, NULL, +/* 0x75 */"PROC2_$NAME_TO_UID", "S,w,u,x", +/* 0x76 */NULL, NULL, +/* 0x77 */NULL, NULL, +/* 0x78 */NULL, NULL, +/* 0x79 */"SCSI_$GET_EC", "x,x,x,x", +/* 0x7a */"SCSI_$GET_INFO", "x,x,x,x", +/* 0x7b */"SCSI_$SETUP", "x,x,x,x", +/* 0x7c */"SCSI_$WIRE", "x,x,x,x", +/* 0x7d */"MSG_$SHARE_SOCKET", "x,x,x,x", +/* 0x7e */"TTY_$K_INQ_DELAY", "x,x,x,x", +/* 0x7f */"TTY_$K_SET_DELAY", "x,x,x,x", +/* 0x80 */NULL, NULL, +/* 0x81 */NULL, NULL, +/* 0x82 */"PROC2_$PGROUP_INFO", "x,x,x,x", +/* 0x83 */"PROC2_$SET_PARM", "x,x,x,x", +/* 0x84 */NULL, NULL, +/* 0x85 */NULL, NULL, +/* 0x86 */"XPAGE_$PAGER_RENDEZVOUS", "x,x,x,x", +/* 0x87 */"FILE_$SET_DEVNO32", "x,x,x,x", +/* 0x88 */"MST_$SET_LIMIT", "x,x,x,x", +/* 0x89 */"THREAD_$SET_PRIORITY", "x,x,x,x", +/* 0x8a */"THREAD_$INFO", "x,x,x,x", +/* 0x8b */"TTY_$K_SET_DELAY_STYLE", "x,x,x,x", +/* 0x8c */"TTY_$K_INQ_DELAY_STYLE", "x,x,x,x" }; + +//------------------------------------------------------ +// TRAP5 +//------------------------------------------------------ + +static const char* trap5[] = { +/* 0x00 */NULL, NULL, +/* 0x01 */"MST_$MAP_AREA", "x,x,x,u,x", +/* 0x02 */NULL, NULL, +/* 0x03 */NULL, NULL, +/* 0x04 */NULL, NULL, +/* 0x05 */"ACL_$RIGHTS", "x,x,x,x,x", +/* 0x06 */NULL, NULL, +/* 0x07 */"ASKNODE_$INFO", "x,x,x,x,x", +/* 0x08 */"DISK_$AS_READ", "x,x,x,x,x", +/* 0x09 */"DISK_$AS_WRITE", "x,x,x,x,x", +/* 0x0a */NULL, NULL, +/* 0x0b */NULL, NULL, +/* 0x0c */NULL, NULL, +/* 0x0d */NULL, NULL, +/* 0x0e */NULL, NULL, +/* 0x0f */NULL, NULL, +/* 0x10 */NULL, NULL, +/* 0x11 */"PBU_$GET_DCTE", "x,x,x,x,x", +/* 0x12 */"PBU_$READ_CSR", "x,x,x,x,x", +/* 0x13 */"PBU_$CONTROL", "x,x,x,x,x", +/* 0x14 */"PBU2_$WIRE_MAP", "x,x,x,x,x", +/* 0x15 */"PBU_$WRITE_CSR", "x,x,x,x,x", +/* 0x16 */"TPAD_$INQUIRE", "x,x,x,x,x", +/* 0x17 */"TPAD_$SET_MODE", "x,x,x,x,x", +/* 0x18 */"VFMT_$MAIN", "x,x,x,x,x", +/* 0x19 */"VOLX_$GET_INFO", "x,x,x,x,x", +/* 0x1a */"VTOC_$GET_UID", "x,x,x,x,x", +/* 0x1b */"NETLOG_$CNTL", "x,x,x,x,x", +/* 0x1c */"PROC2_$GET_UPIDS", "x,x,x,x,x", +/* 0x1d */NULL, NULL, +/* 0x1e */NULL, NULL, +/* 0x1f */"PBU2_$ALLOCATE_MAP", "x,x,x,x,x", +/* 0x20 */"PBU2_$MAP", "x,x,x,x,x", +/* 0x21 */"PBU2_$UNMAP", "x,x,x,x,x", +/* 0x22 */"PBU2_$UNWIRE", "x,x,x,x,x", +/* 0x23 */"MST_$GET_UID_ASID", "x,x,x,x,x", +/* 0x24 */"MST_$INVALIDATE", "x,x,u,x,x", +/* 0x25 */"FILE_$INVALIDATE", "x,x,x,x,x", +/* 0x26 */NULL, NULL, +/* 0x27 */NULL, NULL, +/* 0x28 */NULL, NULL, +/* 0x29 */"MST_$SET_TOUCH_AHEAD_CNT", "x,x,x,x,x", +/* 0x2a */"OS_$CHKSUM", "x,x,x,x,x", +/* 0x2b */"FILE_$GET_SEGMENT_MAP", "x,x,x,x,x", +/* 0x2c */NULL, NULL, +/* 0x2d */"PBU2_$ASSOC", "x,x,x,x,x", +/* 0x2e */"FILE_$UNLOCK_PROC", "x,x,x,x,x", +/* 0x2f */"CT_$READ", "x,x,x,x,x", +/* 0x30 */"CT_$WRITE", "x,x,x,x,x", +/* 0x31 */"DIR_$ADDU", "u,S,w,u,x", +/* 0x32 */"DIR_$DROPU", "x,x,x,x,x", +/* 0x33 */"DIR_$CREATE_DIRU", "x,x,x,x,x", +/* 0x34 */"DIR_$ADD_BAKU", "x,x,x,x,x", +/* 0x35 */NULL, NULL, +/* 0x36 */NULL, NULL, +/* 0x37 */NULL, NULL, +/* 0x38 */"DIR_$ADD_HARD_LINKU", "x,x,x,x,x", +/* 0x39 */NULL, NULL, +/* 0x3a */"RIP_$UPDATE", "x,x,x,x,x", +/* 0x3b */"DIR_$DROP_LINKU", "x,x,x,x,x", +/* 0x3c */"ACL_$CHECK_RIGHTS", "x,x,x,x,x", +/* 0x3d */"DIR_$DROP_HARD_LINKU", "x,x,x,x,x", +/* 0x3e */"ROUTE_$OUTGOING", "x,x,x,x,x", +/* 0x3f */NULL, NULL, +/* 0x40 */NULL, NULL, +/* 0x41 */NULL, NULL, +/* 0x42 */"NET_$GET_INFO", "x,x,x,x,x", +/* 0x43 */"DIR_$GET_ENTRYU", "x,x,x,x,x", +/* 0x44 */"AUDIT_$LOG_EVENT", "x,x,x,x,x", +/* 0x45 */"FILE_$SET_PROT", "x,x,x,x,x", +/* 0x46 */"TTY_$K_GET", "x,x,s,x,x", +/* 0x47 */"TTY_$K_PUT", "x,x,S,w,x", +/* 0x48 */"PROC2_$ALIGN_CTL", "x,x,x,x,x", +/* 0x49 */NULL, NULL, +/* 0x4a */"XPD_$READ_PROC", "x,x,x,x,x", +/* 0x4b */"XPD_$WRITE_PROC", "x,x,x,x,x", +/* 0x4c */"DIR_$SET_DEF_PROTECTION", "x,x,x,x,x", +/* 0x4d */"DIR_$GET_DEF_PROTECTION", "x,x,x,x,x", +/* 0x4e */"ACL_$COPY", "u,u,x,x,x", +/* 0x4f */"ACL_$CONVERT_FUNKY_ACL", "x,x,x,x,x", +/* 0x50 */"DIR_$SET_PROTECTION", "x,x,x,x,x", +/* 0x51 */"FILE_$OLD_AP", "x,x,x,x,x", +/* 0x52 */"ACL_$SET_RE_ALL_SIDS", "x,x,x,x,x", +/* 0x53 */"ACL_$GET_RE_ALL_SIDS", "x,x,x,x,x", +/* 0x54 */"FILE_$EXPORT_LK", "x,x,x,x,x", +/* 0x55 */"FILE_$CHANGE_LOCK_D", "x,x,x,x,x", +/* 0x56 */"XPD_$READ_PROC_ASYNC", "x,x,x,x,x", +/* 0x57 */NULL, NULL, +/* 0x58 */"SMD_$MAP_DISPLAY_MEMORY", "x,x,x,x,x", +/* 0x59 */NULL, NULL, +/* 0x5a */NULL, NULL, +/* 0x5b */NULL, NULL, +/* 0x5c */NULL, NULL, +/* 0x5d */"SCSI_$UNWIRE", "x,x,x,x,x", +/* 0x5e */"SMD_$UNMAP_DISPLAY_MEMORY", "x,x,x,x,x", +/* 0x5f */"SMD_$SET_COLOR_TABLE", "x,x,x,x,x", +/* 0x60 */"RIP_$TABLE_D", "x,x,x,x,x", +/* 0x61 */NULL, NULL, +/* 0x62 */"SMD_$DEVICE_INFO", "x,x,x,x,x", +/* 0x63 */NULL, NULL, +/* 0x64 */NULL, NULL, +/* 0x65 */"THREAD_$GET_STATE", "x,x,x,p,x", +/* 0x66 */"THREAD_$SET_STATE", "x,x,x,p,x", +/* 0x67 */"THREAD_$SET_STACK", "x,u,x,x,x", +/* 0x68 */NULL, NULL }; + +//------------------------------------------------------ +// TRAP7 +//------------------------------------------------------ + +static const char* trap7[] = { +/* 0x00 */"FILE_$LOCK", "u,x,x,x,x,x,x", +/* 0x01 */"VFMT_$WRITE", "s,x,x,x,x,x,x", +/* 0x02 */"MST_$MAP_AREA_AT", "x,x,x,x,x,x,x", +/* 0x03 */NULL, NULL, +/* 0x04 */NULL, NULL, +/* 0x05 */NULL, NULL, +/* 0x06 */NULL, NULL, +/* 0x07 */NULL, NULL, +/* 0x08 */NULL, NULL, +/* 0x09 */NULL, NULL, +/* 0x0a */NULL, NULL, +/* 0x0b */NULL, NULL, +/* 0x0c */NULL, NULL, +/* 0x0d */"VFMT_$ENCODE/VFMT_$FORMAT", "x,x,x,x,x,x,x", +/* 0x0e */"VFMT_$ENCODE/VFMT_$FORMAT", "x,x,x,x,x,x,x", +/* 0x0f */"STOP_$WATCH", "x,x,x,x,x,x,x", +/* 0x10 */NULL, NULL, +/* 0x11 */NULL, NULL, +/* 0x12 */"ASKNODE_$GET_INFO", "x,x,x,x,x,x,x", +/* 0x13 */"DISK_$DIAG_IO", "x,x,x,x,x,x,x", +/* 0x14 */NULL, NULL, +/* 0x15 */NULL, NULL, +/* 0x16 */NULL, NULL, +/* 0x17 */"CT_$DIAG", "x,x,x,x,x,x,x", +/* 0x18 */"TIME_$SET_ITIMER", "x,x,x,x,x,x,x", +/* 0x19 */"OSINFO_$GET_STATS", "x,x,x,x,x,x,x", +/* 0x1a */"DIR_$CNAMEU", "x,x,x,x,x,x,x", +/* 0x1b */"DIR_$DELETE_FILEU", "u,S,w,x,x,x,x", +/* 0x1c */"DIR_$ADD_LINKU", "x,x,x,x,x,x,x", +/* 0x1d */NULL, NULL, +/* 0x1e */NULL, NULL, +/* 0x1f */NULL, NULL, +/* 0x20 */NULL, NULL, +/* 0x21 */"ASKNODE_$WHO_REMOTE", "x,x,x,x,x,x,x", +/* 0x22 */"MST_$REMAP", "x,x,x,x,x,x,x", +/* 0x23 */"DIR_$ROOT_ADDU", "x,x,x,x,x,x,x", +/* 0x24 */NULL, NULL, +/* 0x25 */NULL, NULL, +/* 0x26 */NULL, NULL, +/* 0x27 */NULL, NULL, +/* 0x28 */"ASKNODE_$WHO_NOTOPO", "x,x,x,x,x,x,x", +/* 0x29 */"NET_$OPEN", "x,x,x,x,x,x,x", +/* 0x2a */"NET_$CLOSE", "x,x,x,x,x,x,x", +/* 0x2b */"NET_$IOCTL", "x,x,x,x,x,x,x", +/* 0x2c */"DIR_$FIND_UID", "u,u,x,S,w,x,x", +/* 0x2d */"FILE_$GET_ATTRIBUTES", "u,x,x,x,x,x,-", +/* 0x2e */NULL, NULL, +/* 0x2f */"PCHIST_$UNIX_PROFIL_CNTL", "x,x,x,x,x,x,x", +/* 0x30 */"XPD_$RESTART", "x,x,x,x,x,x,x", +/* 0x31 */"FILE_$GET_ATTR_INFO", "u,x,x,x,x,x,p", +/* 0x32 */"ACL_$PRIM_CREATE", "x,x,x,x,x,x,x", +/* 0x33 */"PROC2_$GET_REGS", "x,x,x,x,x,x,x", +/* 0x34 */"ACL_$CONVERT_TO_9ACL", "x,x,x,x,x,x,x", +/* 0x35 */"ACL_$SET_RES_ALL_SIDS", "x,x,x,x,x,x,x", +/* 0x36 */"ACL_$GET_RES_ALL_SIDS", "x,x,x,x,x,x,x", +/* 0x37 */"FILE_$LOCK_D", "u,x,x,x,x,x,p", +/* 0x38 */"FILE_$CREATE_IT", "x,x,u,x,u,x,u", +/* 0x39 */"ACL_$RIGHTS_CHECK", "x,x,x,x,x,x,x", +/* 0x3a */"RIP_$UPDATE_D", "x,x,x,x,x,x,x", +/* 0x3b */"VOLX_$SWAPON", "x,x,x,x,x,x,x", +/* 0x3c */"MST_$ADDMAP", "x,x,x,x,x,x,x", }; + +//------------------------------------------------------ +// TRAP8 +//------------------------------------------------------ + +static const char* trap8[] = { +/* 0x00 - 0x07 */"MST_$MAP", "u,x,x,x,x,x,x", +/* 0x01 - 0x08 */"MST_$MAP_AT", "x,u,x,x,x,x,x,x", +/* 0x02 - 0x07 */"MST_$MAP_GLOBAL", "u,x,x,x,x,x,x", +/* 0x03 - 0x0A */"VFMT_$WRITE", "s,x,x,x,x,x,x,x,x,x", +/* 0x04 - 0x06 */"VOLX_$DISMOUNT", "x,x,x,x,x,x", +/* 0x05 - 0x06 */"VOLX_$GET_UIDS", "x,x,x,x,x,x", +/* 0x06 - 0x07 */NULL, NULL, +/* 0x07 - 0x07 */"DISK_$PV_ASSIGN", "x,x,x,x,x,x,x", +/* 0x08 - 0x0B */"MSG_$RCV", "x,x,x,x,x,x,x,x,x,x,x", +/* 0x09 - 0x10 */"MSG_$SAR", "x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x0a - 0x0A */"MSG_$SEND", "x,x,x,x,x,x,x,x,x,x", +/* 0x0b - 0x06 */NULL, NULL, +/* 0x0c - 0x07 */"SMD_$LOAD_CRSR_BITMAP", "x,x,x,x,x,x,x", +/* 0x0d - 0x07 */"SMD_$READ_CRSR_BITMAP", "x,x,x,x,x,x,x", +/* 0x0e - 0x0D */"VFMT_$ENCODE/VFMT_$FORMAT", "s,x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x0f - 0x08 */"VFMT_$ENCODE/VFMT_$FORMAT", "s,x,x,x,x,x,x,x", +/* 0x10 - 0x0D */"VFMT_$ENCODE/VFMT_$FORMAT", "s,x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x11 - 0x08 */"VFMT_$ENCODE/VFMT_$FORMAT", "s,x,x,x,x,x,x,x", +/* 0x12 - 0x06 */"CAL_$WRITE_CALENDAR", "x,x,x,x,x,x", +/* 0x13 - 0x08 */"MSG_$RCV_CONTIG", "x,x,x,x,x,x,x,x", +/* 0x14 - 0x06 */"OSINFO_$GET_MMAP", "x,x,x,x,x,x", +/* 0x15 - 0x06 */"ASKNODE_$INTERNET_INFO", "x,x,x,x,x,x", +/* 0x16 - 0x07 */"MST_$GET_VA_INFO", "x,x,x,x,x,x,x", +/* 0x17 - 0x0D */"MSG_$SENDI", "x,x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x18 - 0x0F */"MSG_$RCVI", "x,x,x,x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x19 - 0x0C */"MSG_$RCV_CONTIGI", "x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x1a - 0x11 */"MSG_$SARI", "x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x1b - 0x06 */NULL, NULL, +/* 0x1c - 0x0E */"MSG_$SEND_HW", "x,x,x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x1d - 0x07 */"PBU_$WIRE_SPECIAL", "x,x,x,x,x,x,x", +/* 0x1e - 0x06 */"PBU_$DMA_START", "x,x,x,x,x,x", +/* 0x1f - 0x08 */NULL, NULL, +/* 0x20 - 0x07 */"MST_$MAP_TOP", "x,x,x,x,x,x,x", +/* 0x21 - 0x08 */"NET_$SEND", "x,x,x,x,x,x,x,x", +/* 0x22 - 0x08 */"NET_$RCV", "x,x,x,x,x,x,x,x", +/* 0x23 - 0x08 */"DIR_$DIR_READU", "u,S,w,x,x,x,x,x", +/* 0x24 - 0x07 */"DIR_$READ_LINKU", "x,x,x,x,x,x,x", +/* 0x25 - 0x07 */"PBU2_$DMA_START", "x,x,x,x,x,x,x", +/* 0x26 - 0x09 */NULL, NULL, +/* 0x27 - 0x09 */NULL, NULL, +/* 0x28 - 0x07 */"PROC2_$COMPLETE_VFORK", "x,x,x,x,x,x,x", +/* 0x29 - 0x07 */NULL, NULL, +/* 0x2a - 0x06 */NULL, NULL, +/* 0x2b - 0x0A */"DIR_$RESOLVE", "S,w,u,u,x,x,x,x,x,x", +/* 0x2c - 0x08 */"VOLX_$MOUNT", "x,x,x,x,x,x,x,x", +/* 0x2d - 0x06 */"ACL_$IMAGE", "x,x,x,x,x,x", +/* 0x2e - 0x09 */"DISK_$PV_ASSIGN_N", "x,x,x,x,x,x,x,x,x", +/* 0x2f - 0x07 */"DISK_$AS_XFER_MULTI", "x,x,x,x,x,x,x", +/* 0x30 - 0x07 */"PROC2_$FORK", "x,x,x,x,x,x,x", +/* 0x31 - 0x06 */"SCSI_$DO_COMMAND", "x,x,x,x,x,x", +/* 0x32 - 0x07 */"SCSI_$WAIT", "x,x,x,x,x,x,x", +/* 0x33 - 0x0A */"PROC2_$CREATE", "x,x,x,x,x,x,x,x,x,x", +/* 0x34 - 0x06 */"TPAD_$SET_UNIT_MODE", "x,x,x,x,x,x", +/* 0x35 - 0x06 */"TPAD_$INQUIRE_UNIT", "x,x,x,x,x,x", +/* 0x36 - 0x0B */"SCSI_$DO_SYS_DEVICE_CMD", "x,x,x,x,x,x,x,x,x,x,x", +/* 0x37 - 0x0D */"MSG_$RCV_HW", "x,x,x,x,x,x,x,x,x,x,x,x,x", +/* 0x38 - 0x06 */"VOLX_$VOL_INFO", "x,x,x,x,x,x", +/* 0x39 - 0x08 */"MST_$MAP_XTAL", "x,x,x,x,x,x,x,x", +/* 0x3a - 0x08 */"MST_$MAP_U", "x,u,x,x,x,x,x,x", +/* 0x3b - 0x06 */"MST_$GET_INFO_BY_VA", "x,x,x,x,x,x", +/* 0x3c - 0x06 */"VOLX_$QUOTA_CONTROL", "x,x,x,x,x,x", +/* 0x3d - 0x06 */"VOLX_$READ_QUOTA_TABLE", "x,x,x,x,x,x", +/* 0x3e - 0x06 */"THREAD_$LIST", "x,x,x,x,x,x", +/* 0x3f - 0x07 */"SCSI_$DO_COMMAND_2", "x,x,x,x,x,x,x" }; + +// get parameter string for parameter type and value at addr + +static const char *get_param(m68000_base_device *m68k, UINT32 addr, char type) +{ + UINT32 value = ~0; + + // FIXME: + static char sb[256]; + + int i; + char ch; + int maxlen = sizeof(sb) - 2; + UINT32 value1; + + sb[0] = 0; + + if (!m68k->mmu_tmp_buserror_occurred) + { + value = m68k->read32(addr); + if (!m68k->mmu_tmp_buserror_occurred && (value != ~0)) + { + switch (type) + { + case 'S': // string w/o terminating 0 + value1 = m68k->read32(addr + 4); + if (!m68k->mmu_tmp_buserror_occurred && (value1 != ~0)) + { + maxlen = m68k->read16(value1); + if (maxlen > sizeof(sb) - 2) + { + maxlen = sizeof(sb) - 2; + } + } + case 's': // string + i = 0; + sb[i++] = '"'; + while (i <= maxlen && (ch = m68k->read8(value++)) != 0 + && !m68k->mmu_tmp_buserror_occurred) + { + sb[i++] = ch < 32 ? '.' : ch; + } + sb[i++] = '"'; + sb[i] = 0; + break; + case 'b': // byte (1 byte) + sprintf(sb, "0x%x", m68k->read8(value)); + break; + case 'p': // pointer + sprintf(sb, "0x%x", value); + break; + case 'w': // word (2 byte) + sprintf(sb, "0x%x", m68k->read16(value)); + break; + case 'x': // default (hex 32 bit) + sprintf(sb, "0x%x", m68k->read32(value)); + break; + case 'u': // uid + sprintf(sb, "%08x.%08x", m68k->read32(value), + m68k->read32(value + 4)); + break; + default: + sprintf(sb, "%c", type); + break; + } + } + m68k->mmu_tmp_buserror_occurred = 0; + } + return sb; +} + +// get the svc call string + +static const char* get_svc_call(m68000_base_device *m68k, int trap_no, + int trap_code, char *sb) +{ + UINT32 sp = REG_A(m68k)[7]; + UINT32 pa; + const char * name = NULL; + const char * param = NULL; + + switch (trap_no) + { + case 0: + if (trap_no < sizeof(trap0) / 8) + { + name = trap0[trap_code * 2]; + param = trap0[trap_code * 2 + 1]; + } + break; + case 1: + if (trap_no < sizeof(trap1) / 8) + { + name = trap1[trap_code * 2]; + param = trap1[trap_code * 2 + 1]; + } + break; + case 2: + if (trap_no < sizeof(trap2) / 8) + { + name = trap2[trap_code * 2]; + param = trap2[trap_code * 2 + 1]; + } + break; + case 3: + if (trap_no < sizeof(trap3) / 8) + { + name = trap3[trap_code * 2]; + param = trap3[trap_code * 2 + 1]; + } + break; + case 4: + if (trap_no < sizeof(trap4) / 8) + { + name = trap4[trap_code * 2]; + param = trap4[trap_code * 2 + 1]; + } + break; + case 5: + if (trap_no < sizeof(trap5) / 8) + { + name = trap5[trap_code * 2]; + param = trap5[trap_code * 2 + 1]; + } + break; + case 7: + if (trap_no < sizeof(trap7) / 8) + { + name = trap7[trap_code * 2]; + param = trap7[trap_code * 2 + 1]; + } + break; + case 8: + if (trap_no < sizeof(trap8) / 8) + { + name = trap8[trap_code * 2]; + param = trap8[trap_code * 2 + 1]; + } + break; + } + + sb[0] = '\0'; + + if (name == NULL) + { + strcat(sb, "???"); + } + else + { + strcat(sb, name); + if (param != NULL) + { + int i; + strcat(sb, "("); + for (i = 0, pa = sp + 4; param[i] != '\0'; i++) + { + switch (param[i]) + { + case ',': + strcat(sb, ", "); + pa += 4; + break; + default: + strcat(sb, get_param(m68k, pa, param[i])); + break; + } + } + strcat(sb, ")"); + } + } + return sb; +} + +static const char * disassemble(m68000_base_device *m68k, offs_t pc, char* sb) +{ + UINT8 oprom[10]; + UINT8 opram[10]; + UINT32 options = 0; + + // remember bus error state + UINT32 tmp_buserror_occurred = m68k->mmu_tmp_buserror_occurred; + UINT32 tmp_buserror_address = m68k->mmu_tmp_buserror_address; + + m68k->mmu_tmp_buserror_occurred = 0; + m68k->mmu_tmp_rw = 1; + + int i; + for (i = 0; i < sizeof(oprom); i++) + { + oprom[i] = opram[i] = m68k->read8(pc + i); + if (m68k->mmu_tmp_buserror_occurred) + { + sprintf(sb, "- (apollo_disassemble failed at %08x)", pc + i); + + // restore previous bus error state + m68k->mmu_tmp_buserror_occurred = tmp_buserror_occurred; + m68k->mmu_tmp_buserror_address = tmp_buserror_address; + + return sb; + } + } + m68k->disassemble(sb, pc, oprom, opram, options); + + // restore previous bus error state + m68k->mmu_tmp_buserror_occurred = tmp_buserror_occurred; + m68k->mmu_tmp_buserror_address = tmp_buserror_address; + + return sb; +} + +static const UINT16 *get_data(m68000_base_device *m68k, offs_t addr) +{ + static UINT16 data[4]; + + // remember bus error state + UINT32 tmp_buserror_occurred = m68k->mmu_tmp_buserror_occurred; + UINT32 tmp_buserror_address = m68k->mmu_tmp_buserror_address; + + m68k->mmu_tmp_buserror_occurred = 0; + m68k->mmu_tmp_rw = 1; + + int i; + for (i = 0; i < sizeof(data); i += 2) + { + data[i/2] = m68k->read16(addr + i); + } + + // restore previous bus error state + m68k->mmu_tmp_buserror_occurred = tmp_buserror_occurred; + m68k->mmu_tmp_buserror_address = tmp_buserror_address; + + return data; +} + +//------------------------------------------------- +// instruction_hook - should be called by the CPU core +// before executing each instruction +//------------------------------------------------- + +int apollo_debug_instruction_hook(m68000_base_device *device, offs_t curpc) +{ + // trap data remembered for next rte + static struct { + UINT32 pc; + UINT32 sp; + UINT16 trap_no; + UINT16 trap_code; + } trap = { 0, 0, 0, 0 }; + + if (apollo_config( APOLLO_CONF_TRAP_TRACE | APOLLO_CONF_FPU_TRACE)) + { + UINT32 ppc_save; + UINT16 ir; + m68000_base_device *m68k = device; + m68k->mmu_tmp_buserror_occurred = 0; + + /* Read next instruction */ + ir = (m68k->pref_addr == REG_PC(m68k)) ? m68k->pref_data : m68k->readimm16(REG_PC(m68k)); + + // apollo_cpu_context expects the PC of current opcode in REG_PPC (not the previous PC) + ppc_save = REG_PPC(m68k); + REG_PPC(m68k) = REG_PC(m68k); + + if (m68k->mmu_tmp_buserror_occurred) + { + m68k->mmu_tmp_buserror_occurred = 0; + // give up + } + else if ((ir & 0xff00) == 0xf200 && (apollo_config( APOLLO_CONF_FPU_TRACE))) + { + char sb[256]; + LOG(("%s sp=%08x FPU: %x %s", apollo_cpu_context(device->machine().firstcpu), + REG_A(m68k)[7], ir, disassemble(m68k, REG_PC(m68k), sb))); + } + else if (!m68k->pmmu_enabled) + { + // skip + } + else if (ir == 0x4e73) // RTE + { + const UINT16 *data = get_data(m68k, REG_A(m68k)[7]); + if ( REG_USP(m68k) == 0 && (data[0] & 0x2000) == 0) { + LOG(("%s sp=%08x RTE: sr=%04x pc=%04x%04x v=%04x usp=%08x", + apollo_cpu_context(device->machine().firstcpu), + REG_A(m68k)[7], data[0], data[1], data[2], data[3], REG_USP(m68k))); + } + } + else if ((ir & 0xfff0) == 0x4e40 && (ir & 0x0f) <= 8 && apollo_config(APOLLO_CONF_TRAP_TRACE)) + { + // trap n + trap.pc = REG_PC(m68k); + trap.sp = REG_A(m68k)[7]; + trap.trap_no = ir & 0x0f; + trap.trap_code = REG_D(m68k)[0] & 0xffff; + + char sb[1000]; + LOG(("%s sp=%08x Domain/OS SVC: trap %x 0x%02x: %s", + apollo_cpu_context(device->machine().firstcpu), trap.sp, + trap.trap_no, trap.trap_code, + get_svc_call(m68k, trap.trap_no, trap.trap_code, sb))); + + } + else if (trap.pc == REG_PC(m68k) - 2 && trap.sp == REG_A(m68k)[7]) + { + // rte + char sb[1000]; + LOG(("%s sp=%08x Domain/OS SVC: %s D0=0x%x", + apollo_cpu_context(device->machine().firstcpu), trap.sp, + get_svc_call(m68k, trap.trap_no, trap.trap_code, sb), REG_D(m68k)[0])); + + trap.pc = 0; + trap.sp = 0; + trap.trap_no = 0; + trap.trap_code = 0; + } + // restore previous PC + REG_PPC(m68k) = ppc_save; + } + return 0; +} diff --git a/src/mame/machine/apollo_kbd.c b/src/mame/machine/apollo_kbd.c new file mode 100644 index 00000000000..79fc99c1ad3 --- /dev/null +++ b/src/mame/machine/apollo_kbd.c @@ -0,0 +1,986 @@ +// license:BSD-3-Clause +// copyright-holders:Hans Ostermeyer +/* + * apollo_kbd.c - Apollo keyboard and mouse emulation + * + * Created on: Dec 27, 2010 + * Author: Hans Ostermeyer + * + * see also http://www.bitsavers.org/pdf/apollo/008778-03_DOMAIN_Series_3000_4000_Technical_Reference_Aug87.pdf + * + */ + +#define VERBOSE 0 + +#include "machine/apollo_kbd.h" +#include "sound/beep.h" + +#define LOG(x) { logerror ("%s apollo_kbd: ", m_device->cpu_context()); logerror x; logerror ("\n"); } +#define LOG1(x) { if (VERBOSE > 0) LOG(x)} +#define LOG2(x) { if (VERBOSE > 1) LOG(x)} + +#define MAP_APOLLO_KEYS 1 + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +//const device_type APOLLO_KBD = apollo_kbd_device_config::static_alloc_device_config; + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define KBD_MODE_0_COMPATIBILITY 0 +#define KBD_MODE_1_KEYSTATE 1 +#define KBD_MODE_2_RELATIVE_CURSOR_CONTROL 2 +#define KBD_MODE_3_ABSOLUTE_CURSOR_CONTROL 3 + +#define CODE_TABLE_DOWN_CODE 0 +#define CODE_TABLE_UP_CODE 1 +#define CODE_TABLE_UNSHIFTED_CODE 2 +#define CODE_TABLE_SHIFTED_CODE 3 +#define CODE_TABLE_CONTROL_CODE 4 +#define CODE_TABLE_CAPS_LOCK_CODE 5 +#define CODE_TABLE_UP_TRANS_CODE 6 +#define CODE_TABLE_AUTO_REPEAT_CODE 7 +#define CODE_TABLE_ENTRY_SIZE 8 + +#define NOP 0 +#define No 0 +#define Yes 1 + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +// device type definition +const device_type APOLLO_KBD = &device_creator; + +//------------------------------------------------- +// apollo_kbd_device - constructor +//------------------------------------------------- + +apollo_kbd_device::apollo_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, APOLLO_KBD, "Apollo Keyboard", tag, owner, clock, "apollo_kbd", __FILE__), + device_serial_interface(mconfig, *this), + m_tx_w(*this), + m_german_r(*this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apollo_kbd_device::device_start() +{ + m_device = this; + LOG1(("start apollo_kbd")); + + m_tx_w.resolve_safe(); + m_german_r.resolve_safe(0); + + m_beeper.start(this); + m_mouse.start(this); + + m_io_keyboard1 = machine().root_device().ioport("keyboard1"); + m_io_keyboard2 = machine().root_device().ioport("keyboard2"); + m_io_keyboard3 = machine().root_device().ioport("keyboard3"); + m_io_keyboard4 = machine().root_device().ioport("keyboard4"); + m_io_mouse1 = machine().root_device().ioport("mouse1"); + m_io_mouse2 = machine().root_device().ioport("mouse2"); + m_io_mouse3 = machine().root_device().ioport("mouse3"); + + m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_kbd_device::kbd_scan_timer), this)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apollo_kbd_device::device_reset() +{ + LOG1(("reset apollo_kbd")); + + m_beeper.reset(); + m_mouse.reset(); + + // init keyboard + m_loopback_mode = 1; + m_mode = KBD_MODE_0_COMPATIBILITY; + m_delay = 500; + m_repeat = 33; + m_last_pressed = 0; + memset(m_keytime, 0, sizeof(m_keytime)); + memset(m_keyon, 0, sizeof(m_keyon)); + + // start timer + m_timer->adjust( attotime::zero, 0, attotime::from_msec(5)); // every 5ms + + // keyboard comms is at 8E1, 1200 baud + set_data_frame(1, 8, PARITY_EVEN, STOP_BITS_1); + set_rcv_rate(1200); + set_tra_rate(1200); + + m_tx_busy = false; + m_xmit_read = m_xmit_write = 0; +} + +void apollo_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + device_serial_interface::device_timer(timer, id, param, ptr); +} + +/*************************************************************************** + cpu_context - return a string describing the current CPU context + ***************************************************************************/ + +const char *apollo_kbd_device::cpu_context() +{ + static char statebuf[64]; /* string buffer containing state description */ + + device_t *cpu = machine().firstcpu; + osd_ticks_t t = osd_ticks(); + int s = t / osd_ticks_per_second(); + int ms = (t % osd_ticks_per_second()) / 1000; + + /* if we have an executing CPU, output data */ + if (cpu != NULL) + { + sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(), + cpu->safe_pcbase(), tag()); + } + else + { + sprintf(statebuf, "%d.%03d", s, ms); + } + return statebuf; +} + +//************************************************************************** +// Beeper +//************************************************************************** + +apollo_kbd_device::beeper::beeper() : + m_device(NULL), + m_beeper(NULL), + m_timer(NULL) +{ +} + +void apollo_kbd_device::beeper::start(apollo_kbd_device *device) +{ + m_device = device; + LOG2(("start apollo_kbd::beeper")); + m_beeper = m_device->machine().device("beep"); + m_timer = m_device->machine().scheduler().timer_alloc(FUNC(static_beeper_callback), this); +} + +void apollo_kbd_device::beeper::reset() +{ + LOG2(("reset apollo_kbd::beeper")); + on(); +} + +void apollo_kbd_device::beeper::off() +{ + m_beeper->set_state(0); +} + +void apollo_kbd_device::beeper::on() +{ + if (keyboard_has_beeper()) + { + m_beeper->set_frequency(1000); + m_beeper->set_state(1); + m_timer->adjust( attotime::from_msec(10), 0, attotime::zero); + } +} + +int apollo_kbd_device::beeper::keyboard_has_beeper() +{ + return true; // driver has no facility to return false here, so go with it +} + +void apollo_kbd_device::beeper::beeper_callback() +{ + off(); +} + +TIMER_CALLBACK( apollo_kbd_device::beeper::static_beeper_callback ) +{ + reinterpret_cast(ptr)->beeper_callback(); +} + +//************************************************************************** +// Mouse +//************************************************************************** + +apollo_kbd_device::mouse::mouse() : + m_device(NULL) +{ +} + +void apollo_kbd_device::mouse::start(apollo_kbd_device *device) +{ + m_device = device; + LOG2(("start apollo_kbd::mouse")); +} + +void apollo_kbd_device::mouse::reset() +{ + LOG2(("reset apollo_kbd::mouse")); + + m_last_b = -1; + m_last_x = 0; + m_last_y = 0; + m_tx_pending = 0; +} + +void apollo_kbd_device::mouse::read_mouse() +{ + if (m_tx_pending > 0) + { + m_tx_pending -= 5; // we will be called every 5ms + } + else + { + int b = m_device->m_io_mouse1->read(); + int x = m_device->m_io_mouse2->read(); + int y = m_device->m_io_mouse3->read(); + + /* sign extend values < 0 */ + if (x & 0x80) + x |= 0xffffff00; + if (y & 0x80) + y |= 0xffffff00; + y = -y; + + if (m_last_b < 0) + { + m_last_b = b; + m_last_x = x; + m_last_y = y; + } + else if (b != m_last_b || x != m_last_x || y != m_last_y) + { + UINT8 mouse_data[4]; + int mouse_data_size; + + int dx = x - m_last_x; + int dy = y - m_last_y; + + LOG2(("read_mouse: b=%02x x=%d y=%d dx=%d dy=%d", b, x, y, dx, dy)); + + if (m_device->m_mode == KBD_MODE_0_COMPATIBILITY) + { + mouse_data[0] = 0xdf; + mouse_data[1] = 0xf0 ^ b; + mouse_data[2] = dx; + mouse_data[3] = dy; + mouse_data_size = 4; + } + else + { + if (m_device->m_mode != KBD_MODE_2_RELATIVE_CURSOR_CONTROL) + { + m_device->set_mode(KBD_MODE_2_RELATIVE_CURSOR_CONTROL); + } + + mouse_data[0] = 0xf0 ^ b; + mouse_data[1] = dx; + mouse_data[2] = dy; + mouse_data_size = 3; + } + + for (int md = 0; md < mouse_data_size; md++) + { + m_device->xmit_char(mouse_data[md]); + } + + // mouse data submitted; update current mouse state + m_last_b = b; + m_last_x += dx; + m_last_y += dy; + m_tx_pending = 100; // mouse data packet will take 40 ms + } + } +} + +/*------------------------------------------------- + keyboard_is_german - check for german keyboard + -------------------------------------------------*/ + +int apollo_kbd_device::keyboard_is_german() +{ + return (m_german_r() == ASSERT_LINE) ? true : false; +} + +void apollo_kbd_device::set_mode(UINT16 mode) +{ + xmit_char(0xff); + xmit_char(mode); + m_mode = mode; +} + +void apollo_kbd_device::tra_complete() // Tx completed sending byte +{ + // is there more waiting to send? + if (m_xmit_read != m_xmit_write) + { + transmit_register_setup(m_xmitring[m_xmit_read++]); + if (m_xmit_read >= XMIT_RING_SIZE) + { + m_xmit_read = 0; + } + } + else + { + m_tx_busy = false; + } +} + +void apollo_kbd_device::rcv_complete() // Rx completed receiving byte +{ + receive_register_extract(); + UINT8 data = get_received_char(); + + kgetchar(data); +} + +void apollo_kbd_device::tra_callback() // Tx send bit +{ + int bit = transmit_register_get_data_bit(); + m_tx_w(bit); +} + +void apollo_kbd_device::input_callback(UINT8 state) +{ +} + +void apollo_kbd_device::xmit_char(UINT8 data) +{ + // if tx is busy it'll pick this up automatically when it completes + if (!m_tx_busy) + { + m_tx_busy = true; + transmit_register_setup(data); + } + else + { + // tx is busy, it'll pick this up next time + m_xmitring[m_xmit_write++] = data; + if (m_xmit_write >= XMIT_RING_SIZE) + { + m_xmit_write = 0; + } + } +} + +/*------------------------------------------------- + putdata - put keyboard data to sio + -------------------------------------------------*/ + +void apollo_kbd_device::putdata(const UINT8 *data, int data_length) +{ + // send data only if no real Apollo keyboard has been connected + if (m_mode > KBD_MODE_1_KEYSTATE) + { + set_mode(KBD_MODE_1_KEYSTATE); + } + + for (int i = 0; i < data_length; i++) + { + xmit_char(data[i]); + } +} + +/*------------------------------------------------- + putstring - put keyboard string to sio + -------------------------------------------------*/ + +void apollo_kbd_device::putstring(const char *data) +{ + putdata((UINT8 *) data, strlen(data)); +} + +void apollo_kbd_device::kgetchar(UINT8 data) +{ + static const UINT8 ff1116_data[] = { 0x00, 0xff, 0x00 }; + + LOG1(("getchar <- %02x", data)); + + if (data == 0xff) + { + m_rx_message = data; + putdata(&data, 1); + m_loopback_mode = 1; + } + else if (data == 0x00) + { + if (m_loopback_mode) + { + set_mode(KBD_MODE_0_COMPATIBILITY); + m_loopback_mode = 0; + } + } + else + { + m_rx_message = m_rx_message << 8 | data; + + switch (m_rx_message) + { + case 0xff00: + putdata(&data, 1); + m_mode = KBD_MODE_0_COMPATIBILITY; + m_loopback_mode = 0; + m_rx_message = 0; + case 0xff01: + putdata(&data, 1); + m_mode = KBD_MODE_1_KEYSTATE; + m_rx_message = 0; + break; + case 0xff11: + putdata(&data, 1); + break; + case 0xff1116: + putdata(ff1116_data, sizeof(ff1116_data)); + m_loopback_mode = 0; + m_rx_message = 0; + break; + case 0xff1117: + m_rx_message = 0; + break; + case 0xff12: + putdata(&data, 1); + break; + case 0xff1221: // receive ID message + m_loopback_mode = 0; + putdata(&data, 1); + if (keyboard_is_german()) + { + putstring("3-A\r2-0\rSD-03863-MS\r"); + } + else + { + putstring("3-@\r2-0\rSD-03863-MS\r"); + } + + if (m_mode == KBD_MODE_0_COMPATIBILITY) + { + set_mode(KBD_MODE_0_COMPATIBILITY); + } + else + { + set_mode(KBD_MODE_1_KEYSTATE); + } + m_rx_message = 0; + break; + case 0xff2181: // beeper on (for 300 ms) + putdata(&data, 1); + m_rx_message = 0; + m_beeper.on(); + break; + case 0xff2182: // beeper off + putdata(&data, 1); + m_rx_message = 0; + m_beeper.off(); + break; + default: + if (m_loopback_mode && data != 0) + { + putdata(&data, 1); + } + break; + } + } +} + +int apollo_kbd_device::push_scancode(UINT8 code, UINT8 repeat) +{ + int n_chars = 0; + UINT16 key_code = 0; + UINT8 caps = BIT(machine().root_device().ioport("keyboard4")->read(),0); + UINT8 shift = BIT(machine().root_device().ioport("keyboard4")->read(),1) | BIT(machine().root_device().ioport("keyboard4")->read(),5); + UINT8 ctrl = BIT(machine().root_device().ioport("keyboard4")->read(),2); + UINT8 numlock = BIT(machine().root_device().ioport("keyboard4")->read(),6); + UINT16 index; + + if (keyboard_is_german()) + { + // map special keys for German keyboard + switch (code) + { + case 0x00: code = 0x68; break; // _ + case 0x0e: code = 0x6b; break; // # + case 0x29: code = 0x69; break; // <> + case 0x42: code = 0x6f; break; // NP- + case 0x46: code = 0x6e; break; // NP+ + case 0x4e: code = 0x73; break; // NP ENTER + } + } + +#if MAP_APOLLO_KEYS + if (numlock) + { + // don't map function keys to Apollo left keypad + switch (code) + { + case 0x52: code = 0x75; break; // F1 + case 0x53: code = 0x76; break; // F2 + case 0x54: code = 0x77; break; // F3 + case 0x55: code = 0x78; break; // F4 + case 0x56: code = 0x79; break; // F5 + case 0x57: code = 0x7a; break; // F6 + case 0x58: code = 0x7b; break; // F7 + case 0x59: code = 0x7c; break; // F8 + case 0x5a: code = 0x7d; break; // F9 + case 0x5b: code = 0x74; break; // F0 = F10 + } + } +#endif + + index = (code & 0x7f) * CODE_TABLE_ENTRY_SIZE; + if (m_mode == KBD_MODE_0_COMPATIBILITY) + { + if (code & 0x80) + { + // skip up code in ASCII mode + } + else if (repeat > 0 + && m_code_table[index + CODE_TABLE_AUTO_REPEAT_CODE] != Yes) + { + // skip repeat in ASCII mode + } + else if (ctrl) + { + key_code = m_code_table[index + CODE_TABLE_CONTROL_CODE]; + } + else if (shift) + { + key_code = m_code_table[index + CODE_TABLE_SHIFTED_CODE]; + } + else if (caps) + { + key_code = m_code_table[index + CODE_TABLE_CAPS_LOCK_CODE]; + } + else + { + key_code = m_code_table[index + CODE_TABLE_UNSHIFTED_CODE]; + } + } + else + { + if (repeat > 0) + { + if (repeat == 1) + { + // auto repeat (but only for first scanned key) + key_code = 0x7f; + } + } + else if (code & 0x80) + { + key_code = m_code_table[index + CODE_TABLE_UP_CODE]; + } + else + { + key_code = m_code_table[index + CODE_TABLE_DOWN_CODE]; + } + } + + if (key_code != 0) + { + LOG2(("scan_code = 0x%02x key_code = 0x%04x",code, key_code)); + if (m_mode > KBD_MODE_1_KEYSTATE) + { + set_mode(KBD_MODE_1_KEYSTATE); + } + + if (key_code & 0xff00) + { + xmit_char(key_code >> 8); + n_chars++; + } + xmit_char(key_code & 0xff); + n_chars++; + } + return n_chars; +} + +void apollo_kbd_device::scan_keyboard() +{ + int x; + int repeat = 0; + + static const char * const keynames[] = { "keyboard1", "keyboard2", "keyboard3", "keyboard4" }; + + for (x = 0; x < 0x80; x++) + { + if (!(machine().root_device().ioport(keynames[x / 32])->read() & (1 << (x % 32)))) + { + // no key pressed + if (m_keyon[x] != 0) + { + // a key has been released + push_scancode(0x80 + x, 0); + m_keytime[x] = 0; + m_keyon[x] = 0; + m_last_pressed = 0; + LOG2(("released key 0x%02x at time %d",x, m_keytime[x])); + } + } + else if (m_keyon[x] == 0) + { + // a key has been pressed + if (push_scancode(x, 0) > 0) + { + m_keytime[x] = m_mode == KBD_MODE_0_COMPATIBILITY ? m_delay : m_repeat; + m_keyon[x] = 1; + m_last_pressed = x; + LOG2(("pushed key 0x%02x at time %d",x, m_keytime[x])); + } + } + else if (m_last_pressed == x) + { + // a key is being held; adjust delay/repeat timers + m_keytime[x] -= 5; + if (m_keytime[x] <= 0) + { + push_scancode(x, ++repeat); + m_keytime[x] = m_repeat; + } + LOG2(("holding key 0x%02x at time %d",x, m_keytime[x])); + } + } +} + +TIMER_CALLBACK_MEMBER(apollo_kbd_device::kbd_scan_timer) +{ + scan_keyboard(); + + // Note: we omit extra traffic while keyboard is in Compatibility mode + if (m_device->m_mode != KBD_MODE_0_COMPATIBILITY) + { + m_mouse.read_mouse(); + } +} + +UINT16 apollo_kbd_device::m_code_table[] = { + /* Key | Keycap | Down | Up |Unshifted|Shifted|Control|Caps Lock|Up Trans|Auto */ + /* Number| Legend | Code | Code|Code | Code | Code |Code | Code |Repeat*/ + + /* B14 ~ ' / ESC */ 0x24, 0xA4, 0x60, 0x7E, 0x1E, 0x60, NOP, No, + /* B1 ESC */ 0x17, 0x97, 0x1B, 0x1B, NOP, 0x1B, NOP, No, + /* B2 ! 1 */ 0x18, 0x98, 0x31, 0x21, NOP, 0x31, NOP, No, + /* B3 @ 2 */ 0x19, 0x99, 0x32, 0x40, NOP, 0x32, NOP, No, + /* B4 # 3 */ 0x1A, 0x9A, 0x33, 0x23, NOP, 0x33, NOP, No, + /* B5 $ 4 */ 0x1B, 0x9B, 0x34, 0x24, NOP, 0x34, NOP, No, + /* B6 % 5 */ 0x1C, 0x9C, 0x35, 0x25, NOP, 0x35, NOP, No, + /* B7 ^ 6 */ 0x1D, 0x9D, 0x36, 0x5E, NOP, 0x36, NOP, No, + /* B8 & 7 */ 0x1E, 0x9E, 0x37, 0x26, NOP, 0x37, NOP, No, + /* B9 * 8 */ 0x1F, 0x9F, 0x38, 0x2A, NOP, 0x38, NOP, No, + /* B10 ( 9 */ 0x20, 0xA0, 0x39, 0x28, NOP, 0x39, NOP, No, + /* B11 ) 0 */ 0x21, 0xA1, 0x30, 0x29, NOP, 0x30, NOP, No, + /* B12 _ - */ 0x22, 0xA2, 0x2D, 0x5F, NOP, 0x2D, NOP, Yes, + /* B13 + = */ 0x23, 0xA3, 0x3D, 0x2B, NOP, 0x3D, NOP, Yes, + /* B14 ~ ' / BS */ 0x24, 0xA4, 0x60, 0x7E, 0x1E, 0x60, NOP, No, + /* B15 BACKSPACE */ 0x25, 0xA5, 0xDE, 0xDE, NOP, 0xDE, NOP, Yes, + + /* C1 TAB */ 0x2C, 0xAC, 0xCA, 0xDA, 0xFA, 0xCA, NOP, No, + /* C2 Q */ 0x2D, 0xAD, 0x71, 0x51, 0x11, 0x51, NOP, No, + /* C3 W */ 0x2E, 0xAE, 0x77, 0x57, 0x17, 0x57, NOP, No, + /* C4 E */ 0x2F, 0xAF, 0x65, 0x45, 0x05, 0x45, NOP, No, + /* C5 R */ 0x30, 0xB0, 0x72, 0x52, 0x12, 0x52, NOP, No, + /* C6 T */ 0x31, 0xB1, 0x74, 0x54, 0x14, 0x54, NOP, No, + /* C7 V */ 0x32, 0xB2, 0x79, 0x59, 0x19, 0x59, NOP, No, + /* C8 U */ 0x33, 0xB3, 0x75, 0x55, 0x15, 0x55, NOP, No, + /* C9 I */ 0x34, 0xB4, 0x69, 0x49, 0x09, 0x49, NOP, No, + /* C10 O */ 0x35, 0xB5, 0x6F, 0x4F, 0x0F, 0x4F, NOP, No, + /* C11 P */ 0x36, 0xB6, 0x70, 0x50, 0x10, 0x50, NOP, No, + /* C12 { [ / Ue */ 0x37, 0xB7, 0x7B, 0x5B, 0x1B, 0x7B, NOP, No, + /* C13 } ] / Oe */ 0x38, 0xB8, 0x7D, 0x5D, 0x1D, 0x7D, NOP, No, + /* D13 RETURN */ 0x52, 0xD2, 0xCB, 0xDB, NOP, 0xCB, NOP, No, + + /* D2 A */ 0x46, 0xC6, 0x61, 0x41, 0x01, 0x41, NOP, No, + /* D3 S */ 0x47, 0xC7, 0x73, 0x53, 0x13, 0x53, NOP, No, + /* D4 D */ 0x48, 0xC8, 0x64, 0x44, 0x04, 0x44, NOP, No, + /* D5 F */ 0x49, 0xC9, 0x66, 0x46, 0x06, 0x46, NOP, No, + /* D6 G */ 0x4A, 0xCA, 0x67, 0x47, 0x07, 0x47, NOP, No, + /* D7 H */ 0x4B, 0xCB, 0x68, 0x48, 0x08, 0x48, NOP, No, + /* D8 J */ 0x4C, 0xCC, 0x6A, 0x4A, 0x0A, 0x4A, NOP, No, + /* D9 K */ 0x4D, 0xCD, 0x6B, 0x4B, 0x0B, 0x4B, NOP, No, + /* D10 L */ 0x4E, 0xCE, 0x6C, 0x4C, 0x0C, 0x4C, NOP, No, + /* D11 : ; */ 0x4F, 0xCF, 0x3B, 0x3A, 0xFB, 0x3B, NOP, No, + /* D12 " ' / Ae */ 0x50, 0xD0, 0x27, 0x22, 0xF8, 0x27, NOP, No, + /* D14 ! \ */ 0x53, 0xD3, 0xC8, 0xC9, NOP, 0xC8, NOP, No, + + /* E2 Z */ 0x60, 0xE0, 0x7A, 0x5A, 0x1A, 0x5A, NOP, No, + /* E3 X */ 0x61, 0xE1, 0x78, 0x58, 0x18, 0x58, NOP, No, + /* E4 C */ 0x62, 0xE2, 0x63, 0x43, 0x03, 0x43, NOP, No, + /* E5 V */ 0x63, 0xE3, 0x76, 0x56, 0x16, 0x56, NOP, No, + /* E6 8 */ 0x64, 0xE4, 0x62, 0x42, 0x02, 0x42, NOP, No, + /* E7 N */ 0x65, 0xE5, 0x6E, 0x4E, 0x0E, 0x4E, NOP, No, + /* E8 M */ 0x66, 0xE6, 0x6D, 0x4D, 0x0D, 0x4D, NOP, No, + /* E9 < , */ 0x67, 0xE7, 0x2C, 0x3C, NOP, 0x2C, NOP, No, + /* E10 > . */ 0x68, 0xE8, 0x2E, 0x3E, NOP, 0x2E, NOP, Yes, + /* E11 ? / */ 0x69, 0xE9, 0xCC, 0xDC, 0xFC, 0xCC, NOP, No, + +// /* B14 ~ ' */ 0x24, 0xA4, 0x60, 0x7E, 0x1E, 0x60, NOP, No, + /* _ */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, + /* F1 (space bar) */ 0x76, 0xF6, 0x20, 0x20, 0x20, 0x20, NOP, Yes, + /* LC0 Home */ 0x27, 0xA7, 0x84, 0x94, 0x84, 0x84, 0xA4, No, +#if !MAP_APOLLO_KEYS + /* C14 DELETE */ 0x3A, 0xBA, 0x7F, 0x7F, NOP, 0x7F, NOP, Yes, +#else + /* E13 POP */ 0x6C, 0xEC, 0x80, 0x90, 0x80, 0x80, 0xA0, No, +#endif + /* LF0 Roll Up */ 0x72, 0xF2, 0x8D, 0x9D, 0x8D, 0x8D, 0xAD, No, + /* LF2 Roll Down */ 0x74, 0xF4, 0x8F, 0x9F, 0x8F, 0x8F, 0xAF, No, + /* LC2 End */ 0x29, 0xA9, 0x86, 0x96, 0x86, 0x86, 0xA6, No, + /* LE0 Cursor left */ 0x59, 0xD9, 0x8A, 0x9A, 0x9A, 0x9A, 0xAA, Yes, + /* LD1 Cursor Up */ 0x41, 0xC1, 0x88, 0x98, 0x88, 0x88, 0xA8, Yes, + /* LE2 Cursor right*/ 0x5B, 0xDB, 0x8C, 0x9C, 0x8C, 0xBE, 0xAC, Yes, + /* LF1 Cursor down */ 0x73, 0xF3, 0x8E, 0x9E, 0x8E, 0x8E, 0xAE, Yes, + +#if !MAP_APOLLO_KEYS + /* Numpad CLR */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, + /* Numpad / */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, + /* Numpad * */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, + /* RD4 - */ 0x58, 0xD8, 0xFE2D, 0xFE5F, NOP, 0xFE2D, NOP, No, + /* RC1 7 */ 0x3C, 0xBC, 0xFE37, 0xFE26, NOP, 0xFE37, NOP, No, + /* RC2 8 */ 0x3D, 0xBD, 0xFE38, 0xFE2A, NOP, 0xFE38, NOP, No, + /* RC3 9 */ 0x3E, 0xBE, 0xFE39, 0xFE28, NOP, 0xFE39, NOP, No, + /* RC4 + */ 0x3F, 0xBF, 0xFE2B, 0xFE3D, NOP, 0xFE2B, NOP, No, + /* RD1 4 */ 0x55, 0xD5, 0xFE34, 0xFE24, NOP, 0xFE34, NOP, No, + /* RD2 5 */ 0x56, 0xD6, 0xFE35, 0xFE25, NOP, 0xFE35, NOP, No, + /* RD3 6 */ 0x57, 0xD7, 0xFE36, 0xFE5E, NOP, 0xFE36, NOP, No, + /* Numpad = */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, + /* RE1 1 */ 0x6E, 0xEE, 0xFE31, 0xFE21, NOP, 0xFE31, NOP, No, + /* RE2 2 */ 0x6F, 0xEF, 0xFE32, 0xFE40, NOP, 0xFE32, NOP, No, + /* RE3 3 */ 0x70, 0xF0, 0xFE33, 0xFE23, NOP, 0xFE33, NOP, No, + /* RF3 ENTER */ 0x7C, 0xFC, 0xFECB, 0xFEDB, NOP, 0xFECB, NOP, No, + /* RF1 0 */ 0x79, 0xF9, 0xFE30, 0xFE29, NOP, 0xFE30, NOP, No, + /* Numpad , */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, + /* RF2 . */ 0x7B, 0xFB, 0xFE2E, 0xFE2E, NOP, 0xFE2E, NOP, No, + /* A0 F0 */ 0x04, 0x84, 0x1C, 0x5C, 0x7C, 0x1C, 0xBC, No, + /* A1 F1 */ 0x05, 0x85, 0xC0, 0xD0, 0xF0, 0xC0, 0xE0, No, + /* A2 F2 */ 0x06, 0x86, 0xC1, 0x01, 0xF1, 0xC1, 0xE1, No, + /* A3 F3 */ 0x07, 0x87, 0xC2, 0x02, 0xF2, 0xC2, 0xE2, No, + /* A4 F4 */ 0x08, 0x88, 0xC3, 0x03, 0xF3, 0xC3, 0xE3, No, + /* A5 F5 */ 0x09, 0x89, 0xC4, 0x04, 0xF4, 0xC4, 0xE4, No, + /* A6 F6 */ 0x0A, 0x8A, 0xC5, 0x05, 0xF5, 0xC5, 0xE5, No, + /* A7 F7 */ 0x0B, 0x8B, 0xC6, 0x06, 0xF6, 0xC6, 0xE6, No, + /* A8 F8 */ 0x0C, 0x8C, 0xC7, 0x07, 0xF7, 0xC7, 0xE7, No, + /* A9 F9 */ 0x0D, 0x8D, 0x1F, 0x2F, 0x3F, 0x1F, 0xBD, No, +#else + /* E13 POP */ 0x6C, 0xEC, 0x80, 0x90, 0x80, 0x80, 0xA0, No, + /* LDO [<-] */ 0x40, 0xC0, 0x87, 0x97, 0x87, 0x87, 0xA7, No, + /* LD2 [->] */ 0x42, 0xC2, 0x89, 0x99, 0x89, 0x89, 0xA9, No, + /* RD4 Numpad - */ 0x58, 0xD8, 0xFE2D, 0xFE5F, NOP, 0xFE2D, NOP, No, + /* LC0 7 Home */ 0x27, 0xA7, 0x84, 0x94, 0x84, 0x84, 0xA4, No, + /* LD1 8 Cursor Up */ 0x41, 0xC1, 0x88, 0x98, 0x88, 0x88, 0xA8, Yes, + /* LF0 9 Roll Up */ 0x72, 0xF2, 0x8D, 0x9D, 0x8D, 0x8D, 0xAD, No, + /* RC4 Numpad + */ 0x3F, 0xBF, 0xFE2B, 0xFE3D, NOP, 0xFE2B, NOP, No, + /* LE0 4 Cursor left */ 0x59, 0xD9, 0x8A, 0x9A, 0x9A, 0x9A, 0xAA, Yes, + /* LE1 NEXT WINDOW */ 0x5A, 0xDA, 0x8B, 0x9B, 0x8B, 0x8B, 0xAB, No, + /* LE2 6 Cursor right*/ 0x5B, 0xDB, 0x8C, 0x9C, 0x8C, 0xBE, 0xAC, Yes, + /* Numpad = */ 0x7C, 0xFC, 0xFEC8, 0xFED8, NOP, 0xFECB, NOP, No, + /* LC2 1 End */ 0x29, 0xA9, 0x86, 0x96, 0x86, 0x86, 0xA6, No, + /* LF1 2 Cursor down */ 0x73, 0xF3, 0x8E, 0x9E, 0x8E, 0x8E, 0xAE, Yes, + /* LF2 3 Roll Down */ 0x74, 0xF4, 0x8F, 0x9F, 0x8F, 0x8F, 0xAF, No, + /* RF3 ENTER */ 0x7C, 0xFC, 0xFECB, 0xFEDB, NOP, 0xFECB, NOP, No, + /* LE1 NEXT WINDOW */ 0x5A, 0xDA, 0x8B, 0x9B, 0x8B, 0x8B, 0xAB, No, + /* Numpad , */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, + /* E13 POP */ 0x6C, 0xEC, 0x80, 0x90, 0x80, 0x80, 0xA0, No, + + /* LC1 F1/SHELL/CMD */ 0x28, 0xA8, 0x85, 0x95, 0x85, 0x85, 0xA5, No, + /* LB0 F2/CUT/COPY */ 0x13, 0x93, 0xB0, 0xB4, 0xB0, 0xB0, 0xB8, No, + /* LB1 F3/UNDO/PASTE */ 0x14, 0x94, 0xB1, 0xB5, 0xB1, 0xB1, 0xB9, No, + /* LB2 F4/MOVE/GROW */ 0x15, 0x95, 0xB2, 0xB6, 0xB2, 0xB2, 0xBA, No, + + /* LAO F5/INS/MARK */ 0x01, 0x81, 0x81, 0x91, 0x81, 0x81, 0xA1, No, + /* LA1 F6/LINE DEL */ 0x02, 0x82, 0x82, 0x92, 0x82, 0x82, 0xA2, No, + /* LA2 F7/CHAR DEL */ 0x03, 0x83, 0x83, 0x93, 0x83, 0x83, 0xA3, Yes, + /* RA0 F8/AGAIN */ 0x0E, 0x8E, 0xCD, 0xE9, 0xCD, 0xCD, 0xED, No, + + /* RA1 F9/READ */ 0x0F, 0x8F, 0xCE, 0xEA, 0xCE, 0xCE, 0xEE, No, + /* RA2 F10/SAVE/EDIT */ 0x10, 0x90, 0xCF, 0xEB, 0xCF, 0xCF, 0xEF, No, +#endif + /* RA3 F11/ABORT/EXIT */ 0x11, 0x91, 0xDD, 0xEC, 0xD0, 0xD0, 0xFD, No, + /* RA4 F12/HELP/HOLD */ 0x12, 0x92, 0xB3, 0xB7, 0xB3, 0xB3, 0xBB, No, + + /* LE1 NEXT WINDOW */ 0x5A, 0xDA, 0x8B, 0x9B, 0x8B, 0x8B, 0xAB, No, + /* LE1 NEXT WINDOW */ 0x5A, 0xDA, 0x8B, 0x9B, 0x8B, 0x8B, 0xAB, No, + + /* D1 CAPS LOCK */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, + /* E1 SHIFT */ 0x5E, 0xDE, NOP, NOP, NOP, NOP, NOP, NOP, + /* DO CTRL */ 0x43, 0xC3, NOP, NOP, NOP, NOP, NOP, NOP, +// FIXME: ALT swapped! + /* ?? ALT_R */ 0x77, 0xF7, 0xfe00, NOP, NOP, NOP, 0xfe01, No, + /* ?? ALT_L */ 0x75, 0xF5, 0xfe02, NOP, NOP, NOP, 0xfe03, No, + /* E12 SHIFT */ 0x6A, 0xEA, NOP, NOP, NOP, NOP, NOP, NOP, +// not yet used: + /* E0 REPEAT */ 0x5D, 0xDD, NOP, NOP, NOP, NOP, NOP, NOP, + /* CAPS LOCK LED*/ 0x7E, 0xFE, NOP, NOP, NOP, NOP, NOP, NOP, +// german kbd: + /* 0x68 B1_DE _ */ 0x17, 0x97, 0x60, 0x7E, 0x1E, 0x60, NOP, No, + /* 0x69 E1a_DE <> */ 0x5F, 0xDF, 0xBE, 0xBE, NOP, 0xBE, NOP, No, + /* 0x6a B14_DE ESC */ 0x16, 0x96, 0x1B, 0x1B, NOP, 0x1B, NOP, No, + /* 0x6b D14_DE # \ */ 0x51, 0xD1, 0xC8, 0xC9, NOP, 0xC8, NOP, No, + + /* 0x6c NPG NP ( */ 0x3F, 0xBF, 0xFE28, 0xFE0E, NOP, 0xFE28, NOP, No, + /* 0x6d NPF NP ) */ 0x58, 0xD8, 0xFE29, 0xFE0F, NOP, 0xFE29, NOP, No, + /* 0x6e NPD NP + */ 0x3B, 0xBB, 0xFE2B, 0xFE26, NOP, 0xFE2B, NOP, No, + /* 0x6f NPC NP - */ 0x54, 0xD4, 0xFE2D, 0xFE7E, NOP, 0xFE2D, NOP, No, + /* 0x70 NPB NP * */ 0x6D, 0xED, 0xFE2A, 0xFE21, NOP, 0xFE2A, NOP, No, + /* 0x71 NPA NP / */ 0x78, 0xF8, 0xFECC, 0xFEC8, NOP, 0xFECC, NOP, No, + /* 0x72 NPP NP . */ 0x7B, 0xFB, 0xFE2E, 0xFE2C, NOP, 0xFE2E, NOP, No, + /* 0x73 NPE ENTER */ 0x7C, 0xFC, 0xFECB, 0xFE3D, NOP, 0xFECB, NOP, No, + + /* 0x74 A0 F0 */ 0x04, 0x84, 0x1C, 0x5C, 0x7C, 0x1C, 0xBC, No, + /* 0x75 A1 F1 */ 0x05, 0x85, 0xC0, 0xD0, 0xF0, 0xC0, 0xE0, No, + /* 0x76 A2 F2 */ 0x06, 0x86, 0xC1, 0x01, 0xF1, 0xC1, 0xE1, No, + /* 0x77 A3 F3 */ 0x07, 0x87, 0xC2, 0x02, 0xF2, 0xC2, 0xE2, No, + /* 0x78 A4 F4 */ 0x08, 0x88, 0xC3, 0x03, 0xF3, 0xC3, 0xE3, No, + /* 0x79 A5 F5 */ 0x09, 0x89, 0xC4, 0x04, 0xF4, 0xC4, 0xE4, No, + /* 0x7a A6 F6 */ 0x0A, 0x8A, 0xC5, 0x05, 0xF5, 0xC5, 0xE5, No, + /* 0x7b A7 F7 */ 0x0B, 0x8B, 0xC6, 0x06, 0xF6, 0xC6, 0xE6, No, + /* 0x7c A8 F8 */ 0x0C, 0x8C, 0xC7, 0x07, 0xF7, 0xC7, 0xE7, No, + /* 0x7d A9 F9 */ 0x0D, 0x8D, 0x1F, 0x2F, 0x3F, 0x1F, 0xBD, No, + + /* Key | Keycap | Down | Up |Unshifted|Shifted|Control|Caps Lock|Up Trans|Auto */ + /* Number| Legend | Code | Code|Code | Code | Code |Code | Code |Repeat*/ +}; + +INPUT_PORTS_START( apollo_kbd ) + + PORT_START( "keyboard1" ) + PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("~ '") PORT_CODE(KEYCODE_TILDE) /* ESC */ + PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) /* ESC */ + PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) /* 1 ! */ + PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) /* 2 " */ + PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) /* 3 # */ + PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) /* 4 $ */ + PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) /* 5 % */ + PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) /* 6 & */ + PORT_BIT( 0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) /* 7 ' */ + PORT_BIT( 0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) /* 8 ( */ + PORT_BIT( 0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) /* 9 ) */ + PORT_BIT( 0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) /* 0 */ + PORT_BIT( 0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) /* - _ */ + PORT_BIT( 0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) /* = + */ + PORT_BIT( 0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ ^") PORT_CODE(KEYCODE_BACKSLASH2) /* ~ ` */ + PORT_BIT( 0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) /* Backspace */ + PORT_BIT( 0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) /* Tab */ + PORT_BIT( 0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) /* Q */ + PORT_BIT( 0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) /* W */ + PORT_BIT( 0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) /* E */ + PORT_BIT( 0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) /* R */ + PORT_BIT( 0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) /* T */ + PORT_BIT( 0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) /* Y */ + PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) /* U */ + PORT_BIT( 0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) /* I */ + PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) /* O */ + PORT_BIT( 0x04000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) /* P */ + PORT_BIT( 0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) /* [ { */ + PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) /* ] } */ + PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) /* Return */ + PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) /* A */ + PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) /* S */ + + PORT_START( "keyboard2" ) + PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) /* D */ + PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) /* F */ + PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) /* G */ + PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) /* H */ + PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) /* J */ + PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) /* K */ + PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) /* L */ + PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) /* ; + */ + PORT_BIT( 0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) /* : * */ + PORT_BIT( 0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) /* \\ | */ + PORT_BIT( 0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) /* Z */ + PORT_BIT( 0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) /* X */ + PORT_BIT( 0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) /* C */ + PORT_BIT( 0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) /* V */ + PORT_BIT( 0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) /* B */ + PORT_BIT( 0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) /* N */ + PORT_BIT( 0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) /* M */ + PORT_BIT( 0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) /* , < */ + PORT_BIT( 0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) /* . > */ + PORT_BIT( 0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) /* / ? */ +//?? + PORT_BIT( 0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("~ '") PORT_CODE(KEYCODE_TILDE) /* Underscore (shifted only?) */ + PORT_BIT( 0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) /* Space */ + PORT_BIT( 0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* Home */ + PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) /* Del */ + PORT_BIT( 0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_PGUP) /* Roll Up */ + PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_PGDN) /* Roll Down */ + PORT_BIT( 0x04000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("End") PORT_CODE(KEYCODE_END) /* End */ + PORT_BIT( 0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) /* Left */ + PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) /* Up */ + PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /* Right */ + PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) /* Down */ +// PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad CLR") PORT_CODE(KEYCODE_NUMLOCK) /* CLR */ + PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MENU") PORT_CODE(KEYCODE_MENU) /* Menu = POP */ + + PORT_START( "keyboard3" ) + PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad /") PORT_CODE(KEYCODE_SLASH_PAD) /* / (numpad) */ + PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad *") PORT_CODE(KEYCODE_ASTERISK) /* * (numpad) */ + PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad -") PORT_CODE(KEYCODE_MINUS_PAD) /* - (numpad) */ + PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 7") PORT_CODE(KEYCODE_7_PAD) /* 7 (numpad) */ + PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 8") PORT_CODE(KEYCODE_8_PAD) /* 8 (numpad) */ + PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 9") PORT_CODE(KEYCODE_9_PAD) /* 9 (numpad) */ + PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad +") PORT_CODE(KEYCODE_PLUS_PAD) /* + (numpad) */ + PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 4") PORT_CODE(KEYCODE_4_PAD) /* 4 (numpad) */ + PORT_BIT( 0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 5") PORT_CODE(KEYCODE_5_PAD) /* 5 (numpad) */ + PORT_BIT( 0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 6") PORT_CODE(KEYCODE_6_PAD) /* 6 (numpad) */ + PORT_BIT( 0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad =") /* = (numpad) */ + PORT_BIT( 0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 1") PORT_CODE(KEYCODE_1_PAD) /* 1 (numpad) */ + PORT_BIT( 0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 2") PORT_CODE(KEYCODE_2_PAD) /* 2 (numpad) */ + PORT_BIT( 0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 3") PORT_CODE(KEYCODE_3_PAD) /* 3 (numpad) */ + PORT_BIT( 0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* Enter (numpad) */ + PORT_BIT( 0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 0") PORT_CODE(KEYCODE_0_PAD) /* 0 (numpad) */ + PORT_BIT( 0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad ,") /* , (numpad) */ + PORT_BIT( 0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad .") PORT_CODE(KEYCODE_DEL_PAD) /* 2 (numpad) */ + + PORT_BIT( 0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) /* F1 */ + PORT_BIT( 0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) /* F2 */ + PORT_BIT( 0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) /* F3 */ + PORT_BIT( 0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) /* F4 */ + PORT_BIT( 0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) /* F5 */ + PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) /* F6 */ + PORT_BIT( 0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) /* F7 */ + PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) /* F8 */ + PORT_BIT( 0x04000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) /* F9 */ + PORT_BIT( 0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) /* F10 */ + PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) /* F11 */ + PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) /* F12 */ + PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) /* Insert */ +// PORT_BIT( 0x80000000, 0x0000, IPT_UNUSED ) + PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("WIN_R") PORT_CODE(KEYCODE_RWIN) /* Windows Right = Next Window */ + + PORT_START( "keyboard4" ) + + PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) /* Caps lock */ + PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) /* Shift */ + PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) /* Ctrl */ + PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT_L") PORT_CODE(KEYCODE_LALT) /* ALT */ + PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT_R") PORT_CODE(KEYCODE_RALT) /* ALT GR */ + PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) /* Shift */ + PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num Lock") PORT_CODE(KEYCODE_NUMLOCK) /* Num Lock */ + + PORT_START("mouse1") // mouse buttons + PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) + PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON3) + PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Center mouse button") PORT_CODE(MOUSECODE_BUTTON2) + + PORT_START("mouse2") // X-axis + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(200) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START("mouse3") // Y-axis + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(200) PORT_KEYDELTA(0) PORT_PLAYER(1) + +INPUT_PORTS_END diff --git a/src/mame/machine/apollo_kbd.h b/src/mame/machine/apollo_kbd.h new file mode 100644 index 00000000000..151e753f916 --- /dev/null +++ b/src/mame/machine/apollo_kbd.h @@ -0,0 +1,163 @@ +// license:BSD-3-Clause +// copyright-holders:Hans Ostermeyer +/* + * apollo_kbd.h + * + * Created on: Dec 27, 2010 + * Author: Hans Ostermeyer + * + */ + +#pragma once + +#ifndef __APOLLO_KBD_H__ +#define __APOLLO_KBD_H__ + +#include "emu.h" +#include "sound/beep.h" + +// BSD-derived systems get very sad when you party with system reserved names. +#ifdef getchar +#undef getchar +#endif + +#ifdef putchar +#undef putchar +#endif + +//************************************************************************** +// DEVICE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_APOLLO_KBD_TX_CALLBACK(_cb) \ + devcb = &apollo_kbd_device::set_tx_cb(*device, DEVCB_##_cb); + +#define MCFG_APOLLO_KBD_GERMAN_CALLBACK(_cb) \ + devcb = &apollo_kbd_device::set_german_cb(*device, DEVCB_##_cb); + +INPUT_PORTS_EXTERN(apollo_kbd); + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> apollo_kbd_device + +class apollo_kbd_device : public device_t, public device_serial_interface +{ +public: + // construction/destruction + apollo_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_tx_cb(device_t &device, _Object object) { return downcast(device).m_tx_w.set_callback(object); } + template static devcb_base &set_german_cb(device_t &device, _Object object) { return downcast(device).m_german_r.set_callback(object); } + + devcb_write_line m_tx_w; + devcb_read_line m_german_r; + +private: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // serial overrides + virtual void rcv_complete(); // Rx completed receiving byte + virtual void tra_complete(); // Tx completed sending byte + virtual void tra_callback(); // Tx send bit + void input_callback(UINT8 state); + + TIMER_CALLBACK_MEMBER( kbd_scan_timer ); + + const char *cpu_context() ; + + void kgetchar(UINT8 data); + + int keyboard_is_german(); + + void set_mode(UINT16 mode); + void putchar(const UINT8 data); + void putdata(const UINT8 *data, int data_length); + void putstring(const char *data); + + int push_scancode( UINT8 code, UINT8 repeat); + void scan_keyboard(); + void poll_callback(); + static TIMER_CALLBACK( static_poll_callback ); + + // the keyboard beeper + class beeper + { + public: + beeper(); + void start(apollo_kbd_device *device); + void reset(); + void off(); + void on(); + private: + int keyboard_has_beeper(); + void beeper_callback(); + static TIMER_CALLBACK( static_beeper_callback ); + + apollo_kbd_device *m_device; // pointer back to our device + beep_device *m_beeper; // the keyboard beeper device + emu_timer * m_timer; // timer to clock data in + }; + + // the keyboard mouse + class mouse + { + public: + mouse(); + void start(apollo_kbd_device *device); + void reset(); + void read_mouse(); + private: + apollo_kbd_device *m_device; // pointer back to our device + + int m_last_b; // previous mouse button values + int m_last_x; // previous mouse x-axis value + int m_last_y; // previous mouse y-axis value + int m_tx_pending; // mouse data packet is pending + }; + + static const int XMIT_RING_SIZE = 64; + + UINT8 m_xmitring[XMIT_RING_SIZE]; + int m_xmit_read, m_xmit_write; + bool m_tx_busy; + + void xmit_char(UINT8 data); + + beeper m_beeper; + mouse m_mouse; + + apollo_kbd_device *m_device; // pointer to myself (nasty: used for cpu_context) + + ioport_port *m_io_keyboard1; + ioport_port *m_io_keyboard2; + ioport_port *m_io_keyboard3; + ioport_port *m_io_keyboard4; + ioport_port *m_io_mouse1; + ioport_port *m_io_mouse2; + ioport_port *m_io_mouse3; + + /* Receiver */ + UINT32 m_rx_message; + UINT16 m_loopback_mode; + + emu_timer* m_timer; + UINT16 m_mode; + UINT16 m_delay; // key press delay after initial press + UINT16 m_repeat; // key press repeat rate + UINT16 m_last_pressed; // last key pressed, for repeat key handling + int m_keytime[0x80]; // time until next key press (1 ms) + UINT8 m_keyon[0x80]; // is 1 if key is pressed + + static UINT16 m_code_table[]; +}; + +// device type definition +extern const device_type APOLLO_KBD; + +#endif diff --git a/src/mame/machine/appldriv.c b/src/mame/machine/appldriv.c new file mode 100644 index 00000000000..86e2657cf9b --- /dev/null +++ b/src/mame/machine/appldriv.c @@ -0,0 +1,336 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + appldriv.c + + Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c) + +*********************************************************************/ +#include "emu.h" +#include "appldriv.h" +#include "imagedev/flopdrv.h" +#include "formats/ap2_dsk.h" + +// our parent's device is the Disk II card (Apple II) or main driver (Mac, IIgs) +// either way, get the drive from there. +#define PARENT_FLOPPY_0 "^floppy0" +#define PARENT_FLOPPY_1 "^floppy1" +#define PARENT_FLOPPY_2 "^floppy2" +#define PARENT_FLOPPY_3 "^floppy3" + +INLINE apple525_floppy_image_device *get_device(device_t *device) +{ + assert(device != NULL); + assert(device->type() == FLOPPY_APPLE); + + return (apple525_floppy_image_device *) downcast(device); +} + +static int apple525_enable_mask = 1; + +legacy_floppy_image_device *apple525_get_subdevice(device_t *device, int drive) +{ + switch(drive) { + case 0 : return device->subdevice(PARENT_FLOPPY_0); + case 1 : return device->subdevice(PARENT_FLOPPY_1); + case 2 : return device->subdevice(PARENT_FLOPPY_2); + case 3 : return device->subdevice(PARENT_FLOPPY_3); + } + return NULL; +} + +device_t *apple525_get_device_by_type(device_t *device, int ftype, int drive) +{ + int i; + int cnt = 0; + for (i=0;i<4;i++) { + legacy_floppy_image_device *disk = apple525_get_subdevice(device, i); + if (disk->floppy_get_drive_type()==ftype) { + if (cnt==drive) { + return disk; + } + cnt++; + } + } + return NULL; +} + +void apple525_set_enable_lines(device_t *device,int enable_mask) +{ + apple525_enable_mask = enable_mask; +} + +/* ----------------------------------------------------------------------- */ + +static void apple525_load_current_track(device_t *image) +{ + int len; + apple525_floppy_image_device *disk; + + disk = get_device(image); + len = sizeof(disk->track_data); + + disk->floppy_drive_read_track_data_info_buffer(0, disk->track_data, &len); + disk->track_loaded = 1; + disk->track_dirty = 0; +} + +static void apple525_save_current_track(device_t *image, int unload) +{ + int len; + apple525_floppy_image_device *disk; + + disk = get_device(image); + + if (disk->track_dirty) + { + len = sizeof(disk->track_data); + disk->floppy_drive_write_track_data_info_buffer(0, disk->track_data, &len); + disk->track_dirty = 0; + } + if (unload) + disk->track_loaded = 0; +} + +static void apple525_seek_disk(apple525_floppy_image_device *img, signed int step) +{ + int track; + int pseudo_track; + apple525_floppy_image_device *disk; + + disk = get_device(img); + + apple525_save_current_track(img, FALSE); + + track = img->floppy_drive_get_current_track(); + pseudo_track = (track * 2) + disk->tween_tracks; + + pseudo_track += step; + if (pseudo_track < 0) + pseudo_track = 0; + else if (pseudo_track/2 >= APPLE2_TRACK_COUNT) + pseudo_track = APPLE2_TRACK_COUNT*2-1; + + if (pseudo_track/2 != track) + { + img->floppy_drive_seek(pseudo_track/2 - img->floppy_drive_get_current_track()); + disk->track_loaded = 0; + } + + if (pseudo_track & 1) + disk->tween_tracks = 1; + else + disk->tween_tracks = 0; +} + +static void apple525_disk_set_lines(device_t *device,device_t *image, UINT8 new_state) +{ + apple525_floppy_image_device *cur_disk; + UINT8 old_state; + unsigned int phase; + + cur_disk = get_device(image); + + old_state = cur_disk->state; + cur_disk->state = new_state; + + if ((new_state & 0x0F) > (old_state & 0x0F)) + { + phase = 0; + switch((old_state ^ new_state) & 0x0F) + { + case 1: phase = 0; break; + case 2: phase = 1; break; + case 4: phase = 2; break; + case 8: phase = 3; break; + } + + phase -= cur_disk->floppy_drive_get_current_track() * 2; + if (cur_disk->tween_tracks) + phase--; + phase %= 4; + + switch(phase) + { + case 1: + apple525_seek_disk(cur_disk, +1); + break; + case 3: + apple525_seek_disk(cur_disk, -1); + break; + } + } +} + +int apple525_get_count(device_t *device) +{ + int cnt = 0; + if ((device->subdevice("^" FLOPPY_0)!=NULL) && (device->subdevice("^" FLOPPY_0)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_0))!=NULL)) cnt++; + if ((device->subdevice("^" FLOPPY_1)!=NULL) && (device->subdevice("^" FLOPPY_1)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_1))!=NULL)) cnt++; + if ((device->subdevice("^" FLOPPY_2)!=NULL) && (device->subdevice("^" FLOPPY_2)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_2))!=NULL)) cnt++; + if ((device->subdevice("^" FLOPPY_3)!=NULL) && (device->subdevice("^" FLOPPY_3)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_3))!=NULL)) cnt++; + + return cnt; +} + +void apple525_set_lines(device_t *device, UINT8 lines) +{ + int i, count; + device_t *image; + + count = apple525_get_count(device); + for (i = 0; i < count; i++) + { + if (apple525_enable_mask & (1 << i)) + { + image = apple525_get_device_by_type(device, FLOPPY_TYPE_APPLE, i); + if (image) + apple525_disk_set_lines(device,image, lines); + } + } +} + +/* reads/writes a byte; write_value is -1 for read only */ +static UINT8 apple525_process_byte(device_t *img, int write_value) +{ + UINT8 read_value; + apple525_floppy_image_device *disk; + int spinfract_divisor; + int spinfract_dividend; + apple525_floppy_image_device *config = get_device(img); + device_image_interface *image = dynamic_cast(img); + + disk = get_device(img); + spinfract_dividend = config->get_dividend(); + spinfract_divisor = config->get_divisor(); + + /* no image initialized for that drive ? */ + if (!image->exists()) + return 0xFF; + + /* check the spin count if reading*/ + if (write_value < 0) + { + disk->spin_count++; + disk->spin_count %= spinfract_divisor; + if (disk->spin_count >= spinfract_dividend) + return 0x00; + } + + /* load track if need be */ + if (disk->track_loaded == 0) + apple525_load_current_track(img); + + /* perform the read */ + read_value = disk->track_data[disk->position]; + + /* perform the write, if applicable */ + if (write_value >= 0) + { + disk->track_data[disk->position] = write_value; + disk->track_dirty = 1; + } + + disk->position++; + disk->position %= ARRAY_LENGTH(disk->track_data); + + /* when writing; save the current track after every full sector write */ + if ((write_value >= 0) && ((disk->position % APPLE2_NIBBLE_SIZE) == 0)) + apple525_save_current_track(img, FALSE); + + return read_value; +} + +static device_t *apple525_selected_image(device_t *device) +{ + int i,count; + + count = apple525_get_count(device); + + for (i = 0; i < count; i++) + { + if (apple525_enable_mask & (1 << i)) + return apple525_get_device_by_type(device, FLOPPY_TYPE_APPLE, i); + } + return NULL; +} + +UINT8 apple525_read_data(device_t *device) +{ + device_t *image; + image = apple525_selected_image(device); + return image ? apple525_process_byte(image, -1) : 0xFF; +} + +void apple525_write_data(device_t *device,UINT8 data) +{ + device_t *image; + image = apple525_selected_image(device); + if (image) + apple525_process_byte(image, data); +} + +int apple525_read_status(device_t *device) +{ + int i, count, result = 0; + device_image_interface *image; + + count = apple525_get_count(device); + + for (i = 0; i < count; i++) + { + if (apple525_enable_mask & (1 << i)) + { + image = dynamic_cast(apple525_get_device_by_type(device, FLOPPY_TYPE_APPLE, i)); + if (image && image->is_readonly()) + result = 1; + } + } + return result; +} + +// device type definition +const device_type FLOPPY_APPLE = &device_creator; + +//------------------------------------------------- +// apple525_floppy_image_device - constructor +//------------------------------------------------- + +apple525_floppy_image_device::apple525_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : legacy_floppy_image_device(mconfig, FLOPPY_APPLE, "Apple Disk II", tag, owner, clock, "floppy_apple", __FILE__) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apple525_floppy_image_device::device_start() +{ + legacy_floppy_image_device::device_start(); + floppy_set_type(FLOPPY_TYPE_APPLE); + + state = 0; + tween_tracks = 0; + track_loaded = 0; + track_dirty = 0; + position = 0; + spin_count = 0; + memset(track_data, 0, sizeof(track_data)); +} + +bool apple525_floppy_image_device::call_load() +{ + int result = legacy_floppy_image_device::call_load(); + floppy_drive_seek(-999); + floppy_drive_seek(+35/2); + return result; +} + +void apple525_floppy_image_device::call_unload() +{ + apple525_save_current_track(this, TRUE); + + legacy_floppy_image_device::call_unload(); +} diff --git a/src/mame/machine/appldriv.h b/src/mame/machine/appldriv.h new file mode 100644 index 00000000000..cbda53a42a3 --- /dev/null +++ b/src/mame/machine/appldriv.h @@ -0,0 +1,88 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + appldriv.h + + Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c) + +*********************************************************************/ + +#ifndef APPLDRIV_H +#define APPLDRIV_H + +#include "emu.h" +#include "imagedev/flopdrv.h" +#include "formats/ap2_dsk.h" + +void apple525_set_lines(device_t *device,UINT8 lines); +void apple525_set_enable_lines(device_t *device,int enable_mask); + +UINT8 apple525_read_data(device_t *device); +void apple525_write_data(device_t *device,UINT8 data); +int apple525_read_status(device_t *device); +int apple525_get_count(running_machine &machine); + +class apple525_floppy_image_device : public legacy_floppy_image_device +{ +public: + // construction/destruction + apple525_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual bool call_load(); + virtual void call_unload(); + void set_params(int dividend, int divisor) { m_dividend = dividend; m_divisor = divisor;} + + int get_dividend() { return m_dividend; } + int get_divisor() { return m_divisor; } + + // these elements should be private, but are not yet + unsigned int state : 4; /* bits 0-3 are the phase */ + unsigned int tween_tracks : 1; + unsigned int track_loaded : 1; + unsigned int track_dirty : 1; + int position; + int spin_count; /* simulate drive spin to fool RWTS test at $BD34 */ + UINT8 track_data[APPLE2_NIBBLE_SIZE * APPLE2_SECTOR_COUNT]; + +protected: + virtual void device_start(); + +private: + int m_dividend; + int m_divisor; +}; + +// device type definition +extern const device_type FLOPPY_APPLE; + +#define MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ + downcast(device)->set_params(_dividend,_divisor); + +#define MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(_config,_dividend,_divisor) \ + MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_APPLE, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ + MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_APPLE, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) + +#define MCFG_LEGACY_FLOPPY_APPLE_4_DRIVES_ADD(_config,_dividend,_divisor) \ + MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_APPLE, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ + MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_APPLE, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ + MCFG_DEVICE_ADD(FLOPPY_2, FLOPPY_APPLE, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ + MCFG_DEVICE_ADD(FLOPPY_3, FLOPPY_APPLE, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) + +#define MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_REMOVE() \ + MCFG_DEVICE_REMOVE(FLOPPY_0) \ + MCFG_DEVICE_REMOVE(FLOPPY_1) + +#endif /* APPLDRIV_H */ diff --git a/src/mame/machine/apple1.c b/src/mame/machine/apple1.c new file mode 100644 index 00000000000..59b360aea7e --- /dev/null +++ b/src/mame/machine/apple1.c @@ -0,0 +1,404 @@ +// license:??? +// copyright-holders:Paul Daniels, Colin Howell, R. Belmont +/*************************************************************************** + + machine.c + + Functions to emulate general aspects of the machine (RAM, ROM, interrupts, + I/O ports) + + The Apple I used a Motorola 6820 PIA for its keyboard and display + I/O. The keyboard was mapped to PIA port A, and the display to port + B. + + Port A, the keyboard, was an input port connected to a standard + ASCII-encoded keyboard. The high bit of the port was tied to +5V. + The keyboard strobe signal was connected to the PIA's CA1 control + input so that the keyboard could signal each keypress to the PIA. + The processor could check for a keypress by testing the IRQA1 flag + in the Port A Control Register and then reading the character value + from Port A. + + The keyboard connector also had two special lines, RESET and CLEAR + SCREEN, which were meant to be connected to pushbutton switches on + the keyboard. RESET was tied to the reset inputs for the CPU and + PIA; it allowed the user to stop a program and return control to the + Monitor. CLEAR SCREEN was directly tied to the video hardware and + would clear the display. + + Port B, the display, was an output port which accepted 7-bit ASCII + characters from the PIA and wrote them on the display. The details + of this are described in video/apple1.c. Control line CB2 served + as an output signal to inform the display of a new character. (CB2 + was also connected to line 7 of port B, which was configured as an + input, so that the CPU could more easily check the status of the + write.) The CB1 control input signaled the PIA when the display had + finished writing the character and could accept a new one. + + MAME models the 6821 instead of the earlier 6820 used in the Apple + I, but there is no difference in functionality between the two + chips; the 6821 simply has a better ability to drive electrical + loads. + + The Apple I had an optional cassette interface which plugged into + the expansion connector. This is described below in the "Cassette + interface I/O" section. + +***************************************************************************/ + +#include "emu.h" +#include "includes/apple1.h" +#include "machine/6821pia.h" +#include "cpu/m6502/m6502.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" + +/***************************************************************************** +** Structures +*****************************************************************************/ + +/* Use the same keyboard mapping as on a modern keyboard. This is not + the same as the keyboard mapping of the actual teletype-style + keyboards used with the Apple I, but it's less likely to cause + confusion for people who haven't memorized that layout. + + The Backspace key is mapped to the '_' (underscore) character + because the Apple I ROM Monitor used "back-arrow" to erase + characters, rather than backspace, and back-arrow is an earlier + form of the underscore. */ + +#define ESCAPE '\x1b' + +static const UINT8 apple1_unshifted_keymap[] = +{ + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', '-', '=', '[', ']', ';', '\'', + ',', '.', '/', '\\', 'A', 'B', 'C', 'D', + 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', + 'U', 'V', 'W', 'X', 'Y', 'Z', '\r', '_', + ' ', ESCAPE +}; + +static const UINT8 apple1_shifted_keymap[] = +{ + ')', '!', '@', '#', '$', '%', '^', '&', + '*', '(', '_', '+', '[', ']', ':', '"', + '<', '>', '?', '\\', 'A', 'B', 'C', 'D', + 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', + 'U', 'V', 'W', 'X', 'Y', 'Z', '\r', '_', + ' ', ESCAPE +}; + +/* Control key mappings, like the other mappings, conform to a modern + keyboard where possible. Note that the Apple I ROM Monitor ignores + most control characters. */ + +static const UINT8 apple1_control_keymap[] = +{ + '0', '1', '\x00', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '8', '9', '\x1f', '=', '\x1b', '\x1d', ';', '\'', + ',', '.', '/', '\x1c', '\x01', '\x02', '\x03', '\x04', + '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', + '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', + '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\r', '_', + '\x00', ESCAPE +}; + + + +/***************************************************************************** +** DRIVER_INIT: driver-specific setup, executed once at MESS startup. +*****************************************************************************/ + +DRIVER_INIT_MEMBER(apple1_state,apple1) +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + /* Set up the handlers for MESS's dynamically-sized RAM. */ + space.install_readwrite_bank(0x0000, m_ram->size() - 1, "bank1"); + membank("bank1")->set_base(m_ram->pointer()); + + /* Poll the keyboard input ports periodically. These include both + ordinary keys and the RESET and CLEAR SCREEN pushbutton + switches. We can't handle these switches in a VBLANK_INT or + PERIODIC_INT because both switches need to be monitored even + while the CPU is suspended during RESET; VBLANK_INT and + PERIODIC_INT callbacks aren't run while the CPU is in this + state. + + A 120-Hz poll rate seems to be fast enough to ensure no + keystrokes are missed. */ + machine().scheduler().timer_pulse(attotime::from_hz(120), timer_expired_delegate(FUNC(apple1_state::apple1_kbd_poll),this)); +} + + +void apple1_state::machine_reset() +{ + /* Reset the display hardware. */ + apple1_vh_dsp_clr(); +} + + +/***************************************************************************** +** apple1_verify_header +*****************************************************************************/ +int apple1_state::apple1_verify_header (UINT8 *data) +{ + /* Verify the format for the snapshot */ + if ((data[0] == 'L') && + (data[1] == 'O') && + (data[2] == 'A') && + (data[3] == 'D') && + (data[4] == ':') && + (data[7] == 'D') && + (data[8] == 'A') && + (data[9] == 'T') && + (data[10]== 'A') && + (data[11]== ':')) + { + return(IMAGE_VERIFY_PASS); + } + else + { + return(IMAGE_VERIFY_FAIL); + } +} + +#define SNAP_HEADER_LEN 12 + +/***************************************************************************** +** snapshot_load_apple1 +** +** Format of the binary snapshot image is: +** +** [ LOAD:xxyyDATA:zzzzzz...] +** +** where xxyy is the binary starting address (in big-endian byte +** order) to load the binary data zzzzzz to. +** +** The image can be of arbitrary length, but it must fit in available +** memory. +*****************************************************************************/ +SNAPSHOT_LOAD_MEMBER( apple1_state,apple1) +{ + UINT64 filesize, datasize; + UINT8 *snapbuf, *snapptr; + UINT16 start_addr, end_addr, addr; + + filesize = image.length(); + + /* Read the snapshot data into a temporary array */ + if (filesize < SNAP_HEADER_LEN) + return IMAGE_INIT_FAIL; + snapbuf = (UINT8*)image.ptr(); + if (!snapbuf) + return IMAGE_INIT_FAIL; + + /* Verify the snapshot header */ + if (apple1_verify_header(snapbuf) == IMAGE_VERIFY_FAIL) + { + logerror("apple1 - Snapshot Header is in incorrect format - needs to be LOAD:xxyyDATA:\n"); + return IMAGE_INIT_FAIL; + } + + datasize = filesize - SNAP_HEADER_LEN; + + /* Extract the starting address to load the snapshot to. */ + start_addr = (snapbuf[5] << 8) | (snapbuf[6]); + logerror("apple1 - LoadAddress is 0x%04x\n", start_addr); + + end_addr = start_addr + datasize - 1; + + if ((start_addr < 0xE000 && end_addr > m_ram->size() - 1) + || end_addr > 0xEFFF) + { + logerror("apple1 - Snapshot won't fit in this memory configuration;\n" + "needs memory from $%04X to $%04X.\n", start_addr, end_addr); + return IMAGE_INIT_FAIL; + } + + /* Copy the data into memory space. */ + for (addr = start_addr, snapptr = snapbuf + SNAP_HEADER_LEN; + addr <= end_addr; + addr++, snapptr++) + m_maincpu->space(AS_PROGRAM).write_byte(addr, *snapptr); + + + return IMAGE_INIT_PASS; +} + + +/***************************************************************************** +** apple1_kbd_poll +** +** Keyboard polling handles both ordinary keys and the special RESET +** and CLEAR SCREEN switches. +** +** For ordinary keys, this implements 2-key rollover to reduce the +** chance of missed keypresses. If we press a key and then press a +** second key while the first hasn't been completely released, as +** might happen during rapid typing, only the second key is +** registered; the first key is ignored. +** +** If multiple newly-pressed keys are found, the one closest to the +** end of the input ports list is counted; the others are ignored. +*****************************************************************************/ +TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_poll) +{ + int port, bit; + int key_pressed; + UINT32 shiftkeys, ctrlkeys; + pia6821_device *pia = machine().device("pia"); + static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" }; + + /* This holds the values of all the input ports for ordinary keys + seen during the last scan. */ + + /* First we check the RESET and CLEAR SCREEN pushbutton switches. */ + + /* The RESET switch resets the CPU and the 6820 PIA. */ + if (ioport("KEY5")->read() & 0x0001) + { + if (!m_reset_flag) { + m_reset_flag = 1; + /* using PULSE_LINE does not allow us to press and hold key */ + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + pia->reset(); + } + } + else if (m_reset_flag) { + /* RESET released--allow the processor to continue. */ + m_reset_flag = 0; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } + + /* The CLEAR SCREEN switch clears the video hardware. */ + if (ioport("KEY5")->read() & 0x0002) + { + if (!m_vh_clrscrn_pressed) + { + /* Ignore further video writes, and clear the screen. */ + m_vh_clrscrn_pressed = 1; + apple1_vh_dsp_clr(); + } + } + else if (m_vh_clrscrn_pressed) + { + /* CLEAR SCREEN released--pay attention to video writes again. */ + m_vh_clrscrn_pressed = 0; + } + + /* Now we scan all the input ports for ordinary keys, recording + new keypresses while ignoring keys that were already pressed in + the last scan. */ + + m_kbd_data = 0; + key_pressed = 0; + + /* The keyboard strobe line should always be low when a scan starts. */ + pia->ca1_w(0); + + shiftkeys = ioport("KEY4")->read() & 0x0003; + ctrlkeys = ioport("KEY4")->read() & 0x000c; + + for (port = 0; port < 4; port++) + { + UINT32 portval, newkeys; + + portval = ioport(keynames[port])->read(); + newkeys = portval & ~(m_kbd_last_scan[port]); + + if (newkeys) + { + key_pressed = 1; + for (bit = 0; bit < 16; bit++) { + if (newkeys & 1) + { + m_kbd_data = (ctrlkeys) + ? apple1_control_keymap[port*16 + bit] + : (shiftkeys) + ? apple1_shifted_keymap[port*16 + bit] + : apple1_unshifted_keymap[port*16 + bit]; + } + newkeys >>= 1; + } + } + m_kbd_last_scan[port] = portval; + } + + if (key_pressed) + { + /* The keyboard will pulse its strobe line when a key is + pressed. A 10-usec pulse is typical. */ + pia->ca1_w(1); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(apple1_state::apple1_kbd_strobe_end),this)); + } +} + +TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_strobe_end) +{ + pia6821_device *pia = machine().device("pia"); + + /* End of the keyboard strobe pulse. */ + pia->ca1_w(0); +} + + +/***************************************************************************** +** READ/WRITE HANDLERS +*****************************************************************************/ +READ8_MEMBER(apple1_state::apple1_pia0_kbdin) +{ + /* Bit 7 of the keyboard input is permanently wired high. This is + what the ROM Monitor software expects. */ + return m_kbd_data | 0x80; +} + +WRITE8_MEMBER(apple1_state::apple1_pia0_dspout) +{ + /* Send an ASCII character to the video hardware. */ + apple1_vh_dsp_w(data); +} + +WRITE_LINE_MEMBER(apple1_state::apple1_pia0_dsp_write_signal) +{ + device_t *device = machine().device("pia"); + /* PIA output CB2 is inverted to become the DA signal, used to + signal a display write to the video hardware. */ + + /* DA is directly connected to PIA input PB7, so the processor can + read bit 7 of port B to test whether the display has completed + a write. */ + pia6821_device *pia = downcast(device); + pia->portb_w((!state) << 7); + + /* Once DA is asserted, the display will wait until it can perform + the write, when the cursor position is about to be refreshed. + Only then will it assert \RDA to signal readiness for another + write. Thus the write delay depends on the cursor position and + where the display is in the refresh cycle. */ + if (!state) + machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_start),this)); +} + +TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_start) +{ + pia6821_device *pia = machine().device("pia"); + + /* When the display asserts \RDA to signal it is ready, it + triggers a 74123 one-shot to send a 3.5-usec low pulse to PIA + input CB1. The end of this pulse will tell the PIA that the + display is ready for another write. */ + pia->cb1_w(0); + machine().scheduler().timer_set(attotime::from_nsec(3500), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_end),this)); +} + +TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_end) +{ + pia6821_device *pia = machine().device("pia"); + + /* The one-shot pulse has ended; return CB1 to high, so we can do + another display write. */ + pia->cb1_w(1); +} diff --git a/src/mame/machine/apple2.c b/src/mame/machine/apple2.c new file mode 100644 index 00000000000..765f97ad92a --- /dev/null +++ b/src/mame/machine/apple2.c @@ -0,0 +1,2632 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + apple2.c + + Machine file to handle emulation of the Apple II series. + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "includes/apple2.h" +#include "machine/applefdc.h" +#include "machine/sonydriv.h" +#include "machine/appldriv.h" +#include "imagedev/flopdrv.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" +#include "debugger.h" + +#ifdef MAME_DEBUG +#define VERBOSE 1 +#else +#define VERBOSE 0 +#endif /* MAME_DEBUG */ + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +#define PROFILER_C00X PROFILER_USER2 +#define PROFILER_C01X PROFILER_USER2 +#define PROFILER_C08X PROFILER_USER2 +#define PROFILER_A2INT PROFILER_USER2 + +/* ----------------------------------------------------------------------- + * New Apple II memory manager + * ----------------------------------------------------------------------- */ + +READ8_MEMBER(apple2_state::read_floatingbus) +{ + return apple2_getfloatingbusvalue(); +} + + + +void apple2_state::apple2_setup_memory(const apple2_memmap_config *config) +{ + m_mem_config = *config; + m_current_meminfo = NULL; + apple2_update_memory(); +} + + + +void apple2_state::apple2_update_memory() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + int i, bank; + char rbank[10], wbank[10]; + int full_update = 0; + apple2_meminfo meminfo; + read8_delegate *rh; + write8_delegate *wh; + offs_t begin, end_r, end_w; + UINT8 *rbase, *wbase; + UINT32 offset; + bank_disposition_t bank_disposition; + int wh_nop = 0; + + /* need to build list of current info? */ + if (!m_current_meminfo) + { + for (i = 0; m_mem_config.memmap[i].end; i++) + ; + m_current_meminfo = auto_alloc_array(machine(), apple2_meminfo, i); + full_update = 1; + } + + /* loop through the entire memory map */ + bank = m_mem_config.first_bank; + for (i = 0; m_mem_config.memmap[i].get_meminfo; i++) + { + /* retrieve information on this entry */ + memset(&meminfo, 0, sizeof(meminfo)); + m_mem_config.memmap[i].get_meminfo(machine(),m_mem_config.memmap[i].begin, m_mem_config.memmap[i].end, &meminfo); + + bank_disposition = m_mem_config.memmap[i].bank_disposition; + + /* do we need to memory reading? */ + if (full_update + || (meminfo.read_mem != m_current_meminfo[i].read_mem) + || (meminfo.read_handler != m_current_meminfo[i].read_handler)) + { + rbase = NULL; + sprintf(rbank,"bank%d",bank); + begin = m_mem_config.memmap[i].begin; + end_r = m_mem_config.memmap[i].end; + rh = NULL; + + LOG(("apple2_update_memory(): Updating RD {%06X..%06X} [#%02d] --> %08X\n", + begin, end_r, bank, meminfo.read_mem)); + + /* read handling */ + if (meminfo.read_handler) + { + /* handler */ + rh = meminfo.read_handler; + } + else if (meminfo.read_mem == APPLE2_MEM_FLOATING) + { + /* floating RAM */ + rh = &read_delegates_master[0]; + } + else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_AUX) + { + /* auxillary memory */ + assert(m_mem_config.auxmem); + offset = meminfo.read_mem & APPLE2_MEM_MASK; + rbase = &m_mem_config.auxmem[offset]; + } + else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_SLOT) + { + // slots 1-2 + if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0) + { + rh = &read_delegates_master[1]; + } + else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x200) + { // slot 3 + rh = &read_delegates_master[2]; + } + else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300) + { // slots 4-7 + rh = &read_delegates_master[3]; + } + else + { + printf("ERROR: Unhandled case for APPLE2_MEM_SLOT write_mem = %x!\n", (meminfo.write_mem & APPLE2_MEM_MASK)); + } + } + else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_ROM) + { + /* ROM */ + offset = meminfo.read_mem & APPLE2_MEM_MASK; + rbase = &m_rom[offset % m_rom_length]; + } + else + { + /* RAM */ + if (end_r >= m_ram->size()) + end_r = m_ram->size() - 1; + offset = meminfo.read_mem & APPLE2_MEM_MASK; + if (end_r >= begin) + rbase = &m_ram->pointer()[offset]; + } + + /* install the actual handlers */ + if (begin <= end_r) { + if (rh) { + space.install_read_handler(begin, end_r, *rh); + } else { + space.install_read_bank(begin, end_r, rbank); + } + } + + /* did we 'go past the end?' */ + if (end_r < m_mem_config.memmap[i].end) + space.nop_read(end_r + 1, m_mem_config.memmap[i].end); + + /* set the memory bank */ + if (rbase) + { + membank(rbank)->set_base(rbase); + } + + /* record the current settings */ + m_current_meminfo[i].read_mem = meminfo.read_mem; + m_current_meminfo[i].read_handler = meminfo.read_handler; + } + + /* do we need to memory writing? */ + if (full_update + || (meminfo.write_mem != m_current_meminfo[i].write_mem) + || (meminfo.write_handler != m_current_meminfo[i].write_handler)) + { + wbase = NULL; + if (bank_disposition == A2MEM_MONO) + sprintf(wbank,"bank%d",bank); + else if (bank_disposition == A2MEM_DUAL) + sprintf(wbank,"bank%d",bank+1); + begin = m_mem_config.memmap[i].begin; + end_w = m_mem_config.memmap[i].end; + wh = NULL; + + LOG(("apple2_update_memory(): Updating WR {%06X..%06X} [#%02d] --> %08X\n", + begin, end_w, bank, meminfo.write_mem)); + + /* write handling */ + if (meminfo.write_handler) + { + /* handler */ + wh = meminfo.write_handler; + } + else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_AUX) + { + /* auxillary memory */ + assert(m_mem_config.auxmem); + offset = meminfo.write_mem & APPLE2_MEM_MASK; + wbase = &m_mem_config.auxmem[offset]; + } + else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_SLOT) + { + /* slot RAM/ROM */ + + // slots 1-2 + if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0) + { + wh = &write_delegates_master[0]; + } + else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x200) + { // slot 3 + wh = &write_delegates_master[1]; + } + else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300) + { // slots 4-7 + wh = &write_delegates_master[2]; + } + } + else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_ROM) + { + /* ROM */ + wh_nop = 1; + } + else + { + /* RAM */ + if (end_w >= m_ram->size()) + end_w = m_ram->size() - 1; + offset = meminfo.write_mem & APPLE2_MEM_MASK; + if (end_w >= begin) + wbase = &m_ram->pointer()[offset]; + } + + + /* install the actual handlers */ + if (begin <= end_w) { + if (wh) { + space.install_write_handler(begin, end_w, *wh); + } else { + if (wh_nop) { + space.nop_write(begin, end_w); + } else { + space.install_write_bank(begin, end_w, wbank); + } + } + } + + /* did we 'go past the end?' */ + if (end_w < m_mem_config.memmap[i].end) + space.nop_write(end_w + 1, m_mem_config.memmap[i].end); + + /* set the memory bank */ + if (wbase) + { + membank(wbank)->set_base(wbase); + } + + /* record the current settings */ + m_current_meminfo[i].write_mem = meminfo.write_mem; + m_current_meminfo[i].write_handler = meminfo.write_handler; + } + bank += bank_disposition; + } +} + + + +void apple2_state::apple2_update_memory_postload() +{ + apple2_update_memory(); +} + + + +/* ----------------------------------------------------------------------- + * Apple II memory map + * ----------------------------------------------------------------------- */ + +READ8_MEMBER(apple2_state::apple2_c0xx_r) +{ + if(!space.debugger_access()) + { + read8_delegate handlers[] = + { + read8_delegate(FUNC(apple2_state::apple2_c00x_r), this), + read8_delegate(FUNC(apple2_state::apple2_c01x_r), this), + read8_delegate(FUNC(apple2_state::apple2_c02x_r), this), + read8_delegate(FUNC(apple2_state::apple2_c03x_r), this), + read8_delegate(FUNC(apple2_state::apple2_c03x_r), this), // not called here, handled elsewhere + read8_delegate(FUNC(apple2_state::apple2_c05x_r), this), + read8_delegate(FUNC(apple2_state::apple2_c06x_r), this), + read8_delegate(FUNC(apple2_state::apple2_c07x_r), this) + }; + + offset &= 0x7F; + + /* normal handler */ + if (offset / 0x10 != 4) + { + return handlers[offset / 0x10](space, offset % 0x10, 0); + } + } + + return 0; +} + + + +WRITE8_MEMBER(apple2_state::apple2_c0xx_w) +{ + write8_delegate handlers[] = + { + write8_delegate(FUNC(apple2_state::apple2_c00x_w), this), + write8_delegate(FUNC(apple2_state::apple2_c01x_w), this), + write8_delegate(FUNC(apple2_state::apple2_c02x_w), this), + write8_delegate(FUNC(apple2_state::apple2_c03x_w), this), + write8_delegate(FUNC(apple2_state::apple2_c03x_w), this), // unused + write8_delegate(FUNC(apple2_state::apple2_c05x_w), this), + write8_delegate(FUNC(apple2_state::apple2_c05x_w), this), // unused + write8_delegate(FUNC(apple2_state::apple2_c07x_w), this) + }; + + offset &= 0x7F; + + /* normal handler */ + if (((offset / 0x10) != 4) && (offset / 0x10) != 6) + { + handlers[offset / 0x10](space, offset % 0x10, data, 0); + } +} + +READ8_MEMBER(apple2_state::apple2_c080_r) +{ + if(!space.debugger_access()) + { + device_a2bus_card_interface *slotdevice; + int slot; + + offset &= 0x7F; + slot = offset / 0x10; + + if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS) || (m_machinetype == LASER128)) + { + if (slot == 1) + { + offset &= 0xf; + if (offset >= 8 && offset <= 0xb) + { + return m_acia1->read(space, offset-8); + } + } + else if (slot == 2) + { + offset &= 0xf; + if (offset >= 8 && offset <= 0xb) + { + return m_acia2->read(space, offset-8); + } + } + } + + if ((m_machinetype == APPLE_IICPLUS) && (slot == 6)) + { + offset &= 0xf; + return m_iicpiwm->read(offset); + } + + if ((m_machinetype == LASER128) && (slot == 5)) + { + offset &= 0xf; + UINT8 retval = m_exp_regs[offset]; + + if (offset == 3) + { + retval = m_exp_ram[m_exp_liveptr&m_exp_addrmask]; + m_exp_liveptr++; + m_exp_regs[0] = m_exp_liveptr & 0xff; + m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; + } + + return retval; + } + + if ((m_machinetype == LASER128) && (slot == 6)) + { + offset &= 0xf; + return m_laserudc->read(offset); + } + + /* now identify the device */ + slotdevice = m_a2bus->get_a2bus_card(slot); + + /* and if we can, read from the slot */ + if (slotdevice != NULL) + { + return slotdevice->read_c0nx(space, offset % 0x10); + } + } + + return 0; +} + + +WRITE8_MEMBER(apple2_state::apple2_c080_w) +{ + device_a2bus_card_interface *slotdevice; + int slot; + + offset &= 0x7F; + slot = offset / 0x10; + + if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS) || (m_machinetype == LASER128)) + { + if (slot == 1) + { + offset &= 0xf; + if (offset >= 8 && offset <= 0xb) + { + m_acia1->write(space, offset-8, data); + return; + } + } + else if (slot == 2) + { + offset &= 0xf; + if (offset >= 8 && offset <= 0xb) + { + m_acia2->write(space, offset-8, data); + return; + } + } + } + + if ((m_machinetype == APPLE_IICPLUS) && (slot == 6)) + { + offset &= 0xf; + m_iicpiwm->write(offset, data); + return; + } + + if ((m_machinetype == LASER128) && (slot == 5)) + { + switch (offset & 0xf) + { + case 0: + m_exp_wptr &= ~0xff; + m_exp_wptr |= data; + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 1: + m_exp_wptr &= ~0xff00; + m_exp_wptr |= (data<<8); + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 2: + m_exp_wptr &= ~0xff0000; + m_exp_wptr |= (data<<16); + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 3: + // printf("Write %02x to RAM[%x]\n", data, m_liveptr); + m_exp_ram[(m_exp_liveptr&m_exp_addrmask)] = data; + m_exp_liveptr++; + m_exp_regs[0] = m_exp_liveptr & 0xff; + m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; + break; + + default: + m_exp_regs[offset] = data; + break; + } + } + + if ((m_machinetype == LASER128) && (slot == 6)) + { + offset &= 0xf; + m_laserudc->write(space, offset, data); + return; + } + + /* now identify the device */ + slotdevice = m_a2bus->get_a2bus_card(slot); + + /* and if we can, write to the slot */ + if (slotdevice != NULL) + { + slotdevice->write_c0nx(space, offset % 0x10, data); + } +} + +/* returns default CnXX slotram for a slot space */ +INT8 apple2_state::apple2_slotram_r(address_space &space, int slotnum, int offset) +{ + if (m_slot_ram) + { + if (!space.debugger_access()) + { +// printf("slotram_r: taking cnxx_slot to -1\n"); + m_a2_cnxx_slot = -1; + apple2_update_memory(); + } + + return m_slot_ram[offset]; + } + + // else fall through to floating bus + return apple2_getfloatingbusvalue(); +} + +READ8_MEMBER(apple2_state::apple2_c1xx_r ) +{ + int slotnum; + device_a2bus_card_interface *slotdevice; + + slotnum = ((offset>>8) & 0xf) + 1; + slotdevice = m_a2bus->get_a2bus_card(slotnum); + + if (slotdevice != NULL) + { + if ((slotdevice->take_c800()) && (!space.debugger_access())) + { +// printf("c1xx_r: taking cnxx_slot to %d\n", slotnum); + m_a2_cnxx_slot = slotnum; + apple2_update_memory(); + } + + return slotdevice->read_cnxx(space, offset&0xff); + } + else + { + return apple2_slotram_r(space, slotnum, offset); + } + + // else fall through to floating bus + // never executed + //return apple2_getfloatingbusvalue(); +} + +WRITE8_MEMBER(apple2_state::apple2_c1xx_w ) +{ + int slotnum; + device_a2bus_card_interface *slotdevice; + + slotnum = ((offset>>8) & 0xf) + 1; + + slotdevice = m_a2bus->get_a2bus_card(slotnum); + + if (slotdevice != NULL) + { + slotdevice->write_cnxx(space, offset&0xff, data); + } + else + { + if (m_slot_ram) + m_slot_ram[offset] = data; + } +} + +READ8_MEMBER(apple2_state::apple2_c3xx_r ) +{ + int slotnum; + device_a2bus_card_interface *slotdevice; + + slotnum = 3; + slotdevice = m_a2bus->get_a2bus_card(slotnum); + + // is a card installed in this slot? + if (slotdevice != NULL) + { + if ((slotdevice->take_c800()) && (!space.debugger_access())) + { +// printf("c3xx_r: taking cnxx_slot to %d\n", slotnum); + m_a2_cnxx_slot = slotnum; + apple2_update_memory(); + } + return slotdevice->read_cnxx(space, offset&0xff); + } + else + { + return apple2_slotram_r(space, slotnum, offset); + } + + // else fall through to floating bus + // never executed + //return apple2_getfloatingbusvalue(); +} + +WRITE8_MEMBER(apple2_state::apple2_c3xx_w ) +{ + int slotnum; + device_a2bus_card_interface *slotdevice; + + slotnum = 3; + slotdevice = m_a2bus->get_a2bus_card(slotnum); + + if (slotdevice != NULL) + { + if ((slotdevice->take_c800()) && (!space.debugger_access())) + { +// printf("c3xx_w: taking cnxx_slot to %d\n", slotnum); + m_a2_cnxx_slot = slotnum; + apple2_update_memory(); + } + slotdevice->write_cnxx(space, offset&0xff, data); + } + else + { + if (m_slot_ram) + m_slot_ram[offset] = data; + } +} + +READ8_MEMBER(apple2_state::apple2_c4xx_r ) +{ + int slotnum; + device_a2bus_card_interface *slotdevice; + + slotnum = ((offset>>8) & 0xf) + 4; + slotdevice = m_a2bus->get_a2bus_card(slotnum); + + // is a card installed in this slot? + if (slotdevice != NULL) + { + if (slotdevice->take_c800() && (m_a2_cnxx_slot != slotnum) && (!space.debugger_access())) + { + m_a2_cnxx_slot = slotnum; + apple2_update_memory(); + } + return slotdevice->read_cnxx(space, offset&0xff); + } + else + { + return apple2_slotram_r(space, slotnum, offset); + } + + // else fall through to floating bus + // never executed + //return apple2_getfloatingbusvalue(); +} + +WRITE8_MEMBER ( apple2_state::apple2_c4xx_w ) +{ + int slotnum; + device_a2bus_card_interface *slotdevice; + + slotnum = ((offset>>8) & 0xf) + 4; + slotdevice = m_a2bus->get_a2bus_card(slotnum); + + if (slotdevice != NULL) + { + if ((slotdevice->take_c800()) && (!space.debugger_access())) + { +// printf("c4xx_w: taking cnxx_slot to %d\n", slotnum); + m_a2_cnxx_slot = slotnum; + apple2_update_memory(); + } + slotdevice->write_cnxx(space, offset&0xff, data); + } + else + { + if (m_slot_ram) + m_slot_ram[offset] = data; + } +} + +READ8_MEMBER(apple2_state::apple2_cfff_r) +{ + // debugger guard + if (!space.debugger_access()) + { +// printf("cfff_r: taking cnxx_slot to -1\n"); + m_a2_cnxx_slot = -1; + apple2_update_memory(); + } + + return apple2_getfloatingbusvalue(); +} + +WRITE8_MEMBER(apple2_state::apple2_cfff_w) +{ + if (!space.debugger_access()) + { +// printf("cfff_w: taking cnxx_slot to -1\n"); + m_a2_cnxx_slot = -1; + apple2_update_memory(); + } +} + +READ8_MEMBER(apple2_state::apple2_c800_r ) +{ + device_a2bus_card_interface *slotdevice; + + slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); + + if (slotdevice != NULL) + { + return slotdevice->read_c800(space, offset&0xfff); + } + + return apple2_getfloatingbusvalue(); +} + +WRITE8_MEMBER(apple2_state::apple2_c800_w ) +{ + device_a2bus_card_interface *slotdevice; + + slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); + + if (slotdevice != NULL) + { + slotdevice->write_c800(space, offset&0xfff, data); + } +} + +READ8_MEMBER(apple2_state::apple2_ce00_r ) +{ + device_a2bus_card_interface *slotdevice; + + slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); + + if (slotdevice != NULL) + { + return slotdevice->read_c800(space, (offset&0xfff) + 0x600); + } + + return apple2_getfloatingbusvalue(); +} + +WRITE8_MEMBER(apple2_state::apple2_ce00_w ) +{ + device_a2bus_card_interface *slotdevice; + + slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); + + if (slotdevice != NULL) + { + slotdevice->write_c800(space, (offset&0xfff)+0x600, data); + } +} + +READ8_MEMBER(apple2_state::apple2_inh_d000_r ) +{ + device_a2bus_card_interface *slotdevice; + + slotdevice = m_a2bus->get_a2bus_card(m_inh_slot); + + if (slotdevice != NULL) + { + return slotdevice->read_inh_rom(space, offset & 0xfff); + } + + return apple2_getfloatingbusvalue(); +} + +WRITE8_MEMBER(apple2_state::apple2_inh_d000_w ) +{ + device_a2bus_card_interface *slotdevice; + + slotdevice = m_a2bus->get_a2bus_card(m_inh_slot); + + if (slotdevice != NULL) + { + return slotdevice->write_inh_rom(space, offset & 0xfff, data); + } +} + +READ8_MEMBER(apple2_state::apple2_inh_e000_r ) +{ + device_a2bus_card_interface *slotdevice; + + slotdevice = m_a2bus->get_a2bus_card(m_inh_slot); + + if (slotdevice != NULL) + { + return slotdevice->read_inh_rom(space, (offset & 0x1fff) + 0x1000); + } + + return apple2_getfloatingbusvalue(); +} + +WRITE8_MEMBER(apple2_state::apple2_inh_e000_w ) +{ + device_a2bus_card_interface *slotdevice; + + slotdevice = m_a2bus->get_a2bus_card(m_inh_slot); + + if (slotdevice != NULL) + { + slotdevice->write_inh_rom(space, (offset & 0x1fff) + 0x1000, data); + } +} + +static void apple2_mem_0000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + meminfo->read_handler = (state->m_flags & VAR_ALTZP) ? &state->read_delegates_0000[0] : &state->read_delegates_0000[1]; + meminfo->write_handler = (state->m_flags & VAR_ALTZP) ? &state->write_delegates_0000[0] : &state->write_delegates_0000[1]; +} + +static void apple2_mem_0200(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_0200[0] : &state->read_delegates_0200[1]; + meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_0200[0] : &state->write_delegates_0200[1]; +} + +static void apple2_mem_0400(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + + if (state->m_flags & VAR_80STORE) + { + meminfo->read_handler = (state->m_flags & VAR_PAGE2) ? &state->read_delegates_0400[0] : &state->read_delegates_0400[1]; + meminfo->write_handler = (state->m_flags & VAR_PAGE2) ? &state->write_delegates_0400[0] : &state->write_delegates_0400[1]; + } + else + { + meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_0400[0] : &state->read_delegates_0400[1]; + meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_0400[0] : &state->write_delegates_0400[1]; + } +} + +static void apple2_mem_0800(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_0800[0] : &state->read_delegates_0800[1]; + meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_0800[0] : &state->write_delegates_0800[1]; +} + +static void apple2_mem_2000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + if ((state->m_flags & (VAR_80STORE|VAR_HIRES)) == (VAR_80STORE|VAR_HIRES)) + { + meminfo->read_handler = (state->m_flags & VAR_PAGE2) ? &state->read_delegates_2000[0] : &state->read_delegates_2000[1]; + meminfo->write_handler = (state->m_flags & VAR_PAGE2) ? &state->write_delegates_2000[0] : &state->write_delegates_2000[1]; + } + else + { + meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_2000[0] : &state->read_delegates_2000[1]; + meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_2000[0] : &state->write_delegates_2000[1]; + } +} + +static void apple2_mem_4000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_4000[0] : &state->read_delegates_4000[1]; + meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_4000[0] : &state->write_delegates_4000[1]; +} + +static void apple2_mem_C000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + meminfo->read_handler = &state->rd_c000; + meminfo->write_handler = &state->wd_c000; +} + +static void apple2_mem_C080(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + + meminfo->read_handler = &state->rd_c080; + meminfo->write_handler = &state->wd_c080; +} + +static void tk2000_mem_C100(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + + if (state->m_flags & VAR_TK2000RAM) + { + meminfo->read_mem = 0x00C100; + meminfo->write_mem = 0x00C100; + } + else + { + meminfo->read_mem = (begin & 0x3fff) | APPLE2_MEM_ROM; + meminfo->write_mem = 0x00C100; + } +} + +static void apple2_mem_CFFF(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + + meminfo->read_handler = &state->rd_cfff; + meminfo->write_handler = &state->wd_cfff; +} + +static void apple2_mem_Cx00(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + if (state->m_flags & VAR_INTCXROM) + { + meminfo->read_mem = (begin & 0x0FFF) | (state->m_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM; + meminfo->write_mem = APPLE2_MEM_FLOATING; + } + else + { + meminfo->read_mem = ((begin & 0x0FFF) - 0x100) | APPLE2_MEM_SLOT; + meminfo->write_mem = ((begin & 0x0FFF) - 0x100) | APPLE2_MEM_SLOT; + } +} + +static void apple2_mem_C300(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + + if (((state->m_flags & (VAR_INTCXROM|VAR_SLOTC3ROM)) != VAR_SLOTC3ROM) && !(state->m_flags_mask & VAR_SLOTC3ROM)) + { + meminfo->read_mem = (begin & 0x0FFF) | (state->m_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM; + meminfo->write_mem = APPLE2_MEM_FLOATING; + } + else + { + meminfo->read_mem = ((begin & 0x0FFF) - 0x100) | APPLE2_MEM_SLOT; + meminfo->write_mem = ((begin & 0x0FFF) - 0x100) | APPLE2_MEM_SLOT; + } +} + +static void apple2_mem_C800(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + if ((state->m_flags & VAR_INTCXROM) || (state->m_a2_cnxx_slot == -1)) + { + meminfo->read_mem = (begin & 0x0FFF) | (state->m_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM; + meminfo->write_mem = APPLE2_MEM_FLOATING; + } + else + { + meminfo->read_handler = &state->rd_c800; + meminfo->write_handler = &state->wd_c800; + } +} + +static void apple2_mem_CE00(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + if ((state->m_flags & VAR_ROMSWITCH) && !strcmp(machine.system().name, "apple2cp")) + { + meminfo->read_mem = APPLE2_MEM_AUX; + meminfo->write_mem = APPLE2_MEM_AUX; + } + else + { + if ((state->m_flags & VAR_INTCXROM) || (state->m_a2_cnxx_slot == -1)) + { + meminfo->read_mem = (begin & 0x0FFF) | (state->m_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM; + meminfo->write_mem = APPLE2_MEM_FLOATING; + } + else + { + meminfo->read_handler = &state->rd_ce00; + meminfo->write_handler = &state->wd_ce00; + } + } +} + +static void apple2_mem_D000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + + if (state->m_inh_slot == -1) + { + if (state->m_flags & VAR_LCRAM) + { + if (state->m_flags & VAR_LCRAM2) + { + meminfo->read_handler = (state->m_flags & VAR_ALTZP) ? &state->read_delegates_c000[0] : &state->read_delegates_c000[1]; + } + else + { + meminfo->read_handler = (state->m_flags & VAR_ALTZP) ? &state->read_delegates_d000[0] : &state->read_delegates_d000[1]; + } + } + else + { + meminfo->read_mem = (state->m_flags & VAR_ROMSWITCH) ? 0x005000 : 0x001000; + meminfo->read_mem |= APPLE2_MEM_ROM; + } + + if (state->m_flags & VAR_LCWRITE) + { + if (state->m_flags & VAR_LCRAM2) + { + meminfo->write_handler = (state->m_flags & VAR_ALTZP) ? &state->write_delegates_c000[0] : &state->write_delegates_c000[1]; + } + else + { + meminfo->write_handler = (state->m_flags & VAR_ALTZP) ? &state->write_delegates_d000[0] : &state->write_delegates_d000[1]; + } + } + else + { + meminfo->write_mem = APPLE2_MEM_FLOATING; + } + } + else + { + meminfo->read_handler = &state->rd_inh_d000; + meminfo->write_handler = &state->wd_inh_d000; + } +} + +static void apple2_mem_E000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2_state *state = machine.driver_data(); + + if (state->m_inh_slot == -1) + { + if (state->m_flags & VAR_LCRAM) + { + meminfo->read_handler = (state->m_flags & VAR_ALTZP) ? &state->read_delegates_e000[0] : &state->read_delegates_e000[1]; + } + else + { + meminfo->read_mem = (state->m_flags & VAR_ROMSWITCH) ? 0x006000 : 0x002000; + meminfo->read_mem |= APPLE2_MEM_ROM; + } + + if (state->m_flags & VAR_LCWRITE) + { + meminfo->write_handler = (state->m_flags & VAR_ALTZP) ? &state->write_delegates_e000[0] : &state->write_delegates_e000[1]; + } + else + { + meminfo->write_mem = APPLE2_MEM_FLOATING; + } + } + else + { + meminfo->read_handler = &state->rd_inh_e000; + meminfo->write_handler = &state->wd_inh_e000; + } +} + + + +static const apple2_memmap_entry apple2_memmap_entries[] = +{ + { 0x0000, 0x01FF, apple2_mem_0000, A2MEM_MONO }, + { 0x0200, 0x03FF, apple2_mem_0200, A2MEM_DUAL }, + { 0x0400, 0x07FF, apple2_mem_0400, A2MEM_DUAL }, + { 0x0800, 0x1FFF, apple2_mem_0800, A2MEM_DUAL }, + { 0x2000, 0x3FFF, apple2_mem_2000, A2MEM_DUAL }, + { 0x4000, 0xBFFF, apple2_mem_4000, A2MEM_DUAL }, + { 0xC000, 0xC07F, apple2_mem_C000, A2MEM_IO }, + { 0xC080, 0xC0FF, apple2_mem_C080, A2MEM_IO }, + { 0xC100, 0xC2FF, apple2_mem_Cx00, A2MEM_MONO }, + { 0xC300, 0xC3FF, apple2_mem_C300, A2MEM_MONO }, + { 0xC400, 0xC7FF, apple2_mem_Cx00, A2MEM_MONO }, + { 0xC800, 0xCDFF, apple2_mem_C800, A2MEM_MONO }, + { 0xCE00, 0xCFFE, apple2_mem_CE00, A2MEM_MONO }, + { 0xCFFF, 0xCFFF, apple2_mem_CFFF, A2MEM_IO }, + { 0xD000, 0xDFFF, apple2_mem_D000, A2MEM_DUAL }, + { 0xE000, 0xFFFF, apple2_mem_E000, A2MEM_DUAL }, + { 0 } +}; + + +static const apple2_memmap_entry tk2000_memmap_entries[] = +{ + { 0x0000, 0x01FF, apple2_mem_0000, A2MEM_MONO }, + { 0x0200, 0x03FF, apple2_mem_0200, A2MEM_DUAL }, + { 0x0400, 0x07FF, apple2_mem_0400, A2MEM_DUAL }, + { 0x0800, 0x1FFF, apple2_mem_0800, A2MEM_DUAL }, + { 0x2000, 0x3FFF, apple2_mem_2000, A2MEM_DUAL }, + { 0x4000, 0xBFFF, apple2_mem_4000, A2MEM_DUAL }, + { 0xC000, 0xC07F, apple2_mem_C000, A2MEM_IO }, + { 0xC080, 0xC0FF, apple2_mem_C080, A2MEM_IO }, + { 0xC100, 0xFFFF, tk2000_mem_C100, A2MEM_DUAL }, + { 0 } +}; + +void apple2_state::apple2_setvar(UINT32 val, UINT32 mask) +{ + LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, + (unsigned int) m_maincpu->pc())); + + assert((val & mask) == val); + + /* apply mask and set */ + val &= m_a2_mask; + val |= m_a2_set; + + /* change the softswitch */ + m_flags &= ~mask; + m_flags |= val; + + // disable flags that don't apply (INTCXROM/SLOTC3ROM on II/II+ for instance) + m_flags &= ~m_flags_mask; + + apple2_update_memory(); +} + + + +/* ----------------------------------------------------------------------- + * Floating bus code + * + * preliminary floating bus video scanner code - look for comments + * with FIX: + * ----------------------------------------------------------------------- */ + +UINT8 apple2_state::apple2_getfloatingbusvalue() +{ + enum + { + // scanner types + kScannerNone = 0, kScannerApple2, kScannerApple2e, + + // scanner constants + kHBurstClock = 53, // clock when Color Burst starts + kHBurstClocks = 4, // clocks per Color Burst duration + kHClock0State = 0x18, // H[543210] = 011000 + kHClocks = 65, // clocks per horizontal scan (including HBL) + kHPEClock = 40, // clock when HPE (horizontal preset enable) goes low + kHPresetClock = 41, // clock when H state presets + kHSyncClock = 49, // clock when HSync starts + kHSyncClocks = 4, // clocks per HSync duration + kNTSCScanLines = 262, // total scan lines including VBL (NTSC) + kNTSCVSyncLine = 224, // line when VSync starts (NTSC) + kPALScanLines = 312, // total scan lines including VBL (PAL) + kPALVSyncLine = 264, // line when VSync starts (PAL) + kVLine0State = 0x100, // V[543210CBA] = 100000000 + kVPresetLine = 256, // line when V state presets + kVSyncLines = 4, // lines per VSync duration + kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? + }; + + // vars + // + int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ + h_clock, h_state, h_0, h_1, h_2, h_3, h_4, h_5, + v_line, v_state, v_A, v_B, v_C, v_0, v_1, v_2, v_3, v_4, /* v_5, */ + _hires, addend0, addend1, addend2, sum, address; + + // video scanner data + // + i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync + + // machine state switches + // + Hires = (m_flags & VAR_HIRES) ? 1 : 0; + Mixed = (m_flags & VAR_MIXED) ? 1 : 0; + Page2 = (m_flags & VAR_PAGE2) ? 1 : 0; + _80Store = (m_flags & VAR_80STORE) ? 1 : 0; + + // calculate video parameters according to display standard + // + ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? + // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? + // ScanCycles = ScanLines * kHClocks; + + // calculate horizontal scanning state + // + h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock + h_state = kHClock0State + h_clock; // H state bits + if (h_clock >= kHPresetClock) // check for horizontal preset + { + h_state -= 1; // correct for state preset (two 0 states) + } + h_0 = (h_state >> 0) & 1; // get horizontal state bits + h_1 = (h_state >> 1) & 1; + h_2 = (h_state >> 2) & 1; + h_3 = (h_state >> 3) & 1; + h_4 = (h_state >> 4) & 1; + h_5 = (h_state >> 5) & 1; + + // calculate vertical scanning state + // + v_line = i / kHClocks; // which vertical scanning line + v_state = kVLine0State + v_line; // V state bits + if ((v_line >= kVPresetLine)) // check for previous vertical state preset + { + v_state -= ScanLines; // compensate for preset + } + v_A = (v_state >> 0) & 1; // get vertical state bits + v_B = (v_state >> 1) & 1; + v_C = (v_state >> 2) & 1; + v_0 = (v_state >> 3) & 1; + v_1 = (v_state >> 4) & 1; + v_2 = (v_state >> 5) & 1; + v_3 = (v_state >> 6) & 1; + v_4 = (v_state >> 7) & 1; + //v_5 = (v_state >> 8) & 1; + + // calculate scanning memory address + // + _hires = Hires; + if (Hires && Mixed && (v_4 & v_2)) + { + _hires = 0; // (address is in text memory) + } + + addend0 = 0x68; // 1 1 0 1 + addend1 = (h_5 << 5) | (h_4 << 4) | (h_3 << 3); + addend2 = (v_4 << 6) | (v_3 << 5) | (v_4 << 4) | (v_3 << 3); + sum = (addend0 + addend1 + addend2) & (0x0F << 3); + + address = 0; + address |= h_0 << 0; // a0 + address |= h_1 << 1; // a1 + address |= h_2 << 2; // a2 + address |= sum; // a3 - aa6 + address |= v_0 << 7; // a7 + address |= v_1 << 8; // a8 + address |= v_2 << 9; // a9 + address |= ((_hires) ? v_A : (1 ^ (Page2 & (1 ^ _80Store)))) << 10; // a10 + address |= ((_hires) ? v_B : (Page2 & (1 ^ _80Store))) << 11; // a11 + if (_hires) // hires? + { + // Y: insert hires only address bits + // + address |= v_C << 12; // a12 + address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 + address |= (Page2 & (1 ^ _80Store)) << 14; // a14 + } + else + { + // N: text, so no higher address bits unless Apple ][, not Apple //e + // + if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) + (kHPEClock <= h_clock) && // Y: HBL? + (h_clock <= (kHClocks - 1))) + { + address |= 1 << 12; // Y: a12 (add $1000 to address!) + } + } + + // update VBL' state + // + if (v_4 & v_3) // VBL? + { + //CMemory::mState &= ~CMemory::kVBLBar; // Y: VBL' is false // FIX: MESS? + } + else + { + //CMemory::mState |= CMemory::kVBLBar; // N: VBL' is true // FIX: MESS? + } + + return m_ram->pointer()[address % m_ram->size()]; // FIX: this seems to work, but is it right!? +} + + + +/* ----------------------------------------------------------------------- + * Machine reset + * ----------------------------------------------------------------------- */ + +void apple2_state::machine_reset() +{ + int need_intcxrom; + + m_reset_flag = 0; + m_rambase = m_ram->pointer(); + apple2_refresh_delegates(); + + need_intcxrom = !strcmp(machine().system().name, "apple2c") + || !strcmp(machine().system().name, "apple2c0") + || !strcmp(machine().system().name, "apple2c3") + || !strcmp(machine().system().name, "apple2c4") + || !strcmp(machine().system().name, "prav8c") + || !strcmp(machine().system().name, "apple2cp") + || !strncmp(machine().system().name, "apple2g", 7); + apple2_setvar(need_intcxrom ? VAR_INTCXROM : 0, ~0); + + // IIgs ROM 0 cannot boot unless language card bank 2 is write-enabled (but read ROM) on startup + // Peter Ferrie reports this is also the default on the IIe/IIc at least + apple2_setvar(VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2); + + m_a2_speaker_state = 0; + + m_a2_cnxx_slot = -1; // bank in ROM at C800 on reset + + m_joystick_x1_time = m_joystick_y1_time = 0; + m_joystick_x2_time = m_joystick_y2_time = 0; + + memset(m_exp_regs, 0, sizeof(UINT8) * 0x10); + m_exp_wptr = m_exp_liveptr = 0; + +} + +int apple2_state::a2_no_ctrl_reset() +{ + return (((m_kbrepeat != NULL) && (m_resetdip == NULL)) || + ((m_resetdip != NULL) && !m_resetdip->read())); +} + +/* ----------------------------------------------------------------------- + * Apple II interrupt; used to force partial updates + * ----------------------------------------------------------------------- */ + +TIMER_DEVICE_CALLBACK_MEMBER(apple2_state::apple2_interrupt) +{ + int scanline = param; + + if((scanline % 8) == 0) + machine().first_screen()->update_partial(machine().first_screen()->vpos()); + if ((m_kbspecial->read() & 0x80) && + (a2_no_ctrl_reset() || (m_kbspecial->read() & 0x08))) + { + if (!m_reset_flag) + { + m_reset_flag = 1; + /* using PULSE_LINE does not allow us to press and hold key */ + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + } + return; + } + + if (m_reset_flag) + { + m_reset_flag = 0; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + machine().schedule_soft_reset(); + } +} + + + +/*************************************************************************** + apple2_mainramxx00_r + apple2_mainramxx00_w + apple2_auxramxx00_r + apple2_auxramxx00_w +***************************************************************************/ + +READ8_MEMBER ( apple2_state::apple2_mainram0000_r ) +{ + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_mainram0200_r ) +{ + offset += 0x200; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_mainram0400_r ) +{ + offset += 0x400; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_mainram0800_r ) +{ + offset += 0x800; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_mainram2000_r ) +{ + offset += 0x2000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_mainram4000_r ) +{ + offset += 0x4000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_mainramc000_r ) +{ + offset += 0xc000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_mainramd000_r ) +{ + offset += 0xd000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_mainrame000_r ) +{ + offset += 0xe000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxram0000_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x10000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxram0200_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset+0x200); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x10200; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxram0400_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset+0x400); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x10400; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxram0800_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset+0x800); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x10800; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxram2000_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset+0x2000); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x12000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxram4000_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset+0x4000); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x14000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxramc000_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset+0xc000); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x1c000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxramd000_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset+0xd000); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x1d000; + return m_rambase[offset]; +} + +READ8_MEMBER ( apple2_state::apple2_auxrame000_r ) +{ + if (m_auxslotdevice) + { + return m_auxslotdevice->read_auxram(offset+0xe000); + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return 0xff; + } + + offset += 0x1e000; + return m_rambase[offset]; +} + + +WRITE8_MEMBER ( apple2_state::apple2_mainram0000_w ) +{ + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_mainram0200_w ) +{ + offset += 0x200; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_mainram0400_w ) +{ + offset += 0x400; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_mainram0800_w ) +{ + offset += 0x800; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_mainram2000_w ) +{ + offset += 0x2000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_mainram4000_w ) +{ + offset += 0x4000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_mainramc000_w ) +{ + offset += 0xc000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_mainramd000_w ) +{ + offset += 0xd000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_mainrame000_w ) +{ + offset += 0xe000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxram0000_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x10000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxram0200_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset+0x200, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x10200; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxram0400_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset+0x400, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x10400; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxram0800_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset+0x800, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x10800; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxram2000_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset+0x2000, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x12000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxram4000_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset+0x4000, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x14000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxramc000_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset+0xc000, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x1c000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxramd000_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset+0xd000, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x1d000; + m_rambase[offset] = data; +} + +WRITE8_MEMBER ( apple2_state::apple2_auxrame000_w ) +{ + if (m_auxslotdevice) + { + m_auxslotdevice->write_auxram(offset+0xe000, data); + return; + } + else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + return; + } + + offset += 0x1e000; + m_rambase[offset] = data; +} + +/*************************************************************************** + apple2_c00x_r +***************************************************************************/ + +READ8_MEMBER ( apple2_state::apple2_c00x_r ) +{ + UINT8 result = 0; + + if(!space.debugger_access()) + { + /* Read the keyboard data and strobe */ + g_profiler.start(PROFILER_C00X); + result = m_transchar | m_strobe; + g_profiler.stop(); + } + + + + return result; +} + + + +/*************************************************************************** + apple2_c00x_w + + C000 80STOREOFF + C001 80STOREON - use 80-column memory mapping + C002 RAMRDOFF + C003 RAMRDON - read from aux 48k + C004 RAMWRTOFF + C005 RAMWRTON - write to aux 48k + C006 INTCXROMOFF + C007 INTCXROMON + C008 ALTZPOFF + C009 ALTZPON - use aux ZP, stack and language card area + C00A SLOTC3ROMOFF + C00B SLOTC3ROMON - use external slot 3 ROM + C00C 80COLOFF + C00D 80COLON - use 80-column display mode + C00E ALTCHARSETOFF + C00F ALTCHARSETON - use alt character set +***************************************************************************/ + +WRITE8_MEMBER ( apple2_state::apple2_c00x_w ) +{ + UINT32 mask; + + mask = 1 << (offset / 2); + apple2_setvar((offset & 1) ? mask : 0, mask); +} + + + +/*************************************************************************** + apple2_c01x_r +***************************************************************************/ + +READ8_MEMBER( apple2_state::apple2_c01x_r ) +{ + UINT8 result = apple2_getfloatingbusvalue() & 0x7F; + + if(!space.debugger_access()) + { + g_profiler.start(PROFILER_C01X); + + LOG(("a2 softswitch_r: %04x\n", offset + 0xc010)); + switch (offset) + { + case 0x00: result |= m_transchar | m_strobe; m_strobe = 0; break; + case 0x01: result |= (m_flags & VAR_LCRAM2) ? 0x80 : 0x00; break; + case 0x02: result |= (m_flags & VAR_LCRAM) ? 0x80 : 0x00; break; + case 0x03: result |= (m_flags & VAR_RAMRD) ? 0x80 : 0x00; break; + case 0x04: result |= (m_flags & VAR_RAMWRT) ? 0x80 : 0x00; break; + case 0x05: result |= (m_flags & VAR_INTCXROM) ? 0x80 : 0x00; break; + case 0x06: result |= (m_flags & VAR_ALTZP) ? 0x80 : 0x00; break; + case 0x07: result |= (m_flags & VAR_SLOTC3ROM) ? 0x80 : 0x00; break; + case 0x08: result |= (m_flags & VAR_80STORE) ? 0x80 : 0x00; break; + case 0x09: result |= !space.machine().first_screen()->vblank() ? 0x80 : 0x00; break; + case 0x0A: result |= (m_flags & VAR_TEXT) ? 0x80 : 0x00; break; + case 0x0B: result |= (m_flags & VAR_MIXED) ? 0x80 : 0x00; break; + case 0x0C: result |= (m_flags & VAR_PAGE2) ? 0x80 : 0x00; break; + case 0x0D: result |= (m_flags & VAR_HIRES) ? 0x80 : 0x00; break; + case 0x0E: result |= (m_flags & VAR_ALTCHARSET) ? 0x80 : 0x00; break; + case 0x0F: result |= (m_flags & VAR_80COL) ? 0x80 : 0x00; break; + } + + g_profiler.stop(); + } + + return result; +} + + + +/*************************************************************************** + apple2_c01x_w +***************************************************************************/ + +WRITE8_MEMBER( apple2_state::apple2_c01x_w ) +{ + /* Clear the keyboard strobe */ + g_profiler.start(PROFILER_C01X); + m_strobe = 0; + g_profiler.stop(); +} + + + +/*************************************************************************** + apple2_c02x_r +***************************************************************************/ + +READ8_MEMBER( apple2_state::apple2_c02x_r ) +{ + if(!space.debugger_access()) + { + apple2_c02x_w(space, offset, 0, 0); + } + return apple2_getfloatingbusvalue(); +} + + + +/*************************************************************************** + apple2_c02x_w +***************************************************************************/ + +WRITE8_MEMBER( apple2_state::apple2_c02x_w ) +{ + switch(offset) + { + case 0x08: + apple2_setvar((m_flags & VAR_ROMSWITCH) ^ VAR_ROMSWITCH, VAR_ROMSWITCH); + break; + } +} + + + +/*************************************************************************** + apple2_c03x_r +***************************************************************************/ + +READ8_MEMBER ( apple2_state::apple2_c03x_r ) +{ + if(!space.debugger_access()) + { + if (!offset) + { + speaker_sound_device *speaker = space.machine().device("a2speaker"); + + m_a2_speaker_state ^= 1; + speaker->level_w(m_a2_speaker_state); + } + } + return apple2_getfloatingbusvalue(); +} + + + +/*************************************************************************** + apple2_c03x_w +***************************************************************************/ + +WRITE8_MEMBER ( apple2_state::apple2_c03x_w ) +{ + apple2_c03x_r(space, offset, 0); +} + + + +/*************************************************************************** + apple2_c05x_r +***************************************************************************/ + +READ8_MEMBER ( apple2_state::apple2_c05x_r ) +{ + if(!space.debugger_access()) + { + UINT32 mask; + + if (m_machinetype == TK2000) + { + if (offset == 0xa) // RAM + { + apple2_setvar(VAR_TK2000RAM, ~0); + } + else if (offset == 0xb) // ROM + { + apple2_setvar(0, ~VAR_TK2000RAM); + } + } + + /* ANx has reverse SET logic */ + if (offset >= 8) + { + offset ^= 1; + } + + mask = 0x100 << (offset / 2); + apple2_setvar((offset & 1) ? mask : 0, mask); + } + return apple2_getfloatingbusvalue(); +} + + + +/*************************************************************************** + apple2_c05x_w +***************************************************************************/ + +WRITE8_MEMBER ( apple2_state::apple2_c05x_w ) +{ + apple2_c05x_r(space, offset, 0); +} + + + +/*************************************************************************** + apple2_c06x_r +***************************************************************************/ + +READ8_MEMBER ( apple2_state::apple2_c06x_r ) +{ + int result = 0; + if(!space.debugger_access()) + { + switch (offset & 0x0F) + { + case 0x00: + /* Cassette input */ + { + if (m_cassette) + { + result = m_cassette->input() > 0.0 ? 0x80 : 0; + } + else + { + result = 0; + } + } + break; + case 0x01: + /* Open-Apple/Joystick button 0 */ + result = apple2_pressed_specialkey(0x10); + break; + case 0x02: + /* Closed-Apple/Joystick button 1 */ + result = apple2_pressed_specialkey(0x20); + break; + case 0x03: + /* Joystick button 2. Later revision motherboards connected this to SHIFT also */ + result = apple2_pressed_specialkey(0x40); + break; + case 0x04: + /* X Joystick 1 axis */ + result = space.machine().time().as_double() < m_joystick_x1_time; + break; + case 0x05: + /* Y Joystick 1 axis */ + result = space.machine().time().as_double() < m_joystick_y1_time; + break; + case 0x06: + /* X Joystick 2 axis */ + result = space.machine().time().as_double() < m_joystick_x2_time; + break; + case 0x07: + /* Y Joystick 2 axis */ + result = space.machine().time().as_double() < m_joystick_y2_time; + break; + default: + /* c060 Empty Cassette head read + * and any other non joystick c06 port returns this according to applewin + */ + return apple2_getfloatingbusvalue(); + } + } + return result ? 0x80 : 0x00; +} + + + +/*************************************************************************** + apple2_c07x_r +***************************************************************************/ + +READ8_MEMBER ( apple2_state::apple2_c07x_r ) +{ + if(!space.debugger_access()) + { + double x_calibration = attotime::from_usec(12).as_double(); + double y_calibration = attotime::from_usec(13).as_double(); + + if (offset == 0) + { + m_joystick_x1_time = machine().time().as_double() + x_calibration * m_joy1x->read(); + m_joystick_y1_time = machine().time().as_double() + y_calibration * m_joy1y->read(); + m_joystick_x2_time = machine().time().as_double() + x_calibration * m_joy2x->read(); + m_joystick_y2_time = machine().time().as_double() + y_calibration * m_joy2y->read(); + } + } + return 0; +} + + + +/*************************************************************************** + apple2_c07x_w +***************************************************************************/ + +WRITE8_MEMBER ( apple2_state::apple2_c07x_w ) +{ + // this a machine with an aux slot? + if (m_auxslotdevice) + { + m_auxslotdevice->write_c07x(space, offset&0xf, data); + } + + // AE RamWorks manual indicates that even if the auxslot card sees the c07x write, + // so does the motherboard and it will trigger the paddles. So always call this. + apple2_c07x_r(space, offset, 0); +} + + + +/* ----------------------------------------------------------------------- + * Floppy disk controller + * ----------------------------------------------------------------------- */ + + +int apple2_state::apple2_fdc_has_35() +{ + return (floppy_get_count(machine())); // - apple525_get_count(machine)) > 0; +} + +int apple2_state::apple2_fdc_has_525() +{ + return 1; //apple525_get_count(machine) > 0; +} + +static void apple2_fdc_set_lines(device_t *device, UINT8 lines) +{ + apple2_state *state = device->machine().driver_data(); + if (state->m_fdc_diskreg & 0x40) + { + if (state->apple2_fdc_has_35()) + { + /* slot 5: 3.5" disks */ + sony_set_lines(device,lines); + } + } + else + { + if (state->apple2_fdc_has_525()) + { + /* slot 6: 5.25" disks */ + apple525_set_lines(device,lines); + } + } +} + + + +static void apple2_fdc_set_enable_lines(device_t *device,int enable_mask) +{ + apple2_state *state = device->machine().driver_data(); + int slot5_enable_mask = 0; + int slot6_enable_mask = 0; + + if (state->m_fdc_diskreg & 0x40) + slot5_enable_mask = enable_mask; + else + slot6_enable_mask = enable_mask; + + if (state->apple2_fdc_has_35()) + { + /* set the 3.5" enable lines */ + sony_set_enable_lines(device,slot5_enable_mask); + } + + if (state->apple2_fdc_has_525()) + { + /* set the 5.25" enable lines */ + apple525_set_enable_lines(device,slot6_enable_mask); + } +} + + + +static UINT8 apple2_fdc_read_data(device_t *device) +{ + apple2_state *state = device->machine().driver_data(); + UINT8 result = 0x00; + + if (state->m_fdc_diskreg & 0x40) + { + if (state->apple2_fdc_has_35()) + { + /* slot 5: 3.5" disks */ + result = sony_read_data(device); + } + } + else + { + if (state->apple2_fdc_has_525()) + { + /* slot 6: 5.25" disks */ + result = apple525_read_data(device); + } + } + return result; +} + + + +static void apple2_fdc_write_data(device_t *device, UINT8 data) +{ + apple2_state *state = device->machine().driver_data(); + if (state->m_fdc_diskreg & 0x40) + { + if (state->apple2_fdc_has_35()) + { + /* slot 5: 3.5" disks */ + sony_write_data(device,data); + } + } + else + { + if (state->apple2_fdc_has_525()) + { + /* slot 6: 5.25" disks */ + apple525_write_data(device,data); + } + } +} + + + +static int apple2_fdc_read_status(device_t *device) +{ + apple2_state *state = device->machine().driver_data(); + int result = 0; + + if (state->m_fdc_diskreg & 0x40) + { + if (state->apple2_fdc_has_35()) + { + /* slot 5: 3.5" disks */ + result = sony_read_status(device); + } + } + else + { + if (state->apple2_fdc_has_525()) + { + /* slot 6: 5.25" disks */ + result = apple525_read_status(device); + } + } + return result; +} + + +void apple2_state::apple2_iwm_setdiskreg(UINT8 data) +{ + m_fdc_diskreg = data & 0xC0; + if (apple2_fdc_has_35()) + sony_set_sel_line( machine().device("fdc"),m_fdc_diskreg & 0x80); +} + + +const applefdc_interface apple2_fdc_interface = +{ + apple2_fdc_set_lines, /* set_lines */ + apple2_fdc_set_enable_lines, /* set_enable_lines */ + + apple2_fdc_read_data, /* read_data */ + apple2_fdc_write_data, /* write_data */ + apple2_fdc_read_status /* read_status */ +}; + + + +/* ----------------------------------------------------------------------- + * Driver init + * ----------------------------------------------------------------------- */ + +void apple2_state::apple2_init_common() +{ + m_inh_slot = -1; + m_flags = 0; + m_fdc_diskreg = 0; + + // do these lookups once at startup + m_rom = memregion("maincpu")->base(); + m_rom_length = memregion("maincpu")->bytes() & ~0xFFF; + m_slot_length = memregion("maincpu")->bytes() - m_rom_length; + m_slot_ram = (m_slot_length > 0) ? &m_rom[m_rom_length] : NULL; + + m_auxslotdevice = NULL; + if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) + { + m_auxslotdevice = m_a2eauxslot->get_a2eauxslot_card(); + } + + /* state save registers */ + save_item(NAME(m_flags)); + machine().save().register_postload(save_prepost_delegate(FUNC(apple2_state::apple2_update_memory_postload), this)); + + /* --------------------------------------------- * + * set up the softswitch mask/set * + * --------------------------------------------- */ + m_a2_mask = ~0; + m_a2_set = 0; + + /* disable VAR_ROMSWITCH if the ROM is only 16k */ + if (memregion("maincpu")->bytes() < 0x8000) + m_a2_mask &= ~VAR_ROMSWITCH; + + if (m_ram->size() <= 64*1024) + m_a2_mask &= ~(VAR_RAMRD | VAR_RAMWRT | VAR_80STORE | VAR_ALTZP | VAR_80COL); + + apple2_refresh_delegates(); +} + +void apple2_state::apple2eplus_init_common(void *apple2cp_ce00_ram) +{ + apple2_memmap_config mem_cfg; + + m_flags_mask = 0; + + apple2_init_common(); + + /* setup memory */ + memset(&mem_cfg, 0, sizeof(mem_cfg)); + mem_cfg.first_bank = 1; + mem_cfg.memmap = apple2_memmap_entries; + mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; + apple2_setup_memory(&mem_cfg); +} + +MACHINE_START_MEMBER(apple2_state,apple2c) +{ + m_machinetype = APPLE_IIC; + + apple2eplus_init_common((void *)NULL); +} + +MACHINE_START_MEMBER(apple2_state,tk3000) +{ + m_machinetype = TK3000; // enhanced IIe clone with Z80 keyboard scanner subcpu + + apple2eplus_init_common((void *)NULL); +} + +MACHINE_START_MEMBER(apple2_state,apple2cp) +{ + void *apple2cp_ce00_ram; + + /* there appears to be some hidden RAM that is swapped in on the Apple + * IIc plus; I have not found any official documentation but the BIOS + * clearly uses this area as writeable memory */ + apple2cp_ce00_ram = auto_alloc_array(machine(), UINT8, 0x200); + memset(apple2cp_ce00_ram, 0, sizeof(UINT8) * 0x200); + + m_machinetype = APPLE_IICPLUS; + + apple2eplus_init_common(apple2cp_ce00_ram); +} + +MACHINE_START_MEMBER(apple2_state,apple2e) +{ + apple2_memmap_config mem_cfg; + + m_flags_mask = 0; + + m_machinetype = APPLE_IIE; + + apple2_init_common(); + + /* setup memory */ + memset(&mem_cfg, 0, sizeof(mem_cfg)); + mem_cfg.first_bank = 1; + mem_cfg.memmap = apple2_memmap_entries; + mem_cfg.auxmem = (UINT8*)NULL; + apple2_setup_memory(&mem_cfg); +} + +MACHINE_START_MEMBER(apple2_state,laser128) +{ + apple2_memmap_config mem_cfg; + + m_flags_mask = 0; + m_machinetype = LASER128; + + apple2_init_common(); + + // 1 MB of expansion RAM in slot 5 + m_exp_ram = auto_alloc_array(machine(), UINT8, 1024*1024); + memset(m_exp_ram, 0xff, 1024*1024); + + m_exp_bankhior = 0xf0; + m_exp_addrmask = 0xfffff; + + // save memory expansion vars + save_item(NAME(m_exp_regs)); + save_item(NAME(m_exp_wptr)); + save_item(NAME(m_exp_liveptr)); + save_item(NAME(m_exp_bankhior)); + save_item(NAME(m_exp_addrmask)); + + /* setup memory */ + memset(&mem_cfg, 0, sizeof(mem_cfg)); + mem_cfg.first_bank = 1; + mem_cfg.memmap = apple2_memmap_entries; + mem_cfg.auxmem = (UINT8*)NULL; + apple2_setup_memory(&mem_cfg); +} + +MACHINE_START_MEMBER(apple2_state,apple2orig) +{ + apple2_memmap_config mem_cfg; + void *apple2cp_ce00_ram = NULL; + + // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states + m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; + + m_machinetype = APPLE_II; + + apple2_init_common(); + + /* setup memory */ + memset(&mem_cfg, 0, sizeof(mem_cfg)); + mem_cfg.first_bank = 1; + mem_cfg.memmap = apple2_memmap_entries; + mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; + apple2_setup_memory(&mem_cfg); +} + +MACHINE_START_MEMBER(apple2_state,space84) +{ + apple2_memmap_config mem_cfg; + void *apple2cp_ce00_ram = NULL; + + // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states + m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; + + m_machinetype = SPACE84; + + apple2_init_common(); + + /* setup memory */ + memset(&mem_cfg, 0, sizeof(mem_cfg)); + mem_cfg.first_bank = 1; + mem_cfg.memmap = apple2_memmap_entries; + mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; + apple2_setup_memory(&mem_cfg); +} + +MACHINE_START_MEMBER(apple2_state,laba2p) +{ + apple2_memmap_config mem_cfg; + void *apple2cp_ce00_ram = NULL; + + // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states + m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; + + m_machinetype = LABA2P; + + apple2_init_common(); + + /* setup memory */ + memset(&mem_cfg, 0, sizeof(mem_cfg)); + mem_cfg.first_bank = 1; + mem_cfg.memmap = apple2_memmap_entries; + mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; + apple2_setup_memory(&mem_cfg); +} + +MACHINE_START_MEMBER(apple2_state,tk2000) +{ + apple2_memmap_config mem_cfg; + + // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states + m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; + + m_machinetype = TK2000; + + apple2_init_common(); + + /* setup memory */ + memset(&mem_cfg, 0, sizeof(mem_cfg)); + mem_cfg.first_bank = 1; + mem_cfg.memmap = tk2000_memmap_entries; + mem_cfg.auxmem = (UINT8*)NULL; + apple2_setup_memory(&mem_cfg); +} + +int apple2_state::apple2_pressed_specialkey(UINT8 key) +{ + return ((m_kbspecial ? m_kbspecial->read() : 0) & key) + || ((m_joybuttons ? m_joybuttons->read() : 0) & key); +} + +void apple2_state::apple2_refresh_delegates() +{ + read_delegates_master[0] = read8_delegate(FUNC(apple2_state::read_floatingbus), this); + read_delegates_master[1] = read8_delegate(FUNC(apple2_state::apple2_c1xx_r), this); + read_delegates_master[2] = read8_delegate(FUNC(apple2_state::apple2_c3xx_r), this); + read_delegates_master[3] = read8_delegate(FUNC(apple2_state::apple2_c4xx_r), this); + write_delegates_master[0] = write8_delegate(FUNC(apple2_state::apple2_c1xx_w), this); + write_delegates_master[1] = write8_delegate(FUNC(apple2_state::apple2_c3xx_w), this); + write_delegates_master[2] = write8_delegate(FUNC(apple2_state::apple2_c4xx_w), this); + + rd_c000 = read8_delegate(FUNC(apple2_state::apple2_c0xx_r), this); + wd_c000 = write8_delegate(FUNC(apple2_state::apple2_c0xx_w), this); + + rd_c080 = read8_delegate(FUNC(apple2_state::apple2_c080_r), this); + wd_c080 = write8_delegate(FUNC(apple2_state::apple2_c080_w), this); + + rd_cfff = read8_delegate(FUNC(apple2_state::apple2_cfff_r), this); + wd_cfff = write8_delegate(FUNC(apple2_state::apple2_cfff_w), this); + + rd_c800 = read8_delegate(FUNC(apple2_state::apple2_c800_r), this); + wd_c800 = write8_delegate(FUNC(apple2_state::apple2_c800_w), this); + + rd_ce00 = read8_delegate(FUNC(apple2_state::apple2_ce00_r), this); + wd_ce00 = write8_delegate(FUNC(apple2_state::apple2_ce00_w), this); + + rd_inh_d000 = read8_delegate(FUNC(apple2_state::apple2_inh_d000_r), this); + wd_inh_d000 = write8_delegate(FUNC(apple2_state::apple2_inh_d000_w), this); + + rd_inh_e000 = read8_delegate(FUNC(apple2_state::apple2_inh_e000_r), this); + wd_inh_e000 = write8_delegate(FUNC(apple2_state::apple2_inh_e000_w), this); + + read_delegates_0000[0] = read8_delegate(FUNC(apple2_state::apple2_auxram0000_r), this); + read_delegates_0000[1] = read8_delegate(FUNC(apple2_state::apple2_mainram0000_r), this); + read_delegates_0200[0] = read8_delegate(FUNC(apple2_state::apple2_auxram0200_r), this); + read_delegates_0200[1] = read8_delegate(FUNC(apple2_state::apple2_mainram0200_r), this); + read_delegates_0400[0] = read8_delegate(FUNC(apple2_state::apple2_auxram0400_r), this); + read_delegates_0400[1] = read8_delegate(FUNC(apple2_state::apple2_mainram0400_r), this); + read_delegates_0800[0] = read8_delegate(FUNC(apple2_state::apple2_auxram0800_r), this); + read_delegates_0800[1] = read8_delegate(FUNC(apple2_state::apple2_mainram0800_r), this); + read_delegates_2000[0] = read8_delegate(FUNC(apple2_state::apple2_auxram2000_r), this); + read_delegates_2000[1] = read8_delegate(FUNC(apple2_state::apple2_mainram2000_r), this); + read_delegates_4000[0] = read8_delegate(FUNC(apple2_state::apple2_auxram4000_r), this); + read_delegates_4000[1] = read8_delegate(FUNC(apple2_state::apple2_mainram4000_r), this); + read_delegates_c000[0] = read8_delegate(FUNC(apple2_state::apple2_auxramc000_r), this); + read_delegates_c000[1] = read8_delegate(FUNC(apple2_state::apple2_mainramc000_r), this); + read_delegates_d000[0] = read8_delegate(FUNC(apple2_state::apple2_auxramd000_r), this); + read_delegates_d000[1] = read8_delegate(FUNC(apple2_state::apple2_mainramd000_r), this); + read_delegates_e000[0] = read8_delegate(FUNC(apple2_state::apple2_auxrame000_r), this); + read_delegates_e000[1] = read8_delegate(FUNC(apple2_state::apple2_mainrame000_r), this); + + write_delegates_0000[0] = write8_delegate(FUNC(apple2_state::apple2_auxram0000_w), this); + write_delegates_0000[1] = write8_delegate(FUNC(apple2_state::apple2_mainram0000_w), this); + write_delegates_0200[0] = write8_delegate(FUNC(apple2_state::apple2_auxram0200_w), this); + write_delegates_0200[1] = write8_delegate(FUNC(apple2_state::apple2_mainram0200_w), this); + write_delegates_0400[0] = write8_delegate(FUNC(apple2_state::apple2_auxram0400_w), this); + write_delegates_0400[1] = write8_delegate(FUNC(apple2_state::apple2_mainram0400_w), this); + write_delegates_0800[0] = write8_delegate(FUNC(apple2_state::apple2_auxram0800_w), this); + write_delegates_0800[1] = write8_delegate(FUNC(apple2_state::apple2_mainram0800_w), this); + write_delegates_2000[0] = write8_delegate(FUNC(apple2_state::apple2_auxram2000_w), this); + write_delegates_2000[1] = write8_delegate(FUNC(apple2_state::apple2_mainram2000_w), this); + write_delegates_4000[0] = write8_delegate(FUNC(apple2_state::apple2_auxram4000_w), this); + write_delegates_4000[1] = write8_delegate(FUNC(apple2_state::apple2_mainram4000_w), this); + write_delegates_c000[0] = write8_delegate(FUNC(apple2_state::apple2_auxramc000_w), this); + write_delegates_c000[1] = write8_delegate(FUNC(apple2_state::apple2_mainramc000_w), this); + write_delegates_d000[0] = write8_delegate(FUNC(apple2_state::apple2_auxramd000_w), this); + write_delegates_d000[1] = write8_delegate(FUNC(apple2_state::apple2_mainramd000_w), this); + write_delegates_e000[0] = write8_delegate(FUNC(apple2_state::apple2_auxrame000_w), this); + write_delegates_e000[1] = write8_delegate(FUNC(apple2_state::apple2_mainrame000_w), this); +} + +READ_LINE_MEMBER(apple2_state::ay3600_shift_r) +{ + // either shift key + if (m_kbspecial->read() & 0x06) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +READ_LINE_MEMBER(apple2_state::ay3600_control_r) +{ + if (m_kbspecial->read() & 0x08) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +static const UINT8 a2_key_remap[0x32][4] = +{ +/* norm shft ctrl both */ + { 0x33,0x23,0x33,0x23 }, /* 3 # 00 */ + { 0x34,0x24,0x34,0x24 }, /* 4 $ 01 */ + { 0x35,0x25,0x35,0x25 }, /* 5 % 02 */ + { 0x36,0x5e,0x35,0x53 }, /* 6 ^ 03 */ + { 0x37,0x26,0x37,0x26 }, /* 7 & 04 */ + { 0x38,0x2a,0x38,0x2a }, /* 8 * 05 */ + { 0x39,0x28,0x39,0x28 }, /* 9 ( 06 */ + { 0x30,0x29,0x30,0x29 }, /* 0 ) 07 */ + { 0x3b,0x3a,0x3b,0x3a }, /* ; : 08 */ + { 0x2d,0x5f,0x2d,0x1f }, /* - _ 09 */ + { 0x51,0x51,0x11,0x11 }, /* q Q 0a */ + { 0x57,0x57,0x17,0x17 }, /* w W 0b */ + { 0x45,0x45,0x05,0x05 }, /* e E 0c */ + { 0x52,0x52,0x12,0x12 }, /* r R 0d */ + { 0x54,0x54,0x14,0x14 }, /* t T 0e */ + { 0x59,0x59,0x19,0x19 }, /* y Y 0f */ + { 0x55,0x55,0x15,0x15 }, /* u U 10 */ + { 0x49,0x49,0x09,0x09 }, /* i I 11 */ + { 0x4f,0x4f,0x0f,0x0f }, /* o O 12 */ + { 0x50,0x50,0x10,0x10 }, /* p P 13 */ + { 0x44,0x44,0x04,0x04 }, /* d D 14 */ + { 0x46,0x46,0x06,0x06 }, /* f F 15 */ + { 0x47,0x47,0x07,0x07 }, /* g G 16 */ + { 0x48,0x48,0x08,0x08 }, /* h H 17 */ + { 0x4a,0x4a,0x0a,0x0a }, /* j J 18 */ + { 0x4b,0x4b,0x0b,0x0b }, /* k K 19 */ + { 0x4c,0x4c,0x0c,0x0c }, /* l L 1a */ + { 0x3d,0x2b,0x3d,0x2b }, /* = + 1b */ + { 0x08,0x08,0x08,0x08 }, /* Left 1c */ + { 0x15,0x15,0x15,0x15 }, /* Right 1d */ + { 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */ + { 0x58,0x58,0x18,0x18 }, /* x X 1f */ + { 0x43,0x43,0x03,0x03 }, /* c C 20 */ + { 0x56,0x56,0x16,0x16 }, /* v V 21 */ + { 0x42,0x42,0x02,0x02 }, /* b B 22 */ + { 0x4e,0x4e,0x0e,0x0e }, /* n N 23 */ + { 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */ + { 0x2c,0x3c,0x2c,0x3c }, /* , < 25 */ + { 0x2e,0x3e,0x2e,0x3e }, /* . > 26 */ + { 0x2f,0x3f,0x2f,0x3f }, /* / ? 27 */ + { 0x53,0x53,0x13,0x13 }, /* s S 28 */ + { 0x32,0x40,0x32,0x00 }, /* 2 @ 29 */ + { 0x31,0x21,0x31,0x31 }, /* 1 ! 2a */ + { 0x9b,0x9b,0x9b,0x9b }, /* Escape 2b */ + { 0x41,0x41,0x01,0x01 }, /* a A 2c */ + { 0x20,0x20,0x20,0x20 }, /* Space 2d */ + { 0x00,0x00,0x00,0x00 }, /* 0x2e unused */ + { 0x00,0x00,0x00,0x00 }, /* 0x2f unused */ + { 0x00,0x00,0x00,0x00 }, /* 0x30 unused */ + { 0x0d,0x0d,0x0d,0x0d }, /* Enter 31 */ +}; + +WRITE_LINE_MEMBER(apple2_state::ay3600_data_ready_w) +{ + if (state == ASSERT_LINE) + { + int mod = 0; + m_lastchar = m_ay3600->b_r(); + + mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; + mod |= (m_kbspecial->read() & 0x08) ? 0x02 : 0x00; + + m_transchar = a2_key_remap[m_lastchar&0x3f][mod]; + + if (m_transchar != 0) + { + m_strobe = 0x80; +// printf("new char = %04x (%02x)\n", m_lastchar&0x3f, m_transchar); + } + } +} + +WRITE_LINE_MEMBER(apple2_state::ay3600_iie_data_ready_w) +{ + if (state == ASSERT_LINE) + { + UINT8 *decode = m_kbdrom->base(); + UINT16 trans; + + m_lastchar = m_ay3600->b_r(); + + trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff + trans |= (m_lastchar & 0x100)>>2; // bring the 0x100 bit down to the 0x40 place + trans <<= 2; // 4 entries per key + trans |= (m_kbspecial->read() & 0x06) ? 0x00 : 0x01; // shift is bit 1 (active low) + trans |= (m_kbspecial->read() & 0x08) ? 0x00 : 0x02; // control is bit 2 (active low) + trans |= (m_kbspecial->read() & 0x01) ? 0x0000 : 0x0200; // caps lock is bit 9 (active low) + + m_transchar = decode[trans]; + m_strobe = 0x80; + +// printf("new char = %04x (%02x)\n", m_lastchar, m_transchar); + } +} diff --git a/src/mame/machine/apple2gs.c b/src/mame/machine/apple2gs.c new file mode 100644 index 00000000000..4f7f64f0f7c --- /dev/null +++ b/src/mame/machine/apple2gs.c @@ -0,0 +1,2236 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,R. Belmont +/********************************************************************* + + apple2gs.c + + Apple IIgs code + + + Apple IIgs specific softswitches: + + C019 - RDVBLBAR + bits 7 - set during vblank (when at scanline 192 or higher) + + C022 - TBCOLOR + bits 7-4 - text foreground color + bits 3-0 - text background color + + C023 - VGCINT + bit 7 - set for interrupt generated by VGC + + bit 6 - set during one second interrupt + bit 5 - set during scanline interrupt + + bit 4 - set during external interrupt + bit 3 - ??? + bit 2 - set for interrupt every second + + bit 1 - set for scanline interrupt + bit 0 - set for external interrupt + + C025 - KEYMODREG (comes from ?) + bit 7 - option key pressed + bit 6 - command key presssed + bit 5 - modified latch + bit 4 - keypad key pressed + bit 3 - repeating + bit 2 - caps lock latched + bit 1 - control key pressed + bit 0 - shift key pressed + + C027 - KMSTATUS (GLU system status) + bit 7 - set if mouse register full + bit 6 - mouse interupt enable flag + bit 5 - set if data register full + bit 4 - data interrupt enabled + bit 3 - set if key data full + bit 2 - key data interurpt enabled + bit 1 - clear if horizontal mouse data, set if vertical + bit 0 - command register full + + C029 - NEWVIDEO + bit 7 - 1 for Super Hi-Res mode, 0 for old Apple II video modes + bit 6 - 1 to enable memory linearization (2000-9D00 in banks 01/E1), 0 for physical layout + bit 5 - 1 to display double hi-res mode in monochrome, 0 for color + bit 4 - ??? + bit 3 - ??? + bit 2 - ??? + bit 1 - ??? + bit 0 - ??? + + C02D - SLTROMSEL + + C031 - DISKREG + bit 7 - set to select head on 3.5" drive + bit 6 - set to enable 3.5" drive, clear to enable 5.25" drive + + C035 - SHADOW + bit 7 - ??? + bit 6 - set to inhibit I/O and LC operations ($C000-$FFFF) + bit 5 - ??? + bit 4 - set to inhibit shadowing aux hires page + bit 3 - set to inhibit shadowing super hires video + bit 2 - set to inhibit shadowing hires page 2 + bit 1 - set to inhibit shadowing hires page 2 + bit 0 - set to inhibit shadowing text pages + + C036 - CYAREG + bit 7 - clear for slow speed, set for hi speed + bit 6 - ??? + bit 5 - ??? + bit 4 - shadow in all RAM banks + bit 3 - slot 7 motor on + bit 2 - slot 6 motor on + bit 1 - slot 5 motor on + bit 0 - slot 4 motor on + + C041 - INTEN + bit 4 - set to enable quarter second interrupts + bit 3 - set to enable VBL interrupts + bit 2 - set to enable Mega II mouse switch interrupts + bit 1 - set to enable Mega II mouse movement interrupts + bit 0 - set to enable Mega II mouse mouse operation + + C046 - DIAGTYPE/INTFLAG + bit 7 - set if mouse button currently down + bit 6 - set if mouse button down on last read + bit 5 - set for AN3 + bit 4 - set if currently in quarter second interrupt + bit 3 - set if currently in VBL interrupt + bit 2 - set if currently in Mega II mouse switch interrupt + bit 1 - set if currently in Mega II mouse movement interrupt + bit 0 - set if system IRQ line asserted + + C047 - CLRVBLINT + + C068 - STATEREG + bit 7 - ALTZP status + bit 6 - PAGE2 status + bit 5 - RAMRD status + bit 4 - RAMWRT status + bit 3 - !LCRAM status (inverted) + bit 2 - LCRAM2 status + bit 1 - ROMBANK status (unimplemented) + bit 0 - INTCXROM status + +*********************************************************************/ + +#include "emu.h" + +#include "includes/apple2gs.h" +#include "includes/apple2.h" +#include "machine/applefdc.h" +#include "machine/sonydriv.h" +#include "machine/8530scc.h" +#include "imagedev/flopdrv.h" +#include "cpu/g65816/g65816.h" +#include "sound/es5503.h" +#include "machine/ram.h" +#include "debugger.h" + +#define LOG_C0XX 0 +#define LOG_ADB 0 +#define LOG_IRQ 0 + +/* ----------------------------------------------------------------------- + * Apple IIgs clock + * ----------------------------------------------------------------------- */ + +void apple2gs_state::process_clock() +{ + UINT8 operation; + seconds_t current_interval; + + /* update clock_curtime */ + current_interval = machine().time().seconds(); + m_clock_curtime += current_interval - m_clock_curtime_interval; + m_clock_curtime_interval = current_interval; + + switch(m_clock_mode) + { + case CLOCKMODE_IDLE: + m_clock_read = (m_clock_data >> 7); + m_clock_reg1 = (m_clock_data >> 2) & 0x03; + operation = (m_clock_data >> 4) & 0x07; + + if ((m_clock_data & 0x40) == 0x00) + { + switch(operation) + { + case 0x00: + /* read/write seconds register */ + m_clock_mode = CLOCKMODE_TIME; + break; + + case 0x03: + /* internal registers */ + if (m_clock_reg1 & 0x02) + { + m_clock_mode = CLOCKMODE_BRAM2; + m_clock_reg1 = (m_clock_data & 0x07) << 5; + } + else + { + m_clock_mode = CLOCKMODE_INTERNALREGS; + } + break; + + default: + //fatalerror("NYI\n"); + break; + } + } + break; + + case CLOCKMODE_BRAM1: + if (m_clock_read) + m_clock_data = m_clock_bram[m_clock_reg1]; + else + m_clock_bram[m_clock_reg1] = m_clock_data; + m_clock_mode = CLOCKMODE_IDLE; + break; + + case CLOCKMODE_BRAM2: + m_clock_reg1 |= (m_clock_data >> 2) & 0x1F; + m_clock_mode = CLOCKMODE_BRAM1; + break; + + case CLOCKMODE_INTERNALREGS: + switch (m_clock_reg1) + { + case 0x00: + /* test register */ + break; + + case 0x01: + /* write protect register */ + break; + } + m_clock_mode = CLOCKMODE_IDLE; + break; + + case CLOCKMODE_TIME: + if (m_clock_data & 0x40) + { + m_clock_data = m_clock_curtime >> (m_clock_reg1 * 8); + } + else + { + m_clock_curtime &= ~(0xFF << (m_clock_reg1 * 8)); + m_clock_curtime |= m_clock_data << (m_clock_reg1 * 8); + } + m_clock_mode = CLOCKMODE_IDLE; + break; + + default: + //fatalerror("NYI\n"); + break; + } +} + +/* ----------------------------------------------------------------------- + * Interrupts + * ----------------------------------------------------------------------- */ + +const char *apple2gs_state::apple2gs_irq_name(UINT16 irq_mask) +{ + switch(irq_mask) + { + case IRQ_KBD_SRQ: return "IRQ_KBD_SRQ"; + case IRQ_ADB_DATA: return "IRQ_ADB_DATA"; + case IRQ_ADB_MOUSE: return "IRQ_ADB_MOUSE"; + case IRQ_VGC_SCANLINE: return "IRQ_VGC_SCANLINE"; + case IRQ_VGC_SECOND: return "IRQ_VGC_SECOND"; + case IRQ_INTEN_QSECOND: return "IRQ_INTEN_QSECOND"; + case IRQ_INTEN_VBL: return "IRQ_INTEN_VBL"; + case IRQ_DOC: return "IRQ_DOC"; + case IRQ_SLOT: return "IRQ_SLOT"; + } + return NULL; +} + +void apple2gs_state::apple2gs_add_irq(UINT16 irq_mask) +{ + if ((m_pending_irqs & irq_mask) == 0x00) + { + if (LOG_IRQ) + logerror("apple2gs_add_irq(): adding %s\n", apple2gs_irq_name(irq_mask)); + + m_pending_irqs |= irq_mask; + m_maincpu->set_input_line(G65816_LINE_IRQ, m_pending_irqs ? ASSERT_LINE : CLEAR_LINE); + } +} + + + +void apple2gs_state::apple2gs_remove_irq(UINT16 irq_mask) +{ + if (m_pending_irqs & irq_mask) + { + if (LOG_IRQ) + logerror("apple2gs_remove_irq(): removing %s\n", apple2gs_irq_name(irq_mask)); + + m_pending_irqs &= ~irq_mask; + m_maincpu->set_input_line(G65816_LINE_IRQ, m_pending_irqs ? ASSERT_LINE : CLEAR_LINE); + } +} + +WRITE_LINE_MEMBER(apple2gs_state::apple2gs_doc_irq) +{ + if (state) + { + apple2gs_add_irq(IRQ_DOC); + } + else + { + apple2gs_remove_irq(IRQ_DOC); + } +} + + +/* Clock interrupt */ +TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_clock_tick) +{ + if ((m_vgcint & 0x04) && !(m_vgcint & 0x40)) + { + m_vgcint |= 0xc0; + apple2gs_add_irq(IRQ_VGC_SECOND); + } +} + + +/* Quarter-second interrupt */ +TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_qsecond_tick) +{ + if ((m_inten & 0x10) && !(m_intflag & 0x10)) + { + m_intflag |= 0x10; + apple2gs_add_irq(IRQ_INTEN_QSECOND); + } +} + + +/* ----------------------------------------------------------------------- + * ADB + * ----------------------------------------------------------------------- */ + + +#if !RUN_ADB_MICRO +UINT8 apple2gs_state::adb_read_memory(UINT32 address) +{ + if (address < ARRAY_LENGTH(m_adb_memory)) + return m_adb_memory[address]; + else + return 0x00; +} + + + +void apple2gs_state::adb_write_memory(UINT32 address, UINT8 data) +{ + if (address < ARRAY_LENGTH(m_adb_memory)) + m_adb_memory[address] = data; +} + + + +void apple2gs_state::adb_set_mode(UINT8 mode) +{ + m_adb_mode = mode; +} + + + +void apple2gs_state::adb_set_config(UINT8 b1, UINT8 b2, UINT8 b3) +{ + /* ignore for now */ +} + + + +void apple2gs_state::adb_post_response(const UINT8 *bytes, size_t length) +{ + assert(length < ARRAY_LENGTH(m_adb_response_bytes)); + memcpy(m_adb_response_bytes, bytes, length); + + m_adb_state = ADBSTATE_INRESPONSE; + m_adb_response_length = length; + m_adb_response_pos = 0; +} + + + +void apple2gs_state::adb_post_response_1(UINT8 b) +{ + adb_post_response(&b, 1); +} + + + +void apple2gs_state::adb_post_response_2(UINT8 b1, UINT8 b2) +{ + UINT8 b[2]; + b[0] = b1; + b[1] = b2; + adb_post_response(b, 2); +} + + +void apple2gs_state::adb_do_command() +{ + int device; + UINT32 address; + UINT8 val; + + m_adb_state = ADBSTATE_IDLE; + if (LOG_ADB) + logerror("adb_do_command(): adb_command=0x%02x\n", m_adb_command); + + switch(m_adb_command) + { + case 0x00: /* ??? */ + break; + + case 0x03: /* flush keyboard buffer */ + break; + + case 0x04: /* set modes */ + adb_set_mode(m_adb_mode | m_adb_command_bytes[0]); + break; + + case 0x05: /* clear modes */ + adb_set_mode(m_adb_mode & ~m_adb_command_bytes[0]); + break; + + case 0x06: /* set config */ + adb_set_config(m_adb_command_bytes[0], m_adb_command_bytes[1], m_adb_command_bytes[2]); + break; + + case 0x07: /* synchronize */ + adb_set_mode(m_adb_command_bytes[0]); + adb_set_config(m_adb_command_bytes[1], m_adb_command_bytes[2], m_adb_command_bytes[3]); + break; + + case 0x08: /* write memory */ + address = m_adb_command_bytes[0]; + val = m_adb_command_bytes[1]; + adb_write_memory(address, val); + break; + + case 0x09: /* read memory */ + address = (m_adb_command_bytes[1] << 8) | m_adb_command_bytes[0]; + adb_post_response_1(adb_read_memory(address)); + break; + + case 0x0a: /* ??? */ + case 0x0b: /* ??? */ + break; + + case 0x0d: /* get version */ + adb_post_response_1(0x06); + break; + + case 0x0e: /* read available charsets */ + adb_post_response_2(0x01, 0x00); + break; + + case 0x0f: /* read available layouts */ + adb_post_response_2(0x01, 0x00); + break; + + case 0x12: /* mystery command 0x12 */ + case 0x13: /* mystery command 0x13 */ + break; + + case 0xb0: case 0xb1: case 0xb2: case 0xb3: + case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: + case 0xbc: case 0xbd: case 0xbe: case 0xbf: + /* send data to device */ + device = m_adb_command & 0x0f; + if (device == m_adb_address_keyboard) + { + } + else if (device == m_adb_address_mouse) + { + } + break; + + case 0xf2: + break; + + default: + fatalerror("ADB command 0x%02x unimplemented\n", m_adb_command); + } + m_adb_kmstatus |= 0x20; +} + + +UINT8 apple2gs_state::adb_read_datareg() +{ + UINT8 result; + + switch(m_adb_state) + { + case ADBSTATE_INRESPONSE: + result = m_adb_response_bytes[m_adb_response_pos++]; + if (m_adb_response_pos >= m_adb_response_length) + { + m_adb_state = ADBSTATE_IDLE; + m_adb_latent_result = result; + m_adb_kmstatus &= ~0x20; + } + break; + + default: + result = 0; //m_adb_latent_result & 0x7f; + break; + } + + if (LOG_ADB) + logerror("adb_read_datareg(): result=0x%02x\n", result); + + return result; +} + + +void apple2gs_state::adb_write_datareg(UINT8 data) +{ + if (LOG_ADB) + logerror("adb_write_datareg(): data=0x%02x\n", data); + + switch(m_adb_state) + { + case ADBSTATE_IDLE: + m_adb_command = data; + m_adb_command_length = 0; + m_adb_command_pos = 0; + +// printf("ADB command %02x\n", data); + switch(data) + { + case 0x00: /* ??? */ + case 0x01: /* abort */ + /* do nothing for now */ + break; + + case 0x03: /* flush keyboard buffer */ + m_adb_command_length = 0; + break; + + case 0x04: /* set modes */ + case 0x05: /* clear modes */ + m_adb_command_length = 1; + break; + + case 0x06: /* set config */ + m_adb_command_length = 3; + break; + + case 0x07: /* synchronize */ + if (m_is_rom3) + m_adb_command_length = 8; // ROM 3 has 8 bytes: mode byte, 3 config bytes, kbd/mouse params, disk eject options + else + m_adb_command_length = 4; // ROM 0/1 has 4 bytes sync + break; + + case 0x08: /* write memory */ + case 0x09: /* read memory */ + m_adb_command_length = 2; + break; + + case 0x0a: /* ??? */ + case 0x0b: /* ??? */ + m_adb_command_length = 0; + break; + + case 0x0d: /* get version */ + m_adb_command_length = 0; + break; + + case 0x0e: /* read available charsets */ + m_adb_command_length = 0; + m_adb_state = ADBSTATE_INCOMMAND; /* HACK */ + break; + + case 0x0f: /* read available layouts */ + m_adb_command_length = 0; + m_adb_state = ADBSTATE_INCOMMAND; /* HACK */ + break; + + case 0x12: /* mystery command 0x12 */ + case 0x13: /* mystery command 0x13 */ + m_adb_command_length = 2; + break; + + case 0x70: /* disable SRQ device 0 */ + case 0x71: /* disable SRQ device 1 */ + case 0x72: /* disable SRQ device 2 */ + case 0x73: /* disable SRQ device 3 */ + /* ignore for now */ + break; + + case 0xb0: case 0xb1: case 0xb2: case 0xb3: + case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: + case 0xbc: case 0xbd: case 0xbe: case 0xbf: + /* send data to device */ + m_adb_command_length = 2; + break; + + case 0xf2: + break; + + default: + fatalerror("ADB command 0x%02x unimplemented\n", data); + } + + if (m_adb_command_length > 0) + { + m_adb_state = ADBSTATE_INCOMMAND; + if (LOG_ADB) + logerror("adb_write_datareg(): in command length %u\n", (unsigned) m_adb_command_length); + } + break; + + case ADBSTATE_INCOMMAND: + assert(m_adb_command_pos < ARRAY_LENGTH(m_adb_command_bytes)); +// printf("ADB param %02x\n", data); + m_adb_command_bytes[m_adb_command_pos++] = data; + break; + + case ADBSTATE_INRESPONSE: + m_adb_state = ADBSTATE_IDLE; + break; + } + + /* do command if necessary */ + if ((m_adb_state == ADBSTATE_INCOMMAND) && (m_adb_command_pos >= m_adb_command_length)) + adb_do_command(); +} + +// real rom 3 h/w reads 0x90 when idle, 0x98 when key pressed +// current MESS reads back 0xb0 when idle +UINT8 apple2gs_state::adb_read_kmstatus() +{ + return m_adb_kmstatus; +} + + +void apple2gs_state::adb_write_kmstatus(UINT8 data) +{ + m_adb_kmstatus &= ~0x54; + m_adb_kmstatus |= data & 0x54; +} + + + +UINT8 apple2gs_state::adb_read_mousedata() +{ + UINT8 result = 0x00; + UINT8 absolute; + INT8 delta; + + if (m_adb_kmstatus & 0x80) // mouse register full + { + if (m_adb_kmstatus & 0x02) // H/V mouse data select + { + absolute = m_mouse_y; + delta = m_mouse_dy; + m_adb_kmstatus &= ~0x82; + apple2gs_remove_irq(IRQ_ADB_MOUSE); + } + else + { + absolute = m_mouse_x; + delta = m_mouse_dx; + m_adb_kmstatus |= 0x02; + } + + if (delta > 63) + delta = 63; + else if (delta < -64) + delta = -64; + + result = (absolute & 0x80) | (delta & 0x7F); + } + return result; +} + + +INT8 apple2gs_state::seven_bit_diff(UINT8 v1, UINT8 v2) +{ + v1 -= v2; + if (v1 & 0x40) + v1 |= 0x80; + else + v1 &= ~0x80; + return v1; +} + + + +void apple2gs_state::adb_check_mouse() +{ + UINT8 new_mouse_x, new_mouse_y; + + /* read mouse values */ + if ((m_adb_kmstatus & 0x80) == 0x00) + { + new_mouse_x = m_adb_mousex->read(); + new_mouse_y = m_adb_mousey->read(); + + if ((m_mouse_x != new_mouse_x) || (m_mouse_y != new_mouse_y)) + { + m_mouse_dx = seven_bit_diff(new_mouse_x, m_mouse_x); + m_mouse_dy = seven_bit_diff(new_mouse_y, m_mouse_y); + m_mouse_x = new_mouse_x; + m_mouse_y = new_mouse_y; + + m_adb_kmstatus |= 0x80; + m_adb_kmstatus &= ~0x02; + if (m_adb_kmstatus & 0x40) + apple2gs_add_irq(IRQ_ADB_MOUSE); + } + } +} +#endif + + +void apple2gs_state::apple2gs_set_scanint(UINT8 data) +{ + /* second interrupt */ + if ((m_vgcint & 0x40) && !(data & 0x40)) + { + apple2gs_remove_irq(IRQ_VGC_SECOND); + m_vgcint &= ~0xC0; + } + + /* scanline interrupt */ + if ((m_vgcint & 0x20) && !(data & 0x20)) + { + apple2gs_remove_irq(IRQ_VGC_SCANLINE); + m_vgcint &= ~0xA0; + } + + if (m_pending_irqs & (IRQ_VGC_SECOND | IRQ_VGC_SCANLINE)) + m_vgcint |= 0x80; +} + + +TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_scanline_tick) +{ + int scanline; + + scanline = machine().first_screen()->vpos(); + machine().first_screen()->update_partial(scanline); + + /* check scanline interrupt bits if we're in super hi-res and the current scanline is within the active display area */ + if ((m_newvideo & 0x80) && (scanline >= (BORDER_TOP-1)) && (scanline < (200+BORDER_TOP-1))) + { + UINT8 scb; + + scb = m_slowmem[0x19D00 + scanline - BORDER_TOP + 1]; + + if (scb & 0x40) + { + // scanline int flag is set even when the actual interrupt is disabled + m_vgcint |= 0x20; + + // see if the interrupt is also enabled and trigger it if so + if (m_vgcint & 0x02) + { + m_vgcint |= 0x80; + apple2gs_add_irq(IRQ_VGC_SCANLINE); + } + } + } + + if (scanline == (192+BORDER_TOP)) + { + /* VBL interrupt */ + if ((m_inten & 0x08) && !(m_intflag & 0x08)) + { + m_intflag |= 0x08; + apple2gs_add_irq(IRQ_INTEN_VBL); + } + } + + /* check the mouse status */ + if ((scanline % 8) == 0) + { + #if !RUN_ADB_MICRO + adb_check_mouse(); + #endif + + /* call Apple II interrupt handler */ + if ((machine().first_screen()->vpos() % 8) == 7) + { + //apple2_interrupt(m_maincpu); + /* TODO: check me! */ + machine().first_screen()->update_partial(machine().first_screen()->vpos()); + } + } + + m_scanline_timer->adjust(machine().first_screen()->time_until_pos((scanline+1)%262, 0)); +} + + + +/* ----------------------------------------------------------------------- + * Sound handlers + * ----------------------------------------------------------------------- */ + + +READ8_MEMBER( apple2gs_state::gssnd_r ) +{ + UINT8 ret = 0; + + switch (offset) + { + case 0: // control + ret = m_sndglu_ctrl; + break; + case 1: // data read + ret = m_sndglu_dummy_read; + + if (m_sndglu_ctrl & 0x40) // docram access + { + UINT8 *docram = memregion("es5503")->base(); + m_sndglu_dummy_read = docram[m_sndglu_addr]; + } + else + { + m_sndglu_dummy_read = m_es5503->read(space, m_sndglu_addr); + } + + if (m_sndglu_ctrl & 0x20) // auto-increment + { + m_sndglu_addr++; + } + break; + case 2: // addr l + ret = m_sndglu_addr & 0xff; + break; + case 3: // addr h + ret = (m_sndglu_addr >> 8) & 0xff; + break; + } + + return ret; +} + + + +WRITE8_MEMBER( apple2gs_state::gssnd_w ) +{ + switch (offset) + { + case 0: // control + m_sndglu_ctrl = data & 0x7f; // make sure DOC is never busy + if (!(m_sndglu_ctrl & 0x40)) // clear hi byte of address pointer on DOC access + { + m_sndglu_addr &= 0xff; + } + break; + case 1: // data write + if (m_sndglu_ctrl & 0x40) // docram access + { + UINT8 *docram = memregion("es5503")->base(); + docram[m_sndglu_addr] = data; + } + else + { + m_es5503->write(space, m_sndglu_addr, data); + } + + if (m_sndglu_ctrl & 0x20) // auto-increment + { + m_sndglu_addr++; + } + break; + case 2: // addr l + m_sndglu_addr &= 0xff00; + m_sndglu_addr |= data; + break; + case 3: // addr h + m_sndglu_addr &= 0x00ff; + m_sndglu_addr |= data<<8; + break; + } +} + +/* ----------------------------------------------------------------------- + * IO handlers + * ----------------------------------------------------------------------- */ + +// apple2gs_get_vpos - return the correct vertical counter value for the current scanline, +// keeping borders in mind. + +int apple2gs_state::apple2gs_get_vpos() +{ + int result, scan; + static const UINT8 top_border_vert[BORDER_TOP] = + { + 0xfa, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, + 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfe, 0xfe, 0xff, + + }; + + scan = machine().first_screen()->vpos(); + + if (scan < BORDER_TOP) + { + result = top_border_vert[scan]; + } + else + { + result = scan - BORDER_TOP + 0x100 + 1; + } + + return result; +} + +READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r ) +{ + UINT8 result; + scc8530_t *scc; + + if(space.debugger_access()) + { + return 0; + } + + offset &= 0xFF; + + switch(offset) + { + #if RUN_ADB_MICRO + case 0x00: /* C000 - KEYDATA */ + result = keyglu_816_read(GLU_C000); + break; + + case 0x10: /* C010 - KBDSTRB */ + result = keyglu_816_read(GLU_C010); + break; + #endif + + case 0x19: /* C019 - RDVBLBAR */ + result = (space.machine().first_screen()->vpos() >= (192+BORDER_TOP)) ? 0x80 : 0x00; + break; + + case 0x22: /* C022 - TBCOLOR */ + result = (m_fgcolor << 4) | m_bgcolor; + break; + + case 0x23: /* C023 - VGCINT */ + result = m_vgcint; + break; + + case 0x24: /* C024 - MOUSEDATA */ + #if RUN_ADB_MICRO + result = keyglu_816_read(GLU_MOUSEX); + #else + result = adb_read_mousedata(); + #endif + break; + + case 0x25: /* C025 - KEYMODREG */ + #if RUN_ADB_MICRO + result = keyglu_816_read(GLU_KEYMOD); + #else + + result = 0; + { + UINT8 temp = m_kbspecial->read(); + if (temp & 1) // capslock + { + result |= 4; + } + if (temp & 6) // shift + { + result |= 1; + } + if (temp & 8) // control + { + result |= 2; + } + if (temp & 0x10) // open apple/command + { + result |= 0x40; + } + if (temp & 0x20) // option + { + result |= 0x80; + } + // keypad is a little rough right now + if (m_lastchar >= 0x28 && m_lastchar <= 0x2d) + { + result |= 0x10; + } + else if (m_lastchar >= 0x32 && m_lastchar <= 0x3f) + { + result |= 0x10; + } + else if (m_lastchar >= 0x100 && m_lastchar <= 0x101) + { + result |= 0x10; + } + else if (m_lastchar >= 0x109 && m_lastchar <= 0x10a) + { + result |= 0x10; + } + } +#endif + break; + + case 0x26: /* C026 - DATAREG */ + #if RUN_ADB_MICRO + result = keyglu_816_read(GLU_DATA); + #else + result = adb_read_datareg(); + #endif + break; + + case 0x27: /* C027 - KMSTATUS */ + #if RUN_ADB_MICRO + result = keyglu_816_read(GLU_SYSSTAT); + #else + result = adb_read_kmstatus(); + #endif + break; + + case 0x29: /* C029 - NEWVIDEO */ + result = m_newvideo; + break; + + case 0x2B: /* C02B - LANGSEL */ + result = m_langsel; + break; + + case 0x2D: /* C02D - SLTROMSEL */ + result = m_sltromsel; + break; + + case 0x2E: /* C02E - VERTCNT */ + result = apple2gs_get_vpos() >> 1; + break; + + case 0x2F: /* C02F - HORIZCNT */ + result = space.machine().first_screen()->hpos() / 11; + if (result > 0) + { + result += 0x40; + } + + if (apple2gs_get_vpos() & 1) + { + result |= 0x80; + } + break; + + case 0x31: /* C031 - DISKREG */ + result = m_fdc_diskreg; + break; + + case 0x33: /* C033 - CLOCKDATA */ + result = m_clock_data; + break; + + case 0x34: /* C034 - CLOCKCTL */ + result = m_clock_control; + break; + + case 0x35: /* C035 - SHADOW */ + result = m_shadow; + break; + + case 0x36: /* C036 - CYAREG */ + result = m_cyareg; + break; + + case 0x38: /* C038 - SCCBREG */ + case 0x39: /* C039 - SCCAREG */ + case 0x3A: /* C03A - SCCBDATA */ + case 0x3B: /* C03B - SCCADATA */ + scc = space.machine().device("scc"); + result = scc->reg_r(space, offset & 0x03); + break; + + case 0x3C: /* C03C - SOUNDCTL */ + case 0x3D: /* C03D - SOUNDDATA */ + case 0x3E: /* C03E - SOUNDADRL */ + case 0x3F: /* C03F - SOUNDADRH */ + result = gssnd_r(space, offset & 0x03, mem_mask); + break; + + case 0x41: /* C041 - INTEN */ + result = m_inten; + break; + + case 0x46: /* C046 - INTFLAG */ + result = m_intflag; + break; + + case 0x68: /* C068 - STATEREG */ + result = ((m_flags & VAR_ALTZP) ? 0x80 : 0x00) + | ((m_flags & VAR_PAGE2) ? 0x40 : 0x00) + | ((m_flags & VAR_RAMRD) ? 0x20 : 0x00) + | ((m_flags & VAR_RAMWRT) ? 0x10 : 0x00) + | ((m_flags & VAR_LCRAM) ? 0x00 : 0x08) + | ((m_flags & VAR_LCRAM2) ? 0x04 : 0x00) + | ((m_flags & VAR_INTCXROM)? 0x01 : 0x00); + break; + + case 0x71: case 0x72: case 0x73: + case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7a: case 0x7b: + case 0x7c: case 0x7d: case 0x7e: case 0x7f: + offset |= (memregion("maincpu")->bytes() - 1) & ~0x3FFF; + result = m_rom[offset]; + break; + + case 0x21: /* C021 - MONOCOLOR */ + case 0x2C: /* C02C - CHARROM */ + result = 0x00; + break; + + // slot 6 registers should go to applefdc if slot 6 not "Your Card" + case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7: + case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: + if ((m_sltromsel & (1 << 6)) == 0) + { + result = m_fdc->read(offset); + } + else + { + result = apple2_c0xx_r(space, offset, 0); + } + break; + + default: + if (offset < 0x80) + { + result = apple2_c0xx_r(space, offset, 0); + } + else + { + result = apple2_c080_r(space, offset, 0); + } + break; + } + + if (LOG_C0XX) + logerror("apple2gs_c0xx_r(): offset=0x%02x result=0x%02x\n", offset, result); + + return result; +} + + + +WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) +{ + scc8530_t *scc; + + offset &= 0xFF; + + if (LOG_C0XX) + logerror("apple2gs_c0xx_w(): offset=0x%02x data=0x%02x\n", offset, data); + + switch(offset) + { + #if RUN_ADB_MICRO + case 0x10: + break; + #endif + + case 0x22: /* C022 - TBCOLOR */ + m_fgcolor = (data >> 4) & 0x0F; + m_bgcolor = (data >> 0) & 0x0F; + break; + + case 0x23: /* C023 - VGCINT */ + m_vgcint &= ~0x0F; + m_vgcint |= data & 0x0F; + break; + + case 0x24: /* C024 - MOUSEDATA */ + case 0x25: /* C025 - KEYMODREG */ + case 0x28: /* C028 - ROMBANK */ + case 0x2C: /* C02C - CHARROM */ + case 0x2E: /* C02E - VERTCNT */ + case 0x2F: /* C02F - HORIZCNT */ + /* ignore these writes */ + break; + + case 0x26: /* C026 - DATAREG */ + #if RUN_ADB_MICRO + keyglu_816_write(GLU_COMMAND, data); + #else + adb_write_datareg(data); + #endif + break; + + case 0x27: /* C027 - KMSTATUS */ + #if RUN_ADB_MICRO + keyglu_816_write(GLU_SYSSTAT, data); + #else + adb_write_kmstatus(data); + #endif + break; + + case 0x29: /* C029 - NEWVIDEO */ + m_newvideo = data; + break; + + case 0x2B: /* C02B - LANGSEL */ + m_langsel = data; + break; + + case 0x2D: /* C02D - SLTROMSEL */ + m_sltromsel = data; + apple2_update_memory(); + break; + + case 0x31: /* C031 - DISKREG */ + apple2_iwm_setdiskreg(data); + break; + + case 0x32: /* C032 - SCANINT */ + apple2gs_set_scanint(data); + break; + + case 0x33: /* C033 - CLOCKDATA */ + m_clock_data = data; + break; + + case 0x34: /* C034 - CLOCKCTL */ + m_clock_control = data & 0x7F; + m_bordercolor = data & 0x0F; + if (data & 0x80) + process_clock(); + break; + + case 0x35: /* C035 - SHADOW */ + if (m_shadow != data) + { + m_shadow = data; + apple2_update_memory(); + } + break; + + case 0x36: /* C036 - CYAREG */ + m_cyareg = data & ~0x20; + m_maincpu->set_unscaled_clock((data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7); + break; + + case 0x38: /* C038 - SCCBREG */ + case 0x39: /* C039 - SCCAREG */ + case 0x3A: /* C03A - SCCBDATA */ + case 0x3B: /* C03B - SCCADATA */ + scc = space.machine().device("scc"); + scc->reg_w(space, offset & 0x03, data); + break; + + case 0x3C: /* C03C - SOUNDCTL */ + case 0x3D: /* C03D - SOUNDDATA */ + case 0x3E: /* C03E - SOUNDADRL */ + case 0x3F: /* C03F - SOUNDADRH */ + gssnd_w(space, offset & 0x03, data, mem_mask); + break; + + case 0x41: /* C041 - INTEN */ + m_inten = data & 0x1F; + if ((m_inten & 0x10) == 0x00) + apple2gs_remove_irq(IRQ_INTEN_QSECOND); + if ((m_inten & 0x08) == 0x00) + apple2gs_remove_irq(IRQ_INTEN_VBL); + break; + + case 0x47: /* C047 - CLRVBLINT */ + m_intflag &= ~0x18; + apple2gs_remove_irq(IRQ_INTEN_QSECOND); + apple2gs_remove_irq(IRQ_INTEN_VBL); + break; + + case 0x68: /* C068 - STATEREG */ + apple2_setvar( + ((data & 0x80) ? VAR_ALTZP : 0) | + ((data & 0x40) ? VAR_PAGE2 : 0) | + ((data & 0x20) ? VAR_RAMRD : 0) | + ((data & 0x10) ? VAR_RAMWRT : 0) | + ((data & 0x08) ? 0 : VAR_LCRAM) | + ((data & 0x04) ? VAR_LCRAM2 : 0) | + ((data & 0x01) ? VAR_INTCXROM : 0), + VAR_ALTZP | VAR_PAGE2 | VAR_RAMRD | VAR_RAMWRT | VAR_LCRAM | VAR_LCRAM2 | VAR_INTCXROM); + break; + + // slot 6 registers should go to applefdc if slot 6 not "Your Card" + case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7: + case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: + if ((m_sltromsel & (1 << 6)) == 0) + { + m_fdc->write(offset, data); + } + else + { + apple2_c0xx_w(space, offset, data, 0); + } + break; + + default: + if (offset < 0x80) + { + apple2_c0xx_w(space, offset, data, 0); + } + else + { + apple2_c080_w(space, offset, data, 0); + } + break; + } +} + + + +/* ----------------------------------------------------------------------- + * Memory management + * ----------------------------------------------------------------------- */ + +WRITE8_MEMBER( apple2gs_state::apple2gs_main0400_w ) +{ + offset += 0x000400; + m_rambase[offset] = data; + + if (!(m_shadow & 0x01)) + { + m_slowmem[offset] = data; + } +} + +WRITE8_MEMBER( apple2gs_state::apple2gs_aux0400_w ) +{ + offset += 0x010400; + m_rambase[offset] = data; + + if (!(m_shadow & 0x01)) + { + m_slowmem[offset] = data; + } +} + +WRITE8_MEMBER( apple2gs_state::apple2gs_main2000_w ) +{ + offset += 0x002000; + m_rambase[offset] = data; + + if (!(m_shadow & 0x02)) + { + m_slowmem[offset] = data; + } +} + +WRITE8_MEMBER( apple2gs_state::apple2gs_aux2000_w ) +{ + offset += 0x012000; + m_rambase[offset] = data; + + if (!(m_shadow & 0x12) || !(m_shadow & 0x08)) + { + m_slowmem[offset] = data; + } +} + +WRITE8_MEMBER( apple2gs_state::apple2gs_main4000_w ) +{ + offset += 0x004000; + m_rambase[offset] = data; + + if ((offset >= 0x004000) && (offset <= 0x005FFF)) + { + if (!(m_shadow & 0x04)) + m_slowmem[offset] = data; + } +} + +WRITE8_MEMBER( apple2gs_state::apple2gs_aux4000_w ) +{ + offset += 0x014000; + m_rambase[offset] = data; + + if ((offset >= 0x014000) && (offset <= 0x015FFF)) + { + if (!(m_shadow & 0x14) || !(m_shadow & 0x08)) + m_slowmem[offset] = data; + } + else if ((offset >= 0x016000) && (offset <= 0x019FFF)) + { + if (!(m_shadow & 0x08)) + { + m_slowmem[offset] = data; + + if (offset >= 0x19e00) + { + int color = (offset - 0x19e00) >> 1; + + m_shr_palette[color] = rgb_t( + ((m_slowmem[0x19E00 + (color * 2) + 1] >> 0) & 0x0F) * 17, + ((m_slowmem[0x19E00 + (color * 2) + 0] >> 4) & 0x0F) * 17, + ((m_slowmem[0x19E00 + (color * 2) + 0] >> 0) & 0x0F) * 17); + } + } + } +} + + + +static void apple2gs_mem_000000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + meminfo->read_mem = (state->m_flags & VAR_ALTZP) ? 0x010000 : 0x000000; + meminfo->write_mem = (state->m_flags & VAR_ALTZP) ? 0x010000 : 0x000000; +} + +static void apple2gs_mem_000200(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x010200 : 0x000200; + meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x010200 : 0x000200; +} + +static void apple2gs_mem_000400(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + if (state->m_flags & VAR_80STORE) + { + meminfo->read_mem = (state->m_flags & VAR_PAGE2) ? 0x010400 : 0x000400; + meminfo->write_mem = (state->m_flags & VAR_PAGE2) ? 0x010400 : 0x000400; + meminfo->write_handler = (state->m_flags & VAR_PAGE2) ? &state->write_delegates_2gs0400[0] : &state->write_delegates_2gs0400[1]; + } + else + { + meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x010400 : 0x000400; + meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x010400 : 0x000400; + meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_2gs0400[0] : &state->write_delegates_2gs0400[1]; + } +} + +static void apple2gs_mem_000800(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x010800 : 0x000800; + meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x010800 : 0x000800; +} + +static void apple2gs_mem_002000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + if ((state->m_flags & (VAR_80STORE|VAR_HIRES)) == (VAR_80STORE|VAR_HIRES)) + { + meminfo->read_mem = (state->m_flags & VAR_PAGE2) ? 0x012000 : 0x002000; + meminfo->write_mem = (state->m_flags & VAR_PAGE2) ? 0x012000 : 0x002000; + meminfo->write_handler = (state->m_flags & VAR_PAGE2) ? &state->write_delegates_2gs2000[0] : &state->write_delegates_2gs2000[1]; + } + else + { + meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x012000 : 0x002000; + meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x012000 : 0x002000; + meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_2gs2000[0] : &state->write_delegates_2gs2000[1]; + } +} + +static void apple2gs_mem_004000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x014000 : 0x004000; + meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_2gs4000[0] : &state->write_delegates_2gs4000[1]; +} + +static void apple2gs_mem_xxD000(running_machine &machine,apple2_meminfo *meminfo, UINT32 lcmem) +{ + apple2gs_state *state = machine.driver_data(); + if (state->m_flags & VAR_LCRAM) + { + if (state->m_flags & VAR_LCRAM2) + meminfo->read_mem = lcmem | 0x00C000; + else + meminfo->read_mem = lcmem | 0x00D000; + } + else + { + meminfo->read_mem = 0x03D000 | APPLE2_MEM_ROM; + } + + if (state->m_flags & VAR_LCWRITE) + { + if (state->m_flags & VAR_LCRAM2) + meminfo->write_mem = lcmem | 0x00C000; + else + meminfo->write_mem = lcmem | 0x00D000; + } + else + { + meminfo->write_mem = APPLE2_MEM_FLOATING; + } +} + +static void apple2gs_mem_xxE000(running_machine &machine,apple2_meminfo *meminfo, UINT32 lcmem) +{ + apple2gs_state *state = machine.driver_data(); + if (state->m_flags & VAR_LCRAM) + meminfo->read_mem = lcmem | 0x00E000; + else + meminfo->read_mem = 0x03E000 | APPLE2_MEM_ROM; + + if (state->m_flags & VAR_LCWRITE) + meminfo->write_mem = lcmem | 0x00E000; + else + meminfo->write_mem = APPLE2_MEM_FLOATING; +} + +static void apple2gs_mem_00D000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + if (state->m_shadow & 0x40) + { + meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x01D000 : 0x00D000; + meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x01D000 : 0x00D000; + } + else + { + apple2gs_mem_xxD000(machine,meminfo, (state->m_flags & VAR_ALTZP) ? 0x010000 : 0x000000); + } +} + +static void apple2gs_mem_00E000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + if (state->m_shadow & 0x40) + { + meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x01E000 : 0x00E000; + meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x01E000 : 0x00E000; + } + else + { + apple2gs_mem_xxE000(machine,meminfo, (state->m_flags & VAR_ALTZP) ? 0x010000 : 0x000000); + } +} + +static void apple2gs_mem_01D000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + if (state->m_shadow & 0x40) + { + meminfo->read_mem = 0x01D000; + meminfo->write_mem = 0x01D000; + } + else + { + apple2gs_mem_xxD000(machine,meminfo, 0x010000); + } +} + +static void apple2gs_mem_01E000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_state *state = machine.driver_data(); + if (state->m_shadow & 0x40) + { + meminfo->read_mem = 0x01E000; + meminfo->write_mem = 0x01E000; + } + else + { + apple2gs_mem_xxE000(machine,meminfo, 0x010000); + } +} + +static void apple2gs_mem_E0D000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_mem_xxD000(machine,meminfo, 0x000000 | APPLE2_MEM_AUX); +} + +static void apple2gs_mem_E0E000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_mem_xxE000(machine,meminfo, 0x000000 | APPLE2_MEM_AUX); +} + +static void apple2gs_mem_E1D000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_mem_xxD000(machine,meminfo, 0x010000 | APPLE2_MEM_AUX); +} + +static void apple2gs_mem_E1E000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) +{ + apple2gs_mem_xxE000(machine,meminfo, 0x010000 | APPLE2_MEM_AUX); +} + + + +static const apple2_memmap_entry apple2gs_memmap_entries[] = +{ + { 0x000000, 0x0001FF, apple2gs_mem_000000, A2MEM_MONO }, + { 0x000200, 0x0003FF, apple2gs_mem_000200, A2MEM_DUAL }, + { 0x000400, 0x0007FF, apple2gs_mem_000400, A2MEM_DUAL }, + { 0x000800, 0x001FFF, apple2gs_mem_000800, A2MEM_DUAL }, + { 0x002000, 0x003FFF, apple2gs_mem_002000, A2MEM_DUAL }, + { 0x004000, 0x00BFFF, apple2gs_mem_004000, A2MEM_DUAL }, + { 0x00D000, 0x00DFFF, apple2gs_mem_00D000, A2MEM_DUAL }, + { 0x00E000, 0x00FFFF, apple2gs_mem_00E000, A2MEM_DUAL }, + + { 0x01D000, 0x01DFFF, apple2gs_mem_01D000, A2MEM_DUAL }, + { 0x01E000, 0x01FFFF, apple2gs_mem_01E000, A2MEM_DUAL }, + { 0xE0D000, 0xE0DFFF, apple2gs_mem_E0D000, A2MEM_DUAL }, + { 0xE0E000, 0xE0FFFF, apple2gs_mem_E0E000, A2MEM_DUAL }, + { 0xE1D000, 0xE1DFFF, apple2gs_mem_E1D000, A2MEM_DUAL }, + { 0xE1E000, 0xE1FFFF, apple2gs_mem_E1E000, A2MEM_DUAL }, + + { 0 } +}; + + + +UINT8 *apple2gs_state::apple2gs_getslotmem(offs_t address) +{ + UINT8 *rom; + + address %= 0x00FFFF; + assert(address >= 0xC000); + assert(address <= 0xCFFF); + + rom = m_rom; + rom += 0x030000 % memregion("maincpu")->bytes(); + return &rom[address]; +} + + + +UINT8 apple2gs_state::apple2gs_xxCxxx_r(address_space &space, offs_t address) +{ + UINT8 result; + int slot; + + if ((m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) // shadow all banks and C0xx? + { + result = m_ram->pointer()[address]; + } + else if ((address & 0x000F00) == 0x000000) // accessing C0xx? + { + result = apple2gs_c0xx_r(m_maincpu->space(AS_PROGRAM), address, 0); + } + else + { + device_a2bus_card_interface *slotdevice; + + slot = (address & 0x000F00) / 0x100; + if (slot <= 7) // slots 1-7, it's the slot + { + slotdevice = m_a2bus->get_a2bus_card(slot); + + // is this slot internal or "Your Card"? + if ((m_sltromsel & (1 << slot)) == 0) + { + // accessing a slot mapped to internal, let's put back the internal ROM + m_a2_cnxx_slot = -1; + apple2_update_memory(); + result = *apple2gs_getslotmem(address); + } + else + { + // accessing a slot mapped to "Your Card", C800 should belong to that card + if (slotdevice != NULL) + { + if (slotdevice->take_c800()) + { + m_a2_cnxx_slot = slot; + apple2_update_memory(); + } + result = slotdevice->read_cnxx(space, address&0xff); + } + else + { + result = apple2_getfloatingbusvalue(); + } + } + } + else // C800-CFFF, not cards + { + slotdevice = NULL; + + // if CFFF accessed, reset C800 area to internal ROM + if(!space.debugger_access()) + { + if ((address & 0xfff) == 0xfff) + { + m_a2_cnxx_slot = -1; + apple2_update_memory(); + } + } + + if ( m_a2_cnxx_slot >= 0 && m_a2_cnxx_slot <= 7 ) + { + slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); + } + + if (slotdevice) + { + result = slotdevice->read_c800(space, address&0x7ff); + } + else + { + result = *apple2gs_getslotmem(address); + } + } + } + return result; +} + + + +void apple2gs_state::apple2gs_xxCxxx_w(address_space &space, offs_t address, UINT8 data) +{ + int slot; + + // if CFFF accessed, reset C800 area to internal ROM + if(!space.debugger_access()) + { + if ((address & 0xfff) == 0xfff) + { + m_a2_cnxx_slot = -1; + apple2_update_memory(); + } + } + + if ((m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) + { + m_ram->pointer()[address] = data; + } + else if ((address & 0x000F00) == 0x000000) + { + apple2gs_c0xx_w(m_maincpu->space(AS_PROGRAM), address, data, 0); + } + else + { + device_a2bus_card_interface *slotdevice; + + slot = (address & 0x000F00) / 0x100; + + if (slot <= 7) // slots 1-7, it's the slot + { + slotdevice = m_a2bus->get_a2bus_card(slot); + + // is this slot internal or "Your Card"? + if ((m_sltromsel & (1 << slot)) == 0) + { + // accessing a slot mapped to internal, let's put back the internal ROM + m_a2_cnxx_slot = -1; + apple2_update_memory(); + *apple2gs_getslotmem(address) = data; + } + else + { + // accessing a slot mapped to "Your Card", C800 should belong to that card if it can take it + if (slotdevice != NULL) + { + if (slotdevice->take_c800()) + { + m_a2_cnxx_slot = slot; + apple2_update_memory(); + } + slotdevice->write_cnxx(space, address&0xff, data); + } + // (else slot is your card but there's no card inserted so the write goes nowhere) + } + } + else // C800-CFFF, not cards + { + slotdevice = NULL; + + // if CFFF accessed, reset C800 area to internal ROM + if ((address & 0xfff) == 0xfff) + { + m_a2_cnxx_slot = -1; + apple2_update_memory(); + } + + if ( m_a2_cnxx_slot >= 0 && m_a2_cnxx_slot <= 7 ) + { + slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); + } + + if (slotdevice) + { + slotdevice->write_c800(space, address&0x7ff, data); + } + else + { + *apple2gs_getslotmem(address) = data; + } + } + } +} + + + +READ8_MEMBER( apple2gs_state::apple2gs_00Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0x00C000); } +READ8_MEMBER( apple2gs_state::apple2gs_01Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0x01C000); } +READ8_MEMBER( apple2gs_state::apple2gs_E0Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0xE0C000); } +READ8_MEMBER( apple2gs_state::apple2gs_E1Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0xE1C000); } + +WRITE8_MEMBER( apple2gs_state::apple2gs_00Cxxx_w ) { apple2gs_xxCxxx_w(space, offset | 0x00C000, data); } +WRITE8_MEMBER( apple2gs_state::apple2gs_01Cxxx_w ) { apple2gs_xxCxxx_w(space, offset | 0x01C000, data); } +WRITE8_MEMBER( apple2gs_state::apple2gs_E0Cxxx_w ) { apple2gs_xxCxxx_w(space, offset | 0xE0C000, data); } +WRITE8_MEMBER( apple2gs_state::apple2gs_E1Cxxx_w ) { apple2gs_xxCxxx_w(space, offset | 0xE1C000, data); } + +WRITE8_MEMBER( apple2gs_state::apple2gs_Exxxxx_w ) +{ + m_slowmem[offset] = data; +} + +WRITE8_MEMBER( apple2gs_state::apple2gs_E004xx_w ) { apple2gs_Exxxxx_w(space, offset + 0x00400, data, mem_mask); } +WRITE8_MEMBER( apple2gs_state::apple2gs_E02xxx_w ) { apple2gs_Exxxxx_w(space, offset + 0x02000, data, mem_mask); } +WRITE8_MEMBER( apple2gs_state::apple2gs_E104xx_w ) { apple2gs_Exxxxx_w(space, offset + 0x10400, data, mem_mask); } +WRITE8_MEMBER( apple2gs_state::apple2gs_E12xxx_w ) { apple2gs_Exxxxx_w(space, offset + 0x12000, data, mem_mask); } + +WRITE8_MEMBER( apple2gs_state::apple2gs_slowmem_w ) +{ + m_slowmem[offset] = data; + + if ((offset >= 0x19e00) && (offset < 0x19fff)) + { + int color = (offset - 0x19e00) >> 1; + + m_shr_palette[color] = rgb_t( + ((m_slowmem[0x19E00 + (color * 2) + 1] >> 0) & 0x0F) * 17, + ((m_slowmem[0x19E00 + (color * 2) + 0] >> 4) & 0x0F) * 17, + ((m_slowmem[0x19E00 + (color * 2) + 0] >> 0) & 0x0F) * 17); + } +} + +// Because the bank address multiplexes on the 65816 data bus, reading a memory area +// which doesn't drive the bus results in reading back the bank number. +READ8_MEMBER(apple2gs_state::apple2gs_bank_echo_r) +{ + return m_echo_bank + (offset>>16); +} + +void apple2gs_state::apple2gs_setup_memory() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + offs_t begin, end; + apple2_memmap_config cfg; + + /* allocate memory for E00000-E1FFFF */ + m_slowmem = auto_alloc_array_clear(machine(), UINT8, 128*1024); + save_pointer(m_slowmem, "APPLE2GS_SLOWMEM", 128*1024); + + // install expanded memory + // fair warning: other code assumes banks 0 and 1 are the first 128k of the RAM device, so you must install bank 1 at 0x10000 + // otherwise nothing works :) + if (m_is_rom3) + { + int ramsize = m_ram->size(); + + // ROM 03 hardware: the quoted "1 MB" for a base machine doesn't include banks e0/e1, so map accordingly + space.install_readwrite_bank(0x010000, ramsize - 1, "bank1"); + membank("bank1")->set_base(m_ram->pointer() + 0x010000); + + space.install_read_handler( ramsize, 0xdfffff, read8_delegate(FUNC(apple2gs_state::apple2gs_bank_echo_r),this)); + m_echo_bank = (ramsize >> 16); + } + else + { + int ramsize = m_ram->size()-0x30000; + + // ROM 00/01 hardware: the quoted "256K" for a base machine *does* include banks e0/e1. + space.install_readwrite_bank(0x010000, ramsize - 1 + 0x10000, "bank1"); + membank("bank1")->set_base(m_ram->pointer() + 0x010000); + + space.install_read_handler( ramsize + 0x10000, 0xdfffff, read8_delegate(FUNC(apple2gs_state::apple2gs_bank_echo_r),this)); + m_echo_bank = (ramsize+0x10000) >> 16; + } + + /* install hi memory */ + space.install_read_bank(0xe00000, 0xe1ffff, "bank2"); + space.install_write_handler(0xe00000, 0xe1ffff, write8_delegate(FUNC(apple2gs_state::apple2gs_slowmem_w),this)); + space.install_write_handler(0xe00400, 0xe007ff, write8_delegate(FUNC(apple2gs_state::apple2gs_E004xx_w),this)); + space.install_write_handler(0xe02000, 0xe03fff, write8_delegate(FUNC(apple2gs_state::apple2gs_E02xxx_w),this)); + space.install_write_handler(0xe10400, 0xe107ff, write8_delegate(FUNC(apple2gs_state::apple2gs_E104xx_w),this)); + space.install_write_handler(0xe12000, 0xe13fff, write8_delegate(FUNC(apple2gs_state::apple2gs_E12xxx_w),this)); + membank("bank2")->set_base(m_slowmem); + + /* install alternate ROM bank */ + begin = 0x1000000 - memregion("maincpu")->bytes(); + end = 0xffffff; + space.install_read_bank(begin, end, "bank3"); + membank("bank3")->set_base(m_rom); + + /* install new xxC000-xxCFFF handlers */ + space.install_read_handler(0x00c000, 0x00cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_00Cxxx_r),this)); + space.install_write_handler(0x00c000, 0x00cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_00Cxxx_w),this)); + space.install_read_handler(0x01c000, 0x01cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_01Cxxx_r),this)); + space.install_write_handler(0x01c000, 0x01cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_01Cxxx_w),this)); + space.install_read_handler(0xe0c000, 0xe0cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_E0Cxxx_r),this)); + space.install_write_handler(0xe0c000, 0xe0cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_E0Cxxx_w),this)); + space.install_read_handler(0xe1c000, 0xe1cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_E1Cxxx_r),this)); + space.install_write_handler(0xe1c000, 0xe1cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_E1Cxxx_w),this)); + + + /* install aux memory writes (for shadowing) */ + space.install_write_handler(0x010400, 0x0107FF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux0400_w), this)); + space.install_write_handler(0x012000, 0x013FFF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux2000_w), this)); + space.install_write_handler(0x014000, 0x019FFF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux4000_w), this)); + + /* setup the Apple II memory system */ + memset(&cfg, 0, sizeof(cfg)); + cfg.first_bank = 4; + cfg.memmap = apple2gs_memmap_entries; + cfg.auxmem = m_slowmem; + cfg.auxmem_length = 0x20000; + apple2_setup_memory(&cfg); +} + + + +/* ----------------------------------------------------------------------- + * Driver Init + * ----------------------------------------------------------------------- */ + +READ8_MEMBER(apple2gs_state::apple2gs_read_vector) +{ + return space.read_byte(offset | 0xFF0000); +} + +MACHINE_RESET_MEMBER(apple2gs_state,apple2gs) +{ + apple2gs_refresh_delegates(); + + // call "base class" machine reset to set up m_rambase and the language card + machine_reset(); + + m_cur_slot6_image = NULL; + m_newvideo = 0x00; + m_vgcint = 0x00; + m_langsel = 0x00; + m_sltromsel = 0x00; + m_cyareg = 0x80; + m_inten = 0x00; + m_intflag = 0x00; + m_shadow = 0x00; + m_pending_irqs = 0x00; + m_mouse_x = 0x00; + m_mouse_y = 0x00; + m_mouse_dx = 0x00; + m_mouse_dy = 0x00; + #if !RUN_ADB_MICRO + m_adb_state = ADBSTATE_IDLE; + m_adb_kmstatus = 0x00; + m_adb_command = 0; + m_adb_mode = 0; + m_adb_latent_result = 0; + m_adb_command_length = 0; + m_adb_command_pos = 0; + memset(m_adb_command_bytes, 0, sizeof(m_adb_command_bytes)); + memset(m_adb_response_bytes, 0, sizeof(m_adb_response_bytes)); + m_adb_response_length = 0; + m_adb_response_pos = 0; + memset(m_adb_memory, 0, sizeof(m_adb_memory)); + m_adb_address_keyboard = 2; + m_adb_address_mouse = 3; + #endif + + /* init time */ + m_clock_data = 0; + m_clock_control =0; + m_clock_read = 0; + m_clock_reg1 = 0; + m_clock_mode = CLOCKMODE_IDLE; + m_clock_curtime = 0; + m_clock_curtime_interval = 0; + + m_sndglu_ctrl = 0x00; + m_sndglu_addr = 0; + m_sndglu_dummy_read = 0; + + m_adb_dtime = 0; + m_last_adb_time = 0; +} + +MACHINE_START_MEMBER(apple2gs_state,apple2gscommon) +{ + apple2gs_refresh_delegates(); + + m_machinetype = APPLE_IIGS; + apple2eplus_init_common(NULL); + + /* set up Apple IIgs vectoring */ + m_maincpu->set_read_vector_callback(read8_delegate(FUNC(apple2gs_state::apple2gs_read_vector),this)); + + /* setup globals */ + m_is_rom3 = true; + + machine().device("nvram")->set_base(m_clock_bram, sizeof(m_clock_bram)); + + /* save state stuff. note that the driver takes care of docram. */ + UINT8* ram = m_ram->pointer(); + save_pointer(ram, "APPLE2GS_RAM", m_ram->size()); + + save_item(m_newvideo, "NEWVIDEO"); + save_item(m_bordercolor, "BORDERCOLOR"); + save_item(m_vgcint, "VGCINT"); + save_item(m_langsel, "LANGSEL"); + save_item(m_sltromsel, "SLTROMSEL"); + save_item(m_cyareg, "CYAREG"); + save_item(m_inten, "INTEN"); + save_item(m_intflag, "INTFLAG"); + save_item(m_shadow, "SHADOW"); + save_item(m_pending_irqs, "PENDIRQ"); + save_item(m_mouse_x, "MX"); + save_item(m_mouse_y, "MY"); + save_item(m_mouse_dx, "MDX"); + save_item(m_mouse_dy, "MDY"); + + save_item(m_clock_data, "CLKDATA"); + save_item(m_clock_control, "CLKCTRL"); + save_item(m_clock_read, "CLKRD"); + save_item(m_clock_reg1, "CLKREG1"); + save_item(m_clock_curtime, "CLKCURTIME"); + save_item(m_clock_curtime_interval, "CLKCURTIMEINT"); +// save_item(m_clock_mode, "CLKMODE"); + save_item(NAME(m_clock_bram)); +#if !RUN_ADB_MICRO + save_item(NAME(m_adb_memory)); + save_item(NAME(m_adb_command_bytes)); + save_item(NAME(m_adb_response_bytes)); +// save_item(m_adb_state, "ADB/m_adb_state"); + save_item(m_adb_command, "ADB/m_adb_command"); + save_item(m_adb_mode, "ADB/m_adb_mode"); + save_item(m_adb_kmstatus, "ADB/m_adb_kmstatus"); + save_item(m_adb_latent_result, "ADB/m_adb_latent_result"); + save_item(m_adb_command_length, "ADB/m_adb_command_length"); + save_item(m_adb_command_pos, "ADB/m_adb_command_pos"); + save_item(m_adb_response_length, "ADB/m_adb_response_length"); + save_item(m_adb_response_pos, "ADB/m_adb_response_pos"); + save_item(m_adb_address_keyboard, "ADB/m_adb_address_keyboard"); + save_item(m_adb_address_mouse, "ADB/m_adb_address_mouse"); +#endif + save_item(m_sndglu_ctrl, "SNDGLUCTRL"); + save_item(m_sndglu_addr, "SNDGLUADDR"); + save_item(m_sndglu_dummy_read, "SNDGLUDUMMYRD"); + + save_item(m_echo_bank, "ECHOBANK"); + + m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_clock_tick),this)); + m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + + m_qsecond_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_qsecond_tick),this)); + m_qsecond_timer->adjust(attotime::from_usec(266700), 0, attotime::from_usec(266700)); + + m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_scanline_tick),this)); + m_scanline_timer->adjust(attotime::never); + + // fire on scanline zero + m_scanline_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); +} + +MACHINE_START_MEMBER(apple2gs_state,apple2gs) +{ + MACHINE_START_CALL_MEMBER(apple2gscommon); + apple2gs_setup_memory(); +} + +MACHINE_START_MEMBER(apple2gs_state,apple2gsr1) +{ + MACHINE_START_CALL_MEMBER(apple2gscommon); + + m_is_rom3 = false; + apple2gs_setup_memory(); +} + +void apple2gs_state::apple2gs_refresh_delegates() +{ + write_delegates_2gs0400[0] = write8_delegate(FUNC(apple2gs_state::apple2gs_aux0400_w), this); + write_delegates_2gs0400[1] = write8_delegate(FUNC(apple2gs_state::apple2gs_main0400_w), this); + write_delegates_2gs2000[0] = write8_delegate(FUNC(apple2gs_state::apple2gs_aux2000_w), this); + write_delegates_2gs2000[1] = write8_delegate(FUNC(apple2gs_state::apple2gs_main2000_w), this); + write_delegates_2gs4000[0] = write8_delegate(FUNC(apple2gs_state::apple2gs_aux4000_w), this); + write_delegates_2gs4000[1] = write8_delegate(FUNC(apple2gs_state::apple2gs_main4000_w), this); +} + +/* ----------------------------------------------------------------------- + * Keym_glu / low-level ADB emulation + * ----------------------------------------------------------------------- */ +#if RUN_ADB_MICRO +UINT8 apple2gs_state::keyglu_mcu_read(UINT8 offset) +{ + UINT8 rv = m_glu_regs[offset]; + +// printf("MCU reads reg %x\n", offset); + + // the command full flag is cleared by the MCU reading + // first the KGS register and then the command register + if ((offset == GLU_COMMAND) && (m_glu_mcu_read_kgs)) + { + m_glu_regs[GLU_KG_STATUS] &= ~KGS_COMMAND_FULL; + m_glu_mcu_read_kgs = false; +// printf("MCU reads COMMAND = %02x (drop command full)\n", rv); + } + + // prime for the next command register read to clear the command full flag + if (offset == GLU_KG_STATUS) + { + m_glu_mcu_read_kgs = true; + } + + return rv; +} + +void apple2gs_state::keyglu_mcu_write(UINT8 offset, UINT8 data) +{ + m_glu_regs[offset] = data; + +// printf("MCU writes %02x to reg %x\n", data, offset); + + switch (offset) + { + case GLU_MOUSEX: + case GLU_MOUSEY: + m_glu_regs[GLU_KG_STATUS] |= KGS_MOUSEX_FULL; + m_glu_mouse_read_stat = false; // signal next read will be mouse X + break; + + case GLU_ANY_KEY_DOWN: // bit 7 is the actual flag here; both MCU programs write either 0x7f or 0xff +// printf("%d to ANY_KEY_DOWN (PC=%x)\n", data, m_adbmicro->pc()); + if (data & 0x80) + { + m_glu_regs[GLU_KG_STATUS] |= KGS_ANY_KEY_DOWN | KGS_KEYSTROBE; + } + break; + + case GLU_DATA: + m_glu_regs[GLU_KG_STATUS] |= KGS_DATA_FULL; + m_glu_816_read_dstat = false; +// printf("MCU writes %02x to DATA\n", data); + break; + } +} + +/* + Keym_glu registers map as follows on the 816: + + C000 = key data + any key down, clears strobe + C010 = clears keystrobe + + C024 MOUSEDATA = reads GLU mouseX and mouseY + C025 KEYMODREG = reads GLU keymod register + C026 DATAREG = writes from the 816 go to COMMAND, reads from DATA + C027 KMSTATUS = GLU system status register + +*/ +UINT8 apple2gs_state::keyglu_816_read(UINT8 offset) +{ + switch (offset) + { + case GLU_C000: + { + UINT8 rv; + rv = m_glu_regs[GLU_KEY_DATA] & 0x7f; + if (m_glu_regs[GLU_KG_STATUS] & KGS_KEYSTROBE) + { + rv |= 0x80; + } + return rv; + } + break; + + case GLU_C010: + { + UINT8 rv; + rv = m_glu_regs[GLU_KEY_DATA] & 0x7f; + if (m_glu_regs[GLU_KG_STATUS] & KGS_KEYSTROBE) + { + rv |= 0x80; + } + m_glu_regs[GLU_KG_STATUS] &= ~KGS_KEYSTROBE; + return rv; + } + break; + + case GLU_MOUSEX: + case GLU_MOUSEY: + if (!m_glu_mouse_read_stat) + { + m_glu_mouse_read_stat = 1; + return m_glu_regs[GLU_MOUSEY]; + } + return m_glu_regs[GLU_MOUSEX]; + + case GLU_SYSSTAT: + // regenerate sysstat bits + m_glu_sysstat &= ~0xab; // mask off read/write bits + if (m_glu_regs[GLU_KG_STATUS] & KGS_COMMAND_FULL) + { + m_glu_sysstat |= 1; + } + if (m_glu_regs[GLU_KG_STATUS] & m_glu_mouse_read_stat) + { + m_glu_sysstat |= 2; + } + if (m_glu_regs[GLU_KG_STATUS] & KGS_KEYSTROBE) + { + m_glu_sysstat |= 8; + } + if (m_glu_regs[GLU_KG_STATUS] & KGS_DATA_FULL) + { + m_glu_sysstat |= 0x20; + } + if (m_glu_regs[GLU_KG_STATUS] & KGS_MOUSEX_FULL) + { + m_glu_sysstat |= 0x80; + } + m_glu_816_read_dstat = true; +// printf("816 gets %02x in sysstat (data avail %02x)\n", m_glu_sysstat, m_glu_sysstat & 0x20); + return m_glu_sysstat; + + case GLU_DATA: + if (m_glu_816_read_dstat) + { + m_glu_816_read_dstat = false; + m_glu_regs[GLU_KG_STATUS] &= ~KGS_DATA_FULL; +// printf("816 reads %02x from DATA\n", m_glu_regs[GLU_DATA]); + } + return m_glu_regs[GLU_DATA]; + + default: + return m_glu_regs[offset]; + break; + } + + return 0xff; +} + +void apple2gs_state::keyglu_816_write(UINT8 offset, UINT8 data) +{ + if (offset < GLU_C000) + { + m_glu_regs[offset&7] = data; + } + + switch (offset) + { + case GLU_C010: + m_glu_regs[GLU_KG_STATUS] &= ~KGS_KEYSTROBE; + break; + + case GLU_COMMAND: +// printf("816 sets COMMAND to %02x (raise command full)\n", data); + m_glu_regs[GLU_KG_STATUS] |= KGS_COMMAND_FULL; + break; + + case GLU_SYSSTAT: + m_glu_sysstat &= 0xab; // clear the non-read-only fields + m_glu_sysstat |= (data & ~0xab); + break; + } +} +#endif diff --git a/src/mame/machine/apple3.c b/src/mame/machine/apple3.c new file mode 100644 index 00000000000..8df76e3de4a --- /dev/null +++ b/src/mame/machine/apple3.c @@ -0,0 +1,1301 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,R. Belmont +/*************************************************************************** + + machine/apple3.c + + Apple /// + + VIA #0 (D VIA) + CA1: IRQ from the MM58167 RTC + CA2: 1 if key pressed, 0 otherwise + CB1/CB2: connected to VBL + + Port A: Environment register (all bits out) + bit 7: 1 for 1 MHz, 0 for 2 MHz + bit 6: 1 for I/O at C000-CFFF + bit 5: 1 to enable video + bit 4: 1 to enable NMI/Reset + bit 3: 1 to write-protect RAM in system bank C000-FFFF + bit 2: 1 to force primary stack at 0100-01FF + bit 1: 1 for primary ROM, 0 for secondary (Apple III doesn't have a secondary ROM, so this should always be '1' when bit 0 is) + bit 0: 1 to enable ROM in F000-FFFF + + Port B: Zero page high 8 address bits, also MM58167 RTC register select (all bits out) + + VIA #1 (E VIA) + CA1: OR of all 4 slots' IRQ status + CA2: SW1 (Open Apple key?) + CB1: SW3/SCO + CB2: SER + + Port A: + bits 0-2: bank select for $2000-$9FFF range + bit 3: n/c + bit 4: slot 4 IRQ (in) + bit 5: slot 3 IRQ (in) + bit 6: Apple II mode trap output (out) + bit 7: IRQ status (in) (0 = IRQ, 1 = no IRQ) + + Port B: + bits 0-5: 6-bit audio DAC output + bit 6: screen blank + bit 7: OR of NMI from slots + +***************************************************************************/ + +#include "emu.h" +#include "includes/apple3.h" +#include "includes/apple2.h" + +#define LOG_MEMORY 1 +#define LOG_INDXADDR 1 + +#define ENV_SLOWSPEED (0x80) +#define ENV_IOENABLE (0x40) +#define ENV_VIDENABLE (0x20) +#define ENV_NMIENABLE (0x10) +#define ENV_WRITEPROT (0x08) +#define ENV_STACK1XX (0x04) +#define ENV_PRIMARYROM (0x02) +#define ENV_ROMENABLE (0x01) + +READ8_MEMBER(apple3_state::apple3_c0xx_r) +{ + UINT8 result = 0xFF; + device_a2bus_card_interface *slotdevice; + + switch(offset) + { + /* keystrobe */ + case 0x00: case 0x01: case 0x02: case 0x03: + case 0x04: case 0x05: case 0x06: case 0x07: + result = (m_transchar & 0x7f) | m_strobe; + break; + + /* modifier keys */ + case 0x08: case 0x09: case 0x0A: case 0x0B: + case 0x0C: case 0x0D: case 0x0E: case 0x0F: + { + UINT8 tmp = m_kbspecial->read(); + + result = 0x7c | (m_transchar & 0x80); + + if (m_strobe) + { + result |= 1; + } + + if (tmp & 0x06) + { + result |= 0x02; + } + if (tmp & 0x08) + { + result &= ~0x04; + } + if (tmp & 0x01) + { + result &= ~0x08; + } + if (tmp & 0x10) + { + result &= ~0x10; + } + if (tmp & 0x20) + { + result &= ~0x20; + } + } +// printf("modifier = %02x\n", result); + break; + + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1A: case 0x1B: + case 0x1C: case 0x1D: case 0x1E: case 0x1F: + m_strobe = 0; + break; + + case 0x20: case 0x21: case 0x22: case 0x23: + case 0x24: case 0x25: case 0x26: case 0x27: + case 0x28: case 0x29: case 0x2A: case 0x2B: + case 0x2C: case 0x2D: case 0x2E: case 0x2F: + m_cnxx_slot = -1; + break; + + case 0x30: case 0x31: case 0x32: case 0x33: + case 0x34: case 0x35: case 0x36: case 0x37: + case 0x38: case 0x39: case 0x3A: case 0x3B: + case 0x3C: case 0x3D: case 0x3E: case 0x3F: + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + break; + + case 0x40: case 0x41: case 0x42: case 0x43: + case 0x44: case 0x45: case 0x46: case 0x47: + case 0x48: case 0x49: case 0x4A: case 0x4B: + case 0x4C: case 0x4D: case 0x4E: case 0x4F: + m_c040_time = 200; + break; + + case 0x50: case 0x51: case 0x52: case 0x53: + case 0x54: case 0x55: case 0x56: case 0x57: + /* graphics softswitches */ + if (offset & 1) + m_flags |= 1 << ((offset - 0x50) / 2); + else + m_flags &= ~(1 << ((offset - 0x50) / 2)); + break; + + case 0x58: + case 0x59: + case 0x5a: + case 0x5b: + case 0x5c: + case 0x5d: + case 0x5e: + case 0x5f: + pdl_handler(offset); + break; + + case 0x60: // joystick switch 0 + case 0x68: + result = (m_joybuttons->read() & 1) ? 0x80 : 0x00; + break; + + case 0x61: // joystick switch 1 (margin switch for Silentype) + case 0x69: + result = (m_joybuttons->read() & 4) ? 0x80 : 0x00; + break; + + case 0x62: // joystick switch 2 + case 0x6a: + result = (m_joybuttons->read() & 2) ? 0x80 : 0x00; + break; + + case 0x63: // joystick switch 3 (serial clock for silentype) + case 0x6b: + result = (m_joybuttons->read() & 8) ? 0x80 : 0x00; + break; + + case 0x66: // paddle A/D conversion done (bit 7 = 1 while counting, 0 when done) + case 0x6e: + result = m_ramp_active ? 0x80 : 0x00; + break; + + case 0x70: case 0x71: case 0x72: case 0x73: + case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7A: case 0x7B: + case 0x7C: case 0x7D: case 0x7E: case 0x7F: + result = m_rtc->read(space, m_via_0_b); + break; + + case 0x90: case 0x91: case 0x92: case 0x93: + case 0x94: case 0x95: case 0x96: case 0x97: + case 0x98: case 0x99: case 0x9a: case 0x9b: + case 0x9c: case 0x9d: case 0x9e: case 0x9f: + slotdevice = m_a2bus->get_a2bus_card(1); + if (slotdevice != NULL) + { + result = slotdevice->read_c0nx(space, offset&0xf); + } + break; + + case 0xa0: case 0xa1: case 0xa2: case 0xa3: + case 0xa4: case 0xa5: case 0xa6: case 0xa7: + case 0xa8: case 0xa9: case 0xaa: case 0xab: + case 0xac: case 0xad: case 0xae: case 0xaf: + slotdevice = m_a2bus->get_a2bus_card(2); + if (slotdevice != NULL) + { + result = slotdevice->read_c0nx(space, offset&0xf); + } + break; + + case 0xb0: case 0xb1: case 0xb2: case 0xb3: + case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: + case 0xbc: case 0xbd: case 0xbe: case 0xbf: + slotdevice = m_a2bus->get_a2bus_card(3); + if (slotdevice != NULL) + { + result = slotdevice->read_c0nx(space, offset&0xf); + } + break; + + case 0xc0: case 0xc1: case 0xc2: case 0xc3: + case 0xc4: case 0xc5: case 0xc6: case 0xc7: + case 0xc8: case 0xc9: case 0xca: case 0xcb: + case 0xcc: case 0xcd: case 0xce: case 0xcf: + slotdevice = m_a2bus->get_a2bus_card(4); + if (slotdevice != NULL) + { + result = slotdevice->read_c0nx(space, offset&0xf); + } + break; + + case 0xD0: case 0xD1: case 0xD2: case 0xD3: + case 0xD4: case 0xD5: case 0xD6: case 0xD7: + /* external drive stuff */ + m_fdc->read_c0dx(space, offset&0xf); + result = 0x00; + break; + + case 0xd8: case 0xd9: + m_smoothscr = offset & 1; + break; + + case 0xDB: + apple3_write_charmem(); + break; + + case 0xE0: case 0xE1: + result = m_fdc->read(space, offset&0xf); + m_va = offset & 1; + break; + + case 0xE2: case 0xE3: + result = m_fdc->read(space, offset&0xf); + m_vb = offset & 1; + break; + + case 0xE4: case 0xE5: + result = m_fdc->read(space, offset&0xf); + m_vc = offset & 1; + break; + + case 0xE6: case 0xE7: case 0xE8: case 0xE9: + case 0xEA: case 0xEB: case 0xEC: case 0xED: + case 0xEE: case 0xEF: + result = m_fdc->read(space, offset&0xf); + break; + + case 0xF0: + case 0xF1: + case 0xF2: + case 0xF3: + result = m_acia->read(space, offset & 0x03); + break; + } + return result; +} + + + +WRITE8_MEMBER(apple3_state::apple3_c0xx_w) +{ + device_a2bus_card_interface *slotdevice; + + switch(offset) + { + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1A: case 0x1B: + case 0x1C: case 0x1D: case 0x1E: case 0x1F: + m_strobe = 0; + break; + + case 0x20: case 0x21: case 0x22: case 0x23: + case 0x24: case 0x25: case 0x26: case 0x27: + case 0x28: case 0x29: case 0x2A: case 0x2B: + case 0x2C: case 0x2D: case 0x2E: case 0x2F: + m_cnxx_slot = -1; + break; + + case 0x30: case 0x31: case 0x32: case 0x33: + case 0x34: case 0x35: case 0x36: case 0x37: + case 0x38: case 0x39: case 0x3A: case 0x3B: + case 0x3C: case 0x3D: case 0x3E: case 0x3F: + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + break; + + case 0x40: case 0x41: case 0x42: case 0x43: + case 0x44: case 0x45: case 0x46: case 0x47: + case 0x48: case 0x49: case 0x4A: case 0x4B: + case 0x4C: case 0x4D: case 0x4E: case 0x4F: + m_c040_time = 200; + break; + + case 0x50: case 0x51: case 0x52: case 0x53: + case 0x54: case 0x55: case 0x56: case 0x57: + /* graphics softswitches */ + if (offset & 1) + m_flags |= 1 << ((offset - 0x50) / 2); + else + m_flags &= ~(1 << ((offset - 0x50) / 2)); + break; + + case 0x58: + case 0x59: + case 0x5a: + case 0x5b: + case 0x5c: + case 0x5d: + case 0x5e: + case 0x5f: + pdl_handler(offset); + break; + + case 0x70: case 0x71: case 0x72: case 0x73: + case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7A: case 0x7B: + case 0x7C: case 0x7D: case 0x7E: case 0x7F: + m_rtc->write(space, m_via_0_b, data); + break; + + + case 0x90: case 0x91: case 0x92: case 0x93: + case 0x94: case 0x95: case 0x96: case 0x97: + case 0x98: case 0x99: case 0x9a: case 0x9b: + case 0x9c: case 0x9d: case 0x9e: case 0x9f: + slotdevice = m_a2bus->get_a2bus_card(1); + if (slotdevice != NULL) + { + slotdevice->write_c0nx(space, offset&0xf, data); + } + break; + + case 0xa0: case 0xa1: case 0xa2: case 0xa3: + case 0xa4: case 0xa5: case 0xa6: case 0xa7: + case 0xa8: case 0xa9: case 0xaa: case 0xab: + case 0xac: case 0xad: case 0xae: case 0xaf: + slotdevice = m_a2bus->get_a2bus_card(2); + if (slotdevice != NULL) + { + slotdevice->write_c0nx(space, offset&0xf, data); + } + break; + + case 0xb0: case 0xb1: case 0xb2: case 0xb3: + case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: + case 0xbc: case 0xbd: case 0xbe: case 0xbf: + slotdevice = m_a2bus->get_a2bus_card(3); + if (slotdevice != NULL) + { + slotdevice->write_c0nx(space, offset&0xf, data); + } + break; + + case 0xc0: case 0xc1: case 0xc2: case 0xc3: + case 0xc4: case 0xc5: case 0xc6: case 0xc7: + case 0xc8: case 0xc9: case 0xca: case 0xcb: + case 0xcc: case 0xcd: case 0xce: case 0xcf: + slotdevice = m_a2bus->get_a2bus_card(4); + if (slotdevice != NULL) + { + slotdevice->write_c0nx(space, offset&0xf, data); + } + break; + + case 0xD0: case 0xD1: case 0xD2: case 0xD3: + case 0xD4: case 0xD5: case 0xD6: case 0xD7: + /* external drive stuff */ + m_fdc->write_c0dx(space, offset&0xf, data); + break; + + case 0xd9: + popmessage("Smooth scroll enabled, contact MESSdev"); + break; + + case 0xDB: + apple3_write_charmem(); + break; + + case 0xE0: case 0xE1: case 0xE2: case 0xE3: + case 0xE4: case 0xE5: case 0xE6: case 0xE7: + case 0xE8: case 0xE9: case 0xEA: case 0xEB: + case 0xEC: case 0xED: case 0xEE: case 0xEF: + m_fdc->write(space, offset&0xf, data); + break; + + case 0xF0: + case 0xF1: + case 0xF2: + case 0xF3: + m_acia->write(space, offset & 0x03, data); + break; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(apple3_state::apple3_interrupt) +{ + m_via_1->write_cb1(machine().first_screen()->vblank()); + m_via_1->write_cb2(machine().first_screen()->vblank()); +} + +UINT8 *apple3_state::apple3_bankaddr(UINT16 bank, offs_t offset) +{ + if (bank != (UINT16) ~0) + { + bank %= m_ram->size() / 0x8000; + if ((bank + 1) == (m_ram->size() / 0x8000)) + bank = 0x02; + } + offset += ((offs_t) bank) * 0x8000; + offset %= m_ram->size(); + return &m_ram->pointer()[offset]; +} + +UINT8 *apple3_state::apple3_get_zpa_addr(offs_t offset) +{ + m_zpa = (((offs_t) m_via_0_b) * 0x100) + offset; + + if (m_via_0_b < 0x20) + return apple3_bankaddr(~0, m_zpa); + else if (m_via_0_b > 0x9F) + return apple3_bankaddr(~0, m_zpa - 0x8000); + else + return apple3_bankaddr(m_via_1_a, m_zpa - 0x2000); +} + +void apple3_state::apple3_update_memory() +{ + UINT16 bank; + UINT8 page; + + if (LOG_MEMORY) + { + logerror("apple3_update_memory(): via_0_b=0x%02x via_1_a=0x0x%02x\n", m_via_0_b, m_via_1_a); + } + + machine().device("maincpu")->set_unscaled_clock((m_via_0_a & ENV_SLOWSPEED) ? 1021800 : 2000000); + + /* bank 2 (0100-01FF) */ + if (!(m_via_0_a & ENV_STACK1XX)) + { + if (m_via_0_b < 0x20) + { + bank = ~0; /* system bank */ + page = m_via_0_b ^ 0x01; + } + else if (m_via_0_b >= 0xA0) + { + bank = ~0; /* system bank */ + page = (m_via_0_b ^ 0x01) - 0x80; + } + else + { + bank = m_via_1_a; + page = (m_via_0_b ^ 0x01) - 0x20; + } + } + else + { + bank = ~0; + page = 0x01; + } + m_bank2 = apple3_bankaddr(bank, ((offs_t) page) * 0x100); + + /* bank 3 (0200-1FFF) */ + m_bank3 = apple3_bankaddr(~0, 0x0200); + + /* bank 4 (2000-9FFF) */ + m_bank4 = apple3_bankaddr(m_via_1_a, 0x0000); + + /* bank 5 (A000-BFFF) */ + m_bank5 = apple3_bankaddr(~0, 0x2000); + + /* bank 8 (C000-C0FF) */ + if (!(m_via_0_a & ENV_IOENABLE)) + { + m_bank8 = apple3_bankaddr(~0, 0x4000); + } + + /* bank 9 (C100-C4FF) */ + if (!(m_via_0_a & ENV_IOENABLE)) + { + m_bank9 = apple3_bankaddr(~0, 0x4100); + } + + /* bank 10 (C500-C7FF) */ + m_bank10 = apple3_bankaddr(~0, 0x4500); + + /* bank 11 (C800-CFFF) */ + if (!(m_via_0_a & ENV_IOENABLE)) + { + m_bank11 = apple3_bankaddr(~0, 0x4800); + } + + /* install bank 6 (D000-EFFF) */ + m_bank6 = apple3_bankaddr(~0, 0x5000); + + /* install bank 7 (F000-FFFF) */ + m_bank7wr = apple3_bankaddr(~0, 0x7000); + if (m_via_0_a & ENV_ROMENABLE) + { + m_bank7rd = memregion("maincpu")->base(); + } + else + { + m_rom_has_been_disabled = true; + m_bank7rd = m_bank7wr; + + // if we had an IRQ waiting for RAM to be paged in... + apple3_irq_update(); + } +} + + + +void apple3_state::apple3_via_out(UINT8 *var, UINT8 data) +{ + if (*var != data) + { + *var = data; + apple3_update_memory(); + } +} + + +WRITE8_MEMBER(apple3_state::apple3_via_0_out_a) +{ + apple3_via_out(&m_via_0_a, data); +} + +WRITE8_MEMBER(apple3_state::apple3_via_0_out_b) +{ +// printf("ZP to %02x\n", data); + apple3_via_out(&m_via_0_b, data); +} + +WRITE8_MEMBER(apple3_state::apple3_via_1_out_a) +{ + apple3_via_out(&m_via_1_a, data); +} + +WRITE8_MEMBER(apple3_state::apple3_via_1_out_b) +{ + m_dac->write_unsigned8(data<<2); + apple3_via_out(&m_via_1_b, data); +} + +void apple3_state::apple3_irq_update() +{ + if (m_acia_irq || m_via_1_irq || m_via_0_irq) + { + // HACK: SOS floppy driver enables ROM at Fxxx *before* trying to + // suppress IRQs. IRQ hits at inopportune time -> bad vector -> system crash. + // This breaks the Confidence Test, but the Confidence Test + // never disables the ROM so checking for that gets us + // working in all cases. + // Bonus points: for some reason this isn't a problem with -debug. + // m6502 heisenbug maybe? + if ((m_via_0_a & ENV_ROMENABLE) && (m_rom_has_been_disabled)) + { + return; + } +// printf(" setting IRQ\n"); + m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + m_via_1->write_pa7(0); // this is active low + } + else + { +// printf(" clearing IRQ\n"); + m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); + m_via_1->write_pa7(1); + } +} + +WRITE_LINE_MEMBER(apple3_state::apple3_acia_irq_func) +{ +// printf("acia IRQ: %d\n", state); + m_acia_irq = state; + apple3_irq_update(); +} + +WRITE_LINE_MEMBER(apple3_state::apple3_via_1_irq_func) +{ +// printf("via 1 IRQ: %d\n", state); + m_via_1_irq = state; + apple3_irq_update(); +} + + +WRITE_LINE_MEMBER(apple3_state::apple3_via_0_irq_func) +{ +// printf("via 0 IRQ: %d\n", state); + m_via_0_irq = state; + apple3_irq_update(); +} + +MACHINE_RESET_MEMBER(apple3_state,apple3) +{ + m_indir_bank = 0; + m_sync = false; + m_speaker_state = 0; + m_speaker->level_w(0); + m_c040_time = 0; + m_strobe = 0; + m_lastchar = 0x0d; + m_rom_has_been_disabled = false; + m_cnxx_slot = -1; + m_analog_sel = 0; + m_ramp_active = false; + + m_fdc->set_floppies_4(floppy0, floppy1, floppy2, floppy3); +} + + + +UINT8 *apple3_state::apple3_get_indexed_addr(offs_t offset) +{ + UINT8 *result = NULL; + + // m_indir_bank is guaranteed to be between 0x80 and 0x8f + if (m_indir_bank == 0x8f) + { + /* get at that special ram under the VIAs */ + if ((offset >= 0xFFD0) && (offset <= 0xFFEF)) + result = apple3_bankaddr(~0, offset & 0x7FFF); + else if (offset < 0x2000) + result = apple3_bankaddr(~0, offset - 0x2000); + else if (offset > 0x9FFF) + result = apple3_bankaddr(~0, offset - 0x8000); + else + result = &m_ram->pointer()[offset - 0x2000]; + } + else + { + result = apple3_bankaddr(m_indir_bank, offset); + } + + return result; +} + +DRIVER_INIT_MEMBER(apple3_state,apple3) +{ + m_enable_mask = 0; + + m_flags = 0; + m_acia_irq = 0; + m_via_0_a = ~0; + m_via_1_a = ~0; + m_via_0_irq = 0; + m_via_1_irq = 0; + m_va = 0; + m_vb = 0; + m_vc = 0; + m_smoothscr = 0; + + // kludge round +12v pull up resistors, which after conversion will bring this low when nothing is plugged in. issue also affects dcd/dsr but those don't affect booting. + m_acia->write_cts(0); + + /* these are here to appease the Apple /// confidence tests */ + m_via_1->write_pa0(1); + m_via_1->write_pa1(1); + m_via_1->write_pa2(1); + m_via_1->write_pa3(1); + m_via_1->write_pa4(1); + m_via_1->write_pa5(1); + m_via_1->write_pa6(1); + m_via_1->write_pa7(1); + + m_via_1->write_pb0(1); + m_via_1->write_pb1(1); + m_via_1->write_pb2(1); + m_via_1->write_pb3(1); + m_via_1->write_pb4(1); + m_via_1->write_pb5(1); + m_via_1->write_pb6(1); + m_via_1->write_pb7(1); + + apple3_update_memory(); + + save_item(NAME(m_acia_irq)); + save_item(NAME(m_via_0_a)); + save_item(NAME(m_via_0_b)); + save_item(NAME(m_via_1_a)); + save_item(NAME(m_via_1_b)); + save_item(NAME(m_via_0_irq)); + save_item(NAME(m_via_1_irq)); + save_item(NAME(m_zpa)); + save_item(NAME(m_last_n)); + save_item(NAME(m_sync)); + save_item(NAME(m_rom_has_been_disabled)); + save_item(NAME(m_indir_bank)); + save_item(NAME(m_cnxx_slot)); + save_item(NAME(m_speaker_state)); + save_item(NAME(m_c040_time)); + save_item(NAME(m_lastchar)); + save_item(NAME(m_strobe)); + save_item(NAME(m_transchar)); + save_item(NAME(m_flags)); + save_item(NAME(m_char_mem)); + save_item(NAME(m_analog_sel)); + save_item(NAME(m_ramp_active)); + save_item(NAME(m_pdl_charge)); + save_item(NAME(m_va)); + save_item(NAME(m_vb)); + save_item(NAME(m_vc)); + save_item(NAME(m_smoothscr)); + + machine().save().register_postload(save_prepost_delegate(FUNC(apple3_state::apple3_postload), this)); +} + +void apple3_state::apple3_postload() +{ + apple3_update_memory(); +} + +READ8_MEMBER(apple3_state::apple3_memory_r) +{ + UINT8 rv = 0xff; + + // (zp), y or (zp,x) read + if (!space.debugger_access()) + { + if ((m_indir_bank & 0x80) && (offset >= 0x100)) + { + UINT8 *test; + test = apple3_get_indexed_addr(offset); + + if (test) + { + return *test; + } + } + } + + if (offset < 0x100) + { + rv = *apple3_get_zpa_addr(offset); + + if ((!m_sync) && (m_via_0_b >= 0x18) && (m_via_0_b <= 0x1F)) + { + // fetch the "X byte" + m_indir_bank = *apple3_bankaddr(~0, m_zpa ^ 0x0C00) & 0x8f; + } + } + else if (offset < 0x200) + { + rv = m_bank2[offset-0x100]; + } + else if (offset < 0x2000) + { + rv = m_bank3[offset-0x200]; + } + else if (offset < 0xa000) + { + rv = m_bank4[offset-0x2000]; + } + else if (offset < 0xc000) + { + rv = m_bank5[offset-0xa000]; + } + else if (offset < 0xc100) + { + if (m_via_0_a & ENV_IOENABLE) + { + if (!space.debugger_access()) + { + rv = apple3_c0xx_r(space, offset-0xc000); + } + } + else + { + rv = m_bank8[offset - 0xc000]; + } + } + else if (offset < 0xc500) + { + if (!(m_via_0_a & ENV_IOENABLE)) + { + rv = m_bank9[offset - 0xc100]; + } + else + { + /* now identify the device */ + device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card((offset>>8) & 0x7); + + if (slotdevice != NULL) + { + if (slotdevice->take_c800()) + { + m_cnxx_slot = ((offset>>8) & 7); + } + + return slotdevice->read_cnxx(space, offset&0xff); + } + } + } + else if (offset < 0xc800) + { + rv = m_bank10[offset - 0xc500]; + } + else if (offset < 0xd000) + { + if (!(m_via_0_a & ENV_IOENABLE)) + { + rv = m_bank11[offset - 0xc800]; + } + else + { + if (offset == 0xcfff) + { + m_cnxx_slot = -1; + } + + if (m_cnxx_slot != -1) + { + device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card(m_cnxx_slot); + + if (slotdevice != NULL) + { + rv = slotdevice->read_c800(space, offset&0x7ff); + } + } + } + } + else if (offset < 0xf000) + { + rv = m_bank6[offset - 0xd000]; + } + else + { + if (offset >= 0xffd0 && offset <= 0xffdf) + { + rv = m_via_0->read(space, offset); + } + else if (offset >= 0xffe0 && offset <= 0xffef) + { + rv = m_via_1->read(space, offset); + } + else + { + rv = m_bank7rd[offset - 0xf000]; + } + } + + return rv; +} + +WRITE8_MEMBER(apple3_state::apple3_memory_w) +{ + if ((m_indir_bank & 0x80) && (offset >= 0x100)) + { + UINT8 *test; + test = apple3_get_indexed_addr(offset); + + if (test) + { + *test = data; + return; + } + } + + if (offset < 0x100) + { + *apple3_get_zpa_addr(offset) = data; + } + else if (offset < 0x200) + { + m_bank2[offset-0x100] = data; + } + else if (offset < 0x2000) + { + m_bank3[offset-0x200] = data; + } + else if (offset < 0xa000) + { + m_bank4[offset-0x2000] = data; + } + else if (offset < 0xc000) + { + m_bank5[offset-0xa000] = data; + } + else if (offset < 0xc100) + { + if (m_via_0_a & ENV_IOENABLE) + { + if (!space.debugger_access()) + { + apple3_c0xx_w(space, offset-0xc000, data); + } + } + else + { + // is this page write protected? + if (!(m_via_0_a & ENV_WRITEPROT)) + { + m_bank8[offset - 0xc000] = data; + } + } + } + else if (offset < 0xc500) + { + if (!(m_via_0_a & ENV_IOENABLE)) + { + if (!(m_via_0_a & ENV_WRITEPROT)) + { + m_bank9[offset - 0xc100] = data; + } + } + else + { + /* now identify the device */ + device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card((offset>>8) & 0x7); + + if (slotdevice != NULL) + { + if (slotdevice->take_c800()) + { + m_cnxx_slot = ((offset>>8) & 7); + } + + slotdevice->write_cnxx(space, offset&0xff, data); + } + } + } + else if (offset < 0xc800) + { + if (!(m_via_0_a & ENV_WRITEPROT)) + { + m_bank10[offset - 0xc500] = data; + } + } + else if (offset < 0xd000) + { + if (!(m_via_0_a & ENV_IOENABLE)) + { + if (!(m_via_0_a & ENV_WRITEPROT)) + { + m_bank11[offset - 0xc800] = data; + } + } + else + { + if (offset == 0xcfff) + { + m_cnxx_slot = -1; + } + + if (m_cnxx_slot != -1) + { + device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card(m_cnxx_slot); + + if (slotdevice != NULL) + { + slotdevice->write_c800(space, offset&0x7ff, data); + } + } + } + } + else if (offset < 0xf000) + { + if (!(m_via_0_a & ENV_WRITEPROT)) + { + m_bank6[offset - 0xd000] = data; + } + } + else + { + if (offset >= 0xffd0 && offset <= 0xffdf) + { + if (!space.debugger_access()) + { + m_via_0->write(space, offset, data); + } + } + else if (offset >= 0xffe0 && offset <= 0xffef) + { + if (!space.debugger_access()) + { + m_via_1->write(space, offset, data); + } + } + else + { + if (!(m_via_0_a & ENV_WRITEPROT)) + { + m_bank7wr[offset - 0xf000] = data; + } + } + } +} + +WRITE_LINE_MEMBER(apple3_state::apple3_sync_w) +{ +// printf("sync: %d\n", state); + m_sync = (state == ASSERT_LINE) ? true : false; + + if (m_sync) + { + m_indir_bank = 0; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(apple3_state::apple3_c040_tick) +{ + if (m_c040_time > 0) + { + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + m_c040_time--; + } +} + +READ_LINE_MEMBER(apple3_state::ay3600_shift_r) +{ + // either shift key + if (m_kbspecial->read() & 0x06) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +READ_LINE_MEMBER(apple3_state::ay3600_control_r) +{ + if (m_kbspecial->read() & 0x08) + { + return ASSERT_LINE; + } + + return CLEAR_LINE; +} + +static const UINT8 key_remap[0x50][4] = +{ +/* norm shft ctrl both */ + { 0x9b,0x9b,0x9b,0x9b }, /* Escape 00 */ + { 0x31,0x21,0x31,0x31 }, /* 1 ! 01 */ + { 0x32,0x40,0x32,0x00 }, /* 2 @ 02 */ + { 0x33,0x23,0x33,0x23 }, /* 3 # 03 */ + { 0x34,0x24,0x34,0x24 }, /* 4 $ 04 */ + { 0x35,0x25,0x35,0x25 }, /* 5 % 05 */ + { 0x36,0x5e,0x35,0x53 }, /* 6 ^ 06 */ + { 0x37,0x26,0x37,0x26 }, /* 7 & 07 */ + { 0x38,0x2a,0x38,0x2a }, /* 8 * 08 */ + { 0x39,0x28,0x39,0x28 }, /* 9 ( 09 */ + { 0x89,0x89,0x89,0x89 }, /* Tab 0a */ + { 0x51,0x51,0x11,0x11 }, /* q Q 0b */ + { 0x57,0x57,0x17,0x17 }, /* w W 0c */ + { 0x45,0x45,0x05,0x05 }, /* e E 0d */ + { 0x52,0x52,0x12,0x12 }, /* r R 0e */ + { 0x54,0x54,0x14,0x14 }, /* t T 0f */ + { 0x59,0x59,0x19,0x19 }, /* y Y 10 */ + { 0x55,0x55,0x15,0x15 }, /* u U 11 */ + { 0x49,0x49,0x09,0x09 }, /* i I 12 */ + { 0x4f,0x4f,0x0f,0x0f }, /* o O 13 */ + { 0x41,0x41,0x01,0x01 }, /* a A 14 */ + { 0x53,0x53,0x13,0x13 }, /* s S 15 */ + { 0x44,0x44,0x04,0x04 }, /* d D 16 */ + { 0x46,0x46,0x06,0x06 }, /* f F 17 */ + { 0x48,0x48,0x08,0x08 }, /* h H 18 */ + { 0x47,0x47,0x07,0x07 }, /* g G 19 */ + { 0x4a,0x4a,0x0a,0x0a }, /* j J 1a */ + { 0x4b,0x4b,0x0b,0x0b }, /* k K 1b */ + { 0x3b,0x3a,0x3b,0x3a }, /* ; : 1c */ + { 0x4c,0x4c,0x0c,0x0c }, /* l L 1d */ + { 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */ + { 0x58,0x58,0x18,0x18 }, /* x X 1f */ + { 0x43,0x43,0x03,0x03 }, /* c C 20 */ + { 0x56,0x56,0x16,0x16 }, /* v V 21 */ + { 0x42,0x42,0x02,0x02 }, /* b B 22 */ + { 0x4e,0x4e,0x0e,0x0e }, /* n N 23 */ + { 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */ + { 0x2c,0x3c,0x2c,0x3c }, /* , < 25 */ + { 0x2e,0x3e,0x2e,0x3e }, /* . > 26 */ + { 0x2f,0x3f,0x2f,0x3f }, /* / ? 27 */ + { 0x00,0x00,0x00,0x00 }, /* 0x28 unused */ + { 0xb9,0xb9,0xb9,0xb9 }, /* 9 (KP) 29 */ + { 0x00,0x00,0x00,0x00 }, /* 0x2a unused */ + { 0xb8,0xb8,0xb8,0xb8 }, /* 8 (KP) 2b */ + { 0x00,0x00,0x00,0x00 }, /* 0x2c unused */ + { 0xb7,0xb7,0xb7,0xb7 }, /* 7 (KP) 2d */ + { 0x5c,0x7c,0x7f,0x1c }, /* \ | 2e */ + { 0x3d,0x2b,0x3d,0x2b }, /* = + 2f */ + { 0x30,0x29,0x30,0x29 }, /* 0 ) 30 */ + { 0x2d,0x5f,0x2d,0x1f }, /* - _ 31 */ + { 0x00,0x00,0x00,0x00 }, /* 0x32 unused */ + { 0xb6,0xb6,0xb6,0xb6 }, /* 6 (KP) 33 */ + { 0x00,0x00,0x00,0x00 }, /* 0x34 unused */ + { 0xb5,0xb5,0xb5,0xb5 }, /* 5 (KP) 35 */ + { 0x00,0x00,0x00,0x00 }, /* 0x36 unused */ + { 0xb4,0xb4,0xb4,0xb4 }, /* 4 (KP) 37 */ + { 0x60,0x7e,0x60,0x7e }, /* ` ~ 38 */ + { 0x5d,0x7d,0x1d,0x1d }, /* ] } 39 */ + { 0x50,0x50,0x10,0x10 }, /* p P 3a */ + { 0x5b,0x7b,0x1b,0x1b }, /* [ { 3b */ + { 0x00,0x00,0x00,0x00 }, /* 0x3c unused */ + { 0xb3,0xb3,0xb3,0xb3 }, /* 3 (KP) 3d */ + { 0xae,0xae,0xae,0xae }, /* . (KP) 3e */ + { 0xb2,0xb2,0xb2,0xb2 }, /* 2 (KP) 3f */ + { 0xb0,0xb0,0xb0,0xb0 }, /* 0 (KP) 40 */ + { 0xb1,0xb1,0xb1,0xb1 }, /* 1 (KP) 41 */ + { 0x0d,0x0d,0x0d,0x0d }, /* Enter 42 */ + { 0x8b,0x8b,0x8b,0x8b }, /* Up 43 */ + { 0x00,0x00,0x00,0x00 }, /* 0x44 unused */ + { 0x27,0x22,0x27,0x22 }, /* ' " 45 */ + { 0x00,0x00,0x00,0x00 }, /* 0x46 unused */ + { 0x00,0x00,0x00,0x00 }, /* 0x47 unused */ + { 0x8d,0x8d,0x8d,0x8d }, /* Ent(KP) 48 */ + { 0xa0,0xa0,0xa0,0xa0 }, /* Space 49 */ + { 0x00,0x00,0x00,0x00 }, /* 0x4a unused */ + { 0xad,0xad,0xad,0xad }, /* - (KP) 4b */ + { 0x95,0x95,0x95,0x95 }, /* Right 4c */ + { 0x8a,0x8a,0x8a,0x8a }, /* Down 4d */ + { 0x88,0x88,0x88,0x88 }, /* Left 4e */ + { 0x00,0x00,0x00,0x00 } /* 0x4f unused */ +}; + +WRITE_LINE_MEMBER(apple3_state::ay3600_data_ready_w) +{ + m_via_1->write_ca2(state); + + if (state == ASSERT_LINE) + { + UINT16 trans; + int mod = 0; + m_lastchar = m_ay3600->b_r(); + + trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff + trans |= (m_lastchar & 0x100)>>2; // bring the 0x100 bit down to the 0x40 place + + mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; + mod |= (m_kbspecial->read() & 0x08) ? 0x02 : 0x00; + + m_transchar = key_remap[trans][mod]; + + if (m_transchar != 0) + { + m_strobe = 0x80; +// printf("new char = %04x (%02x)\n", trans, m_transchar); + } + } +} + +void apple3_state::pdl_handler(int offset) +{ + UINT8 pdlread; + + switch (offset) + { + case 0x58: + m_analog_sel &= ~1; + break; + + case 0x59: + m_analog_sel |= 1; + break; + + case 0x5a: + m_analog_sel &= ~4; + break; + + case 0x5b: + m_analog_sel |= 4; + break; + + case 0x5c: + m_ramp_active = false; + m_pdl_charge = 0; + m_pdltimer->adjust(attotime::from_hz(1000000.0)); + break; + + case 0x5d: + switch (m_analog_sel) + { + case 1: + pdlread = m_joy1x->read(); + break; + + case 2: + pdlread = m_joy1y->read(); + break; + + case 4: + pdlread = m_joy2x->read(); + break; + + case 5: + pdlread = m_joy2y->read(); + break; + + default: + pdlread = 127; + break; + } + + // help the ROM self-test + if (m_pdl_charge > 82) + { + m_pdl_charge += (pdlread*4); + m_pdl_charge -= 93; + } + m_pdltimer->adjust(attotime::from_hz(1000000.0)); + m_ramp_active = true; + break; + + case 0x5e: + m_analog_sel &= ~2; + break; + + case 0x5f: + m_analog_sel |= 2; + break; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(apple3_state::paddle_timer) +{ + if (m_ramp_active) + { + m_pdl_charge--; + + if (m_pdl_charge > 0) + { + m_pdltimer->adjust(attotime::from_hz(1000000.0)); + } + else + { + m_pdltimer->adjust(attotime::never); + m_ramp_active = false; + } + } + else + { + m_pdl_charge++; + m_pdltimer->adjust(attotime::from_hz(1000000.0)); + } +} + +WRITE_LINE_MEMBER(apple3_state::a2bus_irq_w) +{ + UINT8 irq_mask = m_a2bus->get_a2bus_irq_mask(); + + m_via_1->write_ca1(state); + m_via_1->write_pa7(state); + + if (irq_mask & (1<<4)) + { + m_via_1->write_pa4(ASSERT_LINE); + } + else + { + m_via_1->write_pa4(CLEAR_LINE); + } + + if (irq_mask & (1<<3)) + { + m_via_1->write_pa5(ASSERT_LINE); + } + else + { + m_via_1->write_pa5(CLEAR_LINE); + } +} + +WRITE_LINE_MEMBER(apple3_state::a2bus_nmi_w) +{ + m_via_1->write_pb7(state); + + if (m_via_0_a & ENV_NMIENABLE) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, state); + } +} diff --git a/src/mame/machine/applefdc.c b/src/mame/machine/applefdc.c new file mode 100644 index 00000000000..dac524308ba --- /dev/null +++ b/src/mame/machine/applefdc.c @@ -0,0 +1,586 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/********************************************************************* + + applefdc.c + + Implementation of various Apple Floppy Disk Controllers, including + the classic Apple controller and the IWM (Integrated Woz Machine) + chip + + The IWM chip was used as the floppy disk controller for early Macs and the + Apple IIgs, and was eventually superseded by the SWIM chp. + + Nate Woods + Raphael Nabet + + Writing this code would not be possible if it weren't for the work of the + XGS and KEGS emulators which also contain IWM emulations. + + TODO + - Implement the unimplemented IWM modes + - IWM_MODE_CLOCKSPEED + - IWM_MODE_BITCELLTIME + - IWM_MODE_HANDSHAKEPROTOCOL + - IWM_MODE_LATCHMODE + - Investigate the differences between the IWM and the classic Apple II + controller more fully. It is currently unclear what are genuine + differences and what are effectively hacks that "just seem" to work. + - Figure out iwm_readenable2handshake() and iwm_enable2(); they are + hackish at best + - Support the SWIM chip + - Proper timing + - This code was originally IWM specific; we need to clean up IWMisms in + the code + - Make it faster? + - Add sound? + +*********************************************************************/ + +#include "applefdc.h" + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +// logging +#define LOG_APPLEFDC 0 +#define LOG_APPLEFDC_EXTRA 0 + +// mask for FDC lines +#define IWM_MOTOR 0x10 +#define IWM_DRIVE 0x20 +#define IWM_Q6 0x40 +#define IWM_Q7 0x80 + +const device_timer_id TIMER_MOTOR_ONOFF = 1; + + + + + +/*************************************************************************** + IWM MODE + + The IWM mode has the following values: + + Bit 7 Reserved + Bit 6 Reserved + Bit 5 Reserved + Bit 4 ! Clock speed + 0=7MHz; used by Apple IIgs + 1=8MHz; used by Mac (I believe) + Bit 3 ! Bit cell time + 0=4usec/bit (used for 5.25" drives) + 1=2usec/bit (used for 3.5" drives) + Bit 2 Motor-off delay + 0=leave on for 1 sec after system turns it off + 1=turn off immediately + Bit 1 ! Handshake protocol + 0=synchronous (software supplies timing for writing data; used for 5.25" drives) + 1=asynchronous (IWM supplies timing; used for 3.5" drives) + Bit 0 ! Latch mode + 0=read data stays valid for 7usec (used for 5.25" drives) + 1=read data stays valid for full byte time (used for 3.5" drives) + + ***************************************************************************/ + +enum +{ + IWM_MODE_CLOCKSPEED = 0x10, + IWM_MODE_BITCELLTIME = 0x08, + IWM_MODE_MOTOROFFDELAY = 0x04, + IWM_MODE_HANDSHAKEPROTOCOL = 0x02, + IWM_MODE_LATCHMODE = 0x01 +}; + + + +/*************************************************************************** + BASE DEVICE +***************************************************************************/ + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +applefdc_base_device::applefdc_base_device(applefdc_base_device::applefdc_t fdc_type, const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) +{ + m_type = fdc_type; +} + + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void applefdc_base_device::device_start() +{ + // timer + m_motor_timer = timer_alloc(TIMER_MOTOR_ONOFF); + + // state + m_write_byte = 0x00; + m_lines = 0x00; + m_mode = 0x1F; // default value needed by Lisa 2 - no, I don't know if it is true + m_handshake_hack = 0x00; + + // register save states + save_item(NAME(m_write_byte)); + save_item(NAME(m_lines)); + save_item(NAME(m_mode)); + save_item(NAME(m_handshake_hack)); +} + + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void applefdc_base_device::device_reset(void) +{ + m_handshake_hack = 0x00; + m_write_byte = 0x00; + m_lines = 0x00; + m_mode = 0x1F; /* default value needed by Lisa 2 - no, I don't know if it is true */ + m_motor_timer->reset(); +} + + + +//------------------------------------------------- +// device_timer - device-specific timer callbacks +//------------------------------------------------- + +void applefdc_base_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_MOTOR_ONOFF: + turn_motor_onoff(param != 0); + break; + } +} + + + +//------------------------------------------------- +// get_interface - gets the interface +//------------------------------------------------- + +const applefdc_interface *applefdc_base_device::get_interface() +{ + static const applefdc_interface dummy_interface = {0, }; + + return (static_config() != NULL) + ? (const applefdc_interface *) static_config() + : &dummy_interface; +} + + + +//------------------------------------------------- +// iwm_enable2 - hackish function +//------------------------------------------------- + +int applefdc_base_device::iwm_enable2() +{ + /* R. Nabet : This function looks more like a hack than a real feature of the IWM; */ + /* it is not called from the Mac Plus driver */ + return (m_lines & APPLEFDC_PH1) && (m_lines & APPLEFDC_PH3); +} + + + +//------------------------------------------------- +// iwm_readenable2handshake - hackish function +//------------------------------------------------- + +UINT8 applefdc_base_device::iwm_readenable2handshake() +{ + /* R. Nabet : This function looks more like a hack than a real feature of the IWM; */ + /* it is not called from the Mac Plus driver */ + m_handshake_hack++; + m_handshake_hack %= 4; + return (m_handshake_hack != 0) ? 0xc0 : 0x80; +} + + + +//------------------------------------------------- +// statusreg_r - reads the status register +//------------------------------------------------- + +UINT8 applefdc_base_device::statusreg_r() +{ + UINT8 result; + int status; + const applefdc_interface *intf = get_interface(); + + /* IWM status: + * + * Bit 7 Sense input (write protect for 5.25" drive and general status line for 3.5") + * Bit 6 Reserved + * Bit 5 Drive enable (is 1 if drive is on) + * Bits 4-0 Same as IWM mode bits 4-0 + */ + + status = iwm_enable2() ? 1 : (intf->read_status ? intf->read_status(this) : 0); + + result = (status ? 0x80 : 0x00); + + if (m_type != APPLEFDC_APPLE2) + result |= (((m_lines & IWM_MOTOR) ? 1 : 0) << 5) | m_mode; + return result; +} + + + +//------------------------------------------------- +// iwm_modereg_w - changes the mode register +//------------------------------------------------- + +void applefdc_base_device::iwm_modereg_w(UINT8 data) +{ + m_mode = data & 0x1f; /* write mode register */ + + if (LOG_APPLEFDC_EXTRA) + logerror("iwm_modereg_w: iwm_mode=0x%02x\n", (unsigned) m_mode); +} + + + +//------------------------------------------------- +// read_reg - reads a register +//------------------------------------------------- + +UINT8 applefdc_base_device::read_reg(int lines) +{ + const applefdc_interface *intf = get_interface(); + UINT8 result = 0; + + switch(lines) + { + case 0: + // read data register + if ((m_type != APPLEFDC_APPLE2) && (iwm_enable2() || !(m_lines & IWM_MOTOR))) + { + result = 0xFF; + } + else + { + // Right now, this function assumes latch mode; which is always used for + // 3.5 inch drives. Eventually we should check to see if latch mode is + // off + if (LOG_APPLEFDC) + { + if ((m_mode & IWM_MODE_LATCHMODE) == 0x00) + logerror("applefdc_read_reg(): latch mode off not implemented\n"); + } + + result = (intf->read_data ? intf->read_data(this) : 0x00); + } + break; + + case IWM_Q6: + // read status register + result = statusreg_r(); + break; + + case IWM_Q7: + // Classic Apple II: Read status register + // IWM: Read handshake register + if (m_type == APPLEFDC_APPLE2) + result = statusreg_r(); + else + result = iwm_enable2() ? iwm_readenable2handshake() : 0x80; + break; + } + return result; +} + + + +//------------------------------------------------- +// write_reg - writes a register +//------------------------------------------------- + +void applefdc_base_device::write_reg(UINT8 data) +{ + const applefdc_interface *intf = get_interface(); + + switch(m_lines & (IWM_Q6 | IWM_Q7)) + { + case IWM_Q6 | IWM_Q7: + if (!(m_lines & IWM_MOTOR)) + { + iwm_modereg_w(data); + } + else if (!iwm_enable2()) + { + // Right now, this function assumes latch mode; which is always used for + // 3.5 inch drives. Eventually we should check to see if latch mode is + // off + if (LOG_APPLEFDC) + { + if ((m_mode & IWM_MODE_LATCHMODE) == 0) + logerror("applefdc_write_reg(): latch mode off not implemented\n"); + } + + if (intf->write_data != NULL) + intf->write_data(this, data); + } + break; + } +} + + + +//------------------------------------------------- +// turn_motor_onoff - timer callback for turning +// motor on or off +//------------------------------------------------- + +void applefdc_base_device::turn_motor_onoff(bool status) +{ + const applefdc_interface *intf = get_interface(); + int enable_lines; + + if (status) + { + m_lines |= IWM_MOTOR; + enable_lines = (m_lines & IWM_DRIVE) ? 2 : 1; + } + else + { + m_lines &= ~IWM_MOTOR; + + if (m_type == APPLEFDC_APPLE2) + enable_lines = (m_lines & IWM_DRIVE) ? 2 : 1; + else + enable_lines = 0; + } + + /* invoke callback, if present */ + if (intf->set_enable_lines != NULL) + intf->set_enable_lines(this, enable_lines); + + if (LOG_APPLEFDC_EXTRA) + logerror("iwm_turnmotor_onoff(): Turning motor %s\n", status ? "on" : "off"); +} + + + +//------------------------------------------------- +// iwm_access +//------------------------------------------------- + +void applefdc_base_device::iwm_access(int offset) +{ + static const char *const lines[] = + { + "PH0", + "PH1", + "PH2", + "PH3", + "MOTOR", + "DRIVE", + "Q6", + "Q7" + }; + + const applefdc_interface *intf = get_interface(); + + if (offset & 1) + m_lines |= (1 << (offset >> 1)); + else + m_lines &= ~(1 << (offset >> 1)); + + if (LOG_APPLEFDC_EXTRA) + { + logerror("iwm_access(): %s line %s => %02x\n", + (offset & 1) ? "setting" : "clearing", lines[offset >> 1], m_lines); + } + + if ((offset < 0x08) && (intf->set_lines != NULL)) + intf->set_lines(this, m_lines & 0x0f); + + switch(offset) + { + case 0x08: + /* turn off motor */ + m_motor_timer->adjust( + (m_mode & IWM_MODE_MOTOROFFDELAY) ? attotime::zero : attotime::from_seconds(1), 0); + break; + + case 0x09: + /* turn on motor */ + m_motor_timer->adjust(attotime::zero, 1); + break; + + case 0x0A: + /* turn off IWM_DRIVE */ + if ((m_lines & IWM_MOTOR) && (intf->set_enable_lines != NULL)) + intf->set_enable_lines(this, 1); + break; + + case 0x0B: + /* turn on IWM_DRIVE */ + if ((m_lines & IWM_MOTOR) && (intf->set_enable_lines != NULL)) + intf->set_enable_lines(this, 2); + break; + } +} + + + +//------------------------------------------------- +// read - reads a byte from the FDC +//------------------------------------------------- + +UINT8 applefdc_base_device::read(UINT8 offset) +{ + const applefdc_interface *intf = get_interface(); + UINT8 result = 0; + + // normalize offset + offset &= 0xf; + + if (LOG_APPLEFDC_EXTRA) + logerror("applefdc_r: offset=%i\n", offset); + + iwm_access(offset); + + switch(m_type) + { + case APPLEFDC_APPLE2: + switch(offset) + { + case 0x0C: + if (m_lines & IWM_Q7) + { + if (intf->write_data != NULL) + intf->write_data(this, m_write_byte); + result = 0; + } + else + result = read_reg(0); + break; + + case 0x0D: + result = read_reg(IWM_Q6); + break; + + case 0x0E: + result = read_reg(IWM_Q7); + break; + + case 0x0F: + result = read_reg(IWM_Q7 | IWM_Q6); + break; + } + break; + + case APPLEFDC_IWM: + if ((offset & 1) == 0) + result = read_reg(m_lines & (IWM_Q6 | IWM_Q7)); + break; + + case APPLEFDC_SWIM: + if ((offset & 1) == 0) + result = read_reg(m_lines & (IWM_Q6 | IWM_Q7)); + break; + } + + return result; +} + + + +//------------------------------------------------- +// write - writes a byte to the FDC +//------------------------------------------------- + +void applefdc_base_device::write(UINT8 offset, UINT8 data) +{ + const applefdc_interface *intf = get_interface(); + + /* normalize offset */ + offset &= 15; + + if (LOG_APPLEFDC_EXTRA) + logerror("applefdc_w: offset=%i data=0x%02x\n", offset, data); + + iwm_access(offset); + + switch(m_type) + { + case APPLEFDC_APPLE2: + switch(offset) + { + case 0x0C: + if (m_lines & IWM_Q7) + { + if (intf->write_data != NULL) + intf->write_data(this, m_write_byte); + } + break; + + case 0x0D: + m_write_byte = data; + break; + } + break; + + case APPLEFDC_IWM: + if (offset & 1) + write_reg(data); + break; + + case APPLEFDC_SWIM: + if (offset & 1) + write_reg(data); + break; + } +} + + + +//------------------------------------------------- +// get_lines - accessor +//------------------------------------------------- + +UINT8 applefdc_base_device::get_lines() +{ + return m_lines & 0x0f; +} + + + +/*************************************************************************** + APPLE FDC - Used on Apple II +***************************************************************************/ + +const device_type APPLEFDC = &device_creator; + +applefdc_device::applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : applefdc_base_device(APPLEFDC_APPLE2, mconfig, APPLEFDC, "Apple FDC", tag, owner, clock, "apple_fdc", __FILE__) +{ +} + + + +/*************************************************************************** + IWM - Used on early Macs +***************************************************************************/ + +const device_type IWM = &device_creator; + +iwm_device::iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : applefdc_base_device(APPLEFDC_IWM, mconfig, IWM, "Apple IWM (Integrated Woz Machine)", tag, owner, clock, "iwm", __FILE__) +{ +} diff --git a/src/mame/machine/applefdc.h b/src/mame/machine/applefdc.h new file mode 100644 index 00000000000..38efb9036d2 --- /dev/null +++ b/src/mame/machine/applefdc.h @@ -0,0 +1,163 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/********************************************************************* + + applefdc.h + + Implementation of various Apple Floppy Disk Controllers, including + the classic Apple controller and the IWM (Integrated Woz Machine) + chip + + Nate Woods + Raphael Nabet + R. Belmont + +*********************************************************************/ + +#ifndef __APPLEFDC_H__ +#define __APPLEFDC_H__ + +#include "emu.h" + + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define APPLEFDC_PH0 0x01 +#define APPLEFDC_PH1 0x02 +#define APPLEFDC_PH2 0x04 +#define APPLEFDC_PH3 0x08 + +extern const device_type APPLEFDC; +extern const device_type IWM; +extern const device_type SWIM; + + + +/*************************************************************************** + INTERFACE +***************************************************************************/ + +struct applefdc_interface +{ + void (*set_lines)(device_t *device, UINT8 lines); + void (*set_enable_lines)(device_t *device, int enable_mask); + + UINT8 (*read_data)(device_t *device); + void (*write_data)(device_t *device, UINT8 data); + int (*read_status)(device_t *device); +}; + + + +/*************************************************************************** + BASE DEVICE +***************************************************************************/ + +class applefdc_base_device : public device_t +{ +public: + // read/write handlers + virtual UINT8 read(UINT8 offset); + virtual void write(UINT8 offset, UINT8 data); + + // read/write handlers overloads + UINT8 read(offs_t offset) { return read((UINT8) offset); } + void write(offs_t offset, UINT8 data) { write((UINT8) offset, data); } + DECLARE_READ8_MEMBER( read ) { return read((UINT8) offset); } + DECLARE_WRITE8_MEMBER( write ) { write((UINT8) offset, data); } + + // accessor + UINT8 get_lines(); + +protected: + enum applefdc_t + { + APPLEFDC_APPLE2, /* classic Apple II disk controller (pre-IWM) */ + APPLEFDC_IWM, /* Integrated Woz Machine */ + APPLEFDC_SWIM /* Sander/Woz Integrated Machine */ + }; + + // constructor + applefdc_base_device(applefdc_t fdc_type, const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // other protecteds + virtual void iwm_modereg_w(UINT8 data); + +private: + // data that is constant for the lifetime of the emulation + emu_timer * m_motor_timer; + applefdc_t m_type; + + // data that changes at emulation time + UINT8 m_write_byte; + UINT8 m_lines; /* flags from IWM_MOTOR - IWM_Q7 */ + UINT8 m_mode; /* 0-31; see above */ + UINT8 m_handshake_hack; /* not sure what this is for */ + + // functions + const applefdc_interface *get_interface(); + int iwm_enable2(); + UINT8 iwm_readenable2handshake(); + UINT8 statusreg_r(); + UINT8 read_reg(int lines); + void write_reg(UINT8 data); + void turn_motor_onoff(bool status); + void iwm_access(int offset); +}; + + + +/*************************************************************************** + APPLE FDC - Used on Apple II +***************************************************************************/ + +class applefdc_device : public applefdc_base_device +{ +public: + applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + + + +/*************************************************************************** + IWM - Used on early Macs +***************************************************************************/ + +class iwm_device : public applefdc_base_device +{ +public: + iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ + +#define MCFG_APPLEFDC_ADD(_tag, _intrf) \ + MCFG_DEVICE_ADD(_tag, APPLEFDC, 0) \ + MCFG_DEVICE_CONFIG(_intrf) + +#define MCFG_APPLEFDC_MODIFY(_tag, _intrf) \ + MCFG_DEVICE_MODIFY(_tag) \ + MCFG_DEVICE_CONFIG(_intrf) + +#define MCFG_IWM_ADD(_tag, _intrf) \ + MCFG_DEVICE_ADD(_tag, IWM, 0) \ + MCFG_DEVICE_CONFIG(_intrf) + +#define MCFG_IWM_MODIFY(_tag, _intrf) \ + MCFG_DEVICE_MODIFY(_tag) \ + MCFG_DEVICE_CONFIG(_intrf) + + +#endif /* __APPLEFDC_H__ */ diff --git a/src/mame/machine/apricotkb.c b/src/mame/machine/apricotkb.c new file mode 100644 index 00000000000..6ceb0d6ba4d --- /dev/null +++ b/src/mame/machine/apricotkb.c @@ -0,0 +1,404 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Apricot keyboard emulation + +*********************************************************************/ + +#include "apricotkb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define UPD7507C_TAG "ic2" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type APRICOT_KEYBOARD = &device_creator; + + +//------------------------------------------------- +// ROM( apricot_keyboard ) +//------------------------------------------------- + +ROM_START( apricot_keyboard ) + ROM_REGION( 0x800, UPD7507C_TAG, 0 ) + ROM_LOAD( "keyboard controller upd7507c.ic2", 0x000, 0x800, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *apricot_keyboard_device::device_rom_region() const +{ + return ROM_NAME( apricot_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( kb_io ) +//------------------------------------------------- + +#ifdef UPD7507_EMULATED +static ADDRESS_MAP_START( apricot_keyboard_io, AS_IO, 8, apricot_keyboard_device ) + AM_RANGE(0x00, 0x00) AM_READ(kb_lo_r) + AM_RANGE(0x01, 0x01) AM_READ(kb_hi_r) + AM_RANGE(0x03, 0x03) AM_WRITE(kb_p3_w) + AM_RANGE(0x04, 0x04) AM_WRITE(kb_y0_w) + AM_RANGE(0x05, 0x05) AM_WRITE(kb_y4_w) + AM_RANGE(0x06, 0x06) AM_READWRITE(kb_p6_r, kb_yc_w) + AM_RANGE(0x07, 0x07) AM_WRITE(kb_y8_w) +ADDRESS_MAP_END +#endif + + +//------------------------------------------------- +// MACHINE_DRIVER( apricot_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( apricot_keyboard ) +#ifdef UPD7507_EMULATED + MCFG_CPU_ADD(UPD7507C_TAG, UPD7507, XTAL_32_768kHz) + MCFG_CPU_IO_MAP(apricot_keyboard_io) +#endif +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor apricot_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( apricot_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( apricot_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( apricot_keyboard ) + PORT_START("Y0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y6") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y9") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("YA") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("YB") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("YC") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("MODIFIERS") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor apricot_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( apricot_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// apricot_keyboard_device - constructor +//------------------------------------------------- + +apricot_keyboard_device::apricot_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, APRICOT_KEYBOARD, "Apricot Keyboard", tag, owner, clock, "aprikb", __FILE__), + m_write_txd(*this), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_ya(*this, "YA"), + m_yb(*this, "YB"), + m_yc(*this, "YC"), + m_modifiers(*this, "MODIFIERS") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apricot_keyboard_device::device_start() +{ + // resolve callbacks + m_write_txd.resolve_safe(); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apricot_keyboard_device::device_reset() +{ +} + + +//------------------------------------------------- +// read_keyboard - +//------------------------------------------------- + +UINT8 apricot_keyboard_device::read_keyboard() +{ + UINT8 data = 0xff; + + if (!BIT(m_kb_y, 0)) data &= m_y0->read(); + if (!BIT(m_kb_y, 1)) data &= m_y1->read(); + if (!BIT(m_kb_y, 2)) data &= m_y2->read(); + if (!BIT(m_kb_y, 3)) data &= m_y3->read(); + if (!BIT(m_kb_y, 4)) data &= m_y4->read(); + if (!BIT(m_kb_y, 5)) data &= m_y5->read(); + if (!BIT(m_kb_y, 6)) data &= m_y6->read(); + if (!BIT(m_kb_y, 7)) data &= m_y7->read(); + if (!BIT(m_kb_y, 8)) data &= m_y8->read(); + if (!BIT(m_kb_y, 9)) data &= m_y9->read(); + if (!BIT(m_kb_y, 10)) data &= m_ya->read(); + if (!BIT(m_kb_y, 11)) data &= m_yb->read(); + if (!BIT(m_kb_y, 12)) data &= m_yc->read(); + + return data; +} + + +//------------------------------------------------- +// kb_lo_r - +//------------------------------------------------- + +READ8_MEMBER( apricot_keyboard_device::kb_lo_r ) +{ + return read_keyboard() & 0x0f; +} + + +//------------------------------------------------- +// kb_hi_r - +//------------------------------------------------- + +READ8_MEMBER( apricot_keyboard_device::kb_hi_r ) +{ + return read_keyboard() >> 4; +} + + +//------------------------------------------------- +// kb_p6_r - +//------------------------------------------------- + +READ8_MEMBER( apricot_keyboard_device::kb_p6_r ) +{ + /* + + bit description + + P60 + P61 SHIFT + P62 CONTROL + + */ + + UINT8 modifiers = m_modifiers->read(); + + return modifiers << 1; +} + + +//------------------------------------------------- +// kb_p3_w - +//------------------------------------------------- + +WRITE8_MEMBER( apricot_keyboard_device::kb_p3_w ) +{ + // bit 1 controls the IR LEDs +} + + +//------------------------------------------------- +// kb_y0_w - +//------------------------------------------------- + +WRITE8_MEMBER( apricot_keyboard_device::kb_y0_w ) +{ + m_kb_y = (m_kb_y & 0xfff0) | (data & 0x0f); +} + + +//------------------------------------------------- +// kb_y4_w - +//------------------------------------------------- + +WRITE8_MEMBER( apricot_keyboard_device::kb_y4_w ) +{ + m_kb_y = (m_kb_y & 0xff0f) | ((data & 0x0f) << 4); +} + + +//------------------------------------------------- +// kb_y8_w - +//------------------------------------------------- + +WRITE8_MEMBER( apricot_keyboard_device::kb_y8_w ) +{ + m_kb_y = (m_kb_y & 0xf0ff) | ((data & 0x0f) << 8); +} + + +//------------------------------------------------- +// kb_yc_w - +//------------------------------------------------- + +WRITE8_MEMBER( apricot_keyboard_device::kb_yc_w ) +{ + m_kb_y = (m_kb_y & 0xf0ff) | ((data & 0x0f) << 12); +} diff --git a/src/mame/machine/apricotkb.h b/src/mame/machine/apricotkb.h new file mode 100644 index 00000000000..7b3d20a7a48 --- /dev/null +++ b/src/mame/machine/apricotkb.h @@ -0,0 +1,97 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Apricot keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __APRICOT_KEYBOARD__ +#define __APRICOT_KEYBOARD__ + +#include "emu.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define APRICOT_KEYBOARD_TAG "aprikb" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_APRICOT_KEYBOARD_TXD_CALLBACK(_write) \ + devcb = &apricot_keyboard_device::set_tcd_wr_callback(*device, DEVCB_##_write); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> apricot_keyboard_device + +class apricot_keyboard_device : public device_t +{ +public: + // construction/destruction + apricot_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_txd_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_txd.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + UINT8 read_keyboard(); + + DECLARE_READ8_MEMBER( kb_lo_r ); + DECLARE_READ8_MEMBER( kb_hi_r ); + DECLARE_READ8_MEMBER( kb_p6_r ); + DECLARE_WRITE8_MEMBER( kb_p3_w ); + DECLARE_WRITE8_MEMBER( kb_y0_w ); + DECLARE_WRITE8_MEMBER( kb_y4_w ); + DECLARE_WRITE8_MEMBER( kb_y8_w ); + DECLARE_WRITE8_MEMBER( kb_yc_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + devcb_write_line m_write_txd; + + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_ya; + required_ioport m_yb; + required_ioport m_yc; + required_ioport m_modifiers; + + UINT16 m_kb_y; +}; + + +// device type definition +extern const device_type APRICOT_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/apricotkb_hle.c b/src/mame/machine/apricotkb_hle.c new file mode 100644 index 00000000000..6950033c79f --- /dev/null +++ b/src/mame/machine/apricotkb_hle.c @@ -0,0 +1,286 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + ACT Apricot Keyboard (HLE) + + Keyboard to System: + - 01-60: Key make codes + - 70-7f: Mouse codes + - 80: RAM test failed + - 81-e0: Key break codes + - e9: ROM test failed + - ea: X-on (keyboard ready to receive) + - eb: X-off (keyboard buffer full) + - ec: Reset request + - ed: Time prefix + - ee: Date prefix + - ef: Mouse header + - f0-f9: BCD data + - fa: Invalid clock data + - fb: Acknowledge firmware version/reset + + System to keyboard: + - 01-7f: Character codes for MicroScreen + - 80-cf: Cursor address + - d0: Clear screen + - d1: Cursor left + - d2: Cursor right + - d3: Cursor on + - d4: Cursor off + - d5: Display on + - d6: Display off + - e0: Query + - e1: Time and date request + - e2: Display time/data on MicroScreen + - e3: Set LED prefix + - e4: Set time and date + - e5: Mouse enable + - e6: Mouse disable + - e7: Execute processor diagnostics + - e8: Keyboard reset + - f0-f9: BCD data + - fa: Invalid clock data + +***************************************************************************/ + +#include "apricotkb_hle.h" + + +//************************************************************************** +// CONSTANTS / MACROS +//************************************************************************** + +#define APRICOT_KEY(_key, _index) \ + PORT_BIT(1 << _key, IP_ACTIVE_HIGH, IPT_KEYBOARD) \ + PORT_CHANGED_MEMBER(DEVICE_SELF, apricot_keyboard_hle_device, key_callback, (void *) _index) + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type APRICOT_KEYBOARD_HLE = &device_creator; + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( keyboard ) + PORT_START("keyboard_0") + PORT_BIT(1 << 0, IP_ACTIVE_HIGH, IPT_UNUSED) + APRICOT_KEY( 1, 0) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_NAME("Help") + APRICOT_KEY( 2, 0) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_NAME("Undo") + APRICOT_KEY( 3, 0) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_NAME("Repeat") + APRICOT_KEY( 4, 0) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_NAME("Calc") + APRICOT_KEY( 5, 0) PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) PORT_NAME("Print") + APRICOT_KEY( 6, 0) PORT_CODE(KEYCODE_CANCEL) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) PORT_NAME("Intr") + APRICOT_KEY( 7, 0) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_NAME("Menu") + APRICOT_KEY( 8, 0) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_NAME("Finish") + APRICOT_KEY( 9, 0) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("Function 1") + APRICOT_KEY(10, 0) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_NAME("Function 2") + APRICOT_KEY(11, 0) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_NAME("Function 3") + APRICOT_KEY(12, 0) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_NAME("Function 4") + APRICOT_KEY(13, 0) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_NAME("Function 5") + APRICOT_KEY(14, 0) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_NAME("Function 6") + APRICOT_KEY(15, 0) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('^') + APRICOT_KEY(16, 0) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + APRICOT_KEY(17, 0) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + APRICOT_KEY(18, 0) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + APRICOT_KEY(19, 0) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0xa3) // pound + APRICOT_KEY(20, 0) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + APRICOT_KEY(21, 0) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('$') + APRICOT_KEY(22, 0) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + APRICOT_KEY(23, 0) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + APRICOT_KEY(24, 0) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + APRICOT_KEY(25, 0) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + APRICOT_KEY(26, 0) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + APRICOT_KEY(27, 0) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + APRICOT_KEY(28, 0) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(9) + PORT_BIT(1 << 29, IP_ACTIVE_HIGH, IPT_UNUSED) // actually a dedicated % key + APRICOT_KEY(30, 0) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + APRICOT_KEY(31, 0) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + + PORT_START("keyboard_1") + APRICOT_KEY( 0, 1) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + APRICOT_KEY( 1, 1) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + APRICOT_KEY( 2, 1) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + APRICOT_KEY( 3, 1) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + APRICOT_KEY( 4, 1) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + APRICOT_KEY( 5, 1) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + APRICOT_KEY( 6, 1) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + APRICOT_KEY( 7, 1) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + APRICOT_KEY( 8, 1) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + APRICOT_KEY( 9, 1) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + APRICOT_KEY(10, 1) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + APRICOT_KEY(11, 1) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + APRICOT_KEY(12, 1) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + APRICOT_KEY(13, 1) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + APRICOT_KEY(14, 1) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + APRICOT_KEY(15, 1) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + APRICOT_KEY(16, 1) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("Clear") + APRICOT_KEY(17, 1) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + APRICOT_KEY(18, 1) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + APRICOT_KEY(19, 1) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + APRICOT_KEY(20, 1) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + APRICOT_KEY(21, 1) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + APRICOT_KEY(22, 1) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + APRICOT_KEY(23, 1) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + APRICOT_KEY(24, 1) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + APRICOT_KEY(25, 1) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + APRICOT_KEY(26, 1) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + APRICOT_KEY(27, 1) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + APRICOT_KEY(28, 1) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + APRICOT_KEY(29, 1) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + APRICOT_KEY(30, 1) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + APRICOT_KEY(31, 1) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + + PORT_START("keyboard_2") + APRICOT_KEY( 0, 2) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + APRICOT_KEY( 1, 2) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + APRICOT_KEY( 2, 2) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + APRICOT_KEY( 3, 2) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + APRICOT_KEY( 4, 2) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + APRICOT_KEY( 5, 2) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + APRICOT_KEY( 6, 2) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + APRICOT_KEY( 7, 2) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + APRICOT_KEY( 8, 2) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + APRICOT_KEY( 9, 2) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + APRICOT_KEY(10, 2) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + APRICOT_KEY(11, 2) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + APRICOT_KEY(12, 2) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + APRICOT_KEY(13, 2) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + APRICOT_KEY(14, 2) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + APRICOT_KEY(15, 2) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + APRICOT_KEY(16, 2) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + APRICOT_KEY(17, 2) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + APRICOT_KEY(18, 2) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + APRICOT_KEY(19, 2) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) + APRICOT_KEY(20, 2) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + APRICOT_KEY(21, 2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + APRICOT_KEY(22, 2) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + APRICOT_KEY(23, 2) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + APRICOT_KEY(24, 2) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + APRICOT_KEY(25, 2) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + APRICOT_KEY(26, 2) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("Stop") + APRICOT_KEY(27, 2) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + APRICOT_KEY(28, 2) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + APRICOT_KEY(29, 2) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + APRICOT_KEY(30, 2) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + APRICOT_KEY(31, 2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_START("keyboard_3") + APRICOT_KEY( 0, 3) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) +INPUT_PORTS_END + +ioport_constructor apricot_keyboard_hle_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( keyboard ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// apricot_keyboard_hle_device - constructor +//------------------------------------------------- + +apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, APRICOT_KEYBOARD_HLE, "Apricot Keyboard (HLE)", tag, owner, clock, "apricotkb_hle", __FILE__), + device_serial_interface(mconfig, *this), + m_txd_handler(*this), + m_rxd(1), + m_data_in(0), + m_data_out(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apricot_keyboard_hle_device::device_start() +{ + // resolve callbacks + m_txd_handler.resolve_safe(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apricot_keyboard_hle_device::device_reset() +{ + receive_register_reset(); + transmit_register_reset(); + + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); + set_rcv_rate(7800); + set_tra_rate(7800); +} + +//------------------------------------------------- +// device_timer - device-specific timer +//------------------------------------------------- + +void apricot_keyboard_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + device_serial_interface::device_timer(timer, id, param, ptr); +} + +void apricot_keyboard_hle_device::tra_callback() +{ + m_txd_handler(transmit_register_get_data_bit()); +} + +void apricot_keyboard_hle_device::tra_complete() +{ + if (m_data_out != 0) + { + transmit_register_setup(m_data_out); + m_data_out = 0; + } +} + +void apricot_keyboard_hle_device::rcv_callback() +{ + receive_register_update_bit(m_rxd); +} + +void apricot_keyboard_hle_device::rcv_complete() +{ + receive_register_extract(); + m_data_in = get_received_char(); + + // reset command? send keyboard ready (likely needs a delay, just disable for now) +// if (m_data_in == 0xe8) +// transmit_register_setup(0xfb); +} + +WRITE_LINE_MEMBER( apricot_keyboard_hle_device::rxd_w ) +{ + m_rxd = state; + device_serial_interface::rx_w(m_rxd); +} + +INPUT_CHANGED_MEMBER( apricot_keyboard_hle_device::key_callback ) +{ + UINT32 oldvalue = oldval * field.mask(), newvalue = newval * field.mask(); + UINT32 delta = oldvalue ^ newvalue; + + for (int i = 0; i < 32; i++) + { + if (delta & (1 << i)) + { + UINT8 down = (newvalue & (1 << i)) ? 0x00 : 0x80; + UINT8 scancode = (FPTR) param * 32 + i; + scancode |= down; + transmit_register_setup(scancode); + break; + } + } + +} diff --git a/src/mame/machine/apricotkb_hle.h b/src/mame/machine/apricotkb_hle.h new file mode 100644 index 00000000000..e8cea1a516d --- /dev/null +++ b/src/mame/machine/apricotkb_hle.h @@ -0,0 +1,73 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + ACT Apricot Keyboard (HLE) + +***************************************************************************/ + +#pragma once + +#ifndef __APRICOTKB_HLE__ +#define __APRICOTKB_HLE__ + +#include "emu.h" + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_APRICOT_KEYBOARD_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, APRICOT_KEYBOARD_HLE, 0) + +#define MCFG_APRICOT_KEYBOARD_TXD_HANDLER(_write) \ + devcb = &apricot_keyboard_hle_device::set_txd_handler(*device, DEVCB_##_write); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> apricot_keyboard_hle_device + +class apricot_keyboard_hle_device : public device_t, public device_serial_interface +{ +public: + // construction/destruction + apricot_keyboard_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_txd_handler(device_t &device, _Object object) + { return downcast(device).m_txd_handler.set_callback(object); } + + DECLARE_WRITE_LINE_MEMBER(rxd_w); + DECLARE_INPUT_CHANGED_MEMBER(key_callback); + +protected: + // device_t overrides + virtual ioport_constructor device_input_ports() const; + virtual void device_start(); + virtual void device_reset(); + + // device_serial_interface overrides + virtual void tra_callback(); + virtual void tra_complete(); + virtual void rcv_callback(); + virtual void rcv_complete(); + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + devcb_write_line m_txd_handler; + + int m_rxd; + + UINT8 m_data_in; + UINT8 m_data_out; +}; + + +// device type definition +extern const device_type APRICOT_KEYBOARD_HLE; + + +#endif // __APRICOTKB_HLE__ diff --git a/src/mame/machine/at.c b/src/mame/machine/at.c new file mode 100644 index 00000000000..ffc817fbaba --- /dev/null +++ b/src/mame/machine/at.c @@ -0,0 +1,313 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Miodrag Milanovic +/*************************************************************************** + + IBM AT Compatibles + +***************************************************************************/ + +#include "includes/at.h" + +#define LOG_PORT80 0 + +/************************************************************* + * + * pic8259 configuration + * + *************************************************************/ +READ8_MEMBER( at_state::get_slave_ack ) +{ + if (offset==2) // IRQ = 2 + return m_pic8259_slave->acknowledge(); + + return 0x00; +} + +/************************************************************************* + * + * PC Speaker related + * + *************************************************************************/ + +void at_state::at_speaker_set_spkrdata(UINT8 data) +{ + m_at_spkrdata = data ? 1 : 0; + m_speaker->level_w(m_at_spkrdata & m_pit_out2); +} + + + +/************************************************************* + * + * pit8254 configuration + * + *************************************************************/ + +WRITE_LINE_MEMBER( at_state::at_pit8254_out0_changed ) +{ + m_pic8259_master->ir0_w(state); +} + + +WRITE_LINE_MEMBER( at_state::at_pit8254_out2_changed ) +{ + m_pit_out2 = state ? 1 : 0; + m_speaker->level_w(m_at_spkrdata & m_pit_out2); +} + + +/************************************************************************* + * + * PC DMA stuff + * + *************************************************************************/ + +READ8_MEMBER( at_state::at_page8_r ) +{ + UINT8 data = m_at_pages[offset % 0x10]; + + switch(offset % 8) + { + case 1: + data = m_dma_offset[BIT(offset, 3)][2]; + break; + case 2: + data = m_dma_offset[BIT(offset, 3)][3]; + break; + case 3: + data = m_dma_offset[BIT(offset, 3)][1]; + break; + case 7: + data = m_dma_offset[BIT(offset, 3)][0]; + break; + } + return data; +} + + +WRITE8_MEMBER( at_state::at_page8_w ) +{ + m_at_pages[offset % 0x10] = data; + + if (LOG_PORT80 && (offset == 0)) + { + logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, + (unsigned) m_maincpu->pc()); + } + + switch(offset % 8) + { + case 1: + m_dma_offset[BIT(offset, 3)][2] = data; + break; + case 2: + m_dma_offset[BIT(offset, 3)][3] = data; + break; + case 3: + m_dma_offset[BIT(offset, 3)][1] = data; + break; + case 7: + m_dma_offset[BIT(offset, 3)][0] = data; + break; + } +} + + +WRITE_LINE_MEMBER( at_state::pc_dma_hrq_changed ) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + /* Assert HLDA */ + m_dma8237_2->hack_w(state); +} + +READ8_MEMBER(at_state::pc_dma_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space + if(m_dma_channel == -1) + return 0xff; + UINT8 result; + offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; + + result = prog_space.read_byte(page_offset + offset); + return result; +} + + +WRITE8_MEMBER(at_state::pc_dma_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space + if(m_dma_channel == -1) + return; + offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; + + prog_space.write_byte(page_offset + offset, data); +} + + +READ8_MEMBER(at_state::pc_dma_read_word) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space + if(m_dma_channel == -1) + return 0xff; + UINT16 result; + offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; + + result = prog_space.read_word(page_offset + ( offset << 1 ) ); + m_dma_high_byte = result & 0xFF00; + + return result & 0xFF; +} + + +WRITE8_MEMBER(at_state::pc_dma_write_word) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space + if(m_dma_channel == -1) + return; + offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; + + prog_space.write_word(page_offset + ( offset << 1 ), m_dma_high_byte | data); +} + +READ8_MEMBER( at_state::pc_dma8237_0_dack_r ) { return m_isabus->dack_r(0); } +READ8_MEMBER( at_state::pc_dma8237_1_dack_r ) { return m_isabus->dack_r(1); } +READ8_MEMBER( at_state::pc_dma8237_2_dack_r ) { return m_isabus->dack_r(2); } +READ8_MEMBER( at_state::pc_dma8237_3_dack_r ) { return m_isabus->dack_r(3); } +READ8_MEMBER( at_state::pc_dma8237_5_dack_r ) { UINT16 ret = m_isabus->dack16_r(5); m_dma_high_byte = ret & 0xff00; return ret; } +READ8_MEMBER( at_state::pc_dma8237_6_dack_r ) { UINT16 ret = m_isabus->dack16_r(6); m_dma_high_byte = ret & 0xff00; return ret; } +READ8_MEMBER( at_state::pc_dma8237_7_dack_r ) { UINT16 ret = m_isabus->dack16_r(7); m_dma_high_byte = ret & 0xff00; return ret; } + + +WRITE8_MEMBER( at_state::pc_dma8237_0_dack_w ){ m_isabus->dack_w(0, data); } +WRITE8_MEMBER( at_state::pc_dma8237_1_dack_w ){ m_isabus->dack_w(1, data); } +WRITE8_MEMBER( at_state::pc_dma8237_2_dack_w ){ m_isabus->dack_w(2, data); } +WRITE8_MEMBER( at_state::pc_dma8237_3_dack_w ){ m_isabus->dack_w(3, data); } +WRITE8_MEMBER( at_state::pc_dma8237_5_dack_w ){ m_isabus->dack16_w(5, m_dma_high_byte | data); } +WRITE8_MEMBER( at_state::pc_dma8237_6_dack_w ){ m_isabus->dack16_w(6, m_dma_high_byte | data); } +WRITE8_MEMBER( at_state::pc_dma8237_7_dack_w ){ m_isabus->dack16_w(7, m_dma_high_byte | data); } + +WRITE_LINE_MEMBER( at_state::at_dma8237_out_eop ) +{ + m_cur_eop = state == ASSERT_LINE; + if(m_dma_channel != -1) + m_isabus->eop_w(m_dma_channel, m_cur_eop ? ASSERT_LINE : CLEAR_LINE ); +} + +void at_state::pc_set_dma_channel(int channel, int state) +{ + if(!state) { + m_dma_channel = channel; + if(m_cur_eop) + m_isabus->eop_w(channel, ASSERT_LINE ); + + } else if(m_dma_channel == channel) { + m_dma_channel = -1; + if(m_cur_eop) + m_isabus->eop_w(channel, CLEAR_LINE ); + } +} + +WRITE_LINE_MEMBER( at_state::pc_dack0_w ) { pc_set_dma_channel(0, state); } +WRITE_LINE_MEMBER( at_state::pc_dack1_w ) { pc_set_dma_channel(1, state); } +WRITE_LINE_MEMBER( at_state::pc_dack2_w ) { pc_set_dma_channel(2, state); } +WRITE_LINE_MEMBER( at_state::pc_dack3_w ) { pc_set_dma_channel(3, state); } +WRITE_LINE_MEMBER( at_state::pc_dack4_w ) { m_dma8237_1->hack_w(state ? 0 : 1); } // it's inverted +WRITE_LINE_MEMBER( at_state::pc_dack5_w ) { pc_set_dma_channel(5, state); } +WRITE_LINE_MEMBER( at_state::pc_dack6_w ) { pc_set_dma_channel(6, state); } +WRITE_LINE_MEMBER( at_state::pc_dack7_w ) { pc_set_dma_channel(7, state); } + +READ8_MEMBER( at_state::at_portb_r ) +{ + UINT8 data = m_at_speaker; + data &= ~0xd0; /* AT BIOS don't likes this being set */ + + /* 0x10 is the dram refresh line bit, 15.085us. */ + data |= (machine().time().as_ticks(110000) & 1) ? 0x10 : 0; + + if (m_pit_out2) + data |= 0x20; + else + data &= ~0x20; /* ps2m30 wants this */ + + return data; +} + +WRITE8_MEMBER( at_state::at_portb_w ) +{ + m_at_speaker = data; + m_pit8254->write_gate2(BIT(data, 0)); + at_speaker_set_spkrdata( BIT(data, 1)); + m_channel_check = BIT(data, 3); + m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0)); +} + +READ8_MEMBER( at_state::ps2_portb_r ) +{ + UINT8 data = m_at_speaker; + data &= ~0xd0; /* AT BIOS don't likes this being set */ + + /* 0x10 is the dram refresh line bit, 15.085us. */ + data |= (machine().time().as_ticks(66291) & 1) ? 0x10 : 0; + + if (m_pit_out2) + data |= 0x20; + else + data &= ~0x20; /* ps2m30 wants this */ + + return data; +} + + +/********************************************************** + * + * Init functions + * + **********************************************************/ + +void at_state::init_at_common(int xmsbase) +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + + /* MESS managed RAM */ + membank("bank10")->set_base(m_ram->pointer()); + + if (m_ram->size() > xmsbase) + { + offs_t ram_limit = 0x100000 + m_ram->size() - xmsbase; + space.install_read_bank(0x100000, ram_limit - 1, "bank1"); + space.install_write_bank(0x100000, ram_limit - 1, "bank1"); + membank("bank1")->set_base(m_ram->pointer() + xmsbase); + } +} + +DRIVER_INIT_MEMBER(at_state,atcga) +{ + init_at_common(0xa0000); +} + +DRIVER_INIT_MEMBER(at_state,atvga) +{ + init_at_common(0xa0000); +} + +DRIVER_INIT_MEMBER(at_state,atpci) +{ + init_at_common(0x100000); +} + +DRIVER_INIT_MEMBER(at586_state,at586) +{ +} + +MACHINE_START_MEMBER(at_state,at) +{ +} + +MACHINE_RESET_MEMBER(at_state,at) +{ + m_at_spkrdata = 0; + m_pit_out2 = 1; + m_dma_channel = -1; + m_cur_eop = false; +} diff --git a/src/mame/machine/atarifdc.c b/src/mame/machine/atarifdc.c new file mode 100644 index 00000000000..a440181468c --- /dev/null +++ b/src/mame/machine/atarifdc.c @@ -0,0 +1,796 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/*************************************************************************** + + Atari 400/800 + + Floppy Disk Controller code + + Juergen Buchmueller, June 1998 + +***************************************************************************/ + +#include + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "includes/atari.h" +#include "atarifdc.h" +#include "sound/pokey.h" +#include "machine/6821pia.h" +#include "formats/atari_dsk.h" + +#define VERBOSE_SERIAL 0 +#define VERBOSE_CHKSUM 0 + +/************************************* + * + * Disk stuff + * + *************************************/ + +#define FORMAT_XFD 0 +#define FORMAT_ATR 1 +#define FORMAT_DSK 2 + +/***************************************************************************** + * This is the structure I used in my own Atari 800 emulator some years ago + * Though it's a bit overloaded, I used it as it is the maximum of all + * supported formats: + * XFD no header at all + * ATR 16 bytes header + * DSK this struct + * It is used to determine the format of a XFD image by it's size only + *****************************************************************************/ + +struct atari_dsk_format +{ + UINT8 density; + UINT8 tracks; + UINT8 door; + UINT8 sta1; + UINT8 spt; + UINT8 doublesided; + UINT8 highdensity; + UINT8 seclen_hi; + UINT8 seclen_lo; + UINT8 status; + UINT8 sta2; + UINT8 sta3; + UINT8 sta4; + UINT8 cr; + UINT8 info[65+1]; +}; + +/* combined with the size the image should have */ +struct xfd_format +{ + int size; + atari_dsk_format dsk; +}; + +/* here's a table of known xfd formats */ +static const xfd_format xfd_formats[] = +{ + {35 * 18 * 1 * 128, {0,35,1,0,18,0,0,0,128,255,0,0,0,13,"35 SS/SD"}}, + {35 * 26 * 1 * 128, {1,35,1,0,26,0,4,0,128,255,0,0,0,13,"35 SS/MD"}}, + {(35 * 18 * 1 - 3) * 256 + 3 * 128, {2,35,1,0,18,0,4,1, 0,255,0,0,0,13,"35 SS/DD"}}, + {40 * 18 * 1 * 128, {0,40,1,0,18,0,0,0,128,255,0,0,0,13,"40 SS/SD"}}, + {40 * 26 * 1 * 128, {1,40,1,0,26,0,4,0,128,255,0,0,0,13,"40 SS/MD"}}, + {(40 * 18 * 1 - 3) * 256 + 3 * 128, {2,40,1,0,18,0,4,1, 0,255,0,0,0,13,"40 SS/DD"}}, + {40 * 18 * 2 * 128, {0,40,1,0,18,1,0,0,128,255,0,0,0,13,"40 DS/SD"}}, + {40 * 26 * 2 * 128, {1,40,1,0,26,1,4,0,128,255,0,0,0,13,"40 DS/MD"}}, + {(40 * 18 * 2 - 3) * 256 + 3 * 128, {2,40,1,0,18,1,4,1, 0,255,0,0,0,13,"40 DS/DD"}}, + {77 * 18 * 1 * 128, {0,77,1,0,18,0,0,0,128,255,0,0,0,13,"77 SS/SD"}}, + {77 * 26 * 1 * 128, {1,77,1,0,26,0,4,0,128,255,0,0,0,13,"77 SS/MD"}}, + {(77 * 18 * 1 - 3) * 256 + 3 * 128, {2,77,1,0,18,0,4,1, 0,255,0,0,0,13,"77 SS/DD"}}, + {77 * 18 * 2 * 128, {0,77,1,0,18,1,0,0,128,255,0,0,0,13,"77 DS/SD"}}, + {77 * 26 * 2 * 128, {1,77,1,0,26,1,4,0,128,255,0,0,0,13,"77 DS/MD"}}, + {(77 * 18 * 2 - 3) * 256 + 3 * 128, {2,77,1,0,18,1,4,1, 0,255,0,0,0,13,"77 DS/DD"}}, + {80 * 18 * 2 * 128, {0,80,1,0,18,1,0,0,128,255,0,0,0,13,"80 DS/SD"}}, + {80 * 26 * 2 * 128, {1,80,1,0,26,1,4,0,128,255,0,0,0,13,"80 DS/MD"}}, + {(80 * 18 * 2 - 3) * 256 + 3 * 128, {2,80,1,0,18,1,4,1, 0,255,0,0,0,13,"80 DS/DD"}}, + {0, {0,}} +}; + +/***************************************************************************** + * + * Open a floppy image for drive 'drive' if it is not yet openend + * and a name was given. Determine the image geometry depending on the + * type of image and store the results into the global drv[] structure + * + *****************************************************************************/ + +#define MAXSIZE 5760 * 256 + 80 +static void _atari_load_proc(device_image_interface &image) +{ + atari_fdc_device *atarifdc = static_cast(image.device().owner()); + atarifdc->atari_load_proc(image); +} + +void atari_fdc_device::atari_load_proc(device_image_interface &image) +{ + int id = floppy_get_drive(image); + int size, i; + const char *ext; + + m_drv[id].image = auto_alloc_array(image.device().machine(),UINT8,MAXSIZE); + if (!m_drv[id].image) + return; + + /* tell whether the image is writable */ + m_drv[id].mode = !image.is_readonly(); + /* set up image if it has been created */ + if (image.has_been_created()) + { + int sector; + char buff[256]; + memset(buff, 0, sizeof(buff)); + /* default to 720 sectors */ + for( sector = 0; sector < 720; sector++ ) + image.fwrite(buff, 256); + image.fseek(0, SEEK_SET); + } + + size = image.fread(m_drv[id].image, MAXSIZE); + + if( size <= 0 ) + { + m_drv[id].image = NULL; + return; + } + + + /* re allocate the buffer; we don't want to be too lazy ;) */ + //m_drv[id].image = (UINT8*)image.image_realloc(m_drv[id].image, size); + + ext = image.filetype(); + + // hack alert, this means we can only load ATR via the softlist at the moment, image.filetype reutrns NULL :/ + if (image.software_entry() != NULL) ext="ATR"; + + /* no extension: assume XFD format (no header) */ + if (!ext) + { + m_drv[id].type = FORMAT_XFD; + m_drv[id].header_skip = 0; + } + else + /* XFD extension */ + if( toupper(ext[0])=='X' && toupper(ext[1])=='F' && toupper(ext[2])=='D' ) + { + m_drv[id].type = FORMAT_XFD; + m_drv[id].header_skip = 0; + } + else + /* ATR extension */ + if( toupper(ext[0])=='A' && toupper(ext[1])=='T' && toupper(ext[2])=='R' ) + { + m_drv[id].type = FORMAT_ATR; + m_drv[id].header_skip = 16; + } + else + /* DSK extension */ + if( toupper(ext[0])=='D' && toupper(ext[1])=='S' && toupper(ext[2])=='K' ) + { + m_drv[id].type = FORMAT_DSK; + m_drv[id].header_skip = sizeof(atari_dsk_format); + } + else + { + m_drv[id].type = FORMAT_XFD; + m_drv[id].header_skip = 0; + } + + if( m_drv[id].type == FORMAT_ATR && + (m_drv[id].image[0] != 0x96 || m_drv[id].image[1] != 0x02) ) + { + m_drv[id].type = FORMAT_XFD; + m_drv[id].header_skip = 0; + } + + + switch (m_drv[id].type) + { + /* XFD or unknown format: find a matching size from the table */ + case FORMAT_XFD: + for( i = 0; xfd_formats[i].size; i++ ) + { + if( size == xfd_formats[i].size ) + { + m_drv[id].density = xfd_formats[i].dsk.density; + m_drv[id].tracks = xfd_formats[i].dsk.tracks; + m_drv[id].spt = xfd_formats[i].dsk.spt; + m_drv[id].heads = (xfd_formats[i].dsk.doublesided) ? 2 : 1; + m_drv[id].bseclen = 128; + m_drv[id].seclen = 256 * xfd_formats[i].dsk.seclen_hi + xfd_formats[i].dsk.seclen_lo; + m_drv[id].sectors = m_drv[id].tracks * m_drv[id].heads * m_drv[id].spt; + break; + } + } + break; + /* ATR format: find a size including the 16 bytes header */ + case FORMAT_ATR: + { + int s; + m_drv[id].bseclen = 128; + /* get sectors from ATR header */ + s = (size - 16) / 128; + /* 3 + odd number of sectors ? */ + if ( m_drv[id].image[4] == 128 || (s % 18) == 0 || (s % 26) == 0 || ((s - 3) % 1) != 0 ) + { + m_drv[id].sectors = s; + m_drv[id].seclen = 128; + /* sector size 128 or count not evenly dividable by 26 ? */ + if( m_drv[id].seclen == 128 || (s % 26) != 0 ) + { + /* yup! single density */ + m_drv[id].density = 0; + m_drv[id].spt = 18; + m_drv[id].heads = 1; + m_drv[id].tracks = s / 18; + if( s % 18 != 0 ) + m_drv[id].tracks += 1; + if( m_drv[id].tracks % 2 == 0 && m_drv[id].tracks > 80 ) + { + m_drv[id].heads = 2; + m_drv[id].tracks /= 2; + } + } + else + { + /* yes: medium density */ + m_drv[id].density = 0; + m_drv[id].spt = 26; + m_drv[id].heads = 1; + m_drv[id].tracks = s / 26; + if( s % 26 != 0 ) + m_drv[id].tracks += 1; + if( m_drv[id].tracks % 2 == 0 && m_drv[id].tracks > 80 ) + { + m_drv[id].heads = 2; + m_drv[id].tracks /= 2; + } + } + } + else + { + /* it's double density */ + s = (s - 3) / 2 + 3; + m_drv[id].sectors = s; + m_drv[id].density = 2; + m_drv[id].seclen = 256; + m_drv[id].spt = 18; + m_drv[id].heads = 1; + m_drv[id].tracks = s / 18; + if( s % 18 != 0 ) + m_drv[id].tracks += 1; + if( m_drv[id].tracks % 2 == 0 && m_drv[id].tracks > 80 ) + { + m_drv[id].heads = 2; + m_drv[id].tracks /= 2; + } + } + } + break; + /* DSK format: it's all in the header */ + case FORMAT_DSK: + { + atari_dsk_format *dsk = (atari_dsk_format *) m_drv[id].image; + + m_drv[id].tracks = dsk->tracks; + m_drv[id].spt = dsk->spt; + m_drv[id].heads = (dsk->doublesided) ? 2 : 1; + m_drv[id].seclen = 256 * dsk->seclen_hi + dsk->seclen_lo; + m_drv[id].bseclen = m_drv[id].seclen; + m_drv[id].sectors = m_drv[id].tracks * m_drv[id].heads * m_drv[id].spt; + } + break; + } + logerror("atari opened floppy '%s', %d sectors (%d %s%s) %d bytes/sector\n", + image.filename(), + m_drv[id].sectors, + m_drv[id].tracks, + (m_drv[id].heads == 1) ? "SS" : "DS", + (m_drv[id].density == 0) ? "SD" : (m_drv[id].density == 1) ? "MD" : "DD", + m_drv[id].seclen); + return; +} + + + +/***************************************************************************** + * + * This is a description of the data flow between Atari (A) and the + * Floppy (F) for the supported commands. + * + * A->F DEV CMD AUX1 AUX2 CKS + * '1' 'S' 00 00 get status + * F->A ACK CPL 04 FF E0 00 CKS + * ^ ^ + * | | + * | bit 7 : door closed + * | + * bit7 : MD 128 bytes/sector, 26 sectors/track + * bit5 : DD 256 bytes/sector, 18 sectors/track + * else : SD 128 bytes/sector, 18 sectors/track + * + * A->F DEV CMD AUX1 AUX2 CKS + * '1' 'R' SECL SECH read sector + * F->A ACK command acknowledge + * *** now read the sector + * F->A CPL complete: sector read + * F->A 128/256 byte CKS + * + * A->F DEV CMD AUX1 AUX2 CKS + * '1' 'W' SECL SECH write with verify + * F->A ACK command acknowledge + * A->F 128/256 data CKS + * F->A CPL complete: CKS okay + * execute writing the sector + * F->A CPL complete: sector written + * + * A->F DEV CMD AUX1 AUX2 CKS + * '1' 'P' SECL SECH put sector + * F->A ACK command acknowledge + * A->F 128/256 data CKS + * F->A CPL complete: CKS okay + * execute writing the sector + * F->A CPL complete: sector written + * + * A->F DEV CMD AUX1 AUX2 CKS + * '1' '!' xx xx single density format + * F->A ACK command acknowledge + * execute formatting + * F->A CPL complete: format + * F->A 128/256 byte CKS bad sector table + * + * + * A->F DEV CMD AUX1 AUX2 CKS + * '1' '"' xx xx double density format + * F->A ACK command acknowledge + * execute formatting + * F->A CPL complete: format + * F->A 128/256 byte CKS bad sector table + * + *****************************************************************************/ +static void make_chksum(UINT8 * chksum, UINT8 data) +{ + UINT8 newone; + newone= *chksum + data; + if (newone < *chksum) + newone++; + + if (VERBOSE_CHKSUM) + logerror("atari chksum old $%02x + data $%02x -> new $%02x\n", *chksum, data, newone); + + *chksum = newone; +} + +void atari_fdc_device::clr_serout(int expect_data) +{ + m_serout_chksum = 0; + m_serout_offs = 0; + m_serout_count = expect_data + 1; +} + +void atari_fdc_device::add_serout(int expect_data) +{ + m_serout_chksum = 0; + m_serout_count = expect_data + 1; +} + +void atari_fdc_device::clr_serin(int ser_delay) +{ + pokey_device *pokey = machine().device("pokey"); + m_serin_chksum = 0; + m_serin_offs = 0; + m_serin_count = 0; + pokey->serin_ready(ser_delay * 40); +} + +void atari_fdc_device::add_serin(UINT8 data, int with_checksum) +{ + m_serin_buff[m_serin_count++] = data; + if (with_checksum) + make_chksum(&m_serin_chksum, data); +} + +static void ATTR_PRINTF(1,2) atari_set_frame_message(const char *fmt, ...) +{ + //va_list arg; + //va_start(arg, fmt); + + //vsprintf(atari_frame_message, fmt, arg); + //atari_frame_counter = 30; /* FIXME */ + + //va_end(arg); +} + +void atari_fdc_device::a800_serial_command() +{ + int i, drive, sector, offset; + + if( !m_serout_offs ) + { + if (VERBOSE_SERIAL) + logerror("atari serout command offset = 0\n"); + return; + } + clr_serin(10); + + if (VERBOSE_SERIAL) + { + logerror("atari serout command %d: %02X %02X %02X %02X %02X : %02X ", + m_serout_offs, + m_serout_buff[0], m_serout_buff[1], m_serout_buff[2], + m_serout_buff[3], m_serout_buff[4], m_serout_chksum); + } + + if (m_serout_chksum == 0) + { + if (VERBOSE_SERIAL) + logerror("OK\n"); + + drive = m_serout_buff[0] - '1'; /* drive # */ + /* sector # */ + if (drive < 0 || drive > 3) /* ignore unknown drives */ + { + logerror("atari unsupported drive #%d\n", drive+1); + atari_set_frame_message("DRIVE #%d not supported", drive+1); + return; + } + + /* extract sector number from the command buffer */ + sector = m_serout_buff[2] + 256 * m_serout_buff[3]; + + switch (m_serout_buff[1]) /* command ? */ + { + case 'S': /* status */ + atari_set_frame_message("DRIVE #%d STATUS", drive+1); + + if (VERBOSE_SERIAL) + logerror("atari status\n"); + + add_serin('A',0); + add_serin('C',0); + if (!m_drv[drive].mode) /* read only mode ? */ + { + if (m_drv[drive].spt == 26) + add_serin(0x80,1); /* MD: 0x80 */ + else + if (m_drv[drive].seclen == 128) + add_serin(0x00,1); /* SD: 0x00 */ + else + add_serin(0x20,1); /* DD: 0x20 */ + } + else + { + if (m_drv[drive].spt == 26) + add_serin(0x84,1); /* MD: 0x84 */ + else + if (m_drv[drive].seclen == 128) + add_serin(0x04,1); /* SD: 0x04 */ + else + add_serin(0x24,1); /* DD: 0x24 */ + } + if (m_drv[drive].image) + add_serin(0xff,1); /* door closed: 0xff */ + else + add_serin(0x7f,1); /* door open: 0x7f */ + add_serin(0xe0,1); /* dunno */ + add_serin(0x00,1); /* dunno */ + add_serin(m_serin_chksum,0); + break; + + case 'R': /* read sector */ + if (VERBOSE_SERIAL) + logerror("atari read sector #%d\n", sector); + + if( sector < 1 || sector > m_drv[drive].sectors ) + { + atari_set_frame_message("DRIVE #%d READ SECTOR #%3d - ERR", drive+1, sector); + + if (VERBOSE_SERIAL) + logerror("atari bad sector #\n"); + + add_serin('E',0); + break; + } + add_serin('A',0); /* acknowledge */ + add_serin('C',0); /* completed */ + if (sector < 4) /* sector 1 .. 3 might be different length */ + { + atari_set_frame_message("DRIVE #%d READ SECTOR #%3d - SD", drive+1, sector); + offset = (sector - 1) * m_drv[drive].bseclen + m_drv[drive].header_skip; + for (i = 0; i < 128; i++) + add_serin(m_drv[drive].image[offset++],1); + } + else + { + atari_set_frame_message("DRIVE #%d READ SECTOR #%3d - %cD", drive+1, sector, (m_drv[drive].seclen == 128) ? 'S' : 'D'); + offset = (sector - 1) * m_drv[drive].seclen + m_drv[drive].header_skip; + for (i = 0; i < m_drv[drive].seclen; i++) + add_serin(m_drv[drive].image[offset++],1); + } + add_serin(m_serin_chksum,0); + break; + + case 'W': /* write sector with verify */ + if (VERBOSE_SERIAL) + logerror("atari write sector #%d\n", sector); + + add_serin('A',0); + if (sector < 4) /* sector 1 .. 3 might be different length */ + { + add_serout(m_drv[drive].bseclen); + atari_set_frame_message("DRIVE #%d WRITE SECTOR #%3d - SD", drive+1, sector); + } + else + { + add_serout(m_drv[drive].seclen); + atari_set_frame_message("DRIVE #%d WRITE SECTOR #%3d - %cD", drive+1, sector, (m_drv[drive].seclen == 128) ? 'S' : 'D'); + } + break; + + case 'P': /* put sector (no verify) */ + if (VERBOSE_SERIAL) + logerror("atari put sector #%d\n", sector); + + add_serin('A',0); + if (sector < 4) /* sector 1 .. 3 might be different length */ + { + add_serout(m_drv[drive].bseclen); + atari_set_frame_message("DRIVE #%d PUT SECTOR #%3d - SD", drive+1, sector); + } + else + { + add_serout(m_drv[drive].seclen); + atari_set_frame_message("DRIVE #%d PUT SECTOR #%3d - %cD", drive+1, sector, (m_drv[drive].seclen == 128) ? 'S' : 'D'); + } + break; + + case '!': /* SD format */ + if (VERBOSE_SERIAL) + logerror("atari format SD drive #%d\n", drive+1); + + atari_set_frame_message("DRIVE #%d FORMAT SD", drive+1); + add_serin('A',0); /* acknowledge */ + add_serin('C',0); /* completed */ + for (i = 0; i < 128; i++) + add_serin(0,1); + add_serin(m_serin_chksum,0); + break; + + case '"': /* DD format */ + if (VERBOSE_SERIAL) + logerror("atari format DD drive #%d\n", drive+1); + + atari_set_frame_message("DRIVE #%d FORMAT DD", drive+1); + add_serin('A',0); /* acknowledge */ + add_serin('C',0); /* completed */ + for (i = 0; i < 256; i++) + add_serin(0,1); + add_serin(m_serin_chksum,0); + break; + + default: + if (VERBOSE_SERIAL) + logerror("atari unknown command #%c\n", m_serout_buff[1]); + + atari_set_frame_message("DRIVE #%d UNKNOWN CMD '%c'", drive+1, m_serout_buff[1]); + add_serin('N',0); /* negative acknowledge */ + } + } + else + { + atari_set_frame_message("serial cmd chksum error"); + if (VERBOSE_SERIAL) + logerror("BAD\n"); + + add_serin('E',0); + } + if (VERBOSE_SERIAL) + logerror("atari %d bytes to read\n", m_serin_count); +} + +void atari_fdc_device::a800_serial_write() +{ + int i, drive, sector, offset; + + if (VERBOSE_SERIAL) + { + logerror("atari serout %d bytes written : %02X ", + m_serout_offs, m_serout_chksum); + } + + clr_serin(80); + if (m_serout_chksum == 0) + { + if (VERBOSE_SERIAL) + logerror("OK\n"); + + add_serin('C',0); + /* write the sector */ + drive = m_serout_buff[0] - '1'; /* drive # */ + /* not write protected and image available ? */ + if (m_drv[drive].mode && m_drv[drive].image) + { + /* extract sector number from the command buffer */ + sector = m_serout_buff[2] + 256 * m_serout_buff[3]; + if (sector < 4) /* sector 1 .. 3 might be different length */ + { + offset = (sector - 1) * m_drv[drive].bseclen + m_drv[drive].header_skip; + + if (VERBOSE_SERIAL) + logerror("atari storing 128 byte sector %d at offset 0x%08X", sector, offset ); + + for (i = 0; i < 128; i++) + m_drv[drive].image[offset++] = m_serout_buff[5+i]; + atari_set_frame_message("DRIVE #%d WROTE SECTOR #%3d - SD", drive+1, sector); + } + else + { + offset = (sector - 1) * m_drv[drive].seclen + m_drv[drive].header_skip; + + if (VERBOSE_SERIAL) + logerror("atari storing %d byte sector %d at offset 0x%08X", m_drv[drive].seclen, sector, offset ); + + for (i = 0; i < m_drv[drive].seclen; i++) + m_drv[drive].image[offset++] = m_serout_buff[5+i]; + atari_set_frame_message("DRIVE #%d WROTE SECTOR #%3d - %cD", drive+1, sector, (m_drv[drive].seclen == 128) ? 'S' : 'D'); + } + add_serin('C',0); + } + else + { + add_serin('E',0); + } + } + else + { + if (VERBOSE_SERIAL) + logerror("BAD\n"); + + add_serin('E',0); + } +} + +READ8_MEMBER( atari_fdc_device::serin_r ) +{ + int data = 0x00; + int ser_delay = 0; + + if (m_serin_count) + { + pokey_device *pokey = machine().device("pokey"); + + data = m_serin_buff[m_serin_offs]; + ser_delay = 2 * 40; + if (m_serin_offs < 3) + { + ser_delay = 4 * 40; + if (m_serin_offs < 2) + ser_delay = 200 * 40; + } + m_serin_offs++; + if (--m_serin_count == 0) + m_serin_offs = 0; + else + pokey->serin_ready(ser_delay); + } + + if (VERBOSE_SERIAL) + logerror("atari serin[$%04x] -> $%02x; delay %d\n", m_serin_offs, data, ser_delay); + + return data; +} + +WRITE8_MEMBER( atari_fdc_device::serout_w ) +{ + pia6821_device *pia = machine().device( "pia" ); + + /* ignore serial commands if no floppy image is specified */ + if( !m_drv[0].image ) + return; + if (m_serout_count) + { + /* store data */ + m_serout_buff[m_serout_offs] = data; + + if (VERBOSE_SERIAL) + logerror("atari serout[$%04x] <- $%02x; count %d\n", m_serout_offs, data, m_serout_count); + + m_serout_offs++; + if (--m_serout_count == 0) + { + /* exclusive or written checksum with calculated */ + m_serout_chksum ^= data; + /* if the attention line is high, this should be data */ + if (pia->irq_b_state()) + a800_serial_write(); + } + else + { + make_chksum(&m_serout_chksum, data); + } + } +} + +WRITE_LINE_MEMBER(atari_fdc_device::pia_cb2_w) +{ + if (!state) + { + clr_serout(4); /* expect 4 command bytes + checksum */ + } + else + { + m_serin_delay = 0; + a800_serial_command(); + } +} + +static const floppy_interface atari_floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(atari_only), + "floppy_5_25" +}; + +static MACHINE_CONFIG_FRAGMENT( atari_fdc ) + MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(atari_floppy_interface) +MACHINE_CONFIG_END + +legacy_floppy_image_device *atari_fdc_device::atari_floppy_get_device_child(int drive) +{ + switch(drive) { + case 0 : return subdevice(FLOPPY_0); + case 1 : return subdevice(FLOPPY_1); + case 2 : return subdevice(FLOPPY_2); + case 3 : return subdevice(FLOPPY_3); + } + return NULL; +} + +const device_type ATARI_FDC = &device_creator; + +atari_fdc_device::atari_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ATARI_FDC, "Atari FDC", tag, owner, clock, "atari_fdc", __FILE__), + m_serout_count(0), + m_serout_offs(0), + m_serout_chksum(0), +// m_serout_delay(0), + m_serin_count(0), + m_serin_offs(0), + m_serin_chksum(0), + m_serin_delay(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void atari_fdc_device::device_start() +{ + int id; + + memset(m_serout_buff, 0, sizeof(m_serout_buff)); + memset(m_serin_buff, 0, sizeof(m_serin_buff)); + memset(m_drv, 0, sizeof(m_drv)); + + for(id=0;id<4;id++) + { + atari_floppy_get_device_child(id)->floppy_install_load_proc(_atari_load_proc); + } +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor atari_fdc_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( atari_fdc ); +} diff --git a/src/mame/machine/atarifdc.h b/src/mame/machine/atarifdc.h new file mode 100644 index 00000000000..29aea88ad86 --- /dev/null +++ b/src/mame/machine/atarifdc.h @@ -0,0 +1,69 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/* + ataridev.h + +*/ + +#ifndef _ATARIFDC_H +#define _ATARIFDC_H + +#include "imagedev/flopdrv.h" + +class atari_fdc_device : public device_t +{ +public: + atari_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER( serin_r ); + DECLARE_WRITE8_MEMBER( serout_w ); + DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); + void atari_load_proc(device_image_interface &image); + +protected: + // device-level overrides + virtual void device_start(); + virtual machine_config_constructor device_mconfig_additions() const; + +private: + void clr_serout(int expect_data); + void add_serout(int expect_data); + void clr_serin(int ser_delay); + void add_serin(UINT8 data, int with_checksum); + void a800_serial_command(); + void a800_serial_write(); + legacy_floppy_image_device *atari_floppy_get_device_child(int drive); + + struct atari_drive + { + UINT8 *image; /* alloc'd image */ + int type; /* type of image (XFD, ATR, DSK) */ + int mode; /* 0 read only, != 0 read/write */ + int density; /* 0 SD, 1 MD, 2 DD */ + int header_skip; /* number of bytes in format header */ + int tracks; /* number of tracks (35,40,77,80) */ + int heads; /* number of heads (1,2) */ + int spt; /* sectors per track (18,26) */ + int seclen; /* sector length (128,256) */ + int bseclen; /* boot sector length (sectors 1..3) */ + int sectors; /* total sectors, ie. tracks x heads x spt */ + }; + + int m_serout_count; + int m_serout_offs; + UINT8 m_serout_buff[512]; + UINT8 m_serout_chksum; +// int m_serout_delay; + + int m_serin_count; + int m_serin_offs; + UINT8 m_serin_buff[512]; + UINT8 m_serin_chksum; + int m_serin_delay; + + atari_drive m_drv[4]; +}; + +extern const device_type ATARI_FDC; + +#endif /* _ATARIFDC_H */ diff --git a/src/mame/machine/b2m.c b/src/mame/machine/b2m.c new file mode 100644 index 00000000000..2ff9f595aa1 --- /dev/null +++ b/src/mame/machine/b2m.c @@ -0,0 +1,304 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Bashkiria-2M machine driver by Miodrag Milanovic + + 28/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "machine/wd_fdc.h" +#include "machine/pic8259.h" +#include "machine/i8251.h" +#include "includes/b2m.h" +#include "machine/ram.h" +#include "imagedev/flopdrv.h" + +READ8_MEMBER(b2m_state::b2m_keyboard_r) +{ + UINT8 key = 0x00; + if (offset < 0x100) { + if ((offset & 0x01)!=0) { key |= ioport("LINE0")->read(); } + if ((offset & 0x02)!=0) { key |= ioport("LINE1")->read(); } + if ((offset & 0x04)!=0) { key |= ioport("LINE2")->read(); } + if ((offset & 0x08)!=0) { key |= ioport("LINE3")->read(); } + if ((offset & 0x10)!=0) { key |= ioport("LINE4")->read(); } + if ((offset & 0x20)!=0) { key |= ioport("LINE5")->read(); } + if ((offset & 0x40)!=0) { key |= ioport("LINE6")->read(); } + if ((offset & 0x80)!=0) { key |= ioport("LINE7")->read(); } + } else { + if ((offset & 0x01)!=0) { key |= ioport("LINE8")->read(); } + if ((offset & 0x02)!=0) { key |= ioport("LINE9")->read(); } + if ((offset & 0x04)!=0) { key |= ioport("LINE10")->read(); } + } + return key; +} + + +void b2m_state::b2m_set_bank(int bank) +{ + UINT8 *rom; + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + space.install_write_bank(0x0000, 0x27ff, "bank1"); + space.install_write_bank(0x2800, 0x2fff, "bank2"); + space.install_write_bank(0x3000, 0x6fff, "bank3"); + space.install_write_bank(0x7000, 0xdfff, "bank4"); + space.install_write_bank(0xe000, 0xffff, "bank5"); + + rom = memregion("maincpu")->base(); + switch(bank) { + case 0 : + case 1 : + space.unmap_write(0xe000, 0xffff); + + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x2800); + membank("bank3")->set_base(ram + 0x3000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); + break; +#if 0 + case 1 : + space.unmap_write(0x3000, 0x6fff); + space.unmap_write(0xe000, 0xffff); + + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x2800); + membank("bank3")->set_base(rom + 0x12000); + membank("bank4")->set_base(rom + 0x16000); + membank("bank5")->set_base(rom + 0x10000); + break; +#endif + case 2 : + space.unmap_write(0x2800, 0x2fff); + space.unmap_write(0xe000, 0xffff); + + membank("bank1")->set_base(ram); + space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); + membank("bank3")->set_base(ram + 0x10000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); + break; + case 3 : + space.unmap_write(0x2800, 0x2fff); + space.unmap_write(0xe000, 0xffff); + + membank("bank1")->set_base(ram); + space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); + membank("bank3")->set_base(ram + 0x14000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); + break; + case 4 : + space.unmap_write(0x2800, 0x2fff); + space.unmap_write(0xe000, 0xffff); + + membank("bank1")->set_base(ram); + space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); + membank("bank3")->set_base(ram + 0x18000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); + + break; + case 5 : + space.unmap_write(0x2800, 0x2fff); + space.unmap_write(0xe000, 0xffff); + + membank("bank1")->set_base(ram); + space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); + membank("bank3")->set_base(ram + 0x1c000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); + + break; + case 6 : + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x2800); + membank("bank3")->set_base(ram + 0x3000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(ram + 0xe000); + break; + case 7 : + space.unmap_write(0x0000, 0x27ff); + space.unmap_write(0x2800, 0x2fff); + space.unmap_write(0x3000, 0x6fff); + space.unmap_write(0x7000, 0xdfff); + space.unmap_write(0xe000, 0xffff); + + membank("bank1")->set_base(rom + 0x10000); + membank("bank2")->set_base(rom + 0x10000); + membank("bank3")->set_base(rom + 0x10000); + membank("bank4")->set_base(rom + 0x10000); + membank("bank5")->set_base(rom + 0x10000); + break; + } +} + + +WRITE_LINE_MEMBER(b2m_state::bm2_pit_out1) +{ + m_speaker->level_w(state); +} + +WRITE8_MEMBER(b2m_state::b2m_8255_porta_w) +{ + m_b2m_8255_porta = data; +} + +WRITE8_MEMBER(b2m_state::b2m_8255_portb_w) +{ + m_b2m_video_scroll = data; +} + +WRITE8_MEMBER(b2m_state::b2m_8255_portc_w) +{ + m_b2m_8255_portc = data; + b2m_set_bank(m_b2m_8255_portc & 7); + m_b2m_video_page = (m_b2m_8255_portc >> 7) & 1; +} + +READ8_MEMBER(b2m_state::b2m_8255_portb_r) +{ + return m_b2m_video_scroll; +} + +WRITE_LINE_MEMBER( b2m_state::b2m_fdc_drq ) +{ + /* Clears HALT state of CPU when data is ready to read */ + if (state) + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); +} + + +WRITE8_MEMBER(b2m_state::b2m_ext_8255_portc_w) +{ + UINT8 drive = ((data >> 1) & 1) ^ 1; + UINT8 side = (data & 1) ^ 1; + + static const char *names[] = { "fd0", "fd1"}; + floppy_image_device *floppy = NULL; + floppy_connector *con = machine().device(names[drive]); + if(con) + floppy = con->get_device(); + + floppy->mon_w(0); + m_fdc->set_floppy(floppy); + if (m_b2m_drive!=drive) { + m_b2m_drive = drive; + } + + if (m_b2m_side!=side) { + m_b2m_side = side; + floppy->ss_w(side); + } + /* + When bit 5 is set CPU is in HALT state and stay there until + DRQ is triggered from floppy side + */ + + if ((data & 0xf0)==0x20) { + m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + } +} + +READ8_MEMBER(b2m_state::b2m_romdisk_porta_r) +{ + UINT8 *romdisk = memregion("maincpu")->base() + 0x12000; + return romdisk[m_b2m_romdisk_msb*256+m_b2m_romdisk_lsb]; +} + +WRITE8_MEMBER(b2m_state::b2m_romdisk_portb_w) +{ + m_b2m_romdisk_lsb = data; +} + +WRITE8_MEMBER(b2m_state::b2m_romdisk_portc_w) +{ + m_b2m_romdisk_msb = data & 0x7f; +} + +/* Driver initialization */ +DRIVER_INIT_MEMBER(b2m_state,b2m) +{ + m_vblank_state = 0; +} + +WRITE8_MEMBER(b2m_state::b2m_palette_w) +{ + UINT8 b = (3 - ((data >> 6) & 3)) * 0x55; + UINT8 g = (3 - ((data >> 4) & 3)) * 0x55; + UINT8 r = (3 - ((data >> 2) & 3)) * 0x55; + + UINT8 bw = (3 - (data & 3)) * 0x55; + + m_b2m_color[offset & 3] = data; + + if (ioport("MONITOR")->read()==1) { + m_palette->set_pen_color(offset, r, g, b); + } else { + m_palette->set_pen_color(offset, bw, bw, bw); + } +} + +READ8_MEMBER(b2m_state::b2m_palette_r) +{ + return m_b2m_color[offset]; +} + +WRITE8_MEMBER(b2m_state::b2m_localmachine_w) +{ + m_b2m_localmachine = data; +} + +READ8_MEMBER(b2m_state::b2m_localmachine_r) +{ + return m_b2m_localmachine; +} + +void b2m_state::b2m_postload() +{ + b2m_set_bank(m_b2m_8255_portc & 7); +} + +void b2m_state::machine_start() +{ + m_pic = machine().device("pic8259"); + m_fdc = machine().device("fd1793"); + + /* register for state saving */ + save_item(NAME(m_b2m_8255_porta)); + save_item(NAME(m_b2m_video_scroll)); + save_item(NAME(m_b2m_8255_portc)); + save_item(NAME(m_b2m_video_page)); + save_item(NAME(m_b2m_drive)); + save_item(NAME(m_b2m_side)); + save_item(NAME(m_b2m_romdisk_lsb)); + save_item(NAME(m_b2m_romdisk_msb)); + save_pointer(NAME(m_b2m_color), 4); + save_item(NAME(m_b2m_localmachine)); + save_item(NAME(m_vblank_state)); + + machine().save().register_postload(save_prepost_delegate(FUNC(b2m_state::b2m_postload), this)); +} + +INTERRUPT_GEN_MEMBER(b2m_state::b2m_vblank_interrupt) +{ + m_vblank_state++; + if (m_vblank_state>1) m_vblank_state=0; + m_pic->ir0_w(m_vblank_state); +} + +void b2m_state::machine_reset() +{ + m_b2m_side = 0; + m_b2m_drive = 0; + + b2m_set_bank(7); +} diff --git a/src/mame/machine/bbc.c b/src/mame/machine/bbc.c new file mode 100644 index 00000000000..3ffefc8a585 --- /dev/null +++ b/src/mame/machine/bbc.c @@ -0,0 +1,1861 @@ +// license:BSD-3-Clause +// copyright-holders:Gordon Jefferyes, Nigel Barnes +/****************************************************************************** + BBC Model B + + MESS Driver By: + + Gordon Jefferyes + mess_bbc@romvault.com + Nigel Barnes + ngbarnes@hotmail.com + +******************************************************************************/ + +#include +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "sound/tms5220.h" +#include "machine/6522via.h" +#include "machine/wd_fdc.h" +#include "imagedev/flopdrv.h" +#include "includes/bbc.h" +#include "machine/mc146818.h" +#include "bus/centronics/ctronics.h" +#include "imagedev/cassette.h" + + +void bbc_state::check_interrupts() +{ + m_maincpu->set_input_line(M6502_IRQ_LINE, m_via_system_irq || m_via_user_irq || m_acia_irq || m_ACCCON_IRR); +} + +/************************* +Model A memory handling functions +*************************/ + +/* for the model A just address the 4 on board ROM sockets */ +WRITE8_MEMBER(bbc_state::bbc_page_selecta_w) +{ + m_bank4->set_entry(data & 0x03); +} + + +WRITE8_MEMBER(bbc_state::bbc_memorya1_w) +{ + m_region_maincpu->base()[offset]=data; +} + +/************************* +Model B memory handling functions +*************************/ + +/* the model B address all 16 of the ROM sockets */ +WRITE8_MEMBER(bbc_state::bbc_page_selectb_w) +{ + m_rombank = data & 0x0f; + m_bank4->set_entry(m_rombank); +} + + +WRITE8_MEMBER(bbc_state::bbc_memoryb3_w) +{ + if (m_ram->size() == 32*1024) + { + m_region_maincpu->base()[offset + 0x4000] = data; + } + else + { + m_region_maincpu->base()[offset] = data; + } +} + +/* I have setup 3 types of sideways ram: +0: none +1: 128K (bank 8 to 15) Solidisc sideways ram userport bank latch +2: 64K (banks 4 to 7) for Acorn sideways ram FE30 bank latch +3: 128K (banks 8 to 15) for Acown sideways ram FE30 bank latch +*/ +static const unsigned short bbc_SWRAMtype1[16]={0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1}; +static const unsigned short bbc_SWRAMtype2[16]={0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0}; +static const unsigned short bbc_SWRAMtype3[16]={0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1}; + +WRITE8_MEMBER(bbc_state::bbc_memoryb4_w) +{ + switch (m_SWRAMtype) + { + case 1: if (bbc_SWRAMtype1[m_userport]) m_region_opt->base()[(m_userport << 14) + offset] = data; + case 2: if (bbc_SWRAMtype2[m_rombank]) m_region_opt->base()[(m_rombank << 14) + offset] = data; + case 3: if (bbc_SWRAMtype3[m_rombank]) m_region_opt->base()[(m_rombank << 14) + offset] = data; + } +} + +/****************************************/ +/* BBC B Plus memory handling function */ +/****************************************/ + + +/* this function should return true if + the instruction is in the VDU driver address ranged + these are set when: + PC is in the range c000 to dfff + or if pagedRAM set and PC is in the range a000 to afff +*/ +int bbc_state::vdudriverset() +{ + int PC; + PC = machine().device("maincpu")->safe_pc(); // this needs to be set to the 6502 program counter + return (((PC >= 0xc000) && (PC <= 0xdfff)) || ((m_pagedRAM) && ((PC >= 0xa000) && (PC <= 0xafff)))); +} + + +/* the model B Plus addresses all 16 of the ROM sockets plus the extra 12K of ram at 0x8000 + and 20K of shadow ram at 0x3000 */ +WRITE8_MEMBER(bbc_state::bbc_page_selectbp_w) +{ + if ((offset&0x04)==0) + { + m_pagedRAM = (data >> 7) & 0x01; + m_rombank = data & 0x0f; + + if (m_pagedRAM) + { + /* if paged ram then set 8000 to afff to read from the ram 8000 to afff */ + m_bank4->set_entry(0x10); + } + else + { + /* if paged rom then set the rom to be read from 8000 to afff */ + m_bank4->set_entry(m_rombank); + }; + + /* set the rom to be read from b000 to bfff */ + m_bank6->set_entry(m_rombank); + } + else + { + //the video display should now use this flag to display the shadow ram memory + m_vdusel=(data>>7)&0x01; + bbcbp_setvideoshadow(m_vdusel); + //need to make the video display do a full screen refresh for the new memory area + m_bank2->set_base(m_region_maincpu->base() + 0x3000); + } +} + + +/* write to the normal memory from 0x0000 to 0x2fff + the writes to this memory are just done the normal + way */ + +WRITE8_MEMBER(bbc_state::bbc_memorybp1_w) +{ + m_region_maincpu->base()[offset]=data; +} + + +/* the next two function handle reads and write to the shadow video ram area + between 0x3000 and 0x7fff + + when vdusel is set high the video display uses the shadow ram memory + the processor only reads and write to the shadow ram when vdusel is set + and when the instruction being executed is stored in a set range of memory + addresses known as the VDU driver instructions. +*/ + + +DIRECT_UPDATE_MEMBER(bbc_state::bbcbp_direct_handler) +{ + UINT8 *RAM = m_region_maincpu->base(); + if (m_vdusel == 0) + { + // not in shadow ram mode so just read normal ram + m_bank2->set_base(RAM + 0x3000); + } + else + { + if (vdudriverset()) + { + // if VDUDriver set then read from shadow ram + m_bank2->set_base(RAM + 0xb000); + } + else + { + // else read from normal ram + m_bank2->set_base(RAM + 0x3000); + } + } + return address; +} + + +WRITE8_MEMBER(bbc_state::bbc_memorybp2_w) +{ + UINT8 *RAM = m_region_maincpu->base(); + if (m_vdusel==0) + { + // not in shadow ram mode so just write to normal ram + RAM[offset + 0x3000] = data; + } + else + { + if (vdudriverset()) + { + // if VDUDriver set then write to shadow ram + RAM[offset + 0xb000] = data; + } + else + { + // else write to normal ram + RAM[offset + 0x3000] = data; + } + } +} + + +/* if the pagedRAM is set write to RAM between 0x8000 to 0xafff +otherwise this area contains ROM so no write is required */ +WRITE8_MEMBER(bbc_state::bbc_memorybp4_w) +{ + if (m_pagedRAM) + { + m_region_maincpu->base()[offset+0x8000]=data; + } +} + + +/* the BBC B plus 128K had extra ram mapped in replacing the +rom bank 0,1,c and d. +The function memorybp3_128_w handles memory writes from 0x8000 to 0xafff +which could either be sideways ROM, paged RAM, or sideways RAM. +The function memorybp4_128_w handles memory writes from 0xb000 to 0xbfff +which could either be sideways ROM or sideways RAM */ + + +static const unsigned short bbc_b_plus_sideways_ram_banks[16]={ 1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0 }; + + +WRITE8_MEMBER(bbc_state::bbc_memorybp4_128_w) +{ + if (m_pagedRAM) + { + m_region_maincpu->base()[offset+0x8000]=data; + } + else + { + if (bbc_b_plus_sideways_ram_banks[m_rombank]) + { + m_region_opt->base()[offset+(m_rombank<<14)]=data; + } + } +} + +WRITE8_MEMBER(bbc_state::bbc_memorybp6_128_w) +{ + if (bbc_b_plus_sideways_ram_banks[m_rombank]) + { + m_region_opt->base()[offset+(m_rombank<<14)+0x3000]=data; + } +} + + + +/****************************************/ +/* BBC Master functions */ +/****************************************/ + +/* +ROMSEL - &FE30 write Only +B7 RAM 1=Page in ANDY &8000-&8FFF + 0=Page in ROM &8000-&8FFF +B6 Not Used +B5 Not Used +B4 Not Used +B3-B0 Rom/Ram Bank Select + +ACCCON + +b7 IRR 1=Causes an IRQ to the processor +b6 TST 1=Selects &FC00-&FEFF read from OS-ROM +b5 IFJ 1=Internal 1MHz bus + 0=External 1MHz bus +b4 ITU 1=Internal Tube + 0=External Tube +b3 Y 1=Read/Write HAZEL &C000-&DFFF RAM + 0=Read/Write ROM &C000-&DFFF OS-ROM +b2 X 1=Read/Write LYNNE + 0=Read/WRITE main memory &3000-&8000 +b1 E 1=Causes shadow if VDU code + 0=Main all the time +b0 D 1=Display LYNNE as screen + 0=Display main RAM screen + +ACCCON is a read/write register + +HAZEL is the 8K of RAM used by the MOS, filing system, and other Roms at &C000-&DFFF + +ANDY is the name of the 4K of RAM used by the MOS at &8000-&8FFF + +b7:This causes an IRQ to occur. If you set this bit, you must write a routine on IRQ2V to clear it. + +b6:If set, this switches in the ROM at &FD00-&FEFF for reading, writes to these addresses are still directed to the I/O +The MOS will not work properly with this but set. the Masters OS uses this feature to place some of the reset code in this area, +which is run at powerup. + +b3:If set, access to &C000-&DFFF are directed to HAZEL, an 8K bank of RAM. IF clear, then operating system ROM is read. + +b2:If set, read/write access to &3000-&7FFF are directed to the LYNNE, the shadow screen RAM. If clear access is made to the main RAM. + +b1:If set, when the program counter is between &C000 and &DFFF, read/write access is directed to the LYNNE shadow RAM. +if the program counter is anywhere else main ram is accessed. + +*/ + + +READ8_MEMBER(bbc_state::bbcm_ACCCON_read) +{ + logerror("ACCCON read %d\n",offset); + return m_ACCCON; +} + +WRITE8_MEMBER(bbc_state::bbcm_ACCCON_write) +{ + int tempIRR; + m_ACCCON=data; + + logerror("ACCCON write %d %d \n",offset,data); + + tempIRR=m_ACCCON_IRR; + + m_ACCCON_IRR=(data>>7)&1; + m_ACCCON_TST=(data>>6)&1; + m_ACCCON_IFJ=(data>>5)&1; + m_ACCCON_ITU=(data>>4)&1; + m_ACCCON_Y =(data>>3)&1; + m_ACCCON_X =(data>>2)&1; + m_ACCCON_E =(data>>1)&1; + m_ACCCON_D =(data>>0)&1; + + if (tempIRR!=m_ACCCON_IRR) + { + check_interrupts(); + } + + if (m_ACCCON_Y) + { + m_bank7->set_base(m_region_maincpu->base() + 0x9000); + } + else + { + m_bank7->set_base(m_region_os->base()); + } + + bbcbp_setvideoshadow(m_ACCCON_D); + + + if (m_ACCCON_X) + { + m_bank2->set_base(m_region_maincpu->base() + 0xb000); + } + else + { + m_bank2->set_base(m_region_maincpu->base() + 0x3000); + } + + /* ACCCON_TST controls paging of rom reads in the 0xFC00-0xFEFF region */ + /* if 0 the I/O is paged for both reads and writes */ + /* if 1 the ROM is paged in for reads but writes still go to I/O */ + if (m_ACCCON_TST) + { + m_bank8->set_base(m_region_os->base() + 0x3c00); + space.install_read_bank(0xfc00, 0xfeff, "bank8"); + } + else + { + space.install_read_handler(0xfc00, 0xfeff, read8_delegate(FUNC(bbc_state::bbcm_r),this)); + } +} + + +int bbc_state::bbcm_vdudriverset() +{ + int PC; + PC = machine().device("maincpu")->safe_pc(); + return ((PC >= 0xc000) && (PC <= 0xdfff)); +} + + +WRITE8_MEMBER(bbc_state::page_selectbm_w) +{ + m_pagedRAM = (data & 0x80) >> 7; + m_rombank = data & 0x0f; + + if (m_pagedRAM) + { + m_bank4->set_entry(0x10); + m_bank5->set_entry(m_rombank); + } + else + { + m_bank4->set_entry(m_rombank); + m_bank5->set_entry(m_rombank); + } +} + + + +WRITE8_MEMBER(bbc_state::bbc_memorybm1_w) +{ + m_region_maincpu->base()[offset] = data; +} + + +DIRECT_UPDATE_MEMBER(bbc_state::bbcm_direct_handler) +{ + if (m_ACCCON_X) + { + m_bank2->set_base(m_region_maincpu->base() + 0xb000); + } + else + { + if (m_ACCCON_E && bbcm_vdudriverset()) + { + m_bank2->set_base(m_region_maincpu->base() + 0xb000); + } + else + { + m_bank2->set_base(m_region_maincpu->base() + 0x3000); + } + } + + return address; +} + + + +WRITE8_MEMBER(bbc_state::bbc_memorybm2_w) +{ + UINT8 *RAM = m_region_maincpu->base(); + if (m_ACCCON_X) + { + RAM[offset + 0xb000] = data; + } + else + { + if (m_ACCCON_E && bbcm_vdudriverset()) + { + RAM[offset + 0xb000] = data; + } + else + { + RAM[offset + 0x3000] = data; + } + } +} + +static const unsigned short bbc_master_sideways_ram_banks[16]= +{ + 0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0 +}; + + +WRITE8_MEMBER(bbc_state::bbc_memorybm4_w) +{ + if (m_pagedRAM) + { + m_region_maincpu->base()[offset+0x8000] = data; + } + else + { + if (bbc_master_sideways_ram_banks[m_rombank]) + { + m_region_opt->base()[offset+(m_rombank<<14)] = data; + } + } +} + + +WRITE8_MEMBER(bbc_state::bbc_memorybm5_w) +{ + if (bbc_master_sideways_ram_banks[m_rombank]) + { + m_region_opt->base()[offset+(m_rombank<<14)+0x1000] = data; + } +} + + +WRITE8_MEMBER(bbc_state::bbc_memorybm7_w) +{ + if (m_ACCCON_Y) + { + m_region_maincpu->base()[offset+0x9000] = data; + } +} + + + +/****************************************************************************** +&FC00-&FCFF FRED +&FC00-&FC03 Byte-Wide Expansion RAM +&FC08-&FC0F Ample M2000 MIDI Interface (see also FCF0) +&FC10-&FC13 Teletext +&FC14-&FC1F Prestel +&FC20-&FC27 IEEE 488 Interface +&FC28-&FC2F Acorn Expansion, currently unused +&FC30-&FC3F Cambridge Ring Interface +&FC40-&FC47 Winchester Disc Interface +&FC48-&FC7F Acorn Expansion, currently unused +&FC80-&FC8F Test Hardware +&FC90-&FCBF Acorn Expansion, currently unused +&FCC0-&FCFE User Applications +&FCF0-&FCF7 JGH/ETI MIDI Control (see also FC08) +&FCFC-&FCFF Page-Wide Expansion RAM + +&FD00-&FDFF JIM +&FD00-&FDFF Page-wide expansion RAM window +&FD40-&FD4F Torch SASI/SCSI Hard Drive Access +&FDFE-&FDFF Reset Test vector + +&FE00-&FEFF SHEILA Read Write +&FE00-&FE07 6845 CRTC Video controller Video Controller 8 ( 2 bytes x 4 ) +&FE08-&FE0F 6850 ACIA Serial controller Serial Controller 8 ( 2 bytes x 4 ) +&FE10-&FE17 Serial ULA - Serial system chip 8 ( 1 byte x 8 ) +&FE18-&FE1F uPD7002 A to D converter A to D converter 8 ( 4 bytes x 2 ) +&FE20-&FE23 Video ULA - Video system chip 4 ( 2 bytes x 2 ) +&FE24-&FE27 FDC Latch 1770 Control latch 1770 Control latch 4 ( 1 byte x 4 ) +&FE28-&FE2F 1770 registers 1770 Disc Controller 1770 Disc Controller 8 ( 4 bytes x 2 ) +&FE30-&FE33 ROMSEL - ROM Select 4 ( 1 byte x 4 ) +&FE34-&3FE7 ACCCON ACCCON select reg. ACCCON select reg 4 ( 1 byte x 4 ) +&FE38-&FE3F NC - - +&FE40-&FE5F 6522 VIA SYSTEM VIA SYSTEM VIA 32 (16 bytes x 2 ) 1MHz +&FE60-&FE7F 6522 VIA USER VIA USER VIA 32 (16 bytes x 2 ) 1MHz +&FE80-&FE9F 8271 registers 8271 Disk Controller 8271 Disk Controller +&FEA0-&FEBF 68B54 ADLC ECONET controller ECONET controller 32 ( 4 bytes x 8 ) 2MHz +&FEC0-&FEDF 6854 ADLC ECONET controller ECONET controller 32 ( 4 bytes x 8 ) 2MHz +&FEE0-&FEFF Tube ULA Tube system interface Tube system interface 32 (32 bytes x 1 ) 2MHz +******************************************************************************/ + +READ8_MEMBER(bbc_state::bbcm_r) +{ + long myo; + + if (offset<=0x0ff) /* FRED */ + { + return 0xff; + }; + + if ((offset>=0x100) && (offset<=0x1ff)) /* JIM */ + { + return 0xff; + }; + + if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */ + { + myo = offset-0x200; + if ((myo>=0x00) && (myo<=0x06) && (myo+0x01) & 1) return m_mc6845->status_r(space, myo-0x00); /* Video controller */ + if ((myo>=0x01) && (myo<=0x07) && (myo & 1)) return m_mc6845->register_r(space, myo-0x01); + if ((myo>=0x08) && (myo<=0x0e) && (myo+0x01) & 1) return m_acia ? m_acia->status_r(space, myo-0x08) : 0xfe; /* Serial controller */ + if ((myo>=0x09) && (myo<=0x0f) && (myo & 1)) return m_acia ? m_acia->data_r(space, myo-0x09) : 0xfe; + if ((myo>=0x10) && (myo<=0x17)) return 0xfe; /* Serial System Chip */ + if ((myo>=0x18) && (myo<=0x1f)) return m_upd7002 ? m_upd7002->read(space, myo-0x18) : 0xfe; /* A to D converter */ + if ((myo>=0x20) && (myo<=0x23)) return 0xfe; /* VideoULA */ + if ((myo>=0x24) && (myo<=0x27)) return bbcm_wd177xl_read(space, myo - 0x24); /* 177x Control Latch */ + if ((myo>=0x28) && (myo<=0x2f) && (m_wd1770)) return m_wd1770->read(space, myo-0x28); /* 1770 Controller */ + if ((myo>=0x28) && (myo<=0x2f) && (m_wd1772)) return m_wd1772->read(space, myo-0x28); /* 1772 Controller */ + if ((myo>=0x28) && (myo<=0x2f)) return 0xfe; /* No Controller */ + if ((myo>=0x30) && (myo<=0x33)) return 0xfe; + if ((myo>=0x34) && (myo<=0x37)) return bbcm_ACCCON_read(space, myo-0x34); /* ACCCON */ + if ((myo>=0x38) && (myo<=0x3f)) return 0xfe; /* NC ?? */ + if ((myo>=0x40) && (myo<=0x5f)) return m_via6522_0->read(space, myo-0x40); + if ((myo>=0x60) && (myo<=0x7f)) return m_via6522_1 ? m_via6522_1->read(space, myo-0x60) : 0xfe; + if ((myo>=0x80) && (myo<=0x9f)) return 0xfe; + if ((myo>=0xa0) && (myo<=0xbf)) return m_adlc ? m_adlc->read(space, myo & 0x03) : 0xfe; + if ((myo>=0xc0) && (myo<=0xdf)) return 0xfe; + if ((myo>=0xe0) && (myo<=0xff)) return 0xfe; + } + return 0xfe; +} + +WRITE8_MEMBER(bbc_state::bbcm_w) +{ + long myo; + + if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */ + { + myo=offset-0x200; + if ((myo>=0x00) && (myo<=0x06) && (myo+0x01) & 1) m_mc6845->address_w(space, myo-0x00, data); /* Video Controller */ + if ((myo>=0x01) && (myo<=0x07) && (myo & 1)) m_mc6845->register_w(space, myo-0x01, data); + if ((myo>=0x08) && (myo<=0x0e) && (myo+0x01) & 1) if (m_acia) m_acia->control_w(space, myo-0x08, data); /* Serial controller */ + if ((myo>=0x09) && (myo<=0x0f) && (myo & 1)) if (m_acia) m_acia->data_w(space, myo-0x09, data); + if ((myo>=0x10) && (myo<=0x17)) bbc_SerialULA_w(space, myo-0x10, data); /* Serial System Chip */ + if ((myo>=0x18) && (myo<=0x1f) && (m_upd7002)) m_upd7002->write(space, myo-0x18, data); /* A to D converter */ + if ((myo>=0x20) && (myo<=0x23)) bbc_videoULA_w(space, myo-0x20, data); /* VideoULA */ + if ((myo>=0x24) && (myo<=0x27) && (m_wd1770)) bbcm_wd1770l_write(space, myo-0x24, data); /* disc control latch */ + if ((myo>=0x28) && (myo<=0x2f) && (m_wd1770)) m_wd1770->write(space, myo-0x28, data); /* 1770 Controller */ + if ((myo>=0x24) && (myo<=0x27) && (m_wd1772)) bbcm_wd1772l_write(space, myo-0x24, data); /* disc control latch */ + if ((myo>=0x28) && (myo<=0x2f) && (m_wd1772)) m_wd1772->write(space, myo-0x28, data); /* 1772 Controller */ + if ((myo>=0x30) && (myo<=0x33)) page_selectbm_w(space, myo-0x30, data); /* ROMSEL */ + if ((myo>=0x34) && (myo<=0x37)) bbcm_ACCCON_write(space, myo-0x34, data); /* ACCCON */ + //if ((myo>=0x38) && (myo<=0x3f)) /* NC ?? */ + if ((myo>=0x40) && (myo<=0x5f)) m_via6522_0->write(space, myo-0x40, data); + if ((myo>=0x60) && (myo<=0x7f) && (m_via6522_1)) m_via6522_1->write(space, myo-0x60, data); + //if ((myo>=0x80) && (myo<=0x9f)) + if ((myo>=0xa0) && (myo<=0xbf) && (m_adlc)) m_adlc->write(space, myo & 0x03, data); + //if ((myo>=0xc0) && (myo<=0xdf)) + //if ((myo>=0xe0) && (myo<=0xff)) + } +} + + +/****************************************************************************** + +System VIA 6522 + +PA0-PA7 +Port A forms a slow data bus to the keyboard sound and speech processors +PortA Keyboard +D0 Pin 8 +D1 Pin 9 +D2 Pin 10 +D3 Pin 11 +D4 Pin 5 +D5 Pin 6 +D6 Pin 7 +D7 Pin 12 + +PB0-PB2 outputs +--------------- +These 3 outputs form the address to an 8 bit addressable latch. +(IC32 74LS259) + +PB3 output +---------- +This output holds the data to be written to the selected +addressable latch bit. + +PB4 and PB5 inputs +------------------ +These are the inputs from the joystick FIRE buttons. They are +normally at logic 1 with no button pressed and change to 0 +when a button is pressed. + +PB6 and PB7 inputs from the speech processor (model B and B+) +------------------------------------------------------------- +PB6 is the speech processor 'ready' output and PB7 is from the +speech processor 'interrupt' output. + +PB6 and PB7 outputs to Master CMOS RAM/RTC +------------------------------------------ +PB6 operates the 146818 chip enable when set to '1'. PB7 operates +the 146818 address strobe line. + +CA1 input +--------- +This is the vertical sync input from the 6845. CA1 is set up to +interrupt the 6502 every 20ms (50Hz) as a vertical sync from +the video circuitry is detected. The operation system changes +the display flash colours on this interrupt so that they occur +during the screen blanking period. +---------------------------------------------------------------- +This is required for a lot of time function within the machine +and must be triggered every 20ms. (Should check at some point +how this 20ms signal is made, and see if none standard shaped +screen modes change this time period.) + +CB1 input +--------- +The CB1 input is the end of conversion (EOC) signal from the +7002 analogue to digital converter. It can be used to interrupt +the 6502 whenever a conversion is complete. + +CA2 input +--------- +This input comes from the keyboard circuit, and is used to +generate an interrupt whenever a key is pressed. See the +keyboard circuit section for more details. + +CB2 input +--------- +This is the light pen strobe signal (LPSTB) from the light pen. +If also connects to the 6845 video processor, +CB2 can be programmed to interrupt the processor whenever +a light pen strobe occurs. +---------------------------------------------------------------- +CB2 is not needed in the initial emulation +and should be set to logic low, should be mapped through to +a light pen emulator later. + +IRQ output +This connects to the IRQ line of the 6502 + + +The addressable latch +This 8 bit addressable latch is operated from port B lines 0-3. +PB0-PB2 are set to the required address of the output bit to be set. +PB3 is set to the value which should be programmed at that bit. +The function of the 8 output bits from this latch are:- + +B0 - Write Enable to the sound generator IC +B1 - READ select on the speech processor +B2 - WRITE select on the speech processor +B3 - Keyboard write enable +B4,B5 - these two outputs define the number to be added to the +start of screen address in hardware to control hardware scrolling:- +Mode Size Start of screen Number to add B5 B4 +0,1,2 20K &3000 12K 1 1 +3 16K &4000 16K 0 0 +4,5 10K &5800 (or &1800) 22K 1 0 +6 8K &6000 (or &2000) 24K 0 1 +B6 - Operates the CAPS lock LED (Pin 17 keyboard connector) +B7 - Operates the SHIFT lock LED (Pin 16 keyboard connector) +******************************************************************************/ + + +INTERRUPT_GEN_MEMBER(bbc_state::bbcb_keyscan) +{ + static const char *const colnames[] = { + "COL0", "COL1", "COL2", "COL3", "COL4", + "COL5", "COL6", "COL7", "COL8", "COL9", + "COL10", "COL11", "COL12" + }; + + /* only do auto scan if keyboard is not enabled */ + if (m_b3_keyboard == 1) + { + /* KBD IC1 4 bit addressable counter */ + /* KBD IC3 4 to 10 line decoder */ + /* keyboard not enabled so increment counter */ + m_column = (m_column + 1) % 16; + + if (m_column < 13) + { + /* KBD IC4 8 input NAND gate */ + /* set the value of via_system ca2, by checking for any keys + being pressed on the selected m_column */ + if ((ioport(colnames[m_column])->read() | 0x01) != 0xff) + { + m_via6522_0->write_ca2(1); + } + else + { + m_via6522_0->write_ca2(0); + } + } + else + { + m_via6522_0->write_ca2(0); + } + } +} + + +int bbc_state::bbc_keyboard(address_space &space, int data) +{ + int bit; + int row; + int res; + static const char *const colnames[] = { + "COL0", "COL1", "COL2", "COL3", "COL4", + "COL5", "COL6", "COL7", "COL8", "COL9", + "COL10", "COL11", "COL12" + }; + + m_column = data & 0x0f; + row = (data>>4) & 0x07; + + bit = 0; + + if (m_column < 13) + { + res = ioport(colnames[m_column])->read(); + } + else + { + res = 0xff; + } + + /* Normal keyboard result */ + if ((res & (1<write_ca2(1); + } + else + { + m_via6522_0->write_ca2(0); + } + + return (data & 0x7f) | (bit<<7); +} + + +void bbc_state::bbcb_IC32_initialise(bbc_state *state) +{ + m_b0_sound=0x01; // Write Enable to the sound generator IC + m_b1_speech_read=0x01; // READ select on the speech processor + m_b2_speech_write=0x01; // WRITE select on the speech processor + m_b3_keyboard=0x01; // Keyboard write enable + m_b4_video0=0x01; // These two outputs define the number to be added to the start of screen address + m_b5_video1=0x01; // in hardware to control hardware scrolling + m_b6_caps_lock_led=0x01; // Operates the CAPS lock LED + m_b7_shift_lock_led=0x01; // Operates the SHIFT lock LED +} + + +/* This the BBC Masters Real Time Clock and NVRAM IC */ +void bbc_state::MC146818_set(address_space &space) +{ + //logerror ("146181 WR=%d DS=%d AS=%d CE=%d \n",m_MC146818_WR,m_MC146818_DS,m_MC146818_AS,m_MC146818_CE); + //mc146818_device *rtc = space.machine().device("rtc"); + + // if chip enabled + if (m_MC146818_CE) + { + // if data select is set then access the data in the 146818 + if (m_MC146818_DS) + { + if (m_MC146818_WR) + { + m_via_system_porta = m_rtc->read(space, 1); + //logerror("read 146818 data %d \n",m_via_system_porta); + } + else + { + m_rtc->write(space, 1, m_via_system_porta); + //logerror("write 146818 data %d \n",m_via_system_porta); + } + } + + // if address select is set then set the address in the 146818 + if (m_MC146818_AS) + { + m_rtc->write(space, 0, m_via_system_porta); + //logerror("write 146818 address %d \n",m_via_system_porta); + } + } +} + + +WRITE8_MEMBER(bbc_state::bbcb_via_system_write_porta) +{ + //logerror("SYSTEM write porta %d\n",data); + + m_via_system_porta = data; + if (m_b0_sound == 0) + { + //logerror("Doing an unsafe write to the sound chip %d \n",data); + if (m_sn) m_sn->write(space, 0, m_via_system_porta); + } + if (m_b1_speech_read == 0) + { + if (m_tms) m_via_system_porta = m_tms->status_r(space, 0); + //logerror("Doing an unsafe read to the speech chip %d \n",m_via_system_porta); + } + if (m_b2_speech_write == 0) + { + //logerror("Doing an unsafe write to the speech chip %d \n",data); + if (m_tms) m_tms->data_w(space, 0, m_via_system_porta); + } + if (m_b3_keyboard == 0) + { + //logerror("Doing an unsafe write to the keyboard %d \n",data); + m_via_system_porta = bbc_keyboard(space, m_via_system_porta); + } + if (m_rtc) MC146818_set(space); +} + + +WRITE8_MEMBER(bbc_state::bbcb_via_system_write_portb) +{ + int bit, value; + bit = data & 0x07; + value = (data >> 3) & 0x01; + + //logerror("SYSTEM write portb %d %d %d\n",data,bit,value); + + if (value) + { + switch (bit) + { + case 0: + if (m_b0_sound == 0) + { + m_b0_sound = 1; + } + break; + case 1: + if (m_rtc && m_MC146818_WR == 0) + { + /* BBC Master has NVRAM Here */ + m_MC146818_WR = 1; + MC146818_set(space); + } + else + { + if (m_b1_speech_read == 0) + { + /* VSP TMS 5220 */ + m_b1_speech_read = 1; + //logerror("Speech read select TRUE\n"); + if (m_tms) m_tms->rsq_w(TRUE); + } + } + break; + case 2: + if (m_rtc && m_MC146818_DS == 0) + { + /* BBC Master has NVRAM Here */ + m_MC146818_DS = 1; + MC146818_set(space); + } + else + { + if (m_b2_speech_write == 0) + { + /* VSP TMS 5220 */ + m_b2_speech_write = 1; + //logerror("Speech write select TRUE\n"); + if (m_tms) m_tms->wsq_w(TRUE); + } + } + break; + case 3: + if (m_b3_keyboard == 0) + { + m_b3_keyboard = 1; + } + break; + case 4: + if (m_b4_video0 == 0) + { + m_b4_video0 = 1; + } + break; + case 5: + if (m_b5_video1 == 0) + { + m_b5_video1 = 1; + } + break; + case 6: + if (m_b6_caps_lock_led == 0) + { + m_b6_caps_lock_led = 1; + /* call caps lock led update */ + output_set_value("capslock_led", m_b6_caps_lock_led); + } + break; + case 7: + if (m_b7_shift_lock_led == 0) + { + m_b7_shift_lock_led = 1; + /* call shift lock led update */ + output_set_value("shiftlock_led", m_b7_shift_lock_led); + } + break; + } + } + else + { + switch (bit) + { + case 0: + if (m_b0_sound == 1) + { + m_b0_sound = 0; + if (m_sn) m_sn->write(space, 0, m_via_system_porta); + } + break; + case 1: + if (m_rtc && m_MC146818_WR == 1) + { + /* BBC Master has NVRAM Here */ + m_MC146818_WR = 0; + MC146818_set(space); + } + else + { + if (m_b1_speech_read == 1) + { + /* VSP TMS 5220 */ + m_b1_speech_read = 0; + //logerror("Speech read select FALSE\n"); + if (m_tms) m_tms->rsq_w(FALSE); + } + } + break; + case 2: + if (m_rtc && m_MC146818_DS == 1) + { + /* BBC Master has NVRAM Here */ + m_MC146818_DS = 0; + MC146818_set(space); + } + else + { + if (m_b2_speech_write == 1) + { + /* VSP TMS 5220 */ + m_b2_speech_write = 0; + //logerror("Speech write select FALSE\n"); + if (m_tms) m_tms->wsq_w(FALSE); + } + } + break; + case 3: + if (m_b3_keyboard == 1) + { + m_b3_keyboard = 0; + /* *** call keyboard enabled *** */ + m_via_system_porta = bbc_keyboard(space, m_via_system_porta); + } + break; + case 4: + if (m_b4_video0 == 1) + { + m_b4_video0 = 0; + } + break; + case 5: + if (m_b5_video1 == 1) + { + m_b5_video1 = 0; + } + break; + case 6: + if (m_b6_caps_lock_led == 1) + { + m_b6_caps_lock_led = 0; + /* call caps lock led update */ + output_set_value("capslock_led", m_b6_caps_lock_led); + } + break; + case 7: + if (m_b7_shift_lock_led == 1) + { + m_b7_shift_lock_led = 0; + /* call shift lock led update */ + output_set_value("shiftlock_led", m_b7_shift_lock_led); + } + break; + } + } + + + if (m_rtc) + { + //set the Address Select + if (m_MC146818_AS != ((data>>7)&1)) + { + m_MC146818_AS=(data>>7)&1; + MC146818_set(space); + } + + //if CE changes + if (m_MC146818_CE != ((data>>6)&1)) + { + m_MC146818_CE=(data>>6)&1; + MC146818_set(space); + } + } +} + + +READ8_MEMBER(bbc_state::bbcb_via_system_read_porta) +{ + //logerror("SYSTEM read porta %d\n",m_via_system_porta); + return m_via_system_porta; +} + + +READ8_MEMBER(bbc_state::bbcb_via_system_read_portb) +{ + // D4 of portb is joystick fire button 1 + // D5 of portb is joystick fire button 2 + // D6 VSPINT + // D7 VSPRDY + int TMSint = m_tms ? m_tms->intq_r() : 0; + int TMSrdy = m_tms ? m_tms->readyq_r() : 0; + //logerror("TMSint %d\n",TMSint); + //logerror("TMSrdy %d\n",TMSrdy); + return (0xf | ioport("IN0")->read() | (!TMSrdy << 7) | (!TMSint << 6)); +} + + +WRITE_LINE_MEMBER(bbc_state::bbcb_via_system_irq_w) +{ + m_via_system_irq = state; + + check_interrupts(); +} + +/********************************************************************** +USER VIA +Port A output is buffered before being connected to the printer connector. +This means that they can only be operated as output lines. +CA1 is pulled high by a 4K7 resistor. CA1 normally acts as an acknowledge +line when a printer is used. CA2 is buffered so that it has become an open +collector output only. It usually acts as the printer strobe line. +***********************************************************************/ + +/* USER VIA 6522 port B is connected to the BBC user port */ +READ8_MEMBER(bbc_state::bbcb_via_user_read_portb) +{ + return 0xff; +} + +WRITE8_MEMBER(bbc_state::bbcb_via_user_write_portb) +{ + m_userport = data; +} + +WRITE_LINE_MEMBER(bbc_state::bbcb_via_user_irq_w) +{ + m_via_user_irq = state; + + check_interrupts(); +} + + +/************************************** +BBC Joystick Support +**************************************/ + +UPD7002_GET_ANALOGUE(bbc_state::BBC_get_analogue_input) +{ + switch (channel_number) + { + case 0: + return ((0xff - m_joy0->read()) << 8); + case 1: + return ((0xff - m_joy1->read()) << 8); + case 2: + return ((0xff - m_joy2->read()) << 8); + case 3: + return ((0xff - m_joy3->read()) << 8); + } + + return 0; +} + +UPD7002_EOC(bbc_state::BBC_uPD7002_EOC) +{ + m_via6522_0->write_cb1(data); +} + +/*************************************** + BBC 2C199 Serial Interface Cassette +****************************************/ + + +void bbc_state::MC6850_Receive_Clock(int new_clock) +{ + m_rxd_cass = new_clock; + update_acia_rxd(); + + // + // Somehow the "serial processor" generates 16 clock signals towards + // the 6850. Exact details are unknown, faking it with the following + // loop. + // + for (int i = 0; i < 16; i++ ) + { + m_acia->write_rxc(1); + m_acia->write_rxc(0); + } +} + +TIMER_CALLBACK_MEMBER(bbc_state::bbc_tape_timer_cb) +{ + if ( m_cass_out_enabled ) + { + // 0 = 18-18 18-17-1 + // 1 = 9-9-9-9 9-9-9-8-1 + + switch ( m_cass_out_samples_to_go ) + { + case 0: + if ( m_cass_out_phase == 0 ) + { + // get bit value + m_cass_out_bit = m_txd; + if ( m_cass_out_bit ) + { + m_cass_out_phase = 3; + m_cass_out_samples_to_go = 9; + } + else + { + m_cass_out_phase = 1; + m_cass_out_samples_to_go = 18; + } + m_cassette->output( +1.0 ); + } + else + { + // switch phase + m_cass_out_phase--; + m_cass_out_samples_to_go = m_cass_out_bit ? 9 : 18; + m_cassette->output( ( m_cass_out_phase & 1 ) ? +1.0 : -1.0 ); + } + break; + case 1: + if ( m_cass_out_phase == 0 ) + { + m_cassette->output( 0.0 ); + } + break; + } + + m_cass_out_samples_to_go--; + } + else + { + double dev_val = m_cassette->input(); + + // look for edges on the cassette wave + if (((dev_val>=0.0) && (m_last_dev_val<0.0)) || ((dev_val<0.0) && (m_last_dev_val>=0.0))) + { + if (m_wav_len>(9*3)) + { + //this is too long to receive anything so reset the serial IC. This is a hack, this should be done as a timer in the MC6850 code. + logerror ("Cassette length %d\n",m_wav_len); + m_nr_high_tones = 0; + m_dcd_cass = 0; + update_acia_dcd(); + m_len0=0; + m_len1=0; + m_len2=0; + m_len3=0; + m_wav_len=0; + } + + m_len3=m_len2; + m_len2=m_len1; + m_len1=m_len0; + m_len0=m_wav_len; + + m_wav_len=0; + logerror ("cassette %d %d %d %d\n",m_len3,m_len2,m_len1,m_len0); + + if ((m_len0+m_len1)>=(18+18-5)) + { + /* Clock a 0 onto the serial line */ + logerror("Serial value 0\n"); + m_nr_high_tones = 0; + m_dcd_cass = 0; + update_acia_dcd(); + MC6850_Receive_Clock(0); + m_len0=0; + m_len1=0; + m_len2=0; + m_len3=0; + } + + if (((m_len0+m_len1+m_len2+m_len3)<=41) && (m_len3!=0)) + { + /* Clock a 1 onto the serial line */ + logerror("Serial value 1\n"); + m_nr_high_tones++; + if ( m_nr_high_tones > 100 ) + { + m_dcd_cass = 1; + update_acia_dcd(); + } + MC6850_Receive_Clock(1); + m_len0=0; + m_len1=0; + m_len2=0; + m_len3=0; + } + } + + m_wav_len++; + m_last_dev_val=dev_val; + } +} + +WRITE_LINE_MEMBER( bbc_state::write_rxd_serial ) +{ + m_rxd_serial = state; + update_acia_rxd(); +} + +void bbc_state::update_acia_rxd() +{ + m_acia->write_rxd(( m_serproc_data & 0x40 ) ? m_rxd_serial : m_rxd_cass); +} + + +WRITE_LINE_MEMBER( bbc_state::write_dcd_serial ) +{ + m_dcd_serial = state; + update_acia_dcd(); +} + +void bbc_state::update_acia_dcd() +{ + m_acia->write_dcd(( m_serproc_data & 0x40 ) ? m_dcd_serial : m_dcd_cass); +} + + +WRITE_LINE_MEMBER( bbc_state::write_cts_serial ) +{ + m_cts_serial = state; + update_acia_cts(); +} + +void bbc_state::update_acia_cts() +{ + m_acia->write_cts(( m_serproc_data & 0x40 ) ? m_cts_serial : 0); +} + + +WRITE_LINE_MEMBER( bbc_state::bbc_rts_w ) +{ + if ( m_serproc_data & 0x40 ) + { + m_rs232->write_rts(state); + m_cass_out_enabled = 0; + } + else + { + m_cass_out_enabled = state ? 0 : 1; + } +} + + +WRITE_LINE_MEMBER( bbc_state::bbc_txd_w ) +{ + if ( m_serproc_data & 0x40 ) + { + m_rs232->write_txd(state); + } + else + { + m_txd = state; + } +} + + +void bbc_state::BBC_Cassette_motor(unsigned char status) +{ + if (status) + { + m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_tape_timer->adjust(attotime::zero, 0, attotime::from_hz(44100)); + } + else + { + m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_tape_timer->reset(); + m_len0 = 0; + m_len1 = 0; + m_len2 = 0; + m_len3 = 0; + m_wav_len = 0; + m_cass_out_phase = 0; + m_cass_out_samples_to_go = 4; + } + output_set_value("motor_led", !status); +} + + +// +// Serial processor control +// x--- ---- - Motor OFF(0)/ON(1) +// -x-- ---- - Cassette(0)/RS243 input(1) +// --xx x--- - Receive baud rate generator control +// ---- -xxx - Transmit baud rate generator control +// These possible settings apply to both the receive +// and transmit baud generator control bits: +// 000 - 16MHz / 13 / 1 - 19200 baud +// 001 - 16MHz / 13 / 16 - 1200 baud +// 010 - 16MHz / 13 / 4 - 4800 baud +// 011 - 16MHz / 13 / 128 - 150 baud +// 100 - 16MHz / 13 / 2 - 9600 baud +// 101 - 16MHz / 13 / 64 - 300 baud +// 110 - 16MHz / 13 / 8 - 2400 baud +// 110 - 16MHz / 13 / 256 - 75 baud +// +WRITE8_MEMBER(bbc_state::bbc_SerialULA_w) +{ + static const int serial_clocks[8] = + { + 1, // 000 + 16, // 001 + 4, // 010 + 128, // 011 + 2, // 100 + 64, // 101 + 8, // 110 + 256 // 111 + }; + + m_serproc_data = data; + update_acia_rxd(); + update_acia_dcd(); + update_acia_cts(); + if (m_cassette) BBC_Cassette_motor(m_serproc_data & 0x80); + + // Set transmit clock rate + m_acia_clock->set_clock_scale( (double) 1 / serial_clocks[ data & 0x07 ] ); +} + +WRITE_LINE_MEMBER(bbc_state::write_acia_clock) +{ + m_acia->write_txc(state); + + if (m_serproc_data & 0x40) + m_acia->write_rxc(state); +} + +/************************************** + i8271 disc control function +***************************************/ + + +WRITE_LINE_MEMBER(bbc_state::bbc_i8271_interrupt) +{ + /* I'm assuming that the nmi is edge triggered */ + /* a interrupt from the fdc will cause a change in line state, and + the nmi will be triggered, but when the state changes because the int + is cleared this will not cause another nmi */ + /* I'll emulate it like this to be sure */ + + if (state!=m_previous_i8271_int_state) + { + if (state) + { + /* I'll pulse it because if I used hold-line I'm not sure + it would clear - to be checked */ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } + } + + m_previous_i8271_int_state = state; +} + +WRITE_LINE_MEMBER(bbc_state::motor_w) +{ + m_i8271->subdevice("0")->get_device()->mon_w(!state); + m_i8271->subdevice("1")->get_device()->mon_w(!state); +} + + +/************************************** + WD1770 disc control function +***************************************/ + + +/* + B/ B+ drive control: + + Bit Meaning + ----------------- + 7,6 Not used. + 5 Reset drive controller chip. (0 = reset controller, 1 = no reset) + 4 Interrupt Enable (0 = enable int, 1 = disable int) + 3 Double density select (0 = double, 1 = single). + 2 Side select (0 = side 0, 1 = side 1). + 1 Drive select 1. + 0 Drive select 0. +*/ + +/* +density select +single density is as the 8271 disc format +double density is as the 8271 disc format but with 16 sectors per track +*/ + + +/* wd177x_IRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together + wd177x_DRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together + the output of the above two NAND gates are then OR'ED together and sent to the 6502 NMI line. + DRQ and IRQ are active low outputs from wd177x. We use wd177x_DRQ_SET for DRQ = 0, + and wd177x_DRQ_CLR for DRQ = 1. Similarly wd177x_IRQ_SET for IRQ = 0 and wd177x_IRQ_CLR + for IRQ = 1. + + The above means that if IRQ or DRQ are set, a interrupt should be generated. + The nmi_enable decides if interrupts are actually triggered. + The nmi is edge triggered, and triggers on a +ve edge. +*/ + +void bbc_state::bbc_update_fdq_int(int state) +{ + int bbc_state; + + /* if drq or irq is set, and interrupt is enabled */ + if ((m_wd177x_irq_state || m_wd177x_drq_state) && (m_177x_IntEnabled)) + { + /* int trigger */ + bbc_state = 1; + } + else + { + /* do not trigger int */ + bbc_state = 0; + } + /* nmi is edge triggered, and triggers when the state goes from clear->set. + Here we are checking this transition before triggering the nmi */ + if (bbc_state != m_previous_wd177x_int_state) + { + if (bbc_state) + { + /* I'll pulse it because if I used hold-line I'm not sure + it would clear - to be checked */ + m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); + } + } + + m_previous_wd177x_int_state = bbc_state; +} + +WRITE_LINE_MEMBER(bbc_state::bbc_wd177x_intrq_w) +{ + m_wd177x_irq_state = state; + bbc_update_fdq_int(state); +} + +WRITE_LINE_MEMBER(bbc_state::bbc_wd177x_drq_w) +{ + m_wd177x_drq_state = state; + bbc_update_fdq_int(state); +} + +WRITE8_MEMBER(bbc_state::bbc_wd1770_status_w) +{ + floppy_image_device *floppy = NULL; + + m_drive_control = data; + logerror("Drive control %d \n", data); + + // bit 5: reset + if (!BIT(data, 5)) m_wd1770->reset(); + + // bit 0, 1: drive select + if (BIT(data, 0)) floppy = m_wd1770->subdevice("0")->get_device(); + if (BIT(data, 1)) floppy = m_wd1770->subdevice("1")->get_device(); + m_wd1770->set_floppy(floppy); + + // bit 2: side select + if (floppy) + floppy->ss_w(BIT(data, 2)); + + // bit 3: density + m_wd1770->dden_w(BIT(data, 3)); + + // bit 4: interrupt enable + m_177x_IntEnabled = !BIT(data, 4); +} + +/*************************************** +BBC MASTER DISC SUPPORT +***************************************/ + +READ8_MEMBER(bbc_state::bbcm_wd177xl_read) +{ + return m_drive_control; +} + +WRITE8_MEMBER(bbc_state::bbcm_wd1770l_write) +{ + floppy_image_device *floppy = NULL; + + m_drive_control = data; + //logerror("Drive control %d \n", data); + + // bit 2: reset + if (!BIT(data, 2)) m_wd1770->reset(); + + // bit 0, 1, 3: drive select + if (BIT(data, 0)) floppy = m_wd1770->subdevice("0")->get_device(); + if (BIT(data, 1)) floppy = m_wd1770->subdevice("1")->get_device(); + if (BIT(data, 3)) floppy = m_wd1770->subdevice("2")->get_device(); + m_wd1770->set_floppy(floppy); + + // bit 4: side select + if (floppy) + floppy->ss_w(BIT(data, 4)); + + // bit 5: density + m_wd1770->dden_w(BIT(data, 5)); + + m_177x_IntEnabled = 1; +} + +WRITE8_MEMBER(bbc_state::bbcm_wd1772l_write) +{ + floppy_image_device *floppy = NULL; + + m_drive_control = data; + //logerror("Drive control %d \n", data); + + // bit 2: reset + if (!BIT(data, 2)) m_wd1772->reset(); + + // bit 0, 1, 3: drive select + if (BIT(data, 0)) floppy = m_wd1772->subdevice("0")->get_device(); + if (BIT(data, 1)) floppy = m_wd1772->subdevice("1")->get_device(); + if (BIT(data, 3)) floppy = m_wd1772->subdevice("2")->get_device(); + m_wd1772->set_floppy(floppy); + + // bit 4: side select + if (floppy) + floppy->ss_w(BIT(data, 4)); + + // bit 5: density + m_wd1772->dden_w(BIT(data, 5)); + + m_177x_IntEnabled = 1; +} + +/************************************** + BBC B Rom loading functions +***************************************/ + +int bbc_state::bbc_load_cart(device_image_interface &image, generic_slot_device *slot) +{ + UINT32 size = slot->common_get_size("rom"); + + if (size != 0x2000 && size != 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + slot->common_load_rom(slot->get_rom_base(), size, "rom"); + + return IMAGE_INIT_PASS; +} + +/************************************** + BBC Master Rom loading functions +***************************************/ + +int bbc_state::bbcm_load_cart(device_image_interface &image, generic_slot_device *slot) +{ + if (image.software_entry() == NULL) + { + UINT32 filesize = image.length(); + + if (filesize != 0x8000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + slot->rom_alloc(filesize, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + image.fread(slot->get_rom_base(), filesize); + return IMAGE_INIT_PASS; + } + else + { + UINT32 size_lo = image.get_software_region_length("lorom"); + UINT32 size_hi = image.get_software_region_length("uprom"); + + if (size_lo + size_hi != 0x8000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + slot->rom_alloc(size_lo + size_hi, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + memcpy(slot->get_rom_base() + 0, image.get_software_region("uprom"), size_hi); + memcpy(slot->get_rom_base() + size_hi, image.get_software_region("lorom"), size_lo); + } + + return IMAGE_INIT_PASS; +} + + +/************************************** + Machine Initialisation functions +***************************************/ + +DRIVER_INIT_MEMBER(bbc_state,bbc) +{ + m_rxd_cass = 0; + m_nr_high_tones = 0; + m_serproc_data = 0; + m_cass_out_enabled = 0; + m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bbc_state::bbc_tape_timer_cb),this)); + + /* vertical sync pulse from video circuit */ + m_via6522_0->write_ca1(1); + + /* light pen strobe detect (not emulated) */ + m_via6522_0->write_cb2(1); +} + +// setup pointers for optional EPROMs +void bbc_state::bbc_setup_banks(memory_bank *membank, int banks, UINT32 shift, UINT32 size) +{ + std::string region_tag; + memory_region *tmp_reg; + UINT8 *eprom[4]; + if (m_exp1 && (tmp_reg = memregion(region_tag.assign(m_exp1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) + eprom[0] = tmp_reg->base() + shift; + else + eprom[0] = m_region_opt->base() + 0x0000 + shift; + if (m_exp2 && (tmp_reg = memregion(region_tag.assign(m_exp2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) + eprom[1] = tmp_reg->base() + shift; + else + eprom[1] = m_region_opt->base() + 0x4000 + shift; + if (m_exp3 && (tmp_reg = memregion(region_tag.assign(m_exp3->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) + eprom[2] = tmp_reg->base() + shift; + else + eprom[2] = m_region_opt->base() + 0x8000 + shift; + if (m_exp4 && (tmp_reg = memregion(region_tag.assign(m_exp4->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) + eprom[3] = tmp_reg->base() + shift; + else + eprom[3] = m_region_opt->base() + 0xc000 + shift; + + membank->configure_entries(0, 1, eprom[0], size); + membank->configure_entries(1, 1, eprom[1], size); + membank->configure_entries(2, 1, eprom[2], size); + membank->configure_entries(3, 1, eprom[3], size); + + if (banks > 4) + { + for (int i = 0; i < banks - 4; i++) + membank->configure_entries(i + 4, 1, m_region_opt->base() + 0x10000 + shift + i * 0x4000, size); + } +} + +void bbc_state::bbcm_setup_banks(memory_bank *membank, int banks, UINT32 shift, UINT32 size) +{ + std::string region_tag; + memory_region *tmp_reg; + UINT8 *eprom[2]; + if (m_exp1 && (tmp_reg = memregion(region_tag.assign(m_exp1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) + eprom[0] = tmp_reg->base() + shift; + else + eprom[0] = m_region_opt->base() + 0x0000 + shift; + if (m_exp2 && (tmp_reg = memregion(region_tag.assign(m_exp2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) + eprom[1] = tmp_reg->base() + shift; + else + eprom[1] = m_region_opt->base() + 0x8000 + shift; + + membank->configure_entries(0, 1, eprom[0], size); + membank->configure_entries(1, 1, eprom[0] + 0x4000, size); + membank->configure_entries(2, 1, eprom[1], size); + membank->configure_entries(3, 1, eprom[1] + 0x4000, size); + + if (banks > 4) + { + for (int i = 0; i < banks - 4; i++) + membank->configure_entries(i + 4, 1, m_region_opt->base() + 0x10000 + shift + i * 0x4000, size); + } +} + +MACHINE_START_MEMBER(bbc_state, bbca) +{ + bbc_setup_banks(m_bank4, 4, 0, 0x4000); +} + +MACHINE_RESET_MEMBER(bbc_state, bbca) +{ + UINT8 *RAM = m_region_maincpu->base(); + + m_bank1->set_base(RAM); + if (m_ram->size() == 32*1024) + { + /* 32K Model A */ + m_bank3->set_base(RAM + 0x4000); + m_memorySize=32; + } + else + { + /* 16K just repeat the lower 16K*/ + m_bank3->set_base(RAM); + m_memorySize=16; + } + + m_bank4->set_entry(0); + m_bank7->set_base(m_region_os->base()); /* bank 7 points at the OS rom from c000 to ffff */ + + bbcb_IC32_initialise(this); +} + +MACHINE_START_MEMBER(bbc_state, bbcb) +{ + m_mc6850_clock = 0; + m_previous_i8271_int_state=0; + m_previous_wd177x_int_state=1; + bbc_setup_banks(m_bank4, 16, 0, 0x4000); +} + +MACHINE_RESET_MEMBER(bbc_state, bbcb) +{ + UINT8 *RAM = m_region_maincpu->base(); + m_Speech = (ioport("BBCCONFIG")->read() >> 0) & 0x01; + m_SWRAMtype = (ioport("BBCCONFIG")->read() >> 3) & 0x03; + m_bank1->set_base(RAM); + m_bank3->set_base(RAM + 0x4000); + m_memorySize=32; + + m_bank4->set_entry(0); + m_bank7->set_base(m_region_os->base()); /* bank 7 points at the OS rom from c000 to ffff */ + + bbcb_IC32_initialise(this); +} + + +MACHINE_START_MEMBER(bbc_state, bbcbp) +{ + m_mc6850_clock = 0; + + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcbp_direct_handler), this)); + + bbc_setup_banks(m_bank4, 16, 0, 0x3000); + m_bank4->configure_entries(16, 1, m_region_maincpu->base() + 0x8000, 0x3000); // additional bank for paged ram + bbc_setup_banks(m_bank6, 16, 0x3000, 0x1000); +} + +MACHINE_RESET_MEMBER(bbc_state, bbcbp) +{ + m_Speech = 1; + m_bank1->set_base(m_region_maincpu->base()); + m_bank2->set_base(m_region_maincpu->base() + 0x03000); /* bank 2 screen/shadow ram from 3000 to 7fff */ + m_bank4->set_entry(0); + m_bank6->set_entry(0); + m_bank7->set_base(m_region_os->base()); /* bank 7 points at the OS rom from c000 to ffff */ + + bbcb_IC32_initialise(this); + + m_previous_wd177x_int_state=1; +} + + +MACHINE_START_MEMBER(bbc_state, bbcm) +{ + m_mc6850_clock = 0; + + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcm_direct_handler), this)); + + bbcm_setup_banks(m_bank4, 16, 0, 0x1000); + m_bank4->configure_entries(16, 1, m_region_maincpu->base() + 0x8000, 0x1000); // additional bank for paged ram + bbcm_setup_banks(m_bank5, 16, 0x1000, 0x3000); + + /* Set ROM/IO bank to point to rom */ + m_bank8->set_base(m_region_os->base() + 0x3c00); + m_maincpu->space(AS_PROGRAM).install_read_bank(0xfc00, 0xfeff, "bank8"); +} + +MACHINE_RESET_MEMBER(bbc_state, bbcm) +{ + m_bank1->set_base(m_region_maincpu->base()); /* bank 1 regular lower ram from 0000 to 2fff */ + m_bank2->set_base(m_region_maincpu->base() + 0x3000); /* bank 2 screen/shadow ram from 3000 to 7fff */ + m_bank4->set_entry(0); + m_bank5->set_entry(0); + m_bank7->set_base(m_region_os->base()); /* bank 6 OS rom of RAM from c000 to dfff */ + + bbcb_IC32_initialise(this); + + m_previous_wd177x_int_state=1; +} diff --git a/src/mame/machine/bebox.c b/src/mame/machine/bebox.c new file mode 100644 index 00000000000..d5bceceb0aa --- /dev/null +++ b/src/mame/machine/bebox.c @@ -0,0 +1,814 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, R. Belmont +/*************************************************************************** + + machine/bebox.c + + BeBox + + Memory map: + + 00000000 - 3FFFFFFF Physical RAM + 40000000 - 7FFFFFFF Motherboard glue registers + 80000000 - 807FFFFF ISA I/O + 81000000 - BF7FFFFF PCI I/O + BFFFFFF0 - BFFFFFFF PCI/ISA interrupt acknowledge + FF000000 - FFFFFFFF ROM/flash + + In ISA space, peripherals are generally in similar places as they are on + standard PC hardware (e.g. - the keyboard is 80000060 and 80000064). The + following table shows more: + + Keyboard/Mouse (Intel 8242) 80000060, 80000064 + Real Time Clock (BQ3285) 80000070, 80000074 + IDE ATA Interface 800001F0-F7, 800003F6-7 + COM2 800002F8-F + GeekPort A/D Control 80000360-1 + GeekPort A/D Data 80000362-3 + GeekPort A/D Rate 80000364 + GeekPort OE 80000366 + Infrared Interface 80000368-A + COM3 80000380-7 + COM4 80000388-F + GeekPort D/A 80000390-3 + GeekPort GPA/GPB 80000394 + Joystick Buttons 80000397 + SuperIO Config (PReP standard) 80000398-9 + MIDI Port 1 800003A0-7 + MIDI Port 2 800003A8-F + Parallel 800003BC-E + Floppy 800003F0-7 + COM1 800003F8-F + AD1848 80000830-4 + + + Interrupt bit masks: + + bit 31 - N/A (used to set/clear masks) + bit 30 - SMI interrupt to CPU 0 (CPU 0 only) + bit 29 - SMI interrupt to CPU 1 (CPU 1 only) + bit 28 - Unused + bit 27 - COM1 (PC IRQ #4) + bit 26 - COM2 (PC IRQ #3) + bit 25 - COM3 + bit 24 - COM4 + bit 23 - MIDI1 + bit 22 - MIDI2 + bit 21 - SCSI + bit 20 - PCI Slot #1 + bit 19 - PCI Slot #2 + bit 18 - PCI Slot #3 + bit 17 - Sound + bit 16 - Keyboard (PC IRQ #1) + bit 15 - Real Time Clock (PC IRQ #8) + bit 14 - PC IRQ #5 + bit 13 - Floppy Disk (PC IRQ #6) + bit 12 - Parallel Port (PC IRQ #7) + bit 11 - PC IRQ #9 + bit 10 - PC IRQ #10 + bit 9 - PC IRQ #11 + bit 8 - Mouse (PC IRQ #12) + bit 7 - IDE (PC IRQ #14) + bit 6 - PC IRQ #15 + bit 5 - PIC8259 + bit 4 - Infrared Controller + bit 3 - Analog To Digital + bit 2 - GeekPort + bit 1 - Unused + bit 0 - Unused + + Be documentation uses PowerPC bit numbering conventions (i.e. - bit #0 is + the most significant bit) + + PCI Devices: + #0 Motorola MPC105 + #11 Intel 82378 PCI/ISA bridge + #12 NCR 53C810 SCSI + + More hardware information at http://www.netbsd.org/Ports/bebox/hardware.html + +***************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "includes/bebox.h" + +/* Components */ +#include "video/pc_vga.h" +#include "bus/lpci/cirrus.h" +#include "cpu/powerpc/ppc.h" +#include "machine/mc146818.h" +#include "machine/ataintf.h" +#include "bus/lpci/pci.h" + +#define LOG_CPUIMASK 1 +#define LOG_UART 1 +#define LOG_INTERRUPTS 1 + +/************************************* + * + * Interrupts and Motherboard Registers + * + *************************************/ + +static void bebox_mbreg32_w(UINT32 *target, UINT64 data, UINT64 mem_mask) +{ + int i; + + for (i = 1; i < 32; i++) + { + if ((data >> (63 - i)) & 1) + { + if ((data >> 63) & 1) + *target |= 0x80000000 >> i; + else + *target &= ~(0x80000000 >> i); + } + } +} + + +READ64_MEMBER(bebox_state::bebox_cpu0_imask_r ) +{ + return ((UINT64) m_cpu_imask[0]) << 32; +} + +READ64_MEMBER(bebox_state::bebox_cpu1_imask_r ) +{ + return ((UINT64) m_cpu_imask[1]) << 32; +} + +READ64_MEMBER(bebox_state::bebox_interrupt_sources_r ) +{ + return ((UINT64) m_interrupts) << 32; +} + +WRITE64_MEMBER(bebox_state::bebox_cpu0_imask_w ) +{ + UINT32 old_imask = m_cpu_imask[0]; + + bebox_mbreg32_w(&m_cpu_imask[0], data, mem_mask); + + if (old_imask != m_cpu_imask[0]) + { + if (LOG_CPUIMASK) + { + logerror("BeBox CPU #0 pc=0x%08X imask=0x%08x\n", + (unsigned) space.device().safe_pc( ), m_cpu_imask[0]); + } + bebox_update_interrupts(); + } +} + +WRITE64_MEMBER(bebox_state::bebox_cpu1_imask_w ) +{ + UINT32 old_imask = m_cpu_imask[1]; + + bebox_mbreg32_w(&m_cpu_imask[1], data, mem_mask); + + if (old_imask != m_cpu_imask[1]) + { + if (LOG_CPUIMASK) + { + logerror("BeBox CPU #1 pc=0x%08X imask=0x%08x\n", + (unsigned) space.device() .safe_pc( ), m_cpu_imask[1]); + } + bebox_update_interrupts(); + } +} + +READ64_MEMBER(bebox_state::bebox_crossproc_interrupts_r ) +{ + UINT32 result; + result = m_crossproc_interrupts; + + /* return a different result depending on which CPU is accessing this handler */ + if (&space != &m_ppc1->space(AS_PROGRAM)) + result |= 0x02000000; + else + result &= ~0x02000000; + + return ((UINT64) result) << 32; +} + +WRITE64_MEMBER(bebox_state::bebox_crossproc_interrupts_w ) +{ + static const struct + { + UINT32 mask; + int cpunum; + int active_high; + int inputline; + } crossproc_map[] = + { + { 0x40000000, 0, 1, 0/*PPC_INPUT_LINE_SMI*/ }, + { 0x20000000, 1, 1, 0/*PPC_INPUT_LINE_SMI*/ }, + { 0x08000000, 0, 0, 0/*PPC_INPUT_LINE_TLBISYNC*/ }, + { 0x04000000, 1, 0, 0/*PPC_INPUT_LINE_TLBISYNC*/ } + }; + int i, line; + UINT32 old_crossproc_interrupts = m_crossproc_interrupts; + cpu_device *cpus[] = { m_ppc1, m_ppc2 }; + + bebox_mbreg32_w(&m_crossproc_interrupts, data, mem_mask); + + for (i = 0; i < ARRAY_LENGTH(crossproc_map); i++) + { + if ((old_crossproc_interrupts ^ m_crossproc_interrupts) & crossproc_map[i].mask) + { + if (m_crossproc_interrupts & crossproc_map[i].mask) + line = crossproc_map[i].active_high ? ASSERT_LINE : CLEAR_LINE; + else + line = crossproc_map[i].active_high ? CLEAR_LINE : ASSERT_LINE; + + if (LOG_INTERRUPTS) + { +/* + logerror("bebox_crossproc_interrupts_w(): CPU #%d %s %s\n", + crossproc_map[i].cpunum, line ? "Asserting" : "Clearing", + (crossproc_map[i].inputline == PPC_INPUT_LINE_SMI) ? "SMI" : "TLBISYNC"); + */ + } + + cpus[crossproc_map[i].cpunum]->set_input_line(crossproc_map[i].inputline, line); + } + } +} + +WRITE64_MEMBER(bebox_state::bebox_processor_resets_w ) +{ + UINT8 b = (UINT8) (data >> 56); + + if (b & 0x20) + { + m_ppc2->set_input_line(INPUT_LINE_RESET, (b & 0x80) ? CLEAR_LINE : ASSERT_LINE); + } +} + + +void bebox_state::bebox_update_interrupts() +{ + UINT32 interrupt; + cpu_device *cpus[] = { m_ppc1, m_ppc2 }; + + for (int cpunum = 0; cpunum < 2; cpunum++) + { + interrupt = m_interrupts & m_cpu_imask[cpunum]; + + if (LOG_INTERRUPTS) + { + logerror("\tbebox_update_interrupts(): CPU #%d [%08X|%08X] IRQ %s\n", cpunum, + m_interrupts, m_cpu_imask[cpunum], interrupt ? "on" : "off"); + } + + cpus[cpunum]->set_input_line(INPUT_LINE_IRQ0, interrupt ? ASSERT_LINE : CLEAR_LINE); + } +} + + +void bebox_state::bebox_set_irq_bit(unsigned int interrupt_bit, int val) +{ + static const char *const interrupt_names[32] = + { + NULL, + NULL, + "GEEKPORT", + "ADC", + "IR", + "PIC8259", + "PCIRQ 15", + "IDE", + "MOUSE", + "PCIRQ 11", + "PCIRQ 10", + "PCIRQ 9", + "PARALLEL", + "FLOPPY", + "PCIRQ 5", + "RTC", + "KEYBOARD", + "SOUND", + "PCI3", + "PCI2", + "PCI1", + "SCSI", + "MIDI2", + "MIDI1", + "COM4", + "COM3", + "COM2", + "COM1", + NULL, + "SMI1", + "SMI0", + NULL + }; + UINT32 old_interrupts; + + if (LOG_INTERRUPTS) + { + /* make sure that we don't shoot ourself in the foot */ + assert_always((interrupt_bit < ARRAY_LENGTH(interrupt_names)) && (interrupt_names[interrupt_bit] != NULL), "Raising invalid interrupt"); + + logerror("bebox_set_irq_bit(): pc[0]=0x%08x pc[1]=0x%08x %s interrupt #%u (%s)\n", + (unsigned) m_ppc1->pc(), + (unsigned) m_ppc2->pc(), + val ? "Asserting" : "Clearing", + interrupt_bit, interrupt_names[interrupt_bit]); + } + + old_interrupts = m_interrupts; + if (val) + m_interrupts |= 1 << interrupt_bit; + else + m_interrupts &= ~(1 << interrupt_bit); + + /* if interrupt values have changed, update the lines */ + if (m_interrupts != old_interrupts) + bebox_update_interrupts(); +} + +/************************************* + * + * Floppy Disk Controller + * + *************************************/ + +WRITE_LINE_MEMBER( bebox_state::fdc_interrupt ) +{ + bebox_set_irq_bit(13, state); + m_pic8259_1->ir6_w(state); +} + +/************************************* + * + * 8259 PIC + * + *************************************/ + +READ64_MEMBER(bebox_state::bebox_interrupt_ack_r ) +{ + UINT32 result; + result = m_pic8259_1->acknowledge(); + bebox_set_irq_bit(5, 0); /* HACK */ + return ((UINT64) result) << 56; +} + + +/************************************************************* + * + * pic8259 configuration + * + *************************************************************/ + +WRITE_LINE_MEMBER(bebox_state::bebox_pic8259_master_set_int_line) +{ + bebox_set_irq_bit(5, state); +} + +WRITE_LINE_MEMBER(bebox_state::bebox_pic8259_slave_set_int_line) +{ + m_pic8259_1->ir2_w(state); +} + +READ8_MEMBER(bebox_state::get_slave_ack) +{ + return m_pic8259_2->acknowledge(); +} + + +/************************************* + * + * Floppy/IDE/ATA + * + *************************************/ + +WRITE_LINE_MEMBER(bebox_state::bebox_ide_interrupt) +{ + bebox_set_irq_bit(7, state); + m_pic8259_1->ir6_w(state); +} + + +/************************************* + * + * Video card (Cirrus Logic CL-GD5430) + * + *************************************/ +/* +static READ64_MEMBER(bebox_state::bebox_video_r ) +{ + UINT64 result = 0; + mem_mask = FLIPENDIAN_INT64(mem_mask); + if (ACCESSING_BITS_0_7) + result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 0, mem_mask >> 0) << 0; + if (ACCESSING_BITS_8_15) + result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 1, mem_mask >> 8) << 8; + if (ACCESSING_BITS_16_23) + result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 2, mem_mask >> 16) << 16; + if (ACCESSING_BITS_24_31) + result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 3, mem_mask >> 24) << 24; + if (ACCESSING_BITS_32_39) + result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 4, mem_mask >> 32) << 32; + if (ACCESSING_BITS_40_47) + result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 5, mem_mask >> 40) << 40; + if (ACCESSING_BITS_48_55) + result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 6, mem_mask >> 48) << 48; + if (ACCESSING_BITS_56_63) + result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 7, mem_mask >> 56) << 56; + return FLIPENDIAN_INT64(result); +} + + +static WRITE64_MEMBER(bebox_state::bebox_video_w ) +{ + data = FLIPENDIAN_INT64(data); + mem_mask = FLIPENDIAN_INT64(mem_mask); + if (ACCESSING_BITS_0_7) + vga_mem_linear_w(space, offset * 8 + 0, data >> 0 , mem_mask >> 0); + if (ACCESSING_BITS_8_15) + vga_mem_linear_w(space, offset * 8 + 1, data >> 8 , mem_mask >> 8); + if (ACCESSING_BITS_16_23) + vga_mem_linear_w(space, offset * 8 + 2, data >> 16, mem_mask >> 16); + if (ACCESSING_BITS_24_31) + vga_mem_linear_w(space, offset * 8 + 3, data >> 24, mem_mask >> 24); + if (ACCESSING_BITS_32_39) + vga_mem_linear_w(space, offset * 8 + 4, data >> 32, mem_mask >> 32); + if (ACCESSING_BITS_40_47) + vga_mem_linear_w(space, offset * 8 + 5, data >> 40, mem_mask >> 40); + if (ACCESSING_BITS_48_55) + vga_mem_linear_w(space, offset * 8 + 6, data >> 48, mem_mask >> 48); + if (ACCESSING_BITS_56_63) + vga_mem_linear_w(space, offset * 8 + 7, data >> 56, mem_mask >> 56); +} +*/ +/************************************* + * + * 8237 DMA + * + *************************************/ + + +READ8_MEMBER(bebox_state::bebox_page_r) +{ + UINT8 data = m_at_pages[offset % 0x10]; + + switch(offset % 8) + { + case 1: + data = m_dma_offset[(offset / 8) & 1][2]; + break; + case 2: + data = m_dma_offset[(offset / 8) & 1][3]; + break; + case 3: + data = m_dma_offset[(offset / 8) & 1][1]; + break; + case 7: + data = m_dma_offset[(offset / 8) & 1][0]; + break; + } + return data; +} + + +WRITE8_MEMBER(bebox_state::bebox_page_w) +{ + m_at_pages[offset % 0x10] = data; + + switch(offset % 8) + { + case 1: + m_dma_offset[(offset / 8) & 1][2] &= 0xFF00; + m_dma_offset[(offset / 8) & 1][2] |= ((UINT16 ) data) << 0; + break; + case 2: + m_dma_offset[(offset / 8) & 1][3] &= 0xFF00; + m_dma_offset[(offset / 8) & 1][3] |= ((UINT16 ) data) << 0; + break; + case 3: + m_dma_offset[(offset / 8) & 1][1] &= 0xFF00; + m_dma_offset[(offset / 8) & 1][1] |= ((UINT16 ) data) << 0; + break; + case 7: + m_dma_offset[(offset / 8) & 1][0] &= 0xFF00; + m_dma_offset[(offset / 8) & 1][0] |= ((UINT16 ) data) << 0; + break; + } +} + + +WRITE8_MEMBER(bebox_state::bebox_80000480_w) +{ + switch(offset % 8) + { + case 1: + m_dma_offset[(offset / 8) & 1][2] &= 0x00FF; + m_dma_offset[(offset / 8) & 1][2] |= ((UINT16 ) data) << 8; + break; + case 2: + m_dma_offset[(offset / 8) & 1][3] &= 0x00FF; + m_dma_offset[(offset / 8) & 1][3] |= ((UINT16 ) data) << 8; + break; + case 3: + m_dma_offset[(offset / 8) & 1][1] &= 0x00FF; + m_dma_offset[(offset / 8) & 1][1] |= ((UINT16 ) data) << 8; + break; + case 7: + m_dma_offset[(offset / 8) & 1][0] &= 0x00FF; + m_dma_offset[(offset / 8) & 1][0] |= ((UINT16 ) data) << 8; + break; + } +} + + +READ8_MEMBER(bebox_state::bebox_80000480_r) +{ + fatalerror("NYI\n"); +} + + +WRITE_LINE_MEMBER(bebox_state::bebox_dma_hrq_changed) +{ + m_ppc1->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + /* Assert HLDA */ + m_dma8237_1->hack_w( state ); +} + + +READ8_MEMBER(bebox_state::bebox_dma_read_byte ) +{ + address_space& prog_space = m_ppc1->space(AS_PROGRAM); // get the right address space + offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) + & 0x7FFF0000; + return prog_space.read_byte(page_offset + offset); +} + + +WRITE8_MEMBER(bebox_state::bebox_dma_write_byte ) +{ + address_space& prog_space = m_ppc1->space(AS_PROGRAM); // get the right address space + offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) + & 0x7FFF0000; + prog_space.write_byte(page_offset + offset, data); +} + + +READ8_MEMBER(bebox_state::bebox_dma8237_fdc_dack_r){ + return m_smc37c78->dma_r(); +} + + +WRITE8_MEMBER(bebox_state::bebox_dma8237_fdc_dack_w){ + m_smc37c78->dma_w(data); +} + + +WRITE_LINE_MEMBER(bebox_state::bebox_dma8237_out_eop){ + m_smc37c78->tc_w(state); +} + +static void set_dma_channel(running_machine &machine, int channel, int state) +{ + bebox_state *drvstate = machine.driver_data(); + if (!state) drvstate->m_dma_channel = channel; +} + +WRITE_LINE_MEMBER(bebox_state::pc_dack0_w){ set_dma_channel(machine(), 0, state); } +WRITE_LINE_MEMBER(bebox_state::pc_dack1_w){ set_dma_channel(machine(), 1, state); } +WRITE_LINE_MEMBER(bebox_state::pc_dack2_w){ set_dma_channel(machine(), 2, state); } +WRITE_LINE_MEMBER(bebox_state::pc_dack3_w){ set_dma_channel(machine(), 3, state); } + +/************************************* + * + * 8254 PIT + * + *************************************/ + +WRITE_LINE_MEMBER(bebox_state::bebox_timer0_w) +{ + m_pic8259_1->ir0_w(state); +} + + +/************************************* + * + * Flash ROM + * + *************************************/ + +READ8_MEMBER(bebox_state::bebox_flash_r ) +{ + offset = (offset & ~7) | (7 - (offset & 7)); + return m_flash->read(offset); +} + + +WRITE8_MEMBER(bebox_state::bebox_flash_w ) +{ + offset = (offset & ~7) | (7 - (offset & 7)); + m_flash->write(offset, data); +} + +/************************************* + * + * SCSI + * + *************************************/ + + +READ64_MEMBER(bebox_state::scsi53c810_r ) +{ + int reg = offset*8; + UINT64 r = 0; + if (!(mem_mask & U64(0xff00000000000000))) { + r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+0) << 56; + } + if (!(mem_mask & U64(0x00ff000000000000))) { + r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+1) << 48; + } + if (!(mem_mask & U64(0x0000ff0000000000))) { + r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+2) << 40; + } + if (!(mem_mask & U64(0x000000ff00000000))) { + r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+3) << 32; + } + if (!(mem_mask & U64(0x00000000ff000000))) { + r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+4) << 24; + } + if (!(mem_mask & U64(0x0000000000ff0000))) { + r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+5) << 16; + } + if (!(mem_mask & U64(0x000000000000ff00))) { + r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+6) << 8; + } + if (!(mem_mask & U64(0x00000000000000ff))) { + r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+7) << 0; + } + + return r; +} + + +WRITE64_MEMBER(bebox_state::scsi53c810_w ) +{ + int reg = offset*8; + if (!(mem_mask & U64(0xff00000000000000))) { + m_lsi53c810->lsi53c810_reg_w(reg+0, data >> 56); + } + if (!(mem_mask & U64(0x00ff000000000000))) { + m_lsi53c810->lsi53c810_reg_w(reg+1, data >> 48); + } + if (!(mem_mask & U64(0x0000ff0000000000))) { + m_lsi53c810->lsi53c810_reg_w(reg+2, data >> 40); + } + if (!(mem_mask & U64(0x000000ff00000000))) { + m_lsi53c810->lsi53c810_reg_w(reg+3, data >> 32); + } + if (!(mem_mask & U64(0x00000000ff000000))) { + m_lsi53c810->lsi53c810_reg_w(reg+4, data >> 24); + } + if (!(mem_mask & U64(0x0000000000ff0000))) { + m_lsi53c810->lsi53c810_reg_w(reg+5, data >> 16); + } + if (!(mem_mask & U64(0x000000000000ff00))) { + m_lsi53c810->lsi53c810_reg_w(reg+6, data >> 8); + } + if (!(mem_mask & U64(0x00000000000000ff))) { + m_lsi53c810->lsi53c810_reg_w(reg+7, data >> 0); + } +} + + +UINT32 scsi53c810_pci_read(device_t *busdevice, device_t *device, int function, int offset, UINT32 mem_mask) +{ + bebox_state *state = device->machine().driver_data(); + UINT32 result = 0; + + if (function == 0) + { + switch(offset) + { + case 0x00: /* vendor/device ID */ + result = 0x00011000; + break; + + case 0x08: + result = 0x01000000; + break; + + default: + result = state->m_scsi53c810_data[offset / 4]; + break; + } + } + return result; +} + + +void scsi53c810_pci_write(device_t *busdevice, device_t *device, int function, int offset, UINT32 data, UINT32 mem_mask) +{ + bebox_state *state = device->machine().driver_data(); + offs_t addr; + + if (function == 0) + { + state->m_scsi53c810_data[offset / 4] = data; + + switch(offset) + { + case 0x04: + /* command + * + * bit 8: SERR/ Enable + * bit 6: Enable Parity Response + * bit 4: Write and Invalidate Mode + * bit 2: Enable Bus Mastering + * bit 1: Enable Memory Space + * bit 0: Enable IO Space + */ + if (data & 0x02) + { + /* brutal ugly hack; at some point the PCI code should be handling this stuff */ + if (state->m_scsi53c810_data[5] != 0xFFFFFFF0) + { + address_space &space = state->m_ppc1->space(AS_PROGRAM); + + addr = (state->m_scsi53c810_data[5] | 0xC0000000) & ~0xFF; + space.install_readwrite_handler(addr, addr + 0xFF, read64_delegate(FUNC(bebox_state::scsi53c810_r),state), write64_delegate(FUNC(bebox_state::scsi53c810_w),state)); + } + } + break; + } + } +} + + +void bebox_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_GET_DEVICES: + break; + default: + assert_always(FALSE, "Unknown id in bebox_state::device_timer"); + } +} + + +/************************************* + * + * Driver main + * + *************************************/ + +void bebox_state::machine_reset() +{ + timer_set(attotime::zero, TIMER_GET_DEVICES); + + m_ppc1->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + m_ppc2->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + + memcpy(m_flash->space().get_read_ptr(0),memregion("user1")->base(),0x200000); +} + +void bebox_state::machine_start() +{ +} + +DRIVER_INIT_MEMBER(bebox_state,bebox) +{ + address_space &space_0 = m_ppc1->space(AS_PROGRAM); + address_space &space_1 = m_ppc2->space(AS_PROGRAM); + + /* set up boot and flash ROM */ + membank("bank2")->set_base(memregion("user2")->base()); + + /* install MESS managed RAM */ + space_0.install_readwrite_bank(0, m_ram->size() - 1, 0, 0x02000000, "bank3"); + space_1.install_readwrite_bank(0, m_ram->size() - 1, 0, 0x02000000, "bank3"); + membank("bank3")->set_base(m_ram->pointer()); + + /* The following is a verrrry ugly hack put in to support NetBSD for + * NetBSD. When NetBSD/bebox it does most of its work on CPU #0 and then + * lets CPU #1 go. However, it seems that CPU #1 jumps into never-never + * land, crashes, and then goes into NetBSD's crash handler which catches + * it. The current PowerPC core cannot catch this trip into never-never + * land properly, and MESS crashes. In the interim, this "mitten" catches + * the crash + */ + { + static UINT64 ops[2] = + { + /* li r0, 0x0700 */ + /* mtspr ctr, r0 */ + U64(0x380007007C0903A6), + + /* bcctr 0x14, 0 */ + U64(0x4E80042000000000) + }; + space_1.install_read_bank(0x9421FFF0, 0x9421FFFF, "bank1"); + membank("bank1")->set_base(ops); + } +} diff --git a/src/mame/machine/beta.c b/src/mame/machine/beta.c new file mode 100644 index 00000000000..ef9ec771805 --- /dev/null +++ b/src/mame/machine/beta.c @@ -0,0 +1,292 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, MetalliC +/********************************************************************* + + beta.h + + Implementation of Beta disk drive support for Spectrum and clones + + 04/05/2008 Created by Miodrag Milanovic + +*********************************************************************/ +/* +BUGS: +- due to original firmware bug random commands can be sent to FDC instead of SEEK + +*/ +#include "emu.h" +#include "formats/trd_dsk.h" +#include "machine/beta.h" + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + + +const device_type BETA_DISK = &device_creator; + +beta_disk_device::beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock, "betadisk", __FILE__) + , m_betadisk_active(0) + , m_wd179x(*this, "wd179x") + , m_floppy0(*this, "wd179x:0") + , m_floppy1(*this, "wd179x:1") + , m_floppy2(*this, "wd179x:2") + , m_floppy3(*this, "wd179x:3") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void beta_disk_device::device_start() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void beta_disk_device::device_reset() +{ +} + +int beta_disk_device::is_active() +{ + return m_betadisk_active; +} + +void beta_disk_device::enable() +{ + m_betadisk_active = 1; +} + +void beta_disk_device::disable() +{ + m_betadisk_active = 0; +} + +READ8_MEMBER(beta_disk_device::status_r) +{ + if (m_betadisk_active==1) { + return m_wd179x->status_r(space, 0); + } else { + return 0xff; + } +} + +READ8_MEMBER(beta_disk_device::track_r) +{ + if (m_betadisk_active==1) { + return m_wd179x->track_r(space, 0); + } else { + return 0xff; + } +} + +READ8_MEMBER(beta_disk_device::sector_r) +{ + if (m_betadisk_active==1) { + return m_wd179x->sector_r(space, 0); + } else { + return 0xff; + } +} + +READ8_MEMBER(beta_disk_device::data_r) +{ + if (m_betadisk_active==1) { + return m_wd179x->data_r(space, 0); + } else { + return 0xff; + } +} + +READ8_MEMBER(beta_disk_device::state_r) +{ + if (m_betadisk_active==1) { + UINT8 result = 0x3F; // actually open bus + result |= m_wd179x->drq_r() ? 0x40 : 0; + result |= m_wd179x->intrq_r() ? 0x80 : 0; + return result; + } else { + return 0xff; + } +} + +WRITE8_MEMBER(beta_disk_device::param_w) +{ + if (m_betadisk_active == 1) + { + floppy_connector* connectors[] = { m_floppy0, m_floppy1, m_floppy2, m_floppy3 }; + + floppy_image_device* floppy = connectors[data & 3]->get_device(); + + m_wd179x->set_floppy(floppy); + floppy->ss_w(BIT(data, 4) ? 0 : 1); + m_wd179x->dden_w(BIT(data, 6)); + + // bit 3 connected to pin 23 "HLT" of FDC and via diode to INDEX + //m_wd179x->hlt_w(BIT(data, 3)); // not handled in current wd_fdc + + if (BIT(data, 2) == 0) // reset + { + m_wd179x->reset(); + floppy->mon_w(ASSERT_LINE); + } else { + // HACK, FDD motor and RDY FDC pin controlled by HLD pin of FDC + floppy->mon_w(CLEAR_LINE); + } + } +} + +WRITE8_MEMBER(beta_disk_device::command_w) +{ + if (m_betadisk_active==1) { + m_wd179x->cmd_w(space, 0, data); + } +} + +WRITE8_MEMBER(beta_disk_device::track_w) +{ + if (m_betadisk_active==1) { + m_wd179x->track_w(space, 0, data); + } +} + +WRITE8_MEMBER(beta_disk_device::sector_w) +{ + if (m_betadisk_active==1) { + m_wd179x->sector_w(space, 0, data); + } +} + +WRITE8_MEMBER(beta_disk_device::data_w) +{ + if (m_betadisk_active==1) { + m_wd179x->data_w(space, 0, data); + } +} + +FLOPPY_FORMATS_MEMBER(beta_disk_device::floppy_formats) + FLOPPY_TRD_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( beta_disk_floppies ) + SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) + SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) + SLOT_INTERFACE( "drive2", FLOPPY_525_QD ) + SLOT_INTERFACE( "drive3", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_FRAGMENT( beta_disk ) + MCFG_KR1818VG93_ADD("wd179x", XTAL_8MHz / 8) + MCFG_FLOPPY_DRIVE_ADD("wd179x:0", beta_disk_floppies, "drive0", beta_disk_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd179x:1", beta_disk_floppies, "drive1", beta_disk_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd179x:2", beta_disk_floppies, "drive2", beta_disk_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("wd179x:3", beta_disk_floppies, "drive3", beta_disk_device::floppy_formats) +MACHINE_CONFIG_END + +ROM_START( beta_disk ) + ROM_REGION( 0x60000, "beta", 0 ) + ROM_LOAD( "trd501.rom", 0x00000, 0x4000, CRC(3e3cdd4c) SHA1(8303ba0cc79daa6c04cd1e6ce27e8b6886a3f0de)) + + ROM_LOAD( "trd503zxvgs.rom",0x00000, 0x4000, CRC(b90ee684) SHA1(c78e1b36812fb2b3e7a62e66049c850d27de74a6)) + ROM_LOAD( "trd503m.rom", 0x00000, 0x4000, CRC(2f97fe06) SHA1(6b9decc07d5d7322c6c283f5fe950f530a42d70d)) + ROM_LOAD( "trd503[a].rom", 0x00000, 0x4000, CRC(c43d717f) SHA1(0a74bd34538a03d0e1d214b425d95c14ad10c8c4)) + ROM_LOAD( "trd503[a2].rom", 0x00000, 0x4000, CRC(121889b0) SHA1(c9d69cf3a0219f6e37e7eb5046961fa8fa8eb2c6)) + ROM_LOAD( "trd503[a3].rom", 0x00000, 0x4000, CRC(1c5a25b1) SHA1(4a6fbabd82a6a8f3986ac77e7157d1a2551ed40d)) + ROM_LOAD( "trd503beta3.rom",0x00000, 0x4000, CRC(561662f2) SHA1(4cea8a361eb848cf0ad59605c83d57c30521cfd5)) + ROM_LOAD( "trd503beta4.rom",0x00000, 0x4000, CRC(23dbc387) SHA1(74b80d3f07dc95e9f09b83c3df4724f063f47116)) + ROM_LOAD( "trd503all.rom", 0x00000, 0x4000, CRC(4c0187ab) SHA1(21f611e5e0bbf5d6450606e30b470f7c2c9640f1)) + ROM_LOAD( "trd503aut.rom", 0x00000, 0x4000, CRC(7ff90178) SHA1(2261144bdb5046cb8013f744a5b0721be8577dc7)) + ROM_LOAD( "trd503ext.rom", 0x00000, 0x4000, CRC(abb139e7) SHA1(3c1736857655a48375d30b3865963090ba635635)) + ROM_LOAD( "trd503kay.rom", 0x00000, 0x4000, CRC(77baccbb) SHA1(9c5fb89b57643f723246453809dad3f669bf59a3)) + ROM_LOAD( "trd503xbios.rom",0x00000, 0x4000, CRC(8be427cc) SHA1(78f423fd200e720aa6b857f00969fa1f8c7da20e)) + ROM_LOAD( "trd503[a4].rom", 0x00000, 0x4000, CRC(c2387608) SHA1(93e0b92a3f38b59cc006d22f9c9299f5377b15e5)) + + + ROM_LOAD( "trd504.rom", 0x00000, 0x4000, CRC(ba310874) SHA1(05e55e37df8eee6c68601ba9cf6c92195852ce3f)) + ROM_LOAD( "trd504s.rom", 0x00000, 0x4000, CRC(c5ca0423) SHA1(cb2da2c4575bc54454e4f97073c5bb37505487fe)) + ROM_LOAD( "trd504s2.rom", 0x00000, 0x4000, CRC(1e9b59aa) SHA1(d6eb0eeb429c70d1f8f9a23ca4e2feb5f73d3120)) + ROM_LOAD( "trd504s3.rom", 0x00000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db)) + + + ROM_LOAD( "trd504tm.rom", 0x00000, 0x4000, CRC(2334b8c6) SHA1(2fd8944e067140324e998b59aab766f16eb5c7fb)) + ROM_LOAD( "trd504t.rom", 0x00000, 0x4000, CRC(e212d1e0) SHA1(745e9caf576e64a5386ad845256d28593d34cc40)) + ROM_LOAD( "trd504tb2.rom", 0x00000, 0x4000, CRC(8d943e6b) SHA1(bf6ab329791258f02c5f695b0c7448998b709435)) + ROM_LOAD( "trd504s4.rom", 0x00000, 0x4000, CRC(522ebbd6) SHA1(eede6a988ed453e506b27a8d09470e0a8d97d1aa)) + ROM_LOAD( "trd504f.rom", 0x00000, 0x4000, CRC(ab3100d8) SHA1(33646525ae1c579cddc0dd84d3218095950965b8)) + ROM_LOAD( "trd504em.rom", 0x00000, 0x4000, CRC(0d3f8b43) SHA1(d6783983a16b17b79337c22e9460e1cfde3744ae)) + ROM_LOAD( "trd504-1.rom", 0x00000, 0x4000, CRC(da170c65) SHA1(80f0fe79cbf393ac91ff971d31ff9eab0c9a959e)) + ROM_LOAD( "trd504m.rom", 0x00000, 0x4000, CRC(2f2cb630) SHA1(40b1f87f8be4e09630d7eb7c14561dde0b85c0c9)) + ROM_LOAD( "trd504em[a].rom",0x00000, 0x4000, CRC(fcbf11e8) SHA1(8050d371d7049e0c3e946964643396a39aa5ab0f)) + ROM_LOAD( "trd5043.rom", 0x00000, 0x4000, CRC(165d5ef8) SHA1(99d25234154e4a8b3ad5e06f260b6c41c253b333)) + + ROM_LOAD( "trd505.rom", 0x00000, 0x4000, CRC(fdff3810) SHA1(0a0e284d4764a542aa3e5d7c43d0291036e16c35)) + ROM_LOAD( "trd505[a].rom", 0x00000, 0x4000, CRC(03b76c8f) SHA1(ef2a07767d3b229aa4573dcfee905156a83bc32d)) + ROM_LOAD( "trd505h.rom", 0x00000, 0x4000, CRC(9ba15549) SHA1(5908784cdfb782066bde08f186f0bbb6f6b80545)) + ROM_LOAD( "trd505d.rom", 0x00000, 0x4000, CRC(31e4be08) SHA1(dd08bdea8b5caa35569f49770e380d16bb37502b)) + ROM_LOAD( "trd505[a2].rom", 0x00000, 0x4000, CRC(a102e726) SHA1(a3f0ef7b7d8b3022f306be8d9e8a51ae699097df)) + + ROM_LOAD( "trd56661.rom", 0x00000, 0x4000, CRC(8528c789) SHA1(1332a01137bd537fee696ba7adddc0a15b3237c4)) + ROM_LOAD( "trd5666hte.rom", 0x00000, 0x4000, CRC(03841161) SHA1(4e523768231130947a81247e116fc049bd6da963)) + ROM_LOAD( "trd5613.rom", 0x00000, 0x4000, CRC(d66cda49) SHA1(dac3c8396fc4f85b5673076cc647afbe439ad17a)) + + ROM_LOAD( "trd512.rom", 0x00000, 0x4000, CRC(b615d6c4) SHA1(4abb90243f66df19caa84f82d0b880a6ce344eca)) + ROM_LOAD( "trd512f.rom", 0x00000, 0x4000, CRC(edb74f8c) SHA1(c5b2cd18926dde4a68bcd8c360ba33d6c11b8801)) + + ROM_LOAD( "trd513f.rom", 0x00000, 0x4000, CRC(6b1c17f3) SHA1(5c14c0c389e29521cb59672d93d3e8a74f0184cc)) + ROM_LOAD( "trd513fm.rom", 0x00000, 0x4000, CRC(bad0c0a0) SHA1(da88e756302f83991774730012601ebf3c61aed9)) + ROM_LOAD( "trd513p.rom", 0x00000, 0x4000, CRC(eb3196fe) SHA1(7c85b9b562d288155677f20f5e41e679c073379b)) + + ROM_LOAD( "trd604.rom", 0x00000, 0x4000, CRC(d8882a8c) SHA1(282eb7bc819aad2a12fd954e76f7838a4e1a7929)) + ROM_LOAD( "trd604m.rom", 0x00000, 0x4000, CRC(e73394cb) SHA1(5b1336e8534513df0a71f8fedca38bc67174f03c)) + + ROM_LOAD( "trd605r.rom", 0x00000, 0x4000, CRC(f8816a47) SHA1(98c9b63835e559f38f6a8d1344992f02cb899add)) + ROM_LOAD( "trd605e.rom", 0x00000, 0x4000, CRC(56d3c2db) SHA1(adc21492d216da1aca4119972f2110a23fdd23a7)) + ROM_LOAD( "trd605h.rom", 0x00000, 0x4000, CRC(53bb1b4a) SHA1(fc899901fd59c84c9aa6c402b67d76b225ab8e5b)) + ROM_LOAD( "trd605e-2.rom", 0x00000, 0x4000, CRC(a064b7f2) SHA1(46ac75e88375d313fdd5e873800bf82c179eb226)) + ROM_LOAD( "trd605e-3.rom", 0x00000, 0x4000, CRC(cff3d06b) SHA1(0fca9c61cb94a4cab78118c66ba54ce6bc6dcf65)) + + ROM_LOAD( "trd606h.rom", 0x00000, 0x4000, CRC(6b44fdd7) SHA1(4ca7ea2bc0e62c98c9ba86a304aee3cbf88d6b09)) + + ROM_LOAD( "trd607m.rom", 0x00000, 0x4000, CRC(5a062f03) SHA1(bbd68481c76e8a3f2f26847faa72c42df013b617)) + + ROM_LOAD( "trd608.rom", 0x00000, 0x4000, CRC(5c998d53) SHA1(c65a972e75e627336c44ea184cb9ae81dfa2069b)) + ROM_LOAD( "trd608-2.rom", 0x00000, 0x4000, CRC(3541b280) SHA1(2b93c1887f485639ec15860b5503dc7efb6d31d6)) + ROM_LOAD( "trd608-3.rom", 0x00000, 0x4000, CRC(d3e91d69) SHA1(5e367d3601d07bd2af1d6255561a5983c0e9fb5d)) + + ROM_LOAD( "trd609.rom", 0x00000, 0x4000, CRC(91028924) SHA1(fa5433f73aab93c58c891ceee2cdfed0a979dfbb)) + ROM_LOAD( "trd609e.rom", 0x00000, 0x4000, CRC(46312c8c) SHA1(0ce69fe76e17a875c287e3725f6209f1c59d8bd9)) + + ROM_LOAD( "trd610e.rom", 0x00000, 0x4000, CRC(95395ca4) SHA1(8cda2efbf2360cd675ea8b04b43cf1746fb41f35)) + + ROM_LOAD( "trd701.rom", 0x00000, 0x4000, CRC(47f39c0d) SHA1(53d8b8959c321618caaef5aeb270e530e8f8ada3)) + + //Default for now + ROM_LOAD( "trd503.rom", 0x00000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c)) +ROM_END + + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor beta_disk_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( beta_disk ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *beta_disk_device::device_rom_region() const +{ + return ROM_NAME(beta_disk ); +} diff --git a/src/mame/machine/beta.h b/src/mame/machine/beta.h new file mode 100644 index 00000000000..4afe62c771c --- /dev/null +++ b/src/mame/machine/beta.h @@ -0,0 +1,69 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, MetalliC +/********************************************************************* + + beta.h + + Implementation of Beta disk drive support for Spectrum and clones + + 04/05/2008 Created by Miodrag Milanovic + +*********************************************************************/ +#ifndef __BETA_H__ +#define __BETA_H__ + +#include "machine/wd_fdc.h" + + +#define BETA_DISK_TAG "beta" + +class beta_disk_device : public device_t +{ +public: + beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~beta_disk_device() {} + + DECLARE_READ8_MEMBER(status_r); + DECLARE_READ8_MEMBER(track_r); + DECLARE_READ8_MEMBER(sector_r); + DECLARE_READ8_MEMBER(data_r); + DECLARE_READ8_MEMBER(state_r); + + DECLARE_WRITE8_MEMBER(param_w); + DECLARE_WRITE8_MEMBER(command_w); + DECLARE_WRITE8_MEMBER(track_w); + DECLARE_WRITE8_MEMBER(sector_w); + DECLARE_WRITE8_MEMBER(data_w); + DECLARE_FLOPPY_FORMATS(floppy_formats); + + int is_active(); + void enable(); + void disable(); + + UINT8 m_betadisk_active; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + +private: + required_device m_wd179x; + required_device m_floppy0; + required_device m_floppy1; + required_device m_floppy2; + required_device m_floppy3; +}; + +extern const device_type BETA_DISK; + + +#define MCFG_BETA_DISK_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, BETA_DISK, 0) + +#define MCFG_BETA_DISK_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +#endif /* __BETA_H__ */ diff --git a/src/mame/machine/bk.c b/src/mame/machine/bk.c new file mode 100644 index 00000000000..605b66dc74b --- /dev/null +++ b/src/mame/machine/bk.c @@ -0,0 +1,168 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + BK machine driver by Miodrag Milanovic + + 10/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "imagedev/cassette.h" +#include "machine/i8255.h" +#include "includes/bk.h" + + +TIMER_CALLBACK_MEMBER(bk_state::keyboard_callback) +{ + UINT8 code, i, j; + static const char *const keynames[] = { + "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", + "LINE7", "LINE8", "LINE9", "LINE10", "LINE11" + }; + + for(i = 1; i < 12; i++) + { + code = ioport(keynames[i-1])->read(); + if (code != 0) + { + for(j = 0; j < 8; j++) + { + if (code == (1 << j)) + { + m_key_code = j + i*8; + break; + } + } + if ((ioport("LINE0")->read() & 4) == 4) + { + if (i==6 || i==7) + { + m_key_code -= 16; + } + + } + if ((ioport("LINE0")->read() & 4) == 4) + { + if (i>=8 && i<=11) + { + m_key_code += 32; + } + } + m_key_pressed = 0x40; + if ((ioport("LINE0")->read() & 2) == 0) + { + m_key_irq_vector = 0x30; + } + else + { + m_key_irq_vector = 0xBC; + } + m_maincpu->set_input_line(0, ASSERT_LINE); + break; + } + } +} + + +void bk_state::machine_start() +{ + machine().scheduler().timer_pulse(attotime::from_hz(2400), timer_expired_delegate(FUNC(bk_state::keyboard_callback),this)); +} + +IRQ_CALLBACK_MEMBER(bk_state::bk0010_irq_callback) +{ + device.execute().set_input_line(0, CLEAR_LINE); + return m_key_irq_vector; +} + +void bk_state::machine_reset() +{ + m_kbd_state = 0; + m_scrool = 01330; +} + +READ16_MEMBER(bk_state::bk_key_state_r) +{ + return m_kbd_state; +} +READ16_MEMBER(bk_state::bk_key_code_r) +{ + m_kbd_state &= ~0x80; // mark reading done + m_key_pressed = 0; + return m_key_code; +} +READ16_MEMBER(bk_state::bk_vid_scrool_r) +{ + return m_scrool; +} + +READ16_MEMBER(bk_state::bk_key_press_r) +{ + double level = m_cassette->input(); + UINT16 cas; + if (level < 0) + { + cas = 0x00; + } + else + { + cas = 0x20; + } + + return 0x8080 | m_key_pressed | cas; +} + +WRITE16_MEMBER(bk_state::bk_key_state_w) +{ + m_kbd_state = (m_kbd_state & ~0x40) | (data & 0x40); +} + +WRITE16_MEMBER(bk_state::bk_vid_scrool_w) +{ + m_scrool = data; +} + +WRITE16_MEMBER(bk_state::bk_key_press_w) +{ +} + +READ16_MEMBER(bk_state::bk_floppy_cmd_r) +{ + return 0; +} + +WRITE16_MEMBER(bk_state::bk_floppy_cmd_w) +{ + if ((data & 1) == 1) + { + m_drive = 0; + } + if ((data & 2) == 2) + { + m_drive = 1; + } + if ((data & 4) == 4) + { + m_drive = 2; + } + if ((data & 8) == 8) + { + m_drive = 3; + } + if (data == 0) + { + m_drive = -1; + } +} + +READ16_MEMBER(bk_state::bk_floppy_data_r) +{ + return 0; +} + +WRITE16_MEMBER(bk_state::bk_floppy_data_w) +{ +} diff --git a/src/mame/machine/c65_old.c b/src/mame/machine/c65_old.c new file mode 100644 index 00000000000..3a582cfb0ae --- /dev/null +++ b/src/mame/machine/c65_old.c @@ -0,0 +1,1339 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/*************************************************************************** + commodore c65 home computer + peter.trauner@jk.uni-linz.ac.at + documention + www.funet.fi + ***************************************************************************/ + +#include "emu.h" + +#include "includes/c65.h" +#include "cpu/m6502/m4510.h" +#include "sound/mos6581.h" +#include "machine/mos6526.h" +#include "bus/cbmiec/cbmiec.h" +#include "machine/ram.h" +#include "video/vic4567.h" +#include "imagedev/cassette.h" +#include "crsshair.h" +#include "formats/cbm_tap.h" + +#define VERBOSE_LEVEL 0 +#define DBG_LOG( MACHINE, N, M, A ) \ + do { \ + if(VERBOSE_LEVEL >= N) \ + { \ + if( M ) \ + logerror("%11.6f: %-24s", MACHINE.time().as_double(), (char*) M ); \ + logerror A; \ + } \ + } while (0) + + + +/*********************************************** + + Input Reading - Common Components + +***********************************************/ + +/* These are needed by c64, c65 and c128, each machine has also additional specific +components in its INTERRUPT_GEN */ + +/* keyboard lines */ +UINT8 c64_keyline[10]; + +void cbm_common_init(void) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH(c64_keyline); i++) + c64_keyline[i] = 0xff; +} + +static TIMER_CALLBACK( lightpen_tick ) +{ + if (((machine.root_device().ioport("CTRLSEL")->read() & 0x07) == 0x04) || ((machine.root_device().ioport("CTRLSEL")->read() & 0x07) == 0x06)) + { + /* enable lightpen crosshair */ + crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); + } + else + { + /* disable lightpen crosshair */ + crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); + } +} + +void cbm_common_interrupt( device_t *device ) +{ + int value, i; + int controller1 = device->machine().root_device().ioport("CTRLSEL")->read() & 0x07; + int controller2 = device->machine().root_device().ioport("CTRLSEL")->read() & 0x70; + static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; + + /* Lines 0-7 : common keyboard */ + for (i = 0; i < 8; i++) + { + value = 0xff; + value &= ~device->machine().root_device().ioport(c64ports[i])->read(); + + /* Shift Lock is mapped on Left Shift */ + if ((i == 1) && (device->machine().root_device().ioport("SPECIAL")->read() & 0x40)) + value &= ~0x80; + + c64_keyline[i] = value; + } + + + value = 0xff; + switch(controller1) + { + case 0x00: + value &= ~device->machine().root_device().ioport("JOY1_1B")->read(); /* Joy1 Directions + Button 1 */ + break; + + case 0x01: + if (device->machine().root_device().ioport("OTHER")->read() & 0x40) /* Paddle2 Button */ + value &= ~0x08; + if (device->machine().root_device().ioport("OTHER")->read() & 0x80) /* Paddle1 Button */ + value &= ~0x04; + break; + + case 0x02: + if (device->machine().root_device().ioport("OTHER")->read() & 0x02) /* Mouse Button Left */ + value &= ~0x10; + if (device->machine().root_device().ioport("OTHER")->read() & 0x01) /* Mouse Button Right */ + value &= ~0x01; + break; + + case 0x03: + value &= ~(device->machine().root_device().ioport("JOY1_2B")->read() & 0x1f); /* Joy1 Directions + Button 1 */ + break; + + case 0x04: +/* was there any input on the lightpen? where is it mapped? */ +// if (device->machine().root_device().ioport("OTHER")->read() & 0x04) /* Lightpen Signal */ +// value &= ?? ; + break; + + case 0x07: + break; + + default: + logerror("Invalid Controller 1 Setting %d\n", controller1); + break; + } + + c64_keyline[8] = value; + + + value = 0xff; + switch(controller2) + { + case 0x00: + value &= ~device->machine().root_device().ioport("JOY2_1B")->read(); /* Joy2 Directions + Button 1 */ + break; + + case 0x10: + if (device->machine().root_device().ioport("OTHER")->read() & 0x10) /* Paddle4 Button */ + value &= ~0x08; + if (device->machine().root_device().ioport("OTHER")->read() & 0x20) /* Paddle3 Button */ + value &= ~0x04; + break; + + case 0x20: + if (device->machine().root_device().ioport("OTHER")->read() & 0x02) /* Mouse Button Left */ + value &= ~0x10; + if (device->machine().root_device().ioport("OTHER")->read() & 0x01) /* Mouse Button Right */ + value &= ~0x01; + break; + + case 0x30: + value &= ~(device->machine().root_device().ioport("JOY2_2B")->read() & 0x1f); /* Joy2 Directions + Button 1 */ + break; + + case 0x40: +/* was there any input on the lightpen? where is it mapped? */ +// if (device->machine().root_device().ioport("OTHER")->read() & 0x04) /* Lightpen Signal */ +// value &= ?? ; + break; + + case 0x70: + break; + + default: + logerror("Invalid Controller 2 Setting %d\n", controller2); + break; + } + + c64_keyline[9] = value; + +// vic2_frame_interrupt does nothing so this is not necessary +// vic2_frame_interrupt (device); + + /* check if lightpen has been chosen as input: if so, enable crosshair */ + device->machine().scheduler().timer_set(attotime::zero, FUNC(lightpen_tick)); + + set_led_status (device->machine(), 1, device->machine().root_device().ioport("SPECIAL")->read() & 0x40 ? 1 : 0); /* Shift Lock */ + set_led_status (device->machine(), 0, device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ? 1 : 0); /* Joystick Swap */ +} + + +/*********************************************** + + CIA Common Handlers + +***********************************************/ + +/* These are shared by c64, c65 and c128. c65 and c128 also have additional specific +components (to select/read additional keyboard lines) */ + +/* + * CIA 0 - Port A + * bits 7-0 keyboard line select + * bits 7,6: paddle select( 01 port a, 10 port b) + * bit 4: joystick a fire button + * bits 3,2: Paddles port a fire button + * bits 3-0: joystick a direction + * + * CIA 0 - Port B + * bits 7-0: keyboard raw values + * bit 4: joystick b fire button, lightpen select + * bits 3,2: paddle b fire buttons (left,right) + * bits 3-0: joystick b direction + * + * flag cassette read input, serial request in + * irq to irq connected + */ + +UINT8 cbm_common_cia0_port_a_r( device_t *device, UINT8 output_b ) +{ + UINT8 value = 0xff; + + if (!(output_b & 0x80)) + { + UINT8 t = 0xff; + if (!(c64_keyline[7] & 0x80)) t &= ~0x80; + if (!(c64_keyline[6] & 0x80)) t &= ~0x40; + if (!(c64_keyline[5] & 0x80)) t &= ~0x20; + if (!(c64_keyline[4] & 0x80)) t &= ~0x10; + if (!(c64_keyline[3] & 0x80)) t &= ~0x08; + if (!(c64_keyline[2] & 0x80)) t &= ~0x04; + if (!(c64_keyline[1] & 0x80)) t &= ~0x02; + if (!(c64_keyline[0] & 0x80)) t &= ~0x01; + value &= t; + } + + if (!(output_b & 0x40)) + { + UINT8 t = 0xff; + if (!(c64_keyline[7] & 0x40)) t &= ~0x80; + if (!(c64_keyline[6] & 0x40)) t &= ~0x40; + if (!(c64_keyline[5] & 0x40)) t &= ~0x20; + if (!(c64_keyline[4] & 0x40)) t &= ~0x10; + if (!(c64_keyline[3] & 0x40)) t &= ~0x08; + if (!(c64_keyline[2] & 0x40)) t &= ~0x04; + if (!(c64_keyline[1] & 0x40)) t &= ~0x02; + if (!(c64_keyline[0] & 0x40)) t &= ~0x01; + value &= t; + } + + if (!(output_b & 0x20)) + { + UINT8 t = 0xff; + if (!(c64_keyline[7] & 0x20)) t &= ~0x80; + if (!(c64_keyline[6] & 0x20)) t &= ~0x40; + if (!(c64_keyline[5] & 0x20)) t &= ~0x20; + if (!(c64_keyline[4] & 0x20)) t &= ~0x10; + if (!(c64_keyline[3] & 0x20)) t &= ~0x08; + if (!(c64_keyline[2] & 0x20)) t &= ~0x04; + if (!(c64_keyline[1] & 0x20)) t &= ~0x02; + if (!(c64_keyline[0] & 0x20)) t &= ~0x01; + value &= t; + } + + if (!(output_b & 0x10)) + { + UINT8 t = 0xff; + if (!(c64_keyline[7] & 0x10)) t &= ~0x80; + if (!(c64_keyline[6] & 0x10)) t &= ~0x40; + if (!(c64_keyline[5] & 0x10)) t &= ~0x20; + if (!(c64_keyline[4] & 0x10)) t &= ~0x10; + if (!(c64_keyline[3] & 0x10)) t &= ~0x08; + if (!(c64_keyline[2] & 0x10)) t &= ~0x04; + if (!(c64_keyline[1] & 0x10)) t &= ~0x02; + if (!(c64_keyline[0] & 0x10)) t &= ~0x01; + value &= t; + } + + if (!(output_b & 0x08)) + { + UINT8 t = 0xff; + if (!(c64_keyline[7] & 0x08)) t &= ~0x80; + if (!(c64_keyline[6] & 0x08)) t &= ~0x40; + if (!(c64_keyline[5] & 0x08)) t &= ~0x20; + if (!(c64_keyline[4] & 0x08)) t &= ~0x10; + if (!(c64_keyline[3] & 0x08)) t &= ~0x08; + if (!(c64_keyline[2] & 0x08)) t &= ~0x04; + if (!(c64_keyline[1] & 0x08)) t &= ~0x02; + if (!(c64_keyline[0] & 0x08)) t &= ~0x01; + value &= t; + } + + if (!(output_b & 0x04)) + { + UINT8 t = 0xff; + if (!(c64_keyline[7] & 0x04)) t &= ~0x80; + if (!(c64_keyline[6] & 0x04)) t &= ~0x40; + if (!(c64_keyline[5] & 0x04)) t &= ~0x20; + if (!(c64_keyline[4] & 0x04)) t &= ~0x10; + if (!(c64_keyline[3] & 0x04)) t &= ~0x08; + if (!(c64_keyline[2] & 0x04)) t &= ~0x04; + if (!(c64_keyline[1] & 0x04)) t &= ~0x02; + if (!(c64_keyline[0] & 0x04)) t &= ~0x01; + value &= t; + } + + if (!(output_b & 0x02)) + { + UINT8 t = 0xff; + if (!(c64_keyline[7] & 0x02)) t &= ~0x80; + if (!(c64_keyline[6] & 0x02)) t &= ~0x40; + if (!(c64_keyline[5] & 0x02)) t &= ~0x20; + if (!(c64_keyline[4] & 0x02)) t &= ~0x10; + if (!(c64_keyline[3] & 0x02)) t &= ~0x08; + if (!(c64_keyline[2] & 0x02)) t &= ~0x04; + if (!(c64_keyline[1] & 0x02)) t &= ~0x02; + if (!(c64_keyline[0] & 0x02)) t &= ~0x01; + value &= t; + } + + if (!(output_b & 0x01)) + { + UINT8 t = 0xff; + if (!(c64_keyline[7] & 0x01)) t &= ~0x80; + if (!(c64_keyline[6] & 0x01)) t &= ~0x40; + if (!(c64_keyline[5] & 0x01)) t &= ~0x20; + if (!(c64_keyline[4] & 0x01)) t &= ~0x10; + if (!(c64_keyline[3] & 0x01)) t &= ~0x08; + if (!(c64_keyline[2] & 0x01)) t &= ~0x04; + if (!(c64_keyline[1] & 0x01)) t &= ~0x02; + if (!(c64_keyline[0] & 0x01)) t &= ~0x01; + value &= t; + } + + if ( device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ) + value &= c64_keyline[8]; + else + value &= c64_keyline[9]; + + return value; +} + +UINT8 cbm_common_cia0_port_b_r( device_t *device, UINT8 output_a ) +{ + UINT8 value = 0xff; + + if (!(output_a & 0x80)) value &= c64_keyline[7]; + if (!(output_a & 0x40)) value &= c64_keyline[6]; + if (!(output_a & 0x20)) value &= c64_keyline[5]; + if (!(output_a & 0x10)) value &= c64_keyline[4]; + if (!(output_a & 0x08)) value &= c64_keyline[3]; + if (!(output_a & 0x04)) value &= c64_keyline[2]; + if (!(output_a & 0x02)) value &= c64_keyline[1]; + if (!(output_a & 0x01)) value &= c64_keyline[0]; + + if ( device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ) + value &= c64_keyline[9]; + else + value &= c64_keyline[8]; + + return value; +} + + +/*********************************************** + + CBM Cartridges + +***********************************************/ + + +/* All the cartridge specific code has been moved + to machine/ drivers. Once more informations + surface about the cart expansions for systems + in c65.c, c128.c, cbmb.c and pet.c, the shared + code could be refactored to have here the + common functions */ + + + +/*********************************************** + + CBM Datasette Tapes + +***********************************************/ + +#if 0 +const cassette_interface cbm_cassette_interface = +{ + cbm_cassette_formats, + NULL, + (cassette_state) (CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED), + NULL +}; +#endif + + +/*UINT8 *c65_basic; */ +/*UINT8 *c65_kernal; */ +/*UINT8 *c65_dos; */ +/*UINT8 *c65_monitor; */ +/*UINT8 *c65_graphics; */ + + +void c65_state::c65_nmi( ) +{ + if (m_nmilevel != (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq) /* KEY_RESTORE */ + { + m_maincpu->set_input_line(INPUT_LINE_NMI, (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq); + + m_nmilevel = (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq; + } +} + + +/*********************************************** + + CIA Interfaces + +***********************************************/ + +/* + * CIA 0 - Port A keyboard line select + * CIA 0 - Port B keyboard line read + * + * flag cassette read input, serial request in + * irq to irq connected + * + * see machine/cbm.c + */ + +READ8_MEMBER(c65_state::c65_cia0_port_a_r) +{ + UINT8 cia0portb = m_cia0->pb_r(space, 0); + + return cbm_common_cia0_port_a_r(m_cia0, cia0portb); +} + +READ8_MEMBER(c65_state::c65_cia0_port_b_r) +{ + UINT8 value = 0xff; + UINT8 cia0porta = m_cia0->pa_r(space, 0); + + value &= cbm_common_cia0_port_b_r(m_cia0, cia0porta); + + if (!(m_6511_port & 0x02)) + value &= m_keyline; + + return value; +} + +WRITE8_MEMBER(c65_state::c65_cia0_port_b_w) +{ +// was there lightpen support in c65 video chip? +// vic3_device *vic3 = machine().device("vic3"); +// vic3->lightpen_write(data & 0x10); +} + +void c65_state::c65_irq( int level ) +{ + if (level != m_old_level) + { + DBG_LOG(machine(), 3, "mos4510", ("irq %s\n", level ? "start" : "end")); + m_maincpu->set_input_line(M4510_IRQ_LINE, level); + m_old_level = level; + } +} + +/* is this correct for c65 as well as c64? */ +WRITE_LINE_MEMBER(c65_state::c65_cia0_interrupt) +{ + m_cia0_irq = state; + c65_irq(state || m_vicirq); +} + +/* is this correct for c65 as well as c64? */ +WRITE_LINE_MEMBER(c65_state::c65_vic_interrupt) +{ +#if 1 + if (state != m_vicirq) + { + c65_irq (state || m_cia0_irq); + m_vicirq = state; + } +#endif +} + +/* + * CIA 1 - Port A + * bit 7 serial bus data input + * bit 6 serial bus clock input + * bit 5 serial bus data output + * bit 4 serial bus clock output + * bit 3 serial bus atn output + * bit 2 rs232 data output + * bits 1-0 vic-chip system memory bank select + * + * CIA 1 - Port B + * bit 7 user rs232 data set ready + * bit 6 user rs232 clear to send + * bit 5 user + * bit 4 user rs232 carrier detect + * bit 3 user rs232 ring indicator + * bit 2 user rs232 data terminal ready + * bit 1 user rs232 request to send + * bit 0 user rs232 received data + * + * flag restore key or rs232 received data input + * irq to nmi connected ? + */ +READ8_MEMBER(c65_state::c65_cia1_port_a_r) +{ + UINT8 value = 0xff; + + if (!m_iec->clk_r()) + value &= ~0x40; + + if (!m_iec->data_r()) + value &= ~0x80; + + return value; +} + +WRITE8_MEMBER(c65_state::c65_cia1_port_a_w) +{ + static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000}; + + m_iec->atn_w(!BIT(data, 3)); + m_iec->clk_w(!BIT(data, 4)); + m_iec->data_w(!BIT(data, 5)); + + m_vicaddr = m_memory + helper[data & 0x03]; +} + +WRITE_LINE_MEMBER(c65_state::c65_cia1_interrupt) +{ + m_cia1_irq = state; + c65_nmi(); +} + +/*********************************************** + + Memory Handlers + +***********************************************/ + +/* processor has only 1 mega address space !? */ +/* and system 8 megabyte */ +/* dma controller and bankswitch hardware ?*/ +READ8_MEMBER( c65_state::c65_read_mem ) +{ + UINT8 result; + if (offset <= 0x0ffff) + result = m_memory[offset]; + else + result = space.read_byte(offset); + return result; +} + +WRITE8_MEMBER( c65_state::c65_write_mem ) +{ + if (offset <= 0x0ffff) + m_memory[offset] = data; + else + space.write_byte(offset, data); +} + +/* dma chip at 0xd700 + used: + writing banknumber to offset 2 + writing hibyte to offset 1 + writing lobyte to offset 0 + cpu holded, dma transfer(data at address) executed, cpu activated + + command data: + 0 command (0 copy, 3 fill) + 1,2 length + 3,4,5 source + 6,7,8 dest + 9 subcommand + 10 mod + + version 1: + seldom copy (overlapping) from 0x402002 to 0x402008 + (making place for new line in basic area) + for whats this bit 0x400000, or is this really the address? + maybe means add counter to address for access, + so allowing up or down copies, and reordering copies + + version 2: + cmd 0x30 used for this +*/ +void c65_state::c65_dma_port_w( int offset, int value ) +{ + PAIR pair, src, dst, len; + UINT8 cmd, fill; + int i; + address_space &space = m_maincpu->space(AS_PROGRAM); + + switch (offset & 3) + { + case 2: + case 1: + m_dma.data[offset & 3] = value; + break; + case 0: + pair.b.h3 = 0; + pair.b.h2 = m_dma.data[2]; + pair.b.h = m_dma.data[1]; + pair.b.l = m_dma.data[0]=value; + cmd = c65_read_mem(space, pair.d++); + len.w.h = 0; + len.b.l = c65_read_mem(space, pair.d++); + len.b.h = c65_read_mem(space, pair.d++); + src.b.h3 = 0; + fill = src.b.l = c65_read_mem(space, pair.d++); + src.b.h = c65_read_mem(space, pair.d++); + src.b.h2 = c65_read_mem(space, pair.d++); + dst.b.h3 = 0; + dst.b.l = c65_read_mem(space, pair.d++); + dst.b.h = c65_read_mem(space, pair.d++); + dst.b.h2 = c65_read_mem(space, pair.d++); + + switch (cmd) + { + case 0: + if (src.d == 0x3ffff) m_dump_dma = 1; + if (m_dump_dma) + DBG_LOG(space.machine(), 1,"dma copy job", + ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", + len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), + c65_read_mem(space, pair.d + 1) ) ); + if ((m_dma.version == 1) + && ( (src.d&0x400000) || (dst.d & 0x400000))) + { + if (!(src.d & 0x400000)) + { + dst.d &= ~0x400000; + for (i = 0; i < len.w.l; i++) + c65_write_mem(space, dst.d--, c65_read_mem(space, src.d++)); + } + else if (!(dst.d & 0x400000)) + { + src.d &= ~0x400000; + for (i = 0; i < len.w.l; i++) + c65_write_mem(space, dst.d++, c65_read_mem(space, src.d--)); + } + else + { + src.d &= ~0x400000; + dst.d &= ~0x400000; + for (i = 0; i < len.w.l; i++) + c65_write_mem(space, --dst.d, c65_read_mem(space, --src.d)); + } + } + else + { + for (i = 0; i < len.w.l; i++) + c65_write_mem(space, dst.d++, c65_read_mem(space, src.d++)); + } + break; + case 3: + DBG_LOG(space.machine(), 3,"dma fill job", + ("len:%.4x value:%.2x dst:%.6x sub:%.2x modrm:%.2x\n", + len.w.l, fill, dst.d, c65_read_mem(space, pair.d), + c65_read_mem(space, pair.d + 1))); + for (i = 0; i < len.w.l; i++) + c65_write_mem(space, dst.d++, fill); + break; + case 0x30: + DBG_LOG(space.machine(), 1,"dma copy down", + ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", + len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), + c65_read_mem(space, pair.d + 1) ) ); + for (i = 0; i < len.w.l; i++) + c65_write_mem(space, dst.d--,c65_read_mem(space, src.d--)); + break; + default: + DBG_LOG(space.machine(), 1,"dma job", + ("cmd:%.2x len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", + cmd,len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), + c65_read_mem(space, pair.d + 1))); + } + break; + default: + DBG_LOG(space.machine(), 1, "dma chip write", ("%.3x %.2x\n", offset, value)); + break; + } +} + +int c65_state::c65_dma_port_r( int offset ) +{ + /* offset 3 bit 7 in progress ? */ + DBG_LOG(machine(), 2, "dma chip read", ("%.3x\n", offset)); + return 0x7f; +} + +void c65_state::c65_6511_port_w( int offset, int value ) +{ + if (offset == 7) + { + m_6511_port = value; + } + DBG_LOG(machine(), 2, "r6511 write", ("%.2x %.2x\n", offset, value)); +} + +int c65_state::c65_6511_port_r( int offset ) +{ + int data = 0xff; + + if (offset == 7) + { + if (ioport("SPECIAL")->read() & 0x20) + data &= ~1; + } + DBG_LOG(machine(), 2, "r6511 read", ("%.2x\n", offset)); + + return data; +} + +/* one docu states custom 4191 disk controller + (for 2 1MB MFM disk drives, 1 internal, the other extern (optional) 1565 + with integrated 512 byte buffer + + 0->0 reset ? + + 0->1, 0->0, wait until 2 positiv, 1->0 ??? + + 0->0, 0 not 0 means no drive ???, other system entries + + + reg 0 write/read + 0,1 written + bit 1 set + bit 2 set + bit 3 set + bit 4 set + + + reg 0 read + bit 0 + bit 1 + bit 2 + 0..2 ->$1d4 + + reg 1 write + $01 written + $18 written + $46 written + $80 written + $a1 written + $01 written, dec + $10 written + + reg 2 read/write?(lsr) + bit 2 + bit 4 + bit 5 busy waiting until zero, then reading reg 7 + bit 6 operation not activ flag!? or set overflow pin used + bit 7 busy flag? + + reg 3 read/write?(rcr) + bit 1 + bit 3 + bit 7 busy flag? + + reg 4 + track?? + 0 written + read -> $1d2 + cmp #$50 + bcs + + + reg 5 + sector ?? + 1 written + read -> $1d3 + cmp #$b bcc + + + reg 6 + head ?? + 0 written + read -> $1d1 + cmp #2 bcc + + reg 7 read + #4e written + 12 times 0, a1 a1 a1 fe written + + reg 8 read + #ff written + 16 times #ff written + + reg 9 + #60 written + +might use the set overflow input + +$21a6c 9a6c format +$21c97 9c97 write operation +$21ca0 9ca0 get byte? +$21cab 9cab read reg 7 +$21caf 9caf write reg 7 +$21cb3 +*/ + +#define FDC_LOST 4 +#define FDC_CRC 8 +#define FDC_RNF 0x10 +#define FDC_BUSY 0x80 +#define FDC_IRQ 0x200 + +#define FDC_CMD_MOTOR_SPIN_UP 0x10 + +#if 0 +void c65_state::c65_fdc_state(void) +{ + switch (m_fdc.state) + { + case FDC_CMD_MOTOR_SPIN_UP: + if (machine().time() - m_fdc.time) + { + m_fdc.state = 0; + m_fdc.status &= ~FDC_BUSY; + } + break; + } +} +#endif + +void c65_state::c65_fdc_w( int offset, int data ) +{ + DBG_LOG(machine(), 1, "fdc write", ("%.5x %.2x %.2x\n", machine().device("maincpu")->safe_pc(), offset, data)); + switch (offset & 0xf) + { + case 0: + m_fdc.reg[0] = data; + break; + case 1: + m_fdc.reg[1] = data; + switch (data & 0xf9) + { + case 0x20: // wait for motor spin up + m_fdc.status &= ~(FDC_IRQ|FDC_LOST|FDC_CRC|FDC_RNF); + m_fdc.status |= FDC_BUSY; + m_fdc.time = machine().time(); + m_fdc.state = FDC_CMD_MOTOR_SPIN_UP; + break; + case 0: // cancel + m_fdc.status &= ~(FDC_BUSY); + m_fdc.state = 0; + break; + case 0x80: // buffered write + case 0x40: // buffered read + case 0x81: // unbuffered write + case 0x41: // unbuffered read + case 0x30:case 0x31: // step + break; + } + break; + case 2: case 3: // read only + break; + case 4: + m_fdc.reg[offset & 0xf] = data; + m_fdc.track = data; + break; + case 5: + m_fdc.reg[offset & 0xf] = data; + m_fdc.sector = data; + break; + case 6: + m_fdc.reg[offset & 0xf] = data; + m_fdc.head = data; + break; + case 7: + m_fdc.buffer[m_fdc.cpu_pos++] = data; + break; + default: + m_fdc.reg[offset & 0xf] = data; + break; + } +} + +int c65_state::c65_fdc_r( int offset ) +{ + UINT8 data = 0; + switch (offset & 0xf) + { + case 0: + data = m_fdc.reg[0]; + break; + case 1: + data = m_fdc.reg[1]; + break; + case 2: + data = m_fdc.status; + break; + case 3: + data = m_fdc.status >> 8; + break; + case 4: + data = m_fdc.track; + break; + case 5: + data = m_fdc.sector; + break; + case 6: + data = m_fdc.head; + break; + case 7: + data = m_fdc.buffer[m_fdc.cpu_pos++]; + break; + default: + data = m_fdc.reg[offset & 0xf]; + break; + } + DBG_LOG(machine(), 1, "fdc read", ("%.5x %.2x %.2x\n", machine().device("maincpu")->safe_pc(), offset, data)); + return data; +} + +/* version 1 ramcheck + write 0:0 + read write read write 80000,90000,f0000 + write 0:8 + read write read write 80000,90000,f0000 + + version 2 ramcheck??? + read 0: + write 0:0 + read 0: + first read and second read bit 0x80 set --> nothing + write 0:0 + read 0 + write 0:ff +*/ + +READ8_MEMBER( c65_state::c65_ram_expansion_r ) +{ + UINT8 data = 0xff; + if (m_ram->size() > (128 * 1024)) + data = m_expansion_ram.reg; + return data; +} + +WRITE8_MEMBER( c65_state::c65_ram_expansion_w ) +{ + offs_t expansion_ram_begin; + offs_t expansion_ram_end; + + if (m_ram->size() > (128 * 1024)) + { + m_expansion_ram.reg = data; + + expansion_ram_begin = 0x80000; + expansion_ram_end = 0x80000 + (m_ram->size() - 128*1024) - 1; + + if (data == 0x00) { + space.install_readwrite_bank(expansion_ram_begin, expansion_ram_end,"bank16"); + membank("bank16")->set_base(m_ram->pointer() + 128*1024); + } else { + space.nop_readwrite(expansion_ram_begin, expansion_ram_end); + } + } +} + +WRITE8_MEMBER( c65_state::c65_write_io ) +{ + mos6581_device *sid_0 = machine().device("sid_r"); + mos6581_device *sid_1 = machine().device("sid_l"); + vic3_device *vic3 = machine().device("vic3"); + + switch (offset & 0xf00) + { + case 0x000: + if (offset < 0x80) + vic3->port_w(space, offset & 0x7f, data); + else if (offset < 0xa0) + c65_fdc_w(offset & 0x1f, data); + else + { + c65_ram_expansion_w(space, offset & 0x1f, data, mem_mask); + /*ram expansion crtl optional */ + } + break; + case 0x100: + case 0x200: + case 0x300: + vic3->palette_w(space, offset - 0x100, data); + break; + case 0x400: + if (offset<0x420) /* maybe 0x20 */ + sid_0->write(space, offset & 0x3f, data); + else if (offset<0x440) + sid_1->write(space, offset & 0x3f, data); + else + DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset, data)); + break; + case 0x500: + DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset, data)); + break; + case 0x600: + c65_6511_port_w(offset & 0xff,data); + break; + case 0x700: + c65_dma_port_w(offset & 0xff, data); + break; + } +} + +WRITE8_MEMBER( c65_state::c65_write_io_dc00 ) +{ + switch (offset & 0xf00) + { + case 0x000: + m_cia0->write(space, offset, data); + break; + case 0x100: + m_cia1->write(space, offset, data); + break; + case 0x200: + case 0x300: + DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset+0xc00, data)); + break; + } +} + +READ8_MEMBER( c65_state::c65_read_io ) +{ + mos6581_device *sid_0 = machine().device("sid_r"); + mos6581_device *sid_1 = machine().device("sid_l"); + vic3_device *vic3 = machine().device("vic3"); + + switch (offset & 0xf00) + { + case 0x000: + if (offset < 0x80) + return vic3->port_r(space, offset & 0x7f); + if (offset < 0xa0) + return c65_fdc_r(offset & 0x1f); + else + { + return c65_ram_expansion_r(space, offset & 0x1f, mem_mask); + /*return; ram expansion crtl optional */ + } + case 0x100: + case 0x200: + case 0x300: + /* read only !? */ + DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); + break; + case 0x400: + if (offset < 0x420) + return sid_0->read(space, offset & 0x3f); + if (offset < 0x440) + return sid_1->read(space, offset & 0x3f); + DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); + break; + case 0x500: + DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); + break; + case 0x600: + return c65_6511_port_r(offset&0xff); + case 0x700: + return c65_dma_port_r(offset&0xff); + } + return 0xff; +} + +READ8_MEMBER( c65_state::c65_read_io_dc00 ) +{ + switch (offset & 0x300) + { + case 0x000: + return m_cia0->read(space, offset); + case 0x100: + return m_cia1->read(space, offset); + case 0x200: + case 0x300: + DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset+0xc00)); + break; + } + return 0xff; +} + + +/* +d02f: + init a5 96 written (seems to be switch to c65 or vic3 mode) + go64 0 written +*/ + +/* bit 1 external sync enable (genlock) + bit 2 palette enable + bit 6 vic3 c65 character set */ +WRITE8_MEMBER(c65_state::c65_bankswitch_interface) +{ + DBG_LOG(machine(), 2, "c65 bankswitch", ("%.2x\n",data)); + + if (m_io_on) + { + if (data & 1) + { + membank("bank8")->set_base(m_colorram + 0x400); + membank("bank9")->set_base(m_colorram + 0x400); + m_maincpu->space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8"); + m_maincpu->space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9"); + } + else + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0dc00, 0x0dfff, read8_delegate(FUNC(c65_state::c65_read_io_dc00),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x0dc00, 0x0dfff, write8_delegate(FUNC(c65_state::c65_write_io_dc00),this)); + } + } + + m_io_dc00_on = !(data & 1); +#if 0 + /* cartridge roms !?*/ + if (data & 0x08) + membank("bank1")->set_base(m_roml); + else + membank("bank1")->set_base(m_memory + 0x8000); + + if (data & 0x10) + membank("bank2")->set_base(m_basic); + else + membank("bank2")->set_base(m_memory + 0xa000); +#endif + if ((m_old_value^data) & 0x20) + { + /* bankswitching faulty when doing actual page */ + if (data & 0x20) + membank("bank3")->set_base(m_basic); + else + membank("bank3")->set_base(m_memory + 0xc000); + } + m_charset_select = data & 0x40; +#if 0 + /* cartridge roms !?*/ + if (data & 0x80) + membank("bank8")->set_base(m_kernal); + else + membank("bank6")->set_base(m_memory + 0xe000); +#endif + m_old_value = data; +} + +void c65_state::c65_bankswitch( ) +{ + int data, loram, hiram, charen; + + data = 0x00; // machine().device("maincpu")->get_port(); + if (data == m_old_data) + return; + + DBG_LOG(machine(), 1, "bankswitch", ("%d\n", data & 7)); + loram = (data & 1) ? 1 : 0; + hiram = (data & 2) ? 1 : 0; + charen = (data & 4) ? 1 : 0; + + if ((!m_game && m_exrom) || (loram && hiram && !m_exrom)) + membank("bank1")->set_base(m_roml); + else + membank("bank1")->set_base(m_memory + 0x8000); + + if ((!m_game && m_exrom && hiram) || (!m_exrom)) + membank("bank2")->set_base(m_romh); + else if (loram && hiram) + membank("bank2")->set_base(m_basic); + else + membank("bank2")->set_base(m_memory + 0xa000); + + if ((!m_game && m_exrom) || (charen && (loram || hiram))) + { + m_io_on = 1; + membank("bank6")->set_base(m_colorram); + membank("bank7")->set_base(m_colorram); + + if (m_io_dc00_on) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0dc00, 0x0dfff, read8_delegate(FUNC(c65_state::c65_read_io_dc00),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x0dc00, 0x0dfff, write8_delegate(FUNC(c65_state::c65_write_io_dc00),this)); + } + else + { + m_maincpu->space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8"); + m_maincpu->space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9"); + membank("bank8")->set_base(m_colorram + 0x400); + membank("bank9")->set_base(m_colorram + 0x400); + } + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0d000, 0x0d7ff, read8_delegate(FUNC(c65_state::c65_read_io),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x0d000, 0x0d7ff, write8_delegate(FUNC(c65_state::c65_write_io),this)); + } + else + { + m_io_on = 0; + membank("bank5")->set_base(m_memory + 0xd000); + membank("bank7")->set_base(m_memory + 0xd800); + membank("bank9")->set_base(m_memory + 0xdc00); + if (!charen && (loram || hiram)) + { + membank("bank4")->set_base(m_chargen); + membank("bank6")->set_base(m_chargen + 0x800); + membank("bank8")->set_base(m_chargen + 0xc00); + } + else + { + membank("bank4")->set_base(m_memory + 0xd000); + membank("bank6")->set_base(m_memory + 0xd800); + membank("bank8")->set_base(m_memory + 0xdc00); + } + m_maincpu->space(AS_PROGRAM).install_read_bank(0x0d000, 0x0d7ff, "bank4"); + m_maincpu->space(AS_PROGRAM).install_write_bank(0x0d000, 0x0d7ff, "bank5"); + } + + if (!m_game && m_exrom) + { + membank("bank10")->set_base(m_romh); + } + else + { + if (hiram) + { + membank("bank10")->set_base(m_kernal); + } + else + { + membank("bank10")->set_base(m_memory + 0xe000); + } + } + m_old_data = data; +} + +#ifdef UNUSED_FUNCTION +void c65_state::c65_colorram_write( int offset, int value ) +{ + m_colorram[offset & 0x7ff] = value | 0xf0; +} +#endif + +/* + * only 14 address lines + * a15 and a14 portlines + * 0x1000-0x1fff, 0x9000-0x9fff char rom + */ +READ8_MEMBER(c65_state::c65_dma_read) +{ + if (!m_game && m_exrom) + { + if (offset < 0x3000) + return m_memory[offset]; + return m_romh[offset & 0x1fff]; + } + if ((m_vicaddr == m_memory) || (m_vicaddr == m_memory + 0x8000)) + { + if (offset < 0x1000) + return m_vicaddr[offset & 0x3fff]; + if (offset < 0x2000) { + if (m_charset_select) + return m_chargen[offset & 0xfff]; + else + return m_chargen[offset & 0xfff]; + } + return m_vicaddr[offset & 0x3fff]; + } + return m_vicaddr[offset & 0x3fff]; +} + +READ8_MEMBER(c65_state::c65_dma_read_color) +{ + if (m_c64mode) + return m_colorram[offset & 0x3ff] & 0xf; + return m_colorram[offset & 0x7ff]; +} + +void c65_state::c65_common_driver_init( ) +{ + m_memory = auto_alloc_array_clear(machine(), UINT8, 0x10000); + membank("bank11")->set_base(m_memory + 0x00000); + membank("bank12")->set_base(m_memory + 0x08000); + membank("bank13")->set_base(m_memory + 0x0a000); + membank("bank14")->set_base(m_memory + 0x0c000); + membank("bank15")->set_base(m_memory + 0x0e000); + + cbm_common_init(); + m_keyline = 0xff; + + m_pal = 0; + m_charset_select = 0; + m_6511_port = 0xff; + m_vicirq = 0; + m_old_data = -1; + + /* C65 had no datasette port */ + m_tape_on = 0; + m_game = 1; + m_exrom = 1; + + /*memset(m_memory + 0x40000, 0, 0x800000 - 0x40000); */ +} + +DRIVER_INIT_MEMBER(c65_state,c65) +{ + m_dma.version = 2; + c65_common_driver_init(); +} + +DRIVER_INIT_MEMBER(c65_state,c65pal) +{ + m_dma.version = 1; + c65_common_driver_init(); + m_pal = 1; +} + +MACHINE_START_MEMBER(c65_state,c65) +{ + /* clear upper memory */ + memset(m_ram->pointer() + 128*1024, 0xff, m_ram->size() - 128*1024); + +//removed cbm_drive_0_config (SERIAL, 10); +//removed cbm_drive_1_config (SERIAL, 11); + m_vicaddr = m_memory; + + m_c64mode = 0; + + c65_bankswitch_interface(m_maincpu->space(AS_PROGRAM),0,0xff); + c65_bankswitch(); +} + + +INTERRUPT_GEN_MEMBER(c65_state::c65_frame_interrupt) +{ + int value; + + c65_nmi(); + + /* common keys input ports */ + cbm_common_interrupt(&device); + + /* c65 specific: function keys input ports */ + value = 0xff; + + value &= ~ioport("FUNCT")->read(); + m_keyline = value; +} diff --git a/src/mame/machine/cbm_snqk.c b/src/mame/machine/cbm_snqk.c new file mode 100644 index 00000000000..e066aa8e262 --- /dev/null +++ b/src/mame/machine/cbm_snqk.c @@ -0,0 +1,100 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*********************************************** + + CBM Quickloads + + ***********************************************/ + +#include "emu.h" +#include "machine/cbm_snqk.h" + +/* prg file format + * sfx file format + * sda file format + * 0 lsb 16bit address + * 2 chip data */ + +/* p00 file format (p00 .. p63, s00 .. s63, ..) + * 0x0000 C64File + * 0x0007 0 + * 0x0008 Name in commodore encoding? + * 0x0018 0 0 + * 0x001a lsb 16bit address + * 0x001c data */ + + +int general_cbm_loadsnap( device_image_interface &image, const char *file_type, int snapshot_size, + address_space &space, offs_t offset, void (*cbm_sethiaddress)(address_space &space, UINT16 hiaddress) ) +{ + char buffer[7]; + dynamic_buffer data; + UINT32 bytesread; + UINT16 address = 0; + int i; + + if (!file_type) + goto error; + + if (!core_stricmp(file_type, "prg")) + { + /* prg files */ + } + else if (!core_stricmp(file_type, "p00")) + { + /* p00 files */ + if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer)) + goto error; + if (memcmp(buffer, "C64File", sizeof(buffer))) + goto error; + image.fseek(26, SEEK_SET); + snapshot_size -= 26; + } + else if (!core_stricmp(file_type, "t64")) + { + /* t64 files - for GB64 Single T64s loading to x0801 - header is always the same size */ + if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer)) + goto error; + if (memcmp(buffer, "C64 tape image file", sizeof(buffer))) + goto error; + image.fseek(94, SEEK_SET); + snapshot_size -= 94; + } + else + { + goto error; + } + + image.fread( &address, 2); + address = LITTLE_ENDIANIZE_INT16(address); + if (!core_stricmp(file_type, "t64")) + address = 2049; + snapshot_size -= 2; + + data.resize(snapshot_size); + + bytesread = image.fread( &data[0], snapshot_size); + if (bytesread != snapshot_size) + goto error; + + for (i = 0; i < snapshot_size; i++) + space.write_byte(address + i + offset, data[i]); + + cbm_sethiaddress(space, address + snapshot_size); + return IMAGE_INIT_PASS; + +error: + return IMAGE_INIT_FAIL; +} + +void cbm_quick_sethiaddress( address_space &space, UINT16 hiaddress ) +{ + space.write_byte(0xae, hiaddress & 0xff); + space.write_byte(0x31, hiaddress & 0xff); + space.write_byte(0x2f, hiaddress & 0xff); + space.write_byte(0x2d, hiaddress & 0xff); + space.write_byte(0xaf, hiaddress >> 8); + space.write_byte(0x32, hiaddress >> 8); + space.write_byte(0x30, hiaddress >> 8); + space.write_byte(0x2e, hiaddress >> 8); +} diff --git a/src/mame/machine/cbm_snqk.h b/src/mame/machine/cbm_snqk.h new file mode 100644 index 00000000000..3abfbf36309 --- /dev/null +++ b/src/mame/machine/cbm_snqk.h @@ -0,0 +1,21 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/*********************************************** + + CBM Quickloads + + ***********************************************/ + +#ifndef __CBM_SNQK_H__ +#define __CBM_SNQK_H__ + +#include "imagedev/snapquik.h" + +#define CBM_QUICKLOAD_DELAY_SECONDS 3 + +int general_cbm_loadsnap( device_image_interface &image, const char *file_type, int snapshot_size, + address_space &space, offs_t offset, void (*cbm_sethiaddress)(address_space &space, UINT16 hiaddress) ); + +void cbm_quick_sethiaddress( address_space &space, UINT16 hiaddress ); + +#endif /* __CBM_SNQK_H__ */ diff --git a/src/mame/machine/coco.c b/src/mame/machine/coco.c new file mode 100644 index 00000000000..f1177b8d9e8 --- /dev/null +++ b/src/mame/machine/coco.c @@ -0,0 +1,1387 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco.c + + TRS-80 Radio Shack Color Computer Family + + Functions to emulate general aspects of the machine (RAM, ROM, interrupts, + I/O ports) + + References: + There are two main references for the info for this driver + - Tandy Color Computer Unravelled Series + (http://www.giftmarket.org/unravelled/unravelled.shtml) + - Assembly Language Programming For the CoCo 3 by Laurence A. Tepolt + - Kevin K. Darlings GIME reference + (http://www.cris.com/~Alxevans/gime.txt) + - Sock Masters's GIME register reference + (http://www.axess.com/twilight/sock/gime.html) + - Robert Gault's FAQ + (http://home.att.net/~robert.gault/Coco/FAQ/FAQ_main.htm) + - Discussions with L. Curtis Boyle (LCB) and John Kowalski (JK) + + TODO: + - Implement unimplemented SAM registers + - Choose and implement more appropriate ratios for the speed up poke + - Handle resets correctly + + In the CoCo, all timings should be exactly relative to each other. This + table shows how all clocks are relative to each other (info: JK): + - Main CPU Clock 0.89 MHz + - Horizontal Sync Interrupt 15.7 kHz/63.5us (57 clock cycles) + - Vertical Sync Interrupt 60 Hz (14934 clock cycles) + - Composite Video Color Carrier 3.58 MHz/279ns (1/4 clock cycles) + + It is also noting that the CoCo 3 had two sets of VSync interrupts. To quote + John Kowalski: + + One other thing to mention is that the old vertical interrupt and the new + vertical interrupt are not the same.. The old one is triggered by the + video's vertical sync pulse, but the new one is triggered on the next scan + line *after* the last scan line of the active video display. That is : new + vertical interrupt triggers somewheres around scan line 230 of the 262 line + screen (if a 200 line graphics mode is used, a bit earlier if a 192 line + mode is used and a bit later if a 225 line mode is used). The old vsync + interrupt triggers on scanline zero. + + 230 is just an estimate [(262-200)/2+200]. I don't think the active part + of the screen is exactly centered within the 262 line total. I can + research that for you if you want an exact number for scanlines before the + screen starts and the scanline that the v-interrupt triggers..etc. + +Added bi-directional bitbanger support. Also fixed reading PIA 1, port A. The +DAC and bitbanger values written should be reflected in the read. + tim lindner, October 2010 + +***************************************************************************/ + +#include "includes/coco.h" +#include "cpu/m6809/m6809.h" +#include "debug/debugcpu.h" + + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define LOG_INTERRUPTS 0 + + + +//************************************************************************** +// BODY +//************************************************************************** + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +coco_state::coco_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, MAINCPU_TAG), + m_pia_0(*this, PIA0_TAG), + m_pia_1(*this, PIA1_TAG), + m_dac(*this, DAC_TAG), + m_wave(*this, WAVE_TAG), + m_cococart(*this, CARTRIDGE_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, "cassette"), + m_rs232(*this, RS232_TAG), + m_vhd_0(*this, VHD0_TAG), + m_vhd_1(*this, VHD1_TAG), + m_beckerport(*this, DWSOCK_TAG), + m_beckerportconfig(*this, BECKERPORT_TAG) +{ +} + + +//------------------------------------------------- +// analog_port_start +//------------------------------------------------- + +void coco_state::analog_port_start(analog_input_t *analog, const char *rx_tag, const char *ry_tag, const char *lx_tag, const char *ly_tag, const char *buttons_tag) +{ + analog->m_input[0][0] = ioport(rx_tag); + analog->m_input[0][1] = ioport(ry_tag); + analog->m_input[1][0] = ioport(lx_tag); + analog->m_input[1][1] = ioport(ly_tag); + analog->m_buttons = ioport(buttons_tag); +} + + + +//------------------------------------------------- +// device_start +//------------------------------------------------- + +void coco_state::device_start() +{ + /* call base device_start */ + driver_device::device_start(); + + /* look up keyboard ports */ + for (int i = 0; i < ARRAY_LENGTH(m_keyboard); i++) + { + char name[32]; + snprintf(name, ARRAY_LENGTH(name), "row%d", i); + m_keyboard[i] = ioport(name); + } + + /* look up analog ports */ + analog_port_start(&m_joystick, JOYSTICK_RX_TAG, JOYSTICK_RY_TAG, + JOYSTICK_LX_TAG, JOYSTICK_LY_TAG, JOYSTICK_BUTTONS_TAG); + analog_port_start(&m_rat_mouse, RAT_MOUSE_RX_TAG, RAT_MOUSE_RY_TAG, + RAT_MOUSE_LX_TAG, RAT_MOUSE_LY_TAG, RAT_MOUSE_BUTTONS_TAG); + analog_port_start(&m_diecom_lightgun, DIECOM_LIGHTGUN_RX_TAG, DIECOM_LIGHTGUN_RY_TAG, + DIECOM_LIGHTGUN_LX_TAG, DIECOM_LIGHTGUN_LY_TAG, DIECOM_LIGHTGUN_BUTTONS_TAG); + + /* look up miscellaneous controls */ + m_joystick_type_control = ioport(CTRL_SEL_TAG); + m_joystick_hires_control = ioport(HIRES_INTF_TAG); + + /* timers */ + m_hiresjoy_transition_timer[0] = timer_alloc(TIMER_HIRES_JOYSTICK_X); + m_hiresjoy_transition_timer[1] = timer_alloc(TIMER_HIRES_JOYSTICK_Y); + m_diecom_lightgun_timer = timer_alloc(TIMER_DIECOM_LIGHTGUN); + + /* cart base update */ + m_cococart->set_cart_base_update(cococart_base_update_delegate(FUNC(coco_state::update_cart_base), this)); + + /* save state support */ + save_item(NAME(m_dac_output)); + save_item(NAME(m_hiresjoy_ca)); + save_item(NAME(m_dclg_previous_bit)); + save_item(NAME(m_dclg_output_h)); + save_item(NAME(m_dclg_output_v)); + save_item(NAME(m_dclg_state)); + save_item(NAME(m_dclg_timer)); + save_item(NAME(m_vhd_select)); + + /* set up disassembly override */ + if (m_maincpu->debug()) + { + m_maincpu->debug()->set_dasm_override(dasm_override); + } + + // miscellaneous + m_in_floating_bus_read = false; +} + + + +//------------------------------------------------- +// device_reset +//------------------------------------------------- + +void coco_state::device_reset() +{ + /* call base device_start */ + driver_device::device_reset(); + + /* reset state */ + m_dac_output = 0; + m_analog_audio_level = 0; + m_hiresjoy_ca = false; + m_dclg_previous_bit = false; + m_dclg_output_h = 0; + m_dclg_output_v = 0; + m_dclg_state = 0; + m_dclg_timer = 0; + m_vhd_select = 0; +} + + + +//------------------------------------------------- +// device_timer +//------------------------------------------------- + +void coco_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_HIRES_JOYSTICK_X: + case TIMER_HIRES_JOYSTICK_Y: + case TIMER_DIECOM_LIGHTGUN: + poll_keyboard(); + break; + } +} + + + +//------------------------------------------------- +// floating_bus_read +//------------------------------------------------- +// +// From Darren A on the CoCo list: +// +// Whenever you read from an un-mapped hardware address or from an +// address where some of the bits are undefined (like the GIME's palette +// and MMU registers), the value obtained for those undefined bits is +// predictable on the CoCo. +// +// There are two possibilites which depend on the addressing mode you use +// to read from such an address. If you use the "no-offset" indexed mode +// (as in LDA ,X) the undefined bits will come from the first byte of the +// next instruction. For any other addressing mode, the undefined bits +// will come from the byte at $FFFF (LSB of the Reset vector). +// +// When you use BASIC's PEEK command to read from an un-mapped address +// (such as $FF70), you get a value of 126. This is because PEEK reads +// the address with a LDA ,X instruction, so the value returned is the +// opcode of the next instruction (JMP Extended = $7E = 126). If you +// patch the PEEK command to use a 5-bit offset (LDA 0,X), the value +// returned for an un-mapped address will instead come from $FFFF (27 on +// a CoCo 3 or 39 on a CoCo 1/2). +// +// The reason for this behavior is that the 6809 normally does a VMA +// cycle just before reading the instruction's effective address. The +// exception is the "no-offset" indexed mode in which case the next +// instruction byte is read just prior to the effective address. During +// a VMA cycle the address bus goes to Hi Impedance and the R/W line is +// HI. This has the effect of loading the value from $FFFF onto the data +// bus. This stale data from the previous cycle supplies the value for +// the undefined bits. +// +// Here is a small routine which will demonstrate this behavior: +// +// ldx #$FF70 +// lda ,x +// ldb $FF70 +// std $400 +// rts +// +// On a CoCo 3, you should end up with the value $F61B at $400-401. On a +// CoCo 1/2 you should get $F627 instead. +//------------------------------------------------- + +UINT8 coco_state::floating_bus_read(void) +{ + UINT8 result; + + // this method calls program.read_byte() - therefore we run the risk of a stack overflow if we don't check for + // a reentrant invocation + if (m_in_floating_bus_read) + { + // not sure what should really happen in this extremely degenerate scenario (the PC is probably + // in $FFxx never-never land), but I guess 0xFF is as good as anything. + result = 0xFF; + } + else + { + // prevent stack overflows + m_in_floating_bus_read = true; + + // set up the ability to read address spaces + address_space &program = m_maincpu->space(AS_PROGRAM); + + // get the previous and current PC + UINT16 prev_pc = m_maincpu->pcbase(); + UINT16 pc = m_maincpu->pc(); + + // get the byte; and skip over header bytes + UINT8 byte = program.read_byte(prev_pc); + if ((byte == 0x10) || (byte == 0x11)) + byte = program.read_byte(++prev_pc); + + // check to see if the opcode specifies the indexed addressing mode, and the secondary byte + // specifies no-offset + bool is_nooffset_indexed = (((byte & 0xF0) == 0x60) || ((byte & 0xF0) == 0xA0) || ((byte & 0xF0) == 0xE0)) + && ((program.read_byte(prev_pc + 1) & 0xBF) == 0x84); + + // finally read the byte + result = program.read_byte(is_nooffset_indexed ? pc : 0xFFFF); + + // we're done reading + m_in_floating_bus_read = false; + } + return result; +} + + + +/*************************************************************************** + PIA0 ($FF00-$FF1F) (Chip U8) + + PIA0 PA0-PA7 - Keyboard/Joystick read + PIA0 PB0-PB7 - Keyboard write + PIA0 CA1 - MC6847 HS (Horizontal Sync) + PIA0 CA2 - SEL1 (Used by sound mux and joystick) + PIA0 CB1 - MC6847 FS (Field Sync) + PIA0 CB2 - SEL2 (Used by sound mux and joystick) +***************************************************************************/ + +//------------------------------------------------- +// ff00_write +//------------------------------------------------- + +READ8_MEMBER( coco_state::ff00_read ) +{ + return m_pia_0->read(space, offset, mem_mask); +} + + + +//------------------------------------------------- +// ff00_write +//------------------------------------------------- + +WRITE8_MEMBER( coco_state::ff00_write ) +{ + m_pia_0->write(space, offset, data, mem_mask); +} + + + +//------------------------------------------------- +// pia0_pa_w +//------------------------------------------------- + +WRITE8_MEMBER( coco_state::pia0_pa_w ) +{ + poll_keyboard(); +} + + + +//------------------------------------------------- +// pia0_pb_w +//------------------------------------------------- + +WRITE8_MEMBER( coco_state::pia0_pb_w ) +{ + poll_keyboard(); +} + + + +//------------------------------------------------- +// pia0_ca2_w +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco_state::pia0_ca2_w ) +{ + update_sound(); // analog mux SEL1 is tied to PIA0 CA2 + poll_keyboard(); +} + + + +//------------------------------------------------- +// pia0_cb2_w +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco_state::pia0_cb2_w ) +{ + update_sound(); // analog mux SEL2 is tied to PIA0 CB2 + poll_keyboard(); +} + + + +//------------------------------------------------- +// pia0_irq_a +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco_state::pia0_irq_a ) +{ + recalculate_irq(); +} + + + +//------------------------------------------------- +// pia0_irq_b +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco_state::pia0_irq_b ) +{ + recalculate_irq(); +} + + + +/*************************************************************************** + PIA1 ($FF20-$FF3F) (Chip U4) + + PIA1 PA0 - CASSDIN + PIA1 PA1 - RS232 OUT (CoCo), Printer Strobe (Dragon) + PIA1 PA2-PA7 - DAC + PIA1 PB0 - RS232 IN + PIA1 PB1 - Single bit sound + PIA1 PB2 - RAMSZ (32/64K, 16K, and 4K three position switch) + PIA1 PB3 - M6847 CSS + PIA1 PB4 - M6847 INT/EXT and M6847 GM0 + PIA1 PB5 - M6847 GM1 + PIA1 PB6 - M6847 GM2 + PIA1 PB7 - M6847 A/G + PIA1 CA1 - CD (Carrier Detect; NYI) + PIA1 CA2 - CASSMOT (Cassette Motor) + PIA1 CB1 - CART (Cartridge Detect) + PIA1 CB2 - SNDEN (Sound Enable) +***************************************************************************/ + +//------------------------------------------------- +// ff20_read +//------------------------------------------------- + +READ8_MEMBER( coco_state::ff20_read ) +{ + return m_pia_1->read(space, offset, mem_mask); +} + + + +//------------------------------------------------- +// ff20_write +//------------------------------------------------- + +WRITE8_MEMBER( coco_state::ff20_write ) +{ + /* write to the PIA */ + m_pia_1->write(space, offset, data, mem_mask); + + /* we have to do this to do something that approximates the cartridge Q line behavior */ + m_cococart->twiddle_q_lines(); +} + + + +//------------------------------------------------- +// pia1_pa_r +//------------------------------------------------- + +READ8_MEMBER( coco_state::pia1_pa_r ) +{ + // Port A: we need to specify the values of all the lines, regardless of whether + // they are in input or output mode in the DDR + return (m_cassette->input() >= 0 ? 0x01 : 0x00) + | (dac_output() << 2); +} + + + +//------------------------------------------------- +// pia1_pb_r - this handles the reading of the +// memory sense switch (PB2) for the CoCo 1 and +// serial-in (PB0) +//------------------------------------------------- + +READ8_MEMBER( coco_state::pia1_pb_r ) +{ + // Port B: lines in output mode are handled automatically by the PIA object. + // We only need to specify the input lines here + UINT32 ram_size = m_ram->size(); + + // For the CoCo 1, the logic has been changed to only select 64K rams + // if there is more than 16K of memory, as the Color Basic 1.0 rom + // can only configure 4K or 16K ram banks (as documented in "Color + // Basic Unreveled"), doing this allows this allows the coco driver + // to access 32K of ram, and also allows the cocoe driver to access + // the full 64K, as this uses Color Basic 1.2, which can configure 64K rams + bool memory_sense = (ram_size >= 0x4000 && ram_size <= 0x7FFF) + || (ram_size >= 0x8000 && (m_pia_0->b_output() & 0x40)); + + // serial in (PB0) + bool serial_in = (m_rs232 != NULL) && (m_rs232->rxd_r() ? true : false); + + // composite the results + return (memory_sense ? 0x04 : 0x00) + | (serial_in ? 0x01 : 0x00); +} + + + +//------------------------------------------------- +// pia1_pa_w +//------------------------------------------------- + +WRITE8_MEMBER( coco_state::pia1_pa_w ) +{ + pia1_pa_changed(data); +} + + + +//------------------------------------------------- +// pia1_pb_w +//------------------------------------------------- + +WRITE8_MEMBER( coco_state::pia1_pb_w ) +{ + pia1_pb_changed(data); +} + + + +//------------------------------------------------- +// pia1_ca2_w +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco_state::pia1_ca2_w ) +{ + m_cassette->change_state( + state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, + CASSETTE_MASK_MOTOR); +} + + + +//------------------------------------------------- +// pia1_cb2_w +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco_state::pia1_cb2_w ) +{ + update_sound(); // SOUND_ENABLE is connected to PIA1 CB2 +} + + + +//------------------------------------------------- +// pia1_firq_a +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco_state::pia1_firq_a ) +{ + recalculate_firq(); +} + + + +//------------------------------------------------- +// pia1_firq_b +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco_state::pia1_firq_b ) +{ + recalculate_firq(); +} + + + +/*************************************************************************** + CPU INTERRUPTS + + The Dragon/CoCo2 have two PIAs. These PIAs can trigger interrupts. PIA0 + is set up to trigger IRQ on the CPU, and PIA1 can trigger FIRQ. Each PIA + has two output lines, and an interrupt will be triggered if either of these + lines are asserted. + + ----- IRQ + 6809 |-<----------- PIA0 + | + | + | + | + | + |-<----------- PIA1 + ----- + +***************************************************************************/ + +//------------------------------------------------- +// irq_get_line - gets the value of the FIRQ line +// passed into the CPU +//------------------------------------------------- + +bool coco_state::irq_get_line(void) +{ + return m_pia_0->irq_a_state() || m_pia_0->irq_b_state(); +} + + + +//------------------------------------------------- +// recalculate_irq +//------------------------------------------------- + +void coco_state::recalculate_irq(void) +{ + bool line = irq_get_line(); + if (LOG_INTERRUPTS) + logerror("recalculate_irq(): line=%d\n", line ? 1 : 0); + m_maincpu->set_input_line(M6809_IRQ_LINE, line ? ASSERT_LINE : CLEAR_LINE); +} + + + +//------------------------------------------------- +// firq_get_line - gets the value of the FIRQ line +// passed into the CPU +//------------------------------------------------- + +bool coco_state::firq_get_line(void) +{ + return m_pia_1->irq_a_state() || m_pia_1->irq_b_state(); +} + + + +//------------------------------------------------- +// recalculate_firq +//------------------------------------------------- + +void coco_state::recalculate_firq(void) +{ + bool line = firq_get_line(); + if (LOG_INTERRUPTS) + logerror("recalculate_firq(): line=%d\n", line ? 1 : 0); + m_maincpu->set_input_line(M6809_FIRQ_LINE, line ? ASSERT_LINE : CLEAR_LINE); +} + + + +/*************************************************************************** + SOUND / KEYBOARD / JOYSTICK + + The sound MUX has 4 possible settings, depend on SELA and SELB inputs: + + 00 - DAC (digital - analog converter) + 01 - CSN (cassette) + 10 - SND input from cartridge (NYI because we only support the FDC) + 11 - Grounded (0) + + Source - Tandy Color Computer Service Manual + + Note on the Dragon Alpha state 11, selects the AY-3-8912, this is currently + un-implemented - phs. + +***************************************************************************/ + +//------------------------------------------------- +// soundmux_status +//------------------------------------------------- + +coco_state::soundmux_status_t coco_state::soundmux_status(void) +{ + return (soundmux_status_t) ( + (snden() ? SOUNDMUX_ENABLE : 0) | + (sel1() ? SOUNDMUX_SEL1 : 0) | + (sel2() ? SOUNDMUX_SEL2 : 0)); +} + + + +//------------------------------------------------- +// update_sound +//------------------------------------------------- + +void coco_state::update_sound(void) +{ + /* PB1 will drive the sound output. This is a rarely + * used single bit sound mode. It is always connected thus + * cannot be disabled. + * + * Source: Page 31 of the Tandy Color Computer Serice Manual + */ + UINT8 single_bit_sound = (m_pia_1->b_output() & 0x02) ? 0x80 : 0x00; + + /* determine the sound mux status */ + soundmux_status_t status = soundmux_status(); + + /* the SC77526 DAC chip internally biases the AC-coupled sound inputs for Cassette and Cartridge at the midpoint of the 3.9v output range */ + bool bCassSoundEnable = (status == (SOUNDMUX_ENABLE | SOUNDMUX_SEL1)); + bool bCartSoundEnable = (status == (SOUNDMUX_ENABLE | SOUNDMUX_SEL2)); + UINT8 cassette_sound = (bCassSoundEnable ? 0x40 : 0); + UINT8 cart_sound = (bCartSoundEnable ? 0x40 : 0); + + /* determine the value to send to the DAC (this is used by the Joystick read as well as audio out) */ + m_dac_output = (m_pia_1->a_output() & 0xFC) >> 2; + UINT8 dac_sound = (status == SOUNDMUX_ENABLE ? m_dac_output << 1 : 0); + + /* The CoCo uses a single DAC for both audio output and joystick axis position measurement. + * To avoid introducing artifacts while reading the axis positions, some software will disable + * the audio output while using the DAC to read the joystick. On a real CoCo, there is a low-pass + * filter (C57 on the CoCo 3) which will hold the audio level for very short periods of time, + * preventing the introduction of artifacts while the joystick value is being read. We are not going + * to simulate the exponential decay of a capacitor here. Instead, we will store and hold the last + * used analog audio output value while the audio is disabled, to avoid introducing artifacts in + * software such as Tandy's Popcorn and Sock Master's Donkey Kong. + */ + if ((status & SOUNDMUX_ENABLE) != 0) + { + m_analog_audio_level = dac_sound + cassette_sound + cart_sound; + } + + m_dac->write_unsigned8(single_bit_sound + m_analog_audio_level); + + /* determine the cassette sound status */ + cassette_state cas_sound = bCassSoundEnable ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED; + m_cassette->change_state(cas_sound, CASSETTE_MASK_SPEAKER); + + /* determine the cartridge sound status */ + m_cococart->cart_set_line(COCOCART_LINE_SOUND_ENABLE, bCartSoundEnable ? COCOCART_LINE_VALUE_ASSERT : COCOCART_LINE_VALUE_CLEAR); +} + + + +//------------------------------------------------- +// joystick_type - returns the type of joystick +// in the specified port +//------------------------------------------------- + +coco_state::joystick_type_t coco_state::joystick_type(int index) +{ + assert((index == 0) || (index == 1)); + return (m_joystick_type_control != NULL) + ? (joystick_type_t) ((m_joystick_type_control->read() >> (index * 4)) & 0x0F) + : JOYSTICK_NONE; +} + + + +//------------------------------------------------- +// hires_interface_type +//------------------------------------------------- + +coco_state::hires_type_t coco_state::hires_interface_type(void) +{ + return (m_joystick_hires_control != NULL) + ? (hires_type_t) m_joystick_hires_control->read() + : HIRES_NONE; +} + + + +//------------------------------------------------- +// is_joystick_hires +//------------------------------------------------- + +bool coco_state::is_joystick_hires(int joystick_index) +{ + bool result; + assert((joystick_index == 0) || (joystick_index == 1)); + + switch(hires_interface_type()) + { + case HIRES_RIGHT: + case HIRES_RIGHT_COCOMAX3: + result = (joystick_index == 0); + break; + + case HIRES_LEFT: + case HIRES_LEFT_COCOMAX3: + result = (joystick_index == 1); + break; + + default: + result = false; + break; + } + return result; +} + + + +//------------------------------------------------- +// poll_joystick +//------------------------------------------------- + +void coco_state::poll_joystick(bool *joyin, UINT8 *buttons) +{ + static const analog_input_t s_empty = {}; + static const int joy_rat_table[] = {15, 24, 42, 33 }; + static const int dclg_table[] = {0, 14, 30, 49 }; + + /* identify the joystick and axis */ + int joystick_axis = sel1() ? 1 : 0; + int joystick = sel2() ? 1 : 0; + + /* determine the JOYIN value */ + const analog_input_t *analog; + bool joyin_value; + UINT8 joyval; + int dclg_vpos; + switch(joystick_type(joystick)) + { + case JOYSTICK_NORMAL: + analog = &m_joystick; + + /* is any Hi-Res Interface turned on? prepare masks to check it */ + if (is_joystick_hires(joystick)) + { + /* hi-res joystick or hi-res CoCo3Max joystick */ + attotime remaining = m_hiresjoy_transition_timer[joystick_axis]->remaining(); + joyin_value = remaining.is_zero() || remaining.is_never(); + } + else + { + /* conventional joystick */ + joyval = analog->input(joystick, joystick_axis); + joyin_value = (dac_output() <= (joyval >> 2)); + } + break; + + case JOYSTICK_RAT_MOUSE: + analog = &m_rat_mouse; + joyval = analog->input(joystick, joystick_axis); + joyin_value = dac_output() <= joy_rat_table[joyval]; + break; + + case JOYSTICK_DIECOM_LIGHT_GUN: + analog = &m_diecom_lightgun; + + /* get the vertical position of the lightgun */ + dclg_vpos = analog->input(joystick, 1); + + if (machine().first_screen()->vpos() == dclg_vpos) + { + /* if gun is pointing at the current scan line, set hit bit and cache horizontal timer value */ + m_dclg_output_h |= 0x02; + m_dclg_timer = analog->input(joystick, 0) << 1; + } + + joyin_value = (dac_output() <= dclg_table[(joystick_axis ? m_dclg_output_h : m_dclg_output_v) & 0x03]); + + if (m_dclg_state == 7) + { + /* while in state 7, prepare to check next video frame for a hit */ + attotime dclg_time = machine().first_screen()->time_until_pos(dclg_vpos, 0); + m_diecom_lightgun_timer->adjust(dclg_time); + } + break; + + default: /* None */ + analog = &s_empty; + joyin_value = false; + break; + } + + *joyin = joyin_value; + *buttons = analog->buttons(); +} + + + +//------------------------------------------------- +// poll_keyboard +//------------------------------------------------- + +void coco_state::poll_keyboard(void) +{ + UINT8 pia0_pb = m_pia_0->b_output(); + UINT8 pia0_pb_z = m_pia_0->port_b_z_mask(); + + UINT8 pia0_pa = 0x7F; + UINT8 pia0_pa_z = 0x7F; + + /* poll the keyboard, and update PA6-PA0 accordingly*/ + for (int i = 0; i < ARRAY_LENGTH(m_keyboard); i++) + { + int value = m_keyboard[i]->read(); + if ((value | pia0_pb) != 0xFF) + { + pia0_pa &= ~(0x01 << i); + } + if ((value | pia0_pb_z) != 0xFF) + { + pia0_pa_z &= ~(0x01 << i); + } + } + + /* hires joystick */ + poll_hires_joystick(); + + /* poll the joystick (*/ + bool joyin; + UINT8 buttons; + poll_joystick(&joyin, &buttons); + + /* PA7 comes from JOYIN */ + pia0_pa |= joyin ? 0x80 : 0x00; + + /* mask out the buttons */ + pia0_pa &= ~buttons; + pia0_pa_z &= ~buttons; + + /* and write the result to PIA0 */ + update_keyboard_input(pia0_pa, pia0_pa_z); +} + + + +//------------------------------------------------- +// update_keyboard_input - writes to PIA0 PA, but +// on the CoCo 3 controls a GIME input +//------------------------------------------------- + +void coco_state::update_keyboard_input(UINT8 value, UINT8 z) +{ + m_pia_0->set_a_input(value, z); +} + + + +//------------------------------------------------- +// update_cassout - called when CASSOUT changes +//------------------------------------------------- + +void coco_state::update_cassout(int cassout) +{ + m_cassette->output((cassout - 0x20) / 32.0); +} + + + +//------------------------------------------------- +// diecom_lightgun_clock - called the diecom +// lightgun undergoes a high to low transition +//------------------------------------------------- + +void coco_state::diecom_lightgun_clock(void) +{ + /* clock Diecom Light gun interface on a high to low transistion */ + m_dclg_state++; + m_dclg_state &= 0x0f; + + /* clear hit bit for every transistion */ + m_dclg_output_h &= ~0x02; + + if (m_dclg_state > 7) + { + /* Bit shift timer data on state 8 thru 15 */ + if (((m_dclg_timer >> (m_dclg_state - 8 + 1)) & 0x01) == 1) + m_dclg_output_v |= 0x01; + else + m_dclg_output_v &= ~0x01; + + /* Bit 9 of timer is only avaiable if state == 8*/ + if (m_dclg_state == 8 && (((m_dclg_timer >> 9) & 0x01) == 1)) + m_dclg_output_v |= 0x02; + else + m_dclg_output_v &= ~0x02; + } + + /* During state 15, this bit is high. */ + if (m_dclg_state == 15) + m_dclg_output_h |= 0x01; + else + m_dclg_output_h &= ~0x01; +} + + + +//------------------------------------------------- +// update_prinout - called when PRINOUT changes +//------------------------------------------------- + +void coco_state::update_prinout(bool prinout) +{ + if ((joystick_type(0) == JOYSTICK_DIECOM_LIGHT_GUN) || (joystick_type(1) == JOYSTICK_DIECOM_LIGHT_GUN)) + { + /* printer port is connected to diecom light gun */ + if (m_dclg_previous_bit && !prinout) + { + diecom_lightgun_clock(); + } + m_dclg_previous_bit = prinout; + } + else + { + /* output bitbanger if present (only on CoCos) */ + if (m_rs232 != NULL) + { + m_rs232->write_txd(prinout ? 1 : 0); + } + } +} + + + +//------------------------------------------------- +// pia1_pa_changed - called when PIA1 PA changes +//------------------------------------------------- + +void coco_state::pia1_pa_changed(UINT8 data) +{ + update_sound(); // DAC is connected to PIA1 PA2-PA7 + poll_keyboard(); + update_cassout(dac_output()); + update_prinout(data & 0x02 ? true : false); +} + + + +//------------------------------------------------- +// pia1_pb_changed - called when PIA1 PB changes +//------------------------------------------------- + +void coco_state::pia1_pb_changed(UINT8 data) +{ + update_sound(); // singe_bit_sound is connected to PIA1 PB1 +} + + + +//------------------------------------------------- +// keyboard_changed +//------------------------------------------------- + +INPUT_CHANGED_MEMBER(coco_state::keyboard_changed) +{ + poll_keyboard(); +} + + + +//------------------------------------------------- +// joystick_mode_changed +//------------------------------------------------- + +INPUT_CHANGED_MEMBER(coco_state::joystick_mode_changed) +{ + poll_keyboard(); +} + +//------------------------------------------------- +// poll_hires_joystick +//------------------------------------------------- + +void coco_state::poll_hires_joystick(void) +{ + bool newvalue; + bool is_cocomax3; + int joystick_index, axis; + + /* we do different things based on the type of hires interface */ + switch(hires_interface_type()) + { + case HIRES_RIGHT: + newvalue = (dac_output() >= 0x20); + joystick_index = 0; + is_cocomax3 = false; + break; + + case HIRES_RIGHT_COCOMAX3: + newvalue = (m_pia_0->a_output() & 0x04); + joystick_index = 0; + is_cocomax3 = true; + break; + + case HIRES_LEFT: + newvalue = (dac_output() >= 0x20); + joystick_index = 1; + is_cocomax3 = false; + break; + + case HIRES_LEFT_COCOMAX3: + newvalue = (m_pia_0->a_output() & 0x08); + joystick_index = 1; + is_cocomax3 = true; + break; + + default: + newvalue = true; + joystick_index = -1; + is_cocomax3 = false; + break; + } + + /* if the joystick isn't selected, newvalue is true */ + newvalue = newvalue || (joystick_index < 0) || (joystick_type(joystick_index) != JOYSTICK_NORMAL); + + /* make the transition */ + for (axis = 0; axis <= 1; axis++) + { + if (m_hiresjoy_ca && !newvalue) + { + /* hi to lo */ + double value = m_joystick.input(joystick_index, axis) / 255.0; + value *= is_cocomax3 ? 2500.0 : 4160.0; + value += is_cocomax3 ? 400.0 : 592.0; + attotime duration = m_maincpu->clocks_to_attotime((UINT64) value) * 8; + m_hiresjoy_transition_timer[axis]->adjust(duration); + } + else if (!m_hiresjoy_ca && newvalue) + { + /* lo to hi */ + m_hiresjoy_transition_timer[axis]->reset(); + } + } + m_hiresjoy_ca = newvalue; +} + + + +/*************************************************************************** + VHD + ***************************************************************************/ + +//------------------------------------------------- +// current_vhd +//------------------------------------------------- + +coco_vhd_image_device *coco_state::current_vhd(void) +{ + switch(m_vhd_select) + { + case 0: return m_vhd_0; + case 1: return m_vhd_1; + default: return NULL; + } +} + + + +//------------------------------------------------- +// ff60_read +//------------------------------------------------- + +READ8_MEMBER( coco_state::ff60_read ) +{ + UINT8 result; + + if ((current_vhd() != NULL) && (offset >= 32) && (offset <= 37)) + { + result = current_vhd()->read(offset - 32); + } + else + { + result = floating_bus_read(); + } + + return result; +} + + + +//------------------------------------------------- +// ff60_write +//------------------------------------------------- + +WRITE8_MEMBER( coco_state::ff60_write ) +{ + if ((current_vhd() != NULL) && (offset >= 32) && (offset <= 37)) + { + current_vhd()->write(offset - 32, data); + } + else if (offset == 38) + { + /* writes to $FF86 will switch the VHD */ + m_vhd_select = data; + } +} + + + +/*************************************************************************** + CARTRIDGE & CASSETTE + ***************************************************************************/ + +//------------------------------------------------- +// ff40_read +//------------------------------------------------- + +READ8_MEMBER( coco_state::ff40_read ) +{ + if (offset >= 1 && offset <= 2 && m_beckerportconfig && m_beckerportconfig->read() == 1) + { + return m_beckerport->read(space, offset-1, mem_mask); + } + + return m_cococart->read(space, offset, mem_mask); +} + + + +//------------------------------------------------- +// ff40_write +//------------------------------------------------- + +WRITE8_MEMBER( coco_state::ff40_write ) +{ + if (offset >= 1 && offset <= 2 && m_beckerportconfig && m_beckerportconfig->read() == 1) + { + return m_beckerport->write(space, offset-1, data, mem_mask); + } + + m_cococart->write(space, offset, data, mem_mask); +} + + + +//------------------------------------------------- +// cart_w +//------------------------------------------------- + +void coco_state::cart_w(bool state) +{ + m_pia_1->cb1_w(state); +} + +/*************************************************************************** + DISASSEMBLY OVERRIDE (OS9 syscalls) + ***************************************************************************/ + +static const char *const os9syscalls[] = +{ + "F$Link", /* Link to Module */ + "F$Load", /* Load Module from File */ + "F$UnLink", /* Unlink Module */ + "F$Fork", /* Start New Process */ + "F$Wait", /* Wait for Child Process to Die */ + "F$Chain", /* Chain Process to New Module */ + "F$Exit", /* Terminate Process */ + "F$Mem", /* Set Memory Size */ + "F$Send", /* Send Signal to Process */ + "F$Icpt", /* Set Signal Intercept */ + "F$Sleep", /* Suspend Process */ + "F$SSpd", /* Suspend Process */ + "F$ID", /* Return Process ID */ + "F$SPrior", /* Set Process Priority */ + "F$SSWI", /* Set Software Interrupt */ + "F$PErr", /* Print Error */ + "F$PrsNam", /* Parse Pathlist Name */ + "F$CmpNam", /* Compare Two Names */ + "F$SchBit", /* Search Bit Map */ + "F$AllBit", /* Allocate in Bit Map */ + "F$DelBit", /* Deallocate in Bit Map */ + "F$Time", /* Get Current Time */ + "F$STime", /* Set Current Time */ + "F$CRC", /* Generate CRC */ + "F$GPrDsc", /* get Process Descriptor copy */ + "F$GBlkMp", /* get System Block Map copy */ + "F$GModDr", /* get Module Directory copy */ + "F$CpyMem", /* Copy External Memory */ + "F$SUser", /* Set User ID number */ + "F$UnLoad", /* Unlink Module by name */ + "F$Alarm", /* Color Computer Alarm Call (system wide) */ + NULL, + NULL, + "F$NMLink", /* Color Computer NonMapping Link */ + "F$NMLoad", /* Color Computer NonMapping Load */ + NULL, + NULL, + "F$TPS", /* Return System's Ticks Per Second */ + "F$TimAlm", /* COCO individual process alarm call */ + "F$VIRQ", /* Install/Delete Virtual IRQ */ + "F$SRqMem", /* System Memory Request */ + "F$SRtMem", /* System Memory Return */ + "F$IRQ", /* Enter IRQ Polling Table */ + "F$IOQu", /* Enter I/O Queue */ + "F$AProc", /* Enter Active Process Queue */ + "F$NProc", /* Start Next Process */ + "F$VModul", /* Validate Module */ + "F$Find64", /* Find Process/Path Descriptor */ + "F$All64", /* Allocate Process/Path Descriptor */ + "F$Ret64", /* Return Process/Path Descriptor */ + "F$SSvc", /* Service Request Table Initialization */ + "F$IODel", /* Delete I/O Module */ + "F$SLink", /* System Link */ + "F$Boot", /* Bootstrap System */ + "F$BtMem", /* Bootstrap Memory Request */ + "F$GProcP", /* Get Process ptr */ + "F$Move", /* Move Data (low bound first) */ + "F$AllRAM", /* Allocate RAM blocks */ + "F$AllImg", /* Allocate Image RAM blocks */ + "F$DelImg", /* Deallocate Image RAM blocks */ + "F$SetImg", /* Set Process DAT Image */ + "F$FreeLB", /* Get Free Low Block */ + "F$FreeHB", /* Get Free High Block */ + "F$AllTsk", /* Allocate Process Task number */ + "F$DelTsk", /* Deallocate Process Task number */ + "F$SetTsk", /* Set Process Task DAT registers */ + "F$ResTsk", /* Reserve Task number */ + "F$RelTsk", /* Release Task number */ + "F$DATLog", /* Convert DAT Block/Offset to Logical */ + "F$DATTmp", /* Make temporary DAT image (Obsolete) */ + "F$LDAXY", /* Load A [X,[Y]] */ + "F$LDAXYP", /* Load A [X+,[Y]] */ + "F$LDDDXY", /* Load D [D+X,[Y]] */ + "F$LDABX", /* Load A from 0,X in task B */ + "F$STABX", /* Store A at 0,X in task B */ + "F$AllPrc", /* Allocate Process Descriptor */ + "F$DelPrc", /* Deallocate Process Descriptor */ + "F$ELink", /* Link using Module Directory Entry */ + "F$FModul", /* Find Module Directory Entry */ + "F$MapBlk", /* Map Specific Block */ + "F$ClrBlk", /* Clear Specific Block */ + "F$DelRAM", /* Deallocate RAM blocks */ + "F$GCMDir", /* Pack module directory */ + "F$AlHRam", /* Allocate HIGH RAM Blocks */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "F$RegDmp", /* Ron Lammardo's debugging register dump call */ + "F$NVRAM", /* Non Volatile RAM (RTC battery backed static) read/write */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "I$Attach", /* Attach I/O Device */ + "I$Detach", /* Detach I/O Device */ + "I$Dup", /* Duplicate Path */ + "I$Create", /* Create New File */ + "I$Open", /* Open Existing File */ + "I$MakDir", /* Make Directory File */ + "I$ChgDir", /* Change Default Directory */ + "I$Delete", /* Delete File */ + "I$Seek", /* Change Current Position */ + "I$Read", /* Read Data */ + "I$Write", /* Write Data */ + "I$ReadLn", /* Read Line of ASCII Data */ + "I$WritLn", /* Write Line of ASCII Data */ + "I$GetStt", /* Get Path Status */ + "I$SetStt", /* Set Path Status */ + "I$Close", /* Close Path */ + "I$DeletX" /* Delete from current exec dir */ +}; + + +offs_t coco_state::dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) +{ + unsigned call; + unsigned result = 0; + + /* check for SWI2 instruction */ + if ((oprom[0] == 0x10) && (oprom[1] == 0x3F)) + { + call = oprom[2]; + if ((call < ARRAY_LENGTH(os9syscalls)) && os9syscalls[call]) + { + sprintf(buffer, "OS9 %s", os9syscalls[call]); + result = 3; + } + } + return result; +} diff --git a/src/mame/machine/coco12.c b/src/mame/machine/coco12.c new file mode 100644 index 00000000000..e2f3fbdb521 --- /dev/null +++ b/src/mame/machine/coco12.c @@ -0,0 +1,119 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco12.c + + TRS-80 Radio Shack Color Computer 1/2 Family + +***************************************************************************/ + +#include "includes/coco12.h" + +//------------------------------------------------- +// device_start +//------------------------------------------------- + +void coco12_state::device_start() +{ + coco_state::device_start(); + configure_sam(); +} + + + +//------------------------------------------------- +// configure_sam +//------------------------------------------------- + +void coco12_state::configure_sam() +{ + cococart_slot_device *cart = m_cococart; + UINT8 *ram = m_ram->pointer(); + UINT32 ram_size = m_ram->size(); + UINT8 *rom = memregion(MAINCPU_TAG)->base(); + UINT8 *cart_rom = cart->get_cart_base(); + + m_sam->configure_bank(0, ram, ram_size, false); // $0000-$7FFF + m_sam->configure_bank(1, &rom[0x0000], 0x2000, true); // $8000-$9FFF + m_sam->configure_bank(2, &rom[0x2000], 0x2000, true); // $A000-$BFFF + m_sam->configure_bank(3, cart_rom, 0x4000, true); // $C000-$FEFF + + // $FF00-$FF1F + m_sam->configure_bank(4, read8_delegate(FUNC(coco12_state::ff00_read), this), write8_delegate(FUNC(coco12_state::ff00_write), this)); + + // $FF20-$FF3F + m_sam->configure_bank(5, read8_delegate(FUNC(coco12_state::ff20_read), this), write8_delegate(FUNC(coco12_state::ff20_write), this)); + + // $FF40-$FF5F + m_sam->configure_bank(6, read8_delegate(FUNC(coco12_state::ff40_read), this), write8_delegate(FUNC(coco12_state::ff40_write), this)); + + // $FF60-$FFBF + m_sam->configure_bank(7, read8_delegate(FUNC(coco12_state::ff60_read), this), write8_delegate(FUNC(coco12_state::ff60_write), this)); +} + + +//------------------------------------------------- +// horizontal_sync +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco12_state::horizontal_sync ) +{ + m_pia_0->ca1_w(state); + m_sam->hs_w(state); +} + + + +//------------------------------------------------- +// field_sync +//------------------------------------------------- + +WRITE_LINE_MEMBER( coco12_state::field_sync ) +{ + m_pia_0->cb1_w(state); +} + + + +//------------------------------------------------- +// sam_read +//------------------------------------------------- + +READ8_MEMBER( coco12_state::sam_read ) +{ + UINT8 data = m_ram->read(offset); + m_vdg->as_w(data & 0x80 ? ASSERT_LINE : CLEAR_LINE); + m_vdg->inv_w(data & 0x40 ? ASSERT_LINE : CLEAR_LINE); + return data; +} + + + +//------------------------------------------------- +// pia1_pb_changed +//------------------------------------------------- + +void coco12_state::pia1_pb_changed(UINT8 data) +{ + /* call inherited function */ + coco_state::pia1_pb_changed(data); + + m_vdg->css_w(data & 0x08); + m_vdg->intext_w(data & 0x10); + m_vdg->gm0_w(data & 0x10); + m_vdg->gm1_w(data & 0x20); + m_vdg->gm2_w(data & 0x40); + m_vdg->ag_w(data & 0x80); +} + + + +//------------------------------------------------- +// update_cart_base +//------------------------------------------------- + +void coco12_state::update_cart_base(UINT8 *cart_base) +{ + m_sam->configure_bank(3, cart_base, 0x4000, true); // $C000-$FEFF +} diff --git a/src/mame/machine/coco3.c b/src/mame/machine/coco3.c new file mode 100644 index 00000000000..40624853dec --- /dev/null +++ b/src/mame/machine/coco3.c @@ -0,0 +1,167 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco3.c + + TRS-80 Radio Shack Color Computer 3 + + Functions to emulate general aspects of the machine (RAM, ROM, interrupts, + I/O ports) + + The Dragon/CoCo2 have two PIAs. These PIAs can trigger interrupts. PIA0 + is set up to trigger IRQ on the CPU, and PIA1 can trigger FIRQ. Each PIA + has two output lines, and an interrupt will be triggered if either of these + lines are asserted. + + ----- IRQ + 6809 |-<----------- PIA0 + | + | + | + | + | + |-<----------- PIA1 + ----- + + The CoCo 3 still supports these interrupts, but the GIME can chose whether + "old school" interrupts are generated, or the new ones generated by the GIME + + ----- IRQ + 6809 |-<----------- PIA0 + | | ------ + | -<-------<-------| | + | |GIME| + | -<-------<-------| | + | FIRQ | ------ + |-<----------- PIA1 + ----- + + In an email discussion with JK, he informs me that when GIME interrupts are + enabled, this actually does not prevent PIA interrupts. Apparently JeffV's + CoCo 3 emulator did not handle this properly. + +***************************************************************************/ + +#include "includes/coco3.h" + +//------------------------------------------------- +// ff20_write +//------------------------------------------------- + +WRITE8_MEMBER( coco3_state::ff20_write ) +{ + coco_state::ff20_write(space, offset, data, mem_mask); + + if (offset == 0x02) + m_gime->ff22_write(data); +} + + + +//------------------------------------------------- +// ff40_read +//------------------------------------------------- + +READ8_MEMBER( coco3_state::ff40_read ) +{ + UINT8 result = 0x00; + if (m_gime->spare_chip_select_enabled()) + result = coco_state::ff40_read(space, offset, mem_mask); + return result; +} + + + +//------------------------------------------------- +// ff40_write +//------------------------------------------------- + +WRITE8_MEMBER( coco3_state::ff40_write ) +{ + if (m_gime->spare_chip_select_enabled()) + coco_state::ff40_write(space, offset, data, mem_mask); +} + + + +//------------------------------------------------- +// firq_get_line +//------------------------------------------------- + +bool coco3_state::firq_get_line(void) +{ + return coco_state::firq_get_line() || m_gime->firq_r(); +} + + + +//------------------------------------------------- +// irq_get_line +//------------------------------------------------- + +bool coco3_state::irq_get_line(void) +{ + return coco_state::irq_get_line() || m_gime->irq_r(); +} + + + +//------------------------------------------------- +// update_keyboard_input +//------------------------------------------------- + +void coco3_state::update_keyboard_input(UINT8 value, UINT8 z) +{ + coco_state::update_keyboard_input(value, z); + m_gime->set_il1(value == 0xFF); +} + + + +//------------------------------------------------- +// cart_w +//------------------------------------------------- + +void coco3_state::cart_w(bool state) +{ + coco_state::cart_w(state); + m_gime->set_il0(state); +} + + + +//------------------------------------------------- +// update_cart_base +//------------------------------------------------- + +void coco3_state::update_cart_base(UINT8 *cart_base) +{ + m_gime->update_cart_rom(); +} + + + +//------------------------------------------------- +// screen_update +//------------------------------------------------- + +UINT32 coco3_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bool result; + if (!strcmp(screen.tag(), ":" COMPOSITE_SCREEN_TAG)) + { + /* composite screen */ + result = m_gime->update_composite(bitmap, cliprect); + } + else if (!strcmp(screen.tag(), ":" RGB_SCREEN_TAG)) + { + /* rgb screen */ + result = m_gime->update_rgb(bitmap, cliprect); + } + else + { + fatalerror("Called screen_update() with invalid tag '%s'\n", screen.tag()); + } + return result; +} diff --git a/src/mame/machine/coco_vhd.c b/src/mame/machine/coco_vhd.c new file mode 100644 index 00000000000..0510ce469ff --- /dev/null +++ b/src/mame/machine/coco_vhd.c @@ -0,0 +1,281 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco_vhd.c + + Color Computer Virtual Hard Drives + +**************************************************************************** + + Technical specs on the Virtual Hard Disk interface + + Address Description + ------- ----------- + FF80 Logical record number (high byte) + FF81 Logical record number (middle byte) + FF82 Logical record number (low byte) + FF83 Command/status register + FF84 Buffer address (high byte) + FF85 Buffer address (low byte) + + Set the other registers, and then issue a command to FF83 as follows: + + 0 = read 256-byte sector at LRN + 1 = write 256-byte sector at LRN + 2 = flush write cache (Closes and then opens the image file) + + Error values: + + 0 = no error + -1 = power-on state (before the first command is received) + -2 = invalid command + 2 = VHD image does not exist + 4 = Unable to open VHD image file + 5 = access denied (may not be able to write to VHD image) + + IMPORTANT: The I/O buffer must NOT cross an 8K MMU bank boundary. + + ***************************************************************************/ + +#include "emu.h" +#include "coco_vhd.h" +#include "includes/coco.h" +#include "machine/ram.h" + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define VERBOSE 1 + +#define VHDSTATUS_OK 0x00 +#define VHDSTATUS_NO_VHD_ATTACHED 0x02 +#define VHDSTATUS_ACCESS_DENIED 0x05 +#define VHDSTATUS_UNKNOWN_COMMAND 0xFE +#define VHDSTATUS_POWER_ON_STATE 0xFF + +#define VHDCMD_READ 0 +#define VHDCMD_WRITE 1 +#define VHDCMD_FLUSH 2 + + +/*************************************************************************** + CORE IMPLEMENTATION +***************************************************************************/ + +const device_type COCO_VHD = &device_creator; + +//------------------------------------------------- +// coco_vhd_image_device - constructor +//------------------------------------------------- + +coco_vhd_image_device::coco_vhd_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, COCO_VHD, "Virtual Hard Disk", tag, owner, clock, "coco_vhd_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// coco_vhd_image_device - destructor +//------------------------------------------------- + +coco_vhd_image_device::~coco_vhd_image_device() +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void coco_vhd_image_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void coco_vhd_image_device::device_start() +{ + m_status = VHDSTATUS_NO_VHD_ATTACHED; + m_cpu = machine().device(MAINCPU_TAG); + m_cpu_space = &m_cpu->space(AS_PROGRAM); +} + + + +//------------------------------------------------- +// call_load +//------------------------------------------------- + +bool coco_vhd_image_device::call_load() +{ + m_status = VHDSTATUS_POWER_ON_STATE; + m_logical_record_number = 0; + m_buffer_address = 0; + return IMAGE_INIT_PASS; +} + + + +//------------------------------------------------- +// coco_vhd_readwrite +//------------------------------------------------- + +void coco_vhd_image_device::coco_vhd_readwrite(UINT8 data) +{ + int result, i; + UINT32 bytes_to_read; + UINT32 bytes_to_write; + UINT64 seek_position; + UINT64 total_size; + char buffer[1024]; + + /* access the image */ + if (!exists()) + { + m_status = VHDSTATUS_NO_VHD_ATTACHED; + return; + } + + /* perform the seek */ + seek_position = ((UINT64) 256) * m_logical_record_number; + total_size = length(); + result = fseek(MIN(seek_position, total_size), SEEK_SET); + if (result < 0) + { + m_status = VHDSTATUS_ACCESS_DENIED; + return; + } + + /* expand the disk, if necessary */ + if (data == VHDCMD_WRITE) + { + while(total_size < seek_position) + { + memset(buffer, 0, sizeof(buffer)); + + bytes_to_write = (UINT32) MIN(seek_position - total_size, (UINT64) sizeof(buffer)); + result = fwrite(buffer, bytes_to_write); + if (result != bytes_to_write) + { + m_status = VHDSTATUS_ACCESS_DENIED; + return; + } + + total_size += bytes_to_write; + } + } + + switch(data) + { + case VHDCMD_READ: /* Read sector */ + memset(buffer, 0, 256); + if (total_size > seek_position) + { + bytes_to_read = (UINT32) MIN((UINT64) 256, total_size - seek_position); + result = fread(buffer, bytes_to_read); + if (result != bytes_to_read) + { + m_status = VHDSTATUS_ACCESS_DENIED; + return; + } + } + + /* write the bytes to memory */ + for (i = 0; i < 256; i++) + m_cpu_space->write_byte(m_buffer_address + i, buffer[i]); + + m_status = VHDSTATUS_OK; + break; + + case VHDCMD_WRITE: /* Write Sector */ + /* read the bytes from memory */ + for (i = 0; i < 256; i++) + buffer[i] = m_cpu_space->read_byte(m_buffer_address + i); + + /* and write to disk */ + result = fwrite(buffer, 256); + if (result != 256) + { + m_status = VHDSTATUS_ACCESS_DENIED; + return; + } + + m_status = VHDSTATUS_OK; + break; + + case VHDCMD_FLUSH: /* Flush file cache */ + m_status = VHDSTATUS_OK; + break; + + default: + m_status = VHDSTATUS_UNKNOWN_COMMAND; + break; + } +} + + + +UINT8 coco_vhd_image_device::read(offs_t offset) +{ + UINT8 result = 0; + + switch(offset) + { + case 0xff83 - 0xff80: + if (VERBOSE) + logerror("vhd: Status read: %d\n", m_status); + result = m_status; + break; + } + return result; +} + + + +void coco_vhd_image_device::write(offs_t offset, UINT8 data) +{ + int pos; + + switch(offset) + { + case 0xff80 - 0xff80: + case 0xff81 - 0xff80: + case 0xff82 - 0xff80: + pos = ((0xff82 - 0xff80) - offset) * 8; + m_logical_record_number &= ~(0xFF << pos); + m_logical_record_number += data << pos; + if (VERBOSE) + logerror("vhd: LRN write: %6.6X\n", m_logical_record_number); + break; + + case 0xff83 - 0xff80: + coco_vhd_readwrite(data); + if (VERBOSE) + logerror("vhd: Command: %d\n", data); + break; + + case 0xff84 - 0xff80: + m_buffer_address &= 0xFFFF00FF; + m_buffer_address += data << 8; + if (VERBOSE) + logerror("vhd: BA write: %X (%2.2X..)\n", m_buffer_address, data); + break; + + case 0xff85 - 0xff80: + m_buffer_address &= 0xFFFFFF00; + m_buffer_address += data; + if (VERBOSE) + logerror("vhd: BA write: %X (..%2.2X)\n", m_buffer_address, data); + break; + } +} diff --git a/src/mame/machine/coco_vhd.h b/src/mame/machine/coco_vhd.h new file mode 100644 index 00000000000..3d4819cb8f5 --- /dev/null +++ b/src/mame/machine/coco_vhd.h @@ -0,0 +1,73 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + coco_vhd.h + + Color Computer Virtual Hard Drives + +***************************************************************************/ + +#ifndef COCOVHD_H +#define COCOVHD_H + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +// ======================> coco_vhd_image_device + +class coco_vhd_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + coco_vhd_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~coco_vhd_image_device(); + + // image-level overrides + virtual bool call_load(); + + virtual iodevice_t image_type() const { return IO_HARDDISK; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "vhd"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + // specific implementation + DECLARE_READ8_MEMBER(read) { return read(offset); } + DECLARE_WRITE8_MEMBER(write) { write(offset, data); } + UINT8 read(offs_t offset); + void write(offs_t offset, UINT8 data); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + void coco_vhd_readwrite(UINT8 data); + +private: + cpu_device * m_cpu; + address_space * m_cpu_space; + UINT32 m_logical_record_number; + UINT32 m_buffer_address; + UINT8 m_status; +}; + +// device type definition +extern const device_type COCO_VHD; + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ + +#define MCFG_COCO_VHD_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, COCO_VHD, 0) +#endif /* COCOVHD_H */ diff --git a/src/mame/machine/coleco.c b/src/mame/machine/coleco.c new file mode 100644 index 00000000000..e95e6786903 --- /dev/null +++ b/src/mame/machine/coleco.c @@ -0,0 +1,177 @@ +// license:BSD-3-Clause +// copyright-holders:Mike Balfour, Ben Bruscella, Sean Young +#include "emu.h" +#include "machine/coleco.h" + +// ColecoVision Controller +static INPUT_PORTS_START( ctrl1 ) + PORT_START("STD_KEYPAD1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 (pad 1)") PORT_CODE(KEYCODE_0_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1 (pad 1)") PORT_CODE(KEYCODE_1_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2 (pad 1)") PORT_CODE(KEYCODE_2_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3 (pad 1)") PORT_CODE(KEYCODE_3_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4 (pad 1)") PORT_CODE(KEYCODE_4_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5 (pad 1)") PORT_CODE(KEYCODE_5_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6 (pad 1)") PORT_CODE(KEYCODE_6_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7 (pad 1)") PORT_CODE(KEYCODE_7_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8 (pad 1)") PORT_CODE(KEYCODE_8_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 (pad 1)") PORT_CODE(KEYCODE_9_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("# (pad 1)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("* (pad 1)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0xb000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + + PORT_START("STD_JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) + PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) +INPUT_PORTS_END + +static INPUT_PORTS_START( ctrl2 ) + PORT_START("STD_KEYPAD2") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("# (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("* (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0xb000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + + PORT_START("STD_JOY2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) + PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) +INPUT_PORTS_END + + +// Super Action Controller +static INPUT_PORTS_START( sac1 ) + PORT_START("SAC_KEYPAD1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 (SAC pad 1)") PORT_CODE(KEYCODE_0_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1 (SAC pad 1)") PORT_CODE(KEYCODE_1_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2 (SAC pad 1)") PORT_CODE(KEYCODE_2_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3 (SAC pad 1)") PORT_CODE(KEYCODE_3_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4 (SAC pad 1)") PORT_CODE(KEYCODE_4_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5 (SAC pad 1)") PORT_CODE(KEYCODE_5_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6 (SAC pad 1)") PORT_CODE(KEYCODE_6_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7 (SAC pad 1)") PORT_CODE(KEYCODE_7_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8 (SAC pad 1)") PORT_CODE(KEYCODE_8_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 (SAC pad 1)") PORT_CODE(KEYCODE_9_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("# (SAC pad 1)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("* (SAC pad 1)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Blue Action Button P1") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Purple Action Button P1") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Orange Action Button P1") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + + PORT_START("SAC_JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Yellow Action Button P1") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) + + PORT_START("SAC_SLIDE1") // SAC P1 slider + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_J) PORT_CODE_INC(KEYCODE_L) PORT_REVERSE PORT_RESET PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) +INPUT_PORTS_END + +static INPUT_PORTS_START( sac2 ) + PORT_START("SAC_KEYPAD2") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("# (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("* (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Blue Action Button P2") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Purple Action Button P2") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Orange Action Button P2") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + + PORT_START("SAC_JOY2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Yellow Action Button P2") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) + + PORT_START("SAC_SLIDE2") // SAC P2 slider + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_RESET PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) +INPUT_PORTS_END + + +// Driving Controller +static INPUT_PORTS_START( driv1 ) + PORT_START("DRIV_WHEEL1") + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_J) PORT_CODE_INC(KEYCODE_L) PORT_REVERSE PORT_RESET PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x03) + + PORT_START("DRIV_PEDAL1") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x03) + PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x03) +INPUT_PORTS_END + +static INPUT_PORTS_START( driv2 ) + PORT_START("DRIV_WHEEL2") + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_RESET PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x30) + + PORT_START("DRIV_PEDAL2") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x30) + PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x30) +INPUT_PORTS_END + + +// Roller Controller +static INPUT_PORTS_START( roller ) + PORT_START("ROLLER_X") // Roller Controller X Axis + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_J) PORT_CODE_INC(KEYCODE_L) PORT_REVERSE PORT_RESET PORT_CONDITION("CTRLSEL", 0x80, EQUALS, 0x80) + + PORT_START("ROLLER_Y") // Roller Controller Y Axis + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_RESET PORT_CONDITION("CTRLSEL", 0x80, EQUALS, 0x80) +INPUT_PORTS_END + + +INPUT_PORTS_START( coleco ) + PORT_START("CTRLSEL") /* Select Controller Type */ + PORT_CONFNAME( 0x07, 0x00, "Port 1 Controller" ) + PORT_CONFSETTING( 0x01, DEF_STR( None ) ) + PORT_CONFSETTING( 0x00, "ColecoVision Controller" ) + PORT_CONFSETTING( 0x02, "Super Action Controller" ) + PORT_CONFSETTING( 0x03, "Driving Controller" ) + PORT_CONFNAME( 0x70, 0x00, "Port 2 Controller" ) + PORT_CONFSETTING( 0x10, DEF_STR( None ) ) + PORT_CONFSETTING( 0x00, "ColecoVision Controller" ) + PORT_CONFSETTING( 0x20, "Super Action Controller" ) + PORT_CONFSETTING( 0x30, "Driving Controller" ) + PORT_CONFNAME( 0x80, 0x00, "Extra Controller" ) + PORT_CONFSETTING( 0x00, DEF_STR( None ) ) + PORT_CONFSETTING( 0x80, "Roller Controller" ) + + PORT_INCLUDE( ctrl1 ) + PORT_INCLUDE( ctrl2 ) + PORT_INCLUDE( sac1 ) + PORT_INCLUDE( sac2 ) + PORT_INCLUDE( driv1 ) + PORT_INCLUDE( driv2 ) + PORT_INCLUDE( roller ) +INPUT_PORTS_END diff --git a/src/mame/machine/coleco.h b/src/mame/machine/coleco.h new file mode 100644 index 00000000000..b6022b164c9 --- /dev/null +++ b/src/mame/machine/coleco.h @@ -0,0 +1,10 @@ +// license:BSD-3-Clause +// copyright-holders:Mike Balfour, Ben Bruscella, Sean Young +#pragma once + +#ifndef __COLECO_CONTROLLERS__ +#define __COLECO_CONTROLLERS__ + +INPUT_PORTS_EXTERN( coleco ); + +#endif diff --git a/src/mame/machine/compiskb.c b/src/mame/machine/compiskb.c new file mode 100644 index 00000000000..1fe9e356ec8 --- /dev/null +++ b/src/mame/machine/compiskb.c @@ -0,0 +1,378 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Telenova Compis keyboard emulation + +*********************************************************************/ + +#include "compiskb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8748_TAG "i8748" +#define SPEAKER_TAG "speaker" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type COMPIS_KEYBOARD = &device_creator; + + +//------------------------------------------------- +// ROM( compis_keyboard ) +//------------------------------------------------- + +ROM_START( compis_keyboard ) + ROM_REGION( 0x800, I8748_TAG, 0 ) + ROM_LOAD( "cmpkey13.u1", 0x000, 0x800, CRC(3f87d138) SHA1(c04e2d325b9c04818bc7c47c3bf32b13862b11ec) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *compis_keyboard_device::device_rom_region() const +{ + return ROM_NAME( compis_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( compis_keyboard_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( compis_keyboard_io, AS_IO, 8, compis_keyboard_device ) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_r, bus_w) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(p1_r) AM_WRITENOP + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(p2_r) AM_WRITENOP + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_NOP + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_NOP +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_DRIVER( compis_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( compis_keyboard ) + MCFG_CPU_ADD(I8748_TAG, I8748, XTAL_2MHz) + MCFG_CPU_IO_MAP(compis_keyboard_io) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor compis_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( compis_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( compis_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( compis_keyboard ) + PORT_START("Y1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u_UMLAUT " " U_UMLAUT) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TABR") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TABL") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y2") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("'' *") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('*') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS !") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS ?") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS |") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 000") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) // 49 + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) // 52 + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y3") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) // 41 + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y4") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) // 4b + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y5") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y6") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y7") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(o_UMLAUT " " O_UMLAUT) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INPASSA") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S" O_UMLAUT "K") PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UTPL" A_RING "NA") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS S") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad C") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xe2\x8c\xab") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y8") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) //TODO utf8 + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AVBRYT") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("START-STOP") PORT_CODE(KEYCODE_PAUSE) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_RING " " A_RING) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y9") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS +") + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_UMLAUT " " A_UMLAUT) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC2\xB4 `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('`') + PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("SPECIAL") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xe2\x87\xa9") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xe2\x87\xa7\xe2\x87\xa7") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xe2\x87\xa7") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor compis_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( compis_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// compis_keyboard_device - constructor +//------------------------------------------------- + +compis_keyboard_device::compis_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, COMPIS_KEYBOARD, "Compis Keyboard", tag, owner, clock, "compiskb", __FILE__), + m_maincpu(*this, I8748_TAG), + m_speaker(*this, SPEAKER_TAG), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_special(*this, "SPECIAL"), + m_out_tx_handler(*this), + m_bus(0xff), + m_keylatch(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void compis_keyboard_device::device_start() +{ + // resolve callbacks + m_out_tx_handler.resolve_safe(); + m_out_tx_handler(1); +} + + +//------------------------------------------------- +// si_w - serial input write +//------------------------------------------------- + +WRITE_LINE_MEMBER( compis_keyboard_device::si_w ) +{ + m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); +} + + +//------------------------------------------------- +// bus_r - +//------------------------------------------------- + +READ8_MEMBER( compis_keyboard_device::bus_r ) +{ + // HACK this should be handled in mcs48.c + return m_bus; +} + + +//------------------------------------------------- +// bus_w - +//------------------------------------------------- + +WRITE8_MEMBER( compis_keyboard_device::bus_w ) +{ + /* + + bit description + + 0 keyboard row bit 0 + 1 keyboard row bit 1 + 2 keyboard row bit 2 + 3 keyboard row bit 3 + 4 + 5 speaker + 6 CAPS LED + 7 data out + + */ + + m_bus = data; + + // keyboard column + m_keylatch = (data & 0x0f); + + // speaker + m_speaker->level_w(BIT(data, 5)); + + // LEDs + output_set_led_value(LED_CAPS, BIT(data, 6)); + + // serial data out + m_out_tx_handler(BIT(data, 7)); +} + + +//------------------------------------------------- +// bus_w - +//------------------------------------------------- + +READ8_MEMBER( compis_keyboard_device::p1_r ) +{ + UINT8 data = 0xff; + + switch (m_keylatch) + { + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 9: data &= m_y9->read(); break; + } + + return data; +} + + +//------------------------------------------------- +// p2_r - +//------------------------------------------------- + +READ8_MEMBER( compis_keyboard_device::p2_r ) +{ + UINT8 data = 0xff; + + switch (m_keylatch) + { + case 1: data &= m_y1->read() >> 8; break; + case 2: data &= m_y2->read() >> 8; break; + case 3: data &= m_y3->read() >> 8; break; + case 4: data &= m_y4->read() >> 8; break; + case 5: data &= m_y5->read() >> 8; break; + case 6: data &= m_y6->read() >> 8; break; + case 7: data &= m_y7->read() >> 8; break; + case 8: data &= m_y8->read() >> 8; break; + case 9: data &= m_y9->read() >> 8; break; + } + + data &= m_special->read(); + + return data; +} diff --git a/src/mame/machine/compiskb.h b/src/mame/machine/compiskb.h new file mode 100644 index 00000000000..1872c3506c2 --- /dev/null +++ b/src/mame/machine/compiskb.h @@ -0,0 +1,90 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Telenova Compis keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __COMPIS_KEYBOARD__ +#define __COMPIS_KEYBOARD__ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "sound/speaker.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(_devcb) \ + devcb = &compis_keyboard_device::set_out_tx_handler(*device, DEVCB_##_devcb); + + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> compis_keyboard_device + +class compis_keyboard_device : public device_t +{ +public: + // construction/destruction + compis_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_out_tx_handler(device_t &device, _Object object) { return downcast(device).m_out_tx_handler.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_WRITE_LINE_MEMBER( si_w ); + + DECLARE_READ8_MEMBER( bus_r ); + DECLARE_WRITE8_MEMBER( bus_w ); + DECLARE_READ8_MEMBER( p1_r ); + DECLARE_READ8_MEMBER( p2_r ); + +protected: + // device-level overrides + virtual void device_start(); + +private: + enum + { + LED_CAPS + }; + + required_device m_maincpu; + required_device m_speaker; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_special; + devcb_write_line m_out_tx_handler; + + UINT8 m_bus; + UINT8 m_keylatch; +}; + + +// device type definition +extern const device_type COMPIS_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/concept.c b/src/mame/machine/concept.c new file mode 100644 index 00000000000..7beeb8fe1d7 --- /dev/null +++ b/src/mame/machine/concept.c @@ -0,0 +1,401 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet, Brett Wyer +/* + Corvus Concept driver + + Raphael Nabet, Brett Wyer, 2003-2005 +*/ + +#include "emu.h" +#include "includes/concept.h" + + +#define VERBOSE 1 + +#define LOG(x) do { if (VERBOSE > 0) logerror x; } while (0) +#define VLOG(x) do { if (VERBOSE > 1) logerror x; } while (0) + + +/* interrupt priority encoder */ +enum +{ + IOCINT_level = 1, /* serial lines (CTS, DSR & DCD) and I/O ports */ + SR1INT_level, /* serial port 1 acia */ + OMINT_level, /* omninet */ + SR0INT_level, /* serial port 0 acia */ + TIMINT_level, /* via */ + KEYINT_level, /* keyboard acia */ + NMIINT_level /* reserved */ +}; + +/* Clock interface */ + +/* Omninet */ +/*static int ready;*/ /* ready line from monochip, role unknown */ + +/* Via */ + + +void concept_state::machine_start() +{ + /* initialize int state */ + m_pending_interrupts = 0; + + /* initialize clock interface */ + m_clock_enable = FALSE /*TRUE*/; + + save_item(NAME(m_pending_interrupts)); + save_item(NAME(m_clock_enable)); + save_item(NAME(m_clock_address)); +} + + +void concept_state::machine_reset() +{ + // OS will not boot if TDRE is clear on ACIA 0; this fixes that + m_acia0->write_cts(CLEAR_LINE); + m_acia1->write_cts(CLEAR_LINE); +} + +void concept_state::video_start() +{ +} + +UINT32 concept_state::screen_update_concept(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + /* resolution is 720*560 */ + UINT16 *videoram = m_videoram; + int x, y; + UINT16 *line; + + for (y = 0; y < 560; y++) + { + line = &bitmap.pix16(560-1-y); + for (x = 0; x < 720; x++) + line[720-1-x] = (videoram[(x+48+y*768)>>4] & (0x8000 >> ((x+48+y*768) & 0xf))) ? 1 : 0; + } + return 0; +} + +void concept_state::concept_set_interrupt(int level, int state) +{ + int interrupt_mask; + int final_level; + + if (state) + m_pending_interrupts |= 1 << level; + else + m_pending_interrupts &= ~ (1 << level); + + for (final_level = 7, interrupt_mask = m_pending_interrupts; (final_level > 0) && ! (interrupt_mask & 0x80); final_level--, interrupt_mask <<= 1) + ; + + if (final_level) + /* assert interrupt */ + m_maincpu->set_input_line_and_vector(M68K_IRQ_1 + final_level - 1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + else + { + /* clear all interrupts */ + m_maincpu->set_input_line_and_vector(M68K_IRQ_1 + level - 1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); + } +} + +/* + VIA port A + + 0: omninet ready (I) + 1: CTS0 (I) + 2: CTS1 (I) + 3: DSR0 (I) + 4: DSR1 (I) + 5: DCD0 (I) + 6: DCD1 (I) + 7: IOX (O) +*/ +READ8_MEMBER(concept_state::via_in_a) +{ + LOG(("via_in_a: VIA port A (Omninet and COMM port status) read\n")); + return 1; /* omninet ready always 1 */ +} + +WRITE8_MEMBER(concept_state::via_out_a) +{ + LOG(("via_out_a: VIA port A status written: data=0x%2.2x\n", data)); + /*iox = (data & 0x80) != 0;*/ +} + +/* + VIA port B + + 0: video off (O) + 1: video address 17 (O) + 2: video address 18 (O) + 3: monitor orientation (I) + 4: CH rate select DC0 (serial port line) (O) + 5: CH rate select DC1 (serial port line) (O) + 6: boot switch 0 (I) + 7: boot switch 1 (I) +*/ +READ8_MEMBER(concept_state::via_in_b) +{ + UINT8 status; + + status = ((ioport("DSW0")->read() & 0x80) >> 1) | ((ioport("DSW0")->read() & 0x40) << 1); + LOG(("via_in_b: VIA port B (DIP switches, Video, Comm Rate) - status: 0x%2.2x\n", status)); + return status; +} + +WRITE8_MEMBER(concept_state::via_out_b) +{ + VLOG(("via_out_b: VIA port B (Video Control and COMM rate select) written: data=0x%2.2x\n", data)); +} + +/* + VIA CB2: used as sound output +*/ + +WRITE_LINE_MEMBER(concept_state::via_out_cb2) +{ +// LOG(("via_out_cb2: Sound control written: data=0x%2.2x\n", state)); + m_speaker->level_w(state); +} + +/* + VIA irq -> 68k level 5 +*/ +WRITE_LINE_MEMBER(concept_state::via_irq_func) +{ + concept_set_interrupt(TIMINT_level, state); +} + +READ16_MEMBER(concept_state::concept_io_r) +{ + if (! ACCESSING_BITS_0_7) + return 0; + + switch ((offset >> 8) & 7) + { + case 0: + /* I/O slot regs */ + switch ((offset >> 4) & 7) + { + case 1: // IO1 registers + case 2: // IO2 registers + case 3: // IO3 registers + case 4: // IO4 registers + { + int slot = ((offset >> 4) & 7); + device_a2bus_card_interface *card = m_a2bus->get_a2bus_card(slot); + + if (card) + { + return card->read_c0nx(space, offset & 0x0f); + } + + return 0xff; + } + break; + + default: // ??? + logerror("concept_io_r: Slot I/O memory accessed for unknown purpose at address 0x03%4.4x\n", offset << 1); + break; + } + break; + + case 1: // IO1 ROM + case 2: // IO2 ROM + case 3: // IO3 ROM + case 4: // IO4 ROM + { + int slot = (offset >> 8) & 7; + device_a2bus_card_interface *card = m_a2bus->get_a2bus_card(slot); + + if (card) + { + return card->read_cnxx(space, offset & 0xff); + } + } + break; + + case 5: + /* slot status */ + LOG(("concept_io_r: Slot status read at address 0x03%4.4x\n", offset << 1)); + break; + + case 6: + /* calendar R/W */ + VLOG(("concept_io_r: Calendar read at address 0x03%4.4x\n", offset << 1)); + if (!m_clock_enable) + return m_mm58274->read(space, m_clock_address); + break; + + case 7: + /* I/O ports */ + switch ((offset >> 4) & 7) + { + case 0: + /* NKBP keyboard */ + return m_kbdacia->read(space, (offset & 3)); + + case 1: + /* NSR0 data comm port 0 */ + return m_acia0->read(space, (offset & 3)); + + case 2: + /* NSR1 data comm port 1 */ + return m_acia1->read(space, (offset & 3)); + + case 3: + /* NVIA versatile system interface */ +// LOG(("concept_io_r: VIA read at address 0x03%4.4x\n", offset << 1)); + { + via6522_device *via_0 = machine().device("via6522_0"); + return via_0->read(space, offset & 0xf); + } + + case 4: + /* NCALM clock calendar address and strobe register */ + /* write-only? */ + LOG(("concept_io_r: NCALM clock/calendar read at address 0x03%4.4x\n", offset << 1)); + break; + + case 5: + /* NOMNI omninet strobe */ + logerror("concept_io_r: NOMNI Omninet Transporter register read at address 0x03%4.4x\n", offset << 1); + break; + + case 6: + /* NOMOFF reset omninet interrupt flip-flop */ + logerror("concept_io_r: NOMOFF Omninet interrupt flip-flop read at address 0x03%4.4x\n", offset << 1); + break; + + case 7: + /* NIOSTRB external I/O ROM strobe (disables interface RAM) */ + logerror("concept_io_r: NIOSTRB External I/O ROM strobe read at address 0x03%4.4x\n", offset << 1); + break; + } + break; + } + + return 0; +} + +WRITE16_MEMBER(concept_state::concept_io_w) +{ + if (! ACCESSING_BITS_0_7) + return; + + data &= 0xff; + + switch ((offset >> 8) & 7) + { + case 0: + /* I/O slot regs */ + switch ((offset >> 4) & 7) + { + case 1: // IO1 registers + case 2: // IO2 registers + case 3: // IO3 registers + case 4: // IO4 registers + { + int slot = (offset >> 4) & 7; + device_a2bus_card_interface *card = m_a2bus->get_a2bus_card(slot); + + if (card) + { + return card->write_c0nx(space, offset & 0x0f, data); + } + } + break; + + default: // ??? + logerror("concept_io_w: Slot I/O memory written for unknown purpose at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); + break; + } + break; + + case 1: // IO1 ROM + case 2: // IO2 ROM + case 3: // IO3 ROM + case 4: // IO4 ROM + { + int slot = (offset >> 8) & 7; + device_a2bus_card_interface *card = m_a2bus->get_a2bus_card(slot); + + if (card) + { + return card->write_cnxx(space, offset & 0xff, data); + } + } + break; + + case 5: + /* slot status */ + logerror("concept_io_w: Slot status written at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); + break; + + case 6: + /* calendar R/W */ + LOG(("concept_io_w: Calendar written to at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data)); + if (!m_clock_enable) + m_mm58274->write(space, m_clock_address, data & 0xf); + break; + + case 7: + /* I/O ports */ + switch ((offset >> 4) & 7) + { + case 0: + /* NKBP keyboard */ + m_kbdacia->write(space, (offset & 3), data); + break; + + case 1: + /* NSR0 data comm port 0 */ + m_acia0->write(space, (offset & 3), data); + break; + + case 2: + /* NSR1 data comm port 1 */ + m_acia1->write(space, (offset & 3), data); + break; + + case 3: + /* NVIA versatile system interface */ + { + via6522_device *via_0 = machine().device("via6522_0"); + via_0->write(space, offset & 0xf, data); + } + break; + + case 4: + /* NCALM clock calendar address and strobe register */ + if (m_clock_enable != ((data & 0x10) != 0)) + { + m_clock_enable = ((data & 0x10) != 0); + if (! m_clock_enable) + /* latch address when enable goes low */ + m_clock_address = data & 0x0f; + } + /*volume_control = (data & 0x20) != 0;*/ + /*alt_map = (data & 0x40) != 0;*/ + break; + + case 5: + /* NOMNI omninet strobe */ + logerror("concept_io_w: NOMNI Omninet Transporter register written at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); + break; + + case 6: + /* NOMOFF reset omninet interrupt flip-flop */ + logerror("concept_io_w: NOMOFF Omninet flip-flop reset at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); + break; + + case 7: + /* NIOSTRB external I/O ROM strobe */ + logerror("concept_io_w: NIOSTRB External I/O ROM strobe written at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); + break; + } + break; + } +} diff --git a/src/mame/machine/cuda.c b/src/mame/machine/cuda.c new file mode 100644 index 00000000000..5c4964653b1 --- /dev/null +++ b/src/mame/machine/cuda.c @@ -0,0 +1,567 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/* + Apple "Cuda" ADB/system controller MCU + Emulation by R. Belmont + + Port definitions, primarily from the schematics. + + Port A: + + x------- O ADB data line out + -x------ I ADB data line in + --x----- I "1" for passive or soft power, "off sense" for secure + ---x---- O DFAC latch + ----x--- O "Fast Reset" + -----x-- I Keyboard power switch + ------x- I 1 for secure or passive power, chassis switch for soft + -------x ? 1 for passive, power supply control on secure/soft power, input on secure/soft also? + + Port B: + + x------- O DFAC bit clock + -x------ B DFAC data I/O (used in both directions) + --x----- B VIA shift register data (used in both directions) + ---x---- O VIA clock + ----x--- I VIA TIP + -----x-- I VIA BYTEACK + ------x- O VIA TREQ + -------x I +5v sense + + Port C: + x--- O 680x0 reset + -x-- ? 680x0 IPL 2 (used in both directions) + --x- ? IPL 1/pull up for passive power, trickle sense for soft and secure + ---x ? IPL 0 for passive power, pull-up for soft power, file server switch for secure power +*/ + + +//#define CUDA_SUPER_VERBOSE + +#include "emu.h" +#include "cuda.h" +#include "cpu/m6805/m6805.h" +#include "sound/asc.h" +#include "includes/mac.h" + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define CUDA_CPU_TAG "cuda" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type CUDA = &device_creator; + +ROM_START( cuda ) + ROM_REGION(0x4400, CUDA_CPU_TAG, 0) + ROM_LOAD( "341s0060.bin", 0x1100, 0x1100, CRC(0f5e7b4a) SHA1(972b3778146d9787b18c3a9874d505cf606b3e15) ) + ROM_LOAD( "341s0788.bin", 0x2200, 0x1100, CRC(df6e1b43) SHA1(ec23cc6214c472d61b98964928c40589517a3172) ) + ROM_LOAD( "341s0417.bin", 0x3300, 0x1100, CRC(571f24c9) SHA1(a2ae12492389a00e5f4b1ef19b267d6f3a8eadc3) ) +ROM_END + +//------------------------------------------------- +// ADDRESS_MAP +//------------------------------------------------- + +static ADDRESS_MAP_START( cuda_map, AS_PROGRAM, 8, cuda_device ) + AM_RANGE(0x0000, 0x0002) AM_READWRITE(ports_r, ports_w) + AM_RANGE(0x0004, 0x0006) AM_READWRITE(ddr_r, ddr_w) + AM_RANGE(0x0007, 0x0007) AM_READWRITE(pll_r, pll_w) + AM_RANGE(0x0008, 0x0008) AM_READWRITE(timer_ctrl_r, timer_ctrl_w) + AM_RANGE(0x0009, 0x0009) AM_READWRITE(timer_counter_r, timer_counter_w) + AM_RANGE(0x0012, 0x0012) AM_READWRITE(onesec_r, onesec_w) + AM_RANGE(0x0090, 0x00ff) AM_RAM // work RAM and stack + AM_RANGE(0x0100, 0x01ff) AM_READWRITE(pram_r, pram_w) + AM_RANGE(0x0f00, 0x1fff) AM_ROM AM_REGION(CUDA_CPU_TAG, 0) +ADDRESS_MAP_END + +//------------------------------------------------- +// MACHINE_CONFIG +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( cuda ) + MCFG_CPU_ADD(CUDA_CPU_TAG, M68HC05EG, XTAL_32_768kHz*192) // 32.768 kHz input clock, can be PLL'ed to x128 = 4.1 MHz under s/w control + MCFG_CPU_PROGRAM_MAP(cuda_map) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor cuda_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( cuda ); +} + +const rom_entry *cuda_device::device_rom_region() const +{ + return ROM_NAME( cuda ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data) +{ +// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->pc()); + + switch (offset) + { + case 0: // port A +/* printf("PORT A ADB:%d DFAC:%d PFW:%d\n", + (data & 0x80) ? 1 : 0, + (data & 0x10) ? 1 : 0, + (data & 0x01) ? 1 : 0);*/ + + if ((data & 0x80) != last_adb) + { +/* if (data & 0x80) + { + printf("CU ADB: 1->0 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time); + } + else + { + printf("CU ADB: 0->1 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time); + }*/ + + // allow the linechange handler to override us + adb_in = (data & 0x80) ? true : false; + + m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time); + write_linechange(((data & 0x80) >> 7) ^ 1); + + last_adb = data & 0x80; + last_adb_time = machine().time().as_ticks(1000000); + } + break; + + case 1: // port B + { + if (treq != ((data>>1)&1)) + { + #ifdef CUDA_SUPER_VERBOSE + printf("CU-> TREQ: %d (PC=%x)\n", (data>>1)&1, m_maincpu->pc()); + #endif + treq = (data>>1) & 1; + } + if (via_data != ((data>>5)&1)) + { + #ifdef CUDA_SUPER_VERBOSE + printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->pc()); + #endif + via_data = (data>>5) & 1; + write_via_data(via_data); + } + if (via_clock != ((data>>4)&1)) + { + #ifdef CUDA_SUPER_VERBOSE + printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc()); + #endif + via_clock = (data>>4) & 1; + write_via_clock(via_clock); + } + } + break; + + case 2: // port C + if ((data & 8) != reset_line) + { + #ifdef CUDA_SUPER_VERBOSE + printf("680x0 reset: %d -> %d (PC=%x)\n", (ports[2] & 8)>>3, (data & 8)>>3, m_maincpu->pc()); + #endif + reset_line = (data & 8); + // falling edge, should reset the machine too + if ((ports[2] & 8) && !(data&8)) + { + write_reset(ASSERT_LINE); + write_reset(CLEAR_LINE); + + // if PRAM's waiting to be loaded, transfer it now + if (!pram_loaded) + { +// memcpy(pram, disk_pram, 0x100); + pram_loaded = true; + } + } + } + break; + } +} + +READ8_MEMBER( cuda_device::ddr_r ) +{ + return ddrs[offset]; +} + +WRITE8_MEMBER( cuda_device::ddr_w ) +{ +// printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, m_maincpu->pc()); + + send_port(space, offset, ports[offset] & data); + + ddrs[offset] = data; +} + +READ8_MEMBER( cuda_device::ports_r ) +{ + UINT8 incoming = 0; + + switch (offset) + { + case 0: // port A + if (cuda_controls_power) + { + incoming = 0x20; // pull up + chassis switch (which is 0 = on) + } + else + { + incoming = 0x02 | 0x01; // pull-up + PFW + } + + if (adb_in) + { + incoming |= 0x40; + } + break; + + case 1: // port B +// printf("Read: byteack %d tip %d via_data %d\n", byteack, tip, via_data); + incoming |= 0x01; // +5v sense + incoming |= byteack<<2; + incoming |= tip<<3; + incoming |= via_data<<5; + incoming |= 0xc0; // show DFAC lines high + break; + + case 2: // port C + if (cuda_controls_power) + { + incoming = 0x02 | 0x01; // soft power: trickle sense + pull-up + } + else + { + incoming = 0x02 | 0x01; // secure power: pull-up + file server + } + break; + } + + // apply data direction registers + incoming &= (ddrs[offset] ^ 0xff); + // add in ddr-masked version of port writes + incoming |= (ports[offset] & ddrs[offset]); + + // HACK: don't know how this works on h/w... + if (!offset) + { + incoming |= 0x01; + } + +// printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], m_maincpu->pc()); + + return incoming; +} + +WRITE8_MEMBER( cuda_device::ports_w ) +{ + send_port(space, offset, data); + + ports[offset] = data; +} + +READ8_MEMBER( cuda_device::pll_r ) +{ + return pll_ctrl; +} + +WRITE8_MEMBER( cuda_device::pll_w ) +{ + #ifdef CUDA_SUPER_VERBOSE + if (pll_ctrl != data) + { + static const int clocks[4] = { 524288, 1048576, 2097152, 4194304 }; + printf("PLL ctrl: clock %d TCS:%d BCS:%d AUTO:%d BWC:%d PLLON:%d (PC=%x)\n", clocks[data&3], + (data & 0x80) ? 1 : 0, + (data & 0x40) ? 1 : 0, + (data & 0x20) ? 1 : 0, + (data & 0x10) ? 1 : 0, + (data & 0x08) ? 1 : 0, m_maincpu->pc()); + } + #endif + pll_ctrl = data; +} + +READ8_MEMBER( cuda_device::timer_ctrl_r ) +{ + return timer_ctrl; +} + +WRITE8_MEMBER( cuda_device::timer_ctrl_w ) +{ + static const attotime rates[4][5] = + { + { attotime::from_seconds(1), attotime::from_msec(31.3f), attotime::from_msec(15.6f), attotime::from_msec(7.8f), attotime::from_msec(3.9f) }, + { attotime::from_seconds(2), attotime::from_msec(62.5f), attotime::from_msec(31.3f), attotime::from_msec(15.6f), attotime::from_msec(7.8f) }, + { attotime::from_seconds(4), attotime::from_msec(125.0f), attotime::from_msec(62.5f), attotime::from_msec(31.3f), attotime::from_msec(15.6f) }, + { attotime::from_seconds(8), attotime::from_msec(250.0f), attotime::from_msec(125.1f), attotime::from_msec(62.5f), attotime::from_msec(31.3f) }, + }; + +// printf("%02x to timer control (PC=%x)\n", data, m_maincpu->pc()); + + if (data & 0x50) + { + m_prog_timer->adjust(rates[data & 3][(pll_ctrl&3)+1], 1, rates[data&3][(pll_ctrl&3)+1]); + ripple_counter = timer_counter; + } + else + { + m_prog_timer->adjust(attotime::never); + } + + if ((timer_ctrl & 0x80) && !(data & 0x80)) + { + m_maincpu->set_input_line(M68HC05EG_INT_TIMER, CLEAR_LINE); + timer_ctrl &= ~0x80; + } + else if ((timer_ctrl & 0x40) && !(data & 0x40)) + { + m_maincpu->set_input_line(M68HC05EG_INT_TIMER, CLEAR_LINE); + timer_ctrl &= ~0x40; + } + + timer_ctrl &= 0xc0; + timer_ctrl |= (data & ~0xc0); +} + +READ8_MEMBER( cuda_device::timer_counter_r ) +{ + return timer_counter; +} + +WRITE8_MEMBER( cuda_device::timer_counter_w ) +{ +// printf("%02x to timer counter (PC=%x)\n", data, m_maincpu->pc()); + timer_counter = data; + ripple_counter = timer_counter; +} + +READ8_MEMBER( cuda_device::onesec_r ) +{ + return onesec; +} + +WRITE8_MEMBER( cuda_device::onesec_w ) +{ + m_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + + if ((onesec & 0x40) && !(data & 0x40)) + { + m_maincpu->set_input_line(M68HC05EG_INT_CPI, CLEAR_LINE); + } + + onesec = data; +} + +READ8_MEMBER( cuda_device::pram_r ) +{ + return pram[offset]; +} + +WRITE8_MEMBER( cuda_device::pram_w ) +{ + pram[offset] = data; +} + +//------------------------------------------------- +// cuda_device - constructor +//------------------------------------------------- + +cuda_device::cuda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CUDA, "Apple Cuda", tag, owner, clock, "cuda", __FILE__), + device_nvram_interface(mconfig, *this), + write_reset(*this), + write_linechange(*this), + write_via_clock(*this), + write_via_data(*this), + m_maincpu(*this, CUDA_CPU_TAG) +{ +} + +//------------------------------------------------- +// static_set_type - configuration helper to set +// the chip type +//------------------------------------------------- + +void cuda_device::static_set_type(device_t &device, int type) +{ + cuda_device &cuda = downcast(device); + cuda.rom_offset = type; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cuda_device::device_start() +{ + write_reset.resolve_safe(); + write_linechange.resolve_safe(); + write_via_clock.resolve_safe(); + write_via_data.resolve_safe(); + + m_timer = timer_alloc(0, NULL); + m_prog_timer = timer_alloc(1, NULL); + save_item(NAME(ddrs[0])); + save_item(NAME(ddrs[1])); + save_item(NAME(ddrs[2])); + save_item(NAME(ports[0])); + save_item(NAME(ports[1])); + save_item(NAME(ports[2])); + save_item(NAME(pll_ctrl)); + save_item(NAME(timer_ctrl)); + save_item(NAME(timer_counter)); + save_item(NAME(ripple_counter)); + save_item(NAME(onesec)); + save_item(NAME(treq)); + save_item(NAME(byteack)); + save_item(NAME(tip)); + save_item(NAME(via_data)); + save_item(NAME(via_clock)); + save_item(NAME(adb_in)); + save_item(NAME(reset_line)); + save_item(NAME(m_adb_dtime)); + save_item(NAME(pram_loaded)); + save_item(NAME(pram)); + save_item(NAME(disk_pram)); + + UINT8 *rom = device().machine().root_device().memregion(device().subtag(CUDA_CPU_TAG).c_str())->base(); + + if (rom) + { + memcpy(rom, rom+rom_offset, 0x1100); + } +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void cuda_device::device_reset() +{ + ddrs[0] = ddrs[1] = ddrs[2] = 0; + ports[0] = ports[1] = ports[2] = 0; + + m_timer->adjust(attotime::never); + m_prog_timer->adjust(attotime::never); + + cuda_controls_power = false; // set to hard power control + adb_in = true; // line is pulled up to +5v, so nothing plugged in would read as "1" + reset_line = 0; + tip = 0; + treq = 0; + byteack = 0; + via_data = 0; + via_clock = 0; + pll_ctrl = 0; + timer_ctrl = 0; + timer_counter = 32; + last_adb_time = m_maincpu->total_cycles(); + onesec = 0; + last_adb = 0; +} + +void cuda_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (id == 0) + { + onesec |= 0x40; + + if (onesec & 0x10) + { + m_maincpu->set_input_line(M68HC05EG_INT_CPI, ASSERT_LINE); + } + } + else + { + timer_ctrl |= 0x80; + + if (timer_ctrl & 0x20) + { + m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE); + } + + ripple_counter--; + if (ripple_counter <= 0) + { + timer_ctrl |= 0x40; + + ripple_counter = timer_counter; + + if (timer_ctrl & 0x10) + { + m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE); + } + } + } +} + +// the 6805 program clears PRAM on startup (on h/w it's always running once a battery is inserted) +// we deal with that by loading pram from disk to a secondary buffer and then slapping it into "live" +// once the cuda reboots the 68k +void cuda_device::nvram_default() +{ + memset(pram, 0, 0x100); + memset(disk_pram, 0, 0x100); + + pram[0x1] = 0x10; + pram[0x2] = 0x4f; + pram[0x3] = 0x48; + pram[0x8] = 0x13; + pram[0x9] = 0x88; + pram[0xb] = 0xcc; + pram[0xc] = 0x4e; + pram[0xd] = 0x75; + pram[0xe] = 0x4d; + pram[0xf] = 0x63; + pram[0x10] = 0xa8; + pram[0x14] = 0xcc; + pram[0x15] = 0x0a; + pram[0x16] = 0xcc; + pram[0x17] = 0x0a; + pram[0x1d] = 0x02; + pram[0x1e] = 0x63; + pram[0x4a] = 0x90; + pram[0x4b] = 0xc7; + pram[0x57] = 0x29; + pram[0x58] = 0x80; + pram[0x59] = 0x68; + pram[0x5a] = 0x80; + pram[0x5b] = 0x80; + pram[0x6f] = 0x28; + pram[0x77] = 0x01; + pram[0x78] = 0xff; + pram[0x79] = 0xff; + pram[0x7a] = 0xff; + pram[0x7b] = 0xdf; + pram[0xb8] = 0x35; + pram[0xb9] = 0x80; + pram_loaded = false; +} + +void cuda_device::nvram_read(emu_file &file) +{ + file.read(disk_pram, 0x100); + pram_loaded = false; +} + +void cuda_device::nvram_write(emu_file &file) +{ + file.write(pram, 0x100); +} diff --git a/src/mame/machine/cuda.h b/src/mame/machine/cuda.h new file mode 100644 index 00000000000..2cdc32f7ff9 --- /dev/null +++ b/src/mame/machine/cuda.h @@ -0,0 +1,141 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +#pragma once + +#ifndef __CUDA_H__ +#define __CUDA_H__ + +#include "emu.h" + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define CUDA_TAG "cuda" + +#define CUDA_341S0060 0x1100 // v2.40 (Most common: Performa/Quadra 6xx, PowerMac x200, x400, x500, Pippin, Gossamer G3) +#define CUDA_341S0788 0x2200 // v2.37 (LC 475/575/Quadra 605, Quadra 660AV/840AV, PowerMac x200) +#define CUDA_341S0417 0x3300 // v2.35 (Color Classic) + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_CUDA_ADD(_type) \ + MCFG_DEVICE_ADD(CUDA_TAG, CUDA, 0) \ + MCFG_CUDA_TYPE(_type) + +#define MCFG_CUDA_REPLACE(_type) \ + MCFG_DEVICE_REPLACE(CUDA_TAG, CUDA, 0) \ + MCFG_CUDA_TYPE(_type) + +#define MCFG_CUDA_REMOVE() \ + MCFG_DEVICE_REMOVE(CUDA_TAG) + +#define MCFG_CUDA_TYPE(_type) \ + cuda_device::static_set_type(*device, _type); + +#define MCFG_CUDA_REMOVE() \ + MCFG_DEVICE_REMOVE(CUDA_TAG) + +#define MCFG_CUDA_RESET_CALLBACK(_cb) \ + devcb = &cuda_device::set_reset_cb(*device, DEVCB_##_cb); + +#define MCFG_CUDA_LINECHANGE_CALLBACK(_cb) \ + devcb = &cuda_device::set_linechange_cb(*device, DEVCB_##_cb); + +#define MCFG_CUDA_VIA_CLOCK_CALLBACK(_cb) \ + devcb = &cuda_device::set_via_clock_cb(*device, DEVCB_##_cb); + +#define MCFG_CUDA_VIA_DATA_CALLBACK(_cb) \ + devcb = &cuda_device::set_via_data_cb(*device, DEVCB_##_cb); + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> cuda_device + +class cuda_device : public device_t, public device_nvram_interface +{ +public: + // construction/destruction + cuda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // inline configuration helpers + static void static_set_type(device_t &device, int type); + + // device_config_nvram_interface overrides + virtual void nvram_default(); + virtual void nvram_read(emu_file &file); + virtual void nvram_write(emu_file &file); + + DECLARE_READ8_MEMBER( ddr_r ); + DECLARE_WRITE8_MEMBER( ddr_w ); + DECLARE_READ8_MEMBER( ports_r ); + DECLARE_WRITE8_MEMBER( ports_w ); + DECLARE_READ8_MEMBER( pll_r ); + DECLARE_WRITE8_MEMBER( pll_w ); + DECLARE_READ8_MEMBER( timer_ctrl_r ); + DECLARE_WRITE8_MEMBER( timer_ctrl_w ); + DECLARE_READ8_MEMBER( timer_counter_r ); + DECLARE_WRITE8_MEMBER( timer_counter_w ); + DECLARE_READ8_MEMBER( onesec_r ); + DECLARE_WRITE8_MEMBER( onesec_w ); + DECLARE_READ8_MEMBER( pram_r ); + DECLARE_WRITE8_MEMBER( pram_w ); + + // VIA interface routines + UINT8 get_treq() { return treq; } + void set_tip(UINT8 val) { tip = val; } + void set_byteack(UINT8 val) { byteack = val; } + UINT8 get_via_data() { return via_data; } + void set_via_data(UINT8 dat) { via_data = dat; } + UINT8 get_via_clock() { return via_clock; } + void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; } + int get_adb_dtime() { return m_adb_dtime; } + + int rom_offset; + + template static devcb_base &set_reset_cb(device_t &device, _Object wr) { return downcast(device).write_reset.set_callback(wr); } + template static devcb_base &set_linechange_cb(device_t &device, _Object wr) { return downcast(device).write_linechange.set_callback(wr); } + template static devcb_base &set_via_clock_cb(device_t &device, _Object wr) { return downcast(device).write_via_clock.set_callback(wr); } + template static devcb_base &set_via_data_cb(device_t &device, _Object wr) { return downcast(device).write_via_data.set_callback(wr); } + + devcb_write_line write_reset, write_linechange, write_via_clock, write_via_data; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + + required_device m_maincpu; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + UINT8 ddrs[3]; + UINT8 ports[3]; + UINT8 pll_ctrl; + UINT8 timer_ctrl; + UINT8 timer_counter, ripple_counter; + UINT8 onesec; + UINT8 treq, byteack, tip, via_data, via_clock, last_adb; + UINT64 last_adb_time; + bool cuda_controls_power; + bool adb_in; + int reset_line; + int m_adb_dtime; + emu_timer *m_timer, *m_prog_timer; + UINT8 pram[0x100], disk_pram[0x100]; + bool pram_loaded; + + void send_port(address_space &space, UINT8 offset, UINT8 data); +}; + +// device type definition +extern const device_type CUDA; + +#endif diff --git a/src/mame/machine/cx4data.inc b/src/mame/machine/cx4data.inc new file mode 100644 index 00000000000..b7d1610a304 --- /dev/null +++ b/src/mame/machine/cx4data.inc @@ -0,0 +1,200 @@ +// license:GPL-2.0+ +// copyright-holders:byuu, Nach +/*************************************************************************** + + cx4data.c + + Code based on original work by zsKnight, anomie and Nach. + This implementation is based on C++ "cx4*.cpp" by byuu + (up to date with source v 0.49). + +***************************************************************************/ + +static const UINT8 CX4_immediate_data[48] = +{ + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x80, 0xff, 0xff, 0x7f, + 0x00, 0x80, 0x00, 0xff, 0x7f, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0xff, + 0x00, 0x00, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x01, 0x00, 0xff, 0xfe, 0x00 +}; + +static const UINT16 CX4_wave_data[40] = +{ + 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, + 0x0200, 0x0202, 0x0204, 0x0206, 0x0208, 0x020a, 0x020c, 0x020e, + 0x0400, 0x0402, 0x0404, 0x0406, 0x0408, 0x040a, 0x040c, 0x040e, + 0x0600, 0x0602, 0x0604, 0x0606, 0x0608, 0x060a, 0x060c, 0x060e, + 0x0800, 0x0802, 0x0804, 0x0806, 0x0808, 0x080a, 0x080c, 0x080e +}; + +static const UINT32 CX4_sin_table[256] = +{ + 0x000000, 0x000324, 0x000648, 0x00096c, 0x000c8f, 0x000fb2, 0x0012d5, 0x0015f6, + 0x001917, 0x001c37, 0x001f56, 0x002273, 0x002590, 0x0028aa, 0x002bc4, 0x002edb, + 0x0031f1, 0x003505, 0x003817, 0x003b26, 0x003e33, 0x00413e, 0x004447, 0x00474d, + 0x004a50, 0x004d50, 0x00504d, 0x005347, 0x00563e, 0x005931, 0x005c22, 0x005f0e, + 0x0061f7, 0x0064dc, 0x0067bd, 0x006a9b, 0x006d74, 0x007049, 0x007319, 0x0075e5, + 0x0078ad, 0x007b70, 0x007e2e, 0x0080e7, 0x00839c, 0x00864b, 0x0088f5, 0x008b9a, + 0x008e39, 0x0090d3, 0x009368, 0x0095f6, 0x00987f, 0x009b02, 0x009d7f, 0x009ff6, + 0x00a267, 0x00a4d2, 0x00a736, 0x00a994, 0x00abeb, 0x00ae3b, 0x00b085, 0x00b2c8, + 0x00b504, 0x00b73a, 0x00b968, 0x00bb8f, 0x00bdae, 0x00bfc7, 0x00c1d8, 0x00c3e2, + 0x00c5e4, 0x00c7de, 0x00c9d1, 0x00cbbb, 0x00cd9f, 0x00cf7a, 0x00d14d, 0x00d318, + 0x00d4db, 0x00d695, 0x00d848, 0x00d9f2, 0x00db94, 0x00dd2d, 0x00debe, 0x00e046, + 0x00e1c5, 0x00e33c, 0x00e4aa, 0x00e60f, 0x00e76b, 0x00e8bf, 0x00ea09, 0x00eb4b, + 0x00ec83, 0x00edb2, 0x00eed8, 0x00eff5, 0x00f109, 0x00f213, 0x00f314, 0x00f40b, + 0x00f4fa, 0x00f5de, 0x00f6ba, 0x00f78b, 0x00f853, 0x00f912, 0x00f9c7, 0x00fa73, + 0x00fb14, 0x00fbac, 0x00fc3b, 0x00fcbf, 0x00fd3a, 0x00fdab, 0x00fe13, 0x00fe70, + 0x00fec4, 0x00ff0e, 0x00ff4e, 0x00ff84, 0x00ffb1, 0x00ffd3, 0x00ffec, 0x00fffb, + 0x000000, 0xfffcdb, 0xfff9b7, 0xfff693, 0xfff370, 0xfff04d, 0xffed2a, 0xffea09, + 0xffe6e8, 0xffe3c8, 0xffe0a9, 0xffdd8c, 0xffda6f, 0xffd755, 0xffd43b, 0xffd124, + 0xffce0e, 0xffcafa, 0xffc7e8, 0xffc4d9, 0xffc1cc, 0xffbec1, 0xffbbb8, 0xffb8b2, + 0xffb5af, 0xffb2af, 0xffafb2, 0xffacb8, 0xffa9c1, 0xffa6ce, 0xffa3dd, 0xffa0f1, + 0xff9e08, 0xff9b23, 0xff9842, 0xff9564, 0xff928b, 0xff8fb6, 0xff8ce6, 0xff8a1a, + 0xff8752, 0xff848f, 0xff81d1, 0xff7f18, 0xff7c63, 0xff79b4, 0xff770a, 0xff7465, + 0xff71c6, 0xff6f2c, 0xff6c97, 0xff6a09, 0xff6780, 0xff64fd, 0xff6280, 0xff6009, + 0xff5d98, 0xff5b2d, 0xff58c9, 0xff566b, 0xff5414, 0xff51c4, 0xff4f7a, 0xff4d37, + 0xff4afb, 0xff48c5, 0xff4697, 0xff4470, 0xff4251, 0xff4038, 0xff3e27, 0xff3c1e, + 0xff3a1b, 0xff3821, 0xff362e, 0xff3444, 0xff3260, 0xff3085, 0xff2eb2, 0xff2ce7, + 0xff2b24, 0xff296a, 0xff27b7, 0xff260d, 0xff246b, 0xff22d2, 0xff2141, 0xff1fb9, + 0xff1e3a, 0xff1cc3, 0xff1b55, 0xff19f0, 0xff1894, 0xff1740, 0xff15f6, 0xff14b4, + 0xff137c, 0xff124d, 0xff1127, 0xff100a, 0xff0ef6, 0xff0dec, 0xff0ceb, 0xff0bf4, + 0xff0b05, 0xff0a21, 0xff0945, 0xff0874, 0xff07ac, 0xff06ed, 0xff0638, 0xff058d, + 0xff04eb, 0xff0453, 0xff03c4, 0xff0340, 0xff02c5, 0xff0254, 0xff01ec, 0xff018f, + 0xff013b, 0xff00f1, 0xff00b1, 0xff007b, 0xff004e, 0xff002c, 0xff0013, 0xff0004 +}; + +static const INT16 CX4_SinTable[512] = +{ + 0, 402, 804, 1206, 1607, 2009, 2410, 2811, + 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, + 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, + 9512, 9896, 10278, 10659, 11039, 11416, 11793, 12167, + 12539, 12910, 13278, 13645, 14010, 14372, 14732, 15090, + 15446, 15800, 16151, 16499, 16846, 17189, 17530, 17869, + 18204, 18537, 18868, 19195, 19519, 19841, 20159, 20475, + 20787, 21097, 21403, 21706, 22005, 22301, 22594, 22884, + 23170, 23453, 23732, 24007, 24279, 24547, 24812, 25073, + 25330, 25583, 25832, 26077, 26319, 26557, 26790, 27020, + 27245, 27466, 27684, 27897, 28106, 28310, 28511, 28707, + 28898, 29086, 29269, 29447, 29621, 29791, 29956, 30117, + 30273, 30425, 30572, 30714, 30852, 30985, 31114, 31237, + 31357, 31471, 31581, 31685, 31785, 31881, 31971, 32057, + 32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568, + 32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765, + 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, + 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, + 32138, 32057, 31971, 31881, 31785, 31685, 31581, 31471, + 31357, 31237, 31114, 30985, 30852, 30714, 30572, 30425, + 30273, 30117, 29956, 29791, 29621, 29447, 29269, 29086, + 28898, 28707, 28511, 28310, 28106, 27897, 27684, 27466, + 27245, 27020, 26790, 26557, 26319, 26077, 25832, 25583, + 25330, 25073, 24812, 24547, 24279, 24007, 23732, 23453, + 23170, 22884, 22594, 22301, 22005, 21706, 21403, 21097, + 20787, 20475, 20159, 19841, 19519, 19195, 18868, 18537, + 18204, 17869, 17530, 17189, 16846, 16499, 16151, 15800, + 15446, 15090, 14732, 14372, 14010, 13645, 13278, 12910, + 12539, 12167, 11793, 11416, 11039, 10659, 10278, 9896, + 9512, 9126, 8739, 8351, 7961, 7571, 7179, 6786, + 6392, 5997, 5602, 5205, 4808, 4409, 4011, 3611, + 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, + 0, -402, -804, -1206, -1607, -2009, -2410, -2811, + -3211, -3611, -4011, -4409, -4808, -5205, -5602, -5997, + -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, + -9512, -9896, -10278, -10659, -11039, -11416, -11793, -12167, + -12539, -12910, -13278, -13645, -14010, -14372, -14732, -15090, + -15446, -15800, -16151, -16499, -16846, -17189, -17530, -17869, + -18204, -18537, -18868, -19195, -19519, -19841, -20159, -20475, + -20787, -21097, -21403, -21706, -22005, -22301, -22594, -22884, + -23170, -23453, -23732, -24007, -24279, -24547, -24812, -25073, + -25330, -25583, -25832, -26077, -26319, -26557, -26790, -27020, + -27245, -27466, -27684, -27897, -28106, -28310, -28511, -28707, + -28898, -29086, -29269, -29447, -29621, -29791, -29956, -30117, + -30273, -30425, -30572, -30714, -30852, -30985, -31114, -31237, + -31357, -31471, -31581, -31685, -31785, -31881, -31971, -32057, + -32138, -32214, -32285, -32351, -32413, -32469, -32521, -32568, + -32610, -32647, -32679, -32706, -32728, -32745, -32758, -32765, + -32767, -32765, -32758, -32745, -32728, -32706, -32679, -32647, + -32610, -32568, -32521, -32469, -32413, -32351, -32285, -32214, + -32138, -32057, -31971, -31881, -31785, -31685, -31581, -31471, + -31357, -31237, -31114, -30985, -30852, -30714, -30572, -30425, + -30273, -30117, -29956, -29791, -29621, -29447, -29269, -29086, + -28898, -28707, -28511, -28310, -28106, -27897, -27684, -27466, + -27245, -27020, -26790, -26557, -26319, -26077, -25832, -25583, + -25330, -25073, -24812, -24547, -24279, -24007, -23732, -23453, + -23170, -22884, -22594, -22301, -22005, -21706, -21403, -21097, + -20787, -20475, -20159, -19841, -19519, -19195, -18868, -18537, + -18204, -17869, -17530, -17189, -16846, -16499, -16151, -15800, + -15446, -15090, -14732, -14372, -14010, -13645, -13278, -12910, + -12539, -12167, -11793, -11416, -11039, -10659, -10278, -9896, + -9512, -9126, -8739, -8351, -7961, -7571, -7179, -6786, + -6392, -5997, -5602, -5205, -4808, -4409, -4011, -3611, + -3211, -2811, -2410, -2009, -1607, -1206, -804, -402 +}; + +static const INT16 CX4_CosTable[512] = +{ + 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, + 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, + 32138, 32057, 31971, 31881, 31785, 31685, 31581, 31471, + 31357, 31237, 31114, 30985, 30852, 30714, 30572, 30425, + 30273, 30117, 29956, 29791, 29621, 29447, 29269, 29086, + 28898, 28707, 28511, 28310, 28106, 27897, 27684, 27466, + 27245, 27020, 26790, 26557, 26319, 26077, 25832, 25583, + 25330, 25073, 24812, 24547, 24279, 24007, 23732, 23453, + 23170, 22884, 22594, 22301, 22005, 21706, 21403, 21097, + 20787, 20475, 20159, 19841, 19519, 19195, 18868, 18537, + 18204, 17869, 17530, 17189, 16846, 16499, 16151, 15800, + 15446, 15090, 14732, 14372, 14010, 13645, 13278, 12910, + 12539, 12167, 11793, 11416, 11039, 10659, 10278, 9896, + 9512, 9126, 8739, 8351, 7961, 7571, 7179, 6786, + 6392, 5997, 5602, 5205, 4808, 4409, 4011, 3611, + 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, + 0, -402, -804, -1206, -1607, -2009, -2410, -2811, + -3211, -3611, -4011, -4409, -4808, -5205, -5602, -5997, + -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, + -9512, -9896, -10278, -10659, -11039, -11416, -11793, -12167, + -12539, -12910, -13278, -13645, -14010, -14372, -14732, -15090, + -15446, -15800, -16151, -16499, -16846, -17189, -17530, -17869, + -18204, -18537, -18868, -19195, -19519, -19841, -20159, -20475, + -20787, -21097, -21403, -21706, -22005, -22301, -22594, -22884, + -23170, -23453, -23732, -24007, -24279, -24547, -24812, -25073, + -25330, -25583, -25832, -26077, -26319, -26557, -26790, -27020, + -27245, -27466, -27684, -27897, -28106, -28310, -28511, -28707, + -28898, -29086, -29269, -29447, -29621, -29791, -29956, -30117, + -30273, -30425, -30572, -30714, -30852, -30985, -31114, -31237, + -31357, -31471, -31581, -31685, -31785, -31881, -31971, -32057, + -32138, -32214, -32285, -32351, -32413, -32469, -32521, -32568, + -32610, -32647, -32679, -32706, -32728, -32745, -32758, -32765, + -32767, -32765, -32758, -32745, -32728, -32706, -32679, -32647, + -32610, -32568, -32521, -32469, -32413, -32351, -32285, -32214, + -32138, -32057, -31971, -31881, -31785, -31685, -31581, -31471, + -31357, -31237, -31114, -30985, -30852, -30714, -30572, -30425, + -30273, -30117, -29956, -29791, -29621, -29447, -29269, -29086, + -28898, -28707, -28511, -28310, -28106, -27897, -27684, -27466, + -27245, -27020, -26790, -26557, -26319, -26077, -25832, -25583, + -25330, -25073, -24812, -24547, -24279, -24007, -23732, -23453, + -23170, -22884, -22594, -22301, -22005, -21706, -21403, -21097, + -20787, -20475, -20159, -19841, -19519, -19195, -18868, -18537, + -18204, -17869, -17530, -17189, -16846, -16499, -16151, -15800, + -15446, -15090, -14732, -14372, -14010, -13645, -13278, -12910, + -12539, -12167, -11793, -11416, -11039, -10659, -10278, -9896, + -9512, -9126, -8739, -8351, -7961, -7571, -7179, -6786, + -6392, -5997, -5602, -5205, -4808, -4409, -4011, -3611, + -3211, -2811, -2410, -2009, -1607, -1206, -804, -402, + 0, 402, 804, 1206, 1607, 2009, 2410, 2811, + 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, + 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, + 9512, 9896, 10278, 10659, 11039, 11416, 11793, 12167, + 12539, 12910, 13278, 13645, 14010, 14372, 14732, 15090, + 15446, 15800, 16151, 16499, 16846, 17189, 17530, 17869, + 18204, 18537, 18868, 19195, 19519, 19841, 20159, 20475, + 20787, 21097, 21403, 21706, 22005, 22301, 22594, 22884, + 23170, 23453, 23732, 24007, 24279, 24547, 24812, 25073, + 25330, 25583, 25832, 26077, 26319, 26557, 26790, 27020, + 27245, 27466, 27684, 27897, 28106, 28310, 28511, 28707, + 28898, 29086, 29269, 29447, 29621, 29791, 29956, 30117, + 30273, 30425, 30572, 30714, 30852, 30985, 31114, 31237, + 31357, 31471, 31581, 31685, 31785, 31881, 31971, 32057, + 32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568, + 32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765 +}; diff --git a/src/mame/machine/cx4fn.inc b/src/mame/machine/cx4fn.inc new file mode 100644 index 00000000000..2b5a302a227 --- /dev/null +++ b/src/mame/machine/cx4fn.inc @@ -0,0 +1,331 @@ +// license:GPL-2.0+ +// copyright-holders:byuu, Nach +/*************************************************************************** + + cx4fn.c + + Code based on original work by zsKnight, anomie and Nach. + This implementation is based on C++ "cx4*.cpp" by byuu. + (up to date with source v 0.49). + +***************************************************************************/ + +#include +#define CX4_Tan(a) (CX4_CosTable[a] ? ((((INT32)CX4_SinTable[a]) << 16) / CX4_CosTable[a]) : 0x80000000) +#define CX4_sar(b, n) ((b) >> (n)) +#ifdef PI +#undef PI +#endif +#define PI 3.1415926535897932384626433832795 + +//Wireframe Helpers +static void CX4_C4TransfWireFrame(void) +{ + cx4.c4x = (double)cx4.C4WFXVal; + cx4.c4y = (double)cx4.C4WFYVal; + cx4.c4z = (double)cx4.C4WFZVal - 0x95; + + //Rotate X + cx4.tanval = -(double)cx4.C4WFX2Val * PI * 2 / 128; + cx4.c4y2 = cx4.c4y * cos(cx4.tanval) - cx4.c4z * sin(cx4.tanval); + cx4.c4z2 = cx4.c4y * sin(cx4.tanval) + cx4.c4z * cos(cx4.tanval); + + //Rotate Y + cx4.tanval = -(double)cx4.C4WFY2Val * PI * 2 / 128; + cx4.c4x2 = cx4.c4x * cos(cx4.tanval) + cx4.c4z2 * sin(cx4.tanval); + cx4.c4z = cx4.c4x * -sin(cx4.tanval) + cx4.c4z2 * cos(cx4.tanval); + + //Rotate Z + cx4.tanval = -(double)cx4.C4WFDist * PI * 2 / 128; + cx4.c4x = cx4.c4x2 * cos(cx4.tanval) - cx4.c4y2 * sin(cx4.tanval); + cx4.c4y = cx4.c4x2 * sin(cx4.tanval) + cx4.c4y2 * cos(cx4.tanval); + + //Scale + cx4.C4WFXVal = (INT16)(cx4.c4x * cx4.C4WFScale / (0x90 * (cx4.c4z + 0x95)) * 0x95); + cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / (0x90 * (cx4.c4z + 0x95)) * 0x95); +} + +static void CX4_C4CalcWireFrame(void) +{ + cx4.C4WFXVal = cx4.C4WFX2Val - cx4.C4WFXVal; + cx4.C4WFYVal = cx4.C4WFY2Val - cx4.C4WFYVal; + + if(abs(cx4.C4WFXVal) > abs(cx4.C4WFYVal)) + { + cx4.C4WFDist = abs(cx4.C4WFXVal) + 1; + cx4.C4WFYVal = (256 * (long)cx4.C4WFYVal) / abs(cx4.C4WFXVal); + cx4.C4WFXVal = (cx4.C4WFXVal < 0) ? -256 : 256; + } + else if(cx4.C4WFYVal != 0) + { + cx4.C4WFDist = abs(cx4.C4WFYVal) + 1; + cx4.C4WFXVal = (256 * (long)cx4.C4WFXVal) / abs(cx4.C4WFYVal); + cx4.C4WFYVal = (cx4.C4WFYVal < 0) ? -256 : 256; + } + else + { + cx4.C4WFDist = 0; + } +} + +static void CX4_C4TransfWireFrame2(void) +{ + cx4.c4x = (double)cx4.C4WFXVal; + cx4.c4y = (double)cx4.C4WFYVal; + cx4.c4z = (double)cx4.C4WFZVal; + + //Rotate X + cx4.tanval = -(double)cx4.C4WFX2Val * PI * 2 / 128; + cx4.c4y2 = cx4.c4y * cos(cx4.tanval) - cx4.c4z * sin(cx4.tanval); + cx4.c4z2 = cx4.c4y * sin(cx4.tanval) + cx4.c4z * cos(cx4.tanval); + + //Rotate Y + cx4.tanval = -(double)cx4.C4WFY2Val * PI * 2 / 128; + cx4.c4x2 = cx4.c4x * cos(cx4.tanval) + cx4.c4z2 * sin(cx4.tanval); + cx4.c4z = cx4.c4x * -sin(cx4.tanval) + cx4.c4z2 * cos(cx4.tanval); + + //Rotate Z + cx4.tanval = -(double)cx4.C4WFDist * PI * 2 / 128; + cx4.c4x = cx4.c4x2 * cos(cx4.tanval) - cx4.c4y2 * sin(cx4.tanval); + cx4.c4y = cx4.c4x2 * sin(cx4.tanval) + cx4.c4y2 * cos(cx4.tanval); + + //Scale + cx4.C4WFXVal = (INT16)(cx4.c4x * cx4.C4WFScale / 0x100); + cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / 0x100); +} + +static void CX4_C4DrawWireFrame(running_machine &machine) +{ + UINT32 line = CX4_readl(0x1f80); + UINT32 point1, point2; + INT16 X1, Y1, Z1; + INT16 X2, Y2, Z2; + UINT8 Color; + INT32 i; + + address_space &space = machine.device("maincpu")->space(AS_PROGRAM); + for(i = cx4.ram[0x0295]; i > 0; i--, line += 5) + { + if(space.read_byte(line) == 0xff && + space.read_byte(line + 1) == 0xff) + { + INT32 tmp = line - 5; + while(space.read_byte(tmp + 2) == 0xff && + space.read_byte(tmp + 3) == 0xff && + (tmp + 2) >= 0) + { + tmp -= 5; + } + point1 = (CX4_read(0x1f82) << 16) | + (space.read_byte(tmp + 2) << 8) | + space.read_byte(tmp + 3); + } + else + { + point1 = (CX4_read(0x1f82) << 16) | + (space.read_byte(line) << 8) | + space.read_byte(line + 1); + } + point2 = (CX4_read(0x1f82) << 16) | + (space.read_byte(line + 2) << 8) | + space.read_byte(line + 3); + + X1=(space.read_byte(point1 + 0) << 8) | + space.read_byte(point1 + 1); + Y1=(space.read_byte(point1 + 2) << 8) | + space.read_byte(point1 + 3); + Z1=(space.read_byte(point1 + 4) << 8) | + space.read_byte(point1 + 5); + X2=(space.read_byte(point2 + 0) << 8) | + space.read_byte(point2 + 1); + Y2=(space.read_byte(point2 + 2) << 8) | + space.read_byte(point2 + 3); + Z2=(space.read_byte(point2 + 4) << 8) | + space.read_byte(point2 + 5); + Color = space.read_byte(line + 4); + CX4_C4DrawLine(X1, Y1, Z1, X2, Y2, Z2, Color); + } +} + +static void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color) +{ + INT32 i; + + //Transform coordinates + cx4.C4WFXVal = (INT16)X1; + cx4.C4WFYVal = (INT16)Y1; + cx4.C4WFZVal = Z1; + cx4.C4WFScale = CX4_read(0x1f90); + cx4.C4WFX2Val = CX4_read(0x1f86); + cx4.C4WFY2Val = CX4_read(0x1f87); + cx4.C4WFDist = CX4_read(0x1f88); + CX4_C4TransfWireFrame2(); + X1 = (cx4.C4WFXVal + 48) << 8; + Y1 = (cx4.C4WFYVal + 48) << 8; + + cx4.C4WFXVal = (INT16)X2; + cx4.C4WFYVal = (INT16)Y2; + cx4.C4WFZVal = Z2; + CX4_C4TransfWireFrame2(); + X2 = (cx4.C4WFXVal + 48) << 8; + Y2 = (cx4.C4WFYVal + 48) << 8; + + //Get line info + cx4.C4WFXVal = (INT16)(X1 >> 8); + cx4.C4WFYVal = (INT16)(Y1 >> 8); + cx4.C4WFX2Val = (INT16)(X2 >> 8); + cx4.C4WFY2Val = (INT16)(Y2 >> 8); + CX4_C4CalcWireFrame(); + X2 = (INT16)cx4.C4WFXVal; + Y2 = (INT16)cx4.C4WFYVal; + + //Render line + for(i = cx4.C4WFDist ? cx4.C4WFDist : 1; i > 0; i--) + { + if(X1 > 0xff && Y1 > 0xff && X1 < 0x6000 && Y1 < 0x6000) + { + UINT16 addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + (((X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2; + UINT8 bit = 0x80 >> ((X1 >> 8) & 7); + cx4.ram[addr + 0x300] &= ~bit; + cx4.ram[addr + 0x301] &= ~bit; + if(Color & 1) + { + cx4.ram[addr + 0x300] |= bit; + } + if(Color & 2) + { + cx4.ram[addr + 0x301] |= bit; + } + } + X1 += X2; + Y1 += Y2; + } +} + +static void CX4_C4DoScaleRotate(int row_padding) +{ + INT16 A, B, C, D; + INT32 x, y; + + //Calculate Pixel Resolution + UINT8 w = CX4_read(0x1f89) & ~7; + UINT8 h = CX4_read(0x1f8c) & ~7; + + INT32 Cx = (INT16)CX4_readw(0x1f83); + INT32 Cy = (INT16)CX4_readw(0x1f86); + + INT32 LineX, LineY; + UINT32 X, Y; + UINT8 byte; + INT32 outidx = 0; + UINT8 bit = 0x80; + + //Calculate matrix + INT32 XScale = CX4_readw(0x1f8f); + INT32 YScale = CX4_readw(0x1f92); + + if(XScale & 0x8000) + { + XScale = 0x7fff; + } + if(YScale & 0x8000) + { + YScale = 0x7fff; + } + + if(CX4_readw(0x1f80) == 0) + { //no rotation + A = (INT16)XScale; + B = 0; + C = 0; + D = (INT16)YScale; + } + else if(CX4_readw(0x1f80) == 128) + { //90 degree rotation + A = 0; + B = (INT16)(-YScale); + C = (INT16)XScale; + D = 0; + } + else if(CX4_readw(0x1f80) == 256) + { //180 degree rotation + A = (INT16)(-XScale); + B = 0; + C = 0; + D = (INT16)(-YScale); + } + else if(CX4_readw(0x1f80) == 384) + { //270 degree rotation + A = 0; + B = (INT16)YScale; + C = (INT16)(-XScale); + D = 0; + } + else + { + A = (INT16) CX4_sar(CX4_CosTable[CX4_readw(0x1f80) & 0x1ff] * XScale, 15); + B = (INT16)(-CX4_sar(CX4_SinTable[CX4_readw(0x1f80) & 0x1ff] * YScale, 15)); + C = (INT16) CX4_sar(CX4_SinTable[CX4_readw(0x1f80) & 0x1ff] * XScale, 15); + D = (INT16) CX4_sar(CX4_CosTable[CX4_readw(0x1f80) & 0x1ff] * YScale, 15); + } + + //Clear the output RAM + memset(cx4.ram, 0, (w + row_padding / 4) * h / 2); + + //Calculate start position (i.e. (Ox, Oy) = (0, 0)) + //The low 12 bits are fractional, so (Cx<<12) gives us the Cx we want in + //the function. We do Cx*A etc normally because the matrix parameters + //already have the fractional parts. + LineX = (Cx << 12) - Cx * A - Cx * B; + LineY = (Cy << 12) - Cy * C - Cy * D; + + //Start loop + for(y = 0; y < h; y++) + { + X = LineX; + Y = LineY; + for(x = 0; x < w; x++) + { + if((X >> 12) >= w || (Y >> 12) >= h) + { + byte = 0; + } + else + { + UINT32 addr = (Y >> 12) * w + (X >> 12); + byte = CX4_read(0x600 + (addr >> 1)); + if(addr & 1) + { + byte >>= 4; + } + } + + //De-bitplanify + if(byte & 1) { cx4.ram[outidx ] |= bit; } + if(byte & 2) { cx4.ram[outidx + 1] |= bit; } + if(byte & 4) { cx4.ram[outidx + 16] |= bit; } + if(byte & 8) { cx4.ram[outidx + 17] |= bit; } + + bit >>= 1; + if(!bit) + { + bit = 0x80; + outidx += 32; + } + + X += A; //Add 1 to output x => add an A and a C + Y += C; + } + outidx += 2 + row_padding; + if(outidx & 0x10) + { + outidx &= ~0x10; + } + else + { + outidx -= w * 4 + row_padding; + } + LineX += B; //Add 1 to output y => add a B and a D + LineY += D; + } +} diff --git a/src/mame/machine/cx4oam.inc b/src/mame/machine/cx4oam.inc new file mode 100644 index 00000000000..abf74defea2 --- /dev/null +++ b/src/mame/machine/cx4oam.inc @@ -0,0 +1,308 @@ +// license:GPL-2.0+ +// copyright-holders:byuu, Nach +/*************************************************************************** + + cx4oam.c + + Code based on original work by zsKnight, anomie and Nach. + This implementation is based on C++ "cx4*.cpp" by byuu + (up to date with source v 0.49). + +***************************************************************************/ + +//Build OAM +static void CX4_op00_00(running_machine &machine) +{ + INT32 i; + + UINT32 oamptr = cx4.ram[0x626] << 2; + UINT16 globalx, globaly; + UINT32 oamptr2; + INT16 sprx, spry; + UINT8 sprname, sprattr; + UINT8 sprcount; + UINT8 offset; + UINT32 srcptr; + + for(i = 0x1fd; i > oamptr && i >= 0; i -= 4) + { + //clear oam-to-be + if(i >= 0) + { + cx4.ram[i] = 0xe0; + } + } + + globalx = CX4_readw(0x621); + globaly = CX4_readw(0x623); + oamptr2 = 0x200 + (cx4.ram[0x626] >> 2); + + if(!cx4.ram[0x620]) + { + return; + } + + sprcount = 128 - cx4.ram[0x626]; + offset = (cx4.ram[0x626] & 3) * 2; + srcptr = 0x220; + + address_space &space = machine.device("maincpu")->space(AS_PROGRAM); + for(i = cx4.ram[0x620]; i > 0 && sprcount > 0; i--, srcptr += 16) + { + UINT32 spraddr = CX4_readl(srcptr + 7); + + sprx = CX4_readw(srcptr) - globalx; + spry = CX4_readw(srcptr + 2) - globaly; + sprname = cx4.ram[srcptr + 5]; + sprattr = cx4.ram[srcptr + 4] | cx4.ram[srcptr + 6]; + + if(space.read_byte(spraddr)) + { + INT16 x, y; + INT32 sprcnt; + for(sprcnt = space.read_byte(spraddr++); sprcnt > 0 && sprcount > 0; sprcnt--, spraddr += 4) + { + x = (INT8)space.read_byte(spraddr + 1); + if(sprattr & 0x40) + { + x = -x - ((space.read_byte(spraddr) & 0x20) ? 16 : 8); + } + x += sprx; + if(x >= -16 && x <= 272) + { + y = (INT8)space.read_byte(spraddr + 2); + if(sprattr & 0x80) + { + y = -y - ((space.read_byte(spraddr) & 0x20) ? 16 : 8); + } + y += spry; + if(y >= -16 && y <= 224) + { + cx4.ram[oamptr ] = (UINT8)x; + cx4.ram[oamptr + 1] = (UINT8)y; + cx4.ram[oamptr + 2] = sprname + space.read_byte(spraddr + 3); + cx4.ram[oamptr + 3] = sprattr ^ (space.read_byte(spraddr) & 0xc0); + cx4.ram[oamptr2] &= ~(3 << offset); + if(x & 0x100) + { + cx4.ram[oamptr2] |= 1 << offset; + } + if(space.read_byte(spraddr) & 0x20) + { + cx4.ram[oamptr2] |= 2 << offset; + } + oamptr += 4; + sprcount--; + offset = (offset + 2) & 6; + if(!offset) + { + oamptr2++; + } + } + } + } + } + else if(sprcount > 0) + { + cx4.ram[oamptr ] = (UINT8)sprx; + cx4.ram[oamptr + 1] = (UINT8)spry; + cx4.ram[oamptr + 2] = sprname; + cx4.ram[oamptr + 3] = sprattr; + cx4.ram[oamptr2] &= ~(3 << offset); + if(sprx & 0x100) + { + cx4.ram[oamptr2] |= 3 << offset; + } + else + { + cx4.ram[oamptr2] |= 2 << offset; + } + oamptr += 4; + sprcount--; + offset = (offset + 2) & 6; + if(!offset) + { + oamptr2++; + } + } + } +} + +//Scale and Rotate +static void CX4_op00_03(void) +{ + CX4_C4DoScaleRotate(0); +} + +//Transform Lines +static void CX4_op00_05(running_machine &machine) +{ + INT32 i; + UINT32 ptr = 0, ptr2 = 0; + + cx4.C4WFX2Val = CX4_read(0x1f83); + cx4.C4WFY2Val = CX4_read(0x1f86); + cx4.C4WFDist = CX4_read(0x1f89); + cx4.C4WFScale = CX4_read(0x1f8c); + + //Transform Vertices + for(i = CX4_readw(0x1f80); i > 0; i--, ptr += 0x10) + { + cx4.C4WFXVal = CX4_readw(ptr + 1); + cx4.C4WFYVal = CX4_readw(ptr + 5); + cx4.C4WFZVal = CX4_readw(ptr + 9); + CX4_C4TransfWireFrame(); + + //Displace + CX4_writew(machine, ptr + 1, cx4.C4WFXVal + 0x80); + CX4_writew(machine, ptr + 5, cx4.C4WFYVal + 0x50); + } + + CX4_writew(machine, 0x600, 23); + CX4_writew(machine, 0x602, 0x60); + CX4_writew(machine, 0x605, 0x40); + CX4_writew(machine, 0x600 + 8, 23); + CX4_writew(machine, 0x602 + 8, 0x60); + CX4_writew(machine, 0x605 + 8, 0x40); + + ptr = 0xb02; + + for(i = CX4_readw(0xb00); i > 0; i--, ptr += 2, ptr2 += 8) + { + cx4.C4WFXVal = CX4_readw((CX4_read(ptr + 0) << 4) + 1); + cx4.C4WFYVal = CX4_readw((CX4_read(ptr + 0) << 4) + 5); + cx4.C4WFX2Val = CX4_readw((CX4_read(ptr + 1) << 4) + 1); + cx4.C4WFY2Val = CX4_readw((CX4_read(ptr + 1) << 4) + 5); + CX4_C4CalcWireFrame(); + CX4_writew(machine, ptr2 + 0x600, cx4.C4WFDist ? cx4.C4WFDist : 1); + CX4_writew(machine, ptr2 + 0x602, cx4.C4WFXVal); + CX4_writew(machine, ptr2 + 0x605, cx4.C4WFYVal); + } +} + +//Scale and Rotate +static void CX4_op00_07(void) +{ + CX4_C4DoScaleRotate(64); +} + +//Draw Wireframe +static void CX4_op00_08(running_machine &machine) +{ + CX4_C4DrawWireFrame(machine); +} + +//Disintegrate +static void CX4_op00_0b(running_machine &machine) +{ + UINT8 width, height; + UINT32 startx, starty; + UINT32 srcptr; + UINT32 x, y; + INT32 scalex, scaley; + INT32 cx, cy; + INT32 i, j; + + width = CX4_read(0x1f89); + height = CX4_read(0x1f8c); + cx = CX4_readw(0x1f80); + cy = CX4_readw(0x1f83); + + scalex = (INT16)CX4_readw(0x1f86); + scaley = (INT16)CX4_readw(0x1f8f); + startx = -cx * scalex + (cx << 8); + starty = -cy * scaley + (cy << 8); + srcptr = 0x600; + + for(i = 0; i < (width * height) >> 1; i++) + { + CX4_write(machine, i, 0); + } + + for(y = starty, i = 0;i < height; i++, y += scaley) + { + for(x = startx, j = 0;j < width; j++, x += scalex) + { + if((x >> 8) < width && (y >> 8) < height && (y >> 8) * width + (x >> 8) < 0x2000) + { + UINT8 pixel = (j & 1) ? (cx4.ram[srcptr] >> 4) : (cx4.ram[srcptr]); + INT32 index = (y >> 11) * width * 4 + (x >> 11) * 32 + ((y >> 8) & 7) * 2; + UINT8 mask = 0x80 >> ((x >> 8) & 7); + + if(pixel & 1) cx4.ram[index ] |= mask; + if(pixel & 2) cx4.ram[index + 1] |= mask; + if(pixel & 4) cx4.ram[index + 16] |= mask; + if(pixel & 8) cx4.ram[index + 17] |= mask; + } + if(j & 1) + { + srcptr++; + } + } + } +} + +//Bitplane Wave +static void CX4_op00_0c(running_machine &machine) +{ + int i, j; + UINT32 destptr = 0; + UINT32 waveptr = CX4_read(0x1f83); + UINT16 mask1 = 0xc0c0; + UINT16 mask2 = 0x3f3f; + + for(j = 0; j < 0x10; j++) + { + do + { + INT16 height = -((INT8)CX4_read(waveptr + 0xb00)) - 16; + for(i = 0; i < 40; i++) + { + UINT16 temp = CX4_readw(destptr + CX4_wave_data[i]) & mask2; + if(height >= 0) + { + if(height < 8) + { + temp |= mask1 & CX4_readw(0xa00 + height * 2); + } + else + { + temp |= mask1 & 0xff00; + } + } + CX4_writew(machine, destptr + CX4_wave_data[i], temp); + height++; + } + waveptr = (waveptr + 1) & 0x7f; + mask1 = (mask1 >> 2) | (mask1 << 6); + mask2 = (mask2 >> 2) | (mask2 << 6); + } while(mask1 != 0xc0c0); + destptr += 16; + + do + { + INT16 height = -((INT8)CX4_read(waveptr + 0xb00)) - 16; + for(i = 0; i < 40; i++) + { + UINT16 temp = CX4_readw(destptr + CX4_wave_data[i]) & mask2; + if(height >= 0) + { + if(height < 8) + { + temp |= mask1 & CX4_readw(0xa10 + height * 2); + } + else + { + temp |= mask1 & 0xff00; + } + } + CX4_writew(machine, destptr + CX4_wave_data[i], temp); + height++; + } + waveptr = (waveptr + 1) & 0x7f; + mask1 = (mask1 >> 2) | (mask1 << 6); + mask2 = (mask2 >> 2) | (mask2 << 6); + } while(mask1 != 0xc0c0); + destptr += 16; + } +} diff --git a/src/mame/machine/cx4ops.inc b/src/mame/machine/cx4ops.inc new file mode 100644 index 00000000000..02b97bc944d --- /dev/null +++ b/src/mame/machine/cx4ops.inc @@ -0,0 +1,278 @@ +// license:GPL-2.0+ +// copyright-holders:byuu, Nach +/*************************************************************************** + + cx4ops.c + + Code based on original work by zsKnight, anomie and Nach. + This implementation is based on C++ "cx4*.cpp" by byuu + (up to date with source v 0.49). + +***************************************************************************/ + +//Sprite Functions +static void CX4_op00(running_machine& machine) +{ + switch(cx4.reg[0x4d]) + { + case 0x00: CX4_op00_00(machine); break; + case 0x03: CX4_op00_03(); break; + case 0x05: CX4_op00_05(machine); break; + case 0x07: CX4_op00_07(); break; + case 0x08: CX4_op00_08(machine); break; + case 0x0b: CX4_op00_0b(machine); break; + case 0x0c: CX4_op00_0c(machine); break; + } +} + +//Draw Wireframe +static void CX4_op01(running_machine& machine) +{ + memset(cx4.ram + 0x300, 0, 2304); + CX4_C4DrawWireFrame(machine); +} + +//Propulsion +static void CX4_op05(running_machine &machine) +{ + INT32 temp = 0x10000; + if(CX4_readw(0x1f83)) + { + temp = CX4_sar((temp / CX4_readw(0x1f83)) * CX4_readw(0x1f81), 8); + } + CX4_writew(machine, 0x1f80, temp); +} + +//Set Vector length +static void CX4_op0d(running_machine &machine) +{ + cx4.C41FXVal = CX4_readw(0x1f80); + cx4.C41FYVal = CX4_readw(0x1f83); + cx4.C41FDistVal = CX4_readw(0x1f86); + cx4.tanval = sqrt(((double)cx4.C41FYVal) * ((double)cx4.C41FYVal) + ((double)cx4.C41FXVal) * ((double)cx4.C41FXVal)); + cx4.tanval = (double)cx4.C41FDistVal / cx4.tanval; + cx4.C41FYVal = (INT16)(((double)cx4.C41FYVal * cx4.tanval) * 0.99); + cx4.C41FXVal = (INT16)(((double)cx4.C41FXVal * cx4.tanval) * 0.98); + CX4_writew(machine, 0x1f89, cx4.C41FXVal); + CX4_writew(machine, 0x1f8c, cx4.C41FYVal); +} + +//Triangle +static void CX4_op10(void) +{ + cx4.r0 = CX4_ldr(0); + cx4.r1 = CX4_ldr(1); + + cx4.r4 = cx4.r0 & 0x1ff; + if(cx4.r1 & 0x8000) + { + cx4.r1 |= ~0x7fff; + } + + CX4_mul(CX4_cos(cx4.r4), cx4.r1, &cx4.r5, &cx4.r2); + cx4.r5 = (cx4.r5 >> 16) & 0xff; + cx4.r2 = (cx4.r2 << 8) + cx4.r5; + + CX4_mul(CX4_sin(cx4.r4), cx4.r1, &cx4.r5, &cx4.r3); + cx4.r5 = (cx4.r5 >> 16) & 0xff; + cx4.r3 = (cx4.r3 << 8) + cx4.r5; + + CX4_str(0, cx4.r0); + CX4_str(1, cx4.r1); + CX4_str(2, cx4.r2); + CX4_str(3, cx4.r3); + CX4_str(4, cx4.r4); + CX4_str(5, cx4.r5); +} + +//Triangle +static void CX4_op13(void) +{ + cx4.r0 = CX4_ldr(0); + cx4.r1 = CX4_ldr(1); + + cx4.r4 = cx4.r0 & 0x1ff; + + CX4_mul(CX4_cos(cx4.r4), cx4.r1, &cx4.r5, &cx4.r2); + cx4.r5 = (cx4.r5 >> 8) & 0xffff; + cx4.r2 = (cx4.r2 << 16) + cx4.r5; + + CX4_mul(CX4_sin(cx4.r4), cx4.r1, &cx4.r5, &cx4.r3); + cx4.r5 = (cx4.r5 >> 8) & 0xffff; + cx4.r3 = (cx4.r3 << 16) + cx4.r5; + + CX4_str(0, cx4.r0); + CX4_str(1, cx4.r1); + CX4_str(2, cx4.r2); + CX4_str(3, cx4.r3); + CX4_str(4, cx4.r4); + CX4_str(5, cx4.r5); +} + +//Pythagorean +static void CX4_op15(running_machine &machine) +{ + double temp = 0.0; + cx4.C41FXVal = CX4_readw(0x1f80); + cx4.C41FYVal = CX4_readw(0x1f83); + temp = sqrt((double)cx4.C41FXVal * (double)cx4.C41FXVal + (double)cx4.C41FYVal * (double)cx4.C41FYVal); + cx4.C41FDist = (INT16)temp; + CX4_writew(machine, 0x1f80, cx4.C41FDist); +} + +//Calculate distance +static void CX4_op1f(running_machine &machine) +{ + cx4.C41FXVal = CX4_readw(0x1f80); + cx4.C41FYVal = CX4_readw(0x1f83); + if(!cx4.C41FXVal) + { + cx4.C41FAngleRes = (cx4.C41FYVal > 0) ? 0x080 : 0x180; + } + else + { + cx4.tanval = ((double)cx4.C41FYVal) / ((double)cx4.C41FXVal); + cx4.C41FAngleRes = (INT16)(atan(cx4.tanval) / (PI * 2) * 512); + cx4.C41FAngleRes = cx4.C41FAngleRes; + if(cx4.C41FXVal < 0) + { + cx4.C41FAngleRes += 0x100; + } + cx4.C41FAngleRes &= 0x1ff; + } + CX4_writew(machine, 0x1f86, cx4.C41FAngleRes); +} + +//Trapezoid +static void CX4_op22(void) +{ + INT16 angle1 = CX4_readw(0x1f8c) & 0x1ff; + INT16 angle2 = CX4_readw(0x1f8f) & 0x1ff; + INT32 tan1 = CX4_Tan(angle1); + INT32 tan2 = CX4_Tan(angle2); + INT16 y = CX4_readw(0x1f83) - CX4_readw(0x1f89); + INT16 left, right; + INT32 j; + + for(j = 0; j < 225; j++, y++) + { + if(y >= 0) + { + left = CX4_sar((INT32)tan1 * y, 16) - CX4_readw(0x1f80) + CX4_readw(0x1f86); + right = CX4_sar((INT32)tan2 * y, 16) - CX4_readw(0x1f80) + CX4_readw(0x1f86) + CX4_readw(0x1f93); + + if(left < 0 && right < 0) + { + left = 1; + right = 0; + } + else if(left < 0) + { + left = 0; + } + else if(right < 0) + { + right = 0; + } + + if(left > 255 && right > 255) + { + left = 255; + right = 254; + } + else if(left > 255) + { + left = 255; + } + else if(right > 255) + { + right = 255; + } + } + else + { + left = 1; + right = 0; + } + cx4.ram[j + 0x800] = (UINT8)left; + cx4.ram[j + 0x900] = (UINT8)right; + } +} + +//Multiply +static void CX4_op25(void) +{ + cx4.r0 = CX4_ldr(0); + cx4.r1 = CX4_ldr(1); + CX4_mul(cx4.r0, cx4.r1, &cx4.r0, &cx4.r1); + CX4_str(0, cx4.r0); + CX4_str(1, cx4.r1); +} + +//Transform Coords +static void CX4_op2d(running_machine &machine) +{ + cx4.C4WFXVal = CX4_readw(0x1f81); + cx4.C4WFYVal = CX4_readw(0x1f84); + cx4.C4WFZVal = CX4_readw(0x1f87); + cx4.C4WFX2Val = CX4_read (0x1f89); + cx4.C4WFY2Val = CX4_read (0x1f8a); + cx4.C4WFDist = CX4_read (0x1f8b); + cx4.C4WFScale = CX4_readw(0x1f90); + CX4_C4TransfWireFrame2(); + CX4_writew(machine, 0x1f80, cx4.C4WFXVal); + CX4_writew(machine, 0x1f83, cx4.C4WFYVal); +} + +//Sum +static void CX4_op40(void) +{ + UINT32 i; + cx4.r0 = 0; + for(i=0;i<0x800;i++) + { + cx4.r0 += cx4.ram[i]; + } + CX4_str(0, cx4.r0); +} + +//Square +static void CX4_op54(void) +{ + cx4.r0 = CX4_ldr(0); + CX4_mul(cx4.r0, cx4.r0, &cx4.r1, &cx4.r2); + CX4_str(1, cx4.r1); + CX4_str(2, cx4.r2); +} + +//Immediate Register +static void CX4_op5c(void) +{ + CX4_str(0, 0x000000); + CX4_immediate_reg(0); +} + +//Immediate Register (Multiple) +static void CX4_op5e(void) { CX4_immediate_reg( 0); } +static void CX4_op60(void) { CX4_immediate_reg( 3); } +static void CX4_op62(void) { CX4_immediate_reg( 6); } +static void CX4_op64(void) { CX4_immediate_reg( 9); } +static void CX4_op66(void) { CX4_immediate_reg(12); } +static void CX4_op68(void) { CX4_immediate_reg(15); } +static void CX4_op6a(void) { CX4_immediate_reg(18); } +static void CX4_op6c(void) { CX4_immediate_reg(21); } +static void CX4_op6e(void) { CX4_immediate_reg(24); } +static void CX4_op70(void) { CX4_immediate_reg(27); } +static void CX4_op72(void) { CX4_immediate_reg(30); } +static void CX4_op74(void) { CX4_immediate_reg(33); } +static void CX4_op76(void) { CX4_immediate_reg(36); } +static void CX4_op78(void) { CX4_immediate_reg(39); } +static void CX4_op7a(void) { CX4_immediate_reg(42); } +static void CX4_op7c(void) { CX4_immediate_reg(45); } + +//Immediate ROM +static void CX4_op89(void) +{ + CX4_str(0, 0x054336); + CX4_str(1, 0xffffff); +} diff --git a/src/mame/machine/cybiko.c b/src/mame/machine/cybiko.c new file mode 100644 index 00000000000..6da702b34c3 --- /dev/null +++ b/src/mame/machine/cybiko.c @@ -0,0 +1,492 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/* + + Cybiko Wireless Inter-tainment System + + (c) 2001-2007 Tim Schuerewegen + + Cybiko Classic (V1) + Cybiko Classic (V2) + Cybiko Xtreme + +*/ + +#include "includes/cybiko.h" + +#define LOG_LEVEL 1 +#define _logerror(level,x) do { if (LOG_LEVEL > level) logerror x; } while (0) + +#define RAMDISK_SIZE (512 * 1024) + + +//////////////////////// +// DRIVER INIT & EXIT // +//////////////////////// + +DRIVER_INIT_MEMBER(cybiko_state,cybiko) +{ + _logerror( 0, ("init_cybikov1\n")); + m_maincpu->space(AS_PROGRAM).install_ram(0x200000, 0x200000 + m_ram->size() - 1, 0, 0x200000 - m_ram->size(), m_ram->pointer()); +} + +DRIVER_INIT_MEMBER(cybiko_state,cybikoxt) +{ + _logerror( 0, ("init_cybikoxt\n")); + m_maincpu->space(AS_PROGRAM).install_ram(0x400000, 0x400000 + m_ram->size() - 1, 0, 0x200000 - m_ram->size(), m_ram->pointer()); +} + +QUICKLOAD_LOAD_MEMBER( cybiko_state, cybiko ) +{ + image.fread(m_flash1->get_ptr(), MIN(image.length(), 0x84000)); + + return IMAGE_INIT_PASS; +} + +QUICKLOAD_LOAD_MEMBER( cybiko_state, cybikoxt ) +{ + address_space &dest = m_maincpu->space(AS_PROGRAM); + UINT32 size = MIN(image.length(), RAMDISK_SIZE); + + dynamic_buffer buffer(size); + image.fread(&buffer[0], size); + for (int byte = 0; byte < size; byte++) + dest.write_byte(0x400000 + byte, buffer[byte]); + + return IMAGE_INIT_PASS; +} + +/////////////////// +// MACHINE START // +/////////////////// + +void cybiko_state::machine_start() +{ + _logerror( 0, ("machine_start_cybikov1\n")); + // serial port + cybiko_rs232_init(); + // other + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybiko),this)); + + int nvram_size = RAMDISK_SIZE; + + if (m_ram->size() < nvram_size) + { + nvram_size = m_ram->size(); + } + + m_nvram->set_base(m_ram->pointer(), nvram_size); +} + +/////////////////// +// MACHINE RESET // +/////////////////// + +void cybiko_state::machine_reset() +{ + _logerror( 0, ("machine_reset_cybikov1\n")); + cybiko_rs232_reset(); +} + +////////////////// +// MACHINE STOP // +////////////////// + +void cybiko_state::machine_stop_cybiko() +{ + _logerror( 0, ("machine_stop_cybikov1\n")); + // serial port + cybiko_rs232_exit(); +} + +/////////// +// RS232 // +/////////// + + +void cybiko_state::cybiko_rs232_init() +{ + _logerror( 0, ("cybiko_rs232_init\n")); + memset( &m_rs232, 0, sizeof(m_rs232)); +// machine().scheduler().timer_pulse(TIME_IN_HZ( 10), FUNC(rs232_timer_callback)); +} + +void cybiko_state::cybiko_rs232_exit() +{ + _logerror( 0, ("cybiko_rs232_exit\n")); +} + +void cybiko_state::cybiko_rs232_reset() +{ + _logerror( 0, ("cybiko_rs232_reset\n")); +} + +void cybiko_state::cybiko_rs232_write_byte( int data ) +{ +// printf( "%c", data); +} + +void cybiko_state::cybiko_rs232_pin_sck( int data ) +{ + _logerror( 3, ("cybiko_rs232_pin_sck (%d)\n", data)); + // clock high-to-low + if ((m_rs232.pin.sck == 1) && (data == 0)) + { + // transmit + if (m_rs232.pin.txd) m_rs232.tx_byte = m_rs232.tx_byte | (1 << m_rs232.tx_bits); + m_rs232.tx_bits++; + if (m_rs232.tx_bits == 8) + { + m_rs232.tx_bits = 0; + cybiko_rs232_write_byte(m_rs232.tx_byte); + m_rs232.tx_byte = 0; + } + // receive + m_rs232.pin.rxd = (m_rs232.rx_byte >> m_rs232.rx_bits) & 1; + m_rs232.rx_bits++; + if (m_rs232.rx_bits == 8) + { + m_rs232.rx_bits = 0; + m_rs232.rx_byte = 0; + } + } + // save sck + m_rs232.pin.sck = data; +} + +void cybiko_state::cybiko_rs232_pin_txd( int data ) +{ + _logerror( 3, ("cybiko_rs232_pin_txd (%d)\n", data)); + m_rs232.pin.txd = data; +} + +int cybiko_state::cybiko_rs232_pin_rxd() +{ + _logerror( 3, ("cybiko_rs232_pin_rxd\n")); + return m_rs232.pin.rxd; +} + +int cybiko_state::cybiko_rs232_rx_queue() +{ + return 0; +} + +///////////////////////// +// READ/WRITE HANDLERS // +///////////////////////// + +READ16_MEMBER( cybiko_state::cybiko_lcd_r ) +{ + UINT16 data = 0; + if (ACCESSING_BITS_8_15) data |= (m_crtc->reg_idx_r(space, offset) << 8); + if (ACCESSING_BITS_0_7) data |= (m_crtc->reg_dat_r(space, offset) << 0); + return data; +} + +WRITE16_MEMBER( cybiko_state::cybiko_lcd_w ) +{ + if (ACCESSING_BITS_8_15) m_crtc->reg_idx_w(space, offset, (data >> 8) & 0xff); + if (ACCESSING_BITS_0_7) m_crtc->reg_dat_w(space, offset, (data >> 0) & 0xff); +} + +int cybiko_state::cybiko_key_r( offs_t offset, int mem_mask) +{ + UINT16 data = 0xFFFF; + for (UINT8 i = 0; i < 15; i++) + { + if (m_input[i] && !BIT(offset, i)) + data &= ~m_input[i]->read(); + } + if (data != 0xFFFF) + { + _logerror( 1, ("cybiko_key_r (%08X/%04X) %04X\n", offset, mem_mask, data)); + } + return data; +} + +READ16_MEMBER( cybiko_state::cybikov1_key_r ) +{ + return cybiko_key_r(offset, mem_mask); +} + +READ16_MEMBER( cybiko_state::cybikov2_key_r ) +{ + UINT16 data = cybiko_key_r(offset, mem_mask); + if (!BIT(offset, 0)) + data |= 0x0002; // or else [esc] does not work in "lost in labyrinth" + return data; +} + +READ16_MEMBER( cybiko_state::cybikoxt_key_r ) +{ + return cybiko_key_r(offset, mem_mask); +} + +#if 0 +READ16_MEMBER( cybiko_state::cybikov1_io_reg_r ) +{ + UINT16 data = 0; +#if 0 + _logerror( 2, ("cybikov1_io_reg_r (%08X)\n", offset)); + switch (offset) + { + // keyboard + case h8_device::PORT_1: + { + if (!BIT(ioport("A1")->read(), 1)) + data |= (1 << 3); // "esc" key + } + break; + // serial dataflash + case h8_device::PORT_3: + { + if (m_flash1->so_r()) + data |= H8S_P3_RXD1; + } + break; + // rs232 + case h8_device::PORT_5: + { + if (cybiko_rs232_pin_rxd()) + data |= H8S_P5_RXD2; + } + break; + // real-time clock + case h8_device::PORT_F: + { + data = H8S_PF_PF2; + if (m_rtc->sda_r()) + data |= H8S_PF_PF0; + } + break; + // serial 2 + case H8S_IO_SSR2 : + { + if (cybiko_rs232_rx_queue()) + data |= H8S_SSR_RDRF; + } + break; + } +#endif + return data; +} + +READ16_MEMBER( cybiko_state::cybikov2_io_reg_r ) +{ + UINT16 data = 0; +#if 0 + _logerror( 2, ("cybikov2_io_reg_r (%08X)\n", offset)); + switch (offset) + { + // keyboard + case h8_device::PORT_1 : + { + if (!BIT(ioport("A1")->read(), 1)) + data |= (1 << 3); // "esc" key + } + break; + // serial dataflash + case h8_device::PORT_3 : + { + if (m_flash1->so_r()) + data |= H8S_P3_RXD1; + } + break; + // rs232 + case h8_device::PORT_5 : + { + if (cybiko_rs232_pin_rxd()) + data |= H8S_P5_RXD2; + } + break; + // real-time clock + case h8_device::PORT_F : + { + data = H8S_PF_PF2; + if (m_rtc->sda_r()) + data |= H8S_PF_PF0; + } + break; + // serial 2 + case H8S_IO_SSR2 : + { + if (cybiko_rs232_rx_queue()) + data |= H8S_SSR_RDRF; + } + break; + } +#endif + return data; +} + +READ16_MEMBER( cybiko_state::cybikoxt_io_reg_r ) +{ + UINT16 data = 0; +#if 0 + _logerror( 2, ("cybikoxt_io_reg_r (%08X)\n", offset)); + switch (offset) + { + // rs232 + case h8_device::PORT_3 : + { + if (cybiko_rs232_pin_rxd()) + data |= H8S_P3_RXD1; + } + break; + // ... + case h8_device::PORT_A : + { + data |= (1 << 6); // recharge batteries (xtreme) + data |= (1 << 7); // on/off key (xtreme) + } + break; + // real-time clock + case h8_device::PORT_F : + { + if (m_rtc->sda_r()) + data |= H8S_PF_PF6; + } + break; + // serial 1 + case H8S_IO_SSR1 : + { + if (cybiko_rs232_rx_queue()) + data |= H8S_SSR_RDRF; + } + break; + } +#endif + return data; +} + +WRITE16_MEMBER( cybiko_state::cybikov1_io_reg_w ) +{ +#if 0 + _logerror( 2, ("cybikov1_io_reg_w (%08X/%02X)\n", offset, data)); + switch (offset) + { + // speaker + case H8S_IO_P1DR : + { + m_speaker->level_w((data & H8S_P1_TIOCB1) ? 1 : 0); + } + break; + // serial dataflash + case H8S_IO_P3DR : + { + m_flash1->cs_w ((data & H8S_P3_SCK0) ? 0 : 1); + m_flash1->si_w ((data & H8S_P3_TXD1) ? 1 : 0); + m_flash1->sck_w((data & H8S_P3_SCK1) ? 1 : 0); + } + break; + // rs232 + case H8S_IO_P5DR : + { + cybiko_rs232_pin_txd((data & H8S_P5_TXD2) ? 1 : 0); + cybiko_rs232_pin_sck((data & H8S_P5_SCK2) ? 1 : 0); + } + break; + // real-time clock + case H8S_IO_PFDR : + { + m_rtc->scl_w((data & H8S_PF_PF1) ? 1 : 0); + } + break; + // real-time clock + case H8S_IO_PFDDR : + { + m_rtc->sda_w((data & H8S_PF_PF0) ? 0 : 1); + } + break; + } +#endif +} + +WRITE16_MEMBER( cybiko_state::cybikov2_io_reg_w ) +{ +#if 0 + _logerror( 2, ("cybikov2_io_reg_w (%08X/%02X)\n", offset, data)); + switch (offset) + { + // speaker + case H8S_IO_P1DR : + { + m_speaker->level_w((data & H8S_P1_TIOCB1) ? 1 : 0); + } + break; + // serial dataflash + case H8S_IO_P3DR : + { + m_flash1->cs_w ((data & H8S_P3_SCK0) ? 0 : 1); + m_flash1->si_w ((data & H8S_P3_TXD1) ? 1 : 0); + m_flash1->sck_w((data & H8S_P3_SCK1) ? 1 : 0); + } + break; + // rs232 + case H8S_IO_P5DR : + { + cybiko_rs232_pin_txd((data & H8S_P5_TXD2) ? 1 : 0); + cybiko_rs232_pin_sck((data & H8S_P5_SCK2) ? 1 : 0); + } + break; + // real-time clock + case H8S_IO_PFDR : + { + m_rtc->scl_w((data & H8S_PF_PF1) ? 1 : 0); + } + break; + // real-time clock + case H8S_IO_PFDDR : + { + m_rtc->sda_w((data & H8S_PF_PF0) ? 0 : 1); + } + break; + } +#endif +} + +WRITE16_MEMBER( cybiko_state::cybikoxt_io_reg_w ) +{ +#if 0 + _logerror( 2, ("cybikoxt_io_reg_w (%08X/%02X)\n", offset, data)); + switch (offset) + { + // speaker + case H8S_IO_P1DR : + { + m_speaker->level_w((data & H8S_P1_TIOCB1) ? 1 : 0); + } + break; + // rs232 + case H8S_IO_P3DR : + { + cybiko_rs232_pin_txd((data & H8S_P3_TXD1) ? 1 : 0); + cybiko_rs232_pin_sck((data & H8S_P3_SCK1) ? 1 : 0); + } + break; + // real-time clock + case H8S_IO_PFDR : + { + m_rtc->scl_w((data & H8S_PF_PF1) ? 1 : 0); + } + break; + // real-time clock + case H8S_IO_PFDDR : + { + m_rtc->sda_w((data & H8S_PF_PF6) ? 0 : 1); + } + break; + } +#endif +} +#endif + +// Cybiko Xtreme writes following byte pairs to 0x200003/0x200000 +// 00/01, 00/C0, 0F/32, 0D/03, 0B/03, 09/50, 07/D6, 05/00, 04/00, 20/00, 23/08, 27/01, 2F/08, 2C/02, 2B/08, 28/01 +// 04/80, 05/02, 00/C8, 00/C8, 00/C0, 1B/2C, 00/01, 00/C0, 1B/6C, 0F/10, 0D/07, 0B/07, 09/D2, 07/D6, 05/00, 04/00, +// 20/00, 23/08, 27/01, 2F/08, 2C/02, 2B/08, 28/01, 37/08, 34/04, 33/08, 30/03, 04/80, 05/02, 1B/6C, 00/C8 +WRITE16_MEMBER( cybiko_state::cybiko_usb_w ) +{ + if (ACCESSING_BITS_8_15) _logerror( 2, ("[%08X] <- %02X\n", 0x200000 + offset * 2 + 0, (data >> 8) & 0xFF)); + if (ACCESSING_BITS_0_7) _logerror( 2, ("[%08X] <- %02X\n", 0x200000 + offset * 2 + 1, (data >> 0) & 0xFF)); +} diff --git a/src/mame/machine/dai.c b/src/mame/machine/dai.c new file mode 100644 index 00000000000..9ea8258f805 --- /dev/null +++ b/src/mame/machine/dai.c @@ -0,0 +1,216 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha, Nathan Woods +/*************************************************************************** + + machine/dai.c + + Functions to emulate general aspects of DAI (RAM, ROM, interrupts, I/O ports) + + Krzysztof Strzecha + Nathan Woods + +***************************************************************************/ + +#include "emu.h" +#include "includes/dai.h" + +#define DEBUG_DAI_PORTS 0 + +#define LOG_DAI_PORT_R(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port read : %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0) +#define LOG_DAI_PORT_W(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port write: %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0) + +void dai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BOOTSTRAP: + m_maincpu->set_pc(0xc000); + break; + case TIMER_TMS5501: + m_tms5501->xi7_w((ioport("IN8")->read() & 0x04) ? 1:0); + timer_set(attotime::from_hz(100), TIMER_TMS5501); + break; + default: + assert_always(FALSE, "Unknown id in dai_state::device_timer"); + } +} + + +/* Discrete I/O devices */ + + +/* Memory */ + +WRITE8_MEMBER(dai_state::dai_stack_interrupt_circuit_w) +{ + m_tms5501->sens_w(1); + m_tms5501->sens_w(0); +} + +void dai_state::dai_update_memory(int dai_rom_bank) +{ + membank("bank2")->set_entry(dai_rom_bank); +} + + +READ8_MEMBER(dai_state::dai_keyboard_r) +{ + UINT8 data = 0x00; + static const char *const keynames[] = { "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7" }; + + for (int i = 0; i < 8; i++) + { + if (m_keyboard_scan_mask & (1 << i)) + data |= ioport(keynames[i])->read(); + } + + return data; +} + +WRITE8_MEMBER(dai_state::dai_keyboard_w) +{ + m_keyboard_scan_mask = data; +} + +IRQ_CALLBACK_MEMBER(dai_state::int_ack) +{ + return m_tms5501->get_vector(); +} + +void dai_state::machine_start() +{ + membank("bank2")->configure_entries(0, 4, memregion("maincpu")->base() + 0x010000, 0x1000); + timer_set(attotime::zero, TIMER_BOOTSTRAP); + timer_set(attotime::from_hz(100), TIMER_TMS5501); + + memset(m_ram->pointer(), 0, m_ram->size()); +} + +void dai_state::machine_reset() +{ + membank("bank1")->set_base(m_ram->pointer()); +} + +/*************************************************************************** + + Discrete Devices IO + + FD00 POR1: IN bit 0 - + bit 1 - + bit 2 PIPGE: Page signal + bit 3 PIDTR: Serial output ready + bit 4 PIBU1: Button on paddle 1 (1 = closed) + bit 5 PIBU1: Button on paddle 2 (1 = closed) + bit 6 PIRPI: Random data + bit 7 PICAI: Cassette input data + + FD01 PDLST: IN Single pulse used to trigger paddle timer circuit + + FD04 POR1: OUT bit 0-3 Volume oscillator channel 0 + bit 4-7 Volume oscillator channel 1 + + FD05 POR1: OUT bit 0-3 Volume oscillator channel 2 + bit 4-7 Volume random noise generator + + FD06 POR0: OUT bit 0 POCAS: Cassette data output + bit 1-2 PDLMSK: Paddle select + bit 3 PDPNA: Paddle enable + bit 4 POCM1: Cassette 1 motor control (0 = run) + bit 5 POCM2: Cassette 2 motor control (0 = run) + bit 6-7 ROM bank switching +***************************************************************************/ + +READ8_MEMBER(dai_state::dai_io_discrete_devices_r) +{ + UINT8 data = 0x00; + + switch(offset & 0x000f) { + case 0x00: + data = ioport("IN8")->read(); + data |= 0x08; // serial ready + if (machine().rand()&0x01) + data |= 0x40; // random number generator + if (m_cassette->input() > 0.01) + data |= 0x80; // tape input + break; + + default: + data = 0xff; + LOG_DAI_PORT_R (offset, data, "discrete devices - unmapped"); + + break; + } + return data; +} + +WRITE8_MEMBER(dai_state::dai_io_discrete_devices_w) +{ + switch(offset & 0x000f) { + case 0x04: + m_sound->set_volume(space, offset, data); + LOG_DAI_PORT_W (offset, data&0x0f, "discrete devices - osc. 0 volume"); + LOG_DAI_PORT_W (offset, (data&0xf0)>>4, "discrete devices - osc. 1 volume"); + break; + + case 0x05: + m_sound->set_volume(space, offset, data); + LOG_DAI_PORT_W (offset, data&0x0f, "discrete devices - osc. 2 volume"); + LOG_DAI_PORT_W (offset, (data&0xf0)>>4, "discrete devices - noise volume"); + break; + + case 0x06: + m_paddle_select = (data&0x06)>>2; + m_paddle_enable = (data&0x08)>>3; + m_cassette_motor[0] = (data&0x10)>>4; + m_cassette_motor[1] = (data&0x20)>>5; + m_cassette->change_state(m_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_cassette->output((data & 0x01) ? -1.0 : 1.0); + dai_update_memory ((data&0xc0)>>6); + LOG_DAI_PORT_W (offset, (data&0x06)>>2, "discrete devices - paddle select"); + LOG_DAI_PORT_W (offset, (data&0x08)>>3, "discrete devices - paddle enable"); + LOG_DAI_PORT_W (offset, (data&0x10)>>4, "discrete devices - cassette motor 1"); + LOG_DAI_PORT_W (offset, (data&0x20)>>5, "discrete devices - cassette motor 2"); + LOG_DAI_PORT_W (offset, (data&0xc0)>>6, "discrete devices - ROM bank"); + break; + + default: + LOG_DAI_PORT_W (offset, data, "discrete devices - unmapped"); + break; + } +} + +/*************************************************************************** + + PIT8253 + + Offset need to be shifted by 1 to right, because the PIT is + connected to A1 and A2 + +***************************************************************************/ + +READ8_MEMBER(dai_state::dai_pit_r) +{ + return m_pit->read(space, (offset >> 1) & 3); +} + +WRITE8_MEMBER(dai_state::dai_pit_w) +{ + m_pit->write(space, (offset >> 1) & 3, data); +} + +/*************************************************************************** + + AMD 9911 mathematical coprocesor + +***************************************************************************/ + +READ8_MEMBER(dai_state::dai_amd9511_r) +{ + /* optional and no present at this moment */ + return 0xff; +} + +WRITE8_MEMBER(dai_state::dai_amd9511_w) +{ + logerror ("Writing to AMD9511 math chip, %04x, %02x\n", offset, data); +} diff --git a/src/mame/machine/dccons.c b/src/mame/machine/dccons.c new file mode 100644 index 00000000000..48f4bd372a6 --- /dev/null +++ b/src/mame/machine/dccons.c @@ -0,0 +1,196 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese, R. Belmont +/* + + dc.c - Sega Dreamcast hardware + + MESS (DC home console) hardware overrides (GD-ROM drive etc) + + c230048 - 5 is written, want 6 + c0d9d9e - where bad happens, from routine @ c0da260 + + c0d9d8e - R0 on return is the value to put in + + cfffee0 - stack location when bad happens + + TODO: + - gdrom_alt_status is identical to normal status except that "but it does not clear DMA status information when it is accessed" + +*/ + +#include "emu.h" +#include "cdrom.h" +#include "debugger.h" +#include "includes/dc.h" +#include "cpu/sh4/sh4.h" +#include "sound/aica.h" +#include "includes/dccons.h" + +#define ATAPI_CYCLES_PER_SECTOR (5000) // TBD for Dreamcast + +WRITE_LINE_MEMBER(dc_cons_state::ata_interrupt) +{ + if (state) + dc_sysctrl_regs[SB_ISTEXT] |= IST_EXT_GDROM; + else + dc_sysctrl_regs[SB_ISTEXT] &= ~IST_EXT_GDROM; + + dc_update_interrupt_status(); +} + +TIMER_CALLBACK_MEMBER(dc_cons_state::atapi_xfer_end ) +{ + UINT8 sector_buffer[ 4096 ]; + + atapi_timer->adjust(attotime::never); + + printf("atapi_xfer_end atapi_xferlen = %d\n", atapi_xferlen ); + + //osd_printf_debug("ATAPI: xfer_end. xferlen = %d\n", atapi_xferlen); + + m_ata->write_dmack(1); + + while (atapi_xferlen > 0 ) + { + struct sh4_ddt_dma ddtdata; + + // get a sector from the SCSI device + for (int i = 0; i < 2048/2; i++) + { + int d = m_ata->read_dma(); + sector_buffer[ i*2 ] = d & 0xff; + sector_buffer[ (i*2)+1 ] = d >> 8; + } + + atapi_xferlen -= 2048; + + // perform the DMA + ddtdata.destination = atapi_xferbase; // destination address + ddtdata.length = 2048/4; + ddtdata.size = 4; + ddtdata.buffer = sector_buffer; + ddtdata.direction=1; // 0 source to buffer, 1 buffer to destination + ddtdata.channel= 0; + ddtdata.mode= -1; // copy from/to buffer + printf("ATAPI: DMA one sector to %x, %x remaining\n", atapi_xferbase, atapi_xferlen); + m_maincpu->sh4_dma_ddt(&ddtdata); + + atapi_xferbase += 2048; + } + + m_ata->write_dmack(0); + + g1bus_regs[SB_GDST]=0; + dc_sysctrl_regs[SB_ISTNRM] |= IST_DMA_GDROM; + dc_update_interrupt_status(); +} + +void dc_cons_state::dreamcast_atapi_init() +{ + atapi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dc_cons_state::atapi_xfer_end),this)); + atapi_timer->adjust(attotime::never); + save_item(NAME(atapi_xferlen)); + save_item(NAME(atapi_xferbase)); +} + +/* + + GDROM regsters: + + 5f7018: alternate status/device control + 5f7080: data + 5f7084: error/features + 5f7088: interrupt reason/sector count + 5f708c: sector number + 5f7090: byte control low + 5f7094: byte control high + 5f7098: drive select + 5f709c: status/command + +c002910 - ATAPI packet writes +c002796 - aux status read after that +c000776 - DMA triggered to c008000 + +*/ + +READ32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_r ) +{ + switch(offset) + { + case SB_GDSTARD: + printf("G1CTRL: GDSTARD %08x\n", atapi_xferbase); // Hello Kitty reads here + debugger_break(machine()); + return atapi_xferbase; + case SB_GDST: + break; + case SB_GDLEND: + //debugger_break(machine()); + return atapi_xferlen; // TODO: check me + default: + printf("G1CTRL: Unmapped read %08x\n", 0x5f7400+offset*4); + debugger_break(machine()); + } + return g1bus_regs[offset]; +} + +WRITE32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_w ) +{ + g1bus_regs[offset] = data; // 5f7400+reg*4=dat +// osd_printf_verbose("G1CTRL: [%08x=%x] write %" I64FMT "x to %x, mask %" I64FMT "x\n", 0x5f7400+reg*4, dat, data, offset, mem_mask); + switch (offset) + { + case SB_GDST: + if (data & 1 && g1bus_regs[SB_GDEN] == 1) // 0 -> 1 + { + if (g1bus_regs[SB_GDDIR] == 0) + { + printf("G1CTRL: unsupported transfer\n"); + return; + } + + atapi_xferbase = g1bus_regs[SB_GDSTAR]; + //atapi_timer->adjust(m_maincpu->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048)))); + /* 12x * 75 Hz = 0,00(1) secs per sector */ + /* TODO: make DMA to be single step */ + atapi_timer->adjust(attotime::from_usec(1111*atapi_xferlen/2048)); +// atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80; + } + break; + + case SB_GDLEN: + atapi_xferlen = data; + break; + +/* + The following register is involved in BIOS checksum protection system. + current understanding of its functioning based on several hardware tests: + + after power on system is in "protected state": + - access to G1 ATA register area (5F70XX) is locked, ie GD-ROM in Dreamcast or cartridge/DIMM in arcade systems is not accessible; + - *any* data readed via G1 data bus (ie BIOS) is summed internally by chipset; + - write to GD_UNLOCK (5F74E4) register set "last address" of checksummed area; + + then readed address matches with "last address" - calculated summ compared with some hardcoded value + if values match - system becomes in "unlocked state": + - G1 ATA registers unlocked; + - by write to GD_UNLOCK register system can be switched back to "protected state" + + if values doesn't match - system switch to "locked state": + - similar to protected, but data summing seems not performed anymore, + at least write to GD_UNLOCK and "pumping" through G1 bus data chunk with valid checksumm have no effect; + - the only exit from this state - power off/on or reset; + + actual checksum algorithm is unknown, but its supposed to be simple and weak, + known few modded BIOSes which succesfully passes this CRC check, because of good luck + + all described above works the same way in all HOLLY/CLX2-based systems - Dreamcast, Naomi 1/2, Atomiswave, SystemSP +*/ + case GD_UNLOCK: + if (data==0 || data==0x001fffff || data==0x42fe) + { +// atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80; + printf("Unlocking GD-ROM! %x\n", data); + } + break; + } +} diff --git a/src/mame/machine/dec_lk201.c b/src/mame/machine/dec_lk201.c new file mode 100644 index 00000000000..b110b45cfe3 --- /dev/null +++ b/src/mame/machine/dec_lk201.c @@ -0,0 +1,760 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont, M. Burke +/* + DEC LK-201 keyboard + Emulation by R. Belmont & M. Burke + + This is the later "cost-reduced" 6805 version; there's also an 8048 version. + The LK-201 mechanical elements are described in US Patent 4,467,150 +*/ + +/* LK201-AA keyboard matrix (8048 version with updates) + Source: VCB02 Technical Reference. + + KBD controller scan matrix (PORT 1): 8 x BCD IN => 18 DECIMAL OUT + + Keyboard itself: + 18 x IN (KEYBOARD DRIVE) KBD 17... KBD 0 => + 8 OUT (keyboard data @ D7..D0) + + to => PORT 0 @ KBD controller. + +________|D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 +..KBD17:|[R] |F19 |[R] |F20|PF4|N- | N,| Enter +........| | | | | | NOTE1) +........| |G22 | |G23|E23|D23|C23| A23 +--------|----|----|----|---|---|---|---|--- +..KBD16:|F18 |PF3 |[R] |N9 |C:D|N6 |N3 |N. +........|G21 |E22 | |D22|B17|C22|B22|A22 +--------|----|----|----|---|---|---|---|--- +..KBD15:|F17 |PF2 |[R] |N8 |N5 |C:R| N2|N0 +........| | | | | | | |NOTE 2) +........|G20 |E21 | |D21|C21|B18|B21| +--------|----|----|----|---|---|---|---|--- + KBD14:|PF1 |Next|Rem-|C:U|N7 |N4 |N1 |N0 +........| |Scrn|move|...| | | | +........|E20 |D18 |E18 |C17|D20|C20|B20|A20 +--------|----|----|----|---|---|---|---|--- +..KBD13:|Ins.|--- |'Do'|Prev { |" |[R]|[R] +........|Here|- | Scrn| [ |' | | +........|E17 |E11 |G16 |D17|D11|C11| | +--------|----|----|----|---|---|---|---|--- +..KBD12:|Find|+ |Help|Se-| } |Re-|C:L| | +........| |= | |lect ] |turn...| \ +........|E16 |E12 |G15 |D16 D12|C13|B16|C12 +--------|----|----|----|---|---|---|---|--- +..KBD11:Addtnl +........|Scrn| 2 |....| | | | |< +........|G99 |E02 |....|D00|D02|C02|B02|B00 +--------|----|----|----|---|---|---|---|--- +..KBD_2: [R] |[R] |[R] |~ |! |Q |A |Z +........|..............|...|1 +........|..............|E00 E01 D01 C01 B01 +--------|----|----|----|---|---|---|---|--- +..KBD_1: Ctrl|Lock|Comp|[R] +........|C99 |C00 |A99 | +--------|----|----|----|---|---|---|---|--- +..KBD_0: Shift +........|B99,B11 + +--- + [R] = Reserved + NOTE 1) N0-N9, N-, N. and N, refer to numeric keypad + NOTE 2) N0 can be divided into 2 keys. + Normally only the N0 keyswitch is implemented as a double-sized key. + NOTE 3) Return key occupies 2 positions that are + decoded as the Return (C13) key. + + C:D - Cursor down (B17) + C:U - Cursor up (C17) + C:R - Cursor right (B18) + C:L - Cursor left (B16) + */ + +#include "emu.h" +#include "dec_lk201.h" +#include "cpu/m6805/m6805.h" + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LK201_CPU_TAG "lk201_cpu" +#define LK201_SPK_TAG "beeper" + +//------------------------------------------------- +// SERIAL COMMUNICATIONS INTERFACE +//------------------------------------------------- + +#define SCI_BAUD 0 // Baud rate register +#define BAUD_SCR 0x07 // SCI baud rate select +#define BAUD_SCP 0x30 // SCI prescaler select + +#define SCI_SCCR1 1 // Control register 1 +#define SCCR1_WAKE 0x08 // Wakeup method +#define SCCR1_M 0x10 // Character length +#define SCCR1_T8 0x40 // Transmit bit 8 +#define SCCR1_R8 0x80 // Receive bit 8 + +#define SCI_SCCR2 2 // Control register 2 +#define SCCR2_SBK 0x01 // Send break +#define SCCR2_RWU 0x02 // Receiver wakeup enable +#define SCCR2_RE 0x04 // Receiver enable +#define SCCR2_TE 0x08 // Transmitter enable +#define SCCR2_ILIE 0x10 // Idle line interrupt enable +#define SCCR2_RIE 0x20 // Receiver interrupt enable +#define SCCR2_TCIE 0x40 // Transmit complete interrupt enable +#define SCCR2_TIE 0x80 // Transmit interrupt enable + +#define SCI_SCSR 3 // Status register +#define SCSR_FE 0x02 // Receiver framing error +#define SCSR_NF 0x04 // Receiver noise +#define SCSR_OR 0x08 // Receiver overrun +#define SCSR_IDLE 0x10 // Receiver idle +#define SCSR_RDRF 0x20 // Receive data register full +#define SCSR_TC 0x40 // Transmit complete +#define SCSR_TDRE 0x80 // Transmit data register empty +#define SCSR_INT (SCSR_IDLE | SCSR_RDRF| \ + SCSR_TC | SCSR_TDRE) // Interrupt sources + +#define SCI_SCDR 4 // Data register + +//------------------------------------------------- +// SERIAL PERIPHERAL INTERFACE +//------------------------------------------------- + +#define SPI_SPCR 0 // Control register +#define SPCR_SPR 0x03 // SPI clock rate select +#define SPCR_CPHA 0x04 // Clock phase +#define SPCR_CPOL 0x08 // Clock polarity +#define SPCR_MSTR 0x10 // Master mode select +#define SPCR_DWOM 0x20 // Port D wire-or mode option +#define SPCR_SPE 0x40 // Serial peripheral system enable +#define SPCR_SPIE 0x80 // Serial peripheral interrupt enable + +#define SPI_SPSR 1 // Status register +#define SPSR_MODF 0x10 // Mode fault flag +#define SPSR_WCOL 0x40 // Write collision +#define SPSR_SPIF 0x80 // SPI transfer complete + +#define SPI_SPDR 2 // Data I/O Register + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type LK201 = &device_creator; + +ROM_START( lk201 ) + ROM_REGION(0x2000, LK201_CPU_TAG, 0) + ROM_LOAD( "23-001s9-00.bin", 0x0000, 0x2000, CRC(be293c51) SHA1(a11ae004d2d6055d7279da3560c3e56610a19fdb) ) +ROM_END + +//------------------------------------------------- +// ADDRESS_MAP +//------------------------------------------------- + +static ADDRESS_MAP_START( lk201_map, AS_PROGRAM, 8, lk201_device ) + AM_RANGE(0x0000, 0x0002) AM_READWRITE(ports_r, ports_w) + AM_RANGE(0x0004, 0x0006) AM_READWRITE(ddr_r, ddr_w) + AM_RANGE(0x000a, 0x000c) AM_READWRITE(spi_r, spi_w) + AM_RANGE(0x000d, 0x0011) AM_READWRITE(sci_r, sci_w) + AM_RANGE(0x0050, 0x00ff) AM_RAM + AM_RANGE(0x0100, 0x1fff) AM_ROM AM_REGION(LK201_CPU_TAG, 0x100) +ADDRESS_MAP_END + +//------------------------------------------------- +// MACHINE_CONFIG +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( lk201 ) + MCFG_CPU_ADD(LK201_CPU_TAG, M68HC05EG, 2000000) // actually 68HC05C4 + MCFG_CPU_PROGRAM_MAP(lk201_map) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(LK201_SPK_TAG, BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor lk201_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( lk201 ); +} + +const rom_entry *lk201_device::device_rom_region() const +{ + return ROM_NAME( lk201 ); +} + +//------------------------------------------------- +// INPUT_PORTS( lk201 ) +//------------------------------------------------- + +/* [Foreign language caps] are referenced in software titles. Please leave them in. + + DEC omitted terms like 'Interrupt', 'Break' and 'Data / Talk' on some keyboards, + so Fn numbers are definitely important for end users. + + === CURRENT SPECIAL KEYS === + [PC-AT] ......=> [DEC] + LEFT CONTROL..=> Control + LEFT ALT .....=> Compose + + RIGHT ALT ....=> Help + RIGHT CONTROL => Do + ============================================================================================== + === (PC - AT ) keys above cursor block === + * KEYCODE_INSERT * KEYCODE_HOME * KEYCODE_PGUP + * KEYCODE_DEL... * KEYCODE_END * KEYCODE_PGDN + + === (DEC LK 201 layout above cursor) === + * Find ........| Insert Here | Remove + * Select.........| Prev ..... | Next + ============================================================================================== + === CURRENT NUM PAD ASSIGNMENTS === + [PF1] to [PF4] are mapped to NUM LOCK, SLASH etc. (=> 4 keys on top on num pad). + Num pad '+' gives ',' on the DEC. + ',' translates to '.' (=> more or less the layout of model 'LK-201-AG') + + Switch between 'full' and 'partial keyboard emulation' with Scroll Lock. +*/ + +INPUT_PORTS_START( lk201 ) + +#ifndef KEYBOARD_WORKAROUND + PORT_START("KBD0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + + PORT_START("KBD1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Compose") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) + + PORT_START("KBD2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tilde") PORT_CODE(KEYCODE_TILDE) // E00 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("<") PORT_CODE(KEYCODE_BACKSLASH2) // B00 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Hold Screen (F1)") PORT_CODE(KEYCODE_F1) + + PORT_START("KBD4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Setup (F3)") PORT_CODE(KEYCODE_PAUSE) // SET UP = Pause on PC + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Print Screen (F2)") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break (F5)") PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Data / Talk (F4)") PORT_CODE(KEYCODE_F4) + + PORT_START("KBD6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Interrupt (F6) [X]") PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Resume (F7) [Fortsetzen]") PORT_CODE(KEYCODE_F7) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cancel (F8) [Zuruecknehmen]") PORT_CODE(KEYCODE_F8) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Exit (F10) [Fertig]") PORT_CODE(KEYCODE_F10) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Main Screen (F9) [Hauptbild]") PORT_CODE(KEYCODE_F9) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC (F11)") PORT_CODE(KEYCODE_F11) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD10") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LF (F13)") PORT_CODE(KEYCODE_F13) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS (F12)") PORT_CODE(KEYCODE_F12) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD11") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // FIXME - duplicate "Return" + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete set_input_line(M68HC05EG_INT_CPI, 1); + } + else + { + m_maincpu->set_input_line(M68HC05EG_INT_CPI, 0); + } +} + +READ8_MEMBER( lk201_device::ddr_r ) +{ + return ddrs[offset]; +} + +WRITE8_MEMBER( lk201_device::ddr_w ) +{ +// printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, m_maincpu->pc()); + + send_port(space, offset, ports[offset] & data); + + ddrs[offset] = data; +} + +READ8_MEMBER( lk201_device::ports_r ) +{ + UINT8 incoming = 0; + + // apply data direction registers + incoming &= (ddrs[offset] ^ 0xff); + // add in ddr-masked version of port writes + incoming |= (ports[offset] & ddrs[offset]); + +// printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], m_maincpu->pc()); + + return incoming; +} + +WRITE8_MEMBER( lk201_device::ports_w ) +{ + send_port(space, offset, data); + + ports[offset] = data; +} + +void lk201_device::send_port(address_space &space, UINT8 offset, UINT8 data) +{ +// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->pc()); + + switch (offset) + { + case 0: // port A + break; + + case 1: // port B + break; + + case 2: // port C + // Check for keyboard read strobe + if (((data & 0x40) == 0) && (ports[offset] & 0x40)) + { +#ifndef KEYBOARD_WORKAROUND + if (ports[0] & 0x1) kbd_data = m_kbd0->read(); + if (ports[0] & 0x2) kbd_data = m_kbd1->read(); + if (ports[0] & 0x4) kbd_data = m_kbd2->read(); + if (ports[0] & 0x8) kbd_data = m_kbd3->read(); + if (ports[0] & 0x10) kbd_data = m_kbd4->read(); + if (ports[0] & 0x20) kbd_data = m_kbd5->read(); + if (ports[0] & 0x40) kbd_data = m_kbd6->read(); + if (ports[0] & 0x80) kbd_data = m_kbd7->read(); + if (ports[1] & 0x1) kbd_data = m_kbd8->read(); + if (ports[1] & 0x2) kbd_data = m_kbd9->read(); + if (ports[1] & 0x4) kbd_data = m_kbd10->read(); + if (ports[1] & 0x8) kbd_data = m_kbd11->read(); + if (ports[1] & 0x10) kbd_data = m_kbd12->read(); + if (ports[1] & 0x20) kbd_data = m_kbd13->read(); + if (ports[1] & 0x40) kbd_data = m_kbd14->read(); + if (ports[1] & 0x80) kbd_data = m_kbd15->read(); + if (ports[2] & 0x1) kbd_data = m_kbd16->read(); + if (ports[2] & 0x2) kbd_data = m_kbd17->read(); + } + // Check for LED update strobe + if (((data & 0x80) == 0) && (ports[offset] & 0x80)) + { + // Lower nibble contains the LED values (1 = on, 0 = off) + output_set_value("led_wait" , (led_data & 0x1) == 0); + output_set_value("led_compose", (led_data & 0x2) == 0); + output_set_value("led_hold" , (led_data & 0x4) == 0); + output_set_value("led_lock" , (led_data & 0x8) == 0); + } +#endif + + break; + } +} + +READ8_MEMBER( lk201_device::sci_r ) +{ + UINT8 incoming = 0; + + switch (offset) + { + case SCI_BAUD: // Baud rate + break; + + case SCI_SCCR1: // Control 1 + break; + + case SCI_SCCR2: // Control 2 + incoming = sci_ctl2; + break; + + case SCI_SCSR: // Status + incoming = sci_status; + break; + + case SCI_SCDR: // Data + incoming = get_received_char(); + sci_status &= ~SCSR_RDRF; + m_maincpu->set_input_line(M68HC05EG_INT_CPI, 0); + update_interrupts(); + break; + } + +// printf("SCI read @ %x = %02x (PC=%x)\n", offset, incoming, m_maincpu->pc()); + + return incoming; +} + +WRITE8_MEMBER( lk201_device::sci_w ) +{ + switch (offset) + { + case SCI_BAUD: // Baud rate + break; + + case SCI_SCCR1: // Control 1 + break; + + case SCI_SCCR2: // Control 2 + sci_ctl2 = data; + update_interrupts(); + break; + + case SCI_SCSR: // Status + break; + + case SCI_SCDR: // Data +// printf("LK201: sending %02x\n", data); + transmit_register_setup(data); + sci_status &= ~(SCSR_TC | SCSR_TDRE); + m_maincpu->set_input_line(M68HC05EG_INT_CPI, 0); + update_interrupts(); + break; + } + +// printf("SCI %02x to %x (PC=%x)\n", data, offset, m_maincpu->pc()); +} + +READ8_MEMBER( lk201_device::spi_r ) +{ + UINT8 incoming = 0; + + switch (offset) + { + case SPI_SPCR: // Control + break; + + case SPI_SPSR: // Status + incoming = spi_status; + spi_status &= ~SPSR_SPIF; + break; + + case SPI_SPDR: // Data I/O + incoming = spi_data; + break; + } + +// printf("SPI read @ %x = %02x (PC=%x)\n", offset, incoming, m_maincpu->pc()); + + return incoming; +} + +WRITE8_MEMBER( lk201_device::spi_w ) +{ + switch (offset) + { + case SPI_SPCR: // Control + break; + + case SPI_SPSR: // Status (read only) + break; + + case SPI_SPDR: // Data I/O + spi_data = data; + + // Transfer only allowed if transfer complete flag has been acknowleged + if ((spi_status & SPSR_SPIF) == 0) + { + // Data out + led_data = data; + + // Data in + spi_data = kbd_data; + + // Indicate transfer complete + spi_status |= SPSR_SPIF; + } + break; + } + +// printf("SPI %02x to %x (PC=%x)\n", data, offset, m_maincpu->pc()); +} diff --git a/src/mame/machine/dec_lk201.h b/src/mame/machine/dec_lk201.h new file mode 100644 index 00000000000..34f25e32dae --- /dev/null +++ b/src/mame/machine/dec_lk201.h @@ -0,0 +1,117 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont, M. Burke +#pragma once + +#ifndef __LK201_H__ +#define __LK201_H__ + +#include "emu.h" +#include "sound/beep.h" + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LK_CMD_LEDS_ON 0x13 /* light LEDs - 1st param: led bitmask */ +#define LK_CMD_LEDS_OFF 0x11 /* turn off LEDs */ + +#define LK_CMD_DIS_KEYCLK 0x99 /* disable the keyclick */ +#define LK_CMD_ENB_KEYCLK 0x1b /* enable the keyclick - 1st param: volume */ +//#define LK_CMD_DIS_CTLCLK 0xb9 /* disable the Ctrl keyclick */ +//#define LK_CMD_ENB_CTLCLK 0xbb /* enable the Ctrl keyclick */ +#define LK_CMD_SOUND_CLK 0x9f /* emit a keyclick - 1st param: volume */ +#define LK_CMD_DIS_BELL 0xa1 /* disable the bell */ +#define LK_CMD_ENB_BELL 0x23 /* enable the bell - 1st param: volume */ +#define LK_CMD_BELL 0xa7 /* emit a bell - 1st param: volume */ + +#define LK_CMD_POWER_UP 0xfd /* init power-up sequence */ + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_LK201_TX_HANDLER(_cb) \ + devcb = &lk201_device::set_tx_handler(*device, DEVCB_##_cb); + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> lk201_device + +class lk201_device : public device_t, public device_serial_interface +{ +public: + // construction/destruction + lk201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER( ddr_r ); + DECLARE_WRITE8_MEMBER( ddr_w ); + DECLARE_READ8_MEMBER( ports_r ); + DECLARE_WRITE8_MEMBER( ports_w ); + DECLARE_READ8_MEMBER( sci_r ); + DECLARE_WRITE8_MEMBER( sci_w ); + DECLARE_READ8_MEMBER( spi_r ); + DECLARE_WRITE8_MEMBER( spi_w ); + + template static devcb_base &set_tx_handler(device_t &device, _Object wr) { return downcast(device).m_tx_handler.set_callback(wr); } + +protected: + // device-level overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + virtual ioport_constructor device_input_ports() const; + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // device_serial overrides + virtual void rcv_complete(); // Rx completed receiving byte + virtual void tra_complete(); // Tx completed sending byte + virtual void tra_callback(); // Tx send bit + +private: + UINT8 ddrs[3]; + UINT8 ports[3]; + UINT8 led_data; + UINT8 kbd_data; + + UINT8 sci_ctl2; + UINT8 sci_status; + //UINT8 sci_data; + + UINT8 spi_status; + UINT8 spi_data; + + required_device m_maincpu; + required_device m_speaker; + + required_ioport m_kbd0; + required_ioport m_kbd1; + required_ioport m_kbd2; + required_ioport m_kbd3; + required_ioport m_kbd4; + required_ioport m_kbd5; + required_ioport m_kbd6; + required_ioport m_kbd7; + required_ioport m_kbd8; + required_ioport m_kbd9; + required_ioport m_kbd10; + required_ioport m_kbd11; + required_ioport m_kbd12; + required_ioport m_kbd13; + required_ioport m_kbd14; + required_ioport m_kbd15; + required_ioport m_kbd16; + required_ioport m_kbd17; + + void send_port(address_space &space, UINT8 offset, UINT8 data); + void update_interrupts(); + + devcb_write_line m_tx_handler; +}; + +// device type definition +extern const device_type LK201; + +#endif diff --git a/src/mame/machine/dgn_beta.c b/src/mame/machine/dgn_beta.c new file mode 100644 index 00000000000..57de97d32f5 --- /dev/null +++ b/src/mame/machine/dgn_beta.c @@ -0,0 +1,1144 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + machine\dgn_beta.c (machine.c) + + Moved out of dragon.c, 2005-05-05, P.Harvey-Smith. + + I decided to move this out of the main Dragon/CoCo source files, as + the Beta is so radically different from the other Dragon machines that + this made more sense (to me at least). + + Functions to emulate general aspects of the machine (RAM, ROM, interrupts, + I/O ports) + + References: + Disassembly of Dragon Beta ROM, examination of only (known) surviving board. + + TODO: + Pretty much everything ! + + Display working with 6845 taking data from rom. + + 2005-05-10 + Memory banking seems to be working, as documented in code comments below. + + 2005-05-31 + CPU#2 now executes code correctly to do transfers from WD2797. + + 2005-06-03 + + When fed a standard OS-9 boot disk it reads in the boot file and attempts + to start it, not being able to find init, it fails. Hopefully I will + soon have an image of a Beta boot disk. + + 2005-11-29 + + Major track tracing excersise on scans of bare beta board, reveal where a + whole bunch of the PIA lines go, especially the IRQs, most of them go back + to the IRQ line on the main CPU. + + 2005-12-07 + + First booted to OS9 prompt, did not execute startup scripts. + + 2005-12-08 + + Fixed density setting on WD2797, so density of read data is now + correctlty set as required by OS-9. This was the reason startup + script was not being executed as Beta disks have a single denisty + boot track, however the rest of the disk is double density. + Booted completely to OS-9, including running startup script. + + 2006-09-27 + + Clean up of IRQ/FIRQ handling code allows correct booting again. + +***************************************************************************/ + +#include +#include "emu.h" +#include "debug/debugcon.h" +#include "cpu/m6809/m6809.h" +#include "machine/6821pia.h" +#include "includes/dgn_beta.h" +#include "machine/mos6551.h" +#include "imagedev/flopdrv.h" + +#include "debug/debugcpu.h" +#include "debug/debugcon.h" +#include "machine/ram.h" + +#define VERBOSE 0 + + +#define LOG_BANK_UPDATE(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_DEFAULT_TASK(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_PAGE_WRITE(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_HALT(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_TASK(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_KEYBOARD(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_VIDEO(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_DISK(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_INTS(x) do { if (VERBOSE) logerror x; } while (0) + + +/* Debugging commands and handlers. */ +static offs_t dgnbeta_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); +static void execute_beta_dat_log(running_machine &machine, int ref, int params, const char *param[]); +static void execute_beta_key_dump(running_machine &machine, int ref, int params, const char *param[]); + +//static int DMA_NMI; /* DMA cpu has received an NMI */ + +#define INVALID_KEYROW -1 /* no ketrow selected */ +#define NO_KEY_PRESSED 0x7F /* retrurned by hardware if no key pressed */ + +// Info for bank switcher +struct bank_info_entry +{ + write8_delegate func; // Pointer to write handler + offs_t start; // Offset of start of block + offs_t end; // offset of end of block +}; + +static const struct bank_info_entry bank_info[] = +{ + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b0_w),(dgn_beta_state*)0), 0x0000, 0x0fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b1_w),(dgn_beta_state*)0), 0x1000, 0x1fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b2_w),(dgn_beta_state*)0), 0x2000, 0x2fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b3_w),(dgn_beta_state*)0), 0x3000, 0x3fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b4_w),(dgn_beta_state*)0), 0x4000, 0x4fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b5_w),(dgn_beta_state*)0), 0x5000, 0x5fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b6_w),(dgn_beta_state*)0), 0x6000, 0x6fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b7_w),(dgn_beta_state*)0), 0x7000, 0x7fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b8_w),(dgn_beta_state*)0), 0x8000, 0x8fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b9_w),(dgn_beta_state*)0), 0x9000, 0x9fff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bA_w),(dgn_beta_state*)0), 0xA000, 0xAfff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bB_w),(dgn_beta_state*)0), 0xB000, 0xBfff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bC_w),(dgn_beta_state*)0), 0xC000, 0xCfff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bD_w),(dgn_beta_state*)0), 0xD000, 0xDfff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bE_w),(dgn_beta_state*)0), 0xE000, 0xEfff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bF_w),(dgn_beta_state*)0), 0xF000, 0xFBff }, + { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bG_w),(dgn_beta_state*)0), 0xFF00, 0xFfff } +}; + +#define is_last_page(page) (((page==LastPage) || (page==LastPage+1)) ? 1 : 0) + +// +// Memory pager, maps machine's 1Mb total address space into the 64K addressable by the 6809. +// This is in some way similar to the system used on the CoCo 3, except the beta uses 4K +// pages (instead of 8K on the CoCo), and has 16 task registers instead of the 2 on the CoCo. +// +// Each block of 16 page registers (1 for each task), is paged in at $FE00-$FE0F, the bottom +// 4 bits of the PIA register at $FCC0 seem to contain which task is active. +// bit 6 of the same port seems to enable the memory paging +// +// For the purpose of this driver any block that is not ram, and is not a known ROM block, +// is mapped to the first page of the boot rom, I do not know what happens in the real +// hardware, however this does allow the boot rom to correctly size the RAM. +// this should probably be considdered a hack ! +// + +void dgn_beta_state::UpdateBanks(int first, int last) +{ + address_space &space_0 = m_maincpu->space(AS_PROGRAM); + address_space &space_1 = machine().device(DMACPU_TAG)->memory().space(AS_PROGRAM); + int Page; + UINT8 *readbank; + int bank_start; + int bank_end; + int MapPage; + char page_num[10]; + + LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,space_0.device().safe_pc())); + for(Page=first;Page<=last;Page++) + { + sprintf(page_num,"bank%d",Page+1); + + bank_start = bank_info[Page].start; + bank_end = bank_info[Page].end; + + // bank16 and bank17 are mapped to the same page with a hole for the IO memory + if (!is_last_page(Page)) + MapPage = m_PageRegs[m_TaskReg][Page].value; + else + MapPage = m_PageRegs[m_TaskReg][LastPage].value; + + // + // Map block, $00-$BF are ram, $FC-$FF are Boot ROM + // + if ((MapPage*4) < ((m_ram->size() / 1024)-1)) // Block is ram + { + if (!is_last_page(Page)) + { + readbank = &m_ram->pointer()[MapPage*RamPageSize]; + if(m_LogDatWrites) + debug_console_printf(machine(), "Mapping page %X, pageno=%X, mess_ram)[%X]\n",Page,MapPage,(MapPage*RamPageSize)); + } + else + { + readbank = &m_ram->pointer()[(MapPage*RamPageSize)-256]; + logerror("Error RAM in Last page !\n"); + } + write8_delegate func = bank_info[Page].func; + if (!func.isnull()) func.late_bind(*this); + space_0.install_write_handler(bank_start, bank_end, func); + space_1.install_write_handler(bank_start, bank_end, func); + } + else // Block is rom, or undefined + { + if (MapPage>0xfB) + { + if (Page!=IOPage+1) + readbank=&m_system_rom[(MapPage-0xFC)*0x1000]; + else + readbank=&m_system_rom[0x3F00]; + } + else + readbank=m_system_rom; + + space_0.unmap_write(bank_start, bank_end); + space_1.unmap_write(bank_start, bank_end); + } + + m_PageRegs[m_TaskReg][Page].memory=readbank; + membank(page_num)->set_base(readbank); + + LOG_BANK_UPDATE(("UpdateBanks:MapPage=$%02X readbank=$%X\n",MapPage,(int)(FPTR)readbank)); + LOG_BANK_UPDATE(("PageRegsSet Task=%X Page=%x\n",m_TaskReg,Page)); + //LOG_BANK_UPDATE(("%X)\n",membank(Page+1))); + LOG_BANK_UPDATE(("memory_install_write8_handler CPU=0\n")); + LOG_BANK_UPDATE(("memory_install_write8_handler CPU=1\n")); + } +} + +// +void dgn_beta_state::SetDefaultTask() +{ +// UINT8 *videoram = m_videoram; + int Idx; + + LOG_DEFAULT_TASK(("SetDefaultTask()\n")); + //if (VERBOSE) debug_console_printf(machine())->set_base("Set Default task\n"); + + m_TaskReg=NoPagingTask; + + /* Reset ram pages */ + for(Idx=0;Idxpointer()[TextVidBasePage*RamPageSize]; +} + +// Return the value of a page register +READ8_MEMBER(dgn_beta_state::dgn_beta_page_r) +{ + return m_PageRegs[m_PIATaskReg][offset].value; +} + +// Write to a page register, writes to the register, and then checks to see +// if memory banking is active, if it is, it calls UpdateBanks, to actually +// setup the mappings. + +WRITE8_MEMBER(dgn_beta_state::dgn_beta_page_w ) +{ + m_PageRegs[m_PIATaskReg][offset].value=data; + + LOG_PAGE_WRITE(("PageRegWrite : task=$%X offset=$%X value=$%X\n",m_PIATaskReg,offset,data)); + + if (m_EnableMapRegs) + { + UpdateBanks(offset,offset); + if (offset==15) + UpdateBanks(offset+1,offset+1); + } +} + +/*********************** Memory bank write handlers ************************/ +/* These actually write the data to the memory, and not to the page regs ! */ +void dgn_beta_state::dgn_beta_bank_memory(int offset, int data, int bank) +{ + m_PageRegs[m_TaskReg][bank].memory[offset]=data; +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b0_w ) +{ + dgn_beta_bank_memory(offset,data,0); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b1_w ) +{ + dgn_beta_bank_memory(offset,data,1); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b2_w ) +{ + dgn_beta_bank_memory(offset,data,2); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b3_w ) +{ + dgn_beta_bank_memory(offset,data,3); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b4_w ) +{ + dgn_beta_bank_memory(offset,data,4); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b5_w ) +{ + dgn_beta_bank_memory(offset,data,5); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b6_w ) +{ + dgn_beta_bank_memory(offset,data,6); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b7_w ) +{ + dgn_beta_bank_memory(offset,data,7); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b8_w ) +{ + dgn_beta_bank_memory(offset,data,8); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b9_w ) +{ + dgn_beta_bank_memory(offset,data,9); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bA_w ) +{ + dgn_beta_bank_memory(offset,data,10); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bB_w ) +{ + dgn_beta_bank_memory(offset,data,11); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bC_w ) +{ + dgn_beta_bank_memory(offset,data,12); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bD_w ) +{ + dgn_beta_bank_memory(offset,data,13); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bE_w ) +{ + dgn_beta_bank_memory(offset,data,14); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bF_w ) +{ + dgn_beta_bank_memory(offset,data,15); +} + +WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bG_w ) +{ + dgn_beta_bank_memory(offset,data,16); +} + +/* +The keyrow being scanned for any key is the lest significant bit +of the output shift register that is zero, most of the time there should +only be one row active e.g. + +Shifter Row being scanned +1111111110 0 +1111111101 1 +1111111011 2 + +etc. + +Returns row number or -1 if none selected. + +2006-12-03, P.Harvey-Smith, modified to scan from msb to lsb, and stop at +first row with zero, as the beta_test fills the shifter with zeros, rather +than using a walking zero as the OS-9 driver does. This meant that SelectKeyrow +never moved past the first row, by scanning for the last active row +the beta_test rom works, and it does not break the OS-9 driver :) +*/ +int dgn_beta_state::SelectedKeyrow(dgn_beta_state *state, int Rows) +{ + int Idx; + int Row; /* Row selected */ + int Mask; /* Mask to test row */ + int Found; /* Set true when found */ + + Row=INVALID_KEYROW; /* Pretend no rows selected */ + Mask=0x200; /* Start with row 9 */ + Found=0; /* Start with not found */ + Idx=9; + + while ((Mask>0) && !Found) + { + if((~Rows & Mask) && !Found) + { + Row=Idx; /* Get row */ + Found=1; /* Mark as found */ + } + Idx=Idx-1; /* Decrement row count */ + Mask=Mask>>1; /* Select next bit */ + } + + return Row; +} + +/* GetKeyRow, returns the value of a keyrow, checking for invalid rows */ +/* and returning no key pressed if row is invalid */ +int dgn_beta_state::GetKeyRow(dgn_beta_state *state, int RowNo) +{ + if(RowNo==INVALID_KEYROW) + return NO_KEY_PRESSED; /* row is invalid, so return no key down */ + else + return m_Keyboard[RowNo]; /* Else return keyboard data */ +} + +/*********************************** PIA Handlers ************************/ +/* PIA #0 at $FC20-$FC23 I46 + This handles:- + The Printer port, side A, + PB0 R16 (pullup) -> Printer Port (PL1) + PB1 Printer Port + PB2 Keyboard (any key). + PB3 D4 -> R37 -> TR1 switching circuit -> PL5 + PB4 Keyboard Data out, clocked by CB2. + positive edge clocks data out of the input shift register. + PB5 Keyboard data in, clocked by PB4. + PB6 R79 -> I99/6/7416 -> PL9/26/READY (from floppy) + PB7 Printer port + CB1 I36/39/6845(Horz Sync) + CB2 Keyboard (out) Low loads input shift reg +*/ +READ8_MEMBER(dgn_beta_state::d_pia0_pa_r) +{ + return 0; +} + +WRITE8_MEMBER(dgn_beta_state::d_pia0_pa_w) +{ +} + +READ8_MEMBER(dgn_beta_state::d_pia0_pb_r) +{ + int RetVal; + int Idx; + int Selected; + static const char *const keynames[] = { + "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", + "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" + }; + + LOG_KEYBOARD(("PB Read\n")); + + m_KAny_next = 0; + + Selected = SelectedKeyrow(this, m_RowShifter); + + /* Scan the whole keyboard, if output shifter is all low */ + /* This actually scans in the keyboard */ + if(m_RowShifter == 0x00) + { + for(Idx=0; Idxread(); + + if(m_Keyboard[Idx] != 0x7F) + m_KAny_next = 1; + } + } + else /* Just scan current row, from previously read values */ + { + if(GetKeyRow(this, Selected) != NO_KEY_PRESSED) + m_KAny_next = 1; + } + + RetVal = (m_KInDat_next<<5) | (m_KAny_next<<2); + + LOG_KEYBOARD(("FC22=$%02X KAny=%d\n", RetVal, m_KAny_next)); + + return RetVal; +} + +WRITE8_MEMBER(dgn_beta_state::d_pia0_pb_w) +{ + int InClkState; + //int OutClkState; + + LOG_KEYBOARD(("PB Write\n")); + + InClkState = data & KInClk; + //OutClkState = data & KOutClk; + + LOG_KEYBOARD(("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(m_d_pia0_pb_last & KInClk),m_Keyrow)); + + /* Input clock bit has changed state */ + if ((InClkState) != (m_d_pia0_pb_last & KInClk)) + { + /* Clock in bit */ + if(InClkState) + { + m_KInDat_next=(~m_Keyrow & 0x40)>>6; + m_Keyrow = ((m_Keyrow<<1) | 0x01) & 0x7F ; + LOG_KEYBOARD(("Keyrow=$%02X KInDat_next=%X\n",m_Keyrow,m_KInDat_next)); + } + } + + m_d_pia0_pb_last=data; +} + +WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_cb2_w) +{ + int RowNo; + LOG_KEYBOARD(("\nCB2 Write\n")); + + /* load keyrow on rising edge of CB2 */ + if((state==1) && (m_d_pia0_cb2_last==0)) + { + RowNo=SelectedKeyrow(this, m_RowShifter); + m_Keyrow=GetKeyRow(this, RowNo); + + /* Output clock rising edge, clock CB2 value into rowshifterlow to high transition */ + /* In the beta the shift registers are a cmos 4015, and a cmos 4013 in series */ + m_RowShifter = (m_RowShifter<<1) | ((m_d_pia0_pb_last & KOutDat)>>4); + m_RowShifter &= 0x3FF; + LOG_KEYBOARD(("Rowshifter=$%02X Keyrow=$%02X\n",m_RowShifter,m_Keyrow)); + if (VERBOSE) debug_console_printf(machine(), "rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",m_RowShifter,RowNo,m_Keyrow); + } + + m_d_pia0_cb2_last=state; +} + + +WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_irq_a) +{ + cpu0_recalc_irq(state); +} + +WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_irq_b) +{ + cpu0_recalc_firq(state); +} + +/* PIA #1 at $FC24-$FC27 I63 + This handles :- + Mouse + Disk Select on side A + Halt on DMA CPU PA7 + Beeper PB0 + Halt on main CPU PB1 + Character set select PB6 + Baud rate PB1..PB5 ???? +*/ + +READ8_MEMBER(dgn_beta_state::d_pia1_pa_r) +{ + return 0; +} + +WRITE8_MEMBER(dgn_beta_state::d_pia1_pa_w) +{ + int HALT_DMA; + + /* Only play with halt line if halt bit changed since last write */ + if((data & 0x80) != m_d_pia1_pa_last) + { + /* Bit 7 of $FF24, seems to control HALT on second CPU (through an inverter) */ + if(data & 0x80) + HALT_DMA = ASSERT_LINE; + else + HALT_DMA = CLEAR_LINE; + + LOG_HALT(("DMA_CPU HALT=%d\n", HALT_DMA)); + machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, HALT_DMA); + + /* CPU un-halted let it run ! */ + if (HALT_DMA == CLEAR_LINE) + m_maincpu->yield(); + + m_d_pia1_pa_last = data & 0x80; + } + + /* Drive selects are binary encoded on PA0 & PA1 */ + floppy_image_device *floppy = NULL; + + switch (~data & 0x03) + { + case 0: floppy = m_floppy0->get_device(); break; + case 1: floppy = m_floppy1->get_device(); break; + case 2: floppy = m_floppy2->get_device(); break; + case 3: floppy = m_floppy3->get_device(); break; + } + + m_fdc->set_floppy(floppy); + + // not connected: bit 5 = ENP + m_fdc->dden_w(BIT(data, 6)); + LOG_DISK(("Set density %s\n", BIT(data, 6) ? "low" : "high")); +} + +READ8_MEMBER(dgn_beta_state::d_pia1_pb_r) +{ + return 0; +} + +WRITE8_MEMBER(dgn_beta_state::d_pia1_pb_w) +{ + int HALT_CPU; + + /* Only play with halt line if halt bit changed since last write */ + if((data & 0x02) != m_d_pia1_pb_last) + { + /* Bit 1 of $FF26, seems to control HALT on primary CPU */ + if(data & 0x02) + HALT_CPU = CLEAR_LINE; + else + HALT_CPU = ASSERT_LINE; + + LOG_HALT(("MAIN_CPU HALT=%d\n", HALT_CPU)); + m_maincpu->set_input_line(INPUT_LINE_HALT, HALT_CPU); + + m_d_pia1_pb_last = data & 0x02; + + /* CPU un-halted let it run ! */ + if (HALT_CPU == CLEAR_LINE) + machine().device(DMACPU_TAG)->execute().yield(); + } +} + +WRITE_LINE_MEMBER(dgn_beta_state::d_pia1_irq_a) +{ + cpu0_recalc_irq(state); +} + +WRITE_LINE_MEMBER(dgn_beta_state::d_pia1_irq_b) +{ + cpu0_recalc_irq(state); +} + +/* PIA #2 at FCC0-FCC3 I28 + This handles :- + DAT task select PA0..PA3 + + DMA CPU NMI PA7 + + Graphics control PB0..PB7 ??? + VSYNC intutrupt CB2 +*/ +READ8_MEMBER(dgn_beta_state::d_pia2_pa_r) +{ + return 0; +} + +WRITE8_MEMBER(dgn_beta_state::d_pia2_pa_w) +{ + int OldTask; + int OldEnableMap; + int NMI; + + LOG_TASK(("FCC0 write : $%02X\n", data)); + + /* Bit 7 of $FFC0, seems to control NMI on second CPU */ + NMI=(data & 0x80); + + /* only take action if NMI changed */ + if(NMI != m_DMA_NMI_LAST) + { + LOG_INTS(("cpu1 NMI : %d\n", NMI)); + if(!NMI) + { + machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + logerror("device_yield()\n"); + machine().device(DMACPU_TAG)->execute().yield(); /* Let DMA CPU run */ + } + else + { + machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + } + + m_DMA_NMI_LAST = NMI; /* Save it for next time */ + } + + OldEnableMap = m_EnableMapRegs; + /* Bit 6 seems to enable memory paging */ + if(data & 0x40) + m_EnableMapRegs = 0; + else + m_EnableMapRegs = 1; + + /* Bits 0..3 seem to control which task register is selected */ + OldTask = m_PIATaskReg; + m_PIATaskReg = data & 0x0F; + + LOG_TASK(("OldTask=$%02X EnableMapRegs=%d OldEnableMap=%d\n", OldTask, m_EnableMapRegs, OldEnableMap)); + + // Maping was enabled or disabled, select apropreate task reg + // and map it in + if (m_EnableMapRegs != OldEnableMap) + { + if(m_EnableMapRegs) + m_TaskReg = m_PIATaskReg; + else + m_TaskReg = NoPagingTask; + + UpdateBanks(0, IOPage + 1); + } + else + { + // Update ram banks only if task reg changed and mapping enabled + if ((m_PIATaskReg != OldTask) && (m_EnableMapRegs)) + { + m_TaskReg = m_PIATaskReg; + UpdateBanks(0, IOPage + 1); + } + } + LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n", m_TaskReg, m_PIATaskReg)); +} + +READ8_MEMBER(dgn_beta_state::d_pia2_pb_r) +{ + return 0; +} + +WRITE8_MEMBER(dgn_beta_state::d_pia2_pb_w) +{ + /* Update top video address lines */ + dgnbeta_vid_set_gctrl(data); +} + +WRITE_LINE_MEMBER(dgn_beta_state::d_pia2_irq_a) +{ + cpu0_recalc_irq(state); +} + +WRITE_LINE_MEMBER(dgn_beta_state::d_pia2_irq_b) +{ + cpu0_recalc_irq(state); +} + +/************************************ Recalculate CPU inturrupts ****************************/ +/* CPU 0 */ +void dgn_beta_state::cpu0_recalc_irq(int state) +{ + pia6821_device *pia_0 = machine().device( PIA_0_TAG ); + pia6821_device *pia_1 = machine().device( PIA_1_TAG ); + pia6821_device *pia_2 = machine().device( PIA_2_TAG ); + UINT8 pia0_irq_a = pia_0->irq_a_state(); + UINT8 pia1_irq_a = pia_1->irq_a_state(); + UINT8 pia1_irq_b = pia_1->irq_b_state(); + UINT8 pia2_irq_a = pia_2->irq_a_state(); + UINT8 pia2_irq_b = pia_2->irq_b_state(); + UINT8 IRQ; + + if (pia0_irq_a || pia1_irq_a || pia1_irq_b || pia2_irq_a || pia2_irq_b) + IRQ = ASSERT_LINE; + else + IRQ = CLEAR_LINE; + + m_maincpu->set_input_line(M6809_IRQ_LINE, IRQ); + LOG_INTS(("cpu0 IRQ : %d\n", IRQ)); +} + +void dgn_beta_state::cpu0_recalc_firq(int state) +{ + pia6821_device *pia_0 = machine().device( PIA_0_TAG ); + UINT8 pia0_irq_b = pia_0->irq_b_state(); + UINT8 FIRQ; + + if (pia0_irq_b) + FIRQ = ASSERT_LINE; + else + FIRQ = CLEAR_LINE; + + m_maincpu->set_input_line(M6809_FIRQ_LINE, FIRQ); + + LOG_INTS(("cpu0 FIRQ : %d\n", FIRQ)); +} + +/* CPU 1 */ + +void dgn_beta_state::cpu1_recalc_firq(int state) +{ + machine().device(DMACPU_TAG)->execute().set_input_line(M6809_FIRQ_LINE, state); + LOG_INTS(("cpu1 FIRQ : %d\n",state)); +} + +/********************************************************************************************/ +/* Dragon Beta onboard FDC */ +/********************************************************************************************/ + +/* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */ +WRITE_LINE_MEMBER( dgn_beta_state::dgnbeta_fdc_intrq_w ) +{ + device_t *device = machine().device(PIA_2_TAG); + LOG_DISK(("dgnbeta_fdc_intrq_w(%d)\n", state)); + if(m_wd2797_written) + downcast(device)->ca1_w(state); +} + +/* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */ +WRITE_LINE_MEMBER( dgn_beta_state::dgnbeta_fdc_drq_w ) +{ + LOG_DISK(("dgnbeta_fdc_drq_w(%d)\n", state)); + cpu1_recalc_firq(state); +} + +READ8_MEMBER( dgn_beta_state::dgnbeta_wd2797_r ) +{ + return m_fdc->read(space, offset & 0x03); +} + +WRITE8_MEMBER( dgn_beta_state::dgnbeta_wd2797_w ) +{ + m_wd2797_written = 1; + m_fdc->write(space, offset & 0x03, data); +} + +/* Scan physical keyboard into Keyboard array */ +/* gonna try and sync this more closely with hardware as keyboard being scanned */ +/* on *EVERY* vblank ! */ +void dgn_beta_state::ScanInKeyboard(void) +{ +#if 0 + int Idx; + int Row; + static const char *const keynames[] = { + "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", + "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" + }; + + LOG_KEYBOARD(("Scanning Host keyboard\n")); + + for(Idx=0; Idxread(); + + else + Row = 0x7f; + + m_Keyboard[Idx]=Row; + LOG_KEYBOARD(("Keyboard[%d]=$%02X\n",Idx,Row)); + + if (Row != 0x7F) + { + LOG_KEYBOARD(("Found Pressed Key\n")); + } + } +#endif +} + +/* VBlank inturrupt */ +void dgn_beta_state::dgn_beta_frame_interrupt (int data) +{ + pia6821_device *pia_2 = machine().device( PIA_2_TAG ); + + /* Set PIA line, so it recognises inturrupt */ + if (!data) + pia_2->cb2_w(ASSERT_LINE); + else + pia_2->cb2_w(CLEAR_LINE); + +// LOG_VIDEO(("Vblank\n")); + ScanInKeyboard(); +} + +#ifdef UNUSED_FUNCTION +void dgn_beta_state::dgn_beta_line_interrupt (int data) +{ +// /* Set PIA line, so it recognises inturrupt */ +// if (data) +// { +// pia_0_cb1_w(machine, 0,ASSERT_LINE); +// } +// else +// { +// pia_0_cb1_w(machine, 0,CLEAR_LINE); +// } +} +#endif + + +/********************************* Machine/Driver Initialization ****************************************/ +void dgn_beta_state::machine_reset() +{ + pia6821_device *pia_0 = machine().device( PIA_0_TAG ); + pia6821_device *pia_1 = machine().device( PIA_1_TAG ); + pia6821_device *pia_2 = machine().device( PIA_2_TAG ); + + logerror("dgn_beta_state::machine_reset()\n"); + + m_system_rom = memregion(MAINCPU_TAG)->base(); + + /* Make sure CPU 1 is started out halted ! */ + machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + + /* Reset to task 0, and map banks disabled, so standard memory map */ + /* with ram at $0000-$BFFF, ROM at $C000-FBFF, IO at $FC00-$FEFF */ + /* and ROM at $FF00-$FFFF */ + m_TaskReg = 0; + m_PIATaskReg = 0; + m_EnableMapRegs = 0; + memset(m_PageRegs, 0, sizeof(m_PageRegs)); /* Reset page registers to 0 */ + SetDefaultTask(); + + /* Set pullups on all PIA port A, to match what hardware does */ + pia_0->set_port_a_z_mask(0xFF); + pia_1->set_port_a_z_mask(0xFF); + pia_2->set_port_a_z_mask(0xFF); + + m_d_pia1_pa_last = 0x00; + m_d_pia1_pb_last = 0x00; + m_RowShifter = 0x00; /* shift register to select row */ + m_Keyrow = 0x00; /* Keyboard row being shifted out */ + m_d_pia0_pb_last = 0x00; /* Last byte output to pia0 port b */ + m_d_pia0_cb2_last = 0x00; /* Last state of CB2 */ + + m_KInDat_next = 0x00; /* Next data bit to input */ + m_KAny_next = 0x00; /* Next value for KAny */ + + m_DMA_NMI_LAST = 0x80; /* start with DMA NMI inactive, as pulled up */ +// DMA_NMI = CLEAR_LINE; /* start with DMA NMI inactive */ + + m_videoram.set_target(m_ram->pointer(),m_videoram.bytes()); /* Point video ram at the start of physical ram */ + + m_wd2797_written=0; + + m_maincpu->reset(); +} + +void dgn_beta_state::machine_start() +{ + logerror("MACHINE_START( dgnbeta )\n"); + + if (machine().device(MAINCPU_TAG)->debug()) { + machine().device(MAINCPU_TAG)->debug()->set_dasm_override(dgnbeta_dasm_override); + } + + /* setup debug commands */ + if (machine().debug_flags & DEBUG_FLAG_ENABLED) + { + debug_console_register_command(machine(), "beta_dat_log", CMDFLAG_NONE, 0, 0, 0, execute_beta_dat_log); + debug_console_register_command(machine(), "beta_key_dump", CMDFLAG_NONE, 0, 0, 0, execute_beta_key_dump); + } + m_LogDatWrites=0; +} + + +/*************************************************************************** + OS9 Syscalls for disassembly +****************************************************************************/ + + +static const char *const os9syscalls[] = +{ + "F$Link", /* Link to Module */ + "F$Load", /* Load Module from File */ + "F$UnLink", /* Unlink Module */ + "F$Fork", /* Start New Process */ + "F$Wait", /* Wait for Child Process to Die */ + "F$Chain", /* Chain Process to New Module */ + "F$Exit", /* Terminate Process */ + "F$Mem", /* Set Memory Size */ + "F$Send", /* Send Signal to Process */ + "F$Icpt", /* Set Signal Intercept */ + "F$Sleep", /* Suspend Process */ + "F$SSpd", /* Suspend Process */ + "F$ID", /* Return Process ID */ + "F$SPrior", /* Set Process Priority */ + "F$SSWI", /* Set Software Interrupt */ + "F$PErr", /* Print Error */ + "F$PrsNam", /* Parse Pathlist Name */ + "F$CmpNam", /* Compare Two Names */ + "F$SchBit", /* Search Bit Map */ + "F$AllBit", /* Allocate in Bit Map */ + "F$DelBit", /* Deallocate in Bit Map */ + "F$Time", /* Get Current Time */ + "F$STime", /* Set Current Time */ + "F$CRC", /* Generate CRC */ + "F$GPrDsc", /* get Process Descriptor copy */ + "F$GBlkMp", /* get System Block Map copy */ + "F$GModDr", /* get Module Directory copy */ + "F$CpyMem", /* Copy External Memory */ + "F$SUser", /* Set User ID number */ + "F$UnLoad", /* Unlink Module by name */ + "F$Alarm", /* Color Computer Alarm Call (system wide) */ + NULL, + NULL, + "F$NMLink", /* Color Computer NonMapping Link */ + "F$NMLoad", /* Color Computer NonMapping Load */ + NULL, + NULL, + "F$TPS", /* Return System's Ticks Per Second */ + "F$TimAlm", /* COCO individual process alarm call */ + "F$VIRQ", /* Install/Delete Virtual IRQ */ + "F$SRqMem", /* System Memory Request */ + "F$SRtMem", /* System Memory Return */ + "F$IRQ", /* Enter IRQ Polling Table */ + "F$IOQu", /* Enter I/O Queue */ + "F$AProc", /* Enter Active Process Queue */ + "F$NProc", /* Start Next Process */ + "F$VModul", /* Validate Module */ + "F$Find64", /* Find Process/Path Descriptor */ + "F$All64", /* Allocate Process/Path Descriptor */ + "F$Ret64", /* Return Process/Path Descriptor */ + "F$SSvc", /* Service Request Table Initialization */ + "F$IODel", /* Delete I/O Module */ + "F$SLink", /* System Link */ + "F$Boot", /* Bootstrap System */ + "F$BtMem", /* Bootstrap Memory Request */ + "F$GProcP", /* Get Process ptr */ + "F$Move", /* Move Data (low bound first) */ + "F$AllRAM", /* Allocate RAM blocks */ + "F$AllImg", /* Allocate Image RAM blocks */ + "F$DelImg", /* Deallocate Image RAM blocks */ + "F$SetImg", /* Set Process DAT Image */ + "F$FreeLB", /* Get Free Low Block */ + "F$FreeHB", /* Get Free High Block */ + "F$AllTsk", /* Allocate Process Task number */ + "F$DelTsk", /* Deallocate Process Task number */ + "F$SetTsk", /* Set Process Task DAT registers */ + "F$ResTsk", /* Reserve Task number */ + "F$RelTsk", /* Release Task number */ + "F$DATLog", /* Convert DAT Block/Offset to Logical */ + "F$DATTmp", /* Make temporary DAT image (Obsolete) */ + "F$LDAXY", /* Load A [X,[Y]] */ + "F$LDAXYP", /* Load A [X+,[Y]] */ + "F$LDDDXY", /* Load D [D+X,[Y]] */ + "F$LDABX", /* Load A from 0,X in task B */ + "F$STABX", /* Store A at 0,X in task B */ + "F$AllPrc", /* Allocate Process Descriptor */ + "F$DelPrc", /* Deallocate Process Descriptor */ + "F$ELink", /* Link using Module Directory Entry */ + "F$FModul", /* Find Module Directory Entry */ + "F$MapBlk", /* Map Specific Block */ + "F$ClrBlk", /* Clear Specific Block */ + "F$DelRAM", /* Deallocate RAM blocks */ + "F$GCMDir", /* Pack module directory */ + "F$AlHRam", /* Allocate HIGH RAM Blocks */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "F$RegDmp", /* Ron Lammardo's debugging register dump call */ + "F$NVRAM", /* Non Volatile RAM (RTC battery backed static) read/write */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "I$Attach", /* Attach I/O Device */ + "I$Detach", /* Detach I/O Device */ + "I$Dup", /* Duplicate Path */ + "I$Create", /* Create New File */ + "I$Open", /* Open Existing File */ + "I$MakDir", /* Make Directory File */ + "I$ChgDir", /* Change Default Directory */ + "I$Delete", /* Delete File */ + "I$Seek", /* Change Current Position */ + "I$Read", /* Read Data */ + "I$Write", /* Write Data */ + "I$ReadLn", /* Read Line of ASCII Data */ + "I$WritLn", /* Write Line of ASCII Data */ + "I$GetStt", /* Get Path Status */ + "I$SetStt", /* Set Path Status */ + "I$Close", /* Close Path */ + "I$DeletX" /* Delete from current exec dir */ +}; + + +static offs_t dgnbeta_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) +{ + unsigned call; + unsigned result = 0; + + if ((oprom[0] == 0x10) && (oprom[1] == 0x3F)) + { + call = oprom[2]; + if ((call < ARRAY_LENGTH(os9syscalls)) && os9syscalls[call]) + { + sprintf(buffer, "OS9 %s", os9syscalls[call]); + result = 3; + } + } + return result; +} + +static void execute_beta_dat_log(running_machine &machine, int ref, int params, const char *param[]) +{ + dgn_beta_state *state = machine.driver_data(); + state->m_LogDatWrites=!state->m_LogDatWrites; + + debug_console_printf(machine, "DAT register write info set : %d\n",state->m_LogDatWrites); +} + +static void execute_beta_key_dump(running_machine &machine, int ref, int params, const char *param[]) +{ + dgn_beta_state *state = machine.driver_data(); + int Idx; + + for(Idx=0;Idxm_Keyboard[Idx]); + } +} diff --git a/src/mame/machine/dgnalpha.c b/src/mame/machine/dgnalpha.c new file mode 100644 index 00000000000..a146e1e3aae --- /dev/null +++ b/src/mame/machine/dgnalpha.c @@ -0,0 +1,377 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + dgnalpha.c + + Dragon Alpha + + The Dragon Alpha was a prototype in development when Dragon Data went bust, + it is basically an enhanced Dragon 64, with built in modem, disk system, and + graphical boot rom. + + It has the following extra hardware :- + A third 6821 PIA mapped between FF24 and FF27 + An AY-8912, connected to the PIA. + + Port A of the PIA is connected as follows :- + + b0 BDIR of AY8912 + b1 BC1 of AY8912 + b2 Rom select, High= boot rom, low=BASIC rom + b3..7 not used. + + Port B + b0..7 connected to D0..7 of the AY8912. + + CB1 DRQ of WD2797. + + /irqa + /irqb both connected to 6809 FIRQ. + + + The analog outputs of the AY-8912 are connected to the standard sound multiplexer. + The AY8912 output port is used as follows :- + + b0..b3 /DS0../DS3 for the drive interface (through an inverter first). + b4 /motor for the drive interface (through an inverter first). + b5..b7 not used as far as I can tell. + + A 6850 for the modem. + + A WD2797, used as an internal disk interface, this is however connected in a slightly strange + way that I am yet to completely determine. + 19/10/2004, WD2797 is mapped between FF2C and FF2F, however the order of the registers is + reversed so the command Register is at the highest address instead of the lowest. The Data + request pin is connected to CB1(pin 18) of PIA2, to cause an firq, the INTRQ, is connected via + an inverter to the 6809's NMI. + + All these are as yet un-emulated. + + 29-Oct-2004, AY-8912 is now emulated. + 30-Oct-2004, Internal disk interface now emulated, Normal DragonDos rom replaced with a re-assembled + version, that talks to the alpha hardware (verified on a clone of the real machine). + +Dragon Alpha code added 21-Oct-2004, + Phill Harvey-Smith (afra@aurigae.demon.co.uk) + + Added AY-8912 and FDC code 30-Oct-2004. + +Fixed Dragon Alpha NMI enable/disable, following circuit traces on a real machine. + P.Harvey-Smith, 11-Aug-2005. + +Re-implemented Alpha NMI enable/disable, using direct PIA reads, rather than +keeping track of it in a variable in the driver. + P.Harvey-Smith, 25-Sep-2006. + +***************************************************************************/ + +#include "includes/dgnalpha.h" +#include "sound/ay8910.h" +#include "imagedev/flopdrv.h" + +//------------------------------------------------- +// device_start +//------------------------------------------------- + +void dragon_alpha_state::device_start(void) +{ + dragon_state::device_start(); + save_item(NAME(m_just_reset)); +} + + + +//------------------------------------------------- +// device_reset +//------------------------------------------------- + +void dragon_alpha_state::device_reset(void) +{ + dragon_state::device_reset(); + m_just_reset = 1; +} + + + +/*************************************************************************** + MODEM +***************************************************************************/ + +//------------------------------------------------- +// modem_r +//------------------------------------------------- + +UINT8 dragon_alpha_state::modem_r(offs_t offset) +{ + return 0xFF; +} + + + +//------------------------------------------------- +// modem_w +//------------------------------------------------- + +void dragon_alpha_state::modem_w(offs_t offset, UINT8 data) +{ +} + + + +/*************************************************************************** + PIA1 +***************************************************************************/ + +//------------------------------------------------- +// ff20_read +//------------------------------------------------- + +READ8_MEMBER( dragon_alpha_state::ff20_read ) +{ + UINT8 result = 0x00; + + switch(offset & 0x0f) + { + case 0: case 1: case 2: case 3: + result = dragon_state::ff20_read(space, offset, mem_mask); + break; + + case 4: case 5: case 6: case 7: + result = m_pia_2->read(space, offset, mem_mask); + break; + + case 8: case 9: case 10: case 11: + result = modem_r(offset); + break; + + case 12: + result = m_fdc->data_r(space, 0); + break; + + case 13: + result = m_fdc->sector_r(space, 0); + break; + + case 14: + result = m_fdc->track_r(space, 0); + break; + + case 15: + result = m_fdc->status_r(space, 0); + break; + } + + return result; +} + + + +//------------------------------------------------- +// ff20_write +//------------------------------------------------- + +WRITE8_MEMBER( dragon_alpha_state::ff20_write ) +{ + switch(offset & 0x0f) + { + case 0: case 1: case 2: case 3: + dragon_state::ff20_write(space, offset, data, mem_mask); + break; + + case 4: case 5: case 6: case 7: + m_pia_2->write(space, offset, data, mem_mask); + break; + + case 8: case 9: case 10: case 11: + modem_w(offset, data); + break; + + case 12: + m_fdc->data_w(space, 0, data); + break; + case 13: + m_fdc->sector_w(space, 0, data); + break; + case 14: + m_fdc->track_w(space, 0, data); + break; + case 15: + m_fdc->cmd_w(space, 0, data); + break; + } +} + + +/*************************************************************************** + PIA2 ($FF24-$FF28) on Dragon Alpha/Professional + + PIA2 PA0 bcdir to AY-8912 + PIA2 PA1 bc0 to AY-8912 + PIA2 PA2 Rom switch, 0=basic rom, 1=boot rom. + PIA2 PA3-PA7 Unknown/unused ? + PIA2 PB0-PB7 connected to D0..7 of the AY8912. + CB1 DRQ from WD2797 disk controler. +***************************************************************************/ + +//------------------------------------------------- +// pia2_pa_w +//------------------------------------------------- + +WRITE8_MEMBER( dragon_alpha_state::pia2_pa_w ) +{ + UINT8 ddr = ~m_pia_2->port_b_z_mask(); + + /* If bit 2 of the pia2 ddra is 1 then this pin is an output so use it */ + /* to control the paging of the boot and basic roms */ + /* Otherwise it set as an input, with an internal pull-up so it should */ + /* always be high (enabling boot rom) */ + /* PIA FIXME if (pia_get_ddr_a(2) & 0x04) */ + if(ddr & 0x04) + { + page_rom(data & 0x04 ? true : false); /* bit 2 controls boot or basic rom */ + } + + /* Bits 0 and 1 for pia2 port a control the BCDIR and BC1 lines of the */ + /* AY-8912 */ + switch (data & 0x03) + { + case 0x00: /* Inactive, do nothing */ + break; + case 0x01: /* Write to selected port */ + m_ay8912->data_w(space, 0, m_pia_2->b_output()); + break; + case 0x02: /* Read from selected port */ + m_pia_2->portb_w(m_ay8912->data_r(space, 0)); + break; + case 0x03: /* Select port to write to */ + m_ay8912->address_w(space, 0, m_pia_2->b_output()); + break; + } +} + + + +//------------------------------------------------- +// pia1_firq_a +//------------------------------------------------- + +WRITE_LINE_MEMBER( dragon_alpha_state::pia2_firq_a ) +{ + recalculate_firq(); +} + + + +//------------------------------------------------- +// pia1_firq_b +//------------------------------------------------- + +WRITE_LINE_MEMBER( dragon_alpha_state::pia2_firq_b ) +{ + recalculate_firq(); +} + + + +/*************************************************************************** + CPU INTERRUPTS +***************************************************************************/ + +//------------------------------------------------- +// firq_get_line - gets the value of the FIRQ line +// passed into the CPU +//------------------------------------------------- + +bool dragon_alpha_state::firq_get_line(void) +{ + return dragon_state::firq_get_line() || m_pia_2->irq_a_state() || m_pia_2->irq_b_state(); +} + + + +/*************************************************************************** + AY8912 +***************************************************************************/ + +//------------------------------------------------- +// psg_porta_read +//------------------------------------------------- + +READ8_MEMBER( dragon_alpha_state::psg_porta_read ) +{ + return 0; +} + + + +//------------------------------------------------- +// psg_porta_read +//------------------------------------------------- + +WRITE8_MEMBER( dragon_alpha_state::psg_porta_write ) +{ + /* Bits 0..3 are the drive select lines for the internal floppy interface */ + /* Bit 4 is the motor on, in the real hardware these are inverted on their way to the drive */ + /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */ + + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + + // todo: turning the motor on with bit 4 isn't giving the drive enough + // time to spin up, how does it work in hardware? + if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0); + if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0); + if (m_floppy2->get_device()) m_floppy2->get_device()->mon_w(0); + if (m_floppy3->get_device()) m_floppy3->get_device()->mon_w(0); + + m_fdc->dden_w(BIT(data, 5)); +} + +/*************************************************************************** + FDC +***************************************************************************/ + +//------------------------------------------------- +// fdc_intrq_w - The NMI line on the Alpha is gated +// through IC16 (early PLD), and is gated by pia2 CA2 +//------------------------------------------------- + +WRITE_LINE_MEMBER( dragon_alpha_state::fdc_intrq_w ) +{ + if (state) + { + if (m_just_reset) + { + m_just_reset = 0; + } + else + { + if (m_pia_2->ca2_output_z()) + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + } + } + else + { + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + } +} + + + +//------------------------------------------------- +// fdc_drq_w - The DRQ line goes through pia2 CB1, +// in exactly the same way as DRQ from DragonDos +// does for pia1 CB1 +//------------------------------------------------- + +WRITE_LINE_MEMBER( dragon_alpha_state::fdc_drq_w ) +{ + m_pia_2->cb1_w(state ? ASSERT_LINE : CLEAR_LINE); +} diff --git a/src/mame/machine/dmv_keyb.c b/src/mame/machine/dmv_keyb.c new file mode 100644 index 00000000000..1fe0f2f8f43 --- /dev/null +++ b/src/mame/machine/dmv_keyb.c @@ -0,0 +1,313 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/********************************************************************** + + Decision Mate V keyboard emulation + +*********************************************************************/ + +#include "dmv_keyb.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type DMV_KEYBOARD = &device_creator; + + +//*************************************************************************** +// IMPLEMENTATION +//*************************************************************************** + +ROM_START( dmv_keyboard ) + ROM_REGION( 0x400, "mcu", 0 ) + ROM_LOAD( "dmv_kbmcu.bin", 0x0000, 0x0400, CRC(14e376de) SHA1 (ed09048ef03c602dba17ad6fcfe125c082c9bb17)) +ROM_END + + +static ADDRESS_MAP_START( dmv_keyboard_io, AS_IO, 8, dmv_keyboard_device ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(port1_r) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(port2_r, port2_w) +ADDRESS_MAP_END + + +static MACHINE_CONFIG_FRAGMENT( dmv_keyboard ) + MCFG_CPU_ADD("mcu", I8741, XTAL_6MHz) + MCFG_CPU_IO_MAP(dmv_keyboard_io) +MACHINE_CONFIG_END + + +INPUT_PORTS_START( dmv_keyboard ) + PORT_START("COL.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("COL.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("00") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("COL.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("CLR") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("COL.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("COL.4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("COL.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("COL.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_NAME("Backspace") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + + PORT_START("COL.7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F14") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) PORT_NAME("Enter") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13") + + PORT_START("COL.8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("COL.9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F16") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F18") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + + PORT_START("COL.10") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F19") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + + PORT_START("COL.11") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F15") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F17") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + + PORT_START("COL.12") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F20") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("COL.13") + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("COL.14") + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("COL.15") + PORT_DIPNAME( 0x07, 0x00, "Lanuguage Code" ) + PORT_DIPSETTING( 0x00, "US English" ) + PORT_DIPSETTING( 0x01, "UK/Int. English" ) + PORT_DIPSETTING( 0x02, "Danish" ) + PORT_DIPSETTING( 0x03, "German" ) + PORT_DIPSETTING( 0x04, "Swedish/Finnish" ) + PORT_DIPSETTING( 0x05, "Norwegian" ) + PORT_DIPSETTING( 0x06, "Spanish" ) + PORT_DIPSETTING( 0x07, "Italian" ) + PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor dmv_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( dmv_keyboard ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// dmv_keyboard_device - constructor +//------------------------------------------------- + +dmv_keyboard_device::dmv_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DMV_KEYBOARD, "Decision Mate V Keyboard", tag, owner, clock, "dmv_keyboard", __FILE__), + m_maincpu(*this, "mcu"), + m_keyboard(*this, "COL") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dmv_keyboard_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dmv_keyboard_device::device_reset() +{ + m_col = 0; + m_sd_data_state = 1; + m_sd_poll_state = 1; +} + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor dmv_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( dmv_keyboard ); +} + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *dmv_keyboard_device::device_rom_region() const +{ + return ROM_NAME( dmv_keyboard ); +} + + +//------------------------------------------------- +// port1_r - +//------------------------------------------------- + +READ8_MEMBER( dmv_keyboard_device::port1_r ) +{ + return m_keyboard[m_col]->read(); +} + +//------------------------------------------------- +// port2_r +//------------------------------------------------- + +READ8_MEMBER( dmv_keyboard_device::port2_r ) +{ + return ((m_sd_data_state | m_sd_poll_state) << 7) | m_col; +} + +//------------------------------------------------- +// port2_w +//------------------------------------------------- + +WRITE8_MEMBER( dmv_keyboard_device::port2_w ) +{ + /* + P2.0 col 0 + P2.1 col 1 + P2.2 col 2 + P2.3 col 3 + P2.7 SDATA + */ + + m_col = data & 0x0f; + m_sd_data_state = BIT(data, 7); +} + +//------------------------------------------------- +// sd_poll_w +//------------------------------------------------- + +DECLARE_WRITE_LINE_MEMBER(dmv_keyboard_device::sd_poll_w) +{ + if (m_sd_poll_state && !state) + m_maincpu->upi41_master_w(m_maincpu->space(), 0, 0); + + m_sd_poll_state = state; +} + +//------------------------------------------------- +// sd_poll_r +//------------------------------------------------- + +DECLARE_READ_LINE_MEMBER(dmv_keyboard_device::sd_poll_r) +{ + return m_sd_data_state; +} diff --git a/src/mame/machine/dmv_keyb.h b/src/mame/machine/dmv_keyb.h new file mode 100644 index 00000000000..a20f59a27d4 --- /dev/null +++ b/src/mame/machine/dmv_keyb.h @@ -0,0 +1,71 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/********************************************************************** + + Decision Mate V keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __DMV_KEYBOARD__ +#define __DMV_KEYBOARD__ + + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_DMV_KEYBOARD_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, DMV_KEYBOARD, 0) + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> dmv_keyboard_device + +class dmv_keyboard_device : public device_t +{ +public: + // construction/destruction + dmv_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_WRITE_LINE_MEMBER(sd_poll_w); + DECLARE_READ_LINE_MEMBER(sd_poll_r); + + DECLARE_READ8_MEMBER( port1_r ); + DECLARE_READ8_MEMBER( port2_r ); + DECLARE_WRITE8_MEMBER( port2_w ); + +protected: + // device-level overrides + virtual void device_config_complete() { m_shortname = "dmv_keyb"; } + virtual void device_start(); + virtual void device_reset(); + +private: + required_device m_maincpu; + required_ioport_array<16> m_keyboard; + + UINT8 m_col; + int m_sd_data_state; + int m_sd_poll_state; +}; + + +// device type definition +extern const device_type DMV_KEYBOARD; + + +#endif diff --git a/src/mame/machine/docg3.c b/src/mame/machine/docg3.c new file mode 100644 index 00000000000..e0701987b7b --- /dev/null +++ b/src/mame/machine/docg3.c @@ -0,0 +1,842 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/* + + M-Systems DiskOnChip G3 - Flash Disk with MLC NAND and M-Systems? x2 Technology + + (c) 2009 Tim Schuerewegen + +*/ + +#include "emu.h" +#include "machine/docg3.h" + +#define VERBOSE_LEVEL ( 0 ) + +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... ) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%s: %s", machine.describe_context(), buf ); + } +} + + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +// device type definition +const device_type DISKONCHIP_G3 = &device_creator; + +//------------------------------------------------- +// diskonchip_g3_device - constructor +//------------------------------------------------- + +diskonchip_g3_device::diskonchip_g3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DISKONCHIP_G3, "DiskOnChip G3", tag, owner, clock, "diskonchip_g3", __FILE__), + device_nvram_interface(mconfig, *this) +{ +} + + +UINT32 diskonchip_g3_device::g3_offset_data_1() +{ +// printf( "block %d pages %d page %d planes %d plane %d user_data_size %d extra_area_size %d\n", doc->block, doc->pages, doc->page, doc->planes, doc->plane, doc->user_data_size, doc->extra_area_size); + return ((((m_block * m_pages) + m_page) * m_planes) + m_plane) * (m_user_data_size + m_extra_area_size); +} + +UINT32 diskonchip_g3_device::g3_offset_data_2() +{ + return ((((m_block * m_pages) + m_page) * m_planes) + m_plane) * 16; +} + +UINT32 diskonchip_g3_device::g3_offset_data_3() +{ + return m_block * 8; +} + +UINT8 diskonchip_g3_device::g3_read_data() +{ + UINT8 data = 0; + UINT32 offset; + if (m_test == 0) + { + // read page data (512 + 16) + if (m_transfer_offset >= (m_user_data_size + m_extra_area_size)) + { + m_transfer_offset = m_transfer_offset - (m_user_data_size + m_extra_area_size); + m_plane++; + } + offset = g3_offset_data_1() + m_transfer_offset; + data = m_data[0][offset]; + } + else if (m_test == 1) + { + // read ??? (0x28 bytes) + if (m_transfer_offset < 0x20) + { + offset = g3_offset_data_1() + (m_user_data_size + m_extra_area_size) + (m_user_data_size - 16) + m_transfer_offset; + data = m_data[0][offset]; + } + else if (m_transfer_offset < 0x28) + { + offset = g3_offset_data_3() + m_transfer_offset - 0x20; + data = m_data[2][offset]; + } + else + { + data = 0xFF; + } + } + else if (m_test == 2) + { + // read erase block status + data = 0x00; + } + m_transfer_offset++; + return data; +} + +READ16_MEMBER( diskonchip_g3_device::sec_1_r ) +{ + UINT16 data; + if (m_sec_2[0x1B] & 0x40) + { + data = g3_read_data(); + m_sec_2[0x1B] &= ~0x40; + } + else + { + data = (g3_read_data() << 0) | (g3_read_data() << 8); + } + verboselog( machine(), 9, "(DOC) %08X -> %04X\n", 0x0800 + (offset << 1), data); + return data; +} + +void diskonchip_g3_device::g3_write_data(UINT8 data) +{ + UINT32 offset; + if (m_test == 3) + { + // read page data (512 + 16) + if (m_transfer_offset >= (m_user_data_size + m_extra_area_size)) + { + m_transfer_offset = m_transfer_offset - (m_user_data_size + m_extra_area_size); + m_plane++; + } + if (m_transfer_offset == 0) + { + const UINT8 xxx[] = { 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + offset = g3_offset_data_2(); + memcpy( m_data[1] + offset, xxx, 16); + } + offset = g3_offset_data_1() + m_transfer_offset; + m_data[0][offset] = data; + } + m_transfer_offset++; +} + +WRITE16_MEMBER( diskonchip_g3_device::sec_1_w ) +{ + verboselog( machine(), 9, "(DOC) %08X <- %04X\n", 0x0800 + (offset << 1), data); + if (m_sec_2[0x1B] & 0x40) + { + g3_write_data(data); + m_sec_2[0x1B] &= ~0x40; + } + else + { + g3_write_data((data >> 0) & 0xFF); + g3_write_data((data >> 8) & 0xFF); + } +} + +// #define DoC_G3_IO 0x0800 +// #define DoC_G3_ChipID 0x1000 +// #define DoC_G3_DeviceIdSelect 0x100a +// #define DoC_G3_Ctrl 0x100c +// #define DoC_G3_CtrlConfirm 0x1072 +// #define DoC_G3_ReadAddress 0x101a +// #define DoC_G3_FlashSelect 0x1032 +// #define DoC_G3_FlashCmd 0x1034 +// #define DoC_G3_FlashAddr 0x1036 +// #define DoC_G3_FlashCtrl 0x1038 +// #define DoC_G3_Nop 0x103e + +UINT16 diskonchip_g3_device::sec_2_read_1000() +{ + if (m_device == 0) + { + return 0x0200; + } + else + { + return 0x008C; + } +} + +UINT16 diskonchip_g3_device::sec_2_read_1074() +{ + if (m_device == 0) + { + return 0xFDFF; + } + else + { + return 0x02B3; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_1042() +{ + UINT8 data; + if ((m_block == 0) && (m_page == 0) && (m_transfersize == 0x27)) + { + data = 0x07; + } + else + { + UINT32 offset = g3_offset_data_2() + 0x02; + data = m_data[1][offset]; //0x07; //data & ~(1 << 7); + if ((m_sec_2[0x41] & 0x10) == 0) + { + data = data & ~0x20; + } + if ((m_sec_2[0x41] & 0x08) == 0) + { + data = data & ~0x80; + } + if (m_test != 0) + { + data = 0x00; + } + } + return data; +} + +UINT8 diskonchip_g3_device::sec_2_read_1046() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x06; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_1048() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x08; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_1049() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x09; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_104A() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x0A; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_104B() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x0B; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_104C() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x0C; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_104D() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x0D; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_104E() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x0E; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_104F() +{ + if (m_test == 0) + { + UINT32 offset = g3_offset_data_2() + 0x0F; + return m_data[1][offset]; + } + else + { + return 0x00; + } +} + +UINT8 diskonchip_g3_device::sec_2_read_100E() +{ + return 0x81; +} + +UINT8 diskonchip_g3_device::sec_2_read_1014() +{ + return 0x01; +} + +UINT8 diskonchip_g3_device::sec_2_read_1022() +{ + return 0x85; +} + +UINT8 diskonchip_g3_device::sec_2_read_1038() +{ + // bit 0 = ? + // bit 1 = ? error 0x7C + // bit 2 = ? error 0x73 + // bit 3 = ? + // bit 4 = ? + // bit 5 = ? + // bit 6 = ? + // bit 7 = ? + if (m_device == 0) + { + return 0x19; + } + else + { + return 0x38; + } +} + +UINT16 diskonchip_g3_device::sec_2_read16(UINT32 offset) +{ + UINT16 data = (m_sec_2[offset+0] << 0) + (m_sec_2[offset+1] << 8); + switch (0x1000 + offset) + { + // ? + case 0x1000 : data = sec_2_read_1000(); break; + // ? + case 0x100E : data = sec_2_read_100E(); break; + // ? + case 0x1014 : data = sec_2_read_1014(); break; + // ? + case 0x1022 : data = sec_2_read_1022(); break; + // flash control + case 0x1038 : data = sec_2_read_1038(); break; + // flash ? + case 0x1042 : data = sec_2_read_1042(); break; + // ? + case 0x1046 : data = sec_2_read_1046(); break; + // ? + case 0x1048 : data = (sec_2_read_1048() << 0) + (sec_2_read_1049() << 8); break; + case 0x104A : data = (sec_2_read_104A() << 0) + (sec_2_read_104B() << 8); break; + case 0x104C : data = (sec_2_read_104C() << 0) + (sec_2_read_104D() << 8); break; + case 0x104E : data = (sec_2_read_104E() << 0) + (sec_2_read_104F() << 8); break; + // ? + case 0x1074 : data = sec_2_read_1074(); break; + } + verboselog( machine(), 9, "(DOC) %08X -> %04X\n", 0x1000 + offset, data); + return data; +} + +UINT8 diskonchip_g3_device::sec_2_read8(UINT32 offset) +{ + UINT8 data = m_sec_2[offset]; + switch (0x1000 + offset) + { + // ? + case 0x100E : data = sec_2_read_100E(); break; + // ? + case 0x1014 : data = sec_2_read_1014(); break; + // ? + case 0x1022 : data = sec_2_read_1022(); break; + // flash control + case 0x1038 : data = sec_2_read_1038(); break; + // flash ? + case 0x1042 : data = sec_2_read_1042(); break; + // ? + case 0x1046 : data = sec_2_read_1046(); break; + // ? + case 0x1048 : data = sec_2_read_1048(); break; + case 0x1049 : data = sec_2_read_1049(); break; + case 0x104A : data = sec_2_read_104A(); break; + case 0x104B : data = sec_2_read_104B(); break; + case 0x104C : data = sec_2_read_104C(); break; + case 0x104D : data = sec_2_read_104D(); break; + case 0x104E : data = sec_2_read_104E(); break; + case 0x104F : data = sec_2_read_104F(); break; + } + verboselog( machine(), 9, "(DOC) %08X -> %02X\n", 0x1000 + offset, data); + return data; +} + +void diskonchip_g3_device::sec_2_write_100C(UINT8 data) +{ + const char *mode_name[] = { "reset", "normal", "deep power down" }; + UINT32 mode = data & 3; + verboselog( machine(), 5, "mode %d (%s)\n", mode, mode_name[mode]); + if (mode == 0) + { + m_sec_2[0x04] = 00; + } +} + +void diskonchip_g3_device::sec_2_write_1032(UINT8 data) +{ + verboselog( machine(), 5, "flash select %02X\n", data); + if ((data == 0x12) || (data == 0x27)) + { + m_transfer_offset = 0; + m_plane = 0; + m_block = 0; + m_page = 0; + } +} + +void diskonchip_g3_device::g3_erase_block() +{ + UINT32 offset; + int i, j; + const UINT8 xxx[] = { 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0xCE, 0x00, 0xCF, 0x72, 0xFC, 0x1B, 0xA9, 0xC7, 0xB9, 0x00 }; + verboselog( machine(), 5, "erase block %04X\n", m_block); + for (i=0;i> 7); + if (block >= m_blocks) fatalerror( "DOCG3: invalid block (%d)\n", block); + plane = (m_data_1036 >> 6) & 1; + page = (m_data_1036 >> 0) & 0x3F; + verboselog( machine(), 5, "flash address %d - %06X (plane %d block %04X page %04X)\n", m_address_count, m_data_1036, plane, block, page); + if (m_address_count == 1) + { + m_plane = 0; + m_block = block; + m_page = page; + } + } + } + else if (m_sec_2[0x34] == 0x80) + { + m_data_1036 |= data << (8 * m_data_1036_count++); + if (m_data_1036_count == 4) + { + UINT32 block, page, plane, unk; + block = (m_data_1036 >> 15); + plane = (m_data_1036 >> 14) & 1; + page = (m_data_1036 >> 8) & 0x3F; + unk = (m_data_1036 >> 0) & 0xFF; + verboselog( machine(), 5, "flash address %d - %08X (plane %d block %04X page %04X unk %02X)\n", m_address_count, m_data_1036, plane, block, page, unk); + if (m_address_count == 1) + { + m_plane = 0; + m_block = block; + m_page = page; + m_transfer_offset = 0; + } + } + } + else if (m_sec_2[0x34] == 0x05) + { + m_transfer_offset = data << 2; + verboselog( machine(), 5, "flash transfer offset %04X\n", m_transfer_offset); + } +} + +void diskonchip_g3_device::sec_2_write_1040(UINT16 data) +{ + m_transfersize = (data & 0x3FF); + verboselog( machine(), 5, "flash transfer size %04X\n", m_transfersize); +} + +void diskonchip_g3_device::sec_2_write_100A(UINT8 data) +{ + m_device = data & 3; + verboselog( machine(), 5, "select device %d\n", m_device); +} + +void diskonchip_g3_device::sec_2_write16(UINT32 offset, UINT16 data) +{ + m_sec_2[offset+0] = (data >> 0) & 0xFF; + m_sec_2[offset+1] = (data >> 8) & 0xFF; + verboselog( machine(), 9, "(DOC) %08X <- %04X\n", 0x1000 + offset, data); + switch (0x1000 + offset) + { + // ? + case 0x100C : sec_2_write_100C(data); break; + // Device ID Select Register + case 0x100A : sec_2_write_100A(data); break; + // flash select + case 0x1032 : sec_2_write_1032(data); break; + // flash command + case 0x1034 : sec_2_write_1034(data); break; + // flash address + case 0x1036 : sec_2_write_1036(data); break; + // ? + case 0x1040 : sec_2_write_1040(data); break; + } +} + +void diskonchip_g3_device::sec_2_write8(UINT32 offset, UINT8 data) +{ + m_sec_2[offset] = data; + verboselog( machine(), 9, "(DOC) %08X <- %02X\n", 0x1000 + offset, data); + switch (0x1000 + offset) + { + // ? + case 0x100C : sec_2_write_100C(data); break; + // Device ID Select Register + case 0x100A : sec_2_write_100A(data); break; + // flash select + case 0x1032 : sec_2_write_1032(data); break; + // flash command + case 0x1034 : sec_2_write_1034(data); break; + // flash address + case 0x1036 : sec_2_write_1036(data); break; + } +} + +READ16_MEMBER( diskonchip_g3_device::sec_2_r ) +{ + if (mem_mask == 0xffff) + { + return sec_2_read16(offset * 2); + } + else if (mem_mask == 0x00ff) + { + return sec_2_read8(offset * 2 + 0) << 0; + } + else if (mem_mask == 0xff00) + { + return sec_2_read8( offset * 2 + 1) << 8; + } + else + { + verboselog( machine(), 0, "diskonchip_g3_sec_2_r: unknown mem_mask %08X\n", mem_mask); + return 0; + } +} + +WRITE16_MEMBER( diskonchip_g3_device::sec_2_w ) +{ + if (mem_mask == 0xffff) + { + sec_2_write16(offset * 2, data); + } + else if (mem_mask == 0x00ff) + { + sec_2_write8(offset * 2 + 0, (data >> 0) & 0xFF); + } + else if (mem_mask == 0xff00) + { + sec_2_write8(offset * 2 + 1, (data >> 8) & 0xFF); + } + else + { + verboselog( machine(), 0, "diskonchip_g3_sec_2_w: unknown mem_mask %08X\n", mem_mask); + } +} + +READ16_MEMBER( diskonchip_g3_device::sec_3_r ) +{ + UINT16 data = 0; + verboselog( machine(), 9, "(DOC) %08X -> %04X\n", 0x1800 + (offset << 1), data); + return data; +} + +WRITE16_MEMBER( diskonchip_g3_device::sec_3_w ) +{ + verboselog( machine(), 9, "(DOC) %08X <- %02X\n", 0x1800 + (offset << 1), data); +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- +void diskonchip_g3_device::device_start() +{ + verboselog( machine(), 9, "(DOC) device start\n"); + + switch (m_size) + { + case 64 : + { + m_planes = 2; + m_blocks = 1024; + m_pages = 64; + m_user_data_size = 512; + m_extra_area_size = 16; + } + break; + } + + m_data_size[0] = m_planes * m_blocks * m_pages * (m_user_data_size + m_extra_area_size); + m_data_size[1] = m_planes * m_blocks * m_pages * 16; + m_data_size[2] = m_blocks * 8; + + m_device = 0; + m_block = 0; + m_page = 0; + m_transfersize = 0; + m_plane = 0; + m_test = 0; + + memset(m_sec_2, 0, sizeof(m_sec_2)); + + m_data[0] = auto_alloc_array( machine(), UINT8, m_data_size[0]); + memset(m_data[0], 0, sizeof(UINT8) * m_data_size[0]); + m_data[1] = auto_alloc_array( machine(), UINT8, m_data_size[1]); + memset(m_data[1], 0, sizeof(UINT8) * m_data_size[1]); + m_data[2] = auto_alloc_array( machine(), UINT8, m_data_size[2]); + memset(m_data[2], 0, sizeof(UINT8) * m_data_size[2]); + +// diskonchip_load( device, "diskonchip"); + + save_item( NAME(m_planes)); + save_item( NAME(m_blocks)); + save_item( NAME(m_pages)); + save_item( NAME(m_user_data_size)); + save_item( NAME(m_extra_area_size)); + save_pointer( NAME(m_data[0]), m_data_size[0]); + save_pointer( NAME(m_data[1]), m_data_size[1]); + save_pointer( NAME(m_data[2]), m_data_size[2]); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void diskonchip_g3_device::device_reset() +{ + verboselog( machine(), 9, "(DOC) device reset\n"); +} + +//------------------------------------------------- +// nvram_default - called to initialize NVRAM to +// its default state +//------------------------------------------------- + +void diskonchip_g3_device::nvram_default() +{ + memset(m_data[0], 0xFF, m_data_size[0]); + memset(m_data[1], 0x00, m_data_size[1]); + memset(m_data[2], 0xFF, m_data_size[2]); +} + +//------------------------------------------------- +// nvram_read - called to read NVRAM from the +// .nv file +//------------------------------------------------- + +void diskonchip_g3_device::nvram_read(emu_file &file) +{ + file.read(m_data[0], m_data_size[0]); + file.read(m_data[1], m_data_size[1]); + file.read(m_data[2], m_data_size[2]); +} + +//------------------------------------------------- +// nvram_write - called to write NVRAM to the +// .nv file +//------------------------------------------------- + +void diskonchip_g3_device::nvram_write(emu_file &file) +{ + file.write(m_data[0], m_data_size[0]); + file.write(m_data[1], m_data_size[1]); + file.write(m_data[2], m_data_size[2]); +} diff --git a/src/mame/machine/docg3.h b/src/mame/machine/docg3.h new file mode 100644 index 00000000000..0a00b446500 --- /dev/null +++ b/src/mame/machine/docg3.h @@ -0,0 +1,103 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/* + + M-Systems DiskOnChip G3 - Flash Disk with MLC NAND and M-Systems? x2 Technology + + (c) 2009 Tim Schuerewegen + +*/ + +#ifndef __DOCG3_H__ +#define __DOCG3_H__ + +#define MCFG_DISKONCHIP_G3_ADD(_tag, _size) \ + MCFG_DEVICE_ADD(_tag, DISKONCHIP_G3, 0) \ + static_cast(device)->set_size(_size); + +// ======================> diskonchip_g3_device + +class diskonchip_g3_device : public device_t, + public device_nvram_interface +{ +public: + // construction/destruction + diskonchip_g3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + void set_size(int _size) { m_size = _size; } +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // device_nvram_interface overrides + virtual void nvram_default(); + virtual void nvram_read(emu_file &file); + virtual void nvram_write(emu_file &file); +public: + DECLARE_READ16_MEMBER( sec_1_r ); + DECLARE_WRITE16_MEMBER( sec_1_w ); + DECLARE_READ16_MEMBER( sec_2_r ); + DECLARE_WRITE16_MEMBER( sec_2_w ); + DECLARE_READ16_MEMBER( sec_3_r ); + DECLARE_WRITE16_MEMBER( sec_3_w ); +private: + UINT32 g3_offset_data_1(); + UINT32 g3_offset_data_2(); + UINT32 g3_offset_data_3(); + UINT8 g3_read_data(); + void g3_write_data(UINT8 data); + UINT16 sec_2_read_1000(); + UINT16 sec_2_read_1074(); + UINT8 sec_2_read_1042(); + UINT8 sec_2_read_1046(); + UINT8 sec_2_read_1048(); + UINT8 sec_2_read_1049(); + UINT8 sec_2_read_104A(); + UINT8 sec_2_read_104B(); + UINT8 sec_2_read_104C(); + UINT8 sec_2_read_104D(); + UINT8 sec_2_read_104E(); + UINT8 sec_2_read_104F(); + UINT8 sec_2_read_100E(); + UINT8 sec_2_read_1014(); + UINT8 sec_2_read_1022(); + UINT8 sec_2_read_1038(); + UINT16 sec_2_read16(UINT32 offset); + UINT8 sec_2_read8(UINT32 offset); + void sec_2_write_100C(UINT8 data); + void sec_2_write_1032(UINT8 data); + void g3_erase_block(); + void sec_2_write_1034(UINT8 data); + void sec_2_write_1036(UINT8 data); + void sec_2_write_1040(UINT16 data); + void sec_2_write_100A(UINT8 data); + void sec_2_write16(UINT32 offset, UINT16 data); + void sec_2_write8(UINT32 offset, UINT8 data); + + int m_size; + + UINT32 m_planes; + UINT32 m_blocks; + UINT32 m_pages; + UINT32 m_user_data_size; + UINT32 m_extra_area_size; + UINT8 *m_data[3]; + UINT32 m_data_size[3]; + UINT8 m_sec_2[0x800]; + UINT32 m_data_1036; + UINT32 m_data_1036_count; + UINT32 m_transfer_offset; + UINT8 m_device; + UINT32 m_block; + UINT32 m_page; + UINT32 m_plane; + UINT32 m_transfersize; + UINT8 m_test; + UINT32 m_address_count; +}; + +// device type definition +extern const device_type DISKONCHIP_G3; + +#endif /* __DOCG3_H__ */ diff --git a/src/mame/machine/dragon.c b/src/mame/machine/dragon.c new file mode 100644 index 00000000000..12c902d5c93 --- /dev/null +++ b/src/mame/machine/dragon.c @@ -0,0 +1,153 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + dragon.h + + Dragon Family + +Dragon Alpha code added 21-Oct-2004, + Phill Harvey-Smith (afra@aurigae.demon.co.uk) + + Added AY-8912 and FDC code 30-Oct-2004. + +Fixed Dragon Alpha NMI enable/disable, following circuit traces on a real machine. + P.Harvey-Smith, 11-Aug-2005. + +Re-implemented Alpha NMI enable/disable, using direct PIA reads, rather than +keeping track of it in a variable in the driver. + P.Harvey-Smith, 25-Sep-2006. + +Radically re-wrote memory emulation code for CoCo 1/2 & Dragon machines, the +new code emulates the memory mapping of the SAM, dependent on what size of +RAM chips it is programed to use, including proper mirroring of the RAM. + +Replaced the kludged emulation of the cart line, with a timer based trigger +this is set to toggle at 1Hz, this seems to be good enough to trigger the +cartline, but is so slow in real terms that it should have very little +impact on the emulation speed. + +Re-factored the code common to all machines, and separated the code different, +into callbacks/functions unique to the machines, in preperation for splitting +the code for individual machine types into separate files, I have preposed, that +the CoCo 1/2 should stay in coco.c, and that the coco3 and dragon specifc code +should go into coco3.c and dragon.c which should (hopefully) make the code +easier to manage. + P.Harvey-Smith, Dec 2006-Feb 2007 + +***************************************************************************/ + +#include "includes/dragon.h" + + +/*************************************************************************** + DRAGON32 +***************************************************************************/ + +//------------------------------------------------- +// pia1_pa_changed - called when PIA1 PA changes +//------------------------------------------------- + +void dragon_state::pia1_pa_changed(UINT8 data) +{ + /* call inherited function */ + coco12_state::pia1_pa_changed(data); + + /* if strobe bit is high send data from pia0 port b to dragon parallel printer */ + if (data & 0x02) + { + UINT8 output = m_pia_1->b_output(); + m_printer->output(output); + } +} + + +/*************************************************************************** + DRAGON64 +***************************************************************************/ + +//------------------------------------------------- +// ff00_read +//------------------------------------------------- + +READ8_MEMBER( dragon64_state::ff00_read ) +{ + UINT8 result = 0x00; + + switch(offset & 0x07) + { + case 0: case 1: case 2: case 3: + result = dragon_state::ff00_read(space, offset, mem_mask); + break; + + case 4: case 5: case 6: case 7: + result = m_acia->read(space, offset, mem_mask); + break; + } + return result; +} + + + +//------------------------------------------------- +// ff00_write +//------------------------------------------------- + +WRITE8_MEMBER( dragon64_state::ff00_write ) +{ + switch(offset & 0x07) + { + case 0: case 1: case 2: case 3: + dragon_state::ff00_write(space, offset, data, mem_mask); + break; + + case 4: case 5: case 6: case 7: + m_acia->write(space, offset, data, mem_mask); + break; + } +} + + + +//------------------------------------------------- +// pia1_pb_changed +//------------------------------------------------- + +void dragon64_state::pia1_pb_changed(UINT8 data) +{ + dragon_state::pia1_pb_changed(data); + + UINT8 ddr = ~m_pia_1->port_b_z_mask(); + + /* If bit 2 of the pia1 ddrb is 1 then this pin is an output so use it */ + /* to control the paging of the 32k and 64k basic roms */ + /* Otherwise it set as an input, with an EXTERNAL pull-up so it should */ + /* always be high (enabling 32k basic rom) */ + if (ddr & 0x04) + { + page_rom(data & 0x04 ? true : false); + logerror("pia1_pb_changed\n"); + } +} + + + +//------------------------------------------------- +// page_rom - Controls rom paging in Dragon 64, +// and Dragon Alpha. +// +// On 64, switches between the two versions of the +// basic rom mapped in at 0x8000 +// +// On the alpha switches between the +// Boot/Diagnostic rom and the basic rom +//------------------------------------------------- + +void dragon64_state::page_rom(bool romswitch) +{ + offs_t offset = romswitch + ? 0x0000 // This is the 32k mode basic(64)/boot rom(alpha) + : 0x8000; // This is the 64k mode basic(64)/basic rom(alpha) + m_sam->set_bank_offset(1, offset); // 0x8000-0x9FFF + m_sam->set_bank_offset(2, offset); // 0xA000-0xBFFF +} diff --git a/src/mame/machine/egret.c b/src/mame/machine/egret.c new file mode 100644 index 00000000000..079a2504536 --- /dev/null +++ b/src/mame/machine/egret.c @@ -0,0 +1,489 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/* + Apple "Egret" ADB/system controller MCU + Emulation by R. Belmont + + Port definitions, primarily from the schematics. + + Port A: + + x------- O ADB data line out + -x------ I ADB data line in + --x----- I System type. 0 = hardware power switch, 1 = Egret controls power on/off + ---x---- O DFAC latch + ----x--- O ? (asserted briefly when resetting 680x0) + -----x-- I Keyboard power switch + ------x- ? PSU enable OUT for system type 0, otherwise chassis power switch IN + -------x ? Control panel enable IN for system type 0 (e.g. LC), power supply enable OUT for type 1 + + Port B: + + x------- O DFAC bit clock + -x------ ? DFAC data I/O (used in both directions) + --x----- ? VIA shift register data (used in both directions) + ---x---- O VIA clock + ----x--- I VIA SYS_SESSION + -----x-- I VIA VIA_FULL + ------x- O VIA XCEIVER SESSION + -------x I +5v sense + + Port C: + x--- O 680x0 reset + -x-- ? 680x0 IPL 2 (used in both directions) + --xx ? IPL 1/0 for hardware power switch, trickle sense (bit 1) and pulled up to +5v (bit 0) if Egret controls the PSU +*/ + + +//#define EGRET_SUPER_VERBOSE + +#include "emu.h" +#include "egret.h" +#include "cpu/m6805/m6805.h" +#include "sound/asc.h" +#include "includes/mac.h" + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define EGRET_CPU_TAG "egret" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type EGRET = &device_creator; + +ROM_START( egret ) + ROM_REGION(0x4400, EGRET_CPU_TAG, 0) + ROM_LOAD( "341s0851.bin", 0x1100, 0x1100, CRC(ea9ea6e4) SHA1(8b0dae3ec66cdddbf71567365d2c462688aeb571) ) + ROM_LOAD( "341s0850.bin", 0x2200, 0x1100, CRC(4906ecd0) SHA1(95e08ba0c5d4b242f115f104aba9905dbd3fd87c) ) + ROM_LOAD( "344s0100.bin", 0x3300, 0x1100, CRC(59e2b6b6) SHA1(540e752b7da521f1bdb16e0ad7c5f46ddc92d4e9) ) +ROM_END + +//------------------------------------------------- +// ADDRESS_MAP +//------------------------------------------------- + +static ADDRESS_MAP_START( egret_map, AS_PROGRAM, 8, egret_device ) + AM_RANGE(0x0000, 0x0002) AM_READWRITE(ports_r, ports_w) + AM_RANGE(0x0004, 0x0006) AM_READWRITE(ddr_r, ddr_w) + AM_RANGE(0x0007, 0x0007) AM_READWRITE(pll_r, pll_w) + AM_RANGE(0x0008, 0x0008) AM_READWRITE(timer_ctrl_r, timer_ctrl_w) + AM_RANGE(0x0009, 0x0009) AM_READWRITE(timer_counter_r, timer_counter_w) + AM_RANGE(0x0012, 0x0012) AM_READWRITE(onesec_r, onesec_w) + AM_RANGE(0x0090, 0x00ff) AM_RAM // work RAM and stack + AM_RANGE(0x0100, 0x01ff) AM_READWRITE(pram_r, pram_w) + AM_RANGE(0x0f00, 0x1fff) AM_ROM AM_REGION(EGRET_CPU_TAG, 0) +ADDRESS_MAP_END + +//------------------------------------------------- +// MACHINE_CONFIG +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( egret ) + MCFG_CPU_ADD(EGRET_CPU_TAG, M68HC05EG, XTAL_32_768kHz*192) // 32.768 kHz input clock, can be PLL'ed to x128 = 4.1 MHz under s/w control + MCFG_CPU_PROGRAM_MAP(egret_map) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor egret_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( egret ); +} + +const rom_entry *egret_device::device_rom_region() const +{ + return ROM_NAME( egret ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data) +{ + switch (offset) + { + case 0: // port A +/* printf("ADB:%d DFAC:%d PowerEnable:%d\n", + (data & 0x80) ? 1 : 0, + (data & 0x10) ? 1 : 0, + (data & 0x02) ? 1 : 0);*/ + + if ((data & 0x80) != last_adb) + { +/* if (data & 0x80) + { + printf("EG ADB: 1->0 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time); + } + else + { + printf("EG ADB: 0->1 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time); + }*/ + + // allow the linechange handler to override us + adb_in = (data & 0x80) ? true : false; + + m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time); + write_linechange(((data & 0x80) >> 7) ^ 1); + + last_adb = data & 0x80; + last_adb_time = machine().time().as_ticks(1000000); + } + break; + + case 1: // port B + { + if (xcvr_session != ((data>>1)&1)) + { + #ifdef EGRET_SUPER_VERBOSE + printf("EG-> XCVR_SESSION: %d (PC=%x)\n", (data>>1)&1, m_maincpu->pc()); + #endif + xcvr_session = (data>>1) & 1; + } + if (via_data != ((data>>5)&1)) + { + #ifdef EGRET_SUPER_VERBOSE + printf("EG-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->pc()); + #endif + via_data = (data>>5) & 1; + write_via_data(via_data); + } + if (via_clock != ((data>>4)&1)) + { + #ifdef EGRET_SUPER_VERBOSE + printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc()); + #endif + via_clock = (data>>4) & 1; + write_via_clock(via_clock^1); + } + } + break; + + case 2: // port C + if ((data & 8) != reset_line) + { + #ifdef EGRET_SUPER_VERBOSE + printf("680x0 reset: %d -> %d\n", (ports[2] & 8)>>3, (data & 8)>>3); + #endif + reset_line = (data & 8); + + // falling edge, should reset the machine too + if ((ports[2] & 8) && !(data&8)) + { + // if PRAM's waiting to be loaded, transfer it now + if (!pram_loaded) + { + memcpy(pram, disk_pram, 0x100); + pram_loaded = true; + } + } + + write_reset((reset_line & 8) ? ASSERT_LINE : CLEAR_LINE); + } + break; + } +} + +READ8_MEMBER( egret_device::ddr_r ) +{ + return ddrs[offset]; +} + +WRITE8_MEMBER( egret_device::ddr_w ) +{ +/* printf("%02x to DDR %c\n", data, 'A' + offset);*/ + + send_port(space, offset, ports[offset] & data); + + ddrs[offset] = data; +} + +READ8_MEMBER( egret_device::ports_r ) +{ + UINT8 incoming = 0; + + switch (offset) + { + case 0: // port A + incoming |= adb_in ? 0x40 : 0; + + if (egret_controls_power) + { + incoming |= 0x02; // indicate soft power, indicate chassis switch on + } + else + { + //incoming |= 0x01; // enable control panel enabled + } + break; + + case 1: // port B + incoming |= 0x01; // always show +5v active + incoming |= via_full<<2; + incoming |= sys_session<<3; + incoming |= via_data<<5; + incoming |= 0x40; // show DFAC line high + break; + + case 2: // port C + if (egret_controls_power) + { + incoming |= 0x3; // trickle sense active, bit 0 pulled up as per schematics + } + break; + } + + // apply data direction registers + incoming &= (ddrs[offset] ^ 0xff); + // add in ddr-masked version of port writes + incoming |= (ports[offset] & ddrs[offset]); + + return incoming; +} + +WRITE8_MEMBER( egret_device::ports_w ) +{ + send_port(space, offset, data); + + ports[offset] = data; +} + +READ8_MEMBER( egret_device::pll_r ) +{ + return pll_ctrl; +} + +WRITE8_MEMBER( egret_device::pll_w ) +{ + #ifdef EGRET_SUPER_VERBOSE + if (pll_ctrl != data) + { + static const int clocks[4] = { 524288, 1048576, 2097152, 4194304 }; + printf("PLL ctrl: clock %d TCS:%d BCS:%d AUTO:%d BWC:%d PLLON:%d\n", clocks[data&3], + (data & 0x80) ? 1 : 0, + (data & 0x40) ? 1 : 0, + (data & 0x20) ? 1 : 0, + (data & 0x10) ? 1 : 0, + (data & 0x08) ? 1 : 0); + } + #endif + pll_ctrl = data; +} + +READ8_MEMBER( egret_device::timer_ctrl_r ) +{ + return timer_ctrl; +} + +WRITE8_MEMBER( egret_device::timer_ctrl_w ) +{ +// printf("%02x to timer control\n", data); + timer_ctrl = data; +} + +READ8_MEMBER( egret_device::timer_counter_r ) +{ + return timer_counter; +} + +WRITE8_MEMBER( egret_device::timer_counter_w ) +{ +// printf("%02x to timer/counter\n", data); + timer_counter = data; +} + +READ8_MEMBER( egret_device::onesec_r ) +{ + return onesec; +} + +WRITE8_MEMBER( egret_device::onesec_w ) +{ +// printf("%02x to one-second control\n", data); + + m_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + + if ((onesec & 0x40) && !(data & 0x40)) + { + m_maincpu->set_input_line(M68HC05EG_INT_CPI, CLEAR_LINE); + } + + onesec = data; +} + +READ8_MEMBER( egret_device::pram_r ) +{ + return pram[offset]; +} + +WRITE8_MEMBER( egret_device::pram_w ) +{ + pram[offset] = data; +} + +//------------------------------------------------- +// egret_device - constructor +//------------------------------------------------- + +egret_device::egret_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, EGRET, "Apple Egret", tag, owner, clock, "egret", __FILE__), + device_nvram_interface(mconfig, *this), + write_reset(*this), + write_linechange(*this), + write_via_clock(*this), + write_via_data(*this), + m_maincpu(*this, EGRET_CPU_TAG) +{ +} + +//------------------------------------------------- +// static_set_type - configuration helper to set +// the chip type +//------------------------------------------------- + +void egret_device::static_set_type(device_t &device, int type) +{ + egret_device &egret = downcast(device); + egret.rom_offset = type; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void egret_device::device_start() +{ + write_reset.resolve_safe(); + write_linechange.resolve_safe(); + write_via_clock.resolve_safe(); + write_via_data.resolve_safe(); + + m_timer = timer_alloc(0, NULL); + save_item(NAME(ddrs[0])); + save_item(NAME(ddrs[1])); + save_item(NAME(ddrs[2])); + save_item(NAME(ports[0])); + save_item(NAME(ports[1])); + save_item(NAME(ports[2])); + save_item(NAME(pll_ctrl)); + save_item(NAME(timer_ctrl)); + save_item(NAME(timer_counter)); + save_item(NAME(onesec)); + save_item(NAME(xcvr_session)); + save_item(NAME(via_full)); + save_item(NAME(sys_session)); + save_item(NAME(via_data)); + save_item(NAME(via_clock)); + save_item(NAME(adb_in)); + save_item(NAME(reset_line)); + save_item(NAME(m_adb_dtime)); + save_item(NAME(pram_loaded)); + save_item(NAME(pram)); + save_item(NAME(disk_pram)); + + UINT8 *rom = device().machine().root_device().memregion(device().subtag(EGRET_CPU_TAG).c_str())->base(); + + if (rom) + { + memcpy(rom, rom+rom_offset, 0x1100); + } +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void egret_device::device_reset() +{ + ddrs[0] = ddrs[1] = ddrs[2] = 0; + ports[0] = ports[1] = ports[2] = 0; + + m_timer->adjust(attotime::never); + + egret_controls_power = false; // set to hard power control + adb_in = true; // line is pulled up to +5v, so nothing plugged in would read as "1" + reset_line = 0; + xcvr_session = 0; + via_full = 0; + sys_session = 0; + via_data = 0; + via_clock = 0; + pll_ctrl = 0; + timer_ctrl = 0; + timer_counter = 0; + last_adb_time = m_maincpu->total_cycles(); + onesec = 0; + last_adb = 0; +} + +void egret_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + onesec |= 0x40; + + if (onesec & 0x10) + { + m_maincpu->set_input_line(M68HC05EG_INT_CPI, ASSERT_LINE); + } +} + +// the 6805 program clears PRAM on startup (on h/w it's always running once a battery is inserted) +// we deal with that by loading pram from disk to a secondary buffer and then slapping it into "live" +// once the Egret reboots the 68k +void egret_device::nvram_default() +{ + memset(pram, 0, 0x100); + memset(disk_pram, 0, 0x100); + + // IIsi and IIvx both default PRAM to this, it seems a reasonable default for Egret systems + pram[0x1] = 0x80; + pram[0x2] = 0x4f; + pram[0x3] = 0x48; + pram[0x8] = 0x13; + pram[0x9] = 0x88; + pram[0xb] = 0x4c; + pram[0xc] = 0x4e; + pram[0xd] = 0x75; + pram[0xe] = 0x4d; + pram[0xf] = 0x63; + pram[0x10] = 0xa8; + pram[0x14] = 0xcc; + pram[0x15] = 0x0a; + pram[0x16] = 0xcc; + pram[0x17] = 0x0a; + pram[0x1d] = 0x02; + pram[0x1e] = 0x63; + pram[0x6f] = 0x28; + pram[0x70] = 0x83; + pram[0x71] = 0x26; + pram[0x77] = 0x01; + pram[0x78] = 0xff; + pram[0x79] = 0xff; + pram[0x7a] = 0xff; + pram[0x7b] = 0xdf; + pram[0x7d] = 0x09; + pram[0xf3] = 0x12; + pram[0xf9] = 0x01; + pram[0xf3] = 0x12; + pram[0xfb] = 0x8d; + pram_loaded = false; +} + +void egret_device::nvram_read(emu_file &file) +{ + file.read(disk_pram, 0x100); + pram_loaded = false; +} + +void egret_device::nvram_write(emu_file &file) +{ + file.write(pram, 0x100); +} diff --git a/src/mame/machine/egret.h b/src/mame/machine/egret.h new file mode 100644 index 00000000000..cca418b62a5 --- /dev/null +++ b/src/mame/machine/egret.h @@ -0,0 +1,140 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +#pragma once + +#ifndef __EGRET_H__ +#define __EGRET_H__ + +#include "emu.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define EGRET_TAG "egret" + +#define EGRET_341S0851 0x1100 +#define EGRET_341S0850 0x2200 +#define EGRET_344S0100 0x3300 + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_EGRET_ADD(_type) \ + MCFG_DEVICE_ADD(EGRET_TAG, EGRET, 0) \ + MCFG_EGRET_TYPE(_type) + +#define MCFG_EGRET_REPLACE(_type) \ + MCFG_DEVICE_REPLACE(EGRET_TAG, EGRET, 0) \ + MCFG_EGRET_TYPE(_type) + +#define MCFG_EGRET_TYPE(_type) \ + egret_device::static_set_type(*device, _type); + +#define MCFG_EGRET_REMOVE() \ + MCFG_DEVICE_REMOVE(EGRET_TAG) + +#define MCFG_EGRET_RESET_CALLBACK(_cb) \ + devcb = &egret_device::set_reset_cb(*device, DEVCB_##_cb); + +#define MCFG_EGRET_LINECHANGE_CALLBACK(_cb) \ + devcb = &egret_device::set_linechange_cb(*device, DEVCB_##_cb); + +#define MCFG_EGRET_VIA_CLOCK_CALLBACK(_cb) \ + devcb = &egret_device::set_via_clock_cb(*device, DEVCB_##_cb); + +#define MCFG_EGRET_VIA_DATA_CALLBACK(_cb) \ + devcb = &egret_device::set_via_data_cb(*device, DEVCB_##_cb); + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> egret_device + +class egret_device : public device_t, public device_nvram_interface +{ +public: + // construction/destruction + egret_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // inline configuration helpers + static void static_set_type(device_t &device, int type); + + // device_config_nvram_interface overrides + virtual void nvram_default(); + virtual void nvram_read(emu_file &file); + virtual void nvram_write(emu_file &file); + + DECLARE_READ8_MEMBER( ddr_r ); + DECLARE_WRITE8_MEMBER( ddr_w ); + DECLARE_READ8_MEMBER( ports_r ); + DECLARE_WRITE8_MEMBER( ports_w ); + DECLARE_READ8_MEMBER( pll_r ); + DECLARE_WRITE8_MEMBER( pll_w ); + DECLARE_READ8_MEMBER( timer_ctrl_r ); + DECLARE_WRITE8_MEMBER( timer_ctrl_w ); + DECLARE_READ8_MEMBER( timer_counter_r ); + DECLARE_WRITE8_MEMBER( timer_counter_w ); + DECLARE_READ8_MEMBER( onesec_r ); + DECLARE_WRITE8_MEMBER( onesec_w ); + DECLARE_READ8_MEMBER( pram_r ); + DECLARE_WRITE8_MEMBER( pram_w ); + + // interface routines + UINT8 get_xcvr_session() { return xcvr_session; } + void set_via_full(UINT8 val) { via_full = val; } + void set_sys_session(UINT8 val) { sys_session = val; } + UINT8 get_via_data() { return via_data; } + void set_via_data(UINT8 dat) { via_data = dat; } + UINT8 get_via_clock() { return via_clock; } + void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; } + int get_adb_dtime() { return m_adb_dtime; } + + int rom_offset; + + template static devcb_base &set_reset_cb(device_t &device, _Object wr) { return downcast(device).write_reset.set_callback(wr); } + template static devcb_base &set_linechange_cb(device_t &device, _Object wr) { return downcast(device).write_linechange.set_callback(wr); } + template static devcb_base &set_via_clock_cb(device_t &device, _Object wr) { return downcast(device).write_via_clock.set_callback(wr); } + template static devcb_base &set_via_data_cb(device_t &device, _Object wr) { return downcast(device).write_via_data.set_callback(wr); } + + devcb_write_line write_reset, write_linechange, write_via_clock, write_via_data; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + + required_device m_maincpu; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + UINT8 ddrs[3]; + UINT8 ports[3]; + UINT8 pll_ctrl; + UINT8 timer_ctrl; + UINT8 timer_counter; + UINT8 onesec; + UINT8 xcvr_session, via_full, sys_session, via_data, via_clock, last_adb; + UINT64 last_adb_time; + bool egret_controls_power; + bool adb_in; + int reset_line; + int m_adb_dtime; + emu_timer *m_timer; + UINT8 pram[0x100], disk_pram[0x100]; + bool pram_loaded; + + void send_port(address_space &space, UINT8 offset, UINT8 data); +}; + +// device type definition +extern const device_type EGRET; + +#endif diff --git a/src/mame/machine/einstein.c b/src/mame/machine/einstein.c new file mode 100644 index 00000000000..a2582ee93e3 --- /dev/null +++ b/src/mame/machine/einstein.c @@ -0,0 +1,208 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Dirk Best, Phill Harvey-Smith +/*************************************************************************** + + Tatung Einstein + + +***************************************************************************/ + +#include "emu.h" +#include "includes/einstein.h" + +/**************************************************************** + EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT +****************************************************************/ + + +const device_type EINSTEIN_KEYBOARD_DAISY = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// z80ctc_device - constructor +//------------------------------------------------- + +einstein_keyboard_daisy_device::einstein_keyboard_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, EINSTEIN_KEYBOARD_DAISY, "Einstein keyboard daisy chain", tag, owner, clock, "einstein_keyboard", __FILE__), + device_z80daisy_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void einstein_keyboard_daisy_device::device_start() +{ +} + +//************************************************************************** +// DAISY CHAIN INTERFACE +//************************************************************************** + +//------------------------------------------------- +// z80daisy_irq_state - return the overall IRQ +// state for this device +//------------------------------------------------- + +int einstein_keyboard_daisy_device::z80daisy_irq_state() +{ + einstein_state *einstein = device().machine().driver_data(); + + if (einstein->m_interrupt & einstein->m_interrupt_mask & EINSTEIN_KEY_INT) + return Z80_DAISY_INT; + + return 0; +} + + +//------------------------------------------------- +// z80daisy_irq_ack - acknowledge an IRQ and +// return the appropriate vector +//------------------------------------------------- + +int einstein_keyboard_daisy_device::z80daisy_irq_ack() +{ + return 0xf7; +} + +//------------------------------------------------- +// z80daisy_irq_reti - clear the interrupt +// pending state to allow other interrupts through +//------------------------------------------------- + +void einstein_keyboard_daisy_device::z80daisy_irq_reti() +{ +} + +const device_type EINSTEIN_ADC_DAISY = &device_creator; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// z80ctc_device - constructor +//------------------------------------------------- + +einstein_adc_daisy_device::einstein_adc_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, EINSTEIN_ADC_DAISY, "Einstein ADC daisy chain", tag, owner, clock, "einstein_adc_daisy", __FILE__), + device_z80daisy_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void einstein_adc_daisy_device::device_start() +{ +} + +//************************************************************************** +// DAISY CHAIN INTERFACE +//************************************************************************** + +//------------------------------------------------- +// z80daisy_irq_state - return the overall IRQ +// state for this device +//------------------------------------------------- + +int einstein_adc_daisy_device::z80daisy_irq_state() +{ + einstein_state *einstein = device().machine().driver_data(); + + if (einstein->m_interrupt & einstein->m_interrupt_mask & EINSTEIN_ADC_INT) + return Z80_DAISY_INT; + + return 0; +} + + +//------------------------------------------------- +// z80daisy_irq_ack - acknowledge an IRQ and +// return the appropriate vector +//------------------------------------------------- + +int einstein_adc_daisy_device::z80daisy_irq_ack() +{ + return 0xfb; +} + +//------------------------------------------------- +// z80daisy_irq_reti - clear the interrupt +// pending state to allow other interrupts through +//------------------------------------------------- + +void einstein_adc_daisy_device::z80daisy_irq_reti() +{ +} + + +const device_type EINSTEIN_FIRE_DAISY = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// z80ctc_device - constructor +//------------------------------------------------- + +einstein_fire_daisy_device::einstein_fire_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, EINSTEIN_FIRE_DAISY, "Einstein fire button daisy chain", tag, owner, clock, "einstein_fire_daisy", __FILE__), + device_z80daisy_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void einstein_fire_daisy_device::device_start() +{ +} + +//************************************************************************** +// DAISY CHAIN INTERFACE +//************************************************************************** + +//------------------------------------------------- +// z80daisy_irq_state - return the overall IRQ +// state for this device +//------------------------------------------------- + +int einstein_fire_daisy_device::z80daisy_irq_state() +{ + einstein_state *einstein = device().machine().driver_data(); + + if (einstein->m_interrupt & einstein->m_interrupt_mask & EINSTEIN_FIRE_INT) + return Z80_DAISY_INT; + + return 0; +} + + +//------------------------------------------------- +// z80daisy_irq_ack - acknowledge an IRQ and +// return the appropriate vector +//------------------------------------------------- + +int einstein_fire_daisy_device::z80daisy_irq_ack() +{ + return 0xfd; +} + +//------------------------------------------------- +// z80daisy_irq_reti - clear the interrupt +// pending state to allow other interrupts through +//------------------------------------------------- + +void einstein_fire_daisy_device::z80daisy_irq_reti() +{ +} diff --git a/src/mame/machine/electron.c b/src/mame/machine/electron.c new file mode 100644 index 00000000000..8510fe7f454 --- /dev/null +++ b/src/mame/machine/electron.c @@ -0,0 +1,417 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/****************************************************************************** + Acorn Electron driver + + MESS Driver By: + + Wilbert Pol + +******************************************************************************/ + +#include "emu.h" +#include "includes/electron.h" +#include "sound/beep.h" +#include "imagedev/cassette.h" + +void electron_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_TAPE_HANDLER: + electron_tape_timer_handler(ptr, param); + break; + case TIMER_SETUP_BEEP: + setup_beep(ptr, param); + break; + case TIMER_SCANLINE_INTERRUPT: + electron_scanline_interrupt(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in electron_state::device_timer"); + } +} + + +void electron_state::electron_tape_start() +{ + if (m_ula.tape_running ) + { + return; + } + m_ula.tape_steps = 0; + m_ula.tape_value = 0x80808080; + m_ula.high_tone_set = 0; + m_ula.bit_count = 0; + m_ula.tape_running = 1; + m_tape_timer->adjust(attotime::zero, 0, attotime::from_hz(4800)); +} + +void electron_state::electron_tape_stop() +{ + m_ula.tape_running = 0; + m_tape_timer->reset(); +} + +#define TAPE_LOW 0x00; +#define TAPE_HIGH 0xFF; + +TIMER_CALLBACK_MEMBER(electron_state::electron_tape_timer_handler) +{ + if ( m_ula.cassette_motor_mode ) + { + double tap_val; + tap_val = m_cassette->input(); + if ( tap_val < -0.5 ) + { + m_ula.tape_value = ( m_ula.tape_value << 8 ) | TAPE_LOW; + m_ula.tape_steps++; + } + else if ( tap_val > 0.5 ) + { + m_ula.tape_value = ( m_ula.tape_value << 8 ) | TAPE_HIGH; + m_ula.tape_steps++; + } + else + { + m_ula.tape_steps = 0; + m_ula.bit_count = 0; + m_ula.high_tone_set = 0; + m_ula.tape_value = 0x80808080; + } + if ( m_ula.tape_steps > 2 && ( m_ula.tape_value == 0x0000FFFF || m_ula.tape_value == 0x00FF00FF ) ) + { + m_ula.tape_steps = 0; + switch( m_ula.bit_count ) + { + case 0: /* start bit */ + m_ula.start_bit = ( ( m_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); + //logerror( "++ Read start bit: %d\n", m_ula.start_bit ); + if ( m_ula.start_bit ) + { + if ( m_ula.high_tone_set ) + { + m_ula.bit_count--; + } + } + else + { + m_ula.high_tone_set = 0; + } + break; + case 1: case 2: case 3: case 4: + case 5: case 6: case 7: case 8: + //logerror( "++ Read regular bit: %d\n", m_ula.tape_value == 0x0000FFFF ? 0 : 1 ); + m_ula.tape_byte = ( m_ula.tape_byte >> 1 ) | ( m_ula.tape_value == 0x0000FFFF ? 0 : 0x80 ); + break; + case 9: /* stop bit */ + m_ula.stop_bit = ( ( m_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); + //logerror( "++ Read stop bit: %d\n", m_ula.stop_bit ); + if ( m_ula.start_bit && m_ula.stop_bit && m_ula.tape_byte == 0xFF && ! m_ula.high_tone_set ) + { + electron_interrupt_handler( INT_SET, INT_HIGH_TONE ); + m_ula.high_tone_set = 1; + } + else if ( ! m_ula.start_bit && m_ula.stop_bit ) + { + //logerror( "-- Byte read from tape: %02x\n", m_ula.tape_byte ); + electron_interrupt_handler( INT_SET, INT_RECEIVE_FULL ); + } + else + { + logerror( "Invalid start/stop bit combination detected: %d,%d\n", m_ula.start_bit, m_ula.stop_bit ); + } + break; + } + m_ula.bit_count = ( m_ula.bit_count + 1 ) % 10; + } + } +} + +READ8_MEMBER(electron_state::electron_read_keyboard) +{ + UINT8 data = 0; + + //logerror( "PC=%04x: keyboard read from paged rom area, address: %04x", activecpu_get_pc(), offset ); + for (int i = 0; i < 14; i++) + { + if (!(offset & 1)) + data |= m_keybd[i]->read() & 0x0f; + + offset = offset >> 1; + } + //logerror( ", data: %02x\n", data ); + return data; +} + +READ8_MEMBER(electron_state::electron_jim_r) +{ + return 0xff; +} + +WRITE8_MEMBER(electron_state::electron_jim_w) +{ +} + +READ8_MEMBER(electron_state::electron_1mhz_r) +{ + return 0xff; +} + +WRITE8_MEMBER(electron_state::electron_1mhz_w) +{ +} + +READ8_MEMBER(electron_state::electron_ula_r) +{ + UINT8 data = ((UINT8 *)memregion("user1")->base())[0x43E00 + offset]; + switch ( offset & 0x0f ) + { + case 0x00: /* Interrupt status */ + data = m_ula.interrupt_status; + m_ula.interrupt_status &= ~0x02; + break; + case 0x01: /* Unknown */ + break; + case 0x04: /* Casette data shift register */ + electron_interrupt_handler(INT_CLEAR, INT_RECEIVE_FULL ); + data = m_ula.tape_byte; + break; + } + logerror( "ULA: read offset %02x: %02x\n", offset, data ); + return data; +} + +static const int electron_palette_offset[4] = { 0, 4, 5, 1 }; +static const UINT16 electron_screen_base[8] = { 0x3000, 0x3000, 0x3000, 0x4000, 0x5800, 0x5800, 0x6000, 0x5800 }; + +WRITE8_MEMBER(electron_state::electron_ula_w) +{ + int i = electron_palette_offset[(( offset >> 1 ) & 0x03)]; + logerror( "ULA: write offset %02x <- %02x\n", offset & 0x0f, data ); + switch( offset & 0x0f ) + { + case 0x00: /* Interrupt control */ + m_ula.interrupt_control = data; + break; + case 0x01: /* Unknown */ + break; + case 0x02: /* Screen start address #1 */ + m_ula.screen_start = ( m_ula.screen_start & 0x7e00 ) | ( ( data & 0xe0 ) << 1 ); + logerror( "screen_start changed to %04x\n", m_ula.screen_start ); + break; + case 0x03: /* Screen start addres #2 */ + m_ula.screen_start = ( m_ula.screen_start & 0x1c0 ) | ( ( data & 0x3f ) << 9 ); + logerror( "screen_start changed to %04x\n", m_ula.screen_start ); + break; + case 0x04: /* Cassette data shift register */ + break; + case 0x05: /* Interrupt clear and paging */ + /* rom page requests are honoured when currently bank 0-7 or 12-15 is switched in, + * or when 8-11 is currently switched in only switching to bank 8-15 is allowed. + * + * Rompages 10 and 11 both select the Basic ROM. + * Rompages 8 and 9 both select the keyboard. + */ + if ( ( ( m_ula.rompage & 0x0C ) != 0x08 ) || ( data & 0x08 ) ) + { + m_ula.rompage = data & 0x0f; + if ( m_ula.rompage == 8 || m_ula.rompage == 9 ) + { + m_ula.rompage = 8; + space.install_read_handler( 0x8000, 0xbfff, read8_delegate(FUNC(electron_state::electron_read_keyboard),this)); + } + else + { + space.install_read_bank( 0x8000, 0xbfff, "bank2"); + } + membank("bank2")->set_entry(m_ula.rompage); + } + if ( data & 0x10 ) + { + electron_interrupt_handler( INT_CLEAR, INT_DISPLAY_END ); + } + if ( data & 0x20 ) + { + electron_interrupt_handler( INT_CLEAR, INT_RTC ); + } + if ( data & 0x40 ) + { + electron_interrupt_handler( INT_CLEAR, INT_HIGH_TONE ); + } + if ( data & 0x80 ) + { + } + break; + case 0x06: /* Counter divider */ + if ( m_ula.communication_mode == 0x01) + { + m_beeper->set_frequency( 1000000 / ( 16 * ( data + 1 ) ) ); + } + break; + case 0x07: /* Misc. */ + m_ula.communication_mode = ( data >> 1 ) & 0x03; + switch( m_ula.communication_mode ) + { + case 0x00: /* cassette input */ + m_beeper->set_state( 0 ); + electron_tape_start(); + break; + case 0x01: /* sound generation */ + m_beeper->set_state( 1 ); + electron_tape_stop(); + break; + case 0x02: /* cassette output */ + m_beeper->set_state( 0 ); + electron_tape_stop(); + break; + case 0x03: /* not used */ + m_beeper->set_state( 0 ); + electron_tape_stop(); + break; + } + m_ula.screen_mode = ( data >> 3 ) & 0x07; + m_ula.screen_base = electron_screen_base[ m_ula.screen_mode ]; + m_ula.screen_size = 0x8000 - m_ula.screen_base; + m_ula.vram = (UINT8 *)space.get_read_ptr(m_ula.screen_base ); + logerror( "ULA: screen mode set to %d\n", m_ula.screen_mode ); + m_ula.cassette_motor_mode = ( data >> 6 ) & 0x01; + m_cassette->change_state(m_ula.cassette_motor_mode ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MOTOR_DISABLED ); + m_ula.capslock_mode = ( data >> 7 ) & 0x01; + break; + case 0x08: case 0x0A: case 0x0C: case 0x0E: + // video_update + m_ula.current_pal[i+10] = (m_ula.current_pal[i+10] & 0x01) | (((data & 0x80) >> 5) | ((data & 0x08) >> 1)); + m_ula.current_pal[i+8] = (m_ula.current_pal[i+8] & 0x01) | (((data & 0x40) >> 4) | ((data & 0x04) >> 1)); + m_ula.current_pal[i+2] = (m_ula.current_pal[i+2] & 0x03) | ((data & 0x20) >> 3); + m_ula.current_pal[i] = (m_ula.current_pal[i] & 0x03) | ((data & 0x10) >> 2); + break; + case 0x09: case 0x0B: case 0x0D: case 0x0F: + // video_update + m_ula.current_pal[i+10] = (m_ula.current_pal[i+10] & 0x06) | ((data & 0x08) >> 3); + m_ula.current_pal[i+8] = (m_ula.current_pal[i+8] & 0x06) | ((data & 0x04) >> 2); + m_ula.current_pal[i+2] = (m_ula.current_pal[i+2] & 0x04) | (((data & 0x20) >> 4) | ((data & 0x02) >> 1)); + m_ula.current_pal[i] = (m_ula.current_pal[i] & 0x04) | (((data & 0x10) >> 3) | ((data & 0x01))); + break; + } +} + +void electron_state::electron_interrupt_handler(int mode, int interrupt) +{ + if ( mode == INT_SET ) + { + m_ula.interrupt_status |= interrupt; + } + else + { + m_ula.interrupt_status &= ~interrupt; + } + if ( m_ula.interrupt_status & m_ula.interrupt_control & ~0x83 ) + { + m_ula.interrupt_status |= 0x01; + m_maincpu->set_input_line(0, ASSERT_LINE ); + } + else + { + m_ula.interrupt_status &= ~0x01; + m_maincpu->set_input_line(0, CLEAR_LINE ); + } +} + +/************************************** + Machine Initialisation functions +***************************************/ + +TIMER_CALLBACK_MEMBER(electron_state::setup_beep) +{ + m_beeper->set_state( 0 ); + m_beeper->set_frequency( 300 ); +} + +void electron_state::machine_reset() +{ + membank("bank2")->set_entry(0); + + m_ula.communication_mode = 0x04; + m_ula.screen_mode = 0; + m_ula.cassette_motor_mode = 0; + m_ula.capslock_mode = 0; + m_ula.screen_mode = 0; + m_ula.screen_start = 0x3000; + m_ula.screen_base = 0x3000; + m_ula.screen_size = 0x8000 - 0x3000; + m_ula.screen_addr = 0; + m_ula.tape_running = 0; + m_ula.vram = (UINT8 *)m_maincpu->space(AS_PROGRAM).get_read_ptr(m_ula.screen_base); +} + +void electron_state::machine_start() +{ + UINT8 *lo_rom, *up_rom; + std::string region_tag; + memory_region *cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + if (cart_rom) + up_rom = cart_rom->base(); + else + up_rom = memregion("user1")->base() + 12 * 0x4000; + if (cart_rom && cart_rom->bytes() > 0x4000) + lo_rom = cart_rom->base() + 0x4000; + else + lo_rom = memregion("user1")->base(); + + membank("bank2")->configure_entries(0, 1, lo_rom, 0x4000); + membank("bank2")->configure_entries(1, 11, memregion("user1")->base() + 0x04000, 0x4000); + membank("bank2")->configure_entries(12, 1, up_rom, 0x4000); + membank("bank2")->configure_entries(13, 3, memregion("user1")->base() + 0x34000, 0x4000); + + m_ula.interrupt_status = 0x82; + m_ula.interrupt_control = 0x00; + timer_set(attotime::zero, TIMER_SETUP_BEEP); + m_tape_timer = timer_alloc(TIMER_TAPE_HANDLER); +} + +DEVICE_IMAGE_LOAD_MEMBER( electron_state, electron_cart ) +{ + if (image.software_entry() == NULL) + { + UINT32 filesize = image.length(); + + if (filesize != 16384) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only size 16384 is supported"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(filesize, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + image.fread(m_cart->get_rom_base(), filesize); + return IMAGE_INIT_PASS; + } + else + { + int upsize = image.get_software_region_length("uprom"); + int losize = image.get_software_region_length("lorom"); + + if (upsize != 16384 && upsize != 0) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size for uprom"); + return IMAGE_INIT_FAIL; + } + + if (losize != 16384 && losize != 0) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size for lorom"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(upsize + losize, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + + if (upsize) + memcpy(m_cart->get_rom_base(), image.get_software_region("uprom"), upsize); + + if (losize) + memcpy(m_cart->get_rom_base() + upsize, image.get_software_region("lorom"), losize); + + return IMAGE_INIT_PASS; + } +} diff --git a/src/mame/machine/esqpanel.c b/src/mame/machine/esqpanel.c new file mode 100644 index 00000000000..1c4dee54248 --- /dev/null +++ b/src/mame/machine/esqpanel.c @@ -0,0 +1,253 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/* + Ensoniq panel/display device +*/ +#include "emu.h" +#include "esqpanel.h" + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ESQPANEL1x22 = &device_creator; +const device_type ESQPANEL2x40 = &device_creator; +const device_type ESQPANEL2x40_SQ1 = &device_creator; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// esqpanel_device - constructor +//------------------------------------------------- + +esqpanel_device::esqpanel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_serial_interface(mconfig, *this), + m_write_tx(*this), + m_write_analog(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void esqpanel_device::device_start() +{ + m_write_tx.resolve_safe(); + m_write_analog.resolve_safe(); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void esqpanel_device::device_reset() +{ + // panel comms is at 62500 baud (double the MIDI rate), 8N2 + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2); + set_rcv_rate(62500); + set_tra_rate(62500); + + m_tx_busy = false; + m_xmit_read = m_xmit_write = 0; + m_bCalibSecondByte = false; + m_bButtonLightSecondByte = false; +} + +void esqpanel_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + device_serial_interface::device_timer(timer, id, param, ptr); +} + +void esqpanel_device::rcv_complete() // Rx completed receiving byte +{ + receive_register_extract(); + UINT8 data = get_received_char(); + +// if (data >= 0xe0) printf("Got %02x from motherboard (second %s)\n", data, m_bCalibSecondByte ? "yes" : "no"); + + send_to_display(data); + + if (m_bCalibSecondByte) + { +// printf("second byte is %02x\n", data); + if (data == 0xfd) // calibration request + { +// printf("let's send reply!\n"); + xmit_char(0xff); // this is the correct response for "calibration OK" + } + m_bCalibSecondByte = false; + } + else if (m_bButtonLightSecondByte) + { + // Lights on the Buttons, on the VFX-SD: + // Number Button + // 0 1-6 + // 1 8 + // 2 6 + // 3 4 + // 4 2 + // 5 Compare + // 6 1 + // 7 Presets + // 8 7-12 + // 9 9 + // a 7 + // b 5 + // c 3 + // d Sounds + // e 0 + // f Cart +// int lightNumber = data & 0x3f; + + // Light states: + // 0 = Off + // 2 = On + // 3 = Blinking +// int lightState = (data & 0xc0) >> 6; + + // TODO: do something with the button information! + // printf("Setting light %d to %s\n", lightNumber, lightState == 3 ? "Blink" : lightState == 2 ? "On" : "Off"); + m_bButtonLightSecondByte = false; + } + else if (data == 0xfb) // request calibration + { + m_bCalibSecondByte = true; + } + else if (data == 0xff) // button light state command + { + m_bButtonLightSecondByte = true; + } + else + { + // EPS wants a throwaway reply byte for each byte sent to the KPC + // VFX-SD and SD-1 definitely don't :) + if (m_eps_mode) + { + if (data == 0xe7) + { + xmit_char(0x00); // actual value of response is never checked + } + else if (data == 0x71) + { + xmit_char(0x00); // actual value of response is never checked + } + else + { + xmit_char(data); // actual value of response is never checked + } + } + } +} + +void esqpanel_device::tra_complete() // Tx completed sending byte +{ +// printf("panel Tx complete\n"); + // is there more waiting to send? + if (m_xmit_read != m_xmit_write) + { + transmit_register_setup(m_xmitring[m_xmit_read++]); + if (m_xmit_read >= XMIT_RING_SIZE) + { + m_xmit_read = 0; + } + } + else + { + m_tx_busy = false; + } +} + +void esqpanel_device::tra_callback() // Tx send bit +{ + m_write_tx(transmit_register_get_data_bit()); +} + +void esqpanel_device::xmit_char(UINT8 data) +{ +// printf("Panel: xmit %02x\n", data); + + // if tx is busy it'll pick this up automatically when it completes + if (!m_tx_busy) + { + m_tx_busy = true; + transmit_register_setup(data); + } + else + { + // tx is busy, it'll pick this up next time + m_xmitring[m_xmit_write++] = data; + if (m_xmit_write >= XMIT_RING_SIZE) + { + m_xmit_write = 0; + } + } +} + +void esqpanel_device::set_analog_value(offs_t offset, UINT16 value) +{ + m_write_analog(offset, value); +} + +/* panel with 1x22 VFD display used in the EPS-16 and EPS-16 Plus */ + +static MACHINE_CONFIG_FRAGMENT(esqpanel1x22) + MCFG_ESQ1x22_ADD("vfd") +MACHINE_CONFIG_END + +machine_config_constructor esqpanel1x22_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( esqpanel1x22 ); +} + +esqpanel1x22_device::esqpanel1x22_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + esqpanel_device(mconfig, ESQPANEL1x22, "Ensoniq front panel with 1x22 VFD", tag, owner, clock, "esqpanel122", __FILE__), + m_vfd(*this, "vfd") +{ + m_eps_mode = true; +} + +/* panel with 2x40 VFD display used in the ESQ-1, VFX-SD, SD-1, and others */ + +static MACHINE_CONFIG_FRAGMENT(esqpanel2x40) + MCFG_ESQ2x40_ADD("vfd") +MACHINE_CONFIG_END + +machine_config_constructor esqpanel2x40_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( esqpanel2x40 ); +} + +esqpanel2x40_device::esqpanel2x40_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + esqpanel_device(mconfig, ESQPANEL2x40, "Ensoniq front panel with 2x40 VFD", tag, owner, clock, "esqpanel240", __FILE__), + m_vfd(*this, "vfd") +{ + m_eps_mode = false; +} + +/* panel with 2x16? LCD display used in the SQ and MR series, plus probably more */ + +static MACHINE_CONFIG_FRAGMENT(esqpanel2x40_sq1) + MCFG_ESQ2x40_SQ1_ADD("vfd") +MACHINE_CONFIG_END + +machine_config_constructor esqpanel2x40_sq1_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( esqpanel2x40_sq1 ); +} + +esqpanel2x40_sq1_device::esqpanel2x40_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + esqpanel_device(mconfig, ESQPANEL2x40, "Ensoniq front panel with 2x16 LCD", tag, owner, clock, "esqpanel240_sq1", __FILE__), + m_vfd(*this, "vfd") +{ + m_eps_mode = false; +} diff --git a/src/mame/machine/esqpanel.h b/src/mame/machine/esqpanel.h new file mode 100644 index 00000000000..2cd913e0856 --- /dev/null +++ b/src/mame/machine/esqpanel.h @@ -0,0 +1,140 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +#pragma once + +#ifndef __ESQPANEL_H__ +#define __ESQPANEL_H__ + +#include "emu.h" +#include "machine/esqvfd.h" + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_ESQPANEL1x22_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, ESQPANEL1x22, 0) + +#define MCFG_ESQPANEL1x22_REPLACE(_tag) \ + MCFG_DEVICE_REPLACE(_tag, ESQPANEL1x22, 0) + +#define MCFG_ESQPANEL1x22_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +#define MCFG_ESQPANEL2x40_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, ESQPANEL2x40, 0) + +#define MCFG_ESQPANEL2x40_REPLACE(_tag) \ + MCFG_DEVICE_REPLACE(_tag, ESQPANEL2x40, 0) + +#define MCFG_ESQPANEL_2x40_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +#define MCFG_ESQPANEL2x40_SQ1_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, ESQPANEL2x40_SQ1, 0) + +#define MCFG_ESQPANEL2x40_SQ1_REPLACE(_tag) \ + MCFG_DEVICE_REPLACE(_tag, ESQPANEL2x40_SQ1, 0) + +#define MCFG_ESQPANEL2x40_SQ1_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +#define MCFG_ESQPANEL_TX_CALLBACK(_write) \ + devcb = &esqpanel_device::set_tx_wr_callback(*device, DEVCB_##_write); + +#define MCFG_ESQPANEL_ANALOG_CALLBACK(_write) \ + devcb = &esqpanel_device::set_analog_wr_callback(*device, DEVCB_##_write); + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> esqpanel_device + +class esqpanel_device : public device_t, public device_serial_interface +{ +public: + // construction/destruction + esqpanel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + template static devcb_base &set_tx_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_tx.set_callback(object); } + template static devcb_base &set_analog_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_analog.set_callback(object); } + + virtual void send_to_display(UINT8 data) = 0; + + void xmit_char(UINT8 data); + void set_analog_value(offs_t offset, UINT16 value); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // serial overrides + virtual void rcv_complete(); // Rx completed receiving byte + virtual void tra_complete(); // Tx completed sending byte + virtual void tra_callback(); // Tx send bit + + bool m_eps_mode; + +private: + static const int XMIT_RING_SIZE = 16; + + bool m_bCalibSecondByte; + bool m_bButtonLightSecondByte; + + devcb_write_line m_write_tx; + devcb_write16 m_write_analog; + UINT8 m_xmitring[XMIT_RING_SIZE]; + int m_xmit_read, m_xmit_write; + bool m_tx_busy; +}; + +class esqpanel1x22_device : public esqpanel_device { +public: + esqpanel1x22_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + required_device m_vfd; + + virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); } + +protected: + virtual machine_config_constructor device_mconfig_additions() const; + +private: +}; + +class esqpanel2x40_device : public esqpanel_device { +public: + esqpanel2x40_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + required_device m_vfd; + + virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); } + +protected: + virtual machine_config_constructor device_mconfig_additions() const; + +private: +}; + +class esqpanel2x40_sq1_device : public esqpanel_device { +public: + esqpanel2x40_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + required_device m_vfd; + + virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); } + +protected: + virtual machine_config_constructor device_mconfig_additions() const; + +private: +}; + +extern const device_type ESQPANEL1x22; +extern const device_type ESQPANEL2x40; +extern const device_type ESQPANEL2x40_SQ1; + +#endif diff --git a/src/mame/machine/esqvfd.c b/src/mame/machine/esqvfd.c new file mode 100644 index 00000000000..e103ef6e972 --- /dev/null +++ b/src/mame/machine/esqvfd.c @@ -0,0 +1,405 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/* + Ensoniq Vacuum Fluorescent Displays (VFDs) + Emulation by R. Belmont +*/ + +#include "esqvfd.h" +#include "esq1by22.lh" +#include "esq2by40.lh" + +const device_type ESQ1x22 = &device_creator; +const device_type ESQ2x40 = &device_creator; +const device_type ESQ2x40_SQ1 = &device_creator; + +// adapted from bfm_bd1, rearranged to work with ASCII data used by the Ensoniq h/w +static const UINT16 font[]= +{ // FEDC BA98 7654 3210 + 0x0000, // 0000 0000 0000 0000 (space) + 0x0000, // 0000 0000 0000 0000 ! (not defined) + 0x0009, // 0000 0000 0000 1001 ". + 0xC62A, // 1100 0110 0010 1010 #. + 0xC62D, // 1100 0110 0010 1101 $. + 0x0000, // 0000 0000 0000 0000 % (not defined) + 0x0000, // 0000 0000 0000 0000 & (not defined) + 0x0040, // 0000 0000 1000 0000 '. + 0x0880, // 0000 1000 1000 0000 (. + 0x0050, // 0000 0000 0101 0000 ). + 0xCCD8, // 1100 1100 1101 1000 *. + 0xC408, // 1100 0100 0000 1000 +. + 0x0000, // 0000 0000 0000 0000 , (not defined) + 0xC000, // 1100 0000 0000 0000 -. + 0x1000, // 0001 0000 0000 0000 . + 0x0090, // 0000 0000 1001 0000 / + 0x22B7, // 0010 0010 1011 0111 0. + 0x0408, // 0000 0100 0000 1000 1. + 0xE206, // 1110 0010 0000 0110 2. + 0x4226, // 0100 0010 0010 0110 3. + 0xC023, // 1100 0000 0010 0011 4. + 0xC225, // 1100 0010 0010 0101 5. + 0xE225, // 1110 0010 0010 0101 6. + 0x0026, // 0000 0000 0010 0110 7. + 0xE227, // 1110 0010 0010 0111 8. + 0xC227, // 1100 0010 0010 0111 9. + 0x0000, // 0000 0000 0000 0000 : (not defined) + 0x0000, // 0000 0000 0000 0000 ; (not defined) + 0x0290, // 0000 0010 1001 0000 <. + 0xC200, // 1100 0010 0000 0000 =. + 0x0A40, // 0000 1010 0100 0000 >. + 0x0000, // 0000 0000 0000 0000 ? (not defined) + 0xA626, // 1010 0110 0010 0110 @. + 0xE027, // 1110 0000 0010 0111 A. + 0x462E, // 0100 0110 0010 1110 B. + 0x2205, // 0010 0010 0000 0101 C. + 0x062E, // 0000 0110 0010 1110 D. + 0xA205, // 1010 0010 0000 0101 E. + 0xA005, // 1010 0000 0000 0101 F. + 0x6225, // 0110 0010 0010 0101 G. + 0xE023, // 1110 0000 0010 0011 H. + 0x060C, // 0000 0110 0000 1100 I. + 0x2222, // 0010 0010 0010 0010 J. + 0xA881, // 1010 1000 1000 0001 K. + 0x2201, // 0010 0010 0000 0001 L. + 0x20E3, // 0010 0000 1110 0011 M. + 0x2863, // 0010 1000 0110 0011 N. + 0x2227, // 0010 0010 0010 0111 O. + 0xE007, // 1110 0000 0000 0111 P. + 0x2A27, // 0010 1010 0010 0111 Q. + 0xE807, // 1110 1000 0000 0111 R. + 0xC225, // 1100 0010 0010 0101 S. + 0x040C, // 0000 0100 0000 1100 T. + 0x2223, // 0010 0010 0010 0011 U. + 0x2091, // 0010 0000 1001 0001 V. + 0x2833, // 0010 1000 0011 0011 W. + 0x08D0, // 0000 1000 1101 0000 X. + 0x04C0, // 0000 0100 1100 0000 Y. + 0x0294, // 0000 0010 1001 0100 Z. + 0x2205, // 0010 0010 0000 0101 [. + 0x0840, // 0000 1000 0100 0000 \. + 0x0226, // 0000 0010 0010 0110 ]. + 0x0810, // 0000 1000 0001 0000 ^. + 0x0200, // 0000 0010 0000 0000 _ + 0x0040, // 0000 0000 0100 0000 ` + 0xE027, // 1110 0000 0010 0111 A. + 0x462E, // 0100 0110 0010 1110 B. + 0x2205, // 0010 0010 0000 0101 C. + 0x062E, // 0000 0110 0010 1110 D. + 0xA205, // 1010 0010 0000 0101 E. + 0xA005, // 1010 0000 0000 0101 F. + 0x6225, // 0110 0010 0010 0101 G. + 0xE023, // 1110 0000 0010 0011 H. + 0x060C, // 0000 0110 0000 1100 I. + 0x2222, // 0010 0010 0010 0010 J. + 0xA881, // 1010 1000 1000 0001 K. + 0x2201, // 0010 0010 0000 0001 L. + 0x20E3, // 0010 0000 1110 0011 M. + 0x2863, // 0010 1000 0110 0011 N. + 0x2227, // 0010 0010 0010 0111 O. + 0xE007, // 1110 0000 0000 0111 P. + 0x2A27, // 0010 1010 0010 0111 Q. + 0xE807, // 1110 1000 0000 0111 R. + 0xC225, // 1100 0010 0010 0101 S. + 0x040C, // 0000 0100 0000 1100 T. + 0x2223, // 0010 0010 0010 0011 U. + 0x2091, // 0010 0000 1001 0001 V. + 0x2833, // 0010 1000 0011 0011 W. + 0x08D0, // 0000 1000 1101 0000 X. + 0x04C0, // 0000 0100 1100 0000 Y. + 0x0294, // 0000 0010 1001 0100 Z. + 0x2205, // 0010 0010 0000 0101 [. + 0x0408, // 0000 0100 0000 1000 | + 0x0226, // 0000 0010 0010 0110 ]. + 0x0810, // 0000 1000 0001 0000 ~. + 0x0000, // 0000 0000 0000 0000 (DEL) +}; + +esqvfd_t::esqvfd_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source) +{ +} + +void esqvfd_t::device_start() +{ +} + +void esqvfd_t::device_reset() +{ + m_cursx = m_cursy = 0; + m_savedx = m_savedy = 0; + m_curattr = AT_NORMAL; + m_lastchar = 0; + memset(m_chars, 0, sizeof(m_chars)); + memset(m_attrs, 0, sizeof(m_attrs)); + memset(m_dirty, 1, sizeof(m_attrs)); +} + +void esqvfd_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ +} + +// why isn't the font just stored in this order? +UINT32 esqvfd_t::conv_segments(UINT16 segin) +{ + UINT32 segout = 0; + + if ( segin & 0x0004 ) segout |= 0x0001; + if ( segin & 0x0002 ) segout |= 0x0002; + if ( segin & 0x0020 ) segout |= 0x0004; + if ( segin & 0x0200 ) segout |= 0x0008; + if ( segin & 0x2000 ) segout |= 0x0010; + if ( segin & 0x0001 ) segout |= 0x0020; + if ( segin & 0x8000 ) segout |= 0x0040; + if ( segin & 0x4000 ) segout |= 0x0080; + if ( segin & 0x0008 ) segout |= 0x0100; + if ( segin & 0x0400 ) segout |= 0x0200; + if ( segin & 0x0010 ) segout |= 0x0400; + if ( segin & 0x0040 ) segout |= 0x0800; + if ( segin & 0x0080 ) segout |= 0x1000; + if ( segin & 0x0800 ) segout |= 0x2000; + if ( segin & 0x1000 ) segout |= 0x4000; + + return segout; +} + +// generic display update; can override from child classes if not good enough +void esqvfd_t::update_display() +{ + for (int row = 0; row < m_rows; row++) + { + for (int col = 0; col < m_cols; col++) + { + if (m_dirty[row][col]) + { + UINT32 segdata = conv_segments(font[m_chars[row][col]]); + + // force bottom bar on all underlined chars + if (m_attrs[row][col] & AT_UNDERLINE) + { + segdata |= 0x0008; + } + + output_set_indexed_value("vfd", (row*m_cols) + col, segdata); + + m_dirty[row][col] = 0; + } + } + } +} + +/* 2x40 VFD display used in the ESQ-1, VFX-SD, SD-1, and others */ + +static MACHINE_CONFIG_FRAGMENT(esq2x40) + MCFG_DEFAULT_LAYOUT(layout_esq2by40) +MACHINE_CONFIG_END + +machine_config_constructor esq2x40_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( esq2x40 ); +} + +void esq2x40_t::write_char(int data) +{ + // ESQ-1 sends (cursor move) 0xfa 0xYY to mark YY characters as underlined at the current cursor location + if (m_lastchar == 0xfa) + { + for (int i = 0; i < data; i++) + { + m_attrs[m_cursy][m_cursx + i] |= AT_UNDERLINE; + m_dirty[m_cursy][m_cursx + i] = 1; + } + + m_lastchar = 0; + update_display(); + return; + } + + m_lastchar = data; + + if ((data >= 0x80) && (data < 0xd0)) + { + m_cursy = ((data & 0x7f) >= 40) ? 1 : 0; + m_cursx = (data & 0x7f) % 40; + } + else if (data >= 0xd0) + { + switch (data) + { + case 0xd0: // blink start + m_curattr = AT_BLINK; + break; + + case 0xd1: // blink stop (cancel all attribs on VFX+) + m_curattr = 0; //&= ~AT_BLINK; + break; + + case 0xd3: // start underline + m_curattr |= AT_UNDERLINE; + break; + + case 0xd6: // clear screen + m_cursx = m_cursy = 0; + memset(m_chars, 0, sizeof(m_chars)); + memset(m_attrs, 0, sizeof(m_attrs)); + memset(m_dirty, 1, sizeof(m_dirty)); + break; + + case 0xf5: // save cursor position + m_savedx = m_cursx; + m_savedy = m_cursy; + break; + + case 0xf6: // restore cursor position + m_cursx = m_savedx; + m_cursy = m_savedy; + m_curattr = m_attrs[m_cursy][m_cursx]; + break; + + default: +// printf("Unknown control code %02x\n", data); + break; + } + } + else + { + if ((data >= 0x20) && (data <= 0x5f)) + { + m_chars[m_cursy][m_cursx] = data - ' '; + m_attrs[m_cursy][m_cursx] = m_curattr; + m_dirty[m_cursy][m_cursx] = 1; + m_cursx++; + + if (m_cursx >= 39) + { + m_cursx = 39; + } + } + } + + update_display(); +} + +esq2x40_t::esq2x40_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : esqvfd_t(mconfig, ESQ2x40, "Ensoniq 2x40 VFD", tag, owner, clock, "esq2x40", __FILE__) +{ + m_rows = 2; + m_cols = 40; +} + +/* 1x22 display from the VFX (not right, but it'll do for now) */ + +static MACHINE_CONFIG_FRAGMENT(esq1x22) + MCFG_DEFAULT_LAYOUT(layout_esq1by22) +MACHINE_CONFIG_END + +machine_config_constructor esq1x22_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( esq1x22 ); +} + +void esq1x22_t::write_char(int data) +{ + if (data >= 0x60) + { + switch (data) + { + case 'f': // clear screen + m_cursx = m_cursy = 0; + memset(m_chars, 0, sizeof(m_chars)); + memset(m_attrs, 0, sizeof(m_attrs)); + memset(m_dirty, 1, sizeof(m_dirty)); + break; + + default: + printf("Unhandled control code %02x\n", data); + break; + } + } + else + { + if ((data >= 0x20) && (data <= 0x5f)) + { + m_chars[0][m_cursx] = data - ' '; + m_dirty[0][m_cursx] = 1; + m_cursx++; + + if (m_cursx >= 23) + { + m_cursx = 23; + } + } + } + + update_display(); +} + +esq1x22_t::esq1x22_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : esqvfd_t(mconfig, ESQ1x22, "Ensoniq 1x22 VFD", tag, owner, clock, "esq1x22", __FILE__) +{ + m_rows = 1; + m_cols = 22; +} + +/* SQ-1 display, I think it's really an LCD but we'll deal with it for now */ +machine_config_constructor esq2x40_sq1_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( esq2x40 ); // we use the normal 2x40 layout +} + +void esq2x40_sq1_t::write_char(int data) +{ + if (data == 0x09) // musical note + { + data = '^'; // approximate for now + } + + if (m_Wait87Shift) + { + m_cursy = (data >> 4) & 0xf; + m_cursx = data & 0xf; + m_Wait87Shift = false; + } + else if (m_Wait88Shift) + { + m_Wait88Shift = false; + } + else if ((data >= 0x20) && (data <= 0x7f)) + { + m_chars[m_cursy][m_cursx] = data - ' '; + m_attrs[m_cursy][m_cursx] = m_curattr; + m_dirty[m_cursy][m_cursx] = 1; + m_cursx++; + + if (m_cursx >= 39) + { + m_cursx = 39; + } + + update_display(); + } + else if (data == 0x83) + { + m_cursx = m_cursy = 0; + memset(m_chars, 0, sizeof(m_chars)); + memset(m_attrs, 0, sizeof(m_attrs)); + memset(m_dirty, 1, sizeof(m_dirty)); + } + else if (data == 0x87) + { + m_Wait87Shift = true; + } + else if (data == 0x88) + { + m_Wait88Shift = true; + } + else + { +// printf("SQ-1 unhandled display char %02x\n", data); + } +} + +esq2x40_sq1_t::esq2x40_sq1_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : esqvfd_t(mconfig, ESQ2x40_SQ1, "Ensoniq 2x40 VFD (SQ-1 variant)", tag, owner, clock, "esq2x40_sq1", __FILE__) +{ + m_rows = 2; + m_cols = 40; + m_Wait87Shift = false; + m_Wait88Shift = false; +} diff --git a/src/mame/machine/esqvfd.h b/src/mame/machine/esqvfd.h new file mode 100644 index 00000000000..8db9d054ab4 --- /dev/null +++ b/src/mame/machine/esqvfd.h @@ -0,0 +1,99 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +#ifndef ESQVFD_H +#define ESQVFD_H + +#include "emu.h" + +#define MCFG_ESQ1x22_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, ESQ1x22, 60) + +#define MCFG_ESQ1x22_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +#define MCFG_ESQ2x40_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, ESQ2x40, 60) + +#define MCFG_ESQ2x40_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +#define MCFG_ESQ2x40_SQ1_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, ESQ2x40_SQ1, 60) + +#define MCFG_ESQ2x40_SQ1_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +class esqvfd_t : public device_t { +public: + esqvfd_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + DECLARE_WRITE8_MEMBER( write ) { write_char(data); } + + virtual void write_char(int data) = 0; + virtual void update_display(); + + UINT32 conv_segments(UINT16 segin); + +protected: + static const UINT8 AT_NORMAL = 0x00; + static const UINT8 AT_BOLD = 0x01; + static const UINT8 AT_UNDERLINE = 0x02; + static const UINT8 AT_BLINK = 0x04; + static const UINT8 AT_BLINKED = 0x80; // set when character should be blinked off + + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + int m_cursx, m_cursy; + int m_savedx, m_savedy; + int m_rows, m_cols; + UINT8 m_curattr; + UINT8 m_lastchar; + UINT8 m_chars[2][40]; + UINT8 m_attrs[2][40]; + UINT8 m_dirty[2][40]; +}; + +class esq1x22_t : public esqvfd_t { +public: + esq1x22_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void write_char(int data); + +protected: + virtual machine_config_constructor device_mconfig_additions() const; + +private: +}; + +class esq2x40_t : public esqvfd_t { +public: + esq2x40_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void write_char(int data); + +protected: + virtual machine_config_constructor device_mconfig_additions() const; + +private: +}; + +class esq2x40_sq1_t : public esqvfd_t { +public: + esq2x40_sq1_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void write_char(int data); + +protected: + virtual machine_config_constructor device_mconfig_additions() const; + +private: + bool m_Wait87Shift, m_Wait88Shift; +}; + +extern const device_type ESQ1x22; +extern const device_type ESQ2x40; +extern const device_type ESQ2x40_SQ1; + +#endif diff --git a/src/mame/machine/fm_scsi.c b/src/mame/machine/fm_scsi.c new file mode 100644 index 00000000000..a63795db0c2 --- /dev/null +++ b/src/mame/machine/fm_scsi.c @@ -0,0 +1,427 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + * + * Implementation of Fujitsu FMR-50, FMR-60 and FM-Towns SCSI hardware + * + * + + info from Toshiya Takeda's e-FMR50 source (the Towns uses the same controller?) + 0xc30 = Data register + 0xc32 = Status register (read) + bit 7 = REQ + bit 6 = I/O + bit 5 = MSG + bit 4 = C/D + bit 3 = BUSY + bit 1 = INT + bit 0 = PERR + 0xc32 = Control register (write) + bit 7 = WEN + bit 6 = IMSK + bit 4 = ATN + bit 2 = SEL + bit 1 = DMAE + bit 0 = RST +*/ +#include "emu.h" +#include "fm_scsi.h" +#include "debugger.h" + +/* + * Device config + */ + +const device_type FMSCSI = &device_creator; + +/* + * Device + */ + +fmscsi_device::fmscsi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : legacy_scsi_host_adapter(mconfig, FMSCSI, "FM-SCSI", tag, owner, clock, "fmscsi", __FILE__), + m_irq_handler(*this), + m_drq_handler(*this) +{ +} + +void fmscsi_device::device_start() +{ + m_input_lines = 0; + m_output_lines = 0; + m_data = 0; + m_command_index = 0; + m_last_id = 0; + m_target = 0; + m_phase = SCSI_PHASE_BUS_FREE; + + m_irq_handler.resolve_safe(); + m_drq_handler.resolve_safe(); + + // allocate read timer + m_transfer_timer = timer_alloc(TIMER_TRANSFER); + m_phase_timer = timer_alloc(TIMER_PHASE); +} + +void fmscsi_device::device_reset() +{ + m_input_lines = 0; + m_output_lines = 0; + m_data = 0; + m_command_index = 0; + m_last_id = 0; + m_target = 0; + m_result_length = 0; + m_result_index = 0; + stop_transfer(); + set_input_line(FMSCSI_LINE_INT,0); + m_irq_handler(0); + + m_phase = SCSI_PHASE_BUS_FREE; +} + +// get the length of a SCSI command based on it's command byte type +int fmscsi_device::get_scsi_cmd_len(UINT8 cbyte) +{ + int group; + + group = (cbyte>>5) & 7; + + if (group == 0) return 6; + if (group == 1 || group == 2) return 10; + if (group == 5) return 12; + + fatalerror("fmscsi: Unknown SCSI command group %d\n", group); + + // never executed + //return 6; +} + +void fmscsi_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_TRANSFER: + set_input_line(FMSCSI_LINE_REQ,1); + //logerror("FMSCSI: timer triggered: %i/%i\n",m_result_index,m_result_length); + if(m_output_lines & FMSCSI_LINE_DMAE) + { + m_drq_handler(1); + } + break; + case TIMER_PHASE: + set_phase(param); + break; + } +} + +void fmscsi_device::stop_transfer() +{ + m_transfer_timer->adjust(attotime::never); // stop timer + m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS); + if(m_output_lines & FMSCSI_LINE_DMAE) + { + m_drq_handler(0); + } + logerror("FMSCSI: Stopping transfer : (%i/%i)\n",m_result_index,m_result_length); +} + +UINT8 fmscsi_device::fmscsi_data_r(void) +{ + // read from data bus + // ACK is automatic on accessing the data bus, so REQ will go low. + set_input_line(FMSCSI_LINE_REQ,0); + + if(m_phase == SCSI_PHASE_DATAIN) + { + m_data = m_buffer[m_result_index % 512]; + //logerror("FMSCSI: DATAIN phase read data %02x\n",m_data); + m_result_index++; + if(m_result_index % 512 == 0) + read_data(m_buffer,512); // read next sector + + if(m_result_index >= m_result_length) + { + // end of data transfer + stop_transfer(); + } + return m_data; + } + + if(m_phase == SCSI_PHASE_MESSAGE_IN) + { + m_data = 0; // command complete message + m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_BUS_FREE); + m_command_index = 0; + return m_data; + } + + if(m_phase == SCSI_PHASE_STATUS) + { + m_data = get_status(); + // no command complete message? + m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_MESSAGE_IN); + m_command_index = 0; + //set_input_line(FMSCSI_LINE_REQ,1); // raise REQ yet again + return m_data; + } + + return m_data; +} + +void fmscsi_device::fmscsi_data_w(UINT8 data) +{ + int phase; + + // write to data bus + m_data = data; + //logerror("FMSCSI: data write %02x\n",data); + + // ACK is automatic on accessing the data bus, so REQ will go low. + set_input_line(FMSCSI_LINE_REQ,0); + + if(m_phase == SCSI_PHASE_BUS_FREE) + { + // select target + switch(data & 0x7f) + { + case 0x01: m_target = 0; break; + case 0x02: m_target = 1; break; + case 0x04: m_target = 2; break; + case 0x08: m_target = 3; break; + case 0x10: m_target = 4; break; + } + } + if(m_phase == SCSI_PHASE_DATAOUT) + { + m_buffer[m_result_index % 512] = m_data; + m_result_index++; + if(m_result_index % 512 == 0) + write_data(m_buffer,512); // write buffer to disc + if(m_result_index >= m_result_length) + { + // end of data transfer + m_transfer_timer->adjust(attotime::never); // stop timer + m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS); + if(m_output_lines & FMSCSI_LINE_DMAE) + { + m_drq_handler(0); + } + logerror("FMSCSI: Stopping transfer : (%i/%i)\n",m_result_index,m_result_length); + } + } + if(m_phase == SCSI_PHASE_COMMAND) + { + m_command[m_command_index] = data; + logerror("FMSCSI: writing command byte %02x [%i]\n",data,m_command_index); + m_command_index++; + if(m_command_index >= get_scsi_cmd_len(m_command[0])) + { + // command complete + send_command(m_command,m_command_index); + m_result_length = get_length(); + phase = legacy_scsi_host_adapter::get_phase(); + m_phase_timer->adjust(attotime::from_usec(800),phase); + + logerror("FMSCSI: Command %02x sent, result length = %i\n",m_command[0],m_result_length); + } + else + { + m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_COMMAND); + } + } + if(m_phase == SCSI_PHASE_MESSAGE_OUT) + { + m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS); + } +} + +void fmscsi_device::set_phase(int phase) +{ + m_phase = phase; + logerror("FMSCSI: phase set to %i\n",m_phase); + // set input lines accordingly + switch(phase) + { + case SCSI_PHASE_BUS_FREE: + set_input_line(FMSCSI_LINE_BSY,0); + set_input_line(FMSCSI_LINE_CD,0); + set_input_line(FMSCSI_LINE_MSG,0); + set_input_line(FMSCSI_LINE_IO,0); + //set_input_line(FMSCSI_LINE_REQ,0); + break; + case SCSI_PHASE_COMMAND: + set_input_line(FMSCSI_LINE_BSY,1); + set_input_line(FMSCSI_LINE_CD,1); + set_input_line(FMSCSI_LINE_MSG,0); + set_input_line(FMSCSI_LINE_IO,0); + set_input_line(FMSCSI_LINE_REQ,1); + break; + case SCSI_PHASE_STATUS: + set_input_line(FMSCSI_LINE_CD,1); + set_input_line(FMSCSI_LINE_MSG,0); + set_input_line(FMSCSI_LINE_IO,1); + set_input_line(FMSCSI_LINE_REQ,1); + break; + case SCSI_PHASE_DATAIN: + set_input_line(FMSCSI_LINE_CD,0); + set_input_line(FMSCSI_LINE_MSG,0); + set_input_line(FMSCSI_LINE_IO,1); + set_input_line(FMSCSI_LINE_REQ,1); + // start transfer timer + m_transfer_timer->adjust(attotime::zero,0,attotime::from_hz(3000000)); // arbitrary value for now + read_data(m_buffer,512); + m_result_index = 0; + logerror("FMSCSI: Starting transfer in (%i)\n",m_result_length); + break; + case SCSI_PHASE_DATAOUT: + set_input_line(FMSCSI_LINE_CD,0); + set_input_line(FMSCSI_LINE_MSG,0); + set_input_line(FMSCSI_LINE_IO,0); + set_input_line(FMSCSI_LINE_REQ,1); + // start transfer timer + m_transfer_timer->adjust(attotime::zero,0,attotime::from_hz(3000000)); // arbitrary value for now + m_result_index = 0; + logerror("FMSCSI: Starting transfer out (%i)\n",m_result_length); + break; + case SCSI_PHASE_MESSAGE_IN: + set_input_line(FMSCSI_LINE_CD,1); + set_input_line(FMSCSI_LINE_MSG,1); + set_input_line(FMSCSI_LINE_IO,1); + set_input_line(FMSCSI_LINE_REQ,1); + break; + case SCSI_PHASE_MESSAGE_OUT: + set_input_line(FMSCSI_LINE_CD,1); + set_input_line(FMSCSI_LINE_MSG,1); + set_input_line(FMSCSI_LINE_IO,0); + set_input_line(FMSCSI_LINE_REQ,1); + break; + } +} + +int fmscsi_device::get_phase(void) +{ + return m_phase; +} + +void fmscsi_device::set_input_line(UINT8 line, UINT8 state) +{ + if(line == FMSCSI_LINE_REQ) + { + if(state != 0 && !(m_input_lines & FMSCSI_LINE_REQ)) // low to high + { + if(m_output_lines & FMSCSI_LINE_IMSK && m_phase != SCSI_PHASE_DATAIN && m_phase != SCSI_PHASE_DATAOUT) + { + set_input_line(FMSCSI_LINE_INT,1); + m_irq_handler(1); + logerror("FMSCSI: IRQ high\n"); + } + } + if(state == 0 && (m_input_lines & FMSCSI_LINE_REQ)) // high to low + { + if(m_output_lines & FMSCSI_LINE_IMSK && m_phase != SCSI_PHASE_DATAIN && m_phase != SCSI_PHASE_DATAOUT) + { + set_input_line(FMSCSI_LINE_INT,0); + m_irq_handler(0); + logerror("FMSCSI: IRQ low\n"); + } + } + } + if(state != 0) + m_input_lines |= line; + else + m_input_lines &= ~line; +// logerror("FMSCSI: input line %02x set to %i\n",line,state); +} + +UINT8 fmscsi_device::get_input_line(UINT8 line) +{ + return m_input_lines & line; +} + +void fmscsi_device::set_output_line(UINT8 line, UINT8 state) +{ + if(line == FMSCSI_LINE_RST && state != 0) + { + device_reset(); + logerror("FMSCSI: reset\n"); + } + + if(line == FMSCSI_LINE_SEL) + { + if(state != 0 && !(m_output_lines & FMSCSI_LINE_SEL)) // low to high transition + { + if (select(m_target)) + { + m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_COMMAND); + m_data = 0x08; + } + } + } + + if(line == FMSCSI_LINE_ATN) + { + if(state != 0) + m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_MESSAGE_OUT); + } + + if(state != 0) + m_output_lines |= line; + else + m_output_lines &= ~line; +// logerror("FMSCSI: output line %02x set to %i\n",line,state); +} + +UINT8 fmscsi_device::get_output_line(UINT8 line) +{ + return m_output_lines & line; +} + +UINT8 fmscsi_device::fmscsi_status_r(void) +{ + // status inputs + return m_input_lines; +} + +void fmscsi_device::fmscsi_control_w(UINT8 data) +{ + // control outputs + set_output_line(FMSCSI_LINE_RST,data & FMSCSI_LINE_RST); + set_output_line(FMSCSI_LINE_DMAE,data & FMSCSI_LINE_DMAE); + set_output_line(FMSCSI_LINE_IMSK,data & FMSCSI_LINE_IMSK); + set_output_line(FMSCSI_LINE_ATN,data & FMSCSI_LINE_ATN); + set_output_line(FMSCSI_LINE_WEN,data & FMSCSI_LINE_WEN); + set_output_line(FMSCSI_LINE_SEL,data & FMSCSI_LINE_SEL); + logerror("FMSCSI: control write %02x\n",data); +} + +READ8_MEMBER( fmscsi_device::fmscsi_r ) +{ + switch(offset & 0x03) + { + case 0x00: + return fmscsi_data_r(); + case 0x01: + return fmscsi_status_r(); + case 0x02: + return 0x80; // Linux uses this port to detect the ability to do word transfers. We'll tell it that it doesn't for now. + default: + logerror("FMSCSI: Unknown read at offset %i\n",offset); + } + return 0; +} + +WRITE8_MEMBER( fmscsi_device::fmscsi_w ) +{ + switch(offset & 0x03) + { + case 0x00: + fmscsi_data_w(data); + break; + case 0x01: + fmscsi_control_w(data); + break; + default: + logerror("FMSCSI: Unknown write 0x%02x at offset %i\n",data,offset); + } +} diff --git a/src/mame/machine/fm_scsi.h b/src/mame/machine/fm_scsi.h new file mode 100644 index 00000000000..12ca5ded55d --- /dev/null +++ b/src/mame/machine/fm_scsi.h @@ -0,0 +1,103 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + * fm_scsi.h + * + * SCSI controller used in Fujitsu FMR-50, FMR-60, and FM-Towns + * + */ + +#ifndef FM_SCSI_H_ +#define FM_SCSI_H_ + +#include "machine/legscsi.h" + +// SCSI input lines (from target) +#define FMSCSI_LINE_REQ 0x80 +#define FMSCSI_LINE_IO 0x40 +#define FMSCSI_LINE_MSG 0x20 +#define FMSCSI_LINE_CD 0x10 +#define FMSCSI_LINE_BSY 0x08 +#define FMSCSI_LINE_EX 0x04 +#define FMSCSI_LINE_INT 0x02 +#define FMSCSI_LINE_PERR 0x01 + +// SCSI output lines (to target) +#define FMSCSI_LINE_WEN 0x80 +#define FMSCSI_LINE_IMSK 0x40 +#define FMSCSI_LINE_RMSK 0x20 +#define FMSCSI_LINE_ATN 0x10 +#define FMSCSI_LINE_WRD 0x08 +#define FMSCSI_LINE_SEL 0x04 +#define FMSCSI_LINE_DMAE 0x02 +#define FMSCSI_LINE_RST 0x01 + +#define MCFG_FMSCSI_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, FMSCSI, 0) + +#define MCFG_FMSCSI_IRQ_HANDLER(_devcb) \ + devcb = &fmscsi_device::set_irq_handler(*device, DEVCB_##_devcb); +#define MCFG_FMSCSI_DRQ_HANDLER(_devcb) \ + devcb = &fmscsi_device::set_drq_handler(*device, DEVCB_##_devcb); + +class fmscsi_device : public legacy_scsi_host_adapter +{ +public: + // construction/destruction + fmscsi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // static configuration helpers + template static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast(device).m_irq_handler.set_callback(object); } + template static devcb_base &set_drq_handler(device_t &device, _Object object) { return downcast(device).m_drq_handler.set_callback(object); } + + // any publically accessible interfaces needed for runtime + UINT8 fmscsi_data_r(void); + void fmscsi_data_w(UINT8 data); + UINT8 fmscsi_status_r(void); + void fmscsi_control_w(UINT8 data); + DECLARE_READ8_MEMBER( fmscsi_r ); + DECLARE_WRITE8_MEMBER( fmscsi_w ); + + void set_phase(int phase); + int get_phase(void); + void set_input_line(UINT8 line, UINT8 state); + UINT8 get_input_line(UINT8 line); + void set_output_line(UINT8 line, UINT8 state); + UINT8 get_output_line(UINT8 line); + +protected: + // device-level overrides (none are required, but these are common) + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + // internal device state goes here + static const device_timer_id TIMER_TRANSFER = 0; + static const device_timer_id TIMER_PHASE = 1; + + int get_scsi_cmd_len(UINT8 cbyte); + void stop_transfer(); + + devcb_write_line m_irq_handler; + devcb_write_line m_drq_handler; + + UINT8 m_command[32]; + //UINT8 m_result[32]; + UINT8 m_command_index; + int m_result_length; + UINT32 m_result_index; + UINT8 m_input_lines; + UINT8 m_output_lines; + UINT8 m_data; + UINT8 m_last_id; + UINT8 m_phase; + UINT8 m_target; + UINT8 m_buffer[512]; + emu_timer* m_transfer_timer; + emu_timer* m_phase_timer; +}; + +extern const device_type FMSCSI; + +#endif /* FM_SCSI_H_ */ diff --git a/src/mame/machine/galaxy.c b/src/mame/machine/galaxy.c new file mode 100644 index 00000000000..2356a193b7e --- /dev/null +++ b/src/mame/machine/galaxy.c @@ -0,0 +1,211 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha, Miodrag Milanovic +/*************************************************************************** + + machine.c + + Functions to emulate general aspects of the machine (RAM, ROM, interrupts, + I/O ports) + +***************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "includes/galaxy.h" + +/*************************************************************************** + I/O devices +***************************************************************************/ + +READ8_MEMBER(galaxy_state::galaxy_keyboard_r) +{ + if (offset == 0) + { + double level = m_cassette->input(); + return (level > 0) ? 0xfe : 0xff; + } + else + { + return m_io_ports[(offset>>3) & 0x07]->read() & (0x01<<(offset & 0x07)) ? 0xfe : 0xff; + } +} + +WRITE8_MEMBER(galaxy_state::galaxy_latch_w) +{ + double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000; + m_latch_value = data; + m_cassette->output(val); +} + + + +/*************************************************************************** + Interrupts +***************************************************************************/ + +INTERRUPT_GEN_MEMBER(galaxy_state::galaxy_interrupt) +{ + device.execute().set_input_line(0, HOLD_LINE); +} + +IRQ_CALLBACK_MEMBER(galaxy_state::galaxy_irq_callback) +{ + galaxy_set_timer(); + m_interrupts_enabled = TRUE; + return 0xff; +} + +/*************************************************************************** + Snapshot files (GAL) +***************************************************************************/ + +#define GALAXY_SNAPSHOT_V1_SIZE 8268 +#define GALAXY_SNAPSHOT_V2_SIZE 8244 + +void galaxy_state::galaxy_setup_snapshot (const UINT8 * data, UINT32 size) +{ + switch (size) + { + case GALAXY_SNAPSHOT_V1_SIZE: + m_maincpu->set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); + m_maincpu->set_state_int(Z80_BC, data[0x04] | data[0x05] << 8); + m_maincpu->set_state_int(Z80_DE, data[0x08] | data[0x09] << 8); + m_maincpu->set_state_int(Z80_HL, data[0x0c] | data[0x0d] << 8); + m_maincpu->set_state_int(Z80_IX, data[0x10] | data[0x11] << 8); + m_maincpu->set_state_int(Z80_IY, data[0x14] | data[0x15] << 8); + m_maincpu->set_state_int(Z80_PC, data[0x18] | data[0x19] << 8); + m_maincpu->set_state_int(Z80_SP, data[0x1c] | data[0x1d] << 8); + m_maincpu->set_state_int(Z80_AF2, data[0x20] | data[0x21] << 8); + m_maincpu->set_state_int(Z80_BC2, data[0x24] | data[0x25] << 8); + m_maincpu->set_state_int(Z80_DE2, data[0x28] | data[0x29] << 8); + m_maincpu->set_state_int(Z80_HL2, data[0x2c] | data[0x2d] << 8); + m_maincpu->set_state_int(Z80_IFF1, data[0x30]); + m_maincpu->set_state_int(Z80_IFF2, data[0x34]); + m_maincpu->set_state_int(Z80_HALT, data[0x38]); + m_maincpu->set_state_int(Z80_IM, data[0x3c]); + m_maincpu->set_state_int(Z80_I, data[0x40]); + m_maincpu->set_state_int(Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80)); + + memcpy (m_ram->pointer(), data + 0x084c, (m_ram->size() < 0x1800) ? m_ram->size() : 0x1800); + + break; + case GALAXY_SNAPSHOT_V2_SIZE: + m_maincpu->set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); + m_maincpu->set_state_int(Z80_BC, data[0x02] | data[0x03] << 8); + m_maincpu->set_state_int(Z80_DE, data[0x04] | data[0x05] << 8); + m_maincpu->set_state_int(Z80_HL, data[0x06] | data[0x07] << 8); + m_maincpu->set_state_int(Z80_IX, data[0x08] | data[0x09] << 8); + m_maincpu->set_state_int(Z80_IY, data[0x0a] | data[0x0b] << 8); + m_maincpu->set_state_int(Z80_PC, data[0x0c] | data[0x0d] << 8); + m_maincpu->set_state_int(Z80_SP, data[0x0e] | data[0x0f] << 8); + m_maincpu->set_state_int(Z80_AF2, data[0x10] | data[0x11] << 8); + m_maincpu->set_state_int(Z80_BC2, data[0x12] | data[0x13] << 8); + m_maincpu->set_state_int(Z80_DE2, data[0x14] | data[0x15] << 8); + m_maincpu->set_state_int(Z80_HL2, data[0x16] | data[0x17] << 8); + + m_maincpu->set_state_int(Z80_IFF1, data[0x18] & 0x01); + m_maincpu->set_state_int(Z80_IFF2, (UINT64)0); + + m_maincpu->set_state_int(Z80_HALT, (UINT64)0); + + m_maincpu->set_state_int(Z80_IM, (data[0x18] >> 1) & 0x03); + + m_maincpu->set_state_int(Z80_I, data[0x19]); + m_maincpu->set_state_int(Z80_R, data[0x1a]); + + memcpy (m_ram->pointer(), data + 0x0834, (m_ram->size() < 0x1800) ? m_ram->size() : 0x1800); + + break; + } + + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); +} + +SNAPSHOT_LOAD_MEMBER( galaxy_state, galaxy ) +{ + UINT8* snapshot_data; + + switch (snapshot_size) + { + case GALAXY_SNAPSHOT_V1_SIZE: + case GALAXY_SNAPSHOT_V2_SIZE: + snapshot_data = auto_alloc_array(machine(), UINT8, snapshot_size); + break; + default: + return IMAGE_INIT_FAIL; + } + + image.fread( snapshot_data, snapshot_size); + + galaxy_setup_snapshot(snapshot_data, snapshot_size); + + return IMAGE_INIT_PASS; +} + + +/*************************************************************************** + Driver Initialization +***************************************************************************/ + +DRIVER_INIT_MEMBER(galaxy_state,galaxy) +{ + static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; + + address_space &space = m_maincpu->space(AS_PROGRAM); + space.install_readwrite_bank( 0x2800, 0x2800 + m_ram->size() - 1, "bank1"); + membank("bank1")->set_base(m_ram->pointer()); + + if (m_ram->size() < (6 + 48) * 1024) + { + space.nop_readwrite( 0x2800 + m_ram->size(), 0xffff); + } + + for ( int i = 0; i < 8; i++ ) + { + m_io_ports[i] = ioport( keynames[i] ); + } +} + +/*************************************************************************** + Machine Initialization +***************************************************************************/ + +MACHINE_RESET_MEMBER(galaxy_state,galaxy) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + /* ROM 2 enable/disable */ + if (ioport("ROM2")->read()) { + space.install_read_bank(0x1000, 0x1fff, "bank10"); + } else { + space.nop_read(0x1000, 0x1fff); + } + space.nop_write(0x1000, 0x1fff); + + if (ioport("ROM2")->read()) + membank("bank10")->set_base(memregion("maincpu")->base() + 0x1000); + + m_interrupts_enabled = TRUE; +} + +DRIVER_INIT_MEMBER(galaxy_state,galaxyp) +{ + DRIVER_INIT_CALL(galaxy); +} + +MACHINE_RESET_MEMBER(galaxy_state,galaxyp) +{ + UINT8 *ROM = memregion("maincpu")->base(); + address_space &space = m_maincpu->space(AS_PROGRAM); + + ROM[0x0037] = 0x29; + ROM[0x03f9] = 0xcd; + ROM[0x03fa] = 0x00; + ROM[0x03fb] = 0xe0; + + space.install_read_bank(0xe000, 0xefff, "bank11"); + space.nop_write(0xe000, 0xefff); + membank("bank11")->set_base(memregion("maincpu")->base() + 0xe000); + m_interrupts_enabled = TRUE; +} diff --git a/src/mame/machine/gamecom.c b/src/mame/machine/gamecom.c new file mode 100644 index 00000000000..148a0585928 --- /dev/null +++ b/src/mame/machine/gamecom.c @@ -0,0 +1,629 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Robbbert + +#include "includes/gamecom.h" + + + +static const int gamecom_timer_limit[8] = { 2, 1024, 2048, 4096, 8192, 16384, 32768, 65536 }; + +TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_clock_timer_callback) +{ + UINT8 val = m_p_ram[SM8521_CLKT] + 1; + m_p_ram[SM8521_CLKT] = ( m_p_ram[SM8521_CLKT] & 0xC0 ) | (val & 0x3f); + m_maincpu->set_input_line(sm8500_cpu_device::CK_INT, ASSERT_LINE ); +} + +void gamecom_state::machine_reset() +{ + UINT8 *rom = m_region_kernel->base(); + m_bank1->set_base(rom); + m_bank2->set_base(rom); + m_bank3->set_base(rom); + m_bank4->set_base(rom); + + m_cart_ptr = NULL; + m_lch_reg = 0x07; + m_lcv_reg = 0x27; + m_lcdc_reg = 0xb0; + + std::string region_tag; + m_cart1_rom = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + m_cart2_rom = memregion(region_tag.assign(m_cart2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); +} + +void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data) +{ + if (data < 0x20) + { + /* select internal ROM bank */ + switch (mmu) + { + case 1: m_bank1->set_base(m_region_kernel->base() + (data << 13)); break; + case 2: m_bank2->set_base(m_region_kernel->base() + (data << 13)); break; + case 3: m_bank3->set_base(m_region_kernel->base() + (data << 13)); break; + case 4: m_bank4->set_base(m_region_kernel->base() + (data << 13)); break; + } + } + else + { + /* select cartridge bank */ + if (m_cart_ptr) + { + switch (mmu) + { + case 1: m_bank1->set_base(m_cart_ptr + (data << 13)); break; + case 2: m_bank2->set_base(m_cart_ptr + (data << 13)); break; + case 3: m_bank3->set_base(m_cart_ptr + (data << 13)); break; + case 4: m_bank4->set_base(m_cart_ptr + (data << 13)); break; + } + } + } +} + +void gamecom_state::handle_stylus_press( int column ) +{ + UINT16 data = m_io_grid[column]->read(); + if (data) + { + UINT16 stylus_y = data ^ 0x3ff; + m_p_ram[SM8521_P0] = stylus_y; + m_p_ram[SM8521_P1] = ( m_p_ram[SM8521_P1] & 0xFC ) | ( stylus_y >> 8 ); + } + else + { + m_p_ram[SM8521_P0] = 0xFF; + m_p_ram[SM8521_P1] |= 3; + } +} + +void gamecom_state::handle_input_press(UINT16 mux_data) +{ + switch( mux_data ) + { + case 0xFFFB: + /* column #0 */ + /* P0 bit 0 cleared => 01 */ + /* P0 bit 1 cleared => 0E */ + /* P0 bit 2 cleared => 1B */ + /* P0 bit 3 cleared => etc */ + /* P0 bit 4 cleared => */ + /* P0 bit 5 cleared => */ + /* P0 bit 6 cleared => */ + /* P0 bit 7 cleared => */ + /* P1 bit 0 cleared => */ + /* P1 bit 1 cleared => */ + handle_stylus_press(0); + break; + case 0xFFF7: /* column #1 */ + handle_stylus_press(1); + break; + case 0xFFEF: /* column #2 */ + handle_stylus_press(2); + break; + case 0xFFDF: /* column #3 */ + handle_stylus_press(3); + break; + case 0xFFBF: /* column #4 */ + handle_stylus_press(4); + break; + case 0xFF7F: /* column #5 */ + handle_stylus_press(5); + break; + case 0xFEFF: /* column #6 */ + handle_stylus_press(6); + break; + case 0xFDFF: /* column #7 */ + handle_stylus_press(7); + break; + case 0xFBFF: /* column #8 */ + handle_stylus_press(8); + break; + case 0xF7FF: /* column #9 */ + handle_stylus_press(9); + break; + case 0xEFFF: /* column #10 */ + handle_stylus_press(10); + break; + case 0xDFFF: /* column #11 */ + handle_stylus_press(11); + break; + case 0xBFFF: /* column #12 */ + handle_stylus_press(12); + break; + case 0x7FFF: /* keys #1 */ + /* P0 bit 0 cleared => 83 (up) */ + /* P0 bit 1 cleared => 84 (down) */ + /* P0 bit 2 cleared => 85 (left) */ + /* P0 bit 3 cleared => 86 (right) */ + /* P0 bit 4 cleared => 87 (menu) */ + /* P0 bit 5 cleared => 8A (pause) */ + /* P0 bit 6 cleared => 89 (sound) */ + /* P0 bit 7 cleared => 8B (button A) */ + /* P1 bit 0 cleared => 8C (button B) */ + /* P1 bit 1 cleared => 8D (button C) */ + m_p_ram[SM8521_P0] = m_io_in0->read(); + m_p_ram[SM8521_P1] = (m_p_ram[SM8521_P1] & 0xFC) | ( m_io_in1->read() & 3 ); + break; + case 0xFFFF: /* keys #2 */ + /* P0 bit 0 cleared => 88 (power) */ + /* P0 bit 1 cleared => 8E (button D) */ + /* P0 bit 2 cleared => A0 */ + /* P0 bit 3 cleared => A0 */ + /* P0 bit 4 cleared => A0 */ + /* P0 bit 5 cleared => A0 */ + /* P0 bit 6 cleared => A0 */ + /* P0 bit 7 cleared => A0 */ + /* P1 bit 0 cleared => A0 */ + /* P1 bit 1 cleared => A0 */ + m_p_ram[SM8521_P0] = (m_p_ram[SM8521_P0] & 0xFC) | ( m_io_in2->read() & 3 ); + m_p_ram[SM8521_P1] = 0xFF; + break; + } +} + +WRITE8_MEMBER( gamecom_state::gamecom_pio_w ) +{ + offset += 0x14; + m_p_ram[offset] = data; + switch (offset) + { + case SM8521_P1: + case SM8521_P2: + handle_input_press(m_p_ram[SM8521_P1] | (m_p_ram[SM8521_P2] << 8)); + break; + case SM8521_P3: + /* P3 bit7 clear, bit6 set -> enable cartridge port #0? */ + /* P3 bit6 clear, bit7 set -> enable cartridge port #1? */ + switch (data & 0xc0) + { + case 0x40: m_cart_ptr = m_cart1_rom->base(); break; + case 0x80: m_cart_ptr = m_cart2_rom->base(); break; + default: m_cart_ptr = NULL; break; + } + return; + } +} + +READ8_MEMBER( gamecom_state::gamecom_pio_r ) +{ + return m_p_ram[offset + 0x14]; +} + +READ8_MEMBER( gamecom_state::gamecom_internal_r ) +{ +// ToDo: Read from vblank bit +// if(SM8521_LCV == offset + 0x20) +// popmessage("Read from vblank bit, TODO"); + + return m_p_ram[offset + 0x20]; +} + +/* TODO: preliminary, proper formula not yet understood (and manual doesn't help much either) */ +void gamecom_state::recompute_lcd_params() +{ + int vblank_period,hblank_period; + int H_timing,V_timing; + int pixel_clock; + attoseconds_t refresh; + + if(m_lch_reg != 7) + popmessage("LCH = %02x!",m_lch_reg); + + if((m_lcdc_reg & 0xf) != 0) + popmessage("LCDC = %02x!",m_lcdc_reg); + + if(m_lcv_reg != 0x27) + popmessage("LCV = %02x!",m_lcv_reg); + + H_timing = ((m_lch_reg & 0x1f) + 1) * 200/4; + V_timing = (m_lcv_reg & 0x1f); + pixel_clock = (XTAL_11_0592MHz / 2); // TODO: divisor actually settable + + rectangle visarea(0, 200-1, 0, 160-1); // TODO: check settings + + vblank_period = (V_timing + 160); + hblank_period = (H_timing + 200); + + refresh = HZ_TO_ATTOSECONDS(pixel_clock) * (hblank_period) * vblank_period; + machine().first_screen()->configure((hblank_period), (vblank_period), visarea, refresh ); +} + +WRITE8_MEMBER( gamecom_state::gamecom_internal_w ) +{ + offset += 0x20; + switch( offset ) + { + case SM8521_MMU0: /* disable bootstrap ROM? most likely not written to on game.com */ + logerror( "Write to MMU0\n" ); + break; + case SM8521_MMU1: + gamecom_set_mmu(1, data); + break; + case SM8521_MMU2: + gamecom_set_mmu(2, data); + break; + case SM8521_MMU3: + gamecom_set_mmu(3, data); + break; + case SM8521_MMU4: + gamecom_set_mmu(4, data); + break; + + /* Video hardware and DMA */ + case SM8521_DMBR: + data &= 0x7f; + break; + case SM8521_TM0D: + m_timer[0].check_value = data; + return; + case SM8521_TM0C: + m_timer[0].enabled = data & 0x80; + m_timer[0].state_limit = gamecom_timer_limit[data & 0x07] >> 1; + m_timer[0].state_count = 0; + m_p_ram[SM8521_TM0D] = 0; + break; + case SM8521_TM1D: + m_timer[1].check_value = data; + return; + case SM8521_TM1C: + m_timer[1].enabled = data & 0x80; + m_timer[1].state_limit = gamecom_timer_limit[data & 0x07] >> 1; + m_timer[1].state_count = 0; + m_p_ram[SM8521_TM1D] = 0; + break; + case SM8521_CLKT: /* bit 6-7 */ + if ( data & 0x80 ) + { + /* timer run */ + if ( data & 0x40 ) + { + /* timer resolution 1 minute */ + m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(60)); + } + else + { + /* TImer resolution 1 second */ + m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + } + } + else + { + /* disable timer reset */ + m_clock_timer->enable( 0 ); + data &= 0xC0; + } + break; + + case SM8521_LCDC: + m_lcdc_reg = data; + recompute_lcd_params(); + break; + + case SM8521_LCH: + /* + --x- ---- Horizontal DOT size (160 / 200) + ---x xxxx H-Timing bits + */ + m_lch_reg = data; + recompute_lcd_params(); + break; + + case SM8521_LCV: + /* + x--- ---- V-blank bit (R) + -xx- ---- V-line size bits (100 / 160 / 200 / undef) + ---x xxxx V-Blank width bits + */ + m_lcv_reg = data; + recompute_lcd_params(); + break; + + /* Sound */ + case SM8521_SGC: + /* + x--- ---- enable sound output + ---- x--- enable DAC + ---- -x-- enable SG2 + ---- --x- enable SG1 + ---- ---x enable SG0 + */ + m_sound.sgc = data; + break; + case SM8521_SG0L: + m_sound.sg0l = data; + break; + case SM8521_SG1L: + m_sound.sg1l = data; + break; + case SM8521_SG0TH: + m_sound.sg0t = ( m_sound.sg0t & 0xFF ) | ( data << 8 ); + break; + case SM8521_SG0TL: + m_sound.sg0t = ( m_sound.sg0t & 0xFF00 ) | data; + break; + case SM8521_SG1TH: + m_sound.sg1t = ( m_sound.sg1t & 0xFF ) | ( data << 8 ); + break; + case SM8521_SG1TL: + m_sound.sg1t = ( m_sound.sg1t & 0xFF00 ) | data; + break; + case SM8521_SG2L: + m_sound.sg2l = data; + break; + case SM8521_SG2TH: + m_sound.sg2t = ( m_sound.sg2t & 0xFF ) | ( data << 8 ); + break; + case SM8521_SG2TL: + m_sound.sg2t = ( m_sound.sg2t & 0xFF00 ) | data; + break; + case SM8521_SGDA: + m_sound.sgda = data; + if((m_sound.sgc & 0x88) == 0x88) + m_dac->write_unsigned8(data); + break; + + case SM8521_SG0W0: + case SM8521_SG0W1: + case SM8521_SG0W2: + case SM8521_SG0W3: + case SM8521_SG0W4: + case SM8521_SG0W5: + case SM8521_SG0W6: + case SM8521_SG0W7: + case SM8521_SG0W8: + case SM8521_SG0W9: + case SM8521_SG0W10: + case SM8521_SG0W11: + case SM8521_SG0W12: + case SM8521_SG0W13: + case SM8521_SG0W14: + case SM8521_SG0W15: + m_sound.sg0w[offset - SM8521_SG0W0] = data; + break; + case SM8521_SG1W0: + case SM8521_SG1W1: + case SM8521_SG1W2: + case SM8521_SG1W3: + case SM8521_SG1W4: + case SM8521_SG1W5: + case SM8521_SG1W6: + case SM8521_SG1W7: + case SM8521_SG1W8: + case SM8521_SG1W9: + case SM8521_SG1W10: + case SM8521_SG1W11: + case SM8521_SG1W12: + case SM8521_SG1W13: + case SM8521_SG1W14: + case SM8521_SG1W15: + m_sound.sg1w[offset - SM8521_SG1W0] = data; + break; + + /* Reserved addresses */ + case SM8521_18: case SM8521_1B: + case SM8521_29: case SM8521_2A: case SM8521_2F: + case SM8521_33: case SM8521_3E: case SM8521_3F: + case SM8521_41: case SM8521_43: case SM8521_45: case SM8521_4B: + case SM8521_4F: + case SM8521_55: case SM8521_56: case SM8521_57: case SM8521_58: + case SM8521_59: case SM8521_5A: case SM8521_5B: case SM8521_5C: + case SM8521_5D: + logerror( "%X: Write to reserved address (0x%02X). Value written: 0x%02X\n", m_maincpu->pc(), offset, data ); + break; + } + m_p_ram[offset] = data; +} + + +/* The manual is not conclusive as to which bit of the DMVP register (offset 0x3D) determines + which page for source or destination is used */ +WRITE8_MEMBER( gamecom_state::gamecom_handle_dma ) +{ + UINT8 dmc = m_p_ram[SM8521_DMC]; + m_dma.overwrite_mode = dmc & 0x01; + m_dma.transfer_mode = dmc & 0x06; + m_dma.decrement_x = dmc & 0x08; + m_dma.decrement_y = dmc & 0x10; + m_dma.enabled = dmc & 0x80; + if ( !m_dma.enabled ) + { + return; + } + + m_dma.width_x = m_p_ram[SM8521_DMDX]; + m_dma.width_x_count = 0; + m_dma.width_y = m_p_ram[SM8521_DMDY]; + m_dma.width_y_count = 0; + m_dma.source_x = m_p_ram[SM8521_DMX1]; + m_dma.source_x_current = m_dma.source_x; + m_dma.source_y = m_p_ram[SM8521_DMY1]; + m_dma.source_width = ( m_p_ram[SM8521_LCH] & 0x20 ) ? 50 : 40; + m_dma.dest_x = m_p_ram[SM8521_DMX2]; + m_dma.dest_x_current = m_dma.dest_x; + m_dma.dest_y = m_p_ram[SM8521_DMY2]; + m_dma.dest_width = ( m_p_ram[SM8521_LCH] & 0x20 ) ? 50 : 40; + m_dma.palette[0] = m_p_ram[SM8521_DMPL] & 0x03; + m_dma.palette[1] = ( m_p_ram[SM8521_DMPL] >> 2 ) & 3; + m_dma.palette[2] = ( m_p_ram[SM8521_DMPL] >> 4 ) & 3; + m_dma.palette[3] = m_p_ram[SM8521_DMPL] >> 6; + m_dma.source_mask = 0x1FFF; + m_dma.dest_mask = 0x1FFF; +// logerror("DMA: width %Xx%X, source (%X,%X), dest (%X,%X), transfer_mode %X, banks %X \n", m_dma.width_x, m_dma.width_y, m_dma.source_x, m_dma.source_y, m_dma.dest_x, m_dma.dest_y, m_dma.transfer_mode, m_p_ram[SM8521_DMVP] ); +// logerror( " Palette: %d, %d, %d, %d\n", m_dma.palette[0], m_dma.palette[1], m_dma.palette[2], m_dma.palette[3] ); + switch( m_dma.transfer_mode ) + { + case 0x00: + /* VRAM->VRAM */ + m_dma.source_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; + m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; + break; + case 0x02: + /* ROM->VRAM */ +// logerror( "DMA DMBR = %X\n", m_p_ram[SM8521_DMBR] ); + m_dma.source_width = 64; + m_dma.source_mask = 0x3FFF; + if (m_p_ram[SM8521_DMBR] < 16) + m_dma.source_bank = m_region_kernel->base() + (m_p_ram[SM8521_DMBR] << 14); + else + if (m_cart_ptr) + m_dma.source_bank = m_cart_ptr + (m_p_ram[SM8521_DMBR] << 14); + + m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; + break; + case 0x04: + /* Extend RAM->VRAM */ + m_dma.source_width = 64; + m_dma.source_bank = &m_p_nvram[0x0000]; + m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; + break; + case 0x06: + /* VRAM->Extend RAM */ + m_dma.source_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; + m_dma.dest_width = 64; + m_dma.dest_bank = &m_p_nvram[0x0000]; + break; + } + m_dma.source_current = m_dma.source_width * m_dma.source_y; + m_dma.source_current += m_dma.source_x >> 2; + m_dma.dest_current = m_dma.dest_width * m_dma.dest_y; + m_dma.dest_current += m_dma.dest_x >> 2; + m_dma.source_line = m_dma.source_current; + m_dma.dest_line = m_dma.dest_current; + m_dma.state_count = 0; + + unsigned y_count, x_count; + + for( y_count = 0; y_count <= m_dma.width_y; y_count++ ) + { + for( x_count = 0; x_count <= m_dma.width_x; x_count++ ) + { + UINT16 src_addr = m_dma.source_current & m_dma.source_mask; + UINT16 dest_addr = m_dma.dest_current & m_dma.dest_mask; + UINT8 dest_adj = (3 - (m_dma.dest_x_current & 3)) << 1; + UINT8 src_adj = (3 - (m_dma.source_x_current & 3)) << 1; + + /* handle DMA for 1 pixel */ + // Get new pixel + UINT8 source_pixel = (m_dma.source_bank[src_addr] >> src_adj) & 3; + + // If overwrite mode, write new pixel + if ( m_dma.overwrite_mode || source_pixel) + { + // Get 4 pixels and remove the one about to be replaced + UINT8 other_pixels = m_dma.dest_bank[dest_addr] & ~(3 << dest_adj); + // Get palette of new pixel and place into the hole + m_dma.dest_bank[dest_addr] = other_pixels | (m_dma.palette[ source_pixel ] << dest_adj); + } + + /* Advance a pixel */ + if ( m_dma.decrement_x ) + { + m_dma.source_x_current--; + if ( ( m_dma.source_x_current & 0x03 ) == 0x03 ) + m_dma.source_current--; + } + else + { + m_dma.source_x_current++; + if ( ( m_dma.source_x_current & 0x03 ) == 0x00 ) + m_dma.source_current++; + } + m_dma.dest_x_current++; + if ( ( m_dma.dest_x_current & 0x03 ) == 0x00 ) + m_dma.dest_current++; + } + + /* Advance a line */ + m_dma.source_x_current = m_dma.source_x; + m_dma.dest_x_current = m_dma.dest_x; + if ( m_dma.decrement_y ) + m_dma.source_line -= m_dma.source_width; + else + m_dma.source_line += m_dma.source_width; + m_dma.source_current = m_dma.source_line; + m_dma.dest_line += m_dma.dest_width; + m_dma.dest_current = m_dma.dest_line; + } + m_dma.enabled = 0; + m_maincpu->set_input_line(sm8500_cpu_device::DMA_INT, ASSERT_LINE ); +} + +WRITE8_MEMBER( gamecom_state::gamecom_update_timers ) +{ + if ( m_timer[0].enabled ) + { + m_timer[0].state_count += data; + while ( m_timer[0].state_count >= m_timer[0].state_limit ) + { + m_timer[0].state_count -= m_timer[0].state_limit; + m_p_ram[SM8521_TM0D]++; + if ( m_p_ram[SM8521_TM0D] >= m_timer[0].check_value ) + { + m_p_ram[SM8521_TM0D] = 0; + m_maincpu->set_input_line(sm8500_cpu_device::TIM0_INT, ASSERT_LINE ); + } + } + } + if ( m_timer[1].enabled ) + { + m_timer[1].state_count += data; + while ( m_timer[1].state_count >= m_timer[1].state_limit ) + { + m_timer[1].state_count -= m_timer[1].state_limit; + m_p_ram[SM8521_TM1D]++; + if ( m_p_ram[SM8521_TM1D] >= m_timer[1].check_value ) + { + m_p_ram[SM8521_TM1D] = 0; + m_maincpu->set_input_line(sm8500_cpu_device::TIM1_INT, ASSERT_LINE ); + } + } + } +} + +DRIVER_INIT_MEMBER(gamecom_state,gamecom) +{ + m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_clock_timer_callback),this)); + m_p_ram = m_region_maincpu->base(); // required here because pio_w gets called before machine_reset +} + +int gamecom_state::common_load(device_image_interface &image, generic_slot_device *slot) +{ + UINT32 size = slot->common_get_size("rom"); + UINT32 load_offset = 0; + + if (size != 0x008000 && size != 0x040000 && size != 0x080000 + && size != 0x100000 && size != 0x1c0000 && size != 0x200000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + if (size == 0x1c0000) + load_offset = 0x40000; + + // in order to simplify banked access from the driver, we always allocate 0x200000, + slot->rom_alloc(0x200000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + // we load what we have + slot->common_load_rom(slot->get_rom_base() + load_offset, size, "rom"); + // and then we mirror the content, instead of masking out larger accesses + UINT8 *crt = slot->get_rom_base(); + if (size < 0x010000) { memcpy(crt + 0x008000, crt, 0x008000); } /* ->64KB */ + if (size < 0x020000) { memcpy(crt + 0x010000, crt, 0x010000); } /* ->128KB */ + if (size < 0x040000) { memcpy(crt + 0x020000, crt, 0x020000); } /* ->256KB */ + if (size < 0x080000) { memcpy(crt + 0x040000, crt, 0x040000); } /* ->512KB */ + if (size < 0x100000) { memcpy(crt + 0x080000, crt, 0x080000); } /* ->1MB */ + if (size < 0x1c0000) { memcpy(crt + 0x100000, crt, 0x100000); } /* -> >=1.8MB */ + + return IMAGE_INIT_PASS; +} + +DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 ) +{ + return common_load(image, m_cart1); +} + +DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 ) +{ + return common_load(image, m_cart2); +} diff --git a/src/mame/machine/gamepock.c b/src/mame/machine/gamepock.c new file mode 100644 index 00000000000..ecc94d723d5 --- /dev/null +++ b/src/mame/machine/gamepock.c @@ -0,0 +1,224 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "sound/speaker.h" +#include "cpu/upd7810/upd7810.h" +#include "includes/gamepock.h" + + +void gamepock_state::hd44102ch_w( int which, int c_d, UINT8 data ) +{ + if ( c_d ) + { + UINT8 y; + /* Data */ + m_hd44102ch[which].ram[ m_hd44102ch[which].address ] = data; + + /* Increment/decrement Y counter */ + y = ( m_hd44102ch[which].address & 0x3F ) + m_hd44102ch[which].y_inc; + if ( y == 0xFF ) + { + y = 49; + } + if ( y == 50 ) + { + y = 0; + } + m_hd44102ch[which].address = ( m_hd44102ch[which].address & 0xC0 ) | y; + } + else + { + /* Command */ + switch ( data ) + { + case 0x38: /* Display off */ + m_hd44102ch[which].enabled = 0; + break; + case 0x39: /* Display on */ + m_hd44102ch[which].enabled = 1; + break; + case 0x3A: /* Y decrement mode */ + m_hd44102ch[which].y_inc = 0xFF; + break; + case 0x3B: /* Y increment mode */ + m_hd44102ch[which].y_inc = 0x01; + break; + case 0x3E: /* Display start page #0 */ + case 0x7E: /* Display start page #1 */ + case 0xBE: /* Display start page #2 */ + case 0xFE: /* Display start page #3 */ + m_hd44102ch[which].start_page = data & 0xC0; + break; + default: + if ( ( data & 0x3F ) < 50 ) + { + m_hd44102ch[which].address = data; + } + break; + } + } +} + + +void gamepock_state::hd44102ch_init( int which ) +{ + memset( &m_hd44102ch[which], 0, sizeof( HD44102CH ) ); + m_hd44102ch[which].y_inc = 0x01; +} + + +void gamepock_state::lcd_update() +{ + /* Check whether HD44102CH #1 is enabled */ + if ( m_port_a & 0x08 ) + { + hd44102ch_w( 0, m_port_a & 0x04, m_port_b ); + } + + /* Check whether HD44102CH #2 is enabled */ + if ( m_port_a & 0x10 ) + { + hd44102ch_w( 1, m_port_a & 0x04, m_port_b ); + } + + /* Check whether HD44102CH #3 is enabled */ + if ( m_port_a & 0x20 ) + { + hd44102ch_w( 2, m_port_a & 0x04, m_port_b ); + } +} + + +WRITE8_MEMBER( gamepock_state::port_a_w ) +{ + UINT8 old_port_a = m_port_a; + + m_port_a = data; + + if ( ! ( old_port_a & 0x02 ) && ( m_port_a & 0x02 ) ) + { + lcd_update(); + } +} + + +WRITE8_MEMBER( gamepock_state::port_b_w ) +{ + m_port_b = data; +} + + +READ8_MEMBER( gamepock_state::port_b_r ) +{ + logerror("gamepock_port_b_r: not implemented\n"); + return 0xFF; +} + + +READ8_MEMBER( gamepock_state::port_c_r ) +{ + UINT8 data = 0xFF; + + if ( m_port_a & 0x80 ) + { + data &= ioport("IN0")->read(); + } + + if ( m_port_a & 0x40 ) + { + data &= ioport("IN1")->read(); + } + + return data; +} + + +void gamepock_state::machine_reset() +{ + hd44102ch_init( 0 ); + hd44102ch_init( 1 ); + hd44102ch_init( 2 ); + + if (m_cart->exists()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000,0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + +} + +UINT32 gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 ad; + int i,j; + + /* Handle HD44102CH #0 */ + ad = m_hd44102ch[0].start_page; + for ( i = 0; i < 4; i++ ) + { + for ( j = 0; j < 50; j++ ) + { + bitmap.pix16(i * 8 + 0, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix16(i * 8 + 1, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix16(i * 8 + 2, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix16(i * 8 + 3, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix16(i * 8 + 4, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix16(i * 8 + 5, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix16(i * 8 + 6, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix16(i * 8 + 7, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x80 ) ? 0 : 1; + } + ad += 0x40; + } + + /* Handle HD44102CH #1 */ + ad = m_hd44102ch[1].start_page; + for ( i = 4; i < 8; i++ ) + { + for ( j = 0; j < 50; j++ ) + { + bitmap.pix16(i * 8 + 0, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix16(i * 8 + 1, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix16(i * 8 + 2, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix16(i * 8 + 3, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix16(i * 8 + 4, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix16(i * 8 + 5, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix16(i * 8 + 6, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix16(i * 8 + 7, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x80 ) ? 0 : 1; + } + ad += 0x40; + } + + /* Handle HD44102CH #2 */ + ad = m_hd44102ch[2].start_page; + for ( i = 0; i < 4; i++ ) + { + for ( j = 0; j < 25; j++ ) + { + bitmap.pix16(i * 8 + 0, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix16(i * 8 + 1, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix16(i * 8 + 2, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix16(i * 8 + 3, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix16(i * 8 + 4, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix16(i * 8 + 5, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix16(i * 8 + 6, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix16(i * 8 + 7, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; + } + for ( j = 25; j < 50; j++ ) + { + bitmap.pix16(32 + i * 8 + 0, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix16(32 + i * 8 + 1, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix16(32 + i * 8 + 2, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix16(32 + i * 8 + 3, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix16(32 + i * 8 + 4, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix16(32 + i * 8 + 5, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix16(32 + i * 8 + 6, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix16(32 + i * 8 + 7, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; + } + ad += 0x40; + } + + return 0; +} + +/* This is called whenever the T0 pin switches state */ +WRITE_LINE_MEMBER(gamepock_state::gamepock_to_w) +{ + m_speaker->level_w(state & 1); +} diff --git a/src/mame/machine/gb.c b/src/mame/machine/gb.c new file mode 100644 index 00000000000..187cea04d72 --- /dev/null +++ b/src/mame/machine/gb.c @@ -0,0 +1,757 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + gb.c + + Machine file to handle emulation of the Nintendo Game Boy. + +Cardridge port pinouts: +Pin Name Description +1 VCC +5 VDC +2 PHI CPU clock ? +3 /WR Write +4 /RD Read +5 /CS SRAM select +6 A0 Address 0 +7 A1 Address 1 +8 A2 Address 2 +9 A3 Address 3 +10 A4 Address 4 +11 A5 Address 5 +12 A6 Address 6 +13 A7 Address 7 +14 A8 Address 8 +15 A9 Address 9 +16 A10 Address 10 +17 A11 Address 11 +18 A12 Address 12 +19 A13 Address 13 +20 A14 Address 14 +21 A15 Address 15 +22 D0 Data 0 +23 D1 Data 1 +24 D2 Data 2 +25 D3 Data 3 +26 D4 Data 4 +27 D5 Data 5 +28 D6 Data 6 +29 D7 Data 7 +30 /RST Reset +31 AUDIOIN Never used ? +32 GND Ground + + +TODO: +- YongYong mapper: + - During start there are 2 writes to 5000 and 5003, it is still unknown what these do. +- Story of La Sa Ma mapper: + - This should display the Gowin logo on boot on both DMG and CGB (Not implemented yet) +- ATV Racing/Rocket Games mapper: + - How did this overlay the official Nintendo logo at BIOS check time? (Some Sachen titles use a similar trick) + + + Changes: + + 13/2/2002 AK - MBC2 and MBC3 support and added NVRAM support. + 23/2/2002 AK - MBC5 support, and MBC2 RAM support. + 13/3/2002 AK - Tidied up the MBC code, window layer now has it's + own palette. Tidied init code. + 15/3/2002 AK - More init code tidying with a slight hack to stop + sound when the machine starts. + 19/3/2002 AK - Changed NVRAM code to the new battery_* functions. + 24/3/2002 AK - Added MBC1 mode switching, and partial MBC3 RTC support. + 28/3/2002 AK - Improved LCD status timing and interrupts. + Free memory when we shutdown instead of leaking. + 31/3/2002 AK - Handle IO memory reading so we return 0xFF for registers + that are unsupported. + 7/4/2002 AK - Free memory from battery load/save. General tidying. + 13/4/2002 AK - Ok, don't free memory when we shutdown as that causes + a crash on reset. + 28/4/2002 AK - General code tidying. + Fixed MBC3's RAM/RTC banking. + Added support for games with more than 128 ROM banks. + 12/6/2002 AK - Rewrote the way bg and sprite palettes are handled. + The window layer no longer has it's own palette. + Added Super Game Boy support. + 13/6/2002 AK - Added Game Boy Color support. + + 17/5/2004 WP - Added Megaduck/Cougar Boy support. + 13/6/2005 WP - Added support for bootstrap rom banking. + +***************************************************************************/ +#define __MACHINE_GB_C + +#include "emu.h" +#include "includes/gb.h" + + +/* RAM layout defines */ +#define CGB_START_VRAM_BANKS 0x0000 +#define CGB_START_RAM_BANKS ( 2 * 8 * 1024 ) + +#define JOYPAD m_gb_io[0x00] /* Joystick: 1.1.P15.P14.P13.P12.P11.P10 */ +#define SIODATA m_gb_io[0x01] /* Serial IO data buffer */ +#define SIOCONT m_gb_io[0x02] /* Serial IO control register */ +#define DIVREG m_gb_io[0x04] /* Divider register (???) */ +#define TIMECNT m_gb_io[0x05] /* Timer counter. Gen. int. when it overflows */ +#define TIMEMOD m_gb_io[0x06] /* New value of TimeCount after it overflows */ +#define TIMEFRQ m_gb_io[0x07] /* Timer frequency and start/stop switch */ + + + +/* + Prototypes +*/ + + +#ifdef MAME_DEBUG +/* #define V_GENERAL*/ /* Display general debug information */ +/* #define V_BANK*/ /* Display bank switching debug information */ +#endif + +//------------------------- +// handle save state +//------------------------- + +void gb_state::save_gb_base() +{ + save_item(NAME(m_gb_io)); + save_item(NAME(m_divcount)); + save_item(NAME(m_shift)); + save_item(NAME(m_shift_cycles)); + save_item(NAME(m_triggering_irq)); + save_item(NAME(m_reloading)); + save_item(NAME(m_sio_count)); + save_item(NAME(m_bios_disable)); + if (m_cartslot) + m_cartslot->save_ram(); +} + +void gb_state::save_gbc_only() +{ + save_item(NAME(m_gbc_rambank)); +} + +void gb_state::save_sgb_only() +{ + save_item(NAME(m_sgb_packets)); + save_item(NAME(m_sgb_bitcount)); + save_item(NAME(m_sgb_bytecount)); + save_item(NAME(m_sgb_start)); + save_item(NAME(m_sgb_rest)); + save_item(NAME(m_sgb_controller_no)); + save_item(NAME(m_sgb_controller_mode)); + save_item(NAME(m_sgb_data)); +} + + +void gb_state::gb_init_regs() +{ + /* Initialize the registers */ + SIODATA = 0x00; + SIOCONT = 0x7E; + + gb_io_w(m_maincpu->space(AS_PROGRAM), 0x05, 0x00); /* TIMECNT */ + gb_io_w(m_maincpu->space(AS_PROGRAM), 0x06, 0x00); /* TIMEMOD */ +} + + +void gb_state::gb_init() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + m_custom->sound_w(space, 0x16, 0x00); /* Initialize sound hardware */ + + m_divcount = 0; + m_triggering_irq = 0; + m_gb_io[0x07] = 0xF8; /* Upper bits of TIMEFRQ register are set to 1 */ +} + + +void gb_state::machine_start() +{ + /* Allocate the serial timer, and disable it */ + m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); + m_gb_serial_timer->enable( 0 ); + + save_gb_base(); +} + +MACHINE_START_MEMBER(gb_state,gbc) +{ + /* Allocate the serial timer, and disable it */ + m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); + m_gb_serial_timer->enable( 0 ); + + for (int i = 0; i < 8; i++) + m_gbc_rammap[i] = m_ram->pointer() + CGB_START_RAM_BANKS + i * 0x1000; + + save_gb_base(); + save_gbc_only(); +} + + +MACHINE_START_MEMBER(gb_state,sgb) +{ + m_sgb_packets = -1; + + /* Allocate the serial timer, and disable it */ + m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); + m_gb_serial_timer->enable( 0 ); + + save_gb_base(); + save_sgb_only(); + + if (m_cartslot && m_cartslot->get_sgb_hack()) { + dynamic_cast(m_lcd.target())->set_sgb_hack(TRUE); + } +} + +void gb_state::machine_reset() +{ + gb_init(); + + /* Enable BIOS rom */ + m_bios_disable = 0; + + m_divcount = 0x0004; +} + +MACHINE_RESET_MEMBER(gb_state,gbc) +{ + gb_init(); + + gb_init_regs(); + + /* Enable BIOS rom */ + m_bios_disable = 0; + + for (int i = 0; i < 8; i++) + memset(m_gbc_rammap[i], 0, 0x1000); +} + +MACHINE_RESET_MEMBER(gb_state,sgb) +{ + gb_init(); + + gb_init_regs(); + + /* Enable BIOS rom */ + m_bios_disable = 0; + + m_divcount = 0x0004; +} + + +WRITE8_MEMBER(gb_state::gb_io_w) +{ + static const UINT8 timer_shifts[4] = {10, 4, 6, 8}; + + switch (offset) + { + case 0x00: /* JOYP - Joypad */ + JOYPAD = 0xCF | data; + if (!(data & 0x20)) + JOYPAD &= (m_inputs->read() >> 4) | 0xF0; + if (!(data & 0x10)) + JOYPAD &= m_inputs->read() | 0xF0; + return; + case 0x01: /* SB - Serial transfer data */ + break; + case 0x02: /* SC - SIO control */ + switch( data & 0x81 ) + { + case 0x00: + case 0x01: + case 0x80: /* enabled & external clock */ + m_sio_count = 0; + break; + case 0x81: /* enabled & internal clock */ + SIODATA = 0xFF; + m_sio_count = 8; + m_gb_serial_timer->adjust(m_maincpu->cycles_to_attotime(512), 0, m_maincpu->cycles_to_attotime(512)); + m_gb_serial_timer->enable( 1 ); + break; + } + break; + case 0x04: /* DIV - Divider register */ + /* Force increment of TIMECNT register */ + if ( m_divcount >= 16 ) + gb_timer_increment(); + m_divcount = 0; + return; + case 0x05: /* TIMA - Timer counter */ + /* Check if the counter is being reloaded in this cycle */ + if ( m_reloading && ( m_divcount & ( m_shift_cycles - 1 ) ) == 4 ) + { + data = TIMECNT; + } + break; + case 0x06: /* TMA - Timer module */ + /* Check if the counter is being reloaded in this cycle */ + if ( m_reloading && ( m_divcount & ( m_shift_cycles - 1 ) ) == 4 ) + { + TIMECNT = data; + } + break; + case 0x07: /* TAC - Timer control */ + data |= 0xF8; + /* Check if timer is just disabled or the timer frequency is changing */ + if ( ( ! ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) ) || ( ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) && ( data & 0x03 ) != ( TIMEFRQ & 0x03 ) ) ) + { + /* Check if TIMECNT should be incremented */ + if ( ( m_divcount & ( m_shift_cycles - 1 ) ) >= ( m_shift_cycles >> 1 ) ) + { + gb_timer_increment(); + } + } + m_shift = timer_shifts[data & 0x03]; + m_shift_cycles = 1 << m_shift; + break; + case 0x0F: /* IF - Interrupt flag */ + data &= 0x1F; + m_maincpu->set_if( data ); + break; + } + + m_gb_io[offset] = data; +} + +WRITE8_MEMBER(gb_state::gb_io2_w) +{ + if (offset == 0x10) + { + /* disable BIOS ROM */ + m_bios_disable = 1; + //printf("here again?\n"); + } + else + m_lcd->video_w(space, offset, data); +} + +#ifdef MAME_DEBUG +static const char *const sgbcmds[32] = +{ + "PAL01 ", + "PAL23 ", + "PAL03 ", + "PAL12 ", + "ATTR_BLK", + "ATTR_LIN", + "ATTR_DIV", + "ATTR_CHR", + "SOUND ", + "SOU_TRN ", + "PAL_SET ", + "PAL_TRN ", + "ATRC_EN ", + "TEST_EN ", + "ICON_EN ", + "DATA_SND", + "DATA_TRN", + "MLT_REG ", + "JUMP ", + "CHR_TRN ", + "PCT_TRN ", + "ATTR_TRN", + "ATTR_SET", + "MASK_EN ", + "OBJ_TRN ", + "????????", + "????????", + "????????", + "????????", + "????????", + "????????", + "????????" +}; +#endif + +WRITE8_MEMBER(gb_state::sgb_io_w) +{ + UINT8 *sgb_data = m_sgb_data; + + switch( offset ) + { + case 0x00: + switch (data & 0x30) + { + case 0x00: /* start condition */ + if (m_sgb_start) + logerror("SGB: Start condition before end of transfer ??\n"); + m_sgb_bitcount = 0; + m_sgb_start = 1; + m_sgb_rest = 0; + JOYPAD = 0x0F & ((m_inputs->read() >> 4) | m_inputs->read() | 0xF0); + break; + case 0x10: /* data true */ + if (m_sgb_rest) + { + /* We should test for this case , but the code below won't + work with the current setup */ +#if 0 + if (m_sgb_bytecount == 16) + { + logerror("SGB: end of block is not zero!"); + m_sgb_start = 0; + } +#endif + sgb_data[m_sgb_bytecount] >>= 1; + sgb_data[m_sgb_bytecount] |= 0x80; + m_sgb_bitcount++; + if (m_sgb_bitcount == 8) + { + m_sgb_bitcount = 0; + m_sgb_bytecount++; + } + m_sgb_rest = 0; + } + JOYPAD = 0x1F & ((m_inputs->read() >> 4) | 0xF0); + break; + case 0x20: /* data false */ + if (m_sgb_rest) + { + if( m_sgb_bytecount == 16 && m_sgb_packets == -1 ) + { +#ifdef MAME_DEBUG + logerror("SGB: %s (%02X) pkts: %d data: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", + sgbcmds[sgb_data[0] >> 3],sgb_data[0] >> 3, sgb_data[0] & 0x07, sgb_data[1], sgb_data[2], sgb_data[3], + sgb_data[4], sgb_data[5], sgb_data[6], sgb_data[7], + sgb_data[8], sgb_data[9], sgb_data[10], sgb_data[11], + sgb_data[12], sgb_data[13], sgb_data[14], sgb_data[15]); +#endif + m_sgb_packets = sgb_data[0] & 0x07; + m_sgb_start = 0; + } + if (m_sgb_bytecount == (m_sgb_packets << 4)) + { + switch (sgb_data[0] >> 3) + { + case 0x11: /* MLT_REQ - Multi controller request */ + if (sgb_data[1] == 0x00) + m_sgb_controller_mode = 0; + else if (sgb_data[1] == 0x01) + m_sgb_controller_mode = 2; + break; + default: + dynamic_cast(m_lcd.target())->sgb_io_write_pal(sgb_data[0] >> 3, &sgb_data[0]); + break; + } + m_sgb_start = 0; + m_sgb_bytecount = 0; + m_sgb_packets = -1; + } + if( m_sgb_start ) + { + sgb_data[m_sgb_bytecount] >>= 1; + m_sgb_bitcount++; + if (m_sgb_bitcount == 8) + { + m_sgb_bitcount = 0; + m_sgb_bytecount++; + } + } + m_sgb_rest = 0; + } + JOYPAD = 0x2F & (m_inputs->read() | 0xF0); + break; + case 0x30: /* rest condition */ + if (m_sgb_start) + m_sgb_rest = 1; + if (m_sgb_controller_mode) + { + m_sgb_controller_no++; + if (m_sgb_controller_no == m_sgb_controller_mode) + m_sgb_controller_no = 0; + JOYPAD = 0x3F - m_sgb_controller_no; + } + else + JOYPAD = 0x3F; + + /* Hack to let cartridge know it's running on an SGB */ + if ( (sgb_data[0] >> 3) == 0x1F ) + JOYPAD = 0x3E; + break; + } + return; + default: + /* we didn't handle the write, so pass it to the GB handler */ + gb_io_w( space, offset, data ); + return; + } + + m_gb_io[offset] = data; +} + +/* Interrupt Enable register */ +READ8_MEMBER(gb_state::gb_ie_r) +{ + return m_maincpu->get_ie(); +} + +WRITE8_MEMBER(gb_state::gb_ie_w) +{ + m_maincpu->set_ie( data & 0x1F ); +} + +/* IO read */ +READ8_MEMBER(gb_state::gb_io_r) +{ + switch(offset) + { + case 0x04: + return ( m_divcount >> 8 ) & 0xFF; + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x05: + case 0x06: + case 0x07: + return m_gb_io[offset]; + case 0x0F: + /* Make sure the internal states are up to date */ + return 0xE0 | m_maincpu->get_if(); + default: + /* It seems unsupported registers return 0xFF */ + return 0xFF; + } +} + + +TIMER_CALLBACK_MEMBER(gb_state::gb_serial_timer_proc) +{ + /* Shift in a received bit */ + SIODATA = (SIODATA << 1) | 0x01; + /* Decrement number of handled bits */ + m_sio_count--; + /* If all bits done, stop timer and trigger interrupt */ + if ( ! m_sio_count ) + { + SIOCONT &= 0x7F; + m_gb_serial_timer->enable( 0 ); + m_maincpu->set_input_line(SIO_INT, ASSERT_LINE); + } +} + +void gb_state::gb_timer_check_irq() +{ + m_reloading = 0; + if ( m_triggering_irq ) + { + m_triggering_irq = 0; + if ( TIMECNT == 0 ) + { + TIMECNT = TIMEMOD; + m_maincpu->set_input_line(TIM_INT, ASSERT_LINE); + m_reloading = 1; + } + } +} + +void gb_state::gb_timer_increment() +{ + gb_timer_check_irq(); + + TIMECNT += 1; + if ( TIMECNT == 0 ) + { + m_triggering_irq = 1; + } +} + +WRITE8_MEMBER( gb_state::gb_timer_callback ) +{ + UINT16 old_gb_divcount = m_divcount; + m_divcount += data; + + gb_timer_check_irq(); + + if ( TIMEFRQ & 0x04 ) + { + UINT16 old_count = old_gb_divcount >> m_shift; + UINT16 new_count = m_divcount >> m_shift; + if ( data > m_shift_cycles ) + { + gb_timer_increment(); + old_count++; + } + if ( new_count != old_count ) + { + gb_timer_increment(); + } + if ( new_count << m_shift < m_divcount ) + { + gb_timer_check_irq(); + } + } +} + +WRITE8_MEMBER(gb_state::gbc_io2_w) +{ + switch( offset ) + { + case 0x0D: /* KEY1 - Prepare speed switch */ + m_maincpu->set_speed(data); + return; + case 0x10: /* BFF - Bios disable */ + m_bios_disable = 1; + return; + case 0x16: /* RP - Infrared port */ + break; + case 0x30: /* SVBK - RAM bank select */ + m_gbc_rambank = data & 0x7; + if (!m_gbc_rambank) + m_gbc_rambank = 1; + m_rambank->set_base(m_gbc_rammap[m_gbc_rambank]); + break; + default: + break; + } + m_lcd->video_w(space, offset, data); +} + +READ8_MEMBER(gb_state::gbc_io2_r) +{ + switch( offset ) + { + case 0x0D: /* KEY1 */ + return m_maincpu->get_speed(); + case 0x16: /* RP - Infrared port */ + break; + case 0x30: /* SVBK - RAM bank select */ + return m_gbc_rambank; + default: + break; + } + return m_lcd->video_r(space, offset); +} + +/**************************************************************************** + + Megaduck routines + + ****************************************************************************/ + +MACHINE_START_MEMBER(megaduck_state,megaduck) +{ + /* Allocate the serial timer, and disable it */ + m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); + m_gb_serial_timer->enable( 0 ); + + save_gb_base(); +} + +MACHINE_RESET_MEMBER(megaduck_state,megaduck) +{ + /* We may have to add some more stuff here, if not then it can be merged back into gb */ + gb_init(); + + m_bios_disable = 1; +} + +/* + Map megaduck video related area on to regular Game Boy video area + + Different locations of the video registers: + Register Game Boy MegaDuck + LCDC FF40 FF10 (See different bit order below) + STAT FF41 FF11 + SCY FF42 FF12 + SCX FF43 FF13 + LY FF44 FF18 + LYC FF45 FF19 + DMA FF46 FF1A + BGP FF47 FF1B + OBP0 FF48 FF14 + OBP1 FF49 FF15 + WY FF4A FF16 + WX FF4B FF17 + Unused FF4C FF4C (?) + Unused FF4D FF4D (?) + Unused FF4E FF4E (?) + Unused FF4F FF4F (?) + + Different LCDC register + + Game Boy MegaDuck + 0 6 - BG & Window Display : 0 - Off, 1 - On + 1 0 - OBJ Display: 0 - Off, 1 - On + 2 1 - OBJ Size: 0 - 8x8, 1 - 8x16 + 3 2 - BG Tile Map Display: 0 - 9800, 1 - 9C00 + 4 4 - BG & Window Tile Data Select: 0 - 8800, 1 - 8000 + 5 5 - Window Display: 0 - Off, 1 - On + 6 3 - Window Tile Map Display Select: 0 - 9800, 1 - 9C00 + 7 7 - LCD Operation + + **************/ + +READ8_MEMBER(megaduck_state::megaduck_video_r) +{ + UINT8 data; + + if ((offset & 0x0C) && ((offset & 0x0C) ^ 0x0C)) + { + offset ^= 0x0C; + } + data = m_lcd->video_r(space, offset); + if ( offset ) + return data; + return BITSWAP8(data,7,0,5,4,6,3,2,1); +} + +WRITE8_MEMBER(megaduck_state::megaduck_video_w) +{ + if (!offset) + { + data = BITSWAP8(data,7,3,5,4,2,1,0,6); + } + if ((offset & 0x0C) && ((offset & 0x0C) ^ 0x0C)) + { + offset ^= 0x0C; + } + m_lcd->video_w(space, offset, data); +} + +/* Map megaduck audio offset to game boy audio offsets */ + +static const UINT8 megaduck_sound_offsets[16] = { 0, 2, 1, 3, 4, 6, 5, 7, 8, 9, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; + +WRITE8_MEMBER(megaduck_state::megaduck_sound_w1) +{ + m_custom->sound_w(space, megaduck_sound_offsets[offset], data); +} + +READ8_MEMBER(megaduck_state::megaduck_sound_r1) +{ + return m_custom->sound_r(space, megaduck_sound_offsets[offset]); +} + +WRITE8_MEMBER(megaduck_state::megaduck_sound_w2) +{ + switch(offset) + { + case 0x00: m_custom->sound_w(space, 0x10, data); break; + case 0x01: m_custom->sound_w(space, 0x12, data); break; + case 0x02: m_custom->sound_w(space, 0x11, data); break; + case 0x03: m_custom->sound_w(space, 0x13, data); break; + case 0x04: m_custom->sound_w(space, 0x14, data); break; + case 0x05: m_custom->sound_w(space, 0x16, data); break; + case 0x06: m_custom->sound_w(space, 0x15, data); break; + case 0x07: + case 0x08: + case 0x09: + case 0x0A: + case 0x0B: + case 0x0C: + case 0x0D: + case 0x0E: + case 0x0F: + break; + } +} + +READ8_MEMBER(megaduck_state::megaduck_sound_r2) +{ + return m_custom->sound_r(space, 0x10 + megaduck_sound_offsets[offset]); +} diff --git a/src/mame/machine/genpc.c b/src/mame/machine/genpc.c new file mode 100644 index 00000000000..44dbcd00d20 --- /dev/null +++ b/src/mame/machine/genpc.c @@ -0,0 +1,954 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Miodrag Milanovic +/*************************************************************************** + + machine/genpc.c + + +***************************************************************************/ + +#include "emu.h" +#include "includes/genpc.h" + +#include "machine/i8255.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "sound/speaker.h" +#include "machine/ram.h" +#include "imagedev/cassette.h" + +#define VERBOSE_PIO 0 /* PIO (keyboard controller) */ + +#define PIO_LOG(N,M,A) \ + do { \ + if(VERBOSE_PIO>=N) \ + { \ + if( M ) \ + logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + + +/************************************************************************* + * + * PC DMA stuff + * + *************************************************************************/ + +READ8_MEMBER( ibm5160_mb_device::pc_page_r) +{ + return 0xff; +} + + +WRITE8_MEMBER( ibm5160_mb_device::pc_page_w) +{ + switch(offset % 4) + { + case 1: + m_dma_offset[2] = data; + break; + case 2: + m_dma_offset[3] = data; + break; + case 3: + m_dma_offset[0] = m_dma_offset[1] = data; + break; + } +} + + +WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dma_hrq_changed ) +{ + m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); + + /* Assert HLDA */ + m_dma8237->hack_w(state); +} + + +READ8_MEMBER( ibm5160_mb_device::pc_dma_read_byte ) +{ + if(m_dma_channel == -1) + return 0xff; + address_space &spaceio = m_maincpu->space(AS_PROGRAM); + offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0x0F0000; + return spaceio.read_byte( page_offset + offset); +} + + +WRITE8_MEMBER( ibm5160_mb_device::pc_dma_write_byte ) +{ + if(m_dma_channel == -1) + return; + address_space &spaceio = m_maincpu->space(AS_PROGRAM); + offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0x0F0000; + + spaceio.write_byte( page_offset + offset, data); +} + + +READ8_MEMBER( ibm5160_mb_device::pc_dma8237_1_dack_r ) +{ + return m_isabus->dack_r(1); +} + +READ8_MEMBER( ibm5160_mb_device::pc_dma8237_2_dack_r ) +{ + return m_isabus->dack_r(2); +} + + +READ8_MEMBER( ibm5160_mb_device::pc_dma8237_3_dack_r ) +{ + return m_isabus->dack_r(3); +} + + +WRITE8_MEMBER( ibm5160_mb_device::pc_dma8237_1_dack_w ) +{ + m_isabus->dack_w(1,data); +} + +WRITE8_MEMBER( ibm5160_mb_device::pc_dma8237_2_dack_w ) +{ + m_isabus->dack_w(2,data); +} + + +WRITE8_MEMBER( ibm5160_mb_device::pc_dma8237_3_dack_w ) +{ + m_isabus->dack_w(3,data); +} + + +WRITE8_MEMBER( ibm5160_mb_device::pc_dma8237_0_dack_w ) +{ + m_u73_q2 = 0; + m_dma8237->dreq0_w( m_u73_q2 ); +} + + +WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dma8237_out_eop ) +{ + m_cur_eop = state == ASSERT_LINE; + if(m_dma_channel != -1 && m_cur_eop) + m_isabus->eop_w(m_dma_channel, m_cur_eop ? ASSERT_LINE : CLEAR_LINE ); +} + +void ibm5160_mb_device::pc_select_dma_channel(int channel, bool state) +{ + if(!state) { + m_dma_channel = channel; + if(m_cur_eop) + m_isabus->eop_w(channel, ASSERT_LINE ); + + } else if(m_dma_channel == channel) { + m_dma_channel = -1; + if(m_cur_eop) + m_isabus->eop_w(channel, CLEAR_LINE ); + } +} + +WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dack0_w ) { pc_select_dma_channel(0, state); } +WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dack1_w ) { pc_select_dma_channel(1, state); } +WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dack2_w ) { pc_select_dma_channel(2, state); } +WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dack3_w ) { pc_select_dma_channel(3, state); } + +/************************************************************* + * + * pic8259 configuration + * + *************************************************************/ + +WRITE_LINE_MEMBER(ibm5160_mb_device::pc_speaker_set_spkrdata) +{ + m_pc_spkrdata = state ? 1 : 0; + m_speaker->level_w(m_pc_spkrdata & m_pit_out2); +} + + +/************************************************************* + * + * pit8253 configuration + * + *************************************************************/ + +WRITE_LINE_MEMBER( ibm5160_mb_device::pc_pit8253_out1_changed ) +{ + /* Trigger DMA channel #0 */ + if ( m_out1 == 0 && state == 1 && m_u73_q2 == 0 ) + { + m_u73_q2 = 1; + m_dma8237->dreq0_w( m_u73_q2 ); + } + m_out1 = state; +} + + +WRITE_LINE_MEMBER( ibm5160_mb_device::pc_pit8253_out2_changed ) +{ + m_pit_out2 = state ? 1 : 0; + m_speaker->level_w(m_pc_spkrdata & m_pit_out2); +} + + +/********************************************************** + * + * PPI8255 interface + * + * + * PORT A (input) + * + * Directly attached to shift register which stores data + * received from the keyboard. + * + * PORT B (output) + * 0 - PB0 - TIM2GATESPK - Enable/disable counting on timer 2 of the 8253 + * 1 - PB1 - SPKRDATA - Speaker data + * 2 - PB2 - - Enable receiving data from the keyboard when keyboard is not locked. + * 3 - PB3 - - Dipsswitch set selector + * 4 - PB4 - ENBRAMPCK - Enable ram parity check + * 5 - PB5 - ENABLEI/OCK - Enable expansion I/O check + * 6 - PB6 - - Connected to keyboard clock signal + * 0 = ignore keyboard signals + * 1 = accept keyboard signals + * 7 - PB7 - - Clear/disable shift register and IRQ1 line + * 0 = normal operation + * 1 = clear and disable shift register and clear IRQ1 flip flop + * + * PORT C + * 0 - PC0 - - Dipswitch 0/4 SW1 + * 1 - PC1 - - Dipswitch 1/5 SW1 + * 2 - PC2 - - Dipswitch 2/6 SW1 + * 3 - PC3 - - Dipswitch 3/7 SW1 + * 4 - PC4 - SPK - Speaker/cassette data + * 5 - PC5 - I/OCHCK - Expansion I/O check result + * 6 - PC6 - T/C2OUT - Output of 8253 timer 2 + * 7 - PC7 - PCK - Parity check result + * + * IBM5150 SW1: + * 0 - OFF - One or more floppy drives + * ON - Diskless operation + * 1 - OFF - 8087 present + * ON - No 8087 present + * 2+3 - Used to determine on board memory configuration + * OFF OFF - 64KB + * ON OFF - 48KB + * OFF ON - 32KB + * ON ON - 16KB + * 4+5 - Used to select display + * OFF OFF - Monochrome + * ON OFF - CGA, 80 column + * OFF ON - CGA, 40 column + * ON ON - EGA/VGA display + * 6+7 - Used to select number of disk drives + * OFF OFF - four disk drives + * ON OFF - three disk drives + * OFF ON - two disk drives + * ON ON - one disk drive + * + **********************************************************/ +WRITE_LINE_MEMBER( ibm5150_mb_device::keyboard_clock_w ) +{ + if (!m_ppi_keyboard_clear && !state && !m_ppi_shift_enable) + { + m_ppi_shift_enable = m_ppi_shift_register & 0x01; + + m_ppi_shift_register >>= 1; + m_ppi_shift_register |= m_ppi_data_signal << 7; + + m_pic8259->ir1_w(m_ppi_shift_enable); + m_pc_kbdc->data_write_from_mb(!m_ppi_shift_enable); + } +} + +WRITE_LINE_MEMBER( ec1841_mb_device::keyboard_clock_w ) +{ + if (!m_ppi_keyboard_clear && !state && !m_ppi_shift_enable) + { + m_ppi_shift_enable = m_ppi_shift_register & 0x01; + + m_ppi_shift_register >>= 1; + m_ppi_shift_register |= m_ppi_data_signal << 7; + + m_pic8259->ir1_w(m_ppi_shift_enable); + m_pc_kbdc->data_write_from_mb(!m_ppi_shift_enable); + } +} + +WRITE_LINE_MEMBER( ibm5160_mb_device::keyboard_clock_w ) +{ + if (!m_ppi_keyboard_clear && !state && !m_ppi_shift_enable) + { + m_ppi_shift_enable = m_ppi_shift_register & 0x01; + + m_ppi_shift_register >>= 1; + m_ppi_shift_register |= m_ppi_data_signal << 7; + + m_pic8259->ir1_w(m_ppi_shift_enable); + m_pc_kbdc->data_write_from_mb(!BIT(m_ppi_portb, 2) && !m_ppi_shift_enable); + } +} + + +WRITE_LINE_MEMBER( ibm5160_mb_device::keyboard_data_w ) +{ + m_ppi_data_signal = state; +} + +READ8_MEMBER (ibm5160_mb_device::pc_ppi_porta_r) +{ + int data = 0xFF; + /* KB port A */ + if (m_ppi_keyboard_clear) + { + /* 0 0 - no floppy drives + * 1 Not used + * 2-3 The number of memory banks on the system board + * 4-5 Display mode + * 11 = monochrome + * 10 - color 80x25 + * 01 - color 40x25 + * 6-7 The number of floppy disk drives + */ + data = ioport("DSW0")->read(); + } + else + { + data = m_ppi_shift_register; + } + PIO_LOG(1,"PIO_A_r",("$%02x\n", data)); + return data; +} + + +READ8_MEMBER ( ibm5160_mb_device::pc_ppi_portc_r ) +{ + int data=0xff; + + data&=~0x80; // no parity error + data&=~0x40; // no error on expansion board + /* KB port C: equipment flags */ + if (m_ppi_portc_switch_high) + { + /* read hi nibble of S2 */ + data = (data & 0xf0) | ((ioport("DSW0")->read() >> 4) & 0x0f); + PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data)); + } + else + { + /* read lo nibble of S2 */ + data = (data & 0xf0) | (ioport("DSW0")->read() & 0x0f); + PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data)); + } + + if ( m_ppi_portb & 0x01 ) + { + data = ( data & ~0x10 ) | ( m_pit_out2 ? 0x10 : 0x00 ); + } + data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); + + return data; +} + + +WRITE8_MEMBER( ibm5160_mb_device::pc_ppi_portb_w ) +{ + /* PPI controller port B*/ + m_ppi_portb = data; + m_ppi_portc_switch_high = data & 0x08; + m_ppi_keyboard_clear = data & 0x80; + m_ppi_keyb_clock = data & 0x40; + m_pit8253->write_gate2(BIT(data, 0)); + pc_speaker_set_spkrdata( data & 0x02 ); + + /* If PB7 is set clear the shift register and reset the IRQ line */ + if ( m_ppi_keyboard_clear ) + { + m_ppi_shift_register = 0; + m_ppi_shift_enable = 0; + m_pic8259->ir1_w(m_ppi_shift_enable); + } + + m_pc_kbdc->data_write_from_mb(!BIT(m_ppi_portb, 2) && !m_ppi_shift_enable); + m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; + m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); +} + + +/********************************************************** + * + * NMI handling + * + **********************************************************/ + +WRITE8_MEMBER( ibm5160_mb_device::nmi_enable_w ) +{ + m_nmi_enabled = BIT(data,7); + m_isabus->set_nmi_state(m_nmi_enabled); +} +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type IBM5160_MOTHERBOARD = &device_creator; + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +static MACHINE_CONFIG_FRAGMENT( ibm5160_mb_config ) + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_14_31818MHz/12) /* heartbeat IRQ */ + MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) + MCFG_PIT8253_CLK1(XTAL_14_31818MHz/12) /* dram refresh */ + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(ibm5160_mb_device, pc_pit8253_out1_changed)) + MCFG_PIT8253_CLK2(XTAL_14_31818MHz/12) /* pio port c pin 4, and speaker polling enough */ + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(ibm5160_mb_device, pc_pit8253_out2_changed)) + + MCFG_DEVICE_ADD( "dma8237", AM9517A, XTAL_14_31818MHz/3 ) + MCFG_I8237_OUT_HREQ_CB(WRITELINE(ibm5160_mb_device, pc_dma_hrq_changed)) + MCFG_I8237_OUT_EOP_CB(WRITELINE(ibm5160_mb_device, pc_dma8237_out_eop)) + MCFG_I8237_IN_MEMR_CB(READ8(ibm5160_mb_device, pc_dma_read_byte)) + MCFG_I8237_OUT_MEMW_CB(WRITE8(ibm5160_mb_device, pc_dma_write_byte)) + MCFG_I8237_IN_IOR_1_CB(READ8(ibm5160_mb_device, pc_dma8237_1_dack_r)) + MCFG_I8237_IN_IOR_2_CB(READ8(ibm5160_mb_device, pc_dma8237_2_dack_r)) + MCFG_I8237_IN_IOR_3_CB(READ8(ibm5160_mb_device, pc_dma8237_3_dack_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(ibm5160_mb_device, pc_dma8237_0_dack_w)) + MCFG_I8237_OUT_IOW_1_CB(WRITE8(ibm5160_mb_device, pc_dma8237_1_dack_w)) + MCFG_I8237_OUT_IOW_2_CB(WRITE8(ibm5160_mb_device, pc_dma8237_2_dack_w)) + MCFG_I8237_OUT_IOW_3_CB(WRITE8(ibm5160_mb_device, pc_dma8237_3_dack_w)) + MCFG_I8237_OUT_DACK_0_CB(WRITELINE(ibm5160_mb_device, pc_dack0_w)) + MCFG_I8237_OUT_DACK_1_CB(WRITELINE(ibm5160_mb_device, pc_dack1_w)) + MCFG_I8237_OUT_DACK_2_CB(WRITELINE(ibm5160_mb_device, pc_dack2_w)) + MCFG_I8237_OUT_DACK_3_CB(WRITELINE(ibm5160_mb_device, pc_dack3_w)) + + MCFG_PIC8259_ADD( "pic8259", INPUTLINE(":maincpu", 0), VCC, NULL ) + + MCFG_DEVICE_ADD("ppi8255", I8255A, 0) + MCFG_I8255_IN_PORTA_CB(READ8(ibm5160_mb_device, pc_ppi_porta_r)) + MCFG_I8255_OUT_PORTB_CB(WRITE8(ibm5160_mb_device, pc_ppi_portb_w)) + MCFG_I8255_IN_PORTC_CB(READ8(ibm5160_mb_device, pc_ppi_portc_r)) + + MCFG_DEVICE_ADD("isa", ISA8, 0) + MCFG_ISA8_CPU(":maincpu") + MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) + MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("pic8259", pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("pic8259", pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) + MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("dma8237", am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("dma8237", am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("dma8237", am9517a_device, dreq3_w)) + + MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0) + MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(ibm5160_mb_device, keyboard_clock_w)) + MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE(ibm5160_mb_device, keyboard_data_w)) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor ibm5160_mb_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( ibm5160_mb_config ); +} + + +static INPUT_PORTS_START( ibm5160_mb ) + PORT_START("DSW0") /* IN1 */ + PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives") + PORT_DIPSETTING( 0x00, "1" ) + PORT_DIPSETTING( 0x40, "2" ) + PORT_DIPSETTING( 0x80, "3" ) + PORT_DIPSETTING( 0xc0, "4" ) + PORT_DIPNAME( 0x30, 0x30, "Graphics adapter") + PORT_DIPSETTING( 0x00, "EGA/VGA" ) + PORT_DIPSETTING( 0x10, "Color 40x25" ) + PORT_DIPSETTING( 0x20, "Color 80x25" ) + PORT_DIPSETTING( 0x30, "Monochrome" ) + PORT_DIPNAME( 0x0c, 0x0c, "RAM banks") + PORT_DIPSETTING( 0x00, "1 - 16/ 64/256K" ) + PORT_DIPSETTING( 0x04, "2 - 32/128/512K" ) + PORT_DIPSETTING( 0x08, "3 - 48/192/576K" ) + PORT_DIPSETTING( 0x0c, "4 - 64/256/640K" ) + PORT_DIPNAME( 0x02, 0x00, "8087 installed") + PORT_DIPSETTING( 0x00, DEF_STR(No) ) + PORT_DIPSETTING( 0x02, DEF_STR(Yes) ) + PORT_DIPNAME( 0x01, 0x01, "Boot from floppy") + PORT_DIPSETTING( 0x01, DEF_STR(Yes) ) + PORT_DIPSETTING( 0x00, DEF_STR(No) ) +INPUT_PORTS_END +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor ibm5160_mb_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( ibm5160_mb ); +} + + +void ibm5160_mb_device::static_set_cputag(device_t &device, const char *tag) +{ + ibm5160_mb_device &board = downcast(device); + board.m_cputag = tag; +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// ibm5160_mb_device - constructor +//------------------------------------------------- + +ibm5160_mb_device::ibm5160_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, IBM5160_MOTHERBOARD, "IBM5160_MOTHERBOARD", tag, owner, clock, "ibm5160_mb", __FILE__), + m_maincpu(*owner, "maincpu"), + m_pic8259(*this, "pic8259"), + m_dma8237(*this, "dma8237"), + m_pit8253(*this, "pit8253"), + m_ppi8255(*this, "ppi8255"), + m_speaker(*this, "speaker"), + m_isabus(*this, "isa"), + m_pc_kbdc(*this, "pc_kbdc"), + m_ram(*this, ":" RAM_TAG) +{ +} + +void ibm5160_mb_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) +{ + int buswidth = m_maincpu->space_config(AS_IO)->m_databus_width; + switch(buswidth) + { + case 8: + if(!rhandler.isnull()) m_maincpu->space(AS_IO).install_read_handler(start, end, mask, mirror, rhandler, 0); + if(!whandler.isnull()) m_maincpu->space(AS_IO).install_write_handler(start, end, mask, mirror, whandler, 0); + break; + case 16: + if(!rhandler.isnull()) m_maincpu->space(AS_IO).install_read_handler(start, end, mask, mirror, rhandler, 0xffff); + if(!whandler.isnull()) m_maincpu->space(AS_IO).install_write_handler(start, end, mask, mirror, whandler, 0xffff); + break; + default: + fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth); + } +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ibm5160_mb_device::device_start() +{ + install_device(0x0000, 0x000f, 0, 0, read8_delegate(FUNC(am9517a_device::read), (am9517a_device*)m_dma8237), write8_delegate(FUNC(am9517a_device::write), (am9517a_device*)m_dma8237) ); + install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) ); + install_device(0x0040, 0x0043, 0, 0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit8253), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit8253) ); + install_device(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255) ); + install_device(0x0080, 0x0087, 0, 0, read8_delegate(FUNC(ibm5160_mb_device::pc_page_r), this), write8_delegate(FUNC(ibm5160_mb_device::pc_page_w),this) ); + install_device(0x00a0, 0x00a1, 0, 0, read8_delegate(), write8_delegate(FUNC(ibm5160_mb_device::nmi_enable_w),this)); + /* MESS managed RAM */ + if ( m_ram->pointer() ) + membank( "bank10" )->set_base( m_ram->pointer() ); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ibm5160_mb_device::device_reset() +{ + m_u73_q2 = 0; + m_out1 = 2; // initial state of pit output is undefined + m_pc_spkrdata = 0; + m_pit_out2 = 1; + m_dma_channel = -1; + m_cur_eop = false; + memset(m_dma_offset,0,sizeof(m_dma_offset)); + m_ppi_portc_switch_high = 0; + m_ppi_speaker = 0; + m_ppi_keyboard_clear = 0; + m_ppi_keyb_clock = 0; + m_ppi_portb = 0; + m_ppi_clock_signal = 0; + m_ppi_data_signal = 0; + m_ppi_shift_register = 0; + m_ppi_shift_enable = 0; + m_nmi_enabled = 0; + m_speaker->level_w(0); +} + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type IBM5150_MOTHERBOARD = &device_creator; + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** +static MACHINE_CONFIG_FRAGMENT( ibm5150_mb_config ) + MCFG_FRAGMENT_ADD(ibm5160_mb_config) + + MCFG_DEVICE_MODIFY("pc_kbdc") + MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(ibm5150_mb_device, keyboard_clock_w)) + + MCFG_CASSETTE_ADD( "cassette" ) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor ibm5150_mb_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( ibm5150_mb_config ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// ibm5150_mb_device - constructor +//------------------------------------------------- + +ibm5150_mb_device::ibm5150_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ibm5160_mb_device(mconfig, tag, owner, clock), + m_cassette(*this, "cassette") +{ +} + +void ibm5150_mb_device::device_start() +{ + ibm5160_mb_device::device_start(); +} +void ibm5150_mb_device::device_reset() +{ + ibm5160_mb_device::device_reset(); +} + +READ8_MEMBER (ibm5150_mb_device::pc_ppi_porta_r) +{ + int data = 0xFF; + /* KB port A */ + if (m_ppi_keyboard_clear) + { + /* 0 0 - no floppy drives + * 1 Not used + * 2-3 The number of memory banks on the system board + * 4-5 Display mode + * 11 = monochrome + * 10 - color 80x25 + * 01 - color 40x25 + * 6-7 The number of floppy disk drives + */ + data = ioport("DSW0")->read() & 0xF3; + switch ( m_ram->size() ) + { + case 16 * 1024: + data |= 0x00; + break; + case 32 * 1024: /* Need to verify if this is correct */ + data |= 0x04; + break; + case 48 * 1024: /* Need to verify if this is correct */ + data |= 0x08; + break; + default: + data |= 0x0C; + break; + } + } + else + { + data = m_ppi_shift_register; + } + PIO_LOG(1,"PIO_A_r",("$%02x\n", data)); + return data; +} + + +READ8_MEMBER ( ibm5150_mb_device::pc_ppi_portc_r ) +{ + int data=0xff; + + data&=~0x80; // no parity error + data&=~0x40; // no error on expansion board + /* KB port C: equipment flags */ + if (m_ppi_portc_switch_high) + { + /* read hi nibble of SW2 */ + data = data & 0xf0; + + switch ( m_ram->size() - 64 * 1024 ) + { + case 64 * 1024: data |= 0x00; break; + case 128 * 1024: data |= 0x02; break; + case 192 * 1024: data |= 0x04; break; + case 256 * 1024: data |= 0x06; break; + case 320 * 1024: data |= 0x08; break; + case 384 * 1024: data |= 0x0A; break; + case 448 * 1024: data |= 0x0C; break; + case 512 * 1024: data |= 0x0E; break; + case 576 * 1024: data |= 0x01; break; + case 640 * 1024: data |= 0x03; break; + case 704 * 1024: data |= 0x05; break; + case 768 * 1024: data |= 0x07; break; + case 832 * 1024: data |= 0x09; break; + case 896 * 1024: data |= 0x0B; break; + case 960 * 1024: data |= 0x0D; break; + } + if ( m_ram->size() > 960 * 1024 ) + data |= 0x0D; + + PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data)); + } + else + { + /* read lo nibble of S2 */ + data = (data & 0xf0) | (ioport("DSW0")->read() & 0x0f); + PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data)); + } + + if ( ! ( m_ppi_portb & 0x08 ) ) + { + double tap_val = m_cassette->input(); + + if ( tap_val < 0 ) + { + data &= ~0x10; + } + else + { + data |= 0x10; + } + } + else + { + if ( m_ppi_portb & 0x01 ) + { + data = ( data & ~0x10 ) | ( m_pit_out2 ? 0x10 : 0x00 ); + } + } + data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); + + return data; +} + + +WRITE8_MEMBER( ibm5150_mb_device::pc_ppi_portb_w ) +{ + /* KB controller port B */ + m_ppi_portb = data; + m_ppi_portc_switch_high = data & 0x08; + m_ppi_keyboard_clear = data & 0x80; + m_ppi_keyb_clock = data & 0x40; + m_pit8253->write_gate2(BIT(data, 0)); + pc_speaker_set_spkrdata( data & 0x02 ); + + m_cassette->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + + /* If PB7 is set clear the shift register and reset the IRQ line */ + if ( m_ppi_keyboard_clear ) + { + m_ppi_shift_register = 0; + m_ppi_shift_enable = 0; + m_pic8259->ir1_w(m_ppi_shift_enable); + } + + m_pc_kbdc->data_write_from_mb(!m_ppi_shift_enable); + m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; + m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); +} + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type EC1841_MOTHERBOARD = &device_creator; + +static MACHINE_CONFIG_FRAGMENT( ec1841_mb_config ) + MCFG_FRAGMENT_ADD(ibm5160_mb_config) + + MCFG_DEVICE_MODIFY("pc_kbdc") + MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(ec1841_mb_device, keyboard_clock_w)) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor ec1841_mb_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( ec1841_mb_config ); +} + +static INPUT_PORTS_START( ec1841_mb ) + PORT_START("DSW0") /* SA1 */ + PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives") + PORT_DIPSETTING( 0x00, "1" ) + PORT_DIPSETTING( 0x40, "2" ) + PORT_DIPSETTING( 0x80, "3" ) + PORT_DIPSETTING( 0xc0, "4" ) + PORT_DIPNAME( 0x30, 0x20, "Graphics adapter") + PORT_DIPSETTING( 0x00, "Reserved" ) + PORT_DIPSETTING( 0x10, "Color 40x25" ) + PORT_DIPSETTING( 0x20, "Color 80x25" ) + PORT_DIPSETTING( 0x30, "Monochrome" ) + PORT_BIT( 0x08, 0x08, IPT_UNUSED ) + /* BIOS does not support booting from QD floppies */ + PORT_DIPNAME( 0x04, 0x04, "Floppy type") + PORT_DIPSETTING( 0x00, "80 tracks" ) + PORT_DIPSETTING( 0x04, "40 tracks" ) + PORT_DIPNAME( 0x02, 0x00, "8087 installed") + PORT_DIPSETTING( 0x00, DEF_STR(No) ) + PORT_DIPSETTING( 0x02, DEF_STR(Yes) ) + PORT_DIPNAME( 0x01, 0x01, "Boot from floppy") + PORT_DIPSETTING( 0x01, DEF_STR(Yes) ) + PORT_DIPSETTING( 0x00, DEF_STR(No) ) + + PORT_START("SA2") + PORT_DIPNAME( 0x04, 0x04, "Speech synthesizer") + PORT_DIPSETTING( 0x00, "Installed" ) + PORT_DIPSETTING( 0x04, "Not installed" ) +INPUT_PORTS_END + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor ec1841_mb_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( ec1841_mb ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// ec1841_mb_device - constructor +//------------------------------------------------- + +ec1841_mb_device::ec1841_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ibm5160_mb_device(mconfig, tag, owner, clock) +{ +} + +void ec1841_mb_device::device_start() +{ + ibm5160_mb_device::device_start(); +} +void ec1841_mb_device::device_reset() +{ + ibm5160_mb_device::device_reset(); +} + +// kbd interface is 5150-like but PB2 controls access to second bank of DIP switches (SA2). +WRITE8_MEMBER( ec1841_mb_device::pc_ppi_portb_w ) +{ + /* KB controller port B */ + m_ppi_portb = data; + m_ppi_portc_switch_high = data & 0x04; + m_ppi_keyboard_clear = data & 0x80; + m_ppi_keyb_clock = data & 0x40; + m_pit8253->write_gate2(BIT(data, 0)); + pc_speaker_set_spkrdata( data & 0x02 ); + + /* If PB7 is set clear the shift register and reset the IRQ line */ + if ( m_ppi_keyboard_clear ) + { + m_ppi_shift_register = 0; + m_ppi_shift_enable = 0; + m_pic8259->ir1_w(m_ppi_shift_enable); + } + + m_pc_kbdc->data_write_from_mb(!m_ppi_shift_enable); + m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; + m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); +} + +READ8_MEMBER ( ec1841_mb_device::pc_ppi_portc_r ) +{ + int data=0xff; + + data&=~0x80; // no parity error + data&=~0x40; // no error on expansion board + + if (m_ppi_portc_switch_high) + { + data = (data & 0xf0) | (ioport("SA2")->read() & 0x0f); + } + + data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); + + return data; +} + +pc_noppi_mb_device::pc_noppi_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ibm5160_mb_device(mconfig, tag, owner, clock) +{ +} + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +static MACHINE_CONFIG_FRAGMENT( pc_noppi_mb_config ) + MCFG_FRAGMENT_ADD(ibm5160_mb_config) + + MCFG_DEVICE_REMOVE("pc_kbdc") + MCFG_DEVICE_REMOVE("ppi8255") +MACHINE_CONFIG_END + +static INPUT_PORTS_START( pc_noppi_mb ) +INPUT_PORTS_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor pc_noppi_mb_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pc_noppi_mb_config ); +} + +ioport_constructor pc_noppi_mb_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc_noppi_mb ); +} + +void pc_noppi_mb_device::device_start() +{ + install_device(0x0000, 0x000f, 0, 0, read8_delegate(FUNC(am9517a_device::read), (am9517a_device*)m_dma8237), write8_delegate(FUNC(am9517a_device::write), (am9517a_device*)m_dma8237) ); + install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) ); + install_device(0x0040, 0x0043, 0, 0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit8253), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit8253) ); + install_device(0x0080, 0x0087, 0, 0, read8_delegate(FUNC(ibm5160_mb_device::pc_page_r), this), write8_delegate(FUNC(ibm5160_mb_device::pc_page_w),this) ); + install_device(0x00a0, 0x00a1, 0, 0, read8_delegate(), write8_delegate(FUNC(ibm5160_mb_device::nmi_enable_w),this)); + /* MESS managed RAM */ + if ( m_ram->pointer() ) + membank( "bank10" )->set_base( m_ram->pointer() ); +} + +const device_type PCNOPPI_MOTHERBOARD = &device_creator; diff --git a/src/mame/machine/hec2hrp.c b/src/mame/machine/hec2hrp.c new file mode 100644 index 00000000000..55db5bdfe5f --- /dev/null +++ b/src/mame/machine/hec2hrp.c @@ -0,0 +1,822 @@ +// license:BSD-3-Clause +// copyright-holders:JJ Stacino +///////////////////////////////////////////////////////////////////////// +// HEC2HRP.C in machine +/* Hector 2HR+ + Victor + Hector 2HR + Hector HRX + Hector MX40c + Hector MX80c + Hector 1 + Interact + + 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com + 31/06/2009 Video - Robbbert + + 29/10/2009 Update skeleton to functional machine + by yo_fr (jj.stac @ aliceadsl.fr) + + => add Keyboard, + => add color, + => add cassette, + => add sn76477 sound and 1bit sound, + => add joysticks (stick, pot, fire) + => add BR/HR switching + => add bank switch for HRX + => add device MX80c and bank switching for the ROM + 03/01/2010 Update and clean prog by yo_fr (jj.stac @ aliceadsl.fr) + => add the port mapping for keyboard + 28/09/2010 add the DISK II support by yo_fr (jj.stac @ aliceadsl.fr) + => Note that actually the DISK II boot (loading CPM : OK) but do not run (don't run the CPM...). + 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M runnig! JJStacino + 11/11/2011 : add the minidisque support -3 pouces 1/2 driver- JJStacino (jj.stac @ aliceadsl.fr) + 19/02/2012 : few adjustment for the hrp and hr machine - JJStacino + + don't forget to keep some information about these machines, see DChector project : http://dchector.free.fr/ made by DanielCoulom + (and thank's to Daniel!) and Yves site : http://hectorvictor.free.fr/ (thank's too Yves!) + + TODO : Add the cartridge function, + Adjust the one shot and A/D timing (sn76477) +*/ + +#include "emu.h" +#include "imagedev/cassette.h" +#include "imagedev/printer.h" +#include "sound/wave.h" /* for K7 sound*/ +#include "sound/discrete.h" /* for 1 Bit sound*/ +#include "machine/upd765.h" /* for floppy disc controller */ + +#include "formats/hect_tap.h" +#include "includes/hec2hrp.h" + +#ifndef DEBUG_TRACE_COM_HECTOR +//#define DEBUG_TRACE_COM_HECTOR 1 +#endif + + +/* machine List +hec2hrp +victor +hec2hr +hec2hrx +hec2mdhrx +hec2mx80 +hec2mx40 +*/ + +/* Helper function*/ +int hec2hrp_state::isHectorWithDisc2() +{ +return ((strncmp(machine().system().name , "hec2hrx" , 7)==0) || + (strncmp(machine().system().name , "hec2mx40" , 8)==0) || + (strncmp(machine().system().name , "hec2mx80" , 8)==0)); +} + +int hec2hrp_state::isHectorWithMiniDisc() +{ +return ((strncmp(machine().system().name , "hec2mdhrx", 9)==0)); +} + +int hec2hrp_state::isHectorHR() +{ +return ((strncmp(machine().system().name , "hec2hr" , 6)==0) || //Aviable for hr & hrp + (strncmp(machine().system().name , "hec2mdhrx", 9)==0) || + (strncmp(machine().system().name , "victor" , 6)==0) || + (strncmp(machine().system().name , "hec2mx40" , 8)==0) || + (strncmp(machine().system().name , "hec2mx80" , 8)==0)); +} + +int hec2hrp_state::isHectoreXtend() +{ +return ((strncmp(machine().system().name , "hec2mdhrx", 9)==0) || + (strncmp(machine().system().name , "hec2hrx" , 7)==0) || + (strncmp(machine().system().name , "hec2mx40" , 8)==0) || + (strncmp(machine().system().name , "hec2mx80" , 8)==0)); +} + +/* Cassette timer*/ +TIMER_CALLBACK_MEMBER(hec2hrp_state::Callback_CK) +{ +/* To generate the CK signal (K7)*/ + m_CK_signal++; +} + +WRITE8_MEMBER( hec2hrp_state::minidisc_control_w ) +{ + floppy_image_device *floppy = NULL; + + if (BIT(data, 6)) floppy = m_floppy0->get_device(); + // bit 7 = drive 2? + + m_minidisc_fdc->set_floppy(floppy); + + if (floppy) + { + // don't know where the motor on signal is + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); + } + + membank("bank2")->set_entry(BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC); +} + +WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) +{ + if (offset==0x00) { /* 0x800 et 0x000=> video page, HR*/ + if (isHectoreXtend()) + membank("bank1")->set_entry(HECTOR_BANK_VIDEO); + if (m_flag_clk ==1) + { + m_flag_clk=0; + m_maincpu->set_unscaled_clock(XTAL_5MHz); /* increase CPU*/ + } + } + if (offset==0x04) { /* 0x804 => video page, BR*/ + m_hector_flag_hr=0; + if (isHectoreXtend()) + membank("bank1")->set_entry(HECTOR_BANK_VIDEO); + if (m_flag_clk ==0) + { + m_flag_clk=1; + m_maincpu->set_unscaled_clock(XTAL_1_75MHz); /* slowdown CPU*/ + } + } + if (offset==0x08) { /* 0x808 => base page, HR*/ + if (isHectoreXtend()) + membank("bank1")->set_entry(HECTOR_BANK_PROG); + if (m_flag_clk ==1) + { + m_flag_clk=0; + m_maincpu->set_unscaled_clock(XTAL_5MHz); /* increase CPU*/ + } + + } + if (offset==0x0c) { /* 0x80c => base page, BR*/ + m_hector_flag_hr=0; + if (isHectoreXtend()) + membank("bank1")->set_entry(HECTOR_BANK_PROG); + if (m_flag_clk ==0) + { + m_flag_clk=1; + m_maincpu->set_unscaled_clock(XTAL_1_75MHz); /* slowdown CPU*/ + } + } +} + +WRITE8_MEMBER(hec2hrp_state::hector_keyboard_w) +{ + /*nothing to do => read function manage the value*/ +} + +READ8_MEMBER(hec2hrp_state::hector_keyboard_r) +{ + UINT8 data = 0xff; + + if (offset ==7) /* Only when joy reading*/ + { + /* Read special key for analog joystick emulation only (button and pot are analog signal!) and the reset */ + data=m_keyboard[8]->read(); + + if (data & 0x01) /* Reset machine ! (on ESC key)*/ + { + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + if (isHectorHR()) /* aviable for HR and up */ + { + m_hector_flag_hr=1; + if (isHectoreXtend()) + { + membank("bank1")->set_entry(HECTOR_BANK_PROG); + membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); + } + //RESET DISC II unit + if (isHectorWithDisc2() ) + hector_disc2_reset(); + + /* floppy md master reset */ + if (isHectorWithMiniDisc()) + m_minidisc_fdc->reset(); + } + + else /* aviable for BR machines */ + m_hector_flag_hr=0; + + + /*Common flag*/ + m_hector_flag_80c = 0; + m_flag_clk = 0; + } + + m_actions = 0; + if (data & 0x02) /* Fire(0)*/ + m_actions += 1; + + if (data & 0x04) /* Fire(1)*/ + m_actions += 2; + + if (data & 0x08) /* Pot(0)+*/ + m_pot0 += 1; + if (m_pot0>128) m_pot0 = 128; + + if (data & 0x10) /* Pot(0)-*/ + m_pot0 -= 1; + + if (m_pot0>250) m_pot0 = 0; + + if (data & 0x20) /* Pot(1)+*/ + m_pot1 += 1; + if (m_pot1>128) m_pot1 = 128; + + if (data & 0x40) /* Pot(1)-*/ + m_pot1 -= 1; + + if (m_pot1>250) m_pot1 = 0; + } + + /* in all case return the request value*/ + return m_keyboard[offset]->read(); +} + +WRITE8_MEMBER(hec2hrp_state::hector_sn_2000_w) +{ + Mise_A_Jour_Etat(0x2000+ offset, data); + Update_Sound(space, data); +} +WRITE8_MEMBER(hec2hrp_state::hector_sn_2800_w) +{ + Mise_A_Jour_Etat(0x2800+ offset, data); + Update_Sound(space, data); +} +READ8_MEMBER(hec2hrp_state::hector_cassette_r) +{ + double level; + UINT8 value=0; + + if ((m_state3000 & 0x38) != 0x38 ) /* Selon Sb choix cassette ou timer (74153)*/ + { + m_Data_K7 = 0x00; /* No cassette => clear bit*/ + switch (m_state3000 & 0x38 ) + { + case 0x08: value = (m_actions & 1) ? 0x80 : 0; break; + case 0x10: value = m_pot0; break; + case 0x20: value = (m_actions & 2) ? 0x80 : 0; break; + case 0x28: value = m_pot1; break; + default: value = 0; break; + } + } + else + { + if (m_write_cassette == 0) + { + /* Accee a la cassette*/ + level = m_cassette->input(); + + /* Travail du 741 en trigger*/ + if (level < -0.08) + m_cassette_bit = 0x00; + if (level > +0.08) + m_cassette_bit = 0x01; + } + /* Programme du sn7474 (bascule) : Changement ??tat bit Data K7 ?? chaque front montant de m_cassette_bit*/ + if ((m_cassette_bit != m_cassette_bit_mem) && (m_cassette_bit !=0)) + { + if (m_Data_K7 == 0x00) + m_Data_K7 = 0x80;/* En poids fort*/ + else + m_Data_K7 = 0x00; + } + value = ( m_CK_signal & 0x7F ) + m_Data_K7; + m_cassette_bit_mem = m_cassette_bit; /* Memorisation etat bit cassette*/ + } + return value; +} +WRITE8_MEMBER(hec2hrp_state::hector_sn_3000_w) +{ + m_state3000 = data & 0xf8; /* except bit 0 to 2*/ + if ((data & 7) != m_oldstate3000 ) + { + /* Update sn76477 only when necessary!*/ + Mise_A_Jour_Etat(0x3000, data & 7 ); + Update_Sound(space, data & 7); + } + m_oldstate3000 = data & 7; +} + +/* Color Interface */ +WRITE8_MEMBER(hec2hrp_state::hector_color_a_w) +{ + if (data & 0x40) + { + /* Bit 6 => motor ON/OFF => for cassette state!*/ + if (m_write_cassette==0) + { + m_cassette->change_state( + CASSETTE_MOTOR_ENABLED , + CASSETTE_MASK_MOTOR); + // m_cassette->set_state((cassette_state)(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED )); + } + } + else + { /* stop motor*/ + m_cassette->set_state(CASSETTE_STOPPED); + m_write_cassette=0; + m_counter_write =0; + } + if (((data & 0x80) != (m_oldstate1000 & 0x80)) && ((m_oldstate1000 & 7)==(data & 7)) ) /* Bit7 had change but not the color statement*/ + { + /* Bit 7 => Write bit for cassette!*/ + m_counter_write +=1; + + if (m_counter_write > 5) + { + /* Wait several cycle before lauch the record to prevent somes bugs*/ + m_counter_write = 6; + if (m_write_cassette==0) + { /* C'est la 1er fois => record*/ + m_cassette->change_state( + CASSETTE_MOTOR_ENABLED , + CASSETTE_MASK_MOTOR); + m_cassette->set_state(CASSETTE_RECORD); + m_write_cassette=1; + } + } + /* cassette data */ + m_cassette->output(((data & 0x80) == 0x80) ? -1.0 : +1.0); + } + + /* Other bit : color definition*/ + m_hector_color[0] = data & 0x07 ; + m_hector_color[2] = ((data >> 3) & 0x07) | (m_hector_color[2] & 0x40); + + m_oldstate1000=data; /* For next step*/ +} + +WRITE8_MEMBER(hec2hrp_state::hector_color_b_w) +{ + discrete_device *discrete = machine().device("discrete"); + m_hector_color[1] = data & 0x07; + m_hector_color[3] = (data >> 3) & 0x07; + + /* Half light on color 2 only on HR machines:*/ + if (data & 0x40) m_hector_color[2] |= 8; else m_hector_color[2] &= 7; + + /* Play bit*/ + discrete->write(space, NODE_01, (data & 0x80) ? 0:1 ); +} + + +/******************************************************************************** + Port Handling +********************************************************************************/ + +/******************* READ PIO 8255 *******************/ +READ8_MEMBER(hec2hrp_state::hector_io_8255_r) +{ + /* 8255 in mode 0 */ + UINT8 data =0; + UINT8 data_l=0; + UINT8 data_h=0; + + + if ((offset & 0x3) == 0x0) /* Port A */ + data = m_hector_port_a; + + if ((offset & 0x3) == 0x1) /* Port B */ + { + data = m_hector_port_b; + #ifdef DEBUG_TRACE_COM_HECTOR + printf("\nLecture data par Hector %x (portB)",data); + #endif + } + + if ((offset & 0x3) == 0x2) /* Port C */ + { + data_l = (m_hector_port_c_l & 0x0f); + data_h = (m_hector_port_c_h & 0xf0); + + if (BIT(m_hector_port_cmd, 0)) /* Quartet inf en entree ?*/ + data_l = (m_hector_port_c_l & 0x0f); /*no change*/ + + if (BIT(m_hector_port_cmd, 3)) /* Quartet sup en entree ?*/ + { + m_hector_port_c_h = (m_hector_port_c_h & 0x0c0); /* Clear bits 4 & 5*/ + + if (m_hector_disc2_data_w_ready != 0x00) + m_hector_port_c_h = m_hector_port_c_h + 0x010; // PC4 (data write ready from Disc II to Hector) + + if (m_hector_disc2_data_r_ready != 0x00) + m_hector_port_c_h = m_hector_port_c_h + 0x020; // PC5 (data read ready from Hector to Disc2) + + m_hector_port_c_h = m_hector_port_c_h & 0x07F; // PC7 (printer busy=0) + data_h = m_hector_port_c_h; + } + data= data_l + data_h; + } + return data; // Return the value! +} + +/******************* WRITE PIO 8255 *******************/ + +WRITE8_MEMBER(hec2hrp_state::hector_io_8255_w) +{ + /* 8255 in mode 0 */ + if ((offset & 0x3) == 0x0) /* Port A => to printer or Disc II*/ + { + m_hector_port_a = data; + /* Port A => to printer*/ + /* Caution : The strobe connection to the printer seems not be used + So, all what is send to the Disc2 unit will be printed too! */ + + if (BIT(m_hector_port_c_l, 0)) { // PC0 (bit X0)= strobe printer ! + printer_image_device *printer = machine().device("printer"); + printer->output(m_hector_port_a); + } + +#ifdef DEBUG_TRACE_COM_HECTOR + printf("\nEcriture data par Hector %x (dans portA)",data); +#endif + } + + if ((offset & 0x3) == 0x1) /* Port B */ + m_hector_port_b = data; + + + if ((offset & 0x3) == 0x2) /* Port C => depending cmd word */ + { + if (!BIT(m_hector_port_cmd, 0)) /* cmd -> Quartet inf en sortie ?*/ + { + m_hector_port_c_l = data & 0x0f; + // Utilizing bits port C : PC0 for the printer : strobe! + if (BIT(m_hector_port_c_l , 0)) // PC0 (bit X0)= true + { + /* Port A => to printer*/ + //printer_output(machine().device("printer"), m_hector_port_a); + } + // Utilizing bits port C : PC1 // PC2 for the communication with disc2 + if (!BIT(m_hector_port_c_l , 1)) // PC1 (bit X1)= true + { + // Lecture effectuee => RAZ memoire donnee m_hector_disc2_data_write dispo + m_hector_port_b = m_hector_disc2_data_write; // Mep sur port B si 2eme 74374 existant ! + m_hector_disc2_data_w_ready = 0x00; + #ifdef DEBUG_TRACE_COM_HECTOR + printf("\nEcriture port B vers m_hector_disc2_data_write suite a PC1"); + #endif + } + if (!BIT(m_hector_port_c_l, 2)) // PC2 (bit X2)= true + { + m_hector_disc2_data_read = m_hector_port_a; /* mise en place de l'info presente sur le port A */ + m_hector_disc2_data_r_ready = 0x08; /* memorisation de l'info */ + #ifdef DEBUG_TRACE_COM_HECTOR + printf("\nEcriture port A pour m_hector_disc2_data_read suite a PC2"); + #endif + } + } + if (!BIT(m_hector_port_cmd, 3)) /* cmd -> Quartet sup en sortie ?*/ + m_hector_port_c_h = (data & 0xf0); + } + + if ((offset & 0x3) == 0x3) /* Port commande */ + { + m_hector_port_cmd = data; + } +} +/* End of 8255 managing */ + + +/******************* Ecriture PIO specifique machine MX40 *******************/ +WRITE8_MEMBER(hec2hrp_state::hector_mx40_io_port_w) +{ +/* Bank switching on several address */ + if ((offset &0x0ff) == 0x40) /* Port page 0*/ + membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); + if ((offset &0x0ff) == 0x41) /* Port page 1*/ + { + membank("bank2")->set_entry(HECTORMX_BANK_PAGE1); + m_hector_flag_80c=0; + } + if ((offset &0x0ff) == 0x44) /* Port page 2 => 42 pour MX80*/ + membank("bank2")->set_entry(HECTORMX_BANK_PAGE2); + if ((offset &0x0ff) == 0x49) /* Port screen resolution*/ + m_hector_flag_80c=0;/* No 80c in 40c !*/ +} + +/******************* Ecriture PIO specifique machine MX80 *******************/ +WRITE8_MEMBER(hec2hrp_state::hector_mx80_io_port_w) +{ + if ((offset &0x0ff) == 0x40) /* Port page 0*/ + membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); + if ((offset &0x0ff) == 0x41) /* Port page 1*/ + { + membank("bank2")->set_entry(HECTORMX_BANK_PAGE1); + m_hector_flag_80c=0; + } + if ((offset &0x0ff) == 0x42) /* Port page 2 => port different du MX40*/ + membank("bank2")->set_entry(HECTORMX_BANK_PAGE2); + if ((offset &0x0ff) == 0x49) /* Port screen resolution*/ + m_hector_flag_80c=1; +} + +/******************************************************************************** + sound managment +********************************************************************************/ + +void hec2hrp_state::Mise_A_Jour_Etat(int Adresse, int Value ) +{ +/* Adjust value depending on I/O main CPU request*/ +switch(Adresse ) +{ + case 0x2000: + /* Modification AU0 / AU8*/ + { /* AU0*/ + m_AU[ 0] = ((Value & 0x080 )==0) ? 0 : 1 ; + /* AU8 : 0*/ + m_AU[ 8] = ((Value & 0x040 )==0) ? 0 : 1 ; + break; + } + case 0x2001: + /* Modification AU1 / AU9*/ + { /* AU1*/ + m_AU[ 1] = ((Value & 0x080 )==0) ? 0 : 1 ; + /* AU9*/ + m_AU[ 9] = ((Value & 0x040 )==0) ? 0 : 1 ; + break; + } + case 0x2002: + /* Modification AU2 / AU10*/ + { /* AU2*/ + m_AU[ 2] = ((Value & 0x080 )==0) ? 0 : 1 ; + /* AU10*/ + m_AU[10] = ((Value & 0x040 )==0) ? 0 : 1 ; + break; + } + case 0x2003: + /* Modification AU3 / AU11*/ + { /* AU3*/ + m_AU[ 3] = ((Value & 0x080 )==0) ? 0 : 1 ; + /* AU11*/ + m_AU[11] = ((Value & 0x040 )==0) ? 0 : 1 ; + break; + } + case 0x2800: + /* Modification AU4 / AU12*/ + { /* AU4*/ + m_AU[ 4] = ((Value & 0x080 )==0) ? 0 : 1 ; + /* AU8*/ + m_AU[12] = ((Value & 0x040 )==0) ? 0 : 1 ; + break; + } + case 0x2801: + /* Modification AU5 / AU13*/ + { /* AU5*/ + m_AU[ 5] = ((Value & 0x080 )==0) ? 0 : 1 ; + /* AU13*/ + m_AU[13] = ((Value & 0x040 )==0) ? 0 : 1 ; + break; + } + case 0x2802: + { /* Modification AU6 / AU14*/ + /* AU6*/ + m_AU[ 6] = ((Value & 0x080 )==0) ? 0 : 1 ; + /* AU14*/ + m_AU[14] = ((Value & 0x040 )==0) ? 0 : 1 ; + break; + } + case 0x2803: + /* Modification AU7 / AU15*/ + { /* AU7*/ + m_AU[ 7] = ((Value & 0x080 )==0) ? 0 : 1 ; + /* AU15*/ + m_AU[15] = ((Value & 0x040 )==0) ? 0 : 1 ; + break; + } + case 0x3000: + /* Mixer modification*/ + { + m_ValMixer = (Value & 7) ; + break; + } + default: break; +} /*switch*/ +} + + +void hec2hrp_state::Init_Value_SN76477_Hector() +{ + /* Remplissage des valeurs de resistance et capacite d'Hector*/ + + /* Decay R*/ + m_Pin_Value[7][1] = RES_K(680.0); /*680K */ + m_Pin_Value[7][0] = RES_K(252.325); /* 142.325 (680 // 180KOhm)*/ + + /* Capa A/D*/ + m_Pin_Value[8][0] = CAP_U(0.47); /* 0.47uf*/ + m_Pin_Value[8][1] = CAP_U(1.47); /* 1.47*/ + + /* ATTACK R*/ + m_Pin_Value[10][1]= RES_K(180.0); /* 180*/ + m_Pin_Value[10][0]= RES_K(32.054); /* 32.054 (180 // 39 KOhm)*/ + + /* Version 3 : Ajuste pour les frequences mesurees : + // 4 0 SOUND 255 Hz => ajuste a l'oreille + // 4 4 SOUND 65 Hz => ajuste a l'oreille + // 4 8 SOUND 17 Hz => ajuste a l'oreille + // 4 12 SOUND 4,3 Hz => ajuste a l'oreille*/ + /* SLF C Version 3*/ + m_Pin_Value[21][0]= CAP_U(0.1); /*CAPU(0.1) */ + m_Pin_Value[21][1]= CAP_U(1.1); /*1.1*/ + + /*SLF R Version 3*/ + m_Pin_Value[20][1]= RES_K(180); //180 vu + m_Pin_Value[20][0]= RES_K(37.268); //37.268 (47//180 KOhms) + + /* Capa VCO*/ + /* Version 3 : Ajust?? pour les frequences mesur??es : + // 0 0 SOUND 5,5KHz => 5,1KHz + // 0 16 SOUND 1,3KHz => 1,2KHz + // 0 32 SOUND 580Hz => 570Hz + // 0 48 SOUND 132Hz => 120Hz*/ + m_Pin_Value[17][0] = CAP_N(47.0) ; /*47,0 mesure ok */ + m_Pin_Value[17][1] = CAP_N(580.0) ; /*580 mesure ok */ + /* R VCO Version 3*/ + m_Pin_Value[18][1] = RES_K(1400.0 );/*1300 mesure ok // au lieu de 1Mohm*/ + m_Pin_Value[18][0] = RES_K( 203.548 );/*223 mesure ok // au lieu de 193.548 (1000 // 240KOhm)*/ + + /* VCO Controle*/ + m_Pin_Value[16][0] = 0.0; /* Volts */ + m_Pin_Value[16][1] = 1.41; /* 2 = 10/15eme de 5V*/ + + /* Pitch*/ + m_Pin_Value[19][0] = 0.0; /*Volts */ + m_Pin_Value[19][1] = 1.41; + + m_Pin_Value[22][0] = 0; /* TOR */ + m_Pin_Value[22][1] = 1; + + /* R OneShot*/ + m_Pin_Value[24][1] = RES_K(100); + m_Pin_Value[24][0] = RES_K(1000); /*RES_M(1) infini sur Hector car non connectee*/ + + /* Capa OneShot*/ + m_Pin_Value[23][0] = 1.0; + m_Pin_Value[23][1] = 0.0; /* Valeur Bidon sur Hector car mise au 5Volts sans capa*/ + + /* Enabled*/ + m_Pin_Value[9][0] = 0; + m_Pin_Value[9][1] = 1; + + /* Volume*/ + m_Pin_Value[11][0] = 128; /* Rapport 50% et 100% 128*/ + m_Pin_Value[11][1] = 255; /* 255*/ + + /* Noise filter*/ + m_Pin_Value[6][0] = CAP_U(0.390); /* 0.390*/ + m_Pin_Value[6][1] = CAP_U(08.60); /* 0.48*/ + + /* Valeur corrige par rapport au schema :*/ + m_Pin_Value[5][1] = RES_K(3.30 ) ; /* 330Kohm*/ + m_Pin_Value[5][0] = RES_K(1.76 ) ; /* 76 Kohm*/ + + /* Noise pas commande par le bus audio !*/ + /* Seule la valeur [0] est documentee !*/ + m_Pin_Value[4][0] = RES_K(47) ; /* 47 K ohm*/ + m_Pin_Value[12][0] = RES_K(100); /* 100K ohm*/ + m_Pin_Value[3][0] = 0 ; /* NC*/ + + /* Gestion du type d'enveloppe*/ + m_Pin_Value[ 1][0] = 0; + m_Pin_Value[ 1][1] = 1; + + m_Pin_Value[28][0] = 0; + m_Pin_Value[28][1] = 1; + + /* Initialisation a 0 des pin du SN*/ + m_AU[0]=0; + m_AU[1]=0; + m_AU[2]=0; + m_AU[3]=0; + m_AU[4]=0; + m_AU[5]=0; + m_AU[6]=0; + m_AU[7]=0; + m_AU[8]=0; + m_AU[9]=0; + m_AU[10]=0; + m_AU[11]=0; + m_AU[12]=0; + m_AU[13]=0; + m_AU[14]=0; + m_AU[15]=0; + m_ValMixer = 0; +} + +void hec2hrp_state::Update_Sound(address_space &space, UINT8 data) +{ + /* keep device*/ + /* MIXER*/ + m_sn->mixer_a_w(((m_ValMixer & 0x04)==4) ? 1 : 0); + m_sn->mixer_b_w(((m_ValMixer & 0x01)==1) ? 1 : 0); + m_sn->mixer_c_w(((m_ValMixer & 0x02)==2) ? 1 : 0);/* Revu selon mesure electronique sur HRX*/ + + /* VCO oscillateur*/ + if (m_AU[12]==1) + m_sn->vco_res_w(m_Pin_Value[18][m_AU[10]]/12.0); /* en non AU11*/ + else + m_sn->vco_res_w(m_Pin_Value[18][m_AU[10]]); /* en non AU11*/ + + m_sn->vco_cap_w(m_Pin_Value[17][m_AU[2 ]]); + m_sn->pitch_voltage_w(m_Pin_Value[19][m_AU[15]]); + m_sn->vco_voltage_w(m_Pin_Value[16][m_AU[15]]); + m_sn->vco_w(m_Pin_Value[22][m_AU[12]]); /* VCO Select Ext/SLF*/ + + /* SLF*/ + m_sn->slf_res_w(m_Pin_Value[20][m_AU[ 9]]);/*AU10*/ + m_sn->slf_cap_w(m_Pin_Value[21][m_AU[1 ]]); + + /* One Shot*/ + m_sn->one_shot_res_w(m_Pin_Value[24][ 0]); /* NC*/ + m_sn->one_shot_cap_w(m_Pin_Value[23][m_AU[13]]); + + /* Ampli value*/ + m_sn->amplitude_res_w(m_Pin_Value[11][m_AU[5]]); + + /* Attack / Decay*/ + m_sn->attack_res_w(m_Pin_Value[10][m_AU[ 8]]); + m_sn->decay_res_w(m_Pin_Value[7 ][m_AU[11]]);/*AU9*/ + m_sn->attack_decay_cap_w(m_Pin_Value[8][m_AU[0]]); + + /* Filtre*/ + m_sn->noise_filter_res_w(m_Pin_Value[5][m_AU[4]]); + m_sn->noise_filter_cap_w(m_Pin_Value[6][m_AU[3]]); + + /* Clock Extern Noise*/ + m_sn->noise_clock_res_w(m_Pin_Value[4][0]); /* fix*/ + m_sn->feedback_res_w(m_Pin_Value[12][0]); /*fix*/ + + /* Envelope*/ + m_sn->envelope_1_w(m_Pin_Value[1 ][m_AU[6]]); + m_sn->envelope_2_w(m_Pin_Value[28][m_AU[7]]); + + /* En dernier on lance (ou pas !)*/ + m_sn->enable_w(m_Pin_Value[9][m_AU[14]]); +} + +void hec2hrp_state::hector_reset(int hr, int with_D2 ) +{ + // Initialization Hector + m_hector_flag_hr = hr; + m_flag_clk = 0; + m_write_cassette = 0; + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + + // Initialization Disc II + if (with_D2==1) + + { + upd765a_device *fdc = machine().device("upd765"); + m_disc2cpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + fdc->reset(); + } +} + +void hec2hrp_state::hector_init() +{ + m_pot0 = m_pot1 = 0x40; + + /* For Cassette synchro*/ + m_Cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hec2hrp_state::Callback_CK),this)); + m_Cassette_timer->adjust(attotime::from_msec(100), 0, attotime::from_usec(64));/* => real synchro scan speed for 15,624Khz*/ + + /* Sound sn76477*/ + Init_Value_SN76477_Hector(); /*init R/C value*/ +} + + +/* sound hardware */ + +static DISCRETE_SOUND_START( hec2hrp ) + DISCRETE_INPUT_LOGIC(NODE_01) + DISCRETE_OUTPUT(NODE_01, 5000) +DISCRETE_SOUND_END + +MACHINE_CONFIG_FRAGMENT( hector_audio ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(0, "mono", 0.25) /* Sound level for cassette, as it is in mono => output channel=0*/ + + MCFG_SOUND_ADD("sn76477", SN76477, 0) + MCFG_SN76477_NOISE_PARAMS(RES_K(47), RES_K(330), CAP_P(390)) // noise + filter + MCFG_SN76477_DECAY_RES(RES_K(680)) // decay_res + MCFG_SN76477_ATTACK_PARAMS(CAP_U(47), RES_K(180)) // attack_decay_cap + attack_res + MCFG_SN76477_AMP_RES(RES_K(33)) // amplitude_res + MCFG_SN76477_FEEDBACK_RES(RES_K(100)) // feedback_res + MCFG_SN76477_VCO_PARAMS(2, CAP_N(47), RES_K(1000)) // VCO volt + cap + res + MCFG_SN76477_PITCH_VOLTAGE(2) // pitch_voltage + MCFG_SN76477_SLF_PARAMS(CAP_U(0.1), RES_K(180)) // slf caps + res + MCFG_SN76477_ONESHOT_PARAMS(CAP_U(1.00001), RES_K(10000)) // oneshot caps + res + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.1) + + MCFG_SOUND_ADD("discrete", DISCRETE, 0) /* Son 1bit*/ + MCFG_DISCRETE_INTF(hec2hrp) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + +MACHINE_CONFIG_END diff --git a/src/mame/machine/hecdisk2.c b/src/mame/machine/hecdisk2.c new file mode 100644 index 00000000000..16cc67300c9 --- /dev/null +++ b/src/mame/machine/hecdisk2.c @@ -0,0 +1,148 @@ +// license:BSD-3-Clause +// copyright-holders:JJ Stacino +/*******************************************************/ +/************ HECDISK2.C in machine ******************/ +/*******************************************************/ + +/* Lecteur de disquette DISK II pour les machines : + Hector HRX + Hector MX40c + Hector MX80c + + JJStacino jj.stacino@aliceadsl.fr + + 15/02/2010 : Start of the disc2 project! JJStacino + 26/09/2010 : first sending with bug2 (the first "dir" command finih with a crash of the Z80 disc II proc) JJStacino + 01/11/2010 : first time ending boot sequence, probleme on the CP/M lauch JJStacino + 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M runnig! JJStacino + 28/11/2010 : Found at Bratislava that the disk writing with TRANS X: is NOT WORKING (the exchange Hector=>Disc2 ok) +*/ + +#include "emu.h" + +#include "sound/wave.h" /* for K7 sound*/ +#include "sound/discrete.h" /* for 1 Bit sound*/ +#include "machine/upd765.h" /* for floppy disc controller */ +#include "formats/hect_dsk.h" +#include "cpu/z80/z80.h" + +#include "includes/hec2hrp.h" + +/* Callback uPD request */ + +/* How uPD765 works: + * First we send at uPD the string of command (p.e. 9 bytes for read starting by 0x46) on port 60h + between each byte, check the authorization of the uPD by reading the status register + * When the command is finish, the data arrive with DMA interrupt, then: + If read: in port 70 to retrieve the data, + If write: in port 70 send the data + * When all data had been send the uPD launch an INT + * The Z80 Disc2 writes in FF12 a flag + * if the flag is set, end of DMA function, + * At this point the Z80 can read the RESULT in port 61h +*/ + +/*****************************************************************************/ +/**** Management of the interrupts (NMI and INT)between uPD765 and Z80 ******/ +/*****************************************************************************/ + +/* upd765 INT is connected to interrupt of Z80 within a RNMI hardware authorization */ +WRITE_LINE_MEMBER( hec2hrp_state::disc2_fdc_interrupt ) +{ + m_IRQ_current_state = state; + m_disc2cpu->set_input_line(INPUT_LINE_IRQ0, state && m_hector_disc2_RNMI ? ASSERT_LINE : CLEAR_LINE); +} + +/* upd765 DRQ is connected to NMI of Z80 within a RNMI hardware authorization */ +WRITE_LINE_MEMBER( hec2hrp_state::disc2_fdc_dma_irq ) +{ + m_NMI_current_state = state; + m_disc2cpu->set_input_line(INPUT_LINE_NMI, state && m_hector_disc2_RNMI ? ASSERT_LINE : CLEAR_LINE); +} + +// RESET the disc2 Unit ! +void hec2hrp_state::hector_disc2_reset() +{ + // Initialization Disc2 unit + m_disc2cpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + machine().device("upd765")->reset(); + // Select ROM memory to cold restart + membank("bank3")->set_entry(DISCII_BANK_ROM); + + // Clear the Hardware's buffers + m_hector_disc2_data_r_ready=0x0; /* =ff when PC2 = true and data in read buffer (state->m_hector_disc2_data_read) */ + m_hector_disc2_data_w_ready=0x0; /* =ff when Disc 2 Port 40 had send a data in write buffer (state->m_hector_disc2_data_write) */ + m_hector_disc2_data_read=0; /* Data send by Hector to Disc 2 when PC2=true */ + m_hector_disc2_data_write=0; /* Data send by Disc 2 to Hector when Write Port I/O 40 */ + m_hector_disc2_RNMI = 0; /* State of I/O 50 D5 = authorization for INT / NMI */ + m_IRQ_current_state=0; /* Clear the IRQ active request */ + m_NMI_current_state=0; /* Clear the DMA active request */ +} + +/*****************************************************************************/ +/******************** Port handling of the Z80 Disc II unit *****************/ +/*****************************************************************************/ +READ8_MEMBER( hec2hrp_state::hector_disc2_io00_port_r) +{ + /* Switch Disc 2 to RAM to let full RAM acces */ + membank("bank3")->set_entry(DISCII_BANK_RAM); + return 0; +} +WRITE8_MEMBER( hec2hrp_state::hector_disc2_io00_port_w) +{ + /* Switch Disc 2 to RAM to let full RAM acces */ + membank("bank3")->set_entry(DISCII_BANK_RAM); +} +READ8_MEMBER( hec2hrp_state::hector_disc2_io20_port_r) +{ + // You can implemente the 8251 chip communication here ! + return 0; +} +WRITE8_MEMBER( hec2hrp_state::hector_disc2_io20_port_w) +{ + // You can implemente the 8251 chip communication here ! +} +READ8_MEMBER( hec2hrp_state::hector_disc2_io30_port_r) +{ + return m_hector_disc2_data_r_ready; +} +WRITE8_MEMBER( hec2hrp_state::hector_disc2_io30_port_w) +{ + // Nothing here ! +} + +READ8_MEMBER( hec2hrp_state::hector_disc2_io40_port_r) +{ + /* Read data send by Hector, by Disc2*/ + m_hector_disc2_data_r_ready = 0x00; /* Clear memory info read ready*/ + return m_hector_disc2_data_read; /* send the data !*/ +} + +WRITE8_MEMBER( hec2hrp_state::hector_disc2_io40_port_w) /* Write data send by Disc2, to Hector*/ +{ + m_hector_disc2_data_write = data; /* Memorization data*/ + m_hector_disc2_data_w_ready = 0x80; /* Memorization data write ready in D7*/ +} + +READ8_MEMBER( hec2hrp_state::hector_disc2_io50_port_r) /*Read memory info write ready*/ +{ + return m_hector_disc2_data_w_ready; +} + +WRITE8_MEMBER( hec2hrp_state::hector_disc2_io50_port_w) /* I/O Port to the stuff of Disc2*/ +{ + upd765a_device *fdc = machine().device("upd765"); + + /* FDC Motor Control - Bit 0/1 defines the state of the FDD 0/1 motor */ + machine().device("upd765:0")->get_device()->mon_w(BIT(data, 0)); // Moteur floppy A: + machine().device("upd765:1")->get_device()->mon_w(BIT(data, 1)); // Moteur floppy B: + + /* Write bit TC uPD765 on D4 of port I/O 50 */ + fdc->tc_w(BIT(data, 4)); + + + /* Authorization interrupt and NMI with RNMI signal*/ + m_hector_disc2_RNMI = BIT(data, 5); + m_disc2cpu->set_input_line(INPUT_LINE_IRQ0, m_IRQ_current_state && m_hector_disc2_RNMI ? ASSERT_LINE : CLEAR_LINE); + m_disc2cpu->set_input_line(INPUT_LINE_NMI, m_NMI_current_state && m_hector_disc2_RNMI ? ASSERT_LINE : CLEAR_LINE); +} diff --git a/src/mame/machine/hp48.c b/src/mame/machine/hp48.c new file mode 100644 index 00000000000..6c6ad253001 --- /dev/null +++ b/src/mame/machine/hp48.c @@ -0,0 +1,1176 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2008 + + Hewlett Packard HP48 S/SX & G/GX/G+ and HP49 G + +**********************************************************************/ + +#include "emu.h" +#include "sound/dac.h" +#include "cpu/saturn/saturn.h" + +#include "machine/nvram.h" + +#include "includes/hp48.h" + + +/*************************************************************************** + DEBUGGING +***************************************************************************/ + + +#define VERBOSE 0 +#define VERBOSE_SERIAL 0 + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) +#define LOG_SERIAL(x) do { if (VERBOSE_SERIAL) logerror x; } while (0) + + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +/* state field in hp48_module */ +#define HP48_MODULE_UNCONFIGURED 0 +#define HP48_MODULE_MASK_KNOWN 1 +#define HP48_MODULE_CONFIGURED 2 + +/*************************************************************************** + GLOBAL VARIABLES & CONSTANTS +***************************************************************************/ + +/* current HP48 model */ + +#define HP48_G_SERIES ((m_model==HP48_G) || (m_model==HP48_GX) || (m_model==HP48_GP)) +#define HP48_S_SERIES ((m_model==HP48_S) || (m_model==HP48_SX)) +#define HP48_X_SERIES ((m_model==HP48_SX) || (m_model==HP48_GX)) +#define HP48_GX_MODEL ((m_model==HP48_GX) || (m_model==HP48_GP)) +#define HP49_G_MODEL ((m_model==HP49_G)) + +static const char *const hp48_module_names[6] = +{ "HDW (I/O)", "NCE2 (RAM)", "CE1", "CE2", "NCE3", "NCE1 (ROM)" }; + +/* values returned by C=ID */ +static const UINT8 hp48_module_mask_id[6] = { 0x00, 0x03, 0x05, 0x07, 0x01, 0x00 }; +static const UINT8 hp48_module_addr_id[6] = { 0x19, 0xf4, 0xf6, 0xf8, 0xf2, 0x00 }; + + + + + +/*************************************************************************** + FUNCTIONS +***************************************************************************/ + +void hp48_state::hp48_pulse_irq( int irq_line) +{ + m_maincpu->set_input_line(irq_line, ASSERT_LINE ); + m_maincpu->set_input_line(irq_line, CLEAR_LINE ); +} + + +/* ---------------- serial --------------------- */ + +#define RS232_DELAY attotime::from_usec( 300 ) + +/* end of receive event */ +TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_recv_cb) +{ + LOG_SERIAL(( "%f hp48_rs232_byte_recv_cb: end of receive, data=%02x\n", + machine().time().as_double(), param )); + + m_io[0x14] = param & 0xf; /* receive zone */ + m_io[0x15] = param >> 4; + m_io[0x11] &= ~2; /* clear byte receiving */ + m_io[0x11] |= 1; /* set byte received */ + + /* interrupt */ + if ( m_io[0x10] & 2 ) + { + hp48_pulse_irq( SATURN_IRQ_LINE ); + } +} + +/* outside world initiates a receive event */ +void hp48_state::hp48_rs232_start_recv_byte( UINT8 data ) +{ + LOG_SERIAL(( "%f hp48_rs232_start_recv_byte: start receiving, data=%02x\n", + machine().time().as_double(), data )); + + m_io[0x11] |= 2; /* set byte receiving */ + + /* interrupt */ + if ( m_io[0x10] & 1 ) + { + hp48_pulse_irq( SATURN_IRQ_LINE ); + } + + /* schedule end of reception */ + machine().scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_recv_cb),this), data); +} + + +/* end of send event */ +TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_sent_cb) +{ + //device_image_interface *xmodem = dynamic_cast(machine().device("rs232_x")); + //device_image_interface *kermit = dynamic_cast(machine().device("rs232_k")); + + LOG_SERIAL(( "%f hp48_rs232_byte_sent_cb: end of send, data=%02x\n", + machine().time().as_double(), param )); + + m_io[0x12] &= ~3; /* clear byte sending and buffer full */ + + /* interrupt */ + if ( m_io[0x10] & 4 ) + { + hp48_pulse_irq( SATURN_IRQ_LINE ); + } + + /* protocol action */ + //if ( xmodem && xmodem->exists() ) xmodem_receive_byte( &xmodem->device(), param ); + //else if ( kermit && kermit->exists() ) kermit_receive_byte( &kermit->device(), param ); +} + +/* CPU initiates a send event */ +void hp48_state::hp48_rs232_send_byte( ) +{ + UINT8 data = HP48_IO_8(0x16); /* byte to send */ + + LOG_SERIAL(( "%s %f hp48_rs232_send_byte: start sending, data=%02x\n", + machine().describe_context(), machine().time().as_double(), data )); + + /* set byte sending and send buffer full */ + m_io[0x12] |= 3; + + /* schedule transmission */ + machine().scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_sent_cb),this), data); +} + + + + +/* ------ Saturn's IN / OUT registers ---------- */ + + +/* CPU sets OUT register (keyboard + beeper) */ +WRITE32_MEMBER( hp48_state::hp48_reg_out ) +{ + LOG(( "%s %f hp48_reg_out: %03x\n", + machine().describe_context(), machine().time().as_double(), data )); + + /* bits 0-8: keyboard lines */ + m_out = data & 0x1ff; + + /* bits 9-10: unused */ + + /* bit 11: beeper */ + m_dac->write_unsigned8((data & 0x800) ? 0x80 : 00 ); +} + +int hp48_state::hp48_get_in( ) +{ + int in = 0; + + /* regular keys */ + if ( (m_out >> 0) & 1 ) in |= ioport( "LINE0" )->read(); + if ( (m_out >> 1) & 1 ) in |= ioport( "LINE1" )->read(); + if ( (m_out >> 2) & 1 ) in |= ioport( "LINE2" )->read(); + if ( (m_out >> 3) & 1 ) in |= ioport( "LINE3" )->read(); + if ( (m_out >> 4) & 1 ) in |= ioport( "LINE4" )->read(); + if ( (m_out >> 5) & 1 ) in |= ioport( "LINE5" )->read(); + if ( (m_out >> 6) & 1 ) in |= ioport( "LINE6" )->read(); + if ( (m_out >> 7) & 1 ) in |= ioport( "LINE7" )->read(); + if ( (m_out >> 8) & 1 ) in |= ioport( "LINE8" )->read(); + + /* on key */ + in |= ioport( "ON" )->read(); + + return in; +} + +/* CPU reads IN register (keyboard) */ +READ32_MEMBER( hp48_state::hp48_reg_in ) +{ + int in = hp48_get_in(); + LOG(( "%s %f hp48_reg_in: %04x\n", + machine().describe_context(), machine().time().as_double(), in )); + return in; +} + +/* key detect */ +void hp48_state::hp48_update_kdn( ) +{ + int in = hp48_get_in(); + + /* interrupt on raising edge */ + if ( in && !m_kdn ) + { + LOG(( "%f hp48_update_kdn: interrupt\n", machine().time().as_double() )); + m_io[0x19] |= 8; /* service request */ + hp48_pulse_irq( SATURN_WAKEUP_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); + } + + m_kdn = (in!=0); +} + +/* periodic keyboard polling, generates an interrupt */ +TIMER_CALLBACK_MEMBER(hp48_state::hp48_kbd_cb) +{ + /* NMI for ON key */ + if ( ioport( "ON" )->read() ) + { + LOG(( "%f hp48_kbd_cb: keyboard interrupt, on key\n", + machine().time().as_double() )); + m_io[0x19] |= 8; /* set service request */ + hp48_pulse_irq( SATURN_WAKEUP_LINE ); + hp48_pulse_irq( SATURN_NMI_LINE ); + return; + } + + /* regular keys */ + hp48_update_kdn(); +} + +/* RSI opcode */ +WRITE_LINE_MEMBER( hp48_state::hp48_rsi ) +{ + LOG(( "%s %f hp48_rsi\n", machine().describe_context(), machine().time().as_double() )); + + /* enables interrupts on key repeat + (normally, there is only one interrupt, when the key is pressed) + */ + m_kdn = 0; +} + + +/* ------------- annonciators ------------ */ + +void hp48_state::hp48_update_annunciators() +{ + /* bit 0: left shift + bit 1: right shift + bit 2: alpha + bit 3: alert + bit 4: busy + bit 5: transmit + bit 7: master enable + */ + int markers = HP48_IO_8(0xb); + output_set_value( "lshift0", (markers & 0x81) == 0x81 ); + output_set_value( "rshift0", (markers & 0x82) == 0x82 ); + output_set_value( "alpha0", (markers & 0x84) == 0x84 ); + output_set_value( "alert0", (markers & 0x88) == 0x88 ); + output_set_value( "busy0", (markers & 0x90) == 0x90 ); + output_set_value( "transmit0", (markers & 0xb0) == 0xb0 ); +} + + +/* ------------- I/O registers ----------- */ + +/* Some part of the I/O registers are simple r/w registers. We store them in hp48_io. + Special cases are registers that: + - have a different meaning on read and write + - perform some action on read / write + */ + +WRITE8_MEMBER(hp48_state::hp48_io_w) +{ + LOG(( "%s %f hp48_io_w: off=%02x data=%x\n", + space.machine().describe_context(), space.machine().time().as_double(), offset, data )); + + switch( offset ) + { + /* CRC register */ + case 0x04: m_crc = (m_crc & 0xfff0) | data; break; + case 0x05: m_crc = (m_crc & 0xff0f) | (data << 4); break; + case 0x06: m_crc = (m_crc & 0xf0ff) | (data << 8); break; + case 0x07: m_crc = (m_crc & 0x0fff) | (data << 12); break; + + /* annunciators */ + case 0x0b: + case 0x0c: + m_io[offset] = data; + hp48_update_annunciators(); + break; + + /* cntrl ROM */ + case 0x29: + { + int old_cntrl = m_io[offset] & 8; + m_io[offset] = data; + if ( old_cntrl != (data & 8) ) + { + hp48_apply_modules(); + } + break; + } + + /* timers */ + case 0x37: m_timer1 = data; break; + case 0x38: m_timer2 = (m_timer2 & 0xfffffff0) | data; break; + case 0x39: m_timer2 = (m_timer2 & 0xffffff0f) | (data << 4); break; + case 0x3a: m_timer2 = (m_timer2 & 0xfffff0ff) | (data << 8); break; + case 0x3b: m_timer2 = (m_timer2 & 0xffff0fff) | (data << 12); break; + case 0x3c: m_timer2 = (m_timer2 & 0xfff0ffff) | (data << 16); break; + case 0x3d: m_timer2 = (m_timer2 & 0xff0fffff) | (data << 20); break; + case 0x3e: m_timer2 = (m_timer2 & 0xf0ffffff) | (data << 24); break; + case 0x3f: m_timer2 = (m_timer2 & 0x0fffffff) | (data << 28); break; + + /* cards */ + case 0x0e: + LOG(( "%s: card control write %02x\n", space.machine().describe_context(), data )); + + /* bit 0: software interrupt */ + if ( data & 1 ) + { + LOG(( "%f hp48_io_w: software interrupt requested\n", + space.machine().time().as_double() )); + hp48_pulse_irq( SATURN_IRQ_LINE ); + data &= ~1; + } + + /* XXX not implemented + bit 1: card test? + */ + + m_io[0x0e] = data; + break; + + case 0x0f: + LOG(( "%s: card info write %02x\n", space.machine().describe_context(), data )); + m_io[0x0f] = data; + break; + + /* serial */ + case 0x13: + m_io[0x11] &= ~4; /* clear error status */ + break; + case 0x16: + /* first nibble of sent data */ + m_io[offset] = data; + break; + case 0x17: + /* second nibble of sent data */ + m_io[offset] = data; + hp48_rs232_send_byte(); + break; + + /* XXX not implemented: + + - 0x0d: RS232c speed: + bits 0-2: speed + 000 = 1200 bauds + 010 = 2400 bauds + 100 = 4800 bauds + 110 = 9600 bauds + bit 3: ? + + - 0x1a: I/R input + bit 0: irq + bit 1: irq enable + bit 2: 1=RS232c mode 0=direct mode + bit 3: receiving + + - 0x1c: I/R output control + bit 0: buffer full + bit 1: transmitting + bit 2: irq enable on buffer empty + bit 3: led on (direct mode) + on HP49 G, flash ROM write enable + + - 0x1d: I/R output buffer + */ + + default: m_io[offset] = data; + } + +} + + +READ8_MEMBER(hp48_state::hp48_io_r) +{ + UINT8 data = 0; + + switch( offset ) + { + /* CRC register */ + case 0x04: data = m_crc & 0xf; break; + case 0x05: data = (m_crc >> 4) & 0xf; break; + case 0x06: data = (m_crc >> 8) & 0xf; break; + case 0x07: data = (m_crc >> 12) & 0xf; break; + + /* battery test */ + case 0x08: + data = 0; + if ( m_io[0x9] & 8 ) /* test enable */ + { + /* XXX not implemented: + bit 3: battery in port 2 + bit 2: battery in port 1 + */ + switch ( ioport( "BATTERY" )->read() ) + { + case 1: data = 2; break; /* low */ + case 2: data = 3; break; /* low | critical */ + } + } + break; + + /* remaining lines in main bitmap */ + case 0x28: + case 0x29: + { + int last_line = HP48_IO_8(0x28) & 0x3f; /* last line of main bitmap before menu */ + int cur_line = space.machine().first_screen()->vpos(); + if ( last_line <= 1 ) last_line = 0x3f; + data = ( cur_line >= 0 && cur_line <= last_line ) ? last_line - cur_line : 0; + if ( offset == 0x29 ) + { + data >>= 4; + data |= HP48_IO_4(0x29) & 0xc; + } + else + { + data &= 0xf; + } + break; + } + + /* timers */ + case 0x37: data = m_timer1; break; + case 0x38: data = m_timer2 & 0xf; break; + case 0x39: data = (m_timer2 >> 4) & 0xf; break; + case 0x3a: data = (m_timer2 >> 8) & 0xf; break; + case 0x3b: data = (m_timer2 >> 12) & 0xf; break; + case 0x3c: data = (m_timer2 >> 16) & 0xf; break; + case 0x3d: data = (m_timer2 >> 20) & 0xf; break; + case 0x3e: data = (m_timer2 >> 24) & 0xf; break; + case 0x3f: data = (m_timer2 >> 28) & 0xf; break; + + /* serial */ + case 0x15: + { + /* second nibble of received data */ + + //device_image_interface *xmodem = dynamic_cast(space.machine().device("rs232_x")); + //device_image_interface *kermit = dynamic_cast(space.machine().device("rs232_k")); + + m_io[0x11] &= ~1; /* clear byte received */ + data = m_io[offset]; + + /* protocol action */ + //if ( xmodem && xmodem->exists() ) xmodem_byte_transmitted( &xmodem->device() ); + //else if ( kermit && kermit->exists() ) kermit_byte_transmitted( &kermit->device() ); + break; + } + + /* cards */ + case 0x0e: /* detection */ + data = m_io[0x0e]; + LOG(( "%s: card control read %02x\n", space.machine().describe_context(), data )); + break; + case 0x0f: /* card info */ + data = 0; + if ( HP48_G_SERIES ) + { + if ( m_port_size[1] ) data |= 1; + if ( m_port_size[0] ) data |= 2; + if ( m_port_size[1] && m_port_write[1] ) data |= 4; + if ( m_port_size[0] && m_port_write[0] ) data |= 8; + } + else + { + if ( m_port_size[0] ) data |= 1; + if ( m_port_size[1] ) data |= 2; + if ( m_port_size[0] && m_port_write[0] ) data |= 4; + if ( m_port_size[1] && m_port_write[1] ) data |= 8; + } + LOG(( "%s: card info read %02x\n", space.machine().describe_context(), data )); + break; + + + default: data = m_io[offset]; + } + + LOG(( "%s %f hp48_io_r: off=%02x data=%x\n", + space.machine().describe_context(), space.machine().time().as_double(), offset, data )); + return data; +} + + +/* ---------- bank switcher --------- */ + +READ8_MEMBER(hp48_state::hp48_bank_r) +{ + /* HP48 GX + bit 0: ignored + bits 2-5: bank number + bit 6: enable + */ + + /* HP49 G + bit 0: ignored + bits 1-2: select bank 0x00000-0x3ffff + bits 3-6: select bank 0x40000-0x7ffff + */ + offset &= 0x7e; + if ( m_bank_switch != offset ) + { + LOG(( "%s %f hp48_bank_r: off=%03x\n", space.machine().describe_context(), space.machine().time().as_double(), offset )); + m_bank_switch = offset; + hp48_apply_modules(); + } + return 0; +} + + +WRITE8_MEMBER(hp48_state::hp49_bank_w) +{ + offset &= 0x7e; + if ( m_bank_switch != offset ) + { + LOG(( "%05x %f hp49_bank_w: off=%03x\n", space.device().safe_pcbase(), space.machine().time().as_double(), offset )); + m_bank_switch = offset; + hp48_apply_modules(); + } +} + + + +/* ---------------- timers --------------- */ + +TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer1_cb) +{ + if ( !(m_io[0x2f] & 1) ) return; /* timer enable */ + + m_timer1 = (m_timer1 - 1) & 0xf; + + /* wake-up on carry */ + if ( (m_io[0x2e] & 4) && (m_timer1 == 0xf) ) + { + LOG(( "wake-up on timer1\n" )); + m_io[0x2e] |= 8; /* set service request */ + m_io[0x18] |= 4; /* set service request */ + hp48_pulse_irq( SATURN_WAKEUP_LINE ); + } + /* interrupt on carry */ + if ( (m_io[0x2e] & 2) && (m_timer1 == 0xf) ) + { + LOG(( "generate timer1 interrupt\n" )); + m_io[0x2e] |= 8; /* set service request */ + m_io[0x18] |= 4; /* set service request */ + hp48_pulse_irq( SATURN_NMI_LINE ); + } +} + +TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer2_cb) +{ + if ( !(m_io[0x2f] & 1) ) return; /* timer enable */ + + m_timer2 = (m_timer2 - 1) & 0xffffffff; + + /* wake-up on carry */ + if ( (m_io[0x2f] & 4) && (m_timer2 == 0xffffffff) ) + { + LOG(( "wake-up on timer2\n" )); + m_io[0x2f] |= 8; /* set service request */ + m_io[0x18] |= 4; /* set service request */ + hp48_pulse_irq( SATURN_WAKEUP_LINE ); + } + /* interrupt on carry */ + if ( (m_io[0x2f] & 2) && (m_timer2 == 0xffffffff) ) + { + LOG(( "generate timer2 interrupt\n" )); + m_io[0x2f] |= 8; /* set service request */ + m_io[0x18] |= 4; /* set service request */ + hp48_pulse_irq( SATURN_NMI_LINE ); + } +} + + + + +/* --------- memory controller ----------- */ + +/* + Clark (S series) and York (G series) CPUs have 6 daisy-chained modules + + + <-- highest --------- priority ------------- lowest --> + + CPU --------------------------------------------------- + | | | | | | + HDW NCE2 CE1 CE2 NCE3 NCE1 + + + However, controller usage is different in both series: + + + controller 48 S series 48 G series 49 G series + (Clark CPU) (York CPU) (York CPU) + + HDW 32B I/O RAM 32B I/O RAM 32B I/O RAM + NCE2 32KB RAM 32/128KB RAM 256KB RAM + CE1 port1 bank switcher bank switcher + CE2 port2 port1 128KB RAM + NCE3 unused port2 128KB RAM + NCE1 256KB ROM 512KB ROM 2MB flash ROM + + + - NCE1 (ROM) cannot be configured, it is always visible at addresses + 00000-7ffff not covered by higher priority modules. + + - only the address of HDW (I/O) can be configured, its size is constant + (64 nibbles) + + - other modules can have their address & size set + + */ + + +/* remap all modules according to hp48_modules */ +void hp48_state::hp48_apply_modules() +{ + int i; + int nce3_enable = 1; + address_space& space = m_maincpu->space(AS_PROGRAM); + + m_io_addr = 0x100000; + + /* NCE1 (ROM) is a bit special, so treat it separately */ + space.unmap_readwrite( 0, 0xfffff, 0, 0 ); + if ( HP49_G_MODEL ) + { + int bank_lo = (m_bank_switch >> 5) & 3; + int bank_hi = (m_bank_switch >> 1) & 15; + LOG(( "hp48_apply_modules: low ROM bank is %i\n", bank_lo )); + LOG(( "hp48_apply_modules: high ROM bank is %i\n", bank_hi )); + space.install_read_bank( 0x00000, 0x3ffff, 0, 0x80000, "bank5" ); + space.install_read_bank( 0x40000, 0x7ffff, 0, 0x80000, "bank6" ); + if ( m_rom ) + { + membank("bank5")->set_base( m_rom + bank_lo * 0x40000 ); + membank("bank6")->set_base( m_rom + bank_hi * 0x40000 ); + } + } + else if ( HP48_G_SERIES ) + { + /* port 2 bank switch */ + if ( m_port_size[1] > 0 ) + { + int off = (m_bank_switch << 16) % m_port_size[1]; + LOG(( "hp48_apply_modules: port 2 offset is %i\n", off )); + m_modules[HP48_NCE3].data = m_port_data[1] + off; + } + + /* ROM A19 (hi 256 KB) / NCE3 (port 2) control switch */ + if ( m_io[0x29] & 8 ) + { + /* A19 */ + LOG(( "hp48_apply_modules: A19 enabled, NCE3 disabled\n" )); + nce3_enable = 0; + space.install_read_bank( 0, 0xfffff, 0, 0, "bank5" ); + } + else + { + /* NCE3 */ + nce3_enable = m_bank_switch >> 6; + LOG(( "hp48_apply_modules: A19 disabled, NCE3 %s\n", nce3_enable ? "enabled" : "disabled" )); + space.install_read_bank( 0, 0x7ffff, 0, 0x80000, "bank5" ); + } + if ( m_rom ) + membank("bank5")->set_base( m_rom ); + } + else + { + space.install_read_bank( 0, 0x7ffff, 0, 0x80000, "bank5" ); + if ( m_rom ) + membank("bank5")->set_base( m_rom ); + } + + + /* from lowest to highest priority */ + for ( i = 4; i >= 0; i-- ) + { + UINT32 select_mask = m_modules[i].mask; + UINT32 nselect_mask = ~select_mask & 0xfffff; + UINT32 base = m_modules[i].base; + UINT32 off_mask = m_modules[i].off_mask; + UINT32 mirror = nselect_mask & ~off_mask; + UINT32 end = base + (off_mask & nselect_mask); + char bank[10]; + sprintf(bank,"bank%d",i); + + if ( m_modules[i].state != HP48_MODULE_CONFIGURED ) continue; + + if ( (i == 4) && !nce3_enable ) continue; + + /* our code assumes that the 20-bit select_mask is all 1s followed by all 0s */ + if ( nselect_mask & (nselect_mask+1) ) + { + logerror( "hp48_apply_modules: invalid mask %05x for module %s\n", + select_mask, hp48_module_names[i] ); + continue; + } + + if (m_modules[i].data) + space.install_read_bank( base, end, 0, mirror, bank ); + else + { + if (!m_modules[i].read.isnull()) + space.install_read_handler( base, end, 0, mirror, m_modules[i].read ); + } + + if (m_modules[i].isnop) + space.nop_write(base, end, 0, mirror); + else + { + if (m_modules[i].data) + { + space.install_write_bank( base, end, 0, mirror, bank ); + } + else + { + if (!m_modules[i].write.isnull()) + space.install_write_handler( base, end, 0, mirror, m_modules[i].write ); + } + } + + LOG(( "hp48_apply_modules: module %s configured at %05x-%05x, mirror %05x\n", + hp48_module_names[i], base, end, mirror )); + + if ( m_modules[i].data ) + { + membank( bank )->set_base( m_modules[i].data ); + } + + if ( i == 0 ) + { + m_io_addr = base; + } + } +} + + +/* reset the configuration */ +void hp48_state::hp48_reset_modules( ) +{ + int i; + /* fixed size for HDW */ + m_modules[HP48_HDW].state = HP48_MODULE_MASK_KNOWN; + m_modules[HP48_HDW].mask = 0xfffc0; + /* unconfigure NCE2, CE1, CE2, NCE3 */ + for ( i = 1; i < 5; i++ ) + { + m_modules[i].state = HP48_MODULE_UNCONFIGURED; + } + + /* fixed configuration for NCE1 */ + m_modules[HP48_NCE1].state = HP48_MODULE_CONFIGURED; + m_modules[HP48_NCE1].base = 0; + m_modules[HP48_NCE1].mask = 0; + + hp48_apply_modules(); +} + + +/* RESET opcode */ +WRITE_LINE_MEMBER( hp48_state::hp48_mem_reset ) +{ + LOG(( "%s %f hp48_mem_reset\n", machine().describe_context(), machine().time().as_double() )); + hp48_reset_modules(); +} + + +/* CONFIG opcode */ +WRITE32_MEMBER( hp48_state::hp48_mem_config ) +{ + int i; + + LOG(( "%s %f hp48_mem_config: %05x\n", machine().describe_context(), machine().time().as_double(), data )); + + /* find the highest priority unconfigured module (except non-configurable NCE1)... */ + for ( i = 0; i < 5; i++ ) + { + /* ... first call sets the address mask */ + if ( m_modules[i].state == HP48_MODULE_UNCONFIGURED ) + { + m_modules[i].mask = data & 0xff000; + m_modules[i].state = HP48_MODULE_MASK_KNOWN; + break; + } + + /* ... second call sets the base address */ + if ( m_modules[i].state == HP48_MODULE_MASK_KNOWN ) + { + m_modules[i].base = data & m_modules[i].mask; + m_modules[i].state = HP48_MODULE_CONFIGURED; + LOG(( "hp48_mem_config: module %s configured base=%05x, mask=%05x\n", + hp48_module_names[i], m_modules[i].base, m_modules[i].mask )); + hp48_apply_modules(); + break; + } + } +} + + +/* UNCFG opcode */ +WRITE32_MEMBER( hp48_state::hp48_mem_unconfig ) +{ + int i; + LOG(( "%s %f hp48_mem_unconfig: %05x\n", machine().describe_context(), machine().time().as_double(), data )); + + /* find the highest priority fully configured module at address v (except NCE1)... */ + for ( i = 0; i < 5; i++ ) + { + /* ... and unconfigure it */ + if ( m_modules[i].state == HP48_MODULE_CONFIGURED && + (m_modules[i].base == (data & m_modules[i].mask)) ) + { + m_modules[i].state = i> 0 ? HP48_MODULE_UNCONFIGURED : HP48_MODULE_MASK_KNOWN; + LOG(( "hp48_mem_unconfig: module %s\n", hp48_module_names[i] )); + hp48_apply_modules(); + break; + } + } +} + + +/* C=ID opcode */ +READ32_MEMBER( hp48_state::hp48_mem_id ) +{ + int i; + int data = 0; /* 0 = everything is configured */ + + /* find the highest priority unconfigured module (except NCE1)... */ + for ( i = 0; i < 5; i++ ) + { + /* ... mask need to be configured */ + if ( m_modules[i].state == HP48_MODULE_UNCONFIGURED ) + { + data = hp48_module_mask_id[i] | (m_modules[i].mask & ~0xff); + break; + } + + /* ... address need to be configured */ + if ( m_modules[i].state == HP48_MODULE_MASK_KNOWN ) + { + data = hp48_module_addr_id[i] | (m_modules[i].base & ~0x3f); + break; + } + } + + LOG(( "%s %f hp48_mem_id = %02x\n", + machine().describe_context(), machine().time().as_double(), data )); + + return data; /* everything is configured */ +} + + + +/* --------- CRC ---------- */ + +/* each memory read by the CPU updates the internal CRC state */ +WRITE32_MEMBER( hp48_state::hp48_mem_crc ) +{ + /* no CRC for I/O RAM */ + if ( offset >= m_io_addr && offset < m_io_addr + 0x40 ) return; + + m_crc = (m_crc >> 4) ^ (((m_crc ^ data) & 0xf) * 0x1081); +} + + + +/* ------ utilities ------- */ + + +/* decodes size bytes into 2*size nibbles (least significant first) */ +void hp48_state::hp48_decode_nibble( UINT8* dst, UINT8* src, int size ) +{ + int i; + for ( i=size-1; i >= 0; i-- ) + { + dst[2*i+1] = src[i] >> 4; + dst[2*i] = src[i] & 0xf; + } +} + +/* inverse of hp48_decode_nibble */ +void hp48_state::hp48_encode_nibble( UINT8* dst, UINT8* src, int size ) +{ + int i; + for ( i=0; i < size; i++ ) + { + dst[i] = (src[2*i] & 0xf) | (src[2*i+1] << 4); + } +} + + + +/* ----- card images ------ */ +const device_type HP48_PORT = &device_creator; + +/* helper for load and create */ +void hp48_port_image_device::hp48_fill_port() +{ + hp48_state *state = machine().driver_data(); + int size = state->m_port_size[m_port]; + LOG(( "hp48_fill_port: %s module=%i size=%i rw=%i\n", tag(), m_module, size, state->m_port_write[m_port] )); + state->m_port_data[m_port] = global_alloc_array(UINT8, 2 * size); + memset( state->m_port_data[m_port], 0, 2 * size ); + state->m_modules[m_module].off_mask = 2 * (( size > 128 * 1024 ) ? 128 * 1024 : size) - 1; + state->m_modules[m_module].read = read8_delegate(); + state->m_modules[m_module].write = write8_delegate(); + state->m_modules[m_module].isnop = state->m_port_write[m_port] ? 0 : 1; + state->m_modules[m_module].data = state->m_port_data[m_port]; + state->hp48_apply_modules(); +} + +/* helper for start and unload */ +void hp48_port_image_device::hp48_unfill_port() +{ + hp48_state *state = machine().driver_data(); + LOG(( "hp48_unfill_port\n" )); + state->m_modules[m_module].off_mask = 0x00fff; /* 2 KB */ + state->m_modules[m_module].read = read8_delegate(); + state->m_modules[m_module].write = write8_delegate(); + state->m_modules[m_module].data = NULL; + state->m_modules[m_module].isnop = 1; + state->m_port_size[m_port] = 0; +} + + +bool hp48_port_image_device::call_load() +{ + hp48_state *state = machine().driver_data(); + int size = length(); + if ( size == 0 ) size = m_max_size; /* default size */ + LOG(( "hp48_port_image load: size=%i\n", size )); + + /* check size */ + if ( (size < 32*1024) || (size > m_max_size) || (size & (size-1)) ) + { + logerror( "hp48: image size for %s should be a power of two between %i and %i\n", tag(), 32*1024, m_max_size ); + return IMAGE_INIT_FAIL; + } + + state->m_port_size[m_port] = size; + state->m_port_write[m_port] = !is_readonly(); + hp48_fill_port( ); + fread(state->m_port_data[m_port], state->m_port_size[m_port] ); + state->hp48_decode_nibble( state->m_port_data[m_port], state->m_port_data[m_port], state->m_port_size[m_port] ); + return IMAGE_INIT_PASS; +} + +bool hp48_port_image_device::call_create(int format_type, option_resolution *format_options) +{ + hp48_state *state = machine().driver_data(); + int size = m_max_size; + LOG(( "hp48_port_image create: size=%i\n", size )); + /* XXX defaults to max_size; get user-specified size instead */ + + /* check size */ + /* size must be a power of 2 between 32K and max_size */ + if ( (size < 32*1024) || (size > m_max_size) || (size & (size-1)) ) + { + logerror( "hp48: image size for %s should be a power of two between %i and %i\n", tag(), 32*1024, m_max_size ); + return IMAGE_INIT_FAIL; + } + + state->m_port_size[m_port] = size; + state->m_port_write[m_port] = 1; + hp48_fill_port(); + return IMAGE_INIT_PASS; +} + +void hp48_port_image_device::call_unload() +{ + hp48_state *state = machine().driver_data(); + LOG(( "hp48_port image unload: %s size=%i rw=%i\n", + tag(), state->m_port_size[m_port], state->m_port_write[m_port] )); + if ( state->m_port_write[m_port] ) + { + state->hp48_encode_nibble( state->m_port_data[m_port], state->m_port_data[m_port], state->m_port_size[m_port] ); + fseek( 0, SEEK_SET ); + fwrite( state->m_port_data[m_port], state->m_port_size[m_port] ); + } + global_free_array( state->m_port_data[m_port] ); + hp48_unfill_port(); + state->hp48_apply_modules(); +} + +void hp48_port_image_device::device_start() +{ + LOG(("hp48_port_image start\n")); + hp48_unfill_port(); +} + +hp48_port_image_device::hp48_port_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, HP48_PORT, "HP48 memory card", tag, owner, clock, "hp48_port_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +void hp48_port_image_device::device_config_complete() +{ + update_names(HP48_PORT, "port", "p"); +} + +/*************************************************************************** + MACHINES +***************************************************************************/ + +DRIVER_INIT_MEMBER(hp48_state,hp48) +{ + int i; + LOG(( "hp48: driver init called\n" )); + for ( i = 0; i < 6; i++ ) + { + m_modules[i].off_mask = 0x00fff; /* 2 KB */ + m_modules[i].read = read8_delegate(); + m_modules[i].write = write8_delegate(); + m_modules[i].data = NULL; + m_modules[i].isnop = 0; + } + m_port_size[0] = 0; + m_port_size[1] = 0; + m_rom = NULL; +} + +void hp48_state::machine_reset() +{ + LOG(( "hp48: machine reset called\n" )); + m_bank_switch = 0; + hp48_reset_modules(); + hp48_update_annunciators(); +} + +void hp48_state::hp48_machine_start( hp48_models model ) +{ + UINT8 *ram; + int ram_size, rom_size, i; + + LOG(( "hp48_machine_start: model %i\n", model )); + + m_model = model; + + /* internal RAM */ + ram_size = + HP49_G_MODEL ? (512 * 1024) : + HP48_GX_MODEL ? (128 * 1024) : (32 * 1024); + + ram = auto_alloc_array(machine(), UINT8, 2 * ram_size); + machine().device("nvram")->set_base(ram, 2 * ram_size); + + + /* ROM load */ + rom_size = + HP49_G_MODEL ? (2048 * 1024) : + HP48_S_SERIES ? (256 * 1024) : (512 * 1024); + m_rom = auto_alloc_array(machine(), UINT8, 2 * rom_size); + hp48_decode_nibble( m_rom, memregion( "maincpu" )->base(), rom_size ); + + /* init state */ + memset( ram, 0, 2 * ram_size ); + memset( m_io, 0, sizeof( m_io ) ); + m_out = 0; + m_kdn = 0; + m_crc = 0; + m_timer1 = 0; + m_timer2 = 0; + m_bank_switch = 0; + + /* I/O RAM */ + m_modules[HP48_HDW].off_mask = 0x0003f; /* 32 B */ + m_modules[HP48_HDW].read = read8_delegate(FUNC(hp48_state::hp48_io_r),this); + m_modules[HP48_HDW].write = write8_delegate(FUNC(hp48_state::hp48_io_w),this); + + /* internal RAM */ + if ( HP49_G_MODEL ) + { + m_modules[HP48_NCE2].off_mask = 2 * 256 * 1024 - 1; + m_modules[HP48_NCE2].data = ram; + m_modules[HP48_CE2].off_mask = 2 * 128 * 1024 - 1; + m_modules[HP48_CE2].data = ram + 2 * 256 * 1024; + m_modules[HP48_NCE3].off_mask = 2 * 128 * 1024 - 1; + m_modules[HP48_NCE3].data = ram + 2 * (128+256) * 1024; + } + else + { + m_modules[HP48_NCE2].off_mask = 2 * ram_size - 1; + m_modules[HP48_NCE2].data = ram; + } + + /* bank switcher */ + if ( HP48_G_SERIES ) + { + m_modules[HP48_CE1].off_mask = 0x00fff; /* 2 KB */ + m_modules[HP48_CE1].read = read8_delegate(FUNC(hp48_state::hp48_bank_r),this); + m_modules[HP48_CE1].write = HP49_G_MODEL ? write8_delegate(FUNC(hp48_state::hp49_bank_w),this) : write8_delegate(); + } + + /* timers */ + machine().scheduler().timer_pulse(attotime::from_hz( 16 ), timer_expired_delegate(FUNC(hp48_state::hp48_timer1_cb),this)); + machine().scheduler().timer_pulse(attotime::from_hz( 8192 ), timer_expired_delegate(FUNC(hp48_state::hp48_timer2_cb),this)); + + /* 1ms keyboard polling */ + machine().scheduler().timer_pulse(attotime::from_msec( 1 ), timer_expired_delegate(FUNC(hp48_state::hp48_kbd_cb),this)); + + /* save state */ + save_item(NAME(m_out) ); + save_item(NAME(m_kdn) ); + save_item(NAME(m_io_addr) ); + save_item(NAME(m_crc) ); + save_item(NAME(m_timer1) ); + save_item(NAME(m_timer2) ); + save_item(NAME(m_bank_switch) ); + for ( i = 0; i < 6; i++ ) + { + save_item(m_modules[i].state, "globals/m_modules[i].state", i); + save_item(m_modules[i].base, "globals/m_modules[i].base", i); + save_item(m_modules[i].mask, "globals/m_modules[i].mask", i); + } + save_item(NAME(m_io) ); + machine().save().register_postload( save_prepost_delegate(FUNC(hp48_state::hp48_update_annunciators), this )); + machine().save().register_postload( save_prepost_delegate(FUNC(hp48_state::hp48_apply_modules), this )); + +} + + +MACHINE_START_MEMBER(hp48_state,hp48s) +{ + hp48_machine_start( HP48_S ); +} + + +MACHINE_START_MEMBER(hp48_state,hp48sx) +{ + hp48_machine_start( HP48_SX ); +} + + +MACHINE_START_MEMBER(hp48_state,hp48g) +{ + hp48_machine_start( HP48_G ); +} + +MACHINE_START_MEMBER(hp48_state,hp48gx) +{ + hp48_machine_start( HP48_GX ); +} + +MACHINE_START_MEMBER(hp48_state,hp48gp) +{ + hp48_machine_start( HP48_GP ); +} + +MACHINE_START_MEMBER(hp48_state,hp49g) +{ + hp48_machine_start( HP49_G ); +} diff --git a/src/mame/machine/ie15_kbd.c b/src/mame/machine/ie15_kbd.c new file mode 100644 index 00000000000..f98eb316092 --- /dev/null +++ b/src/mame/machine/ie15_kbd.c @@ -0,0 +1,325 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/*************************************************************************** + + 15WWW-97-006 keyboard, normally used with 15IE-00-013. + Irisha can use it too. + +***************************************************************************/ + +#include "machine/ie15_kbd.h" + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + + +ie15_keyboard_device::ie15_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , m_io_kbd0(*this, "TERM_LINE0") + , m_io_kbd1(*this, "TERM_LINE1") + , m_io_kbd2(*this, "TERM_LINE2") + , m_io_kbd3(*this, "TERM_LINE3") + , m_io_kbdc(*this, "TERM_LINEC") + , m_keyboard_cb(*this) +{ +} + +ie15_keyboard_device::ie15_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, IE15_KEYBOARD, "15WWW-97-006 Keyboard", tag, owner, clock, "ie15_keyboard", __FILE__) + , m_io_kbd0(*this, "TERM_LINE0") + , m_io_kbd1(*this, "TERM_LINE1") + , m_io_kbd2(*this, "TERM_LINE2") + , m_io_kbd3(*this, "TERM_LINE3") + , m_io_kbdc(*this, "TERM_LINEC") + , m_keyboard_cb(*this) +{ +} + +UINT8 ie15_keyboard_device::row_number(UINT32 code) +{ + if BIT(code,0) return 0; + if BIT(code,1) return 1; + if BIT(code,2) return 2; + if BIT(code,3) return 3; + if BIT(code,4) return 4; + if BIT(code,5) return 5; + if BIT(code,6) return 6; + if BIT(code,7) return 7; + if BIT(code,8) return 8; + if BIT(code,9) return 9; + if BIT(code,10) return 10; + if BIT(code,11) return 11; + if BIT(code,12) return 12; + if BIT(code,13) return 13; + if BIT(code,14) return 14; + if BIT(code,15) return 15; + return 0; +} + +UINT16 ie15_keyboard_device::keyboard_handler(UINT16 last_code, UINT8 *scan_line) +{ + int i; + UINT32 code = 0; + UINT16 key_code = 0; + UINT16 retVal = 0; + UINT8 ctrl = BIT(m_io_kbdc->read(), 0); + UINT8 shift = BIT(m_io_kbdc->read(), 1); + + i = *scan_line; + { + if (i == 0) code = m_io_kbd0->read(); + else + if (i == 1) code = m_io_kbd1->read(); + else + if (i == 2) code = m_io_kbd2->read(); + else + if (i == 3) code = m_io_kbd3->read(); + + if (code != 0) + { + if (!m_ruslat) + i += 4; + if (shift) + i += 8; + i <<= 4; + if (code < 0x10000) { + key_code = m_rom [i + row_number(code)]; + } else { + key_code = m_rom [i + row_number(code >> 16)*2 + 256]; + } + if (ctrl) { + key_code &= 0x1f; + } + retVal = key_code; + } else { + *scan_line += 1; + if (*scan_line==4) { + *scan_line = 0; + } + } + } + + // setup mode toggle + if (BIT(m_io_kbdc->read(), 2)) { + retVal |= (IE_KB_SDV << 8); + } + // aux keyboard flag + if (code & 0xe0e000) { + retVal |= (IE_KB_DK << 8); + } + // shift + if (shift) { + retVal |= (IE_KB_NR << 8); + } + // SI/SO handling + if ((key_code & 127) == IE_KB_SI) { + m_ruslat = 0; + } + if ((key_code & 127) == IE_KB_SO) { + m_ruslat = 1; + } + + return retVal; +} + +void ie15_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + UINT16 new_code; + new_code = keyboard_handler(m_last_code, &m_scan_line); + if ((m_last_code != new_code) /* && (new_code) */) + send_key(new_code); + m_last_code = new_code; +} + +/*************************************************************************** + VIDEO HARDWARE +***************************************************************************/ + +ROM_START( ie15_keyboard ) + ROM_REGION( 0x200, "ie15kbd", 0 ) + ROM_LOAD( "15bbb.rt5", 0x000, 0x200, CRC(e6a4226e) SHA1(0ee46f5be1b01fa917a6d483bb51463106ae441f) ) +ROM_END + +const rom_entry *ie15_keyboard_device::device_rom_region() const +{ + return ROM_NAME( ie15_keyboard ); +} + +static MACHINE_CONFIG_FRAGMENT( ie15_keyboard ) +MACHINE_CONFIG_END + +machine_config_constructor ie15_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(ie15_keyboard); +} + +void ie15_keyboard_device::device_start() +{ + m_keyboard_cb.resolve_safe(); + m_timer = timer_alloc(); + m_rom = (UINT8*)memregion("ie15kbd")->base(); +} + +void ie15_keyboard_device::device_reset() +{ + m_last_code = 0; + m_scan_line = 0; + m_ruslat = 0; + m_timer->adjust(attotime::from_hz(10000), 0, attotime::from_hz(10000)); +} + +/* +Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 Y10 Y11 Y12 Y13 Y14 Y15 Y16 Y17 Y18 Y19 Y20 Y21 Y22 Y23 Y24 +-- +;+ 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 -= 7 8 9 ?????? ???? ?????? ?????? ?????? f1 f2 f3 +??J ??C ??U ??K ??E ??N ??G ??[ ??] ??Z ??H :* 4 5 6 ???? ???? ????1 ??1 ????2 f4 f5 f6 +??F ??Y ??W ??A ??P ??R ??O ??L ??D ??V ??\ .> ???? 1 2 3 ?????? ?????? ?????? f7 f8 f9 +??Q ??^ ??S ??M ??I ??T ??X ??B ??@ ,< /? _ SPC 0 , fA fB fC + +rom: + +00000000 3b 31 32 33 34 35 36 37 38 39 30 2d 00 37 38 39 |;1234567890-.789| rus + upper +00000010 6a 63 75 6b 65 6e 67 7b 7d 7a 68 3a 00 34 35 36 |jcukeng{}zh:.456| +00000020 66 79 77 61 70 72 6f 6c 64 76 7c 2e 7f 31 32 33 |fywaproldv|..123| +00000030 71 7e 73 6d 69 74 78 62 60 2c 2f 7f 20 30 30 2c |q~smitxb`,/. 00,| + +00000040 3b 31 32 33 34 35 36 37 38 39 30 2d 00 37 38 39 |;1234567890-.789| lat + upper +00000050 4a 43 55 4b 45 4e 47 5b 5d 5a 48 3a 00 34 35 36 |JCUKENG[]ZH:.456| +00000060 46 59 57 41 50 52 4f 4c 44 56 5c 2e 7f 31 32 33 |FYWAPROLDV\..123| +00000070 51 5e 53 4d 49 54 58 42 40 2c 2f 5f 20 30 30 2c |Q^SMITXB@,/_ 00,| + +00000080 2b 21 22 23 24 25 26 27 28 29 30 3d 00 37 38 39 |+!"#$%&'()0=.789| rus + lower +00000090 4a 43 55 4b 45 4e 47 5b 5d 5a 48 2a 00 34 35 36 |JCUKENG[]ZH*.456| +000000a0 46 59 57 41 50 52 4f 4c 44 56 5c 3e 7f 31 32 33 |FYWAPROLDV\>.123| +000000b0 51 5e 53 4d 49 54 58 42 40 3c 3f 5f 20 30 30 2c |Q^SMITXB@.123| +000000f0 71 7e 73 6d 69 74 78 62 60 3c 3f 7f 20 30 30 2c |q~smitxb`') + PORT_BIT(0x001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x010000, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x020000, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRD") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRM") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRS") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("TERM_LINE3") + PORT_BIT(0x000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT(0x000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // PORT_CHAR('`') PORT_CHAR('@') // XXX + PORT_BIT(0x000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('_') // XXX + PORT_BIT(0x001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x004000, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lat (SO)") PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rus (SI)") PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x040000, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x080000, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x100000, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgDn") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) + PORT_BIT(0x400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Next SetUp") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) + + PORT_START("TERM_LINEC") + PORT_BIT(0x000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) +// PORT_BIT(0x000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SetUp") PORT_CODE(KEYCODE_RSHIFT) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT(0x000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SetUp") PORT_CODE(KEYCODE_PRTSCR) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) +INPUT_PORTS_END + +ioport_constructor ie15_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(ie15_keyboard); +} + +const device_type IE15_KEYBOARD = &device_creator; diff --git a/src/mame/machine/ie15_kbd.h b/src/mame/machine/ie15_kbd.h new file mode 100644 index 00000000000..49967d68eff --- /dev/null +++ b/src/mame/machine/ie15_kbd.h @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +#ifndef __IE15_KEYBOARD_H__ +#define __IE15_KEYBOARD_H__ + +#include "emu.h" + +#define IE_KB_ACK 1 + +#define IE_KB_RED 0x01 +#define IE_KB_SDV 0x02 +#define IE_KB_DUP 0x08 +#define IE_KB_LIN 0x10 +#define IE_KB_DK 0x20 +#define IE_KB_PCH 0x40 +#define IE_KB_NR 0x80 + +#define IE_KB_RED_BIT 0 +#define IE_KB_SDV_BIT 1 +#define IE_KB_DUP_BIT 3 +#define IE_KB_LIN_BIT 4 +#define IE_KB_DK_BIT 5 +#define IE_KB_PCH_BIT 6 +#define IE_KB_NR_BIT 7 + +#define IE_KB_SI 0x0f +#define IE_KB_SO 0x0e + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ + +#define MCFG_IE15_KEYBOARD_CB(_devcb) \ + devcb = &ie15_keyboard_device::set_keyboard_callback(*device, DEVCB_##_devcb); + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +class ie15_keyboard_device : + public device_t +{ +public: + ie15_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + ie15_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_keyboard_callback(device_t &device, _Object object) { return downcast(device).m_keyboard_cb.set_callback(object); } + + virtual ioport_constructor device_input_ports() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + +protected: + required_ioport m_io_kbd0; + required_ioport m_io_kbd1; + required_ioport m_io_kbd2; + required_ioport m_io_kbd3; + required_ioport m_io_kbdc; + + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void send_key(UINT16 code) { m_keyboard_cb((offs_t)0, code); } + emu_timer *m_timer; + +private: + virtual UINT16 keyboard_handler(UINT16 last_code, UINT8 *scan_line); + UINT8 row_number(UINT32 code); + UINT16 m_last_code; + UINT8 m_scan_line; + UINT8 m_ruslat; + UINT8 *m_rom; + + devcb_write16 m_keyboard_cb; +}; + +extern const device_type IE15_KEYBOARD; + +#endif /* __IE15_KEYBOARD_H__ */ diff --git a/src/mame/machine/intv.c b/src/mame/machine/intv.c new file mode 100644 index 00000000000..391abbd4150 --- /dev/null +++ b/src/mame/machine/intv.c @@ -0,0 +1,532 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,Frank Palazzolo +#include "emu.h" +#include "video/stic.h" +#include "includes/intv.h" +#include "cpu/cp1610/cp1610.h" + + + +WRITE16_MEMBER( intv_state::intvkbd_dualport16_w ) +{ + unsigned char *RAM; + + COMBINE_DATA(&m_intvkbd_dualport_ram[offset]); + + /* copy the LSB over to the 6502 OP RAM, in case they are opcodes */ + RAM = m_region_keyboard->base(); + RAM[offset] = (UINT8) (data >> 0); +} + +READ8_MEMBER( intv_state::intvkbd_dualport8_lsb_r ) +{ + return (UINT8) (m_intvkbd_dualport_ram[offset] >> 0); +} + +WRITE8_MEMBER( intv_state::intvkbd_dualport8_lsb_w ) +{ + unsigned char *RAM; + + m_intvkbd_dualport_ram[offset] &= ~0x00FF; + m_intvkbd_dualport_ram[offset] |= ((UINT16) data) << 0; + + /* copy over to the 6502 OP RAM, in case they are opcodes */ + RAM = m_region_keyboard->base(); + RAM[offset] = data; +} + + + +READ8_MEMBER( intv_state::intvkbd_dualport8_msb_r ) +{ + unsigned char rv; + + if (offset < 0x100) + { + switch (offset) + { + case 0x000: + rv = m_io_test->read() & 0x80; + logerror("TAPE: Read %02x from 0x40%02x - XOR Data?\n",rv,offset); + break; + case 0x001: + rv = (m_io_test->read() & 0x40) << 1; + logerror("TAPE: Read %02x from 0x40%02x - Sense 1?\n",rv,offset); + break; + case 0x002: + rv = (m_io_test->read() & 0x20) << 2; + logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset); + break; + case 0x003: + rv = (m_io_test->read() & 0x10) << 3; + logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset); + break; + case 0x004: + rv = (m_io_test->read() & 0x08) << 4; + logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset); + break; + case 0x005: + rv = (m_io_test->read() & 0x04) << 5; + logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset); + break; + case 0x006: + if (m_sr1_int_pending) + rv = 0x00; + else + rv = 0x80; + logerror("TAPE: Read %02x from 0x40%02x - SR1 Int Pending\n",rv,offset); + break; + case 0x007: + if (m_tape_int_pending) + rv = 0x00; + else + rv = 0x80; + logerror("TAPE: Read %02x from 0x40%02x - Tape? Int Pending\n",rv,offset); + break; + case 0x060: /* Keyboard Read */ + rv = 0xff; + if (m_intvkbd_keyboard_col < 10) + rv = m_intv_keyboard[m_intvkbd_keyboard_col]->read(); + break; + case 0x80: + rv = 0x00; + logerror("TAPE: Read %02x from 0x40%02x, clear tape int pending\n",rv,offset); + m_tape_int_pending = 0; + break; + case 0xa0: + rv = 0x00; + logerror("TAPE: Read %02x from 0x40%02x, clear SR1 int pending\n",rv,offset); + m_sr1_int_pending = 0; + break; + case 0xc0: + case 0xc1: + case 0xc2: + case 0xc3: + case 0xc4: + case 0xc5: + case 0xc6: + case 0xc7: + case 0xc8: + case 0xc9: + case 0xca: + case 0xcb: + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + /* TMS9927 regs */ + rv = intvkbd_tms9927_r(space, offset-0xc0); + break; + default: + rv = (m_intvkbd_dualport_ram[offset]&0x0300)>>8; + logerror("Unknown read %02x from 0x40%02x\n",rv,offset); + break; + } + return rv; + } + else + return (m_intvkbd_dualport_ram[offset]&0x0300)>>8; +} + +static const char *const tape_motor_mode_desc[8] = +{ + "IDLE", "IDLE", "IDLE", "IDLE", + "EJECT", "PLAY/RECORD", "REWIND", "FF" +}; + +WRITE8_MEMBER( intv_state::intvkbd_dualport8_msb_w ) +{ + unsigned int mask; + + if (offset < 0x100) + { + switch (offset) + { + case 0x020: + m_tape_motor_mode &= 3; + if (data & 1) + m_tape_motor_mode |= 4; + logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]); + break; + case 0x021: + m_tape_motor_mode &= 5; + if (data & 1) + m_tape_motor_mode |= 2; + logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]); + break; + case 0x022: + m_tape_motor_mode &= 6; + if (data & 1) + m_tape_motor_mode |= 1; + logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]); + break; + case 0x023: + case 0x024: + case 0x025: + case 0x026: + case 0x027: + m_tape_unknown_write[offset - 0x23] = (data & 1); + break; + case 0x040: + m_tape_unknown_write[5] = (data & 1); + break; + case 0x041: + if (data & 1) + logerror("TAPE: Tape Interrupts Enabled\n"); + else + logerror("TAPE: Tape Interrupts Disabled\n"); + m_tape_interrupts_enabled = (data & 1); + break; + case 0x042: + if (data & 1) + logerror("TAPE: Cart Bus Interrupts Disabled\n"); + else + logerror("TAPE: Cart Bus Interrupts Enabled\n"); + break; + case 0x043: + if (data & 0x01) + m_intvkbd_text_blanked = 0; + else + m_intvkbd_text_blanked = 1; + break; + case 0x044: + m_intvkbd_keyboard_col &= 0x0e; + m_intvkbd_keyboard_col |= (data&0x01); + break; + case 0x045: + m_intvkbd_keyboard_col &= 0x0d; + m_intvkbd_keyboard_col |= ((data&0x01)<<1); + break; + case 0x046: + m_intvkbd_keyboard_col &= 0x0b; + m_intvkbd_keyboard_col |= ((data&0x01)<<2); + break; + case 0x047: + m_intvkbd_keyboard_col &= 0x07; + m_intvkbd_keyboard_col |= ((data&0x01)<<3); + break; + case 0x80: + logerror("TAPE: Write to 0x40%02x, clear tape int pending\n",offset); + m_tape_int_pending = 0; + break; + case 0xa0: + logerror("TAPE: Write to 0x40%02x, clear SR1 int pending\n",offset); + m_sr1_int_pending = 0; + break; + case 0xc0: + case 0xc1: + case 0xc2: + case 0xc3: + case 0xc4: + case 0xc5: + case 0xc6: + case 0xc7: + case 0xc8: + case 0xc9: + case 0xca: + case 0xcb: + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + /* TMS9927 regs */ + intvkbd_tms9927_w(space, offset-0xc0, data); + break; + default: + logerror("%04X: Unknown write %02x to 0x40%02x\n",space.device().safe_pc(),data,offset); + break; + } + } + else + { + mask = m_intvkbd_dualport_ram[offset] & 0x00ff; + m_intvkbd_dualport_ram[offset] = mask | ((data<<8)&0x0300); + } +} + + +READ16_MEMBER( intv_state::intv_stic_r ) +{ + if (m_bus_copy_mode || !m_stic->read_stic_handshake()) + return m_stic->read(space, offset, mem_mask); + else + return offset; +} + +WRITE16_MEMBER( intv_state::intv_stic_w ) +{ + if (m_bus_copy_mode || !m_stic->read_stic_handshake()) + m_stic->write(space, offset, data, mem_mask); +} + + +READ16_MEMBER( intv_state::intv_gram_r ) +{ + //logerror("read: %d = GRAM(%d)\n",state->m_gram[offset],offset); + if (m_bus_copy_mode || !m_stic->read_stic_handshake()) + return m_stic->gram_read(space, offset, mem_mask); + else + return offset; +} + +WRITE16_MEMBER( intv_state::intv_gram_w ) +{ + if (m_bus_copy_mode || !m_stic->read_stic_handshake()) + m_stic->gram_write(space, offset, data, mem_mask); +} + +READ16_MEMBER( intv_state::intv_ram8_r ) +{ + //logerror("%x = ram8_r(%x)\n",state->m_ram8[offset],offset); + return (int)m_ram8[offset]; +} + +WRITE16_MEMBER( intv_state::intv_ram8_w ) +{ + //logerror("ram8_w(%x) = %x\n",offset,data); + m_ram8[offset] = data&0xff; +} + +READ16_MEMBER( intv_state::intv_ram16_r ) +{ + //logerror("%x = ram16_r(%x)\n",state->m_ram16[offset],offset); + return (int)m_ram16[offset]; +} + +WRITE16_MEMBER( intv_state::intv_ram16_w ) +{ + //logerror("%g: WRITING TO GRAM offset = %d\n",machine.time(),offset); + //logerror("ram16_w(%x) = %x\n",offset,data); + m_ram16[offset] = data & 0xffff; +} + +READ8_MEMBER( intv_state::intvkb_iocart_r ) +{ + if (m_iocart1->exists()) + return m_iocart1->read_rom(space, offset, mem_mask); + else if (m_iocart2->exists()) + return m_iocart2->read_rom(space, offset, mem_mask); + else + return m_region_keyboard->u8(offset + 0xe000); +} + + +/* Set Reset and INTR/INTRM Vector */ +void intv_state::machine_reset() +{ + m_maincpu->set_input_line_vector(CP1610_RESET, 0x1000); + + /* These are actually the same vector, and INTR is unused */ + m_maincpu->set_input_line_vector(CP1610_INT_INTRM, 0x1004); + m_maincpu->set_input_line_vector(CP1610_INT_INTR, 0x1004); + + /* Set initial PC */ + m_maincpu->set_state_int(CP1610_R7, 0x1000); +} + +void intv_state::machine_start() +{ + // TODO: split these for intvkbd & intvecs?? + for (int i = 0; i < 4; i++) + { + char str[8]; + sprintf(str, "KEYPAD%i", i + 1); + m_keypad[i] = ioport(str); + } + for (int i = 0; i < 4; i++) + { + char str[6]; + sprintf(str, "DISC%i", i + 1); + m_disc[i] = ioport(str); + } + for (int i = 0; i < 4; i++) + { + char str[7]; + sprintf(str, "DISCX%i", i + 1); + m_discx[i] = ioport(str); + sprintf(str, "DISCY%i", i + 1); + m_discy[i] = ioport(str); + } + + save_item(NAME(m_bus_copy_mode)); + save_item(NAME(m_backtab_row)); + save_item(NAME(m_ram16)); + save_item(NAME(m_sr1_int_pending)); + save_item(NAME(m_ram8)); + + // intvkbd + if (m_is_keybd) + { + for (int i = 0; i < 10; i++) + { + char str[5]; + sprintf(str, "ROW%i", i); + m_intv_keyboard[i] = ioport(str); + } + + save_item(NAME(m_intvkbd_text_blanked)); + save_item(NAME(m_intvkbd_keyboard_col)); + save_item(NAME(m_tape_int_pending)); + save_item(NAME(m_tape_interrupts_enabled)); + save_item(NAME(m_tape_unknown_write)); + save_item(NAME(m_tape_motor_mode)); + save_item(NAME(m_tms9927_num_rows)); + save_item(NAME(m_tms9927_cursor_col)); + save_item(NAME(m_tms9927_cursor_row)); + save_item(NAME(m_tms9927_last_row)); + } + + if (m_cart && m_cart->exists()) + { + // RAM + switch (m_cart->get_type()) + { + case INTV_RAM: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd000, 0xd7ff, read16_delegate(FUNC(intv_cart_slot_device::read_ram),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_ram),(intv_cart_slot_device*)m_cart)); + break; + case INTV_GFACT: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x8800, 0x8fff, read16_delegate(FUNC(intv_cart_slot_device::read_ram),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_ram),(intv_cart_slot_device*)m_cart)); + break; + case INTV_VOICE: + m_cart->late_subslot_setup(); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0080, 0x0081, read16_delegate(FUNC(intv_cart_slot_device::read_speech),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_speech),(intv_cart_slot_device*)m_cart)); + + // passthru for RAM-equipped carts + m_maincpu->space(AS_PROGRAM).install_write_handler(0x8800, 0x8fff, write16_delegate(FUNC(intv_cart_slot_device::write_88),(intv_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd000, 0xd7ff, write16_delegate(FUNC(intv_cart_slot_device::write_d0),(intv_cart_slot_device*)m_cart)); + break; + case INTV_ECS: + m_cart->late_subslot_setup(); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x00f0, 0x00ff, read16_delegate(FUNC(intv_cart_slot_device::read_ay),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_ay),(intv_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x4000, 0x47ff, read16_delegate(FUNC(intv_cart_slot_device::read_ram),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_ram),(intv_cart_slot_device*)m_cart)); + + m_maincpu->space(AS_PROGRAM).install_write_handler(0x2000, 0x2fff, write16_delegate(FUNC(intv_cart_slot_device::write_rom20),(intv_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x7000, 0x7fff, write16_delegate(FUNC(intv_cart_slot_device::write_rom70),(intv_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000, 0xefff, write16_delegate(FUNC(intv_cart_slot_device::write_rome0),(intv_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xf000, 0xffff, write16_delegate(FUNC(intv_cart_slot_device::write_romf0),(intv_cart_slot_device*)m_cart)); + + // passthru for Intellivoice expansion + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0080, 0x0081, read16_delegate(FUNC(intv_cart_slot_device::read_speech),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_speech),(intv_cart_slot_device*)m_cart)); + + // passthru for RAM-equipped carts + m_maincpu->space(AS_PROGRAM).install_write_handler(0x8800, 0x8fff, write16_delegate(FUNC(intv_cart_slot_device::write_88),(intv_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xd000, 0xd7ff, write16_delegate(FUNC(intv_cart_slot_device::write_d0),(intv_cart_slot_device*)m_cart)); + break; + } + + m_cart->save_ram(); + } +} + + +TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt_complete) +{ + m_maincpu->set_input_line(CP1610_INT_INTRM, CLEAR_LINE); + m_bus_copy_mode = 0; +} + +TIMER_CALLBACK_MEMBER(intv_state::intv_btb_fill) +{ + UINT8 row = m_backtab_row; + //m_maincpu->adjust_icount(-STIC_ROW_FETCH); + + for (int column = 0; column < STIC_BACKTAB_WIDTH; column++) + m_stic->write_to_btb(row, column, m_ram16[column + row * STIC_BACKTAB_WIDTH]); + + m_backtab_row += 1; +} + +INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt) +{ + int delay = m_stic->read_row_delay(); + m_maincpu->set_input_line(CP1610_INT_INTRM, ASSERT_LINE); + m_sr1_int_pending = 1; + m_bus_copy_mode = 1; + m_backtab_row = 0; + + m_maincpu->adjust_icount(-(12*STIC_ROW_BUSRQ+STIC_FRAME_BUSRQ)); // Account for stic cycle stealing + timer_set(m_maincpu->cycles_to_attotime(STIC_VBLANK_END), TIMER_INTV_INTERRUPT_COMPLETE); + for (int row = 0; row < STIC_BACKTAB_HEIGHT; row++) + { + timer_set(m_maincpu->cycles_to_attotime(STIC_FIRST_FETCH-STIC_FRAME_BUSRQ+STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*delay + (STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*STIC_CARD_HEIGHT - STIC_ROW_BUSRQ)*row), TIMER_INTV_BTB_FILL); + } + + if (delay == 0) + { + m_maincpu->adjust_icount(-STIC_ROW_BUSRQ); // extra row fetch occurs if vertical delay == 0 + } + + m_stic->screenrefresh(); +} + +/* hand 0 == left, 1 == right, 2 == ECS hand controller 1, 3 == ECS hand controller 2 */ +UINT8 intv_state::intv_control_r(int hand) +{ + static const UINT8 keypad_table[] = + { + 0xFF, 0x3F, 0x9F, 0x5F, 0xD7, 0xB7, 0x77, 0xDB, + 0xBB, 0x7B, 0xDD, 0xBD, 0x7D, 0xDE, 0xBE, 0x7E + }; + + static const UINT8 disc_table[] = + { + 0xF3, 0xE3, 0xE7, 0xF7, 0xF6, 0xE6, 0xEE, 0xFE, + 0xFC, 0xEC, 0xED, 0xFD, 0xF9, 0xE9, 0xEB, 0xFB + }; + + static const UINT8 discyx_table[5][5] = + { + { 0xE3, 0xF3, 0xFB, 0xEB, 0xE9 }, + { 0xE7, 0xE3, 0xFB, 0xE9, 0xF9 }, + { 0xF7, 0xF7, 0xFF, 0xFD, 0xFD }, + { 0xF6, 0xE6, 0xFE, 0xEC, 0xED }, + { 0xE6, 0xEE, 0xFE, 0xFC, 0xEC } + }; + + int x, y; + UINT8 rv = 0xFF; + + /* keypad */ + x = m_keypad[hand]->read(); + for (y = 0; y < 16; y++) + { + if (x & (1 << y)) + { + rv &= keypad_table[y]; + } + } + + switch ((m_io_options->read() >> hand) & 1) + { + case 0: /* disc == digital */ + default: + + x = m_disc[hand]->read(); + for (y = 0; y < 16; y++) + { + if (x & (1 << y)) + { + rv &= disc_table[y]; + } + } + break; + + case 1: /* disc == _fake_ analog */ + + x = m_discx[hand]->read(); + y = m_discy[hand]->read(); + rv &= discyx_table[y / 32][x / 32]; + } + + return rv; +} + +READ8_MEMBER( intv_state::intv_left_control_r ) +{ + return intv_control_r(0); +} + +READ8_MEMBER( intv_state::intv_right_control_r ) +{ + return intv_control_r(1); +} diff --git a/src/mame/machine/isbc_215g.c b/src/mame/machine/isbc_215g.c new file mode 100644 index 00000000000..000c620d1a7 --- /dev/null +++ b/src/mame/machine/isbc_215g.c @@ -0,0 +1,433 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +// Currently only emulates Shugart SA1000 interface disks (aka ST506) +// despite the controller supporting many different disk types (hard sectored, onboard controllers, ANSI X3T9) +// Xenix supports the Quantum Q540 CHS 512,8,9 with 1024B sectors + +// TODO: multibus + +#include "isbc_215g.h" + +const device_type ISBC_215G = &device_creator; + +isbc_215g_device::isbc_215g_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ISBC_215G, "ISBC 215G Winchester Disk Controller", tag, owner, clock, "isbc_215g", __FILE__), + m_dmac(*this, "u84"), + m_hdd0(*this, "drive0"), + m_hdd1(*this, "drive1"), + m_sbx1(*this, "sbx1"), + m_sbx2(*this, "sbx2"), + m_out_irq_func(*this) +{ +} + +void isbc_215g_device::find_sector() +{ + //sector id + // 0/6-7: sector type - 0-data, 1-alternate, 2-bad, 3-invalid + // 0/4-5: size - 128<> 4) & 3); + + if(!m_geom[m_drive]) + return; + + if(m_cyl[m_drive] != cyl) + return; + + if((m_idcompare[3] != m_head) || (m_head > m_geom[m_drive]->heads)) + return; + + if(m_idcompare[2] > m_geom[m_drive]->sectors) + return; + + if(bps != m_geom[m_drive]->sectorbytes) + return; + + if(m_idcompare[0] >> 6) + return; + + m_idfound = true; + m_lba[m_drive] = (cyl * m_geom[m_drive]->heads + m_head) * m_geom[m_drive]->sectors + m_idcompare[2]; + m_secoffset = 0; + return; +} + +UINT16 isbc_215g_device::read_sector() +{ + UINT16 wps = 64 << ((m_idcompare[0] >> 4) & 3); + harddisk_image_device *drive = (m_drive ? m_hdd1 : m_hdd0); + if(!m_secoffset) + hard_disk_read(drive->get_hard_disk_file(), m_lba[m_drive], m_sector); + if(m_secoffset >= wps) + return 0; + return m_sector[m_secoffset++]; +} + +bool isbc_215g_device::write_sector(UINT16 data) +{ + UINT16 wps = 64 << ((m_idcompare[0] >> 4) & 3); + harddisk_image_device *drive = (m_drive ? m_hdd1 : m_hdd0); + if(m_secoffset >= wps) + return true; + m_sector[m_secoffset++] = data; + if(m_secoffset == wps) + { + hard_disk_write(drive->get_hard_disk_file(), m_lba[m_drive], m_sector); + return true; + } + return false; +} + +READ16_MEMBER(isbc_215g_device::io_r) +{ + UINT16 data = 0; + switch(offset) + { + case 0x00: + //read status + // 0: gnd + // 1: drive ready + // 2: seek done + // 3: sector sync found + // 4: fault + // 5: bus ack + // 6: sector id not found or bad ecc + // 7: timeout + // 8: sbx 1 present + // 9: sbx 1 int 0 + // a: sbx 1 int 1 + // b: sbx 1 opt 0 + // c: sbx 1 opt 1 + // d: illegal req/vendor 2 + // e: drive req + // f: index latch + data |= (!m_idfound) << 6; + data |= (m_sbx1->get_card_device() ? 0 : 1) << 8; + data |= m_isbx_irq[0] << 9; + data |= m_isbx_irq[1] << 10; + data |= ((m_index--) <= 0) ? 0x8000 : 0; // fake an index pulse + break; + case 0x04: + //read status 2 + // 0: sbx 2 present + // 1: sbx 2 int 0 + // 2: sbx 2 int 1 + // 3: sbx 2 opt 0 + // 4: sbx 2 opt 1 + // 5: vendor bit 0 + // 6: track 0/busy + // 7: wp + data |= m_sbx2->get_card_device() ? 0 : 1; + data |= m_isbx_irq[2] << 1; + data |= m_isbx_irq[3] << 2; + data |= (!m_cyl[m_drive]) ? 0 : 0x40; + break; + case 0x08: + //cmd data bus + break; + case 0x0c: + // reset channel 2 + if(space.debugger_access()) // reading this is bad + break; + m_dmac->sel_w(1); + m_dmac->ca_w(1); + m_dmac->ca_w(0); + m_dmac->sel_w(0); + break; + case 0x10: + //pit ch 0 + break; + case 0x11: + //pit ch 1 + break; + case 0x12: + //pit ch 2 + break; + case 0x14: + //read buffer + if(m_rdgate && !m_amsrch && m_geom[m_drive]) + data = read_sector(); + break; + case 0x18: + //vendor bit 1,3-4 + data |= 3<<4 | 2; + break; + default: + logerror("isbc_215g: invalid port read 0x80%02x\n", offset*2); + break; + } + return data; +} + +WRITE16_MEMBER(isbc_215g_device::io_w) +{ + switch(offset) + { + case 0x00: + //control, 0x8002 doesn't set gates or search + // 0: wr gate + // 1: rd gate + // 2: address mark search + // 3: cmd bus enable + // 4: drive sel/head sel 2 + // 5: safe/head sel 1 + // 6: b ack + // 7: drive reg addr 0/step dir + // 8: drive reg addr 1 + // 9: cmd/rd + // a: para/head sel 0 + m_wrgate = data & 1; + m_rdgate = (data >> 1) & 1; + m_amsrch = (data >> 2) & 1; + if(m_wrgate && (m_rdgate || m_amsrch)) + logerror("isbc_215g: both write gate and read gate and/or address search enabled\n"); + else if(m_rdgate && m_amsrch) + find_sector(); + else if(m_amsrch) + logerror("isbc_215g: address search without read gate\n"); + case 0x01: + m_stepdir = (data & 0x80) ? 1 : 0; + break; + case 0x04: + //clear index and id latch + m_index = 10; + m_idfound = false; + break; + case 0x08: + //cmd data bus/head sel + m_head = data & 7; + m_out_irq_func((data & 0x100) ? 1 : 0); + break; + case 0x0c: + //unit select + // 0: step/wr + // 1: sbx 1 opt 0/1 (sbx2?) + // 2: sbx 2 opt 0/1 + // 3: unit select 0 + // 4: unit select 1 + // 5: extr 2 + // 6: format + // 7: format wr gate + if(!m_step && (data & 1) && m_geom[m_drive]) + { + if(m_cyl[m_drive] && !m_stepdir) + m_cyl[m_drive]--; + else if((m_cyl[m_drive] < m_geom[m_drive]->cylinders) && m_stepdir) + m_cyl[m_drive]++; + } + m_step = data & 1; + m_drive = (data >> 3) & 1; // shugart interface, two drives only + if(((data >> 1) & 1) != m_fdctc) + { + m_fdctc = !m_fdctc; + m_sbx2->opt0_w(m_fdctc); + } + if((data & 0xc0) == 0xc0) // low-level format + { + if(!m_format) + m_format_bytes = 5; // sync + sector id + m_format = true; + } + else + m_format = false; + break; + case 0x10: + //pit ch 0 + break; + case 0x11: + //pit ch 1 + break; + case 0x12: + //pit ch 2 + break; + case 0x13: + //pit control + break; + case 0x14: + //write buffer + if(m_wrgate) + { + if(m_format) + { + m_format_bytes -= 2; + if(m_format_bytes <= 0) + { + m_dmac->ext1_w(1); + m_dmac->ext1_w(0); + m_format_bytes = 5; + } + } + else + { + if(m_geom[m_drive]) + { + if(write_sector(data)) + { + m_dmac->ext1_w(1); + m_dmac->ext1_w(0); + } + } + } + } + break; + case 0x18: + //sector id/format + m_idcompare[1] = data & 0xff; + m_idcompare[0] = data >> 8; + break; + case 0x1c: + //sector id low + m_idcompare[3] = data & 0xff; + m_idcompare[2] = data >> 8; + break; + default: + logerror("isbc_215g: invalid port write 0x80%02x\n", offset*2); + break; + } +} + +READ16_MEMBER(isbc_215g_device::mem_r) +{ + // XXX: hack to permit debugger to disassemble rom + if(space.debugger_access() && (offset < 0x1fff)) + return m_dmac->space(AS_IO).read_word_unaligned(offset*2); + + switch(offset) + { + case 0x7fffb: + return 1; + case 0x7fffc: + return 0; + case 0x7fffd: + return m_wakeup; + default: + return m_maincpu_mem->read_word_unaligned(offset*2, mem_mask); + } +} + +WRITE16_MEMBER(isbc_215g_device::mem_w) +{ + m_maincpu_mem->write_word_unaligned(offset*2, data, mem_mask); +} + +static ADDRESS_MAP_START(isbc_215g_mem, AS_PROGRAM, 16, isbc_215g_device) + AM_RANGE(0x00000, 0xfffff) AM_READWRITE(mem_r, mem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(isbc_215g_io, AS_IO, 16, isbc_215g_device) + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("i8089", 0) + AM_RANGE(0x4000, 0x47ff) AM_MIRROR(0x3800) AM_RAM + AM_RANGE(0x8000, 0x8039) AM_MIRROR(0x3fc0) AM_READWRITE(io_r, io_w) + AM_RANGE(0xc070, 0xc08f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) + AM_RANGE(0xc0b0, 0xc0bf) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) + AM_RANGE(0xc0d0, 0xc0df) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) + AM_RANGE(0xc0e0, 0xc0ef) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) +ADDRESS_MAP_END + +WRITE_LINE_MEMBER(isbc_215g_device::isbx_irq_00_w) +{ + m_isbx_irq[0] = state ? true : false; +} + +WRITE_LINE_MEMBER(isbc_215g_device::isbx_irq_01_w) +{ + m_isbx_irq[1] = state ? true : false; +} + +WRITE_LINE_MEMBER(isbc_215g_device::isbx_irq_10_w) +{ + m_isbx_irq[2] = state ? true : false; +} + +WRITE_LINE_MEMBER(isbc_215g_device::isbx_irq_11_w) +{ + m_isbx_irq[3] = state ? true : false; +} + +static MACHINE_CONFIG_FRAGMENT( isbc_215g ) + MCFG_CPU_ADD("u84", I8089, XTAL_15MHz / 3) + MCFG_CPU_PROGRAM_MAP(isbc_215g_mem) + MCFG_CPU_IO_MAP(isbc_215g_io) + MCFG_I8089_DATABUS_WIDTH(16) + + MCFG_HARDDISK_ADD("drive0") + MCFG_HARDDISK_ADD("drive1") + + MCFG_ISBX_SLOT_ADD("sbx1", 0, isbx_cards, NULL) + MCFG_ISBX_SLOT_MINTR0_CALLBACK(WRITELINE(isbc_215g_device, isbx_irq_00_w)) + MCFG_ISBX_SLOT_MINTR1_CALLBACK(WRITELINE(isbc_215g_device, isbx_irq_01_w)) + MCFG_ISBX_SLOT_ADD("sbx2", 0, isbx_cards, "fdc_218a") + MCFG_ISBX_SLOT_MINTR0_CALLBACK(WRITELINE(isbc_215g_device, isbx_irq_10_w)) + MCFG_ISBX_SLOT_MINTR1_CALLBACK(WRITELINE(isbc_215g_device, isbx_irq_11_w)) +MACHINE_CONFIG_END + +machine_config_constructor isbc_215g_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( isbc_215g ); +} + +ROM_START( isbc_215g ) + ROM_REGION( 0x4000, "i8089", ROMREGION_ERASEFF ) + ROM_LOAD16_BYTE( "174581.001.bin", 0x0000, 0x2000, CRC(ccdbc7ab) SHA1(5c2ebdde1b0252124177221ba9cacdb6d925a24d)) + ROM_LOAD16_BYTE( "174581.002.bin", 0x0001, 0x2000, CRC(6190fa67) SHA1(295dd4e75f699aaf93227cc4876cee8accae383a)) +ROM_END + +const rom_entry *isbc_215g_device::device_rom_region() const +{ + return ROM_NAME( isbc_215g ); +} + +void isbc_215g_device::device_reset() +{ + if(m_hdd0->get_hard_disk_file()) + m_geom[0] = hard_disk_get_info(m_hdd0->get_hard_disk_file()); + else + m_geom[0] = 0; + if(m_hdd1->get_hard_disk_file()) + m_geom[1] = hard_disk_get_info(m_hdd1->get_hard_disk_file()); + else + m_geom[1] = 0; + + m_reset = false; + m_fdctc = false; + m_isbx_irq[0] = m_isbx_irq[1] = m_isbx_irq[2] = m_isbx_irq[3] = false; +} + +void isbc_215g_device::device_start() +{ + m_maincpu_mem = &machine().device(m_maincpu_tag)->space(AS_PROGRAM); + m_cyl[0] = m_cyl[1] = 0; + m_lba[0] = m_lba[1] = 0; + m_idcompare[0] = m_idcompare[1] = m_idcompare[2] = m_idcompare[3] = 0; + m_index = 10; + m_idfound = false; + m_drive = 0; + m_head = 0; + m_stepdir = false; + m_step = false; + m_format = false; + m_wrgate = false; + m_rdgate = false; + m_format_bytes = 0; + m_out_irq_func.resolve_safe(); + +} + +WRITE8_MEMBER(isbc_215g_device::write) +{ + if(!offset) + { + data &= 3; + if(!data && (m_reset == 2)) + m_dmac->reset(); + m_out_irq_func(0); + m_dmac->ca_w(data == 1); + m_dmac->ca_w(0); + m_reset = data; + } +} diff --git a/src/mame/machine/isbc_215g.h b/src/mame/machine/isbc_215g.h new file mode 100644 index 00000000000..f636de93cb9 --- /dev/null +++ b/src/mame/machine/isbc_215g.h @@ -0,0 +1,77 @@ +// license:BSD-3-Clause +// copyright-holders:Carl + +#ifndef ISBC_215G_H_ +#define ISBC_215G_H_ + +#include "emu.h" +#include "cpu/i8089/i8089.h" +#include "bus/isbx/isbx.h" +#include "imagedev/harddriv.h" + +class isbc_215g_device : public device_t +{ +public: + isbc_215g_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual machine_config_constructor device_mconfig_additions() const; + const rom_entry *device_rom_region() const; + + DECLARE_WRITE8_MEMBER(write); + DECLARE_READ16_MEMBER(io_r); + DECLARE_WRITE16_MEMBER(io_w); + DECLARE_READ16_MEMBER(mem_r); + DECLARE_WRITE16_MEMBER(mem_w); + + DECLARE_WRITE_LINE_MEMBER(isbx_irq_00_w); + DECLARE_WRITE_LINE_MEMBER(isbx_irq_01_w); + DECLARE_WRITE_LINE_MEMBER(isbx_irq_10_w); + DECLARE_WRITE_LINE_MEMBER(isbx_irq_11_w); + + static void static_set_wakeup_addr(device_t &device, UINT32 wakeup) { downcast(device).m_wakeup = wakeup; } + static void static_set_maincpu_tag(device_t &device, const char *maincpu_tag) { downcast(device).m_maincpu_tag = maincpu_tag; } + template static devcb_base &static_set_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_func.set_callback(object); } + +protected: + virtual void device_start(); + virtual void device_reset(); + +private: + void find_sector(); + UINT16 read_sector(); + bool write_sector(UINT16 data); + + required_device m_dmac; + required_device m_hdd0; + required_device m_hdd1; + required_device m_sbx1; + required_device m_sbx2; + + devcb_write_line m_out_irq_func; + + int m_reset; + UINT16 m_wakeup, m_secoffset, m_sector[512]; + const char *m_maincpu_tag; + address_space *m_maincpu_mem; + UINT32 m_lba[2]; + UINT16 m_cyl[2]; + UINT8 m_idcompare[4], m_drive, m_head, m_index; + INT8 m_format_bytes; + bool m_idfound, m_stepdir, m_wrgate, m_rdgate, m_amsrch; + + bool m_isbx_irq[4], m_fdctc, m_step, m_format; + + const struct hard_disk_info* m_geom[2]; +}; + +#define MCFG_ISBC_215_ADD(_tag, _wakeup, _maincpu_tag) \ + MCFG_DEVICE_ADD(_tag, ISBC_215G, 0) \ + isbc_215g_device::static_set_wakeup_addr(*device, _wakeup); \ + isbc_215g_device::static_set_maincpu_tag(*device, _maincpu_tag); + +#define MCFG_ISBC_215_IRQ(_irq_line) \ + devcb = &isbc_215g_device::static_set_irq_callback(*device, DEVCB_##_irq_line); + +extern const device_type ISBC_215G; + +#endif /* ISBC_215G_H_ */ diff --git a/src/mame/machine/k7659kb.c b/src/mame/machine/k7659kb.c new file mode 100644 index 00000000000..5b46d8a9814 --- /dev/null +++ b/src/mame/machine/k7659kb.c @@ -0,0 +1,311 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/********************************************************************** + + K7659 keyboard emulation + +*********************************************************************/ + +#include "k7659kb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type K7659_KEYBOARD = &device_creator; + + + +//------------------------------------------------- +// ROM( k7659_keyboard ) +//------------------------------------------------- + +ROM_START( k7659_keyboard ) + ROM_REGION(0x0800, "k7659",0) + ROM_LOAD ("k7659n.bin", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *k7659_keyboard_device::device_rom_region() const +{ + return ROM_NAME( k7659_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( kb_io ) +//------------------------------------------------- + + + +//------------------------------------------------- +// DISCRETE_SOUND_START( k7659kb ) +//------------------------------------------------- + + + +//------------------------------------------------- +// MACHINE_DRIVER( k7659_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( k7659_keyboard ) + +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor k7659_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( k7659_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( k7659_keyboard ) +//------------------------------------------------- + +static INPUT_PORTS_START( k7659_keyboard ) + PORT_START("A1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) + PORT_START("A2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xff) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) + PORT_START("A3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) + PORT_START("A4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 /") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_START("A5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". :") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR('0') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('|') PORT_CHAR('\\') PORT_CHAR(0x1c) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_START("A6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('~') PORT_CHAR('?') PORT_CHAR(0x1e) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("} ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('}') PORT_CHAR(']') PORT_CHAR(0x1d) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("{ [") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('{') PORT_CHAR('[') PORT_CHAR(0x1b) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ *") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("# '") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') PORT_CHAR('\'') PORT_CHAR(0x1f) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_COLON) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) + PORT_START("A7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(">") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("04") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x04) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("01") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x01) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(' ') PORT_CHAR('`') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) PORT_CHAR(0x1b) PORT_CHAR(0x1f) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("13") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x13) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("06") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x06) + PORT_START("A8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_START("A9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_END) PORT_CHAR(0x0c) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x1e) PORT_CHAR(0x1f) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F01") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x05) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F02") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x18) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F03") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x13) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F04") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x04) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F06") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x03) + PORT_START("A10") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F07") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x1a) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F08") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x17) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F09") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x07) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x14) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x19) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x02) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F13") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x0b) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F14") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x11) + PORT_START("A11") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F05") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x12) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(0x1a) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(0x0a) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(0x15) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(0x08) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E95") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0xff) + PORT_START("A12") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor k7659_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( k7659_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// k7659_keyboard_device - constructor +//------------------------------------------------- + +k7659_keyboard_device::k7659_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K7659_KEYBOARD, "K7659 Keyboard", tag, owner, clock, "k7659kb", __FILE__) +{} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k7659_keyboard_device::device_start() +{ + m_timer = timer_alloc(); + // state saving + //save_item(NAME(m_y)); + //save_item(NAME(m_so)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k7659_keyboard_device::device_reset() +{ + m_lookup = 0; + m_p_rom = memregion("k7659")->base(); + m_timer->adjust(attotime::from_hz(200), 0, attotime::from_hz(200)); +} + +void k7659_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + UINT8 retVal = 0;//m_lookup; + UINT8 a1 = ioport("A1")->read(); + UINT8 a2 = ioport("A2")->read(); + UINT8 a3 = ioport("A3")->read(); + UINT8 a4 = ioport("A4")->read(); + UINT8 a5 = ioport("A5")->read(); + UINT8 a6 = ioport("A6")->read(); + UINT8 a7 = ioport("A7")->read(); + UINT8 a8 = ioport("A8")->read(); + UINT8 a9 = ioport("A9")->read(); + UINT8 a10 = ioport("A10")->read(); + UINT8 a11 = ioport("A11")->read(); + UINT8 a12 = ioport("A12")->read(); + UINT16 code = 0; + if (a1) + code = 0x10 + key_pos(a1); + else if (a2) + code = 0x20 + key_pos(a2); + else if (a3) + code = 0x30 + key_pos(a3); + else if (a4) + code = 0x40 + key_pos(a4); + else if (a5) + code = 0x50 + key_pos(a5); + else if (a6) + code = 0x60 + key_pos(a6); + else if (a7) + code = 0x70 + key_pos(a7); + else if (a9) + code = 0x80 + key_pos(a9); + else if (a10) + code = 0x90 + key_pos(a10); + else if (a11) + code = 0xA0 + key_pos(a11); + + if (code) + { + if (BIT(a8,6) || BIT(a8,7)) + code |= 0x100; + else + if (BIT(a12,6)) + code |= 0x200; + + m_lookup = m_p_rom[code]; + retVal = m_lookup | 0x80; + } + m_key = retVal; +} + +UINT8 k7659_keyboard_device::key_pos(UINT8 val) +{ + if (BIT(val,0)) return 1; + if (BIT(val,1)) return 2; + if (BIT(val,2)) return 3; + if (BIT(val,3)) return 4; + if (BIT(val,4)) return 5; + if (BIT(val,5)) return 6; + if (BIT(val,6)) return 7; + if (BIT(val,7)) return 8; + return 0; +} + +READ8_MEMBER(k7659_keyboard_device::read) +{ + return m_key; +} diff --git a/src/mame/machine/k7659kb.h b/src/mame/machine/k7659kb.h new file mode 100644 index 00000000000..2dc4db24747 --- /dev/null +++ b/src/mame/machine/k7659kb.h @@ -0,0 +1,75 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/********************************************************************** + + K7659 keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __K7659_KEYBOARD__ +#define __K7659_KEYBOARD__ + + +#include "emu.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define K7659_KEYBOARD_TAG "k7659kb" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_K7659_KEYBOARD_ADD() \ + MCFG_DEVICE_ADD(K7659_KEYBOARD_TAG, K7659_KEYBOARD, 0) + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> k7659_keyboard_device + +class k7659_keyboard_device : public device_t +{ +public: + // construction/destruction + k7659_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_READ8_MEMBER(read); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + emu_timer *m_timer; + +private: + UINT8 key_pos(UINT8 val); + UINT8 m_lookup; + UINT8 m_key; + const UINT8 *m_p_rom; +}; + + +// device type definition +extern const device_type K7659_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/kay_kbd.c b/src/mame/machine/kay_kbd.c new file mode 100644 index 00000000000..2568bd8af9c --- /dev/null +++ b/src/mame/machine/kay_kbd.c @@ -0,0 +1,517 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/****************************************************************************** + * + * kay_kbd.c + * + * Kaypro II Serial Keyboard + * + * Most of this is copied from the old kaypro.c, + * rather than re-inventing the wheel. + * + * Juergen Buchmueller, July 1998 + * Benjamin C. W. Sittler, July 1998 (new keyboard table) + * + * Converted to a serial device (as far as MESS will allow) + * by Robbbert, April 2009. + * + ******************************************************************************/ + +#include "emu.h" +#include "sound/beep.h" +#include "includes/kaypro.h" + + +/* + * The KAYPRO keyboard has roughly the following layout: + * + * [up] [down] [left] [right] + * [ESC] [1!] [2@] [3#] [4$] [5%] [6^] [7&] [8*] [9(] [0)] [-_] [=+] [`~] [BACK SPACE] + * [TAB] [qQ] [wW] [eE] [rR] [tT] [yY] [uU] [iI] [oO] [pP] [[{] []}] [DEL] + *[CTRL] [CAPS LOCK] [aA] [sS] [dD] [fF] [gG] [hH] [jJ] [kK] [lL] [;:] ['"] [RETURN] [\|] + * [SHIFT] [zZ] [xX] [cC] [vV] [bB] [nN] [mM] [,<] [.>] [/?] [SHIFT] [LINE FEED] + * [ SPACE ] + * + * [7] [8] [9] [-] + * [4] [5] [6] [,] + * [1] [2] [3] + * [ 0 ] [.] [ENTER] + * + * Notes on Appearance + * ------------------- + * The RETURN key is shaped like a backwards "L". The keypad ENTER key is actually + * oriented vertically, not horizontally. The alpha keys are marked with the uppercase letters + * only. Other keys with two symbols have the shifted symbol printed above the unshifted symbol. + * The keypad is actually located to the right of the main keyboard; it is shown separately here + * as a convenience to users of narrow listing windows. The arrow keys are actually marked with + * arrow graphics pointing in the appropriate directions. The F and J keys are specially shaped, + * since they are the "home keys" for touch-typing. The CAPS LOCK key has a build-in red indicator + * which is lit when CAPS LOCK is pressed once, and extinguished when the key is pressed again. + * + * Technical Notes + * --------------- + * The keyboard interfaces to the computer using a serial protocol. Modifier keys are handled + * inside the keyboards, as is the CAPS LOCK key. The arrow keys and the numeric keypad send + * non-ASCII codes which are not affected by the modifier keys. The remaining keys send the + * appropriate ASCII values. + * + * The keyboard has a built-in buzzer which is activated briefly by a non-modifier keypress, + * producing a "clicking" sound for user feedback. Additionally, this buzzer can be activated + * for a longer period by sending a 0x04 byte to the keyboard. This is used by the ROM soft + * terminal to alert the user in case of a BEL. + * + * 2008-05 FP: + * Small note about natural keyboard support: currently, + * - "Line Feed" is mapped to the 'End' key + * - "Keypad ," is not mapped + */ + +struct kay_kbd_t +{ + beep_device *beeper; + UINT8 buff[16]; + UINT8 head; + UINT8 tail; + UINT8 beep_on; + UINT8 control_status; + UINT8 keyrows[10]; + int lastrow; + int mask; + int key; + int repeat; + int repeater; +}; + +INPUT_PORTS_START( kay_kbd ) + PORT_START("ROW0") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_START("ROW1") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + + PORT_START("ROW2") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + + PORT_START("ROW3") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + + PORT_START("ROW4") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("ROW5") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + + PORT_START("ROW6") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + + PORT_START("ROW7") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + + PORT_START("ROW8") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + + PORT_START("ROW9") + PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0xf0, 0x00, IPT_UNUSED) +INPUT_PORTS_END + +static void kay_kbd_in( running_machine &machine, UINT8 data ); + +static const UINT8 keyboard[8][10][8] = { + { /* normal */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0','-','=','`', 8, 9}, + {'q','w','e','r','t','y','u','i'}, + {'o','p','[',']', 13,127, 0, 0}, + {'a','s','d','f','g','h','j','k'}, + {'l',';', 39, 92, 0,'z','x','c'}, + {'v','b','n','m',',','.','/', 0}, + { 10, 32, 228, 211, 195, 178, 177, 192}, + { 193, 194, 208, 209, 210, 225, 226, 227}, + { 241, 242, 243, 244, 0, 0, 0, 0}, + }, + { /* Shift */ + { 27,'!','@','#','$','%','^','&'}, + {'*','(',')','_','+','~', 8, 9}, + {'Q','W','E','R','T','Y','U','I'}, + {'O','P','{','}', 13,127, 0, 0}, + {'A','S','D','F','G','H','J','K'}, + {'L',':','"','|', 0,'Z','X','C'}, + {'V','B','N','M','<','>','?', 0}, + { 10, 32, 228, 211, 195, 178, 177, 192}, + { 193, 194, 208, 209, 210, 225, 226, 227}, + { 241, 242, 243, 244, 0, 0, 0, 0}, + }, + { /* Control */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0','-','=','`', 8, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,';', 39, 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10, 32, 228, 211, 195, 178, 177, 192}, + { 193, 194, 208, 209, 210, 225, 226, 227}, + { 241, 242, 243, 244, 0, 0, 0, 0}, + }, + { /* Shift+Control */ + { 27,'!', 0,'#','$','%', 30,'&'}, + {'*','(',')', 31,'+','~', 8, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,':','"', 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10, 32, 228, 211, 195, 178, 177, 192}, + { 193, 194, 208, 209, 210, 225, 226, 227}, + { 241, 242, 243, 244, 0, 0, 0, 0}, + }, + { /* CapsLock */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0','-','=','`', 8, 9}, + {'Q','W','E','R','T','Y','U','I'}, + {'O','P','[',']', 13,127, 0, 0}, + {'A','S','D','F','G','H','J','K'}, + {'L',';', 39, 92, 0,'Z','X','C'}, + {'V','B','N','M',',','.','/', 0}, + { 10, 32, 228, 211, 195, 178, 177, 192}, + { 193, 194, 208, 209, 210, 225, 226, 227}, + { 241, 242, 243, 244, 0, 0, 0, 0}, + }, + { /* Shift+CapsLock */ + { 27,'!','@','#','$','%','^','&'}, + {'*','(',')','_','+','~', 8, 9}, + {'Q','W','E','R','T','Y','U','I'}, + {'O','P','{','}', 13,127, 0, 0}, + {'A','S','D','F','G','H','J','K'}, + {'L',':','"','|', 0,'Z','X','C'}, + {'V','B','N','M','<','>','?', 0}, + { 10, 32, 228, 211, 195, 178, 177, 192}, + { 193, 194, 208, 209, 210, 225, 226, 227}, + { 241, 242, 243, 244, 0, 0, 0, 0}, + }, + { /* Control+CapsLock */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0','-','=','`', 8, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,';', 39, 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10, 32, 228, 211, 195, 178, 177, 192}, + { 193, 194, 208, 209, 210, 225, 226, 227}, + { 241, 242, 243, 244, 0, 0, 0, 0}, + }, + { /* Shift+Control+CapsLock */ + { 27,'!', 0,'#','$','%', 30,'&'}, + {'*','(',')', 31,'+','~', 8, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,':','"', 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10, 32, 228, 211, 195, 178, 177, 192}, + { 193, 194, 208, 209, 210, 225, 226, 227}, + { 241, 242, 243, 244, 0, 0, 0, 0}, + }, +}; + +MACHINE_RESET_MEMBER(kaypro_state,kay_kbd) +{ + kay_kbd_t *kbd = m_kbd = auto_alloc_clear(machine(), kay_kbd_t); + + /* disable CapsLock LED initially */ + set_led_status(machine(), 1, 1); + set_led_status(machine(), 1, 0); + kbd->beeper = machine().device("beeper"); + kbd->beep_on = 1; + kbd->control_status = 0x14; + kbd->beeper->set_state(0); + kbd->beeper->set_frequency(950); /* piezo-device needs to be measured */ + kbd->head = kbd->tail = 0; /* init buffer */ +} + +/****************************************************** + * vertical blank interrupt + * used to scan keyboard; newly pressed keys + * are stuffed into a keyboard buffer; + * also drives keyboard LEDs and + * and handles autorepeating keys + ******************************************************/ +INTERRUPT_GEN_MEMBER(kaypro_state::kay_kbd_interrupt) +{ + kay_kbd_t *kbd = m_kbd; + int mod, row, col, chg, newval; + UINT8 *keyrows = kbd->keyrows; + + if( kbd->repeat ) + { + if( !--kbd->repeat ) + kbd->repeater = 4; + } + else + if( kbd->repeater ) + { + kbd->repeat = kbd->repeater; + } + + row = 9; + newval = machine().root_device().ioport("ROW9")->read(); + chg = keyrows[row] ^ newval; + + if (!chg) { newval = machine().root_device().ioport("ROW8")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) { newval = machine().root_device().ioport("ROW7")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) { newval = machine().root_device().ioport("ROW6")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) { newval = machine().root_device().ioport("ROW5")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) { newval = machine().root_device().ioport("ROW4")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) { newval = machine().root_device().ioport("ROW3")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) { newval = machine().root_device().ioport("ROW2")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) { newval = machine().root_device().ioport("ROW1")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) { newval = machine().root_device().ioport("ROW0")->read(); chg = keyrows[--row] ^ newval; } + if (!chg) --row; + + if (row >= 0) + { + kbd->repeater = 0x00; + kbd->mask = 0x00; + kbd->key = 0x00; + kbd->lastrow = row; + /* CapsLock LED */ + if( row == 3 && chg == 0x80 ) + set_led_status(machine(), 1, (kbd->keyrows[3] & 0x80) ? 0 : 1); + + if (newval & chg) /* key(s) pressed ? */ + { + mod = 0; + + /* Shift modifier */ + if ( (keyrows[5] & 0x10) || (keyrows[6] & 0x80) ) + mod |= 1; + + /* Control modifier */ + if (keyrows[3] & 0x40) + mod |= 2; + + /* CapsLock modifier */ + if (keyrows[3] & 0x80) + mod |= 4; + + /* find newval key */ + kbd->mask = 0x01; + for (col = 0; col < 8; col ++) + { + if (chg & kbd->mask) + { + newval &= kbd->mask; + kbd->key = keyboard[mod][row][col]; + break; + } + kbd->mask <<= 1; + } + if( kbd->key ) /* normal key */ + { + kbd->repeater = 30; + kay_kbd_in(machine(), kbd->key); + } + else + if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */ + kay_kbd_in(machine(), 0); + keyrows[row] |= newval; + } + else + { + kbd->keyrows[row] = newval; + } + kbd->repeat = kbd->repeater; + } + else if ( kbd->key && (keyrows[kbd->lastrow] & kbd->mask) && kbd->repeat == 0 ) + { + kay_kbd_in(machine(), kbd->key); + } +} + +#if 0 + +/****************************************************** + * kaypro_const_w (write console status ;) + * bit + * 0 flush keyboard buffer + ******************************************************/ +static WRITE8_HANDLER ( kaypro2_const_w ) +{ + if (data & 1) + kbd->head = kbd->tail = 0; +} + +#endif + +/****************************************************** + * stuff character into the keyboard buffer + * releases CPU if it was waiting for a key + * sounds bell if buffer would overflow + ******************************************************/ +static void kay_kbd_in( running_machine &machine, UINT8 data ) +{ + kaypro_state *state = machine.driver_data(); + kay_kbd_t *kbd = state->m_kbd; + UINT8 kbd_head_old; + + kbd_head_old = kbd->head; + kbd->buff[kbd->head] = data; + kbd->head = (kbd->head + 1) % sizeof(kbd->buff); + /* will the buffer overflow ? */ + if (kbd->head == kbd->tail) + { + kbd->head = kbd_head_old; + kay_kbd_d_w(machine, 4); + } + else + kay_kbd_d_w(machine, 1); +} + + +UINT8 kay_kbd_c_r( running_machine &machine ) +{ +/* d4 transmit buffer empty - 1=ok to send + d2 appears to be receive buffer empty - 1=ok to receive + d0 keyboard buffer empty - 1=key waiting to be used */ + + kaypro_state *state = machine.driver_data(); + kay_kbd_t *kbd = state->m_kbd; + UINT8 data = kbd->control_status; + + if( kbd->head != kbd->tail ) + data++; + + return data; +} + +UINT8 kay_kbd_d_r( running_machine &machine ) +{ +/* return next key in buffer */ + + kaypro_state *state = machine.driver_data(); + kay_kbd_t *kbd = state->m_kbd; + UINT8 data = 0; + + if (kbd->tail != kbd->head) + { + data = kbd->buff[kbd->tail]; + kbd->tail = (kbd->tail + 1) % sizeof(kbd->buff); + } + + return data; +} + +static TIMER_CALLBACK( kay_kbd_beepoff ) +{ + kaypro_state *state = machine.driver_data(); + kay_kbd_t *kbd = state->m_kbd; + kbd->beeper->set_state(0); + kbd->control_status |= 4; +} + +void kay_kbd_d_w( running_machine &machine, UINT8 data ) +{ +/* Beeper control - lengths need verifying + 01 - keyclick + 02 - short beep + 04 - standard bell beep + 08 - mute + 16 - unmute */ + + kaypro_state *state = machine.driver_data(); + kay_kbd_t *kbd = state->m_kbd; + UINT16 length = 0; + + if (data & 0x10) + kbd->beep_on = 1; + else + if (data & 0x08) + kbd->beep_on = 0; + else + if (kbd->beep_on) + { + if (data & 0x04) + length = 400; + else + if (data & 0x02) + length = 200; + else + if (data & 0x01) + length = 4; + + if (length) + { + kbd->control_status &= 0xfb; + machine.scheduler().timer_set(attotime::from_msec(length), FUNC(kay_kbd_beepoff)); + kbd->beeper->set_state(1); + } + } +} diff --git a/src/mame/machine/kaypro.c b/src/mame/machine/kaypro.c new file mode 100644 index 00000000000..9b9c3a7bab7 --- /dev/null +++ b/src/mame/machine/kaypro.c @@ -0,0 +1,292 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert + + +#include "includes/kaypro.h" + + + + +/*********************************************************** + + PIO + + Port B is unused on both PIOs + +************************************************************/ + +WRITE_LINE_MEMBER( kaypro_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +READ8_MEMBER( kaypro_state::pio_system_r ) +{ + UINT8 data = 0; + + /* centronics busy */ + data |= m_centronics_busy << 3; + + /* PA7 is pulled high */ + data |= 0x80; + + return data; +} + +WRITE8_MEMBER( kaypro_state::kayproii_pio_system_w ) +{ +/* d7 bank select + d6 disk drive motors - (0=on) + d5 double-density enable (0=double density) + d4 Centronics strobe + d2 side select (1=side 1) + d1 drive B + d0 drive A */ + + membank("bankr0")->set_entry(BIT(data, 7)); + membank("bank3")->set_entry(BIT(data, 7)); + m_is_motor_off = BIT(data, 6); + + m_floppy = NULL; + if (BIT(data, 0)) + m_floppy = m_floppy0->get_device(); + else + if (BIT(data, 1)) + m_floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(m_floppy); + m_fdc->dden_w(BIT(data, 5)); + + if (m_floppy) + { + m_floppy->mon_w(BIT(data, 6)); // motor on + m_floppy->ss_w(!BIT(data, 2)); // signal exists even though drives are single sided + } + + output_set_value("ledA", BIT(data, 0)); /* LEDs in artwork */ + output_set_value("ledB", BIT(data, 1)); + + m_centronics->write_strobe(BIT(data, 4)); + + m_system_port = data; +} + +WRITE8_MEMBER( kaypro_state::kaypro4_pio_system_w ) +{ + kayproii_pio_system_w(space, offset, data); + + /* side select */ + m_floppy->ss_w(BIT(data, 2)); +} + +/*********************************************************** + + KAYPRO2X SYSTEM PORT + + The PIOs were replaced by a few standard 74xx chips + +************************************************************/ + +READ8_MEMBER( kaypro_state::kaypro2x_system_port_r ) +{ + UINT8 data = m_centronics_busy << 6; + return (m_system_port & 0xbf) | data; +} + +WRITE8_MEMBER( kaypro_state::kaypro2x_system_port_w ) +{ +/* d7 bank select + d6 alternate character set (write only) + d5 double-density enable + d4 disk drive motors (1=on) + d3 Centronics strobe + d2 side select (appears that 0=side 1?) + d1 drive B + d0 drive A */ + + membank("bankr0")->set_entry(BIT(data, 7)); + membank("bank3")->set_entry(BIT(data, 7)); + m_is_motor_off = !BIT(data, 4); + + m_floppy = NULL; + if (!BIT(data, 0)) + m_floppy = m_floppy0->get_device(); + else + if (m_floppy1 && (!BIT(data, 1))) + m_floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(m_floppy); + m_fdc->dden_w(BIT(data, 5)); + + if (m_floppy) + { + m_floppy->mon_w(!BIT(data, 4)); // motor on + m_floppy->ss_w(!BIT(data, 2)); + } + + output_set_value("ledA", BIT(data, 0)); /* LEDs in artwork */ + output_set_value("ledB", BIT(data, 1)); + + m_centronics->write_strobe(BIT(data, 3)); + + m_system_port = data; +} + + +/*********************************************************************** + + SIO + + On Kaypro2x, Channel B on both SIOs is hardwired to 300 baud. + + Both devices on sio2 (printer and modem) are not emulated. + +************************************************************************/ + +/* Set baud rate. bits 0..3 Rx and Tx are tied together. Baud Rate Generator is a AY-5-8116, SMC8116, WD1943, etc. + 00h 50 + 11h 75 + 22h 110 + 33h 134.5 + 44h 150 + 55h 300 + 66h 600 + 77h 1200 + 88h 1800 + 99h 2000 + AAh 2400 + BBh 3600 + CCh 4800 + DDh 7200 + EEh 9600 + FFh 19200 */ + + +READ8_MEMBER(kaypro_state::kaypro_sio_r) +{ + if (offset == 1) + return kay_kbd_d_r(machine()); + else + if (offset == 3) + return kay_kbd_c_r(machine()); + else + return m_sio->cd_ba_r(space, offset); +} + +WRITE8_MEMBER(kaypro_state::kaypro_sio_w) +{ + if (offset == 1) + kay_kbd_d_w(machine(), data); + else + m_sio->cd_ba_w(space, offset, data); +} + + +/************************************************************************************* + + Floppy DIsk + + If DRQ or IRQ is set, and cpu is halted, the NMI goes low. + Since the HALT occurs last (and has no callback mechanism), we need to set + a short delay, to give time for the processor to execute the HALT before NMI + becomes active. + +*************************************************************************************/ + +void kaypro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + bool halt; + switch (id) + { + case TIMER_FLOPPY: + halt = (bool)m_maincpu->state_int(Z80_HALT); + if (m_is_motor_off) + { + timer_set(attotime::from_hz(10), TIMER_FLOPPY); + break; + } + if ((halt) && (m_fdc_rq & 3) && (m_fdc_rq < 0x80)) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_fdc_rq |= 0x80; + } + else + if ((m_fdc_rq == 0x80) || ((!halt) && BIT(m_fdc_rq, 7))) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_fdc_rq &= 0x7f; + } + timer_set(attotime::from_hz(1e5), TIMER_FLOPPY); + + break; + default: + assert_always(FALSE, "Unknown id in kaypro_state::device_timer"); + } +} + +WRITE_LINE_MEMBER( kaypro_state::fdc_intrq_w ) +{ + m_fdc_rq = (m_fdc_rq & 0x82) | state; +} + +WRITE_LINE_MEMBER( kaypro_state::fdc_drq_w ) +{ + m_fdc_rq = (m_fdc_rq & 0x81) | (state << 1); +} + + +/*********************************************************** + + Machine + +************************************************************/ +MACHINE_START_MEMBER( kaypro_state,kayproii ) +{ + m_pio_s->strobe_a(0); +} + +MACHINE_RESET_MEMBER( kaypro_state,kaypro ) +{ + MACHINE_RESET_CALL_MEMBER(kay_kbd); + membank("bankr0")->set_entry(1); // point at rom + membank("bankw0")->set_entry(0); // always write to ram + membank("bank3")->set_entry(1); // point at video ram + m_system_port = 0x80; + m_fdc_rq = 0; + m_maincpu->reset(); + timer_set(attotime::from_hz(1), TIMER_FLOPPY); /* kick-start the nmi timer */ +} + + +/*********************************************************** + + Quickload + + This loads a .COM file to address 0x100 then jumps + there. Sometimes .COM has been renamed to .CPM to + prevent windows going ballistic. These can be loaded + as well. + +************************************************************/ + +QUICKLOAD_LOAD_MEMBER( kaypro_state, kaypro ) +{ + UINT8 *RAM = memregion("rambank")->base(); + UINT16 i; + UINT8 data; + + /* Load image to the TPA (Transient Program Area) */ + for (i = 0; i < quickload_size; i++) + { + if (image.fread( &data, 1) != 1) return IMAGE_INIT_FAIL; + + RAM[i+0x100] = data; + } + + membank("bankr0")->set_entry(0); + membank("bank3")->set_entry(0); + RAM[0x80]=0; // clear out command tail + RAM[0x81]=0; + m_maincpu->set_pc(0x100); // start program + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/kb_7007_3.h b/src/mame/machine/kb_7007_3.h new file mode 100644 index 00000000000..3324de839f6 --- /dev/null +++ b/src/mame/machine/kb_7007_3.h @@ -0,0 +1,122 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/* + * MC 7007 keyboard, variant 3, used by mc1502. + * + * Rus/Lat key is mapped to RAlt. + */ + +INPUT_PORTS_START( mc7007_3_keyboard ) + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Scroll Lock") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) // PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) // PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) // PORT_CODE(KEYCODE_PGUP) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) /* ??2 */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') /* ??? */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) /* ??? */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) /* ??? */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_RALT) /* ??? */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) // PORT_CODE(KEYCODE_INSERT) /* ??? */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL_PAD) /* ???? */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) /* ???? */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) // PORT_CODE(KEYCODE_END) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) // PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) // PORT_CODE(KEYCODE_PGDN) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) // PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) // PORT_CODE(KEYCODE_RIGHT) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') /* keypad */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_PRTSCR) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor up") PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + + PORT_START("Y10") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + + PORT_START("Y11") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + + PORT_START("Y12") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) +INPUT_PORTS_END diff --git a/src/mame/machine/kb_poisk1.h b/src/mame/machine/kb_poisk1.h new file mode 100644 index 00000000000..ece8ee0c0c9 --- /dev/null +++ b/src/mame/machine/kb_poisk1.h @@ -0,0 +1,252 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/* + * Poisk-1 keyboard + * + * F4 - toggles key click + * RCtrl - toggles Latin/Cyrillic layout + * Keypad / - Pause key + * F11 - XXX + * F12 - XXX + */ + +INPUT_PORTS_START( poisk1_keyboard_v89 ) + PORT_START("Y1") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') // 0x55 + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?56?") // 0x56 + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) +/*-12*/ PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-12 - ?") /* PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') */ + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') +/*-11*/ PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-11 - %") /* PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') */ + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + + PORT_START("Y2") +/*-15*/ PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-15 - !") /* PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') */ + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) /* ??? */ + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) +/*-13*/ PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-13 - ;") /* PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') */ + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) +/*-2*/ PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-2 - .") /* PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') */ +/*-3*/ PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-3 - _") /* PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') */ + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') // 0x54 + + PORT_START("Y3") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("Y4") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) +/*-1*/ PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-1 - *") /* PORT_CODE(KEYCODE_8) PORT_CHAR('*') PORT_CHAR('8') */ + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) /* ??2 */ +/*-9*/ PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-9 - :") /* PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') */ +/*-10*/ PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-10 - ,") /* PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') */ + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("Y5") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_UNUSED ) +/*?*/ PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) /* ???? */ + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + + PORT_START("Y6") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) +/*?*/ PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?dc?") // 0xdc = SHIFT2 + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_RALT) // 0xdb = Rus/Lat + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?59?") // 0x59 + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y7") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?5a?") // 0x5a + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("Y8") +/*-6*/ PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-6 - -") /* PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') */ + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') /* ??? */ + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') +/*-7*/ PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-7 - )") /* PORT_CODE(KEYCODE_0) PORT_CHAR(')') PORT_CHAR('0') */ + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock") +/*-4*/ PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-4 - (") /* PORT_CODE(KEYCODE_9) PORT_CHAR('(') PORT_CHAR('9') */ + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') +/*-5*/ PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-5 - \"") /* PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('"') PORT_CHAR('\'') */ +/*-8*/ PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-8 - /") /* PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') */ + +#if 0 + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x000, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x000, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x000, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x000, IP_ACTIVE_LOW, IPT_KEYBOARD ) +#endif + +INPUT_PORTS_END + +INPUT_PORTS_START( poisk1_keyboard_v91 ) + PORT_START("Y1") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+ / CYRILLIC YO") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(")") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + + PORT_START("Y2") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("*") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("(") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + + PORT_START("Y3") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + + PORT_START("Y4") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Pause") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("Y5") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UKRAINIAN XXX") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + + PORT_START("Y6") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Ctrl/Cyril") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Alt") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Alt") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y7") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- / UKRAINIAN XXX") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock") + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + + PORT_START("Y8") + PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') /* ??? */ + PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("!") PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') + PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UKRAINIAN XXX") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("%") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') +INPUT_PORTS_END diff --git a/src/mame/machine/kc.c b/src/mame/machine/kc.c new file mode 100644 index 00000000000..ad707f9dbc6 --- /dev/null +++ b/src/mame/machine/kc.c @@ -0,0 +1,788 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/* Core includes */ +#include "emu.h" +#include "includes/kc.h" + +#define KC_DEBUG 0 +#define LOG(x) do { if (KC_DEBUG) logerror x; } while (0) + +struct kcc_header +{ + UINT8 name[10]; + UINT8 reserved[6]; + UINT8 number_addresses; + UINT8 load_address_l; + UINT8 load_address_h; + UINT8 end_address_l; + UINT8 end_address_h; + UINT8 execution_address_l; + UINT8 execution_address_h; + UINT8 pad[128-2-2-2-1-16]; +}; + +/* appears to work a bit.. */ +/* load file, then type: MENU and it should now be displayed. */ +/* now type name that has appeared! */ + +/* load snapshot */ +QUICKLOAD_LOAD_MEMBER( kc_state,kc) +{ + struct kcc_header *header; + UINT16 addr; + UINT16 datasize; + UINT16 execution_address; + UINT16 i; + + /* get file size */ + UINT64 size = image.length(); + + if (size == 0) + return IMAGE_INIT_FAIL; + + dynamic_buffer data(size); + image.fread( &data[0], size); + + header = (struct kcc_header *) &data[0]; + addr = (header->load_address_l & 0x0ff) | ((header->load_address_h & 0x0ff)<<8); + datasize = ((header->end_address_l & 0x0ff) | ((header->end_address_h & 0x0ff)<<8)) - addr; + execution_address = (header->execution_address_l & 0x0ff) | ((header->execution_address_h & 0x0ff)<<8); + + if (datasize > size - 128) + { + osd_printf_info("Invalid snapshot size: expected 0x%04x, found 0x%04x\n", datasize, (UINT32)size - 128); + datasize = size - 128; + } + + address_space &space = m_maincpu->space( AS_PROGRAM ); + + for (i=0; inumber_addresses >= 3 ) + { + // if specified, jumps to the quickload start address + m_maincpu->set_pc(execution_address); + } + + logerror("Snapshot loaded at: 0x%04x-0x%04x, execution address: 0x%04x\n", addr, addr + datasize - 1, execution_address); + + return IMAGE_INIT_PASS; +} + + +//************************************************************************** +// MODULE SYSTEM EMULATION +//************************************************************************** + +// The KC85/4 and KC85/3 are "modular systems". These computers can be expanded with modules. + +READ8_MEMBER( kc_state::expansion_read ) +{ + UINT8 result = 0xff; + + // assert MEI line of first slot + m_expansions[0]->mei_w(ASSERT_LINE); + + for (int i=0; i<3; i++) + m_expansions[i]->read(offset, result); + + return result; +} + +WRITE8_MEMBER( kc_state::expansion_write ) +{ + // assert MEI line of first slot + m_expansions[0]->mei_w(ASSERT_LINE); + + for (int i=0; i<3; i++) + m_expansions[i]->write(offset, data); +} + +/* + port xx80 + + - xx is module id. + + Only addressess divisible by 4 are checked. + If module does not exist, 0x0ff is returned. + + When xx80 is read, if a module exists a id will be returned. + Id's for known modules are listed above. +*/ + +READ8_MEMBER( kc_state::expansion_io_read ) +{ + UINT8 result = 0xff; + + // assert MEI line of first slot + m_expansions[0]->mei_w(ASSERT_LINE); + + if ((offset & 0xff) == 0x80) + { + UINT8 slot_id = (offset>>8) & 0xff; + + if (slot_id == 0x08 || slot_id == 0x0c) + result = m_expansions[(slot_id - 8) >> 2]->module_id_r(); + else + m_expansions[2]->io_read(offset, result); + } + else + { + for (int i=0; i<3; i++) + m_expansions[i]->io_read(offset, result); + } + + return result; +} + +WRITE8_MEMBER( kc_state::expansion_io_write ) +{ + // assert MEI line of first slot + m_expansions[0]->mei_w(ASSERT_LINE); + + if ((offset & 0xff) == 0x80) + { + UINT8 slot_id = (offset>>8) & 0xff; + + if (slot_id == 0x08 || slot_id == 0x0c) + m_expansions[(slot_id - 8) >> 2]->control_w(data); + else + m_expansions[2]->io_write(offset, data); + } + else + { + for (int i=0; i<3; i++) + m_expansions[i]->io_write(offset, data); + } +} + +// module read/write handlers +READ8_MEMBER ( kc_state::expansion_4000_r ){ return expansion_read(space, offset + 0x4000); } +WRITE8_MEMBER( kc_state::expansion_4000_w ){ expansion_write(space, offset + 0x4000, data); } +READ8_MEMBER ( kc_state::expansion_8000_r ){ return expansion_read(space, offset + 0x8000); } +WRITE8_MEMBER( kc_state::expansion_8000_w ){ expansion_write(space, offset + 0x8000, data); } +READ8_MEMBER ( kc_state::expansion_c000_r ){ return expansion_read(space, offset + 0xc000); } +WRITE8_MEMBER( kc_state::expansion_c000_w ){ expansion_write(space, offset + 0xc000, data); } +READ8_MEMBER ( kc_state::expansion_e000_r ){ return expansion_read(space, offset + 0xe000); } +WRITE8_MEMBER( kc_state::expansion_e000_w ){ expansion_write(space, offset + 0xe000, data); } + + +//************************************************************************** +// CASSETTE EMULATION +//************************************************************************** + +/* + The cassette motor is controlled by bit 6 of PIO port A. + The cassette read data is connected to /ASTB input of the PIO. + A edge from the cassette therefore will trigger a interrupt + from the PIO. + The duration between two edges can be timed and the data-bit + identified. + + I have used a timer to feed data into /ASTB. The timer is only + active when the cassette motor is on. +*/ + +void kc_state::update_cassette(int state) +{ + int astb = (state & m_ardy) ? 0 : 1; + + // if state is changed updates the /ASTB line + if (m_astb ^ astb) + { + m_z80pio->strobe_a(astb); + + m_astb = astb; + + // FIXME: temporary for allow kc85_2-3 to load cassette + if ((m_cassette->get_state() & 0x03) == CASSETTE_PLAY) + m_z80pio->data_write(0, m_pio_data[0]); + } +} + +TIMER_CALLBACK_MEMBER(kc_state::kc_cassette_oneshot_timer) +{ + update_cassette(0); + + m_cassette_oneshot_timer->reset(); +} + +// timer used for polling data from cassette input +// enabled only when cassette motor is on +TIMER_CALLBACK_MEMBER(kc_state::kc_cassette_timer_callback) +{ + // read cassette data + int bit = (m_cassette->input() > 0.0038) ? 1 : 0; + + // generates a pulse when the cassette input changes state + if (bit ^ m_cassette_in) + { + update_cassette(1); + m_cassette_in = bit; + m_cassette_oneshot_timer->adjust(attotime::from_double(TIME_OF_74LS123(RES_K(10), CAP_N(1)))); + } +} + +void kc_state::cassette_set_motor(int motor_state) +{ + /* set new motor state in cassette device */ + m_cassette->change_state(motor_state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + if (motor_state) + { + /* start timer */ + m_cassette_timer->adjust(attotime::zero, 0, KC_CASSETTE_TIMER_FREQUENCY); + } + else + { + /* stop timer */ + m_cassette_timer->reset(); + } +} + +/* + pin 2 = gnd + pin 3 = read + pin 1 = k1 ?? modulating signal + pin 4 = k0 ?? signal?? + pin 5 = motor on + + + Tape signals: + K0, K1 ?? + MOTON motor control + ASTB read? + + T1-T4 give 4 bit a/d tone sound? + K1, K0 are mixed with tone. + + Cassette read goes into ASTB of PIO. + From this, KC must be able to detect the length + of the pulses and can read the data. + + + Tape write: clock comes from CTC? + truck signal resets, 5v signal for set. + output gives k0 and k1. + +*/ + + + +//************************************************************************** +// KC85 bankswitch +//************************************************************************** + +/* update status of memory area 0x0000-0x03fff */ +void kc_state::update_0x00000() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + /* access ram? */ + if (m_pio_data[0] & (1<<1)) + { + LOG(("ram0 enabled\n")); + + /* yes; set address of bank */ + space.install_read_bank(0x0000, 0x3fff, "bank1"); + membank("bank1")->set_base(m_ram_base); + + /* write protect ram? */ + if ((m_pio_data[0] & (1<<3)) == 0) + { + /* yes */ + LOG(("ram0 write protected\n")); + + /* ram is enabled and write protected */ + space.unmap_write(0x0000, 0x3fff); + } + else + { + LOG(("ram0 write enabled\n")); + + /* ram is enabled and write enabled */ + space.install_write_bank(0x0000, 0x3fff, "bank1"); + } + } + else + { + LOG(("Module at 0x0000\n")); + + space.install_read_handler (0x0000, 0x3fff, 0, 0, read8_delegate(FUNC(kc_state::expansion_read), this), 0); + space.install_write_handler(0x0000, 0x3fff, 0, 0, write8_delegate(FUNC(kc_state::expansion_write), this), 0); + } +} + +/* update status of memory area 0x4000-0x07fff */ +void kc_state::update_0x04000() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + LOG(("Module at 0x4000\n")); + + space.install_read_handler (0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(kc_state::expansion_4000_r), this), 0); + space.install_write_handler(0x4000, 0x7fff, 0, 0, write8_delegate(FUNC(kc_state::expansion_4000_w), this), 0); + +} + + +/* update memory address 0x0c000-0x0e000 */ +void kc_state::update_0x0c000() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + if ((m_pio_data[0] & (1<<7)) && memregion("basic")->base() != NULL) + { + /* BASIC takes next priority */ + LOG(("BASIC rom 0x0c000\n")); + + membank("bank4")->set_base(memregion("basic")->base()); + space.install_read_bank(0xc000, 0xdfff, "bank4"); + space.unmap_write(0xc000, 0xdfff); + } + else + { + LOG(("Module at 0x0c000\n")); + + space.install_read_handler (0xc000, 0xdfff, 0, 0, read8_delegate(FUNC(kc_state::expansion_c000_r), this), 0); + space.install_write_handler(0xc000, 0xdfff, 0, 0, write8_delegate(FUNC(kc_state::expansion_c000_w), this), 0); + } +} + +/* update memory address 0x0e000-0x0ffff */ +void kc_state::update_0x0e000() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + if (m_pio_data[0] & (1<<0)) + { + /* enable CAOS rom in memory range 0x0e000-0x0ffff */ + LOG(("CAOS rom 0x0e000\n")); + /* read will access the rom */ + membank("bank5")->set_base(memregion("caos")->base() + 0x2000); + space.install_read_bank(0xe000, 0xffff, "bank5"); + space.unmap_write(0xe000, 0xffff); + } + else + { + LOG(("Module at 0x0e000\n")); + + space.install_read_handler (0xe000, 0xffff, 0, 0, read8_delegate(FUNC(kc_state::expansion_e000_r), this), 0); + space.install_write_handler(0xe000, 0xffff, 0, 0, write8_delegate(FUNC(kc_state::expansion_e000_w), this), 0); + } +} + + +/* update status of memory area 0x08000-0x0ffff */ +void kc_state::update_0x08000() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + if (m_pio_data[0] & (1<<2)) + { + /* IRM enabled */ + LOG(("IRM enabled\n")); + + membank("bank3")->set_base(m_video_ram); + space.install_readwrite_bank(0x8000, 0xbfff, "bank3"); + } + else + { + LOG(("Module at 0x8000!\n")); + + space.install_read_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(kc_state::expansion_8000_r), this), 0); + space.install_write_handler(0x8000, 0xbfff, 0, 0, write8_delegate(FUNC(kc_state::expansion_8000_w), this), 0); + } +} + + +/* update status of memory area 0x4000-0x07fff */ +void kc85_4_state::update_0x04000() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + /* access ram? */ + if (m_port_86_data & (1<<0)) + { + LOG(("RAM4 enabled\n")); + + /* yes */ + space.install_read_bank(0x4000, 0x7fff, "bank2"); + /* set address of bank */ + membank("bank2")->set_base(m_ram_base + 0x4000); + + /* write protect ram? */ + if ((m_port_86_data & (1<<1)) == 0) + { + /* yes */ + LOG(("ram4 write protected\n")); + + /* ram is enabled and write protected */ + space.nop_write(0x4000, 0x7fff); + } + else + { + LOG(("ram4 write enabled\n")); + + /* ram is enabled and write enabled */ + space.install_write_bank(0x4000, 0x7fff, "bank2"); + } + } + else + { + LOG(("Module at 0x4000\n")); + + space.install_read_handler (0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(kc_state::expansion_4000_r), this), 0); + space.install_write_handler(0x4000, 0x7fff, 0, 0, write8_delegate(FUNC(kc_state::expansion_4000_w), this), 0); + } + +} + +/* update memory address 0x0c000-0x0e000 */ +void kc85_4_state::update_0x0c000() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + if (m_port_86_data & (1<<7)) + { + /* CAOS rom takes priority */ + LOG(("CAOS rom 0x0c000\n")); + + membank("bank4")->set_base(memregion("caos")->base()); + space.install_read_bank(0xc000, 0xdfff, "bank4"); + space.unmap_write(0xc000, 0xdfff); + } + else + { + if (m_pio_data[0] & (1<<7)) + { + /* BASIC takes next priority */ + LOG(("BASIC rom 0x0c000\n")); + + int bank = memregion("basic")->bytes() == 0x8000 ? (m_port_86_data>>5) & 0x03 : 0; + + membank("bank4")->set_base(memregion("basic")->base() + (bank << 13)); + space.install_read_bank(0xc000, 0xdfff, "bank4"); + space.unmap_write(0xc000, 0xdfff); + } + else + { + LOG(("Module at 0x0c000\n")); + + space.install_read_handler (0xc000, 0xdfff, 0, 0, read8_delegate(FUNC(kc_state::expansion_c000_r), this), 0); + space.install_write_handler(0xc000, 0xdfff, 0, 0, write8_delegate(FUNC(kc_state::expansion_c000_w), this), 0); + } + } +} + +void kc85_4_state::update_0x08000() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + if (m_pio_data[0] & (1<<2)) + { + /* IRM enabled - has priority over RAM8 enabled */ + LOG(("IRM enabled\n")); + + UINT8* ram_page = m_video_ram + ((BIT(m_port_84_data, 2)<<15) | (BIT(m_port_84_data, 1)<<14)); + + membank("bank3")->set_base(ram_page); + space.install_readwrite_bank(0x8000, 0xa7ff, "bank3"); + + membank("bank6")->set_base(m_video_ram + 0x2800); + space.install_readwrite_bank(0xa800, 0xbfff, "bank6"); + } + else if (m_pio_data[1] & (1<<5)) + { + LOG(("RAM8 enabled\n")); + + int ram8_block; + UINT8 *mem_ptr; + + /* ram8 block chosen */ + + if (m_ram->size() == 64 * 1024) + { + // kc85_4 64K RAM + ram8_block = ((m_port_84_data)>>4) & 0x01; + mem_ptr = m_ram_base + 0x8000 + (ram8_block<<14); + } + else + { + // kc85_5 256K RAM + ram8_block = ((m_port_84_data)>>4) & 0x0f; + mem_ptr = m_ram_base + (ram8_block<<14); + } + + membank("bank3")->set_base(mem_ptr); + membank("bank6")->set_base(mem_ptr + 0x2800); + space.install_read_bank(0x8000, 0xa7ff, "bank3"); + space.install_read_bank(0xa800, 0xbfff, "bank6"); + + /* write protect RAM8 ? */ + if ((m_pio_data[1] & (1<<6)) == 0) + { + /* ram8 is enabled and write protected */ + LOG(("RAM8 write protected\n")); + + space.nop_write(0x8000, 0xa7ff); + space.nop_write(0xa800, 0xbfff); + } + else + { + LOG(("RAM8 write enabled\n")); + + /* ram8 is enabled and write enabled */ + space.install_write_bank(0x8000, 0xa7ff, "bank3"); + space.install_write_bank(0xa800, 0xbfff, "bank6"); + } + } + else + { + LOG(("Module at 0x8000\n")); + + space.install_read_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(kc_state::expansion_8000_r), this), 0); + space.install_write_handler(0x8000, 0xbfff, 0, 0, write8_delegate(FUNC(kc_state::expansion_8000_w), this), 0); + } +} + +//************************************************************************** +// KC85 Z80PIO Interface +//************************************************************************** + + +/* PIO PORT A: port 0x088: + +bit 7: ROM C (BASIC) +bit 6: Tape Motor on +bit 5: LED +bit 4: K OUT +bit 3: WRITE PROTECT RAM 0 +bit 2: IRM +bit 1: ACCESS RAM 0 +bit 0: CAOS ROM E +*/ + +READ8_MEMBER( kc_state::pio_porta_r ) +{ + return m_pio_data[0]; +} + +WRITE8_MEMBER( kc_state::pio_porta_w ) +{ + if (m_pio_data[0] != data) // to avoid a severe slowdown during cassette loading + { + m_pio_data[0] = data; + + update_0x00000(); + update_0x08000(); + update_0x0c000(); + update_0x0e000(); + + cassette_set_motor(BIT(data, 6)); + } +} + + +/* PIO PORT B: port 0x089: +bit 7: BLINK ENABLE +bit 6: WRITE PROTECT RAM 8 +bit 5: ACCESS RAM 8 +bit 4: TONE 4 +bit 3: TONE 3 +bit 2: TONE 2 +bit 1: TONE 1 +bit 0: TRUCK */ + +READ8_MEMBER( kc_state::pio_portb_r ) +{ + return m_pio_data[1]; +} + +WRITE8_MEMBER( kc_state::pio_portb_w ) +{ + m_pio_data[1] = data; + + update_0x08000(); + + /* 16 speaker levels */ + m_speaker_level = (data>>1) & 0x0f; + + speaker_update(); +} + +/* port 0x84/0x85: + +bit 7: RAF3 +bit 6: RAF2 +bit 5: RAF1 +bit 4: RAF0 +bit 3: FPIX. high resolution +bit 2: BLA1 .access screen +bit 1: BLA0 .pixel/color +bit 0: BILD .display screen 0 or 1 +*/ + +WRITE8_MEMBER( kc85_4_state::kc85_4_84_w ) +{ + LOG(("0x84 W: %02x\n", data)); + + m_port_84_data = data; + + video_control_w(data); + + update_0x08000(); +} + +READ8_MEMBER( kc85_4_state::kc85_4_84_r ) +{ + return m_port_84_data; +} + + +/* port 0x86/0x87: + +bit 7: ROCC +bit 6: ROF1 +bit 5: ROF0 +bit 4-2 are not connected +bit 1: WRITE PROTECT RAM 4 +bit 0: ACCESS RAM 4 +*/ + +WRITE8_MEMBER( kc85_4_state::kc85_4_86_w ) +{ + LOG(("0x86 W: %02x\n", data)); + + m_port_86_data = data; + + update_0x0c000(); + update_0x04000(); +} + +READ8_MEMBER( kc85_4_state::kc85_4_86_r ) +{ + return m_port_86_data; +} + +/*****************************************************************/ + + +/* callback for ardy output from PIO */ +/* used in KC85/4 & KC85/3 cassette interface */ +WRITE_LINE_MEMBER( kc_state::pio_ardy_cb) +{ + m_ardy = state & 0x01; +} + +/* callback for brdy output from PIO */ +/* used in KC85/4 & KC85/3 keyboard interface */ +WRITE_LINE_MEMBER( kc_state::pio_brdy_cb) +{ + m_brdy = state & 0x01; +} + +/* used in cassette write -> K0 */ +WRITE_LINE_MEMBER( kc_state::ctc_zc0_callback ) +{ + if (state) + { + m_k0_line^=1; + speaker_update(); + } +} + +/* used in cassette write -> K1 */ +WRITE_LINE_MEMBER( kc_state::ctc_zc1_callback) +{ + if (state) + { + m_k1_line^=1; + speaker_update(); + + // K1 line is also cassette output + m_cassette->output((m_k1_line & 1) ? +1 : -1); + } + +} + +TIMER_DEVICE_CALLBACK_MEMBER(kc_state::kc_scanline) +{ + int scanline = (int)param; + + /* set clock input for channel 0 and 1 to ctc */ + m_z80ctc->trg0(1); + m_z80ctc->trg0(0); + m_z80ctc->trg1(1); + m_z80ctc->trg1(0); + + if (scanline == 256) + { + /* set clock input for channel 2 and 3 to ctc */ + m_z80ctc->trg2(1); + m_z80ctc->trg2(0); + m_z80ctc->trg3(1); + m_z80ctc->trg3(0); + } +} + +void kc_state::speaker_update() +{ + /* this might not be correct, the range might be logarithmic and not linear! */ + m_speaker->level_w(m_k0_line ? (m_speaker_level | (m_k1_line ? 0x01 : 0)) : 0); +} + +/* keyboard callback */ +WRITE_LINE_MEMBER( kc_state::keyboard_cb ) +{ + m_z80pio->strobe_b(state & m_brdy); + + // FIXME: understand why the PIO fail to acknowledge the irq on kc85_2/3 + m_z80pio->data_write(1, m_pio_data[1]); +} + + +void kc_state::machine_start() +{ + m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kc_state::kc_cassette_timer_callback),this)); + m_cassette_oneshot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kc_state::kc_cassette_oneshot_timer),this)); + + m_ram_base = m_ram->pointer(); + + m_expansions[0] = machine().device("m8"); + m_expansions[1] = machine().device("mc"); + m_expansions[2] = machine().device("exp"); +} + +void kc_state::machine_reset() +{ + m_pio_data[0] = 0x0f; + m_pio_data[1] = 0xf1; + + update_0x00000(); + update_0x04000(); + update_0x08000(); + update_0x0c000(); + update_0x0e000(); + + // set low resolution at reset + m_high_resolution = 0; + + cassette_set_motor(0); + + /* this is temporary. Normally when a Z80 is reset, it will + execute address 0. It appears the KC85 series pages the rom + at address 0x0000-0x01000 which has a single jump in it, + can't see yet where it disables it later!!!! so for now + here will be a override */ + m_maincpu->set_pc(0x0f000); +} + +void kc85_4_state::machine_reset() +{ + kc_state::machine_reset(); + + m_port_84_data = 0x00; + m_port_86_data = 0x00; +} diff --git a/src/mame/machine/kc_keyb.c b/src/mame/machine/kc_keyb.c new file mode 100644 index 00000000000..740d0dc7fce --- /dev/null +++ b/src/mame/machine/kc_keyb.c @@ -0,0 +1,614 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/********************************************************************* + + kc_keyb.c + + KC85_2/3/4/5 Keyboard emulation + +********************************************************************** + + E-mail from Torsten Paul about the keyboard: + + Torsten.Paul@gmx.de + +"> I hope that you will be able to help me so I can add keyboard +> emulation to it. +> +Oh yes the keyboard caused me a lot of trouble too. I still don't +understand it completely. +A first dirty but working keyboard support is quite easy because +of the good and modular system rom. Most programs use the supplied +routines to read keyboard input so patching the right memory address +with the keycode that is originally supplied by the interrupt +routines for keyboard input will work. So if you first want to +have a simple start to get other things to work you can try this. + + * write keycode (ascii) to address IX+0dh (0x1fd) + * set bit 0 at address IX+08h (0x1f8) - simply writing 01h + worked for me but some other bits are used too + this bit is reset if the key is read by the system + +> From the schematics I see that the keyboard is linked to the CTC and PIO, +> but I don't understand it fully. +> Please can you tell me more about how the keyboard is scanned? +> +The full emulation is quite tricky and I still have some programs that +behave odd. (A good hint for a correct keyboard emulation is Digger ;-). + +Ok, now the technical things: + +The keyboard of the KC is driven by a remote control circuit that is +originally designed for infrared remote control. This one was named +U807 and I learned there should be a similar chip called SAB 3021 +available but I never found the specs on the web. The SAB 3021 was +produced by Valvo which doesn't exist anymore (bought by Phillips +if I remember correctly). If you have more luck finding the specs +I'm still interested. +There also was a complementary chip for the recieving side but that +was not used in the KC unfortunately. They choosed to measure the +pulses sent by the U807 via PIO and CTC. + +Anyway here is what I know about the protocol: + +The U807 sends impulses with equal length. The information is +given by the time between two impulses. Short time means bit is 1 +long time mean bit is 0. The impulses are modulated by a 62.5 kHz +Signal but that's not interesting for the emulator. +The timing comes from a base clock of 4 MHz that is divided +multiple times: + +4 MHz / 64 - 62.5 kHz -> used for filtered amplification +62.5 kHz / 64 - 976 Hz -> 1.024 ms +976 / 7 - 140 Hz -> 7.2 ms +976 / 5 - 195 Hz -> 5.1 ms + +short - 5.12 ms - 1 bit +long - 7.168 ms - 0 bit + + +-+ +-+ +-+ +-+ + | | | | | | | | + +--+ +-----+ +-------+ +-----+ +--.... + + | | |---0---| |--1--| + ^ + | + Startbit = shift key + +The keyboard can have 64 keys with an additional key that is used by +the KC as shift key. This additional key is directly connected to the +chip and changes the startbit. All other keys are arranged in a matrix. + +The chip sends full words of 7 bits (including the startbit) at least +twice for each keypress with a spacing of 14 * 1.024 ms. If the key +is still pressed the double word is repeated after 19 * 1.024 ms. + +The impulses trigger the pio interrupt line for channel B that +triggers the time measurement by the CTC channel 3." + + +********************************************************************** + + + The CTC timer 3 count is initialised at 0x08f and counts down. + + The pulses are connected into PIO /BSTB and generate a interrupt + on a positive edge. A pulse will not get through if BRDY from PIO is + not true! + + Then the interrupt occurs, the CTC count is read. The time between + pulses is therefore measured by the CTC. + + The time is checked and depending on the value the KC detects + a 1 or 0 bit sent from the keyboard. + + Summary From code below: + + 0x065<=count<0x078 -> 0 bit "short pulse" + 0x042<=count<0x065 -> 1 bit "long pulse" + count<0x014 -> ignore + count>=0x078 -> ignore + 0x014<=count<0x042 -> signal end of code "very long pulse" + + codes are sent bit 0, bit 1, bit 2...bit 7. bit 0 is the state + of the shift key. + + Torsten's e-mail indicates "short pulse" for 1 bit, and "long + pulse" for 0 bit, but I found this to be incorrect. However, + the timings are correct. + + + Keyboard reading procedure extracted from KC85/4 system rom: + +0345 f5 push af +0346 db8f in a,(#8f) ; get CTC timer 3 count +0348 f5 push af +0349 3ea7 ld a,#a7 ; channel 3, enable int, select counter mode, control word + ; write, software reset, time constant follows +034b d38f out (#8f),a +034d 3e8f ld a,#8f ; time constant +034f d38f out (#8f),a +0351 f1 pop af + +0352 fb ei +0353 b7 or a ; count is over +0354 284d jr z,#03a3 ; + + ;; check count is in range +0356 fe14 cp #14 +0358 3849 jr c,#03a3 ; +035a fe78 cp #78 +035c 3045 jr nc,#03a3 ; + + ;; at this point, time must be between #14 and #77 to be valid + + ;; if >=#65, then carry=0, and a 0 bit has been detected + +035e fe65 cp #65 +0360 303d jr nc,#039f ; (61) + + ;; if <#65, then a 1 bit has been detected. carry is set with the addition below. + ;; a carry will be generated if the count is >#42 + + ;; therefore for a 1 bit to be generated, then #42<=time<#65 + ;; must be true. + +0362 c6be add a,#be +0364 3839 jr c,#039f ; (57) + + ;; this code appears to take the transmitted scan-code + ;; and converts it into a useable code by the os??? +0366 e5 push hl +0367 d5 push de + ;; convert hardware scan-code into os code +0368 dd7e0c ld a,(ix+#0c) +036b 1f rra +036c ee01 xor #01 +036e dd6e0e ld l,(ix+#0e) +0371 dd660f ld h,(ix+#0f) +0374 1600 ld d,#00 +0376 5f ld e,a +0377 19 add hl,de +0378 7e ld a,(hl) +0379 d1 pop de +037a e1 pop hl + + ;; shift lock pressed? +037b ddcb087e bit 7,(ix+#08) +037f 200a jr nz,#038b + ;; no. + + ;; alpha char? +0381 fe40 cp #40 +0383 3806 jr c,#038b +0385 fe80 cp #80 +0387 3002 jr nc,#038b + ;; yes, it is a alpha char + ;; force to lower case +0389 ee20 xor #20 + +038b ddbe0d cp (ix+#0d) ;; same as stored? +038e 201d jr nz,#03ad + + ;; yes - must be held for a certain time before it can repeat? +0390 f5 push af +0391 3ae0b7 ld a,(#b7e0) +0394 ddbe0a cp (ix+#0a) +0397 3811 jr c,#03aa +0399 f1 pop af + +039a dd340a inc (ix+#0a) ;; incremenent repeat count? +039d 1804 jr #03a3 + + ;; update scan-code received so far + +039f ddcb0c1e rr (ix+#0c) ; shift in 0 or 1 bit depending on what has been selected + +03a3 db89 in a,(#89) ; used to clear brdy +03a5 d389 out (#89),a +03a7 f1 pop af +03a8 ed4d reti + +03aa f1 pop af +03ab 1808 jr #03b5 + +;; clear count +03ad dd360a00 ld (ix+#0a),#00 + +;; shift lock? +03b1 fe16 cp #16 +03b3 2809 jr z,#03be + +;; store char +03b5 dd770d ld (ix+#0d),a +03b8 ddcb08c6 set 0,(ix+#08) +03bc 18e5 jr #03a3 + +;; toggle shift lock on/off +03be dd7e08 ld a,(ix+#08) +03c1 ee80 xor #80 +03c3 dd7708 ld (ix+#08),a +;; shift/lock was last key pressed +03c6 3e16 ld a,#16 +03c8 18eb jr #03b5 + +03ca b7 or a +03cb ddcb0846 bit 0,(ix+#08) +03cf c8 ret z +03d0 dd7e0d ld a,(ix+#0d) +03d3 37 scf +03d4 c9 ret +03d5 cdcae3 call #e3ca +03d8 d0 ret nc +03d9 ddcb0886 res 0,(ix+#08) +03dd c9 ret +03de cdcae3 call #e3ca +03e1 d0 ret nc +03e2 fe03 cp #03 +03e4 37 scf +03e5 c8 ret z +03e6 a7 and a +03e7 c9 ret + + + Keyboard reading procedure extracted from KC85/3 rom: + + +019a f5 push af +019b db8f in a,(#8f) +019d f5 push af +019e 3ea7 ld a,#a7 +01a0 d38f out (#8f),a +01a2 3e8f ld a,#8f +01a4 d38f out (#8f),a +01a6 f1 pop af +01a7 ddcb085e bit 3,(ix+#08) +01ab ddcb089e res 3,(ix+#08) +01af 2055 jr nz,#0206 ; (85) + +01b1 fe65 cp #65 +01b3 3054 jr nc,#0209 + + + ;; count>=#65 = 0 bit + ;; #44<=count<#65 = 1 bit + ;; count<#44 = end of code + +01b5 fe44 cp #44 +01b7 3053 jr nc,#020c +01b9 e5 push hl +01ba d5 push de +01bb ddcb0c3e srl (ix+#0c) +01bf dd7e08 ld a,(ix+#08) +01c2 e680 and #80 +01c4 07 rlca +01c5 ddae0c xor (ix+#0c) +01c8 2600 ld h,#00 +01ca dd5e0e ld e,(ix+#0e) +01cd dd560f ld d,(ix+#0f) +01d0 6f ld l,a +01d1 19 add hl,de +01d2 7e ld a,(hl) +01d3 d1 pop de +01d4 e1 pop hl +01d5 ddbe0d cp (ix+#0d) +01d8 2811 jr z,#01eb ; (17) +01da dd770d ld (ix+#0d),a +01dd ddcb08a6 res 4,(ix+#08) +01e1 ddcb08c6 set 0,(ix+#08) +01e5 dd360a00 ld (ix+#0a),#00 +01e9 181b jr #0206 ; (27) +01eb dd340a inc (ix+#0a) +01ee ddcb0866 bit 4,(ix+#08) +01f2 200c jr nz,#0200 ; (12) +01f4 ddcb0a66 bit 4,(ix+#0a) +01f8 280c jr z,#0206 ; (12) +01fa ddcb08e6 set 4,(ix+#08) +01fe 18e1 jr #01e1 ; (-31) +0200 ddcb0a4e bit 1,(ix+#0a) +0204 20db jr nz,#01e1 ; (-37) +0206 f1 pop af +0207 ed4d reti +0209 b7 or a +020a 1801 jr #020d ; (1) +020c 37 scf +020d ddcb0c1e rr (ix+#0c) +0211 18f3 jr #0206 ; (-13) + +*********************************************************************/ + + +#include "emu.h" +#include "kc_keyb.h" + +#define VERBOSE 0 +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type KC_KEYBOARD = &device_creator; + +//************************************************************************** +// Input Ports +//************************************************************************** + +// this is a fake keyboard layout. The keys are converted into codes +// which are transmitted by the keyboard to the base-unit. key code can +// be calculated as (line*8)+bit_index + +static INPUT_PORTS_START( kc_keyboard ) + // start of keyboard scan-codes + // codes 0-7 + PORT_START("KEY0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + // codes 8-15 + PORT_START("KEY1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR(0x00AC) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clr") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + // codes 16-23 + PORT_START("KEY2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + // codes 24-31 + PORT_START("KEY3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Brk") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + // codes 32-39 + PORT_START("KEY4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + // codes 40-47 + PORT_START("KEY5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x08, 0x00, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + // codes 48-56 + PORT_START("KEY6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('+') PORT_CHAR(';') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + // codes 56-63 + PORT_START("KEY7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + // end of keyboard scan-codes + PORT_START("SHIFT") + // has a single shift key. Mapped here to left and right shift. + // shift is connected to the MOC pin of the U807 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) +INPUT_PORTS_END + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// kc_keyboard_device - constructor +//------------------------------------------------- +kc_keyboard_device::kc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, KC_KEYBOARD, "KC Keyboard", tag, owner, clock, "kc_keyboard", __FILE__), + m_write_out(*this) +{ +} + +//------------------------------------------------- +// kc_keyboard_device - destructor +//------------------------------------------------- + +kc_keyboard_device::~kc_keyboard_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void kc_keyboard_device::device_start() +{ + // resolve callbacks + m_write_out.resolve_safe(); + + m_timer_transmit_pulse = timer_alloc(TIMER_TRANSMIT_PULSE); + + m_timer_transmit_pulse->adjust(attotime::from_usec(1024), 0, attotime::from_usec(1024)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void kc_keyboard_device::device_reset() +{ + // set initial state + m_write_out(CLEAR_LINE); + + m_transmit_buffer.pulse_sent = 0; + m_transmit_buffer.pulse_count = 0; + + memset(&m_transmit_buffer, 0, sizeof(m_transmit_buffer)); +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor kc_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( kc_keyboard ); +} + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void kc_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_TRANSMIT_PULSE: + if (m_transmit_buffer.pulse_sent < m_transmit_buffer.pulse_count) + { + // byte containing pulse state + int pulse_byte_count = m_transmit_buffer.pulse_sent>>3; + // bit within byte containing pulse state + int pulse_bit_count = 7 - (m_transmit_buffer.pulse_sent & 0x07); + + // get current pulse state + int pulse_state = (m_transmit_buffer.data[pulse_byte_count]>>pulse_bit_count) & 0x01; + + LOG(("KC keyboard sending pulse: %02x\n", pulse_state)); + + // send pulse + m_write_out(pulse_state ? ASSERT_LINE : CLEAR_LINE); + + // update counts + m_transmit_buffer.pulse_sent++; + } + else + { + // if there is nothing to send, rescan the keyboard + static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7" }; + + m_transmit_buffer.pulse_sent = 0; + m_transmit_buffer.pulse_count = 0; + + // scan all lines (excluding shift) + for (int i=0; i<8; i++) + { + UINT8 keyboard_line_data = ioport(keynames[i])->read(); + + // scan through each bit + for (int b=0; b<8; b++) + { + // is pressed? + if ((keyboard_line_data & (1<>3; + int pulse_bit_count = 7-(m_transmit_buffer.pulse_count & 0x07); + + if (pulse_state) + m_transmit_buffer.data[pulse_byte_count] |= (1< end of time for bit + add_pulse_to_transmit_buffer(1); +} + + +//------------------------------------------------- +// begin pulse transmit +//------------------------------------------------- + +void kc_keyboard_device::transmit_scancode(UINT8 scan_code) +{ + // initial pulse -> start of code + add_pulse_to_transmit_buffer(1); + + // state of shift key + add_bit((ioport("SHIFT")->read() & 0x01)^0x01); + + for (int i=0; i<6; i++) + { + // each bit in turn + add_bit(scan_code & (1< kc_keyboard_device + +class kc_keyboard_device : public device_t +{ +public: + // construction/destruction + kc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~kc_keyboard_device(); + + template static devcb_base &set_out_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_out.set_callback(object); } + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + void add_pulse_to_transmit_buffer(int pulse_state, int pulse_number = 1); + void add_bit(int bit); + void transmit_scancode(UINT8 scan_code); + +private: + static const device_timer_id TIMER_TRANSMIT_PULSE = 1; + + // internal state + emu_timer * m_timer_transmit_pulse; + devcb_write_line m_write_out; + + // pulses to transmit + struct + { + UINT8 data[KC_TRANSMIT_BUFFER_LENGTH>>3]; + int pulse_sent; + int pulse_count; + } m_transmit_buffer; +}; + +// device type definition +extern const device_type KC_KEYBOARD; + +#endif /* __KC_KEYB_H__ */ diff --git a/src/mame/machine/kramermc.c b/src/mame/machine/kramermc.c new file mode 100644 index 00000000000..503dbf711f5 --- /dev/null +++ b/src/mame/machine/kramermc.c @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Kramer MC machine driver by Miodrag Milanovic + + 13/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "machine/z80pio.h" +#include "includes/kramermc.h" + + +READ8_MEMBER(kramermc_state::kramermc_port_a_r) +{ + return 0xff; +} + +READ8_MEMBER(kramermc_state::kramermc_port_b_r) +{ + static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; + + return ioport(keynames[m_key_row])->read(); +} + +WRITE8_MEMBER(kramermc_state::kramermc_port_a_w) +{ + m_key_row = ((data >> 1) & 0x07); +} + +/* Driver initialization */ +DRIVER_INIT_MEMBER(kramermc_state,kramermc) +{ +} + +void kramermc_state::machine_reset() +{ + m_key_row = 0; +} diff --git a/src/mame/machine/lisa.c b/src/mame/machine/lisa.c new file mode 100644 index 00000000000..2e2b2bb6bc6 --- /dev/null +++ b/src/mame/machine/lisa.c @@ -0,0 +1,1927 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + experimental LISA driver + + This driver runs most ROM test code successfully, and it loads the boot + file, but it locks when booting from Lisa OS (probably because of floppy + write bug). MacWorks boots fine, though (I think it looks when we + attempt to write to floppy, too). + + TODO : + * fix floppy write bug + * *** Boot and run LisaTest !!! *** + * finish MMU (does not switch to bank 0 on 68k trap) --- fixed in June 2003??? + * support hard disk to boot office system + * finish keyboard/mouse support + * finish clock support + * write SCC support + * finalize sound support (involves adding new features to the 6522 VIA core) + * fix warm-reset (I think I need to use a callback when 68k RESET + instruction is called) + * write support for additionnal hardware (hard disk, etc...) + * emulate LISA1 (?) + * optimize MMU emulation ! + + DONE (just a reminder to uplift my spirit) : + * the lion's share of MMU (spring 2000) + * video hardware (except contrast control) (spring 2000) + * LISA2/Mac XL floppy hardware (november 2000) + + Credits : + * the lisaemu project () has gathered much + hardware information (books, schematics...) without which this driver + could never have been written + * The driver raised the interest of several MESS regulars (Paul Lunga, + Dennis Munsie...) who supported my feeble efforts + + Raphael Nabet, 2000-2003 +*/ + +#include "includes/lisa.h" + + +/* + pointers with RAM & ROM location +*/ + +/* up to 2MB of 68k RAM (normally 1MB or 512kb), generally 16kb of ROM */ + +/* offsets in "maincpu" */ +#define RAM_OFFSET 0x004000 +#define ROM_OFFSET 0x000000 + +/* 1kb of RAM for 6504 floppy disk controller (shared with 68000), and 4kb of +ROM (8kb on some boards, but then only one 4kb bank is selected, according to +the drive type (TWIGGY or 3.5'')) */ + +/* special ROM (includes S/N) */ + + +/* + MMU regs +*/ + + + + + +/* + parity logic - only hard errors are emulated for now, since + a) the ROMs power-up test only tests hard errors + b) most memory boards do not use soft errors (i.e. they only generate 1 + parity bit to detect errors, instead of generating several ECC bits to + fix errors) +*/ + + + + +/* + video +*/ + + +/* + 2 vias : one is used for communication with COPS ; the other may be used to interface + a hard disk +*/ + +/* + floppy disk interface +*/ + + + + +/* + lisa model identification +*/ +enum lisa_model_t +{ + /*lisa1,*/ /* twiggy floppy drive */ + lisa2, /* 3.5'' Sony floppy drive */ + lisa210, /* modified I/O board, and internal 10Meg drive */ + mac_xl /* same as above with modified video */ +}; + + + +/* + protos +*/ + + + + + +/* + Interrupt handling +*/ + +void lisa_state::field_interrupts() +{ + if (m_parity_error_pending) + return; /* don't touch anything... */ + +#if 0 + if (RSIR) + // serial interrupt + m_maincpu->set_input_line_and_vector(M68K_IRQ_6, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + else if (int0) + // external interrupt + m_maincpu->set_input_line_and_vector(M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + else if (int1) + // external interrupt + m_maincpu->set_input_line_and_vector(M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + else if (int2) + // external interrupt + m_maincpu->set_input_line_and_vector(M68K_IRQ_3, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + else +#endif + if (m_KBIR) + /* COPS VIA interrupt */ + m_maincpu->set_input_line_and_vector(M68K_IRQ_2, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + else if (m_FDIR || m_VTIR) + /* floppy disk or VBl */ + m_maincpu->set_input_line_and_vector(M68K_IRQ_1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + else + /* clear all interrupts */ + m_maincpu->set_input_line_and_vector(M68K_IRQ_1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); +} + +void lisa_state::set_parity_error_pending(int value) +{ +#if 1 + /* does not work well due to bugs in 68k cores */ + m_parity_error_pending = value; + if (m_parity_error_pending) + { + m_maincpu->set_input_line_and_vector(M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + } + else + { + m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); + } +#else + /* work-around... */ + if ((! m_parity_error_pending) && value) + { + m_parity_error_pending = 1; + m_maincpu->set_input_line_and_vector(M68K_IRQ_7, PULSE_LINE, M68K_INT_ACK_AUTOVECTOR); + } + else if (m_parity_error_pending && (! value)) + { + m_parity_error_pending = 0; + field_interrupts(); + } +#endif +} + +void lisa_state::set_VTIR(int value) +{ + if (m_VTIR != value) + { + m_VTIR = value; + if (m_VTIR==1) + field_interrupts(); + } +} + + + +/* + keyboard interface (COPS simulation; our COPS CPU core is too broken and too esoteric to emulate this correctly, I tried) +*/ + +void lisa_state::COPS_send_data_if_possible() +{ + if ((! m_hold_COPS_data) && m_fifo_size && (! m_COPS_Ready)) + { +// printf("COPsim: sending %02x to VIA\n", m_fifo_data[m_fifo_head]); + + UINT8 data = m_fifo_data[m_fifo_head];/* output data */ + m_via0->write_pa0((data>>0)&1); + m_via0->write_pa1((data>>1)&1); + m_via0->write_pa2((data>>2)&1); + m_via0->write_pa3((data>>3)&1); + m_via0->write_pa4((data>>4)&1); + m_via0->write_pa5((data>>5)&1); + m_via0->write_pa6((data>>6)&1); + m_via0->write_pa7((data>>7)&1); + + if (m_fifo_head == m_mouse_data_offset) + m_mouse_data_offset = -1; /* we just phased out the mouse data in buffer */ + m_fifo_head = (m_fifo_head+1) & 0x7; + m_fifo_size--; + m_via0->write_ca1(1); /* pulse ca1 so that VIA reads it */ + m_via0->write_ca1(0); /* BTW, I have no idea how a real COPS does it ! */ + } +} + +/* send data (queue it into the FIFO if needed) */ +void lisa_state::COPS_queue_data(const UINT8 *data, int len) +{ +#if 0 + if (m_fifo_size + len <= 8) +#else + /* trash old data */ + while (m_fifo_size > 8 - len) + { + if (m_fifo_head == m_mouse_data_offset) + m_mouse_data_offset = -1; /* we just phased out the mouse data in buffer */ + m_fifo_head = (m_fifo_head+1) & 0x7; + m_fifo_size--; + } +#endif + + { +// printf("Adding %d bytes of data to FIFO\n", len); + + while (len--) + { + m_fifo_data[m_fifo_tail] = * (data++); + m_fifo_tail = (m_fifo_tail+1) & 0x7; + m_fifo_size++; + } + + // do not try to send immediately here, the VIA is set to latch mode so + // sending too soon after a command can result in the DDR not yet being + // returned to input and the first byte gets trashed + } +} + +/* + scan_keyboard() + + scan the keyboard, and add key transition codes to buffer as needed +*/ +/* shamelessly stolen from machine/mac.c :-) */ + +/* keyboard matrix to detect transition */ + +void lisa_state::scan_keyboard() +{ + int i, j; + UINT8 keycode; + UINT8 keybuf[8] = { m_io_line0->read(), m_io_line1->read(), m_io_line2->read(), m_io_line3->read(), + m_io_line4->read(), m_io_line5->read(), m_io_line6->read(), m_io_line7->read() }; + + if (! m_COPS_force_unplug) + for (i=0; i<8; i++) + { + if (keybuf[i] != m_key_matrix[i]) + { /* if state has changed, find first bit which has changed */ + /*logerror("keyboard state changed, %d %X\n", i, keybuf);*/ + + for (j=0; j<16; j++) + { + if (((keybuf[i] ^ m_key_matrix[i]) >> j) & 1) + { + /* update key_matrix */ + m_key_matrix[i] = (m_key_matrix[i] & ~ (1 << j)) | (keybuf[i] & (1 << j)); + + /* create key code */ + keycode = (i << 4) | j; + if (keybuf[i] & (1 << j)) + { /* key down */ + keycode |= 0x80; + } +#if 0 + if (keycode == m_NMIcode) + { /* generate NMI interrupt */ + m_maincpu->set_input_line(M68K_IRQ_7, PULSE_LINE); + m_maincpu->set_input_line_vector(M68K_IRQ_7, M68K_INT_ACK_AUTOVECTOR); + } +#endif + COPS_queue_data(&keycode, 1); + } + } + } + } +} + +/* handle mouse moves */ +/* shamelessly stolen from machine/mac.c :-) */ +TIMER_CALLBACK_MEMBER(lisa_state::handle_mouse) +{ + int diff_x = 0, diff_y = 0; + int new_mx, new_my; + +#if 0 + if (m_COPS_force_unplug) + return; /* ???? */ +#endif + + new_mx = m_io_mouse_x->read(); + new_my = m_io_mouse_y->read(); + + /* see if it moved in the x coord */ + if (new_mx != m_last_mx) + { + diff_x = new_mx - m_last_mx; + + /* check for wrap */ + if (diff_x > 0x80) + diff_x = 0x100-diff_x; + if (diff_x < -0x80) + diff_x = -0x100-diff_x; + + m_last_mx = new_mx; + } + /* see if it moved in the y coord */ + if (new_my != m_last_my) + { + diff_y = new_my - m_last_my; + + /* check for wrap */ + if (diff_y > 0x80) + diff_y = 0x100-diff_y; + if (diff_y < -0x80) + diff_y = -0x100-diff_y; + + m_last_my = new_my; + } + + /* update any remaining count and then return */ + if (diff_x || diff_y) + { + if (m_mouse_data_offset != -1) + { + m_fifo_data[m_mouse_data_offset] += diff_x; + m_fifo_data[(m_mouse_data_offset+1) & 0x7] += diff_y; + } + else + { +#if 0 + if (m_fifo_size <= 5) +#else + /* trash old data */ + while (m_fifo_size > 5) + { + m_fifo_head = (m_fifo_head+1) & 0x7; + m_fifo_size--; + } +#endif + + { + /*logerror("Adding 3 bytes of mouse data to FIFO\n");*/ + + m_fifo_data[m_fifo_tail] = 0; + m_mouse_data_offset = m_fifo_tail = (m_fifo_tail+1) & 0x7; + m_fifo_data[m_fifo_tail] = diff_x; + m_fifo_tail = (m_fifo_tail+1) & 0x7; + m_fifo_data[m_fifo_tail] = diff_y; + m_fifo_tail = (m_fifo_tail+1) & 0x7; + m_fifo_size += 3; + + /*logerror("handle_mouse : trying to send data to VIA\n");*/ + COPS_send_data_if_possible(); + } + /* else, mouse data is lost forever (correct ??) */ + } + } +} + +/* read command from the VIA port A */ +TIMER_CALLBACK_MEMBER(lisa_state::read_COPS_command) +{ + int command; + address_space &space = m_maincpu->space(AS_PROGRAM); + + m_COPS_Ready = 0; + m_via0->write_pb6(m_COPS_Ready); + + /*logerror("read_COPS_command : trying to send data to VIA\n");*/ + COPS_send_data_if_possible(); + + /* some pull-ups allow the COPS to read 1s when the VIA port is not set as output */ + command = (m_COPS_command | (~ m_via0->read(space, via6522_device::VIA_DDRA))) & 0xff; + +// printf("Dropping Ready, command = %02x\n", command); + + if (command & 0x80) + return; /* NOP */ + + if (command & 0xF0) + { /* commands with 4-bit immediate operand */ + int immediate = command & 0xf; + + switch ((command & 0xF0) >> 4) + { + case 0x1: /* write clock data */ + if (m_clock_regs.clock_write_ptr != -1) + { + switch (m_clock_regs.clock_write_ptr) + { + case 0: + case 1: + case 2: + case 3: + case 4: + /* alarm */ + m_clock_regs.alarm &= ~ (0xf << (4 * (4 - m_clock_regs.clock_write_ptr))); + m_clock_regs.alarm |= immediate << (4 * (4 - m_clock_regs.clock_write_ptr)); + break; + case 5: + /* year */ + m_clock_regs.years = immediate; + break; + case 6: + /* day */ + m_clock_regs.days1 = immediate; + break; + case 7: + /* day */ + m_clock_regs.days2 = immediate; + break; + case 8: + /* day */ + m_clock_regs.days3 = immediate; + break; + case 9: + /* hours */ + m_clock_regs.hours1 = immediate; + break; + case 10: + /* hours */ + m_clock_regs.hours2 = immediate; + break; + case 11: + /* minutes */ + m_clock_regs.minutes1 = immediate; + break; + case 12: + /* minutes */ + m_clock_regs.minutes1 = immediate; + break; + case 13: + /* seconds */ + m_clock_regs.seconds1 = immediate; + break; + case 14: + /* seconds */ + m_clock_regs.seconds2 = immediate; + break; + case 15: + /* tenth */ + m_clock_regs.tenths = immediate; + break; + } + m_clock_regs.clock_write_ptr++; + if (m_clock_regs.clock_write_ptr == 16) + m_clock_regs.clock_write_ptr = -1; + } + + break; + + case 0x2: /* set clock mode */ + if (immediate & 0x8) + { /* start setting the clock */ + m_clock_regs.clock_write_ptr = 0; + } + else + { /* clock write disabled */ + m_clock_regs.clock_write_ptr = -1; + } + + if (! (immediate & 0x4)) + { /* enter sleep mode */ + /* ... */ + } + else + { /* wake up */ + /* should never happen */ + } + + m_clock_regs.clock_mode = (clock_mode_t)(immediate & 0x3); + break; + +#if 0 + /* LED commands - not implemented in production LISAs */ + case 0x3: /* write 4 keyboard LEDs */ + keyboard_leds = (keyboard_leds & 0x0f) | (immediate << 4); + break; + + case 0x4: /* write next 4 keyboard LEDs */ + keyboard_leds = (keyboard_leds & 0xf0) | immediate; + break; +#endif + + case 0x5: /* set high nibble of NMI character to nnnn */ + m_NMIcode = (m_NMIcode & 0x0f) | (immediate << 4); + break; + + case 0x6: /* set low nibble of NMI character to nnnn */ + m_NMIcode = (m_NMIcode & 0xf0) | immediate; + break; + + case 0x7: /* send mouse command */ + if (immediate & 0x8) + m_mouse_timer->adjust(attotime::zero, 0, attotime::from_msec((immediate & 0x7)*4)); /* enable mouse */ + else + m_mouse_timer->reset(); + break; + } + } + else + { /* operand-less commands */ + switch (command) + { + case 0x0: /*Turn I/O port on (???) */ + + break; + + case 0x1: /*Turn I/O port off (???) */ + + break; + + case 0x2: /* Read clock data */ + { + /* format and send reply */ + + UINT8 reply[7]; + + reply[0] = 0x80; + reply[1] = 0xE0 | m_clock_regs.years; + reply[2] = (m_clock_regs.days1 << 4) | m_clock_regs.days2; + reply[3] = (m_clock_regs.days3 << 4) | m_clock_regs.hours1; + reply[4] = (m_clock_regs.hours2 << 4) | m_clock_regs.minutes1; + reply[5] = (m_clock_regs.minutes2 << 4) | m_clock_regs.seconds1; + reply[6] = (m_clock_regs.seconds2 << 4) | m_clock_regs.tenths; + + COPS_queue_data(reply, 7); + } + break; + } + } +} + +/* this timer callback raises the COPS Ready line, which tells the COPS is about to read a command */ +TIMER_CALLBACK_MEMBER(lisa_state::set_COPS_ready) +{ + m_COPS_Ready = 1; + m_via0->write_pb6(m_COPS_Ready); + + /* impulsion width : +/- 20us */ + machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(lisa_state::read_COPS_command),this)); +} + +void lisa_state::reset_COPS() +{ + int i; + + m_fifo_size = 0; + m_fifo_head = 0; + m_fifo_tail = 0; + m_mouse_data_offset = -1; + + for (i=0; i<8; i++) + m_key_matrix[i] = 0; + + m_mouse_timer->reset(); +} + +void lisa_state::unplug_keyboard() +{ + static const UINT8 cmd[2] = + { + 0x80, /* RESET code */ + 0xFD /* keyboard unplugged */ + }; + + COPS_queue_data(cmd, 2); +} + +void lisa_state::plug_keyboard() +{ + /* + possible keyboard IDs according to Lisa Hardware Manual and boot ROM source code + + 2 MSBs : "mfg code" (-> 0x80 for Keytronics, 0x00 for "APD") + 6 LSBs : + 0x0x : "old US keyboard" + 0x3f : US keyboard + 0x3d : Canadian keyboard + 0x2f : UK + 0x2e : German + 0x2d : French + 0x27 : Swiss-French + 0x26 : Swiss-German + unknown : spanish, US dvorak, italian & swedish + */ + + static const UINT8 cmd[2] = + { + 0x80, /* RESET code */ + 0x3f /* keyboard ID - US for now */ + }; + + COPS_queue_data(cmd, 2); +} + + +/* called at power-up */ +void lisa_state::init_COPS() +{ + m_COPS_Ready = 0; + m_via0->write_pb6(m_COPS_Ready); + + reset_COPS(); +} + + + +/* VIA1 accessors (COPS, sound, and 2 hard disk lines) */ + +/* + PA0-7 (I/O) : VIA <-> COPS data bus + CA1 (I) : COPS sending valid data + CA2 (O) : VIA -> COPS handshake +*/ +WRITE8_MEMBER(lisa_state::COPS_via_out_a) +{ +// printf("VIA A = %02x\n", data); + m_COPS_command = data; +} + +WRITE_LINE_MEMBER(lisa_state::COPS_via_out_ca2) +{ + m_hold_COPS_data = state; + + /*logerror("COPS CA2 line state : %d\n", val);*/ + + /*logerror("COPS_via_out_ca2 : trying to send data to VIA\n");*/ + COPS_send_data_if_possible(); +} + +/* + PB7 (O) : CR* ("Controller Reset", used by hard disk interface) ??? + PB6 (I) : CRDY ("COPS ready") : set low by the COPS for 20us when it is reading a command + from the data bus (command latched at low-to-high transition) + PB5 (I/O) : PR* ; as output : "parity error latch reset" (only when CR* and RESET* are + inactive) ; as input : low when CR* or RESET are low. + PB4 (I) : FDIR (floppy disk interrupt request - the fdc shared RAM should not be accessed + unless this bit is 1) + PB1-3 (O) : sound volume + PB0 (O) : forces disconnection of keyboard and mouse (allows to retrive keyboard ID, etc.) + + CB1 : not used + CB2 (O) : sound output +*/ + +WRITE8_MEMBER(lisa_state::COPS_via_out_b) +{ + /* pull-up */ + data |= (~ m_via0->read(space, via6522_device::VIA_DDRA)) & 0x01; + + if (data & 0x01) + { + if (m_COPS_force_unplug) + { + m_COPS_force_unplug = 0; + plug_keyboard(); + } + } + else + { + if (! m_COPS_force_unplug) + { + m_COPS_force_unplug = 1; + unplug_keyboard(); + //reset_COPS(state); + } + } +} + +WRITE_LINE_MEMBER(lisa_state::COPS_via_out_cb2) +{ + m_speaker->level_w(state); +} + +void lisa_state::COPS_via_irq_func(int val) +{ + if (m_KBIR != val) + { + m_KBIR = val; + field_interrupts(); + } +} + +/* VIA2 accessors (hard disk, and a few floppy disk lines) */ + +/* + PA0-7 (I/O) : VIA <-> hard disk data bus (cf PB3) + CA1 (I) : hard disk BSY line + CA2 (O) : hard disk PSTRB* line +*/ + +/* + PB7 (O) : WCNT line : set contrast latch on low-to-high transition ? + PB6 (I) : floppy disk DISK DIAG line + PB5 (I) : hard disk data DD0-7 current parity (does not depend on PB2) + PB4 (O) : hard disk CMD* line + PB3 (O) : hard disk DR/W* line ; controls the direction of the drivers on the data bus + PB2 (O) : when low, disables hard disk interface drivers + PB1 (I) : hard disk BSY line + PB0 (I) : hard disk OCD (Open Cable Detect) line : 0 when hard disk attached + CB1 : not used + CB2 (I) : current parity latch value +*/ + + + +/* + LISA video emulation +*/ + +void lisa_state::video_start() +{ +} + +/* + Video update +*/ +UINT32 lisa_state::screen_update_lisa(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 *v; + int x, y; + /* resolution is 720*364 on lisa, vs 608*431 on mac XL */ + int resx = (m_features.has_mac_xl_video) ? 608 : 720; /* width */ + int resy = (m_features.has_mac_xl_video) ? 431 : 364; /* height */ + + UINT8 line_buffer[720]; + + v = m_videoram_ptr; + + for (y = 0; y < resy; y++) + { + for (x = 0; x < resx; x++) +// line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> ((x+y*resx) & 0xf))) ? 0 : 1; + line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> (x & 0xf))) ? 0 : 1; + draw_scanline8(bitmap, 0, y, resx, line_buffer, m_palette->pens()); + } + return 0; +} + +#if 0 // we can execute directly out of read handlers now, so this shouldn't be necessary any more. #if 0'd for documentation until we get everything working. +DIRECT_UPDATE_HANDLER (lisa_OPbaseoverride) +{ + lisa_state *state = machine.driver_data(); + /* upper 7 bits -> segment # */ + int segment = (address >> 17) & 0x7f; + int the_seg = m_seg; + + address &= 0xffffff; + + printf("lisa: logical address %x\n", address); + + if (m_setup) + { + if (address & 0x004000) + { +// the_seg = 0; /* correct ??? */ + } + else + { + if (address & 0x008000) + { /* MMU register : BUS error ??? */ + printf("illegal opbase address %lX\n", (long) address); + } + else + { /* system ROMs */ + direct.explicit_configure((address & 0xffc000), (address & 0xffc000) + 0x003fff, 0xffffff, m_rom_ptr - (address & 0x3fff)); + } + + return -1; + } + + } + + if (m_maincpu->state_int(M68K_SR) & 0x2000) + { + /* supervisor mode -> force register file 0 */ + the_seg = 0; + } + + { + int seg_offset = address & 0x01ffff; + + /* add relevant origin -> address */ + offs_t mapped_address = (m_mmu_regs[the_seg][segment].sorg + seg_offset) & 0x1fffff; + + switch ((mmu_entry_t)m_mmu_regs[the_seg][segment].type) + { + case RAM_r: + case RAM_rw: + if (seg_offset > m_mmu_regs[the_seg][segment].slim) + { + /* out of segment limits : bus error */ + printf("illegal opbase address%lX\n", (long) address); + } + direct.explicit_configure((address & 0xffc000), (address & 0xffc000) + 0x003fff, 0xffffff, m_ram_ptr + mapped_address - address); + printf("RAM\n"); + break; + + case RAM_stack_r: + case RAM_stack_rw: /* stack : bus error ??? */ + case IO: /* I/O : bus error ??? */ + case invalid: /* unmapped segment */ + /* bus error */ + printf("illegal opbase address%lX\n", (long) address); + break; + + case special_IO: + direct.explicit_configure((address & 0xffc000), (address & 0xffc000) + 0x003fff, 0xffffff, m_rom_ptr + (mapped_address & 0x003fff) - address); + printf("ROM\n"); + break; + } + } + + return -1; +} +#endif + +/* should save PRAM to file */ +/* TODO : save time difference with host clock, set default date, etc */ +void lisa_state::nvram_init(nvram_device &nvram, void *data, size_t size) +{ + memset(data, 0x00, size); + + { + /* Now we copy the host clock into the Lisa clock */ + system_time systime; + machine().base_datetime(systime); + + m_clock_regs.alarm = 0xfffffL; + /* The clock count starts on 1st January 1980 */ + m_clock_regs.years = (systime.local_time.year - 1980) & 0xf; + m_clock_regs.days1 = (systime.local_time.day + 1) / 100; + m_clock_regs.days2 = ((systime.local_time.day + 1) / 10) % 10; + m_clock_regs.days3 = (systime.local_time.day + 1) % 10; + m_clock_regs.hours1 = systime.local_time.hour / 10; + m_clock_regs.hours2 = systime.local_time.hour % 10; + m_clock_regs.minutes1 = systime.local_time.minute / 10; + m_clock_regs.minutes2 = systime.local_time.minute % 10; + m_clock_regs.seconds1 = systime.local_time.second / 10; + m_clock_regs.seconds2 = systime.local_time.second % 10; + m_clock_regs.tenths = 0; + + m_clock_regs.clock_mode = timer_disable; + m_clock_regs.clock_write_ptr = -1; + } +#if 0 + UINT32 temp32; + SINT8 temp8; + temp32 = (m_clock_regs.alarm << 12) | (m_clock_regs.years << 8) | (m_clock_regs.days1 << 4) + | m_clock_regs.days2; + + temp32 = (m_clock_regs.days3 << 28) | (m_clock_regs.hours1 << 24) | (m_clock_regs.hours2 << 20) + | (m_clock_regs.minutes1 << 16) | (m_clock_regs.minutes2 << 12) + | (m_clock_regs.seconds1 << 8) | (m_clock_regs.seconds2 << 4) | m_clock_regs.tenths; + + temp8 = clock_mode; /* clock mode */ + + temp8 = m_clock_regs.clock_write_ptr; /* clock byte to be written next (-1 if clock write disabled) */ +#endif + +} + + +#ifdef UNUSED_FUNCTION +void lisa_state::init_lisa1(void) +{ + m_model = lisa1; + m_features.has_fast_timers = 0; + m_features.floppy_hardware = twiggy; + m_features.has_double_sided_floppy = 1; + m_features.has_mac_xl_video = 0; +} +#endif + +DRIVER_INIT_MEMBER(lisa_state,lisa2) +{ + m_ram_ptr = memregion("maincpu")->base() + RAM_OFFSET; + m_rom_ptr = memregion("maincpu")->base() + ROM_OFFSET; + m_model = lisa2; + m_features.has_fast_timers = 0; + m_features.floppy_hardware = sony_lisa2; + m_features.has_double_sided_floppy = 0; + m_features.has_mac_xl_video = 0; + + m_bad_parity_table = auto_alloc_array(machine(), UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ +} + +DRIVER_INIT_MEMBER(lisa_state,lisa210) +{ + m_ram_ptr = memregion("maincpu")->base() + RAM_OFFSET; + m_rom_ptr = memregion("maincpu")->base() + ROM_OFFSET; + m_model = lisa210; + m_features.has_fast_timers = 1; + m_features.floppy_hardware = sony_lisa210; + m_features.has_double_sided_floppy = 0; + m_features.has_mac_xl_video = 0; + + m_bad_parity_table = auto_alloc_array(machine(), UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ +} + +DRIVER_INIT_MEMBER(lisa_state,mac_xl) +{ + m_ram_ptr = memregion("maincpu")->base() + RAM_OFFSET; + m_rom_ptr = memregion("maincpu")->base() + ROM_OFFSET; + m_model = mac_xl; + m_features.has_fast_timers = 1; + m_features.floppy_hardware = sony_lisa210; + m_features.has_double_sided_floppy = 0; + m_features.has_mac_xl_video = 1; + + m_bad_parity_table = auto_alloc_array(machine(), UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ +} + +void lisa_state::machine_start() +{ + m_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lisa_state::handle_mouse),this)); + + /* read command every ms (don't know the real value) */ + machine().scheduler().timer_pulse(attotime::from_msec(1), timer_expired_delegate(FUNC(lisa_state::set_COPS_ready),this)); + + m_nvram->set_base(m_fdc_ram, 1024); +} + +void lisa_state::machine_reset() +{ + m_ram_ptr = memregion("maincpu")->base() + RAM_OFFSET; + m_rom_ptr = memregion("maincpu")->base() + ROM_OFFSET; + m_videoROM_ptr = memregion("gfx1")->base(); + +// m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate_create_static(lisa_OPbaseoverride, *machine())); +// m68k_set_reset_callback(m_maincpu, /*lisa_reset_instr_callback*/NULL); + + /* init MMU */ + m_setup = 1; + m_seg = 0; + + /* init parity */ + m_diag2 = 0; + m_test_parity = 0; + m_parity_error_pending = 0; + + m_bad_parity_count = 0; + memset(m_bad_parity_table, 0, 0x40000); /* Clear */ + + /* init video */ + + m_VTMSK = 0; + set_VTIR(0); + + m_video_address_latch = 0; + m_videoram_ptr = (UINT16 *) m_ram_ptr; + + m_FDIR = 0; + m_via0->write_pb4(m_FDIR); + + /* tell there is no hard disk : */ + m_via1->write_pb0(1); + + /* keep busy high to work around a bug??? */ + //m_via1->write_pb1(1); + + m_DISK_DIAG = 0; + m_via1->write_pb6(m_DISK_DIAG); + + /* reset COPS keyboard/mouse controller */ + init_COPS(); + + { + COPS_via_out_ca2(0); /* VIA core forgets to do so */ + } + + /* initialize floppy */ + { + if (m_features.floppy_hardware == sony_lisa2) + { + sony_set_enable_lines(m_fdc, 1); /* on lisa2, drive unit 1 is always selected (?) */ + } + } + + /* reset 68k to pick up proper vectors from MMU */ + m_maincpu->reset(); +} + +INTERRUPT_GEN_MEMBER(lisa_state::lisa_interrupt) +{ + if ((++m_frame_count) == 6) + { /* increment clock every 1/10s */ + m_frame_count = 0; + + if (m_clock_regs.clock_mode != clock_timer_disable) + { + if ((++m_clock_regs.tenths) == 10) + { + m_clock_regs.tenths = 0; + + if (m_clock_regs.clock_mode != timer_disable) + { + if (m_clock_regs.alarm == 0) + { + /* generate reset (should cause a VIA interrupt...) */ + static const UINT8 cmd[2] = + { + 0x80, /* RESET code */ + 0xFC /* timer time-out */ + }; + COPS_queue_data(cmd, 2); + + m_clock_regs.alarm = 0xfffffL; + } + else + { + m_clock_regs.alarm--; + } + } + + if ((++m_clock_regs.seconds2) == 10) + { + m_clock_regs.seconds2 = 0; + + if ((++m_clock_regs.seconds1) == 6) + { + m_clock_regs.seconds1 = 0; + + if ((++m_clock_regs.minutes2) == 10) + { + m_clock_regs.minutes2 = 0; + + if ((++m_clock_regs.minutes1) == 6) + { + m_clock_regs.minutes1 = 0; + + if ((++m_clock_regs.hours2) == 10) + { + m_clock_regs.hours2 = 0; + + m_clock_regs.hours1++; + } + + if ((m_clock_regs.hours1*10 + m_clock_regs.hours2) == 24) + { + m_clock_regs.hours1 = m_clock_regs.hours2 = 0; + + if ((++m_clock_regs.days3) == 10) + { + m_clock_regs.days3 = 0; + + if ((++m_clock_regs.days2) == 10) + { + m_clock_regs.days2 = 0; + + m_clock_regs.days1++; + } + } + + if ((m_clock_regs.days1*100 + m_clock_regs.days2*10 + m_clock_regs.days3) == + ((m_clock_regs.years % 4) ? 366 : 367)) + { + m_clock_regs.days1 = m_clock_regs.days2 = m_clock_regs.days3 = 0; + + m_clock_regs.years = (m_clock_regs.years + 1) & 0xf; + } + } + } + } + } + } + } + } + } + + /* set VBI */ + if (m_VTMSK) + set_VTIR(1); + else + set_VTIR(0); + + /* do keyboard scan */ + scan_keyboard(); +} + +/* + Lots of fun with the Lisa fdc hardware + + The iwm floppy select line is connected to the drive SEL line in Lisa2 (which is why Lisa 2 + cannot support 2 floppy drives)... +*/ + +void lisa_state::lisa_fdc_ttl_glue_access(offs_t offset) +{ + switch ((offset & 0x000E) >> 1) + { + case 0: + /*stop = offset & 1;*/ /* stop/run motor pulse generation */ + break; + case 2: + /*MT0 = offset & 1;*/ /* ???? */ + break; + case 3: + /* enable/disable the motor on Lisa 1 */ + /* can disable the motor on Lisa 2/10, too (although it is not useful) */ + /* On lisa 2, commands the loading of the speed register on lisalite board */ + if (m_features.floppy_hardware == sony_lisa2) + { + int oldMT1 = m_MT1; + m_MT1 = offset & 1; + if (m_MT1 && ! oldMT1) + { + m_PWM_floppy_motor_speed = (m_PWM_floppy_motor_speed << 1) & 0xff; + if (m_fdc->get_lines() & APPLEFDC_PH0) + m_PWM_floppy_motor_speed |= 1; + sony_set_speed(((256-m_PWM_floppy_motor_speed) * 1.3) + 237); + } + } + /*else + m_MT1 = offset & 1;*/ + break; + case 4: + /*DIS = offset & 1;*/ /* forbids access from the 68000 to our RAM */ + break; + case 5: + /*HDS = offset & 1;*/ /* head select (-> disk side) on twiggy */ +#if 0 + if (m_features.floppy_hardware == twiggy) + twiggy_set_head_line(offset & 1); + else +#endif + if (m_features.floppy_hardware == sony_lisa210) + sony_set_sel_line(m_fdc, offset & 1); + break; + case 6: + m_DISK_DIAG = offset & 1; + m_via1->write_pb6(m_DISK_DIAG); + break; + case 7: + m_FDIR = offset & 1; /* Interrupt request to 68k */ + m_via0->write_pb4(m_FDIR); + field_interrupts(); + break; + } +} + +READ8_MEMBER(lisa_state::lisa_fdc_io_r) +{ + int answer=0; + + switch ((offset & 0x0030) >> 4) + { + case 0: /* IWM */ + answer = m_fdc->read(offset); + break; + + case 1: /* TTL glue */ + lisa_fdc_ttl_glue_access(offset); + answer = 0; /* ??? */ + break; + + case 2: /* pulses the PWM LOAD line (bug!) */ + answer = 0; /* ??? */ + break; + + case 3: /* not used */ + answer = 0; /* ??? */ + break; + } + + return answer; +} + +WRITE8_MEMBER(lisa_state::lisa_fdc_io_w) +{ + switch ((offset & 0x0030) >> 4) + { + case 0: /* IWM */ + m_fdc->write(offset, data); + break; + + case 1: /* TTL glue */ + lisa_fdc_ttl_glue_access(offset); + break; + + case 2: /* writes the PWM register */ + /* the written value is used to generate the motor speed control signal */ +#if 0 + if (m_features.floppy_hardware == twiggy) + twiggy_set_speed((256-data) * 1.3 /* ??? */ + 237 /* ??? */); + else +#endif + if (m_features.floppy_hardware == sony_lisa210) + sony_set_speed(((256-data) * 1.3) + 237); + break; + + case 3: /* not used */ + break; + } +} + +READ8_MEMBER(lisa_state::lisa_fdc_r) +{ + if (! (offset & 0x1000)) + { + if (! (offset & 0x0800)) + if (! (offset & 0x0400)) + return m_fdc_ram[offset & 0x03ff]; + else + return lisa_fdc_io_r(space, offset & 0x03ff); + else + return 0; /* ??? */ + } + else + return m_fdc_rom[offset & 0x0fff]; +} + +READ8_MEMBER(lisa_state::lisa210_fdc_r) +{ + if (! (offset & 0x1000)) + { + if (! (offset & 0x0400)) + if (! (offset & 0x0800)) + return m_fdc_ram[offset & 0x03ff]; + else + return lisa_fdc_io_r(space, offset & 0x03ff); + else + return 0; /* ??? */ + } + else + return m_fdc_rom[offset & 0x0fff]; +} + +WRITE8_MEMBER(lisa_state::lisa_fdc_w) +{ + if (! (offset & 0x1000)) + { + if (! (offset & 0x0800)) + { + if (! (offset & 0x0400)) + m_fdc_ram[offset & 0x03ff] = data; + else + lisa_fdc_io_w(space, offset & 0x03ff, data); + } + } +} + +WRITE8_MEMBER(lisa_state::lisa210_fdc_w) +{ + if (! (offset & 0x1000)) + { + if (! (offset & 0x0400)) + { + if (! (offset & 0x0800)) + m_fdc_ram[offset & 0x03ff] = data; + else + lisa_fdc_io_w(space, offset & 0x03ff, data); + } + } +} + +READ16_MEMBER(lisa_state::lisa_r) +{ + int answer=0; + + /* segment register set */ + int the_seg = m_seg; + + /* upper 7 bits -> segment # */ + int segment = (offset >> 16) & 0x7f; + + /*logerror("read, logical address%lX\n", offset);*/ + + if (m_setup) + { /* special setup mode */ + if (offset & 0x002000) + { + the_seg = 0; // TRUSTED by Lisa Hardware Manual section 2.3.3 and MMU startup test + } + else + { + if (offset & 0x004000) + { /* read MMU register */ + /*logerror("read from segment registers (%X:%X) ", the_seg, segment);*/ + if (offset & 0x000004) + { /* sorg register */ + answer = m_real_mmu_regs[the_seg][segment].sorg; + /*logerror("sorg, data = %X\n", answer);*/ + } + else + { /* slim register */ + answer = m_real_mmu_regs[the_seg][segment].slim; + /*logerror("slim, data = %X\n", answer);*/ + } + } + else + { /* system ROMs */ + answer = ((UINT16*)m_rom_ptr)[(offset & 0x001fff)]; + /*logerror("dst address in ROM (setup mode)\n");*/ + } + + return answer; + } + } + + if (m_maincpu->state_int(M68K_SR) & 0x2000) + /* supervisor mode -> force register file 0 */ + the_seg = 0; + + { + /* offset in segment */ + int seg_offset = (offset & 0x00ffff) << 1; + + /* add relevant origin -> address */ + offs_t address = (m_mmu_regs[the_seg][segment].sorg + seg_offset) & 0x1fffff; + + /*logerror("read, logical address%lX\n", offset); + logerror("physical address%lX\n", address);*/ + + switch (m_mmu_regs[the_seg][segment].type) + { + case RAM_stack_r: + case RAM_stack_rw: + if (address <= m_mmu_regs[the_seg][segment].slim) + { + /* out of segment limits : bus error */ + + } + answer = *(UINT16 *)(m_ram_ptr + address); + + if (m_bad_parity_count && m_test_parity + && (m_bad_parity_table[address >> 3] & (0x3 << (address & 0x7)))) + { + m_mem_err_addr_latch = address >> 5; + set_parity_error_pending(1); + } + + break; + + case RAM_r: + case RAM_rw: + if (address > m_mmu_regs[the_seg][segment].slim) + { + /* out of segment limits : bus error */ + + } + answer = *(UINT16 *)(m_ram_ptr + address); + + if (m_bad_parity_count && m_test_parity + && (m_bad_parity_table[address >> 3] & (0x3 << (address & 0x7)))) + { + m_mem_err_addr_latch = address >> 5; + set_parity_error_pending(1); + } + + break; + + case IO: + answer = lisa_IO_r(space, (address & 0x00ffff) >> 1, mem_mask); + + break; + + case invalid: /* unmapped segment */ + /* bus error */ + + answer = 0; + + break; + + case special_IO: + if (! (address & 0x008000)) + answer = *(UINT16 *)(m_rom_ptr + (address & 0x003fff)); + else + { /* read serial number from ROM */ + /* this has to be be the least efficient way to read a ROM :-) */ + /* this emulation is not guaranteed accurate */ + + /* problem : due to collisions with video, timings of the LISA CPU + are slightly different from timings of a bare 68k */ + /* so we use a kludge... */ + int time_in_frame = machine().first_screen()->vpos(); + + /* the BOOT ROM only reads 56 bits, so there must be some wrap-around for + videoROM_address <= 56 */ + /* pixel clock 20MHz, memory access rate 1.25MHz, horizontal clock 22.7kHz + according to Apple, which must stand for 1.25MHz/55 = 22727kHz, vertical + clock approximately 60Hz, which means there are about 380 lines, including VBlank */ + /* The values are different on the Mac XL, and I don't know the correct values + for sure. */ + + /* Something appears to be wrong with the timings, since we expect to read the + 2nd half when v-syncing, i.e. for lines beyond the 431th or 364th one (provided + there are no additionnal margins). + This is caused by the fact that 68k timings are wrong (memory accesses are + interlaced with the video hardware, which is not emulated). */ + if (m_features.has_mac_xl_video) + { + if ((time_in_frame >= 374) && (time_in_frame <= 392)) /* these values have not been tested */ + answer = m_videoROM_ptr[m_videoROM_address|0x80] << 8; + else + answer = m_videoROM_ptr[m_videoROM_address] << 8; + } + else + { + if ((time_in_frame >= 364) && (time_in_frame <= 375)) + { + answer = m_videoROM_ptr[m_videoROM_address|0x80] << 8; + logerror("reading1 %06X=%04x %s time=%d\n", address, answer, machine().describe_context(), time_in_frame); + } + else + { + answer = m_videoROM_ptr[m_videoROM_address] << 8; + logerror("reading2 %06X=%04x %s time=%d\n", address, answer, machine().describe_context(), time_in_frame); + } + } + + + m_videoROM_address = (m_videoROM_address + 1) & 0x7f; + if (m_videoROM_address == ((m_features.has_mac_xl_video) ? 48 : 56)) { + logerror("loop %d\n", m_videoROM_address); + m_videoROM_address = 0; + } + + } + + break; + } + } + + /*logerror("result %X\n", answer);*/ + + return answer; +} + +WRITE16_MEMBER(lisa_state::lisa_w) +{ + /* segment register set */ + int the_seg = m_seg; + + /* upper 7 bits -> segment # */ + int segment = (offset >> 16) & 0x7f; + + + if (m_setup) + { + if (offset & 0x002000) + { + the_seg = 0; // TRUSTED by Lisa Hardware Manual section 2.3.3 and MMU startup test + } + else + { + if (offset & 0x004000) + { /* write to MMU register */ + logerror("write to segment registers (%X:%X) ", the_seg, segment); + if (offset & 0x000004) + { /* sorg register */ + logerror("sorg, data = %X\n", data); + m_real_mmu_regs[the_seg][segment].sorg = data & 0xFFF; + m_mmu_regs[the_seg][segment].sorg = (data & 0x0fff) << 9; + } + else + { /* slim register */ + logerror("slim, data = %X\n", data); + m_real_mmu_regs[the_seg][segment].slim = data & 0xFFF; + m_mmu_regs[the_seg][segment].slim = (~ (data << 9)) & 0x01ffff; + switch ((data & 0x0f00) >> 8) + { + case 0x4: + /*logerror("type : RAM stack r\n");*/ + m_mmu_regs[the_seg][segment].type = RAM_stack_r; + break; + case 0x5: + /*logerror("type : RAM r\n");*/ + m_mmu_regs[the_seg][segment].type = RAM_r; + break; + case 0x6: + /*logerror("type : RAM stack rw\n");*/ + m_mmu_regs[the_seg][segment].type = RAM_stack_rw; + break; + case 0x7: + /*logerror("type : RAM rw\n");*/ + m_mmu_regs[the_seg][segment].type = RAM_rw; + break; + case 0x8: + case 0x9: /* not documented, but used by ROMs (?) */ + /*logerror("type : I/O\n");*/ + m_mmu_regs[the_seg][segment].type = IO; + break; + case 0xC: + /*logerror("type : invalid\n");*/ + m_mmu_regs[the_seg][segment].type = invalid; + break; + case 0xF: + logerror("type : special I/O\n"); + m_mmu_regs[the_seg][segment].type = special_IO; + break; + default: /* "unpredictable results" */ + logerror("type : unknown\n"); + m_mmu_regs[the_seg][segment].type = invalid; + break; + } + } + } + else + { /* system ROMs : read-only ??? */ + /* bus error ??? */ + } + return; + } + } + + if (m_maincpu->state_int(M68K_SR) & 0x2000) + /* supervisor mode -> force register file 0 */ + the_seg = 0; + + { + /* offset in segment */ + int seg_offset = (offset & 0x00ffff) << 1; + + /* add relevant origin -> address */ + offs_t address = (m_mmu_regs[the_seg][segment].sorg + seg_offset) & 0x1fffff; + + switch (m_mmu_regs[the_seg][segment].type) + { + case RAM_stack_rw: + if (address <= m_mmu_regs[the_seg][segment].slim) + { + /* out of segment limits : bus error */ + + } + COMBINE_DATA((UINT16 *) (m_ram_ptr + address)); + if (m_diag2) + { + if ((ACCESSING_BITS_0_7) + && ! (m_bad_parity_table[address >> 3] & (0x1 << (address & 0x7)))) + { + m_bad_parity_table[address >> 3] |= 0x1 << (address & 0x7); + m_bad_parity_count++; + } + if ((ACCESSING_BITS_8_15) + && ! (m_bad_parity_table[address >> 3] & (0x2 << (address & 0x7)))) + { + m_bad_parity_table[address >> 3] |= 0x2 << (address & 0x7); + m_bad_parity_count++; + } + } + else if (m_bad_parity_table[address >> 3] & (0x3 << (address & 0x7))) + { + if ((ACCESSING_BITS_0_7) + && (m_bad_parity_table[address >> 3] & (0x1 << (address & 0x7)))) + { + m_bad_parity_table[address >> 3] &= ~ (0x1 << (address & 0x7)); + m_bad_parity_count--; + } + if ((ACCESSING_BITS_8_15) + && (m_bad_parity_table[address >> 3] & (0x2 << (address & 0x7)))) + { + m_bad_parity_table[address >> 3] &= ~ (0x2 << (address & 0x7)); + m_bad_parity_count--; + } + } + break; + + case RAM_rw: + if (address > m_mmu_regs[the_seg][segment].slim) + { + /* out of segment limits : bus error */ + + } + COMBINE_DATA((UINT16 *) (m_ram_ptr + address)); + if (m_diag2) + { + if ((ACCESSING_BITS_0_7) + && ! (m_bad_parity_table[address >> 3] & (0x1 << (address & 0x7)))) + { + m_bad_parity_table[address >> 3] |= 0x1 << (address & 0x7); + m_bad_parity_count++; + } + if ((ACCESSING_BITS_8_15) + && ! (m_bad_parity_table[address >> 3] & (0x2 << (address & 0x7)))) + { + m_bad_parity_table[address >> 3] |= 0x2 << (address & 0x7); + m_bad_parity_count++; + } + } + else if (m_bad_parity_table[address >> 3] & (0x3 << (address & 0x7))) + { + if ((ACCESSING_BITS_0_7) + && (m_bad_parity_table[address >> 3] & (0x1 << (address & 0x7)))) + { + m_bad_parity_table[address >> 3] &= ~ (0x1 << (address & 0x7)); + m_bad_parity_count--; + } + if ((ACCESSING_BITS_8_15) + && (m_bad_parity_table[address >> 3] & (0x2 << (address & 0x7)))) + { + m_bad_parity_table[address >> 3] &= ~ (0x2 << (address & 0x7)); + m_bad_parity_count--; + } + } + break; + + case IO: + lisa_IO_w(space, (address & 0x00ffff) >> 1, data, mem_mask); + break; + + case RAM_stack_r: /* read-only */ + case RAM_r: /* read-only */ + case special_IO: /* system ROMs : read-only ??? */ + case invalid: /* unmapped segment */ + /* bus error */ + + break; + } + } +} + + +/**************************************************************************************\ +* I/O Slot Memory * +* * +* 000000 - 001FFF Slot 0 Low Decode * +* 002000 - 003FFF Slot 0 High Decode * +* 004000 - 005FFF Slot 1 Low Decode * +* 006000 - 007FFF Slot 1 High Decode * +* 008000 - 009FFF Slot 2 Low Decode * +* 00A000 - 00BFFF Slot 2 High Decode * +* 00C000 - 00CFFF Floppy Disk Controller shared RAM * +* 00c001-00c7ff floppy disk control * +* 00D000 - 00DFFF I/O Board Devices * +* 00d000-00d3ff serial ports control * +* 00d800-00dbff paralel port * +* 00dc00-00dfff keyboard/mouse cops via * +* 00E000 - 00FFFF CPU Board Devices * +* 00e000-00e01e cpu board control * +* 00e01f-00e7ff unused * +* 00e8xx-video address latch * +* 00f0xx memory error address latch * +* 00f8xx status register * +* * +\**************************************************************************************/ + +void lisa_state::cpu_board_control_access(offs_t offset) +{ + switch ((offset & 0x03ff) << 1) + { + case 0x0002: /* Set DIAG1 Latch */ + case 0x0000: /* Reset DIAG1 Latch */ + break; + case 0x0006: /* Set Diag2 Latch */ + m_diag2 = 1; + break; + case 0x0004: /* ReSet Diag2 Latch */ + m_diag2 = 0; + break; + case 0x000A: /* SEG1 Context Selection bit SET */ + /*logerror("seg bit 0 set\n");*/ + m_seg |= 1; + break; + case 0x0008: /* SEG1 Context Selection bit RESET */ + /*logerror("seg bit 0 clear\n");*/ + m_seg &= ~1; + break; + case 0x000E: /* SEG2 Context Selection bit SET */ + /*logerror("seg bit 1 set\n");*/ + m_seg |= 2; + break; + case 0x000C: /* SEG2 Context Selection bit RESET */ + /*logerror("seg bit 1 clear\n");*/ + m_seg &= ~2; + break; + case 0x0010: /* SETUP register SET */ + logerror("setup SET %s\n", machine().describe_context()); + m_setup = 1; + break; + case 0x0012: /* SETUP register RESET */ + logerror("setup UNSET %s\n", machine().describe_context()); + m_setup = 0; + break; + case 0x001A: /* Enable Vertical Retrace Interrupt */ + logerror("enable retrace %s\n", machine().describe_context()); + m_VTMSK = 1; + break; + case 0x0018: /* Disable Vertical Retrace Interrupt */ + logerror("disable retrace %s\n", machine().describe_context()); + m_VTMSK = 0; + set_VTIR(2); + break; + case 0x0016: /* Enable Soft Error Detect. */ + case 0x0014: /* Disable Soft Error Detect. */ + break; + case 0x001E: /* Enable Hard Error Detect */ + m_test_parity = 1; + break; + case 0x001C: /* Disable Hard Error Detect */ + m_test_parity = 0; + set_parity_error_pending(0); + break; + } +} + +READ16_MEMBER(lisa_state::lisa_IO_r) +{ + int answer=0; + + switch ((offset & 0x7000) >> 12) + { + case 0x0: + /* Slot 0 Low */ + break; + + case 0x1: + /* Slot 0 High */ + break; + + case 0x2: + /* Slot 1 Low */ + break; + + case 0x3: + /* Slot 1 High */ + break; + + case 0x4: + /* Slot 2 Low */ + break; + + case 0x5: + /* Slot 2 High */ + break; + + case 0x6: + if (! (offset & 0x800)) + { + if (! (offset & 0x400)) + { + /*if (ACCESSING_BITS_0_7)*/ /* Geez, who cares ? */ + answer = m_fdc_ram[offset & 0x03ff] & 0xff; /* right ??? */ + } + } + else + { + /* I/O Board Devices */ + switch ((offset & 0x0600) >> 9) + { + case 0: /* serial ports control */ + answer = m_scc->reg_r(space, offset&7); + break; + + case 2: /* parallel port */ + /* 1 VIA located at 0xD901 */ + if (ACCESSING_BITS_0_7) + answer = m_via1->read(space, (offset >> 2) & 0xf); + break; + + case 3: /* keyboard/mouse cops via */ + /* 1 VIA located at 0xDD81 */ + if (ACCESSING_BITS_0_7) + answer = m_via0->read(space, offset & 0xf); + break; + } + } + break; + + case 0x7: + /* CPU Board Devices */ + switch ((offset & 0x0C00) >> 10) + { + case 0x0: /* cpu board control */ + cpu_board_control_access(offset & 0x03ff); + break; + + case 0x1: /* Video Address Latch */ + answer = m_video_address_latch; + break; + + case 0x2: /* Memory Error Address Latch */ + answer = m_mem_err_addr_latch; + break; + + case 0x3: /* Status Register */ + answer = 0; + if (! m_parity_error_pending) + answer |= 0x02; + if (m_VTIR<=1) +// GFE : needs to be in phase with Serial NUM + { + int time_in_frame = machine().first_screen()->vpos(); + if (m_features.has_mac_xl_video) + { + if ((time_in_frame >= 374) && (time_in_frame <= 392)) /* these values have not been tested */ + { /* if VSyncing, read ROM 2nd half ? */ + } + else + { + m_VTIR=0; + answer |= 0x04; + } + } + else + { + logerror("read status time=%x\n", time_in_frame); + if ((time_in_frame >= 364) && (time_in_frame <= 383)) /* these values are approximative */ + { /* if VSyncing, read ROM 2nd half ? */ + } + else + { + m_VTIR=0; + answer |= 0x04; + } + } + + } + else + answer |= 0x04; + /* huh... we need to emulate some other bits */ + logerror("read status %s val=%x\n", machine().describe_context(), answer); + + break; + } + break; + } + + return answer; +} + +WRITE16_MEMBER(lisa_state::lisa_IO_w) +{ + switch ((offset & 0x7000) >> 12) + { + case 0x0: + /* Slot 0 Low */ + break; + + case 0x1: + /* Slot 0 High */ + break; + + case 0x2: + /* Slot 1 Low */ + break; + + case 0x3: + /* Slot 1 High */ + break; + + case 0x4: + /* Slot 2 Low */ + break; + + case 0x5: + /* Slot 2 High */ + break; + + case 0x6: + if (! (offset & 0x0800)) + { + /* Floppy Disk Controller shared RAM */ + if (! (offset & 0x0400)) + { + if (ACCESSING_BITS_0_7) + m_fdc_ram[offset & 0x03ff] = data & 0xff; + } + } + else + { + /* I/O Board Devices */ + switch ((offset & 0x0600) >> 9) + { + case 0: /* serial ports control */ + m_scc->reg_w(space, offset&7, data); + break; + + case 2: /* paralel port */ + if (ACCESSING_BITS_0_7) + m_via1->write(space, (offset >> 2) & 0xf, data & 0xff); + break; + + case 3: /* keyboard/mouse cops via */ + if (ACCESSING_BITS_0_7) + m_via0->write(space, offset & 0xf, data & 0xff); + break; + } + } + break; + + case 0x7: + /* CPU Board Devices */ + switch ((offset & 0x0C00) >> 10) + { + case 0x0: /* cpu board control */ + cpu_board_control_access(offset & 0x03ff); + break; + + case 0x1: /* Video Address Latch */ + /*logerror("video address latch write offs=%X, data=%X\n", offset, data);*/ + COMBINE_DATA(& m_video_address_latch); + m_videoram_ptr = ((UINT16 *)m_ram_ptr) + ((m_video_address_latch << 6) & 0xfc000); + /*logerror("video address latch %X -> base address %X\n", m_video_address_latch, + (m_video_address_latch << 7) & 0x1f8000);*/ + break; + } + break; + } +} diff --git a/src/mame/machine/llc.c b/src/mame/machine/llc.c new file mode 100644 index 00000000000..b208071b3c2 --- /dev/null +++ b/src/mame/machine/llc.c @@ -0,0 +1,180 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + LLC driver by Miodrag Milanovic + + 17/04/2009 Preliminary driver. + +****************************************************************************/ + + +#include "includes/llc.h" + + +// LLC1 BASIC keyboard +READ8_MEMBER(llc_state::llc1_port2_b_r) +{ + UINT8 retVal = 0; + + if (m_term_status) + { + retVal = m_term_status; + m_term_status = 0; + } + else + retVal = m_term_data; + + return retVal; +} + +READ8_MEMBER(llc_state::llc1_port2_a_r) +{ + return 0; +} + +// LLC1 Monitor keyboard +READ8_MEMBER(llc_state::llc1_port1_a_r) +{ + UINT8 data = 0; + if (!BIT(m_porta, 4)) + data = ioport("X4")->read(); + if (!BIT(m_porta, 5)) + data = ioport("X5")->read(); + if (!BIT(m_porta, 6)) + data = ioport("X6")->read(); + if (data & 0xf0) + data = (data >> 4) | 0x80; + + data |= (m_porta & 0x70); + + // do not repeat key + if (data & 15) + { + if (data == m_llc1_key) + data &= 0x70; + else + m_llc1_key = data; + } + else + if ((data & 0x70) == (m_llc1_key & 0x70)) + m_llc1_key = 0; + + return data; +} + +WRITE8_MEMBER(llc_state::llc1_port1_a_w) +{ + m_porta = data; +} + +WRITE8_MEMBER(llc_state::llc1_port1_b_w) +{ + static UINT8 count = 0, digit = 0; + + if (data == 0) + { + digit = 0; + count = 0; + } + else + count++; + + if (count == 1) + output_set_digit_value(digit, data & 0x7f); + else + if (count == 3) + { + count = 0; + digit++; + } +} + +DRIVER_INIT_MEMBER(llc_state,llc1) +{ +} + +MACHINE_RESET_MEMBER(llc_state,llc1) +{ + m_term_status = 0; + m_llc1_key = 0; +} + +MACHINE_START_MEMBER(llc_state,llc1) +{ +} + +/* Driver initialization */ +DRIVER_INIT_MEMBER(llc_state,llc2) +{ + m_p_videoram.set_target( m_ram->pointer() + 0xc000,m_p_videoram.bytes()); +} + +MACHINE_RESET_MEMBER(llc_state,llc2) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.unmap_write(0x0000, 0x3fff); + membank("bank1")->set_base(memregion("maincpu")->base()); + + space.unmap_write(0x4000, 0x5fff); + membank("bank2")->set_base(memregion("maincpu")->base() + 0x4000); + + space.unmap_write(0x6000, 0xbfff); + membank("bank3")->set_base(memregion("maincpu")->base() + 0x6000); + + space.install_write_bank(0xc000, 0xffff, "bank4"); + membank("bank4")->set_base(m_ram->pointer() + 0xc000); + +} + +WRITE8_MEMBER(llc_state::llc2_rom_disable_w) +{ + address_space &mem_space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + mem_space.install_write_bank(0x0000, 0xbfff, "bank1"); + membank("bank1")->set_base(ram); + + mem_space.install_write_bank(0x4000, 0x5fff, "bank2"); + membank("bank2")->set_base(ram + 0x4000); + + mem_space.install_write_bank(0x6000, 0xbfff, "bank3"); + membank("bank3")->set_base(ram + 0x6000); + + mem_space.install_write_bank(0xc000, 0xffff, "bank4"); + membank("bank4")->set_base(ram + 0xc000); + +} + +WRITE8_MEMBER(llc_state::llc2_basic_enable_w) +{ + address_space &mem_space = m_maincpu->space(AS_PROGRAM); + if (data & 0x02) + { + mem_space.unmap_write(0x4000, 0x5fff); + membank("bank2")->set_base(memregion("maincpu")->base() + 0x10000); + } + else + { + mem_space.install_write_bank(0x4000, 0x5fff, "bank2"); + membank("bank2")->set_base(m_ram->pointer() + 0x4000); + } + +} + +READ8_MEMBER(llc_state::llc2_port1_b_r) +{ + return 0; +} + +WRITE8_MEMBER(llc_state::llc2_port1_b_w) +{ + m_speaker->level_w(BIT(data, 6)); + m_rv = BIT(data, 5); +} + +READ8_MEMBER(llc_state::llc2_port2_a_r) +{ + return 0; // bit 2 low or hangs on ^Z^X^C sequence +} diff --git a/src/mame/machine/lviv.c b/src/mame/machine/lviv.c new file mode 100644 index 00000000000..e2fd86c293f --- /dev/null +++ b/src/mame/machine/lviv.c @@ -0,0 +1,321 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/*************************************************************************** + + machine.c + + Functions to emulate general aspects of PK-01 Lviv (RAM, ROM, interrupts, + I/O ports) + + Krzysztof Strzecha + +***************************************************************************/ + +#include "emu.h" +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "includes/lviv.h" +#include "sound/speaker.h" +#include "machine/ram.h" + +#define LVIV_SNAPSHOT_SIZE 82219 + + + + + +void lviv_state::lviv_update_memory () +{ + UINT8 *ram = m_ram->pointer(); + + if (m_ppi_port_outputs[0][2] & 0x02) + { + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x4000); + } + else + { + membank("bank1")->set_base(ram + 0x8000); + membank("bank2")->set_base(ram + 0xc000); + } +} + +INPUT_CHANGED_MEMBER(lviv_state::lviv_reset) +{ + machine().schedule_soft_reset(); +} + +READ8_MEMBER(lviv_state::lviv_ppi_0_porta_r) +{ + return 0xff; +} + +READ8_MEMBER(lviv_state::lviv_ppi_0_portb_r) +{ + return 0xff; +} + +READ8_MEMBER(lviv_state::lviv_ppi_0_portc_r) +{ + UINT8 data = m_ppi_port_outputs[0][2] & 0x0f; + if (m_cassette->input() > 0.038) + data |= 0x10; + if (m_ppi_port_outputs[0][0] & ioport("JOY")->read()) + data |= 0x80; + return data; +} + +WRITE8_MEMBER(lviv_state::lviv_ppi_0_porta_w) +{ + m_ppi_port_outputs[0][0] = data; +} + +WRITE8_MEMBER(lviv_state::lviv_ppi_0_portb_w) +{ + m_ppi_port_outputs[0][1] = data; + lviv_update_palette(data&0x7f); +} + +WRITE8_MEMBER(lviv_state::lviv_ppi_0_portc_w)/* tape in/out, video memory on/off */ +{ + m_ppi_port_outputs[0][2] = data; + if (m_ppi_port_outputs[0][1]&0x80) + m_speaker->level_w(data & 0x01); + m_cassette->output((data & 0x01) ? -1.0 : 1.0); + lviv_update_memory(); +} + +READ8_MEMBER(lviv_state::lviv_ppi_1_porta_r) +{ + return 0xff; +} + +READ8_MEMBER(lviv_state::lviv_ppi_1_portb_r)/* keyboard reading */ +{ + return ((m_ppi_port_outputs[1][0] & 0x01) ? 0xff : ioport("KEY0")->read()) & + ((m_ppi_port_outputs[1][0] & 0x02) ? 0xff : ioport("KEY1")->read()) & + ((m_ppi_port_outputs[1][0] & 0x04) ? 0xff : ioport("KEY2")->read()) & + ((m_ppi_port_outputs[1][0] & 0x08) ? 0xff : ioport("KEY3")->read()) & + ((m_ppi_port_outputs[1][0] & 0x10) ? 0xff : ioport("KEY4")->read()) & + ((m_ppi_port_outputs[1][0] & 0x20) ? 0xff : ioport("KEY5")->read()) & + ((m_ppi_port_outputs[1][0] & 0x40) ? 0xff : ioport("KEY6")->read()) & + ((m_ppi_port_outputs[1][0] & 0x80) ? 0xff : ioport("KEY7")->read()); +} + +READ8_MEMBER(lviv_state::lviv_ppi_1_portc_r)/* keyboard reading */ +{ + return ((m_ppi_port_outputs[1][2] & 0x01) ? 0xff : ioport("KEY8")->read()) & + ((m_ppi_port_outputs[1][2] & 0x02) ? 0xff : ioport("KEY9" )->read()) & + ((m_ppi_port_outputs[1][2] & 0x04) ? 0xff : ioport("KEY10")->read()) & + ((m_ppi_port_outputs[1][2] & 0x08) ? 0xff : ioport("KEY11")->read()); +} + +WRITE8_MEMBER(lviv_state::lviv_ppi_1_porta_w)/* kayboard scaning */ +{ + m_ppi_port_outputs[1][0] = data; +} + +WRITE8_MEMBER(lviv_state::lviv_ppi_1_portb_w) +{ + m_ppi_port_outputs[1][1] = data; +} + +WRITE8_MEMBER(lviv_state::lviv_ppi_1_portc_w)/* kayboard scaning */ +{ + m_ppi_port_outputs[1][2] = data; +} + + +/* I/O */ +READ8_MEMBER(lviv_state::lviv_io_r) +{ + if (m_startup_mem_map) + { + return 0; /* ??? */ + } + else + { + switch ((offset >> 4) & 0x3) + { + case 0: + return machine().device("ppi8255_0")->read(space, offset & 3); + + case 1: + return machine().device("ppi8255_1")->read(space, offset & 3); + + case 2: + case 3: + default: + /* reserved for extension? */ + return 0; /* ??? */ + } + } +} + +WRITE8_MEMBER(lviv_state::lviv_io_w) +{ + address_space &cpuspace = m_maincpu->space(AS_PROGRAM); + if (m_startup_mem_map) + { + UINT8 *ram = m_ram->pointer(); + + m_startup_mem_map = 0; + + cpuspace.install_write_bank(0x0000, 0x3fff, "bank1"); + cpuspace.install_write_bank(0x4000, 0x7fff, "bank2"); + cpuspace.install_write_bank(0x8000, 0xbfff, "bank3"); + cpuspace.unmap_write(0xC000, 0xffff); + + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x4000); + membank("bank3")->set_base(ram + 0x8000); + membank("bank4")->set_base(memregion("maincpu")->base() + 0x010000); + } + else + { + switch ((offset >> 4) & 0x3) + { + case 0: + machine().device("ppi8255_0")->write(space, offset & 3, data); + break; + + case 1: + machine().device("ppi8255_1")->write(space, offset & 3, data); + break; + + case 2: + case 3: + /* reserved for extension? */ + break; + } + } +} + + +void lviv_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *mem; + + m_video_ram = m_ram->pointer() + 0xc000; + + m_startup_mem_map = 1; + + space.unmap_write(0x0000, 0x3fff); + space.unmap_write(0x4000, 0x7fff); + space.unmap_write(0x8000, 0xbfff); + space.unmap_write(0xC000, 0xffff); + + mem = memregion("maincpu")->base(); + membank("bank1")->set_base(mem + 0x010000); + membank("bank2")->set_base(mem + 0x010000); + membank("bank3")->set_base(mem + 0x010000); + membank("bank4")->set_base(mem + 0x010000); + + /*machine().scheduler().timer_pulse(TIME_IN_NSEC(200), FUNC(lviv_draw_pixel));*/ + + /*memset(m_ram->pointer(), 0, sizeof(unsigned char)*0xffff);*/ +} + + +/******************************************************************************* +Lviv snapshot files (SAV) +------------------------- + +00000 - 0000D: 'LVOV/DUMP/2.0/' (like LVT-header) +0000E - 0000F: 'H+' (something additional) +00010 00h +00011 - 0C010: RAM (0000 - BFFF) +0C011 - 10010: ROM (C000 - FFFF) +10011 - 14010: Video RAM (4000 - 7FFF) +14011 - 14110: Ports map (00 - FF) +14111 - 1411C: Registers (B,C,D,E,H,L,A,F,SP,PC) +1411D - 1412A: ??? (something additional) +*******************************************************************************/ + +void lviv_state::lviv_setup_snapshot (UINT8 * data) +{ + unsigned char lo,hi; + + /* Set registers */ + lo = data[0x14112] & 0x0ff; + hi = data[0x14111] & 0x0ff; + m_maincpu->set_state_int(I8085_BC, (hi << 8) | lo); + lo = data[0x14114] & 0x0ff; + hi = data[0x14113] & 0x0ff; + m_maincpu->set_state_int(I8085_DE, (hi << 8) | lo); + lo = data[0x14116] & 0x0ff; + hi = data[0x14115] & 0x0ff; + m_maincpu->set_state_int(I8085_HL, (hi << 8) | lo); + lo = data[0x14118] & 0x0ff; + hi = data[0x14117] & 0x0ff; + m_maincpu->set_state_int(I8085_AF, (hi << 8) | lo); + lo = data[0x14119] & 0x0ff; + hi = data[0x1411a] & 0x0ff; + m_maincpu->set_state_int(I8085_SP, (hi << 8) | lo); + lo = data[0x1411b] & 0x0ff; + hi = data[0x1411c] & 0x0ff; + m_maincpu->set_state_int(I8085_PC, (hi << 8) | lo); + + /* Memory dump */ + memcpy (m_ram->pointer(), data+0x0011, 0xc000); + memcpy (m_ram->pointer()+0xc000, data+0x10011, 0x4000); + + /* Ports */ + m_ppi_port_outputs[0][0] = data[0x14011+0xc0]; + m_ppi_port_outputs[0][1] = data[0x14011+0xc1]; + lviv_update_palette(m_ppi_port_outputs[0][1]&0x7f); + m_ppi_port_outputs[0][2] = data[0x14011+0xc2]; + lviv_update_memory(); +} + +void lviv_state::dump_registers() +{ + logerror("PC = %04x\n", (unsigned) m_maincpu->state_int(I8085_PC)); + logerror("SP = %04x\n", (unsigned) m_maincpu->state_int(I8085_SP)); + logerror("AF = %04x\n", (unsigned) m_maincpu->state_int(I8085_AF)); + logerror("BC = %04x\n", (unsigned) m_maincpu->state_int(I8085_BC)); + logerror("DE = %04x\n", (unsigned) m_maincpu->state_int(I8085_DE)); + logerror("HL = %04x\n", (unsigned) m_maincpu->state_int(I8085_HL)); +} + +int lviv_state::lviv_verify_snapshot (UINT8 * data, UINT32 size) +{ + const char* tag = "LVOV/DUMP/2.0/"; + + if( strncmp( tag, (char*)data, strlen(tag) ) ) + { + logerror("Not a Lviv snapshot\n"); + return IMAGE_VERIFY_FAIL; + } + + if (size != LVIV_SNAPSHOT_SIZE) + { + logerror ("Incomplete snapshot file\n"); + return IMAGE_VERIFY_FAIL; + } + + logerror("returning ID_OK\n"); + return IMAGE_VERIFY_PASS; +} + +SNAPSHOT_LOAD_MEMBER( lviv_state, lviv ) +{ + dynamic_buffer lviv_snapshot_data(LVIV_SNAPSHOT_SIZE); + + image.fread( &lviv_snapshot_data[0], LVIV_SNAPSHOT_SIZE); + + if(lviv_verify_snapshot(&lviv_snapshot_data[0], snapshot_size) == IMAGE_VERIFY_FAIL) + { + return IMAGE_INIT_FAIL; + } + + lviv_setup_snapshot (&lviv_snapshot_data[0]); + + dump_registers(); + + logerror("Snapshot file loaded\n"); + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/lynx.c b/src/mame/machine/lynx.c new file mode 100644 index 00000000000..b68b2b6c0d3 --- /dev/null +++ b/src/mame/machine/lynx.c @@ -0,0 +1,2144 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + PeT mess@utanet.at 2000,2001 +******************************************************************************/ + +#include "emu.h" +#include "includes/lynx.h" +#include "cpu/m6502/m65sc02.h" + + +#define PAD_UP 0x80 +#define PAD_DOWN 0x40 +#define PAD_LEFT 0x20 +#define PAD_RIGHT 0x10 + + +/**************************************** + + Graphics Drawing + +****************************************/ + +/* modes from blitter command */ +enum { + BACKGROUND = 0, + BACKGROUND_NO_COLL, + BOUNDARY_SHADOW, + BOUNDARY, + NORMAL_SPRITE, + NO_COLL, + XOR_SPRITE, + SHADOW +}; + +UINT8 lynx_state::lynx_read_ram(UINT16 address) +{ + UINT8 result = 0x00; + if (address <= 0xfbff) + result = m_mem_0000[address - 0x0000]; + else if (address <= 0xfcff) + result = m_mem_fc00[address - 0xfc00]; + else if (address <= 0xfdff) + result = m_mem_fd00[address - 0xfd00]; + else if (address <= 0xfff7) + result = m_mem_fe00[address - 0xfe00]; + else if (address >= 0xfffa) + result = m_mem_fffa[address - 0xfffa]; + return result; +} + +void lynx_state::lynx_write_ram(UINT16 address, UINT8 data) +{ + if (address <= 0xfbff) + m_mem_0000[address - 0x0000] = data; + else if (address <= 0xfcff) + m_mem_fc00[address - 0xfc00] = data; + else if (address <= 0xfdff) + m_mem_fd00[address - 0xfd00] = data; + else if (address <= 0xfff7) + m_mem_fe00[address - 0xfe00] = data; + else if (address >= 0xfffa) + m_mem_fffa[address - 0xfffa] = data; +} + +/* The pen numbers range from '0' to 'F. Pen numbers '1' through 'D' are always collidable and opaque. The other +ones have different behavior depending on the sprite type: there are 8 types of sprites, each has different +characteristics relating to some or all of their pen numbers. + +* Shadow Error: The hardware is missing an inverter in the 'shadow' generator. This causes sprite types that +did not invoke shadow to now invoke it and vice versa. The only actual functionality loss is that 'exclusive or' +sprites and 'background' sprites will have shadow enabled. + +The sprite types relate to specific hardware functions according to the following table: + + + -------------------------- SHADOW + | ----------------------- BOUNDARY_SHADOW + | | -------------------- NORMAL_SPRITE + | | | ----------------- BOUNDARY + | | | | -------------- BACKGROUND (+ shadow, due to bug in 'E' pen) + | | | | | ----------- BACKGROUND_NO_COLL + | | | | | | -------- NO_COLL + | | | | | | | ----- XOR_SPRITE (+ shadow, due to bug in 'E' pen) + | | | | | | | | + 1 0 1 0 1 1 1 1 F is opaque + 0 0 1 1 0 0 0 0 E is collideable + 0 0 1 1 0 0 0 0 0 is opaque and collideable + 1 1 1 1 0 0 0 1 allow collision detect + 1 1 1 1 1 0 0 1 allow coll. buffer access + 0 0 0 0 0 0 0 1 exclusive-or the data +*/ + +inline void lynx_state::lynx_plot_pixel(const int mode, const INT16 x, const int y, const int color) +{ + UINT8 back; + UINT16 screen; + UINT16 colbuf; + + m_blitter.everon = TRUE; + screen = m_blitter.screen + y * 80 + x / 2; + colbuf = m_blitter.colbuf + y * 80 + x / 2; + + /* a note on timing: The hardware packs the pixel data and updates the screen and collision buffer a byte at a time. + Thus the buffer update for two pixels takes 3 memory accesses for a normal sprite (write to screen buffer, read/write to collision buffer). + +1 memory access for palette fetch? + */ + + switch (mode&0x7) + { + case NORMAL_SPRITE: + /* A sprite may be set to 'normal'. This means that pen number '0' will be transparent and + non-collideable. All other pens will be opaque and collideable */ + if (color == 0) + break; + if (!(x & 0x01)) /* Upper nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0x0f) | (color << 4)); + m_blitter.memory_accesses++; + + if(m_blitter.sprite_collide && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); + m_blitter.memory_accesses += 2; + if ((back >> 4) > m_blitter.fred) + m_blitter.fred = back >> 4; + } + m_blitter.memory_accesses++; + } + else /* Lower nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0xf0) | color); + + if(m_blitter.sprite_collide && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); + if ((back & 0x0f) > m_blitter.fred) + m_blitter.fred = back >> 4; + } + } + break; + + case BOUNDARY: + /* A sprite may be set to 'boundary'. This is a 'normal' sprite with the exception that pen + number 'F' is transparent (and still collideable). */ + if (color == 0) + break; + if (!(x & 0x01)) /* Upper nibble */ + { + if (color != 0x0f) + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0x0f) | (color << 4)); + m_blitter.memory_accesses++; + } + if(m_blitter.sprite_collide && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); + if ((back >> 4) > m_blitter.fred) + m_blitter.fred = back >> 4; + m_blitter.memory_accesses += 2; + } + m_blitter.memory_accesses++; + } + else /* Lower nibble */ + { + if (color != 0x0f) + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0xf0) | color); + } + if(m_blitter.sprite_collide && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); + if ((back & 0x0f) > m_blitter.fred) + m_blitter.fred = back >> 4; + } + } + break; + + case SHADOW: + /* A sprite may be set to 'shadow'. This is a 'normal' sprite with the exception that pen + number 'E' is non-collideable (but still opaque) */ + if (color == 0) + break; + if (!(x & 0x01)) /* Upper nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0x0f) | (color << 4)); + m_blitter.memory_accesses++; + + if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); + if ((back >> 4) > m_blitter.fred) + m_blitter.fred = back >> 4; + m_blitter.memory_accesses += 2; + } + m_blitter.memory_accesses++; + } + else /* Lower nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0xf0) | color); + + if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); + if ((back & 0x0f) > m_blitter.fred) + m_blitter.fred = back >> 4; + } + } + break; + + case BOUNDARY_SHADOW: + /* This sprite is a 'normal' sprite with the characteristics of both 'boundary' + and 'shadow'. That is, pen number 'F' is transparent (and still collideable) and + pen number 'E' is non-collideable (but still opaque). */ + if (color == 0) + break; + if (!(x & 0x01)) /* Upper nibble */ + { + if (color != 0x0f) + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0x0f) | (color << 4)); + m_blitter.memory_accesses++; + } + if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); + if ((back >> 4) > m_blitter.fred) + m_blitter.fred = back >> 4; + m_blitter.memory_accesses += 2; + } + m_blitter.memory_accesses++; + } + else /* Lower nibble */ + { + if (color != 0x0f) + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0xf0) | color); + } + if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); + if ((back & 0x0f) > m_blitter.fred) + m_blitter.fred = back >> 4; + } + } + break; + + case BACKGROUND: + /* A sprite may be set to 'background'. This sprite will overwrite the contents of the video and + collision buffers. Pens '0' and 'F' are no longer transparent. This sprite is used to initialize + the buffers at the start of a 'painting'. Additionally, no collision detection is done, and no write + to the collision depository occurs. The 'E' error will cause the pen number 'E' to be non-collideable + and therefore not clear the collision buffer */ + if (!(x & 0x01)) /* Upper nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0x0f) | (color << 4)); + m_blitter.memory_accesses++; + + if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); + m_blitter.memory_accesses++; + } + m_blitter.memory_accesses++; + } + else /* Lower nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0xf0) | color); + + if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); + } + } + break; + + case BACKGROUND_NO_COLL: + /* This is a 'background' sprite with the exception that no activity occurs in the collision buffer */ + if (!(x & 0x01)) /* Upper nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0x0f) | (color << 4)); + m_blitter.memory_accesses++; + m_blitter.memory_accesses++; + } + else /* Lower nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0xf0) | color); + } + break; + + case NO_COLL: + /* A sprite may be set to 'non-collideable'. This means that it will have no affect on the contents of + the collision buffer and all other collision activities are overridden (pen 'F' is not collideable). */ + if (color == 0) + break; + if (!(x & 0x01)) /* Upper nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0x0f) | (color << 4)); + m_blitter.memory_accesses++; + m_blitter.memory_accesses++; + } + else /* Lower nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, (back & 0xf0) | color); + } + break; + + case XOR_SPRITE: + /* This is a 'normal' sprite with the exception that the data from the video buffer is exclusive-ored + with the sprite data and written back out to the video buffer. Collision activity is 'normal'. The 'E' + error will cause the pen number 'E' to be non-collideable and therefore not react with the collision + buffer */ + if (color == 0) + break; + if (!(x & 0x01)) /* Upper nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, back^(color << 4)); + m_blitter.memory_accesses += 2; + if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); + if ((back >> 4) > m_blitter.fred) + m_blitter.fred = back >> 4; + m_blitter.memory_accesses += 2; + } + m_blitter.memory_accesses++; + } + else /* Lower nibble */ + { + back = lynx_read_ram(screen); + lynx_write_ram(screen, back^color); + if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) + { + back = lynx_read_ram(colbuf); + lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); + if ((back & 0x0f) > m_blitter.fred) + m_blitter.fred = back >> 4; + } + } + break; + } +} + +void lynx_state::lynx_blit_do_work( const int y, const int xdir, const int bits_per_pixel, const int mask ) +{ + int next_line_addr,i,j; + int xi, bits, color; + UINT16 width_accum, buffer; + + next_line_addr = lynx_read_ram(m_blitter.bitmap); // offset to second sprite line + width_accum = (xdir == 1) ? m_blitter.width_offset : 0; + m_blitter.memory_accesses++; + + for (xi = m_blitter.x_pos - m_blitter.xoff, bits = 0, buffer = 0, j = 1; j < next_line_addr;j++) + { + buffer = (buffer << 8) | lynx_read_ram(m_blitter.bitmap + j); + bits += 8; // current bits in buffer + m_blitter.memory_accesses++; + + for ( ; bits > bits_per_pixel; bits -= bits_per_pixel) // last data packet at end of scanline is not rendered (qix, blulght) + { + color = m_blitter.color[(buffer >> (bits - bits_per_pixel)) & mask]; + width_accum += m_blitter.width; + for (i = 0; i < (width_accum>>8); i++, xi += xdir) + { + if ((xi >= 0) && (xi < 160)) + { + lynx_plot_pixel(m_blitter.mode, xi, y, color); + } + } + width_accum &= 0xff; + } + } +} + +void lynx_state::lynx_blit_rle_do_work( const INT16 y, const int xdir, const int bits_per_pixel, const int mask ) +{ + int i; + int xi; + int buffer, bits, j; + int literal_data, count, color; + UINT16 width_accum; + + width_accum = (xdir == 1) ? m_blitter.width_offset : 0; + for( bits = 0, j = 0, buffer = 0, xi = m_blitter.x_pos - m_blitter.xoff; ; ) /* through the rle entries */ + { + if (bits < 5 + bits_per_pixel) /* under 7 bits no complete entry */ + { + j++; + if (j >= lynx_read_ram(m_blitter.bitmap)) + return; + + bits += 8; + buffer = (buffer << 8) | lynx_read_ram(m_blitter.bitmap + j); + m_blitter.memory_accesses++; + } + + literal_data = (buffer >> (bits - 1)) & 0x01; + bits--; + count = (buffer >> (bits - 4)) & 0x0f; // repeat count (packed) or pixel count (literal) + bits -= 4; + + if (literal_data) /* count of different pixels */ + { + for ( ; count >= 0; count--) + { + if (bits < bits_per_pixel) + { + j++; + if (j >= lynx_read_ram(m_blitter.bitmap)) + return; + bits += 8; + buffer = (buffer << 8) | lynx_read_ram(m_blitter.bitmap + j); + m_blitter.memory_accesses++; + } + + color = m_blitter.color[(buffer >> (bits - bits_per_pixel)) & mask]; + bits -= bits_per_pixel; + width_accum += m_blitter.width; + for (i = 0; i < (width_accum>>8); i++, xi += xdir) + { + if ((xi >= 0) && (xi < 160)) + lynx_plot_pixel(m_blitter.mode, xi, y, color); + } + width_accum &= 0xff; + } + } + else /* count of same pixels */ + { + if (count == 0) // 4 bit count value of zero indicates end-of-line in a packed sprite + return; + + if (bits < bits_per_pixel) + { + j++; + if (j >= lynx_read_ram(m_blitter.bitmap)) + return; + bits += 8; + buffer = (buffer << 8) | lynx_read_ram(m_blitter.bitmap + j); + m_blitter.memory_accesses++; + } + + color = m_blitter.color[(buffer >> (bits - bits_per_pixel)) & mask]; + bits -= bits_per_pixel; + + for ( ; count>=0; count--) + { + width_accum += m_blitter.width; + for (i = 0; i < (width_accum >> 8); i++, xi += xdir) + { + if ((xi >= 0) && (xi < 160)) + lynx_plot_pixel(m_blitter.mode, xi, y, color); + } + width_accum &= 0xff; + } + } + } +} + +void lynx_state::lynx_blit_lines() +{ + static const int lynx_color_masks[4] = { 0x01, 0x03, 0x07, 0x0f }; + INT16 y; + int i; + int ydir = 0, xdir = 0; + int flip = 0; + + m_blitter.everon = FALSE; + + switch (m_blitter.spr_ctl1 & 0x03) /* Initial drawing direction */ + { + case 0: // Down/Right (quadrant 0) + xdir = 1; + ydir = 1; + flip = 0; + break; + case 1: // Down/Left (blockout) (quadrant 3) + xdir = -1; + ydir = 1; + flip = 3; + break; + case 2: // Up/Right (fat bobby) (quadrant 1) + xdir = 1; + ydir = -1; + flip = 1; + break; + case 3: // Up/Left (quadrant 2) + xdir = -1; + ydir = -1; + flip = 2; + break; + } + + if (m_blitter.spr_ctl0 & 0x20) /* Horizontal Flip */ + { + xdir *= -1; + } + + if (m_blitter.spr_ctl0 & 0x10) /* Vertical Flip */ + { + ydir *= -1; + } + + // Set height accumulator based on drawing direction + m_blitter.height_accumulator = (ydir == 1) ? m_blitter.height_offset : 0x00; + + // loop through lines, next line offset of zero indicates end of sprite + for (y = m_blitter.y_pos - m_blitter.yoff; (i = lynx_read_ram(m_blitter.bitmap)); m_blitter.bitmap += i) + { + m_blitter.memory_accesses++; + + if (i == 1) // draw next quadrant + { + // centered sprites sprdemo3, fat bobby, blockout + switch (flip & 0x03) + { + case 0: + case 2: + ydir *= -1; + m_blitter.y_pos += ydir; + break; + case 1: + case 3: + xdir *= -1; + m_blitter.x_pos += xdir; + break; + } + flip++; + y = m_blitter.y_pos - m_blitter.yoff; + m_blitter.height_accumulator = (ydir == 1) ? m_blitter.height_offset : 0x00; + continue; + } + + m_blitter.height_accumulator += m_blitter.height; + for (int j = 0; j < (m_blitter.height_accumulator >> 8); j++, y += ydir) + { + if (y >= 0 && y < 102) + { + if (m_blitter.use_rle) + lynx_blit_rle_do_work(y, xdir, m_blitter.line_color + 1, lynx_color_masks[m_blitter.line_color]); + else + lynx_blit_do_work(y, xdir, m_blitter.line_color + 1, lynx_color_masks[m_blitter.line_color]); + } + m_blitter.width += (INT16)m_blitter.stretch; + if (m_blitter.vstretch) // doesn't seem to be used + { + m_blitter.height += (INT16)m_blitter.stretch; + logerror("vertical stretch enabled"); + } + m_blitter.tilt_accumulator += m_blitter.tilt; + m_blitter.x_pos += (m_blitter.tilt_accumulator>>8); + m_blitter.tilt_accumulator &= 0xff; + } + m_blitter.height_accumulator &= 0xff; + } +} + +void lynx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BLITTER: + lynx_blitter_timer(ptr, param); + break; + case TIMER_SHOT: + lynx_timer_shot(ptr, param); + break; + case TIMER_UART_LOOPBACK: + lynx_uart_loopback_timer(ptr, param); + break; + case TIMER_UART: + lynx_uart_timer(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in lynx_state::device_timer"); + } +} + +TIMER_CALLBACK_MEMBER(lynx_state::lynx_blitter_timer) +{ + m_blitter.busy=0; // blitter finished + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); +} + +/* + control 0 + bit 7,6: 00 2 color + 01 4 color + 11 8 colors? + 11 16 color + bit 5,4: 00 right down + 01 right up + 10 left down + 11 left up + +#define SHADOW (0x07) +#define XORSHADOW (0x06) +#define NONCOLLIDABLE (0x05) +#define NORMAL (0x04) +#define BOUNDARY (0x03) +#define BOUNDARYSHADOW (0x02) +#define BKGRNDNOCOL (0x01) +#define BKGRND (0x00) + + control 1 + bit 7: 0 bitmap rle encoded + 1 not encoded + bit 3: 0 color info with command + 1 no color info with command + +#define RELHVST (0x30) +#define RELHVS (0x20) +#define RELHV (0x10) + +#define SKIPSPRITE (0x04) + +#define DUP (0x02) +#define DDOWN (0x00) +#define DLEFT (0x01) +#define DRIGHT (0x00) + + + coll +#define DONTCOLLIDE (0x20) + + word next + word data + word x + word y + word width + word height + + pixel c0 90 20 0000 datapointer x y 0100 0100 color (8 colorbytes) + 4 bit direct? + datapointer 2 10 0 + 98 (0 colorbytes) + + box c0 90 20 0000 datapointer x y width height color + datapointer 2 10 0 + + c1 98 00 4 bit direct without color bytes (raycast) + + 40 10 20 4 bit rle (sprdemo2) + + line c1 b0 20 0000 datapointer x y 0100 0100 stretch tilt:x/y color (8 color bytes) + or + line c0 b0 20 0000 datapointer x y 0100 0100 stretch tilt:x/y color + datapointer 2 11 0 + + text ?(04) 90 20 0000 datapointer x y width height color + datapointer 2 10 0 + + stretch: hsize adder + tilt: hpos adder + +*/ + +void lynx_state::lynx_blitter() +{ + static const int lynx_colors[4] = { 2, 4, 8, 16 }; + UINT8 palette_offset; + UINT8 coldep; + int colors; + + m_blitter.busy = 1; // blitter working + m_blitter.memory_accesses = 0; + + // Last SCB is indicated by zero in the high byte of SCBNEXT + while (m_blitter.scb_next & 0xff00) + { + m_blitter.stretch = 0; + m_blitter.tilt = 0; + m_blitter.tilt_accumulator = 0; + + m_blitter.scb = m_blitter.scb_next; // current scb + m_blitter.scb_next = lynx_read_ram(m_blitter.scb + SCB_SCBNEXT) | (lynx_read_ram(m_blitter.scb + SCB_SCBNEXT + 1) << 8); // next scb + m_blitter.spr_ctl0 = lynx_read_ram(m_blitter.scb + SCB_SPRCTL0); + m_blitter.spr_ctl1 = lynx_read_ram(m_blitter.scb + SCB_SPRCTL1); + m_blitter.spr_coll = lynx_read_ram(m_blitter.scb + SCB_SPRCOLL); + m_blitter.memory_accesses += 5; + + if(!(m_blitter.spr_ctl1 & 0x04)) // sprite will be processed (if sprite is skipped first 5 bytes are still copied to suzy) + { + m_blitter.bitmap = lynx_read_ram(m_blitter.scb + SCB_SPRDLINE) | (lynx_read_ram(m_blitter.scb + SCB_SPRDLINE + 1) << 8); + m_blitter.x_pos = lynx_read_ram(m_blitter.scb + SCB_HPOSSTRT) | (lynx_read_ram(m_blitter.scb + SCB_HPOSSTRT + 1) << 8); + m_blitter.y_pos = lynx_read_ram(m_blitter.scb + SCB_VPOSSTRT) | (lynx_read_ram(m_blitter.scb + SCB_VPOSSTRT + 1) << 8); + m_blitter.memory_accesses += 6; + + switch(m_blitter.spr_ctl1 & 0x30) // reload sprite scaling + { + case 0x30: // width, height, tilt, stretch + m_blitter.tilt = lynx_read_ram(m_blitter.scb + SCB_TILT) | (lynx_read_ram(m_blitter.scb + SCB_TILT + 1) << 8); + m_blitter.memory_accesses+=2; + case 0x20: // width, height, stretch + m_blitter.stretch = lynx_read_ram(m_blitter.scb + SCB_STRETCH) | (lynx_read_ram(m_blitter.scb + SCB_STRETCH + 1) << 8); + m_blitter.memory_accesses+=2; + case 0x10: // width, height + m_blitter.width = lynx_read_ram(m_blitter.scb + SCB_SPRHSIZ) | (lynx_read_ram(m_blitter.scb + SCB_SPRHSIZ + 1) << 8); + m_blitter.height = lynx_read_ram(m_blitter.scb + SCB_SPRVSIZ) | (lynx_read_ram(m_blitter.scb + SCB_SPRVSIZ + 1) << 8); + m_blitter.memory_accesses+=4; + } + + if(!(m_blitter.spr_ctl1 & 0x08)) // reload palette + { + if (m_blitter.spr_ctl1 & 0x30) + palette_offset = 0x0b + 2*(((m_blitter.spr_ctl1 & 0x30)>>4) + 1); // palette data offset depends on width, height, etc. reloading + else + palette_offset = 0x0b; + + colors = lynx_colors[m_blitter.spr_ctl0 >> 6]; + + for (int i = 0; i < colors / 2; i++) + { + m_blitter.color[i * 2] = lynx_read_ram(m_blitter.scb + palette_offset + i) >> 4; + m_blitter.color[i * 2 + 1 ] = lynx_read_ram(m_blitter.scb + palette_offset + i) & 0x0f; + m_blitter.memory_accesses++; + } + } + } + + + if (!(m_blitter.spr_ctl1 & 0x04)) // if 0, we skip this sprite + { + m_blitter.colpos = m_blitter.scb + (m_suzy.data[COLLOFFL] | (m_suzy.data[COLLOFFH]<<8)); + m_blitter.mode = m_blitter.spr_ctl0 & 0x07; + m_blitter.use_rle = m_blitter.spr_ctl1 & 0x80 ? 0 : 1; + m_blitter.line_color = (m_blitter.spr_ctl0 >> 6) & 0x03; + + m_blitter.sprite_collide = !(m_blitter.spr_coll & 0x20); + m_blitter.spritenr = m_blitter.spr_coll & 0x0f; + m_blitter.fred = 0; + + /* Draw Sprite */ + lynx_blit_lines(); + + if (m_blitter.sprite_collide && !(m_blitter.no_collide)) + { + switch (m_blitter.mode) + { + case BOUNDARY_SHADOW: + case BOUNDARY: + case NORMAL_SPRITE: + case XOR_SPRITE: + case SHADOW: + lynx_write_ram(m_blitter.colpos, m_blitter.fred); + break; + } + } + + if (m_suzy.data[SPRGO] & 0x04) // Everon enabled + { + coldep = lynx_read_ram(m_blitter.colpos); + if (!m_blitter.everon) + coldep |= 0x80; + else + coldep &= 0x7f; + lynx_write_ram(m_blitter.colpos, coldep); + } + } + } + + timer_set(m_maincpu->cycles_to_attotime(m_blitter.memory_accesses), TIMER_BLITTER); +} + + +/**************************************** + + Suzy Emulation + +****************************************/ + + +/* Math bugs of the original hardware: + +- in signed multiply, the hardware thinks that 8000 is a positive number +- in signed multiply, the hardware thinks that 0 is a negative number. This is not an immediate +problem for a multiply by zero, since the answer will be re-negated to the correct polarity of +zero. However, since it will set the sign flag, you can not depend on the sign flag to be correct +if you just load the lower byte after a multiply by zero. +- in divide, the remainder will have 2 possible errors, depending on its actual value (no further +notes on these errors available) */ + +void lynx_state::lynx_divide() +{ + UINT32 left; + UINT16 right; + UINT32 res, mod; + /* + Hardware divide: + EFGH + * NP + ---------------- + ABCD + Remainder (JK)LM + */ + + left = m_suzy.data[MATH_H] | (m_suzy.data[MATH_G] << 8) | (m_suzy.data[MATH_F] << 16) | (m_suzy.data[MATH_E] << 24); + right = m_suzy.data[MATH_P] | (m_suzy.data[MATH_N] << 8); + + m_suzy.accumulate_overflow = FALSE; + if (right == 0) + { + m_suzy.accumulate_overflow = TRUE; /* during divisions, this bit is used to detect denominator = 0 */ + res = 0xffffffff; + mod = 0; //? + } + else + { + res = left / right; + mod = left % right; + } +// logerror("coprocessor %8x / %8x = %4x\n", left, right, res); + m_suzy.data[MATH_D] = res & 0xff; + m_suzy.data[MATH_C] = res >> 8; + m_suzy.data[MATH_B] = res >> 16; + m_suzy.data[MATH_A] = res >> 24; + + m_suzy.data[MATH_M] = mod & 0xff; + m_suzy.data[MATH_L] = mod >> 8; + m_suzy.data[MATH_K] = 0; // documentation states the hardware sets these to zero on divides + m_suzy.data[MATH_J] = 0; +} + +void lynx_state::lynx_multiply() +{ + UINT16 left, right; + UINT32 res, accu; + /* + Hardware multiply: + AB + * CD + ---------------- + EFGH + Accumulate JKLM + */ + m_suzy.accumulate_overflow = FALSE; + + left = m_suzy.data[MATH_B] | (m_suzy.data[MATH_A] << 8); + right = m_suzy.data[MATH_D] | (m_suzy.data[MATH_C] << 8); + + res = left * right; + + if (m_suzy.signed_math) + { + if (!(m_sign_AB + m_sign_CD)) /* different signs */ + res = (res ^ 0xffffffff) + 1; + } + + m_suzy.data[MATH_H] = res & 0xff; + m_suzy.data[MATH_G] = res >> 8; + m_suzy.data[MATH_F] = res >> 16; + m_suzy.data[MATH_E] = res >> 24; + + if (m_suzy.accumulate) + { + accu = m_suzy.data[MATH_M] | m_suzy.data[MATH_L] << 8 | m_suzy.data[MATH_K] << 16 | m_suzy.data[MATH_J] << 24; + accu += res; + + if (accu < res) + m_suzy.accumulate_overflow = TRUE; + + m_suzy.data[MATH_M] = accu; + m_suzy.data[MATH_L] = accu >> 8; + m_suzy.data[MATH_K] = accu >> 16; + m_suzy.data[MATH_J] = accu >> 24; + } +} + +READ8_MEMBER(lynx_state::suzy_read) +{ + UINT8 value = 0, input; + + switch (offset) + { + case TILTACUML: + return m_blitter.tilt_accumulator & 0xff; + case TILTACUMH: + return m_blitter.tilt_accumulator>>8; + case HOFFL: + return m_blitter.xoff & 0xff; + case HOFFH: + return m_blitter.xoff>>8; + case VOFFL: + return m_blitter.yoff & 0xff; + case VOFFH: + return m_blitter.yoff>>8; + case VIDBASL: + return m_blitter.screen & 0xff; + case VIDBASH: + return m_blitter.screen>>8; + case COLLBASL: + return m_blitter.colbuf & 0xff; + case COLLBASH: + return m_blitter.colbuf>>8; + case SCBNEXTL: + return m_blitter.scb_next & 0xff; + case SCBNEXTH: + return m_blitter.scb_next>>8; + case SPRDLINEL: + return m_blitter.bitmap & 0xff; + case SPRDLINEH: + return m_blitter.bitmap>>8; + case HPOSSTRTL: + return m_blitter.x_pos & 0xff; + case HPOSSTRTH: + return m_blitter.x_pos>>8; + case VPOSSTRTL: + return m_blitter.y_pos & 0xff; + case VPOSSTRTH: + return m_blitter.y_pos>>8; + case SPRHSIZL: + return m_blitter.width & 0xff; + case SPRHSIZH: + return m_blitter.width>>8; + case SPRVSIZL: + return m_blitter.height & 0xff; + case SPRVSIZH: + return m_blitter.height>>8; + case STRETCHL: + return m_blitter.stretch & 0xff; + case STRETCHH: + return m_blitter.stretch>>8; + case TILTL: + return m_blitter.tilt & 0xff; + case TILTH: + return m_blitter.tilt>>8; + // case SPRDOFFL: + // case SPRVPOSL: + // case COLLOFFL: + case VSIZACUML: + return m_blitter.height_accumulator & 0xff; + case VSIZACUMH: + return m_blitter.height_accumulator>>8; + case HSIZOFFL: + return m_blitter.width_offset & 0xff; + case HSIZOFFH: + return m_blitter.width_offset>>8; + case VSIZOFFL: + return m_blitter.height_offset & 0xff; + case VSIZOFFH: + return m_blitter.height_offset>>8; + case SCBADRL: + return m_blitter.scb & 0xff; + case SCBADRH: + return m_blitter.scb>>8; + //case PROCADRL: + case SUZYHREV: + return 0x01; // must not be 0 for correct power up + case SPRSYS: + // math busy, last carry, unsafe access, and stop on current sprite bits not implemented. + if (m_suzy.accumulate_overflow) + value |= 0x40; + if (m_blitter.vstretch) + value |= 0x10; + if (m_blitter.lefthanded) + value |= 0x08; + if (m_blitter.busy) + value |= 0x01; + break; + case JOYSTICK: + input = ioport("JOY")->read(); + switch (m_rotate) + { + case 1: + value = input; + input &= 0x0f; + if (value & PAD_UP) input |= PAD_LEFT; + if (value & PAD_LEFT) input |= PAD_DOWN; + if (value & PAD_DOWN) input |= PAD_RIGHT; + if (value & PAD_RIGHT) input |= PAD_UP; + break; + case 2: + value = input; + input &= 0x0f; + if (value & PAD_UP) input |= PAD_RIGHT; + if (value & PAD_RIGHT) input |= PAD_DOWN; + if (value & PAD_DOWN) input |= PAD_LEFT; + if (value & PAD_LEFT) input |= PAD_UP; + break; + } + if (m_blitter.lefthanded) + { + value = input & 0x0f; + if (input & PAD_UP) value |= PAD_DOWN; + if (input & PAD_DOWN) value |= PAD_UP; + if (input & PAD_LEFT) value |= PAD_RIGHT; + if (input & PAD_RIGHT) value |= PAD_LEFT; + } + else + value = input; + break; + case SWITCHES: + value = ioport("PAUSE")->read(); + break; + case RCART: + if (m_cart->exists()) + value = m_cart->read_rom(space, (m_suzy.high * m_granularity) + m_suzy.low); + else + value = 0; + m_suzy.low = (m_suzy.low + 1) & (m_granularity - 1); + break; + //case RCART_BANK1: /* we need bank 1 emulation!!! */ + case SPRCTL0: + case SPRCTL1: + case SPRCOLL: + case SPRINIT: + case SUZYBUSEN: + case SPRGO: + logerror("read from write only register %x\n", offset); + value = 0; + break; + default: + value = m_suzy.data[offset]; + } + //logerror("suzy read %.2x %.2x\n",offset,value); + return value; +} + +WRITE8_MEMBER(lynx_state::suzy_write) +{ + m_suzy.data[offset] = data; + //logerror("suzy write %.2x %.2x\n",offset,data); + /* Additional effects of a write */ + /* Even addresses are the LSB. Any CPU write to an LSB in 0x00-0x7f will set the MSB to 0. */ + /* This in particular holds for math quantities: Writing to B (0x54), D (0x52), + F (0x62), H (0x60), K (0x6e) or M (0x6c) will force a '0' to be written to A (0x55), + C (0x53), E (0x63), G (0x61), J (0x6f) or L (0x6d) respectively */ + if ((offset < 0x80) && !(offset & 0x01)) + m_suzy.data[offset + 1] = 0; + + switch(offset) + { + //case TMPADRL: + //case TMPADRH: + case TILTACUML: + m_blitter.tilt_accumulator = data; // upper byte forced to zero see above. + break; + case TILTACUMH: + m_blitter.tilt_accumulator &= 0xff; + m_blitter.tilt_accumulator |= data<<8; + break; + case HOFFL: + m_blitter.xoff = data; + break; + case HOFFH: + m_blitter.xoff &= 0xff; + m_blitter.xoff |= data<<8; + break; + case VOFFL: + m_blitter.yoff = data; + break; + case VOFFH: + m_blitter.yoff &= 0xff; + m_blitter.yoff |= data<<8; + break; + case VIDBASL: + m_blitter.screen = data; + break; + case VIDBASH: + m_blitter.screen &= 0xff; + m_blitter.screen |= data<<8; + break; + case COLLBASL: + m_blitter.colbuf = data; + break; + case COLLBASH: + m_blitter.colbuf &= 0xff; + m_blitter.colbuf |= data<<8; + break; + case SCBNEXTL: + m_blitter.scb_next = data; + break; + case SCBNEXTH: + m_blitter.scb_next &= 0xff; + m_blitter.scb_next |= data<<8; + break; + case SPRDLINEL: + m_blitter.bitmap = data; + break; + case SPRDLINEH: + m_blitter.bitmap &= 0xff; + m_blitter.bitmap |= data<<8; + break; + case HPOSSTRTL: + m_blitter.x_pos = data; + case HPOSSTRTH: + m_blitter.x_pos &= 0xff; + m_blitter.x_pos |= data<<8; + case VPOSSTRTL: + m_blitter.y_pos = data; + case VPOSSTRTH: + m_blitter.y_pos &= 0xff; + m_blitter.y_pos |= data<<8; + case SPRHSIZL: + m_blitter.width = data; + break; + case SPRHSIZH: + m_blitter.width &= 0xff; + m_blitter.width |= data<<8; + break; + case SPRVSIZL: + m_blitter.height = data; + break; + case SPRVSIZH: + m_blitter.height &= 0xff; + m_blitter.height |= data<<8; + break; + case STRETCHL: + m_blitter.stretch = data; + break; + case STRETCHH: + m_blitter.stretch &= 0xff; + m_blitter.stretch |= data<<8; + break; + case TILTL: + m_blitter.tilt = data; + break; + case TILTH: + m_blitter.tilt &= 0xff; + m_blitter.tilt |= data<<8; + break; + // case SPRDOFFL: + // case SPRVPOSL: + // case COLLOFFL: + case VSIZACUML: + m_blitter.height_accumulator = data; + break; + case VSIZACUMH: + m_blitter.height_accumulator &= 0xff; + m_blitter.height_accumulator |= data<<8; + break; + case HSIZOFFL: + m_blitter.width_offset = data; + break; + case HSIZOFFH: + m_blitter.width_offset &= 0xff; + m_blitter.width_offset |= data<<8; + break; + case VSIZOFFL: + m_blitter.height_offset = data; + break; + case VSIZOFFH: + m_blitter.height_offset &= 0xff; + m_blitter.height_offset |= data<<8; + break; + case SCBADRL: + m_blitter.scb = data; + break; + case SCBADRH: + m_blitter.scb &= 0xff; + m_blitter.scb |= data<<8; + break; + //case PROCADRL: + + /* Writing to M (0x6c) will also clear the accumulator overflow bit */ + case MATH_M: + m_suzy.accumulate_overflow = FALSE; + break; + case MATH_C: + /* If we are going to perform a signed multiplication, we store the sign and convert the number + to an unsigned one */ + if (m_suzy.signed_math) + { + UINT16 factor, temp; + factor = m_suzy.data[MATH_D] | (m_suzy.data[MATH_C] << 8); + if ((factor - 1) & 0x8000) /* here we use -1 to cover the math bugs on the sign of 0 and 0x8000 */ + { + temp = (factor ^ 0xffff) + 1; + m_sign_CD = - 1; + m_suzy.data[MATH_D] = temp & 0xff; + m_suzy.data[MATH_C] = temp >> 8; + } + else + m_sign_CD = 1; + } + break; + case MATH_D: + /* Documentation states that writing to the MATH_D will set MATH_C to zero but not update the sign flag. + Implementing the sign detection as described in the documentation causes Stun Runners to not work. + Either the sign error in the docs is not as described or writing to the lower byte does update the sign flag. + Here I assume the sign flag gets updated. */ + if (data) + m_sign_CD = 1; + break; + /* Writing to A will start a 16 bit multiply */ + /* If we are going to perform a signed multiplication, we also store the sign and convert the + number to an unsigned one */ + case MATH_A: + if (m_suzy.signed_math) + { + UINT16 factor, temp; + factor = m_suzy.data[MATH_B] | (m_suzy.data[MATH_A] << 8); + if ((factor - 1) & 0x8000) /* here we use -1 to cover the math bugs on the sign of 0 and 0x8000 */ + { + temp = (factor ^ 0xffff) + 1; + m_sign_AB = - 1; + m_suzy.data[MATH_B] = temp & 0xff; + m_suzy.data[MATH_A] = temp >> 8; + } + else + m_sign_AB = 1; + } + lynx_multiply(); + break; + /* Writing to E will start a 16 bit divide */ + case MATH_E: + lynx_divide(); + break; + case SPRCTL0: + m_blitter.spr_ctl0 = data; + break; + case SPRCTL1: + m_blitter.spr_ctl1 = data; + break; + case SPRCOLL: + m_blitter.spr_coll = data; + break; + case SUZYBUSEN: + logerror("write to SUSYBUSEN %x \n", data); + break; + case SPRSYS: + m_suzy.signed_math = (data & 0x80) ? 1:0; + m_suzy.accumulate = (data & 0x40) ? 1:0; + m_blitter.no_collide = (data & 0x20) ? 1:0; + m_blitter.vstretch = (data & 0x10) ? 1:0; + m_blitter.lefthanded = (data & 0x08) ? 1:0; + // unsafe access clear and sprite engine stop request are not enabled + if (data & 0x02) logerror("sprite engine stop request\n"); + break; + case SPRGO: + if ((data & 0x01) && m_suzy.data[SUZYBUSEN]) + { + //m_blitter.time = machine().time(); + lynx_blitter(); + } + break; + case JOYSTICK: + case SWITCHES: + logerror("warning: write to read-only button registers\n"); + break; + } +} + + +/**************************************** + + Mikey emulation + +****************************************/ + +/* + 0xfd0a r sync signal? + 0xfd81 r interrupt source bit 2 vertical refresh + 0xfd80 w interrupt quit + 0xfd87 w bit 1 !clr bit 0 blocknumber clk + 0xfd8b w bit 1 blocknumber hi B + 0xfd94 w 0 + 0xfd95 w 4 + 0xfda0-f rw farben 0..15 + 0xfdb0-f rw bit0..3 farben 0..15 +*/ + + +/* +DISPCTL EQU $FD92 ; set to $D by INITMIKEY + +; B7..B4 0 +; B3 1 EQU color +; B2 1 EQU 4 bit mode +; B1 1 EQU flip screen +; B0 1 EQU video DMA enabled +*/ + +void lynx_state::lynx_draw_line() +{ + int x, y; + UINT16 j; // clipping needed! + UINT8 byte; + UINT16 *line; + + + // calculate y: first three lines are vblank, + y = 101-m_timer[2].counter; + // Documentation states lower two bits of buffer address are ignored (thus 0xfffc mask) + j = (m_mikey.disp_addr & 0xfffc) + y * 160 / 2; + + if (m_mikey.data[0x92] & 0x02) + { + j -= 160 * 102 / 2 - 1; + line = &m_bitmap_temp.pix16(102 - 1 - y); + for (x = 160 - 2; x >= 0; j++, x -= 2) + { + byte = lynx_read_ram(j); + line[x + 1] = m_lynx_palette[(byte >> 4) & 0x0f]; + line[x + 0] = m_lynx_palette[(byte >> 0) & 0x0f]; + } + } + else + { + line = &m_bitmap_temp.pix16(y); + for (x = 0; x < 160; j++, x += 2) + { + byte = lynx_read_ram(j); + line[x + 0] = m_lynx_palette[(byte >> 4) & 0x0f]; + line[x + 1] = m_lynx_palette[(byte >> 0) & 0x0f]; + } + } +} + +/**************************************** + + Timers + +****************************************/ + +/* +HCOUNTER EQU TIMER0 +VCOUNTER EQU TIMER2 +SERIALRATE EQU TIMER4 + +TIM_BAKUP EQU 0 ; backup-value (count+1) +TIM_CNTRL1 EQU 1 ; timer-control register +TIM_CNT EQU 2 ; current counter +TIM_CNTRL2 EQU 3 ; dynamic control + +; TIM_CNTRL1 +TIM_IRQ EQU %10000000 ; enable interrupt (not TIMER4 !) +TIM_RESETDONE EQU %01000000 ; reset timer done +TIM_MAGMODE EQU %00100000 ; nonsense in Lynx !! +TIM_RELOAD EQU %00010000 ; enable reload +TIM_COUNT EQU %00001000 ; enable counter +TIM_LINK EQU %00000111 +; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1 +TIM_64us EQU %00000110 +TIM_32us EQU %00000101 +TIM_16us EQU %00000100 +TIM_8us EQU %00000011 +TIM_4us EQU %00000010 +TIM_2us EQU %00000001 +TIM_1us EQU %00000000 + +;TIM_CNTRL2 (read-only) +; B7..B4 unused +TIM_DONE EQU %00001000 ; set if timer's done; reset with TIM_RESETDONE +TIM_LAST EQU %00000100 ; last clock (??) +TIM_BORROWIN EQU %00000010 +TIM_BORROWOUT EQU %00000001 +*/ + +#define NR_LYNX_TIMERS 8 + + + + +void lynx_state::lynx_timer_init(int which) +{ + memset(&m_timer[which], 0, sizeof(LYNX_TIMER)); + m_timer[which].timer = timer_alloc(TIMER_SHOT); + + save_item(NAME(m_timer[which].bakup), which); + save_item(NAME(m_timer[which].cntrl1), which); + save_item(NAME(m_timer[which].cntrl2), which); + save_item(NAME(m_timer[which].counter), which); + save_item(NAME(m_timer[which].timer_active), which); +} + +void lynx_state::lynx_timer_signal_irq(int which) +{ + if ((m_timer[which].cntrl1 & 0x80) && (which != 4)) // if interrupts are enabled and timer != 4 + { + m_mikey.data[0x81] |= (1 << which); // set interupt poll register + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_maincpu->set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); + } + switch (which) // count down linked timers + { + case 0: + switch (m_timer[2].counter) + { + case 104: + break; + case 103: + m_mikey.vb_rest = 1; + break; + case 102: + m_mikey.disp_addr = m_mikey.data[0x94] | (m_mikey.data[0x95] << 8); + break; + case 101: + m_mikey.vb_rest = 0; + lynx_draw_line(); + break; + default: + lynx_draw_line(); + } + lynx_timer_count_down(2); + break; + case 2: + copybitmap(m_bitmap, m_bitmap_temp, 0, 0, 0, 0, machine().first_screen()->cliprect()); + lynx_timer_count_down(4); + break; + case 1: + lynx_timer_count_down(3); + break; + case 3: + lynx_timer_count_down(5); + break; + case 5: + lynx_timer_count_down(7); + break; + case 7: + m_sound->count_down(0); + break; + } +} + +void lynx_state::lynx_timer_count_down(int which) +{ + if ((m_timer[which].cntrl1 & 0x0f) == 0x0f) // count and linking enabled + { + if (m_timer[which].counter > 0) + { + m_timer[which].counter--; + //m_timer[which].borrow_in = 1; + return; + } + if (m_timer[which].counter == 0) + { + if (m_timer[which].cntrl2 & 0x01) // borrow out + { + lynx_timer_signal_irq(which); + if (m_timer[which].cntrl1 & 0x10) // if reload enabled + { + m_timer[which].counter = m_timer[which].bakup; + } + else + { + m_timer[which].cntrl2 |= 8; // set timer done + } + m_timer[which].cntrl2 &= ~0x01; // clear borrow out + } + else + m_timer[which].cntrl2 |= 0x01; // set borrow out + return; + } + } + else + { + //m_timer[which].borrow_in = 0; + m_timer[which].cntrl2 &= ~0x01; + } +} + +UINT32 lynx_state::lynx_time_factor(int val) +{ + switch(val) + { + case 0: return 1000000; + case 1: return 500000; + case 2: return 250000; + case 3: return 125000; + case 4: return 62500; + case 5: return 31250; + case 6: return 15625; + default: fatalerror("invalid value\n"); + } +} + +TIMER_CALLBACK_MEMBER(lynx_state::lynx_timer_shot) +{ + lynx_timer_signal_irq(param); + if (!(m_timer[param].cntrl1 & 0x10)) // if reload not enabled + { + m_timer[param].timer_active = 0; + m_timer[param].cntrl2 |= 8; // set timer done + } + else + { + attotime t = (attotime::from_hz(lynx_time_factor(m_timer[param].cntrl1 & 0x07)) * (m_timer[param].bakup + 1)); + m_timer[param].timer->adjust(t, param); + } +} + +UINT8 lynx_state::lynx_timer_read(int which, int offset) +{ + UINT8 value = 0; + + switch (offset) + { + case 0: + value = m_timer[which].bakup; + break; + case 1: + value = m_timer[which].cntrl1; + break; + case 2: + if ((m_timer[which].cntrl1 & 0x07) == 0x07) // linked timer + { + value = m_timer[which].counter; + } + else + { + if ( m_timer[which].timer_active ) + { + value = (UINT8) (m_timer[which].timer->remaining().as_ticks(1000000>>(m_timer[which].cntrl1 & 0x07))); + value -= value ? 1 : 0; + } + } + break; + + case 3: + value = m_timer[which].cntrl2; + break; + } + // logerror("timer %d read %x %.2x\n", which, offset, value); + return value; +} + +void lynx_state::lynx_timer_write(int which, int offset, UINT8 data) +{ + //logerror("timer %d write %x %.2x\n", which, offset, data); + attotime t; + + if ( m_timer[which].timer_active && ((m_timer[which].cntrl1 & 0x07) != 0x07)) + { + m_timer[which].counter = (UINT8) (m_timer[which].timer->remaining().as_ticks(1000000>>(m_timer[which].cntrl1 & 0x07))); + m_timer[which].counter -= (m_timer[which].counter) ? 1 : 0; + } + + switch (offset) + { + case 0: + m_timer[which].bakup = data; + break; + case 1: + m_timer[which].cntrl1 = data; + if (data & 0x40) // reset timer done + m_timer[which].cntrl2 &= ~0x08; + break; + case 2: + m_timer[which].counter = data; + break; + case 3: + m_timer[which].cntrl2 = (m_timer[which].cntrl2 & ~0x08) | (data & 0x08); + break; + } + + /* Update timers */ + //if ( offset < 3 ) + //{ + m_timer[which].timer->reset(); + m_timer[which].timer_active = 0; + if ((m_timer[which].cntrl1 & 0x08) && !(m_timer[which].cntrl2 & 0x08)) // if enable count + { + if ((m_timer[which].cntrl1 & 0x07) != 0x07) // if not set to link mode + { + t = (attotime::from_hz(lynx_time_factor(m_timer[which].cntrl1 & 0x07)) * (m_timer[which].counter + 1)); + m_timer[which].timer->adjust(t, which); + m_timer[which].timer_active = 1; + } + } + //} +} + + +/**************************************** + + UART Emulation + +****************************************/ + + +void lynx_state::lynx_uart_reset() +{ + memset(&m_uart, 0, sizeof(m_uart)); +} + +TIMER_CALLBACK_MEMBER(lynx_state::lynx_uart_loopback_timer) +{ + m_uart.received = FALSE; +} + +TIMER_CALLBACK_MEMBER(lynx_state::lynx_uart_timer) +{ + if (m_uart.buffer_loaded) + { + m_uart.data_to_send = m_uart.buffer; + m_uart.buffer_loaded = FALSE; + timer_set(attotime::from_usec(11*16), TIMER_UART); + } + else + { + m_uart.sending = FALSE; + m_uart.received = TRUE; + m_uart.data_received = m_uart.data_to_send; + timer_set(attotime::from_usec(11*16), TIMER_UART_LOOPBACK); + if (m_uart.serctl & 0x40) + { + m_mikey.data[0x81] |= 0x10; + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_maincpu->set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); + } + } + + if (m_uart.serctl & 0x80) + { + m_mikey.data[0x81] |= 0x10; + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_maincpu->set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); + } +} + +READ8_MEMBER(lynx_state::lynx_uart_r) +{ + UINT8 value = 0x00; + switch (offset) + { + case 0x8c: + if (!m_uart.buffer_loaded) + value |= 0x80; + if (m_uart.received) + value |= 0x40; + if (!m_uart.sending) + value |= 0x20; + break; + + case 0x8d: + value = m_uart.data_received; + break; + } + logerror("uart read %.2x %.2x\n", offset, value); + return value; +} + +WRITE8_MEMBER(lynx_state::lynx_uart_w) +{ + logerror("uart write %.2x %.2x\n", offset, data); + switch (offset) + { + case 0x8c: + m_uart.serctl = data; + break; + + case 0x8d: + if (m_uart.sending) + { + m_uart.buffer = data; + m_uart.buffer_loaded = TRUE; + } + else + { + m_uart.sending = TRUE; + m_uart.data_to_send = data; + // timing not accurate, baude rate should be calculated from timer 4 backup value and clock rate + timer_set(attotime::from_usec(11*16), TIMER_UART); + } + break; + } +} + + +/**************************************** + + Mikey memory handlers + +****************************************/ + + +READ8_MEMBER(lynx_state::mikey_read) +{ + UINT8 direction, value = 0x00; + + switch (offset) + { + case 0x00: case 0x01: case 0x02: case 0x03: + case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0a: case 0x0b: + case 0x0c: case 0x0d: case 0x0e: case 0x0f: + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: + case 0x1c: case 0x1d: case 0x1e: case 0x1f: + value = lynx_timer_read(offset >> 2, offset & 0x03); + break; + + case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: + case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: + case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: + case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x50: + value = m_sound->read(space, offset); + break; + + case 0x80: + case 0x81: + value = m_mikey.data[0x81]; // both registers access the same interupt status byte + // logerror( "mikey read %.2x %.2x\n", offset, value ); + break; + + case 0x84: + case 0x85: + value = 0x00; + break; + + case 0x86: + value = 0x80; + break; + + case 0x88: + value = 0x01; + break; + + case 0x8b: + direction = m_mikey.data[0x8a]; + value |= (direction & 0x01) ? (m_mikey.data[offset] & 0x01) : 0x01; // External Power input + value |= (direction & 0x02) ? (m_mikey.data[offset] & 0x02) : 0x00; // Cart Address Data output (0 turns cart power on) + value |= (direction & 0x04) ? (m_mikey.data[offset] & 0x04) : 0x04; // noexp input + // REST read returns actual rest state anded with rest output bit + value |= (direction & 0x08) ? (((m_mikey.data[offset] & 0x08) && (m_mikey.vb_rest)) ? 0x00 : 0x08) : 0x00; // rest output + value |= (direction & 0x10) ? (m_mikey.data[offset] & 0x10) : 0x10; // audin input + /* Hack: we disable COMLynx */ + value |= 0x04; + /* B5, B6 & B7 are not used */ + break; + + case 0x8c: + case 0x8d: + value = lynx_uart_r(space, offset, mem_mask); + break; + + default: + value = m_mikey.data[offset]; + //logerror( "mikey read %.2x %.2x\n", offset, value ); + } + return value; +} + +WRITE8_MEMBER(lynx_state::mikey_write) +{ + switch (offset) + { + case 0x00: case 0x01: case 0x02: case 0x03: + case 0x04: case 0x05: case 0x06: case 0x07: + case 0x08: case 0x09: case 0x0a: case 0x0b: + case 0x0c: case 0x0d: case 0x0e: case 0x0f: + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: + case 0x1c: case 0x1d: case 0x1e: case 0x1f: + lynx_timer_write(offset >> 2, offset & 3, data); + return; + + case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: + case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: + case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: + case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x50: + m_sound->write(space, offset, data); + return; + + case 0x80: + m_mikey.data[0x81] &= ~data; // clear interrupt source + // logerror("mikey write %.2x %.2x\n", offset, data); + if (!m_mikey.data[0x81]) + m_maincpu->set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE); + break; + + /* Is this correct? */ // Notes say writing to register will result in interupt being triggered. + case 0x81: + m_mikey.data[0x81] |= data; + if (data) + { + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_maincpu->set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); + logerror("direct write to interupt register\n"); + } + break; + + case 0x87: + m_mikey.data[offset] = data; + if (data & 0x02) // Power (1 = on) + { + if (data & 0x01) // Cart Address Strobe + { + m_suzy.high <<= 1; + if (m_mikey.data[0x8b] & 0x02) + m_suzy.high |= 1; + m_suzy.high &= 0xff; + m_suzy.low = 0; + } + } + else + { + m_suzy.high = 0; + m_suzy.low = 0; + } + break; + + case 0x8c: case 0x8d: + lynx_uart_w(space, offset, data); + break; + + case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7: + case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf: + case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf: + m_mikey.data[offset] = data; + + /* RED = 0xb- & 0x0f, GREEN = 0xa- & 0x0f, BLUE = (0xb- & 0xf0) >> 4 */ + m_lynx_palette[offset & 0x0f] = m_palette->pen( + ((m_mikey.data[0xb0 + (offset & 0x0f)] & 0x0f)) | + ((m_mikey.data[0xa0 + (offset & 0x0f)] & 0x0f) << 4) | + ((m_mikey.data[0xb0 + (offset & 0x0f)] & 0xf0) << 4)); + break; + + /* TODO: properly implement these writes */ + case 0x8b: + m_mikey.data[offset] = data; + if (m_mikey.data[0x8a] & 0x10) + logerror("Trying to enable bank 1 write. %d\n", m_mikey.data[offset] & 0x10); + break; + + //case 0x90: // SDONEACK - Suzy Done Acknowledge + case 0x91: // CPUSLEEP - CPU Bus Request Disable + m_mikey.data[offset] = data; + if (!data && m_blitter.busy) + { + m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + /* A write of '0' to this address will reset the CPU bus request flip flop */ + } + break; + case 0x94: case 0x95: + m_mikey.data[offset]=data; + break; + case 0x9c: case 0x9d: case 0x9e: + m_mikey.data[offset]=data; + logerror("Mtest%d write: %x\n", offset&0x3, data); + break; + + default: + m_mikey.data[offset]=data; + //logerror("mikey write %.2x %.2x\n",offset,data); + break; + } +} + +/**************************************** + + Init / Config + +****************************************/ + +READ8_MEMBER(lynx_state::lynx_memory_config_r) +{ + return m_memory_config; +} + +WRITE8_MEMBER(lynx_state::lynx_memory_config_w) +{ + /* bit 7: hispeed, uses page mode accesses (4 instead of 5 cycles ) + * when these are safe in the cpu */ + m_memory_config = data; + + if (data & 1) + { + space.install_readwrite_bank(0xfc00, 0xfcff, "bank1"); + membank("bank1")->set_base(m_mem_fc00); + } + else + space.install_readwrite_handler(0xfc00, 0xfcff, read8_delegate(FUNC(lynx_state::suzy_read),this), write8_delegate(FUNC(lynx_state::suzy_write),this)); + + if (data & 2) + { + space.install_readwrite_bank(0xfd00, 0xfdff, "bank2"); + membank("bank2")->set_base(m_mem_fd00); + } + else + space.install_readwrite_handler(0xfd00, 0xfdff, read8_delegate(FUNC(lynx_state::mikey_read),this), write8_delegate(FUNC(lynx_state::mikey_write),this)); + + membank("bank3")->set_entry((data & 4) ? 1 : 0); + membank("bank4")->set_entry((data & 8) ? 1 : 0); +} + +void lynx_state::machine_reset() +{ + lynx_memory_config_w(m_maincpu->space(AS_PROGRAM), 0, 0); + + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_maincpu->set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE); + + memset(&m_suzy, 0, sizeof(m_suzy)); + memset(&m_mikey, 0, sizeof(m_mikey)); + + m_suzy.data[0x88] = 0x01; + m_suzy.data[0x90] = 0x00; + m_suzy.data[0x91] = 0x00; + m_mikey.data[0x80] = 0x00; + m_mikey.data[0x81] = 0x00; + m_mikey.data[0x88] = 0x01; + m_mikey.data[0x8a] = 0x00; + m_mikey.data[0x8c] = 0x00; + m_mikey.data[0x90] = 0x00; + m_mikey.data[0x92] = 0x00; + + lynx_uart_reset(); + + // hack to allow current object loading to work +#if 0 + lynx_timer_write( this, 0, 0, 160 ); // set backup value (hpos) = 160 + lynx_timer_write( this, 0, 1, 0x10 | 0x8 | 0 ); // enable count, enable reload, 1us period + lynx_timer_write( this, 2, 0, 105 ); // set backup value (vpos) = 102 + lynx_timer_write( this, 2, 1, 0x10 | 0x8 | 7 ); // enable count, enable reload, link +#endif + + render_target *target = machine().render().first_target(); + target->set_view(m_rotate); +} + +void lynx_state::lynx_postload() +{ + lynx_memory_config_w(m_maincpu->space(AS_PROGRAM), 0, m_memory_config); +} + +void lynx_state::machine_start() +{ + m_bitmap_temp.allocate(160,102,0,0); + + // save driver variables + save_item(NAME(m_memory_config)); + save_item(NAME(m_sign_AB)); + save_item(NAME(m_sign_CD)); + save_item(NAME(m_lynx_palette)); + save_item(NAME(m_rotate)); + // save blitter variables + save_item(NAME(m_blitter.screen)); + save_item(NAME(m_blitter.colbuf)); + save_item(NAME(m_blitter.colpos)); + save_item(NAME(m_blitter.xoff)); + save_item(NAME(m_blitter.yoff)); + save_item(NAME(m_blitter.mode)); + save_item(NAME(m_blitter.spr_coll)); + save_item(NAME(m_blitter.spritenr)); + save_item(NAME(m_blitter.x_pos)); + save_item(NAME(m_blitter.y_pos)); + save_item(NAME(m_blitter.width)); + save_item(NAME(m_blitter.height)); + save_item(NAME(m_blitter.tilt_accumulator)); + save_item(NAME(m_blitter.width_accumulator)); + save_item(NAME(m_blitter.height_accumulator)); + save_item(NAME(m_blitter.width_offset)); + save_item(NAME(m_blitter.height_offset)); + save_item(NAME(m_blitter.stretch)); + save_item(NAME(m_blitter.tilt)); + save_item(NAME(m_blitter.color)); + save_item(NAME(m_blitter.bitmap)); + save_item(NAME(m_blitter.use_rle)); + save_item(NAME(m_blitter.line_color)); + save_item(NAME(m_blitter.spr_ctl0)); + save_item(NAME(m_blitter.spr_ctl1)); + save_item(NAME(m_blitter.scb)); + save_item(NAME(m_blitter.scb_next)); + save_item(NAME(m_blitter.sprite_collide)); + save_item(NAME(m_blitter.everon)); + save_item(NAME(m_blitter.fred)); + save_item(NAME(m_blitter.memory_accesses)); + save_item(NAME(m_blitter.no_collide)); + save_item(NAME(m_blitter.vstretch)); + save_item(NAME(m_blitter.lefthanded)); + save_item(NAME(m_blitter.busy)); + // save suzy variables + save_item(NAME(m_suzy.data)); + save_item(NAME(m_suzy.high)); + save_item(NAME(m_suzy.low)); + save_item(NAME(m_suzy.signed_math)); + save_item(NAME(m_suzy.accumulate)); + save_item(NAME(m_suzy.accumulate_overflow)); + // save mikey variables + save_item(NAME(m_mikey.data)); + save_item(NAME(m_mikey.disp_addr)); + save_item(NAME(m_mikey.vb_rest)); + // save uart variables + save_item(NAME(m_uart.serctl)); + save_item(NAME(m_uart.data_received)); + save_item(NAME(m_uart.data_to_send)); + save_item(NAME(m_uart.buffer)); + save_item(NAME(m_uart.received)); + save_item(NAME(m_uart.sending)); + save_item(NAME(m_uart.buffer_loaded)); + + machine().save().register_postload(save_prepost_delegate(FUNC(lynx_state::lynx_postload), this)); + + membank("bank3")->configure_entry(0, memregion("maincpu")->base() + 0x0000); + membank("bank3")->configure_entry(1, m_mem_fe00); + membank("bank4")->configure_entry(0, memregion("maincpu")->base() + 0x01fa); + membank("bank4")->configure_entry(1, m_mem_fffa); + + for (int i = 0; i < NR_LYNX_TIMERS; i++) + lynx_timer_init(i); +} + + +/**************************************** + + Image handling + +****************************************/ + +int lynx_state::lynx_verify_cart (char *header, int kind) +{ + if (kind) + { + if (strncmp("BS93", &header[6], 4)) + { + logerror("This is not a valid Lynx image\n"); + return IMAGE_VERIFY_FAIL; + } + } + else + { + if (strncmp("LYNX", &header[0], 4)) + { + if (!strncmp("BS93", &header[6], 4)) + { + logerror("This image is probably a Quickload image with .lnx extension\n"); + logerror("Try to load it with -quickload\n"); + } + else + logerror("This is not a valid Lynx image\n"); + return IMAGE_VERIFY_FAIL; + } + } + + return IMAGE_VERIFY_PASS; +} + +DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart ) +{ + /* Lynx carts have 19 address lines, the upper 8 used for bank select. The lower + 11 bits are used to address data within the selected bank. Valid bank sizes are 256, + 512, 1024 or 2048 bytes. Commercial roms use all 256 banks.*/ + UINT32 size = m_cart->common_get_size("rom"); + UINT16 gran = 0; + + if (image.software_entry() == NULL) + { + // check for lnx header + const char *filetype = image.filetype(); + if (!core_stricmp(filetype, "lnx")) + { + // 64 byte header + // LYNX + // intelword lower counter size + // 0 0 1 0 + // 32 chars name + // 22 chars manufacturer + UINT8 header[0x40]; + image.fread(header, 0x40); + + // Check the image + if (lynx_verify_cart((char*)header, LYNX_CART) == IMAGE_VERIFY_FAIL) + return IMAGE_INIT_FAIL; + + /* 2008-10 FP: According to Handy source these should be page_size_bank0. Are we using + it correctly in MESS? Moreover, the next two values should be page_size_bank1. We should + implement this as well */ + gran = header[4] | (header[5] << 8); + + logerror ("%s %dkb cartridge with %dbyte granularity from %s\n", header + 10, size / 1024, gran, header + 42); + size -= 0x40; + } + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + // set-up granularity + if (image.software_entry() == NULL) + { + const char *filetype = image.filetype(); + if (!core_stricmp(filetype, "lnx")) // from header + m_granularity = gran; + else if (!core_stricmp(filetype, "lyx")) + { + /* 2008-10 FP: FIXME: .lyx file don't have an header, hence they miss "lynx_granularity" + (see above). What if bank 0 has to be loaded elsewhere? And what about bank 1? + These should work with most .lyx files, but we need additional info on raw cart images */ + if (size == 0x20000) + m_granularity = 0x0200; + else if (size == 0x80000) + m_granularity = 0x0800; + else + m_granularity = 0x0400; + } + } + else + { + if (size > 0xffff) // 64,128,256,512k cartridges + m_granularity = size >> 8; + else + m_granularity = 0x400; // Homebrew roms not using all 256 banks (T-Tris) (none currently in softlist) + } + + // set-up rotation from softlist + if (image.software_entry() != NULL) + { + const char *rotate = image.get_feature("rotation"); + m_rotate = 0; + if (rotate) + { + if (!core_stricmp(rotate, "RIGHT")) + m_rotate = 1; + else if (!core_stricmp(rotate, "LEFT")) + m_rotate = 2; + } + + } + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/m20_8086.c b/src/mame/machine/m20_8086.c new file mode 100644 index 00000000000..5c817b17edf --- /dev/null +++ b/src/mame/machine/m20_8086.c @@ -0,0 +1,119 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#include "m20_8086.h" +#include "machine/ram.h" + +const device_type M20_8086 = &device_creator; + +m20_8086_device::m20_8086_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, M20_8086, "Olivetti M20 8086 Adapter", tag, owner, clock, "m20_8086", __FILE__), + m_8086(*this, "8086"), + m_maincpu(*this, ":maincpu"), + m_pic(*this, ":i8259"), + m_8086_halt(true) +{ +} + +void m20_8086_device::device_start() +{ + UINT8* ram = machine().device("ram")->pointer(); + m_8086->space(AS_PROGRAM).install_readwrite_bank(0x00000, machine().device("ram")->size() - 0x4001, "mainram"); + membank("highram")->set_base(ram); + membank("mainram")->set_base(&ram[0x4000]); + membank("vram")->set_base(memshare(":p_videoram")->ptr()); + membank("vram2")->set_base(memshare(":p_videoram")->ptr()); +} + +void m20_8086_device::device_reset() +{ + m_8086_halt = true; + m_nvi = m_vi = 0; + m_8086->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); +} + +ROM_START( m20_8086 ) + ROM_REGION(0x4000, "8086", 0) + ROM_LOAD("apb-1086-2.0.bin", 0x0000, 0x4000, CRC(8c05be93) SHA1(2bb424afd874cc6562e9642780eaac2391308053)) +ROM_END + + +const rom_entry *m20_8086_device::device_rom_region() const +{ + return ROM_NAME( m20_8086 ); +} + +static ADDRESS_MAP_START(i86_prog, AS_PROGRAM, 16, m20_8086_device) + AM_RANGE(0xe0000, 0xe3fff) AM_RAMBANK("vram2") + AM_RANGE(0xf0000, 0xf3fff) AM_RAMBANK("highram") + AM_RANGE(0xf4000, 0xf7fff) AM_RAMBANK("vram") + AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("8086",0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(i86_io, AS_IO, 16, m20_8086_device) + AM_RANGE(0x4000, 0x4fff) AM_READWRITE(z8000_io_r, z8000_io_w) + AM_RANGE(0x7ffa, 0x7ffd) AM_WRITE(handshake_w) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( m20_8086 ) + MCFG_CPU_ADD("8086", I8086, XTAL_24MHz/3) + MCFG_CPU_PROGRAM_MAP(i86_prog) + MCFG_CPU_IO_MAP(i86_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(m20_8086_device, int_cb) +MACHINE_CONFIG_END + +machine_config_constructor m20_8086_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( m20_8086 ); +} + +READ16_MEMBER(m20_8086_device::z8000_io_r) +{ + return m_maincpu->space(AS_IO).read_word(offset << 1, mem_mask); +} + +WRITE16_MEMBER(m20_8086_device::z8000_io_w) +{ + m_maincpu->space(AS_IO).write_word(offset << 1, data, mem_mask); +} + +IRQ_CALLBACK_MEMBER(m20_8086_device::int_cb) +{ + if(m_nvi) + { + m_nvi = false; + m_8086->set_input_line(INPUT_LINE_IRQ0, m_vi ? ASSERT_LINE : CLEAR_LINE); + return 0xff; + } + else + return m_pic->acknowledge() << 1; +} + +WRITE_LINE_MEMBER(m20_8086_device::nvi_w) +{ + m_nvi = state; + m_8086->set_input_line(INPUT_LINE_IRQ0, (state || m_vi) ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE_LINE_MEMBER(m20_8086_device::vi_w) +{ + m_vi = state; + m_8086->set_input_line(INPUT_LINE_IRQ0, (state || m_nvi) ? ASSERT_LINE : CLEAR_LINE); +} + +WRITE16_MEMBER(m20_8086_device::handshake_w) +{ + if(!offset) + { + m_8086->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_8086_halt = true; + } + else + { + m_8086->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_8086->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_8086_halt = false; + } +} diff --git a/src/mame/machine/m20_8086.h b/src/mame/machine/m20_8086.h new file mode 100644 index 00000000000..148ba808c0a --- /dev/null +++ b/src/mame/machine/m20_8086.h @@ -0,0 +1,40 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#ifndef M20_8086_H_ +#define M20_8086_H_ + +#include "emu.h" +#include "cpu/i86/i86.h" +#include "machine/pic8259.h" + +class m20_8086_device : public device_t +{ +public: + m20_8086_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + + DECLARE_READ16_MEMBER(z8000_io_r); + DECLARE_WRITE16_MEMBER(z8000_io_w); + DECLARE_WRITE_LINE_MEMBER(vi_w); + DECLARE_WRITE_LINE_MEMBER(nvi_w); + DECLARE_WRITE16_MEMBER(handshake_w); + IRQ_CALLBACK_MEMBER(int_cb); + bool halted() { return m_8086_halt; } + required_device m_8086; + +protected: + void device_start(); + void device_reset(); + +private: + required_device m_maincpu; + required_device m_pic; + bool m_8086_halt; + int m_nvi, m_vi; +}; + +extern const device_type M20_8086; + +#endif /* M20_8086_H_ */ diff --git a/src/mame/machine/m20_kbd.c b/src/mame/machine/m20_kbd.c new file mode 100644 index 00000000000..ecccffae775 --- /dev/null +++ b/src/mame/machine/m20_kbd.c @@ -0,0 +1,225 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +// TODO: dump 8048 mcu + +#include "machine/m20_kbd.h" + +m20_keyboard_device::m20_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : + serial_keyboard_device(mconfig, M20_KEYBOARD, "M20 Keyboard", tag, owner, 0, "m20_keyboard", __FILE__) +{ +} + +void m20_keyboard_device::write(UINT8 data) +{ + switch(data) + { + case 0x03: + send_key(2); + break; + case 0x80: + send_key(0x80); + break; + } + return; +} + +UINT8 m20_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) +{ + int i = *scan_line, j; + UINT8 code = 0, state = m_state[i]; + + if (i == 0) code = m_io_kbd0->read(); + else + if (i == 1) code = m_io_kbd1->read(); + else + if (i == 2) code = m_io_kbd2->read(); + else + if (i == 3) code = m_io_kbd3->read(); + else + if (i == 4) code = m_io_kbd4->read(); + else + if (i == 5) code = m_io_kbd5->read(); + else + if (i == 6) code = m_io_kbd6->read(); + else + if (i == 7) code = m_io_kbd7->read(); + else + if (i == 8) code = m_io_kbd8->read(); + + *scan_line = (*scan_line + 1) % 9; + + if(m_state[i] == code) + return 0; + + m_state[i] = code; + code = (state ^ code) & code; + + if(!code) + return 0; + + for(j = 0; j < 8; j++) + if((code >> j) == 1) + break; + + if(i >= 6) + code = 0xc0 + ((i - 6) << 3) + j; + else + code = (i << 3) + j; + + state = m_io_kbd9->read(); + if(state && (i <= 8)) + { + switch(state) + { + case 1: + code += 0x90; + break; + case 2: + code += 0x60; + break; + case 4: + case 8: + code += 0x30; + break; + } + } + + return code; +} + +// Italian layout +static INPUT_PORTS_START( m20_keyboard ) + PORT_START("TERM_LINE0") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_LALT) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + + PORT_START("TERM_LINE1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("TERM_LINE2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("TERM_LINE3") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa0 0") PORT_CODE(KEYCODE_0) PORT_CHAR(0x85) PORT_CHAR('0') // a_GRAVE + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc2\xa3 1") PORT_CODE(KEYCODE_1) PORT_CHAR(0x9c) PORT_CHAR('1') // POUND + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(e_ACUTE " 2") PORT_CODE(KEYCODE_2) PORT_CHAR(0x82) PORT_CHAR('2') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\" 3") PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') + + PORT_START("TERM_LINE4") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' 4") PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("( 5") PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_ 6") PORT_CODE(KEYCODE_6) PORT_CHAR('_') PORT_CHAR('6') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa8 7") PORT_CODE(KEYCODE_7) PORT_CHAR(0x8a) PORT_CHAR('7') // e_GRAVE + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ 8") PORT_CODE(KEYCODE_8) PORT_CHAR('^') PORT_CHAR('8') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa7 9") PORT_CODE(KEYCODE_9) PORT_CHAR(0x87) PORT_CHAR('9') // c_CEDILLA + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(") \xc2\xb0") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR(0xa7) // DEGREE + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('+') + + PORT_START("TERM_LINE5") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xac =") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x8d) PORT_CHAR('=') // i_GRAVE + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("$ &") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('$') PORT_CHAR('&') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xb9 %") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x8a) PORT_CHAR('%') // u_GRAVE + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("* \xc2\xa7") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('*') PORT_CHAR(0xf5) // SECTION + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; .") PORT_CODE(KEYCODE_STOP) PORT_CHAR(';') PORT_CHAR('.') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": /") PORT_CODE(KEYCODE_SLASH) PORT_CHAR(':') PORT_CHAR('/') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xb2") PORT_CODE(KEYCODE_RALT) PORT_CHAR(0x95) + + PORT_START("TERM_LINE6") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S2") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + + PORT_START("TERM_LINE7") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + + PORT_START("TERM_LINE8") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + + PORT_START("TERM_LINE9") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("COMMAND") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) + + PORT_START("TERM_LINEC") + + PORT_START("RS232_TXBAUD") + PORT_CONFNAME(0xff, RS232_BAUD_1200, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_BAUD_1200, "1200") + + PORT_START("RS232_STARTBITS") + PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STARTBITS_1, "1") + + PORT_START("RS232_DATABITS") + PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_DATABITS_8, "8") + + PORT_START("RS232_PARITY") + PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_PARITY_NONE, "None") + + PORT_START("RS232_STOPBITS") + PORT_CONFNAME(0xff, RS232_STOPBITS_2, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STOPBITS_2, "2") +INPUT_PORTS_END + +ioport_constructor m20_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(m20_keyboard); +} + +void m20_keyboard_device::device_start() +{ + serial_keyboard_device::device_start(); + memset(m_state, '\0', sizeof(m_state)); + set_rcv_rate(1200); +} + +void m20_keyboard_device::rcv_complete() +{ + receive_register_extract(); + write(get_received_char()); +} + +const device_type M20_KEYBOARD = &device_creator; diff --git a/src/mame/machine/m20_kbd.h b/src/mame/machine/m20_kbd.h new file mode 100644 index 00000000000..a3b9e770e77 --- /dev/null +++ b/src/mame/machine/m20_kbd.h @@ -0,0 +1,26 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#ifndef M20KBD_H_ +#define M20KBD_H_ + +#include "bus/rs232/keyboard.h" + +class m20_keyboard_device : public serial_keyboard_device +{ +public: + m20_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ioport_constructor device_input_ports() const; + +protected: + virtual void device_start(); + virtual void rcv_complete(); + +private: + void write(UINT8 data); + virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); + UINT8 m_state[16]; +}; + +extern const device_type M20_KEYBOARD; + +#endif /* M20KBD_H_ */ diff --git a/src/mame/machine/m24_kbd.c b/src/mame/machine/m24_kbd.c new file mode 100644 index 00000000000..5cc05a95b16 --- /dev/null +++ b/src/mame/machine/m24_kbd.c @@ -0,0 +1,292 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#include "m24_kbd.h" + +const device_type M24_KEYBOARD = &device_creator; + +ROM_START( m24_keyboard ) + ROM_REGION(0x800, "mcu", 0) + ROM_LOAD("m24_8049_int.bin", 0x0000, 0x800, CRC(ef26ca15) SHA1(b5076d40c255e17dc93478e2254ea19aff4918b3)) +ROM_END + + +const rom_entry *m24_keyboard_device::device_rom_region() const +{ + return ROM_NAME( m24_keyboard ); +} + +static ADDRESS_MAP_START( m24_keyboard_io, AS_IO, 8, m24_keyboard_device ) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(p2_r) AM_WRITENOP + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( m24_keyboard ) + MCFG_CPU_ADD("mcu", I8049, XTAL_6MHz) + MCFG_CPU_IO_MAP(m24_keyboard_io) +MACHINE_CONFIG_END + +machine_config_constructor m24_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( m24_keyboard ); +} + +INPUT_PORTS_START( m24_keyboard ) + PORT_START("ROW.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + + PORT_START("ROW.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + + PORT_START("ROW.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + + PORT_START("ROW.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + + PORT_START("ROW.4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("ROW.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + + PORT_START("ROW.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("ROW.7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + + PORT_START("ROW.8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + + PORT_START("ROW.9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + + PORT_START("ROW.10") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW.11") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW.12") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW.13") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW.14") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW.15") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x2A") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + + PORT_START("MOUSEBTN") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left Btn") PORT_CODE(MOUSECODE_BUTTON1) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Middle Btn") PORT_CODE(MOUSECODE_BUTTON3) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right Btn") PORT_CODE(MOUSECODE_BUTTON2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +ioport_constructor m24_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( m24_keyboard ); +} + +m24_keyboard_device::m24_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, M24_KEYBOARD, "Olivetti M24 Keyboard", tag, owner, clock, "m24_kbd", __FILE__), + m_rows(*this, "ROW"), + m_mousebtn(*this, "MOUSEBTN"), + m_out_data(*this), + m_mcu(*this, "mcu") +{ +} + +void m24_keyboard_device::device_start() +{ + m_out_data.resolve_safe(); + m_out_data(1); + m_reset_timer = timer_alloc(); +} + +void m24_keyboard_device::device_reset() +{ + m_kbcdata = true; +} + +void m24_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_out_data(1); +} + +READ8_MEMBER( m24_keyboard_device::p1_r ) +{ + return m_p1 | (m_kbcdata ? 0 : 2); +} + +WRITE8_MEMBER( m24_keyboard_device::p1_w ) +{ + // bit 3 and 4 are leds and bits 6 and 7 are jumpers to ground + m_p1 = data & ~0xc0; + if(m_p1 & 4) + m_p1 |= 2; + else + m_p1 &= ~2; + m_out_data(!BIT(data, 2)); +} + +READ8_MEMBER( m24_keyboard_device::p2_r ) +{ + return (m_keypress << 7) | m_mousebtn->read(); +} + +READ8_MEMBER( m24_keyboard_device::t0_r ) +{ + return 0; +} + +READ8_MEMBER( m24_keyboard_device::t1_r ) +{ + return 0; +} + +WRITE8_MEMBER( m24_keyboard_device::bus_w ) +{ + UINT8 col = m_rows[(data >> 3) & 0xf]->read(); + m_keypress = (col & (1 << (data & 7))) ? 1 : 0; +} + +WRITE_LINE_MEMBER( m24_keyboard_device::clock_w ) +{ + m_mcu->set_input_line(MCS48_INPUT_IRQ, !state); + if(!state) + m_reset_timer->adjust(attotime::from_msec(50)); + else + { + m_reset_timer->adjust(attotime::never); + m_mcu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } +} + +WRITE_LINE_MEMBER( m24_keyboard_device::data_w ) +{ + m_kbcdata = state; +} diff --git a/src/mame/machine/m24_kbd.h b/src/mame/machine/m24_kbd.h new file mode 100644 index 00000000000..8057c87e053 --- /dev/null +++ b/src/mame/machine/m24_kbd.h @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#ifndef M24KBD_H_ +#define M24KBD_H_ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" + +#define MCFG_M24_KEYBOARD_OUT_DATA_HANDLER(_devcb) \ + devcb = &m24_keyboard_device::set_out_data_handler(*device, DEVCB_##_devcb); + +class m24_keyboard_device : public device_t +{ +public: + m24_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_out_data_handler(device_t &device, _Object object) { return downcast(device).m_out_data.set_callback(object); } + + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + void device_start(); + void device_reset(); + void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + DECLARE_WRITE8_MEMBER(bus_w); + DECLARE_READ8_MEMBER(p1_r); + DECLARE_WRITE8_MEMBER(p1_w); + DECLARE_READ8_MEMBER(p2_r); + DECLARE_READ8_MEMBER(t0_r); + DECLARE_READ8_MEMBER(t1_r); + DECLARE_WRITE_LINE_MEMBER(clock_w); + DECLARE_WRITE_LINE_MEMBER(data_w); +private: + required_ioport_array<16> m_rows; + required_ioport m_mousebtn; + UINT8 m_p1; + bool m_keypress, m_kbcdata; + devcb_write_line m_out_data; + required_device m_mcu; + emu_timer *m_reset_timer; +}; + +extern const device_type M24_KEYBOARD; + +#endif /* M24KBD_H_ */ diff --git a/src/mame/machine/m24_z8000.c b/src/mame/machine/m24_z8000.c new file mode 100644 index 00000000000..d89034b4736 --- /dev/null +++ b/src/mame/machine/m24_z8000.c @@ -0,0 +1,229 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#include "m24_z8000.h" + +const device_type M24_Z8000 = &device_creator; + +m24_z8000_device::m24_z8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, M24_Z8000, "Olivetti M24 Z8000 Adapter", tag, owner, clock, "m24_z8000", __FILE__), + m_z8000(*this, "z8000"), + m_maincpu(*this, ":maincpu"), + m_pic(*this, ":mb:pic8259"), + m_halt_out(*this), + m_z8000_halt(true) +{ +} + +void m24_z8000_device::device_start() +{ + m_halt_out.resolve_safe(); +} + +void m24_z8000_device::device_reset() +{ + m_z8000_halt = true; + m_z8000_mem = false; + m_timer_irq = false; + m_irq = 0; + m_z8000->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); +} + +ROM_START( m24_z8000 ) + ROM_REGION(0x4000, "z8000", 0) + ROM_LOAD("m24apb.bin", 0x0000, 0x4000, CRC(3b3d2895) SHA1(ff048cf61b090b147be7e29a929a0be7b3ac8409)) +ROM_END + + +const rom_entry *m24_z8000_device::device_rom_region() const +{ + return ROM_NAME( m24_z8000 ); +} + +static ADDRESS_MAP_START(z8000_prog, AS_PROGRAM, 16, m24_z8000_device) + AM_RANGE(0x40000, 0x43fff) AM_ROM AM_REGION("z8000", 0) + AM_RANGE(0x50000, 0x53fff) AM_ROM AM_REGION("z8000", 0) + AM_RANGE(0x70000, 0x73fff) AM_ROM AM_REGION("z8000", 0) + AM_RANGE(0x00000, 0xfffff) AM_READWRITE(pmem_r, pmem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(z8000_data, AS_DATA, 16, m24_z8000_device) + AM_RANGE(0x40000, 0x43fff) AM_ROM AM_REGION("z8000", 0) + AM_RANGE(0x70000, 0x73fff) AM_ROM AM_REGION("z8000", 0) + AM_RANGE(0x00000, 0xfffff) AM_READWRITE(dmem_r, dmem_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(z8000_io, AS_IO, 16, m24_z8000_device) + AM_RANGE(0x0080, 0x0081) AM_WRITE8(irqctl_w, 0x00ff) + AM_RANGE(0x00a0, 0x00a1) AM_WRITE8(serctl_w, 0x00ff) + AM_RANGE(0x00c0, 0x00c1) AM_DEVREADWRITE8("i8251", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0x00c2, 0x00c3) AM_DEVREADWRITE8("i8251", i8251_device, status_r, control_w, 0x00ff) + AM_RANGE(0x0120, 0x0127) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0x00ff) + AM_RANGE(0x80c0, 0x80c1) AM_READWRITE8(handshake_r, handshake_w, 0x00ff) + AM_RANGE(0x8000, 0x83ff) AM_READWRITE(i86_io_r, i86_io_w) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( m24_z8000 ) + MCFG_CPU_ADD("z8000", Z8001, XTAL_8MHz/2) + MCFG_CPU_PROGRAM_MAP(z8000_prog) + MCFG_CPU_DATA_MAP(z8000_data) + MCFG_CPU_IO_MAP(z8000_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(m24_z8000_device, int_cb) + MCFG_Z8000_MO(WRITELINE(m24_z8000_device, mo_w)) + + MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_PIT8253_CLK0(19660000/15) + MCFG_PIT8253_OUT0_HANDLER(NULL) //8251 + MCFG_PIT8253_CLK1(19660000/15) + MCFG_PIT8253_OUT1_HANDLER(NULL) + MCFG_PIT8253_CLK2(19660000/15) + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(m24_z8000_device, timer_irq_w)) + + MCFG_DEVICE_ADD("i8251", I8251, 0) +MACHINE_CONFIG_END + +machine_config_constructor m24_z8000_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( m24_z8000 ); +} + +const UINT8 m24_z8000_device::pmem_table[16][4] = + {{0, 1, 2, 3}, {1, 2, 3, 255}, {4, 5, 6, 7}, {46, 40, 41, 42}, + {255, 255, 255, 255}, {255, 255, 255, 47}, {1, 2, 3, 255}, {255, 255, 255, 255}, + {1, 2, 8, 9}, {5, 6, 10, 11}, {1, 2, 8, 9}, {12, 13, 14, 15}, + {16, 17, 18, 19}, {20, 21, 22, 23}, {24, 25, 26, 27}, {28, 29, 30, 31}}; + +READ16_MEMBER(m24_z8000_device::pmem_r) +{ + UINT16 ret; + UINT8 hostseg; + offset <<= 1; + if(!m_z8000_mem) + return memregion(subtag("z8000").c_str())->u16(offset >> 1); + + hostseg = pmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; + if(hostseg == 255) + return 0; + offset = (offset & 0x3fff) | (hostseg << 14); + if((hostseg >= 40) && (hostseg <= 47)) + offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); // move A6/A7 so CGA framebuffer appears linear + ret = m_maincpu->space(AS_PROGRAM).read_word(offset, (mem_mask << 8) | (mem_mask >> 8)); + return (ret << 8) | (ret >> 8); +} + +WRITE16_MEMBER(m24_z8000_device::pmem_w) +{ + UINT8 hostseg; + data = (data << 8) | (data >> 8); + offset <<= 1; + hostseg = pmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; + if(hostseg == 255) + return; + offset = (offset & 0x3fff) | (hostseg << 14); + if((hostseg >= 40) && (hostseg <= 47)) + offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); + m_maincpu->space(AS_PROGRAM).write_word(offset, data, (mem_mask << 8) | (mem_mask >> 8)); +} + +const UINT8 m24_z8000_device::dmem_table[16][4] = + {{0, 1, 2, 3}, {4, 5, 6, 7}, {4, 5, 6, 7}, {46, 40, 41, 42}, + {255, 255, 255, 255}, {1, 2, 3, 47}, {1, 2, 3, 255}, {255, 255, 255, 255}, + {5, 6, 10, 11}, {5, 6, 10, 11}, {1, 2, 8, 9}, {12, 13, 14, 15}, + {16, 17, 18, 19}, {20, 21, 22, 23}, {24, 25, 26, 27}, {28, 29, 30, 31}}; + +READ16_MEMBER(m24_z8000_device::dmem_r) +{ + UINT16 ret; + UINT8 hostseg; + offset <<= 1; + hostseg = dmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; + if(hostseg == 255) + return 0; + offset = (offset & 0x3fff) | (hostseg << 14); + if((hostseg >= 40) && (hostseg <= 47)) + offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); + ret = m_maincpu->space(AS_PROGRAM).read_word(offset, (mem_mask << 8) | (mem_mask >> 8)); + return (ret << 8) | (ret >> 8); +} + +WRITE16_MEMBER(m24_z8000_device::dmem_w) +{ + UINT8 hostseg; + data = (data << 8) | (data >> 8); + offset <<= 1; + hostseg = dmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; + if(hostseg == 255) + return; + offset = (offset & 0x3fff) | (hostseg << 14); + if((hostseg >= 40) && (hostseg <= 47)) + offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); + m_maincpu->space(AS_PROGRAM).write_word(offset, data, (mem_mask << 8) | (mem_mask >> 8)); +} + +READ16_MEMBER(m24_z8000_device::i86_io_r) +{ + UINT16 ret = m_maincpu->space(AS_IO).read_word(offset << 1, (mem_mask << 8) | (mem_mask >> 8)); + return (ret << 8) | (ret >> 8); +} + +WRITE16_MEMBER(m24_z8000_device::i86_io_w) +{ + data = (data << 8) | (data >> 8); + m_maincpu->space(AS_IO).write_word(offset << 1, data, (mem_mask << 8) | (mem_mask >> 8)); +} + +WRITE8_MEMBER(m24_z8000_device::irqctl_w) +{ + m_irq = data; +} + +WRITE8_MEMBER(m24_z8000_device::serctl_w) +{ + m_z8000_mem = (data & 0x20) ? true : false; +} + +IRQ_CALLBACK_MEMBER(m24_z8000_device::int_cb) +{ + if (!irqline) + { + m_z8000->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + return 0xff; // NVI, value ignored + } + else + return m_pic->acknowledge(); +} + +READ8_MEMBER(m24_z8000_device::handshake_r) +{ + return 0; +} + +WRITE8_MEMBER(m24_z8000_device::handshake_w) +{ + m_handshake = data; + if(data & 1) + { + m_z8000->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_z8000->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + m_z8000->mi_w(CLEAR_LINE); + m_z8000_halt = false; + } + else + { + m_z8000->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_z8000_halt = true; + m_z8000_mem = false; + m_halt_out(CLEAR_LINE); + } +} + +WRITE_LINE_MEMBER(m24_z8000_device::mo_w) +{ + m_z8000->mi_w(state ? ASSERT_LINE : CLEAR_LINE); + m_halt_out(state); +} + +WRITE_LINE_MEMBER(m24_z8000_device::timer_irq_w) +{ + m_timer_irq = state ? true : false; + m_z8000->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); +} diff --git a/src/mame/machine/m24_z8000.h b/src/mame/machine/m24_z8000.h new file mode 100644 index 00000000000..7f0e08e0b5e --- /dev/null +++ b/src/mame/machine/m24_z8000.h @@ -0,0 +1,56 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#ifndef M24_Z8000_H_ +#define M24_Z8000_H_ + +#include "emu.h" +#include "cpu/z8000/z8000.h" +#include "machine/i8251.h" +#include "machine/pit8253.h" +#include "machine/pic8259.h" + +#define MCFG_M24_Z8000_HALT(_devcb) \ + devcb = &m24_z8000_device::set_halt_callback(*device, DEVCB_##_devcb); + +class m24_z8000_device : public device_t +{ +public: + m24_z8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + template static devcb_base &set_halt_callback(device_t &device, _Object object) { return downcast(device).m_halt_out.set_callback(object); } + + DECLARE_READ16_MEMBER(pmem_r); + DECLARE_WRITE16_MEMBER(pmem_w); + DECLARE_READ16_MEMBER(dmem_r); + DECLARE_WRITE16_MEMBER(dmem_w); + DECLARE_READ16_MEMBER(i86_io_r); + DECLARE_WRITE16_MEMBER(i86_io_w); + DECLARE_WRITE8_MEMBER(irqctl_w); + DECLARE_WRITE8_MEMBER(serctl_w); + DECLARE_READ8_MEMBER(handshake_r); + DECLARE_WRITE8_MEMBER(handshake_w); + DECLARE_WRITE_LINE_MEMBER(mo_w); + DECLARE_WRITE_LINE_MEMBER(timer_irq_w); + IRQ_CALLBACK_MEMBER(int_cb); + bool halted() { return m_z8000_halt; } + + required_device m_z8000; +protected: + void device_start(); + void device_reset(); + +private: + required_device m_maincpu; + required_device m_pic; + devcb_write_line m_halt_out; + static const UINT8 pmem_table[16][4]; + static const UINT8 dmem_table[16][4]; + UINT8 m_handshake, m_irq; + bool m_z8000_halt, m_z8000_mem, m_timer_irq; +}; + +extern const device_type M24_Z8000; + +#endif /* M24_Z8000_H_ */ diff --git a/src/mame/machine/mac.c b/src/mame/machine/mac.c new file mode 100644 index 00000000000..098bcede238 --- /dev/null +++ b/src/mame/machine/mac.c @@ -0,0 +1,3294 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/**************************************************************************** + + machine/mac.c + + Mac hardware - Mac 128k, 512k, 512ke, Plus, SE, Classic, II, PowerBook (SCSI, SCC, ADB, etc) + + Nate Woods + Ernesto Corvi + Raphael Nabet + R. Belmont + + Mac Model Feature Summary: + CPU FDC Kbd/Mouse PRAM Video + - Mac 128k 68k IWM orig orig Original + - Mac 512k 68k IWM orig orig Original + - Mac 512ke 68k IWM orig orig Original + - Mac Plus 68k IWM orig ext Original + - Mac SE 68k IWM MacII ADB ext Original + - Mac Classic 68k SWIM MacII ADB ext Original + - Mac Portable 68k (16 MHz) SWIM ADB-PMU PMU 640x400 B&W + - PowerBook 100 68k (16 MHz) SWIM ADB-PMU PMU 640x400 B&W + - Mac II 020 IWM MacII ADB ext NuBus card + - Mac IIx 030 SWIM MacII ADB ext NuBus card + - Mac IIfx 030 SWIM IOP ADB ext NuBus card + - Mac SE/30 030 SWIM MacII ADB ext Internal fake NuBus card + - Mac IIcx 030 SWIM MacII ADB ext NuBus card + - Mac IIci 030 SWIM MacII ADB ext Internal "RBV" type + - Mac IIsi 030 SWIM Egret ADB n/a Internal "RBV" type + - PowerBook 140/145(B) 030 (16/25 MHz) SWIM ADB-PMU PMU 640x400 B&W (passive matrix) + - PowerBook 170 030 (25 MHz) SWIM ADB-PMU PMU 640x400 B&W (active matrix) + - Mac IIvx/IIvi 030 SWIM Egret ADB n/a Internal "VASP" type + - Mac LC 020 SWIM Egret ADB n/a Internal "V8" type + - Mac LC II 030 SWIM Egret ADB n/a Internal "V8" type + - Mac LC III 030 SWIM Egret ADB n/a Internal "Sonora" type + - Mac Classic II 030 SWIM Egret ADB n/a Internal "Eagle" type (V8 clone) + - Mac Color Classic 030 SWIM Cuda ADB n/a Internal "Spice" type (V8 clone) + - Mac Quadra 700 040 (25 MHz) SWIM II MacII ADB ext Internal "DAFB" type + - Mac Quadra 900 040 (33 MHz) SWIM II IOP ADB ext Internal "DAFB" type + + Notes: + - The Mac Plus boot code seems to check to see the extent of ROM + mirroring to determine if SCSI is available. If the ROM is mirrored, + then SCSI is not available. Thanks to R. Belmont for making this + discovery. + - On the SE and most later Macs, the first access to ROM turns off the overlay. + However, the Mac II/IIx/IIcx (and others?) have the old-style VIA overlay control bit! + - The Mac II can have either a 68551 PMMU fitted or an Apple custom that handles 24 vs. 32 + bit addressing mode. The ROM is *not* 32-bit clean so Mac OS normally runs in 24 bit mode, + but A/UX can run 32. + - There are 5 known kinds of host-side ADB hardware: + * "Mac II ADB" used in the SE, II, IIx, IIcx, SE/30, IIci, Quadra 610, Quadra 650, Quadra 700, + Quadra 800, Centris 610 and Centris 650. This is a bit-banger using the VIA and a simple PIC. + * "PMU ADB" used in the Mac Portable and all 680x0-based PowerBooks. + * "Egret ADB" used in the IIsi, IIvi, IIvx, Classic II, LC, LC II, LC III, Performa 460, + and Performa 600. This is a 68HC05 with a different internal ROM than CUDA. + * "IOP ADB" (ADB driven by a 6502 coprocessor, similar to Lisa) used in the IIfx, + Quadra 900, and Quadra 950. + * "Cuda ADB" (Apple's CUDA chip, which is a 68HC05 MCU) used in the Color Classic, LC 520, + LC 55x, LC 57x, LC 58x, Quadra 630, Quadra 660AV, Quadra 840AV, PowerMac 6100/7100/8100, + IIci, and PowerMac 5200. + + TODO: + - Call the RTC timer + + Egret version spotting: + 341S0850 - 0x???? (1.01, earlier) - LC, LC II + 341S0851 - 0x0101 (1.01, later) - Classic II, IIsi, IIvx/IIvi, LC III + 344S0100 - 0x0100 (1.00) - Some (early production?) IIsi + + Cuda version spotting: + 341S0262 - 0x0003f200 (3.02) - some PMac 6500, Bondi blue iMac + 341S0285 - No version (x.xx) - PMac 4400 + Mac clones ("Cuda Lite" with 768 bytes more ROM + PS/2 keyboard/mouse support) + 341S0060 - 0x00020028 (2.40) - Performa/Quadra 6xx, PMac 6200, x400, some x500, Pippin, "Gossamer" G3, others? + (verified found in PMac 5500-225, G3-333) + 341S0788 - 0x00020025 (2.37) - LC 475/575/Quadra 605, Quadra 660AV/840AV, PMac 7200 + 341S0417 - 0x00020023 (2.35) - Color Classic + + Caboose version spotting: + 341S0853 - 0x0100 (1.00) - Quadra 950 + + PG&E (68HC05 PMU) version spotting: + (find the text "BORG" in the system ROM, the next 32768 bytes are the PG&E image. + offset +4 in the image is the version byte). + 01 - PowerBook Duo 210/230/250 + 02 - PowerBook 540c, PBDuo 270C, PBDuo 280/280C + 03 - PowerBook 150 + 08 - PB190cs, PowerBook 540c PPC update, all PowerPC PowerBooks through WallStreet G3s + +****************************************************************************/ + +#include "emu.h" +#include "includes/mac.h" +#include "machine/applefdc.h" +#include "machine/sonydriv.h" +#include "debug/debugcpu.h" +#include "debugger.h" + +#define AUDIO_IS_CLASSIC (m_model <= MODEL_MAC_CLASSIC) +#define MAC_HAS_VIA2 ((m_model >= MODEL_MAC_II) && (m_model != MODEL_MAC_IIFX)) + +#define INTS_RBV ((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIVI)) || ((m_model >= MODEL_MAC_LC) && (m_model <= MODEL_MAC_LC_580)) + +#ifdef MAME_DEBUG +#define LOG_ADB 0 +#define LOG_VIA 0 +#define LOG_MAC_IWM 0 +#define LOG_GENERAL 0 +#define LOG_KEYBOARD 0 +#define LOG_MEMORY 0 +#else +#define LOG_ADB 0 +#define LOG_VIA 0 +#define LOG_MAC_IWM 0 +#define LOG_GENERAL 0 +#define LOG_KEYBOARD 0 +#define LOG_MEMORY 0 +#endif + +extern TIMER_CALLBACK(mac_adb_tick); // macadb.c +extern TIMER_CALLBACK(mac_pmu_tick); // macadb.c + +static offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); + +// returns non-zero if this Mac has ADB +int mac_state::has_adb() +{ + return m_model >= MODEL_MAC_SE; +} + +// handle disk enable lines +void mac_fdc_set_enable_lines(device_t *device, int enable_mask) +{ + mac_state *mac = device->machine().driver_data(); + + if (mac->m_model != MODEL_MAC_SE) + { + sony_set_enable_lines(device, enable_mask); + } + else + { + if (enable_mask) + { + sony_set_enable_lines(device, mac->m_drive_select ? 1 : 2); + } + else + { + sony_set_enable_lines(device, enable_mask); + } + } +} + +void mac_state::mac_install_memory(offs_t memory_begin, offs_t memory_end, + offs_t memory_size, void *memory_data, int is_rom, const char *bank) +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + offs_t memory_mask; + + memory_size = MIN(memory_size, (memory_end + 1 - memory_begin)); + memory_mask = memory_size - 1; + + if (!is_rom) + { + space.install_readwrite_bank(memory_begin, memory_end, memory_mask, 0, bank); + } + else + { + space.unmap_write(memory_begin, memory_end, memory_mask, 0); + space.install_read_bank(memory_begin, memory_end, memory_mask, 0, bank); + } + + membank(bank)->set_base(memory_data); + + if (LOG_MEMORY) + { + printf("mac_install_memory(): bank=%s range=[0x%06x...0x%06x] mask=0x%06x ptr=0x%p\n", + bank, memory_begin, memory_end, memory_mask, memory_data); + } +} + + + +/* + Interrupt handling +*/ + +void mac_state::field_interrupts() +{ + int take_interrupt = -1; + + if (m_model < MODEL_MAC_PORTABLE) + { + if ((m_scc_interrupt) || (m_scsi_interrupt)) + { + take_interrupt = 2; + } + else if (m_via_interrupt) + { + take_interrupt = 1; + } + } + else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100)) + { + if ((m_scc_interrupt) || (m_asc_interrupt)) + { + take_interrupt = 2; + } + else if (m_via_interrupt) + { + take_interrupt = 1; + } + } + else if ((m_model < MODEL_MAC_POWERMAC_6100) && (m_model != MODEL_MAC_IIFX)) + { + if (m_scc_interrupt) + { + take_interrupt = 4; + } + else if (m_via2_interrupt) + { + take_interrupt = 2; + } + else if (m_via_interrupt) + { + take_interrupt = 1; + } + } + else + { + return; // no interrupts for PowerPC yet + } + + if (m_last_taken_interrupt > -1) + { + m_maincpu->set_input_line(m_last_taken_interrupt, CLEAR_LINE); + m_last_taken_interrupt = -1; + } + + if (take_interrupt > -1) + { + m_maincpu->set_input_line(take_interrupt, ASSERT_LINE); + m_last_taken_interrupt = take_interrupt; + } +} + +WRITE_LINE_MEMBER(mac_state::set_scc_interrupt) +{ + m_scc_interrupt = state; + this->field_interrupts(); +} + +void mac_state::set_via_interrupt(int value) +{ + m_via_interrupt = value; + this->field_interrupts(); +} + + +void mac_state::set_via2_interrupt(int value) +{ + m_via2_interrupt = value; + this->field_interrupts(); +} + +WRITE_LINE_MEMBER(mac_state::mac_asc_irq) +{ + if (INTS_RBV) + { + if (state == ASSERT_LINE) + { + m_rbv_regs[3] |= 0x10; // any VIA 2 interrupt | sound interrupt + rbv_recalc_irqs(); + } + else + { + m_rbv_regs[3] &= ~0x10; + rbv_recalc_irqs(); + } + } + else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100)) + { +// m_asc_interrupt = state; +// field_interrupts(); + } + else if ((m_model >= MODEL_MAC_II) && (m_model != MODEL_MAC_IIFX)) + { + m_via2->write_cb1(state^1); + } +} + +WRITE16_MEMBER ( mac_state::mac_autovector_w ) +{ + if (LOG_GENERAL) + logerror("mac_autovector_w: offset=0x%08x data=0x%04x\n", offset, data); + + /* This should throw an exception */ + + /* Not yet implemented */ +} + +READ16_MEMBER ( mac_state::mac_autovector_r ) +{ + if (LOG_GENERAL) + logerror("mac_autovector_r: offset=0x%08x\n", offset); + + /* This should throw an exception */ + + /* Not yet implemented */ + return 0; +} + +void mac_state::set_scc_waitrequest(int waitrequest) +{ + if (LOG_GENERAL) + logerror("set_scc_waitrequest: waitrequest=%i\n", waitrequest); + + /* Not Yet Implemented */ +} + +void mac_state::v8_resize() +{ + offs_t memory_size; + UINT8 *memory_data; + int is_rom; + + is_rom = (m_overlay) ? 1 : 0; + + // get what memory we're going to map + if (is_rom) + { + /* ROM mirror */ + memory_size = memregion("bootrom")->bytes(); + memory_data = memregion("bootrom")->base(); + is_rom = TRUE; + } + else + { + /* RAM */ + memory_size = m_ram->size(); + memory_data = m_ram->pointer(); + is_rom = FALSE; + } + +// printf("mac_v8_resize: memory_size = %x, ctrl bits %02x (overlay %d = %s)\n", memory_size, m_rbv_regs[1] & 0xe0, m_overlay, is_rom ? "ROM" : "RAM"); + + if (is_rom) + { + mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + } + else + { + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT32 onboard_amt, simm_amt, simm_size; + static const UINT32 simm_sizes[4] = { 0, 2*1024*1024, 4*1024*1024, 8*1024*1024 }; + + // force unmap of entire RAM region + space.unmap_write(0, 0x9fffff, 0x9fffff, 0); + + // LC and Classic II have 2 MB built-in, all other V8-style machines have 4 MB + // we reserve the first 2 or 4 MB of mess_ram for the onboard, + // RAM above that mark is the SIMM + onboard_amt = ((m_model == MODEL_MAC_LC) || (m_model == MODEL_MAC_CLASSIC_II)) ? 2*1024*1024 : 4*1024*1024; + simm_amt = (m_rbv_regs[1]>>6) & 3; // size of SIMM RAM window + simm_size = memory_size - onboard_amt; // actual amount of RAM available for SIMMs + + // installing SIMM RAM? + if (simm_amt != 0) + { +// printf("mac_v8_resize: SIMM region size is %x, SIMM size is %x, onboard size is %x\n", simm_sizes[simm_amt], simm_size, onboard_amt); + + if ((simm_amt > 0) && (simm_size > 0)) + { +// mac_install_memory(0x000000, simm_sizes[simm_amt]-1, simm_sizes[simm_amt], memory_data + onboard_amt, is_rom, "bank1"); + mac_install_memory(0x000000, simm_size-1, simm_size, memory_data + onboard_amt, is_rom, "bank1"); + } + + // onboard RAM sits immediately above the SIMM, if any + if (simm_sizes[simm_amt] + onboard_amt <= 0x800000) + { + mac_install_memory(simm_sizes[simm_amt], simm_sizes[simm_amt] + onboard_amt - 1, onboard_amt, memory_data, is_rom, "bank2"); + } + + // a mirror of the first 2 MB of on board RAM always lives at 0x800000 + mac_install_memory(0x800000, 0x9fffff, 0x200000, memory_data, is_rom, "bank3"); + } + else + { +// printf("mac_v8_resize: SIMM off, mobo RAM at 0 and top\n"); + + mac_install_memory(0x000000, onboard_amt-1, onboard_amt, memory_data, is_rom, "bank1"); + mac_install_memory(0x900000, 0x9fffff, 0x200000, memory_data+0x100000, is_rom, "bank3"); + } + } +} + +void mac_state::set_memory_overlay(int overlay) +{ + offs_t memory_size; + UINT8 *memory_data; + int is_rom; + + /* normalize overlay */ + overlay = overlay ? TRUE : FALSE; + + if (overlay != m_overlay) + { + /* set up either main RAM area or ROM mirror at 0x000000-0x3fffff */ + if (overlay) + { + /* ROM mirror */ + memory_size = memregion("bootrom")->bytes(); + memory_data = memregion("bootrom")->base(); + is_rom = TRUE; + } + else + { + /* RAM */ + memory_size = m_ram->size(); + memory_data = m_ram->pointer(); + is_rom = FALSE; + } + + /* install the memory */ + if (((m_model >= MODEL_MAC_LC) && (m_model <= MODEL_MAC_COLOR_CLASSIC) && ((m_model != MODEL_MAC_LC_III) && (m_model != MODEL_MAC_LC_III_PLUS))) || (m_model == MODEL_MAC_CLASSIC_II)) + { + m_overlay = overlay; + v8_resize(); + } + else if ((m_model == MODEL_MAC_IICI) || (m_model == MODEL_MAC_IISI)) + { + // ROM is OK to flood to 3fffffff + if (is_rom) + { + mac_install_memory(0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1"); + } + else // RAM: be careful not to populate ram B with a mirror or the ROM will get confused + { + mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + } + } + else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100) || (m_model == MODEL_MAC_IIVX) || (m_model == MODEL_MAC_IIFX)) + { + address_space& space = m_maincpu->space(AS_PROGRAM); + space.unmap_write(0x000000, 0x9fffff, 0x9fffff, 0); + mac_install_memory(0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + } + else if ((m_model == MODEL_MAC_PB140) || (m_model == MODEL_MAC_PB160) || ((m_model >= MODEL_MAC_PBDUO_210) && (m_model <= MODEL_MAC_PBDUO_270c))) + { + address_space& space = m_maincpu->space(AS_PROGRAM); + space.unmap_write(0x000000, 0xffffff, 0xffffff, 0); + mac_install_memory(0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + } + else if ((m_model >= MODEL_MAC_II) && (m_model <= MODEL_MAC_SE30)) + { + mac_install_memory(0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1"); + } + else if ((m_model == MODEL_MAC_LC_III) || (m_model == MODEL_MAC_LC_III_PLUS) || (m_model >= MODEL_MAC_LC_475 && m_model <= MODEL_MAC_LC_580)) // up to 36 MB + { + mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + } + else if (m_model == MODEL_MAC_QUADRA_700) + { + mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + } + else + { + mac_install_memory(0x00000000, 0x003fffff, memory_size, memory_data, is_rom, "bank1"); + } + + m_overlay = overlay; + + if (LOG_GENERAL) + logerror("mac_set_memory_overlay: overlay=%i\n", overlay); + } +} + + + +/* + R Nabet 000531 : added keyboard code +*/ + +/* ************************************************************************* + * non-ADB keyboard support + * + * The keyboard uses a i8021 (?) microcontroller. + * It uses a bidirectional synchonous serial line, connected to the VIA (SR feature) + * + * Our emulation is more a hack than anything else - the keyboard controller is + * not emulated, instead we interpret keyboard commands directly. I made + * many guesses, which may be wrong + * + * todo : + * * find the correct model number for the Mac Plus keyboard ? + * * emulate original Macintosh keyboards (2 layouts : US and international) + * + * references : + * * IM III-29 through III-32 and III-39 through III-42 + * * IM IV-250 + * *************************************************************************/ + +/* + scan_keyboard() + + scan the keyboard, and returns key transition code (or NULL ($7B) if none) +*/ +#ifndef MAC_USE_EMULATED_KBD +int mac_state::scan_keyboard() +{ + int i, j; + int keybuf = 0; + int keycode; + ioport_port *ports[7] = { m_key0, m_key1, m_key2, m_key3, m_key4, m_key5, m_key6 }; + + if (m_keycode_buf_index) + { + return m_keycode_buf[--m_keycode_buf_index]; + } + + for (i=0; i<7; i++) + { + keybuf = ports[i]->read(); + + if (keybuf != m_key_matrix[i]) + { + /* if state has changed, find first bit which has changed */ + if (LOG_KEYBOARD) + logerror("keyboard state changed, %d %X\n", i, keybuf); + + for (j=0; j<16; j++) + { + if (((keybuf ^ m_key_matrix[i]) >> j) & 1) + { + /* update m_key_matrix */ + m_key_matrix[i] = (m_key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j)); + + if (i < 4) + { + /* create key code */ + keycode = (i << 5) | (j << 1) | 0x01; + if (! (keybuf & (1 << j))) + { + /* key up */ + keycode |= 0x80; + } + return keycode; + } + else if (i < 6) + { + /* create key code */ + keycode = ((i & 3) << 5) | (j << 1) | 0x01; + + if ((keycode == 0x05) || (keycode == 0x0d) || (keycode == 0x11) || (keycode == 0x1b)) + { + /* these keys cause shift to be pressed (for compatibility with mac 128/512) */ + if (keybuf & (1 << j)) + { + /* key down */ + if (! (m_key_matrix[3] & 0x0100)) + { + /* shift key is really up */ + m_keycode_buf[0] = keycode; + m_keycode_buf[1] = 0x79; + m_keycode_buf_index = 2; + return 0x71; /* "presses" shift down */ + } + } + else + { /* key up */ + if (! (m_key_matrix[3] & 0x0100)) + { + /* shift key is really up */ + m_keycode_buf[0] = keycode | 0x80; + m_keycode_buf[1] = 0x79; + m_keycode_buf_index = 2; + return 0xF1; /* "releases" shift */ + } + } + } + + if (! (keybuf & (1 << j))) + { + /* key up */ + keycode |= 0x80; + } + m_keycode_buf[0] = keycode; + m_keycode_buf_index = 1; + return 0x79; + } + else /* i == 6 */ + { + /* create key code */ + keycode = (j << 1) | 0x01; + if (! (keybuf & (1 << j))) + { + /* key up */ + keycode |= 0x80; + } + m_keycode_buf[0] = keycode; + m_keycode_buf_index = 1; + return 0x79; + } + } + } + } + } + + return 0x7B; /* return NULL */ +} + +/* + power-up init +*/ +void mac_state::keyboard_init() +{ + int i; + + /* init flag */ + m_kbd_comm = FALSE; + m_kbd_receive = FALSE; + m_kbd_shift_reg=0; + m_kbd_shift_count=0; + + /* clear key matrix */ + for (i=0; i<7; i++) + { + m_key_matrix[i] = 0; + } + + /* purge transmission buffer */ + m_keycode_buf_index = 0; +} +#endif + +/******************* Keyboard <-> VIA communication ***********************/ + +#ifdef MAC_USE_EMULATED_KBD + +WRITE_LINE_MEMBER(mac_state::mac_kbd_clk_in) +{ + printf("CLK: %d\n", state^1); + m_via1->write_cb1(state ? 0 : 1); +} + +WRITE_LINE_MEMBER(mac_state::mac_via_out_cb2) +{ + printf("Sending %d to kbd (PC=%x)\n", data, m_maincpu->pc()); + m_mackbd->data_w((data & 1) ? ASSERT_LINE : CLEAR_LINE); +} + +#else // keyboard HLE + +TIMER_CALLBACK_MEMBER(mac_state::kbd_clock) +{ + int i; + + if (m_kbd_comm == TRUE) + { + for (i=0; i<8; i++) + { + /* Put data on CB2 if we are sending*/ + if (m_kbd_receive == FALSE) + m_via1->write_cb2(m_kbd_shift_reg&0x80?1:0); + m_kbd_shift_reg <<= 1; + m_via1->write_cb1(0); + m_via1->write_cb1(1); + } + if (m_kbd_receive == TRUE) + { + m_kbd_receive = FALSE; + /* Process the command received from mac */ + keyboard_receive(m_kbd_shift_reg & 0xff); + } + else + { + /* Communication is over */ + m_kbd_comm = FALSE; + } + } +} + +void mac_state::kbd_shift_out(int data) +{ + if (m_kbd_comm == TRUE) + { + m_kbd_shift_reg = data; + machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(mac_state::kbd_clock),this)); + } +} + +WRITE_LINE_MEMBER(mac_state::mac_via_out_cb2) +{ + if (m_kbd_comm == FALSE && state == 0) + { + /* Mac pulls CB2 down to initiate communication */ + m_kbd_comm = TRUE; + m_kbd_receive = TRUE; + machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(mac_state::kbd_clock),this)); + } + if (m_kbd_comm == TRUE && m_kbd_receive == TRUE) + { + /* Shift in what mac is sending */ + m_kbd_shift_reg = (m_kbd_shift_reg & ~1) | state; + } +} + +/* + called when inquiry times out (1/4s) +*/ +TIMER_CALLBACK_MEMBER(mac_state::inquiry_timeout_func) +{ + if (LOG_KEYBOARD) + logerror("keyboard enquiry timeout\n"); + kbd_shift_out(0x7B); /* always send NULL */ +} + +/* + called when a command is received from the mac +*/ +void mac_state::keyboard_receive(int val) +{ + switch (val) + { + case 0x10: + /* inquiry - returns key transition code, or NULL ($7B) if time out (1/4s) */ + if (LOG_KEYBOARD) + logerror("keyboard command : inquiry\n"); + + m_inquiry_timeout->adjust( + attotime(0, DOUBLE_TO_ATTOSECONDS(0.25)), 0); + break; + + case 0x14: + /* instant - returns key transition code, or NULL ($7B) */ + if (LOG_KEYBOARD) + logerror("keyboard command : instant\n"); + + kbd_shift_out(scan_keyboard()); + break; + + case 0x16: + /* model number - resets keyboard, return model number */ + if (LOG_KEYBOARD) + logerror("keyboard command : model number\n"); + + { /* reset */ + int i; + + /* clear key matrix */ + for (i=0; i<7; i++) + { + m_key_matrix[i] = 0; + } + + /* purge transmission buffer */ + m_keycode_buf_index = 0; + } + + /* format : 1 if another device (-> keypad ?) connected | next device (-> keypad ?) number 1-8 + | keyboard model number 1-8 | 1 */ + /* keyboards : + 3 : mac 512k, US and international layout ? Mac plus ??? + other values : Apple II keyboards ? + */ + /* keypads : + ??? : standard keypad (always available on Mac Plus) ??? + */ + kbd_shift_out(0x17); /* probably wrong */ + break; + + case 0x36: + /* test - resets keyboard, return ACK ($7D) or NAK ($77) */ + if (LOG_KEYBOARD) + logerror("keyboard command : test\n"); + + kbd_shift_out(0x7D); /* ACK */ + break; + + default: + if (LOG_KEYBOARD) + logerror("unknown keyboard command 0x%X\n", val); + + kbd_shift_out(0); + break; + } +} +#endif + +/* ************************************************************************* + * Mouse + * *************************************************************************/ + +void mac_state::mouse_callback() +{ + int new_mx, new_my; + int x_needs_update = 0, y_needs_update = 0; + + new_mx = m_mouse1->read(); + new_my = m_mouse2->read(); + + /* see if it moved in the x coord */ + if (new_mx != last_mx) + { + int diff = new_mx - last_mx; + + /* check for wrap */ + if (diff > 0x80) + diff = 0x100-diff; + if (diff < -0x80) + diff = -0x100-diff; + + count_x += diff; + + last_mx = new_mx; + } + /* see if it moved in the y coord */ + if (new_my != last_my) + { + int diff = new_my - last_my; + + /* check for wrap */ + if (diff > 0x80) + diff = 0x100-diff; + if (diff < -0x80) + diff = -0x100-diff; + + count_y += diff; + + last_my = new_my; + } + + /* update any remaining count and then return */ + if (count_x) + { + if (count_x < 0) + { + count_x++; + m_mouse_bit_x = 0; + x_needs_update = 2; + } + else + { + count_x--; + m_mouse_bit_x = 1; + x_needs_update = 1; + } + } + else if (count_y) + { + if (count_y < 0) + { + count_y++; + m_mouse_bit_y = 1; + y_needs_update = 1; + } + else + { + count_y--; + m_mouse_bit_y = 0; + y_needs_update = 2; + } + } + + if (x_needs_update || y_needs_update) + /* assert Port B External Interrupt on the SCC */ + scc_mouse_irq(x_needs_update, y_needs_update ); +} + +/* ************************************************************************* + * SCSI + * *************************************************************************/ + +/* + +From http://www.mac.m68k-linux.org/devel/plushw.php + +The address of each register is computed as follows: + + $580drn + + where r represents the register number (from 0 through 7), + n determines whether it a read or write operation + (0 for reads, or 1 for writes), and + d determines whether the DACK signal to the NCR 5380 is asserted. + (0 for not asserted, 1 is for asserted) + +Here's an example of the address expressed in binary: + + 0101 1000 0000 00d0 0rrr 000n + +Note: Asserting the DACK signal applies only to write operations to + the output data register and read operations from the input + data register. + + Symbolic Memory + Location Location NCR 5380 Internal Register + + scsiWr+sODR+dackWr $580201 Output Data Register with DACK + scsiWr+sODR $580001 Output Data Register + scsiWr+sICR $580011 Initiator Command Register + scsiWr+sMR $580021 Mode Register + scsiWr+sTCR $580031 Target Command Register + scsiWr+sSER $580041 Select Enable Register + scsiWr+sDMAtx $580051 Start DMA Send + scsiWr+sTDMArx $580061 Start DMA Target Receive + scsiWr+sIDMArx $580071 Start DMA Initiator Receive + + scsiRd+sIDR+dackRd $580260 Current SCSI Data with DACK + scsiRd+sCDR $580000 Current SCSI Data + scsiRd+sICR $580010 Initiator Command Register + scsiRd+sMR $580020 Mode Registor + scsiRd+sTCR $580030 Target Command Register + scsiRd+sCSR $580040 Current SCSI Bus Status + scsiRd+sBSR $580050 Bus and Status Register + scsiRd+sIDR $580060 Input Data Register + scsiRd+sRESET $580070 Reset Parity/Interrupt + */ + +READ16_MEMBER ( mac_state::macplus_scsi_r ) +{ + int reg = (offset>>3) & 0xf; + +// logerror("macplus_scsi_r: offset %x mask %x\n", offset, mem_mask); + + if ((reg == 6) && (offset == 0x130)) + { + reg = R5380_CURDATA_DTACK; + } + + return m_ncr5380->ncr5380_read_reg(reg)<<8; +} + +READ32_MEMBER (mac_state::macii_scsi_drq_r) +{ + switch (mem_mask) + { + case 0xff000000: + return m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<24; + + case 0xffff0000: + return (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<24) | (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<16); + + case 0xffffffff: + return (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<24) | (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<16) | (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<8) | m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK); + + default: + logerror("macii_scsi_drq_r: unknown mem_mask %08x\n", mem_mask); + } + + return 0; +} + +WRITE32_MEMBER (mac_state::macii_scsi_drq_w) +{ + switch (mem_mask) + { + case 0xff000000: + m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>24); + break; + + case 0xffff0000: + m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>24); + m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>16); + break; + + case 0xffffffff: + m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>24); + m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>16); + m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>8); + m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data&0xff); + break; + + default: + logerror("macii_scsi_drq_w: unknown mem_mask %08x\n", mem_mask); + break; + } +} + +WRITE16_MEMBER ( mac_state::macplus_scsi_w ) +{ + int reg = (offset>>3) & 0xf; + +// logerror("macplus_scsi_w: data %x offset %x mask %x\n", data, offset, mem_mask); + + if ((reg == 0) && (offset == 0x100)) + { + reg = R5380_OUTDATA_DTACK; + } + + m_ncr5380->ncr5380_write_reg(reg, data); +} + +WRITE16_MEMBER ( mac_state::macii_scsi_w ) +{ + int reg = (offset>>3) & 0xf; + +// logerror("macplus_scsi_w: data %x offset %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); + + if ((reg == 0) && (offset == 0x100)) + { + reg = R5380_OUTDATA_DTACK; + } + + m_ncr5380->ncr5380_write_reg(reg, data>>8); +} + +WRITE_LINE_MEMBER(mac_state::mac_scsi_irq) +{ +/* mac_state *mac = machine.driver_data(); + + if ((mac->m_scsiirq_enable) && ((mac->m_model == MODEL_MAC_SE) || (mac->m_model == MODEL_MAC_CLASSIC))) + { + mac->m_scsi_interrupt = state; + mac->field_interrupts(); + }*/ +} + +WRITE_LINE_MEMBER(mac_state::irq_539x_1_w) +{ + if (state) // make sure a CB1 transition occurs + { + m_via2->write_cb2(0); + m_via2->write_cb2(1); + } +} + +WRITE_LINE_MEMBER(mac_state::drq_539x_1_w) +{ + m_dafb_scsi1_drq = state; +} + +/* ************************************************************************* + * SCC + * + * Serial Communications Controller + * *************************************************************************/ + +void mac_state::scc_mouse_irq(int x, int y) +{ + scc8530_t *scc = machine().device("scc"); + static int lasty = 0; + static int lastx = 0; + + if (x && y) + { + if (m_last_was_x) { + scc->set_status(0x0a); + if(x == 2) { + if(lastx) { + scc->set_reg_a(0, 0x04); + m_mouse_bit_x = 0; + } else { + scc->set_reg_a(0, 0x0C); + m_mouse_bit_x = 1; + } + } else { + if(lastx) { + scc->set_reg_a(0, 0x04); + m_mouse_bit_x = 1; + } else { + scc->set_reg_a(0, 0x0C); + m_mouse_bit_x = 0; + } + } + lastx = !lastx; + } else { + scc->set_status(0x02); + if(y == 2) { + if(lasty) { + scc->set_reg_b(0, 0x04); + m_mouse_bit_y = 0; + } else { + scc->set_reg_b(0, 0x0C); + m_mouse_bit_y = 1; + } + } else { + if(lasty) { + scc->set_reg_b(0, 0x04); + m_mouse_bit_y = 1; + } else { + scc->set_reg_b(0, 0x0C); + m_mouse_bit_y = 0; + } + } + lasty = !lasty; + } + + m_last_was_x ^= 1; + } + else + { + if (x) { + scc->set_status(0x0a); + if(x == 2) { + if(lastx) { + scc->set_reg_a(0, 0x04); + m_mouse_bit_x = 0; + } else { + scc->set_reg_a(0, 0x0C); + m_mouse_bit_x = 1; + } + } else { + if(lastx) { + scc->set_reg_a(0, 0x04); + m_mouse_bit_x = 1; + } else { + scc->set_reg_a(0, 0x0C); + m_mouse_bit_x = 0; + } + } + lastx = !lastx; + } else { + scc->set_status(0x02); + if(y == 2) { + if(lasty) { + scc->set_reg_b(0, 0x04); + m_mouse_bit_y = 0; + } else { + scc->set_reg_b(0, 0x0C); + m_mouse_bit_y = 1; + } + } else { + if(lasty) { + scc->set_reg_b(0, 0x04); + m_mouse_bit_y = 1; + } else { + scc->set_reg_b(0, 0x0C); + m_mouse_bit_y = 0; + } + } + lasty = !lasty; + } + } + + this->set_scc_interrupt(1); +} + + + +READ16_MEMBER ( mac_state::mac_scc_r ) +{ + scc8530_t *scc = space.machine().device("scc"); + UINT16 result; + + result = scc->reg_r(space, offset); + return (result << 8) | result; +} + + + +WRITE16_MEMBER ( mac_state::mac_scc_w ) +{ + scc8530_t *scc = space.machine().device("scc"); + scc->reg_w(space, offset, data); +} + +WRITE16_MEMBER ( mac_state::mac_scc_2_w ) +{ + scc8530_t *scc = space.machine().device("scc"); + scc->reg_w(space, offset, data >> 8); +} + +/* ********************************** * + * IWM Code specific to the Mac Plus * + * ********************************** */ + +READ16_MEMBER ( mac_state::mac_iwm_r ) +{ + /* The first time this is called is in a floppy test, which goes from + * $400104 to $400126. After that, all access to the floppy goes through + * the disk driver in the MacOS + * + * I just thought this would be on interest to someone trying to further + * this driver along + */ + + UINT16 result = 0; + applefdc_base_device *fdc = space.machine().device("fdc"); + + result = fdc->read(offset >> 8); + + if (LOG_MAC_IWM) + printf("mac_iwm_r: offset=0x%08x mem_mask %04x = %02x (PC %x)\n", offset, mem_mask, result, space.device().safe_pc()); + + return (result << 8) | result; +} + +WRITE16_MEMBER ( mac_state::mac_iwm_w ) +{ + applefdc_base_device *fdc = space.machine().device("fdc"); + + if (LOG_MAC_IWM) + printf("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, space.device().safe_pc()); + + if (ACCESSING_BITS_0_7) + fdc->write((offset >> 8), data & 0xff); + else + fdc->write((offset >> 8), data>>8); +} + +WRITE_LINE_MEMBER(mac_state::mac_adb_via_out_cb2) +{ +// printf("VIA OUT CB2 = %x\n", state); + if (ADB_IS_EGRET) + { + m_egret->set_via_data(state & 1); + } + else if (ADB_IS_CUDA) + { + m_cuda->set_via_data(state & 1); + } + else + { + if (state) + m_adb_command |= 1; + else + m_adb_command &= ~1; + } +} + +/* ************************************************************************* + * VIA + * ************************************************************************* + * + * + * PORT A + * + * bit 7 R SCC Wait/Request + * bit 6 W Main/Alternate screen buffer select + * bit 5 W Floppy Disk Line Selection + * bit 4 W Overlay/Normal memory mapping + * bit 3 W Main/Alternate sound buffer + * bit 2-0 W Sound Volume + * + * + * PORT B + * + * bit 7 W Sound enable + * bit 6 R Video beam in display + * bit 5 (pre-ADB) R Mouse Y2 + * (ADB) W ADB ST1 + * bit 4 (pre-ADB) R Mouse X2 + * (ADB) W ADB ST0 + * bit 3 (pre-ADB) R Mouse button (active low) + * (ADB) R ADB INT + * bit 2 W Real time clock enable + * bit 1 W Real time clock data clock + * bit 0 RW Real time clock data + * + */ + +#define PA6 0x40 +#define PA4 0x10 +#define PA2 0x04 +#define PA1 0x02 + +READ8_MEMBER(mac_state::mac_via_in_a) +{ +// printf("VIA1 IN_A (PC %x)\n", m_maincpu->safe_pc()); + + switch (m_model) + { + case MODEL_MAC_CLASSIC: + case MODEL_MAC_II: + case MODEL_MAC_II_FDHD: + case MODEL_MAC_IIX: + case MODEL_MAC_POWERMAC_6100: + case MODEL_MAC_POWERMAC_7100: + case MODEL_MAC_POWERMAC_8100: + return 0x81; // bit 0 must be set on most Macs to avoid attempting to boot from AppleTalk + + case MODEL_MAC_SE30: + return 0x81 | PA6; + + case MODEL_MAC_LC: + case MODEL_MAC_LC_II: + case MODEL_MAC_IIVX: + return 0x81 | PA6 | PA4 | PA2; + + case MODEL_MAC_IICI: + return 0x81 | PA6 | PA2 | PA1; + + case MODEL_MAC_IISI: + return 0x81 | PA4 | PA2 | PA1; + + case MODEL_MAC_IIFX: + return 0x81 | PA6 | PA4 | PA1; + + case MODEL_MAC_IICX: + return 0x81 | PA6; + + case MODEL_MAC_PB140: // since the ASICs are different, these are allowed to "collide" + case MODEL_MAC_PB160: + case MODEL_MAC_CLASSIC_II: + case MODEL_MAC_QUADRA_800: + return 0x81 | PA4 | PA1; + + case MODEL_MAC_QUADRA_700: + return 0x81 | PA6; + + case MODEL_MAC_QUADRA_900: + return 0x81 | PA6 | PA4; + + case MODEL_MAC_COLOR_CLASSIC: + return 0x81 | PA1; + + default: + return 0x80; + } +} + +READ8_MEMBER(mac_state::mac_via_in_a_pmu) +{ +// printf("VIA1 IN_A (PC %x)\n", m_maincpu->safe_pc()); + + #if LOG_ADB +// printf("Read PM data %x\n", m_pm_data_recv); + #endif + return m_pm_data_recv; +} + +READ8_MEMBER(mac_state::mac_via_in_b) +{ + int val = 0; + /* video beam in display (! VBLANK && ! HBLANK basically) */ + if (machine().first_screen()) + { + if (machine().first_screen()->vpos() >= MAC_V_VIS) + val |= 0x40; + } + + if (ADB_IS_BITBANG_CLASS) + { + val |= m_adb_state<<4; + + if (!m_adb_irq_pending) + { + val |= 0x08; + } + + val |= m_rtc->data_r(); + } + else if (ADB_IS_EGRET) + { + val |= m_egret->get_xcvr_session()<<3; + } + else if (ADB_IS_CUDA) + { + val |= m_cuda->get_treq()<<3; + } + else + { + if (m_mouse_bit_y) /* Mouse Y2 */ + val |= 0x20; + if (m_mouse_bit_x) /* Mouse X2 */ + val |= 0x10; + if ((m_mouse0->read() & 0x01) == 0) + val |= 0x08; + + val |= m_rtc->data_r(); + } + +// printf("VIA1 IN_B = %02x (PC %x)\n", val, m_maincpu->safe_pc()); + + return val; +} + +READ8_MEMBER(mac_state::mac_via_in_b_via2pmu) +{ + int val = 0; + // TODO: is this valid for VIA2 PMU machines? + /* video beam in display (! VBLANK && ! HBLANK basically) */ + if (machine().first_screen()) + { + if (machine().first_screen()->vpos() >= MAC_V_VIS) + val |= 0x40; + } + +// printf("VIA1 IN_B = %02x (PC %x)\n", val, m_maincpu->safe_pc()); + + return val; +} + +READ8_MEMBER(mac_state::mac_via_in_b_pmu) +{ + int val = 0; +// printf("Read VIA B: PM_ACK %x\n", m_pm_ack); + val = 0x80 | 0x04 | m_pm_ack; // SCC wait/request (bit 2 must be set at 900c1a or startup tests always fail) + +// printf("VIA1 IN_B = %02x (PC %x)\n", val, m_maincpu->safe_pc()); + + return val; +} + +WRITE8_MEMBER(mac_state::mac_via_out_a) +{ + mac_sound_device *sound = machine().device("custom"); + device_t *fdc = machine().device("fdc"); +// printf("VIA1 OUT A: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + + set_scc_waitrequest((data & 0x80) >> 7); + m_screen_buffer = (data & 0x40) >> 6; + sony_set_sel_line(fdc,(data & 0x20) >> 5); + if (m_model == MODEL_MAC_SE) // on SE this selects which floppy drive (0 = upper, 1 = lower) + { + m_drive_select = ((data & 0x10) >> 4); + } + + if (m_model < MODEL_MAC_SE) // SE no longer has dual buffers + { + sound->set_sound_buffer((data & 0x08) >> 3); + } + + if (m_model < MODEL_MAC_II) + { + sound->set_volume(data & 0x07); + } + + /* Early Mac models had VIA A4 control overlaying. In the Mac SE (and + * possibly later models), overlay was set on reset, but cleared on the + * first access to the ROM. */ + if (m_model < MODEL_MAC_SE) + { + set_memory_overlay((data & 0x10) >> 4); + } +} + +WRITE8_MEMBER(mac_state::mac_via_out_a_pmu) +{ +// printf("VIA1 OUT A: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + + #if LOG_ADB +// printf("%02x to PM\n", data); + #endif + m_pm_data_send = data; + return; +} + +WRITE8_MEMBER(mac_state::mac_via_out_b) +{ + mac_sound_device *sound = machine().device("custom"); +// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + + if (AUDIO_IS_CLASSIC) + { + sound->enable_sound((data & 0x80) == 0); + } + + m_rtc->ce_w((data & 0x04)>>2); + m_rtc->data_w(data & 0x01); + m_rtc->clk_w((data >> 1) & 0x01); +} + +WRITE8_MEMBER(mac_state::mac_via_out_b_bbadb) +{ +// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + + // SE and Classic have SCSI enable/disable here + if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC)) + { + m_scsiirq_enable = (data & 0x40) ? 0 : 1; +// printf("VIAB & 0x40 = %02x, IRQ enable %d\n", data & 0x40, m_scsiirq_enable); + } + + if (m_model == MODEL_MAC_SE30) + { + // 0x40 = 0 means enable vblank on SE/30 + m_se30_vbl_enable = (data & 0x40) ? 0 : 1; + + // clear the interrupt if we disabled it + if (!m_se30_vbl_enable) + { + nubus_slot_interrupt(0xe, 0); + } + } + + mac_adb_newaction((data & 0x30) >> 4); + + m_rtc->ce_w((data & 0x04)>>2); + m_rtc->data_w(data & 0x01); + m_rtc->clk_w((data >> 1) & 0x01); +} + +WRITE8_MEMBER(mac_state::mac_via_out_b_egadb) +{ +// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + + #if LOG_ADB + printf("68K: New Egret state: SS %d VF %d (PC %x)\n", (data>>5)&1, (data>>4)&1, space.device().safe_pc()); + #endif + m_egret->set_via_full((data&0x10) ? 1 : 0); + m_egret->set_sys_session((data&0x20) ? 1 : 0); +} + +WRITE8_MEMBER(mac_state::mac_via_out_b_cdadb) +{ +// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + + #if LOG_ADB + printf("68K: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, space.device().safe_pc()); + #endif + m_cuda->set_byteack((data&0x10) ? 1 : 0); + m_cuda->set_tip((data&0x20) ? 1 : 0); +} + +WRITE8_MEMBER(mac_state::mac_via_out_b_via2pmu) +{ +// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); +} + +WRITE8_MEMBER(mac_state::mac_via_out_b_pmu) +{ +// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + + device_t *fdc = machine().device("fdc"); + + sony_set_sel_line(fdc,(data & 0x20) >> 5); + m_drive_select = ((data & 0x10) >> 4); + + if ((data & 1) && !(m_pm_req & 1)) + { + #if LOG_ADB + printf("PM: 68k dropping /REQ\n"); + #endif + + if (m_pm_state == 0) // do this in receive state only + { + m_pm_data_recv = 0xff; + m_pm_ack |= 2; + + // check if length byte matches + if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2))) + { + pmu_exec(); + #if LOG_ADB + printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]); + #endif + } + } + } + else if (!(data & 1) && (m_pm_req & 1)) + { + if (m_pm_state == 0) + { + #if LOG_ADB + printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send); + #endif + m_pm_ack &= ~2; // clear, we're waiting for more bytes + m_pm_cmd[m_pm_dptr++] = m_pm_data_send; + } + else // receiving, so this is different + { + m_pm_data_recv = m_pm_out[m_pm_sptr++]; + m_pm_slen--; + m_pm_ack |= 2; // raise ACK to indicate available byte + #if LOG_ADB + printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv); + #endif + + // another byte to send? + if (m_pm_slen) + { + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + } + else + { + m_pm_state = 0; // back to receive state + m_pmu_send_timer->adjust(attotime::never); + } + } + } + + m_pm_req = data & 1; +} + +WRITE_LINE_MEMBER(mac_state::mac_via_irq) +{ + /* interrupt the 68k (level 1) */ + set_via_interrupt(state); +} + +READ16_MEMBER ( mac_state::mac_via_r ) +{ + UINT16 data; + + offset >>= 8; + offset &= 0x0f; + + if (LOG_VIA) + logerror("mac_via_r: offset=0x%02x\n", offset); + data = m_via1->read(space, offset); + + m_maincpu->adjust_icount(m_via_cycles); + + return (data & 0xff) | (data << 8); +} + +WRITE16_MEMBER ( mac_state::mac_via_w ) +{ + offset >>= 8; + offset &= 0x0f; + + if (LOG_VIA) + logerror("mac_via_w: offset=0x%02x data=0x%08x\n", offset, data); + + if (ACCESSING_BITS_0_7) + m_via1->write(space, offset, data & 0xff); + if (ACCESSING_BITS_8_15) + m_via1->write(space, offset, (data >> 8) & 0xff); + + m_maincpu->adjust_icount(m_via_cycles); +} + +/* ************************************************************************* + * VIA 2 (on Mac IIs, PowerBooks > 100, and PowerMacs) + * *************************************************************************/ + +WRITE_LINE_MEMBER(mac_state::mac_via2_irq) +{ + set_via2_interrupt(state); +} + +READ16_MEMBER ( mac_state::mac_via2_r ) +{ + int data; + + offset >>= 8; + offset &= 0x0f; + + data = m_via2->read(space, offset); + + if (LOG_VIA) + logerror("mac_via2_r: offset=0x%02x = %02x (PC=%x)\n", offset*2, data, space.device().safe_pc()); + + return (data & 0xff) | (data << 8); +} + +WRITE16_MEMBER ( mac_state::mac_via2_w ) +{ + offset >>= 8; + offset &= 0x0f; + + if (LOG_VIA) + logerror("mac_via2_w: offset=%x data=0x%08x mask=%x (PC=%x)\n", offset, data, mem_mask, space.device().safe_pc()); + + if (ACCESSING_BITS_0_7) + m_via2->write(space, offset, data & 0xff); + if (ACCESSING_BITS_8_15) + m_via2->write(space, offset, (data >> 8) & 0xff); +} + + +READ8_MEMBER(mac_state::mac_via2_in_a) +{ + UINT8 result; + + if ((m_model == MODEL_MAC_QUADRA_700) || (m_model == MODEL_MAC_QUADRA_900) || (m_model == MODEL_MAC_QUADRA_950)) + { + result = 0x80 | m_nubus_irq_state; + } + else + { + result = 0xc0 | m_nubus_irq_state; + } + + return result; +} + +READ8_MEMBER(mac_state::mac_via2_in_a_pmu) +{ + return m_pm_data_recv; +} + +READ8_MEMBER(mac_state::mac_via2_in_b) +{ +// logerror("VIA2 IN B (PC %x)\n", m_maincpu->safe_pc()); + + if ((m_model == MODEL_MAC_LC) || (m_model == MODEL_MAC_LC_II) || (m_model == MODEL_MAC_CLASSIC_II)) + { + return 0x4f; + } + + if ((m_model == MODEL_MAC_SE30) || (m_model == MODEL_MAC_IIX)) + { + return 0x87; // bits 3 and 6 are tied low on SE/30 + } + + return 0xcf; // indicate no NuBus transaction error +} + +READ8_MEMBER(mac_state::mac_via2_in_b_pmu) +{ +// logerror("VIA2 IN B (PC %x)\n", m_maincpu->safe_pc()); + + if (m_pm_ack == 2) + { + return 0xcf; + } + else + { + return 0xcd; + } +} + +WRITE8_MEMBER(mac_state::mac_via2_out_a) +{ +// logerror("VIA2 OUT A: %02x (PC %x)\n", data, m_maincpu->safe_pc()); +} + +WRITE8_MEMBER(mac_state::mac_via2_out_a_pmu) +{ +// logerror("VIA2 OUT A: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + m_pm_data_send = data; +} + +WRITE8_MEMBER(mac_state::mac_via2_out_b) +{ +// logerror("VIA2 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); + + // chain 60.15 Hz to VIA1 + m_via1->write_ca1(data>>7); + + if (m_model == MODEL_MAC_II) + { + m68000_base_device *m68k = downcast(m_maincpu.target()); + m68k->set_hmmu_enable((data & 0x8) ? M68K_HMMU_DISABLE : M68K_HMMU_ENABLE_II); + } +} + +WRITE8_MEMBER(mac_state::mac_via2_out_b_pmu) +{ +// logerror("VIA2 OUT B PMU: %02x (PC %x)\n", data, m_maincpu->pc()); + + if ((data & 4) && !(m_pm_req & 4)) + { + #if LOG_ADB + printf("PM: 68k dropping /REQ\n"); + #endif + + if (m_pm_state == 0) // do this in receive state only + { + m_pm_data_recv = 0xff; + m_pm_ack |= 2; + + // check if length byte matches + if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2))) + { + pmu_exec(); + #if LOG_ADB + printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]); + #endif + } + } + } + else if (!(data & 4) && (m_pm_req & 4)) + { + if (m_pm_state == 0) + { + #if LOG_ADB + printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send); + #endif + m_pm_ack &= ~2; // clear, we're waiting for more bytes + m_pm_cmd[m_pm_dptr++] = m_pm_data_send; + } + else // receiving, so this is different + { + m_pm_data_recv = m_pm_out[m_pm_sptr++]; + m_pm_slen--; + m_pm_ack |= 2; // raise ACK to indicate available byte + #if LOG_ADB + printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv); + #endif + + // another byte to send? + if (m_pm_slen) + { + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + } + else + { + m_pm_state = 0; // back to receive state + m_pmu_send_timer->adjust(attotime::never); + } + } + } + + m_pm_req = data & 4; +} + +// This signal is generated internally on RBV, V8, Sonora, VASP, Eagle, etc. +TIMER_CALLBACK_MEMBER(mac_state::mac_6015_tick) +{ + m_via1->write_ca1(0); + m_via1->write_ca1(1); +} + +/* ************************************************************************* + * Main + * *************************************************************************/ + +void mac_state::machine_start() +{ + if (has_adb()) + { + this->m_adb_timer = machine().scheduler().timer_alloc(FUNC(mac_adb_tick)); + this->m_adb_timer->adjust(attotime::never); + + // also allocate PMU timer + if (ADB_IS_PM_CLASS) + { + m_pmu_send_timer = machine().scheduler().timer_alloc(FUNC(mac_pmu_tick)); + this->m_adb_timer->adjust(attotime::never); + m_pmu_int_status = 0; + } + } + + if (machine().first_screen()) + { + this->m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_scanline_tick),this)); + this->m_scanline_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); + } + + m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_6015_tick),this)); + m_6015_timer->adjust(attotime::never); +} + +void mac_state::machine_reset() +{ + // stop 60.15 Hz timer + m_6015_timer->adjust(attotime::never); + + m_rbv_vbltime = 0; + + if (m_model >= MODEL_MAC_POWERMAC_6100 && m_model <= MODEL_MAC_POWERMAC_8100) + { + m_awacs->set_dma_base(m_maincpu->space(AS_PROGRAM), 0x10000, 0x12000); + } + + // start 60.15 Hz timer for most systems + if (((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIVI)) || (m_model >= MODEL_MAC_LC)) + { + m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); + } + + // we use the CPU clock divided by the VIA clock (783360 Hz) rounded up as + // an approximation for the right number of wait states. this yields good + // results - it's towards the end of the worst-case delay on h/w. + switch (m_maincpu->clock()) + { + case 7833600: // C7M on classic Macs + m_via_cycles = -10; + break; + + case 7833600*2: // "16 MHz" Macs + m_via_cycles = -30; + break; + + case 20000000: // 20 MHz Macs + m_via_cycles = -40; + break; + + case 25000000: // 25 MHz Macs + m_via_cycles = -50; + break; + + case 7833600*4: // 32 MHz Macs (these are C7M * 4 like IIvx) + m_via_cycles = -60; + break; + + case 33000000: // 33 MHz Macs ('040s) + m_via_cycles = -64; + break; + + case 40000000: // 40 MHz Macs + m_via_cycles = -80; + break; + + case 60000000: // 60 MHz PowerMac + m_via_cycles = -120; + break; + + case 66000000: // 66 MHz PowerMac + m_via_cycles = -128; + break; + + default: + fatalerror("mac: unknown clock\n"); + } + + // clear PMU response timer + if (ADB_IS_PM_CLASS) + { + this->m_adb_timer->adjust(attotime::never); + } + + // default to 32-bit mode on LC + if (m_model == MODEL_MAC_LC) + { + m68000_base_device *m68k = downcast(m_maincpu.target()); + m68k->set_hmmu_enable(M68K_HMMU_DISABLE); + } + + m_last_taken_interrupt = -1; + + /* setup the memory overlay */ + if (m_model < MODEL_MAC_POWERMAC_6100) // no overlay for PowerPC + { + m_overlay = -1; // insure no match + this->set_memory_overlay(1); + } + + /* setup videoram */ + this->m_screen_buffer = 1; + + /* setup 'classic' sound */ + if (machine().device("custom") != NULL) + { + machine().device("custom")->set_sound_buffer(0); + } + else if (MAC_HAS_VIA2) // prime CB1 for ASC and slot interrupts + { + m_via2_ca1_hack = 1; + m_via2->write_ca1(1); + m_via2->write_cb1(1); + } + + if (has_adb()) + { + this->adb_reset(); + } + + if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC)) + { + machine().device("custom")->set_sound_buffer(1); + + // classic will fail RAM test and try to boot appletalk if RAM is not all zero + memset(m_ram->pointer(), 0, m_ram->size()); + } + + m_scsi_interrupt = 0; + if ((m_maincpu->debug()) && (m_model < MODEL_MAC_POWERMAC_6100)) + { + m_maincpu->debug()->set_dasm_override(mac_dasm_override); + } + + m_drive_select = 0; + m_scsiirq_enable = 0; + m_via2_vbl = 0; + m_se30_vbl_enable = 0; + m_nubus_irq_state = 0xff; +#ifndef MAC_USE_EMULATED_KBD + m_keyboard_reply = 0; + m_kbd_comm = 0; + m_kbd_receive = 0; + m_kbd_shift_reg = 0; + m_kbd_shift_count = 0; +#endif + m_mouse_bit_x = m_mouse_bit_y = 0; + m_pm_data_send = m_pm_data_recv = m_pm_ack = m_pm_req = m_pm_dptr = 0; + m_pm_state = 0; + m_last_taken_interrupt = 0; +} + +WRITE_LINE_MEMBER(mac_state::cuda_reset_w) +{ + if ((state == ASSERT_LINE) && (m_model < MODEL_MAC_POWERMAC_6100)) + { + set_memory_overlay(0); + set_memory_overlay(1); + } + + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + +void mac_state::mac_state_load() +{ + int overlay; + overlay = m_overlay; + if (m_model < MODEL_MAC_POWERMAC_6100) // no overlay for PowerPC + { + m_overlay = -1; + set_memory_overlay(overlay); + } +} + + +DIRECT_UPDATE_MEMBER(mac_state::overlay_opbaseoverride) +{ + if (m_overlay != -1) + { + if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100)) + { + if ((address >= 0x900000) && (address <= 0x9fffff)) + { + set_memory_overlay(0); // kill the overlay + } + } + else if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC)) + { + if ((address >= 0x400000) && (address <= 0x4fffff)) + { + set_memory_overlay(0); // kill the overlay + } + } + else if ((m_model == MODEL_MAC_LC) || (m_model == MODEL_MAC_LC_II) || (m_model == MODEL_MAC_CLASSIC_II) || (m_model == MODEL_MAC_COLOR_CLASSIC)) + { + if (((address >= 0xa00000) && (address <= 0xafffff)) || ((address >= 0x40a00000) && (address <= 0x40afffff))) + { + set_memory_overlay(0); // kill the overlay + } + } + else + { + if ((address >= 0x40000000) && (address <= 0x4fffffff)) + { + set_memory_overlay(0); // kill the overlay + } + } + } + + return address; +} + +READ32_MEMBER(mac_state::mac_read_id) +{ +// printf("Mac read ID reg @ PC=%x\n", m_maincpu->pc()); + + switch (m_model) + { + case MODEL_MAC_LC_III: + return 0xa55a0001; // 25 MHz LC III + + case MODEL_MAC_LC_III_PLUS: + return 0xa55a0003; // 33 MHz LC III+ + + case MODEL_MAC_LC_475: + return 0xa55a2221; + + case MODEL_MAC_LC_520: + return 0xa55a0100; + + case MODEL_MAC_LC_550: + return 0xa55a0101; + + case MODEL_MAC_LC_575: + return 0xa55a222e; + + case MODEL_MAC_POWERMAC_6100: + return 0xa55a3011; + + case MODEL_MAC_POWERMAC_7100: + return 0xa55a3012; + + case MODEL_MAC_POWERMAC_8100: + return 0xa55a3013; + + case MODEL_MAC_PBDUO_210: + return 0xa55a1004; + + case MODEL_MAC_PBDUO_230: + return 0xa55a1005; + + case MODEL_MAC_PBDUO_250: + return 0xa55a1006; + + case MODEL_MAC_QUADRA_605: + return 0xa55a2225; + + case MODEL_MAC_QUADRA_610: + case MODEL_MAC_QUADRA_650: + case MODEL_MAC_QUADRA_800: + return 0xa55a2bad; + + case MODEL_MAC_QUADRA_660AV: + case MODEL_MAC_QUADRA_840AV: + return 0xa55a2830; + + default: + return 0; + } +} + +void mac_state::mac_driver_init(model_t model) +{ + m_overlay = 1; + m_scsi_interrupt = 0; + m_model = model; + + if (model < MODEL_MAC_PORTABLE) + { + /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */ + mac_install_memory(0x600000, 0x6fffff, m_ram->size(), m_ram->pointer(), FALSE, "bank2"); + + /* set up ROM at 0x400000-0x4fffff (-0x5fffff for mac 128k/512k/512ke) */ + mac_install_memory(0x400000, (model >= MODEL_MAC_PLUS) ? 0x4fffff : 0x5fffff, + memregion("bootrom")->bytes(), memregion("bootrom")->base(), TRUE, "bank3"); + } + + m_overlay = -1; + if (m_model < MODEL_MAC_POWERMAC_6100) // no overlay for PowerPC + { + set_memory_overlay(1); + } + + memset(m_ram->pointer(), 0, m_ram->size()); + + if ((model == MODEL_MAC_SE) || (model == MODEL_MAC_CLASSIC) || (model == MODEL_MAC_CLASSIC_II) || (model == MODEL_MAC_LC) || (model == MODEL_MAC_COLOR_CLASSIC) || (model >= MODEL_MAC_LC_475 && model <= MODEL_MAC_LC_580) || + (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || (model == MODEL_MAC_LC_III_PLUS) || ((m_model >= MODEL_MAC_II) && (m_model <= MODEL_MAC_SE30)) || + (model == MODEL_MAC_PORTABLE) || (model == MODEL_MAC_PB100) || (model == MODEL_MAC_PB140) || (model == MODEL_MAC_PB160) || (model == MODEL_MAC_PBDUO_210) || (model >= MODEL_MAC_QUADRA_700 && model <= MODEL_MAC_QUADRA_800)) + { + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mac_state::overlay_opbaseoverride), this)); + } + + /* setup keyboard */ +#ifndef MAC_USE_EMULATED_KBD + keyboard_init(); + m_inquiry_timeout = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::inquiry_timeout_func),this)); +#else + /* clear key matrix for macadb */ + for (int i=0; i<7; i++) + { + m_key_matrix[i] = 0; + } +#endif + + /* save state stuff */ + machine().save().register_postload(save_prepost_delegate(FUNC(mac_state::mac_state_load), this)); +} + +#define MAC_DRIVER_INIT(label, model) \ +DRIVER_INIT_MEMBER(mac_state,label) \ +{ \ + mac_driver_init(model); \ +} + +MAC_DRIVER_INIT(mac128k512k, MODEL_MAC_128K512K) +MAC_DRIVER_INIT(mac512ke, MODEL_MAC_512KE) +MAC_DRIVER_INIT(macplus, MODEL_MAC_PLUS) +MAC_DRIVER_INIT(macse, MODEL_MAC_SE) +MAC_DRIVER_INIT(macclassic, MODEL_MAC_CLASSIC) +MAC_DRIVER_INIT(maclc, MODEL_MAC_LC) +MAC_DRIVER_INIT(maclc2, MODEL_MAC_LC_II) +MAC_DRIVER_INIT(maclc3, MODEL_MAC_LC_III) +MAC_DRIVER_INIT(maclc3plus, MODEL_MAC_LC_III_PLUS) +MAC_DRIVER_INIT(maciici, MODEL_MAC_IICI) +MAC_DRIVER_INIT(maciisi, MODEL_MAC_IISI) +MAC_DRIVER_INIT(macii, MODEL_MAC_II) +MAC_DRIVER_INIT(macse30, MODEL_MAC_SE30) +MAC_DRIVER_INIT(macclassic2, MODEL_MAC_CLASSIC_II) +MAC_DRIVER_INIT(maclrcclassic, MODEL_MAC_COLOR_CLASSIC) +MAC_DRIVER_INIT(macpm6100, MODEL_MAC_POWERMAC_6100) +MAC_DRIVER_INIT(macpm7100, MODEL_MAC_POWERMAC_7100) +MAC_DRIVER_INIT(macpm8100, MODEL_MAC_POWERMAC_8100) +MAC_DRIVER_INIT(macprtb, MODEL_MAC_PORTABLE) +MAC_DRIVER_INIT(macpb100, MODEL_MAC_PB100) +MAC_DRIVER_INIT(macpb140, MODEL_MAC_PB140) +MAC_DRIVER_INIT(macpb160, MODEL_MAC_PB160) +MAC_DRIVER_INIT(maciivx, MODEL_MAC_IIVX) +MAC_DRIVER_INIT(maciifx, MODEL_MAC_IIFX) +MAC_DRIVER_INIT(macpd210, MODEL_MAC_PBDUO_210) +MAC_DRIVER_INIT(macquadra700, MODEL_MAC_QUADRA_700) +MAC_DRIVER_INIT(maciicx, MODEL_MAC_IICX) +MAC_DRIVER_INIT(maciifdhd, MODEL_MAC_II_FDHD) +MAC_DRIVER_INIT(maciix, MODEL_MAC_IIX) +MAC_DRIVER_INIT(maclc520, MODEL_MAC_LC_520) + +void mac_state::nubus_slot_interrupt(UINT8 slot, UINT32 state) +{ + static const UINT8 masks[8] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80 }; + UINT8 mask = 0x3f; + + // quadra 700/900/950 use the top 2 bits of the interrupt register for ethernet and video + if ((m_model == MODEL_MAC_QUADRA_700) || (m_model == MODEL_MAC_QUADRA_900) || (m_model == MODEL_MAC_QUADRA_950)) + { + mask = 0xff; + } + + slot -= 9; + + if (state) + { + m_nubus_irq_state &= ~masks[slot]; + } + else + { + m_nubus_irq_state |= masks[slot]; + } + + if ((m_model != MODEL_MAC_IIFX) && (!INTS_RBV)) + { + if ((m_nubus_irq_state & mask) != mask) + { + // HACK: sometimes we miss an ack (possible misbehavior in the VIA?) + if (m_via2_ca1_hack == 0) + { + m_via2->write_ca1(1); + } + m_via2_ca1_hack = 0; + m_via2->write_ca1(0); + } + else + { + m_via2_ca1_hack = 1; + m_via2->write_ca1(1); + } + } + + if (INTS_RBV) + { + m_rbv_regs[2] &= ~0x38; + m_rbv_regs[2] |= (m_nubus_irq_state & 0x38); + rbv_recalc_irqs(); + } +} + +void mac_state::vblank_irq() +{ + /* handle ADB keyboard/mouse */ + if (has_adb()) + { + this->adb_vblank(); + } + +#ifndef MAC_USE_EMULATED_KBD + /* handle keyboard */ + if (m_kbd_comm == TRUE && m_kbd_receive == FALSE) + { + int keycode = scan_keyboard(); + + if (keycode != 0x7B) + { + /* if key pressed, send the code */ + + logerror("keyboard enquiry successful, keycode %X\n", keycode); + + m_inquiry_timeout->reset(); + kbd_shift_out(keycode); + } + } +#endif + + /* signal VBlank on CA1 input on the VIA */ + if ((m_model < MODEL_MAC_II) || (m_model == MODEL_MAC_PB140) || (m_model == MODEL_MAC_PB160) || (m_model == MODEL_MAC_QUADRA_700)) + { + ca1_data ^= 1; + m_via1->write_ca1(ca1_data); + } + + if (++irq_count == 60) + { + irq_count = 0; + + ca2_data ^= 1; + /* signal 1 Hz irq on CA2 input on the VIA */ + m_via1->write_ca2(ca2_data); + } + + // handle SE/30 vblank IRQ + if (m_model == MODEL_MAC_SE30) + { + if (m_se30_vbl_enable) + { + m_via2_vbl ^= 1; + if (!m_via2_vbl) + { + this->nubus_slot_interrupt(0xe, 1); + } + } + } +} + +TIMER_CALLBACK_MEMBER(mac_state::mac_scanline_tick) +{ + int scanline; + + if (machine().device("custom") != NULL) + { + machine().device("custom")->sh_updatebuffer(); + } + + if (m_rbv_vbltime > 0) + { + m_rbv_vbltime--; + + if (m_rbv_vbltime == 0) + { + m_rbv_regs[2] |= 0x40; + rbv_recalc_irqs(); + } + } + + scanline = machine().first_screen()->vpos(); + if (scanline == MAC_V_VIS) + vblank_irq(); + + /* check for mouse changes at 10 irqs per frame */ + if (m_model <= MODEL_MAC_PLUS) + { + if (!(scanline % 10)) + mouse_callback(); + } + + m_scanline_timer->adjust(machine().first_screen()->time_until_pos((scanline+1) % MAC_V_TOTAL, 0)); +} + +WRITE_LINE_MEMBER(mac_state::nubus_irq_9_w) +{ + nubus_slot_interrupt(9, state); +} + +WRITE_LINE_MEMBER(mac_state::nubus_irq_a_w) +{ + nubus_slot_interrupt(0xa, state); +} + +WRITE_LINE_MEMBER(mac_state::nubus_irq_b_w) +{ + nubus_slot_interrupt(0xb, state); +} + +WRITE_LINE_MEMBER(mac_state::nubus_irq_c_w) +{ + nubus_slot_interrupt(0xc, state); +} + +WRITE_LINE_MEMBER(mac_state::nubus_irq_d_w) +{ + nubus_slot_interrupt(0xd, state); +} + +WRITE_LINE_MEMBER(mac_state::nubus_irq_e_w) +{ + nubus_slot_interrupt(0xe, state); +} + +/* ************************************************************************* + * Trap Tracing + * + * This is debug code that will output diagnostics regarding OS traps called + * *************************************************************************/ + +const char *lookup_trap(UINT16 opcode) +{ + static const struct + { + UINT16 trap; + const char *name; + } traps[] = + { + { 0xA000, "_Open" }, + { 0xA001, "_Close" }, + { 0xA002, "_Read" }, + { 0xA003, "_Write" }, + { 0xA004, "_Control" }, + { 0xA005, "_Status" }, + { 0xA006, "_KillIO" }, + { 0xA007, "_GetVolInfo" }, + { 0xA008, "_Create" }, + { 0xA009, "_Delete" }, + { 0xA00A, "_OpenRF" }, + { 0xA00B, "_Rename" }, + { 0xA00C, "_GetFileInfo" }, + { 0xA00D, "_SetFileInfo" }, + { 0xA00E, "_UnmountVol" }, + { 0xA00F, "_MountVol" }, + { 0xA010, "_Allocate" }, + { 0xA011, "_GetEOF" }, + { 0xA012, "_SetEOF" }, + { 0xA013, "_FlushVol" }, + { 0xA014, "_GetVol" }, + { 0xA015, "_SetVol" }, + { 0xA016, "_FInitQueue" }, + { 0xA017, "_Eject" }, + { 0xA018, "_GetFPos" }, + { 0xA019, "_InitZone" }, + { 0xA01B, "_SetZone" }, + { 0xA01C, "_FreeMem" }, + { 0xA01F, "_DisposePtr" }, + { 0xA020, "_SetPtrSize" }, + { 0xA021, "_GetPtrSize" }, + { 0xA023, "_DisposeHandle" }, + { 0xA024, "_SetHandleSize" }, + { 0xA025, "_GetHandleSize" }, + { 0xA027, "_ReallocHandle" }, + { 0xA029, "_HLock" }, + { 0xA02A, "_HUnlock" }, + { 0xA02B, "_EmptyHandle" }, + { 0xA02C, "_InitApplZone" }, + { 0xA02D, "_SetApplLimit" }, + { 0xA02E, "_BlockMove" }, + { 0xA02F, "_PostEvent" }, + { 0xA030, "_OSEventAvail" }, + { 0xA031, "_GetOSEvent" }, + { 0xA032, "_FlushEvents" }, + { 0xA033, "_VInstall" }, + { 0xA034, "_VRemove" }, + { 0xA035, "_OffLine" }, + { 0xA036, "_MoreMasters" }, + { 0xA038, "_WriteParam" }, + { 0xA039, "_ReadDateTime" }, + { 0xA03A, "_SetDateTime" }, + { 0xA03B, "_Delay" }, + { 0xA03C, "_CmpString" }, + { 0xA03D, "_DrvrInstall" }, + { 0xA03E, "_DrvrRemove" }, + { 0xA03F, "_InitUtil" }, + { 0xA040, "_ResrvMem" }, + { 0xA041, "_SetFilLock" }, + { 0xA042, "_RstFilLock" }, + { 0xA043, "_SetFilType" }, + { 0xA044, "_SetFPos" }, + { 0xA045, "_FlushFile" }, + { 0xA047, "_SetTrapAddress" }, + { 0xA049, "_HPurge" }, + { 0xA04A, "_HNoPurge" }, + { 0xA04B, "_SetGrowZone" }, + { 0xA04C, "_CompactMem" }, + { 0xA04D, "_PurgeMem" }, + { 0xA04E, "_AddDrive" }, + { 0xA04F, "_RDrvrInstall" }, + { 0xA050, "_CompareString" }, + { 0xA051, "_ReadXPRam" }, + { 0xA052, "_WriteXPRam" }, + { 0xA054, "_UprString" }, + { 0xA055, "_StripAddress" }, + { 0xA056, "_LowerText" }, + { 0xA057, "_SetAppBase" }, + { 0xA058, "_InsTime" }, + { 0xA059, "_RmvTime" }, + { 0xA05A, "_PrimeTime" }, + { 0xA05B, "_PowerOff" }, + { 0xA05C, "_MemoryDispatch" }, + { 0xA05D, "_SwapMMUMode" }, + { 0xA05E, "_NMInstall" }, + { 0xA05F, "_NMRemove" }, + { 0xA060, "_FSDispatch" }, + { 0xA061, "_MaxBlock" }, + { 0xA063, "_MaxApplZone" }, + { 0xA064, "_MoveHHi" }, + { 0xA065, "_StackSpace" }, + { 0xA067, "_HSetRBit" }, + { 0xA068, "_HClrRBit" }, + { 0xA069, "_HGetState" }, + { 0xA06A, "_HSetState" }, + { 0xA06C, "_InitFS" }, + { 0xA06D, "_InitEvents" }, + { 0xA06E, "_SlotManager" }, + { 0xA06F, "_SlotVInstall" }, + { 0xA070, "_SlotVRemove" }, + { 0xA071, "_AttachVBL" }, + { 0xA072, "_DoVBLTask" }, + { 0xA075, "_SIntInstall" }, + { 0xA076, "_SIntRemove" }, + { 0xA077, "_CountADBs" }, + { 0xA078, "_GetIndADB" }, + { 0xA079, "_GetADBInfo" }, + { 0xA07A, "_SetADBInfo" }, + { 0xA07B, "_ADBReInit" }, + { 0xA07C, "_ADBOp" }, + { 0xA07D, "_GetDefaultStartup" }, + { 0xA07E, "_SetDefaultStartup" }, + { 0xA07F, "_InternalWait" }, + { 0xA080, "_GetVideoDefault" }, + { 0xA081, "_SetVideoDefault" }, + { 0xA082, "_DTInstall" }, + { 0xA083, "_SetOSDefault" }, + { 0xA084, "_GetOSDefault" }, + { 0xA085, "_PMgrOp" }, + { 0xA086, "_IOPInfoAccess" }, + { 0xA087, "_IOPMsgRequest" }, + { 0xA088, "_IOPMoveData" }, + { 0xA089, "_SCSIAtomic" }, + { 0xA08A, "_Sleep" }, + { 0xA08B, "_CommToolboxDispatch" }, + { 0xA08D, "_DebugUtil" }, + { 0xA08F, "_DeferUserFn" }, + { 0xA090, "_SysEnvirons" }, + { 0xA092, "_EgretDispatch" }, + { 0xA094, "_ServerDispatch" }, + { 0xA09E, "_PowerMgrDispatch" }, + { 0xA09F, "_PowerDispatch" }, + { 0xA0A4, "_HeapDispatch" }, + { 0xA0AC, "_FSMDispatch" }, + { 0xA0AE, "_VADBProc" }, + { 0xA0DD, "_PPC" }, + { 0xA0FE, "_TEFindWord" }, + { 0xA0FF, "_TEFindLine" }, + { 0xA11A, "_GetZone" }, + { 0xA11D, "_MaxMem" }, + { 0xA11E, "_NewPtr" }, + { 0xA122, "_NewHandle" }, + { 0xA126, "_HandleZone" }, + { 0xA128, "_RecoverHandle" }, + { 0xA12F, "_PPostEvent" }, + { 0xA146, "_GetTrapAddress" }, + { 0xA148, "_PtrZone" }, + { 0xA162, "_PurgeSpace" }, + { 0xA166, "_NewEmptyHandle" }, + { 0xA193, "_Microseconds" }, + { 0xA198, "_HWPriv" }, + { 0xA1AD, "_Gestalt" }, + { 0xA200, "_HOpen" }, + { 0xA207, "_HGetVInfo" }, + { 0xA208, "_HCreate" }, + { 0xA209, "_HDelete" }, + { 0xA20A, "_HOpenRF" }, + { 0xA20B, "_HRename" }, + { 0xA20C, "_HGetFileInfo" }, + { 0xA20D, "_HSetFileInfo" }, + { 0xA20E, "_HUnmountVol" }, + { 0xA210, "_AllocContig" }, + { 0xA214, "_HGetVol" }, + { 0xA215, "_HSetVol" }, + { 0xA22E, "_BlockMoveData" }, + { 0xA241, "_HSetFLock" }, + { 0xA242, "_HRstFLock" }, + { 0xA247, "_SetOSTrapAddress" }, + { 0xA256, "_StripText" }, + { 0xA260, "_HFSDispatch" }, + { 0xA285, "_IdleUpdate" }, + { 0xA28A, "_SlpQInstall" }, + { 0xA31E, "_NewPtrClear" }, + { 0xA322, "_NewHandleClear" }, + { 0xA346, "_GetOSTrapAddress" }, + { 0xA3AD, "_NewGestalt" }, + { 0xA456, "_UpperText" }, + { 0xA458, "_InsXTime" }, + { 0xA485, "_IdleState" }, + { 0xA48A, "_SlpQRemove" }, + { 0xA51E, "_NewPtrSys" }, + { 0xA522, "_NewHandleSys" }, + { 0xA562, "_PurgeSpaceSys" }, + { 0xA5AD, "_ReplaceGestalt" }, + { 0xA647, "_SetToolBoxTrapAddress" }, + { 0xA656, "_StripUpperText" }, + { 0xA685, "_SerialPower" }, + { 0xA71E, "_NewPtrSysClear" }, + { 0xA722, "_NewHandleSysClear" }, + { 0xA746, "_GetToolBoxTrapAddress" }, + { 0xA7AD, "_GetGestaltProcPtr" }, + { 0xA800, "_SoundDispatch" }, + { 0xA801, "_SndDisposeChannel" }, + { 0xA802, "_SndAddModifier" }, + { 0xA803, "_SndDoCommand" }, + { 0xA804, "_SndDoImmediate" }, + { 0xA805, "_SndPlay" }, + { 0xA806, "_SndControl" }, + { 0xA807, "_SndNewChannel" }, + { 0xA808, "_InitProcMenu" }, + { 0xA809, "_GetControlVariant" }, + { 0xA80A, "_GetWVariant" }, + { 0xA80B, "_PopUpMenuSelect" }, + { 0xA80C, "_RGetResource" }, + { 0xA811, "_TESelView" }, + { 0xA812, "_TEPinScroll" }, + { 0xA813, "_TEAutoView" }, + { 0xA814, "_SetFractEnable" }, + { 0xA815, "_SCSIDispatch" }, + { 0xA817, "_CopyMask" }, + { 0xA819, "_XMunger" }, + { 0xA81A, "_HOpenResFile" }, + { 0xA81B, "_HCreateResFile" }, + { 0xA81D, "_InvalMenuBar" }, + { 0xA821, "_MaxSizeRsrc" }, + { 0xA822, "_ResourceDispatch" }, + { 0xA823, "_AliasDispatch" }, + { 0xA824, "_HFSUtilDispatch" }, + { 0xA825, "_MenuDispatch" }, + { 0xA826, "_InsertMenuItem" }, + { 0xA827, "_HideDialogItem" }, + { 0xA828, "_ShowDialogItem" }, + { 0xA82A, "_ComponentDispatch" }, + { 0xA833, "_ScrnBitMap" }, + { 0xA834, "_SetFScaleDisable" }, + { 0xA835, "_FontMetrics" }, + { 0xA836, "_GetMaskTable" }, + { 0xA837, "_MeasureText" }, + { 0xA838, "_CalcMask" }, + { 0xA839, "_SeedFill" }, + { 0xA83A, "_ZoomWindow" }, + { 0xA83B, "_TrackBox" }, + { 0xA83C, "_TEGetOffset" }, + { 0xA83D, "_TEDispatch" }, + { 0xA83E, "_TEStyleNew" }, + { 0xA847, "_FracCos" }, + { 0xA848, "_FracSin" }, + { 0xA849, "_FracSqrt" }, + { 0xA84A, "_FracMul" }, + { 0xA84B, "_FracDiv" }, + { 0xA84D, "_FixDiv" }, + { 0xA84E, "_GetItemCmd" }, + { 0xA84F, "_SetItemCmd" }, + { 0xA850, "_InitCursor" }, + { 0xA851, "_SetCursor" }, + { 0xA852, "_HideCursor" }, + { 0xA853, "_ShowCursor" }, + { 0xA854, "_FontDispatch" }, + { 0xA855, "_ShieldCursor" }, + { 0xA856, "_ObscureCursor" }, + { 0xA858, "_BitAnd" }, + { 0xA859, "_BitXOr" }, + { 0xA85A, "_BitNot" }, + { 0xA85B, "_BitOr" }, + { 0xA85C, "_BitShift" }, + { 0xA85D, "_BitTst" }, + { 0xA85E, "_BitSet" }, + { 0xA85F, "_BitClr" }, + { 0xA860, "_WaitNextEvent" }, + { 0xA861, "_Random" }, + { 0xA862, "_ForeColor" }, + { 0xA863, "_BackColor" }, + { 0xA864, "_ColorBit" }, + { 0xA865, "_GetPixel" }, + { 0xA866, "_StuffHex" }, + { 0xA867, "_LongMul" }, + { 0xA868, "_FixMul" }, + { 0xA869, "_FixRatio" }, + { 0xA86A, "_HiWord" }, + { 0xA86B, "_LoWord" }, + { 0xA86C, "_FixRound" }, + { 0xA86D, "_InitPort" }, + { 0xA86E, "_InitGraf" }, + { 0xA86F, "_OpenPort" }, + { 0xA870, "_LocalToGlobal" }, + { 0xA871, "_GlobalToLocal" }, + { 0xA872, "_GrafDevice" }, + { 0xA873, "_SetPort" }, + { 0xA874, "_GetPort" }, + { 0xA875, "_SetPBits" }, + { 0xA876, "_PortSize" }, + { 0xA877, "_MovePortTo" }, + { 0xA878, "_SetOrigin" }, + { 0xA879, "_SetClip" }, + { 0xA87A, "_GetClip" }, + { 0xA87B, "_ClipRect" }, + { 0xA87C, "_BackPat" }, + { 0xA87D, "_ClosePort" }, + { 0xA87E, "_AddPt" }, + { 0xA87F, "_SubPt" }, + { 0xA880, "_SetPt" }, + { 0xA881, "_EqualPt" }, + { 0xA882, "_StdText" }, + { 0xA883, "_DrawChar" }, + { 0xA884, "_DrawString" }, + { 0xA885, "_DrawText" }, + { 0xA886, "_TextWidth" }, + { 0xA887, "_TextFont" }, + { 0xA888, "_TextFace" }, + { 0xA889, "_TextMode" }, + { 0xA88A, "_TextSize" }, + { 0xA88B, "_GetFontInfo" }, + { 0xA88C, "_StringWidth" }, + { 0xA88D, "_CharWidth" }, + { 0xA88E, "_SpaceExtra" }, + { 0xA88F, "_OSDispatch" }, + { 0xA890, "_StdLine" }, + { 0xA891, "_LineTo" }, + { 0xA892, "_Line" }, + { 0xA893, "_MoveTo" }, + { 0xA894, "_Move" }, + { 0xA895, "_ShutDown" }, + { 0xA896, "_HidePen" }, + { 0xA897, "_ShowPen" }, + { 0xA898, "_GetPenState" }, + { 0xA899, "_SetPenState" }, + { 0xA89A, "_GetPen" }, + { 0xA89B, "_PenSize" }, + { 0xA89C, "_PenMode" }, + { 0xA89D, "_PenPat" }, + { 0xA89E, "_PenNormal" }, + { 0xA89F, "_Moof" }, + { 0xA8A0, "_StdRect" }, + { 0xA8A1, "_FrameRect" }, + { 0xA8A2, "_PaintRect" }, + { 0xA8A3, "_EraseRect" }, + { 0xA8A4, "_InverRect" }, + { 0xA8A5, "_FillRect" }, + { 0xA8A6, "_EqualRect" }, + { 0xA8A7, "_SetRect" }, + { 0xA8A8, "_OffsetRect" }, + { 0xA8A9, "_InsetRect" }, + { 0xA8AA, "_SectRect" }, + { 0xA8AB, "_UnionRect" }, + { 0xA8AD, "_PtInRect" }, + { 0xA8AE, "_EmptyRect" }, + { 0xA8AF, "_StdRRect" }, + { 0xA8B0, "_FrameRoundRect" }, + { 0xA8B1, "_PaintRoundRect" }, + { 0xA8B2, "_EraseRoundRect" }, + { 0xA8B3, "_InverRoundRect" }, + { 0xA8B4, "_FillRoundRect" }, + { 0xA8B5, "_ScriptUtil" }, + { 0xA8B6, "_StdOval" }, + { 0xA8B7, "_FrameOval" }, + { 0xA8B8, "_PaintOval" }, + { 0xA8B9, "_EraseOval" }, + { 0xA8BA, "_InvertOval" }, + { 0xA8BB, "_FillOval" }, + { 0xA8BC, "_SlopeFromAngle" }, + { 0xA8BD, "_StdArc" }, + { 0xA8BE, "_FrameArc" }, + { 0xA8BF, "_PaintArc" }, + { 0xA8C0, "_EraseArc" }, + { 0xA8C1, "_InvertArc" }, + { 0xA8C2, "_FillArc" }, + { 0xA8C3, "_PtToAngle" }, + { 0xA8C4, "_AngleFromSlope" }, + { 0xA8C5, "_StdPoly" }, + { 0xA8C6, "_FramePoly" }, + { 0xA8C7, "_PaintPoly" }, + { 0xA8C8, "_ErasePoly" }, + { 0xA8C9, "_InvertPoly" }, + { 0xA8CA, "_FillPoly" }, + { 0xA8CB, "_OpenPoly" }, + { 0xA8CC, "_ClosePoly" }, + { 0xA8CD, "_KillPoly" }, + { 0xA8CE, "_OffsetPoly" }, + { 0xA8CF, "_PackBits" }, + { 0xA8D0, "_UnpackBits" }, + { 0xA8D1, "_StdRgn" }, + { 0xA8D2, "_FrameRgn" }, + { 0xA8D3, "_PaintRgn" }, + { 0xA8D4, "_EraseRgn" }, + { 0xA8D5, "_InverRgn" }, + { 0xA8D6, "_FillRgn" }, + { 0xA8D7, "_BitMapToRegion" }, + { 0xA8D8, "_NewRgn" }, + { 0xA8D9, "_DisposeRgn" }, + { 0xA8DA, "_OpenRgn" }, + { 0xA8DB, "_CloseRgn" }, + { 0xA8DC, "_CopyRgn" }, + { 0xA8DD, "_SetEmptyRgn" }, + { 0xA8DE, "_SetRecRgn" }, + { 0xA8DF, "_RectRgn" }, + { 0xA8E0, "_OffsetRgn" }, + { 0xA8E1, "_InsetRgn" }, + { 0xA8E2, "_EmptyRgn" }, + { 0xA8E3, "_EqualRgn" }, + { 0xA8E4, "_SectRgn" }, + { 0xA8E5, "_UnionRgn" }, + { 0xA8E6, "_DiffRgn" }, + { 0xA8E7, "_XOrRgn" }, + { 0xA8E8, "_PtInRgn" }, + { 0xA8E9, "_RectInRgn" }, + { 0xA8EA, "_SetStdProcs" }, + { 0xA8EB, "_StdBits" }, + { 0xA8EC, "_CopyBits" }, + { 0xA8ED, "_StdTxMeas" }, + { 0xA8EE, "_StdGetPic" }, + { 0xA8EF, "_ScrollRect" }, + { 0xA8F0, "_StdPutPic" }, + { 0xA8F1, "_StdComment" }, + { 0xA8F2, "_PicComment" }, + { 0xA8F3, "_OpenPicture" }, + { 0xA8F4, "_ClosePicture" }, + { 0xA8F5, "_KillPicture" }, + { 0xA8F6, "_DrawPicture" }, + { 0xA8F7, "_Layout" }, + { 0xA8F8, "_ScalePt" }, + { 0xA8F9, "_MapPt" }, + { 0xA8FA, "_MapRect" }, + { 0xA8FB, "_MapRgn" }, + { 0xA8FC, "_MapPoly" }, + { 0xA8FD, "_PrGlue" }, + { 0xA8FE, "_InitFonts" }, + { 0xA8FF, "_GetFName" }, + { 0xA900, "_GetFNum" }, + { 0xA901, "_FMSwapFont" }, + { 0xA902, "_RealFont" }, + { 0xA903, "_SetFontLock" }, + { 0xA904, "_DrawGrowIcon" }, + { 0xA905, "_DragGrayRgn" }, + { 0xA906, "_NewString" }, + { 0xA907, "_SetString" }, + { 0xA908, "_ShowHide" }, + { 0xA909, "_CalcVis" }, + { 0xA90A, "_CalcVBehind" }, + { 0xA90B, "_ClipAbove" }, + { 0xA90C, "_PaintOne" }, + { 0xA90D, "_PaintBehind" }, + { 0xA90E, "_SaveOld" }, + { 0xA90F, "_DrawNew" }, + { 0xA910, "_GetWMgrPort" }, + { 0xA911, "_CheckUpDate" }, + { 0xA912, "_InitWindows" }, + { 0xA913, "_NewWindow" }, + { 0xA914, "_DisposeWindow" }, + { 0xA915, "_ShowWindow" }, + { 0xA916, "_HideWindow" }, + { 0xA917, "_GetWRefCon" }, + { 0xA918, "_SetWRefCon" }, + { 0xA919, "_GetWTitle" }, + { 0xA91A, "_SetWTitle" }, + { 0xA91B, "_MoveWindow" }, + { 0xA91C, "_HiliteWindow" }, + { 0xA91D, "_SizeWindow" }, + { 0xA91E, "_TrackGoAway" }, + { 0xA91F, "_SelectWindow" }, + { 0xA920, "_BringToFront" }, + { 0xA921, "_SendBehind" }, + { 0xA922, "_BeginUpDate" }, + { 0xA923, "_EndUpDate" }, + { 0xA924, "_FrontWindow" }, + { 0xA925, "_DragWindow" }, + { 0xA926, "_DragTheRgn" }, + { 0xA927, "_InvalRgn" }, + { 0xA928, "_InvalRect" }, + { 0xA929, "_ValidRgn" }, + { 0xA92A, "_ValidRect" }, + { 0xA92B, "_GrowWindow" }, + { 0xA92C, "_FindWindow" }, + { 0xA92D, "_CloseWindow" }, + { 0xA92E, "_SetWindowPic" }, + { 0xA92F, "_GetWindowPic" }, + { 0xA930, "_InitMenus" }, + { 0xA931, "_NewMenu" }, + { 0xA932, "_DisposeMenu" }, + { 0xA933, "_AppendMenu" }, + { 0xA934, "_ClearMenuBar" }, + { 0xA935, "_InsertMenu" }, + { 0xA936, "_DeleteMenu" }, + { 0xA937, "_DrawMenuBar" }, + { 0xA938, "_HiliteMenu" }, + { 0xA939, "_EnableItem" }, + { 0xA93A, "_DisableItem" }, + { 0xA93B, "_GetMenuBar" }, + { 0xA93C, "_SetMenuBar" }, + { 0xA93D, "_MenuSelect" }, + { 0xA93E, "_MenuKey" }, + { 0xA93F, "_GetItmIcon" }, + { 0xA940, "_SetItmIcon" }, + { 0xA941, "_GetItmStyle" }, + { 0xA942, "_SetItmStyle" }, + { 0xA943, "_GetItmMark" }, + { 0xA944, "_SetItmMark" }, + { 0xA945, "_CheckItem" }, + { 0xA946, "_GetMenuItemText" }, + { 0xA947, "_SetMenuItemText" }, + { 0xA948, "_CalcMenuSize" }, + { 0xA949, "_GetMenuHandle" }, + { 0xA94A, "_SetMFlash" }, + { 0xA94B, "_PlotIcon" }, + { 0xA94C, "_FlashMenuBar" }, + { 0xA94D, "_AppendResMenu" }, + { 0xA94E, "_PinRect" }, + { 0xA94F, "_DeltaPoint" }, + { 0xA950, "_CountMItems" }, + { 0xA951, "_InsertResMenu" }, + { 0xA952, "_DeleteMenuItem" }, + { 0xA953, "_UpdtControl" }, + { 0xA954, "_NewControl" }, + { 0xA955, "_DisposeControl" }, + { 0xA956, "_KillControls" }, + { 0xA957, "_ShowControl" }, + { 0xA958, "_HideControl" }, + { 0xA959, "_MoveControl" }, + { 0xA95A, "_GetControlReference" }, + { 0xA95B, "_SetControlReference" }, + { 0xA95C, "_SizeControl" }, + { 0xA95D, "_HiliteControl" }, + { 0xA95E, "_GetControlTitle" }, + { 0xA95F, "_SetControlTitle" }, + { 0xA960, "_GetControlValue" }, + { 0xA961, "_GetControlMinimum" }, + { 0xA962, "_GetControlMaximum" }, + { 0xA963, "_SetControlValue" }, + { 0xA964, "_SetControlMinimum" }, + { 0xA965, "_SetControlMaximum" }, + { 0xA966, "_TestControl" }, + { 0xA967, "_DragControl" }, + { 0xA968, "_TrackControl" }, + { 0xA969, "_DrawControls" }, + { 0xA96A, "_GetControlAction" }, + { 0xA96B, "_SetControlAction" }, + { 0xA96C, "_FindControl" }, + { 0xA96E, "_Dequeue" }, + { 0xA96F, "_Enqueue" }, + { 0xA970, "_GetNextEvent" }, + { 0xA971, "_EventAvail" }, + { 0xA972, "_GetMouse" }, + { 0xA973, "_StillDown" }, + { 0xA974, "_Button" }, + { 0xA975, "_TickCount" }, + { 0xA976, "_GetKeys" }, + { 0xA977, "_WaitMouseUp" }, + { 0xA978, "_UpdtDialog" }, + { 0xA97B, "_InitDialogs" }, + { 0xA97C, "_GetNewDialog" }, + { 0xA97D, "_NewDialog" }, + { 0xA97E, "_SelectDialogItemText" }, + { 0xA97F, "_IsDialogEvent" }, + { 0xA980, "_DialogSelect" }, + { 0xA981, "_DrawDialog" }, + { 0xA982, "_CloseDialog" }, + { 0xA983, "_DisposeDialog" }, + { 0xA984, "_FindDialogItem" }, + { 0xA985, "_Alert" }, + { 0xA986, "_StopAlert" }, + { 0xA987, "_NoteAlert" }, + { 0xA988, "_CautionAlert" }, + { 0xA98B, "_ParamText" }, + { 0xA98C, "_ErrorSound" }, + { 0xA98D, "_GetDialogItem" }, + { 0xA98E, "_SetDialogItem" }, + { 0xA98F, "_SetDialogItemText" }, + { 0xA990, "_GetDialogItemText" }, + { 0xA991, "_ModalDialog" }, + { 0xA992, "_DetachResource" }, + { 0xA993, "_SetResPurge" }, + { 0xA994, "_CurResFile" }, + { 0xA995, "_InitResources" }, + { 0xA996, "_RsrcZoneInit" }, + { 0xA997, "_OpenResFile" }, + { 0xA998, "_UseResFile" }, + { 0xA999, "_UpdateResFile" }, + { 0xA99A, "_CloseResFile" }, + { 0xA99B, "_SetResLoad" }, + { 0xA99C, "_CountResources" }, + { 0xA99D, "_GetIndResource" }, + { 0xA99E, "_CountTypes" }, + { 0xA99F, "_GetIndType" }, + { 0xA9A0, "_GetResource" }, + { 0xA9A1, "_GetNamedResource" }, + { 0xA9A2, "_LoadResource" }, + { 0xA9A3, "_ReleaseResource" }, + { 0xA9A4, "_HomeResFile" }, + { 0xA9A5, "_SizeRsrc" }, + { 0xA9A6, "_GetResAttrs" }, + { 0xA9A7, "_SetResAttrs" }, + { 0xA9A8, "_GetResInfo" }, + { 0xA9A9, "_SetResInfo" }, + { 0xA9AA, "_ChangedResource" }, + { 0xA9AB, "_AddResource" }, + { 0xA9AC, "_AddReference" }, + { 0xA9AD, "_RmveResource" }, + { 0xA9AE, "_RmveReference" }, + { 0xA9AF, "_ResError" }, + { 0xA9B0, "_WriteResource" }, + { 0xA9B1, "_CreateResFile" }, + { 0xA9B2, "_SystemEvent" }, + { 0xA9B3, "_SystemClick" }, + { 0xA9B4, "_SystemTask" }, + { 0xA9B5, "_SystemMenu" }, + { 0xA9B6, "_OpenDeskAcc" }, + { 0xA9B7, "_CloseDeskAcc" }, + { 0xA9B8, "_GetPattern" }, + { 0xA9B9, "_GetCursor" }, + { 0xA9BA, "_GetString" }, + { 0xA9BB, "_GetIcon" }, + { 0xA9BC, "_GetPicture" }, + { 0xA9BD, "_GetNewWindow" }, + { 0xA9BE, "_GetNewControl" }, + { 0xA9BF, "_GetRMenu" }, + { 0xA9C0, "_GetNewMBar" }, + { 0xA9C1, "_UniqueID" }, + { 0xA9C2, "_SysEdit" }, + { 0xA9C3, "_KeyTranslate" }, + { 0xA9C4, "_OpenRFPerm" }, + { 0xA9C5, "_RsrcMapEntry" }, + { 0xA9C6, "_SecondsToDate" }, + { 0xA9C7, "_DateToSeconds" }, + { 0xA9C8, "_SysBeep" }, + { 0xA9C9, "_SysError" }, + { 0xA9CA, "_PutIcon" }, + { 0xA9CB, "_TEGetText" }, + { 0xA9CC, "_TEInit" }, + { 0xA9CD, "_TEDispose" }, + { 0xA9CE, "_TETextBox" }, + { 0xA9CF, "_TESetText" }, + { 0xA9D0, "_TECalText" }, + { 0xA9D1, "_TESetSelect" }, + { 0xA9D2, "_TENew" }, + { 0xA9D3, "_TEUpdate" }, + { 0xA9D4, "_TEClick" }, + { 0xA9D5, "_TECopy" }, + { 0xA9D6, "_TECut" }, + { 0xA9D7, "_TEDelete" }, + { 0xA9D8, "_TEActivate" }, + { 0xA9D9, "_TEDeactivate" }, + { 0xA9DA, "_TEIdle" }, + { 0xA9DB, "_TEPaste" }, + { 0xA9DC, "_TEKey" }, + { 0xA9DD, "_TEScroll" }, + { 0xA9DE, "_TEInsert" }, + { 0xA9DF, "_TESetAlignment" }, + { 0xA9E0, "_Munger" }, + { 0xA9E1, "_HandToHand" }, + { 0xA9E2, "_PtrToXHand" }, + { 0xA9E3, "_PtrToHand" }, + { 0xA9E4, "_HandAndHand" }, + { 0xA9E5, "_InitPack" }, + { 0xA9E6, "_InitAllPacks" }, + { 0xA9EF, "_PtrAndHand" }, + { 0xA9F0, "_LoadSeg" }, + { 0xA9F1, "_UnLoadSeg" }, + { 0xA9F2, "_Launch" }, + { 0xA9F3, "_Chain" }, + { 0xA9F4, "_ExitToShell" }, + { 0xA9F5, "_GetAppParms" }, + { 0xA9F6, "_GetResFileAttrs" }, + { 0xA9F7, "_SetResFileAttrs" }, + { 0xA9F8, "_MethodDispatch" }, + { 0xA9F9, "_InfoScrap" }, + { 0xA9FA, "_UnloadScrap" }, + { 0xA9FB, "_LoadScrap" }, + { 0xA9FC, "_ZeroScrap" }, + { 0xA9FD, "_GetScrap" }, + { 0xA9FE, "_PutScrap" }, + { 0xA9FF, "_Debugger" }, + { 0xAA00, "_OpenCPort" }, + { 0xAA01, "_InitCPort" }, + { 0xAA02, "_CloseCPort" }, + { 0xAA03, "_NewPixMap" }, + { 0xAA04, "_DisposePixMap" }, + { 0xAA05, "_CopyPixMap" }, + { 0xAA06, "_SetPortPix" }, + { 0xAA07, "_NewPixPat" }, + { 0xAA08, "_DisposePixPat" }, + { 0xAA09, "_CopyPixPat" }, + { 0xAA0A, "_PenPixPat" }, + { 0xAA0B, "_BackPixPat" }, + { 0xAA0C, "_GetPixPat" }, + { 0xAA0D, "_MakeRGBPat" }, + { 0xAA0E, "_FillCRect" }, + { 0xAA0F, "_FillCOval" }, + { 0xAA10, "_FillCRoundRect" }, + { 0xAA11, "_FillCArc" }, + { 0xAA12, "_FillCRgn" }, + { 0xAA13, "_FillCPoly" }, + { 0xAA14, "_RGBForeColor" }, + { 0xAA15, "_RGBBackColor" }, + { 0xAA16, "_SetCPixel" }, + { 0xAA17, "_GetCPixel" }, + { 0xAA18, "_GetCTable" }, + { 0xAA19, "_GetForeColor" }, + { 0xAA1A, "_GetBackColor" }, + { 0xAA1B, "_GetCCursor" }, + { 0xAA1C, "_SetCCursor" }, + { 0xAA1D, "_AllocCursor" }, + { 0xAA1E, "_GetCIcon" }, + { 0xAA1F, "_PlotCIcon" }, + { 0xAA20, "_OpenCPicture" }, + { 0xAA21, "_OpColor" }, + { 0xAA22, "_HiliteColor" }, + { 0xAA23, "_CharExtra" }, + { 0xAA24, "_DisposeCTable" }, + { 0xAA25, "_DisposeCIcon" }, + { 0xAA26, "_DisposeCCursor" }, + { 0xAA27, "_GetMaxDevice" }, + { 0xAA28, "_GetCTSeed" }, + { 0xAA29, "_GetDeviceList" }, + { 0xAA2A, "_GetMainDevice" }, + { 0xAA2B, "_GetNextDevice" }, + { 0xAA2C, "_TestDeviceAttribute" }, + { 0xAA2D, "_SetDeviceAttribute" }, + { 0xAA2E, "_InitGDevice" }, + { 0xAA2F, "_NewGDevice" }, + { 0xAA30, "_DisposeGDevice" }, + { 0xAA31, "_SetGDevice" }, + { 0xAA32, "_GetGDevice" }, + { 0xAA35, "_InvertColor" }, + { 0xAA36, "_RealColor" }, + { 0xAA37, "_GetSubTable" }, + { 0xAA38, "_UpdatePixMap" }, + { 0xAA39, "_MakeITable" }, + { 0xAA3A, "_AddSearch" }, + { 0xAA3B, "_AddComp" }, + { 0xAA3C, "_SetClientID" }, + { 0xAA3D, "_ProtectEntry" }, + { 0xAA3E, "_ReserveEntry" }, + { 0xAA3F, "_SetEntries" }, + { 0xAA40, "_QDError" }, + { 0xAA41, "_SetWinColor" }, + { 0xAA42, "_GetAuxWin" }, + { 0xAA43, "_SetControlColor" }, + { 0xAA44, "_GetAuxiliaryControlRecord" }, + { 0xAA45, "_NewCWindow" }, + { 0xAA46, "_GetNewCWindow" }, + { 0xAA47, "_SetDeskCPat" }, + { 0xAA48, "_GetCWMgrPort" }, + { 0xAA49, "_SaveEntries" }, + { 0xAA4A, "_RestoreEntries" }, + { 0xAA4B, "_NewColorDialog" }, + { 0xAA4C, "_DelSearch" }, + { 0xAA4D, "_DelComp" }, + { 0xAA4E, "_SetStdCProcs" }, + { 0xAA4F, "_CalcCMask" }, + { 0xAA50, "_SeedCFill" }, + { 0xAA51, "_CopyDeepMask" }, + { 0xAA52, "_HFSPinaforeDispatch" }, + { 0xAA53, "_DictionaryDispatch" }, + { 0xAA54, "_TextServicesDispatch" }, + { 0xAA56, "_SpeechRecognitionDispatch" }, + { 0xAA57, "_DockingDispatch" }, + { 0xAA59, "_MixedModeDispatch" }, + { 0xAA5A, "_CodeFragmentDispatch" }, + { 0xAA5C, "_OCEUtils" }, + { 0xAA5D, "_DigitalSignature" }, + { 0xAA5E, "_TBDispatch" }, + { 0xAA60, "_DeleteMCEntries" }, + { 0xAA61, "_GetMCInfo" }, + { 0xAA62, "_SetMCInfo" }, + { 0xAA63, "_DisposeMCInfo" }, + { 0xAA64, "_GetMCEntry" }, + { 0xAA65, "_SetMCEntries" }, + { 0xAA66, "_MenuChoice" }, + { 0xAA67, "_ModalDialogMenuSetup" }, + { 0xAA68, "_DialogDispatch" }, + { 0xAA73, "_ControlDispatch" }, + { 0xAA74, "_AppearanceDispatch" }, + { 0xAA7E, "_SysDebugDispatch" }, + { 0xAA80, "_AVLTreeDispatch" }, + { 0xAA81, "_FileMappingDispatch" }, + { 0xAA90, "_InitPalettes" }, + { 0xAA91, "_NewPalette" }, + { 0xAA92, "_GetNewPalette" }, + { 0xAA93, "_DisposePalette" }, + { 0xAA94, "_ActivatePalette" }, + { 0xAA95, "_NSetPalette" }, + { 0xAA96, "_GetPalette" }, + { 0xAA97, "_PmForeColor" }, + { 0xAA98, "_PmBackColor" }, + { 0xAA99, "_AnimateEntry" }, + { 0xAA9A, "_AnimatePalette" }, + { 0xAA9B, "_GetEntryColor" }, + { 0xAA9C, "_SetEntryColor" }, + { 0xAA9D, "_GetEntryUsage" }, + { 0xAA9E, "_SetEntryUsage" }, + { 0xAAA1, "_CopyPalette" }, + { 0xAAA2, "_PaletteDispatch" }, + { 0xAAA3, "_CodecDispatch" }, + { 0xAAA4, "_ALMDispatch" }, + { 0xAADB, "_CursorDeviceDispatch" }, + { 0xAAF2, "_ControlStripDispatch" }, + { 0xAAF3, "_ExpansionManager" }, + { 0xAB1D, "_QDExtensions" }, + { 0xABC3, "_NQDMisc" }, + { 0xABC9, "_IconDispatch" }, + { 0xABCA, "_DeviceLoop" }, + { 0xABEB, "_DisplayDispatch" }, + { 0xABED, "_DragDispatch" }, + { 0xABF1, "_GestaltValueDispatch" }, + { 0xABF2, "_ThreadDispatch" }, + { 0xABF6, "_CollectionMgr" }, + { 0xABF8, "_StdOpcodeProc" }, + { 0xABFC, "_TranslationDispatch" }, + { 0xABFF, "_DebugStr" } + }; + + int i; + + for (i = 0; i < ARRAY_LENGTH(traps); i++) + { + if (traps[i].trap == opcode) + return traps[i].name; + } + return NULL; +} + + + +static offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) +{ + UINT16 opcode; + unsigned result = 0; + const char *trap; + + opcode = oprom[0]<<8 | oprom[1]; + if ((opcode & 0xF000) == 0xA000) + { + trap = lookup_trap(opcode); + if (trap) + { + strcpy(buffer, trap); + result = 2; + } + } + return result; +} + + + +#ifdef MAC_TRACETRAP +void mac_state::mac_tracetrap(const char *cpu_name_local, int addr, int trap) +{ + struct sonycscodeentry + { + int csCode; + const char *name; + }; + + static const sonycscodeentry cscodes[] = + { + { 1, "KillIO" }, + { 5, "VerifyDisk" }, + { 6, "FormatDisk" }, + { 7, "EjectDisk" }, + { 8, "SetTagBuffer" }, + { 9, "TrackCacheControl" }, + { 23, "ReturnDriveInfo" } + }; + + static const char *const scsisels[] = + { + "SCSIReset", /* $00 */ + "SCSIGet", /* $01 */ + "SCSISelect", /* $02 */ + "SCSICmd", /* $03 */ + "SCSIComplete", /* $04 */ + "SCSIRead", /* $05 */ + "SCSIWrite", /* $06 */ + NULL, /* $07 */ + "SCSIRBlind", /* $08 */ + "SCSIWBlind", /* $09 */ + "SCSIStat", /* $0A */ + "SCSISelAtn", /* $0B */ + "SCSIMsgIn", /* $0C */ + "SCSIMsgOut", /* $0D */ + }; + + int i, a0, a7, d0, d1; + int csCode, ioVRefNum, ioRefNum, ioCRefNum, ioCompletion, ioBuffer, ioReqCount, ioPosOffset; + char *s; + unsigned char *mem; + char buf[256]; + const char *trapstr; + + trapstr = lookup_trap(trap); + if (trapstr) + strcpy(buf, trapstr); + else + sprintf(buf, "Trap $%04x", trap); + + s = &buf[strlen(buf)]; + mem = mac_ram_ptr; + a0 = M68K_A0); + a7 = cpu_get_reg(M68K_A7); + d0 = cpu_get_reg(M68K_D0); + d1 = cpu_get_reg(M68K_D1); + + switch(trap) + { + case 0xa004: /* _Control */ + ioVRefNum = *((INT16*) (mem + a0 + 22)); + ioCRefNum = *((INT16*) (mem + a0 + 24)); + csCode = *((UINT16*) (mem + a0 + 26)); + sprintf(s->state().state_int(" ioVRefNum=%i ioCRefNum=%i csCode=%i", ioVRefNum, ioCRefNum, csCode); + + for (i = 0; i < ARRAY_LENGTH(cscodes); i++) + { + if (cscodes[i].csCode == csCode) + { + strcat(s, "="); + strcat(s, cscodes[i].name); + break; + } + } + break; + + case 0xa002: /* _Read */ + ioCompletion = (*((INT16*) (mem + a0 + 12)) << 16) + *((INT16*) (mem + a0 + 14)); + ioVRefNum = *((INT16*) (mem + a0 + 22)); + ioRefNum = *((INT16*) (mem + a0 + 24)); + ioBuffer = (*((INT16*) (mem + a0 + 32)) << 16) + *((INT16*) (mem + a0 + 34)); + ioReqCount = (*((INT16*) (mem + a0 + 36)) << 16) + *((INT16*) (mem + a0 + 38)); + ioPosOffset = (*((INT16*) (mem + a0 + 46)) << 16) + *((INT16*) (mem + a0 + 48)); + sprintf(s, " ioCompletion=0x%08x ioVRefNum=%i ioRefNum=%i ioBuffer=0x%08x ioReqCount=%i ioPosOffset=%i", + ioCompletion, ioVRefNum, ioRefNum, ioBuffer, ioReqCount, ioPosOffset); + break; + + case 0xa04e: /* _AddDrive */ + sprintf(s, " drvrRefNum=%i drvNum=%i qEl=0x%08x", (int) (INT16) d0, (int) (INT16) d1, a0); + break; + + case 0xa9a0: /* _GetResource */ + /* HACKHACK - the 'type' output assumes that the host is little endian + * since this is just trace code it isn't much of an issue + */ + sprintf(s, " type='%c%c%c%c' id=%i", (char) mem[a7+3], (char) mem[a7+2], + (char) mem[a7+5], (char) mem[a7+4], *((INT16*) (mem + a7))); + break; + + case 0xa815: /* _SCSIDispatch */ + i = *((UINT16*) (mem + a7)); + if (i < ARRAY_LENGTH(scsisels)) + if (scsisels[i]) + sprintf(s, " (%s)", scsisels[i]); + break; + } + + logerror("mac_trace_trap: %s at 0x%08x: %s\n",cpu_name_local, addr, buf); +} +#endif diff --git a/src/mame/machine/macadb.c b/src/mame/machine/macadb.c new file mode 100644 index 00000000000..76a8a010b57 --- /dev/null +++ b/src/mame/machine/macadb.c @@ -0,0 +1,1430 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + macadb.c - handles various aspects of ADB on the Mac. + +***************************************************************************/ + +#include "emu.h" +#include "includes/mac.h" + +#define LOG_ADB 0 +#define LOG_ADB_MCU_CMD 0 +#define LOG_ADB_TALK_LISTEN 0 + +// ADB states +#define ADB_STATE_NEW_COMMAND (0) +#define ADB_STATE_XFER_EVEN (1) +#define ADB_STATE_XFER_ODD (2) +#define ADB_STATE_IDLE (3) +#define ADB_STATE_NOTINIT (4) + +// ADB commands +#define ADB_CMD_RESET (0) +#define ADB_CMD_FLUSH (1) + +// ADB line states +enum +{ + // receive states + LST_IDLE = 0, + LST_ATTENTION, + LST_BIT0, + LST_BIT1, + LST_BIT2, + LST_BIT3, + LST_BIT4, + LST_BIT5, + LST_BIT6, + LST_BIT7, + LST_TSTOP, + LST_WAITT1T, + LST_RCVSTARTBIT, + LST_SRQNODATA, + + // send states + LST_TSTOPSTART, + LST_TSTOPSTARTa, + LST_STARTBIT, + LST_SENDBIT0, + LST_SENDBIT0a, + LST_SENDBIT1, + LST_SENDBIT1a, + LST_SENDBIT2, + LST_SENDBIT2a, + LST_SENDBIT3, + LST_SENDBIT3a, + LST_SENDBIT4, + LST_SENDBIT4a, + LST_SENDBIT5, + LST_SENDBIT5a, + LST_SENDBIT6, + LST_SENDBIT6a, + LST_SENDBIT7, + LST_SENDBIT7a, + LST_SENDSTOP, + LST_SENDSTOPa +}; + +/* ************************************************************************* + * High-level ADB primitives used by all lower-level implementations + * *************************************************************************/ + +#if LOG_ADB +static const char *const adb_statenames[4] = { "NEW", "EVEN", "ODD", "IDLE" }; +#endif + +int mac_state::adb_pollkbd(int update) +{ + int i, j, keybuf, report, codes[2], result; + ioport_port *ports[6] = { m_key0, m_key1, m_key2, m_key3, m_key4, m_key5 }; + + codes[0] = codes[1] = 0xff; // key up + report = result = 0; + + for (i = 0; i < 6; i++) + { + keybuf = ports[i]->read(); + + // any changes in this row? + if ((keybuf != m_key_matrix[i]) && (report < 2)) + { + // check each column bit + for (j=0; j<16; j++) + { + if (((keybuf ^ m_key_matrix[i]) >> j) & 1) + { + // update m_key_matrix + if (update) + { + m_key_matrix[i] = (m_key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j)); + } + + codes[report] = (i<<4)|j; + + // key up? + if (!(keybuf & (1 << j))) + { + codes[report] |= 0x80; + } + + // update modifier state + if (update) + { + if (((i<<4)|j) == 0x39) + { + if (codes[report] & 0x80) + { + m_adb_modifiers &= ~0x20; + } + else + { + m_adb_modifiers |= 0x20; + } + } + if (((i<<4)|j) == 0x36) + { + if (codes[report] & 0x80) + { + m_adb_modifiers &= ~0x8; + } + else + { + m_adb_modifiers |= 0x08; + } + } + if (((i<<4)|j) == 0x38) + { + if (codes[report] & 0x80) + { + m_adb_modifiers &= ~0x4; + } + else + { + m_adb_modifiers |= 0x04; + } + } + if (((i<<4)|j) == 0x3a) + { + if (codes[report] & 0x80) + { + m_adb_modifiers &= ~0x2; + } + else + { + m_adb_modifiers |= 0x02; + } + } + if (((i<<4)|j) == 0x37) + { + if (codes[report] & 0x80) + { + m_adb_modifiers &= ~0x1; + } + else + { + m_adb_modifiers |= 0x01; + } + } + } + + // we run out of keys we can track? + report++; + if (report == 2) + { + break; + } + } + } + + // we run out of keys we can track? + if (report == 2) + { + break; + } + } + } + +// printf("ADB keyboard: update %d keys %02x %02x\n", update, codes[0], codes[1]); + + // figure out if there was a change + if ((m_adb_currentkeys[0] != codes[0]) || (m_adb_currentkeys[1] != codes[1])) + { + result = 1; + + // if we want to update the current read, do so + if (update) + { + if(m_adb_currentkeys[0] != codes[0]) { + m_adb_keybuf[m_adb_keybuf_end] = codes[0]; + m_adb_keybuf_end = (m_adb_keybuf_end+1) % kADBKeyBufSize; + } + if(m_adb_currentkeys[1] != codes[1]) { + m_adb_keybuf[m_adb_keybuf_end] = codes[1]; + m_adb_keybuf_end = (m_adb_keybuf_end+1) % kADBKeyBufSize; + } + m_adb_currentkeys[0] = codes[0]; + m_adb_currentkeys[1] = codes[1]; + } + } + + return result; +} + +int mac_state::adb_pollmouse() +{ + int NewX, NewY, NewButton; + + if (!m_adb_mouse_initialized) + { + return 0; + } + + NewButton = m_mouse0->read() & 0x01; + NewX = m_mouse2->read(); + NewY = m_mouse1->read(); + + if ((NewX != m_adb_lastmousex) || (NewY != m_adb_lastmousey) || (NewButton != m_adb_lastbutton)) + { + return 1; + } + + return 0; +} + +void mac_state::adb_accummouse( UINT8 *MouseX, UINT8 *MouseY ) +{ + int MouseCountX = 0, MouseCountY = 0; + int NewX, NewY; + + NewX = ioport("MOUSE2")->read(); + NewY = ioport("MOUSE1")->read(); + + /* see if it moved in the x coord */ + if (NewX != m_adb_lastmousex) + { + int diff = NewX - m_adb_lastmousex; + + /* check for wrap */ + if (diff > 0x80) + diff = 0x100-diff; + if (diff < -0x80) + diff = -0x100-diff; + + MouseCountX += diff; + m_adb_lastmousex = NewX; + } + + /* see if it moved in the y coord */ + if (NewY != m_adb_lastmousey) + { + int diff = NewY - m_adb_lastmousey; + + /* check for wrap */ + if (diff > 0x80) + diff = 0x100-diff; + if (diff < -0x80) + diff = -0x100-diff; + + MouseCountY += diff; + m_adb_lastmousey = NewY; + } + + m_adb_lastbutton = m_mouse0->read() & 0x01; + + *MouseX = (UINT8)MouseCountX; + *MouseY = (UINT8)MouseCountY; +} + +void mac_state::adb_talk() +{ + int addr, reg; + + addr = (m_adb_command>>4); + reg = (m_adb_command & 3); + +// printf("Mac sent %x (cmd %d addr %d reg %d mr %d kr %d)\n", mac->m_adb_command, (mac->m_adb_command>>2)&3, addr, reg, m_adb_mouseaddr, m_adb_keybaddr); + + if (m_adb_waiting_cmd) + { + switch ((m_adb_command>>2)&3) + { + case 0: + case 1: + switch (reg) + { + case ADB_CMD_RESET: + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("ADB RESET: reg %x address %x\n", reg, addr); + #endif + m_adb_direction = 0; + m_adb_send = 0; + break; + + case ADB_CMD_FLUSH: + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("ADB FLUSH: reg %x address %x\n", reg, addr); + #endif + + m_adb_direction = 0; + m_adb_send = 0; + break; + + default: // reserved/unused + break; + } + break; + + case 2: // listen + m_adb_datasize = 0; + if ((addr == m_adb_keybaddr) || (addr == m_adb_mouseaddr)) + { + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("ADB LISTEN: reg %x address %x\n", reg, addr); + #endif + m_adb_direction = 1; // input from Mac + m_adb_command = 0; + m_adb_listenreg = reg; + m_adb_listenaddr = addr; + if ((ADB_IS_EGRET) || (ADB_IS_CUDA)) + { + m_adb_stream_ptr = 0; + memset(m_adb_buffer, 0, sizeof(m_adb_buffer)); + } + } + else + { + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("ADB LISTEN to unknown device, timing out\n"); + #endif + m_adb_direction = 0; + } + break; + + case 3: // talk + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("ADB TALK: reg %x address %x (K %x M %x)\n", reg, addr, m_adb_keybaddr, m_adb_mouseaddr); + #endif + + // keep track of what device the Mac last TALKed to + m_adb_last_talk = addr; + + m_adb_direction = 0; // output to Mac + if (addr == m_adb_mouseaddr) + { + UINT8 mouseX, mouseY; + + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("Talking to mouse, register %x\n", reg); + #endif + + switch (reg) + { + // read mouse + case 0: + if (m_adb_srq_switch) + { + m_adb_srq_switch = 0; + mouseX = mouseY = 0; + } + else + { + this->adb_accummouse(&mouseX, &mouseY); + } + m_adb_buffer[0] = (m_adb_lastbutton & 0x01) ? 0x00 : 0x80; + m_adb_buffer[0] |= mouseX & 0x7f; + m_adb_buffer[1] = mouseY & 0x7f; + m_adb_datasize = 2; + break; + + // get ID/handler + case 3: + m_adb_buffer[0] = 0x60 | (m_adb_mouseaddr&0xf); // SRQ enable, no exceptional event + m_adb_buffer[1] = 0x01; // handler 1 + m_adb_datasize = 2; + + m_adb_mouse_initialized = 1; + break; + + default: + break; + } + + if (adb_pollkbd(0)) + { + m_adb_srqflag = true; + } + } + else if (addr == m_adb_keybaddr) + { + int kbd_has_data = 1; + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("Talking to keyboard, register %x\n", reg); + #endif + + switch (reg) + { + // read keyboard + case 0: + if (m_adb_srq_switch) + { + m_adb_srq_switch = 0; + } + else + { + kbd_has_data = this->adb_pollkbd(1); + } + +/* if (m_adb_currentkeys[0] != 0xff) + { + printf("Keys[0] = %02x\n", m_adb_currentkeys[0]); + } + if (m_adb_currentkeys[1] != 0xff) + { + printf("Keys[1] = %02x\n", m_adb_currentkeys[1]); + }*/ + + if(kbd_has_data) + { + if(m_adb_keybuf_start == m_adb_keybuf_end) + { + // printf("%s: buffer empty\n", __func__); + m_adb_buffer[0] = 0xff; + m_adb_buffer[1] = 0xff; + } + else + { + m_adb_buffer[1] = m_adb_keybuf[m_adb_keybuf_start]; + m_adb_keybuf_start = (m_adb_keybuf_start+1) % kADBKeyBufSize; + if(m_adb_keybuf_start != m_adb_keybuf_end) + { + m_adb_buffer[0] = m_adb_keybuf[m_adb_keybuf_start]; + m_adb_keybuf_start = (m_adb_keybuf_start+1) % kADBKeyBufSize; + } + else + { + m_adb_buffer[0] = 0xff; + } + } + m_adb_datasize = 2; + } + break; + + // read modifier keys + case 2: + { + this->adb_pollkbd(1); + m_adb_buffer[0] = m_adb_modifiers; + m_adb_buffer[1] = 0xff; + m_adb_datasize = 2; + } + break; + + // get ID/handler + case 3: + m_adb_buffer[0] = 0x60 | (m_adb_keybaddr&0xf); // SRQ enable, no exceptional event + m_adb_buffer[1] = 0x01; // handler 1 + m_adb_datasize = 2; + + m_adb_keybinitialized = 1; + break; + + default: + break; + } + + if (adb_pollmouse()) + { + m_adb_srqflag = true; + } + } + else + { + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("ADB: talking to unconnected device %d (K %d M %d)\n", addr, m_adb_keybaddr, m_adb_mouseaddr); + #endif + m_adb_buffer[0] = m_adb_buffer[1] = 0; + m_adb_datasize = 0; + + if ((adb_pollkbd(0)) || (adb_pollmouse())) + { + m_adb_srqflag = true; + } + } + break; + } + + m_adb_waiting_cmd = 0; + } + else + { + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("Got LISTEN data %02x %02x for device %x reg %x\n", m_adb_command, m_adb_buffer[1], m_adb_listenaddr, m_adb_listenreg); + #endif + + m_adb_direction = 0; + + if (m_adb_listenaddr == m_adb_mouseaddr) + { + if ((m_adb_listenreg == 3) && (m_adb_command > 0) && (m_adb_command < 16)) + { + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("MOUSE: moving to address %x\n", m_adb_command); + #endif + m_adb_mouseaddr = m_adb_command&0x0f; + } + } + else if (m_adb_listenaddr == m_adb_keybaddr) + { + if ((m_adb_listenreg == 3) && (m_adb_command > 0) && (m_adb_command < 16)) + { + #if LOG_ADB || LOG_ADB_TALK_LISTEN + printf("KEYBOARD: moving to address %x\n", m_adb_command); + #endif + m_adb_keybaddr = m_adb_command&0x0f; + } + } + } +} + +TIMER_CALLBACK(mac_adb_tick) +{ + mac_state *mac = machine.driver_data(); + + if ((ADB_IS_EGRET_NONCLASS) || (ADB_IS_CUDA_NONCLASS)) + { + switch (mac->m_adb_linestate) + { + case LST_SRQNODATA: + mac->set_adb_line(ASSERT_LINE); + mac->m_adb_linestate = LST_IDLE; + break; + + case LST_TSTOPSTART: + mac->set_adb_line(ASSERT_LINE); + mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); + mac->m_adb_linestate++; + break; + + case LST_TSTOPSTARTa: + mac->set_adb_line(CLEAR_LINE); + mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); + mac->m_adb_linestate++; + break; + + case LST_STARTBIT: + mac->set_adb_line(ASSERT_LINE); + mac->m_adb_timer->adjust(attotime::from_ticks(105, 1000000)); + mac->m_adb_linestate++; + break; + + case LST_SENDBIT0: + case LST_SENDBIT1: + case LST_SENDBIT2: + case LST_SENDBIT3: + case LST_SENDBIT4: + case LST_SENDBIT5: + case LST_SENDBIT6: + case LST_SENDBIT7: + mac->set_adb_line(CLEAR_LINE); + if (mac->m_adb_buffer[mac->m_adb_stream_ptr] & 0x80) + { +// printf("1 "); + mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); + } + else + { +// printf("0 "); + mac->m_adb_timer->adjust(attotime::from_ticks(105, 1000000)); + } + mac->m_adb_linestate++; + break; + + case LST_SENDBIT0a: + case LST_SENDBIT1a: + case LST_SENDBIT2a: + case LST_SENDBIT3a: + case LST_SENDBIT4a: + case LST_SENDBIT5a: + case LST_SENDBIT6a: + mac->set_adb_line(ASSERT_LINE); + if (mac->m_adb_buffer[mac->m_adb_stream_ptr] & 0x80) + { + mac->m_adb_timer->adjust(attotime::from_ticks(105, 1000000)); + } + else + { + mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); + } + mac->m_adb_buffer[mac->m_adb_stream_ptr] <<= 1; + mac->m_adb_linestate++; + break; + + case LST_SENDBIT7a: + mac->set_adb_line(ASSERT_LINE); + if (mac->m_adb_buffer[mac->m_adb_stream_ptr] & 0x80) + { +// printf(" "); + mac->m_adb_timer->adjust(attotime::from_ticks(105, 1000000)); + } + else + { +// printf(" "); + mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); + } + + mac->m_adb_stream_ptr++; + if (mac->m_adb_stream_ptr == mac->m_adb_datasize) + { + mac->m_adb_linestate++; + } + else + { + mac->m_adb_linestate = LST_SENDBIT0; + } + break; + + case LST_SENDSTOP: + mac->set_adb_line(CLEAR_LINE); + mac->m_adb_timer->adjust(attotime::from_ticks((57*2), 1000000)); + mac->m_adb_linestate++; + break; + + case LST_SENDSTOPa: + mac->set_adb_line(ASSERT_LINE); + mac->m_adb_timer->adjust(attotime::never); + mac->m_adb_linestate = LST_IDLE; + break; + } + } + else + { + // do one clock transition on CB1 to advance the VIA shifter + mac->m_adb_extclock ^= 1; + mac->m_via1->write_cb1(mac->m_adb_extclock); + + if (mac->m_adb_direction) + { + mac->m_adb_command <<= 1; + } + else + { + mac->m_via1->write_cb2((mac->m_adb_send & 0x80)>>7); + mac->m_adb_send <<= 1; + } + + mac->m_adb_extclock ^= 1; + mac->m_via1->write_cb1(mac->m_adb_extclock); + + mac->m_adb_timer_ticks--; + if (!mac->m_adb_timer_ticks) + { + mac->m_adb_timer->adjust(attotime::never); + + if ((mac->m_adb_direction) && (ADB_IS_BITBANG)) + { + mac->adb_talk(); + if((mac->m_adb_last_talk == 2) && mac->m_adb_datasize) { + mac->m_adb_timer_ticks = 8; + mac->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + } + } + } + else + { + mac->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + } + } +} + +void mac_state::mac_adb_newaction(int state) +{ + if (state != m_adb_state) + { + #if LOG_ADB + printf("New ADB state: %s\n", adb_statenames[state]); + #endif + + m_adb_state = state; + m_adb_timer_ticks = 8; + + switch (state) + { + case ADB_STATE_NEW_COMMAND: + m_adb_command = m_adb_send = 0; + m_adb_direction = 1; // Mac is shifting us a command + m_adb_waiting_cmd = 1; // we're going to get a command + m_adb_irq_pending = 0; + m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + break; + + case ADB_STATE_XFER_EVEN: + case ADB_STATE_XFER_ODD: + if (m_adb_datasize > 0) + { + int i; + + // is something trying to send to the Mac? + if (m_adb_direction == 0) + { + // set up the byte + m_adb_send = m_adb_buffer[0]; + m_adb_datasize--; + + // move down the rest of the buffer, if any + for (i = 0; i < m_adb_datasize; i++) + { + m_adb_buffer[i] = m_adb_buffer[i+1]; + } + } + + } + else + { + m_adb_send = 0; + m_adb_irq_pending = 1; + } + + m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + break; + + case ADB_STATE_IDLE: + m_adb_irq_pending = 0; + break; + } + } +} + +TIMER_CALLBACK(mac_pmu_tick) +{ + mac_state *mac = machine.driver_data(); + + // state 10 means this is in response to an ADB command + if (mac->m_pm_state == 10) + { + #if LOG_ADB + printf("PM: was state 10, chunk-chunking CB1\n"); + #endif + mac->m_pm_state = 0; + + // tick CB1, which should cause a PMU interrupt on PMU machines + mac->m_adb_extclock ^= 1; + mac->m_via1->write_cb1(mac->m_adb_extclock); + mac->m_adb_extclock ^= 1; + mac->m_via1->write_cb1(mac->m_adb_extclock); + } + else + { + #if LOG_ADB + printf("PM: timer tick, lowering ACK\n"); + #endif + mac->m_pm_ack &= ~2; // lower ACK to handshake next step + } +} + +void mac_state::pmu_one_byte_reply(UINT8 result) +{ + m_pm_out[0] = m_pm_out[1] = 1; // length + m_pm_out[2] = result; + m_pm_slen = 3; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); +} + +void mac_state::pmu_three_byte_reply(UINT8 result1, UINT8 result2, UINT8 result3) +{ + m_pm_out[0] = m_pm_out[1] = 3; // length + m_pm_out[2] = result1; + m_pm_out[3] = result2; + m_pm_out[4] = result3; + m_pm_slen = 5; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); +} + +void mac_state::pmu_exec() +{ + m_pm_sptr = 0; // clear send pointer + m_pm_slen = 0; // and send length + m_pm_dptr = 0; // and receive pointer + +// printf("PMU: Command %02x\n", mac->m_pm_cmd[0]); + switch (m_pm_cmd[0]) + { + case 0x10: // subsystem power and clock ctrl + break; + + case 0x20: // send ADB command (PMU must issue an IRQ on completion) + #if 0 + printf("PMU: Send ADB %02x %02x cmd %02x flag %02x data %02x %02x\n", + m_pm_cmd[0], // 0x20 + m_pm_cmd[1], // ??? + m_pm_cmd[2], // adb flags (2 for autopoll active, 3 to reset bus?) + m_pm_cmd[3], // length of ADB data + m_pm_cmd[4], // adb data + m_pm_cmd[5]); + #endif + + #if 0 + m_pm_state = 10; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + if (ADB_IS_PM_VIA1_CLASS) + { + m_pmu_int_status = 0x1; + } + else if (ADB_IS_PM_VIA2_CLASS) + { + m_pmu_int_status = 0x10; + } + else + { + fatalerror("mac: unknown ADB PMU type\n"); + } + m_pmu_last_adb_command = m_pm_cmd[2]; + m_adb_command = m_pm_cmd[2]; + m_adb_waiting_cmd = 1; + adb_talk(); + + if ((m_pm_cmd[2] & 0xf) == 0xb) // LISTEN register 3 (remap) + { + m_adb_waiting_cmd = 0; + m_adb_command = mac->m_pm_cmd[5]; + adb_talk(); + } + #else + if (((m_pm_cmd[2] == 0xfc) || (m_pm_cmd[2] == 0x2c)) && (m_pm_cmd[3] == 4)) + { +// printf("PMU: request to poll ADB, returning nothing\n"); + m_pm_slen = 0; + m_pmu_int_status = 0; + } + else + { + m_pm_state = 10; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + if (ADB_IS_PM_VIA1_CLASS) + { + m_pmu_int_status = 0x1; + } + else if (ADB_IS_PM_VIA2_CLASS) + { + m_pmu_int_status = 0x10; + } + else + { + fatalerror("mac: unknown ADB PMU type\n"); + } + m_pmu_last_adb_command = m_pm_cmd[2]; + } + + m_adb_command = m_pm_cmd[2]; + m_adb_waiting_cmd = 1; + adb_talk(); + #endif + break; + + case 0x21: // turn ADB auto-poll off (does this need a reply?) + break; + + case 0x28: // read ADB + if (m_adb_datasize > 0) + { + m_adb_datasize = 1; // hack + + m_pm_out[0] = m_pm_out[1] = 3 + m_adb_datasize; + m_pm_out[2] = 0; +// m_pm_out[3] = m_pmu_last_adb_command; + m_pm_out[3] = 0; + m_pm_out[4] = m_adb_datasize; + for (int i = 0; i < m_adb_datasize; i++) + { + m_pm_out[5+i] = 0; //mac->m_adb_buffer[i]; + } + m_pm_slen = 5 + m_adb_datasize; + } + else + { + m_pm_out[0] = m_pm_out[1] = 4; + m_pm_out[2] = 0; + m_pm_out[3] = 0; +// m_pm_out[3] = m_pmu_last_adb_command; + m_pm_out[4] = 1; // length of following data + m_pm_out[5] = 0; + m_pm_slen = 6; + } +/* printf("ADB packet: "); + for (int i = 0; i < m_pm_slen; i++) + { + printf("%02x ", m_pm_out[i]); + } + printf("\n");*/ + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(1000))); + break; + + case 0x31: // write first 20 bytes of PRAM + { + for (int i = 0; i < 20; i++) + { + m_adb_pram[i] = m_pm_cmd[1+i]; + } + } + break; + + case 0x32: // write extended PRAM byte(s). cmd[2] = address, cmd[3] = length, cmd[4...] = data + if ((m_pm_cmd[2] + m_pm_cmd[3]) < 0x100) + { + int i; + + for (i = 0; i < m_pm_cmd[3]; i++) + { + m_adb_pram[m_pm_cmd[2] + i] = m_pm_cmd[4+i]; + } + } + break; + + case 0x38: // read time + { + m_pm_out[0] = m_pm_out[1] = 4; + m_pm_out[2] = 0x63; // famous Mac RTC value of 8/27/56 8:35:00 PM + m_pm_out[3] = 0x0b; + m_pm_out[4] = 0xd1; + m_pm_out[5] = 0x78; + m_pm_slen = 6; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + } + break; + + case 0x39: // read first 20 bytes of PRAM + { + int i; + + m_pm_out[0] = m_pm_out[1] = 20; + for (i = 0; i < 20; i++) + { + m_pm_out[2 + i] = m_adb_pram[i]; + } + m_pm_slen = 22; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + } + break; + + case 0x3a: // read extended PRAM byte(s). cmd[2] = address, cmd[3] = length + if ((m_pm_cmd[2] + m_pm_cmd[3]) < 0x100) + { + int i; + + m_pm_out[0] = m_pm_out[1] = m_pm_cmd[3]; + for (i = 0; i < m_pm_cmd[3]; i++) + { + m_pm_out[2 + i] = m_adb_pram[m_pm_cmd[2] + i]; + } + m_pm_slen = m_pm_out[0] + 2; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + } + break; + + case 0x40: // set screen contrast + break; + + case 0x41: + break; + + case 0x58: // read internal modem status + pmu_one_byte_reply(0); + break; + + case 0x60: // set low power warning and cutoff battery levels + break; + + case 0x68: // read battery/charger level + pmu_three_byte_reply(255, 255, 255); + break; + + case 0x69: // read battery/charger instantaneous level and status + pmu_three_byte_reply(255, 255, 255); + break; + + case 0x6b: // read extended battery/charger level and status (wants an 8 byte reply) + m_pm_out[0] = m_pm_out[1] = 8; // length + m_pm_out[2] = 255; + m_pm_out[3] = 255; + m_pm_out[4] = 255; + m_pm_out[5] = 255; + m_pm_out[6] = 255; + m_pm_out[7] = 255; + m_pm_out[8] = 255; + m_pm_out[9] = 255; + m_pm_slen = 10; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + break; + + case 0x6c: // read battery ID + pmu_one_byte_reply(1); + break; + + case 0x78: // read interrupt flag + if (ADB_IS_PM_VIA2_CLASS) // PB 140/170 use a "leaner" PMU protocol where you get the data for a PMU interrupt here + { + #if 0 + if ((m_pmu_int_status&0xf0) == 0x10) + { + if (m_adb_datasize > 0) + { + m_adb_datasize = 1; // hack + m_pm_out[0] = m_pm_out[1] = 2 + m_adb_datasize; + m_pm_out[2] = m_pmu_int_status; // ADB status in low nibble + m_pm_out[3] = m_pmu_last_adb_command; // ADB command that was sent + for (int i = 0; i < m_adb_datasize; i++) + { + m_pm_out[4+i] = 0; //m_adb_buffer[i]; + } + m_pm_slen = 4 + m_adb_datasize; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(1500))); + +/* printf("ADB packet: "); + for (int i = 0; i < m_pm_slen; i++) + { + printf("%02x ", m_pm_out[i]); + } + printf("\n");*/ + } + else + { + m_pm_out[0] = m_pm_out[1] = 2; + m_pm_out[2] = m_pmu_int_status; // ADB status in low nibble + m_pm_out[3] = m_pmu_last_adb_command; // ADB command that was sent OR 0x80 for extra error-ness + m_pm_out[4] = 0; // return data + m_pm_slen = 4; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(1500))); + } + } + else + { + pmu_one_byte_reply(mac, m_pmu_int_status); + } + #else + if ((m_pmu_int_status&0xf0) == 0x10) + { + m_pm_out[0] = m_pm_out[1] = 2; + m_pm_out[2] = m_pmu_int_status; // ADB status in low nibble + m_pm_out[3] = m_pmu_last_adb_command; // ADB command that was sent OR 0x80 for extra error-ness + m_pm_out[4] = 0; // return data + m_pm_slen = 4; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(1500))); + } + else + { + pmu_one_byte_reply(m_pmu_int_status); + } + #endif + } + else + { + pmu_one_byte_reply(m_pmu_int_status); + } + + m_pmu_int_status = 0; + break; + + case 0x90: // sound power control + break; + + case 0x98: // read sound power state + pmu_one_byte_reply(1); + break; + + case 0xd8: // read A/D converter (not sure what this does) + pmu_one_byte_reply(0); + break; + + case 0xe0: // write PMU internal RAM + break; + + case 0xe8: // read PMU internal RAM (just return zeroes) + { + int i; + + m_pm_out[0] = m_pm_out[1] = m_pm_cmd[4]; +// printf("PMU read at %x\n", m_pm_cmd[2] | (m_pm_cmd[3]<<8)); + + // note: read at 0xEE00 0 = target disk mode, 0xff = normal bootup + // (actually 0x00EE, the 50753 port 6) + + for (i = 0; i < m_pm_cmd[4]; i++) + { + m_pm_out[2 + i] = 0xff; + } + m_pm_slen = m_pm_out[0] + 2; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + } + break; + + case 0xec: // PMU self-test (send 1 count byte + reply) + pmu_one_byte_reply(0); + break; + + default: + fatalerror("PMU: Unhandled command %02x\n", m_pm_cmd[0]); + } + + if (m_pm_slen > 0) + { + m_pm_state = 1; + } +} + +void mac_state::adb_vblank() +{ + if ((m_adb_state == ADB_STATE_IDLE) || ((ADB_IS_PM_CLASS) && (m_pmu_poll))) + { + if (this->adb_pollmouse()) + { + // if the mouse was the last TALK, we can just send the new data + // otherwise we need to pull SRQ + if ((m_adb_last_talk == m_adb_mouseaddr) && !(ADB_IS_PM_CLASS)) + { + // repeat last TALK to get updated data + m_adb_waiting_cmd = 1; + this->adb_talk(); + + m_adb_timer_ticks = 8; + this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + } + #if 0 + else if (ADB_IS_PM_CLASS) + { + m_adb_waiting_cmd = 1; + this->adb_talk(); + m_pm_state = 10; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + if (ADB_IS_PM_VIA1_CLASS) + { + m_pmu_int_status = 0x1; + } + else if (ADB_IS_PM_VIA2_CLASS) + { + m_pmu_int_status = 0x10; + } + } + #endif + else + { + m_adb_irq_pending = 1; + m_adb_command = m_adb_send = 0; + m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ + this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + m_adb_srq_switch = 1; + } + } + else if (this->adb_pollkbd(0)) + { + if ((m_adb_last_talk == m_adb_keybaddr) && !(ADB_IS_PM_CLASS)) + { + // repeat last TALK to get updated data + m_adb_waiting_cmd = 1; + this->adb_talk(); + + m_adb_timer_ticks = 8; + this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + } + #if 0 + else if (ADB_IS_PM_CLASS) + { + m_adb_waiting_cmd = 1; + this->adb_talk(); + m_pm_state = 10; + m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); + m_pmu_int_status = 0x1; + } + #endif + else + { + m_adb_irq_pending = 1; + m_adb_command = m_adb_send = 0; + m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ + this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); + m_adb_srq_switch = 1; + } + } + } +} + +void mac_state::adb_reset() +{ + int i; + + m_adb_srq_switch = 0; + m_adb_irq_pending = 0; // no interrupt + m_adb_timer_ticks = 0; + m_adb_command = 0; + m_adb_extclock = 0; + m_adb_send = 0; + m_adb_waiting_cmd = 0; + m_adb_streaming = MCU_STREAMING_NONE; + m_adb_state = 0; + m_adb_srqflag = false; + m_pmu_poll = 0; + if (ADB_IS_BITBANG_CLASS) + { + m_adb_state = ADB_STATE_NOTINIT; + } + m_adb_direction = 0; + m_adb_datasize = 0; + m_adb_last_talk = -1; + + m_adb_linestate = 0; + + // mouse + m_adb_mouseaddr = 3; + m_adb_lastmousex = m_adb_lastmousey = m_adb_lastbutton = 0; + m_adb_mouse_initialized = 0; + + // keyboard + m_adb_keybaddr = 2; + m_adb_keybinitialized = 0; + m_adb_currentkeys[0] = m_adb_currentkeys[1] = 0xff; + m_adb_modifiers = 0xff; + for (i=0; i<7; i++) + { + m_key_matrix[i] = 0; + } + m_adb_keybuf_start = 0; + m_adb_keybuf_end = 0; +} + +WRITE_LINE_MEMBER(mac_state::adb_linechange_w) +{ + int dtime = 0; +/* static const char *states[] = + { + "idle", + "attention", + "bit0", + "bit1", + "bit2", + "bit3", + "bit4", + "bit5", + "bit6", + "bit7", + "tstop", + "waitt1t", + "rcvstartbit", + "srqnodata" + };*/ + + if (ADB_IS_EGRET) + { + dtime = m_egret->get_adb_dtime(); + } + else if (ADB_IS_CUDA) + { + dtime = m_cuda->get_adb_dtime(); + } + +/* if (m_adb_linestate <= 12) + { + printf("linechange: %d -> %d, time %d (state %d = %s)\n", state^1, state, dtime, m_adb_linestate, states[m_adb_linestate]); + } + else + { + printf("linechange: %d -> %d, time %d (state %d)\n", state^1, state, dtime, m_adb_linestate); + }*/ + + if ((m_adb_direction) && (m_adb_linestate == LST_TSTOP)) + { + if (m_adb_stream_ptr & 1) // odd byte, can't end here + { +// printf("critical linechange: odd, cont\n"); + m_adb_linestate = LST_BIT0; + } + else + { + if (dtime < 90) + { +// printf("critical linechange: even, and it's another bit\n"); + m_adb_linestate = LST_BIT0; + } + } + } + + switch (m_adb_linestate) + { + case LST_IDLE: + if ((state) && (dtime >= 4500)) // reset + { +// printf("ADB RESET\n"); + } + else if ((state) && (dtime >= 1200)) // attention + { +// printf("ADB ATTENTION\n"); + m_adb_waiting_cmd = 1; + m_adb_direction = 0; + m_adb_linestate++; + } + break; + + case LST_ATTENTION: + if ((!state) && (dtime >= 90)) // Tsync + { +// printf("ADB Tsync\n"); + m_adb_command = 0; + m_adb_linestate++; + } + break; + + case LST_BIT0: + case LST_BIT1: + case LST_BIT2: + case LST_BIT3: + case LST_BIT4: + case LST_BIT5: + case LST_BIT6: + case LST_BIT7: + if (!state) + { + if (dtime >= 90) // "1" bit + { + m_adb_command |= 1; + } +// printf("ADB bit %d\n", m_adb_command & 1); + + if (m_adb_linestate != LST_BIT7) + { + m_adb_command <<= 1; + } + else + { + if (m_adb_direction) + { +// printf("listen byte[%d] = %02x\n", m_adb_stream_ptr, m_adb_command); + m_adb_buffer[m_adb_stream_ptr++] = m_adb_command; + m_adb_command = 0; + } + } + + m_adb_linestate++; + } + break; + + case LST_TSTOP: + if (state) + { +// printf("ADB TSTOP, command byte %02x\n", m_adb_command); + + if (m_adb_direction) + { + m_adb_command = m_adb_buffer[0]; + } + + m_adb_srqflag = false; + adb_talk(); + + if (!m_adb_srqflag) + { + set_adb_line(ASSERT_LINE); + } + else + { + set_adb_line(CLEAR_LINE); + } + + if (m_adb_datasize > 0) + { +/* printf("Device has %d bytes of data: ", m_adb_datasize); + for (int i = 0; i < m_adb_datasize; i++) + { + printf("%02x ", m_adb_buffer[i]); + }*/ + m_adb_linestate = LST_TSTOPSTART; // T1t + m_adb_timer->adjust(attotime::from_ticks(324/4, 1000000)); + m_adb_stream_ptr = 0; + } + else if (m_adb_direction) // if direction is set, we LISTENed to a valid device + { + m_adb_linestate = LST_WAITT1T; + } + else // no valid device targetted, time out + { + if (m_adb_srqflag) + { + m_adb_linestate = LST_SRQNODATA; + m_adb_timer->adjust(attotime::from_ticks(486, 1000000)); // SRQ time + } + else + { + m_adb_linestate = LST_IDLE; + } + } + } + break; + + case LST_WAITT1T: + if ((!state) && (dtime >= 300)) // T1t + { +// printf("ADB T1t\n"); + m_adb_linestate++; + } + break; + + case LST_RCVSTARTBIT: + if ((!state) && (dtime >= 90)) // start + { +// printf("ADB start\n"); + m_adb_linestate = LST_BIT0; + m_adb_command = 0; + } + break; + } +} + +void mac_state::set_adb_line(int linestate) +{ + if (ADB_IS_EGRET) + { + m_egret->set_adb_line(linestate); + } + else if (ADB_IS_CUDA) + { + m_cuda->set_adb_line(linestate); + } +} diff --git a/src/mame/machine/mackbd.c b/src/mame/machine/mackbd.c new file mode 100644 index 00000000000..7244b16866f --- /dev/null +++ b/src/mame/machine/mackbd.c @@ -0,0 +1,329 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/* + Apple Macintosh original/512/Plus keyboard + Emulation by R. Belmont + + Port definitions from "IM Underground Volume 1" + http://bitsavers.org/pdf/apple/mac/IM_Underground_Vol_1_1985.pdf + + Key matrix for keyboard: + + Cols 0 1 2 3 4 5 6 7 8 Rows + G B T 5 0 P ; . n/a 0 + H n/a Y 6 8 I K M Enter 1 + F V R 4 - [ ' N Backsp 2 + D C E 3 7 U J / ` 3 + S X W 2 9 O L , Space 4 + A Z Q 1 = ] Ret \ Tab 5 + + Port 0: + + x------- Clock to Mac + -x------ Caps Lock + --x----- Row 5 readback (tied to Vcc for keypad) + ---x---- Row 4 readback + ----x--- Row 3 readback + -----x-- Row 2 readback + ------x- Row 1 readback + -------x Row 0 readback + + Port 1: + + x------- Column 8 strobe + -x------ Column 7 strobe + --x----- Column 6 strobe + ---x---- Column 5 strobe + ----x--- Column 4 strobe + -----x-- Column 3 strobe + ------x- Column 2 strobe + -------x Column 1 strobe + + Port 2: + x--- Command/Apple + -x-- Shift + --x- Column 0 strobe + ---x Data to Mac + + The T1 line is "Option". + + There is a later M0110 keyboard version which uses a GI PIC1657; we do not have a dump of that version. +*/ + + +#include "emu.h" +#include "mackbd.h" +#include "cpu/mcs48/mcs48.h" + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define MACKBD_CPU_TAG "mackbd" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type MACKBD = &device_creator; + +ROM_START( mackbd ) + ROM_REGION(0x800, MACKBD_CPU_TAG, 0) + // original Mac keyboard and optional external keypad + ROM_LOAD( "ip8021h_2173.bin", 0x000000, 0x000400, CRC(5fbd9a94) SHA1(32a3b58afb445a8675b12a4de3aec2fa00c99222) ) + // Mac Plus all-in-one keyboard (not yet supported) + ROM_LOAD( "341-0332-a.bin", 0x000400, 0x000400, CRC(6554f5b6) SHA1(a80404a122d74721cda13b285c412057c2c78bd7) ) +ROM_END + +//------------------------------------------------- +// ADDRESS_MAP +//------------------------------------------------- + +static ADDRESS_MAP_START( mackbd_map, AS_PROGRAM, 8, mackbd_device ) + AM_RANGE(0x0000, 0x03ff) AM_ROM AM_REGION(MACKBD_CPU_TAG, 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( mackbd_io_map, AS_IO, 8, mackbd_device ) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(p0_r) + AM_RANGE(0x2f, 0x36) AM_WRITE(p0_w) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_r, p2_w) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) +ADDRESS_MAP_END + +//------------------------------------------------- +// MACHINE_CONFIG +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( mackbd ) + MCFG_CPU_ADD(MACKBD_CPU_TAG, I8021, 3000000) // "the approximate clock rate of the MPU is 3 MHz" + MCFG_CPU_PROGRAM_MAP(mackbd_map) + MCFG_CPU_IO_MAP(mackbd_io_map) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( mackbd ) + PORT_START("COL0") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + + PORT_START("COL1") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("COL2") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START("COL3") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + + PORT_START("COL4") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + + PORT_START("COL5") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + + PORT_START("COL6") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') PORT_NAME("Return") + + PORT_START("COL7") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + + PORT_START("COL8") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + + PORT_START("MODS") + PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Option") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Command") PORT_CODE(KEYCODE_LCONTROL) +INPUT_PORTS_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor mackbd_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( mackbd ); +} + +const rom_entry *mackbd_device::device_rom_region() const +{ + return ROM_NAME( mackbd ); +} + +ioport_constructor mackbd_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( mackbd ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// mackbd_device - constructor +//------------------------------------------------- + +mackbd_device::mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MACKBD, "Macintosh keyboard", tag, owner, clock, "mackbd", __FILE__), + m_maincpu(*this, MACKBD_CPU_TAG), + m_clkout_handler(*this), + m_dataout_handler(*this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mackbd_device::device_start() +{ + m_clkout_handler.resolve_safe(); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mackbd_device::device_reset() +{ + p0 = p1 = p2 = 0; + p0 = 0x3f; + data_from_mac = data_to_mac = 0; +} + +void mackbd_device::scan_kbd_col(int col) +{ + char tempcol[8]; + UINT16 keydata; + + // read the selected col + sprintf(tempcol, "COL%d", col); + keydata = ioport(tempcol)->read(); + + p0 &= ~0x3f; + p0 |= (keydata & 0x3f); + + // set modifier bits in p2 + p2 = ioport("MODS")->read() & 0xc; +} + +READ8_MEMBER(mackbd_device::p0_r) +{ + UINT8 ret = p0; + + // capslock + if (ioport("MODS")->read() & 0x1) + { + ret |= 0x40; + } + + return ret; +} + +WRITE8_MEMBER(mackbd_device::p0_w) +{ + if (!(data & 2)) + { + scan_kbd_col(0); + } + + if (data & 0x80) + { + m_clkout_handler(ASSERT_LINE); + } + else + { + m_clkout_handler(CLEAR_LINE); +// machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10)); + } +} + +READ8_MEMBER(mackbd_device::p1_r) +{ + return p1; +} + +WRITE8_MEMBER(mackbd_device::p1_w) +{ + data ^= 0xff; + if (data & 0x01) scan_kbd_col(1); + if (data & 0x02) scan_kbd_col(2); + if (data & 0x04) scan_kbd_col(3); + if (data & 0x08) scan_kbd_col(4); + if (data & 0x10) scan_kbd_col(5); + if (data & 0x20) scan_kbd_col(6); + if (data & 0x40) scan_kbd_col(7); + if (data & 0x80) scan_kbd_col(8); +} + +READ8_MEMBER(mackbd_device::p2_r) +{ + return p2 | data_from_mac; +} + +WRITE8_MEMBER(mackbd_device::p2_w) +{ + // prevent key scan accesses to the port from messing with the data line (how does this work on h/w?) + if (m_maincpu->pc() != 0x19e && m_maincpu->pc() != 0x1a3) + { + data_to_mac = data_from_mac = (data & 1); +// printf("data to/from mac = %d (PC=%x)\n", data_to_mac, m_maincpu->pc()); + } +} + +READ8_MEMBER(mackbd_device::t1_r) +{ + return (ioport("MODS")->read() & 0x2) ? 0xff : 0x00; +} + +WRITE_LINE_MEMBER(mackbd_device::data_w) +{ + data_from_mac = (state == ASSERT_LINE) ? 1 : 0; +} diff --git a/src/mame/machine/mackbd.h b/src/mame/machine/mackbd.h new file mode 100644 index 00000000000..cb8090b9bdb --- /dev/null +++ b/src/mame/machine/mackbd.h @@ -0,0 +1,79 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +#pragma once + +#ifndef __MACKBD_H__ +#define __MACKBD_H__ + +#include "emu.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_MACKBD_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, MACKBD, 0) + +#define MCFG_MACKBD_REPLACE(_tag) \ + MCFG_DEVICE_REPLACE(_tag, MACKBD, 0) + +#define MCFG_MACKBD_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +#define MCFG_MACKBD_CLKOUT_HANDLER(_devcb) \ + devcb = &mackbd_device::set_clkout_handler(*device, DEVCB_##_devcb); + +#define MCFG_MACKBD_DATAOUT_HANDLER(_devcb) \ + devcb = &mackbd_device::set_dataout_handler(*device, DEVCB_##_devcb); + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> mackbd_device + +class mackbd_device : public device_t +{ +public: + // static config helper + template static devcb_base &set_clkout_handler(device_t &device, _Object object) { return downcast(device).m_clkout_handler.set_callback(object); } + template static devcb_base &set_dataout_handler(device_t &device, _Object object) { return downcast(device).m_dataout_handler.set_callback(object); } + + // construction/destruction + mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER(p0_r); + DECLARE_WRITE8_MEMBER(p0_w); + DECLARE_READ8_MEMBER(p1_r); + DECLARE_WRITE8_MEMBER(p1_w); + DECLARE_READ8_MEMBER(p2_r); + DECLARE_WRITE8_MEMBER(p2_w); + DECLARE_READ8_MEMBER(t1_r); + + DECLARE_WRITE_LINE_MEMBER(data_w); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + virtual ioport_constructor device_input_ports() const; + + required_device m_maincpu; + +private: + UINT8 p0, p1, p2, data_from_mac, data_to_mac; + + devcb_write_line m_clkout_handler; + devcb_write_line m_dataout_handler; + + void scan_kbd_col(int col); +}; + +// device type definition +extern const device_type MACKBD; + +#endif diff --git a/src/mame/machine/macpci.c b/src/mame/machine/macpci.c new file mode 100644 index 00000000000..705f686f056 --- /dev/null +++ b/src/mame/machine/macpci.c @@ -0,0 +1,228 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/**************************************************************************** + + machine/pcimac.c + + PCI-based Power Macintosh hardware + + R. Belmont + +****************************************************************************/ + +#include "emu.h" +#include "machine/8530scc.h" +#include "cpu/m68000/m68000.h" +#include "machine/applefdc.h" +#include "machine/sonydriv.h" +#include "includes/macpci.h" +#include "debug/debugcpu.h" +#include "machine/ram.h" +#include "debugger.h" + +#define LOG_ADB 0 +#define LOG_VIA 0 + + + +/* VIA1 Handlers */ + +WRITE_LINE_MEMBER(macpci_state::mac_via_irq) +{ +} + +READ8_MEMBER(macpci_state::mac_via_in_a) +{ +// printf("VIA1 IN_A (PC %x)\n", mac->m_maincpu->pc()); + + return 0x80; +} + +READ8_MEMBER(macpci_state::mac_via_in_b) +{ + int val = 0; + val |= m_cuda->get_treq()<<3; + +// printf("VIA1 IN B = %02x (PC %x)\n", val, m_maincpu->pc()); + + return val; +} + +WRITE8_MEMBER(macpci_state::mac_via_out_a) +{ +// printf("VIA1 OUT A: %02x (PC %x)\n", data, m_maincpu->pc()); +} + +WRITE8_MEMBER(macpci_state::mac_via_out_b) +{ +// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->pc()); + + #if LOG_ADB + printf("PPC: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, m_maincpu->pc()); + #endif + m_cuda->set_byteack((data&0x10) ? 1 : 0); + m_cuda->set_tip((data&0x20) ? 1 : 0); +} + +READ16_MEMBER ( macpci_state::mac_via_r ) +{ + UINT16 data; + + offset >>= 8; + offset &= 0x0f; + + if (LOG_VIA) + printf("mac_via_r: offset=0x%02x (PC=%x)\n", offset, m_maincpu->pc()); + data = m_via1->read(space, offset); + + m_maincpu->adjust_icount(m_via_cycles); + + return data | (data<<8); +} + +WRITE16_MEMBER ( macpci_state::mac_via_w ) +{ + offset >>= 8; + offset &= 0x0f; + + if (LOG_VIA) + printf("mac_via_w: offset=0x%02x data=0x%08x (PC=%x)\n", offset, data, m_maincpu->pc()); + + if (ACCESSING_BITS_0_7) + m_via1->write(space, offset, data & 0xff); + if (ACCESSING_BITS_8_15) + m_via1->write(space, offset, (data >> 8) & 0xff); + + m_maincpu->adjust_icount(m_via_cycles); +} + +READ_LINE_MEMBER(macpci_state::mac_adb_via_in_cb2) +{ + UINT8 ret; + ret = m_cuda->get_via_data(); + #if LOG_ADB + printf("PPC: Read VIA_DATA %x\n", ret); + #endif + + return ret; +} + +WRITE_LINE_MEMBER(macpci_state::mac_adb_via_out_cb2) +{ + m_cuda->set_via_data(state); +} + +void macpci_state::machine_start() +{ + m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macpci_state::mac_6015_tick),this)); + m_6015_timer->adjust(attotime::never); +} + +void macpci_state::machine_reset() +{ + m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); + + m_via_cycles = -256; // for a 66 MHz PowerMac + + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); +} + +WRITE_LINE_MEMBER(macpci_state::cuda_reset_w) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + +WRITE_LINE_MEMBER(macpci_state::cuda_adb_linechange_w) +{ +} + +void macpci_state::mac_driver_init(model_t model) +{ + m_model = model; + + memset(m_ram->pointer(), 0, m_ram->size()); +} + +#define MAC_DRIVER_INIT(label, model) \ +DRIVER_INIT_MEMBER(macpci_state,label) \ +{ \ + mac_driver_init(model ); \ +} + +MAC_DRIVER_INIT(pippin, PCIMODEL_MAC_PIPPIN) + +READ32_MEMBER(macpci_state::mac_read_id) +{ + printf("Mac read ID reg @ PC=%x\n", m_maincpu->pc()); + + switch (m_model) + { + case PCIMODEL_MAC_PIPPIN: + return 0xa55a7001; + + default: + return 0; + } +} + +/* 8530 SCC interface */ + +READ16_MEMBER ( macpci_state::mac_scc_r ) +{ + scc8530_t *scc = space.machine().device("scc"); + UINT16 result; + + result = scc->reg_r(space, offset); + return (result << 8) | result; +} + +WRITE16_MEMBER ( macpci_state::mac_scc_w ) +{ + scc8530_t *scc = space.machine().device("scc"); + scc->reg_w(space, offset, data); +} + +WRITE16_MEMBER ( macpci_state::mac_scc_2_w ) +{ + scc8530_t *scc = space.machine().device("scc"); + scc->reg_w(space, offset, data >> 8); +} + +READ8_MEMBER(macpci_state::mac_5396_r) +{ + if (offset < 0x100) + { + return m_539x_1->read(space, offset>>4); + } + else // pseudo-DMA: read from the FIFO + { + return m_539x_1->read(space, 2); + } + + // never executed + //return 0; +} + +WRITE8_MEMBER(macpci_state::mac_5396_w) +{ + if (offset < 0x100) + { + m_539x_1->write(space, offset>>4, data); + } + else // pseudo-DMA: write to the FIFO + { + m_539x_1->write(space, 2, data); + } +} + +WRITE_LINE_MEMBER(macpci_state::irq_539x_1_w) +{ +} + +WRITE_LINE_MEMBER(macpci_state::drq_539x_1_w) +{ +} + +TIMER_CALLBACK_MEMBER(macpci_state::mac_6015_tick) +{ +} diff --git a/src/mame/machine/macrtc.c b/src/mame/machine/macrtc.c new file mode 100644 index 00000000000..dd047014c0f --- /dev/null +++ b/src/mame/machine/macrtc.c @@ -0,0 +1,365 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + macrtc.c - the real-time clock & NVRAM chip used in early 680x0 Macs, + Apple part numbers 343-0040 (original) and 343-0042 (with extended PRAM) + + The IIgs has this chip also, but the VGC contains a relatively + sophisticated logic block that offloads the low-level serial comms + from the CPU, which makes it look quite different to software. + +***************************************************************************/ + +#include "emu.h" +#include "macrtc.h" + +#ifdef MAME_DEBUG +#define LOG_RTC 0 +#else +#define LOG_RTC 0 +#endif + +enum +{ + RTC_STATE_NORMAL, + RTC_STATE_WRITE, + RTC_STATE_XPCOMMAND, + RTC_STATE_XPWRITE +}; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +// device type definition +const device_type RTC3430042 = &device_creator; + + +//------------------------------------------------- +// rtc4543_device - constructor +//------------------------------------------------- + +rtc3430042_device::rtc3430042_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, RTC3430042, "Apple 343-0042 clock/PRAM", tag, owner, clock, "rtc3430042", __FILE__), + device_rtc_interface(mconfig, *this), + device_nvram_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void rtc3430042_device::device_start() +{ + // allocate timers + m_clock_timer = timer_alloc(); + m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + + // state saving +} + +void rtc3430042_device::device_reset() +{ + set_current_time(machine()); + + m_rtc_rTCEnb = 0; + m_rtc_rTCClk = 0; + m_rtc_bit_count = 0; + m_rtc_data_dir = 0; + m_rtc_data_out = 0; + m_rtc_cmd = 0; + m_rtc_write_protect = 0; + m_rtc_state = 0; + + ce_w(1); + m_rtc_state = RTC_STATE_NORMAL; +} + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void rtc3430042_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + advance_seconds(); +} + +//------------------------------------------------- +// rtc_clock_updated - called by the RTC base class when the time changes +//------------------------------------------------- + +void rtc3430042_device::rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) +{ + struct tm cur_time, mac_reference; + UINT32 seconds; + + cur_time.tm_sec = second; + cur_time.tm_min = minute; + cur_time.tm_hour = hour; + cur_time.tm_mday = day; + cur_time.tm_mon = month-1; + cur_time.tm_year = year+100; // assumes post-2000 current system time + cur_time.tm_isdst = 0; + + /* The count starts on 1st January 1904 */ + mac_reference.tm_sec = 0; + mac_reference.tm_min = 0; + mac_reference.tm_hour = 0; + mac_reference.tm_mday = 1; + mac_reference.tm_mon = 0; + mac_reference.tm_year = 4; + mac_reference.tm_isdst = 0; + + seconds = difftime(mktime(&cur_time), mktime(&mac_reference)); + + if (LOG_RTC) + logerror("second count 0x%lX\n", (unsigned long) seconds); + + m_rtc_seconds[0] = seconds & 0xff; + m_rtc_seconds[1] = (seconds >> 8) & 0xff; + m_rtc_seconds[2] = (seconds >> 16) & 0xff; + m_rtc_seconds[3] = (seconds >> 24) & 0xff; +} + +/* write the rTCEnb state */ +WRITE_LINE_MEMBER( rtc3430042_device::ce_w ) +{ + if (state && (! m_rtc_rTCEnb)) + { + /* rTCEnb goes high (inactive) */ + m_rtc_rTCEnb = 1; + /* abort current transmission */ + m_rtc_data_byte = m_rtc_bit_count = m_rtc_data_dir = m_rtc_data_out = 0; + m_rtc_state = RTC_STATE_NORMAL; + } + else if ((!state) && m_rtc_rTCEnb) + { + /* rTCEnb goes low (active) */ + m_rtc_rTCEnb = 0; + /* abort current transmission */ + m_rtc_data_byte = m_rtc_bit_count = m_rtc_data_dir = m_rtc_data_out = 0; + m_rtc_state = RTC_STATE_NORMAL; + } + + m_rtc_rTCEnb = state; +} + +WRITE_LINE_MEMBER( rtc3430042_device::clk_w ) +{ + if ((!state) && (m_rtc_rTCClk)) + { + rtc_shift_data(m_data_latch & 0x01); + } + + m_rtc_rTCClk = state; +} + +READ_LINE_MEMBER( rtc3430042_device::data_r ) +{ + return m_rtc_data_out; +} + +WRITE_LINE_MEMBER( rtc3430042_device::data_w ) +{ + m_data_latch = state; +} + +/* shift data (called on rTCClk high-to-low transition (?)) */ +void rtc3430042_device::rtc_shift_data(int data) +{ + if (m_rtc_rTCEnb) + /* if enable line inactive (high), do nothing */ + return; + + if (m_rtc_data_dir) + { /* RTC -> VIA transmission */ + m_rtc_data_out = (m_rtc_data_byte >> --m_rtc_bit_count) & 0x01; + if (LOG_RTC) + logerror("RTC shifted new data %d\n", m_rtc_data_out); + } + else + { /* VIA -> RTC transmission */ + m_rtc_data_byte = (m_rtc_data_byte << 1) | (data ? 1 : 0); + + if (++m_rtc_bit_count == 8) + { /* if one byte received, send to command interpreter */ + rtc_execute_cmd(m_rtc_data_byte); + } + } +} + +/* Executes a command. +Called when the first byte after "enable" is received, and when the data byte after a write command +is received. */ +void rtc3430042_device::rtc_execute_cmd(int data) +{ + int i; + + if (LOG_RTC) + printf("rtc_execute_cmd: data=%x, state=%x\n", data, m_rtc_state); + + if (m_rtc_state == RTC_STATE_XPCOMMAND) + { + m_rtc_xpaddr = ((m_rtc_cmd & 7)<<5) | ((data&0x7c)>>2); + if ((m_rtc_cmd & 0x80) != 0) + { + // read command + if (LOG_RTC) + printf("RTC: Reading extended address %x = %x\n", m_rtc_xpaddr, m_pram[m_rtc_xpaddr]); + + m_rtc_data_dir = 1; + m_rtc_data_byte = m_pram[m_rtc_xpaddr]; + m_rtc_state = RTC_STATE_NORMAL; + } + else + { + // write command + m_rtc_state = RTC_STATE_XPWRITE; + m_rtc_data_byte = 0; + m_rtc_bit_count = 0; + } + } + else if (m_rtc_state == RTC_STATE_XPWRITE) + { + if (LOG_RTC) + printf("RTC: writing %x to extended address %x\n", data, m_rtc_xpaddr); + m_pram[m_rtc_xpaddr] = data; + m_rtc_state = RTC_STATE_NORMAL; + } + else if (m_rtc_state == RTC_STATE_WRITE) + { + m_rtc_state = RTC_STATE_NORMAL; + + /* Writing an RTC register */ + i = (m_rtc_cmd >> 2) & 0x1f; + if (m_rtc_write_protect && (i != 13)) + /* write-protection : only write-protect can be written again */ + return; + switch(i) + { + case 0: case 1: case 2: case 3: /* seconds register */ + case 4: case 5: case 6: case 7: /* ??? (not described in IM III) */ + { + /* after various tries, I assumed m_rtc_seconds[4+i] is mapped to m_rtc_seconds[i] */ + if (LOG_RTC) + logerror("RTC clock write, address = %X, data = %X\n", i, (int) m_rtc_data_byte); + m_rtc_seconds[i & 3] = m_rtc_data_byte; + + // TODO: call the base class's time set here + } + break; + + case 8: case 9: case 10: case 11: /* RAM address $10-$13 */ + if (LOG_RTC) + printf("PRAM write, address = %X, data = %X\n", i, (int) m_rtc_data_byte); + m_pram[i] = m_rtc_data_byte; + break; + + case 12: + /* Test register - do nothing */ + if (LOG_RTC) + logerror("RTC write to test register, data = %X\n", (int) m_rtc_data_byte); + break; + + case 13: + /* Write-protect register */ + if (LOG_RTC) + printf("RTC write to write-protect register, data = %X\n", (int) m_rtc_data_byte&0x80); + m_rtc_write_protect = (m_rtc_data_byte & 0x80) ? TRUE : FALSE; + break; + + case 16: case 17: case 18: case 19: /* RAM address $00-$0f */ + case 20: case 21: case 22: case 23: + case 24: case 25: case 26: case 27: + case 28: case 29: case 30: case 31: + if (LOG_RTC) + printf("PRAM write, address = %X, data = %X\n", i, (int) m_rtc_data_byte); + m_pram[i] = m_rtc_data_byte; + break; + + default: + printf("Unknown RTC write command : %X, data = %d\n", (int) m_rtc_cmd, (int) m_rtc_data_byte); + break; + } + } + else + { + // always save this byte to m_rtc_cmd + m_rtc_cmd = m_rtc_data_byte; + + if ((m_rtc_cmd & 0x78) == 0x38) // extended command + { + m_rtc_state = RTC_STATE_XPCOMMAND; + m_rtc_data_byte = 0; + m_rtc_bit_count = 0; + } + else + { + if (m_rtc_cmd & 0x80) + { + m_rtc_state = RTC_STATE_NORMAL; + + /* Reading an RTC register */ + m_rtc_data_dir = 1; + i = (m_rtc_cmd >> 2) & 0x1f; + switch(i) + { + case 0: case 1: case 2: case 3: + case 4: case 5: case 6: case 7: + m_rtc_data_byte = m_rtc_seconds[i & 3]; + if (LOG_RTC) + printf("RTC clock read, address = %X -> data = %X\n", i, m_rtc_data_byte); + break; + + case 8: case 9: case 10: case 11: + if (LOG_RTC) + printf("PRAM read, address = %X data = %x\n", i, m_pram[i]); + m_rtc_data_byte = m_pram[i]; + break; + + case 16: case 17: case 18: case 19: + case 20: case 21: case 22: case 23: + case 24: case 25: case 26: case 27: + case 28: case 29: case 30: case 31: + if (LOG_RTC) + printf("PRAM read, address = %X data = %x\n", i, m_pram[i]); + m_rtc_data_byte = m_pram[i]; + break; + + default: + if (LOG_RTC) + logerror("Unknown RTC read command : %X\n", (int) m_rtc_cmd); + m_rtc_data_byte = 0; + break; + } + } + else + { + /* Writing an RTC register */ + /* wait for extra data byte */ + if (LOG_RTC) + logerror("RTC write, waiting for data byte : %X\n", (int) m_rtc_cmd); + m_rtc_state = RTC_STATE_WRITE; + m_rtc_data_byte = 0; + m_rtc_bit_count = 0; + } + } + } +} + +void rtc3430042_device::nvram_default() +{ + memset(m_pram, 0, 0x100); +} + +void rtc3430042_device::nvram_read(emu_file &file) +{ + file.read(m_pram, 0x100); +} + +void rtc3430042_device::nvram_write(emu_file &file) +{ + file.write(m_pram, 0x100); +} diff --git a/src/mame/machine/macrtc.h b/src/mame/machine/macrtc.h new file mode 100644 index 00000000000..d830b743c1e --- /dev/null +++ b/src/mame/machine/macrtc.h @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************** + + macrtc.h - Apple 343-0042 real time clock and battery RAM + by R. Belmont + +**********************************************************************/ + +#pragma once + +#ifndef __RTC3430042_H__ +#define __RTC3430042_H__ + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_RTC3430042_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, RTC3430042, _clock) + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> rtc3430042_device + +class rtc3430042_device : public device_t, + public device_rtc_interface, + public device_nvram_interface +{ +public: + // construction/destruction + rtc3430042_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE_LINE_MEMBER( ce_w ); + DECLARE_WRITE_LINE_MEMBER( clk_w ); + DECLARE_READ_LINE_MEMBER( data_r ); + DECLARE_WRITE_LINE_MEMBER( data_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // device_rtc_interface overrides + virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second); + virtual bool rtc_feature_leap_year() { return true; } + + // device_nvram_interface overrides + virtual void nvram_default(); + virtual void nvram_read(emu_file &file); + virtual void nvram_write(emu_file &file); + +private: + /* state of rTCEnb and rTCClk lines */ + UINT8 m_rtc_rTCEnb; + UINT8 m_rtc_rTCClk; + + /* serial transmit/receive register : bits are shifted in/out of this byte */ + UINT8 m_rtc_data_byte; + /* serial transmitted/received bit count */ + UINT8 m_rtc_bit_count; + /* direction of the current transfer (0 : VIA->RTC, 1 : RTC->VIA) */ + UINT8 m_rtc_data_dir; + /* when rtc_data_dir == 1, state of rTCData as set by RTC (-> data bit seen by VIA) */ + UINT8 m_rtc_data_out; + + /* set to 1 when command in progress */ + UINT8 m_rtc_cmd; + + /* write protect flag */ + UINT8 m_rtc_write_protect; + + /* internal seconds register */ + UINT8 m_rtc_seconds[/*8*/4]; + /* 20-byte long PRAM, or 256-byte long XPRAM */ + UINT8 m_pram[256]; + /* current extended address and RTC state */ + UINT8 m_rtc_xpaddr; + UINT8 m_rtc_state; + UINT8 m_data_latch; + + // timers + emu_timer *m_clock_timer; + + void rtc_shift_data(int data); + void rtc_execute_cmd(int data); +}; + + +// device type definition +extern const device_type RTC3430042; + +#endif diff --git a/src/mame/machine/mbc55x.c b/src/mame/machine/mbc55x.c new file mode 100644 index 00000000000..18704e33f0a --- /dev/null +++ b/src/mame/machine/mbc55x.c @@ -0,0 +1,414 @@ +// license:BSD-3-Clause +// copyright-holders:Phill Harvey-Smith +/* + machine/mbc55x.c + + Machine driver for the Sanyo MBC-550 and MBC-555. + + Phill Harvey-Smith + 2011-01-29. +*****************************************************************************/ + +#include "includes/mbc55x.h" + + +/*-------------------------------------------------------------------------*/ +/* Defines, constants, and global variables */ +/*-------------------------------------------------------------------------*/ + +/* Debugging */ + +#define DEBUG_SET(flags) ((state->m_debug_machine & (flags))==(flags)) + +#define DEBUG_NONE 0x0000000 +#define DMA_BREAK 0x0000001 +#define DECODE_BIOS 0x0000002 +#define DECODE_BIOS_RAW 0x0000004 +#define DECODE_DOS21 0x0000008 + +#define LOG_KEYBOARD 1 + +static void decode_dos21(device_t *device,offs_t pc); +//static void mbc55x_recalculate_ints(running_machine &machine); +static void mbc55x_debug(running_machine &machine, int ref, int params, const char *param[]); +static int instruction_hook(device_t &device, offs_t curpc); +//static void fdc_reset(running_machine &machine); +//static void set_disk_int(running_machine &machine, int state); + +/* 8255 Configuration */ + +READ8_MEMBER( mbc55x_state::ppi8255_r ) +{ + return m_ppi->read(space, offset>>1); +} + +WRITE8_MEMBER( mbc55x_state::ppi8255_w ) +{ + m_ppi->write(space, offset>>1, data); +} + +READ8_MEMBER( mbc55x_state::mbc55x_ppi_porta_r ) +{ + return 0xff; +} + +READ8_MEMBER( mbc55x_state::mbc55x_ppi_portb_r ) +{ + return 0xff; +} + +READ8_MEMBER( mbc55x_state::mbc55x_ppi_portc_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_porta_w ) +{ +} + +WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_portb_w ) +{ +} + +WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_portc_w ) +{ + floppy_image_device *floppy = NULL; + + switch (data & 0x03) + { + case 0: floppy = m_floppy0->get_device(); break; + case 1: floppy = m_floppy1->get_device(); break; + case 2: floppy = m_floppy2->get_device(); break; + case 3: floppy = m_floppy3->get_device(); break; + } + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 2)); + } +} + +/* Serial port USART, unimplemented as yet */ + +READ8_MEMBER( mbc55x_state::mbc55x_usart_r ) +{ + return 0; +} + +WRITE8_MEMBER( mbc55x_state::mbc55x_usart_w ) +{ +} + +/* PIC 8259 Configuration */ + +READ8_MEMBER(mbc55x_state::mbcpic8259_r) +{ + return m_pic->read(space, offset>>1); +} + +WRITE8_MEMBER(mbc55x_state::mbcpic8259_w) +{ + m_pic->write(space, offset>>1, data); +} + +READ8_MEMBER(mbc55x_state::mbcpit8253_r) +{ + return m_pit->read(space, offset >> 1); +} + +WRITE8_MEMBER(mbc55x_state::mbcpit8253_w) +{ + m_pit->write(space, offset >> 1, data); +} + +WRITE_LINE_MEMBER( mbc55x_state::pit8253_t2 ) +{ + m_kb_uart->write_txc(state); + m_kb_uart->write_rxc(state); +} + +/* Video ram page register */ + +READ8_MEMBER( mbc55x_state::vram_page_r ) +{ + return m_vram_page; +} + +WRITE8_MEMBER( mbc55x_state::vram_page_w ) +{ + logerror("%s : set vram page to %02X\n", machine().describe_context(),data); + + m_vram_page=data; +} + +READ8_MEMBER(mbc55x_state::mbc55x_disk_r) +{ + return m_fdc->read(space, offset>>1); +} + +WRITE8_MEMBER(mbc55x_state::mbc55x_disk_w) +{ + m_fdc->write(space, offset>>1, data); +} + + +/* + Keyboard emulation + +*/ + +void mbc55x_state::keyboard_reset() +{ + logerror("keyboard_reset()\n"); + + memset(m_keyboard.keyrows,0xFF,MBC55X_KEYROWS); + m_keyboard.key_special=0; + + // Setup timer to scan keyboard. + m_keyboard.keyscan_timer->adjust(attotime::zero, 0, attotime::from_hz(50)); +} + +void mbc55x_state::scan_keyboard() +{ + UINT8 keyrow; + UINT8 row; + UINT8 bitno; + UINT8 mask; + + char key; + static const char *const keynames[] = + { + "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", + "KEY5", "KEY6", "KEY7", "KEY8", "KEY9", + "KEY10" + }; + + static const char keyvalues_normal[MBC55X_KEYROWS][8] = + { + { '1', '2', '3', '4' , '5', '6', '7', '8' }, + { '9', '0', '-', '=', '\\', 'q', 'w', 'e' }, + { 'r', 't', 'y', 'u', 'i', 'o', 'p', '[' }, + { ']', 'a', 's', 'd', 'f', 'g', 'h', 'j' }, + { 'k', 'l', ';', '\'', '`', 0x0D, 'z', 'x' }, + { 'c', 'v', 'b', 'n', 'm', ',', '.', '/', }, + { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', } + + }; + + static const char keyvalues_shift[MBC55X_KEYROWS][8] = + { + { '!', '@', '#', '$' , '%', '^', '&', '*' }, + { '(', ')', '_', '+', '|', 'Q', 'W', 'E' }, + { 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{' }, + { '}', 'A', 'S', 'D', 'F', 'G', 'H', 'J' }, + { 'K', 'L', ':', '"', '~', 0x0d, 'Z', 'X' }, + { 'C', 'V', 'B', 'N', 'M', ',', '?', '/' }, + { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } + }; + + // First read shift, control and graph + + m_keyboard.key_special = ioport(KEY_SPECIAL_TAG)->read(); + + for(row=0; rowread(); + + for(mask=0x80, bitno=7;mask>0;mask=mask>>1, bitno-=1) + { + if(!(keyrow & mask) && (m_keyboard.keyrows[row] & mask)) + { + if(m_keyboard.key_special & (KEY_BIT_LSHIFT | KEY_BIT_RSHIFT)) + key=keyvalues_shift[row][bitno]; + else + key=keyvalues_normal[row][bitno]; + + if (LOG_KEYBOARD) logerror("keypress %c\n",key); + m_kb_uart->receive_character(key); + } + } + + m_keyboard.keyrows[row]=keyrow; + } +} + +TIMER_CALLBACK_MEMBER(mbc55x_state::keyscan_callback) +{ + scan_keyboard(); +} + +READ8_MEMBER(mbc55x_state::mbc55x_kb_usart_r) +{ + UINT8 result = 0; + offset>>=1; + + switch (offset) + { + case 0: //logerror("%s read kb_uart\n",machine().describe_context()); + result = m_kb_uart->data_r(space,0); + break; + + case 1: + result = m_kb_uart->status_r(space,0); + if (m_keyboard.key_special & KEY_BIT_CTRL) // Parity error used to flag control down + result |= i8251_device::I8251_STATUS_PARITY_ERROR; + break; + } + + return result; +} + +WRITE8_MEMBER(mbc55x_state::mbc55x_kb_usart_w) +{ + offset>>=1; + + switch (offset) + { + case 0 : m_kb_uart->data_w(space, 0, data); break; + case 1 : m_kb_uart->control_w(space, 0, data); break; + } +} + +void mbc55x_state::set_ram_size() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + int ramsize = m_ram->size(); + int nobanks = ramsize / RAM_BANK_SIZE; + char bank[10]; + int bankno; + UINT8 *ram = &m_ram->pointer()[0]; + UINT8 *map_base; + int bank_base; + + + logerror("Ramsize is %d bytes\n",ramsize); + logerror("RAM_BANK_SIZE=%d, nobanks=%d\n",RAM_BANK_SIZE,nobanks); + + // Main memory mapping + + for(bankno=0; banknoset_base(map_base); + space.install_readwrite_bank(bank_base, bank_base+(RAM_BANK_SIZE-1), bank); + logerror("Mapping bank %d at %05X to RAM\n",bankno,bank_base); + } + else + { + space.nop_readwrite(bank_base, bank_base+(RAM_BANK_SIZE-1)); + logerror("Mapping bank %d at %05X to NOP\n",bankno,bank_base); + } + } + + // Graphics red and blue plane memory mapping, green is in main memory + membank(RED_PLANE_TAG)->set_base(&m_video_mem[RED_PLANE_OFFSET]); + space.install_readwrite_bank(RED_PLANE_MEMBASE, RED_PLANE_MEMBASE+(COLOUR_PLANE_SIZE-1), RED_PLANE_TAG); + membank(BLUE_PLANE_TAG)->set_base(&m_video_mem[BLUE_PLANE_OFFSET]); + space.install_readwrite_bank(BLUE_PLANE_MEMBASE, BLUE_PLANE_MEMBASE+(COLOUR_PLANE_SIZE-1), BLUE_PLANE_TAG); +} + +DRIVER_INIT_MEMBER(mbc55x_state,mbc55x) +{ +} + +void mbc55x_state::machine_reset() +{ + set_ram_size(); + keyboard_reset(); +} + +void mbc55x_state::machine_start() +{ + /* init cpu */ +// mbc55x_cpu_init(); + + + /* setup debug commands */ + if (machine().debug_flags & DEBUG_FLAG_ENABLED) + { + debug_console_register_command(machine(), "mbc55x_debug", CMDFLAG_NONE, 0, 0, 1, mbc55x_debug); + + /* set up the instruction hook */ + m_maincpu->debug()->set_instruction_hook(instruction_hook); + } + + m_debug_machine=DEBUG_NONE; + + // Allocate keyscan timer + m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mbc55x_state::keyscan_callback),this)); +} + + +static void mbc55x_debug(running_machine &machine, int ref, int params, const char *param[]) +{ + mbc55x_state *state = machine.driver_data(); + if(params>0) + { + int temp; + sscanf(param[0],"%d",&temp); state->m_debug_machine = temp; + } + else + { + debug_console_printf(machine,"Error usage : mbc55x_debug \n"); + debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_machine); + } +} + +/*----------------------------------------------- + instruction_hook - per-instruction hook +-----------------------------------------------*/ + +static int instruction_hook(device_t &device, offs_t curpc) +{ + mbc55x_state *state = device.machine().driver_data(); + address_space &space = device.memory().space(AS_PROGRAM); + UINT8 *addr_ptr; + + addr_ptr = (UINT8*)space.get_read_ptr(curpc); + + if ((addr_ptr !=NULL) && (addr_ptr[0]==0xCD)) + { +// logerror("int %02X called\n",addr_ptr[1]); + + if(DEBUG_SET(DECODE_DOS21) && (addr_ptr[1]==0x21)) + decode_dos21(&device,curpc); + } + + return 0; +} + +static void decode_dos21(device_t *device,offs_t pc) +{ + mbc55x_state *state = device->machine().driver_data(); + + UINT16 ax = state->m_maincpu->state_int(I8086_AX); + UINT16 bx = state->m_maincpu->state_int(I8086_BX); + UINT16 cx = state->m_maincpu->state_int(I8086_CX); + UINT16 dx = state->m_maincpu->state_int(I8086_DX); + UINT16 cs = state->m_maincpu->state_int(I8086_CS); + UINT16 ds = state->m_maincpu->state_int(I8086_DS); + UINT16 es = state->m_maincpu->state_int(I8086_ES); + UINT16 ss = state->m_maincpu->state_int(I8086_SS); + + UINT16 si = state->m_maincpu->state_int(I8086_SI); + UINT16 di = state->m_maincpu->state_int(I8086_DI); + UINT16 bp = state->m_maincpu->state_int(I8086_BP); + + logerror("=======================================================================\n"); + logerror("DOS Int 0x21 call at %05X\n",pc); + logerror("AX=%04X, BX=%04X, CX=%04X, DX=%04X\n",ax,bx,cx,dx); + logerror("CS=%04X, DS=%04X, ES=%04X, SS=%04X\n",cs,ds,es,ss); + logerror("SI=%04X, DI=%04X, BP=%04X\n",si,di,bp); + logerror("=======================================================================\n"); + + if((ax & 0xff00)==0x0900) + debugger_break(device->machine()); +} diff --git a/src/mame/machine/mbee.c b/src/mame/machine/mbee.c new file mode 100644 index 00000000000..e2f6b08a94a --- /dev/null +++ b/src/mame/machine/mbee.c @@ -0,0 +1,745 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + microbee.c + + machine driver + Originally written by Juergen Buchmueller, Jan 2000 + + Rewritten by Robbbert (see notes in driver file). + +****************************************************************************/ + +#include "includes/mbee.h" +#include "machine/z80bin.h" + + +void mbee_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_MBEE_NEWKB: + timer_newkb(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in mbee_state::device_timer"); + } +} + + +/*********************************************************** + + PIO + +************************************************************/ + +WRITE_LINE_MEMBER( mbee_state::pio_ardy ) +{ + m_centronics->write_strobe((state) ? 0 : 1); +} + +WRITE8_MEMBER( mbee_state::pio_port_b_w ) +{ +/* PIO port B - d5..d2 not emulated + d7 interrupt from network or rtc or vsync or not used (see config switch) + d6 speaker + d5 rs232 output (1=mark) + d4 rs232 input (0=mark) + d3 rs232 CTS (0=clear to send) + d2 rs232 clock or DTR + d1 cass out and (on new keyboard) keyboard irq + d0 cass in */ + + m_cassette->output(BIT(data, 1) ? -1.0 : +1.0); + m_speaker->level_w(BIT(data, 6)); +} + +READ8_MEMBER( mbee_state::pio_port_b_r ) +{ + UINT8 data = 0; + + if (m_cassette->input() > 0.03) + data |= 1; + + data |= 8; // CTS held high via resistor. If low, the disk-based models think a mouse is plugged in. + + switch (m_io_config->read() & 0xc0) + { + case 0x00: + data |= (UINT8)m_b7_vs << 7; + break; + case 0x40: + data |= (UINT8)m_b7_rtc << 7; + break; + case 0x80: + data |= 0x80; + break; + } + data |= (UINT8)m_b2 << 1; // key pressed on new keyboard + + return data; +} + +/************************************************************************************* + + Floppy Disk + + The callback is quite simple, no interrupts are used. + If either IRQ or DRQ activate, they set bit 7 of inport 0x48. + +*************************************************************************************/ + +WRITE_LINE_MEMBER( mbee_state::fdc_intrq_w ) +{ + m_fdc_rq = (m_fdc_rq & 2) | state; +} + +WRITE_LINE_MEMBER( mbee_state::fdc_drq_w ) +{ + m_fdc_rq = (m_fdc_rq & 1) | (state << 1); +} + +READ8_MEMBER( mbee_state::fdc_status_r ) +{ +/* d7 indicate if IRQ or DRQ is occurring (1=happening) + d6..d0 not used */ + + return m_fdc_rq ? 0xff : 0x7f; +} + +WRITE8_MEMBER( mbee_state::fdc_motor_w ) +{ +/* d7..d4 not used + d3 density (1=MFM) + d2 side (1=side 1) + d1..d0 drive select (0 to 3) */ + + floppy_image_device *floppy = NULL; + floppy = m_floppy0->get_device(); + floppy->mon_w(0); // motor on always + floppy = m_floppy1->get_device(); + floppy->mon_w(0); // motor on always + + if ((data&3)==0) + floppy = m_floppy0->get_device(); + else + if ((data&3)==1) + floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + m_fdc->dden_w(!BIT(data, 3)); // /Q output of ic29 + + if (floppy) + { + floppy->ss_w(BIT(data, 2)); // inverted on the board + } +} + +/*********************************************************** + + 256TC Keyboard + +************************************************************/ + + +TIMER_CALLBACK_MEMBER( mbee_state::timer_newkb ) +{ + /* Keyboard scanner is a Mostek M3870 chip. Its speed of operation is determined by a 15k resistor on + pin 2 (XTL2) and is therefore 2MHz. If a key change is detected (up or down), the /strobe + line activates, sending a high to bit 1 of port 2 (one of the pio input lines). The next read of + port 18 will clear this line, and read the key scancode. It will also signal the 3870 that the key + data has been read, on pin 38 (/extint). The 3870 can cache up to 9 keys. With no rom dump + available, the following is a guess. + + The 3870 (MK3870) 8-bit microcontroller is a single chip implementation of Fairchild F8 (Mostek 3850). + It includes up to 4 KB of mask-programmable ROM, 64 bytes of scratchpad RAM and up to 64 bytes + of executable RAM. The MCU also integrates 32-bit I/O and a programmable timer. */ + + UINT8 i, j, pressed; + + // find what has changed + for (i = 0; i < 15; i++) + { + pressed = m_io_newkb[i]->read(); + if (pressed != m_mbee256_was_pressed[i]) + { + // get scankey value + for (j = 0; j < 8; j++) + { + if (BIT(pressed^m_mbee256_was_pressed[i], j)) + { + // put it in the queue + UINT8 code = (i << 3) | j | (BIT(pressed, j) ? 0x80 : 0); + m_mbee256_q[m_mbee256_q_pos] = code; + if (m_mbee256_q_pos < 19) m_mbee256_q_pos++; + } + } + m_mbee256_was_pressed[i] = pressed; + } + } + + // if anything queued, cause an interrupt + if (m_mbee256_q_pos) + m_b2 = 1; // set irq + + if (m_b2) + m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); + + timer_set(attotime::from_hz(50), TIMER_MBEE_NEWKB); +} + +READ8_MEMBER( mbee_state::port18_r ) +{ + UINT8 i, data = m_mbee256_q[0]; // get oldest key + + if (m_mbee256_q_pos) + { + m_mbee256_q_pos--; + for (i = 0; i < m_mbee256_q_pos; i++) m_mbee256_q[i] = m_mbee256_q[i+1]; // ripple queue + } + + m_b2 = 0; // clear irq + return data; +} + + +/*********************************************************** + + 256TC Change CPU speed + +************************************************************/ + +READ8_MEMBER( mbee_state::speed_low_r ) +{ + m_maincpu->set_unscaled_clock(3375000); + return 0xff; +} + +READ8_MEMBER( mbee_state::speed_high_r ) +{ + m_maincpu->set_unscaled_clock(6750000); + return 0xff; +} + + + +/*********************************************************** + + 256TC Real Time Clock + +************************************************************/ + +WRITE8_MEMBER( mbee_state::port04_w ) // address +{ + m_rtc->write(space, 0, data); +} + +WRITE8_MEMBER( mbee_state::port06_w ) // write +{ + m_rtc->write(space, 1, data); +} + +READ8_MEMBER( mbee_state::port07_r ) // read +{ + return m_rtc->read(space, 1); +} + +// See it work: Run mbeett, choose RTC in the config switches, run the F3 test, press Esc. +WRITE_LINE_MEMBER( mbee_state::rtc_irq_w ) +{ + m_b7_rtc = (state) ? 0 : 1; // inverted by IC15 (pins 8,9,10) + + if ((m_io_config->read() & 0xc0) == 0x40) // RTC selected in config menu + m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); +} + + +/*********************************************************** + + 256TC Memory Banking + + Selection of ROM, RAM, and video access by the CPU is controlled by U39, + a PAL14L8. When read as an ordinary rom it is 16k in size. The dumper has + arranged the pins as (bit0,1,..) (input = 1,23,2,3,4,5,6,7,8,9,10,11,14,13) + and (output = 22,21,20,19,18,17,16,15). The prom is also used to control + the refresh required by the dynamic rams, however we ignore this function. + + b_mask = total dynamic ram (1=64k; 3=128k; 7=256k) + + Certain software (such as the PJB system) constantly switch banks around, + causing slowness. Therefore this function only changes the banks that need + changing, leaving the others as is. + +************************************************************/ + +void mbee_state::setup_banks(UINT8 data, bool first_time, UINT8 b_mask) +{ + data &= 0x3f; // (bits 0-5 are referred to as S0-S5) + address_space &mem = m_maincpu->space(AS_PROGRAM); + UINT8 *prom = memregion("pals")->base(); + UINT8 b_data = BITSWAP8(data, 7,5,3,2,4,6,1,0) & 0x3b; // arrange data bits to S0,S1,-,S4,S2,S3 + UINT8 b_bank, b_byte, b_byte_t, b_addr, p_bank = 1; + UINT16 b_vid; + char banktag[10]; + + if (first_time || (b_data != m_bank_array[0])) // if same data as last time, leave now + { + m_bank_array[0] = b_data; + + for (b_bank = 0; b_bank < 16; b_bank++) + { + b_vid = b_bank << 12; + b_addr = BITSWAP8(b_bank, 7,4,5,3,1,2,6,0) & 0x1f; // arrange address bits to A12,-,A14,A13,A15 + + // Calculate read-bank + b_byte_t = prom[b_addr | (b_data << 8) | 0x82]; // read-bank (RDS and MREQ are low, RFSH is high) + b_byte = BITSWAP8(b_byte_t, 7,5,0,3,6,2,1,4); // rearrange so that bits 0-2 are rambank, bit 3 = rom select, bit 4 = video select, others not used + + if (first_time || (b_byte != m_bank_array[p_bank])) + { + m_bank_array[p_bank] = b_byte; + + if (!BIT(data, 5)) + b_byte &= 0xfb; // U42/1 - S17 only valid if S5 is on + + mem.unmap_read (b_vid, b_vid + 0xfff); + + if (!BIT(b_byte, 4)) + { + // select video + mem.install_read_handler (b_vid, b_vid + 0x7ff, read8_delegate(FUNC(mbee_state::video_low_r), this)); + mem.install_read_handler (b_vid + 0x800, b_vid + 0xfff, read8_delegate(FUNC(mbee_state::video_high_r), this)); + } + else + { + sprintf(banktag, "bankr%d", b_bank); + mem.install_read_bank( b_vid, b_vid+0xfff, banktag ); + + if (!BIT(b_byte, 3)) + membank(banktag)->set_entry(64 + (b_bank & 3)); // read from rom + else + membank(banktag)->set_entry((b_bank & 7) | ((b_byte & b_mask) << 3)); // ram + } + } + p_bank++; + + // Calculate write-bank + b_byte_t = prom[b_addr | (b_data << 8) | 0xc0]; // write-bank (XWR and MREQ are low, RFSH is high) + b_byte = BITSWAP8(b_byte_t, 7,5,0,3,6,2,1,4); // rearrange so that bits 0-2 are rambank, bit 3 = rom select, bit 4 = video select, others not used + + if (first_time || (b_byte != m_bank_array[p_bank])) + { + m_bank_array[p_bank] = b_byte; + + if (!BIT(data, 5)) + b_byte &= 0xfb; // U42/1 - S17 only valid if S5 is on + + mem.unmap_write (b_vid, b_vid + 0xfff); + + if (!BIT(b_byte, 4)) + { + // select video + mem.install_write_handler (b_vid, b_vid + 0x7ff, write8_delegate(FUNC(mbee_state::video_low_w), this)); + mem.install_write_handler (b_vid + 0x800, b_vid + 0xfff, write8_delegate(FUNC(mbee_state::video_high_w), this)); + } + else + { + sprintf(banktag, "bankw%d", b_bank); + mem.install_write_bank( b_vid, b_vid+0xfff, banktag ); + + if (!BIT(b_byte, 3)) + membank(banktag)->set_entry(64); // write to rom dummy area + else + membank(banktag)->set_entry((b_bank & 7) | ((b_byte & b_mask) << 3)); // ram + } + } + p_bank++; + } + } +} + +WRITE8_MEMBER( mbee_state::mbee256_50_w ) +{ + setup_banks(data, 0, 7); +} + +/*********************************************************** + + 128k Memory Banking + + The only difference to the 256TC is that bit 5 switches + between rom2 and rom3. Since neither of these is dumped, + this bit is not emulated. If it was, this scheme is used: + + Low - rom2 occupies C000-FFFF + High - ram = C000-DFFF, rom3 = E000-FFFF. + +************************************************************/ + +WRITE8_MEMBER( mbee_state::mbee128_50_w ) +{ + setup_banks(data, 0, 3); +} + +/*********************************************************** + + ROM Banking on older models + + Set A to 0 or 1 then read the port to switch between the + halves of the Telcom ROM. + + Output the PAK number to choose an optional PAK ROM. + + The bios will support 256 PAKs, although normally only + 8 are available in hardware. Each PAK is normally a 4K + ROM. If 8K ROMs are used, the 2nd half becomes PAK+8, + thus 16 PAKs in total. This is used in the PC85 models. + +************************************************************/ + +WRITE8_MEMBER( mbee_state::port0a_w ) +{ + m_0a = data; + + if (m_pak) + m_pak->set_entry(data & 15); +} + +READ8_MEMBER( mbee_state::telcom_low_r ) +{ +/* Read of port 0A - set Telcom rom to first half */ + if (m_telcom) + m_telcom->set_entry(0); + + return m_0a; +} + +READ8_MEMBER( mbee_state::telcom_high_r ) +{ +/* Read of port 10A - set Telcom rom to 2nd half */ + if (m_telcom) + m_telcom->set_entry(1); + + return m_0a; +} + + +/*********************************************************** + + Machine + +************************************************************/ + +/* + On reset or power on, a circuit forces rom 8000-8FFF to appear at 0000-0FFF, while ram is disabled. + It gets set back to normal on the first attempt to write to memory. (/WR line goes active). +*/ + + +void mbee_state::machine_reset_common() +{ + m_fdc_rq = 0; + m_08 = 0; + m_0a = 0; + m_0b = 0; + m_1c = 0; + + if (m_basic) + m_basic->set_entry(0); + + if (m_telcom) + m_telcom->set_entry(0); +} + +MACHINE_RESET_MEMBER( mbee_state, mbee ) +{ + machine_reset_common(); + m_maincpu->set_pc(0x8000); +} + +MACHINE_RESET_MEMBER( mbee_state, mbee56 ) +{ + machine_reset_common(); + m_maincpu->set_pc(0xE000); +} + +MACHINE_RESET_MEMBER( mbee_state, mbee128 ) +{ + machine_reset_common(); + setup_banks(0, 1, 3); // set banks to default + m_maincpu->set_pc(0x8000); +} + +MACHINE_RESET_MEMBER( mbee_state, mbee256 ) +{ + m_mbee256_q_pos = 0; + machine_reset_common(); + setup_banks(0, 1, 7); // set banks to default + m_maincpu->set_pc(0x8000); +} + +MACHINE_RESET_MEMBER( mbee_state, mbeett ) +{ + m_mbee256_q_pos = 0; + machine_reset_common(); + m_maincpu->set_pc(0x8000); +} + +DRIVER_INIT_MEMBER( mbee_state, mbee ) +{ + m_size = 0x8000; + m_has_oldkb = 1; +} + +DRIVER_INIT_MEMBER( mbee_state, mbeeic ) +{ + UINT8 *RAM = memregion("pakrom")->base(); + m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); + m_pak->set_entry(0); + + m_size = 0x8000; + m_has_oldkb = 1; +} + +DRIVER_INIT_MEMBER( mbee_state, mbeepc ) +{ + UINT8 *RAM = memregion("telcomrom")->base(); + m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000); + + RAM = memregion("pakrom")->base(); + m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); + m_pak->set_entry(0); + + m_size = 0x8000; + m_has_oldkb = 1; +} + +DRIVER_INIT_MEMBER( mbee_state, mbeepc85 ) +{ + UINT8 *RAM = memregion("telcomrom")->base(); + m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000); + + RAM = memregion("pakrom")->base(); + m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); + m_pak->set_entry(5); + + m_size = 0x8000; + m_has_oldkb = 1; +} + +DRIVER_INIT_MEMBER( mbee_state, mbeeppc ) +{ + UINT8 *RAM = memregion("basicrom")->base(); + m_basic->configure_entries(0, 2, &RAM[0x0000], 0x2000); + + RAM = memregion("telcomrom")->base(); + m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000); + + RAM = memregion("pakrom")->base(); + m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); + m_pak->set_entry(5); + + m_size = 0x8000; + m_has_oldkb = 1; +} + +DRIVER_INIT_MEMBER( mbee_state, mbee56 ) +{ + m_size = 0xe000; + m_has_oldkb = 1; +} + +DRIVER_INIT_MEMBER( mbee_state, mbee128 ) +{ + UINT8 *RAM = memregion("rams")->base(); + UINT8 *ROM = memregion("roms")->base(); + char banktag[10]; + + for (UINT8 b_bank = 0; b_bank < 16; b_bank++) + { + sprintf(banktag, "bankr%d", b_bank); + membank(banktag)->configure_entries(0, 32, &RAM[0x0000], 0x1000); // RAM banks + membank(banktag)->configure_entries(64, 4, &ROM[0x0000], 0x1000); // rom + + sprintf(banktag, "bankw%d", b_bank); + membank(banktag)->configure_entries(0, 32, &RAM[0x0000], 0x1000); // RAM banks + membank(banktag)->configure_entries(64, 1, &ROM[0x4000], 0x1000); // dummy rom + } + + m_size = 0x8000; + m_has_oldkb = 1; +} + +DRIVER_INIT_MEMBER( mbee_state, mbee256 ) +{ + UINT8 *RAM = memregion("rams")->base(); + UINT8 *ROM = memregion("roms")->base(); + char banktag[10]; + + for (UINT8 b_bank = 0; b_bank < 16; b_bank++) + { + sprintf(banktag, "bankr%d", b_bank); + membank(banktag)->configure_entries(0, 64, &RAM[0x0000], 0x1000); // RAM banks + membank(banktag)->configure_entries(64, 4, &ROM[0x0000], 0x1000); // rom + + sprintf(banktag, "bankw%d", b_bank); + membank(banktag)->configure_entries(0, 64, &RAM[0x0000], 0x1000); // RAM banks + membank(banktag)->configure_entries(64, 1, &ROM[0x4000], 0x1000); // dummy rom + } + + timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB); /* kick-start timer for kbd */ + + m_size = 0x8000; + m_has_oldkb = 0; +} + +DRIVER_INIT_MEMBER( mbee_state, mbeett ) +{ + UINT8 *RAM = memregion("telcomrom")->base(); + m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000); + + RAM = memregion("pakrom")->base(); + m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); + m_pak->set_entry(5); + + timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB); /* kick-start timer for kbd */ + + m_size = 0x8000; + m_has_oldkb = 0; +} + + +/*********************************************************** + + Quickload + + These load the standard BIN format, as well + as BEE, COM and MWB files. + +************************************************************/ + +QUICKLOAD_LOAD_MEMBER( mbee_state, mbee ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT16 i, j; + UINT8 data, sw = m_io_config->read() & 1; /* reading the config switch: 1 = autorun */ + + if (!core_stricmp(image.filetype(), "mwb")) + { + /* mwb files - standard basic files */ + for (i = 0; i < quickload_size; i++) + { + j = 0x8c0 + i; + + if (image.fread(&data, 1) != 1) + { + image.message("Unexpected EOF"); + return IMAGE_INIT_FAIL; + } + + if ((j < m_size) || (j > 0xefff)) + space.write_byte(j, data); + else + { + image.message("Not enough memory in this microbee"); + return IMAGE_INIT_FAIL; + } + } + + if (sw) + { + space.write_word(0xa2,0x801e); /* fix warm-start vector to get around some copy-protections */ + m_maincpu->set_pc(0x801e); + } + else + space.write_word(0xa2,0x8517); + } + else if (!core_stricmp(image.filetype(), "com")) + { + /* com files - most com files are just machine-language games with a wrapper and don't need cp/m to be present */ + for (i = 0; i < quickload_size; i++) + { + j = 0x100 + i; + + if (image.fread(&data, 1) != 1) + { + image.message("Unexpected EOF"); + return IMAGE_INIT_FAIL; + } + + if ((j < m_size) || (j > 0xefff)) + space.write_byte(j, data); + else + { + image.message("Not enough memory in this microbee"); + return IMAGE_INIT_FAIL; + } + } + + if (sw) m_maincpu->set_pc(0x100); + } + else if (!core_stricmp(image.filetype(), "bee")) + { + /* bee files - machine-language games that start at 0900 */ + for (i = 0; i < quickload_size; i++) + { + j = 0x900 + i; + + if (image.fread(&data, 1) != 1) + { + image.message("Unexpected EOF"); + return IMAGE_INIT_FAIL; + } + + if ((j < m_size) || (j > 0xefff)) + space.write_byte(j, data); + else + { + image.message("Not enough memory in this microbee"); + return IMAGE_INIT_FAIL; + } + } + + if (sw) m_maincpu->set_pc(0x900); + } + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + QUICKLOAD_LOAD_MEMBER( mbee_state, mbee_z80bin ) +-------------------------------------------------*/ + +QUICKLOAD_LOAD_MEMBER( mbee_state, mbee_z80bin ) +{ + UINT16 execute_address, start_addr, end_addr; + int autorun; + address_space &space = m_maincpu->space(AS_PROGRAM); + + /* load the binary into memory */ + if (z80bin_load_file(&image, space, file_type, &execute_address, &start_addr, &end_addr) == IMAGE_INIT_FAIL) + return IMAGE_INIT_FAIL; + + /* is this file executable? */ + if (execute_address != 0xffff) + { + /* check to see if autorun is on */ + autorun = m_io_config->read() & 1; + + space.write_word(0xa6, execute_address); /* fix the EXEC command */ + + if (autorun) + { + space.write_word(0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */ + m_maincpu->set_pc(execute_address); + } + else + { + space.write_word(0xa2, 0x8517); + } + } + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/mboard.c b/src/mame/machine/mboard.c new file mode 100644 index 00000000000..1ea5963a3ab --- /dev/null +++ b/src/mame/machine/mboard.c @@ -0,0 +1,568 @@ +// license:??? +// copyright-holders:Ralf Schaefer, Cowering +/********************************************************************** + + Mephisto Chess Computers + +**********************************************************************/ +#include "emu.h" +#include "includes/mboard.h" +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +#define IsPiece(x) ((m_board[x] >=1) && (m_board[x] <=12)) + +const int mboard_state::start_board[64] = +{ + BR, BN, BB, BQ, BK, BB, BN, BR, + BP, BP, BP, BP, BP, BP, BP, BP, + EM, EM, EM, EM, EM, EM, EM, EM, + EM, EM, EM, EM, EM, EM, EM, EM, + EM, EM, EM, EM, EM, EM, EM, EM, + EM, EM, EM, EM, EM, EM, EM, EM, + WP, WP, WP, WP, WP, WP, WP, WP, + WR, WN, WB, WQ, WK, WB, WN, WR +}; + +UINT8 mboard_state::border_pieces[12] = {WK,WQ,WR,WB,WN,WP,BK,BQ,BR,BB,BN,BP,}; + + +int mboard_state::get_first_bit(UINT8 data) +{ + int i; + + for (i = 0; i < 8; i++) + if (BIT(data, i)) + return i; + + return NOT_VALID; +} + + +inline UINT8 mboard_state::pos_to_num(UINT8 val) +{ + switch (val) + { + case 0xfe: return 7; + case 0xfd: return 6; + case 0xfb: return 5; + case 0xf7: return 4; + case 0xef: return 3; + case 0xdf: return 2; + case 0xbf: return 1; + case 0x7f: return 0; + default: return 0xff; + } +} + +int mboard_state::get_first_cleared_bit(UINT8 data) +{ + int i; + + for (i=0;i<8;i++) + if (!BIT(data, i)) + return i; + + return NOT_VALID; +} + +UINT8 mboard_state::read_board() +{ + UINT8 i_18, i_AH; + UINT8 data; + + data = 0xff; + +/* + +Example board scan: +Starting postion and pawn on E2 is lifted + + +mask: 7f 0111 1111 Line 8 +data: 0 0000 0000 all fields occupied +mask: bf 1011 1111 Line 7 +data: 0 0000 0000 all fields occupied +mask: df 1101 1111 Line 6 +data: ff 1111 1111 all fields empty +mask: ef 1110 1111 Line 5 +data: ff 1111 1111 all fields empty +mask: f7 1111 0111 Line 4 +data: ff 1111 1111 all fields empty +mask: fb 1111 1011 Line 3 +data: ff 1111 1111 all fields empty +mask: fd 1111 1101 Line 2 +data: 10 0001 0000 E2 is empty rest is occupied +mask: fe 1111 1110 Line 1 +data: 0 0000 0000 all fields occupied + + +*/ + +/* looking for cleared bit in mask Line18_REED => current line */ + + if (data && Line18_REED) + { + i_18 = get_first_cleared_bit(Line18_REED); + + if (i_18 == NOT_VALID) + printf("No cleared bit in mask Line18_REED!\n"); + else + { + /* looking for a piece in this line and clear bit in data if found */ + + for (i_AH = 0; i_AH < 8; i_AH = i_AH + 1) + if (IsPiece(64 - (i_18 * 8 + 8 - i_AH))) + data &= ~(1 << i_AH); // clear bit + + read_board_flag = TRUE; + } + } + + return data; +} + + +void mboard_state::write_board(UINT8 data) +{ + Line18_REED=data; + + if (read_board_flag && !strcmp(machine().system().name,"glasgow") ) //HACK + Line18_LED = 0; + else + Line18_LED = data; + + read_board_flag = FALSE; + + if (data == 0xff) + mboard_key_selector = 0; +} + + + +void mboard_state::write_LED(UINT8 data) +{ + int i; + UINT8 i_AH, i_18; + UINT8 LED; + + mboard_lcd_invert = 1; +/* + +Example: turn led E2 on + +mask: fd 1111 1101 Line 2 +data: 10 0001 0000 Line E + +*/ + + for (i=0; i < 64; i++) /* all LED's off */ + output_set_led_value(i, 0); + + if (Line18_LED) + { + for (i_AH = 0; i_AH < 8; i_AH++) /* turn LED on depending on bit masks */ + { + if (BIT(data,i_AH)) + { + for (i_18 = 0; i_18 < 8; i_18++) + { + LED = (i_18*8 + 8-i_AH-1); + if (!(Line18_LED & (1 << i_18))) /* cleared bit */ + output_set_led_value(LED, 1); + //else + // output_set_led_value(LED, 0); + } + } + } + } + +} + + + +READ8_MEMBER(mboard_state::mboard_read_board_8) +{ + UINT8 data; + + data=read_board(); + logerror("Read Board Port Data = %d\n ",data); + return data; +} + +READ16_MEMBER(mboard_state::mboard_read_board_16) +{ + UINT8 data; + + data=read_board(); + return data << 8; +} + +READ32_MEMBER(mboard_state::mboard_read_board_32) +{ + UINT8 data; + + data=read_board(); + return data<<24; +} + +WRITE8_MEMBER(mboard_state::mboard_write_board_8) +{ + write_board(data); + logerror("Write Board Port Data = %02x\n",data); +} + +WRITE16_MEMBER(mboard_state::mboard_write_board_16) +{ + if (data & 0xff) write_board(data); + logerror("write board 16 %08x\n",data); + write_board(data>>8); +} + +WRITE32_MEMBER(mboard_state::mboard_write_board_32) +{ +// data |= data << 24; +//printf("write board %08x %08x\n",offset,data); + logerror("write board 32 o: %08x d: %08x\n",offset,data); + if (offset) write_board(data); + else write_board(data>>24); +} + +WRITE8_MEMBER(mboard_state::mboard_write_LED_8) +{ + write_LED(data); + space.device().execute().spin_until_time(attotime::from_usec(7)); +} + +WRITE16_MEMBER(mboard_state::mboard_write_LED_16) +{ + write_LED(data >> 8); + space.device().execute().spin_until_time(attotime::from_usec(9)); +} + +WRITE32_MEMBER(mboard_state::mboard_write_LED_32) +{ +// data = data | data << 24; +//printf("write LED %08x %08x\n",offset,data); + if (offset) write_LED(data); + else write_LED(data >> 24); + logerror("write LED 32 o: %08x d: %08x\n",offset,data); +// space.device().execute().spin_until_time(ATTOTIME_IN_USEC(20)); +} + + +/* save states callback */ + +void mboard_state::board_presave() +{ + int i; + for (i=0;i<64;i++) + save_board[i]=m_board[i]; +} + +void mboard_state::board_postload() +{ + int i; + for (i=0;i<64;i++) + m_board[i]=save_board[i]; + +} + +void mboard_state::mboard_savestate_register() +{ + save_item(NAME(save_board)); + machine().save().register_postload(save_prepost_delegate(FUNC(mboard_state::board_postload),this)); + machine().save().register_presave(save_prepost_delegate(FUNC(mboard_state::board_presave),this)); +} + +void mboard_state::mboard_set_board() +{ + read_board_flag = TRUE; + int i; + for (i=0;i<64;i++) + m_board[i]=start_board[i]; +} + +void mboard_state::clear_board() +{ + int i; + for (i=0;i<64;i++) + m_board[i]=EM; +} + +void mboard_state::set_artwork() +{ + int i; + for (i=0;i<64;i++) + output_set_indexed_value("P", i, m_board[i]); +} + +void mboard_state::mboard_set_border_pieces() +{ + int i; + for (i=0;i<12;i++) + output_set_indexed_value("Q", i, border_pieces[i]); +} + +TIMER_DEVICE_CALLBACK_MEMBER(mboard_state::mboard_update_artwork ) +{ + check_board_buttons(); + set_artwork(); + mboard_set_border_pieces(); +} + +void mboard_state::check_board_buttons() +{ + int field; + int i; + UINT8 port_input=0; + UINT8 data = 0xff; + static UINT8 board_row = 0; + static UINT16 mouse_down = 0; + UINT8 pos2num_res = 0; + board_row++; + board_row &= 7; + int click_on_border_piece=FALSE; + + +/* check click on border pieces */ + i=0; + port_input = m_b_black->read(); + if (port_input) + { + i=get_first_bit(port_input)+6; + click_on_border_piece=TRUE; + } + + port_input = m_b_white->read(); + if (port_input) + { + i=get_first_bit(port_input); + click_on_border_piece=TRUE; + } + + if (click_on_border_piece) + { + if (!mouse_down) + { + if (border_pieces[i] > 12 ) /* second click on selected border piece */ + { + mouse_hold_border_piece=FALSE; + border_pieces[i]=border_pieces[i]-12; + mouse_hold_from=0; + mouse_hold_piece=0; + } + else if (!mouse_hold_piece) /*select border piece */ + { + if (mouse_hold_border_piece) + border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12; + + mouse_hold_from=i; + mouse_hold_piece=border_pieces[i]; + border_pieces[i]=border_pieces[i]+12; + mouse_hold_border_piece=TRUE; + } + + mouse_down = board_row + 1; + + } + return; + } + + +/* check click on board */ + data = m_line[board_row]->read(); + + if ((data != 0xff) && (!mouse_down) ) + { + pos2num_res = pos_to_num(data); + field=64-(board_row*8+8-pos2num_res); + + + if (!(pos2num_res < 8)) + logerror("Position out of bound!"); + + else if ((mouse_hold_piece) && (!IsPiece(field))) + { + /* Moving a piece onto a blank */ + m_board[field] = mouse_hold_piece; + + if (mouse_hold_border_piece) + { + border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12; + }else if ( field != mouse_hold_from ) /* Put a selected piece back to the source field */ + m_board[mouse_hold_from] = 0; + + + mouse_hold_from = 0; + mouse_hold_piece = 0; + mouse_hold_border_piece=FALSE; + } + else if ((!mouse_hold_piece) ) + { + /* Picking up a piece */ + + if (IsPiece(field)) + { + mouse_hold_from = field; + mouse_hold_piece = m_board[field]; + m_board[field] = m_board[field]+12; + } + + } + + mouse_down = board_row + 1; + } + else if ((data == 0xff) && (mouse_down == (board_row + 1))) /* Wait for mouse to be released */ + mouse_down = 0; + +/* check click on border - remove selected piece*/ + if (m_line10->read()) + { + if (mouse_hold_piece) + { + if (mouse_hold_border_piece) + border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12; + else + m_board[mouse_hold_from] = 0; + + mouse_hold_from = 0; + mouse_hold_piece = 0; + mouse_hold_border_piece = FALSE; + } + + return; + } + +/* check additional buttons */ + if (data == 0xff) + { + port_input = m_b_buttons->read(); + if (port_input==0x01) + { + clear_board(); + return; + }else if (port_input==0x02) + { + mboard_set_board(); + return; + } + + + } + +} + +extern INPUT_PORTS_START( chessboard ) + + PORT_START("LINE.0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_START("LINE.1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_START("LINE.2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_START("LINE.3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_START("LINE.4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_START("LINE.5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_START("LINE.6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_START("LINE.7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) + + PORT_START("LINE10") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) + + PORT_START("B_WHITE") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) + + PORT_START("B_BLACK") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) + + PORT_START("B_BUTTONS") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) + + PORT_START("MOUSE_X") + PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) + + PORT_START("MOUSE_Y") + PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) + + PORT_START("BUTTON_L") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("left button") + + PORT_START("BUTTON_R") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("right button") + + +INPUT_PORTS_END diff --git a/src/mame/machine/mc80.c b/src/mame/machine/mc80.c new file mode 100644 index 00000000000..d96f2c3cbaa --- /dev/null +++ b/src/mame/machine/mc80.c @@ -0,0 +1,134 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + MC-80.xx by Miodrag Milanovic + + 15/05/2009 Initial implementation + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +#include "includes/mc80.h" + +/*****************************************************************************/ +/* Implementation for MC80.2x */ +/*****************************************************************************/ + +IRQ_CALLBACK_MEMBER(mc80_state::mc8020_irq_callback) +{ + return 0x00; +} + +MACHINE_RESET_MEMBER(mc80_state,mc8020) +{ +} + +WRITE_LINE_MEMBER( mc80_state::ctc_z0_w ) +{ +} + +WRITE_LINE_MEMBER( mc80_state::ctc_z1_w ) +{ +} + +WRITE_LINE_MEMBER(mc80_state::ctc_z2_w) +{ + downcast(machine().device("z80ctc"))->trg0(state); + downcast(machine().device("z80ctc"))->trg1(state); +} + +READ8_MEMBER( mc80_state::mc80_port_b_r ) +{ + return 0; +} + +READ8_MEMBER( mc80_state::mc80_port_a_r ) +{ + return 0; +} + +WRITE8_MEMBER( mc80_state::mc80_port_a_w ) +{ +} + +WRITE8_MEMBER( mc80_state::mc80_port_b_w ) +{ +} + +/*****************************************************************************/ +/* Implementation for MC80.3x */ +/*****************************************************************************/ + +WRITE8_MEMBER( mc80_state::mc8030_zve_write_protect_w ) +{ +} + +WRITE8_MEMBER( mc80_state::mc8030_vis_w ) +{ + // reg C + // 7 6 5 4 -- module + // 3 - 0 left half, 1 right half + // 2 1 0 + // ===== + // 0 0 0 - dark + // 0 0 1 - light + // 0 1 0 - in reg pixel + // 0 1 1 - negate in reg pixel + // 1 0 x - operation code in B reg + // reg B + // + UINT16 addr = ((offset & 0xff00) >> 2) | ((offset & 0x08) << 2) | (data >> 3); + static const UINT8 val[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; + int c = offset & 1; + m_p_videoram[addr] = m_p_videoram[addr] | (val[data & 7]*c); +} + +WRITE8_MEMBER( mc80_state::mc8030_eprom_prog_w ) +{ +} + +IRQ_CALLBACK_MEMBER(mc80_state::mc8030_irq_callback ) +{ + return 0x20; +} + +MACHINE_RESET_MEMBER(mc80_state,mc8030) +{ +} + +READ8_MEMBER( mc80_state::zve_port_a_r ) +{ + return 0xff; +} + +READ8_MEMBER( mc80_state::zve_port_b_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( mc80_state::zve_port_a_w ) +{ +} + +WRITE8_MEMBER( mc80_state::zve_port_b_w ) +{ +} + +READ8_MEMBER( mc80_state::asp_port_a_r ) +{ + return 0xff; +} + +READ8_MEMBER( mc80_state::asp_port_b_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( mc80_state::asp_port_a_w ) +{ +} + +WRITE8_MEMBER( mc80_state::asp_port_b_w ) +{ +} diff --git a/src/mame/machine/mega32x.c b/src/mame/machine/mega32x.c new file mode 100644 index 00000000000..8c60160097d --- /dev/null +++ b/src/mame/machine/mega32x.c @@ -0,0 +1,1957 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/* Megadrive / Genesis 32X emulation */ + +/* + + Fix 32X support (not used by any arcade systems?) + - this seems to require far greater sync and timing accuracy on rom / ram access than MAME can provide + - split NTSC / PAL drivers + - 36greatju: missing backup ram, has issues with golfer select due of that + - bcracers: write to undefined PWM register? + - fifa96 / nbajamte: dies on the gameplay, waiting for a comm change that never occurs; + - marsch1: doesn't boot, Master / Slave communicates through SCI + - nbajamte: missing I2C hookup, startup fails due of that (same I2C type as plain MD version); + - nflquart: black screen, missing h irq? + - sangoku4: black screen after the Sega logo + - soulstar: OSD and player sprite isn't drawn; + - tempo: intro is too fast, mostly noticeable with the PWM sound that cuts off too early when it gets to the title screen; + - tmek: gameplay is clearly too fast + - vrdxu: has 3d geometry bugs, caused by a SH-2 DRC bug; + - vrdxu: crashes if you attempt to enter into main menu; + - wwfraw: writes fb data to the cart area and expects it to be read back, kludging the cart area to be writeable makes the 32x gfxs to appear, why? + - wwfwre: no 32x gfxs + - xmen: black screen after that you choose the level, needs bare minimum SH-2 SCI support + + +32x Marsch tests documentation (keep start pressed at start-up for individual tests): + +MD side check: +#1 Communication Check +#2 FM Bit +#3 Irq Register +#4 Bank Control Register +#5 DREQ Control FULL bit +#6 DREQ SRC Address +#7 DREQ DST Address +#8 DREQ SIZE Address +#9 SEGA TV Register +#10 H IRQ Vector +#11 PWM Control Register +#12 PWM Frequency Register +#13 PWM Lch Pulse Width Register +#14 PWM Rch Pulse Width Register +#15 PWM MONO Pulse Width Register +32x side check: +#16 SH-2 Master Communication Check +#17 SH-2 Slave Communication Check +#18 SH-2 Master FM Bit +#19 SH-2 Slave FM Bit +#20 SH-2 Master IRQ Mask Register +#21 SH-2 Slave IRQ Mask Register +#22 SH-2 Master H Counter Register +#23 SH-2 Slave H Counter Register +#24 SH-2 Master PWM Timer Register +#25 SH-2 Slave PWM Timer Register +#26 SH-2 Master PWM Cont. Register +#27 SH-2 Slave PWM Cont. Register +#28 SH-2 Master PWM Freq. Register +#29 SH-2 Slave PWM Freq. Register +#30 SH-2 Master PWM Lch Register +#31 SH-2 Slave PWM Lch Register +#32 SH-2 Master PWM Rch Register +#33 SH-2 Slave PWM Rch Register +#34 SH-2 Master PWM Mono Register +#35 SH-2 Slave PWM Mono Register +#36 SH-2 Master ROM Read Check +#37 SH-2 Slave ROM Read Check +#38 SH-2 Serial Communication (ERROR - returns a Timeout Error) +MD & 32x check: +#39 MD&SH-2 Master Communication +#40 MD&SH-2 Slave Communication +#41 MD&SH-2 Master FM Bit R/W +#42 MD&SH-2 Slave FM Bit R/W +#43 MD&SH-2 Master DREQ CTL +#44 MD&SH-2 Slave DREQ CTL +#45 MD&SH-2 Master DREQ SRC address +#46 MD&SH-2 Slave DREQ SRC address +#47 MD&SH-2 Master DREQ DST address +#48 MD&SH-2 Slave DREQ DST address +#49 MD&SH-2 Master DREQ SIZE address +#50 MD&SH-2 Slave DREQ SIZE address +#51 SH-2 Master V IRQ +#52 SH-2 Slave V IRQ +#53 SH2 Master H IRQ (MD 0) +#54 SH2 Slave H IRQ (MD 0) +#55 SH2 Master H IRQ (MD 1) +#56 SH2 Slave H IRQ (MD 1) +#57 SH2 Master H IRQ (MD 2) +#58 SH2 Slave H IRQ (MD 2) +MD VDP check: +#59 Bitmap Mode Register +#60 Shift Register +#61 Auto Fill Length Register +#62 Auto Fill Start Address Register +#63 V Blank BIT +#64 H Blank BIT +#65 Palette Enable BIT +SH-2 VDP check: +#66 Frame Swap BIT +#67 SH-2 Master Bitmap MD +#68 SH-2 Slave Bitmap MD +#69 SH-2 Master Shift +#70 SH-2 Slave Shift +#71 SH-2 Master Fill SIZE +#72 SH-2 Slave Fill SIZE +#73 SH-2 Master Fill START +#74 SH-2 Slave Fill START +#75 SH-2 Master V Blank Bit +#76 SH-2 Slave V Blank Bit +#77 SH-2 Master H Blank Bit +#78 SH-2 Slave H Blank Bit +#79 SH-2 Master Palette Enable Bit +#80 SH-2 Slave Palette Enable Bit +#81 SH-2 Master Frame Swap Bit +#82 SH-2 Slave Frame Swap Bit +Framebuffer Check: +#83 MD Frame Buffer 0 +#84 MD Frame Buffer 1 +#85 SH-2 Master Frame Buffer 0 +#86 SH-2 Slave Frame Buffer 0 +#87 SH-2 Master Frame Buffer 1 +#88 SH-2 Slave Frame Buffer 1 +#89 MD Frame Buffer 0 Overwrite +#90 MD Frame Buffer 1 Overwrite +#91 MD Frame Buffer 0 Byte Write +#92 MD Frame Buffer 1 Byte Write +#93 SH-2 Master Frame Buffer 0 Overwrite +#94 SH-2 Slave Frame Buffer 0 Overwrite +#95 SH-2 Master Frame Buffer 1 Overwrite +#96 SH-2 Slave Frame Buffer 1 Overwrite +#97 SH-2 Master Frame Buffer 0 Byte Write +#98 SH-2 Slave Frame Buffer 0 Byte Write +#99 SH-2 Master Frame Buffer 1 Byte Write +#100 SH-2 Slave Frame Buffer 1 Byte Write +#101 MD Frame Buffer 0 Fill Data +#102 MD Frame Buffer 1 Fill Data +#103 MD Frame Buffer 0 Fill Length & Address +#104 MD Frame Buffer 1 Fill Length & Address +#105 SH-2 Master Frame Buffer 0 Fill Data +#106 SH-2 Slave Frame Buffer 0 Fill Data +#107 SH-2 Master Frame Buffer 1 Fill Data +#108 SH-2 Slave Frame Buffer 1 Fill Data +#109 SH-2 Master Frame Buffer 0 Fill Address +#110 SH-2 Slave Frame Buffer 0 Fill Address +#111 SH-2 Master Frame Buffer 1 Fill Address +#112 SH-2 Slave Frame Buffer 1 Fill Address +#113 MD Palette R/W (Blank Mode) +#114 MD Palette R/W (Display Mode) +#115 MD Palette R/W (Fill Mode) +#116 SH-2 Master Palette R/W (Blank Mode) +#117 SH-2 Slave Palette R/W (Blank Mode) +#118 SH-2 Master Palette R/W (Display Mode) +#119 SH-2 Slave Palette R/W (Display Mode) +#120 SH-2 Master Palette R/W (Fill Mode) +#121 SH-2 Slave Palette R/W (Fill Mode) +MD or SH-2 DMA check: +#122 SH-2 Master CPU Write DMA (68S) (ERROR) +#123 SH-2 Slave CPU Write DMA (68S) (ERROR) +#124 MD ROM to VRAM DMA (asserts after this) +----- +#127 SH-2 Master ROM to SDRAM DMA +#128 SH-2 Slave ROM to SDRAM DMA +#129 SH-2 Master ROM to Frame DMA +#130 SH-2 Slave ROM to Frame DMA +#131 SH-2 Master SDRAM to Frame DMA +#132 SH-2 Slave SDRAM to Frame DMA +#133 SH-2 Master Frame to SDRAM DMA +#134 SH-2 Slave Frame to SDRAM DMA +Sound Test (these don't explicitly fails): +#135 MD 68k Monaural Sound +#136 MD 68k L Sound +#137 MD 68k R Sound +#138 MD 68k L -> R Sound +#139 MD 68k R -> L Sound +#140 SH-2 Master Monaural Sound +#141 SH-2 Master L Sound +#142 SH-2 Master R Sound +#143 SH-2 Master L -> R Pan +#144 SH-2 Master R -> L Pan +#145 SH-2 Slave Monaural Sound +#146 SH-2 Slave L Sound +#147 SH-2 Slave R Sound +#148 SH-2 Slave L -> R Pan +#149 SH-2 Slave R -> L Pan +#150 SH-2 Master PWM Interrupt +#151 SH-2 Slave PWM Interrupt +#152 SH-2 Master PWM DMA Write (!) +#153 SH-2 Slave PWM DMA Write (!) +#154 Z80 PWM Monaural Sound (!) +#155 Z80 PWM L Sound (!) +#156 Z80 PWM R Sound (!) +GFX check (these don't explicitly fails): +#157 Direct Color Mode +#158 Packed Pixel Mode +#159 Runlength Mode +#160 Runlength Mode +#161 Runlength Mode + +*/ +#include "emu.h" +#include "machine/mega32x.h" + + +const device_type SEGA_32X_NTSC = &device_creator; +const device_type SEGA_32X_PAL = &device_creator; + +sega_32x_device::sega_32x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + m_master_cpu(*this, "32x_master_sh2"), + m_slave_cpu(*this, "32x_slave_sh2"), + m_lch_pwm(*this, "lch_pwm"), + m_rch_pwm(*this, "rch_pwm"), + m_sh2_shared(*this, "sh2_shared"), + m_palette(*this) +{ +} + +sega_32x_ntsc_device::sega_32x_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sega_32x_device(mconfig, SEGA_32X_NTSC, "sega_32x_ntsc", tag, owner, clock, "sega_32x_ntsc", __FILE__) +{ +} + +sega_32x_pal_device::sega_32x_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sega_32x_device(mconfig, SEGA_32X_PAL, "sega_32x_pal", tag, owner, clock, "sega_32x_pal", __FILE__) +{ +} + +//------------------------------------------------- +// static_set_palette_tag: Set the tag of the +// palette device +//------------------------------------------------- + +void sega_32x_device::static_set_palette_tag(device_t &device, const char *tag) +{ + downcast(device).m_palette.set_tag(tag); +} + +TIMER_CALLBACK( _32x_pwm_callback ); + + + +READ16_MEMBER( sega_32x_device::_32x_68k_palette_r ) +{ + return m_32x_palette[offset]; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_palette_w ) +{ + int r,g,b, p; + + COMBINE_DATA(&m_32x_palette[offset]); + data = m_32x_palette[offset]; + + r = ((data >> 0) & 0x1f); + g = ((data >> 5) & 0x1f); + b = ((data >> 10) & 0x1f); + p = ((data >> 15) & 0x01); // priority 'through' bit + + m_32x_palette_lookup[offset] = (r << 10) | (g << 5) | (b << 0) | (p << 15); + + m_palette->set_pen_color(offset+0x40,pal5bit(r),pal5bit(g),pal5bit(b)); + +} + +READ16_MEMBER( sega_32x_device::_32x_68k_dram_r ) +{ + return m_32x_access_dram[offset]; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_dram_w ) +{ + if ((mem_mask&0xffff) == 0xffff) + { + // 16-bit accesses are normal + COMBINE_DATA(&m_32x_access_dram[offset]); + } + else + { + // 8-bit writes act as if they were going to the overwrite region! + // bc-racers and world series baseball rely on this! + // (tested on real hw) + + if ((mem_mask & 0xffff) == 0xff00) + { + if ((data & 0xff00) != 0x0000) + { + m_32x_access_dram[offset] = (data & 0xff00) | (m_32x_access_dram[offset] & 0x00ff); + } + } + else if ((mem_mask & 0xffff) == 0x00ff) + { + if ((data & 0x00ff) != 0x0000) + { + m_32x_access_dram[offset] = (data & 0x00ff) | (m_32x_access_dram[offset] & 0xff00); + } + } + } +} + +READ16_MEMBER( sega_32x_device::_32x_68k_dram_overwrite_r ) +{ + return m_32x_access_dram[offset]; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_dram_overwrite_w ) +{ + //COMBINE_DATA(&m_32x_access_dram[offset+0x10000]); + + if (ACCESSING_BITS_8_15) + { + if (data & 0xff00) + { + m_32x_access_dram[offset] = (m_32x_access_dram[offset]&0x00ff) | (data & 0xff00); + } + } + + if (ACCESSING_BITS_0_7) + { + if (data & 0x00ff) + { + m_32x_access_dram[offset] = (m_32x_access_dram[offset]&0xff00) | (data & 0x00ff); + } + } +} + +/**********************************************************************************************/ +// 68k side a15112 +// FIFO +/**********************************************************************************************/ + + + + +/* + +15106 DREQ + + ---- ---- F--- -K0R + + F = Fifo FULL + K = 68k CPU Write mode (0 = no, 1 = CPU write) + 0 = always 0? no, marsch test wants it to be latched or 1 + R = RV (0 = no operation, 1 = DMA Start allowed) <-- RV bit actually affects memory mapping, this is misleading.. it just sets the memory up in a suitable way to use the genesis VDP DMA + +*/ + + + + +READ16_MEMBER( sega_32x_device::_32x_68k_a15106_r ) +{ + UINT16 retval; + + retval = m_a15106_reg; + + if (m_fifo_block_a_full && m_fifo_block_b_full) retval |= 0x8080; + + return retval; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_a15106_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_a15106_reg = data & 0x7; + + if (m_a15106_reg & 0x1) /* NBA Jam TE relies on this */ + { + // install the game rom in the normal 0x000000-0x03fffff space used by the genesis - this allows VDP DMA operations to work as they have to be from this area or RAM + // it should also UNMAP the banked rom area... + space.install_rom(0x0000100, 0x03fffff, space.machine().root_device().memregion("gamecart")->base() + 0x100); + } + else + { + // we should be careful and map back any rom overlay (hint) and backup ram too I think... + + // this is actually blank / nop area + // we should also map the banked area back (we don't currently unmap it tho) + space.install_rom(0x0000100, 0x03fffff, space.machine().root_device().memregion("maincpu")->base()+0x100); + } + + if((m_a15106_reg & 4) == 0) // clears the FIFO state + { + m_current_fifo_block = m_fifo_block_a; + m_current_fifo_readblock = m_fifo_block_b; + m_current_fifo_write_pos = 0; + m_current_fifo_read_pos = 0; + m_fifo_block_a_full = 0; + m_fifo_block_b_full = 0; + } + + //printf("_32x_68k_a15106_w %04x\n", data); + /* + if (m_a15106_reg & 0x4) + printf(" --- 68k Write Mode enabled\n"); + else + printf(" --- 68k Write Mode disabled\n"); + + if (m_a15106_reg & 0x1) + printf(" --- DMA Start Allowed \n"); + else + printf(" --- DMA Start No Operation\n"); + + */ + } +} + + + +READ16_MEMBER( sega_32x_device::_32x_dreq_common_r ) +{ + address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); + + switch (offset) + { + case 0x00/2: // a15108 / 4008 + case 0x02/2: // a1510a / 400a + return m_dreq_src_addr[offset&1]; + + case 0x04/2: // a1510c / 400c + case 0x06/2: // a1510e / 400e + return m_dreq_dst_addr[offset&1]; + + case 0x08/2: // a15110 / 4010 + return m_dreq_size; + + case 0x0a/2: // a15112 / 4012 + if (&space == &_68kspace) + { + printf("attempting to READ FIFO with 68k!\n"); + return 0xffff; + } + + UINT16 retdat = m_current_fifo_readblock[m_current_fifo_read_pos]; + + m_current_fifo_read_pos++; + + // printf("reading FIFO!\n"); + + if (m_current_fifo_readblock == m_fifo_block_a && !m_fifo_block_a_full) + printf("Fifo block a isn't filled!\n"); + + if (m_current_fifo_readblock == m_fifo_block_b && !m_fifo_block_b_full) + printf("%08x Fifo block b isn't filled!\n",space.device().safe_pc()); + + + if (m_current_fifo_read_pos==4) + { + if (m_current_fifo_readblock == m_fifo_block_a) + { + m_fifo_block_a_full = 0; + + if (m_fifo_block_b_full) + { + m_current_fifo_readblock = m_fifo_block_b; + m_current_fifo_block = m_fifo_block_a; + } + + m_current_fifo_read_pos = 0; + } + else if (m_current_fifo_readblock == m_fifo_block_b) + { + m_fifo_block_b_full = 0; + + if (m_fifo_block_a_full) + { + m_current_fifo_readblock = m_fifo_block_a; + m_current_fifo_block = m_fifo_block_b; + } + + m_current_fifo_read_pos = 0; + } + } + + return retdat; + } + + return 0x0000; +} + +WRITE16_MEMBER( sega_32x_device::_32x_dreq_common_w ) +{ + address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); + + switch (offset) + { + case 0x00/2: // a15108 / 4008 + case 0x02/2: // a1510a / 400a + if (&space != &_68kspace) + { + printf("attempting to WRITE DREQ SRC with SH2!\n"); + return; + } + + m_dreq_src_addr[offset&1] = ((offset&1) == 0) ? (data & 0xff) : (data & 0xfffe); + + //if((m_dreq_src_addr[0]<<16)|m_dreq_src_addr[1]) + // printf("DREQ set SRC = %08x\n",(m_dreq_src_addr[0]<<16)|m_dreq_src_addr[1]); + + break; + + case 0x04/2: // a1510c / 400c + case 0x06/2: // a1510e / 400e + if (&space != &_68kspace) + { + printf("attempting to WRITE DREQ DST with SH2!\n"); + return; + } + + m_dreq_dst_addr[offset&1] = ((offset&1) == 0) ? (data & 0xff) : (data & 0xffff); + + //if((m_dreq_dst_addr[0]<<16)|m_dreq_dst_addr[1]) + // printf("DREQ set DST = %08x\n",(m_dreq_dst_addr[0]<<16)|m_dreq_dst_addr[1]); + + break; + + case 0x08/2: // a15110 / 4010 + if (&space != &_68kspace) + { + printf("attempting to WRITE DREQ SIZE with SH2!\n"); + return; + } + + m_dreq_size = data & 0xfffc; + + // if(m_dreq_size) + // printf("DREQ set SIZE = %04x\n",m_dreq_size); + + break; + + case 0x0a/2: // a15112 / 4012 - FIFO Write (68k only!) + if (&space != &_68kspace) + { + printf("attempting to WRITE FIFO with SH2!\n"); + return; + } + + if (m_current_fifo_block==m_fifo_block_a && m_fifo_block_a_full) + { + printf("attempt to write to Full Fifo block a!\n"); + return; + } + + if (m_current_fifo_block==m_fifo_block_b && m_fifo_block_b_full) + { + printf("attempt to write to Full Fifo block b!\n"); + return; + } + + if((m_a15106_reg & 4) == 0) + { + printf("attempting to WRITE FIFO with 68S cleared!\n"); // corpse32 + return; + } + + m_current_fifo_block[m_current_fifo_write_pos] = data; + m_current_fifo_write_pos++; + + if (m_current_fifo_write_pos==4) + { + if (m_current_fifo_block==m_fifo_block_a) + { + m_fifo_block_a_full = 1; + if (!m_fifo_block_b_full) + { + m_current_fifo_block = m_fifo_block_b; + m_current_fifo_readblock = m_fifo_block_a; + // incase we have a stalled DMA in progress, let the SH2 know there is data available + m_master_cpu->sh2_notify_dma_data_available(); + m_slave_cpu->sh2_notify_dma_data_available(); + + } + m_current_fifo_write_pos = 0; + } + else + { + m_fifo_block_b_full = 1; + + if (!m_fifo_block_a_full) + { + m_current_fifo_block = m_fifo_block_a; + m_current_fifo_readblock = m_fifo_block_b; + // incase we have a stalled DMA in progress, let the SH2 know there is data available + m_master_cpu->sh2_notify_dma_data_available(); + m_slave_cpu->sh2_notify_dma_data_available(); + + } + + m_current_fifo_write_pos = 0; + } + } + + break; + } +} + + + + +READ16_MEMBER( sega_32x_device::_32x_68k_a1511a_r ) +{ + return m_sega_tv; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_a1511a_w ) +{ + m_sega_tv = data & 1; + + printf("SEGA TV register set = %04x\n",data); +} + +/* +000070 H interrupt vector can be overwritten apparently +*/ + + + +READ16_MEMBER( sega_32x_device::_32x_68k_m_hint_vector_r ) +{ + return m_hint_vector[offset]; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_m_hint_vector_w ) +{ + m_hint_vector[offset] = data; +} + +// returns MARS, the system ID of the 32x +READ16_MEMBER( sega_32x_device::_32x_68k_MARS_r ) +{ + switch (offset) + { + case 0: + return 0x4d41; + + case 1: + return 0x5253; + } + + return 0x0000; +} + + +/**********************************************************************************************/ +// 68k side a15100 +// control register - used to enable 32x etc. +/**********************************************************************************************/ + + + +READ16_MEMBER( sega_32x_device::_32x_68k_a15100_r ) +{ + return (m_32x_access_auth<<15) | 0x0080; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_a15100_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_a15100_reg = (m_a15100_reg & 0xff00) | (data & 0x00ff); + + if (data & 0x02) + { + m_master_cpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + m_slave_cpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } + + if (data & 0x01) + { + m_32x_adapter_enabled = 1; + space.install_rom(0x0880000, 0x08fffff, space.machine().root_device().memregion("gamecart")->base()); // 'fixed' 512kb rom bank + + space.install_read_bank(0x0900000, 0x09fffff, "bank12"); // 'bankable' 1024kb rom bank + space.machine().root_device().membank("bank12")->set_base(space.machine().root_device().memregion("gamecart")->base()+((m_32x_68k_a15104_reg&0x3)*0x100000) ); + + space.install_rom(0x0000000, 0x03fffff, space.machine().root_device().memregion("32x_68k_bios")->base()); + + /* VDP area */ + space.install_readwrite_handler(0x0a15180, 0x0a1518b, read16_delegate(FUNC(sega_32x_device::_32x_common_vdp_regs_r), this), write16_delegate(FUNC(sega_32x_device::_32x_common_vdp_regs_w),this)); // common / shared VDP regs + space.install_readwrite_handler(0x0a15200, 0x0a153ff, read16_delegate(FUNC(sega_32x_device::_32x_68k_palette_r), this), write16_delegate(FUNC(sega_32x_device::_32x_68k_palette_w),this)); // access to 'palette' xRRRRRGGGGGBBBBB + space.install_readwrite_handler(0x0840000, 0x085ffff, read16_delegate(FUNC(sega_32x_device::_32x_68k_dram_r), this), write16_delegate(FUNC(sega_32x_device::_32x_68k_dram_w),this)); // access to 'display ram' (framebuffer) + space.install_readwrite_handler(0x0860000, 0x087ffff, read16_delegate(FUNC(sega_32x_device::_32x_68k_dram_overwrite_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_dram_overwrite_w),this)); // access to 'display ram' (framebuffer) + + + + space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector + } + else + { + m_32x_adapter_enabled = 0; + + space.install_rom(0x0000000, 0x03fffff, space.machine().root_device().memregion("gamecart")->base()); + space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector + } + } + + if (ACCESSING_BITS_8_15) + { + m_a15100_reg = (m_a15100_reg & 0x00ff) | (data & 0xff00); + m_32x_access_auth = (data & 0x8000)>>15; + } +} + +/**********************************************************************************************/ +// 68k side a15102 +// command interrupt to SH2 +/**********************************************************************************************/ + + + +READ16_MEMBER( sega_32x_device::_32x_68k_a15102_r ) +{ + //printf("_32x_68k_a15102_r\n"); + return m_32x_68k_a15102_reg; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_a15102_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_32x_68k_a15102_reg = data & 3; + + if (data&0x1) + { + if (m_sh2_master_cmdint_enable) m_master_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,ASSERT_LINE); + else printf("master cmdint when masked!\n"); + } + + if (data&0x2) + { + if (m_sh2_slave_cmdint_enable) m_slave_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,ASSERT_LINE); + else printf("slave cmdint when masked!\n"); + } + } +} + +/**********************************************************************************************/ +// 68k side a15104 +// ROM banking for 68k rom +/**********************************************************************************************/ + + +READ16_MEMBER( sega_32x_device::_32x_68k_a15104_r ) +{ + return m_32x_68k_a15104_reg; +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_a15104_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_32x_68k_a15104_reg = (m_32x_68k_a15104_reg & 0xff00) | (data & 0x00ff); + } + + if (ACCESSING_BITS_8_15) + { + m_32x_68k_a15104_reg = (m_32x_68k_a15104_reg & 0x00ff) | (data & 0xff00); + } + + space.machine().root_device().membank("bank12")->set_base(space.machine().root_device().memregion("gamecart")->base()+((m_32x_68k_a15104_reg&0x3)*0x100000) ); +} + +/**********************************************************************************************/ +// 68k side a15120 - a1512f +// Communication Port 0 +// access from the SH2 via 4020 - 402f +/**********************************************************************************************/ + + +/**********************************************************************************************/ + +// reads +READ16_MEMBER( sega_32x_device::_32x_68k_m_commsram_r ) +{ + if (_32X_COMMS_PORT_SYNC) space.machine().scheduler().synchronize(); + return m_commsram[offset]; +} + +// writes +WRITE16_MEMBER( sega_32x_device::_32x_68k_m_commsram_w ) +{ + COMBINE_DATA(&m_commsram[offset]); + if (_32X_COMMS_PORT_SYNC) space.machine().scheduler().synchronize(); +} + +/**********************************************************************************************/ +// 68k side a15130 - a1513f +// PWM registers +// access from the SH2 via 4030 - 403f +/**********************************************************************************************/ + +/* +TODO: +- noticeable static noise on Virtua Fighter Sega logo at start-up +- Understand if Speaker OFF makes the FIFO to advance or not +*/ + + + + +void sega_32x_device::calculate_pwm_timer() +{ + if(m_pwm_tm_reg == 0) { m_pwm_tm_reg = 16; } // zero gives max range + if(m_pwm_cycle == 0) { m_pwm_cycle = 4095; } // zero gives max range + + /* if both RMD and LMD are set to OFF or pwm cycle register is one, then PWM timer ticks doesn't occur */ + if(m_pwm_cycle == 1 || ((m_pwm_ctrl & 0xf) == 0)) + m_32x_pwm_timer->adjust(attotime::never); + else + { + m_pwm_timer_tick = 0; + m_lch_fifo_state = m_rch_fifo_state = 0x4000; + m_lch_index_r = m_rch_index_r = 0; + m_lch_index_w = m_rch_index_w = 0; + m_32x_pwm_timer->adjust(attotime::from_hz((PWM_CLOCK) / (m_pwm_cycle - 1))); + } +} + + +void sega_32x_device::handle_pwm_callback() +{ + if(m_lch_index_r < PWM_FIFO_SIZE) + { + switch(m_pwm_ctrl & 3) + { + case 0: m_lch_index_r++; /*Speaker OFF*/ break; + case 1: m_lch_pwm->write_signed16(m_cur_lch[m_lch_index_r++]); break; + case 2: m_rch_pwm->write_signed16(m_cur_lch[m_lch_index_r++]); break; + case 3: popmessage("Undefined PWM Lch value 3, contact MESSdev"); break; + } + + m_lch_index_w = 0; + } + + m_lch_fifo_state = (m_lch_index_r == PWM_FIFO_SIZE) ? 0x4000 : 0x0000; + + if(m_rch_index_r < PWM_FIFO_SIZE) + { + switch((m_pwm_ctrl & 0xc) >> 2) + { + case 0: m_rch_index_r++; /*Speaker OFF*/ break; + case 1: m_rch_pwm->write_signed16(m_cur_rch[m_rch_index_r++]); break; + case 2: m_lch_pwm->write_signed16(m_cur_rch[m_rch_index_r++]); break; + case 3: popmessage("Undefined PWM Rch value 3, contact MESSdev"); break; + } + + m_rch_index_w = 0; + } + + m_rch_fifo_state = (m_rch_index_r == PWM_FIFO_SIZE) ? 0x4000 : 0x0000; + + m_pwm_timer_tick++; + + if(m_pwm_timer_tick == m_pwm_tm_reg) + { + m_pwm_timer_tick = 0; + if(sh2_master_pwmint_enable) { m_master_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,ASSERT_LINE); } + if(sh2_slave_pwmint_enable) { m_slave_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,ASSERT_LINE); } + } + + m_32x_pwm_timer->adjust(attotime::from_hz((PWM_CLOCK) / (m_pwm_cycle - 1))); +} + +TIMER_CALLBACK( _32x_pwm_callback ) +{ + sega_32x_device* _32xdev = (sega_32x_device*)ptr; + _32xdev->handle_pwm_callback(); +} + +READ16_MEMBER( sega_32x_device::_32x_pwm_r ) +{ + switch(offset) + { + case 0x00/2: return m_pwm_ctrl; //control register + case 0x02/2: return m_pwm_cycle_reg; // cycle register + case 0x04/2: return m_lch_fifo_state; // l ch + case 0x06/2: return m_rch_fifo_state; // r ch + case 0x08/2: return m_lch_fifo_state & m_rch_fifo_state; // mono ch + } + + printf("Read at undefined PWM register %02x\n",offset); + return 0xffff; +} + +WRITE16_MEMBER( sega_32x_device::_32x_pwm_w ) +{ + switch(offset) + { + case 0x00/2: + m_pwm_ctrl = data & 0xffff; + m_pwm_tm_reg = (m_pwm_ctrl & 0xf00) >> 8; + calculate_pwm_timer(); + break; + case 0x02/2: + m_pwm_cycle = m_pwm_cycle_reg = data & 0xfff; + calculate_pwm_timer(); + break; + case 0x04/2: + if(m_lch_index_w < PWM_FIFO_SIZE) + { + m_cur_lch[m_lch_index_w++] = ((data & 0xfff) << 4) | (data & 0xf); + m_lch_index_r = 0; + } + + m_lch_fifo_state = (m_lch_index_w == PWM_FIFO_SIZE) ? 0x8000 : 0x0000; + break; + case 0x06/2: + if(m_rch_index_w < PWM_FIFO_SIZE) + { + m_cur_rch[m_rch_index_w++] = ((data & 0xfff) << 4) | (data & 0xf); + m_rch_index_r = 0; + } + + m_rch_fifo_state = (m_rch_index_w == PWM_FIFO_SIZE) ? 0x8000 : 0x0000; + + break; + case 0x08/2: + if(m_lch_index_w < PWM_FIFO_SIZE) + { + m_cur_lch[m_lch_index_w++] = ((data & 0xfff) << 4) | (data & 0xf); + m_lch_index_r = 0; + } + + if(m_rch_index_w < PWM_FIFO_SIZE) + { + m_cur_rch[m_rch_index_w++] = ((data & 0xfff) << 4) | (data & 0xf); + m_rch_index_r = 0; + } + + m_lch_fifo_state = (m_lch_index_w == PWM_FIFO_SIZE) ? 0x8000 : 0x0000; + m_rch_fifo_state = (m_rch_index_w == PWM_FIFO_SIZE) ? 0x8000 : 0x0000; + + break; + default: + printf("Write at undefined PWM register %02x %04x\n",offset,data); + break; + } +} + +WRITE16_MEMBER( sega_32x_device::_32x_68k_pwm_w ) +{ + if(offset == 0/2) + _32x_pwm_w(space,offset,(data & 0x7f) | (m_pwm_ctrl & 0xff80),mem_mask); + else + _32x_pwm_w(space,offset,data,mem_mask); +} + +/**********************************************************************************************/ +// 68k side a15180 +// framebuffer control +// also accessed from the SH2 @ 4100 +/**********************************************************************************************/ + +UINT16 sega_32x_device::get_hposition(void) +{ + attotime time_elapsed_since_megadriv_scanline_timer; + UINT16 value4; + + time_elapsed_since_megadriv_scanline_timer = machine().device(":md_scan_timer")->time_elapsed(); + + if (time_elapsed_since_megadriv_scanline_timer.attoseconds() < (ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines)) + { + value4 = (UINT16)(MAX_HPOSITION*((double)(time_elapsed_since_megadriv_scanline_timer.attoseconds()) / (double)(ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines))); + } + else /* in some cases (probably due to rounding errors) we get some stupid results (the odd huge value where the time elapsed is much higher than the scanline time??!).. hopefully by clamping the result to the maximum we limit errors */ + { + value4 = MAX_HPOSITION; + } + + return value4; +} + +READ16_MEMBER( sega_32x_device::_32x_common_vdp_regs_r ) +{ + // what happens if the z80 accesses it, what authorization do we use? + + int ntsc; + +// printf("_32x_68k_a15180_r (a15180) %04x\n",mem_mask); + + // read needs authorization too I think, undefined behavior otherwise + switch (offset) + { + case 0x00: + + // the flag is inverted compared to the megadrive + ntsc = m_32x_pal ? 0 : 1; + + return (ntsc << 15) | + (m_32x_videopriority << 7) | + (m_32x_240mode << 6) | + (m_32x_displaymode << 0); + + case 0x02/2: + return m_32x_screenshift; + + case 0x04/2: + return m_32x_autofill_length; + + case 0x06/2: + return m_32x_autofill_address; + + case 0x08/2: + return m_32x_autofill_data; + + case 0x0a/2: + UINT16 retdata = m_32x_a1518a_reg; + UINT16 hpos = get_hposition(); + int megadrive_hblank_flag = 0; + + if (m_32x_vblank_flag) retdata |= 0x8000; + + if (hpos>400) megadrive_hblank_flag = 1; + if (hpos>460) megadrive_hblank_flag = 0; + + if (megadrive_hblank_flag) retdata |= 0x4000; + + if (m_32x_vblank_flag) { retdata |= 2; } // framebuffer approval (TODO: condition is unknown at current time) + + if (megadrive_hblank_flag && m_32x_vblank_flag) { retdata |= 0x2000; } // palette approval (TODO: active high or low?) + + return retdata; + } + + return 0x0000; +} + + +void sega_32x_device::_32x_check_framebuffer_swap(bool enabled) +{ + // this logic should be correct, but makes things worse? + // enabled = (genesis_scanline_counter >= megadrive_irq6_scanline) from video/315_5313.c + //if (enabled) + { + m_32x_a1518a_reg = m_32x_fb_swap & 1; + + + + if (m_32x_fb_swap & 1) + { + m_32x_access_dram = m_32x_dram0; + m_32x_display_dram = m_32x_dram1; + } + else + { + m_32x_display_dram = m_32x_dram0; + m_32x_access_dram = m_32x_dram1; + } + } +} + + +WRITE16_MEMBER( sega_32x_device::_32x_common_vdp_regs_w ) +{ + // what happens if the z80 accesses it, what authorization do we use? which address space do we get?? the z80 *can* write here and to the framebuffer via the window + + address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); + + if (&space!= &_68kspace) + { + if (m_32x_access_auth!=1) + return; + } + + if (&space== &_68kspace) + { + if (m_32x_access_auth!=0) + return; + } + + + switch (offset) + { + case 0x00: + //printf("_32x_68k_a15180_w (a15180) %04x %04x source m_32x_access_auth %04x\n",data,mem_mask, m_32x_access_auth); + + if (ACCESSING_BITS_0_7) + { + m_32x_videopriority = (data & 0x80) >> 7; + m_32x_240mode = (data & 0x40) >> 6; + m_32x_displaymode = (data & 0x03) >> 0; + } + break; + + case 0x02/2: + if (ACCESSING_BITS_0_7) + { + m_32x_screenshift = data & 1; // allows 1 pixel shifting + } + if (ACCESSING_BITS_8_15) + { + } + break; + + case 0x04/2: + if (ACCESSING_BITS_0_7) + { + m_32x_autofill_length = data & 0xff; + } + + if (ACCESSING_BITS_8_15) + { + } + break; + + case 0x06/2: + if (ACCESSING_BITS_0_7) + { + m_32x_autofill_address = (m_32x_autofill_address & 0xff00) | (data & 0x00ff); + } + + if (ACCESSING_BITS_8_15) + { + m_32x_autofill_address = (m_32x_autofill_address & 0x00ff) | (data & 0xff00); + } + break; + + case 0x08/2: + if (ACCESSING_BITS_0_7) + { + m_32x_autofill_data = (m_32x_autofill_data & 0xff00) | (data & 0x00ff); + } + + if (ACCESSING_BITS_8_15) + { + m_32x_autofill_data = (m_32x_autofill_data & 0x00ff) | (data & 0xff00); + } + + // do the fill - shouldn't be instant.. + { + int i; + for (i=0; i> 15; + } + + if (ACCESSING_BITS_0_7) + { + m_sh2_hint_in_vbl = data & 0x80; + m_sh2_master_vint_enable = data & 0x8; + m_sh2_master_hint_enable = data & 0x4; + m_sh2_master_cmdint_enable = data & 0x2; + sh2_master_pwmint_enable = data & 0x1; + + //if (m_sh2_master_hint_enable) printf("m_sh2_master_hint_enable enable!\n"); + //if (sh2_master_pwmint_enable) printf("sh2_master_pwn_enable enable!\n"); + + _32x_check_irqs(); + } +} + +/* SLAVE */ + +READ16_MEMBER( sega_32x_device::_32x_sh2_slave_4000_r ) +{ + UINT16 retvalue = 0x0200; + retvalue |= m_32x_access_auth << 15; + retvalue |= m_sh2_hint_in_vbl; + retvalue |= m_sh2_slave_vint_enable; + retvalue |= m_sh2_slave_hint_enable; + retvalue |= m_sh2_slave_cmdint_enable; + retvalue |= sh2_slave_pwmint_enable; + + return retvalue; +} + + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4000_w ) +{ + if (ACCESSING_BITS_8_15) + { + m_32x_access_auth = (data &0x8000) >> 15; + } + + if (ACCESSING_BITS_0_7) + { + m_sh2_hint_in_vbl = data & 0x80; + m_sh2_slave_vint_enable = data & 0x8; + m_sh2_slave_hint_enable = data & 0x4; + m_sh2_slave_cmdint_enable = data & 0x2; + sh2_slave_pwmint_enable = data & 0x1; + + //if (m_sh2_slave_hint_enable) printf("m_sh2_slave_hint_enable enable!\n"); + //if (sh2_slave_pwmint_enable) printf("sh2_slave_pwm_enable enable!\n"); + + _32x_check_irqs(); + } +} + +/**********************************************************************************************/ +// SH2 side 4002 +// Reserved ( Stand By Change Register ) +// Shouldn't be used +/**********************************************************************************************/ + +READ16_MEMBER( sega_32x_device::_32x_sh2_common_4002_r ) +{ + printf("reading 4002!\n"); + return 0x0000; +} + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4002_w ) +{ + printf("write 4002!\n"); +} + + +/**********************************************************************************************/ +// SH2 side 4004 +// H Count Register (H Interrupt) +// 0 = every line +/**********************************************************************************************/ +READ16_MEMBER( sega_32x_device::_32x_sh2_common_4004_r ) +{ + return m_32x_hcount_reg; +} + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4004_w ) +{ + m_32x_hcount_reg = data & 0xff; +} + + +/**********************************************************************************************/ +// SH2 side 4006 +// DReq Control Register +/**********************************************************************************************/ + +READ16_MEMBER( sega_32x_device::_32x_sh2_common_4006_r ) +{ + //printf("DREQ read!\n"); // tempo reads it, shut up for now + return _32x_68k_a15106_r(space,offset,mem_mask); +} + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4006_w ) +{ + printf("DREQ write!\n"); //register is read only on SH-2 side +} + + +/**********************************************************************************************/ +// SH2 side 4014 +// VRES (md reset button interrupt) clear +/**********************************************************************************************/ + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4014_w ){ m_master_cpu->set_input_line(SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} +WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4014_w ) { m_slave_cpu->set_input_line(SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} + +/**********************************************************************************************/ +// SH2 side 4016 +// VINT (vertical interrupt) clear +/**********************************************************************************************/ + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4016_w ){ m_sh2_master_vint_pending = 0; _32x_check_irqs(); } +WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4016_w ) { m_sh2_slave_vint_pending = 0; _32x_check_irqs(); } + +/**********************************************************************************************/ +// SH2 side 4018 +// HINT (horizontal interrupt) clear +/**********************************************************************************************/ + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4018_w ){ m_master_cpu->set_input_line(SH2_HINT_IRQ_LEVEL,CLEAR_LINE);} +WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4018_w ) { m_slave_cpu->set_input_line(SH2_HINT_IRQ_LEVEL,CLEAR_LINE);} + +/**********************************************************************************************/ +// SH2 side 401A +// HINT (control register interrupt) clear +// Note: flag cleared here is a guess, according to After Burner behaviour +/**********************************************************************************************/ + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401a_w ){ m_32x_68k_a15102_reg &= ~1; m_master_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,CLEAR_LINE);} +WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401a_w ) { m_32x_68k_a15102_reg &= ~2; m_slave_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,CLEAR_LINE);} + +/**********************************************************************************************/ +// SH2 side 401C +// PINT (PWM timer interrupt) clear +/**********************************************************************************************/ + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401c_w ){ m_master_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,CLEAR_LINE);} +WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401c_w ) { m_slave_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,CLEAR_LINE);} + +/**********************************************************************************************/ +// SH2 side 401E +// ?? unknown / unused +/**********************************************************************************************/ + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401e_w ) +{ + printf("_32x_sh2_master_401e_w\n"); +} + +WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401e_w ) +{ + printf("_32x_sh2_slave_401e_w\n"); +} + +/**********************************************************************************************/ +// SH2 side 4020 - 402f +// SH2 -> 68k Comms ports, +// access at a15120 - a1512f on 68k +// these just map through to the 68k functions +/**********************************************************************************************/ + +/* handled directly */ + +/**********************************************************************************************/ +// SH2 side 4030 +// PWM Control Register +/**********************************************************************************************/ + +/**********************************************************************************************/ +// SH2 side 4032 +// Cycle Register +/**********************************************************************************************/ + + +/**********************************************************************************************/ +// SH2 side 4034 +// LCH Pulse Width Register +/**********************************************************************************************/ + +/**********************************************************************************************/ +// SH2 side 4036 +// RCH Pulse Width Register +/**********************************************************************************************/ + +/**********************************************************************************************/ +// SH2 side 4038 +// Mono Pulse Width Register +/**********************************************************************************************/ + +/* 4100 - 43ff are VDP registers, you need permission to access them - ensure this is true for all! */ + +/**********************************************************************************************/ +// SH2 side 4200 - 43ff +// palette +// maps through to 68k at a15200 - a153ff +/**********************************************************************************************/ + +/* handled directly */ + +/**********************************************************************************************/ +// SH2 side 4000000 - 401ffff +// framebuffer +// maps through to 68k at 840000 - 85ffff +/**********************************************************************************************/ + +/* handled directly */ + +/**********************************************************************************************/ +// SH2 side 4020000 - 403ffff +// framebuffer overwrite +// maps through to 68k at 860000 - 87ffff +/**********************************************************************************************/ + +/* handled directly */ + +/**********************************************************************************************/ +// SH2 access Macros +/**********************************************************************************************/ + + +/* the 32x treats everything as 16-bit registers, so we remap the 32-bit read & writes + to 2x 16-bit handlers here (TODO: nuke this eventually) */ + +#define _32X_MAP_READHANDLERS(NAMEA,NAMEB) \ +READ32_MEMBER( sega_32x_device::_32x_sh2_##NAMEA##_##NAMEB##_r ) \ +{ \ + UINT32 retvalue = 0x00000000; \ + if (ACCESSING_BITS_16_31) \ + { \ + UINT16 ret = _32x_sh2_##NAMEA##_r(space,0,(mem_mask>>16)&0xffff); \ + retvalue |= ret << 16; \ + } \ + if (ACCESSING_BITS_0_15) \ + { \ + UINT16 ret = _32x_sh2_##NAMEB##_r(space,0,(mem_mask>>0)&0xffff); \ + retvalue |= ret << 0; \ + } \ + \ + return retvalue; \ +} +#define _32X_MAP_WRITEHANDLERS(NAMEA,NAMEB) \ +WRITE32_MEMBER( sega_32x_device::_32x_sh2_##NAMEA##_##NAMEB##_w) \ +{ \ + if (ACCESSING_BITS_16_31) \ + { \ + _32x_sh2_##NAMEA##_w(space,0,(data>>16)&0xffff,(mem_mask>>16)&0xffff); \ + } \ + if (ACCESSING_BITS_0_15) \ + { \ + _32x_sh2_##NAMEB##_w(space,0,(data>>0)&0xffff,(mem_mask>>0)&0xffff); \ + } \ +} + + + +/**********************************************************************************************/ +// SH2 access for Memory Map +/**********************************************************************************************/ + +_32X_MAP_READHANDLERS(master_4000,common_4002) // _32x_sh2_master_4000_common_4002_r +_32X_MAP_WRITEHANDLERS(master_4000,common_4002) // _32x_sh2_master_4000_common_4002_w + +_32X_MAP_READHANDLERS(slave_4000,common_4002) // _32x_sh2_slave_4000_common_4002_r +_32X_MAP_WRITEHANDLERS(slave_4000,common_4002) // _32x_sh2_slave_4000_common_4002_w + +_32X_MAP_READHANDLERS(common_4004,common_4006) +_32X_MAP_WRITEHANDLERS(common_4004,common_4006) + +_32X_MAP_WRITEHANDLERS(master_4014,master_4016) // _32x_sh2_master_4014_master_4016_w +_32X_MAP_WRITEHANDLERS(master_4018,master_401a) // _32x_sh2_master_4018_master_401a_w +_32X_MAP_WRITEHANDLERS(master_401c,master_401e) // _32x_sh2_master_401c_master_401e_w + +_32X_MAP_WRITEHANDLERS(slave_4014,slave_4016) // _32x_sh2_slave_4014_slave_4016_w +_32X_MAP_WRITEHANDLERS(slave_4018,slave_401a) // _32x_sh2_slave_4018_slave_401a_w +_32X_MAP_WRITEHANDLERS(slave_401c,slave_401e) // _32x_sh2_slave_401c_slave_401e_w + + + +/**********************************************************************************************/ +// SH2 memory maps +/**********************************************************************************************/ + +ADDRESS_MAP_START( sh2_main_map, AS_PROGRAM, 32, sega_32x_device ) + AM_RANGE(0x00000000, 0x00003fff) AM_ROMBANK("masterbios") + + AM_RANGE(0x00004000, 0x00004003) AM_READWRITE(_32x_sh2_master_4000_common_4002_r, _32x_sh2_master_4000_common_4002_w ) + AM_RANGE(0x00004004, 0x00004007) AM_READWRITE(_32x_sh2_common_4004_common_4006_r, _32x_sh2_common_4004_common_4006_w) + + AM_RANGE(0x00004008, 0x00004013) AM_READWRITE16(_32x_dreq_common_r, _32x_dreq_common_w, 0xffffffff ) + + AM_RANGE(0x00004014, 0x00004017) AM_READNOP AM_WRITE(_32x_sh2_master_4014_master_4016_w ) // IRQ clear + AM_RANGE(0x00004018, 0x0000401b) AM_READNOP AM_WRITE(_32x_sh2_master_4018_master_401a_w ) // IRQ clear + AM_RANGE(0x0000401c, 0x0000401f) AM_READNOP AM_WRITE(_32x_sh2_master_401c_master_401e_w ) // IRQ clear + + AM_RANGE(0x00004020, 0x0000402f) AM_READWRITE16(_32x_68k_m_commsram_r, _32x_68k_m_commsram_w, 0xffffffff ) + AM_RANGE(0x00004030, 0x0000403f) AM_READWRITE16(_32x_pwm_r, _32x_pwm_w, 0xffffffff ) + + AM_RANGE(0x00004100, 0x0000410b) AM_READWRITE16(_32x_common_vdp_regs_r, _32x_common_vdp_regs_w , 0xffffffff) + AM_RANGE(0x00004200, 0x000043ff) AM_READWRITE16(_32x_68k_palette_r, _32x_68k_palette_w, 0xffffffff) + + AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE16(_32x_68k_dram_r, _32x_68k_dram_w, 0xffffffff) + AM_RANGE(0x04020000, 0x0403ffff) AM_READWRITE16(_32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w, 0xffffffff) + + AM_RANGE(0x06000000, 0x0603ffff) AM_RAM AM_SHARE("sh2_shared") + AM_RANGE(0x02000000, 0x023fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // program is writeable (wwfraw) + + AM_RANGE(0x22000000, 0x223fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // cart mirror (fifa96) + + AM_RANGE(0xc0000000, 0xc0000fff) AM_RAM +ADDRESS_MAP_END + +ADDRESS_MAP_START( sh2_slave_map, AS_PROGRAM, 32, sega_32x_device ) + AM_RANGE(0x00000000, 0x00003fff) AM_ROMBANK("slavebios") + + AM_RANGE(0x00004000, 0x00004003) AM_READWRITE(_32x_sh2_slave_4000_common_4002_r, _32x_sh2_slave_4000_common_4002_w ) + AM_RANGE(0x00004004, 0x00004007) AM_READWRITE(_32x_sh2_common_4004_common_4006_r, _32x_sh2_common_4004_common_4006_w) + + AM_RANGE(0x00004008, 0x00004013) AM_READWRITE16(_32x_dreq_common_r, _32x_dreq_common_w, 0xffffffff ) + + AM_RANGE(0x00004014, 0x00004017) AM_READNOP AM_WRITE(_32x_sh2_slave_4014_slave_4016_w ) // IRQ clear + AM_RANGE(0x00004018, 0x0000401b) AM_READNOP AM_WRITE(_32x_sh2_slave_4018_slave_401a_w ) // IRQ clear + AM_RANGE(0x0000401c, 0x0000401f) AM_READNOP AM_WRITE(_32x_sh2_slave_401c_slave_401e_w ) // IRQ clear + + AM_RANGE(0x00004020, 0x0000402f) AM_READWRITE16(_32x_68k_m_commsram_r, _32x_68k_m_commsram_w, 0xffffffff ) + AM_RANGE(0x00004030, 0x0000403f) AM_READWRITE16(_32x_pwm_r, _32x_pwm_w, 0xffffffff ) + + AM_RANGE(0x00004100, 0x0000410b) AM_READWRITE16(_32x_common_vdp_regs_r, _32x_common_vdp_regs_w , 0xffffffff) + AM_RANGE(0x00004200, 0x000043ff) AM_READWRITE16(_32x_68k_palette_r, _32x_68k_palette_w, 0xffffffff) + + AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE16(_32x_68k_dram_r, _32x_68k_dram_w, 0xffffffff) + AM_RANGE(0x04020000, 0x0403ffff) AM_READWRITE16(_32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w, 0xffffffff) + + AM_RANGE(0x06000000, 0x0603ffff) AM_RAM AM_SHARE("sh2_shared") + AM_RANGE(0x02000000, 0x023fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // program is writeable (wwfraw) + + AM_RANGE(0x22000000, 0x223fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // cart mirror (fifa96) + + AM_RANGE(0xc0000000, 0xc0000fff) AM_RAM +ADDRESS_MAP_END + +/****************************************** END 32X related *************************************/ + + + + +void sega_32x_device::_32x_check_irqs() +{ + if (m_sh2_master_vint_enable && m_sh2_master_vint_pending) m_master_cpu->set_input_line(SH2_VINT_IRQ_LEVEL,ASSERT_LINE); + else m_master_cpu->set_input_line(SH2_VINT_IRQ_LEVEL,CLEAR_LINE); + + if (m_sh2_slave_vint_enable && m_sh2_slave_vint_pending) m_slave_cpu->set_input_line(SH2_VINT_IRQ_LEVEL,ASSERT_LINE); + else m_slave_cpu->set_input_line(SH2_VINT_IRQ_LEVEL,CLEAR_LINE); +} + +void sega_32x_device::_32x_interrupt_cb(int scanline, int irq6) +{ + if (scanline == irq6) + { + m_32x_vblank_flag = 1; + m_sh2_master_vint_pending = 1; + m_sh2_slave_vint_pending = 1; + _32x_check_irqs(); + } + + _32x_check_framebuffer_swap(scanline >= irq6); + + m_32x_hcount_compare_val++; + + if (m_32x_hcount_compare_val >= m_32x_hcount_reg) + { + m_32x_hcount_compare_val = -1; + + if (scanline < 224 || m_sh2_hint_in_vbl) + { + if (m_sh2_master_hint_enable) + m_master_cpu->set_input_line(SH2_HINT_IRQ_LEVEL, ASSERT_LINE); + if (m_sh2_slave_hint_enable) + m_slave_cpu->set_input_line(SH2_HINT_IRQ_LEVEL, ASSERT_LINE); + } + } +} + + +SH2_DMA_FIFO_DATA_AVAILABLE_CB(sega_32x_device::_32x_fifo_available_callback) +{ + if (src==0x4012) + { + if (m_current_fifo_readblock==m_fifo_block_a && m_fifo_block_a_full) + return 1; + + if (m_current_fifo_readblock==m_fifo_block_b && m_fifo_block_b_full) + return 1; + + return 0; + } + + return 1; +} + + + +void sega_32x_device::_32x_render_videobuffer_to_screenbuffer_helper(int scanline) +{ + int x; + + /* render 32x output to a buffer */ + if (m_32x_displaymode != 0) + { + if (m_32x_displaymode==1) + { + UINT32 lineoffs; + int start; + + lineoffs = m_32x_display_dram[scanline]; + + if (m_32x_screenshift == 0) start=0; + else start = -1; + + for (x=start;x<320;x++) + { + UINT16 coldata; + coldata = m_32x_display_dram[lineoffs]; + + { + if (x>=0) + { + m_32x_linerender[x] = m_32x_palette_lookup[(coldata & 0xff00)>>8]; + } + + x++; + + if (x>=0) + { + m_32x_linerender[x] = m_32x_palette_lookup[(coldata & 0x00ff)]; + } + } + + lineoffs++; + + } + } + else if (m_32x_displaymode==3) // mode 3 = RLE (used by BRUTAL intro) + { + UINT32 lineoffs; + int start; + + lineoffs = m_32x_display_dram[scanline]; + + if (m_32x_screenshift == 0) start=0; + else start = -1; + + x = start; + while (x<320) + { + UINT16 coldata, length, l; + coldata = m_32x_display_dram[lineoffs]; + length = ((coldata & 0xff00)>>8)+1; + coldata = (coldata & 0x00ff)>>0; + for (l=0;l=0) + { + m_32x_linerender[x] = m_32x_palette_lookup[(coldata)]; + } + x++; + } + + lineoffs++; + + } + } + else // MODE 2 - 15bpp mode, not used by any commercial games? + { + UINT32 lineoffs; + int start; + + lineoffs = m_32x_display_dram[scanline]; + + if (m_32x_screenshift == 0) start=0; + else start = -1; + + x = start; + while (x<320) + { + UINT16 coldata; + coldata = m_32x_display_dram[lineoffs&0xffff]; + + // need to swap red and blue around for MAME + { + int r = ((coldata >> 0) & 0x1f); + int g = ((coldata >> 5) & 0x1f); + int b = ((coldata >> 10) & 0x1f); + int p = ((coldata >> 15) & 0x01); // priority 'through' bit + + coldata = (r << 10) | (g << 5) | (b << 0) | (p << 15); + + } + + if (x>=0) + m_32x_linerender[x] = coldata; + + x++; + lineoffs++; + } + } + } +} + +void sega_32x_device::_32x_render_videobuffer_to_screenbuffer(int x, UINT32 priority, UINT16 &lineptr) +{ + if (m_32x_displaymode != 0) + { + if (!m_32x_videopriority) + { + if (priority && !(m_32x_linerender[x] & 0x8000)) + lineptr = m_32x_linerender[x] & 0x7fff; + if (m_32x_linerender[x] & 0x8000) + lineptr = m_32x_linerender[x] & 0x7fff; + } + else + { + if (priority && m_32x_linerender[x] & 0x8000) + lineptr = m_32x_linerender[x] & 0x7fff; + if (!(m_32x_linerender[x] & 0x8000)) + lineptr = m_32x_linerender[x] & 0x7fff; + } + } +} + +#if 0 +// for now we just use the regular loading because we have 2 different BIOS roms, and you can't use -bios within a device for obvious reasons +ROM_START( 32x ) + ROM_REGION( 0x400000, "32x_master_sh2", 0 ) + ROM_REGION( 0x400000, "32x_slave_sh2", 0 ) +ROM_END + +const rom_entry *sega_32x_device::device_rom_region() const +{ + return ROM_NAME( 32x ); +} +#endif + + +// brutal needs high levels of interleave or the background animations don't work +// and some stages simply freeze the game, the is not good for performance however. +// +// some games appear to dislike 'perfect' levels of interleave, probably due to +// non-emulated cache, ram waitstates and other issues? +#define _32X_INTERLEAVE_LEVEL \ + MCFG_QUANTUM_TIME(attotime::from_hz(1800000)) + +static MACHINE_CONFIG_FRAGMENT( _32x_ntsc ) + +#ifndef _32X_SWAP_MASTER_SLAVE_HACK + MCFG_CPU_ADD("32x_master_sh2", SH2, (MASTER_CLOCK_NTSC*3)/7 ) + MCFG_CPU_PROGRAM_MAP(sh2_main_map) + MCFG_SH2_IS_SLAVE(0) + MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) +#endif + + MCFG_CPU_ADD("32x_slave_sh2", SH2, (MASTER_CLOCK_NTSC*3)/7 ) + MCFG_CPU_PROGRAM_MAP(sh2_slave_map) + MCFG_SH2_IS_SLAVE(1) + MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) + +#ifdef _32X_SWAP_MASTER_SLAVE_HACK + MCFG_CPU_ADD("32x_master_sh2", SH2, (MASTER_CLOCK_NTSC*3)/7 ) + MCFG_CPU_PROGRAM_MAP(sh2_main_map) + MCFG_SH2_IS_SLAVE(0) + MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) +#endif + + MCFG_DAC_ADD("lch_pwm") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":lspeaker", 0.40) + + MCFG_DAC_ADD("rch_pwm") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":rspeaker", 0.40) + + _32X_INTERLEAVE_LEVEL +MACHINE_CONFIG_END + +static MACHINE_CONFIG_FRAGMENT( _32x_pal ) + +#ifndef _32X_SWAP_MASTER_SLAVE_HACK + MCFG_CPU_ADD("32x_master_sh2", SH2, (MASTER_CLOCK_PAL*3)/7 ) + MCFG_CPU_PROGRAM_MAP(sh2_main_map) + MCFG_SH2_IS_SLAVE(0) + MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) +#endif + + MCFG_CPU_ADD("32x_slave_sh2", SH2, (MASTER_CLOCK_PAL*3)/7 ) + MCFG_CPU_PROGRAM_MAP(sh2_slave_map) + MCFG_SH2_IS_SLAVE(1) + MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) + +#ifdef _32X_SWAP_MASTER_SLAVE_HACK + MCFG_CPU_ADD("32x_master_sh2", SH2, (MASTER_CLOCK_PAL*3)/7 ) + MCFG_CPU_PROGRAM_MAP(sh2_main_map) + MCFG_SH2_IS_SLAVE(0) + MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) +#endif + + MCFG_DAC_ADD("lch_pwm") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":lspeaker", 0.40) + + MCFG_DAC_ADD("rch_pwm") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":rspeaker", 0.40) + + _32X_INTERLEAVE_LEVEL +MACHINE_CONFIG_END + + + +machine_config_constructor sega_32x_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( _32x_ntsc ); +} + +machine_config_constructor sega_32x_pal_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( _32x_pal ); +} + + +void sega_32x_device::device_start() +{ + m_32x_pwm_timer = machine().scheduler().timer_alloc(FUNC(_32x_pwm_callback), (void*)this); + m_32x_pwm_timer->adjust(attotime::never); + + m_32x_dram0 = auto_alloc_array(machine(), UINT16, 0x40000/2); + m_32x_dram1 = auto_alloc_array(machine(), UINT16, 0x40000/2); + + memset(m_32x_dram0, 0x00, 0x40000); + memset(m_32x_dram1, 0x00, 0x40000); + + m_32x_palette_lookup = auto_alloc_array(machine(), UINT16, 0x200/2); + m_32x_palette = auto_alloc_array(machine(), UINT16, 0x200/2); + + memset(m_32x_palette_lookup, 0x00, 0x200); + memset(m_32x_palette, 0x00, 0x200); + + m_32x_display_dram = m_32x_dram0; + m_32x_access_dram = m_32x_dram1; +} + +void sega_32x_device::device_reset() +{ + /* Interrupts are masked / disabled at first */ + m_sh2_master_vint_enable = m_sh2_slave_vint_enable = 0; + m_sh2_master_hint_enable = m_sh2_slave_hint_enable = 0; + m_sh2_master_cmdint_enable = m_sh2_slave_cmdint_enable = 0; + sh2_master_pwmint_enable = sh2_slave_pwmint_enable = 0; + m_sh2_master_vint_pending = m_sh2_slave_vint_pending = 0; + m_sh2_hint_in_vbl = 0; + + // start in a reset state + m_sh2_are_running = 0; + + m_32x_a1518a_reg = 0x00; // inital value + m_32x_68k_a15104_reg = 0x00; + + m_32x_autofill_length = 0; + m_32x_autofill_address = 0; + m_32x_autofill_data = 0; + m_32x_screenshift = 0; + m_32x_videopriority = 0; // MD priority + m_32x_displaymode = 0; + m_32x_240mode = 0; + + m_current_fifo_block = m_fifo_block_a; + m_current_fifo_readblock = m_fifo_block_b; + m_current_fifo_write_pos = 0; + m_current_fifo_read_pos = 0; + m_fifo_block_a_full = 0; + m_fifo_block_b_full = 0; + + m_32x_hcount_compare_val = -1; + m_32x_hcount_reg = 0; + + m_32x_fb_swap = 0; + + m_pwm_tm_reg = 0; + m_pwm_cycle = 0; + m_pwm_ctrl = 0; + + m_lch_index_w = 0; + m_rch_index_w = 0; + + m_total_scanlines = 262; + +// moved from init + + m_32x_adapter_enabled = 0; + m_32x_access_auth = 0; + + if (m_32x_adapter_enabled == 0) + { + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_rom(0x0000000, 0x03fffff, machine().root_device().memregion(":gamecart")->base()); + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector + }; + + + m_a15100_reg = 0x0000; + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15100, 0xa15101, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_w),this)); // framebuffer control regs + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15102, 0xa15103, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_w),this)); // send irq to sh2 + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15104, 0xa15105, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_w),this)); // 68k BANK rom set + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15106, 0xa15107, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_w),this)); // dreq stuff + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15108, 0xa15113, read16_delegate(FUNC(sega_32x_device::_32x_dreq_common_r),this), write16_delegate(FUNC(sega_32x_device::_32x_dreq_common_w),this)); // dreq src / dst / length /fifo + + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa1511a, 0xa1511b, read16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_w),this)); // SEGA TV + + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15120, 0xa1512f, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_commsram_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_commsram_w),this)); // comms reg 0-7 + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15130, 0xa1513f, read16_delegate(FUNC(sega_32x_device::_32x_pwm_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_pwm_w),this)); + + machine().device(":maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0a130ec, 0x0a130ef, read16_delegate(FUNC(sega_32x_device::_32x_68k_MARS_r),this)); // system ID + + + +// checking if these help brutal, they don't. + m_master_cpu->sh2drc_set_options(SH2DRC_COMPATIBLE_OPTIONS); + m_slave_cpu->sh2drc_set_options(SH2DRC_COMPATIBLE_OPTIONS); + + UINT32 *cart = (UINT32 *)memregion(":gamecart_sh2")->base(); + + m_master_cpu->sh2drc_add_fastram(0x06000000, 0x0603ffff, 0, &m_sh2_shared[0]); + m_master_cpu->sh2drc_add_fastram(0x02000000, 0x023fffff, 0, cart); + m_master_cpu->sh2drc_add_fastram(0x22000000, 0x223fffff, 0, cart); + m_slave_cpu->sh2drc_add_fastram(0x06000000, 0x0603ffff, 0, &m_sh2_shared[0]); + m_slave_cpu->sh2drc_add_fastram(0x02000000, 0x023fffff, 0, cart); + m_slave_cpu->sh2drc_add_fastram(0x22000000, 0x223fffff, 0, cart); + + +// install these now, otherwise we'll get the following (incorrect) warnings on startup.. +// SH-2 device ':sega32x:32x_slave_sh2': program space memory map entry 0-3FFF references non-existant region ':slave' +// SH-2 device ':sega32x:32x_master_sh2': program space memory map entry 0-3FFF references non-existant region ':master' + UINT8* masterbios = (UINT8*)machine().root_device().memregion(":master")->base(); + UINT8* slavebios = (UINT8*)machine().root_device().memregion(":slave")->base(); + membank("masterbios")->configure_entries(0, 1, masterbios, 0x4000); + membank("slavebios")->configure_entries(0, 1, slavebios, 0x4000); + membank("masterbios")->set_entry(0); + membank("slavebios")->set_entry(0); +} + +// if the system has a 32x, the extra CPUs are paused at start +void sega_32x_device::pause_cpu() +{ + m_master_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_slave_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); +} diff --git a/src/mame/machine/mega32x.h b/src/mame/machine/mega32x.h new file mode 100644 index 00000000000..fd9ed2131a8 --- /dev/null +++ b/src/mame/machine/mega32x.h @@ -0,0 +1,235 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/* 32X */ + + +// Fifa96 needs the CPUs swapped for the gameplay to enter due to some race conditions +// when using the DRC core. Needs further investigation, the non-DRC core works either +// way +#define _32X_SWAP_MASTER_SLAVE_HACK +#define _32X_COMMS_PORT_SYNC 0 +#define MAX_HPOSITION 480 +/* need to make some pwm stuff part of device */ +#define PWM_FIFO_SIZE m_pwm_tm_reg // guess, Marsch calls this register as FIFO width +#define PWM_CLOCK m_32x_pal ? ((MASTER_CLOCK_PAL*3) / 7) : ((MASTER_CLOCK_NTSC*3) / 7) + + + +#define SH2_VRES_IRQ_LEVEL 14 +#define SH2_VINT_IRQ_LEVEL 12 +#define SH2_HINT_IRQ_LEVEL 10 +#define SH2_CINT_IRQ_LEVEL 8 +#define SH2_PINT_IRQ_LEVEL 6 + +#define MASTER_CLOCK_NTSC 53693175 +#define MASTER_CLOCK_PAL 53203424 + +#include "cpu/sh2/sh2.h" +#include "cpu/sh2/sh2comn.h" +#include "sound/dac.h" + +class sega_32x_device : public device_t +{ +public: + sega_32x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + required_device m_master_cpu; + required_device m_slave_cpu; + required_device m_lch_pwm; + required_device m_rch_pwm; + + required_shared_ptr m_sh2_shared; + + void pause_cpu(); + + // set some variables at start, depending on region (shall be moved to a device interface?) + void set_framerate(int rate) { m_framerate = rate; } + void set_32x_pal(bool pal) { m_32x_pal = pal ? 1 : 0; } + void set_total_scanlines(int total) { m_base_total_scanlines = total; } // this get set at start only + void update_total_scanlines(bool mode3) { m_total_scanlines = mode3 ? (m_base_total_scanlines * 2) : m_base_total_scanlines; } // this gets set at each EOF + + // static configuration + static void static_set_palette_tag(device_t &device, const char *tag); + + DECLARE_READ32_MEMBER( _32x_sh2_master_4000_common_4002_r ); + DECLARE_READ32_MEMBER( _32x_sh2_slave_4000_common_4002_r ); + DECLARE_READ32_MEMBER( _32x_sh2_common_4004_common_4006_r ); + DECLARE_WRITE32_MEMBER( _32x_sh2_master_4000_common_4002_w ); + DECLARE_WRITE32_MEMBER( _32x_sh2_slave_4000_common_4002_w ); + DECLARE_WRITE32_MEMBER( _32x_sh2_common_4004_common_4006_w ); + DECLARE_WRITE32_MEMBER( _32x_sh2_master_4014_master_4016_w ); + DECLARE_WRITE32_MEMBER( _32x_sh2_master_4018_master_401a_w ); + DECLARE_WRITE32_MEMBER( _32x_sh2_master_401c_master_401e_w ); + DECLARE_WRITE32_MEMBER( _32x_sh2_slave_4014_slave_4016_w ); + DECLARE_WRITE32_MEMBER( _32x_sh2_slave_4018_slave_401a_w ); + DECLARE_WRITE32_MEMBER( _32x_sh2_slave_401c_slave_401e_w ); + + + DECLARE_READ16_MEMBER( _32x_68k_palette_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_palette_w ); + DECLARE_READ16_MEMBER( _32x_68k_dram_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_dram_w ); + DECLARE_READ16_MEMBER( _32x_68k_dram_overwrite_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_dram_overwrite_w ); + DECLARE_READ16_MEMBER( _32x_68k_a15106_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_a15106_w ); + DECLARE_READ16_MEMBER( _32x_dreq_common_r ); + DECLARE_WRITE16_MEMBER( _32x_dreq_common_w ); + DECLARE_READ16_MEMBER( _32x_68k_a1511a_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_a1511a_w ); + DECLARE_READ16_MEMBER( _32x_68k_m_hint_vector_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_m_hint_vector_w ); + DECLARE_READ16_MEMBER( _32x_68k_MARS_r ); + DECLARE_READ16_MEMBER( _32x_68k_a15100_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_a15100_w ); + DECLARE_READ16_MEMBER( _32x_68k_a15102_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_a15102_w ); + DECLARE_READ16_MEMBER( _32x_68k_a15104_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_a15104_w ); + DECLARE_READ16_MEMBER( _32x_68k_m_commsram_r ); + DECLARE_WRITE16_MEMBER( _32x_68k_m_commsram_w ); + DECLARE_READ16_MEMBER( _32x_pwm_r ); + DECLARE_WRITE16_MEMBER( _32x_pwm_w ); + DECLARE_WRITE16_MEMBER( _32x_68k_pwm_w ); + DECLARE_READ16_MEMBER( _32x_common_vdp_regs_r ); + DECLARE_WRITE16_MEMBER( _32x_common_vdp_regs_w ); + DECLARE_READ16_MEMBER( _32x_sh2_master_4000_r ); + DECLARE_WRITE16_MEMBER( _32x_sh2_master_4000_w ); + DECLARE_READ16_MEMBER( _32x_sh2_slave_4000_r ); + DECLARE_WRITE16_MEMBER( _32x_sh2_slave_4000_w ); + DECLARE_READ16_MEMBER( _32x_sh2_common_4002_r ); + DECLARE_WRITE16_MEMBER( _32x_sh2_common_4002_w ); + DECLARE_READ16_MEMBER( _32x_sh2_common_4004_r ); + DECLARE_WRITE16_MEMBER( _32x_sh2_common_4004_w ); + DECLARE_READ16_MEMBER( _32x_sh2_common_4006_r ); + DECLARE_WRITE16_MEMBER( _32x_sh2_common_4006_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_master_4014_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_slave_4014_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_master_4016_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_slave_4016_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_master_4018_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_slave_4018_w ) ; + DECLARE_WRITE16_MEMBER( _32x_sh2_master_401a_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_slave_401a_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_master_401c_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_slave_401c_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_master_401e_w ); + DECLARE_WRITE16_MEMBER( _32x_sh2_slave_401e_w ); + + SH2_DMA_FIFO_DATA_AVAILABLE_CB(_32x_fifo_available_callback); + + void _32x_render_videobuffer_to_screenbuffer_helper(int scanline); + void _32x_render_videobuffer_to_screenbuffer(int x, UINT32 priority, UINT16 &lineptr); + int sh2_master_pwmint_enable, sh2_slave_pwmint_enable; + + void _32x_check_framebuffer_swap(bool enabled); + void _32x_check_irqs(); + void _32x_interrupt_cb(int scanline, int irq6); + + /* our main vblank handler resets this */ + int m_32x_hcount_compare_val; + int m_32x_vblank_flag; + int m_sh2_are_running; + int m_32x_240mode; + UINT16 m_32x_a1518a_reg; + + void handle_pwm_callback(); + void calculate_pwm_timer(); + UINT16 m_pwm_ctrl, m_pwm_cycle, m_pwm_tm_reg; + UINT16 m_cur_lch[0x10],m_cur_rch[0x10]; + UINT16 m_pwm_cycle_reg; //used for latching + UINT8 m_pwm_timer_tick; + UINT8 m_lch_index_r, m_rch_index_r, m_lch_index_w, m_rch_index_w; + UINT16 m_lch_fifo_state, m_rch_fifo_state; + + + UINT16 get_hposition(void); + + emu_timer *m_32x_pwm_timer; + +protected: + virtual void device_start(); + virtual void device_reset(); + + // optional information overrides +// virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + +private: + + int m_32x_displaymode; + int m_32x_videopriority; + UINT32 m_32x_linerender[320+258]; // tmp buffer (bigger than it needs to be to simplify RLE decode) + +// virtual void device_config_complete(); + int m_32x_adapter_enabled; + int m_32x_access_auth; + int m_32x_screenshift; + + UINT16 m_32x_68k_a15104_reg; + int m_sh2_master_vint_enable, m_sh2_slave_vint_enable; + int m_sh2_master_hint_enable, m_sh2_slave_hint_enable; + int m_sh2_master_cmdint_enable, m_sh2_slave_cmdint_enable; + int m_sh2_hint_in_vbl; + int m_sh2_master_vint_pending; + int m_sh2_slave_vint_pending; + int m_32x_fb_swap; + int m_32x_hcount_reg; + + UINT16 m_32x_autofill_length; + UINT16 m_32x_autofill_address; + UINT16 m_32x_autofill_data; + UINT16 m_a15106_reg; + UINT16 m_dreq_src_addr[2],m_dreq_dst_addr[2],m_dreq_size; + UINT8 m_sega_tv; + UINT16 m_hint_vector[2]; + UINT16 m_a15100_reg; + int m_32x_68k_a15102_reg; + + int m_32x_pal; + int m_framerate; + int m_base_total_scanlines; + int m_total_scanlines; + + UINT16 m_commsram[8]; + + UINT16* m_32x_dram0; + UINT16* m_32x_dram1; + UINT16 *m_32x_display_dram, *m_32x_access_dram; + UINT16* m_32x_palette; + UINT16* m_32x_palette_lookup; + + UINT16 m_fifo_block_a[4]; + UINT16 m_fifo_block_b[4]; + UINT16* m_current_fifo_block; + UINT16* m_current_fifo_readblock; + int m_current_fifo_write_pos; + int m_current_fifo_read_pos; + int m_fifo_block_a_full; + int m_fifo_block_b_full; + + required_device m_palette; +}; + + +class sega_32x_ntsc_device : public sega_32x_device +{ + public: + sega_32x_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +}; + +class sega_32x_pal_device : public sega_32x_device +{ + public: + sega_32x_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + protected: + virtual machine_config_constructor device_mconfig_additions() const; +}; + + +extern const device_type SEGA_32X_NTSC; +extern const device_type SEGA_32X_PAL; + +#define MCFG_SEGA_32X_PALETTE(_palette_tag) \ + sega_32x_device::static_set_palette_tag(*device, "^" _palette_tag); diff --git a/src/mame/machine/megacd.c b/src/mame/machine/megacd.c new file mode 100644 index 00000000000..c416bf73d89 --- /dev/null +++ b/src/mame/machine/megacd.c @@ -0,0 +1,1914 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +#include "emu.h" +#include "machine/megacd.h" +#include "machine/nvram.h" +#include "megacd.lh" + + +const device_type SEGA_SEGACD_US = &device_creator; +const device_type SEGA_SEGACD_JAPAN = &device_creator; +const device_type SEGA_SEGACD_EUROPE = &device_creator; + + +/* Callback when the genesis enters interrupt code */ +IRQ_CALLBACK_MEMBER(sega_segacd_device::segacd_sub_int_callback) +{ + if (irqline==2) + { + // clear this bit + m_a12000_halt_reset_reg &= ~0x0100; + m_scdcpu->set_input_line(2, CLEAR_LINE); + } + + return (0x60+irqline*4)/4; // vector address +} + + +TIMER_DEVICE_CALLBACK_MEMBER( sega_segacd_device::irq3_timer_callback ) +{ + CHECK_SCD_LV3_INTERRUPT + m_irq3_timer->adjust(SEGACD_IRQ3_TIMER_SPEED); +} + + +TIMER_DEVICE_CALLBACK_MEMBER( sega_segacd_device::stamp_timer_callback ) +{ + //printf("stamp_timer_callback\n"); + + CHECK_SCD_LV1_INTERRUPT + + segacd_conversion_active = 0; + + // this ends up as 0 after processing (soniccd bonus stage) + segacd_imagebuffer_vdot_size = 0; +} + + +static ADDRESS_MAP_START( segacd_map, AS_PROGRAM, 16, sega_segacd_device ) + AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_SHARE("prgram") + AM_RANGE(0x080000, 0x0bffff) AM_READWRITE(segacd_sub_dataram_part1_r, segacd_sub_dataram_part1_w) AM_SHARE("dataram") + AM_RANGE(0x0c0000, 0x0dffff) AM_READWRITE(segacd_sub_dataram_part2_r, segacd_sub_dataram_part2_w) //AM_SHARE("dataram2") + + AM_RANGE(0xfe0000, 0xfe3fff) AM_READWRITE8(backupram_r, backupram_w, 0x00ff) // backup RAM, odd bytes only! + + AM_RANGE(0xff0000, 0xff001f) AM_DEVWRITE8("rfsnd", rf5c68_device, rf5c68_w, 0x00ff) // PCM, RF5C164 + AM_RANGE(0xff0020, 0xff003f) AM_DEVREAD8("rfsnd", rf5c68_device, rf5c68_r, 0x00ff) + AM_RANGE(0xff2000, 0xff3fff) AM_DEVREADWRITE8("rfsnd", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w,0x00ff) // PCM, RF5C164 + + AM_RANGE(0xff8000 ,0xff8001) AM_READWRITE(segacd_sub_led_ready_r, segacd_sub_led_ready_w) + AM_RANGE(0xff8002 ,0xff8003) AM_READWRITE(segacd_sub_memory_mode_r, segacd_sub_memory_mode_w) + + AM_RANGE(0xff8004 ,0xff8005) AM_DEVREADWRITE("tempcdc",lc89510_temp_device, segacd_cdc_mode_address_r, segacd_cdc_mode_address_w) + AM_RANGE(0xff8006 ,0xff8007) AM_DEVREADWRITE("tempcdc",lc89510_temp_device,segacd_cdc_data_r, segacd_cdc_data_w) + AM_RANGE(0xff8008, 0xff8009) AM_DEVREAD("tempcdc",lc89510_temp_device, cdc_data_sub_r) + AM_RANGE(0xff800a, 0xff800b) AM_READWRITE(segacd_dmaaddr_r,segacd_dmaaddr_w) // DMA Address (not CDC, used in conjunction with) + AM_RANGE(0xff800c, 0xff800d) AM_READWRITE(segacd_stopwatch_timer_r, segacd_stopwatch_timer_w)// Stopwatch timer + AM_RANGE(0xff800e ,0xff800f) AM_READWRITE(segacd_comms_flags_r, segacd_comms_flags_subcpu_w) + AM_RANGE(0xff8010 ,0xff801f) AM_READWRITE(segacd_comms_sub_part1_r, segacd_comms_sub_part1_w) + AM_RANGE(0xff8020 ,0xff802f) AM_READWRITE(segacd_comms_sub_part2_r, segacd_comms_sub_part2_w) + AM_RANGE(0xff8030, 0xff8031) AM_READWRITE(segacd_irq3timer_r, segacd_irq3timer_w) // Timer W/INT3 + AM_RANGE(0xff8032, 0xff8033) AM_DEVREADWRITE("tempcdc",lc89510_temp_device,segacd_irq_mask_r,segacd_irq_mask_w) + AM_RANGE(0xff8034, 0xff8035) AM_DEVREADWRITE("tempcdc",lc89510_temp_device,segacd_cdfader_r,segacd_cdfader_w) // CD Fader + AM_RANGE(0xff8036, 0xff8037) AM_DEVREADWRITE("tempcdc",lc89510_temp_device,segacd_cdd_ctrl_r,segacd_cdd_ctrl_w) + AM_RANGE(0xff8038, 0xff8041) AM_DEVREAD8("tempcdc",lc89510_temp_device,segacd_cdd_rx_r,0xffff) + AM_RANGE(0xff8042, 0xff804b) AM_DEVWRITE8("tempcdc",lc89510_temp_device,segacd_cdd_tx_w,0xffff) + AM_RANGE(0xff804c, 0xff804d) AM_READWRITE8(font_color_r, font_color_w, 0x00ff) + AM_RANGE(0xff804e, 0xff804f) AM_RAM AM_SHARE("font_bits") + AM_RANGE(0xff8050, 0xff8057) AM_READ(font_converted_r) + AM_RANGE(0xff8058, 0xff8059) AM_READWRITE(segacd_stampsize_r, segacd_stampsize_w) // Stamp size + AM_RANGE(0xff805a, 0xff805b) AM_READWRITE(segacd_stampmap_base_address_r, segacd_stampmap_base_address_w) // Stamp map base address + AM_RANGE(0xff805c, 0xff805d) AM_READWRITE(segacd_imagebuffer_vcell_size_r, segacd_imagebuffer_vcell_size_w)// Image buffer V cell size + AM_RANGE(0xff805e, 0xff805f) AM_READWRITE(segacd_imagebuffer_start_address_r, segacd_imagebuffer_start_address_w) // Image buffer start address + AM_RANGE(0xff8060, 0xff8061) AM_READWRITE(segacd_imagebuffer_offset_r, segacd_imagebuffer_offset_w) + AM_RANGE(0xff8062, 0xff8063) AM_READWRITE(segacd_imagebuffer_hdot_size_r, segacd_imagebuffer_hdot_size_w) // Image buffer H dot size + AM_RANGE(0xff8064, 0xff8065) AM_READWRITE(segacd_imagebuffer_vdot_size_r, segacd_imagebuffer_vdot_size_w ) // Image buffer V dot size + AM_RANGE(0xff8066, 0xff8067) AM_WRITE(segacd_trace_vector_base_address_w)// Trace vector base address +// AM_RANGE(0xff8068, 0xff8069) // Subcode address + +// AM_RANGE(0xff8100, 0xff817f) // Subcode buffer area +// AM_RANGE(0xff8180, 0xff81ff) // mirror of subcode buffer area + +ADDRESS_MAP_END + + +// the tiles in RAM are 8x8 tiles +// they are referenced in the cell look-up map as either 16x16 or 32x32 tiles (made of 4 / 16 8x8 tiles) + +#define SEGACD_BYTES_PER_TILE16 (128) +#define SEGACD_BYTES_PER_TILE32 (512) + +#define SEGACD_NUM_TILES16 (0x40000/SEGACD_BYTES_PER_TILE16) +#define SEGACD_NUM_TILES32 (0x40000/SEGACD_BYTES_PER_TILE32) + +#define _16x16_SEQUENCE_1 { STEP8(0, 4), STEP8(512, 4) }, +#define _16x16_SEQUENCE_1_FLIP { STEP8(512+28, -4), STEP8(28, -4) }, + +#define _16x16_SEQUENCE_2 { STEP16(0, 32) }, +#define _16x16_SEQUENCE_2_FLIP { STEP16(15*32, -32) }, + + +#define _16x16_START \ +{ \ + 16,16, \ + SEGACD_NUM_TILES16, \ + 4, \ + { 0,1,2,3 }, +#define _16x16_END \ + 8*128 \ +}; +#define _32x32_START \ +{ \ + 32,32, \ + SEGACD_NUM_TILES32, \ + 4, \ + { 0,1,2,3 }, + +#define _32x32_END \ + 8*512 \ +}; + +#define _32x32_SEQUENCE_1 { STEP8(0, 4), STEP8(1024, 4), STEP8(2048, 4), STEP8(3072, 4) }, +#define _32x32_SEQUENCE_1_FLIP { STEP8(3072+28, -4), STEP8(2048+28, -4), STEP8(1024+28, -4), STEP8(28, -4) }, + +#define _32x32_SEQUENCE_2 { STEP32(0, 32) }, +#define _32x32_SEQUENCE_2_FLIP { STEP32(31*32, -32) }, + + +/* 16x16 decodes */ +static const gfx_layout sega_16x16_r00_f0_layout = +_16x16_START + _16x16_SEQUENCE_1 + _16x16_SEQUENCE_2 +_16x16_END + +static const gfx_layout sega_16x16_r01_f0_layout = +_16x16_START + _16x16_SEQUENCE_2 + _16x16_SEQUENCE_1_FLIP +_16x16_END + +static const gfx_layout sega_16x16_r10_f0_layout = +_16x16_START + _16x16_SEQUENCE_1_FLIP + _16x16_SEQUENCE_2_FLIP +_16x16_END + +static const gfx_layout sega_16x16_r11_f0_layout = +_16x16_START + _16x16_SEQUENCE_2_FLIP + _16x16_SEQUENCE_1 +_16x16_END + +static const gfx_layout sega_16x16_r00_f1_layout = +_16x16_START + _16x16_SEQUENCE_1_FLIP + _16x16_SEQUENCE_2 +_16x16_END + +static const gfx_layout sega_16x16_r01_f1_layout = +_16x16_START + _16x16_SEQUENCE_2 + _16x16_SEQUENCE_1 +_16x16_END + +static const gfx_layout sega_16x16_r10_f1_layout = +_16x16_START + _16x16_SEQUENCE_1 + _16x16_SEQUENCE_2_FLIP +_16x16_END + +static const gfx_layout sega_16x16_r11_f1_layout = +_16x16_START + _16x16_SEQUENCE_2_FLIP + _16x16_SEQUENCE_1_FLIP +_16x16_END + +/* 32x32 decodes */ +static const gfx_layout sega_32x32_r00_f0_layout = +_32x32_START + _32x32_SEQUENCE_1 + _32x32_SEQUENCE_2 +_32x32_END + +static const gfx_layout sega_32x32_r01_f0_layout = +_32x32_START + _32x32_SEQUENCE_2 + _32x32_SEQUENCE_1_FLIP +_32x32_END + +static const gfx_layout sega_32x32_r10_f0_layout = +_32x32_START + _32x32_SEQUENCE_1_FLIP + _32x32_SEQUENCE_2_FLIP +_32x32_END + +static const gfx_layout sega_32x32_r11_f0_layout = +_32x32_START + _32x32_SEQUENCE_2_FLIP + _32x32_SEQUENCE_1 +_32x32_END + +static const gfx_layout sega_32x32_r00_f1_layout = +_32x32_START + _32x32_SEQUENCE_1_FLIP + _32x32_SEQUENCE_2 +_32x32_END + +static const gfx_layout sega_32x32_r01_f1_layout = +_32x32_START + _32x32_SEQUENCE_2 + _32x32_SEQUENCE_1 +_32x32_END + +static const gfx_layout sega_32x32_r10_f1_layout = +_32x32_START + _32x32_SEQUENCE_1 + _32x32_SEQUENCE_2_FLIP +_32x32_END + +static const gfx_layout sega_32x32_r11_f1_layout = +_32x32_START + _32x32_SEQUENCE_2_FLIP + _32x32_SEQUENCE_1_FLIP +_32x32_END + +static GFXDECODE_START( segacd ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r00_f0_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r01_f0_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r10_f0_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r11_f0_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r00_f1_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r11_f1_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r10_f1_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r01_f1_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r00_f0_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r01_f0_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r10_f0_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r11_f0_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r00_f1_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r11_f1_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r10_f1_layout, 0, 0 ) + GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r01_f1_layout, 0, 0 ) +GFXDECODE_END + + +static MACHINE_CONFIG_FRAGMENT( segacd_fragment ) + + MCFG_CPU_ADD("segacd_68k", M68000, SEGACD_CLOCK ) /* 12.5 MHz */ + MCFG_CPU_PROGRAM_MAP(segacd_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(DEVICE_SELF, sega_segacd_device,segacd_sub_int_callback) + + MCFG_DEVICE_ADD("cdc", LC89510, 0) // cd controller + + // temporary until things are cleaned up + MCFG_DEVICE_ADD("tempcdc", LC89510_TEMP, 0) // cd controller + MCFG_SEGACD_HACK_SET_CDC_DO_DMA( sega_segacd_device, SegaCD_CDC_Do_DMA ) // hack + + MCFG_TIMER_ADD_NONE("sw_timer") //stopwatch timer + MCFG_TIMER_DRIVER_ADD("stamp_timer", sega_segacd_device, stamp_timer_callback) + MCFG_TIMER_DRIVER_ADD("irq3_timer", sega_segacd_device, irq3_timer_callback) + MCFG_TIMER_DRIVER_ADD("dma_timer", sega_segacd_device, dma_timer_callback) + + MCFG_DEFAULT_LAYOUT( layout_megacd ) + + MCFG_RF5C68_ADD("rfsnd", SEGACD_CLOCK) // RF5C164! + MCFG_SOUND_ROUTE( 0, ":lspeaker", 0.50 ) + MCFG_SOUND_ROUTE( 1, ":rspeaker", 0.50 ) + + MCFG_NVRAM_ADD_0FILL("backupram") + + MCFG_QUANTUM_PERFECT_CPU("segacd_68k") // perfect sync to the fastest cpu +MACHINE_CONFIG_END + + + +machine_config_constructor sega_segacd_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( segacd_fragment ); +} + + +sega_segacd_device::sega_segacd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_gfx_interface(mconfig, *this, GFXDECODE_NAME( segacd )), + m_scdcpu(*this, "segacd_68k"), + m_rfsnd(*this, "rfsnd"), + m_lc89510_temp(*this, "tempcdc"), + m_stopwatch_timer(*this, "sw_timer"), + m_stamp_timer(*this, "stamp_timer"), + m_irq3_timer(*this, "irq3_timer"), + m_dma_timer(*this, "dma_timer"), + m_prgram(*this, "prgram"), + m_dataram(*this, "dataram"), + m_font_bits(*this, "font_bits") +{ +} + +sega_segacd_us_device::sega_segacd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sega_segacd_device(mconfig, SEGA_SEGACD_US, "sega_segacd_us", tag, owner, clock, "sega_segacd_us", __FILE__) +{ +} + +sega_segacd_japan_device::sega_segacd_japan_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sega_segacd_device(mconfig, SEGA_SEGACD_JAPAN, "sega_segacd_japan", tag, owner, clock, "sega_segacd_japan", __FILE__) +{ +} + +sega_segacd_europe_device::sega_segacd_europe_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sega_segacd_device(mconfig, SEGA_SEGACD_EUROPE, "sega_segacd_europe", tag, owner, clock, "sega_segacd_europe", __FILE__) +{ +} + + +inline void sega_segacd_device::write_pixel(UINT8 pix, int pixeloffset) +{ + int shift = 12-(4*(pixeloffset&0x3)); + UINT16 datamask = (0x000f) << shift; + + int offset = pixeloffset>>3; + if (pixeloffset&4) offset++; + + offset &=0x1ffff; + + switch (segacd_memory_priority_mode) + { + case 0x00: // normal write, just write the data + m_dataram[offset] = m_dataram[offset] &~ datamask; + m_dataram[offset] |= pix << shift; + break; + + case 0x01: // underwrite, only write if the existing data is 0 + if ((m_dataram[offset]&datamask) == 0x0000) + { + m_dataram[offset] = m_dataram[offset] &~ datamask; + m_dataram[offset] |= pix << shift; + } + break; + + case 0x02: // overwrite, only write non-zero data + if (pix) + { + m_dataram[offset] = m_dataram[offset] &~ datamask; + m_dataram[offset] |= pix << shift; + } + break; + + default: + case 0x03: + pix = machine().rand() & 0x000f; + m_dataram[offset] = m_dataram[offset] &~ datamask; + m_dataram[offset] |= pix << shift; + break; + + } +} + +// 1meg / 2meg swap is interleaved swap, not half/half of the ram? +// Wily Beamish and Citizen X appear to rely on this +// however, it breaks the megacdj bios (megacd2j still works!) +// (maybe that's a timing issue instead?) +UINT16 sega_segacd_device::segacd_1meg_mode_word_read(int offset, UINT16 mem_mask) +{ + offset *= 2; + + if ((offset&0x20000)) + offset +=1; + + offset &=0x1ffff; + + return m_dataram[offset]; +} + + +void sega_segacd_device::segacd_1meg_mode_word_write(int offset, UINT16 data, UINT16 mem_mask, int use_pm) +{ + offset *= 2; + + if ((offset&0x20000)) + offset +=1; + + offset &=0x1ffff; + + if (use_pm) + { + // priority mode can apply when writing with the double up buffer mode + // Jaguar XJ220 relies on this + switch (segacd_memory_priority_mode) + { + case 0x00: // normal write, just write the data + COMBINE_DATA(&m_dataram[offset]); + break; + + case 0x01: // underwrite, only write if the existing data is 0 + if (ACCESSING_BITS_8_15) + { + if ((m_dataram[offset]&0xf000) == 0x0000) m_dataram[offset] |= (data)&0xf000; + if ((m_dataram[offset]&0x0f00) == 0x0000) m_dataram[offset] |= (data)&0x0f00; + } + if (ACCESSING_BITS_0_7) + { + if ((m_dataram[offset]&0x00f0) == 0x0000) m_dataram[offset] |= (data)&0x00f0; + if ((m_dataram[offset]&0x000f) == 0x0000) m_dataram[offset] |= (data)&0x000f; + } + break; + + case 0x02: // overwrite, only write non-zero data + if (ACCESSING_BITS_8_15) + { + if ((data)&0xf000) m_dataram[offset] = (m_dataram[offset] & 0x0fff) | ((data)&0xf000); + if ((data)&0x0f00) m_dataram[offset] = (m_dataram[offset] & 0xf0ff) | ((data)&0x0f00); + } + if (ACCESSING_BITS_0_7) + { + if ((data)&0x00f0) m_dataram[offset] = (m_dataram[offset] & 0xff0f) | ((data)&0x00f0); + if ((data)&0x000f) m_dataram[offset] = (m_dataram[offset] & 0xfff0) | ((data)&0x000f); + } + break; + + default: + case 0x03: // invalid? + COMBINE_DATA(&m_dataram[offset]); + break; + + } + } + else + { + COMBINE_DATA(&m_dataram[offset]); + } +} + + + + +WRITE16_MEMBER( sega_segacd_device::scd_a12000_halt_reset_w ) +{ + UINT16 old_halt = m_a12000_halt_reset_reg; + + COMBINE_DATA(&m_a12000_halt_reset_reg); + + if (ACCESSING_BITS_0_7) + { + // reset line + if (m_a12000_halt_reset_reg & 0x0001) + { + m_scdcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + if (!(old_halt&0x0001)) printf("clear reset slave\n"); + } + else + { + m_scdcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + if ((old_halt&0x0001)) printf("assert reset slave\n"); + } + + // request BUS + if (m_a12000_halt_reset_reg & 0x0002) + { + m_scdcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + if (!(old_halt&0x0002)) printf("halt slave\n"); + } + else + { + m_scdcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + if ((old_halt&0x0002)) printf("resume slave\n"); + } + } + + if (ACCESSING_BITS_8_15) + { + if (m_a12000_halt_reset_reg & 0x0100) + { + CHECK_SCD_LV2_INTERRUPT + } + + if (m_a12000_halt_reset_reg & 0x8000) + { + // not writable.. but can read irq mask here? + //printf("m_a12000_halt_reset_reg & 0x8000 set\n"); // irq2 mask? + } + + + } +} + +READ16_MEMBER( sega_segacd_device::scd_a12000_halt_reset_r ) +{ + return m_a12000_halt_reset_reg; +} + + +/******************************************************************************** + MEMORY MODE CONTROL + - main / sub sides differ! +********************************************************************************/ + +// +// we might need a delay on the segacd_maincpu_has_ram_access registers, as they actually indicate requests being made +// so probably don't change instantly... +// + + +READ16_MEMBER( sega_segacd_device::scd_a12002_memory_mode_r ) +{ + int temp = scd_rammode; + int temp2 = 0; + + temp2 |= (scd_mode_dmna_ret_flags>>(temp*4))&0x7; + + return (segacd_ram_writeprotect_bits << 8) | + (segacd_4meg_prgbank << 6) | + temp2; + +} + + +/* I'm still not 100% clear how this works, the sources I have are a bit vague, + it might still be incorrect in both modes + + for a simple way to swap blocks of ram between cpus this is stupidly convoluted + + */ + +// DMNA = Decleration Mainram No Access (bit 0) +// RET = Return access (bit 1) + + +WRITE8_MEMBER( sega_segacd_device::scd_a12002_memory_mode_w_8_15 ) +{ + if (data & 0xff00) + { + printf("write protect bits set %02x\n", data); + } + + segacd_ram_writeprotect_bits = data; +} + + +WRITE8_MEMBER( sega_segacd_device::scd_a12002_memory_mode_w_0_7 ) +{ + //printf("scd_a12002_memory_mode_w_0_7 %04x\n",data); + + segacd_4meg_prgbank = (data&0x00c0)>>6; + + if (scd_rammode&0x2) + { // ==0x2 (1 meg mode) + if (!(data&2)) // check DMNA bit + { + scd_mode_dmna_ret_flags |= 0x2200; + } + } + else // == 0x0 (2 meg mode) + { + if (data&2) // check DMNA bit + { + scd_rammode = 1; + } + } +} + + +WRITE16_MEMBER( sega_segacd_device::scd_a12002_memory_mode_w ) +{ + if (ACCESSING_BITS_8_15) + scd_a12002_memory_mode_w_8_15(space, 0, data>>8, mem_mask>>8); + + if (ACCESSING_BITS_0_7) + scd_a12002_memory_mode_w_0_7(space, 0, data&0xff, mem_mask&0xff); +} + + + + +READ16_MEMBER( sega_segacd_device::segacd_sub_memory_mode_r ) +{ + int temp = scd_rammode; + int temp2 = 0; + + temp2 |= (scd_mode_dmna_ret_flags>>(temp*4))&0x7; + + return (segacd_ram_writeprotect_bits << 8) | + (segacd_memory_priority_mode << 3) | + temp2; +} + + +WRITE8_MEMBER( sega_segacd_device::segacd_sub_memory_mode_w_8_15 ) +{ + /* setting write protect bits from sub-cpu has no effect? */ +} + + + +WRITE8_MEMBER( sega_segacd_device::segacd_sub_memory_mode_w_0_7 ) +{ + segacd_memory_priority_mode = (data&0x0018)>>3; + + // If the mode bit is 0 then we're requesting a change to + // 2Meg mode? + + //printf("segacd_sub_memory_mode_w_0_7 %04x\n",data); + + if (!(data&4)) // check ram mode bit + { // == 0x0 - 2 meg mode + scd_mode_dmna_ret_flags &= 0xddff; + + if (data&1) // check RET + { + // If RET is set and the Mode bit in the write is set to 2M then we want to change to 2M mode + // If we're already in 2M mode it has no effect + scd_rammode = 0; + + } + else + { + // == 0x4 - 1 meg mode + + int temp = scd_rammode; + if (temp&2) // check ram mode + { // == 0x2 - 1 meg mode + scd_mode_dmna_ret_flags &= 0xffde; + scd_rammode = temp &1; + } + } + } + else + { // == 0x4 - 1 meg mode + data &=1; + int temp = data; + int scd_rammode_old = scd_rammode; + data |=2; + + temp ^= scd_rammode_old; + scd_rammode = data; + + if (scd_rammode_old & 2) + { // == 0x2 - already in 1 meg mode + if (temp & 1) // ret bit + { + scd_mode_dmna_ret_flags &= 0xddff; + } + } + else + { // == 0x0 - currently in 2 meg mode + scd_mode_dmna_ret_flags &= 0xddff; + } + } +} + +WRITE16_MEMBER( sega_segacd_device::segacd_sub_memory_mode_w ) +{ + //printf("segacd_sub_memory_mode_w %04x %04x\n", data, mem_mask); + + + if (ACCESSING_BITS_8_15) + segacd_sub_memory_mode_w_8_15(space, 0, data>>8, mem_mask>>8); + + if (ACCESSING_BITS_0_7) + segacd_sub_memory_mode_w_0_7(space, 0, data&0xff, mem_mask&0xff); +} + + +/******************************************************************************** + END MEMORY MODE CONTROL +********************************************************************************/ + +/******************************************************************************** + COMMUNICATION FLAGS + - main / sub sides differ in which bits are write only +********************************************************************************/ + + +READ16_MEMBER( sega_segacd_device::segacd_comms_flags_r ) +{ + return segacd_comms_flags; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_comms_flags_subcpu_w ) +{ + if (ACCESSING_BITS_8_15) // Dragon's Lair + { + segacd_comms_flags = (segacd_comms_flags & 0xff00) | ((data >> 8) & 0x00ff); + } + + // flashback needs low bits to take priority in word writes + if (ACCESSING_BITS_0_7) + { + segacd_comms_flags = (segacd_comms_flags & 0xff00) | (data & 0x00ff); + } +} + +WRITE16_MEMBER( sega_segacd_device::segacd_comms_flags_maincpu_w ) +{ + if (ACCESSING_BITS_8_15) + { + segacd_comms_flags = (segacd_comms_flags & 0x00ff) | (data & 0xff00); + } + + // flashback needs low bits to take priority in word writes + if (ACCESSING_BITS_0_7) + { + segacd_comms_flags = (segacd_comms_flags & 0x00ff) | ((data << 8) & 0xff00); + } +} + +READ16_MEMBER( sega_segacd_device::scd_4m_prgbank_ram_r ) +{ + UINT16 realoffset = ((segacd_4meg_prgbank * 0x20000)/2) + offset; + return m_prgram[realoffset]; + +} + +WRITE16_MEMBER( sega_segacd_device::scd_4m_prgbank_ram_w ) +{ + UINT16 realoffset = ((segacd_4meg_prgbank * 0x20000)/2) + offset; + + // todo: + // check for write protection? (or does that only apply to writes on the SubCPU side? + + COMBINE_DATA(&m_prgram[realoffset]); + +} + + + +READ16_MEMBER( sega_segacd_device::segacd_comms_main_part1_r ) +{ + return segacd_comms_part1[offset]; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_comms_main_part1_w ) +{ + COMBINE_DATA(&segacd_comms_part1[offset]); +} + +READ16_MEMBER( sega_segacd_device::segacd_comms_main_part2_r ) +{ + return segacd_comms_part2[offset]; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_comms_main_part2_w ) +{ + printf("Sega CD main CPU attempting to write to read only comms regs\n"); +} + + +READ16_MEMBER( sega_segacd_device::segacd_comms_sub_part1_r ) +{ + return segacd_comms_part1[offset]; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_comms_sub_part1_w ) +{ + printf("Sega CD sub CPU attempting to write to read only comms regs\n"); +} + +READ16_MEMBER( sega_segacd_device::segacd_comms_sub_part2_r ) +{ + return segacd_comms_part2[offset]; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_comms_sub_part2_w ) +{ + COMBINE_DATA(&segacd_comms_part2[offset]); +} + + +READ16_MEMBER( sega_segacd_device::segacd_main_dataram_part1_r ) +{ + if ((scd_rammode&2)==RAM_MODE_2MEG) + { + // is this correct? + if (!(scd_rammode&1)) + { + //printf("segacd_main_dataram_part1_r in mode 0 %08x %04x\n", offset*2, m_dataram[offset]); + + return m_dataram[offset]; + + } + else + { + //printf("Illegal: segacd_main_dataram_part1_r in mode 0 without permission\n"); + return 0xffff; + } + + } + else if ((scd_rammode&2)==RAM_MODE_1MEG) + { + if (offset<0x20000/2) + { + // wordram accees + //printf("Unspported: segacd_main_dataram_part1_r (word RAM) in mode 1\n"); + + // ret bit set by sub cpu determines which half of WorkRAM we have access to? + if (scd_rammode&1) + { + return segacd_1meg_mode_word_read(offset+0x20000/2, mem_mask); + } + else + { + return segacd_1meg_mode_word_read(offset+0x00000/2, mem_mask); + } + + } + else + { + // converts data stored in bitmap format (in dataram) to be read out as tiles (for dma->vram purposes) + // used by Heart of the Alien + + if(offset<0x30000/2) /* 0x20000 - 0x2ffff */ // 512x256 bitmap. tiles + offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,8,7,6,5,4,3,2,1,14,13,12,11,10,9,0); + else if(offset<0x38000/2) /* 0x30000 - 0x37fff */ // 512x128 bitmap. tiles + offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,7,6,5,4,3,2,1,13,12,11,10,9,8,0); + else if(offset<0x3c000/2) /* 0x38000 - 0x3bfff */ // 512x64 bitmap. tiles + offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,13,6,5,4,3,2,1,12,11,10,9,8,7,0); + else /* 0x3c000 - 0x3dfff and 0x3e000 - 0x3ffff */ // 512x32 bitmap (x2) -> tiles + offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,13,12,5,4,3,2,1,11,10,9,8,7,6,0); + + offset &=0xffff; + // HOTA cares about this + if (!(scd_rammode&1)) + { + return segacd_1meg_mode_word_read(offset+0x00000/2, mem_mask); + } + else + { + return segacd_1meg_mode_word_read(offset+0x20000/2, mem_mask); + } + } + } + + return 0x0000; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_main_dataram_part1_w ) +{ + if ((scd_rammode&2)==RAM_MODE_2MEG) + { + // is this correct? + if (!(scd_rammode&1)) + { + COMBINE_DATA(&m_dataram[offset]); + segacd_mark_tiles_dirty(offset); + } + else + { + //printf("Illegal: segacd_main_dataram_part1_w in mode 0 without permission\n"); + } + + } + else if ((scd_rammode&2)==RAM_MODE_1MEG) + { + if (offset<0x20000/2) + { + //printf("Unspported: segacd_main_dataram_part1_w (word RAM) in mode 1\n"); + // wordram accees + + // ret bit set by sub cpu determines which half of WorkRAM we have access to? + if (scd_rammode&1) + { + segacd_1meg_mode_word_write(offset+0x20000/2, data, mem_mask, 0); + } + else + { + segacd_1meg_mode_word_write(offset+0x00000/2, data, mem_mask, 0); + } + } + else + { + // printf("Unspported: segacd_main_dataram_part1_w (Cell rearranged RAM) in mode 1 (illega?)\n"); // is this legal?? + } + } +} + +READ16_MEMBER( sega_segacd_device::scd_hint_vector_r ) +{ +// printf("read HINT offset %d\n", offset); + + switch (offset&1) + { + case 0x00: + //return 0x00ff; // doesn't make much sense.. + return 0xffff; + case 0x01: + return segacd_hint_register; + } + + return 0; + +} + +READ16_MEMBER( sega_segacd_device::scd_a12006_hint_register_r ) +{ + return segacd_hint_register; +} + +WRITE16_MEMBER( sega_segacd_device::scd_a12006_hint_register_w ) +{ + COMBINE_DATA(&segacd_hint_register); +} + + +void sega_segacd_device::segacd_mark_tiles_dirty(int offset) +{ + m_gfx[0]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); + m_gfx[1]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); + m_gfx[2]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); + m_gfx[3]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); + m_gfx[4]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); + m_gfx[5]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); + m_gfx[6]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); + m_gfx[7]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); + + m_gfx[8]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); + m_gfx[9]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); + m_gfx[10]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); + m_gfx[11]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); + m_gfx[12]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); + m_gfx[13]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); + m_gfx[14]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); + m_gfx[15]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); +} + + +// mame specific.. map registers to which tilemap cache we use +int sega_segacd_device::segacd_get_active_stampmap_tilemap(void) +{ + return (segacd_stampsize & 0x6)>>1; +} + + + +void sega_segacd_device::SCD_GET_TILE_INFO_16x16_1x1( int& tile_region, int& tileno, int tile_index ) +{ + tile_region = 0; // 16x16 tiles + int tile_base = (segacd_stampmap_base_address & 0xff80) * 4; + + int tiledat = m_dataram[((tile_base>>1)+tile_index) & 0x1ffff]; + tileno = tiledat & 0x07ff; + int xflip = tiledat & 0x8000; + int roll = (tiledat & 0x6000)>>13; + + if (xflip) tile_region += 4; + tile_region+=roll; +} + +void sega_segacd_device::SCD_GET_TILE_INFO_32x32_1x1( int& tile_region, int& tileno, int tile_index ) +{ + tile_region = 8; // 32x32 tiles + int tile_base = (segacd_stampmap_base_address & 0xffe0) * 4; + + int tiledat = m_dataram[((tile_base>>1)+tile_index) & 0x1ffff]; + tileno = (tiledat & 0x07fc)>>2; + int xflip = tiledat & 0x8000; + int roll = (tiledat & 0x6000)>>13; + + if (xflip) tile_region += 4; + tile_region+=roll; +} + + +void sega_segacd_device::SCD_GET_TILE_INFO_16x16_16x16( int& tile_region, int& tileno, int tile_index ) +{ + tile_region = 0; // 16x16 tiles + int tile_base = (0x8000) * 4; // fixed address in this mode + + int tiledat = m_dataram[((tile_base>>1)+tile_index) & 0x1ffff]; + tileno = tiledat & 0x07ff; + int xflip = tiledat & 0x8000; + int roll = (tiledat & 0x6000)>>13; + + if (xflip) tile_region += 4; + tile_region+=roll; +} + + +void sega_segacd_device::SCD_GET_TILE_INFO_32x32_16x16( int& tile_region, int& tileno, int tile_index ) +{ + tile_region = 8; // 32x32 tiles + int tile_base = (segacd_stampmap_base_address & 0xe000) * 4; + + int tiledat = m_dataram[((tile_base>>1)+tile_index) & 0x1ffff]; + tileno = (tiledat & 0x07fc)>>2; + int xflip = tiledat & 0x8000; + int roll = (tiledat & 0x6000)>>13; + + if (xflip) tile_region += 4; + tile_region+=roll; +} + +/* Tilemap callbacks (we don't actually use the tilemaps due to the excessive overhead */ + + + +TILE_GET_INFO_MEMBER( sega_segacd_device::get_stampmap_16x16_1x1_tile_info ) +{ + int tile_region, tileno; + SCD_GET_TILE_INFO_16x16_1x1(tile_region,tileno,(int)tile_index); + SET_TILE_INFO_MEMBER(tile_region, tileno, 0, 0); +} + +TILE_GET_INFO_MEMBER( sega_segacd_device::get_stampmap_32x32_1x1_tile_info ) +{ + int tile_region, tileno; + SCD_GET_TILE_INFO_32x32_1x1(tile_region,tileno,(int)tile_index); + SET_TILE_INFO_MEMBER(tile_region, tileno, 0, 0); +} + + +TILE_GET_INFO_MEMBER( sega_segacd_device::get_stampmap_16x16_16x16_tile_info ) +{ + int tile_region, tileno; + SCD_GET_TILE_INFO_16x16_16x16(tile_region,tileno,(int)tile_index); + SET_TILE_INFO_MEMBER(tile_region, tileno, 0, 0); +} + +TILE_GET_INFO_MEMBER( sega_segacd_device::get_stampmap_32x32_16x16_tile_info ) +{ + int tile_region, tileno; + SCD_GET_TILE_INFO_32x32_16x16(tile_region,tileno,(int)tile_index); + SET_TILE_INFO_MEMBER(tile_region, tileno, 0, 0); +} + +// non-tilemap functions to get a pixel from a 'tilemap' based on the above, but looking up each pixel, as to avoid the heavy cache bitmap + +inline UINT8 sega_segacd_device::get_stampmap_16x16_1x1_tile_info_pixel(int xpos, int ypos) +{ + const int tilesize = 4; // 0xf pixels + const int tilemapsize = 0x0f; + + int wraparound = segacd_stampsize&1; + + int xtile = xpos / (1<tilemapsize) return 0; + if (xtile<0) return 0; + + if (ytile>tilemapsize) return 0; + if (ytile<0) return 0; + } + + int tile_index = (ytile * (tilemapsize+1)) + xtile; + + int tile_region, tileno; + SCD_GET_TILE_INFO_16x16_1x1(tile_region,tileno,(int)tile_index); + + tileno %= m_gfx[tile_region]->elements(); + + if (tileno==0) return 0x00; + + const UINT8* srcdata = m_gfx[tile_region]->get_data(tileno); + return srcdata[((ypos&((1<tilemapsize) return 0; + if (xtile<0) return 0; + + if (ytile>tilemapsize) return 0; + if (ytile<0) return 0; + } + + int tile_index = (ytile * (tilemapsize+1)) + xtile; + + int tile_region, tileno; + SCD_GET_TILE_INFO_32x32_1x1(tile_region,tileno,(int)tile_index); + + tileno %= m_gfx[tile_region]->elements(); + + if (tileno==0) return 0x00; // does this apply in this mode? + + const UINT8* srcdata = m_gfx[tile_region]->get_data(tileno); + return srcdata[((ypos&((1<tilemapsize) return 0; + if (xtile<0) return 0; + + if (ytile>tilemapsize) return 0; + if (ytile<0) return 0; + } + + int tile_index = (ytile * (tilemapsize+1)) + xtile; + + int tile_region, tileno; + SCD_GET_TILE_INFO_16x16_16x16(tile_region,tileno,(int)tile_index); + + tileno %= m_gfx[tile_region]->elements(); + + if (tileno==0) return 0x00; // does this apply in this mode + + const UINT8* srcdata = m_gfx[tile_region]->get_data(tileno); + return srcdata[((ypos&((1<tilemapsize) return 0; + if (xtile<0) return 0; + + if (ytile>tilemapsize) return 0; + if (ytile<0) return 0; + } + + int tile_index = (ytile * (tilemapsize+1)) + xtile; + + int tile_region, tileno; + SCD_GET_TILE_INFO_32x32_16x16(tile_region,tileno,(int)tile_index); + + tileno %= m_gfx[tile_region]->elements(); + + if (tileno==0) return 0x00; + + const UINT8* srcdata = m_gfx[tile_region]->get_data(tileno); + return srcdata[((ypos&((1<reset(); + else + printf("Stopwatch timer %04x\n",data); +} + +READ16_MEMBER( sega_segacd_device::segacd_stopwatch_timer_r ) +{ + INT32 result = (m_stopwatch_timer->time_elapsed() * ATTOSECONDS_TO_HZ(ATTOSECONDS_IN_USEC(30.72))).as_double(); + + return result & 0xfff; +} + + + + + + + +READ16_MEMBER( sega_segacd_device::segacd_sub_led_ready_r ) +{ + UINT16 retdata = 0x0000; + + if (ACCESSING_BITS_0_7) + { + retdata |= segacd_ready; + } + + if (ACCESSING_BITS_8_15) + { + retdata |= segacd_redled << 8; + retdata |= segacd_greenled << 9; + } + + return retdata; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_sub_led_ready_w ) +{ + if (ACCESSING_BITS_0_7) + { + if ((data&0x01) == 0x00) + { + // reset CD unit + } + } + + if (ACCESSING_BITS_8_15) + { + segacd_redled = (data >> 8)&1; + segacd_greenled = (data >> 9)&1; + + output_set_value("red_led",segacd_redled ^ 1); + output_set_value("green_led",segacd_greenled ^ 1); + + //popmessage("%02x %02x",segacd_greenled,segacd_redled); + } +} + + + +READ16_MEMBER( sega_segacd_device::segacd_sub_dataram_part1_r ) +{ + if ((scd_rammode&2)==RAM_MODE_2MEG) + { + // is this correct? + if (scd_rammode&1) + return m_dataram[offset]; + else + { + //printf("Illegal: segacd_sub_dataram_part1_r in mode 0 without permission\n"); + return 0x0000; + } + } + else if ((scd_rammode&2)==RAM_MODE_1MEG) + { +// printf("Unspported: segacd_sub_dataram_part1_r in mode 1 (Word RAM Expander - 1 Byte Per Pixel)\n"); + UINT16 data; + + if (scd_rammode&1) + { + data = segacd_1meg_mode_word_read(offset/2+0x00000/2, 0xffff); + } + else + { + data = segacd_1meg_mode_word_read(offset/2+0x20000/2, 0xffff); + } + + if (offset&1) + { + return ((data & 0x00f0) << 4) | ((data & 0x000f) << 0); + } + else + { + return ((data & 0xf000) >> 4) | ((data & 0x0f00) >> 8); + } + + + } + + return 0x0000; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_sub_dataram_part1_w ) +{ + if ((scd_rammode&2)==RAM_MODE_2MEG) + { + // is this correct? + if (scd_rammode&1) + { + COMBINE_DATA(&m_dataram[offset]); + segacd_mark_tiles_dirty(offset); + } + else + { + //printf("Illegal: segacd_sub_dataram_part1_w in mode 0 without permission\n"); + } + } + else if ((scd_rammode&2)==RAM_MODE_1MEG) + { + //if (mem_mask==0xffff) + // printf("Unspported: segacd_sub_dataram_part1_w in mode 1 (Word RAM Expander - 1 Byte Per Pixel) %04x %04x\n", data, mem_mask); + + data = (data & 0x000f) | (data & 0x0f00)>>4; + mem_mask = (mem_mask & 0x000f) | (mem_mask & 0x0f00)>>4; + +// data = ((data & 0x00f0) >>4) | (data & 0xf000)>>8; +// mem_mask = ((mem_mask & 0x00f0)>>4) | ((mem_mask & 0xf000)>>8); + + + if (!(offset&1)) + { + data <<=8; + mem_mask <<=8; + } + + if (scd_rammode&1) + { + segacd_1meg_mode_word_write(offset/2+0x00000/2, data , mem_mask, 1); + } + else + { + segacd_1meg_mode_word_write(offset/2+0x20000/2, data, mem_mask, 1); + } + + // printf("Unspported: segacd_sub_dataram_part1_w in mode 1 (Word RAM Expander - 1 Byte Per Pixel) %04x\n", data); + } +} + +READ16_MEMBER( sega_segacd_device::segacd_sub_dataram_part2_r ) +{ + if ((scd_rammode&2)==RAM_MODE_2MEG) + { + //printf("ILLEGAL segacd_sub_dataram_part2_r in mode 0\n"); // not mapped to anything in mode 0 + return 0x0000; + } + else if ((scd_rammode&2)==RAM_MODE_1MEG) + { + //printf("Unsupported: segacd_sub_dataram_part2_r in mode 1 (Word RAM)\n"); + // ret bit set by sub cpu determines which half of WorkRAM we have access to? + if (scd_rammode&1) + { + return segacd_1meg_mode_word_read(offset+0x00000/2, mem_mask); + } + else + { + return segacd_1meg_mode_word_read(offset+0x20000/2, mem_mask); + } + + } + + return 0x0000; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_sub_dataram_part2_w ) +{ + if ((scd_rammode&2)==RAM_MODE_2MEG) + { + printf("ILLEGAL segacd_sub_dataram_part2_w in mode 0\n"); // not mapped to anything in mode 0 + } + else if ((scd_rammode&2)==RAM_MODE_1MEG) + { + //printf("Unsupported: segacd_sub_dataram_part2_w in mode 1 (Word RAM)\n"); + // ret bit set by sub cpu determines which half of WorkRAM we have access to? + if (scd_rammode&1) + { + segacd_1meg_mode_word_write(offset+0x00000/2, data, mem_mask, 0); + } + else + { + segacd_1meg_mode_word_write(offset+0x20000/2, data, mem_mask, 0); + } + + } +} + + + +READ16_MEMBER( sega_segacd_device::segacd_stampsize_r ) +{ + UINT16 retdata = 0x0000; + + retdata |= segacd_conversion_active<<15; + + retdata |= segacd_stampsize & 0x7; + + return retdata; + +} + +WRITE16_MEMBER( sega_segacd_device::segacd_stampsize_w ) +{ + //printf("segacd_stampsize_w %04x %04x\n",data, mem_mask); + if (ACCESSING_BITS_0_7) + { + segacd_stampsize = data & 0x07; + //if (data & 0xf8) + // printf(" unused bits (LSB) set in stampsize!\n"); + + //if (data&1) printf(" Repeat On\n"); + //else printf(" Repeat Off\n"); + + //if (data&2) printf(" 32x32 dots\n"); + //else printf(" 16x16 dots\n"); + + //if (data&4) printf(" 16x16 screens\n"); + //else printf(" 1x1 screen\n"); + } + + if (ACCESSING_BITS_8_15) + { + //if (data&0xff00) printf(" unused bits (MSB) set in stampsize!\n"); + } +} + +// these functions won't cope if +// +// the lower 3 bits of segacd_imagebuffer_hdot_size are set + +// this really needs to be doing it's own lookups rather than depending on the inefficient MAME cache.. +inline UINT8 sega_segacd_device::read_pixel_from_stampmap(bitmap_ind16* srcbitmap, int x, int y) +{ +/* + if (!srcbitmap) + { + return machine.rand(); + } + + if (x >= srcbitmap->width) return 0; + if (y >= srcbitmap->height) return 0; + + UINT16* cacheptr = &srcbitmap->pix16(y, x); + + return cacheptr[0] & 0xf; +*/ + + switch (segacd_get_active_stampmap_tilemap()&3) + { + case 0x00: return get_stampmap_16x16_1x1_tile_info_pixel( x, y ); + case 0x01: return get_stampmap_32x32_1x1_tile_info_pixel( x, y ); + case 0x02: return get_stampmap_16x16_16x16_tile_info_pixel( x, y ); + case 0x03: return get_stampmap_32x32_16x16_tile_info_pixel( x, y ); + } + + return 0; +} + + + + + +// this triggers the conversion operation, which will cause an IRQ1 when finished +WRITE16_MEMBER( sega_segacd_device::segacd_trace_vector_base_address_w ) +{ + if ((scd_rammode&2)==RAM_MODE_1MEG) + { + printf("ILLEGAL: segacd_trace_vector_base_address_w %04x %04x in mode 1!\n",data,mem_mask); + } + + //printf("segacd_trace_vector_base_address_w %04x %04x\n",data,mem_mask); + + { + int base = (data & 0xfffe) * 4; + + //printf("actual base = %06x\n", base + 0x80000); + + // nasty nasty nasty + //segacd_mark_stampmaps_dirty(); + + segacd_conversion_active = 1; + + // todo: proper time calculation + m_stamp_timer->adjust(attotime::from_nsec(30000)); + + + + int line; + //bitmap_ind16 *srcbitmap = segacd_stampmap[segacd_get_active_stampmap_tilemap(->pixmap()]); + bitmap_ind16 *srcbitmap = 0; + UINT32 bufferstart = ((segacd_imagebuffer_start_address&0xfff8)*2)<<3; + + for (line=0;line>1]; + tilemapyoffs = m_dataram[(currbase+0x2)>>1]; + deltax = m_dataram[(currbase+0x4)>>1]; // x-zoom + deltay = m_dataram[(currbase+0x6)>>1]; // rotation + + //printf("%06x: %04x (%d) %04x (%d) %04x %04x\n", currbase, tilemapxoffs, tilemapxoffs>>3, tilemapyoffs, tilemapyoffs>>3, deltax, deltay); + + int xbase = tilemapxoffs * 256; + int ybase = tilemapyoffs * 256; + int count; + + for (count=0;count<(segacd_imagebuffer_hdot_size);count++) + { + //int i; + UINT8 pix = 0x0; + + pix = read_pixel_from_stampmap(srcbitmap, xbase>>(3+8), ybase>>(3+8)); + + xbase += deltax; + ybase += deltay; + + // clamp to 24-bits, seems to be required for all the intro effects to work + xbase &= 0xffffff; + ybase &= 0xffffff; + + int countx = count + (segacd_imagebuffer_offset&0x7); + + UINT32 offset; + + offset = bufferstart+((((segacd_imagebuffer_vcell_size+1)*0x10)*(countx>>3))<<3); + + offset+= ((line*2)<<3); + offset+=(segacd_imagebuffer_offset&0x38)<<1; + + offset+=countx & 0x7; + + write_pixel( pix, offset ); + + segacd_mark_tiles_dirty(offset>>3); + segacd_mark_tiles_dirty((offset>>3)+1); + + } + + } + } + +} + +// actually just the low 8 bits? +READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_vdot_size_r ) +{ + return segacd_imagebuffer_vdot_size; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_vdot_size_w ) +{ + //printf("segacd_imagebuffer_vdot_size_w %04x %04x\n",data,mem_mask); + COMBINE_DATA(&segacd_imagebuffer_vdot_size); +} + + +// basically the 'tilemap' base address, for the 16x16 / 32x32 source tiles +READ16_MEMBER( sega_segacd_device::segacd_stampmap_base_address_r ) +{ + // different bits are valid in different modes, but I'm guessing the register + // always returns all the bits set, even if they're not used? + return segacd_stampmap_base_address; + +} + +WRITE16_MEMBER( sega_segacd_device::segacd_stampmap_base_address_w ) +{ // WORD ACCESS + + // low 3 bitsa aren't used, are they stored? + COMBINE_DATA(&segacd_stampmap_base_address); +} + +// destination for 'rendering' the section of the tilemap(stampmap) requested +READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_start_address_r ) +{ + return segacd_imagebuffer_start_address; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_start_address_w ) +{ + COMBINE_DATA(&segacd_imagebuffer_start_address); + + //int base = (segacd_imagebuffer_start_address & 0xfffe) * 4; + //printf("segacd_imagebuffer_start_address_w %04x %04x (actual base = %06x)\n", data, segacd_imagebuffer_start_address, base); +} + +READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_offset_r ) +{ + return segacd_imagebuffer_offset; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_offset_w ) +{ + COMBINE_DATA(&segacd_imagebuffer_offset); +// printf("segacd_imagebuffer_offset_w %04x\n", segacd_imagebuffer_offset); +} + +READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_vcell_size_r ) +{ + return segacd_imagebuffer_vcell_size; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_vcell_size_w ) +{ + COMBINE_DATA(&segacd_imagebuffer_vcell_size); +} + + +READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_hdot_size_r ) +{ + return segacd_imagebuffer_hdot_size; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_hdot_size_w ) +{ + COMBINE_DATA(&segacd_imagebuffer_hdot_size); +} + + + +READ16_MEMBER( sega_segacd_device::segacd_irq3timer_r ) +{ + return m_irq3_timer_reg; // always returns value written, not current counter! +} + + +WRITE16_MEMBER( sega_segacd_device::segacd_irq3timer_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_irq3_timer_reg = data & 0xff; + + // time = reg * 30.72 us + + if (m_irq3_timer_reg) + m_irq3_timer->adjust(SEGACD_IRQ3_TIMER_SPEED); + else + m_irq3_timer->adjust(attotime::never); + + //printf("segacd_irq3timer_w %02x\n", segacd_m_irq3_timer_reg); + } +} + + +READ8_MEMBER( sega_segacd_device::backupram_r ) +{ + return m_backupram[offset]; +} + +WRITE8_MEMBER( sega_segacd_device::backupram_w ) +{ + m_backupram[offset] = data; +} + +READ8_MEMBER( sega_segacd_device::font_color_r ) +{ + return m_font_color; +} + +WRITE8_MEMBER( sega_segacd_device::font_color_w ) +{ + m_font_color = data; +} + +READ16_MEMBER( sega_segacd_device::font_converted_r ) +{ + int scbg = (m_font_color & 0x0f); + int scfg = (m_font_color & 0xf0)>>4; + UINT16 retdata = 0; + int bit; + + for (bit=0;bit<4;bit++) + { + if (*m_font_bits&((0x1000>>offset*4)<memory().space(AS_PROGRAM); + + m_backupram.resize(0x2000); + subdevice("backupram")->set_base(&m_backupram[0], 0x2000); + + segacd_4meg_prgbank = 0; + + space.unmap_readwrite (0x020000,0x3fffff); + + space.install_read_handler (0x0020000, 0x003ffff, read16_delegate(FUNC(sega_segacd_device::scd_4m_prgbank_ram_r),this) ); + space.install_write_handler (0x0020000, 0x003ffff, write16_delegate(FUNC(sega_segacd_device::scd_4m_prgbank_ram_w),this) ); + + + space.install_readwrite_handler(0x200000, 0x23ffff, read16_delegate(FUNC(sega_segacd_device::segacd_main_dataram_part1_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_main_dataram_part1_w),this)); // RAM shared with sub + space.install_readwrite_handler(0xa12000, 0xa12001, read16_delegate(FUNC(sega_segacd_device::scd_a12000_halt_reset_r),this), write16_delegate(FUNC(sega_segacd_device::scd_a12000_halt_reset_w),this)); // sub-cpu control + space.install_readwrite_handler(0xa12002, 0xa12003, read16_delegate(FUNC(sega_segacd_device::scd_a12002_memory_mode_r),this), write16_delegate(FUNC(sega_segacd_device::scd_a12002_memory_mode_w),this)); // memory mode / write protect + //space.install_readwrite_handler(0xa12004, 0xa12005, read16_delegate(FUNC(sega_segacd_device::segacd_cdc_mode_address_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_cdc_mode_address_w),this)); + space.install_readwrite_handler(0xa12006, 0xa12007, read16_delegate(FUNC(sega_segacd_device::scd_a12006_hint_register_r),this), write16_delegate(FUNC(sega_segacd_device::scd_a12006_hint_register_w),this)); // where HINT points on main CPU + //space.install_read_handler (0xa12008, 0xa12009, read16_delegate(FUNC(sega_segacd_device::cdc_data_main_r),this)); + + + space.install_readwrite_handler(0xa1200c, 0xa1200d, read16_delegate(FUNC(sega_segacd_device::segacd_stopwatch_timer_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_stopwatch_timer_w),this)); // starblad + + space.install_readwrite_handler(0xa1200e, 0xa1200f, read16_delegate(FUNC(sega_segacd_device::segacd_comms_flags_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_comms_flags_maincpu_w),this)); // communication flags block + + space.install_readwrite_handler(0xa12010, 0xa1201f, read16_delegate(FUNC(sega_segacd_device::segacd_comms_main_part1_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_comms_main_part1_w),this)); + space.install_readwrite_handler(0xa12020, 0xa1202f, read16_delegate(FUNC(sega_segacd_device::segacd_comms_main_part2_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_comms_main_part2_w),this)); + + + + space.install_read_handler (0x0000070, 0x0000073, read16_delegate(FUNC(sega_segacd_device::scd_hint_vector_r),this) ); + + segacd_stampmap[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(sega_segacd_device::get_stampmap_16x16_1x1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); + segacd_stampmap[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(sega_segacd_device::get_stampmap_32x32_1x1_tile_info),this), TILEMAP_SCAN_ROWS, 32, 32, 8, 8); + segacd_stampmap[2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(sega_segacd_device::get_stampmap_16x16_16x16_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 256, 256); // 128kb! + segacd_stampmap[3] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(sega_segacd_device::get_stampmap_32x32_16x16_tile_info),this), TILEMAP_SCAN_ROWS, 32, 32, 128, 128); // 32kb! + + // todo register save state stuff +} + +READ16_MEMBER( sega_segacd_device::segacd_dmaaddr_r ) +{ + return m_dmaaddr; +} + +WRITE16_MEMBER( sega_segacd_device::segacd_dmaaddr_w ) +{ + COMBINE_DATA(&m_dmaaddr); +} + +void sega_segacd_device::device_reset() +{ + m_scdcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_scdcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + + segacd_hint_register = 0xffff; // -1 + + m_a12000_halt_reset_reg = 0x0000; + + scd_rammode = 0; + scd_mode_dmna_ret_flags = 0x5421; + + m_lc89510_temp->reset_cd(); + m_dmaaddr = 0; + m_dma_timer->adjust(attotime::zero); + + m_total_scanlines = 262; + + // HACK!!!! timegal, anettfut, roadaven end up with the SubCPU waiting in a loop for *something* + // overclocking the CPU, even at the point where the game is hung, allows them to continue and boot + // I'm not sure what the source of this timing problem is, it's not using IRQ3 or StopWatch at the + // time. Changing the CDHock timer to 50hz from 75hz also stops the hang, but then the video is + // too slow and has bad sound. -- Investigate! + + m_scdcpu->set_clock_scale(1.5000f); + + + // initialize some stuff on reset + + segacd_ram_writeprotect_bits = 0; + segacd_4meg_prgbank = 0; + segacd_memory_priority_mode = 0; + segacd_stampsize = 0; + + segacd_imagebuffer_vdot_size = 0; + segacd_imagebuffer_vcell_size = 0; + segacd_imagebuffer_hdot_size = 0; + + segacd_conversion_active = 0; + segacd_stampmap_base_address = 0; + segacd_imagebuffer_start_address = 0; + segacd_imagebuffer_offset = 0; + + segacd_comms_flags = 0x0000; + + segacd_redled = 0; + segacd_greenled = 0; + segacd_ready = 1; // actually set 100ms after startup? + m_irq3_timer_reg = 0; + + m_stamp_timer->adjust(attotime::never); + m_irq3_timer->adjust(attotime::never); + +} + + +// todo: tidy up +TIMER_DEVICE_CALLBACK_MEMBER( sega_segacd_device::dma_timer_callback ) +{ + // todo: accurate timing of this! + + #define RATE 256 + m_lc89510_temp->CDC_Do_DMA(machine(), RATE); + + // timed reset of flags + scd_mode_dmna_ret_flags |= 0x0021; + + m_dma_timer->adjust(attotime::from_hz(m_framerate) / m_total_scanlines); + +} + +// todo: tidy up, too many CDC internals here +void sega_segacd_device::SegaCD_CDC_Do_DMA(int &dmacount, UINT8 *CDC_BUFFER, UINT16 &dma_addrc, UINT16 &destination ) +{ + int length = dmacount; + UINT16 *dest; + int srcoffset = 0; + int dstoffset = 0; + address_space& space = m_scdcpu->space(AS_PROGRAM); + + bool PCM_DMA = false; + + if (destination==DMA_PCM) + { + dstoffset = (m_dmaaddr & 0x03FF) << 2; + PCM_DMA = true; + } + else + { + dstoffset = (m_dmaaddr & 0xFFFF) << 3; + } + + + while (dmacount--) + { + UINT16 data = (CDC_BUFFER[dma_addrc+srcoffset]<<8) | CDC_BUFFER[dma_addrc+srcoffset+1]; + + if (destination==DMA_PRG) + { + dest = m_prgram; + } + else if (destination==DMA_WRAM) + { + dest = m_dataram; + } + else if (destination==DMA_PCM) + { + dest = 0;//fatalerror("PCM RAM DMA unimplemented!\n"); + } + else + { + fatalerror("Unknown DMA Destination!!\n"); + } + + if (PCM_DMA) + { + m_rfsnd->rf5c68_mem_w(space, dstoffset & 0xfff, data >> 8); + m_rfsnd->rf5c68_mem_w(space, (dstoffset+1) & 0xfff, data); + // printf("PCM_DMA writing %04x %04x\n",0xff2000+(dstoffset*2), data); + } + else + { + if (dest) + { + if (destination==DMA_WRAM) + { + if ((scd_rammode&2)==RAM_MODE_2MEG) + { + dstoffset &= 0x3ffff; + + dest[dstoffset/2] = data; + + segacd_mark_tiles_dirty(dstoffset/2); + } + else + { + dstoffset &= 0x1ffff; + + if (!(scd_rammode & 1)) + { + segacd_1meg_mode_word_write((dstoffset+0x20000)/2, data, 0xffff, 0); + } + else + { + segacd_1meg_mode_word_write((dstoffset+0x00000)/2, data, 0xffff, 0); + } + } + + } + else + { + // main ram + dest[dstoffset/2] = data; + } + + } + } + + srcoffset += 2; + dstoffset += 2; + } + + + if (PCM_DMA) + { + m_dmaaddr += length >> 1; + } + else + { + m_dmaaddr += length >> 2; + } +} diff --git a/src/mame/machine/megacd.h b/src/mame/machine/megacd.h new file mode 100644 index 00000000000..84ed0b399c5 --- /dev/null +++ b/src/mame/machine/megacd.h @@ -0,0 +1,254 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/* Sega CD / Mega CD */ + +#include "cpu/m68000/m68000.h" +#include "machine/lc89510.h" +#include "machine/megacdcd.h" +#include "sound/rf5c68.h" + +#define SEGACD_CLOCK 12500000 + +#define RAM_MODE_2MEG (0) +#define RAM_MODE_1MEG (2) + +#define DMA_PCM (0x0400) +#define DMA_PRG (0x0500) +#define DMA_WRAM (0x0700) + +// irq3 timer +#define CHECK_SCD_LV3_INTERRUPT \ + if (m_lc89510_temp->get_segacd_irq_mask() & 0x08) \ + { \ + m_scdcpu->set_input_line(3, HOLD_LINE); \ + } +// from master +#define CHECK_SCD_LV2_INTERRUPT \ + if (m_lc89510_temp->get_segacd_irq_mask() & 0x04) \ + { \ + m_scdcpu->set_input_line(2, HOLD_LINE); \ + } + +// gfx convert +#define CHECK_SCD_LV1_INTERRUPT \ + if (m_lc89510_temp->get_segacd_irq_mask() & 0x02) \ + { \ + m_scdcpu->set_input_line(1, HOLD_LINE); \ + } + +#define SEGACD_IRQ3_TIMER_SPEED (attotime::from_nsec(m_irq3_timer_reg*30720)) + + +class sega_segacd_device : public device_t, public device_gfx_interface +{ +public: + sega_segacd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + required_device m_scdcpu; + required_device m_rfsnd; + required_device m_lc89510_temp; + required_device m_stopwatch_timer; + required_device m_stamp_timer; + required_device m_irq3_timer; + required_device m_dma_timer; + //required_device m_hock_timer; + + required_shared_ptr m_prgram; + required_shared_ptr m_dataram; + required_shared_ptr m_font_bits; + + // can't use a memshare because it's 8-bit RAM in a 16-bit address space + std::vector m_backupram; + + UINT8 m_font_color; + + UINT16 scd_rammode; + UINT32 scd_mode_dmna_ret_flags ; + + tilemap_t *segacd_stampmap[4]; + + + UINT8 segacd_ram_writeprotect_bits; + int segacd_4meg_prgbank;// = 0; // which bank the MainCPU can see of the SubCPU PrgRAM + int segacd_memory_priority_mode;// = 0; + int segacd_stampsize; + + UINT16 segacd_hint_register; + UINT16 segacd_imagebuffer_vdot_size; + UINT16 segacd_imagebuffer_vcell_size; + UINT16 segacd_imagebuffer_hdot_size; + + int segacd_conversion_active;// = 0; + UINT16 segacd_stampmap_base_address; + UINT16 segacd_imagebuffer_start_address; + UINT16 segacd_imagebuffer_offset; + + + UINT16 segacd_comms_flags;// = 0x0000; + UINT16 segacd_comms_part1[0x8]; + UINT16 segacd_comms_part2[0x8]; + + int segacd_redled;// = 0; + int segacd_greenled;// = 0; + int segacd_ready;// = 1; // actually set 100ms after startup? + UINT8 m_irq3_timer_reg; + + + TIMER_DEVICE_CALLBACK_MEMBER( irq3_timer_callback ); + TIMER_DEVICE_CALLBACK_MEMBER( stamp_timer_callback ); + + UINT16 handle_segacd_sub_int_callback(int irqline); + + inline void write_pixel(UINT8 pix, int pixeloffset); + UINT16 segacd_1meg_mode_word_read(int offset, UINT16 mem_mask); + void segacd_1meg_mode_word_write(int offset, UINT16 data, UINT16 mem_mask, int use_pm); + + DECLARE_READ16_MEMBER( segacd_dmaaddr_r ); + DECLARE_WRITE16_MEMBER( segacd_dmaaddr_w ); + UINT16 m_dmaaddr; + + UINT16 m_a12000_halt_reset_reg; + + int m_framerate; + int m_base_total_scanlines; + int m_total_scanlines; + + void segacd_mark_tiles_dirty(int offset); + int segacd_get_active_stampmap_tilemap(void); + + // set some variables at start, depending on region (shall be moved to a device interface?) + void set_framerate(int rate) { m_framerate = rate; } + void set_total_scanlines(int total) { m_base_total_scanlines = total; } // this gets set at start only + void update_total_scanlines(bool mode3) { m_total_scanlines = mode3 ? (m_base_total_scanlines * 2) : m_base_total_scanlines; } // this gets set at each EOF + + void SCD_GET_TILE_INFO_16x16_1x1( int& tile_region, int& tileno, int tile_index ); + void SCD_GET_TILE_INFO_32x32_1x1( int& tile_region, int& tileno, int tile_index ); + void SCD_GET_TILE_INFO_16x16_16x16( int& tile_region, int& tileno, int tile_index ); + void SCD_GET_TILE_INFO_32x32_16x16( int& tile_region, int& tileno, int tile_index ); + + TILE_GET_INFO_MEMBER( get_stampmap_16x16_1x1_tile_info ); + TILE_GET_INFO_MEMBER( get_stampmap_32x32_1x1_tile_info ); + TILE_GET_INFO_MEMBER( get_stampmap_16x16_16x16_tile_info ); + TILE_GET_INFO_MEMBER( get_stampmap_32x32_16x16_tile_info ); + + UINT8 get_stampmap_16x16_1x1_tile_info_pixel(int xpos, int ypos); + UINT8 get_stampmap_32x32_1x1_tile_info_pixel(int xpos, int ypos); + UINT8 get_stampmap_16x16_16x16_tile_info_pixel(int xpos, int ypos); + UINT8 get_stampmap_32x32_16x16_tile_info_pixel(int xpos, int ypos); + + WRITE16_MEMBER( scd_a12000_halt_reset_w ); + READ16_MEMBER( scd_a12000_halt_reset_r ); + READ16_MEMBER( scd_a12002_memory_mode_r ); + WRITE8_MEMBER( scd_a12002_memory_mode_w_8_15 ); + WRITE8_MEMBER( scd_a12002_memory_mode_w_0_7 ); + WRITE16_MEMBER( scd_a12002_memory_mode_w ); + READ16_MEMBER( segacd_sub_memory_mode_r ); + WRITE8_MEMBER( segacd_sub_memory_mode_w_8_15 ); + WRITE8_MEMBER( segacd_sub_memory_mode_w_0_7 ); + WRITE16_MEMBER( segacd_sub_memory_mode_w ); + + READ16_MEMBER( segacd_comms_flags_r ); + WRITE16_MEMBER( segacd_comms_flags_subcpu_w ); + WRITE16_MEMBER( segacd_comms_flags_maincpu_w ); + READ16_MEMBER( scd_4m_prgbank_ram_r ); + WRITE16_MEMBER( scd_4m_prgbank_ram_w ); + READ16_MEMBER( segacd_comms_main_part1_r ); + WRITE16_MEMBER( segacd_comms_main_part1_w ); + READ16_MEMBER( segacd_comms_main_part2_r ); + WRITE16_MEMBER( segacd_comms_main_part2_w ); + READ16_MEMBER( segacd_comms_sub_part1_r ); + WRITE16_MEMBER( segacd_comms_sub_part1_w ); + READ16_MEMBER( segacd_comms_sub_part2_r ); + WRITE16_MEMBER( segacd_comms_sub_part2_w ); + + + + READ16_MEMBER( segacd_main_dataram_part1_r ); + WRITE16_MEMBER( segacd_main_dataram_part1_w ); + + READ16_MEMBER( scd_hint_vector_r ); + READ16_MEMBER( scd_a12006_hint_register_r ); + WRITE16_MEMBER( scd_a12006_hint_register_w ); + + + WRITE16_MEMBER( segacd_stopwatch_timer_w ); + READ16_MEMBER( segacd_stopwatch_timer_r ); + READ16_MEMBER( segacd_sub_led_ready_r ); + WRITE16_MEMBER( segacd_sub_led_ready_w ); + READ16_MEMBER( segacd_sub_dataram_part1_r ); + WRITE16_MEMBER( segacd_sub_dataram_part1_w ); + READ16_MEMBER( segacd_sub_dataram_part2_r ); + WRITE16_MEMBER( segacd_sub_dataram_part2_w ); + + + READ16_MEMBER( segacd_stampsize_r ); + WRITE16_MEMBER( segacd_stampsize_w ); + + UINT8 read_pixel_from_stampmap(bitmap_ind16* srcbitmap, int x, int y); + + WRITE16_MEMBER( segacd_trace_vector_base_address_w ); + READ16_MEMBER( segacd_imagebuffer_vdot_size_r ); + WRITE16_MEMBER( segacd_imagebuffer_vdot_size_w ); + READ16_MEMBER( segacd_stampmap_base_address_r ); + WRITE16_MEMBER( segacd_stampmap_base_address_w ); + READ16_MEMBER( segacd_imagebuffer_start_address_r ); + WRITE16_MEMBER( segacd_imagebuffer_start_address_w ); + READ16_MEMBER( segacd_imagebuffer_offset_r ); + WRITE16_MEMBER( segacd_imagebuffer_offset_w ); + READ16_MEMBER( segacd_imagebuffer_vcell_size_r ); + WRITE16_MEMBER( segacd_imagebuffer_vcell_size_w ); + READ16_MEMBER( segacd_imagebuffer_hdot_size_r ); + WRITE16_MEMBER( segacd_imagebuffer_hdot_size_w ); + READ16_MEMBER( segacd_irq3timer_r ); + WRITE16_MEMBER( segacd_irq3timer_w ); + READ8_MEMBER( backupram_r ); + WRITE8_MEMBER( backupram_w ); + READ8_MEMBER( font_color_r ); + WRITE8_MEMBER( font_color_w ); + READ16_MEMBER( font_converted_r ); + TIMER_DEVICE_CALLBACK_MEMBER( dma_timer_callback ); + IRQ_CALLBACK_MEMBER(segacd_sub_int_callback); + + void SegaCD_CDC_Do_DMA( int &dmacount, UINT8 *CDC_BUFFER, UINT16 &dma_addrc, UINT16 &destination ); + +protected: + virtual void device_start(); + virtual void device_reset(); + + // optional information overrides +// virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: +// virtual void device_config_complete(); + +}; + + +class sega_segacd_us_device : public sega_segacd_device +{ + public: + sega_segacd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + protected: + +}; + +class sega_segacd_japan_device : public sega_segacd_device +{ + public: + sega_segacd_japan_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + protected: +// virtual machine_config_constructor device_mconfig_additions() const; +}; + +class sega_segacd_europe_device : public sega_segacd_device +{ + public: + sega_segacd_europe_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + protected: +// virtual machine_config_constructor device_mconfig_additions() const; +}; + + +extern const device_type SEGA_SEGACD_US; +extern const device_type SEGA_SEGACD_JAPAN; +extern const device_type SEGA_SEGACD_EUROPE; diff --git a/src/mame/machine/megacdcd.c b/src/mame/machine/megacdcd.c new file mode 100644 index 00000000000..617d3615393 --- /dev/null +++ b/src/mame/machine/megacdcd.c @@ -0,0 +1,1331 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/* CD controller code from megacd.c, used by Sega CD / Mega CD */ + +/* todo: cleanup(!!), make more generic, unifiy implementation with NeoCD, turn into a device and move to the proper lc89510.c file + currently this is a bit of a mix of system specific bits, incomplete implementations etc. as well as a rather kludgy combination + of the CDC and drive emulation. */ + + +#include "emu.h" +#include "machine/megacdcd.h" + +const device_type LC89510_TEMP = &device_creator; + +lc89510_temp_device::lc89510_temp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, LC89510_TEMP, "lc89510_temp_device", tag, owner, clock, "lc89510_temp", __FILE__) +{ + segacd_dma_callback = segacd_dma_delegate(FUNC(lc89510_temp_device::Fake_CDC_Do_DMA), this); + type1_interrupt_callback = interrupt_delegate(FUNC(lc89510_temp_device::dummy_interrupt_callback), this); + type2_interrupt_callback = interrupt_delegate(FUNC(lc89510_temp_device::dummy_interrupt_callback), this); + type3_interrupt_callback = interrupt_delegate(FUNC(lc89510_temp_device::dummy_interrupt_callback), this); + + is_neoCD = false; + + nff0002 = 0; + for (int i=0;i<10;i++) + CDD_TX[i] = 0; + for (int i=0;i<10;i++) + CDD_RX[i] = 0; + NeoCDCommsWordCount = 0; + NeoCD_StatusHack = 0; + SCD_CURLBA = 0; + + CDC_REG0 = 0; + + segacd_irq_mask = 0; +} + +void lc89510_temp_device::dummy_interrupt_callback(void) +{ +} + +void lc89510_temp_device::set_CDC_Do_DMA(device_t &device,segacd_dma_delegate new_segacd_dma_callback) +{ + lc89510_temp_device &dev = downcast(device); + dev.segacd_dma_callback = new_segacd_dma_callback; +} + +void lc89510_temp_device::set_type1_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback) +{ + lc89510_temp_device &dev = downcast(device); + dev.type1_interrupt_callback = interrupt_callback; +} + +void lc89510_temp_device::set_type2_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback) +{ + lc89510_temp_device &dev = downcast(device); + dev.type2_interrupt_callback = interrupt_callback; +} + +void lc89510_temp_device::set_type3_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback) +{ + lc89510_temp_device &dev = downcast(device); + dev.type3_interrupt_callback = interrupt_callback; +} + +void lc89510_temp_device::set_is_neoCD(device_t &device, bool is_neoCD) +{ + lc89510_temp_device &dev = downcast(device); + dev.is_neoCD = is_neoCD; +} + +// HACK for DMA handling, this gets replaced +void lc89510_temp_device::Fake_CDC_Do_DMA(int &dmacount, UINT8 *CDC_BUFFER, UINT16 &dma_addrc, UINT16 &destination ) +{ + fatalerror("Fake_CDC_Do_DMA\n"); +} + +void lc89510_temp_device::device_start() +{ + segacd_dma_callback.bind_relative_to(*owner()); + type1_interrupt_callback.bind_relative_to(*owner()); + type2_interrupt_callback.bind_relative_to(*owner()); + type3_interrupt_callback.bind_relative_to(*owner()); + + m_cdda = (cdda_device*)subdevice("cdda"); +} + +void lc89510_temp_device::device_reset() +{ +} + + +inline int lc89510_temp_device::to_bcd(int val, bool byte) +{ + if (val > 99) val = 99; + + if (byte) return (((val) / 10) << 4) + ((val) % 10); + else return (((val) / 10) << 8) + ((val) % 10); +} + + + +void lc89510_temp_device::set_data_audio_mode(void) +{ + if (CURRENT_TRACK_IS_DATA) + { + SET_CDD_DATA_MODE + } + else + { + SET_CDD_AUDIO_MODE + //fatalerror("CDDA unsupported\n"); + } +} + +void lc89510_temp_device::CDD_DoChecksum(void) +{ + int checksum = + CDD_RX[0] + + CDD_RX[1] + + CDD_RX[2] + + CDD_RX[3] + + CDD_RX[4] + + CDD_RX[5] + + CDD_RX[6] + + CDD_RX[7] + + CDD_RX[8]; + + if (is_neoCD) checksum += 0x5; // why?? + checksum &= 0xf; + checksum ^= 0xf; + + CDD_RX[9] = checksum; +} + +bool lc89510_temp_device::CDD_Check_TX_Checksum(void) +{ + int checksum = + CDD_TX[0] + + CDD_TX[1] + + CDD_TX[2] + + CDD_TX[3] + + CDD_TX[4] + + CDD_TX[5] + + CDD_TX[6] + + CDD_TX[7] + + CDD_TX[8]; + + if (is_neoCD) checksum += 0x5; // why?? + checksum &= 0xf; + checksum ^= 0xf; + + if (CDD_TX[9] == checksum) + return true; + + return false; +} + +// converts our 16-bit working regs to 8-bit regs and checksums them +void lc89510_temp_device::CDD_Export(bool neocd_hack) +{ + if (!neocd_hack) + CDD_RX[0] = (CDD_STATUS & 0xff00)>>8; + else + { + // printf("was %02x returning %02x\n", (CDD_STATUS & 0xff00)>>8, NeoCD_StatusHack); + CDD_RX[0] = NeoCD_StatusHack; + } + + CDD_RX[1] = (CDD_STATUS & 0x00ff)>>0; + CDD_RX[2] = (CDD_MIN & 0xff00)>>8; + CDD_RX[3] = (CDD_MIN & 0x00ff)>>0; + CDD_RX[4] = (CDD_SEC & 0xff00)>>8; + CDD_RX[5] = (CDD_SEC & 0x00ff)>>0; + CDD_RX[6] = (CDD_FRAME & 0xff00)>>8; + CDD_RX[7] = (CDD_FRAME & 0x00ff)>>0; + CDD_RX[8] = (CDD_EXT & 0x00ff)>>0; + /* 9 = checksum */ + + CDD_DoChecksum(); + + CDD_CONTROL &= ~4; // Clear HOCK bit + +} + + + + + + +void lc89510_temp_device::CDD_GetStatus(void) +{ + UINT16 s = (CDD_STATUS & 0x0f00); + + if ((s == 0x0200) || (s == 0x0700) || (s == 0x0e00)) + CDD_STATUS = (SCD_STATUS & 0xff00) | (CDD_STATUS & 0x00ff); +} + + +void lc89510_temp_device::CDD_Stop(running_machine &machine) +{ + CLEAR_CDD_RESULT + STOP_CDC_READ + SCD_STATUS = CDD_STOPPED; + CDD_STATUS = 0x0000; + SET_CDD_DATA_MODE + m_cdda->stop_audio(); //stop any pending CD-DA + + //neocd + NeoCD_StatusHack = 0x0E; + + +} + + +void lc89510_temp_device::CDD_GetPos(void) +{ + CLEAR_CDD_RESULT + UINT32 msf; + CDD_STATUS &= 0xFF; + if(segacd.cd == NULL) // no CD is there, bail out + return; + CDD_STATUS |= SCD_STATUS; + msf = lba_to_msf_alt(SCD_CURLBA+150); + CDD_MIN = to_bcd(((msf & 0x00ff0000)>>16),false); + CDD_SEC = to_bcd(((msf & 0x0000ff00)>>8),false); + CDD_FRAME = to_bcd(((msf & 0x000000ff)>>0),false); +} + +void lc89510_temp_device::CDD_GetTrackPos(void) +{ + CLEAR_CDD_RESULT + int elapsedlba; + UINT32 msf; + CDD_STATUS &= 0xFF; + // UINT32 end_msf = ; + if(segacd.cd == NULL) // no CD is there, bail out + return; + CDD_STATUS |= SCD_STATUS; + elapsedlba = SCD_CURLBA - segacd.toc->tracks[ cdrom_get_track(segacd.cd, SCD_CURLBA) ].logframeofs; + msf = lba_to_msf_alt (elapsedlba); + //popmessage("%08x %08x",SCD_CURLBA,segacd.toc->tracks[ cdrom_get_track(segacd.cd, SCD_CURLBA) + 1 ].logframeofs); + CDD_MIN = to_bcd(((msf & 0x00ff0000)>>16),false); + CDD_SEC = to_bcd(((msf & 0x0000ff00)>>8),false); + CDD_FRAME = to_bcd(((msf & 0x000000ff)>>0),false); +} + +void lc89510_temp_device::CDD_GetTrack(void) +{ + CLEAR_CDD_RESULT + CDD_STATUS &= 0xFF; + if(segacd.cd == NULL) // no CD is there, bail out + return; + CDD_STATUS |= SCD_STATUS; + SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; + CDD_MIN = to_bcd(SCD_CURTRK, false); +} + +void lc89510_temp_device::CDD_Length(void) +{ + CLEAR_CDD_RESULT + CDD_STATUS &= 0xFF; + if(segacd.cd == NULL) // no CD is there, bail out + return; + CDD_STATUS |= SCD_STATUS; + + UINT32 startlba = (segacd.toc->tracks[cdrom_get_last_track(segacd.cd)].logframeofs); + UINT32 startmsf = lba_to_msf_alt( startlba ); + + CDD_MIN = to_bcd((startmsf&0x00ff0000)>>16,false); + CDD_SEC = to_bcd((startmsf&0x0000ff00)>>8,false); + CDD_FRAME = to_bcd((startmsf&0x000000ff)>>0,false); +} + + +void lc89510_temp_device::CDD_FirstLast(void) +{ + CLEAR_CDD_RESULT + CDD_STATUS &= 0xFF; + if(segacd.cd == NULL) // no CD is there, bail out + return; + CDD_STATUS |= SCD_STATUS; + CDD_MIN = 1; // first + CDD_SEC = to_bcd(cdrom_get_last_track(segacd.cd),false); // last +} + +void lc89510_temp_device::CDD_GetTrackAdr(void) +{ + CLEAR_CDD_RESULT + + int track = (CDD_TX[5] & 0xF) + (CDD_TX[4] & 0xF) * 10; + int last_track = cdrom_get_last_track(segacd.cd); + + CDD_STATUS &= 0xFF; + if(segacd.cd == NULL) // no CD is there, bail out + return; + CDD_STATUS |= SCD_STATUS; + + if (track > last_track) + track = last_track; + + if (track < 1) + track = 1; + + UINT32 startlba = (segacd.toc->tracks[track-1].logframeofs); + UINT32 startmsf = lba_to_msf_alt( startlba+150 ); + + CDD_MIN = to_bcd((startmsf&0x00ff0000)>>16,false); + CDD_SEC = to_bcd((startmsf&0x0000ff00)>>8,false); + CDD_FRAME = to_bcd((startmsf&0x000000ff)>>0,false); + CDD_EXT = track % 10; + + if (segacd.toc->tracks[track - 1].trktype != CD_TRACK_AUDIO) + CDD_FRAME |= 0x0800; +} + +// verify what this is.. the NeoCd emu code only checked the track type but +// checked it where we put CDD_EXT, not CDD_FRAME (RX[7] vs RX[8] in Export) +void lc89510_temp_device::CDD_GetTrackType(void) +{ + CLEAR_CDD_RESULT + + int track = (CDD_TX[5] & 0xF) + (CDD_TX[4] & 0xF) * 10; + int last_track = cdrom_get_last_track(segacd.cd); + + CDD_STATUS &= 0xFF; + if(segacd.cd == NULL) // no CD is there, bail out + return; + CDD_STATUS |= SCD_STATUS; + + if (track > last_track) + track = last_track; + + if (track < 1) + track = 1; + + if (segacd.toc->tracks[track - 1].trktype != CD_TRACK_AUDIO) + { + CDD_EXT = 0x08; + CDD_FRAME |= 0x0800; + } + + + +} + +UINT32 lc89510_temp_device::getmsf_from_regs(void) +{ + UINT32 msf = 0; + + msf = ((CDD_TX[3] & 0xF) + (CDD_TX[2] & 0xF) * 10) << 16; + msf |= ((CDD_TX[5] & 0xF) + (CDD_TX[4] & 0xF) * 10) << 8; + msf |= ((CDD_TX[7] & 0xF) + (CDD_TX[6] & 0xF) * 10) << 0; + + return msf; +} + +void lc89510_temp_device::CDD_Play(running_machine &machine) +{ + CLEAR_CDD_RESULT + UINT32 msf = getmsf_from_regs(); + SCD_CURLBA = msf_to_lba(msf)-150; + if(segacd.cd == NULL) // no CD is there, bail out + return; + UINT32 end_msf = segacd.toc->tracks[ cdrom_get_track(segacd.cd, SCD_CURLBA) + 1 ].logframeofs; + SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; + LC8951UpdateHeader(); + SCD_STATUS = CDD_PLAYINGCDDA; + CDD_STATUS = 0x0102; + set_data_audio_mode(); + printf("%d Track played\n",SCD_CURTRK); + CDD_MIN = to_bcd(SCD_CURTRK, false); + if(!(CURRENT_TRACK_IS_DATA)) + m_cdda->start_audio(SCD_CURLBA, end_msf - SCD_CURLBA); + SET_CDC_READ + + + NeoCD_StatusHack = 1; + +} + + +void lc89510_temp_device::CDD_Seek(void) +{ + CLEAR_CDD_RESULT + UINT32 msf = getmsf_from_regs(); + SCD_CURLBA = msf_to_lba(msf)-150; + if(segacd.cd == NULL) // no CD is there, bail out + return; + SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; + LC8951UpdateHeader(); + STOP_CDC_READ + SCD_STATUS = CDD_READY; + CDD_STATUS = 0x0200; + set_data_audio_mode(); +} + + +void lc89510_temp_device::CDD_Pause(running_machine &machine) +{ + CLEAR_CDD_RESULT + STOP_CDC_READ + SCD_STATUS = CDD_READY; + CDD_STATUS = SCD_STATUS; + SET_CDD_DATA_MODE + + //segacd.current_frame = cdda_get_audio_lba( machine.device( "cdda" ) ); + //if(!(CURRENT_TRACK_IS_DATA)) + m_cdda->pause_audio(1); + + + NeoCD_StatusHack = 4; + + +} + +void lc89510_temp_device::CDD_Resume(running_machine &machine) +{ + CLEAR_CDD_RESULT + STOP_CDC_READ + if(segacd.cd == NULL) // no CD is there, bail out + return; + SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; + SCD_STATUS = CDD_PLAYINGCDDA; + CDD_STATUS = 0x0102; + set_data_audio_mode(); + CDD_MIN = to_bcd (SCD_CURTRK, false); + SET_CDC_READ + //if(!(CURRENT_TRACK_IS_DATA)) + m_cdda->pause_audio(0); + + NeoCD_StatusHack = 1; +} + + +void lc89510_temp_device::CDD_FF(running_machine &machine) +{ + fatalerror("Fast Forward unsupported\n"); +} + + +void lc89510_temp_device::CDD_RW(running_machine &machine) +{ + fatalerror("Fast Rewind unsupported\n"); +} + + +void lc89510_temp_device::CDD_Open(void) +{ + fatalerror("Close Tray unsupported\n"); + /* TODO: re-read CD-ROM buffer here (Mega CD has multi disc games iirc?) */ +} + + +void lc89510_temp_device::CDD_Close(void) +{ + fatalerror("Open Tray unsupported\n"); + /* TODO: clear CD-ROM buffer here */ +} + + +void lc89510_temp_device::CDD_Init(void) +{ + CLEAR_CDD_RESULT + STOP_CDC_READ + SCD_STATUS = CDD_READY; + CDD_STATUS = SCD_STATUS; + CDD_SEC = 1; + CDD_FRAME = 1; +} + + +void lc89510_temp_device::CDD_Default(void) +{ + CLEAR_CDD_RESULT + CDD_STATUS = SCD_STATUS; + + + NeoCD_StatusHack = 9; +} + + +void lc89510_temp_device::CDD_Reset(void) +{ + CLEAR_CDD_RESULT + CDD_CONTROL = CDD_STATUS = 0; + + for (int i = 0; i < 10; i++) + CDD_RX[i] = CDD_TX[i] = 0; + + CDD_DoChecksum(); + + SCD_CURTRK = SCD_CURLBA = 0; + SCD_STATUS = CDD_READY; +} + +void lc89510_temp_device::CDC_Reset(void) +{ + memset(CDC_BUFFER, 0x00, ((16 * 1024 * 2) + SECTOR_SIZE)); + + LC8951RegistersW[REG_W_DACL] = LC8951RegistersW[REG_W_DACH] = LC8951RegistersW[REG_W_DBCL] = LC8951RegistersW[REG_W_DBCH] = LC8951RegistersW[REG_W_PTH] = LC8951RegistersW[REG_W_PTL] = LC8951RegistersW[REG_W_SBOUT] = LC8951RegistersW[REG_W_IFCTRL] = LC8951RegistersW[REG_W_CTRL0] = LC8951RegistersW[REG_W_CTRL1] = + LC8951RegistersW[REG_W_CTRL2] = LC8951RegistersR[REG_R_HEAD1] = LC8951RegistersR[REG_R_HEAD2] = LC8951RegistersR[REG_R_HEAD3] = LC8951RegistersR[REG_R_STAT0] = LC8951RegistersR[REG_R_STAT1] = LC8951RegistersR[REG_R_STAT2] = CDC_DECODE = 0; + + LC8951RegistersR[REG_R_IFSTAT] = 0xFF; + int wa = SECTOR_SIZE * 2; + LC8951RegistersW[REG_W_WAL] = wa & 0xff; LC8951RegistersW[REG_W_WAH] = (wa >> 8) &0xff; + LC8951RegistersR[REG_R_HEAD0] = 0x01; + LC8951RegistersR[REG_R_STAT3] = 0x80; + + LC8951UpdateHeader(); +} + + +void lc89510_temp_device::lc89510_Reset(void) +{ + CDD_Reset(); + CDC_Reset(); + + CDC_REG0 = CDC_REG1 = SCD_STATUS_CDC = CDD_DONE = 0; +} + + +void lc89510_temp_device::CDC_Do_DMA(running_machine& machine, int rate) +{ + UINT32 length; + + UINT16 destination = CDC_REG0 & 0x0700; + + if (!(SCD_DMA_ENABLED)) + return; + + if ((destination == READ_MAIN) || (destination==READ_SUB)) + { + CDC_REG0 |= 0x4000; + return; + } + + int dma_count_register = LC8951RegistersW[REG_W_DBCL] | (LC8951RegistersW[REG_W_DBCH]<<8); + + if (dma_count_register <= (rate * 2)) + { + length = (dma_count_register + 1) >> 1; + CDC_End_Transfer(machine); + } + else + length = rate; + + + int dmacount = length; + + UINT16 dma_addrc = LC8951RegistersW[REG_W_DACL] | (LC8951RegistersW[REG_W_DACH]<<8); + + // HACK + segacd_dma_callback(dmacount, CDC_BUFFER, dma_addrc, destination ); + + + dma_addrc += length*2; + LC8951RegistersW[REG_W_DACL] = dma_addrc & 0xff; LC8951RegistersW[REG_W_DACH] = (dma_addrc >> 8) & 0xff; + + if (SCD_DMA_ENABLED) + dma_count_register -= length*2; + else + dma_count_register = 0; + + LC8951RegistersW[REG_W_DBCL] = dma_count_register & 0xff; LC8951RegistersW[REG_W_DBCH] = (dma_count_register>>8) & 0xff; + +} + + + + +UINT16 lc89510_temp_device::CDC_Host_r(running_machine& machine, UINT16 type) +{ + UINT16 destination = CDC_REG0 & 0x0700; + + if (SCD_DMA_ENABLED) + { + if (destination == type) + { + int dma_count_register = LC8951RegistersW[REG_W_DBCL] | (LC8951RegistersW[REG_W_DBCH]<<8); + + dma_count_register -= 2; + + if (dma_count_register <= 0) + { + if (type==READ_SUB) dma_count_register = 0; + + CDC_End_Transfer(machine); + } + + LC8951RegistersW[REG_W_DBCL] = dma_count_register & 0xff; LC8951RegistersW[REG_W_DBCH] = (dma_count_register>>8) & 0xff; + + UINT16 dma_addrc = LC8951RegistersW[REG_W_DACL] | (LC8951RegistersW[REG_W_DACH]<<8); + + UINT16 data = (CDC_BUFFER[dma_addrc]<<8) | CDC_BUFFER[dma_addrc+1]; + dma_addrc += 2; + + LC8951RegistersW[REG_W_DACL] = dma_addrc & 0xff; LC8951RegistersW[REG_W_DACH] = (dma_addrc >> 8) & 0xff; + + + return data; + } + } + + return 0; +} + + + + +UINT8 lc89510_temp_device::CDC_Reg_r(void) +{ + int reg = CDC_REG0 & 0xF; + UINT8 ret = 0; + + + UINT16 decoderegs = 0x73F2; + + if ((decoderegs>>reg)&1) + CDC_DECODE |= (1 << reg); + + + CDC_REG0 = (CDC_REG0 & 0xFFF0) | ((reg+1)&0xf); + + switch (reg) + { + case REG_R_COMIN: ret = 0/*COMIN*/; break; + case REG_R_IFSTAT: ret = LC8951RegistersR[REG_R_IFSTAT]; break; + case REG_R_DBCL: ret = LC8951RegistersW[REG_W_DBCL]; break; + case REG_R_DBCH: +// LC8951RegistersR[REG_R_DBCH] &= 0x0F; // NeoCD? +// LC8951RegistersR[REG_R_DBCH] |= (LC8951RegistersR[REG_R_IFSTAT] & 0x40) ? 0x00 : 0xF0; // NeoCD? + ret = LC8951RegistersW[REG_W_DBCH]; break; + case REG_R_HEAD0: ret = LC8951RegistersR[REG_R_HEAD0]; break; + case REG_R_HEAD1: ret = LC8951RegistersR[REG_R_HEAD1]; break; + case REG_R_HEAD2: ret = LC8951RegistersR[REG_R_HEAD2]; break; + case REG_R_HEAD3: ret = LC8951RegistersR[REG_R_HEAD3]; break; + case REG_R_PTL: ret = LC8951RegistersW[REG_W_PTL]; break; + case REG_R_PTH: ret = LC8951RegistersW[REG_W_PTH]; break; + case REG_R_WAL: ret = LC8951RegistersW[REG_W_WAL]; break; + case REG_R_WAH: ret = LC8951RegistersW[REG_W_WAH]; break; + case REG_R_STAT0: ret = LC8951RegistersR[REG_R_STAT0]; break; + case REG_R_STAT1: ret = LC8951RegistersR[REG_R_STAT1]; + // LC8951RegistersR[REG_R_IFSTAT] |= 0x20; // NeoCD? // reset DECI + break; + case REG_R_STAT2: ret = LC8951RegistersR[REG_R_STAT2]; break; + case REG_R_STAT3: ret = LC8951RegistersR[REG_R_STAT3]; + + LC8951RegistersR[REG_R_IFSTAT] |= 0x20; // SegaCD? // reset DECI + if (!is_neoCD) + { + if ((LC8951RegistersW[REG_W_CTRL0] & 0x80) && (LC8951RegistersW[REG_W_IFCTRL] & 0x20)) + { + if ((CDC_DECODE & decoderegs) == decoderegs) + LC8951RegistersR[REG_R_STAT3] = 0x80; + } + } + break; + + } + + + return ret; +} + +void lc89510_temp_device::CDC_Reg_w(UINT8 data) +{ + int reg = CDC_REG0 & 0xF; + + int changers0[0x10] = { 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0}; + + if (changers0[reg]) + CDC_REG0 = (CDC_REG0 & 0xFFF0) | (reg+1); + + switch (reg) + { + case REG_W_SBOUT: + LC8951RegistersW[REG_W_SBOUT] = data; + break; + + case REG_W_IFCTRL: + LC8951RegistersW[REG_W_IFCTRL] = data; + + if (!(LC8951RegistersW[REG_W_IFCTRL] & 0x02)) + { + LC8951RegistersW[REG_W_DBCL] = 0; LC8951RegistersW[REG_W_DBCH] = 0; + STOP_CDC_DMA; + LC8951RegistersR[REG_R_IFSTAT] |= 0x08; + } + break; + + case REG_W_DBCL: LC8951RegistersW[REG_W_DBCL] = data; break; + case REG_W_DBCH: LC8951RegistersW[REG_W_DBCH] = data; break; + case REG_W_DACL: LC8951RegistersW[REG_W_DACL] = data; break; + case REG_W_DACH: LC8951RegistersW[REG_W_DACH] = data; break; + + case REG_W_DTTRG: + if (!is_neoCD) + { + if (LC8951RegistersW[REG_W_IFCTRL] & 0x02) + { + LC8951RegistersR[REG_R_IFSTAT] &= ~0x08; + SET_CDC_DMA; + CDC_REG0 &= ~0x8000; + } + } + else + { + LC8951RegistersW[REG_W_DTTRG] = ~0x00; + LC8951RegistersR[REG_R_IFSTAT] &= ~0x08; + } + break; + + case REG_W_DTACK: + //if (!is_neoCD) + { + LC8951RegistersR[REG_R_IFSTAT] |= 0x40; + } + //else + //{ + // LC8951RegistersW[REG_W_DTACK] = ~0x00; + // LC8951RegistersR[REG_R_IFSTAT] &= ~0x40; + //} + break; + case REG_W_WAL: LC8951RegistersW[REG_W_WAL] = data; break; + case REG_W_WAH: LC8951RegistersW[REG_W_WAH] = data; break; + case REG_W_CTRL0: LC8951RegistersW[REG_W_CTRL0] = data; break; + case REG_W_CTRL1: LC8951RegistersW[REG_W_CTRL1] = data; + //LC8951UpdateHeader(); // NeoCD + break; + case REG_W_PTL: LC8951RegistersW[REG_W_PTL] = data; break; + case REG_W_PTH: LC8951RegistersW[REG_W_PTH] = data; break; + case REG_W_CTRL2: LC8951RegistersW[REG_W_CTRL2] = data; break; + case REG_W_RESET: CDC_Reset(); break; + } +} + + + +void lc89510_temp_device::CDD_Process(running_machine& machine, int reason) +{ + CDD_Export(); + CHECK_SCD_LV4_INTERRUPT +} + +void lc89510_temp_device::CDD_Handle_TOC_Commands(void) +{ + int subcmd = CDD_TX[3]; + CDD_STATUS = (CDD_STATUS & 0xFF00) | subcmd; + + switch (subcmd) + { + case TOCCMD_CURPOS: CDD_GetPos(); break; + case TOCCMD_TRKPOS: CDD_GetTrackPos(); break; + case TOCCMD_CURTRK: CDD_GetTrack(); break; + case TOCCMD_LENGTH: CDD_Length(); break; + case TOCCMD_FIRSTLAST: CDD_FirstLast(); break; + case TOCCMD_TRACKADDR: CDD_GetTrackAdr(); break; + case 6: CDD_GetTrackType(); break; // NGCD, might be wrong, make sure Sega CD doesn't hate it + default: CDD_GetStatus(); break; + } +} + +static const char *const CDD_import_cmdnames[] = +{ + "Get Status", // 0 + "Stop ALL", // 1 + "Handle TOC", // 2 + "Play", // 3 + "Seek", // 4 + " (5)", // 5 + "Pause", // 6 + "Resume", // 7 + "FF", // 8 + "RWD", // 9 + "INIT", // A + " (b)", // B + "Close Tray", // C + "Open Tray", // D + " (e)", // E + " (f)" // F +}; + +bool lc89510_temp_device::CDD_Import(running_machine& machine) +{ + // don't execute the command if the checksum isn't valid + if (!CDD_Check_TX_Checksum()) + { + printf("invalid checksum\n"); + return false; + } + + if(CDD_TX[0] != 2 && CDD_TX[0] != 0) + printf("%s\n",CDD_import_cmdnames[CDD_TX[0]]); + + switch (CDD_TX[0]) + { + case CMD_STATUS: CDD_GetStatus(); break; + case CMD_STOPALL: CDD_Stop(machine); break; + case CMD_GETTOC: CDD_Handle_TOC_Commands(); break; + case CMD_READ: CDD_Play(machine); break; + case CMD_SEEK: CDD_Seek(); break; + case CMD_STOP: CDD_Pause(machine); break; + case CMD_RESUME: CDD_Resume(machine); break; + case CMD_FF: CDD_FF(machine); break; + case CMD_RW: CDD_RW(machine); break; + case CMD_INIT: CDD_Init(); break; + case CMD_CLOSE: CDD_Open(); break; + case CMD_OPEN: CDD_Close(); break; + default: CDD_Default(); break; + } + + CDD_DONE = 1; + return true; +} + + +/************************************************************** + CDC Stuff ******** +**************************************************************/ + + + +WRITE16_MEMBER( lc89510_temp_device::segacd_cdc_mode_address_w ) +{ + COMBINE_DATA(&CDC_REG0); +} + +READ16_MEMBER( lc89510_temp_device::segacd_cdc_mode_address_r ) +{ + return CDC_REG0; +} + +WRITE16_MEMBER( lc89510_temp_device::segacd_cdc_data_w ) +{ + COMBINE_DATA(&CDC_REG1); + + if (ACCESSING_BITS_0_7) + CDC_Reg_w(data); +} + +READ16_MEMBER( lc89510_temp_device::segacd_cdc_data_r ) +{ + UINT16 retdat = 0x0000; + + if (ACCESSING_BITS_0_7) + retdat |= CDC_Reg_r(); + + return retdat; +} + + +READ16_MEMBER( lc89510_temp_device::cdc_data_sub_r ) +{ + return CDC_Host_r(space.machine(), READ_SUB); +} + +READ16_MEMBER( lc89510_temp_device::cdc_data_main_r ) +{ + return CDC_Host_r(space.machine(), READ_MAIN); +} + + + + +READ16_MEMBER( lc89510_temp_device::segacd_irq_mask_r ) +{ + return segacd_irq_mask; +} + +WRITE16_MEMBER( lc89510_temp_device::segacd_irq_mask_w ) +{ + if (ACCESSING_BITS_0_7) + { + UINT16 control = CDD_CONTROL; + + // printf("segacd_irq_mask_w %04x %04x (CDD control is %04x)\n",data, mem_mask, control); + + if (data & 0x10) + { + if (control & 0x04) + { + if (!(segacd_irq_mask & 0x10)) + { + segacd_irq_mask = data & 0x7e; + CDD_Process(space.machine(), 0); + return; + } + } + } + + segacd_irq_mask = data & 0x7e; + } + else + { + printf("segacd_irq_mask_w only MSB written\n"); + + } +} + +READ16_MEMBER( lc89510_temp_device::segacd_cdd_ctrl_r ) +{ + return CDD_CONTROL; +} + + +WRITE16_MEMBER( lc89510_temp_device::segacd_cdd_ctrl_w ) +{ + if (ACCESSING_BITS_0_7) + { + UINT16 control = CDD_CONTROL; + + + //printf("segacd_cdd_ctrl_w %04x %04x (control %04x irq %04x\n", data, mem_mask, control, segacd_irq_mask); + + data &=0x4; // only HOCK bit is writable + + if (data & 0x4) + { + if (!(control & 0x4)) + { + if (segacd_irq_mask&0x10) + { + CDD_Process(space.machine(), 1); + } + } + } + + CDD_CONTROL |= data; + } + else + { + printf("segacd_cdd_ctrl_w only MSB written\n"); + } +} + + +// mapped as serial +UINT8 lc89510_temp_device::neocd_cdd_rx_r() +{ + UINT8 ret = 0; + + if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { + ret = CDD_RX[NeoCDCommsWordCount] & 0x0F; + } + + if (bNeoCDCommsClock) { + ret |= 0x10; + } + + return ret; +} + +// mapped like 'ram' +READ8_MEMBER( lc89510_temp_device::segacd_cdd_rx_r ) +{ + return CDD_RX[offset]; +} + +// mapped as serial +void lc89510_temp_device::neocd_cdd_tx_w(UINT8 data) +{ + //printf("neocd_cdd_tx_w %d, %02x\n", NeoCDCommsWordCount, data); + + if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { + CDD_TX[NeoCDCommsWordCount] = data & 0x0F; + } +} + +WRITE8_MEMBER( lc89510_temp_device::segacd_cdd_tx_w ) +{ + CDD_TX[offset] = data; + + if(offset == 9) + { + CDD_Import(space.machine()); + } +} + + + + + + +READ16_MEMBER( lc89510_temp_device::segacd_cdfader_r ) +{ + return 0; +} + +WRITE16_MEMBER( lc89510_temp_device::segacd_cdfader_w ) +{ + static double cdfader_vol; + if(data & 0x800f) + printf("CD Fader register write %04x\n",data); + + cdfader_vol = (double)((data & 0x3ff0) >> 4); + + if(data & 0x4000) + cdfader_vol = 100.0; + else + cdfader_vol = (cdfader_vol / 1024.0) * 100.0; + + //printf("%f\n",cdfader_vol); + + m_cdda->set_volume(cdfader_vol); +} + +void lc89510_temp_device::reset_cd(void) +{ + /* init cd-rom device */ + + lc89510_Reset(); + + { + cdrom_image_device *cddevice = machine().device("cdrom"); + if ( cddevice ) + { + segacd.cd = cddevice->get_cdrom_file(); + if ( segacd.cd ) + { + segacd.toc = cdrom_get_toc( segacd.cd ); + m_cdda->set_cdrom(segacd.cd); + m_cdda->stop_audio(); //stop any pending CD-DA + } + } + } + + + +// if (segacd.cd) +// printf("cd found\n"); +} + + + +TIMER_DEVICE_CALLBACK_MEMBER( lc89510_temp_device::segacd_access_timer_callback ) +{ + if (!is_neoCD) + { + if (CDD_DONE) + { + CDD_DONE = 0; + CDD_Export(); + CHECK_SCD_LV4_INTERRUPT_A + } + } + else + { + if (nff0002 & 0x0050) + { + type2_interrupt_callback(); + } + } + + if (SCD_READ_ENABLED) // if (nff0002 & 0x0050) if (nff0002 & 0x0500); + { + set_data_audio_mode(); + Read_LBA_To_Buffer(machine()); + } + +} + + + + +static MACHINE_CONFIG_FRAGMENT( lc89510_temp_fragment ) + MCFG_TIMER_DRIVER_ADD_PERIODIC("hock_timer", lc89510_temp_device, segacd_access_timer_callback, attotime::from_hz(75)) + + MCFG_SOUND_ADD( "cdda", CDDA, 0 ) + MCFG_SOUND_ROUTE( 0, ":lspeaker", 0.50 ) // TODO: accurate volume balance + MCFG_SOUND_ROUTE( 1, ":rspeaker", 0.50 ) +MACHINE_CONFIG_END + +machine_config_constructor lc89510_temp_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( lc89510_temp_fragment ); +} + +/* Neo CD */ + + + + + + + + + + +void lc89510_temp_device::NeoCDCommsReset() +{ + bNeoCDCommsClock = true; + + memset(CDD_TX, 0, sizeof(CDD_TX)); + memset(CDD_RX, 0, sizeof(CDD_RX)); + + NeoCDCommsWordCount = 0; + + NeoCD_StatusHack = 9; + + + nff0016 = 0; +} + + + + +void lc89510_temp_device::NeoCDCommsControl(UINT8 clock, UINT8 send) +{ + if (clock && !bNeoCDCommsClock) { + NeoCDCommsWordCount++; + if (NeoCDCommsWordCount >= 10) { + NeoCDCommsWordCount = 0; + + if (send) + { + if (CDD_TX[0]) + { + if (!CDD_Import(machine())) + return; + + CDD_Export(true); // true == neocd hack, + } + + } + + } + } + bNeoCDCommsClock = clock; +} + + +void lc89510_temp_device::LC8951UpdateHeader() // neocd +{ + if (LC8951RegistersW[REG_W_CTRL1] & 1) { + // HEAD registers have sub-header + + LC8951RegistersR[REG_R_HEAD0] = 0; // HEAD0 + LC8951RegistersR[REG_R_HEAD1] = 0; // HEAD1 + LC8951RegistersR[REG_R_HEAD2] = 0; // HEAD2 + LC8951RegistersR[REG_R_HEAD3] = 0; // HEAD3 + + } else { + // HEAD registers have header + UINT32 msf = lba_to_msf_alt(SCD_CURLBA+150); + + LC8951RegistersR[REG_R_HEAD0] = to_bcd (((msf & 0x00ff0000)>>16), true); // HEAD0 + LC8951RegistersR[REG_R_HEAD1] = to_bcd (((msf & 0x0000ff00)>>8), true); // HEAD1 + LC8951RegistersR[REG_R_HEAD2] = to_bcd (((msf & 0x000000ff)>>0), true); // HEAD2 + LC8951RegistersR[REG_R_HEAD3] = 0x1; // HEAD3 + } +} + +char* lc89510_temp_device::LC8915InitTransfer(int NeoCDDMACount) +{ + if (!LC8951RegistersW[REG_W_DTTRG]) { + //bprintf(PRINT_ERROR, _T(" LC8951 DTTRG status invalid\n")); + return NULL; + } + if (!(LC8951RegistersW[REG_W_IFCTRL] & 0x02)) { + //bprintf(PRINT_ERROR, _T(" LC8951 DOUTEN status invalid\n")); + return NULL; + } + if (((LC8951RegistersW[REG_W_DACH] << 8) | LC8951RegistersW[REG_W_DACL]) + (NeoCDDMACount << 1) > LC89510_EXTERNAL_BUFFER_SIZE) { + //bprintf(PRINT_ERROR, _T(" DMA transfer exceeds current sector in LC8951 external buffer\n")); + + return NULL; + } + + char* addr = (char*)CDC_BUFFER + ((LC8951RegistersW[REG_W_DACH] << 8) | LC8951RegistersW[REG_W_DACL]); + return addr; +} + +void lc89510_temp_device::LC8915EndTransfer() +{ + LC8951RegistersW[REG_W_DTTRG] = 0x00; // reset DTTRG + + LC8951RegistersR[REG_R_IFSTAT] |= 0x48; // set DTEI & DTBSY + if (LC8951RegistersW[REG_W_IFCTRL] & 0x40) { + // trigger DTE interrupt + + // the Neo Geo CD doesn't use the DTE interrupt + // nIRQAcknowledge &= ~0x20; + // NeoCDIRQUpdate(0); + + } +} + + +void lc89510_temp_device::CDC_End_Transfer(running_machine& machine) +{ + STOP_CDC_DMA + CDC_REG0 |= 0x8000; + CDC_REG0 &= ~0x4000; + LC8951RegistersR[REG_R_IFSTAT] |= 0x08; + + if (LC8951RegistersW[REG_W_IFCTRL] & 0x40) + { + LC8951RegistersR[REG_R_IFSTAT] &= ~0x40; + CHECK_SCD_LV5_INTERRUPT + } +} + + + + + + +void lc89510_temp_device::scd_ctrl_checks(running_machine& machine) +{ + LC8951RegistersR[REG_R_STAT0] = 0x80; + + (LC8951RegistersW[REG_W_CTRL0] & 0x10) ? (LC8951RegistersR[REG_R_STAT2] = LC8951RegistersW[REG_W_CTRL1] & 0x08) : (LC8951RegistersR[REG_R_STAT2] = LC8951RegistersW[REG_W_CTRL1] & 0x0C); + (LC8951RegistersW[REG_W_CTRL0] & 0x02) ? (LC8951RegistersR[REG_R_STAT3] = 0x20) : (LC8951RegistersR[REG_R_STAT3] = 0x00); + + if (LC8951RegistersW[REG_W_IFCTRL] & 0x20) + { + if (is_neoCD) + { + type1_interrupt_callback(); + } + else + { + // todo: make callback + CHECK_SCD_LV5_INTERRUPT + } + + + + LC8951RegistersR[REG_R_IFSTAT] &= ~0x20; + CDC_DECODE = 0; + } +} + +void lc89510_temp_device::scd_advance_current_readpos(void) +{ + SCD_CURLBA++; + + int pt = LC8951RegistersW[REG_W_PTL] | (LC8951RegistersW[REG_W_PTH] << 8); + int wa = LC8951RegistersW[REG_W_WAL] | (LC8951RegistersW[REG_W_WAH] << 8); + + wa += SECTOR_SIZE; + pt += SECTOR_SIZE; + + wa &= 0x7fff; + pt &= 0x7fff; + + LC8951RegistersW[REG_W_PTL] = pt & 0xff; LC8951RegistersW[REG_W_PTH] = (pt >> 8) &0xff; + LC8951RegistersW[REG_W_WAL] = wa & 0xff; LC8951RegistersW[REG_W_WAH] = (wa >> 8) &0xff; + +} + +int lc89510_temp_device::Read_LBA_To_Buffer(running_machine& machine) +{ + bool data_track = false; + if (CDD_CONTROL & 0x0100) data_track = true; + + if (data_track) + cdrom_read_data(segacd.cd, SCD_CURLBA, SCD_BUFFER, CD_TRACK_MODE1); + + LC8951UpdateHeader(); + + if (!data_track) + { + scd_advance_current_readpos(); + } + + if (LC8951RegistersW[REG_W_CTRL0] & 0x80) + { + if (LC8951RegistersW[REG_W_CTRL0] & 0x04) + { + if (data_track) + { + scd_advance_current_readpos(); + + int pt = LC8951RegistersW[REG_W_PTL] | (LC8951RegistersW[REG_W_PTH] << 8); + + memcpy(&CDC_BUFFER[pt + 4], SCD_BUFFER, 2048); + CDC_BUFFER[pt+0] = LC8951RegistersR[REG_R_HEAD0]; + CDC_BUFFER[pt+1] = LC8951RegistersR[REG_R_HEAD1]; + CDC_BUFFER[pt+2] = LC8951RegistersR[REG_R_HEAD2]; + CDC_BUFFER[pt+3] = LC8951RegistersR[REG_R_HEAD3]; + + + if (is_neoCD) + { + // This simulates the protection used by the NeoCDZ, a number of games (samsrpg for example) + // will not be recognized unless this happens. Is this part of the CDC error correction + // mechanism? + char *buffer_hack = (char*)&CDC_BUFFER[pt]; + if (buffer_hack[4 + 64] == 'g' && !strncmp(buffer_hack + 4, "Copyright by SNK", 16)) + { + buffer_hack[4 + 64] = 'f'; + } + } + + } + else + { + int pt = LC8951RegistersW[REG_W_PTL] | (LC8951RegistersW[REG_W_PTH] << 8); + + memcpy(&CDC_BUFFER[pt], SCD_BUFFER, SECTOR_SIZE); + } + } + + scd_ctrl_checks(machine); + + + } + + + return 0; +} + + + + + + +void lc89510_temp_device::nff0002_set(UINT16 wordValue) +{ + nff0002 = wordValue; +} + +void lc89510_temp_device::nff0016_set(UINT16 wordValue) +{ + nff0016 = wordValue; +} + +UINT16 lc89510_temp_device::nff0016_r(void) { return nff0016; } diff --git a/src/mame/machine/megacdcd.h b/src/mame/machine/megacdcd.h new file mode 100644 index 00000000000..9804c372031 --- /dev/null +++ b/src/mame/machine/megacdcd.h @@ -0,0 +1,317 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +#include "sound/cdda.h" +#include "imagedev/chd_cd.h" + + +typedef device_delegate segacd_dma_delegate; + +typedef device_delegate interrupt_delegate; + + +#define READ_MAIN (0x0200) +#define READ_SUB (0x0300) + +#define REG_W_SBOUT (0x0) +#define REG_W_IFCTRL (0x1) +#define REG_W_DBCL (0x2) +#define REG_W_DBCH (0x3) +#define REG_W_DACL (0x4) +#define REG_W_DACH (0x5) +#define REG_W_DTTRG (0x6) +#define REG_W_DTACK (0x7) +#define REG_W_WAL (0x8) +#define REG_W_WAH (0x9) +#define REG_W_CTRL0 (0xA) +#define REG_W_CTRL1 (0xB) +#define REG_W_PTL (0xC) +#define REG_W_PTH (0xD) +#define REG_W_CTRL2 (0xE) +#define REG_W_RESET (0xF) + +#define REG_R_COMIN (0x0) +#define REG_R_IFSTAT (0x1) +#define REG_R_DBCL (0x2) +#define REG_R_DBCH (0x3) +#define REG_R_HEAD0 (0x4) +#define REG_R_HEAD1 (0x5) +#define REG_R_HEAD2 (0x6) +#define REG_R_HEAD3 (0x7) +#define REG_R_PTL (0x8) +#define REG_R_PTH (0x9) +#define REG_R_WAL (0xa) +#define REG_R_WAH (0xb) +#define REG_R_STAT0 (0xc) +#define REG_R_STAT1 (0xd) +#define REG_R_STAT2 (0xe) +#define REG_R_STAT3 (0xf) + +#define CMD_STATUS (0x0) +#define CMD_STOPALL (0x1) +#define CMD_GETTOC (0x2) +#define CMD_READ (0x3) +#define CMD_SEEK (0x4) +// (0x5) +#define CMD_STOP (0x6) +#define CMD_RESUME (0x7) +#define CMD_FF (0x8) +#define CMD_RW (0x9) +#define CMD_INIT (0xa) +// (0xb) +#define CMD_CLOSE (0xc) +#define CMD_OPEN (0xd) +// (0xe) +// (0xf) + + +#define TOCCMD_CURPOS (0x0) +#define TOCCMD_TRKPOS (0x1) +#define TOCCMD_CURTRK (0x2) +#define TOCCMD_LENGTH (0x3) +#define TOCCMD_FIRSTLAST (0x4) +#define TOCCMD_TRACKADDR (0x5) + + + + +#define SECTOR_SIZE (2352) + +#define SET_CDD_DATA_MODE \ + CDD_CONTROL |= 0x0100; +#define SET_CDD_AUDIO_MODE \ + CDD_CONTROL &= ~0x0100; +#define STOP_CDC_READ \ + SCD_STATUS_CDC &= ~0x01; +#define SET_CDC_READ \ + SCD_STATUS_CDC |= 0x01; +#define SET_CDC_DMA \ + SCD_STATUS_CDC |= 0x08; +#define STOP_CDC_DMA \ + SCD_STATUS_CDC &= ~0x08; +#define SCD_READ_ENABLED \ + (SCD_STATUS_CDC & 1) + +#define SCD_DMA_ENABLED \ + (SCD_STATUS_CDC & 0x08) + +#define CLEAR_CDD_RESULT \ + CDD_MIN = CDD_SEC = CDD_FRAME = CDD_EXT = 0; +#define CHECK_SCD_LV5_INTERRUPT \ + if (segacd_irq_mask & 0x20) \ + { \ + machine.device(":segacd:segacd_68k")->execute().set_input_line(5, HOLD_LINE); \ + } +#define CHECK_SCD_LV4_INTERRUPT \ + if (segacd_irq_mask & 0x10) \ + { \ + machine.device(":segacd:segacd_68k")->execute().set_input_line(4, HOLD_LINE); \ + } +#define CHECK_SCD_LV4_INTERRUPT_A \ + if (segacd_irq_mask & 0x10) \ + { \ + machine().device(":segacd:segacd_68k")->execute().set_input_line(4, HOLD_LINE); \ + } + + +#define CURRENT_TRACK_IS_DATA \ + (segacd.toc->tracks[SCD_CURTRK - 1].trktype != CD_TRACK_AUDIO) + +#define CDD_PLAYINGCDDA 0x0100 +#define CDD_READY 0x0400 +#define CDD_STOPPED 0x0900 + + +#define MCFG_SEGACD_HACK_SET_CDC_DO_DMA( _class, _method) \ + lc89510_temp_device::set_CDC_Do_DMA(*device, segacd_dma_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); +#define MCFG_SEGACD_HACK_SET_NEOCD \ + lc89510_temp_device::set_is_neoCD(*device, true); +#define MCFG_SET_TYPE1_INTERRUPT_CALLBACK( _class, _method) \ + lc89510_temp_device::set_type1_interrupt_callback(*device, interrupt_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); +#define MCFG_SET_TYPE2_INTERRUPT_CALLBACK( _class, _method) \ + lc89510_temp_device::set_type2_interrupt_callback(*device, interrupt_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); +#define MCFG_SET_TYPE3_INTERRUPT_CALLBACK( _class, _method) \ + lc89510_temp_device::set_type3_interrupt_callback(*device, interrupt_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); +/* neocd */ + +#define CD_FRAMES_MINUTE (60 * 75) +#define CD_FRAMES_SECOND ( 75) +#define CD_FRAMES_PREGAP ( 2 * 75) + +#define SEK_IRQSTATUS_NONE (0x0000) +#define SEK_IRQSTATUS_AUTO (0x2000) +#define SEK_IRQSTATUS_ACK (0x1000) + +#define LC89510_EXTERNAL_BUFFER_SIZE ((32 * 1024 * 2) + SECTOR_SIZE) + +class lc89510_temp_device : public device_t +{ +public: + lc89510_temp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // HACK for DMA handling + segacd_dma_delegate segacd_dma_callback; + interrupt_delegate type1_interrupt_callback; + interrupt_delegate type2_interrupt_callback; + interrupt_delegate type3_interrupt_callback; + + void Fake_CDC_Do_DMA(int &dmacount, UINT8 *CDC_BUFFER, UINT16 &dma_addrc, UINT16 &destination ); + static void set_CDC_Do_DMA(device_t &device,segacd_dma_delegate new_segacd_dma_callback); + + void dummy_interrupt_callback(void); + static void set_type1_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback); + static void set_type2_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback); + static void set_type3_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback); + + + static void set_is_neoCD(device_t &device, bool is_neoCD); + + + // HACK for neoCD handling + bool is_neoCD; + + + struct segacd_t + { + cdrom_file *cd; + const cdrom_toc *toc; + UINT32 current_frame; + }; + + + segacd_t segacd; + + UINT8 SCD_BUFFER[2560]; + + UINT32 SCD_STATUS; + UINT32 SCD_STATUS_CDC; + INT32 SCD_CURLBA; + UINT8 SCD_CURTRK; + + + UINT16 CDC_DECODE; + UINT16 CDC_REG0; + UINT16 CDC_REG1; + + UINT8 CDC_BUFFER[LC89510_EXTERNAL_BUFFER_SIZE]; + + + UINT8 CDD_RX[10]; + UINT8 CDD_TX[10]; + + UINT32 CDD_STATUS; + UINT32 CDD_MIN; + UINT32 CDD_SEC; + UINT32 CDD_FRAME; + UINT32 CDD_EXT; + + UINT16 CDD_CONTROL; + + INT16 CDD_DONE; + + inline int to_bcd(int val, bool byte); + void set_data_audio_mode(void); + void CDD_DoChecksum(void); + bool CDD_Check_TX_Checksum(void); + void CDD_Export(bool neocd_hack = false); + void scd_ctrl_checks(running_machine& machine); + void scd_advance_current_readpos(void); + int Read_LBA_To_Buffer(running_machine& machine); + void CDD_GetStatus(void); + void CDD_Stop(running_machine &machine); + void CDD_GetPos(void); + void CDD_GetTrackPos(void); + void CDD_GetTrack(void); + void CDD_Length(void); + void CDD_FirstLast(void); + void CDD_GetTrackAdr(void); + void CDD_GetTrackType(void); + UINT32 getmsf_from_regs(void); + void CDD_Play(running_machine &machine); + void CDD_Seek(void); + void CDD_Pause(running_machine &machine); + void CDD_Resume(running_machine &machine); + void CDD_FF(running_machine &machine); + void CDD_RW(running_machine &machine); + void CDD_Open(void); + void CDD_Close(void); + void CDD_Init(void); + void CDD_Default(void); + void CDD_Reset(void); + void CDC_Reset(void); + void lc89510_Reset(void); + void CDC_End_Transfer(running_machine& machine); + void CDC_Do_DMA(running_machine& machine, int rate); + UINT16 CDC_Host_r(running_machine& machine, UINT16 type); + UINT8 CDC_Reg_r(void); + void CDC_Reg_w(UINT8 data); + void CDD_Process(running_machine& machine, int reason); + void CDD_Handle_TOC_Commands(void); + bool CDD_Import(running_machine& machine); + READ16_MEMBER( segacd_irq_mask_r ); + WRITE16_MEMBER( segacd_irq_mask_w ); + READ16_MEMBER( segacd_cdd_ctrl_r ); + WRITE16_MEMBER( segacd_cdd_ctrl_w ); + READ8_MEMBER( segacd_cdd_rx_r ); + WRITE8_MEMBER( segacd_cdd_tx_w ); + READ16_MEMBER( segacd_cdfader_r ); + WRITE16_MEMBER( segacd_cdfader_w ); + + void reset_cd(void); + + WRITE16_MEMBER( segacd_cdc_mode_address_w ); + READ16_MEMBER( segacd_cdc_mode_address_r ); + WRITE16_MEMBER( segacd_cdc_data_w ); + READ16_MEMBER( segacd_cdc_data_r ); + READ16_MEMBER( cdc_data_sub_r ); + READ16_MEMBER( cdc_data_main_r ); + + TIMER_DEVICE_CALLBACK_MEMBER( segacd_access_timer_callback ); + + UINT16 get_segacd_irq_mask(void) { return segacd_irq_mask; } + UINT16 segacd_irq_mask; + cdda_device* m_cdda; + + /* NeoCD */ + UINT16 nff0002; + UINT16 nff0016; + + + INT32 LC8951RegistersR[16]; + INT32 LC8951RegistersW[16]; + + + + bool bNeoCDCommsClock; + + INT32 NeoCDCommsWordCount; + + INT32 NeoCD_StatusHack; + + + + + void NeoCDCommsControl(UINT8 clock, UINT8 send); + void LC8951UpdateHeader(); + char* LC8915InitTransfer(int NeoCDDMACount); + void LC8915EndTransfer(); + + void neocd_cdd_tx_w(UINT8 data); + UINT8 neocd_cdd_rx_r(); + void NeoCDCommsReset(); + + + UINT16 nff0016_r(void); + void nff0016_set(UINT16 wordValue); + void nff0002_set(UINT16 wordValue); + +protected: + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; +private: + + +}; + +extern const device_type LC89510_TEMP; diff --git a/src/mame/machine/microdrv.c b/src/mame/machine/microdrv.c new file mode 100644 index 00000000000..803f1d921d8 --- /dev/null +++ b/src/mame/machine/microdrv.c @@ -0,0 +1,197 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************* + + microdrv.c + + MESS interface to the Sinclair Microdrive image abstraction code + +*********************************************************************/ + +#include "emu.h" +#include "microdrv.h" + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define LOG 0 + +#define MDV_SECTOR_COUNT 255 +#define MDV_SECTOR_LENGTH 686 +#define MDV_IMAGE_LENGTH (MDV_SECTOR_COUNT * MDV_SECTOR_LENGTH) + +#define MDV_PREAMBLE_LENGTH 12 +#define MDV_GAP_LENGTH 120 + +#define MDV_OFFSET_HEADER_PREAMBLE 0 +#define MDV_OFFSET_HEADER MDV_OFFSET_HEADER_PREAMBLE + MDV_PREAMBLE_LENGTH +#define MDV_OFFSET_DATA_PREAMBLE 28 +#define MDV_OFFSET_DATA MDV_OFFSET_DATA_PREAMBLE + MDV_PREAMBLE_LENGTH +#define MDV_OFFSET_GAP 566 + +#define MDV_BITRATE 120000 // invalid, from ZX microdrive + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +// device type definition +const device_type MICRODRIVE = &device_creator; + +//------------------------------------------------- +// microdrive_image_device - constructor +//------------------------------------------------- + +microdrive_image_device::microdrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, MICRODRIVE, "Microdrive", tag, owner, clock, "microdrive_image", __FILE__), + device_image_interface(mconfig, *this), + m_write_comms_out(*this) +{ +} + +//------------------------------------------------- +// microdrive_image_device - destructor +//------------------------------------------------- + +microdrive_image_device::~microdrive_image_device() +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void microdrive_image_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + +void microdrive_image_device::device_start() +{ + // resolve callbacks + m_write_comms_out.resolve_safe(); + + // allocate track buffers + m_left = auto_alloc_array(machine(), UINT8, MDV_IMAGE_LENGTH / 2); + m_right = auto_alloc_array(machine(), UINT8, MDV_IMAGE_LENGTH / 2); + + // allocate timers + m_bit_timer = timer_alloc(); + m_bit_timer->adjust(attotime::zero, 0, attotime::from_hz(MDV_BITRATE)); + m_bit_timer->enable(0); + + m_clk = 0; + m_comms_in = 0; + m_comms_out = 0; +} + +bool microdrive_image_device::call_load() +{ + if (length() != MDV_IMAGE_LENGTH) + return IMAGE_INIT_FAIL; + + for (int i = 0; i < MDV_IMAGE_LENGTH / 2; i++) + { + fread(m_left, 1); + fread(m_right, 1); + } + + m_bit_offset = 0; + m_byte_offset = 0; + + return IMAGE_INIT_PASS; +} + +void microdrive_image_device::call_unload() +{ + memset(m_left, 0, MDV_IMAGE_LENGTH / 2); + memset(m_right, 0, MDV_IMAGE_LENGTH / 2); +} + +void microdrive_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_bit_offset++; + + if (m_bit_offset == 8) + { + m_bit_offset = 0; + m_byte_offset++; + + if (m_byte_offset == MDV_IMAGE_LENGTH) + { + m_byte_offset = 0; + } + } +} + +WRITE_LINE_MEMBER( microdrive_image_device::clk_w ) +{ + if (LOG) logerror("Microdrive '%s' CLK: %u\n", tag(), state); + if (!m_clk && state) + { + m_comms_out = m_comms_in; + if (LOG) logerror("Microdrive '%s' COMMS OUT: %u\n", tag(), m_comms_out); + m_write_comms_out(m_comms_out); + m_bit_timer->enable(m_comms_out); + } + m_clk = state; +} + +WRITE_LINE_MEMBER( microdrive_image_device::comms_in_w ) +{ + if (LOG) logerror("Microdrive '%s' COMMS IN: %u\n", tag(), state); + m_comms_in = state; +} + +WRITE_LINE_MEMBER( microdrive_image_device::erase_w ) +{ + if (LOG) logerror("Microdrive '%s' ERASE: %u\n", tag(), state); + m_erase = state; +} + +WRITE_LINE_MEMBER( microdrive_image_device::read_write_w ) +{ + if (LOG) logerror("Microdrive '%s' READ/WRITE: %u\n", tag(), state); + m_read_write = state; +} + +WRITE_LINE_MEMBER( microdrive_image_device::data1_w ) +{ + if (m_comms_out && !m_read_write) + { + // TODO + } +} + +WRITE_LINE_MEMBER( microdrive_image_device::data2_w ) +{ + if (m_comms_out && !m_read_write) + { + // TODO + } +} + +READ_LINE_MEMBER( microdrive_image_device::data1_r ) +{ + int data = 0; + if (m_comms_out && m_read_write) + { + data = BIT(m_left[m_byte_offset], 7 - m_bit_offset); + } + return data; +} + +READ_LINE_MEMBER( microdrive_image_device::data2_r ) +{ + int data = 0; + if (m_comms_out && m_read_write) + { + data = BIT(m_right[m_byte_offset], 7 - m_bit_offset); + } + return data; +} diff --git a/src/mame/machine/microdrv.h b/src/mame/machine/microdrv.h new file mode 100644 index 00000000000..7d8913aae00 --- /dev/null +++ b/src/mame/machine/microdrv.h @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************* + + microdrv.h + + MESS interface to the Sinclair Microdrive image abstraction code + +*********************************************************************/ + +#pragma once + +#ifndef __MICRODRV__ +#define __MICRODRV__ + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MDV_1 "mdv1" +#define MDV_2 "mdv2" + + +#define MCFG_MICRODRIVE_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, MICRODRIVE, 0) + +#define MCFG_MICRODRIVE_COMMS_OUT_CALLBACK(_write) \ + devcb = µdrive_image_device::set_comms_out_wr_callback(*device, DEVCB_##_write); + + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +// ======================> microdrive_image_device + +class microdrive_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + microdrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~microdrive_image_device(); + + template static devcb_base &set_comms_out_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_comms_out.set_callback(object); } + + // image-level overrides + virtual bool call_load(); + virtual void call_unload(); + virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); } + + virtual iodevice_t image_type() const { return IO_CASSETTE; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return "ql_cass"; } + virtual const char *file_extensions() const { return "mdv"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + // specific implementation + DECLARE_WRITE_LINE_MEMBER( clk_w ); + DECLARE_WRITE_LINE_MEMBER( comms_in_w ); + DECLARE_WRITE_LINE_MEMBER( erase_w ); + DECLARE_WRITE_LINE_MEMBER( read_write_w ); + DECLARE_WRITE_LINE_MEMBER( data1_w ); + DECLARE_WRITE_LINE_MEMBER( data2_w ); + DECLARE_READ_LINE_MEMBER ( data1_r ); + DECLARE_READ_LINE_MEMBER ( data2_r ); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +private: + devcb_write_line m_write_comms_out; + + int m_clk; + int m_comms_in; + int m_comms_out; + int m_erase; + int m_read_write; + + UINT8 *m_left; + UINT8 *m_right; + + int m_bit_offset; + int m_byte_offset; + + emu_timer *m_bit_timer; +}; + + +// device type definition +extern const device_type MICRODRIVE; + + + +#endif diff --git a/src/mame/machine/micropolis.c b/src/mame/machine/micropolis.c new file mode 100644 index 00000000000..73b1b58178e --- /dev/null +++ b/src/mame/machine/micropolis.c @@ -0,0 +1,344 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + + micropolis.c + + by Robbbert, August 2011. + +This is a rough implementation of the Micropolis floppy-disk controller +as used for the Exidy Sorcerer. Since there is no documentation, coding +was done by looking at the Z80 code, and supplying the expected values. + +Currently, only reading of disks is supported. + +ToDo: +- Rewrite to be a standard device able to be used in a general way +- Fix bug where if you run a program on drive B,C,D then exit, you + get a disk error. +- Enable the ability to write to disk when above bug gets fixed. +- When the controller is reset via command 5, what exactly gets reset? + + +Ports: +BE00 and BE01 can be used as command registers (they are identical), + and they are also used as status registers (different). + +BE02 and BE03 - read data, write data + +***************************************************************************/ + + +#include "emu.h" +#include "machine/micropolis.h" + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + + +#define STAT_RFC 0x20 +#define STAT_TRACK0 0x08 +#define STAT_READY 0x80 + +#define VERBOSE 0 /* General logging */ +#define VERBOSE_DATA 0 /* Logging of each byte during read and write */ + +/* structure describing a single density track */ +#define TRKSIZE_SD 16*270 + +#if 0 +static const UINT8 track_SD[][2] = { + { 1, 0xff}, /* 1 * FF (marker) */ + { 1, 0x00}, /* 1 byte, track number (00-4C) */ + { 1, 0x01}, /* 1 byte, sector number (00-0F) */ + {10, 0x00}, /* 10 bytes of zeroes */ + {256, 0xe5}, /* 256 bytes of sector data */ + { 1, 0xb7}, /* 1 byte, CRC */ +}; +#endif + +/*************************************************************************** + MAME DEVICE INTERFACE +***************************************************************************/ + +const device_type MICROPOLIS = &device_creator; + +micropolis_device::micropolis_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MICROPOLIS, "MICROPOLIS", tag, owner, clock, "micropolis", __FILE__), + m_read_dden(*this), + m_write_intrq(*this), + m_write_drq(*this), + m_data(0), + m_drive_num(0), + m_track(0), + m_sector(0), + m_command(0), + m_status(0), + m_write_cmd(0), + m_data_offset(0), + m_data_count(0), + m_sector_length(0), + m_drive(NULL) +{ + for (int i = 0; i < 6144; i++) + m_buffer[i] = 0; + + for (int i = 0; i < 4; i++) + m_floppy_drive_tags[i] = NULL; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void micropolis_device::device_start() +{ + m_read_dden.resolve_safe(1); + m_write_intrq.resolve_safe(); + m_write_drq.resolve_safe(); + + save_item(NAME(m_data)); + save_item(NAME(m_drive_num)); + save_item(NAME(m_track)); + save_item(NAME(m_sector)); + save_item(NAME(m_command)); + save_item(NAME(m_status)); + save_item(NAME(m_write_cmd)); + save_item(NAME(m_buffer)); + save_item(NAME(m_data_offset)); + save_item(NAME(m_data_count)); + save_item(NAME(m_sector_length)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void micropolis_device::device_reset() +{ + for (int i = 0; i < 4; i++) + { + if (m_floppy_drive_tags[i]) + { + legacy_floppy_image_device *img = siblingdevice(m_floppy_drive_tags[i]); + + if (img) + { + img->floppy_drive_set_controller(this); + //img->floppy_drive_set_index_pulse_callback(wd17xx_index_pulse_callback); + img->floppy_drive_set_rpm(300.); + } + } + } + + set_drive(0); + + m_drive_num = 0; + m_sector = 0; + m_track = 0; + m_sector_length = 270; + m_status = STAT_TRACK0; +} + + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + + +/* read a sector */ +void micropolis_device::read_sector() +{ + m_data_offset = 0; + m_data_count = m_sector_length; + + /* read data */ + m_drive->floppy_drive_read_sector_data(0, m_sector, (char *)m_buffer, m_sector_length); +} + + +void micropolis_device::write_sector() +{ +#if 0 + /* at this point, the disc is write enabled, and data + * has been transfered into our buffer - now write it to + * the disc image or to the real disc + */ + + /* find sector */ + m_data_count = m_sector_length; + + /* write data */ + m_drive->floppy_drive_write_sector_data(0, m_sector, (char *)m_buffer, m_sector_length, m_write_cmd & 0x01); +#endif +} + + + + +/*************************************************************************** + INTERFACE +***************************************************************************/ + +/* select a drive */ +void micropolis_device::set_drive(UINT8 drive) +{ + if (VERBOSE) + logerror("micropolis_set_drive: $%02x\n", drive); + + if (m_floppy_drive_tags[drive]) + m_drive = siblingdevice(m_floppy_drive_tags[drive]); +} + + +/*************************************************************************** + DEVICE HANDLERS +***************************************************************************/ + + +/* read the FDC status register. */ +READ8_MEMBER( micropolis_device::status_r ) +{ + static int inv = 0; + + if (offset) + return m_status | m_drive_num; + else + { + // FIXME - find out what controls current sector + m_sector = (m_sector + 3 + inv) & 15; + read_sector(); + inv ^= 1; + return (m_status & STAT_READY) | m_sector; + } +} + + +/* read the FDC data register */ +READ8_MEMBER( micropolis_device::data_r ) +{ + if (m_data_offset >= m_sector_length) + m_data_offset = 0; + + return m_buffer[m_data_offset++]; +} + +/* write the FDC command register */ +WRITE8_MEMBER( micropolis_device::command_w ) +{ +/* List of commands: +Command (bits 5,6,7) Options (bits 0,1,2,3,4) +0 Not used +1 Drive/head select bits 0,1 select drive 0-3; bit 4 chooses a side +2 INT sector control bit 0 LO = disable; HI = enable +3 Step bit 0 LO step out; HI = step in (increment track number) +4 Set Write +5 Reset controller +6 Not used +7 Not used */ + + int direction = 0; + + switch (data >> 5) + { + case 1: + m_drive_num = data & 3; + m_drive->floppy_mon_w(1); // turn off the old drive + set_drive(m_drive_num); // select new drive + m_drive->floppy_mon_w(0); // turn it on + break; + case 2: // not emulated, not used in sorcerer + break; + case 3: + if (BIT(data, 0)) + { + if (m_track < 77) + { + m_track++; + direction = 1; + } + } + else + { + if (m_track) + { + m_track--; + direction = -1; + } + } + break; + case 4: // not emulated, to be done + break; + case 5: // not emulated, to be done + break; + } + + + m_status = STAT_RFC; + + if (BIT(data, 5)) + m_status |= STAT_READY; + + m_drive->floppy_drive_set_ready_state(1,0); + + + if (!m_track) + m_status |= STAT_TRACK0; + + m_drive->floppy_drive_seek(direction); +} + + +/* write the FDC data register */ +WRITE8_MEMBER( micropolis_device::data_w ) +{ + if (m_data_count > 0) + { + /* put byte into buffer */ + if (VERBOSE_DATA) + logerror("micropolis_info buffered data: $%02X at offset %d.\n", data, m_data_offset); + + m_buffer[m_data_offset++] = data; + + if (--m_data_count < 1) + { + write_sector(); + + m_data_offset = 0; + } + } + else + { + if (VERBOSE) + logerror("%s: micropolis_data_w $%02X\n", space.machine().describe_context(), data); + } + m_data = data; +} + +READ8_MEMBER( micropolis_device::read ) +{ + UINT8 data = 0; + + switch (offset & 0x03) + { + case 0: data = status_r(space, 0); break; + case 1: data = status_r(space, 1); break; + case 2: + case 3: data = data_r(space, 0); break; + } + + return data; +} + +WRITE8_MEMBER( micropolis_device::write ) +{ + switch (offset & 0x03) + { + case 0: + case 1: command_w(space, 0, data); break; + case 2: + case 3: data_w(space, 0, data); break; + } +} diff --git a/src/mame/machine/micropolis.h b/src/mame/machine/micropolis.h new file mode 100644 index 00000000000..b7ef89dee2b --- /dev/null +++ b/src/mame/machine/micropolis.h @@ -0,0 +1,111 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/********************************************************************* + + micropolis.h + + Implementations of the Micropolis + floppy disk controller for the Sorcerer + +*********************************************************************/ + +#ifndef __MICROPOLIS_H__ +#define __MICROPOLIS_H__ + +#include "imagedev/flopdrv.h" + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +#define MCFG_MICROPOLIS_DRIVE_TAGS(_tag1, _tag2, _tag3, _tag4) \ + micropolis_device::set_drive_tags(*device, _tag1, _tag2, _tag3, _tag4); + +#define MCFG_MICROPOLIS_DEFAULT_DRIVE4_TAGS \ + MCFG_MICROPOLIS_DRIVE_TAGS(FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3) + +#define MCFG_MICROPOLIS_DDEN_CALLBACK(_read) \ + devcb = µpolis_device::set_dden_rd_callback(*device, DEVCB_##_read); + +#define MCFG_MICROPOLIS_INTRQ_CALLBACK(_write) \ + devcb = µpolis_device::set_intrq_wr_callback(*device, DEVCB_##_write); + +#define MCFG_MICROPOLIS_DRQ_CALLBACK(_write) \ + devcb = µpolis_device::set_drq_wr_callback(*device, DEVCB_##_write); + +/*************************************************************************** + MACROS +***************************************************************************/ + +class micropolis_device : public device_t +{ +public: + micropolis_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~micropolis_device() {} + + template static devcb_base &set_dden_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_dden.set_callback(object); } + template static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_intrq.set_callback(object); } + template static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_drq.set_callback(object); } + + static void set_drive_tags(device_t &device, const char *tag1, const char *tag2, const char *tag3, const char *tag4) + { + micropolis_device &dev = downcast(device); + dev.m_floppy_drive_tags[0] = tag1; + dev.m_floppy_drive_tags[1] = tag2; + dev.m_floppy_drive_tags[2] = tag3; + dev.m_floppy_drive_tags[3] = tag4; + } + + void set_drive(UINT8 drive); // set current drive (0-3) + + DECLARE_READ8_MEMBER( status_r ); + DECLARE_READ8_MEMBER( data_r ); + + DECLARE_WRITE8_MEMBER( command_w ); + DECLARE_WRITE8_MEMBER( data_w ); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + // internal state + + devcb_read_line m_read_dden; + devcb_write_line m_write_intrq; + devcb_write_line m_write_drq; + + const char *m_floppy_drive_tags[4]; + + /* register */ + UINT8 m_data; + UINT8 m_drive_num; + UINT8 m_track; + UINT8 m_sector; + UINT8 m_command; + UINT8 m_status; + + UINT8 m_write_cmd; /* last write command issued */ + + UINT8 m_buffer[6144]; /* I/O buffer (holds up to a whole track) */ + UINT32 m_data_offset; /* offset into I/O buffer */ + INT32 m_data_count; /* transfer count from/into I/O buffer */ + + UINT32 m_sector_length; /* sector length (byte) */ + + /* this is the drive currently selected */ + legacy_floppy_image_device *m_drive; + + void read_sector(); + void write_sector(); +}; + +extern const device_type MICROPOLIS; + + +#endif /* __MICROPOLIS_H__ */ diff --git a/src/mame/machine/microtan.c b/src/mame/machine/microtan.c new file mode 100644 index 00000000000..4fca3fe18ca --- /dev/null +++ b/src/mame/machine/microtan.c @@ -0,0 +1,855 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/****************************************************************************** + * Microtan 65 + * + * machine driver + * + * Juergen Buchmueller , Jul 2000 + * + * Thanks go to Geoff Macdonald + * for his site http:://www.geo255.redhotant.com + * and to Fabrice Frances + * for his site http://www.ifrance.com/oric/microtan.html + * + *****************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "includes/microtan.h" + +/* Components */ +#include "cpu/m6502/m6502.h" +#include "machine/6522via.h" +#include "machine/mos6551.h" +#include "sound/ay8910.h" + +/* Devices */ +#include "imagedev/cassette.h" +//#include "imagedev/snapquik.h" + + +#ifndef VERBOSE +#define VERBOSE 0 +#endif + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + + + + +static const char keyboard[8][9][8] = { + { /* normal */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0','-','=','`',127, 9}, + {'q','w','e','r','t','y','u','i'}, + {'o','p','[',']', 13,127, 0, 0}, + {'a','s','d','f','g','h','j','k'}, + {'l',';', 39, 92, 0,'z','x','c'}, + {'v','b','n','m',',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Shift */ + { 27,'!','@','#','$','%','^','&'}, + {'*','(',')','_','+','~',127, 9}, + {'Q','W','E','R','T','Y','U','I'}, + {'O','P','{','}', 13,127, 0, 0}, + {'A','S','D','F','G','H','J','K'}, + {'L',':','"','|', 0,'Z','X','C'}, + {'V','B','N','M','<','>','?', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Control */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0','-','=','`',127, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,';', 39, 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Shift+Control */ + { 27,'!', 0,'#','$','%', 30,'&'}, + {'*','(',')', 31,'+','~',127, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,':','"', 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* CapsLock */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0','-','=','`',127, 9}, + {'Q','W','E','R','T','Y','U','I'}, + {'O','P','[',']', 13,127, 0, 0}, + {'A','S','D','F','G','H','J','K'}, + {'L',';', 39, 92, 0,'Z','X','C'}, + {'V','B','N','M',',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Shift+CapsLock */ + { 27,'!','@','#','$','%','^','&'}, + {'*','(',')','_','+','~',127, 9}, + {'Q','W','E','R','T','Y','U','I'}, + {'O','P','{','}', 13,127, 0, 0}, + {'A','S','D','F','G','H','J','K'}, + {'L',':','"','|', 0,'Z','X','C'}, + {'V','B','N','M','<','>','?', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Control+CapsLock */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0','-','=','`',127, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,';', 39, 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Shift+Control+CapsLock */ + { 27,'!', 0,'#','$','%', 30,'&'}, + {'*','(',')', 31,'+','~',127, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,':','"', 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, +}; + +UINT8 microtan_state::read_dsw() +{ + UINT8 result; + switch(machine().phase()) + { + case MACHINE_PHASE_RESET: + case MACHINE_PHASE_RUNNING: + result = ioport("DSW")->read(); + break; + + default: + result = 0x00; + break; + } + return result; +} + +void microtan_state::microtan_set_irq_line() +{ + /* The 6502 IRQ line is active low and probably driven + by open collector outputs (guess). Since MAME/MESS use + a non-0 value for ASSERT_LINE we OR the signals here */ + m_maincpu->set_input_line(0, m_via_0_irq_line | m_via_1_irq_line | m_kbd_irq_line); +} + +/************************************************************** + * VIA callback functions for VIA #0 + **************************************************************/ +READ8_MEMBER(microtan_state::via_0_in_a) +{ + int data = ioport("JOY")->read(); + LOG(("microtan_via_0_in_a %02X\n", data)); + return data; +} + +WRITE8_MEMBER(microtan_state::via_0_out_a) +{ + LOG(("microtan_via_0_out_a %02X\n", data)); +} + +WRITE8_MEMBER(microtan_state::via_0_out_b) +{ + LOG(("microtan_via_0_out_b %02X\n", data)); + /* bit #7 is the cassette output signal */ + m_cassette->output(data & 0x80 ? +1.0 : -1.0); +} + +WRITE_LINE_MEMBER(microtan_state::via_0_out_ca2) +{ + LOG(("microtan_via_0_out_ca2 %d\n", state)); +} + +WRITE_LINE_MEMBER(microtan_state::via_0_out_cb2) +{ + LOG(("microtan_via_0_out_cb2 %d\n", state)); +} + +WRITE_LINE_MEMBER(microtan_state::via_0_irq) +{ + LOG(("microtan_via_0_irq %d\n", state)); + m_via_0_irq_line = state; + microtan_set_irq_line(); +} + +/************************************************************** + * VIA callback functions for VIA #1 + **************************************************************/ + +WRITE8_MEMBER(microtan_state::via_1_out_a) +{ + LOG(("microtan_via_1_out_a %02X\n", data)); +} + +WRITE8_MEMBER(microtan_state::via_1_out_b) +{ + LOG(("microtan_via_1_out_b %02X\n", data)); +} + +WRITE_LINE_MEMBER(microtan_state::via_1_out_ca2) +{ + LOG(("microtan_via_1_out_ca2 %d\n", state)); +} + +WRITE_LINE_MEMBER(microtan_state::via_1_out_cb2) +{ + LOG(("microtan_via_1_out_cb2 %d\n", state)); +} + +WRITE_LINE_MEMBER(microtan_state::via_1_irq) +{ + LOG(("microtan_via_1_irq %d\n", state)); + m_via_1_irq_line = state; + microtan_set_irq_line(); +} + +void microtan_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_READ_CASSETTE: + microtan_read_cassette(ptr, param); + break; + case TIMER_PULSE_NMI: + microtan_pulse_nmi(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in microtan_state::device_timer"); + } +} + + +TIMER_CALLBACK_MEMBER(microtan_state::microtan_read_cassette) +{ + double level = m_cassette->input(); + + LOG(("microtan_read_cassette: %g\n", level)); + if (level < -0.07) + m_via6522_0->write_cb2(0); + else if (level > +0.07) + m_via6522_0->write_cb2(1); +} + +READ8_MEMBER(microtan_state::microtan_sound_r) +{ + int data = 0xff; + LOG(("microtan_sound_r: -> %02x\n", data)); + return data; +} + +WRITE8_MEMBER(microtan_state::microtan_sound_w) +{ + LOG(("microtan_sound_w: <- %02x\n", data)); +} + + +READ8_MEMBER(microtan_state::microtan_bffx_r) +{ + int data = 0xff; + switch( offset & 3 ) + { + case 0: /* BFF0: read enables chunky graphics */ + m_chunky_graphics = 1; + LOG(("microtan_bff0_r: -> %02x (chunky graphics on)\n", data)); + break; + case 1: /* BFF1: read undefined (?) */ + LOG(("microtan_bff1_r: -> %02x\n", data)); + break; + case 2: /* BFF2: read undefined (?) */ + LOG(("microtan_bff2_r: -> %02x\n", data)); + break; + default: /* BFF3: read keyboard ASCII value */ + data = m_keyboard_ascii; + LOG(("microtan_bff3_r: -> %02x (keyboard ASCII)\n", data)); + } + return data; +} + + +/* This callback is called one clock cycle after BFF2 is written (delayed nmi) */ +TIMER_CALLBACK_MEMBER(microtan_state::microtan_pulse_nmi) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + +WRITE8_MEMBER(microtan_state::microtan_bffx_w) +{ + switch( offset & 3 ) + { + case 0: /* BFF0: write reset keyboard interrupt flag */ + /* This removes bit 7 from the ASCII value of the last key pressed. */ + LOG(("microtan_bff0_w: %d <- %02x (keyboard IRQ clear )\n", offset, data)); + m_keyboard_ascii &= ~0x80; + m_kbd_irq_line = CLEAR_LINE; + microtan_set_irq_line(); + break; + case 1: /* BFF1: write delayed NMI */ + LOG(("microtan_bff1_w: %d <- %02x (delayed NMI)\n", offset, data)); + timer_set(m_maincpu->cycles_to_attotime(8), TIMER_PULSE_NMI); + break; + case 2: /* BFF2: write keypad column write (what is this meant for?) */ + LOG(("microtan_bff2_w: %d <- %02x (keypad column)\n", offset, data)); + m_keypad_column = data; + break; + default: /* BFF3: write disable chunky graphics */ + LOG(("microtan_bff3_w: %d <- %02x (chunky graphics off)\n", offset, data)); + m_chunky_graphics = 0; + } +} + +void microtan_state::store_key(int key) +{ + LOG(("microtan: store key '%c'\n", key)); + m_keyboard_ascii = key | 0x80; + m_kbd_irq_line = ASSERT_LINE; + microtan_set_irq_line(); +} + +INTERRUPT_GEN_MEMBER(microtan_state::microtan_interrupt) +{ + int mod, row, col, chg, newvar; + static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" }; + + if( m_repeat ) + { + if( !--m_repeat ) + m_repeater = 4; + } + else if( m_repeater ) + { + m_repeat = m_repeater; + } + + + row = 9; + newvar = ioport("ROW8")->read(); + chg = m_keyrows[--row] ^ newvar; + + while ( !chg && row > 0) + { + newvar = ioport(keynames[row - 1])->read(); + chg = m_keyrows[--row] ^ newvar; + } + if (!chg) + --row; + + if (row >= 0) + { + m_repeater = 0x00; + m_mask = 0x00; + m_key = 0x00; + m_lastrow = row; + /* CapsLock LED */ + if( row == 3 && chg == 0x80 ) + set_led_status(machine(), 1, (m_keyrows[3] & 0x80) ? 0 : 1); + + if (newvar & chg) /* key(s) pressed ? */ + { + mod = 0; + + /* Shift modifier */ + if ( (m_keyrows[5] & 0x10) || (m_keyrows[6] & 0x80) ) + mod |= 1; + + /* Control modifier */ + if (m_keyrows[3] & 0x40) + mod |= 2; + + /* CapsLock modifier */ + if (m_keyrows[3] & 0x80) + mod |= 4; + + /* find newvar key */ + m_mask = 0x01; + for (col = 0; col < 8; col ++) + { + if (chg & m_mask) + { + newvar &= m_mask; + m_key = keyboard[mod][row][col]; + break; + } + m_mask <<= 1; + } + if( m_key ) /* normal key */ + { + m_repeater = 30; + store_key(m_key); + } + else + if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */ + store_key(0); + m_keyrows[row] |= newvar; + } + else + { + m_keyrows[row] = newvar; + } + m_repeat = m_repeater; + } + else + if ( m_key && (m_keyrows[m_lastrow] & m_mask) && m_repeat == 0 ) + { + store_key(m_key); + } +} + +DRIVER_INIT_MEMBER(microtan_state,microtan) +{ + UINT8 *dst = memregion("gfx2")->base(); + int i; + address_space &space = m_maincpu->space(AS_PROGRAM); + + for (i = 0; i < 256; i++) + { + switch (i & 3) + { + case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; + case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; + case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; + case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; + } + dst += 4; + switch ((i >> 2) & 3) + { + case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; + case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; + case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; + case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; + } + dst += 4; + switch ((i >> 4) & 3) + { + case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; + case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; + case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; + case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; + } + dst += 4; + switch ((i >> 6) & 3) + { + case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; + case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; + case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; + case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; + } + dst += 4; + } + + switch (read_dsw() & 3) + { + case 0: // 1K only :) + space.nop_readwrite(0x0400, 0xbbff); + break; + case 1: // +7K TANEX + space.install_ram(0x0400, 0x1fff,NULL); + space.nop_readwrite(0x2000, 0xbbff); + break; + default: // +7K TANEX + 40K TANRAM + space.install_ram(0x0400, 0xbbff, NULL); + break; + } + + m_timer = timer_alloc(TIMER_READ_CASSETTE); + + m_via6522_0->write_ca1(1); + m_via6522_0->write_ca2(1); + + m_via6522_0->write_pb0(1); + m_via6522_0->write_pb1(1); + m_via6522_0->write_pb2(1); + m_via6522_0->write_pb3(1); + m_via6522_0->write_pb4(1); + m_via6522_0->write_pb5(1); + m_via6522_0->write_pb6(1); + m_via6522_0->write_pb7(1); + m_via6522_0->write_cb1(1); + m_via6522_0->write_cb2(1); + + m_via6522_1->write_pa0(1); + m_via6522_1->write_pa1(1); + m_via6522_1->write_pa2(1); + m_via6522_1->write_pa3(1); + m_via6522_1->write_pa4(1); + m_via6522_1->write_pa5(1); + m_via6522_1->write_pa6(1); + m_via6522_1->write_pa7(1); + m_via6522_1->write_ca1(1); + m_via6522_1->write_ca2(1); + + m_via6522_1->write_pb0(1); + m_via6522_1->write_pb1(1); + m_via6522_1->write_pb2(1); + m_via6522_1->write_pb3(1); + m_via6522_1->write_pb4(1); + m_via6522_1->write_pb5(1); + m_via6522_1->write_pb6(1); + m_via6522_1->write_pb7(1); + m_via6522_1->write_cb1(1); + m_via6522_1->write_cb2(1); +} + +void microtan_state::machine_reset() +{ + int i; + static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" }; + + for (i = 1; i < 10; i++) + { + m_keyrows[i] = ioport(keynames[i-1])->read(); + } + set_led_status(machine(), 1, (m_keyrows[3] & 0x80) ? 0 : 1); +} + +int microtan_state::microtan_verify_snapshot(UINT8 *data, int size) +{ + if (size == 8263) + { + logerror("microtan_snapshot_id: magic size %d found\n", size); + return IMAGE_VERIFY_PASS; + } + else + { + if (4 + data[2] + 256 * data[3] + 1 + 16 + 16 + 16 + 1 + 1 + 16 + 16 + 64 + 7 == size) + { + logerror("microtan_snapshot_id: header RAM size + structures matches filesize %d\n", size); + return IMAGE_VERIFY_PASS; + } + } + + return IMAGE_VERIFY_FAIL; +} + +int microtan_state::parse_intel_hex(UINT8 *snapshot_buff, char *src) +{ + char line[128]; + int /*row = 0,*/ column = 0, last_addr = 0, last_size = 0; + + while (*src) + { + if (*src == '\r' || *src == '\n') + { + if (column) + { + unsigned int size, addr, null, b[32], cs, n; + + line[column] = '\0'; + /*row++;*/ + n = sscanf(line, ":%02x%04x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + &size, &addr, &null, + &b[ 0], &b[ 1], &b[ 2], &b[ 3], &b[ 4], &b[ 5], &b[ 6], &b[ 7], + &b[ 8], &b[ 9], &b[10], &b[11], &b[12], &b[13], &b[14], &b[15], + &b[16], &b[17], &b[18], &b[19], &b[20], &b[21], &b[22], &b[23], + &b[24], &b[25], &b[26], &b[27], &b[28], &b[29], &b[30], &b[31], + &cs); + if (n == 0) + { + logerror("parse_intel_hex: malformed line [%s]\n", line); + } + else if (n == 1) + { + logerror("parse_intel_hex: only size found [%s]\n", line); + } + else if (n == 2) + { + logerror("parse_intel_hex: only size and addr found [%s]\n", line); + } + else if (n == 3) + { + logerror("parse_intel_hex: only size, addr and null found [%s]\n", line); + } + else + if (null != 0) + { + logerror("parse_intel_hex: warning null byte is != 0 [%s]\n", line); + } + else + { + int i, sum; + + n -= 3; + + sum = size + (addr & 0xff) + ((addr >> 8) & 0xff); + if (n != 32 + 1) + cs = b[n-1]; + + last_addr = addr; + last_size = n-1; + logerror("parse_intel_hex: %04X", addr); + for (i = 0; i < n-1; i++) + { + sum += b[i]; + snapshot_buff[addr++] = b[i]; + } + logerror("-%04X checksum %02X+%02X = %02X\n", addr-1, cs, sum & 0xff, (cs + sum) & 0xff); + } + } + column = 0; + } + else + { + line[column++] = *src; + } + src++; + } + /* register preset? */ + if (last_size == 7) + { + logerror("parse_intel_hex: registers (?) at %04X\n", last_addr); + memcpy(&snapshot_buff[8192+64], &snapshot_buff[last_addr], last_size); + } + return IMAGE_INIT_PASS; +} + +int microtan_state::parse_zillion_hex(UINT8 *snapshot_buff, char *src) +{ + char line[128]; + int parsing = 0, /*row = 0,*/ column = 0; + + while (*src) + { + if (parsing) + { + if (*src == '}') + parsing = 0; + else + { + if (*src == '\r' || *src == '\n') + { + if (column) + { + unsigned int addr, b[8], n; + + line[column] = '\0'; + /*row++;*/ + n = sscanf(line, "%x %x %x %x %x %x %x %x %x", &addr, &b[0], &b[1], &b[2], &b[3], &b[4], &b[5], &b[6], &b[7]); + if (n == 0) + { + logerror("parse_zillion_hex: malformed line [%s]\n", line); + } + else if (n == 1) + { + logerror("parse_zillion_hex: only addr found [%s]\n", line); + } + else + { + int i; + + logerror("parse_zillion_hex: %04X", addr); + for (i = 0; i < n-1; i++) + snapshot_buff[addr++] = b[i]; + logerror("-%04X\n", addr-1); + } + } + column = 0; + } + else + { + line[column++] = *src; + } + } + } + else + { + if (*src == '\r' || *src == '\n') + { + if (column) + { + int addr, n; + + /*row++;*/ + line[column] = '\0'; + n = sscanf(line, "G%x", (unsigned int *) &addr); + if (n == 1 && !snapshot_buff[8192+64+0] && !snapshot_buff[8192+64+1]) + { + logerror("microtan_hexfile_init: go addr %04X\n", addr); + snapshot_buff[8192+64+0] = addr & 0xff; + snapshot_buff[8192+64+1] = (addr >> 8) & 0xff; + } + } + column = 0; + } + else + { + line[column++] = *src; + } + if (*src == '{') + { + parsing = 1; + column = 0; + } + } + src++; + } + return IMAGE_INIT_PASS; +} + +void microtan_state::microtan_set_cpu_regs(const UINT8 *snapshot_buff, int base) +{ + logerror("microtan_snapshot_copy: PC:%02X%02X P:%02X A:%02X X:%02X Y:%02X SP:1%02X", + snapshot_buff[base+1], snapshot_buff[base+0], snapshot_buff[base+2], snapshot_buff[base+3], + snapshot_buff[base+4], snapshot_buff[base+5], snapshot_buff[base+6]); + m_maincpu->set_state_int(M6502_PC, snapshot_buff[base+0] + 256 * snapshot_buff[base+1]); + m_maincpu->set_state_int(M6502_P, snapshot_buff[base+2]); + m_maincpu->set_state_int(M6502_A, snapshot_buff[base+3]); + m_maincpu->set_state_int(M6502_X, snapshot_buff[base+4]); + m_maincpu->set_state_int(M6502_Y, snapshot_buff[base+5]); + m_maincpu->set_state_int(M6502_S, snapshot_buff[base+6]); +} + +void microtan_state::microtan_snapshot_copy(UINT8 *snapshot_buff, int snapshot_size) +{ + UINT8 *RAM = memregion("maincpu")->base(); + address_space &space = m_maincpu->space(AS_PROGRAM); + ay8910_device *ay8910 = machine().device("ay8910.1"); + + /* check for .DMP file format */ + if (snapshot_size == 8263) + { + int i, base; + /********** DMP format + * Lower 8k of RAM (0000 to 1fff) + * 64 bytes of chunky graphics bits (first byte bit is for character at 0200, bit 1=0201, etc) + * 7 bytes of CPU registers (PCL, PCH, PSW, A, IX, IY, SP) + */ + logerror("microtan_snapshot_copy: magic size %d found, assuming *.DMP format\n", snapshot_size); + + base = 0; + /* 8K of RAM from 0000 to 1fff */ + memcpy(RAM, &snapshot_buff[base], 8192); + base += 8192; + /* 64 bytes of chunky graphics info */ + for (i = 0; i < 32*16; i++) + { + m_chunky_buffer[i] = (snapshot_buff[base+i/8] >> (i&7)) & 1; + } + base += 64; + microtan_set_cpu_regs(snapshot_buff, base); + } + else + { + int i, ramend, base; + /********** M65 format ************************************ + * 2 bytes: File version + * 2 bytes: RAM size + * n bytes: RAM (0000 to RAM Size) + * 16 bytes: 1st 6522 (0xbfc0 to 0xbfcf) + * 16 bytes: 2ns 6522 (0xbfe0 to 0xbfef) + * 16 bytes: Microtan IO (0xbff0 to 0xbfff) + * 1 byte : Invaders sound (0xbc04) + * 1 byte : Chunky graphics state (0=off, 1=on) + * 16 bytes: 1st AY8910 registers + * 16 bytes: 2nd AY8910 registers + * 64 bytes: Chunky graphics bits (first byte bit 0 is for character at 0200, bit 1=0201, etc) + * 7 bytes: CPU registers (PCL, PCH, PSW, A, IX, IY, SP) + */ + ramend = snapshot_buff[2] + 256 * snapshot_buff[3]; + if (2 + 2 + ramend + 1 + 16 + 16 + 16 + 1 + 1 + 16 + 16 + 64 + 7 != snapshot_size) + { + logerror("microtan_snapshot_copy: size %d doesn't match RAM size %d + structure size\n", snapshot_size, ramend+1); + return; + } + + logerror("microtan_snapshot_copy: size %d found, assuming *.M65 format\n", snapshot_size); + base = 4; + memcpy(RAM, &snapshot_buff[base], snapshot_buff[2] + 256 * snapshot_buff[3] + 1); + base += ramend + 1; + + /* first set of VIA6522 registers */ + for (i = 0; i < 16; i++ ) + m_via6522_0->write(space, i, snapshot_buff[base++]); + + /* second set of VIA6522 registers */ + for (i = 0; i < 16; i++ ) + m_via6522_1->write(space, i, snapshot_buff[base++]); + + /* microtan IO bff0-bfff */ + for (i = 0; i < 16; i++ ) + { + RAM[0xbff0+i] = snapshot_buff[base++]; + if (i < 4) + microtan_bffx_w(space, i, RAM[0xbff0+i]); + } + + microtan_sound_w(space, 0, snapshot_buff[base++]); + m_chunky_graphics = snapshot_buff[base++]; + + /* first set of AY8910 registers */ + for (i = 0; i < 16; i++ ) + { + ay8910->address_w(generic_space(), 0, i); + ay8910->data_w(generic_space(), 0, snapshot_buff[base++]); + } + + /* second set of AY8910 registers */ + for (i = 0; i < 16; i++ ) + { + ay8910->address_w(generic_space(), 0, i); + ay8910->data_w(generic_space(), 0, snapshot_buff[base++]); + } + + for (i = 0; i < 32*16; i++) + { + m_chunky_buffer[i] = (snapshot_buff[base+i/8] >> (i&7)) & 1; + } + base += 64; + + microtan_set_cpu_regs(snapshot_buff, base); + } +} + +SNAPSHOT_LOAD_MEMBER( microtan_state, microtan ) +{ + UINT8 *snapshot_buff; + + snapshot_buff = (UINT8*)image.ptr(); + if (!snapshot_buff) + return IMAGE_INIT_FAIL; + + if (microtan_verify_snapshot(snapshot_buff, snapshot_size)==IMAGE_VERIFY_FAIL) + return IMAGE_INIT_FAIL; + + microtan_snapshot_copy(snapshot_buff, snapshot_size); + return IMAGE_INIT_PASS; +} + +QUICKLOAD_LOAD_MEMBER( microtan_state, microtan ) +{ + int snapshot_size = 8263; /* magic size */ + dynamic_buffer snapshot_buff(snapshot_size, 0); + std::vector buff(quickload_size + 1); + int rc; + + image.fread(&buff[0], quickload_size); + + buff[quickload_size] = '\0'; + + if (buff[0] == ':') + rc = parse_intel_hex(&snapshot_buff[0], &buff[0]); + else + rc = parse_zillion_hex(&snapshot_buff[0], &buff[0]); + if (rc == IMAGE_INIT_PASS) + microtan_snapshot_copy(&snapshot_buff[0], snapshot_size); + return rc; +} diff --git a/src/mame/machine/mikro80.c b/src/mame/machine/mikro80.c new file mode 100644 index 00000000000..30eea2124bf --- /dev/null +++ b/src/mame/machine/mikro80.c @@ -0,0 +1,105 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Mikro-80 machine driver by Miodrag Milanovic + + 10/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "includes/mikro80.h" + +/* Driver initialization */ +DRIVER_INIT_MEMBER(mikro80_state,mikro80) +{ + /* set initialy ROM to be visible on first bank */ + UINT8 *RAM = m_region_maincpu->base(); + memset(RAM,0x0000,0x0800); // make frist page empty by default + m_bank1->configure_entries(1, 2, RAM, 0x0000); + m_bank1->configure_entries(0, 2, RAM, 0xf800); + m_key_mask = 0x7f; +} + +DRIVER_INIT_MEMBER(mikro80_state,radio99) +{ + DRIVER_INIT_CALL(mikro80); + m_key_mask = 0xff; +} + +READ8_MEMBER(mikro80_state::mikro80_8255_portb_r) +{ + UINT8 key = 0xff; + if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_line0->read(); } + if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_line1->read(); } + if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_line2->read(); } + if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_line3->read(); } + if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_line4->read(); } + if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_line5->read(); } + if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_line6->read(); } + if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_line7->read(); } + return key & m_key_mask; +} + +READ8_MEMBER(mikro80_state::mikro80_8255_portc_r) +{ + return m_io_line8->read(); +} + +WRITE8_MEMBER(mikro80_state::mikro80_8255_porta_w) +{ + m_keyboard_mask = data ^ 0xff; +} + +WRITE8_MEMBER(mikro80_state::mikro80_8255_portc_w) +{ +} + +void mikro80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_RESET: + m_bank1->set_entry(0); + break; + default: + assert_always(FALSE, "Unknown id in mikro80_state::device_timer"); + } +} + +void mikro80_state::machine_reset() +{ + timer_set(attotime::from_usec(10), TIMER_RESET); + m_bank1->set_entry(1); + m_keyboard_mask = 0; +} + + +READ8_MEMBER(mikro80_state::mikro80_keyboard_r) +{ + return m_ppi8255->read(space, offset^0x03); +} + +WRITE8_MEMBER(mikro80_state::mikro80_keyboard_w) +{ + m_ppi8255->write(space, offset^0x03, data); +} + + +WRITE8_MEMBER(mikro80_state::mikro80_tape_w) +{ + m_cassette->output(data & 0x01 ? 1 : -1); +} + + +READ8_MEMBER(mikro80_state::mikro80_tape_r) +{ + double level = m_cassette->input(); + if (level < 0) { + return 0x00; + } + return 0xff; +} diff --git a/src/mame/machine/mm1kb.c b/src/mame/machine/mm1kb.c new file mode 100644 index 00000000000..3b74ca8650d --- /dev/null +++ b/src/mame/machine/mm1kb.c @@ -0,0 +1,298 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Nokia MikroMikko 1 keyboard emulation + +*********************************************************************/ + +#include "mm1kb.h" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type MM1_KEYBOARD = &device_creator; + + +//------------------------------------------------- +// ROM( mm1_keyboard ) +//------------------------------------------------- + +ROM_START( mm1_keyboard ) + ROM_REGION( 0x200, "keyboard", 0 ) + ROM_LOAD( "mmi6349-1j.bin", 0x0000, 0x0200, CRC(4ab3bf03) SHA1(925c9ee22db13566416cdbc505c03d4116ff8d5f) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *mm1_keyboard_t::device_rom_region() const +{ + return ROM_NAME( mm1_keyboard ); +} + + +//------------------------------------------------- +// MACHINE_DRIVER( mm1_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( mm1_keyboard ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor mm1_keyboard_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( mm1_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( mm1_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( mm1_keyboard ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC2\xB4 '") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00B4) PORT_CHAR('`') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x96") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_RING " " A_RING) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('~') PORT_CHAR('^') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LF") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') PORT_CHAR('*') + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_UMLAUT " " A_UMLAUT) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(o_UMLAUT " " O_UMLAUT) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + + PORT_START("SPECIAL") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor mm1_keyboard_t::device_input_ports() const +{ + return INPUT_PORTS_NAME( mm1_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// mm1_keyboard_t - constructor +//------------------------------------------------- + +mm1_keyboard_t::mm1_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, MM1_KEYBOARD, "MikroMikko 1 keyboard", tag, owner, clock, "mm1kb", __FILE__), + m_write_kbst(*this), + m_speaker(*this, "speaker"), + m_rom(*this, "keyboard"), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_special(*this, "SPECIAL"), + m_sense(0), + m_drive(0), + m_data(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mm1_keyboard_t::device_start() +{ + // resolve callbacks + m_write_kbst.resolve_safe(); + + // allocate timers + m_scan_timer = timer_alloc(); + m_scan_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + + // state saving + save_item(NAME(m_sense)); + save_item(NAME(m_drive)); + save_item(NAME(m_data)); +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void mm1_keyboard_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + UINT8 data = 0xff; + + switch (m_drive) + { + case 0: data = m_y0->read(); break; + case 1: data = m_y1->read(); break; + case 2: data = m_y2->read(); break; + case 3: data = m_y3->read(); break; + case 4: data = m_y4->read(); break; + case 5: data = m_y5->read(); break; + case 6: data = m_y6->read(); break; + case 7: data = m_y7->read(); break; + case 8: data = m_y8->read(); break; + case 9: data = m_y9->read(); break; + } + + UINT8 special = m_special->read(); + int ctrl = BIT(special, 0); + int shift = BIT(special, 2) & BIT(special, 1); + UINT8 keydata = 0xff; + + if (!BIT(data, m_sense)) + { + // get key data from PROM + keydata = m_rom->base()[(ctrl << 8) | (shift << 7) | (m_drive << 3) | (m_sense)]; + } + + if (m_data != keydata) + { + // latch key data + m_data = keydata; + + if (keydata != 0xff) + { + // strobe in key data + m_write_kbst(1); + m_write_kbst(0); + } + } + + if (keydata == 0xff) + { + // increase scan counters + m_sense++; + + if (m_sense == 8) + { + m_sense = 0; + m_drive++; + + if (m_drive == 10) + { + m_drive = 0; + } + } + } +} diff --git a/src/mame/machine/mm1kb.h b/src/mame/machine/mm1kb.h new file mode 100644 index 00000000000..00e8ddebf73 --- /dev/null +++ b/src/mame/machine/mm1kb.h @@ -0,0 +1,86 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Nokia MikroMikko 1 keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __MM1_KEYBOARD__ +#define __MM1_KEYBOARD__ + +#include "emu.h" +#include "sound/speaker.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_MM1_KEYBOARD_KBST_CALLBACK(_write) \ + devcb = &mm1_keyboard_t::set_kbst_wr_callback(*device, DEVCB_##_write); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> mm1_keyboard_t + +class mm1_keyboard_t : public device_t +{ +public: + // construction/destruction + mm1_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_kbst_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_kbst.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_READ8_MEMBER( read ) { return m_data; } + + DECLARE_WRITE_LINE_MEMBER( bell_w ) { m_speaker->level_w(state); } + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + devcb_write_line m_write_kbst; + + required_device m_speaker; + required_memory_region m_rom; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_special; + + int m_sense; + int m_drive; + UINT8 m_data; + + emu_timer *m_scan_timer; +}; + + +// device type definition +extern const device_type MM1_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/ms7004.c b/src/mame/machine/ms7004.c new file mode 100644 index 00000000000..bacd74a303a --- /dev/null +++ b/src/mame/machine/ms7004.c @@ -0,0 +1,500 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/* + Electronika MS 7004 keyboard (DEC LK-201 workalike with extra keys + for Cyrillic characters). + + To do: + - debug keymap + - receive data from host (not used by KSM but used by other boards) + - connect LEDs and speaker +*/ + +#include "emu.h" +#include "ms7004.h" + +#define VERBOSE_DBG 1 /* general debug messages */ + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \ + logerror A; \ + } \ + } while (0) + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define MS7004_CPU_TAG "i8048" +#define MS7004_SPK_TAG "beeper" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type MS7004 = &device_creator; + +ROM_START( ms7004 ) + ROM_REGION (0x800, MS7004_CPU_TAG, 0) + ROM_LOAD ("mc7004_keyboard_original.rom", 0x0000, 0x800, CRC(69fcab53) SHA1(2d7cc7cd182f2ee09ecf2c539e33db3c2195f778)) +ROM_END + +//------------------------------------------------- +// ADDRESS_MAP +//------------------------------------------------- + +static ADDRESS_MAP_START( ms7004_map, AS_IO, 8, ms7004_device ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) + AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w) +ADDRESS_MAP_END + +//------------------------------------------------- +// MACHINE_CONFIG +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( ms7004 ) + MCFG_CPU_ADD(MS7004_CPU_TAG, I8048, XTAL_4_608MHz) + MCFG_CPU_IO_MAP(ms7004_map) + + MCFG_I8243_ADD("i8243", NOOP, WRITE8(ms7004_device, i8243_port_w)) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(MS7004_SPK_TAG, BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor ms7004_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( ms7004 ); +} + +const rom_entry *ms7004_device::device_rom_region() const +{ + return ROM_NAME( ms7004 ); +} + +//------------------------------------------------- +// INPUT_PORTS( ms7004 ) +//------------------------------------------------- +/* +bit sig XSn ????n +--- --- --- --- +0 8 16 15 +1 9 15 14 +2 10 14 13 +3 11 13 12 +4 12 19 16 +5 13 12 11 +6 14 11 10 +7 15 10 9 +8 16 9 8 +9 17 8 7 +10 18 7 6 +11 19 6 5 +12 20 3 1 +13 21 1 2 +14 22 4 3 +15 23 5 4 + +0xc9 KEY_LANGLE_RANGLE '?????????????????? ??????????????' +0xbc KEY_DELETE ???? +0xbd KEY_RETURN ???? +0xbf KEY_TILDE '; +' +0xc4 - '??' +0xca - '/ ?' +0xed KEY_PERIOD '?? @' +0xf1 - '_' +<...> + +0x56 KEY_F1 ???????? ???????? +0x57 KEY_F2 ???????????? ?????????? +0x58 KEY_F3 ?????????? +0x59 KEY_F4 ?????? ???????????? +0x5a KEY_F5 ??5 + +0x64 KEY_F6 ???????????? +0x65 KEY_F7 ?????????????? +0x66 KEY_F8 ?????????? +0x67 KEY_F9 ???????????? ???????? +0x69 KEY_F10 ?????????? + +0x71 KEY_F11 ??11 (????2) +0x72 KEY_F12 ??12 (????) +0x73 KEY_F13 ??13 (????) +0x74 KEY_F14 ?????? ?????????????? + +0x7c KEY_HELP ???? +0x7d KEY_MENU ?????? + +0x80 KEY_F17 ??17 +0x81 KEY_F18 ??18 +0x82 KEY_F19 ??19 +0x83 KEY_F20 ??20 + +0xb0 KEY_LOCK ?????? +0xae KEY_SHIFT ???? +0xaf KEY_CTRL ???? + +0xb1 KEY_META ?????? +0xb2 - ??????/?????? + +0x8a KEY_FIND ???? +0x8b KEY_INSERT_HERE ?????? +0x8c KEY_REMOVE ???????? +0x8d KEY_SELECT ???????? +0x8e KEY_PREV_SCREEN ???????? ???????? +0x8f KEY_NEXT_SCREEN ???????? ???????? + +nothing sends '@' or '`' + +`/~ sends ^/~ +2/@ sends 2/" +6/^ sends 6/& +7/& sends 7/' +8/ * sends 8/( +9/( sends 9/) +0/) sends 0/0 +-/_ sends _/_ ++/= sends -/= +;/: sends ;/+ +'/" sends :/ * + +F10 sends ^C +F11 sends ESC +F12 sends ^H +*/ +INPUT_PORTS_START( ms7004 ) + PORT_START("KBD12") // vertical row 1 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Print Screen (F2)") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Hold Screen (F1)") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // '{' / '|' + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) // '+' + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) // what + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) + + PORT_START("KBD13") // vertical row 2 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Setup (F3)") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Data / Talk (F4)") PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_ESC) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Compose") PORT_CODE(KEYCODE_LALT) + + PORT_START("KBD14") // vertical row 3 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break (F5)") PORT_CODE(KEYCODE_F5) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tilde") PORT_CODE(KEYCODE_TILDE) // ^ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD15") // vertical row 4 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD11") // vertical row 5 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Interrupt (F6)") PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("KBD10") // vertical row 6 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Resume (F7)") PORT_CODE(KEYCODE_F7) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + + PORT_START("KBD9") // vertical row 7 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cancel (F8)") PORT_CODE(KEYCODE_F8) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Main Screen (F9)") PORT_CODE(KEYCODE_F9) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) + + PORT_START("KBD8") // vertical row 8 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Exit (F10)") PORT_CODE(KEYCODE_F10) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) // '@' + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) + + PORT_START("KBD7") // vertical row 9 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC (F11)") PORT_CODE(KEYCODE_F11) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) + + PORT_START("KBD6") // vertical row 10 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS (F12)") PORT_CODE(KEYCODE_F12) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LF (F13)") PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // '}' + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) // ':' + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) // '??' + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + + PORT_START("KBD5") // vertical row 11 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Additional Options (F14)") PORT_CODE(KEYCODE_PAUSE) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete i8243_p2_w(space, offset, data); +} + + +//------------------------------------------------- +// prog_w - +//------------------------------------------------- + +WRITE8_MEMBER( ms7004_device::i8243_port_w ) +{ + int sense = 0; + + DBG_LOG(2,0,( "%s: 8243 port %d data %02xH\n", + tag(), offset + 4, data)); + + if (data) { + switch(offset << 4 | data) { + case 0x01: sense = m_kbd0->read(); break; + case 0x02: sense = m_kbd1->read(); break; + case 0x04: sense = m_kbd2->read(); break; + case 0x08: sense = m_kbd3->read(); break; + case 0x11: sense = m_kbd4->read(); break; + case 0x12: sense = m_kbd5->read(); break; + case 0x14: sense = m_kbd6->read(); break; + case 0x18: sense = m_kbd7->read(); break; + case 0x21: sense = m_kbd8->read(); break; + case 0x22: sense = m_kbd9->read(); break; + case 0x24: sense = m_kbd10->read(); break; + case 0x28: sense = m_kbd11->read(); break; + case 0x31: sense = m_kbd12->read(); break; + case 0x32: sense = m_kbd13->read(); break; + case 0x34: sense = m_kbd14->read(); break; + case 0x38: sense = m_kbd15->read(); break; + } + m_keylatch = BIT(sense, (m_p1 & 7)); + DBG_LOG(2,0,( "%s: row %d col %02x t1 %d\n", + tag(), (m_p1 & 7), (offset << 4 | data), m_keylatch)); + } +} + + +//------------------------------------------------- +// t1_r - +//------------------------------------------------- + +READ8_MEMBER( ms7004_device::t1_r ) +{ + if (!BIT(m_p1,4)) + return m_keylatch; + else + return 0; +} diff --git a/src/mame/machine/ms7004.h b/src/mame/machine/ms7004.h new file mode 100644 index 00000000000..bf0dd1a3aee --- /dev/null +++ b/src/mame/machine/ms7004.h @@ -0,0 +1,85 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +#pragma once + +#ifndef __MS7004_H__ +#define __MS7004_H__ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/i8243.h" +#include "sound/beep.h" + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_MS7004_TX_HANDLER(_cb) \ + devcb = &ms7004_device::set_tx_handler(*device, DEVCB_##_cb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> ms7004_device + +class ms7004_device : public device_t //, public device_serial_interface +{ +public: + // construction/destruction + ms7004_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_tx_handler(device_t &device, _Object wr) { return downcast(device).m_tx_handler.set_callback(wr); } + + DECLARE_WRITE8_MEMBER( p1_w ); + DECLARE_WRITE8_MEMBER( p2_w ); + DECLARE_READ8_MEMBER( t1_r ); + DECLARE_WRITE8_MEMBER( i8243_port_w ); + +protected: + // device-level overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + virtual ioport_constructor device_input_ports() const; + virtual void device_start(); + virtual void device_reset(); + +private: + required_device m_maincpu; + required_device m_speaker; + required_device m_i8243; + + required_ioport m_kbd0; + required_ioport m_kbd1; + required_ioport m_kbd2; + required_ioport m_kbd3; + required_ioport m_kbd4; + required_ioport m_kbd5; + required_ioport m_kbd6; + required_ioport m_kbd7; + required_ioport m_kbd8; + required_ioport m_kbd9; + required_ioport m_kbd10; + required_ioport m_kbd11; + required_ioport m_kbd12; + required_ioport m_kbd13; + required_ioport m_kbd14; + required_ioport m_kbd15; + + int m_keylatch; // keyboard row latch + UINT8 m_p1; + UINT8 m_p2; + + devcb_write_line m_tx_handler; +}; + +// device type definition +extern const device_type MS7004; + +#endif diff --git a/src/mame/machine/msx.c b/src/mame/machine/msx.c new file mode 100644 index 00000000000..92add704ebe --- /dev/null +++ b/src/mame/machine/msx.c @@ -0,0 +1,531 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/* + * msx.c: MSX emulation + * + * Copyright (C) 2004 Sean Young + * + * Todo: + * + * - fix mouse support + * - cassette support doesn't work + * - Ensure changing cartridge after boot works + * - wd2793, nms8255 + */ + +#include "includes/msx.h" + +#define VERBOSE 0 + + +void msx_state::msx_irq_source(int source, int level) +{ + assert(source >= 0 && source < ARRAY_LENGTH(m_irq_state)); + + m_irq_state[source] = level; + check_irq(); +} + + +void msx_state::check_irq() +{ + int state = CLEAR_LINE; + + for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + { + if (m_irq_state[i] != CLEAR_LINE) + { + state = ASSERT_LINE; + } + } + + m_maincpu->set_input_line(0, state); +} + + +void msx_state::machine_reset() +{ + msx_memory_reset (); + msx_memory_map_all (); + for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + { + m_irq_state[i] = CLEAR_LINE; + } + check_irq(); +} + + +void msx_state::machine_start() +{ + m_port_c_old = 0xff; +} + + +static const UINT8 cc_op[0x100] = { + 4+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, 4+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, + 8+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,12+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, + 7+1,10+1,16+1, 6+1, 4+1, 4+1, 7+1, 4+1, 7+1,11+1,16+1, 6+1, 4+1, 4+1, 7+1, 4+1, + 7+1,10+1,13+1, 6+1,11+1,11+1,10+1, 4+1, 7+1,11+1,13+1, 6+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 7+1, 7+1, 7+1, 7+1, 7+1, 7+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 5+1,10+1,10+1,10+1,10+1,11+1, 7+1,11+1, 5+1,10+1,10+1, 0 ,10+1,17+1, 7+1,11+1, + 5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 0 , 7+1,11+1, + 5+1,10+1,10+1,19+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1, 4+1,10+1, 0 , 7+1,11+1, + 5+1,10+1,10+1, 4+1,10+1,11+1, 7+1,11+1, 5+1, 6+1,10+1, 4+1,10+1, 0 , 7+1,11+1 +}; + +static const UINT8 cc_cb[0x100] = { + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2 +}; + +static const UINT8 cc_ed[0x100] = { + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, +12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2, +12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2, +12+2,12+2,15+2,20+2, 8+2,14+2, 8+2,18+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2,18+2, +12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 8+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, +16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2,16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2, +16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2,16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2 +}; + +static const UINT8 cc_xy[0x100] = { + 4+4+2,10+4+2, 7+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, 4+4+2,11+4+2, 7+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, + 8+4+2,10+4+2, 7+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2,12+4+2,11+4+2, 7+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, + 7+4+2,10+4+2,16+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, 7+4+2,11+4+2,16+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, + 7+4+2,10+4+2,13+4+2, 6+4+2,23 +2,23 +2,19 +2, 4+4+2, 7+4+2,11+4+2,13+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, + 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, + 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, + 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, +19 +2,19 +2,19 +2,19 +2,19 +2,19 +2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, + 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, + 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, + 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, + 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, + 5+4+2,10+4+2,10+4+2,10+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2,10+4+2,10+4+2, 0 ,10+4+2,17+4+2, 7+4+2,11+4+2, + 5+4+2,10+4+2,10+4+2,11+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 4+4+2,10+4+2,11+4+2,10+4+2, 4 +1, 7+4+2,11+4+2, + 5+4+2,10+4+2,10+4+2,19+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 4+4+2,10+4+2, 4+4+2,10+4+2, 4 +1, 7+4+2,11+4+2, + 5+4+2,10+4+2,10+4+2, 4+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 6+4+2,10+4+2, 4+4+2,10+4+2, 4 +1, 7+4+2,11+4+2 +}; + +static const UINT8 cc_xycb[0x100] = { +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, +20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, +20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, +20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2 +}; + +/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */ +static const UINT8 cc_ex[0x100] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DJNZ */ + 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NZ/JR Z */ + 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NC/JR C */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, /* LDIR/CPIR/INIR/OTIR LDDR/CPDR/INDR/OTDR */ + 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, + 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, + 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, + 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2+1 +}; + + +void msx_state::driver_start() +{ + m_maincpu->set_input_line_vector(0, 0xff); + + msx_memory_init(); + + m_maincpu->z80_set_cycle_tables( cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex ); + + save_item(NAME(m_psg_b)); + save_item(NAME(m_mouse)); + save_item(NAME(m_mouse_stat)); + save_item(NAME(m_rtc_latch)); + save_item(NAME(m_kanji_latch)); + save_item(NAME(m_slot_expanded)); + save_item(NAME(m_primary_slot)); + save_item(NAME(m_secondary_slot)); + save_item(NAME(m_port_c_old)); + save_item(NAME(m_keylatch)); + save_item(NAME(m_current_switched_device)); + save_item(NAME(m_irq_state)); + + machine().save().register_postload(save_prepost_delegate(FUNC(msx_state::post_load), this)); +} + +void msx_state::post_load() +{ + for (int page = 0; page < 4; page++) + { + int slot_primary = (m_primary_slot >> (page * 2)) & 3; + int slot_secondary = (m_secondary_slot[slot_primary] >> (page * 2)) & 3; + + m_current_page[page] = m_all_slots[slot_primary][slot_secondary][page]; + } +} + +INTERRUPT_GEN_MEMBER(msx_state::msx_interrupt) +{ + m_mouse[0] = m_io_mouse0->read(); + m_mouse_stat[0] = -1; + m_mouse[1] = m_io_mouse1->read(); + m_mouse_stat[1] = -1; +} + +/* +** The I/O functions +*/ + + +READ8_MEMBER(msx_state::msx_psg_port_a_r) +{ + UINT8 data; + + data = (m_cassette->input() > 0.0038 ? 0x80 : 0); + + if ( (m_psg_b ^ m_io_dsw->read() ) & 0x40) + { + /* game port 2 */ + UINT8 inp = m_io_joy1->read(); + if ( !(inp & 0x80) ) + { + /* joystick */ + data |= ( inp & 0x7f ); + } + else + { + /* mouse */ + data |= ( inp & 0x70 ); + if (m_mouse_stat[1] < 0) + data |= 0xf; + else + data |= ~(m_mouse[1] >> (4*m_mouse_stat[1]) ) & 15; + } + } + else + { + /* game port 1 */ + UINT8 inp = m_io_joy0->read(); + if ( !(inp & 0x80) ) + { + /* joystick */ + data |= ( inp & 0x7f ); + } + else + { + /* mouse */ + data |= ( inp & 0x70 ); + if (m_mouse_stat[0] < 0) + data |= 0xf; + else + data |= ~(m_mouse[0] >> (4*m_mouse_stat[0]) ) & 15; + } + } + + return data; +} + +READ8_MEMBER(msx_state::msx_psg_port_b_r) +{ + return m_psg_b; +} + +WRITE8_MEMBER(msx_state::msx_psg_port_a_w) +{ +} + +WRITE8_MEMBER(msx_state::msx_psg_port_b_w) +{ + /* Arabic or kana mode led */ + if ( (data ^ m_psg_b) & 0x80) + set_led_status (machine(), 2, !(data & 0x80) ); + + if ( (m_psg_b ^ data) & 0x10) + { + if (++m_mouse_stat[0] > 3) m_mouse_stat[0] = -1; + } + if ( (m_psg_b ^ data) & 0x20) + { + if (++m_mouse_stat[1] > 3) m_mouse_stat[1] = -1; + } + + m_psg_b = data; +} + + +/* +** RTC functions +*/ + +WRITE8_MEMBER( msx_state::msx_rtc_latch_w ) +{ + m_rtc_latch = data & 15; +} + +WRITE8_MEMBER( msx_state::msx_rtc_reg_w ) +{ + m_rtc->write(space, m_rtc_latch, data); +} + +READ8_MEMBER( msx_state::msx_rtc_reg_r ) +{ + return m_rtc->read(space, m_rtc_latch); +} + + +/* +** The PPI functions +*/ + +WRITE8_MEMBER( msx_state::msx_ppi_port_a_w ) +{ + m_primary_slot = data; + + if (VERBOSE) + logerror ("write to primary slot select: %02x\n", m_primary_slot); + msx_memory_map_all (); +} + +WRITE8_MEMBER( msx_state::msx_ppi_port_c_w ) +{ + m_keylatch = data & 0x0f; + + /* caps lock */ + if ( BIT(m_port_c_old ^ data, 6) ) + set_led_status (machine(), 1, !BIT(data, 6) ); + + /* key click */ + if ( BIT(m_port_c_old ^ data, 7) ) + m_dac->write_signed8(BIT(data, 7) ? 0x7f : 0); + + /* cassette motor on/off */ + if ( BIT(m_port_c_old ^ data, 4) ) + m_cassette->change_state(BIT(data, 4) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + + /* cassette signal write */ + if ( BIT(m_port_c_old ^ data, 5) ) + m_cassette->output(BIT(data, 5) ? -1.0 : 1.0); + + m_port_c_old = data; +} + +READ8_MEMBER( msx_state::msx_ppi_port_b_r ) +{ + UINT8 result = 0xff; + int row, data; + ioport_port *keynames[] = { m_io_key0, m_io_key1, m_io_key2, m_io_key3, m_io_key4, m_io_key5 }; + + row = m_keylatch; + if (row <= 10) + { + data = keynames[row / 2]->read(); + + if (BIT(row, 0)) + data >>= 8; + result = data & 0xff; + } + return result; +} + +/************************************************************************ + * + * New memory emulation !! + * + ***********************************************************************/ + +void msx_state::install_slot_pages(device_t &owner, UINT8 prim, UINT8 sec, UINT8 page, UINT8 numpages, device_t *device) +{ + msx_state &msx = downcast(owner); + msx_internal_slot_interface *internal_slot = dynamic_cast(device); + + for ( int i = page; i < MIN(page + numpages, 4); i++ ) + { + msx.m_all_slots[prim][sec][i] = internal_slot; + } + if ( sec ) + { + msx.m_slot_expanded[prim] = true; + } +} + +void msx_state::msx_memory_init() +{ + int count_populated_pages = 0; + + // Populate all unpopulated slots with the dummy interface + for ( int prim = 0; prim < 4; prim++ ) + { + for ( int sec = 0; sec < 4; sec++ ) + { + for ( int page = 0; page < 4; page++ ) + { + if ( m_all_slots[prim][sec][page] == NULL ) + { + m_all_slots[prim][sec][page] = &m_empty_slot; + } + else + { + count_populated_pages++; + } + } + } + } + + if ( count_populated_pages == 0 ) { + fatalerror("No msx slot layout defined for this system!\n"); + } +} + +void msx_state::msx_memory_reset () +{ + m_primary_slot = 0; + + for (int prim=0; prim<4; prim++) + { + m_secondary_slot[prim] = 0; + } +} + +void msx_state::msx_memory_map_page (UINT8 page) +{ + int slot_primary = (m_primary_slot >> (page * 2)) & 3; + int slot_secondary = (m_secondary_slot[slot_primary] >> (page * 2)) & 3; + + m_current_page[page] = m_all_slots[slot_primary][slot_secondary][page]; +} + +void msx_state::msx_memory_map_all () +{ + for (UINT8 i=0; i<4; i++) + msx_memory_map_page (i); +} + +READ8_MEMBER( msx_state::msx_mem_read ) +{ + return m_current_page[offset >> 14]->read(space, offset); +} + +WRITE8_MEMBER( msx_state::msx_mem_write ) +{ + m_current_page[offset >> 14]->write(space, offset, data); +} + +WRITE8_MEMBER( msx_state::msx_sec_slot_w ) +{ + int slot = m_primary_slot >> 6; + if (m_slot_expanded[slot]) + { + if (VERBOSE) + logerror ("write to secondary slot %d select: %02x\n", slot, data); + + m_secondary_slot[slot] = data; + msx_memory_map_all (); + } + else + m_current_page[3]->write(space, 0xffff, data); +} + +READ8_MEMBER( msx_state::msx_sec_slot_r ) +{ + int slot = m_primary_slot >> 6; + + if (m_slot_expanded[slot]) + { + return ~m_secondary_slot[slot]; + } + else + { + return m_current_page[3]->read(space, 0xffff); + } +} + +READ8_MEMBER( msx_state::msx_kanji_r ) +{ + UINT8 result = 0xff; + + if (offset && m_region_kanji) + { + int latch = m_kanji_latch; + result = m_region_kanji->u8(latch++); + + m_kanji_latch &= ~0x1f; + m_kanji_latch |= latch & 0x1f; + } + return result; +} + +WRITE8_MEMBER( msx_state::msx_kanji_w ) +{ + if (offset) + m_kanji_latch = (m_kanji_latch & 0x007E0) | ((data & 0x3f) << 11); + else + m_kanji_latch = (m_kanji_latch & 0x1f800) | ((data & 0x3f) << 5); +} + +READ8_MEMBER( msx_state::msx_switched_r ) +{ + // Read from selected switched device + return this->space().read_byte( (m_current_switched_device << 8) | offset ); +} + +WRITE8_MEMBER( msx_state::msx_switched_w ) +{ + if (offset == 0) + { + // Select switched device + m_current_switched_device = data; + } + else + { + // Write to selected switched device + this->space().write_byte( (m_current_switched_device << 8) | offset, data ); + } +} diff --git a/src/mame/machine/msx_matsushita.c b/src/mame/machine/msx_matsushita.c new file mode 100644 index 00000000000..dd00841f5eb --- /dev/null +++ b/src/mame/machine/msx_matsushita.c @@ -0,0 +1,168 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "msx_matsushita.h" + + +const device_type MSX_MATSUSHITA = &device_creator; + + +msx_matsushita_device::msx_matsushita_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : msx_switched_device(mconfig, MSX_MATSUSHITA, "Matsushita switched device", tag, owner, clock, "msx_matsushita", __FILE__) + , m_io_config(*this, "CONFIG") + , m_nvram(*this, "nvram") + , m_turbo_out_cb(*this) + , m_address(0) + , m_nibble1(0) + , m_nibble2(0) + , m_pattern(0) +{ +} + + +UINT8 msx_matsushita_device::get_id() +{ + return 0x08; +} + + +static MACHINE_CONFIG_FRAGMENT( matsushita ) + MCFG_NVRAM_ADD_0FILL("nvram") +MACHINE_CONFIG_END + + +machine_config_constructor msx_matsushita_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( matsushita ); +} + + +static INPUT_PORTS_START( matsushita ) + PORT_START("CONFIG") + PORT_CONFNAME( 0x80, 0x00, "Firmware switch") + PORT_CONFSETTING( 0x00, "On" ) + PORT_CONFSETTING( 0x80, "Off" ) + PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +ioport_constructor msx_matsushita_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( matsushita ); +} + + +void msx_matsushita_device::device_start() +{ + msx_switched_device::device_start(); + + m_turbo_out_cb.resolve_safe(); + + m_sram.resize(0x800); + + m_nvram->set_base(&m_sram[0], 0x000); +} + + +READ8_MEMBER(msx_matsushita_device::io_read) +{ + switch (offset) + { + case 0x00: + return ~get_id(); + + case 0x01: + return m_io_config->read(); + + case 0x03: + { + UINT8 result = (((m_pattern & 0x80) ? m_nibble1 : m_nibble2) << 4) | ((m_pattern & 0x40) ? m_nibble1 : m_nibble2); + m_pattern = (m_pattern << 2) | (m_pattern >> 6); + return result; + } + + case 0x09: // Data + if (m_address < m_sram.size()) + { + return m_sram[m_address]; + } + break; + + default: + logerror("msx_matsushita: unhandled read from offset %02x\n", offset); + break; + } + + return 0xFF; +} + + +/* + 03 <- 10 + 04 <- fe + 4x read 04 and store at CC46-CC49 + + 03 <- 10 + 04 <- ce + 4x read 04 and store at CC4A-CC4D + + 03 <- 10 + 04 <- fe + 4x read 04 and store at CC4E-CC51 + + + 03 <- 10 + 04 <- fc + 4x read 04 and store at CC46-CC49 + + 03 <- 10 + 04 <- cc + 4x read 04 and store at CC4A-CC4D + + 03 <- 10 + 04 <- fc + 4x read 04 and store at CC4E-CC51 + +*/ + + +WRITE8_MEMBER(msx_matsushita_device::io_write) +{ + switch (offset) + { + // bit 0: CPU clock select + // 0 - 5.369317 MHz + // 1 - 3.579545 MHz + case 0x01: + m_turbo_out_cb((data & 1) ? ASSERT_LINE : CLEAR_LINE); + break; + + case 0x03: + m_nibble1 = data & 0x0f; + m_nibble2 = data >> 4; + break; + + case 0x04: + m_pattern = data; + break; + + case 0x07: // Address low + m_address = (m_address & 0xff00) | data; + break; + + case 0x08: // Address high + m_address = (m_address & 0xff) | (data << 8); + break; + + case 0x09: // Data + if (m_address < m_sram.size()) + { + m_sram[m_address] = data; + } + break; + + default: + logerror("msx_matsushita: unhandled write %02x to offset %02x\n", data, offset); + break; + } +} diff --git a/src/mame/machine/msx_matsushita.h b/src/mame/machine/msx_matsushita.h new file mode 100644 index 00000000000..8406d5b29e7 --- /dev/null +++ b/src/mame/machine/msx_matsushita.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef __MSX_MATSUSHITA_H +#define __MSX_MATSUSHITA_H + + +#include "msx_switched.h" +#include "machine/nvram.h" + + +extern const device_type MSX_MATSUSHITA; + + +#define MCFG_MSX_MATSUSHITA_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, MSX_MATSUSHITA, 0) + +#define MCFG_MSX_MATSUSHITA_TURBO_CB(_devcb) \ + devcb = &msx_matsushita_device::set_turbo_callback(*device, DEVCB_##_devcb); + + +class msx_matsushita_device : public msx_switched_device +{ +public: + msx_matsushita_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_turbo_callback(device_t &device, _Object object) { return downcast(device).m_turbo_out_cb.set_callback(object); } + + virtual void device_start(); + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + virtual UINT8 get_id(); + + virtual DECLARE_READ8_MEMBER(io_read); + virtual DECLARE_WRITE8_MEMBER(io_write); + +private: + required_ioport m_io_config; + required_device m_nvram; + devcb_write_line m_turbo_out_cb; + UINT16 m_address; + dynamic_buffer m_sram; + UINT8 m_nibble1; + UINT8 m_nibble2; + UINT8 m_pattern; +}; + +#endif diff --git a/src/mame/machine/msx_s1985.c b/src/mame/machine/msx_s1985.c new file mode 100644 index 00000000000..762b82afa8f --- /dev/null +++ b/src/mame/machine/msx_s1985.c @@ -0,0 +1,65 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "msx_s1985.h" + + +const device_type MSX_S1985 = &device_creator; + + +msx_s1985_device::msx_s1985_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : msx_switched_device(mconfig, MSX_S1985, "MSX-Engine S1985", tag, owner, clock, "msx_s1985", __FILE__) + , m_6_1(0) + , m_6_2(0) + , m_7(0) +{ +} + + +UINT8 msx_s1985_device::get_id() +{ + return 0xFE; +} + + +READ8_MEMBER(msx_s1985_device::io_read) +{ + switch (offset) + { + case 0: + return ~get_id(); + + case 7: + { + UINT8 data = (m_7 & 0x80) ? m_6_2 : m_6_1; + m_7 = ( m_7 << 1 ) | ( m_7 >> 7 ); + return data; + } + + default: + printf("msx_s1985: unhandled read from offset %02x\n", offset); + break; + } + + return 0xFF; +} + + +WRITE8_MEMBER(msx_s1985_device::io_write) +{ + switch (offset) + { + case 6: + m_6_2 = m_6_1; + m_6_1 = data; + break; + + case 7: + m_7 = data; + break; + + default: + printf("msx_s1985: unhandled write %02x to offset %02x\n", data, offset); + break; + } +} diff --git a/src/mame/machine/msx_s1985.h b/src/mame/machine/msx_s1985.h new file mode 100644 index 00000000000..98ecdcf631d --- /dev/null +++ b/src/mame/machine/msx_s1985.h @@ -0,0 +1,33 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef __MSX_S1985_H +#define __MSX_S1985_H + + +#include "msx_switched.h" + + +extern const device_type MSX_S1985; + + +#define MCFG_MSX_S1985_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, MSX_S1985, 0) + + +class msx_s1985_device : public msx_switched_device +{ +public: + msx_s1985_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual UINT8 get_id(); + + virtual DECLARE_READ8_MEMBER(io_read); + virtual DECLARE_WRITE8_MEMBER(io_write); + +private: + UINT8 m_6_1; + UINT8 m_6_2; + UINT8 m_7; +}; + +#endif diff --git a/src/mame/machine/msx_switched.c b/src/mame/machine/msx_switched.c new file mode 100644 index 00000000000..f810f2c2dc2 --- /dev/null +++ b/src/mame/machine/msx_switched.c @@ -0,0 +1,22 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "msx_switched.h" + + +msx_switched_device::msx_switched_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) +{ +} + + +void msx_switched_device::device_start() +{ + address_space &space = dynamic_cast(owner())->space(); + + // Install IO read/write handlers + UINT16 start = ( get_id() << 8 ) | 0x00; + UINT16 end = ( get_id() << 8 ) | 0x0f; + space.install_read_handler(start, end, read8_delegate(FUNC(msx_switched_device::io_read), this)); + space.install_write_handler(start, end, write8_delegate(FUNC(msx_switched_device::io_write), this)); +} diff --git a/src/mame/machine/msx_switched.h b/src/mame/machine/msx_switched.h new file mode 100644 index 00000000000..681ffaaa680 --- /dev/null +++ b/src/mame/machine/msx_switched.h @@ -0,0 +1,21 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef __MSX_SWITCHED_H +#define __MSX_SWITCHED_H + + +class msx_switched_device : public device_t +{ +public: + msx_switched_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + virtual UINT8 get_id() = 0; + + virtual DECLARE_READ8_MEMBER(io_read) = 0; + virtual DECLARE_WRITE8_MEMBER(io_write) = 0; + +protected: + virtual void device_start(); +}; + +#endif diff --git a/src/mame/machine/msx_systemflags.c b/src/mame/machine/msx_systemflags.c new file mode 100644 index 00000000000..ee443f79471 --- /dev/null +++ b/src/mame/machine/msx_systemflags.c @@ -0,0 +1,40 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "msx_systemflags.h" + + +const device_type MSX_SYSTEMFLAGS = &device_creator; + + +msx_systemflags_device::msx_systemflags_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_SYSTEMFLAGS, "MSX System Flags", tag, owner, clock, "msx_systemflags", __FILE__) + , m_initial_value(0xff) + , m_system_flags(0xff) +{ +} + + +void msx_systemflags_device::device_start() +{ + m_system_flags = m_initial_value; + + save_item(NAME(m_system_flags)); + + // Install IO read/write handlers + address_space &space = machine().device("maincpu")->space(AS_IO); + space.install_write_handler(0xf4, 0xf4, write8_delegate(FUNC(msx_systemflags_device::write), this)); + space.install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(msx_systemflags_device::read), this)); +} + + +READ8_MEMBER(msx_systemflags_device::read) +{ + return m_system_flags; +} + + +WRITE8_MEMBER(msx_systemflags_device::write) +{ + m_system_flags = data; +} diff --git a/src/mame/machine/msx_systemflags.h b/src/mame/machine/msx_systemflags.h new file mode 100644 index 00000000000..616ea57f5da --- /dev/null +++ b/src/mame/machine/msx_systemflags.h @@ -0,0 +1,39 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef __MSX_SYSTEMFLAGS_H +#define __MSX_SYSTEMFLAGS_H + +/* +Some MSX2+ and TurboR machines have a 'system flags' I/O port ($F4). +The value in this register is cleared on power up, but it keeps it's +value during a reset of the system. +*/ + +extern const device_type MSX_SYSTEMFLAGS; + + +#define MCFG_MSX_SYSTEMFLAGS_ADD(_tag, _initial_value) \ + MCFG_DEVICE_ADD(_tag, MSX_SYSTEMFLAGS, 0) \ + msx_systemflags_device::set_initial_value(*device, _initial_value); + + +class msx_systemflags_device : public device_t +{ +public: + msx_systemflags_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // static configuration helpers + static void set_initial_value(device_t &device, UINT8 initial_value) { dynamic_cast(device).m_initial_value = initial_value; } + + DECLARE_READ8_MEMBER(read); + DECLARE_WRITE8_MEMBER(write); + +protected: + virtual void device_start(); + +private: + UINT8 m_initial_value; + UINT8 m_system_flags; +}; + +#endif diff --git a/src/mame/machine/mtx.c b/src/mame/machine/mtx.c new file mode 100644 index 00000000000..0594ec6c086 --- /dev/null +++ b/src/mame/machine/mtx.c @@ -0,0 +1,414 @@ +// license:BSD-3-Clause +// copyright-holders:Lee Ward, Dirk Best, Curt Coder +/************************************************************************* + + Memotech MTX 500, MTX 512 and RS 128 + +**************************************************************************/ + +#include "emu.h" +#include "formats/imageutl.h" +#include "includes/mtx.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" +#include "imagedev/snapquik.h" +#include "bus/centronics/ctronics.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" +#include "video/tms9928a.h" +#include "sound/sn76496.h" + +/*************************************************************************** + READ/WRITE HANDLERS +***************************************************************************/ + +/*------------------------------------------------- + mtx_strobe_r - centronics strobe +-------------------------------------------------*/ + +READ8_MEMBER(mtx_state::mtx_strobe_r) +{ + /* set STROBE low */ + m_centronics->write_strobe(FALSE); + + return 0xff; +} + +/*------------------------------------------------- + mtx_bankswitch_w - bankswitch +-------------------------------------------------*/ + +/* + There are two memory models on the MTX, the standard one and a + CBM mode. In standard mode, the memory map is defined as: + + 0x0000 - 0x1fff OSROM + 0x2000 - 0x3fff Paged ROM + 0x4000 - 0x7fff Paged RAM + 0x8000 - 0xbfff Paged RAM + 0xc000 - 0xffff RAM + + Banks are selected by output port 0. Bits 0-3 define the RAM page + and bits 4-6 the ROM page. + + CBM mode is selected by bit 7 of output port 0. ROM is replaced + by RAM in this mode. +*/ + +void mtx_state::bankswitch(UINT8 data) +{ + /* + + bit description + + 0 P0 + 1 P1 + 2 P2 + 3 P3 + 4 R0 + 5 R1 + 6 R2 + 7 RELCPMH + + */ + address_space &program = m_maincpu->space(AS_PROGRAM); + ram_device *messram = m_ram; + +// UINT8 cbm_mode = data >> 7 & 0x01; + UINT8 rom_page = data >> 4 & 0x07; + UINT8 ram_page = data >> 0 & 0x0f; + + /* set rom bank (switches between basic and assembler rom or cartridges) */ + membank("bank2")->set_entry(rom_page); + + /* set ram bank, for invalid pages a nop-handler will be installed */ + if (ram_page >= messram->size()/0x8000) + { + program.nop_readwrite(0x4000, 0x7fff); + program.nop_readwrite(0x8000, 0xbfff); + } + else if (ram_page + 1 == messram->size()/0x8000) + { + program.nop_readwrite(0x4000, 0x7fff); + program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); + membank("bank4")->set_entry(ram_page); + } + else + { + program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); + program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); + membank("bank3")->set_entry(ram_page); + membank("bank4")->set_entry(ram_page); + } +} + +WRITE8_MEMBER(mtx_state::mtx_bankswitch_w) +{ + bankswitch(data); +} + +/*------------------------------------------------- + mtx_sound_strobe_r - sound strobe +-------------------------------------------------*/ + +READ8_MEMBER(mtx_state::mtx_sound_strobe_r) +{ + m_sn->write(space, 0, m_sound_latch); + return 0xff; +} + +/*------------------------------------------------- + mtx_sound_latch_w - sound latch write +-------------------------------------------------*/ + +WRITE8_MEMBER(mtx_state::mtx_sound_latch_w) +{ + m_sound_latch = data; +} + +/*------------------------------------------------- + mtx_cst_w - cassette write +-------------------------------------------------*/ + +WRITE8_MEMBER(mtx_state::mtx_cst_w) +{ + m_cassette->output( BIT(data, 0) ? -1 : 1); +} + +/*------------------------------------------------- + mtx_prt_r - centronics status +-------------------------------------------------*/ + +WRITE_LINE_MEMBER(mtx_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER(mtx_state::write_centronics_fault) +{ + m_centronics_fault = state; +} + +WRITE_LINE_MEMBER(mtx_state::write_centronics_perror) +{ + m_centronics_perror = state; +} + +WRITE_LINE_MEMBER(mtx_state::write_centronics_select) +{ + m_centronics_select = state; +} + +READ8_MEMBER(mtx_state::mtx_prt_r) +{ + /* + + bit description + + 0 BUSY + 1 ERROR + 2 PE + 3 SLCT + 4 + 5 + 6 + 7 + + */ + + UINT8 data = 0; + + /* reset STROBE to high */ + m_centronics->write_strobe( TRUE); + + data |= m_centronics_busy << 0; + data |= m_centronics_fault << 1; + data |= m_centronics_perror << 2; + data |= m_centronics_select << 3; + + return data; +} + +/*------------------------------------------------- + mtx_sense_w - keyboard sense write +-------------------------------------------------*/ + +WRITE8_MEMBER(mtx_state::mtx_sense_w) +{ + m_key_sense = data; +} + +/*------------------------------------------------- + mtx_key_lo_r - keyboard low read +-------------------------------------------------*/ + +READ8_MEMBER(mtx_state::mtx_key_lo_r) +{ + UINT8 data = 0xff; + + if (!(m_key_sense & 0x01)) data &= ioport("ROW0")->read(); + if (!(m_key_sense & 0x02)) data &= ioport("ROW1")->read(); + if (!(m_key_sense & 0x04)) data &= ioport("ROW2")->read(); + if (!(m_key_sense & 0x08)) data &= ioport("ROW3")->read(); + if (!(m_key_sense & 0x10)) data &= ioport("ROW4")->read(); + if (!(m_key_sense & 0x20)) data &= ioport("ROW5")->read(); + if (!(m_key_sense & 0x40)) data &= ioport("ROW6")->read(); + if (!(m_key_sense & 0x80)) data &= ioport("ROW7")->read(); + + return data; +} + +/*------------------------------------------------- + mtx_key_lo_r - keyboard high read +-------------------------------------------------*/ + +READ8_MEMBER(mtx_state::mtx_key_hi_r) +{ + UINT8 data = ioport("country_code")->read(); + + if (!(m_key_sense & 0x01)) data &= ioport("ROW0")->read() >> 8; + if (!(m_key_sense & 0x02)) data &= ioport("ROW1")->read() >> 8; + if (!(m_key_sense & 0x04)) data &= ioport("ROW2")->read() >> 8; + if (!(m_key_sense & 0x08)) data &= ioport("ROW3")->read() >> 8; + if (!(m_key_sense & 0x10)) data &= ioport("ROW4")->read() >> 8; + if (!(m_key_sense & 0x20)) data &= ioport("ROW5")->read() >> 8; + if (!(m_key_sense & 0x40)) data &= ioport("ROW6")->read() >> 8; + if (!(m_key_sense & 0x80)) data &= ioport("ROW7")->read() >> 8; + + return data; +} + +/*------------------------------------------------- + hrx_address_w - HRX video RAM address +-------------------------------------------------*/ + +WRITE8_MEMBER(mtx_state::hrx_address_w) +{ + if (offset) + { + /* + + bit description + + 0 A8 + 1 A9 + 2 A10 + 3 + 4 + 5 attribute memory write enable + 6 ASCII memory write enable + 7 cycle (0=read/1=write) + + */ + } + else + { + /* + + bit description + + 0 A0 + 1 A1 + 2 A2 + 3 A3 + 4 A4 + 5 A5 + 6 A6 + 7 A7 + + */ + } +} + +/*------------------------------------------------- + hrx_data_r - HRX data read +-------------------------------------------------*/ + +READ8_MEMBER(mtx_state::hrx_data_r) +{ + return 0; +} + +/*------------------------------------------------- + hrx_data_w - HRX data write +-------------------------------------------------*/ + +WRITE8_MEMBER(mtx_state::hrx_data_w) +{ +} + +/*------------------------------------------------- + hrx_attr_r - HRX attribute read +-------------------------------------------------*/ + +READ8_MEMBER(mtx_state::hrx_attr_r) +{ + return 0; +} + +/*------------------------------------------------- + hrx_attr_r - HRX attribute write +-------------------------------------------------*/ + +WRITE8_MEMBER(mtx_state::hrx_attr_w) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ +} + +/*************************************************************************** + SNAPSHOT +***************************************************************************/ + +// this only works for some of the files, nothing which tries to load +// more data from tape. todo: tapes which autorun after loading +SNAPSHOT_LOAD_MEMBER( mtx_state, mtx ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + void *ptr; + UINT8 header[18]; + + // read header + image.fread(&header, sizeof(header)); + + // verify first byte + if (header[0] != 0xff) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, NULL); + return IMAGE_INIT_FAIL; + } + + // get tape name + char tape_name[16]; + memcpy(&tape_name, &header[1], 15); + tape_name[15] = '\0'; + image.message("Loading '%s'", tape_name); + + // start of system variables area + UINT16 system_variables_base = pick_integer_le(header, 16, 2); + + // write system variables + UINT16 system_variables_size = 0; + + if (system_variables_base != 0) + { + ptr = program.get_write_ptr(system_variables_base); + system_variables_size = 0xfb4b - system_variables_base; + image.fread(ptr, system_variables_size); + } + + // write actual image data + UINT16 data_size = snapshot_size - 18 - system_variables_size; + + ptr = program.get_write_ptr(0x4000); + image.fread(ptr, 0x4000); + + // if we cross the page boundary, get a new write pointer and write the rest + if (data_size > 0x4000) + { + ptr = program.get_write_ptr(0x8000); + image.fread(ptr, 0x4000); + } + + logerror("snapshot name = '%s', system_size = 0x%04x, data_size = 0x%04x\n", tape_name, system_variables_size, data_size); + + return IMAGE_INIT_PASS; +} + +/*************************************************************************** + MACHINE INITIALIZATION +***************************************************************************/ + +/*------------------------------------------------- + MACHINE_START( mtx512 ) +-------------------------------------------------*/ + +MACHINE_START_MEMBER(mtx_state,mtx512) +{ + ram_device *messram = m_ram; + + /* configure memory */ + membank("bank1")->set_base(memregion("user1")->base()); + membank("bank2")->configure_entries(0, 8, memregion("user2")->base(), 0x2000); + membank("bank3")->configure_entries(0, messram->size()/0x4000/2, messram->pointer(), 0x4000); + membank("bank4")->configure_entries(0, messram->size()/0x4000/2, messram->pointer() + messram->size()/2, 0x4000); +} + +MACHINE_RESET_MEMBER(mtx_state,mtx512) +{ + /* bank switching */ + bankswitch(0); +} diff --git a/src/mame/machine/mz700.c b/src/mame/machine/mz700.c new file mode 100644 index 00000000000..a3a9f3514fa --- /dev/null +++ b/src/mame/machine/mz700.c @@ -0,0 +1,616 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Dirk Best +/****************************************************************************** + * Sharp MZ700 + * + * Reference: http://sharpmz.computingmuseum.com + * + *****************************************************************************/ + +#include "emu.h" +#include "includes/mz700.h" +#include "cpu/z80/z80.h" +#include "machine/pit8253.h" +#include "machine/i8255.h" +#include "machine/z80pio.h" +#include "machine/74145.h" +#include "sound/speaker.h" +#include "imagedev/cassette.h" +#include "machine/ram.h" + +#ifndef VERBOSE +#define VERBOSE 1 +#endif + +#define LOG(N,M,A,mac) \ + do { \ + if(VERBOSE>=N) \ + { \ + if( M ) \ + logerror("%11.6f: %-24s",mac.time().as_double(), (const char*)M ); \ + logerror A; \ + } \ + } while (0) + + +/*************************************************************************** + INITIALIZATION +***************************************************************************/ + +DRIVER_INIT_MEMBER(mz_state,mz700) +{ + m_mz700 = TRUE; + m_mz700_mode = TRUE; + + m_videoram = auto_alloc_array(machine(), UINT8, 0x800); + memset(m_videoram, 0, sizeof(UINT8) * 0x800); + m_colorram = auto_alloc_array(machine(), UINT8, 0x800); + memset(m_colorram, 0, sizeof(UINT8) * 0x800); +} + +DRIVER_INIT_MEMBER(mz_state,mz800) +{ + m_mz700 = FALSE; + m_mz700_mode = FALSE; + + /* video ram */ + m_videoram = auto_alloc_array(machine(), UINT8, 0x4000); + memset(m_videoram, 0, sizeof(UINT8) * 0x4000); + m_colorram = m_videoram + 0x800; + + /* character generator ram */ + m_cgram = auto_alloc_array(machine(), UINT8, 0x1000); + memset(m_cgram, 0, sizeof(UINT8) * 0x1000); +} + +void mz_state::machine_start() +{ + /* reset memory map to defaults */ + mz700_bank_4_w(m_maincpu->space(AS_PROGRAM), 0, 0); +} + + +/*************************************************************************** + MMIO +***************************************************************************/ + +READ8_MEMBER(mz_state::mz700_e008_r) +{ + UINT8 data = 0; + + data |= m_other_timer; + data |= ioport("JOY")->read(); + data |= machine().first_screen()->hblank() << 7; + + LOG(1, "mz700_e008_r", ("%02X\n", data), machine()); + + return data; +} + +WRITE8_MEMBER(mz_state::mz700_e008_w) +{ + m_pit->write_gate0(BIT(data, 0)); +} + + +/*************************************************************************** + BANK SWITCHING +***************************************************************************/ + +READ8_MEMBER(mz_state::mz800_bank_0_r) +{ + UINT8 *videoram = m_videoram; + address_space &spc = m_maincpu->space(AS_PROGRAM); + + /* switch in cgrom */ + spc.install_read_bank(0x1000, 0x1fff, "bank2"); + spc.nop_write(0x1000, 0x1fff); + membank("bank2")->set_base(memregion("monitor")->base() + 0x1000); + + if (m_mz700_mode) + { + /* cgram from 0xc000 to 0xcfff */ + spc.install_read_bank(0xc000, 0xcfff, "bank6"); + spc.install_write_handler(0xc000, 0xcfff, write8_delegate(FUNC(mz_state::mz800_cgram_w),this)); + membank("bank6")->set_base(m_cgram); + } + else + { + if (m_hires_mode) + { + /* vram from 0x8000 to 0xbfff */ + spc.install_readwrite_bank(0x8000, 0xbfff, "bank4"); + membank("bank4")->set_base(videoram); + } + else + { + /* vram from 0x8000 to 0x9fff */ + spc.install_readwrite_bank(0x8000, 0x9fff, "bank4"); + membank("bank4")->set_base(videoram); + + /* ram from 0xa000 to 0xbfff */ + spc.install_readwrite_bank(0xa000, 0xbfff, "bank5"); + membank("bank5")->set_base(m_ram->pointer() + 0xa000); + } + } + + return 0xff; +} + +WRITE8_MEMBER(mz_state::mz700_bank_0_w) +{ + address_space &spc = m_maincpu->space(AS_PROGRAM); + + spc.install_readwrite_bank(0x0000, 0x0fff, "bank1"); + membank("bank1")->set_base(m_ram->pointer()); +} + +WRITE8_MEMBER(mz_state::mz800_bank_0_w) +{ + address_space &spc = m_maincpu->space(AS_PROGRAM); + + spc.install_readwrite_bank(0x0000, 0x7fff, "bank1"); + membank("bank1")->set_base(m_ram->pointer()); +} + +READ8_MEMBER(mz_state::mz800_bank_1_r) +{ + address_space &spc = m_maincpu->space(AS_PROGRAM); + + /* switch in ram from 0x1000 to 0x1fff */ + spc.install_readwrite_bank(0x1000, 0x1fff, "bank2"); + membank("bank2")->set_base(m_ram->pointer() + 0x1000); + + if (m_mz700_mode) + { + /* ram from 0xc000 to 0xcfff */ + spc.install_readwrite_bank(0xc000, 0xcfff, "bank6"); + membank("bank6")->set_base(m_ram->pointer() + 0xc000); + } + else + { + /* ram from 0x8000 to 0xbfff */ + spc.install_readwrite_bank(0x8000, 0xbfff, "bank4"); + membank("bank4")->set_base(m_ram->pointer() + 0x8000); + } + + return 0xff; +} + +WRITE8_MEMBER(mz_state::mz700_bank_1_w) +{ + address_space &spc = m_maincpu->space(AS_PROGRAM); + + if (m_mz700_mode) + { + /* switch in ram when not locked */ + if (!m_mz700_ram_lock) + { + spc.install_readwrite_bank(0xd000, 0xffff, "bank7"); + membank("bank7")->set_base(m_ram->pointer() + 0xd000); + m_mz700_ram_vram = FALSE; + } + } + else + { + /* switch in ram when not locked */ + if (!m_mz800_ram_lock) + { + spc.install_readwrite_bank(0xe000, 0xffff, "bank8"); + membank("bank8")->set_base(m_ram->pointer() + 0xe000); + m_mz800_ram_monitor = FALSE; + } + } +} + +WRITE8_MEMBER(mz_state::mz700_bank_2_w) +{ + address_space &spc = m_maincpu->space(AS_PROGRAM); + + spc.install_read_bank(0x0000, 0x0fff, "bank1"); + spc.nop_write(0x0000, 0x0fff); + membank("bank1")->set_base(memregion("monitor")->base()); +} + +WRITE8_MEMBER(mz_state::mz700_bank_3_w) +{ + UINT8 *videoram = m_videoram; + address_space &spc = m_maincpu->space(AS_PROGRAM); + + if (m_mz700_mode) + { + if (!m_mz700_ram_lock) + { + /* switch in videoram */ + spc.install_readwrite_bank(0xd000, 0xd7ff, "bank7"); + membank("bank7")->set_base(videoram); + + /* switch in colorram */ + spc.install_readwrite_bank(0xd800, 0xdfff, "bank9"); + membank("bank9")->set_base(m_colorram); + + m_mz700_ram_vram = TRUE; + + /* switch in memory mapped i/o devices */ + if (m_mz700) + { + spc.install_readwrite_handler(0xe000, 0xfff3, 0, 0x1ff0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi)); + spc.install_readwrite_handler(0xe004, 0xfff7, 0, 0x1ff0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit)); + spc.install_readwrite_handler(0xe008, 0xfff8, 0, 0x1ff0, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this)); + } + else + { + spc.install_readwrite_handler(0xe000, 0xe003, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi)); + spc.install_readwrite_handler(0xe004, 0xe007, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit)); + spc.install_readwrite_handler(0xe008, 0xe008, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this)); + } + } + } + else + { + if (!m_mz800_ram_lock) + { + /* switch in mz800 monitor rom if not locked */ + spc.install_read_bank(0xe000, 0xffff, "bank8"); + spc.nop_write(0xe000, 0xffff); + membank("bank8")->set_base(memregion("monitor")->base() + 0x2000); + m_mz800_ram_monitor = TRUE; + } + } +} + +WRITE8_MEMBER(mz_state::mz700_bank_4_w) +{ + UINT8 *videoram = m_videoram; + address_space &spc = m_maincpu->space(AS_PROGRAM); + + if (m_mz700_mode) + { + m_mz700_ram_lock = FALSE; /* reset lock */ + mz700_bank_2_w(space, 0, 0); /* switch in monitor rom */ + mz700_bank_3_w(space, 0, 0); /* switch in videoram, colorram, and mmio */ + + /* rest is ram is always ram in mz700 mode */ + spc.install_readwrite_bank(0x1000, 0xcfff, "bank2"); + membank("bank2")->set_base(m_ram->pointer() + 0x1000); + } + else + { + /* monitor rom and cgrom */ + spc.install_read_bank(0x0000, 0x1fff, "bank1"); + spc.nop_write(0x0000, 0x1fff); + membank("bank1")->set_base(memregion("monitor")->base()); + + /* ram from 0x2000 to 0x7fff */ + spc.install_readwrite_bank(0x2000, 0x7fff, "bank3"); + membank("bank3")->set_base(m_ram->pointer()); + + if (m_hires_mode) + { + /* vram from 0x8000 to 0xbfff */ + spc.install_readwrite_bank(0x8000, 0xbfff, "bank4"); + membank("bank4")->set_base(videoram); + } + else + { + /* vram from 0x8000 to 0x9fff */ + spc.install_readwrite_bank(0x8000, 0x9fff, "bank4"); + membank("bank4")->set_base(videoram); + + /* ram from 0xa000 to 0xbfff */ + spc.install_readwrite_bank(0xa000, 0xbfff, "bank5"); + membank("bank5")->set_base(m_ram->pointer() + 0xa000); + } + + /* ram from 0xc000 to 0xdfff */ + spc.install_readwrite_bank(0xc000, 0xdfff, "bank6"); + membank("bank6")->set_base(m_ram->pointer() + 0xc000); + + /* mz800 monitor rom from 0xe000 to 0xffff */ + spc.install_read_bank(0xe000, 0xffff, "bank8"); + spc.nop_write(0xe000, 0xffff); + membank("bank8")->set_base(memregion("monitor")->base() + 0x2000); + m_mz800_ram_monitor = TRUE; + + m_mz800_ram_lock = FALSE; /* reset lock? */ + } +} + +WRITE8_MEMBER(mz_state::mz700_bank_5_w) +{ + address_space &spc = m_maincpu->space(AS_PROGRAM); + + if (m_mz700_mode) + { + /* prevent access from 0xd000 to 0xffff */ + m_mz700_ram_lock = TRUE; + spc.nop_readwrite(0xd000, 0xffff); + } + else + { + /* prevent access from 0xe000 to 0xffff */ + m_mz800_ram_lock = TRUE; + spc.nop_readwrite(0xe000, 0xffff); + } +} + +WRITE8_MEMBER(mz_state::mz700_bank_6_w) +{ + if (m_mz700_mode) + { + m_mz700_ram_lock = FALSE; + + /* restore access */ + if (m_mz700_ram_vram) + mz700_bank_3_w(space, 0, 0); + else + mz700_bank_1_w(space, 0, 0); + } + else + { + m_mz800_ram_lock = FALSE; + + /* restore access from 0xe000 to 0xffff */ + if (m_mz800_ram_monitor) + mz700_bank_3_w(space, 0, 0); + else + mz700_bank_1_w(space, 0, 0); + } +} + + +/************************ PIT ************************************************/ + +/* Timer 0 is the clock for the speaker output */ + +WRITE_LINE_MEMBER(mz_state::pit_out0_changed) +{ + if((m_prev_state==0) && (state==1)) { + m_speaker_level ^= 1; + } + m_prev_state = state; + m_speaker->level_w(m_speaker_level); +} + +/* timer 2 is the AM/PM (12 hour) interrupt */ +WRITE_LINE_MEMBER(mz_state::pit_irq_2) +{ + if (!m_intmsk) + m_maincpu->set_input_line(0, state); +} + + +/*************************************************************************** + 8255 PPI +***************************************************************************/ + +READ8_MEMBER(mz_state::pio_port_b_r) +{ + device_t *device = machine().device("ls145"); + int key_line = dynamic_cast(device)->read(); + const char *const keynames[10] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9" }; + int i; + UINT8 res = 0; + + for(i=0;i<10;i++) + { + if(key_line & (1 << i)) + res |= ioport(keynames[i])->read(); + } + + return res; +} + +/* + * bit 7 in vertical blank + * bit 6 in NE556 output + * bit 5 in tape data (RDATA) + * bit 4 in motor (1 = on) + */ +READ8_MEMBER(mz_state::pio_port_c_r) +{ + UINT8 data = 0; + + /* note: this is actually connected to Q output of the motor-control flip-flop (see below) */ + if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED) + data |= 0x10; + + if ((m_cassette)->input() > 0.0038) + data |= 0x20; /* set the RDATA status */ + + data |= m_cursor_timer << 6; + data |= machine().first_screen()->vblank() << 7; + + LOG(2,"mz700_pio_port_c_r",("%02X\n", data),machine()); + + return data; +} + + +WRITE8_MEMBER(mz_state::pio_port_a_w) +{ + device_t *device = machine().device("ls145"); + timer_device *timer = machine().device("cursor"); + + LOG(2,"mz700_pio_port_a_w",("%02X\n", data),machine()); + + /* the ls145 is connected to PA0-PA3 */ + dynamic_cast(device)->write(data & 0x07); + + /* ne556 reset is connected to PA7 */ + timer->enable(BIT(data, 7)); +} + + +WRITE8_MEMBER(mz_state::pio_port_c_w) +{ + /* + * bit 3 out motor control (0 = on) + * bit 2 out INTMSK + * bit 1 out tape data (WDATA) + * bit 0 out unused + */ + +// UINT8 state = cassette_get_state(m_cassette); +// UINT8 action = ((~pio_port_c_output & 8) & (data & 8)); /* detect low-to-high transition */ + + /* The motor control circuit consists of a resistor, capacitor, invertor, nand-gate, and D flip-flop. + The sense input from the cassette player goes low whenever play, rewind or fast-forward is pressed. + This connects to most of the above components. + The Q output enables the motor, and also connects to Bit 4 (input). + Bit 3 outputs a string of pulses to the Clock pin, and therefore cannot be used to control + the motor directly. + For the moment, the user can use the UI to select play, stop, etc. + If you load from the command-line or the software-picker, type in L immediately. */ +#if 0 + + m_cassette->change_state( + ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, + CASSETTE_MOTOR_DISABLED); + +#endif + + LOG(2,"mz700_pio_port_c_w",("%02X\n", data),machine()); + + m_cassette->output((data & 0x02) ? +1.0 : -1.0); +} + + +/****************************************************************************** + * Sharp MZ800 + * + * + ******************************************************************************/ + +//static UINT8 mz800_display_mode = 0; +//static UINT8 mz800_port_e8 = 0; + + +/*************************************************************************** + Z80 PIO +***************************************************************************/ + +WRITE_LINE_MEMBER(mz_state::mz800_z80pio_irq) +{ + m_maincpu->set_input_line(0, state); +} + +WRITE_LINE_MEMBER(mz_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +WRITE_LINE_MEMBER(mz_state::write_centronics_perror) +{ + m_centronics_perror = state; +} + +READ8_MEMBER(mz_state::mz800_z80pio_port_a_r) +{ + UINT8 result = 0; + + result |= m_centronics_busy; + result |= m_centronics_perror << 1; + result |= machine().first_screen()->hblank() << 5; + + return result; +} + +WRITE8_MEMBER(mz_state::mz800_z80pio_port_a_w) +{ + m_centronics->write_init(BIT(data, 6)); + m_centronics->write_strobe(BIT(data, 7)); +} + +/* port CE */ +READ8_MEMBER(mz_state::mz800_crtc_r) +{ + UINT8 data = 0x00; + LOG(1,"mz800_crtc_r",("%02X\n",data),machine()); + return data; +} + + +/* port EA */ +READ8_MEMBER(mz_state::mz800_ramdisk_r) +{ + UINT8 *mem = memregion("user1")->base(); + UINT8 data = mem[m_mz800_ramaddr]; + LOG(2,"mz800_ramdisk_r",("[%04X] -> %02X\n", m_mz800_ramaddr, data),machine()); + if (m_mz800_ramaddr++ == 0) + LOG(1,"mz800_ramdisk_r",("address wrap 0000\n"),machine()); + return data; +} + +/* port CC */ +WRITE8_MEMBER(mz_state::mz800_write_format_w) +{ + LOG(1,"mz800_write_format_w",("%02X\n", data),machine()); +} + +/* port CD */ +WRITE8_MEMBER(mz_state::mz800_read_format_w) +{ + LOG(1,"mz800_read_format_w",("%02X\n", data),machine()); +} + +/* port CE + * bit 3 1: MZ700 mode 0: MZ800 mode + * bit 2 1: 640 horizontal 0: 320 horizontal + * bit 1 1: 4bpp/2bpp 0: 2bpp/1bpp + * bit 0 ??? + */ +WRITE8_MEMBER(mz_state::mz800_display_mode_w) +{ + m_mz700_mode = BIT(data, 3); + m_hires_mode = BIT(data, 2); + m_screennum = data & 0x03; + + /* change memory maps if we switched mode */ +// if (BIT(data, 3) != m_mz700_mode) +// { +// logerror("mz800_display_mode_w: switching mode to %s\n", (BIT(data, 3) ? "mz700" : "mz800")); +// m_mz700_mode = BIT(data, 3); +// mz700_bank_4_w(*m_maincpu->&space(AS_PROGRAM), 0, 0); +// } +} + +/* port CF */ +WRITE8_MEMBER(mz_state::mz800_scroll_border_w) +{ + LOG(1,"mz800_scroll_border_w",("%02X\n", data),machine()); +} + +/* port EA */ +WRITE8_MEMBER(mz_state::mz800_ramdisk_w) +{ + UINT8 *mem = memregion("user1")->base(); + LOG(2,"mz800_ramdisk_w",("[%04X] <- %02X\n", m_mz800_ramaddr, data),machine()); + mem[m_mz800_ramaddr] = data; + if (m_mz800_ramaddr++ == 0) + LOG(1,"mz800_ramdisk_w",("address wrap 0000\n"),machine()); +} + +/* port EB */ +WRITE8_MEMBER(mz_state::mz800_ramaddr_w) +{ + m_mz800_ramaddr = (m_maincpu->state_int(Z80_BC) & 0xff00) | (data & 0xff); + LOG(1,"mz800_ramaddr_w",("%04X\n", m_mz800_ramaddr),machine()); +} + +/* port F0 */ +WRITE8_MEMBER(mz_state::mz800_palette_w) +{ + if (data & 0x40) + { + m_mz800_palette_bank = data & 3; + LOG(1,"mz800_palette_w",("bank: %d\n", m_mz800_palette_bank),machine()); + } + else + { + int idx = (data >> 4) & 3; + int val = data & 15; + LOG(1,"mz800_palette_w",("palette[%d] <- %d\n", idx, val),machine()); + m_mz800_palette[idx] = val; + } +} diff --git a/src/mame/machine/mz80.c b/src/mame/machine/mz80.c new file mode 100644 index 00000000000..66abbff2e00 --- /dev/null +++ b/src/mame/machine/mz80.c @@ -0,0 +1,84 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + MZ80 driver by Miodrag Milanovic + + 22/11/2008 Preliminary driver. + +****************************************************************************/ + +#include "includes/mz80.h" + + +/* Driver initialization */ +DRIVER_INIT_MEMBER(mz80_state,mz80k) +{ +} + +void mz80_state::machine_reset() +{ + m_mz80k_tempo_strobe = 0; + m_mz80k_vertical = 0; + m_mz80k_cursor_cnt = 0; + m_mz80k_keyboard_line = 0; +} + + +READ8_MEMBER( mz80_state::mz80k_8255_portb_r ) +{ + char kbdrow[8]; + sprintf(kbdrow,"LINE%d", m_mz80k_keyboard_line); + if (m_mz80k_keyboard_line > 9) + return 0xff; + else + return ioport(kbdrow)->read(); +} + +READ8_MEMBER( mz80_state::mz80k_8255_portc_r ) +{ + UINT8 val = 0; + val |= m_mz80k_vertical ? 0x80 : 0x00; + val |= ((m_mz80k_cursor_cnt & 0x3f) > 31) ? 0x40 : 0x00; + val |= (m_cassette->get_state() & CASSETTE_MASK_UISTATE)== CASSETTE_PLAY ? 0x10 : 0x00; + + if (m_cassette->input() > 0.00) + val |= 0x20; + + return val; +} + +WRITE8_MEMBER( mz80_state::mz80k_8255_porta_w ) +{ + m_mz80k_keyboard_line = data & 0x0f; +} + +WRITE8_MEMBER( mz80_state::mz80k_8255_portc_w ) +{ +// logerror("mz80k_8255_portc_w %02x\n",data); +} + + +WRITE_LINE_MEMBER( mz80_state::pit_out0_changed ) +{ + if(!m_prev_state && state) + m_speaker_level++; + + m_prev_state = state; + m_speaker->level_w(BIT(m_speaker_level, 1)); +} + +WRITE_LINE_MEMBER( mz80_state::pit_out2_changed ) +{ + m_maincpu->set_input_line(0, HOLD_LINE); +} + +READ8_MEMBER( mz80_state::mz80k_strobe_r ) +{ + return 0x7e | (UINT8)m_mz80k_tempo_strobe; +} + +WRITE8_MEMBER( mz80_state::mz80k_strobe_w ) +{ + m_pit->write_gate0(BIT(data, 0)); +} diff --git a/src/mame/machine/nc.c b/src/mame/machine/nc.c new file mode 100644 index 00000000000..07041c5c787 --- /dev/null +++ b/src/mame/machine/nc.c @@ -0,0 +1,87 @@ +// license:GPL-2.0+ +// copyright-holders:Wilbert Pol, Kevin Thacker +/*************************************************************************** + + nc.c + +***************************************************************************/ + +#include "emu.h" +#include "includes/nc.h" +#include "machine/i8251.h" + +/*************************************************************************************************/ +/* PCMCIA Ram Card management */ + +/* the data is stored as a simple memory dump, there is no header or other information */ +/* stores size of actual file on filesystem */ + + +/* this is not a real register, it is used to record card status */ +/* ==0, card not inserted, !=0 card is inserted */ + +// set pcmcia card present state +void nc_state::set_card_present_state(int state) +{ + m_card_status = state; +} + + +// this mask will prevent overwrites from end of data +int nc_state::card_calculate_mask(int size) +{ + /* memory block is visible as 16k blocks */ + /* mask can only operate on power of two sizes */ + /* memory cards normally in power of two sizes */ + /* maximum of 64 16k blocks can be accessed using memory paging of nc computer */ + /* max card size is therefore 1mb */ + for (int i = 14; i < 20; i++) + { + if (size < (1 << i)) + return 0x03f >> (19 - i); + } + + return 0x03f; +} + + +// load pcmcia card data +DEVICE_IMAGE_LOAD_MEMBER( nc_state, nc_pcmcia_card ) +{ + UINT32 size = m_card->common_get_size("rom"); + + m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_card->common_load_rom(m_card->get_rom_base(), size, "rom"); + + set_card_present_state(1); + m_membank_card_ram_mask = card_calculate_mask(size); + + return IMAGE_INIT_PASS; +} + + +// save pcmcia card data back +DEVICE_IMAGE_UNLOAD_MEMBER( nc_state, nc_pcmcia_card ) +{ + // if there is no data to write, quit + if (!m_card_size) + return; + + logerror("attempting card save\n"); + + // write data + image.fwrite(m_card_ram, m_card_size); + + logerror("write succeeded!\r\n"); + + // set card not present state + set_card_present_state(0); + m_card_size = 0; +} + +DRIVER_INIT_MEMBER( nc_state, nc ) +{ + // set card not present state + set_card_present_state(0); + m_card_size = 0; +} diff --git a/src/mame/machine/nes.c b/src/mame/machine/nes.c new file mode 100644 index 00000000000..c5cd79575ee --- /dev/null +++ b/src/mame/machine/nes.c @@ -0,0 +1,208 @@ +// license:BSD-3-Clause +// copyright-holders:Brad Oliver,Fabio Priuli +/***************************************************************************** + + nes.c + + Nintendo Entertainment System (Famicom) + + ****************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "includes/nes.h" + +/*************************************************************************** + FUNCTIONS +***************************************************************************/ + +// to be probably removed (it does nothing since a long time) +int nes_state::nes_ppu_vidaccess( int address, int data ) +{ + return data; +} + +//------------------------------------------------- +// machine_reset +//------------------------------------------------- + +void nes_state::machine_reset() +{ + // Reset the mapper variables. Will also mark the char-gen ram as dirty + if (m_cartslot) + m_cartslot->pcb_reset(); + + m_maincpu->reset(); +} + +//------------------------------------------------- +// machine_start +//------------------------------------------------- + +void nes_state::machine_start() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + // CIRAM (Character Internal RAM) + // NES has 2KB of internal RAM which can be used to fill the 4x1KB banks of PPU RAM at $2000-$2fff + // Line A10 is exposed to the carts, so that games can change CIRAM mapping in PPU (we emulate this with the set_nt_mirroring + // function). CIRAM can also be disabled by the game (if e.g. VROM or cart RAM has to be used in PPU... + m_ciram = auto_alloc_array(machine(), UINT8, 0x800); + // other pointers got set in the loading routine, because they 'belong' to the cart itself + + m_io_disksel = ioport("FLIPDISK"); + + if (m_cartslot && m_cartslot->m_cart) + { + // Set up memory handlers + space.install_read_handler(0x4100, 0x5fff, read8_delegate(FUNC(nes_cart_slot_device::read_l), (nes_cart_slot_device *)m_cartslot)); + space.install_write_handler(0x4100, 0x5fff, write8_delegate(FUNC(nes_cart_slot_device::write_l), (nes_cart_slot_device *)m_cartslot)); + space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(nes_cart_slot_device::read_m), (nes_cart_slot_device *)m_cartslot)); + space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(nes_cart_slot_device::write_m), (nes_cart_slot_device *)m_cartslot)); + space.install_read_bank(0x8000, 0x9fff, "prg0"); + space.install_read_bank(0xa000, 0xbfff, "prg1"); + space.install_read_bank(0xc000, 0xdfff, "prg2"); + space.install_read_bank(0xe000, 0xffff, "prg3"); + space.install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(nes_cart_slot_device::write_h), (nes_cart_slot_device *)m_cartslot)); + + m_ppu->space(AS_PROGRAM).install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(device_nes_cart_interface::chr_r),m_cartslot->m_cart), write8_delegate(FUNC(device_nes_cart_interface::chr_w),m_cartslot->m_cart)); + m_ppu->space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(device_nes_cart_interface::nt_r),m_cartslot->m_cart), write8_delegate(FUNC(device_nes_cart_interface::nt_w),m_cartslot->m_cart)); + m_ppu->set_scanline_callback(ppu2c0x_scanline_delegate(FUNC(device_nes_cart_interface::scanline_irq),m_cartslot->m_cart)); + m_ppu->set_hblank_callback(ppu2c0x_hblank_delegate(FUNC(device_nes_cart_interface::hblank_irq),m_cartslot->m_cart)); + m_ppu->set_latch(ppu2c0x_latch_delegate(FUNC(device_nes_cart_interface::ppu_latch),m_cartslot->m_cart)); + + // install additional handlers (read_h, read_ex, write_ex) + if (m_cartslot->get_pcb_id() == STD_EXROM || m_cartslot->get_pcb_id() == STD_NROM368 || m_cartslot->get_pcb_id() == STD_DISKSYS + || m_cartslot->get_pcb_id() == GG_NROM || m_cartslot->get_pcb_id() == CAMERICA_ALADDIN || m_cartslot->get_pcb_id() == SUNSOFT_DCS + || m_cartslot->get_pcb_id() == BANDAI_DATACH || m_cartslot->get_pcb_id() == BANDAI_KARAOKE || m_cartslot->get_pcb_id() == BTL_2A03_PURITANS || m_cartslot->get_pcb_id() == AVE_MAXI15 + || m_cartslot->get_pcb_id() == KAISER_KS7022 || m_cartslot->get_pcb_id() == KAISER_KS7031 || m_cartslot->get_pcb_id() == BMC_VT5201 + || m_cartslot->get_pcb_id() == UNL_LH32 || m_cartslot->get_pcb_id() == UNL_LH10 || m_cartslot->get_pcb_id() == UNL_2708 + || m_cartslot->get_pcb_id() == UNL_43272 || m_cartslot->get_pcb_id() == BMC_G63IN1 || m_cartslot->get_pcb_id() == BMC_8157 + || m_cartslot->get_pcb_id() == BMC_GOLD150 || m_cartslot->get_pcb_id() == BMC_CH001 + || m_cartslot->get_pcb_id() == BMC_70IN1 || m_cartslot->get_pcb_id() == BMC_800IN1) + { + logerror("read_h installed!\n"); + space.install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(nes_cart_slot_device::read_h), (nes_cart_slot_device *)m_cartslot)); + } + + if (m_cartslot->get_pcb_id() == BTL_SMB2JB || m_cartslot->get_pcb_id() == UNL_AC08 || m_cartslot->get_pcb_id() == UNL_SMB2J || m_cartslot->get_pcb_id() == BTL_09034A) + { + logerror("write_ex installed!\n"); + space.install_write_handler(0x4020, 0x40ff, write8_delegate(FUNC(nes_cart_slot_device::write_ex), (nes_cart_slot_device *)m_cartslot)); + } + + if (m_cartslot->get_pcb_id() == KAISER_KS7017 || m_cartslot->get_pcb_id() == UNL_603_5052 || m_cartslot->get_pcb_id() == STD_DISKSYS) + { + logerror("write_ex & read_ex installed!\n"); + space.install_read_handler(0x4020, 0x40ff, read8_delegate(FUNC(nes_cart_slot_device::read_ex), (nes_cart_slot_device *)m_cartslot)); + space.install_write_handler(0x4020, 0x40ff, write8_delegate(FUNC(nes_cart_slot_device::write_ex), (nes_cart_slot_device *)m_cartslot)); + } + + m_cartslot->pcb_start(m_ciram); + m_cartslot->m_cart->pcb_reg_postload(machine()); + } + + // register saves + save_item(NAME(m_last_frame_flip)); + save_pointer(NAME(m_ciram), 0x800); +} + + +//------------------------------------------------- +// INPUTS +//------------------------------------------------- + +READ8_MEMBER(nes_state::nes_in0_r) +{ + UINT8 ret = 0x40; + ret |= m_ctrl1->read_bit0(); + ret |= m_ctrl1->read_bit34(); + return ret; +} + +READ8_MEMBER(nes_state::nes_in1_r) +{ + UINT8 ret = 0x40; + ret |= m_ctrl2->read_bit0(); + ret |= m_ctrl2->read_bit34(); + return ret; +} + +WRITE8_MEMBER(nes_state::nes_in0_w) +{ + m_ctrl1->write(data); + m_ctrl2->write(data); +} + + +READ8_MEMBER(nes_state::fc_in0_r) +{ + UINT8 ret = 0x40; + // bit 0 to controller port + ret |= m_ctrl1->read_bit0(); + + // expansion port bits (in the original FC, P2 controller was hooked to these lines + // too, so in principle some homebrew hardware modification could use the same + // connection with P1 controller too) + ret |= m_ctrl1->read_exp(0); + ret |= m_ctrl2->read_exp(0); + + // at the same time, we might have a standard joypad connected to the expansion port which + // shall be read as P3 (this is needed here to avoid implementing the expansion port as a + // different device compared to the standard control port... it might be changed later) + ret |= (m_exp->read_bit0() << 1); + // finally, read the expansion port as expected + ret |= m_exp->read_exp(0); + return ret; +} + +READ8_MEMBER(nes_state::fc_in1_r) +{ + UINT8 ret = 0x40; + // bit 0 to controller port + ret |= m_ctrl2->read_bit0(); + + // expansion port bits (in the original FC, P2 controller was hooked to these lines + // too, so in principle some homebrew hardware modification could use the same + // connection with P1 controller too) + ret |= m_ctrl1->read_exp(1); + ret |= m_ctrl2->read_exp(1); + + // finally, read the expansion port as expected (standard pad cannot be hooked as P4, so + // no read_bit0 here) + ret |= m_exp->read_exp(1); + return ret; +} + +WRITE8_MEMBER(nes_state::fc_in0_w) +{ + m_ctrl1->write(data); + m_ctrl2->write(data); + m_exp->write(data); +} + + +DRIVER_INIT_MEMBER(nes_state,famicom) +{ + // setup alt input handlers for additional FC input devices + address_space &space = machine().device("maincpu")->space(AS_PROGRAM); + space.install_read_handler(0x4016, 0x4016, read8_delegate(FUNC(nes_state::fc_in0_r), this)); + space.install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(nes_state::fc_in0_w), this)); + space.install_read_handler(0x4017, 0x4017, read8_delegate(FUNC(nes_state::fc_in1_r), this)); +} + +NESCTRL_BRIGHTPIXEL_CB(nes_state::bright_pixel) +{ + // get the pixel at the gun position + UINT32 pix = m_ppu->get_pixel(x, y); + + // get the color base from the ppu + UINT32 color_base = m_ppu->get_colorbase(); + + // check if the cursor is over a bright pixel + if ((pix == color_base + 0x20) || (pix == color_base + 0x30) || + (pix == color_base + 0x33) || (pix == color_base + 0x34)) + return true; + else + return false; +} diff --git a/src/mame/machine/nextkbd.c b/src/mame/machine/nextkbd.c new file mode 100644 index 00000000000..7ff946b7916 --- /dev/null +++ b/src/mame/machine/nextkbd.c @@ -0,0 +1,456 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +#include "nextkbd.h" + +const device_type NEXTKBD = &device_creator; + +DEVICE_ADDRESS_MAP_START(amap, 32, nextkbd_device) + AM_RANGE(0x0, 0x3) AM_READWRITE8(status_snd_r, ctrl_snd_w, 0xff000000) + AM_RANGE(0x0, 0x3) AM_READWRITE8(status_kms_r, ctrl_kms_w, 0x00ff0000) + AM_RANGE(0x0, 0x3) AM_READWRITE8(status_dma_r, ctrl_dma_w, 0x0000ff00) + AM_RANGE(0x0, 0x3) AM_READWRITE8(status_cmd_r, ctrl_cmd_w, 0x000000ff) + AM_RANGE(0x4, 0x7) AM_READWRITE(cdata_r, cdata_w) + AM_RANGE(0x8, 0xb) AM_READWRITE(kmdata_r, kmdata_w) +ADDRESS_MAP_END + +nextkbd_device::nextkbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEXTKBD, "NEXTKBD", tag, owner, clock, "nextkbd", __FILE__), + int_change_cb(*this), + int_power_cb(*this), + int_nmi_cb(*this), + mousex(*this, "mousex"), + mousey(*this, "mousey"), + mousebtn(*this, "mousebtn") +{ +} + +void nextkbd_device::device_start() +{ + int_change_cb.resolve_safe(); + int_power_cb.resolve_safe(); + int_nmi_cb.resolve_safe(); + + poll_timer = timer_alloc(0); + + save_item(NAME(ctrl_snd)); + save_item(NAME(ctrl_kms)); + save_item(NAME(ctrl_dma)); + save_item(NAME(ctrl_cmd)); + save_item(NAME(cdata)); + save_item(NAME(kmdata)); + save_item(NAME(fifo_ir)); + save_item(NAME(fifo_iw)); + save_item(NAME(fifo_size)); + save_item(NAME(fifo)); + save_item(NAME(modifiers_state)); + save_item(NAME(prev_mousex)); + save_item(NAME(prev_mousey)); + save_item(NAME(prev_mousebtn)); +} + +void nextkbd_device::device_reset() +{ + ctrl_snd = 0x00; + ctrl_kms = 0x00; + ctrl_dma = 0x00; + ctrl_cmd = 0x00; + cdata = 0; + kmdata = 0; + fifo_ir = 0; + fifo_iw = 0; + fifo_size = 0; + memset(fifo, 0, sizeof(fifo)); + modifiers_state = 0; + nmi_active = false; + prev_mousex = 0; + prev_mousey = 0; + prev_mousebtn = 0; + km_address = 0; + poll_timer->adjust(attotime::from_hz(200), 0, attotime::from_hz(200)); +} + +void nextkbd_device::send() +{ + if(ctrl_kms & C_KBD_DATA) + return; + + kmdata = fifo_pop(); + ctrl_kms |= C_KBD_DATA; + if(!(ctrl_kms & C_KBD_INTERRUPT)) { + ctrl_kms |= C_KBD_INTERRUPT; + int_change_cb(true); + } +} + +void nextkbd_device::update_mouse(bool force_update) +{ + UINT32 cur_mousex = mousex->read(); + UINT32 cur_mousey = mousey->read(); + UINT32 cur_mousebtn = mousebtn->read(); + + if(!force_update && cur_mousex == prev_mousex && cur_mousey == prev_mousey && cur_mousebtn == prev_mousebtn) + return; + + INT32 deltax = -(cur_mousex - prev_mousex); + INT32 deltay = -(cur_mousey - prev_mousey); + + if(deltax >= 128) + deltax -= 256; + if(deltax < -128) + deltax += 256; + if(deltay >= 128) + deltay -= 256; + if(deltay < -128) + deltay += 256; + + prev_mousex = cur_mousex; + prev_mousey = cur_mousey; + prev_mousebtn = cur_mousebtn; + + if(deltax < -0x40) + deltax = -0x40; + if(deltax > 0x3f) + deltax = 0x3f; + if(deltay < -0x40) + deltay = -0x40; + if(deltay > 0x3f) + deltay = 0x3f; + + UINT32 base = ((deltax & 0x7f) << 1) | ((deltay & 0x7f) << 9) | cur_mousebtn; + fifo_push(km_address | D_SECONDARY | base); + send(); +} + +void nextkbd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if(!fifo_empty()) + send(); + + update_mouse(false); +} + +void nextkbd_device::fifo_push(UINT32 val) +{ + if(fifo_size == FIFO_SIZE) + return; + + fifo_size++; + fifo[fifo_iw++] = val; + if(fifo_iw == FIFO_SIZE) + fifo_iw = 0; +} + +UINT32 nextkbd_device::fifo_pop() +{ + if(fifo_size == 0) + return 0; + + fifo_size--; + UINT32 res = fifo[fifo_ir++]; + if(fifo_ir == FIFO_SIZE) + fifo_ir = 0; + + return res; +} + +bool nextkbd_device::fifo_empty() const +{ + return !fifo_size; +} + +READ8_MEMBER( nextkbd_device::status_snd_r ) +{ + logerror("%s: status_snd_r %02x (%08x)\n", tag(), ctrl_snd, (unsigned int)space.device().safe_pc()); + return ctrl_snd; +} + +READ8_MEMBER( nextkbd_device::status_kms_r ) +{ + logerror("%s: status_kms_r %02x (%08x)\n", tag(), ctrl_kms, (unsigned int)space.device().safe_pc()); + return ctrl_kms; +} + +READ8_MEMBER( nextkbd_device::status_dma_r ) +{ + logerror("%s: status_dma_r %02x (%08x)\n", tag(), ctrl_dma, (unsigned int)space.device().safe_pc()); + return ctrl_dma; +} + +READ8_MEMBER( nextkbd_device::status_cmd_r ) +{ + logerror("%s: status_cmd_r %02x (%08x)\n", tag(), ctrl_cmd, (unsigned int)space.device().safe_pc()); + return ctrl_cmd; +} + +READ32_MEMBER( nextkbd_device::cdata_r ) +{ + logerror("%s: cdata_r %08x @ %08x (%08x)\n", tag(), cdata, mem_mask, (unsigned int)space.device().safe_pc()); + return cdata; +} + +READ32_MEMBER( nextkbd_device::kmdata_r ) +{ + UINT8 old = ctrl_kms; + ctrl_kms &= ~(C_KBD_INTERRUPT|C_KBD_DATA); + if(old & C_KBD_INTERRUPT) + int_change_cb(false); + logerror("%s: kmdata_r %08x @ %08x (%08x)\n", tag(), kmdata, mem_mask, (unsigned int)space.device().safe_pc()); + return kmdata; +} + +WRITE8_MEMBER( nextkbd_device::ctrl_snd_w ) +{ + UINT8 old = ctrl_snd; + ctrl_snd = (ctrl_snd & ~C_SOUND_WMASK) | (data & C_SOUND_WMASK); + UINT8 diff = old ^ ctrl_snd; + + logerror("%s: ctrl_snd_w %02x | %02x (%08x)\n", tag(), ctrl_snd, diff, (unsigned int)space.device().safe_pc()); +} + +WRITE8_MEMBER( nextkbd_device::ctrl_kms_w ) +{ + UINT8 old = ctrl_kms; + ctrl_kms = (ctrl_kms & ~C_KMS_WMASK) | (data & C_KMS_WMASK); + UINT8 diff = old ^ ctrl_kms; + + logerror("%s: ctrl_kms_w %02x | %02x (%08x)\n", tag(), ctrl_kms, diff, (unsigned int)space.device().safe_pc()); +} + +WRITE8_MEMBER( nextkbd_device::ctrl_dma_w ) +{ + UINT8 old = ctrl_dma; + ctrl_dma = (ctrl_dma & ~C_WMASK) | (data & C_WMASK); + UINT8 diff = old ^ ctrl_dma; + + logerror("%s: ctrl_dma_w %02x | %02x (%08x)\n", tag(), ctrl_dma, diff, (unsigned int)space.device().safe_pc()); +} + +WRITE8_MEMBER( nextkbd_device::ctrl_cmd_w ) +{ + ctrl_cmd = data; + logerror("%s: ctrl_cmd_w %02x (%08x)\n", tag(), ctrl_cmd, (unsigned int)space.device().safe_pc()); +} + +WRITE32_MEMBER( nextkbd_device::cdata_w ) +{ + COMBINE_DATA(&cdata); + logerror("%s: cdata_w %08x @ %08x (%08x)\n", tag(), data, mem_mask, (unsigned int)space.device().safe_pc()); + handle_command(); +} + +WRITE32_MEMBER( nextkbd_device::kmdata_w ) +{ + logerror("%s: kmdata_w %08x @ %08x (%08x)\n", tag(), data, mem_mask, (unsigned int)space.device().safe_pc()); +} + +INPUT_CHANGED_MEMBER( nextkbd_device::update ) +{ + int bank = (int)(FPTR)param; + switch(bank) { + case 0: case 1: case 2: { + int index; + for(index=0; index < 32; index++) + if(field.mask() & (1 << index)) + break; + assert(index != 32); + index += bank*32; + UINT16 val = index | modifiers_state | D_KBD_VALID; + if(!newval) + val |= D_KBD_KEYDOWN; + if(val == 0x8826 || val == 0x884a) { + nmi_active = true; + int_nmi_cb(true); + } else if(nmi_active) { + nmi_active = false; + int_nmi_cb(false); + } + fifo_push(val | D_MASTER | km_address); + send(); + break; + } + + case 3: + if(newval) + modifiers_state |= field.mask(); + else + modifiers_state &= ~field.mask(); + fifo_push(modifiers_state | D_MASTER | km_address); + + send(); + break; + + case 4: + if(field.mask() & 1) + int_power_cb(newval & 1); + break; + } +} + +void nextkbd_device::handle_fifo_command() +{ + logerror("%s: Fifo command %08x?\n", tag(), cdata); + fifo_ir = 0; + fifo_iw = 0; + fifo_size = 0; + memset(fifo, 0, sizeof(fifo)); + if(ctrl_kms & C_KBD_INTERRUPT) + int_change_cb(false); + ctrl_kms &= ~(C_KBD_INTERRUPT|C_KBD_DATA); +} + +void nextkbd_device::handle_kbd_command() +{ + switch(cdata >> 24) { + case 0x00: + logerror("%s: Keyboard LED control %06x?\n", tag(), cdata & 0xffffff); + ctrl_kms |= C_KBD_DATA; // Hmmmm. The rom wants it, but I'm not sure if data is actually expected + break; + + case 0xef: + logerror("%s: Set keyboard/mouse address to %d\n", tag(), (cdata >> 17) & 7); + km_address = ((cdata >> 17) & 7) << 25; + ctrl_kms |= C_KBD_DATA; // Hmmmm. The rom wants it, but I'm not sure if data is actually expected + break; + + default: + logerror("%s: Unhandled keyboard command %02x.%06x\n", tag(), cdata >> 24, cdata & 0xffffff); + break; + } +} + +void nextkbd_device::handle_command() +{ + switch(ctrl_cmd) { + case 0xc5: + handle_kbd_command(); + break; + + case 0xc6: + handle_fifo_command(); + break; + + default: + logerror("%s: Unhandled command %02x.%08x\n", tag(), ctrl_cmd, cdata); + break; + } +} + +static INPUT_PORTS_START(nextkbd_keymap) + PORT_START("0") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) + PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) + PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x02000000, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) + PORT_BIT(0x04000000, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) + PORT_BIT(0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + + PORT_START("1") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) // Keypad = ? + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) + PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START("2") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0xfffe0000, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) + + PORT_START("modifiers") + PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_NAME("Control") + PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("Shift (Left)") + PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("Shift (Right)") + PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_LWIN) PORT_NAME("Command (Left)") + PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_RWIN) PORT_NAME("Command (Right)") + PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_NAME("Alt (Left)") + PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Alt (Right)") + PORT_BIT(0xffff80ff, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) + + PORT_START("special") + PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 4) PORT_CODE(KEYCODE_HOME) PORT_NAME("Power") + PORT_BIT(0xfffffffe, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 4) + + PORT_START("mousex") + PORT_BIT( 0x00ff, 0, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(1) + + PORT_START("mousey") + PORT_BIT( 0x00ff, 0, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(1) + + PORT_START("mousebtn") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) +INPUT_PORTS_END + +ioport_constructor nextkbd_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(nextkbd_keymap); +} diff --git a/src/mame/machine/nextkbd.h b/src/mame/machine/nextkbd.h new file mode 100644 index 00000000000..e0be0c7836c --- /dev/null +++ b/src/mame/machine/nextkbd.h @@ -0,0 +1,121 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +#ifndef __NEXTKBD_H__ +#define __NEXTKBD_H__ + +#include "emu.h" + +#define MCFG_NEXTKBD_INT_CHANGE_CALLBACK(_write) \ + devcb = &nextkbd_device::set_int_change_wr_callback(*device, DEVCB_##_write); + +#define MCFG_NEXTKBD_INT_POWER_CALLBACK(_write) \ + devcb = &nextkbd_device::set_int_power_wr_callback(*device, DEVCB_##_write); + +#define MCFG_NEXTKBD_INT_NMI_CALLBACK(_write) \ + devcb = &nextkbd_device::set_int_nmi_wr_callback(*device, DEVCB_##_write); + +class nextkbd_device : public device_t { +public: + nextkbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_int_change_wr_callback(device_t &device, _Object object) { return downcast(device).int_change_cb.set_callback(object); } + template static devcb_base &set_int_power_wr_callback(device_t &device, _Object object) { return downcast(device).int_power_cb.set_callback(object); } + template static devcb_base &set_int_nmi_wr_callback(device_t &device, _Object object) { return downcast(device).int_nmi_cb.set_callback(object); } + + DECLARE_ADDRESS_MAP(amap, 32); + + DECLARE_READ8_MEMBER(status_snd_r); + DECLARE_READ8_MEMBER(status_kms_r); + DECLARE_READ8_MEMBER(status_dma_r); + DECLARE_READ8_MEMBER(status_cmd_r); + DECLARE_READ32_MEMBER(cdata_r); + DECLARE_READ32_MEMBER(kmdata_r); + + DECLARE_WRITE8_MEMBER(ctrl_snd_w); + DECLARE_WRITE8_MEMBER(ctrl_kms_w); + DECLARE_WRITE8_MEMBER(ctrl_dma_w); + DECLARE_WRITE8_MEMBER(ctrl_cmd_w); + DECLARE_WRITE32_MEMBER(cdata_w); + DECLARE_WRITE32_MEMBER(kmdata_w); + + bool int_level_get(); + + DECLARE_INPUT_CHANGED_MEMBER(update); + +protected: + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual ioport_constructor device_input_ports() const; + +private: + // Big thanks to the previous emulator for that information + enum { + C_SOUND_OUT_ENABLE = 0x80, // rw + C_SOUND_OUT_REQUEST = 0x40, // r + C_SOUND_OUT_UNDERRUN = 0x20, // rw + C_SOUND_IN_ENABLE = 0x08, // rw + C_SOUND_IN_REQUEST = 0x04, // r + C_SOUND_IN_OVERRUN = 0x02, // rw + C_SOUND_WMASK = 0xaa, + + C_KBD_INTERRUPT = 0x80, // r + C_KBD_DATA = 0x40, // r + C_KBD_OVERRUN = 0x20, // rw + C_KBD_NMI = 0x10, // rw? + C_KMS_INTERRUPT = 0x08, // r + C_KMS_DATA = 0x04, // r + C_KMS_OVERRUN = 0x02, // rw + C_KMS_WMASK = 0x22, + + C_SDMA_OUT_PENDING = 0x80, // r + C_SDMA_OUT_RUNNING = 0x40, // r + C_CDMA_PENDING = 0x20, // r + C_CDMA_RUNNING = 0x10, // r + C_KMS_ENABLE = 0x02, // rw + C_LOOPBACK = 0x01, // rw + C_WMASK = 0x03, + + D_ERROR = 0x40000000, + D_USER = 0x20000000, + D_MASTER = 0x10000000, + D_SECONDARY = 0x01000000, + D_VERSION_OLD = 0x00000000, + D_VERSION_NEW = 0x00010000, + D_VERSION_DIGITAL = 0x00020000, + + D_KBD_VALID = 0x00008000, + D_KBD_KEYDOWN = 0x00000080 + }; + + enum { FIFO_SIZE = 32 }; + + devcb_write_line int_change_cb, int_power_cb, int_nmi_cb; + required_ioport mousex; + required_ioport mousey; + required_ioport mousebtn; + + emu_timer *poll_timer; + bool nmi_active; + + UINT32 cdata, kmdata, fifo_ir, fifo_iw, fifo_size; + UINT32 fifo[FIFO_SIZE]; + UINT32 km_address; + UINT32 prev_mousex, prev_mousey, prev_mousebtn; + UINT16 modifiers_state; + UINT8 ctrl_snd, ctrl_kms, ctrl_dma, ctrl_cmd; + + void fifo_push(UINT32 val); + UINT32 fifo_pop(); + bool fifo_empty() const; + + void update_mouse(bool force_update); + void send(); + void handle_fifo_command(); + void handle_kbd_command(); + void handle_command(); +}; + +extern const device_type NEXTKBD; + +#endif diff --git a/src/mame/machine/nextmo.c b/src/mame/machine/nextmo.c new file mode 100644 index 00000000000..20cfba9aa6c --- /dev/null +++ b/src/mame/machine/nextmo.c @@ -0,0 +1,198 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +#include "emu.h" +#include "nextmo.h" + +const device_type NEXTMO = &device_creator; + +DEVICE_ADDRESS_MAP_START(map, 8, nextmo_device) + AM_RANGE(0x04, 0x04) AM_READWRITE(r4_r, r4_w) + AM_RANGE(0x05, 0x05) AM_READWRITE(r5_r, r5_w) + AM_RANGE(0x06, 0x06) AM_READWRITE(r6_r, r6_w) + AM_RANGE(0x07, 0x07) AM_READWRITE(r7_r, r7_w) + AM_RANGE(0x08, 0x08) AM_READWRITE(r8_r, r8_w) + AM_RANGE(0x09, 0x09) AM_READWRITE(r9_r, r9_w) + AM_RANGE(0x0a, 0x0a) AM_READWRITE(ra_r, ra_w) + AM_RANGE(0x0b, 0x0b) AM_READWRITE(rb_r, rb_w) + AM_RANGE(0x10, 0x17) AM_READWRITE(r10_r, r10_w) +ADDRESS_MAP_END + +nextmo_device::nextmo_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEXTMO, "NeXT Magneto-optical drive", tag, owner, clock, "nextmo", __FILE__), + r4(0), + irq_cb(*this), + drq_cb(*this) +{ +} + +void nextmo_device::device_start() +{ + irq_cb.resolve_safe(); + drq_cb.resolve_safe(); +} + +void nextmo_device::device_reset() +{ +} + +READ8_MEMBER(nextmo_device::r4_r) +{ + logerror("nextmo: r4_r %02x (%08x)\n", r4, space.device().safe_pc()); + return r4; +} + +WRITE8_MEMBER(nextmo_device::r4_w) +{ + if(r4 & 1) + device_reset(); + r4 = (r4 & (~data & 0xfc)) | (data & 3); + logerror("nextmo: r4_w %02x (%08x)\n", r4, space.device().safe_pc()); +} + +READ8_MEMBER(nextmo_device::r5_r) +{ + logerror("nextmo: r5_r %02x (%08x)\n", r5, space.device().safe_pc()); + return r5; +} + +WRITE8_MEMBER(nextmo_device::r5_w) +{ + r5 = data; + logerror("nextmo: r5_w %02x (%08x)\n", r5, space.device().safe_pc()); +} + +READ8_MEMBER(nextmo_device::r6_r) +{ + logerror("nextmo: r6_r %02x (%08x)\n", r6, space.device().safe_pc()); + return r6; +} + +WRITE8_MEMBER(nextmo_device::r6_w) +{ + r6 = data; + logerror("nextmo: r6_w %02x (%08x)\n", r6, space.device().safe_pc()); +} + +READ8_MEMBER(nextmo_device::r7_r) +{ + logerror("nextmo: r7_r %02x (%08x)\n", r7, space.device().safe_pc()); + return r7; +} + +WRITE8_MEMBER(nextmo_device::r7_w) +{ + r7 = data; + logerror("nextmo: r7_w %02x (%08x)\n", r7, space.device().safe_pc()); + if(r7 & 0xc0) { + logerror("nextmo: start dma %02x %02x\n", r6, r7); + sector_pos = 0; + if(!drq_cb.isnull()) + drq_cb(true); + } +} + +UINT8 nextmo_device::dma_r() +{ + UINT8 r = 0; + if(r7 & 0x80) + r = sector[sector_pos++]; + check_dma_end(); + return r; +} + +void nextmo_device::dma_w(UINT8 data) +{ + if(r7 & 0x40) + sector[sector_pos++] = data; + check_dma_end(); +} + +void nextmo_device::check_dma_end() +{ + int limit; + if(r7 & 0x40) + limit = r6 & 0x20 ? 0x510 : 0x400; + else + limit = r6 & 0x20 ? 0x400 : 0x510; + if(sector_pos == limit) { + if(!drq_cb.isnull()) + drq_cb(false); + if(r7 & 0x40) { + if(r6 & 0x20) + check_ecc(); + else + compute_ecc(); + } + r7 &= 0x3f; + r4 |= 0x08; + } +} + +READ8_MEMBER(nextmo_device::r8_r) +{ + logerror("nextmo: r8_r (%08x)\n", space.device().safe_pc()); + return 0x00; +} + +WRITE8_MEMBER(nextmo_device::r8_w) +{ + logerror("nextmo: r8_w %02x (%08x)\n", data, space.device().safe_pc()); +} + +READ8_MEMBER(nextmo_device::r9_r) +{ + logerror("nextmo: r9_r (%08x)\n", space.device().safe_pc()); + return 0x00; +} + +WRITE8_MEMBER(nextmo_device::r9_w) +{ + logerror("nextmo: r9_w %02x (%08x)\n", data, space.device().safe_pc()); +} + +READ8_MEMBER(nextmo_device::ra_r) +{ + logerror("nextmo: ra_r (%08x)\n", space.device().safe_pc()); + return 0x00; +} + +WRITE8_MEMBER(nextmo_device::ra_w) +{ + logerror("nextmo: ra_w %02x (%08x)\n", data, space.device().safe_pc()); +} + +READ8_MEMBER(nextmo_device::rb_r) +{ + logerror("nextmo: rb_r (%08x)\n", space.device().safe_pc()); + return 0x24; +} + +WRITE8_MEMBER(nextmo_device::rb_w) +{ + logerror("nextmo: rb_w %02x (%08x)\n", data, space.device().safe_pc()); +} + +READ8_MEMBER(nextmo_device::r10_r) +{ + logerror("nextmo: r10_r %d (%08x)\n", offset, space.device().safe_pc()); + return 0x00; +} + +WRITE8_MEMBER(nextmo_device::r10_w) +{ + logerror("nextmo: r10_w %d, %02x (%08x)\n", offset, data, space.device().safe_pc()); +} + +void nextmo_device::check_ecc() +{ + logerror("nextmo: check_ecc\n"); + for(int i=0; i<0x400; i++) + sector[i] = i; +} + +void nextmo_device::compute_ecc() +{ + logerror("nextmo: compute_ecc\n"); + memset(sector+0x400, 0, 0x110); +} diff --git a/src/mame/machine/nextmo.h b/src/mame/machine/nextmo.h new file mode 100644 index 00000000000..427d9d81862 --- /dev/null +++ b/src/mame/machine/nextmo.h @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +#ifndef NEXTMO_H +#define NEXTMO_H + +#define MCFG_NEXTMO_IRQ_CALLBACK(_write) \ + devcb = &nextmo_device::set_irq_wr_callback(*device, DEVCB_##_write); + +#define MCFG_NEXTMO_DRQ_CALLBACK(_write) \ + devcb = &nextmo_device::set_drq_wr_callback(*device, DEVCB_##_write); + +class nextmo_device : public device_t +{ +public: + nextmo_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).irq_cb.set_callback(object); } + template static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast(device).drq_cb.set_callback(object); } + + DECLARE_ADDRESS_MAP(map, 32); + + DECLARE_READ8_MEMBER(r4_r); + DECLARE_WRITE8_MEMBER(r4_w); + DECLARE_READ8_MEMBER(r5_r); + DECLARE_WRITE8_MEMBER(r5_w); + DECLARE_READ8_MEMBER(r6_r); + DECLARE_WRITE8_MEMBER(r6_w); + DECLARE_READ8_MEMBER(r7_r); + DECLARE_WRITE8_MEMBER(r7_w); + DECLARE_READ8_MEMBER(r8_r); + DECLARE_WRITE8_MEMBER(r8_w); + DECLARE_READ8_MEMBER(r9_r); + DECLARE_WRITE8_MEMBER(r9_w); + DECLARE_READ8_MEMBER(ra_r); + DECLARE_WRITE8_MEMBER(ra_w); + DECLARE_READ8_MEMBER(rb_r); + DECLARE_WRITE8_MEMBER(rb_w); + DECLARE_READ8_MEMBER(r10_r); + DECLARE_WRITE8_MEMBER(r10_w); + + UINT8 dma_r(); + void dma_w(UINT8 data); + +protected: + virtual void device_start(); + virtual void device_reset(); + +private: + UINT8 sector[0x510]; + UINT8 r4, r5, r6, r7; + devcb_write_line irq_cb, drq_cb; + int sector_pos; + + void check_dma_end(); + void check_ecc(); + void compute_ecc(); +}; + +extern const device_type NEXTMO; + +#endif diff --git a/src/mame/machine/ngen_kb.c b/src/mame/machine/ngen_kb.c new file mode 100644 index 00000000000..4c901ea5d41 --- /dev/null +++ b/src/mame/machine/ngen_kb.c @@ -0,0 +1,231 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +// Convergent NGEN keyboard device + +#include "ngen_kb.h" + +ngen_keyboard_device::ngen_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : + serial_keyboard_device(mconfig, NGEN_KEYBOARD, "NGEN Keyboard", tag, owner, 0, "ngen_keyboard", __FILE__), + m_keys_down(false) +{ +} + + +void ngen_keyboard_device::write(UINT8 data) +{ + // To be figured out + // Code 0x92 is sent on startup, perhaps resets the keyboard MCU + // Codes 0xAx and 0xBx appear to control the keyboard LEDs, lower nibbles controlling the state of the LEDs + // When setting an error code via the LEDs, 0xB0 then 0xAE is sent (presumably for error code 0xE0), + // so that means that 0xAx controls the Overtype, Lock, F1 and F2 LEDs, and 0xBx controls the F3, F8, F9 and F10 LEDs. + logerror("KB: received character %02x\n",data); + switch(data) + { + case 0x92: // reset(?) + m_last_reset = true; + break; + } +} + +UINT8 ngen_keyboard_device::row_number(UINT8 code) +{ + if BIT(code,0) return 0; + if BIT(code,1) return 1; + if BIT(code,2) return 2; + if BIT(code,3) return 3; + if BIT(code,4) return 4; + if BIT(code,5) return 5; + if BIT(code,6) return 6; + if BIT(code,7) return 7; + return 0; +} + +UINT8 ngen_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) +{ + int i; + UINT8 code = 0; + UINT8 key_code = 0; + UINT8 retVal = 0x00; + UINT8 shift = BIT(m_io_kbdc->read(), 1); + UINT8 caps = BIT(m_io_kbdc->read(), 2); + UINT8 ctrl = BIT(m_io_kbdc->read(), 0); + i = *scan_line; + { + if (i == 0) code = m_io_kbd0->read(); + else + if (i == 1) code = m_io_kbd1->read(); + else + if (i == 2) code = m_io_kbd2->read(); + else + if (i == 3) code = m_io_kbd3->read(); + else + if (i == 4) code = m_io_kbd4->read(); + else + if (i == 5) code = m_io_kbd5->read(); + else + if (i == 6) code = m_io_kbd6->read(); + else + if (i == 7) code = m_io_kbd7->read(); + else + if (i == 8) code = m_io_kbd8->read(); + else + if (i == 9) code = m_io_kbd9->read(); + + if (code != 0) + { + if (i==0 && shift==0) { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } + if (i==0 && shift==1) { + key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers + } + if (i==1 && shift==0) { + if (row_number(code) < 4) { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } else { + key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs + } + } + if (i==1 && shift==1) { + if (row_number(code) < 4) { + key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs + } else { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } + } + if (i>=2 && i<=4 && (shift ^ caps)==0 && ctrl==0) { + key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters + } + if (i>=2 && i<=4 && (shift ^ caps)==1 && ctrl==0) { + key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters + } + if (i>=2 && i<=5 && ctrl==1) { + key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters + } + if (i==5 && shift==1 && ctrl==0) { + if (row_number(code)<7) { + if (row_number(code)<3) { + key_code = (caps ? 0x60 : 0x40) + row_number(code) + (i-2)*8; // for big letters + } else { + key_code = 0x60 + row_number(code) + (i-2)*8; // for upper symbols letters + } + } else { + key_code = 0x40 + row_number(code) + (i-2)*8; // for DEL it is switched + } + } + if (i==5 && shift==0 && ctrl==0) { + if (row_number(code)<7) { + if (row_number(code)<3) { + key_code = (caps ? 0x40 : 0x60) + row_number(code) + (i-2)*8; // for small letters + } else { + key_code = 0x40 + row_number(code) + (i-2)*8; // for lower symbols letters + } + } else { + key_code = 0x60 + row_number(code) + (i-2)*8; // for DEL it is switched + } + } + + if (i==6) { + switch(row_number(code)) + { +/* case 0: key_code = 0x11; break; + case 1: key_code = 0x12; break; + case 2: key_code = 0x13; break; + case 3: key_code = 0x14; break;*/ + case 4: key_code = 0x20; break; // Space + case 5: key_code = 0x0A; break; // LineFeed + case 6: key_code = 0x09; break; // TAB + case 7: key_code = 0x0D; break; // Enter + } + } + if (i==7) + { + switch(row_number(code)) + { + case 0: key_code = 0x1B; break; // Escape + case 1: key_code = 0x08; break; // Backspace + } + } + else + if (i==8) + { + key_code = row_number(code)+0x81; + if (ctrl) key_code+=0x10; + if (shift) key_code+=0x20; + } + else + if (i==9) + { + key_code = row_number(code)+0x89; + if (ctrl) key_code+=0x10; + if (shift) key_code+=0x20; + } + m_keys_down = true; + m_last_reset = false; + retVal = key_code; + } + else + { + *scan_line += 1; + if (*scan_line==10) + *scan_line = 0; + if(m_keys_down) + { + retVal = 0xc0; + m_keys_down = false; + } + } + } + return retVal; +} + +static INPUT_PORTS_START( ngen_keyboard ) + PORT_INCLUDE(generic_keyboard) + + PORT_START("RS232_TXBAUD") + PORT_CONFNAME(0xff, RS232_BAUD_19200, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_BAUD_19200, "19200") // TODO: Based on the RAM refresh timer (~78kHz) to be 19530Hz + + PORT_START("RS232_STARTBITS") + PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STARTBITS_1, "1") + + PORT_START("RS232_DATABITS") + PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_DATABITS_8, "8") + + PORT_START("RS232_PARITY") + PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_PARITY_NONE, "None") + + PORT_START("RS232_STOPBITS") + PORT_CONFNAME(0xff, RS232_STOPBITS_2, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STOPBITS_2, "2") +INPUT_PORTS_END + + +ioport_constructor ngen_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(ngen_keyboard); +} + +void ngen_keyboard_device::device_start() +{ + serial_keyboard_device::device_start(); + set_rcv_rate(19200); +} + +void ngen_keyboard_device::device_reset() +{ + serial_keyboard_device::device_reset(); + m_keys_down = false; + m_last_reset = true; +} + +void ngen_keyboard_device::rcv_complete() +{ + receive_register_extract(); + write(get_received_char()); +} + +const device_type NGEN_KEYBOARD = &device_creator; diff --git a/src/mame/machine/ngen_kb.h b/src/mame/machine/ngen_kb.h new file mode 100644 index 00000000000..4daa72422f4 --- /dev/null +++ b/src/mame/machine/ngen_kb.h @@ -0,0 +1,33 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +// Convergent NGEN keyboard + +#ifndef NGEN_KB_H_ +#define NGEN_KB_H_ + +#include "bus/rs232/keyboard.h" + +class ngen_keyboard_device : public serial_keyboard_device +{ +public: + ngen_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ioport_constructor device_input_ports() const; + virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) { device_serial_interface::rx_w(state); } + +protected: + virtual void device_start(); + virtual void device_reset(); + virtual void rcv_complete(); + +private: + virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); + UINT8 row_number(UINT8 code); + void write(UINT8 data); + + bool m_keys_down; + bool m_last_reset; +}; + +extern const device_type NGEN_KEYBOARD; + +#endif /* NGENKB_H_ */ diff --git a/src/mame/machine/ondra.c b/src/mame/machine/ondra.c new file mode 100644 index 00000000000..ca9d927217d --- /dev/null +++ b/src/mame/machine/ondra.c @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Ondra driver by Miodrag Milanovic + + 08/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "includes/ondra.h" + + +READ8_MEMBER(ondra_state::ondra_keyboard_r) +{ + UINT8 retVal = 0x00; + double valcas = m_cassette->input(); + + if ( valcas < 0.00) { + retVal = 0x80; + } + + switch ( offset & 0x0f ) + { + case 0: retVal |= m_line0->read(); break; + case 1: retVal |= m_line1->read(); break; + case 2: retVal |= m_line2->read(); break; + case 3: retVal |= m_line3->read(); break; + case 4: retVal |= m_line4->read(); break; + case 5: retVal |= m_line5->read(); break; + case 6: retVal |= m_line6->read(); break; + case 7: retVal |= m_line7->read(); break; + case 8: retVal |= m_line8->read(); break; + case 9: retVal |= m_line9->read(); break; + default: retVal |= 0x1f; break; + } + + return retVal; +} + +void ondra_state::ondra_update_banks() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *mem = m_region_maincpu->base(); + + if (m_bank1_status==0) { + space.unmap_write(0x0000, 0x3fff); + m_bank1->set_base(mem + 0x010000); + } else { + space.install_write_bank(0x0000, 0x3fff, "bank1"); + m_bank1->set_base(m_ram->pointer() + 0x0000); + } + m_bank2->set_base(m_ram->pointer() + 0x4000); + if (m_bank2_status==0) { + space.install_readwrite_bank(0xe000, 0xffff, "bank3"); + m_bank3->set_base(m_ram->pointer() + 0xe000); + } else { + space.unmap_write(0xe000, 0xffff); + space.install_read_handler (0xe000, 0xffff, read8_delegate(FUNC(ondra_state::ondra_keyboard_r),this)); + } +} + +WRITE8_MEMBER(ondra_state::ondra_port_03_w) +{ + m_video_enable = data & 1; + m_bank1_status = (data >> 1) & 1; + m_bank2_status = (data >> 2) & 1; + ondra_update_banks(); + m_cassette->output(((data >> 3) & 1) ? -1.0 : +1.0); +} + +WRITE8_MEMBER(ondra_state::ondra_port_09_w) +{ +} + +WRITE8_MEMBER(ondra_state::ondra_port_0a_w) +{ +} + +TIMER_CALLBACK_MEMBER(ondra_state::nmi_check_callback) +{ + if ((m_nmi->read() & 1) == 1) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } +} + +void ondra_state::machine_reset() +{ + m_bank1_status = 0; + m_bank2_status = 0; + ondra_update_banks(); +} + +void ondra_state::machine_start() +{ + machine().scheduler().timer_pulse(attotime::from_hz(10), timer_expired_delegate(FUNC(ondra_state::nmi_check_callback),this)); +} diff --git a/src/mame/machine/orao.c b/src/mame/machine/orao.c new file mode 100644 index 00000000000..5540d9092fb --- /dev/null +++ b/src/mame/machine/orao.c @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Orao machine driver by Miodrag Milanovic + + 23/02/2008 Sound support added. + 22/02/2008 Preliminary driver. + +****************************************************************************/ + +#include "emu.h" +#include "sound/dac.h" +#include "imagedev/cassette.h" +#include "includes/orao.h" + + +/* Driver initialization */ +DRIVER_INIT_MEMBER(orao_state,orao) +{ + memset(m_memory,0xff,0x6000); +} + +DRIVER_INIT_MEMBER(orao_state,orao103) +{ + memset(m_memory,0xff,0x6000); +} + +void orao_state::machine_reset() +{ +} + +READ8_MEMBER(orao_state::orao_io_r) +{ + double level; + + switch(offset) { + /* Keyboard*/ + case 0x07FC : return m_line[0]->read(); + case 0x07FD : return m_line[1]->read(); + case 0x07FA : return m_line[2]->read(); + case 0x07FB : return m_line[3]->read(); + case 0x07F6 : return m_line[4]->read(); + case 0x07F7 : return m_line[5]->read(); + case 0x07EE : return m_line[6]->read(); + case 0x07EF : return m_line[7]->read(); + case 0x07DE : return m_line[8]->read(); + case 0x07DF : return m_line[9]->read(); + case 0x07BE : return m_line[10]->read(); + case 0x07BF : return m_line[11]->read(); + case 0x077E : return m_line[12]->read(); + case 0x077F : return m_line[13]->read(); + case 0x06FE : return m_line[14]->read(); + case 0x06FF : return m_line[15]->read(); + case 0x05FE : return m_line[16]->read(); + case 0x05FF : return m_line[17]->read(); + case 0x03FE : return m_line[18]->read(); + case 0x03FF : return m_line[19]->read(); + /* Tape */ + case 0x07FF : + level = m_cassette->input(); + if (level < 0) { + return 0x00; + } + return 0xff; + } + + + return 0xff; +} + + +WRITE8_MEMBER(orao_state::orao_io_w) +{ + if (offset == 0x0800) + { + m_speaker->level_w(m_beep); + m_beep ^= 1; + } +} diff --git a/src/mame/machine/orion.c b/src/mame/machine/orion.c new file mode 100644 index 00000000000..4556778597b --- /dev/null +++ b/src/mame/machine/orion.c @@ -0,0 +1,594 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Orion machine driver by Miodrag Milanovic + + 22/04/2008 Orion Pro added + 02/04/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" +#include "includes/orion.h" + +#define SCREEN_WIDTH_384 48 +#define SCREEN_WIDTH_480 60 +#define SCREEN_WIDTH_512 64 + + + +READ8_MEMBER(orion_state::orion_romdisk_porta_r) +{ + UINT16 addr = (m_romdisk_msb << 8) | m_romdisk_lsb; + if (m_cart->exists() && addr < m_cart->get_rom_size()) + return m_cart->read_rom(space, addr); + else + return 0xff; +} + +WRITE8_MEMBER(orion_state::orion_romdisk_portb_w) +{ + m_romdisk_lsb = data; +} + +WRITE8_MEMBER(orion_state::orion_romdisk_portc_w) +{ + m_romdisk_msb = data; +} + +MACHINE_START_MEMBER(orion_state,orion128) +{ + m_video_mode_mask = 7; +} + +READ8_MEMBER(orion_state::orion128_system_r) +{ + return m_ppi8255_2->read(space, offset & 3); +} + +WRITE8_MEMBER(orion_state::orion128_system_w) +{ + m_ppi8255_2->write(space, offset & 3, data); +} + +READ8_MEMBER(orion_state::orion128_romdisk_r) +{ + return m_ppi8255_1->read(space, offset & 3); +} + +WRITE8_MEMBER(orion_state::orion128_romdisk_w) +{ + m_ppi8255_1->write(space, offset & 3, data); +} + +void orion_state::orion_set_video_mode(int width) +{ + rectangle visarea(0, width-1, 0, 255); + machine().first_screen()->configure(width, 256, visarea, machine().first_screen()->frame_period().attoseconds()); +} + +WRITE8_MEMBER(orion_state::orion128_video_mode_w) +{ + if ((data & 0x80)!=(m_orion128_video_mode & 0x80)) + { + if ((data & 0x80)==0x80) + { + if (m_video_mode_mask == 31) + { + m_orion128_video_width = SCREEN_WIDTH_512; + orion_set_video_mode(512); + } + else + { + m_orion128_video_width = SCREEN_WIDTH_480; + orion_set_video_mode(480); + } + } + else + { + m_orion128_video_width = SCREEN_WIDTH_384; + orion_set_video_mode(384); + } + } + + m_orion128_video_mode = data; +} + +WRITE8_MEMBER(orion_state::orion128_video_page_w) +{ + if (m_orion128_video_page != data) + { + if ((data & 0x80)!=(m_orion128_video_page & 0x80)) + { + if ((data & 0x80)==0x80) + { + if (m_video_mode_mask == 31) + { + m_orion128_video_width = SCREEN_WIDTH_512; + orion_set_video_mode(512); + } + else + { + m_orion128_video_width = SCREEN_WIDTH_480; + orion_set_video_mode(480); + } + } + else + { + m_orion128_video_width = SCREEN_WIDTH_384; + orion_set_video_mode(384); + } + } + } + m_orion128_video_page = data; +} + + +WRITE8_MEMBER(orion_state::orion128_memory_page_w) +{ + if (data!=m_orion128_memory_page ) + { + m_bank1->set_base(m_ram->pointer() + (data & 3) * 0x10000); + m_orion128_memory_page = (data & 3); + } +} + +MACHINE_RESET_MEMBER(orion_state,orion128) +{ + m_orion128_video_page = 0; + m_orion128_video_mode = 0; + m_orion128_memory_page = -1; + m_bank1->set_base(m_region_maincpu->base() + 0xf800); + m_bank2->set_base(m_ram->pointer() + 0xf000); + m_orion128_video_width = SCREEN_WIDTH_384; + orion_set_video_mode(384); + radio86_init_keyboard(); +} + +WRITE8_MEMBER(orion_state::orion_disk_control_w) +{ + floppy_connector *names[] = { m_fd0, m_fd1, m_fd2, m_fd3}; + floppy_image_device *floppy = names[data & 3]->get_device(); + + m_fdc->set_floppy(floppy); + floppy->mon_w(0); + floppy->ss_w(((data & 0x10) >> 4) ^ 1); +} + +READ8_MEMBER(orion_state::orion128_floppy_r) +{ + switch(offset) + { + case 0x0 : + case 0x10 : return m_fdc->status_r(space, 0); + case 0x1 : + case 0x11 : return m_fdc->track_r(space, 0); + case 0x2 : + case 0x12 : return m_fdc->sector_r(space, 0); + case 0x3 : + case 0x13 : return m_fdc->data_r(space, 0); + } + return 0xff; +} + +WRITE8_MEMBER(orion_state::orion128_floppy_w) +{ + switch(offset) + { + case 0x0 : + case 0x10 : m_fdc->cmd_w(space, 0,data); break; + case 0x1 : + case 0x11 : m_fdc->track_w(space, 0,data);break; + case 0x2 : + case 0x12 : m_fdc->sector_w(space, 0,data);break; + case 0x3 : + case 0x13 : m_fdc->data_w(space, 0,data);break; + case 0x4 : + case 0x14 : + case 0x20 : orion_disk_control_w(space, offset, data);break; + } +} +READ8_MEMBER(orion_state::orionz80_floppy_rtc_r) +{ + if ((offset >= 0x60) && (offset <= 0x6f)) + { + return m_rtc->read(space,offset-0x60); + } + else + { + return orion128_floppy_r(space,offset); + } +} + +WRITE8_MEMBER(orion_state::orionz80_floppy_rtc_w) +{ + if ((offset >= 0x60) && (offset <= 0x6f)) + { + m_rtc->write(space,offset-0x60,data); + } + else + { + orion128_floppy_w(space,offset,data); + } +} + + +MACHINE_START_MEMBER(orion_state,orionz80) +{ + m_video_mode_mask = 7; +} + +WRITE8_MEMBER(orion_state::orionz80_sound_w) +{ + if (m_speaker_data == 0) + { + m_speaker_data = data; + } + else + { + m_speaker_data = 0; + } + m_speaker->level_w(m_speaker_data); + +} + +WRITE8_MEMBER(orion_state::orionz80_sound_fe_w) +{ + m_speaker->level_w(BIT(data, 4)); +} + + +void orion_state::orionz80_switch_bank() +{ + UINT8 bank_select; + UINT8 segment_select; + address_space &space = m_maincpu->space(AS_PROGRAM); + + bank_select = (m_orionz80_dispatcher & 0x0c) >> 2; + segment_select = m_orionz80_dispatcher & 0x03; + + space.install_write_bank(0x0000, 0x3fff, "bank1"); + if ((m_orionz80_dispatcher & 0x80)==0) + { // dispatcher on + m_bank1->set_base(m_ram->pointer() + 0x10000 * bank_select + segment_select * 0x4000 ); + } + else + { // dispatcher off + m_bank1->set_base(m_ram->pointer() + 0x10000 * m_orionz80_memory_page); + } + + m_bank2->set_base(m_ram->pointer() + 0x4000 + 0x10000 * m_orionz80_memory_page); + + if ((m_orionz80_dispatcher & 0x20) == 0) + { + space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this)); + space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this)); + space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orionz80_floppy_rtc_w),this)); + space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this)); + space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this)); + space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orionz80_floppy_rtc_r),this)); + + space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this)); + space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionz80_memory_page_w),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(orion_state::orionz80_dispatcher_w),this)); + space.unmap_write(0xfc00, 0xfeff); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); + + m_bank3->set_base(m_ram->pointer() + 0xf000); + m_bank5->set_base(m_region_maincpu->base() + 0xf800); + + } + else + { + /* if it is full memory access */ + m_bank3->set_base(m_ram->pointer() + 0xf000 + 0x10000 * m_orionz80_memory_page); + m_bank4->set_base(m_ram->pointer() + 0xf400 + 0x10000 * m_orionz80_memory_page); + m_bank5->set_base(m_ram->pointer() + 0xf800 + 0x10000 * m_orionz80_memory_page); + } +} + +WRITE8_MEMBER(orion_state::orionz80_memory_page_w) +{ + m_orionz80_memory_page = data & 7; + orionz80_switch_bank(); +} + +WRITE8_MEMBER(orion_state::orionz80_dispatcher_w) +{ + m_orionz80_dispatcher = data; + orionz80_switch_bank(); +} + +MACHINE_RESET_MEMBER(orion_state,orionz80) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.unmap_write(0x0000, 0x3fff); + space.install_write_bank(0x4000, 0xefff, "bank2"); + space.install_write_bank(0xf000, 0xf3ff, "bank3"); + + space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this)); + space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this)); + space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orionz80_floppy_rtc_w),this)); + space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this)); + space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this)); + space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orionz80_floppy_rtc_r),this)); + + space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this)); + space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionz80_memory_page_w),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(orion_state::orionz80_dispatcher_w),this)); + space.unmap_write(0xfc00, 0xfeff); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); + + + m_bank1->set_base(m_region_maincpu->base() + 0xf800); + m_bank2->set_base(m_ram->pointer() + 0x4000); + m_bank3->set_base(m_ram->pointer() + 0xf000); + m_bank5->set_base(m_region_maincpu->base() + 0xf800); + + + m_orion128_video_page = 0; + m_orion128_video_mode = 0; + m_orionz80_memory_page = 0; + m_orionz80_dispatcher = 0; + m_speaker_data = 0; + m_orion128_video_width = SCREEN_WIDTH_384; + orion_set_video_mode(384); + radio86_init_keyboard(); +} + +INTERRUPT_GEN_MEMBER(orion_state::orionz80_interrupt) +{ + if ((m_orionz80_dispatcher & 0x40)==0x40) + { + device.execute().set_input_line(0, HOLD_LINE); + } +} + +READ8_MEMBER(orion_state::orionz80_io_r) +{ + if (offset == 0xFFFD) + { + return m_ay8912->data_r(space, 0); + } + return 0xff; +} + +WRITE8_MEMBER(orion_state::orionz80_io_w) +{ + switch (offset & 0xff) + { + case 0xf8 : orion128_video_mode_w(space,0,data);break; + case 0xf9 : orionz80_memory_page_w(space,0,data);break; + case 0xfa : orion128_video_page_w(space,0,data);break; + case 0xfb : orionz80_dispatcher_w(space,0,data);break; + case 0xfe : orionz80_sound_fe_w(space,0,data);break; + case 0xff : orionz80_sound_w(space,0,data);break; + } + switch(offset) + { + case 0xfffd : m_ay8912->address_w(space, 0, data); + break; + case 0xbffd : + case 0xbefd : m_ay8912->data_w(space, 0, data); + break; + } +} + + + + + + + +void orion_state::orionpro_bank_switch() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int page = m_orionpro_page & 7; // we have only 8 pages + int is128 = (m_orionpro_dispatcher & 0x80) ? 1 : 0; + UINT8 *ram = m_ram->pointer(); + + if (is128==1) + { + page = m_orionpro_128_page & 7; + } + space.install_write_bank(0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x2000, 0x3fff, "bank2"); + space.install_write_bank(0x4000, 0x7fff, "bank3"); + space.install_write_bank(0x8000, 0xbfff, "bank4"); + space.install_write_bank(0xc000, 0xefff, "bank5"); + space.install_write_bank(0xf000, 0xf3ff, "bank6"); + space.install_write_bank(0xf400, 0xf7ff, "bank7"); + space.install_write_bank(0xf800, 0xffff, "bank8"); + + + if ((m_orionpro_dispatcher & 0x01)==0x00) + { // RAM0 segment disabled + m_bank1->set_base(ram + 0x10000 * page); + m_bank2->set_base(ram + 0x10000 * page + 0x2000); + } + else + { + m_bank1->set_base(ram + (m_orionpro_ram0_segment & 31) * 0x4000); + m_bank2->set_base(ram + (m_orionpro_ram0_segment & 31) * 0x4000 + 0x2000); + } + if ((m_orionpro_dispatcher & 0x10)==0x10) + { // ROM1 enabled + space.unmap_write(0x0000, 0x1fff); + m_bank1->set_base(m_region_maincpu->base() + 0x20000); + } + if ((m_orionpro_dispatcher & 0x08)==0x08) + { // ROM2 enabled + space.unmap_write(0x2000, 0x3fff); + m_bank2->set_base(m_region_maincpu->base() + 0x22000 + (m_orionpro_rom2_segment & 7) * 0x2000); + } + + if ((m_orionpro_dispatcher & 0x02)==0x00) + { // RAM1 segment disabled + m_bank3->set_base(ram + 0x10000 * page + 0x4000); + } + else + { + m_bank3->set_base(ram + (m_orionpro_ram1_segment & 31) * 0x4000); + } + + if ((m_orionpro_dispatcher & 0x04)==0x00) + { // RAM2 segment disabled + m_bank4->set_base(ram + 0x10000 * page + 0x8000); + } + else + { + m_bank4->set_base(ram + (m_orionpro_ram2_segment & 31) * 0x4000); + } + + m_bank5->set_base(ram + 0x10000 * page + 0xc000); + + if (is128) + { + m_bank6->set_base(ram + 0x10000 * 0 + 0xf000); + + space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this)); + space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this)); + space.unmap_write(0xf600, 0xf6ff); + space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orion128_floppy_w),this)); + space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this)); + space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this)); + space.unmap_read(0xf600, 0xf6ff); + space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orion128_floppy_r),this)); + + space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this)); + space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionpro_memory_page_w),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this)); + space.unmap_write(0xfb00, 0xfeff); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); + + + m_bank8->set_base(ram + 0x10000 * 0 + 0xf800); + } + else + { + if ((m_orionpro_dispatcher & 0x40)==0x40) + { // FIX F000 enabled + m_bank6->set_base(ram + 0x10000 * 0 + 0xf000); + m_bank7->set_base(ram + 0x10000 * 0 + 0xf400); + m_bank8->set_base(ram + 0x10000 * 0 + 0xf800); + } + else + { + m_bank6->set_base(ram + 0x10000 * page + 0xf000); + m_bank7->set_base(ram + 0x10000 * page + 0xf400); + m_bank8->set_base(ram + 0x10000 * page + 0xf800); + } + } +} + +WRITE8_MEMBER(orion_state::orionpro_memory_page_w) +{ + m_orionpro_128_page = data; + orionpro_bank_switch(); +} + +MACHINE_RESET_MEMBER(orion_state,orionpro) +{ + radio86_init_keyboard(); + + m_orion128_video_page = 0; + m_orion128_video_mode = 0; + m_orionpro_ram0_segment = 0; + m_orionpro_ram1_segment = 0; + m_orionpro_ram2_segment = 0; + + m_orionpro_page = 0; + m_orionpro_128_page = 0; + m_orionpro_rom2_segment = 0; + + m_orionpro_dispatcher = 0x50; + orionpro_bank_switch(); + + m_speaker_data = 0; + m_orion128_video_width = SCREEN_WIDTH_384; + orion_set_video_mode(384); + + m_video_mode_mask = 31; + m_orionpro_pseudo_color = 0; +} + +READ8_MEMBER(orion_state::orionpro_io_r) +{ + switch (offset & 0xff) + { + case 0x00 : return 0x56; + case 0x04 : return m_orionpro_ram0_segment; + case 0x05 : return m_orionpro_ram1_segment; + case 0x06 : return m_orionpro_ram2_segment; + case 0x08 : return m_orionpro_page; + case 0x09 : return m_orionpro_rom2_segment; + case 0x0a : return m_orionpro_dispatcher; + case 0x10 : return m_fdc->status_r(space, 0); + case 0x11 : return m_fdc->track_r(space, 0); + case 0x12 : return m_fdc->sector_r(space, 0); + case 0x13 : return m_fdc->data_r(space, 0); + case 0x18 : + case 0x19 : + case 0x1a : + case 0x1b : + return orion128_system_r(space,(offset & 0xff)-0x18); + case 0x28 : return orion128_romdisk_r(space,0); + case 0x29 : return orion128_romdisk_r(space,1); + case 0x2a : return orion128_romdisk_r(space,2); + case 0x2b : return orion128_romdisk_r(space,3); + } + if (offset == 0xFFFD) + { + return m_ay8912->data_r(space, 0); + } + return 0xff; +} + +WRITE8_MEMBER(orion_state::orionpro_io_w) +{ + switch (offset & 0xff) + { + case 0x04 : m_orionpro_ram0_segment = data; orionpro_bank_switch(); break; + case 0x05 : m_orionpro_ram1_segment = data; orionpro_bank_switch(); break; + case 0x06 : m_orionpro_ram2_segment = data; orionpro_bank_switch(); break; + case 0x08 : m_orionpro_page = data; orionpro_bank_switch(); break; + case 0x09 : m_orionpro_rom2_segment = data; orionpro_bank_switch(); break; + case 0x0a : m_orionpro_dispatcher = data; orionpro_bank_switch(); break; + case 0x10 : m_fdc->cmd_w(space, 0,data); break; + case 0x11 : m_fdc->track_w(space, 0,data);break; + case 0x12 : m_fdc->sector_w(space, 0,data);break; + case 0x13 : m_fdc->data_w(space, 0,data);break; + case 0x14 : orion_disk_control_w(space, 9, data);break; + case 0x18 : + case 0x19 : + case 0x1a : + case 0x1b : + orion128_system_w(space,(offset & 0xff)-0x18,data); break; + case 0x28 : orion128_romdisk_w(space,0,data); break; + case 0x29 : orion128_romdisk_w(space,1,data); break; + case 0x2a : orion128_romdisk_w(space,2,data); break; + case 0x2b : orion128_romdisk_w(space,3,data); break; + case 0xf8 : orion128_video_mode_w(space,0,data);break; + case 0xf9 : m_orionpro_128_page = data; orionpro_bank_switch(); break; + case 0xfa : orion128_video_page_w(space,0,data);break; + case 0xfc : m_orionpro_pseudo_color = data;break; + case 0xfe : orionz80_sound_fe_w(space,0,data);break; + case 0xff : orionz80_sound_w(space,0,data);break; + } + switch(offset) + { + case 0xfffd : m_ay8912->address_w(space, 0, data); + break; + case 0xbffd : + case 0xbefd : m_ay8912->data_w(space, 0, data); + break; + } +} diff --git a/src/mame/machine/osborne1.c b/src/mame/machine/osborne1.c new file mode 100644 index 00000000000..84cf5f2db46 --- /dev/null +++ b/src/mame/machine/osborne1.c @@ -0,0 +1,513 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + +There are three IRQ sources: +- IRQ0 +- IRQ1 = IRQA from the video PIA +- IRQ2 = IRQA from the IEEE488 PIA + +Interrupt handling on the Osborne-1 is a bit awkward. When an interrupt is +taken by the Z80 the ROMMODE is enabled on each fetch of an instruction +byte. During execution of an instruction the previous ROMMODE setting seems +to be used. Side effect of this is that when an interrupt is taken and the +stack pointer is pointing to 0000-3FFF then the return address will still +be written to RAM if RAM was switched in. + +***************************************************************************/ + +#include "includes/osborne1.h" + +#define RAMMODE (0x01) + + +WRITE8_MEMBER( osborne1_state::osborne1_0000_w ) +{ + /* Check whether regular RAM is enabled */ + if ( ! m_bank2_enabled || ( m_in_irq_handler && m_bankswitch == RAMMODE ) ) + { + m_ram->pointer()[ offset ] = data; + } +} + + +WRITE8_MEMBER( osborne1_state::osborne1_1000_w ) +{ + /* Check whether regular RAM is enabled */ + if ( ! m_bank2_enabled || ( m_in_irq_handler && m_bankswitch == RAMMODE ) ) + { + m_ram->pointer()[ 0x1000 + offset ] = data; + } +} + + +READ8_MEMBER( osborne1_state::osborne1_2000_r ) +{ + UINT8 data = 0xFF; + + /* Check whether regular RAM is enabled */ + if ( ! m_bank2_enabled ) + { + data = m_ram->pointer()[ 0x2000 + offset ]; + } + else + { + switch( offset & 0x0F00 ) + { + case 0x100: /* Floppy */ + data = m_fdc->read( space, offset & 0x03 ); + break; + case 0x200: /* Keyboard */ + /* Row 0 */ + if ( offset & 0x01 ) data &= m_row0->read(); + /* Row 1 */ + if ( offset & 0x02 ) data &= m_row1->read(); + /* Row 2 */ + if ( offset & 0x04 ) data &= m_row3->read(); + /* Row 3 */ + if ( offset & 0x08 ) data &= m_row4->read(); + /* Row 4 */ + if ( offset & 0x10 ) data &= m_row5->read(); + /* Row 5 */ + if ( offset & 0x20 ) data &= m_row2->read(); + /* Row 6 */ + if ( offset & 0x40 ) data &= m_row6->read(); + /* Row 7 */ + if ( offset & 0x80 ) data &= m_row7->read(); + break; + case 0x900: /* IEEE488 PIA */ + data = m_pia0->read(space, offset & 0x03 ); + break; + case 0xA00: /* Serial */ + break; + case 0xC00: /* Video PIA */ + data = m_pia1->read(space, offset & 0x03 ); + break; + } + } + return data; +} + + +WRITE8_MEMBER( osborne1_state::osborne1_2000_w ) +{ + /* Check whether regular RAM is enabled */ + if ( ! m_bank2_enabled ) + { + m_ram->pointer()[ 0x2000 + offset ] = data; + } + else + { + if ( m_in_irq_handler && m_bankswitch == RAMMODE ) + { + m_ram->pointer()[ 0x2000 + offset ] = data; + } + /* Handle writes to the I/O area */ + switch( offset & 0x0F00 ) + { + case 0x100: /* Floppy */ + m_fdc->write(space, offset & 0x03, data ); + break; + case 0x900: /* IEEE488 PIA */ + m_pia0->write(space, offset & 0x03, data ); + break; + case 0xA00: /* Serial */ + break; + case 0xC00: /* Video PIA */ + m_pia1->write(space, offset & 0x03, data ); + break; + } + } +} + + +WRITE8_MEMBER( osborne1_state::osborne1_3000_w ) +{ + /* Check whether regular RAM is enabled */ + if ( ! m_bank2_enabled || ( m_in_irq_handler && m_bankswitch == RAMMODE ) ) + { + m_ram->pointer()[ 0x3000 + offset ] = data; + } +} + + +WRITE8_MEMBER( osborne1_state::osborne1_videoram_w ) +{ + /* Check whether the video attribute section is enabled */ + if ( m_bank3_enabled ) + data |= 0x7F; + + m_bank4_ptr[offset] = data; +} + + +WRITE8_MEMBER( osborne1_state::osborne1_bankswitch_w ) +{ + switch( offset ) + { + case 0x00: + m_bank2_enabled = 1; + m_bank3_enabled = 0; + break; + case 0x01: + m_bank2_enabled = 0; + m_bank3_enabled = 0; + break; + case 0x02: + m_bank2_enabled = 1; + m_bank3_enabled = 1; + break; + case 0x03: + m_bank2_enabled = 1; + m_bank3_enabled = 0; + break; + } + if ( m_bank2_enabled ) + { + m_bank1->set_base(m_region_maincpu->base() ); + m_bank2->set_base(m_empty_4K ); + m_bank3->set_base(m_empty_4K ); + } + else + { + m_bank1->set_base(m_ram->pointer() ); + m_bank2->set_base(m_ram->pointer() + 0x1000 ); + m_bank3->set_base(m_ram->pointer() + 0x3000 ); + } + m_bank4_ptr = m_ram->pointer() + ( ( m_bank3_enabled ) ? 0x10000 : 0xF000 ); + m_bank4->set_base(m_bank4_ptr ); + m_bankswitch = offset; + m_in_irq_handler = 0; +} + + +DIRECT_UPDATE_MEMBER(osborne1_state::osborne1_opbase) +{ + if ( ( address & 0xF000 ) == 0x2000 ) + { + if ( ! m_bank2_enabled ) + { + direct.explicit_configure(0x2000, 0x2fff, 0x0fff, m_ram->pointer() + 0x2000); + return ~0; + } + } + return address; +} + + +WRITE_LINE_MEMBER( osborne1_state::ieee_pia_irq_a_func ) +{ + m_pia_0_irq_state = state; + m_maincpu->set_input_line(0, ( m_pia_1_irq_state ) ? ASSERT_LINE : CLEAR_LINE); +} + + +READ8_MEMBER( osborne1_state::ieee_pia_pb_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 EOI + 4 + 5 DAV + 6 NDAC + 7 NRFD + + */ + + UINT8 data = 0; + + data |= m_ieee->eoi_r() << 3; + data |= m_ieee->dav_r() << 5; + data |= m_ieee->ndac_r() << 6; + data |= m_ieee->nrfd_r() << 7; + + return data; +} + + +WRITE8_MEMBER( osborne1_state::ieee_pia_pb_w ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 EOI + 4 ATN + 5 DAV + 6 NDAC + 7 NRFD + + */ + + m_ieee->eoi_w(BIT(data, 3)); + m_ieee->atn_w(BIT(data, 4)); + m_ieee->dav_w(BIT(data, 5)); + m_ieee->ndac_w(BIT(data, 6)); + m_ieee->nrfd_w(BIT(data, 7)); +} + + +WRITE_LINE_MEMBER( osborne1_state::video_pia_out_cb2_dummy ) +{ +} + + +WRITE8_MEMBER( osborne1_state::video_pia_port_a_w ) +{ + m_fdc->dden_w(BIT(data, 0)); + + data -= 0xea; // remove bias + + m_new_start_x = (data >> 1); + if (m_new_start_x) + m_new_start_x--; + + //logerror("Video pia port a write: %02X, density set to %s\n", data, data & 1 ? "FM" : "MFM" ); +} + + +WRITE8_MEMBER( osborne1_state::video_pia_port_b_w ) +{ + m_new_start_y = data & 0x1F; + m_beep_state = BIT(data, 5); + + if (BIT(data, 6)) + { + m_fdc->set_floppy(m_floppy0); + m_floppy0->mon_w(0); + } + else if (BIT(data, 7)) + { + m_fdc->set_floppy(m_floppy1); + m_floppy1->mon_w(0); + } + else + { + m_fdc->set_floppy(NULL); + } + + //logerror("Video pia port b write: %02X\n", data ); +} + + +WRITE_LINE_MEMBER( osborne1_state::video_pia_irq_a_func ) +{ + m_pia_1_irq_state = state; + m_maincpu->set_input_line(0, ( m_pia_1_irq_state ) ? ASSERT_LINE : CLEAR_LINE); +} + + +//static const struct aica6850_interface osborne1_6850_config = +//{ +// 10, /* tx_clock */ +// 10, /* rx_clock */ +// NULL, /* rx_pin */ +// NULL, /* tx_pin */ +// NULL, /* cts_pin */ +// NULL, /* rts_pin */ +// NULL, /* dcd_pin */ +// NULL /* int_callback */ +//}; + + +void osborne1_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_VIDEO: + osborne1_video_callback(ptr, param); + break; + case TIMER_SETUP: + setup_osborne1(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in osborne1_state::device_timer"); + } +} + + +TIMER_CALLBACK_MEMBER(osborne1_state::osborne1_video_callback) +{ + int y = machine().first_screen()->vpos(); + UINT8 ra=0,chr,gfx,dim; + UINT16 x,ma; + + /* Check for start of frame */ + if ( y == 0 ) + { + /* Clear CA1 on video PIA */ + m_pia1->ca1_w(0); + } + if ( y == 240 ) + { + /* Set CA1 on video PIA */ + m_pia1->ca1_w(1); + } + if ( y < 240 ) + { + ra = y % 10; + /* Draw a line of the display */ + ma = (m_new_start_y + (y/10)) * 128 + m_new_start_x; + UINT16 *p = &m_bitmap.pix16(y); + + for ( x = 0; x < 52; x++ ) + { + chr = m_ram->pointer()[ 0xF000 + ( (ma+x) & 0xFFF ) ]; + dim = m_ram->pointer()[ 0x10000 + ( (ma+x) & 0xFFF ) ] & 0x80; + + if ( (chr & 0x80) && (ra == 9) ) + gfx = 0xFF; + else + gfx = m_p_chargen[ (ra << 7) | ( chr & 0x7F ) ]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7) ? ( dim ? 2 : 1 ) : 0; + *p++ = BIT(gfx, 6) ? ( dim ? 2 : 1 ) : 0; + *p++ = BIT(gfx, 5) ? ( dim ? 2 : 1 ) : 0; + *p++ = BIT(gfx, 4) ? ( dim ? 2 : 1 ) : 0; + *p++ = BIT(gfx, 3) ? ( dim ? 2 : 1 ) : 0; + *p++ = BIT(gfx, 2) ? ( dim ? 2 : 1 ) : 0; + *p++ = BIT(gfx, 1) ? ( dim ? 2 : 1 ) : 0; + *p++ = BIT(gfx, 0) ? ( dim ? 2 : 1 ) : 0; + } + } + + if ( (ra==2) || (ra== 6) ) + { + m_beep->set_state( m_beep_state ); + } + else + { + m_beep->set_state( 0 ); + } + + m_video_timer->adjust(machine().first_screen()->time_until_pos(y + 1, 0 )); +} + +TIMER_CALLBACK_MEMBER(osborne1_state::setup_osborne1) +{ + m_beep->set_state( 0 ); + m_beep->set_frequency( 300 /* 60 * 240 / 2 */ ); + m_pia1->ca1_w(0); +} + +void osborne1_state::machine_reset() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + /* Initialize memory configuration */ + osborne1_bankswitch_w( space, 0x00, 0 ); + + m_pia_0_irq_state = FALSE; + m_pia_1_irq_state = FALSE; + m_in_irq_handler = 0; + + m_p_chargen = memregion( "chargen" )->base(); + + memset( m_ram->pointer() + 0x10000, 0xFF, 0x1000 ); + + space.set_direct_update_handler(direct_update_delegate(FUNC(osborne1_state::osborne1_opbase), this)); +} + + +DRIVER_INIT_MEMBER(osborne1_state,osborne1) +{ + m_empty_4K = auto_alloc_array(machine(), UINT8, 0x1000 ); + memset( m_empty_4K, 0xFF, 0x1000 ); + + /* Configure the 6850 ACIA */ +// acia6850_config( 0, &osborne1_6850_config ); + m_video_timer = timer_alloc(TIMER_VIDEO); + m_video_timer->adjust(machine().first_screen()->time_until_pos(1, 0 )); + + timer_set(attotime::zero, TIMER_SETUP); +} + + +void osborne1_state::video_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); +} + +UINT32 osborne1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + +/**************************************************************** + Osborne1 specific daisy chain code +****************************************************************/ + +const device_type OSBORNE1_DAISY = &device_creator; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// z80ctc_device - constructor +//------------------------------------------------- +osborne1_daisy_device::osborne1_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, OSBORNE1_DAISY, "Osborne 1 daisy", tag, owner, clock, "osborne1_daisy", __FILE__), + device_z80daisy_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void osborne1_daisy_device::device_start() +{ +} + +//************************************************************************** +// DAISY CHAIN INTERFACE +//************************************************************************** + +//------------------------------------------------- +// z80daisy_irq_state - return the overall IRQ +// state for this device +//------------------------------------------------- + +int osborne1_daisy_device::z80daisy_irq_state() +{ + osborne1_state *state = machine().driver_data(); + return ( state->m_pia_1_irq_state ? Z80_DAISY_INT : 0 ); +} + + +//------------------------------------------------- +// z80daisy_irq_ack - acknowledge an IRQ and +// return the appropriate vector +//------------------------------------------------- + +int osborne1_daisy_device::z80daisy_irq_ack() +{ + osborne1_state *state = machine().driver_data(); + /* Enable ROM and I/O when IRQ is acknowledged */ + UINT8 old_bankswitch = state->m_bankswitch; + address_space& space = state->m_maincpu->space(AS_PROGRAM); + + state->osborne1_bankswitch_w( space, 0, 0 ); + state->m_bankswitch = old_bankswitch; + state->m_in_irq_handler = 1; + return 0xF8; +} + +//------------------------------------------------- +// z80daisy_irq_reti - clear the interrupt +// pending state to allow other interrupts through +//------------------------------------------------- + +void osborne1_daisy_device::z80daisy_irq_reti() +{ +} diff --git a/src/mame/machine/p2000t.c b/src/mame/machine/p2000t.c new file mode 100644 index 00000000000..224e2e462ae --- /dev/null +++ b/src/mame/machine/p2000t.c @@ -0,0 +1,157 @@ +// license:??? +// copyright-holders:Paul Daniels +/********************************************************************** + + machine.c + + Functions to emulate general aspects of the machine (RAM, ROM, interrups, + I/O ports) + +**********************************************************************/ + +#include "includes/p2000t.h" + +#define P2000M_101F_CASDAT 0x01 +#define P2000M_101F_CASCMD 0x02 +#define P2000M_101F_CASREW 0x04 +#define P2000M_101F_CASFOR 0x08 +#define P2000M_101F_KEYINT 0x40 +#define P2000M_101F_PRNOUT 0x80 + +#define P2000M_202F_PINPUT 0x01 +#define P2000M_202F_PREADY 0x02 +#define P2000M_202F_STRAPN 0x04 +#define P2000M_202F_CASENB 0x08 +#define P2000M_202F_CASPOS 0x10 +#define P2000M_202F_CASEND 0x20 +#define P2000M_202F_CASCLK 0x40 +#define P2000M_202F_CASDAT 0x80 + +#define P2000M_303F_VIDEO 0x01 + +#define P2000M_707F_DISA 0x01 + +/* + Keyboard port 0x0x + + If the keyboard interrupt is enabled, all keyboard matrix rows are + connected and reading from either of these ports will give the + keyboard status (FF=no key pressed) + + If the keyboard interrupt is disabled, reading one of these ports + will read the corresponding keyboard matrix row +*/ +READ8_MEMBER( p2000t_state::p2000t_port_000f_r ) +{ + if (m_port_101f & P2000M_101F_KEYINT) + { + return ( + m_keyboard[0]->read() & m_keyboard[1]->read() & + m_keyboard[2]->read() & m_keyboard[3]->read() & + m_keyboard[4]->read() & m_keyboard[5]->read() & + m_keyboard[6]->read() & m_keyboard[7]->read() & + m_keyboard[8]->read() & m_keyboard[9]->read()); + } + else + if (offset < 10) + { + return m_keyboard[offset]->read(); + } + else + return 0xff; +} + + +/* + Input port 0x2x + + bit 0 - Printer input + bit 1 - Printer ready + bit 2 - Strap N (daisy/matrix) + bit 3 - Cassette write enabled + bit 4 - Cassette in position + bit 5 - Begin/end of tape + bit 6 - Cassette read clock + bit 7 - Cassette read data +*/ +READ8_MEMBER( p2000t_state::p2000t_port_202f_r ) +{ + return (0xff); +} + + +/* + Output Port 0x1x + + bit 0 - Cassette write data + bit 1 - Cassette write command + bit 2 - Cassette rewind + bit 3 - Cassette forward + bit 4 - Unused + bit 5 - Unused + bit 6 - Keyboard interrupt enable + bit 7 - Printer output +*/ +WRITE8_MEMBER( p2000t_state::p2000t_port_101f_w ) +{ + m_port_101f = data; +} + +/* + Scroll Register 0x3x (P2000T only) + + bit 0 - / + bit 1 - | + bit 2 - | Index of the first character + bit 3 - | to be displayed + bit 4 - | + bit 5 - | + bit 6 - \ + bit 7 - Video disable (0 = enabled) +*/ +WRITE8_MEMBER( p2000t_state::p2000t_port_303f_w ) +{ + m_port_303f = data; +} + +/* + Beeper 0x5x + + bit 0 - Beeper + bit 1 - Unused + bit 2 - Unused + bit 3 - Unused + bit 4 - Unused + bit 5 - Unused + bit 6 - Unused + bit 7 - Unused +*/ +WRITE8_MEMBER( p2000t_state::p2000t_port_505f_w ) +{ + m_speaker->level_w(BIT(data, 0)); +} + +/* + DISAS 0x7x (P2000M only) + + bit 0 - Unused + bit 1 - DISAS enable + bit 2 - Unused + bit 3 - Unused + bit 4 - Unused + bit 5 - Unused + bit 6 - Unused + bit 7 - Unused + + When the DISAS is active, the CPU has the highest priority and + video refresh is disabled when the CPU accesses video memory + +*/ +WRITE8_MEMBER( p2000t_state::p2000t_port_707f_w ) +{ + m_port_707f = data; +} + +WRITE8_MEMBER( p2000t_state::p2000t_port_888b_w ) {} +WRITE8_MEMBER( p2000t_state::p2000t_port_8c90_w ) {} +WRITE8_MEMBER( p2000t_state::p2000t_port_9494_w ) {} diff --git a/src/mame/machine/partner.c b/src/mame/machine/partner.c new file mode 100644 index 00000000000..a336ad83c9b --- /dev/null +++ b/src/mame/machine/partner.c @@ -0,0 +1,362 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Partner driver by Miodrag Milanovic + + 09/06/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "includes/radio86.h" +#include "includes/partner.h" +#include "imagedev/flopdrv.h" +#include "machine/ram.h" + + +/* Driver initialization */ +DRIVER_INIT_MEMBER(partner_state,partner) +{ + m_tape_value = 0x80; +} + +void partner_state::partner_window_1(UINT8 bank_num, UINT16 offset,UINT8 *rom) +{ + char bank[10]; + sprintf(bank,"bank%d",bank_num); + switch(m_win_mem_page) { + case 2 : // FDD BIOS + membank(bank)->set_base(rom + 0x16000 + offset); + break; + case 4 : // MCPG BIOS + membank(bank)->set_base(rom + 0x14000 + offset); + break; + default : // BIOS + membank(bank)->set_base(rom + 0x10000 + offset); + break; + } +} + +void partner_state::partner_window_2(UINT8 bank_num, UINT16 offset,UINT8 *rom) +{ + char bank[10]; + sprintf(bank,"bank%d",bank_num); + switch(m_win_mem_page) { + case 4 : // MCPG FONT + membank(bank)->set_base(rom + 0x18000 + offset); + break; + default : // BIOS + membank(bank)->set_base(rom + 0x10000 + offset); + break; + } +} + +READ8_MEMBER(partner_state::partner_floppy_r){ + if (offset<0x100) { + switch(offset & 3) { + case 0x00 : return m_fdc->status_r(space, 0); + case 0x01 : return m_fdc->track_r(space, 0); + case 0x02 : return m_fdc->sector_r(space, 0); + default : + return m_fdc->data_r(space, 0); + } + } else { + return 0; + } +} + +WRITE8_MEMBER(partner_state::partner_floppy_w){ + if (offset<0x100) { + switch(offset & 3) { + case 0x00 : m_fdc->cmd_w(space, 0,data); break; + case 0x01 : m_fdc->track_w(space, 0,data);break; + case 0x02 : m_fdc->sector_w(space, 0,data);break; + default : m_fdc->data_w(space, 0,data);break; + } + } else { + floppy_image_device *floppy0 = m_fdc->subdevice("0")->get_device(); + floppy_image_device *floppy1 = m_fdc->subdevice("1")->get_device(); + + if (((data >> 6) & 1)==1) { + m_fdc->set_floppy(floppy0); + floppy0->mon_w(0); + floppy0->ss_w(data >> 7); + } + else + floppy0->mon_w(1); + + if (((data >> 3) & 1)==1) { + m_fdc->set_floppy(floppy1); + floppy1->mon_w(0); + floppy1->ss_w(data >> 7); + } + else + floppy1->mon_w(1); + } +} + +void partner_state::partner_iomap_bank(UINT8 *rom) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + switch(m_win_mem_page) { + case 2 : + // FDD + space.install_write_handler(0xdc00, 0xddff, write8_delegate(FUNC(partner_state::partner_floppy_w),this)); + space.install_read_handler (0xdc00, 0xddff, read8_delegate(FUNC(partner_state::partner_floppy_r),this)); + break; + case 4 : + // Timer + break; + default : // BIOS + membank("bank11")->set_base(rom + 0x10000); + break; + } +} +void partner_state::partner_bank_switch() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *rom = memregion("maincpu")->base(); + UINT8 *ram = m_ram->pointer(); + + space.install_write_bank(0x0000, 0x07ff, "bank1"); + space.install_write_bank(0x0800, 0x3fff, "bank2"); + space.install_write_bank(0x4000, 0x5fff, "bank3"); + space.install_write_bank(0x6000, 0x7fff, "bank4"); + space.install_write_bank(0x8000, 0x9fff, "bank5"); + space.install_write_bank(0xa000, 0xb7ff, "bank6"); + space.install_write_bank(0xb800, 0xbfff, "bank7"); + space.install_write_bank(0xc000, 0xc7ff, "bank8"); + space.install_write_bank(0xc800, 0xcfff, "bank9"); + space.install_write_bank(0xd000, 0xd7ff, "bank10"); + space.unmap_write(0xdc00, 0xddff); + space.install_read_bank (0xdc00, 0xddff, "bank11"); + space.unmap_write(0xe000, 0xe7ff); + space.unmap_write(0xe800, 0xffff); + + // BANK 1 (0x0000 - 0x07ff) + if (m_mem_page==0) { + space.unmap_write(0x0000, 0x07ff); + membank("bank1")->set_base(rom + 0x10000); + } else { + if (m_mem_page==7) { + membank("bank1")->set_base(ram + 0x8000); + } else { + membank("bank1")->set_base(ram + 0x0000); + } + } + + // BANK 2 (0x0800 - 0x3fff) + if (m_mem_page==7) { + membank("bank2")->set_base(ram + 0x8800); + } else { + membank("bank2")->set_base(ram + 0x0800); + } + + // BANK 3 (0x4000 - 0x5fff) + if (m_mem_page==7) { + membank("bank3")->set_base(ram + 0xC000); + } else { + if (m_mem_page==10) { + //window 1 + space.unmap_write(0x4000, 0x5fff); + partner_window_1(3, 0, rom); + } else { + membank("bank3")->set_base(ram + 0x4000); + } + } + + // BANK 4 (0x6000 - 0x7fff) + if (m_mem_page==7) { + membank("bank4")->set_base(ram + 0xe000); + } else { + membank("bank4")->set_base(ram + 0x6000); + } + + // BANK 5 (0x8000 - 0x9fff) + switch (m_mem_page) { + case 5: + case 10: + //window 2 + space.unmap_write(0x8000, 0x9fff); + partner_window_2(5, 0, rom); + break; + case 8: + case 9: + //window 1 + space.unmap_write(0x8000, 0x9fff); + partner_window_1(5, 0, rom); + break; + case 7: + membank("bank5")->set_base(ram + 0x0000); + break; + default: + membank("bank5")->set_base(ram + 0x8000); + break; + } + + // BANK 6 (0xa000 - 0xb7ff) + switch (m_mem_page) { + case 5: + case 10: + //window 2 + space.unmap_write(0xa000, 0xb7ff); + partner_window_2(6, 0, rom); + break; + case 6: + case 8: + //BASIC + space.unmap_write(0xa000, 0xb7ff); + membank("bank6")->set_base(rom + 0x12000); // BASIC + break; + case 7: + membank("bank6")->set_base(ram + 0x2000); + break; + default: + membank("bank6")->set_base(ram + 0xa000); + break; + } + + // BANK 7 (0xb800 - 0xbfff) + switch (m_mem_page) { + case 4: + case 5: + case 10: + //window 2 + space.unmap_write(0xb800, 0xbfff); + partner_window_2(7, 0x1800, rom); + break; + case 6: + case 8: + //BASIC + space.unmap_write(0xb800, 0xbfff); + membank("bank7")->set_base(rom + 0x13800); // BASIC + break; + case 7: + membank("bank7")->set_base(ram + 0x3800); + break; + default: + membank("bank7")->set_base(ram + 0xb800); + break; + } + + // BANK 8 (0xc000 - 0xc7ff) + switch (m_mem_page) { + case 7: + membank("bank8")->set_base(ram + 0x4000); + break; + case 8: + case 10: + space.unmap_write(0xc000, 0xc7ff); + membank("bank8")->set_base(rom + 0x10000); + break; + default: + membank("bank8")->set_base(ram + 0xc000); + break; + } + + // BANK 9 (0xc800 - 0xcfff) + switch (m_mem_page) { + case 7: + membank("bank9")->set_base(ram + 0x4800); + break; + case 8: + case 9: + // window 2 + space.unmap_write(0xc800, 0xcfff); + partner_window_2(9, 0, rom); + break; + case 10: + space.unmap_write(0xc800, 0xcfff); + membank("bank9")->set_base(rom + 0x10800); + break; + default: + membank("bank9")->set_base(ram + 0xc800); + break; + } + + // BANK 10 (0xd000 - 0xd7ff) + switch (m_mem_page) { + case 7: + membank("bank10")->set_base(ram + 0x5000); + break; + case 8: + case 9: + // window 2 + space.unmap_write(0xd000, 0xd7ff); + partner_window_2(10, 0x0800, rom); + break; + default: + membank("bank10")->set_base(ram + 0xd000); + break; + } + + // BANK 11 (0xdc00 - 0xddff) + partner_iomap_bank(rom); + + // BANK 12 (0xe000 - 0xe7ff) + if (m_mem_page==1) { + membank("bank12")->set_base(rom + 0x10000); + } else { + //window 1 + partner_window_1(12, 0, rom); + } + + // BANK 13 (0xe800 - 0xffff) + switch (m_mem_page) { + case 3: + case 4: + case 5: + // window 1 + partner_window_1(13, 0x800, rom); + break; + default: + // BIOS + membank("bank13")->set_base(rom + 0x10800); + break; + } +} + +WRITE8_MEMBER(partner_state::partner_win_memory_page_w) +{ + m_win_mem_page = ~data; + partner_bank_switch(); +} + +WRITE8_MEMBER(partner_state::partner_mem_page_w) +{ + m_mem_page = (data >> 4) & 0x0f; + partner_bank_switch(); +} + +I8275_DRAW_CHARACTER_MEMBER(partner_state::display_pixels) +{ + int i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + const UINT8 *charmap = m_charmap + 0x400 * (gpa * 2 + hlgt); + UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; + if(linecount == 8) + pixels = 0; + if (vsp) { + pixels = 0; + } + if (lten) { + pixels = 0xff; + } + if (rvv) { + pixels ^= 0xff; + } + for(i=0;i<6;i++) { + bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1]; + } +} + +MACHINE_RESET_MEMBER(partner_state,partner) +{ + m_mem_page = 0; + m_win_mem_page = 0; + partner_bank_switch(); +} diff --git a/src/mame/machine/pc1251.c b/src/mame/machine/pc1251.c new file mode 100644 index 00000000000..bd0cd4ff25e --- /dev/null +++ b/src/mame/machine/pc1251.c @@ -0,0 +1,128 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#include "emu.h" +#include "cpu/sc61860/sc61860.h" + +#include "includes/pocketc.h" +#include "includes/pc1251.h" + +/* C-CE while reset, program will not be destroyed! */ + + + +WRITE8_MEMBER(pc1251_state::pc1251_outa) +{ + m_outa = data; +} + +WRITE8_MEMBER(pc1251_state::pc1251_outb) +{ + m_outb = data; +} + +WRITE8_MEMBER(pc1251_state::pc1251_outc) +{ +} + +READ8_MEMBER(pc1251_state::pc1251_ina) +{ + int data = m_outa; + + if (m_outb & 0x01) + { + data |= ioport("KEY0")->read(); + + /* At Power Up we fake a 'CL' pressure */ + if (m_power) + data |= 0x02; // problem with the deg lcd + } + + if (m_outb & 0x02) + data |= ioport("KEY1")->read(); + + if (m_outb & 0x04) + data |= ioport("KEY2")->read(); + + if (m_outa & 0x01) + data |= ioport("KEY3")->read(); + + if (m_outa & 0x02) + data |= ioport("KEY4")->read(); + + if (m_outa & 0x04) + data |= ioport("KEY5")->read(); + + if (m_outa & 0x08) + data |= ioport("KEY6")->read(); + + if (m_outa & 0x10) + data |= ioport("KEY7")->read(); + + if (m_outa & 0x20) + data |= ioport("KEY8")->read(); + + if (m_outa & 0x40) + data |= ioport("KEY9")->read(); + + return data; +} + +READ8_MEMBER(pc1251_state::pc1251_inb) +{ + int data = m_outb; + + if (m_outb & 0x08) + data |= (ioport("MODE")->read() & 0x07); + + return data; +} + +READ_LINE_MEMBER(pc1251_state::pc1251_brk) +{ + return (ioport("EXTRA")->read() & 0x01); +} + +READ_LINE_MEMBER(pc1251_state::pc1251_reset) +{ + return (ioport("EXTRA")->read() & 0x02); +} + +void pc1251_state::machine_start() +{ + UINT8 *ram = memregion("maincpu")->base() + 0x8000; + UINT8 *cpu = m_maincpu->internal_ram(); + + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x4800); +} + +MACHINE_START_MEMBER(pc1251_state,pc1260 ) +{ + UINT8 *ram = memregion("maincpu")->base() + 0x4000; + UINT8 *cpu = m_maincpu->internal_ram(); + + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x2800); +} + +void pc1251_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_POWER_UP: + m_power = 0; + break; + default: + assert_always(FALSE, "Unknown id in pc1251_state::device_timer"); + } +} + +DRIVER_INIT_MEMBER(pc1251_state,pc1251) +{ + int i; + UINT8 *gfx = memregion("gfx1")->base(); + for (i=0; i<128; i++) gfx[i]=i; + + m_power = 1; + timer_set(attotime::from_seconds(1), TIMER_POWER_UP); +} diff --git a/src/mame/machine/pc1350.c b/src/mame/machine/pc1350.c new file mode 100644 index 00000000000..6559e08041e --- /dev/null +++ b/src/mame/machine/pc1350.c @@ -0,0 +1,135 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#include "emu.h" +#include "cpu/sc61860/sc61860.h" + +#include "includes/pocketc.h" +#include "includes/pc1350.h" +#include "machine/ram.h" + + + +WRITE8_MEMBER(pc1350_state::pc1350_outa) +{ + m_outa=data; +} + +WRITE8_MEMBER(pc1350_state::pc1350_outb) +{ + m_outb=data; +} + +WRITE8_MEMBER(pc1350_state::pc1350_outc) +{ +} + +READ8_MEMBER(pc1350_state::pc1350_ina) +{ + int data = m_outa; + int t = pc1350_keyboard_line_r(space,0); + + if (t & 0x01) + data |= ioport("KEY0")->read(); + + if (t & 0x02) + data |= ioport("KEY1")->read(); + + if (t & 0x04) + data |= ioport("KEY2")->read(); + + if (t & 0x08) + data |= ioport("KEY3")->read(); + + if (t & 0x10) + data |= ioport("KEY4")->read(); + + if (t & 0x20) + data |= ioport("KEY5")->read(); + + if (m_outa & 0x01) + data |= ioport("KEY6")->read(); + + if (m_outa & 0x02) + data |= ioport("KEY7")->read(); + + if (m_outa & 0x04) + { + data |= ioport("KEY8")->read(); + + /* At Power Up we fake a 'CLS' pressure */ + if (m_power) + data |= 0x08; + } + + if (m_outa & 0x08) + data |= ioport("KEY9")->read(); + + if (m_outa & 0x10) + data |= ioport("KEY10")->read(); + + if (m_outa & 0xc0) + data |= ioport("KEY11")->read(); + + // missing lshift + + return data; +} + +READ8_MEMBER(pc1350_state::pc1350_inb) +{ + return m_outb; +} + +READ_LINE_MEMBER(pc1350_state::pc1350_brk) +{ + return (ioport("EXTRA")->read() & 0x01); +} + +void pc1350_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_POWER_UP: + m_power=0; + break; + default: + assert_always(FALSE, "Unknown id in pc1350_state::device_timer"); + } +} + +void pc1350_state::machine_start() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + m_power = 1; + timer_set(attotime::from_seconds(1), TIMER_POWER_UP); + + space.install_readwrite_bank(0x6000, 0x6fff, "bank1"); + membank("bank1")->set_base(&m_ram->pointer()[0x0000]); + + if (m_ram->size() >= 0x3000) + { + space.install_readwrite_bank(0x4000, 0x5fff, "bank2"); + membank("bank2")->set_base(&m_ram->pointer()[0x1000]); + } + else + { + space.nop_readwrite(0x4000, 0x5fff); + } + + if (m_ram->size() >= 0x5000) + { + space.install_readwrite_bank(0x2000, 0x3fff, "bank3"); + membank("bank3")->set_base(&m_ram->pointer()[0x3000]); + } + else + { + space.nop_readwrite(0x2000, 0x3fff); + } + + UINT8 *ram = memregion("maincpu")->base() + 0x2000; + UINT8 *cpu = m_maincpu->internal_ram(); + + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x5000); +} diff --git a/src/mame/machine/pc1401.c b/src/mame/machine/pc1401.c new file mode 100644 index 00000000000..7cb7fb08308 --- /dev/null +++ b/src/mame/machine/pc1401.c @@ -0,0 +1,240 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#include "emu.h" +#include "cpu/sc61860/sc61860.h" + +#include "includes/pocketc.h" +#include "includes/pc1401.h" +#include "machine/ram.h" + +/* C-CE while reset, program will not be destroyed! */ + +/* error codes +1 syntax error +2 calculation error +3 illegal function argument +4 too large a line number +5 next without for + return without gosub +6 memory overflow +7 print using error +8 i/o device error +9 other errors*/ + + + +WRITE8_MEMBER(pc1401_state::pc1401_outa) +{ + m_outa = data; +} + +WRITE8_MEMBER(pc1401_state::pc1401_outb) +{ + m_outb = data; +} + +WRITE8_MEMBER(pc1401_state::pc1401_outc) +{ + //logerror("%g outc %.2x\n", machine.time().as_double(), data); + m_portc = data; +} + +READ8_MEMBER(pc1401_state::pc1401_ina) +{ + int data = m_outa; + + if (m_outb & 0x01) + data |= ioport("KEY0")->read(); + + if (m_outb & 0x02) + data |= ioport("KEY1")->read(); + + if (m_outb & 0x04) + data |= ioport("KEY2")->read(); + + if (m_outb & 0x08) + data |= ioport("KEY3")->read(); + + if (m_outb & 0x10) + data |= ioport("KEY4")->read(); + + if (m_outb & 0x20) + { + data |= ioport("KEY5")->read(); + + /* At Power Up we fake a 'C-CE' pressure */ + if (m_power) + data |= 0x01; + } + + if (m_outa & 0x01) + data |= ioport("KEY6")->read(); + + if (m_outa & 0x02) + data |= ioport("KEY7")->read(); + + if (m_outa & 0x04) + data |= ioport("KEY8")->read(); + + if (m_outa & 0x08) + data |= ioport("KEY9")->read(); + + if (m_outa & 0x10) + data |= ioport("KEY10")->read(); + + if (m_outa & 0x20) + data |= ioport("KEY11")->read(); + + if (m_outa & 0x40) + data |= ioport("KEY12")->read(); + + return data; +} + +READ8_MEMBER(pc1401_state::pc1401_inb) +{ + int data=m_outb; + + if (ioport("EXTRA")->read() & 0x04) + data |= 0x01; + + return data; +} + +READ_LINE_MEMBER(pc1401_state::pc1401_brk) +{ + return (ioport("EXTRA")->read() & 0x01); +} + +READ_LINE_MEMBER(pc1401_state::pc1401_reset) +{ + return (ioport("EXTRA")->read() & 0x02); +} + +void pc1401_state::machine_start() +{ + UINT8 *ram = memregion("maincpu")->base() + 0x2000; + UINT8 *cpu = m_maincpu->internal_ram(); + + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x2800); +} + +void pc1401_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_POWER_UP: + m_power = 0; + break; + default: + assert_always(FALSE, "Unknown id in pc1401_state::device_timer"); + } +} + +DRIVER_INIT_MEMBER(pc1401_state,pc1401) +{ + int i; + UINT8 *gfx=memregion("gfx1")->base(); +#if 0 + static const char sucker[]={ + /* this routine dump the memory (start 0) + in an endless loop, + the pc side must be started before this + its here to allow verification of the decimal data + in mame disassembler + */ +#if 1 + 18,4,/*lip xl */ + 2,0,/*lia 0 startaddress low */ + 219,/*exam */ + 18,5,/*lip xh */ + 2,0,/*lia 0 startaddress high */ + 219,/*exam */ +/*400f x: */ + /* dump internal rom */ + 18,5,/*lip 4 */ + 89,/*ldm */ + 218,/*exab */ + 18,4,/*lip 5 */ + 89,/*ldm */ + 4,/*ix for increasing x */ + 0,0,/*lii,0 */ + 18,20,/*lip 20 */ + 53, /* */ + 18,20,/* lip 20 */ + 219,/*exam */ +#else + 18,4,/*lip xl */ + 2,255,/*lia 0 */ + 219,/*exam */ + 18,5,/*lip xh */ + 2,255,/*lia 0 */ + 219,/*exam */ +/*400f x: */ + /* dump external memory */ + 4, /*ix */ + 87,/* ldd */ +#endif + 218,/*exab */ + + + + 0,4,/*lii 4 */ + + /*a: */ + 218,/* exab */ + 90,/* sl */ + 218,/* exab */ + 18,94,/* lip 94 */ + 96,252,/* anma 252 */ + 2,2, /*lia 2 */ + 196,/* adcm */ + 95,/* outf */ + /*b: */ + 204,/*inb */ + 102,128,/*tsia 0x80 */ +#if 0 + 41,4,/* jnzm b */ +#else + /* input not working reliable! */ + /* so handshake removed, PC side must run with disabled */ + /* interrupt to not lose data */ + 78,20, /*wait 20 */ +#endif + + 218,/* exab */ + 90,/* sl */ + 218,/* exab */ + 18,94,/* lip 94 */ + 96,252,/*anma 252 */ + 2,0,/* lia 0 */ + 196,/*adcm */ + 95,/* outf */ + /*c: */ + 204,/*inb */ + 102,128,/*tsia 0x80 */ +#if 0 + 57,4,/* jzm c */ +#else + 78,20, /*wait 20 */ +#endif + + 65,/*deci */ + 41,34,/*jnzm a */ + + 41,41,/*jnzm x: */ + + 55,/* rtn */ + }; + + for (i=0; i>9]=data; + switch( (offset>>9) ){ + case 0/*0x3800*/: + // output + logerror ("asic write %.4x %.2x\n",offset, data); + break; + case 1/*0x3a00*/: + logerror ("asic write %.4x %.2x\n",offset, data); + break; + case 2/*0x3c00*/: + membank("bank1")->set_base(memregion("user1")->base()+((data&7)<<14)); + logerror ("asic write %.4x %.2x\n",offset, data); + break; + case 3/*0x3e00*/: break; + } +} + +READ8_MEMBER(pc1403_state::pc1403_asic_read) +{ + UINT8 data=m_asic[offset>>9]; + switch( (offset>>9) ){ + case 0: case 1: case 2: + logerror ("asic read %.4x %.2x\n",offset, data); + break; + } + return data; +} + +WRITE8_MEMBER(pc1403_state::pc1403_outa) +{ + m_outa=data; +} + +READ8_MEMBER(pc1403_state::pc1403_ina) +{ + UINT8 data=m_outa; + + if (m_asic[3] & 0x01) + data |= ioport("KEY0")->read(); + + if (m_asic[3] & 0x02) + data |= ioport("KEY1")->read(); + + if (m_asic[3] & 0x04) + data |= ioport("KEY2")->read(); + + if (m_asic[3] & 0x08) + data |= ioport("KEY3")->read(); + + if (m_asic[3] & 0x10) + data |= ioport("KEY4")->read(); + + if (m_asic[3] & 0x20) + data |= ioport("KEY5")->read(); + + if (m_asic[3] & 0x40) + data |= ioport("KEY6")->read(); + + if (m_outa & 0x01) + { + data |= ioport("KEY7")->read(); + + /* At Power Up we fake a 'C-CE' pressure */ + if (m_power) + data |= 0x02; + } + + if (m_outa & 0x02) + data |= ioport("KEY8")->read(); + + if (m_outa & 0x04) + data |= ioport("KEY9")->read(); + + if (m_outa & 0x08) + data |= ioport("KEY10")->read(); + + if (m_outa & 0x10) + data |= ioport("KEY11")->read(); + + if (m_outa & 0x20) + data |= ioport("KEY12")->read(); + + if (m_outa & 0x40) + data |= ioport("KEY13")->read(); + + return data; +} + +#if 0 +READ8_MEMBER(pc1403_state::pc1403_inb) +{ + int data = m_outb; + + if (ioport("KEY13")->read()) + data |= 1; + + return data; +} +#endif + +WRITE8_MEMBER(pc1403_state::pc1403_outc) +{ + m_portc = data; +// logerror("%g pc %.4x outc %.2x\n", device->machine().time().as_double(), device->m_maincpu->safe_pc(), data); +} + + +READ_LINE_MEMBER(pc1403_state::pc1403_brk) +{ + return (ioport("EXTRA")->read() & 0x01); +} + +READ_LINE_MEMBER(pc1403_state::pc1403_reset) +{ + return (ioport("EXTRA")->read() & 0x02); +} + +void pc1403_state::machine_start() +{ + UINT8 *ram = memregion("maincpu")->base() + 0x8000; + UINT8 *cpu = m_maincpu->internal_ram(); + + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x8000); +} + +void pc1403_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_POWER_UP: + m_power=0; + break; + default: + assert_always(FALSE, "Unknown id in pc1403_state::device_timer"); + } +} + +DRIVER_INIT_MEMBER(pc1403_state,pc1403) +{ + int i; + UINT8 *gfx=memregion("gfx1")->base(); + + for (i=0; i<128; i++) gfx[i]=i; + + m_power = 1; + timer_set(attotime::from_seconds(1), TIMER_POWER_UP); + + membank("bank1")->set_base(memregion("user1")->base()); +} diff --git a/src/mame/machine/pc1512kb.c b/src/mame/machine/pc1512kb.c new file mode 100644 index 00000000000..6d4ef54e134 --- /dev/null +++ b/src/mame/machine/pc1512kb.c @@ -0,0 +1,506 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Amstrad PC1512 Keyboard emulation + +**********************************************************************/ + +#include "pc1512kb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8048_TAG "ic801" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type PC1512_KEYBOARD = &device_creator; + + +//------------------------------------------------- +// ROM( pc1512_keyboard ) +//------------------------------------------------- + +ROM_START( pc1512_keyboard ) + ROM_REGION( 0x400, I8048_TAG, 0 ) + ROM_LOAD( "40042.ic801", 0x000, 0x400, CRC(607edaf6) SHA1(4422c6475596c3881c11b6a6266811c336d55d19) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *pc1512_keyboard_device::device_rom_region() const +{ + return ROM_NAME( pc1512_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( pc1512_keyboard_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( pc1512_keyboard_io, AS_IO, 8, pc1512_keyboard_device ) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(kb_bus_r) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kb_p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(kb_p2_r, kb_p2_w) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(kb_t0_r) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(kb_t1_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_DRIVER( pc1512_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( pc1512_keyboard ) + MCFG_CPU_ADD(I8048_TAG, I8048, XTAL_6MHz) + MCFG_CPU_IO_MAP(pc1512_keyboard_io) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor pc1512_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pc1512_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( pc1512_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( pc1512_keyboard ) + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\'') PORT_CHAR('|') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('?') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('@') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('#') PORT_CHAR('~') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_PRTSCR) + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Num Lock") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break Scroll Lock") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 Pg Up") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) + + PORT_START("Y10") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 Pg Dn") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del " UTF8_RIGHT) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + + PORT_START("Y11") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) + + PORT_START("COM") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor pc1512_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc1512_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc1512_keyboard_device - constructor +//------------------------------------------------- + +pc1512_keyboard_device::pc1512_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PC1512_KEYBOARD, "Amstrad PC1512 Keyboard", tag, owner, clock, "pc1512kb", __FILE__), + m_maincpu(*this, I8048_TAG), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_y10(*this, "Y10"), + m_y11(*this, "Y11"), + m_com(*this, "COM"), + m_write_clock(*this), + m_write_data(*this), + m_data_in(1), + m_clock_in(1), + m_kb_y(0xffff), + m_joy_com(1), + m_m1(1), + m_m2(1) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc1512_keyboard_device::device_start() +{ + // allocate timers + m_reset_timer = timer_alloc(); + + // resolve callbacks + m_write_clock.resolve_safe(); + m_write_data.resolve_safe(); + + // state saving + save_item(NAME(m_data_in)); + save_item(NAME(m_clock_in)); + save_item(NAME(m_kb_y)); + save_item(NAME(m_joy_com)); + save_item(NAME(m_m1)); + save_item(NAME(m_m2)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc1512_keyboard_device::device_reset() +{ + m_maincpu->set_input_line(MCS48_INPUT_EA, CLEAR_LINE); +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void pc1512_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (!m_clock_in) + { + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + } +} + + +//------------------------------------------------- +// data_w - keyboard data input +//------------------------------------------------- + +WRITE_LINE_MEMBER( pc1512_keyboard_device::data_w ) +{ + m_data_in = state; +} + + +//------------------------------------------------- +// clock_w - keyboard clock input +//------------------------------------------------- + +WRITE_LINE_MEMBER( pc1512_keyboard_device::clock_w ) +{ + if (m_clock_in != state) + { + if (!state) + { + m_reset_timer->adjust(attotime::from_msec(10)); + } + else + { + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } + } + + m_clock_in = state; +} + + +//------------------------------------------------- +// m1_w - mouse button 1 +//------------------------------------------------- + +WRITE_LINE_MEMBER( pc1512_keyboard_device::m1_w ) +{ + m_m1 = state; +} + + +//------------------------------------------------- +// m2_w - mouse button 2 +//------------------------------------------------- + +WRITE_LINE_MEMBER( pc1512_keyboard_device::m2_w ) +{ + m_m2 = state; +} + + +//------------------------------------------------- +// kb_bus_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_keyboard_device::kb_bus_r ) +{ + /* + + bit description + + 0 X1 + 1 X2 + 2 X3 + 3 X4 + 4 X5 + 5 X6 + 6 X7 + 7 X8 + + */ + + UINT8 data = 0xff; + + if (!BIT(m_kb_y, 0)) data &= m_y1->read(); + if (!BIT(m_kb_y, 1)) data &= m_y2->read(); + if (!BIT(m_kb_y, 2)) data &= m_y3->read(); + if (!BIT(m_kb_y, 3)) data &= m_y4->read(); + if (!BIT(m_kb_y, 4)) data &= m_y5->read(); + if (!BIT(m_kb_y, 5)) data &= m_y6->read(); + if (!BIT(m_kb_y, 6)) data &= m_y7->read(); + if (!BIT(m_kb_y, 7)) data &= m_y8->read(); + if (!BIT(m_kb_y, 8)) data &= m_y9->read(); + if (!BIT(m_kb_y, 9)) data &= m_y10->read(); + if (!BIT(m_kb_y, 10)) data &= m_y11->read(); + if (!m_joy_com) data &= m_com->read(); + + return data; +} + + +//------------------------------------------------- +// kb_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_keyboard_device::kb_p1_w ) +{ + /* + + bit description + + 0 Y1 + 1 Y2 + 2 Y3 + 3 Y4 + 4 Y5 + 5 Y6 + 6 Y7 + 7 Y8 + + */ + + m_kb_y = (m_kb_y & 0xff00) | data; +} + + +//------------------------------------------------- +// kb_p2_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_keyboard_device::kb_p2_r ) +{ + /* + + bit description + + 0 SERIAL DATA + 1 SERIAL CLOCK + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + UINT8 data = 0; + + data |= m_data_in; + data |= m_clock_in << 1; + + return data; +} + + +//------------------------------------------------- +// kb_p2_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_keyboard_device::kb_p2_w ) +{ + /* + + bit description + + 0 SERIAL DATA + 1 SERIAL CLOCK + 2 CAPS LED + 3 NUM LED + 4 Y9 + 5 Y10 + 6 Y11 + 7 joystick COM + + */ + + // keyboard data + m_write_data(BIT(data, 0)); + + // keyboard clock + m_write_clock(BIT(data, 1)); + + // CAPS LOCK + output_set_led_value(LED_CAPS, BIT(data, 2)); + + // NUM LOCK + output_set_led_value(LED_NUM, BIT(data, 3)); + + // keyboard row + m_kb_y = (((data >> 4) & 0x07) << 8) | (m_kb_y & 0xff); + + // joystick common + m_joy_com = BIT(data, 7); +} + + +//------------------------------------------------- +// kb_t0_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_keyboard_device::kb_t0_r ) +{ + return m_m1; +} + + +//------------------------------------------------- +// kb_t1_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_keyboard_device::kb_t1_r ) +{ + return m_m2; +} diff --git a/src/mame/machine/pc1512kb.h b/src/mame/machine/pc1512kb.h new file mode 100644 index 00000000000..a5012b69b8a --- /dev/null +++ b/src/mame/machine/pc1512kb.h @@ -0,0 +1,118 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Amstrad PC1512 Keyboard emulation + +**********************************************************************/ + +#pragma once + +#ifndef __PC1512_KEYBOARD__ +#define __PC1512_KEYBOARD__ + + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define PC1512_KEYBOARD_TAG "pc1512_keyboard" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_PC1512_KEYBOARD_CLOCK_CALLBACK(_write) \ + devcb = &pc1512_keyboard_device::set_clock_wr_callback(*device, DEVCB_##_write); + +#define MCFG_PC1512_KEYBOARD_DATA_CALLBACK(_write) \ + devcb = &pc1512_keyboard_device::set_data_wr_callback(*device, DEVCB_##_write); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc1512_keyboard_device + +class pc1512_keyboard_device : public device_t +{ +public: + // construction/destruction + pc1512_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_clock_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clock.set_callback(object); } + template static devcb_base &set_data_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_data.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_WRITE_LINE_MEMBER( data_w ); + DECLARE_WRITE_LINE_MEMBER( clock_w ); + DECLARE_WRITE_LINE_MEMBER( m1_w ); + DECLARE_WRITE_LINE_MEMBER( m2_w ); + + DECLARE_READ8_MEMBER( kb_bus_r ); + DECLARE_WRITE8_MEMBER( kb_p1_w ); + DECLARE_READ8_MEMBER( kb_p2_r ); + DECLARE_WRITE8_MEMBER( kb_p2_w ); + DECLARE_READ8_MEMBER( kb_t0_r ); + DECLARE_READ8_MEMBER( kb_t1_r ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + enum + { + LED_CAPS = 0, + LED_NUM + }; + + required_device m_maincpu; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_y10; + required_ioport m_y11; + required_ioport m_com; + + devcb_write_line m_write_clock; + devcb_write_line m_write_data; + + int m_data_in; + int m_clock_in; + int m_kb_y; + int m_joy_com; + int m_m1; + int m_m2; + + emu_timer *m_reset_timer; +}; + + +// device type definition +extern const device_type PC1512_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/pc9801_118.c b/src/mame/machine/pc9801_118.c new file mode 100644 index 00000000000..5549ad8dedc --- /dev/null +++ b/src/mame/machine/pc9801_118.c @@ -0,0 +1,228 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-118 sound card + + YMF288 + some extra ports + + TODO: + - preliminary, presumably needs CS-4231 too + - joystick code should be shared between -26, -86 and -118 + +***************************************************************************/ + +#include "emu.h" +#include "machine/pc9801_118.h" +#include "machine/pic8259.h" +#include "sound/2608intf.h" + +#define MAIN_CLOCK_X1 XTAL_1_9968MHz + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type PC9801_118 = &device_creator; + + +READ8_MEMBER(pc9801_118_device::opn_porta_r) +{ + if(m_joy_sel & 0x80) + return ioport(m_joy_sel & 0x40 ? "OPN3_PA2" : "OPN3_PA1")->read(); + + return 0xff; +} + +WRITE8_MEMBER(pc9801_118_device::opn_portb_w){ m_joy_sel = data; } + +WRITE_LINE_MEMBER(pc9801_118_device::pc9801_sound_irq) +{ + /* TODO: seems to die very often */ + machine().device(":pic8259_slave")->ir4_w(state); +} + +static MACHINE_CONFIG_FRAGMENT( pc9801_118_config ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("opn3", YM2608, MAIN_CLOCK_X1*4) // actually YMF288, unknown clock / divider + MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc9801_118_device, pc9801_sound_irq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_118_device, opn_porta_r)) + //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) + //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_118_device, opn_portb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor pc9801_118_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pc9801_118_config ); +} + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( pc9801_118 ) + PORT_START("OPN3_PA1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Up") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Down") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Left") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Right") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPN3_PA2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Up") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Down") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Left") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Right") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPN3_DSW") + PORT_CONFNAME( 0x01, 0x00, "PC-9801-118: Port Base" ) + PORT_CONFSETTING( 0x00, "0x088" ) + PORT_CONFSETTING( 0x01, "0x188" ) +INPUT_PORTS_END + +ioport_constructor pc9801_118_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc9801_118 ); +} + +// RAM +ROM_START( pc9801_118 ) + ROM_REGION( 0x100000, "opn3", ROMREGION_ERASE00 ) +ROM_END + +const rom_entry *pc9801_118_device::device_rom_region() const +{ + return ROM_NAME( pc9801_118 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_118_device - constructor +//------------------------------------------------- + +pc9801_118_device::pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PC9801_118, "pc9801_118", tag, owner, clock, "pc9801_118", __FILE__), +// m_maincpu(*owner, "maincpu"), + m_opn3(*this, "opn3") +{ +} + + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void pc9801_118_device::device_validity_check(validity_checker &valid) const +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_118_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) +{ + int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; + switch(buswidth) + { + case 8: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0); + break; + case 16: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff); + break; + case 32: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff); + break; + default: + fatalerror("PC-9801-118: Bus width %d not supported\n", buswidth); + } +} + + +void pc9801_118_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_118_device::device_reset() +{ + UINT16 port_base = (ioport("OPN3_DSW")->read() & 1) << 8; + install_device(port_base + 0x0088, port_base + 0x008f, 0, 0, read8_delegate(FUNC(pc9801_118_device::pc9801_118_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_w), this) ); + install_device(0xa460, 0xa463, 0, 0, read8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_w), this) ); + m_ext_reg = 1; // TODO: enabled or disabled? +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + + +READ8_MEMBER(pc9801_118_device::pc9801_118_r) +{ + if(((offset & 5) == 0) || m_ext_reg) + return m_opn3->read(space, offset >> 1); + else // odd + { + //printf("PC9801-118: Read to undefined port [%02x]\n",offset+0x188); + return 0xff; + } +} + + +WRITE8_MEMBER(pc9801_118_device::pc9801_118_w) +{ + if(((offset & 5) == 0) || m_ext_reg) + m_opn3->write(space, offset >> 1,data); + //else // odd + // printf("PC9801-118: Write to undefined port [%02x] %02x\n",offset+0x188,data); +} + +READ8_MEMBER( pc9801_118_device::pc9801_118_ext_r ) +{ + if(offset == 0) + { + printf("OPN3 EXT read ID [%02x]\n",offset); + return 0x80 | (m_ext_reg & 1); + } + + printf("OPN3 EXT read unk [%02x]\n",offset); + return 0xff; +} + +WRITE8_MEMBER( pc9801_118_device::pc9801_118_ext_w ) +{ + if(offset == 0) + { + m_ext_reg = data & 1; + /* TODO: apparently writing a 1 doubles the available channels (and presumably enables CS-4231 too) */ + if(data) + printf("PC-9801-118: extended register %02x write\n",data); + return; + } + + printf("OPN3 EXT write unk %02x -> [%02x]\n",data,offset); +} diff --git a/src/mame/machine/pc9801_118.h b/src/mame/machine/pc9801_118.h new file mode 100644 index 00000000000..210a1c4fa07 --- /dev/null +++ b/src/mame/machine/pc9801_118.h @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-118 + +***************************************************************************/ + + +#pragma once + +#ifndef __PC9801_118DEV_H__ +#define __PC9801_118DEV_H__ + +#include "machine/pic8259.h" +#include "sound/2608intf.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc9801_118_device + +class pc9801_118_device : public device_t +{ +public: + // construction/destruction + pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_READ8_MEMBER(opn_porta_r); + DECLARE_WRITE8_MEMBER(opn_portb_w); + DECLARE_READ8_MEMBER(pc9801_118_r); + DECLARE_WRITE8_MEMBER(pc9801_118_w); + DECLARE_READ8_MEMBER(pc9801_118_ext_r); + DECLARE_WRITE8_MEMBER(pc9801_118_ext_w); + DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); + +// required_device m_maincpu; + required_device m_opn3; + virtual const rom_entry *device_rom_region() const; +protected: + // device-level overrides + virtual void device_validity_check(validity_checker &valid) const; + virtual void device_start(); + virtual void device_reset(); + void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler); + +private: + UINT8 m_joy_sel; + UINT8 m_ext_reg; +}; + + +// device type definition +extern const device_type PC9801_118; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/mame/machine/pc9801_26.c b/src/mame/machine/pc9801_26.c new file mode 100644 index 00000000000..2f0b0351c7c --- /dev/null +++ b/src/mame/machine/pc9801_26.c @@ -0,0 +1,194 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-26 sound card + + Legacy sound card for PC-98xx family, composed by a single YM2203 + + TODO: + - joystick code should be shared between -26, -86 and -118 + +***************************************************************************/ + +#include "emu.h" +#include "machine/pc9801_26.h" +#include "machine/pic8259.h" +#include "sound/2203intf.h" + +#define MAIN_CLOCK_X1 XTAL_1_9968MHz + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type PC9801_26 = &device_creator; + + + +READ8_MEMBER(pc9801_26_device::opn_porta_r) +{ + if(m_joy_sel & 0x80) + return ioport(m_joy_sel & 0x40 ? "OPN_PA2" : "OPN_PA1")->read(); + + return 0xff; +} + +WRITE8_MEMBER(pc9801_26_device::opn_portb_w){ m_joy_sel = data; } + +WRITE_LINE_MEMBER(pc9801_26_device::pc9801_sound_irq) +{ + /* TODO: seems to die very often */ + machine().device(":pic8259_slave")->ir4_w(state); +} + +static MACHINE_CONFIG_FRAGMENT( pc9801_26_config ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider + MCFG_YM2203_IRQ_HANDLER(WRITELINE(pc9801_26_device, pc9801_sound_irq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_26_device, opn_porta_r)) + //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) + //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_26_device, opn_portb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor pc9801_26_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pc9801_26_config ); +} + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( pc9801_26 ) + PORT_START("OPN_PA1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Up") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Down") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Left") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Right") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPN_PA2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Up") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Down") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Left") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Right") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPN_DSW") + PORT_CONFNAME( 0x01, 0x01, "PC-9801-26: Port Base" ) + PORT_CONFSETTING( 0x00, "0x088" ) + PORT_CONFSETTING( 0x01, "0x188" ) +INPUT_PORTS_END + +ioport_constructor pc9801_26_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc9801_26 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_26_device - constructor +//------------------------------------------------- + +pc9801_26_device::pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PC9801_26, "pc9801_26", tag, owner, clock, "pc9801_26", __FILE__), +// m_maincpu(*owner, "maincpu"), + m_opn(*this, "opn") +{ +} + + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void pc9801_26_device::device_validity_check(validity_checker &valid) const +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_26_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) +{ + int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; + switch(buswidth) + { + case 8: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0); + break; + case 16: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff); + break; + case 32: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff); + break; + default: + fatalerror("PC-9801-26: Bus width %d not supported\n", buswidth); + } +} + + +void pc9801_26_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_26_device::device_reset() +{ + UINT16 port_base = (ioport("OPN_DSW")->read() & 1) << 8; + install_device(port_base + 0x0088, port_base + 0x008b, 0, 0, read8_delegate(FUNC(pc9801_26_device::pc9801_26_r), this), write8_delegate(FUNC(pc9801_26_device::pc9801_26_w), this) ); +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + + +READ8_MEMBER(pc9801_26_device::pc9801_26_r) +{ + if((offset & 1) == 0) + { + return offset & 4 ? 0xff : m_opn->read(space, offset >> 1); + } + else // odd + { + printf("Read to undefined port [%02x]\n",offset+0x188); + return 0xff; + } +} + + +WRITE8_MEMBER(pc9801_26_device::pc9801_26_w) +{ + if((offset & 5) == 0) + m_opn->write(space, offset >> 1, data); + else // odd + printf("PC9801-26: Write to undefined port [%02x] %02x\n",offset+0x188,data); +} diff --git a/src/mame/machine/pc9801_26.h b/src/mame/machine/pc9801_26.h new file mode 100644 index 00000000000..7f6ab795020 --- /dev/null +++ b/src/mame/machine/pc9801_26.h @@ -0,0 +1,67 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + + +#pragma once + +#ifndef __PC9801_26DEV_H__ +#define __PC9801_26DEV_H__ + +#include "machine/pic8259.h" +#include "sound/2203intf.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc9801_26_device + +class pc9801_26_device : public device_t +{ +public: + // construction/destruction + pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_READ8_MEMBER(opn_porta_r); + DECLARE_WRITE8_MEMBER(opn_portb_w); + DECLARE_READ8_MEMBER(pc9801_26_r); + DECLARE_WRITE8_MEMBER(pc9801_26_w); + DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); + +// required_device m_maincpu; + required_device m_opn; +protected: + // device-level overrides + virtual void device_validity_check(validity_checker &valid) const; + virtual void device_start(); + virtual void device_reset(); + void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler); + +private: + UINT8 m_joy_sel; + +}; + + +// device type definition +extern const device_type PC9801_26; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/mame/machine/pc9801_86.c b/src/mame/machine/pc9801_86.c new file mode 100644 index 00000000000..1416e01fd4b --- /dev/null +++ b/src/mame/machine/pc9801_86.c @@ -0,0 +1,227 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-86 sound card + + Almost the same thing as PC-9801-86, but this one has YM2608 instead of + YM2203 + + TODO: + - joystick code should be shared between -26, -86 and -118 + +***************************************************************************/ + +#include "emu.h" +#include "machine/pc9801_86.h" +#include "machine/pic8259.h" +#include "sound/2608intf.h" + +#define MAIN_CLOCK_X1 XTAL_1_9968MHz + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type PC9801_86 = &device_creator; + + +READ8_MEMBER(pc9801_86_device::opn_porta_r) +{ + if(m_joy_sel & 0x80) + return ioport(m_joy_sel & 0x40 ? "OPNA_PA2" : "OPNA_PA1")->read(); + + return 0xff; +} + +WRITE8_MEMBER(pc9801_86_device::opn_portb_w){ m_joy_sel = data; } + +WRITE_LINE_MEMBER(pc9801_86_device::pc9801_sound_irq) +{ + /* TODO: seems to die very often */ + machine().device(":pic8259_slave")->ir4_w(state); +} + +static MACHINE_CONFIG_FRAGMENT( pc9801_86_config ) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("opna", YM2608, MAIN_CLOCK_X1*4) // unknown clock / divider + MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc9801_86_device, pc9801_sound_irq)) + MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_86_device, opn_porta_r)) + //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) + //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_86_device, opn_portb_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor pc9801_86_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pc9801_86_config ); +} + +// RAM +ROM_START( pc9801_86 ) + ROM_REGION( 0x100000, "opna", ROMREGION_ERASE00 ) +ROM_END + +const rom_entry *pc9801_86_device::device_rom_region() const +{ + return ROM_NAME( pc9801_86 ); +} + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( pc9801_86 ) + PORT_START("OPNA_PA1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Up") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Down") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Left") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Right") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPNA_PA2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Up") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Down") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Left") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Right") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2") + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("OPNA_DSW") + PORT_CONFNAME( 0x01, 0x01, "PC-9801-86: Port Base" ) + PORT_CONFSETTING( 0x00, "0x088" ) + PORT_CONFSETTING( 0x01, "0x188" ) +INPUT_PORTS_END + +ioport_constructor pc9801_86_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc9801_86 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_86_device - constructor +//------------------------------------------------- + +pc9801_86_device::pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PC9801_86, "pc9801_86", tag, owner, clock, "pc9801_86", __FILE__), +// m_maincpu(*owner, "maincpu"), + m_opna(*this, "opna") +{ +} + + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void pc9801_86_device::device_validity_check(validity_checker &valid) const +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_86_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) +{ + int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; + switch(buswidth) + { + case 8: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0); + break; + case 16: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff); + break; + case 32: + machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff); + break; + default: + fatalerror("PC-9801-86: Bus width %d not supported\n", buswidth); + } +} + + +void pc9801_86_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_86_device::device_reset() +{ + UINT16 port_base = (ioport("OPNA_DSW")->read() & 1) << 8; + install_device(port_base + 0x0088, port_base + 0x008f, 0, 0, read8_delegate(FUNC(pc9801_86_device::pc9801_86_r), this), write8_delegate(FUNC(pc9801_86_device::pc9801_86_w), this) ); +// install_device(0xa460, 0xa463, 0, 0, read8_delegate(FUNC(pc9801_86_device::pc9801_86_ext_r), this), write8_delegate(FUNC(pc9801_86_device::pc9801_86_ext_w), this) ); + +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + + +READ8_MEMBER(pc9801_86_device::pc9801_86_r) +{ + if((offset & 1) == 0) + return m_opna->read(space, offset >> 1); + else // odd + { + printf("PC9801-86: Read to undefined port [%02x]\n",offset+0x188); + return 0xff; + } +} + + +WRITE8_MEMBER(pc9801_86_device::pc9801_86_w) +{ + if((offset & 1) == 0) + m_opna->write(space, offset >> 1,data); + else // odd + printf("PC9801-86: Write to undefined port [%02x] %02x\n",offset+0x188,data); +} + +#if 0 +READ8_MEMBER( pc9801_86_device::pc9801_86_ext_r ) +{ + if(offset == 0) + { + printf("OPNA EXT read ID [%02x]\n",offset); + return 0xff; + } + + printf("OPNA EXT read unk [%02x]\n",offset); + return 0xff; +} + +WRITE8_MEMBER( pc9801_86_device::pc9801_86_ext_w ) +{ + if(offset == 0) + { + printf("OPNA EXT write mask %02x -> [%02x]\n",data,offset); + return; + } + + printf("OPNA EXT write unk %02x -> [%02x]\n",data,offset); +} +#endif diff --git a/src/mame/machine/pc9801_86.h b/src/mame/machine/pc9801_86.h new file mode 100644 index 00000000000..633a2282dfd --- /dev/null +++ b/src/mame/machine/pc9801_86.h @@ -0,0 +1,69 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + NEC PC-9801-86 + +***************************************************************************/ + + +#pragma once + +#ifndef __PC9801_86DEV_H__ +#define __PC9801_86DEV_H__ + +#include "machine/pic8259.h" +#include "sound/2608intf.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc9801_86_device + +class pc9801_86_device : public device_t +{ +public: + // construction/destruction + pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_READ8_MEMBER(opn_porta_r); + DECLARE_WRITE8_MEMBER(opn_portb_w); + DECLARE_READ8_MEMBER(pc9801_86_r); + DECLARE_WRITE8_MEMBER(pc9801_86_w); + DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); +// DECLARE_READ8_MEMBER(pc9801_86_ext_r); +// DECLARE_WRITE8_MEMBER(pc9801_86_ext_w); + +// required_device m_maincpu; + required_device m_opna; + virtual const rom_entry *device_rom_region() const; +protected: + // device-level overrides + virtual void device_validity_check(validity_checker &valid) const; + virtual void device_start(); + virtual void device_reset(); + void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler); + +private: + UINT8 m_joy_sel; + +}; + + +// device type definition +extern const device_type PC9801_86; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/mame/machine/pc9801_cbus.c b/src/mame/machine/pc9801_cbus.c new file mode 100644 index 00000000000..2e3f6b59670 --- /dev/null +++ b/src/mame/machine/pc9801_cbus.c @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/********************************************************************** + + CCBUS Slot interface for PC-98xx family + +**********************************************************************/ + +#include "pc9801_cbus.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type PC9801CBUS_SLOT = &device_creator; + + + +//************************************************************************** +// DEVICE PC9801 CARD INTERFACE +//************************************************************************** + +#if 0 +//------------------------------------------------- +// device_pc9801cbus_card_interface - constructor +//------------------------------------------------- + +device_pc9801cbus_card_interface::device_pc9801cbus_card_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device) +{ +} + + +//------------------------------------------------- +// ~device_pc9801cbus_card_interface - destructor +//------------------------------------------------- + +device_pc9801cbus_card_interface::~device_pc9801cbus_card_interface() +{ +} +#endif + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_slot_device - constructor +//------------------------------------------------- + +pc9801_slot_device::pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, PC9801CBUS_SLOT, "PC-9801 sound cbus slot", tag, owner, clock, "pc9801_slot", __FILE__), + device_slot_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pc9801_slot_device::device_config_complete() +{ + // ... +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_slot_device::device_start() +{ +// m_card = dynamic_cast(get_card_device()); +} diff --git a/src/mame/machine/pc9801_cbus.h b/src/mame/machine/pc9801_cbus.h new file mode 100644 index 00000000000..b8d874dcf7a --- /dev/null +++ b/src/mame/machine/pc9801_cbus.h @@ -0,0 +1,77 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/********************************************************************** + + +**********************************************************************/ + +#pragma once + +#ifndef __PC9801_SLOTCBUS__ +#define __PC9801_SLOTCBUS__ + +#include "emu.h" + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + + +#define MCFG_PC9801CBUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \ + MCFG_DEVICE_ADD(_tag, PC9801CBUS_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + + + + +//class pc9801_slot_device; + +#if 0 +class device_pc9801_slot_card_interface : public device_slot_card_interface +{ + friend class pc9801_slot_device; + +public: + // construction/destruction + device_pc9801_slot_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_pc9801_card_interface(); +}; +#endif + +// ======================> pc9801_slot_device + +class pc9801_slot_device : public device_t, + public device_slot_interface +{ +public: + // construction/destruction + pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_config_complete(); +//private: +// device_pc9801_slot_card_interface *m_card; + +}; + + +// device type definition +extern const device_type PC9801CBUS_SLOT; + + + +#endif diff --git a/src/mame/machine/pc9801_kbd.c b/src/mame/machine/pc9801_kbd.c new file mode 100644 index 00000000000..260bd9f6b3d --- /dev/null +++ b/src/mame/machine/pc9801_kbd.c @@ -0,0 +1,313 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + PC-9801 Keyboard simulation + + TODO: + - key repeat + + - Verify untested keys: + STOP, COPY, and vf-1 through vf-5 + + - Problems with natural keyboard (most nonprinting keys don't work) + +***************************************************************************/ + +#include "emu.h" +#include "machine/pc9801_kbd.h" + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type PC9801_KBD = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_kbd_device - constructor +//------------------------------------------------- + +pc9801_kbd_device::pc9801_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, PC9801_KBD, "pc9801_kbd", tag, owner, clock, "pc9801_kbd_", __FILE__), + m_write_irq(*this) +{ +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +INPUT_CHANGED_MEMBER(pc9801_kbd_device::key_stroke) +{ + if(newval && !oldval) + m_rx_buf[(UINT8)(FPTR)(param) & 0x7f] = 1; + + if(oldval && !newval) + m_rx_buf[(UINT8)(FPTR)(param) & 0x7f] = 2; +} + +static INPUT_PORTS_START( pc9801_kbd ) + PORT_START("KEY0") // 0x00 - 0x07 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x00) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x01) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x02) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x03) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x04) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x05) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x06) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x07) + + PORT_START("KEY1") // 0x08 - 0x0f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x08) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x09) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- / =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ / `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('`') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xC2\xA5 / \xC2\xA6") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0f) + + PORT_START("KEY2") // 0x10 - 0x17 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x10) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x11) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x12) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x13) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x14) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x15) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x16) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x17) + + PORT_START("KEY3") // 0x18 - 0x1f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x18) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x19) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ / ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('~') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ / {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1f) + + PORT_START("KEY4") // 0x20 - 0x27 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x20) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x21) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x22) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x23) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x24) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x25) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; / +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x26) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": / *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x27) + + PORT_START("KEY5") // 0x28 - 0x2f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] / }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x28) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x29) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2f) + + // i feel like PORT_CHAR(UCHAR_MAMEKEY(INVALID)) shouldn't work... + PORT_START("KEY6") // 0x30 - 0x37 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", / <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x30) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". / >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x31) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ / ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x32) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CHAR(UCHAR_MAMEKEY(INVALID)) PORT_CHAR('_') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x33) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x34) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("XFER") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x35) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ROLL DOWN") PORT_CODE(KEYCODE_PGDN) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x36) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ROLL UP") PORT_CODE(KEYCODE_PGUP) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x37) + + PORT_START("KEY7") // 0x38 - 0x3f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x38) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x39) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME / CLR") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HELP") PORT_CODE(KEYCODE_END) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3f) + + PORT_START("KEY8") // 0x40 - 0x47 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x40) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x41) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x42) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x43) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x44) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x45) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x46) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x47) + + PORT_START("KEY9") // 0x48 - 0x4f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x48) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x49) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= (PAD)") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", (PAD)") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4f) + + PORT_START("KEYA") // 0x50 - 0x57 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x50) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("NFER") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x51) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF1?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x52) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF2?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x53) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF3?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x54) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF4?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x55) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF5?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x56) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 2-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x57) + + PORT_START("KEYB") // 0x58 - 0x5f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-1") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x58) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-2") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x59) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-3") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-4") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-5") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-6") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-7") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5f) + + PORT_START("KEYC") // 0x60 - 0x67 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("STOP?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x60) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("COPY?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x61) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x62) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x63) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x64) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x65) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x66) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x67) + + PORT_START("KEYD") // 0x68 - 0x6f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x68) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x69) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 5-5") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 5-6") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 5-7") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 5-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6f) + + PORT_START("KEYE") // 0x70 - 0x77 + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x70) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x71) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xe3\x82\xab\xe3\x83\x8a / KANA LOCK") PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x72) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH / ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x73) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x74) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 6-6") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x75) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 6-7") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x76) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 6-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x77) + + PORT_START("KEYF") // 0x78 - 0x7f + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-1") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x78) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-2") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x79) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-3") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7a) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-4") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7b) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-5") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7c) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-6") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7d) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-7") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7e) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7f) +INPUT_PORTS_END + +ioport_constructor pc9801_kbd_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc9801_kbd ); +} + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void pc9801_kbd_device::device_validity_check(validity_checker &valid) const +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_kbd_device::device_start() +{ + m_write_irq.resolve_safe(); + + m_rxtimer = timer_alloc(RX_TIMER); + m_rxtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_kbd_device::device_reset() +{ + int i; + + for(i=0;i<0x80;i++) + m_rx_buf[i] = 0; + + m_keyb_tx = 0xff; + m_keyb_rx = 0; +} + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void pc9801_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if(id == RX_TIMER) + { + int i; + + /* key up */ + for(i=0;i<0x80;i++) + { + if(m_rx_buf[i] == 2) + { + m_keyb_tx = i | 0x80; + m_write_irq(ASSERT_LINE); + m_rx_buf[i] = 0; + return; + } + } + + /* key down */ + for(i=0x7f;i>=0;i--) + { + if(m_rx_buf[i] == 1) + { + m_keyb_tx = i; + m_write_irq(ASSERT_LINE); + m_rx_buf[i] = 0; + return; + } + } + } +} + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +READ8_MEMBER( pc9801_kbd_device::rx_r ) +{ + m_write_irq(CLEAR_LINE); + if(!offset) + return m_keyb_tx; + return 1 | 4 | 2; +} + +WRITE8_MEMBER( pc9801_kbd_device::tx_w ) +{ + m_keyb_rx = data; +} diff --git a/src/mame/machine/pc9801_kbd.h b/src/mame/machine/pc9801_kbd.h new file mode 100644 index 00000000000..2b87773ff12 --- /dev/null +++ b/src/mame/machine/pc9801_kbd.h @@ -0,0 +1,72 @@ +// license:BSD-3-Clause +// copyright-holders:Angelo Salese +/*************************************************************************** + + PC-9801 Keyboard simulation + +***************************************************************************/ + +#pragma once + +#ifndef __PC9801_KBDDEV_H__ +#define __PC9801_KBDDEV_H__ + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_PC9801_KBD_IRQ_CALLBACK(_write) \ + devcb = &pc9801_kbd_device::set_irq_wr_callback(*device, DEVCB_##_write); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc9801_kbd_device + +class pc9801_kbd_device : public device_t +{ +public: + // construction/destruction + pc9801_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_irq.set_callback(object); } + + virtual ioport_constructor device_input_ports() const; + + // I/O operations + DECLARE_WRITE8_MEMBER( tx_w ); + DECLARE_READ8_MEMBER( rx_r ); + DECLARE_INPUT_CHANGED_MEMBER(key_stroke); + +protected: + // device-level overrides + virtual void device_validity_check(validity_checker &valid) const; + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + devcb_write_line m_write_irq; + + static const device_timer_id RX_TIMER = 1; + emu_timer * m_rxtimer; + UINT8 m_rx_buf[0x80]; + UINT8 m_keyb_tx; + UINT8 m_keyb_rx; +}; + + +// device type definition +extern const device_type PC9801_KBD; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/mame/machine/pcd_kbd.c b/src/mame/machine/pcd_kbd.c new file mode 100644 index 00000000000..4c1aa9f0ea5 --- /dev/null +++ b/src/mame/machine/pcd_kbd.c @@ -0,0 +1,264 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#include "pcd_kbd.h" + +const device_type PCD_KEYBOARD = &device_creator; + +ROM_START( pcd_keyboard ) + ROM_REGION(0x1000, "mcu", 0) + ROM_LOAD("pcd_keyboard.bin", 0x0000, 0x1000, CRC(d227d6cb) SHA1(3d6140764d3d043428c941826370ebf1597c63bd)) + ROM_FILL(0x526,1,0x03) // make the PCX video happy, TODO: figure out what's really happening + ROM_FILL(0x1e1,1,0x50) // fix csum +ROM_END + + +const rom_entry *pcd_keyboard_device::device_rom_region() const +{ + return ROM_NAME( pcd_keyboard ); +} + +static ADDRESS_MAP_START( pcd_keyboard_map, AS_PROGRAM, 8, pcd_keyboard_device ) + AM_RANGE(0x000, 0xfff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pcd_keyboard_io, AS_IO, 8, pcd_keyboard_device ) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(bus_r) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( pcd_keyboard ) + MCFG_CPU_ADD("mcu", I8035, 5760000*2) // FIXME: the mc2661 baud rate calculation + MCFG_CPU_PROGRAM_MAP(pcd_keyboard_map) + MCFG_CPU_IO_MAP(pcd_keyboard_io) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +machine_config_constructor pcd_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pcd_keyboard ); +} + +INPUT_PORTS_START( pcd_keyboard ) + PORT_START("ROW.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW.1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x79") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("ROW.2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // shifted is U+00A7 section sign + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_PLUSMINUS) + + PORT_START("ROW.3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x7C") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + + PORT_START("ROW.4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x7A") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x60") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x1F") + + PORT_START("ROW.5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x65") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + + PORT_START("ROW.6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SEITE") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x06") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x1D") + + PORT_START("ROW.7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DRUCK") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x18") + + PORT_START("ROW.8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L" O_UMLAUT "CHEN") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x05") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("EINF" U_UMLAUT "GEN") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("ROW.9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("{") PORT_CODE(KEYCODE_COLON) PORT_CHAR('{') PORT_CHAR(0x00D6) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x78") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x11") + + PORT_START("ROW.10") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x6A") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("?") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('?') PORT_CHAR('~') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(0x00DC) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("}") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('}') PORT_CHAR(0x00C4) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D2") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("ROW.11") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x6F") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CE") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x70") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ZEILE") + + PORT_START("ROW.12") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x10") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HILFE") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x77") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_MULTIPLY) PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) + + PORT_START("ROW.13") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TABL") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x16") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP/LEFT") PORT_CODE(KEYCODE_HOME) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x12") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + + PORT_START("ROW.14") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TABR") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x71") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x04") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_DIVIDE) PORT_CODE(KEYCODE_SLASH_PAD) + + PORT_START("ROW.15") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('\'') PORT_CHAR('`') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('*') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("#") PORT_CHAR('#') PORT_CHAR('^') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D1") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x0C") + + PORT_START("ROW.16") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_PAUSE) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x3C") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x7E") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + +ioport_constructor pcd_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pcd_keyboard ); +} + +pcd_keyboard_device::pcd_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PCD_KEYBOARD, "PC-D Keyboard", tag, owner, clock, "pcd_kbd", __FILE__), + m_rows(*this, "ROW"), + m_p1(0), + m_out_tx_handler(*this) +{ +} + +void pcd_keyboard_device::device_start() +{ + m_out_tx_handler.resolve_safe(); + m_out_tx_handler(1); +} + +READ8_MEMBER( pcd_keyboard_device::bus_r ) +{ + if(m_p1 & 0x10) + return m_rows[16]->read(); + return m_rows[m_p1 & 0xf]->read(); +} + +READ8_MEMBER( pcd_keyboard_device::p1_r ) +{ + return m_p1; +} + +WRITE8_MEMBER( pcd_keyboard_device::p1_w ) +{ + m_p1 = data; + m_out_tx_handler(BIT(data, 5)); +} + +READ8_MEMBER( pcd_keyboard_device::t0_r ) +{ + return m_t0; +} + +WRITE_LINE_MEMBER( pcd_keyboard_device::t0_w ) +{ + m_t0 = state; +} diff --git a/src/mame/machine/pcd_kbd.h b/src/mame/machine/pcd_kbd.h new file mode 100644 index 00000000000..7ec9e2bc70e --- /dev/null +++ b/src/mame/machine/pcd_kbd.h @@ -0,0 +1,40 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#ifndef PCD_KBD_H_ +#define PCD_KBD_H_ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "sound/speaker.h" + +#define MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(_devcb) \ + devcb = &pcd_keyboard_device::set_out_tx_handler(*device, DEVCB_##_devcb); + +class pcd_keyboard_device : public device_t +{ +public: + pcd_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_out_tx_handler(device_t &device, _Object object) { return downcast(device).m_out_tx_handler.set_callback(object); } + + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + void device_start(); + + DECLARE_READ8_MEMBER( bus_r ); + DECLARE_READ8_MEMBER( p1_r ); + DECLARE_WRITE8_MEMBER( p1_w ); + DECLARE_READ8_MEMBER( t0_r ); + DECLARE_WRITE_LINE_MEMBER( t0_w ); +private: + required_ioport_array<17> m_rows; + UINT8 m_p1; + bool m_t0; + devcb_write_line m_out_tx_handler; +}; + +extern const device_type PCD_KEYBOARD; + +#endif /* PCD_KBD_H_ */ diff --git a/src/mame/machine/pce.c b/src/mame/machine/pce.c new file mode 100644 index 00000000000..6aeba853933 --- /dev/null +++ b/src/mame/machine/pce.c @@ -0,0 +1,250 @@ +// license:BSD-3-Clause +// copyright-holders:Charles MacDonald, Wilbert Pol, Angelo Salese +/************************************************************ + +PC Engine CD HW notes: + +TODO: +- Dragon Ball Z: ADPCM dies after the first upload; +- Dragon Slayer - The Legend of Heroes: black screen; +- Mirai Shonen Conan: dies at new game selection; +- Snatcher: black screen after Konami logo, tries set up CD-DA + while transferring data? +- Steam Heart's: needs transfer ready irq to get past the + gameplay hang, don't know exactly when it should fire +- Steam Heart's: bad ADPCM irq, dialogue is cutted due of it; + +============================================================= + +CD Interface Register 0x00 - CDC status +x--- ---- busy signal +-x-- ---- request signal +---x ---- cd signal +---- x--- i/o signal + +CD Interface Register 0x03 - BRAM lock / CD status +-x-- ---- acknowledge signal +--x- ---- done signal +---x ---- bram signal +---- x--- ADPCM 2 +---- -x-- ADPCM 1 +---- --x- CDDA left/right speaker select + +CD Interface Register 0x05 - CD-DA Volume low 8-bit port + +CD Interface Register 0x06 - CD-DA Volume high 8-bit port + +CD Interface Register 0x07 - BRAM unlock / CD status +x--- ---- Enables BRAM + +CD Interface Register 0x0c - ADPCM status +x--- ---- ADPCM is reading data +---- x--- ADPCM playback (0) stopped (1) currently playing +---- -x-- pending ADPCM data write +---- ---x ADPCM playback (1) stopped (0) currently playing + +CD Interface Register 0x0d - ADPCM address control +x--- ---- ADPCM reset +-x-- ---- ADPCM play +--x- ---- ADPCM repeat +---x ---- ADPCM set length +---- x--- ADPCM set read address +---- --xx ADPCM set write address +(note: some games reads bit 5 and wants it to be low otherwise they hangs, surely NOT an ADPCM repeat flag read because it doesn't make sense) + +CD Interface Register 0x0e - ADPCM playback rate + +CD Interface Register 0x0f - ADPCM fade in/out register +---- xxxx command setting: +0x00 ADPCM/CD-DA Fade-in +0x01 CD-DA fade-in +0x08 CD-DA fade-out (short) ADPCM fade-in +0x09 CD-DA fade-out (long) +0x0a ADPCM fade-out (long) +0x0c CD-DA fade-out (short) ADPCM fade-in +0x0d CD-DA fade-out (short) +0x0e ADPCM fade-out (short) + +*************************************************************/ + +#include "emu.h" +#include "cpu/h6280/h6280.h" +#include "includes/pce.h" + + +/* joystick related data*/ + +#define JOY_CLOCK 0x01 +#define JOY_RESET 0x02 + + + +DRIVER_INIT_MEMBER(pce_state,mess_pce) +{ + m_io_port_options = PCE_JOY_SIG | CONST_SIG; +} + +DRIVER_INIT_MEMBER(pce_state,tg16) +{ + m_io_port_options = TG_16_JOY_SIG | CONST_SIG; +} + +DRIVER_INIT_MEMBER(pce_state,sgx) +{ + m_io_port_options = PCE_JOY_SIG | CONST_SIG; +} + +MACHINE_START_MEMBER(pce_state,pce) +{ + if (m_cd) + m_cd->late_setup(); + + // saving is only partially supported: it should be fine with cart games + // OTOH CD states are saved but not correctly restored! + save_item(NAME(m_io_port_options)); + save_item(NAME(m_acard)); + save_item(NAME(m_joystick_port_select)); + save_item(NAME(m_joystick_data_select)); + save_item(NAME(m_joy_6b_packet)); +} + +MACHINE_RESET_MEMBER(pce_state,mess_pce) +{ + for (int joy_i = 0; joy_i < 5; joy_i++) + m_joy_6b_packet[joy_i] = 0; + + /* Note: Arcade Card BIOS contents are the same as System 3, only internal HW differs. + We use a category to select between modes (some games can be run in either S-CD or A-CD modes) */ + m_acard = m_a_card->read() & 1; + + if (m_cartslot->get_type() == PCE_CDSYS3J) + { + m_sys3_card = 1; + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087fff, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),this),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),this)); + } + + if (m_cartslot->get_type() == PCE_CDSYS3U) + { + m_sys3_card = 3; + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087fff, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),this),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),this)); + } +} + +/* todo: how many input ports does the PCE have? */ +WRITE8_MEMBER(pce_state::mess_pce_joystick_w) +{ + int joy_i; + UINT8 joy_type = m_joy_type->read(); + + m_maincpu->io_set_buffer(data); + + /* bump counter on a low-to-high transition of bit 1 */ + if ((!m_joystick_data_select) && (data & JOY_CLOCK)) + { + m_joystick_port_select = (m_joystick_port_select + 1) & 0x07; + } + + /* do we want buttons or direction? */ + m_joystick_data_select = data & JOY_CLOCK; + + /* clear counter if bit 2 is set */ + if (data & JOY_RESET) + { + m_joystick_port_select = 0; + + for (joy_i = 0; joy_i < 5; joy_i++) + { + if (((joy_type >> (joy_i*2)) & 3) == 2) + m_joy_6b_packet[joy_i] ^= 1; + } + } +} + +READ8_MEMBER(pce_state::mess_pce_joystick_r) +{ + UINT8 joy_type = m_joy_type->read(); + UINT8 ret, data; + + if (m_joystick_port_select <= 4) + { + switch ((joy_type >> (m_joystick_port_select*2)) & 3) + { + case 0: //2-buttons pad + data = m_joy[m_joystick_port_select]->read(); + break; + case 2: //6-buttons pad + /* + Two packets: + 1st packet: directions + I, II, Run, Select + 2nd packet: 6 buttons "header" (high 4 bits active low) + III, IV, V, VI + Note that six buttons pad just doesn't work with (almost?) every single 2-button-only games, it's really just an after-thought and it is like this + on real HW. + */ + data = m_joy6b[m_joystick_port_select]->read() >> (m_joy_6b_packet[m_joystick_port_select]*8); + break; + default: + data = 0xff; + break; + } + } + else + data = 0xff; + + + if (m_joystick_data_select) + data >>= 4; + + ret = (data & 0x0f) | m_io_port_options; +#ifdef UNIFIED_PCE + ret &= ~0x40; +#endif + + return (ret); +} + + +WRITE8_MEMBER(pce_state::pce_cd_intf_w) +{ + m_cd->update(); + + if (offset & 0x200 && m_sys3_card && m_acard) // route Arcade Card handling ports + return m_cd->acard_w(space, offset, data); + + m_cd->intf_w(space, offset, data); + + m_cd->update(); +} + +READ8_MEMBER(pce_state::pce_cd_intf_r) +{ + m_cd->update(); + + if (offset & 0x200 && m_sys3_card && m_acard) // route Arcade Card handling ports + return m_cd->acard_r(space, offset); + + if ((offset & 0xc0) == 0xc0 && m_sys3_card) //System 3 Card header handling + { + switch (offset & 0xcf) + { + case 0xc1: return 0xaa; + case 0xc2: return 0x55; + case 0xc3: return 0x00; + case 0xc5: return (m_sys3_card & 2) ? 0x55 : 0xaa; + case 0xc6: return (m_sys3_card & 2) ? 0xaa : 0x55; + case 0xc7: return 0x03; + } + } + + return m_cd->intf_r(space, offset); +} + + +READ8_MEMBER(pce_state::pce_cd_acard_wram_r) +{ + return pce_cd_intf_r(space, 0x200 | (offset & 0x6000) >> 9); +} + +WRITE8_MEMBER(pce_state::pce_cd_acard_wram_w) +{ + pce_cd_intf_w(space, 0x200 | (offset & 0x6000) >> 9, data); +} diff --git a/src/mame/machine/pce220_ser.c b/src/mame/machine/pce220_ser.c new file mode 100644 index 00000000000..59aaf593e73 --- /dev/null +++ b/src/mame/machine/pce220_ser.c @@ -0,0 +1,307 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/**************************************************************************** + + pce220_ser.c + + Sharp PC-E220/PC-G850V Serial I/O + +****************************************************************************/ + +#include "emu.h" +#include "pce220_ser.h" + +// SIO configuration +#define SIO_BAUD_RATE 1200 +#define SIO_EOT_BYTE 0x1a +#define SIO_DATA_BIT 8 // number of data bit +#define SIO_PARITY 0 // 0=none 1=odd 2=even +#define SIO_STOP_BIT 1 // number of stop bit + +//SIO states +enum +{ + SIO_WAIT = 0, + SIO_SEND_START, + SIO_SEND_BIT0, + SIO_SEND_BIT1, + SIO_SEND_BIT2, + SIO_SEND_BIT3, + SIO_SEND_BIT4, + SIO_SEND_BIT5, + SIO_SEND_BIT6, + SIO_SEND_BIT7, + SIO_SEND_PARITY, + SIO_SEND_STOP1, + SIO_SEND_STOP2 +}; + +// device type definition +const device_type PCE220SERIAL = &device_creator; + +//------------------------------------------------- +// pce220_serial_device - constructor +//------------------------------------------------- + +pce220_serial_device::pce220_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PCE220SERIAL, "Sharp PC-E220 serial", tag, owner, clock, "pce220_serial", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// pce220_serial_device - destructor +//------------------------------------------------- + +pce220_serial_device::~pce220_serial_device() +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pce220_serial_device::device_start() +{ + m_send_timer = timer_alloc(TIMER_SEND); + m_receive_timer = timer_alloc(TIMER_RECEIVE); + m_send_timer->reset(); + m_receive_timer->reset(); +} + + +//------------------------------------------------- +// device_reset - reset up the device +//------------------------------------------------- + +void pce220_serial_device::device_reset() +{ + m_state = SIO_WAIT; + m_bytes_count = 0; + m_dout = m_busy = m_xout = 0; + m_din = m_xin = m_ack = 0; +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pce220_serial_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void pce220_serial_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (id == TIMER_SEND && m_enabled) + { + //send data + if (m_bytes_count <= length()) + { + switch(m_state) + { + case SIO_WAIT: + m_ack = 1; //data send request + //waits until is ready to receive + if(!m_busy) + return; + break; + case SIO_SEND_START: + //send start bit + m_xin = 1; + break; + case SIO_SEND_BIT0: + case SIO_SEND_BIT1: + case SIO_SEND_BIT2: + case SIO_SEND_BIT3: + case SIO_SEND_BIT4: + case SIO_SEND_BIT5: + case SIO_SEND_BIT6: + case SIO_SEND_BIT7: + m_xin = BIT(~m_current_byte, m_state - SIO_SEND_BIT0); + break; + case SIO_SEND_PARITY: + m_xin = calc_parity(m_current_byte); + break; + case SIO_SEND_STOP1: + case SIO_SEND_STOP2: + //stop bit + m_xin = m_ack = 0; + break; + } + + if (m_state == (SIO_SEND_PARITY + SIO_STOP_BIT)) + { + //next byte + m_bytes_count++; + popmessage("Send %d/%d bytes\n", m_bytes_count , (UINT32)length()); + m_state = SIO_WAIT; + if (m_bytes_count < length()) + fread(&m_current_byte, 1); + else + m_current_byte = SIO_EOT_BYTE; + } + else + { + m_state = get_next_state(); + } + + } + else + { + m_din = m_xin = m_ack = 0; + } + } + else if (id == TIMER_RECEIVE && m_enabled) + { + //receive data + switch(m_state) + { + case SIO_WAIT: + //wait send request + if(m_busy) + return; + m_ack = 1; //acknowledge + break; + case SIO_SEND_START: + //wait for the start bit + if (!m_xout) + return; + break; + case SIO_SEND_BIT0: + case SIO_SEND_BIT1: + case SIO_SEND_BIT2: + case SIO_SEND_BIT3: + case SIO_SEND_BIT4: + case SIO_SEND_BIT5: + case SIO_SEND_BIT6: + case SIO_SEND_BIT7: + m_current_byte |= ((~m_xout)&1) << (m_state - SIO_SEND_BIT0); + break; + case SIO_SEND_PARITY: + if (m_xout != calc_parity(m_current_byte)) + logerror("SIO %s: byte %d has wrong parity!\n", tag(), m_bytes_count); + break; + case SIO_SEND_STOP1: + case SIO_SEND_STOP2: + //receive stop bit + m_ack = 0; + break; + } + + if (m_state == (SIO_SEND_PARITY + SIO_STOP_BIT)) + { + //next byte + m_bytes_count++; + popmessage("Received %d bytes\n", m_bytes_count); + m_state = SIO_WAIT; + if (m_current_byte != SIO_EOT_BYTE) + fwrite(&m_current_byte, 1); + m_current_byte = 0; + } + else + { + m_state = get_next_state(); + } + } + else + { + m_din = m_xin = m_ack = 0; + } +} + +/*------------------------------------------------- + DEVICE_IMAGE_LOAD( pce220_serial ) +-------------------------------------------------*/ + +bool pce220_serial_device::call_load() +{ + m_state = SIO_WAIT; + m_bytes_count = 0; + m_send_timer->adjust(attotime::from_hz(SIO_BAUD_RATE), 0, attotime::from_hz(SIO_BAUD_RATE)); + + //read the first byte + fread(&m_current_byte, 1); + + return IMAGE_INIT_PASS; +} + +/*------------------------------------------------- + DEVICE_IMAGE_CREATE( pce220_serial ) +-------------------------------------------------*/ + +bool pce220_serial_device::call_create(int format_type, option_resolution *format_options) +{ + m_state = SIO_WAIT; + m_bytes_count = 0; + m_current_byte = 0; + m_receive_timer->adjust(attotime::from_hz(SIO_BAUD_RATE), 0, attotime::from_hz(SIO_BAUD_RATE)); + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + DEVICE_IMAGE_UNLOAD( pce220_serial ) +-------------------------------------------------*/ + +void pce220_serial_device::call_unload() +{ + m_send_timer->reset(); + m_receive_timer->reset(); + m_state = SIO_WAIT; + m_bytes_count = 0; + m_current_byte = 0; +} + + +/*------------------------------------------------- + calculate the byte parity +-------------------------------------------------*/ + +int pce220_serial_device::calc_parity(UINT8 data) +{ + UINT8 count = 0; + + while(data != 0) + { + count++; + data &= (data-1); + } + + return (count ^ BIT(SIO_PARITY, 1)) & 1; +} + + +/*------------------------------------------------- + returns the next SIO state basing on the + configuration +-------------------------------------------------*/ + +int pce220_serial_device::get_next_state() +{ + switch(m_state) + { + case SIO_SEND_BIT6: + if (SIO_DATA_BIT == 8) + return SIO_SEND_BIT7; + //fall through + case SIO_SEND_BIT7: + return (SIO_PARITY ? SIO_SEND_PARITY : SIO_SEND_STOP1); + case SIO_SEND_STOP1: + case SIO_SEND_STOP2: + return (SIO_STOP_BIT == 2 ? SIO_SEND_STOP2 : SIO_SEND_STOP1); + default: + return m_state + 1; + } +} diff --git a/src/mame/machine/pce220_ser.h b/src/mame/machine/pce220_ser.h new file mode 100644 index 00000000000..ec52e5c0476 --- /dev/null +++ b/src/mame/machine/pce220_ser.h @@ -0,0 +1,95 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/**************************************************************************** + + pce220_ser.h + + Sharp PC-E220/PC-G850V Serial I/O + +****************************************************************************/ + +#ifndef __PCE220_SER_H__ +#define __PCE220_SER_H__ + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +// ======================> pce220_serial_device + +class pce220_serial_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + pce220_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~pce220_serial_device(); + + // image-level overrides + virtual bool call_load(); + virtual void call_unload(); + virtual bool call_create(int format_type, option_resolution *format_options); + + virtual iodevice_t image_type() const { return IO_SERIAL; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "txt,ihx"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + // specific implementation + UINT8 in_xin(void) { return m_xin & 0x01; } + UINT8 in_din(void) { return m_din & 0x01; } + UINT8 in_ack(void) { return m_ack & 0x01; } + void out_busy(UINT8 state) { m_busy = state & 0x01; } + void out_dout(UINT8 state) { m_dout = state & 0x01; } + void out_xout(UINT8 state) { m_xout = state & 0x01; } + void enable_interface(UINT8 state) { m_enabled = state & 0x01; } + +protected: + // internal helpers + int calc_parity(UINT8 data); + int get_next_state(); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_config_complete(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + // internal device state + static const device_timer_id TIMER_SEND = 0; + static const device_timer_id TIMER_RECEIVE = 1; + + emu_timer* m_send_timer; // timer for send data + emu_timer* m_receive_timer; // timer for receive data + UINT8 m_state; // transfer status + UINT32 m_bytes_count; // number of bytes transferred + UINT8 m_current_byte; // byte in transfer + UINT8 m_enabled; // enable/disable + + UINT8 m_busy; // CTS + UINT8 m_dout; // DTR + UINT8 m_xout; // TXD + UINT8 m_xin; // RXD + UINT8 m_din; // DSR + UINT8 m_ack; // RTS +}; + +// device type definition +extern const device_type PCE220SERIAL; + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ +#define PCE220SERIAL_TAG "serial" + +#define MCFG_PCE220_SERIAL_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, PCE220SERIAL, 0) +#endif /* __PCE220_SER_H__ */ diff --git a/src/mame/machine/pce_cd.c b/src/mame/machine/pce_cd.c new file mode 100644 index 00000000000..d9b9e5441ea --- /dev/null +++ b/src/mame/machine/pce_cd.c @@ -0,0 +1,1519 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/************************************************************ + +PC Engine CD HW notes: + +TODO: +- Dragon Ball Z: ADPCM dies after the first upload; +- Dragon Slayer - The Legend of Heroes: black screen; +- Mirai Shonen Conan: dies at new game selection; +- Snatcher: black screen after Konami logo, tries set up CD-DA + while transferring data? +- Steam Heart's: needs transfer ready irq to get past the + gameplay hang, don't know exactly when it should fire +- Steam Heart's: bad ADPCM irq, dialogue is cutted due of it; + +============================================================= + +CD Interface Register 0x00 - CDC status +x--- ---- busy signal +-x-- ---- request signal +---x ---- cd signal +---- x--- i/o signal + +CD Interface Register 0x03 - BRAM lock / CD status +-x-- ---- acknowledge signal +--x- ---- done signal +---x ---- bram signal +---- x--- ADPCM 2 +---- -x-- ADPCM 1 +---- --x- CDDA left/right speaker select + +CD Interface Register 0x05 - CD-DA Volume low 8-bit port + +CD Interface Register 0x06 - CD-DA Volume high 8-bit port + +CD Interface Register 0x07 - BRAM unlock / CD status +x--- ---- Enables BRAM + +CD Interface Register 0x0c - ADPCM status +x--- ---- ADPCM is reading data +---- x--- ADPCM playback (0) stopped (1) currently playing +---- -x-- pending ADPCM data write +---- ---x ADPCM playback (1) stopped (0) currently playing + +CD Interface Register 0x0d - ADPCM address control +x--- ---- ADPCM reset +-x-- ---- ADPCM play +--x- ---- ADPCM repeat +---x ---- ADPCM set length +---- x--- ADPCM set read address +---- --xx ADPCM set write address +(note: some games reads bit 5 and wants it to be low otherwise they hangs, surely NOT an ADPCM repeat flag read because it doesn't make sense) + +CD Interface Register 0x0e - ADPCM playback rate + +CD Interface Register 0x0f - ADPCM fade in/out register +---- xxxx command setting: +0x00 ADPCM/CD-DA Fade-in +0x01 CD-DA fade-in +0x08 CD-DA fade-out (short) ADPCM fade-in +0x09 CD-DA fade-out (long) +0x0a ADPCM fade-out (long) +0x0c CD-DA fade-out (short) ADPCM fade-in +0x0d CD-DA fade-out (short) +0x0e ADPCM fade-out (short) + +*************************************************************/ + +#include "emu.h" +#include "coreutil.h" +#include "machine/pce_cd.h" + + +#define PCE_CD_CLOCK 9216000 + + +const device_type PCE_CD = &device_creator; + + +pce_cd_device::pce_cd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PCE_CD, "PCE CD Add-on", tag, owner, clock, "pcecd", __FILE__), + m_maincpu(*this, ":maincpu"), + m_msm(*this, "msm5205"), + m_cdda(*this, "cdda"), + m_nvram(*this, "bram"), + m_cdrom(*this, "cdrom") +{ +} + +void pce_cd_device::device_start() +{ + /* Initialize BRAM */ + m_bram = auto_alloc_array(machine(), UINT8, PCE_BRAM_SIZE * 2); + memset(m_bram, 0, PCE_BRAM_SIZE); + memset(m_bram + PCE_BRAM_SIZE, 0xff, PCE_BRAM_SIZE); + m_bram_locked = 1; + + m_nvram->set_base(m_bram, PCE_BRAM_SIZE); + + /* set up adpcm related things */ + m_adpcm_ram = auto_alloc_array_clear(machine(), UINT8, PCE_ADPCM_RAM_SIZE); + m_adpcm_clock_divider = 1; + + /* Set up cd command buffer */ + m_command_buffer = auto_alloc_array_clear(machine(), UINT8, PCE_CD_COMMAND_BUFFER_SIZE); + m_command_buffer_index = 0; + + /* Set up Arcade Card RAM buffer */ + m_acard_ram = auto_alloc_array_clear(machine(), UINT8, PCE_ACARD_RAM_SIZE); + + m_data_buffer = auto_alloc_array_clear(machine(), UINT8, 8192); + m_data_buffer_size = 0; + m_data_buffer_index = 0; + + m_subcode_buffer = auto_alloc_array(machine(), UINT8, 96); + + m_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::data_timer_callback),this)); + m_data_timer->adjust(attotime::never); + m_adpcm_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_dma_timer_callback),this)); + m_adpcm_dma_timer->adjust(attotime::never); + + m_cdda_fadeout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::cdda_fadeout_callback),this)); + m_cdda_fadeout_timer->adjust(attotime::never); + m_cdda_fadein_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::cdda_fadein_callback),this)); + m_cdda_fadein_timer->adjust(attotime::never); + + m_adpcm_fadeout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_fadeout_callback),this)); + m_adpcm_fadeout_timer->adjust(attotime::never); + m_adpcm_fadein_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_fadein_callback),this)); + m_adpcm_fadein_timer->adjust(attotime::never); + + // m_cd_file pointer is setup at a later stage because it is still empty when this function is called + + // TODO: add proper restore for the cd data... + save_item(NAME(m_regs)); + save_pointer(NAME(m_bram), PCE_BRAM_SIZE * 2); + save_pointer(NAME(m_adpcm_ram), PCE_ADPCM_RAM_SIZE); + save_item(NAME(m_bram_locked)); + save_item(NAME(m_adpcm_read_ptr)); + save_item(NAME(m_adpcm_read_buf)); + save_item(NAME(m_adpcm_write_ptr)); + save_item(NAME(m_adpcm_write_buf)); + save_item(NAME(m_adpcm_length)); + save_item(NAME(m_adpcm_clock_divider)); + save_item(NAME(m_msm_start_addr)); + save_item(NAME(m_msm_end_addr)); + save_item(NAME(m_msm_half_addr)); + save_item(NAME(m_msm_nibble)); + save_item(NAME(m_msm_idle)); + save_item(NAME(m_msm_repeat)); + save_item(NAME(m_scsi_BSY)); + save_item(NAME(m_scsi_SEL)); + save_item(NAME(m_scsi_CD)); + save_item(NAME(m_scsi_IO)); + save_item(NAME(m_scsi_MSG)); + save_item(NAME(m_scsi_REQ)); + save_item(NAME(m_scsi_ACK)); + save_item(NAME(m_scsi_ATN)); + save_item(NAME(m_scsi_RST)); + save_item(NAME(m_scsi_last_RST)); + save_item(NAME(m_cd_motor_on)); + save_item(NAME(m_selected)); + save_pointer(NAME(m_command_buffer), PCE_CD_COMMAND_BUFFER_SIZE); + save_item(NAME(m_command_buffer_index)); + save_item(NAME(m_status_sent)); + save_item(NAME(m_message_after_status)); + save_item(NAME(m_message_sent)); + save_pointer(NAME(m_data_buffer), 8192); + save_item(NAME(m_data_buffer_size)); + save_item(NAME(m_data_buffer_index)); + save_item(NAME(m_data_transferred)); + save_pointer(NAME(m_acard_ram), PCE_ACARD_RAM_SIZE); + save_item(NAME(m_acard_latch)); + save_item(NAME(m_acard_ctrl)); + save_item(NAME(m_acard_base_addr)); + save_item(NAME(m_acard_addr_offset)); + save_item(NAME(m_acard_addr_inc)); + save_item(NAME(m_acard_shift)); + save_item(NAME(m_acard_shift_reg)); + save_item(NAME(m_current_frame)); + save_item(NAME(m_end_frame)); + save_item(NAME(m_last_frame)); + save_item(NAME(m_cdda_status)); + save_item(NAME(m_cdda_play_mode)); + save_pointer(NAME(m_subcode_buffer), 96); + save_item(NAME(m_end_mark)); + save_item(NAME(m_cdda_volume)); + save_item(NAME(m_adpcm_volume)); +} + +void pce_cd_device::device_reset() +{ + m_adpcm_read_buf = 0; + m_adpcm_write_buf = 0; + + // TODO: add CD-DA stop command here + //m_cdda_status = PCE_CD_CDDA_OFF; + //m_cdda->stop_audio(); + + memset(m_regs, 0, sizeof(m_regs)); + + m_regs[0x0c] |= PCE_CD_ADPCM_STOP_FLAG; + m_regs[0x0c] &= ~PCE_CD_ADPCM_PLAY_FLAG; + //m_regs[0x03] = (m_regs[0x03] & ~0x0c) | (PCE_CD_SAMPLE_STOP_PLAY); + m_msm_idle = 1; + + m_scsi_RST = 0; + m_scsi_last_RST = 0; + m_scsi_SEL = 0; + m_scsi_BSY = 0; + m_selected = 0; + m_scsi_ATN = 0; + m_end_mark = 0; +} + + +void pce_cd_device::late_setup() +{ + // at device start, the cdrom is not 'ready' yet, so we postpone this part of the initialization at machine_start in the driver + m_cd_file = m_cdrom->get_cdrom_file(); + if (m_cd_file) + { + m_toc = cdrom_get_toc(m_cd_file); + m_cdda->set_cdrom(m_cd_file); + m_last_frame = cdrom_get_track_start(m_cd_file, cdrom_get_last_track(m_cd_file) - 1); + m_last_frame += m_toc->tracks[cdrom_get_last_track(m_cd_file) - 1].frames; + m_end_frame = m_last_frame; + } + + // MSM5205 might be initialized after PCE CD as well... + m_msm->change_clock_w((PCE_CD_CLOCK / 6) / m_adpcm_clock_divider); +} + +void pce_cd_device::nvram_init(nvram_device &nvram, void *data, size_t size) +{ + static const UINT8 init[8] = { 0x48, 0x55, 0x42, 0x4d, 0x00, 0xa0, 0x10, 0x80 }; + + memset(data, 0x00, size); + memcpy(data, init, sizeof(init)); +} + +// TODO: left and right speaker tags should be passed from the parent config, instead of using the hard-coded ones below!?! +static MACHINE_CONFIG_FRAGMENT( pce_cd ) + MCFG_NVRAM_ADD_CUSTOM_DRIVER("bram", pce_cd_device, nvram_init) + + MCFG_CDROM_ADD("cdrom") + MCFG_CDROM_INTERFACE("pce_cdrom") + + MCFG_SOUND_ADD( "msm5205", MSM5205, PCE_CD_CLOCK / 6 ) + MCFG_MSM5205_VCLK_CB(WRITELINE(pce_cd_device, msm5205_int)) /* interrupt function */ + MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* 1/48 prescaler, 4bit data */ + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "^:lspeaker", 0.50 ) + MCFG_SOUND_ROUTE( ALL_OUTPUTS, "^:rspeaker", 0.50 ) + + MCFG_SOUND_ADD( "cdda", CDDA, 0 ) + MCFG_SOUND_ROUTE( 0, "^:lspeaker", 1.00 ) + MCFG_SOUND_ROUTE( 1, "^:rspeaker", 1.00 ) +MACHINE_CONFIG_END + + +machine_config_constructor pce_cd_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pce_cd ); +} + + +void pce_cd_device::adpcm_stop(UINT8 irq_flag) +{ + m_regs[0x0c] |= PCE_CD_ADPCM_STOP_FLAG; + m_regs[0x0c] &= ~PCE_CD_ADPCM_PLAY_FLAG; + //m_regs[0x03] = (m_regs[0x03] & ~0x0c) | (PCE_CD_SAMPLE_STOP_PLAY); + if (irq_flag) + set_irq_line(PCE_CD_IRQ_SAMPLE_FULL_PLAY, ASSERT_LINE); + m_regs[0x0d] &= ~0x60; + m_msm_idle = 1; +} + +void pce_cd_device::adpcm_play() +{ + m_regs[0x0c] &= ~PCE_CD_ADPCM_STOP_FLAG; + m_regs[0x0c] |= PCE_CD_ADPCM_PLAY_FLAG; + set_irq_line(PCE_CD_IRQ_SAMPLE_FULL_PLAY, CLEAR_LINE); + m_regs[0x03] = (m_regs[0x03] & ~0x0c); + m_msm_idle = 0; +} + + +/* Callback for new data from the MSM5205. + The PCE cd unit actually divides the clock signal supplied to + the MSM5205. Currently we can only use static clocks for the + MSM5205. + */ +WRITE_LINE_MEMBER( pce_cd_device::msm5205_int ) +{ + UINT8 msm_data; + + // popmessage("%08x %08x %08x %02x %02x",m_msm_start_addr,m_msm_end_addr,m_msm_half_addr,m_regs[0x0c],m_regs[0x0d]); + + if (m_msm_idle) + return; + + /* Supply new ADPCM data */ + msm_data = (m_msm_nibble) ? (m_adpcm_ram[m_msm_start_addr] & 0x0f) : ((m_adpcm_ram[m_msm_start_addr] & 0xf0) >> 4); + + m_msm->data_w(msm_data); + m_msm_nibble ^= 1; + + if (m_msm_nibble == 0) + { + m_msm_start_addr++; + + if (m_msm_start_addr == m_msm_half_addr) + { + //set_irq_line(PCE_CD_IRQ_SAMPLE_FULL_PLAY, CLEAR_LINE); + //set_irq_line(PCE_CD_IRQ_SAMPLE_HALF_PLAY, ASSERT_LINE); + } + + if (m_msm_start_addr > m_msm_end_addr) + { + //set_irq_line(PCE_CD_IRQ_SAMPLE_HALF_PLAY, CLEAR_LINE); + //set_irq_line(PCE_CD_IRQ_SAMPLE_FULL_PLAY, CLEAR_LINE); + adpcm_stop(1); + m_msm->reset_w(1); + } + } +} + +#define SCSI_STATUS_OK 0x00 +#define SCSI_CHECK_CONDITION 0x02 + +void pce_cd_device::reply_status_byte(UINT8 status) +{ + logerror("Setting CD in reply_status_byte\n"); + m_scsi_CD = m_scsi_IO = m_scsi_REQ = 1; + m_scsi_MSG = 0; + m_message_after_status = 1; + m_status_sent = m_message_sent = 0; + + if (status == SCSI_STATUS_OK) + { + m_regs[0x01] = 0x00; + } + else + { + m_regs[0x01] = 0x01; + } +} + +/* 0x00 - TEST UNIT READY */ +void pce_cd_device::test_unit_ready() +{ + logerror("test unit ready\n"); + if (m_cd_file) + { + logerror("Sending STATUS_OK status\n"); + reply_status_byte(SCSI_STATUS_OK); + } + else + { + logerror("Sending CHECK_CONDITION status\n"); + reply_status_byte(SCSI_CHECK_CONDITION); + } +} + +/* 0x08 - READ (6) */ +void pce_cd_device::read_6() +{ + UINT32 frame = ((m_command_buffer[1] & 0x1f) << 16) | (m_command_buffer[2] << 8) | m_command_buffer[3]; + UINT32 frame_count = m_command_buffer[4]; + printf("%08x %08x\n",frame,frame_count); + + /* Check for presence of a CD */ + if (!m_cd_file) + { + reply_status_byte(SCSI_CHECK_CONDITION); + return; + } + + if (m_cdda_status != PCE_CD_CDDA_OFF) + { + m_cdda_status = PCE_CD_CDDA_OFF; + m_cdda->stop_audio(); + m_end_mark = 0; + } + + m_current_frame = frame; + m_end_frame = frame + frame_count; + + if (frame_count == 0) + { + /* Star Breaker uses this */ + popmessage("Read Sector frame count == 0, contact MESSdev"); + reply_status_byte(SCSI_STATUS_OK); + } + else + { + m_data_timer->adjust(attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND), 0, attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND)); + } + + /* TODO: correct place? */ + set_irq_line(PCE_CD_IRQ_TRANSFER_READY, ASSERT_LINE); +} + +/* 0xD8 - SET AUDIO PLAYBACK START POSITION (NEC) */ +void pce_cd_device::nec_set_audio_start_position() +{ + UINT32 frame = 0; + + if (!m_cd_file) + { + /* Throw some error here */ + reply_status_byte(SCSI_CHECK_CONDITION); + return; + } + + switch (m_command_buffer[9] & 0xC0) + { + case 0x00: + popmessage("CD-DA set start mode 0x00, contact MESSdev"); + frame = (m_command_buffer[3] << 16) | (m_command_buffer[4] << 8) | m_command_buffer[5]; + break; + case 0x40: + { + UINT8 m,s,f; + + m = bcd_2_dec(m_command_buffer[2]); + s = bcd_2_dec(m_command_buffer[3]); + f = bcd_2_dec(m_command_buffer[4]); + + frame = f + 75 * (s + m * 60); + // PCE tries to be clever here and set (start of track + track pregap size) to skip the pregap + // (I guess it wants the TOC to have the real start sector for data tracks and the start of the pregap for audio?) + frame -= m_toc->tracks[cdrom_get_track(m_cd_file, frame)].pregap; + break; + } + case 0x80: + frame = m_toc->tracks[ bcd_2_dec(m_command_buffer[2]) - 1 ].logframeofs; + break; + default: + popmessage("CD-DA set start mode 0xc0, contact MESSdev"); + //assert(NULL == nec_set_audio_start_position); + break; + } + + m_current_frame = frame; + + if (m_cdda_status == PCE_CD_CDDA_PAUSED) + { + m_cdda_status = PCE_CD_CDDA_OFF; + m_cdda->stop_audio(); + m_end_frame = m_last_frame; + m_end_mark = 0; + } + else + { + if (m_command_buffer[1] & 0x03) + { + m_cdda_status = PCE_CD_CDDA_PLAYING; + m_end_frame = m_last_frame; //get the end of the CD + m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); + m_cdda_play_mode = (m_command_buffer[1] & 0x02) ? 2 : 3; // mode 2 sets IRQ at end + m_end_mark = (m_command_buffer[1] & 0x02) ? 1 : 0; + } + else + { + m_cdda_status = PCE_CD_CDDA_PLAYING; + m_end_frame = m_toc->tracks[ cdrom_get_track(m_cd_file, m_current_frame) + 1 ].logframeofs; //get the end of THIS track + m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); + m_end_mark = 0; + m_cdda_play_mode = 3; + } + } + + reply_status_byte(SCSI_STATUS_OK); + set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE); +} + +/* 0xD9 - SET AUDIO PLAYBACK END POSITION (NEC) */ +void pce_cd_device::nec_set_audio_stop_position() +{ + UINT32 frame = 0; + + if (!m_cd_file) + { + /* Throw some error here */ + reply_status_byte(SCSI_CHECK_CONDITION); + return; + } + + switch (m_command_buffer[9] & 0xC0) + { + case 0x00: + popmessage("CD-DA set end mode 0x00, contact MESSdev"); + frame = (m_command_buffer[3] << 16) | (m_command_buffer[4] << 8) | m_command_buffer[5]; + break; + case 0x40: + { + UINT8 m,s,f; + + m = bcd_2_dec(m_command_buffer[2]); + s = bcd_2_dec(m_command_buffer[3]); + f = bcd_2_dec(m_command_buffer[4]); + + frame = f + 75 * (s + m * 60); + // if (frame >= 525) // TODO: seven seconds gap? O_o + // frame -= 525; + break; + } + case 0x80: + frame = m_toc->tracks[ bcd_2_dec(m_command_buffer[2]) - 1 ].logframeofs; + break; + default: + popmessage("CD-DA set end mode 0xc0, contact MESSdev"); + //assert(NULL == nec_set_audio_start_position); + break; + } + + m_end_frame = frame; + m_cdda_play_mode = m_command_buffer[1] & 0x03; + + if (m_cdda_play_mode) + { + if (m_cdda_status == PCE_CD_CDDA_PAUSED) + { + m_cdda->pause_audio(0); + } + else + { + //printf("%08x %08x\n",m_current_frame,m_end_frame - m_current_frame); + m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); + m_end_mark = 1; + } + m_cdda_status = PCE_CD_CDDA_PLAYING; + } + else + { + m_cdda_status = PCE_CD_CDDA_OFF; + m_cdda->stop_audio(); + m_end_frame = m_last_frame; + m_end_mark = 0; +// assert(NULL == nec_set_audio_stop_position); + } + + reply_status_byte(SCSI_STATUS_OK); + set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE); +} + +/* 0xDA - PAUSE (NEC) */ +void pce_cd_device::nec_pause() +{ + /* If no cd mounted throw an error */ + if (!m_cd_file) + { + reply_status_byte(SCSI_CHECK_CONDITION); + return; + } + + /* If there was no cdda playing, throw an error */ + if (m_cdda_status == PCE_CD_CDDA_OFF) + { + reply_status_byte(SCSI_CHECK_CONDITION); + return; + } + + m_cdda_status = PCE_CD_CDDA_PAUSED; + m_current_frame = m_cdda->get_audio_lba(); + m_cdda->pause_audio(1); + reply_status_byte(SCSI_STATUS_OK); +} + +/* 0xDD - READ SUBCHANNEL Q (NEC) */ +void pce_cd_device::nec_get_subq() +{ + /* WP - I do not have access to chds with subchannel information yet, so I'm faking something here */ + UINT32 msf_abs, msf_rel, track, frame; + + if (!m_cd_file) + { + /* Throw some error here */ + reply_status_byte(SCSI_CHECK_CONDITION); + return; + } + + frame = m_current_frame; + + switch (m_cdda_status) + { + case PCE_CD_CDDA_PAUSED: + m_data_buffer[0] = 2; + frame = m_cdda->get_audio_lba(); + break; + case PCE_CD_CDDA_PLAYING: + m_data_buffer[0] = 0; + frame = m_cdda->get_audio_lba(); + break; + default: + m_data_buffer[0] = 3; + break; + } + + msf_abs = lba_to_msf_alt(frame); + track = cdrom_get_track(m_cd_file, frame); + msf_rel = lba_to_msf_alt(frame - cdrom_get_track_start(m_cd_file, track)); + + m_data_buffer[1] = 0x01 | ((cdrom_get_track_type(m_cd_file, cdrom_get_track(m_cd_file, track+1)) == CD_TRACK_AUDIO) ? 0x00 : 0x40); + m_data_buffer[2] = dec_2_bcd(track+1); /* track */ + m_data_buffer[3] = 1; /* index */ + m_data_buffer[4] = dec_2_bcd((msf_rel >> 16) & 0xFF);/* M (relative) */ + m_data_buffer[5] = dec_2_bcd((msf_rel >> 8) & 0xFF); /* S (relative) */ + m_data_buffer[6] = dec_2_bcd(msf_rel & 0xFF); /* F (relative) */ + m_data_buffer[7] = dec_2_bcd((msf_abs >> 16) & 0xFF);/* M (absolute) */ + m_data_buffer[8] = dec_2_bcd((msf_abs >> 8) & 0xFF); /* S (absolute) */ + m_data_buffer[9] = dec_2_bcd(msf_abs & 0xFF); /* F (absolute) */ + m_data_buffer_size = 10; + + m_data_buffer_index = 0; + m_data_transferred = 1; + m_scsi_IO = 1; + m_scsi_CD = 0; +} + +/* 0xDE - GET DIR INFO (NEC) */ +void pce_cd_device::nec_get_dir_info() +{ + UINT32 frame, msf, track = 0; + const cdrom_toc *toc; + logerror("nec get dir info\n"); + + if (!m_cd_file) + { + /* Throw some error here */ + reply_status_byte(SCSI_CHECK_CONDITION); + } + + toc = cdrom_get_toc(m_cd_file); + + switch (m_command_buffer[1]) + { + case 0x00: /* Get first and last track numbers */ + m_data_buffer[0] = dec_2_bcd(1); + m_data_buffer[1] = dec_2_bcd(toc->numtrks); + m_data_buffer_size = 2; + break; + case 0x01: /* Get total disk size in MSF format */ + frame = toc->tracks[toc->numtrks-1].logframeofs; + frame += toc->tracks[toc->numtrks-1].frames; + msf = lba_to_msf(frame + 150); + + m_data_buffer[0] = (msf >> 16) & 0xFF; /* M */ + m_data_buffer[1] = (msf >> 8) & 0xFF; /* S */ + m_data_buffer[2] = msf & 0xFF; /* F */ + m_data_buffer_size = 3; + break; + case 0x02: /* Get track information */ + if (m_command_buffer[2] == 0xAA) + { + frame = toc->tracks[toc->numtrks-1].logframeofs; + frame += toc->tracks[toc->numtrks-1].frames; + m_data_buffer[3] = 0x04; /* correct? */ + } else + { + track = MAX(bcd_2_dec(m_command_buffer[2]), 1); + frame = toc->tracks[track-1].logframeofs; + // PCE wants the start sector for data tracks to *not* include the pregap + if (toc->tracks[track-1].trktype != CD_TRACK_AUDIO) + { + frame += toc->tracks[track-1].pregap; + } + m_data_buffer[3] = (toc->tracks[track-1].trktype == CD_TRACK_AUDIO) ? 0x00 : 0x04; + } + logerror("track = %d, frame = %d\n", track, frame); + msf = lba_to_msf(frame + 150); + m_data_buffer[0] = (msf >> 16) & 0xFF; /* M */ + m_data_buffer[1] = (msf >> 8) & 0xFF; /* S */ + m_data_buffer[2] = msf & 0xFF; /* F */ + m_data_buffer_size = 4; + break; + default: +// assert(pce_cd_nec_get_dir_info == NULL); // Not implemented yet + break; + } + + m_data_buffer_index = 0; + m_data_transferred = 1; + m_scsi_IO = 1; + m_scsi_CD = 0; +} + +void pce_cd_device::end_of_list() +{ + reply_status_byte(SCSI_CHECK_CONDITION); +} + +typedef void (pce_cd_device::*command_handler_func)(); + +void pce_cd_device::handle_data_output() +{ + static const struct { + UINT8 command_byte; + UINT8 command_size; + command_handler_func command_handler; + } pce_cd_commands[] = { + { 0x00, 6, &pce_cd_device::test_unit_ready }, /* TEST UNIT READY */ + { 0x08, 6, &pce_cd_device::read_6 }, /* READ (6) */ + { 0xD8,10, &pce_cd_device::nec_set_audio_start_position }, /* NEC SET AUDIO PLAYBACK START POSITION */ + { 0xD9,10, &pce_cd_device::nec_set_audio_stop_position }, /* NEC SET AUDIO PLAYBACK END POSITION */ + { 0xDA,10, &pce_cd_device::nec_pause }, /* NEC PAUSE */ + { 0xDD,10, &pce_cd_device::nec_get_subq }, /* NEC GET SUBCHANNEL Q */ + { 0xDE,10, &pce_cd_device::nec_get_dir_info }, /* NEC GET DIR INFO */ + { 0xFF, 1, &pce_cd_device::end_of_list } /* end of list marker */ + }; + + if (m_scsi_REQ && m_scsi_ACK) + { + /* Command byte received */ + logerror("Command byte $%02X received\n", m_regs[0x01]); + + /* Check for buffer overflow */ + assert(m_command_buffer_index < PCE_CD_COMMAND_BUFFER_SIZE); + + m_command_buffer[m_command_buffer_index] = m_regs[0x01]; + m_command_buffer_index++; + m_scsi_REQ = 0; + } + + if (! m_scsi_REQ && ! m_scsi_ACK && m_command_buffer_index) + { + int i = 0; + + logerror("Check if command done\n"); + + for(i = 0; m_command_buffer[0] > pce_cd_commands[i].command_byte; i++); + + /* Check for unknown commands */ + if (m_command_buffer[0] != pce_cd_commands[i].command_byte) + { + logerror("Unrecognized command: %02X\n", m_command_buffer[0]); + if (m_command_buffer[0] == 0x03) + popmessage("CD command 0x03 issued (Request Sense), contact MESSdev"); + } + assert(m_command_buffer[0] == pce_cd_commands[i].command_byte); + + if (m_command_buffer_index == pce_cd_commands[i].command_size) + { + //printf("%02x command issued\n",m_command_buffer[0]); + (this->*pce_cd_commands[i].command_handler)(); + m_command_buffer_index = 0; + } + else + { + m_scsi_REQ = 1; + } + } +} + +void pce_cd_device::handle_data_input() +{ + if (m_scsi_CD) + { + /* Command / Status byte */ + if (m_scsi_REQ && m_scsi_ACK) + { + logerror("status sent\n"); + m_scsi_REQ = 0; + m_status_sent = 1; + } + + if (! m_scsi_REQ && ! m_scsi_ACK && m_status_sent) + { + m_status_sent = 0; + if (m_message_after_status) + { + logerror("message after status\n"); + m_message_after_status = 0; + m_scsi_MSG = m_scsi_REQ = 1; + m_regs[0x01] = 0; + } + } + } + else + { + /* Data */ + if (m_scsi_REQ && m_scsi_ACK) + { + m_scsi_REQ = 0; + } + + if (! m_scsi_REQ && ! m_scsi_ACK) + { + if (m_data_buffer_index == m_data_buffer_size) + { + set_irq_line(PCE_CD_IRQ_TRANSFER_READY, CLEAR_LINE); + if (m_data_transferred) + { + m_data_transferred = 0; + reply_status_byte(SCSI_STATUS_OK); + set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE); + } + } + else + { + logerror("Transfer byte %02x from offset %d %d\n",m_data_buffer[m_data_buffer_index] , m_data_buffer_index, m_current_frame); + m_regs[0x01] = m_data_buffer[m_data_buffer_index]; + m_data_buffer_index++; + m_scsi_REQ = 1; + } + } + } +} + +void pce_cd_device::handle_message_output() +{ + if (m_scsi_REQ && m_scsi_ACK) + m_scsi_REQ = 0; +} + +void pce_cd_device::handle_message_input() +{ + if (m_scsi_REQ && m_scsi_ACK) + { + m_scsi_REQ = 0; + m_message_sent = 1; + } + + if (! m_scsi_REQ && ! m_scsi_ACK && m_message_sent) + { + m_message_sent = 0; + m_scsi_BSY = 0; + } +} + +/* Update internal CD statuses */ +void pce_cd_device::update() +{ + /* Check for reset of CD unit */ + if (m_scsi_RST != m_scsi_last_RST) + { + if (m_scsi_RST) + { + logerror("Performing CD reset\n"); + /* Reset internal data */ + m_scsi_BSY = m_scsi_SEL = m_scsi_CD = m_scsi_IO = 0; + m_scsi_MSG = m_scsi_REQ = m_scsi_ATN = 0; + m_cd_motor_on = 0; + m_selected = 0; + m_cdda_status = PCE_CD_CDDA_OFF; + m_cdda->stop_audio(); + m_adpcm_dma_timer->adjust(attotime::never); // stop ADPCM DMA here + } + m_scsi_last_RST = m_scsi_RST; + } + + /* Check if bus can be freed */ + if (! m_scsi_SEL && ! m_scsi_BSY && m_selected) + { + logerror("freeing bus\n"); + m_selected = 0; + m_scsi_CD = m_scsi_MSG = m_scsi_IO = m_scsi_REQ = 0; + set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, CLEAR_LINE); + } + + /* Select the CD device */ + if (m_scsi_SEL) + { + if (! m_selected) + { + m_selected = 1; + logerror("Setting CD in device selection\n"); + m_scsi_BSY = m_scsi_REQ = m_scsi_CD = 1; + m_scsi_MSG = m_scsi_IO = 0; + } + } + + if (m_scsi_ATN) + { + } + else + { + /* Check for data and message phases */ + if (m_scsi_BSY) + { + if (m_scsi_MSG) + { + /* message phase */ + if (m_scsi_IO) + { + handle_message_input(); + } + else + { + handle_message_output(); + } + } + else + { + /* data phase */ + if (m_scsi_IO) + { + /* Reading data from target */ + handle_data_input(); + } + else + { + /* Sending data to target */ + handle_data_output(); + } + } + } + } + + /* FIXME: presumably CD-DA needs an irq interface for this */ + if (m_cdda->audio_ended() && m_end_mark == 1) + { + switch (m_cdda_play_mode & 3) + { + case 1: m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); m_end_mark = 1; break; //play with repeat + case 2: set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE); m_end_mark = 0; break; //irq when finished + case 3: m_end_mark = 0; break; //play without repeat + } + } +} + +void pce_cd_device::set_irq_line(int num, int state) +{ + if (state == ASSERT_LINE) + m_regs[0x03] |= num; + else + m_regs[0x03] &= ~num; + + if (m_regs[0x02] & m_regs[0x03] & 0x7c) + { + //printf("IRQ PEND = %02x MASK = %02x IRQ ENABLE %02X\n",m_regs[0x02] & m_regs[0x03] & 0x7c,m_regs[0x02] & 0x7c,m_regs[0x03] & 0x7c); + m_maincpu->set_input_line(1, ASSERT_LINE); + } + else + { + m_maincpu->set_input_line(1, CLEAR_LINE); + } +} + +TIMER_CALLBACK_MEMBER(pce_cd_device::data_timer_callback) +{ + if (m_data_buffer_index == m_data_buffer_size) + { + /* Read next data sector */ + logerror("read sector %d\n", m_current_frame); + if (! cdrom_read_data(m_cd_file, m_current_frame, m_data_buffer, CD_TRACK_MODE1)) + { + logerror("Mode1 CD read failed for frame #%d\n", m_current_frame); + } + else + { + logerror("Successfully read mode1 frame #%d\n", m_current_frame); + } + + m_data_buffer_index = 0; + m_data_buffer_size = 2048; + m_current_frame++; + + m_scsi_IO = 1; + m_scsi_CD = 0; + + if (m_current_frame == m_end_frame) + { + /* We are done, disable the timer */ + logerror("Last frame read from CD\n"); + m_data_transferred = 1; + m_data_timer->adjust(attotime::never); + } + else + { + m_data_transferred = 0; + } + } +} + +WRITE8_MEMBER(pce_cd_device::bram_w) +{ + if (!m_bram_locked) + { + m_bram[offset & (PCE_BRAM_SIZE - 1)] = data; + } +} + +READ8_MEMBER(pce_cd_device::bram_r) +{ + return m_bram[(offset & (PCE_BRAM_SIZE - 1)) + m_bram_locked * PCE_BRAM_SIZE]; +} + +void pce_cd_device::set_adpcm_ram_byte(UINT8 val) +{ + if (m_adpcm_write_buf > 0) + { + m_adpcm_write_buf--; + } + else + { + m_adpcm_ram[m_adpcm_write_ptr] = val; + m_adpcm_write_ptr = ((m_adpcm_write_ptr + 1) & 0xffff); + //TODO: length + 1 + } +} + +TIMER_CALLBACK_MEMBER(pce_cd_device::cdda_fadeout_callback) +{ + m_cdda_volume -= 0.1; + + if (m_cdda_volume <= 0) + { + m_cdda_volume = 0.0; + m_cdda->set_volume(0.0); + m_cdda_fadeout_timer->adjust(attotime::never); + } + else + { + m_cdda->set_volume(m_cdda_volume); + m_cdda_fadeout_timer->adjust(attotime::from_usec(param), param); + } +} + +TIMER_CALLBACK_MEMBER(pce_cd_device::cdda_fadein_callback) +{ + m_cdda_volume += 0.1; + + if (m_cdda_volume >= 100.0) + { + m_cdda_volume = 100.0; + m_cdda->set_volume(100.0); + m_cdda_fadein_timer->adjust(attotime::never); + } + else + { + m_cdda->set_volume(m_cdda_volume); + m_cdda_fadein_timer->adjust(attotime::from_usec(param), param); + } +} + +TIMER_CALLBACK_MEMBER(pce_cd_device::adpcm_fadeout_callback) +{ + m_adpcm_volume -= 0.1; + + if (m_adpcm_volume <= 0) + { + m_adpcm_volume = 0.0; + m_msm->set_volume(0.0); + m_adpcm_fadeout_timer->adjust(attotime::never); + } + else + { + m_msm->set_volume(m_adpcm_volume); + m_adpcm_fadeout_timer->adjust(attotime::from_usec(param), param); + } +} + +TIMER_CALLBACK_MEMBER(pce_cd_device::adpcm_fadein_callback) +{ + m_adpcm_volume += 0.1; + + if (m_adpcm_volume >= 100.0) + { + m_adpcm_volume = 100.0; + m_msm->set_volume(100.0); + m_adpcm_fadein_timer->adjust(attotime::never); + } + else + { + m_msm->set_volume(m_adpcm_volume); + m_adpcm_fadein_timer->adjust(attotime::from_usec(param), param); + } +} + + +WRITE8_MEMBER(pce_cd_device::intf_w) +{ + logerror("%04X: write to CD interface offset %02X, data %02X\n", space.device().safe_pc(), offset, data); + + switch (offset & 0xf) + { + case 0x00: /* CDC status */ + /* select device (which bits??) */ + m_scsi_SEL = 1; + update(); + m_scsi_SEL = 0; + m_adpcm_dma_timer->adjust(attotime::never); // stop ADPCM DMA here + /* any write here clears CD transfer irqs */ + set_irq_line(0x70, CLEAR_LINE); + break; + case 0x01: /* CDC command / status / data */ + break; + case 0x02: /* ADPCM / CD control / IRQ enable/disable */ + /* bit 6 - transfer ready irq */ + /* bit 5 - transfer done irq */ + /* bit 4 - BRAM irq? */ + /* bit 3 - ADPCM FULL irq */ + /* bit 2 - ADPCM HALF irq */ + m_scsi_ACK = data & 0x80; + /* Update mask register now otherwise it won't catch the irq enable/disable change */ + m_regs[0x02] = data; + /* Don't set or reset any irq lines, but just verify the current state */ + set_irq_line(0, 0); + break; + case 0x03: /* BRAM lock / CD status / IRQ - Read Only register */ + break; + case 0x04: /* CD reset */ + m_scsi_RST = data & 0x02; + break; + case 0x05: /* Convert PCM data / PCM data */ + case 0x06: /* PCM data */ + break; + case 0x07: /* BRAM unlock / CD status */ + if (data & 0x80) + m_bram_locked = 0; + break; + case 0x08: /* ADPCM address (LSB) / CD data */ + break; + case 0x09: /* ADPCM address (MSB) */ + break; + case 0x0A: /* ADPCM RAM data port */ + set_adpcm_ram_byte(data); + break; + case 0x0B: /* ADPCM DMA control */ + if (data & 0x03) + { + /* Start CD to ADPCM transfer */ + m_adpcm_dma_timer->adjust(attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND * 2048), 0, attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND * 2048)); + m_regs[0x0c] |= 4; + } + break; + case 0x0C: /* ADPCM status */ + break; + case 0x0D: /* ADPCM address control */ + if ((m_regs[0x0D] & 0x80) && !(data & 0x80)) // ADPCM reset + { + /* Reset ADPCM hardware */ + m_adpcm_read_ptr = 0; + m_adpcm_write_ptr = 0; + m_msm_start_addr = 0; + m_msm_end_addr = 0; + m_msm_half_addr = 0; + m_msm_nibble = 0; + adpcm_stop(0); + m_msm->reset_w(1); + } + + if ((data & 0x40) && ((m_regs[0x0D] & 0x40) == 0)) // ADPCM play + { + m_msm_start_addr = (m_adpcm_read_ptr); + m_msm_end_addr = (m_adpcm_read_ptr + m_adpcm_length) & 0xffff; + m_msm_half_addr = (m_adpcm_read_ptr + (m_adpcm_length / 2)) & 0xffff; + m_msm_nibble = 0; + adpcm_play(); + m_msm->reset_w(0); + + //popmessage("%08x %08x",m_adpcm_read_ptr,m_adpcm_length); + } + else if ((data & 0x40) == 0) + { + /* used by Buster Bros to cancel an in-flight sample */ + adpcm_stop(0); + m_msm->reset_w(1); + } + + m_msm_repeat = BIT(data, 5); + + if (data & 0x10) //ADPCM set length + { + m_adpcm_length = (m_regs[0x09] << 8) | m_regs[0x08]; + } + if (data & 0x08) //ADPCM set read address + { + m_adpcm_read_ptr = (m_regs[0x09] << 8) | m_regs[0x08]; + m_adpcm_read_buf = 2; + } + if ((data & 0x02) == 0x02) //ADPCM set write address + { + m_adpcm_write_ptr = (m_regs[0x09] << 8) | m_regs[0x08]; + m_adpcm_write_buf = data & 1; + } + break; + case 0x0E: /* ADPCM playback rate */ + m_adpcm_clock_divider = 0x10 - (data & 0x0f); + m_msm->change_clock_w((PCE_CD_CLOCK / 6) / m_adpcm_clock_divider); + break; + case 0x0F: /* ADPCM and CD audio fade timer */ + /* TODO: timers needs HW tests */ + if (m_regs[0xf] != data) + { + switch (data & 0xf) + { + case 0x00: //CD-DA / ADPCM enable (100 msecs) + m_cdda_volume = 0.0; + m_cdda_fadein_timer->adjust(attotime::from_usec(100), 100); + m_adpcm_volume = 0.0; + m_adpcm_fadein_timer->adjust(attotime::from_usec(100), 100); + m_cdda_fadeout_timer->adjust(attotime::never); + m_adpcm_fadeout_timer->adjust(attotime::never); + break; + case 0x01: //CD-DA enable (100 msecs) + m_cdda_volume = 0.0; + m_cdda_fadein_timer->adjust(attotime::from_usec(100), 100); + m_cdda_fadeout_timer->adjust(attotime::never); + break; + case 0x08: //CD-DA short (1500 msecs) fade out / ADPCM enable + m_cdda_volume = 100.0; + m_cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500); + m_adpcm_volume = 0.0; + m_adpcm_fadein_timer->adjust(attotime::from_usec(100), 100); + m_cdda_fadein_timer->adjust(attotime::never); + m_adpcm_fadeout_timer->adjust(attotime::never); + break; + case 0x09: //CD-DA long (5000 msecs) fade out + m_cdda_volume = 100.0; + m_cdda_fadeout_timer->adjust(attotime::from_usec(5000), 5000); + m_cdda_fadein_timer->adjust(attotime::never); + break; + case 0x0a: //ADPCM long (5000 msecs) fade out + m_adpcm_volume = 100.0; + m_adpcm_fadeout_timer->adjust(attotime::from_usec(5000), 5000); + m_adpcm_fadein_timer->adjust(attotime::never); + break; + case 0x0c: //CD-DA short (1500 msecs) fade out / ADPCM enable + m_cdda_volume = 100.0; + m_cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500); + m_adpcm_volume = 0.0; + m_adpcm_fadein_timer->adjust(attotime::from_usec(100), 100); + m_cdda_fadein_timer->adjust(attotime::never); + m_adpcm_fadeout_timer->adjust(attotime::never); + break; + case 0x0d: //CD-DA short (1500 msecs) fade out + m_cdda_volume = 100.0; + m_cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500); + m_cdda_fadein_timer->adjust(attotime::never); + break; + case 0x0e: //ADPCM short (1500 msecs) fade out + m_adpcm_volume = 100.0; + m_adpcm_fadeout_timer->adjust(attotime::from_usec(1500), 1500); + m_adpcm_fadein_timer->adjust(attotime::never); + break; + default: + popmessage("CD-DA / ADPCM Fade effect mode %02x, contact MESSdev",data & 0x0f); + break; + } + } + break; + default: + return; + } + m_regs[offset & 0xf] = data; +} + +TIMER_CALLBACK_MEMBER(pce_cd_device::clear_ack) +{ + update(); + m_scsi_ACK = 0; + update(); + if (m_scsi_CD) + { + m_regs[0x0B] &= 0xFC; + } +} + +UINT8 pce_cd_device::get_cd_data_byte() +{ + UINT8 data = m_regs[0x01]; + if (m_scsi_REQ && !m_scsi_ACK && !m_scsi_CD) + { + if (m_scsi_IO) + { + m_scsi_ACK = 1; + machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(15), timer_expired_delegate(FUNC(pce_cd_device::clear_ack),this)); + } + } + return data; +} + + +TIMER_CALLBACK_MEMBER(pce_cd_device::adpcm_dma_timer_callback) +{ + if (m_scsi_REQ && !m_scsi_ACK && !m_scsi_CD && m_scsi_IO) + { + m_adpcm_ram[m_adpcm_write_ptr] = get_cd_data_byte(); + m_adpcm_write_ptr = (m_adpcm_write_ptr + 1) & 0xFFFF; + + m_regs[0x0c] &= ~4; + } +} + +UINT8 pce_cd_device::get_adpcm_ram_byte() +{ + if (m_adpcm_read_buf > 0) + { + m_adpcm_read_buf--; + return 0; + } + else + { + UINT8 res; + + res = m_adpcm_ram[m_adpcm_read_ptr]; + m_adpcm_read_ptr = ((m_adpcm_read_ptr + 1) & 0xffff); + + return res; + } +} + +READ8_MEMBER(pce_cd_device::intf_r) +{ + UINT8 data = m_regs[offset & 0x0F]; + + logerror("%04X: read from CD interface offset %02X\n", space.device().safe_pc(), offset ); + + switch (offset & 0xf) + { + case 0x00: /* CDC status */ + data &= 0x07; + data |= m_scsi_BSY ? 0x80 : 0; + data |= m_scsi_REQ ? 0x40 : 0; + data |= m_scsi_MSG ? 0x20 : 0; + data |= m_scsi_CD ? 0x10 : 0; + data |= m_scsi_IO ? 0x08 : 0; + break; + case 0x01: /* CDC command / status / data */ + break; + case 0x02: /* ADPCM / CD control */ + break; + case 0x03: /* BRAM lock / CD status */ + /* bit 4 set when CD motor is on */ + /* bit 2 set when less than half of the ADPCM data is remaining ?? */ + m_bram_locked = 1; + data = data & 0x6E; + data |= (m_cd_motor_on ? 0x10 : 0); + m_regs[0x03] ^= 0x02; /* TODO: get rid of this hack */ + break; + case 0x04: /* CD reset */ + break; + case 0x05: /* Convert PCM data / PCM data */ + data = m_cdda->get_channel_volume((m_regs[0x03] & 2) ? 0 : 1) & 0xff; + break; + case 0x06: /* PCM data */ + data = m_cdda->get_channel_volume((m_regs[0x03] & 2) ? 0 : 1) >> 8; + break; + case 0x07: /* BRAM unlock / CD status */ + data = (m_bram_locked ? (data & 0x7f) : (data | 0x80)); + break; + case 0x08: /* ADPCM address (LSB) / CD data */ + data = get_cd_data_byte(); + break; + case 0x0A: /* ADPCM RAM data port */ + data = get_adpcm_ram_byte(); + break; + case 0x0B: /* ADPCM DMA control */ + break; + case 0x0C: /* ADPCM status */ + break; + case 0x0D: /* ADPCM address control */ + break; + /* These are read-only registers */ + case 0x09: /* ADPCM address (MSB) */ + case 0x0E: /* ADPCM playback rate */ + case 0x0F: /* ADPCM and CD audio fade timer */ + return 0; + default: + data = 0xFF; + break; + } + + return data; +} + + +/* + +PC Engine Arcade Card emulation + +*/ + +READ8_MEMBER(pce_cd_device::acard_r) +{ + UINT8 r_num; + + if ((offset & 0x2e0) == 0x2e0) + { + switch (offset & 0x2ef) + { + case 0x2e0: return (m_acard_shift >> 0) & 0xff; + case 0x2e1: return (m_acard_shift >> 8) & 0xff; + case 0x2e2: return (m_acard_shift >> 16) & 0xff; + case 0x2e3: return (m_acard_shift >> 24) & 0xff; + case 0x2e4: return (m_acard_shift_reg); + case 0x2e5: return m_acard_latch; + case 0x2ee: return 0x10; + case 0x2ef: return 0x51; + } + + return 0; + } + + r_num = (offset & 0x30) >> 4; + + switch (offset & 0x0f) + { + case 0x00: + case 0x01: + { + UINT8 res; + if (m_acard_ctrl[r_num] & 2) + res = m_acard_ram[(m_acard_base_addr[r_num] + m_acard_addr_offset[r_num]) & 0x1fffff]; + else + res = m_acard_ram[m_acard_base_addr[r_num] & 0x1fffff]; + + if (m_acard_ctrl[r_num] & 0x1) + { + if (m_acard_ctrl[r_num] & 0x10) + { + m_acard_base_addr[r_num] += m_acard_addr_inc[r_num]; + m_acard_base_addr[r_num] &= 0xffffff; + } + else + { + m_acard_addr_offset[r_num] += m_acard_addr_inc[r_num]; + } + } + + return res; + } + case 0x02: return (m_acard_base_addr[r_num] >> 0) & 0xff; + case 0x03: return (m_acard_base_addr[r_num] >> 8) & 0xff; + case 0x04: return (m_acard_base_addr[r_num] >> 16) & 0xff; + case 0x05: return (m_acard_addr_offset[r_num] >> 0) & 0xff; + case 0x06: return (m_acard_addr_offset[r_num] >> 8) & 0xff; + case 0x07: return (m_acard_addr_inc[r_num] >> 0) & 0xff; + case 0x08: return (m_acard_addr_inc[r_num] >> 8) & 0xff; + case 0x09: return m_acard_ctrl[r_num]; + default: return 0; + } +} + +WRITE8_MEMBER(pce_cd_device::acard_w) +{ + UINT8 w_num; + + if ((offset & 0x2e0) == 0x2e0) + { + switch (offset & 0x0f) + { + case 0: m_acard_shift = (data & 0xff) | (m_acard_shift & 0xffffff00); break; + case 1: m_acard_shift = (data << 8) | (m_acard_shift & 0xffff00ff); break; + case 2: m_acard_shift = (data << 16) | (m_acard_shift & 0xff00ffff); break; + case 3: m_acard_shift = (data << 24) | (m_acard_shift & 0x00ffffff); break; + case 4: + { + m_acard_shift_reg = data & 0x0f; + + if (m_acard_shift_reg != 0) + { + m_acard_shift = (m_acard_shift_reg < 8) ? + (m_acard_shift << m_acard_shift_reg) + : (m_acard_shift >> (16 - m_acard_shift_reg)); + } + } + break; + case 5: m_acard_latch = data; break; + } + } + else + { + w_num = (offset & 0x30) >> 4; + + switch (offset & 0x0f) + { + case 0x00: + case 0x01: + if (m_acard_ctrl[w_num] & 2) + m_acard_ram[(m_acard_base_addr[w_num] + m_acard_addr_offset[w_num]) & 0x1fffff] = data; + else + m_acard_ram[m_acard_base_addr[w_num] & 0x1FFFFF] = data; + + if (m_acard_ctrl[w_num] & 0x1) + { + if (m_acard_ctrl[w_num] & 0x10) + { + m_acard_base_addr[w_num] += m_acard_addr_inc[w_num]; + m_acard_base_addr[w_num] &= 0xffffff; + } + else + { + m_acard_addr_offset[w_num] += m_acard_addr_inc[w_num]; + } + } + + break; + + case 0x02: m_acard_base_addr[w_num] = (data & 0xff) | (m_acard_base_addr[w_num] & 0xffff00); break; + case 0x03: m_acard_base_addr[w_num] = (data << 8) | (m_acard_base_addr[w_num] & 0xff00ff); break; + case 0x04: m_acard_base_addr[w_num] = (data << 16) | (m_acard_base_addr[w_num] & 0x00ffff); break; + case 0x05: m_acard_addr_offset[w_num] = (data & 0xff) | (m_acard_addr_offset[w_num] & 0xff00); break; + case 0x06: + m_acard_addr_offset[w_num] = (data << 8) | (m_acard_addr_offset[w_num] & 0x00ff); + + if ((m_acard_ctrl[w_num] & 0x60) == 0x40) + { + m_acard_base_addr[w_num] += m_acard_addr_offset[w_num] + ((m_acard_ctrl[w_num] & 0x08) ? 0xff0000 : 0); + m_acard_base_addr[w_num] &= 0xffffff; + } + break; + case 0x07: m_acard_addr_inc[w_num] = (data & 0xff) | (m_acard_addr_inc[w_num] & 0xff00); break; + case 0x08: m_acard_addr_inc[w_num] = (data << 8) | (m_acard_addr_inc[w_num] & 0x00ff); break; + case 0x09: m_acard_ctrl[w_num] = data & 0x7f; break; + case 0x0a: + if ((m_acard_ctrl[w_num] & 0x60) == 0x60) + { + m_acard_base_addr[w_num] += m_acard_addr_offset[w_num]; + m_acard_base_addr[w_num] &= 0xffffff; + } + break; + } + } +} diff --git a/src/mame/machine/pce_cd.h b/src/mame/machine/pce_cd.h new file mode 100644 index 00000000000..d50bbe27153 --- /dev/null +++ b/src/mame/machine/pce_cd.h @@ -0,0 +1,188 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef __PCE_CD_H +#define __PCE_CD_H + +/*************************************************************************** + TYPE DEFINITIONS + ***************************************************************************/ + +#include "imagedev/chd_cd.h" +#include "machine/nvram.h" +#include "sound/cdda.h" +#include "sound/msm5205.h" + +#define PCE_BRAM_SIZE 0x800 +#define PCE_ADPCM_RAM_SIZE 0x10000 +#define PCE_ACARD_RAM_SIZE 0x200000 +#define PCE_CD_COMMAND_BUFFER_SIZE 0x100 + +#define PCE_CD_IRQ_TRANSFER_READY 0x40 +#define PCE_CD_IRQ_TRANSFER_DONE 0x20 +#define PCE_CD_IRQ_BRAM 0x10 /* ??? */ +#define PCE_CD_IRQ_SAMPLE_FULL_PLAY 0x08 +#define PCE_CD_IRQ_SAMPLE_HALF_PLAY 0x04 + +#define PCE_CD_ADPCM_PLAY_FLAG 0x08 +#define PCE_CD_ADPCM_STOP_FLAG 0x01 + +#define PCE_CD_DATA_FRAMES_PER_SECOND 75 + +enum { + PCE_CD_CDDA_OFF = 0, + PCE_CD_CDDA_PLAYING, + PCE_CD_CDDA_PAUSED +}; + + + +// ======================> pce_cd_device + +class pce_cd_device : public device_t +{ +public: + // construction/destruction + pce_cd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~pce_cd_device() {} + + // device-level overrides + virtual void device_start(); + virtual machine_config_constructor device_mconfig_additions() const; + virtual void device_reset(); + + void update(); + + void late_setup(); + + DECLARE_WRITE8_MEMBER(bram_w); + DECLARE_WRITE8_MEMBER(intf_w); + DECLARE_WRITE8_MEMBER(acard_w); + DECLARE_WRITE_LINE_MEMBER(msm5205_int); + DECLARE_READ8_MEMBER(bram_r); + DECLARE_READ8_MEMBER(intf_r); + DECLARE_READ8_MEMBER(acard_r); + + void nvram_init(nvram_device &nvram, void *data, size_t size); + +private: + void adpcm_stop(UINT8 irq_flag); + void adpcm_play(); + void reply_status_byte(UINT8 status); + void test_unit_ready(); + void read_6(); + void nec_set_audio_start_position(); + void nec_set_audio_stop_position(); + void nec_pause(); + void nec_get_subq(); + void nec_get_dir_info(); + void end_of_list(); + void handle_data_output(); + void handle_data_input(); + void handle_message_output(); + void handle_message_input(); + void set_irq_line(int num, int state); + void set_adpcm_ram_byte(UINT8 val); + UINT8 get_cd_data_byte(); + UINT8 get_adpcm_ram_byte(); + + TIMER_CALLBACK_MEMBER(data_timer_callback); + TIMER_CALLBACK_MEMBER(cdda_fadeout_callback); + TIMER_CALLBACK_MEMBER(cdda_fadein_callback); + TIMER_CALLBACK_MEMBER(adpcm_fadeout_callback); + TIMER_CALLBACK_MEMBER(adpcm_fadein_callback); + TIMER_CALLBACK_MEMBER(clear_ack); + TIMER_CALLBACK_MEMBER(adpcm_dma_timer_callback); + + required_device m_maincpu; + + UINT8 m_regs[16]; + UINT8 *m_bram; + UINT8 *m_adpcm_ram; + int m_bram_locked; + int m_adpcm_read_ptr; + UINT8 m_adpcm_read_buf; + int m_adpcm_write_ptr; + UINT8 m_adpcm_write_buf; + int m_adpcm_length; + int m_adpcm_clock_divider; + UINT32 m_msm_start_addr; + UINT32 m_msm_end_addr; + UINT32 m_msm_half_addr; + UINT8 m_msm_nibble; + UINT8 m_msm_idle; + UINT8 m_msm_repeat; + + /* SCSI signals */ + int m_scsi_BSY; /* Busy. Bus in use */ + int m_scsi_SEL; /* Select. Initiator has won arbitration and has selected a target */ + int m_scsi_CD; /* Control/Data. Target is sending control (data) information */ + int m_scsi_IO; /* Input/Output. Target is sending (receiving) information */ + int m_scsi_MSG; /* Message. Target is sending or receiving a message */ + int m_scsi_REQ; /* Request. Target is requesting a data transfer */ + int m_scsi_ACK; /* Acknowledge. Initiator acknowledges that it is ready for a data transfer */ + int m_scsi_ATN; /* Attention. Initiator has a message ready for the target */ + int m_scsi_RST; /* Reset. Initiator forces all targets and any other initiators to do a warm reset */ + int m_scsi_last_RST; /* To catch setting of RST signal */ + int m_cd_motor_on; + int m_selected; + UINT8 *m_command_buffer; + int m_command_buffer_index; + int m_status_sent; + int m_message_after_status; + int m_message_sent; + UINT8 *m_data_buffer; + int m_data_buffer_size; + int m_data_buffer_index; + int m_data_transferred; + + /* Arcade Card specific */ + UINT8 *m_acard_ram; + UINT8 m_acard_latch; + UINT8 m_acard_ctrl[4]; + UINT32 m_acard_base_addr[4]; + UINT16 m_acard_addr_offset[4]; + UINT16 m_acard_addr_inc[4]; + UINT32 m_acard_shift; + UINT8 m_acard_shift_reg; + + UINT32 m_current_frame; + UINT32 m_end_frame; + UINT32 m_last_frame; + UINT8 m_cdda_status; + UINT8 m_cdda_play_mode; + UINT8 *m_subcode_buffer; + UINT8 m_end_mark; + + required_device m_msm; + required_device m_cdda; + required_device m_nvram; + required_device m_cdrom; + + cdrom_file *m_cd_file; + const cdrom_toc* m_toc; + emu_timer *m_data_timer; + emu_timer *m_adpcm_dma_timer; + + emu_timer *m_cdda_fadeout_timer; + emu_timer *m_cdda_fadein_timer; + double m_cdda_volume; + emu_timer *m_adpcm_fadeout_timer; + emu_timer *m_adpcm_fadein_timer; + double m_adpcm_volume; +}; + + + +// device type definition +extern const device_type PCE_CD; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS + ***************************************************************************/ + +#define MCFG_PCE_CD_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, PCE_CD, 0) + + +#endif diff --git a/src/mame/machine/pecom.c b/src/mame/machine/pecom.c new file mode 100644 index 00000000000..ecf002799f0 --- /dev/null +++ b/src/mame/machine/pecom.c @@ -0,0 +1,179 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Pecom driver by Miodrag Milanovic + + 08/11/2008 Preliminary driver. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/cosmac/cosmac.h" +#include "sound/cdp1869.h" +#include "includes/pecom.h" + +TIMER_CALLBACK_MEMBER(pecom_state::reset_tick) +{ + m_reset = 1; +} + +void pecom_state::machine_start() +{ + static const char *const keynames[] = { + "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", + "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15", "LINE16", + "LINE17", "LINE18", "LINE19", "LINE20", "LINE21", "LINE22", "LINE23", "LINE24","LINE25" + }; + + for ( int i = 0; i < 26; i++ ) + { + m_io_ports[i] = ioport(keynames[i]); + } + + m_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pecom_state::reset_tick),this)); +} + +void pecom_state::machine_reset() +{ + UINT8 *rom = memregion(CDP1802_TAG)->base(); + address_space &space = m_cdp1802->space(AS_PROGRAM); + + + space.unmap_write(0x0000, 0x3fff); + space.install_write_bank(0x4000, 0x7fff, "bank2"); + space.unmap_write(0xf000, 0xf7ff); + space.unmap_write(0xf800, 0xffff); + space.install_read_bank (0xf000, 0xf7ff, "bank3"); + space.install_read_bank (0xf800, 0xffff, "bank4"); + m_bank1->set_base(rom + 0x8000); + m_bank2->set_base(m_ram->pointer() + 0x4000); + m_bank3->set_base(rom + 0xf000); + m_bank4->set_base(rom + 0xf800); + + m_reset = 0; + m_dma = 0; + m_reset_timer->adjust(attotime::from_msec(5)); +} + +READ8_MEMBER(pecom_state::pecom_cdp1869_charram_r) +{ + return m_cdp1869->char_ram_r(space, offset); +} + +WRITE8_MEMBER(pecom_state::pecom_cdp1869_charram_w) +{ + return m_cdp1869->char_ram_w(space, offset, data); +} + +READ8_MEMBER(pecom_state::pecom_cdp1869_pageram_r) +{ + return m_cdp1869->page_ram_r(space, offset); +} + +WRITE8_MEMBER(pecom_state::pecom_cdp1869_pageram_w) +{ + return m_cdp1869->page_ram_w(space, offset, data); +} + +WRITE8_MEMBER(pecom_state::pecom_bank_w) +{ + address_space &space2 = m_cdp1802->space(AS_PROGRAM); + UINT8 *rom = memregion(CDP1802_TAG)->base(); + m_cdp1802->space(AS_PROGRAM).install_write_bank(0x0000, 0x3fff, "bank1"); + m_bank1->set_base(m_ram->pointer() + 0x0000); + + if (data==2) + { + space2.install_read_handler (0xf000, 0xf7ff, read8_delegate(FUNC(pecom_state::pecom_cdp1869_charram_r),this)); + space2.install_write_handler(0xf000, 0xf7ff, write8_delegate(FUNC(pecom_state::pecom_cdp1869_charram_w),this)); + space2.install_read_handler (0xf800, 0xffff, read8_delegate(FUNC(pecom_state::pecom_cdp1869_pageram_r),this)); + space2.install_write_handler(0xf800, 0xffff, write8_delegate(FUNC(pecom_state::pecom_cdp1869_pageram_w),this)); + } + else + { + space2.unmap_write(0xf000, 0xf7ff); + space2.unmap_write(0xf800, 0xffff); + space2.install_read_bank (0xf000, 0xf7ff, "bank3"); + space2.install_read_bank (0xf800, 0xffff, "bank4"); + m_bank3->set_base(rom + 0xf000); + m_bank4->set_base(rom + 0xf800); + } +} + +READ8_MEMBER(pecom_state::pecom_keyboard_r) +{ + /* + INP command BUS -> M(R(X)) BUS -> D + so on each input, address is also set, 8 lower bits are used as input for keyboard + Address is available on address bus during reading of value from port, and that is + used to determine keyboard line reading + */ + UINT16 addr = m_cdp1802->state_int(COSMAC_R0 + m_cdp1802->state_int(COSMAC_X)); + /* just in case somone is reading non existing ports */ + if (addr<0x7cca || addr>0x7ce3) return 0; + return m_io_ports[addr - 0x7cca]->read() & 0x03; +} + +/* CDP1802 Interface */ + +READ_LINE_MEMBER(pecom_state::clear_r) +{ + return m_reset; +} + +READ_LINE_MEMBER(pecom_state::ef2_r) +{ + int shift = BIT(m_io_cnt->read(), 1); + double cas = m_cassette->input(); + + return (cas > 0.0) | shift; +} + +/* +static COSMAC_EF_READ( pecom64_ef_r ) +{ + int flags = 0x0f; + double valcas = (cassette_device_image(device->machine()));->input() + UINT8 val = device->machine().root_device().ioport("CNT")->read(); + + if ((val & 0x04)==0x04 && pecom_prev_caps_state==0) + { + pecom_caps_state = (pecom_caps_state==4) ? 0 : 4; // Change CAPS state + } + pecom_prev_caps_state = val & 0x04; + if (valcas!=0.0) + { // If there is any cassette signal + val = (val & 0x0D); // remove EF2 from SHIFT + flags -= EF2; + if ( valcas > 0.00) flags += EF2; + } + flags -= (val & 0x0b) + pecom_caps_state; + return flags; +} +*/ +WRITE_LINE_MEMBER(pecom_state::q_w) +{ + m_cassette->output(state ? -1.0 : +1.0); +} + +WRITE8_MEMBER(pecom_state::sc_w ) +{ + switch (data) + { + case COSMAC_STATE_CODE_S0_FETCH: + // not connected + break; + + case COSMAC_STATE_CODE_S1_EXECUTE: + break; + + case COSMAC_STATE_CODE_S2_DMA: + // DMA acknowledge clears the DMAOUT request + m_cdp1802->set_input_line(COSMAC_INPUT_LINE_DMAOUT, CLEAR_LINE); + break; + + case COSMAC_STATE_CODE_S3_INTERRUPT: + break; + } +} diff --git a/src/mame/machine/pk8020.c b/src/mame/machine/pk8020.c new file mode 100644 index 00000000000..e065aac7fd7 --- /dev/null +++ b/src/mame/machine/pk8020.c @@ -0,0 +1,908 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + PK-8020 driver by Miodrag Milanovic + based on work of Sergey Erokhin from pk8020.narod.ru + + 18/07/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/pk8020.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/flopdrv.h" + + +READ8_MEMBER(pk8020_state::keyboard_r) +{ + UINT8 retVal=0x00; + UINT8 line = 0; + if (offset & 0x100) line=8; + + if (offset & 0x0001) retVal|=m_io_port[line]->read(); + line++; + if (offset & 0x0002) retVal|=m_io_port[line]->read(); + line++; + if (offset & 0x0004) retVal|=m_io_port[line]->read(); + line++; + if (offset & 0x0008) retVal|=m_io_port[line]->read(); + line++; + if (offset & 0x0010) retVal|=m_io_port[line]->read(); + line++; + if (offset & 0x0020) retVal|=m_io_port[line]->read(); + line++; + if (offset & 0x0040) retVal|=m_io_port[line]->read(); + line++; + if (offset & 0x0080) retVal|=m_io_port[line]->read(); + line++; + + return retVal; +} + +READ8_MEMBER(pk8020_state::sysreg_r) +{ + return m_ram->pointer()[offset]; +} +WRITE8_MEMBER(pk8020_state::sysreg_w) +{ + if (BIT(offset,7)==0) { + pk8020_set_bank(data >> 2); + } else if (BIT(offset,6)==0) { + // Color + m_color = data; + } else if (BIT(offset,2)==0) { + // Palette set + UINT8 number = data & 0x0f; + UINT8 color = data >> 4; + UINT8 i = (color & 0x08) ? 0x3F : 0; + UINT8 r = ((color & 0x04) ? 0xC0 : 0) + i; + UINT8 g = ((color & 0x02) ? 0xC0 : 0) + i; + UINT8 b = ((color & 0x01) ? 0xC0 : 0) + i; + m_palette->set_pen_color( number, rgb_t(r,g,b) ); + } +} + +READ8_MEMBER(pk8020_state::text_r) +{ + if (m_attr == 3) m_text_attr=m_ram->pointer()[0x40400+offset]; + return m_ram->pointer()[0x40000+offset]; +} + +WRITE8_MEMBER(pk8020_state::text_w) +{ + UINT8 *ram = m_ram->pointer(); + ram[0x40000+offset] = data; + switch (m_attr) { + case 0: break; + case 1: ram[0x40400+offset]=0x01;break; + case 2: ram[0x40400+offset]=0x00;break; + case 3: ram[0x40400+offset]=m_text_attr;break; + } +} + +READ8_MEMBER(pk8020_state::gzu_r) +{ + UINT8 *addr = m_ram->pointer() + 0x10000 + (m_video_page_access * 0xC000); + UINT8 p0 = addr[offset]; + UINT8 p1 = addr[offset + 0x4000]; + UINT8 p2 = addr[offset + 0x8000]; + UINT8 retVal = 0; + if(m_color & 0x80) { + // Color mode + if (!(m_color & 0x10)) { + p0 ^= 0xff; + } + if (!(m_color & 0x20)) { + p1 ^= 0xff; + } + if (!(m_color & 0x40)) { + p2 ^= 0xff; + } + retVal = (p0 & p1 & p2) ^ 0xff; + } else { + // Plane mode + if (m_color & 0x10) { + retVal |= p0; + } + if (m_color & 0x20) { + retVal |= p1; + } + if (m_color & 0x40) { + retVal |= p2; + } + } + return retVal; +} + +WRITE8_MEMBER(pk8020_state::gzu_w) +{ + UINT8 *addr = m_ram->pointer() + 0x10000 + (m_video_page_access * 0xC000); + UINT8 *plane_0 = addr; + UINT8 *plane_1 = addr + 0x4000; + UINT8 *plane_2 = addr + 0x8000; + + if(m_color & 0x80) + { + // Color mode + plane_0[offset] = (plane_0[offset] & ~data) | ((m_color & 2) ? data : 0); + plane_1[offset] = (plane_1[offset] & ~data) | ((m_color & 4) ? data : 0); + plane_2[offset] = (plane_2[offset] & ~data) | ((m_color & 8) ? data : 0); + } else { + // Plane mode + UINT8 mask = (m_color & 1) ? data : 0; + if (!(m_color & 0x02)) { + plane_0[offset] = (plane_0[offset] & ~data) | mask; + } + if (!(m_color & 0x04)) { + plane_1[offset] = (plane_1[offset] & ~data) | mask; + } + if (!(m_color & 0x08)) { + plane_2[offset] = (plane_2[offset] & ~data) | mask; + } + } +} + +READ8_MEMBER(pk8020_state::devices_r) +{ + switch(offset & 0x38) + { + case 0x00: return m_pit8253->read(space, offset & 3); + case 0x08: return m_ppi8255_3->read(space,offset & 3); + case 0x10: switch(offset & 1) { + case 0 : return m_rs232->data_r(space,0); + case 1 : return m_rs232->status_r(space,0); + } + break; + case 0x18: return m_wd1793->read(space, offset & 0x03); + case 0x20: switch(offset & 1) { + case 0 : return m_lan->data_r(space,0); + case 1 : return m_lan->status_r(space,0); + } + break; + case 0x28: return m_pic8259->read(space, offset & 1); + case 0x30: return m_ppi8255_2->read(space,offset & 3); + case 0x38: return m_ppi8255_1->read(space,offset & 3); + } + return 0xff; +} + +WRITE8_MEMBER(pk8020_state::devices_w) +{ + switch(offset & 0x38) + { + case 0x00: m_pit8253->write(space, offset & 3, data); break; + case 0x08: m_ppi8255_3->write(space,offset & 3,data); break; + case 0x10: switch(offset & 1) { + case 0 : m_rs232->data_w(space,0,data); break; + case 1 : m_rs232->control_w(space,0,data); break; + } + break; + case 0x18: + m_wd1793->write(space, offset & 0x03, data); + break; + case 0x20: switch(offset & 1) { + case 0 : m_lan->data_w(space,0,data); break; + case 1 : m_lan->control_w(space,0,data); break; + } + break; + case 0x28: m_pic8259->write(space, offset & 1,data);break; + case 0x30: m_ppi8255_2->write(space,offset & 3,data); break; + case 0x38: m_ppi8255_1->write(space,offset & 3,data); break; + } +} + +void pk8020_state::pk8020_set_bank(UINT8 data) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *mem = m_region_maincpu->base(); + UINT8 *ram = m_ram->pointer(); + + switch(data & 0x1F) { + case 0x00 : + { + // ROM + space.install_read_bank (0x0000, 0x37ff, "bank1"); + space.install_write_bank(0x0000, 0x37ff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // Keyboard + space.install_read_handler (0x3800, 0x39ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0x3800, 0x39ff, "bank3"); + membank("bank3")->set_base(ram + 0x3800); + // System reg + space.install_read_handler (0x3a00, 0x3aff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0x3a00, 0x3aff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0x3b00, 0x3bff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0x3b00, 0x3bff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0x3c00, 0x3fff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0x3c00, 0x3fff, write8_delegate(FUNC(pk8020_state::text_w),this)); + // RAM + space.install_read_bank (0x4000, 0xffff, "bank4"); + space.install_write_bank(0x4000, 0xffff, "bank5"); + membank("bank4")->set_base(ram + 0x4000); + membank("bank5")->set_base(ram + 0x4000); + } + break; + case 0x01 : { + // ROM + space.install_read_bank (0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x0000, 0x1fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x2000, 0xffff, "bank3"); + space.install_write_bank(0x2000, 0xffff, "bank4"); + membank("bank3")->set_base(ram + 0x2000); + membank("bank4")->set_base(ram + 0x2000); + } + break; + case 0x02 : { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x4000, 0xffff, "bank3"); + space.install_write_bank(0x4000, 0xffff, "bank4"); + membank("bank3")->set_base(ram + 0x4000); + membank("bank4")->set_base(ram + 0x4000); + } + break; + case 0x03 : { + // RAM + space.install_read_bank (0x0000, 0xffff, "bank1"); + space.install_write_bank(0x0000, 0xffff, "bank2"); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram); + } + break; + case 0x04 : + case 0x05 : + { + // ROM + space.install_read_bank (0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x0000, 0x1fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x2000, 0xf7ff, "bank3"); + space.install_write_bank(0x2000, 0xf7ff, "bank4"); + membank("bank3")->set_base(ram + 0x2000); + membank("bank4")->set_base(ram + 0x2000); + // Keyboard + space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0xf800, 0xf9ff, "bank5"); + membank("bank5")->set_base(ram + 0xf800); + // System reg + space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); + } + break; + case 0x06 : + { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x4000, 0xf7ff, "bank3"); + space.install_write_bank(0x4000, 0xf7ff, "bank4"); + membank("bank3")->set_base(ram + 0x4000); + membank("bank4")->set_base(ram + 0x4000); + // Keyboard + space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0xf800, 0xf9ff, "bank5"); + membank("bank5")->set_base(ram + 0xf800); + // System reg + space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); + } + break; + case 0x07 : + { + // RAM + space.install_read_bank (0x0000, 0xf7ff, "bank1"); + space.install_write_bank(0x0000, 0xf7ff, "bank2"); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram); + // Keyboard + space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0xf800, 0xf9ff, "bank3"); + membank("bank3")->set_base(ram + 0xf800); + // System reg + space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); + } + break; + case 0x08 : + { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // Keyboard + space.install_read_handler (0x3800, 0x39ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0x3800, 0x39ff, "bank3"); + membank("bank3")->set_base(ram + 0x3800); + // System reg + space.install_read_handler (0x3a00, 0x3aff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0x3a00, 0x3aff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0x3b00, 0x3bff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0x3b00, 0x3bff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0x3c00, 0x3fff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0x3c00, 0x3fff, write8_delegate(FUNC(pk8020_state::text_w),this)); + // RAM + space.install_read_bank (0x4000, 0xbfff, "bank4"); + space.install_write_bank(0x4000, 0xbfff, "bank5"); + membank("bank4")->set_base(ram + 0x4000); + membank("bank5")->set_base(ram + 0x4000); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + + } + break; + case 0x09 : + { + // ROM + space.install_read_bank (0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x0000, 0x1fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x2000, 0xbfff, "bank3"); + space.install_write_bank(0x2000, 0xbfff, "bank4"); + membank("bank3")->set_base(ram + 0x2000); + membank("bank4")->set_base(ram + 0x2000); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x0A : + { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x4000, 0xbfff, "bank3"); + space.install_write_bank(0x4000, 0xbfff, "bank4"); + membank("bank3")->set_base(ram + 0x4000); + membank("bank4")->set_base(ram + 0x4000); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x0B : + { + // RAM + space.install_read_bank (0x0000, 0xbfff, "bank1"); + space.install_write_bank(0x0000, 0xbfff, "bank2"); + membank("bank1")->set_base(ram + 0x0000); + membank("bank2")->set_base(ram + 0x0000); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x0C : + case 0x0D : + { + // ROM + space.install_read_bank (0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x0000, 0x1fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x2000, 0x3fff, "bank3"); + space.install_write_bank(0x2000, 0x3fff, "bank4"); + membank("bank3")->set_base(ram + 0x2000); + membank("bank4")->set_base(ram + 0x2000); + // Video RAM + space.install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + // RAM + space.install_read_bank (0x8000, 0xfdff, "bank5"); + space.install_write_bank(0x8000, 0xfdff, "bank6"); + membank("bank5")->set_base(ram + 0x8000); + membank("bank6")->set_base(ram + 0x8000); + // Devices + space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // System reg + space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + } + break; + case 0x0E : + { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // Video RAM + space.install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + // RAM + space.install_read_bank (0x8000, 0xfdff, "bank5"); + space.install_write_bank(0x8000, 0xfdff, "bank6"); + membank("bank5")->set_base(ram + 0x8000); + membank("bank6")->set_base(ram + 0x8000); + // Devices + space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // System reg + space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + } + break; + case 0x0F : + { + // RAM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(ram + 0x0000); + membank("bank2")->set_base(ram + 0x0000); + // Video RAM + space.install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + // RAM + space.install_read_bank (0x8000, 0xfdff, "bank3"); + space.install_write_bank(0x8000, 0xfdff, "bank4"); + membank("bank3")->set_base(ram + 0x8000); + membank("bank4")->set_base(ram + 0x8000); + // Devices + space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // System reg + space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + } + break; + case 0x10 : + { + // ROM + space.install_read_bank (0x0000, 0x5fff, "bank1"); + space.install_write_bank(0x0000, 0x5fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x6000, 0xf7ff, "bank3"); + space.install_write_bank(0x6000, 0xf7ff, "bank4"); + membank("bank3")->set_base(ram + 0x6000); + membank("bank4")->set_base(ram + 0x6000); + // Keyboard + space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0xf800, 0xf9ff, "bank5"); + membank("bank5")->set_base(ram + 0xf800); + // System reg + space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); + } + break; + case 0x11 : + { + // ROM + space.install_read_bank (0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x0000, 0x1fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x2000, 0xf7ff, "bank3"); + space.install_write_bank(0x2000, 0xf7ff, "bank4"); + membank("bank3")->set_base(ram + 0x2000); + membank("bank4")->set_base(ram + 0x2000); + // Keyboard + space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0xf800, 0xf9ff, "bank5"); + membank("bank5")->set_base(ram + 0xf800); + // System reg + space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); + } + break; + case 0x12 : + { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x4000, 0xf7ff, "bank3"); + space.install_write_bank(0x4000, 0xf7ff, "bank4"); + membank("bank3")->set_base(ram + 0x4000); + membank("bank4")->set_base(ram + 0x4000); + // Keyboard + space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0xf800, 0xf9ff, "bank5"); + membank("bank5")->set_base(ram + 0xf800); + // System reg + space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); + } + break; + case 0x13 : + { + // RAM + space.install_read_bank (0x0000, 0xf7ff, "bank1"); + space.install_write_bank(0x0000, 0xf7ff, "bank2"); + membank("bank1")->set_base(ram + 0x0000); + membank("bank2")->set_base(ram + 0x0000); + // Keyboard + space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); + space.install_write_bank(0xf800, 0xf9ff, "bank3"); + membank("bank3")->set_base(ram + 0xf800); + // System reg + space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Devices + space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // Text Video Memory + space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); + space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); + } + break; + case 0x14 : + { + // ROM + space.install_read_bank (0x0000, 0x5fff, "bank1"); + space.install_write_bank(0x0000, 0x5fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x6000, 0xfdff, "bank3"); + space.install_write_bank(0x6000, 0xfdff, "bank4"); + membank("bank3")->set_base(ram + 0x6000); + membank("bank4")->set_base(ram + 0x6000); + // Devices + space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // System reg + space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + } + break; + case 0x15 : + { + // ROM + space.install_read_bank (0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x0000, 0x1fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x2000, 0xfdff, "bank3"); + space.install_write_bank(0x2000, 0xfdff, "bank4"); + membank("bank3")->set_base(ram + 0x2000); + membank("bank4")->set_base(ram + 0x2000); + // Devices + space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // System reg + space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + } + break; + case 0x16 : + { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x4000, 0xfdff, "bank3"); + space.install_write_bank(0x4000, 0xfdff, "bank4"); + membank("bank3")->set_base(ram + 0x4000); + membank("bank4")->set_base(ram + 0x4000); + // Devices + space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // System reg + space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + } + break; + case 0x17 : + { + // RAM + space.install_read_bank (0x0000, 0xfdff, "bank1"); + space.install_write_bank(0x0000, 0xfdff, "bank2"); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram); + // Devices + space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); + space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); + // System reg + space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + } + break; + case 0x18 : + { + // ROM + space.install_read_bank (0x0000, 0x5fff, "bank1"); + space.install_write_bank(0x0000, 0x5fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x6000, 0xbeff, "bank3"); + space.install_write_bank(0x6000, 0xbeff, "bank4"); + membank("bank3")->set_base(ram + 0x6000); + membank("bank4")->set_base(ram + 0x6000); + // System reg + space.install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x19 : + { + // ROM + space.install_read_bank (0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x0000, 0x1fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x2000, 0xbeff, "bank3"); + space.install_write_bank(0x2000, 0xbeff, "bank4"); + membank("bank3")->set_base(ram + 0x2000); + membank("bank4")->set_base(ram + 0x2000); + // System reg + space.install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x1A : + { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x4000, 0xbeff, "bank3"); + space.install_write_bank(0x4000, 0xbeff, "bank4"); + membank("bank3")->set_base(ram + 0x4000); + membank("bank4")->set_base(ram + 0x4000); + // System reg + space.install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x1B : + { + // RAM + space.install_read_bank (0x0000, 0xbeff, "bank1"); + space.install_write_bank(0x0000, 0xbeff, "bank2"); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram); + // System reg + space.install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); + space.install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x1C : + { + // ROM + space.install_read_bank (0x0000, 0x5fff, "bank1"); + space.install_write_bank(0x0000, 0x5fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x6000, 0xbfff, "bank3"); + space.install_write_bank(0x6000, 0xbfff, "bank4"); + membank("bank3")->set_base(ram + 0x6000); + membank("bank4")->set_base(ram + 0x6000); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x1D : + { + // ROM + space.install_read_bank (0x0000, 0x1fff, "bank1"); + space.install_write_bank(0x0000, 0x1fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x2000, 0xbfff, "bank3"); + space.install_write_bank(0x2000, 0xbfff, "bank4"); + membank("bank3")->set_base(ram + 0x2000); + membank("bank4")->set_base(ram + 0x2000); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x1E : + { + // ROM + space.install_read_bank (0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x0000, 0x3fff, "bank2"); + membank("bank1")->set_base(mem + 0x10000); + membank("bank2")->set_base(ram + 0x0000); + // RAM + space.install_read_bank (0x4000, 0xbfff, "bank3"); + space.install_write_bank(0x4000, 0xbfff, "bank4"); + membank("bank3")->set_base(ram + 0x4000); + membank("bank4")->set_base(ram + 0x4000); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + case 0x1F : + { + // RAM + space.install_read_bank (0x0000, 0xbfff, "bank1"); + space.install_write_bank(0x0000, 0xbfff, "bank2"); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram); + // Video RAM + space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); + space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); + } + break; + + } +} + +READ8_MEMBER(pk8020_state::pk8020_porta_r) +{ + return 0xf0 | (m_takt <<1) | (m_text_attr)<<3; +} + +WRITE8_MEMBER(pk8020_state::pk8020_portc_w) +{ + m_video_page_access =(data>>6) & 3; + m_attr = (data >> 4) & 3; + m_wide = (data >> 3) & 1; + m_font = (data >> 2) & 1; + m_video_page = (data & 3); + + + m_portc_data = data; +} + +WRITE8_MEMBER(pk8020_state::pk8020_portb_w) +{ + floppy_image_device *floppy = NULL; + + // Turn all motors off + if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(1); + if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(1); + if (m_floppy2->get_device()) m_floppy2->get_device()->mon_w(1); + if (m_floppy3->get_device()) m_floppy3->get_device()->mon_w(1); + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_wd1793->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); + } + + // todo: at least bit 5 and bit 7 is connected to something too... +} + +READ8_MEMBER(pk8020_state::pk8020_portc_r) +{ + return m_portc_data; +} + + +WRITE8_MEMBER(pk8020_state::pk8020_2_portc_w) +{ + m_sound_gate = BIT(data,3); + + m_speaker->level_w(m_sound_gate ? m_sound_level : 0); +} + +WRITE_LINE_MEMBER(pk8020_state::pk8020_pit_out0) +{ + m_sound_level = state; + + m_speaker->level_w(m_sound_gate ? m_sound_level : 0); +} + + +WRITE_LINE_MEMBER(pk8020_state::pk8020_pit_out1) +{ +} + + +void pk8020_state::machine_start() +{ + static const char *const keynames[] = { + "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", + "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15" + }; + + for ( int i = 0; i < 16; i++ ) + { + m_io_port[i] = ioport(keynames[i]); + } +} + +void pk8020_state::machine_reset() +{ + pk8020_set_bank(0); + + m_sound_gate = 0; + m_sound_level = 0; +} + +INTERRUPT_GEN_MEMBER(pk8020_state::pk8020_interrupt) +{ + m_takt ^= 1; + m_pic8259->ir4_w(1); +} diff --git a/src/mame/machine/pmd85.c b/src/mame/machine/pmd85.c new file mode 100644 index 00000000000..d5435443d26 --- /dev/null +++ b/src/mame/machine/pmd85.c @@ -0,0 +1,838 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/*************************************************************************** + + machine.c + + Functions to emulate general aspects of PMD-85 (RAM, ROM, interrupts, + I/O ports) + + Krzysztof Strzecha + +***************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "includes/pmd85.h" +#include "machine/pit8253.h" + + +enum {PMD85_LED_1, PMD85_LED_2, PMD85_LED_3}; +enum {PMD85_1, PMD85_2, PMD85_2A, PMD85_2B, PMD85_3, ALFA, MATO, C2717}; + + + +void pmd85_state::pmd851_update_memory() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + if (m_startup_mem_map) + { + UINT8 *mem = m_region_maincpu->base(); + + space.unmap_write(0x0000, 0x0fff); + space.nop_write(0x1000, 0x1fff); + space.unmap_write(0x2000, 0x2fff); + space.nop_write(0x3000, 0x3fff); + + space.nop_read(0x1000, 0x1fff); + space.nop_read(0x3000, 0x3fff); + + m_bank1->set_base(mem + 0x010000); + m_bank3->set_base(mem + 0x010000); + m_bank5->set_base(ram + 0xc000); + + m_bank6->set_base(mem + 0x010000); + m_bank7->set_base(mem + 0x010000); + m_bank8->set_base(ram + 0xc000); + } + else + { + space.install_write_bank(0x0000, 0x0fff, "bank1"); + space.install_write_bank(0x1000, 0x1fff, "bank2"); + space.install_write_bank(0x2000, 0x2fff, "bank3"); + space.install_write_bank(0x3000, 0x3fff, "bank4"); + space.install_write_bank(0x4000, 0x7fff, "bank5"); + + space.install_read_bank(0x1000, 0x1fff, "bank2"); + space.install_read_bank(0x3000, 0x3fff, "bank4"); + + m_bank1->set_base(ram); + m_bank2->set_base(ram + 0x1000); + m_bank3->set_base(ram + 0x2000); + m_bank4->set_base(ram + 0x3000); + m_bank5->set_base(ram + 0x4000); + } +} + +void pmd85_state::pmd852a_update_memory() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + if (m_startup_mem_map) + { + UINT8 *mem = m_region_maincpu->base(); + + space.unmap_write(0x0000, 0x0fff); + space.unmap_write(0x2000, 0x2fff); + + m_bank1->set_base(mem + 0x010000); + m_bank2->set_base(ram + 0x9000); + m_bank3->set_base(mem + 0x010000); + m_bank4->set_base(ram + 0xb000); + m_bank5->set_base(ram + 0xc000); + m_bank6->set_base(mem + 0x010000); + m_bank7->set_base(ram + 0x9000); + m_bank8->set_base(mem + 0x010000); + m_bank9->set_base(ram + 0xb000); + m_bank10->set_base(ram + 0xc000); + + } + else + { + space.install_write_bank(0x0000, 0x0fff, "bank1"); + space.install_write_bank(0x2000, 0x2fff, "bank3"); + + m_bank1->set_base(ram); + m_bank2->set_base(ram + 0x1000); + m_bank3->set_base(ram + 0x2000); + m_bank4->set_base(ram + 0x5000); + m_bank5->set_base(ram + 0x4000); + } +} + +void pmd85_state::pmd853_update_memory() +{ + UINT8 *mem = m_region_maincpu->base(); + UINT8 *ram = m_ram->pointer(); + + if (m_startup_mem_map) + { + m_bank1->set_base(mem + 0x010000); + m_bank2->set_base(mem + 0x010000); + m_bank3->set_base(mem + 0x010000); + m_bank4->set_base(mem + 0x010000); + m_bank5->set_base(mem + 0x010000); + m_bank6->set_base(mem + 0x010000); + m_bank7->set_base(mem + 0x010000); + m_bank8->set_base(mem + 0x010000); + m_bank9->set_base(ram); + m_bank10->set_base(ram + 0x2000); + m_bank11->set_base(ram + 0x4000); + m_bank12->set_base(ram + 0x6000); + m_bank13->set_base(ram + 0x8000); + m_bank14->set_base(ram + 0xa000); + m_bank15->set_base(ram + 0xc000); + m_bank16->set_base(ram + 0xe000); + } + else + { + m_bank1->set_base(ram); + m_bank2->set_base(ram + 0x2000); + m_bank3->set_base(ram + 0x4000); + m_bank4->set_base(ram + 0x6000); + m_bank5->set_base(ram + 0x8000); + m_bank6->set_base(ram + 0xa000); + m_bank7->set_base(ram + 0xc000); + m_bank8->set_base(m_pmd853_memory_mapping ? mem + 0x010000 : ram + 0xe000); + } +} + +void pmd85_state::alfa_update_memory() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + if (m_startup_mem_map) + { + UINT8 *mem = m_region_maincpu->base(); + + space.unmap_write(0x0000, 0x0fff); + space.unmap_write(0x1000, 0x33ff); + space.nop_write(0x3400, 0x3fff); + + m_bank1->set_base(mem + 0x010000); + m_bank2->set_base(mem + 0x011000); + m_bank4->set_base(ram + 0xc000); + m_bank5->set_base(mem + 0x010000); + m_bank6->set_base(mem + 0x011000); + m_bank7->set_base(ram + 0xc000); + } + else + { + space.install_write_bank(0x0000, 0x0fff, "bank1"); + space.install_write_bank(0x1000, 0x33ff, "bank2"); + space.install_write_bank(0x3400, 0x3fff, "bank3"); + + m_bank1->set_base(ram); + m_bank2->set_base(ram + 0x1000); + m_bank3->set_base(ram + 0x3400); + m_bank4->set_base(ram + 0x4000); + } +} + +void pmd85_state::mato_update_memory() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + if (m_startup_mem_map) + { + UINT8 *mem = m_region_maincpu->base(); + + space.unmap_write(0x0000, 0x3fff); + + m_bank1->set_base(mem + 0x010000); + m_bank2->set_base(ram + 0xc000); + m_bank3->set_base(mem + 0x010000); + m_bank4->set_base(ram + 0xc000); + } + else + { + space.install_write_bank(0x0000, 0x3fff, "bank1"); + + m_bank1->set_base(ram); + m_bank2->set_base(ram + 0x4000); + } +} + +void pmd85_state::c2717_update_memory() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8 *mem = m_region_maincpu->base(); + UINT8 *ram = m_ram->pointer(); + + if (m_startup_mem_map) + { + space.unmap_write(0x0000, 0x3fff); + + m_bank1->set_base(mem + 0x010000); + m_bank2->set_base(ram + 0x4000); + m_bank3->set_base(mem + 0x010000); + m_bank4->set_base(ram + 0xc000); + } + else + { + space.install_write_bank(0x0000, 0x3fff, "bank1"); + m_bank1->set_base(ram); + m_bank2->set_base(ram + 0x4000); + } +} + +/******************************************************************************* + + Motherboard 8255 (PMD-85.1, PMD-85.2, PMD-85.3, Didaktik Alfa) + -------------------------------------------------------------- + keyboard, speaker, LEDs + +*******************************************************************************/ + +READ8_MEMBER(pmd85_state::pmd85_ppi_0_porta_r) +{ + return 0xff; +} + +READ8_MEMBER(pmd85_state::pmd85_ppi_0_portb_r) +{ + return m_io_port[(m_ppi_port_outputs[0][0] & 0x0f)]->read() & m_io_port[15]->read(); +} + +READ8_MEMBER(pmd85_state::pmd85_ppi_0_portc_r) +{ + return 0xff; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_porta_w) +{ + m_ppi_port_outputs[0][0] = data; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_portb_w) +{ + m_ppi_port_outputs[0][1] = data; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_portc_w) +{ + m_ppi_port_outputs[0][2] = data; + set_led_status(machine(), PMD85_LED_2, (data & 0x08) ? 1 : 0); + set_led_status(machine(), PMD85_LED_3, (data & 0x04) ? 1 : 0); +} + +/******************************************************************************* + + Motherboard 8255 (Mato) + ----------------------- + keyboard, speaker, LEDs, tape + +*******************************************************************************/ + +READ8_MEMBER(pmd85_state::mato_ppi_0_portb_r) +{ + int i; + UINT8 data = 0xff; + + for (i = 0; i < 8; i++) + { + if (!BIT(m_ppi_port_outputs[0][0], i)) + data &= m_io_port[i]->read(); + } + return data; +} + +READ8_MEMBER(pmd85_state::mato_ppi_0_portc_r) +{ + return m_io_port[8]->read() | 0x8f; +} + +WRITE8_MEMBER(pmd85_state::mato_ppi_0_portc_w) +{ + m_ppi_port_outputs[0][2] = data; + set_led_status(machine(), PMD85_LED_2, BIT(data, 3)); + set_led_status(machine(), PMD85_LED_3, BIT(data, 2)); +} + +/******************************************************************************* + + I/O board 8255 + -------------- + GPIO/0 (K3 connector), GPIO/1 (K4 connector) + +*******************************************************************************/ + +READ8_MEMBER(pmd85_state::pmd85_ppi_1_porta_r) +{ + return 0xff; +} + +READ8_MEMBER(pmd85_state::pmd85_ppi_1_portb_r) +{ + return 0xff; +} + +READ8_MEMBER(pmd85_state::pmd85_ppi_1_portc_r) +{ + return 0xff; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_porta_w) +{ + m_ppi_port_outputs[1][0] = data; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_portb_w) +{ + m_ppi_port_outputs[1][1] = data; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_portc_w) +{ + m_ppi_port_outputs[1][2] = data; +} + +/******************************************************************************* + + I/O board 8255 + -------------- + IMS-2 (K5 connector) + + - 8251 - cassette recorder and V.24/IFSS (selectable by switch) + + - external interfaces connector (K2) + +*******************************************************************************/ + +READ8_MEMBER(pmd85_state::pmd85_ppi_2_porta_r) +{ + return 0xff; +} + +READ8_MEMBER(pmd85_state::pmd85_ppi_2_portb_r) +{ + return 0xff; +} + +READ8_MEMBER(pmd85_state::pmd85_ppi_2_portc_r) +{ + return 0xff; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_porta_w) +{ + m_ppi_port_outputs[2][0] = data; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_portb_w) +{ + m_ppi_port_outputs[2][1] = data; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_portc_w) +{ + m_ppi_port_outputs[2][2] = data; +} + +/******************************************************************************* + + I/O board 8251 + -------------- + cassette recorder and V.24/IFSS (selectable by switch) + +*******************************************************************************/ + +/******************************************************************************* + + I/O board external interfaces connector (K2) + -------------------------------------------- + +*******************************************************************************/ + + + +/******************************************************************************* + + ROM Module 8255 + --------------- + port A - data read + ports B, C - address select + +*******************************************************************************/ + +READ8_MEMBER(pmd85_state::pmd85_ppi_3_porta_r) +{ + if (memregion("user1")->base() != NULL) + return memregion("user1")->base()[m_ppi_port_outputs[3][1] | (m_ppi_port_outputs[3][2] << 8)]; + else + return 0; +} + +READ8_MEMBER(pmd85_state::pmd85_ppi_3_portb_r) +{ + return 0xff; +} + +READ8_MEMBER(pmd85_state::pmd85_ppi_3_portc_r) +{ + return 0xff; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_porta_w) +{ + m_ppi_port_outputs[3][0] = data; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_portb_w) +{ + m_ppi_port_outputs[3][1] = data; +} + +WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_portc_w) +{ + m_ppi_port_outputs[3][2] = data; +} + +/******************************************************************************* + + I/O ports (PMD-85.1, PMD-85.2, PMD-85.3, Didaktik Alfa) + ------------------------------------------------------- + + I/O board + 1xxx11aa external interfaces connector (K2) + + 0xxx11aa I/O board interfaces + 000111aa 8251 (casette recorder, V24) + 010011aa 8255 (GPIO/0, GPIO/1) + 010111aa 8253 + 011111aa 8255 (IMS-2) + + Motherboard + 1xxx01aa 8255 (keyboard, speaker, LEDs) + PMD-85.3 memory banking + + ROM Module + 1xxx10aa 8255 (ROM reading) + +*******************************************************************************/ + +READ8_MEMBER(pmd85_state::pmd85_io_r) +{ + if (m_startup_mem_map) + { + return 0xff; + } + + switch (offset & 0x0c) + { + case 0x04: /* Motherboard */ + switch (offset & 0x80) + { + case 0x80: /* Motherboard 8255 */ + return m_ppi8255_0->read(space, offset & 0x03); + } + break; + case 0x08: /* ROM module connector */ + switch (m_model) + { + case PMD85_1: + case PMD85_2: + case PMD85_2A: + case C2717: + case PMD85_3: + if (m_rom_module_present) + { + switch (offset & 0x80) + { + case 0x80: /* ROM module 8255 */ + return m_ppi8255_3->read(space, offset & 0x03); + } + } + break; + } + break; + case 0x0c: /* I/O board */ + switch (offset & 0x80) + { + case 0x00: /* I/O board interfaces */ + switch (offset & 0x70) + { + case 0x10: /* 8251 (casette recorder, V24) */ + switch (offset & 0x01) + { + case 0x00: return m_uart->data_r(space, offset & 0x01); + case 0x01: return m_uart->status_r(space, offset & 0x01); + } + break; + case 0x40: /* 8255 (GPIO/0, GPIO/1) */ + return m_ppi8255_1->read(space, offset & 0x03); + case 0x50: /* 8253 */ + return m_pit8253->read(space, offset & 0x03); + case 0x70: /* 8255 (IMS-2) */ + return m_ppi8255_2->read(space, offset & 0x03); + } + break; + case 0x80: /* external interfaces */ + break; + } + break; + } + + logerror ("Reading from unmapped port: %02x\n", offset); + return 0xff; +} + +WRITE8_MEMBER(pmd85_state::pmd85_io_w) +{ + if (m_startup_mem_map) + { + m_startup_mem_map = 0; + (this->*update_memory)(); + } + + switch (offset & 0x0c) + { + case 0x04: /* Motherboard */ + switch (offset & 0x80) + { + case 0x80: /* Motherboard 8255 */ + m_ppi8255_0->write(space, offset & 0x03, data); + /* PMD-85.3 memory banking */ + if ((offset & 0x03) == 0x03) + { + m_pmd853_memory_mapping = data & 0x01; + (this->*update_memory)(); + } + break; + } + break; + case 0x08: /* ROM module connector */ + switch (m_model) + { + case PMD85_1: + case PMD85_2: + case PMD85_2A: + case C2717: + case PMD85_3: + if (m_rom_module_present) + { + switch (offset & 0x80) + { + case 0x80: /* ROM module 8255 */ + m_ppi8255_3->write(space, offset & 0x03, data); + break; + } + } + break; + } + break; + case 0x0c: /* I/O board */ + switch (offset & 0x80) + { + case 0x00: /* I/O board interfaces */ + switch (offset & 0x70) + { + case 0x10: /* 8251 (casette recorder, V24) */ + switch (offset & 0x01) + { + case 0x00: m_uart->data_w(space, offset & 0x01, data); break; + case 0x01: m_uart->control_w(space, offset & 0x01, data); break; + } + break; + case 0x40: /* 8255 (GPIO/0, GPIO/0) */ + m_ppi8255_1->write(space, offset & 0x03, data); + break; + case 0x50: /* 8253 */ + m_pit8253->write(space, offset & 0x03, data); + logerror ("8253 writing. Address: %02x, Data: %02x\n", offset, data); + break; + case 0x70: /* 8255 (IMS-2) */ + m_ppi8255_2->write(space, offset & 0x03, data); + break; + } + break; + case 0x80: /* external interfaces */ + break; + } + break; + } +} + +/******************************************************************************* + + I/O ports (Mato) + ---------------- + + Motherboard + 1xxx01aa 8255 (keyboard, speaker, LEDs, tape) + +*******************************************************************************/ + +READ8_MEMBER(pmd85_state::mato_io_r) +{ + if (m_startup_mem_map) + { + return 0xff; + } + + switch (offset & 0x0c) + { + case 0x04: /* Motherboard */ + switch (offset & 0x80) + { + case 0x80: /* Motherboard 8255 */ + return m_ppi8255_0->read(space, offset & 0x03); + } + break; + } + + logerror ("Reading from unmapped port: %02x\n", offset); + return 0xff; +} + +WRITE8_MEMBER(pmd85_state::mato_io_w) +{ + if (m_startup_mem_map) + { + m_startup_mem_map = 0; + (this->*update_memory)(); + } + + switch (offset & 0x0c) + { + case 0x04: /* Motherboard */ + switch (offset & 0x80) + { + case 0x80: /* Motherboard 8255 */ + return m_ppi8255_0->write(space, offset & 0x03, data); + } + break; + } +} + +void pmd85_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_CASSETTE: + pmd85_cassette_timer_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in pmd85_state::device_timer"); + } +} + +WRITE_LINE_MEMBER(pmd85_state::write_cas_tx) +{ + m_cas_tx = state; +} + +TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback) +{ + int data; + int current_level; + + if (!(m_io_dsw0->read() & 0x02)) /* V.24 / Tape Switch */ + { + /* tape reading */ + if (m_cassette->get_state()&CASSETTE_PLAY) + { + switch (m_model) + { + case PMD85_1: + if (m_clk_level_tape) + { + m_previous_level = (m_cassette->input() > 0.038) ? 1 : 0; + m_clk_level_tape = 0; + } + else + { + current_level = (m_cassette->input() > 0.038) ? 1 : 0; + + if (m_previous_level!=current_level) + { + data = (!m_previous_level && current_level) ? 1 : 0; + + m_uart->write_rxd(data); + + m_clk_level_tape = 1; + } + } + + m_uart->write_rxc(m_clk_level_tape); + return; + case PMD85_2: + case PMD85_2A: + case C2717: + case PMD85_3: + case ALFA: + /* not hardware data decoding */ + return; + } + } + + /* tape writing */ + if (m_cassette->get_state()&CASSETTE_RECORD) + { + data = m_cas_tx; + data ^= m_clk_level_tape; + m_cassette->output(data&0x01 ? 1 : -1); + + m_clk_level_tape = m_clk_level_tape ? 0 : 1; + m_uart->write_txc(m_clk_level_tape); + + return; + } + + m_clk_level_tape = 1; + + m_clk_level = m_clk_level ? 0 : 1; + m_uart->write_txc(m_clk_level); + } +} + +INPUT_CHANGED_MEMBER(pmd85_state::pmd85_reset) +{ + machine().schedule_soft_reset(); +} + +void pmd85_state::pmd85_common_driver_init() +{ + static const char *const keynames[] = { + "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", + "KEY8", "KEY9", "KEY10", "KEY11", "KEY12", "KEY13", "KEY14", "KEY15" + }; + + for ( int i = 0; i < 16; i++ ) + { + m_io_port[i] = ioport( keynames[i] ); + } + + m_previous_level = 0; + m_clk_level = m_clk_level_tape = 1; + m_cassette_timer = timer_alloc(TIMER_CASSETTE); + m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(2400)); +} + +DRIVER_INIT_MEMBER(pmd85_state,pmd851) +{ + m_model = PMD85_1; + update_memory = &pmd85_state::pmd851_update_memory; + pmd85_common_driver_init(); +} + +DRIVER_INIT_MEMBER(pmd85_state,pmd852a) +{ + m_model = PMD85_2A; + update_memory = &pmd85_state::pmd852a_update_memory; + pmd85_common_driver_init(); +} + +DRIVER_INIT_MEMBER(pmd85_state,pmd853) +{ + m_model = PMD85_3; + update_memory = &pmd85_state::pmd853_update_memory; + pmd85_common_driver_init(); +} + +DRIVER_INIT_MEMBER(pmd85_state,alfa) +{ + m_model = ALFA; + update_memory = &pmd85_state::alfa_update_memory; + pmd85_common_driver_init(); +} + +DRIVER_INIT_MEMBER(pmd85_state,mato) +{ + m_model = MATO; + update_memory = &pmd85_state::mato_update_memory; + + static const char *const keynames[] = { + "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", "KEY8" + }; + + for ( int i = 0; i < 9; i++ ) + { + m_io_port[i] = ioport( keynames[i] ); + } + for ( int i = 9; i < 16; i++ ) + { + m_io_port[i] = NULL; + } +} + +DRIVER_INIT_MEMBER(pmd85_state,c2717) +{ + m_model = C2717; + update_memory = &pmd85_state::c2717_update_memory; + pmd85_common_driver_init(); +} + +void pmd85_state::machine_reset() +{ + int i, j; + + /* checking for Rom Module */ + switch (m_model) + { + case PMD85_1: + case PMD85_2A: + case PMD85_3: + case C2717: + m_rom_module_present = (m_io_dsw0->read() & 0x01) ? 1 : 0; + break; + case ALFA: + case MATO: + break; + } + + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + m_ppi_port_outputs[i][j] = 0; + + /* memory initialization */ + memset(m_ram->pointer(), 0, sizeof(unsigned char)*0x10000); + m_pmd853_memory_mapping = 1; + m_startup_mem_map = 1; + (this->*update_memory)(); +} diff --git a/src/mame/machine/poly88.c b/src/mame/machine/poly88.c new file mode 100644 index 00000000000..47db0168f92 --- /dev/null +++ b/src/mame/machine/poly88.c @@ -0,0 +1,332 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Poly-88 machine by Miodrag Milanovic + + 18/05/2009 Initial implementation + +****************************************************************************/ + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "imagedev/cassette.h" +#include "includes/poly88.h" + + +void poly88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_USART: + poly88_usart_timer_callback(ptr, param); + break; + case TIMER_KEYBOARD: + keyboard_callback(ptr, param); + break; + case TIMER_CASSETTE: + poly88_cassette_timer_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in poly88_state::device_timer"); + } +} + + +TIMER_CALLBACK_MEMBER(poly88_state::poly88_usart_timer_callback) +{ + m_int_vector = 0xe7; + m_maincpu->set_input_line(0, HOLD_LINE); +} + +WRITE8_MEMBER(poly88_state::poly88_baud_rate_w) +{ + logerror("poly88_baud_rate_w %02x\n",data); + m_usart_timer = timer_alloc(TIMER_USART); + m_usart_timer->adjust(attotime::zero, 0, attotime::from_hz(300)); + +} + +UINT8 poly88_state::row_number(UINT8 code) { + if BIT(code,0) return 0; + if BIT(code,1) return 1; + if BIT(code,2) return 2; + if BIT(code,3) return 3; + if BIT(code,4) return 4; + if BIT(code,5) return 5; + if BIT(code,6) return 6; + if BIT(code,7) return 7; + return 0; +} + +TIMER_CALLBACK_MEMBER(poly88_state::keyboard_callback) +{ + int i; + UINT8 code; + UINT8 key_code = 0; + UINT8 shift = m_linec->read() & 0x02 ? 1 : 0; + UINT8 ctrl = m_linec->read() & 0x01 ? 1 : 0; + + for(i = 0; i < 7; i++) + { + switch ( i ) + { + case 0: code = m_line0->read(); break; + case 1: code = m_line1->read(); break; + case 2: code = m_line2->read(); break; + case 3: code = m_line3->read(); break; + case 4: code = m_line4->read(); break; + case 5: code = m_line5->read(); break; + case 6: code = m_line6->read(); break; + default: code = 0; + } + if (code != 0) + { + if (i==0 && shift==0) { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } + if (i==0 && shift==1) { + key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers + } + if (i==1 && shift==0) { + if (row_number(code) < 4) { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } else { + key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs + } + } + if (i==1 && shift==1) { + if (row_number(code) < 4) { + key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs + } else { + key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs + } + } + if (i>=2 && i<=4 && shift==1 && ctrl==0) { + key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters + } + if (i>=2 && i<=4 && shift==0 && ctrl==0) { + key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters + } + if (i>=2 && i<=4 && ctrl==1) { + key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters + } + if (i==5 && shift==1 && ctrl==0) { + if (row_number(code)<7) { + key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters + } else { + key_code = 0x40 + row_number(code) + (i-2)*8; // for signs it is switched + } + } + if (i==5 && shift==0 && ctrl==0) { + if (row_number(code)<7) { + key_code = 0x40 + row_number(code) + (i-2)*8; // for small letters + } else { + key_code = 0x60 + row_number(code) + (i-2)*8; // for signs it is switched + } + } + if (i==5 && shift==0 && ctrl==1) { + key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl + } + if (i==6) { + switch(row_number(code)) + { + case 0: key_code = 0x11; break; + case 1: key_code = 0x12; break; + case 2: key_code = 0x13; break; + case 3: key_code = 0x14; break; + case 4: key_code = 0x20; break; // Space + case 5: key_code = 0x0D; break; // Enter + case 6: key_code = 0x09; break; // TAB + case 7: key_code = 0x0A; break; // LF + } + } + } + } + if (key_code==0 && m_last_code !=0){ + m_int_vector = 0xef; + m_maincpu->set_input_line(0, HOLD_LINE); + } else { + m_last_code = key_code; + } + + timer_set(attotime::from_hz(24000), TIMER_KEYBOARD); +} + +IRQ_CALLBACK_MEMBER(poly88_state::poly88_irq_callback) +{ + return m_int_vector; +} + +WRITE_LINE_MEMBER(poly88_state::write_cas_tx) +{ + m_cas_tx = state; +} + +TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) +{ + int data; + int current_level; + +// if (!(ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ + //{ + /* tape reading */ + if (m_cassette->get_state()&CASSETTE_PLAY) + { + if (m_clk_level_tape) + { + m_previous_level = (m_cassette->input() > 0.038) ? 1 : 0; + m_clk_level_tape = 0; + } + else + { + current_level = (m_cassette->input() > 0.038) ? 1 : 0; + + if (m_previous_level!=current_level) + { + data = (!m_previous_level && current_level) ? 1 : 0; +//data = current_level; + m_uart->write_rxd(data); + + m_clk_level_tape = 1; + } + } + + m_uart->write_rxc(m_clk_level_tape); + } + + /* tape writing */ + if (m_cassette->get_state()&CASSETTE_RECORD) + { + data = m_cas_tx; + data ^= m_clk_level_tape; + m_cassette->output(data&0x01 ? 1 : -1); + + m_clk_level_tape = m_clk_level_tape ? 0 : 1; + m_uart->write_txc(m_clk_level_tape); + + return; + } + + m_clk_level_tape = 1; + + m_clk_level = m_clk_level ? 0 : 1; + m_uart->write_txc(m_clk_level); +// } +} + + +DRIVER_INIT_MEMBER(poly88_state,poly88) +{ + m_previous_level = 0; + m_clk_level = m_clk_level_tape = 1; + m_cassette_timer = timer_alloc(TIMER_CASSETTE); + m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(600)); + + timer_set(attotime::from_hz(24000), TIMER_KEYBOARD); +} + +void poly88_state::machine_reset() +{ + m_intr = 0; + m_last_code = 0; +} + +INTERRUPT_GEN_MEMBER(poly88_state::poly88_interrupt) +{ + m_int_vector = 0xf7; + device.execute().set_input_line(0, HOLD_LINE); +} + +WRITE_LINE_MEMBER(poly88_state::poly88_usart_rxready) +{ + //drvm_int_vector = 0xe7; + //execute().set_input_line(0, HOLD_LINE); +} + +READ8_MEMBER(poly88_state::poly88_keyboard_r) +{ + UINT8 retVal = m_last_code; + m_maincpu->set_input_line(0, CLEAR_LINE); + m_last_code = 0x00; + return retVal; +} + +WRITE8_MEMBER(poly88_state::poly88_intr_w) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); +} + +SNAPSHOT_LOAD_MEMBER( poly88_state, poly88 ) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8* data= auto_alloc_array(machine(), UINT8, snapshot_size); + UINT16 recordNum; + UINT16 recordLen; + UINT16 address; + UINT8 recordType; + + int pos = 0x300; + char name[9]; + int i = 0; + int theend = 0; + + image.fread( data, snapshot_size); + + while (posset_state_int(I8085_PC, address); + theend = 1; + break; + case 4 : + /* 04 Data ( used by Assembler ) */ + logerror("ASM load unsupported\n"); + theend = 1; + break; + case 5 : + /* 05 BASIC program file */ + logerror("BASIC load unsupported\n"); + theend = 1; + break; + case 6 : + /* 06 End ( used by Assembler? ) */ + theend = 1; + break; + default: break; + } + + if (theend) { + break; + } + pos+=recordLen; + } + machine().device("uart")->reset(); + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/pp01.c b/src/mame/machine/pp01.c new file mode 100644 index 00000000000..b171a21d7bd --- /dev/null +++ b/src/mame/machine/pp01.c @@ -0,0 +1,199 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + PP-01 driver by Miodrag Milanovic + + 08/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "includes/pp01.h" + + +WRITE8_MEMBER(pp01_state::pp01_video_write_mode_w) +{ + m_video_write_mode = data & 0x0f; +} + +void pp01_state::pp01_video_w(UINT8 block,UINT16 offset,UINT8 data,UINT8 part) +{ + UINT16 addroffset = part ? 0x1000 : 0x0000; + UINT8 *ram = m_ram->pointer(); + + if (BIT(m_video_write_mode,3)) { + // Copy mode + if(BIT(m_video_write_mode,0)) { + ram[0x6000+offset+addroffset] = data; + } else { + ram[0x6000+offset+addroffset] = 0; + } + if(BIT(m_video_write_mode,1)) { + ram[0xa000+offset+addroffset] = data; + } else { + ram[0xa000+offset+addroffset] = 0; + } + if(BIT(m_video_write_mode,2)) { + ram[0xe000+offset+addroffset] = data; + } else { + ram[0xe000+offset+addroffset] = 0; + } + } else { + if (block==0) { + ram[0x6000+offset+addroffset] = data; + } + if (block==1) { + ram[0xa000+offset+addroffset] = data; + } + if (block==2) { + ram[0xe000+offset+addroffset] = data; + } + } +} + +WRITE8_MEMBER(pp01_state::pp01_video_r_1_w) +{ + pp01_video_w(0,offset,data,0); +} +WRITE8_MEMBER(pp01_state::pp01_video_g_1_w) +{ + pp01_video_w(1,offset,data,0); +} +WRITE8_MEMBER(pp01_state::pp01_video_b_1_w) +{ + pp01_video_w(2,offset,data,0); +} + +WRITE8_MEMBER(pp01_state::pp01_video_r_2_w) +{ + pp01_video_w(0,offset,data,1); +} +WRITE8_MEMBER(pp01_state::pp01_video_g_2_w) +{ + pp01_video_w(1,offset,data,1); +} +WRITE8_MEMBER(pp01_state::pp01_video_b_2_w) +{ + pp01_video_w(2,offset,data,1); +} + + +void pp01_state::pp01_set_memory(UINT8 block, UINT8 data) +{ + UINT8 *mem = memregion("maincpu")->base(); + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT16 startaddr = block*0x1000; + UINT16 endaddr = ((block+1)*0x1000)-1; + UINT8 blocknum = block + 1; + char bank[10]; + sprintf(bank,"bank%d",blocknum); + if (data>=0xE0 && data<=0xEF) { + // This is RAM + space.install_read_bank (startaddr, endaddr, bank); + switch(data) { + case 0xe6 : + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_r_1_w),this)); + break; + case 0xe7 : + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_r_2_w),this)); + break; + case 0xea : + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_g_1_w),this)); + break; + case 0xeb : + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_g_2_w),this)); + break; + case 0xee : + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_b_1_w),this)); + break; + case 0xef : + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_b_2_w),this)); + break; + + default : + space.install_write_bank(startaddr, endaddr, bank); + break; + } + + membank(bank)->set_base(m_ram->pointer() + (data & 0x0F)* 0x1000); + } else if (data>=0xF8) { + space.install_read_bank (startaddr, endaddr, bank); + space.unmap_write(startaddr, endaddr); + membank(bank)->set_base(mem + ((data & 0x0F)-8)* 0x1000+0x10000); + } else { + logerror("%02x %02x\n",block,data); + space.unmap_readwrite (startaddr, endaddr); + } +} + +void pp01_state::machine_reset() +{ + int i; + memset(m_memory_block,0xff,16); + for(i=0;i<16;i++) { + m_memory_block[i] = 0xff; + pp01_set_memory(i, 0xff); + } +} + +WRITE8_MEMBER(pp01_state::pp01_mem_block_w) +{ + m_memory_block[offset] = data; + pp01_set_memory(offset, data); +} + +READ8_MEMBER(pp01_state::pp01_mem_block_r) +{ + return m_memory_block[offset]; +} + +void pp01_state::machine_start() +{ +} + + +WRITE_LINE_MEMBER(pp01_state::pp01_pit_out0) +{ +} + +WRITE_LINE_MEMBER(pp01_state::pp01_pit_out1) +{ +} + +READ8_MEMBER(pp01_state::pp01_8255_porta_r) +{ + return m_video_scroll; +} +WRITE8_MEMBER(pp01_state::pp01_8255_porta_w) +{ + m_video_scroll = data; +} + +READ8_MEMBER(pp01_state::pp01_8255_portb_r) +{ + static const char *const keynames[] = { + "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", + "LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF" + }; + + return (ioport(keynames[m_key_line])->read() & 0x3F) | (ioport("LINEALL")->read() & 0xC0); +} +WRITE8_MEMBER(pp01_state::pp01_8255_portb_w) +{ + //logerror("pp01_8255_portb_w %02x\n",data); + +} + +WRITE8_MEMBER(pp01_state::pp01_8255_portc_w) +{ + if BIT(data, 4) + m_key_line = data & 0x0f; + else + m_speaker->level_w(BIT(data, 0)); +} + +READ8_MEMBER(pp01_state::pp01_8255_portc_r) +{ + return 0xff; +} diff --git a/src/mame/machine/primo.c b/src/mame/machine/primo.c new file mode 100644 index 00000000000..1295fe14b8d --- /dev/null +++ b/src/mame/machine/primo.c @@ -0,0 +1,358 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/******************************************************************************* + + primo.c + + Functions to emulate general aspects of Microkey Primo computers + (RAM, ROM, interrupts, I/O ports) + + Krzysztof Strzecha + +*******************************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "includes/primo.h" + +/* Components */ +#include "cpu/z80/z80.h" +#include "bus/cbmiec/cbmiec.h" +#include "sound/speaker.h" + +/* Devices */ +#include "imagedev/cassette.h" +#include "imagedev/snapquik.h" + + + +/******************************************************************************* + + Interrupt callback + +*******************************************************************************/ + +INTERRUPT_GEN_MEMBER(primo_state::primo_vblank_interrupt) +{ + if (m_nmi) + device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + +/******************************************************************************* + + Memory banking + +*******************************************************************************/ + +void primo_state::primo_update_memory() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + switch (m_port_FD & 0x03) + { + case 0x00: /* Original ROM */ + space.unmap_write(0x0000, 0x3fff); + membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000); + break; + case 0x01: /* EPROM extension 1 */ + space.unmap_write(0x0000, 0x3fff); + membank("bank1")->set_base(m_cart2_rom->base()); + break; + case 0x02: /* RAM */ + space.install_write_bank(0x0000, 0x3fff, "bank1"); + membank("bank1")->set_base(memregion("maincpu")->base()); + break; + case 0x03: /* EPROM extension 2 */ + space.unmap_write(0x0000, 0x3fff); + membank("bank1")->set_base(m_cart1_rom->base()); + break; + } + logerror ("Memory update: %02x\n", m_port_FD); +} + +/******************************************************************************* + + IO read/write handlers + +*******************************************************************************/ + +READ8_MEMBER(primo_state::primo_be_1_r) +{ + UINT8 data = 0x00; + static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" }; + + // bit 7, 6 - not used + + // bit 5 - VBLANK + data |= (machine().first_screen()->vblank()) ? 0x20 : 0x00; + + // bit 4 - I4 (external bus) + + // bit 3 - I3 (external bus) + + // bit 2 - cassette + data |= (m_cassette->input() < 0.1) ? 0x04 : 0x00; + + // bit 1 - reset button + data |= (ioport("RESET")->read()) ? 0x02 : 0x00; + + // bit 0 - keyboard + data |= (ioport(portnames[(offset & 0x0030) >> 4])->read() >> (offset&0x000f)) & 0x0001 ? 0x01 : 0x00; + + return data; +} + +READ8_MEMBER(primo_state::primo_be_2_r) +{ + UINT8 data = 0xff; + + // bit 7, 6 - not used + + // bit 5 - SCLK + if (!m_iec->clk_r()) + data &= ~0x20; + + // bit 4 - SDATA + if (!m_iec->data_r()) + data &= ~0x10; + + // bit 3 - SRQ + if (!m_iec->srq_r()) + data &= ~0x08; + + // bit 2 - joystic 2 (not implemeted yet) + + // bit 1 - ATN + if (!m_iec->atn_r()) + data &= ~0x02; + + // bit 0 - joystic 1 (not implemeted yet) + + logerror ("IOR BE-2 data:%02x\n", data); + return data; +} + +WRITE8_MEMBER(primo_state::primo_ki_1_w) +{ + // bit 7 - NMI generator enable/disable + m_nmi = (data & 0x80) ? 1 : 0; + + // bit 6 - joystick register shift (not emulated) + + // bit 5 - V.24 (2) / tape control (not emulated) + + // bit 4 - speaker + m_speaker->level_w(BIT(data, 4)); + + // bit 3 - display buffer + if (data & 0x08) + m_video_memory_base |= 0x2000; + else + m_video_memory_base &= 0xdfff; + + // bit 2 - V.24 (1) / tape control (not emulated) + + // bit 1, 0 - cassette output + switch (data & 0x03) + { + case 0: + m_cassette->output(-1.0); + break; + case 1: + case 2: + m_cassette->output(0.0); + break; + case 3: + m_cassette->output(1.0); + break; + } +} + +WRITE8_MEMBER(primo_state::primo_ki_2_w) +{ + // bit 7, 6 - not used + + // bit 5 - SCLK + m_iec->clk_w(!BIT(data, 5)); + + // bit 4 - SDATA + m_iec->data_w(!BIT(data, 4)); + + // bit 3 - not used + + // bit 2 - SRQ + m_iec->srq_w(!BIT(data, 2)); + + // bit 1 - ATN + m_iec->atn_w(!BIT(data, 1)); + + // bit 0 - not used + +// logerror ("IOW KI-2 data:%02x\n", data); +} + +WRITE8_MEMBER(primo_state::primo_FD_w) +{ + if (!ioport("MEMORY_EXPANSION")->read()) + { + m_port_FD = data; + primo_update_memory(); + } +} + +/******************************************************************************* + + Driver initialization + +*******************************************************************************/ + +void primo_state::primo_common_driver_init (primo_state *state) +{ + m_port_FD = 0x00; +} + +DRIVER_INIT_MEMBER(primo_state,primo32) +{ + primo_common_driver_init(this); + m_video_memory_base = 0x6800; +} + +DRIVER_INIT_MEMBER(primo_state,primo48) +{ + primo_common_driver_init(this); + m_video_memory_base = 0xa800; +} + +DRIVER_INIT_MEMBER(primo_state,primo64) +{ + primo_common_driver_init(this); + m_video_memory_base = 0xe800; +} + +/******************************************************************************* + + Machine initialization + +*******************************************************************************/ + +void primo_state::primo_common_machine_init () +{ + if (ioport("MEMORY_EXPANSION")->read()) + m_port_FD = 0x00; + primo_update_memory(); + machine().device("maincpu")->set_clock_scale(ioport("CPU_CLOCK")->read() ? 1.5 : 1.0); +} + +void primo_state::machine_start() +{ + std::string region_tag; + m_cart1_rom = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + m_cart2_rom = memregion(region_tag.assign(m_cart2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); +} + +void primo_state::machine_reset() +{ + primo_common_machine_init(); +} + +MACHINE_RESET_MEMBER(primo_state,primob) +{ + primo_common_machine_init(); + +//removed cbm_drive_0_config(SERIAL, 8); +//removed cbm_drive_1_config(SERIAL, 9); +} + +/******************************************************************************* + + Snapshot files (.pss) + +*******************************************************************************/ + +void primo_state::primo_setup_pss (UINT8* snapshot_data, UINT32 snapshot_size) +{ + /* Z80 registers */ + m_maincpu->set_state_int(Z80_BC, snapshot_data[4] + snapshot_data[5]*256); + m_maincpu->set_state_int(Z80_DE, snapshot_data[6] + snapshot_data[7]*256); + m_maincpu->set_state_int(Z80_HL, snapshot_data[8] + snapshot_data[9]*256); + m_maincpu->set_state_int(Z80_AF, snapshot_data[10] + snapshot_data[11]*256); + m_maincpu->set_state_int(Z80_BC2, snapshot_data[12] + snapshot_data[13]*256); + m_maincpu->set_state_int(Z80_DE2, snapshot_data[14] + snapshot_data[15]*256); + m_maincpu->set_state_int(Z80_HL2, snapshot_data[16] + snapshot_data[17]*256); + m_maincpu->set_state_int(Z80_AF2, snapshot_data[18] + snapshot_data[19]*256); + m_maincpu->set_state_int(Z80_PC, snapshot_data[20] + snapshot_data[21]*256); + m_maincpu->set_state_int(Z80_SP, snapshot_data[22] + snapshot_data[23]*256); + m_maincpu->set_state_int(Z80_I, snapshot_data[24]); + m_maincpu->set_state_int(Z80_R, snapshot_data[25]); + m_maincpu->set_state_int(Z80_IX, snapshot_data[26] + snapshot_data[27]*256); + m_maincpu->set_state_int(Z80_IY, snapshot_data[28] + snapshot_data[29]*256); + + + /* IO ports */ + + // KI-1 bit 7 - NMI generator enable/disable + m_nmi = (snapshot_data[30] & 0x80) ? 1 : 0; + + // KI-1 bit 4 - speaker + m_speaker->level_w(BIT(snapshot_data[30], 4)); + + + /* memory */ + for (int i = 0; i < 0xc000; i++) + m_maincpu->space(AS_PROGRAM).write_byte(i + 0x4000, snapshot_data[i + 38]); +} + +SNAPSHOT_LOAD_MEMBER( primo_state, primo ) +{ + dynamic_buffer snapshot_data(snapshot_size); + + if (image.fread(&snapshot_data[0], snapshot_size) != snapshot_size) + { + return IMAGE_INIT_FAIL; + } + + if (strncmp((char *)&snapshot_data[0], "PS01", 4)) + { + return IMAGE_INIT_FAIL; + } + + primo_setup_pss(&snapshot_data[0], snapshot_size); + + return IMAGE_INIT_PASS; +} + +/******************************************************************************* + + Quicload files (.pp) + +*******************************************************************************/ + + +void primo_state::primo_setup_pp(UINT8* quickload_data, UINT32 quickload_size) +{ + UINT16 load_addr; + UINT16 start_addr; + + load_addr = quickload_data[0] + quickload_data[1]*256; + start_addr = quickload_data[2] + quickload_data[3]*256; + + for (int i = 4; i < quickload_size; i++) + m_maincpu->space(AS_PROGRAM).write_byte(start_addr+i-4, quickload_data[i]); + + m_maincpu->set_state_int(Z80_PC, start_addr); + + logerror ("Quickload .pp l: %04x r: %04x s: %04x\n", load_addr, start_addr, quickload_size-4); +} + +QUICKLOAD_LOAD_MEMBER( primo_state, primo ) +{ + dynamic_buffer quickload_data(quickload_size); + + if (image.fread(&quickload_data[0], quickload_size) != quickload_size) + { + return IMAGE_INIT_FAIL; + } + + primo_setup_pp(&quickload_data[0], quickload_size); + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/prof80mmu.c b/src/mame/machine/prof80mmu.c new file mode 100644 index 00000000000..ebdccf33004 --- /dev/null +++ b/src/mame/machine/prof80mmu.c @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Conitec PROF-80 Memory Management Unit emulation + +**********************************************************************/ + +#include "prof80mmu.h" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type PROF80_MMU = &device_creator; + + +DEVICE_ADDRESS_MAP_START( z80_program_map, 8, prof80_mmu_device ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(program_r, program_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, prof80_mmu_device ) +ADDRESS_MAP_END + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// prof80_mmu_device - constructor +//------------------------------------------------- + +prof80_mmu_device::prof80_mmu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PROF80_MMU, "PROF80_MMU", tag, owner, clock, "prof80_mmu", __FILE__), + device_memory_interface(mconfig, *this), + m_program_space_config("program", ENDIANNESS_LITTLE, 8, 20, 0, *ADDRESS_MAP_NAME(program_map)) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void prof80_mmu_device::device_start() +{ + // state saving + save_item(NAME(m_blk)); + save_item(NAME(m_enabled)); +} + + +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *prof80_mmu_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == AS_PROGRAM) ? &m_program_space_config : NULL; +} + + +//------------------------------------------------- +// par_w - +//------------------------------------------------- + +WRITE8_MEMBER( prof80_mmu_device::par_w ) +{ + int bank = offset >> 12; + + m_blk[bank] = (data & 0x0f) ^ 0x0f; +} + + +//------------------------------------------------- +// mme_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( prof80_mmu_device::mme_w ) +{ + m_enabled = (state == 1); +} + + +//------------------------------------------------- +// program_r - program space read +//------------------------------------------------- + +READ8_MEMBER( prof80_mmu_device::program_r ) +{ + if (m_enabled) + { + int bank = offset >> 12; + offset |= m_blk[bank] << 16; + } + else + { + offset |= 0xf0000; + } + + return this->space(AS_PROGRAM).read_byte(offset); +} + + +//------------------------------------------------- +// program_w - program space write +//------------------------------------------------- + +WRITE8_MEMBER( prof80_mmu_device::program_w ) +{ + if (m_enabled) + { + int bank = offset >> 12; + offset |= m_blk[bank] << 16; + } + else + { + offset |= 0xf0000; + } + + this->space(AS_PROGRAM).write_byte(offset, data); +} diff --git a/src/mame/machine/prof80mmu.h b/src/mame/machine/prof80mmu.h new file mode 100644 index 00000000000..89e64f72579 --- /dev/null +++ b/src/mame/machine/prof80mmu.h @@ -0,0 +1,68 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Conitec PROF-80 Memory Management Unit emulation + +**********************************************************************/ + +#pragma once + +#ifndef __PROF80_MMU__ +#define __PROF80_MMU__ + +#include "emu.h" + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_PROF80_MMU_ADD(_tag, _program_map) \ + MCFG_DEVICE_ADD(_tag, PROF80_MMU, 0) \ + MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _program_map) + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> prof80_mmu_device + +class prof80_mmu_device : public device_t, + public device_memory_interface +{ +public: + prof80_mmu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual DECLARE_ADDRESS_MAP(z80_program_map, 8); + + DECLARE_WRITE8_MEMBER( par_w ); + DECLARE_WRITE_LINE_MEMBER( mme_w ); + +protected: + // device-level overrides + virtual void device_start(); + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + + DECLARE_READ8_MEMBER( program_r ); + DECLARE_WRITE8_MEMBER( program_w ); + +private: + const address_space_config m_program_space_config; + + UINT8 m_blk[16]; + bool m_enabled; +}; + + +// device type definition +extern const device_type PROF80_MMU; + + + +#endif diff --git a/src/mame/machine/psion_pack.c b/src/mame/machine/psion_pack.c new file mode 100644 index 00000000000..98f26eb5673 --- /dev/null +++ b/src/mame/machine/psion_pack.c @@ -0,0 +1,323 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/**************************************************************************** + + psion_pack.c + + Psion Organiser II Datapack emulation + + + Datapack pinout from Psion's documentation + __ __ + SD1 1 | \/ | 2 SD0 + SD3 3 | | 4 SD2 + SD5 5 | | 6 SD4 + SD7 7 | | 8 SD6 + SMR 9 | | 10 SCLK + SOE_B 11 | | 12 SS_B + GND 13 | | 14 SPGM_B + SVCC 15 |______| 16 SVPP + +****************************************************************************/ + +#include "emu.h" +#include "psion_pack.h" + +// Datapack control lines +#define DP_LINE_CLOCK 0x01 +#define DP_LINE_RESET 0x02 +#define DP_LINE_PROGRAM 0x04 +#define DP_LINE_OUTPUT_ENABLE 0x08 +#define DP_LINE_SLOT_SELECT 0x10 + +// Datapack ID +#define DP_ID_EPROM 0x02 +#define DP_ID_PAGED 0x04 +#define DP_ID_WRITE 0x08 +#define DP_ID_BOOT 0x10 +#define DP_ID_COPY 0x20 + +#define OPK_HEAD_SIZE 6 + + +static OPTION_GUIDE_START( datapack_option_guide ) + OPTION_INT('S', "size", "Datapack size" ) + OPTION_INT('R', "ram", "RAM/EPROM" ) + OPTION_INT('P', "paged", "Paged" ) + OPTION_INT('W', "protect", "Write-protected" ) + OPTION_INT('B', "boot", "Bootable" ) + OPTION_INT('C', "copy", "Copyable" ) +OPTION_GUIDE_END + +static const char *datapack_option_spec = + "S1/2/4/[8]/16;R0/[1];P[0]/1;W[0]/1;B[0]/1;C0/[1]"; + + +// device type definition +const device_type PSION_DATAPACK = &device_creator; + +//------------------------------------------------- +// datapack_device - constructor +//------------------------------------------------- + +datapack_device::datapack_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PSION_DATAPACK, "Psion Datapack", tag, owner, clock, "datapack", __FILE__), + device_image_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// datapack_device - destructor +//------------------------------------------------- + +datapack_device::~datapack_device() +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void datapack_device::device_start() +{ + call_unload(); +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void datapack_device::device_config_complete() +{ + m_formatlist.append(*global_alloc(image_device_format("opk", "Psion Datapack image", "opk", datapack_option_spec))); + + // set brief and instance name + update_names(); +} + + +//------------------------------------------------- +// option_guide for create new image +//------------------------------------------------- + +const option_guide *datapack_device::create_option_guide() const +{ + return datapack_option_guide; +} + + +/*------------------------------------------------- + update the internal state +-------------------------------------------------*/ + +void datapack_device::update() +{ + UINT32 pack_addr = m_counter + ((m_id & DP_ID_PAGED) ? (m_page << 8) : 0); + + // if the datapack is 128k or more is treated as segmented + if (m_size >= 0x10) + pack_addr += (m_segment << 14); + + if (pack_addr < (m_size << 13)) + { + if ((m_control & DP_LINE_OUTPUT_ENABLE) && !(m_control & DP_LINE_RESET)) + { + // write data + if (software_entry() == NULL && (m_id & DP_ID_WRITE)) + { + fseek(pack_addr + OPK_HEAD_SIZE, SEEK_SET); + fwrite(&m_data, 1); + } + } + else if ((m_control & DP_LINE_OUTPUT_ENABLE) && (m_control & DP_LINE_RESET)) + { + // write datapack segment + if (m_size <= 0x10) + m_segment = m_data & 0x07; + else if (m_size <= 0x20) + m_segment = m_data & 0x0f; + else if (m_size <= 0x40) + m_segment = m_data & 0x1f; + else if (m_size <= 0x80) + m_segment = m_data & 0x3f; + else + m_segment = m_data; + } + else if (!(m_control & DP_LINE_OUTPUT_ENABLE) && !(m_control & DP_LINE_RESET)) + { + // read data + if ((pack_addr + OPK_HEAD_SIZE) < length()) + { + fseek(pack_addr + OPK_HEAD_SIZE, SEEK_SET); + fread(&m_data, 1); + } + else + { + m_data = 0xff; + } + } + else if (!(m_control & DP_LINE_OUTPUT_ENABLE) && (m_control & DP_LINE_RESET)) + { + // read datapack ID + if (m_id & DP_ID_EPROM) + m_data = m_id; + else + m_data = 0x01; // for identify RAM pack + } + } +} + + +/*------------------------------------------------- + read datapack data lines +-------------------------------------------------*/ + +UINT8 datapack_device::data_r() +{ + return (!(m_control & DP_LINE_SLOT_SELECT)) ? m_data : 0; +} + + +/*------------------------------------------------- + write datapack data lines +-------------------------------------------------*/ + +void datapack_device::data_w(UINT8 data) +{ + if (is_loaded()) + { + m_data = data; + + // updates the internal state + if (!(data & DP_LINE_SLOT_SELECT)) + update(); + } +} + + +/*------------------------------------------------- + read datapack control lines +-------------------------------------------------*/ + +UINT8 datapack_device::control_r() +{ + return m_control; +} + + +/*------------------------------------------------- + write datapack control lines +-------------------------------------------------*/ + +void datapack_device::control_w(UINT8 data) +{ + if (is_loaded()) + { + if ((m_control & DP_LINE_CLOCK) != (data & DP_LINE_CLOCK)) + { + // increments the counter + m_counter++; + + if (m_counter >= ((m_id & DP_ID_PAGED) ? 0x100 : (m_size << 13))) + m_counter = 0; + } + + if ((m_control & DP_LINE_PROGRAM) && !(data & DP_LINE_PROGRAM)) + { + // increments the page + m_page++; + + if (m_page >= (m_size << 5)) + m_page = 0; + } + + if (data & DP_LINE_RESET) + { + // reset counter and page + m_counter = 0; + m_page = 0; + } + + m_control = data; + + // updates the internal state + if (!(data & DP_LINE_SLOT_SELECT)) + update(); + } +} + + +/*------------------------------------------------- + DEVICE_IMAGE_LOAD( datapack ) +-------------------------------------------------*/ + +bool datapack_device::call_load() +{ + UINT8 data[0x10]; + + fread(data, 0x10); + + // check the OPK head + if(strncmp((const char*)data, "OPK", 3)) + return IMAGE_INIT_FAIL; + + // get datapack ID and size + m_id = data[OPK_HEAD_SIZE + 0]; + m_size = data[OPK_HEAD_SIZE + 1]; + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + DEVICE_IMAGE_CREATE( datapack ) +-------------------------------------------------*/ + +bool datapack_device::call_create(int format_type, option_resolution *create_args) +{ + static const UINT8 opk_head[6] = {'O', 'P', 'K', 0x00, 0x00, 0x00}; + + if (create_args != NULL) + { + m_id = 0x40; + m_id |= (option_resolution_lookup_int(create_args, 'R')) ? 0x00 : 0x02; + m_id |= (option_resolution_lookup_int(create_args, 'P')) ? 0x04 : 0x00; + m_id |= (option_resolution_lookup_int(create_args, 'W')) ? 0x00 : 0x08; + m_id |= (option_resolution_lookup_int(create_args, 'B')) ? 0x00 : 0x10; + m_id |= (option_resolution_lookup_int(create_args, 'C')) ? 0x20 : 0x00; + m_size = option_resolution_lookup_int(create_args, 'S'); + } + else + { + // 64k RAM datapack by default + m_id = 0x7c; + m_size = 0x08; + } + + fwrite(opk_head, 6); + fwrite(&m_id, 1); + fwrite(&m_size, 1); + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + DEVICE_IMAGE_UNLOAD( datapack ) +-------------------------------------------------*/ + +void datapack_device::call_unload() +{ + m_id = 0; + m_size = 0; + m_counter = 0; + m_page = 0; + m_segment = 0; + m_control = 0; + m_data = 0; +} diff --git a/src/mame/machine/psion_pack.h b/src/mame/machine/psion_pack.h new file mode 100644 index 00000000000..47ff33d8383 --- /dev/null +++ b/src/mame/machine/psion_pack.h @@ -0,0 +1,79 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/**************************************************************************** + + psion_pack.h + +****************************************************************************/ + +#ifndef __PSION_PACK_H__ +#define __PSION_PACK_H__ + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +// ======================> datapack_device + +class datapack_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + datapack_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~datapack_device(); + + // image-level overrides + virtual bool call_load(); + virtual void call_unload(); + virtual bool call_create(int format_type, option_resolution *create_args); + virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); } + + virtual iodevice_t image_type() const { return IO_CARTSLOT; } + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return "psion_pack"; } + virtual const char *file_extensions() const { return "opk"; } + virtual const option_guide *create_option_guide() const; + + // specific implementation + UINT8 data_r(); + void data_w(UINT8 data); + UINT8 control_r(); + void control_w(UINT8 data); + +protected: + // internal helper + void update(); + + // device-level overrides + virtual void device_start(); + virtual void device_config_complete(); + +private: + // internal device state + UINT8 m_id; //datapack ID + UINT8 m_size; //size in 8k blocks + UINT8 m_data; //data lines + UINT8 m_control; //control lines + UINT16 m_counter; //address counter + UINT8 m_page; //active page (only for paged Datapack) + UINT8 m_segment; //active segment (only for segmented Datapack) +}; + + +// device type definition +extern const device_type PSION_DATAPACK; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ + +#define MCFG_PSION_DATAPACK_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, PSION_DATAPACK, 0) +#endif /* __PSION_PACK_H__ */ diff --git a/src/mame/machine/psxcd.c b/src/mame/machine/psxcd.c new file mode 100644 index 00000000000..6bcf6f04e6a --- /dev/null +++ b/src/mame/machine/psxcd.c @@ -0,0 +1,1234 @@ +// license:BSD-3-Clause +// copyright-holders:smf,R. Belmont,pSXAuthor,Carl +#include "emu.h" +#include "psxcd.h" +#include "debugger.h" + +#define VERBOSE_LEVEL ( 0 ) + +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine& machine, int n_level, const char *s_fmt, ... ) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%s: %s", machine.describe_context(), buf ); + } +} + +enum cdrom_events +{ + event_cmd_complete=0, + event_read_sector, + event_play_sector, + event_change_disk +}; + +enum intr_status +{ + intr_nointr=0, + intr_dataready, + intr_acknowledge, + intr_complete, + intr_dataend, + intr_diskerror +}; + +enum mode_flags +{ + mode_double_speed=0x80, + mode_adpcm=0x40, + mode_size=0x20, + mode_size2=0x10, + mode_size_mask=0x30, + mode_channel=0x08, + mode_report=0x04, + mode_autopause=0x02, + mode_cdda=0x01 +}; + +enum status_f +{ + status_playing=0x80, + status_seeking=0x40, + status_reading=0x20, + status_shellopen=0x10, + status_invalid=0x08, + status_seekerror=0x04, + status_standby=0x02, + status_error=0x01 +}; + +struct subheader +{ + UINT8 file, channel, submode, coding; +}; + +enum submode_flags +{ + submode_eof=0x80, + submode_realtime=0x40, + submode_form=0x20, + submode_trigger=0x10, + submode_data=0x08, + submode_audio=0x04, + submode_video=0x02, + submode_eor=0x01 +}; + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type PSXCD = &device_creator; + +psxcd_device::psxcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + cdrom_image_device(mconfig, PSXCD, "PSX Cdrom", tag, owner, clock, "psx_cd", __FILE__), + m_irq_handler(*this) +{ + static_set_interface(*this, "psx_cdrom"); +} + + +void psxcd_device::device_start() +{ + cdrom_image_device::device_start(); + m_irq_handler.resolve_safe(); + + m_maincpu = machine().device("maincpu"); + m_spu = machine().device("spu"); + + unsigned int sysclk=m_maincpu->clock()/2; + start_read_delay=(sysclk/60); + read_sector_cycles=(sysclk/75); + preread_delay=(read_sector_cycles>>2)-500; + + m_sysclock = sysclk; + + res_queue = NULL; + rdp = 0; + status=status_shellopen; + mode=0; + + for (int i = 0; i < MAX_PSXCD_TIMERS; i++) + { + m_timers[i] = timer_alloc(i); + m_timerinuse[i] = false; + } + + save_item(NAME(cmdbuf)); + save_item(NAME(mode)); + save_item(NAME(secbuf)); + save_item(NAME(filter_file)); + save_item(NAME(filter_channel)); + save_item(NAME(lastsechdr)); + save_item(NAME(status)); + save_item(NAME(rdp)); + save_item(NAME(m_cursec)); + save_item(NAME(sectail)); + save_item(NAME(m_transcurr)); + save_item(NAME(m_transbuf)); + save_item(NAME(loc.w)); + save_item(NAME(curpos.w)); + save_item(NAME(open)); + save_item(NAME(m_mute)); + save_item(NAME(m_dmaload)); + save_item(NAME(next_read_event)); + save_item(NAME(next_sector_t)); + save_item(NAME(autopause_sector)); + save_item(NAME(m_param_count)); +} + +void psxcd_device::device_stop() +{ + for (int i = 0; i < MAX_PSXCD_TIMERS; i++) + { + if(m_timerinuse[i] && m_timers[i]->ptr()) + global_free((command_result *)m_timers[i]->ptr()); + } + while(res_queue) + { + command_result *res = res_queue->next; + global_free(res_queue); + res_queue = res; + } +} + +void psxcd_device::device_reset() +{ + next_read_event = -1; + stop_read(); + + for (int i = 0; i < MAX_PSXCD_TIMERS; i++) + { + if(m_timerinuse[i] && m_timers[i]->ptr()) + global_free((command_result *)m_timers[i]->ptr()); + m_timers[i]->adjust(attotime::never, 0, attotime::never); + m_timerinuse[i] = false; + } + open = true; + if(m_cdrom_handle) + add_system_event(event_change_disk, m_sysclock, NULL); + + while(res_queue) + { + command_result *res = res_queue->next; + global_free(res_queue); + res_queue = res; + } + + m_param_count = 0; + m_regs.sr = 0x18; + m_regs.ir = 0; + m_regs.imr = 0x1f; + sectail = 0; + m_cursec = 0; + m_mute = false; + m_dmaload = false; + m_int1 = NULL; + curpos.w = 0; +} + +bool psxcd_device::call_load() +{ + bool ret = cdrom_image_device::call_load(); + open = true; + if(ret == IMAGE_INIT_PASS) + add_system_event(event_change_disk, m_sysclock, NULL); // 1 sec to spin up the disk + return ret; +} + +void psxcd_device::call_unload() +{ + stop_read(); + cdrom_image_device::call_unload(); + open = true; + status = status_shellopen; + send_result(intr_diskerror); +} + +READ8_MEMBER( psxcd_device::read ) +{ + UINT8 ret = 0; + switch (offset & 3) + { + /* + x--- ---- command/parameter busy flag + -x-- ---- data fifo full (active low) + --x- ---- response fifo empty (active low) + ---x ---- parameter fifo full (active low) + ---- x--- parameter fifo empty (active high) + ---- --xx cmd mode + */ + case 0: + ret = m_regs.sr; + break; + + case 1: + if ((res_queue) && (rdp < res_queue->sz)) + { + ret = res_queue->data[rdp++]; + if(rdp == res_queue->sz) + m_regs.sr &= ~0x20; + else + m_regs.sr |= 0x20; + } + else + ret = 0; + break; + + case 2: + if(!m_dmaload) + ret = 0; + else + { + ret = m_transbuf[m_transcurr++]; + if(m_transcurr >= raw_sector_size) + { + m_dmaload = false; + m_regs.sr &= ~0x40; + } + } + break; + + case 3: + if(m_regs.sr & 1) + ret = m_regs.ir | 0xe0; + else + ret = m_regs.imr | 0xe0; + break; + } + + verboselog(machine(), 2, "psxcd: read byte %08x = %02x\n",offset,ret); + + return ret; +} + +WRITE8_MEMBER( psxcd_device::write ) +{ + verboselog(machine(), 2, "psxcd: write byte %08x = %02x\n",offset,data); + + switch ((offset & 3) | ((m_regs.sr & 3) << 4)) + { + case 0x00: + case 0x10: + case 0x20: + case 0x30: + m_regs.sr = (m_regs.sr & ~3) | (data & 3); + break; + + case 0x01: + write_command(data); + break; + + case 0x11: + case 0x21: + break; + + case 0x31: + m_regs.vol.rr = data; + break; + + case 0x02: + cmdbuf[m_param_count] = data; + m_param_count++; + break; + + case 0x12: + m_regs.imr = data & 0x1f; + break; + + case 0x22: + m_regs.vol.ll = data; + break; + + case 0x32: + m_regs.vol.rl = data; + break; + /* + x--- ---- unknown + -x-- ---- Reset parameter FIFO + --x- ---- unknown (used on transitions, so it certainly resets something) + ---x ---- Command start + ---- -xxx Response received + */ + case 0x03: + if((data & 0x80) && !m_dmaload) + { + m_dmaload = true; + memcpy(m_transbuf, secbuf[m_cursec], raw_sector_size); + m_regs.sr |= 0x40; + + m_cursec++; + m_cursec %= sector_buffer_size; + + switch(mode & mode_size_mask) + { + case 0x00: + default: + m_transcurr = 24; + break; + case 0x10: + m_transcurr = 24; + break; + case 0x20: + m_transcurr = 12; + break; + } +#if (VERBOSE_LEVEL > 0) + char str[1024]; + for (int i=0; i<12; i++) + sprintf(&str[i*4], "%02x ", m_transbuf[i+12]); + verboselog(machine(), 1, "psxcd: request data=%s\n",str); +#endif + } + else if(!(data & 0x80)) + { + m_dmaload = false; + m_regs.sr &= ~0x40; + } + break; + + case 0x13: + if(data & 0x1f) + { + m_regs.ir &= ~(data & 0x1f); + + if(res_queue && !m_regs.ir) + { + command_result *res = res_queue; + if(res == m_int1) + m_int1 = NULL; + + res_queue = res->next; + global_free(res); + m_regs.sr &= ~0x20; + rdp = 0; + if(res_queue) + { + m_regs.sr |= 0x20; + m_regs.ir = res_queue->res; + } + verboselog(machine(), 1, "psxcd: nextres\n"); + } + } + if(data & 0x40) + m_param_count = 0; + break; + + case 0x23: + m_regs.vol.lr = data; + break; + + case 0x33: + break; + } +} + +const psxcd_device::cdcmd psxcd_device::cmd_table[]= +{ + &psxcd_device::cdcmd_sync, + &psxcd_device::cdcmd_nop, + &psxcd_device::cdcmd_setloc, + &psxcd_device::cdcmd_play, + &psxcd_device::cdcmd_forward, + &psxcd_device::cdcmd_backward, + &psxcd_device::cdcmd_readn, + &psxcd_device::cdcmd_standby, + &psxcd_device::cdcmd_stop, + &psxcd_device::cdcmd_pause, + &psxcd_device::cdcmd_init, + &psxcd_device::cdcmd_mute, + &psxcd_device::cdcmd_demute, + &psxcd_device::cdcmd_setfilter, + &psxcd_device::cdcmd_setmode, + &psxcd_device::cdcmd_getparam, + &psxcd_device::cdcmd_getlocl, + &psxcd_device::cdcmd_getlocp, + &psxcd_device::cdcmd_unknown12, + &psxcd_device::cdcmd_gettn, + &psxcd_device::cdcmd_gettd, + &psxcd_device::cdcmd_seekl, + &psxcd_device::cdcmd_seekp, + &psxcd_device::cdcmd_illegal17, + &psxcd_device::cdcmd_illegal18, + &psxcd_device::cdcmd_test, + &psxcd_device::cdcmd_id, + &psxcd_device::cdcmd_reads, + &psxcd_device::cdcmd_reset, + &psxcd_device::cdcmd_illegal1d, + &psxcd_device::cdcmd_readtoc +}; + +void psxcd_device::write_command(UINT8 byte) +{ + if(byte > 31) + illegalcmd(byte); + else + (this->*cmd_table[byte])(); + m_param_count = 0; +} + +void psxcd_device::cdcmd_sync() +{ + verboselog(machine(), 1, "psxcd: sync\n"); + + stop_read(); + send_result(intr_acknowledge); +} + +void psxcd_device::cdcmd_nop() +{ + verboselog(machine(), 1, "psxcd: nop\n"); + + if (!open) + status &= ~status_shellopen; + + send_result(intr_complete); +} + +void psxcd_device::cdcmd_setloc() +{ + verboselog(machine(), 1, "psxcd: setloc %08x:%08x:%08x\n", cmdbuf[0], cmdbuf[1], cmdbuf[2]); + + stop_read(); + + + CDPOS l; + l.b[M]=bcd_to_decimal(cmdbuf[0]); + l.b[S]=bcd_to_decimal(cmdbuf[1]); + l.b[F]=bcd_to_decimal(cmdbuf[2]); + + if ((l.b[M]>0) || (l.b[S]>=2)) + loc.w=l.w; + else + verboselog(machine(), 0, "psxcd: setloc out of range: %02d:%02d:%02d\n",l.b[M],l.b[S],l.b[F]); + + send_result(intr_complete); +} + +void psxcd_device::cdcmd_play() +{ + if(cmdbuf[0] && m_param_count) + loc.w = lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, bcd_to_decimal(cmdbuf[0]) - 1)); + + curpos.w = loc.w; + if (!curpos.w) + curpos.b[S] = 2; + + verboselog(machine(), 1, "psxcd: play %02x %02x %02x => %d\n", decimal_to_bcd(loc.b[M]), decimal_to_bcd(loc.b[S]), decimal_to_bcd(loc.b[F]), msf_to_lba_ps(loc.w)); + + stop_read(); + start_play(); + send_result(intr_complete); +} + +void psxcd_device::cdcmd_forward() +{ + verboselog(machine(), 1, "psxcd: forward\n"); +} + +void psxcd_device::cdcmd_backward() +{ + verboselog(machine(), 1, "psxcd: backward\n"); +} + +void psxcd_device::cdcmd_readn() +{ + if(!open) + { + verboselog(machine(), 1, "psxcd: readn\n"); + + curpos.w=loc.w; + + stop_read(); + start_read(); + } else + { + send_result(intr_diskerror, NULL, 0, 0x80); + } +} + +void psxcd_device::cdcmd_standby() +{ + verboselog(machine(), 1, "psxcd: standby\n"); + + stop_read(); + send_result(intr_acknowledge); +} + +void psxcd_device::cdcmd_stop() +{ + verboselog(machine(), 1, "psxcd: stop\n"); + + stop_read(); + send_result(intr_acknowledge); +} + +void psxcd_device::cdcmd_pause() +{ + verboselog(machine(), 1, "psxcd: pause\n"); + + stop_read(); + + send_result(intr_acknowledge); +} + +void psxcd_device::cdcmd_init() +{ + verboselog(machine(), 1, "psxcd: init\n"); + + stop_read(); + mode=0; + m_regs.sr |= 0x10; + + send_result(intr_acknowledge); +} + +void psxcd_device::cdcmd_mute() +{ + verboselog(machine(), 1, "psxcd: mute\n"); + + m_mute = true; + send_result(intr_complete); +} + +void psxcd_device::cdcmd_demute() +{ + verboselog(machine(), 1, "psxcd: demute\n"); + + m_mute = false; + send_result(intr_complete); +} + +void psxcd_device::cdcmd_setfilter() +{ + verboselog(machine(), 1, "psxcd: setfilter %08x,%08x\n",cmdbuf[0],cmdbuf[1]); + + filter_file=cmdbuf[0]; + filter_channel=cmdbuf[1]; + + send_result(intr_acknowledge); +} + +void psxcd_device::cdcmd_setmode() +{ + verboselog(machine(), 1, "psxcd: setmode %08x\n",cmdbuf[0]); + + mode=cmdbuf[0]; + send_result(intr_complete); +} + +void psxcd_device::cdcmd_getparam() +{ + unsigned char data[6]= + { + status, + mode, + filter_file, + filter_channel, + 0, + 0 + }; + + verboselog(machine(), 1, "psxcd: getparam [%02x %02x %02x %02x %02x %02x]\n", + data[0], data[1], data[2], data[3], data[4], data[5]); + + send_result(intr_complete,data,6); +} + +UINT32 psxcd_device::sub_loc(CDPOS src1, CDPOS src2) +{ + CDPOS dst; + int f=src1.b[F]-src2.b[F], + s=src1.b[S]-src2.b[S], + m=src1.b[M]-src2.b[M]; + while (f<0) { s--; f+=75; } + while (s<0) { m--; s+=60; } + + if (m<0) + m=s=f=0; + + dst.b[M]=m; + dst.b[S]=s; + dst.b[F]=f; + + return dst.w; +} + +void psxcd_device::cdcmd_getlocl() +{ + verboselog(machine(), 1, "psxcd: getlocl [%02x %02x %02x %02x %02x %02x %02x %02x]\n", + lastsechdr[0], lastsechdr[1], lastsechdr[2], lastsechdr[3], + lastsechdr[4], lastsechdr[5], lastsechdr[6], lastsechdr[7]); + + send_result(intr_complete,lastsechdr,8); +} + +void psxcd_device::cdcmd_getlocp() +{ + CDPOS tloc, start; + UINT8 track = cdrom_get_track(m_cdrom_handle, msf_to_lba_ps(loc.w)) + 1; + start.w = (track == 1) ? 0x000200 : lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, track - 1)); + tloc.w = sub_loc(loc, start); + + unsigned char data[8]= + { + decimal_to_bcd(track), // track + 0x01, // index + decimal_to_bcd(tloc.b[M]), // min + decimal_to_bcd(tloc.b[S]), // sec + decimal_to_bcd(tloc.b[F]), // frame + decimal_to_bcd(loc.b[M]), // amin + decimal_to_bcd(loc.b[S]), // asec + decimal_to_bcd(loc.b[F]) // aframe + }; + + verboselog(machine(), 1, "psxcd: getlocp [%02x %02x %02x %02x %02x %02x %02x %02x]\n", + data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); + + send_result(intr_complete,data,8); +} + +void psxcd_device::cdcmd_gettn() +{ + verboselog(machine(), 1, "psxcd: gettn\n"); + + + if(!open) + { + unsigned char data[3]= + { + status, + decimal_to_bcd(1), + decimal_to_bcd(cdrom_get_last_track(m_cdrom_handle)) + }; + + send_result(intr_complete,data,3); + } + else + { + send_result(intr_diskerror, NULL, 0, 0x80); + } +} + +void psxcd_device::cdcmd_gettd() +{ + UINT8 track = bcd_to_decimal(cmdbuf[0]); + UINT8 last = cdrom_get_last_track(m_cdrom_handle); + if(track <= last) + { + CDPOS trkstart; + if(!track) // length of disk + trkstart.w = lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, 0xaa)); + else + trkstart.w = lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, track - 1)); + + unsigned char data[3]= + { + status, + decimal_to_bcd(trkstart.b[M]), + decimal_to_bcd(trkstart.b[S]) + }; + + verboselog(machine(), 1, "psxcd: gettd %02x [%02x %02x %02x]\n", cmdbuf[0], data[0], data[1], data[2]); + + send_result(intr_acknowledge,data,3); + } + else + { + send_result(intr_diskerror, NULL, 0, 0x80); + } +} + +void psxcd_device::cdcmd_seekl() +{ + verboselog(machine(), 1, "psxcd: seekl [%02d:%02d:%02d]\n", loc.b[M], loc.b[S], loc.b[F]); + + curpos.w=loc.w; + + send_result(intr_acknowledge); +} + +void psxcd_device::cdcmd_seekp() +{ + verboselog(machine(), 1, "psxcd: seekp\n"); + + curpos.w=loc.w; + + send_result(intr_acknowledge); +} + +void psxcd_device::cdcmd_test() +{ + verboselog(machine(), 1, "psxcd: test %02x\n", cmdbuf[0]); + + switch(cmdbuf[0]) + { + case 0x20: + { + static UINT8 data[4]= + { + 0x95, + 0x07, + 0x06, + 0xff + }; + + send_result(intr_complete,data,4); + break; + } + + default: + verboselog(machine(), 0, "psxcd: unimplemented test cmd %02x\n", cmdbuf[0]); + cmd_complete(prepare_result(intr_diskerror, NULL, 0, 0x10)); + break; + } +} + +void psxcd_device::cdcmd_id() +{ + verboselog(machine(), 1, "psxcd: id\n"); + + if (!open) + { + UINT8 cdid[8]; + int irq; + memset(cdid, '\0', 8); + + send_result(intr_complete); + if(cdrom_get_track_type(m_cdrom_handle, 0) == CD_TRACK_AUDIO) + { + irq = intr_diskerror; + cdid[0] = status | status_invalid; + cdid[1] = 0x90; + } + else + { + irq = intr_acknowledge; + cdid[0] = status; + cdid[4] = 'S'; + cdid[5] = 'C'; + cdid[6] = 'E'; + cdid[7] = 'A'; + } + send_result(irq,cdid,8,default_irq_delay*3); + } + else + { + send_result(intr_diskerror, NULL, 0, 0x80); + } +} + +void psxcd_device::cdcmd_reads() +{ + if(!open) + { + verboselog(machine(), 1, "psxcd: reads\n"); + + curpos.w=loc.w; + + stop_read(); + start_read(); + } else + { + send_result(intr_diskerror, NULL, 0, 0x80); + } +} + +void psxcd_device::cdcmd_reset() +{ + verboselog(machine(), 1, "psxcd: reset\n"); +} + +void psxcd_device::cdcmd_readtoc() +{ + verboselog(machine(), 1, "psxcd: readtoc\n"); + + send_result(intr_complete); + send_result(intr_acknowledge, NULL, 0, default_irq_delay*3); // ? +} + +void psxcd_device::cdcmd_unknown12() +{ + verboselog(machine(), 1, "psxcd: unknown 12\n"); + // set session? readt? + if(cmdbuf[0] == 1) + send_result(intr_complete); + else + send_result(intr_diskerror, NULL, 0, 0x40); +} + +void psxcd_device::cdcmd_illegal17() +{ + illegalcmd(0x17); // set clock? +} + +void psxcd_device::cdcmd_illegal18() +{ + illegalcmd(0x18); // get clock? +} + +void psxcd_device::cdcmd_illegal1d() +{ + illegalcmd(0x1d); // read q subchannel +} + +void psxcd_device::illegalcmd(UINT8 cmd) +{ + verboselog(machine(), 0, "psxcd: unimplemented cd command %02x\n", cmd); + + send_result(intr_diskerror, NULL, 0, 0x40); +} + +void psxcd_device::cmd_complete(command_result *res) +{ + command_result *rf; + + verboselog(machine(), 1, "psxcd: irq [%d]\n", res->res); + + if (res_queue) + { + for (rf=res_queue; rf->next; rf=rf->next); + rf->next=res; + } + else + { + res_queue = res; + m_regs.ir = res_queue->res; + if(m_regs.ir & m_regs.imr) + m_irq_handler(1); + m_regs.sr |= 0x20; + } + res->next = NULL; +} + +psxcd_device::command_result *psxcd_device::prepare_result(UINT8 res, UINT8 *data, int sz, UINT8 errcode) +{ + command_result *cr=global_alloc(command_result); + + cr->res=res; + if (sz) + { + assert(szdata)); + memcpy(cr->data,data,sz); + cr->sz=sz; + } else + { + if((res == intr_diskerror) && errcode) + { + cr->data[0] = status | status_error; + cr->data[1] = errcode; + cr->sz = 2; + } + else + { + cr->data[0]=status; + cr->sz=1; + } + } + status &= ~status_error; + + return cr; +} + +void psxcd_device::send_result(UINT8 res, UINT8 *data, int sz, int delay, UINT8 errcode) +{ + // Avoid returning results after sector read results - + // delay the sector read slightly if necessary + + UINT64 systime = m_maincpu->total_cycles(); + if ((next_read_event != -1) && ((systime+delay)>(next_sector_t))) + { + UINT32 hz = m_sysclock / (delay + 2000); + m_timers[next_read_event]->adjust(attotime::from_hz(hz), 0, attotime::never); + } + + add_system_event(event_cmd_complete, delay, prepare_result(res, data, sz, errcode)); +} + +void psxcd_device::start_dma(UINT8 *mainram, UINT32 size) +{ + UINT32 sector_size; + verboselog(machine(), 1, "psxcd: start dma %d bytes at %d\n", size, m_transcurr); + + if(!m_dmaload) + return; + + switch(mode & mode_size_mask) + { + case 0x00: + default: + sector_size = 2048 + 24; + break; + case 0x10: + sector_size = 2328 + 12; + break; + case 0x20: + sector_size = 2340 + 12; + break; + } + + if(size > (sector_size - m_transcurr)) + size = (sector_size - m_transcurr); + + memcpy(mainram, &m_transbuf[m_transcurr], size); + m_transcurr += size; + + if(sector_size <= m_transcurr) + { + m_dmaload = false; + m_regs.sr &= ~0x40; + } +} + +void psxcd_device::read_sector() +{ + next_read_event=-1; + + if (status & status_reading) + { + bool isend = false; + UINT32 sector = msf_to_lba_ps(curpos.w); + UINT8 *buf = secbuf[sectail]; + if (cdrom_read_data(m_cdrom_handle, sector, buf, CD_TRACK_RAW_DONTCARE)) + { + subheader *sub=(subheader *)(buf+16); + memcpy(lastsechdr, buf+12, 8); + + verboselog(machine(), 2, "psxcd: subheader file=%02x chan=%02x submode=%02x coding=%02x [%02x%02x%02x%02x]\n", + sub->file, sub->channel, sub->submode, sub->coding, buf[0xc], buf[0xd], buf[0xe], buf[0xf]); + + if ((mode & mode_adpcm) && (sub->submode & submode_audio)) + { + if ((sub->submode & submode_eof) && (mode & mode_autopause)) + { + isend=true; + //printf("end of file\n"); + } + if((!(mode & mode_channel) || + ((sub->file == filter_file) && (sub->channel == filter_channel))) && !m_mute) + m_spu->play_xa(0,buf+16); + } + else + { + if(!m_int1) + m_cursec = sectail; + + m_int1 = prepare_result(intr_dataready); + cmd_complete(m_int1); + sectail++; + sectail %= sector_buffer_size; + } + + curpos.b[F]++; + if (curpos.b[F]==75) + { + curpos.b[F]=0; + curpos.b[S]++; + if (curpos.b[S]==60) + { + curpos.b[S]=0; + curpos.b[M]++; + } + } + + loc.w=curpos.w; + } + else + isend = true; + + if (! isend) + { + unsigned int cyc=read_sector_cycles; + if (mode&mode_double_speed) cyc>>=1; + + next_sector_t+=cyc; + + next_read_event = add_system_event(event_read_sector, cyc, NULL); + } else + { + verboselog(machine(), 1, "psxcd: autopause xa\n"); + + cmd_complete(prepare_result(intr_dataend)); + stop_read(); + } + } +} + +void psxcd_device::play_sector() +{ + next_read_event=-1; + + if (status&status_playing) + { + UINT32 sector = msf_to_lba_ps(curpos.w); + + if(cdrom_read_data(m_cdrom_handle, sector, secbuf[sectail], CD_TRACK_AUDIO)) + { + if(!m_mute) + m_spu->play_cdda(0, secbuf[sectail]); + } + else + { + if(!cdrom_read_data(m_cdrom_handle, sector, secbuf[sectail], CD_TRACK_RAW_DONTCARE)) + { + stop_read(); // assume we've reached the end + cmd_complete(prepare_result(intr_dataend)); + return; + } + } + + curpos.b[F]++; + if (curpos.b[F]==75) + { + curpos.b[F]=0; + curpos.b[S]++; + if (curpos.b[S]==60) + { + curpos.b[S]=0; + curpos.b[M]++; + } + } + + loc.w=curpos.w; + sector++; + sectail++; + sectail %= sector_buffer_size; + + if (mode&mode_autopause) + { + if (sector>=autopause_sector) + { + verboselog(machine(), 1, "psxcd: autopause cdda\n"); + + stop_read(); + cmd_complete(prepare_result(intr_dataend)); + return; + } + } + + if ((mode&mode_report) && !(sector & 15)) // slow the int rate + { + command_result *res=global_alloc(command_result); + UINT8 track = cdrom_get_track(m_cdrom_handle, sector) + 1; + res->res=intr_dataready; + + res->data[0]=status; + res->data[1]=decimal_to_bcd(track); + res->data[2]=1; + if(sector & 0x10) + { + CDPOS tloc, start; + start.w = (track == 1) ? 0x000200 : lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, track - 1)); + tloc.w = sub_loc(loc, start); + res->data[3]=decimal_to_bcd(tloc.b[M]); + res->data[4]=decimal_to_bcd(tloc.b[S]) | 0x80; + res->data[5]=decimal_to_bcd(tloc.b[F]); + } + else + { + res->data[3]=decimal_to_bcd(loc.b[M]); + res->data[4]=decimal_to_bcd(loc.b[S]); + res->data[5]=decimal_to_bcd(loc.b[F]); + } + + res->sz=8; + + cmd_complete(res); + } + + unsigned int cyc=read_sector_cycles; + + next_sector_t+=cyc>>1; + + next_read_event = add_system_event(event_play_sector, next_sector_t - m_maincpu->total_cycles(), NULL); + } +} + +void psxcd_device::start_read() +{ + UINT32 sector = msf_to_lba_ps(curpos.w); + + assert((status&(status_reading|status_playing))==0); + + if(!(mode & mode_cdda) && (cdrom_get_track_type(m_cdrom_handle, cdrom_get_track(m_cdrom_handle, sector + 150)) == CD_TRACK_AUDIO)) + { + stop_read(); + cmd_complete(prepare_result(intr_diskerror, NULL, 0, 0x40)); + return; + } + send_result(intr_complete); + status |= status_reading; + + m_cursec=sectail=0; + + unsigned int cyc=read_sector_cycles; + if (mode&mode_double_speed) cyc>>=1; + + INT64 systime=m_maincpu->total_cycles(); + + systime+=start_read_delay; + + next_sector_t=systime+cyc; + next_read_event = add_system_event(event_read_sector, start_read_delay+preread_delay, NULL); +} + +void psxcd_device::start_play() +{ + UINT8 track = cdrom_get_track(m_cdrom_handle, msf_to_lba_ps(curpos.w) + 150); + + if(cdrom_get_track_type(m_cdrom_handle, track) != CD_TRACK_AUDIO) + verboselog(machine(), 0, "psxcd: playing data track\n"); + + status|=status_playing; + + m_cursec=sectail=0; + + if (mode&mode_autopause) + { + autopause_sector = cdrom_get_track_start(m_cdrom_handle, track) + cdrom_get_toc(m_cdrom_handle)->tracks[track].frames; +// printf("pos=%d auto=%d\n",pos,autopause_sector); + } + + unsigned int cyc=read_sector_cycles; + + next_sector_t=m_maincpu->total_cycles()+cyc; + + next_sector_t+=cyc>>1; + + next_read_event = add_system_event(event_play_sector, next_sector_t - m_maincpu->total_cycles(), NULL); +} + +void psxcd_device::stop_read() +{ + if (status & (status_reading|status_playing)) + verboselog(machine(), 1, "psxcd: stop read\n"); + + status&=~(status_reading|status_playing); + + if (next_read_event != -1) + { + m_timers[next_read_event]->adjust(attotime::never, 0, attotime::never); + m_timerinuse[next_read_event] = false; + next_read_event = -1; + } + + UINT32 sector=msf_to_lba_ps(curpos.w); + m_spu->flush_xa(sector); + m_spu->flush_cdda(sector); +} + +void psxcd_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +{ + if (!m_timerinuse[tid]) + { + verboselog(machine(), 0, "psxcd: timer fired for free event\n"); + return; + } + + m_timerinuse[tid] = false; + switch (param) + { + case event_cmd_complete: + { + verboselog(machine(), 1, "psxcd: event cmd complete\n"); + + cmd_complete((command_result *)ptr); + break; + } + + case event_read_sector: + read_sector(); + break; + + case event_play_sector: + play_sector(); + break; + + case event_change_disk: + open = false; + status |= status_standby; + break; + } +} + +int psxcd_device::add_system_event(int type, UINT64 t, command_result *ptr) +{ + // t is in maincpu clock cycles + UINT32 hz = m_sysclock / t; + for(int i = 0; i < MAX_PSXCD_TIMERS; i++) + { + if(!m_timerinuse[i]) + { + m_timers[i]->adjust(attotime::from_hz(hz), type, attotime::never); + m_timers[i]->set_ptr(ptr); + m_timerinuse[i] = true; + return i; + } + } + fatalerror("psxcd: out of timers\n"); +} diff --git a/src/mame/machine/psxcd.h b/src/mame/machine/psxcd.h new file mode 100644 index 00000000000..3239ea8ef2c --- /dev/null +++ b/src/mame/machine/psxcd.h @@ -0,0 +1,161 @@ +// license:BSD-3-Clause +// copyright-holders:smf,R. Belmont,pSXAuthor,Carl +#ifndef _included_psxcdrom_ +#define _included_psxcdrom_ + +#include "imagedev/chd_cd.h" +#include "sound/spu.h" + +#define MAX_PSXCD_TIMERS (4) + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_PSXCD_ADD(_tag, _devname) \ + MCFG_DEVICE_ADD(_tag, PSXCD, 0) + +#define MCFG_PSXCD_IRQ_HANDLER(_devcb) \ + devcb = &psxcd_device::set_irq_handler(*device, DEVCB_##_devcb); + +class psxcd_device : public cdrom_image_device +{ +public: + psxcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // static configuration helpers + template static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast(device).m_irq_handler.set_callback(object); } + static void static_set_devname(device_t &device, const char *devname); + virtual bool call_load(); + virtual void call_unload(); + + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( read ); + void start_dma(UINT8 *mainram, UINT32 size); + +protected: + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + void write_command(UINT8 byte); + + typedef void (psxcd_device::*cdcmd)(); + struct command_result + { + UINT8 data[32], sz, res; + command_result *next; + }; + union CDPOS { + UINT8 b[4]; + UINT32 w; + }; + + void cdcmd_sync(); + void cdcmd_nop(); + void cdcmd_setloc(); + void cdcmd_play(); + void cdcmd_forward(); + void cdcmd_backward(); + void cdcmd_readn(); + void cdcmd_standby(); + void cdcmd_stop(); + void cdcmd_pause(); + void cdcmd_init(); + void cdcmd_mute(); + void cdcmd_demute(); + void cdcmd_setfilter(); + void cdcmd_setmode(); + void cdcmd_getparam(); + void cdcmd_getlocl(); + void cdcmd_getlocp(); + void cdcmd_gettn(); + void cdcmd_gettd(); + void cdcmd_seekl(); + void cdcmd_seekp(); + void cdcmd_test(); + void cdcmd_id(); + void cdcmd_reads(); + void cdcmd_reset(); + void cdcmd_readtoc(); + void cdcmd_unknown12(); + void cdcmd_illegal17(); + void cdcmd_illegal18(); + void cdcmd_illegal1d(); + + static const cdcmd cmd_table[31]; + void illegalcmd(UINT8 cmd); + + void cmd_complete(command_result *res); + void send_result(UINT8 res, UINT8 *data=NULL, int sz=0, int delay=default_irq_delay, UINT8 errcode = 0); + command_result *prepare_result(UINT8 res, UINT8 *data=NULL, int sz=0, UINT8 errcode = 0); + + void start_read(); + void start_play(); + void stop_read(); + void read_sector(); + void play_sector(); + UINT32 sub_loc(CDPOS src1, CDPOS src2); + int add_system_event(int type, UINT64 t, command_result *ptr); + + UINT8 bcd_to_decimal(const UINT8 bcd) { return ((bcd>>4)*10)+(bcd&0xf); } + UINT8 decimal_to_bcd(const UINT8 dec) { return ((dec/10)<<4)|(dec%10); } + UINT32 msf_to_lba_ps(UINT32 msf) { msf = msf_to_lba(msf); return (msf>150)?(msf-150):msf; } + UINT32 lba_to_msf_ps(UINT32 lba) { return lba_to_msf_alt(lba+150); } + + static const unsigned int sector_buffer_size=16, default_irq_delay=16000; //480; //8000; //2000<<2; + static const unsigned int raw_sector_size=2352; + + UINT8 cmdbuf[64], mode, secbuf[sector_buffer_size][raw_sector_size]; + UINT8 filter_file, filter_channel, lastsechdr[8], status; + int rdp; + UINT8 m_cursec, sectail; + UINT16 m_transcurr; + UINT8 m_transbuf[raw_sector_size]; + command_result *res_queue, *m_int1; + + struct { + UINT8 sr, ir, imr; + struct { + UINT8 ll, lr, rl, rr; + } vol; + } m_regs; + + CDPOS loc, curpos; + +#ifdef LSB_FIRST + enum { + M = 2, + S = 1, + F = 0 + }; +#else + enum { + M = 1, + S = 2, + F = 3 + }; +#endif + + bool open, m_mute, m_dmaload; + device_timer_id next_read_event; + INT64 next_sector_t; + unsigned int autopause_sector, start_read_delay, read_sector_cycles, preread_delay; + + UINT32 m_param_count; + UINT32 m_sysclock; + emu_timer *m_timers[MAX_PSXCD_TIMERS]; + bool m_timerinuse[MAX_PSXCD_TIMERS]; + + + devcb_write_line m_irq_handler; + cpu_device *m_maincpu; + spu_device *m_spu; +}; + +// device type definition +extern const device_type PSXCD; + +#endif diff --git a/src/mame/machine/qimi.c b/src/mame/machine/qimi.c new file mode 100644 index 00000000000..e1a55134b69 --- /dev/null +++ b/src/mame/machine/qimi.c @@ -0,0 +1,181 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Phill Harvey-Smith +/********************************************************************** + + QJump/Quanta QL Internal Mouse Interface emulation + +**********************************************************************/ + +#include "qimi.h" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type QIMI = &device_creator; + + +//------------------------------------------------- +// INPUT_CHANGED_MEMBER( mouse_x_changed ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( qimi_t::mouse_x_changed ) +{ + if (newval > oldval) + { + m_status |= ST_X_DIR; + } + else + { + m_status &= ~ST_X_DIR; + } + + m_status |= ST_X_INT; + + if (m_extint_en) + { + m_write_extint(ASSERT_LINE); + } +} + + +//------------------------------------------------- +// INPUT_CHANGED_MEMBER( mouse_y_changed ) +//------------------------------------------------- + +INPUT_CHANGED_MEMBER( qimi_t::mouse_y_changed ) +{ + if (newval < oldval) + { + m_status |= ST_Y_DIR; + } + else + { + m_status &= ~ST_Y_DIR; + } + + m_status |= ST_Y_INT; + + if (m_extint_en) + { + m_write_extint(ASSERT_LINE); + } +} + + +//------------------------------------------------- +// INPUT_PORTS( qimi ) +//------------------------------------------------- + +INPUT_PORTS_START( qimi ) + PORT_START("mouse_x") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_CHANGED_MEMBER(DEVICE_SELF, qimi_t, mouse_x_changed, 0) + + PORT_START("mouse_y") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_CHANGED_MEMBER(DEVICE_SELF, qimi_t, mouse_y_changed, 0) + + PORT_START("mouse_buttons") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Right Mouse Button") PORT_CODE(MOUSECODE_BUTTON2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Left Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) + PORT_BIT( 0xcf, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor qimi_t::device_input_ports() const +{ + return INPUT_PORTS_NAME( qimi ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// qimi_t - constructor +//------------------------------------------------- + +qimi_t::qimi_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, QIMI, "QL Internal Mouse Interface", tag, owner, clock, "qimi", __FILE__), + m_write_extint(*this), + m_buttons(*this, "mouse_buttons"), + m_status(0), + m_extint_en(false) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void qimi_t::device_start() +{ + // resolve callbacks + m_write_extint.resolve_safe(); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void qimi_t::device_reset() +{ + m_status = 0; + m_extint_en = false; +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +UINT8 qimi_t::read(address_space &space, offs_t offset, UINT8 data) +{ + switch (offset) + { + // button status + case 0x1bf9c: + data = m_buttons->read(); + break; + + // direction status + case 0x1bfbc: + data = m_status; + break; + + case 0x1bfbe: + m_status &= ~(ST_Y_INT | ST_X_INT); + m_extint_en = true; + + m_write_extint(CLEAR_LINE); + break; + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( qimi_t::write ) +{ + // write to 0x1bfbe resets int status + if (offset == 0x1bfbe) + { + m_status &= ~(ST_Y_INT | ST_X_INT); + m_extint_en = true; + + m_write_extint(CLEAR_LINE); + } +} diff --git a/src/mame/machine/qimi.h b/src/mame/machine/qimi.h new file mode 100644 index 00000000000..bf513da9042 --- /dev/null +++ b/src/mame/machine/qimi.h @@ -0,0 +1,78 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Phill Harvey-Smith +/********************************************************************** + + QJump/Quanta QL Internal Mouse Interface emulation + +**********************************************************************/ + +#pragma once + +#ifndef __QIMI__ +#define __QIMI__ + +#include "emu.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_QIMI_EXTINT_CALLBACK(_write) \ + devcb = &qimi_t::set_exting_wr_callback(*device, DEVCB_##_write); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> qimi_t + +class qimi_t : public device_t +{ +public: + // construction/destruction + qimi_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_exting_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_extint.set_callback(object); } + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + + UINT8 read(address_space &space, offs_t offset, UINT8 data); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_INPUT_CHANGED_MEMBER( mouse_x_changed ); + DECLARE_INPUT_CHANGED_MEMBER( mouse_y_changed ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + enum + { + ST_Y_DIR = 0x01, + ST_X_INT = 0x04, + ST_X_DIR = 0x10, + ST_Y_INT = 0x20 + }; + + devcb_write_line m_write_extint; + + required_ioport m_buttons; + + UINT8 m_status; + bool m_extint_en; +}; + + +// device type definition +extern const device_type QIMI; + + + +#endif diff --git a/src/mame/machine/qx10kbd.c b/src/mame/machine/qx10kbd.c new file mode 100644 index 00000000000..1a4c7364c06 --- /dev/null +++ b/src/mame/machine/qx10kbd.c @@ -0,0 +1,301 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +// TODO: dump 8049 mcu; key repeat + +#include "machine/qx10kbd.h" + +qx10_keyboard_device::qx10_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : + serial_keyboard_device(mconfig, QX10_KEYBOARD, "QX10 Keyboard", tag, owner, 0, "qx10_keyboard", __FILE__), + m_io_kbd8(*this, "TERM_LINE8"), + m_io_kbd9(*this, "TERM_LINE9"), + m_io_kbda(*this, "TERM_LINEA"), + m_io_kbdb(*this, "TERM_LINEB"), + m_io_kbdd(*this, "TERM_LINED"), + m_io_kbde(*this, "TERM_LINEE"), + m_io_kbdf(*this, "TERM_LINEF") +{ +} + +void qx10_keyboard_device::write(UINT8 data) +{ + switch(data & 0xe0) + { + default: + break; + case 0x00: // set repeat start + break; + case 0x20: // set repeat interval + break; + case 0x40: // set LED + break; + case 0x60: // get LED + send_key(0); + break; + case 0x80: // get SW + break; + case 0xa0: // set repeat + break; + case 0xc0: // enable keyboard + break; + case 0xe0: + if(!(data & 1)) + send_key(0); + break; + } + return; +} + +UINT8 qx10_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) +{ + int i = *scan_line, j; + UINT8 code = 0; + + if (i == 0) code = m_io_kbd0->read(); + else + if (i == 1) code = m_io_kbd1->read(); + else + if (i == 2) code = m_io_kbd2->read(); + else + if (i == 3) code = m_io_kbd3->read(); + else + if (i == 4) code = m_io_kbd4->read(); + else + if (i == 5) code = m_io_kbd5->read(); + else + if (i == 6) code = m_io_kbd6->read(); + else + if (i == 7) code = m_io_kbd7->read(); + else + if (i == 8) code = m_io_kbd8->read(); + else + if (i == 9) code = m_io_kbd9->read(); + else + if (i == 10) code = m_io_kbda->read(); + else + if (i == 11) code = m_io_kbdb->read(); + else + if (i == 12) code = m_io_kbdc->read(); + else + if (i == 13) code = m_io_kbdd->read(); + else + if (i == 14) code = m_io_kbde->read(); + else + if (i == 15) code = m_io_kbdf->read(); + + *scan_line = (*scan_line + 1) % 16; + + if(m_state[i] == code) + return 0; + + m_state[i] = code; + + if(!code) + return 0; + + for(j = 0; j < 8; j++) + if((code >> j) == 1) break; + + return (j << 4) + i; +} + +static INPUT_PORTS_START( qx10_keyboard ) + PORT_START("TERM_LINE0") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RSHIFT") + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RCTRL") PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH SHIFT") + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LCTRL") PORT_CODE(KEYCODE_LCONTROL) + + PORT_START("TERM_LINE1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4/UNDO") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS LOCK/(H6)") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB REL") + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3/COPY DISK") PORT_CODE(KEYCODE_F3) + + PORT_START("TERM_LINE2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5/(H1)") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2/HELP") PORT_CODE(KEYCODE_F2) + + PORT_START("TERM_LINE3") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6/STORE") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1/STOP") PORT_CODE(KEYCODE_F1) + + PORT_START("TERM_LINE4") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F7/RETRIEVE") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MAR SEL") + + PORT_START("TERM_LINE5") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F8/PRINT") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER (PAD)") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC/^") PORT_CODE(KEYCODE_ESC) + + PORT_START("TERM_LINE6") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F9/INDEX") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + + PORT_START("TERM_LINE7") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F10/MAIL") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + + PORT_START("TERM_LINE8") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(H2)") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= (PAD)") + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB SET") + + PORT_START("TERM_LINE9") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK/MENU") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) + + PORT_START("TERM_LINEA") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PAUSE/CALC") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) + + PORT_START("TERM_LINEB") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SCRN DUMP/SCHED") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@/1/2 1/4") + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("=") + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) + + PORT_START("TERM_LINEC") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HELP/DRAW") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(H5)") + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/]") + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) + + PORT_START("TERM_LINEE") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BOLD") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF3/STYLE") + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INSERT") PORT_CODE(KEYCODE_INSERT) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-7") + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) + + PORT_START("TERM_LINEF") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF1/ITALIC") + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF2/SIZE") + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("`/DEC TAB") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("? /") + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL/WORD") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS/LINE") + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) + + PORT_START("RS232_TXBAUD") + PORT_CONFNAME(0xff, RS232_BAUD_1200, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_BAUD_1200, "1200") + + PORT_START("RS232_STARTBITS") + PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STARTBITS_1, "1") + + PORT_START("RS232_DATABITS") + PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_DATABITS_8, "8") + + PORT_START("RS232_PARITY") + PORT_CONFNAME(0xff, RS232_PARITY_EVEN, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_PARITY_EVEN, "Even") + + PORT_START("RS232_STOPBITS") + PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STOPBITS_1, "1") +INPUT_PORTS_END + +ioport_constructor qx10_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(qx10_keyboard); +} + +void qx10_keyboard_device::device_start() +{ + serial_keyboard_device::device_start(); + memset(m_state, '\0', sizeof(m_state)); + set_rcv_rate(1200); +} + +void qx10_keyboard_device::rcv_complete() +{ + receive_register_extract(); + write(get_received_char()); +} + +const device_type QX10_KEYBOARD = &device_creator; diff --git a/src/mame/machine/qx10kbd.h b/src/mame/machine/qx10kbd.h new file mode 100644 index 00000000000..46bf99083c0 --- /dev/null +++ b/src/mame/machine/qx10kbd.h @@ -0,0 +1,35 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#ifndef QX10KBD_H_ +#define QX10KBD_H_ + +#include "bus/rs232/keyboard.h" + +class qx10_keyboard_device : public serial_keyboard_device +{ +public: + qx10_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ioport_constructor device_input_ports() const; + +protected: + virtual void device_start(); + virtual void rcv_complete(); + +private: + virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); + void write(UINT8 data); + + required_ioport m_io_kbd8; + required_ioport m_io_kbd9; + required_ioport m_io_kbda; + required_ioport m_io_kbdb; + required_ioport m_io_kbdd; + required_ioport m_io_kbde; + required_ioport m_io_kbdf; + + UINT8 m_state[16]; +}; + +extern const device_type QX10_KEYBOARD; + +#endif /* QX10KBD_H_ */ diff --git a/src/mame/machine/radio86.c b/src/mame/machine/radio86.c new file mode 100644 index 00000000000..0f1f9360aa0 --- /dev/null +++ b/src/mame/machine/radio86.c @@ -0,0 +1,234 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Radio-86RK machine driver by Miodrag Milanovic + + 06/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "machine/i8255.h" +#include "includes/radio86.h" + + + +void radio86_state::radio86_init_keyboard() +{ + m_keyboard_mask = 0; + m_tape_value = 0x10; +} + +/* Driver initialization */ +DRIVER_INIT_MEMBER(radio86_state,radio86) +{ + /* set initialy ROM to be visible on first bank */ + UINT8 *RAM = m_region_maincpu->base(); + memset(RAM,0x0000,0x1000); // make frist page empty by default + m_bank1->configure_entries(1, 2, RAM, 0x0000); + m_bank1->configure_entries(0, 2, RAM, 0xf800); + radio86_init_keyboard(); +} + +DRIVER_INIT_MEMBER(radio86_state,radioram) +{ + DRIVER_INIT_CALL(radio86); + m_radio_ram_disk = auto_alloc_array(machine(), UINT8, 0x20000); + memset(m_radio_ram_disk,0,0x20000); +} +READ8_MEMBER(radio86_state::radio86_8255_portb_r2) +{ + UINT8 key = 0xff; + if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_line0->read(); } + if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_line1->read(); } + if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_line2->read(); } + if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_line3->read(); } + if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_line4->read(); } + if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_line5->read(); } + if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_line6->read(); } + if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_line7->read(); } + return key; +} + +READ8_MEMBER(radio86_state::radio86_8255_portc_r2) +{ + double level = m_cassette->input(); + UINT8 dat = m_io_line8->read(); + if (level < 0) { + dat ^= m_tape_value; + } + return dat; +} + +WRITE8_MEMBER(radio86_state::radio86_8255_porta_w2) +{ + m_keyboard_mask = data ^ 0xff; +} + +WRITE8_MEMBER(radio86_state::radio86_8255_portc_w2) +{ + m_cassette->output(data & 0x01 ? 1 : -1); +} + + +READ8_MEMBER(radio86_state::rk7007_8255_portc_r) +{ + double level = m_cassette->input(); + UINT8 key = 0xff; + if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_cline0->read(); } + if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_cline1->read(); } + if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_cline2->read(); } + if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_cline3->read(); } + if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_cline4->read(); } + if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_cline5->read(); } + if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_cline6->read(); } + if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_cline7->read(); } + key &= 0xe0; + if (level < 0) { + key ^= m_tape_value; + } + return key; +} + +WRITE_LINE_MEMBER(radio86_state::hrq_w) +{ + /* HACK - this should be connected to the BUSREQ line of Z80 */ + m_maincpu->set_input_line(INPUT_LINE_HALT, state); + + /* HACK - this should be connected to the BUSACK line of Z80 */ + m_dma8257->hlda_w(state); +} + +READ8_MEMBER(radio86_state::memory_read_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER(radio86_state::memory_write_byte) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.write_byte(offset, data); +} + +void radio86_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_RESET: + m_bank1->set_entry(0); + break; + default: + assert_always(FALSE, "Unknown id in radio86_state::device_timer"); + } +} + + +READ8_MEMBER(radio86_state::radio_cpu_state_r) +{ + return space.device().state().state_int(I8085_STATUS); +} + +READ8_MEMBER(radio86_state::radio_io_r) +{ + return m_maincpu->space(AS_PROGRAM).read_byte((offset << 8) + offset); +} + +WRITE8_MEMBER(radio86_state::radio_io_w) +{ + m_maincpu->space(AS_PROGRAM).write_byte((offset << 8) + offset,data); +} + +MACHINE_RESET_MEMBER(radio86_state,radio86) +{ + timer_set(attotime::from_usec(10), TIMER_RESET); + m_bank1->set_entry(1); + + m_keyboard_mask = 0; + m_disk_sel = 0; +} + + +WRITE8_MEMBER(radio86_state::radio86_pagesel) +{ + m_disk_sel = data; +} + +READ8_MEMBER(radio86_state::radio86rom_romdisk_porta_r) +{ + UINT16 addr = (m_romdisk_msb << 8) | m_romdisk_lsb; + if (m_cart->exists() && addr < m_cart->get_rom_size()) + return m_cart->read_rom(space, addr); + else + return 0xff; +} + +READ8_MEMBER(radio86_state::radio86ram_romdisk_porta_r) +{ + UINT8 *romdisk = m_region_maincpu->base() + 0x10000; + if ((m_disk_sel & 0x0f) ==0) { + return romdisk[m_romdisk_msb*256+m_romdisk_lsb]; + } else { + if (m_disk_sel==0xdf) { + return m_radio_ram_disk[m_romdisk_msb*256+m_romdisk_lsb + 0x10000]; + } else { + return m_radio_ram_disk[m_romdisk_msb*256+m_romdisk_lsb]; + } + } +} + +WRITE8_MEMBER(radio86_state::radio86_romdisk_portb_w) +{ + m_romdisk_lsb = data; +} + +WRITE8_MEMBER(radio86_state::radio86_romdisk_portc_w) +{ + m_romdisk_msb = data; +} + +WRITE8_MEMBER(radio86_state::mikrosha_8255_font_page_w) +{ + m_mikrosha_font_page = (data > 7) & 1; +} + +I8275_DRAW_CHARACTER_MEMBER(radio86_state::display_pixels) +{ + int i; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + const UINT8 *charmap = m_charmap; + UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; + if(linecount == 8) + pixels = 0; + if (vsp) { + pixels = 0; + } + if (lten) { + pixels = 0xff; + } + if (rvv) { + pixels ^= 0xff; + } + for(i=0;i<6;i++) { + bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + } +} + +static const rgb_t radio86_palette[3] = { + rgb_t(0x00, 0x00, 0x00), // black + rgb_t(0xa0, 0xa0, 0xa0), // white + rgb_t(0xff, 0xff, 0xff) // highlight +}; + +PALETTE_INIT_MEMBER(radio86_state,radio86) +{ + palette.set_pen_colors(0, radio86_palette, ARRAY_LENGTH(radio86_palette)); +} + +void radio86_state::video_start() +{ + m_charmap = memregion("gfx1")->base(); +} diff --git a/src/mame/machine/rm380z.c b/src/mame/machine/rm380z.c new file mode 100644 index 00000000000..082dbf6ff75 --- /dev/null +++ b/src/mame/machine/rm380z.c @@ -0,0 +1,278 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol,Gabriele D'Antona + +/* + +RM 380Z machine + +*/ + + +#include "includes/rm380z.h" + + +/* + +PORT0 write in COS 4.0B/M: + +bit0: 1=reset keyboard latch (?) +bit1: ? +bit2: ? +bit3: ? +bit4: ? +bit5: 40/80 cols switch (?) +bit6: 0=write to char RAM/1=write to attribute RAM +bit7: 1=map ROM at 0000-0fff/0=RAM + +*/ + +WRITE8_MEMBER( rm380z_state::port_write ) +{ + switch ( offset ) + { + case 0xFC: // PORT0 + //printf("FBFCw[%2.2x] FBFD [%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",data,m_fbfd,m_fbfe,m_maincpu->safe_pc(),writenum); + m_port0 = data; + if (data&0x01) + { + //printf("WARNING: bit0 of port0 reset\n"); + m_port0_kbd=0; + } + m_port1&=~0x01; //? + + config_videomode(); + config_memory_map(); + break; + + case 0xFD: // screen line counter (?) + //printf("FBFC [%2.2x] FBFDw[%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,data,m_fbfe,m_maincpu->safe_pc(),writenum); + + m_old_old_fbfd=m_old_fbfd; + m_old_fbfd=m_fbfd; + m_fbfd=data; + + writenum++; + + check_scroll_register(); + + break; + + case 0xFE: // line on screen to write to divided by 2 + //printf("FBFC [%2.2x] FBFD [%2.2x] FBFEw[%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,m_fbfd,data,m_maincpu->safe_pc(),writenum); + m_fbfe=data; + break; + + case 0xFF: // user I/O port + //printf("write of [%x] to FBFF\n",data); + //logerror("%s: Write %02X to user I/O port\n", machine().describe_context(), data ); + break; + + default: + printf("unknown port [%2.2x] write of [%2.2x]\n",offset,data); + } +} + +READ8_MEMBER( rm380z_state::port_read ) +{ + UINT8 data = 0xFF; + + switch ( offset ) + { + case 0xFC: // PORT0 + //m_port0_kbd=getKeyboard(); + data = m_port0_kbd; + //if (m_port0_kbd!=0) m_port0_kbd=0; + //m_port0_kbd=0; + //printf("read of port0 (kbd) from PC [%x]\n",m_maincpu->safe_pc()); + break; + + case 0xFD: // "counter" (?) + //printf("%s: Read from counter FBFD\n", machine().describe_context()); + data = 0x00; + break; + + case 0xFE: // PORT1 + data = m_port1; + //printf("read of port1 from PC [%x]\n",m_maincpu->safe_pc()); + break; + + case 0xFF: // user port + //printf("%s: Read from user port\n", machine().describe_context()); + break; + + default: + printf("read from unknown port [%2.2x]\n",offset); + } + + return data; +} + +WRITE8_MEMBER( rm380z_state::port_write_1b00 ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + port_write(program,offset+0xfc,data); +} + +READ8_MEMBER( rm380z_state::port_read_1b00 ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + return port_read(program,offset+0xfc); +} + +READ8_MEMBER( rm380z_state::hiram_read ) +{ + return hiram[offset]; +} + +WRITE8_MEMBER( rm380z_state::hiram_write ) +{ + hiram[offset]=data; +} + +READ8_MEMBER( rm380z_state::rm380z_portlow_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( rm380z_state::rm380z_portlow_w ) +{ + //printf("port write [%x] [%x] at PC [%x]\n",offset,data,m_maincpu->safe_pc()); +} + +READ8_MEMBER( rm380z_state::rm380z_porthi_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( rm380z_state::rm380z_porthi_w ) +{ + //printf("port write [%x] [%x]\n",offset+0xc5,data); +} + + +#define LINE_SUBDIVISION 82 +#define HORZ_LINES 100 +#define TIMER_SPEED 50*HORZ_LINES*LINE_SUBDIVISION + +// +// this simulates line+frame blanking +// according to the System manual, "frame blanking bit (bit 6) of port1 becomes high +// for about 4.5 milliseconds every 20 milliseconds" +// + +TIMER_CALLBACK_MEMBER(rm380z_state::static_vblank_timer) +{ + //printf("timer callback called at [%f]\n",machine().time().as_double()); + + + m_rasterlineCtr++; + m_rasterlineCtr%=(HORZ_LINES*LINE_SUBDIVISION); + + // frame blanking + if (m_rasterlineCtr>=((HORZ_LINES-22)*LINE_SUBDIVISION)) + { + m_port1|=0x40; + } + else + { + m_port1&=~0x40; + } + + // line blanking + if ((m_rasterlineCtr%LINE_SUBDIVISION)>80) + { + m_port1|=0x80; + } + else + { + m_port1&=~0x80; + } +} + +WRITE8_MEMBER( rm380z_state::keyboard_put ) +{ + if (data) + { + m_port0_kbd = data; + m_port1 |= 1; + } +} + +// +// ports c0-cf are related to the floppy disc controller +// c0-c3: wd1771 +// c4-c8: disk drive port0 +// +// CP/M booting: +// from the service manual: "the B command reads a sector from drive 0, track 0, sector 1 into memory +// at 0x0080 to 0x00FF, then jumps to it if there is no error." +// + +WRITE8_MEMBER( rm380z_state::disk_0_control ) +{ + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + // don't know how motor on is connected + floppy->mon_w(0); + floppy->ss_w(BIT(data, 5)); + } +} + +void rm380z_state::machine_start() +{ + machine().scheduler().timer_pulse(attotime::from_hz(TIMER_SPEED), timer_expired_delegate(FUNC(rm380z_state::static_vblank_timer),this)); +} + +void rm380z_state::machine_reset() +{ + m_port0=0x00; + m_port0_kbd=0x00; + m_port1=0x00; + m_fbfd=0x00; + m_fbfe=0x00; + m_old_fbfd=0x00; + m_old_old_fbfd=0x00; + writenum=0; + + m_videomode=RM380Z_VIDEOMODE_80COL; + m_old_videomode=m_videomode; + m_rasterlineCtr=0; + + // note: from COS 4.0 videos, screen seems to show garbage at the beginning + memset(m_mainVideoram,0,RM380Z_VIDEORAM_SIZE); + + memset(m_vramattribs,0,RM380Z_SCREENSIZE); + memset(m_vramchars,0,RM380Z_SCREENSIZE); + memset(m_vram,0,RM380Z_SCREENSIZE); + + config_memory_map(); + machine().device("wd1771")->reset(); + + init_graphic_chars(); +} + +void rm380z_state::config_memory_map() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT8 *rom = memregion(RM380Z_MAINCPU_TAG)->base(); + UINT8* m_ram_p = m_messram->pointer(); + + if ( RM380Z_PORTS_ENABLED_HIGH ) + { + program.install_ram( 0x0000, 0xDFFF, m_ram_p ); + } + else + { + program.install_rom( 0x0000, 0x0FFF, rom ); + program.install_readwrite_handler(0x1BFC, 0x1BFF,read8_delegate(FUNC(rm380z_state::port_read_1b00), this),write8_delegate(FUNC(rm380z_state::port_write_1b00), this) ); + program.install_rom( 0x1C00, 0x1DFF, rom + 0x1400 ); + program.install_ram( 0x4000, 0xDFFF, m_ram_p ); + } +} diff --git a/src/mame/machine/rmnimbus.c b/src/mame/machine/rmnimbus.c new file mode 100644 index 00000000000..b8b2d79218b --- /dev/null +++ b/src/mame/machine/rmnimbus.c @@ -0,0 +1,1718 @@ +// license:BSD-3-Clause +// copyright-holders:Phill Harvey-Smith, Carl +/* + machine/rmnimbus.c + + Machine driver for the Research Machines Nimbus. + + Phill Harvey-Smith + 2009-11-29. + +*/ + +/* + + SCSI/SASI drives supported by RM Nimbus machines + +Native SCSI - format with HDFORM.EXE + +Drive Capacity Tracks Heads Sec/Track Blocks +RO652-20 20MB 306 4 34 41616 +ST225N 20MB 615 4 17 41721 +ST125N 20MB 407 4 26 41921 +8425S-30 20MB 41004 +CP3020 20MB 623 2 33 41118 +ST225NP 20MB 615 4 17 41720 +CP3040 40MB 1026 2 40 82080 + +Via Xebec S1410 SASI to MFM bridge board - format with WINFORM.EXE +NP05-10S 8MB 160 6 17 16320 +NP04-20T 16MB 320 6 17 32640 +NP03-20 15MB 306 6 17 31212 +R352-10 10MB 306 4 17 20808 +NP04-50 40MB 699 7 17 83181 +NP04-55 44MB 754 7 17 89726 + +Via Adaptec ACB4070 SCSI to RLL bridge board - format with ADAPT.EXE +NEC D5147 60MB 615 8 26 127920 +ST227R 60MB 820 6 26 127920 + +After formating, the drives need to have a partition table put on them with +STAMP.EXE and then formatted in the normal way for a dos system drive with +Format /s. + +The tracks, heads and sectors/track can be used with chdman createhd +to create a blank hard disk which can then be formatted with the RM tools. +The important thing when doing this is to make sure that if using the Native +SCSI tools, that the disk has the same number of blocks as specified above, +even if you have to use unusual geometry to do so ! +Currently, only the ST225N and ST125N can be formatted as the other native +drives and Xebec board expect the WRITE BUFFER (0x3B) and READ BUFFER (0x3C) +with mode 0 commands to be implemented and the Adaptec board uses unknown +command 0xE4. + + +for example: + +chdman createhd -o ST125N.chd -chs 41921,1,1 -ss 512 +(the actual geometry can't be used because the block count won't match) + +*/ + +#include "debugger.h" +#include "debug/debugcon.h" +#include "imagedev/flopdrv.h" +#include "includes/rmnimbus.h" + + + +/*-------------------------------------------------------------------------*/ +/* Defines, constants, and global variables */ +/*-------------------------------------------------------------------------*/ + +/* External int vectors for chained interrupts */ +#define EXTERNAL_INT_DISK 0x80 +#define EXTERNAL_INT_MSM5205 0x84 +#define EXTERNAL_INT_MOUSE_YU 0x88 +#define EXTERNAL_INT_MOUSE_YD 0x89 +#define EXTERNAL_INT_MOUSE_XL 0x8A +#define EXTERNAL_INT_MOUSE_XR 0x8B +#define EXTERNAL_INT_PC8031_8C 0x8c +#define EXTERNAL_INT_PC8031_8E 0x8E +#define EXTERNAL_INT_PC8031_8F 0x8F + +#define HDC_DRQ_MASK 0x40 +#define FDC_SIDE() ((m_nimbus_drives.reg400 & 0x10) >> 4) +#define FDC_MOTOR() ((m_nimbus_drives.reg400 & 0x20) >> 5) +#define FDC_DRIVE() (fdc_driveno(m_nimbus_drives.reg400 & 0x0f)) +#define HDC_DRQ_ENABLED() ((m_nimbus_drives.reg400 & 0x40) ? 1 : 0) +#define FDC_DRQ_ENABLED() ((m_nimbus_drives.reg400 & 0x80) ? 1 : 0) + +/* 8031/8051 Peripheral controller */ + +#define IPC_OUT_ADDR 0X01 +#define IPC_OUT_READ_PEND 0X02 +#define IPC_OUT_BYTE_AVAIL 0X04 + +#define IPC_IN_ADDR 0X01 +#define IPC_IN_BYTE_AVAIL 0X02 +#define IPC_IN_READ_PEND 0X04 + +/* IO unit */ + +#define DISK_INT_ENABLE 0x01 +#define MSM5205_INT_ENABLE 0x04 +#define MOUSE_INT_ENABLE 0x08 +#define PC8031_INT_ENABLE 0x10 + +enum +{ + MOUSE_PHASE_STATIC = 0, + MOUSE_PHASE_POSITIVE, + MOUSE_PHASE_NEGATIVE +}; + +#define MOUSE_INT_ENABLED(state) (((state)->m_iou_reg092 & MOUSE_INT_ENABLE) ? 1 : 0) + +#define LINEAR_ADDR(seg,ofs) ((seg<<4)+ofs) + +#define OUTPUT_SEGOFS(mess,seg,ofs) logerror("%s=%04X:%04X [%08X]\n",mess,seg,ofs,((seg<<4)+ofs)) + +#define LOG_SIO 0 +#define LOG_DISK_HDD 0 +#define LOG_DISK 0 +#define LOG_PC8031 0 +#define LOG_PC8031_186 0 +#define LOG_PC8031_PORT 0 +#define LOG_IOU 0 +#define LOG_RAM 0 + +/* Debugging */ + +#define DEBUG_SET(flags) ((m_debug_machine & (flags))==(flags)) +#define DEBUG_SET_STATE(flags) ((state->m_debug_machine & (flags))==(flags)) + +#define DEBUG_NONE 0x0000000 +#define DECODE_BIOS 0x0000002 +#define DECODE_BIOS_RAW 0x0000004 +#define DECODE_DOS21 0x0000008 + +/* Nimbus sub-bios structures for debugging */ + +struct t_area_params +{ + UINT16 ofs_brush; + UINT16 seg_brush; + UINT16 ofs_data; + UINT16 seg_data; + UINT16 count; +}; + +struct t_plot_string_params +{ + UINT16 ofs_font; + UINT16 seg_font; + UINT16 ofs_data; + UINT16 seg_data; + UINT16 x; + UINT16 y; + UINT16 length; +}; + +struct t_nimbus_brush +{ + UINT16 style; + UINT16 style_index; + UINT16 colour1; + UINT16 colour2; + UINT16 transparency; + UINT16 boundary_spec; + UINT16 boundary_colour; + UINT16 save_colour; +}; + + +static void nimbus_debug(running_machine &machine, int ref, int params, const char *param[]); + +static int instruction_hook(device_t &device, offs_t curpc); +static void decode_subbios(device_t *device,offs_t pc, UINT8 raw_flag); +static void decode_dos21(device_t *device,offs_t pc); +static void decode_dssi_generic(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); +static void decode_dssi_f_fill_area(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); +static void decode_dssi_f_plot_character_string(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); +static void decode_dssi_f_set_new_clt(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); +static void decode_dssi_f_plonk_char(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); +static void decode_dssi_f_rw_sectors(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); + +void rmnimbus_state::external_int(UINT8 vector, bool state) +{ + if(!state && (vector != m_vector)) + return; + + m_vector = vector; + + m_maincpu->int0_w(state); +} + +READ8_MEMBER(rmnimbus_state::cascade_callback) +{ + m_maincpu->int0_w(0); + return m_vector; +} + +void rmnimbus_state::machine_reset() +{ + /* CPU */ + iou_reset(); + fdc_reset(); + hdc_reset(); + pc8031_reset(); + rmni_sound_reset(); + memory_reset(); + mouse_js_reset(); + + /* USER VIA 6522 port B is connected to the BBC user port */ + m_via->write_pb0(1); + m_via->write_pb1(1); + m_via->write_pb2(1); + m_via->write_pb3(1); + m_via->write_pb4(1); + m_via->write_pb5(1); + m_via->write_pb6(1); + m_via->write_pb7(1); +} + +void rmnimbus_state::machine_start() +{ + m_nimbus_mouse.m_mouse_timer=timer_alloc(TIMER_MOUSE); + + /* setup debug commands */ + if (machine().debug_flags & DEBUG_FLAG_ENABLED) + { + debug_console_register_command(machine(), "nimbus_debug", CMDFLAG_NONE, 0, 0, 1, nimbus_debug); + + /* set up the instruction hook */ + m_maincpu->debug()->set_instruction_hook(instruction_hook); + } + + m_debug_machine=DEBUG_NONE; + m_fdc->dden_w(0); +} + +static void nimbus_debug(running_machine &machine, int ref, int params, const char *param[]) +{ + rmnimbus_state *state = machine.driver_data(); + if(params>0) + { + int temp; + sscanf(param[0],"%d",&temp); state->m_debug_machine = temp; + } + else + { + debug_console_printf(machine,"Error usage : nimbus_debug \n"); + debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_machine); + } +} + +/*----------------------------------------------- + instruction_hook - per-instruction hook +-----------------------------------------------*/ + +static int instruction_hook(device_t &device, offs_t curpc) +{ + rmnimbus_state *state = device.machine().driver_data(); + address_space &space = device.memory().space(AS_PROGRAM); + UINT8 *addr_ptr; + + addr_ptr = (UINT8*)space.get_read_ptr(curpc); + + if ((addr_ptr !=NULL) && (addr_ptr[0]==0xCD)) + { + if(DEBUG_SET_STATE(DECODE_BIOS) && (addr_ptr[1]==0xF0)) + { + if(DEBUG_SET_STATE(DECODE_BIOS_RAW)) + decode_subbios(&device,curpc,1); + else + decode_subbios(&device,curpc,0); + } + + if(DEBUG_SET_STATE(DECODE_DOS21) && (addr_ptr[1]==0x21)) + decode_dos21(&device,curpc); + } + + return 0; +} + +#define set_type(type_name) sprintf(type_str,type_name) +#define set_drv(drv_name) sprintf(drv_str,drv_name) +#define set_func(func_name) sprintf(func_str,func_name) + +static void decode_subbios(device_t *device,offs_t pc, UINT8 raw_flag) +{ + char type_str[80]; + char drv_str[80]; + char func_str[80]; + + void (*dump_dssi)(device_t *,UINT16, UINT16 ,UINT8) = NULL; + + device_t *cpu = device->machine().device(MAINCPU_TAG); + + UINT16 ax = cpu->state().state_int(I8086_AX); + UINT16 bx = cpu->state().state_int(I8086_BX); + UINT16 cx = cpu->state().state_int(I8086_CX); + UINT16 ds = cpu->state().state_int(I8086_DS); + UINT16 si = cpu->state().state_int(I8086_SI); + + // *** TEMP Don't show f_enquire_display_line calls ! + if((cx==6) && (ax==43)) + return; + // *** END TEMP + + if(!raw_flag) + { + logerror("=======================================================================\n"); + logerror("Sub-bios call at %08X, AX=%04X, BX=%04X, CX=%04X, DS:SI=%04X:%04X\n",pc,ax,bx,cx,ds,si); + } + + set_type("invalid"); + set_drv("invalid"); + set_func("invalid"); + + switch (cx) + { + case 0 : + { + set_type("t_mummu"); + set_drv("d_mummu"); + + switch (ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_add_type_code"); break; + case 2 : set_func("f_del_typc_code"); break; + case 3 : set_func("f_get_TCB"); break; + case 4 : set_func("f_add_driver_code"); break; + case 5 : set_func("f_del_driver_code"); break; + case 6 : set_func("f_get_DCB"); break; + case 7 : set_func("f_get_copyright"); break; + } + }; break; + + case 1 : + { + set_type("t_character"); + set_drv("d_printer"); + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_get_output_status"); break; + case 2 : set_func("f_output_character"); break; + case 3 : set_func("f_get_input_status"); break; + case 4 : set_func("f_get_and_remove"); break; + case 5 : set_func("f_get_no_remove"); break; + case 6 : set_func("f_get_last_and_remove"); break; + case 7 : set_func("f_get_last_no_remove"); break; + case 8 : set_func("f_set_IO_parameters"); break; + } + }; break; + + case 2 : + { + set_type("t_disk"); + + switch(bx) + { + case 0 : set_drv("d_floppy"); break; + case 1 : set_drv("d_winchester"); break; + case 2 : set_drv("d_tape"); break; + case 3 : set_drv("d_rompack"); break; + case 4 : set_drv("d_eeprom"); break; + } + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_initialise_unit"); break; + case 2 : set_func("f_pseudo_init_unit"); break; + case 3 : set_func("f_get_device_status"); break; + case 4 : set_func("f_read_n_sectors"); dump_dssi=&decode_dssi_f_rw_sectors; break; + case 5 : set_func("f_write_n_sectors"); dump_dssi=&decode_dssi_f_rw_sectors; break; + case 6 : set_func("f_verify_n_sectors"); break; + case 7 : set_func("f_media_check"); break; + case 8 : set_func("f_recalibrate"); break; + case 9 : set_func("f_motors_off"); break; + } + dump_dssi=&decode_dssi_f_rw_sectors; + + }; break; + + case 3 : + { + set_type("t_piconet"); + set_drv("d_piconet"); + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_get_slave_status"); break; + case 2 : set_func("f_get_slave_map"); break; + case 3 : set_func("f_change_slave_addr"); break; + case 4 : set_func("f_read_slave_control"); break; + case 5 : set_func("f_write_slave_control"); break; + case 6 : set_func("f_send_data_byte"); break; + case 7 : set_func("f_request_data_byte"); break; + case 8 : set_func("f_send_data_block"); break; + case 9 : set_func("f_request_data_block"); break; + case 10 : set_func("f_reset_slave"); break; + + } + }; break; + + case 4 : + { + set_type("t_tick"); + set_drv("d_tick"); + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_ticks_per_second"); break; + case 2 : set_func("f_link_tick_routine"); break; + case 3 : set_func("f_unlink_tick_routine"); break; + } + }; break; + + case 5 : + { + set_type("t_graphics_input"); + + switch(bx) + { + case 0 : set_drv("d_mouse"); break; + case 1 : set_drv("d_joystick_1"); break; + case 2 : set_drv("d_joystick_2"); break; + } + + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_graphics_input_cold_start"); break; + case 2 : set_func("f_graphics_input_device_off"); break; + case 3 : set_func("f_return_button_status"); break; + case 4 : set_func("f_return_switch_and_button_stat"); break; + case 5 : set_func("f_start_tracking"); break; + case 6 : set_func("f_stop_tracking"); break; + case 7 : set_func("f_enquire_position"); break; + case 8 : set_func("f_set_position"); break; + + case 10 : set_func("f_return_button_press_info"); break; + case 11 : set_func("f_return_button_release_info"); break; + case 12 : set_func("f_set_gain/f_set_squeaks_per_pixel_ratio"); break; + case 13 : set_func("f_enquire_graphics_in_misc_data"); break; + } + }; break; + + case 6 : + { + set_type("t_graphics_output"); + set_drv("d_ngc_screen"); + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_graphics_output_cold_start"); break; + case 2 : set_func("f_graphics_output_warm_start"); break; + case 3 : set_func("f_graphics_output_off"); break; + case 4 : set_func("f_reinit_graphics_output"); break; + case 5 : set_func("f_polymarker"); break; + case 6 : set_func("f_polyline"); dump_dssi=&decode_dssi_f_fill_area; break; + case 7 : set_func("f_fill_area"); dump_dssi=&decode_dssi_f_fill_area; break; + case 8 : set_func("f_flood_fill_area"); break; + case 9 : set_func("f_plot_character_string"); dump_dssi=&decode_dssi_f_plot_character_string; break; + case 10 : set_func("f_define_graphics_clipping_area"); break; + case 11 : set_func("f_enquire_clipping_area_limits"); break; + case 12 : set_func("f_select_graphics_clipping_area"); break; + case 13 : set_func("f_enq_selctd_graphics_clip_area"); break; + case 14 : set_func("f_set_clt_element"); break; + case 15 : set_func("f_enquire_clt_element"); break; + case 16 : set_func("f_set_new_clt"); dump_dssi=&decode_dssi_f_set_new_clt; break; + case 17 : set_func("f_enquire_clt_contents"); break; + case 18 : set_func("f_define_dithering_pattern"); break; + case 19 : set_func("f_enquire_dithering_pattern"); break; + case 20 : set_func("f_draw_sprite"); break; + case 21 : set_func("f_move_sprite"); break; + case 22 : set_func("f_erase_sprite"); break; + case 23 : set_func("f_read_pixel"); break; + case 24 : set_func("f_read_to_limit"); break; + case 25 : set_func("f_read_area_pixel"); break; + case 26 : set_func("f_write_area_pixel"); break; + case 27 : set_func("f_copy_area_pixel"); break; + + case 29 : set_func("f_read_area_word"); break; + case 30 : set_func("f_write_area_word"); break; + case 31 : set_func("f_copy_area_word"); break; + case 32 : set_func("f_swap_area_word"); break; + case 33 : set_func("f_set_border_colour"); break; + case 34 : set_func("f_enquire_border_colour"); break; + case 35 : set_func("f_enquire_miscellaneous_data"); break; + case 36 : set_func("f_circle"); break; + + case 38 : set_func("f_arc_of_ellipse"); break; + case 39 : set_func("f_isin"); break; + case 40 : set_func("f_icos"); break; + case 41 : set_func("f_define_hatching_pattern"); break; + case 42 : set_func("f_enquire_hatching_pattern"); break; + case 43 : set_func("f_enquire_display_line"); break; + case 44 : set_func("f_plonk_logo"); break; + } + }; break; + + case 7 : + { + set_type("t_zend"); + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + } + }; break; + + case 8 : + { + set_type("t_zep"); + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + } + }; break; + + case 9 : + { + set_type("t_raw_console"); + + switch(bx) + { + case 0 : + { + set_drv("d_screen"); + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_plonk_char"); dump_dssi=decode_dssi_f_plonk_char; break; + case 2 : set_func("f_plonk_cursor"); break; + case 3 : set_func("f_kill_cursor"); break; + case 4 : set_func("f_scroll"); break; + case 5 : set_func("f_width"); dump_dssi=decode_dssi_generic;break; + case 6 : set_func("f_get_char_set"); break; + case 7 : set_func("f_set_char_set"); break; + case 8 : set_func("f_reset_char_set"); break; + case 9 : set_func("f_set_plonk_parameters"); break; + case 10 : set_func("f_set_cursor_flash_rate"); break; + } + }; break; + + case 1 : + { + set_drv("d_keyboard"); + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_init_keyboard"); break; + case 2 : set_func("f_get_last_key_code"); break; + case 3 : set_func("f_get_bitmap"); break; + } + }; break; + } + }; break; + + case 10 : + { + set_type("t_acoustics"); + + switch(bx) + { + case 0 : + { + set_drv("d_sound"); + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_sound_enable"); break; + case 2 : set_func("f_play_note"); break; + case 3 : set_func("f_get_queue_status"); break; + } + }; break; + + case 1 : + { + set_drv("d_voice"); + + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + case 1 : set_func("f_talk"); break; + case 2 : set_func("f_wait_and_talk"); break; + case 3 : set_func("f_test_talking"); break; + } + } + } + }; break; + + case 11 : + { + set_type("t_hard_sums"); + switch(ax) + { + case 0 : set_func("f_get_version_number"); break; + } + }; break; + } + + if(raw_flag) + { + if(dump_dssi!=NULL) + dump_dssi(device,ds,si,raw_flag); + } + else + { + logerror("Type=%s, Driver=%s, Function=%s\n",type_str,drv_str,func_str); + + if(dump_dssi!=NULL) + dump_dssi(device,ds,si,raw_flag); + logerror("=======================================================================\n"); + } +} + +static inline void *get_dssi_ptr(address_space &space, UINT16 ds, UINT16 si) +{ + int addr; + + addr=((ds<<4)+si); +// OUTPUT_SEGOFS("DS:SI",ds,si); + + return space.get_read_ptr(addr); +} + +static void decode_dssi_generic(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) +{ + rmnimbus_state *state = device->machine().driver_data(); + address_space &space = state->m_maincpu->space(AS_PROGRAM); + UINT16 *params; + int count; + + if(raw_flag) + return; + + params=(UINT16 *)get_dssi_ptr(space,ds,si); + + for(count=0; count<10; count++) + logerror("%04X ",params[count]); + + logerror("\n"); +} + + +static void decode_dssi_f_fill_area(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) +{ + rmnimbus_state *state = device->machine().driver_data(); + address_space &space = state->m_maincpu->space(AS_PROGRAM); + + UINT16 *addr_ptr; + t_area_params *area_params; + t_nimbus_brush *brush; + int cocount; + + area_params = (t_area_params *)get_dssi_ptr(space,ds,si); + + if (!raw_flag) + OUTPUT_SEGOFS("SegBrush:OfsBrush",area_params->seg_brush,area_params->ofs_brush); + + brush=(t_nimbus_brush *)space.get_read_ptr(LINEAR_ADDR(area_params->seg_brush,area_params->ofs_brush)); + + if(raw_flag) + { + logerror("\tdw\t%04X, %04X, %04X, %04X, %04X, %04X, %04X, %04X, %04X, ", + brush->style,brush->style_index,brush->colour1,brush->colour2, + brush->transparency,brush->boundary_spec,brush->boundary_colour,brush->save_colour, + area_params->count); + } + else + { + logerror("Brush params\n"); + logerror("Style=%04X, StyleIndex=%04X\n",brush->style,brush->style_index); + logerror("Colour1=%04X, Colour2=%04X\n",brush->colour1,brush->colour2); + logerror("transparency=%04X, boundry_spec=%04X\n",brush->transparency,brush->boundary_spec); + logerror("boundry colour=%04X, save colour=%04X\n",brush->boundary_colour,brush->save_colour); + + + OUTPUT_SEGOFS("SegData:OfsData",area_params->seg_data,area_params->ofs_data); + } + + addr_ptr = (UINT16 *)space.get_read_ptr(LINEAR_ADDR(area_params->seg_data,area_params->ofs_data)); + for(cocount=0; cocount < area_params->count; cocount++) + { + if(raw_flag) + { + if(cocount!=(area_params->count-1)) + logerror("%04X, %04X, ",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); + else + logerror("%04X, %04X ",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); + } + else + logerror("x=%d y=%d\n",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); + } + + if(raw_flag) + logerror("\n"); +} + +static void decode_dssi_f_plot_character_string(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) +{ + rmnimbus_state *state = device->machine().driver_data(); + address_space &space = state->m_maincpu->space(AS_PROGRAM); + + UINT8 *char_ptr; + t_plot_string_params *plot_string_params; + int charno; + + if(raw_flag) + return; + + plot_string_params=(t_plot_string_params *)get_dssi_ptr(space,ds,si); + + OUTPUT_SEGOFS("SegFont:OfsFont",plot_string_params->seg_font,plot_string_params->ofs_font); + OUTPUT_SEGOFS("SegData:OfsData",plot_string_params->seg_data,plot_string_params->ofs_data); + + logerror("x=%d, y=%d, length=%d\n",plot_string_params->x,plot_string_params->y,plot_string_params->length); + + char_ptr=(UINT8*)space.get_read_ptr(LINEAR_ADDR(plot_string_params->seg_data,plot_string_params->ofs_data)); + + if (plot_string_params->length==0xFFFF) + logerror("%s",char_ptr); + else + for(charno=0;charnolength;charno++) + logerror("%c",char_ptr[charno]); + + logerror("\n"); +} + +static void decode_dssi_f_set_new_clt(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) +{ + rmnimbus_state *state = device->machine().driver_data(); + address_space &space = state->m_maincpu->space(AS_PROGRAM); + UINT16 *new_colours; + int colour; + new_colours=(UINT16 *)get_dssi_ptr(space,ds,si); + + if(raw_flag) + return; + + OUTPUT_SEGOFS("SegColours:OfsColours",ds,si); + + for(colour=0;colour<16;colour++) + logerror("colour #%02X=%04X\n",colour,new_colours[colour]); + +} + +static void decode_dssi_f_plonk_char(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) +{ + rmnimbus_state *state = device->machine().driver_data(); + address_space &space = state->m_maincpu->space(AS_PROGRAM); + UINT16 *params; + params=(UINT16 *)get_dssi_ptr(space,ds,si); + + if(raw_flag) + return; + + OUTPUT_SEGOFS("SegParams:OfsParams",ds,si); + + logerror("plonked_char=%c\n",params[0]); +} + +static void decode_dssi_f_rw_sectors(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) +{ + rmnimbus_state *state = device->machine().driver_data(); + address_space &space = state->m_maincpu->space(AS_PROGRAM); + UINT16 *params; + int param_no; + + if(raw_flag) + return; + + params=(UINT16 *)get_dssi_ptr(space,ds,si); + + for(param_no=0;param_no<16;param_no++) + logerror("%04X ",params[param_no]); + + logerror("\n"); +} + +static void decode_dos21(device_t *device,offs_t pc) +{ + device_t *cpu = device->machine().device(MAINCPU_TAG); + + UINT16 ax = cpu->state().state_int(I8086_AX); + UINT16 bx = cpu->state().state_int(I8086_BX); + UINT16 cx = cpu->state().state_int(I8086_CX); + UINT16 dx = cpu->state().state_int(I8086_DX); + UINT16 cs = cpu->state().state_int(I8086_CS); + UINT16 ds = cpu->state().state_int(I8086_DS); + UINT16 es = cpu->state().state_int(I8086_ES); + UINT16 ss = cpu->state().state_int(I8086_SS); + + UINT16 si = cpu->state().state_int(I8086_SI); + UINT16 di = cpu->state().state_int(I8086_DI); + UINT16 bp = cpu->state().state_int(I8086_BP); + + logerror("=======================================================================\n"); + logerror("DOS Int 0x21 call at %05X\n",pc); + logerror("AX=%04X, BX=%04X, CX=%04X, DX=%04X\n",ax,bx,cx,dx); + logerror("CS=%04X, DS=%04X, ES=%04X, SS=%04X\n",cs,ds,es,ss); + logerror("SI=%04X, DI=%04X, BP=%04X\n",si,di,bp); + logerror("=======================================================================\n"); +} + + +/* + The Nimbus has 3 banks of memory each of which can be either 16x4164 or 16x41256 giving + 128K or 512K per bank. These banks are as follows : + + bank0 on nimbus motherboard. + bank1 first half of expansion card. + bank2 second half of expansion card. + + The valid combinations are : + + bank0 bank1 bank2 total + 128K 128K + 128K 128K 256K + 128K 128K 128K 384K + 128K 512K 640K (1) + 512K 128K 640K (2) + 512K 512K 1024K + 512K 512K 512K 1536K + + It will be noted that there are two possible ways of getting 640K, we emulate method 2 + (above). + + To allow for the greatest flexibility, the Nimbus allows 4 methods of mapping the + banks of ram into the 1M addressable by the 81086. + + With only 128K banks present, they are mapped into the first 3 blocks of 128K in + the memory map giving a total of up to 384K. + + If any of the blocks are 512K, then the block size is set to 512K and the map arranged + so that the bottom block is a 512K block (if both 512K and 128K blocks are available). + + This is all determined by the value written to port 80 :- + + port80 = 0x07 start end + block0 0x00000 0x1FFFF + block1 0x20000 0x3FFFF + block2 0x40000 0x5FFFF + + port80 = 0x1F + block0 0x00000 0x7FFFF + block1 0x80000 0xEFFFF (0x9FFFF if 128K (2)) + + port80 = 0x0F + block1 0x00000 0x7FFFF + block0 0x80000 0xEFFFF (0x9FFFF if 128K (1)) + + port80 = 0x17 + block1 0x00000 0x7FFFF + block2 0x80000 0xEFFFF + +*/ + +struct nimbus_meminfo +{ + offs_t start; /* start address of bank */ + offs_t end; /* End address of bank */ +}; + +static const struct nimbus_meminfo memmap[] = +{ + { 0x00000, 0x1FFFF }, + { 0x20000, 0x3FFFF }, + { 0x40000, 0x5FFFF }, + { 0x60000, 0x7FFFF }, + { 0x80000, 0x9FFFF }, + { 0xA0000, 0xBFFFF }, + { 0xC0000, 0xDFFFF }, + { 0xE0000, 0xEFFFF } +}; + +struct nimbus_block +{ + int blockbase; + int blocksize; +}; + +typedef nimbus_block nimbus_blocks[3]; + +static const nimbus_blocks ramblocks[] = +{ + {{ 0, 128 }, { 000, 000 }, { 000, 000 }} , + {{ 0, 128 }, { 128, 128 }, { 000, 000 }} , + {{ 0, 128 }, { 128, 128 }, { 256, 128 }} , + {{ 0, 512 }, { 000, 000 }, { 000, 000 }} , + {{ 0, 512 }, { 512, 128 }, { 000, 000 }} , + {{ 0, 512 }, { 512, 512 }, { 000, 000 }} , + {{ 0, 512 }, { 512, 512 }, { 1024, 512 } } +}; + +void rmnimbus_state::nimbus_bank_memory() +{ + address_space &space = machine().device( MAINCPU_TAG)->memory().space( AS_PROGRAM ); + int ramsize = m_ram->size(); + int ramblock = 0; + int blockno; + char bank[10]; + UINT8 *ram = &m_ram->pointer()[0]; + UINT8 *map_blocks[3]; + UINT8 *map_base; + int map_blockno; + int block_ofs; + + UINT8 ramsel = (m_mcu_reg080 & 0x1F); + + // Invalid ramsel, return. + if((ramsel & 0x07)!=0x07) + return; + + switch (ramsize / 1024) + { + case 128 : ramblock=0; break; + case 256 : ramblock=1; break; + case 384 : ramblock=2; break; + case 512 : ramblock=3; break; + case 640 : ramblock=4; break; + case 1024 : ramblock=5; break; + case 1536 : ramblock=6; break; + } + + map_blocks[0] = ram; + map_blocks[1] = (ramblocks[ramblock][1].blocksize==0) ? NULL : &ram[ramblocks[ramblock][1].blockbase*1024]; + map_blocks[2] = (ramblocks[ramblock][2].blocksize==0) ? NULL : &ram[ramblocks[ramblock][2].blockbase*1024]; + + //if(LOG_RAM) logerror("\n\nmcu_reg080=%02X, ramblock=%d, map_blocks[0]=%X, map_blocks[1]=%X, map_blocks[2]=%X\n",m_mcu_reg080,ramblock,(int)map_blocks[0],(int)map_blocks[1],(int)map_blocks[2]); + + for(blockno=0;blockno<8;blockno++) + { + sprintf(bank,"bank%d",blockno); + + switch (ramsel) + { + case 0x07 : (blockno<3) ? map_blockno=blockno : map_blockno=-1; break; + case 0x1F : (blockno<4) ? map_blockno=0 : map_blockno=1; break; + case 0x0F : (blockno<4) ? map_blockno=1 : map_blockno=0; break; + case 0x17 : (blockno<4) ? map_blockno=1 : map_blockno=2; break; + default : map_blockno=-1; + } + block_ofs=(ramsel==0x07) ? 0 : ((blockno % 4)*128); + + + if(LOG_RAM) logerror("mapped %s",bank); + + if((map_blockno>-1) && (block_ofs < ramblocks[ramblock][map_blockno].blocksize) && + (map_blocks[map_blockno]!=NULL)) + { + map_base=(ramsel==0x07) ? map_blocks[map_blockno] : &map_blocks[map_blockno][block_ofs*1024]; + + membank(bank)->set_base(map_base); + space.install_readwrite_bank(memmap[blockno].start, memmap[blockno].end, bank); + //if(LOG_RAM) logerror(", base=%X\n",(int)map_base); + } + else + { + space.nop_readwrite(memmap[blockno].start, memmap[blockno].end); + if(LOG_RAM) logerror("NOP\n"); + } + } +} + +READ8_MEMBER(rmnimbus_state::nimbus_mcu_r) +{ + return m_mcu_reg080; +} + +WRITE8_MEMBER(rmnimbus_state::nimbus_mcu_w) +{ + m_mcu_reg080=data; + + nimbus_bank_memory(); +} + +void rmnimbus_state::memory_reset() +{ + m_mcu_reg080=0x07; + nimbus_bank_memory(); +} + +/* + +Z80SIO, used for the keyboard interface + +*/ + +/* Z80 SIO/2 */ + +WRITE_LINE_MEMBER(rmnimbus_state::sio_interrupt) +{ + if(LOG_SIO) + logerror("SIO Interrupt state=%02X\n",state); + + external_int(m_z80sio->m1_r(), state); +} + +/* Floppy disk */ + +void rmnimbus_state::fdc_reset() +{ + m_nimbus_drives.reg400=0; + m_scsi_ctrl_out->write(0); +} + +WRITE_LINE_MEMBER(rmnimbus_state::nimbus_fdc_intrq_w) +{ + if(LOG_DISK) + logerror("nimbus_drives_intrq = %d\n",state); + + if(m_iou_reg092 & DISK_INT_ENABLE) + { + external_int(EXTERNAL_INT_DISK,state); + } +} + +WRITE_LINE_MEMBER(rmnimbus_state::nimbus_fdc_drq_w) +{ + if(LOG_DISK) + logerror("nimbus_drives_drq_w(%d)\n", state); + + m_maincpu->drq1_w(state && FDC_DRQ_ENABLED()); +} + +UINT8 rmnimbus_state::fdc_driveno(UINT8 drivesel) +{ + switch (drivesel) + { + case 0x01: return 0; + case 0x02: return 1; + case 0x04: return 2; + case 0x08: return 3; + case 0x10: return 4; + case 0x20: return 5; + case 0x40: return 6; + case 0x80: return 7; + default: return 0; + } +} + +/* + 0x410 read bits + + 0 Ready from floppy + 1 Index pulse from floppy + 2 Motor on from floppy + 3 MSG from HDD + 4 !BSY from HDD + 5 !I/O from HDD + 6 !C/D + 7 !REQ from HDD +*/ + +READ8_MEMBER(rmnimbus_state::scsi_r) +{ + int result = 0; + + int pc=space.device().safe_pc(); + char drive[5]; + floppy_image_device *floppy; + + sprintf(drive, "%d", FDC_DRIVE()); + floppy = m_fdc->subdevice(drive)->get_device(); + + switch(offset*2) + { + case 0x00 : + result |= m_scsi_req << 7; + result |= m_scsi_cd << 6; + result |= m_scsi_io << 5; + result |= m_scsi_bsy << 4; + result |= !m_scsi_msg << 3; + if(floppy) + { + result |= FDC_MOTOR() << 2; + result |= (!floppy->idx_r()) << 1; + result |= floppy->ready_r() << 0; + } + break; + case 0x08 : + result = m_scsi_data_in->read(); + hdc_post_rw(); + default: + break; + } + + if(LOG_DISK_HDD) + logerror("Nimbus HDCR at pc=%08X from %04X data=%02X\n",pc,(offset*2)+0x410,result); + + return result; +} + +/* + 0x400 write bits + + 0 drive 0 select + 1 drive 1 select + 2 drive 2 select + 3 drive 3 select + 4 side select + 5 fdc motor on + 6 hdc drq enabled + 7 fdc drq enabled +*/ +WRITE8_MEMBER(rmnimbus_state::fdc_ctl_w) +{ + UINT8 reg400_old = m_nimbus_drives.reg400; + char drive[5]; + floppy_image_device *floppy; + + m_nimbus_drives.reg400 = data; + + sprintf(drive, "%d", FDC_DRIVE()); + floppy = m_fdc->subdevice(drive)->get_device(); + + m_fdc->set_floppy(floppy); + if(floppy) + { + floppy->ss_w(FDC_SIDE()); + floppy->mon_w(!FDC_MOTOR()); + } + + // if we enable hdc drq with a pending condition, act on it + if((data & HDC_DRQ_MASK) && (~reg400_old & HDC_DRQ_MASK)) + hdc_drq(true); +} + +/* + 0x410 write bits + + 0 SCSI reset + 1 SCSI SEL + 2 SCSI IRQ Enable +*/ + +WRITE8_MEMBER(rmnimbus_state::scsi_w) +{ + int pc=space.device().safe_pc(); + + if(LOG_DISK_HDD) + logerror("Nimbus HDCW at %05X write of %02X to %04X\n",pc,data,(offset*2)+0x410); + + switch(offset*2) + { + case 0x00 : + m_scsi_ctrl_out->write(data); + break; + + case 0x08 : + m_scsi_data_out->write(data); + hdc_post_rw(); + break; + } +} + +void rmnimbus_state::hdc_reset() +{ + m_scsi_iena = 0; + m_scsi_msg = 0; + m_scsi_bsy = 0; + m_scsi_io = 0; + m_scsi_cd = 0; + m_scsi_req = 0; +} + +void rmnimbus_state::check_scsi_irq() +{ + nimbus_fdc_intrq_w(m_scsi_io && m_scsi_cd && m_scsi_req && m_scsi_iena); +} + +WRITE_LINE_MEMBER(rmnimbus_state::write_scsi_iena) +{ + m_scsi_iena = state; + check_scsi_irq(); +} + +void rmnimbus_state::hdc_post_rw() +{ + if(m_scsi_req) + m_scsibus->write_ack(1); +} + +void rmnimbus_state::hdc_drq(bool state) +{ + m_maincpu->drq1_w(HDC_DRQ_ENABLED() && !m_scsi_cd && state); +} + +WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_bsy ) +{ + m_scsi_bsy = state; +} + +WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_cd ) +{ + m_scsi_cd = state; + check_scsi_irq(); +} + +WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_io ) +{ + m_scsi_io = state; + + if (m_scsi_io) + { + m_scsi_data_out->write(0); + } + check_scsi_irq(); +} + +WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_msg ) +{ + m_scsi_msg = state; +} + +WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_req ) +{ + int last = m_scsi_req; + m_scsi_req = state; + + if (state) + { + if (!m_scsi_cd && !last) + { + hdc_drq(true); + } + } + else + { + hdc_drq(false); + m_scsibus->write_ack(0); + } + check_scsi_irq(); +} + +/* 8031/8051 Peripheral controler 80186 side */ + +void rmnimbus_state::pc8031_reset() +{ + logerror("peripheral controler reset\n"); + + memset(&m_ipc_interface,0,sizeof(m_ipc_interface)); +} + + +#if 0 +void rmnimbus_state::ipc_dumpregs() +{ + logerror("in_data=%02X, in_status=%02X, out_data=%02X, out_status=%02X\n", + m_ipc_interface.ipc_in, m_ipc_interface.status_in, + m_ipc_interface.ipc_out, m_ipc_interface.status_out); + +} +#endif + +READ8_MEMBER(rmnimbus_state::nimbus_pc8031_r) +{ + int pc=space.device().safe_pc(); + UINT8 result; + + switch(offset*2) + { + case 0x00 : result=m_ipc_interface.ipc_out; + m_ipc_interface.status_in &= ~IPC_IN_READ_PEND; + m_ipc_interface.status_out &= ~IPC_OUT_BYTE_AVAIL; + break; + + case 0x02 : result=m_ipc_interface.status_out; + break; + + default : result=0; break; + } + + if(LOG_PC8031_186) + logerror("Nimbus PCIOR %08X read of %04X returns %02X\n",pc,(offset*2)+0xC0,result); + + return result; +} + +WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_w) +{ + int pc=space.device().safe_pc(); + + switch(offset*2) + { + case 0x00 : m_ipc_interface.ipc_in=data; + m_ipc_interface.status_in |= IPC_IN_BYTE_AVAIL; + m_ipc_interface.status_in &= ~IPC_IN_ADDR; + m_ipc_interface.status_out |= IPC_OUT_READ_PEND; + break; + + case 0x02 : m_ipc_interface.ipc_in=data; + m_ipc_interface.status_in |= IPC_IN_BYTE_AVAIL; + m_ipc_interface.status_in |= IPC_IN_ADDR; + m_ipc_interface.status_out |= IPC_OUT_READ_PEND; + break; + } + + if(LOG_PC8031_186) + logerror("Nimbus PCIOW %08X write of %02X to %04X\n",pc,data,(offset*2)+0xC0); + +} + +/* 8031/8051 Peripheral controler 8031/8051 side */ + +READ8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_r) +{ + int pc=space.device().safe_pc(); + UINT8 result = 0; + + switch (offset & 0x01) + { + case 0x00 : result=m_ipc_interface.ipc_in; + m_ipc_interface.status_out &= ~IPC_OUT_READ_PEND; + m_ipc_interface.status_in &= ~IPC_IN_BYTE_AVAIL; + break; + + case 0x01 : result=m_ipc_interface.status_in; + break; + } + + if(((offset==2) || (offset==3)) && (m_iou_reg092 & PC8031_INT_ENABLE)) + external_int(EXTERNAL_INT_PC8031_8C, true); + + if(LOG_PC8031) + logerror("8031: PCIOR %04X read of %04X returns %02X\n",pc,offset,result); + + return result; +} + +WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_w) +{ + int pc=space.device().safe_pc(); + + if(LOG_PC8031) + logerror("8031 PCIOW %04X write of %02X to %04X\n",pc,data,offset); + + switch(offset & 0x03) + { + case 0x00 : m_ipc_interface.ipc_out=data; + m_ipc_interface.status_out |= IPC_OUT_BYTE_AVAIL; + m_ipc_interface.status_out &= ~IPC_OUT_ADDR; + m_ipc_interface.status_in |= IPC_IN_READ_PEND; + break; + + case 0x01 : m_ipc_interface.ipc_out=data; + m_ipc_interface.status_out |= IPC_OUT_BYTE_AVAIL; + m_ipc_interface.status_out |= IPC_OUT_ADDR; + m_ipc_interface.status_in |= IPC_IN_READ_PEND; + break; + + case 0x02 : m_ipc_interface.ipc_out=data; + m_ipc_interface.status_out |= IPC_OUT_BYTE_AVAIL; + m_ipc_interface.status_out &= ~IPC_OUT_ADDR; + m_ipc_interface.status_in |= IPC_IN_READ_PEND; + if(m_iou_reg092 & PC8031_INT_ENABLE) + external_int(EXTERNAL_INT_PC8031_8F, true); + break; + + case 0x03 : m_ipc_interface.ipc_out=data; + //m_ipc_interface.status_out |= IPC_OUT_BYTE_AVAIL; + m_ipc_interface.status_out |= IPC_OUT_ADDR; + m_ipc_interface.status_in |= IPC_IN_READ_PEND; + if(m_iou_reg092 & PC8031_INT_ENABLE) + external_int(EXTERNAL_INT_PC8031_8E, true); + break; + } +} + +READ8_MEMBER(rmnimbus_state::nimbus_pc8031_port_r) +{ + int pc=space.device().safe_pc(); + UINT8 result = 0; + + if(LOG_PC8031_PORT) + logerror("8031: PCPORTR %04X read of %04X returns %02X\n",pc,offset,result); + + switch(offset) + { + case 0x01: + result = (m_eeprom_bits & ~4) | (m_eeprom->do_read() << 2); + break; + } + + return result; +} + +WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_port_w) +{ + int pc=space.device().safe_pc(); + + switch (offset) + { + case 0x01: + m_eeprom->cs_write((data & 8) ? 1 : 0); + + if(!(data & 8)) + m_eeprom_state = 0; + else if(!(data & 2) || (m_eeprom_state == 2)) + m_eeprom_state = 2; + else if((data & 8) && (!(m_eeprom_bits & 8))) + m_eeprom_state = 1; + else if((!(data & 1)) && (m_eeprom_bits & 1) && (m_eeprom_state == 1)) + m_eeprom_state = 2; //wait until 1 clk after cs rises to set di else it's seen as a start bit + + m_eeprom->di_write(((data & 2) && (m_eeprom_state == 2)) ? 1 : 0); + m_eeprom->clk_write((data & 1) ? 1 : 0); + m_eeprom_bits = data; + break; + } + + if(LOG_PC8031_PORT) + logerror("8031 PCPORTW %04X write of %02X to %04X\n",pc,data,offset); +} + + + +/* IO Unit */ +READ8_MEMBER(rmnimbus_state::nimbus_iou_r) +{ + int pc=space.device().safe_pc(); + UINT8 result=0; + + if(offset==0) + { + result=m_iou_reg092; + } + + if(LOG_IOU) + logerror("Nimbus IOUR %08X read of %04X returns %02X\n",pc,(offset*2)+0x92,result); + + return result; +} + +WRITE8_MEMBER(rmnimbus_state::nimbus_iou_w) +{ + int pc=space.device().safe_pc(); + + if(LOG_IOU) + logerror("Nimbus IOUW %08X write of %02X to %04X\n",pc,data,(offset*2)+0x92); + + if(offset==0) + { + m_iou_reg092=data; + m_msm->reset_w((data & MSM5205_INT_ENABLE) ? 0 : 1); + } +} + +void rmnimbus_state::iou_reset() +{ + m_iou_reg092=0x00; + m_eeprom_state = 0; +} + +/* + Sound hardware : AY8910 + + I believe that the IO ports of the 8910 are used to control the ROMPack ports, however + this is currently un-implemented (and may never be as I don't have any rompacks!). + + The registers are mapped as so : + + Address 0xE0 0xE2 + Read Data ???? + Write Register Address Data + +*/ + +void rmnimbus_state::rmni_sound_reset() +{ + m_msm->reset_w(1); + + m_last_playmode = MSM5205_S48_4B; + m_msm->playmode_w(m_last_playmode); + + m_ay8910_a=0; +} + +WRITE8_MEMBER(rmnimbus_state::nimbus_sound_ay8910_porta_w) +{ + m_msm->data_w(data); + + // Mouse code needs a copy of this. + m_ay8910_a=data; +} + +WRITE8_MEMBER(rmnimbus_state::nimbus_sound_ay8910_portb_w) +{ + if ((data & 0x07) != m_last_playmode) + { + m_last_playmode = (data & 0x07); + m_msm->playmode_w(m_last_playmode); + } +} + +WRITE_LINE_MEMBER(rmnimbus_state::nimbus_msm5205_vck) +{ + if(m_iou_reg092 & MSM5205_INT_ENABLE) + external_int(EXTERNAL_INT_MSM5205,state); +} + +static const int MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } }; +static const int MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } }; +//static const int MOUSE_XYA[4] = { 1, 1, 0, 0 }; +//static const int MOUSE_XYB[4] = { 0, 1, 1, 0 }; + +void rmnimbus_state::mouse_js_reset() +{ + m_nimbus_mouse.m_mouse_px=0; + m_nimbus_mouse.m_mouse_py=0; + m_nimbus_mouse.m_mouse_x=128; + m_nimbus_mouse.m_mouse_y=128; + m_nimbus_mouse.m_mouse_pc=0; + m_nimbus_mouse.m_mouse_pcx=0; + m_nimbus_mouse.m_mouse_pcy=0; + m_nimbus_mouse.m_intstate_x=0; + m_nimbus_mouse.m_intstate_y=0; + m_nimbus_mouse.m_reg0a4=0xC0; + + // Setup timer to poll the mouse + m_nimbus_mouse.m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(1000)); +} + +void rmnimbus_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + UINT8 x = 0; + UINT8 y = 0; +// int pc=m_maincpu->pc(); + + UINT8 intstate_x; + UINT8 intstate_y; + int xint; + int yint; + + m_nimbus_mouse.m_reg0a4 = m_io_mouse_button->read() | 0xC0; + x = m_io_mousex->read(); + y = m_io_mousey->read(); + + UINT8 mxa; + UINT8 mxb; + UINT8 mya; + UINT8 myb; + + //logerror("poll_mouse()\n"); + + if (x == m_nimbus_mouse.m_mouse_x) + { + m_nimbus_mouse.m_mouse_px = MOUSE_PHASE_STATIC; + } + else if (x > m_nimbus_mouse.m_mouse_x) + { + m_nimbus_mouse.m_mouse_px = MOUSE_PHASE_POSITIVE; + } + else if (x < m_nimbus_mouse.m_mouse_x) + { + m_nimbus_mouse.m_mouse_px = MOUSE_PHASE_NEGATIVE; + } + + if (y == m_nimbus_mouse.m_mouse_y) + { + m_nimbus_mouse.m_mouse_py = MOUSE_PHASE_STATIC; + } + else if (y > m_nimbus_mouse.m_mouse_y) + { + m_nimbus_mouse.m_mouse_py = MOUSE_PHASE_POSITIVE; + } + else if (y < m_nimbus_mouse.m_mouse_y) + { + m_nimbus_mouse.m_mouse_py = MOUSE_PHASE_NEGATIVE; + } + + switch (m_nimbus_mouse.m_mouse_px) + { + case MOUSE_PHASE_STATIC : break; + case MOUSE_PHASE_POSITIVE : m_nimbus_mouse.m_mouse_pcx++; break; + case MOUSE_PHASE_NEGATIVE : m_nimbus_mouse.m_mouse_pcx--; break; + } + m_nimbus_mouse.m_mouse_pcx &= 0x03; + + switch (m_nimbus_mouse.m_mouse_py) + { + case MOUSE_PHASE_STATIC : break; + case MOUSE_PHASE_POSITIVE : m_nimbus_mouse.m_mouse_pcy++; break; + case MOUSE_PHASE_NEGATIVE : m_nimbus_mouse.m_mouse_pcy--; break; + } + m_nimbus_mouse.m_mouse_pcy &= 0x03; + +// mxb = MOUSE_XYB[state.m_mouse_px][state->m_mouse_pcx]; // XB +// mxa = MOUSE_XYA[state.m_mouse_px][state->m_mouse_pcx]; // XA +// mya = MOUSE_XYA[state.m_mouse_py][state->m_mouse_pcy]; // YA +// myb = MOUSE_XYB[state.m_mouse_py][state->m_mouse_pcy]; // YB + + mxb = MOUSE_XYB[1][m_nimbus_mouse.m_mouse_pcx]; // XB + mxa = MOUSE_XYA[1][m_nimbus_mouse.m_mouse_pcx]; // XA + mya = MOUSE_XYA[1][m_nimbus_mouse.m_mouse_pcy]; // YA + myb = MOUSE_XYB[1][m_nimbus_mouse.m_mouse_pcy]; // YB + + if ((m_nimbus_mouse.m_mouse_py!=MOUSE_PHASE_STATIC) || (m_nimbus_mouse.m_mouse_px!=MOUSE_PHASE_STATIC)) + { +// logerror("mouse_px=%02X, mouse_py=%02X, mouse_pcx=%02X, mouse_pcy=%02X\n", +// state.m_mouse_px,state->m_mouse_py,state->m_mouse_pcx,state->m_mouse_pcy); + +// logerror("mxb=%02x, mxa=%02X (mxb ^ mxa)=%02X, (ay8910_a & 0xC0)=%02X, (mxb ^ mxa) ^ ((ay8910_a & 0x80) >> 7)=%02X\n", +// mxb,mxa, (mxb ^ mxa) , (state.m_ay8910_a & 0xC0), (mxb ^ mxa) ^ ((state->m_ay8910_a & 0x40) >> 6)); + } + + intstate_x = (mxb ^ mxa) ^ ((m_ay8910_a & 0x40) >> 6); + intstate_y = (myb ^ mya) ^ ((m_ay8910_a & 0x80) >> 7); + + if (MOUSE_INT_ENABLED(this)) + { + if ((intstate_x==1) && (m_nimbus_mouse.m_intstate_x==0)) +// if (intstate_x!=state.m_intstate_x) + { + xint=mxa ? EXTERNAL_INT_MOUSE_XR : EXTERNAL_INT_MOUSE_XL; + + external_int(xint, true); + +// logerror("Xint:%02X, mxb=%02X\n",xint,mxb); + } + + if ((intstate_y==1) && (m_nimbus_mouse.m_intstate_y==0)) +// if (intstate_y!=state.m_intstate_y) + { + yint=myb ? EXTERNAL_INT_MOUSE_YU : EXTERNAL_INT_MOUSE_YD; + + external_int(yint, true); +// logerror("Yint:%02X, myb=%02X\n",yint,myb); + } + } + else + { + m_nimbus_mouse.m_reg0a4 &= 0xF0; + m_nimbus_mouse.m_reg0a4 |= ( mxb & 0x01) << 3; // XB + m_nimbus_mouse.m_reg0a4 |= (~mxb & 0x01) << 2; // XA + m_nimbus_mouse.m_reg0a4 |= (~myb & 0x01) << 1; // YA + m_nimbus_mouse.m_reg0a4 |= ( myb & 0x01) << 0; // YB + } + + m_nimbus_mouse.m_mouse_x = x; + m_nimbus_mouse.m_mouse_y = y; + + if ((m_nimbus_mouse.m_mouse_py!=MOUSE_PHASE_STATIC) || (m_nimbus_mouse.m_mouse_px!=MOUSE_PHASE_STATIC)) + { +// logerror("pc=%05X, reg0a4=%02X, reg092=%02X, ay_a=%02X, x=%02X, y=%02X, px=%02X, py=%02X, intstate_x=%02X, intstate_y=%02X\n", +// pc,state.m_reg0a4,state->m_iou_reg092,state->m_ay8910_a,state->m_mouse_x,state->m_mouse_y,state->m_mouse_px,state->m_mouse_py,intstate_x,intstate_y); + } + + m_nimbus_mouse.m_intstate_x=intstate_x; + m_nimbus_mouse.m_intstate_y=intstate_y; +} + +READ8_MEMBER(rmnimbus_state::nimbus_mouse_js_r) +{ + /* + + bit description + + 0 JOY 0-Up or mouse XB + 1 JOY 0-Down or mouse XA + 2 JOY 0-Left or mouse YA + 3 JOY 0-Right or mouse YB + 4 JOY 0-b0 or mouse rbutton + 5 JOY 0-b1 or mouse lbutton + 6 ?? always reads 1 + 7 ?? always reads 1 + + */ + UINT8 result; + //int pc=m_maincpu->_pc(); + + if (m_io_config->read() & 0x01) + { + result=m_nimbus_mouse.m_reg0a4; + //logerror("mouse_js_r: pc=%05X, result=%02X\n",pc,result); + } + else + { + result = m_io_joystick0->read(); + } + + return result; +} + +WRITE8_MEMBER(rmnimbus_state::nimbus_mouse_js_w) +{ +} + +/********************************************************************** +Paralell printer / User port. +The Nimbus paralell printer port card is almost identical to the circuit +in the BBC micro, so I have borrowed the driver code from the BBC :) + +Port A output is buffered before being connected to the printer connector. +This means that they can only be operated as output lines. +CA1 is pulled high by a 4K7 resistor. CA1 normally acts as an acknowledge +line when a printer is used. CA2 is buffered so that it has become an open +collector output only. It usially acts as the printer strobe line. +***********************************************************************/ + +/* USER VIA 6522 port B is connected to the BBC user port */ +WRITE8_MEMBER(rmnimbus_state::nimbus_via_write_portb) +{ +} diff --git a/src/mame/machine/rmnkbd.c b/src/mame/machine/rmnkbd.c new file mode 100644 index 00000000000..30987c6701e --- /dev/null +++ b/src/mame/machine/rmnkbd.c @@ -0,0 +1,209 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#include "machine/rmnkbd.h" + +rmnimbus_keyboard_device::rmnimbus_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : + serial_keyboard_device(mconfig, RMNIMBUS_KEYBOARD, "RM Nimbus Keyboard", tag, owner, 0, "rmnimbus_keyboard", __FILE__), + m_io_kbd8(*this, "TERM_LINE8"), + m_io_kbd9(*this, "TERM_LINE9"), + m_io_kbda(*this, "TERM_LINEA") +{ +} + +UINT8 rmnimbus_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) +{ + int i = *scan_line, j; + UINT8 code = 0, change; + + if (i == 0) code = m_io_kbd0->read(); + else + if (i == 1) code = m_io_kbd1->read(); + else + if (i == 2) code = m_io_kbd2->read(); + else + if (i == 3) code = m_io_kbd3->read(); + else + if (i == 4) code = m_io_kbd4->read(); + else + if (i == 5) code = m_io_kbd5->read(); + else + if (i == 6) code = m_io_kbd6->read(); + else + if (i == 7) code = m_io_kbd7->read(); + else + if (i == 8) code = m_io_kbd8->read(); + else + if (i == 9) code = m_io_kbd9->read(); + else + if (i == 10) code = m_io_kbda->read(); + + *scan_line = (*scan_line + 1) % 11; + code = ~code; + + if(m_state[i] == code) + return 0; + + change = (m_state[i] ^ code); + + for(j = 0; j < 8; j++) + if((change >> j) == 1) break; + + change = (1 << j); + m_state[i] ^= change; + + return ((change & code) ? 0 : 0x80) | ((i << 3) + j); +} + +static INPUT_PORTS_START( rmnimbus_keyboard ) + PORT_START("TERM_LINE0") /* Key row 0 scancodes 00..07 */ + //PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + + PORT_START("TERM_LINE1") /* Key row 1 scancodes 08..0F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) + + PORT_START("TERM_LINE2") /* Key row 2 scancodes 10..17 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') + + PORT_START("TERM_LINE3") /* Key row 3 scancodes 18..1F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0D) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) // Ether control + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + + PORT_START("TERM_LINE4") /* Key row 4 scancodes 20..27 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + + PORT_START("TERM_LINE5") /* Key row 5 scancodes 28..2F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("#") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSLASH") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TILDE") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') + + + PORT_START("TERM_LINE6") /* Key row 6 scancodes 30..37 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRSCR") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') + + PORT_START("TERM_LINE7") /* Key row 7 scancodes 38..3F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + + + PORT_START("TERM_LINE8") /* Key row 8 scancodes 40..47 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLK") PORT_CODE(KEYCODE_NUMLOCK) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SCRLK") PORT_CODE(KEYCODE_SCRLOCK) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + + PORT_START("TERM_LINE9") /* Key row 9 scancodes 48..4F */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP8") PORT_CODE(KEYCODE_8_PAD) //PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP9") PORT_CODE(KEYCODE_9_PAD) //PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP-") PORT_CODE(KEYCODE_MINUS_PAD) //PORT_CHAR('-') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP4") PORT_CODE(KEYCODE_4_PAD) //PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) //PORT_CHAR('5') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) //PORT_CHAR('6') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) //PORT_CHAR('+') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) //PORT_CHAR('1') + + PORT_START("TERM_LINEA") /* Key row 10 scancodes 50..57 */ + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP2") PORT_CODE(KEYCODE_2_PAD) //PORT_CHAR('2') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP3") PORT_CODE(KEYCODE_3_PAD) //PORT_CHAR('3') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP0") PORT_CODE(KEYCODE_0_PAD) //PORT_CHAR('0') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP.") PORT_CODE(KEYCODE_DEL_PAD) //PORT_CHAR('.') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + //PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') + //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') + //PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') + //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') + + PORT_START("TERM_LINEC") + + PORT_START("RS232_TXBAUD") + PORT_CONFNAME(0xff, RS232_BAUD_9600, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_BAUD_9600, "9600") + + PORT_START("RS232_STARTBITS") + PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STARTBITS_1, "1") + + PORT_START("RS232_DATABITS") + PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_DATABITS_8, "8") + + PORT_START("RS232_PARITY") + PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_PARITY_NONE, "None") + + PORT_START("RS232_STOPBITS") + PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STOPBITS_1, "1") +INPUT_PORTS_END + +ioport_constructor rmnimbus_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(rmnimbus_keyboard); +} + +void rmnimbus_keyboard_device::device_start() +{ + serial_keyboard_device::device_start(); + memset(m_state, '\0', sizeof(m_state)); +} + +const device_type RMNIMBUS_KEYBOARD = &device_creator; diff --git a/src/mame/machine/rmnkbd.h b/src/mame/machine/rmnkbd.h new file mode 100644 index 00000000000..2c299f19b15 --- /dev/null +++ b/src/mame/machine/rmnkbd.h @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:Carl +#ifndef RMNKBD_H_ +#define RMNKBD_H_ + +#include "bus/rs232/keyboard.h" + +class rmnimbus_keyboard_device : public serial_keyboard_device +{ +public: + rmnimbus_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ioport_constructor device_input_ports() const; + +protected: + virtual void device_start(); + +private: + virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); + + required_ioport m_io_kbd8; + required_ioport m_io_kbd9; + required_ioport m_io_kbda; + UINT8 m_state[11]; +}; + +extern const device_type RMNIMBUS_KEYBOARD; + +#endif /* RMNKBD_H_ */ diff --git a/src/mame/machine/rx01.c b/src/mame/machine/rx01.c new file mode 100644 index 00000000000..e916be7a1fb --- /dev/null +++ b/src/mame/machine/rx01.c @@ -0,0 +1,260 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/********************************************************************** + + DEC RX01 floppy drive controller + +**********************************************************************/ + +/* + + TODO: + - Create also unibus and qbus devices that contain this controller on them +*/ + +#include "emu.h" +#include "machine/rx01.h" +#include "formats/basicdsk.h" + +static LEGACY_FLOPPY_OPTIONS_START( rx01 ) + LEGACY_FLOPPY_OPTION(rx01, "img", "RX01 image", basicdsk_identify_default, basicdsk_construct_default, NULL, + HEADS([1]) + TRACKS([77]) + SECTORS([26]) + SECTOR_LENGTH([128]) + FIRST_SECTOR_ID([1])) +LEGACY_FLOPPY_OPTIONS_END + + +static const floppy_interface rx01_floppy_interface = +{ + FLOPPY_STANDARD_8_SSSD, + LEGACY_FLOPPY_OPTIONS_NAME(rx01), + "floppy_8" +}; + + +MACHINE_CONFIG_FRAGMENT( rx01 ) + MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(rx01_floppy_interface) +MACHINE_CONFIG_END + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type RX01 = &device_creator; + +//------------------------------------------------- +// rx01_device - constructor +//------------------------------------------------- + +rx01_device::rx01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, RX01, "RX01", tag, owner, clock, "rx01", __FILE__) +{ +} + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor rx01_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( rx01 ); +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void rx01_device::device_start() +{ + m_image[0] = subdevice(FLOPPY_0); + m_image[1] = subdevice(FLOPPY_1); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void rx01_device::device_reset() +{ + for(int i=0;i<2;i++) + { + m_image[i]->floppy_mon_w(0); // turn it on + m_image[i]->floppy_drive_set_controller(this); + m_image[i]->floppy_drive_set_rpm(360.); + } + m_rxes = 0; + m_rxcs = 0; + m_rxdb = 0; +} + +//------------------------------------------------- +// read +//------------------------------------------------- + +READ16_MEMBER( rx01_device::read ) +{ + switch(offset & 1) { + case 0: return status_read(); + default: return data_read(); + } + +} + + +//------------------------------------------------- +// write +//------------------------------------------------- + +WRITE16_MEMBER( rx01_device::write ) +{ + switch(offset & 1) { + case 0: command_write(data); break; + case 1: data_write(data); break; + } +} + +void rx01_device::command_write(UINT16 data) +{ + printf("command_write %04x\n",data); + m_unit = BIT(data,4); + m_interrupt = BIT(data,6); + + m_image[m_unit]->floppy_drive_set_ready_state(1,0); + + + if (BIT(data,14)) // Initialize + { + printf("initialize\n"); + m_state = RX01_INIT; + } + else if (BIT(data,1)) // If GO bit is selected + { + m_rxcs &= ~(1<<5); // Clear done bit + m_buf_pos = 0; // Point to start of buffer + switch((data >> 1) & 7) { + case 0: // Fill Buffer + m_rxcs |= (1<<7); // Set TR Bit + m_state = RX01_FILL; + break; + case 1: // Empty Buffer + m_state = RX01_EMPTY; + break; + case 2: // Write Sector + case 3: // Read Sector + case 6: // Write Deleted Data Sector + m_rxes &= ~(1<<6 | 1<<1 | 1<<0);// Reset bits 0, 1 and 6 + m_state = RX01_SET_SECTOR; + break; + case 4: // Not Used + m_state = RX01_COMPLETE; + break; + case 5: // Read Status + m_state = RX01_COMPLETE; + m_rxdb = m_rxes; + break; + case 7: // Read Error Register + m_state = RX01_COMPLETE; + // set ready signal according to current drive status + m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7; + break; + } + } + machine().scheduler().timer_set(attotime::from_msec(100), FUNC(command_execution_callback), 0, this); +} + +UINT16 rx01_device::status_read() +{ + //printf("status_read %04x\n",m_rxcs); + return m_rxcs; +} + +void rx01_device::data_write(UINT16 data) +{ +// printf("data_write %04x\n",data); + // data can be written only if TR is set + if (BIT(m_rxcs,7)) m_rxdb = data; + machine().scheduler().timer_set(attotime::from_msec(100), FUNC(command_execution_callback), 0, this); +} + +UINT16 rx01_device::data_read() +{ + if (m_state==RX01_EMPTY && BIT(m_rxcs,7)) m_rxcs &= (1<<7); // clear TR bit; +// printf("data_read %04x\n",m_rxdb); + return m_rxdb; +} + +void rx01_device::service_command() +{ + printf("service_command %d\n",m_state); + m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7; + switch(m_state) { + case RX01_FILL : + m_buffer[m_buf_pos] = m_rxdb & 0xff; + m_buf_pos++; + if (m_buf_pos<128) + { + m_rxcs |= (1<<7); // Set TR Bit + } else { + //finished + } + break; + case RX01_EMPTY : + if (m_buf_pos>=128) + { + //finished + } else { + m_buffer[m_buf_pos] = m_rxdb & 0xff; + m_buf_pos++; + m_rxcs |= (1<<7); // Set TR Bit + } + break; + case RX01_SET_SECTOR: + m_rxsa = m_rxdb & 0x1f; + m_rxcs |= (1<<7); // Set TR Bit + m_state = RX01_SET_TRACK; + break; + case RX01_SET_TRACK: + m_rxta = m_rxdb & 0x7f; + m_rxcs |= (1<<7); // Set TR Bit + m_state = RX01_TRANSFER; + position_head(); + break; + case RX01_TRANSFER: + break; + case RX01_COMPLETE: + break; + case RX01_INIT: + m_rxes |= (1<<2); // Set init done flag + m_rxcs |= (1<<5); // Set operation done + break; + } +} + +void rx01_device::position_head() +{ + int cur_track = m_image[m_unit]->floppy_drive_get_current_track(); + int dir = (cur_track < m_rxta) ? +1 : -1; + + while (m_rxta != cur_track) + { + cur_track += dir; + + m_image[m_unit]->floppy_drive_seek(dir); + } +} + +void rx01_device::read_sector() +{ + /* read data */ + m_image[m_unit]->floppy_drive_read_sector_data(0, m_rxsa, (char *)m_buffer, 128); +} + +void rx01_device::write_sector(int ddam) +{ + /* write data */ + m_image[m_unit]->floppy_drive_write_sector_data(0, m_rxsa, (char *)m_buffer, 128, ddam); +} diff --git a/src/mame/machine/rx01.h b/src/mame/machine/rx01.h new file mode 100644 index 00000000000..577fb92b5f4 --- /dev/null +++ b/src/mame/machine/rx01.h @@ -0,0 +1,85 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/********************************************************************** + + DEC RX01 floppy drive controller + +**********************************************************************/ + +#pragma once + +#ifndef __RX01__ +#define __RX01__ + +#include "imagedev/flopdrv.h" + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_RX01_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, RX01, 0) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> rx01_device + +class rx01_device : public device_t +{ +public: + // construction/destruction + rx01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ16_MEMBER( read ); + DECLARE_WRITE16_MEMBER( write ); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + void command_write(UINT16 data); + UINT16 status_read(); + + void data_write(UINT16 data); + UINT16 data_read(); + + void service_command(); + static TIMER_CALLBACK( command_execution_callback ) { reinterpret_cast(ptr)->service_command(); } + + void position_head(); + void read_sector(); + void write_sector(int ddam); +private: + enum rx01_state { + RX01_FILL, + RX01_EMPTY, + RX01_SET_SECTOR, + RX01_SET_TRACK, + RX01_TRANSFER, + RX01_COMPLETE, + RX01_INIT + }; + + legacy_floppy_image_device *m_image[2]; + UINT8 m_buffer[128]; + int m_buf_pos; + + UINT16 m_rxcs; // Command and Status Register + UINT16 m_rxdb; // Data Buffer Register + UINT16 m_rxta; // RX Track Address + UINT16 m_rxsa; // RX Sector Address + UINT16 m_rxes; // RX Error and Status + int m_unit; + int m_interrupt; + rx01_state m_state; +}; + +// device type definition +extern const device_type RX01; + +#endif diff --git a/src/mame/machine/samcoupe.c b/src/mame/machine/samcoupe.c new file mode 100644 index 00000000000..682d81d906c --- /dev/null +++ b/src/mame/machine/samcoupe.c @@ -0,0 +1,336 @@ +// license:GPL-2.0+ +// copyright-holders:Lee Hammerton, Dirk Best +/*************************************************************************** + + Miles Gordon Technology SAM Coupe + +***************************************************************************/ + +#include "emu.h" +#include "includes/samcoupe.h" + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define LMPR_RAM0 0x20 /* If bit set ram is paged into bank 0, else its rom0 */ +#define LMPR_ROM1 0x40 /* If bit set rom1 is paged into bank 3, else its ram */ +#define HMPR_MCNTRL 0x80 /* If set external RAM is enabled */ + + +/*************************************************************************** + MEMORY BANKING +***************************************************************************/ + +READ8_MEMBER(samcoupe_state::sam_bank1_r) +{ + if (sam_bank_read_ptr[0]) + return sam_bank_read_ptr[0][offset]; + + return 0xff; +} + +WRITE8_MEMBER(samcoupe_state::sam_bank1_w) +{ + if (sam_bank_write_ptr[0]) + sam_bank_write_ptr[0][offset] = data; +} + + +READ8_MEMBER(samcoupe_state::sam_bank2_r) +{ + if (sam_bank_read_ptr[1]) + return sam_bank_read_ptr[1][offset]; + + return 0xff; +} + +WRITE8_MEMBER(samcoupe_state::sam_bank2_w) +{ + if (sam_bank_write_ptr[1]) + sam_bank_write_ptr[1][offset] = data; +} + + +READ8_MEMBER(samcoupe_state::sam_bank3_r) +{ + if (sam_bank_read_ptr[2]) + return sam_bank_read_ptr[2][offset]; + + return 0xff; +} + +WRITE8_MEMBER(samcoupe_state::sam_bank3_w) +{ + if (sam_bank_write_ptr[2]) + sam_bank_write_ptr[2][offset] = data; +} + + +READ8_MEMBER(samcoupe_state::sam_bank4_r) +{ + if (sam_bank_read_ptr[3]) + return sam_bank_read_ptr[3][offset]; + + return 0xff; +} + +WRITE8_MEMBER(samcoupe_state::sam_bank4_w) +{ + if (sam_bank_write_ptr[3]) + sam_bank_write_ptr[3][offset] = data; +} + +void samcoupe_state::samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memory, int is_readonly) +{ + sam_bank_read_ptr[bank_num-1] = memory; + if (!is_readonly) + sam_bank_write_ptr[bank_num-1] = memory; + else + sam_bank_write_ptr[bank_num-1] = NULL; + + // installing banks on the fly is too slow (20% speed in Manic Miner gameplay vs 300% speed) +#if 0 + char bank[10]; + sprintf(bank,"bank%d",bank_num); + if (memory) + { + membank(bank)->set_base(memory); + space.install_read_bank (((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF, bank); + if (is_readonly) { + space.unmap_write(((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF); + } else { + space.install_write_bank(((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF, bank); + } + } else { + space.nop_readwrite(((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF); + } +#endif +} + + +void samcoupe_state::samcoupe_install_ext_mem(address_space &space) +{ + UINT8 *mem; + + /* bank 3 */ + if (m_lext >> 6 < m_ram->size() >> 20) + mem = &m_ram->pointer()[(m_ram->size() & 0xfffff) + (m_lext >> 6) * 0x100000 + (m_lext & 0x3f) * 0x4000]; + else + mem = NULL; + + samcoupe_update_bank(space, 3, mem, FALSE); + + /* bank 4 */ + if (m_hext >> 6 < m_ram->size() >> 20) + mem = &m_ram->pointer()[(m_ram->size() & 0xfffff) + (m_hext >> 6) * 0x100000 + (m_hext & 0x3f) * 0x4000]; + else + mem = NULL; + + samcoupe_update_bank(space, 4, mem, FALSE); +} + + +void samcoupe_state::samcoupe_update_memory(address_space &space) +{ + const int PAGE_MASK = ((m_ram->size() & 0xfffff) / 0x4000) - 1; + UINT8 *rom = m_region_maincpu->base(); + UINT8 *memory; + int is_readonly; + + /* BANK1 */ + if (m_lmpr & LMPR_RAM0) /* Is ram paged in at bank 1 */ + { + if ((m_lmpr & 0x1F) <= PAGE_MASK) + memory = &m_ram->pointer()[(m_lmpr & PAGE_MASK) * 0x4000]; + else + memory = NULL; /* Attempt to page in non existant ram region */ + is_readonly = FALSE; + } + else + { + memory = rom; /* Rom0 paged in */ + is_readonly = TRUE; + } + samcoupe_update_bank(space, 1, memory, is_readonly); + + + /* BANK2 */ + if (((m_lmpr + 1) & 0x1f) <= PAGE_MASK) + memory = &m_ram->pointer()[((m_lmpr + 1) & PAGE_MASK) * 0x4000]; + else + memory = NULL; /* Attempt to page in non existant ram region */ + samcoupe_update_bank(space, 2, memory, FALSE); + + /* only update bank 3 and 4 when external memory is not enabled */ + if (m_hmpr & HMPR_MCNTRL) + { + samcoupe_install_ext_mem(space); + } + else + { + /* BANK3 */ + if ((m_hmpr & 0x1F) <= PAGE_MASK ) + memory = &m_ram->pointer()[(m_hmpr & PAGE_MASK)*0x4000]; + else + memory = NULL; /* Attempt to page in non existant ram region */ + samcoupe_update_bank(space, 3, memory, FALSE); + + + /* BANK4 */ + if (m_lmpr & LMPR_ROM1) /* Is Rom1 paged in at bank 4 */ + { + memory = rom + 0x4000; + is_readonly = TRUE; + } + else + { + if (((m_hmpr + 1) & 0x1f) <= PAGE_MASK) + memory = &m_ram->pointer()[((m_hmpr + 1) & PAGE_MASK) * 0x4000]; + else + memory = NULL; /* Attempt to page in non existant ram region */ + is_readonly = FALSE; + } + samcoupe_update_bank(space, 4, memory, FALSE); + } + + /* video memory location */ + if (m_vmpr & 0x40) /* if bit set in 2 bank screen mode */ + m_videoram = &m_ram->pointer()[((m_vmpr & 0x1e) & PAGE_MASK) * 0x4000]; + else + m_videoram = &m_ram->pointer()[((m_vmpr & 0x1f) & PAGE_MASK) * 0x4000]; +} + + +WRITE8_MEMBER(samcoupe_state::samcoupe_ext_mem_w) +{ + address_space &space_program = m_maincpu->space(AS_PROGRAM); + + if (offset & 1) + m_hext = data; + else + m_lext = data; + + /* external RAM enabled? */ + if (m_hmpr & HMPR_MCNTRL) + { + samcoupe_install_ext_mem(space_program); + } +} + + +/*************************************************************************** + REAL TIME CLOCK +***************************************************************************/ + +READ8_MEMBER(samcoupe_state::samcoupe_rtc_r) +{ + address_space &spaceio = m_maincpu->space(AS_IO); + return m_rtc->read(spaceio, offset >> 12); +} + + +WRITE8_MEMBER(samcoupe_state::samcoupe_rtc_w) +{ + address_space &spaceio = m_maincpu->space(AS_IO); + m_rtc->write(spaceio, offset >> 12, data); +} + + +/*************************************************************************** + MOUSE +***************************************************************************/ + +TIMER_CALLBACK_MEMBER(samcoupe_state::samcoupe_mouse_reset) +{ + m_mouse_index = 0; +} + +UINT8 samcoupe_state::samcoupe_mouse_r() +{ + UINT8 result; + + /* on a read, reset the timer */ + m_mouse_reset->adjust(attotime::from_usec(50)); + + /* update when we are about to read the first real values */ + if (m_mouse_index == 2) + { + /* update values */ + int mouse_x = m_io_mouse_x->read(); + int mouse_y = m_io_mouse_y->read(); + + int mouse_dx = m_mouse_x - mouse_x; + int mouse_dy = m_mouse_y - mouse_y; + + m_mouse_x = mouse_x; + m_mouse_y = mouse_y; + + /* button state */ + m_mouse_data[2] = m_mouse_buttons->read(); + + /* y-axis */ + m_mouse_data[3] = (mouse_dy & 0xf00) >> 8; + m_mouse_data[4] = (mouse_dy & 0x0f0) >> 4; + m_mouse_data[5] = (mouse_dy & 0x00f) >> 0; + + /* x-axis */ + m_mouse_data[6] = (mouse_dx & 0xf00) >> 8; + m_mouse_data[7] = (mouse_dx & 0x0f0) >> 4; + m_mouse_data[8] = (mouse_dx & 0x00f) >> 0; + } + + /* get current value */ + result = m_mouse_data[m_mouse_index++]; + + /* reset if we are at the end */ + if (m_mouse_index == sizeof(m_mouse_data)) + m_mouse_index = 1; + + return result; +} + +void samcoupe_state::machine_start() +{ + m_mouse_reset = timer_alloc(TIMER_MOUSE_RESET); + + /* schedule our video updates */ + m_video_update_timer = timer_alloc(TIMER_VIDEO_UPDATE); + m_video_update_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); +} + +/*************************************************************************** + RESET +***************************************************************************/ + +void samcoupe_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + address_space &spaceio = m_maincpu->space(AS_IO); + + /* initialize state */ + m_lmpr = 0x0f; /* ROM0 paged in, ROM1 paged out RAM Banks */ + m_hmpr = 0x01; + m_vmpr = 0x81; + m_line_int = 0xff; /* line interrupts disabled */ + m_status = 0x1f; /* no interrupts active */ + + /* initialize mouse */ + m_mouse_index = 0; + m_mouse_data[0] = 0xff; + m_mouse_data[1] = 0xff; + + if (m_config->read() & 0x01) + { + /* install RTC */ + spaceio.install_readwrite_handler(0xef, 0xef, 0xffff, 0xff00, read8_delegate(FUNC(samcoupe_state::samcoupe_rtc_r),this), write8_delegate(FUNC(samcoupe_state::samcoupe_rtc_w),this)); + } + else + { + /* no RTC support */ + spaceio.unmap_readwrite(0xef, 0xef, 0xffff, 0xff00); + } + + /* initialize memory */ + samcoupe_update_memory(space); +} diff --git a/src/mame/machine/sgi.c b/src/mame/machine/sgi.c new file mode 100644 index 00000000000..797f27eb58b --- /dev/null +++ b/src/mame/machine/sgi.c @@ -0,0 +1,562 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/********************************************************************* + + sgi.c + + Silicon Graphics MC (Memory Controller) code + +*********************************************************************/ + +#include "emu.h" +#include "sgi.h" + +#define VERBOSE_LEVEL ( 2 ) + +#if 0 +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... ) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%08x: %s", (unsigned) machine.device("maincpu")->safe_pc(), buf ); + } +} +#endif + +const device_type SGI_MC = &device_creator; + +sgi_mc_device::sgi_mc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SGI_MC, "SGI Memory Controller", tag, owner, clock, "sgi_mc", __FILE__), + m_tUpdateTimer(NULL), + m_nCPUControl0(0), + m_nCPUControl1(0), + m_nWatchdog(0), + m_nSysID(0), + m_nRPSSDiv(0), + m_nRefCntPreload(0), + m_nRefCnt(0), + m_nGIO64ArbParam(0), + m_nArbCPUTime(0), + m_nArbBurstTime(0), + m_nMemCfg0(0), + m_nMemCfg1(0), + m_nCPUMemAccCfg(0), + m_nGIOMemAccCfg(0), + m_nCPUErrorAddr(0), + m_nCPUErrorStatus(0), + m_nGIOErrorAddr(0), + m_nGIOErrorStatus(0), + m_nSysSemaphore(0), + m_nGIOLock(0), + m_nEISALock(0), + m_nGIO64TransMask(0), + m_nGIO64Subst(0), + m_nDMAIntrCause(0), + m_nDMAControl(0), + m_nDMATLBEntry0Hi(0), + m_nDMATLBEntry0Lo(0), + m_nDMATLBEntry1Hi(0), + m_nDMATLBEntry1Lo(0), + m_nDMATLBEntry2Hi(0), + m_nDMATLBEntry2Lo(0), + m_nDMATLBEntry3Hi(0), + m_nDMATLBEntry3Lo(0), + m_nRPSSCounter(0), + m_nDMAMemAddr(0), + m_nDMALineCntWidth(0), + m_nDMALineZoomStride(0), + m_nDMAGIO64Addr(0), + m_nDMAMode(0), + m_nDMAZoomByteCnt(0), + m_nDMARunning(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sgi_mc_device::device_start() +{ + // if Indigo2, ID appropriately + if (!strcmp(machine().system().name, "ip244415")) + { + m_nSysID = 0x11; // rev. B MC, EISA bus present + } + + timer_init(); + + save_item(NAME(m_nCPUControl0)); + save_item(NAME(m_nCPUControl1)); + save_item(NAME(m_nWatchdog)); + save_item(NAME(m_nSysID)); + save_item(NAME(m_nRPSSDiv)); + save_item(NAME(m_nRefCntPreload)); + save_item(NAME(m_nRefCnt)); + save_item(NAME(m_nGIO64ArbParam)); + save_item(NAME(m_nArbCPUTime)); + save_item(NAME(m_nArbBurstTime)); + save_item(NAME(m_nMemCfg0)); + save_item(NAME(m_nMemCfg1)); + save_item(NAME(m_nCPUMemAccCfg)); + save_item(NAME(m_nGIOMemAccCfg)); + save_item(NAME(m_nCPUErrorAddr)); + save_item(NAME(m_nCPUErrorStatus)); + save_item(NAME(m_nGIOErrorAddr)); + save_item(NAME(m_nGIOErrorStatus)); + save_item(NAME(m_nSysSemaphore)); + save_item(NAME(m_nGIOLock)); + save_item(NAME(m_nEISALock)); + save_item(NAME(m_nGIO64TransMask)); + save_item(NAME(m_nGIO64Subst)); + save_item(NAME(m_nDMAIntrCause)); + save_item(NAME(m_nDMAControl)); + save_item(NAME(m_nDMATLBEntry0Hi)); + save_item(NAME(m_nDMATLBEntry0Lo)); + save_item(NAME(m_nDMATLBEntry1Hi)); + save_item(NAME(m_nDMATLBEntry1Lo)); + save_item(NAME(m_nDMATLBEntry2Hi)); + save_item(NAME(m_nDMATLBEntry2Lo)); + save_item(NAME(m_nDMATLBEntry3Hi)); + save_item(NAME(m_nDMATLBEntry3Lo)); + save_item(NAME(m_nRPSSCounter)); + save_item(NAME(m_nDMAMemAddr)); + save_item(NAME(m_nDMALineCntWidth)); + save_item(NAME(m_nDMALineZoomStride)); + save_item(NAME(m_nDMAGIO64Addr)); + save_item(NAME(m_nDMAMode)); + save_item(NAME(m_nDMAZoomByteCnt)); + save_item(NAME(m_nDMARunning)); +} + +READ32_MEMBER( sgi_mc_device::read ) +{ + offset <<= 2; + switch( offset ) + { + case 0x0000: + case 0x0004: + //verboselog( space.machine(), 3, "CPU Control 0 Read: %08x (%08x)\n", m_nCPUControl0, mem_mask ); + return m_nCPUControl0; + case 0x0008: + case 0x000c: + //verboselog( space.machine(), 2, "CPU Control 1 Read: %08x (%08x)\n", m_nCPUControl1, mem_mask ); + return m_nCPUControl1; + case 0x0010: + case 0x0014: + //verboselog( space.machine(), 2, "Watchdog Timer Read: %08x (%08x)\n", m_nWatchdog, mem_mask ); + return m_nWatchdog; + case 0x0018: + case 0x001c: + //verboselog( space.machine(), 2, "System ID Read: %08x (%08x)\n", m_nSysID, mem_mask ); + return m_nSysID; + case 0x0028: + case 0x002c: + //verboselog( space.machine(), 2, "RPSS Divider Read: %08x (%08x)\n", m_nRPSSDiv, mem_mask ); + return m_nRPSSDiv; + case 0x0030: + case 0x0034: + //verboselog( space.machine(), 2, "R4000 EEPROM Read\n" ); + return 0; + case 0x0040: + case 0x0044: + //verboselog( space.machine(), 2, "Refresh Count Preload Read: %08x (%08x)\n", m_nRefCntPreload, mem_mask ); + return m_nRefCntPreload; + case 0x0048: + case 0x004c: + //verboselog( space.machine(), 2, "Refresh Count Read: %08x (%08x)\n", m_nRefCnt, mem_mask ); + return m_nRefCnt; + case 0x0080: + case 0x0084: + //verboselog( space.machine(), 2, "GIO64 Arbitration Param Read: %08x (%08x)\n", m_nGIO64ArbParam, mem_mask ); + return m_nGIO64ArbParam; + case 0x0088: + case 0x008c: + //verboselog( space.machine(), 2, "Arbiter CPU Time Read: %08x (%08x)\n", m_nArbCPUTime, mem_mask ); + return m_nArbCPUTime; + case 0x0098: + case 0x009c: + //verboselog( space.machine(), 2, "Arbiter Long Burst Time Read: %08x (%08x)\n", m_nArbBurstTime, mem_mask ); + return m_nArbBurstTime; + case 0x00c0: + case 0x00c4: + //verboselog( space.machine(), 3, "Memory Configuration Register 0 Read: %08x (%08x)\n", m_nMemCfg0, mem_mask ); + return m_nMemCfg0; + case 0x00c8: + case 0x00cc: + //verboselog( space.machine(), 3, "Memory Configuration Register 1 Read: %08x (%08x)\n", m_nMemCfg1, mem_mask ); + return m_nMemCfg1; + case 0x00d0: + case 0x00d4: + //verboselog( space.machine(), 2, "CPU Memory Access Config Params Read: %08x (%08x)\n", m_nCPUMemAccCfg, mem_mask ); + return m_nCPUMemAccCfg; + case 0x00d8: + case 0x00dc: + //verboselog( space.machine(), 2, "GIO Memory Access Config Params Read: %08x (%08x)\n", m_nGIOMemAccCfg, mem_mask ); + return m_nGIOMemAccCfg; + case 0x00e0: + case 0x00e4: + //verboselog( space.machine(), 2, "CPU Error Address Read: %08x (%08x)\n", m_nCPUErrorAddr, mem_mask ); + return m_nCPUErrorAddr; + case 0x00e8: + case 0x00ec: + //verboselog( space.machine(), 2, "CPU Error Status Read: %08x (%08x)\n", m_nCPUErrorStatus, mem_mask ); + return m_nCPUErrorStatus; + case 0x00f0: + case 0x00f4: + //verboselog( space.machine(), 2, "GIO Error Address Read: %08x (%08x)\n", m_nGIOErrorAddr, mem_mask ); + return m_nGIOErrorAddr; + case 0x00f8: + case 0x00fc: + //verboselog( space.machine(), 2, "GIO Error Status Read: %08x (%08x)\n", m_nGIOErrorStatus, mem_mask ); + return m_nGIOErrorStatus; + case 0x0100: + case 0x0104: + //verboselog( space.machine(), 2, "System Semaphore Read: %08x (%08x)\n", m_nSysSemaphore, mem_mask ); + return m_nSysSemaphore; + case 0x0108: + case 0x010c: + //verboselog( space.machine(), 2, "GIO Lock Read: %08x (%08x)\n", m_nGIOLock, mem_mask ); + return m_nGIOLock; + case 0x0110: + case 0x0114: + //verboselog( space.machine(), 2, "EISA Lock Read: %08x (%08x)\n", m_nEISALock, mem_mask ); + return m_nEISALock; + case 0x0150: + case 0x0154: + //verboselog( space.machine(), 2, "GIO64 Translation Address Mask Read: %08x (%08x)\n", m_nGIO64TransMask, mem_mask ); + return m_nGIO64TransMask; + case 0x0158: + case 0x015c: + //verboselog( space.machine(), 2, "GIO64 Translation Address Substitution Bits Read: %08x (%08x)\n", m_nGIO64Subst, mem_mask ); + return m_nGIO64Subst; + case 0x0160: + case 0x0164: + //verboselog( space.machine(), 2, "DMA Interrupt Cause: %08x (%08x)\n", m_nDMAIntrCause, mem_mask ); + return m_nDMAIntrCause; + case 0x0168: + case 0x016c: + //verboselog( space.machine(), 2, "DMA Control Read: %08x (%08x)\n", m_nDMAControl, mem_mask ); + return m_nDMAControl; + case 0x0180: + case 0x0184: + //verboselog( space.machine(), 2, "DMA TLB Entry 0 High Read: %08x (%08x)\n", m_nDMATLBEntry0Hi, mem_mask ); + return m_nDMATLBEntry0Hi; + case 0x0188: + case 0x018c: + //verboselog( space.machine(), 2, "DMA TLB Entry 0 Low Read: %08x (%08x)\n", m_nDMATLBEntry0Lo, mem_mask ); + return m_nDMATLBEntry0Lo; + case 0x0190: + case 0x0194: + //verboselog( space.machine(), 2, "DMA TLB Entry 1 High Read: %08x (%08x)\n", m_nDMATLBEntry1Hi, mem_mask ); + return m_nDMATLBEntry1Hi; + case 0x0198: + case 0x019c: + //verboselog( space.machine(), 2, "DMA TLB Entry 1 Low Read: %08x (%08x)\n", m_nDMATLBEntry1Lo, mem_mask ); + return m_nDMATLBEntry1Lo; + case 0x01a0: + case 0x01a4: + //verboselog( space.machine(), 2, "DMA TLB Entry 2 High Read: %08x (%08x)\n", m_nDMATLBEntry2Hi, mem_mask ); + return m_nDMATLBEntry2Hi; + case 0x01a8: + case 0x01ac: + //verboselog( space.machine(), 2, "DMA TLB Entry 2 Low Read: %08x (%08x)\n", m_nDMATLBEntry2Lo, mem_mask ); + return m_nDMATLBEntry2Lo; + case 0x01b0: + case 0x01b4: + //verboselog( space.machine(), 2, "DMA TLB Entry 3 High Read: %08x (%08x)\n", m_nDMATLBEntry3Hi, mem_mask ); + return m_nDMATLBEntry3Hi; + case 0x01b8: + case 0x01bc: + //verboselog( space.machine(), 2, "DMA TLB Entry 3 Low Read: %08x (%08x)\n", m_nDMATLBEntry3Lo, mem_mask ); + return m_nDMATLBEntry3Lo; + case 0x1000: + case 0x1004: + //verboselog( space.machine(), 2, "RPSS 100ns Counter Read: %08x (%08x)\n", m_nRPSSCounter, mem_mask ); + return m_nRPSSCounter; + case 0x2000: + case 0x2004: + case 0x2008: + case 0x200c: + //verboselog( space.machine(), 0, "DMA Memory Address Read: %08x (%08x)\n", m_nDMAMemAddr, mem_mask ); + return m_nDMAMemAddr; + case 0x2010: + case 0x2014: + //verboselog( space.machine(), 0, "DMA Line Count and Width Read: %08x (%08x)\n", m_nDMALineCntWidth, mem_mask ); + return m_nDMALineCntWidth; + case 0x2018: + case 0x201c: + //verboselog( space.machine(), 0, "DMA Line Zoom and Stride Read: %08x (%08x)\n", m_nDMALineZoomStride, mem_mask ); + return m_nDMALineZoomStride; + case 0x2020: + case 0x2024: + case 0x2028: + case 0x202c: + //verboselog( space.machine(), 0, "DMA GIO64 Address Read: %08x (%08x)\n", m_nDMAGIO64Addr, mem_mask ); + return m_nDMAGIO64Addr; + case 0x2030: + case 0x2034: + //verboselog( space.machine(), 0, "DMA Mode Write: %08x (%08x)\n", m_nDMAMode, mem_mask ); + return m_nDMAMode; + case 0x2038: + case 0x203c: + //verboselog( space.machine(), 0, "DMA Zoom Count Read: %08x (%08x)\n", m_nDMAZoomByteCnt, mem_mask ); + return m_nDMAZoomByteCnt; +// case 0x2040: +// case 0x2044: +// //verboselog( space.machine(), 2, "DMA Start Write: %08x (%08x)\n", data, mem_mask ); + // Start DMA +// m_nDMARunning = 1; +// break; + case 0x2048: + case 0x204c: + //verboselog( space.machine(), 0, "VDMA Running Read: %08x (%08x)\n", m_nDMARunning, mem_mask ); + if( m_nDMARunning == 1 ) + { + m_nDMARunning = 0; + return 0x00000040; + } + else + { + return 0; + } + } + //verboselog( space.machine(), 0, "Unmapped MC read: 0x%08x (%08x)\n", 0x1fa00000 + offset, mem_mask ); + return 0; +} + +WRITE32_MEMBER( sgi_mc_device::write ) +{ + offset <<= 2; + switch( offset ) + { + case 0x0000: + case 0x0004: + //verboselog( space.machine(), 2, "CPU Control 0 Write: %08x (%08x)\n", data, mem_mask ); + m_nCPUControl0 = data; + break; + case 0x0008: + case 0x000c: + //verboselog( space.machine(), 2, "CPU Control 1 Write: %08x (%08x)\n", data, mem_mask ); + m_nCPUControl1 = data; + break; + case 0x0010: + case 0x0014: + //verboselog( space.machine(), 2, "Watchdog Timer Clear" ); + m_nWatchdog = 0; + break; + case 0x0028: + case 0x002c: + //verboselog( space.machine(), 2, "RPSS Divider Write: %08x (%08x)\n", data, mem_mask ); + m_nRPSSDiv = data; + break; + case 0x0030: + case 0x0034: + //verboselog( space.machine(), 2, "R4000 EEPROM Write\n" ); + break; + case 0x0040: + case 0x0044: + //verboselog( space.machine(), 2, "Refresh Count Preload Write: %08x (%08x)\n", data, mem_mask ); + m_nRefCntPreload = data; + break; + case 0x0080: + case 0x0084: + //verboselog( space.machine(), 2, "GIO64 Arbitration Param Write: %08x (%08x)\n", data, mem_mask ); + m_nGIO64ArbParam = data; + break; + case 0x0088: + case 0x008c: + //verboselog( space.machine(), 3, "Arbiter CPU Time Write: %08x (%08x)\n", data, mem_mask ); + m_nArbCPUTime = data; + break; + case 0x0098: + case 0x009c: + //verboselog( space.machine(), 3, "Arbiter Long Burst Time Write: %08x (%08x)\n", data, mem_mask ); + m_nArbBurstTime = data; + break; + case 0x00c0: + case 0x00c4: + //verboselog( space.machine(), 3, "Memory Configuration Register 0 Write: %08x (%08x)\n", data, mem_mask ); + m_nMemCfg0 = data; + break; + case 0x00c8: + case 0x00cc: + //verboselog( space.machine(), 3, "Memory Configuration Register 1 Write: %08x (%08x)\n", data, mem_mask ); + m_nMemCfg1 = data; + break; + case 0x00d0: + case 0x00d4: + //verboselog( space.machine(), 2, "CPU Memory Access Config Params Write: %08x (%08x)\n", data, mem_mask ); + m_nCPUMemAccCfg = data; + break; + case 0x00d8: + case 0x00dc: + //verboselog( space.machine(), 2, "GIO Memory Access Config Params Write: %08x (%08x)\n", data, mem_mask ); + m_nGIOMemAccCfg = data; + break; + case 0x00e8: + case 0x00ec: + //verboselog( space.machine(), 2, "CPU Error Status Clear\n" ); + m_nCPUErrorStatus = 0; + break; + case 0x00f8: + case 0x00fc: + //verboselog( space.machine(), 2, "GIO Error Status Clear\n" ); + m_nGIOErrorStatus = 0; + break; + case 0x0100: + case 0x0104: + //verboselog( space.machine(), 2, "System Semaphore Write: %08x (%08x)\n", data, mem_mask ); + m_nSysSemaphore = data; + break; + case 0x0108: + case 0x010c: + //verboselog( space.machine(), 2, "GIO Lock Write: %08x (%08x)\n", data, mem_mask ); + m_nGIOLock = data; + break; + case 0x0110: + case 0x0114: + //verboselog( space.machine(), 2, "EISA Lock Write: %08x (%08x)\n", data, mem_mask ); + m_nEISALock = data; + break; + case 0x0150: + case 0x0154: + //verboselog( space.machine(), 2, "GIO64 Translation Address Mask Write: %08x (%08x)\n", data, mem_mask ); + m_nGIO64TransMask = data; + break; + case 0x0158: + case 0x015c: + //verboselog( space.machine(), 2, "GIO64 Translation Address Substitution Bits Write: %08x (%08x)\n", data, mem_mask ); + m_nGIO64Subst = data; + break; + case 0x0160: + case 0x0164: + //verboselog( space.machine(), 0, "DMA Interrupt Cause Write: %08x (%08x)\n", data, mem_mask ); + m_nDMAIntrCause = data; + break; + case 0x0168: + case 0x016c: + //verboselog( space.machine(), 0, "DMA Control Write: %08x (%08x)\n", data, mem_mask ); + m_nDMAControl = data; + break; + case 0x0180: + case 0x0184: + //verboselog( space.machine(), 0, "DMA TLB Entry 0 High Write: %08x (%08x)\n", data, mem_mask ); + m_nDMATLBEntry0Hi = data; + break; + case 0x0188: + case 0x018c: + //verboselog( space.machine(), 0, "DMA TLB Entry 0 Low Write: %08x (%08x)\n", data, mem_mask ); + m_nDMATLBEntry0Lo = data; + break; + case 0x0190: + case 0x0194: + //verboselog( space.machine(), 0, "DMA TLB Entry 1 High Write: %08x (%08x)\n", data, mem_mask ); + m_nDMATLBEntry1Hi = data; + break; + case 0x0198: + case 0x019c: + //verboselog( space.machine(), 0, "DMA TLB Entry 1 Low Write: %08x (%08x)\n", data, mem_mask ); + m_nDMATLBEntry1Lo = data; + break; + case 0x01a0: + case 0x01a4: + //verboselog( space.machine(), 0, "DMA TLB Entry 2 High Write: %08x (%08x)\n", data, mem_mask ); + m_nDMATLBEntry2Hi = data; + break; + case 0x01a8: + case 0x01ac: + //verboselog( space.machine(), 0, "DMA TLB Entry 2 Low Write: %08x (%08x)\n", data, mem_mask ); + m_nDMATLBEntry2Lo = data; + break; + case 0x01b0: + case 0x01b4: + //verboselog( space.machine(), 0, "DMA TLB Entry 3 High Write: %08x (%08x)\n", data, mem_mask ); + m_nDMATLBEntry3Hi = data; + break; + case 0x01b8: + case 0x01bc: + //verboselog( space.machine(), 0, "DMA TLB Entry 3 Low Write: %08x (%08x)\n", data, mem_mask ); + m_nDMATLBEntry3Lo = data; + break; + case 0x2000: + case 0x2004: + //verboselog( space.machine(), 0, "DMA Memory Address Write: %08x (%08x)\n", data, mem_mask ); + m_nDMAMemAddr = data; + break; + case 0x2008: + case 0x200c: + //verboselog( space.machine(), 0, "DMA Memory Address + Default Params Write: %08x (%08x)\n", data, mem_mask ); + m_nDMAMemAddr = data; + break; + case 0x2010: + case 0x2014: + //verboselog( space.machine(), 0, "DMA Line Count and Width Write: %08x (%08x)\n", data, mem_mask ); + m_nDMALineCntWidth = data; + break; + case 0x2018: + case 0x201c: + //verboselog( space.machine(), 0, "DMA Line Zoom and Stride Write: %08x (%08x)\n", data, mem_mask ); + m_nDMALineZoomStride = data; + break; + case 0x2020: + case 0x2024: + //verboselog( space.machine(), 0, "DMA GIO64 Address Write: %08x (%08x)\n", data, mem_mask ); + m_nDMAGIO64Addr = data; + break; + case 0x2028: + case 0x202c: + //verboselog( space.machine(), 0, "DMA GIO64 Address Write + Start DMA: %08x (%08x)\n", data, mem_mask ); + m_nDMAGIO64Addr = data; + // Start DMA + m_nDMARunning = 1; + break; + case 0x2030: + case 0x2034: + //verboselog( space.machine(), 0, "DMA Mode Write: %08x (%08x)\n", data, mem_mask ); + m_nDMAMode = data; + break; + case 0x2038: + case 0x203c: + //verboselog( space.machine(), 0, "DMA Zoom Count + Byte Count Write: %08x (%08x)\n", data, mem_mask ); + m_nDMAZoomByteCnt = data; + break; + case 0x2040: + case 0x2044: + //verboselog( space.machine(), 0, "DMA Start Write: %08x (%08x)\n", data, mem_mask ); + // Start DMA + m_nDMARunning = 1; + break; + case 0x2070: + case 0x2074: + //verboselog( space.machine(), 0, "DMA GIO64 Address Write + Default Params Write + Start DMA: %08x (%08x)\n", data, mem_mask ); + m_nDMAGIO64Addr = data; + // Start DMA + m_nDMARunning = 1; + break; + default: + //verboselog( space.machine(), 0, "Unmapped MC write: 0x%08x: %08x (%08x)\n", 0x1fa00000 + offset, data, mem_mask ); + break; + } +} + +void sgi_mc_device::update() +{ + m_nRPSSCounter += 1000; +} + +TIMER_CALLBACK_MEMBER(sgi_mc_device::update_callback) +{ + update(); +} + +void sgi_mc_device::timer_init() +{ + m_tUpdateTimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sgi_mc_device::update_callback), this)); + m_tUpdateTimer->adjust(attotime::from_hz(10000), 0, attotime::from_hz(10000)); +} diff --git a/src/mame/machine/sgi.h b/src/mame/machine/sgi.h new file mode 100644 index 00000000000..ec5d203ba70 --- /dev/null +++ b/src/mame/machine/sgi.h @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/********************************************************************* + + sgi.h + + Silicon Graphics MC (Memory Controller) code + +*********************************************************************/ + +#ifndef _SGIMC_H +#define _SGIMC_H + +class sgi_mc_device : public device_t +{ +public: + sgi_mc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~sgi_mc_device() {} + +DECLARE_READ32_MEMBER(read); +DECLARE_WRITE32_MEMBER(write); + +protected: + // device-level overrides + virtual void device_start(); + +private: + // internal state + emu_timer *m_tUpdateTimer; + UINT32 m_nCPUControl0; + UINT32 m_nCPUControl1; + UINT32 m_nWatchdog; + UINT32 m_nSysID; + UINT32 m_nRPSSDiv; + UINT32 m_nRefCntPreload; + UINT32 m_nRefCnt; + UINT32 m_nGIO64ArbParam; + UINT32 m_nArbCPUTime; + UINT32 m_nArbBurstTime; + UINT32 m_nMemCfg0; + UINT32 m_nMemCfg1; + UINT32 m_nCPUMemAccCfg; + UINT32 m_nGIOMemAccCfg; + UINT32 m_nCPUErrorAddr; + UINT32 m_nCPUErrorStatus; + UINT32 m_nGIOErrorAddr; + UINT32 m_nGIOErrorStatus; + UINT32 m_nSysSemaphore; + UINT32 m_nGIOLock; + UINT32 m_nEISALock; + UINT32 m_nGIO64TransMask; + UINT32 m_nGIO64Subst; + UINT32 m_nDMAIntrCause; + UINT32 m_nDMAControl; + UINT32 m_nDMATLBEntry0Hi; + UINT32 m_nDMATLBEntry0Lo; + UINT32 m_nDMATLBEntry1Hi; + UINT32 m_nDMATLBEntry1Lo; + UINT32 m_nDMATLBEntry2Hi; + UINT32 m_nDMATLBEntry2Lo; + UINT32 m_nDMATLBEntry3Hi; + UINT32 m_nDMATLBEntry3Lo; + UINT32 m_nRPSSCounter; + UINT32 m_nDMAMemAddr; + UINT32 m_nDMALineCntWidth; + UINT32 m_nDMALineZoomStride; + UINT32 m_nDMAGIO64Addr; + UINT32 m_nDMAMode; + UINT32 m_nDMAZoomByteCnt; + UINT32 m_nDMARunning; + + void update(); + TIMER_CALLBACK_MEMBER(update_callback); + void timer_init(); +}; + +extern const device_type SGI_MC; + + +#endif /* _SGIMC_H */ diff --git a/src/mame/machine/smartmed.c b/src/mame/machine/smartmed.c new file mode 100644 index 00000000000..32e9c53bcaa --- /dev/null +++ b/src/mame/machine/smartmed.c @@ -0,0 +1,791 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/* + smartmed.c: SmartMedia Flash ROM emulation + + The SmartMedia is a Flash ROM in a fancy card. It is used in a variety of + digital devices (still cameras...) and can be interfaced with a computer. + + References: + Datasheets for various SmartMedia chips were found on Samsung and Toshiba's + sites (http://www.toshiba.com/taec and + http://www.samsung.com/Products/Semiconductor/Flash/FlashCard/SmartMedia) + + TODO: + * support multi-plane mode? + * use HD-format images instead of our experimental custom format? + + Raphael Nabet 2004 +*/ + +#include "emu.h" +#include "smartmed.h" + + +#define MAX_SMARTMEDIA 1 + +/* machine-independent big-endian 32-bit integer */ +struct UINT32BE +{ + UINT8 bytes[4]; +}; + +INLINE UINT32 get_UINT32BE(UINT32BE word) +{ + return (word.bytes[0] << 24) | (word.bytes[1] << 16) | (word.bytes[2] << 8) | word.bytes[3]; +} + +#ifdef UNUSED_FUNCTION +INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) +{ + word->bytes[0] = (data >> 24) & 0xff; + word->bytes[1] = (data >> 16) & 0xff; + word->bytes[2] = (data >> 8) & 0xff; + word->bytes[3] = data & 0xff; +} +#endif + +/* SmartMedia image header */ +struct SM_disk_image_header +{ + UINT8 version; + UINT32BE page_data_size; + UINT32BE page_total_size; + UINT32BE num_pages; + UINT32BE log2_pages_per_block; +}; + +struct disk_image_format_2_header +{ + UINT8 data1[3]; + UINT8 padding1[256-3]; + UINT8 data2[16]; + UINT8 data3[16]; + UINT8 padding2[768-32]; +}; + +enum +{ + header_len = sizeof(SM_disk_image_header) +}; + + +const device_type NAND = &device_creator; + +nand_device::nand_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAND, "NAND Flash Memory", tag, owner, clock, "nand", __FILE__), + m_page_data_size(0), + m_page_total_size(0), + m_num_pages(0), + m_log2_pages_per_block(0), + m_pagereg(NULL), + m_id_len(0), + m_col_address_cycles(0), + m_row_address_cycles(0), + m_sequential_row_read(0), + m_write_rnb(*this) +{ + memset(m_id, 0, sizeof(m_id)); +} + +nand_device::nand_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + m_page_data_size(0), + m_page_total_size(0), + m_num_pages(0), + m_log2_pages_per_block(0), + m_pagereg(NULL), + m_id_len(0), + m_col_address_cycles(0), + m_row_address_cycles(0), + m_sequential_row_read(0), + m_write_rnb(*this) +{ + memset(m_id, 0, sizeof(m_id)); +} + +/* + Init a SmartMedia image +*/ +void nand_device::device_start() +{ + m_data_ptr = NULL; + m_data_uid_ptr = NULL; + m_mode = SM_M_INIT; + m_pointer_mode = SM_PM_A; + m_page_addr = 0; + m_byte_addr = 0; + m_status = 0xC0; + m_accumulated_status = 0; + m_mp_opcode = 0; + m_mode_3065 = 0; + m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); + + #ifdef SMARTMEDIA_IMAGE_SAVE + m_image_format = 0; + #endif + m_write_rnb.resolve_safe(); +} + +/* + Load a SmartMedia image +*/ +bool smartmedia_image_device::smartmedia_format_1() +{ + SM_disk_image_header custom_header; + int bytes_read; + + bytes_read = fread(&custom_header, sizeof(custom_header)); + if (bytes_read != sizeof(custom_header)) + { + return IMAGE_INIT_FAIL; + } + + if (custom_header.version > 1) + { + return IMAGE_INIT_FAIL; + } + + m_page_data_size = get_UINT32BE(custom_header.page_data_size); + m_page_total_size = get_UINT32BE(custom_header.page_total_size); + m_num_pages = get_UINT32BE(custom_header.num_pages); + m_log2_pages_per_block = get_UINT32BE(custom_header.log2_pages_per_block); + m_data_ptr = auto_alloc_array(machine(), UINT8, m_page_total_size*m_num_pages); + m_data_uid_ptr = auto_alloc_array(machine(), UINT8, 256 + 16); + m_mode = SM_M_INIT; + m_pointer_mode = SM_PM_A; + m_page_addr = 0; + m_byte_addr = 0; + m_status = 0x40; + if (!is_readonly()) + m_status |= 0x80; + m_accumulated_status = 0; + m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); + memset( m_id, 0, sizeof( m_id)); + m_id_len = 0; + m_col_address_cycles = 1; + m_row_address_cycles = (m_num_pages > 0x10000) ? 3 : 2; + m_sequential_row_read = 1; + + if (custom_header.version == 0) + { + m_id_len = 2; + fread(m_id, m_id_len); + fread(&m_mp_opcode, 1); + } + else if (custom_header.version == 1) + { + m_id_len = 3; + fread(m_id, m_id_len); + fread(&m_mp_opcode, 1); + fread(m_data_uid_ptr, 256 + 16); + } + fread(m_data_ptr, m_page_total_size*m_num_pages); + + #ifdef SMARTMEDIA_IMAGE_SAVE + m_image_format = 1; + #endif + + return IMAGE_INIT_PASS; +} + +int smartmedia_image_device::detect_geometry( UINT8 id1, UINT8 id2) +{ + int result = FALSE; + + switch (id1) + { + case 0xEC : + { + switch (id2) + { + case 0xA4 : m_page_data_size = 0x0100; m_num_pages = 0x00800; m_page_total_size = 0x0108; m_log2_pages_per_block = 0; result = TRUE; break; + case 0x6E : m_page_data_size = 0x0100; m_num_pages = 0x01000; m_page_total_size = 0x0108; m_log2_pages_per_block = 0; result = TRUE; break; + case 0xEA : m_page_data_size = 0x0100; m_num_pages = 0x02000; m_page_total_size = 0x0108; m_log2_pages_per_block = 4; result = TRUE; break; + case 0xE3 : m_page_data_size = 0x0200; m_num_pages = 0x02000; m_page_total_size = 0x0210; m_log2_pages_per_block = 4; result = TRUE; break; + case 0xE6 : m_page_data_size = 0x0200; m_num_pages = 0x04000; m_page_total_size = 0x0210; m_log2_pages_per_block = 4; result = TRUE; break; + case 0x73 : m_page_data_size = 0x0200; m_num_pages = 0x08000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; + case 0x75 : m_page_data_size = 0x0200; m_num_pages = 0x10000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; + case 0x76 : m_page_data_size = 0x0200; m_num_pages = 0x20000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; + case 0x79 : m_page_data_size = 0x0200; m_num_pages = 0x40000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; + } + } + break; + case 0x98 : + { + switch (id2) + { + case 0x75 : m_page_data_size = 0x0200; m_num_pages = 0x10000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; + } + } + break; + } + + return result; +} + +bool smartmedia_image_device::smartmedia_format_2() +{ + disk_image_format_2_header custom_header; + int bytes_read, i, j; + + bytes_read = fread(&custom_header, sizeof(custom_header)); + if (bytes_read != sizeof(custom_header)) + { + return IMAGE_INIT_FAIL; + } + + if ((custom_header.data1[0] != 0xEC) && (custom_header.data1[0] != 0x98)) + { + return IMAGE_INIT_FAIL; + } + + if (!detect_geometry(custom_header.data1[0], custom_header.data1[1])) + { + return IMAGE_INIT_FAIL; + } + + m_data_ptr = auto_alloc_array(machine(), UINT8, m_page_total_size*m_num_pages); + m_data_uid_ptr = auto_alloc_array(machine(), UINT8, 256 + 16); + m_mode = SM_M_INIT; + m_pointer_mode = SM_PM_A; + m_page_addr = 0; + m_byte_addr = 0; + m_status = 0x40; + if (!is_readonly()) + m_status |= 0x80; + m_accumulated_status = 0; + m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); + m_id_len = 3; + memcpy( m_id, custom_header.data1, m_id_len); + m_mp_opcode = 0; + m_col_address_cycles = 1; + m_row_address_cycles = (m_num_pages > 0x10000) ? 3 : 2; + m_sequential_row_read = 1; + + for (i=0;i<8;i++) + { + memcpy( m_data_uid_ptr + i * 32, custom_header.data2, 16); + for (j=0;j<16;j++) m_data_uid_ptr[i*32+16+j] = custom_header.data2[j] ^ 0xFF; + } + memcpy( m_data_uid_ptr + 256, custom_header.data3, 16); + + fread(m_data_ptr, m_page_total_size*m_num_pages); + + #ifdef SMARTMEDIA_IMAGE_SAVE + m_image_format = 2; + #endif + + return IMAGE_INIT_PASS; +} + +bool smartmedia_image_device::call_load() +{ + int result; + UINT64 position; + // try format 1 + position = ftell(); + result = smartmedia_format_1(); + if (result != IMAGE_INIT_PASS) + { + // try format 2 + fseek( position, SEEK_SET); + result = smartmedia_format_2(); + } + return result; +} + +/* + Unload a SmartMedia image +*/ +void smartmedia_image_device::call_unload() +{ + #ifdef SMARTMEDIA_IMAGE_SAVE + if (!is_readonly()) + { + if (m_image_format == 1) + { + SM_disk_image_header custom_header; + int bytes_read; + fseek( 0, SEEK_SET); + bytes_read = fread( &custom_header, sizeof( custom_header)); + if (bytes_read == sizeof( custom_header)) + { + if (custom_header.version == 0) + { + fseek( 2 + 1, SEEK_CUR); + fwrite( m_data_ptr, m_page_total_size * m_num_pages); + } + else if (custom_header.version == 1) + { + fseek( 3 + 1 + 256 + 16, SEEK_CUR); + fwrite( m_data_ptr, m_page_total_size * m_num_pages); + } + } + } + else if (m_image_format == 2) + { + fseek( sizeof( disk_image_format_2_header), SEEK_SET); + fwrite( m_data_ptr, m_page_total_size * m_num_pages); + } + } + #endif + + m_page_data_size = 0; + m_page_total_size = 0; + m_num_pages = 0; + m_log2_pages_per_block = 0; + m_data_ptr = NULL; + m_data_uid_ptr = NULL; + m_mode = SM_M_INIT; + m_pointer_mode = SM_PM_A; + m_page_addr = 0; + m_byte_addr = 0; + m_status = 0xC0; + m_accumulated_status = 0; + m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); + memset( m_id, 0, sizeof( m_id)); + m_id_len = 0; + m_mp_opcode = 0; + m_mode_3065 = 0; + m_col_address_cycles = 0; + m_row_address_cycles = 0; + m_sequential_row_read = 0; + + #ifdef SMARTMEDIA_IMAGE_SAVE + m_image_format = 0; + #endif + + return; +} + +int nand_device::is_present() +{ + return m_num_pages != 0; +} + +int nand_device::is_protected() +{ + return (m_status & 0x80) == 0; +} + +int nand_device::is_busy() +{ + return (m_status & 0x40) == 0; +} + +void nand_device::set_data_ptr(void *ptr) +{ + m_data_ptr = (UINT8 *)ptr; +} + +/* + write a byte to SmartMedia command port +*/ +void nand_device::command_w(UINT8 data) +{ + if (!is_present()) + return; + + switch (data) + { + case 0xff: // Reset + m_mode = SM_M_INIT; + m_pointer_mode = SM_PM_A; + m_status = (m_status & 0x80) | 0x40; + m_accumulated_status = 0; + m_mode_3065 = 0; + if (!m_write_rnb.isnull()) + { + m_write_rnb( 0); + m_write_rnb( 1); + } + break; + case 0x00: // Read (1st cycle) + m_mode = SM_M_READ; + m_pointer_mode = SM_PM_A; + m_page_addr = 0; + m_addr_load_ptr = 0; + break; + case 0x01: + if (m_page_data_size != 512) + { + logerror("smartmedia: unsupported upper data field select (256-byte pages)\n"); + m_mode = SM_M_INIT; + } + else + { + m_mode = SM_M_READ; + m_pointer_mode = SM_PM_B; + m_page_addr = 0; + m_addr_load_ptr = 0; + } + break; + case 0x50: + if (m_page_data_size > 512) + { + logerror("smartmedia: unsupported spare area select\n"); + m_mode = SM_M_INIT; + } + else + { + m_mode = SM_M_READ; + m_pointer_mode = SM_PM_C; + m_page_addr = 0; + m_addr_load_ptr = 0; + } + break; + case 0x80: // Page Program (1st cycle) + m_mode = SM_M_PROGRAM; + m_page_addr = 0; + m_addr_load_ptr = 0; + m_program_byte_count = 0; + memset(m_pagereg, 0xff, m_page_total_size); + break; + case 0x10: // Page Program (2nd cycle) + case 0x15: + if ((m_mode != SM_M_PROGRAM) && (m_mode != SM_M_RANDOM_DATA_INPUT)) + { + logerror("smartmedia: illegal page program confirm command\n"); + m_mode = SM_M_INIT; + } + else + { + int i; + m_status = (m_status & 0x80) | m_accumulated_status; + //logerror( "smartmedia: program, page_addr %08X\n", m_page_addr); + for (i=0; i; + +smartmedia_image_device::smartmedia_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : nand_device(mconfig, SMARTMEDIA, "SmartMedia Flash ROM", tag, owner, clock, "smartmedia", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +void smartmedia_image_device::device_config_complete() +{ + update_names(); +} diff --git a/src/mame/machine/smartmed.h b/src/mame/machine/smartmed.h new file mode 100644 index 00000000000..4f15cf35a0f --- /dev/null +++ b/src/mame/machine/smartmed.h @@ -0,0 +1,239 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/* + smartmed.h: header file for smartmed.c +*/ + +#ifndef __SMARTMEDIA_H__ +#define __SMARTMEDIA_H__ + +#include "formats/imageutl.h" + +//#define SMARTMEDIA_IMAGE_SAVE + +#define MCFG_NAND_TYPE(_type) \ + nand_device::set_nand_type(*device, _type); + +#define MCFG_NAND_RNB_CALLBACK(_write) \ + devcb = &nand_device::set_rnb_wr_callback(*device, DEVCB_##_write); + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +enum sm_mode_t +{ + SM_M_INIT, // initial state + SM_M_READ, // read page data + SM_M_PROGRAM, // program page data + SM_M_ERASE, // erase block data + SM_M_READSTATUS,// read status + SM_M_READID, // read ID + SM_M_30, + SM_M_RANDOM_DATA_INPUT, + SM_M_RANDOM_DATA_OUTPUT +}; + +enum pointer_sm_mode_t +{ + SM_PM_A, // accessing first 256-byte half of 512-byte data field + SM_PM_B, // accessing second 256-byte half of 512-byte data field + SM_PM_C // accessing spare field +}; + + +// "Sequential Row Read is available only on K9F5608U0D_Y,P,V,F or K9F5608D0D_Y,P" +enum +{ + NAND_CHIP_K9F5608U0D = 0, // K9F5608U0D + NAND_CHIP_K9F5608U0D_J, // K9F5608U0D-Jxxx + NAND_CHIP_K9F5608U0B, // K9F5608U0B + NAND_CHIP_K9F1G08U0B, // K9F1G08U0B + NAND_CHIP_K9LAG08U0M // K9LAG08U0M +}; + +// ======================> nand_device +class nand_device : public device_t +{ +public: + // construction/destruction + nand_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + nand_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + template static devcb_base &set_rnb_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_rnb.set_callback(object); } + + static void set_nand_type(device_t &device, int type) + { + nand_device &dev = downcast(device); + switch (type) + { + case NAND_CHIP_K9F5608U0D: + dev.m_id_len = 2; + dev.m_id[0] = 0xec; + dev.m_id[1] = 0x75; + dev.m_page_data_size = 512; + dev.m_page_total_size = 512 + 16; + dev.m_log2_pages_per_block = compute_log2(32); + dev.m_num_pages = 32 * 2048; + dev.m_col_address_cycles = 1; + dev.m_row_address_cycles = 2; + dev.m_sequential_row_read = 1; + break; + case NAND_CHIP_K9F5608U0D_J: + case NAND_CHIP_K9F5608U0B: + dev.m_id_len = 2; + dev.m_id[0] = 0xec; + dev.m_id[1] = 0x75; + dev.m_page_data_size = 512; + dev.m_page_total_size = 512 + 16; + dev.m_log2_pages_per_block = compute_log2(32); + dev.m_num_pages = 32 * 2048; + dev.m_col_address_cycles = 1; + dev.m_row_address_cycles = 2; + dev.m_sequential_row_read = 0; + break; + case NAND_CHIP_K9F1G08U0B: + dev.m_id_len = 5; + dev.m_id[0] = 0xec; + dev.m_id[1] = 0xf1; + dev.m_id[2] = 0x00; + dev.m_id[3] = 0x95; + dev.m_id[4] = 0x40; + dev.m_page_data_size = 2048; + dev.m_page_total_size = 2048 + 64; + dev.m_log2_pages_per_block = compute_log2(64); + dev.m_num_pages = 64 * 1024; + dev.m_col_address_cycles = 2; + dev.m_row_address_cycles = 2; + dev.m_sequential_row_read = 0; + break; + case NAND_CHIP_K9LAG08U0M: + dev.m_id_len = 5; + dev.m_id[0] = 0xec; + dev.m_id[1] = 0xd5; + dev.m_id[2] = 0x55; + dev.m_id[3] = 0x25; + dev.m_id[4] = 0x68; + dev.m_page_data_size = 2048; + dev.m_page_total_size = 2048 + 64; + dev.m_log2_pages_per_block = compute_log2(128); + dev.m_num_pages = 128 * 8192; + dev.m_col_address_cycles = 2; + dev.m_row_address_cycles = 3; + dev.m_sequential_row_read = 0; + break; + default: + printf("Unknown NAND type!\n"); + dev.m_id_len = 0; + dev.m_page_data_size = 0; + dev.m_page_total_size = 0; + dev.m_log2_pages_per_block = 0; + dev.m_num_pages = 0; + dev.m_col_address_cycles = 0; + dev.m_row_address_cycles = 0; + dev.m_sequential_row_read = 0; + break; + } + } + + int is_present(); + int is_protected(); + int is_busy(); + + UINT8 data_r(); + void command_w(UINT8 data); + void address_w(UINT8 data); + void data_w(UINT8 data); + + void read(int offset, void *data, int size); + + void set_data_ptr(void *ptr); +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + int m_page_data_size; // 256 for a 2MB card, 512 otherwise + int m_page_total_size;// 264 for a 2MB card, 528 otherwise + int m_num_pages; // 8192 for a 4MB card, 16184 for 8MB, 32768 for 16MB, + // 65536 for 32MB, 131072 for 64MB, 262144 for 128MB... + // 0 means no card loaded + int m_log2_pages_per_block; // log2 of number of pages per erase block (usually 4 or 5) + + UINT8 *m_data_ptr; // FEEPROM data area + UINT8 *m_data_uid_ptr; + + sm_mode_t m_mode; // current operation mode + pointer_sm_mode_t m_pointer_mode; // pointer mode + + unsigned int m_page_addr; // page address pointer + int m_byte_addr; // byte address pointer + int m_addr_load_ptr; // address load pointer + + int m_status; // current status + int m_accumulated_status; // accumulated status + + UINT8 *m_pagereg; // page register used by program command + UINT8 m_id[5]; // chip ID + UINT8 m_mp_opcode; // multi-plane operation code + + int m_mode_3065; + + // Palm Z22 NAND has 512 + 16 byte pages but, for some reason, Palm OS writes 512 + 64 bytes when + // programming a page, so we need to keep track of the number of bytes written so we can ignore the + // last 48 (64 - 16) bytes or else the first 48 bytes get overwritten + int m_program_byte_count; + + int m_id_len; + int m_col_address_cycles; + int m_row_address_cycles; + int m_sequential_row_read; + + devcb_write_line m_write_rnb; + + #ifdef SMARTMEDIA_IMAGE_SAVE + int m_image_format; + #endif +}; + + + +class smartmedia_image_device : public nand_device, + public device_image_interface +{ +public: + // construction/destruction + smartmedia_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_MEMCARD; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return "sm_memc"; } + virtual const char *file_extensions() const { return "smc"; } + virtual const option_guide *create_option_guide() const { return NULL; } + + virtual bool call_load(); + virtual void call_unload(); + virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); } + +protected: + // device-level overrides + virtual void device_config_complete(); + + bool smartmedia_format_1(); + bool smartmedia_format_2(); + int detect_geometry( UINT8 id1, UINT8 id2); +}; + + +// device type definition +extern const device_type NAND; +extern const device_type SMARTMEDIA; + + +#endif /* __SMARTMEDIA_H__ */ diff --git a/src/mame/machine/sms.c b/src/mame/machine/sms.c new file mode 100644 index 00000000000..32081091088 --- /dev/null +++ b/src/mame/machine/sms.c @@ -0,0 +1,1521 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Charles MacDonald,Mathis Rosenhauer,Brad Oliver,Michael Luong,Fabio Priuli,Enik Land +#include "emu.h" +#include "crsshair.h" +#include "video/315_5124.h" +#include "sound/sn76496.h" +#include "sound/2413intf.h" +#include "includes/sms.h" + +#define VERBOSE 0 +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + +#define ENABLE_NONE 0x00 +#define ENABLE_EXPANSION 0x01 +#define ENABLE_CARD 0x02 +#define ENABLE_CART 0x04 +#define ENABLE_BIOS 0x08 +#define ENABLE_EXT_RAM 0x10 + + +void sms_state::lphaser_hcount_latch() +{ + /* A delay seems to occur when the Light Phaser latches the + VDP hcount, then an offset is added here to the hpos. */ + m_vdp->hcount_latch_at_hpos(m_main_scr->hpos() + m_lphaser_x_offs); +} + + +WRITE_LINE_MEMBER(sms_state::sms_ctrl1_th_input) +{ + // Check if TH of controller port 1 is set to input (1) + if (m_io_ctrl_reg & 0x02) + { + if (state == 0) + { + m_ctrl1_th_latch = 1; + } + else + { + // State is 1. If changed from 0, hcount is latched. + if (m_ctrl1_th_state == 0) + lphaser_hcount_latch(); + } + m_ctrl1_th_state = state; + } +} + + +WRITE_LINE_MEMBER(sms_state::sms_ctrl2_th_input) +{ + // Check if TH of controller port 2 is set to input (1) + if (m_io_ctrl_reg & 0x08) + { + if (state == 0) + { + m_ctrl2_th_latch = 1; + } + else + { + // State is 1. If changed from 0, hcount is latched. + if (m_ctrl2_th_state == 0) + lphaser_hcount_latch(); + } + m_ctrl2_th_state = state; + } +} + + +WRITE_LINE_MEMBER(sms_state::gg_ext_th_input) +{ + if (!(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) + return; + + // The EXT port act as the controller port 2 on SMS compatibility mode. + sms_ctrl2_th_input(state); +} + + +void sms_state::sms_get_inputs() +{ + bool port_dd_has_th_input = true; + + UINT8 data1 = 0xff; + UINT8 data2 = 0xff; + + m_port_dc_reg = 0xff; + m_port_dd_reg = 0xff; + + // The bit order of the emulated controller port tries to follow its + // physical pins numbering. For register bits whose order differs, + // it's necessary move the equivalent controller bits to match. + + if (m_is_gamegear) + { + // Assume the Japanese Game Gear behaves as the + // Japanese Master System, regarding TH input. + if (m_is_gg_region_japan) + port_dd_has_th_input = false; + + // For Game Gear, this function is used only if SMS mode is + // enabled, else only register $dc receives input data, through + // direct read of the m_port_gg_dc I/O port. + + data1 = m_port_gg_dc->read(); + m_port_dc_reg &= ~0x03f | data1; + + data2 = m_port_gg_ext->port_r(); + } + else + { + // Sega Mark III does not have TH lines connected. + // The Japanese Master System does not set port $dd with TH input. + if (m_is_mark_iii || m_is_smsj) + port_dd_has_th_input = false; + + data1 = m_port_ctrl1->port_r(); + m_port_dc_reg &= ~0x0f | data1; // Up, Down, Left, Right + m_port_dc_reg &= ~0x10 | (data1 >> 1); // TL (Button 1) + m_port_dc_reg &= ~0x20 | (data1 >> 2); // TR (Button 2) + + data2 = m_port_ctrl2->port_r(); + } + + m_port_dc_reg &= ~0xc0 | (data2 << 6); // Up, Down + m_port_dd_reg &= ~0x03 | (data2 >> 2); // Left, Right + m_port_dd_reg &= ~0x04 | (data2 >> 3); // TL (Button 1) + m_port_dd_reg &= ~0x08 | (data2 >> 4); // TR (Button 2) + + if (port_dd_has_th_input) + { + m_port_dd_reg &= ~0x40 | data1; // TH ctrl1 + m_port_dd_reg &= ~0x80 | (data2 << 1); // TH ctrl2 + } +} + + +WRITE8_MEMBER(sms_state::sms_io_control_w) +{ + bool latch_hcount = false; + UINT8 ctrl1_port_data = 0xff; + UINT8 ctrl2_port_data = 0xff; + + if (m_is_gamegear && !(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) + { + m_io_ctrl_reg = data; + return; + } + + // Controller Port 1: + + // check if TR or TH are set to output (0). + if ((data & 0x03) != 0x03) + { + if (!(data & 0x01)) // TR set to output + { + ctrl1_port_data &= ~0x80 | (data << 3); + } + if (!(data & 0x02)) // TH set to output + { + ctrl1_port_data &= ~0x40 | (data << 1); + } + if (!m_is_gamegear) + m_port_ctrl1->port_w(ctrl1_port_data); + } + // check if TH is set to input (1). + if (data & 0x02) + { + if (!m_is_gamegear) + ctrl1_port_data &= ~0x40 | m_port_ctrl1->port_r(); + + // check if TH input level is high (1) and was output/low (0) + if ((ctrl1_port_data & 0x40) && !(m_io_ctrl_reg & 0x22)) + latch_hcount = true; + } + + // Controller Port 2: + + // check if TR or TH are set to output (0). + if ((data & 0x0c) != 0x0c) + { + if (!(data & 0x04)) // TR set to output + { + ctrl2_port_data &= ~0x80 | (data << 1); + } + if (!(data & 0x08)) // TH set to output + { + ctrl2_port_data &= ~0x40 | (data >> 1); + } + if (!m_is_gamegear) + m_port_ctrl2->port_w(ctrl2_port_data); + else + m_port_gg_ext->port_w(ctrl2_port_data); + } + // check if TH is set to input (1). + if (data & 0x08) + { + if (!m_is_gamegear) + ctrl2_port_data &= ~0x40 | m_port_ctrl2->port_r(); + else + ctrl2_port_data &= ~0x40 | m_port_gg_ext->port_r(); + + // check if TH input level is high (1) and was output/low (0) + if ((ctrl2_port_data & 0x40) && !(m_io_ctrl_reg & 0x88)) + latch_hcount = true; + } + + if (latch_hcount) + { + m_vdp->hcount_latch(); + } + m_io_ctrl_reg = data; +} + + +READ8_MEMBER(sms_state::sms_count_r) +{ + if (offset & 0x01) + return m_vdp->hcount_read(*m_space, offset); + else + return m_vdp->vcount_read(*m_space, offset); +} + + +/* + Check if the pause button is pressed. + If the gamegear is in sms mode, check if the start button is pressed. + */ +WRITE_LINE_MEMBER(sms_state::sms_pause_callback) +{ + bool pause_pressed = false; + + if (!m_is_mark_iii) + { + // clear TH latch of the controller ports + m_ctrl1_th_latch = 0; + m_ctrl2_th_latch = 0; + } + + if (m_is_gamegear) + { + if (!(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) + return; + + if (!(m_port_start->read() & 0x80)) + pause_pressed = true; + } + else + { + if (!(m_port_pause->read() & 0x80)) + pause_pressed = true; + } + + if (pause_pressed) + { + if (!m_paused) + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + + m_paused = 1; + } + else + m_paused = 0; +} + + +READ8_MEMBER(sms_state::sms_input_port_dc_r) +{ + if (m_is_mark_iii) + { + sms_get_inputs(); + return m_port_dc_reg; + } + + if (m_is_gamegear) + { + // If SMS mode is disabled, just return the data read from the + // input port. Its mapped port bits match the bits of register $dc. + if (!(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) + return m_port_gg_dc->read(); + } + else + { + // Return if the I/O chip is disabled (1). This check isn't performed + // for the Game Gear because has no effect on it (even in SMS mode?). + if (m_mem_ctrl_reg & IO_CHIP) + return 0xff; + } + + sms_get_inputs(); + + // Check if TR of controller port 1 is set to output (0) + if (!(m_io_ctrl_reg & 0x01)) + { + // Read TR state set through IO control port + m_port_dc_reg &= ~0x20 | ((m_io_ctrl_reg & 0x10) << 1); + } + + return m_port_dc_reg; +} + + +READ8_MEMBER(sms_state::sms_input_port_dd_r) +{ + if (m_is_mark_iii) + { + sms_get_inputs(); + return m_port_dd_reg; + } + + if (m_is_gamegear) + { + if (!(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) + return 0xff; + } + else + { + // Return if the I/O chip is disabled (1). This check isn't performed + // for the Game Gear because has no effect on it (even in SMS mode?). + if (m_mem_ctrl_reg & IO_CHIP) + return 0xff; + } + + sms_get_inputs(); + + // Check if TR of controller port 2 is set to output (0) + if (!(m_io_ctrl_reg & 0x04)) + { + // Read TR state set through IO control port + m_port_dd_reg &= ~0x08 | ((m_io_ctrl_reg & 0x40) >> 3); + } + + if (m_is_smsj || (m_is_gamegear && m_is_gg_region_japan)) + { + // For Japanese Master System, set upper 4 bits with TH/TR + // direction bits of IO control register, according to Enri's + // docs ( http://www43.tok2.com/home/cmpslv/Sms/EnrSms.htm ). + // This makes the console incapable of using the Light Phaser. + // Assume the same for a Japanese Game Gear. + m_port_dd_reg &= ~0x10 | ((m_io_ctrl_reg & 0x01) << 4); + m_port_dd_reg &= ~0x20 | ((m_io_ctrl_reg & 0x04) << 3); + m_port_dd_reg &= ~0x40 | ((m_io_ctrl_reg & 0x02) << 5); + m_port_dd_reg &= ~0x80 | ((m_io_ctrl_reg & 0x08) << 4); + return m_port_dd_reg; + } + + // Reset Button + if ( m_port_reset ) + { + m_port_dd_reg &= ~0x10 | (m_port_reset->read() & 0x01) << 4; + } + + // Check if TH of controller port 1 is set to output (0) + if (!(m_io_ctrl_reg & 0x02)) + { + // Read TH state set through IO control port + m_port_dd_reg &= ~0x40 | ((m_io_ctrl_reg & 0x20) << 1); + } + else // TH set to input (1) + { + if (m_ctrl1_th_latch) + { + m_port_dd_reg &= ~0x40; + m_ctrl1_th_latch = 0; + } + } + + // Check if TH of controller port 2 is set to output (0) + if (!(m_io_ctrl_reg & 0x08)) + { + // Read TH state set through IO control port + m_port_dd_reg &= ~0x80 | (m_io_ctrl_reg & 0x80); + } + else // TH set to input (1) + { + if (m_ctrl2_th_latch) + { + m_port_dd_reg &= ~0x80; + m_ctrl2_th_latch = 0; + } + } + + return m_port_dd_reg; +} + + +WRITE8_MEMBER(sms_state::sms_audio_control_w) +{ + if (m_has_fm) + { + if (m_is_smsj) + m_audio_control = data & 0x03; + else + m_audio_control = data & 0x01; + } +} + + +READ8_MEMBER(sms_state::sms_audio_control_r) +{ + if (m_has_fm) + // The register reference on SMSPower states that just the + // first bit written is returned on reads (even for smsj?). + return m_audio_control & 0x01; + else + return sms_input_port_dc_r(space, offset); +} + + +WRITE8_MEMBER(sms_state::sms_ym2413_register_port_w) +{ + if (m_has_fm && (m_audio_control & 0x01)) + m_ym->write(space, 0, data & 0x3f); +} + + +WRITE8_MEMBER(sms_state::sms_ym2413_data_port_w) +{ + if (m_has_fm && (m_audio_control & 0x01)) + { + //logerror("data_port_w %x %x\n", offset, data); + m_ym->write(space, 1, data); + } +} + + +WRITE8_MEMBER(sms_state::sms_psg_w) +{ + // On Japanese SMS, if FM is enabled, PSG must be explicitly enabled too. + if (m_is_smsj && (m_audio_control & 0x01) && !(m_audio_control & 0x02)) + return; + + m_psg_sms->write(space, offset, data, mem_mask); +} + + +WRITE8_MEMBER(sms_state::gg_psg_w) +{ + m_psg_gg->write(space, offset, data, mem_mask); +} + + +WRITE8_MEMBER(sms_state::gg_psg_stereo_w) +{ + if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) + return; + + m_psg_gg->stereo_w(space, offset, data, mem_mask); +} + + +READ8_MEMBER(sms_state::gg_input_port_00_r) +{ + if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) + return 0xff; + else + { + UINT8 data = (m_is_gg_region_japan ? 0x00 : 0x40) | (m_port_start->read() & 0x80); + + //logerror("port $00 read, val: %02x, pc: %04x\n", data, activecpu_get_pc()); + return data; + } +} + + +READ8_MEMBER(sms_state::sms_sscope_r) +{ + int sscope = m_port_scope->read(); + + if ( sscope ) + { + // Scope is attached + return m_sscope_state; + } + + return read_ram(space, 0x3ff8 + offset); +} + + +WRITE8_MEMBER(sms_state::sms_sscope_w) +{ + write_ram(space, 0x3ff8 + offset, data); + + int sscope = m_port_scope->read(); + + if ( sscope ) + { + // Scope is attached + m_sscope_state = data; + + // There are occurrences when Sega Scope's state changes after VBLANK, or at + // active screen. Most cases are solid-color frames of scene transitions, but + // one exception is the first frame of Zaxxon 3-D's title screen. In that + // case, this method is enough for setting the intended state for the frame. + // No information found about a minimum time need for switch open/closed lens. + if (m_main_scr->vpos() < (m_main_scr->height() >> 1)) + { + m_frame_sscope_state = m_sscope_state; + } + } +} + + +READ8_MEMBER(sms_state::read_ram) +{ + if (m_mem_device_enabled & ENABLE_EXT_RAM) + { + UINT8 data = 0xff; + + if (m_mem_device_enabled & ENABLE_CART) + data &= m_cartslot->read_ram(space, offset); + if (m_mem_device_enabled & ENABLE_CARD) + data &= m_cardslot->read_ram(space, offset); + if (m_mem_device_enabled & ENABLE_EXPANSION) + data &= m_expslot->read_ram(space, offset); + + return data; + } + else + { + return m_mainram[offset & 0x1fff]; + } +} + + +WRITE8_MEMBER(sms_state::write_ram) +{ + if (m_mem_device_enabled & ENABLE_EXT_RAM) + { + if (m_mem_device_enabled & ENABLE_CART) + m_cartslot->write_ram(space, offset, data); + if (m_mem_device_enabled & ENABLE_CARD) + m_cardslot->write_ram(space, offset, data); + if (m_mem_device_enabled & ENABLE_EXPANSION) + m_expslot->write_ram(space, offset, data); + } + else + { + m_mainram[offset & 0x1fff] = data; + } +} + + +READ8_MEMBER(sms_state::sms_mapper_r) +{ + return read_ram(space, 0x3ffc + offset); +} + + +WRITE8_MEMBER(sms_state::sms_mapper_w) +{ + m_mapper[offset] = data; + write_ram(space, 0x3ffc + offset, data); + + switch (offset) + { + case 0: // Control RAM/ROM + if (!(data & 0x08) && (m_mem_device_enabled & ENABLE_BIOS)) // BIOS ROM + { + if (!m_has_bios_0400 && !m_has_bios_2000) + { + m_bios_page[2] = m_mapper[3]; + } + } + if (m_mem_device_enabled & ENABLE_CART) // CART ROM/RAM + { + m_cartslot->write_mapper(space, offset, data); + } + if (m_mem_device_enabled & ENABLE_CARD) // CARD ROM/RAM + { + m_cardslot->write_mapper(space, offset, data); + } + if (m_mem_device_enabled & ENABLE_EXPANSION) // expansion slot + { + m_expslot->write_mapper(space, offset, data); + } + break; + + case 1: // Select 16k ROM bank for 0400-3fff + case 2: // Select 16k ROM bank for 4000-7fff + case 3: // Select 16k ROM bank for 8000-bfff + if (m_mem_device_enabled & ENABLE_BIOS) + { + if (!m_has_bios_0400 && !m_has_bios_2000) + { + m_bios_page[offset - 1] = data & (m_bios_page_count - 1); + } + } + if (m_mem_device_enabled & ENABLE_CART) + { + m_cartslot->write_mapper(space, offset, data); + } + if (m_mem_device_enabled & ENABLE_CARD) + { + m_cardslot->write_mapper(space, offset, data); + } + if (m_mem_device_enabled & ENABLE_EXPANSION) + { + m_expslot->write_mapper(space, offset, data); + } + break; + } +} + + +UINT8 sms_state::read_bus(address_space &space, unsigned int page, UINT16 base_addr, UINT16 offset) +{ + if (m_is_gamegear) + { + // Game Gear BIOS behavior, according to Charles MacDonald: "it uses the first + // 1K. The rest of the space is mapped to the cartridge, regardless of the slot + // that's selected. This allows the BIOS to check for the 'TMR SEGA' string at + // 1FF0/3FF0/7FF0, but it can't do a checksum since the first 1K of ROM is + // unavailable. Anyway, once the BIOS decides to run the game, it disables + // itself, and the first 1K is assigned to the cartridge ROM like normal." + + if ((m_mem_device_enabled & ENABLE_BIOS) && page == 3) + return m_BIOS[(m_bios_page[page] * 0x4000) + (offset & 0x3fff)]; + if (m_mem_device_enabled & ENABLE_CART) + return m_cartslot->read_cart(space, base_addr + offset); + } + else if (m_mem_device_enabled != ENABLE_NONE) + { + UINT8 data = 0xff; + + // SMS2 behavior described by Charles MacDonald's SMS notes: + // "If the BIOS is enabled at the same time the cartridge slot is, + // the data from both sources are logically ANDed together when read." + + if (m_mem_device_enabled & ENABLE_BIOS) + data &= m_BIOS[(m_bios_page[page] * 0x4000) + (offset & 0x3fff)]; + if (m_mem_device_enabled & ENABLE_CART) + data &= m_cartslot->read_cart(space, base_addr + offset); + if (m_mem_device_enabled & ENABLE_CARD) + data &= m_cardslot->read_cart(space, base_addr + offset); + if (m_mem_device_enabled & ENABLE_EXPANSION) + data &= m_expslot->read(space, base_addr + offset); + + return data; + } + return m_region_maincpu->base()[offset]; +} + + +READ8_MEMBER(sms_state::read_0000) +{ + if (offset < 0x400) + { + return read_bus(space, 3, 0x0000, offset); + } + else + { + return read_bus(space, 0, 0x0000, offset); + } +} + +READ8_MEMBER(sms_state::read_4000) +{ + return read_bus(space, 1, 0x4000, offset); +} + +READ8_MEMBER(sms_state::read_8000) +{ + return read_bus(space, 2, 0x8000, offset); +} + +WRITE8_MEMBER(sms_state::write_cart) +{ + if (m_mem_device_enabled & ENABLE_CART) + m_cartslot->write_cart(space, offset, data); + if (m_mem_device_enabled & ENABLE_CARD) + m_cardslot->write_cart(space, offset, data); + if (m_mem_device_enabled & ENABLE_EXPANSION) + m_expslot->write(space, offset, data); +} + + +READ8_MEMBER(smssdisp_state::store_cart_peek) +{ + if (m_mem_device_enabled != ENABLE_NONE) + { + UINT8 data = 0xff; + + if (m_mem_device_enabled & ENABLE_CART) + data &= m_cartslot->read_cart(space, 0x6000 + (offset & 0x1fff)); + + return data; + } + else + { + return m_region_maincpu->base()[offset]; + } +} + +WRITE8_MEMBER(sms_state::sms_mem_control_w) +{ + m_mem_ctrl_reg = data; + + logerror("memory control reg write %02x, pc: %04x\n", data, space.device().safe_pc()); + + setup_media_slots(); +} + + +WRITE8_MEMBER(sms_state::gg_sio_w) +{ + if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) + return; + + logerror("*** write %02X to SIO register #%d\n", data, offset); + + m_gg_sio[offset & 0x07] = data; + switch (offset & 7) + { + case 0x00: /* Parallel Data */ + break; + + case 0x01: /* Data Direction / NMI Enable */ + break; + + case 0x02: /* Serial Output */ + break; + + case 0x03: /* Serial Input */ + break; + + case 0x04: /* Serial Control / Status */ + break; + } +} + + +READ8_MEMBER(sms_state::gg_sio_r) +{ + if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) + return 0xff; + + logerror("*** read SIO register #%d\n", offset); + + switch (offset & 7) + { + case 0x00: /* Parallel Data */ + break; + + case 0x01: /* Data Direction / NMI Enable */ + break; + + case 0x02: /* Serial Output */ + break; + + case 0x03: /* Serial Input */ + break; + + case 0x04: /* Serial Control / Status */ + break; + } + + return m_gg_sio[offset]; +} + + +void sms_state::setup_enabled_slots() +{ + m_mem_device_enabled = ENABLE_NONE; + + if (m_is_mark_iii) + { + // Mark III uses the card slot by default, but has hardware method + // (/CART pin) that prioritizes the cartridge slot if it has media + // inserted. Japanese 3-D cartridges do not connect the /CART pin, + // to not disable the card adaptor used by the 3-D glasses. + if (m_cartslot && m_cartslot->exists()) + { + m_mem_device_enabled |= ENABLE_CART; + logerror("Cartridge ROM/RAM enabled.\n"); + } + else if (m_cardslot && m_cardslot->exists()) + { + m_mem_device_enabled |= ENABLE_CARD; + logerror("Card ROM port enabled.\n"); + } + return; + } + + if (!(m_mem_ctrl_reg & IO_EXPANSION) && m_expslot && m_expslot->m_device) + { + m_mem_device_enabled |= ENABLE_EXPANSION; + logerror("Expansion port enabled.\n"); + } + + if (!(m_mem_ctrl_reg & IO_CARD) && m_cardslot && m_cardslot->exists()) + { + m_mem_device_enabled |= ENABLE_CARD; + logerror("Card ROM port enabled.\n"); + } + + if ((m_is_gamegear || !(m_mem_ctrl_reg & IO_CARTRIDGE)) && m_cartslot && m_cartslot->exists()) + { + m_mem_device_enabled |= ENABLE_CART; + logerror("Cartridge ROM/RAM enabled.\n"); + } + + if (!(m_mem_ctrl_reg & IO_BIOS_ROM) && m_BIOS) + { + m_mem_device_enabled |= ENABLE_BIOS; + logerror("BIOS enabled.\n"); + } +} + + +void sms_state::setup_media_slots() +{ + setup_enabled_slots(); + + if (m_mem_device_enabled == ENABLE_NONE) + return; + + // Setup cartridge RAM + if (!m_is_mark_iii && (m_mem_ctrl_reg & IO_WORK_RAM)) // Work RAM disabled (1). + { + m_mem_device_enabled |= ENABLE_EXT_RAM; + } + else if (m_has_jpn_sms_cart_slot && (m_mem_device_enabled & ENABLE_CART)) + { + // a bunch of SG1000 carts (compatible with SG1000 Mark III) use their own RAM... + // TODO: are BASIC and Music actually compatible with Mark III?? + if (m_cartslot->get_type() == SEGA8_BASIC_L3 || + m_cartslot->get_type() == SEGA8_MUSIC_EDITOR || + m_cartslot->get_type() == SEGA8_DAHJEE_TYPEA || + m_cartslot->get_type() == SEGA8_DAHJEE_TYPEB) + { + m_mem_device_enabled |= ENABLE_EXT_RAM; + } + } + + // Set offset for Light Phaser + if (!m_is_mark_iii) + { + m_lphaser_x_offs = -1; // same value returned for ROMs without custom offset. + + if (m_mem_device_enabled & ENABLE_CART) + m_lphaser_x_offs = m_cartslot->m_cart->get_lphaser_xoffs(); + else if (m_mem_device_enabled & ENABLE_CARD) + m_lphaser_x_offs = m_cardslot->m_cart->get_lphaser_xoffs(); + else if (m_mem_device_enabled & ENABLE_EXPANSION) + m_lphaser_x_offs = m_expslot->m_device->get_lphaser_xoffs(); + + if (m_lphaser_x_offs == -1) + m_lphaser_x_offs = 36; + } +} + + +void sms_state::setup_bios() +{ + m_BIOS = memregion("user1")->base(); + m_bios_page_count = (m_BIOS ? memregion("user1")->bytes() / 0x4000 : 0); + + if (m_BIOS == NULL || m_BIOS[0] == 0x00) + { + m_BIOS = NULL; + m_has_bios_0400 = 0; + m_has_bios_2000 = 0; + m_has_bios_full = 0; + } + + if (m_BIOS) + { + m_bios_page[3] = 0; + m_bios_page[0] = 0; + m_bios_page[1] = (1 < m_bios_page_count) ? 1 : 0; + m_bios_page[2] = (2 < m_bios_page_count) ? 2 : 0; + } + + if (!m_is_mark_iii) + { + m_mem_ctrl_reg = (IO_EXPANSION | IO_CARTRIDGE | IO_CARD); + if (!m_BIOS) + { + m_mem_ctrl_reg &= ~(IO_CARTRIDGE); + m_mem_ctrl_reg |= IO_BIOS_ROM; + } + } +} + +MACHINE_START_MEMBER(sms_state,sms) +{ + char str[7]; + + m_cartslot = machine().device("slot"); + m_cardslot = machine().device("mycard"); + m_expslot = machine().device("exp"); + m_space = &m_maincpu->space(AS_PROGRAM); + + if (m_mainram == NULL) + { + m_mainram = auto_alloc_array_clear(machine(), UINT8, 0x2000); + save_pointer(NAME(m_mainram), 0x2000); + + // alibaba and blockhol are ports of games for the MSX system. The + // MSX bios usually initializes callback "vectors" at the top of RAM. + // The code in alibaba does not do this so the IRQ vector only contains + // the "call $4010" without a following RET statement. That is basically + // a bug in the program code. The only way this cartridge could have run + // successfully on a real unit is if the RAM would be initialized with + // a F0 pattern on power up; F0 = RET P. + // This initialization breaks some Game Gear games though (e.g. + // tempojr), suggesting that not all systems had the same initialization. + // This also breaks some homebrew softwares (e.g. Nine Pixels). + // For the moment we apply this to systems that have the Japanese SMS + // cartridge slot. + if (m_has_jpn_sms_cart_slot) + { + memset(m_mainram, 0xf0, 0x2000); + } + } + + save_item(NAME(m_paused)); + save_item(NAME(m_mapper)); + save_item(NAME(m_port_dc_reg)); + save_item(NAME(m_port_dd_reg)); + save_item(NAME(m_mem_device_enabled)); + + if (m_has_fm) + { + save_item(NAME(m_audio_control)); + } + + if (!m_is_mark_iii) + { + save_item(NAME(m_mem_ctrl_reg)); + save_item(NAME(m_bios_page)); + save_item(NAME(m_io_ctrl_reg)); + save_item(NAME(m_ctrl1_th_latch)); + save_item(NAME(m_ctrl2_th_latch)); + save_item(NAME(m_ctrl1_th_state)); + save_item(NAME(m_ctrl2_th_state)); + save_item(NAME(m_lphaser_x_offs)); + } + + if (m_is_gamegear) + { + save_item(NAME(m_gg_sio)); + } + + if (m_is_sdisp) + { + machine().save().register_postload(save_prepost_delegate(FUNC(sms_state::store_post_load), this)); + + save_item(NAME(m_store_control)); + save_item(NAME(m_store_cart_selection_data)); + + m_slots[0] = m_cartslot; + for (int i = 1; i < 16; i++) + { + sprintf(str,"slot%i",i + 1); + m_slots[i] = machine().device(str); + } + for (int i = 0; i < 16; i++) + { + sprintf(str,"slot%i",i + 16 + 1); + m_cards[i] = machine().device(str); + } + } + + if (m_cartslot) + m_cartslot->save_ram(); +} + +MACHINE_RESET_MEMBER(sms_state,sms) +{ + if (m_has_fm) + m_audio_control = 0x00; + + if (!m_is_mark_iii) + { + m_io_ctrl_reg = 0xff; + m_ctrl1_th_latch = 0; + m_ctrl2_th_latch = 0; + m_ctrl1_th_state = 1; + m_ctrl2_th_state = 1; + } + + if (m_is_gamegear) + { + if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) + m_vdp->set_sega315_5124_compatibility_mode(true); + + /* Initialize SIO stuff for GG */ + m_gg_sio[0] = 0x7f; + m_gg_sio[1] = 0xff; + m_gg_sio[2] = 0x00; + m_gg_sio[3] = 0xff; + m_gg_sio[4] = 0x00; + } + + if (m_is_sdisp) + { + m_store_control = 0; + m_store_cart_selection_data = 0; + store_select_cart(m_store_cart_selection_data); + } + + setup_bios(); + setup_media_slots(); +} + +READ8_MEMBER(smssdisp_state::sms_store_cart_select_r) +{ + return m_store_cart_selection_data; +} + + +WRITE8_MEMBER(smssdisp_state::sms_store_cart_select_w) +{ + store_select_cart(data); + m_store_cart_selection_data = data; + setup_media_slots(); +} + + +void sms_state::store_post_load() +{ + store_select_cart(m_store_cart_selection_data); +} + + +// There are two known models of the Store Display Unit: +// +// - the one with 16 cart slots and 3 card slots; +// - the one with 16 cart slots and 16 card slots. +// +// On front panel of both models there are only 16 game switches, +// that seems to change the active cart/card slot pair or, for the 4th +// game switch onward of the 16-3 model, the active cart slot only. + +void sms_state::store_select_cart(UINT8 data) +{ + UINT8 slot = data >> 4; + UINT8 slottype = data & 0x08; + + // The SMS Store Display Unit only uses the logical cartridge slot to + // map the active cartridge or card slot, of its multiple ones. + if (slottype == 0) + m_cartslot = m_slots[slot]; + else + m_cartslot = m_cards[slot]; + + logerror("switching in part of %s slot #%d\n", slottype ? "card" : "cartridge", slot); +} + +WRITE8_MEMBER(smssdisp_state::sms_store_control_w) +{ + int led_number = data >> 4; + int led_column = led_number / 4; + int led_line = led_number % 4; + int game_number = (4 * led_column) + (3 - led_line); + + logerror("0x%04X: sms_store_control write 0x%02X\n", space.device().safe_pc(), data); + logerror("sms_store_control: LED #%d activated for game #%d\n", led_number, game_number); + + if (data & 0x02) + { + m_maincpu->resume(SUSPEND_REASON_HALT); + } + else + { + /* Pull reset line of CPU #0 low */ + m_maincpu->reset(); + m_maincpu->suspend(SUSPEND_REASON_HALT, 1); + } + m_store_control = data; +} + +WRITE_LINE_MEMBER(smssdisp_state::sms_store_int_callback) +{ + if ( m_store_control & 0x01 ) + { + m_control_cpu->set_input_line( 0, state ); + } + else + { + m_maincpu->set_input_line( 0, state ); + } +} + +DRIVER_INIT_MEMBER(sms_state,sg1000m3) +{ + m_is_mark_iii = 1; + m_has_fm = 1; + m_has_jpn_sms_cart_slot = 1; +} + + +DRIVER_INIT_MEMBER(sms_state,sms1) +{ + m_has_bios_full = 1; +} + + +DRIVER_INIT_MEMBER(sms_state,smsj) +{ + m_is_smsj = 1; + m_has_bios_2000 = 1; + m_has_fm = 1; + m_has_jpn_sms_cart_slot = 1; +} + + +DRIVER_INIT_MEMBER(sms_state,sms1krfm) +{ + m_has_bios_2000 = 1; + m_has_fm = 1; + m_has_jpn_sms_cart_slot = 1; +} + + +DRIVER_INIT_MEMBER(sms_state,sms1kr) +{ + m_has_bios_2000 = 1; + m_has_jpn_sms_cart_slot = 1; +} + + +DRIVER_INIT_MEMBER(sms_state,smskr) +{ + m_has_bios_full = 1; + // Despite having a Japanese cartridge slot, this version is detected as Export region. + m_has_jpn_sms_cart_slot = 1; +} + + +DRIVER_INIT_MEMBER(smssdisp_state,smssdisp) +{ + m_is_sdisp = 1; +} + + +DRIVER_INIT_MEMBER(sms_state,gamegear) +{ + m_is_gamegear = 1; + m_has_bios_0400 = 1; +} + + +DRIVER_INIT_MEMBER(sms_state,gamegeaj) +{ + m_is_gamegear = 1; + m_has_bios_0400 = 1; + m_is_gg_region_japan = 1; +} + + +VIDEO_START_MEMBER(sms_state,sms1) +{ + m_left_lcd = machine().device("left_lcd"); + m_right_lcd = machine().device("right_lcd"); + + m_main_scr->register_screen_bitmap(m_prevleft_bitmap); + m_main_scr->register_screen_bitmap(m_prevright_bitmap); + save_item(NAME(m_prevleft_bitmap)); + save_item(NAME(m_prevright_bitmap)); + save_item(NAME(m_sscope_state)); + save_item(NAME(m_frame_sscope_state)); + + // Allow sscope screens to have crosshair, useful for the game missil3d + crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_ALL); +} + + +VIDEO_RESET_MEMBER(sms_state,sms1) +{ + if (m_port_scope->read()) + { + UINT8 sscope_binocular_hack = m_port_scope_binocular->read(); + + if (sscope_binocular_hack & 0x01) + m_prevleft_bitmap.fill(rgb_t::black); + if (sscope_binocular_hack & 0x02) + m_prevright_bitmap.fill(rgb_t::black); + } + + m_sscope_state = 0; + m_frame_sscope_state = 0; +} + + +READ32_MEMBER(sms_state::sms_pixel_color) +{ + bitmap_rgb32 &vdp_bitmap = m_vdp->get_bitmap(); + int beam_x = m_main_scr->hpos(); + int beam_y = m_main_scr->vpos(); + + return vdp_bitmap.pix32(beam_y, beam_x); +} + + +void sms_state::screen_vblank_sms1(screen_device &screen, bool state) +{ + // on falling edge + if (!state) + { + // Most of the 3-D games usually set Sega Scope's state for next frame + // soon after the active area of current frame was drawn, but before + // it is displayed by the screen update function. That function needs to + // check the state used at the time of frame drawing, to display it on + // the correct side. So here, when the frame is about to be drawn, the + // Sega Scope's state is stored, to be checked by that function. + m_frame_sscope_state = m_sscope_state; + } +} + + +UINT32 sms_state::screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT8 sscope = 0; + UINT8 sscope_binocular_hack; + UINT8 occluded_view = 0; + + if (&screen != m_main_scr) + { + sscope = m_port_scope->read(); + if (!sscope) + { + // without SegaScope, both LCDs for glasses go black + occluded_view = 1; + } + else if (&screen == m_left_lcd) + { + // with SegaScope, state 0 = left screen OFF, right screen ON + if (!(m_frame_sscope_state & 0x01)) + occluded_view = 1; + } + else // it's right LCD + { + // with SegaScope, state 1 = left screen ON, right screen OFF + if (m_frame_sscope_state & 0x01) + occluded_view = 1; + } + } + + if (!occluded_view) + { + m_vdp->screen_update(screen, bitmap, cliprect); + + // HACK: fake 3D->2D handling (if enabled, it repeats each frame twice on the selected lens) + // save a copy of current bitmap for the binocular hack + if (sscope) + { + sscope_binocular_hack = m_port_scope_binocular->read(); + + if (&screen == m_left_lcd) + { + if (sscope_binocular_hack & 0x01) + copybitmap(m_prevleft_bitmap, bitmap, 0, 0, 0, 0, cliprect); + } + else // it's right LCD + { + if (sscope_binocular_hack & 0x02) + copybitmap(m_prevright_bitmap, bitmap, 0, 0, 0, 0, cliprect); + } + } + } + else + { + // HACK: fake 3D->2D handling (if enabled, it repeats each frame twice on the selected lens) + // use the copied bitmap for the binocular hack + if (sscope) + { + sscope_binocular_hack = m_port_scope_binocular->read(); + + if (&screen == m_left_lcd) + { + if (sscope_binocular_hack & 0x01) + { + copybitmap(bitmap, m_prevleft_bitmap, 0, 0, 0, 0, cliprect); + return 0; + } + } + else // it's right LCD + { + if (sscope_binocular_hack & 0x02) + { + copybitmap(bitmap, m_prevright_bitmap, 0, 0, 0, 0, cliprect); + return 0; + } + } + } + bitmap.fill(rgb_t::black, cliprect); + } + + return 0; +} + +UINT32 sms_state::screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_vdp->screen_update(screen, bitmap, cliprect); + return 0; +} + +VIDEO_START_MEMBER(sms_state,gamegear) +{ + m_prev_bitmap_copied = false; + m_main_scr->register_screen_bitmap(m_prev_bitmap); + m_main_scr->register_screen_bitmap(m_gg_sms_mode_bitmap); + m_line_buffer = auto_alloc_array(machine(), int, 160 * 4); + + save_item(NAME(m_prev_bitmap_copied)); + save_item(NAME(m_prev_bitmap)); + save_item(NAME(m_gg_sms_mode_bitmap)); + save_pointer(NAME(m_line_buffer), 160 * 4); +} + +VIDEO_RESET_MEMBER(sms_state,gamegear) +{ + if (m_prev_bitmap_copied) + { + m_prev_bitmap.fill(rgb_t::black); + m_prev_bitmap_copied = false; + } + if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) + { + m_gg_sms_mode_bitmap.fill(rgb_t::black); + memset(m_line_buffer, 0, 160 * 4 * sizeof(int)); + } +} + + +void sms_state::screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bitmap_rgb32 &vdp_bitmap = m_vdp->get_bitmap(); + const rectangle visarea = screen.visible_area(); + + /* Plot positions relative to visarea minimum values */ + const int plot_min_x = cliprect.min_x - visarea.min_x; + const int plot_max_x = MIN(cliprect.max_x - visarea.min_x, 159); // avoid m_line_buffer overflow. + const int plot_min_y = cliprect.min_y - visarea.min_y; + const int plot_max_y = cliprect.max_y - visarea.min_y; + + /* For each group of 3 SMS pixels, a group of 2 GG pixels is processed. + In case the cliprect coordinates may map any region of the visible area, + take in account the remaining position, if any, of the first group. */ + const int plot_x_first_group = plot_min_x - (plot_min_x % 2); + const int plot_y_first_group = plot_min_y - (plot_min_y % 2); + + /* Calculation of the minimum scaled value for X */ + const int visarea_xcenter = visarea.xcenter(); + const int sms_offset_min_x = ((int) (visarea_xcenter - cliprect.min_x) / 2) * 3; + const int sms_min_x = visarea_xcenter - sms_offset_min_x; + + /* Calculation of the minimum scaled value for Y */ + const int visarea_ycenter = visarea.ycenter(); + const int sms_offset_min_y = ((int) (visarea_ycenter - cliprect.min_y) / 2) * 3; + const int sms_min_y = visarea_ycenter - sms_offset_min_y; + + int sms_y = sms_min_y; + int y_min_i = plot_min_y - plot_y_first_group; + + /* Auxiliary variable for vertical scaling */ + int sms_y2 = sms_y - 1; + + for (int plot_y_group = plot_y_first_group; plot_y_group <= plot_max_y; plot_y_group += 2) + { + const int y_max_i = MIN(1, plot_max_y - plot_y_group); + + for (int y_i = y_min_i; y_i <= y_max_i; y_i++) + { + /* Include additional lines that have influence over what appears on the LCD */ + const int sms_min_y2 = sms_y + y_i - 1; + const int sms_max_y2 = sms_y + y_i + 2; + + /* Process lines, but skip those already processed before */ + for (sms_y2 = MAX(sms_min_y2, sms_y2); sms_y2 <= sms_max_y2; sms_y2++) + { + int *combineline_buffer = m_line_buffer + (sms_y2 & 0x03) * 160; + + if (sms_y2 >= vdp_bitmap.cliprect().min_y && sms_y2 <= vdp_bitmap.cliprect().max_y) + { + UINT32 *vdp_buffer = &vdp_bitmap.pix32(sms_y2); + + int sms_x = sms_min_x; + int x_min_i = plot_min_x - plot_x_first_group; + + /* Do horizontal scaling */ + for (int plot_x_group = plot_x_first_group; plot_x_group <= plot_max_x; plot_x_group += 2) + { + const int x_max_i = MIN(1, plot_max_x - plot_x_group); + + for (int x_i = x_min_i; x_i <= x_max_i; x_i++) + { + int combined = 0; + + if (sms_x + x_i >= vdp_bitmap.cliprect().min_x && sms_x + x_i + 1 <= vdp_bitmap.cliprect().max_x) + { + switch (x_i) + { + case 0: + /* Take red and green from first pixel, and blue from second pixel */ + combined = (vdp_buffer[sms_x] & 0x00ffff00) | (vdp_buffer[sms_x + 1] & 0x000000ff); + break; + case 1: + /* Take red from second pixel, and green and blue from third pixel */ + combined = (vdp_buffer[sms_x + 1] & 0x00ff0000) | (vdp_buffer[sms_x + 2] & 0x0000ffff); + break; + } + } + + combineline_buffer[plot_x_group + x_i] = combined; + } + + sms_x += 3; + x_min_i = 0; + } + } + else + { + memset(combineline_buffer, 0, 160 * sizeof(int)); + } + } + + /* Do vertical scaling for a screen with 192 or 224 lines + Lines 0-2 and 221-223 have no effect on the output on the GG screen. + We will calculate the gamegear lines as follows: + GG_0 = 1/6 * SMS_3 + 1/3 * SMS_4 + 1/3 * SMS_5 + 1/6 * SMS_6 + GG_1 = 1/6 * SMS_4 + 1/3 * SMS_5 + 1/3 * SMS_6 + 1/6 * SMS_7 + GG_2 = 1/6 * SMS_6 + 1/3 * SMS_7 + 1/3 * SMS_8 + 1/6 * SMS_9 + GG_3 = 1/6 * SMS_7 + 1/3 * SMS_8 + 1/3 * SMS_9 + 1/6 * SMS_10 + GG_4 = 1/6 * SMS_9 + 1/3 * SMS_10 + 1/3 * SMS_11 + 1/6 * SMS_12 + ..... + GG_142 = 1/6 * SMS_216 + 1/3 * SMS_217 + 1/3 * SMS_218 + 1/6 * SMS_219 + GG_143 = 1/6 * SMS_217 + 1/3 * SMS_218 + 1/3 * SMS_219 + 1/6 * SMS_220 + */ + { + int *line1, *line2, *line3, *line4; + + /* Setup our source lines */ + line1 = m_line_buffer + ((sms_y + y_i - 1) & 0x03) * 160; + line2 = m_line_buffer + ((sms_y + y_i - 0) & 0x03) * 160; + line3 = m_line_buffer + ((sms_y + y_i + 1) & 0x03) * 160; + line4 = m_line_buffer + ((sms_y + y_i + 2) & 0x03) * 160; + + UINT32 *p_bitmap = &bitmap.pix32(visarea.min_y + plot_y_group + y_i, visarea.min_x); + + for (int plot_x = plot_min_x; plot_x <= plot_max_x; plot_x++) + { + rgb_t c1 = line1[plot_x]; + rgb_t c2 = line2[plot_x]; + rgb_t c3 = line3[plot_x]; + rgb_t c4 = line4[plot_x]; + p_bitmap[plot_x] = + rgb_t( + ( c1.r() / 6 + c2.r() / 3 + c3.r() / 3 + c4.r() / 6 ), + ( c1.g() / 6 + c2.g() / 3 + c3.g() / 3 + c4.g() / 6 ), + ( c1.b() / 6 + c2.b() / 3 + c3.b() / 3 + c4.b() / 6 ) + ); + } + } + } + + sms_y += 3; + y_min_i = 0; + } +} + + +UINT32 sms_state::screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bitmap_rgb32 *source_bitmap; + + if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) + { + screen_gg_sms_mode_scaling(screen, m_gg_sms_mode_bitmap, cliprect); + source_bitmap = &m_gg_sms_mode_bitmap; + } + else + { + source_bitmap = &m_vdp->get_bitmap(); + } + + if (!m_port_persist->read()) + { + copybitmap(bitmap, *source_bitmap, 0, 0, 0, 0, cliprect); + if (m_prev_bitmap_copied) + { + m_prev_bitmap.fill(rgb_t::black); + m_prev_bitmap_copied = false; + } + } + else if (!m_prev_bitmap_copied) + { + copybitmap(bitmap, *source_bitmap, 0, 0, 0, 0, cliprect); + copybitmap(m_prev_bitmap, *source_bitmap, 0, 0, 0, 0, cliprect); + m_prev_bitmap_copied = true; + } + else + { + // HACK: fake LCD persistence effect + // (it would be better to generalize this in the core, to be used for all LCD systems) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + { + UINT32 *linedst = &bitmap.pix32(y); + UINT32 *line0 = &source_bitmap->pix32(y); + UINT32 *line1 = &m_prev_bitmap.pix32(y); + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + { + UINT32 color0 = line0[x]; + UINT32 color1 = line1[x]; + UINT16 r0 = (color0 >> 16) & 0x000000ff; + UINT16 g0 = (color0 >> 8) & 0x000000ff; + UINT16 b0 = (color0 >> 0) & 0x000000ff; + UINT16 r1 = (color1 >> 16) & 0x000000ff; + UINT16 g1 = (color1 >> 8) & 0x000000ff; + UINT16 b1 = (color1 >> 0) & 0x000000ff; + UINT8 r = (UINT8)((r0 + r1) >> 1); + UINT8 g = (UINT8)((g0 + g1) >> 1); + UINT8 b = (UINT8)((b0 + b1) >> 1); + linedst[x] = (r << 16) | (g << 8) | b; + } + } + copybitmap(m_prev_bitmap, *source_bitmap, 0, 0, 0, 0, cliprect); + } + return 0; +} diff --git a/src/mame/machine/snescx4.c b/src/mame/machine/snescx4.c new file mode 100644 index 00000000000..a4a200452a2 --- /dev/null +++ b/src/mame/machine/snescx4.c @@ -0,0 +1,257 @@ +// license:GPL-2.0+ +// copyright-holders:Fabio Priuli, byuu, Nach +/*************************************************************************** + + snescx4.c + + File to handle emulation of the SNES "CX4" add-on chip. + + Code based on original work by zsKnight, anomie and Nach. + This implementation is based on C++ "cx4*.cpp" by byuu + (up to date with source v 0.49). + +***************************************************************************/ + +#include "emu.h" +#include "machine/snescx4.h" + +static CX4 cx4; + +static UINT16 CX4_readw(UINT16 addr); +static UINT32 CX4_readl(UINT16 addr); + +static void CX4_writew(running_machine &machine, UINT16 addr, UINT16 data); +//static void CX4_writel(running_machine &machine, UINT16 addr, UINT32 data); + +static void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color); + +#include "machine/cx4data.inc" +#include "machine/cx4fn.inc" + +static UINT32 CX4_ldr(UINT8 r) +{ + UINT16 addr = 0x0080 + (r * 3); + return (cx4.reg[addr + 0] << 0) + | (cx4.reg[addr + 1] << 8) + | (cx4.reg[addr + 2] << 16); +} + +static void CX4_str(UINT8 r, UINT32 data) +{ + UINT16 addr = 0x0080 + (r * 3); + cx4.reg[addr + 0] = (data >> 0); + cx4.reg[addr + 1] = (data >> 8); + cx4.reg[addr + 2] = (data >> 16); +} + +static void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh) +{ + INT64 rx = x & 0xffffff; + INT64 ry = y & 0xffffff; + if(rx & 0x800000)rx |= ~0x7fffff; + if(ry & 0x800000)ry |= ~0x7fffff; + + rx *= ry; + + *rl = (rx) & 0xffffff; + *rh = (rx >> 24) & 0xffffff; +} + +static UINT32 CX4_sin(UINT32 rx) +{ + cx4.r0 = rx & 0x1ff; + if(cx4.r0 & 0x100) + { + cx4.r0 ^= 0x1ff; + } + if(cx4.r0 & 0x080) + { + cx4.r0 ^= 0x0ff; + } + if(rx & 0x100) + { + return CX4_sin_table[cx4.r0 + 0x80]; + } + else + { + return CX4_sin_table[cx4.r0]; + } +} + +static UINT32 CX4_cos(UINT32 rx) +{ + return CX4_sin(rx + 0x080); +} + +static void CX4_immediate_reg(UINT32 start) +{ + UINT32 i = 0; + cx4.r0 = CX4_ldr(0); + for(i = start; i < 48; i++) + { + if((cx4.r0 & 0x0fff) < 0x0c00) + { + cx4.ram[cx4.r0 & 0x0fff] = CX4_immediate_data[i]; + } + cx4.r0++; + } + CX4_str(0, cx4.r0); +} + +static void CX4_transfer_data(running_machine &machine) +{ + UINT32 src; + UINT16 dest, count; + UINT32 i; + + src = (cx4.reg[0x40]) | (cx4.reg[0x41] << 8) | (cx4.reg[0x42] << 16); + count = (cx4.reg[0x43]) | (cx4.reg[0x44] << 8); + dest = (cx4.reg[0x45]) | (cx4.reg[0x46] << 8); + + address_space &space = machine.device("maincpu")->space(AS_PROGRAM); + for(i=0;i> 2; + return; + } + + switch(data) + { + case 0x00: CX4_op00(machine); break; + case 0x01: CX4_op01(machine); break; + case 0x05: CX4_op05(machine); break; + case 0x0d: CX4_op0d(machine); break; + case 0x10: CX4_op10(); break; + case 0x13: CX4_op13(); break; + case 0x15: CX4_op15(machine); break; + case 0x1f: CX4_op1f(machine); break; + case 0x22: CX4_op22(); break; + case 0x25: CX4_op25(); break; + case 0x2d: CX4_op2d(machine); break; + case 0x40: CX4_op40(); break; + case 0x54: CX4_op54(); break; + case 0x5c: CX4_op5c(); break; + case 0x5e: CX4_op5e(); break; + case 0x60: CX4_op60(); break; + case 0x62: CX4_op62(); break; + case 0x64: CX4_op64(); break; + case 0x66: CX4_op66(); break; + case 0x68: CX4_op68(); break; + case 0x6a: CX4_op6a(); break; + case 0x6c: CX4_op6c(); break; + case 0x6e: CX4_op6e(); break; + case 0x70: CX4_op70(); break; + case 0x72: CX4_op72(); break; + case 0x74: CX4_op74(); break; + case 0x76: CX4_op76(); break; + case 0x78: CX4_op78(); break; + case 0x7a: CX4_op7a(); break; + case 0x7c: CX4_op7c(); break; + case 0x89: CX4_op89(); break; + } + } +} + +#ifdef UNUSED_FUNCTION +void CX4_writeb(running_machine &machine, UINT16 addr, UINT8 data) +{ + CX4_write(machine, addr, data); +} +#endif + +static void CX4_writew(running_machine &machine, UINT16 addr, UINT16 data) +{ + CX4_write(machine, addr + 0, data >> 0); + CX4_write(machine, addr + 1, data >> 8); +} + +#ifdef UNUSED_FUNCTION +void CX4_writel(running_machine &machine, UINT16 addr, UINT32 data) +{ + CX4_write(machine, addr + 0, data >> 0); + CX4_write(machine, addr + 1, data >> 8); + CX4_write(machine, addr + 2, data >> 16); +} +#endif + +UINT8 CX4_read(UINT32 addr) +{ + addr &= 0x1fff; + + if(addr < 0x0c00) + { + return cx4.ram[addr]; + } + + if(addr >= 0x1f00) + { + return cx4.reg[addr & 0xff]; + } + + return 0xff; +} + +#ifdef UNUSED_FUNCTION +UINT8 CX4_readb(UINT16 addr) +{ + return CX4_read(addr); +} +#endif + +static UINT16 CX4_readw(UINT16 addr) +{ + return CX4_read(addr) | (CX4_read(addr + 1) << 8); +} + +static UINT32 CX4_readl(UINT16 addr) +{ + return CX4_read(addr) | (CX4_read(addr + 1) << 8) | (CX4_read(addr + 2) << 16); +} + +#ifdef UNUSED_FUNCTION +void CX4_reset() +{ + memset(cx4.ram, 0, 0x0c00); + memset(cx4.reg, 0, 0x0100); +} +#endif diff --git a/src/mame/machine/snescx4.h b/src/mame/machine/snescx4.h new file mode 100644 index 00000000000..1adca638a39 --- /dev/null +++ b/src/mame/machine/snescx4.h @@ -0,0 +1,29 @@ +// license:GPL-2.0+ +// copyright-holders:Fabio Priuli, byuu, Nach +/*************************************************************************** + + snescx4.h + + Code based on original work by zsKnight, anomie and Nach. + This implementation is based on C++ "cx4*.cpp" by byuu + (up to date with source v 0.49). + +***************************************************************************/ + +struct CX4 +{ + UINT8 ram[0x0c00]; + UINT8 reg[0x0100]; + UINT32 r0, r1, r2, r3, r4, r5, r6, r7, + r8, r9, r10, r11, r12, r13, r14, r15; + + INT16 C4WFXVal, C4WFYVal, C4WFZVal, C4WFX2Val, C4WFY2Val, C4WFDist, C4WFScale; + INT16 C41FXVal, C41FYVal, C41FAngleRes, C41FDist, C41FDistVal; + + double tanval; + double c4x, c4y, c4z; + double c4x2, c4y2, c4z2; +}; + +UINT8 CX4_read(UINT32 addr); +void CX4_write(running_machine &machine, UINT32 addr, UINT8 data); diff --git a/src/mame/machine/sonydriv.c b/src/mame/machine/sonydriv.c new file mode 100644 index 00000000000..31c88e4f988 --- /dev/null +++ b/src/mame/machine/sonydriv.c @@ -0,0 +1,572 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/********************************************************************* + + sonydriv.c + + Apple/Sony 3.5" floppy drive emulation (to be interfaced with iwm.c) + + Nate Woods, Raphael Nabet, R. Belmont + + This floppy drive was present in all variants of Lisa 2 (including Mac XL), + all Apple IIgs and IIc Plus machines, and in all Macintoshes in production + before 1988, when SWIM and SuperDrive were introduced. + + There were three major variants : + - A single-sided 400k unit which was used on Lisa 2/Mac XL, and Macintosh + 128k/512k. This unit needs the computer to send the proper pulses to + control the drive motor rotation. It can be connected to all early + Macintosh (but not Mac Classic?) as an external unit. + - A double-sided 800k unit which was used on Macintosh Plus, 512ke, and + early SE and II*. This unit generates its own drive motor rotation + control signals. It can be connected to earlier (and later) Macintosh as + an external or internal unit. Some Lisa2/10 and Mac XL were upgraded to + use it, too, but a fdc ROM upgrade was required. + - A double-sided 1440k unit. This is fully back compatible with the 800k + drive, and adds 1440k MFM capability. This drive, called FDHD or + SuperDrive by Apple, came in automatic and manual-inject versions. + + TODO : + * support for other image formats? + * should we support more than 2 floppy disk units? (Mac SE supported 3 drives) + +*********************************************************************/ + +#include "emu.h" +#include "machine/applefdc.h" +#include "sonydriv.h" +#include "formats/ap_dsk35.h" +#include "imagedev/flopdrv.h" + + +#ifdef MAME_DEBUG +#define LOG_SONY 1 +#define LOG_SONY_EXTRA 0 +#else +#define LOG_SONY 0 +#define LOG_SONY_EXTRA 0 +#endif + +/* + These lines are normally connected to the PHI0-PHI3 lines of the IWM +*/ +enum +{ + SONY_CA0 = 0x01, + SONY_CA1 = 0x02, + SONY_CA2 = 0x04, + SONY_LSTRB = 0x08 +}; + +/* + Structure that describes the state of a floppy drive, and the associated + disk image +*/ +struct floppy_t +{ + device_t *img; + emu_file *fd; + + unsigned int disk_switched : 1; /* disk-in-place status bit */ + unsigned int head : 1; /* active head (-> floppy side) */ + unsigned int step : 1; + int motor_on; + + unsigned int loadedtrack_valid : 1; /* is data in track buffer valid ? */ + unsigned int loadedtrack_dirty : 1; /* has data in track buffer been modified? */ + size_t loadedtrack_size; /* size of loaded track */ + size_t loadedtrack_pos; /* position within loaded track */ + UINT8 *loadedtrack_data; /* pointer to track buffer */ + + int is_fdhd; /* is drive an FDHD? */ + int is_400k; /* drive is single-sided, which means 400K */ +}; + +struct sonydriv_t +{ + int lines; /* four lines SONY_CA0 - SONY_LSTRB */ + + int floppy_enable; /* whether a drive is enabled or not (-> enable line) */ + int floppy_select; /* which drive is enabled */ + + int sel_line; /* one single line Is 0 or 1 */ + + unsigned int rotation_speed; /* drive rotation speed - ignored if ext_speed_control == 0 */ + floppy_t floppy[2]; /* data for two floppy disk units */ +}; +static sonydriv_t sony; + +/* bit of code used in several places - I am unsure why it is here */ +static int sony_enable2(void) +{ + return (sony.lines & SONY_CA1) && (sony.lines & SONY_LSTRB); +} + +static void load_track_data(device_t *device,int floppy_select) +{ + int track_size; + legacy_floppy_image_device *cur_image; + UINT8 *new_data; + floppy_t *f; + + f = &sony.floppy[floppy_select]; + cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, floppy_select); + + floppy_image_legacy *fimg = cur_image->flopimg_get_image(); + + if (!fimg) + { + return; + } + + track_size = floppy_get_track_size(fimg, f->head, cur_image->floppy_drive_get_current_track()); + if (f->loadedtrack_data) auto_free(device->machine(),f->loadedtrack_data); + new_data = auto_alloc_array(device->machine(),UINT8,track_size); + if (!new_data) + { + return; + } + + cur_image->floppy_drive_read_track_data_info_buffer(f->head, new_data, &track_size); + f->loadedtrack_valid = 1; + f->loadedtrack_dirty = 0; + f->loadedtrack_size = track_size; + f->loadedtrack_data = new_data; + f->loadedtrack_pos = 0; +} + + + +static void save_track_data(device_t *device, int floppy_select) +{ + legacy_floppy_image_device *cur_image; + floppy_t *f; + int len; + + f = &sony.floppy[floppy_select]; + cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, floppy_select); + + if (f->loadedtrack_dirty) + { + len = f->loadedtrack_size; + cur_image->floppy_drive_write_track_data_info_buffer(f->head, f->loadedtrack_data, &len); + f->loadedtrack_dirty = 0; + } +} + + + +UINT8 sony_read_data(device_t *device) +{ + UINT8 result = 0; + legacy_floppy_image_device *cur_image; + floppy_t *f; + + if (sony_enable2() || (! sony.floppy_enable)) + return 0xFF; /* right ??? */ + + f = &sony.floppy[sony.floppy_select]; + cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select); + if (!cur_image->exists()) + return 0xFF; + + if (!f->loadedtrack_valid) + load_track_data(device, sony.floppy_select); + + if (!f->loadedtrack_data) + { + return 0xFF; + } + + result = sony_fetchtrack(f->loadedtrack_data, f->loadedtrack_size, &f->loadedtrack_pos); + return result; +} + + + +void sony_write_data(device_t *device,UINT8 data) +{ + device_image_interface *cur_image; + floppy_t *f; + + f = &sony.floppy[sony.floppy_select]; + cur_image = dynamic_cast(floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select)); + if (!cur_image->exists()) + return; + + if (!f->loadedtrack_valid) + load_track_data(device,sony.floppy_select); + + if (!f->loadedtrack_data) + { + return; + } + + sony_filltrack(f->loadedtrack_data, f->loadedtrack_size, &f->loadedtrack_pos, data); + f->loadedtrack_dirty = 1; +} + + + +static int sony_rpm(floppy_t *f, legacy_floppy_image_device *cur_image) +{ + int result = 0; + /* + * The Mac floppy controller was interesting in that its speed was adjusted + * while the thing was running. On the tracks closer to the rim, it was + * sped up so that more data could be placed on it. Hence, this function + * has different results depending on the track number + * + * The Mac Plus (and probably the other Macs that use the IWM) verify that + * the speed of the floppy drive is within a certain range depending on + * what track the floppy is at. These RPM values are just guesses and are + * probably not fully accurate, but they are within the range that the Mac + * Plus expects and thus are probably in the right ballpark. + * + * Note - the timing values are the values returned by the Mac Plus routine + * that calculates the speed; I'm not sure what units they are in + */ + + if ((f->is_400k) && (sony.rotation_speed)) + { + /* 400k unit : rotation speed should be controlled by computer */ + result = sony.rotation_speed; + } + else + { /* 800k unit : rotation speed controlled by drive */ +#if 1 /* Mac Plus */ + static const int speeds[] = + { + 500, /* 00-15: timing value 117B (acceptable range {1135-11E9} */ + 550, /* 16-31: timing value ???? (acceptable range {12C6-138A} */ + 600, /* 32-47: timing value ???? (acceptable range {14A7-157F} */ + 675, /* 48-63: timing value ???? (acceptable range {16F2-17E2} */ + 750 /* 64-79: timing value ???? (acceptable range {19D0-1ADE} */ + }; +#else /* Lisa 2 */ + /* 237 + 1.3*(256-reg) */ + static const int speeds[] = + { + 293, /* 00-15: timing value ???? (acceptable range {0330-0336} */ + 322, /* 16-31: timing value ???? (acceptable range {02ED-02F3} */ + 351, /* 32-47: timing value ???? (acceptable range {02A7-02AD} */ + 394, /* 48-63: timing value ???? (acceptable range {0262-0266} */ + 439 /* 64-79: timing value ???? (acceptable range {021E-0222} */ + }; +#endif + if (cur_image && cur_image->exists()) + result = speeds[cur_image->floppy_drive_get_current_track() / 16]; + } + return result; +} + +int sony_read_status(device_t *device) +{ + int result = 1; + int action; + floppy_t *f; + legacy_floppy_image_device *cur_image; + + action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2); + + if (LOG_SONY_EXTRA) + { + printf("sony.status(): action=%x pc=0x%08x%s\n", + action, (int) device->machine().firstcpu->pc(), sony.floppy_enable ? "" : " (no drive enabled)"); + } + + if ((! sony_enable2()) && sony.floppy_enable) + { + f = &sony.floppy[sony.floppy_select]; + cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select); + if (!cur_image->exists()) + cur_image = NULL; + + switch(action) { + case 0x00: /* Step direction */ + result = f->step; + break; + case 0x01: /* Lower head activate */ + if (f->head != 0) + { + save_track_data(device,sony.floppy_select); + f->head = 0; + f->loadedtrack_valid = 0; + } + result = 0; + break; + case 0x02: /* Disk in place */ + result = cur_image ? 0 : 1; /* 0=disk 1=nodisk */ + break; + case 0x03: /* Upper head activate (not on 400k) */ + if ((f->head != 1) && !(f->is_400k)) + { + save_track_data(device,sony.floppy_select); + f->head = 1; + f->loadedtrack_valid = 0; + } + result = 0; + break; + case 0x04: /* Disk is stepping 0=stepping 1=not stepping*/ + result = 1; + break; + case 0x05: /* Drive is SuperDrive: 0 = 400/800k, 1 = SuperDrive */ + result = f->is_fdhd ? 1: 0; + break; + case 0x06: /* Disk is locked 0=locked 1=unlocked */ + if (cur_image) + result = cur_image->floppy_wpt_r(); + else + result = 0; + break; + case 0x08: /* Motor on 0=on 1=off */ + result = f->motor_on; + break; + case 0x09: /* Number of sides: 0=single sided, 1=double sided */ + if (cur_image) + { + floppy_image_legacy *fimg = cur_image->flopimg_get_image(); + if (fimg) + { + result = floppy_get_heads_per_disk(fimg) - 1; + f->is_400k = result ? 0 : 1; + } + } + break; + case 0x0a: /* At track 0: 0=track zero 1=not track zero */ + logerror("%s sony.status(): reading Track 0\n", device->machine().describe_context()); + if (cur_image) + result = cur_image->floppy_tk00_r(); + else + result = 0; + break; + case 0x0b: /* Disk ready: 0=ready, 1=not ready */ + result = 0; + break; + case 0x0c: /* Disk switched */ + { + if (cur_image) + { + if (!cur_image->floppy_dskchg_r()) + { + f->disk_switched = 1; + } + } + result = f->disk_switched; + } + break; + case 0x0d: /* Unknown */ + /* I'm not sure what this one does, but the Mac Plus executes the + * following code that uses this status: + * + * 417E52: moveq #$d, D0 ; Status 0x0d + * 417E54: bsr 4185fe ; Query IWM status + * 417E58: bmi 417e82 ; If result=1, then skip + * + * This code is called in the Sony driver's open method, and + * _AddDrive does not get called if this status 0x0d returns 1. + * Hence, we are returning 0 + */ + result = 0; + break; + case 0x0e: /* Tachometer */ + /* (time in seconds) / (60 sec/minute) * (rounds/minute) * (60 pulses) * (2 pulse phases) */ + if (cur_image) + { + result = ((int) (device->machine().time().as_double() / 60.0 * sony_rpm(f, cur_image) * 60.0 * 2.0)) & 1; + } + break; + case 0x0f: /* 400k/800k: Drive installed: 0=drive connected, 1=drive not connected */ + /* FDHD: Inserted disk density: 0=HD, 1=DD */ + if (f->is_fdhd) + { + result = 1; + } + else + { + result = 0; + } + break; + default: + if (LOG_SONY) + logerror("sony_status(): unknown action\n"); + break; + } + } + + return result; +} + +static void sony_doaction(device_t *device) +{ + int action; + floppy_t *f; + legacy_floppy_image_device *cur_image; + + action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | ((sony.lines & SONY_CA2) >> 2) | (sony.sel_line << 1); + + if (LOG_SONY) + { + logerror("%s sony_doaction(): action=%d %s\n", + device->machine().describe_context(), action, (sony.floppy_enable) ? "" : " (MOTOR OFF)"); + } + + if (sony.floppy_enable) + { + f = &sony.floppy[sony.floppy_select]; + cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select); + if (!cur_image->exists()) + cur_image = NULL; + + switch(action) + { + case 0x00: /* Set step inward (higher tracks) */ + f->step = 0; + break; + case 0x01: /* Set step outward (lower tracks) */ + f->step = 1; + break; + case 0x03: /* Reset diskswitched */ + f->disk_switched = 0; + break; + case 0x04: /* Step disk */ + if (cur_image) + { + save_track_data(device,sony.floppy_select); + if (f->step) + cur_image->floppy_drive_seek(-1); + else + cur_image->floppy_drive_seek(+1); + f->loadedtrack_valid = 0; + } + break; + case 0x08: /* Turn motor on */ + f->motor_on = CLEAR_LINE; + if (cur_image) + cur_image->floppy_mon_w(f->motor_on); + break; + case 0x09: /* Turn motor off */ + f->motor_on = ASSERT_LINE; + if (cur_image) + cur_image->floppy_mon_w(f->motor_on); + break; + case 0x0d: /* Eject disk */ + if (cur_image) + cur_image->unload(); + break; + default: + if (LOG_SONY) + logerror("sony_doaction(): unknown action %d\n", action); + break; + } + } +} + +void sony_set_lines(device_t *device,UINT8 lines) +{ + int old_sony_lines = sony.lines; + + sony.lines = lines & 0x0F; + + { + //int action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2); + //printf("sony.set_lines: %02x, action now %d\n", lines&0xf, action); + } + + /* have we just set LSTRB ? */ + if ((sony.lines & ~old_sony_lines) & SONY_LSTRB) + { + /* if so, write drive reg */ + sony_doaction(device); + } + + if (LOG_SONY_EXTRA) + logerror("sony.set_lines(): %d\n", lines); +} + +void sony_set_enable_lines(device_t *device,int enable_mask) +{ + switch (enable_mask) + { + case 0: + default: /* well, we have to do something, right ? */ + sony.floppy_enable = 0; + break; + case 1: + sony.floppy_enable = 1; + sony.floppy_select = 0; + break; + case 2: + sony.floppy_enable = 1; + sony.floppy_select = 1; + break; + } + + if (LOG_SONY_EXTRA) + logerror("sony.set_enable_lines(): %d\n", enable_mask); +} + +void sony_set_sel_line(device_t *device,int sel) +{ + sony.sel_line = sel ? 1 : 0; + + { + //int action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2); + //printf("sony.set_sel_line: %d, action now %d\n", sony.sel_line, action); + } + + if (LOG_SONY_EXTRA) + logerror("sony.set_sel_line(): %s line IWM_SEL\n", sony.sel_line ? "setting" : "clearing"); +} + +void sony_set_speed(int speed) +{ + sony.rotation_speed = speed; +} + +// device type definition +const device_type FLOPPY_SONY = &device_creator; + +//------------------------------------------------- +// sonydriv_floppy_image_device - constructor +//------------------------------------------------- + +sonydriv_floppy_image_device::sonydriv_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : legacy_floppy_image_device(mconfig, FLOPPY_SONY, "Floppy Disk [Sony]", tag, owner, clock, "floppy_sonny", __FILE__) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sonydriv_floppy_image_device::device_start() +{ + legacy_floppy_image_device::device_start(); + floppy_set_type(FLOPPY_TYPE_SONY); + + sony.floppy[0].is_fdhd = 0; + sony.floppy[1].is_fdhd = 0; + sony.floppy[0].is_400k = 0; + sony.floppy[1].is_400k = 0; + sony.floppy[0].loadedtrack_data = NULL; + sony.floppy[1].loadedtrack_data = NULL; + sony.floppy[0].head = 0; + sony.floppy[1].head = 0; + sony.rotation_speed = 0; +} + +void sonydriv_floppy_image_device::call_unload() +{ + int id; + device_t *fdc; + + /* locate the FDC */ + fdc = machine().device("fdc"); + + id = floppy_get_drive_by_type(this,FLOPPY_TYPE_SONY); + save_track_data(fdc, id); + memset(&sony.floppy[id], 0, sizeof(sony.floppy[id])); + + legacy_floppy_image_device::call_unload(); +} diff --git a/src/mame/machine/sonydriv.h b/src/mame/machine/sonydriv.h new file mode 100644 index 00000000000..52ecca6697a --- /dev/null +++ b/src/mame/machine/sonydriv.h @@ -0,0 +1,71 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/********************************************************************* + + sonydriv.h + + Apple/Sony 3.5" floppy drive emulation (to be interfaced with applefdc.c) + +*********************************************************************/ + +#ifndef SONYDRIV_H +#define SONYDRIV_H + +#include "imagedev/flopdrv.h" + +#if 0 +enum +{ + SONY_FLOPPY_ALLOW400K = 0x0001, + SONY_FLOPPY_ALLOW800K = 0x0002, + + SONY_FLOPPY_SUPPORT2IMG = 0x4000, + SONY_FLOPPY_EXT_SPEED_CONTROL = 0x8000 // means the speed is controlled by computer +}; +#endif + +void sony_set_lines(device_t *device,UINT8 lines); +void sony_set_enable_lines(device_t *device,int enable_mask); +void sony_set_sel_line(device_t *device,int sel); + +void sony_set_speed(int speed); + +UINT8 sony_read_data(device_t *device); +void sony_write_data(device_t *device,UINT8 data); +int sony_read_status(device_t *device); + +class sonydriv_floppy_image_device : public legacy_floppy_image_device +{ +public: + // construction/destruction + sonydriv_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void call_unload(); +protected: + virtual void device_start(); +}; + +// device type definition +extern const device_type FLOPPY_SONY; + +#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(_config) \ + MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_SONY, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_SONY, 0) \ + MCFG_DEVICE_CONFIG(_config) + +#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(_config) \ + MCFG_DEVICE_ADD(FLOPPY_2, FLOPPY_SONY, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_DEVICE_ADD(FLOPPY_3, FLOPPY_SONY, 0) \ + MCFG_DEVICE_CONFIG(_config) + +#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_MODIFY(_config) \ + MCFG_DEVICE_MODIFY(FLOPPY_0) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_DEVICE_MODIFY(FLOPPY_1) \ + MCFG_DEVICE_CONFIG(_config) + + + +#endif /* SONYDRIV_H */ diff --git a/src/mame/machine/sorcerer.c b/src/mame/machine/sorcerer.c new file mode 100644 index 00000000000..25fb66015e3 --- /dev/null +++ b/src/mame/machine/sorcerer.c @@ -0,0 +1,492 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker, Robbbert +/****************************************************************************** + + Exidy Sorcerer machine functions + +*******************************************************************************/ + +#include "includes/sorcerer.h" +#include "machine/z80bin.h" + +#if SORCERER_USING_RS232 + +/* The serial code (which was never connected to the outside) is disabled for now. */ + +/* timer for sorcerer serial chip transmit and receive */ + +TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_serial_tc) +{ + /* if rs232 is enabled, uart is connected to clock defined by bit6 of port fe. + Transmit and receive clocks are connected to the same clock */ + + /* if rs232 is disabled, receive clock is linked to cassette hardware */ + if (m_fe & 0x80) + { + /* connect to rs232 */ + } +} +#endif + + +void sorcerer_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SERIAL: +#if SORCERER_USING_RS232 + sorcerer_serial_tc(ptr, param); +#endif + break; + case TIMER_CASSETTE: + sorcerer_cassette_tc(ptr, param); + break; + case TIMER_RESET: + sorcerer_reset(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in sorcerer_state::device_timer"); + } +} + + +/* timer to read cassette waveforms */ + +TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_cassette_tc) +{ + UINT8 cass_ws = 0; + switch (m_fe & 0xc0) /*/ bit 7 low indicates cassette */ + { + case 0x00: /* Cassette 300 baud */ + + /* loading a tape - this is basically the same as the super80. + We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */ + + m_cass_data.input.length++; + + cass_ws = ((((m_fe & 0x20) ? m_cassette2 : m_cassette1))->input() > +0.02) ? 1 : 0; + + if (cass_ws != m_cass_data.input.level) + { + m_cass_data.input.level = cass_ws; + m_cass_data.input.bit = ((m_cass_data.input.length < 0x6) || (m_cass_data.input.length > 0x20)) ? 1 : 0; + m_cass_data.input.length = 0; + m_uart->set_input_pin(AY31015_SI, m_cass_data.input.bit); + } + + /* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies. + Synchronisation of the frequency pulses to the uart is extremely important. */ + + m_cass_data.output.length++; + if (!(m_cass_data.output.length & 0x1f)) + { + cass_ws = m_uart->get_output_pin(AY31015_SO); + if (cass_ws != m_cass_data.output.bit) + { + m_cass_data.output.bit = cass_ws; + m_cass_data.output.length = 0; + } + } + + if (!(m_cass_data.output.length & 3)) + { + if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 4))) + { + m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit + ((m_fe & 0x20) ? m_cassette2 : m_cassette1)->output(m_cass_data.output.level ? -1.0 : +1.0); + } + } + return; + + case 0x40: /* Cassette 1200 baud */ + /* loading a tape */ + m_cass_data.input.length++; + + cass_ws = ((((m_fe & 0x20) ? m_cassette2 : m_cassette1))->input() > +0.02) ? 1 : 0; + + if (cass_ws != m_cass_data.input.level || m_cass_data.input.length == 10) + { + m_cass_data.input.bit = ((m_cass_data.input.length < 10) || (m_cass_data.input.length > 0x20)) ? 1 : 0; + if ( cass_ws != m_cass_data.input.level ) + { + m_cass_data.input.length = 0; + m_cass_data.input.level = cass_ws; + } + m_uart->set_input_pin(AY31015_SI, m_cass_data.input.bit); + } + + /* saving a tape - convert the serial stream from the uart, into 600 and 1200 Hz frequencies. */ + + m_cass_data.output.length++; + if (!(m_cass_data.output.length & 7)) + { + cass_ws = m_uart->get_output_pin(AY31015_SO); + if (cass_ws != m_cass_data.output.bit) + { + m_cass_data.output.bit = cass_ws; + m_cass_data.output.length = 0; + } + } + + if (!(m_cass_data.output.length & 7)) + { + if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 8))) + { + m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit + ((m_fe & 0x20) ? m_cassette2 : m_cassette1)->output(m_cass_data.output.level ? -1.0 : +1.0); + } + } + return; + } +} + + +/* after the first 4 bytes have been read from ROM, switch the ram back in */ +TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_reset) +{ + membank("boot")->set_entry(0); +} + +WRITE8_MEMBER(sorcerer_state::sorcerer_fc_w) +{ + m_uart->set_transmit_data(data); +} + + +WRITE8_MEMBER(sorcerer_state::sorcerer_fd_w) +{ + /* Translate data to control signals */ + + m_uart->set_input_pin(AY31015_CS, 0); + m_uart->set_input_pin(AY31015_NB1, BIT(data, 0)); + m_uart->set_input_pin(AY31015_NB2, BIT(data, 1)); + m_uart->set_input_pin(AY31015_TSB, BIT(data, 2)); + m_uart->set_input_pin(AY31015_EPS, BIT(data, 3)); + m_uart->set_input_pin(AY31015_NP, BIT(data, 4)); + m_uart->set_input_pin(AY31015_CS, 1); +} + +WRITE8_MEMBER(sorcerer_state::sorcerer_fe_w) +{ + UINT8 changed_bits = (m_fe ^ data) & 0xf0; + m_fe = data; + + /* bits 0..3 */ + m_keyboard_line = data & 0x0f; + + if (!changed_bits) return; + + /* bits 4..5 */ + /* does user want to hear the sound? */ + + if (!BIT(data, 7)) // cassette operations + { +#if SORCERER_USING_RS232 + m_serial_timer->adjust(attotime::zero); +#endif + + bool sound = BIT(m_iop_config->read(), 3); + + m_cassette1->change_state( + (BIT(data,4) & sound) ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); + + m_cassette2->change_state( + (BIT(data,5) & sound) ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); + + /* cassette 1 motor */ + m_cassette1->change_state( + (BIT(data,4)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + /* cassette 2 motor */ + m_cassette2->change_state( + (BIT(data,5)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + + if (data & 0x30) + m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(19200)); + else + m_cassette_timer->adjust(attotime::zero); + } +#if SORCERER_USING_RS232 + else + { + m_serial_timer->adjust(attotime::zero, 0, attotime::from_hz(19200)); + m_cassette_timer->adjust(attotime::zero); + } +#endif + + // bit 6 baud rate */ + if (BIT(changed_bits, 6)) + { + m_uart->set_receiver_clock(BIT(data, 6) ? 19200.0 : 4800.0); + m_uart->set_transmitter_clock(BIT(data, 6) ? 19200.0 : 4800.0); + } +} + +WRITE8_MEMBER(sorcerer_state::sorcerer_ff_w) +{ + /// TODO: create a sorcerer parallel slot with a 7 bit and 8 bit centronics adapter as two of the options + /// TODO: figure out what role FE plays http://www.trailingedge.com/exidy/exidych7.html + m_centronics->write_data0(BIT(data, 0)); + m_centronics->write_data1(BIT(data, 1)); + m_centronics->write_data2(BIT(data, 2)); + m_centronics->write_data3(BIT(data, 3)); + m_centronics->write_data4(BIT(data, 4)); + m_centronics->write_data5(BIT(data, 5)); + m_centronics->write_data6(BIT(data, 6)); + + /* reading the config switch */ + switch (m_iop_config->read() & 0x02) + { + case 0: /* 7-bit port */ + /* bit 7 = strobe, bit 6..0 = data */ + m_centronics->write_data7(0); + m_centronics->write_strobe(BIT(data, 7)); + break; + + case 2: /* 8-bit port */ + /* hardware strobe driven from port select, bit 7..0 = data */ + m_centronics->write_data7(BIT(data, 7)); + m_centronics->write_strobe(0); + m_centronics->write_strobe(1); + break; + } +} + +READ8_MEMBER(sorcerer_state::sorcerer_fc_r) +{ + UINT8 data = m_uart->get_received_data(); + m_uart->set_input_pin(AY31015_RDAV, 0); + m_uart->set_input_pin(AY31015_RDAV, 1); + return data; +} + +READ8_MEMBER(sorcerer_state::sorcerer_fd_r) +{ + /* set unused bits high */ + UINT8 data = 0xe0; + + m_uart->set_input_pin(AY31015_SWE, 0); + data |= m_uart->get_output_pin(AY31015_TBMT) ? 0x01 : 0; + data |= m_uart->get_output_pin(AY31015_DAV ) ? 0x02 : 0; + data |= m_uart->get_output_pin(AY31015_OR ) ? 0x04 : 0; + data |= m_uart->get_output_pin(AY31015_FE ) ? 0x08 : 0; + data |= m_uart->get_output_pin(AY31015_PE ) ? 0x10 : 0; + m_uart->set_input_pin(AY31015_SWE, 1); + + return data; +} + +READ8_MEMBER(sorcerer_state::sorcerer_fe_r) +{ + /* bits 6..7 + - hardware handshakes from user port + - not emulated + - tied high, allowing PARIN and PAROUT bios routines to run */ + + UINT8 data = 0xc0; + + /* bit 5 - vsync */ + data |= m_iop_vs->read(); + + /* bits 4..0 - keyboard data */ + data |= m_iop_x[m_keyboard_line]->read(); + + return data; +} + +/****************************************************************************** + Snapshot Handling +******************************************************************************/ + +SNAPSHOT_LOAD_MEMBER( sorcerer_state,sorcerer) +{ + UINT8 *RAM = memregion(m_maincpu->tag())->base(); + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 header[28]; + unsigned char s_byte; + + /* check size */ + if (snapshot_size != 0x1001c) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Snapshot must be 65564 bytes"); + image.message("Snapshot must be 65564 bytes"); + return IMAGE_INIT_FAIL; + } + + /* get the header */ + image.fread( &header, sizeof(header)); + + /* write it to ram */ + for (int i = 0; i < 0xc000; i++) + { + image.fread( &s_byte, 1); + space.write_byte(i, s_byte); + } + image.fread( RAM+0xc000, 0x4000); + + /* patch CPU registers */ + m_maincpu->set_state_int(Z80_I, header[0]); + m_maincpu->set_state_int(Z80_HL2, header[1] | (header[2] << 8)); + m_maincpu->set_state_int(Z80_DE2, header[3] | (header[4] << 8)); + m_maincpu->set_state_int(Z80_BC2, header[5] | (header[6] << 8)); + m_maincpu->set_state_int(Z80_AF2, header[7] | (header[8] << 8)); + m_maincpu->set_state_int(Z80_HL, header[9] | (header[10] << 8)); + m_maincpu->set_state_int(Z80_DE, header[11] | (header[12] << 8)); + m_maincpu->set_state_int(Z80_BC, header[13] | (header[14] << 8)); + m_maincpu->set_state_int(Z80_IY, header[15] | (header[16] << 8)); + m_maincpu->set_state_int(Z80_IX, header[17] | (header[18] << 8)); + m_maincpu->set_state_int(Z80_IFF1, header[19]&2 ? 1 : 0); + m_maincpu->set_state_int(Z80_IFF2, header[19]&4 ? 1 : 0); + m_maincpu->set_state_int(Z80_R, header[20]); + m_maincpu->set_state_int(Z80_AF, header[21] | (header[22] << 8)); + m_maincpu->set_state_int(STATE_GENSP, header[23] | (header[24] << 8)); + m_maincpu->set_state_int(Z80_IM, header[25]); + m_maincpu->set_pc(header[26] | (header[27] << 8)); + + return IMAGE_INIT_PASS; +} + +void sorcerer_state::machine_start() +{ + m_cassette_timer = timer_alloc(TIMER_CASSETTE); +#if SORCERER_USING_RS232 + m_serial_timer = timer_alloc(TIMER_SERIAL); +#endif + + UINT16 endmem = 0xbfff; + + address_space &space = m_maincpu->space(AS_PROGRAM); + /* configure RAM */ + switch (m_ram->size()) + { + case 8*1024: + space.unmap_readwrite(0x2000, endmem); + break; + + case 16*1024: + space.unmap_readwrite(0x4000, endmem); + break; + + case 32*1024: + space.unmap_readwrite(0x8000, endmem); + break; + } + + if (m_cart->exists()) + space.install_read_handler(0xc000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +MACHINE_START_MEMBER(sorcerer_state,sorcererd) +{ + m_cassette_timer = timer_alloc(TIMER_CASSETTE); +#if SORCERER_USING_RS232 + m_serial_timer = timer_alloc(TIMER_SERIAL); +#endif + + UINT16 endmem = 0xbbff; + + address_space &space = m_maincpu->space(AS_PROGRAM); + /* configure RAM */ + switch (m_ram->size()) + { + case 8*1024: + space.unmap_readwrite(0x2000, endmem); + break; + + case 16*1024: + space.unmap_readwrite(0x4000, endmem); + break; + + case 32*1024: + space.unmap_readwrite(0x8000, endmem); + break; + } + + if (m_cart->exists()) + space.install_read_handler(0xc000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); +} + +void sorcerer_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + /* Initialize cassette interface */ + m_cass_data.output.length = 0; + m_cass_data.output.level = 1; + m_cass_data.input.length = 0; + m_cass_data.input.bit = 1; + + m_fe = 0xff; + sorcerer_fe_w(space, 0, 0, 0xff); + + membank("boot")->set_entry(1); + timer_set(attotime::from_usec(10), TIMER_RESET); +} + + +/*------------------------------------------------- + QUICKLOAD_LOAD_MEMBER( sorcerer_state, sorcerer ) +-------------------------------------------------*/ + +QUICKLOAD_LOAD_MEMBER( sorcerer_state, sorcerer ) +{ + UINT16 execute_address, start_address, end_address; + int autorun; + address_space &space = m_maincpu->space(AS_PROGRAM); + + /* load the binary into memory */ + if (z80bin_load_file(&image, space, file_type, &execute_address, &start_address, &end_address) == IMAGE_INIT_FAIL) + return IMAGE_INIT_FAIL; + + /* is this file executable? */ + if (execute_address != 0xffff) + { + /* check to see if autorun is on (I hate how this works) */ + autorun = m_iop_config->read() & 1; + + if ((execute_address >= 0xc000) && (execute_address <= 0xdfff) && (space.read_byte(0xdffa) != 0xc3)) + return IMAGE_INIT_FAIL; /* can't run a program if the cartridge isn't in */ + + /* Since Exidy Basic is by Microsoft, it needs some preprocessing before it can be run. + 1. A start address of 01D5 indicates a basic program which needs its pointers fixed up. + 2. If autorunning, jump to C689 (command processor), else jump to C3DD (READY prompt). + Important addresses: + 01D5 = start (load) address of a conventional basic program + C858 = an autorun basic program will have this exec address on the tape + C3DD = part of basic that displays READY and lets user enter input */ + + if ((start_address == 0x1d5) || (execute_address == 0xc858)) + { + UINT8 i; + static const UINT8 data[]={ + 0xcd, 0x26, 0xc4, // CALL C426 ;set up other pointers + 0x21, 0xd4, 1, // LD HL,01D4 ;start of program address (used by C689) + 0x36, 0, // LD (HL),00 ;make sure dummy end-of-line is there + 0xc3, 0x89, 0xc6 // JP C689 ;run program + }; + + for (i = 0; i < ARRAY_LENGTH(data); i++) + space.write_byte(0xf01f + i, data[i]); + + if (!autorun) + space.write_word(0xf028,0xc3dd); + + /* tell BASIC where program ends */ + space.write_byte(0x1b7, end_address & 0xff); + space.write_byte(0x1b8, (end_address >> 8) & 0xff); + + if ((execute_address != 0xc858) && autorun) + space.write_word(0xf028, execute_address); + + m_maincpu->set_pc(0xf01f); + } + else + { + if (autorun) + m_maincpu->set_pc(execute_address); + } + + } + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/spec_snqk.c b/src/mame/machine/spec_snqk.c new file mode 100644 index 00000000000..2bdbd725683 --- /dev/null +++ b/src/mame/machine/spec_snqk.c @@ -0,0 +1,2565 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/*************************************************************************** + + mess/machine/spec_snqk.c + + TODO: + + - Implement the following snapshot formats + .89C (Tezxas) + .SLT (Various emulators) + .SZX (Spectaculator) + .ZLS (ZX-Live!) + .ZX (ZXSpectr) + .ZX82 (Speculator '97) + .ZXS (ZX32) + + - Implement the following quickload formats + .$? (HoBeta) + .__? (SpecEm) + .BAS (BASin) + .H/.B (Roman ZX) + .RAW (Various emulators) + .SCR variants + + - Cleanup of the .Z80 format + +***************************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "cpu/z80/z80.h" +#include "includes/spectrum.h" +#include "sound/ay8910.h" +#include "machine/spec_snqk.h" + +#define LOAD_REG(_cpu, _reg, _data) \ + do { \ + _cpu->set_state_int(_reg, (_data)); \ + } while (0) + +#define EXEC_NA "N/A" + +/*------------------------------------------------- + log_quickload - logs and displays useful + data for the end user +-------------------------------------------------*/ + +static void log_quickload(running_machine &machine, const char *type, UINT32 start, UINT32 length, UINT32 exec, const char *exec_format) +{ + std::string tempstring; + + logerror("Loading %04X bytes of RAM at %04X\n", length, start); + + strcatprintf(tempstring,"Quickload type: %s Length: %d bytes\n", type, length); + strcatprintf(tempstring,"Start: 0x%04X End: 0x%04X Exec: ", start, start + length - 1); + + logerror("Quickload loaded.\n"); + if (!core_stricmp(exec_format, EXEC_NA)) + tempstring.append("N/A"); + else + { + logerror("Execution can resume with "); + logerror(exec_format, exec); + logerror("\n"); + strcatprintf(tempstring,exec_format, exec); + } + + machine.ui().popup_time(10, "%s", tempstring.c_str()); +} + +/******************************************************************* + * + * Update the memory and paging of the spectrum being emulated + * + * if port_7ffd_data is -1 then machine is 48K - no paging + * if port_1ffd_data is -1 then machine is 128K + * if neither port is -1 then machine is +2a/+3 + * + * Note: the 128K .SNA and .Z80 file formats do not store the + * port 1FFD setting so it is necessary to calculate the appropriate + * value for the ROM paging. + * + *******************************************************************/ +static void spectrum_update_paging(running_machine &machine) +{ + spectrum_state *state = machine.driver_data(); + if (state->m_port_7ffd_data == -1) + return; + if (state->m_port_1ffd_data == -1) + state->spectrum_128_update_memory(); + + else + { + if (BIT(state->m_port_7ffd_data, 4)) + /* Page in Spec 48K basic ROM */ + state->m_port_1ffd_data = 0x04; + else + state->m_port_1ffd_data = 0x00; + state->spectrum_plus3_update_memory(); + } +} + +/* Page in the 48K Basic ROM. Used when running 48K snapshots on a 128K machine. */ +static void spectrum_page_basicrom(running_machine &machine) +{ + spectrum_state *state = machine.driver_data(); + if (state->m_port_7ffd_data == -1) + return; + state->m_port_7ffd_data |= 0x10; + spectrum_update_paging(machine); +} + + +SNAPSHOT_LOAD_MEMBER( spectrum_state,spectrum) +{ + dynamic_buffer snapshot_data(snapshot_size); + + image.fread(&snapshot_data[0], snapshot_size); + + if (!core_stricmp(file_type, "sna")) + { + if ((snapshot_size != SNA48_SIZE) && (snapshot_size != SNA128_SIZE_1) && (snapshot_size != SNA128_SIZE_2)) + { + logerror("Invalid .SNA file size.\n"); + goto error; + } + spectrum_setup_sna(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "sp")) + { + if ((snapshot_data[0] != 'S' && snapshot_data[1] != 'P') && (snapshot_size != SP_NEW_SIZE_16K && snapshot_size != SP_NEW_SIZE_48K)) + { + if (snapshot_size != SP_OLD_SIZE) + { + logerror("Invalid .SP file size.\n"); + goto error; + } + } + spectrum_setup_sp(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "ach")) + { + if (snapshot_size != ACH_SIZE) + { + logerror("Invalid .ACH file size.\n"); + goto error; + } + spectrum_setup_ach(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "prg")) + { + if (snapshot_size != PRG_SIZE) + { + logerror("Invalid .PRG file size.\n"); + goto error; + } + spectrum_setup_prg(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "plusd")) + { + if ((snapshot_size != PLUSD48_SIZE) && (snapshot_size != PLUSD128_SIZE)) + { + logerror("Invalid .PLUSD file size.\n"); + goto error; + } + spectrum_setup_plusd(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "sem")) + { + if (snapshot_data[0] != 0x05 && snapshot_data[1] != 'S' && \ + snapshot_data[2] != 'P' && snapshot_data[3] != 'E' && \ + snapshot_data[4] != 'C' && snapshot_data[5] != '1') + { + if (snapshot_size != SEM_SIZE) + { + logerror("Invalid .SEM file size.\n"); + goto error; + } + } + spectrum_setup_sem(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "sit")) + { + if (snapshot_size != SIT_SIZE) + { + logerror("Invalid .SIT file size.\n"); + goto error; + } + spectrum_setup_sit(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "zx")) + { + if (snapshot_size != ZX_SIZE) + { + logerror("Invalid .ZX file size.\n"); + goto error; + } + spectrum_setup_zx(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "snp")) + { + if (snapshot_size != SNP_SIZE) + { + logerror("Invalid .SNP file size.\n"); + goto error; + } + spectrum_setup_snp(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "snx")) + { + if (snapshot_data[0] != 'X' && snapshot_data[1] != 'S' && \ + snapshot_data[2] != 'N' && snapshot_data[3] != 'A') + { + logerror("Invalid .SNX file size.\n"); + goto error; + } + spectrum_setup_snx(machine(), &snapshot_data[0], snapshot_size); + } + else if (!core_stricmp(file_type, "frz")) + { + if (snapshot_size != FRZ_SIZE) + { + logerror("Invalid .FRZ file size.\n"); + goto error; + } + spectrum_setup_frz(machine(), &snapshot_data[0], snapshot_size); + } + else + { + spectrum_setup_z80(machine(), &snapshot_data[0], snapshot_size); + } + + return IMAGE_INIT_PASS; + +error: + return IMAGE_INIT_FAIL; +} + +/******************************************************************* + * + * Load a .SP file. + * + * There are two kinds of .SP files: "old" and "new". + * + * The old version is always 49184 bytes long and is created + * by a leaked copy of the VGASpec emulator. + * + * Subsequently Pedro Gimeno (the author of VGASpec) renamed it + * to "Spectrum" (but it's colloquially known as the "Spanish + * Spectrum emulator") and extended the header to break backward + * compatibility: the new format supports both 16K and 48K + * images and it's 16422 or 49190 bytes long. + * + * http://www.formauri.es/personal/pgimeno/spec/spec.html + * + * The formats are defined as follows: + * + * Offset Size Description (all registers stored with LSB first) + * ------------------- ------- ------------------------------------------------- + * VGASPEC SPECTRUM + * ------------------- ------- ------------------------------------------------- + * N/A 0 2 "SP" (signature) + * N/A 2 2 Program length + * N/A 4 2 Program location + * 0 6 2 BC + * 2 8 2 DE + * 4 10 2 HL + * 6 12 2 AF + * 8 14 2 IX + * 10 16 2 IY + * 12 18 2 BC' + * 14 20 2 DE' + * 16 22 2 HL' + * 18 24 2 AF' + * 20 26 1 R + * 21 27 1 I + * 22 28 2 SP + * 24 30 2 PC + * 26 32 2 0x00 (reserved for future use) + * 28 34 1 Border color + * 29 35 1 0x00 (reserved for future use) + * 30 36 2 Status word + * 32 38 16384/ RAM dump + * 49152 + * + * Status word: + * Bit Description + * ------- --------------------------------------------------- + * 15-8 Reserved for future use + * 7-6 Reserved for internal use (0) + * 5 Status of the flash attribute: 0=normal/1=inverse + * 4 Interrupt pending for execution + * 3 If 1, IM 0; if 0, bit 1 determines interrupt mode + * (Spectrum v0.99e had this behaviour reversed, + * and this bit was not used in versions previous + * to v 0.99e) + * 2 IFF2: 0=DI/1=EI + * 1 Interrupt mode (if bit 3 reset): 0=IM1/1=IM2 + * 0 IFF1: 0=DI/1=EI + * + *******************************************************************/ +static void spectrum_border_update(running_machine &machine, int data) +{ +#if 0 + spectrum_EventList_Reset(machine); + spectrum_border_set_last_color(machine, data); + spectrum_border_force_redraw(machine); +#endif +} + +void spectrum_setup_sp(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i, SP_OFFSET; + UINT8 intr; + UINT16 start, size, data, status; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + if (snapsize == SP_NEW_SIZE_16K || snapsize == SP_NEW_SIZE_48K) + { + SP_OFFSET = 0; + start = (snapdata[SP_OFFSET + 5] << 8) | snapdata[SP_OFFSET + 4]; + size = (snapdata[SP_OFFSET + 3] << 8) | snapdata[SP_OFFSET + 2]; + } + else + { + SP_OFFSET = SP_OLD_HDR - SP_NEW_HDR; + start = BASE_RAM; + size = 3*SPECTRUM_BANK; + } + + data = (snapdata[SP_OFFSET + 13] << 8) | snapdata[SP_OFFSET + 12]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[SP_OFFSET + 7] << 8) | snapdata[SP_OFFSET + 6]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[SP_OFFSET + 9] << 8) | snapdata[SP_OFFSET + 8]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[SP_OFFSET + 11] << 8) | snapdata[SP_OFFSET + 10]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[SP_OFFSET + 25] << 8) | snapdata[SP_OFFSET + 24]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[SP_OFFSET + 19] << 8) | snapdata[SP_OFFSET + 18]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[SP_OFFSET + 21] << 8) | snapdata[SP_OFFSET + 20]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[SP_OFFSET + 23] << 8) | snapdata[SP_OFFSET + 22]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[SP_OFFSET + 15] << 8) | snapdata[SP_OFFSET + 14]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[SP_OFFSET + 17] << 8) | snapdata[SP_OFFSET + 16]; + LOAD_REG(cpu, Z80_IY, data); + + + data = snapdata[SP_OFFSET + 26]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[SP_OFFSET + 27]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[SP_OFFSET + 29] << 8) | snapdata[SP_OFFSET + 28]; + LOAD_REG(cpu, Z80_SP, data); + + data = (snapdata[SP_OFFSET + 31] << 8) | snapdata[SP_OFFSET + 30]; + LOAD_REG(cpu, Z80_PC, data); + + + status = (snapdata[SP_OFFSET + 37] << 8) | snapdata[SP_OFFSET + 36]; + + data = (BIT(status, 3) << 1) | BIT(status, 1); + switch(data) + { + case 0: // case 2: in version 0.99e of the emulator + LOAD_REG(cpu, Z80_IM, 1); + break; + case 1: // case 3: in version 0.99e of the emulator + LOAD_REG(cpu, Z80_IM, 2); + break; + case 2: // case 0: in version 0.99e of the emulator + case 3: // case 1: in version 0.99e of the emulator + LOAD_REG(cpu, Z80_IM, (UINT64)0); + } + + data = BIT(status, 0); + LOAD_REG(cpu, Z80_IFF1, data); + + data = BIT(status, 2); + LOAD_REG(cpu, Z80_IFF2, data); + + intr = BIT(status, 4) ? ASSERT_LINE : CLEAR_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + data = BIT(status, 5); + state->m_flash_invert = data; + logerror("FLASH state: %s\n", data ? "PAPER on INK" : "INK on PAPER"); + + /* Memory dump */ + logerror("Loading %04X bytes of RAM at %04X\n", size, start); + for (i = 0; i < size; i++) + space.write_byte(start + i, snapdata[SP_OFFSET + SP_NEW_HDR + i]); + + /* Set border color */ + data = snapdata[SP_OFFSET + 34] & 0x07; + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + spectrum_page_basicrom(machine); + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); +} + +/******************************************************************* + * + * Load a .SNA file. + * + * This format was used by Arnt Gulbrandsen for its JPP + * emulator, and it's based on the format used by the Mirage + * Microdriver, a Microdrive backup accessory. + * + * http://www.worldofspectrum.org/infoseekid.cgi?id=1000266 + * + * The 48K image is always 49179 bytes long. + * + * .SNA snapshots save the PC on the top of the stack, thus + * deleting the original bytes: not a good feature for a snapshot... + * + * It's been reported that snapshots saved at critical moments would + * subsequently crash on restore due to the fact that the stack was full + * or pointed to a ROM address. A workaround for this situation is to + * store 0x0000 into the word where the PC was located. + * + * For sake of fidelity, the code that zeroes the top of the stack has + * been written but commented out. + * + * Later, the format has been extended to store the whole Spectrum 128 status. + * + * 48K format as follows: + * + * Offset Size Description (all registers stored with LSB first) + * ------- ------- ------------------------------------------------- + * 0 1 I + * 1 2 HL' + * 3 2 DE' + * 5 2 BC' + * 7 2 AF' + * 9 2 HL + * 11 2 DE + * 13 2 BC + * 15 2 IY + * 17 2 IX + * 19 1 IFF1/2: bit 0 contains IFF1, bit 2 contains IFF2 (0=DI/1=EI) + * 20 1 R + * 21 2 AF + * 23 2 SP + * 25 1 Interrupt mode (0=IM0/1=IM1/2=IM2) + * 26 1 Border color + * 27 49152 RAM dump + * + * PC is stored on stack. + * + * 128K format as follows: + * + * Offset Size Description (all registers stored with LSB first) + * ------- ------- ------------------------------------------------- + * 0 1 I + * 1 2 HL' + * 3 2 DE' + * 5 2 BC' + * 7 2 AF' + * 9 2 HL + * 11 2 DE + * 13 2 BC + * 15 2 IY + * 17 2 IX + * 19 1 IFF1/2: bit 0 contains IFF1, bit 2 contains IFF2 (0=DI/1=EI) + * 20 1 R + * 21 2 AF + * 23 2 SP + * 25 1 Interrupt mode (0=IM0/1=IM1/2=IM2) + * 26 1 Border color + * 27 16384 RAM bank 5 (0x4000-0x7fff) + * 16411 16384 RAM bank 2 (0x8000-0xbfff) + * 32795 16384 RAM bank n (0xc000-0xffff - currently paged bank) + * 49179 2 PC + * 49181 1 Port 0x7FFD data + * 49182 1 TR-DOS rom paged (0=no/1=yes) + * 49183 81920/ Remaining RAM banks in ascending order + * 98304 + * + * PC is NOT stored on stack. + * + * The bank in 0xc000 is always included even if it is page 2 or 5 + * in which case it is included twice. + * + *******************************************************************/ +void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i, j, usedbanks[8]; + long bank_offset; + UINT8 intr; + UINT16 data, addr; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + if ((snapsize != SNA48_SIZE) && (state->m_port_7ffd_data == -1)) + { + logerror("Can't load 128K .SNA file into 48K machine\n"); + return; + } + + + data = (snapdata[SNA48_OFFSET + 22] << 8) | snapdata[SNA48_OFFSET + 21]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[SNA48_OFFSET + 14] << 8) | snapdata[SNA48_OFFSET + 13]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[SNA48_OFFSET + 12] << 8) | snapdata[SNA48_OFFSET + 11]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[SNA48_OFFSET + 10] << 8) | snapdata[SNA48_OFFSET + 9]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[SNA48_OFFSET + 8] << 8) | snapdata[SNA48_OFFSET + 7]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[SNA48_OFFSET + 6] << 8) | snapdata[SNA48_OFFSET + 5]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[SNA48_OFFSET + 4] << 8) | snapdata[SNA48_OFFSET + 3]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[SNA48_OFFSET + 2] << 8) | snapdata[SNA48_OFFSET + 1]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[SNA48_OFFSET + 18] << 8) | snapdata[SNA48_OFFSET + 17]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[SNA48_OFFSET + 16] << 8) | snapdata[SNA48_OFFSET + 15]; + LOAD_REG(cpu, Z80_IY, data); + + + data = snapdata[SNA48_OFFSET + 20]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[SNA48_OFFSET + 0]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[SNA48_OFFSET + 24] << 8) | snapdata[SNA48_OFFSET + 23]; + LOAD_REG(cpu, Z80_SP, data); + + + data = snapdata[SNA48_OFFSET + 25] & 0x03; + if (data == 3) + data = 2; + LOAD_REG(cpu, Z80_IM, data); + + data = snapdata[SNA48_OFFSET + 19]; + LOAD_REG(cpu, Z80_IFF1, BIT(data, 0)); + LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); + + intr = BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + if (snapsize == SNA48_SIZE) + /* 48K Snapshot */ + spectrum_page_basicrom(machine); + else + { + /* 128K Snapshot */ + state->m_port_7ffd_data = snapdata[SNA128_OFFSET + 2]; + logerror ("Port 7FFD:%02X\n", state->m_port_7ffd_data); + if (snapdata[SNA128_OFFSET + 3]) + { + /* TODO: page TR-DOS ROM when supported */ + } + spectrum_update_paging(machine); + } + + if (snapsize == SNA48_SIZE) + { + /* Memory dump */ + logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[SNA48_HDR + i]); + + /* Get PC from stack */ + addr = cpu->state_int(Z80_SP); + + if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2) + logerror("Corrupted SP out of range:%04X", addr); + else + logerror("Fetching PC from the stack at SP:%04X\n", addr); + + data = (space.read_byte(addr + 1) << 8) | space.read_byte(addr + 0); + LOAD_REG(cpu, Z80_PC, data); + +#if 0 + space.write_byte(addr + 0, 0); // It's been reported that zeroing these locations fixes the loading + space.write_byte(addr + 1, 0); // of a few images that were snapshot at a "wrong" instant +#endif + + addr += 2; + logerror("Fixing SP:%04X\n", addr); + cpu->set_state_int(Z80_SP, addr); + + /* Set border color */ + data = snapdata[SNA48_OFFSET + 26] & 0x07; + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); + } + else + { + /* Set up other RAM banks */ + for (i = 0; i < 8; i++) + usedbanks[i] = 0; + + usedbanks[5] = 1; /* 0x4000-0x7fff */ + usedbanks[2] = 1; /* 0x8000-0xbfff */ + usedbanks[state->m_port_7ffd_data & 0x07] = 1; /* Banked memory */ + + logerror("Loading %05X bytes of RAM at %04X\n", 8*SPECTRUM_BANK, BASE_RAM); + logerror("Loading bank 5 from offset:0001B\n"); + logerror("Loading bank 2 from offset:0401B\n"); + logerror("Loading bank %d from offset:0801B\n", snapdata[SNA128_OFFSET + 2] & 0x07); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[SNA48_HDR + i]); + + bank_offset = SNA48_SIZE + SNA128_HDR; + for (i = 0; i < 8; i++) + { + if (!usedbanks[i]) + { + logerror("Loading bank %d from offset:%05lX\n", i, bank_offset); + state->m_port_7ffd_data &= 0xf8; + state->m_port_7ffd_data += i; + spectrum_update_paging(machine); + for (j = 0; j < SPECTRUM_BANK; j++) + space.write_byte(j + 3*SPECTRUM_BANK, snapdata[bank_offset + j]); + bank_offset += SPECTRUM_BANK; + } + } + + /* program counter */ + data = (snapdata[SNA128_OFFSET + 1] << 8) | snapdata[SNA128_OFFSET + 0]; + LOAD_REG(cpu, Z80_PC, data); + + /* Set border color */ + data = snapdata[SNA48_OFFSET + 26] & 0x07; + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + data = state->m_port_7ffd_data & 0x07; + + /* Reset paging */ + state->m_port_7ffd_data = snapdata[SNA128_OFFSET + 2]; + spectrum_update_paging(machine); + + //logerror("Snapshot loaded.\nExecution resuming at bank:%d %s\n", data, cpu_get_reg_string(cpu, Z80_PC)); + } +} + +/******************************************************************* + * + * Load a .ACH file. + * + * .ACH files were produced by a commercial Archimedes + * (hence the name) emulator called !Speccy. + * + * The files are always 65792 bytes long and store both + * a copy of the ROM and the whole 48K RAM. + * + * + * Offset Size Description (all registers stored with LSB first + * except when noted with *BE*) + * ------- ------- ------------------------------------------------- + * 0 4 A + * 4 4 F + * 8 4 B + * 12 4 C + * 16 4 D + * 20 4 E + * 24 4 H + * 28 4 L + * 32 4 PC + * 36 4 0x00 (reserved for future use) + * 40 4 SP + * 44 104 0x00 (reserved for future use) + * 148 4 R + * 152 4 0x00 (reserved for future use) + * 156 4 Border color + * 160 4 0x00 (reserved for future use) + * 164 2 Interrupt mode (0=IM0/1=IM1/2=IM2) + * 166 24 0x00 (reserved for future use) + * 190 1 I + * 191 1 IFF1/2: (0=DI/1=EI) + * 192 44 0x00 (reserved for future use) + * 236 4 AF' *BE* + * 240 4 BC' *BE* + * 244 2 DE' *BE* + * 246 2 HL' *BE* + * 248 4 IX + * 252 4 IY + * 256 16384 ROM dump + * 16640 49152 RAM dump + * + *******************************************************************/ +void spectrum_setup_ach(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i; + UINT8 intr; + UINT16 data; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + data = (snapdata[ACH_OFFSET + 0] << 8) | snapdata[ACH_OFFSET + 4]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[ACH_OFFSET + 8] << 8) | snapdata[ACH_OFFSET + 12]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[ACH_OFFSET + 16] << 8) | snapdata[ACH_OFFSET + 20]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[ACH_OFFSET + 24] << 8) | snapdata[ACH_OFFSET + 28]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[ACH_OFFSET + 236] << 8) | snapdata[ACH_OFFSET + 237]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[ACH_OFFSET + 240] << 8) | snapdata[ACH_OFFSET + 241]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[ACH_OFFSET + 244] << 8) | snapdata[ACH_OFFSET + 245]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[ACH_OFFSET + 246] << 8) | snapdata[ACH_OFFSET + 247]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[ACH_OFFSET + 249] << 8) | snapdata[ACH_OFFSET + 248]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[ACH_OFFSET + 253] << 8) | snapdata[ACH_OFFSET + 252]; + LOAD_REG(cpu, Z80_IY, data); + + data = snapdata[ACH_OFFSET + 148]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[ACH_OFFSET + 190]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[ACH_OFFSET + 41] << 8) | snapdata[ACH_OFFSET + 40]; + LOAD_REG(cpu, Z80_SP, data); + + data = (snapdata[ACH_OFFSET + 33] << 8) | snapdata[ACH_OFFSET + 32]; + LOAD_REG(cpu, Z80_PC, data); + + data = snapdata[ACH_OFFSET + 164] & 0x03; + if (data == 3) + data = 0; + LOAD_REG(cpu, Z80_IM, data); + + data = snapdata[ACH_OFFSET + 191] ? 1 : 0; + LOAD_REG(cpu, Z80_IFF1, data); + LOAD_REG(cpu, Z80_IFF2, data); + + intr = snapdata[ACH_OFFSET + 191] ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + logerror("Skipping the 16K ROM dump at offset:%04X\n", ACH_OFFSET + 256); + + /* Memory dump */ + logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[ACH_HDR + SPECTRUM_BANK + i]); + + /* Set border color */ + data = snapdata[ACH_OFFSET + 156] & 0x07; + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + spectrum_page_basicrom(machine); + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); +} + +/******************************************************************* + * + * Load a .PRG file. + * + * .PRG files were produced by an irish emulator called SpecEm + * written by Kevin Phair (thanks for the help, Kevin!) + * + * http://code.google.com/p/specem/ + * + * The files are always 49408 bytes long and use some stack space + * to store registers. + * + * The header actually mimics the file descriptor format used by + * the DISCiPLE/+D interface. + * + * Offset Size Description (all registers stored with LSB first + * except when noted with *BE*) + * ------- ------- ------------------------------------------------- + * 0 1 File type (always 0x05, corresponding to "48K Snapshot" + * 1 10 Program name (padded with 0x20) + * 11 2 Number of sectors occupied by the file *BE* + * 13 1 Track number of the first sector of the file + * 14 1 Sector number of the first sector of the file + * 15 195 Sector allocation bitmap + * 210 10 0x00 (reserved for future use) + * 220 2 IY + * 222 2 IX + * 224 2 DE' + * 226 2 BC' + * 228 2 HL' + * 230 2 AF' + * 232 2 DE + * 234 2 BC + * 236 2 HL + * 238 1 Junk created when saving I via LD A,I/PUSH AF + * 239 1 I + * 240 2 SP + * 242 14 0x00 (reserved for future use) + * 256 49152 RAM dump + * + * IFF1/2, R, AF and PC are stored on the stack. Due to a bug in the + * BIOS, the snapshots created with the DISCiPLE have the AF' register + * replaced with the AF register. + * + * It's unknown (but likely possible) that the snapshots could + * suffer from the same "top of the stack" bug as well as .SNA images. + * + *******************************************************************/ +void spectrum_setup_prg(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i; + UINT8 intr; + UINT16 addr, data; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + data = snapdata[PRG_OFFSET + 0]; + if (data != 0x05) + logerror("Wrong DISCiPLE/+D file type: %02X instead of 05\n", data); + + data = (snapdata[PRG_OFFSET + 235] << 8) | snapdata[PRG_OFFSET + 234]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[PRG_OFFSET + 233] << 8) | snapdata[PRG_OFFSET + 232]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[PRG_OFFSET + 237] << 8) | snapdata[PRG_OFFSET + 236]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[PRG_OFFSET + 231] << 8) | snapdata[PRG_OFFSET + 230]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[PRG_OFFSET + 227] << 8) | snapdata[PRG_OFFSET + 226]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[PRG_OFFSET + 225] << 8) | snapdata[PRG_OFFSET + 224]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[PRG_OFFSET + 229] << 8) | snapdata[PRG_OFFSET + 228]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[PRG_OFFSET + 223] << 8) | snapdata[PRG_OFFSET + 222]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[PRG_OFFSET + 221] << 8) | snapdata[PRG_OFFSET + 220]; + LOAD_REG(cpu, Z80_IY, data); + + data = snapdata[PRG_OFFSET + 239]; + LOAD_REG(cpu, Z80_I, data); + + LOAD_REG(cpu, Z80_IM, (data == 0x00 || data == 0x3f) ? 1 : 2); + + /* Memory dump */ + logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[PRG_HDR + i]); + + addr = (snapdata[PRG_OFFSET + 241] << 8) | snapdata[PRG_OFFSET + 240]; + if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 6) + logerror("Corrupted SP out of range:%04X", addr); + else + logerror("Fetching registers IFF1/2, R, AF and PC from the stack at SP:%04X\n", addr); + + data = space.read_byte(addr + 0); // IFF1/2: (bit 2, 0=DI/1=EI) + LOAD_REG(cpu, Z80_IFF1, BIT(data, 2)); + LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); + + intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + data = space.read_byte(addr + 1); + LOAD_REG(cpu, Z80_R, data); + + data = (space.read_byte(addr + 3) << 8) | space.read_byte(addr + 2); + LOAD_REG(cpu, Z80_AF, data); + + data = (space.read_byte(addr + 5) << 8) | space.read_byte(addr + 4); + LOAD_REG(cpu, Z80_PC, data); + +#if 0 + space.write_byte(addr + 0, 0); // It's been reported that zeroing these locations fixes the loading + space.write_byte(addr + 1, 0); // of a few images that were snapshot at a "wrong" instant + space.write_byte(addr + 2, 0); + space.write_byte(addr + 3, 0); + space.write_byte(addr + 4, 0); + space.write_byte(addr + 5, 0); +#endif + + addr += 6; + logerror("Fixing SP:%04X\n", addr); + cpu->set_state_int(Z80_SP, addr); + + /* Set border color */ + data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + spectrum_page_basicrom(machine); + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); +} + +/******************************************************************* + * + * Load a .PLUSD file. + * + * .PLUSD files are the snapshots produced by the DISCiPLE or + * the +D disk interface, thus share the same internal organization + * of the .PRG files, with a couple of notable exceptions: + * + * 1) The filesystem metadata is missing + * 2) Spectrum 128 snapshots (file type 9) are allowed + * + * A commented disassembly of both BIOSes is avilable at: + * + * http://www.biehold.nl/rudy/ + * + * 48K snapshots are 49174 bytes long, 128K snapshots are 131095 + * bytes long. + * + * Philip Kendall's FUSE emulator at http://fuse-emulator.sourceforge.net + * supports this format, but no extension is officially provided. + * Therefore I have used .PLUSD - corrections are welcome! + * + * 48K snapshot format + * ------------------- + * + * Offset Size Description (all registers stored with LSB first + * ------- ------- ------------------------------------------------- + * 0 2 IY + * 2 2 IX + * 4 2 DE' + * 6 2 BC' + * 8 2 HL' + * 10 2 AF' + * 12 2 DE + * 14 2 BC + * 16 2 HL + * 18 1 Junk created when saving I via LD A,I/PUSH AF + * 19 1 I + * 20 2 SP + * 22 49152 RAM dump + * + * 128K snapshot format + * -------------------- + * + * Offset Size Description (all registers stored with LSB first + * ------- ------- ------------------------------------------------- + * 0 2 IY + * 2 2 IX + * 4 2 DE' + * 6 2 BC' + * 8 2 HL' + * 10 2 AF' + * 12 2 DE + * 14 2 BC + * 16 2 HL + * 18 1 Junk created when saving I via LD A,I/PUSH AF + * 19 1 I + * 20 2 SP + * 22 1 Port 0x7FFD data + * 23 131072 RAM dump + * + * The 8 RAM banks are stored in the order 0-7. + * + * IFF1/2, R, AF and PC are stored on the stack. Due to a bug in the + * BIOS, the snapshots created with the DISCiPLE have the AF' register + * replaced with the AF register. + * + * It's unknown (but likely possible) that the snapshots could + * suffer from the same "top of the stack" bug as well as .SNA images. + * + *******************************************************************/ +void spectrum_setup_plusd(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i, j; + UINT8 intr; + UINT16 addr = 0, data; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + data = (snapdata[PLUSD_OFFSET + 15] << 8) | snapdata[PLUSD_OFFSET + 14]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[PLUSD_OFFSET + 13] << 8) | snapdata[PLUSD_OFFSET + 12]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[PLUSD_OFFSET + 17] << 8) | snapdata[PLUSD_OFFSET + 16]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[PLUSD_OFFSET + 11] << 8) | snapdata[PLUSD_OFFSET + 10]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[PLUSD_OFFSET + 7] << 8) | snapdata[PLUSD_OFFSET + 6]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[PLUSD_OFFSET + 5] << 8) | snapdata[PLUSD_OFFSET + 4]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[PLUSD_OFFSET + 9] << 8) | snapdata[PLUSD_OFFSET + 8]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[PLUSD_OFFSET + 3] << 8) | snapdata[PLUSD_OFFSET + 2]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[PLUSD_OFFSET + 1] << 8) | snapdata[PLUSD_OFFSET + 0]; + LOAD_REG(cpu, Z80_IY, data); + + data = snapdata[PLUSD_OFFSET + 19]; + LOAD_REG(cpu, Z80_I, data); + + LOAD_REG(cpu, Z80_IM, (data == 0x00 || data == 0x3f) ? 1 : 2); + + if (snapsize == PLUSD48_SIZE) + { + spectrum_page_basicrom(machine); + + /* Memory dump */ + logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[PLUSD48_HDR + i]); + } + else + { + logerror("Loading %05X bytes of RAM at %04X\n", 8*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 8; i++) + { + switch (i) + { + case 5: addr = SPECTRUM_BANK; + break; + case 2: addr = 2*SPECTRUM_BANK; + break; + case 0: + case 1: + case 3: + case 4: + case 6: + case 7: addr = 3*SPECTRUM_BANK; + state->m_port_7ffd_data &= 0xf8; + state->m_port_7ffd_data += i; + spectrum_update_paging(machine); + break; + }; + logerror("Loading bank %d from offset:%05X\n", i, PLUSD128_HDR + i*SPECTRUM_BANK); + for (j = 0; j < SPECTRUM_BANK; j++) + space.write_byte(j + addr, snapdata[j + PLUSD128_HDR + i*SPECTRUM_BANK]); + } + state->m_port_7ffd_data = snapdata[PLUSD_OFFSET + 22]; + logerror ("Port 7FFD:%02X\n", state->m_port_7ffd_data); + logerror ("Paging bank:%d\n", state->m_port_7ffd_data & 0x07); + spectrum_update_paging(machine); + } + + addr = (snapdata[PLUSD_OFFSET + 21] << 8) | snapdata[PLUSD_OFFSET + 20]; + if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 6) + logerror("Corrupted SP out of range:%04X", addr); + else + logerror("Fetching registers IFF1/2, R, AF and PC from the stack at SP:%04X\n", addr); + + data = space.read_byte(addr + 0); // IFF1/2: (bit 2, 0=DI/1=EI) + LOAD_REG(cpu, Z80_IFF1, BIT(data, 2)); + LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); + + intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + data = space.read_byte(addr + 1); + LOAD_REG(cpu, Z80_R, data); + + data = (space.read_byte(addr + 3) << 8) | space.read_byte(addr + 2); + LOAD_REG(cpu, Z80_AF, data); + + data = (space.read_byte(addr + 5) << 8) | space.read_byte(addr + 4); + LOAD_REG(cpu, Z80_PC, data); + +#if 0 + space.write_byte(addr + 0, 0); // It's been reported that zeroing these locations fixes the loading + space.write_byte(addr + 1, 0); // of a few images that were snapshot at a "wrong" instant + space.write_byte(addr + 2, 0); + space.write_byte(addr + 3, 0); + space.write_byte(addr + 4, 0); + space.write_byte(addr + 5, 0); +#endif + + addr += 6; + logerror("Fixing SP:%04X\n", addr); + cpu->set_state_int(Z80_SP, addr); + + /* Set border color */ + data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + //if (snapsize == PLUSD48_SIZE) + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); + //else + //logerror("Snapshot loaded.\nExecution resuming at bank:%d %s\n", state->m_port_7ffd_data & 0x07, cpu_get_reg_string(cpu, Z80_PC)); +} + +/******************************************************************* + * + * Load a .SEM file. + * + * .SEM files were produced by a german emulator called SpecEmu + * written by Bernd Waschke. + * + * The files are usually 49192 bytes long unless optional POKE + * blocks are stored at the end of the file. + * + * Offset Size Description (all registers stored with LSB first) + * ------- ------- ------------------------------------------------- + * 0 1 0x05 (signature length) + * 1 5 "SPEC1" (signature) + * 6 49152 RAM dump + * 49158 2 AF + * 49160 2 BC + * 49162 2 DE + * 49164 2 HL + * 49166 2 AF' + * 49168 2 BC' + * 49170 2 DE' + * 49172 2 HL' + * 49174 2 PC + * 49176 2 SP + * 49178 2 IX + * 49180 2 IY + * 49182 2 I + * 49184 2 R + * 49186 2 IFF1 (0=DI/1=EI) + * 49188 2 IFF2 (0=DI/1=EI) + * 49190 2 Interrupt mode (0=IM0/1=IM1/2=IM2) + * + * Following these data, there are optional POKE blocks + * + *******************************************************************/ +void spectrum_setup_sem(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i; + UINT8 intr; + UINT16 data; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + data = (snapdata[SEM_OFFSET + 1] << 8) | snapdata[SEM_OFFSET + 0]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[SEM_OFFSET + 3] << 8) | snapdata[SEM_OFFSET + 2]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[SEM_OFFSET + 5] << 8) | snapdata[SEM_OFFSET + 4]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[SEM_OFFSET + 7] << 8) | snapdata[SEM_OFFSET + 6]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[SEM_OFFSET + 9] << 8) | snapdata[SEM_OFFSET + 8]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[SEM_OFFSET + 11] << 8) | snapdata[SEM_OFFSET + 10]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[SEM_OFFSET + 13] << 8) | snapdata[SEM_OFFSET + 12]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[SEM_OFFSET + 15] << 8) | snapdata[SEM_OFFSET + 14]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[SEM_OFFSET + 21] << 8) | snapdata[SEM_OFFSET + 20]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[SEM_OFFSET + 23] << 8) | snapdata[SEM_OFFSET + 22]; + LOAD_REG(cpu, Z80_IY, data); + + + data = snapdata[SEM_OFFSET + 26]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[SEM_OFFSET + 24]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[SEM_OFFSET + 19] << 8) | snapdata[SEM_OFFSET + 18]; + LOAD_REG(cpu, Z80_SP, data); + + data = (snapdata[SEM_OFFSET + 17] << 8) | snapdata[SEM_OFFSET + 16]; + LOAD_REG(cpu, Z80_PC, data); + + data = snapdata[SEM_OFFSET + 32]; + LOAD_REG(cpu, Z80_IM, data); + + data = snapdata[SEM_OFFSET + 28]; + LOAD_REG(cpu, Z80_IFF1, BIT(data, 0)); + data = snapdata[SEM_OFFSET + 30]; + LOAD_REG(cpu, Z80_IFF2, BIT(data, 0)); + + intr = BIT(snapdata[SEM_OFFSET + 30], 0) ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + /* Memory dump */ + logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[SEM_SIGNATURE + i]); + + /* Set border color */ + data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + spectrum_page_basicrom(machine); + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); + +/* TODO: Decode the optional POKE bank at the end of the image */ + +} + +/******************************************************************* + * + * Load a .SIT file. + * + * .SIT files were produced by a spanish emulator called Sinclair + * written by Pedro M. R. Salas. + * + * http://www.ugr.es/~pedrom/sinclair.htm + * + * The files are always 65564 bytes long and store both ROM and RAM. + * + * Offset Size Description (all registers stored with LSB first) + * ------- ------- ------------------------------------------------- + * 0 2 BC + * 2 2 DE + * 4 2 HL + * 6 2 AF + * 8 2 IX + * 10 2 IY + * 12 2 SP + * 14 2 PC + * 16 1 R + * 17 1 I + * 18 2 BC' + * 20 2 DE' + * 22 2 HL' + * 24 2 AF' + * 26 1 Interrupt mode (0=IM0/1=IM1/2=IM2) + * 27 1 Border color + * 28 16384 ROM dump + * 16412 49152 RAM dump + * + *******************************************************************/ +void spectrum_setup_sit(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i; + UINT8 intr; + UINT16 data; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + data = (snapdata[SIT_OFFSET + 7] << 8) | snapdata[SIT_OFFSET + 6]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[SIT_OFFSET + 1] << 8) | snapdata[SIT_OFFSET + 0]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[SIT_OFFSET + 3] << 8) | snapdata[SIT_OFFSET + 2]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[SIT_OFFSET + 5] << 8) | snapdata[SIT_OFFSET + 4]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[SIT_OFFSET + 25] << 8) | snapdata[SIT_OFFSET + 24]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[SIT_OFFSET + 19] << 8) | snapdata[SIT_OFFSET + 18]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[SIT_OFFSET + 21] << 8) | snapdata[SIT_OFFSET + 20]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[SIT_OFFSET + 23] << 8) | snapdata[SIT_OFFSET + 22]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[SIT_OFFSET + 9] << 8) | snapdata[SIT_OFFSET + 8]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[SIT_OFFSET + 11] << 8) | snapdata[SIT_OFFSET + 10]; + LOAD_REG(cpu, Z80_IY, data); + + + data = snapdata[SIT_OFFSET + 16]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[SIT_OFFSET + 17]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[SIT_OFFSET + 13] << 8) | snapdata[SIT_OFFSET + 12]; + LOAD_REG(cpu, Z80_SP, data); + + data = (snapdata[SIT_OFFSET + 15] << 8) | snapdata[SIT_OFFSET + 14]; + LOAD_REG(cpu, Z80_PC, data); + + data = snapdata[SIT_OFFSET + 26]; + LOAD_REG(cpu, Z80_IM, data); + + data = 0x01; // .SIT snapshots don't specify whether interrupts are enabled or not, so I assume they are. + LOAD_REG(cpu, Z80_IFF1, data); + LOAD_REG(cpu, Z80_IFF2, data); + + intr = data ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + /* Memory dump */ + logerror("Skipping the 16K ROM dump at offset:%04X\n", SIT_OFFSET + 28); + logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[SIT_HDR + SPECTRUM_BANK + i]); + + /* Set border color */ + data = snapdata[SIT_OFFSET + 27] & 0x07; + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + spectrum_page_basicrom(machine); + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); +} + +/******************************************************************* + * + * Load a .ZX file. + * + * .ZX files were produced by the Amiga emulator called KGB + * + * The files are usually 49486 bytes and store at the beginning + * of the file the last 132 bytes of the ROM. + * + * Offset Size Description (all registers stored with MSB first) + * ------- ------- ------------------------------------------------- + * 0 132 Last 132 bytes of ROM dump + * 132 49152 RAM dump + * 49284 132 0x00 (reserved for future use) + * 49416 10 Various KGB settings + * 49426 1 IFF1/2: (0=DI/1=EI) + * 49427 2 Reserved (must be 0x0003) + * 49429 1 KGB ColorMode (0=BW/1=Color) + * 49430 4 0x00 (reserved for future use) + * 49434 2 BC + * 49436 2 BC' + * 49438 2 DE + * 49440 2 DE' + * 49442 2 HL + * 49444 2 HL' + * 49446 2 IX + * 49448 2 IY + * 49450 1 I + * 49451 1 R + * 49452 3 0x00 (reserved for future use) + * 49455 1 A' + * 49456 1 0x00 (reserved for future use) + * 49457 1 A + * 49458 1 0x00 (reserved for future use) + * 49459 1 F' + * 49460 1 0x00 (reserved for future use) + * 49461 1 F + * 49462 2 0x00 (reserved for future use) + * 49464 2 PC + * 49466 2 0x00 (reserved for future use) + * 49468 2 SP + * 49470 2 KGB Soundmode (0=Simple/1=Pitch/2=RomOnly) + * 49472 2 KGB HaltMode (0=NoHalt/1=Halt) + * 49474 2 Interrupt mode (-1=IM0/0=IM1/1=IM2) + * 49476 10 0x00 (reserved for future use) + * + *******************************************************************/ +void spectrum_setup_zx(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i; + UINT8 intr; + UINT16 data, mode; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + logerror("Skipping last 132 bytes of the 16K ROM dump at offset:0000\n"); + + data = (snapdata[ZX_OFFSET + 173] << 8) | snapdata[ZX_OFFSET + 177]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[ZX_OFFSET + 150] << 8) | snapdata[ZX_OFFSET + 151]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[ZX_OFFSET + 154] << 8) | snapdata[ZX_OFFSET + 155]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[ZX_OFFSET + 158] << 8) | snapdata[ZX_OFFSET + 159]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[ZX_OFFSET + 171] << 8) | snapdata[ZX_OFFSET + 175]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[ZX_OFFSET + 152] << 8) | snapdata[ZX_OFFSET + 153]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[ZX_OFFSET + 156] << 8) | snapdata[ZX_OFFSET + 157]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[ZX_OFFSET + 160] << 8) | snapdata[ZX_OFFSET + 161]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[ZX_OFFSET + 162] << 8) | snapdata[ZX_OFFSET + 163]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[ZX_OFFSET + 164] << 8) | snapdata[ZX_OFFSET + 165]; + LOAD_REG(cpu, Z80_IY, data); + + + data = snapdata[ZX_OFFSET + 167]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[ZX_OFFSET + 166]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[ZX_OFFSET + 184] << 8) | snapdata[ZX_OFFSET + 185]; + LOAD_REG(cpu, Z80_SP, data); + + data = (snapdata[ZX_OFFSET + 180] << 8) | snapdata[ZX_OFFSET + 181]; + LOAD_REG(cpu, Z80_PC, data); + + mode = (snapdata[ZX_OFFSET + 190] << 8) | snapdata[ZX_OFFSET + 191]; + switch (mode) + { + case 0xffff: + LOAD_REG(cpu, Z80_IM, (UINT64)0); + break; + case 0x00: + LOAD_REG(cpu, Z80_IM, 1); + break; + case 0x01: + LOAD_REG(cpu, Z80_IM, 2); + break; + default: + logerror("Invalid IM:%04X\n", mode); + } + + data = BIT(snapdata[ZX_OFFSET + 142], 0); + LOAD_REG(cpu, Z80_IFF1, data); + LOAD_REG(cpu, Z80_IFF2, data); + + intr = BIT(snapdata[ZX_OFFSET + 142], 0) ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + /* Memory dump */ + logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[132 + i]); + + /* Set border color */ + data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + spectrum_page_basicrom(machine); + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); +} + +/******************************************************************* + * + * Load a .SNP file. + * + * .SNP files were produced by a polish emulator called Nuclear ZX + * written by Radovan Garabik and Lubomir Salanci. + * + * http://korpus.juls.savba.sk/~garabik/old/zx.html + * + * The files are always 49183 bytes long. + * + * Offset Size Description (all registers stored with LSB first) + * ------- ------- ------------------------------------------------- + * 0 49152 RAM dump + * 49152 2 AF + * 49154 1 Border color + * 49155 1 0x00 (reserved for future use) + * 49156 2 BC + * 49158 2 DE + * 49160 2 HL + * 49162 2 PC + * 49164 2 SP + * 49166 2 IX + * 49168 2 IY + * 49170 1 0x00 (reserved for IFF2 but not implemented) + * 49171 1 IFF1 (0=DI/other=EI) + * 49172 1 Interrupt mode (0=IM0/1=IM1/2=IM2) + * 49173 1 R + * 49174 1 I + * 49175 2 AF' + * 49177 2 BC' + * 49179 2 DE' + * 49181 2 HL' + * + *******************************************************************/ +void spectrum_setup_snp(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i; + UINT8 intr; + UINT16 data; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + data = (snapdata[SNP_OFFSET + 1] << 8) | snapdata[SNP_OFFSET + 0]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[SNP_OFFSET + 5] << 8) | snapdata[SNP_OFFSET + 4]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[SNP_OFFSET + 7] << 8) | snapdata[SNP_OFFSET + 6]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[SNP_OFFSET + 9] << 8) | snapdata[SNP_OFFSET + 8]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[SNP_OFFSET + 24] << 8) | snapdata[SNP_OFFSET + 23]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[SNP_OFFSET + 26] << 8) | snapdata[SNP_OFFSET + 25]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[SNP_OFFSET + 28] << 8) | snapdata[SNP_OFFSET + 27]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[SNP_OFFSET + 30] << 8) | snapdata[SNP_OFFSET + 29]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[SNP_OFFSET + 15] << 8) | snapdata[SNP_OFFSET + 14]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[SNP_OFFSET + 17] << 8) | snapdata[SNP_OFFSET + 16]; + LOAD_REG(cpu, Z80_IY, data); + + + data = snapdata[SNP_OFFSET + 21]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[SNP_OFFSET + 22]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[SNP_OFFSET + 13] << 8) | snapdata[SNP_OFFSET + 12]; + LOAD_REG(cpu, Z80_SP, data); + + data = (snapdata[SNP_OFFSET + 11] << 8) | snapdata[SNP_OFFSET + 10]; + LOAD_REG(cpu, Z80_PC, data); + + + data = snapdata[SNP_OFFSET + 20] & 0x03; + LOAD_REG(cpu, Z80_IM, data); + + data = BIT(snapdata[SNP_OFFSET + 19], 0); + LOAD_REG(cpu, Z80_IFF1, data); + LOAD_REG(cpu, Z80_IFF2, data); + + intr = BIT(snapdata[SNP_OFFSET + 19], 0) ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + /* Memory dump */ + logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 3*SPECTRUM_BANK; i++) + space.write_byte(BASE_RAM + i, snapdata[i]); + + /* Set border color */ + data = snapdata[SNP_OFFSET + 2] & 0x07; + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + spectrum_page_basicrom(machine); + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); +} + +/******************************************************************* + * + * Load a .SNX file. + * + * .SNX files were produced by an Atari ST emulator called Specci + * written by Christian Gandler + * + * http://cd.textfiles.com/crawlycrypt1/apps/misc/zx_sp207/ + * + * The header is an extension of the .SNA format and the RAM dump + * is compressed with a simple run-length algorithm. + * + * Offset Size Description (all registers stored with LSB first + * except when noted with *BE*) + * ------- ------- ------------------------------------------------- + * 0 4 "XSNA" (signature) + * 4 2 Header length *BE* + * 6 1 I + * 7 2 HL' + * 9 2 DE' + * 11 2 BC' + * 13 2 AF' + * 15 2 HL + * 17 2 DE + * 19 2 BC + * 21 2 IY + * 23 2 IX + * 25 1 IFF1/2: bit 0 contains IFF1, bit 2 contains IFF2 (0=DI/1=EI) + * 26 1 R + * 27 2 AF + * 29 2 SP + * 31 1 Interrupt Mode (0=IM0/1=IM1/2=IM2) + * 32 1 Border color + * 33 1 Specci settings: Interface 1 (0=no/1=yes) + * 34 1 Specci settings: FLASH emulation (0=no/1=yes) + * 35 1 Specci settings: Attributes emulation (0=no/1=yes) + * 36 1 Specci settings: Bit 7 - Keyboard (0=QWERTY/1=QWERTZ) + * Bit 6 - ULA emulation (0=no/1=yes) + * Bit 0,1 - Joystick interface + * 00 = Kempston + * 01 = IF2 Left + * 10 = IF2 Right + * 11 = Cursor/AGF/Protek + * 37 1 Specci settings: R register emulation (0=no/1=yes) + * Bit 7 - EAR bit (0=Issue 3/1=Issue 2) + * 38 1 Specci settings: Interrupt frequency (0=50 Hz/1=100 Hz) + * 39 1 Specci settings: RS232 redirection (0=RS232/1=Centronics) + * 40 1 Specci settings: Sound emulation + * Bit 4,7 - Frequency (0..4) for mode 2 + * Bit 0,3 - Mode (0=off/1=direct/2=interrupt) + * 41 1 Specci settings: Border emulation (0=off/1=direct/2=interrupt) + * 42 1 Specci settings: IM2 hardware vector (0..255) + * 43 ????? RAM dump + * + * PC is stored on stack. + * + * The RAM dump is divided into short or long datablocks: + * if the block is composed of the same byte, it is replaced by + * a compressed version. The format of the various blocks follows: + * + * Uncompressed short block + * ------------------------ + * Offset Size Description + * ------- ------- ------------------------------------------------- + * 0 1 Marker byte. Values between 0xe0 and 0xef. + * Low nibble is (block length - 1). + * 1 ????? Data block + * + * Compressed short block + * ---------------------- + * Offset Size Description + * ------- ------- ------------------------------------------------- + * 0 1 Marker byte. Values between 0xf0 and 0xff. + * Low nibble is (block length - 1). + * 1 1 Filler byte. This byte is repeated for the whole + * length of the block. + * + * Uncompressed long block + * ----------------------- + * Offset Size Description + * ------- ------- ------------------------------------------------- + * 0 2 Block length in big endian format. + * Values between 0x0000 and 0xdfff. + * 2 1 Uncompressed block flag: 0xff. + * 3 ????? Data block + * + * Compressed long block + * --------------------- + * Offset Size Description + * ------- ------- ------------------------------------------------- + * 0 2 Block length in big endian format. + * Values between 0x0000 and 0xdfff. + * 2 1 Compressed block flag: 0x00. + * 3 1 Filler byte. This byte is repeated for the whole + * length of the block. + * + *******************************************************************/ +static void spectrum_snx_decompress_block(address_space &space, UINT8 *source, UINT16 dest, UINT16 size) +{ + UINT8 counthi, countlo, compress, fill; + UINT16 block = 0, count, i, j, numbytes; + + i = SNX_HDR - 1; + numbytes = 0; + + while (numbytes < size) + { + counthi = source[++i]; + if (counthi >= 0xe0) + { + count = (counthi & 0x0f) + 1; // Short block + if ((counthi & 0xf0) == 0xf0) + compress = SNX_COMPRESSED; + else + compress = SNX_UNCOMPRESSED; + logerror("Block:%05d Type:Short Compr:%s Offset:%04X Len:%04X ", block++, compress == SNX_COMPRESSED ? "Y" : "N", i-1, count); + } + else + { + countlo = source[++i]; + count = (counthi << 8) | countlo; // Long block + compress = source[++i]; + logerror("Block:%05d Type:Long Compr:%s Offset:%04X Len:%04X ", block++, compress == SNX_COMPRESSED ? "Y" : "N", i-3, count); + } + + if (compress == SNX_COMPRESSED) + { + fill = source[++i]; + logerror("Dest:%04X Filler:%02X\n", BASE_RAM + numbytes, fill); + for(j = 0; j < count; j++) + space.write_byte(BASE_RAM + numbytes + j, fill); + numbytes += count; + } + else + { + logerror("Dest:%04X\n", BASE_RAM + numbytes); + j = 0; + while (j < count) + space.write_byte(BASE_RAM + numbytes + j++, source[++i]); + numbytes += count; + } + } +} + +void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + UINT8 intr; + UINT16 data, addr; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + data = (snapdata[SNX_OFFSET + 4] << 8) | snapdata[SNX_OFFSET + 5]; + if (data != 0x25) + logerror("Corrupted header length: %02X instead of 0x25\n", data); + + data = (snapdata[SNX_OFFSET + 28] << 8) | snapdata[SNX_OFFSET + 27]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[SNX_OFFSET + 20] << 8) | snapdata[SNX_OFFSET + 19]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[SNX_OFFSET + 18] << 8) | snapdata[SNX_OFFSET + 17]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[SNX_OFFSET + 16] << 8) | snapdata[SNX_OFFSET + 15]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[SNX_OFFSET + 14] << 8) | snapdata[SNX_OFFSET + 13]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[SNX_OFFSET + 12] << 8) | snapdata[SNX_OFFSET + 11]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[SNX_OFFSET + 10] << 8) | snapdata[SNX_OFFSET + 9]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[SNX_OFFSET + 8] << 8) | snapdata[SNX_OFFSET + 7]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[SNX_OFFSET + 24] << 8) | snapdata[SNX_OFFSET + 23]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[SNX_OFFSET + 22] << 8) | snapdata[SNX_OFFSET + 21]; + LOAD_REG(cpu, Z80_IY, data); + + + data = snapdata[SNX_OFFSET + 26]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[SNX_OFFSET + 6]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[SNX_OFFSET + 30] << 8) | snapdata[SNX_OFFSET + 29]; + LOAD_REG(cpu, Z80_SP, data); + + + data = snapdata[SNX_OFFSET + 31] & 0x03; + if (data == 3) + data = 2; + LOAD_REG(cpu, Z80_IM, data); + + data = snapdata[SNX_OFFSET + 25]; + LOAD_REG(cpu, Z80_IFF1, BIT(data, 0)); + LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); + + intr = BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + /* Memory dump */ + logerror("Uncompressing %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); + spectrum_snx_decompress_block(space, snapdata, BASE_RAM, 3*SPECTRUM_BANK); + + /* get pc from stack */ + addr = cpu->state_int(Z80_SP); + + if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2) + logerror("Corrupted SP out of range:%04X", addr); + else + logerror("Fetching PC from the stack at SP:%04X\n", addr); + + LOAD_REG(cpu, Z80_PC, (space.read_byte(addr + 1) << 8) | space.read_byte(addr + 0)); + +#if 0 + space.write_byte(addr + 0, 0); // It's been reported that zeroing these locations fixes the loading + space.write_byte(addr + 1, 0); // of a few images that were snapshot at a "wrong" instant +#endif + + addr += 2; + logerror("Fixed the stack at SP:%04X\n", addr); + cpu->set_state_int(Z80_SP, addr); + + /* Set border color */ + data = snapdata[SNX_OFFSET + 32] & 0x07; + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + spectrum_page_basicrom(machine); + +/* TODO: Enable/disable IF1 as per snapdata[SNX_OFFSET + 33] */ + +/* TODO: Enable/disable joysticks as per snapdata[SNX_OFFSET + 36] */ + +/* TODO: Enable selection of Issue 2/3 config switch as per snapdata[SNX_OFFSET + 37] */ + + //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); +} + +/******************************************************************* + * + * Load a .FRZ file. + * + * .FRZ files were produced by the czech Amiga emulator CBSpeccy + * written by the CodeBusters. Kudos to Dmitriy Zhivilov and + * Ian Greenway for having reverse-engineered and shared the + * description of this format. + * + * The original specs of this format were published on a + * russian electronics magazine. + * + * The format is always 131114 bytes long and supports only + * Spectrum 128K images. + * + * Offset Size Description (all registers stored with MSB first) + * ------- ------- ------------------------------------------------- + * 0 1 0x00 (reserved for future use) + * 1 1 Port 0x7FFD data + * 2 2 HL' + * 4 2 HL + * 6 2 DE' + * 8 2 DE + * 10 2 BC' + * 12 2 BC + * 14 2 AF' + * 16 2 AF + * 18 7 Emulation disk registers and T-states + * 25 1 R + * 26 2 PC + * 28 2 SP + * 30 1 I + * 31 1 0xFF (reserved for future use) + * 32 1 0x00 (reserved for future use) + * 33 1 Interrupt mode (0=IM0/1=IM1/2=IM2) + * 34 3 0x00 (reserved for future use) + * 37 1 IFF1: bit 2 contains IFF1 (0=DI/1=EI) + * 38 2 IY + * 40 2 IX + * 42 131072 RAM dump + * + * The 8 16K banks are stored in the order 5, 2, 0, 1, 3, 4, 6, 7 + * + *******************************************************************/ +void spectrum_setup_frz(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + int i, j; + UINT8 intr; + UINT16 addr, data; + spectrum_state *state = machine.driver_data(); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + if (state->m_port_7ffd_data == -1) + { + logerror("Can't load 128K .FRZ file into 48K machine\n"); + return; + } + + data = (snapdata[FRZ_OFFSET + 16] << 8) | snapdata[FRZ_OFFSET + 17]; + LOAD_REG(cpu, Z80_AF, data); + + data = (snapdata[FRZ_OFFSET + 12] << 8) | snapdata[FRZ_OFFSET + 13]; + LOAD_REG(cpu, Z80_BC, data); + + data = (snapdata[FRZ_OFFSET + 8] << 8) | snapdata[FRZ_OFFSET + 9]; + LOAD_REG(cpu, Z80_DE, data); + + data = (snapdata[FRZ_OFFSET + 4] << 8) | snapdata[FRZ_OFFSET + 5]; + LOAD_REG(cpu, Z80_HL, data); + + + data = (snapdata[FRZ_OFFSET + 14] << 8) | snapdata[FRZ_OFFSET + 15]; + LOAD_REG(cpu, Z80_AF2, data); + + data = (snapdata[FRZ_OFFSET + 10] << 8) | snapdata[FRZ_OFFSET + 11]; + LOAD_REG(cpu, Z80_BC2, data); + + data = (snapdata[FRZ_OFFSET + 6] << 8) | snapdata[FRZ_OFFSET + 7]; + LOAD_REG(cpu, Z80_DE2, data); + + data = (snapdata[FRZ_OFFSET + 2] << 8) | snapdata[FRZ_OFFSET + 3]; + LOAD_REG(cpu, Z80_HL2, data); + + + data = (snapdata[FRZ_OFFSET + 40] << 8) | snapdata[FRZ_OFFSET + 41]; + LOAD_REG(cpu, Z80_IX, data); + + data = (snapdata[FRZ_OFFSET + 38] << 8) | snapdata[FRZ_OFFSET + 39]; + LOAD_REG(cpu, Z80_IY, data); + + + data = snapdata[FRZ_OFFSET + 25]; + LOAD_REG(cpu, Z80_R, data); + + data = snapdata[FRZ_OFFSET + 30]; + LOAD_REG(cpu, Z80_I, data); + + + data = (snapdata[FRZ_OFFSET + 28] << 8) | snapdata[FRZ_OFFSET + 29]; + LOAD_REG(cpu, Z80_SP, data); + + data = (snapdata[FRZ_OFFSET + 26] << 8) | snapdata[FRZ_OFFSET + 27]; + LOAD_REG(cpu, Z80_PC, data); + + + data = snapdata[FRZ_OFFSET + 33]; + LOAD_REG(cpu, Z80_IM, data); + + data = snapdata[FRZ_OFFSET + 37]; + LOAD_REG(cpu, Z80_IFF1, BIT(data, 2)); + LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); + + intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + /* Memory dump */ + addr = 0; + static const UINT8 banks[] = { 5, 2, 0, 1, 3, 4, 6, 7 }; + logerror("Loading %05X bytes of RAM at %04X\n", 8*SPECTRUM_BANK, BASE_RAM); + for (i = 0; i < 8; i++) + { + switch (banks[i]) + { + case 5: addr = SPECTRUM_BANK; + break; + case 2: addr = 2*SPECTRUM_BANK; + break; + case 0: + case 1: + case 3: + case 4: + case 6: + case 7: addr = 3*SPECTRUM_BANK; + state->m_port_7ffd_data &= 0xf8; + state->m_port_7ffd_data += banks[i]; + spectrum_update_paging(machine); + break; + }; + logerror("Loading bank %d from offset:%05X\n", banks[i], FRZ_HDR + i*SPECTRUM_BANK); + for (j = 0; j < SPECTRUM_BANK; j++) + space.write_byte(j + addr, snapdata[j + FRZ_HDR + i*SPECTRUM_BANK]); + } + state->m_port_7ffd_data = snapdata[FRZ_OFFSET + 1]; + logerror ("Port 7FFD:%02X\n", state->m_port_7ffd_data); + logerror ("Paging bank:%d\n", state->m_port_7ffd_data & 0x07); + spectrum_update_paging(machine); + + /* Set border color */ + data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + //logerror("Snapshot loaded.\nExecution resuming at bank:%d %s\n", state->m_port_7ffd_data & 0x07, cpu_get_reg_string(cpu, Z80_PC)); +} + +static void spectrum_z80_decompress_block(address_space &space, UINT8 *source, UINT16 dest, UINT16 size) +{ + UINT8 ch; + int i; + + do + { + /* get byte */ + ch = source[0]; + + /* either start 0f 0x0ed, 0x0ed, xx yy or single 0x0ed */ + if (ch == 0x0ed) + { + if (source[1] == 0x0ed) + { + /* 0x0ed, 0x0ed, xx yy - repetition */ + UINT8 count; + UINT8 data; + + count = source[2]; + + if (count == 0) + return; + + data = source[3]; + + source += 4; + + if (count > size) + count = size; + + size -= count; + + for (i = 0; i < count; i++) + { + space.write_byte(dest, data); + dest++; + } + } + else + { + /* single 0x0ed */ + space.write_byte(dest, ch); + dest++; + source++; + size--; + } + } + else + { + /* not 0x0ed */ + space.write_byte(dest, ch); + dest++; + source++; + size--; + } + } + while (size > 0); +} + +static SPECTRUM_Z80_SNAPSHOT_TYPE spectrum_identify_z80 (UINT8 *snapdata, UINT32 snapsize) +{ + UINT8 lo, hi, data; + + if (snapsize < 30) + return SPECTRUM_Z80_SNAPSHOT_INVALID; /* Invalid file */ + + lo = snapdata[6] & 0x0ff; + hi = snapdata[7] & 0x0ff; + if (hi || lo) + return SPECTRUM_Z80_SNAPSHOT_48K_OLD; /* V1.45 - 48K only */ + + lo = snapdata[30] & 0x0ff; + hi = snapdata[31] & 0x0ff; + data = snapdata[34] & 0x0ff; /* Hardware mode */ + + if ((hi == 0) && (lo == 23)) + { /* V2.01 */ /* V2.01 format */ + switch (data) + { + case 0: + case 1: return SPECTRUM_Z80_SNAPSHOT_48K; + case 2: return SPECTRUM_Z80_SNAPSHOT_SAMRAM; + case 3: + case 4: return SPECTRUM_Z80_SNAPSHOT_128K; + case 128: return SPECTRUM_Z80_SNAPSHOT_TS2068; + } + } + + if ((hi == 0) && (lo == 54)) + { /* V3.0x */ /* V2.01 format */ + switch (data) + { + case 0: + case 1: + case 3: return SPECTRUM_Z80_SNAPSHOT_48K; + case 2: return SPECTRUM_Z80_SNAPSHOT_SAMRAM; + case 4: + case 5: + case 6: return SPECTRUM_Z80_SNAPSHOT_128K; + case 128: return SPECTRUM_Z80_SNAPSHOT_TS2068; + } + } + + return SPECTRUM_Z80_SNAPSHOT_INVALID; +} + +/* now supports 48k & 128k .Z80 files */ +void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) +{ + spectrum_state *state = machine.driver_data(); + int i; + UINT8 lo, hi, data; + SPECTRUM_Z80_SNAPSHOT_TYPE z80_type; + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); + + z80_type = spectrum_identify_z80(snapdata, snapsize); + + switch (z80_type) + { + case SPECTRUM_Z80_SNAPSHOT_INVALID: + logerror("Invalid .Z80 file\n"); + return; + case SPECTRUM_Z80_SNAPSHOT_48K_OLD: + case SPECTRUM_Z80_SNAPSHOT_48K: + logerror("48K .Z80 file\n"); + if (!strcmp(machine.system().name,"ts2068")) + logerror("48K .Z80 file in TS2068\n"); + break; + case SPECTRUM_Z80_SNAPSHOT_128K: + logerror("128K .Z80 file\n"); + if (state->m_port_7ffd_data == -1) + { + logerror("Not a 48K .Z80 file\n"); + return; + } + if (!strcmp(machine.system().name,"ts2068")) + { + logerror("Not a TS2068 .Z80 file\n"); + return; + } + break; + case SPECTRUM_Z80_SNAPSHOT_TS2068: + logerror("TS2068 .Z80 file\n"); + if (strcmp(machine.system().name,"ts2068")) + logerror("Not a TS2068 machine\n"); + break; + case SPECTRUM_Z80_SNAPSHOT_SAMRAM: + logerror("Hardware not supported - .Z80 file\n"); + return; + } + + /* AF */ + hi = snapdata[0] & 0x0ff; + lo = snapdata[1] & 0x0ff; + cpu->set_state_int(Z80_AF, (hi << 8) | lo); + /* BC */ + lo = snapdata[2] & 0x0ff; + hi = snapdata[3] & 0x0ff; + cpu->set_state_int(Z80_BC, (hi << 8) | lo); + /* HL */ + lo = snapdata[4] & 0x0ff; + hi = snapdata[5] & 0x0ff; + cpu->set_state_int(Z80_HL, (hi << 8) | lo); + + /* SP */ + lo = snapdata[8] & 0x0ff; + hi = snapdata[9] & 0x0ff; + cpu->set_state_int(Z80_SP, (hi << 8) | lo); + + /* I */ + cpu->set_state_int(Z80_I, (snapdata[10] & 0x0ff)); + + /* R */ + data = (snapdata[11] & 0x07f) | ((snapdata[12] & 0x01) << 7); + cpu->set_state_int(Z80_R, data); + + /* Set border color */ + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | ((snapdata[12] & 0x0e) >> 1); + spectrum_border_update(machine, (snapdata[12] & 0x0e) >> 1); + + lo = snapdata[13] & 0x0ff; + hi = snapdata[14] & 0x0ff; + cpu->set_state_int(Z80_DE, (hi << 8) | lo); + + lo = snapdata[15] & 0x0ff; + hi = snapdata[16] & 0x0ff; + cpu->set_state_int(Z80_BC2, (hi << 8) | lo); + + lo = snapdata[17] & 0x0ff; + hi = snapdata[18] & 0x0ff; + cpu->set_state_int(Z80_DE2, (hi << 8) | lo); + + lo = snapdata[19] & 0x0ff; + hi = snapdata[20] & 0x0ff; + cpu->set_state_int(Z80_HL2, (hi << 8) | lo); + + hi = snapdata[21] & 0x0ff; + lo = snapdata[22] & 0x0ff; + cpu->set_state_int(Z80_AF2, (hi << 8) | lo); + + lo = snapdata[23] & 0x0ff; + hi = snapdata[24] & 0x0ff; + cpu->set_state_int(Z80_IY, (hi << 8) | lo); + + lo = snapdata[25] & 0x0ff; + hi = snapdata[26] & 0x0ff; + cpu->set_state_int(Z80_IX, (hi << 8) | lo); + + /* Interrupt Flip/Flop */ + if (snapdata[27] == 0) + { + cpu->set_state_int(Z80_IFF1, (UINT64)0); + /* cpu->set_state_int(Z80_IRQ_STATE, 0); */ + } + else + { + cpu->set_state_int(Z80_IFF1, 1); + /* cpu->set_state_int(Z80_IRQ_STATE, 1); */ + } + + cpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); +// cpu->set_input_line(INPUT_LINE_NMI, data); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + + /* IFF2 */ + if (snapdata[28] != 0) + { + data = 1; + } + else + { + data = 0; + } + cpu->set_state_int(Z80_IFF2, data); + + /* Interrupt Mode */ + cpu->set_state_int(Z80_IM, (snapdata[29] & 0x03)); + + if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K_OLD) + { + lo = snapdata[6] & 0x0ff; + hi = snapdata[7] & 0x0ff; + cpu->set_state_int(Z80_PC, (hi << 8) | lo); + + spectrum_page_basicrom(machine); + + if ((snapdata[12] & 0x020) == 0) + { + logerror("Not compressed\n"); /* not compressed */ + for (i = 0; i < 49152; i++) + space.write_byte(i + 16384, snapdata[30 + i]); + } + else + { + logerror("Compressed\n"); /* compressed */ + spectrum_z80_decompress_block(space, snapdata + 30, 16384, 49152); + } + } + else + { + UINT8 *pSource; + int header_size; + + header_size = 30 + 2 + ((snapdata[30] & 0x0ff) | ((snapdata[31] & 0x0ff) << 8)); + + lo = snapdata[32] & 0x0ff; + hi = snapdata[33] & 0x0ff; + cpu->set_state_int(Z80_PC, (hi << 8) | lo); + + if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine.system().name,"ts2068"))) + { + ay8910_device *ay8912 = machine.device("ay8912"); + + /* Only set up sound registers for 128K machine or TS2068! */ + for (i = 0; i < 16; i++) + { + ay8912->address_w(state->generic_space(), 0, i); + ay8912->data_w(state->generic_space(), 0, snapdata[39 + i]); + } + ay8912->address_w(state->generic_space(), 0, snapdata[38]); + } + + pSource = snapdata + header_size; + + if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K) + /* Ensure 48K Basic ROM is used */ + spectrum_page_basicrom(machine); + + do + { + unsigned short length; + UINT8 page; + int Dest = 0; + + length = (pSource[0] & 0x0ff) | ((pSource[1] & 0x0ff) << 8); + page = pSource[2]; + + if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K || z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) + { + switch (page) + { + case 4: Dest = 0x08000; break; + case 5: Dest = 0x0c000; break; + case 8: Dest = 0x04000; break; + default: Dest = 0; break; + } + } + else + { + /* 3 = bank 0, 4 = bank 1 ... 10 = bank 7 */ + if ((page >= 3) && (page <= 10)) + { + /* Page the appropriate bank into 0xc000 - 0xfff */ + state->m_port_7ffd_data = page - 3; + spectrum_update_paging(machine); + Dest = 0x0c000; + } + else + /* Other values correspond to ROM pages */ + Dest = 0x0; + } + + if (Dest != 0) + { + if (length == 0x0ffff) + { + /* block is uncompressed */ + logerror("Not compressed\n"); + + /* not compressed */ + for (i = 0; i < 16384; i++) + space.write_byte(i + Dest, pSource[i]); + } + else + { + logerror("Compressed\n"); + + /* block is compressed */ + spectrum_z80_decompress_block(space, &pSource[3], Dest, 16384); + } + } + + /* go to next block */ + pSource += (3 + length); + } + while ((pSource - snapdata) < snapsize); + + if ((state->m_port_7ffd_data != -1) && (z80_type != SPECTRUM_Z80_SNAPSHOT_48K)) + { + /* Set up paging */ + state->m_port_7ffd_data = (snapdata[35] & 0x0ff); + spectrum_update_paging(machine); + } + if ((z80_type == SPECTRUM_Z80_SNAPSHOT_48K) && !strcmp(machine.system().name,"ts2068")) + { + state->m_port_f4_data = 0x03; + state->m_port_ff_data = 0x00; + state->ts2068_update_memory(); + } + if (z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068 && !strcmp(machine.system().name,"ts2068")) + { + state->m_port_f4_data = snapdata[35]; + state->m_port_ff_data = snapdata[36]; + state->ts2068_update_memory(); + } + } +} + +QUICKLOAD_LOAD_MEMBER( spectrum_state,spectrum) +{ + dynamic_buffer quickload_data(quickload_size); + + image.fread(&quickload_data[0], quickload_size); + + if (!core_stricmp(file_type, "scr")) + { + if ((quickload_size != SCR_SIZE) && (quickload_size != SCR_BITMAP)) + { + logerror("Invalid .SCR file size.\n"); + goto error; + } + spectrum_setup_scr(machine(), &quickload_data[0], quickload_size); + } + else if (!core_stricmp(file_type, "raw")) + { + if (quickload_size != RAW_SIZE) + { + logerror("Invalid .RAW file size.\n"); + goto error; + } + spectrum_setup_raw(machine(), &quickload_data[0], quickload_size); + } + + return IMAGE_INIT_PASS; + +error: + return IMAGE_INIT_FAIL; +} + +/******************************************************************* + * + * Load a .SCR file. + * + * .SCR files are just a binary dump of the ZX Spectrum's + * display file, which is 256x192 pixels large. + * + * These file are created using the Sinclair BASIC command + * + * SAVE "filename" SCREEN$ + * + * where the keyword "SCREEN$" is a shortcut for "CODE 16384,6912" + * i.e. the loading address and the length of the data. + * + * The format is organized as follows: + * + * Offset Size Description + * -------- ------- ------------------------------------------------- + * 0 6144 Screen bitmap + * 6144 768 Screen attributes + * + * Some utilities and emulators support a B&W version of this + * format, which stores only the bitmap. These files can't be + * produced using the SAVE SCREEN$ command - rather they're + * created by the command + * + * SAVE "filename" CODE 16384,6144 + * + *******************************************************************/ +void spectrum_setup_scr(running_machine &machine, UINT8 *quickdata, UINT32 quicksize) +{ + int i; + address_space &space = machine.driver_data()->m_maincpu->space(AS_PROGRAM); + + for (i = 0; i < quicksize; i++) + space.write_byte(i + BASE_RAM, quickdata[i]); + + log_quickload(machine, quicksize == SCR_SIZE ? "SCREEN$" : "SCREEN$ (Mono)", BASE_RAM, quicksize, 0, EXEC_NA); +} + +/******************************************************************* + * + * Load a .RAW file. + * + * .RAW files are a binary dump of the ZX Spectrum RAM + * and are created using the Sinclair BASIC command + * + * SAVE *"b" CODE 16384,49152 + * + * which copies the whole RAM to the Interface 1's RS232 interface. + * The resulting file is always 49161 bytes long. + * + * The format is organized as follows: + * + * Offset Size Description (all registers stored with LSB first) + * ------- ------- ------------------------------------------------- + * 0 1 0x03 (BYTES file type) + * 1 2 Image size + * 3 2 Image start address + * 5 4 0xFF + * + * Since the size and the start address are encoded in the header, + * it would be possible to create .RAW images of any part of the RAM. + * However, no image of such type has ever surfaced. + * + *******************************************************************/ +void spectrum_setup_raw(running_machine &machine, UINT8 *quickdata, UINT32 quicksize) +{ + int i; + UINT8 data; + UINT16 start, len; + spectrum_state *state = machine.driver_data(); + address_space &space = state->m_maincpu->space(AS_PROGRAM); + + start = (quickdata[RAW_OFFSET + 4] << 8) | quickdata[RAW_OFFSET + 3]; + len = (quickdata[RAW_OFFSET + 2] << 8) | quickdata[RAW_OFFSET + 1]; + + for (i = 0; i < len; i++) + space.write_byte(i + start, quickdata[i + RAW_HDR]); + + /* Set border color */ + data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. + state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; + spectrum_border_update(machine, data); + logerror("Border color:%02X\n", data); + + log_quickload(machine, "BYTES", start, len, 0, EXEC_NA); +} diff --git a/src/mame/machine/spec_snqk.h b/src/mame/machine/spec_snqk.h new file mode 100644 index 00000000000..6eec8f90ade --- /dev/null +++ b/src/mame/machine/spec_snqk.h @@ -0,0 +1,181 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/***************************************************************************** + * + * machine/spec_snqk.h + * + ****************************************************************************/ + +#ifndef __SPEC_SNQK_H__ +#define __SPEC_SNQK_H__ + +#include "imagedev/snapquik.h" + +void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_sp(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_ach(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_prg(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_plusd(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_sem(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_sit(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_zx(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_snp(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); +void spectrum_setup_frz(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); + +void spectrum_setup_scr(running_machine &machine, UINT8 *quickdata, UINT32 quicksize); +void spectrum_setup_raw(running_machine &machine, UINT8 *quickdata, UINT32 quicksize); + +#define BASE_RAM 0x4000 +#define SPECTRUM_BANK 0x4000 + +/***************************************************************************** + * + * .SNA format (used by JPP) + * + ****************************************************************************/ +#define SNA48_OFFSET 0 +#define SNA48_HDR 27 +#define SNA48_SIZE (SNA48_HDR + 3*SPECTRUM_BANK) + +#define SNA128_OFFSET (SNA48_HDR + 3*SPECTRUM_BANK) +#define SNA128_HDR 4 +#define SNA128_SIZE_1 (SNA48_HDR + 3*SPECTRUM_BANK + SNA128_HDR + 5*SPECTRUM_BANK) +#define SNA128_SIZE_2 (SNA48_HDR + 3*SPECTRUM_BANK + SNA128_HDR + 6*SPECTRUM_BANK) + +/***************************************************************************** + * + * .SP format (used by VGASPEC and Spanish Spectrum emulator) + * + ****************************************************************************/ +#define SP_OLD_HDR 32 +#define SP_NEW_HDR 38 +#define SP_OLD_SIZE (SP_OLD_HDR + 3*SPECTRUM_BANK) +#define SP_NEW_SIZE_16K (SP_NEW_HDR + 1*SPECTRUM_BANK) +#define SP_NEW_SIZE_48K (SP_NEW_HDR + 3*SPECTRUM_BANK) + +/***************************************************************************** + * + * .ACH format (used by !Speccy) + * + ****************************************************************************/ +#define ACH_OFFSET 0 +#define ACH_HDR 256 +#define ACH_SIZE (ACH_HDR + BASE_RAM + 3*SPECTRUM_BANK) + +/***************************************************************************** + * + * .PRG format (used by SpecEm) + * + ****************************************************************************/ +#define PRG_OFFSET 0 +#define PRG_HDR 256 +#define PRG_SIZE (PRG_HDR + 3*SPECTRUM_BANK) + +/***************************************************************************** + * + * .PLUSD format (used by FUSE) + * + ****************************************************************************/ +#define PLUSD_OFFSET 0 +#define PLUSD48_HDR 22 +#define PLUSD48_SIZE (PLUSD48_HDR + 3*SPECTRUM_BANK) + +#define PLUSD128_HDR 23 +#define PLUSD128_SIZE (PLUSD128_HDR + 8*SPECTRUM_BANK) + +/***************************************************************************** + * + * .SEM format (used by SpecEmu) + * + ****************************************************************************/ +#define SEM_SIGNATURE 6 +#define SEM_OFFSET 49158 +#define SEM_HDR 34 +#define SEM_SIZE (SEM_SIGNATURE + 3*SPECTRUM_BANK + SEM_HDR) + +/***************************************************************************** + * + * .SIT format (used by Sinclair) + * + ****************************************************************************/ +#define SIT_OFFSET 0 +#define SIT_HDR 28 +#define SIT_SIZE (SIT_HDR + BASE_RAM + 3*SPECTRUM_BANK) + +/***************************************************************************** + * + * .ZX format (used by KGB) + * + ****************************************************************************/ +#define ZX_OFFSET 49284 +#define ZX_HDR 202 +#define ZX_SIZE (132 + 3*SPECTRUM_BANK + ZX_HDR) + +/***************************************************************************** + * + * .SNP format (used by Nuclear ZX) + * + ****************************************************************************/ +#define SNP_OFFSET 49152 +#define SNP_HDR 31 +#define SNP_SIZE (3*SPECTRUM_BANK + SNP_HDR) + +/***************************************************************************** + * + * .SNX format (used by Specci) + * + ****************************************************************************/ +#define SNX_OFFSET 0 +#define SNX_HDR 43 + +#define SNX_COMPRESSED 0xff +#define SNX_UNCOMPRESSED 0x00 + +/***************************************************************************** + * + * .FRZ format (used by CBSpeccy, ZX-Live and ASp) + * + ****************************************************************************/ +#define FRZ_OFFSET 0 +#define FRZ_HDR 42 +#define FRZ_SIZE (FRZ_HDR + 8*SPECTRUM_BANK) + +enum SPECTRUM_SNAPSHOT_TYPE +{ + SPECTRUM_SNAPSHOT_NONE, + SPECTRUM_SNAPSHOT_SNA, + SPECTRUM_SNAPSHOT_Z80, + SPECTRUM_SNAPSHOT_SP, + SPECTRUM_TAPEFILE_TAP +}; + +enum SPECTRUM_Z80_SNAPSHOT_TYPE { + SPECTRUM_Z80_SNAPSHOT_INVALID, + SPECTRUM_Z80_SNAPSHOT_48K_OLD, + SPECTRUM_Z80_SNAPSHOT_48K, + SPECTRUM_Z80_SNAPSHOT_SAMRAM, + SPECTRUM_Z80_SNAPSHOT_128K, + SPECTRUM_Z80_SNAPSHOT_TS2068 +}; + +/***************************************************************************** + * + * .SCR format (used by many emulators) + * + ****************************************************************************/ +#define SCR_BITMAP 6144 +#define SCR_ATTR 768 +#define SCR_SIZE (SCR_BITMAP + SCR_ATTR) + +/***************************************************************************** + * + * .RAW format (used by many emulators) + * + ****************************************************************************/ +#define RAW_OFFSET 0 +#define RAW_HDR 9 +#define RAW_SIZE (RAW_HDR + 3*SPECTRUM_BANK) + +#endif /* __SPEC_SNQK_H__ */ diff --git a/src/mame/machine/special.c b/src/mame/machine/special.c new file mode 100644 index 00000000000..4bbcdbf4dd9 --- /dev/null +++ b/src/mame/machine/special.c @@ -0,0 +1,397 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Specialist machine driver by Miodrag Milanovic + + 20/03/2008 Cassette support + 15/03/2008 Preliminary driver. + +****************************************************************************/ + + + +#include "includes/special.h" + + +/* Driver initialization */ +DRIVER_INIT_MEMBER(special_state,special) +{ + /* set initialy ROM to be visible on first bank */ + UINT8 *RAM = m_region_maincpu->base(); + memset(RAM,0x0000,0x3000); // make first page empty by default + m_bank1->configure_entries(1, 2, RAM, 0x0000); + m_bank1->configure_entries(0, 2, RAM, 0xc000); +} + +READ8_MEMBER( special_state::specialist_8255_porta_r ) +{ + if (m_io_line0->read()!=0xff) return 0xfe; + if (m_io_line1->read()!=0xff) return 0xfd; + if (m_io_line2->read()!=0xff) return 0xfb; + if (m_io_line3->read()!=0xff) return 0xf7; + if (m_io_line4->read()!=0xff) return 0xef; + if (m_io_line5->read()!=0xff) return 0xdf; + if (m_io_line6->read()!=0xff) return 0xbf; + if (m_io_line7->read()!=0xff) return 0x7f; + return 0xff; +} + +READ8_MEMBER( special_state::specialist_8255_portb_r ) +{ + UINT8 dat = 0xff; + + if ((m_specialist_8255_porta & 0x01)==0) dat &= m_io_line0->read(); + if ((m_specialist_8255_porta & 0x02)==0) dat &= m_io_line1->read(); + if ((m_specialist_8255_porta & 0x04)==0) dat &= m_io_line2->read(); + if ((m_specialist_8255_porta & 0x08)==0) dat &= m_io_line3->read(); + if ((m_specialist_8255_porta & 0x10)==0) dat &= m_io_line4->read(); + if ((m_specialist_8255_porta & 0x20)==0) dat &= m_io_line5->read(); + if ((m_specialist_8255_porta & 0x40)==0) dat &= m_io_line6->read(); + if ((m_specialist_8255_porta & 0x80)==0) dat &= m_io_line7->read(); + if ((m_specialist_8255_portc & 0x01)==0) dat &= m_io_line8->read(); + if ((m_specialist_8255_portc & 0x02)==0) dat &= m_io_line9->read(); + if ((m_specialist_8255_portc & 0x04)==0) dat &= m_io_line10->read(); + if ((m_specialist_8255_portc & 0x08)==0) dat &= m_io_line11->read(); + + // shift key + if BIT(~m_io_line12->read(), 0) + dat &= 0xfd; + + // cassette + if (m_cassette->input() > 0.01) + dat &= 0xfe; + + // strobe if a key is pressed + if (dat < 0xfc) dat &= 0x7f; + + return dat; +} + +READ8_MEMBER( special_state::specimx_8255_portb_r ) +{ + UINT8 dat = 0xff; + + if ((m_specialist_8255_porta & 0x01)==0) dat &= m_io_line0->read(); + if ((m_specialist_8255_porta & 0x02)==0) dat &= m_io_line1->read(); + if ((m_specialist_8255_porta & 0x04)==0) dat &= m_io_line2->read(); + if ((m_specialist_8255_porta & 0x08)==0) dat &= m_io_line3->read(); + if ((m_specialist_8255_porta & 0x10)==0) dat &= m_io_line4->read(); + if ((m_specialist_8255_porta & 0x20)==0) dat &= m_io_line5->read(); + if ((m_specialist_8255_porta & 0x40)==0) dat &= m_io_line6->read(); + if ((m_specialist_8255_porta & 0x80)==0) dat &= m_io_line7->read(); + if ((m_specialist_8255_portc & 0x01)==0) dat &= m_io_line8->read(); + if ((m_specialist_8255_portc & 0x02)==0) dat &= m_io_line9->read(); + if ((m_specialist_8255_portc & 0x04)==0) dat &= m_io_line10->read(); + if ((m_specialist_8255_portc & 0x08)==0) dat &= m_io_line11->read(); + + // shift key + if BIT(~m_io_line12->read(), 0) + dat &= 0xfd; + + // cassette + if (m_cassette->input() > 0.01) + dat &= 0xfe; + + return dat; +} + +READ8_MEMBER( special_state::specialist_8255_portc_r ) +{ + if (m_io_line8->read()!=0xff) return 0x0e; + if (m_io_line9->read()!=0xff) return 0x0d; + if (m_io_line10->read()!=0xff) return 0x0b; + if (m_io_line11->read()!=0xff) return 0x07; + return 0x0f; +} + +WRITE8_MEMBER( special_state::specialist_8255_porta_w ) +{ + m_specialist_8255_porta = data; +} + +WRITE8_MEMBER( special_state::specialist_8255_portb_w ) +{ + m_specialist_8255_portb = data; +} + +WRITE8_MEMBER( special_state::specialist_8255_portc_w ) +{ + m_specialist_8255_portc = data; + + m_cassette->output(BIT(data, 7) ? 1 : -1); + + m_dac->write_unsigned8(BIT(data, 5)); //beeper +} + +void special_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_RESET: + m_bank1->set_entry(0); + break; + case TIMER_PIT8253_GATES: + { + m_pit->write_gate0(0); + m_pit->write_gate1(0); + m_pit->write_gate2(0); + break; + } + default: + assert_always(FALSE, "Unknown id in special_state::device_timer"); + } +} + + +MACHINE_RESET_MEMBER(special_state,special) +{ + timer_set(attotime::from_usec(10), TIMER_RESET); + m_bank1->set_entry(1); +} + + +/* + Specialist MX +*/ +WRITE8_MEMBER( special_state::video_memory_w ) +{ + m_ram->pointer()[0x9000 + offset] = data; + m_specimx_colorram[offset] = m_specimx_color; +} + +WRITE8_MEMBER( special_state::specimx_video_color_w ) +{ + m_specimx_color = data; +} + +READ8_MEMBER( special_state::specimx_video_color_r ) +{ + return m_specimx_color; +} + +void special_state::specimx_set_bank(offs_t i, UINT8 data) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = m_ram->pointer(); + + space.install_write_bank(0xc000, 0xffbf, "bank3"); + space.install_write_bank(0xffc0, 0xffdf, "bank4"); + m_bank4->set_base(ram + 0xffc0); + switch(i) + { + case 0 : + space.install_write_bank(0x0000, 0x8fff, "bank1"); + space.install_write_handler(0x9000, 0xbfff, write8_delegate(FUNC(special_state::video_memory_w), this)); + + m_bank1->set_base(ram); + m_bank2->set_base(ram + 0x9000); + m_bank3->set_base(ram + 0xc000); + break; + case 1 : + space.install_write_bank(0x0000, 0x8fff, "bank1"); + space.install_write_bank(0x9000, 0xbfff, "bank2"); + + m_bank1->set_base(ram + 0x10000); + m_bank2->set_base(ram + 0x19000); + m_bank3->set_base(ram + 0x1c000); + break; + case 2 : + space.unmap_write(0x0000, 0x8fff); + space.unmap_write(0x9000, 0xbfff); + + m_bank1->set_base(m_region_maincpu->base() + 0x10000); + m_bank2->set_base(m_region_maincpu->base() + 0x19000); + + if (data & 0x80) + m_bank3->set_base(ram + 0x1c000); + else + m_bank3->set_base(ram + 0xc000); + + break; + } +} + +WRITE8_MEMBER( special_state::specimx_select_bank ) +{ + specimx_set_bank(offset, data); +} + +MACHINE_START_MEMBER(special_state,specimx) +{ + m_drive = 0; +} + +MACHINE_RESET_MEMBER(special_state,specimx) +{ + specimx_set_bank(2, 0); // Initiali load ROM disk + timer_set(attotime::zero, TIMER_PIT8253_GATES); +} + +READ8_MEMBER( special_state::specimx_disk_ctrl_r ) +{ + return 0xff; +} + +WRITE_LINE_MEMBER( special_state::fdc_drq ) +{ + /* Clears HALT state of CPU when data is ready to read */ + if(state) { + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + } +} + +WRITE8_MEMBER( special_state::specimx_disk_ctrl_w ) +{ + static const char *names[] = { "fd0", "fd1"}; + floppy_image_device *floppy = NULL; + floppy_connector *con = machine().device(names[m_drive & 1]); + if(con) + floppy = con->get_device(); + + m_fdc->set_floppy(floppy); + floppy->mon_w(0); + + switch(offset) + { + case 0 : + m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + break; + case 2 : + floppy->ss_w(data & 1); + break; + case 3 : + m_drive = data & 1; + break; + } +} + +/* + Erik +*/ + +void special_state::erik_set_bank() +{ + UINT8 bank1 = m_RR_register & 3; + UINT8 bank2 = (m_RR_register >> 2) & 3; + UINT8 bank3 = (m_RR_register >> 4) & 3; + UINT8 bank4 = (m_RR_register >> 6) & 3; + UINT8 *mem = m_region_maincpu->base(); + UINT8 *ram = m_ram->pointer(); + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.install_write_bank(0x0000, 0x3fff, "bank1"); + space.install_write_bank(0x4000, 0x8fff, "bank2"); + space.install_write_bank(0x9000, 0xbfff, "bank3"); + space.install_write_bank(0xc000, 0xefff, "bank4"); + space.install_write_bank(0xf000, 0xf7ff, "bank5"); + space.install_write_bank(0xf800, 0xffff, "bank6"); + + switch(bank1) + { + case 1: + case 2: + case 3: + m_bank1->set_base(ram + 0x10000*(bank1-1)); + break; + case 0: + space.unmap_write(0x0000, 0x3fff); + m_bank1->set_base(mem + 0x10000); + break; + } + switch(bank2) + { + case 1: + case 2: + case 3: + m_bank2->set_base(ram + 0x10000*(bank2-1) + 0x4000); + break; + case 0: + space.unmap_write(0x4000, 0x8fff); + m_bank2->set_base(mem + 0x14000); + break; + } + switch(bank3) + { + case 1: + case 2: + case 3: + m_bank3->set_base(ram + 0x10000*(bank3-1) + 0x9000); + break; + case 0: + space.unmap_write(0x9000, 0xbfff); + m_bank3->set_base(mem + 0x19000); + break; + } + switch(bank4) + { + case 1: + case 2: + case 3: + m_bank4->set_base(ram + 0x10000*(bank4-1) + 0x0c000); + m_bank5->set_base(ram + 0x10000*(bank4-1) + 0x0f000); + m_bank6->set_base(ram + 0x10000*(bank4-1) + 0x0f800); + break; + case 0: + space.unmap_write(0xc000, 0xefff); + m_bank4->set_base(mem + 0x1c000); + space.unmap_write(0xf000, 0xf7ff); + space.nop_read(0xf000, 0xf7ff); + space.install_readwrite_handler(0xf800, 0xf803, 0, 0x7fc, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi)); + break; + } +} + +DRIVER_INIT_MEMBER(special_state,erik) +{ + m_erik_color_1 = 0; + m_erik_color_2 = 0; + m_erik_background = 0; +} + +MACHINE_RESET_MEMBER(special_state,erik) +{ + m_RR_register = 0x00; + m_RC_register = 0x00; + erik_set_bank(); +} + +READ8_MEMBER( special_state::erik_rr_reg_r ) +{ + return m_RR_register; +} + +WRITE8_MEMBER( special_state::erik_rr_reg_w ) +{ + m_RR_register = data; + erik_set_bank(); +} + +READ8_MEMBER( special_state::erik_rc_reg_r ) +{ + return m_RC_register; +} + +WRITE8_MEMBER( special_state::erik_rc_reg_w ) +{ + m_RC_register = data; + m_erik_color_1 = m_RC_register & 7; + m_erik_color_2 = (m_RC_register >> 3) & 7; + m_erik_background = BIT(m_RC_register, 6) + BIT(m_RC_register, 7) * 4; +} + +READ8_MEMBER( special_state::erik_disk_reg_r ) +{ + return 0xff; +} + +WRITE8_MEMBER( special_state::erik_disk_reg_w ) +{ +/* + wd17xx_set_side (m_fdc,data & 1); + wd17xx_set_drive(m_fdc,(data >> 1) & 1); + wd17xx_dden_w(m_fdc, BIT(data, 2)); + floppy_mon_w(floppy_get_device(machine(), BIT(data, 1)), 0); + floppy_mon_w(floppy_get_device(machine(), BIT(data, 1) ^ 1), 1); + floppy_drive_set_ready_state(floppy_get_device(machine(), BIT(data, 1)), 1, 1);*/ +} diff --git a/src/mame/machine/super80.c b/src/mame/machine/super80.c new file mode 100644 index 00000000000..b77c04b68fd --- /dev/null +++ b/src/mame/machine/super80.c @@ -0,0 +1,240 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/* Super80.c written by Robbbert, 2005-2009. See driver source for documentation. */ + +#include "includes/super80.h" +#include "machine/z80bin.h" + +/**************************** PIO ******************************************************************************/ + + +WRITE8_MEMBER( super80_state::pio_port_a_w ) +{ + m_keylatch = data; + m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); // refresh kbd int +} + +READ8_MEMBER( super80_state::pio_port_b_r ) +{ + UINT8 data = 0xff; + + for (int i = 0; i < 8; i++) + { + if (!BIT(m_keylatch, i)) + data &= m_io_keyboard[i]->read(); + } + + m_key_pressed = 3; + + return data; +} + +/**************************** CASSETTE ROUTINES *****************************************************************/ + +void super80_state::super80_cassette_motor( UINT8 data ) +{ + if (data) + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + else + m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + + /* does user want to hear the sound? */ + if BIT(m_io_config->read(), 3) + m_cassette->change_state(CASSETTE_SPEAKER_ENABLED,CASSETTE_MASK_SPEAKER); + else + m_cassette->change_state(CASSETTE_SPEAKER_MUTED,CASSETTE_MASK_SPEAKER); +} + +/********************************************* TIMER ************************************************/ + + +// If normal keyboard scan has stopped, then do a scan to allow the interrupt key sequence +TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_k ) +{ + if (m_key_pressed) + m_key_pressed--; + else + if (!m_key_pressed) + m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); +} + +/* cassette load circuit + This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage, + and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint. + + The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop. + The "read-any-system" cassette circuit is a CA3140 op-amp, the smarts being done in software. + + bit 0 = original system (U79 and U1) + bit 1 = MDS fast system + bit 2 = CA3140 */ +TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_p ) +{ + UINT8 cass_ws=0; + + m_cass_data[1]++; + cass_ws = ((m_cassette)->input() > +0.03) ? 4 : 0; + + if (cass_ws != m_cass_data[0]) + { + if (cass_ws) m_cass_data[3] ^= 2; // the MDS flipflop + m_cass_data[0] = cass_ws; + m_cass_data[2] = ((m_cass_data[1] < 0x0d) ? 1 : 0) | cass_ws | m_cass_data[3]; + m_cass_data[1] = 0; + } +} + +/* after the first 4 bytes have been read from ROM, switch the ram back in */ +TIMER_CALLBACK_MEMBER(super80_state::super80_reset) +{ + membank("boot")->set_entry(0); +} + +TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_h ) +{ + UINT8 go_fast = 0; + if ( (!BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 1)) ) /* bit 2 of port F0 is low, OR user turned on config switch */ + go_fast++; + + /* code to slow down computer to 1 MHz by halting cpu on every second frame */ + if (!go_fast) + { + if (!m_int_sw) + m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); // if going, stop it + + m_int_sw++; + if (m_int_sw > 1) + { + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); // if stopped, start it + m_int_sw = 0; + } + } + else + { + if (m_int_sw < 8) // @2MHz, reset just once + { + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_int_sw = 8; // ...not every time + } + } +} + +/*************************************** PRINTER ********************************************************/ + +/* The Super80 had an optional I/O card that plugged into the S-100 slot. The card had facility for running + an 8-bit Centronics printer, and a serial device at 300, 600, or 1200 baud. The I/O address range + was selectable via 4 dipswitches. The serial parameters (baud rate, parity, stop bits, etc) was + chosen with more dipswitches. Regretably, no parameters could be set by software. Currently, the + Centronics printer is emulated; the serial side of things may be done later, as will the dipswitches. + + The most commonly used I/O range is DC-DE (DC = centronics, DD = serial data, DE = serial control + All the home-brew roms use this, except for super80e which uses BC-BE. */ + +/**************************** I/O PORTS *****************************************************************/ + +READ8_MEMBER( super80_state::port3e_r ) +{ + return 0xF8 | (m_fdc->intrq_r() << 0) | (m_fdc->drq_r() << 1) | 4; +} + +// UFDC board can support 4 drives; we support 2 +WRITE8_MEMBER( super80_state::port3f_w ) +{ + // m_fdc->58(BIT(data, 0)); 5/8 pin not emulated in wd_fdc + m_fdc->enmf_w(BIT(data,1)); + + floppy_image_device *floppy = NULL; + if (BIT(data, 2)) floppy = m_floppy0->get_device(); + if (BIT(data, 3)) floppy = m_floppy1->get_device(); + //if (BIT(data, 4)) floppy = m_floppy2->get_device(); + //if (BIT(data, 5)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(!BIT(data, 6)); + } + + m_fdc->dden_w(BIT(data, 7)); +} + +READ8_MEMBER( super80_state::super80_f2_r ) +{ + UINT8 data = m_io_dsw->read() & 0xf0; // dip switches on pcb + data |= m_cass_data[2]; // bit 0 = output of U1, bit 1 = MDS cass state, bit 2 = current wave_state + data |= 0x08; // bit 3 - not used + return data; +} + +WRITE8_MEMBER( super80_state::super80_dc_w ) +{ + /* hardware strobe driven from port select, bit 7..0 = data */ + m_cent_data_out->write(space, 0, data); + m_centronics->write_strobe(0); + m_centronics->write_strobe(1); +} + + +WRITE8_MEMBER( super80_state::super80_f0_w ) +{ + UINT8 bits = data ^ m_last_data; + m_portf0 = data; + m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */ + if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ + m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */ + + m_last_data = data; +} + +WRITE8_MEMBER( super80_state::super80r_f0_w ) +{ + UINT8 bits = data ^ m_last_data; + m_portf0 = data | 0x14; + m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */ + if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ + m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */ + + m_last_data = data; +} + +/**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/ + +void super80_state::machine_reset() +{ + m_portf0 = 0xff; + m_keylatch = 0xff; + m_key_pressed = 0; + m_palette_index = 0; + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(super80_state::super80_reset),this)); + membank("boot")->set_entry(1); +} + +DRIVER_INIT_MEMBER( super80_state,super80 ) +{ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); +} + + +/*------------------------------------------------- + QUICKLOAD_LOAD_MEMBER( super80_state, super80 ) +-------------------------------------------------*/ + +QUICKLOAD_LOAD_MEMBER( super80_state, super80 ) +{ + UINT16 exec_addr, start_addr, end_addr; + + /* load the binary into memory */ + if (z80bin_load_file(&image, m_maincpu->space(AS_PROGRAM), file_type, &exec_addr, &start_addr, &end_addr) == IMAGE_INIT_FAIL) + return IMAGE_INIT_FAIL; + + /* is this file executable? */ + if (exec_addr != 0xffff) + /* check to see if autorun is on */ + if BIT(m_io_config->read(), 0) + m_maincpu->set_pc(exec_addr); + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/svi318.c b/src/mame/machine/svi318.c new file mode 100644 index 00000000000..89ea87ce0e8 --- /dev/null +++ b/src/mame/machine/svi318.c @@ -0,0 +1,767 @@ +// license:??? +// copyright-holders:Sean Young,Tomas Karlsson +/* +** Spectravideo SVI-318 and SVI-328 +** +** Sean Young, Tomas Karlsson +** +*/ + +#include "emu.h" +#include "video/mc6845.h" +#include "includes/svi318.h" +#include "cpu/z80/z80.h" +#include "video/tms9928a.h" +#include "imagedev/flopdrv.h" +#include "formats/svi_cas.h" +#include "sound/ay8910.h" + +enum { + SVI_INTERNAL = 0, + SVI_CART = 1, + SVI_EXPRAM2 = 2, + SVI_EXPRAM3 = 3 +}; + + +/* Serial ports */ + +WRITE_LINE_MEMBER(svi318_state::ins8250_interrupt) +{ + if (m_bank_low != SVI_CART) + m_maincpu->set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE)); +} + +#if 0 +static INS8250_REFRESH_CONNECT( svi318_com_refresh_connected ) +{ + /* Motorola MC14412 modem */ + ins8250_handshake_in(device, UART8250_HANDSHAKE_IN_CTS|UART8250_HANDSHAKE_IN_DSR|UART8250_INPUTS_RING_INDICATOR|UART8250_INPUTS_DATA_CARRIER_DETECT); +} +#endif + +/* Cartridge */ + +bool svi318_state::cart_verify(UINT8 *ROM) +{ + if (ROM[0] != 0xf3 || ROM[1] != 0x31) + return false; + + return true; +} + +DEVICE_IMAGE_LOAD_MEMBER( svi318_state, svi318_cart ) +{ + UINT32 size = m_cart->common_get_size("rom"); + + if (size > 0x8000) + { + logerror("Cart image %s larger than expected. Please report the issue.\n", image.filename()); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + if (image.software_entry() == NULL && !cart_verify(m_cart->get_rom_base())) + return IMAGE_INIT_FAIL; + + return IMAGE_INIT_PASS; +} + + + +/* PPI */ + +/* + PPI Port A Input (address 98H) + Bit Name Description + 1 TA Joystick 1, /SENSE + 2 TB Joystick 1, EOC + 3 TC Joystick 2, /SENSE + 4 TD Joystick 2, EOC + 5 TRIGGER1 Joystick 1, Trigger + 6 TRIGGER2 Joystick 2, Trigger + 7 /READY Cassette, Ready + 8 CASR Cassette, Read data +*/ + +READ8_MEMBER(svi318_state::ppi_port_a_r) +{ + int data = 0x0f; + + if (m_cassette->input() > 0.0038) + data |= 0x80; + if (!m_cassette->exists()) + data |= 0x40; + + data |= m_buttons->read() & 0x30; + + return data; +} + +/* + PPI Port B Input (address 99H) + Bit Name Description + 1 IN0 Keyboard, Column status of selected line + 2 IN1 Keyboard, Column status of selected line + 3 IN2 Keyboard, Column status of selected line + 4 IN3 Keyboard, Column status of selected line + 5 IN4 Keyboard, Column status of selected line + 6 IN5 Keyboard, Column status of selected line + 7 IN6 Keyboard, Column status of selected line + 8 IN7 Keyboard, Column status of selected line +*/ + +READ8_MEMBER(svi318_state::ppi_port_b_r) +{ + if (m_keyboard_row <= 10) + return m_line[m_keyboard_row]->read(); + else + return 0xff; +} + +/* + PPI Port C Output (address 97H) + Bit Name Description + 1 KB0 Keyboard, Line select 0 + 2 KB1 Keyboard, Line select 1 + 3 KB2 Keyboard, Line select 2 + 4 KB3 Keyboard, Line select 3 + 5 CASON Cassette, Motor relay control (0=on, 1=off) + 6 CASW Cassette, Write data + 7 CASAUD Cassette, Audio out (pulse) + 8 SOUND Keyboard, Click sound bit (pulse) +*/ + +WRITE8_MEMBER(svi318_state::ppi_port_c_w) +{ + int val; + + /* key click */ + val = (data & 0x80) ? 0x3e : 0; + val += (data & 0x40) ? 0x3e : 0; + m_dac->write_signed8(val); + + /* cassette motor on/off */ + if (m_cassette->exists()) + { + m_cassette->change_state( + (data & 0x10) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, + CASSETTE_MOTOR_DISABLED); + } + + /* cassette signal write */ + m_cassette->output((data & 0x20) ? -1.0 : +1.0); + + m_keyboard_row = data & 0x0f; +} + +WRITE8_MEMBER(svi318_state::ppi_w) +{ + m_ppi->write(space, offset + 2, data); +} + + +/* PSG */ + +/* + PSG Port A Input + Bit Name Description + 1 FWD1 Joystick 1, Forward + 2 BACK1 Joystick 1, Back + 3 LEFT1 Joystick 1, Left + 4 RIGHT1 Joystick 1, Right + 5 FWD2 Joystick 2, Forward + 6 BACK2 Joystick 2, Back + 7 LEFT2 Joystick 2, Left + 8 RIGHT2 Joystick 2, Right +*/ + +READ8_MEMBER(svi318_state::psg_port_a_r) +{ + return m_joysticks->read(); +} + +/* + PSG Port B Output + Bit Name Description + 1 /CART Memory bank 11, ROM 0000-7FFF (Cartridge /CCS1, /CCS2) + 2 /BK21 Memory bank 21, RAM 0000-7FFF + 3 /BK22 Memory bank 22, RAM 8000-FFFF + 4 /BK31 Memory bank 31, RAM 0000-7FFF + 5 /BK32 Memory bank 32, RAM 8000-7FFF + 6 CAPS Caps-Lock diod + 7 /ROMEN0 Memory bank 12, ROM 8000-BFFF* (Cartridge /CCS3) + 8 /ROMEN1 Memory bank 12, ROM C000-FFFF* (Cartridge /CCS4) + + * The /CART signal must be active for any effect and all banks + with RAM are disabled. +*/ + +WRITE8_MEMBER(svi318_state::psg_port_b_w) +{ + if ((m_bank_switch ^ data) & 0x20) + set_led_status(machine(), 0, !(data & 0x20)); + + m_bank_switch = data; + set_banks(); +} + +/* Disk drives */ + +WRITE_LINE_MEMBER(svi318_state::fdc_intrq_w) +{ + m_irq = state; +} + +WRITE_LINE_MEMBER(svi318_state::fdc_drq_w) +{ + m_drq = state; +} + +WRITE8_MEMBER(svi318_state::fdc_drive_motor_w) +{ + m_floppy = NULL; + + if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); + if (BIT(data, 1)) m_floppy = m_floppy1->get_device(); + + m_fd1793->set_floppy(m_floppy); + + if (m_floppy0->get_device()) + m_floppy0->get_device()->mon_w(!BIT(data, 2)); + + if (m_floppy1->get_device()) + m_floppy1->get_device()->mon_w(!BIT(data, 3)); +} + +WRITE8_MEMBER(svi318_state::fdc_density_side_w) +{ + m_fd1793->dden_w(BIT(data, 0)); + + if (m_floppy) + m_floppy->ss_w(BIT(data, 1)); +} + +READ8_MEMBER(svi318_state::fdc_irqdrq_r) +{ + UINT8 result = 0; + + result |= m_drq << 6; + result |= m_irq << 7; + + return result; +} + +MC6845_UPDATE_ROW( svi318_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + for (int i = 0; i < x_count; i++) + { + UINT8 data = m_svi806_gfx[m_svi806_ram[(ma + i) & 0x7ff] * 16 + ra]; + + if (i == cursor_x) + { + data = 0xff; + } + + for (int j = 0; j < 8; j++) + { + bitmap.pix32(y, i * 8 + j) = palette[TMS9928A_PALETTE_SIZE + BIT(data, 7)]; + data = data << 1; + } + } +} + + +WRITE8_MEMBER(svi318_state::svi806_ram_enable_w) +{ + m_svi806_ram_enabled = (data & 0x01); + set_banks(); +} + + +/* Init functions */ + +static const UINT8 cc_op[0x100] = { + 4+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, 4+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, + 8+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,12+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, + 7+1,10+1,16+1, 6+1, 4+1, 4+1, 7+1, 4+1, 7+1,11+1,16+1, 6+1, 4+1, 4+1, 7+1, 4+1, + 7+1,10+1,13+1, 6+1,11+1,11+1,10+1, 4+1, 7+1,11+1,13+1, 6+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 7+1, 7+1, 7+1, 7+1, 7+1, 7+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, + 5+1,10+1,10+1,10+1,10+1,11+1, 7+1,11+1, 5+1,10+1,10+1, 0+1,10+1,17+1, 7+1,11+1, + 5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 0+1, 7+1,11+1, + 5+1,10+1,10+1,19+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1, 4+1,10+1, 0+1, 7+1,11+1, + 5+1,10+1,10+1, 4+1,10+1,11+1, 7+1,11+1, 5+1, 6+1,10+1, 4+1,10+1, 0+1, 7+1,11+1 +}; + +static const UINT8 cc_cb[0x100] = { + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2 +}; + +static const UINT8 cc_ed[0x100] = { + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, +12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2, +12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2, +12+2,12+2,15+2,20+2, 8+2,14+2, 8+2,18+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2,18+2, +12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 8+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, +16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2,16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2, +16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2,16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, + 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2 +}; + +static const UINT8 cc_xy[0x100] = { + 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2,15+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2,15+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, + 4+2,14+2,20+2,10+2, 9+2, 9+2, 9+2, 4+2, 4+2,15+2,20+2,10+2, 9+2, 9+2, 9+2, 4+2, + 4+2, 4+2, 4+2, 4+2,23+2,23+2,19+2, 4+2, 4+2,15+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, + 9+2, 9+2, 9+2, 9+2, 9+2, 9+2,19+2, 9+2, 9+2, 9+2, 9+2, 9+2, 9+2, 9+2,19+2, 9+2, +19+2,19+2,19+2,19+2,19+2,19+2, 4+2,19+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 0+2, 4+2, 4+2, 4+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, + 4+2,14+2, 4+2,23+2, 4+2,15+2, 4+2, 4+2, 4+2, 8+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, + 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2,10+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2 +}; + +static const UINT8 cc_xycb[0x100] = { +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, +20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, +20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, +20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, +23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2 +}; + +/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */ +static const UINT8 cc_ex[0x100] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DJNZ */ + 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NZ/JR Z */ + 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NC/JR C */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0+1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, /* LDIR/CPIR/INIR/OTIR LDDR/CPDR/INDR/OTDR */ + 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, + 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, + 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, + 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2+1 +}; + + +DRIVER_INIT_MEMBER(svi318_state, svi318) +{ + /* z80 stuff */ + m_maincpu->z80_set_cycle_tables(cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex); + + m_maincpu->set_input_line_vector(0, 0xff); + + /* memory */ + m_empty_bank = auto_alloc_array(machine(), UINT8, 0x8000); + memset(m_empty_bank, 0xff, 0x8000); + + m_bank_low_ptr = m_empty_bank; + m_bank_high1_ptr = m_empty_bank; + m_bank_high2_ptr = m_empty_bank; +} + +DRIVER_INIT_MEMBER(svi318_state, svi328_806) +{ + DRIVER_INIT_CALL(svi318); + m_svi806_present = 1; +} + +void svi318_state::machine_start() +{ + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + m_bios_rom = memregion("maincpu"); + + // 80 column card start + if (m_svi806_present) + { + // 2K RAM, but allocating 4KB to make banking easier + // The upper 2KB will be set to FFs and will never be written to + m_svi806_ram.resize(0x1000); + save_item(NAME(m_svi806_ram)); + memset(&m_svi806_ram[0], 0x00, 0x800); + memset(&m_svi806_ram[0x800], 0xff, 0x800); + + m_svi806_gfx = memregion("gfx1")->base(); + + // Set SVI-806 80 column card palette + m_palette->set_pen_color(TMS9928A_PALETTE_SIZE, 0, 0, 0); /* Monochrome black */ + m_palette->set_pen_color(TMS9928A_PALETTE_SIZE+1, 0, 224, 0); /* Monochrome green */ + } + + // register for savestates + save_item(NAME(m_drq)); + save_item(NAME(m_irq)); + + save_item(NAME(m_bank_switch)); + save_item(NAME(m_bank_low)); + save_item(NAME(m_bank_high)); + save_item(NAME(m_bank_low_read_only)); + save_item(NAME(m_bank_high1_read_only)); + save_item(NAME(m_bank_high2_read_only)); + save_item(NAME(m_keyboard_row)); + save_item(NAME(m_centronics_busy)); + + save_item(NAME(m_svi806_present)); + save_item(NAME(m_svi806_ram_enabled)); + + machine().save().register_postload(save_prepost_delegate(FUNC(svi318_state::postload), this)); +} + +void svi318_state::machine_reset() +{ + m_keyboard_row = 0; + m_centronics_busy = 0; + m_svi806_present = 0; + m_svi806_ram_enabled = 0; + m_drq = 0; + m_irq = 0; + + m_bank_low = 0; + m_bank_high = 0; + m_bank_low_read_only = 0; + m_bank_high1_read_only = 0; + m_bank_high2_read_only = 0; + + m_bank_switch = 0xff; + set_banks(); +} + +/* Memory */ + +WRITE8_MEMBER(svi318_state::writemem1) +{ + if (m_bank_low_read_only) + return; + + m_bank_low_ptr[offset] = data; +} + +WRITE8_MEMBER(svi318_state::writemem2) +{ + if (m_bank_high1_read_only) + return; + + m_bank_high1_ptr[offset] = data; +} + +WRITE8_MEMBER(svi318_state::writemem3) +{ + if (m_bank_high2_read_only) + return; + + m_bank_high2_ptr[offset] = data; +} + +WRITE8_MEMBER(svi318_state::writemem4) +{ + if (m_svi806_ram_enabled) + { + if (offset < 0x800) + m_svi806_ram[offset] = data; + } + else + { + if (m_bank_high2_read_only) + return; + + m_bank_high2_ptr[0x3000 + offset] = data; + } +} + +void svi318_state::set_banks() +{ + const UINT8 v = m_bank_switch; + UINT8 *ram = m_ram->pointer(); + UINT32 ram_size = m_ram->size(); + + m_bank_low = (v & 1) ? ((v & 2) ? ((v & 8) ? SVI_INTERNAL : SVI_EXPRAM3) : SVI_EXPRAM2) : SVI_CART; + m_bank_high = (v & 4) ? ((v & 16) ? SVI_INTERNAL : SVI_EXPRAM3) : SVI_EXPRAM2; + + m_bank_low_ptr = m_empty_bank; + m_bank_low_read_only = 1; + + switch (m_bank_low) + { + case SVI_INTERNAL: + m_bank_low_ptr = m_bios_rom->base(); + break; + case SVI_CART: + if (m_cart_rom) + m_bank_low_ptr = m_cart_rom->base(); + break; + case SVI_EXPRAM2: + if (ram_size >= 64 * 1024) + { + m_bank_low_ptr = ram + ram_size - 64 * 1024; + m_bank_low_read_only = 0; + } + break; + case SVI_EXPRAM3: + if (ram_size > 128 * 1024) + { + m_bank_low_ptr = ram + ram_size - 128 * 1024; + m_bank_low_read_only = 0; + } + break; + } + + m_bank_high1_ptr = m_empty_bank; + m_bank_high1_read_only = 1; + m_bank_high2_ptr = m_empty_bank; + m_bank_high2_read_only = 1; + + switch (m_bank_high) + { + case SVI_INTERNAL: + if (ram_size == 16 * 1024) + { + m_bank_high2_ptr = ram; + m_bank_high2_read_only = 0; + } + else + { + m_bank_high1_ptr = ram; + m_bank_high1_read_only = 0; + m_bank_high2_ptr = ram + 0x4000; + m_bank_high2_read_only = 0; + } + break; + case SVI_EXPRAM2: + if (ram_size > 64 * 1024) + { + m_bank_high1_ptr = ram + ram_size - 64 * 1024 + 32 * 1024; + m_bank_high1_read_only = 0; + m_bank_high2_ptr = ram + ram_size - 64 * 1024 + 48 * 1024; + m_bank_high2_read_only = 0; + } + break; + case SVI_EXPRAM3: + if (ram_size > 128 * 1024) + { + m_bank_high1_ptr = ram + ram_size - 128 * 1024 + 32 * 1024; + m_bank_high1_read_only = 0; + m_bank_high2_ptr = ram + ram_size - 128 * 1024 + 48 * 1024; + m_bank_high2_read_only = 0; + } + break; + } + + /* Check for special CART based banking */ + if (m_bank_low == SVI_CART && (v & 0xc0 ) != 0xc0) + { + m_bank_high1_ptr = m_empty_bank; + m_bank_high1_read_only = 1; + m_bank_high2_ptr = m_empty_bank; + m_bank_high2_read_only = 1; + + if (m_cart_rom && !(v & 0x80)) + m_bank_high2_ptr = m_cart_rom->base() + 0x4000; + if (m_cart_rom && !(v & 0x40)) + m_bank_high1_ptr = m_cart_rom->base(); + } + + m_bank1->set_base(m_bank_low_ptr); + m_bank2->set_base(m_bank_high1_ptr); + m_bank3->set_base(m_bank_high2_ptr); + + /* SVI-806 80 column card specific banking */ + if (m_svi806_present) + { + if (m_svi806_ram_enabled) + m_bank4->set_base(&m_svi806_ram[0]); + else + m_bank4->set_base(m_bank_high2_ptr + 0x3000); + } +} + +void svi318_state::postload() +{ + set_banks(); +} + + +/* External I/O */ + +WRITE_LINE_MEMBER(svi318_state::write_centronics_busy) +{ + m_centronics_busy = state; +} + +READ8_MEMBER(svi318_state::io_ext_r) +{ + if (m_bank_low == SVI_CART) + return 0xff; + + switch (offset) + { + case 0x12: + return 0xfe | m_centronics_busy; + + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + return m_ins8250_0->ins8250_r(space, offset & 7); + + case 0x28: + case 0x29: + case 0x2a: + case 0x2b: + case 0x2c: + case 0x2d: + case 0x2e: + case 0x2f: + return m_ins8250_1->ins8250_r(space, offset & 7); + + case 0x30: + return m_fd1793->status_r(space, 0); + + case 0x31: + return m_fd1793->track_r(space, 0); + + case 0x32: + return m_fd1793->sector_r(space, 0); + + case 0x33: + return m_fd1793->data_r(space, 0); + + case 0x34: + return fdc_irqdrq_r(space, 0); + + case 0x51: + return m_crtc->register_r(space, offset); + } + + return 0xff; +} + +WRITE8_MEMBER(svi318_state::io_ext_w) +{ + if (m_bank_low == SVI_CART) + return; + + switch (offset) + { + case 0x10: + m_cent_data_out->write(space, 0, data); + break; + + case 0x11: + m_centronics->write_strobe(BIT(data, 0)); + break; + + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + m_ins8250_0->ins8250_w(space, offset & 7, data); + break; + + case 0x28: + case 0x29: + case 0x2A: + case 0x2B: + case 0x2C: + case 0x2D: + case 0x2E: + case 0x2F: + m_ins8250_1->ins8250_w(space, offset & 7, data); + break; + + case 0x30: + m_fd1793->cmd_w(space, 0, data); + break; + case 0x31: + m_fd1793->track_w(space, 0, data); + break; + case 0x32: + m_fd1793->sector_w(space, 0, data); + break; + case 0x33: + m_fd1793->data_w(space, 0, data); + break; + case 0x34: + fdc_drive_motor_w(space, 0, data); + break; + case 0x38: + fdc_density_side_w(space, 0, data); + break; + + case 0x50: + m_crtc->address_w(space, offset, data); + break; + case 0x51: + m_crtc->register_w(space, offset, data); + break; + + case 0x58: + svi806_ram_enable_w(space, 0, data); + break; + } +} diff --git a/src/mame/machine/swim.c b/src/mame/machine/swim.c new file mode 100644 index 00000000000..9e1506ad9ab --- /dev/null +++ b/src/mame/machine/swim.c @@ -0,0 +1,222 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + swim.c + + Implementation of the Apple SWIM FDC controller; used on (less) + early Macs + +*********************************************************************/ + +#include "machine/swim.h" + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define LOG_SWIM 0 + +enum +{ + SWIM_MODE_IWM, + SWIM_MODE_SWIM, + SWIM_MODE_SWIM2, + SWIM_MODE_SWIM3 +}; + + +/*************************************************************************** + DEVICE +***************************************************************************/ + +const device_type SWIM = &device_creator; + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +swim_device::swim_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : applefdc_base_device(APPLEFDC_SWIM, mconfig, SWIM, "Apple SWIM (Steve Woz Integrated Machine)", tag, owner, clock, "swim", __FILE__) +{ +} + + + +//------------------------------------------------- +// device_start - device-specific start +//------------------------------------------------- + +void swim_device::device_start() +{ + // call inherited version + applefdc_base_device::device_start(); + + m_swim_mode = SWIM_MODE_IWM; + m_swim_magic_state = 0x00; + m_parm_offset = 0x00; + memset(m_ism_regs, 0, sizeof(m_ism_regs)); + memset(m_parms, 0, sizeof(m_parms)); +} + + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void swim_device::device_reset() +{ + // call inherited version + applefdc_base_device::device_reset(); + + static UINT8 swim_default_parms[16] = + { + 0x38, 0x18, 0x41, 0x2e, 0x2e, 0x18, 0x18, 0x1b, + 0x1b, 0x2f, 0x2f, 0x19, 0x19, 0x97, 0x1b, 0x57 + }; + + for (int i = 0; i < 16; i++) + { + m_parms[i] = swim_default_parms[i]; + } + + m_swim_magic_state = 0; + m_swim_mode = SWIM_MODE_IWM; + m_parm_offset = 0; +} + + + +//------------------------------------------------- +// read - reads a byte from the FDC +//------------------------------------------------- + +UINT8 swim_device::read(UINT8 offset) +{ + UINT8 result = 0; + + if (m_swim_mode == SWIM_MODE_IWM) + { + // IWM mode + result = applefdc_base_device::read(offset); + } + else if (m_swim_mode >= SWIM_MODE_SWIM) + { + // reading parameter RAM? + if ((offset & 7) == 3) + { + result = m_parms[m_parm_offset++]; + m_parm_offset &= 0xf; + } + else + { + result = m_ism_regs[offset&7]; + } + + if (LOG_SWIM) + logerror("SWIM: read %02x from offset %x\n", result, offset & 7); + } + return result; +} + + + +//------------------------------------------------- +// write - write a byte to the FDC +//------------------------------------------------- + +void swim_device::write(UINT8 offset, UINT8 data) +{ + if (m_swim_mode == SWIM_MODE_IWM) + { + // IWM mode + applefdc_base_device::write(offset, data); + } + else if (m_swim_mode >= SWIM_MODE_SWIM) + { + if (LOG_SWIM) + logerror("SWIM: write %02x to offset %x\n", data, offset & 7); + + switch (offset & 7) + { + case 2: // write CRC + break; + + case 3: // write parameter + m_parms[m_parm_offset++] = data; + m_parm_offset &= 0xf; + break; + + case 6: // write zeros to status (also zeroes parameter RAM pointer) + m_ism_regs[6] &= ~data; + m_parm_offset = 0; + + if (data == 0xf8) // magic "revert to IWM" value + { + if (LOG_SWIM) + logerror("SWIM: reverting to IWM\n"); + m_swim_mode = SWIM_MODE_IWM; + } + break; + + case 7: // write ones to status + m_ism_regs[6] |= data; + break; + + default: + m_ism_regs[offset & 7] = data; + break; + + } + } +} + + + +//------------------------------------------------- +// iwm_modereg_w - changes the mode register +//------------------------------------------------- + +void swim_device::iwm_modereg_w(UINT8 data) +{ + // SWIM mode is unlocked by writing 1/0/1/1 in a row to bit 6 (which is unused on IWM) + // when SWIM mode engages, the IWM is disconnected from both the 68k and the drives, + // and the ISM is substituted. + + switch (m_swim_magic_state) + { + case 0: + case 2: + case 3: + if (data & 0x40) + { + m_swim_magic_state++; + } + else + { + m_swim_magic_state = 0; + } + break; + case 1: + if (!(data & 0x40)) + { + m_swim_magic_state++; + } + else + { + m_swim_magic_state = 0; + } + break; + } + + if (m_swim_magic_state == 4) + { + m_swim_magic_state = 0; + m_swim_mode = SWIM_MODE_SWIM; + } + + // call inherited version + applefdc_base_device::iwm_modereg_w(data); +} diff --git a/src/mame/machine/swim.h b/src/mame/machine/swim.h new file mode 100644 index 00000000000..752f5404f47 --- /dev/null +++ b/src/mame/machine/swim.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + swim.h + + Implementation of the Apple SWIM FDC controller; used on (less) + early Macs + +*********************************************************************/ + +#ifndef __SWIM_H__ +#define __SWIM_H__ + +#include "machine/applefdc.h" + + +/*************************************************************************** + DEVICE +***************************************************************************/ + +extern const device_type SWIM; + +class swim_device : public applefdc_base_device +{ +public: + swim_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // read/write + virtual UINT8 read(UINT8 offset); + virtual void write(UINT8 offset, UINT8 data); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // other overrides + virtual void iwm_modereg_w(UINT8 data); + +private: + UINT8 m_swim_mode; + UINT8 m_swim_magic_state; + UINT8 m_parm_offset; + UINT8 m_ism_regs[8]; + UINT8 m_parms[16]; +}; + + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ + +#define MCFG_SWIM_ADD(_tag, _intrf) \ + MCFG_DEVICE_ADD(_tag, SWIM, 0) \ + MCFG_DEVICE_CONFIG(_intrf) + +#define MCFG_SWIM_MODIFY(_tag, _intrf) \ + MCFG_DEVICE_MODIFY(_tag) \ + MCFG_DEVICE_CONFIG(_intrf) + +#endif // __SWIM_H__ diff --git a/src/mame/machine/swtpc09.c b/src/mame/machine/swtpc09.c new file mode 100644 index 00000000000..29bae501462 --- /dev/null +++ b/src/mame/machine/swtpc09.c @@ -0,0 +1,859 @@ +// license:BSD-3-Clause +// copyright-holders:Robert Justice +/*************************************************************************** + swtpc09 machine file + Robert Justice ,2009-2014 + +****************************************************************************/ + +#include "emu.h" +#include "includes/swtpc09.h" + +#define DMAC_IRQ 0x01 // interrupt handler IDs +#define ACIA_IRQ 0x02 +#define PTM_IRQ 0x04 +#define PIA_IRQ 0x08 +#define FDC_IRQ 0x10 +#define VIA_IRQ 0x20 + +#define FLEX_DMF2 1 // system type flags +#define UNIFLEX_DMF2 2 +#define UNIFLEX_DMF3 3 +#define FLEX_DC4_PIAIDE 4 + +#define VERBOSE 0 + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + + +/******* MC6840 PTM on MPID Board *******/ + +/* 6840 PTM handlers */ +WRITE8_MEMBER( swtpc09_state::ptm_o1_callback ) +{ + pia6821_device *pia = machine().device("pia"); + + m_pia_counter++; + //pia_counter = pia_counter && 0xff; + if (m_pia_counter & 0x80) pia->ca1_w(1); +} + +WRITE8_MEMBER( swtpc09_state::ptm_o3_callback ) +{ + //ptm6840_device *ptm = machine().device("ptm"); + /* the output from timer3 is the input clock for timer2 */ + //m_ptm->set_c2(data); +} + +WRITE_LINE_MEMBER( swtpc09_state::ptm_irq ) +{ + if (state) + swtpc09_irq_handler(PTM_IRQ, ASSERT_LINE); + else + swtpc09_irq_handler(PTM_IRQ, CLEAR_LINE); +} + +/******* MC6821 PIA on MPID Board *******/ +/* Read/Write handlers for pia */ + +READ8_MEMBER( swtpc09_state::pia0_a_r ) +{ + return m_pia_counter; +} + +READ8_MEMBER( swtpc09_state::pia0_ca1_r ) +{ + return 0; +} + +WRITE_LINE_MEMBER( swtpc09_state::pia0_irq_a ) +{ + pia6821_device *pia = machine().device("pia"); + + if ( pia->irq_a_state()) + swtpc09_irq_handler(PIA_IRQ, ASSERT_LINE); + else + swtpc09_irq_handler(PIA_IRQ, CLEAR_LINE); + +} + + +/******* MC6850 ACIA on MPS2 *******/ + +WRITE_LINE_MEMBER( swtpc09_state::acia_interrupt ) +{ + if (state) + { + swtpc09_irq_handler(ACIA_IRQ, ASSERT_LINE); + LOG(("swtpc09_acia_irq_assert\n")); + } + else + { + swtpc09_irq_handler(ACIA_IRQ, CLEAR_LINE); + LOG(("swtpc09_acia_irq_clear\n")); + } +} + +/*********************************************************************/ +/* DMF2 Floppy Controller Board */ +/*********************************************************************/ + +/* DMF2 dma extended address register */ +READ8_MEMBER ( swtpc09_state::dmf2_dma_address_reg_r ) +{ + return m_fdc_dma_address_reg; +} + +WRITE8_MEMBER ( swtpc09_state::dmf2_dma_address_reg_w ) +{ + m_fdc_dma_address_reg = data; + + // bit 4 controls a gate enable/disable for DMF2 fdc irq line + if ((m_fdc_dma_address_reg & 0x10) && (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2)) + swtpc09_irq_handler(FDC_IRQ, CLEAR_LINE); //then clear the irq to cpu + + LOG(("swtpc09_dmf2_dma_address_reg_w %02X\n", data)); +} + +/* DMF2 fdc control register */ +READ8_MEMBER ( swtpc09_state::dmf2_control_reg_r ) +{ + //LOG(("swtpc09_dmf2_control_reg_r $%02X\n", m_fdc_status)); + return m_fdc_status; +} + +WRITE8_MEMBER ( swtpc09_state::dmf2_control_reg_w ) +{ + LOG(("swtpc09_dmf2_control_reg_w $%02X\n", data)); + + floppy_image_device *floppy = NULL; + + if (!BIT(data, 0)) floppy = m_floppy0->get_device(); + if (!BIT(data, 1)) floppy = m_floppy1->get_device(); + if (!BIT(data, 2)) floppy = m_floppy2->get_device(); + if (!BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(!BIT(data, 4)); + } + + m_fdc->dden_w(!BIT(data, 5)); +} + +/* FDC controller dma transfer */ +void swtpc09_state::swtpc09_fdc_dma_transfer() +{ + UINT8 *RAM = memregion("maincpu")->base(); + UINT32 offset; + address_space &space = m_maincpu->space(AS_PROGRAM); + + offset = (m_fdc_dma_address_reg & 0x0f)<<16; + + if (m_m6844_channel[0].active == 1) //active dma transfer + { + if (!(m_m6844_channel[0].control & 0x01)) // dma write to memory + { + UINT8 data = m_fdc->data_r(space, 0); + + LOG(("swtpc09_dma_write_mem %05X %02X\n", m_m6844_channel[0].address + offset, data)); + RAM[m_m6844_channel[0].address + offset] = data; + } + else + { + UINT8 data = RAM[m_m6844_channel[0].address + offset]; + + m_fdc->data_w(space, 0, data); + //LOG(("swtpc09_dma_read_mem %04X %02X\n", m_m6844_channel[0].address, data)); + } + + m_m6844_channel[0].address++; + m_m6844_channel[0].counter--; + + if (m_m6844_channel[0].counter == 0) // dma transfer has finished + { + m_m6844_channel[0].control |= 0x80; // set dend flag + if (m_m6844_interrupt & 0x01) // interrupt for channel 0 is enabled? + { + m_m6844_interrupt |= 0x80; // set bit 7 to indicate active interrupt + swtpc09_irq_handler(DMAC_IRQ, ASSERT_LINE); + } + } + } + +} + +/* common interrupt handler */ +void swtpc09_state::swtpc09_irq_handler(UINT8 peripheral, UINT8 state) +{ + LOG(("swtpc09_irq_handler peripheral:%02X state:%02X\n", peripheral, state)); + + switch (state) + { + case ASSERT_LINE: + m_interrupt |= peripheral; + break; + + case CLEAR_LINE: + m_interrupt &= (~peripheral & 0x3f); + break; + } + + if (!m_active_interrupt && m_interrupt) //no active interrupt and it needs to be asserted + { + m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + m_active_interrupt=TRUE; + LOG(("swtpc09_irq_assert %02X\n", peripheral)); + } + else if (m_active_interrupt && !m_interrupt) //active interrupt and it needs to be cleared + { + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + LOG(("swtpc09_irq_clear %02X\n", peripheral)); + m_active_interrupt=FALSE; + } +} + +/* handlers for fdc */ +WRITE_LINE_MEMBER( swtpc09_state::fdc_intrq_w ) +{ + LOG(("swtpc09_fdc_intrq_w %02X\n", state)); + if ( m_system_type == UNIFLEX_DMF3 ) //IRQ from 1791 is connect into VIA ca2 + { + if (state) + { + m_fdc_status |= 0x40; + m_via->write_cb2(0); //fdc interrupt is connected to CA1 + m_dmf3_via_porta &= 0xfb; //clear pa3 + //m_via->write_porta(m_dmf3_via_porta); //and connected to PA3 + //swtpc09_irq_handler(FDC_IRQ, ASSERT_LINE); + } + else + { + m_fdc_status &= ~0x40; + m_via->write_cb2(1); + m_dmf3_via_porta |= 0x04; //and connected to PA3 + //m_via->write_porta(m_dmf3_via_porta); //and connected to PA3 + //swtpc09_irq_handler(FDC_IRQ, CLEAR_LINE); + } + } + else if ( m_system_type == FLEX_DC4_PIAIDE ) //for dc4 emulate irq jumper out + { + if (state) + { + m_fdc_status |= 0x40; + } + else + { + m_fdc_status &= ~0x40; + } + } + else //for dmf2 it is connected directly to cpu via a gate + { + if (state) + { + m_fdc_status |= 0x40; + if (!(m_fdc_dma_address_reg & 0x10)) // is dmf2 fdc irq enabled + { + LOG(("swtpc09_fdc_int ** assert\n")); + swtpc09_irq_handler(FDC_IRQ, ASSERT_LINE); + } + } + else + { + m_fdc_status &= ~0x40; + if (!(m_fdc_dma_address_reg & 0x10)) // is dmf2 fdc irq enabled + { + LOG(("swtpc09_fdc_int ** clear\n")); + swtpc09_irq_handler(FDC_IRQ, CLEAR_LINE); + } + } + } +} + +WRITE_LINE_MEMBER( swtpc09_state::fdc_drq_w ) +{ + if (m_system_type == FLEX_DC4_PIAIDE) //for dc4 no dma + { + if (state) + { + m_fdc_status |= 0x80; + } + else + m_fdc_status &= 0x7f; + } + else + { + if (state) + { + m_fdc_status |= 0x80; + swtpc09_fdc_dma_transfer(); + } + else + m_fdc_status &= 0x7f; + } +} + +/*********************************************************************/ +/* DMF3 Board */ +/*********************************************************************/ + +/* via on dmf3 board */ +READ8_MEMBER( swtpc09_state::dmf3_via_read_porta ) +{ + return m_dmf3_via_porta; +} + +READ8_MEMBER( swtpc09_state::dmf3_via_read_portb ) +{ + return 0xff; +} + +WRITE8_MEMBER( swtpc09_state::dmf3_via_write_porta ) +{ + m_dmf3_via_porta &= data; +} + +//WRITE_LINE_MEMBER( swtpc09_state::dmf3_via_write_ca1 ) +//{ +// return m_via_ca1_input; +// LOG(("swtpc09_dmf3_via_write_ca1 %02X\n", state)); + +//} + +WRITE_LINE_MEMBER( swtpc09_state::dmf3_via_irq ) +{ + if (state) + swtpc09_irq_handler(VIA_IRQ, ASSERT_LINE); + else + swtpc09_irq_handler(VIA_IRQ, CLEAR_LINE); +} + +/* DMF3 dma extended address register */ +READ8_MEMBER ( swtpc09_state::dmf3_dma_address_reg_r ) +{ + return m_fdc_dma_address_reg; +} + +WRITE8_MEMBER ( swtpc09_state::dmf3_dma_address_reg_w ) +{ + m_fdc_dma_address_reg = data; + LOG(("swtpc09_dmf3_dma_address_reg_w %02X\n", data)); +} + +/* DMF3 fdc control register */ +READ8_MEMBER ( swtpc09_state::dmf3_control_reg_r ) +{ + //LOG(("swtpc09_dmf3_control_reg_r $%02X\n", m_fdc_status)); + return m_fdc_status; +} + +WRITE8_MEMBER ( swtpc09_state::dmf3_control_reg_w ) +{ + LOG(("swtpc09_dmf3_control_reg_w $%02X\n", data)); + + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); + } + + m_fdc->dden_w(BIT(data, 5)); +} + +// DC4 drive select + +WRITE8_MEMBER ( swtpc09_state::dc4_control_reg_w ) +{ + LOG(("swtpc09_dc4_control_reg_w $%02X\n", data)); + + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); +} + + +/******* MC6821 PIA on IDE Board *******/ +/* Read/Write handlers for pia ide */ +/* TODO: update and finish this off */ + +READ8_MEMBER( swtpc09_state::piaide_a_r ) +{ + return m_piaide_porta; +} + +READ8_MEMBER( swtpc09_state::piaide_b_r ) +{ + return m_piaide_portb; +} + +WRITE8_MEMBER( swtpc09_state::piaide_a_w ) +{ + m_piaide_porta = data; +} + +WRITE8_MEMBER( swtpc09_state::piaide_b_w ) +{ + int tempidedata; + + m_piaide_portb = data; + + if ((data & 0x40)&&(!(data&0x20))) //cs0=0 cs1=1 bit 5&6 + { + if (!(data & 0x02)) //rd line bit 1 + { + tempidedata = m_ide->read_cs0(space, (data&0x1c)>>2, 0xffff); + LOG(("swtpc09_ide_bus_r: offset $%02X data %04X\n", (data&0x1c)>>2, tempidedata)); + m_piaide_porta = tempidedata & 0x00ff; + } + else if (!(data & 0x01)) //wr line bit 0 + { + m_ide->write_cs0(space, (data&0x1c)>>2, m_piaide_porta, 0xffff); + LOG(("swtpc09_ide_bus_w: offset $%02X data %04X\n", (data&0x1c)>>2, m_piaide_porta)); + } + } + else if ((data & 0x20)&&(!(data&0x40))) //cs0=1 cs1=0 bit 5&6 + { + if (!(data & 0x02)) //rd line bit 1 + { + tempidedata = m_ide->read_cs1(space, (data&0x1c)>>2, 0xffff); + LOG(("swtpc09_ide_bus_r: offset $%02X data %04X\n", (data&0x1c)>>2, tempidedata)); + m_piaide_porta = tempidedata & 0x00ff; + } + else if (!(data & 0x01)) //wr line bit 0 + { + m_ide->write_cs1(space, (data&0x1c)>>2, m_piaide_porta, 0xffff); + LOG(("swtpc09_ide_bus_w: offset $%02X data %04X\n", (data&0x1c)>>2, m_piaide_porta)); + } + } +} + + +/* DAT ram write handler (Dynamic Address Translator) */ +/* This creates the address map when a page is mapped in */ +/* memory map is created based on system_type flag */ +/* this is accommodate the different cards installed */ + +WRITE8_MEMBER(swtpc09_state::dat_w) +{ + UINT8 a16_to_a19, a12_to_a15; + UINT8 *RAM = memregion("maincpu")->base(); + UINT32 physical_address, logical_address; + + address_space &mem = m_maincpu->space(AS_PROGRAM); + + fd1793_t *fdc = machine().device("fdc"); + pia6821_device *pia = machine().device("pia"); + ptm6840_device *ptm = machine().device("ptm"); + acia6850_device *acia = machine().device("acia"); + via6522_device *via = machine().device("via"); + pia6821_device *piaide = machine().device("piaide"); + + a16_to_a19 = data & 0xf0; + a12_to_a15 = ~data & 0x0f; //lower 4 bits are inverted + physical_address = ((a16_to_a19 + a12_to_a15) << 12); + logical_address = offset << 12; + LOG(("swtpc09_dat_bank_unmap Logical address:%04X\n", offset << 12 )); + LOG(("swtpc09_dat_bank_set dat:%02X Logical address:%04X Physical address:%05X\n", data, offset << 12, physical_address )); + + + // unmap page to be changed + mem.unmap_readwrite(offset << 12, (offset << 12)+0x0fff); + + // map in new page + if (a12_to_a15 == 0x0e) // 0xE000 address range to be mapped in at this page + { + if (m_system_type == FLEX_DMF2) // if flex/sbug, map in acia at 0xE004 + { + mem.nop_readwrite(logical_address+0x000, logical_address+0x003); + mem.install_readwrite_handler(logical_address+0x004, logical_address+0x004, read8_delegate(FUNC(acia6850_device::status_r), acia), write8_delegate(FUNC(acia6850_device::control_w),acia)); + mem.install_readwrite_handler(logical_address+0x005, logical_address+0x005, read8_delegate(FUNC(acia6850_device::data_r), acia), write8_delegate(FUNC(acia6850_device::data_w),acia)); + mem.nop_readwrite(logical_address+0x006, logical_address+0x07f); + mem.install_readwrite_handler(logical_address+0x080, logical_address+0x08f, read8_delegate(FUNC(pia6821_device::read), pia), write8_delegate(FUNC(pia6821_device::write), pia)); + mem.install_readwrite_handler(logical_address+0x090, logical_address+0x09f, read8_delegate(FUNC(ptm6840_device::read), ptm), write8_delegate(FUNC(ptm6840_device::write), ptm)); + mem.nop_readwrite(logical_address+0x0a0, logical_address+0xfff); + } + else if (m_system_type == FLEX_DC4_PIAIDE) // if flex/sbug and dc4 and piaide + { + mem.nop_readwrite(logical_address+0x000, logical_address+0x003); + mem.install_readwrite_handler(logical_address+0x004, logical_address+0x004, read8_delegate(FUNC(acia6850_device::status_r), acia), write8_delegate(FUNC(acia6850_device::control_w),acia)); + mem.install_readwrite_handler(logical_address+0x005, logical_address+0x005, read8_delegate(FUNC(acia6850_device::data_r), acia), write8_delegate(FUNC(acia6850_device::data_w),acia)); + mem.install_write_handler(logical_address+0x014, logical_address+0x014, write8_delegate(FUNC(swtpc09_state::dc4_control_reg_w),this)); + mem.install_readwrite_handler(logical_address+0x018, logical_address+0x01b, read8_delegate(FUNC(fd1793_t::read), fdc), write8_delegate(FUNC(fd1793_t::write),fdc)); + //mem.nop_readwrite(logical_address+0x01c, logical_address+0x05f); + mem.install_readwrite_handler(logical_address+0x060, logical_address+0x06f, read8_delegate(FUNC(pia6821_device::read), piaide), write8_delegate(FUNC(pia6821_device::write), piaide)); + //mem.nop_readwrite(logical_address+0x070, logical_address+0x07f); + mem.install_readwrite_handler(logical_address+0x080, logical_address+0x08f, read8_delegate(FUNC(pia6821_device::read), pia), write8_delegate(FUNC(pia6821_device::write), pia)); + mem.install_readwrite_handler(logical_address+0x090, logical_address+0x09f, read8_delegate(FUNC(ptm6840_device::read), ptm), write8_delegate(FUNC(ptm6840_device::write), ptm)); + //mem.nop_readwrite(logical_address+0x0a0, logical_address+0x7ff); + mem.install_rom(logical_address+0x800, logical_address+0xfff, &RAM[0xe800]); //piaide rom + } + else // assume unibug, map in acia at 0xE000 + { + mem.install_readwrite_handler(logical_address+0x000, logical_address+0x000, read8_delegate(FUNC(acia6850_device::status_r), acia), write8_delegate(FUNC(acia6850_device::control_w), acia)); + mem.install_readwrite_handler(logical_address+0x001, logical_address+0x001, read8_delegate(FUNC(acia6850_device::data_r), acia), write8_delegate(FUNC(acia6850_device::data_w), acia)); + mem.nop_readwrite(logical_address+0x002, logical_address+0x07f); + mem.install_readwrite_handler(logical_address+0x080, logical_address+0x08f, read8_delegate(FUNC(pia6821_device::read), pia), write8_delegate(FUNC(pia6821_device::write), pia)); + mem.install_readwrite_handler(logical_address+0x090, logical_address+0x09f, read8_delegate(FUNC(ptm6840_device::read), ptm), write8_delegate(FUNC(ptm6840_device::write), ptm)); + mem.nop_readwrite(logical_address+0x0a0, logical_address+0xfff); + } + } + else if (a12_to_a15 == 0x0f) // 0xF000 address range to be mapped in at this page + { + if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2) // if DMF2 conroller this is the map + { + mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this)); + mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_t::read), fdc), write8_delegate(FUNC(fd1793_t::write),fdc)); + mem.install_readwrite_handler(logical_address+0x024, logical_address+0x03f, read8_delegate(FUNC(swtpc09_state::dmf2_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_control_reg_w),this)); + mem.install_readwrite_handler(logical_address+0x040, logical_address+0x041, read8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_w),this)); + //mem.nop_readwrite(logical_address+0x042, logical_address+0x7ff); + mem.install_rom(logical_address+0x800, logical_address+0xfff, &RAM[0xf800]); + mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this)); + } + else if (m_system_type == FLEX_DC4_PIAIDE) // 2k ram for piaide on s09 board + { + //mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this)); + //mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_t::read), fdc), write8_delegate(FUNC(fd1793_t::write),fdc)); + //mem.install_readwrite_handler(logical_address+0x024, logical_address+0x03f, read8_delegate(FUNC(swtpc09_state::dmf2_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_control_reg_w),this)); + //mem.install_readwrite_handler(logical_address+0x040, logical_address+0x041, read8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_w),this)); + mem.install_ram(logical_address+0x000, logical_address+0x7ff, &RAM[0xf000]); + mem.install_rom(logical_address+0x800, logical_address+0xfff, &RAM[0xf800]); + mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this)); + } + else // assume DMF3 controller + { + mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this)); + mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_t::read), fdc), write8_delegate(FUNC(fd1793_t::write),fdc)); + mem.install_readwrite_handler(logical_address+0x024, logical_address+0x024, read8_delegate(FUNC(swtpc09_state::dmf3_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf3_control_reg_w),this)); + mem.install_readwrite_handler(logical_address+0x025, logical_address+0x025, read8_delegate(FUNC(swtpc09_state::dmf3_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf3_dma_address_reg_w),this)); + //mem.nop_readwrite(logical_address+0x030, logical_address+0x03f); + mem.install_readwrite_handler(logical_address+0x040, logical_address+0x04f, read8_delegate(FUNC(via6522_device::read), via), write8_delegate(FUNC(via6522_device::write), via)); + //mem.nop_readwrite(logical_address+0x050, logical_address+0x7ff); + mem.install_rom(logical_address+0x800, logical_address+0xfff, &RAM[0xf800]); + mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this)); + } + } + else if (offset==0x0f) // then we need to leave in top part of ram and dat write + { + mem.install_ram(logical_address, logical_address+0x0eff, 0, 0, &RAM[physical_address]); + mem.install_rom(logical_address+0xf00, logical_address+0xfff, 0, 0, &RAM[0xff00]); + mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this)); + + } + else // all the rest is treated as ram, 1MB ram emulated + { + mem.install_ram(logical_address, logical_address+0x0fff, &RAM[physical_address]); + } + +// unused code to limit to 256k ram +// else if (!(a12_to_a15 & 0x0c) ) // limit ram to 256k || a12_to_a15 == 0x02 +// { +// memory_install_ram(space, logical_address, logical_address+0x0fff, 0, 0, &RAM[physical_address]); +// } +// +// else // all the rest is treated as unallocated +// { +// memory_nop_readwrite(space, logical_address, logical_address+0x0fff, 0, 0); +// } + +} + +/* MC6844 DMA controller I/O */ + +READ8_MEMBER( swtpc09_state::m6844_r ) +{ + UINT8 result = 0; + + + /* switch off the offset we were given */ + switch (offset) + { + /* upper byte of address */ + case 0x00: + case 0x04: + case 0x08: + case 0x0c: + result = m_m6844_channel[offset / 4].address >> 8; + break; + + /* lower byte of address */ + case 0x01: + case 0x05: + case 0x09: + case 0x0d: + result = m_m6844_channel[offset / 4].address & 0xff; + break; + + /* upper byte of counter */ + case 0x02: + case 0x06: + case 0x0a: + case 0x0e: + result = m_m6844_channel[offset / 4].counter >> 8; + break; + + /* lower byte of counter */ + case 0x03: + case 0x07: + case 0x0b: + case 0x0f: + result = m_m6844_channel[offset / 4].counter & 0xff; + break; + + /* channel control */ + case 0x10: + case 0x11: + case 0x12: + case 0x13: + result = m_m6844_channel[offset - 0x10].control; + + /* a read here clears the DMA end flag */ + m_m6844_channel[offset - 0x10].control &= ~0x80; + if (m_m6844_interrupt & 0x80) // if interrupt is active, then clear + { + swtpc09_irq_handler(0x01, CLEAR_LINE); + m_m6844_interrupt &= 0x7f; // clear interrupt indication bit 7 + LOG(("swtpc09_6844_r interrupt cleared \n")); + } + break; + + /* priority control */ + case 0x14: + result = m_m6844_priority; + break; + + /* interrupt control */ + case 0x15: + result = m_m6844_interrupt; + break; + + /* chaining control */ + case 0x16: + result = m_m6844_chain; + break; + + /* 0x17-0x1f not used */ + default: break; + } + //LOG(("swtpc09_6844_r %02X %02X\n", offset, result & 0xff)); + + if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2) // if DMF2 controller data bus is inverted to 6844 + { + return ~result & 0xff; + } + else + { + return result & 0xff; + } +} + + +WRITE8_MEMBER( swtpc09_state::m6844_w ) +{ + int i; + + if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2) // if DMF2 controller data bus is inverted to 6844 + data = ~data & 0xff; + + LOG(("swtpc09_6844_w %02X %02X\n", offset, data)); + /* switch off the offset we were given */ + switch (offset) + { + /* upper byte of address */ + case 0x00: + case 0x04: + case 0x08: + case 0x0c: + m_m6844_channel[offset / 4].address = (m_m6844_channel[offset / 4].address & 0xff) | (data << 8); + break; + + /* lower byte of address */ + case 0x01: + case 0x05: + case 0x09: + case 0x0d: + m_m6844_channel[offset / 4].address = (m_m6844_channel[offset / 4].address & 0xff00) | (data & 0xff); + break; + + /* upper byte of counter */ + case 0x02: + case 0x06: + case 0x0a: + case 0x0e: + m_m6844_channel[offset / 4].counter = (m_m6844_channel[offset / 4].counter & 0xff) | (data << 8); + break; + + /* lower byte of counter */ + case 0x03: + case 0x07: + case 0x0b: + case 0x0f: + m_m6844_channel[offset / 4].counter = (m_m6844_channel[offset / 4].counter & 0xff00) | (data & 0xff); + break; + + /* channel control */ + case 0x10: + case 0x11: + case 0x12: + case 0x13: + m_m6844_channel[offset - 0x10].control = (m_m6844_channel[offset - 0x10].control & 0xc0) | (data & 0x3f); + break; + + /* priority control */ + case 0x14: + m_m6844_priority = data; + + /* update each channel */ + for (i = 0; i < 4; i++) + { + /* if we're going active... */ + if (!m_m6844_channel[i].active && (data & (1 << i))) + { + /* mark us active */ + m_m6844_channel[i].active = 1; + LOG(("swtpc09_dma_channel active %02X\n", i)); + + /* set the DMA busy bit and clear the DMA end bit */ + m_m6844_channel[i].control |= 0x40; + m_m6844_channel[i].control &= ~0x80; + + /* set the starting address, counter, and time */ + m_m6844_channel[i].start_address = m_m6844_channel[i].address; + m_m6844_channel[i].start_counter = m_m6844_channel[i].counter; + + + /* generate and play the sample */ + //play_cvsd(space->machine, i); + } + + /* if we're going inactive... */ + else if (m_m6844_channel[i].active && !(data & (1 << i))) + { + /* mark us inactive */ + m_m6844_channel[i].active = 0; + } + } + break; + + /* interrupt control */ + case 0x15: + m_m6844_interrupt = (m_m6844_interrupt & 0x80) | (data & 0x7f); + LOG(("swtpc09_m_m6844_interrupt_w %02X\n", m_m6844_interrupt)); + break; + + /* chaining control */ + case 0x16: + m_m6844_chain = data; + break; + + /* 0x17-0x1f not used */ + default: break; + } +} + + +DRIVER_INIT_MEMBER( swtpc09_state, swtpc09 ) +{ + int i; + m_pia_counter = 0; // init ptm/pia counter to 0 + m_term_data = 0; // terminal keyboard input + m_fdc_status = 0; // for floppy controller + m_system_type = FLEX_DMF2; + m_interrupt = 0; + m_active_interrupt = FALSE; + + /* reset the 6844 */ + for (i = 0; i < 4; i++) + { + m_m6844_channel[i].active = 0; + m_m6844_channel[i].control = 0x00; + } + m_m6844_priority = 0x00; + m_m6844_interrupt = 0x00; + m_m6844_chain = 0x00; + +} + +DRIVER_INIT_MEMBER( swtpc09_state, swtpc09i ) +{ + int i; + m_pia_counter = 0; // init ptm/pia counter to 0 + m_term_data = 0; // terminal keyboard input + m_fdc_status = 0; // for floppy controller + m_system_type = FLEX_DC4_PIAIDE; + m_interrupt = 0; + m_active_interrupt = FALSE; + + /* reset the 6844 */ + for (i = 0; i < 4; i++) + { + m_m6844_channel[i].active = 0; + m_m6844_channel[i].control = 0x00; + } + m_m6844_priority = 0x00; + m_m6844_interrupt = 0x00; + m_m6844_chain = 0x00; + +} + +DRIVER_INIT_MEMBER( swtpc09_state, swtpc09u ) +{ + int i; + m_pia_counter = 0; //init ptm/pia counter to 0 + m_term_data = 0; //terminal keyboard input + m_fdc_status = 0; // for floppy controller + m_system_type = UNIFLEX_DMF2; + m_interrupt = 0; + m_active_interrupt = FALSE; + + /* reset the 6844 */ + for (i = 0; i < 4; i++) + { + m_m6844_channel[i].active = 0; + m_m6844_channel[i].control = 0x00; + } + m_m6844_priority = 0x00; + m_m6844_interrupt = 0x00; + m_m6844_chain = 0x00; + +} + +DRIVER_INIT_MEMBER( swtpc09_state, swtpc09d3 ) +{ + int i; + m_pia_counter = 0; //init ptm/pia counter to 0 + m_term_data = 0; //terminal keyboard input + m_fdc_status = 0; // for floppy controller + m_via_ca1_input = 0; + m_system_type = UNIFLEX_DMF3; + m_interrupt = 0; + m_active_interrupt = FALSE; + + + /* reset the 6844 */ + for (i = 0; i < 4; i++) + { + m_m6844_channel[i].active = 0; + m_m6844_channel[i].control = 0x00; + } + m_m6844_priority = 0x00; + m_m6844_interrupt = 0x00; + m_m6844_chain = 0x00; + +} diff --git a/src/mame/machine/tandy2kb.c b/src/mame/machine/tandy2kb.c new file mode 100644 index 00000000000..b6c7dd18db3 --- /dev/null +++ b/src/mame/machine/tandy2kb.c @@ -0,0 +1,432 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Tandy 2000 keyboard emulation + +*********************************************************************/ + +#include "tandy2kb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8048_TAG "m1" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type TANDY2K_KEYBOARD = &device_creator; + + + +//------------------------------------------------- +// ROM( tandy2k_keyboard ) +//------------------------------------------------- + +ROM_START( tandy2k_keyboard ) + ROM_REGION( 0x400, I8048_TAG, 0 ) + ROM_LOAD( "keyboard.m1", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *tandy2k_keyboard_device::device_rom_region() const +{ + return ROM_NAME( tandy2k_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( kb_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( tandy2k_keyboard_io, AS_IO, 8, tandy2k_keyboard_device ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kb_p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(kb_p1_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_DRIVER( tandy2k_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( tandy2k_keyboard ) + MCFG_CPU_ADD(I8048_TAG, I8048, 1000000) // ? + MCFG_CPU_IO_MAP(tandy2k_keyboard_io) + MCFG_DEVICE_DISABLE() // TODO +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor tandy2k_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( tandy2k_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( tandy2k_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( tandy2k_keyboard ) + PORT_START("Y0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y6") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y9") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y10") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("Y11") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor tandy2k_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( tandy2k_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// tandy2k_keyboard_device - constructor +//------------------------------------------------- + +tandy2k_keyboard_device::tandy2k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TANDY2K_KEYBOARD, "Tandy 2000 Keyboard", tag, owner, clock, "tandy2kb", __FILE__), + m_maincpu(*this, I8048_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_y10(*this, "Y10"), + m_y11(*this, "Y11"), + m_write_clock(*this), + m_write_data(*this), + m_keylatch(0xffff), + m_clock(0), + m_data(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tandy2k_keyboard_device::device_start() +{ + // resolve callbacks + m_write_clock.resolve_safe(); + m_write_data.resolve_safe(); + + // state saving + save_item(NAME(m_keylatch)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tandy2k_keyboard_device::device_reset() +{ +} + + +//------------------------------------------------- +// power_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( tandy2k_keyboard_device::power_w ) +{ + // TODO +} + + +//------------------------------------------------- +// reset_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( tandy2k_keyboard_device::reset_w ) +{ + if (!state) + { + device_reset(); + } +} + + +//------------------------------------------------- +// busy_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( tandy2k_keyboard_device::busy_w ) +{ + m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); +} + + +//------------------------------------------------- +// data_r - +//------------------------------------------------- + +READ_LINE_MEMBER( tandy2k_keyboard_device::data_r ) +{ + return m_data; +} + + +//------------------------------------------------- +// kb_p1_r - +//------------------------------------------------- + +READ8_MEMBER( tandy2k_keyboard_device::kb_p1_r ) +{ + /* + + bit description + + 0 X0 + 1 X1 + 2 X2 + 3 X3 + 4 X4 + 5 X5 + 6 X6 + 7 X7 + + */ + + UINT8 data = 0xff; + + if (!BIT(m_keylatch, 0)) data &= m_y0->read(); + if (!BIT(m_keylatch, 1)) data &= m_y1->read(); + if (!BIT(m_keylatch, 2)) data &= m_y2->read(); + if (!BIT(m_keylatch, 3)) data &= m_y3->read(); + if (!BIT(m_keylatch, 4)) data &= m_y4->read(); + if (!BIT(m_keylatch, 5)) data &= m_y5->read(); + if (!BIT(m_keylatch, 6)) data &= m_y6->read(); + if (!BIT(m_keylatch, 7)) data &= m_y7->read(); + if (!BIT(m_keylatch, 8)) data &= m_y8->read(); + if (!BIT(m_keylatch, 9)) data &= m_y9->read(); + if (!BIT(m_keylatch, 10)) data &= m_y10->read(); + if (!BIT(m_keylatch, 11)) data &= m_y11->read(); + + return ~data; +} + + +//------------------------------------------------- +// kb_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( tandy2k_keyboard_device::kb_p1_w ) +{ + /* + + bit description + + 0 Y0 + 1 Y1 + 2 Y2 + 3 Y3 + 4 Y4 + 5 Y5 + 6 Y6 + 7 Y7 + + */ + + // keyboard row + m_keylatch = (m_keylatch & 0xff00) | data; +} + + +//------------------------------------------------- +// kb_p2_w - +//------------------------------------------------- + +WRITE8_MEMBER( tandy2k_keyboard_device::kb_p2_w ) +{ + /* + + bit description + + 0 Y8 + 1 Y9 + 2 Y10 + 3 Y11 + 4 LED 2 + 5 LED 1 + 6 CLOCK + 7 DATA + + */ + + // keyboard row + m_keylatch = ((data & 0x0f) << 8) | (m_keylatch & 0xff); + + // led output + output_set_led_value(LED_2, !BIT(data, 4)); + output_set_led_value(LED_1, !BIT(data, 5)); + + // keyboard clock + int clock = BIT(data, 6); + + if (m_clock != clock) + { + m_clock = clock; + + m_write_clock(m_clock); + } + + // keyboard data + int kbddat = BIT(data, 7); + + if (m_data != kbddat) + { + m_data = kbddat; + + m_write_data(m_data); + } +} diff --git a/src/mame/machine/tandy2kb.h b/src/mame/machine/tandy2kb.h new file mode 100644 index 00000000000..9a2d65d373f --- /dev/null +++ b/src/mame/machine/tandy2kb.h @@ -0,0 +1,110 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Tandy 2000 keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __TANDY2K_KEYBOARD__ +#define __TANDY2K_KEYBOARD__ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define TANDY2K_KEYBOARD_TAG "tandy2kb" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_TANDY2000_KEYBOARD_CLOCK_CALLBACK(_write) \ + devcb = &tandy2k_keyboard_device::set_clock_wr_callback(*device, DEVCB_##_write); + +#define MCFG_TANDY2000_KEYBOARD_DATA_CALLBACK(_write) \ + devcb = &tandy2k_keyboard_device::set_data_wr_callback(*device, DEVCB_##_write); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> tandy2k_keyboard_device + +class tandy2k_keyboard_device : public device_t +{ +public: + // construction/destruction + tandy2k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_clock_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clock.set_callback(object); } + template static devcb_base &set_data_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_data.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_WRITE_LINE_MEMBER( power_w ); + DECLARE_WRITE_LINE_MEMBER( reset_w ); + DECLARE_WRITE_LINE_MEMBER( busy_w ); + DECLARE_READ_LINE_MEMBER( data_r ); + + // not really public + DECLARE_READ8_MEMBER( kb_p1_r ); + DECLARE_WRITE8_MEMBER( kb_p1_w ); + DECLARE_WRITE8_MEMBER( kb_p2_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + enum + { + LED_1 = 0, + LED_2 + }; + + required_device m_maincpu; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_y10; + required_ioport m_y11; + + devcb_write_line m_write_clock; + devcb_write_line m_write_data; + + UINT16 m_keylatch; + + int m_clock; + int m_data; +}; + + +// device type definition +extern const device_type TANDY2K_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/teleprinter.c b/src/mame/machine/teleprinter.c new file mode 100644 index 00000000000..1c72a536883 --- /dev/null +++ b/src/mame/machine/teleprinter.c @@ -0,0 +1,237 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +#include "teleprinter.h" + +#define KEYBOARD_TAG "keyboard" + +static const UINT8 teleprinter_font[128*8] = +{ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00, + 0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00, + 0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07, + 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07, + 0x38,0x38,0x38,0x38,0x07,0x07,0x07,0x07, + 0x3f,0x3f,0x3f,0x3f,0x07,0x07,0x07,0x07, + 0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x38, + 0x07,0x07,0x07,0x07,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x3f,0x3f,0x3f,0x3f,0x38,0x38,0x38,0x38, + 0x00,0x00,0x00,0x00,0x3f,0x3f,0x3f,0x3f, + 0x07,0x07,0x07,0x07,0x3f,0x3f,0x3f,0x3f, + 0x38,0x38,0x38,0x38,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x00,0x00,0x00,0x00,0x2a,0x15,0x2a,0x15, + 0x2a,0x15,0x2a,0x15,0x00,0x00,0x00,0x00, + 0x3f,0x3f,0x3f,0x3f,0x2a,0x15,0x2a,0x15, + 0x2a,0x15,0x2a,0x15,0x3f,0x3f,0x3f,0x3f, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00, + 0x14,0x14,0x14,0x00,0x00,0x00,0x00,0x00, + 0x14,0x14,0x3e,0x14,0x3e,0x14,0x14,0x00, + 0x08,0x3c,0x0a,0x1c,0x28,0x1e,0x08,0x00, + 0x06,0x26,0x10,0x08,0x04,0x32,0x30,0x00, + 0x08,0x14,0x14,0x0c,0x2a,0x12,0x2c,0x00, + 0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x00, + 0x10,0x08,0x04,0x04,0x04,0x08,0x10,0x00, + 0x04,0x08,0x10,0x10,0x10,0x08,0x04,0x00, + 0x00,0x08,0x2a,0x1c,0x2a,0x08,0x00,0x00, + 0x00,0x08,0x08,0x3e,0x08,0x08,0x00,0x00, + 0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x00, + 0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, + 0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00, + 0x1c,0x22,0x32,0x2a,0x26,0x22,0x1c,0x00, + 0x08,0x0c,0x08,0x08,0x08,0x08,0x1c,0x00, + 0x1c,0x22,0x20,0x18,0x04,0x02,0x3e,0x00, + 0x3e,0x20,0x10,0x18,0x20,0x22,0x1c,0x00, + 0x10,0x18,0x14,0x12,0x3e,0x10,0x10,0x00, + 0x3e,0x02,0x1e,0x20,0x20,0x22,0x1c,0x00, + 0x10,0x08,0x04,0x1c,0x22,0x22,0x1c,0x00, + 0x3e,0x20,0x10,0x08,0x04,0x04,0x04,0x00, + 0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c,0x00, + 0x1c,0x22,0x22,0x1c,0x10,0x08,0x04,0x00, + 0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00, + 0x00,0x00,0x08,0x00,0x08,0x08,0x04,0x00, + 0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00, + 0x00,0x00,0x3e,0x00,0x3e,0x00,0x00,0x00, + 0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00, + 0x1c,0x22,0x20,0x10,0x08,0x00,0x08,0x00, + 0x1c,0x22,0x32,0x2a,0x3a,0x02,0x3c,0x00, + 0x08,0x14,0x22,0x22,0x3e,0x22,0x22,0x00, + 0x1e,0x22,0x22,0x1e,0x22,0x22,0x1e,0x00, + 0x1c,0x22,0x02,0x02,0x02,0x22,0x1c,0x00, + 0x1e,0x24,0x24,0x24,0x24,0x24,0x1e,0x00, + 0x3e,0x02,0x02,0x1e,0x02,0x02,0x3e,0x00, + 0x3e,0x02,0x02,0x1e,0x02,0x02,0x02,0x00, + 0x1c,0x22,0x02,0x02,0x32,0x22,0x3c,0x00, + 0x22,0x22,0x22,0x3e,0x22,0x22,0x22,0x00, + 0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,0x00, + 0x38,0x10,0x10,0x10,0x10,0x12,0x0c,0x00, + 0x22,0x12,0x0a,0x06,0x0a,0x12,0x22,0x00, + 0x02,0x02,0x02,0x02,0x02,0x02,0x3e,0x00, + 0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,0x00, + 0x22,0x22,0x26,0x2a,0x32,0x22,0x22,0x00, + 0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,0x00, + 0x1e,0x22,0x22,0x1e,0x02,0x02,0x02,0x00, + 0x1c,0x22,0x22,0x22,0x2a,0x12,0x2c,0x00, + 0x1e,0x22,0x22,0x1e,0x0a,0x12,0x22,0x00, + 0x1c,0x22,0x02,0x1c,0x20,0x22,0x1c,0x00, + 0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x00, + 0x22,0x22,0x22,0x22,0x22,0x22,0x1c,0x00, + 0x22,0x22,0x22,0x14,0x14,0x08,0x08,0x00, + 0x22,0x22,0x22,0x2a,0x2a,0x2a,0x14,0x00, + 0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00, + 0x22,0x22,0x22,0x14,0x08,0x08,0x08,0x00, + 0x3e,0x20,0x10,0x08,0x04,0x02,0x3e,0x00, + 0x0e,0x02,0x02,0x02,0x02,0x02,0x0e,0x00, + 0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00, + 0x38,0x20,0x20,0x20,0x20,0x20,0x38,0x00, + 0x08,0x1c,0x2a,0x08,0x08,0x08,0x08,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00, + 0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x1c,0x20,0x3c,0x22,0x3c,0x00, + 0x02,0x02,0x1e,0x22,0x22,0x22,0x1e,0x00, + 0x00,0x00,0x3c,0x02,0x02,0x02,0x3c,0x00, + 0x20,0x20,0x3c,0x22,0x22,0x22,0x3c,0x00, + 0x00,0x00,0x1c,0x22,0x3e,0x02,0x1c,0x00, + 0x18,0x04,0x0e,0x04,0x04,0x04,0x04,0x00, + 0x00,0x00,0x3c,0x22,0x22,0x3c,0x20,0x18, + 0x02,0x02,0x1e,0x22,0x22,0x22,0x22,0x00, + 0x08,0x00,0x0c,0x08,0x08,0x08,0x1c,0x00, + 0x10,0x00,0x18,0x10,0x10,0x10,0x12,0x0c, + 0x02,0x02,0x22,0x12,0x0e,0x16,0x22,0x00, + 0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x00, + 0x00,0x00,0x16,0x2a,0x2a,0x2a,0x2a,0x00, + 0x00,0x00,0x1a,0x26,0x22,0x22,0x22,0x00, + 0x00,0x00,0x1c,0x22,0x22,0x22,0x1c,0x00, + 0x00,0x00,0x1e,0x22,0x22,0x1e,0x02,0x02, + 0x00,0x00,0x3c,0x22,0x22,0x3c,0x20,0x20, + 0x00,0x00,0x34,0x0c,0x04,0x04,0x04,0x00, + 0x00,0x00,0x3c,0x02,0x1c,0x20,0x1e,0x00, + 0x08,0x08,0x1c,0x08,0x08,0x08,0x10,0x00, + 0x00,0x00,0x22,0x22,0x22,0x32,0x2c,0x00, + 0x00,0x00,0x22,0x22,0x22,0x14,0x08,0x00, + 0x00,0x00,0x22,0x22,0x2a,0x2a,0x14,0x00, + 0x00,0x00,0x22,0x14,0x08,0x14,0x22,0x00, + 0x00,0x00,0x22,0x22,0x14,0x08,0x04,0x02, + 0x00,0x00,0x3e,0x10,0x08,0x04,0x3e,0x00, + 0x10,0x08,0x08,0x04,0x08,0x08,0x10,0x00, + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00, + 0x04,0x08,0x08,0x10,0x08,0x08,0x04,0x00, + 0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x2a,0x15,0x2a,0x15,0x2a,0x15,0x2a,0x15 +}; + +teleprinter_device::teleprinter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : generic_terminal_device(mconfig, TELEPRINTER, "Teleprinter", tag, owner, clock, "teleprinter", __FILE__) +{ +} + +void teleprinter_device::scroll_line() +{ + memmove(m_buffer,m_buffer+TELEPRINTER_WIDTH,(TELEPRINTER_HEIGHT-1)*TELEPRINTER_WIDTH); + memset(m_buffer + TELEPRINTER_WIDTH*(TELEPRINTER_HEIGHT-1),0x20,TELEPRINTER_WIDTH); +} + +void teleprinter_device::write_char(UINT8 data) { + m_buffer[(TELEPRINTER_HEIGHT-1)*TELEPRINTER_WIDTH+m_x_pos] = data; + m_x_pos++; + if (m_x_pos >= TELEPRINTER_WIDTH) + { + m_x_pos = 0; + scroll_line(); + } +} + +void teleprinter_device::clear() { + memset(m_buffer,0,TELEPRINTER_WIDTH*TELEPRINTER_HEIGHT); + m_x_pos = 0; +} + +void teleprinter_device::term_write(UINT8 data) +{ + switch(data) { + case 10: m_x_pos = 0; + scroll_line(); + break; + case 13: m_x_pos = 0; break; + case 9: m_x_pos = (m_x_pos & 0xf8) + 8; + if (m_x_pos >= TELEPRINTER_WIDTH) + m_x_pos = TELEPRINTER_WIDTH-1; + + break; + case 16: break; + default: write_char(data); break; + } +} + +/*************************************************************************** + VIDEO HARDWARE +***************************************************************************/ +UINT32 teleprinter_device::tp_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT8 code; + int y, c, x, b; + + for (y = 0; y < TELEPRINTER_HEIGHT; y++) + { + for (c = 0; c < 8; c++) + { + int horpos = 0; + for (x = 0; x < TELEPRINTER_WIDTH; x++) + { + code = teleprinter_font[(m_buffer[y*TELEPRINTER_WIDTH + x] & 0x7f) *8 + c]; + for (b = 0; b < 8; b++) + { + bitmap.pix32(y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 0x00ffffff; + } + } + } + } + return 0; +} + +/*************************************************************************** + VIDEO HARDWARE +***************************************************************************/ +MACHINE_CONFIG_FRAGMENT( generic_teleprinter ) + MCFG_SCREEN_ADD(TELEPRINTER_SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(TELEPRINTER_WIDTH*8, TELEPRINTER_HEIGHT*8) + MCFG_SCREEN_VISIBLE_AREA(0, TELEPRINTER_WIDTH*8-1, 0, TELEPRINTER_HEIGHT*8-1) + MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, teleprinter_device, tp_update) + MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(generic_terminal_device, kbd_put)) +MACHINE_CONFIG_END + +machine_config_constructor teleprinter_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(generic_teleprinter); +} + +/*------------------------------------------------- + device_reset - device-specific reset +-------------------------------------------------*/ + +void teleprinter_device::device_reset() +{ + clear(); + generic_terminal_device::device_reset(); +} + +const device_type TELEPRINTER = &device_creator; diff --git a/src/mame/machine/teleprinter.h b/src/mame/machine/teleprinter.h new file mode 100644 index 00000000000..0f0cad4c924 --- /dev/null +++ b/src/mame/machine/teleprinter.h @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +#ifndef __TELEPRINTER_H__ +#define __TELEPRINTER_H__ + +#include "machine/terminal.h" + +#define TELEPRINTER_WIDTH 80 +#define TELEPRINTER_HEIGHT 50 + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ +#define TELEPRINTER_TAG "teleprinter" +#define TELEPRINTER_SCREEN_TAG "tty_screen" + +#define MCFG_GENERIC_TELEPRINTER_KEYBOARD_CB(_devcb) \ + devcb = &generic_terminal_device::set_keyboard_callback(*device, DEVCB_##_devcb); + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +class teleprinter_device : public generic_terminal_device +{ +public: + teleprinter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + UINT32 tp_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect); +protected: + virtual void term_write(UINT8 data); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; +private: + void scroll_line(); + void write_char(UINT8 data); + void clear(); +}; + +extern const device_type TELEPRINTER; + +#endif /* __TELEPRINTER_H__ */ diff --git a/src/mame/machine/thomflop.c b/src/mame/machine/thomflop.c new file mode 100644 index 00000000000..3927f7219af --- /dev/null +++ b/src/mame/machine/thomflop.c @@ -0,0 +1,1914 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Thomson 8-bit computers + +**********************************************************************/ + +#include "includes/thomson.h" +#include "machine/wd_fdc.h" + + +#define VERBOSE 0 /* 0, 1 or 2 */ + +#define PRINT(x) osd_printf_info x + +#define LOG(x) do { if (VERBOSE > 0) logerror x; } while (0) +#define VLOG(x) do { if (VERBOSE > 1) logerror x; } while (0) + + + + +/******************* 3''1/2 & 5''1/4 disk format ********************/ + +/* + single density sector format: + + data bytes + + id field 00 6 byte synchro + FE 1 id field mark + 1 track + 1 side + 1 sector + 00 1 log sector size (0->128, 1->256, 2->512,...) + 2 CRC (unemulated) + FF 12 spaces + data field 00 6 bytes synchro + FB 1 data field mark + E5 128 actual data (set to E5 when formatting) + 2 CRC (unemulated) + FF 22 ? spaces + + + + double density sector format: + + data bytes + + id field 00 12 bit synchro + A1 3 byte synchro + FE 1 id field mark + 1 track + 1 side + 1 sector + 01 1 log sector size (0->128, 1->256, 2->512,...) + 2 CRC (unemulated) + 4E/F7 22 spaces + data field 00 12 bit synchro + A1 3 bytes synchro + FB 1 data field mark + E5 256 actual data (set to E5 when formatting) + 2 CRC (unemulated) + 4E/F7 74 ? spaces + + => at most 392 bytes / sector + => at most 6272 bytes / track + + Notes: + - the BIOS puts 4E bytes as spaces after id and data fields + - some protected games expect F7 bytes (instead of 4E) after id fields +*/ + +#define THOM_SIZE_ID 32 +#define THOM_SIZE_DATA_LO (128+80) +#define THOM_SIZE_DATA_HI (256+80) +#define THOM_SIZE_SYNCHRO 12 + +static int motor_on; + + +/* build an identifier, with header & space */ +int thomson_state::thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size ) +{ + if ( sector_size == 128 ) + { + /* single density */ + memset( dst, 0x00, 6 ); /* synchro bytes */ + dst[ 7 ] = 0xfe; /* address field mark */ + dst[ 8 ] = id.C; + dst[ 9 ] = id.H; + dst[ 10 ] = id.N; + dst[ 11 ] = id.R; + dst[ 12 ] = 0; /* TODO: CRC */ + dst[ 13 ] = 0; /* TODO: CRC */ + memset( dst + 14, 0xff, 12 ); /* end mark */ + return 36; + } + else + { + /* double density */ + memset( dst, 0xa1, 3 ); /* synchro bytes */ + dst[ 3 ] = 0xfe; /* address field mark */ + dst[ 4 ] = id.C; + dst[ 5 ] = id.H; + dst[ 6 ] = id.N; + dst[ 7 ] = id.R; + dst[ 8 ] = 0; /* TODO: CRC */ + dst[ 9 ] = 0; /* TODO: CRC */ + memset( dst + 10, 0xf7, 22 ); /* end mark */ + return 32; + } +} + + + +/* build a sector, with header & space */ +int thomson_state::thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, UINT8* dst, int sector_size ) +{ + if ( sector_size == 128 ) + { + /* single density */ + memset( dst, 0x00, 6 ); /* synchro bytes */ + dst[ 6 ] = 0xfb; /* data field mark */ + img->floppy_drive_read_sector_data + ( id.H, id.data_id, dst + 7, sector_size ); + dst[ sector_size + 7 ] = 0; /* TODO: CRC */ + dst[ sector_size + 8 ] = 0; /* TODO: CRC */ + memset( dst + sector_size + 9, 0xff, 22 ); /* end mark */ + return sector_size + 31; + } + else + { + /* double density */ + memset( dst, 0xa1, 3 ); /* synchro bytes */ + dst[ 3 ] = 0xfb; /* data field mark */ + img->floppy_drive_read_sector_data + ( id.H, id.data_id, dst + 4, sector_size ); + dst[ sector_size + 4 ] = 0; /* TODO: CRC */ + dst[ sector_size + 5 ] = 0; /* TODO: CRC */ + memset( dst + sector_size + 6, 0xF7, 74 ); /* end mark */ + return sector_size + 80; + } +} + + + +/* build a whole track */ +int thomson_state::thom_floppy_make_track( legacy_floppy_image_device* img, UINT8* dst, int sector_size, int side ) +{ + UINT8 space = ( sector_size == 128 ) ? 0xff : 0; + UINT8* org = dst; + chrn_id id; + int nb; + + /* go to start of track */ + while ( ! img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) ) + { + if ( ! img->floppy_drive_get_next_id( side, &id ) ) + return 0; + } + + /* for each sector... */ + for ( nb = 0; nb < 16; nb++ ) + { + if ( ! img->floppy_drive_get_next_id( side, &id ) ) + break; + + memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO; + dst += thom_floppy_make_addr( id, dst, sector_size ); + memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO; + dst += thom_floppy_make_sector( img, id, dst, sector_size ); + + if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) ) + break; + } + return dst - org; +} + + + +/******************* QDD disk format ********************/ + +/* + sector format: + + data bytes + + id field 16 17 synchro + A5 1 id field mark + 1 sector (1-400) hi byte + 1 sector (1-400) low byte + 1 check-sum (sum modulo 256 of 3 last bytes) + + data field 16 10 synchro + 5A 1 data field mark + FF 128 actual data (set to FF when formatting) + 1 check-sum (sum modulo 256 of 129 last bytes) + + + there are 400 sectors numbered from 1 +*/ + +#define THOM_QDD_SYNCH_DISK 100 +#define THOM_QDD_SYNCH_ADDR 17 +#define THOM_QDD_SYNCH_DATA 10 + +#define THOM_QDD_SIZE_ID ( 4 + THOM_QDD_SYNCH_ADDR ) +#define THOM_QDD_SIZE_DATA ( 130 + THOM_QDD_SYNCH_DATA ) + + +/* build an identifier, with header */ +int thomson_state::thom_qdd_make_addr( int sector, UINT8* dst ) +{ + dst[ 0 ] = 0xa5; + dst[ 1 ] = sector >> 8; + dst[ 2 ] = sector & 0xff; + dst[ 3 ] = dst[ 0 ] + dst[ 1 ] + dst[ 2 ]; + return 4; +} + + + +/* build a sector, with header */ +int thomson_state::thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, UINT8* dst ) +{ + int i; + dst[ 0 ] = 0x5a; + img->floppy_drive_read_sector_data ( 0, sector, dst + 1, 128 ); + dst[ 129 ] = 0; + for ( i = 0; i < 129; i++ ) + dst[ 129 ] += dst[ i ]; + return 130; +} + + + +/* build a whole disk */ +int thomson_state::thom_qdd_make_disk ( legacy_floppy_image_device* img, UINT8* dst ) +{ + UINT8* org = dst; + int i; + + memset( dst, 0x16, THOM_QDD_SYNCH_DISK ); dst += THOM_QDD_SYNCH_DISK; + + for ( i = 1; i <= 400; i++ ) + { + memset( dst, 0x16, THOM_QDD_SYNCH_ADDR ); dst += THOM_QDD_SYNCH_ADDR; + dst += thom_qdd_make_addr( i, dst ); + memset( dst, 0x16, THOM_QDD_SYNCH_DATA ); dst += THOM_QDD_SYNCH_DATA; + dst += thom_qdd_make_sector( img, i, dst ); + } + + memset( dst, 0x16, THOM_QDD_SYNCH_DISK ); dst += THOM_QDD_SYNCH_DISK; + + return dst - org; +} + + + +/*********************** CD 90-640 controller ************************/ + +/* 5''1/4 two-sided double-density + used in TO7, TO7/70, MO5 computers + based on a WD2793 (or lower ?) chip +*/ + + + +static UINT8 to7_5p14_select; + + + +READ8_MEMBER( thomson_state::to7_5p14_r ) +{ + wd2793_t *fdc = machine().device("wd2793"); + + if ( offset < 4 ) + return fdc->read(space, offset ); + else if ( offset == 8 ) + return to7_5p14_select; + else + logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); + return 0; +} + + + +WRITE8_MEMBER( thomson_state::to7_5p14_w ) +{ + wd2793_t *fdc = machine().device("wd2793"); + if ( offset < 4 ) + fdc->write(space, offset, data ); + else if ( offset == 8 ) + { + /* drive select */ + floppy_image_device *floppy = NULL; + + if (BIT(data, 1)) floppy = fdc->subdevice("0")->get_device(); + if (BIT(data, 2)) floppy = fdc->subdevice("1")->get_device(); + + fdc->set_floppy(floppy); + + if (floppy) + { + thom_floppy_active( 0 ); + floppy->mon_w(0); + floppy->ss_w(BIT(data, 0)); + } + } + else + logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n", + machine().time().as_double(), m_maincpu->pc(), offset, data ); +} + + + +void thomson_state::to7_5p14_reset() +{ + wd2793_t *fdc = machine().device("wd2793"); + LOG(( "to7_5p14_reset: CD 90-640 controller\n" )); + fdc->reset(); +} + + + +void thomson_state::to7_5p14_init() +{ + LOG(( "to7_5p14_init: CD 90-640 controller\n" )); + save_item(NAME(to7_5p14_select)); +} + + + +/*********************** CD 90-015 controller ************************/ + +/* 5''1/4 one-sided single-density (up to 4 one-sided drives) + used in TO7, TO7/70, MO5 computers + based on HD 46503 S chip, but we actually use a MC 6843 instead + (seems they are clone) +*/ + + + +static UINT8 to7_5p14sd_select; + + + +READ8_MEMBER( thomson_state::to7_5p14sd_r ) +{ + if ( offset < 8 ) + return m_mc6843->read( space, offset ); + else if ( offset >= 8 && offset <= 9 ) + return to7_5p14sd_select; + else + logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); + return 0; +} + + + +WRITE8_MEMBER( thomson_state::to7_5p14sd_w ) +{ + if ( offset < 8 ) + m_mc6843->write( space, offset, data ); + else if ( offset >= 8 && offset <= 9 ) + { + /* drive select */ + int drive = -1, side = 0; + + if ( data & 1 ) + { + drive = 0; + side = 0; + } + else if ( data & 2 ) + { + drive = 1; + side = 1; + } + else if ( data & 4 ) + { + drive = 2; + side = 0; + } + else if ( data & 8 ) + { + drive = 3; + side = 1; + } + + to7_5p14sd_select = data; + + if ( drive != -1 ) + { + thom_floppy_active( 0 ); + m_mc6843->set_drive( drive ); + m_mc6843->set_side( side ); + LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n", + machine().time().as_double(), m_maincpu->pc(), data, drive, side )); + } + } + else + logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n", + machine().time().as_double(), m_maincpu->pc(), offset, data ); +} + +void thomson_state::to7_5p14_index_pulse_callback( device_t *controller,legacy_floppy_image_device *image, int state ) +{ + m_mc6843->set_index_pulse( state ); +} + +void thomson_state::to7_5p14sd_reset() +{ + int i; + LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" )); + for ( i = 0; i < floppy_get_count( machine() ); i++ ) + { + legacy_floppy_image_device * img = floppy_get_device( machine(), i ); + if (img) { + img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 ); + img->floppy_drive_set_rpm( 300. ); + img->floppy_drive_seek( - img->floppy_drive_get_current_track() ); + } + } +} + + +void thomson_state::to7_5p14sd_init() +{ + LOG(( "to7_5p14sd_init: CD 90-015 controller\n" )); + save_item(NAME(to7_5p14sd_select)); +} + + +/*********************** CQ 90-028 controller ************************/ + +/* QDD 2''8 controller + used in TO7, TO7/70, MO5 computers + it is based on a MC6852 SSDA + + Note: the MC6852 is only partially emulated, most features are not used in + the controller and are ignored. +*/ + + + +/* MC6852 status */ +#define QDD_S_RDA 0x01 /* receiver data available */ +#define QDD_S_TDRA 0x02 /* transitter data register available */ +#define QDD_S_NDCD 0x04 /* data carrier detect, negated (unused) */ +#define QDD_S_NCTS 0x08 /* clear-to-send, negated write-protect */ +#define QDD_S_TUF 0x10 /* transmitter underflow (unused) */ +#define QDD_S_OVR 0x20 /* receiver overrun (unused) */ +#define QDD_S_PE 0x40 /* receiver parity error (unused) */ +#define QDD_S_IRQ 0x80 /* interrupt request */ +#define QDD_S_ERR (QDD_S_TUF | QDD_S_OVR | QDD_S_PE | QDD_S_NDCD | QDD_S_NCTS) + + +/* MC6852 control */ +#define QDD_C1_RIE 0x20 /* interrupt on reveive */ +#define QDD_C1_TIE 0x10 /* interrupt on transmit */ +#define QDD_C1_CLRSYNC 0x08 /* clear receiver sync char (unused) */ +#define QDD_C1_STRIPSYNC 0x04 /* strips sync from received (unused) */ +#define QDD_C1_TRESET 0x02 /* transmitter reset */ +#define QDD_C1_RRESET 0x01 /* receiver reset */ +#define QDD_C2_EIE 0x80 /* interrupt on error */ +#define QDD_C2_TSYNC 0x40 /* underflow = ff if 0 / sync if 1 (unused) */ +#define QDD_C2_BLEN 0x04 /* transfer byte length (unused) */ +#define QDD_C3_CLRTUF 0x08 /* clear underflow */ +#define QDD_C3_CLRCTS 0x04 /* clear CTS */ +#define QDD_C3_SYNCLEN 0x02 /* sync byte length (unused) */ +#define QDD_C3_SYNCMODE 0x01 /* external / internal sync mode (unused) */ + + +/* a track is actually the whole disk = 400 128-byte sectors + headers */ +#define QDD_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 + + +struct to7qdd_t +{ + /* MC6852 registers */ + UINT8 status; + UINT8 ctrl1; + UINT8 ctrl2; + UINT8 ctrl3; + + /* extra registers */ + UINT8 drive; + + /* internal state */ + UINT8 data[QDD_MAXBUF]; /* enough for a whole track */ + UINT32 data_idx; /* byte position in track */ + UINT32 start_idx; /* start of write position */ + UINT32 data_size; /* track length */ + UINT8 data_crc; /* checksum when writing */ + UINT8 index_pulse; /* one pulse per track */ + +}; + +static to7qdd_t * to7qdd; + + + +void thomson_state::to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state ) +{ + to7qdd->index_pulse = state; + + if ( state ) + { + /* rewind to disk start */ + to7qdd->data_idx = 0; + to7qdd->start_idx = 0; + to7qdd->data_size = 0; + } + + VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", machine().time().as_double(), state )); +} + + + +legacy_floppy_image_device * thomson_state::to7_qdd_image() +{ + return floppy_get_device( machine(), 0 ); +} + + + +/* update MC6852 status register */ +void thomson_state::to7_qdd_stat_update() +{ + /* byte-ready */ + to7qdd->status |= QDD_S_RDA | QDD_S_TDRA; + if ( ! to7qdd->drive ) + to7qdd->status |= QDD_S_PE; + + /* write-protect */ + if (to7_qdd_image()->floppy_wpt_r() == CLEAR_LINE) + to7qdd->status |= QDD_S_NCTS; + + /* sticky reset conditions */ + if ( to7qdd->ctrl1 & QDD_C1_RRESET ) + to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); + if ( to7qdd->ctrl1 & QDD_C1_TRESET ) + to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF); + + /* irq update */ + + if ( ( (to7qdd->ctrl1 & QDD_C1_RIE) && !(to7qdd->status & QDD_S_RDA ) ) || + ( (to7qdd->ctrl1 & QDD_C1_TIE) && !(to7qdd->status & QDD_S_TDRA) ) || + ( (to7qdd->ctrl2 & QDD_C2_EIE) && !(to7qdd->status & QDD_S_ERR ) ) ) + to7qdd->status &= ~QDD_S_IRQ; + + if ( ( (to7qdd->ctrl1 & QDD_C1_RIE) && (to7qdd->status & QDD_S_RDA ) ) || + ( (to7qdd->ctrl1 & QDD_C1_TIE) && (to7qdd->status & QDD_S_TDRA) ) || + ( (to7qdd->ctrl2 & QDD_C2_EIE) && (to7qdd->status & QDD_S_ERR ) ) ) + to7qdd->status |= QDD_S_IRQ; +} + + + +UINT8 thomson_state::to7_qdd_read_byte() +{ + UINT8 data; + + /* rebuild disk if needed */ + if ( !to7qdd->data_size ) + { + to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data ); + assert( to7qdd->data_idx < sizeof( to7qdd->data ) ); + } + + if ( to7qdd->data_idx >= to7qdd->data_size ) + data = 0; + else + data = to7qdd->data[ to7qdd->data_idx ]; + + VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", + machine().time().as_double(), m_maincpu->pc(), + to7qdd->data_idx, to7qdd->data_size, data )); + + to7qdd->data_idx++; + to7qdd->start_idx = to7qdd->data_idx; + + return data; +} + + + +/* This is quite complex: bytes are written one at a time by the CPU and we + must detect the following patterns: + * CPU write id field and data field => format + * CPU write data field after it has read an id field => sector write + */ +void thomson_state::to7_qdd_write_byte( UINT8 data ) +{ + int i; + + /* rebuild disk if needed */ + if ( !to7qdd->data_size ) + { + to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data ); + assert( to7qdd->data_idx < sizeof( to7qdd->data ) ); + } + + if ( ( to7qdd->start_idx != to7qdd->data_idx || /* field in construction */ + data==0xA5 || data==0x5A ) && /* first byte of tentative field */ + to7qdd->data_idx data_size ) + { + /* this is the first byte of the field */ + if ( to7qdd->start_idx == to7qdd->data_idx ) + to7qdd->data_crc = 0; + + /* accumulate bytes */ + to7qdd->data[ to7qdd->data_idx ] = data; + to7qdd->data_idx++; + + VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", + machine().time().as_double(), m_maincpu->pc(), data, + to7qdd->start_idx, to7qdd->data_idx )); + + /* end of tentative id field */ + if ( to7qdd->data_idx == to7qdd->start_idx + 4 && + to7qdd->data[ to7qdd->start_idx ] == 0xA5 && + to7qdd->data[ to7qdd->start_idx + 3 ] == to7qdd->data_crc ) + { + /* got an id field => format */ + int sector = (int) to7qdd->data[ to7qdd->start_idx + 1 ] * 256 + (int) to7qdd->data[ to7qdd->start_idx + 2 ]; + UINT8 filler = 0xff; + + LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", + machine().time().as_double(), m_maincpu->pc(), sector )); + + to7_qdd_image()->floppy_drive_format_sector( + 0, sector, 0, 0, sector, 128, filler ); + thom_floppy_active( 1 ); + to7qdd->start_idx = to7qdd->data_idx; + } + + /* end of tentative data field */ + else if ( to7qdd->data_idx == to7qdd->start_idx + 130 && + to7qdd->data[ to7qdd->start_idx ] == 0x5A && + to7qdd->data[ to7qdd->start_idx + 129 ] == to7qdd->data_crc ) + { + /* look backwards for previous id field */ + for ( i = to7qdd->start_idx - 3; i >= 0; i-- ) + { + if ( to7qdd->data[ i ] == 0xA5 && + ( ( to7qdd->data[ i ] + to7qdd->data[ i + 1 ] + + to7qdd->data[ i + 2 ] ) & 0xff + ) == to7qdd->data[ i + 3 ] ) + break; + } + + if ( i >= 0 ) + { + /* got an id & a data field => write */ + int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ]; + + LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", + machine().time().as_double(), m_maincpu->pc(), sector )); + + to7_qdd_image()->floppy_drive_write_sector_data( 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 ); + thom_floppy_active( 1 ); + } + + to7qdd->start_idx = to7qdd->data_idx; + } + + else to7qdd->data_crc += data; + } +} + + + +READ8_MEMBER( thomson_state::to7_qdd_r ) +{ + switch ( offset ) + { + case 0: /* MC6852 status */ + to7_qdd_stat_update(); + VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n", + machine().time().as_double(), m_maincpu->pc(), to7qdd->status, + to7qdd->status & QDD_S_IRQ ? 1 : 0, + to7qdd->status & QDD_S_PE ? 1 : 0, + to7qdd->status & QDD_S_OVR ? 1 : 0, + to7qdd->status & QDD_S_TUF ? 1 : 0, + to7qdd->status & QDD_S_TDRA ? 1 : 0, + to7qdd->status & QDD_S_RDA ? 1 : 0, + to7qdd->status & QDD_S_NCTS ? 1 : 0 )); + return to7qdd->status; + + case 1: /* MC6852 data input => read byte from disk */ + to7qdd->status &= ~(QDD_S_RDA | QDD_S_PE | QDD_S_OVR); + to7_qdd_stat_update(); + return to7_qdd_read_byte(); + + case 8: /* floppy status */ + { + UINT8 data = 0; + device_image_interface* img = dynamic_cast(to7_qdd_image()); + if ( ! img->exists() ) + data |= 0x40; /* disk present */ + if ( to7qdd->index_pulse ) + data |= 0x80; /* disk start */ + VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + return data; + } + + default: + logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::to7_qdd_w ) +{ + switch ( offset ) + { + case 0: /* MC6852 control 1 */ + /* reset */ + if ( data & QDD_C1_RRESET ) + to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); + if ( data & QDD_C1_TRESET ) + to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF); + + to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 ); + to7_qdd_stat_update(); + VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n", + machine().time().as_double(), m_maincpu->pc(), data, + data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-', + data & QDD_C1_STRIPSYNC ? "strip-sync " : "", + data & QDD_C1_CLRSYNC ? "clear-sync " : "", + data & QDD_C1_RIE ? 'r' : '-', + data & QDD_C1_TIE ? 't' : '-' )); + break; + + case 1: + switch ( to7qdd->ctrl1 >> 6 ) + { + case 0: /* MC6852 control 2 */ + { +#if 0 + /* most of these are unused now */ + static const int bit[8] = { 6, 6, 7, 8, 7, 7, 8, 8 }; + static const int par[8] = { 2, 1, 0, 0, 2, 1, 2, 1 }; + static const char *const parname[3] = { "none", "odd", "even" }; + int bits, parity; + bits = bit[ (data >> 3) & 7 ]; + parity = par[ (data >> 3) & 7 ]; + to7_qdd_stat_update(space.machine()); + VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n", + machine().time().as_double(), m_maincpu->pc(), data, + bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2, + data & QDD_C2_TSYNC ? "sync" : "ff", + data & QDD_C2_EIE ? "irq-err" : "" )); +#endif + to7qdd->ctrl2 = data; + break; + } + + case 1: /* MC6852 control 3 */ + to7qdd->ctrl3 = data; + /* reset just once each write, not sticky */ + if ( data & QDD_C3_CLRTUF ) + to7qdd->status &= ~QDD_S_TUF; + if ( data & QDD_C3_CLRCTS ) + to7qdd->status &= ~QDD_S_NCTS; + to7_qdd_stat_update(); + VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", + machine().time().as_double(), m_maincpu->pc(), data, + data & QDD_C3_CLRTUF ? "clr-tuf " : "", + data & QDD_C3_CLRCTS ? "clr-cts " : "", + data & QDD_C3_SYNCLEN ? 1 : 2, + data & QDD_C3_SYNCMODE ? "ext" : "int" )); + break; + + case 2: /* MC6852 sync code => write byte to disk */ + to7_qdd_write_byte( data ); + break; + + case 3: /* MC6852 data out => does not seem to be used */ + VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + break; + + } + break; + + case 8: /* set drive */ + to7qdd->drive = data; + VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + break; + + case 12: /* motor pulse ? */ + thom_floppy_active( 0 ); + VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + break; + + default: + logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", machine().time().as_double(), m_maincpu->pc(), offset, data ); + } +} + + + +void thomson_state::to7_qdd_reset() +{ + int i; + LOG(( "to7_qdd_reset: CQ 90-028 controller\n" )); + + for ( i = 0; i < floppy_get_count( machine() ); i++ ) + { + legacy_floppy_image_device * img = floppy_get_device( machine(), i ); + if (img) { + img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 ); + + motor_on = CLEAR_LINE; + img->floppy_mon_w( motor_on); + + /* pulse each time the whole-disk spiraling track ends */ + /* at 90us per byte read, the disk can be read in 6s */ + img->floppy_drive_set_rpm( 60. / 6. ); + } + } + + to7qdd->ctrl1 |= QDD_C1_TRESET | QDD_C1_RRESET; /* reset */ + to7qdd->ctrl2 &= 0x7c; /* clear EIE, PC2-PC1 */ + to7qdd->ctrl3 &= 0xfe; /* internal sync */ + to7qdd->drive = 0; + to7_qdd_stat_update(); +} + + + +void thomson_state::to7_qdd_init() +{ + LOG(( "to7_qdd_init: CQ 90-028 controller\n" )); + + to7qdd = auto_alloc(machine(), to7qdd_t); + + save_item(NAME(to7qdd->status)); + save_item(NAME(to7qdd->ctrl1)); + save_item(NAME(to7qdd->ctrl2)); + save_item(NAME(to7qdd->ctrl3)); + save_item(NAME(to7qdd->drive)); + save_item(NAME(to7qdd->data_idx)); + save_item(NAME(to7qdd->start_idx)); + save_item(NAME(to7qdd->data_size)); + save_item(NAME(to7qdd->data_crc)); + save_item(NAME(to7qdd->index_pulse)); + save_item(NAME(to7qdd->data)); +} + + + +/********************** THMFC1 controller *************************/ + +/* custom Thomson Gate-array for 3''1/2, 5''1/4 (double density only) & QDD + */ + + + +/* types of high-level operations */ +#define THMFC1_OP_RESET 0 +#define THMFC1_OP_WRITE_SECT 1 +#define THMFC1_OP_READ_ADDR 2 +#define THMFC1_OP_READ_SECT 3 + + +/* STAT0 flags */ +#define THMFC1_STAT0_SYNCHRO 0x01 /* bit clock synchronized */ +#define THMFC1_STAT0_BYTE_READY_OP 0x02 /* byte ready (high-level operation) */ +#define THMFC1_STAT0_CRC_ERROR 0x04 +#define THMFC1_STAT0_FINISHED 0x08 +#define THMFC1_STAT0_FINISHING 0x10 /* (unemulated) */ +#define THMFC1_STAT0_BYTE_READY_POL 0x80 /* polling mode */ + + +/*#define THOM_MAXBUF (THOM_SIZE_ID+THOM_SIZE_DATA_HI+2*THOM_SIZE_SYNCHRO)*17*/ +#define THOM_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 + + +struct thmfc1_t +{ + UINT8 op; + UINT8 sector; /* target sector, in [1,16] */ + UINT32 sector_id; + UINT8 track; /* current track, in [0,79] */ + UINT8 side; /* current side, 0 or 1 */ + UINT8 drive; /* 0 to 3 */ + UINT16 sector_size; /* 128 or 256 (512, 1024 not supported) */ + UINT8 formatting; + UINT8 ipl; /* index pulse / QDD start */ + UINT8 wsync; /* synchronization word */ + + UINT8 data[THOM_MAXBUF]; /* enough for a whole track */ + UINT32 data_idx; /* reading / writing / formatting pos */ + UINT32 data_size; /* bytes to read / write */ + UINT32 data_finish; /* when to raise the finished flag */ + UINT32 data_raw_idx; /* byte index for raw track reading */ + UINT32 data_raw_size; /* size of track already cached in data */ + UINT8 data_crc; /* check-sum of written data */ + + UINT8 stat0; /* status register */ + +}; + +static thmfc1_t * thmfc1; + + +static emu_timer* thmfc_floppy_cmd; + + + +legacy_floppy_image_device * thomson_state::thmfc_floppy_image() +{ + return floppy_get_device( machine(), thmfc1->drive ); +} + + + +int thomson_state::thmfc_floppy_is_qdd ( legacy_floppy_image_device *image ) +{ + if (image==NULL) return 0; + if (!image->exists()) return 0; + return image->length()==51200; // idf QDD +} + + + +void thomson_state::thmfc_floppy_index_pulse_cb ( device_t *controller,legacy_floppy_image_device *image, int state ) +{ + if ( image != thmfc_floppy_image()) + return; + + if ( thmfc_floppy_is_qdd(image)) + { + /* pulse each time the whole-disk spiraling track ends */ + image->floppy_drive_set_rpm( 16.92f /* 423/25 */ ); + thmfc1->ipl = state; + if ( state ) + { + thmfc1->data_raw_size = 0; + thmfc1->data_raw_idx = 0; + thmfc1->data_idx = 0; + } + } + else + { + image->floppy_drive_set_rpm( 300. ); + thmfc1->ipl = state; + if ( state ) + thmfc1->data_raw_idx = 0; + } + + VLOG(( "%f thmfc_floppy_index_pulse_cb: state=%i\n", machine().time().as_double(), state )); +} + + + +int thomson_state::thmfc_floppy_find_sector( chrn_id* dst ) +{ + legacy_floppy_image_device* img = thmfc_floppy_image(); + chrn_id id; + int r = 0; + + /* scan track, try 4 revolutions */ + while ( r < 4 ) + { + if ( img->floppy_drive_get_next_id( thmfc1->side, &id ) ) + { + if ( id.C == thmfc1->track && + id.R == thmfc1->sector && + (128 << id.N) == thmfc1->sector_size + /* check side ? id.H == thmfc1->side */ ) + { + if ( dst ) + memcpy( dst, &id, sizeof( chrn_id ) ); + thmfc1->stat0 = THMFC1_STAT0_BYTE_READY_POL; + LOG (( "thmfc_floppy_find_sector: sector found C=%i H=%i R=%i N=%i\n", id.C, id.H, id.R, id.N )); + return 1; + } + } + + if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) ) + r++; + } + + thmfc1->stat0 = THMFC1_STAT0_CRC_ERROR | THMFC1_STAT0_FINISHED; + LOG (( "thmfc_floppy_find_sector: sector not found drive=%i track=%i sector=%i\n", floppy_get_drive(img), thmfc1->track, thmfc1->sector )); + return 0; +} + + + +/* complete command (by read, write, or timeout) */ +void thomson_state::thmfc_floppy_cmd_complete() +{ + LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n", + machine().time().as_double(), thmfc1->op, thmfc1->data_idx, + thmfc1->data_finish - 1, thmfc1->data_size - 1 )); + + if ( thmfc1->op == THMFC1_OP_WRITE_SECT ) + { + legacy_floppy_image_device * img = thmfc_floppy_image(); + img->floppy_drive_write_sector_data( thmfc1->side, thmfc1->sector_id, thmfc1->data + 3, thmfc1->data_size - 3, 0 ); + thom_floppy_active( 1 ); + } + thmfc1->op = THMFC1_OP_RESET; + thmfc1->stat0 |= THMFC1_STAT0_FINISHED; + thmfc1->data_idx = 0; + thmfc1->data_size = 0; + thmfc_floppy_cmd->adjust(attotime::never); +} + + + +TIMER_CALLBACK_MEMBER( thomson_state::thmfc_floppy_cmd_complete_cb ) +{ + thmfc_floppy_cmd_complete(); +} + + + +/* intelligent read: show just one field, skip header */ +UINT8 thomson_state::thmfc_floppy_read_byte() +{ + UINT8 data = thmfc1->data[ thmfc1->data_idx ]; + + VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n", + machine().time().as_double(), m_maincpu->pc(), + thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1, + data )); + + if ( thmfc1->data_idx >= thmfc1->data_size - 1 ) + thmfc_floppy_cmd_complete(); + else + thmfc1->data_idx++; + + if ( thmfc1->data_idx >= thmfc1->data_finish ) + thmfc1->stat0 |= THMFC1_STAT0_FINISHED; + + return data; +} + + + +/* dumb read: show whole track with field headers and gaps */ +UINT8 thomson_state::thmfc_floppy_raw_read_byte() +{ + UINT8 data; + + /* rebuild track if needed */ + if ( ! thmfc1->data_raw_size ) + { + if ( thmfc_floppy_is_qdd(thmfc_floppy_image())) + /* QDD: track = whole disk */ + thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); + else + { + thmfc1->data_raw_idx = 0; + thmfc1->data_raw_size = thom_floppy_make_track( thmfc_floppy_image(), thmfc1->data, + thmfc1->sector_size, thmfc1->side ); + } + assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) ); + } + + if ( thmfc1->data_raw_idx >= thmfc1->data_raw_size ) + data = 0; + else + data = thmfc1->data[ thmfc1->data_raw_idx ]; + + VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n", + machine().time().as_double(), m_maincpu->pc(), + thmfc1->data_raw_idx, thmfc1->data_raw_size, data )); + + thmfc1->data_raw_idx++; + + return data; +} + + + +/* QDD writing / formating */ +void thomson_state::thmfc_floppy_qdd_write_byte( UINT8 data ) +{ + int i; + + if ( thmfc1->formatting && + ( thmfc1->data_idx || data==0xA5 || data==0x5A ) && + thmfc1->data_raw_idx < THOM_MAXBUF ) + { + if ( ! thmfc1->data_raw_size ) + { + thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); + assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) ); + } + + /* accumulate bytes to form a field */ + thmfc1->data[ thmfc1->data_raw_idx ] = data; + thmfc1->data_raw_idx++; + + if ( ! thmfc1->data_idx ) + { + /* start */ + thmfc1->data_crc = 0; + thmfc1->data_idx = thmfc1->data_raw_idx; + } + + VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n", + machine().time().as_double(), m_maincpu->pc(), data, + thmfc1->data_idx,thmfc1->data_raw_idx )); + + if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 && + thmfc1->data[ thmfc1->data_idx - 1 ] == 0xA5 && + thmfc1->data[ thmfc1->data_idx + 2 ] == thmfc1->data_crc ) + { + /* got an id field => format */ + int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ]; + UINT8 filler = 0xff; + + LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", machine().time().as_double(), m_maincpu->pc(), sector )); + + thmfc_floppy_image()->floppy_drive_format_sector( 0, sector, 0, 0, sector, 128, filler ); + thom_floppy_active( 1 ); + thmfc1->data_idx = 0; + } + + else if ( thmfc1->data_raw_idx == thmfc1->data_idx + 129 && + thmfc1->data[ thmfc1->data_idx - 1 ] == 0x5A && + thmfc1->data[ thmfc1->data_idx + 128 ] == thmfc1->data_crc ) + { + /* look backwards for previous id field */ + for ( i = thmfc1->data_idx - 4; i >= 0; i-- ) + { + if ( thmfc1->data[ i ] == 0xA5 && + ( ( thmfc1->data[ i ] + thmfc1->data[ i + 1 ] + + thmfc1->data[ i + 2 ] ) & 0xff + ) == thmfc1->data[ i + 3 ] ) + break; + } + + if ( i >= 0 ) + { + /* got an id & a data field => write */ + legacy_floppy_image_device * img = thmfc_floppy_image(); + int sector = (int) thmfc1->data[ i + 1 ] * 256 + + (int) thmfc1->data[ i + 2 ]; + + LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n", + machine().time().as_double(), m_maincpu->pc(), sector )); + + img->floppy_drive_write_sector_data( 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 ); + thom_floppy_active( 1 ); + } + + thmfc1->data_idx = 0; + + } + else + thmfc1->data_crc += data; + } + else + { + thmfc1->data_raw_idx++; + VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + } + +} + + + +/* intelligent writing */ +void thomson_state::thmfc_floppy_write_byte( UINT8 data ) +{ + VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", + machine().time().as_double(), m_maincpu->pc(), + thmfc1->data_idx, thmfc1->data_size - 1, data )); + + thmfc1->data_raw_size = 0; + thmfc1->data[ thmfc1->data_idx ] = data; + if ( thmfc1->data_idx >= thmfc1->data_size - 1 ) + thmfc_floppy_cmd_complete(); + else + thmfc1->data_idx++; +} + +/* intelligent formatting */ +void thomson_state::thmfc_floppy_format_byte( UINT8 data ) +{ + VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + + thmfc1->data_raw_size = 0; + + /* accumulate bytes to form an id field */ + if ( thmfc1->data_idx || data==0xA1 ) + { + static const UINT8 header[] = { 0xa1, 0xa1, 0xa1, 0xfe }; + thmfc1->data[ thmfc1->data_idx ] = data; + thmfc1->data_idx++; + if ( thmfc1->data_idx > 11 ) + { + if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) ) + { + /* got id field => format */ + legacy_floppy_image_device * img = thmfc_floppy_image(); + UINT8 track = thmfc1->data[4]; + UINT8 side = thmfc1->data[5]; + UINT8 sector = thmfc1->data[6]; + UINT8 length = thmfc1->data[7]; /* actually, log length */ + UINT8 filler = 0xe5; /* standard Thomson filler */ + chrn_id id; + if ( thmfc_floppy_find_sector( &id ) ) + { + img->floppy_drive_format_sector( side, thmfc1->sector_id, track, thmfc1->side, sector, length, filler ); + thom_floppy_active( 1 ); + } + } + + thmfc1->data_idx = 0; + } + + } +} + + + +READ8_MEMBER( thomson_state::thmfc_floppy_r ) +{ + switch ( offset ) + { + case 0: /* STAT0 */ + thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL; + VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", machine().time().as_double(), m_maincpu->pc(), thmfc1->stat0 )); + return thmfc1->stat0; + + case 1: /* STAT1 */ + { + UINT8 data = 0; + legacy_floppy_image_device * img = thmfc_floppy_image(); + int flags = img->floppy_drive_get_flag_state(-1 ); + if ( thmfc_floppy_is_qdd(img) ) + { + if ( ! img->exists() ) + data |= 0x40; /* disk present */ + if ( ! thmfc1->ipl ) + data |= 0x02; /* disk start */ + data |= 0x08; /* connected */ + } + else + { + if ( thmfc1->ipl ) + data |= 0x40; + if ( img->exists() ) + data |= 0x20; /* disk change (?) */ + + data |= !img->floppy_tk00_r() << 3; + + if ( flags & FLOPPY_DRIVE_READY ) + data |= 0x02; + } + if (!motor_on) + data |= 0x10; + if (!img->floppy_wpt_r()) + data |= 0x04; + VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + return data; + } + + case 3: /* RDATA */ + + if ( thmfc1->op == THMFC1_OP_READ_SECT || thmfc1->op == THMFC1_OP_READ_ADDR ) + return thmfc_floppy_read_byte(); + else + return thmfc_floppy_raw_read_byte(); + + case 6: + return 0; + + case 8: + { + /* undocumented => emulate TO7 QDD controller ? */ + UINT8 data = thmfc1->ipl << 7; + VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + return data; + } + + default: + logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::thmfc_floppy_w ) +{ + switch ( offset ) { + case 0: /* CMD0 */ + { + int wsync = (data >> 4) & 1; + int qdd = thmfc_floppy_is_qdd(thmfc_floppy_image()); + chrn_id id; + thmfc1->formatting = (data >> 2) & 1; + LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n", + machine().time().as_double(), m_maincpu->pc(), data, + (BIT(data, 5) ? "FM" : "MFM"), + wsync, (data >> 3) & 1, + thmfc1->formatting, data & 3 )); + + /* abort previous command, if any */ + thmfc1->op = THMFC1_OP_RESET; + thmfc_floppy_cmd->adjust(attotime::never); + + switch ( data & 3 ) + { + case THMFC1_OP_RESET: + thmfc1->stat0 = THMFC1_STAT0_FINISHED; + break; + + case THMFC1_OP_WRITE_SECT: + if ( qdd ) + logerror( "thmfc_floppy_w: smart operation 1 not supported for QDD\n" ); + else if ( thmfc_floppy_find_sector( &id ) ) + { + thmfc1->sector_id = id.data_id; + thmfc1->data_idx = 0; + thmfc1->data_size = thmfc1->sector_size + 3; /* A1 A1 FB */ + thmfc1->data_finish = thmfc1->sector_size + 3; + thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; + thmfc1->op = THMFC1_OP_WRITE_SECT; + thmfc_floppy_cmd->adjust(attotime::from_msec( 10 )); + } + break; + + case THMFC1_OP_READ_ADDR: + if ( qdd ) + logerror( "thmfc_floppy_w: smart operation 2 not supported for QDD\n" ); + else if ( thmfc_floppy_find_sector( &id ) ) + { + thmfc1->data_size = + thom_floppy_make_addr( id, thmfc1->data, thmfc1->sector_size ); + assert( thmfc1->data_size < sizeof( thmfc1->data ) ); + thmfc1->data_finish = 10; + thmfc1->data_idx = 1; + thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; + thmfc1->op = THMFC1_OP_READ_ADDR; + thmfc_floppy_cmd->adjust(attotime::from_msec( 1 )); + } + break; + + case THMFC1_OP_READ_SECT: + if ( qdd ) + logerror( "thmfc_floppy_w: smart operation 3 not supported for QDD\n" ); + else if ( thmfc_floppy_find_sector( &id ) ) + { + thmfc1->data_size = thom_floppy_make_sector + ( thmfc_floppy_image(), id, thmfc1->data, thmfc1->sector_size ); + assert( thmfc1->data_size < sizeof( thmfc1->data ) ); + thmfc1->data_finish = thmfc1->sector_size + 4; + thmfc1->data_idx = 1; + thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; + thmfc1->op = THMFC1_OP_READ_SECT; + thmfc_floppy_cmd->adjust(attotime::from_msec( 10 )); + } + break; + } + + /* synchronize to word, if needed (QDD only) */ + if ( wsync && qdd ) { + if ( ! thmfc1->data_raw_size ) + thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); + while ( thmfc1->data_raw_idx < thmfc1->data_raw_size && + thmfc1->data[ thmfc1->data_raw_idx ] != thmfc1->wsync ) + { + thmfc1->data_raw_idx++; + } + } + } + + break; + + + case 1: /* CMD1 */ + thmfc1->data_raw_size = 0; + thmfc1->sector_size = 128 << ( (data >> 5) & 3); + thmfc1->side = (data >> 4) & 1; + if ( thmfc1->sector_size > 256 ) + { + logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n", + m_maincpu->pc(), thmfc1->sector_size ); + thmfc1->sector_size = 256; + } + + LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n", + machine().time().as_double(), m_maincpu->pc(), data, + thmfc1->sector_size, (data >> 1) & 7, thmfc1->side )); + break; + + + case 2: /* CMD2 */ + { + legacy_floppy_image_device * img; + int seek = 0, motor; + thmfc1->drive = data & 2; + + img = thmfc_floppy_image(); + if ( thmfc_floppy_is_qdd(img)) + { + motor = !(data & 0x40); + /* no side select & no seek for QDD */ + } + else + { + if ( data & 0x10 ) + seek = (data & 0x20) ? 1 : -1; + motor = (data >> 2) & 1; + thmfc1->drive |= 1 ^ ((data >> 6) & 1); + img = thmfc_floppy_image(); + } + + thom_floppy_active( 0 ); + + LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n", + machine().time().as_double(), m_maincpu->pc(), data, + thmfc1->drive, seek, motor )); + + if ( seek ) + { + thmfc1->data_raw_size = 0; + img->floppy_drive_seek( seek ); + } + + /* in real life, to keep the motor running, it is sufficient to + set motor to 1 every few seconds. + instead of counting, we assume the motor is always running... + */ + motor_on = CLEAR_LINE /* motor */; + img->floppy_mon_w(motor_on); + } + break; + + + case 3: /* WDATA */ + thmfc1->wsync = data; + if ( thmfc_floppy_is_qdd(thmfc_floppy_image())) + thmfc_floppy_qdd_write_byte( data ); + else if ( thmfc1->op==THMFC1_OP_WRITE_SECT ) + thmfc_floppy_write_byte( data ); + else if ( thmfc1->formatting ) + thmfc_floppy_format_byte( data ); + else + { + /* TODO: implement other forms of raw track writing */ + LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n", + machine().time().as_double(), m_maincpu->pc(), data )); + } + break; + + + case 4: /* WCLK (unemulated) */ + /* clock configuration: FF for data, 0A for synchro */ + LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n", + machine().time().as_double(), m_maincpu->pc(), data, + (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" )); + break; + + case 5: /* WSECT */ + thmfc1->sector = data; + LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n", + machine().time().as_double(), m_maincpu->pc(), data )); + break; + + case 6: /* WTRCK */ + thmfc1->track = data; + LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", + machine().time().as_double(), m_maincpu->pc(), data, + thmfc_floppy_image()->floppy_drive_get_current_track())); + break; + + case 7: /* WCELL */ + /* precompensation (unemulated) */ + LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n", + machine().time().as_double(), m_maincpu->pc(), data )); + break; + + default: + logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n", + machine().time().as_double(), m_maincpu->pc(), offset, data ); + } +} + + + +void thomson_state::thmfc_floppy_reset() +{ + int i; + LOG(( "thmfc_floppy_reset: THMFC1 controller\n" )); + + for ( i = 0; i < floppy_get_count( machine() ); i++ ) + { + legacy_floppy_image_device * img = floppy_get_device( machine(), i ); + if (img) { + img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 ); + img->floppy_drive_seek( - img->floppy_drive_get_current_track() ); + } + } + + thmfc1->op = THMFC1_OP_RESET; + thmfc1->track = 0; + thmfc1->sector = 0; + thmfc1->side = 0; + thmfc1->drive = 0; + thmfc1->sector_size = 256; + thmfc1->formatting = 0; + thmfc1->stat0 = 0; + thmfc1->data_idx = 0; + thmfc1->data_size = 0; + thmfc1->data_raw_idx = 0; + thmfc1->data_raw_size = 0; + thmfc1->data_crc = 0; + thmfc1->wsync = 0; + thmfc_floppy_cmd->adjust(attotime::never); +} + + + +void thomson_state::thmfc_floppy_init() +{ + LOG(( "thmfc_floppy_init: THMFC1 controller\n" )); + + thmfc1 = auto_alloc(machine(), thmfc1_t); + memset(thmfc1, 0, sizeof(thmfc1_t)); + + thmfc_floppy_cmd = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thmfc_floppy_cmd_complete_cb),this)); + + save_item(NAME(thmfc1->op)); + save_item(NAME(thmfc1->sector)); + save_item(NAME(thmfc1->sector_id)); + save_item(NAME(thmfc1->track)); + save_item(NAME(thmfc1->side)); + save_item(NAME(thmfc1->drive)); + save_item(NAME(thmfc1->sector_size)); + save_item(NAME(thmfc1->formatting)); + save_item(NAME(thmfc1->ipl)); + save_item(NAME(thmfc1->data_idx)); + save_item(NAME(thmfc1->data_size)); + save_item(NAME(thmfc1->data_finish)); + save_item(NAME(thmfc1->stat0)); + save_item(NAME(thmfc1->data_raw_idx)); + save_item(NAME(thmfc1->data_raw_size)); + save_item(NAME(thmfc1->data_crc)); + save_item(NAME(thmfc1->wsync)); + save_item(NAME(thmfc1->data)); +} + + + +/*********************** Network ************************/ + +/* The network extension is built as an external floppy controller. + It uses the same ROM and I/O space, and so, it is natural to have the + toplevel network emulation here! +*/ + +/* NOTE: This is work in progress! + For the moment, only hand-checks works: the TO7 can take the line, then + perform a DKBOOT request. We do not have the server emulated yet, so, + no way to answer the request. +*/ + +TIMER_CALLBACK_MEMBER( thomson_state::ans4 ) +{ + LOG(( "%f ans4\n", machine().time().as_double() )); + m_mc6854->set_cts( 0 ); +} + +TIMER_CALLBACK_MEMBER( thomson_state::ans3 ) +{ + LOG(( "%f ans3\n", machine().time().as_double() )); + m_mc6854->set_cts( 1 ); + machine().scheduler().timer_set( attotime::from_usec( 100 ), timer_expired_delegate(FUNC(thomson_state::ans4),this)); +} + +TIMER_CALLBACK_MEMBER( thomson_state::ans2 ) +{ + LOG(( "%f ans2\n", machine().time().as_double() )); + m_mc6854->set_cts( 0 ); + machine().scheduler().timer_set( attotime::from_usec( 100 ), timer_expired_delegate(FUNC(thomson_state::ans3),this)); +} + +TIMER_CALLBACK_MEMBER( thomson_state::ans ) +{ + LOG(( "%f ans\n", machine().time().as_double() )); + m_mc6854->set_cts( 1 ); + machine().scheduler().timer_set( attotime::from_usec( 100 ), timer_expired_delegate(FUNC(thomson_state::ans2),this)); +} +/* consigne DKBOOT + + MO5 BASIC + $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $01 $00<$41 $00 $FF $20 + $3D $4C $01 $60 $20 $3C $4F $01 $05 $20 $3F $9C $19 $25 $03 $11 + $93 $15 $10 $25 $32 $8A $7E $FF $E1 $FD $E9 $41>$00 $00 $00 $00 + $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 + + TO7/70 BASIC + $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $02 $00<$20 $42 $41 $53 + $49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30 + $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00 + $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 + + TO7 BASIC + $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$20 $42 $41 $53 + $49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30 + $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00 + $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 + + TO7 LOGO + $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$00 $00 $00 $00 + $00 $20 $4C $4F $47 $4F $04 $00 $00 $00 $00 $00 $00 $00 $00 $00 + $00 $00 $00 $00 $00 $00 $AA $FF $01 $16 $00 $C8>$00 $00 $00 $00 + $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 + + +*/ + +MC6854_OUT_FRAME_CB(thomson_state::to7_network_got_frame) +{ + LOG(( "%f to7_network_got_frame:", machine().time().as_double() )); + for ( int i = 0; i < length; i++ ) + LOG(( " $%02X", data[i] )); + LOG(( "\n" )); + + if ( data[1] == 0xff ) + { + LOG(( "to7_network_got_frame: %i phones %i\n", data[2], data[0] )); + machine().scheduler().timer_set( attotime::from_usec( 100 ), timer_expired_delegate(FUNC(thomson_state::ans), this)); + m_mc6854->set_cts( 0 ); + } + else if ( ! data[1] ) + { + char name[33]; + memcpy( name, data + 12, 32 ); + name[32] = 0; + for (int i=0;i<32;i++) + { + if ( name[i]<32 || name[i]>=127 ) + name[i]=' '; + } + LOG(( "to7_network_got_frame: DKBOOT system=%s appli=\"%s\"\n", + (data[10] == 0) ? "TO7" : (data[10] == 1) ? "MO5" : + (data[10] == 2) ? "TO7/70" : "?", name )); + } +} + + +void thomson_state::to7_network_init() +{ + LOG(( "to7_network_init: NR 07-005 network extension\n" )); + logerror( "to7_network_init: network not handled!\n" ); +} + + + +void thomson_state::to7_network_reset() +{ + LOG(( "to7_network_reset: NR 07-005 network extension\n" )); + m_mc6854->set_cts( 0 ); + m_mc6854->set_cts( 1 ); +} + + + +READ8_MEMBER( thomson_state::to7_network_r ) +{ + if ( offset < 4 ) + return m_mc6854->read( space, offset ); + + if ( offset == 8 ) + { + /* network ID of the computer */ + UINT8 id = m_io_fconfig->read() >> 3; + VLOG(( "%f $%04x to7_network_r: read id $%02X\n", machine().time().as_double(), m_maincpu->pc(), id )); + return id; + } + + logerror( "%f $%04x to7_network_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); + return 0; +} + + + +WRITE8_MEMBER( thomson_state::to7_network_w ) +{ + if ( offset < 4 ) + m_mc6854->write( space, offset, data ); + else + { + logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n", + machine().time().as_double(), m_maincpu->pc(), offset, data ); + } +} + + + +/*********************** TO7 dispatch ************************/ + +/* The TO7, TO7/70, MO5 and MO6 can use a variety of floppy controllers. + We use a PORT_CONFSETTING to chose the current controller, and dispatch + here. + + NOTE: you need to reset the computer after changing the floppy controller! + + The CD 90-351 controller seems similar to the THMFC1 gate-array + => we reuse the THMFC code! +*/ + + + +UINT8 to7_controller_type; +UINT8 to7_floppy_bank; + + +void thomson_state::to7_floppy_init( void* base ) +{ + m_flopbank->configure_entries( 0, TO7_NB_FLOP_BANK, base, 0x800 ); + save_item(NAME(to7_controller_type)); + save_item(NAME(to7_floppy_bank)); + to7_5p14sd_init(); + to7_5p14_init(); + to7_qdd_init(); + thmfc_floppy_init(); + to7_network_init(); +} + + + +void thomson_state::to7_floppy_reset() +{ + to7_controller_type = (m_io_fconfig->read() ) & 7; + + switch ( to7_controller_type ) + { + case 1: + to7_floppy_bank = 1; + to7_5p14sd_reset(); + break; + + case 2: + to7_floppy_bank = 2; + to7_5p14_reset(); + break; + + case 3: + to7_floppy_bank = 3; + thmfc_floppy_reset(); + break; + + case 4: + to7_floppy_bank = 7; + to7_qdd_reset(); + break; + + case 5: + to7_floppy_bank = 8; + to7_network_reset(); + break; + + default: + to7_floppy_bank = 0; + break; + } + + m_flopbank->set_entry( to7_floppy_bank ); +} + + + +READ8_MEMBER( thomson_state::to7_floppy_r ) +{ + switch ( to7_controller_type ) + { + case 1: + return to7_5p14sd_r( space, offset, mem_mask ); + + case 2: + return to7_5p14_r( space, offset, mem_mask ); + + case 3: + return thmfc_floppy_r( space, offset ); + + case 4: + return to7_qdd_r( space, offset, mem_mask ); + + case 5: + return to7_network_r( space, offset, mem_mask ); + } + + return 0; +} + + + +WRITE8_MEMBER( thomson_state::to7_floppy_w ) +{ + switch ( to7_controller_type ) + { + case 1: + to7_5p14sd_w( space, offset, data, mem_mask ); + return; + + case 2: + to7_5p14_w( space, offset, data, mem_mask ); + break; + + case 3: + if ( offset == 8 ) + { + to7_floppy_bank = 3 + (data & 3); + m_flopbank->set_entry( to7_floppy_bank ); + VLOG (( "to7_floppy_w: set CD 90-351 ROM bank to %i\n", data & 3 )); + } + else + thmfc_floppy_w( space, offset, data ); + break; + + case 4: + to7_qdd_w( space, offset, data, mem_mask ); + break; + + case 5: + to7_network_w( space, offset, data, mem_mask ); + break; + } +} + + + +/*********************** TO9 ************************/ + +/* the internal controller is WD2793-based (so, similar to to7_5p14) + we also emulate external controllers +*/ + + + +void thomson_state::to9_floppy_init( void* int_base, void* ext_base ) +{ + to7_floppy_init( ext_base ); + m_flopbank->configure_entry( TO7_NB_FLOP_BANK, int_base); +} + + + +void thomson_state::to9_floppy_reset() +{ + to7_floppy_reset(); + if ( THOM_FLOPPY_EXT ) + { + LOG(( "to9_floppy_reset: external controller\n" )); + } + else + { + LOG(( "to9_floppy_reset: internal controller\n" )); + to7_5p14_reset(); + m_flopbank->set_entry( TO7_NB_FLOP_BANK ); + } +} + + + +READ8_MEMBER( thomson_state::to9_floppy_r ) +{ + if ( THOM_FLOPPY_EXT ) + return to7_floppy_r( space, offset ); + else + return to7_5p14_r( space, offset, mem_mask ); +} + +WRITE8_MEMBER( thomson_state::to9_floppy_w ) +{ + if ( THOM_FLOPPY_EXT ) + to7_floppy_w( space, offset, data ); + else + to7_5p14_w( space, offset, data, mem_mask ); +} + +void thomson_state::thomson_index_callback(legacy_floppy_image_device *device, int state) +{ + switch ( to7_controller_type ) + { + case 1: + to7_5p14_index_pulse_callback(NULL, device, state); + break; + + case 2: + break; + + case 3: + thmfc_floppy_index_pulse_cb(NULL, device, state); + break; + + case 4: + to7_qdd_index_pulse_cb(NULL, device, state); + break; + + default: + break; + } +} diff --git a/src/mame/machine/thomflop.h b/src/mame/machine/thomflop.h new file mode 100644 index 00000000000..5c85f9e0d43 --- /dev/null +++ b/src/mame/machine/thomflop.h @@ -0,0 +1,36 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Thomson 8-bit computers + +**********************************************************************/ + +#ifndef THOMFLOP_H_ +#define THOMFLOP_H_ + +#include "image.h" +#include "imagedev/flopdrv.h" +#include "machine/mc6843.h" +#include "machine/mc6854.h" + +extern UINT8 to7_controller_type; /* set during init */ +extern UINT8 to7_floppy_bank; + +/* number of external floppy controller ROM banks */ +#define TO7_NB_FLOP_BANK 9 + +/* external floppy / network controller active */ +#define THOM_FLOPPY_EXT (to7_controller_type >= 1) + +/* internal floppy controller active (no or network extension) */ +#define THOM_FLOPPY_INT (to7_controller_type == 0 || to7_controller_type > 4) + + +/* external controllers */ +/* TO9 internal (WD2793) & external controllers */ +/* TO8 internal (THMFC1) controller */ + +#endif /* THOMFLOP_H_ */ diff --git a/src/mame/machine/thomson.c b/src/mame/machine/thomson.c new file mode 100644 index 00000000000..240b004141a --- /dev/null +++ b/src/mame/machine/thomson.c @@ -0,0 +1,4794 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Thomson 8-bit computers + +**********************************************************************/ + +#include "emu.h" +#include "machine/thomflop.h" +#include "formats/thom_dsk.h" +#include "includes/thomson.h" +#include "machine/6821pia.h" +#include "machine/ram.h" + +#define VERBOSE 0 +#define VERBOSE_IRQ 0 +#define VERBOSE_KBD 0 /* TO8 / TO9 / TO9+ keyboard */ +#define VERBOSE_BANK 0 +#define VERBOSE_VIDEO 0 /* video & lightpen */ +#define VERBOSE_IO 0 /* serial & parallel I/O */ +#define VERBOSE_MIDI 0 + +#define PRINT(x) osd_printf_info x + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) +#define VLOG(x) do { if (VERBOSE > 1) logerror x; } while (0) +#define LOG_IRQ(x) do { if (VERBOSE_IRQ) logerror x; } while (0) +#define LOG_KBD(x) do { if (VERBOSE_KBD) logerror x; } while (0) +#define LOG_BANK(x) do { if (VERBOSE_BANK) logerror x; } while (0) +#define LOG_VIDEO(x) do { if (VERBOSE_VIDEO) logerror x; } while (0) +#define LOG_IO(x) do { if (VERBOSE_IO) logerror x; } while (0) +#define LOG_MIDI(x) do { if (VERBOSE_MIDI) logerror x; } while (0) + +/* This set to 1 handle the .k7 files without passing through .wav */ +/* It must be set accordingly in formats/thom_cas.c */ +#define K7_SPEED_HACK 0 + + +/*-------------- TO7 ------------*/ + + +/* On the TO7 & compatible (TO7/70,TO8,TO9, but not MO5,MO6), bits are coded + in FM format with a 1.1 ms period (900 bauds): + - 0 is 5 periods at 4.5 kHz + - 1 is 7 periods at 6.3 kHz + + Moreover, a byte is represented using 11 bits: + - one 0 start bit + - eight data bits (low bit first) + - two 1 stop bits + + There are also long (1 s) sequences of 1 bits to re-synchronize the + cassette at places the motor can be cut off and back on (e.g., between + files). + + The computer outputs a modulated wave that is directly put on the cassette. + However, the input is demodulated by the cassette-reader before being + sent to the computer: we got 0 when the signal is around 4.5 kHz and + 1 when the signal is around 6.3 kHz. +*/ + +#define TO7_BIT_LENGTH 0.001114 + +/* 1-bit cassette input to the computer + inside the controller, two frequency filters (adjusted to 6.3 and 4.5 kHz) + and a comparator demodulate the raw signal into 0s and 1s. +*/ +int thomson_state::to7_get_cassette() +{ + if ( m_cassette->exists() ) + { + cassette_image* cass = m_cassette->get_image(); + cassette_state state = m_cassette->get_state(); + double pos = m_cassette->get_position(); + int bitpos = pos / TO7_BIT_LENGTH; + + if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) + return 1; + + if ( K7_SPEED_HACK && m_to7_k7_bits ) + { + /* hack, feed existing bits */ + if ( bitpos >= m_to7_k7_bitsize ) + bitpos = m_to7_k7_bitsize -1; + VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n", + m_maincpu->pc(), machine().time().as_double(), state, pos, bitpos, + m_to7_k7_bits[ bitpos ] )); + return m_to7_k7_bits[ bitpos ]; + } + else + { + /* demodulate wave signal on-the-fly */ + /* we simply count sign changes... */ + int k, chg; + INT8 data[40]; + cassette_get_samples( cass, 0, pos, TO7_BIT_LENGTH * 15. / 14., 40, 1, data, 0 ); + + for ( k = 1, chg = 0; k < 40; k++ ) + { + if ( data[ k - 1 ] >= 0 && data[ k ] < 0 ) + chg++; + if ( data[ k - 1 ] <= 0 && data[ k ] > 0 ) + chg++; + } + k = ( chg >= 13 ) ? 1 : 0; + VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n", + m_maincpu->pc(), machine().time().as_double(), state, pos, bitpos, + k, chg )); + return k; + } + + } + else + return 0; +} + + + +/* 1-bit cassette output */ +void thomson_state::to7_set_cassette( int data ) +{ + m_cassette->output(data ? 1. : -1. ); +} + + + +WRITE_LINE_MEMBER( thomson_state::to7_set_cassette_motor ) +{ + cassette_state cassstate = m_cassette->get_state(); + double pos = m_cassette->get_position(); + + LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n", + m_maincpu->pc(), machine().time().as_double(), state ? "off" : "on", + (int) (pos / TO7_BIT_LENGTH) )); + + if ( (cassstate & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !state && pos > 0.3 ) + { + /* rewind a little before starting the motor */ + m_cassette->seek(-0.3, SEEK_CUR ); + } + + m_cassette->change_state(state ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR ); +} + + + +/*-------------- MO5 ------------*/ + + +/* Each byte is represented as 8 bits without start or stop bit (unlike TO7). + Bits are coded in MFM, and the MFM signal is directly fed to the + computer which has to decode it in software (unlike TO7). + A 1 bit is one period at 1200 Hz; a 0 bit is one half-period at 600 Hz. + Bit-order is most significant bit first (unlike TO7). + + Double-density MO6 cassettes follow the exact same mechanism, but with + at double frequency (perdiods at 2400 Hz, and half-perdios at 1200 Hz). +*/ + + +#define MO5_BIT_LENGTH 0.000833 +#define MO5_HBIT_LENGTH (MO5_BIT_LENGTH / 2.) + + +int thomson_state::mo5_get_cassette() +{ + if ( m_cassette->exists() ) + { + cassette_image* cass = m_cassette->get_image(); + cassette_state state = m_cassette->get_state(); + double pos = m_cassette->get_position(); + INT32 hbit; + + if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) + return 1; + + cassette_get_sample( cass, 0, pos, 0, &hbit ); + hbit = hbit >= 0; + + VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", + m_maincpu->pc(), machine().time().as_double(), state, pos, + (int) (pos / MO5_HBIT_LENGTH), hbit )); + return hbit; + } + else + return 0; +} + + + +void thomson_state::mo5_set_cassette( int data ) +{ + m_cassette->output(data ? 1. : -1. ); +} + + + +WRITE_LINE_MEMBER( thomson_state::mo5_set_cassette_motor ) +{ + cassette_state cassstate = m_cassette->get_state(); + double pos = m_cassette->get_position(); + + LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n", + m_maincpu->pc(), machine().time().as_double(), state ? "off" : "on", + (int) (pos / MO5_HBIT_LENGTH) )); + + if ( (cassstate & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !state && pos > 0.3 ) + { + /* rewind a little before starting the motor */ + m_cassette->seek(-0.3, SEEK_CUR ); + } + + m_cassette->change_state(state ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR ); +} + + + + +/*************************** utilities ********************************/ + + + +/* ------------ IRQs ------------ */ + + +void thomson_state::thom_set_irq( int line, int state ) +{ + int old = m_thom_irq; + + if ( state ) + m_thom_irq |= 1 << line; + else + m_thom_irq &= ~(1 << line); + + if ( !old && m_thom_irq ) + LOG_IRQ(( "%f thom_set_irq: irq line up %i\n", machine().time().as_double(), line )); + if ( old && !m_thom_irq ) + LOG_IRQ(( "%f thom_set_irq: irq line down %i\n", machine().time().as_double(), line )); + + m_maincpu->set_input_line(M6809_IRQ_LINE, m_thom_irq ? ASSERT_LINE : CLEAR_LINE); +} + + + +void thomson_state::thom_set_firq ( int line, int state ) +{ + int old = m_thom_firq; + + if ( state ) + m_thom_firq |= 1 << line; + else + m_thom_firq &= ~(1 << line); + + if ( !old && m_thom_firq ) + LOG_IRQ(( "%f thom_set_firq: firq line up %i\n", machine().time().as_double(), line )); + if ( old && !m_thom_firq ) + LOG_IRQ(( "%f thom_set_firq: firq line down %i\n", machine().time().as_double(), line )); + + m_maincpu->set_input_line(M6809_FIRQ_LINE, m_thom_firq ? ASSERT_LINE : CLEAR_LINE); +} + + + +void thomson_state::thom_irq_reset() +{ + m_thom_irq = 0; + m_thom_firq = 0; + m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE ); + m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE ); +} + + + +void thomson_state::thom_irq_init() +{ + save_item(NAME(m_thom_irq)); + save_item(NAME(m_thom_firq)); +} + + + +void thomson_state::thom_irq_0( int state ) +{ + thom_set_irq( 0, state ); +} + +WRITE_LINE_MEMBER( thomson_state::thom_dev_irq_0 ) +{ + thom_irq_0( state ); +} + + + +WRITE_LINE_MEMBER( thomson_state::thom_irq_1 ) +{ + thom_set_irq ( 1, state ); +} + +void thomson_state::thom_irq_3( int state ) +{ + thom_set_irq ( 3, state ); +} + +WRITE_LINE_MEMBER( thomson_state::thom_firq_1 ) +{ + thom_set_firq ( 1, state ); +} + +void thomson_state::thom_firq_2( int state ) +{ + thom_set_firq ( 2, state ); +} + +void thomson_state::thom_irq_4( int state ) +{ + thom_set_irq ( 4, state ); +} + + +/* + current IRQ usage: + + line 0 => 6846 interrupt + line 1 => 6821 interrupts (shared for all 6821) + line 2 => TO8 lightpen interrupt (from gate-array) + line 3 => TO9 keyboard interrupt (from 6850 ACIA) + line 4 => MIDI interrupt (from 6850 ACIA) +*/ + + + +/* ------------ LED ------------ */ + + + +void thomson_state::thom_set_caps_led( int led ) +{ + output_set_value( "led0", led ); +} + +/* ------------ 6850 defines ------------ */ + +#define ACIA_6850_RDRF 0x01 /* Receive data register full */ +#define ACIA_6850_TDRE 0x02 /* Transmit data register empty */ +#define ACIA_6850_dcd 0x04 /* Data carrier detect, active low */ +#define ACIA_6850_cts 0x08 /* Clear to send, active low */ +#define ACIA_6850_FE 0x10 /* Framing error */ +#define ACIA_6850_OVRN 0x20 /* Receiver overrun */ +#define ACIA_6850_PE 0x40 /* Parity error */ +#define ACIA_6850_irq 0x80 /* Interrupt request, active low */ + + + +/***************************** TO7 / T9000 *************************/ + +DEVICE_IMAGE_LOAD_MEMBER( thomson_state, to7_cartridge ) +{ + int i,j; + UINT8* pos = memregion("maincpu" )->base() + 0x10000; + offs_t size; + char name[129]; + + if (image.software_entry() == NULL) + size = image.length(); + else + size = image.get_software_region_length("rom"); + + /* get size & number of 16-KB banks */ + if ( size <= 0x04000 ) + m_thom_cart_nb_banks = 1; + else if ( size == 0x08000 ) + m_thom_cart_nb_banks = 2; + else if ( size == 0x10000 ) + m_thom_cart_nb_banks = 4; + else + { + std::string errmsg; + strprintf(errmsg,"Invalid cartridge size %u", size); + image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); + return IMAGE_INIT_FAIL; + } + + if (image.software_entry() == NULL) + { + if ( image.fread( pos, size ) != size ) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Read error"); + return IMAGE_INIT_FAIL; + } + } + else + { + memcpy(pos, image.get_software_region("rom"), size); + } + + /* extract name */ + for ( i = 0; i < size && pos[i] != ' '; i++ ); + for ( i++, j = 0; i + j < size && j < 128 && pos[i+j] >= 0x20; j++) + name[j] = pos[i+j]; + name[j] = 0; + + /* sanitize name */ + for ( i = 0; name[i]; i++) + { + if ( name[i] < ' ' || name[i] >= 127 ) + name[i] = '?'; + } + + PRINT (( "to7_cartridge_load: cartridge \"%s\" banks=%i, size=%i\n", name, m_thom_cart_nb_banks, size )); + + return IMAGE_INIT_PASS; +} + + + +void thomson_state::to7_update_cart_bank() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + int bank = 0; + if ( m_thom_cart_nb_banks ) + { + bank = m_thom_cart_bank % m_thom_cart_nb_banks; + if ( bank != m_old_cart_bank && m_old_cart_bank < 0 ) + { + space.install_read_handler(0x0000, 0x0003, read8_delegate(FUNC(thomson_state::to7_cartridge_r),this) ); + } + } + if ( bank != m_old_cart_bank ) + { + m_cartbank->set_entry( bank ); + m_old_cart_bank = bank; + LOG_BANK(( "to7_update_cart_bank: CART is cartridge bank %i\n", bank )); + } +} + + + +void thomson_state::to7_update_cart_bank_postload() +{ + to7_update_cart_bank(); +} + + + +/* write signal to 0000-1fff generates a bank switch */ +WRITE8_MEMBER( thomson_state::to7_cartridge_w ) +{ + if ( offset >= 0x2000 ) + return; + + m_thom_cart_bank = offset & 3; + to7_update_cart_bank(); +} + + + +/* read signal to 0000-0003 generates a bank switch */ +READ8_MEMBER( thomson_state::to7_cartridge_r ) +{ + UINT8* pos = memregion( "maincpu" )->base() + 0x10000; + UINT8 data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + if ( !space.debugger_access() ) + { + m_thom_cart_bank = offset & 3; + to7_update_cart_bank(); + } + return data; +} + + + +/* ------------ 6846 (timer, I/O) ------------ */ + + + +WRITE8_MEMBER( thomson_state::to7_timer_port_out ) +{ + thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ + thom_set_caps_led( (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */ + thom_set_border_color( ((data & 0x10) ? 1 : 0) | /* bits 4-6: border color */ + ((data & 0x20) ? 2 : 0) | + ((data & 0x40) ? 4 : 0) ); +} + + + +WRITE8_MEMBER( thomson_state::to7_timer_cp2_out ) +{ + m_buzzer->write_unsigned8(data ? 0x80 : 0); /* 1-bit buzzer */ +} + + + +READ8_MEMBER( thomson_state::to7_timer_port_in ) +{ + int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; + int cass = to7_get_cassette() ? 0x80 : 0; + return lightpen | cass; +} + + + +WRITE8_MEMBER( thomson_state::to7_timer_tco_out ) +{ + /* 1-bit cassette output */ + to7_set_cassette( data ); +} + + +/* ------------ lightpen automaton ------------ */ + + +void thomson_state::to7_lightpen_cb( int step ) +{ + if ( ! m_to7_lightpen ) + return; + + LOG_VIDEO(( "%f to7_lightpen_cb: step=%i\n", machine().time().as_double(), step )); + m_pia_sys->cb1_w( 1 ); + m_pia_sys->cb1_w( 0 ); + m_to7_lightpen_step = step; +} + + + +/* ------------ video ------------ */ + + + +void thomson_state::to7_set_init( int init ) +{ + /* INIT signal wired to system PIA 6821 */ + + LOG_VIDEO(( "%f to7_set_init: init=%i\n", machine().time().as_double(), init )); + m_pia_sys->ca1_w( init ); +} + + + +/* ------------ system PIA 6821 ------------ */ + + + +WRITE_LINE_MEMBER( thomson_state::to7_sys_cb2_out ) +{ + m_to7_lightpen = !state; +} + + + +WRITE8_MEMBER( thomson_state::to7_sys_portb_out ) +{ + /* value fetched in to7_sys_porta_in */ +} + + + +#define TO7_LIGHTPEN_DECAL 17 /* horizontal lightpen shift, stored in $60D2 */ + + + +READ8_MEMBER( thomson_state::to7_sys_porta_in ) +{ + if ( m_to7_lightpen ) + { + /* lightpen hi */ + return to7_lightpen_gpl( TO7_LIGHTPEN_DECAL, m_to7_lightpen_step ) >> 8; + } + else + { + /* keyboard */ + int keyline = m_pia_sys->b_output(); + UINT8 val = 0xff; + int i; + + for ( i = 0; i < 8; i++ ) + { + if ( ! (keyline & (1 << i)) ) + val &= m_io_keyboard[i]->read(); + } + return val; + } +} + + + +READ8_MEMBER( thomson_state::to7_sys_portb_in ) +{ + /* lightpen low */ + return to7_lightpen_gpl( TO7_LIGHTPEN_DECAL, m_to7_lightpen_step ) & 0xff; +} + + + +/* ------------ CC 90-232 I/O extension ------------ */ + +/* Features: + - 6821 PIA + - serial RS232: bit-banging? + - parallel CENTRONICS: a printer (-prin) is emulated + - usable on TO7(/70), MO5(E) only; not on TO9 and higher + + Note: it seems impossible to connect both a serial & a parallel device + because the Data Transmit Ready bit is shared in an incompatible way! +*/ + +const device_type TO7_IO_LINE = &device_creator; + +//------------------------------------------------- +// to7_io_line_device - constructor +//------------------------------------------------- + +to7_io_line_device::to7_io_line_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TO7_IO_LINE, "T07 Serial source", tag, owner, clock, "to7_io_line", __FILE__), + m_pia_io(*this, THOM_PIA_IO), + m_rs232(*this, "rs232"), + m_last_low(0) +{ +} + +static MACHINE_CONFIG_FRAGMENT( to7_io_line ) + /// THIS PIO is part of CC 90-232 expansion + MCFG_DEVICE_ADD(THOM_PIA_IO, PIA6821, 0) + MCFG_PIA_READPA_HANDLER(READ8(to7_io_line_device, porta_in)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(to7_io_line_device, porta_out)) + MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_PIA_CB2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) + MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("^", thomson_state, thom_firq_1)) + MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("^", thomson_state, thom_firq_1)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(WRITELINE(to7_io_line_device, write_rxd)) + MCFG_RS232_CTS_HANDLER(WRITELINE(to7_io_line_device, write_cts)) + MCFG_RS232_DSR_HANDLER(WRITELINE(to7_io_line_device, write_dsr)) + + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(THOM_PIA_IO, pia6821_device, cb1_w)) + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(to7_io_line_device, write_centronics_busy)) + + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + +MACHINE_CONFIG_END + +machine_config_constructor to7_io_line_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( to7_io_line ); +} + +void to7_io_line_device::device_start() +{ + m_rs232->write_dtr(0); +} + +WRITE8_MEMBER( to7_io_line_device::porta_out ) +{ + int txd = (data >> 0) & 1; + int rts = (data >> 1) & 1; + + LOG_IO(( "%s %f to7_io_porta_out: txd=%i, rts=%i\n", machine().describe_context(), machine().time().as_double(), txd, rts )); + + m_rs232->write_txd(txd); + m_rs232->write_rts(rts); +} + + + +WRITE_LINE_MEMBER(to7_io_line_device::write_rxd ) +{ + m_rxd = state; +} + +WRITE_LINE_MEMBER(to7_io_line_device::write_dsr ) +{ + if (!state) m_last_low = 0; + + m_dsr = state; +} + +WRITE_LINE_MEMBER(to7_io_line_device::write_cts ) +{ + m_pia_io->ca1_w(state); + m_cts = state; +} + +WRITE_LINE_MEMBER(to7_io_line_device::write_centronics_busy ) +{ + if (!state) m_last_low = 1; + + m_centronics_busy = state; +} + + +READ8_MEMBER( to7_io_line_device::porta_in ) +{ + LOG_IO(( "%s %f to7_io_porta_in: select=%i cts=%i, dsr=%i, rd=%i\n", machine().describe_context(), machine().time().as_double(), m_centronics_busy, m_cts, m_dsr, m_rxd )); + + /// HACK: without high impedance we can't tell whether a device is driving a line high or if it's being pulled up. + /// so assume the last device to drive it low is active. + int dsr; + if (m_last_low == 0) + dsr = m_dsr; + else + dsr = !m_centronics_busy; + + return (0x1f /* not required when converted to write_pa */) | (m_cts << 5) | (dsr << 6) | (m_rxd << 7); +} + + + +/* ------------ RF 57-932 RS232 extension ------------ */ + +/* Features: + - SY 6551 ACIA. + - higher transfer rates than the CC 90-232 + - usable on all computer, including TO9 and higher + */ + + + +/* ------------ MD 90-120 MODEM extension (not functional) ------------ */ + +/* Features: + - 6850 ACIA + - 6821 PIA + - asymetric 1200/ 75 bauds (reversable) + + TODO! + */ + + +WRITE_LINE_MEMBER( thomson_state::to7_modem_cb ) +{ + LOG(( "to7_modem_cb: called %i\n", state )); +} + + + +WRITE_LINE_MEMBER( thomson_state::to7_modem_tx_w ) +{ + m_to7_modem_tx = state; +} + + +WRITE_LINE_MEMBER( thomson_state::write_acia_clock ) +{ + m_acia6850->write_txc(state); + m_acia6850->write_rxc(state); +} + +void thomson_state::to7_modem_reset() +{ + LOG (( "to7_modem_reset called\n" )); + m_acia->write_rxd(0); + m_to7_modem_tx = 0; + /* pia_reset() is called in machine_reset */ + /* acia_6850 has no reset (?) */ +} + + + +void thomson_state::to7_modem_init() +{ + LOG (( "to7_modem_init: MODEM not implemented!\n" )); + save_item(NAME(m_to7_modem_tx)); +} + + + +/* ------------ dispatch MODEM / speech extension ------------ */ + +READ8_MEMBER( thomson_state::to7_modem_mea8000_r ) +{ + if ( space.debugger_access() ) + { + return 0; + } + + if ( m_io_mconfig->read() & 1 ) + { + return m_mea8000->read(space, offset); + } + else + { + switch (offset) + { + case 0: + return m_acia->status_r(space, offset ); + + case 1: + return m_acia->data_r(space, offset ); + + default: + return 0; + } + } +} + + + +WRITE8_MEMBER( thomson_state::to7_modem_mea8000_w ) +{ + if ( m_io_mconfig->read() & 1 ) + { + m_mea8000->write(space, offset, data); + } + else + { + switch (offset) + { + case 0: + m_acia->control_w( space, offset, data ); + break; + + case 1: + m_acia->data_w( space, offset, data ); + break; + } + } +} + + + +/* ------------ SX 90-018 (model 2) music & game extension ------------ */ + +/* features: + - 6821 PIA + - two 8-position, 2-button game pads + - 2-button mouse (exclusive with pads) + do not confuse with the TO9-specific mouse + - 6-bit DAC sound + + extends the CM 90-112 (model 1) with one extra button per pad and a mouse +*/ + + + +#define TO7_GAME_POLL_PERIOD attotime::from_usec( 500 ) + + +/* The mouse is a very simple phase quadrature one. + Each axis provides two 1-bit signals, A and B, that are toggled by the + axis rotation. The two signals are not in phase, so that whether A is + toggled before B or B before A gives the direction of rotation. + This is similar Atari & Amiga mouses. + Returns: 0 0 0 0 0 0 YB XB YA XA + */ +UINT8 thomson_state::to7_get_mouse_signal() +{ + UINT8 xa, xb, ya, yb; + UINT16 dx = m_io_mouse_x->read(); /* x axis */ + UINT16 dy = m_io_mouse_y->read(); /* y axis */ + xa = ((dx + 1) & 3) <= 1; + xb = (dx & 3) <= 1; + ya = ((dy + 1) & 3) <= 1; + yb = (dy & 3) <= 1; + return xa | (ya << 1) | (xb << 2) | (yb << 3); +} + + + +void thomson_state::to7_game_sound_update() +{ + m_dac->write_unsigned8(m_to7_game_mute ? 0 : (m_to7_game_sound << 2) ); +} + + + +READ8_MEMBER( thomson_state::to7_game_porta_in ) +{ + UINT8 data; + if ( m_io_config->read() & 1 ) + { + /* mouse */ + data = to7_get_mouse_signal() & 0x0c; /* XB, YB */ + data |= m_io_mouse_button->read() & 3; /* buttons */ + } + else + { + /* joystick */ + data = m_io_game_port_directions->read(); + /* bit 0=0 => P1 up bit 4=0 => P2 up + bit 1=0 => P1 down bit 5=0 => P2 down + bit 2=0 => P1 left bit 6=0 => P2 left + bit 3=0 => P1 right bit 7=0 => P2 right + */ + /* remove impossible combinations: up+down, left+right */ + if ( ! ( data & 0x03 ) ) + data |= 0x03; + if ( ! ( data & 0x0c ) ) + data |= 0x0c; + if ( ! ( data & 0x30 ) ) + data |= 0x30; + if ( ! ( data & 0xc0 ) ) + data |= 0xc0; + if ( ! ( data & 0x03 ) ) + data |= 0x03; + if ( ! ( data & 0x0c ) ) + data |= 0x0c; + if ( ! ( data & 0x30 ) ) + data |= 0x30; + if ( ! ( data & 0xc0 ) ) + data |= 0xc0; + } + return data; +} + + + +READ8_MEMBER( thomson_state::to7_game_portb_in ) +{ + UINT8 data; + if ( m_io_config->read() & 1 ) + { + /* mouse */ + UINT8 mouse = to7_get_mouse_signal(); + data = 0; + if ( mouse & 1 ) + data |= 0x04; /* XA */ + if ( mouse & 2 ) + data |= 0x40; /* YA */ + } + else + { + /* joystick */ + /* bits 6-7: action buttons A (0=pressed) */ + /* bits 2-3: action buttons B (0=pressed) */ + /* bits 4-5: unused (ouput) */ + /* bits 0-1: unknown! */ + data = m_io_game_port_buttons->read(); + } + return data; +} + + + +WRITE8_MEMBER( thomson_state::to7_game_portb_out ) +{ + /* 6-bit DAC sound */ + m_to7_game_sound = data & 0x3f; + to7_game_sound_update(); +} + + + +WRITE_LINE_MEMBER( thomson_state::to7_game_cb2_out ) +{ + /* undocumented */ + /* some TO8 games (e.g.: F15) seem to write here a lot */ +} + + + +/* this should be called periodically */ +TIMER_CALLBACK_MEMBER(thomson_state::to7_game_update_cb) +{ + if ( m_io_config->read() & 1 ) + { + /* mouse */ + UINT8 mouse = to7_get_mouse_signal(); + m_pia_game->ca1_w( (mouse & 1) ? 1 : 0 ); /* XA */ + m_pia_game->ca2_w( (mouse & 2) ? 1 : 0 ); /* YA */ + } + else + { + /* joystick */ + UINT8 in = m_io_game_port_buttons->read(); + m_pia_game->cb2_w( (in & 0x80) ? 1 : 0 ); /* P2 action A */ + m_pia_game->ca2_w( (in & 0x40) ? 1 : 0 ); /* P1 action A */ + m_pia_game->cb1_w( (in & 0x08) ? 1 : 0 ); /* P2 action B */ + m_pia_game->ca1_w( (in & 0x04) ? 1 : 0 ); /* P1 action B */ + /* TODO: + it seems that CM 90-112 behaves differently + - ca1 is P1 action A, i.e., in & 0x40 + - ca2 is P2 action A, i.e., in & 0x80 + - cb1, cb2 are not connected (should not be a problem) + */ + /* Note: the MO6 & MO5NR have slightly different connections + (see mo6_game_update_cb) + */ + } +} + + + +void thomson_state::to7_game_init() +{ + LOG (( "to7_game_init called\n" )); + m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::to7_game_update_cb),this)); + m_to7_game_timer->adjust(TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD); + save_item(NAME(m_to7_game_sound)); + save_item(NAME(m_to7_game_mute)); +} + + + +void thomson_state::to7_game_reset() +{ + LOG (( "to7_game_reset called\n" )); + m_pia_game->ca1_w( 0 ); + m_to7_game_sound = 0; + m_to7_game_mute = 0; + to7_game_sound_update(); +} + + + +/* ------------ MIDI extension ------------ */ + +/* IMPORTANT NOTE: + The following is experimental and not compiled in by default. + It relies on the existence of an hypothetical "character device" API able + to transmit bytes between the MESS driver and the outside world + (using, e.g., character device special files on some UNIX). +*/ + +/* Features an EF 6850 ACIA + + MIDI protocol is a serial asynchronous protocol + Each 8-bit byte is transmitted as: + - 1 start bit + - 8 data bits + - 1 stop bits + 320 us per transmitted byte => 31250 baud + + Emulation is based on the Motorola 6850 documentation, not EF 6850. + + We do not emulate the seral line but pass bytes directly between the + 6850 registers and the MIDI device. +*/ + + +READ8_MEMBER( thomson_state::to7_midi_r ) +{ + logerror( "to7_midi_r: not implemented\n" ); + return 0; +} + + + +WRITE8_MEMBER( thomson_state::to7_midi_w ) +{ + logerror( "to7_midi_w: not implemented\n" ); +} + + + +void thomson_state::to7_midi_reset() +{ + logerror( "to7_midi_reset: not implemented\n" ); +} + + + +void thomson_state::to7_midi_init() +{ + logerror( "to7_midi_init: not implemented\n" ); +} + + + +/* ------------ init / reset ------------ */ + + + +MACHINE_RESET_MEMBER( thomson_state, to7 ) +{ + LOG (( "to7: machine reset called\n" )); + + /* subsystems */ + thom_irq_reset(); + to7_game_reset(); + to7_floppy_reset(); + to7_modem_reset(); + to7_midi_reset(); + + /* video */ + thom_set_video_mode( THOM_VMODE_TO770 ); + m_thom_init_cb = &thomson_state::to7_set_init; + m_thom_lightpen_cb = &thomson_state::to7_lightpen_cb; + thom_set_lightpen_callback( 3 ); + thom_set_mode_point( 0 ); + thom_set_border_color( 0 ); + m_pia_sys->cb1_w( 0 ); + + /* memory */ + m_old_cart_bank = -1; + to7_update_cart_bank(); + /* thom_cart_bank not reset */ + + /* lightpen */ + m_to7_lightpen = 0; +} + + + +MACHINE_START_MEMBER( thomson_state, to7 ) +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8* mem = memregion("maincpu")->base(); + UINT8* ram = m_ram->pointer(); + + LOG (( "to7: machine start called\n" )); + + /* subsystems */ + thom_irq_init(); + to7_game_init(); + to7_floppy_init(mem + 0x20000); + to7_modem_init(); + to7_midi_init(); + + /* memory */ + m_thom_cart_bank = 0; + m_thom_vram = ram; + m_basebank->configure_entry( 0, ram + 0x4000); + m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); + m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_basebank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_cartbank->set_entry( 0 ); + + space.unmap_readwrite(0x8000, 0xdfff); + + if ( m_ram->size() > 24*1024 ) + { + /* install 16 KB or 16 KB + 8 KB memory extensions */ + /* BASIC instruction to see free memory: ?FRE(0) */ + int extram = m_ram->size() - 24*1024; + space.install_write_bank(0x8000, 0x8000 + extram - 1, m_rambank); + space.install_read_bank(0x8000, 0x8000 + extram - 1, m_rambank); + m_rambank->configure_entry( 0, ram + 0x6000); + m_rambank->set_entry( 0 ); + } + + /* force 2 topmost color bits to 1 */ + memset( m_thom_vram + 0x2000, 0xc0, 0x2000 ); + + /* save-state */ + save_item(NAME(m_thom_cart_nb_banks)); + save_item(NAME(m_thom_cart_bank)); + save_item(NAME(m_to7_lightpen)); + save_item(NAME(m_to7_lightpen_step)); + save_pointer(NAME((mem + 0x10000)), 0x10000 ); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to7_update_cart_bank_postload),this)); +} + + + +/***************************** TO7/70 *************************/ + + + +/* ------------ system PIA 6821 ------------ */ + + + +WRITE_LINE_MEMBER( thomson_state::to770_sys_cb2_out ) +{ + /* video overlay: black pixels are transparent and show TV image underneath */ + LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", m_maincpu->pc(), state )); +} + + + +READ8_MEMBER( thomson_state::to770_sys_porta_in ) +{ + /* keyboard */ + int keyline = m_pia_sys->b_output() & 7; + + return m_io_keyboard[7 - keyline]->read(); +} + + + +void thomson_state::to770_update_ram_bank() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8 portb = m_pia_sys->port_b_z_mask(); + int bank; + + switch (portb & 0xf8) + { + /* 2 * 16 KB internal RAM */ + case 0xf0: bank = 0; break; + case 0xe8: bank = 1; break; + + /* 4 * 16 KB extended RAM */ + case 0x18: bank = 2; break; + case 0x98: bank = 3; break; + case 0x58: bank = 4; break; + case 0xd8: bank = 5; break; + + /* none selected */ + case 0xf8: return; + + default: + logerror( "to770_update_ram_bank unknown bank $%02X\n", portb & 0xf8 ); + return; + } + + if ( bank != m_old_ram_bank ) + { + if ( m_ram->size() == 128*1024 || bank < 2 ) + { + m_rambank->set_entry( bank ); + } + else + { + /* RAM size is 48 KB only and unavailable bank + * requested */ + space.nop_readwrite(0xa000, 0xdfff); + } + m_old_ram_bank = bank; + LOG_BANK(( "to770_update_ram_bank: RAM bank change %i\n", bank )); + } +} + + + +void thomson_state::to770_update_ram_bank_postload() +{ + to770_update_ram_bank(); +} + + + +WRITE8_MEMBER( thomson_state::to770_sys_portb_out ) +{ + to770_update_ram_bank(); +} + + + +/* ------------ 6846 (timer, I/O) ------------ */ + + + +WRITE8_MEMBER( thomson_state::to770_timer_port_out ) +{ + thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ + thom_set_caps_led( (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */ + thom_set_border_color( ((data & 0x10) ? 1 : 0) | /* 4-bit border color */ + ((data & 0x20) ? 2 : 0) | + ((data & 0x40) ? 4 : 0) | + ((data & 0x04) ? 0 : 8) ); +} + + +/* ------------ gate-array ------------ */ + + + +READ8_MEMBER( thomson_state::to770_gatearray_r ) +{ + struct thom_vsignal v = thom_get_vsignal(); + struct thom_vsignal l = thom_get_lightpen_vsignal( TO7_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 0 ); + int count, inil, init, lt3; + count = m_to7_lightpen ? l.count : v.count; + inil = m_to7_lightpen ? l.inil : v.inil; + init = m_to7_lightpen ? l.init : v.init; + lt3 = m_to7_lightpen ? l.lt3 : v.lt3; + + switch ( offset ) + { + case 0: return (count >> 8) & 0xff; + case 1: return count & 0xff; + case 2: return (lt3 << 7) | (inil << 6); + case 3: return (init << 7); + default: + logerror( "$%04x to770_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::to770_gatearray_w ) +{ + if ( ! offset ) + m_to7_lightpen = data & 1; +} + + + +/* ------------ init / reset ------------ */ + + + +MACHINE_RESET_MEMBER( thomson_state, to770 ) +{ + LOG (( "to770: machine reset called\n" )); + + /* subsystems */ + thom_irq_reset(); + to7_game_reset(); + to7_floppy_reset(); + to7_modem_reset(); + to7_midi_reset(); + + /* video */ + thom_set_video_mode( THOM_VMODE_TO770 ); + m_thom_init_cb = &thomson_state::to7_set_init; + m_thom_lightpen_cb = &thomson_state::to7_lightpen_cb; + thom_set_lightpen_callback( 3 ); + thom_set_mode_point( 0 ); + thom_set_border_color( 8 ); + m_pia_sys->cb1_w( 0 ); + + /* memory */ + m_old_ram_bank = -1; + m_old_cart_bank = -1; + to7_update_cart_bank(); + to770_update_ram_bank(); + /* thom_cart_bank not reset */ + + /* lightpen */ + m_to7_lightpen = 0; +} + + + +MACHINE_START_MEMBER( thomson_state, to770 ) +{ + UINT8* mem = memregion("maincpu")->base(); + UINT8* ram = m_ram->pointer(); + + LOG (( "to770: machine start called\n" )); + + /* subsystems */ + thom_irq_init(); + to7_game_init(); + to7_floppy_init( mem + 0x20000 ); + to7_modem_init(); + to7_midi_init(); + + /* memory */ + m_thom_cart_bank = 0; + m_thom_vram = ram; + m_basebank->configure_entry( 0, ram + 0x4000); + m_rambank->configure_entries( 0, 6, ram + 0x8000, 0x4000 ); + m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); + m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_basebank->set_entry( 0 ); + m_rambank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_cartbank->set_entry( 0 ); + + /* save-state */ + save_item(NAME(m_thom_cart_nb_banks)); + save_item(NAME(m_thom_cart_bank)); + save_item(NAME(m_to7_lightpen)); + save_item(NAME(m_to7_lightpen_step)); + save_pointer(NAME(mem + 0x10000), 0x10000 ); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to770_update_ram_bank_postload), this)); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to7_update_cart_bank_postload), this)); +} + + + +/***************************** MO5 *************************/ + + + +/* ------------ lightpen automaton ------------ */ + + + +void thomson_state::mo5_lightpen_cb( int step ) +{ + /* MO5 signals ca1 (TO7 signals cb1) */ + if ( ! m_to7_lightpen ) + return; + + m_pia_sys->ca1_w( 1 ); + m_pia_sys->ca1_w( 0 ); + m_to7_lightpen_step = step; +} + + +/* ------------ periodic interrupt ------------ */ + +/* the MO5 & MO6 do not have a MC 6846 timer, + they have a fixed 50 Hz timer instead +*/ + + +TIMER_CALLBACK_MEMBER(thomson_state::mo5_periodic_cb) +{ + /* pulse */ + m_pia_sys->cb1_w( 1 ); + m_pia_sys->cb1_w( 0 ); +} + + + +void thomson_state::mo5_init_timer() +{ + /* time is a little faster than 50 Hz to match video framerate */ + m_mo5_periodic_timer->adjust(attotime::zero, 0, attotime::from_usec( 19968 )); +} + + + +/* ------------ system PIA 6821 ------------ */ + + + +WRITE8_MEMBER( thomson_state::mo5_sys_porta_out ) +{ + thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ + thom_set_border_color( (data >> 1) & 15 ); /* bit 1-4: border color */ + mo5_set_cassette( (data & 0x40) ? 1 : 0 ); /* bit 6: cassette output */ +} + + + +READ8_MEMBER( thomson_state::mo5_sys_porta_in ) +{ + return + (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ + ((m_io_lightpen_button->read() & 1) ? 0x20 : 0) + /* bit 5: lightpen button */; +} + + + +WRITE8_MEMBER( thomson_state::mo5_sys_portb_out ) +{ + m_buzzer->write_unsigned8((data & 1) ? 0x80 : 0); /* 1-bit buzzer */ +} + + + +READ8_MEMBER( thomson_state::mo5_sys_portb_in ) +{ + UINT8 portb = m_pia_sys->b_output(); + int col = (portb >> 1) & 7; /* key column */ + int lin = 7 - ((portb >> 4) & 7); /* key line */ + + return ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; +} + + + +/* ------------ gate-array ------------ */ + + + +#define MO5_LIGHTPEN_DECAL 12 + + + +READ8_MEMBER( thomson_state::mo5_gatearray_r ) +{ + struct thom_vsignal v = thom_get_vsignal(); + struct thom_vsignal l = thom_get_lightpen_vsignal( MO5_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 0 ); + int count, inil, init, lt3; + count = m_to7_lightpen ? l.count : v.count; + inil = m_to7_lightpen ? l.inil : v.inil; + init = m_to7_lightpen ? l.init : v.init; + lt3 = m_to7_lightpen ? l.lt3 : v.lt3; + + switch ( offset ) { + case 0: return (count >> 8) & 0xff; + case 1: return count & 0xff; + case 2: return (lt3 << 7) | (inil << 6); + case 3: return (init << 7); + default: + logerror( "$%04x mo5_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::mo5_gatearray_w ) +{ + if ( ! offset ) + m_to7_lightpen = data & 1; +} + + + +/* ------------ cartridge / extended RAM ------------ */ + + + +DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge ) +{ + UINT8* pos = memregion("maincpu")->base() + 0x10000; + UINT64 size, i; + int j; + char name[129]; + + if (image.software_entry() == NULL) + size = image.length(); + else + size = image.get_software_region_length("rom"); + + /* get size & number of 16-KB banks */ + if ( size > 32 && size <= 0x04000 ) + m_thom_cart_nb_banks = 1; + else if ( size == 0x08000 ) + m_thom_cart_nb_banks = 2; + else if ( size == 0x10000 ) + m_thom_cart_nb_banks = 4; + else + { + std::string errmsg; + strprintf(errmsg,"Invalid cartridge size %d", (int)size); + image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); + return IMAGE_INIT_FAIL; + } + + if (image.software_entry() == NULL) + { + if ( image.fread(pos, size ) != size ) + { + image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Read error"); + return IMAGE_INIT_FAIL; + } + } + else + { + memcpy(pos, image.get_software_region("rom"), size); + } + + /* extract name */ + i = size - 32; + while ( i < size && !pos[i] ) i++; + for ( j = 0; i < size && pos[i] >= 0x20; j++, i++) + name[j] = pos[i]; + name[j] = 0; + + /* sanitize name */ + for ( j = 0; name[j]; j++) + { + if ( name[j] < ' ' || name[j] >= 127 ) name[j] = '?'; + } + + PRINT (( "mo5_cartridge_load: cartridge \"%s\" banks=%i, size=%u\n", name, m_thom_cart_nb_banks, (unsigned) size )); + + return IMAGE_INIT_PASS; +} + + + +void thomson_state::mo5_update_cart_bank() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + int rom_is_ram = m_mo5_reg_cart & 4; + int bank = 0; + int bank_is_read_only = 0; + + + if ( rom_is_ram && m_thom_cart_nb_banks == 4 ) + { + /* 64 KB ROM from "JANE" cartridge */ + bank = m_mo5_reg_cart & 3; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) + { + space.install_read_bank( 0xb000, 0xefff, m_cartbank); + space.nop_write( 0xb000, 0xefff); + } + LOG_BANK(( "mo5_update_cart_bank: CART is cartridge bank %i (A7CB style)\n", bank )); + } + } + else if ( rom_is_ram ) + { + /* 64 KB RAM from network extension */ + bank = 4 + ( m_mo5_reg_cart & 3 ); + bank_is_read_only = (( m_mo5_reg_cart & 8 ) == 0); + + if ( bank != m_old_cart_bank || bank_is_read_only != m_old_cart_bank_was_read_only) + { + if ( bank_is_read_only ) + { + space.install_read_bank( 0xb000, 0xefff, m_cartbank); + space.nop_write( 0xb000, 0xefff ); + } + else + { + space.install_readwrite_bank( 0xb000, 0xefff, m_cartbank); + } + LOG_BANK(( "mo5_update_cart_bank: CART is nanonetwork RAM bank %i (%s)\n", + m_mo5_reg_cart & 3, + bank_is_read_only ? "read-only":"read-write")); + m_old_cart_bank_was_read_only = bank_is_read_only; + } + } + else + { + /* regular cartridge bank switch */ + if ( m_thom_cart_nb_banks ) + { + bank = m_thom_cart_bank % m_thom_cart_nb_banks; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 0 ) + { + space.install_read_bank( 0xb000, 0xefff, m_cartbank); + space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo5_cartridge_w),this) ); + space.install_read_handler( 0xbffc, 0xbfff, read8_delegate(FUNC(thomson_state::mo5_cartridge_r),this) ); + } + LOG_BANK(( "mo5_update_cart_bank: CART is cartridge bank %i\n", bank )); + } + } + else + { + /* internal ROM */ + if ( m_old_cart_bank != 0 ) + { + space.install_read_bank( 0xb000, 0xefff, m_cartbank); + space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo5_cartridge_w),this) ); + LOG_BANK(( "mo5_update_cart_bank: CART is internal\n")); + } + } + } + if ( bank != m_old_cart_bank ) + { + m_cartbank->set_entry( bank ); + m_old_cart_bank = bank; + } +} + + + +void thomson_state::mo5_update_cart_bank_postload() +{ + mo5_update_cart_bank(); +} + + + +/* write signal to b000-cfff generates a bank switch */ +WRITE8_MEMBER( thomson_state::mo5_cartridge_w ) +{ + if ( offset >= 0x2000 ) + return; + + m_thom_cart_bank = offset & 3; + mo5_update_cart_bank(); +} + + + +/* read signal to bffc-bfff generates a bank switch */ +READ8_MEMBER( thomson_state::mo5_cartridge_r ) +{ + UINT8* pos = memregion( "maincpu" )->base() + 0x10000; + UINT8 data = pos[offset + 0xbffc + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + if ( !space.debugger_access() ) + { + m_thom_cart_bank = offset & 3; + mo5_update_cart_bank(); + } + return data; +} + + + +/* 0xa7cb bank-switch register */ +WRITE8_MEMBER( thomson_state::mo5_ext_w ) +{ + m_mo5_reg_cart = data; + mo5_update_cart_bank(); +} + + + +/* ------------ init / reset ------------ */ + + + +MACHINE_RESET_MEMBER( thomson_state, mo5 ) +{ + LOG (( "mo5: machine reset called\n" )); + + /* subsystems */ + thom_irq_reset(); + m_pia_sys->set_port_a_z_mask(0x5f ); + to7_game_reset(); + to7_floppy_reset(); + to7_modem_reset(); + to7_midi_reset(); + mo5_init_timer(); + + /* video */ + thom_set_video_mode( THOM_VMODE_MO5 ); + m_thom_lightpen_cb = &thomson_state::mo5_lightpen_cb; + thom_set_lightpen_callback( 3 ); + thom_set_mode_point( 0 ); + thom_set_border_color( 0 ); + m_pia_sys->ca1_w( 0 ); + + /* memory */ + m_old_cart_bank = -1; + mo5_update_cart_bank(); + /* mo5_reg_cart not reset */ + /* thom_cart_bank not reset */ + + /* lightpen */ + m_to7_lightpen = 0; +} + + + +MACHINE_START_MEMBER( thomson_state, mo5 ) +{ + UINT8* mem = memregion("maincpu")->base(); + UINT8* ram = m_ram->pointer(); + + LOG (( "mo5: machine start called\n" )); + + /* subsystems */ + thom_irq_init(); + to7_game_init(); + to7_floppy_init( mem + 0x20000 ); + to7_modem_init(); + to7_midi_init(); + m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo5_periodic_cb),this)); + + /* memory */ + m_thom_cart_bank = 0; + m_mo5_reg_cart = 0; + m_thom_vram = ram; + m_basebank->configure_entry( 0, ram + 0x4000); + m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 4, 4, ram + 0xc000, 0x4000 ); + m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); + m_basebank->set_entry( 0 ); + m_cartbank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + + /* save-state */ + save_item(NAME(m_thom_cart_nb_banks)); + save_item(NAME(m_thom_cart_bank)); + save_item(NAME(m_to7_lightpen)); + save_item(NAME(m_to7_lightpen_step)); + save_item(NAME(m_mo5_reg_cart)); + save_pointer(NAME(mem + 0x10000), 0x10000 ); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo5_update_cart_bank_postload), this)); +} + + + +/***************************** TO9 *************************/ + + + +/* ------------ IEEE extension ------------ */ + + + +/* TODO: figure out what this extension is... IEEE-488 ??? */ + + + +WRITE8_MEMBER( thomson_state::to9_ieee_w ) +{ + logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", m_maincpu->pc(), machine().time().as_double(), data, offset ); +} + + + +READ8_MEMBER( thomson_state::to9_ieee_r ) +{ + logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", m_maincpu->pc(), machine().time().as_double(), offset ); + return 0; +} + + + +/* ------------ system gate-array ------------ */ + + + +#define TO9_LIGHTPEN_DECAL 8 + + + +READ8_MEMBER( thomson_state::to9_gatearray_r ) +{ + struct thom_vsignal v = thom_get_vsignal(); + struct thom_vsignal l = thom_get_lightpen_vsignal( TO9_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 0 ); + int count, inil, init, lt3; + count = m_to7_lightpen ? l.count : v.count; + inil = m_to7_lightpen ? l.inil : v.inil; + init = m_to7_lightpen ? l.init : v.init; + lt3 = m_to7_lightpen ? l.lt3 : v.lt3; + + switch ( offset ) + { + case 0: return (count >> 8) & 0xff; + case 1: return count & 0xff; + case 2: return (lt3 << 7) | (inil << 6); + case 3: return (v.init << 7) | (init << 6); /* != TO7/70 */ + default: + logerror( "$%04x to9_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::to9_gatearray_w ) +{ + if ( ! offset ) + m_to7_lightpen = data & 1; +} + + + +/* ------------ video gate-array ------------ */ + + + +/* style: 0 => TO9, 1 => TO8/TO9, 2 => MO6 */ +void thomson_state::to9_set_video_mode( UINT8 data, int style ) +{ + switch ( data & 0x7f ) + { + case 0x00: + if ( style == 2 ) + thom_set_video_mode( THOM_VMODE_MO5 ); + else if ( style == 1 ) + thom_set_video_mode( THOM_VMODE_TO770 ); + else + thom_set_video_mode( THOM_VMODE_TO9 ); + break; + + // undocumented, but tested on a real TO8D + case 0x20: thom_set_video_mode( THOM_VMODE_MO5_ALT ); break; + + case 0x21: thom_set_video_mode( THOM_VMODE_BITMAP4 ); break; + + case 0x41: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT ); break; + + // also undocumented but tested + case 0x59: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT_HALF ); break; + + case 0x2a: + if ( style==0 ) + thom_set_video_mode( THOM_VMODE_80_TO9 ); + else + thom_set_video_mode( THOM_VMODE_80 ); + break; + + case 0x7b: thom_set_video_mode( THOM_VMODE_BITMAP16 ); break; + + case 0x24: thom_set_video_mode( THOM_VMODE_PAGE1 ); break; + + case 0x25: thom_set_video_mode( THOM_VMODE_PAGE2 ); break; + + case 0x26: thom_set_video_mode( THOM_VMODE_OVERLAY ); break; + + // undocumented 160x200 variant of overlay + case 0x3e: thom_set_video_mode( THOM_VMODE_OVERLAY_HALF ); break; + + case 0x3f: thom_set_video_mode( THOM_VMODE_OVERLAY3 ); break; + + default: + logerror( "to9_set_video_mode: unknown mode $%02X tr=%i phi=%i mod=%i\n", data, (data >> 5) & 3, (data >> 3) & 2, data & 7 ); + } +} + + + +READ8_MEMBER( thomson_state::to9_vreg_r ) +{ + switch ( offset ) + { + case 0: /* palette data */ + { + UINT8 c = m_to9_palette_data[ m_to9_palette_idx ]; + if ( !space.debugger_access() ) + { + m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; + } + return c; + } + + case 1: /* palette address */ + return m_to9_palette_idx; + + case 2: + case 3: + return 0; + + default: + logerror( "to9_vreg_r: invalid read offset %i\n", offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::to9_vreg_w ) +{ + LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", m_maincpu->pc(), machine().time().as_double(), offset, 0xe7da + offset, data )); + + switch ( offset ) + { + case 0: /* palette data */ + { + UINT16 color, idx; + m_to9_palette_data[ m_to9_palette_idx ] = data; + idx = m_to9_palette_idx / 2; + color = m_to9_palette_data[ 2 * idx + 1 ]; + color = m_to9_palette_data[ 2 * idx ] | (color << 8); + thom_set_palette( idx ^ 8, color & 0x1fff ); + m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; + } + break; + + case 1: /* palette address */ + m_to9_palette_idx = data & 31; + break; + + case 2: /* video mode */ + to9_set_video_mode( data, 0 ); + break; + + case 3: /* border color */ + thom_set_border_color( data & 15 ); + break; + + default: + logerror( "to9_vreg_w: invalid write offset %i data=$%02X\n", offset, data ); + } +} + + + +void thomson_state::to9_palette_init() +{ + m_to9_palette_idx = 0; + memset( m_to9_palette_data, 0, sizeof( m_to9_palette_data ) ); + save_item(NAME(m_to9_palette_idx)); + save_item(NAME(m_to9_palette_data)); +} + + + +/* ------------ RAM / ROM banking ------------ */ + + +void thomson_state::to9_update_cart_bank() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + int bank = 0; + int slot = ( m_mc6846->get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */ + + switch ( slot ) + { + case 0: + /* BASIC (64 KB) */ + bank = 4 + m_to9_soft_bank; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 4) + { + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); + } + LOG_BANK(( "to9_update_cart_bank: CART is BASIC bank %i\n", m_to9_soft_bank )); + } + break; + case 1: + /* software 1 (32 KB) */ + bank = 8 + (m_to9_soft_bank & 1); + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 4) + { + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); + } + LOG_BANK(( "to9_update_cart_bank: CART is software 1 bank %i\n", m_to9_soft_bank )); + } + break; + case 2: + /* software 2 (32 KB) */ + bank = 10 + (m_to9_soft_bank & 1); + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 4) + { + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); + } + LOG_BANK(( "to9_update_cart_bank: CART is software 2 bank %i\n", m_to9_soft_bank )); + } + break; + case 3: + /* external cartridge */ + if ( m_thom_cart_nb_banks ) + { + bank = m_thom_cart_bank % m_thom_cart_nb_banks; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) + { + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); + space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to9_cartridge_w),this) ); + space.install_read_handler( 0x0000, 0x0003, read8_delegate(FUNC(thomson_state::to9_cartridge_r),this) ); + } + LOG_BANK(( "to9_update_cart_bank: CART is cartridge bank %i\n", m_thom_cart_bank )); + } + } + else + { + if ( m_old_cart_bank != 0 ) + { + space.nop_read( 0x0000, 0x3fff); + LOG_BANK(( "to9_update_cart_bank: CART is unmapped\n")); + } + } + break; + } + if ( bank != m_old_cart_bank ) + { + m_cartbank->set_entry( bank ); + m_old_cart_bank = bank; + } +} + + + +void thomson_state::to9_update_cart_bank_postload() +{ + to9_update_cart_bank(); +} + + + +/* write signal to 0000-1fff generates a bank switch */ +WRITE8_MEMBER( thomson_state::to9_cartridge_w ) +{ + int slot = ( m_mc6846->get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */ + + if ( offset >= 0x2000 ) + return; + + if ( slot == 3 ) + m_thom_cart_bank = offset & 3; + else + m_to9_soft_bank = offset & 3; + to9_update_cart_bank(); +} + + + +/* read signal to 0000-0003 generates a bank switch */ +READ8_MEMBER( thomson_state::to9_cartridge_r ) +{ + UINT8* pos = memregion( "maincpu" )->base() + 0x10000; + UINT8 data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + if ( !space.debugger_access() ) + { + m_thom_cart_bank = offset & 3; + to9_update_cart_bank(); + } + return data; +} + + + +void thomson_state::to9_update_ram_bank() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8 port = m_mc6846->get_output_port(); + UINT8 portb = m_pia_sys->port_b_z_mask(); + UINT8 disk = ((port >> 2) & 1) | ((port >> 5) & 2); /* bits 6,2: RAM bank */ + int bank; + + switch ( portb & 0xf8 ) + { + /* TO7/70 compatible */ + case 0xf0: bank = 0; break; + case 0xe8: bank = 1; break; + case 0x18: bank = 2; break; + case 0x98: bank = 3; break; + case 0x58: bank = 4; break; + case 0xd8: bank = 5; break; + + /* 64 KB of virtual disk */ + case 0xf8: bank = 6 + disk ; break; + + /* none selected */ + case 0: return; + + default: + logerror( "to9_update_ram_bank: unknown RAM bank pia=$%02X disk=%i\n", portb & 0xf8, disk ); + return; + } + + if ( m_old_ram_bank != bank ) + { + if ( m_ram->size() == 192*1024 || bank < 6 ) + { + m_rambank->set_entry( bank ); + } + else + { + space.nop_readwrite( 0xa000, 0xdfff); + } + m_old_ram_bank = bank; + LOG_BANK(( "to9_update_ram_bank: bank %i selected (pia=$%02X disk=%i)\n", bank, portb & 0xf8, disk )); + } +} + + + +void thomson_state::to9_update_ram_bank_postload() +{ + to9_update_ram_bank(); +} + + + +/* ------------ keyboard (6850 ACIA + 6805 CPU) ------------ */ + +/* The 6805 chip scans the keyboard and sends ASCII codes to the 6909. + Data between the 6809 and 6805 is serialized at 9600 bauds. + On the 6809 side, a 6850 ACIA is used. + We do not emulate the seral line but pass bytes directly between the + keyboard and the 6850 registers. + Note that the keyboard protocol uses the parity bit as an extra data bit. +*/ + + + +/* normal mode: polling interval */ +#define TO9_KBD_POLL_PERIOD attotime::from_msec( 10 ) + +/* peripherial mode: time between two bytes, and after last byte */ +#define TO9_KBD_BYTE_SPACE attotime::from_usec( 300 ) +#define TO9_KBD_END_SPACE attotime::from_usec( 9100 ) + +/* first and subsequent repeat periods, in TO9_KBD_POLL_PERIOD units */ +#define TO9_KBD_REPEAT_DELAY 80 /* 800 ms */ +#define TO9_KBD_REPEAT_PERIOD 7 /* 70 ms */ + + + +/* quick keyboard scan */ +int thomson_state::to9_kbd_ktest() +{ + int line, bit; + UINT8 port; + + for ( line = 0; line < 10; line++ ) + { + port = m_io_keyboard[line]->read(); + + if ( line == 7 || line == 9 ) + port |= 1; /* shift & control */ + + for ( bit = 0; bit < 8; bit++ ) + { + if ( ! (port & (1 << bit)) ) + return 1; + } + } + return 0; +} + + + +void thomson_state::to9_kbd_update_irq() +{ + if ( (m_to9_kbd_intr & 4) && (m_to9_kbd_status & ACIA_6850_RDRF) ) + m_to9_kbd_status |= ACIA_6850_irq; /* byte received interrupt */ + + if ( (m_to9_kbd_intr & 4) && (m_to9_kbd_status & ACIA_6850_OVRN) ) + m_to9_kbd_status |= ACIA_6850_irq; /* overrun interrupt */ + + if ( (m_to9_kbd_intr & 3) == 1 && (m_to9_kbd_status & ACIA_6850_TDRE) ) + m_to9_kbd_status |= ACIA_6850_irq; /* ready to transmit interrupt */ + + thom_irq_3( m_to9_kbd_status & ACIA_6850_irq ); +} + + + +READ8_MEMBER( thomson_state::to9_kbd_r ) +{ + /* ACIA 6850 registers */ + + switch ( offset ) + { + case 0: /* get status */ + /* bit 0: data received */ + /* bit 1: ready to transmit data (always 1) */ + /* bit 2: data carrier detect (ignored) */ + /* bit 3: clear to send (ignored) */ + /* bit 4: framing error (ignored) */ + /* bit 5: overrun */ + /* bit 6: parity error */ + /* bit 7: interrupt */ + + LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n", + m_maincpu->pc(), machine().time().as_double(), m_to9_kbd_status, + (m_to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0, + (m_to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0, + (m_to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0, + (m_to9_kbd_status & ACIA_6850_PE) ? 1 : 0, + (m_to9_kbd_status & ACIA_6850_irq) ? 1 : 0 )); + return m_to9_kbd_status; + + case 1: /* get input data */ + if ( !space.debugger_access() ) + { + m_to9_kbd_status &= ~(ACIA_6850_irq | ACIA_6850_PE); + if ( m_to9_kbd_overrun ) + m_to9_kbd_status |= ACIA_6850_OVRN; + else + m_to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF); + m_to9_kbd_overrun = 0; + LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", m_maincpu->pc(), machine().time().as_double(), m_to9_kbd_in )); + to9_kbd_update_irq(); + } + return m_to9_kbd_in; + + default: + logerror( "$%04x to9_kbd_r: invalid offset %i\n", m_maincpu->pc(), offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::to9_kbd_w ) +{ + /* ACIA 6850 registers */ + + switch ( offset ) + { + case 0: /* set control */ + /* bits 0-1: clock divide (ignored) or reset */ + if ( (data & 3) == 3 ) + { + /* reset */ + m_to9_kbd_overrun = 0; + m_to9_kbd_status = ACIA_6850_TDRE; + m_to9_kbd_intr = 0; + LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", m_maincpu->pc(), machine().time().as_double(), data )); + } + else + { + /* bits 2-4: parity */ + if ( (data & 0x18) == 0x10 ) + m_to9_kbd_parity = 2; + else + m_to9_kbd_parity = (data >> 2) & 1; + /* bits 5-6: interrupt on transmit */ + /* bit 7: interrupt on receive */ + m_to9_kbd_intr = data >> 5; + + LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n", + m_maincpu->pc(), machine().time().as_double(), + data, m_to9_kbd_parity, m_to9_kbd_intr >> 2, + (m_to9_kbd_intr & 3) ? 1 : 0 )); + } + to9_kbd_update_irq(); + break; + + case 1: /* output data */ + m_to9_kbd_status &= ~(ACIA_6850_irq | ACIA_6850_TDRE); + to9_kbd_update_irq(); + /* TODO: 1 ms delay here ? */ + m_to9_kbd_status |= ACIA_6850_TDRE; /* data transmit ready again */ + to9_kbd_update_irq(); + + switch ( data ) + { + case 0xF8: + /* reset */ + m_to9_kbd_caps = 1; + m_to9_kbd_periph = 0; + m_to9_kbd_pad = 0; + break; + + case 0xF9: m_to9_kbd_caps = 1; break; + case 0xFA: m_to9_kbd_caps = 0; break; + case 0xFB: m_to9_kbd_pad = 1; break; + case 0xFC: m_to9_kbd_pad = 0; break; + case 0xFD: m_to9_kbd_periph = 1; break; + case 0xFE: m_to9_kbd_periph = 0; break; + + default: + logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", m_maincpu->pc(), machine().time().as_double(), data ); + } + + thom_set_caps_led( !m_to9_kbd_caps ); + + LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n", + m_maincpu->pc(), machine().time().as_double(), data, + m_to9_kbd_caps, m_to9_kbd_pad, m_to9_kbd_periph )); + + break; + + default: + logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", m_maincpu->pc(), offset, data ); + } +} + + + +/* send a key to the CPU, 8-bit + parity bit (0=even, 1=odd) + note: parity is not used as a checksum but to actually transmit a 9-th bit + of information! +*/ +void thomson_state::to9_kbd_send( UINT8 data, int parity ) +{ + if ( m_to9_kbd_status & ACIA_6850_RDRF ) + { + /* overrun will be set when the current valid byte is read */ + m_to9_kbd_overrun = 1; + LOG_KBD(( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", machine().time().as_double(), data, parity )); + } + else + { + /* valid byte */ + m_to9_kbd_in = data; + m_to9_kbd_status |= ACIA_6850_RDRF; /* raise data received flag */ + if ( m_to9_kbd_parity == 2 || m_to9_kbd_parity == parity ) + m_to9_kbd_status &= ~ACIA_6850_PE; /* parity OK */ + else + m_to9_kbd_status |= ACIA_6850_PE; /* parity error */ + LOG_KBD(( "%f to9_kbd_send: data=$%02X, parity=%i, status=$%02X\n", machine().time().as_double(), data, parity, m_to9_kbd_status )); + } + to9_kbd_update_irq(); +} + + + +/* keycode => TO9 code (extended ASCII), shifted and un-shifted */ +static const int to9_kbd_code[80][2] = +{ + { 145, 150 }, { '_', '6' }, { 'Y', 'Y' }, { 'H', 'H' }, + { 11, 11 }, { 9, 9 }, { 30, 12 }, { 'N', 'N' }, + + { 146, 151 }, { '(', '5' }, { 'T', 'T' }, { 'G', 'G' }, + { '=', '+' }, { 8, 8 }, { 28, 28 }, { 'B', 'B' }, + + { 147, 152 }, { '\'', '4' }, { 'R', 'R' }, { 'F', 'F' }, + { 22, 22 }, { 155, 155 }, { 29, 127 }, { 'V', 'V' }, + + { 148, 153 }, { '"', '3' }, { 'E', 'E' }, { 'D', 'D' }, + { 161, 161 }, { 158, 158 }, + { 154, 154 }, { 'C', 'C' }, + + { 144, 149 }, { 128, '2' }, { 'Z', 'Z' }, { 'S', 'S' }, + { 162, 162 }, { 156, 156 }, + { 164, 164 }, { 'X', 'X' }, + + { '#', '@' }, { '*', '1' }, { 'A', 'A' }, { 'Q', 'Q' }, + { '[', '{' }, { 159, 159 }, { 160, 160 }, { 'W', 'W' }, + + { 2, 2 }, { 129, '7' }, { 'U', 'U' }, { 'J', 'J' }, + { ' ', ' ' }, { 163, 163 }, { 165, 165 }, + { ',', '?' }, + + { 0, 0 }, { '!', '8' }, { 'I', 'I' }, { 'K', 'K' }, + { '$', '&' }, { 10, 10 }, { ']', '}' }, { ';', '.' }, + + { 0, 0 }, { 130, '9' }, { 'O', 'O' }, { 'L', 'L' }, + { '-', '\\' }, { 132, '%' }, { 13, 13 }, { ':', '/' }, + + { 0, 0 }, { 131, '0' }, { 'P', 'P' }, { 'M', 'M' }, + { ')', 134 }, { '^', 133 }, { 157, 157 }, { '>', '<' } +}; + + + +/* returns the ASCII code for the key, or 0 for no key */ +int thomson_state::to9_kbd_get_key() +{ + int control = ! (m_io_keyboard[7]->read() & 1); + int shift = ! (m_io_keyboard[9]->read() & 1); + int key = -1, line, bit; + UINT8 port; + + for ( line = 0; line < 10; line++ ) + { + port = m_io_keyboard[line]->read(); + + if ( line == 7 || line == 9 ) + port |= 1; /* shift & control */ + + /* TODO: correct handling of simultaneous keystokes: + return the new key preferably & disable repeat + */ + for ( bit = 0; bit < 8; bit++ ) + { + if ( ! (port & (1 << bit)) ) + key = line * 8 + bit; + } + } + + if ( key == -1 ) + { + m_to9_kbd_last_key = 0xff; + m_to9_kbd_key_count = 0; + return 0; + } + else if ( key == 64 ) + { + /* caps lock */ + if ( m_to9_kbd_last_key == key ) + return 0; /* no repeat */ + + m_to9_kbd_last_key = key; + m_to9_kbd_caps = !m_to9_kbd_caps; + thom_set_caps_led( !m_to9_kbd_caps ); + return 0; + } + else + { + int asc; + asc = to9_kbd_code[key][shift]; + if ( ! asc ) return 0; + + /* keypad */ + if ( ! m_to9_kbd_pad ) { + if ( asc >= 154 && asc <= 163 ) + asc += '0' - 154; + else if ( asc == 164 ) + asc = '.'; + else if ( asc == 165 ) + asc = 13; + } + + /* shifted letter */ + if ( asc >= 'A' && asc <= 'Z' && ( ! m_to9_kbd_caps ) && ( ! shift ) ) + asc += 'a' - 'A'; + + /* control */ + if ( control ) + asc &= ~0x40; + + if ( key == m_to9_kbd_last_key ) + { + /* repeat */ + m_to9_kbd_key_count++; + if ( m_to9_kbd_key_count < TO9_KBD_REPEAT_DELAY || (m_to9_kbd_key_count - TO9_KBD_REPEAT_DELAY) % TO9_KBD_REPEAT_PERIOD ) + return 0; + LOG_KBD(( "to9_kbd_get_key: repeat key $%02X '%c'\n", asc, asc )); + return asc; + } + else + { + m_to9_kbd_last_key = key; + m_to9_kbd_key_count = 0; + LOG_KBD(( "to9_kbd_get_key: key down $%02X '%c'\n", asc, asc )); + return asc; + } + } +} + + + +TIMER_CALLBACK_MEMBER(thomson_state::to9_kbd_timer_cb) +{ + if ( m_to9_kbd_periph ) + { + /* peripherial mode: every 10 ms we send 4 bytes */ + + switch ( m_to9_kbd_byte_count ) + { + case 0: /* key */ + to9_kbd_send( to9_kbd_get_key(), 0 ); + break; + + case 1: /* x axis */ + { + int newx = m_io_mouse_x->read(); + UINT8 data = ( (newx - m_to9_mouse_x) & 0xf ) - 8; + to9_kbd_send( data, 1 ); + m_to9_mouse_x = newx; + break; + } + + case 2: /* y axis */ + { + int newy = m_io_mouse_y->read(); + UINT8 data = ( (newy - m_to9_mouse_y) & 0xf ) - 8; + to9_kbd_send( data, 1 ); + m_to9_mouse_y = newy; + break; + } + + case 3: /* axis overflow & buttons */ + { + int b = m_io_mouse_button->read(); + UINT8 data = 0; + if ( b & 1 ) data |= 1; + if ( b & 2 ) data |= 4; + to9_kbd_send( data, 1 ); + break; + } + + } + + m_to9_kbd_byte_count = ( m_to9_kbd_byte_count + 1 ) & 3; + m_to9_kbd_timer->adjust(m_to9_kbd_byte_count ? TO9_KBD_BYTE_SPACE : TO9_KBD_END_SPACE); + } + else + { + int key = to9_kbd_get_key(); + /* keyboard mode: send a byte only if a key is down */ + if ( key ) + to9_kbd_send( key, 0 ); + m_to9_kbd_timer->adjust(TO9_KBD_POLL_PERIOD); + } +} + + + +void thomson_state::to9_kbd_reset() +{ + LOG(( "to9_kbd_reset called\n" )); + m_to9_kbd_overrun = 0; /* no byte lost */ + m_to9_kbd_status = ACIA_6850_TDRE; /* clear to transmit */ + m_to9_kbd_intr = 0; /* interrupt disabled */ + m_to9_kbd_caps = 1; + m_to9_kbd_periph = 0; + m_to9_kbd_pad = 0; + m_to9_kbd_byte_count = 0; + thom_set_caps_led( !m_to9_kbd_caps ); + m_to9_kbd_key_count = 0; + m_to9_kbd_last_key = 0xff; + to9_kbd_update_irq(); + m_to9_kbd_timer->adjust(TO9_KBD_POLL_PERIOD); +} + + + +void thomson_state::to9_kbd_init() +{ + LOG(( "to9_kbd_init called\n" )); + m_to9_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::to9_kbd_timer_cb),this)); + save_item(NAME(m_to9_kbd_parity)); + save_item(NAME(m_to9_kbd_intr)); + save_item(NAME(m_to9_kbd_in)); + save_item(NAME(m_to9_kbd_status)); + save_item(NAME(m_to9_kbd_overrun)); + save_item(NAME(m_to9_kbd_last_key)); + save_item(NAME(m_to9_kbd_key_count)); + save_item(NAME(m_to9_kbd_caps)); + save_item(NAME(m_to9_kbd_periph)); + save_item(NAME(m_to9_kbd_pad)); + save_item(NAME(m_to9_kbd_byte_count)); + save_item(NAME(m_to9_mouse_x)); + save_item(NAME(m_to9_mouse_y)); +} + + +/* ------------ system PIA 6821 ------------ */ + +/* afaik, P2-P7 are not connected, so, the warning about undefined 0xf0 can be safely ignored */ + + +READ8_MEMBER( thomson_state::to9_sys_porta_in ) +{ + UINT8 ktest = to9_kbd_ktest(); + + LOG_KBD(( "to9_sys_porta_in: ktest=%i\n", ktest )); + + return ktest; +} + + + +WRITE8_MEMBER( thomson_state::to9_sys_porta_out ) +{ + m_centronics->write_data1(BIT(data, 1)); + m_centronics->write_data2(BIT(data, 2)); + m_centronics->write_data3(BIT(data, 3)); + m_centronics->write_data4(BIT(data, 4)); + m_centronics->write_data5(BIT(data, 5)); + m_centronics->write_data6(BIT(data, 6)); + m_centronics->write_data7(BIT(data, 7)); +} + + + +WRITE8_MEMBER( thomson_state::to9_sys_portb_out ) +{ + m_centronics->write_data0(BIT(data, 0)); + m_centronics->write_strobe(BIT(data, 1)); + + to9_update_ram_bank(); + + if ( data & 4 ) /* bit 2: video overlay (TODO) */ + LOG(( "to9_sys_portb_out: video overlay not handled\n" )); +} + + + +/* ------------ 6846 (timer, I/O) ------------ */ + + + +WRITE8_MEMBER( thomson_state::to9_timer_port_out ) +{ + thom_set_mode_point( data & 1 ); /* bit 0: video bank */ + to9_update_ram_bank(); + to9_update_cart_bank(); +} + + +/* ------------ init / reset ------------ */ + + + +MACHINE_RESET_MEMBER( thomson_state, to9 ) +{ + LOG (( "to9: machine reset called\n" )); + + /* subsystems */ + thom_irq_reset(); + m_pia_sys->set_port_a_z_mask( 0xfe ); + to7_game_reset(); + to9_floppy_reset(); + to9_kbd_reset(); + to7_modem_reset(); + to7_midi_reset(); + + /* video */ + thom_set_video_mode( THOM_VMODE_TO9 ); + m_thom_lightpen_cb = &thomson_state::to7_lightpen_cb; + thom_set_lightpen_callback( 3 ); + thom_set_border_color( 8 ); + thom_set_mode_point( 0 ); + m_pia_sys->cb1_w( 0 ); + + /* memory */ + m_old_ram_bank = -1; + m_old_cart_bank = -1; + m_to9_soft_bank = 0; + to9_update_cart_bank(); + to9_update_ram_bank(); + /* thom_cart_bank not reset */ + + /* lightpen */ + m_to7_lightpen = 0; +} + + + +MACHINE_START_MEMBER( thomson_state, to9 ) +{ + UINT8* mem = memregion("maincpu")->base(); + UINT8* ram = m_ram->pointer(); + + LOG (( "to9: machine start called\n" )); + + /* subsystems */ + thom_irq_init(); + to7_game_init(); + to9_floppy_init( mem + 0xe000, mem + 0x40000 ); + to9_kbd_init(); + to9_palette_init(); + to7_modem_init(); + to7_midi_init(); + + /* memory */ + m_thom_vram = ram; + m_thom_cart_bank = 0; + m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); + m_cartbank->configure_entries( 0, 12, mem + 0x10000, 0x4000 ); + m_basebank->configure_entry( 0, ram + 0x4000); + m_rambank->configure_entries( 0, 10, ram + 0x8000, 0x4000 ); + m_vrambank->set_entry( 0 ); + m_cartbank->set_entry( 0 ); + m_basebank->set_entry( 0 ); + m_rambank->set_entry( 0 ); + + /* save-state */ + save_item(NAME(m_thom_cart_nb_banks)); + save_item(NAME(m_thom_cart_bank)); + save_item(NAME(m_to7_lightpen)); + save_item(NAME(m_to7_lightpen_step)); + save_item(NAME(m_to9_soft_bank)); + save_pointer(NAME(mem + 0x10000), 0x10000 ); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to9_update_ram_bank_postload), this)); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to9_update_cart_bank_postload), this)); +} + + + +/***************************** TO8 *************************/ + + +/* ------------ keyboard (6804) ------------ */ + +/* The 6804 chip scans the keyboard and sends keycodes to the 6809. + Data is serialized using variable pulse length encoding. + Unlike the TO9, there is no decoding chip on the 6809 side, only + 1-bit PIA ports (6821 & 6846). The 6809 does the decoding. + + We do not emulate the 6804 but pass serialized data directly through the + PIA ports. + + Note: if we conform to the (scarce) documentation the CPU tend to lock + waitting for keyboard input. + The protocol documentation is pretty scarce and does not account for these + behaviors! + The emulation code contains many hacks (delays, timeouts, spurious + pulses) to improve the stability. + This works well, but is not very accurate. +*/ + + + +/* polling interval */ +#define TO8_KBD_POLL_PERIOD attotime::from_msec( 1 ) + +/* first and subsequent repeat periods, in TO8_KBD_POLL_PERIOD units */ +#define TO8_KBD_REPEAT_DELAY 800 /* 800 ms */ +#define TO8_KBD_REPEAT_PERIOD 70 /* 70 ms */ + +/* timeout waiting for CPU */ +#define TO8_KBD_TIMEOUT attotime::from_msec( 100 ) + + + +/* quick keyboard scan */ +int thomson_state::to8_kbd_ktest() +{ + int line, bit; + UINT8 port; + + if ( m_io_config->read() & 2 ) + return 0; /* disabled */ + + for ( line = 0; line < 10; line++ ) + { + port = m_io_keyboard[line]->read(); + + if ( line == 7 || line == 9 ) + port |= 1; /* shift & control */ + + for ( bit = 0; bit < 8; bit++ ) + { + if ( ! (port & (1 << bit)) ) + return 1; + } + } + + return 0; +} + + + +/* keyboard scan & return keycode (or -1) */ +int thomson_state::to8_kbd_get_key() +{ + int control = (m_io_keyboard[7]->read() & 1) ? 0 : 0x100; + int shift = (m_io_keyboard[9]->read() & 1) ? 0 : 0x080; + int key = -1, line, bit; + UINT8 port; + + if ( m_io_config->read() & 2 ) + return -1; /* disabled */ + + for ( line = 0; line < 10; line++ ) + { + port = m_io_keyboard[line]->read(); + + if ( line == 7 || line == 9 ) + port |= 1; /* shift & control */ + + /* TODO: correct handling of simultaneous keystokes: + return the new key preferably & disable repeat + */ + for ( bit = 0; bit < 8; bit++ ) + { + if ( ! (port & (1 << bit)) ) + key = line * 8 + bit; + } + } + + if ( key == -1 ) + { + m_to8_kbd_last_key = 0xff; + m_to8_kbd_key_count = 0; + return -1; + } + else if ( key == 64 ) + { + /* caps lock */ + if ( m_to8_kbd_last_key == key ) + return -1; /* no repeat */ + m_to8_kbd_last_key = key; + m_to8_kbd_caps = !m_to8_kbd_caps; + if ( m_to8_kbd_caps ) + key |= 0x080; /* auto-shift */ + thom_set_caps_led( !m_to8_kbd_caps ); + return key; + } + else if ( key == m_to8_kbd_last_key ) + { + /* repeat */ + m_to8_kbd_key_count++; + if ( m_to8_kbd_key_count < TO8_KBD_REPEAT_DELAY || (m_to8_kbd_key_count - TO8_KBD_REPEAT_DELAY) % TO8_KBD_REPEAT_PERIOD ) + return -1; + return key | shift | control; + } + else + { + m_to8_kbd_last_key = key; + m_to8_kbd_key_count = 0; + return key | shift | control; + } +} + + +/* steps: + 0 = idle, key polling + 1 = wait for ack to go down (key to send) + 99-117 = key data transmit + 91-117 = signal + 255 = timeout +*/ + +/* keyboard automaton */ +void thomson_state::to8_kbd_timer_func() +{ + attotime d; + + LOG_KBD(( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", machine().time().as_double(), m_to8_kbd_step, m_to8_kbd_ack, m_to8_kbd_data )); + + if( ! m_to8_kbd_step ) + { + /* key polling */ + int k = to8_kbd_get_key(); + /* if not in transfer, send pulse from time to time + (helps avoiding CPU lock) + */ + if ( ! m_to8_kbd_ack ) + m_mc6846->set_input_cp1(0); + m_mc6846->set_input_cp1(1); + + if ( k == -1 ) + d = TO8_KBD_POLL_PERIOD; + else + { + /* got key! */ + LOG_KBD(( "to8_kbd_timer_cb: got key $%03X\n", k )); + m_to8_kbd_data = k; + m_to8_kbd_step = 1; + d = attotime::from_usec( 100 ); + } + } + else if ( m_to8_kbd_step == 255 ) + { + /* timeout */ + m_to8_kbd_last_key = 0xff; + m_to8_kbd_key_count = 0; + m_to8_kbd_step = 0; + m_mc6846->set_input_cp1(1); + d = TO8_KBD_POLL_PERIOD; + } + else if ( m_to8_kbd_step == 1 ) + { + /* schedule timeout waiting for ack to go down */ + m_mc6846->set_input_cp1(0); + m_to8_kbd_step = 255; + d = TO8_KBD_TIMEOUT; + } + else if ( m_to8_kbd_step == 117 ) + { + /* schedule timeout waiting for ack to go up */ + m_mc6846->set_input_cp1(0); + m_to8_kbd_step = 255; + d = TO8_KBD_TIMEOUT; + } + else if ( m_to8_kbd_step & 1 ) + { + /* send silence between bits */ + m_mc6846->set_input_cp1(0); + d = attotime::from_usec( 100 ); + m_to8_kbd_step++; + } + else + { + /* send bit */ + int bpos = 8 - ( (m_to8_kbd_step - 100) / 2); + int bit = (m_to8_kbd_data >> bpos) & 1; + m_mc6846->set_input_cp1(1); + d = attotime::from_usec( bit ? 56 : 38 ); + m_to8_kbd_step++; + } + m_to8_kbd_timer->adjust(d); +} + + + +TIMER_CALLBACK_MEMBER(thomson_state::to8_kbd_timer_cb) +{ + to8_kbd_timer_func(); +} + + + +/* cpu <-> keyboard hand-check */ +void thomson_state::to8_kbd_set_ack( int data ) +{ + if ( data == m_to8_kbd_ack ) + return; + m_to8_kbd_ack = data; + + if ( data ) + { + double len = m_to8_kbd_signal->elapsed( ).as_double() * 1000. - 2.; + LOG_KBD(( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", machine().time().as_double(), len )); + if ( m_to8_kbd_data == 0xfff ) + { + /* end signal from CPU */ + if ( len >= 0.6 && len <= 0.8 ) + { + LOG (( "%f to8_kbd_set_ack: INIT signal\n", machine().time().as_double() )); + m_to8_kbd_last_key = 0xff; + m_to8_kbd_key_count = 0; + m_to8_kbd_caps = 1; + /* send back signal: TODO returned codes ? */ + m_to8_kbd_data = 0; + m_to8_kbd_step = 0; + m_to8_kbd_timer->adjust(attotime::from_msec( 1 )); + } + else + { + m_to8_kbd_step = 0; + m_to8_kbd_timer->adjust(TO8_KBD_POLL_PERIOD); + if ( len >= 1.2 && len <= 1.4 ) + { + LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", machine().time().as_double() )); + m_to8_kbd_caps = 1; + } + else if ( len >= 1.8 && len <= 2.0 ) + { + LOG (( "%f to8_kbd_set_ack: CAPS off signal\n", machine().time().as_double() )); + m_to8_kbd_caps = 0; + } + } + thom_set_caps_led( !m_to8_kbd_caps ); + } + else + { + /* end key transmission */ + m_to8_kbd_step = 0; + m_to8_kbd_timer->adjust(TO8_KBD_POLL_PERIOD); + } + } + + else + { + if ( m_to8_kbd_step == 255 ) + { + /* CPU accepts key */ + m_to8_kbd_step = 99; + m_to8_kbd_timer->adjust(attotime::from_usec( 400 )); + } + else + { + /* start signal from CPU */ + m_to8_kbd_data = 0xfff; + m_to8_kbd_step = 91; + m_to8_kbd_timer->adjust(attotime::from_usec( 400 )); + m_to8_kbd_signal->adjust(attotime::never); + } + LOG_KBD(( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", machine().time().as_double(), m_to8_kbd_data )); + } +} + + + +void thomson_state::to8_kbd_reset() +{ + m_to8_kbd_last_key = 0xff; + m_to8_kbd_key_count = 0; + m_to8_kbd_step = 0; + m_to8_kbd_data = 0; + m_to8_kbd_ack = 1; + m_to8_kbd_caps = 1; + thom_set_caps_led( !m_to8_kbd_caps ); + to8_kbd_timer_func(); +} + + + +void thomson_state::to8_kbd_init() +{ + m_to8_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::to8_kbd_timer_cb),this)); + m_to8_kbd_signal = machine().scheduler().timer_alloc(FUNC_NULL); + save_item(NAME(m_to8_kbd_ack)); + save_item(NAME(m_to8_kbd_data)); + save_item(NAME(m_to8_kbd_step)); + save_item(NAME(m_to8_kbd_last_key)); + save_item(NAME(m_to8_kbd_key_count)); + save_item(NAME(m_to8_kbd_caps)); +} + + + +/* ------------ RAM / ROM banking ------------ */ + +void thomson_state::to8_update_floppy_bank() +{ + int bank = (m_to8_reg_sys1 & 0x80) ? to7_floppy_bank : (m_to8_bios_bank + TO7_NB_FLOP_BANK); + + if ( bank != m_old_floppy_bank ) + { + LOG_BANK(( "to8_update_floppy_bank: floppy ROM is %s bank %i\n", + (m_to8_reg_sys1 & 0x80) ? "external" : "internal", + bank % TO7_NB_FLOP_BANK )); + m_flopbank->set_entry( bank ); + m_old_floppy_bank = bank; + } +} + + + +void thomson_state::to8_update_floppy_bank_postload() +{ + to8_update_floppy_bank(); +} + + + +void thomson_state::to8_update_ram_bank() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + UINT8 bank = 0; + + if ( m_to8_reg_sys1 & 0x10 ) + { + bank = m_to8_reg_ram & 31; + } + else + { + UINT8 portb = m_pia_sys->port_b_z_mask(); + + switch ( portb & 0xf8 ) + { + /* in compatibility mode, banks 5 and 6 are reversed wrt TO7/70 */ + case 0xf0: bank = 2; break; + case 0xe8: bank = 3; break; + case 0x18: bank = 4; break; + case 0x58: bank = 5; break; + case 0x98: bank = 6; break; + case 0xd8: bank = 7; break; + case 0xf8: return; + default: + logerror( "to8_update_ram_bank: unknown RAM bank=$%02X\n", portb & 0xf8 ); + return; + } + } + + /* due to addressing distortion, the 16 KB banked memory space is + split into two 8 KB spaces: + - 0xa000-0xbfff maps to 0x2000-0x3fff in 16 KB bank + - 0xc000-0xdfff maps to 0x0000-0x1fff in 16 KB bank + this is important if we map a bank that is also reachable by another, + undistorted space, such as cartridge, page 0 (video), or page 1 + */ + if ( bank != m_old_ram_bank) + { + if (m_ram->size() == 512*1024 || m_to8_data_vpage < 16) + { + m_datalobank->set_entry( bank ); + m_datahibank->set_entry( bank ); + } + else + { + /* RAM size is 256 KB only and unavailable + * bank requested */ + space.nop_readwrite( 0xa000, 0xbfff); + space.nop_readwrite( 0xc000, 0xdfff); + } + m_to8_data_vpage = bank; + m_old_ram_bank = bank; + LOG_BANK(( "to8_update_ram_bank: select bank %i (%s style)\n", bank, (m_to8_reg_sys1 & 0x10) ? "new" : "old")); + } +} + + + +void thomson_state::to8_update_ram_bank_postload() +{ + to8_update_ram_bank(); +} + + + +void thomson_state::to8_update_cart_bank() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + int bank = 0; + int bank_is_read_only = 0; + + if ( m_to8_reg_cart & 0x20 ) + { + /* RAM space */ + m_to8_cart_vpage = m_to8_reg_cart & 31; + bank = 8 + m_to8_cart_vpage; + bank_is_read_only = (( m_to8_reg_cart & 0x40 ) == 0); + if ( bank != m_old_cart_bank ) + { + /* mapping to VRAM */ + if (m_ram->size() == 512*1024 || m_to8_cart_vpage < 16) + { + if (m_to8_cart_vpage < 4) + { + if (m_old_cart_bank < 8 || m_old_cart_bank > 11) + { + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); + if ( bank_is_read_only ) + { + space.nop_write( 0x0000, 0x3fff); + } + else + { + space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_vcart_w),this)); + } + } + } + else + { + if (m_old_cart_bank < 12) + { + if ( bank_is_read_only ) + { + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); + space.nop_write( 0x0000, 0x3fff); + } + else + { + space.install_readwrite_bank(0x0000, 0x3fff, m_cartbank); + } + } + } + } + else + { + /* RAM size is 256 KB only and unavailable + * bank requested */ + space.nop_readwrite( 0x0000, 0x3fff); + } + LOG_BANK(( "to8_update_cart_bank: CART is RAM bank %i (%s)\n", + m_to8_cart_vpage, + bank_is_read_only ? "read-only":"read-write")); + } + else + { + if ( bank_is_read_only != m_old_cart_bank_was_read_only ) + { + if ( bank_is_read_only ) + { + space.nop_write( 0x0000, 0x3fff); + } + else + { + if (m_to8_cart_vpage < 4) + { + space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_vcart_w),this)); + } + else + { + space.install_readwrite_bank( 0x0000, 0x3fff, m_cartbank ); + } + } + LOG_BANK(( "to8_update_cart_bank: update CART bank %i write status to %s\n", + m_to8_cart_vpage, + bank_is_read_only ? "read-only":"read-write")); + } + } + m_old_cart_bank_was_read_only = bank_is_read_only; + } + else + { + if ( m_to8_soft_select ) + { + /* internal software ROM space */ + bank = 4 + m_to8_soft_bank; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 4 || m_old_cart_bank > 7 ) + { + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); + space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_cartridge_w),this) ); + } + LOG_BANK(( "to8_update_cart_bank: CART is internal bank %i\n", m_to8_soft_bank )); + } + } + else + { + /* external cartridge ROM space */ + if ( m_thom_cart_nb_banks ) + { + bank = m_thom_cart_bank % m_thom_cart_nb_banks; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) + { + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); + space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_cartridge_w),this) ); + space.install_read_handler( 0x0000, 0x0003, read8_delegate(FUNC(thomson_state::to8_cartridge_r),this) ); + } + LOG_BANK(( "to8_update_cart_bank: CART is external cartridge bank %i\n", bank )); + } + } + else + { + if ( m_old_cart_bank != 0 ) + { + space.nop_read( 0x0000, 0x3fff); + LOG_BANK(( "to8_update_cart_bank: CART is unmapped\n")); + } + } + } + } + if ( bank != m_old_cart_bank ) + { + m_cartbank->set_entry( bank ); + m_old_cart_bank = bank; + } +} + + + +void thomson_state::to8_update_cart_bank_postload() +{ + to8_update_cart_bank(); +} + + + +/* ROM bank switch */ +WRITE8_MEMBER( thomson_state::to8_cartridge_w ) +{ + if ( offset >= 0x2000 ) + return; + + if ( m_to8_soft_select ) + m_to8_soft_bank = offset & 3; + else + m_thom_cart_bank = offset & 3; + + to8_update_cart_bank(); +} + + + +/* read signal to 0000-0003 generates a bank switch */ +READ8_MEMBER( thomson_state::to8_cartridge_r ) +{ + UINT8* pos = memregion( "maincpu" )->base() + 0x10000; + UINT8 data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + if ( !space.debugger_access() ) + { + m_thom_cart_bank = offset & 3; + to8_update_cart_bank(); + } + return data; +} + + +/* ------------ floppy / network controller dispatch ------------ */ + + + +void thomson_state::to8_floppy_init() +{ + UINT8* mem = memregion("maincpu")->base(); + to7_floppy_init( mem + 0x34000 ); +} + + + +void thomson_state::to8_floppy_reset() +{ + UINT8* mem = memregion("maincpu")->base(); + to7_floppy_reset(); + if ( THOM_FLOPPY_INT ) + thmfc_floppy_reset(); + m_flopbank->configure_entries( TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 ); +} + + + +READ8_MEMBER( thomson_state::to8_floppy_r ) +{ + if ( space.debugger_access() ) + return 0; + + if ( (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) + /* external controller */ + return to7_floppy_r( space, offset ); + else if ( ! (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) + /* internal controller */ + return thmfc_floppy_r( space, offset ); + else + /* no controller */ + return 0; +} + + + +WRITE8_MEMBER( thomson_state::to8_floppy_w ) +{ + if ( (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) + /* external controller */ + to7_floppy_w( space, offset, data ); + else if ( ! (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) + /* internal controller */ + thmfc_floppy_w( space, offset, data ); +} + + + +/* ------------ system gate-array ------------ */ + + + +#define TO8_LIGHTPEN_DECAL 16 + + + +READ8_MEMBER( thomson_state::to8_gatearray_r ) +{ + struct thom_vsignal v = thom_get_vsignal(); + struct thom_vsignal l = thom_get_lightpen_vsignal( TO8_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 6 ); + int count, inil, init, lt3; + UINT8 res; + count = m_to7_lightpen ? l.count : v.count; + inil = m_to7_lightpen ? l.inil : v.inil; + init = m_to7_lightpen ? l.init : v.init; + lt3 = m_to7_lightpen ? l.lt3 : v.lt3; + + switch ( offset ) + { + case 0: /* system 2 / lightpen register 1 */ + if ( m_to7_lightpen ) + res = (count >> 8) & 0xff; + else + res = m_to8_reg_sys2 & 0xf0; + break; + + case 1: /* ram register / lightpen register 2 */ + if ( m_to7_lightpen ) + { + if ( !space.debugger_access() ) + { + thom_firq_2( 0 ); + m_to8_lightpen_intr = 0; + } + res = count & 0xff; + } + else + res = m_to8_reg_ram & 0x1f; + break; + + case 2: /* cartrige register / lightpen register 3 */ + if ( m_to7_lightpen ) + res = (lt3 << 7) | (inil << 6); + else + res = m_to8_reg_cart; + break; + + case 3: /* lightpen register 4 */ + res = (v.init << 7) | (init << 6) | (v.inil << 5) | (m_to8_lightpen_intr << 1) | m_to7_lightpen; + break; + + default: + logerror( "$%04x to8_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); + res = 0; + } + + LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", + m_maincpu->pc(), machine().time().as_double(), + offset, 0xe7e4 + offset, res, m_to7_lightpen )); + + return res; +} + + + +WRITE8_MEMBER( thomson_state::to8_gatearray_w ) +{ + LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", + m_maincpu->pc(), machine().time().as_double(), + offset, 0xe7e4 + offset, data )); + + switch ( offset ) + { + case 0: /* switch */ + m_to7_lightpen = data & 1; + break; + + case 1: /* ram register */ + if ( m_to8_reg_sys1 & 0x10 ) + { + m_to8_reg_ram = data; + to8_update_ram_bank(); + } + break; + + case 2: /* cartridge register */ + m_to8_reg_cart = data; + to8_update_cart_bank(); + break; + + case 3: /* system register 1 */ + m_to8_reg_sys1 = data; + to8_update_floppy_bank(); + to8_update_ram_bank(); + to8_update_cart_bank(); + break; + + default: + logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n", + m_maincpu->pc(), offset, data ); + } +} + + + +/* ------------ video gate-array ------------ */ + + + +READ8_MEMBER( thomson_state::to8_vreg_r ) +{ + /* 0xe7dc from external floppy drive aliases the video gate-array */ + if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) && ( m_to8_reg_sys1 & 0x80 ) ) + { + if ( space.debugger_access() ) + return 0; + + if ( THOM_FLOPPY_EXT ) + return to7_floppy_r( space, 0xc ); + else + return 0; + } + + switch ( offset ) + { + case 0: /* palette data */ + { + UINT8 c = m_to9_palette_data[ m_to9_palette_idx ]; + if ( !space.debugger_access() ) + { + m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; + } + return c; + } + + case 1: /* palette address */ + return m_to9_palette_idx; + + case 2: + case 3: + return 0; + + default: + logerror( "to8_vreg_r: invalid read offset %i\n", offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::to8_vreg_w ) +{ + LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", + m_maincpu->pc(), machine().time().as_double(), + offset, 0xe7da + offset, data )); + + switch ( offset ) + { + case 0: /* palette data */ + { + UINT16 color, idx; + m_to9_palette_data[ m_to9_palette_idx ] = data; + idx = m_to9_palette_idx / 2; + color = m_to9_palette_data[ 2 * idx + 1 ]; + color = m_to9_palette_data[ 2 * idx ] | (color << 8); + thom_set_palette( idx, color & 0x1fff ); + m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; + } + break; + + case 1: /* palette address */ + m_to9_palette_idx = data & 31; + break; + + case 2: /* display register */ + to9_set_video_mode( data, 1 ); + break; + + case 3: /* system register 2 */ + /* 0xe7dc from external floppy drive aliases the video gate-array */ + if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) && ( m_to8_reg_sys1 & 0x80 ) ) + { + if ( THOM_FLOPPY_EXT ) + to7_floppy_w( space, 0xc, data ); + } + else + { + m_to8_reg_sys2 = data; + thom_set_video_page( data >> 6 ); + thom_set_border_color( data & 15 ); + } + break; + + default: + logerror( "to8_vreg_w: invalid write offset %i data=$%02X\n", offset, data ); + } +} + + + +/* ------------ system PIA 6821 ------------ */ + + + +READ8_MEMBER( thomson_state::to8_sys_porta_in ) +{ + int ktest = to8_kbd_ktest(); + + LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", m_maincpu->pc(), machine().time().as_double(), ktest )); + + return ktest; +} + + + +WRITE8_MEMBER( thomson_state::to8_sys_portb_out ) +{ + m_centronics->write_data0(BIT(data, 0)); + m_centronics->write_strobe(BIT(data, 1)); + + to8_update_ram_bank(); + + if ( data & 4 ) /* bit 2: video overlay (TODO) */ + LOG(( "to8_sys_portb_out: video overlay not handled\n" )); +} + + + +/* ------------ 6846 (timer, I/O) ------------ */ + + +WRITE_LINE_MEMBER(thomson_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +READ8_MEMBER( thomson_state::to8_timer_port_in ) +{ + int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; + int cass = to7_get_cassette() ? 0x80 : 0; + int dtr = m_centronics_busy << 6; + int lock = m_to8_kbd_caps ? 0 : 8; /* undocumented! */ + return lightpen | cass | dtr | lock; +} + + + +WRITE8_MEMBER( thomson_state::to8_timer_port_out ) +{ + int ack = (data & 0x20) ? 1 : 0; /* bit 5: keyboard ACK */ + m_to8_bios_bank = (data & 0x10) ? 1 : 0; /* bit 4: BIOS bank*/ + thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ + m_biosbank->set_entry( m_to8_bios_bank ); + m_to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */ + to8_update_floppy_bank(); + to8_update_cart_bank(); + to8_kbd_set_ack(ack); +} + + + +WRITE8_MEMBER( thomson_state::to8_timer_cp2_out ) +{ + /* mute */ + m_to7_game_mute = data; + to7_game_sound_update(); +} + +/* ------------ lightpen ------------ */ + + + +/* direct connection to interrupt line instead of through a PIA */ +void thomson_state::to8_lightpen_cb( int step ) +{ + if ( ! m_to7_lightpen ) + return; + + thom_firq_2( 1 ); + m_to7_lightpen_step = step; + m_to8_lightpen_intr = 1; +} + + + +/* ------------ init / reset ------------ */ + + + +MACHINE_RESET_MEMBER( thomson_state, to8 ) +{ + LOG (( "to8: machine reset called\n" )); + + /* subsystems */ + thom_irq_reset(); + m_pia_sys->set_port_a_z_mask( 0xfe ); + to7_game_reset(); + to8_floppy_reset(); + to8_kbd_reset(); + to7_modem_reset(); + to7_midi_reset(); + + /* gate-array */ + m_to7_lightpen = 0; + m_to8_reg_ram = 0; + m_to8_reg_cart = 0; + m_to8_reg_sys1 = 0; + m_to8_reg_sys2 = 0; + m_to8_lightpen_intr = 0; + m_to8_soft_select = 0; + + /* video */ + thom_set_video_mode( THOM_VMODE_TO770 ); + m_thom_lightpen_cb = &thomson_state::to8_lightpen_cb; + thom_set_lightpen_callback( 4 ); + thom_set_border_color( 0 ); + thom_set_mode_point( 0 ); + m_pia_sys->cb1_w( 0 ); + + /* memory */ + m_old_ram_bank = -1; + m_old_cart_bank = -1; + m_old_cart_bank_was_read_only = 0; + m_old_floppy_bank = -1; + m_to8_cart_vpage = 0; + m_to8_data_vpage = 0; + m_to8_soft_bank = 0; + m_to8_bios_bank = 0; + to8_update_ram_bank(); + to8_update_cart_bank(); + to8_update_floppy_bank(); + m_biosbank->set_entry( 0 ); + /* thom_cart_bank not reset */ +} + + + +MACHINE_START_MEMBER( thomson_state, to8 ) +{ + UINT8* mem = memregion("maincpu")->base(); + UINT8* ram = m_ram->pointer(); + + LOG (( "to8: machine start called\n" )); + + /* subsystems */ + thom_irq_init(); + to7_game_init(); + to8_floppy_init(); + to8_kbd_init(); + to9_palette_init(); + to7_modem_init(); + to7_midi_init(); + + /* memory */ + m_thom_cart_bank = 0; + m_thom_vram = ram; + m_cartbank->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); + if ( m_ram->size() == 256*1024 ) + { + m_cartbank->configure_entries( 8, 16, ram, 0x4000 ); + m_cartbank->configure_entries( 8+16, 16, ram, 0x4000 ); + m_datalobank->configure_entries( 0, 16, ram + 0x2000, 0x4000 ); + m_datalobank->configure_entries( 16, 16, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 16, ram + 0x0000, 0x4000 ); + m_datahibank->configure_entries( 16, 16, ram + 0x0000, 0x4000 ); + } + else + { + m_cartbank->configure_entries( 8, 32, ram, 0x4000 ); + m_datalobank->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); + } + m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); + m_syslobank->configure_entry( 0, ram + 0x6000); + m_syshibank->configure_entry( 0, ram + 0x4000); + m_biosbank->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); + m_cartbank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_syslobank->set_entry( 0 ); + m_syshibank->set_entry( 0 ); + m_datalobank->set_entry( 0 ); + m_datahibank->set_entry( 0 ); + m_biosbank->set_entry( 0 ); + + /* save-state */ + save_item(NAME(m_thom_cart_nb_banks)); + save_item(NAME(m_thom_cart_bank)); + save_item(NAME(m_to7_lightpen)); + save_item(NAME(m_to7_lightpen_step)); + save_item(NAME(m_to8_reg_ram)); + save_item(NAME(m_to8_reg_cart)); + save_item(NAME(m_to8_reg_sys1)); + save_item(NAME(m_to8_reg_sys2)); + save_item(NAME(m_to8_soft_select)); + save_item(NAME(m_to8_soft_bank)); + save_item(NAME(m_to8_bios_bank)); + save_item(NAME(m_to8_lightpen_intr)); + save_item(NAME(m_to8_data_vpage)); + save_item(NAME(m_to8_cart_vpage)); + save_pointer(NAME(mem + 0x10000), 0x10000 ); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_ram_bank_postload), this)); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_cart_bank_postload), this)); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_floppy_bank_postload), this)); +} + + + +/***************************** TO9+ *************************/ + + + +/* ------------ system PIA 6821 ------------ */ + + + +/* ------------ 6846 (timer, I/O) ------------ */ + + + +READ8_MEMBER( thomson_state::to9p_timer_port_in ) +{ + int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; + int cass = to7_get_cassette() ? 0x80 : 0; + int dtr = m_centronics_busy << 6; + return lightpen | cass | dtr; +} + + + +WRITE8_MEMBER( thomson_state::to9p_timer_port_out ) +{ + int bios_bank = (data & 0x10) ? 1 : 0; /* bit 4: BIOS bank */ + thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ + m_biosbank->set_entry( bios_bank ); + m_to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */ + to8_update_floppy_bank(); + to8_update_cart_bank(); +} + +/* ------------ init / reset ------------ */ + +MACHINE_RESET_MEMBER( thomson_state, to9p ) +{ + LOG (( "to9p: machine reset called\n" )); + + /* subsystems */ + thom_irq_reset(); + m_pia_sys->set_port_a_z_mask( 0xfe ); + to7_game_reset(); + to8_floppy_reset(); + to9_kbd_reset(); + to7_modem_reset(); + to7_midi_reset(); + + /* gate-array */ + m_to7_lightpen = 0; + m_to8_reg_ram = 0; + m_to8_reg_cart = 0; + m_to8_reg_sys1 = 0; + m_to8_reg_sys2 = 0; + m_to8_lightpen_intr = 0; + m_to8_soft_select = 0; + + /* video */ + thom_set_video_mode( THOM_VMODE_TO770 ); + m_thom_lightpen_cb = &thomson_state::to8_lightpen_cb; + thom_set_lightpen_callback( 4 ); + thom_set_border_color( 0 ); + thom_set_mode_point( 0 ); + m_pia_sys->cb1_w( 0 ); + + /* memory */ + m_old_ram_bank = -1; + m_old_cart_bank = -1; + m_old_floppy_bank = -1; + m_to8_cart_vpage = 0; + m_to8_data_vpage = 0; + m_to8_soft_bank = 0; + m_to8_bios_bank = 0; + to8_update_ram_bank(); + to8_update_cart_bank(); + to8_update_floppy_bank(); + m_biosbank->set_entry( 0 ); + /* thom_cart_bank not reset */ +} + + + +MACHINE_START_MEMBER( thomson_state, to9p ) +{ + UINT8* mem = memregion("maincpu")->base(); + UINT8* ram = m_ram->pointer(); + + LOG (( "to9p: machine start called\n" )); + + /* subsystems */ + thom_irq_init(); + to7_game_init(); + to8_floppy_init(); + to9_kbd_init(); + to9_palette_init(); + to7_modem_init(); + to7_midi_init(); + + /* memory */ + m_thom_cart_bank = 0; + m_thom_vram = ram; + m_cartbank->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 8, 32, ram, 0x4000 ); + m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); + m_syslobank->configure_entry( 0, ram + 0x6000 ); + m_syshibank->configure_entry( 0, ram + 0x4000 ); + m_datalobank->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); + m_cartbank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_syslobank->set_entry( 0 ); + m_syshibank->set_entry( 0 ); + m_datalobank->set_entry( 0 ); + m_datahibank->set_entry( 0 ); + m_biosbank->set_entry( 0 ); + + /* save-state */ + save_item(NAME(m_thom_cart_nb_banks)); + save_item(NAME(m_thom_cart_bank)); + save_item(NAME(m_to7_lightpen)); + save_item(NAME(m_to7_lightpen_step)); + save_item(NAME(m_to8_reg_ram)); + save_item(NAME(m_to8_reg_cart)); + save_item(NAME(m_to8_reg_sys1)); + save_item(NAME(m_to8_reg_sys2)); + save_item(NAME(m_to8_soft_select)); + save_item(NAME(m_to8_soft_bank)); + save_item(NAME(m_to8_bios_bank)); + save_item(NAME(m_to8_lightpen_intr)); + save_item(NAME(m_to8_data_vpage)); + save_item(NAME(m_to8_cart_vpage)); + save_pointer(NAME(mem + 0x10000), 0x10000 ); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_ram_bank_postload), this)); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_cart_bank_postload), this)); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_floppy_bank_postload), this)); +} + + + +/****************** MO6 / Olivetti Prodest PC 128 *******************/ + + + +/* ------------ RAM / ROM banking ------------ */ + + + +void thomson_state::mo6_update_ram_bank() +{ + UINT8 bank = 0; + + if ( m_to8_reg_sys1 & 0x10 ) + { + bank = m_to8_reg_ram & 7; /* 128 KB RAM only = 8 pages */ + } + if ( bank != m_to8_data_vpage ) { + m_datalobank->set_entry( bank ); + m_datahibank->set_entry( bank ); + m_to8_data_vpage = bank; + m_old_ram_bank = bank; + LOG_BANK(( "mo6_update_ram_bank: select bank %i (new style)\n", bank )); + } +} + + + +void thomson_state::mo6_update_ram_bank_postload() +{ + mo6_update_ram_bank(); +} + + + +void thomson_state::mo6_update_cart_bank() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + int b = (m_pia_sys->a_output() >> 5) & 1; + int bank = 0; + int bank_is_read_only = 0; + + if ( ( ( m_to8_reg_sys1 & 0x40 ) && ( m_to8_reg_cart & 0x20 ) ) || ( ! ( m_to8_reg_sys1 & 0x40 ) && ( m_mo5_reg_cart & 4 ) ) ) + { + /* RAM space */ + if ( m_to8_reg_sys1 & 0x40 ) + { + /* use a7e6 */ + m_to8_cart_vpage = m_to8_reg_cart & 7; /* 128 KB RAM only = 8 pages */ + bank = 8 + m_to8_cart_vpage; + bank_is_read_only = (( m_to8_reg_cart & 0x40 ) == 0); + if ( bank != m_old_cart_bank ) + { + if (m_to8_cart_vpage < 4) + { + if (m_old_cart_bank < 8 || m_old_cart_bank > 11) + { + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); + if ( bank_is_read_only ) + { + space.nop_write( 0xb000, 0xefff); + } + else + { + space.install_write_handler( 0xb000, 0xbfff, write8_delegate(FUNC(thomson_state::mo6_vcart_lo_w),this)); + space.install_write_handler( 0xc000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_vcart_hi_w),this)); + } + } + } + else + { + if (m_old_cart_bank < 12) + { + if ( bank_is_read_only ) + { + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); + space.nop_write( 0xb000, 0xefff); + } + else + { + space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); + } + } + } + LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (%s)\n", + m_to8_cart_vpage, + bank_is_read_only ? "read-only":"read-write")); + } + else if ( bank_is_read_only != m_old_cart_bank_was_read_only ) + { + if ( bank_is_read_only ) + { + space.nop_write( 0xb000, 0xefff); + } + else + { + if (m_to8_cart_vpage < 4) + { + space.install_write_handler( 0xb000, 0xbfff, write8_delegate(FUNC(thomson_state::mo6_vcart_lo_w),this)); + space.install_write_handler( 0xc000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_vcart_hi_w),this)); + } + else + { + space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); + } + } + LOG_BANK(( "mo6_update_cart_bank: update CART bank %i write status to %s\n", + m_to8_cart_vpage, + bank_is_read_only ? "read-only":"read-write")); + } + m_old_cart_bank_was_read_only = bank_is_read_only; + } + else if ( m_thom_cart_nb_banks == 4 ) + { + /* "JANE"-style cartridge bank switching */ + bank = m_mo5_reg_cart & 3; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) + { + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); + space.nop_write( 0xb000, 0xefff); + } + LOG_BANK(( "mo6_update_cart_bank: CART is external cartridge bank %i (A7CB style)\n", bank )); + } + } + else + { + /* RAM from MO5 network extension */ + int bank_is_read_only = (( m_mo5_reg_cart & 8 ) == 0); + m_to8_cart_vpage = (m_mo5_reg_cart & 3) | 4; + bank = 8 + m_to8_cart_vpage; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 12 ) + { + if ( bank_is_read_only ) + { + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); + space.nop_write( 0xb000, 0xefff); + } + else + { + space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); + } + } + LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (MO5 compat.) (%s)\n", + m_to8_cart_vpage, + bank_is_read_only ? "read-only":"read-write")); + } + else if ( bank_is_read_only != m_old_cart_bank_was_read_only ) + { + if ( bank_is_read_only ) + { + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); + space.nop_write( 0xb000, 0xefff); + } + else + { + space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); + } + LOG_BANK(( "mo5_update_cart_bank: update CART bank %i write status to %s\n", + m_to8_cart_vpage, + bank_is_read_only ? "read-only":"read-write")); + } + m_old_cart_bank_was_read_only = bank_is_read_only; + } + } + else + { + /* ROM space */ + if ( m_to8_reg_sys2 & 0x20 ) + { + /* internal ROM */ + if ( m_to8_reg_sys2 & 0x10) + { + bank = b + 6; /* BASIC 128 */ + } + else + { + bank = b + 4; /* BASIC 1 */ + } + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 4 || m_old_cart_bank > 7 ) + { + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); + space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_cartridge_w),this) ); + } + LOG_BANK(( "mo6_update_cart_bank: CART is internal ROM bank %i\n", b )); + } + } + else + { + /* cartridge */ + if ( m_thom_cart_nb_banks ) + { + bank = m_thom_cart_bank % m_thom_cart_nb_banks; + if ( bank != m_old_cart_bank ) + { + if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) + { + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); + space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_cartridge_w),this) ); + space.install_read_handler( 0xbffc, 0xbfff, read8_delegate(FUNC(thomson_state::mo6_cartridge_r),this) ); + } + LOG_BANK(( "mo6_update_cart_bank: CART is external cartridge bank %i\n", bank )); + } + } + else + { + if ( m_old_cart_bank != 0 ) + { + space.nop_read( 0xb000, 0xefff ); + LOG_BANK(( "mo6_update_cart_bank: CART is unmapped\n")); + } + } + } + } + if ( bank != m_old_cart_bank ) + { + m_cartlobank->set_entry( bank ); + m_carthibank->set_entry( bank ); + m_biosbank->set_entry( b ); + m_old_cart_bank = bank; + } +} + + + +void thomson_state::mo6_update_cart_bank_postload() +{ + mo6_update_cart_bank(); +} + + + +/* write signal generates a bank switch */ +WRITE8_MEMBER( thomson_state::mo6_cartridge_w ) +{ + if ( offset >= 0x2000 ) + return; + + m_thom_cart_bank = offset & 3; + mo6_update_cart_bank(); +} + + + +/* read signal generates a bank switch */ +READ8_MEMBER( thomson_state::mo6_cartridge_r ) +{ + UINT8* pos = memregion( "maincpu" )->base() + 0x10000; + UINT8 data = pos[offset + 0xbffc + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + if ( !space.debugger_access() ) + { + m_thom_cart_bank = offset & 3; + mo6_update_cart_bank(); + } + return data; +} + + + +WRITE8_MEMBER( thomson_state::mo6_ext_w ) +{ + /* MO5 network extension compatible */ + m_mo5_reg_cart = data; + mo6_update_cart_bank(); +} + + + +/* ------------ game 6821 PIA ------------ */ + +/* similar to SX 90-018, but with a few differences: mute, printer */ + + +WRITE_LINE_MEMBER( thomson_state::mo6_centronics_busy ) +{ + m_pia_game->cb1_w(state); +} + + +WRITE8_MEMBER( thomson_state::mo6_game_porta_out ) +{ + LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", m_maincpu->pc(), machine().time().as_double(), data )); + + /* centronics data */ + m_cent_data_out->write(data); +} + + + +WRITE_LINE_MEMBER( thomson_state::mo6_game_cb2_out ) +{ + LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", m_maincpu->pc(), machine().time().as_double(), state )); + + /* centronics strobe */ + m_centronics->write_strobe(state); +} + + + +TIMER_CALLBACK_MEMBER(thomson_state::mo6_game_update_cb) +{ + /* unlike the TO8, CB1 & CB2 are not connected to buttons */ + if ( m_io_config->read() & 1 ) + { + UINT8 mouse = to7_get_mouse_signal(); + m_pia_game->ca1_w( BIT(mouse, 0) ); /* XA */ + m_pia_game->ca2_w( BIT(mouse, 1) ); /* YA */ + } + else + { + /* joystick */ + UINT8 in = m_io_game_port_buttons->read(); + m_pia_game->ca1_w( BIT(in, 2) ); /* P1 action B */ + m_pia_game->ca2_w( BIT(in, 6) ); /* P1 action A */ + } +} + + + +void thomson_state::mo6_game_init() +{ + LOG (( "mo6_game_init called\n" )); + m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo6_game_update_cb),this)); + m_to7_game_timer->adjust(TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD); + save_item(NAME(m_to7_game_sound)); + save_item(NAME(m_to7_game_mute)); +} + + + +void thomson_state::mo6_game_reset() +{ + LOG (( "mo6_game_reset called\n" )); + m_pia_game->ca1_w( 0 ); + m_to7_game_sound = 0; + m_to7_game_mute = 0; + to7_game_sound_update(); +} + + + +/* ------------ system PIA 6821 ------------ */ + + + +READ8_MEMBER( thomson_state::mo6_sys_porta_in ) +{ + return + (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ + 8 | /* bit 3: kbd-line float up to 1 */ + ((m_io_lightpen_button->read() & 1) ? 2 : 0); + /* bit 1: lightpen button */; +} + + + +READ8_MEMBER( thomson_state::mo6_sys_portb_in ) +{ + /* keyboard: 9 lines of 8 keys */ + UINT8 porta = m_pia_sys->a_output(); + UINT8 portb = m_pia_sys->b_output(); + int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ + int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ + + if ( ! (porta & 8) ) + lin = 8; /* A bit 3: 9-th kbd line select */ + + return + ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; + /* bit 7: key up */ +} + + + +WRITE8_MEMBER( thomson_state::mo6_sys_porta_out ) +{ + thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ + m_to7_game_mute = data & 4; /* bit 2: sound mute */ + thom_set_caps_led( (data & 16) ? 0 : 1 ) ; /* bit 4: keyboard led */ + mo5_set_cassette( (data & 0x40) ? 1 : 0 ); /* bit 6: cassette output */ + mo6_update_cart_bank(); /* bit 5: rom bank */ + to7_game_sound_update(); +} + + + +WRITE8_MEMBER( thomson_state::mo6_sys_portb_out ) +{ + m_buzzer->write_unsigned8((data & 1) ? 0x80 : 0); /* bit 0: buzzer */ +} + + + +WRITE_LINE_MEMBER( thomson_state::mo6_sys_cb2_out ) +{ + /* SCART pin 8 = slow switch (?) */ + LOG(( "mo6_sys_cb2_out: SCART slow switch set to %i\n", state )); +} + + + +/* ------------ system gate-array ------------ */ + +#define MO6_LIGHTPEN_DECAL 12 + + + +READ8_MEMBER( thomson_state::mo6_gatearray_r ) +{ + struct thom_vsignal v = thom_get_vsignal(); + struct thom_vsignal l = thom_get_lightpen_vsignal( MO6_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 6 ); + int count, inil, init, lt3; + UINT8 res; + count = m_to7_lightpen ? l.count : v.count; + inil = m_to7_lightpen ? l.inil : v.inil; + init = m_to7_lightpen ? l.init : v.init; + lt3 = m_to7_lightpen ? l.lt3 : v.lt3; + + switch ( offset ) + { + case 0: /* system 2 / lightpen register 1 */ + if ( m_to7_lightpen ) + res = (count >> 8) & 0xff; + else + res = m_to8_reg_sys2 & 0xf0; + break; + + case 1: /* ram register / lightpen register 2 */ + if ( m_to7_lightpen ) + { + if ( !space.debugger_access() ) + { + thom_firq_2( 0 ); + m_to8_lightpen_intr = 0; + } + res = count & 0xff; + } + else + res = m_to8_reg_ram & 0x1f; + break; + + case 2: /* cartrige register / lightpen register 3 */ + if ( m_to7_lightpen ) + res = (lt3 << 7) | (inil << 6); + else + res = 0; + break; + + case 3: /* lightpen register 4 */ + res = (v.init << 7) | (init << 6) | (v.inil << 5) | (m_to8_lightpen_intr << 1) | m_to7_lightpen; + break; + + default: + logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); + res = 0; + } + + LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", + m_maincpu->pc(), machine().time().as_double(), + offset, 0xa7e4 + offset, res, m_to7_lightpen )); + + return res; +} + + + +WRITE8_MEMBER( thomson_state::mo6_gatearray_w ) +{ + LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", + m_maincpu->pc(), machine().time().as_double(), + offset, 0xa7e4 + offset, data )); + + switch ( offset ) + { + case 0: /* switch */ + m_to7_lightpen = data & 1; + break; + + case 1: /* ram register */ + if ( m_to8_reg_sys1 & 0x10 ) + { + m_to8_reg_ram = data; + mo6_update_ram_bank(); + } + break; + + case 2: /* cartridge register */ + m_to8_reg_cart = data; + mo6_update_cart_bank(); + break; + + case 3: /* system register 1 */ + m_to8_reg_sys1 = data; + mo6_update_ram_bank(); + mo6_update_cart_bank(); + break; + + default: + logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", m_maincpu->pc(), offset, data ); + } +} + + +/* ------------ video gate-array ------------ */ + + + +READ8_MEMBER( thomson_state::mo6_vreg_r ) +{ + /* 0xa7dc from external floppy drive aliases the video gate-array */ + if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) ) + { + if ( !space.debugger_access() ) + return to7_floppy_r( space, 0xc ); + } + + switch ( offset ) + { + case 0: /* palette data */ + case 1: /* palette address */ + return to8_vreg_r( space, offset ); + + case 2: + case 3: + return 0; + + default: + logerror( "mo6_vreg_r: invalid read offset %i\n", offset ); + return 0; + } +} + + + +WRITE8_MEMBER( thomson_state::mo6_vreg_w ) +{ + LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", + m_maincpu->pc(), machine().time().as_double(), + offset, 0xa7da + offset, data )); + + switch ( offset ) + { + case 0: /* palette data */ + case 1: /* palette address */ + to8_vreg_w( space, offset, data ); + return; + + case 2: /* display / external floppy register */ + if ( ( m_to8_reg_sys1 & 0x80 ) && ( m_to8_reg_ram & 0x80 ) ) + to7_floppy_w( space, 0xc, data ); + else + to9_set_video_mode( data, 2 ); + break; + + case 3: /* system register 2 */ + /* 0xa7dc from external floppy drive aliases the video gate-array */ + if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) ) + to7_floppy_w( space, 0xc, data ); + else + { + m_to8_reg_sys2 = data; + thom_set_video_page( data >> 6 ); + thom_set_border_color( data & 15 ); + mo6_update_cart_bank(); + } + break; + + default: + logerror( "mo6_vreg_w: invalid write offset %i data=$%02X\n", offset, data ); + } +} + + + +/* ------------ init / reset ------------ */ + + + +MACHINE_RESET_MEMBER( thomson_state, mo6 ) +{ + LOG (( "mo6: machine reset called\n" )); + + /* subsystems */ + thom_irq_reset(); + m_pia_sys->set_port_a_z_mask( 0x75 ); + mo6_game_reset(); + to7_floppy_reset(); + to7_modem_reset(); + to7_midi_reset(); + mo5_init_timer(); + + /* gate-array */ + m_to7_lightpen = 0; + m_to8_reg_ram = 0; + m_to8_reg_cart = 0; + m_to8_reg_sys1 = 0; + m_to8_reg_sys2 = 0; + m_to8_lightpen_intr = 0; + + /* video */ + thom_set_video_mode( THOM_VMODE_MO5 ); + m_thom_lightpen_cb = &thomson_state::to8_lightpen_cb; + thom_set_lightpen_callback( 3 ); + thom_set_border_color( 0 ); + thom_set_mode_point( 0 ); + m_pia_sys->ca1_w( 0 ); + + /* memory */ + m_old_ram_bank = -1; + m_old_cart_bank = -1; + m_to8_cart_vpage = 0; + m_to8_data_vpage = 0; + mo6_update_ram_bank(); + mo6_update_cart_bank(); + /* mo5_reg_cart not reset */ + /* thom_cart_bank not reset */ +} + + + +MACHINE_START_MEMBER( thomson_state, mo6 ) +{ + UINT8* mem = memregion("maincpu")->base(); + UINT8* ram = m_ram->pointer(); + + LOG (( "mo6: machine start called\n" )); + + /* subsystems */ + thom_irq_init(); + mo6_game_init(); + to7_floppy_init( mem + 0x30000 ); + to9_palette_init(); + to7_modem_init(); + to7_midi_init(); + m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo5_periodic_cb),this)); + + /* memory */ + m_thom_cart_bank = 0; + m_mo5_reg_cart = 0; + m_thom_vram = ram; + m_cartlobank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartlobank->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); + m_cartlobank->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); + m_cartlobank->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); + m_carthibank->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 8, 8, ram, 0x4000 ); + m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); + m_syslobank->configure_entry( 0, ram + 0x6000); + m_syshibank->configure_entry( 0, ram + 0x4000); + m_datalobank->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); + m_cartlobank->set_entry( 0 ); + m_carthibank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_syslobank->set_entry( 0 ); + m_syshibank->set_entry( 0 ); + m_datalobank->set_entry( 0 ); + m_datahibank->set_entry( 0 ); + m_biosbank->set_entry( 0 ); + + /* save-state */ + save_item(NAME(m_thom_cart_nb_banks)); + save_item(NAME(m_thom_cart_bank)); + save_item(NAME(m_to7_lightpen)); + save_item(NAME(m_to7_lightpen_step)); + save_item(NAME(m_to8_reg_ram)); + save_item(NAME(m_to8_reg_cart)); + save_item(NAME(m_to8_reg_sys1)); + save_item(NAME(m_to8_reg_sys2)); + save_item(NAME(m_to8_lightpen_intr)); + save_item(NAME(m_to8_data_vpage)); + save_item(NAME(m_to8_cart_vpage)); + save_item(NAME(m_mo5_reg_cart)); + save_pointer(NAME(mem + 0x10000), 0x10000 ); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_ram_bank_postload), this)); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_cart_bank_postload), this)); +} + + + +/***************************** MO5 NR *************************/ + + + +/* ------------ network ( & external floppy) ------------ */ + + + +READ8_MEMBER( thomson_state::mo5nr_net_r ) +{ + if ( space.debugger_access() ) + return 0; + + if ( to7_controller_type ) + return to7_floppy_r ( space, offset ); + + logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", m_maincpu->pc(), machine().time().as_double(), offset ); + + return 0; +} + + + +WRITE8_MEMBER( thomson_state::mo5nr_net_w ) +{ + if ( to7_controller_type ) + to7_floppy_w ( space, offset, data ); + else + logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n", + m_maincpu->pc(), machine().time().as_double(), data, offset ); +} + + +/* ------------ printer ------------ */ + +/* Unlike the TO8, TO9, TO9+, MO6, the printer has its own ports and does not + go through the 6821 PIA. +*/ + + +READ8_MEMBER( thomson_state::mo5nr_prn_r ) +{ + UINT8 result = 0; + + result |= m_centronics_busy << 7; + + return result; +} + + +WRITE8_MEMBER( thomson_state::mo5nr_prn_w ) +{ + /* TODO: understand other bits */ + m_centronics->write_strobe(BIT(data, 3)); +} + + + +/* ------------ system PIA 6821 ------------ */ + + + +READ8_MEMBER( thomson_state::mo5nr_sys_portb_in ) +{ + /* keyboard: only 8 lines of 8 keys (MO6 has 9 lines) */ + UINT8 portb = m_pia_sys->b_output(); + int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ + int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ + + return ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; + /* bit 7: key up */ +} + + + +WRITE8_MEMBER( thomson_state::mo5nr_sys_porta_out ) +{ + /* no keyboard LED */ + thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ + m_to7_game_mute = data & 4; /* bit 2: sound mute */ + mo5_set_cassette( (data & 0x40) ? 1 : 0 ); /* bit 6: cassette output */ + mo6_update_cart_bank(); /* bit 5: rom bank */ + to7_game_sound_update(); +} + + + +/* ------------ game 6821 PIA ------------ */ + +/* similar to the MO6, without the printer */ + + + +void thomson_state::mo5nr_game_init() +{ + LOG (( "mo5nr_game_init called\n" )); + m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo6_game_update_cb),this)); + m_to7_game_timer->adjust( TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); + save_item(NAME(m_to7_game_sound)); + save_item(NAME(m_to7_game_mute)); +} + + + +void thomson_state::mo5nr_game_reset() +{ + LOG (( "mo5nr_game_reset called\n" )); + m_pia_game->ca1_w( 0 ); + m_to7_game_sound = 0; + m_to7_game_mute = 0; + to7_game_sound_update(); +} + + + +/* ------------ init / reset ------------ */ + + + +MACHINE_RESET_MEMBER( thomson_state, mo5nr ) +{ + LOG (( "mo5nr: machine reset called\n" )); + + /* subsystems */ + thom_irq_reset(); + m_pia_sys->set_port_a_z_mask( 0x65 ); + mo5nr_game_reset(); + to7_floppy_reset(); + to7_modem_reset(); + to7_midi_reset(); + mo5_init_timer(); + + /* gate-array */ + m_to7_lightpen = 0; + m_to8_reg_ram = 0; + m_to8_reg_cart = 0; + m_to8_reg_sys1 = 0; + m_to8_reg_sys2 = 0; + m_to8_lightpen_intr = 0; + + /* video */ + thom_set_video_mode( THOM_VMODE_MO5 ); + m_thom_lightpen_cb = &thomson_state::to8_lightpen_cb; + thom_set_lightpen_callback( 3 ); + thom_set_border_color( 0 ); + thom_set_mode_point( 0 ); + m_pia_sys->ca1_w( 0 ); + + /* memory */ + m_old_ram_bank = -1; + m_old_cart_bank = -1; + m_to8_cart_vpage = 0; + m_to8_data_vpage = 0; + mo6_update_ram_bank(); + mo6_update_cart_bank(); + /* mo5_reg_cart not reset */ + /* thom_cart_bank not reset */ +} + + + +MACHINE_START_MEMBER( thomson_state, mo5nr ) +{ + UINT8* mem = memregion("maincpu")->base(); + UINT8* ram = m_ram->pointer(); + + LOG (( "mo5nr: machine start called\n" )); + + /* subsystems */ + thom_irq_init(); + mo5nr_game_init(); + to7_floppy_init( mem + 0x30000 ); + to9_palette_init(); + to7_modem_init(); + to7_midi_init(); + m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo5_periodic_cb),this)); + + /* memory */ + m_thom_cart_bank = 0; + m_mo5_reg_cart = 0; + m_thom_vram = ram; + + m_cartlobank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartlobank->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); + m_cartlobank->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); + m_cartlobank->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); + m_carthibank->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 8, 8, ram, 0x4000 ); + m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); + m_syslobank->configure_entry( 0, ram + 0x6000); + m_syshibank->configure_entry( 0, ram + 0x4000); + m_datalobank->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); + m_cartlobank->set_entry( 0 ); + m_carthibank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_syslobank->set_entry( 0 ); + m_syshibank->set_entry( 0 ); + m_datalobank->set_entry( 0 ); + m_datahibank->set_entry( 0 ); + m_biosbank->set_entry( 0 ); + + /* save-state */ + save_item(NAME(m_thom_cart_nb_banks)); + save_item(NAME(m_thom_cart_bank)); + save_item(NAME(m_to7_lightpen)); + save_item(NAME(m_to7_lightpen_step)); + save_item(NAME(m_to8_reg_ram)); + save_item(NAME(m_to8_reg_cart)); + save_item(NAME(m_to8_reg_sys1)); + save_item(NAME(m_to8_reg_sys2)); + save_item(NAME(m_to8_lightpen_intr)); + save_item(NAME(m_to8_data_vpage)); + save_item(NAME(m_to8_cart_vpage)); + save_item(NAME(m_mo5_reg_cart)); + save_pointer(NAME(mem + 0x10000), 0x10000 ); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_ram_bank_postload), this)); + machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_cart_bank_postload), this)); +} diff --git a/src/mame/machine/ti85.c b/src/mame/machine/ti85.c new file mode 100644 index 00000000000..069e8f7f6fa --- /dev/null +++ b/src/mame/machine/ti85.c @@ -0,0 +1,1192 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha,Jon Sturm +/*************************************************************************** + TI-85 driver by Krzysztof Strzecha + TI-83 Plus, TI-84 Plus, and Siliver Edition support by Jon Sturm + + Functions to emulate general aspects of the machine (RAM, ROM, interrupts, + I/O ports) + +***************************************************************************/ + +#include +#include "emu.h" +#include "cpu/z80/z80.h" +#include "includes/ti85.h" + +#define TI85_SNAPSHOT_SIZE 32976 +#define TI86_SNAPSHOT_SIZE 131284 + +TIMER_CALLBACK_MEMBER(ti85_state::ti85_timer_callback) +{ + if (ioport("ON")->read() & 0x01) + { + if (m_ON_interrupt_mask && !m_ON_pressed) + { + m_maincpu->set_input_line(0, HOLD_LINE); + m_ON_interrupt_status = 1; + if (!m_timer_interrupt_mask) m_timer_interrupt_mask = 2; + } + m_ON_pressed = 1; + return; + } + else + m_ON_pressed = 0; + if (m_timer_interrupt_mask) + { + m_maincpu->set_input_line(0, HOLD_LINE); + m_timer_interrupt_status = m_timer_interrupt_mask; + } +} + +TIMER_CALLBACK_MEMBER(ti85_state::ti83_timer1_callback) +{ + if (ioport("ON")->read() & 0x01) + { + if (m_ON_interrupt_mask && !m_ON_pressed) + { + m_maincpu->set_input_line(0, HOLD_LINE); + m_ON_interrupt_status = 1; + } + m_ON_pressed = 1; + return; + } + else + { + m_ON_pressed = 0; + } + if (m_timer_interrupt_mask & 2) + { + m_maincpu->set_input_line(0, HOLD_LINE); + m_timer_interrupt_status = m_timer_interrupt_status | 2; + } +} + +TIMER_CALLBACK_MEMBER(ti85_state::ti83_timer2_callback) +{ + if (m_timer_interrupt_mask & 4) + { + m_maincpu->set_input_line(0, HOLD_LINE); + m_timer_interrupt_status = m_timer_interrupt_status | 4; + } +} + +void ti85_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case CRYSTAL_TIMER3: + case CRYSTAL_TIMER2: + case CRYSTAL_TIMER1: + if (m_ctimer[id].count) + { + m_ctimer[id].count--; + if (!m_ctimer[id].count) + { + if (!(m_ctimer[id].loop & 4)) + { + if (!(m_ctimer[id].loop & 1)) + { + m_ctimer[id].setup = 0; + } + else + { + ti83pse_count(id, m_ctimer[id].max); + } + if (!(m_ctimer[id].loop & 2)) + { + //generate interrupt + m_ctimer_interrupt_status |= (0x20 << id); + m_maincpu->set_input_line(0, HOLD_LINE); + } + m_ctimer[id].loop &= 2; + } + } + } + break; + case HW_TIMER1: + if (ioport("ON")->read() & 0x01) + { + if (m_ON_interrupt_mask && !m_ON_pressed) + { + m_maincpu->set_input_line(0, HOLD_LINE); + m_ON_interrupt_status = 1; + } + m_ON_pressed = 1; + return; + } + else + { + m_ON_pressed = 0; + } + if (m_timer_interrupt_mask & 2) + { + m_maincpu->set_input_line(0, HOLD_LINE); + m_timer_interrupt_status = m_timer_interrupt_status | 2; + } + break; + case HW_TIMER2: + if (m_timer_interrupt_mask & 4) + { + m_maincpu->set_input_line(0, HOLD_LINE); + m_timer_interrupt_status = m_timer_interrupt_status | 4; + } + } +} + +inline void ti8x_update_bank(address_space &space, UINT8 bank, UINT8 *base, UINT8 page, bool is_ram) +{ + ti85_state *state = space.machine().driver_data(); + static const char *const tag[] = {"bank1", "bank2", "bank3", "bank4"}; + + state->membank(tag[bank&3])->set_base(base + (0x4000 * page)); + + if (is_ram) + space.install_write_bank(bank * 0x4000, bank * 0x4000 + 0x3fff, tag[bank&3]); + else + space.nop_write(bank * 0x4000, bank * 0x4000 + 0x3fff); +} + +void ti85_state::update_ti85_memory () +{ + membank("bank2")->set_base(m_bios + 0x004000*m_ti8x_memory_page_1); +} + +void ti85_state::update_ti83p_memory () +{ + //address_space &space = m_maincpu->space(AS_PROGRAM); + + m_membank1->set_bank(m_booting ? 0x1f : 0); //Always flash page 0, well almost + + if (m_ti83p_port4 & 1) + { + m_membank2->set_bank(m_ti8x_memory_page_1 & 0xfe); + + m_membank3->set_bank(m_ti8x_memory_page_1); + + m_membank4->set_bank(m_ti8x_memory_page_2); + + } + else + { + m_membank2->set_bank(m_ti8x_memory_page_1); + + m_membank3->set_bank(m_ti8x_memory_page_2); + + m_membank4->set_bank(0x40); //Always first ram page + + } +} + +void ti85_state::update_ti83pse_memory () +{ + //address_space &space = m_maincpu->space(AS_PROGRAM); + + m_membank1->set_bank(m_booting ? (m_model==TI84P ? 0x3f : 0x7f) : 0); + + if (m_ti83p_port4 & 1) + { + m_membank2->set_bank(m_ti8x_memory_page_1 & 0xfe); + + m_membank3->set_bank(m_ti8x_memory_page_1 | 1); + + m_membank4->set_bank(m_ti8x_memory_page_2); + + + } + else + { + m_membank2->set_bank(m_ti8x_memory_page_1); + + m_membank3->set_bank(m_ti8x_memory_page_2); + + m_membank4->set_bank(m_ti8x_memory_page_3 + 0x80); + + } +} + +void ti85_state::update_ti86_memory () +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + if (m_ti8x_memory_page_1 & 0x40) + { + ti8x_update_bank(space, 1, m_ti8x_ram, m_ti8x_memory_page_1 & 0x07, true); + } + else + { + ti8x_update_bank(space, 1, m_bios, m_ti8x_memory_page_1 & 0x0f, false); + } + + if (m_ti8x_memory_page_2 & 0x40) + { + ti8x_update_bank(space, 2, m_ti8x_ram, m_ti8x_memory_page_2 & 0x07, true); + } + else + { + ti8x_update_bank(space, 2, m_bios, m_ti8x_memory_page_2 & 0x0f, false); + } + +} + +/*************************************************************************** + Machine Initialization +***************************************************************************/ + +void ti85_state::machine_start() +{ + m_model = TI85; + + address_space &space = m_maincpu->space(AS_PROGRAM); + m_bios = memregion("bios")->base(); + + m_timer_interrupt_mask = 0; + m_timer_interrupt_status = 0; + m_ON_interrupt_mask = 0; + m_ON_interrupt_status = 0; + m_ON_pressed = 0; + m_power_mode = 0; + m_keypad_mask = 0; + m_ti8x_memory_page_1 = 0; + m_LCD_memory_base = 0; + m_LCD_status = 0; + m_LCD_mask = 0; + m_video_buffer_width = 0; + m_interrupt_speed = 0; + m_port4_bit0 = 0; + m_ti81_port_7_data = 0; + + machine().scheduler().timer_pulse(attotime::from_hz(256), timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback),this)); + + space.unmap_write(0x0000, 0x3fff); + space.unmap_write(0x4000, 0x7fff); + membank("bank1")->set_base(m_bios); + membank("bank2")->set_base(m_bios + 0x04000); +} + +MACHINE_RESET_MEMBER(ti85_state,ti85) +{ + m_red_out = 0x00; + m_white_out = 0x00; + m_PCR = 0xc0; +} + +DIRECT_UPDATE_MEMBER(ti85_state::ti83p_direct_update_handler) +{ + if (m_booting) + { + if (((m_ti83p_port4 & 1) && (address >= 0x4000 && address < 0xc000)) || (address >= 0x4000 && address < 0x8000)) + { + m_booting = false; + update_ti83p_memory(); + } + } + return address; +} + + +MACHINE_RESET_MEMBER(ti85_state,ti83p) +{ + m_red_out = 0x00; + m_white_out = 0x00; + m_PCR = 0xc0; + + + m_ti8x_memory_page_1 = 0; + m_ti8x_memory_page_2 = 0; + m_ti8x_memory_page_3 = 0; + m_ti83p_port4 = 1; + m_booting = true; + if (m_model == TI83P) + { + update_ti83p_memory(); + } + else + { + update_ti83pse_memory(); + } +} + +MACHINE_START_MEMBER(ti85_state,ti83p) +{ + m_model = TI83P; + //address_space &space = m_maincpu->space(AS_PROGRAM); + //m_bios = memregion("flash")->base(); + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(ti85_state::ti83p_direct_update_handler), this)); + + m_timer_interrupt_mask = 0; + m_timer_interrupt_status = 0; + m_ON_interrupt_mask = 0; + m_ON_interrupt_status = 0; + m_ON_pressed = 0; + m_ti8x_memory_page_1 = 0; + m_ti8x_memory_page_2 = 0; + m_ti8x_memory_page_3 = 0; + m_LCD_memory_base = 0; + m_LCD_status = 0; + m_LCD_mask = 0; + m_power_mode = 0; + m_keypad_mask = 0; + m_video_buffer_width = 0; + m_interrupt_speed = 0; + m_ti83p_port4 = 1; + m_flash_unlocked = 0; + + m_booting = true; + + ti85_state::update_ti83p_memory(); + + + machine().scheduler().timer_pulse(attotime::from_hz(256), timer_expired_delegate(FUNC(ti85_state::ti83_timer1_callback),this)); + machine().scheduler().timer_pulse(attotime::from_hz(512), timer_expired_delegate(FUNC(ti85_state::ti83_timer2_callback),this)); + + + /* save states and debugging */ + save_item(NAME(m_timer_interrupt_status)); + save_item(NAME(m_timer_interrupt_mask)); + save_item(NAME(m_ti8x_memory_page_1)); + save_item(NAME(m_ti8x_memory_page_2)); + save_item(NAME(m_ti8x_memory_page_3)); + save_item(NAME(m_ti83p_port4)); + save_item(NAME(m_booting)); +} + +void ti85_state::ti8xpse_init_common() +{ + //address_space &space = m_maincpu->space(AS_PROGRAM); + //address_space &asic = ADDRESS_MAP_NAME(ti83p_asic_mem); + + m_timer_interrupt_mask = 0; + m_timer_interrupt_status = 0; + m_ctimer_interrupt_status = 0; + m_ON_interrupt_mask = 0; + m_ON_interrupt_status = 0; + m_ON_pressed = 0; + m_ti8x_memory_page_1 = 0; + m_ti8x_memory_page_2 = 0; + m_ti8x_memory_page_3 = 0; + m_LCD_memory_base = 0; + m_LCD_status = 0; + m_LCD_mask = 0; + m_power_mode = 0; + m_keypad_mask = 0; + m_video_buffer_width = 0; + m_interrupt_speed = 0; + m_ti83p_port4 = 1; + m_flash_unlocked = 0; + + ti85_state::update_ti83pse_memory(); + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(ti85_state::ti83p_direct_update_handler), this)); + + + machine().scheduler().timer_pulse(attotime::from_hz(256), timer_expired_delegate(FUNC(ti85_state::ti83_timer1_callback),this)); + machine().scheduler().timer_pulse(attotime::from_hz(512), timer_expired_delegate(FUNC(ti85_state::ti83_timer2_callback),this)); + + m_crystal_timer1 = timer_alloc(CRYSTAL_TIMER1); + m_crystal_timer2 = timer_alloc(CRYSTAL_TIMER2); + m_crystal_timer3 = timer_alloc(CRYSTAL_TIMER3); + + /* save states and debugging */ + save_item(NAME(m_ctimer_interrupt_status)); + save_item(NAME(m_timer_interrupt_status)); + save_item(NAME(m_ti8x_memory_page_1)); + save_item(NAME(m_ti8x_memory_page_2)); + save_item(NAME(m_ti8x_memory_page_3)); + save_item(NAME(m_ti83p_port4)); +} + + +MACHINE_START_MEMBER(ti85_state,ti83pse) +{ + m_model = TI84PSE; + + ti8xpse_init_common(); +} + +MACHINE_START_MEMBER(ti85_state,ti84pse) +{ + m_model = TI83PSE; + + ti8xpse_init_common(); +} + +MACHINE_START_MEMBER(ti85_state,ti84p) +{ + m_model = TI84P; + + ti8xpse_init_common(); +} + +MACHINE_START_MEMBER(ti85_state,ti86) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + m_bios = memregion("bios")->base(); + + m_timer_interrupt_mask = 0; + m_timer_interrupt_status = 0; + m_ON_interrupt_mask = 0; + m_ON_interrupt_status = 0; + m_ON_pressed = 0; + m_ti8x_memory_page_1 = 0; + m_ti8x_memory_page_2 = 0; + m_LCD_memory_base = 0; + m_LCD_status = 0; + m_LCD_mask = 0; + m_power_mode = 0; + m_keypad_mask = 0; + m_video_buffer_width = 0; + m_interrupt_speed = 0; + m_port4_bit0 = 0; + + m_ti8x_ram = auto_alloc_array(machine(), UINT8, 128*1024); + memset(m_ti8x_ram, 0, sizeof(UINT8)*128*1024); + + space.unmap_write(0x0000, 0x3fff); + + membank("bank1")->set_base(m_bios); + membank("bank2")->set_base(m_bios + 0x04000); + + membank("bank4")->set_base(m_ti8x_ram); + machine().device("nvram")->set_base(m_ti8x_ram, sizeof(UINT8)*128*1024); + + machine().scheduler().timer_pulse(attotime::from_hz(256), timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback),this)); +} + + +/* I/O ports handlers */ + +READ8_MEMBER(ti85_state::ti85_port_0000_r) +{ + return 0xff; +} + +READ8_MEMBER(ti85_state::ti8x_keypad_r) +{ + int data = 0xff; + int port; + int bit; + static const char *const bitnames[] = { "BIT0", "BIT1", "BIT2", "BIT3", "BIT4", "BIT5", "BIT6", "BIT7" }; + + if (m_keypad_mask == 0x7f) return data; + + for (bit = 0; bit < 7; bit++) + { + if (~m_keypad_mask&(0x01<read() & (0x01<>3)&0x03; + m_interrupt_speed = (data>>1)&0x03; + m_port4_bit0 = data&0x01; +} + +WRITE8_MEMBER(ti85_state::ti85_port_0005_w) +{ + m_ti8x_memory_page_1 = data; + update_ti85_memory(); +} + +WRITE8_MEMBER(ti85_state::ti85_port_0006_w) +{ + m_power_mode = data; +} + +WRITE8_MEMBER(ti85_state::ti8x_serial_w) +{ + m_speaker->level_w(BIT(data, 2) | BIT(data, 3)); + m_red_out = BIT(data, 2); + m_white_out = BIT(data, 3); + //ti85serial_red_out( m_serial, 0, m_red_out ); + //ti85serial_white_out( m_serial, 0, m_white_out ); + //ti85_update_serial(m_serial); + m_PCR = data & 0xf0; +} + +WRITE8_MEMBER(ti85_state::ti86_port_0005_w) +{ + m_ti8x_memory_page_1 = data&((data&0x40)?0x47:0x4f); + update_ti86_memory(); +} + +WRITE8_MEMBER(ti85_state::ti86_port_0006_w) +{ + m_ti8x_memory_page_2 = data&((data&0x40)?0x47:0x4f); + update_ti86_memory(); +} + +WRITE8_MEMBER(ti85_state::ti82_port_0002_w) +{ + m_ti8x_memory_page_1 = (data & 0x07); + update_ti85_memory(); + m_ti8x_port2 = data; +} + +WRITE8_MEMBER(ti85_state::ti83_port_0000_w) +{ + m_ti8x_memory_page_1 = (m_ti8x_memory_page_1 & 7) | ((data & 16) >> 1); + update_ti85_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83_port_0002_w) +{ + m_ti8x_memory_page_1 = (m_ti8x_memory_page_1 & 8) | (data & 7); + update_ti85_memory(); + m_ti8x_port2 = data; +} + +WRITE8_MEMBER(ti85_state::ti83_port_0003_w) +{ + if (m_LCD_status && !(data&0x08)) m_timer_interrupt_mask = 0; + m_ON_interrupt_mask = data&0x01; + //m_timer_interrupt_mask = data&0x04; + m_LCD_mask = data&0x02; + m_LCD_status = data&0x08; +} + +WRITE8_MEMBER(ti85_state::ti8x_plus_serial_w) +{ + m_speaker->level_w(BIT(data, 0) | BIT(data, 1)); + m_red_out = BIT(data, 0); + m_white_out = BIT(data, 1); + //ti85serial_red_out( m_serial, 0, m_red_out ); + //ti85serial_white_out( m_serial, 0, m_white_out ); + //ti85_update_serial(m_serial); + m_PCR = data & 0xf0; +} + +WRITE8_MEMBER(ti85_state::ti83pse_int_ack_w) +{ + //Lets ignore this for now, I think it'll be fine. + m_ON_interrupt_status = data & 1; + m_timer_interrupt_status = data & 0x06; +} + +WRITE8_MEMBER(ti85_state::ti83p_int_mask_w) +{ + //m_LCD_mask = (data&0x08) >> 2; + m_ON_interrupt_mask = data & 0x01; + m_ON_interrupt_status &= m_ON_interrupt_mask; + + m_timer_interrupt_mask = data & 0x06; + + m_timer_interrupt_status &= m_timer_interrupt_mask; +} + +WRITE8_MEMBER(ti85_state::ti83p_port_0004_w) +{ + m_ti83p_port4 = data | 0xe0; + update_ti83p_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83p_port_0006_w) +{ + m_ti8x_memory_page_1 = data & ((data&0x40) ? 0x41 : 0x5f); + update_ti83p_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83p_port_0007_w) +{ + m_ti8x_memory_page_2 = data & ((data&0x40) ? 0x41 : 0x5f); + update_ti83p_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83pse_port_0004_w) +{ + m_ti83p_port4 = data; + update_ti83pse_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83pse_port_0005_w) +{ + m_ti8x_memory_page_3 = data & 0x07; + update_ti83pse_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83pse_port_0006_w) +{ + if ((m_model == TI84P) && (data < 0x80)) + { + m_ti8x_memory_page_1 = data & 0x3f; + } + else + { + m_ti8x_memory_page_1 = data; + } + update_ti83pse_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83pse_port_0007_w) +{ + if ((m_model == TI84P) && (data < 0x80)) + { + m_ti8x_memory_page_2 = data & 0x3f; + } + else + { + m_ti8x_memory_page_2 = data; + } + update_ti83pse_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83p_port_0014_w) +{ + m_flash_unlocked = data; + update_ti83pse_memory(); +} + +WRITE8_MEMBER(ti85_state::ti83pse_port_0020_w) +{ + m_cpu_speed = data; + if(data) + { + m_maincpu->set_unscaled_clock(15000000); + } + else + { + m_maincpu->set_unscaled_clock(6000000); + } +} + +READ8_MEMBER(ti85_state::ti83pse_port_0020_r) +{ + return m_cpu_speed; +} + +WRITE8_MEMBER(ti85_state::ti83pse_port_0021_w) +{ + m_ti83pse_port21 = data & 0x0f; +} + +READ8_MEMBER(ti85_state::ti83pse_port_0021_r) +{ + return m_ti83pse_port21; +} + +READ8_MEMBER(ti85_state::ti84pse_port_0055_r) +{ + return 0x1f; +} + +READ8_MEMBER(ti85_state::ti84pse_port_0056_r) +{ + return 0; +} + +//timer ports + +void ti85_state::ti83pse_count( UINT8 timer, UINT8 data) +{ + m_ctimer[timer].max = m_ctimer[timer].count = data; + + if (m_ctimer[timer].setup) + { + switch (m_ctimer[timer].setup & 0x07) + { + case 0x00: + m_ctimer[timer].divsor = 3.0; + break; + case 0x01: + m_ctimer[timer].divsor = 32.0; + break; + case 0x02: + m_ctimer[timer].divsor = 327.000; + break; + case 0x03: + m_ctimer[timer].divsor = 3276.00; + break; + case 0x04: + m_ctimer[timer].divsor = 1.0; + break; + case 0x05: + m_ctimer[timer].divsor = 16.0; + break; + case 0x06: + m_ctimer[timer].divsor = 256.0; + break; + case 0x07: + m_ctimer[timer].divsor = 4096.0; + break; + } + switch (timer) + { + case CRYSTAL_TIMER1: + m_crystal_timer1->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor)); + m_crystal_timer1->enable(true); + break; + case CRYSTAL_TIMER2: + m_crystal_timer2->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor)); + m_crystal_timer2->enable(true); + break; + case CRYSTAL_TIMER3: + m_crystal_timer3->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor)); + m_crystal_timer3->enable(true); + break; + + } + } +} + + +READ8_MEMBER(ti85_state::ti83pse_ctimer1_setup_r) +{ + return m_ctimer[CRYSTAL_TIMER1].setup; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer1_setup_w) +{ + m_crystal_timer1->enable(false); + m_ctimer[CRYSTAL_TIMER1].setup = data; +} + +READ8_MEMBER(ti85_state::ti83pse_ctimer1_loop_r) +{ + return m_ctimer[CRYSTAL_TIMER1].loop; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer1_loop_w) +{ + m_ctimer[CRYSTAL_TIMER1].loop = data & 0x03; + m_ctimer_interrupt_status = 0; +} + +READ8_MEMBER(ti85_state::ti83pse_ctimer1_count_r) +{ + return m_ctimer[CRYSTAL_TIMER1].count; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer1_count_w) +{ + ti83pse_count(CRYSTAL_TIMER1, data); + +} + +// + +READ8_MEMBER(ti85_state::ti83pse_ctimer2_setup_r) +{ + return m_ctimer[CRYSTAL_TIMER2].setup; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer2_setup_w) +{ + m_crystal_timer2->enable(false); + m_ctimer[CRYSTAL_TIMER2].setup = data; +} + +READ8_MEMBER(ti85_state::ti83pse_ctimer2_loop_r) +{ + return m_ctimer[CRYSTAL_TIMER2].loop; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer2_loop_w) +{ + m_ctimer[CRYSTAL_TIMER2].loop = data & 0x03; + m_ctimer_interrupt_status = 0; +} + +READ8_MEMBER(ti85_state::ti83pse_ctimer2_count_r) +{ + return m_ctimer[CRYSTAL_TIMER2].count; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer2_count_w) +{ + ti83pse_count(CRYSTAL_TIMER2, data); + +} + +// + +READ8_MEMBER(ti85_state::ti83pse_ctimer3_setup_r) +{ + return m_ctimer[CRYSTAL_TIMER3].setup; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer3_setup_w) +{ + m_crystal_timer3->enable(false); + m_ctimer[CRYSTAL_TIMER3].setup = data; +} + +READ8_MEMBER(ti85_state::ti83pse_ctimer3_loop_r) +{ + return m_ctimer[CRYSTAL_TIMER3].loop; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer3_loop_w) +{ + m_ctimer[CRYSTAL_TIMER3].loop = data & 0x03; + m_ctimer_interrupt_status = 0; +} + +READ8_MEMBER(ti85_state::ti83pse_ctimer3_count_r) +{ + return m_ctimer[CRYSTAL_TIMER3].count; +} + +WRITE8_MEMBER(ti85_state::ti83pse_ctimer3_count_w) +{ + ti83pse_count(CRYSTAL_TIMER3, data); + +} + + + +/*************************************************************************** + TI calculators snapshot files (SAV) +***************************************************************************/ + +void ti85_state::ti8x_snapshot_setup_registers (UINT8 * data) +{ + unsigned char lo,hi; + unsigned char * reg = data + 0x40; + + /* Set registers */ + lo = reg[0x00] & 0x0ff; + hi = reg[0x01] & 0x0ff; + m_maincpu->set_state_int(Z80_AF, (hi << 8) | lo); + lo = reg[0x04] & 0x0ff; + hi = reg[0x05] & 0x0ff; + m_maincpu->set_state_int(Z80_BC, (hi << 8) | lo); + lo = reg[0x08] & 0x0ff; + hi = reg[0x09] & 0x0ff; + m_maincpu->set_state_int(Z80_DE, (hi << 8) | lo); + lo = reg[0x0c] & 0x0ff; + hi = reg[0x0d] & 0x0ff; + m_maincpu->set_state_int(Z80_HL, (hi << 8) | lo); + lo = reg[0x10] & 0x0ff; + hi = reg[0x11] & 0x0ff; + m_maincpu->set_state_int(Z80_IX, (hi << 8) | lo); + lo = reg[0x14] & 0x0ff; + hi = reg[0x15] & 0x0ff; + m_maincpu->set_state_int(Z80_IY, (hi << 8) | lo); + lo = reg[0x18] & 0x0ff; + hi = reg[0x19] & 0x0ff; + m_maincpu->set_state_int(Z80_PC, (hi << 8) | lo); + lo = reg[0x1c] & 0x0ff; + hi = reg[0x1d] & 0x0ff; + m_maincpu->set_state_int(Z80_SP, (hi << 8) | lo); + lo = reg[0x20] & 0x0ff; + hi = reg[0x21] & 0x0ff; + m_maincpu->set_state_int(Z80_AF2, (hi << 8) | lo); + lo = reg[0x24] & 0x0ff; + hi = reg[0x25] & 0x0ff; + m_maincpu->set_state_int(Z80_BC2, (hi << 8) | lo); + lo = reg[0x28] & 0x0ff; + hi = reg[0x29] & 0x0ff; + m_maincpu->set_state_int(Z80_DE2, (hi << 8) | lo); + lo = reg[0x2c] & 0x0ff; + hi = reg[0x2d] & 0x0ff; + m_maincpu->set_state_int(Z80_HL2, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_IFF1, reg[0x30]&0x0ff); + m_maincpu->set_state_int(Z80_IFF2, reg[0x34]&0x0ff); + m_maincpu->set_state_int(Z80_HALT, reg[0x38]&0x0ff); + m_maincpu->set_state_int(Z80_IM, reg[0x3c]&0x0ff); + m_maincpu->set_state_int(Z80_I, reg[0x40]&0x0ff); + + m_maincpu->set_state_int(Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); + + m_maincpu->set_input_line(0, 0); + m_maincpu->set_input_line(INPUT_LINE_NMI, 0); + m_maincpu->set_input_line(INPUT_LINE_HALT, 0); +} + +void ti85_state::ti85_setup_snapshot (UINT8 * data) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int i; + unsigned char lo,hi; + unsigned char * hdw = data + 0x8000 + 0x94; + + ti8x_snapshot_setup_registers (data); + + /* Memory dump */ + for (i = 0; i < 0x8000; i++) + space.write_byte(i + 0x8000, data[i+0x94]); + + m_keypad_mask = hdw[0x00]&0x7f; + + m_ti8x_memory_page_1 = hdw[0x08]&0xff; + update_ti85_memory(); + + m_power_mode = hdw[0x14]&0xff; + + lo = hdw[0x28] & 0x0ff; + hi = hdw[0x29] & 0x0ff; + m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8; + + m_LCD_status = hdw[0x2c]&0xff ? 0 : 0x08; + if (m_LCD_status) m_LCD_mask = 0x02; + + m_LCD_contrast = hdw[0x30]&0xff; + + m_timer_interrupt_mask = !hdw[0x38]; + m_timer_interrupt_status = 0; + + m_ON_interrupt_mask = !m_LCD_status && m_timer_interrupt_status; + m_ON_interrupt_status = 0; + m_ON_pressed = 0; + + m_video_buffer_width = 0x02; + m_interrupt_speed = 0x03; +} + +void ti85_state::ti86_setup_snapshot (UINT8 * data) +{ + unsigned char lo,hi; + unsigned char * hdw = data + 0x20000 + 0x94; + + ti8x_snapshot_setup_registers ( data); + + /* Memory dump */ + memcpy(m_ti8x_ram, data+0x94, 0x20000); + + m_keypad_mask = hdw[0x00]&0x7f; + + m_ti8x_memory_page_1 = hdw[0x04]&0xff ? 0x40 : 0x00; + m_ti8x_memory_page_1 |= hdw[0x08]&0x0f; + + m_ti8x_memory_page_2 = hdw[0x0c]&0xff ? 0x40 : 0x00; + m_ti8x_memory_page_2 |= hdw[0x10]&0x0f; + + update_ti86_memory(); + + lo = hdw[0x2c] & 0x0ff; + hi = hdw[0x2d] & 0x0ff; + m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8; + + m_LCD_status = hdw[0x30]&0xff ? 0 : 0x08; + if (m_LCD_status) m_LCD_mask = 0x02; + + m_LCD_contrast = hdw[0x34]&0xff; + + m_timer_interrupt_mask = !hdw[0x3c]; + m_timer_interrupt_status = 0; + + m_ON_interrupt_mask = !m_LCD_status && m_timer_interrupt_status; + m_ON_interrupt_status = 0; + m_ON_pressed = 0; + + m_video_buffer_width = 0x02; + m_interrupt_speed = 0x03; +} + +SNAPSHOT_LOAD_MEMBER( ti85_state, ti8x ) +{ + int expected_snapshot_size = 0; + dynamic_buffer ti8x_snapshot_data; + + if (!strncmp(machine().system().name, "ti85", 4)) + expected_snapshot_size = TI85_SNAPSHOT_SIZE; + else if (!strncmp(machine().system().name, "ti86", 4)) + expected_snapshot_size = TI86_SNAPSHOT_SIZE; + + logerror("Snapshot loading\n"); + + if (snapshot_size != expected_snapshot_size) + { + logerror ("Incomplete snapshot file\n"); + return IMAGE_INIT_FAIL; + } + + ti8x_snapshot_data.resize(snapshot_size); + + image.fread( &ti8x_snapshot_data[0], snapshot_size); + + if (!strncmp(machine().system().name, "ti85", 4)) + ti85_setup_snapshot(&ti8x_snapshot_data[0]); + else if (!strncmp(machine().system().name, "ti86", 4)) + ti86_setup_snapshot(&ti8x_snapshot_data[0]); + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/trs80.c b/src/mame/machine/trs80.c new file mode 100644 index 00000000000..980176e109e --- /dev/null +++ b/src/mame/machine/trs80.c @@ -0,0 +1,933 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert and unknown others +/*************************************************************************** + + machine.c + + Functions to emulate general aspects of the machine (RAM, ROM, interrupts, + I/O ports) + +MAX_LUMPS 192 crude storage units - don't know much about it +MAX_GRANULES 8 lumps consisted of granules.. aha +MAX_SECTORS 5 and granules of sectors + +***************************************************************************/ + +#include "includes/trs80.h" + + +#define IRQ_M1_RTC 0x80 /* RTC on Model I */ +#define IRQ_M1_FDC 0x40 /* FDC on Model I */ +#define IRQ_M4_RTC 0x04 /* RTC on Model 4 */ +#define CASS_RISE 0x01 /* high speed cass on Model III/4) */ +#define CASS_FALL 0x02 /* high speed cass on Model III/4) */ +#define MODEL4_MASTER_CLOCK 20275200 + + +TIMER_CALLBACK_MEMBER(trs80_state::cassette_data_callback) +{ +/* This does all baud rates. 250 baud (trs80), and 500 baud (all others) set bit 7 of "cassette_data". + 1500 baud (trs80m3, trs80m4) is interrupt-driven and uses bit 0 of "cassette_data" */ + + double new_val = (m_cassette->input()); + + /* Check for HI-LO transition */ + if ( m_old_cassette_val > -0.2 && new_val < -0.2 ) + { + m_cassette_data |= 0x80; /* 500 baud */ + if (m_mask & CASS_FALL) /* see if 1500 baud */ + { + m_cassette_data = 0; + m_irq |= CASS_FALL; + m_maincpu->set_input_line(0, HOLD_LINE); + } + } + else + if ( m_old_cassette_val < -0.2 && new_val > -0.2 ) + { + if (m_mask & CASS_RISE) /* 1500 baud */ + { + m_cassette_data = 1; + m_irq |= CASS_RISE; + m_maincpu->set_input_line(0, HOLD_LINE); + } + } + + m_old_cassette_val = new_val; +} + + +/************************************* + * + * Port handlers. + * + *************************************/ + + +READ8_MEMBER( trs80_state::trs80m4_e0_r ) +{ +/* Indicates which devices are interrupting - d6..d3 not emulated. + Whenever an interrupt occurs, this port is immediately read + to find out which device requires service. Lowest-numbered + bit takes precedence. We take this opportunity to clear the + cpu INT line. + + d6 RS232 Error (Any of {FE, PE, OR} errors has occurred) + d5 RS232 Rcv (DAV indicates a char ready to be picked up from uart) + d4 RS232 Xmit (TBMT indicates ready to accept another char from cpu) + d3 I/O Bus + d2 RTC + d1 Cass 1500 baud Falling + d0 Cass 1500 baud Rising */ + + m_maincpu->set_input_line(0, CLEAR_LINE); + return ~(m_mask & m_irq); +} + +READ8_MEMBER( trs80_state::trs80m4_e4_r ) +{ +/* Indicates which devices are interrupting - d6..d5 not emulated. + Whenever an NMI occurs, this port is immediately read + to find out which device requires service. Lowest-numbered + bit takes precedence. We take this opportunity to clear the + cpu NMI line. + + d7 status of FDC INTREQ (0=true) + d6 status of Motor Timeout (0=true) + d5 status of Reset signal (0=true - this will reboot the computer) */ + + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + + return ~(m_nmi_mask & m_nmi_data); +} + +READ8_MEMBER( trs80_state::trs80m4_e8_r ) +{ +/* not emulated + d7 Clear-to-Send (CTS), Pin 5 + d6 Data-Set-Ready (DSR), pin 6 + d5 Carrier Detect (CD), pin 8 + d4 Ring Indicator (RI), pin 22 + d3,d2,d0 Not used + d1 UART Receiver Input, pin 20 (pin 20 is also DTR) */ + + return 0; +} + +READ8_MEMBER( trs80_state::trs80m4_ea_r ) +{ +/* UART Status Register + d7 Data Received ('1'=condition true) + d6 Transmitter Holding Register empty ('1'=condition true) + d5 Overrun Error ('1'=condition true) + d4 Framing Error ('1'=condition true) + d3 Parity Error ('1'=condition true) + d2..d0 Not used */ + + UINT8 data=7; + m_ay31015->set_input_pin(AY31015_SWE, 0); + data |= m_ay31015->get_output_pin(AY31015_TBMT) ? 0x40 : 0; + data |= m_ay31015->get_output_pin(AY31015_DAV ) ? 0x80 : 0; + data |= m_ay31015->get_output_pin(AY31015_OR ) ? 0x20 : 0; + data |= m_ay31015->get_output_pin(AY31015_FE ) ? 0x10 : 0; + data |= m_ay31015->get_output_pin(AY31015_PE ) ? 0x08 : 0; + m_ay31015->set_input_pin(AY31015_SWE, 1); + + return data; +} + +READ8_MEMBER( trs80_state::trs80m4_eb_r ) +{ +/* UART received data */ + UINT8 data = m_ay31015->get_received_data(); + m_ay31015->set_input_pin(AY31015_RDAV, 0); + m_ay31015->set_input_pin(AY31015_RDAV, 1); + return data; +} + +READ8_MEMBER( trs80_state::trs80m4_ec_r ) +{ +/* Reset the RTC interrupt */ + m_irq &= ~IRQ_M4_RTC; + return 0; +} + +READ8_MEMBER( trs80_state::sys80_f9_r ) +{ +/* UART Status Register - d6..d4 not emulated + d7 Transmit buffer empty (inverted) + d6 CTS pin + d5 DSR pin + d4 CD pin + d3 Parity Error + d2 Framing Error + d1 Overrun + d0 Data Available */ + + UINT8 data = 70; + m_ay31015->set_input_pin(AY31015_SWE, 0); + data |= m_ay31015->get_output_pin(AY31015_TBMT) ? 0 : 0x80; + data |= m_ay31015->get_output_pin(AY31015_DAV ) ? 0x01 : 0; + data |= m_ay31015->get_output_pin(AY31015_OR ) ? 0x02 : 0; + data |= m_ay31015->get_output_pin(AY31015_FE ) ? 0x04 : 0; + data |= m_ay31015->get_output_pin(AY31015_PE ) ? 0x08 : 0; + m_ay31015->set_input_pin(AY31015_SWE, 1); + + return data; +} + +READ8_MEMBER( trs80_state::lnw80_fe_r ) +{ + return ((m_mode & 0x78) >> 3) | 0xf0; +} + +READ8_MEMBER( trs80_state::trs80_ff_r ) +{ +/* ModeSel and cassette data + d7 cassette data from tape + d2 modesel setting */ + + UINT8 data = (~m_mode & 1) << 5; + return data | m_cassette_data; +} + +READ8_MEMBER( trs80_state::trs80m4_ff_r ) +{ +/* Return of cassette data stream from tape + d7 Low-speed data + d6..d1 info from write of port EC + d0 High-speed data */ + + m_irq &= 0xfc; /* clear cassette interrupts */ + + return m_port_ec | m_cassette_data; +} + + +WRITE8_MEMBER( trs80_state::trs80m4_84_w ) +{ +/* Hi-res graphics control - d6..d4 not emulated + d7 Page Control + d6 Fix upper memory + d5 Memory bit 1 + d4 Memory bit 0 + d3 Invert Video + d2 80/64 width + d1 Select bit 1 + d0 Select bit 0 */ + + /* get address space instead of io space */ + address_space &mem = m_maincpu->space(AS_PROGRAM); + UINT8 *base = m_region_maincpu->base(); + + m_mode = (m_mode & 0x73) | (data & 0x8c); + + m_model4 &= 0xce; + m_model4 |= (data & 3) << 4; + + switch (data & 3) + { + case 0: /* normal operation */ + + if (m_model4 & 4) /* Model 4P gets RAM while Model 4 gets ROM */ + { + if (m_model4 & 8) + m_bank1->set_base(base); + else + m_bank1->set_base(base + 0x10000); + + m_bank2->set_base(base + 0x11000); + m_bank4->set_base(base + 0x137ea); + } + else + { + m_bank1->set_base(base); + m_bank2->set_base(base + 0x01000); + m_bank4->set_base(base + 0x037ea); + } + + m_bank7->set_base(base + 0x14000); + m_bank8->set_base(base + 0x1f400); + m_bank9->set_base(base + 0x1f800); + m_bank11->set_base(base + 0x05000); + m_bank12->set_base(base + 0x06000); + m_bank14->set_base(base + 0x09000); + m_bank15->set_base(base + 0x0a000); + m_bank17->set_base(base + 0x14000); + m_bank18->set_base(base + 0x1f400); + m_bank19->set_base(base + 0x1f800); + mem.install_readwrite_handler (0x37e8, 0x37e9, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this)); /* 3 & 13 */ + mem.install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); /* 5 */ + mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); /* 6 & 16 */ + break; + + case 1: /* write-only ram backs up the rom */ + + if (m_model4 & 4) /* Model 4P gets RAM while Model 4 gets ROM */ + { + if (m_model4 & 8) + m_bank1->set_base(base); + else + m_bank1->set_base(base + 0x10000); + + m_bank2->set_base(base + 0x11000); + m_bank3->set_base(base + 0x137e8); + m_bank4->set_base(base + 0x137ea); + } + else + { + m_bank1->set_base(base); + m_bank2->set_base(base + 0x01000); + m_bank3->set_base(base + 0x037e8); + m_bank4->set_base(base + 0x037ea); + } + + m_bank7->set_base(base + 0x14000); + m_bank8->set_base(base + 0x1f400); + m_bank9->set_base(base + 0x1f800); + m_bank11->set_base(base + 0x10000); + m_bank12->set_base(base + 0x11000); + m_bank13->set_base(base + 0x137e8); + m_bank14->set_base(base + 0x137ea); + m_bank15->set_base(base + 0x0a000); + m_bank17->set_base(base + 0x14000); + m_bank18->set_base(base + 0x1f400); + m_bank19->set_base(base + 0x1f800); + mem.install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); /* 5 */ + mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); /* 6 & 16 */ + break; + + case 2: /* keyboard and video are moved to high memory, and the rest is ram */ + m_bank1->set_base(base + 0x10000); + m_bank2->set_base(base + 0x11000); + m_bank3->set_base(base + 0x137e8); + m_bank4->set_base(base + 0x137ea); + m_bank5->set_base(base + 0x13800); + m_bank6->set_base(base + 0x13c00); + m_bank7->set_base(base + 0x14000); + m_bank11->set_base(base + 0x10000); + m_bank12->set_base(base + 0x11000); + m_bank13->set_base(base + 0x137e8); + m_bank14->set_base(base + 0x137ea); + m_bank15->set_base(base + 0x13800); + m_bank16->set_base(base + 0x13c00); + m_bank17->set_base(base + 0x14000); + m_bank18->set_base(base + 0x0a000); + mem.install_read_handler (0xf400, 0xf7ff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); /* 8 */ + mem.install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); /* 9 & 19 */ + m_model4++; + break; + + case 3: /* 64k of ram */ + m_bank1->set_base(base + 0x10000); + m_bank2->set_base(base + 0x11000); + m_bank3->set_base(base + 0x137e8); + m_bank4->set_base(base + 0x137ea); + m_bank5->set_base(base + 0x13800); + m_bank6->set_base(base + 0x13c00); + m_bank7->set_base(base + 0x14000); + m_bank8->set_base(base + 0x1f400); + m_bank9->set_base(base + 0x1f800); + m_bank11->set_base(base + 0x10000); + m_bank12->set_base(base + 0x11000); + m_bank13->set_base(base + 0x137e8); + m_bank14->set_base(base + 0x137ea); + m_bank15->set_base(base + 0x13800); + m_bank16->set_base(base + 0x13c00); + m_bank17->set_base(base + 0x14000); + m_bank18->set_base(base + 0x1f400); + m_bank19->set_base(base + 0x1f800); + break; + } +} + +WRITE8_MEMBER( trs80_state::trs80m4_90_w ) +{ + m_speaker->level_w(~data & 1); +} + +WRITE8_MEMBER( trs80_state::trs80m4p_9c_w ) /* model 4P only - swaps the ROM with read-only RAM */ +{ + /* Meaning of model4 variable: + d5..d4 memory mode (as described in section above) + d3 rom switch (1=enabled) only effective in mode0 and 1 + d2 this is a Model 4P + d1 this is a Model 4 + d0 Video banking exists yes/no (1=not banked) */ + + m_model4 &= 0xf7; + m_model4 |= (data << 3); + + if ((m_model4) && (~m_model4 & 0x20)) + { + switch (m_model4 & 8) + { + case 0: /* Read-only RAM replaces rom */ + m_bank1->set_base(m_region_maincpu->base() + 0x10000); + break; + case 8: /* Normal setup - rom enabled */ + m_bank1->set_base(m_region_maincpu->base()); + break; + } + } +} + +WRITE8_MEMBER( trs80_state::trs80m4_e0_w ) +{ +/* Interrupt settings - which devices are allowed to interrupt - bits align with read of E0 + d6 Enable Rec Err + d5 Enable Rec Data + d4 Enable Xmit Emp + d3 Enable I/O int + d2 Enable RT int + d1 C fall Int + d0 C Rise Int */ + + m_mask = data; +} + +WRITE8_MEMBER( trs80_state::trs80m4_e4_w ) +{ +/* Disk to NMI interface + d7 1=enable disk INTRQ to generate NMI + d6 1=enable disk Motor Timeout to generate NMI */ + + m_nmi_mask = data; +} + +WRITE8_MEMBER( trs80_state::trs80m4_e8_w ) +{ +/* d1 when '1' enables control register load (see below) */ + + m_reg_load = data & 2; +} + +WRITE8_MEMBER( trs80_state::trs80m4_e9_w ) +{ +/* UART set baud rate. Rx = bits 0..3, Tx = bits 4..7 + 00h 50 + 11h 75 + 22h 110 + 33h 134.5 + 44h 150 + 55h 300 + 66h 600 + 77h 1200 + 88h 1800 + 99h 2000 + AAh 2400 + BBh 3600 + CCh 4800 + DDh 7200 + EEh 9600 + FFh 19200 */ + + static const int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 }; + m_ay31015->set_receiver_clock(baud_clock[data & 0x0f]); + m_ay31015->set_transmitter_clock(baud_clock[data >> 4]); +} + +WRITE8_MEMBER( trs80_state::trs80m4_ea_w ) +{ + if (m_reg_load) + +/* d2..d0 not emulated + d7 Even Parity Enable ('1'=even, '0'=odd) + d6='1',d5='1' for 8 bits + d6='0',d5='1' for 7 bits + d6='1',d5='0' for 6 bits + d6='0',d5='0' for 5 bits + d4 Stop Bit Select ('1'=two stop bits, '0'=one stop bit) + d3 Parity Inhibit ('1'=disable; No parity, '0'=parity enabled) + d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) + d1 Request-to-Send (RTS), pin 4 + d0 Data-Terminal-Ready (DTR), pin 20 */ + + { + m_ay31015->set_input_pin(AY31015_CS, 0); + m_ay31015->set_input_pin(AY31015_NB1, BIT(data, 6)); + m_ay31015->set_input_pin(AY31015_NB2, BIT(data, 5)); + m_ay31015->set_input_pin(AY31015_TSB, BIT(data, 4)); + m_ay31015->set_input_pin(AY31015_EPS, BIT(data, 7)); + m_ay31015->set_input_pin(AY31015_NP, BIT(data, 3)); + m_ay31015->set_input_pin(AY31015_CS, 1); + } + else + { +/* not emulated + d7,d6 Not used + d5 Secondary Unassigned, pin 18 + d4 Secondary Transmit Data, pin 14 + d3 Secondary Request-to-Send, pin 19 + d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) + d1 Data-Terminal-Ready (DTR), pin 20 + d0 Request-to-Send (RTS), pin 4 */ + + } +} + +WRITE8_MEMBER( trs80_state::trs80m4_eb_w ) +{ + m_ay31015->set_transmit_data(data); +} + +WRITE8_MEMBER( trs80_state::trs80m4_ec_w ) +{ +/* Hardware settings - d5..d4 not emulated + d6 CPU fast (1=4MHz, 0=2MHz) + d5 1=Enable Video Wait + d4 1=Enable External I/O bus + d3 1=Enable Alternate Character Set + d2 Mode Select (0=64 chars, 1=32chars) + d1 Cassette Motor (1=On) */ + + m_maincpu->set_unscaled_clock(data & 0x40 ? MODEL4_MASTER_CLOCK/5 : MODEL4_MASTER_CLOCK/10); + + m_mode = (m_mode & 0xde) | ((data & 4) ? 1 : 0) | ((data & 8) ? 0x20 : 0); + + m_cassette->change_state(( data & 2 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR ); + + m_port_ec = data & 0x7e; +} + +/* Selection of drive and parameters - d6..d5 not emulated. + A write also causes the selected drive motor to turn on for about 3 seconds. + When the motor turns off, the drive is deselected. + d7 1=MFM, 0=FM + d6 1=Wait + d5 1=Write Precompensation enabled + d4 0=Side 0, 1=Side 1 + d3 1=select drive 3 + d2 1=select drive 2 + d1 1=select drive 1 + d0 1=select drive 0 */ +WRITE8_MEMBER( trs80_state::trs80m4_f4_w ) +{ + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); + } + + m_fdc->dden_w(!BIT(data, 7)); +} + +WRITE8_MEMBER( trs80_state::sys80_f8_w ) +{ +/* not emulated + d2 reset UART (XR pin) + d1 DTR + d0 RTS */ +} + +WRITE8_MEMBER( trs80_state::sys80_fe_w ) +{ +/* not emulated + d4 select internal or external cassette player */ + + m_tape_unit = (data & 0x10) ? 2 : 1; +} + +/* lnw80 can switch out all the devices, roms and video ram to be replaced by graphics ram. */ +WRITE8_MEMBER( trs80_state::lnw80_fe_w ) +{ +/* lnw80 video options + d3 bankswitch lower 16k between roms and hires ram (1=hires) + d2 enable colour \ + d1 hres / these 2 are the bits from the MODE command of LNWBASIC + d0 inverse video (entire screen) */ + + /* get address space instead of io space */ + address_space &mem = m_maincpu->space(AS_PROGRAM); + + m_mode = (m_mode & 0x87) | ((data & 0x0f) << 3); + + if (data & 8) + { + mem.unmap_readwrite (0x0000, 0x3fff); + mem.install_readwrite_handler (0x0000, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_gfxram_r), this), write8_delegate(FUNC(trs80_state::trs80_gfxram_w), this)); + } + else + { + mem.unmap_readwrite (0x0000, 0x3fff); + mem.install_read_bank (0x0000, 0x2fff, "bank1"); + membank("bank1")->set_base(m_region_maincpu->base()); + mem.install_readwrite_handler (0x37e0, 0x37e3, read8_delegate(FUNC(trs80_state::trs80_irq_status_r), this), write8_delegate(FUNC(trs80_state::trs80_motor_w), this)); + mem.install_readwrite_handler (0x37e8, 0x37eb, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this)); + mem.install_read_handler (0x37ec, 0x37ec, read8_delegate(FUNC(trs80_state::trs80_wd179x_r), this)); + mem.install_write_handler (0x37ec, 0x37ec, write8_delegate(FUNC(fd1793_t::cmd_w),(fd1793_t*)m_fdc)); + mem.install_readwrite_handler (0x37ed, 0x37ed, read8_delegate(FUNC(fd1793_t::track_r),(fd1793_t*)m_fdc), write8_delegate(FUNC(fd1793_t::track_w),(fd1793_t*)m_fdc)); + mem.install_readwrite_handler (0x37ee, 0x37ee, read8_delegate(FUNC(fd1793_t::sector_r),(fd1793_t*)m_fdc), write8_delegate(FUNC(fd1793_t::sector_w),(fd1793_t*)m_fdc)); + mem.install_readwrite_handler (0x37ef, 0x37ef, read8_delegate(FUNC(fd1793_t::data_r),(fd1793_t*)m_fdc),write8_delegate( FUNC(fd1793_t::data_w),(fd1793_t*)m_fdc)); + mem.install_read_handler (0x3800, 0x38ff, 0, 0x0300, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); + mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); + } +} + +WRITE8_MEMBER( trs80_state::trs80_ff_w ) +{ +/* Standard output port of Model I + d3 ModeSel bit + d2 Relay + d1, d0 Cassette output */ + + static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 }; + static int init = 0; + + m_cassette->change_state(( data & 4 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR ); + m_cassette->output(levels[data & 3]); + m_cassette_data &= ~0x80; + + m_mode = (m_mode & 0xfe) | ((data & 8) >> 3); + + if (!init) + { + init = 1; + static INT16 speaker_levels[4] = { 0, -32768, 0, 32767 }; + m_speaker->static_set_levels(*m_speaker, 4, speaker_levels); + + } + /* Speaker for System-80 MK II - only sounds if relay is off */ + if (~data & 4) + m_speaker->level_w(data & 3); +} + +WRITE8_MEMBER( trs80_state::trs80m4_ff_w ) +{ +/* Cassette port + d1, d0 Cassette output */ + + static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 }; + m_cassette->output(levels[data & 3]); + m_cassette_data &= ~0x80; +} + + +/************************************* + * + * Interrupt handlers. + * + *************************************/ + +INTERRUPT_GEN_MEMBER(trs80_state::trs80_rtc_interrupt) +{ +/* This enables the processing of interrupts for the clock and the flashing cursor. + The OS counts one tick for each interrupt. The Model I has 40 ticks per + second, while the Model III/4 has 30. */ + + if (m_model4) // Model 4 + { + if (m_mask & IRQ_M4_RTC) + { + m_irq |= IRQ_M4_RTC; + device.execute().set_input_line(0, HOLD_LINE); + } + } + else // Model 1 + { + m_irq |= IRQ_M1_RTC; + device.execute().set_input_line(0, HOLD_LINE); + } +} + +void trs80_state::trs80_fdc_interrupt_internal() +{ + if (m_model4) + { + if (m_nmi_mask & 0x80) // Model 4 does a NMI + { + m_nmi_data = 0x80; + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } + } + else // Model 1 does a IRQ + { + m_irq |= IRQ_M1_FDC; + m_maincpu->set_input_line(0, HOLD_LINE); + } +} + +INTERRUPT_GEN_MEMBER(trs80_state::trs80_fdc_interrupt)/* not used - should it be? */ +{ + trs80_fdc_interrupt_internal(); +} + +WRITE_LINE_MEMBER(trs80_state::trs80_fdc_intrq_w) +{ + if (state) + { + trs80_fdc_interrupt_internal(); + } + else + { + if (m_model4) + m_nmi_data = 0; + else + m_irq &= ~IRQ_M1_FDC; + } +} + + +/************************************* + * * + * Memory handlers * + * * + *************************************/ + +READ8_MEMBER( trs80_state::trs80_wd179x_r ) +{ + UINT8 data = 0xff; + if (BIT(m_io_config->read(), 7)) + data = m_fdc->status_r(space, offset); + + return data; +} + +READ8_MEMBER( trs80_state::trs80_printer_r ) +{ + return m_cent_status_in->read(); +} + +WRITE8_MEMBER( trs80_state::trs80_printer_w ) +{ + m_cent_data_out->write(space, 0, data); + m_centronics->write_strobe(0); + m_centronics->write_strobe(1); +} + +WRITE8_MEMBER( trs80_state::trs80_cassunit_w ) +{ +/* not emulated + 01 for unit 1 (default) + 02 for unit 2 */ + + m_tape_unit = data; +} + +READ8_MEMBER( trs80_state::trs80_irq_status_r ) +{ +/* (trs80l2) Whenever an interrupt occurs, 37E0 is read to see what devices require service. + d7 = RTC + d6 = FDC + d2 = Communications (not emulated) + All interrupting devices are serviced in a single interrupt. There is a mask byte, + which is dealt with by the DOS. We take the opportunity to reset the cpu INT line. */ + + int result = m_irq; + m_maincpu->set_input_line(0, CLEAR_LINE); + m_irq = 0; + return result; +} + + +WRITE8_MEMBER( trs80_state::trs80_motor_w ) +{ + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_fdc->set_floppy(floppy); + + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(BIT(data, 4)); + } + + // switch to fm + m_fdc->dden_w(1); +} + +/************************************* + * Keyboard * + *************************************/ +READ8_MEMBER( trs80_state::trs80_keyboard_r ) +{ + UINT8 result = 0; + + if (offset & 1) + result |= m_io_line0->read(); + if (offset & 2) + result |= m_io_line1->read(); + if (offset & 4) + result |= m_io_line2->read(); + if (offset & 8) + result |= m_io_line3->read(); + if (offset & 16) + result |= m_io_line4->read(); + if (offset & 32) + result |= m_io_line5->read(); + if (offset & 64) + result |= m_io_line6->read(); + if (offset & 128) + result |= m_io_line7->read(); + + return result; +} + + +/************************************* + * Machine * + *************************************/ + +void trs80_state::machine_start() +{ + m_tape_unit=1; + m_reg_load=1; + m_nmi_data=0xff; + + m_cassette_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(trs80_state::cassette_data_callback),this)); + m_cassette_data_timer->adjust( attotime::zero, 0, attotime::from_hz(11025) ); +} + +void trs80_state::machine_reset() +{ + m_cassette_data = 0; +} + +MACHINE_RESET_MEMBER(trs80_state,trs80m4) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + m_cassette_data = 0; + + mem.install_read_bank (0x0000, 0x0fff, "bank1"); + m_bank1 = membank("bank1"); + mem.install_read_bank (0x1000, 0x37e7, "bank2"); + m_bank2 = membank("bank2"); + mem.install_read_bank (0x37e8, 0x37e9, "bank3"); + m_bank3 = membank("bank3"); + mem.install_read_bank (0x37ea, 0x37ff, "bank4"); + m_bank4 = membank("bank4"); + mem.install_read_bank (0x3800, 0x3bff, "bank5"); + m_bank5 = membank("bank5"); + mem.install_read_bank (0x3c00, 0x3fff, "bank6"); + m_bank6 = membank("bank6"); + mem.install_read_bank (0x4000, 0xf3ff, "bank7"); + m_bank7 = membank("bank7"); + mem.install_read_bank (0xf400, 0xf7ff, "bank8"); + m_bank8 = membank("bank8"); + mem.install_read_bank (0xf800, 0xffff, "bank9"); + m_bank9 = membank("bank9"); + + mem.install_write_bank (0x0000, 0x0fff, "bank11"); + m_bank11 = membank("bank11"); + mem.install_write_bank (0x1000, 0x37e7, "bank12"); + m_bank12 = membank("bank12"); + mem.install_write_bank (0x37e8, 0x37e9, "bank13"); + m_bank13 = membank("bank13"); + mem.install_write_bank (0x37ea, 0x37ff, "bank14"); + m_bank14 = membank("bank14"); + mem.install_write_bank (0x3800, 0x3bff, "bank15"); + m_bank15 = membank("bank15"); + mem.install_write_bank (0x3c00, 0x3fff, "bank16"); + m_bank16 = membank("bank16"); + mem.install_write_bank (0x4000, 0xf3ff, "bank17"); + m_bank17 = membank("bank17"); + mem.install_write_bank (0xf400, 0xf7ff, "bank18"); + m_bank18 = membank("bank18"); + mem.install_write_bank (0xf800, 0xffff, "bank19"); + m_bank19 = membank("bank19"); + trs80m4p_9c_w(mem, 0, 1); /* Enable the ROM */ + trs80m4_84_w(mem, 0, 0); /* switch in devices at power-on */ +} + +MACHINE_RESET_MEMBER(trs80_state,lnw80) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + m_cassette_data = 0; + m_reg_load = 1; + lnw80_fe_w(space, 0, 0); +} + + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +#define LOG 1 + +#define CMD_TYPE_OBJECT_CODE 0x01 +#define CMD_TYPE_TRANSFER_ADDRESS 0x02 +#define CMD_TYPE_END_OF_PARTITIONED_DATA_SET_MEMBER 0x04 +#define CMD_TYPE_LOAD_MODULE_HEADER 0x05 +#define CMD_TYPE_PARTITIONED_DATA_SET_HEADER 0x06 +#define CMD_TYPE_PATCH_NAME_HEADER 0x07 +#define CMD_TYPE_ISAM_DIRECTORY_ENTRY 0x08 +#define CMD_TYPE_END_OF_ISAM_DIRECTORY_ENTRY 0x0a +#define CMD_TYPE_PDS_DIRECTORY_ENTRY 0x0c +#define CMD_TYPE_END_OF_PDS_DIRECTORY_ENTRY 0x0e +#define CMD_TYPE_YANKED_LOAD_BLOCK 0x10 +#define CMD_TYPE_COPYRIGHT_BLOCK 0x1f + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +QUICKLOAD_LOAD_MEMBER( trs80_state, trs80_cmd ) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + UINT8 type, length; + UINT8 data[0x100]; + UINT8 addr[2]; + void *ptr; + + while (!image.image_feof()) + { + image.fread( &type, 1); + image.fread( &length, 1); + + length -= 2; + int block_length = length ? length : 256; + + switch (type) + { + case CMD_TYPE_OBJECT_CODE: + { + image.fread( &addr, 2); + UINT16 address = (addr[1] << 8) | addr[0]; + if (LOG) logerror("/CMD object code block: address %04x length %u\n", address, block_length); + ptr = program.get_write_ptr(address); + image.fread( ptr, block_length); + } + break; + + case CMD_TYPE_TRANSFER_ADDRESS: + { + image.fread( &addr, 2); + UINT16 address = (addr[1] << 8) | addr[0]; + if (LOG) logerror("/CMD transfer address %04x\n", address); + m_maincpu->set_state_int(Z80_PC, address); + } + break; + + case CMD_TYPE_LOAD_MODULE_HEADER: + image.fread( &data, block_length); + if (LOG) logerror("/CMD load module header '%s'\n", data); + break; + + case CMD_TYPE_COPYRIGHT_BLOCK: + image.fread( &data, block_length); + if (LOG) logerror("/CMD copyright block '%s'\n", data); + break; + + default: + image.fread( &data, block_length); + logerror("/CMD unsupported block type %u!\n", type); + } + } + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/trs80m2kb.c b/src/mame/machine/trs80m2kb.c new file mode 100644 index 00000000000..01f4dc7930a --- /dev/null +++ b/src/mame/machine/trs80m2kb.c @@ -0,0 +1,392 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Tandy Radio Shack TRS-80 Model II keyboard emulation + +**********************************************************************/ + +#include "trs80m2kb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8021_TAG "z4" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type TRS80M2_KEYBOARD = &device_creator; + + + +//------------------------------------------------- +// ROM( trs80m2_keyboard ) +//------------------------------------------------- + +ROM_START( trs80m2_keyboard ) + ROM_REGION( 0x400, I8021_TAG, 0 ) + ROM_LOAD( "65-1991.z4", 0x0000, 0x0400, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *trs80m2_keyboard_device::device_rom_region() const +{ + return ROM_NAME( trs80m2_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( kb_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( trs80m2_keyboard_io, AS_IO, 8, trs80m2_keyboard_device ) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(kb_t1_r) + AM_RANGE(MCS48_PORT_P0, MCS48_PORT_P0) AM_READ(kb_p0_r) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kb_p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_DRIVER( trs80m2_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( trs80m2_keyboard ) + MCFG_CPU_ADD(I8021_TAG, I8021, 3000000) // 1000uH inductor connected across the XTAL inputs + MCFG_CPU_IO_MAP(trs80m2_keyboard_io) + MCFG_DEVICE_DISABLE() // TODO +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor trs80m2_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( trs80m2_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( trs80m2_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( trs80m2_keyboard ) + PORT_START("Y0") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y1") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPEAT") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("Y3") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("cannot read label") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + + PORT_START("Y4") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + + PORT_START("Y5") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOLD") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + + PORT_START("Y6") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) + + PORT_START("Y7") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) + + PORT_START("Y8") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) + + PORT_START("Y9") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("YA") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("YB") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor trs80m2_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( trs80m2_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// trs80m2_keyboard_device - constructor +//------------------------------------------------- + +trs80m2_keyboard_device::trs80m2_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TRS80M2_KEYBOARD, "TRS-80 Model II Keyboard", tag, owner, clock, "trs80m2kb", __FILE__), + m_maincpu(*this, I8021_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_ya(*this, "YA"), + m_yb(*this, "YB"), + m_write_clock(*this), + m_busy(1), + m_data(1), + m_clk(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void trs80m2_keyboard_device::device_start() +{ + // resolve callbacks + m_write_clock.resolve_safe(); + + // state saving + save_item(NAME(m_busy)); + save_item(NAME(m_data)); + save_item(NAME(m_clk)); + save_item(NAME(m_y)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void trs80m2_keyboard_device::device_reset() +{ +} + + +//------------------------------------------------- +// busy_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( trs80m2_keyboard_device::busy_w ) +{ + m_busy = state; +} + + +//------------------------------------------------- +// data_r - +//------------------------------------------------- + +READ_LINE_MEMBER( trs80m2_keyboard_device::data_r ) +{ + return m_data; +} + +//------------------------------------------------- +// kb_t1_r - +//------------------------------------------------- + +READ8_MEMBER( trs80m2_keyboard_device::kb_t1_r ) +{ + return m_busy; +} + + +//------------------------------------------------- +// kb_p0_r - +//------------------------------------------------- + +READ8_MEMBER( trs80m2_keyboard_device::kb_p0_r ) +{ + UINT8 data = 0xff; + + switch (m_y) + { + case 0: data &= m_y0->read(); break; + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 9: data &= m_y9->read(); break; + case 0xa: data &= m_ya->read(); break; + case 0xb: data &= m_yb->read(); break; + } + + return data; +} + + +//------------------------------------------------- +// kb_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( trs80m2_keyboard_device::kb_p1_w ) +{ + /* + + bit description + + 0 DATA + 1 CLOCK + 2 LED + 3 + 4 LED + 5 + 6 + 7 + + */ + + m_data = BIT(data, 0); + int clk = BIT(data, 1); + + if (m_clk != clk) + { + m_write_clock(clk); + m_clk = clk; + } + + output_set_led_value(LED_0, BIT(data, 2)); + output_set_led_value(LED_1, BIT(data, 4)); +} + + +//------------------------------------------------- +// kb_p2_w - +//------------------------------------------------- + +WRITE8_MEMBER( trs80m2_keyboard_device::kb_p2_w ) +{ + /* + + bit description + + 0 D + 1 C + 2 B + 3 A + 4 + 5 + 6 + 7 + + */ + + m_y = BITSWAP8(data, 7, 6, 5, 4, 0, 1, 2, 3) & 0x0f; +} diff --git a/src/mame/machine/trs80m2kb.h b/src/mame/machine/trs80m2kb.h new file mode 100644 index 00000000000..be665372e2b --- /dev/null +++ b/src/mame/machine/trs80m2kb.h @@ -0,0 +1,106 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Tandy Radio Shack TRS-80 Model II keyboard emulation + +**********************************************************************/ + +#pragma once + +#ifndef __TRS80M2_KEYBOARD__ +#define __TRS80M2_KEYBOARD__ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "sound/discrete.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define TRS80M2_KEYBOARD_TAG "trs80m2kb" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_TRS80M2_KEYBOARD_CLOCK_CALLBACK(_write) \ + devcb = &trs80m2_keyboard_device::set_clock_wr_callback(*device, DEVCB_##_write); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> trs80m2_keyboard_device + +class trs80m2_keyboard_device : public device_t +{ +public: + // construction/destruction + trs80m2_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_clock_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clock.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_WRITE_LINE_MEMBER( busy_w ); + DECLARE_READ_LINE_MEMBER( data_r ); + + // not really public + DECLARE_READ8_MEMBER( kb_t1_r ); + DECLARE_READ8_MEMBER( kb_p0_r ); + DECLARE_WRITE8_MEMBER( kb_p1_w ); + DECLARE_WRITE8_MEMBER( kb_p2_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + enum + { + LED_0 = 0, + LED_1 + }; + + required_device m_maincpu; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_ya; + required_ioport m_yb; + + devcb_write_line m_write_clock; + + int m_busy; + int m_data; + int m_clk; + + UINT8 m_y; +}; + + +// device type definition +extern const device_type TRS80M2_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/upd65031.c b/src/mame/machine/upd65031.c new file mode 100644 index 00000000000..86d9ff5e093 --- /dev/null +++ b/src/mame/machine/upd65031.c @@ -0,0 +1,621 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/********************************************************************** + + NEC uPD65031 'BLINK' emulation + + the uPD65031 manages almost everything in the Z88: + - memory bankswitch + - interrupts + - RTC + - LCD + - keyboard + - serial + - speaker + + TODO: + - coma and snooze mode + - speaker controlled by txd + - EPROM programming + - UART + +*********************************************************************/ + + +#include "upd65031.h" + + +// device type definition +const device_type UPD65031 = &device_creator; + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + +#define SPEAKER_ALARM_FREQ attotime::from_hz(3200) + +// internal registers +enum +{ + // write registers + REG_PB0 = 0x70, // pixel base 0 + REG_PB1 = 0x71, // pixel base 1 + REG_PB2 = 0x72, // pixel base 2 + REG_PB3 = 0x73, // pixel base 3 + REG_SBR = 0x74, // screen base register + + REG_COM = 0xb0, // command register + REG_INT = 0xb1, // interrupt control + REG_EPR = 0xb3, // EPROM programming + REG_TACK = 0xb4, // RTC acknowledge + REG_TMK = 0xb5, // RTC interrupt mask + REG_ACK = 0xb6, // interrupt acknowledge + + REG_SR0 = 0xd0, // segment register 0 + REG_SR1 = 0xd1, // segment register 1 + REG_SR2 = 0xd2, // segment register 2 + REG_SR3 = 0xd3, // segment register 3 + + REG_RXC = 0xe2, // UART receiver control + REG_TXD = 0xe3, // UART transmit data + REG_TXC = 0xe4, // UART transmit control + REG_UMK = 0xe5, // UART interrupt mask + REG_UAK = 0xe6, // UART interrupt acknowledge + + + // read registers + REG_STA = 0xb1, // interrupt status + REG_KBD = 0xb2, // keyboard read + REG_TSTA = 0xb5, // RTC interrupt status + + REG_TIM0 = 0xd0, // RTC 5ms counter + REG_TIM1 = 0xd1, // RTC seconds counter (6 bits) + REG_TIM2 = 0xd2, // RTC minutes counter + REG_TIM3 = 0xd3, // RTC minutes/256 counter + REG_TIM4 = 0xd4, // RTC minutes/65536 counter (5 bits) + + REG_RXD = 0xe0, // UART receive data register + REG_RXE = 0xe1, // UART extended receiver data + REG_UIT = 0xe5 // UART interrupt status +}; + +//mode +enum +{ + STATE_AWAKE = 0, + STATE_SNOOZE, + STATE_COMA +}; + +// interrupt status +#define STA_FLAPOPEN 0x80 +#define STA_A19 0x40 +#define STA_FLAP 0x20 +#define STA_UART 0x10 +#define STA_BTL 0x08 +#define STA_KEY 0x04 +#define STA_TIME 0x01 + +// interrupt control +#define INT_KWAIT 0x80 +#define INT_A19 0x40 +#define INT_FLAP 0x20 +#define INT_UART 0x10 +#define INT_BTL 0x08 +#define INT_KEY 0x04 +#define INT_TIME 0x02 +#define INT_GINT 0x01 + +// command register +#define COM_SRUN 0x80 +#define COM_SBIT 0x40 +#define COM_OVERP 0x20 +#define COM_RESTIM 0x10 +#define COM_PROGRAM 0x08 +#define COM_RAMS 0x04 +#define COM_VPPON 0x02 +#define COM_LCDON 0x01 + +// EPROM programming register +#define EPR_PD1 0x80 +#define EPR_PD0 0x40 +#define EPR_PGMD 0x20 +#define EPR_EOED 0x10 +#define EPR_SE3D 0x08 +#define EPR_PGMP 0x04 +#define EPR_EOEP 0x02 +#define EPR_SE3P 0x01 + +// RTC interrupt status +#define TSTA_MIN 0x04 +#define TSTA_SEC 0x02 +#define TSTA_TICK 0x01 + +//************************************************************************** +// INLINE HELPERS +//************************************************************************** + +inline void upd65031_device::interrupt_refresh() +{ + if ((m_int & INT_GINT) && ((m_int & m_sta & 0x7c) || ((m_int & INT_TIME) && (m_sta & STA_TIME)))) + { + if (LOG) logerror("uPD65031 '%s': set int\n", tag()); + + m_write_int(ASSERT_LINE); + } + else + { + if (LOG) logerror("uPD65031 '%s': clear int\n", tag()); + + m_write_int(CLEAR_LINE); + } +} + + +inline void upd65031_device::update_rtc_interrupt() +{ + // any ints occurred? + if ((m_int & INT_GINT) && (m_int & INT_TIME) && (m_tsta & (TSTA_MIN | TSTA_SEC | TSTA_TICK))) + m_sta |= STA_TIME; + else + m_sta &= ~STA_TIME; +} + + +inline void upd65031_device::set_mode(int mode) +{ + if (m_mode != mode) + { + m_mode = mode; + + switch(mode) + { + case STATE_AWAKE: + //TODO + break; + case STATE_SNOOZE: + //TODO + break; + case STATE_COMA: + //TODO + break; + } + } +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// upd65031_device - constructor +//------------------------------------------------- + +upd65031_device::upd65031_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD65031, "NEC uPD65031", tag, owner, clock, "upd65031", __FILE__), + m_read_kb(*this), + m_write_int(*this), + m_write_nmi(*this), + m_write_spkr(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd65031_device::device_start() +{ + // resolve callbacks + m_read_kb.resolve_safe(0); + m_write_int.resolve_safe(); + m_write_nmi.resolve_safe(); + m_write_spkr.resolve_safe(); + + // bind delegates + m_screen_update_cb.bind_relative_to(*owner()); + m_out_mem_cb.bind_relative_to(*owner()); + + // allocate timers + m_rtc_timer = timer_alloc(TIMER_RTC); + m_flash_timer = timer_alloc(TIMER_FLASH); + m_speaker_timer = timer_alloc(TIMER_SPEAKER); + m_rtc_timer->adjust(attotime::from_msec(5), 0, attotime::from_msec(5)); + m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); + m_speaker_timer->reset(); + + // state saving + save_item(NAME(m_mode)); + save_item(NAME(m_lcd_regs)); + save_item(NAME(m_tim)); + save_item(NAME(m_sr)); + save_item(NAME(m_sta)); + save_item(NAME(m_int)); + save_item(NAME(m_ack)); + save_item(NAME(m_tsta)); + save_item(NAME(m_tmk)); + save_item(NAME(m_tack)); + save_item(NAME(m_com)); + save_item(NAME(m_flash)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd65031_device::device_reset() +{ + memset(m_lcd_regs, 0, sizeof(m_lcd_regs)); + memset(m_tim, 0, sizeof(m_tim)); + memset(m_sr, 0, sizeof(m_sr)); + m_sta = 0; + m_int = 0; + m_ack = 0; + m_tsta = 0; + m_tmk = TSTA_TICK | TSTA_SEC | TSTA_MIN; + m_tack = 0; + m_com = 0; + m_flash = 0; + m_mode = 0; + set_mode(STATE_AWAKE); + + if (!m_out_mem_cb.isnull()) + { + // reset bankswitch + m_out_mem_cb(0, 0, 0); + m_out_mem_cb(1, 0, 0); + m_out_mem_cb(2, 0, 0); + m_out_mem_cb(3, 0, 0); + } +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void upd65031_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_RTC: + + // if a key is pressed sets the interrupt + if ((m_int & INT_GINT) && (m_int & INT_KEY) && m_read_kb(0) != 0xff) + { + if (LOG) logerror("uPD65031 '%s': Keyboard interrupt!\n", tag()); + + // awakes CPU from snooze on key down + if (m_mode == STATE_SNOOZE) + set_mode(STATE_AWAKE); + + m_sta |= STA_KEY; + } + else + { + m_sta &= ~STA_KEY; + } + + // hold clock at reset? - in this mode it doesn't update + if (!(m_com & COM_RESTIM)) + { + bool irq_change = false; + + // update 5 millisecond counter + m_tim[0]++; + + // tick + if (m_tim[0] & 1) + { + // set tick int has occurred + if (m_tmk & TSTA_TICK) + { + m_tsta |= TSTA_TICK; + irq_change = true; + } + } + + if (m_tim[0] == 200) + { + m_tim[0] = 0; + + // set seconds int has occurred + if (m_tmk & TSTA_SEC) + { + m_tsta |= TSTA_SEC; + irq_change = true; + } + + m_tim[1]++; + + if (m_tim[1] == 60) + { + // set minutes int has occurred + if (m_tmk & TSTA_MIN) + { + m_tsta |= TSTA_MIN; + irq_change = true; + } + m_tim[1] = 0; + m_tim[2]++; + + if (m_tim[2] == 0) // overflowed from 255 + { + m_tim[3]++; + + if (m_tim[3] == 0) // overflowed from 255 + { + m_tim[4]++; + + if (m_tim[4] == 32) + m_tim[4] = 0; + } + } + } + } + + if ((m_int & INT_GINT) && (m_int & INT_TIME) && irq_change && !(m_sta & STA_FLAPOPEN)) + { + set_mode(STATE_AWAKE); + + update_rtc_interrupt(); + } + + // refresh interrupt + interrupt_refresh(); + } + break; + case TIMER_FLASH: + m_flash = !m_flash; + break; + case TIMER_SPEAKER: + m_speaker_state = !m_speaker_state; + m_write_spkr(m_speaker_state ? 1 : 0); + break; + } +} + + +//------------------------------------------------- +// screen_update +//------------------------------------------------- + +UINT32 upd65031_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + if (!m_screen_update_cb.isnull() && (m_com & COM_LCDON)) + m_screen_update_cb(bitmap, m_lcd_regs[4], m_lcd_regs[2], m_lcd_regs[3], m_lcd_regs[0], m_lcd_regs[1], m_flash); + else + bitmap.fill(0, cliprect); + + return 0; +} + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( upd65031_device::read ) +{ + UINT8 port = offset & 0xff; + + switch (port) + { + case REG_STA: // read interrupt status + return m_sta; + + case REG_KBD: + { + // if set, reading the keyboard will put into snooze + if (m_int & INT_KWAIT) + { + set_mode(STATE_SNOOZE); + + if (LOG) logerror("uPD65031 '%s': entering snooze!\n", tag()); + } + + UINT8 data = m_read_kb(offset>>8); + + if (LOG) logerror("uPD65031 '%s': key r %02x: %02x\n", tag(), offset>>8, data); + + return data; + } + + // read real time clock status + case REG_TSTA: + if (LOG) logerror("uPD65031 '%s': tsta r: %02x\n", tag(), m_tsta); + return m_tsta & 0x07; + + // read real time clock counters + case REG_TIM0: + if (LOG) logerror("uPD65031 '%s': TIM0 r: %02x\n", tag(), m_tim[0]); + return m_tim[0]; + case REG_TIM1: + if (LOG) logerror("uPD65031 '%s': TIM1 r: %02x\n", tag(), m_tim[1]); + return m_tim[1]; + case REG_TIM2: + if (LOG) logerror("uPD65031 '%s': TIM2 r: %02x\n", tag(), m_tim[2]); + return m_tim[2]; + case REG_TIM3: + if (LOG) logerror("uPD65031 '%s': TIM3 r: %02x\n", tag(), m_tim[3]); + return m_tim[3]; + case REG_TIM4: + if (LOG) logerror("uPD65031 '%s': TIM4 r: %02x\n", tag(), m_tim[4]); + return m_tim[4]; + + // UART + case REG_RXD: + case REG_RXE: + case REG_UIT: + // TODO + return 0; + + default: + logerror("uPD65031 '%s': blink r: %04x\n", tag(), offset); + return 0; + } +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( upd65031_device::write ) +{ + UINT8 port = offset & 0xff; + + switch (port) + { + // gfx registers + case REG_PB0: + case REG_PB1: + case REG_PB2: + case REG_PB3: + case REG_SBR: + m_lcd_regs[port - REG_PB0] = ((offset & 0xff00) | data); + break; + + case REG_COM: // command register + if (LOG) logerror("uPD65031 '%s': com w: %02x\n", tag(), data); + + // reset clock? + if (data & COM_RESTIM) + m_tim[0] = m_tim[1] = m_tim[2] = m_tim[3] = m_tim[4] = 0; + + if ((data & COM_SRUN) && !(data & COM_SBIT)) + { + // constant tone used for keyclick and alarm + m_speaker_timer->adjust(SPEAKER_ALARM_FREQ, 0, SPEAKER_ALARM_FREQ); + } + else + { + if (!(data & COM_SRUN)) + { + // speaker controlled by SBIT + m_speaker_state = BIT(data, 6); + m_write_spkr(m_speaker_state); + } + else + { + // speaker controlled by txd line + // TODO + } + + m_speaker_timer->reset(); + } + + // bit 2 controls the lower 8kb of memory + if (BIT(m_com^data, 2) && !m_out_mem_cb.isnull()) + m_out_mem_cb(0, m_sr[0], BIT(data, 2)); + + m_com = data; + break; + + case REG_INT: // interrupt control + if (LOG) logerror("uPD65031 '%s': int w: %02x\n", tag(), data); + + m_int = data; + + // refresh ints + update_rtc_interrupt(); + interrupt_refresh(); + break; + + case REG_EPR: // EPROM programming register + if (LOG) logerror("uPD65031 '%s': epr w: %02x\n", tag(), data); + // TODO + break; + + case REG_TACK: // rtc interrupt acknowledge + if (LOG) logerror("uPD65031 '%s': tack w: %02x\n", tag(), data); + + // clear ints that have occurred + m_tsta &= ~(data & 0x07); + m_tack = data; + + // refresh ints + update_rtc_interrupt(); + interrupt_refresh(); + break; + + case REG_TMK: // write rtc interrupt mask + if (LOG) logerror("uPD65031 '%s': tmk w: %02x\n", tag(), data); + + m_tmk = data & 0x07; + break; + + case REG_ACK: // acknowledge ints + if (LOG) logerror("uPD65031 '%s': ack w: %02x\n", tag(), data); + + m_ack = data; + m_sta &= ~(data & 0x7f); + + // refresh ints + interrupt_refresh(); + break; + + // Segment registers + case REG_SR0: + case REG_SR1: + case REG_SR2: + case REG_SR3: + if (!m_out_mem_cb.isnull() && m_sr[port & 3] != data) + m_out_mem_cb(port & 3, data, BIT(m_com, 2)); + + m_sr[port & 3] = data; + break; + + // UART + case REG_RXC: + case REG_TXD: + case REG_TXC: + case REG_UMK: + case REG_UAK: + if (LOG) logerror("uPD65031 '%s': UART w: %02x %02x\n", tag(), port & 7 , data); + // TODO + break; + + default: + logerror("uPD65031 '%s': blink w: %04x %02x\n", tag(), offset, data); + break; + } +} + + +//------------------------------------------------- +// flp line +//------------------------------------------------- + +WRITE_LINE_MEMBER( upd65031_device::flp_w ) +{ + if (!(m_sta & STA_FLAPOPEN) && state) + { + // set interrupt on rising edge + m_sta |= STA_FLAP; + + interrupt_refresh(); + } + + if (state) + m_sta |= STA_FLAPOPEN; + else + m_sta &= ~STA_FLAPOPEN; +} + +//------------------------------------------------- +// battery low line +//------------------------------------------------- + +WRITE_LINE_MEMBER( upd65031_device::btl_w ) +{ + if (state) + m_sta |= STA_BTL; + else + m_sta &= ~STA_BTL; +} diff --git a/src/mame/machine/upd65031.h b/src/mame/machine/upd65031.h new file mode 100644 index 00000000000..75801beb0c4 --- /dev/null +++ b/src/mame/machine/upd65031.h @@ -0,0 +1,121 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/********************************************************************** + + NEC uPD65031 'BLINK' emulation + +**********************************************************************/ + +#pragma once + +#ifndef __UPD65031__ +#define __UPD65031__ + +#include "emu.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_UPD65031_KB_CALLBACK(_read) \ + devcb = &upd65031_device::set_kb_rd_callback(*device, DEVCB_##_read); + +#define MCFG_UPD65031_INT_CALLBACK(_write) \ + devcb = &upd65031_device::set_int_wr_callback(*device, DEVCB_##_write); + +#define MCFG_UPD65031_NMI_CALLBACK(_write) \ + devcb = &upd65031_device::set_nmi_wr_callback(*device, DEVCB_##_write); + +#define MCFG_UPD65031_SPKR_CALLBACK(_write) \ + devcb = &upd65031_device::set_spkr_wr_callback(*device, DEVCB_##_write); + +#define MCFG_UPD65031_SCR_UPDATE_CB(_class, _method) \ + upd65031_device::set_screen_update_callback(*device, upd65031_screen_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + +#define MCFG_UPD65031_MEM_UPDATE_CB(_class, _method) \ + upd65031_device::set_memory_update_callback(*device, upd65031_memory_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +typedef device_delegate upd65031_screen_update_delegate; +typedef device_delegate upd65031_memory_update_delegate; + +#define UPD65031_SCREEN_UPDATE(_name) void _name(bitmap_ind16 &bitmap, UINT16 sbf, UINT16 hires0, UINT16 hires1, UINT16 lores0, UINT16 lores1, int flash) +#define UPD65031_MEMORY_UPDATE(_name) void _name(int bank, UINT16 page, int rams) + + +// ======================> upd65031_device + +class upd65031_device : public device_t +{ +public: + // construction/destruction + upd65031_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_kb_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_kb.set_callback(object); } + template static devcb_base &set_int_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_int.set_callback(object); } + template static devcb_base &set_nmi_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_nmi.set_callback(object); } + template static devcb_base &set_spkr_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_spkr.set_callback(object); } + + static void set_screen_update_callback(device_t &device, upd65031_screen_update_delegate callback) { downcast(device).m_screen_update_cb = callback; } + static void set_memory_update_callback(device_t &device, upd65031_memory_update_delegate callback) { downcast(device).m_out_mem_cb = callback; } + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_WRITE_LINE_MEMBER( flp_w ); + DECLARE_WRITE_LINE_MEMBER( btl_w ); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + inline void interrupt_refresh(); + inline void update_rtc_interrupt(); + inline void set_mode(int mode); + static const device_timer_id TIMER_RTC = 0; + static const device_timer_id TIMER_FLASH = 1; + static const device_timer_id TIMER_SPEAKER = 2; + + devcb_read8 m_read_kb; + devcb_write_line m_write_int; + devcb_write_line m_write_nmi; + devcb_write_line m_write_spkr; + + upd65031_screen_update_delegate m_screen_update_cb; // callback for update the LCD + upd65031_memory_update_delegate m_out_mem_cb; // callback for update bankswitch + + int m_mode; + UINT16 m_lcd_regs[5]; // LCD registers + UINT8 m_tim[5]; // RTC registers + UINT8 m_sr[4]; // segment registers + UINT8 m_sta; // interrupt status + UINT8 m_int; // interrupts mask + UINT8 m_ack; // interrupts acknowledge + UINT8 m_tsta; // timer interrupt status + UINT8 m_tmk; // timer interrupt mask + UINT8 m_tack; // timer interrupts acknowledge + UINT8 m_com; // command register + int m_flash; // cursor flash + int m_speaker_state; // spkr line + + // timers + emu_timer *m_rtc_timer; + emu_timer *m_flash_timer; + emu_timer *m_speaker_timer; +}; + + +// device type definition +extern const device_type UPD65031; + + +#endif diff --git a/src/mame/machine/ut88.c b/src/mame/machine/ut88.c new file mode 100644 index 00000000000..353334b69cd --- /dev/null +++ b/src/mame/machine/ut88.c @@ -0,0 +1,178 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + UT88 machine driver by Miodrag Milanovic + + 06/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "cpu/i8085/i8085.h" +#include "sound/dac.h" +#include "imagedev/cassette.h" +#include "machine/i8255.h" +#include "includes/ut88.h" + +static const UINT8 hex_to_7seg[16] = +{ + 0x3F, 0x06, 0x5B, 0x4F, + 0x66, 0x6D, 0x7D, 0x07, + 0x7F, 0x6F, 0x77, 0x7c, + 0x39, 0x5e, 0x79, 0x71 +}; + + +/* Driver initialization */ +DRIVER_INIT_MEMBER(ut88_state,ut88) +{ + /* set initially ROM to be visible on first bank */ + UINT8 *RAM = m_region_maincpu->base(); + memset(RAM,0x0000,0x0800); // make first page empty by default + m_bank1->configure_entries(1, 2, RAM, 0x0000); + m_bank1->configure_entries(0, 2, RAM, 0xf800); +} + + +void ut88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_RESET: + m_bank1->set_entry(0); + break; + case TIMER_UPDATE_DISPLAY: + for (int i=0;i<6;i++) + output_set_digit_value(i, hex_to_7seg[m_lcd_digit[i]]); + timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY); + break; + default: + assert_always(FALSE, "Unknown id in ut88_state::device_timer"); + } +} + + +READ8_MEMBER( ut88_state::ut88_8255_portb_r ) +{ + UINT8 data = 0xff; + + if ( m_keyboard_mask & 0x01 ) + data &= m_io_line0->read(); + if ( m_keyboard_mask & 0x02 ) + data &= m_io_line1->read(); + if ( m_keyboard_mask & 0x04 ) + data &= m_io_line2->read(); + if ( m_keyboard_mask & 0x08 ) + data &= m_io_line3->read(); + if ( m_keyboard_mask & 0x10 ) + data &= m_io_line4->read(); + if ( m_keyboard_mask & 0x20 ) + data &= m_io_line5->read(); + if ( m_keyboard_mask & 0x40 ) + data &= m_io_line6->read(); + if ( m_keyboard_mask & 0x80 ) + data &= m_io_line7->read(); + + return data; +} + +READ8_MEMBER( ut88_state::ut88_8255_portc_r ) +{ + return m_io_line8->read(); +} + +WRITE8_MEMBER( ut88_state::ut88_8255_porta_w ) +{ + m_keyboard_mask = data ^ 0xff; +} + +MACHINE_RESET_MEMBER(ut88_state,ut88) +{ + timer_set(attotime::from_usec(10), TIMER_RESET); + m_bank1->set_entry(1); + m_keyboard_mask = 0; +} + + +READ8_MEMBER( ut88_state::ut88_keyboard_r ) +{ + return m_ppi->read(space, offset^0x03); +} + + +WRITE8_MEMBER( ut88_state::ut88_keyboard_w ) +{ + m_ppi->write(space, offset^0x03, data); +} + +WRITE8_MEMBER( ut88_state::ut88_sound_w ) +{ + m_dac->write_unsigned8(data); //beeper + m_cassette->output(BIT(data, 0) ? 1 : -1); +} + + +READ8_MEMBER( ut88_state::ut88_tape_r ) +{ + double level = m_cassette->input(); + return (level < 0) ? 0 : 0xff; +} + +READ8_MEMBER( ut88_state::ut88mini_keyboard_r ) +{ + // This is real keyboard implementation + UINT8 *keyrom1 = m_region_proms->base(); + UINT8 *keyrom2 = m_region_proms->base()+100; + + UINT8 key = keyrom2[m_io_line1->read()]; + + // if keyboard 2nd part returned 0 on 4th bit, output from + // first part is used + + if (!BIT(key, 3)) + key = keyrom1[m_io_line0->read()]; + + // for delete key there is special key producing code 0x80 + + key = (BIT(m_io_line2->read(), 7)) ? key : 0x80; + + // If key 0 is pressed its value is 0x10 this is done by additional + // discrete logic + + key = (BIT(m_io_line0->read(), 0)) ? key : 0x10; + return key; +} + + +WRITE8_MEMBER( ut88_state::ut88mini_write_led ) +{ + switch(offset) + { + case 0: m_lcd_digit[4] = (data >> 4) & 0x0f; + m_lcd_digit[5] = data & 0x0f; + break; + case 1: m_lcd_digit[2] = (data >> 4) & 0x0f; + m_lcd_digit[3] = data & 0x0f; + break; + case 2: m_lcd_digit[0] = (data >> 4) & 0x0f; + m_lcd_digit[1] = data & 0x0f; + break; + } +} + +DRIVER_INIT_MEMBER(ut88_state,ut88mini) +{ +} + +MACHINE_START_MEMBER(ut88_state,ut88mini) +{ + timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY); +} + +MACHINE_RESET_MEMBER(ut88_state,ut88mini) +{ + m_lcd_digit[0] = m_lcd_digit[1] = m_lcd_digit[2] = 0; + m_lcd_digit[3] = m_lcd_digit[4] = m_lcd_digit[5] = 0; +} diff --git a/src/mame/machine/v1050kb.c b/src/mame/machine/v1050kb.c new file mode 100644 index 00000000000..e0819004237 --- /dev/null +++ b/src/mame/machine/v1050kb.c @@ -0,0 +1,425 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Visual 1050 keyboard emulation + +*********************************************************************/ + +#include "v1050kb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8049_TAG "z5" +#define DISCRETE_TAG "ls1" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type V1050_KEYBOARD = &device_creator; + + +//------------------------------------------------- +// ROM( v1050_keyboard ) +//------------------------------------------------- + +ROM_START( v1050_keyboard ) + ROM_REGION( 0x800, I8049_TAG, 0 ) + ROM_LOAD( "20-08049-410.z5", 0x0000, 0x0800, NO_DUMP ) // internal 8049 ROM + ROM_LOAD( "22-02716-074.z8", 0x0000, 0x0800, NO_DUMP ) // external ROM for 8039 version +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *v1050_keyboard_device::device_rom_region() const +{ + return ROM_NAME( v1050_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( kb_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( v1050_keyboard_io, AS_IO, 8, v1050_keyboard_device ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// DISCRETE_SOUND_START( v1050kb ) +//------------------------------------------------- + +static const discrete_555_desc v1050_ne555 = +{ + DISC_555_OUT_SQW | DISC_555_OUT_DC, + 5, // B+ voltage of 555 + DEFAULT_555_VALUES +}; + +static DISCRETE_SOUND_START( v1050kb ) + DISCRETE_INPUT_LOGIC(NODE_01) + DISCRETE_555_ASTABLE(NODE_02, NODE_01, (int) RES_K(68) /* can't read on schematic */ , (int) RES_K(3), (int) CAP_N(10), &v1050_ne555) + DISCRETE_OUTPUT(NODE_02, 5000) +DISCRETE_SOUND_END + + +//------------------------------------------------- +// MACHINE_DRIVER( v1050_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( v1050_keyboard ) + MCFG_CPU_ADD(I8049_TAG, I8049, XTAL_4_608MHz) + MCFG_CPU_IO_MAP(v1050_keyboard_io) + MCFG_DEVICE_DISABLE() // TODO + + // discrete sound + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) + MCFG_DISCRETE_INTF(v1050kb) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor v1050_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( v1050_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( v1050_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( v1050_keyboard ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Help") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("No Scrl") + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter DelCh") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 Pg Dn") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 \xE2\x86\x92") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad - DelLn") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 End") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad , DelWd") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Wd\xE2\x86\x92") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F14 OnSer") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F16 Print") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F12 Copy") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 End") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F15 Quick") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F11 Move") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F17 Block") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F13 Hide") + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Line Feed") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('|') PORT_CHAR('\\') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Retn") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Num Lock") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break Stop") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Back Space") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Wd\xE2\x86\x90") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5 \xE2\x86\x91") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 \xE2\x86\x90") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 Last") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 PgUp") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 \xE2\x86\x93") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 Insert") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 InsCr") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 Begin") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 Rept") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 Find") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 Again") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 Refs") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 Save") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + + PORT_START("YA") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') PORT_CHAR('\'') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_START("YB") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) + + PORT_START("SW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("SW2") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor v1050_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( v1050_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// v1050_keyboard_device - constructor +//------------------------------------------------- + +v1050_keyboard_device::v1050_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, V1050_KEYBOARD, "Visual 1050 Keyboard", tag, owner, clock, "v1050kb", __FILE__), + m_maincpu(*this, I8049_TAG), + m_discrete(*this, DISCRETE_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_ya(*this, "YA"), + m_yb(*this, "YB"), + m_out_tx_handler(*this), + m_y(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void v1050_keyboard_device::device_start() +{ + // state saving + save_item(NAME(m_y)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void v1050_keyboard_device::device_reset() +{ + m_out_tx_handler.resolve_safe(); + m_out_tx_handler(1); +} + + +//------------------------------------------------- +// si_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( v1050_keyboard_device::si_w ) +{ + m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); +} + + +//------------------------------------------------- +// kb_p1_r - +//------------------------------------------------- + +READ8_MEMBER( v1050_keyboard_device::kb_p1_r ) +{ + UINT8 data = 0xff; + + switch (m_y) + { + case 0: data &= m_y0->read(); break; + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 9: data &= m_y9->read(); break; + case 0xa: data &= m_ya->read(); break; + case 0xb: data &= m_yb->read(); break; + } + + return data; +} + + +//------------------------------------------------- +// kb_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( v1050_keyboard_device::kb_p1_w ) +{ + m_y = data & 0x0f; +} + + +//------------------------------------------------- +// kb_p2_w - +//------------------------------------------------- + +WRITE8_MEMBER( v1050_keyboard_device::kb_p2_w ) +{ + /* + + bit description + + P20 Z8 A8 (8039 external ROM) + P21 Z8 A9 + P22 Z8 A10 + P23 + P24 + P25 led output + P26 speaker (NE555) output + P27 serial output + + */ + + // led output + output_set_led_value(0, BIT(data, 5)); + + // speaker output + m_discrete->write(space, NODE_01, BIT(data, 6)); + + // serial output + m_out_tx_handler(BIT(data, 7)); +} diff --git a/src/mame/machine/v1050kb.h b/src/mame/machine/v1050kb.h new file mode 100644 index 00000000000..94b4b5dafc4 --- /dev/null +++ b/src/mame/machine/v1050kb.h @@ -0,0 +1,86 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Visual 1050 keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __V1050_KEYBOARD__ +#define __V1050_KEYBOARD__ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "sound/discrete.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_V1050_KEYBOARD_OUT_TX_HANDLER(_devcb) \ + devcb = &v1050_keyboard_device::set_out_tx_handler(*device, DEVCB_##_devcb); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> V1050_keyboard_device + +class v1050_keyboard_device : public device_t +{ +public: + // construction/destruction + v1050_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_out_tx_handler(device_t &device, _Object object) { return downcast(device).m_out_tx_handler.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_WRITE_LINE_MEMBER( si_w ); + + // not really public + DECLARE_READ8_MEMBER( kb_p1_r ); + DECLARE_WRITE8_MEMBER( kb_p1_w ); + DECLARE_WRITE8_MEMBER( kb_p2_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + required_device m_maincpu; + required_device m_discrete; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_ya; + required_ioport m_yb; + devcb_write_line m_out_tx_handler; + + UINT8 m_y; +}; + + +// device type definition +extern const device_type V1050_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/vector06.c b/src/mame/machine/vector06.c new file mode 100644 index 00000000000..ba944cef8fd --- /dev/null +++ b/src/mame/machine/vector06.c @@ -0,0 +1,181 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Vector06c driver by Miodrag Milanovic + + 10/07/2008 Preliminary driver. + +****************************************************************************/ + + +#include "includes/vector06.h" + + +READ8_MEMBER( vector06_state::vector06_8255_portb_r ) +{ + UINT8 key = 0xff; + if (BIT(m_keyboard_mask, 0)) key &= m_line[0]->read(); + if (BIT(m_keyboard_mask, 1)) key &= m_line[1]->read(); + if (BIT(m_keyboard_mask, 2)) key &= m_line[2]->read(); + if (BIT(m_keyboard_mask, 3)) key &= m_line[3]->read(); + if (BIT(m_keyboard_mask, 4)) key &= m_line[4]->read(); + if (BIT(m_keyboard_mask, 5)) key &= m_line[5]->read(); + if (BIT(m_keyboard_mask, 6)) key &= m_line[6]->read(); + if (BIT(m_keyboard_mask, 7)) key &= m_line[7]->read(); + return key; +} + +READ8_MEMBER( vector06_state::vector06_8255_portc_r ) +{ + UINT8 ret = m_line[8]->read(); + + if (m_cassette->input() > 0) + ret |= 0x10; + + return ret; +} + +WRITE8_MEMBER( vector06_state::vector06_8255_porta_w ) +{ + m_keyboard_mask = data ^ 0xff; +} + +void vector06_state::vector06_set_video_mode(int width) +{ + rectangle visarea(0, width+64-1, 0, 256+64-1); + machine().first_screen()->configure(width+64, 256+64, visarea, machine().first_screen()->frame_period().attoseconds()); +} + +WRITE8_MEMBER( vector06_state::vector06_8255_portb_w ) +{ + m_color_index = data & 0x0f; + if ((data & 0x10) != m_video_mode) + { + m_video_mode = data & 0x10; + vector06_set_video_mode((m_video_mode==0x10) ? 512 : 256); + } +} + +WRITE8_MEMBER( vector06_state::vector06_color_set ) +{ + UINT8 r = (data & 7) << 5; + UINT8 g = ((data >> 3) & 7) << 5; + UINT8 b = ((data >>6) & 3) << 6; + m_palette->set_pen_color( m_color_index, rgb_t(r,g,b) ); +} + + +READ8_MEMBER( vector06_state::vector06_romdisk_portb_r ) +{ + UINT16 addr = (m_romdisk_msb << 8) | m_romdisk_lsb; + if (m_cart->exists() && addr < m_cart->get_rom_size()) + return m_cart->read_rom(space, addr); + else + return 0xff; +} + +WRITE8_MEMBER( vector06_state::vector06_romdisk_porta_w ) +{ + m_romdisk_lsb = data; +} + +WRITE8_MEMBER( vector06_state::vector06_romdisk_portc_w ) +{ + m_romdisk_msb = data; +} + +READ8_MEMBER( vector06_state::vector06_8255_1_r ) +{ + return m_ppi->read(space, offset^3); +} + +WRITE8_MEMBER( vector06_state::vector06_8255_1_w ) +{ + m_ppi->write(space, offset^3, data); +} + +READ8_MEMBER( vector06_state::vector06_8255_2_r ) +{ + return m_ppi2->read(space, offset^3); +} + +WRITE8_MEMBER( vector06_state::vector06_8255_2_w ) +{ + m_ppi2->write(space, offset^3, data); +} + +INTERRUPT_GEN_MEMBER(vector06_state::vector06_interrupt) +{ + m_vblank_state++; + if (m_vblank_state>1) m_vblank_state=0; + device.execute().set_input_line(0,m_vblank_state ? HOLD_LINE : CLEAR_LINE); + +} + +IRQ_CALLBACK_MEMBER(vector06_state::vector06_irq_callback) +{ + // Interupt is RST 7 + return 0xff; +} + +TIMER_CALLBACK_MEMBER(vector06_state::reset_check_callback) +{ + UINT8 val = m_reset->read(); + + if (BIT(val, 0)) + { + m_bank1->set_base(m_region_maincpu->base() + 0x10000); + m_maincpu->reset(); + } + + if (BIT(val, 1)) + { + m_bank1->set_base(m_ram->pointer() + 0x0000); + m_maincpu->reset(); + } +} + +WRITE8_MEMBER( vector06_state::vector06_disc_w ) +{ + floppy_image_device *floppy = NULL; + + switch (data & 0x01) + { + case 0: floppy = m_floppy0->get_device(); break; + case 1: floppy = m_floppy1->get_device(); break; + } + + m_fdc->set_floppy(floppy); + + if (floppy) + { + // something here needs to turn the motor on + floppy->mon_w(0); + floppy->ss_w(!BIT(data, 2)); + } +} + +void vector06_state::machine_start() +{ + machine().scheduler().timer_pulse(attotime::from_hz(50), timer_expired_delegate(FUNC(vector06_state::reset_check_callback),this)); +} + +void vector06_state::machine_reset() +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.install_read_bank (0x0000, 0x7fff, m_bank1); + space.install_write_bank(0x0000, 0x7fff, m_bank2); + space.install_read_bank (0x8000, 0xffff, m_bank3); + space.install_write_bank(0x8000, 0xffff, m_bank4); + + m_bank1->set_base(m_region_maincpu->base() + 0x10000); + m_bank2->set_base(m_ram->pointer() + 0x0000); + m_bank3->set_base(m_ram->pointer() + 0x8000); + m_bank4->set_base(m_ram->pointer() + 0x8000); + + m_keyboard_mask = 0; + m_color_index = 0; + m_video_mode = 0; +} diff --git a/src/mame/machine/victor9k_fdc.c b/src/mame/machine/victor9k_fdc.c new file mode 100644 index 00000000000..ae04084757b --- /dev/null +++ b/src/mame/machine/victor9k_fdc.c @@ -0,0 +1,1351 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Victor 9000 floppy disk controller emulation + +**********************************************************************/ + +/* + + value error description + + 01 no sync pulse detected + 02 no header track + 03 checksum error in header + 04 not right track + 05 not right sector + 06 not a data block + 07 data checksum error + 08 sync too long + 99 not a system disc + + 11 Noise on sync + FF No sync (bad or unformatted disk) + +*/ + +/* + + TODO: + + - write protect + - separate read/write methods + - communication error with SCP after loading boot sector + - bp ff1a8 + - patch ff1ab=c3 + - single/double sided jumper + - header sync length unknown (6 is too short) + - 8048 spindle speed control + +*/ + +#include "victor9k_fdc.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 +#define LOG_VIA 0 +#define LOG_SCP 0 +#define LOG_BITS 0 + +#define I8048_TAG "5d" +#define M6522_4_TAG "1f" +#define M6522_5_TAG "1k" +#define M6522_6_TAG "1h" + +// this is exactly the same decode/encode as used in the Commodore 4040/8050 series drives +#define GCR_DECODE(_e, _i) \ + ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04)) + +// E7 E6 I7 E5 E4 E3 E2 I2 E1 E0 +#define GCR_ENCODE(_e, _i) \ + ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03)) + +// Tandon TM-100 spindle @ 300RPM, measured TACH 12VAC 256Hz +// TACH = RPM / 60 * SPINDLE RATIO * MOTOR POLES +// 256 = 300 / 60 * 6.4 * 8 +#define SPINDLE_RATIO 6.4 +#define MOTOR_POLES 8 + +// TODO wrong values here! motor speed is controlled by an LM2917, with help from the spindle TACH and a DAC0808 whose value is set by the SCP 8048 +const int victor_9000_fdc_t::rpm[] = { 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 254, 255, 257, 259, 260, 262, 264, 266, 267, 269, 271, 273, 275, 276, 278, 280, 282, 284, 286, 288, 290, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 318, 320, 322, 324, 326, 328, 330, 333, 335, 337, 339, 342, 344, 346, 348, 351, 353, 355, 358, 360, 362, 365, 367, 370, 372, 375, 377, 380, 382, 385, 387, 390, 392, 395, 398, 400, 403, 406, 408, 411, 414, 416, 419, 422, 425, 428, 430, 433, 436, 439, 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, 472, 475, 478, 482, 485, 488, 491, 494, 498, 501, 504, 508, 511, 514, 518, 521, 525, 528, 532, 535, 539, 542, 546, 550, 553, 557, 561, 564, 568, 572, 576, 579, 583, 587, 591, 595, 599, 603, 607, 611, 615, 619, 623, 627, 631, 636, 640, 644, 648, 653, 657, 661, 666, 670, 674, 679, 683, 688, 693, 697, 702, 706, 711, 716, 721, 725, 730, 735, 740, 745, 750, 755, 760, 765, 770, 775, 780, 785, 790, 796, 801, 806, 812, 817, 822, 828, 833, 839, 844, 850, 856, 861, 867, 873, 878, 884 }; + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type VICTOR_9000_FDC = &device_creator; + + +//------------------------------------------------- +// ROM( victor_9000_fdc ) +//------------------------------------------------- + +ROM_START( victor_9000_fdc ) + ROM_REGION( 0x400, I8048_TAG, 0) + ROM_LOAD( "36080.5d", 0x000, 0x400, CRC(9bf49f7d) SHA1(b3a11bb65105db66ae1985b6f482aab6ea1da38b) ) + + ROM_REGION( 0x800, "gcr", 0 ) + ROM_LOAD( "100836-001.4k", 0x000, 0x800, CRC(adc601bd) SHA1(6eeff3d2063ae2d97452101aa61e27ef83a467e5) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *victor_9000_fdc_t::device_rom_region() const +{ + return ROM_NAME( victor_9000_fdc ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( floppy_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( floppy_io, AS_IO, 8, victor_9000_fdc_t ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(floppy_p1_r, floppy_p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(floppy_p2_r, floppy_p2_w) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(tach0_r) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(tach1_r) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(da_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// SLOT_INTERFACE( victor9k_floppies ) +//------------------------------------------------- + +int victor_9000_fdc_t::load0_cb(floppy_image_device *device) +{ + // DOOR OPEN 0 + m_via4->write_ca1(0); + + return IMAGE_INIT_PASS; +} + +void victor_9000_fdc_t::unload0_cb(floppy_image_device *device) +{ + // DOOR OPEN 0 + m_via4->write_ca1(1); +} + +int victor_9000_fdc_t::load1_cb(floppy_image_device *device) +{ + // DOOR OPEN 1 + m_via4->write_cb1(0); + + return IMAGE_INIT_PASS; +} + +void victor_9000_fdc_t::unload1_cb(floppy_image_device *device) +{ + // DOOR OPEN 1 + m_via4->write_cb1(1); +} + +static SLOT_INTERFACE_START( victor9k_floppies ) + SLOT_INTERFACE( "525ssqd", FLOPPY_525_SSQD ) // Tandon TM100-3 with custom electronics + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Tandon TM100-4 with custom electronics +SLOT_INTERFACE_END + +FLOPPY_FORMATS_MEMBER( victor_9000_fdc_t::floppy_formats ) + FLOPPY_VICTOR_9000_FORMAT +FLOPPY_FORMATS_END + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( victor_9000_fdc ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( victor_9000_fdc ) + MCFG_CPU_ADD(I8048_TAG, I8048, XTAL_30MHz/6) + MCFG_CPU_IO_MAP(floppy_io) + + MCFG_DEVICE_ADD(M6522_4_TAG, VIA6522, XTAL_30MHz/30) + MCFG_VIA6522_READPA_HANDLER(READ8(victor_9000_fdc_t, via4_pa_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(victor_9000_fdc_t, via4_pa_w)) + MCFG_VIA6522_READPB_HANDLER(READ8(victor_9000_fdc_t, via4_pb_r)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor_9000_fdc_t, via4_pb_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(victor_9000_fdc_t, wrsync_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor_9000_fdc_t, via4_irq_w)) + + MCFG_DEVICE_ADD(M6522_5_TAG, VIA6522, XTAL_30MHz/30) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor_9000_fdc_t, via5_irq_w)) + MCFG_VIA6522_READPA_HANDLER(READ8(victor_9000_fdc_t, via5_pa_r)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor_9000_fdc_t, via5_pb_w)) + + MCFG_DEVICE_ADD(M6522_6_TAG, VIA6522, XTAL_30MHz/30) + MCFG_VIA6522_READPA_HANDLER(READ8(victor_9000_fdc_t, via6_pa_r)) + MCFG_VIA6522_READPB_HANDLER(READ8(victor_9000_fdc_t, via6_pb_r)) + MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(victor_9000_fdc_t, via6_pa_w)) + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor_9000_fdc_t, via6_pb_w)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(victor_9000_fdc_t, drw_w)) + MCFG_VIA6522_CB2_HANDLER(WRITELINE(victor_9000_fdc_t, erase_w)) + MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor_9000_fdc_t, via6_irq_w)) + + MCFG_FLOPPY_DRIVE_ADD(I8048_TAG":0", victor9k_floppies, "525qd", victor_9000_fdc_t::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(I8048_TAG":1", victor9k_floppies, "525qd", victor_9000_fdc_t::floppy_formats) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor victor_9000_fdc_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( victor_9000_fdc ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// victor_9000_fdc_t - constructor +//------------------------------------------------- + +victor_9000_fdc_t::victor_9000_fdc_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, VICTOR_9000_FDC, "Victor 9000 FDC", tag, owner, clock, "victor9k_fdc", __FILE__), + m_irq_cb(*this), + m_syn_cb(*this), + m_lbrdy_cb(*this), + m_maincpu(*this, I8048_TAG), + m_via4(*this, M6522_4_TAG), + m_via5(*this, M6522_5_TAG), + m_via6(*this, M6522_6_TAG), + m_floppy0(*this, I8048_TAG":0:525qd"), + m_floppy1(*this, I8048_TAG":1:525qd"), + m_gcr_rom(*this, "gcr"), + m_da(0), + m_da0(0), + m_da1(0), + m_start0(1), + m_stop0(1), + m_start1(1), + m_stop1(1), + m_sel0(0), + m_sel1(0), + m_tach0(0), + m_tach1(0), + m_rdy0(0), + m_rdy1(0), + m_l0ms(0), + m_l1ms(0), + m_st0(0), + m_st1(0), + m_stp0(0), + m_stp1(0), + m_drive(0), + m_side(0), + m_via4_irq(CLEAR_LINE), + m_via5_irq(CLEAR_LINE), + m_via6_irq(CLEAR_LINE), + m_period(attotime::from_hz(XTAL_15MHz/32)) +{ + cur_live.tm = attotime::never; + cur_live.state = IDLE; + cur_live.next_state = -1; +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void victor_9000_fdc_t::device_start() +{ + // resolve callbacks + m_irq_cb.resolve_safe(); + m_syn_cb.resolve_safe(); + m_lbrdy_cb.resolve_safe(); + + // allocate timer + t_gen = timer_alloc(TM_GEN); + t_tach0 = timer_alloc(TM_TACH0); + t_tach1 = timer_alloc(TM_TACH1); + + // state saving + save_item(NAME(m_da)); + save_item(NAME(m_da0)); + save_item(NAME(m_da1)); + save_item(NAME(m_start0)); + save_item(NAME(m_stop0)); + save_item(NAME(m_start1)); + save_item(NAME(m_stop1)); + save_item(NAME(m_sel0)); + save_item(NAME(m_sel1)); + save_item(NAME(m_tach0)); + save_item(NAME(m_tach1)); + save_item(NAME(m_rdy0)); + save_item(NAME(m_rdy1)); + save_item(NAME(m_l0ms)); + save_item(NAME(m_l1ms)); + save_item(NAME(m_st0)); + save_item(NAME(m_st1)); + save_item(NAME(m_stp0)); + save_item(NAME(m_stp1)); + save_item(NAME(m_drive)); + save_item(NAME(m_side)); + save_item(NAME(m_drw)); + save_item(NAME(m_erase)); + save_item(NAME(m_via4_irq)); + save_item(NAME(m_via5_irq)); + save_item(NAME(m_via6_irq)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void victor_9000_fdc_t::device_reset() +{ + live_abort(); + + // reset devices + m_via4->reset(); + m_via5->reset(); + m_via6->reset(); + + // set floppy callbacks + m_floppy0->setup_load_cb(floppy_image_device::load_cb(FUNC(victor_9000_fdc_t::load0_cb), this)); + m_floppy0->setup_unload_cb(floppy_image_device::unload_cb(FUNC(victor_9000_fdc_t::unload0_cb), this)); + + m_floppy1->setup_load_cb(floppy_image_device::load_cb(FUNC(victor_9000_fdc_t::load1_cb), this)); + m_floppy1->setup_unload_cb(floppy_image_device::unload_cb(FUNC(victor_9000_fdc_t::unload1_cb), this)); +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void victor_9000_fdc_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TM_GEN: + live_sync(); + live_run(); + break; + + case TM_TACH0: + m_tach0 = !m_tach0; + if (LOG_SCP) logerror("TACH0 %u\n", m_tach0); + break; + + case TM_TACH1: + m_tach1 = !m_tach1; + if (LOG_SCP) logerror("TACH1 %u\n", m_tach1); + break; + } +} + + +//------------------------------------------------- +// floppy_p1_r - +//------------------------------------------------- + +READ8_MEMBER( victor_9000_fdc_t::floppy_p1_r ) +{ + /* + + bit description + + 0 L0MS0 + 1 L0MS1 + 2 L0MS2 + 3 L0MS3 + 4 L1MS0 + 5 L1MS1 + 6 L1MS2 + 7 L1MS3 + + */ + + return (m_l1ms << 4) | m_l0ms; +} + + +//------------------------------------------------- +// floppy_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( victor_9000_fdc_t::floppy_p1_w ) +{ + /* + + bit description + + 0 L0MS0 + 1 L0MS1 + 2 L0MS2 + 3 L0MS3 + 4 L1MS0 + 5 L1MS1 + 6 L1MS2 + 7 L1MS3 + + */ + + m_l0ms = data & 0x0f; + m_l1ms = data >> 4; +} + + +//------------------------------------------------- +// floppy_p2_r - +//------------------------------------------------- + +READ8_MEMBER( victor_9000_fdc_t::floppy_p2_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 RDY0 + 7 RDY1 + + */ + + UINT8 data = m_p2 & 0x3f; + + data |= m_rdy0 << 6; + data |= m_rdy1 << 7; + + return data; +} + + +//------------------------------------------------- +// floppy_p2_w - +//------------------------------------------------- + +WRITE8_MEMBER( victor_9000_fdc_t::floppy_p2_w ) +{ + /* + + bit description + + 0 START0 + 1 STOP0 + 2 START1 + 3 STOP1 + 4 SEL1 + 5 SEL0 + 6 RDY0 + 7 RDY1 + + */ + + m_p2 = data; + + bool sync = false; + + int start0 = BIT(data, 0); + if (m_start0 != start0) sync = true; + + int stop0 = BIT(data, 1); + if (m_stop0 != stop0) sync = true; + + int start1 = BIT(data, 2); + if (m_start1 != start1) sync = true; + + int stop1 = BIT(data, 3); + if (m_stop1 != stop1) sync = true; + + int sel0 = BIT(data, 5); + if (m_sel0 != sel0) sync = true; + + int sel1 = BIT(data, 4); + if (m_sel1 != sel1) sync = true; + + set_rdy0(BIT(data, 6)); + set_rdy1(BIT(data, 7)); + + if (LOG_SCP) logerror("%s %s START0/STOP0/SEL0/RDY0 %u/%u/%u/%u START1/STOP1/SEL1/RDY1 %u/%u/%u/%u\n", machine().time().as_string(), machine().describe_context(), start0, stop0, sel0, m_rdy0, start1, stop1, sel1, m_rdy1); + + if (sync) + { + live_sync(); + + m_start0 = start0; + m_stop0 = stop0; + m_sel0 = sel0; + //update_spindle_motor(m_floppy0, t_tach0, m_start0, m_stop0, m_sel0, m_da0); + + m_start1 = start1; + m_stop1 = stop1; + m_sel1 = sel1; + //update_spindle_motor(m_floppy1, t_tach1, m_start1, m_stop1, m_sel1, m_da1); + + checkpoint(); + + if (!m_floppy0->mon_r() || !m_floppy1->mon_r()) { + if(cur_live.state == IDLE) { + live_start(); + } + } else { + live_abort(); + } + + live_run(); + } +} + + +//------------------------------------------------- +// tach0_r - +//------------------------------------------------- + +READ8_MEMBER( victor_9000_fdc_t::tach0_r ) +{ + return m_tach0; +} + + +//------------------------------------------------- +// tach1_r - +//------------------------------------------------- + +READ8_MEMBER( victor_9000_fdc_t::tach1_r ) +{ + return m_tach1; +} + + +void victor_9000_fdc_t::update_stepper_motor(floppy_image_device *floppy, int stp, int old_st, int st) +{ + if (stp) return; + + int tracks = 0; + + switch (old_st) + { + case 6: if (st == 0xa) tracks++; else if (st == 5) tracks--; break; + case 5: if (st == 6) tracks++; else if (st == 9) tracks--; break; + case 9: if (st == 5) tracks++; else if (st == 0xa) tracks--; break; + case 0xa: if (st == 9) tracks++; else if (st == 6) tracks--; break; + } + + if (tracks == -1) + { + floppy->dir_w(1); + floppy->stp_w(1); + floppy->stp_w(0); + } + else if (tracks == 1) + { + floppy->dir_w(0); + floppy->stp_w(1); + floppy->stp_w(0); + } +} + +void victor_9000_fdc_t::update_spindle_motor(floppy_image_device *floppy, emu_timer *t_tach, bool start, bool stop, bool sel, UINT8 &da) +{ + if (start && !stop && floppy->mon_r()) { + if (LOG_SCP) logerror("%s: motor start\n", floppy->tag()); + floppy->mon_w(0); + } else if (stop && !floppy->mon_r()) { + if (LOG_SCP) logerror("%s: motor stop\n", floppy->tag()); + floppy->mon_w(1); + t_tach->reset(); + } + + if (sel) { + da = m_da; + if (!floppy->mon_r()) { + float tach = rpm[da] / 60 * SPINDLE_RATIO * MOTOR_POLES; + + if (LOG_SCP) logerror("%s: motor speed %u rpm / tach %0.1f hz (DA %02x)\n", floppy->tag(), rpm[da], (double) tach, da); + + t_tach->adjust(attotime::from_hz(tach*2), 0, attotime::from_hz(tach*2)); + floppy->set_rpm(rpm[da]); + } + } +} + +void victor_9000_fdc_t::set_rdy0(int state) +{ + //m_rdy0 = state; + //m_via5->write_ca2(m_rdy0); +} + +void victor_9000_fdc_t::set_rdy1(int state) +{ + //m_rdy1 = state; + //m_via5->write_cb2(m_rdy1); +} + + +//------------------------------------------------- +// da_w - +//------------------------------------------------- + +WRITE8_MEMBER( victor_9000_fdc_t::da_w ) +{ + if (LOG_SCP) logerror("%s %s DA %02x\n", machine().time().as_string(), machine().describe_context(), data); + + if (m_da != data) + { + live_sync(); + m_da = data; + update_spindle_motor(m_floppy0, t_tach0, m_start0, m_stop0, m_sel0, m_da0); + update_spindle_motor(m_floppy1, t_tach1, m_start1, m_stop1, m_sel1, m_da1); + checkpoint(); + live_run(); + } +} + +READ8_MEMBER( victor_9000_fdc_t::via4_pa_r ) +{ + /* + + bit description + + PA0 L0MS0 + PA1 L0MS1 + PA2 L0MS2 + PA3 L0MS3 + PA4 + PA5 + PA6 + PA7 + + */ + + return m_l0ms; +} + +WRITE8_MEMBER( victor_9000_fdc_t::via4_pa_w ) +{ + /* + + bit description + + PA0 L0MS0 + PA1 L0MS1 + PA2 L0MS2 + PA3 L0MS3 + PA4 ST0A + PA5 ST0B + PA6 ST0C + PA7 ST0D + + */ + + m_l0ms = data & 0x0f; + + { // HACK to bypass SCP + m_floppy0->mon_w((m_l0ms == 0xf) ? 1 : 0); + m_floppy0->set_rpm(victor9k_format::get_rpm(m_side, m_floppy0->get_cyl())); + m_rdy0 = (m_l0ms == 0xf) ? 0 : 1; + m_via5->write_ca2(m_rdy0); + } + + UINT8 st0 = data >> 4; + + if (LOG_VIA) logerror("%s %s L0MS %01x ST0 %01x\n", machine().time().as_string(), machine().describe_context(), m_l0ms, st0); + + if (m_st0 != st0) + { + live_sync(); + update_stepper_motor(m_floppy0, m_stp0, st0, m_st0); + m_st0 = st0; + checkpoint(); + live_run(); + } +} + +READ8_MEMBER( victor_9000_fdc_t::via4_pb_r ) +{ + /* + + bit description + + PB0 L1MS0 + PB1 L1MS1 + PB2 L1MS2 + PB3 L1MS3 + PB4 + PB5 + PB6 + PB7 + + */ + + return m_l1ms; +} + +WRITE8_MEMBER( victor_9000_fdc_t::via4_pb_w ) +{ + /* + + bit description + + PB0 L1MS0 + PB1 L1MS1 + PB2 L1MS2 + PB3 L1MS3 + PB4 ST1A + PB5 ST1B + PB6 ST1C + PB7 ST1D + + */ + + m_l1ms = data & 0x0f; + + { // HACK to bypass SCP + m_floppy1->mon_w((m_l1ms == 0xf) ? 1 : 0); + m_floppy1->set_rpm(victor9k_format::get_rpm(m_side, m_floppy1->get_cyl())); + m_rdy1 = (m_l1ms == 0xf) ? 0 : 1; + m_via5->write_cb2(m_rdy1); + } + + UINT8 st1 = data >> 4; + + if (LOG_VIA) logerror("%s %s L1MS %01x ST1 %01x\n", machine().time().as_string(), machine().describe_context(), m_l1ms, st1); + + if (m_st1 != st1) + { + live_sync(); + update_stepper_motor(m_floppy1, m_stp1, st1, m_st1); + m_st1 = st1; + checkpoint(); + live_run(); + } +} + +WRITE_LINE_MEMBER( victor_9000_fdc_t::wrsync_w ) +{ + if (m_wrsync != state) + { + live_sync(); + m_wrsync = state; + cur_live.wrsync = state; + checkpoint(); + if (LOG_VIA) logerror("%s %s WRSYNC %u\n", machine().time().as_string(), machine().describe_context(), state); + live_run(); + } +} + +WRITE_LINE_MEMBER( victor_9000_fdc_t::via4_irq_w ) +{ + m_via4_irq = state; + + m_irq_cb(m_via4_irq || m_via5_irq || m_via6_irq); +} + +READ8_MEMBER( victor_9000_fdc_t::via5_pa_r ) +{ + /* + + bit description + + PA0 E0 + PA1 E1 + PA2 I1 + PA3 E2 + PA4 E4 + PA5 E5 + PA6 I7 + PA7 E6 + + */ + + return GCR_DECODE(checkpoint_live.e, checkpoint_live.i); +} + +WRITE8_MEMBER( victor_9000_fdc_t::via5_pb_w ) +{ + /* + + bit description + + PB0 WD0 + PB1 WD1 + PB2 WD2 + PB3 WD3 + PB4 WD4 + PB5 WD5 + PB6 WD6 + PB7 WD7 + + */ + + if (LOG_VIA) logerror("%s %s WD %02x\n", machine().time().as_string(), machine().describe_context(), data); + + if (m_wd != data) + { + live_sync(); + m_wd = cur_live.wd = data; + checkpoint(); + live_run(); + } +} + +WRITE_LINE_MEMBER( victor_9000_fdc_t::via5_irq_w ) +{ + m_via5_irq = state; + + m_irq_cb(m_via4_irq || m_via5_irq || m_via6_irq); +} + + +READ8_MEMBER( victor_9000_fdc_t::via6_pa_r ) +{ + /* + + bit description + + PA0 + PA1 _TRK0D0 + PA2 + PA3 _TRK0D1 + PA4 + PA5 + PA6 WPS + PA7 _SYNC + + */ + + if (LOG_VIA) logerror("%s %s TRK0D0 %u TRK0D1 %u SYNC %u\n", machine().time().as_string(), machine().describe_context(), m_floppy0->trk00_r(), m_floppy1->trk00_r(), checkpoint_live.sync); + + UINT8 data = 0; + + // track 0 drive A sense + data |= m_floppy0->trk00_r() << 1; + + // track 0 drive B sense + data |= m_floppy1->trk00_r() << 3; + + // write protect sense + data |= (m_drive ? m_floppy1->wpt_r() : m_floppy0->wpt_r()) << 6; + + // disk sync detect + data |= checkpoint_live.sync << 7; + + return data; +} + +WRITE8_MEMBER( victor_9000_fdc_t::via6_pa_w ) +{ + /* + + bit description + + PA0 LED0A + PA1 + PA2 LED1A + PA3 + PA4 SIDE SELECT + PA5 DRIVE SELECT + PA6 + PA7 + + */ + + // LED, drive A + output_set_led_value(LED_A, BIT(data, 0)); + + // LED, drive B + output_set_led_value(LED_B, BIT(data, 2)); + + bool sync = false; + + // dual side select + int side = BIT(data, 4); + if (m_side != side) sync = true; + + // select drive A/B + int drive = BIT(data, 5); + if (m_drive != drive) sync = true; + + if (sync) + { + live_sync(); + + m_side = side; + cur_live.side = side; + m_floppy0->ss_w(side); + m_floppy1->ss_w(side); + + m_drive = drive; + cur_live.drive = drive; + + if (LOG_VIA) logerror("%s %s SIDE %u DRIVE %u\n", machine().time().as_string(), machine().describe_context(), side, drive); + + checkpoint(); + live_run(); + } +} + +READ8_MEMBER( victor_9000_fdc_t::via6_pb_r ) +{ + /* + + bit description + + PB0 RDY0 + PB1 RDY1 + PB2 + PB3 _DS1 + PB4 _DS0 + PB5 SINGLE/_DOUBLE SIDED + PB6 + PB7 + + */ + + UINT8 data = 0; + + // motor speed status, drive A + data |= m_rdy0; + + // motor speed status, drive B + data |= m_rdy1 << 1; + + // door B sense + data |= (m_floppy1->exists() ? 0 : 1) << 3; + + // door A sense + data |= (m_floppy0->exists() ? 0 : 1) << 4; + + // single/double sided jumper + //data |= 0x20; + + return data; +} + +WRITE8_MEMBER( victor_9000_fdc_t::via6_pb_w ) +{ + /* + + bit description + + PB0 RDY0 + PB1 RDY1 + PB2 _SCRESET + PB3 + PB4 + PB5 + PB6 STP0 + PB7 STP1 + + */ + + set_rdy0(BIT(data, 0)); + set_rdy1(BIT(data, 1)); + + // motor speed controller reset + if (!BIT(data, 2)) + m_maincpu->reset(); + + bool sync = false; + + // stepper enable A + int stp0 = BIT(data, 6); + if (m_stp0 != stp0) sync = true; + + // stepper enable B + int stp1 = BIT(data, 7); + if (m_stp1 != stp1) sync = true; + + if (sync) + { + live_sync(); + + m_stp0 = stp0; + update_stepper_motor(m_floppy0, m_stp0, m_st0, m_st0); + + m_stp1 = stp1; + update_stepper_motor(m_floppy1, m_stp1, m_st1, m_st1); + + if (LOG_VIA) logerror("%s %s STP0 %u STP1 %u\n", machine().time().as_string(), machine().describe_context(), stp0, stp1); + + checkpoint(); + live_run(); + } +} + +WRITE_LINE_MEMBER( victor_9000_fdc_t::drw_w ) +{ + if (m_drw != state) + { + live_sync(); + m_drw = cur_live.drw = state; + checkpoint(); + if (LOG_VIA) logerror("%s %s DRW %u\n", machine().time().as_string(), machine().describe_context(), state); + if (state) { + pll_stop_writing(get_floppy(), machine().time()); + } else { + pll_start_writing(machine().time()); + } + live_run(); + } +} + +WRITE_LINE_MEMBER( victor_9000_fdc_t::erase_w ) +{ + if (m_erase != state) + { + live_sync(); + m_erase = cur_live.erase = state; + checkpoint(); + if (LOG_VIA) logerror("%s %s ERASE %u\n", machine().time().as_string(), machine().describe_context(), state); + live_run(); + } +} + +WRITE_LINE_MEMBER( victor_9000_fdc_t::via6_irq_w ) +{ + m_via6_irq = state; + + m_irq_cb(m_via4_irq || m_via5_irq || m_via6_irq); +} + +READ8_MEMBER( victor_9000_fdc_t::cs7_r ) +{ + m_lbrdy_cb(1); + + if (LOG_VIA) logerror("%s %s LBRDY 1 : %02x\n", machine().time().as_string(), machine().describe_context(), m_via5->read(space, offset)); + + return m_via5->read(space, offset); +} + +WRITE8_MEMBER( victor_9000_fdc_t::cs7_w ) +{ + m_lbrdy_cb(1); + + if (LOG_VIA) logerror("%s %s LBRDY 1\n", machine().time().as_string(), machine().describe_context()); + + m_via5->write(space, offset, data); +} + +floppy_image_device* victor_9000_fdc_t::get_floppy() +{ + return m_drive ? m_floppy1 : m_floppy0; +} + +void victor_9000_fdc_t::live_start() +{ + cur_live.tm = machine().time(); + cur_live.state = RUNNING; + cur_live.next_state = -1; + + cur_live.shift_reg = 0; + cur_live.shift_reg_write = 0; + cur_live.bit_counter = 0; + cur_live.sync_bit_counter = 0; + cur_live.sync_byte_counter = 0; + + cur_live.drive = m_drive; + cur_live.side = m_side; + cur_live.drw = m_drw; + cur_live.wd = m_wd; + cur_live.wrsync = m_wrsync; + cur_live.erase = m_erase; + + pll_reset(cur_live.tm); + checkpoint_live = cur_live; + pll_save_checkpoint(); + + live_run(); +} + +void victor_9000_fdc_t::pll_reset(const attotime &when) +{ + cur_pll.reset(when); + cur_pll.set_clock(attotime::from_nsec(2130)); +} + +void victor_9000_fdc_t::pll_start_writing(const attotime &tm) +{ + cur_pll.start_writing(tm); + pll_reset(cur_live.tm); +} + +void victor_9000_fdc_t::pll_commit(floppy_image_device *floppy, const attotime &tm) +{ + cur_pll.commit(floppy, tm); +} + +void victor_9000_fdc_t::pll_stop_writing(floppy_image_device *floppy, const attotime &tm) +{ + cur_pll.stop_writing(floppy, tm); + pll_reset(cur_live.tm); +} + +void victor_9000_fdc_t::pll_save_checkpoint() +{ + checkpoint_pll = cur_pll; +} + +void victor_9000_fdc_t::pll_retrieve_checkpoint() +{ + cur_pll = checkpoint_pll; +} + +int victor_9000_fdc_t::pll_get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit) +{ + return cur_pll.get_next_bit(tm, floppy, limit); +} + +bool victor_9000_fdc_t::pll_write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit) +{ + return cur_pll.write_next_bit(bit, tm, floppy, limit); +} + +void victor_9000_fdc_t::checkpoint() +{ + pll_commit(get_floppy(), cur_live.tm); + checkpoint_live = cur_live; + pll_save_checkpoint(); +} + +void victor_9000_fdc_t::rollback() +{ + cur_live = checkpoint_live; + pll_retrieve_checkpoint(); +} + +void victor_9000_fdc_t::live_delay(int state) +{ + cur_live.next_state = state; + if(cur_live.tm != machine().time()) + t_gen->adjust(cur_live.tm - machine().time()); + else + live_sync(); +} + +void victor_9000_fdc_t::live_sync() +{ + if(!cur_live.tm.is_never()) { + if(cur_live.tm > machine().time()) { + rollback(); + live_run(machine().time()); + pll_commit(get_floppy(), cur_live.tm); + } else { + pll_commit(get_floppy(), cur_live.tm); + if(cur_live.next_state != -1) { + cur_live.state = cur_live.next_state; + cur_live.next_state = -1; + } + if(cur_live.state == IDLE) { + pll_stop_writing(get_floppy(), cur_live.tm); + cur_live.tm = attotime::never; + } + } + cur_live.next_state = -1; + checkpoint(); + } +} + +void victor_9000_fdc_t::live_abort() +{ + if(!cur_live.tm.is_never() && cur_live.tm > machine().time()) { + rollback(); + live_run(machine().time()); + } + + pll_stop_writing(get_floppy(), cur_live.tm); + + cur_live.tm = attotime::never; + cur_live.state = IDLE; + cur_live.next_state = -1; + + cur_live.brdy = 1; + cur_live.lbrdy_changed = true; + cur_live.sync = 1; + cur_live.syn = 1; + cur_live.syn_changed = true; + cur_live.gcr_err = 1; +} + +void victor_9000_fdc_t::live_run(const attotime &limit) +{ + if(cur_live.state == IDLE || cur_live.next_state != -1) + return; + + for(;;) { + switch(cur_live.state) { + case RUNNING: { + bool syncpoint = false; + + if (cur_live.tm > limit) + return; + + // read bit + int bit = 0; + if (cur_live.drw) { + bit = pll_get_next_bit(cur_live.tm, get_floppy(), limit); + if(bit < 0) + return; + } + + // write bit + int write_bit = 0; + if (!cur_live.drw) { // TODO WPS + write_bit = BIT(cur_live.shift_reg_write, 9); + if (pll_write_next_bit(write_bit, cur_live.tm, get_floppy(), limit)) + return; + } + + // clock read shift register + cur_live.shift_reg <<= 1; + cur_live.shift_reg |= bit; + cur_live.shift_reg &= 0x3ff; + + // sync + int sync = !(cur_live.shift_reg == 0x3ff); + + // bit counter + if (cur_live.drw) { + if (!sync) { + cur_live.bit_counter = 0; + } else if (cur_live.sync) { + cur_live.bit_counter++; + if (cur_live.bit_counter == 10) { + cur_live.bit_counter = 0; + } + } + } else { + cur_live.bit_counter++; + if (cur_live.bit_counter == 10) { + cur_live.bit_counter = 0; + } + } + + // sync counter + if (sync) { + cur_live.sync_bit_counter = 0; + cur_live.sync_byte_counter = 10; // TODO 9 in schematics + } else if (!cur_live.sync) { + cur_live.sync_bit_counter++; + if (cur_live.sync_bit_counter == 10) { + cur_live.sync_bit_counter = 0; + cur_live.sync_byte_counter++; + if (cur_live.sync_byte_counter == 16) { + cur_live.sync_byte_counter = 0; + } + } + } + + // syn + int syn = !(cur_live.sync_byte_counter == 15); + + // GCR decoder + if (cur_live.drw) { + cur_live.i = cur_live.drw << 10 | cur_live.shift_reg; + } else { + cur_live.i = cur_live.drw << 10 | 0x200 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f); + } + + cur_live.e = m_gcr_rom->base()[cur_live.i]; + + attotime next = cur_live.tm + m_period; + if (LOG) logerror("%s:%s cyl %u bit %u sync %u bc %u sr %03x sbc %u sBC %u syn %u i %03x e %02x\n",cur_live.tm.as_string(),next.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.sync_bit_counter,cur_live.sync_byte_counter,syn,cur_live.i,cur_live.e); + + // byte ready + int brdy = !(cur_live.bit_counter == 9); + + // GCR error + int gcr_err = !(brdy || BIT(cur_live.e, 3)); + + if (LOG_BITS) { + if (cur_live.drw) { + logerror("%s cyl %u bit %u sync %u bc %u sr %03x i %03x e %02x\n",cur_live.tm.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.i,cur_live.e); + } else { + logerror("%s cyl %u writing bit %u bc %u sr %03x i %03x e %02x\n",cur_live.tm.as_string(),get_floppy()->get_cyl(),write_bit,cur_live.bit_counter,cur_live.shift_reg_write,cur_live.i,cur_live.e); + } + } + + if (!brdy) { + // load write shift register + cur_live.shift_reg_write = GCR_ENCODE(cur_live.e, cur_live.i); + + if (LOG) logerror("%s load write shift register %03x\n",cur_live.tm.as_string(),cur_live.shift_reg_write); + } else { + // clock write shift register + cur_live.shift_reg_write <<= 1; + cur_live.shift_reg_write &= 0x3ff; + } + + if (brdy != cur_live.brdy) { + if (LOG) logerror("%s BRDY %u\n", cur_live.tm.as_string(),brdy); + if (!brdy) + { + cur_live.lbrdy_changed = true; + if (LOG_VIA) logerror("%s LBRDY 0 : %02x\n", cur_live.tm.as_string(), GCR_DECODE(cur_live.e, cur_live.i)); + } + cur_live.brdy = brdy; + syncpoint = true; + } + + if (sync != cur_live.sync) { + if (LOG) logerror("%s SYNC %u\n", cur_live.tm.as_string(),sync); + cur_live.sync = sync; + syncpoint = true; + } + + if (syn != cur_live.syn) { + if (LOG) logerror("%s SYN %u\n", cur_live.tm.as_string(),syn); + cur_live.syn = syn; + cur_live.syn_changed = true; + syncpoint = true; + } + + if (gcr_err != cur_live.gcr_err) { + if (LOG) logerror("%s GCR ERR %u\n", cur_live.tm.as_string(),gcr_err); + cur_live.gcr_err = gcr_err; + syncpoint = true; + } + + if (syncpoint) { + live_delay(RUNNING_SYNCPOINT); + return; + } + break; + } + + case RUNNING_SYNCPOINT: { + if (cur_live.lbrdy_changed) { + m_lbrdy_cb(0); + cur_live.lbrdy_changed = false; + } + + if (cur_live.syn_changed) { + m_syn_cb(cur_live.syn); + cur_live.syn_changed = false; + } + + m_via5->write_ca1(cur_live.brdy); + + cur_live.state = RUNNING; + checkpoint(); + break; + } + } + } +} diff --git a/src/mame/machine/victor9k_fdc.h b/src/mame/machine/victor9k_fdc.h new file mode 100644 index 00000000000..21c88ebfabf --- /dev/null +++ b/src/mame/machine/victor9k_fdc.h @@ -0,0 +1,241 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Victor 9000 floppy disk controller emulation + +**********************************************************************/ + +#pragma once + +#ifndef __VICTOR_9000_FDC__ +#define __VICTOR_9000_FDC__ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" +#include "formats/victor9k_dsk.h" +#include "imagedev/floppy.h" +#include "machine/6522via.h" +#include "machine/fdc_pll.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_VICTOR_9000_FDC_IRQ_CB(_write) \ + devcb = &victor_9000_fdc_t::set_irq_wr_callback(*device, DEVCB_##_write); + +#define MCFG_VICTOR_9000_FDC_SYN_CB(_write) \ + devcb = &victor_9000_fdc_t::set_syn_wr_callback(*device, DEVCB_##_write); + +#define MCFG_VICTOR_9000_FDC_LBRDY_CB(_write) \ + devcb = &victor_9000_fdc_t::set_lbrdy_wr_callback(*device, DEVCB_##_write); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> victor_9000_fdc_t + +class victor_9000_fdc_t : public device_t +{ +public: + // construction/destruction + victor_9000_fdc_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_irq_cb.set_callback(object); } + template static devcb_base &set_syn_wr_callback(device_t &device, _Object object) { return downcast(device).m_syn_cb.set_callback(object); } + template static devcb_base &set_lbrdy_wr_callback(device_t &device, _Object object) { return downcast(device).m_lbrdy_cb.set_callback(object); } + + DECLARE_READ8_MEMBER( cs5_r ) { return m_via4->read(space, offset); } + DECLARE_WRITE8_MEMBER( cs5_w ) { m_via4->write(space, offset, data); } + DECLARE_READ8_MEMBER( cs6_r ) { return m_via6->read(space, offset); } + DECLARE_WRITE8_MEMBER( cs6_w ) { m_via6->write(space, offset, data); } + DECLARE_READ8_MEMBER( cs7_r ); + DECLARE_WRITE8_MEMBER( cs7_w ); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); + + DECLARE_READ8_MEMBER( floppy_p1_r ); + DECLARE_WRITE8_MEMBER( floppy_p1_w ); + DECLARE_READ8_MEMBER( floppy_p2_r ); + DECLARE_WRITE8_MEMBER( floppy_p2_w ); + DECLARE_READ8_MEMBER( tach0_r ); + DECLARE_READ8_MEMBER( tach1_r ); + DECLARE_WRITE8_MEMBER( da_w ); + + DECLARE_READ8_MEMBER( via4_pa_r ); + DECLARE_WRITE8_MEMBER( via4_pa_w ); + DECLARE_READ8_MEMBER( via4_pb_r ); + DECLARE_WRITE8_MEMBER( via4_pb_w ); + DECLARE_WRITE_LINE_MEMBER( wrsync_w ); + DECLARE_WRITE_LINE_MEMBER( via4_irq_w ); + + DECLARE_READ8_MEMBER( via5_pa_r ); + DECLARE_WRITE8_MEMBER( via5_pb_w ); + DECLARE_WRITE_LINE_MEMBER( via5_irq_w ); + + DECLARE_READ8_MEMBER( via6_pa_r ); + DECLARE_READ8_MEMBER( via6_pb_r ); + DECLARE_WRITE8_MEMBER( via6_pa_w ); + DECLARE_WRITE8_MEMBER( via6_pb_w ); + DECLARE_WRITE_LINE_MEMBER( drw_w ); + DECLARE_WRITE_LINE_MEMBER( erase_w ); + DECLARE_WRITE_LINE_MEMBER( via6_irq_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + +private: + static const int rpm[0x100]; + + enum + { + TM_GEN, + TM_TACH0, + TM_TACH1 + }; + + enum + { + LED_A = 0, + LED_B + }; + + enum { + IDLE, + RUNNING, + RUNNING_SYNCPOINT + }; + + struct live_info { + attotime tm; + int state, next_state; + + int drive; + int side; + int drw; + + // common + offs_t i; + UINT8 e; + + // read + UINT16 shift_reg; + int bit_counter; + int sync_bit_counter; + int sync_byte_counter; + int brdy; + bool lbrdy_changed; + int sync; + int syn; + bool syn_changed; + int gcr_err; + + // write + UINT16 shift_reg_write; + UINT8 wd; + int wrsync; + int gcr_data; + int erase; + }; + + devcb_write_line m_irq_cb; + devcb_write_line m_syn_cb; + devcb_write_line m_lbrdy_cb; + + required_device m_maincpu; + required_device m_via4; + required_device m_via5; + required_device m_via6; + required_device m_floppy0; + required_device m_floppy1; + required_memory_region m_gcr_rom; + + void update_stepper_motor(floppy_image_device *floppy, int stp, int old_st, int st); + void update_spindle_motor(floppy_image_device *floppy, emu_timer *t_tach, bool start, bool stop, bool sel, UINT8 &da); + void set_rdy0(int state); + void set_rdy1(int state); + + int load0_cb(floppy_image_device *device); + void unload0_cb(floppy_image_device *device); + + int load1_cb(floppy_image_device *device); + void unload1_cb(floppy_image_device *device); + + UINT8 m_p2; + + /* floppy state */ + UINT8 m_da; + UINT8 m_da0; + UINT8 m_da1; + int m_start0; + int m_stop0; + int m_start1; + int m_stop1; + int m_sel0; + int m_sel1; + int m_tach0; + int m_tach1; + int m_rdy0; + int m_rdy1; + UINT8 m_l0ms; + UINT8 m_l1ms; + int m_st0; + int m_st1; + int m_stp0; + int m_stp1; + int m_drive; + int m_side; + int m_drw; + int m_erase; + UINT8 m_wd; + int m_wrsync; + + int m_via4_irq; + int m_via5_irq; + int m_via6_irq; + + attotime m_period; + + live_info cur_live, checkpoint_live; + fdc_pll_t cur_pll, checkpoint_pll; + emu_timer *t_gen, *t_tach0, *t_tach1; + + floppy_image_device* get_floppy(); + void live_start(); + void pll_reset(const attotime &when); + void pll_start_writing(const attotime &tm); + void pll_commit(floppy_image_device *floppy, const attotime &tm); + void pll_stop_writing(floppy_image_device *floppy, const attotime &tm); + int pll_get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit); + bool pll_write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit); + void pll_save_checkpoint(); + void pll_retrieve_checkpoint(); + void checkpoint(); + void rollback(); + void live_delay(int state); + void live_sync(); + void live_abort(); + void live_run(const attotime &limit = attotime::never); +}; + + + +// device type definition +extern const device_type VICTOR_9000_FDC; + + + +#endif diff --git a/src/mame/machine/victor9kb.c b/src/mame/machine/victor9kb.c new file mode 100644 index 00000000000..a0cf21bfe36 --- /dev/null +++ b/src/mame/machine/victor9kb.c @@ -0,0 +1,712 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Victor 9000 keyboard emulation + +*********************************************************************/ + +/* + +Keyboard PCB Layout +---------- + +Marking on PCB back: A65-02307-201D 007 + +|------------------------------------------------------------------------------------| +| 22-908-03 22-950-3B XTAL 8021 74LS14 [804x] [EPROM] [???] L CN1=___ +| X X X X X X X X X X X | +| X X X X X X X X X X X X X X X X X X X X X | +| X X X X X X X X X X X X X X X X X X X X X | +| X X X X X X X X X X X X X X X X X X X X X | +| X X X X X X X X X X X X X X X X X X X X | +| X X marking X X X X X X X X | +|----------------------------------------------------------------------------------------| + + +Notes: + All IC's shown. + XTAL - 3.579545Mhz Crystal, marked "48-300-010" (front of xtal) and "3.579545Mhz" (back of xtal) + 74LS14 - Z4 - 74LS14 Hex inverter with Schmitt-trigger inputs (0.8v hysteresis) + 8021 - Z3 - Intel 8021 MCU, marked: "P8021 2137 // 8227 // 20-8021-139 // (C) INTEL 77" + 22-908-03 - Z2 - Exar Semiconductor XR22-008-03 keyboard matrix capacitive readout latch + 22-950-3B - Z1 - Exar Semiconductor XR22-050-3B keyboard matrix row driver with 4 to 12 decoder/demultiplexer + CN1 or J1 - J1 - keyboard data connector (SIP, 7 pins, right angle) + L - L1 & L2 - mil-spec 22uH 10% inductors (double wide silver band(mil spec), red(2) red(2) black(x1uH) silver(10%)) + + [804x] - unpopulated space for a 40 pin 804x or 803x MCU + [EPROM] - unpopulated space for an EPROM, if a ROMless 803x MCU was used + [???] - unpopulated space for an unknown NDIP10 IC or DIP-switch array + X - capacitive sensor pad for one key + marking - PCB trace marking: "KTC // A65-02307-007 // PCB 201 D" + +74LS14 (Hex inverter with Schmitt-trigger inputs (0.8v hysteresis)) +------------------ + __ __ + 1A 1 |* \_/ | 14 VCC + /1Y 2 | | 13 6A + 2A 3 | | 12 /6Y + /2Y 4 | | 11 5A + 3A 5 | 74LS14| 10 /5Y + /3Y 6 | | 9 4A + GND 7 |_______| 8 /4Y + + +P8021 Pinout +------------------ + _____ _____ + P22 1 |* \_/ | 28 VCC + P23 2 | | 27 P21 + PROG 3 | | 26 P20 + P00 4 | | 25 P17 + P01 5 | P8021 | 24 P16 + P02 6 | | 23 P15 + P03 7 | | 22 P14 + P04 8 | | 21 P13 + P05 9 | | 20 P12 + P06 10 | | 19 P11 + P07 11 | | 18 P10 + ALE 12 | | 17 RESET + T1 13 | | 16 XTAL 2 + VSS 14 |_____________| 15 XTAL 1 + + +XR22-008-03 Pinout (AKA XR22-908-03) +------------------ + _____ _____ + D0 1 |* \_/ | 20 Vcc + D1 2 | | 19 _CLR + D2 3 | | 18 Q0 + D3 4 | | 17 Q1 + HYS 5 | 22-008-03 | 16 Q2 + D4 6 | | 15 Q3 + D5 7 | | 14 Q4 + D6 8 | | 13 Q5 + D7 9 | | 12 Q6 + GND 10 |_____________| 11 Q7 + + +XR22-050-3B Pinout (AKA XR22-950-3B) +------------------ + _____ _____ + Y8 1 |* \_/ | 20 Vcc + Y9 2 | | 19 Y7 + Y10 3 | | 18 Y6 + Y11 4 | | 17 Y5 + _STB 5 | 22-050-3B | 16 Y4 + A0 6 | | 15 Y3 + A1 7 | | 14 Y2 + A2 8 | | 13 Y1 + A3 9 | | 12 Y0 + GND 10 |_____________| 11 OE? + +i8021 to elsewhere connections +------------------------------ +8021 pin - 22-xxx pin + P22 1 - 74LS14 pin 5 (3A) AND (804x chip pin 37, P26) + P23 2 - 74LS14 pin 11 (5A) AND (804x chip pin 38, P27) + PROG 3 - (804x chip pin 25, PROG) + P00 4 - N/C + P01 5 - N/C + P02 6 - N/C + P03 7 - N/C + P04 8 - N/C + P05 9 - N/C + P06 10 - N/C + P07 11 - N/C + ALE 12 - N/C + T1 13 - 74LS14 pin 2 (/1Y) AND (804x chip pin 39, T1) + VSS 14 - GND +XTAL1 15 - XTAL +XTAL2 16 - XTAL +RESET 17 - 10uf capacitor - VCC + P10 18 - 22-908 pin 18 (Q0) AND 22-950 pin 6 (A0) AND (804x chip pin 27, P10) + P11 19 - 22-908 pin 17 (Q1) AND 22-950 pin 7 (A1) AND (804x chip pin 28, P11) + P12 20 - 22-908 pin 16 (Q2) AND 22-950 pin 8 (A2) AND (804x chip pin 29, P12) + P13 21 - 22-908 pin 15 (Q3) AND 22-950 pin 9 (A3) AND (804x chip pin 30, P13) + P14 22 - 22-908 pin 14 (Q4) AND (804x chip pin 31, P14) + P15 23 - 22-908 pin 13 (Q5) AND (804x chip pin 32, P15) + P16 24 - 22-908 pin 12 (Q6) AND (804x chip pin 33, P16) + P17 25 - 22-908 pin 11 (Q7) AND (804x chip pin 34, P17) + P20 26 - 22-908 pin 19 (/CLR) AND 22-950 pin 5 (/STB) AND (804x chip pin 35, P24) + P21 27 - 74LS14 pin 9 (4A) AND (804x chip pin 36, P25) + VCC 28 - VCC + +74LS14 to elsewhere connections +------------------------------- + 1A 1 - 100 Ohm resistor - J1 pin 4 + /1Y 2 - 8021 pin 13 (T1) + 2A 3 - 74LS14 pin 8 + /2Y 4 - 22uH 10% inductor 'L1' - J1 pin 5 + 3A 5 - 8021 pin 1 (P22) + /3Y 6 - many keyboard contact pads (!) + GND 7 - GND + /4Y 8 - 74LS14 pin 3 + 4A 9 - 8021 pin 27 (P21) + /5Y 10 - 74LS14 pin 13 + 5A 11 - 8021 pin 2 (P23) + /6Y 12 - 22uH 10% inductor 'L2' - J1 pin 6 + 6A 13 - 74LS14 pin 10 + VCC 14 - VCC + + +J1 (aka CN1) connections: +------------------------- +1 - VCC +2 - GND +3 - GND +4 - 100 Ohm 5% resistor -> 74LS14 pin 1 -> inverted 74LS14 pin 2 -> inverted 8021 pin 13 (T1) +5 - 22uH 10% inductor 'L1' <- 74LS14 pin 4 <- inverted 74LS14 pin 3 <- inverted 74LS14 pin 8 <- 74LS14 pin 9 <- 8021 pin 27 (P21) +6 - 22uH 10% inductor 'L2' <- 74LS14 pin 12 <- inverted 74LS14 pin 13 <- inverted 74LS14 pin 10 <- 74LS14 pin 11 <- 8021 pin 2 (P23) +7 - VCC + +Pins 5,and 6 also have a .0047uF capacitor to GND (forming some sort of LC filter) +There is another .0047uF capacitor to ground from the connection between 74LS14 pin 1 and the 100 Ohm 5% resistor which connects to pin 4 (forming some sort of RC filter) + +Exar Custom connections between each other: +------------------------------------------- +22-950 pin 11 (OE?) - 68KOhm 5% resistor - 22-908 pin 5 (HYS) + +Cable connecting J1/CN1 to the Victor: +-------------------------------------- +RJ45 when looking at end of plug (not socket!) +.||||||||. +|87654321| +|__----__| + |__| + +RJ45 pins Wire Color Connection +1 White J1 pin 1 (VCC) +2 Yellow J1 pin 2 (GND) +3 Green J1 pin 3 (GND) +4 Orange J1 pin 4 (?KBACK?) +5 Blue J1 pin 5 (?KBRDY?) +6 Red J1 pin 6 (?KBDATA?) +7 Black J1 pin 7 (VCC) +8 shield/bare Keyboard Frame Ground + + +Key Layout (USA Variant): (the S0x markings appear on the back of the PCB) +|------------------------------------------------------------------------------------| +| 22-908-03 22-950-3B XTAL 8021 74LS14 [804x] [EPROM] [???] L CN1=___ +| 01 02 03 04 05 06 07 08 09 10 11 | +| 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | +| 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | +| 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | +| 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | +| 95 96 marking 97 98 99 100 101 102 103 104| +|----------------------------------------------------------------------------------------| + + key - Shifted(top)/Unshifted(bottom)/Alt(front) (if no slashes in description assume key has just one symbol on it) + S01 - [1] + S02 - [2] + S03 - [3] + S04 - [4] + S05 - [5] + S06 - [6] + S07 - [7] + S08 - [8] + S09 - UNUSED (under the [8] key, no metal contact on key) + S10 - [9] + S11 - [10] + + S12 - CLR/HOME + S13 - (Degree symbol U+00B0)/(+- symbol U+00B1)/(Pi symbol U+03C0) + S14 - !/1/| + S15 - @/2/< + S16 - #/3/> + S17 - $/4/(centered closed dot U+00B7) + S18 - %/5/(up arrow symbol U+2191) + S19 - (cent symbol U+00A2)/6/(logical not symbol U+00AC) + S20 - &/7/^ + S21 - * /8/` + S22 - (/9/{ + S23 - )/0/} + S24 - _/-/~ + S25 - +/=/\ + S26 - BACKSPACE + S27 - INS + S28 - DEL + S29 - MODE CALC/= (white keypad key) + S30 - % (white keypad key) + S31 - (division symbol U+00F7) (white keypad key) + S32 - (multiplication symbol U+00D7) (white keypad key) + + S33 - (up arrow, SCRL, down arrow)//VTAB + S34 - TAB//BACK + S35 - Q + S36 - W + S37 - E + S38 - R + S39 - T + S40 - Y + S41 - U + S42 - I + S43 - O + S44 - P + S45 - (1/4 symbol U+00BC)/(1/2 symbol U+00BD) + S46 - [/] + S47 - UNUSED (under the RETURN key, no metal contact on key) + S48 - ERASE/EOL + S49 - REQ/CAN + S50 - 7 (white keypad key) + S51 - 8 (white keypad key) + S52 - 9 (white keypad key) + S53 - - (white keypad key) + + S54 - (OFF,RVS,ON)//ESC + S55 - LOCK//CAPS LOCK + S56 - A + S57 - S + S58 - D + S59 - F + S60 - G + S61 - H + S62 - J + S63 - K + S64 - L + S65 - :/; + S66 - "/' + S67 - UNUSED (under the RETURN key, no metal contact on key) + S68 - RETURN + S69 - WORD/(left arrow U+2190)/(volume up U+1F508 plus U+25B4) (i.e. 'Previous Word') + S70 - WORD/(right arrow U+2192)/(volume down U+1F508 plus U+25BE) (i.e. 'Next Word') + S71 - 4 (white keypad key) + S72 - 5 (white keypad key) + S73 - 6 (white keypad key) + S74 - + (white keypad key) + + S75 - (OFF,UNDL,ON) + S76 - SHIFT (left shift) + S77 - UNUSED (under the left SHIFT key, no metal contact on key) + S78 - Z + S79 - X + S80 - C + S81 - V + S82 - B + S83 - N + S84 - M + S85 - ,/, (yes, both are comma) + S86 - ./. (yes, both are period/fullstop) + S87 - ?// (this is the actual / key) + S88 - SHIFT (right shift) + S89 - (up arrow U+2191)//(brightness up U+263C plus U+25B4) + S90 - (down arrow U+2193)//(brightness down U+263C plus U+25BE) + S91 - 1 (white keypad key) + S92 - 2 (white keypad key) + S93 - 3 (white keypad key) + S94 - ENTER (white keypad key) + + S95 - RPT + S96 - ALT + S97 - (spacebar) + S98 - PAUSE/CONT + S99 - (left arrow U+2190)//(contrast up U+25D0 plus U+25B4) (U+1F313 can be used in place of U+25D0) + S100 - (right arrow U+2192)//(contrast down U+25D0 plus U+25BE) '' + S101 - 0 (white keypad key) + S102 - 00 (white keypad key) ('double zero') + S103 - . (white keypad key) + S104 - UNUSED (under the ENTER (keypad) key, no metal contact on key) + + Note that the five unused key contacts: + S09, S47, S67, S77 and S104 + may be used on international variants of the Victor 9000/Sirius 1 Keyboard. + +Keyboard Matrix +--------------- +Row select +| Columns Sxxx by bit Columns Key by bit +| D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 +V V V V V V V V V V V V V V V V V +Y0 12 13 33 34 54 55 75 76 CLRH DEGR SCRL TAB RVS LOCK UNDL LSHFT +Y1 14 15 35 36 56 57 77 78 1 2 Q W A S N/A Z +Y2 16 17 37 38 58 59 79 80 3 4 E R D F X C +Y3 18 19 39 40 60 61 81 82 5 6 T Y G H V B +Y4 20 21 41 42 62 63 83 84 7 8 U I J K N M +Y5 22 23 43 44 64 65 85 86 9 0 O P L ; , . +Y6 24 25 45 46 66 67 87 88 - = 1/2 [] ' N/A ? RSHFT +Y7 26 27 47 48 68 69 89 90 BKSP INS N/A ERSE RETN WRDL UP DOWN +Y8 28 29 49 50 70 71 91 92 DEL MODE REQ k7 WRDR k4 k1 k2 +Y9 30 31 51 52 72 73 93 94 k% kDIV k8 k9 k5 k6 k3 kENTR +Y10 32 11 53 10 74 09 07 06 kMUL [10] k- [9] k+ N/A [7] [6] +Y11 104 103 102 101 100 99 98 97 kN/A k. k00 k0 RGHT LEFT PAUS SPACE +/3Y 05 04 03 02 01 08 95 96 [5] [4] [3] [2] [1] [8] RPT ALT + +*/ + +#include "victor9kb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8021_TAG "z3" + +#define LOG 0 + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type VICTOR9K_KEYBOARD = &device_creator; + + +//------------------------------------------------- +// ROM( victor9k_keyboard ) +//------------------------------------------------- + +ROM_START( victor9k_keyboard ) + ROM_REGION( 0x400, I8021_TAG, 0) + ROM_LOAD( "20-8021-139.z3", 0x000, 0x400, CRC(0fe9d53d) SHA1(61d92ba90f98f8978bbd9303c1ac3134cde8cdcb) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *victor_9000_keyboard_t::device_rom_region() const +{ + return ROM_NAME( victor9k_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( kb_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( victor9k_keyboard_io, AS_IO, 8, victor_9000_keyboard_t ) + // P0 is unconnected on pcb + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) + AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(kb_t1_r) +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_DRIVER( victor9k_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( victor9k_keyboard ) + MCFG_CPU_ADD(I8021_TAG, I8021, XTAL_3_579545MHz) + MCFG_CPU_IO_MAP(victor9k_keyboard_io) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor victor_9000_keyboard_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( victor9k_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( victor9k_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( victor9k_keyboard ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR/HOME") PORT_CODE(KEYCODE_HOME) // S12 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_PLUSMINUS" " UTF8_DEGREES" " UTF8_SMALL_PI) PORT_CODE(KEYCODE_TILDE) // +-, degree, pi // S13 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP" SCRL " UTF8_DOWN) PORT_CODE(KEYCODE_SCRLOCK) // unicode arrows // S33 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB/BACK") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) // S34 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RVS On-Off/ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) // S54 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK/CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) // S55 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNDL On-Off") PORT_CODE(KEYCODE_PRTSCR) // need better key code // S75 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // S76 + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 ! |") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR('|') // S14 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 @ <") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR('<') // S15 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // S35 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // S36 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // S56 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // S57 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S75") // unused // S75 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // S76 + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # >") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR('>') // S16 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $ \xc2\xb7") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // centered closed dot U+00B7 // S17 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // S37 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // S38 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // S58 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // S59 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // S79 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // S80 + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 % " UTF8_UP) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // S18 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 \xc2\xa2 \xc2\xac") PORT_CODE(KEYCODE_6) PORT_CHAR('6') // cent U+00A2, logic not U+00AC // S19 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // S39 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // S40 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // S60 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // S61 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // S81 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // S82 + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 & ^") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR('^') // S20 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 * `") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR('`') // S21 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // S41 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // S42 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // S62 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // S63 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // S83 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // S84 + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 ( {") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('{') // S22 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 ) }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR('}') // S23 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // S43 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // S44 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // S64 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') // S65 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') // S85 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') // S86 + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _ ~") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHAR('~') // S24 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= + \\") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('\\') // S25 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xbd \xc2\xbc") PORT_CODE(KEYCODE_OPENBRACE) // unicode half fraction U+00BD / quarter fraction U+00BC // S45 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR(']') // S46 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') // S66 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S67") // unused // S67 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // S87 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // S88 + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // S26 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) // S27 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S47") // unused // S47 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE/EOL") PORT_CODE(KEYCODE_END) // should this be mapped to end or del? // S48 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // S68 + //PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_LEFT"/Volume Up \xf0\x9f\x94\x88\xe2\x96\xb4") PORT_CODE(KEYCODE_PGUP) // unicode U+2190/U+1F508 + U+25B4 // S69 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_LEFT"/Volume Up") PORT_CODE(KEYCODE_PGUP) // unicode U+2190/U+1F508 + U+25B4 // S69 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP"/Brightness Up \xe2\x98\xbc\xe2\x96\xb4") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // U+2191/U+263C + U+25B4 // S89 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN"/Brightness Down \xe2\x98\xbc\xe2\x96\xbe") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // U+2193/U+263C + U+25BE // S90 + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(127) // S28 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad MODE CALC/=") PORT_CODE(KEYCODE_NUMLOCK) // S29 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REQ/CAN") PORT_CODE(KEYCODE_BACKSLASH) // is this a good key for this? does sysrq make more sense? // S49 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) // S50 + //PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_RIGHT"/Volume Down \xf0\x9f\x94\x88\xe2\x96\xbe") PORT_CODE(KEYCODE_PGDN) // unicode U+2192/U+1F508 + U+25B4 // S70 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_RIGHT"/Volume Down") PORT_CODE(KEYCODE_PGDN) // unicode U+2192/U+1F508 + U+25B4 // S70 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) // S71 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) // S91 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) // S92 + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad %") // find a good key for this // S30 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_DIVIDE) PORT_CODE(KEYCODE_SLASH_PAD) // unicode division sign U+00F7 // S31 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) // S51 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) // S52 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) // S72 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) // S73 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) // S93 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) // S94 + + PORT_START("YA") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_MULTIPLY) PORT_CODE(KEYCODE_ASTERISK) // unicode multiply sign U+00D7 // S32 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 [10]") PORT_CODE(KEYCODE_F10) // S11 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) // S53 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 [9]") PORT_CODE(KEYCODE_F9) // S10 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) // S74 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S09") // unused // S09 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 [7]") PORT_CODE(KEYCODE_F7) // S07 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 [6]") PORT_CODE(KEYCODE_F6) // S06 + + PORT_START("YB") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S04") // unused // S104 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) // S103 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 00") // S102 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) // S101 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT"/Contrast Down \xe2\x97\x90\xe2\x96\xbe") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // U+2190/U+25D0 + U+25BE S100 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT"/Contrast Up \xe2\x97\x90\xe2\x96\xb4") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // U+2190/U+25D0 + U+25B4 S99 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE/CONT") PORT_CODE(KEYCODE_PAUSE) // S98 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Spacebar") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // S97 + + PORT_START("YC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 [5]") PORT_CODE(KEYCODE_F5) // S05 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 [4]") PORT_CODE(KEYCODE_F4) // S04 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 [3]") PORT_CODE(KEYCODE_F3) // S03 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 [2]") PORT_CODE(KEYCODE_F2) // S02 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 [1]") PORT_CODE(KEYCODE_F1) // S01 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 [8]") PORT_CODE(KEYCODE_F8) // S11 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RPT") PORT_CODE(KEYCODE_LCONTROL) // S95 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_SHIFT_2) // S96 +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor victor_9000_keyboard_t::device_input_ports() const +{ + return INPUT_PORTS_NAME( victor9k_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// victor_9000_keyboard_t - constructor +//------------------------------------------------- + +victor_9000_keyboard_t::victor_9000_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, VICTOR9K_KEYBOARD, "Victor 9000 Keyboard", tag, owner, clock, "victor9kb", __FILE__), + m_maincpu(*this, I8021_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_ya(*this, "YA"), + m_yb(*this, "YB"), + m_yc(*this, "YC"), + m_kbrdy_cb(*this), + m_kbdata_cb(*this), + m_y(0), + m_kbrdy(-1), + m_kbdata(-1), + m_kback(1) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void victor_9000_keyboard_t::device_start() +{ + // resolve callbacks + m_kbrdy_cb.resolve_safe(); + m_kbdata_cb.resolve_safe(); + + // state saving + save_item(NAME(m_p1)); + save_item(NAME(m_y)); + save_item(NAME(m_stb)); + save_item(NAME(m_y12)); + save_item(NAME(m_kbrdy)); + save_item(NAME(m_kbdata)); + save_item(NAME(m_kback)); +} + + +//------------------------------------------------- +// kback_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( victor_9000_keyboard_t::kback_w ) +{ + if (LOG) logerror("KBACK %u\n", state); + + m_kback = !state; +} + + +//------------------------------------------------- +// kb_p1_r - +//------------------------------------------------- + +READ8_MEMBER( victor_9000_keyboard_t::kb_p1_r ) +{ + UINT8 data = 0xff; + + switch (m_y) + { + case 0: data &= m_y0->read(); break; + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 9: data &= m_y9->read(); break; + case 0xa: data &= m_ya->read(); break; + case 0xb: data &= m_yb->read(); break; + } + + if (!m_y12) + { + data &= m_yc->read(); + } + + return data; +} + + +//------------------------------------------------- +// kb_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( victor_9000_keyboard_t::kb_p1_w ) +{ + m_p1 = data; +} + + +//------------------------------------------------- +// kb_p2_w - +//------------------------------------------------- + +WRITE8_MEMBER( victor_9000_keyboard_t::kb_p2_w ) +{ + /* + + bit description + + P20 22-908 CLR, 22-950 STB + P21 KBRDY + P22 Y12 + P23 KBDATA + + */ + + // falling (?edge or level?), latch keyboard rows 0-11 + if (!BIT(data, 0)) + { + m_y = m_p1 & 0x0f; + } + + // keyboard row 12 + m_y12 = BIT(data, 2); + + // keyboard ready + m_kbrdy_cb(BIT(data, 1)); + + // keyboard data + m_kbdata_cb(BIT(data, 3)); +} + + +//------------------------------------------------- +// kb_t1_r - +//------------------------------------------------- + +READ8_MEMBER( victor_9000_keyboard_t::kb_t1_r ) +{ + return m_kback; +} diff --git a/src/mame/machine/victor9kb.h b/src/mame/machine/victor9kb.h new file mode 100644 index 00000000000..c3834e1a7d8 --- /dev/null +++ b/src/mame/machine/victor9kb.h @@ -0,0 +1,97 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Victor 9000 keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __VICTOR9K_KEYBOARD__ +#define __VICTOR9K_KEYBOARD__ + + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_VICTOR9K_KBRDY_HANDLER(_devcb) \ + devcb = &victor_9000_keyboard_t::set_kbrdy_cb(*device, DEVCB_##_devcb); + +#define MCFG_VICTOR9K_KBDATA_HANDLER(_devcb) \ + devcb = &victor_9000_keyboard_t::set_kbdata_cb(*device, DEVCB_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> victor_9000_keyboard_t + +class victor_9000_keyboard_t : public device_t +{ +public: + // construction/destruction + victor_9000_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_kbrdy_cb(device_t &device, _Object object) { return downcast(device).m_kbrdy_cb.set_callback(object); } + template static devcb_base &set_kbdata_cb(device_t &device, _Object object) { return downcast(device).m_kbdata_cb.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_WRITE_LINE_MEMBER( kback_w ); + + // not really public + DECLARE_READ8_MEMBER( kb_p1_r ); + DECLARE_WRITE8_MEMBER( kb_p1_w ); + DECLARE_WRITE8_MEMBER( kb_p2_w ); + DECLARE_READ8_MEMBER( kb_t1_r ); + +protected: + // device-level overrides + virtual void device_start(); + +private: + required_device m_maincpu; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_ya; + required_ioport m_yb; + required_ioport m_yc; + + devcb_write_line m_kbrdy_cb; + devcb_write_line m_kbdata_cb; + + UINT8 m_p1; + UINT8 m_y; + int m_stb; + int m_y12; + int m_kbrdy; + int m_kbdata; + int m_kback; +}; + + +// device type definition +extern const device_type VICTOR9K_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/vtech2.c b/src/mame/machine/vtech2.c new file mode 100644 index 00000000000..5929b4aab47 --- /dev/null +++ b/src/mame/machine/vtech2.c @@ -0,0 +1,489 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/*************************************************************************** + vtech2.c + + machine driver + Juergen Buchmueller MESS driver, Jan 2000 + Davide Moretti ROM dump and hardware description + + TODO: + Add loading images from WAV files. + Printer and RS232 support. + Check if the FDC is really the same as in the + Laser 210/310 (aka VZ200/300) series. + +****************************************************************************/ + +#include "emu.h" +#include "includes/vtech2.h" +#include "imagedev/flopdrv.h" +#include "imagedev/cassette.h" +#include "sound/speaker.h" + +/* public */ + +/* static */ + +#define TRKSIZE_VZ 0x9a0 /* arbitrary (actually from analyzing format) */ + +static const UINT8 laser_fdc_wrprot[2] = {0x80, 0x80}; + +/* wrappers for bank #1 to #4 */ +WRITE8_MEMBER(vtech2_state::mwa_bank1 ) { mwa_bank(0,offset,data); } +WRITE8_MEMBER(vtech2_state::mwa_bank2 ) { mwa_bank(1,offset,data); } +WRITE8_MEMBER(vtech2_state::mwa_bank3 ) { mwa_bank(2,offset,data); } +WRITE8_MEMBER(vtech2_state::mwa_bank4 ) { mwa_bank(3,offset,data); } + +/* wrappers for bank #1 to #4 */ +READ8_MEMBER(vtech2_state::mra_bank1 ) { return mra_bank(0,offset); } +READ8_MEMBER(vtech2_state::mra_bank2 ) { return mra_bank(1,offset); } +READ8_MEMBER(vtech2_state::mra_bank3 ) { return mra_bank(2,offset); } +READ8_MEMBER(vtech2_state::mra_bank4 ) { return mra_bank(3,offset); } + +/* read banked memory (plain ROM/RAM) */ +static const char *const mra_bank_hard[4] = +{ + "bank1", /* mapped in 0000-3fff */ + "bank2", /* mapped in 4000-7fff */ + "bank3", /* mapped in 8000-bfff */ + "bank4" /* mapped in c000-ffff */ +}; + +/* write banked memory (plain ROM/RAM) */ +static const char *const mwa_bank_hard[4] = +{ + "bank1", /* mapped in 0000-3fff */ + "bank2", /* mapped in 4000-7fff */ + "bank3", /* mapped in 8000-bfff */ + "bank4" /* mapped in c000-ffff */ +}; + +DRIVER_INIT_MEMBER(vtech2_state,laser) +{ + UINT8 *gfx = memregion("gfx2")->base(); + int i; + + m_laser_track_x2[0] = m_laser_track_x2[1] = 80; + m_laser_fdc_bits = 8; + m_laser_drive = -1; + + for (i = 0; i < 256; i++) + gfx[i] = i; + + m_laser_latch = -1; + m_mem = memregion("maincpu")->base(); + + // check ROM expansion + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + + for (i = 0; i < ARRAY_LENGTH(m_laser_bank); i++) + m_laser_bank[i] = -1; +} + + + +void vtech2_state::laser_machine_init(int bank_mask, int video_mask) +{ + m_laser_bank_mask = bank_mask; + m_laser_video_bank = video_mask; + m_videoram = m_mem + m_laser_video_bank * 0x04000; + logerror("laser_machine_init(): bank mask $%04X, video %d [$%05X]\n", m_laser_bank_mask, m_laser_video_bank, m_laser_video_bank * 0x04000); + + for (int i = 0; i < ARRAY_LENGTH(m_laser_bank); i++) + laser_bank_select_w(m_maincpu->space(AS_PROGRAM), i, 0); +} + +void vtech2_state::machine_reset() +{ + /* banks 0 to 3 only, optional ROM extension */ + laser_machine_init(0x00f, 3); +} + +MACHINE_RESET_MEMBER(vtech2_state,laser500) +{ + /* banks 0 to 2, and 4-7 only, optional ROM extension */ + laser_machine_init(0x0f7, 7); +} + +MACHINE_RESET_MEMBER(vtech2_state,laser700) +{ + /* all banks except #3 */ + laser_machine_init(0xff7, 7); +} + + +WRITE8_MEMBER(vtech2_state::laser_bank_select_w) +{ + static const char *const bank_name[16] = { + "ROM lo","ROM hi","MM I/O","Video RAM lo", + "RAM #0","RAM #1","RAM #2","RAM #3", + "RAM #4","RAM #5","RAM #6","RAM #7/Video RAM hi", + "ext ROM #0","ext ROM #1","ext ROM #2","ext ROM #3" + }; + char bank[10]; + offset %= 4; + data &= 15; + + if( data != m_laser_bank[offset] ) + { + m_laser_bank[offset] = data; + logerror("select bank #%d $%02X [$%05X] %s\n", offset+1, data, 0x4000 * (data & 15), bank_name[data]); + + /* memory mapped I/O bank selected? */ + if (data == 2) + { + static read8_delegate mra_bank_soft[] = + { + read8_delegate(FUNC(vtech2_state::mra_bank1), this), + read8_delegate(FUNC(vtech2_state::mra_bank2), this), + read8_delegate(FUNC(vtech2_state::mra_bank3), this), + read8_delegate(FUNC(vtech2_state::mra_bank4), this), + }; + + static write8_delegate mwa_bank_soft[] = + { + write8_delegate(FUNC(vtech2_state::mwa_bank1), this), + write8_delegate(FUNC(vtech2_state::mwa_bank2), this), + write8_delegate(FUNC(vtech2_state::mwa_bank3), this), + write8_delegate(FUNC(vtech2_state::mwa_bank4), this), + }; + + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_soft[offset], mwa_bank_soft[offset]); + } + else + { + sprintf(bank, "bank%d", offset + 1); + if (data >= 12 && m_cart_rom && (m_cart_rom->bytes() > (data % 12) * 0x4000)) // Expansion ROM banks + { + membank(bank)->set_base(m_cart_rom->base()+ (data % 12) * 0x4000); + m_maincpu->space(AS_PROGRAM).install_read_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_hard[offset]); + m_maincpu->space(AS_PROGRAM).install_write_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_hard[offset]); + } + else if (data < 12 && (m_laser_bank_mask & (1 << data))) // ROM/RAM banks + { + // video RAM bank selected? + if (data == m_laser_video_bank) + logerror("select bank #%d VIDEO!\n", offset + 1); + + membank(bank)->set_base(&m_mem[0x4000 * m_laser_bank[offset]]); + m_maincpu->space(AS_PROGRAM).install_read_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_hard[offset]); + m_maincpu->space(AS_PROGRAM).install_write_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_hard[offset]); + } + else + { + logerror("select bank #%d MASKED!\n", offset + 1); + m_maincpu->space(AS_PROGRAM).nop_readwrite(offset * 0x4000, offset * 0x4000 + 0x3fff); + } + } + + } +} + +/************************************************* + * memory mapped I/O read + * bit function + * 7 not assigned + * 6 column 6 + * 5 column 5 + * 4 column 4 + * 3 column 3 + * 2 column 2 + * 1 column 1 + * 0 column 0 + ************************************************/ +int vtech2_state::mra_bank(int bank, int offs) +{ + UINT8 data = 0x7f; + + /* Laser 500/700 only: keyboard rows A through D */ + if( (offs & 0x00ff) == 0x00ff ) + { + if( (offs & 0x0300) == 0x0000 ) /* keyboard row A */ + { + if( ioport("ROWA")->read() != m_row_a ) + { + m_row_a = ioport("ROWA")->read(); + data &= m_row_a; + } + } + if( (offs & 0x0300) == 0x0100 ) /* keyboard row B */ + { + if( ioport("ROWB")->read() != m_row_b ) + { + m_row_b = ioport("ROWB")->read(); + data &= m_row_b; + } + } + if( (offs & 0x0300) == 0x0200 ) /* keyboard row C */ + { + if( ioport("ROWC")->read() != m_row_c ) + { + m_row_c = ioport("ROWC")->read(); + data &= m_row_c; + } + } + if( (offs & 0x0300) == 0x0300 ) /* keyboard row D */ + { + if( ioport("ROWD")->read() != m_row_d ) + { + m_row_d = ioport("ROWD")->read(); + data &= m_row_d; + } + } + } + else + { + /* All Lasers keyboard rows 0 through 7 */ + if( !(offs & 0x01) ) + data &= ioport("ROW0")->read(); + if( !(offs & 0x02) ) + data &= ioport("ROW1")->read(); + if( !(offs & 0x04) ) + data &= ioport("ROW2")->read(); + if( !(offs & 0x08) ) + data &= ioport("ROW3")->read(); + if( !(offs & 0x10) ) + data &= ioport("ROW4")->read(); + if( !(offs & 0x20) ) + data &= ioport("ROW5")->read(); + if( !(offs & 0x40) ) + data &= ioport("ROW6")->read(); + if( !(offs & 0x80) ) + data &= ioport("ROW7")->read(); + } + + /* BIT 7 - tape input */ + + data |= (m_cassette->input() > +0.02) ? 0x80 : 0; + + return data; +} + +/************************************************* + * memory mapped I/O write + * bit function + * 7-6 not assigned + * 5 speaker B ??? + * 4 ??? + * 3 mode: 1 graphics, 0 text + * 2 cassette out (MSB) + * 1 cassette out (LSB) + * 0 speaker A + ************************************************/ +void vtech2_state::mwa_bank(int bank, int offs, int data) +{ + offs += 0x4000 * m_laser_bank[bank]; + switch (m_laser_bank[bank]) + { + case 0: /* ROM lower 16K */ + case 1: /* ROM upper 16K */ + logerror("bank #%d write to ROM [$%05X] $%02X\n", bank+1, offs, data); + break; + case 2: /* memory mapped output */ + if (data != m_laser_latch) + { + logerror("bank #%d write to I/O [$%05X] $%02X\n", bank+1, offs, data); + /* Toggle between graphics and text modes? */ + if ((data ^ m_laser_latch) & 0x01) + m_speaker->level_w(data & 1); + m_laser_latch = data; + } + m_cassette->output( BIT(data, 2) ? -1.0 : +1.0); + break; + case 12: /* ext. ROM #1 */ + case 13: /* ext. ROM #2 */ + case 14: /* ext. ROM #3 */ + case 15: /* ext. ROM #4 */ + logerror("bank #%d write to ROM [$%05X] $%02X\n", bank+1, offs, data); + break; + default: /* RAM */ + if( m_laser_bank[bank] == m_laser_video_bank && m_mem[offs] != data ) + { + logerror("bank #%d write to videoram [$%05X] $%02X\n", bank+1, offs, data); + } + m_mem[offs] = data; + break; + } +} + + +device_t *vtech2_state::laser_file() +{ + return machine().device(m_laser_drive ? FLOPPY_1 : FLOPPY_0); +} + +void vtech2_state::laser_get_track() +{ + sprintf(m_laser_frame_message, "#%d get track %02d", m_laser_drive, m_laser_track_x2[m_laser_drive]/2); + m_laser_frame_time = 30; + /* drive selected or and image file ok? */ + if( m_laser_drive >= 0 && laser_file() != NULL ) + { + int size, offs; + device_image_interface *image = dynamic_cast(laser_file()); + size = TRKSIZE_VZ; + offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2; + image->fseek(offs, SEEK_SET); + size = image->fread(m_laser_fdc_data, size); + logerror("get track @$%05x $%04x bytes\n", offs, size); + } + m_laser_fdc_offs = 0; + m_laser_fdc_write = 0; +} + +void vtech2_state::laser_put_track() +{ + device_image_interface *image = dynamic_cast(laser_file()); + /* drive selected and image file ok? */ + if( m_laser_drive >= 0 && laser_file() != NULL ) + { + int size, offs; + offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2; + image->fseek(offs + m_laser_fdc_start, SEEK_SET); + size = image->fwrite(&m_laser_fdc_data[m_laser_fdc_start], m_laser_fdc_write); + logerror("put track @$%05X+$%X $%04X/$%04X bytes\n", offs, m_laser_fdc_start, size, m_laser_fdc_write); + } +} + +#define PHI0(n) (((n)>>0)&1) +#define PHI1(n) (((n)>>1)&1) +#define PHI2(n) (((n)>>2)&1) +#define PHI3(n) (((n)>>3)&1) + +READ8_MEMBER(vtech2_state::laser_fdc_r) +{ + int data = 0xff; + switch( offset ) + { + case 1: /* data (read-only) */ + if( m_laser_fdc_bits > 0 ) + { + if( m_laser_fdc_status & 0x80 ) + m_laser_fdc_bits--; + data = (m_laser_data >> m_laser_fdc_bits) & 0xff; +#if 0 + logerror("laser_fdc_r bits %d%d%d%d%d%d%d%d\n", + (data>>7)&1,(data>>6)&1,(data>>5)&1,(data>>4)&1, + (data>>3)&1,(data>>2)&1,(data>>1)&1,(data>>0)&1 ); +#endif + } + if( m_laser_fdc_bits == 0 ) + { + m_laser_data = m_laser_fdc_data[m_laser_fdc_offs]; + logerror("laser_fdc_r %d : data ($%04X) $%02X\n", offset, m_laser_fdc_offs, m_laser_data); + if( m_laser_fdc_status & 0x80 ) + { + m_laser_fdc_bits = 8; + m_laser_fdc_offs = (m_laser_fdc_offs + 1) % TRKSIZE_FM; + } + m_laser_fdc_status &= ~0x80; + } + break; + case 2: /* polling (read-only) */ + /* fake */ + if( m_laser_drive >= 0 ) + m_laser_fdc_status |= 0x80; + data = m_laser_fdc_status; + break; + case 3: /* write protect status (read-only) */ + if( m_laser_drive >= 0 ) + data = laser_fdc_wrprot[m_laser_drive]; + logerror("laser_fdc_r %d : write_protect $%02X\n", offset, data); + break; + } + return data; +} + +WRITE8_MEMBER(vtech2_state::laser_fdc_w) +{ + int drive; + + switch( offset ) + { + case 0: /* latch (write-only) */ + drive = (data & 0x10) ? 0 : (data & 0x80) ? 1 : -1; + if( drive != m_laser_drive ) + { + m_laser_drive = drive; + if( m_laser_drive >= 0 ) + laser_get_track(); + } + if( m_laser_drive >= 0 ) + { + if( (PHI0(data) && !(PHI1(data) || PHI2(data) || PHI3(data)) && PHI1(m_laser_fdc_latch)) || + (PHI1(data) && !(PHI0(data) || PHI2(data) || PHI3(data)) && PHI2(m_laser_fdc_latch)) || + (PHI2(data) && !(PHI0(data) || PHI1(data) || PHI3(data)) && PHI3(m_laser_fdc_latch)) || + (PHI3(data) && !(PHI0(data) || PHI1(data) || PHI2(data)) && PHI0(m_laser_fdc_latch)) ) + { + if( m_laser_track_x2[m_laser_drive] > 0 ) + m_laser_track_x2[m_laser_drive]--; + logerror("laser_fdc_w(%d) $%02X drive %d: stepout track #%2d.%d\n", offset, data, m_laser_drive, m_laser_track_x2[m_laser_drive]/2,5*(m_laser_track_x2[m_laser_drive]&1)); + if( (m_laser_track_x2[m_laser_drive] & 1) == 0 ) + laser_get_track(); + } + else + if( (PHI0(data) && !(PHI1(data) || PHI2(data) || PHI3(data)) && PHI3(m_laser_fdc_latch)) || + (PHI1(data) && !(PHI0(data) || PHI2(data) || PHI3(data)) && PHI0(m_laser_fdc_latch)) || + (PHI2(data) && !(PHI0(data) || PHI1(data) || PHI3(data)) && PHI1(m_laser_fdc_latch)) || + (PHI3(data) && !(PHI0(data) || PHI1(data) || PHI2(data)) && PHI2(m_laser_fdc_latch)) ) + { + if( m_laser_track_x2[m_laser_drive] < 2*40 ) + m_laser_track_x2[m_laser_drive]++; + logerror("laser_fdc_w(%d) $%02X drive %d: stepin track #%2d.%d\n", offset, data, m_laser_drive, m_laser_track_x2[m_laser_drive]/2,5*(m_laser_track_x2[m_laser_drive]&1)); + if( (m_laser_track_x2[m_laser_drive] & 1) == 0 ) + laser_get_track(); + } + if( (data & 0x40) == 0 ) + { + m_laser_data <<= 1; + if( (m_laser_fdc_latch ^ data) & 0x20 ) + m_laser_data |= 1; + if( (m_laser_fdc_edge ^= 1) == 0 ) + { + if( --m_laser_fdc_bits == 0 ) + { + UINT8 value = 0; + m_laser_data &= 0xffff; + if( m_laser_data & 0x4000 ) value |= 0x80; + if( m_laser_data & 0x1000 ) value |= 0x40; + if( m_laser_data & 0x0400 ) value |= 0x20; + if( m_laser_data & 0x0100 ) value |= 0x10; + if( m_laser_data & 0x0040 ) value |= 0x08; + if( m_laser_data & 0x0010 ) value |= 0x04; + if( m_laser_data & 0x0004 ) value |= 0x02; + if( m_laser_data & 0x0001 ) value |= 0x01; + logerror("laser_fdc_w(%d) data($%04X) $%02X <- $%02X ($%04X)\n", offset, m_laser_fdc_offs, m_laser_fdc_data[m_laser_fdc_offs], value, m_laser_data); + m_laser_fdc_data[m_laser_fdc_offs] = value; + m_laser_fdc_offs = (m_laser_fdc_offs + 1) % TRKSIZE_FM; + m_laser_fdc_write++; + m_laser_fdc_bits = 8; + } + } + } + /* change of write signal? */ + if( (m_laser_fdc_latch ^ data) & 0x40 ) + { + /* falling edge? */ + if ( m_laser_fdc_latch & 0x40 ) + { + sprintf(m_laser_frame_message, "#%d put track %02d", m_laser_drive, m_laser_track_x2[m_laser_drive]/2); + m_laser_frame_time = 30; + m_laser_fdc_start = m_laser_fdc_offs; + m_laser_fdc_edge = 0; + } + else + { + /* data written to track before? */ + if( m_laser_fdc_write ) + laser_put_track(); + } + m_laser_fdc_bits = 8; + m_laser_fdc_write = 0; + } + } + m_laser_fdc_latch = data; + break; + } +} diff --git a/src/mame/machine/wangpckb.c b/src/mame/machine/wangpckb.c new file mode 100644 index 00000000000..7e38ec2f153 --- /dev/null +++ b/src/mame/machine/wangpckb.c @@ -0,0 +1,583 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Wang PC keyboard emulation + +*********************************************************************/ + +/* + +PCB Layout +---------- + +Key Tronic A65-02454-002 +PCB 201 + +|-----------------------------------------------------------------------| +| LS273 PSG 555 LS04 4MHz LS132 CN1 LS374 XR | +| CPU | +| LD1 LD2 LD3 LD4 LD5 | +| SW1 LS259 SW2 LS259 | +| | +| | +| | +| | +| | +| | +| | +|-----------------------------------------------------------------------| + +Notes: + Relevant IC's shown. + + CPU - Intel P8051AH "20-8051-225" + PSG - Texas Instruments SN76496N + XR - Exar Semiconductor XR22-908-03B? (hard to read) + CN1 - 1x6 pin PCB header + SW1 - 8-way DIP switch + SW2 - 8-way DIP switch + +*/ + +/* + + TODO: + + - rewrite the mcs51.c serial I/O to replace this horrible, horrible hack + - dip switches + +*/ + +#include "wangpckb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + +#define I8051_TAG "z5" +#define SN76496_TAG "z4" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type WANGPC_KEYBOARD = &device_creator; + + + +//------------------------------------------------- +// ROM( wangpc_keyboard ) +//------------------------------------------------- + +ROM_START( wangpc_keyboard ) + ROM_REGION( 0x1000, I8051_TAG, 0 ) + ROM_LOAD( "20-8051-225.z5", 0x0000, 0x1000, CRC(82d2999f) SHA1(2bb34a1de2d94b2885d9e8fcd4964296f6276c5c) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *wangpc_keyboard_device::device_rom_region() const +{ + return ROM_NAME( wangpc_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( wangpc_keyboard_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( wangpc_keyboard_io, AS_IO, 8, wangpc_keyboard_device ) + //AM_RANGE(0x0000, 0xfeff) AM_READNOP + AM_RANGE(0x47, 0x58) AM_MIRROR(0xff00) AM_READNOP + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_DEVWRITE(SN76496_TAG, sn76496_device, write) + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) + AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITE(kb_p2_w) + AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_WRITE(kb_p3_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_DRIVER( wangpc_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( wangpc_keyboard ) + MCFG_CPU_ADD(I8051_TAG, I8051, XTAL_4MHz) + MCFG_CPU_IO_MAP(wangpc_keyboard_io) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SN76496_TAG, SN76496, 2000000) // ??? + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor wangpc_keyboard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( wangpc_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( wangpc_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( wangpc_keyboard ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // 2b + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // 63 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EXEC") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) // 53 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) // 52 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // 43 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // 29 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x96") // 26 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // 2e + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') // 64 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // 1f + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // 21 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("GL") // 54 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')// 45 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') // 44 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 35 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // 2d + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') // 65 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') // 2f + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // 56 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') // 55 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') // 46 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // 22 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // 23 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // 37 + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') // 67 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') // 66 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // 58 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // 57 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // 48 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // 47 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') // 38 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') // 2a + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 \xC2\xA3") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(0xa3) // 69 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') // 68 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // 5a + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // 59 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // 4a + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // 49 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // 3a + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // 39 + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // 6b + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // 6a + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // 5c + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // 5b + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // 4c + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // 4b + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // 3c + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // 3b + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') // 6d + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // 6c + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // 5e + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // 5d + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // 4e + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // 4d + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // 3e + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // 3d + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\xA4") PORT_CODE(KEYCODE_TILDE) // 1f + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') // 6e + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\xA5") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') // 6f + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // 5f + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 1e + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // 4f + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 1b + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // 3f + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_F8) // 77 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SRCH") PORT_CODE(KEYCODE_F9) // 76 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // 1c + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . ;") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // 32 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // 33 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 '") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 34 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // 35 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // 28 + + PORT_START("Y9") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MERGE") PORT_CODE(KEYCODE_F6) // 79 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NOTE") PORT_CODE(KEYCODE_F7) // 78 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GOTO") // 11 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CANCEL") // 12 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2ND") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) // 25 + + PORT_START("YA") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEC TAB") PORT_CODE(KEYCODE_F4) // 7b + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FORMAT") PORT_CODE(KEYCODE_F5) // 7a + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x95") // 71 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("(blank)") // 70 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // 2c + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 27 + + PORT_START("YB") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAGE") PORT_CODE(KEYCODE_F2) // 7d + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CENTER") PORT_CODE(KEYCODE_F3) // 7c + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MOVE") PORT_CODE(KEYCODE_F12) // 73 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMMAND") // 72 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("YC") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_ESC) // 36 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INDENT") PORT_CODE(KEYCODE_F1) // 7e + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPLC") PORT_CODE(KEYCODE_F10) // 75 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COPY") PORT_CODE(KEYCODE_F11) // 74 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 24 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // 1d + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("YD") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad \xC3\x97") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // 14 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad \xC3\xB7") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // 18 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT") // 19 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // 20 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("ERASE") // 1a + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 1c + + PORT_START("YE") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad + *") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))// 60 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad - !") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // 13 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 >") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 15 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 " UTF8_UP) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 16 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5 ]") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 40 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 $") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 17 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 #") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 10 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 1b + + PORT_START("YF") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // 62 + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PREV") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) // 61 + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NEXT") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) // 51 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 <") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 50 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // 42 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 [") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 41 + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 &") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 31 + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 @") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 30 + + PORT_START("SW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("SW2") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4") + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor wangpc_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( wangpc_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// wangpc_keyboard_device - constructor +//------------------------------------------------- + +wangpc_keyboard_device::wangpc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, WANGPC_KEYBOARD, "Wang PC Keyboard", tag, owner, clock, "wangpckb", __FILE__), + device_serial_interface(mconfig, *this), + m_maincpu(*this, I8051_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_y9(*this, "Y9"), + m_ya(*this, "YA"), + m_yb(*this, "YB"), + m_yc(*this, "YC"), + m_yd(*this, "YD"), + m_ye(*this, "YE"), + m_yf(*this, "YF"), + m_txd_handler(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void wangpc_keyboard_device::device_start() +{ + m_txd_handler.resolve_safe(); + + // set serial callbacks + m_maincpu->i8051_set_serial_tx_callback(WRITE8_DELEGATE(wangpc_keyboard_device, mcs51_tx_callback)); + m_maincpu->i8051_set_serial_rx_callback(READ8_DELEGATE(wangpc_keyboard_device, mcs51_rx_callback)); + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void wangpc_keyboard_device::device_reset() +{ + transmit_register_reset(); + receive_register_reset(); + + m_txd_handler(1); +} + + +//------------------------------------------------- +// write_rxd - +//------------------------------------------------- + +WRITE_LINE_MEMBER(wangpc_keyboard_device::write_rxd) +{ + receive_register_update_bit(state); + + if (is_receive_register_full()) + { + m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); + receive_register_extract(); + + if (LOG) logerror("Wang PC keyboard receive data %02x\n", get_received_char()); + } +} + + +//------------------------------------------------- +// mcs51_rx_callback - +//------------------------------------------------- + +READ8_MEMBER(wangpc_keyboard_device::mcs51_rx_callback) +{ + return get_received_char(); +} + + +//------------------------------------------------- +// mcs51_tx_callback - +//------------------------------------------------- + +WRITE8_MEMBER(wangpc_keyboard_device::mcs51_tx_callback) +{ + if (LOG) logerror("Wang PC keyboard transmit data %02x\n", data); + + transmit_register_setup(data); + + // HACK bang the bits out immediately + while (!is_transmit_register_empty()) + { + m_txd_handler(transmit_register_get_data_bit()); + } +} + + +//------------------------------------------------- +// kb_p1_r - +//------------------------------------------------- + +READ8_MEMBER( wangpc_keyboard_device::kb_p1_r ) +{ + UINT8 data = 0xff; + + switch (m_y & 0x0f) + { + case 0: data &= m_y0->read(); break; + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 9: data &= m_y9->read(); break; + case 0xa: data &= m_ya->read(); break; + case 0xb: data &= m_yb->read(); break; + case 0xc: data &= m_yc->read(); break; + case 0xd: data &= m_yd->read(); break; + case 0xe: data &= m_ye->read(); break; + case 0xf: data &= m_yf->read(); break; + } + + return data; +} + + +//------------------------------------------------- +// kb_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_keyboard_device::kb_p1_w ) +{ + /* + + bit description + + P1.0 led 0 + P1.1 led 1 + P1.2 led 2 + P1.3 led 3 + P1.4 led 4 + P1.5 led 5 + P1.6 + P1.7 + + */ + + for (int i = 0; i < 6; i++) + { + output_set_led_value(i, !BIT(data, i)); + } + + if (LOG) logerror("P1 %02x\n", data); +} + + +//------------------------------------------------- +// kb_p2_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_keyboard_device::kb_p2_w ) +{ + /* + + bit description + + P2.0 row 0 + P2.1 row 1 + P2.2 row 2 + P2.3 row 3 + P2.4 + P2.5 + P2.6 chip enable for something + P2.7 + + */ + + m_y = data & 0x0f; + + if (LOG) logerror("P2 %02x\n", data); +} + + +//------------------------------------------------- +// kb_p3_w - +//------------------------------------------------- + +WRITE8_MEMBER( wangpc_keyboard_device::kb_p3_w ) +{ + /* + + bit description + + P3.0 RxD + P3.1 TxD + P3.2 + P3.3 chip enable for something + P3.4 + P3.5 + P3.6 + P3.7 + + */ + + if (LOG) logerror("P3 %02x\n", data); +} diff --git a/src/mame/machine/wangpckb.h b/src/mame/machine/wangpckb.h new file mode 100644 index 00000000000..27c87b071fc --- /dev/null +++ b/src/mame/machine/wangpckb.h @@ -0,0 +1,107 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Wang PC keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __WANGPC_KEYBOARD__ +#define __WANGPC_KEYBOARD__ + + +#include "emu.h" +#include "cpu/mcs51/mcs51.h" +#include "sound/sn76496.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define WANGPC_KEYBOARD_TAG "wangpckb" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_WANGPC_KEYBOARD_ADD() \ + MCFG_DEVICE_ADD(WANGPC_KEYBOARD_TAG, WANGPC_KEYBOARD, 0) + +#define MCFG_WANGPCKB_TXD_HANDLER(_devcb) \ + devcb = &wangpc_keyboard_device::set_txd_handler(*device, DEVCB_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> wangpc_keyboard_device + +class wangpc_keyboard_device : public device_t, + public device_serial_interface +{ +public: + // construction/destruction + wangpc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_txd_handler(device_t &device, _Object object) { return downcast(device).m_txd_handler.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_WRITE_LINE_MEMBER( write_rxd ); + + // not really public + DECLARE_READ8_MEMBER( kb_p1_r ); + DECLARE_WRITE8_MEMBER( kb_p1_w ); + DECLARE_WRITE8_MEMBER( kb_p2_w ); + DECLARE_WRITE8_MEMBER( kb_p3_w ); + + DECLARE_READ8_MEMBER(mcs51_rx_callback); + DECLARE_WRITE8_MEMBER(mcs51_tx_callback); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // device_serial_interface overrides + +private: + required_device m_maincpu; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_y9; + required_ioport m_ya; + required_ioport m_yb; + required_ioport m_yc; + required_ioport m_yd; + required_ioport m_ye; + required_ioport m_yf; + devcb_write_line m_txd_handler; + + UINT8 m_y; +}; + + +// device type definition +extern const device_type WANGPC_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/wswan.c b/src/mame/machine/wswan.c new file mode 100644 index 00000000000..508f93e8544 --- /dev/null +++ b/src/mame/machine/wswan.c @@ -0,0 +1,662 @@ +// license:BSD-3-Clause +// copyright-holders:Anthony Kruize,Wilbert Pol +/*************************************************************************** + + wswan.c + + Machine file to handle emulation of the Bandai WonderSwan. + + Anthony Kruize + Wilbert Pol + +TODO: + SRAM sizes should be in kbit instead of kbytes(?). This raises a few + interesting issues: + - mirror of smaller <64KBYTE/512kbit sram sizes + - banking when using 1M or 2M sram sizes + +***************************************************************************/ + +#include "includes/wswan.h" + +#define INTERNAL_EEPROM_SIZE 1024 + +enum enum_system { TYPE_WSWAN=0, TYPE_WSC }; + + +static const UINT8 ws_portram_init[256] = +{ + 0x00, 0x00, 0x00/*?*/, 0xbb, 0x00, 0x00, 0x00, 0x26, 0xfe, 0xde, 0xf9, 0xfb, 0xdb, 0xd7, 0x7f, 0xf5, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x9e, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x99, 0xfd, 0xb7, 0xdf, + 0x30, 0x57, 0x75, 0x76, 0x15, 0x73, 0x70/*77?*/, 0x77, 0x20, 0x75, 0x50, 0x36, 0x70, 0x67, 0x50, 0x77, + 0x57, 0x54, 0x75, 0x77, 0x75, 0x17, 0x37, 0x73, 0x50, 0x57, 0x60, 0x77, 0x70, 0x77, 0x10, 0x73, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x87, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xdb, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x83, 0x00, + 0x2f, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1 +}; + +/* + Some fake bios code to initialize some registers and set up some things on the wonderswan. + The code from f:ffe0 which gets copied to 0:0400 is taken from a wonderswan crystal's initial + memory settings. Lacking real bios dumps we will use this.... + + The setting of SP to 2000h is what's needed to get Wonderswan Colloseum to boot. + + f000:ffc0 + FC cld + BC 00 20 mov sp,2000h + 68 00 00 push 0000h + 07 pop es + 68 00 F0 push F000h + 1F pop ds + BF 00 04 mov di,0400h + BE E0 FF mov si,FFE0h + B9 10 00 mov cx,0010h + F3 A4 rep movsb + B0 2F mov al,2Fh + E6 C0 out al,C0h + EA 00 04 00 00 jmp 0000:0400 + + f000:ffe0 + E4 A0 in al, A0h + 0C 01 or al,01h + E6 A0 out al,A0h + EA 00 00 FF FF jmp FFFFh:0000h + +*/ +static const UINT8 ws_fake_bios_code[] = { + 0xfc, 0xbc, 0x00, 0x20, 0x68, 0x00, 0x00, 0x07, 0x68, 0x00, 0xf0, 0x1f, 0xbf, 0x00, 0x04, 0xbe, + 0xe0, 0xff, 0xb9, 0x10, 0x00, 0xf3, 0xa4, 0xb0, 0x2f, 0xe6, 0xc0, 0xea, 0x00, 0x04, 0x00, 0x00, + 0xe4, 0xa0, 0x0c, 0x01, 0xe6, 0xa0, 0xea, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xea, 0xc0, 0xff, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +void wswan_state::handle_irqs() +{ + if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_HBLTMR) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_HBLTMR); + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_VBL) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_VBL); + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_VBLTMR) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_VBLTMR); + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_LCMP) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_LCMP); + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_SRX) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_SRX); + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_RTC) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_RTC); + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_KEY) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_KEY); + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_STX) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_STX); + } + else + { + m_maincpu->set_input_line(0, CLEAR_LINE); + } +} + +void wswan_state::set_irq_line(int irq) +{ + if (m_ws_portram[0xb2] & irq) + { + m_ws_portram[0xb6] |= irq; + handle_irqs(); + } +} + +void wswan_state::dma_sound_cb() +{ + if ((m_sound_dma.enable & 0x88) == 0x80) + { + address_space &space = m_maincpu->space(AS_PROGRAM); + /* TODO: Output sound DMA byte */ + port_w(space, 0x89, space.read_byte(m_sound_dma.source)); + m_sound_dma.size--; + m_sound_dma.source = (m_sound_dma.source + 1) & 0x0fffff; + if (m_sound_dma.size == 0) + { + m_sound_dma.enable &= 0x7F; + } + } +} + +void wswan_state::clear_irq_line(int irq) +{ + m_ws_portram[0xb6] &= ~irq; + handle_irqs(); +} + +void wswan_state::register_save() +{ + save_item(NAME(m_ws_portram)); + save_item(NAME(m_internal_eeprom)); + save_item(NAME(m_bios_disabled)); + save_item(NAME(m_rotate)); + + save_item(NAME(m_sound_dma.source)); + save_item(NAME(m_sound_dma.size)); + save_item(NAME(m_sound_dma.enable)); + + if (m_cart->exists()) + m_cart->save_nvram(); +} + +void wswan_state::common_start() +{ + m_ws_bios_bank = auto_alloc_array(machine(), UINT8, 0x10000); + memcpy(m_ws_bios_bank + 0xffc0, ws_fake_bios_code, 0x40); + + register_save(); + + machine().device("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE); + + if (m_cart->exists()) + { + // ROM + m_maincpu->space(AS_PROGRAM).install_read_handler(0x20000, 0x2ffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom20),(ws_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x30000, 0x3ffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom30),(ws_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x40000, 0xeffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom40),(ws_cart_slot_device*)m_cart)); + + // SRAM + if (m_cart->get_type() == WS_SRAM) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0x10000, 0x1ffff, read8_delegate(FUNC(ws_cart_slot_device::read_ram),(ws_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x10000, 0x1ffff, write8_delegate(FUNC(ws_cart_slot_device::write_ram),(ws_cart_slot_device*)m_cart)); + } + } +} + +void wswan_state::machine_start() +{ + common_start(); + m_system_type = TYPE_WSWAN; +} + +MACHINE_START_MEMBER(wswan_state, wscolor) +{ + common_start(); + m_system_type = TYPE_WSC; +} + +void wswan_state::machine_reset() +{ + m_bios_disabled = 0; + + if (m_cart->exists()) + m_rotate = m_cart->get_is_rotated(); + else + m_rotate = 0; + + /* Intialize ports */ + memcpy(m_ws_portram, ws_portram_init, 256); + + render_target *target = machine().render().first_target(); + target->set_view(m_rotate); + + /* Initialize sound DMA */ + memset(&m_sound_dma, 0, sizeof(m_sound_dma)); +} + +READ8_MEMBER( wswan_state::bios_r ) +{ + if (!m_bios_disabled) + return m_ws_bios_bank[offset]; + else + return m_cart->read_rom40(space, offset + 0xb0000); +} + +READ8_MEMBER( wswan_state::port_r ) +{ + UINT8 value = m_ws_portram[offset]; + + if (offset != 2) + logerror("PC=%X: port read %02X\n", m_maincpu->pc(), offset); + + if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) + return m_vdp->reg_r(space, offset); + + switch (offset) + { + case 0x4a: // Sound DMA source address (low) + value = m_sound_dma.source & 0xff; + break; + case 0x4b: // Sound DMA source address (high) + value = (m_sound_dma.source >> 8) & 0xff; + break; + case 0x4c: // Sound DMA source memory segment + value = (m_sound_dma.source >> 16) & 0xff; + break; + case 0x4e: // Sound DMA transfer size (low) + value = m_sound_dma.size & 0xff; + break; + case 0x4f: // Sound DMA transfer size (high) + value = (m_sound_dma.size >> 8) & 0xff; + break; + case 0x52: // Sound DMA start/stop + value = m_sound_dma.enable; + break; + case 0x60: + value = m_vdp->reg_r(space, offset); + break; + case 0xa0: // Hardware type + // Bit 0 - Disable/enable Bios + // Bit 1 - Determine mono/color + // Bit 2 - Determine color/crystal + value = value & ~ 0x02; + if (m_system_type == TYPE_WSC) + value |= 2; + break; + case 0xc0: + case 0xc1: + case 0xc2: + case 0xc3: + case 0xc4: // EEPROM data + case 0xc5: // EEPROM data + case 0xc6: + case 0xc7: + case 0xc8: + case 0xc9: + case 0xca: + case 0xcb: // RTC data + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + value = m_cart->read_io(space, offset & 0x0f); + break; + } + + return value; +} + +WRITE8_MEMBER( wswan_state::port_w ) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + UINT8 input; + logerror("PC=%X: port write %02X <- %02X\n", m_maincpu->pc(), offset, data); + + if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) + { + m_vdp->reg_w(space, offset, data); + return; + } + + switch (offset) + { + case 0x40: /* DMA source address (low) + Bit 0-7 - DMA source address bit 0-7 + */ + case 0x41: /* DMA source address (high) + Bit 0-7 - DMA source address bit 8-15 + */ + case 0x42: /* DMA source bank + Bit 0-7 - DMA source bank number + */ + case 0x43: /* DMA destination bank + Bit 0-7 - DMA destination bank number + */ + case 0x44: /* DMA destination address (low) + Bit 0-7 - DMA destination address bit 0-7 + */ + case 0x45: /* DMA destination address (high) + Bit 0-7 - DMA destination address bit 8-15 + */ + case 0x46: /* Size of copied data (low) + Bit 0-7 - DMA size bit 0-7 + */ + case 0x47: /* Size of copied data (high) + Bit 0-7 - DMA size bit 8-15 + */ + break; + case 0x48: /* DMA control + Bit 0-6 - Unknown + Bit 7 - DMA stop/start + */ + if (data & 0x80) + { + UINT32 src, dst; + UINT16 length; + + src = m_ws_portram[0x40] + (m_ws_portram[0x41] << 8) + (m_ws_portram[0x42] << 16); + dst = m_ws_portram[0x44] + (m_ws_portram[0x45] << 8) + (m_ws_portram[0x43] << 16); + length = m_ws_portram[0x46] + (m_ws_portram[0x47] << 8); + for ( ; length > 0; length--) + { + mem.write_byte(dst, mem.read_byte(src)); + src++; + dst++; + } +#ifdef MAME_DEBUG + logerror("DMA src:%X dst:%X length:%d\n", src, dst, length); +#endif + m_ws_portram[0x40] = src & 0xff; + m_ws_portram[0x41] = (src >> 8) & 0xff; + m_ws_portram[0x44] = dst & 0xff; + m_ws_portram[0x45] = (dst >> 8) & 0xff; + m_ws_portram[0x46] = length & 0xff; + m_ws_portram[0x47] = (length >> 8) & 0xff; + data &= 0x7f; + } + break; + case 0x4a: /* Sound DMA source address (low) + Bit 0-7 - Sound DMA source address bit 0-7 + */ + m_sound_dma.source = (m_sound_dma.source & 0x0fff00) | data; + break; + case 0x4b: /* Sound DMA source address (high) + Bit 0-7 - Sound DMA source address bit 8-15 + */ + m_sound_dma.source = (m_sound_dma.source & 0x0f00ff) | (data << 8); + break; + case 0x4c: /* Sound DMA source memory segment + Bit 0-3 - Sound DMA source address segment + Bit 4-7 - Unknown + */ + m_sound_dma.source = (m_sound_dma.source & 0xffff) | ((data & 0x0f) << 16); + break; + case 0x4d: /* Unknown */ + break; + case 0x4e: /* Sound DMA transfer size (low) + Bit 0-7 - Sound DMA transfer size bit 0-7 + */ + m_sound_dma.size = (m_sound_dma.size & 0xff00) | data; + break; + case 0x4f: /* Sound DMA transfer size (high) + Bit 0-7 - Sound DMA transfer size bit 8-15 + */ + m_sound_dma.size = (m_sound_dma.size & 0xff) | (data << 8); + break; + case 0x50: /* Unknown */ + case 0x51: /* Unknown */ + break; + case 0x52: /* Sound DMA start/stop + Bit 0-6 - Unknown + Bit 7 - Sound DMA stop/start + */ + m_sound_dma.enable = data; + break; + case 0x60: + m_vdp->reg_w(space, offset, data); + break; + case 0x80: /* Audio 1 freq (lo) + Bit 0-7 - Audio channel 1 frequency bit 0-7 + */ + case 0x81: /* Audio 1 freq (hi) + Bit 0-7 - Audio channel 1 frequency bit 8-15 + */ + case 0x82: /* Audio 2 freq (lo) + Bit 0-7 - Audio channel 2 frequency bit 0-7 + */ + case 0x83: /* Audio 2 freq (hi) + Bit 0-7 - Audio channel 2 frequency bit 8-15 + */ + case 0x84: /* Audio 3 freq (lo) + Bit 0-7 - Audio channel 3 frequency bit 0-7 + */ + case 0x85: /* Audio 3 freq (hi) + Bit 0-7 - Audio channel 3 frequency bit 8-15 + */ + case 0x86: /* Audio 4 freq (lo) + Bit 0-7 - Audio channel 4 frequency bit 0-7 + */ + case 0x87: /* Audio 4 freq (hi) + Bit 0-7 - Audio channel 4 frequency bit 8-15 + */ + case 0x88: /* Audio 1 volume + Bit 0-3 - Right volume audio channel 1 + Bit 4-7 - Left volume audio channel 1 + */ + case 0x89: /* Audio 2 volume + Bit 0-3 - Right volume audio channel 2 + Bit 4-7 - Left volume audio channel 2 + */ + case 0x8a: /* Audio 3 volume + Bit 0-3 - Right volume audio channel 3 + Bit 4-7 - Left volume audio channel 3 + */ + case 0x8b: /* Audio 4 volume + Bit 0-3 - Right volume audio channel 4 + Bit 4-7 - Left volume audio channel 4 + */ + case 0x8c: /* Sweep step + Bit 0-7 - Sweep step + */ + case 0x8d: /* Sweep time + Bit 0-7 - Sweep time + */ + case 0x8e: /* Noise control + Bit 0-2 - Noise generator type + Bit 3 - Reset + Bit 4 - Enable + Bit 5-7 - Unknown + */ + case 0x8f: /* Sample location + Bit 0-7 - Sample address location 0 00xxxxxx xx000000 + */ + case 0x90: /* Audio control + Bit 0 - Audio 1 enable + Bit 1 - Audio 2 enable + Bit 2 - Audio 3 enable + Bit 3 - Audio 4 enable + Bit 4 - Unknown + Bit 5 - Audio 2 voice mode enable + Bit 6 - Audio 3 sweep mode enable + Bit 7 - Audio 4 noise mode enable + */ + case 0x91: /* Audio output + Bit 0 - Mono select + Bit 1-2 - Output volume + Bit 3 - External stereo + Bit 4-6 - Unknown + Bit 7 - External speaker (Read-only, set by hardware) + */ + case 0x92: /* Noise counter shift register (lo) + Bit 0-7 - Noise counter shift register bit 0-7 + */ + case 0x93: /* Noise counter shift register (hi) + Bit 0-6 - Noise counter shift register bit 8-14 + bit 7 - Unknown + */ + case 0x94: /* Master volume + Bit 0-3 - Master volume + Bit 4-7 - Unknown + */ + m_sound->port_w(space, offset, data); + break; + case 0xa0: /* Hardware type - this is probably read only + Bit 0 - Enable cartridge slot and/or disable bios + Bit 1 - Hardware type: 0 = WS, 1 = WSC + Bit 2-7 - Unknown + */ + if ((data & 0x01) && !m_bios_disabled) + m_bios_disabled = 1; + break; + + case 0xb0: /* Interrupt base vector + Bit 0-7 - Interrupt base vector + */ + break; + case 0xb1: /* Communication byte + Bit 0-7 - Communication byte + */ + break; + case 0xb2: /* Interrupt enable + Bit 0 - Serial transmit interrupt enable + Bit 1 - Key press interrupt enable + Bit 2 - RTC alarm interrupt enable + Bit 3 - Serial receive interrupt enable + Bit 4 - Drawing line detection interrupt enable + Bit 5 - VBlank timer interrupt enable + Bit 6 - VBlank interrupt enable + Bit 7 - HBlank timer interrupt enable + */ + break; + case 0xb3: /* serial communication control + Bit 0 - Receive complete + Bit 1 - Error + Bit 2 - Send complete + Bit 3-4 - Unknown + Bit 5 - Send data interrupt generation + Bit 6 - Connection speed: 0 = 9600 bps, 1 = 38400 bps + bit 7 - Receive data interrupt generation + */ + // data |= 0x02; + m_ws_portram[0xb1] = 0xff; + if (data & 0x80) + { + // m_ws_portram[0xb1] = 0x00; + data |= 0x04; + } + if (data & 0x20) + { + // data |= 0x01; + } + break; + case 0xb5: /* Read controls + Bit 0-3 - Current state of input lines (read-only) + Bit 4-6 - Select line of inputs to read + 001 - Read Y cursors + 010 - Read X cursors + 100 - Read START,A,B buttons + Bit 7 - Unknown + */ + data = data & 0xf0; + switch (data) + { + case 0x10: /* Read Y cursors: Y1 - Y2 - Y3 - Y4 */ + input = m_cursy->read(); + if (m_rotate) // reorient controls if the console is rotated + { + if (input & 0x01) data |= 0x02; + if (input & 0x02) data |= 0x04; + if (input & 0x04) data |= 0x08; + if (input & 0x08) data |= 0x01; + } + else + data = data | input; + break; + case 0x20: /* Read X cursors: X1 - X2 - X3 - X4 */ + input = m_cursx->read(); + if (m_rotate) // reorient controls if the console is rotated + { + if (input & 0x01) data |= 0x02; + if (input & 0x02) data |= 0x04; + if (input & 0x04) data |= 0x08; + if (input & 0x08) data |= 0x01; + } + else + data = data | input; + break; + case 0x40: /* Read buttons: START - A - B */ + data = data | m_buttons->read(); + break; + } + break; + case 0xb6: /* Interrupt acknowledge + Bit 0 - Serial transmit interrupt acknowledge + Bit 1 - Key press interrupt acknowledge + Bit 2 - RTC alarm interrupt acknowledge + Bit 3 - Serial receive interrupt acknowledge + Bit 4 - Drawing line detection interrupt acknowledge + Bit 5 - VBlank timer interrupt acknowledge + Bit 6 - VBlank interrupt acknowledge + Bit 7 - HBlank timer interrupt acknowledge + */ + clear_irq_line(data); + data = m_ws_portram[0xb6]; + break; + case 0xba: /* Internal EEPROM data (low) + Bit 0-7 - Internal EEPROM data transfer bit 0-7 + */ + case 0xbb: /* Internal EEPROM data (high) + Bit 0-7 - Internal EEPROM data transfer bit 8-15 + */ + break; + case 0xbc: /* Internal EEPROM address (low) + Bit 0-7 - Internal EEPROM address bit 1-8 + */ + case 0xbd: /* Internal EEPROM address (high) + Bit 0 - Internal EEPROM address bit 9(?) + Bit 1-7 - Unknown + Only 1KByte internal EEPROM?? + */ + break; + case 0xbe: /* Internal EEPROM command + Bit 0 - Read complete (read only) + Bit 1 - Write complete (read only) + Bit 2-3 - Unknown + Bit 4 - Read + Bit 5 - Write + Bit 6 - Protect + Bit 7 - Initialize + */ + if (data & 0x20) + { + UINT16 addr = ( ( ( m_ws_portram[0xbd] << 8 ) | m_ws_portram[0xbc] ) << 1 ) & 0x1FF; + m_internal_eeprom[ addr ] = m_ws_portram[0xba]; + m_internal_eeprom[ addr + 1 ] = m_ws_portram[0xbb]; + data |= 0x02; + } + else if ( data & 0x10 ) + { + UINT16 addr = ( ( ( m_ws_portram[0xbd] << 8 ) | m_ws_portram[0xbc] ) << 1 ) & 0x1FF; + m_ws_portram[0xba] = m_internal_eeprom[ addr ]; + m_ws_portram[0xbb] = m_internal_eeprom[ addr + 1]; + data |= 0x01; + } + else + { + logerror( "Unsupported internal EEPROM command: %X\n", data ); + } + break; + case 0xc0: // ROM bank $40000-$fffff + case 0xc1: // SRAM bank + case 0xc2: // ROM bank $20000-$2ffff + case 0xc3: // ROM bank $30000-$3ffff + case 0xc4: + case 0xc5: + case 0xc6: // EEPROM address / command + case 0xc7: // EEPROM address / command + case 0xc8: // EEPROM command + case 0xc9: + case 0xca: // RTC command + case 0xcb: // RTC data + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + m_cart->write_io(space, offset & 0x0f, data); + break; + default: + logerror( "Write to unsupported port: %X - %X\n", offset, data ); + break; + } + + /* Update the port value */ + m_ws_portram[offset] = data; +} diff --git a/src/mame/machine/x1.c b/src/mame/machine/x1.c new file mode 100644 index 00000000000..f9c40398f20 --- /dev/null +++ b/src/mame/machine/x1.c @@ -0,0 +1,69 @@ +// license:LGPL-2.1+ +// copyright-holders:Angelo Salese, Barry Rodewald + +#include "includes/x1.h" + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +const device_type X1_KEYBOARD = &device_creator; + +//------------------------------------------------- +// z80ctc_device - constructor +//------------------------------------------------- + +x1_keyboard_device::x1_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, X1_KEYBOARD, "X1 Keyboard", tag, owner, clock, "x1_keyboard", __FILE__), + device_z80daisy_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void x1_keyboard_device::device_start() +{ +} + +//************************************************************************** +// DAISY CHAIN INTERFACE +//************************************************************************** + +//------------------------------------------------- +// z80daisy_irq_state - return the overall IRQ +// state for this device +//------------------------------------------------- + +int x1_keyboard_device::z80daisy_irq_state() +{ + x1_state *state = machine().driver_data(); + if(state->m_key_irq_flag != 0) + return Z80_DAISY_INT; + return 0; +} + + +//------------------------------------------------- +// z80daisy_irq_ack - acknowledge an IRQ and +// return the appropriate vector +//------------------------------------------------- + +int x1_keyboard_device::z80daisy_irq_ack() +{ + x1_state *state = machine().driver_data(); + state->m_key_irq_flag = 0; + state->m_maincpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE); + return state->m_key_irq_vector; +} + +//------------------------------------------------- +// z80daisy_irq_reti - clear the interrupt +// pending state to allow other interrupts through +//------------------------------------------------- + +void x1_keyboard_device::z80daisy_irq_reti() +{ +} diff --git a/src/mame/machine/x68k_hdc.c b/src/mame/machine/x68k_hdc.c new file mode 100644 index 00000000000..bdc1612da23 --- /dev/null +++ b/src/mame/machine/x68k_hdc.c @@ -0,0 +1,431 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + + X68000 custom SASI Hard Disk controller + + 0xe96001 (R/W) - SASI data I/O + 0xe96003 (W) - SEL signal high (0) + 0xe96003 (R) - SASI status + - bit 4 = MSG - if 1, content of data line is a message + - bit 3 = Command / Data - if 1, content of data line is a command or status, otherwise it is data. + - bit 2 = I/O - if 0, Host -> Controller (Output), otherwise Controller -> Host (Input). + - bit 1 = BSY - if 1, HD is busy. + - bit 0 = REQ - if 1, host is demanding data transfer to the host. + 0xe96005 (W/O) - data is arbitrary (?) + 0xe96007 (W/O) - SEL signal low (1) + +*/ + +#include "x68k_hdc.h" +#include "imagedev/harddriv.h" +#include "image.h" + +const device_type X68KHDC = &device_creator; + +x68k_hdc_image_device::x68k_hdc_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, X68KHDC, "SASI Hard Disk", tag, owner, clock, "x68k_hdc_image", __FILE__), + device_image_interface(mconfig, *this) +{ +} + +void x68k_hdc_image_device::device_config_complete() +{ + update_names(X68KHDC, "sasihd", "sasi"); +} + +void x68k_hdc_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_req = 1; + m_status_port |= 0x01; +} + +void x68k_hdc_image_device::device_start() +{ + m_status = 0x00; + m_status_port = 0x00; + m_phase = SASI_PHASE_BUSFREE; +} + +bool x68k_hdc_image_device::call_create(int format_type, option_resolution *format_options) +{ + // create 20MB HD + int x; + int ret; + unsigned char sectordata[256]; // empty block data + + memset(sectordata,0,sizeof(sectordata)); + for(x=0;x<0x013c98;x++) // 0x13c98 = number of blocks on a 20MB HD + { + ret = fwrite(sectordata,256); + if(ret < 256) + return IMAGE_INIT_FAIL; + } + + return IMAGE_INIT_PASS; +} + +WRITE16_MEMBER( x68k_hdc_image_device::hdc_w ) +{ + unsigned int lba = 0; + std::vector blk; + switch(offset) + { + case 0x00: // data I/O + if(m_phase == SASI_PHASE_WRITE) + { + if(m_transfer_byte_count == 0) + { + switch(m_command[0]) + { + case SASI_CMD_SPECIFY: + m_transfer_byte_total = 10; + break; + case SASI_CMD_WRITE: + m_transfer_byte_total = (0x100 * m_command[4]); + break; + default: + m_transfer_byte_total = 0x100; + } + } + + if(m_command[0] == SASI_CMD_SPECIFY) + { + logerror("SPECIFY: wrote 0x%02x\n",data); + } + + if(m_command[0] == SASI_CMD_WRITE) + { + if(!exists()) + { + m_phase = SASI_PHASE_STATUS; + m_io = 1; // Output + m_status_port |= 0x04; // C/D remains the same + m_status = 0x02; + logerror("SASI: No HD connected.\n"); + } + else + { + fwrite(&data,1); + } + } + + m_req = 0; + m_status_port &= ~0x01; + timer_set(attotime::from_nsec(450)); + m_transfer_byte_count++; + if(m_transfer_byte_count >= m_transfer_byte_total) + { + // End of transfer + m_phase = SASI_PHASE_STATUS; + m_io = 1; + m_status_port |= 0x04; + m_cd = 1; + m_status_port |= 0x08; + logerror("SASI: Write transfer complete\n"); + } + } + if(m_phase == SASI_PHASE_COMMAND) + { + if(m_command_byte_count == 0) + { + // first command byte + m_current_command = data; + switch(data >> 5) // high 3 bits determine command class, and therefore, length + { + case 0: + m_command_byte_total = 6; + break; + case 1: + m_command_byte_total = 10; + break; + case 2: + m_command_byte_total = 8; + break; + default: + m_command_byte_total = 6; + } + } + m_command[m_command_byte_count] = data; + // reset REQ temporarily + m_req = 0; + m_status_port &= ~0x01; + timer_set(attotime::from_nsec(450)); + + m_command_byte_count++; + if(m_command_byte_count >= m_command_byte_total) + { + // End of command + + switch(m_command[0]) + { + case SASI_CMD_REZERO_UNIT: + m_phase = SASI_PHASE_STATUS; + m_io = 1; // Output + m_status_port |= 0x04; // C/D remains the same + logerror("SASI: REZERO UNIT\n"); + break; + case SASI_CMD_REQUEST_SENSE: + m_phase = SASI_PHASE_READ; + m_io = 1; + m_status_port |= 0x04; + m_cd = 0; + m_status_port &= ~0x08; + m_transfer_byte_count = 0; + m_transfer_byte_total = 0; + logerror("SASI: REQUEST SENSE\n"); + break; + case SASI_CMD_SPECIFY: + m_phase = SASI_PHASE_WRITE; + m_io = 0; + m_status_port &= ~0x04; + m_cd = 0; // Data + m_status_port &= ~0x08; + m_transfer_byte_count = 0; + m_transfer_byte_total = 0; + logerror("SASI: SPECIFY\n"); + break; + case SASI_CMD_READ: + if(!exists()) + { + m_phase = SASI_PHASE_STATUS; + m_io = 1; // Output + m_status_port |= 0x04; // C/D remains the same + m_cd = 1; + m_status_port |= 0x08; + m_status = 0x02; + logerror("SASI: No HD connected\n"); + } + else + { + m_phase = SASI_PHASE_READ; + m_io = 1; + m_status_port |= 0x04; + m_cd = 0; + m_status_port &= ~0x08; + m_transfer_byte_count = 0; + m_transfer_byte_total = 0; + lba = m_command[3]; + lba |= m_command[2] << 8; + lba |= (m_command[1] & 0x1f) << 16; + fseek(lba * 256,SEEK_SET); + logerror("SASI: READ (LBA 0x%06x, blocks = %i)\n",lba,m_command[4]); + } + break; + case SASI_CMD_WRITE: + if(!exists()) + { + m_phase = SASI_PHASE_STATUS; + m_io = 1; // Output + m_status_port |= 0x04; // C/D remains the same + m_cd = 1; + m_status_port |= 0x08; + m_status = 0x02; + logerror("SASI: No HD connected\n"); + } + else + { + m_phase = SASI_PHASE_WRITE; + m_io = 0; + m_status_port &= ~0x04; + m_cd = 0; + m_status_port &= ~0x08; + m_transfer_byte_count = 0; + m_transfer_byte_total = 0; + lba = m_command[3]; + lba |= m_command[2] << 8; + lba |= (m_command[1] & 0x1f) << 16; + fseek(lba * 256,SEEK_SET); + logerror("SASI: WRITE (LBA 0x%06x, blocks = %i)\n",lba,m_command[4]); + } + break; + case SASI_CMD_SEEK: + m_phase = SASI_PHASE_STATUS; + m_io = 1; // Output + m_status_port |= 0x04; // C/D remains the same + m_cd = 1; + m_status_port |= 0x08; + logerror("SASI: SEEK (LBA 0x%06x)\n",lba); + break; + case SASI_CMD_FORMAT_UNIT: + case SASI_CMD_FORMAT_UNIT_06: + /* + Format Unit command format (differs from SASI spec?) + 0 | 0x06 + 1 | Unit number (0-7) | LBA MSB (high 5 bits) + 2 | LBA + 3 | LBA LSB + 4 | ?? (usually 0x01) + 5 | ?? + */ + m_phase = SASI_PHASE_STATUS; + m_io = 1; // Output + m_status_port |= 0x04; // C/D remains the same + m_cd = 1; + m_status_port |= 0x08; + lba = m_command[3]; + lba |= m_command[2] << 8; + lba |= (m_command[1] & 0x1f) << 16; + fseek(lba * 256,SEEK_SET); + blk.resize(256*33); + memset(&blk[0], 0, 256*33); + // formats 33 256-byte blocks + fwrite(&blk[0],256*33); + logerror("SASI: FORMAT UNIT (LBA 0x%06x)\n",lba); + break; + default: + m_phase = SASI_PHASE_STATUS; + m_io = 1; // Output + m_status_port |= 0x04; // C/D remains the same + m_status = 0x02; + logerror("SASI: Invalid or unimplemented SASI command (0x%02x) received.\n",m_command[0]); + } + } + } + break; + case 0x01: + if(data == 0) + { + if(m_phase == SASI_PHASE_SELECTION) + { + // Go to Command phase + m_phase = SASI_PHASE_COMMAND; + m_cd = 1; // data port expects a command or status + m_status_port |= 0x08; + m_command_byte_count = 0; + m_command_byte_total = 0; + timer_set(attotime::from_nsec(45)); + } + } + break; + case 0x02: + break; + case 0x03: + if(data != 0) + { + if(m_phase == SASI_PHASE_BUSFREE) + { + // Go to Selection phase + m_phase = SASI_PHASE_SELECTION; + m_bsy = 1; // HDC is now busy + m_status_port |= 0x02; + } + } + break; + } + +// logerror("SASI: write to HDC, offset %04x, data %04x\n",offset,data); +} + +READ16_MEMBER( x68k_hdc_image_device::hdc_r ) +{ + int retval = 0xff; + + switch(offset) + { + case 0x00: + if(m_phase == SASI_PHASE_MESSAGE) + { + m_phase = SASI_PHASE_BUSFREE; + m_msg = 0; + m_cd = 0; + m_io = 0; + m_bsy = 0; + m_req = 0; + m_status = 0; + m_status_port = 0; // reset all status bits to 0 + return 0x00; + } + if(m_phase == SASI_PHASE_STATUS) + { + m_phase = SASI_PHASE_MESSAGE; + m_msg = 1; + m_status_port |= 0x10; + // reset REQ temporarily + m_req = 0; + m_status_port &= ~0x01; + timer_set(attotime::from_nsec(450)); + + return m_status; + } + if(m_phase == SASI_PHASE_READ) + { + if(m_transfer_byte_count == 0) + { + switch(m_command[0]) + { + case SASI_CMD_REQUEST_SENSE: + // set up sense bytes + m_sense[0] = 0x01; // "No index signal" + m_sense[1] = 0; + m_sense[2] = 0; + m_sense[3] = 0; + if(m_command[3] == 0) + m_transfer_byte_total = 4; + else + m_transfer_byte_total = m_command[3]; + break; + case SASI_CMD_READ: + m_transfer_byte_total = (0x100 * m_command[4]); + m_transfer_byte_count = 0; + break; + default: + m_transfer_byte_total = 0; + } + } + + switch(m_command[0]) + { + case SASI_CMD_REQUEST_SENSE: + retval = m_sense[m_transfer_byte_count]; + logerror("REQUEST SENSE: read value 0x%02x\n",retval); + break; + case SASI_CMD_READ: + if(!exists()) + { + m_phase = SASI_PHASE_STATUS; + m_io = 1; // Output + m_status_port |= 0x04; // C/D remains the same + m_status = 0x02; + logerror("SASI: No HD connected.\n"); + } + else + { + unsigned char val; + fread(&val,1); + retval = val; + } + break; + default: + retval = 0; + } + + m_req = 0; + m_status_port &= ~0x01; + timer_set(attotime::from_nsec(450)); + m_transfer_byte_count++; + if(m_transfer_byte_count >= m_transfer_byte_total) + { + // End of transfer + m_phase = SASI_PHASE_STATUS; + m_io = 1; + m_status_port |= 0x04; + m_cd = 1; + m_status_port |= 0x08; + logerror("SASI: Read transfer complete\n"); + } + + return retval; + } + return 0x00; + case 0x01: +// logerror("SASI: [%08x] read from status port, read 0x%02x\n",activecpu_get_pc(),m_status_port); + return m_status_port; + case 0x02: + return 0xff; // write-only + case 0x03: + return 0xff; // write-only + default: + return 0xff; + } +} diff --git a/src/mame/machine/x68k_hdc.h b/src/mame/machine/x68k_hdc.h new file mode 100644 index 00000000000..73fc210fa63 --- /dev/null +++ b/src/mame/machine/x68k_hdc.h @@ -0,0 +1,130 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + + X68000 Custom SASI HD controller + +*/ + +#include "emu.h" + +enum +{ + SASI_PHASE_BUSFREE = 0, + SASI_PHASE_ARBITRATION, + SASI_PHASE_SELECTION, + SASI_PHASE_RESELECTION, + SASI_PHASE_COMMAND, + SASI_PHASE_DATA, + SASI_PHASE_STATUS, + SASI_PHASE_MESSAGE, + SASI_PHASE_READ, + SASI_PHASE_WRITE +}; + +// SASI commands, based on the SASI standard +enum +{ + // Class 0 (6-byte) commands + SASI_CMD_TEST_UNIT_READY = 0, + SASI_CMD_REZERO_UNIT, + SASI_CMD_RESERVED_02, + SASI_CMD_REQUEST_SENSE, + SASI_CMD_FORMAT_UNIT, + SASI_CMD_RESERVED_05, + SASI_CMD_FORMAT_UNIT_06, // the X68000 uses command 0x06 for Format Unit, despite the SASI specs saying 0x04 + SASI_CMD_RESERVED_07, + SASI_CMD_READ, + SASI_CMD_RESERVED_09, + SASI_CMD_WRITE, + SASI_CMD_SEEK, + SASI_CMD_RESERVED_0C, + SASI_CMD_RESERVED_0D, + SASI_CMD_RESERVED_0E, + SASI_CMD_WRITE_FILE_MARK, + SASI_CMD_INVALID_10, + SASI_CMD_INVALID_11, + SASI_CMD_RESERVE_UNIT, + SASI_CMD_RELEASE_UNIT, + SASI_CMD_INVALID_14, + SASI_CMD_INVALID_15, + SASI_CMD_READ_CAPACITY, + SASI_CMD_INVALID_17, + SASI_CMD_INVALID_18, + SASI_CMD_INVALID_19, + SASI_CMD_READ_DIAGNOSTIC, + SASI_CMD_WRITE_DIAGNOSTIC, + SASI_CMD_INVALID_1C, + SASI_CMD_INVALID_1D, + SASI_CMD_INVALID_1E, + SASI_CMD_INQUIRY, + // Class 1 commands (yes, just the one) + SASI_CMD_RESERVED_20, + SASI_CMD_RESERVED_21, + SASI_CMD_RESERVED_22, + SASI_CMD_SET_BLOCK_LIMITS = 0x28, + // Class 2 commands + SASI_CMD_EXTENDED_ADDRESS_READ = 0x48, + SASI_CMD_INVALID_49, + SASI_CMD_EXTENDED_ADDRESS_WRITE, + SASI_CMD_WRITE_AND_VERIFY = 0x54, + SASI_CMD_VERIFY, + SASI_CMD_INVALID_56, + SASI_CMD_SEARCH_DATA_HIGH, + SASI_CMD_SEARCH_DATA_EQUAL, + SASI_CMD_SEARCH_DATA_LOW, + // controller-specific commands + SASI_CMD_SPECIFY = 0xc2 +}; + +class x68k_hdc_image_device : public device_t, + public device_image_interface +{ +public: + // construction/destruction + x68k_hdc_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // image-level overrides + virtual iodevice_t image_type() const { return IO_HARDDISK; } + + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 1; } + virtual bool is_creatable() const { return 1; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 0; } + virtual const char *image_interface() const { return NULL; } + virtual const char *file_extensions() const { return "hdf"; } + virtual const option_guide *create_option_guide() const { return NULL; } + virtual bool call_create(int format_type, option_resolution *format_options); + + DECLARE_WRITE16_MEMBER( hdc_w ); + DECLARE_READ16_MEMBER( hdc_r ); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +private: + int m_phase; + unsigned char m_status_port; // read at 0xe96003 + unsigned char m_status; // status phase output + //unsigned char m_message; + unsigned char m_command[10]; + unsigned char m_sense[4]; + int m_command_byte_count; + int m_command_byte_total; + int m_current_command; + int m_transfer_byte_count; + int m_transfer_byte_total; + int m_msg; // MSG + int m_cd; // C/D (Command/Data) + int m_bsy; // BSY + int m_io; // I/O + int m_req; // REQ +}; + +// device type definition +extern const device_type X68KHDC; + +#define MCFG_X68KHDC_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, X68KHDC, 0) diff --git a/src/mame/machine/x68k_kbd.c b/src/mame/machine/x68k_kbd.c new file mode 100644 index 00000000000..18984549707 --- /dev/null +++ b/src/mame/machine/x68k_kbd.c @@ -0,0 +1,452 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +#include "machine/x68k_kbd.h" + +x68k_keyboard_device::x68k_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : + serial_keyboard_device(mconfig, X68K_KEYBOARD, "X68k Keyboard", tag, owner, 0, "x68k_keyboard", __FILE__), + m_io_kbd8(*this, "TERM_LINE8"), + m_io_kbd9(*this, "TERM_LINE9"), + m_io_kbda(*this, "TERM_LINEA"), + m_io_kbdb(*this, "TERM_LINEB"), + m_io_kbdd(*this, "TERM_LINED"), + m_io_kbde(*this, "TERM_LINEE") +{ +} + + +void x68k_keyboard_device::write(UINT8 data) +{ + /* Keyboard control commands: + 00xxxxxx - TV Control + Not of much use as yet + + 01000xxy - y = Mouse control signal + + 01001xxy - y = Keyboard enable + + 010100xy - y = Sharp X1 display compatibility mode + + 010101xx - xx = LED brightness (00 = bright, 11 = dark) + + 010110xy - y = Display control enable + + 010111xy - y = Display control via the Opt. 2 key enable + + 0110xxxx - xxxx = Key delay (default 500ms) + 100 * (delay time) + 200ms + + 0111xxxx - xxxx = Key repeat rate (default 110ms) + (repeat rate)^2*5 + 30ms + + 1xxxxxxx - xxxxxxx = keyboard LED status + b6 = "full size" + b5 = hiragana + b4 = insert + b3 = caps + b2 = code input + b1 = romaji input + b0 = kana + */ + + if(data & 0x80) // LED status + { + output_set_value("key_led_kana",(data & 0x01) ? 0 : 1); + output_set_value("key_led_romaji",(data & 0x02) ? 0 : 1); + output_set_value("key_led_code",(data & 0x04) ? 0 : 1); + output_set_value("key_led_caps",(data & 0x08) ? 0 : 1); + output_set_value("key_led_insert",(data & 0x10) ? 0 : 1); + output_set_value("key_led_hiragana",(data & 0x20) ? 0 : 1); + output_set_value("key_led_fullsize",(data & 0x40) ? 0 : 1); + logerror("KB: LED status set to %02x\n",data & 0x7f); + } + + if((data & 0xc0) == 0) // TV control + { + // nothing for now + } + + if((data & 0xf8) == 0x48) // Keyboard enable + { + m_enabled = data & 0x01; + logerror("KB: Keyboard enable bit = %i\n",m_enabled); + } + + if((data & 0xf0) == 0x60) // Key delay time + { + m_delay = data & 0x0f; + logerror("KB: Keypress delay time is now %ims\n",(data & 0x0f)*100+200); + } + + if((data & 0xf0) == 0x70) // Key repeat rate + { + m_repeat = data & 0x0f; + logerror("KB: Keypress repeat rate is now %ims\n",((data & 0x0f)^2)*5+30); + } +} + +UINT8 x68k_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) +{ + if (m_enabled) + { + for (int row = 0; row < 15; row++ ) + { + UINT8 data = 0; + + if (row == 0) data = m_io_kbd0->read(); + else + if (row == 1) data = m_io_kbd1->read(); + else + if (row == 2) data = m_io_kbd2->read(); + else + if (row == 3) data = m_io_kbd3->read(); + else + if (row == 4) data = m_io_kbd4->read(); + else + if (row == 5) data = m_io_kbd5->read(); + else + if (row == 6) data = m_io_kbd6->read(); + else + if (row == 7) data = m_io_kbd7->read(); + else + if (row == 8) data = m_io_kbd8->read(); + else + if (row == 9) data = m_io_kbd9->read(); + else + if (row == 10) data = m_io_kbda->read(); + else + if (row == 11) data = m_io_kbdb->read(); + else + if (row == 12) data = m_io_kbdc->read(); + else + if (row == 13) data = m_io_kbdd->read(); + else + if (row == 14) data = m_io_kbde->read(); + + for (int column = 0; column < 8; column++ ) + { + int new_down = (data & (1 << column)) != 0; + int scan_code = (row * 8) + column; + int old_down = m_key_down[scan_code]; + m_key_down[scan_code] = new_down; + + if (new_down && !old_down) + { + m_repeat_code = scan_code; + m_until_repeat = m_delay * 240; + + return scan_code; + } + else if(!new_down && old_down) + { + m_repeat_code = 0; + return scan_code + 0x80; + } + } + } + + if (m_repeat_code > 0 && m_key_down[m_repeat_code]) + { + m_until_repeat--; + if (m_until_repeat == 0) + { + m_until_repeat = m_repeat * 240; + return m_repeat_code; + } + } + } + + return 0; +} + +static INPUT_PORTS_START( x68k_keyboard ) + + PORT_START("TERM_LINE0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) // unused + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) /* ESC */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 ! \xE3\x83\x8C") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') /* 1 ! */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \" \xE3\x83\x95") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') /* 2 " */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 # \xE3\x82\xA2 \xE3\x82\xA1") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') /* 3 # */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $ \xE3\x82\xA6 \xE3\x82\xA5") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') /* 4 $ */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 % \xE3\x82\xA8 \xE3\x82\xA7") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') /* 5 % */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 & \xE3\x82\xAA \xE3\x82\xA9") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') /* 6 & */ + + PORT_START("TERM_LINE1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \' \xE3\x83\xA4 \xE3\x83\xA3") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') /* 7 ' */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 ( \xE3\x83\xA6 \xE3\x83\xA5") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') /* 8 ( */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 ) \xE3\x83\xA8 \xE3\x83\xA7") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') /* 9 ) */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 \xE3\x83\xAF \xE3\x83\xB2") PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0 */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- = \xE3\x83\x9B") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') /* - = */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("^ \xE3\x83\x98") PORT_CHAR('^') /* ^ */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA5 \xE3\x83\xBC |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') /* Yen | */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* Backspace */ + + PORT_START("TERM_LINE2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* Tab */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q \xE3\x82\xBF") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* Q */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W \xE3\x83\x86") PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* W */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E \xE3\x82\xA4 \xE3\x82\xA3") PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* E */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R \xE3\x82\xB9") PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* R */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T \xE3\x82\xAB") PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* T */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y \xE3\x83\xB3") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* Y */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U \xE3\x83\x8A") PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* U */ + + PORT_START("TERM_LINE3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I \xE3\x83\x8B") PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* I */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O \xE3\x83\xA9") PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* O */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P \xE3\x82\xBB") PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* P */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ ` \xE3\x82\x9B") PORT_CHAR('@') PORT_CHAR('`') /* @ */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ { \xE3\x82\x9C \xE3\x80\x8C") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') /* [ { */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* Return */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A \xE3\x83\x81") PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* A */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S \xE3\x83\x88") PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* S */ + + PORT_START("TERM_LINE4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D \xE3\x82\xB7") PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* D */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F \xE3\x83\x8F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* F */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G \xE3\x82\xAD") PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* G */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H \xE3\x82\xAF") PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* H */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J \xE3\x83\x9E") PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* J */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K \xE3\x83\x8E") PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* K */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L \xE3\x83\xAA") PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* L */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; + \xE3\x83\xAC") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') /* ; + */ + + PORT_START("TERM_LINE5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": * \xE3\x82\xB1") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') /* : * */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] } \xE3\x83\xA0 \xE3\x80\x8D") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') /* ] } */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z \xE3\x83\x84 \xE3\x83\x83") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* Z */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X \xE3\x82\xB5") PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* X */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C \xE3\x82\xBD") PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* C */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V \xE3\x83\x92") PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* V */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B \xE3\x82\xB3") PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* B */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N \xE3\x83\x9F") PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* N */ + + PORT_START("TERM_LINE6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M \xE3\x83\xA2") PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* M */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", < \xE3\x83\x8D \xE3\x80\x81") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') /* , < */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". > \xE3\x83\xAB \xE3\x80\x82") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') /* . > */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ? \xE3\x83\xA1 \xE3\x83\xBB") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') /* / ? */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_ \xE3\x83\xAD") PORT_CHAR('_') /* Underscore (shifted only?) */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') /* Space */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* Home */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) /* Del */ + + PORT_START("TERM_LINE7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_PGUP) /* Roll Up */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_PGDN) /* Roll Down */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Undo") PORT_CODE(KEYCODE_END) /* Undo */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) /* Left */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) /* Up */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /* Right */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) /* Down */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey CLR") PORT_CODE(KEYCODE_NUMLOCK) /* CLR */ + + PORT_START("TERM_LINE8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) /* / (numpad) */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) /* * (numpad) */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) /* - (numpad) */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) /* 7 (numpad) */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) /* 8 (numpad) */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) /* 9 (numpad) */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) /* + (numpad) */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) /* 4 (numpad) */ + + PORT_START("TERM_LINE9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) /* 5 (numpad) */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) /* 6 (numpad) */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey =") /* = (numpad) */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) /* 1 (numpad) */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) /* 2 (numpad) */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) /* 3 (numpad) */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* Enter (numpad) */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) /* 0 (numpad) */ + + PORT_START("TERM_LINEA") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey ,") /* , (numpad) */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) /* 2 (numpad) */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE8\xA8\x98\xE5\x8F\xB7 (Symbolic input)") /* Sign / Symbolic input (babelfish translation) */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE7\x99\xBB\xE9\x8C\xB2 (Register)") /* Register (babelfish translation) */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") /* Help */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF1") PORT_CODE(KEYCODE_F11) /* XF1 */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF2") PORT_CODE(KEYCODE_F12) /* XF2 */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF3") /* XF3 */ + + PORT_START("TERM_LINEB") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF4") /* XF4 */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF5") /* XF5 */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xe3\x81\x8b\xe3\x81\xaa (Kana)") /* Kana */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xe3\x83\xad\xe3\x83\xbc\xe3\x83\x9e\xe5\xad\x97 (Romaji)") /* Romaji */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89 (Code input)") /* Code input */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) /* Caps lock */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) /* Insert */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x81\xB2\xE3\x82\x89\xE3\x81\x8C\xE3\x81\xAA (Hiragana)") /* Hiragana */ + + PORT_START("TERM_LINEC") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE5\x85\xA8\xE8\xA7\x92 (Full size)") /* Full size (babelfish translation) */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") /* Break */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Copy") /* Copy */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) /* F1 */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) /* F2 */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) /* F3 */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) /* F4 */ + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) /* F5 */ + + PORT_START("TERM_LINED") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) /* F6 */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) /* F7 */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) /* F8 */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) /* F9 */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) /* F10 */ + // 0x6d reserved + // 0x6e reserved + // 0x6f reserved + + PORT_START("TERM_LINEE") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) /* Shift */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) /* Ctrl */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Opt. 1") PORT_CODE(KEYCODE_PRTSCR) /* Opt1 */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Opt. 2") PORT_CODE(KEYCODE_PAUSE) /* Opt2 */ + + PORT_START("RS232_TXBAUD") + PORT_CONFNAME(0xff, RS232_BAUD_38400, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_BAUD_38400, "38400") // TODO: Should be 2400 but MC68901 doesn't support divide by 16 + + PORT_START("RS232_STARTBITS") + PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STARTBITS_1, "1") + + PORT_START("RS232_DATABITS") + PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_DATABITS_8, "8") + + PORT_START("RS232_PARITY") + PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_PARITY_NONE, "None") + + PORT_START("RS232_STOPBITS") + PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) + PORT_CONFSETTING( RS232_STOPBITS_1, "1") +INPUT_PORTS_END + +ioport_constructor x68k_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(x68k_keyboard); +} + +void x68k_keyboard_device::device_start() +{ + serial_keyboard_device::device_start(); + set_rcv_rate(38400); // TODO: Should be 2400 but MC68901 doesn't support divide by 16 +} + +void x68k_keyboard_device::device_reset() +{ + serial_keyboard_device::device_reset(); + + m_enabled = 0; + m_delay = 500; // 3*100+200 + m_repeat = 110; // 4^2*5+30 + m_repeat_code = 0; + + memset(m_key_down, 0, sizeof(m_key_down)); +} + +void x68k_keyboard_device::rcv_complete() +{ + receive_register_extract(); + write(get_received_char()); +} + +const device_type X68K_KEYBOARD = &device_creator; + +#if 0 + +void x68k_state::x68k_keyboard_push_scancode(unsigned char code) +{ + m_keynum++; + if(m_keynum >= 1) + { + // keyboard buffer full + if(m_enabled != 0) + { + //m_mfp.rsr |= 0x80; // Buffer full + //if(ioport("options")->read() & 0x01) + //{ + // m_current_vector[6] = 0x4c; + // m_maincpu->set_input_line_and_vector(6,ASSERT_LINE,0x4c); + // logerror("MFP: Receive buffer full IRQ sent\n"); + //} + } + } + m_buffer[m_headpos++] = code; + if(m_headpos > 15) + { + m_headpos = 0; + m_current_vector[6] = 0x4b; + } +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_keyboard_poll) +{ + int x; + static const char *const keynames[] = { "key1", "key2", "key3", "key4" }; + + for(x=0;x<0x80;x++) + { + // adjust delay/repeat timers + if(m_keytime[x] > 0) + { + m_keytime[x] -= 5; + } + if(!(ioport(keynames[x / 32])->read() & (1 << (x % 32)))) + { + if(m_keyon[x] != 0) + { + x68k_keyboard_push_scancode(0x80 + x); + m_keytime[x] = 0; + m_keyon[x] = 0; + m_last_pressed = 0; + logerror("KB: Released key 0x%02x\n",x); + } + } + // check to see if a key is being held + if(m_keyon[x] != 0 && m_keytime[x] == 0 && m_last_pressed == x) + { + if(ioport(keynames[m_last_pressed / 32])->read() & (1 << (m_last_pressed % 32))) + { + x68k_keyboard_push_scancode(m_last_pressed); + m_keytime[m_last_pressed] = (m_repeat^2)*5+30; + logerror("KB: Holding key 0x%02x\n",m_last_pressed); + } + } + if((ioport(keynames[x / 32])->read() & (1 << (x % 32)))) + { + if(m_keyon[x] == 0) + { + x68k_keyboard_push_scancode(x); + m_keytime[x] = m_delay * 100 + 200; + m_keyon[x] = 1; + m_last_pressed = x; + logerror("KB: Pushed key 0x%02x\n",x); + } + } + } +} + + struct + { + unsigned char led_status; // keyboard LED status + unsigned char buffer[16]; + int headpos; // scancodes are added here + int tailpos; // scancodes are read from here + int keynum; // number of scancodes in buffer + int keytime[0x80]; // time until next keypress + int keyon[0x80]; // is 1 if key is pressed, used to determine if the key state has changed from 1 to 0 + int last_pressed; // last key pressed, for repeat key handling + } m_keyboard; + TIMER_CALLBACK_MEMBER(x68k_led_callback); + TIMER_CALLBACK_MEMBER(x68k_keyboard_poll); + void x68k_keyboard_ctrl_w(int data); + int x68k_keyboard_pop_scancode(); + void x68k_keyboard_push_scancode(unsigned char code); + +#endif diff --git a/src/mame/machine/x68k_kbd.h b/src/mame/machine/x68k_kbd.h new file mode 100644 index 00000000000..bc4908e7d03 --- /dev/null +++ b/src/mame/machine/x68k_kbd.h @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +#ifndef X68K_KBD_H_ +#define X68K_KBD_H_ + +#include "bus/rs232/keyboard.h" + +class x68k_keyboard_device : public serial_keyboard_device +{ +public: + x68k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ioport_constructor device_input_ports() const; + +protected: + virtual void device_start(); + virtual void device_reset(); + virtual void rcv_complete(); + +private: + virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); + void write(UINT8 data); + + required_ioport m_io_kbd8; + required_ioport m_io_kbd9; + required_ioport m_io_kbda; + required_ioport m_io_kbdb; + required_ioport m_io_kbdd; + required_ioport m_io_kbde; + + int m_delay; // keypress delay after initial press + int m_repeat; // keypress repeat rate + int m_enabled; // keyboard enabled? + + UINT8 m_key_down[15*8]; + int m_repeat_code; + int m_until_repeat; +}; + +extern const device_type X68K_KEYBOARD; + +#endif /* X68KKBD_H_ */ diff --git a/src/mame/machine/x820kb.c b/src/mame/machine/x820kb.c new file mode 100644 index 00000000000..115e8591e4a --- /dev/null +++ b/src/mame/machine/x820kb.c @@ -0,0 +1,387 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Xerox 820/820-II ASCII keyboard emulation + +*********************************************************************/ + +/* + +PCB Layout +---------- + +Maxi-Switch Co. +630107-02 + +|-----------------------------------------------------------------------| +| |--CN1--| CN2 | +| 8748 6MHz 74154 * | +| | +|-----------------------------------------------------------------------| + +Notes: + All IC's shown. + + 8048 - NEC D8748D + 74154 - 4-line to 16-line decoder/multiplexer + * - unpopulated 8-pin chip + CN1 - 2x16 PCB header + CN2 - unpopulated RJ-45? connector + +*/ + +/* + + TODO: + + - repeat + - what are T0/T1/INT? + +*/ + +#include "x820kb.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define I8748_TAG "i8748" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type XEROX_820_KEYBOARD = &device_creator; + + +//------------------------------------------------- +// ROM( xerox_820_keyboard ) +//------------------------------------------------- + +ROM_START( xerox_820_keyboard ) + ROM_REGION( 0x400, I8748_TAG, 0 ) + ROM_LOAD( "820iikey.bin", 0x000, 0x400, CRC(8ea3b39b) SHA1(3f05959f54a558b273567b1b4f0c7cdf46d8d9bf) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *xerox_820_keyboard_t::device_rom_region() const +{ + return ROM_NAME( xerox_820_keyboard ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( kb_io ) +//------------------------------------------------- + +static ADDRESS_MAP_START( xerox_820_keyboard_io, AS_IO, 8, xerox_820_keyboard_t ) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(kb_p2_r) AM_WRITENOP + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(kb_t0_r) + AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T1) AM_READ(kb_t1_r) + AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(kb_bus_w) +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_DRIVER( xerox_820_keyboard ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( xerox_820_keyboard ) + MCFG_CPU_ADD(I8748_TAG, I8048, XTAL_6MHz) + MCFG_CPU_IO_MAP(xerox_820_keyboard_io) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor xerox_820_keyboard_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( xerox_820_keyboard ); +} + + +//------------------------------------------------- +// INPUT_PORTS( xerox_820_keyboard ) +//------------------------------------------------- + +INPUT_PORTS_START( xerox_820_keyboard ) + PORT_START("Y0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + + PORT_START("Y1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + + PORT_START("Y2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') PORT_CHAR('`') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_CHAR('~') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + + PORT_START("Y3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR('\\') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + + PORT_START("Y4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // ; = + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // : < > + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_START("Y5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + + PORT_START("Y6") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_TILDE) + + PORT_START("Y7") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + + PORT_START("Y8") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + + PORT_START("YF") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor xerox_820_keyboard_t::device_input_ports() const +{ + return INPUT_PORTS_NAME( xerox_820_keyboard ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// xerox_820_keyboard_t - constructor +//------------------------------------------------- + +xerox_820_keyboard_t::xerox_820_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, XEROX_820_KEYBOARD, "Xerox 820 Keyboard", tag, owner, clock, "x820kb", __FILE__), + m_maincpu(*this, I8748_TAG), + m_y0(*this, "Y0"), + m_y1(*this, "Y1"), + m_y2(*this, "Y2"), + m_y3(*this, "Y3"), + m_y4(*this, "Y4"), + m_y5(*this, "Y5"), + m_y6(*this, "Y6"), + m_y7(*this, "Y7"), + m_y8(*this, "Y8"), + m_yf(*this, "YF"), + m_kbstb_cb(*this), + m_p1(0xff), + m_bus(0xff) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void xerox_820_keyboard_t::device_start() +{ + // state saving + save_item(NAME(m_p1)); + save_item(NAME(m_bus)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void xerox_820_keyboard_t::device_reset() +{ + m_kbstb_cb.resolve_safe(); +} + +void xerox_820_keyboard_t::device_reset_after_children() +{ + m_maincpu->set_input_line(MCS48_INPUT_IRQ, ASSERT_LINE); +} + + +//------------------------------------------------- +// kb_p1_r - +//------------------------------------------------- + +READ8_MEMBER( xerox_820_keyboard_t::kb_p1_r ) +{ + return m_p1; // TODO: move to mcs48.c +} + + +//------------------------------------------------- +// kb_p1_w - +//------------------------------------------------- + +WRITE8_MEMBER( xerox_820_keyboard_t::kb_p1_w ) +{ + /* + + bit description + + 0 A0 + 1 A1 + 2 A2 + 3 A3 + 4 KBSTB + 5 + 6 + 7 ? (toggled if T1=0) + + */ + + m_p1 = data; + + m_kbstb_cb(BIT(data, 4) ? CLEAR_LINE : ASSERT_LINE); +} + + +//------------------------------------------------- +// kb_p2_r - +//------------------------------------------------- + +READ8_MEMBER( xerox_820_keyboard_t::kb_p2_r ) +{ + UINT8 data = 0xff; + + switch (m_p1 & 0x0f) + { + case 0: data &= m_y0->read(); break; + case 1: data &= m_y1->read(); break; + case 2: data &= m_y2->read(); break; + case 3: data &= m_y3->read(); break; + case 4: data &= m_y4->read(); break; + case 5: data &= m_y5->read(); break; + case 6: data &= m_y6->read(); break; + case 7: data &= m_y7->read(); break; + case 8: data &= m_y8->read(); break; + case 0xf: data &= m_yf->read(); break; + } + + return data; +} + + +//------------------------------------------------- +// kb_t0_r - +//------------------------------------------------- + +READ8_MEMBER( xerox_820_keyboard_t::kb_t0_r ) +{ + UINT8 data = 1; + + switch (m_p1 & 0x0f) + { + case 0xd: data = 1; break; // ??? if 0, return key data | 0x80 + case 0xe: data = 1; break; // ??? if 0, set r6=1 + } + + return data; +} + + +//------------------------------------------------- +// kb_t1_r - +//------------------------------------------------- + +READ8_MEMBER( xerox_820_keyboard_t::kb_t1_r ) +{ + return 1; // ??? if 0, toggle P17 +} + + +//------------------------------------------------- +// kb_bus_w - +//------------------------------------------------- + +WRITE8_MEMBER( xerox_820_keyboard_t::kb_bus_w ) +{ + m_bus = data; +} diff --git a/src/mame/machine/x820kb.h b/src/mame/machine/x820kb.h new file mode 100644 index 00000000000..03a3054c486 --- /dev/null +++ b/src/mame/machine/x820kb.h @@ -0,0 +1,87 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Xerox 820/820-II ASCII keyboard emulation + +*********************************************************************/ + +#pragma once + +#ifndef __XEROX_820_KEYBOARD__ +#define __XEROX_820_KEYBOARD__ + +#include "emu.h" +#include "cpu/mcs48/mcs48.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(_devcb) \ + devcb = &xerox_820_keyboard_t::set_kbstb_wr_callback(*device, DEVCB_##_devcb); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> xerox_820_keyboard_t + +class xerox_820_keyboard_t : public device_t +{ +public: + // construction/destruction + xerox_820_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_kbstb_wr_callback(device_t &device, _Object object) { return downcast(device).m_kbstb_cb.set_callback(object); } + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + UINT8 read() { return m_bus; } + + DECLARE_READ8_MEMBER( kb_p1_r ); + DECLARE_WRITE8_MEMBER( kb_p1_w ); + DECLARE_READ8_MEMBER( kb_p2_r ); + DECLARE_READ8_MEMBER( kb_t0_r ); + DECLARE_READ8_MEMBER( kb_t1_r ); + DECLARE_WRITE8_MEMBER( kb_bus_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_reset_after_children(); + +private: + required_device m_maincpu; + required_ioport m_y0; + required_ioport m_y1; + required_ioport m_y2; + required_ioport m_y3; + required_ioport m_y4; + required_ioport m_y5; + required_ioport m_y6; + required_ioport m_y7; + required_ioport m_y8; + required_ioport m_yf; + + devcb_write_line m_kbstb_cb; + + UINT8 m_p1; + UINT8 m_bus; +}; + + +// device type definition +extern const device_type XEROX_820_KEYBOARD; + + + +#endif diff --git a/src/mame/machine/z80bin.c b/src/mame/machine/z80bin.c new file mode 100644 index 00000000000..ac18c8e7e11 --- /dev/null +++ b/src/mame/machine/z80bin.c @@ -0,0 +1,77 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +#include "emu.h" +#include "machine/z80bin.h" + +/*------------------------------------------------- + z80bin_load_file - load a z80bin file into + memory +-------------------------------------------------*/ + +int z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ) +{ + int ch; + UINT16 args[3]; + UINT16 i=0, j, size; + UINT8 data; + char pgmname[256]; + char message[256]; + + image->fseek(7, SEEK_SET); + + while((ch = image->fgetc()) != 0x1A) + { + if (ch == EOF) + { + image->seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file name"); + image->message(" Unexpected EOF while getting file name"); + return IMAGE_INIT_FAIL; + } + + if (ch != '\0') + { + if (i >= (ARRAY_LENGTH(pgmname) - 1)) + { + image->seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long"); + image->message(" File name too long"); + return IMAGE_INIT_FAIL; + } + + pgmname[i] = ch; /* build program name */ + i++; + } + } + + pgmname[i] = '\0'; /* terminate string with a null */ + + if (image->fread(args, sizeof(args)) != sizeof(args)) + { + image->seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size"); + image->message(" Unexpected EOF while getting file size"); + return IMAGE_INIT_FAIL; + } + + exec_addr[0] = LITTLE_ENDIANIZE_INT16(args[0]); + start_addr[0] = LITTLE_ENDIANIZE_INT16(args[1]); + end_addr[0] = LITTLE_ENDIANIZE_INT16(args[2]); + + size = (end_addr[0] - start_addr[0] + 1) & 0xffff; + + /* display a message about the loaded quickload */ + image->message(" %s\nsize=%04X : start=%04X : end=%04X : exec=%04X",pgmname,size,start_addr[0],end_addr[0],exec_addr[0]); + + for (i = 0; i < size; i++) + { + j = (start_addr[0] + i) & 0xffff; + if (image->fread(&data, 1) != 1) + { + snprintf(message, ARRAY_LENGTH(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); + image->seterror(IMAGE_ERROR_INVALIDIMAGE, message); + image->message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); + return IMAGE_INIT_FAIL; + } + space.write_byte(j, data); + } + + return IMAGE_INIT_PASS; +} diff --git a/src/mame/machine/z80bin.h b/src/mame/machine/z80bin.h new file mode 100644 index 00000000000..1690ebffcda --- /dev/null +++ b/src/mame/machine/z80bin.h @@ -0,0 +1,18 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/********************************************************************* + + machine/z80bin.h + + Quickload code for Z80 bin format + +*********************************************************************/ + +#pragma once + +#ifndef __Z80_BIN__ +#define __Z80_BIN__ + +int z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ); + +#endif diff --git a/src/mame/machine/z80ne.c b/src/mame/machine/z80ne.c new file mode 100644 index 00000000000..3e5bce4522e --- /dev/null +++ b/src/mame/machine/z80ne.c @@ -0,0 +1,770 @@ +// license:BSD-3-Clause +// copyright-holders:Roberto Lavarone +/*********************************************************************** + + machine/z80ne.c + + Functions to emulate general aspects of the machine (RAM, ROM, + interrupts, I/O ports) + +***********************************************************************/ + +/* Core includes */ +#include "emu.h" +#include "includes/z80ne.h" + +/* Components */ +#include "machine/ay31015.h" + +/* Devices */ +#include "imagedev/flopdrv.h" + +#define VERBOSE 0 +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + + + + + +/* timer to read cassette waveforms */ + +cassette_image_device* z80ne_state::cassette_device_image() +{ + if (m_lx385_ctrl & 0x08) + return m_cassette2; + else + return m_cassette1; +} + +TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_cassette_tc) +{ + UINT8 cass_ws = 0; + m_cass_data.input.length++; + + cass_ws = ((cassette_device_image())->input() > +0.02) ? 1 : 0; + + if ((cass_ws ^ m_cass_data.input.level) & cass_ws) + { + m_cass_data.input.level = cass_ws; + m_cass_data.input.bit = ((m_cass_data.input.length < m_cass_data.wave_filter) || (m_cass_data.input.length > 0x20)) ? 1 : 0; + m_cass_data.input.length = 0; + m_ay31015->set_input_pin(AY31015_SI, m_cass_data.input.bit); + } + m_cass_data.input.level = cass_ws; + + /* saving a tape - convert the serial stream from the uart */ + + m_cass_data.output.length--; + + if (!(m_cass_data.output.length)) + { + if (m_cass_data.output.level) + m_cass_data.output.level = 0; + else + { + m_cass_data.output.level=1; + cass_ws = m_ay31015->get_output_pin(AY31015_SO); + m_cass_data.wave_length = cass_ws ? m_cass_data.wave_short : m_cass_data.wave_long; + } + cassette_device_image()->output(m_cass_data.output.level ? -1.0 : +1.0); + m_cass_data.output.length = m_cass_data.wave_length; + } +} + + +DRIVER_INIT_MEMBER(z80ne_state,z80ne) +{ + /* first two entries point to rom on reset */ + UINT8 *RAM = m_region_z80ne->base(); + m_bank1->configure_entry(0, &RAM[0x00000]); /* RAM at 0x0000 */ + m_bank1->configure_entry(1, &RAM[0x14000]); /* ep382 at 0x0000 */ + m_bank2->configure_entry(0, &RAM[0x14000]); /* ep382 at 0x8000 */ +} + +DRIVER_INIT_MEMBER(z80ne_state,z80net) +{ + DRIVER_INIT_CALL(z80ne); +} + +DRIVER_INIT_MEMBER(z80ne_state,z80netb) +{ +} + +DRIVER_INIT_MEMBER(z80ne_state,z80netf) +{ + /* first two entries point to rom on reset */ + UINT8 *RAM = m_region_z80ne->base(); + m_bank1->configure_entry(0, &RAM[0x00000]); /* RAM at 0x0000-0x03FF */ + m_bank1->configure_entries(1, 3, &RAM[0x14400], 0x0400); /* ep390, ep1390, ep2390 at 0x0000-0x03FF */ + m_bank1->configure_entry(4, &RAM[0x14000]); /* ep382 at 0x0000-0x03FF */ + m_bank1->configure_entry(5, &RAM[0x10000]); /* ep548 at 0x0000-0x03FF */ + + m_bank2->configure_entry(0, &RAM[0x00400]); /* RAM at 0x0400 */ + m_bank2->configure_entry(1, &RAM[0x10400]); /* ep548 at 0x0400-0x3FFF */ + + m_bank3->configure_entry(0, &RAM[0x08000]); /* RAM at 0x8000 */ + m_bank3->configure_entry(1, &RAM[0x14000]); /* ep382 at 0x8000 */ + + m_bank4->configure_entry(0, &RAM[0x0F000]); /* RAM at 0xF000 */ + m_bank4->configure_entries(1, 3, &RAM[0x14400], 0x0400); /* ep390, ep1390, ep2390 at 0xF000 */ + +} + +TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_kbd_scan) +{ + /* + * NE555 is connected to a 74LS93 binary counter + * 74LS93 output: + * QA-QC: column index for LEDs and keyboard + * QD: keyboard row select + * + * Port F0 input bit assignment: + * 0 QA bits 0..3 of row counter + * 1 QB + * 2 QC + * 3 QD + * 4 Control button pressed, active high + * 5 Always low + * 6 Always low + * 7 Selected button pressed, active low + * + * + */ + + UINT16 key_bits; + UINT8 ctrl; //, rst; + UINT8 i; + + /* 4-bit counter */ + --m_lx383_scan_counter; + m_lx383_scan_counter &= 0x0f; + + if ( --m_lx383_downsampler == 0 ) + { + m_lx383_downsampler = LX383_DOWNSAMPLING; + key_bits = (m_io_row1->read() << 8) | m_io_row0->read(); +// rst = m_io_rst->read(); + ctrl = m_io_ctrl->read(); + + for ( i = 0; i>= 1; + } + } +} + +DIRECT_UPDATE_MEMBER(z80ne_state::z80ne_default) +{ + return address; +} +/* + * Handle NMI delay for single step instruction + */ +DIRECT_UPDATE_MEMBER(z80ne_state::z80ne_nmi_delay_count) +{ + m_nmi_delay_counter--; + + if (!m_nmi_delay_counter) + { + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } + return address; +} + +/* + * Handle delayed ROM/RAM banking at RESET + * after the first reset_delay_counter bytes have been read from ROM, switch the RAM back in + */ +DIRECT_UPDATE_MEMBER(z80ne_state::z80ne_reset_delay_count) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + /* + * TODO: when debugger is active, his memory access causes this callback + * + */ + if(!space.debugger_access()) + m_reset_delay_counter--; + + if (!m_reset_delay_counter) + { + /* remove this callback */ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); + /* and switch to RAM bank at address 0x0000 */ + m_bank1->set_entry( 0 ); /* RAM at 0x0000 (bank 1) */ + } + return address; +} + +void z80ne_state::reset_lx388() +{ + m_lx388_kr2376->set_input_pin( KR2376_DSII, 0); + m_lx388_kr2376->set_input_pin( KR2376_PII, 0); +} + +void z80ne_state::reset_lx382_banking() +{ + /* switch to ROM bank at address 0x0000 */ + m_bank1->set_entry(1); + m_bank2->set_entry(0); /* ep382 at 0x8000 */ + + /* after the first 3 bytes have been read from ROM, switch the RAM back in */ + m_reset_delay_counter = 2; + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_reset_delay_count), this)); +} + +void z80ne_state::reset_lx390_banking() +{ + m_reset_delay_counter = 0; + + switch (m_io_config->read() & 0x07) { + case 0x01: /* EP382 Hex Monitor */ + if (VERBOSE) + logerror("reset_lx390_banking: banking ep382\n"); + m_bank1->set_entry(4); /* ep382 at 0x0000 for 3 cycles, then RAM */ + m_bank2->set_entry(0); /* RAM at 0x0400 */ + m_bank3->set_entry(1); /* ep382 at 0x8000 */ + m_bank4->set_entry(0); /* RAM at 0xF000 */ + /* after the first 3 bytes have been read from ROM, switch the RAM back in */ + m_reset_delay_counter = 2; + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_reset_delay_count), this)); + break; + case 0x02: /* EP548 16k BASIC */ + if (VERBOSE) + logerror("reset_lx390_banking: banking ep548\n"); + m_bank1->set_entry(5); /* ep548 at 0x0000-0x03FF */ + m_bank2->set_entry(1); /* ep548 at 0x0400-0x3FFF */ + m_bank3->set_entry(0); /* RAM at 0x8000 */ + m_bank4->set_entry(0); /* RAM at 0xF000 */ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); + break; + case 0x03: /* EP390 Boot Loader for 5.5k floppy BASIC */ + if (VERBOSE) + logerror("reset_lx390_banking: banking ep390\n"); + m_bank1->set_entry(1); /* ep390 at 0x0000-0 x03FF for 3 cycles, then RAM */ + m_bank2->set_entry(0); /* RAM at 0x0400-0x3FFF */ + m_bank3->set_entry(0); /* RAM at 0x8000 */ + m_bank4->set_entry(1); /* ep390 at 0xF000 */ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); + break; + case 0x04: /* EP1390 Boot Loader for NE DOS 1.0/1.5 */ + if (VERBOSE) + logerror("reset_lx390_banking: banking ep1390\n"); + m_bank1->set_entry(2); /* ep1390 at 0x0000-0x03FF for 3 cycles, then RAM */ + m_bank2->set_entry(0); /* RAM at 0x0400-0x3FFF */ + m_bank3->set_entry(0); /* RAM at 0x8000 */ + m_bank4->set_entry(2); /* ep1390 at 0xF000 */ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); + break; + case 0x05: /* EP2390 Boot Loader for NE DOS G.1 */ + if (VERBOSE) + logerror("reset_lx390_banking: banking ep2390\n"); + m_bank1->set_entry(3); /* ep2390 at 0x0000-0x03FF for 3 cycles, then RAM */ + m_bank2->set_entry(0); /* RAM at 0x0400-0x3FFF */ + m_bank3->set_entry(0); /* RAM at 0x8000 */ + m_bank4->set_entry(3); /* ep2390 at 0xF000 */ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); + break; + } + + /* TODO: in real hardware the ENH bus line is pulled down + * until a I/O read is performed on a address with A0 address bit low and A1 or A2 address bit high + */ +} + +MACHINE_RESET_MEMBER(z80ne_state,z80ne_base) +{ + int i; + + LOG(("In machine_reset z80ne_base\n")); + + for ( i=0; iread() & 0x07) + { + case 0x01: + m_cass_data.speed = TAPE_300BPS; + m_cass_data.wave_filter = LX385_TAPE_SAMPLE_FREQ / 1600; + m_cass_data.wave_short = LX385_TAPE_SAMPLE_FREQ / (2400 * 2); + m_cass_data.wave_long = LX385_TAPE_SAMPLE_FREQ / (1200 * 2); + break; + case 0x02: + m_cass_data.speed = TAPE_600BPS; + m_cass_data.wave_filter = LX385_TAPE_SAMPLE_FREQ / 3200; + m_cass_data.wave_short = LX385_TAPE_SAMPLE_FREQ / (4800 * 2); + m_cass_data.wave_long = LX385_TAPE_SAMPLE_FREQ / (2400 * 2); + break; + case 0x04: + m_cass_data.speed = TAPE_1200BPS; + m_cass_data.wave_filter = LX385_TAPE_SAMPLE_FREQ / 6400; + m_cass_data.wave_short = LX385_TAPE_SAMPLE_FREQ / (9600 * 2); + m_cass_data.wave_long = LX385_TAPE_SAMPLE_FREQ / (4800 * 2); + } + m_cass_data.wave_length = m_cass_data.wave_short; + m_cass_data.output.length = m_cass_data.wave_length; + m_cass_data.output.level = 1; + m_cass_data.input.length = 0; + m_cass_data.input.bit = 1; + + m_ay31015->set_input_pin(AY31015_CS, 0); + m_ay31015->set_input_pin(AY31015_NB1, 1); + m_ay31015->set_input_pin(AY31015_NB2, 1); + m_ay31015->set_input_pin(AY31015_TSB, 1); + m_ay31015->set_input_pin(AY31015_EPS, 1); + m_ay31015->set_input_pin(AY31015_NP, m_io_lx_385->read() & 0x80 ? 1 : 0); + m_ay31015->set_input_pin(AY31015_CS, 1); + m_ay31015->set_receiver_clock(m_cass_data.speed * 16.0); + m_ay31015->set_transmitter_clock(m_cass_data.speed * 16.0); + + m_nmi_delay_counter = 0; + lx385_ctrl_w(m_maincpu->space(AS_PROGRAM), 0, 0); + +} + +MACHINE_RESET_MEMBER(z80ne_state,z80ne) +{ + LOG(("In machine_reset z80ne\n")); + reset_lx382_banking(); + MACHINE_RESET_CALL_MEMBER( z80ne_base ); +} + +MACHINE_RESET_MEMBER(z80ne_state,z80net) +{ + LOG(("In machine_reset z80net\n")); + MACHINE_RESET_CALL_MEMBER( z80ne ); + reset_lx388(); +} + +MACHINE_RESET_MEMBER(z80ne_state,z80netb) +{ + LOG(("In machine_reset z80netb\n")); + MACHINE_RESET_CALL_MEMBER( z80ne_base ); + reset_lx388(); +} + +MACHINE_RESET_MEMBER(z80ne_state,z80netf) +{ + LOG(("In machine_reset z80netf\n")); + reset_lx390_banking(); + MACHINE_RESET_CALL_MEMBER( z80ne_base ); + reset_lx388(); +} + +INPUT_CHANGED_MEMBER(z80ne_state::z80ne_reset) +{ + UINT8 rst; + rst = m_io_rst->read(); + + if ( ! BIT(rst, 0)) + { + machine().schedule_soft_reset(); + } +} + +INPUT_CHANGED_MEMBER(z80ne_state::z80ne_nmi) +{ + UINT8 nmi; + nmi = m_io_lx388_brk->read(); + + if ( ! BIT(nmi, 0)) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + } +} + +MACHINE_START_MEMBER(z80ne_state,z80ne) +{ + LOG(("In MACHINE_START z80ne\n")); + m_lx385_ctrl = 0x1f; + save_item(NAME(m_lx383_scan_counter)); + save_item(NAME(m_lx383_downsampler)); + save_item(NAME(m_lx383_key)); + save_item(NAME(m_nmi_delay_counter)); + m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ne_state::z80ne_cassette_tc),this)); + machine().scheduler().timer_pulse( attotime::from_hz(1000), timer_expired_delegate(FUNC(z80ne_state::z80ne_kbd_scan),this)); +} + +MACHINE_START_MEMBER(z80ne_state,z80net) +{ + MACHINE_START_CALL_MEMBER( z80ne ); + LOG(("In MACHINE_START z80net\n")); +} + +MACHINE_START_MEMBER(z80ne_state,z80netb) +{ + MACHINE_START_CALL_MEMBER( z80net ); + LOG(("In MACHINE_START z80netb\n")); +} + +MACHINE_START_MEMBER(z80ne_state,z80netf) +{ + MACHINE_START_CALL_MEMBER( z80net ); + LOG(("In MACHINE_START z80netf\n")); +} + +/****************************************************************************** + Drivers +******************************************************************************/ + +/* LX.383 - LX.384 HEX keyboard and display */ +READ8_MEMBER(z80ne_state::lx383_r) +{ + /* + * Keyboard scanning + * + * IC14 NE555 astable oscillator + * IC13 74LS93 binary counter + * IC5 74LS240 tri-state buffer + * + * l'oscillatore NE555 alimenta il clock del contatore 74LS93 + * D0 - Q(A) --\ + * D1 - Q(B) |-- column + * D2 - Q(C) --/ + * D3 - Q(D) row + * D4 - CTRL + * D5 - 0 + * D6 - 0 + * D7 - ~KEY Pressed + */ + return m_lx383_key[m_lx383_scan_counter]; +} + +WRITE8_MEMBER(z80ne_state::lx383_w) +{ + /* + * First 8 locations (F0-F7) are mapped to a dual-port 8-byte RAM + * The 1KHz NE-555 astable oscillator circuit drive + * a 4-bit 74LS93 binary counter. + * The 3 least sigificant bits of the counter are connected + * both to the read addres of the dual-port ram and to + * a 74LS156 3 to 8 binary decoder driving the cathode + * of 8 7-segments LEDS. + * The data output of the dual-port ram drive the anodes + * of the LEDS through 74LS07 buffers. + * LED segments - dual-port RAM bit: + * A 0x01 + * B 0x02 + * C 0x04 + * D 0x08 + * E 0x10 + * F 0x20 + * G 0x40 + * P 0x80 (represented by DP in original schematics) + * + * A write in the range F0-FF starts a 74LS90 counter + * that trigger the NMI line of the CPU afther 2 instruction + * fetch cycles for single step execution. + */ + + if ( offset < 8 ) + output_set_digit_value( offset, data ^ 0xff ); + else + { + /* after writing to port 0xF8 and the first ~M1 cycles strike a NMI for single step execution */ + m_nmi_delay_counter = 1; + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_nmi_delay_count), this)); + } +} + + +/* LX.385 Cassette tape interface */ +/* + * NE555 is connected to a 74LS93 binary counter + * 74LS93 output: + * QA-QC: column index for LEDs and keyboard + * QD: keyboard row select + * + * Port EE: UART Data Read/Write + * Port EF: Status/Control + * read, UART status bits read + * 0 OR Overrun + * 1 FE Framing Error + * 2 PE Parity Error + * 3 TBMT Transmitter Buffer Empty + * 4 DAV Data Available + * 5 EOC End Of Character + * 6 1 + * 7 1 + * write, UART control bits / Tape Unit select / Modulation control + * 0 bit1=0, bit0=0 UART Reset pulse + * 1 bit1=0, bit0=1 UART RDAV (Reset Data Available) pulse + * 2 Tape modulation enable + * 3 *TAPEA Enable (active low) (at reset: low) + * 4 *TAPEB Enable (active low) (at reset: low) + * Cassette is connected to the uart data input and output via the cassette + * interface hardware. + * + * The cassette interface hardware converts square-wave pulses into bits which the uart receives. + * + * 1. the cassette format: "frequency shift" is converted + into the uart data format "non-return to zero" + + 2. on cassette a 1 data bit is stored as 8 2400 Hz pulses + and a 0 data bit as 4 1200 Hz pulses + - At 1200 baud, a logic 1 is 1 cycle of 1200 Hz and a logic 0 is 1/2 cycle of 600 Hz. + - At 300 baud, a logic 1 is 8 cycles of 2400 Hz and a logic 0 is 4 cycles of 1200 Hz. + + Attenuation is applied to the signal and the square wave edges are rounded. + + A manchester encoder is used. A flip-flop synchronises input + data on the positive-edge of the clock pulse. + * + */ +READ8_MEMBER(z80ne_state::lx385_data_r) +{ + return m_ay31015->get_received_data(); +} + +READ8_MEMBER(z80ne_state::lx385_ctrl_r) +{ + /* set unused bits high */ + UINT8 data = 0xc0; + + m_ay31015->set_input_pin(AY31015_SWE, 0); + data |= (m_ay31015->get_output_pin(AY31015_OR ) ? 0x01 : 0); + data |= (m_ay31015->get_output_pin(AY31015_FE ) ? 0x02 : 0); + data |= (m_ay31015->get_output_pin(AY31015_PE ) ? 0x04 : 0); + data |= (m_ay31015->get_output_pin(AY31015_TBMT) ? 0x08 : 0); + data |= (m_ay31015->get_output_pin(AY31015_DAV ) ? 0x10 : 0); + data |= (m_ay31015->get_output_pin(AY31015_EOC ) ? 0x20 : 0); + m_ay31015->set_input_pin(AY31015_SWE, 1); + + return data; +} + +WRITE8_MEMBER(z80ne_state::lx385_data_w) +{ + m_ay31015->set_transmit_data(data); +} + +#define LX385_CASSETTE_MOTOR_MASK ((1<<3)|(1<<4)) + +WRITE8_MEMBER(z80ne_state::lx385_ctrl_w) +{ + /* Translate data to control signals + * 0 bit1=0, bit0=0 UART Reset pulse + * 1 bit1=0, bit0=1 UART RDAV (Reset Data Available) pulse + * 2 UART Tx Clock Enable (active high) + * 3 *TAPEA Enable (active low) (at reset: low) + * 4 *TAPEB Enable (active low) (at reset: low) + */ + UINT8 uart_reset, uart_rdav, uart_tx_clock; + UINT8 motor_a, motor_b; + UINT8 changed_bits = (m_lx385_ctrl ^ data) & 0x1C; + m_lx385_ctrl = data; + + uart_reset = ((data & 0x03) == 0x00); + uart_rdav = ((data & 0x03) == 0x01); + uart_tx_clock = ((data & 0x04) == 0x04); + motor_a = ((data & 0x08) == 0x00); + motor_b = ((data & 0x10) == 0x00); + + /* UART Reset and RDAV */ + if (uart_reset) + { + m_ay31015->set_input_pin(AY31015_XR, 1); + m_ay31015->set_input_pin(AY31015_XR, 0); + } + + if (uart_rdav) + { + m_ay31015->set_input_pin(AY31015_RDAV, 1); + m_ay31015->set_input_pin(AY31015_RDAV, 0); + } + + if (!changed_bits) return; + + /* UART Tx Clock enable/disable */ + if (changed_bits & 0x04) + m_ay31015->set_transmitter_clock(uart_tx_clock ? m_cass_data.speed * 16.0 : 0.0); + + /* motors */ + if(changed_bits & 0x18) + { + m_cassette1->change_state( + (motor_a) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + + m_cassette2->change_state( + (motor_b) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + + if (motor_a || motor_b) + m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(LX385_TAPE_SAMPLE_FREQ)); + else + m_cassette_timer->adjust(attotime::zero); + } +} + +READ8_MEMBER(z80ne_state::lx388_mc6847_videoram_r) +{ + if (offset == ~0) return 0xff; + + UINT8 *videoram = m_videoram; + int d6 = BIT(videoram[offset], 6); + int d7 = BIT(videoram[offset], 7); + + m_vdg->inv_w(d6 && d7); + m_vdg->as_w(!d6 && d7); + m_vdg->intext_w(!d6 && d7); + + return videoram[offset]; +} + +READ8_MEMBER(z80ne_state::lx388_data_r) +{ + UINT8 data; + + data = m_lx388_kr2376->data_r(space, 0) & 0x7f; + data |= m_lx388_kr2376->get_output_pin(KR2376_SO) << 7; + return data; +} + +READ8_MEMBER(z80ne_state::lx388_read_field_sync) +{ + return m_vdg->fs_r() << 7; +} + +/* + * DRQ INTRQ IC9B.10 IC8B.*Q + * 0 0 1 0 + * 0 1 0 x + * 1 0 0 x + * 1 1 0 x + * + */ + +WRITE8_MEMBER(z80ne_state::lx390_motor_w) +{ + /* Selection of drive and parameters + A write also causes the selected drive motor to turn on for about 3 seconds. + When the motor turns off, the drive is deselected. + d7 Unused (trs80: 1=MFM, 0=FM) + d6 (trs80: 1=Wait) + d5 0=Side 0, 1=Side 1 (trs80: 1=Write Precompensation enabled) + d4 Unused (trs80: 0=Side 0, 1=Side 1) + d3 1=select drive 3 + d2 1=select drive 2 + d1 1=select drive 1 + d0 1=select drive 0 */ + + floppy_image_device *floppy = NULL; + + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 2)) floppy = m_floppy2->get_device(); + if (BIT(data, 3)) floppy = m_floppy3->get_device(); + + m_wd1771->set_floppy(floppy); + + if (floppy) + { + floppy->ss_w(BIT(data, 5)); + floppy->mon_w(0); + } + + m_wd17xx_state.head = (data & 32) ? 1 : 0; + m_wd17xx_state.drive = data & 0x0F; + + /* no drive selected, turn off all leds */ + if (!m_wd17xx_state.drive) + { + output_set_value("drv0", 0); + output_set_value("drv1", 0); + } +} + +READ8_MEMBER(z80ne_state::lx390_reset_bank) +{ + offs_t pc; + + /* if PC is not in range, we are under integrated debugger control, DON'T SWAP */ + pc = m_maincpu->pc(); + if((pc >= 0xf000) && (pc <=0xffff)) + { + LOG(("lx390_reset_bank, reset memory bank 1\n")); + m_bank1->set_entry(0); /* RAM at 0x0000 (bank 1) */ + } + else + { + LOG(("lx390_reset_bank, bypass because in debugger\n")); + } + return 0xff; +} + +READ8_MEMBER(z80ne_state::lx390_fdc_r) +{ + UINT8 d; + + switch(offset) + { + case 0: + d = m_wd1771->status_r(space, 0) ^ 0xff; + LOG(("lx390_fdc_r, WD17xx status: %02x\n", d)); + break; + case 1: + d = m_wd1771->track_r(space, 0) ^ 0xff; + LOG(("lx390_fdc_r, WD17xx track: %02x\n", d)); + break; + case 2: + d = m_wd1771->sector_r(space, 0) ^ 0xff; + LOG(("lx390_fdc_r, WD17xx sector: %02x\n", d)); + break; + case 3: + d = m_wd1771->data_r(space, 0) ^ 0xff; + LOG(("lx390_fdc_r, WD17xx data3: %02x\n", d)); + break; + case 6: + d = 0xff; + lx390_reset_bank(space, 0); + break; + case 7: + d = m_wd1771->data_r(space, 3) ^ 0xff; + LOG(("lx390_fdc_r, WD17xx data7, force: %02x\n", d)); + break; + default: + d = 0x00; + } + return d; +} + +WRITE8_MEMBER(z80ne_state::lx390_fdc_w) +{ + UINT8 d; + + d = data; + switch(offset) + { + case 0: + LOG(("lx390_fdc_w, WD17xx command: %02x\n", d)); + m_wd1771->cmd_w(space, offset, d ^ 0xff); + if (m_wd17xx_state.drive & 1) + output_set_value("drv0", 2); + else if (m_wd17xx_state.drive & 2) + output_set_value("drv1", 2); + break; + case 1: + LOG(("lx390_fdc_w, WD17xx track: %02x\n", d)); + m_wd1771->track_w(space, offset, d ^ 0xff); + break; + case 2: + LOG(("lx390_fdc_w, WD17xx sector: %02x\n", d)); + m_wd1771->sector_w(space, offset, d ^ 0xff); + break; + case 3: + m_wd1771->data_w(space, 0, d ^ 0xff); + LOG(("lx390_fdc_w, WD17xx data3: %02x\n", d)); + break; + case 6: + LOG(("lx390_fdc_w, motor_w: %02x\n", d)); + lx390_motor_w(space, 0, d); + break; + case 7: + LOG(("lx390_fdc_w, WD17xx data7, force: %02x\n", d)); + m_wd1771->data_w(space, 3, d ^ 0xff); + break; + } +} diff --git a/src/mame/machine/zx.c b/src/mame/machine/zx.c new file mode 100644 index 00000000000..be1e1ed246c --- /dev/null +++ b/src/mame/machine/zx.c @@ -0,0 +1,390 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Krzysztof Strzecha, Robbbert +/*************************************************************************** + zx.c + + machine driver + Juergen Buchmueller , Dec 1999 + +****************************************************************************/ + +#include "includes/zx.h" + +#define video_screen_get_refresh(screen) (((screen_config *)(screen)->inline_config)->refresh) + +#define DEBUG_ZX81_PORTS 1 +#define DEBUG_ZX81_VSYNC 1 + +#define LOG_ZX81_IOR(_comment) do { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOR: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, space.machine().first_screen()->vpos(), _comment); } while (0) +#define LOG_ZX81_IOW(_comment) do { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOW: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, space.machine().first_screen()->vpos(), _comment); } while (0) +#define LOG_ZX81_VSYNC do { if (DEBUG_ZX81_VSYNC) logerror("VSYNC starts in scanline: %d\n", space.machine().first_screen()->vpos()); } while (0) + + +WRITE8_MEMBER(zx_state::zx_ram_w) +{ + UINT8 *RAM = m_region_maincpu->base(); + RAM[offset + 0x4000] = data; + + if (data & 0x40) + { + space.write_byte(offset | 0xc000, data); + RAM[offset | 0xc000] = data; + } + else + { + space.write_byte(offset | 0xc000, 0); + RAM[offset | 0xc000] = 0; + } +} + +/* I know this looks really pointless... but it has to be here */ +READ8_MEMBER( zx_state::zx_ram_r ) +{ + UINT8 *RAM = m_region_maincpu->base(); + return RAM[offset | 0xc000]; +} + +DRIVER_INIT_MEMBER(zx_state,zx) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + + space.install_read_bank(0x4000, 0x4000 + m_ram->size() - 1, "bank1"); + space.install_write_handler(0x4000, 0x4000 + m_ram->size() - 1, write8_delegate(FUNC(zx_state::zx_ram_w),this)); + membank("bank1")->set_base(m_region_maincpu->base() + 0x4000); +} + +DIRECT_UPDATE_MEMBER(zx_state::zx_setdirect) +{ + if (address & 0xc000) + zx_ula_r(address, m_region_maincpu, 0); + return address; +} + +DIRECT_UPDATE_MEMBER(zx_state::pc8300_setdirect) +{ + if (address & 0xc000) + zx_ula_r(address, m_region_gfx1, 0); + return address; +} + +DIRECT_UPDATE_MEMBER(zx_state::pow3000_setdirect) +{ + if (address & 0xc000) + zx_ula_r(address, m_region_gfx1, 1); + return address; +} + +void zx_state::machine_reset() +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::zx_setdirect), this)); + m_tape_bit = 0x80; +} + +MACHINE_RESET_MEMBER(zx_state,pow3000) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pow3000_setdirect), this)); + m_tape_bit = 0x80; +} + +MACHINE_RESET_MEMBER(zx_state,pc8300) +{ + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pc8300_setdirect), this)); + m_tape_bit = 0x80; +} + +TIMER_CALLBACK_MEMBER(zx_state::zx_tape_pulse) +{ + m_tape_bit = 0x80; +} + +READ8_MEMBER( zx_state::zx80_io_r ) +{ +/* port FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out + The upper 8 bits are used to select a keyboard scan line */ + + UINT8 data = 0xff; + UINT8 offs = offset & 0xff; + + if (offs == 0xfe) + { + if ((offset & 0x0100) == 0) + data &= m_io_row0->read(); + if ((offset & 0x0200) == 0) + data &= m_io_row1->read(); + if ((offset & 0x0400) == 0) + data &= m_io_row2->read(); + if ((offset & 0x0800) == 0) + data &= m_io_row3->read(); + if ((offset & 0x1000) == 0) + data &= m_io_row4->read(); + if ((offset & 0x2000) == 0) + data &= m_io_row5->read(); + if ((offset & 0x4000) == 0) + data &= m_io_row6->read(); + if ((offset & 0x8000) == 0) + data &= m_io_row7->read(); + + if (!m_io_config->read()) + data &= ~0x40; + + m_cassette->output(+1.0); + + if (m_ula_irq_active) + { + zx_ula_bkgnd(0); + m_ula_irq_active = 0; + } +// else +// { + if ((m_cassette->input() < -0.75) && m_tape_bit) + { + m_tape_bit = 0x00; + timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE); + } + + data &= ~m_tape_bit; +// } + if (m_ula_frame_vsync == 3) + { + m_ula_frame_vsync = 2; + } + } + + return data; +} + +READ8_MEMBER( zx_state::zx81_io_r ) +{ +/* port FB = read printer status, not emulated + FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out + The upper 8 bits are used to select a keyboard scan line */ + + UINT8 data = 0xff; + UINT8 offs = offset & 0xff; + + if (offs == 0xfe) + { + if ((offset & 0x0100) == 0) + data &= m_io_row0->read(); + if ((offset & 0x0200) == 0) + data &= m_io_row1->read(); + if ((offset & 0x0400) == 0) + data &= m_io_row2->read(); + if ((offset & 0x0800) == 0) + data &= m_io_row3->read(); + if ((offset & 0x1000) == 0) + data &= m_io_row4->read(); + if ((offset & 0x2000) == 0) + data &= m_io_row5->read(); + if ((offset & 0x4000) == 0) + data &= m_io_row6->read(); + if ((offset & 0x8000) == 0) + data &= m_io_row7->read(); + + if (!m_io_config->read()) + data &= ~0x40; + + m_cassette->output(+1.0); + + if (m_ula_irq_active) + { + zx_ula_bkgnd(0); + m_ula_irq_active = 0; + } + else + { + if ((m_cassette->input() < -0.75) && m_tape_bit) + { + m_tape_bit = 0x00; + timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE); + } + + data &= ~m_tape_bit; + } + if (m_ula_frame_vsync == 3) + { + m_ula_frame_vsync = 2; + } + } + + return data; +} + +READ8_MEMBER( zx_state::pc8300_io_r ) +{ +/* port F5 = sound + F6 = unknown + FB = read printer status, not emulated + FE = read keyboard and cass bit; turn off HSYNC-generator/cass-out + The upper 8 bits are used to select a keyboard scan line. + No TV diode */ + + UINT8 data = 0xff; + UINT8 offs = offset & 0xff; + + if (offs == 0xf5) + { + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + } + else + if (offs == 0xfe) + { + if ((offset & 0x0100) == 0) + data &= m_io_row0->read(); + if ((offset & 0x0200) == 0) + data &= m_io_row1->read(); + if ((offset & 0x0400) == 0) + data &= m_io_row2->read(); + if ((offset & 0x0800) == 0) + data &= m_io_row3->read(); + if ((offset & 0x1000) == 0) + data &= m_io_row4->read(); + if ((offset & 0x2000) == 0) + data &= m_io_row5->read(); + if ((offset & 0x4000) == 0) + data &= m_io_row6->read(); + if ((offset & 0x8000) == 0) + data &= m_io_row7->read(); + + m_cassette->output(+1.0); + + if (m_ula_irq_active) + { + zx_ula_bkgnd(0); + m_ula_irq_active = 0; + } + else + { + if ((m_cassette->input() < -0.75) && m_tape_bit) + { + m_tape_bit = 0x00; + timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE); + } + + data &= ~m_tape_bit; + } + if (m_ula_frame_vsync == 3) + { + m_ula_frame_vsync = 2; + } + } + + return data; +} + +READ8_MEMBER( zx_state::pow3000_io_r ) +{ +/* port 7E = read NTSC/PAL diode + F5 = sound + F6 = unknown + FB = read printer status, not emulated + FE = read keyboard and cass bit; turn off HSYNC-generator/cass-out + The upper 8 bits are used to select a keyboard scan line */ + + UINT8 data = 0xff; + UINT8 offs = offset & 0xff; + + if (offs == 0x7e) + { + data = (m_io_config->read()); + } + else + if (offs == 0xf5) + { + m_speaker_state ^= 1; + m_speaker->level_w(m_speaker_state); + } + else + if (offs == 0xfe) + { + if ((offset & 0x0100) == 0) + data &= m_io_row0->read(); + if ((offset & 0x0200) == 0) + data &= m_io_row1->read(); + if ((offset & 0x0400) == 0) + data &= m_io_row2->read(); + if ((offset & 0x0800) == 0) + data &= m_io_row3->read(); + if ((offset & 0x1000) == 0) + data &= m_io_row4->read(); + if ((offset & 0x2000) == 0) + data &= m_io_row5->read(); + if ((offset & 0x4000) == 0) + data &= m_io_row6->read(); + if ((offset & 0x8000) == 0) + data &= m_io_row7->read(); + + m_cassette->output(+1.0); + + if (m_ula_irq_active) + { + zx_ula_bkgnd(0); + m_ula_irq_active = 0; + } + else + { + if ((m_cassette->input() < -0.75) && m_tape_bit) + { + m_tape_bit = 0x00; + timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE); + } + + data &= ~m_tape_bit; + } + if (m_ula_frame_vsync == 3) + { + m_ula_frame_vsync = 2; + } + } + + return data; +} + +WRITE8_MEMBER( zx_state::zx80_io_w ) +{ +/* port FF = write HSYNC and cass data */ + + UINT8 offs = offset & 0xff; + + if (offs == 0xff) + m_cassette->output(-1.0); +} + +WRITE8_MEMBER( zx_state::zx81_io_w ) +{ +/* port F5 = unknown, pc8300/pow3000/lambda only + F6 = unknown, pc8300/pow3000/lambda only + FB = write data to printer, not emulated + FD = turn off NMI generator + FE = turn on NMI generator + FF = write HSYNC and cass data */ + + int height = m_screen->height(); + UINT8 offs = offset & 0xff; + + if (offs == 0xfd) + { + m_ula_nmi->reset(); + } + else + if (offs == 0xfe) + { + m_ula_nmi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(207)); + + /* remove the IRQ */ + m_ula_irq_active = 0; + } + else + if (offs == 0xff) + { + m_cassette->output(-1.0); + zx_ula_bkgnd(1); + if (m_ula_frame_vsync == 2) + { + m_maincpu->spin_until_time(m_screen->time_until_pos(height - 1, 0)); + m_ula_scanline_count = height - 1; + logerror ("S: %d B: %d\n", m_screen->vpos(), m_screen->hpos()); + } + } +} diff --git a/src/mame/machine/zx8302.c b/src/mame/machine/zx8302.c new file mode 100644 index 00000000000..6866b61f290 --- /dev/null +++ b/src/mame/machine/zx8302.c @@ -0,0 +1,606 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Sinclair ZX8302 emulation + +**********************************************************************/ + +/* + + TODO: + + - set time + - read from microdrive + - write to microdrive + - DTR/CTS handling + - network + +*/ + +#include "emu.h" +#include +#include "machine/microdrv.h" +#include "zx8302.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + + +// Monday 1st January 1979 00:00:00 UTC +static const int RTC_BASE_ADJUST = 283996800; + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ZX8302 = &device_creator; + +//************************************************************************** +// INLINE HELPERS +//************************************************************************** + +//------------------------------------------------- +// trigger_interrupt - +//------------------------------------------------- + +inline void zx8302_device::trigger_interrupt(UINT8 line) +{ + m_irq |= line; + + m_out_ipl1l_cb(ASSERT_LINE); +} + + +//------------------------------------------------- +// transmit_ipc_data - transmit IPC data +//------------------------------------------------- + +inline void zx8302_device::transmit_ipc_data() +{ + /* + + IPC <-> ZX8302 serial link protocol + *********************************** + + Send bit to IPC + --------------- + + 1. ZX start bit (COMDATA = 0) + 2. IPC clock (COMCTL = 0, COMTL = 1) + 3. ZX data bit (COMDATA = 0/1) + 4. IPC clock (COMCTL = 0, COMTL = 1) + 5. ZX stop bit (COMDATA = 1) + + Receive bit from IPC + -------------------- + + 1. ZX start bit (COMDATA = 0) + 2. IPC clock (COMCTL = 0, COMTL = 1) + 3. IPC data bit (COMDATA = 0/1) + 4. IPC clock (COMCTL = 0, COMTL = 1) + 5. IPC stop bit (COMDATA = 1) + + */ + + switch (m_ipc_state) + { + case IPC_START: + if (LOG) logerror("ZX8302 '%s' COMDATA Start Bit\n", tag()); + + m_out_comdata_cb(BIT(m_idr, 0)); + m_ipc_busy = 1; + m_ipc_state = IPC_DATA; + break; + + case IPC_DATA: + if (LOG) logerror("ZX8302 '%s' COMDATA Data Bit: %x\n", tag(), BIT(m_idr, 1)); + + m_comdata_to_ipc = BIT(m_idr, 1); + m_out_comdata_cb(m_comdata_to_ipc); + m_ipc_state = IPC_STOP; + break; + + case IPC_STOP: + if (LOG) logerror("ZX8302 '%s' COMDATA Stop Bit\n", tag()); + + m_out_comdata_cb(BIT(m_idr, 2)); + m_ipc_busy = 0; + break; + } +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// zx8302_device - constructor +//------------------------------------------------- + +zx8302_device::zx8302_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ZX8302, "Sinclair ZX8302", tag, owner, clock, "zx8302", __FILE__), + device_serial_interface(mconfig, *this), + m_rtc_clock(0), + m_out_ipl1l_cb(*this), + m_out_baudx4_cb(*this), + m_out_comdata_cb(*this), + m_out_txd1_cb(*this), + m_out_txd2_cb(*this), + m_out_netout_cb(*this), + m_out_mdselck_cb(*this), + m_out_mdseld_cb(*this), + m_out_mdrdw_cb(*this), + m_out_erase_cb(*this), + m_out_raw1_cb(*this), + m_in_raw1_cb(*this), + m_out_raw2_cb(*this), + m_in_raw2_cb(*this), + m_dtr1(0), + m_cts2(0), + m_idr(1), + m_irq(0), + m_ctr(time(NULL) + RTC_BASE_ADJUST), + m_status(0), + m_comdata_from_ipc(1), + m_comdata_to_cpu(1), + m_comdata_to_ipc(1), + m_comctl(1), + m_ipc_state(0), + m_ipc_busy(0), + m_baudx4(0), + m_track(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zx8302_device::device_start() +{ + // resolve callbacks + m_out_ipl1l_cb.resolve_safe(); + m_out_baudx4_cb.resolve_safe(); + m_out_comdata_cb.resolve_safe(); + m_out_txd1_cb.resolve_safe(); + m_out_txd2_cb.resolve_safe(); + m_out_netout_cb.resolve_safe(); + m_out_mdselck_cb.resolve_safe(); + m_out_mdseld_cb.resolve_safe(); + m_out_mdrdw_cb.resolve_safe(); + m_out_erase_cb.resolve_safe(); + m_out_raw1_cb.resolve_safe(); + m_in_raw1_cb.resolve_safe(0); + m_out_raw2_cb.resolve_safe(); + m_in_raw2_cb.resolve_safe(0); + + // allocate timers + m_baudx4_timer = timer_alloc(TIMER_BAUDX4); + m_rtc_timer = timer_alloc(TIMER_RTC); + m_gap_timer = timer_alloc(TIMER_GAP); + + m_rtc_timer->adjust(attotime::zero, 0, attotime::from_hz(m_rtc_clock / 32768)); + m_gap_timer->adjust(attotime::zero, 0, attotime::from_msec(31)); + + // register for state saving + save_item(NAME(m_dtr1)); + save_item(NAME(m_cts2)); + save_item(NAME(m_idr)); + save_item(NAME(m_tcr)); + save_item(NAME(m_tdr)); + save_item(NAME(m_irq)); + save_item(NAME(m_ctr)); + save_item(NAME(m_status)); + save_item(NAME(m_comdata_from_ipc)); + save_item(NAME(m_comdata_to_cpu)); + save_item(NAME(m_comdata_to_ipc)); + save_item(NAME(m_comctl)); + save_item(NAME(m_ipc_state)); + save_item(NAME(m_ipc_busy)); + save_item(NAME(m_baudx4)); + save_item(NAME(m_mdv_data)); + save_item(NAME(m_track)); +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void zx8302_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_BAUDX4: + m_baudx4 = !m_baudx4; + m_out_baudx4_cb(m_baudx4); + break; + + case TIMER_RTC: + m_ctr++; + break; + + case TIMER_GAP: + trigger_interrupt(INT_GAP); + break; + + default: + device_serial_interface::device_timer(timer, id, param, ptr); + break; + } +} + + +//------------------------------------------------- +// tra_callback - +//------------------------------------------------- + +void zx8302_device::tra_callback() +{ + switch (m_tcr & MODE_MASK) + { + case MODE_SER1: + m_out_txd1_cb(transmit_register_get_data_bit()); + break; + + case MODE_SER2: + m_out_txd2_cb(transmit_register_get_data_bit()); + break; + + case MODE_MDV: + // TODO + break; + + case MODE_NET: + m_out_netout_cb(transmit_register_get_data_bit()); + break; + } +} + + +//------------------------------------------------- +// tra_complete - +//------------------------------------------------- + +void zx8302_device::tra_complete() +{ + m_status &= ~STATUS_TX_BUFFER_FULL; + + trigger_interrupt(INT_TRANSMIT); +} + + +//------------------------------------------------- +// rcv_callback - +//------------------------------------------------- + +void zx8302_device::rcv_callback() +{ + switch (m_tcr & MODE_MASK) + { + case MODE_NET: + receive_register_update_bit(m_rs232_rx); + break; + } +} + + +//------------------------------------------------- +// rcv_complete - +//------------------------------------------------- + +void zx8302_device::rcv_complete() +{ + // TODO +} + + +//------------------------------------------------- +// rtc_r - real time clock read +//------------------------------------------------- + +READ8_MEMBER( zx8302_device::rtc_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0: + data = (m_ctr >> 24) & 0xff; + break; + case 1: + data = (m_ctr >> 16) & 0xff; + break; + case 2: + data = (m_ctr >> 8) & 0xff; + break; + case 3: + data = m_ctr & 0xff; + break; + } + + return data; +} + + +//------------------------------------------------- +// rtc_w - real time clock write +//------------------------------------------------- + +WRITE8_MEMBER( zx8302_device::rtc_w ) +{ + if (LOG) logerror("ZX8302 '%s' Set Real Time Clock: %02x\n", tag(), data); +} + + +//------------------------------------------------- +// control_w - serial transmit clock +//------------------------------------------------- + +WRITE8_MEMBER( zx8302_device::control_w ) +{ + if (LOG) logerror("ZX8302 '%s' Transmit Control: %02x\n", tag(), data); + + int baud = (19200 >> (data & BAUD_MASK)); + int baudx4 = baud * 4; + + m_tcr = data; + + m_baudx4_timer->adjust(attotime::zero, 0, attotime::from_hz(baudx4)); + + set_tra_rate(baud); + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2); +} + + +//------------------------------------------------- +// mdv_track_r - microdrive track data +//------------------------------------------------- + +READ8_MEMBER( zx8302_device::mdv_track_r ) +{ + if (LOG) logerror("ZX8302 '%s' Microdrive Track %u: %02x\n", tag(), m_track, m_mdv_data[m_track]); + + UINT8 data = m_mdv_data[m_track]; + + m_track = !m_track; + + return data; +} + + +//------------------------------------------------- +// status_r - status register +//------------------------------------------------- + +READ8_MEMBER( zx8302_device::status_r ) +{ + /* + + bit description + + 0 Network port + 1 Transmit buffer full + 2 Receive buffer full + 3 Microdrive GAP + 4 SER1 DTR + 5 SER2 CTS + 6 IPC busy + 7 COMDATA + + */ + + UINT8 data = 0; + + // TODO network port + + // serial status + data |= m_status; + + // TODO microdrive GAP + + // data terminal ready + data |= m_dtr1 << 4; + + // clear to send + data |= m_cts2 << 5; + + // IPC busy + data |= m_ipc_busy << 6; + + // COMDATA + data |= m_comdata_to_cpu << 7; + + if (LOG) logerror("ZX8302 '%s' Status: %02x\n", tag(), data); + + return data; +} + + +//------------------------------------------------- +// ipc_command_w - IPC command +//------------------------------------------------- +// When the main CPU writes to the IPC it writes the lsn of 18003 +// this is encoded as follows : +// +// b0 start bit +// b1 data bit +// b2 stop bit +// b3 extra stop bit. +// +// At startup the IPC sits in a loop waiting for the comdata bit to go +// high, the main CPU does this by writing 0x01 to output register. + +WRITE8_MEMBER( zx8302_device::ipc_command_w ) +{ + if (LOG) logerror("ZX8302 '%s' IPC Command: %02x\n", tag(), data); + + m_idr = data; + m_ipc_state = IPC_START; + + transmit_ipc_data(); +} + + +//------------------------------------------------- +// mdv_control_w - microdrive control +//------------------------------------------------- + +WRITE8_MEMBER( zx8302_device::mdv_control_w ) +{ + /* + + bit description + + 0 MDSELDH + 1 MDSELCKH + 2 MDRDWL + 3 ERASE + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("ZX8302 '%s' Microdrive Control: %02x\n", tag(), data); + + m_out_mdseld_cb(BIT(data, 0)); + m_out_mdselck_cb(BIT(data, 1)); + m_out_mdrdw_cb(BIT(data, 2)); + m_out_erase_cb(BIT(data, 3)); + + if (BIT(data, 1)) + { + m_status &= ~STATUS_RX_BUFFER_FULL; + } +} + + +//------------------------------------------------- +// irq_status_r - interrupt status +//------------------------------------------------- + +READ8_MEMBER( zx8302_device::irq_status_r ) +{ + if (LOG) logerror("ZX8302 '%s' Interrupt Status: %02x\n", tag(), m_irq); + + return m_irq; +} + + +//------------------------------------------------- +// irq_acknowledge_w - interrupt acknowledge +//------------------------------------------------- + +WRITE8_MEMBER( zx8302_device::irq_acknowledge_w ) +{ + if (LOG) logerror("ZX8302 '%s' Interrupt Acknowledge: %02x\n", tag(), data); + + m_irq &= ~data; + + if (!m_irq) + { + m_out_ipl1l_cb(CLEAR_LINE); + } +} + + +//------------------------------------------------- +// data_w - transmit buffer +//------------------------------------------------- + +WRITE8_MEMBER( zx8302_device::data_w ) +{ + if (LOG) logerror("ZX8302 '%s' Data Register: %02x\n", tag(), data); + + m_tdr = data; + m_status |= STATUS_TX_BUFFER_FULL; +} + + +//------------------------------------------------- +// vsync_w - vertical sync +//------------------------------------------------- + +WRITE_LINE_MEMBER( zx8302_device::vsync_w ) +{ + if (state) + { + if (LOG) logerror("ZX8302 '%s' Frame Interrupt\n", tag()); + + trigger_interrupt(INT_FRAME); + } +} + + +//------------------------------------------------- +// comctl_w - IPC COMCTL +//------------------------------------------------- + +WRITE_LINE_MEMBER( zx8302_device::comctl_w ) +{ + if (LOG) logerror("ZX8302 '%s' COMCTL: %x\n", tag(), state); + + if (state) + { + transmit_ipc_data(); + m_comdata_to_cpu = m_comdata_from_ipc; + } +} + + +//------------------------------------------------- +// comdata_w - IPC COMDATA +//------------------------------------------------- +// IPC writing comdata to CPU +// + +WRITE_LINE_MEMBER( zx8302_device::comdata_w ) +{ + if (LOG) logerror("ZX8302 '%s' COMDATA->CPU(pending): %x\n", tag(), state); + + m_comdata_from_ipc = state; +} + + +//------------------------------------------------- +// extint_w - external interrupt +//------------------------------------------------- + +WRITE_LINE_MEMBER( zx8302_device::extint_w ) +{ + if (LOG) logerror("ZX8302 '%s' EXTINT: %x\n", tag(), state); + + if (state == ASSERT_LINE) + { + trigger_interrupt(INT_EXTERNAL); + } +} + +WRITE_LINE_MEMBER( zx8302_device::write_netin ) +{ + m_rs232_rx = state; + device_serial_interface::rx_w(state); +} + +WRITE_LINE_MEMBER( zx8302_device::write_dtr1 ) +{ + m_dtr1 = state; +} + +WRITE_LINE_MEMBER( zx8302_device::write_cts2 ) +{ + m_cts2 = state; +} diff --git a/src/mame/machine/zx8302.h b/src/mame/machine/zx8302.h new file mode 100644 index 00000000000..2cfb4efbe49 --- /dev/null +++ b/src/mame/machine/zx8302.h @@ -0,0 +1,263 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Sinclair ZX8302 emulation + +********************************************************************** + _____ _____ + ERASE 1 |* \_/ | 40 Vdd + EXTINTL 2 | | 39 DB4 + MDRDWL 3 | | 38 DB5 + NETOUT 4 | | 37 DB0 + BAUDX4 5 | | 36 DB1 + DTR1L 6 | | 35 COMDATA + CTS2L 7 | | 34 MDSELDH + DCSML 8 | | 33 MDSELCKN + ROWL 9 | | 32 VSYNCH + PCENL 10 | ZX8302 | 31 XTAL2 + Vdd 11 | ULA | 30 XTAL1 + DB2 12 | | 29 + TXD1 13 | | 28 RESETOUTL + TXD2 14 | | 27 DB7 + A5 15 | | 26 IPL1L + NETIN 16 | | 25 CLKCPU + A1 17 | | 24 DB3 + A0 18 | | 23 DB6 + RAW2 19 | | 22 COMCTL + GND 20 |_____________| 21 RAW1 + +**********************************************************************/ + +#pragma once + +#ifndef __ZX8302__ +#define __ZX8302__ + +#include "emu.h" + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_ZX8302_RTC_CLOCK(_clk) \ + zx8302_device::set_rtc_clock(*device, _clk); + +#define MCFG_ZX8302_OUT_IPL1L_CB(_devcb) \ + devcb = &zx8302_device::set_out_ipl1l_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_BAUDX4_CB(_devcb) \ + devcb = &zx8302_device::set_out_baudx4_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_COMDATA_CB(_devcb) \ + devcb = &zx8302_device::set_out_comdata_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_TXD1_CB(_devcb) \ + devcb = &zx8302_device::set_out_txd1_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_TXD2_CB(_devcb) \ + devcb = &zx8302_device::set_out_txd2_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_NETOUT_CB(_devcb) \ + devcb = &zx8302_device::set_out_netout_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_MDSELCK_CB(_devcb) \ + devcb = &zx8302_device::set_out_mdselck_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_MDSELD_CB(_devcb) \ + devcb = &zx8302_device::set_out_mdseld_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_MDRDW_CB(_devcb) \ + devcb = &zx8302_device::set_out_mdrdw_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_ERASE_CB(_devcb) \ + devcb = &zx8302_device::set_out_erase_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_RAW1_CB(_devcb) \ + devcb = &zx8302_device::set_out_raw1_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_IN_RAW1_CB(_devcb) \ + devcb = &zx8302_device::set_in_raw1_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_OUT_RAW2_CB(_devcb) \ + devcb = &zx8302_device::set_out_raw2_callback(*device, DEVCB_##_devcb); + +#define MCFG_ZX8302_IN_RAW2_CB(_devcb) \ + devcb = &zx8302_device::set_in_raw2_callback(*device, DEVCB_##_devcb); + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> zx8302_device + +class zx8302_device : public device_t, + public device_serial_interface +{ +public: + // construction/destruction + zx8302_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + static void set_rtc_clock(device_t &device, int rtc_clock) { downcast(device).m_rtc_clock = rtc_clock; } + template static devcb_base &set_out_ipl1l_callback(device_t &device, _Object object) { return downcast(device).m_out_ipl1l_cb.set_callback(object); } + template static devcb_base &set_out_baudx4_callback(device_t &device, _Object object) { return downcast(device).m_out_baudx4_cb.set_callback(object); } + template static devcb_base &set_out_comdata_callback(device_t &device, _Object object) { return downcast(device).m_out_comdata_cb.set_callback(object); } + template static devcb_base &set_out_txd1_callback(device_t &device, _Object object) { return downcast(device).m_out_txd1_cb.set_callback(object); } + template static devcb_base &set_out_txd2_callback(device_t &device, _Object object) { return downcast(device).m_out_txd2_cb.set_callback(object); } + template static devcb_base &set_out_netout_callback(device_t &device, _Object object) { return downcast(device).m_out_netout_cb.set_callback(object); } + template static devcb_base &set_out_mdselck_callback(device_t &device, _Object object) { return downcast(device).m_out_mdselck_cb.set_callback(object); } + template static devcb_base &set_out_mdseld_callback(device_t &device, _Object object) { return downcast(device).m_out_mdseld_cb.set_callback(object); } + template static devcb_base &set_out_mdrdw_callback(device_t &device, _Object object) { return downcast(device).m_out_mdrdw_cb.set_callback(object); } + template static devcb_base &set_out_erase_callback(device_t &device, _Object object) { return downcast(device).m_out_erase_cb.set_callback(object); } + template static devcb_base &set_out_raw1_callback(device_t &device, _Object object) { return downcast(device).m_out_raw1_cb.set_callback(object); } + template static devcb_base &set_in_raw1_callback(device_t &device, _Object object) { return downcast(device).m_in_raw1_cb.set_callback(object); } + template static devcb_base &set_out_raw2_callback(device_t &device, _Object object) { return downcast(device).m_out_raw2_cb.set_callback(object); } + template static devcb_base &set_in_raw2_callback(device_t &device, _Object object) { return downcast(device).m_in_raw2_cb.set_callback(object); } + + DECLARE_READ8_MEMBER( rtc_r ); + DECLARE_WRITE8_MEMBER( rtc_w ); + DECLARE_WRITE8_MEMBER( control_w ); + DECLARE_READ8_MEMBER( mdv_track_r ); + DECLARE_READ8_MEMBER( status_r ); + DECLARE_WRITE8_MEMBER( ipc_command_w ); + DECLARE_WRITE8_MEMBER( mdv_control_w ); + DECLARE_READ8_MEMBER( irq_status_r ); + DECLARE_WRITE8_MEMBER( irq_acknowledge_w ); + DECLARE_WRITE8_MEMBER( data_w ); + DECLARE_WRITE_LINE_MEMBER( vsync_w ); + DECLARE_WRITE_LINE_MEMBER( comctl_w ); + DECLARE_WRITE_LINE_MEMBER( comdata_w ); + DECLARE_WRITE_LINE_MEMBER( extint_w ); + + DECLARE_WRITE_LINE_MEMBER( write_netin ); + DECLARE_WRITE_LINE_MEMBER( write_dtr1 ); + DECLARE_WRITE_LINE_MEMBER( write_cts2 ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // device_serial_interface overrides + virtual void tra_callback(); + virtual void tra_complete(); + virtual void rcv_callback(); + virtual void rcv_complete(); + + inline void trigger_interrupt(UINT8 line); + inline void transmit_ipc_data(); + +private: + enum + { + TIMER_BAUDX4 = 0, + TIMER_RTC, + TIMER_GAP + }; + + enum + { + IPC_START, + IPC_DATA, + IPC_STOP + }; + + enum + { + BAUD_19200 = 0, + BAUD_9600, + BAUD_4800, + BAUD_2400, + BAUD_1200, + BAUD_600, + BAUD_300, + BAUD_75, + BAUD_MASK = 0x07 + }; + + enum + { + MODE_SER1 = 0x00, + MODE_SER2 = 0x08, + MODE_MDV = 0x10, + MODE_NET = 0x18, + MODE_MASK = 0x18 + }; + + enum + { + INT_GAP = 0x01, + INT_INTERFACE = 0x02, + INT_TRANSMIT = 0x04, + INT_FRAME = 0x08, + INT_EXTERNAL = 0x10 + }; + + enum + { + STATUS_NETWORK_PORT = 0x01, + STATUS_TX_BUFFER_FULL = 0x02, + STATUS_RX_BUFFER_FULL = 0x04, + STATUS_MICRODRIVE_GAP = 0x08 + }; + + int m_rtc_clock; // the RTC clock (pin 30) of the chip + + // serial + devcb_write_line m_out_ipl1l_cb; + devcb_write_line m_out_baudx4_cb; + devcb_write_line m_out_comdata_cb; + devcb_write_line m_out_txd1_cb; + devcb_write_line m_out_txd2_cb; + devcb_write_line m_out_netout_cb; + + // microdrive + devcb_write_line m_out_mdselck_cb; + devcb_write_line m_out_mdseld_cb; + devcb_write_line m_out_mdrdw_cb; + devcb_write_line m_out_erase_cb; + devcb_write_line m_out_raw1_cb; + devcb_read_line m_in_raw1_cb; + devcb_write_line m_out_raw2_cb; + devcb_read_line m_in_raw2_cb; + + int m_rs232_rx; + int m_dtr1; + int m_cts2; + + // registers + UINT8 m_idr; // IPC data register + UINT8 m_tcr; // transfer control register + UINT8 m_tdr; // transfer data register + UINT8 m_irq; // interrupt register + UINT32 m_ctr; // counter register + UINT8 m_status; // status register + + // IPC communication state + int m_comdata_from_ipc; // pending data from IPC->68000 + int m_comdata_to_cpu; // communication data IPC->68000 + int m_comdata_to_ipc; // communication data 68000->IPC + int m_comctl; // communication control + int m_ipc_state; // communication state + int m_ipc_busy; // IPC busy + int m_baudx4; // IPC baud x4 + + // microdrive state + UINT8 m_mdv_data[2]; // track data register + int m_track; // current track + + // timers + emu_timer *m_baudx4_timer; // baud x4 timer + emu_timer *m_rtc_timer; // real time clock timer + emu_timer *m_gap_timer; // microdrive gap timer +}; + + +// device type definition +extern const device_type ZX8302; + + + +#endif diff --git a/src/mame/mame.mak b/src/mame/mame.mak deleted file mode 100644 index 7fe7bc04f64..00000000000 --- a/src/mame/mame.mak +++ /dev/null @@ -1,10 +0,0 @@ -########################################################################### -# -# makefile -# -# Additional makefile for building MAME -# -########################################################################### - -GEN_FOLDERS += $(GENDIR)/mess/layout/ -LAYOUTS += $(wildcard $(SRC)/mess/layout/*.lay) diff --git a/src/mame/tools/castool/main.c b/src/mame/tools/castool/main.c new file mode 100644 index 00000000000..22564dcdf78 --- /dev/null +++ b/src/mame/tools/castool/main.c @@ -0,0 +1,217 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + main.c + + Castool command line front end + + 27/03/2009 Initial version by Miodrag Milanovic + +***************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "corestr.h" + +#include "formats/a26_cas.h" +#include "formats/ace_tap.h" +#include "formats/adam_cas.h" +#include "formats/apf_apt.h" +#include "formats/cbm_tap.h" +#include "formats/cgen_cas.h" +#include "formats/coco_cas.h" +#include "formats/csw_cas.h" +#include "formats/fm7_cas.h" +#include "formats/fmsx_cas.h" +#include "formats/gtp_cas.h" +#include "formats/hect_tap.h" +#include "formats/kc_cas.h" +#include "formats/kim1_cas.h" +#include "formats/lviv_lvt.h" +#include "formats/mz_cas.h" +#include "formats/orao_cas.h" +#include "formats/oric_tap.h" +#include "formats/p6001_cas.h" +#include "formats/phc25_cas.h" +#include "formats/pmd_cas.h" +#include "formats/primoptp.h" +#include "formats/rk_cas.h" +#include "formats/sc3000_bit.h" +#include "formats/sol_cas.h" +#include "formats/sorc_cas.h" +#include "formats/sord_cas.h" +#include "formats/spc1000_cas.h" +#include "formats/svi_cas.h" +#include "formats/thom_cas.h" +#include "formats/trs_cas.h" +#include "formats/tvc_cas.h" +#include "formats/tzx_cas.h" +#include "formats/uef_cas.h" +#include "formats/vg5k_cas.h" +#include "formats/vt_cas.h" +#include "formats/x07_cas.h" +#include "formats/x1_tap.h" +#include "formats/zx81_p.h" + +struct SupportedCassetteFormats +{ + const char *name; + const struct CassetteFormat * const *formats; + const char *desc; +}; + +const struct SupportedCassetteFormats formats[] = { + {"a26", a26_cassette_formats ,"Atari 2600 SuperCharger"}, + {"apf", apf_cassette_formats ,"APF Imagination Machine"}, + {"bbc", bbc_cassette_formats ,"Acorn BBC & Electron"}, + {"cbm", cbm_cassette_formats ,"Commodore 8-bit series"}, + {"cdt", cdt_cassette_formats ,"Amstrad CPC"}, + {"cgenie", cgenie_cassette_formats ,"EACA Colour Genie"}, + {"coco", coco_cassette_formats ,"Tandy Radio Shack Color Computer"}, + {"csw", csw_cassette_formats ,"Compressed Square Wave"}, + {"ddp", coleco_adam_cassette_formats ,"Coleco ADAM"}, + {"fm7", fm7_cassette_formats ,"Fujitsu FM-7"}, + {"fmsx", fmsx_cassette_formats ,"MSX"}, + {"gtp", gtp_cassette_formats ,"Elektronika inzenjering Galaksija"}, + {"hector", hector_cassette_formats ,"Micronique Hector & Interact Family Computer"}, + {"jupiter", ace_cassette_formats ,"Jupiter Cantab Jupiter Ace"}, + {"kc85", kc_cassette_formats ,"VEB Mikroelektronik KC 85"}, + {"kim1", kim1_cassette_formats ,"MOS KIM-1"}, + {"lviv", lviv_lvt_format ,"PK-01 Lviv"}, + {"mo5", mo5_cassette_formats ,"Thomson MO-series"}, + {"mz", mz700_cassette_formats ,"Sharp MZ-700"}, + {"orao", orao_cassette_formats ,"PEL Varazdin Orao"}, + {"oric", oric_cassette_formats ,"Tangerine Oric"}, + {"pc6001", pc6001_cassette_formats ,"NEC PC-6001"}, + {"phc25", phc25_cassette_formats ,"Sanyo PHC-25"}, + {"pmd85", pmd85_cassette_formats ,"Tesla PMD-85"}, + {"primo", primo_ptp_format ,"Microkey Primo"}, + {"rku", rku_cassette_formats ,"UT-88"}, + {"rk8", rk8_cassette_formats ,"Mikro-80"}, + {"rks", rks_cassette_formats ,"Specialist"}, + {"rko", rko_cassette_formats ,"Orion"}, + {"rkr", rkr_cassette_formats ,"Radio-86RK"}, + {"rka", rka_cassette_formats ,"Zavod BRA Apogee BK-01"}, + {"rkm", rkm_cassette_formats ,"Mikrosha"}, + {"rkp", rkp_cassette_formats ,"SAM SKB VM Partner-01.01"}, + {"sc3000", sc3000_cassette_formats ,"Sega SC-3000"}, + {"sol20", sol20_cassette_formats ,"PTC SOL-20"}, + {"sorcerer", sorcerer_cassette_formats ,"Exidy Sorcerer"}, + {"sordm5", sordm5_cassette_formats ,"Sord M5"}, + {"spc1000", spc1000_cassette_formats ,"Samsung SPC-1000"}, + {"svi", svi_cassette_formats ,"Spectravideo SVI-318 & SVI-328"}, + {"to7", to7_cassette_formats ,"Thomson TO-series"}, + {"trs80l2", trs80l2_cassette_formats ,"TRS-80 Level 2"}, + {"tvc64", tvc64_cassette_formats ,"Videoton TVC 64"}, + {"tzx", tzx_cassette_formats ,"Sinclair ZX Spectrum"}, + {"uef", uef_cassette_formats ,"Acorn Electron"}, + {"vg5k", vg5k_cassette_formats ,"Philips VG 5000"}, + {"vtech1", vtech1_cassette_formats ,"Video Technology Laser 110-310"}, + {"vtech2", vtech2_cassette_formats ,"Video Technology Laser 350-700"}, + {"x07", x07_cassette_formats ,"Canon X-07"}, + {"x1", x1_cassette_formats ,"Sharp X1"}, + {"zx80_o", zx80_o_format ,"Sinclair ZX80"}, + {"zx81_p", zx81_p_format ,"Sinclair ZX81"}, + + + + {NULL,NULL,NULL} +}; + + +static const char *get_extension(const char *name) +{ + const char *s; + s = name; + if (s != NULL) + s = strrchr(s, '.'); + return s ? s+1 : NULL; +} + +static void display_usage(void) +{ + fprintf(stderr, "Usage: \n"); + fprintf(stderr, " castool.exe convert \n"); +} + +static void display_formats(void) +{ + int i,j; + fprintf(stderr, "Supported formats:\n\n"); + for (i = 0; formats[i].name; i++) { + fprintf(stderr, "%10s - %s\n",formats[i].name,formats[i].desc); + for (j = 1; formats[i].formats[j]; j++) { + fprintf(stderr, "%15s %s\n","",formats[i].formats[j]->extensions); + } + } +} + +int CLIB_DECL main(int argc, char *argv[]) +{ + int i; + int found =0; + const struct CassetteFormat * const *selected_formats = NULL; + cassette_image *cassette; + FILE *f; + + if (argc > 1) + { + if (!core_stricmp("convert", argv[1])) + { + // convert command + if (argc!=5) { + fprintf(stderr, "Wrong parameter number.\n\n"); + display_usage(); + return -1; + } else { + for (i = 0; formats[i].name; i++) { + if (core_stricmp(formats[i].name,argv[2])==0) { + selected_formats = formats[i].formats; + found = 1; + } + } + if (found==0) { + fprintf(stderr, "Wrong format name.\n\n"); + display_usage(); + fprintf(stderr, "\n"); + display_formats(); + return -1; + } + + f = fopen(argv[3], "rb"); + if (!f) { + fprintf(stderr, "File %s not found.\n",argv[3]); + return -1; + } + + if (cassette_open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, CASSETTE_FLAG_READONLY, &cassette)) { + fprintf(stderr, "Invalid format of input file.\n"); + fclose(f); + return -1; + } + + cassette_dump(cassette,argv[4]); + cassette_close(cassette); + fclose(f); + goto theend; + } + } + } + + /* Usage */ + fprintf(stderr, "castool - Generic cassette manipulation tool for use with MESS\n\n"); + display_usage(); + fprintf(stderr, "\n"); + display_formats(); + fprintf(stderr, "\nExample usage:\n"); + fprintf(stderr, " castool.exe convert tzx game.tzx game.wav\n\n"); + +theend : + return 0; +} diff --git a/src/mame/tools/floptool/main.c b/src/mame/tools/floptool/main.c new file mode 100644 index 00000000000..2cb36f3a873 --- /dev/null +++ b/src/mame/tools/floptool/main.c @@ -0,0 +1,275 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + main.c + + Floptool command line front end + + 20/07/2011 Initial version by Miodrag Milanovic + +***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +#include "corestr.h" + +#include "formats/mfi_dsk.h" +#include "formats/dfi_dsk.h" +#include "formats/ipf_dsk.h" + +#include "formats/hxcmfm_dsk.h" +#include "formats/ami_dsk.h" + +#include "formats/st_dsk.h" +#include "formats/pasti_dsk.h" + +#include "formats/dsk_dsk.h" + +#include "formats/d88_dsk.h" +#include "formats/imd_dsk.h" +#include "formats/td0_dsk.h" +#include "formats/cqm_dsk.h" +#include "formats/pc_dsk.h" +#include "formats/naslite_dsk.h" + +#include "formats/ap_dsk35.h" +#include "formats/ap2_dsk.h" + +#include "formats/oric_dsk.h" + +#include "formats/applix_dsk.h" + +static floppy_format_type floppy_formats[] = { + FLOPPY_MFI_FORMAT, + FLOPPY_DFI_FORMAT, + FLOPPY_IPF_FORMAT, + + FLOPPY_MFM_FORMAT, + FLOPPY_ADF_FORMAT, + + FLOPPY_ST_FORMAT, + FLOPPY_MSA_FORMAT, + FLOPPY_PASTI_FORMAT, + + FLOPPY_DSK_FORMAT, + + FLOPPY_D88_FORMAT, + FLOPPY_IMD_FORMAT, + FLOPPY_TD0_FORMAT, + FLOPPY_CQM_FORMAT, + FLOPPY_PC_FORMAT, + FLOPPY_NASLITE_FORMAT, + + FLOPPY_DC42_FORMAT, + FLOPPY_A216S_FORMAT, + FLOPPY_RWTS18_FORMAT, + FLOPPY_EDD_FORMAT, + + FLOPPY_ORIC_DSK_FORMAT, + + FLOPPY_APPLIX_FORMAT, +}; + +void CLIB_DECL ATTR_PRINTF(1,2) logerror(const char *format, ...) +{ + va_list arg; + va_start(arg, format); + vprintf(format, arg); + va_end(arg); +} + +enum { FORMAT_COUNT = ARRAY_LENGTH(floppy_formats) }; + +static floppy_image_format_t *formats[FORMAT_COUNT]; + +static void init_formats() +{ + for(int i=0; i != FORMAT_COUNT; i++) + formats[i] = floppy_formats[i](); +} + +static floppy_image_format_t *find_format_by_name(const char *name) +{ + for(int i=0; i != FORMAT_COUNT; i++) + if(!core_stricmp(name, formats[i]->name())) + return formats[i]; + return 0; +} + +static floppy_image_format_t *find_format_by_identify(io_generic *image) +{ + int best = 0; + floppy_image_format_t *best_fif = 0; + + for(int i = 0; i != FORMAT_COUNT; i++) { + floppy_image_format_t *fif = formats[i]; + int score = fif->identify(image, floppy_image::FF_UNKNOWN); + if(score > best) { + best = score; + best_fif = fif; + } + } + return best_fif; +} + +static void display_usage() +{ + fprintf(stderr, "Usage: \n"); + fprintf(stderr, " floptool.exe identify [ ...]\n"); + fprintf(stderr, " floptool.exe convert [input_format|auto] output_format \n"); +} + +static void display_formats() +{ + fprintf(stderr, "Supported formats:\n\n"); + for(int i = 0; i != FORMAT_COUNT; i++) + { + floppy_image_format_t *fif = formats[i]; + fprintf(stderr, "%15s - %s [%s]\n", fif->name(), fif->description(), fif->extensions()); + } +} + +static void display_full_usage() +{ + /* Usage */ + fprintf(stderr, "floptool - Generic floppy image manipulation tool for use with MESS\n\n"); + display_usage(); + fprintf(stderr, "\n"); + display_formats(); + fprintf(stderr, "\nExample usage:\n"); + fprintf(stderr, " floptool.exe identify image.dsk\n\n"); + +} + +static int identify(int argc, char *argv[]) +{ + if (argc<3) { + fprintf(stderr, "Missing name of file to identify.\n\n"); + display_usage(); + return 1; + } + + for(int i=2; idescription()); + else + printf("%s : Unknown format\n", argv[i]); + fclose(f); + } + return 0; +} + +static int convert(int argc, char *argv[]) +{ + if (argc!=6) { + fprintf(stderr, "Incorrect number of arguments.\n\n"); + display_usage(); + return 1; + } + + floppy_image_format_t *source_format, *dest_format; + + char msg[4096]; + sprintf(msg, "Error opening %s for reading", argv[4]); + FILE *f = fopen(argv[4], "rb"); + if (!f) { + perror(msg); + return 1; + } + io_generic source_io; + source_io.file = f; + source_io.procs = &stdio_ioprocs_noclose; + source_io.filler = 0xff; + + if(!core_stricmp(argv[2], "auto")) { + source_format = find_format_by_identify(&source_io); + if(!source_format) { + fprintf(stderr, "Error: Could not identify the format of file %s\n", argv[4]); + return 1; + } + + } else { + source_format = find_format_by_name(argv[2]); + if(!source_format) { + fprintf(stderr, "Error: Format '%s' unknown\n", argv[2]); + return 1; + } + } + + dest_format = find_format_by_name(argv[3]); + if(!dest_format) { + fprintf(stderr, "Error: Format '%s' unknown\n", argv[3]); + return 1; + } + if(!dest_format->supports_save()) { + fprintf(stderr, "Error: saving to format '%s' unsupported\n", argv[3]); + return 1; + } + + sprintf(msg, "Error opening %s for writing", argv[5]); + f = fopen(argv[5], "wb"); + if (!f) { + perror(msg); + return 1; + } + io_generic dest_io; + dest_io.file = f; + dest_io.procs = &stdio_ioprocs_noclose; + dest_io.filler = 0xff; + + floppy_image image(84, 2, floppy_image::FF_UNKNOWN); + if(!source_format->load(&source_io, floppy_image::FF_UNKNOWN, &image)) { + fprintf(stderr, "Error: parsing input file as '%s' failed\n", source_format->name()); + return 1; + } + + if(!dest_format->save(&dest_io, &image)) { + fprintf(stderr, "Error: writing output file as '%s' failed\n", dest_format->name()); + return 1; + } + + fclose((FILE *)source_io.file); + fclose((FILE *)dest_io.file); + + return 0; +} + +int CLIB_DECL main(int argc, char *argv[]) +{ + init_formats(); + + if (argc == 1) { + display_full_usage(); + return 0; + } + + if (!core_stricmp("identify", argv[1])) + return identify(argc, argv); + else if (!core_stricmp("convert", argv[1])) + return convert(argc, argv); + else { + fprintf(stderr, "Unknown command '%s'\n\n", argv[1]); + display_usage(); + return 1; + } +} diff --git a/src/mame/tools/imgtool/charconv.c b/src/mame/tools/imgtool/charconv.c new file mode 100644 index 00000000000..39b5953d799 --- /dev/null +++ b/src/mame/tools/imgtool/charconv.c @@ -0,0 +1,162 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + charconv.c + + Imgtool character set conversion routines. + +***************************************************************************/ + +#include "corestr.h" +#include "charconv.h" + + +/*------------------------------------------------- + utf8_from_latin1 - convert an ISO-8859-1 + character sequence to an UTF-8 string +-------------------------------------------------*/ + +static char *utf8_from_latin1(const char *src) +{ + char *buffer, *bufptr; + + /* validate input */ + if (!src) + { + return NULL; + } + + /* allocate space for result, twice the source len to be safe */ + buffer = (char *) osd_malloc(strlen(src) * 2 + 1); + + /* point to the start */ + bufptr = buffer; + + do + { + unsigned char c = *src; + + if (c < 0x80) + { + *bufptr++ = c; + } + else if (c < 0xc0) + { + *bufptr++ = '\xc2'; + *bufptr++ = c; + } + else + { + *bufptr++ = '\xc3'; + *bufptr++ = c - 0x40; + } + } while (*src++); + + return buffer; +} + + +/*------------------------------------------------- + latin1_from_utf8 - convert an UTF-8 + character sequence to an ISO-8859-1 string +-------------------------------------------------*/ + +static char *latin1_from_utf8(const char *src) +{ + char *buffer, *bufptr; + + /* validate input */ + if (!src) + { + return NULL; + } + + /* allocate space for result */ + buffer = (char *) osd_malloc(strlen(src) + 1); + + /* point to the start */ + bufptr = buffer; + + do + { + unsigned char c = *src; + + if (c < 0x80) + { + *bufptr++ = c; + } + else if (c == 0xc2) + { + c = *++src; + *bufptr++ = c; + } + else if (c == 0xc3) + { + c = *++src; + *bufptr++ = c + 0x40; + } + else + { + /* conversion failed */ + *bufptr++ = '\0'; + break; + } + } while(*src++); + + return buffer; +} + + +/*------------------------------------------------- + utf8_from_native - convert specified character + sequence to an UTF-8 string +-------------------------------------------------*/ + +char *utf8_from_native(imgtool_charset charset, const char *src) +{ + char *result; + + switch (charset) + { + case IMGTOOL_CHARSET_UTF8: + result = core_strdup(src); + break; + + case IMGTOOL_CHARSET_ISO_8859_1: + result = utf8_from_latin1(src); + break; + + default: + result = NULL; + break; + } + return result; +} + + +/*------------------------------------------------- + native_from_utf8 - convert an UTF-8 string + to specified character set +-------------------------------------------------*/ + +char *native_from_utf8(imgtool_charset charset, const char *src) +{ + char *result; + + switch (charset) + { + case IMGTOOL_CHARSET_UTF8: + result = core_strdup(src); + break; + + case IMGTOOL_CHARSET_ISO_8859_1: + result = latin1_from_utf8(src); + break; + + default: + result = NULL; + break; + } + return result; +} diff --git a/src/mame/tools/imgtool/charconv.h b/src/mame/tools/imgtool/charconv.h new file mode 100644 index 00000000000..1544e9df402 --- /dev/null +++ b/src/mame/tools/imgtool/charconv.h @@ -0,0 +1,31 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + charconv.h + + Imgtool character set conversion routines. + +***************************************************************************/ + + +#ifndef __CHARCONV_H__ +#define __CHARCONV_H__ + + +/* Supported character sets */ +enum imgtool_charset +{ + IMGTOOL_CHARSET_UTF8, + IMGTOOL_CHARSET_ISO_8859_1, +}; + + +/* Convert specified charset to UTF-8 */ +char *utf8_from_native(imgtool_charset charset, const char *src); + +/* Convert UTF-8 string to specified charset */ +char *native_from_utf8(imgtool_charset charset, const char *src); + + +#endif /* __CHARCONV_H__ */ diff --git a/src/mame/tools/imgtool/filtbas.c b/src/mame/tools/imgtool/filtbas.c new file mode 100644 index 00000000000..bff1bda121e --- /dev/null +++ b/src/mame/tools/imgtool/filtbas.c @@ -0,0 +1,3115 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/**************************************************************************** + + filtbas.c + + Filter for Microsoft-style tokenized BASIC files + + BASIC files typically follow the following format: + + int8 $ff + int16 + ... + int16 + int16 + int8[] + int8 $00 End of line delimiter + +*****************************************************************************/ + +#include +#include +#include + +#include "imgtool.h" +#include "formats/imageutl.h" + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define EOLN (CRLF == 1 ? "\r" : (CRLF == 2 ? "\n" : (CRLF == 3 ? "\r\n" : NULL))) + + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +struct basictoken_tableent +{ + UINT8 shift; + UINT8 base; + const char *const *tokens; + int num_tokens; +}; + + + +struct basictokens +{ + UINT16 baseaddress; + unsigned int skip_bytes : 15; + unsigned int be : 1; + const basictoken_tableent *entries; + int num_entries; +}; + + + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +/*------------------------------------------------- + basic_readfile - reads a file and decodes + BASIC tokens into ASCII text +-------------------------------------------------*/ + +static imgtoolerr_t basic_readfile(const basictokens *tokens, + imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t err; + imgtool_stream *mem_stream; + UINT8 line_header[4]; + UINT16 line_number; //, address; + UINT8 b, shift; + int i; + int in_string = FALSE; + const basictoken_tableent *token_table; + const char *token; + + /* open a memory stream */ + mem_stream = stream_open_mem(NULL, 0); + if (mem_stream == NULL) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + /* read actual file */ + err = imgtool_partition_read_file(partition, filename, fork, mem_stream, NULL); + if (err) + goto done; + + /* skip first few bytes */ + stream_seek(mem_stream, tokens->skip_bytes, SEEK_SET); + + /* keep reading line headers */ + while(stream_read(mem_stream, line_header, sizeof(line_header)) == sizeof(line_header)) + { + /* pluck the address and line number out */ + if (tokens->be) + { + //address = (UINT16) + pick_integer_be(line_header, 0, 2); + line_number = (UINT16) pick_integer_be(line_header, 2, 2); + } + else + { + //address = (UINT16) + pick_integer_le(line_header, 0, 2); + line_number = (UINT16) pick_integer_le(line_header, 2, 2); + } + + /* write the line number */ + stream_printf(destf, "%u ", (unsigned) line_number); + shift = 0x00; + + while((stream_read(mem_stream, &b, 1) > 0) && (b != 0x00)) + { + if (b == 0x22) + in_string = in_string ? FALSE : TRUE; + + if ((b & 0x80) && (!in_string)) + { + token = NULL; + + for (i = 0; i < tokens->num_entries; i++) + { + token_table = &tokens->entries[i]; + if (token_table->shift == shift) + { + if ((b - 0x80) < token_table->num_tokens) + { + token = token_table->tokens[b - 0x80]; + if (token) + shift = 0x00; + } + } + + if (token_table->shift == b) + { + shift = token_table->shift; + break; + } + } + + if (shift == 0x00) + stream_puts(destf, token ? token : "!"); + } + else + { + stream_putc(destf, (char) b); + } + } + + stream_puts(destf, EOLN); + } + +done: + if (mem_stream != NULL) + stream_close(mem_stream); + return err; +} + + + +/*------------------------------------------------- + basic_writefile - translates ASCII text to + BASIC tokens and writes it to a file +-------------------------------------------------*/ + +static imgtoolerr_t basic_writefile(const basictokens *tokens, + imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtoolerr_t err; + imgtool_stream *mem_stream; + char buf[1024]; + int eof = FALSE; + UINT32 len; + char c; + int i, j, pos, in_quotes; + UINT16 line_number; + UINT8 line_header[4]; + UINT8 file_header[3]; + const basictoken_tableent *token_table; + const char *token; + UINT8 token_shift, token_value; + UINT16 address; + + /* open a memory stream */ + mem_stream = stream_open_mem(NULL, 0); + if (mem_stream == NULL) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + /* skip first few bytes */ + stream_fill(mem_stream, 0x00, tokens->skip_bytes); + + /* loop until the file is complete */ + while(!eof) + { + /* read a line */ + pos = 0; + while((len = stream_read(sourcef, &c, 1)) > 0) + { + /* break if at end of line */ + if ((c == '\r') || (c == '\n')) + break; + + if (pos <= ARRAY_LENGTH(buf) - 1) + { + buf[pos++] = c; + } + } + eof = (len == 0); + buf[pos] = '\0'; + + /* ignore lines that don't start with digits */ + if (isdigit(buf[0])) + { + /* start at beginning of line */ + pos = 0; + + /* read line number */ + line_number = 0; + while(isdigit(buf[pos])) + { + line_number *= 10; + line_number += (buf[pos++] - '0'); + } + + /* determine address */ + if (tokens->baseaddress != 0) + { + address = tokens->baseaddress + (UINT16)stream_size(mem_stream) + 4; + } + else + { + address = 0x0000; + } + + /* set up line header */ + memset(&line_header, 0, sizeof(line_header)); + if (tokens->be) + { + place_integer_be(line_header, 0, 2, address); + place_integer_be(line_header, 2, 2, line_number); + } + else + { + place_integer_be(line_header, 0, 2, address); + place_integer_be(line_header, 2, 2, line_number); + } + + /* emit line header */ + stream_write(mem_stream, line_header, sizeof(line_header)); + + /* skip spaces */ + while(isspace(buf[pos])) + pos++; + + /* when we start out, we are not within quotation marks */ + in_quotes = FALSE; + + /* read until end of line */ + while(buf[pos] != '\0') + { + token = NULL; + token_shift = 0; + token_value = 0; + + if (buf[pos] == '\"') + { + /* flip quotation status */ + in_quotes = !in_quotes; + } + else if (!in_quotes) + { + for (i = 0; (token == NULL) && (i < tokens->num_entries); i++) + { + token_table = &tokens->entries[i]; + for (j = 0; (token == NULL) && (j < token_table->num_tokens); j++) + { + if (!strncmp(&buf[pos], token_table->tokens[j], strlen(token_table->tokens[j]))) + { + token = token_table->tokens[j]; + token_shift = token_table->shift; + token_value = token_table->base + j; + pos += strlen(token); + } + } + } + } + + /* did we find a token? */ + if (token != NULL) + { + /* emit the token */ + if (token_shift != 0) + stream_write(mem_stream, &token_shift, 1); + stream_write(mem_stream, &token_value, 1); + } + else + { + /* no token; emit the byte */ + stream_write(mem_stream, &buf[pos++], 1); + } + } + + /* emit line terminator */ + stream_fill(mem_stream, 0x00, 1); + } + } + + /* emit program terminator */ + stream_fill(mem_stream, 0x00, 2); + + /* reset stream */ + stream_seek(mem_stream, 0, SEEK_SET); + + /* this is somewhat gross */ + if (tokens->skip_bytes >= 3) + { + if (tokens->be) + { + place_integer_be(file_header, 0, 1, 0xFF); + place_integer_be(file_header, 1, 2, stream_size(mem_stream)); + } + else + { + place_integer_le(file_header, 0, 1, 0xFF); + place_integer_le(file_header, 1, 2, stream_size(mem_stream)); + } + stream_write(mem_stream, file_header, 3); + stream_seek(mem_stream, 0, SEEK_SET); + } + + /* write actual file */ + err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL); + if (err) + goto done; + +done: + if (mem_stream != NULL) + stream_close(mem_stream); + return err; +} + + + +/*************************************************************************** + TOKEN DEFINITIONS +***************************************************************************/ + +static const char *const cocobas_statements[] = +{ + "FOR", /* 0x80 */ + "GO", /* 0x81 */ + "REM", /* 0x82 */ + "'", /* 0x83 */ + "ELSE", /* 0x84 */ + "IF", /* 0x85 */ + "DATA", /* 0x86 */ + "PRINT", /* 0x87 */ + "ON", /* 0x88 */ + "INPUT", /* 0x89 */ + "END", /* 0x8a */ + "NEXT", /* 0x8b */ + "DIM", /* 0x8c */ + "READ", /* 0x8d */ + "RUN", /* 0x8e */ + "RESTORE", /* 0x8f */ + "RETURN", /* 0x90 */ + "STOP", /* 0x91 */ + "POKE", /* 0x92 */ + "CONT", /* 0x93 */ + "LIST", /* 0x94 */ + "CLEAR", /* 0x95 */ + "NEW", /* 0x96 */ + "CLOAD", /* 0x97 */ + "CSAVE", /* 0x98 */ + "OPEN", /* 0x99 */ + "CLOSE", /* 0x9a */ + "LLIST", /* 0x9b */ + "SET", /* 0x9c */ + "RESET", /* 0x9d */ + "CLS", /* 0x9e */ + "MOTOR", /* 0x9f */ + "SOUND", /* 0xa0 */ + "AUDIO", /* 0xa1 */ + "EXEC", /* 0xa2 */ + "SKIPF", /* 0xa3 */ + "TAB(", /* 0xa4 */ + "TO", /* 0xa5 */ + "SUB", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "OFF", /* 0xaa */ + "+", /* 0xab */ + "-", /* 0xac */ + "*", /* 0xad */ + "/", /* 0xae */ + "^", /* 0xaf */ + "AND", /* 0xb0 */ + "OR", /* 0xb1 */ + ">", /* 0xb2 */ + "=", /* 0xb3 */ + "<", /* 0xb4 */ + "DEL", /* 0xb5 */ + "EDIT", /* 0xb6 */ + "TRON", /* 0xb7 */ + "TROFF", /* 0xb8 */ + "DEF", /* 0xb9 */ + "LET", /* 0xba */ + "LINE", /* 0xbb */ + "PCLS", /* 0xbc */ + "PSET", /* 0xbd */ + "PRESET", /* 0xbe */ + "SCREEN", /* 0xbf */ + "PCLEAR", /* 0xc0 */ + "COLOR", /* 0xc1 */ + "CIRCLE", /* 0xc2 */ + "PAINT", /* 0xc3 */ + "GET", /* 0xc4 */ + "PUT", /* 0xc5 */ + "DRAW", /* 0xc6 */ + "PCOPY", /* 0xc7 */ + "PMODE", /* 0xc8 */ + "PLAY", /* 0xc9 */ + "DLOAD", /* 0xca */ + "RENUM", /* 0xcb */ + "FN", /* 0xcc */ + "USING", /* 0xcd */ + "DIR", /* 0xce */ + "DRIVE", /* 0xcf */ + "FIELD", /* 0xd0 */ + "FILES", /* 0xd1 */ + "KILL", /* 0xd2 */ + "LOAD", /* 0xd3 */ + "LSET", /* 0xd4 */ + "MERGE", /* 0xd5 */ + "RENAME", /* 0xd6 */ + "RSET", /* 0xd7 */ + "SAVE", /* 0xd8 */ + "WRITE", /* 0xd9 */ + "VERIFY", /* 0xda */ + "UNLOAD", /* 0xdb */ + "DSKINI", /* 0xdc */ + "BACKUP", /* 0xdd */ + "COPY", /* 0xde */ + "DSKI$", /* 0xdf */ + "DSKO$", /* 0xe0 */ + "DOS", /* 0xe1 */ + "WIDTH", /* 0xe2 */ + "PALETTE", /* 0xe3 */ + "HSCREEN", /* 0xe4 */ + "LPOKE", /* 0xe5 */ + "HCLS", /* 0xe6 */ + "HCOLOR", /* 0xe7 */ + "HPAINT", /* 0xe8 */ + "HCIRCLE", /* 0xe9 */ + "HLINE", /* 0xea */ + "HGET", /* 0xeb */ + "HPUT", /* 0xec */ + "HBUFF", /* 0xed */ + "HPRINT", /* 0xee */ + "ERR", /* 0xef */ + "BRK", /* 0xf0 */ + "LOCATE", /* 0xf1 */ + "HSTAT", /* 0xf2 */ + "HSET", /* 0xf3 */ + "HRESET", /* 0xf4 */ + "HDRAW", /* 0xf5 */ + "CMP", /* 0xf6 */ + "RGB", /* 0xf7 */ + "ATTR" /* 0xf8 */ +}; + +static const char *const cocobas_functions[] = +{ + "SGN", /* 0xff80 */ + "INT", /* 0xff81 */ + "ABS", /* 0xff82 */ + "USR", /* 0xff83 */ + "RND", /* 0xff84 */ + "SIN", /* 0xff85 */ + "PEEK", /* 0xff86 */ + "LEN", /* 0xff87 */ + "STR$", /* 0xff88 */ + "VAL", /* 0xff89 */ + "ASC", /* 0xff8a */ + "CHR$", /* 0xff8b */ + "EOF", /* 0xff8c */ + "JOYSTK", /* 0xff8d */ + "LEFT$", /* 0xff8e */ + "RIGHT$", /* 0xff8f */ + "MID$", /* 0xff90 */ + "POINT", /* 0xff91 */ + "INKEY$", /* 0xff92 */ + "MEM", /* 0xff93 */ + "ATN", /* 0xff94 */ + "COS", /* 0xff95 */ + "TAN", /* 0xff96 */ + "EXP", /* 0xff97 */ + "FIX", /* 0xff98 */ + "LOG", /* 0xff99 */ + "POS", /* 0xff9a */ + "SQR", /* 0xff9b */ + "HEX$", /* 0xff9c */ + "VARPTR", /* 0xff9d */ + "INSTR", /* 0xff9e */ + "TIMER", /* 0xff9f */ + "PPOINT", /* 0xffa0 */ + "STRING$", /* 0xffa1 */ + "CVN", /* 0xffa2 */ + "FREE", /* 0xffa3 */ + "LOC", /* 0xffa4 */ + "LOF", /* 0xffa5 */ + "MKN$", /* 0xffa6 */ + "AS", /* 0xffa7 */ + "LPEEK", /* 0xffa8 */ + "BUTTON", /* 0xffa9 */ + "HPOINT", /* 0xffaa */ + "ERNO", /* 0xffab */ + "ERLIN" /* 0xffac */ +}; + +static const char *const dragonbas_statements[] = +{ + "FOR", /* 0x80 */ + "GO", /* 0x81 */ + "REM", /* 0x82 */ + "'", /* 0x83 */ + "ELSE", /* 0x84 */ + "IF", /* 0x85 */ + "DATA", /* 0x86 */ + "PRINT", /* 0x87 */ + "ON", /* 0x88 */ + "INPUT", /* 0x89 */ + "END", /* 0x8a */ + "NEXT", /* 0x8b */ + "DIM", /* 0x8c */ + "READ", /* 0x8d */ + "LET", /* 0x8e */ + "RUN", /* 0x8f */ + "RESTORE", /* 0x90 */ + "RETURN", /* 0x91 */ + "STOP", /* 0x92 */ + "POKE", /* 0x93 */ + "CONT", /* 0x94 */ + "LIST", /* 0x95 */ + "CLEAR", /* 0x96 */ + "NEW", /* 0x97 */ + "DEF", /* 0x98 */ + "CLOAD", /* 0x99 */ + "CSAVE", /* 0x9a */ + "OPEN", /* 0x9b */ + "CLOSE", /* 0x9c */ + "LLIST", /* 0x9d */ + "SET", /* 0x9e */ + "RESET", /* 0x9f */ + "CLS", /* 0xa0 */ + "MOTOR", /* 0xa1 */ + "SOUND", /* 0xa2 */ + "AUDIO", /* 0xa3 */ + "EXEC", /* 0xa4 */ + "SKIPF", /* 0xa5 */ + "DEL", /* 0xa6 */ + "EDIT", /* 0xa7 */ + "TRON", /* 0xa8 */ + "TROFF", /* 0xa9 */ + "LINE", /* 0xaa */ + "PCLS", /* 0xab */ + "PSET", /* 0xac */ + "PRESET", /* 0xad */ + "SCREEN", /* 0xae */ + "PCLEAR", /* 0xaf */ + "COLOR", /* 0xb0 */ + "CIRCLE", /* 0xb1 */ + "PAINT", /* 0xb2 */ + "GET", /* 0xb3 */ + "PUT", /* 0xb4 */ + "DRAW", /* 0xb5 */ + "PCOPY", /* 0xb6 */ + "PMODE", /* 0xb7 */ + "PLAY", /* 0xb8 */ + "DLOAD", /* 0xb9 */ + "RENUM", /* 0xba */ + "TAB(", /* 0xbb */ + "TO", /* 0xbc */ + "SUB", /* 0xbd */ + "FN", /* 0xbe */ + "THEN", /* 0xbf */ + "NOT", /* 0xc0 */ + "STEP", /* 0xc1 */ + "OFF", /* 0xc2 */ + "+", /* 0xc3 */ + "-", /* 0xc4 */ + "*", /* 0xc5 */ + "/", /* 0xc6 */ + "^", /* 0xc7 */ + "AND", /* 0xc8 */ + "OR", /* 0xc9 */ + ">", /* 0xca */ + "=", /* 0xcb */ + "<", /* 0xcc */ + "USING", /* 0xcd */ + "DIR", /* 0xce */ + "DRIVE", /* 0xcf */ + "FIELD", /* 0xd0 */ + "FILES", /* 0xd1 */ + "KILL", /* 0xd2 */ + "LOAD", /* 0xd3 */ + "LSET", /* 0xd4 */ + "MERGE", /* 0xd5 */ + "RENAME", /* 0xd6 */ + "RSET", /* 0xd7 */ + "SAVE", /* 0xd8 */ + "WRITE", /* 0xd9 */ + "VERIFY", /* 0xda */ + "UNLOAD", /* 0xdb */ + "DSKINI", /* 0xdc */ + "BACKUP", /* 0xdd */ + "COPY", /* 0xde */ + "DSKI$", /* 0xdf */ + "DSKO$" /* 0xe0 */ +}; + +static const char *const dragonbas_functions[] = +{ + "SGN", /* 0xff80 */ + "INT", /* 0xff81 */ + "ABS", /* 0xff82 */ + "POS", /* 0xff83 */ + "RND", /* 0xff84 */ + "SQR", /* 0xff85 */ + "LOG", /* 0xff86 */ + "EXP", /* 0xff87 */ + "SIN", /* 0xff88 */ + "COS", /* 0xff89 */ + "TAN", /* 0xff8a */ + "ATN", /* 0xff8b */ + "PEEK", /* 0xff8c */ + "LEN", /* 0xff8d */ + "STR$", /* 0xff8e */ + "VAL", /* 0xff8f */ + "ASC", /* 0xff90 */ + "CHR$", /* 0xff91 */ + "EOF", /* 0xff92 */ + "JOYSTK", /* 0xff93 */ + "FIX", /* 0xff94 */ + "HEX$", /* 0xff95 */ + "LEFT$", /* 0xff96 */ + "RIGHT$", /* 0xff97 */ + "MID$", /* 0xff98 */ + "POINT", /* 0xff99 */ + "INKEY$", /* 0xff9a */ + "MEM", /* 0xff9b */ + "VARPTR", /* 0xff9c */ + "INSTR", /* 0xff9d */ + "TIMER", /* 0xff9e */ + "PPOINT", /* 0xff9f */ + "STRING$", /* 0xffa0 */ + "USR" /* 0xffa1 */ + "CVN", /* 0xffa2 */ + "FREE", /* 0xffa3 */ + "LOC", /* 0xffa4 */ + "LOF", /* 0xffa5 */ + "MKN$" /* 0xffa6 */ +}; + +static const char *const vzbas[] = +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "RESET", /* 0x82 */ + "SET", /* 0x83 */ + "CLS", /* 0x84 */ + NULL, /* 0x85 */ + "RANDOM", /* 0x86 */ + "NEXT", /* 0x87 */ + "DATA", /* 0x88 */ + "INPUT", /* 0x89 */ + "DIM", /* 0x8a */ + "READ", /* 0x8b */ + "LET", /* 0x8c */ + "GOTO", /* 0x8d */ + "RUN", /* 0x8e */ + "IF", /* 0x8f */ + "RESTORE", /* 0x90 */ + "GOSUB", /* 0x91 */ + "RETURN", /* 0x92 */ + "'", /* 0x93 */ + "STOP", /* 0x94 */ + "ELSE", /* 0x95 */ + "COPY", /* 0x96 */ + "COLOR", /* 0x97 */ + "VERIFY", /* 0x98 */ + "DEFINT", /* 0x99 */ + "DEFSNG", /* 0x9a */ + "DEFDBL", /* 0x9b */ + "CRUN", /* 0x9c */ + "MODE", /* 0x9d */ + "ERROR", /* 0x9e */ + "RESUME", /* 0x9f */ + "OUT", /* 0xa0 */ + "IN", /* 0xa1 */ + NULL, /* 0xa2 */ + NULL, /* 0xa3 */ + NULL, /* 0xa4 */ + NULL, /* 0xa5 */ + NULL, /* 0xa6 */ + NULL, /* 0xa7 */ + NULL, /* 0xa8 */ + NULL, /* 0xa9 */ + NULL, /* 0xaa */ + NULL, /* 0xab */ + NULL, /* 0xac */ + NULL, /* 0xad */ + "(RESET)", /* 0xae */ + "LPRINT", /* 0xaf */ + NULL, /* 0xb0 */ + "POKE", /* 0xb1 */ + "PRINT", /* 0xb2 */ + "CONT", /* 0xb3 */ + "LIST", /* 0xb4 */ + "LLIST", /* 0xb5 */ + "DELETE", /* 0xb6 */ + "AUTO", /* 0xb7 */ + "CLEAR", /* 0xb8 */ + "CLOAD", /* 0xb9 */ + "CSAVE", /* 0xba */ + "NEW", /* 0xbb */ + "TAB(", /* 0xbc */ + "TO", /* 0xbd */ + NULL, /* 0xbe */ + "USING", /* 0xbf */ + "VARPTR", /* 0xc0 */ + "USR", /* 0xc1 */ + "ERL", /* 0xc2 */ + "ERR", /* 0xc3 */ + "STRING$", /* 0xc4 */ + NULL, /* 0xc5 */ + "POINT", /* 0xc6 */ + NULL, /* 0xc7 */ + "MEM", /* 0xc8 */ + "INKEY$", /* 0xc9 */ + "THEN", /* 0xca */ + "NOT", /* 0xcb */ + "STEP", /* 0xcc */ + "+", /* 0xcd */ + "-", /* 0xce */ + "*", /* 0xcf */ + "/", /* 0xd0 */ + "^", /* 0xd1 */ + "AND", /* 0xd2 */ + "OR", /* 0xd3 */ + ">", /* 0xd4 */ + "=", /* 0xd5 */ + "<", /* 0xd6 */ + "SGN", /* 0xd7 */ + "INT", /* 0xd8 */ + "ABS", /* 0xd9 */ + "FRE", /* 0xda */ + "INP", /* 0xdb */ + "POS", /* 0xdc */ + "SQR", /* 0xdd */ + "AND", /* 0xde */ + "LOG", /* 0xdf */ + "EXP", /* 0xe0 */ + "COS", /* 0xe1 */ + "SIN", /* 0xe2 */ + "TAN", /* 0xe3 */ + "ATN", /* 0xe4 */ + "PEEK", /* 0xe5 */ + NULL, /* 0xe6 */ + NULL, /* 0xe7 */ + NULL, /* 0xe8 */ + NULL, /* 0xe9 */ + NULL, /* 0xea */ + NULL, /* 0xeb */ + NULL, /* 0xec */ + NULL, /* 0xed */ + NULL, /* 0xee */ + "CINT", /* 0xef */ + "CSNG", /* 0xf0 */ + "CDBL", /* 0xf1 */ + "FIX", /* 0xf2 */ + "LEN", /* 0xf3 */ + "STR$", /* 0xf4 */ + "VAL", /* 0xf5 */ + "ASC", /* 0xf6 */ + "CHR$", /* 0xf7 */ + "LEFT$", /* 0xf8 */ + "RIGHT$", /* 0xf9 */ + "MID$", /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + NULL /* 0xff */ +}; + +static const char *const bml3bas_statements[] = +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "DIM", /* 0x84 */ + "READ", /* 0x85 */ + "LET", /* 0x86 */ + "GO", /* 0x87 */ + "RUN", /* 0x88 */ + "IF", /* 0x89 */ + "RESTORE", /* 0x8a */ + "RETURN", /* 0x8b */ + "REM", /* 0x8c */ + "'", /* 0x8d */ + "STOP", /* 0x8e */ + "ELSE", /* 0x8f */ + "TRON", /* 0x90 */ + "TROFF", /* 0x91 */ + "SWAP", /* 0x92 */ + "DEFSTR", /* 0x93 */ + "DEFINT", /* 0x94 */ + "DEFSNG", /* 0x95 */ + "DEFDBL", /* 0x96 */ + "ON", /* 0x97 */ + "WAIT", /* 0x98 */ + "RENUM", /* 0x99 */ + "EDIT", /* 0x9a */ + "ERROR", /* 0x9b */ + "RESUME", /* 0x9c */ + "AUTO", /* 0x9d */ + "DELETE", /* 0x9e */ + "TERM", /* 0x9f */ + "WIDTH", /* 0xa0 */ + "UNLIST", /* 0xa1 */ + "MON", /* 0xa2 */ + "LOCATE", /* 0xa3 */ + "CLS", /* 0xa4 */ + "CONSOLE", /* 0xa5 */ + "PSET", /* 0xa6 */ + "PRESET", /* 0xa7 */ + "MOTOR", /* 0xa8 */ + "SKIPF", /* 0xa9 */ + "SAVE", /* 0xaa */ + "LOAD", /* 0xab */ + "MERGE", /* 0xac */ + "EXEC", /* 0xad */ + "OPEN", /* 0xae */ + "CLOSE", /* 0xaf */ + "FILES", /* 0xb0 */ + "COM", /* 0xb1 */ + "KEY", /* 0xb2 */ + "PAINT", /* 0xb3 */ + "BEEP", /* 0xb4 */ + "COLOR", /* 0xb5 */ + "LINE", /* 0xb6 */ + "DEF", /* 0xb7 */ + "POKE", /* 0xb8 */ + "PRINT", /* 0xb9 */ + "CONT", /* 0xba */ + "LIST", /* 0xbb */ + "CLEAR", /* 0xbc */ + "RANDOMIZE",/* 0xbd */ + "WHILE", /* 0xbe */ + "WEND", /* 0xbf */ + "NEW", /* 0xc0 */ + "TAB(", /* 0xc1 */ + "TO", /* 0xc2 */ + "SUB", /* 0xc3 */ + "FN", /* 0xc4 */ + "SPC(", /* 0xc5 */ + "USING", /* 0xc6 */ + "USR", /* 0xc7 */ + "ERL", /* 0xc8 */ + "ERR", /* 0xc9 */ + "OFF", /* 0xca */ + "THEN", /* 0xcb */ + "NOT", /* 0xcc */ + "STEP", /* 0xcd */ + "+", /* 0xce */ + "-", /* 0xcf */ + "*", /* 0xd0 */ + "/", /* 0xd1 */ + "^", /* 0xd2 */ + "AND", /* 0xd3 */ + "OR", /* 0xd4 */ + "XOR", /* 0xd5 */ + "EQV", /* 0xd6 */ + "IMP", /* 0xd7 */ + "MOD", /* 0xd8 */ + "\\", /* 0xd9 */ + ">", /* 0xda */ + "=", /* 0xdb */ + "<" /* 0xdc */ +}; + +static const char *const bml3bas_functions[] = +{ + "SGN", /* 0xff80 */ + "INT", /* 0xff81 */ + "ABS", /* 0xff82 */ + "FRE", /* 0xff83 */ + "POS", /* 0xff84 */ + "SQR", /* 0xff85 */ + "LOG", /* 0xff86 */ + "EXP", /* 0xff87 */ + "COS", /* 0xff88 */ + "SIN", /* 0xff89 */ + "TAN", /* 0xff8a */ + "ATN", /* 0xff8b */ + "PEEK", /* 0xff8c */ + "LEN", /* 0xff8d */ + "STR$", /* 0xff8e */ + "VAL", /* 0xff8f */ + "ASC", /* 0xff90 */ + "CHR$", /* 0xff91 */ + "CINT", /* 0xff92 */ + "CSNG", /* 0xff93 */ + "CDBL", /* 0xff94 */ + "FIX", /* 0xff95 */ + "SPACE$", /* 0xff96 */ + "HEX$", /* 0xff97 */ + "OCT$", /* 0xff98 */ + "LOF", /* 0xff99 */ + "EOF", /* 0xff9a */ + "PEN", /* 0xff9b */ + "LEFT$", /* 0xff9c */ + "RIGHT$", /* 0xff9d */ + "MID$", /* 0xff9e */ + "INSTR", /* 0xff9f */ + "SCREEN", /* 0xffa0 */ + "VARPTR", /* 0xffa1 */ + "STRING$", /* 0xffa2 */ + "RND", /* 0xffa3 */ + "INKEY$", /* 0xffa4 */ + "INPUT", /* 0xffa5 */ + "CSRLIN", /* 0xffa6 */ + "POINT", /* 0xffa7 */ + "TIME", /* 0xffa8 */ + "DATE" /* 0xffa9 */ +}; + + +#ifdef BASIC_ +/* ----------------------------------------------------------------------- * + * CBM machines * + * ----------------------------------------------------------------------- */ +static const char *const basic_10[] = /* "BASIC 1.0" - supported by pet */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + NULL, /* 0xcb */ + NULL, /* 0xcc */ + NULL, /* 0xcd */ + NULL, /* 0xce */ + NULL, /* 0xcf */ + NULL, /* 0xd0 */ + NULL, /* 0xd1 */ + NULL, /* 0xd2 */ + NULL, /* 0xd3 */ + NULL, /* 0xd4 */ + NULL, /* 0xd5 */ + NULL, /* 0xd6 */ + NULL, /* 0xd7 */ + NULL, /* 0xd8 */ + NULL, /* 0xd9 */ + NULL, /* 0xda */ + NULL, /* 0xdb */ + NULL, /* 0xdc */ + NULL, /* 0xdd */ + NULL, /* 0xde */ + NULL, /* 0xdf */ + NULL, /* 0xe0 */ + NULL, /* 0xe1 */ + NULL, /* 0xe2 */ + NULL, /* 0xe3 */ + NULL, /* 0xe4 */ + NULL, /* 0xe5 */ + NULL, /* 0xe6 */ + NULL, /* 0xe7 */ + NULL, /* 0xe8 */ + NULL, /* 0xe9 */ + NULL, /* 0xea */ + NULL, /* 0xeb */ + NULL, /* 0xec */ + NULL, /* 0xed */ + NULL, /* 0xee */ + NULL, /* 0xef */ + NULL, /* 0xf0 */ + NULL, /* 0xf1 */ + NULL, /* 0xf2 */ + NULL, /* 0xf3 */ + NULL, /* 0xf4 */ + NULL, /* 0xf5 */ + NULL, /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_20[] = /* "BASIC 2.0" - supported by vic20 & clones, c64 & clones, cbm30xx series */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + NULL, /* 0xcc */ + NULL, /* 0xcd */ + NULL, /* 0xce */ + NULL, /* 0xcf */ + NULL, /* 0xd0 */ + NULL, /* 0xd1 */ + NULL, /* 0xd2 */ + NULL, /* 0xd3 */ + NULL, /* 0xd4 */ + NULL, /* 0xd5 */ + NULL, /* 0xd6 */ + NULL, /* 0xd7 */ + NULL, /* 0xd8 */ + NULL, /* 0xd9 */ + NULL, /* 0xda */ + NULL, /* 0xdb */ + NULL, /* 0xdc */ + NULL, /* 0xdd */ + NULL, /* 0xde */ + NULL, /* 0xdf */ + NULL, /* 0xe0 */ + NULL, /* 0xe1 */ + NULL, /* 0xe2 */ + NULL, /* 0xe3 */ + NULL, /* 0xe4 */ + NULL, /* 0xe5 */ + NULL, /* 0xe6 */ + NULL, /* 0xe7 */ + NULL, /* 0xe8 */ + NULL, /* 0xe9 */ + NULL, /* 0xea */ + NULL, /* 0xeb */ + NULL, /* 0xec */ + NULL, /* 0xed */ + NULL, /* 0xee */ + NULL, /* 0xef */ + NULL, /* 0xf0 */ + NULL, /* 0xf1 */ + NULL, /* 0xf2 */ + NULL, /* 0xf3 */ + NULL, /* 0xf4 */ + NULL, /* 0xf5 */ + NULL, /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_20_super_expander_vic[] = /* "BASIC 2.0 with Super Expander" - supported by vic20 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "KEY", /* 0xcc */ + "GRAPHIC", /* 0xcd */ + "SCNCLR", /* 0xce */ + "CIRCLE", /* 0xcf */ + "DRAW", /* 0xd0 */ + "REGION", /* 0xd1 */ + "COLOR", /* 0xd2 */ + "POINT", /* 0xd3 */ + "SOUND", /* 0xd4 */ + "CHAR", /* 0xd5 */ + "PAINT", /* 0xd6 */ + "RPOT", /* 0xd7 */ + "RPEN", /* 0xd8 */ + "RSND", /* 0xd9 */ + "RCOLR", /* 0xda */ + "RGR", /* 0xdb */ + "RJOY", /* 0xdc */ + "RDOT", /* 0xdd */ + NULL, /* 0xde */ + NULL, /* 0xdf */ + NULL, /* 0xe0 */ + NULL, /* 0xe1 */ + NULL, /* 0xe2 */ + NULL, /* 0xe3 */ + NULL, /* 0xe4 */ + NULL, /* 0xe5 */ + NULL, /* 0xe6 */ + NULL, /* 0xe7 */ + NULL, /* 0xe8 */ + NULL, /* 0xe9 */ + NULL, /* 0xea */ + NULL, /* 0xeb */ + NULL, /* 0xec */ + NULL, /* 0xed */ + NULL, /* 0xee */ + NULL, /* 0xef */ + NULL, /* 0xf0 */ + NULL, /* 0xf1 */ + NULL, /* 0xf2 */ + NULL, /* 0xf3 */ + NULL, /* 0xf4 */ + NULL, /* 0xf5 */ + NULL, /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_20_turtle_basic_10[] = /* "BASIC 2.0 with Turtle BASIC 1.0" - supported by vic20 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "GRAPHIC", /* 0xcc */ + "OLD", /* 0xcd */ + "TURN", /* 0xce */ + "PEN", /* 0xcf */ + "DRAW", /* 0xd0 */ + "MOVE", /* 0xd1 */ + "POINT", /* 0xd2 */ + "KILL", /* 0xd3 */ + "WRITE", /* 0xd4 */ + "REPEAT", /* 0xd5 */ + "SCREEN", /* 0xd6 */ + "DOKE", /* 0xd7 */ + "RELOC", /* 0xd8 */ + "FILL", /* 0xd9 */ + "RTIME", /* 0xda */ + "BASE", /* 0xdb */ + "PAUSE", /* 0xdc */ + "POP", /* 0xdd */ + "COLOR", /* 0xde */ + "MERGE", /* 0xdf */ + "CHAR", /* 0xe0 */ + "TAKE", /* 0xe1 */ + "SOUND", /* 0xe2 */ + "VOL", /* 0xe3 */ + "PUT", /* 0xe4 */ + "PLACE", /* 0xe5 */ + "CLS", /* 0xe6 */ + "ACCEPT", /* 0xe7 */ + "RESET", /* 0xe8 */ + "GRAB", /* 0xe9 */ + "RDOT", /* 0xea */ + "PLR$", /* 0xeb */ + "DEEK", /* 0xec */ + "JOY", /* 0xed */ + NULL, /* 0xee */ + NULL, /* 0xef */ + NULL, /* 0xf0 */ + NULL, /* 0xf1 */ + NULL, /* 0xf2 */ + NULL, /* 0xf3 */ + NULL, /* 0xf4 */ + NULL, /* 0xf5 */ + NULL, /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_20_speech_basic_27[] = /* "BASIC 2.0 with Speech BASIC 2.7" - supported by c64 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "RESET", /* 0xcc */ + "BASIC", /* 0xcd */ + "HELP", /* 0xce */ + "KEY", /* 0xcf */ + "HIMEM", /* 0xd0 */ + "DISK", /* 0xd1 */ + "DIR", /* 0xd2 */ + "BLOAD", /* 0xd3 */ + "BSAVE", /* 0xd4 */ + "MAP", /* 0xd5 */ + "MEM", /* 0xd6 */ + "PAUSE", /* 0xd7 */ + "BLOCK", /* 0xd8 */ + "HEAR", /* 0xd9 */ + "RECORD", /* 0xda */ + "PLAY", /* 0xdb */ + "VOLDEF", /* 0xdc */ + "COLDEF", /* 0xdd */ + "HEX", /* 0xde */ + "DEZ", /* 0xdf */ + "SCREEN", /* 0xe0 */ + "EXEC", /* 0xe1 */ + "MON", /* 0xe2 */ + "{LEFT ARROW}", /* 0xe3 - A single character shaped as a left pointing arrow */ + "FROM", /* 0xe4 */ + "SPEED", /* 0xe5 */ + "OFF", /* 0xe6 */ + NULL, /* 0xe7 */ + NULL, /* 0xe8 */ + NULL, /* 0xe9 */ + NULL, /* 0xea */ + NULL, /* 0xeb */ + NULL, /* 0xec */ + NULL, /* 0xed */ + NULL, /* 0xee */ + NULL, /* 0xef */ + NULL, /* 0xf0 */ + NULL, /* 0xf1 */ + NULL, /* 0xf2 */ + NULL, /* 0xf3 */ + NULL, /* 0xf4 */ + NULL, /* 0xf5 */ + NULL, /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_20_at_basic[] = /* "BASIC 2.0 with @BASIC" - supported by c64 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "TRACE", /* 0xcc */ + "DELETE", /* 0xcd */ + "AUTO", /* 0xce */ + "OLD", /* 0xcf */ + "DUMP", /* 0xd0 */ + "FIND", /* 0xd1 */ + "RENUMBER", /* 0xd2 */ + "DLOAD", /* 0xd3 */ + "DSAVE", /* 0xd4 */ + "DVERIFY", /* 0xd5 */ + "DIRECTORY" /* 0xd6 */ + "CATALOG", /* 0xd7 */ + "SCRATCH", /* 0xd8 */ + "COLLECT", /* 0xd9 */ + "RENAME", /* 0xda */ + "COPY", /* 0xdb */ + "BACKUP", /* 0xdc */ + "DISK", /* 0xdd */ + "HEADER", /* 0xde */ + "APPEND", /* 0xdf */ + "MERGE", /* 0xe0 */ + "MLOAD", /* 0xe1 */ + "MVERIFY", /* 0xe2 */ + "MSAVE", /* 0xe3 */ + "KEY", /* 0xe4 */ + "BASIC", /* 0xe5 */ + "RESET", /* 0xe6 */ + "EXIT", /* 0xe7 */ + "ENTER", /* 0xe8 */ + "DOKE", /* 0xe9 */ + "SET", /* 0xea */ + "HELP", /* 0xeb */ + "SCREEN", /* 0xec */ + "LOMEM", /* 0xed */ + "HIMEM", /* 0xee */ + "COLOUR", /* 0xef */ + "TYPE", /* 0xf0 */ + "TIME", /* 0xf1 */ + "DEEK", /* 0xf2 */ + "HEX$", /* 0xf3 */ + "BIN$", /* 0xf4 */ + "OFF", /* 0xf5 */ + "ALARM", /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_20_simon_s_basic[] = /* "BASIC 2.0 with Simon's BASIC" - supported by c64 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + NULL, /* 0xcc */ + NULL, /* 0xcd */ + NULL, /* 0xce */ + NULL, /* 0xcf */ + NULL, /* 0xd0 */ + NULL, /* 0xd1 */ + NULL, /* 0xd2 */ + NULL, /* 0xd3 */ + NULL, /* 0xd4 */ + NULL, /* 0xd5 */ + NULL, /* 0xd6 */ + NULL, /* 0xd7 */ + NULL, /* 0xd8 */ + NULL, /* 0xd9 */ + NULL, /* 0xda */ + NULL, /* 0xdb */ + NULL, /* 0xdc */ + NULL, /* 0xdd */ + NULL, /* 0xde */ + NULL, /* 0xdf */ + NULL, /* 0xe0 */ + NULL, /* 0xe1 */ + NULL, /* 0xe2 */ + NULL, /* 0xe3 */ + NULL, /* 0xe4 */ + NULL, /* 0xe5 */ + NULL, /* 0xe6 */ + NULL, /* 0xe7 */ + NULL, /* 0xe8 */ + NULL, /* 0xe9 */ + NULL, /* 0xea */ + NULL, /* 0xeb */ + NULL, /* 0xec */ + NULL, /* 0xed */ + NULL, /* 0xee */ + NULL, /* 0xef */ + NULL, /* 0xf0 */ + NULL, /* 0xf1 */ + NULL, /* 0xf2 */ + NULL, /* 0xf3 */ + NULL, /* 0xf4 */ + NULL, /* 0xf5 */ + NULL, /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}", /* 0xff - A single character shaped as greek lowercase 'PI' */ + NULL, /* 0x6400 */ + "HIRES", /* 0x6401 */ + "PLOT", /* 0x6402 */ + "LINE", /* 0x6403 */ + "BLOCK", /* 0x6404 */ + "FCHR", /* 0x6405 */ + "FCOL", /* 0x6406 */ + "FILL", /* 0x6407 */ + "REC", /* 0x6408 */ + "ROT", /* 0x6409 */ + "DRAW", /* 0x640a */ + "CHAR", /* 0x640b */ + "HI COL", /* 0x640c */ + "INV", /* 0x640d */ + "FRAC", /* 0x640e */ + "MOVE", /* 0x640f */ + "PLACE", /* 0x6410 */ + "UPB", /* 0x6411 */ + "UPW", /* 0x6412 */ + "LEFTW", /* 0x6413 */ + "LEFTB", /* 0x6414 */ + "DOWNB", /* 0x6415 */ + "DOWNW", /* 0x6416 */ + "RIGHTB", /* 0x6417 */ + "RIGHTW", /* 0x6418 */ + "MULTI", /* 0x6419 */ + "COLOUR", /* 0x641a */ + "MMOB", /* 0x641b */ + "BFLASH", /* 0x641c */ + "MOB SET", /* 0x641d */ + "MUSIC", /* 0x641e */ + "FLASH", /* 0x641f */ + "REPEAT", /* 0x6420 */ + "PLAY", /* 0x6421 */ + ">>", /* 0x6422 */ + "CENTRE", /* 0x6423 */ + "ENVELOPE", /* 0x6424 */ + "CGOTO", /* 0x6425 */ + "WAVE", /* 0x6426 */ + "FETCH", /* 0x6427 */ + "AT(", /* 0x6428 */ + "UNTIL", /* 0x6429 */ + ">>", /* 0x642a */ + ">>", /* 0x642b */ + "USE", /* 0x642c */ + ">>", /* 0x642d */ + "GLOBAL", /* 0x642e */ + ">>", /* 0x642f */ + "RESET", /* 0x6430 */ + "PROC", /* 0x6431 */ + "CALL", /* 0x6432 */ + "EXEC", /* 0x6433 */ + "END PROC", /* 0x6434 */ + "EXIT", /* 0x6435 */ + "END LOOP", /* 0x6436 */ + "ON KEY", /* 0x6437 */ + "DISABLE", /* 0x6438 */ + "RESUME", /* 0x6439 */ + "LOOP", /* 0x643a */ + "DELAY", /* 0x643b */ + ">>", /* 0x643c */ + ">>", /* 0x643d */ + ">>", /* 0x643e */ + ">>", /* 0x643f */ + "SECURE", /* 0x6440 */ + "DISAPA", /* 0x6441 */ + "CIRCLE", /* 0x6442 */ + "ON ERROR", /* 0x6443 */ + "NO ERROR", /* 0x6444 */ + "LOCAL", /* 0x6445 */ + "RCOMP", /* 0x6446 */ + "ELSE", /* 0x6447 */ + "RETRACE", /* 0x6448 */ + "TRACE", /* 0x6449 */ + "DIR", /* 0x644a */ + "PAGE", /* 0x644b */ + "DUMP", /* 0x644c */ + "FIND", /* 0x644d */ + "OPTION", /* 0x644e */ + "AUTO", /* 0x644f */ + "OLD", /* 0x6450 */ + "JOY", /* 0x6451 */ + "MOD", /* 0x6452 */ + "DIV", /* 0x6453 */ + ">>", /* 0x6454 */ + "DUP", /* 0x6455 */ + "INKEY", /* 0x6456 */ + "INST", /* 0x6457 */ + "TEST", /* 0x6458 */ + "LIN", /* 0x6459 */ + "EXOR", /* 0x645a */ + "INSERT", /* 0x645b */ + "POT", /* 0x645c */ + "PENX", /* 0x645d */ + ">>", /* 0x645e */ + "PENY", /* 0x645f */ + "SOUND", /* 0x6460 */ + "GRAPHICS", /* 0x6461 */ + "DESIGN", /* 0x6462 */ + "RLOCMOB", /* 0x6463 */ + "CMOB", /* 0x6464 */ + "BCKGNDS", /* 0x6465 */ + "PAUSE", /* 0x6466 */ + "NRM", /* 0x6467 */ + "MOB OFF", /* 0x6468 */ + "OFF", /* 0x6469 */ + "ANGL", /* 0x646a */ + "ARC", /* 0x646b */ + "COLD", /* 0x646c */ + "SCRSV", /* 0x646d */ + "SCRLD", /* 0x646e */ + "TEXT", /* 0x646f */ + "CSET", /* 0x6470 */ + "VOL", /* 0x6471 */ + "DISK", /* 0x6472 */ + "HRDCPY", /* 0x6473 */ + "KEY", /* 0x6474 */ + "PAINT", /* 0x6475 */ + "LOW COL", /* 0x6476 */ + "COPY", /* 0x6477 */ + "MERGE", /* 0x6478 */ + "RENUMBER", /* 0x6479 */ + "MEM", /* 0x647a */ + "DETECT", /* 0x647b */ + "CHECK", /* 0x647c */ + "DISPLAY", /* 0x647d */ + "ERR", /* 0x647e */ + "OUT" /* 0x647f */ +}; + +static const char *const basic_20_exp_40[] = /* "BASIC 2.0 with BASIC 4.0 Expansion" - supported by c64 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "CONCAT", /* 0xcc */ + "DOPEN", /* 0xcd */ + "DCLOSE", /* 0xce */ + "RECORD", /* 0xcf */ + "HEADER", /* 0xd0 */ + "COLLECT", /* 0xd1 */ + "BACKUP", /* 0xd2 */ + "COPY", /* 0xd3 */ + "APPEND", /* 0xd4 */ + "DSAVE", /* 0xd5 */ + "DLOAD", /* 0xd6 */ + "CATALOG", /* 0xd7 */ + "RENAME", /* 0xd8 */ + "SCRATCH", /* 0xd9 */ + "DIRECTORY", /* 0xda */ + "COLOR", /* 0xdb */ + "COLD", /* 0xdc */ + "KEY", /* 0xdd */ + "DVERIFY", /* 0xde */ + "DELETE" /* 0xdf */ + "AUTO", /* 0xe0 */ + "MERGE", /* 0xe1 */ + "OLD", /* 0xe2 */ + "MONITOR", /* 0xe3 */ + NULL, /* 0xe4 */ + NULL, /* 0xe5 */ + NULL, /* 0xe6 */ + NULL, /* 0xe7 */ + NULL, /* 0xe8 */ + NULL, /* 0xe9 */ + NULL, /* 0xea */ + NULL, /* 0xeb */ + NULL, /* 0xec */ + NULL, /* 0xed */ + NULL, /* 0xee */ + NULL, /* 0xef */ + NULL, /* 0xf0 */ + NULL, /* 0xf1 */ + NULL, /* 0xf2 */ + NULL, /* 0xf3 */ + NULL, /* 0xf4 */ + NULL, /* 0xf5 */ + NULL, /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_35[] = /* "BASIC 3.5" - supported by c16 & clones, except c364 */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "RGR", /* 0xcc */ + "RCLR" /* 0xcd */ + "RLUM" /* 0xce */ + "JOY", /* 0xcf */ + "RDOT" /* 0xd0 */ + "DEC", /* 0xd1 */ + "HEX$", /* 0xd2 */ + "ERR$", /* 0xd3 */ + "INSTR", /* 0xd4 */ + "ELSE", /* 0xd5 */ + "RESUME", /* 0xd6 */ + "TRAP", /* 0xd7 */ + "TRON", /* 0xd8 */ + "TROFF", /* 0xd9 */ + "SOUND", /* 0xda */ + "VOL", /* 0xdb */ + "AUTO", /* 0xdc */ + "PUDEF", /* 0xdd */ + "GRAPHIC", /* 0xde */ + "PAINT", /* 0xdf */ + "CHAR", /* 0xe0 */ + "BOX", /* 0xe1 */ + "CIRCLE", /* 0xe2 */ + "GSHAPE", /* 0xe3 */ + "SSHAPE", /* 0xe4 */ + "DRAW", /* 0xe5 */ + "LOCATE", /* 0xe6 */ + "COLOR", /* 0xe7 */ + "SCNCLR", /* 0xe8 */ + "SCALE", /* 0xe9 */ + "HELP", /* 0xea */ + "DO", /* 0xeb */ + "LOOP", /* 0xec */ + "EXIT", /* 0xed */ + "DIRECTORY", /* 0xee */ + "DSAVE", /* 0xef */ + "DLOAD", /* 0xf0 */ + "HEADER", /* 0xf1 */ + "SCRATCH", /* 0xf2 */ + "COLLECT", /* 0xf3 */ + "COPY", /* 0xf4 */ + "RENAME", /* 0xf5 */ + "BACKUP", /* 0xf6 */ + "DELETE", /* 0xf7 */ + "RENUMBER", /* 0xf8 */ + "KEY", /* 0xf9 */ + "MONITOR", /* 0xfa */ + "USING", /* 0xfb */ + "UNTIL", /* 0xfc */ + "WHILE", /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_35_magic_voice[] = /* "BASIC 3.5 with Magic Voice Speech Synthesizer" - supported by c364 */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "RGR", /* 0xcc */ + "RCLR" /* 0xcd */ + "RLUM" /* 0xce */ + "JOY", /* 0xcf */ + "RDOT" /* 0xd0 */ + "DEC", /* 0xd1 */ + "HEX$", /* 0xd2 */ + "ERR$", /* 0xd3 */ + "INSTR", /* 0xd4 */ + "ELSE", /* 0xd5 */ + "RESUME", /* 0xd6 */ + "TRAP", /* 0xd7 */ + "TRON", /* 0xd8 */ + "TROFF", /* 0xd9 */ + "SOUND", /* 0xda */ + "VOL", /* 0xdb */ + "AUTO", /* 0xdc */ + "PUDEF", /* 0xdd */ + "GRAPHIC", /* 0xde */ + "PAINT", /* 0xdf */ + "CHAR", /* 0xe0 */ + "BOX", /* 0xe1 */ + "CIRCLE", /* 0xe2 */ + "GSHAPE", /* 0xe3 */ + "SSHAPE", /* 0xe4 */ + "DRAW", /* 0xe5 */ + "LOCATE", /* 0xe6 */ + "COLOR", /* 0xe7 */ + "SCNCLR", /* 0xe8 */ + "SCALE", /* 0xe9 */ + "HELP", /* 0xea */ + "DO", /* 0xeb */ + "LOOP", /* 0xec */ + "EXIT", /* 0xed */ + "DIRECTORY", /* 0xee */ + "DSAVE", /* 0xef */ + "DLOAD", /* 0xf0 */ + "HEADER", /* 0xf1 */ + "SCRATCH", /* 0xf2 */ + "COLLECT", /* 0xf3 */ + "COPY", /* 0xf4 */ + "RENAME", /* 0xf5 */ + "BACKUP", /* 0xf6 */ + "DELETE", /* 0xf7 */ + "RENUMBER", /* 0xf8 */ + "KEY", /* 0xf9 */ + "MONITOR", /* 0xfa */ + "USING", /* 0xfb */ + "UNTIL", /* 0xfc */ + "WHILE", /* 0xfd */ + NULL, /* 0xfe - Prefix for additional tokens */ + "{PI}", /* 0xff - A single character shaped as greek lowercase 'PI' */ + NULL, /* 0xfe00 */ + "RATE", /* 0xfe01 */ + "VOC", /* 0xfe02 */ + NULL, /* 0xfe03 */ + "RDY", /* 0xfe04 */ + NULL, /* 0xfe05 */ + NULL, /* 0xfe06 */ + NULL, /* 0xfe07 */ + NULL, /* 0xfe08 */ + NULL, /* 0xfe09 */ + "SAY" /* 0xfe0a */ +}; + +static const char *const basic_40[] = /* "BASIC 4.0" - supported by cbm40xx & cbm80xx series, p500, cbm600 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "CONCAT", /* 0xcc */ + "DOPEN", /* 0xcd */ + "DCLOSE", /* 0xce */ + "RECORD", /* 0xcf */ + "HEADER", /* 0xd0 */ + "COLLECT", /* 0xd1 */ + "BACKUP", /* 0xd2 */ + "COPY", /* 0xd3 */ + "APPEND", /* 0xd4 */ + "DSAVE", /* 0xd5 */ + "DLOAD", /* 0xd6 */ + "CATALOG", /* 0xd7 */ + "RENAME", /* 0xd8 */ + "SCRATCH", /* 0xd9 */ + "DIRECTORY", /* 0xda */ + NULL, /* 0xdb */ + NULL, /* 0xdc */ + NULL, /* 0xdd */ + NULL, /* 0xde */ + NULL, /* 0xdf */ + NULL, /* 0xe0 */ + NULL, /* 0xe1 */ + NULL, /* 0xe2 */ + NULL, /* 0xe3 */ + NULL, /* 0xe4 */ + NULL, /* 0xe5 */ + NULL, /* 0xe6 */ + NULL, /* 0xe7 */ + NULL, /* 0xe8 */ + NULL, /* 0xe9 */ + NULL, /* 0xea */ + NULL, /* 0xeb */ + NULL, /* 0xec */ + NULL, /* 0xed */ + NULL, /* 0xee */ + NULL, /* 0xef */ + NULL, /* 0xf0 */ + NULL, /* 0xf1 */ + NULL, /* 0xf2 */ + NULL, /* 0xf3 */ + NULL, /* 0xf4 */ + NULL, /* 0xf5 */ + NULL, /* 0xf6 */ + NULL, /* 0xf7 */ + NULL, /* 0xf8 */ + NULL, /* 0xf9 */ + NULL, /* 0xfa */ + NULL, /* 0xfb */ + NULL, /* 0xfc */ + NULL, /* 0xfd */ + NULL, /* 0xfe */ + "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ +}; + +static const char *const basic_70[] = /* "BASIC 7.0" - supported by c128 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "RGR", /* 0xcc */ + "RCLR", /* 0xcd */ + NULL, /* 0xce - Prefix for additional tokens */ + "JOY", /* 0xcf */ + "RDOT" /* 0xd0 */ + "DEC", /* 0xd1 */ + "HEX$", /* 0xd2 */ + "ERR$", /* 0xd3 */ + "INSTR", /* 0xd4 */ + "ELSE", /* 0xd5 */ + "RESUME", /* 0xd6 */ + "TRAP", /* 0xd7 */ + "TRON", /* 0xd8 */ + "TROFF", /* 0xd9 */ + "SOUND", /* 0xda */ + "VOL", /* 0xdb */ + "AUTO", /* 0xdc */ + "PUDEF", /* 0xdd */ + "GRAPHIC", /* 0xde */ + "PAINT", /* 0xdf */ + "CHAR", /* 0xe0 */ + "BOX", /* 0xe1 */ + "CIRCLE", /* 0xe2 */ + "GSHAPE", /* 0xe3 */ + "SSHAPE", /* 0xe4 */ + "DRAW", /* 0xe5 */ + "LOCATE", /* 0xe6 */ + "COLOR", /* 0xe7 */ + "SCNCLR", /* 0xe8 */ + "SCALE", /* 0xe9 */ + "HELP", /* 0xea */ + "DO", /* 0xeb */ + "LOOP", /* 0xec */ + "EXIT", /* 0xed */ + "DIRECTORY", /* 0xee */ + "DSAVE", /* 0xef */ + "DLOAD", /* 0xf0 */ + "HEADER", /* 0xf1 */ + "SCRATCH", /* 0xf2 */ + "COLLECT", /* 0xf3 */ + "COPY", /* 0xf4 */ + "RENAME", /* 0xf5 */ + "BACKUP", /* 0xf6 */ + "DELETE", /* 0xf7 */ + "RENUMBER", /* 0xf8 */ + "KEY", /* 0xf9 */ + "MONITOR", /* 0xfa */ + "USING", /* 0xfb */ + "UNTIL", /* 0xfc */ + "WHILE", /* 0xfd */ + NULL, /* 0xfe - Prefix for additional tokens */ + "{PI}", /* 0xff - A single character shaped as greek lowercase 'PI' */ + NULL, /* 0xce00 */ + NULL, /* 0xce01 */ + "POT", /* 0xce02 */ + "BUMP", /* 0xce03 */ + "PEN", /* 0xce04 */ + "RSPPOS", /* 0xce05 */ + "RSPRITE", /* 0xce06 */ + "RSPCOLOR", /* 0xce07 */ + "XOR", /* 0xce08 */ + "RWINDOW", /* 0xce09 */ + "POINTER", /* 0xce0a */ + NULL, /* 0xfe00 */ + NULL, /* 0xfe01 */ + "BANK", /* 0xfe02 */ + "FILTER", /* 0xfe03 */ + "PLAY", /* 0xfe04 */ + "TEMPO", /* 0xfe05 */ + "MOVSPR", /* 0xfe06 */ + "SPRITE", /* 0xfe07 */ + "SPRCOLOR", /* 0xfe08 */ + "RREG", /* 0xfe09 */ + "ENVELOPE", /* 0xfe0a */ + "SLEEP", /* 0xfe0b */ + "CATALOG", /* 0xfe0c */ + "DOPEN", /* 0xfe0d */ + "APPEND", /* 0xfe0e */ + "DCLOSE", /* 0xfe0f */ + "BSAVE", /* 0xfe10 */ + "BLOAD", /* 0xfe11 */ + "RECORD", /* 0xfe12 */ + "CONCAT", /* 0xfe13 */ + "DVERIFY", /* 0xfe14 */ + "DCLEAR", /* 0xfe15 */ + "SPRSAV", /* 0xfe16 */ + "COLLISION", /* 0xfe17 */ + "BEGIN", /* 0xfe18 */ + "BEND", /* 0xfe19 */ + "WINDOW", /* 0xfe1a */ + "BOOT", /* 0xfe1b */ + "WIDTH", /* 0xfe1c */ + "SPRDEF", /* 0xfe1d */ + "QUIT", /* 0xfe1e */ + "STASH", /* 0xfe1f */ + NULL, /* 0xfe20 */ + "FETCH", /* 0xfe21 */ + NULL, /* 0xfe22 */ + "SWAP", /* 0xfe23 */ + "OFF", /* 0xfe24 */ + "FAST", /* 0xfe25 */ + "SLOW" /* 0xfe26 */ +}; + +static const char *const basic_100[] = /* "BASIC 10.0" - supported by c65 & clones */ +{ + "END", /* 0x80 */ + "FOR", /* 0x81 */ + "NEXT", /* 0x82 */ + "DATA", /* 0x83 */ + "INPUT#", /* 0x84 */ + "INPUT", /* 0x85 */ + "DIM", /* 0x86 */ + "READ", /* 0x87 */ + "LET", /* 0x88 */ + "GOTO", /* 0x89 */ + "RUN", /* 0x8a */ + "IF", /* 0x8b */ + "RESTORE", /* 0x8c */ + "GOSUB", /* 0x8d */ + "RETURN", /* 0x8e */ + "REM", /* 0x8f */ + "STOP", /* 0x90 */ + "ON", /* 0x91 */ + "WAIT", /* 0x92 */ + "LOAD", /* 0x93 */ + "SAVE", /* 0x94 */ + "VERIFY", /* 0x95 */ + "DEF", /* 0x96 */ + "POKE", /* 0x97 */ + "PRINT#", /* 0x98 */ + "PRINT", /* 0x99 */ + "CONT", /* 0x9a */ + "LIST", /* 0x9b */ + "CLR", /* 0x9c */ + "CMD", /* 0x9d */ + "SYS", /* 0x9e */ + "OPEN", /* 0x9f */ + "CLOSE", /* 0xa0 */ + "GET", /* 0xa1 */ + "NEW", /* 0xa2 */ + "TAB(", /* 0xa3 */ + "TO", /* 0xa4 */ + "FN", /* 0xa5 */ + "SPC(", /* 0xa6 */ + "THEN", /* 0xa7 */ + "NOT", /* 0xa8 */ + "STEP", /* 0xa9 */ + "+", /* 0xaa */ + "-", /* 0xab */ + "*", /* 0xac */ + "/", /* 0xad */ + "^", /* 0xae */ + "AND", /* 0xaf */ + "OR", /* 0xb0 */ + ">", /* 0xb1 */ + "=", /* 0xb2 */ + "<", /* 0xb3 */ + "SGN", /* 0xb4 */ + "INT", /* 0xb5 */ + "ABS", /* 0xb6 */ + "USR", /* 0xb7 */ + "FRE", /* 0xb8 */ + "POS", /* 0xb9 */ + "SQR", /* 0xba */ + "RND", /* 0xbb */ + "LOG", /* 0xbc */ + "EXP", /* 0xbd */ + "COS", /* 0xbe */ + "SIN", /* 0xbf */ + "TAN", /* 0xc0 */ + "ATN", /* 0xc1 */ + "PEEK", /* 0xc2 */ + "LEN", /* 0xc3 */ + "STR$", /* 0xc4 */ + "VAL", /* 0xc5 */ + "ASC", /* 0xc6 */ + "CHR$", /* 0xc7 */ + "LEFT$", /* 0xc8 */ + "RIGHT$", /* 0xc9 */ + "MID$", /* 0xca */ + "GO", /* 0xcb */ + "RGR", /* 0xcc */ + "RCLR", /* 0xcd */ + NULL, /* 0xce - Prefix for additional tokens */ + "JOY", /* 0xcf */ + "RDOT" /* 0xd0 */ + "DEC", /* 0xd1 */ + "HEX$", /* 0xd2 */ + "ERR$", /* 0xd3 */ + "INSTR", /* 0xd4 */ + "ELSE", /* 0xd5 */ + "RESUME", /* 0xd6 */ + "TRAP", /* 0xd7 */ + "TRON", /* 0xd8 */ + "TROFF", /* 0xd9 */ + "SOUND", /* 0xda */ + "VOL", /* 0xdb */ + "AUTO", /* 0xdc */ + "PUDEF", /* 0xdd */ + "GRAPHIC", /* 0xde */ + "PAINT", /* 0xdf */ + "CHAR", /* 0xe0 */ + "BOX", /* 0xe1 */ + "CIRCLE", /* 0xe2 */ + "PASTE", /* 0xe3 */ + "CUT", /* 0xe4 */ + "LINE", /* 0xe5 */ + "LOCATE", /* 0xe6 */ + "COLOR", /* 0xe7 */ + "SCNCLR", /* 0xe8 */ + "SCALE", /* 0xe9 */ + "HELP", /* 0xea */ + "DO", /* 0xeb */ + "LOOP", /* 0xec */ + "EXIT", /* 0xed */ + "DIR", /* 0xee */ + "DSAVE", /* 0xef */ + "DLOAD", /* 0xf0 */ + "HEADER", /* 0xf1 */ + "SCRATCH", /* 0xf2 */ + "COLLECT", /* 0xf3 */ + "COPY", /* 0xf4 */ + "RENAME", /* 0xf5 */ + "BACKUP", /* 0xf6 */ + "DELETE", /* 0xf7 */ + "RENUMBER", /* 0xf8 */ + "KEY", /* 0xf9 */ + "MONITOR", /* 0xfa */ + "USING", /* 0xfb */ + "UNTIL", /* 0xfc */ + "WHILE", /* 0xfd */ + NULL, /* 0xfe - Prefix for additional tokens */ + "{PI}", /* 0xff - A single character shaped as greek lowercase 'PI' */ + NULL, /* 0xce00 */ + NULL, /* 0xce01 */ + "POT", /* 0xce02 */ + "BUMP", /* 0xce03 */ + "PEN", /* 0xce04 */ + "RSPPOS", /* 0xce05 */ + "RSPRITE", /* 0xce06 */ + "RSPCOLOR", /* 0xce07 */ + "XOR", /* 0xce08 */ + "RWINDOW", /* 0xce09 */ + "POINTER", /* 0xce0a */ + NULL, /* 0xfe00 */ + NULL, /* 0xfe01 */ + "BANK", /* 0xfe02 */ + "FILTER", /* 0xfe03 */ + "PLAY", /* 0xfe04 */ + "TEMPO", /* 0xfe05 */ + "MOVSPR", /* 0xfe06 */ + "SPRITE", /* 0xfe07 */ + "SPRCOLOR", /* 0xfe08 */ + "RREG", /* 0xfe09 */ + "ENVELOPE", /* 0xfe0a */ + "SLEEP", /* 0xfe0b */ + "CATALOG", /* 0xfe0c */ + "DOPEN", /* 0xfe0d */ + "APPEND", /* 0xfe0e */ + "DCLOSE", /* 0xfe0f */ + "BSAVE", /* 0xfe10 */ + "BLOAD", /* 0xfe11 */ + "RECORD", /* 0xfe12 */ + "CONCAT", /* 0xfe13 */ + "DVERIFY", /* 0xfe14 */ + "DCLEAR", /* 0xfe15 */ + "SPRSAV", /* 0xfe16 */ + "COLLISION", /* 0xfe17 */ + "BEGIN", /* 0xfe18 */ + "BEND", /* 0xfe19 */ + "WINDOW", /* 0xfe1a */ + "BOOT", /* 0xfe1b */ + "WIDTH", /* 0xfe1c */ + "SPRDEF", /* 0xfe1d */ + "QUIT", /* 0xfe1e */ + "DMA", /* 0xfe1f */ + NULL, /* 0xfe20 */ + "DMA", /* 0xfe21 */ + NULL, /* 0xfe22 */ + "DMA", /* 0xfe23 */ + "OFF", /* 0xfe24 */ + "FAST", /* 0xfe25 */ + "SLOW", /* 0xfe26 */ + "TYPE", /* 0xfe27 */ + "BVERIFY", /* 0xfe28 */ + "ECTORY", /* 0xfe29 */ + "ERASE", /* 0xfe2a */ + "FIND", /* 0xfe2b */ + "CHANGE", /* 0xfe2c */ + "SET", /* 0xfe2d */ + "SCREEN", /* 0xfe2e */ + "POLYGON", /* 0xfe2f */ + "ELLIPSE", /* 0xfe30 */ + "VIEWPORT", /* 0xfe31 */ + "GCOPY", /* 0xfe32 */ + "PEN", /* 0xfe33 */ + "PALETTE", /* 0xfe34 */ + "DMODE", /* 0xfe35 */ + "DPAT", /* 0xfe36 */ + "PIC", /* 0xfe37 */ + "GENLOCK", /* 0xfe38 */ + "FOREGROUND", /* 0xfe39 */ + NULL, /* 0xfe3a */ + "BACKGROUND", /* 0xfe3b */ + "BORDER", /* 0xfe3c */ + "HIGHLIGHT" /* 0xfe3d */ +}; + +#endif + + + +/*************************************************************************** + COCO BASIC +***************************************************************************/ + +static const basictoken_tableent cocobas_tokenents[] = +{ + { 0x00, 0x80, cocobas_statements, ARRAY_LENGTH(cocobas_statements) }, + { 0xff, 0x80, cocobas_functions, ARRAY_LENGTH(cocobas_functions) } +}; + +static const basictokens cocobas_tokens = +{ + 0x2600, + 3, + TRUE, + cocobas_tokenents, + ARRAY_LENGTH(cocobas_tokenents) +}; + +static imgtoolerr_t cocobas_readfile(imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *destf) +{ + return basic_readfile(&cocobas_tokens, partition, filename, fork, destf); +} + +static imgtoolerr_t cocobas_writefile(imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + return basic_writefile(&cocobas_tokens, partition, filename, fork, sourcef, opts); +} + +void filter_cocobas_getinfo(UINT32 state, union filterinfo *info) +{ + switch(state) + { + case FILTINFO_STR_NAME: info->s = "cocobas"; break; + case FILTINFO_STR_HUMANNAME: info->s = "CoCo Tokenized Basic Files"; break; + case FILTINFO_PTR_READFILE: info->read_file = cocobas_readfile; break; + case FILTINFO_PTR_WRITEFILE: info->write_file = cocobas_writefile; break; + } +} + + + +/*************************************************************************** + DRAGON BASIC +***************************************************************************/ + +static const basictoken_tableent dragonbas_tokenents[] = +{ + { 0x00, 0x80, dragonbas_statements, ARRAY_LENGTH(dragonbas_statements) }, + { 0xff, 0x80, dragonbas_functions, ARRAY_LENGTH(dragonbas_functions) } +}; + +static const basictokens dragonbas_tokens = +{ + 0x2600, + 4, + TRUE, + dragonbas_tokenents, + ARRAY_LENGTH(dragonbas_tokenents) +}; + +static imgtoolerr_t dragonbas_readfile(imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *destf) +{ + return basic_readfile(&dragonbas_tokens, partition, filename, fork, destf); +} + +static imgtoolerr_t dragonbas_writefile(imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + return basic_writefile(&dragonbas_tokens, partition, filename, fork, sourcef, opts); +} + +void filter_dragonbas_getinfo(UINT32 state, union filterinfo *info) +{ + switch(state) + { + case FILTINFO_STR_NAME: info->s = "dragonbas"; break; + case FILTINFO_STR_HUMANNAME: info->s = "Dragon Tokenized Basic Files"; break; + case FILTINFO_PTR_READFILE: info->read_file = dragonbas_readfile; break; + case FILTINFO_PTR_WRITEFILE: info->write_file = dragonbas_writefile; break; + } +} + + + +/*************************************************************************** + VZBASIC +***************************************************************************/ + +static const basictoken_tableent vzbas_tokenents[] = +{ + { 0x00, 0x80, vzbas, ARRAY_LENGTH(vzbas) } +}; + + + +static const basictokens vzbas_tokens = +{ + 0x7ae9, + 0, + FALSE, + vzbas_tokenents, + ARRAY_LENGTH(vzbas_tokenents) +}; + +static imgtoolerr_t vzbas_readfile(imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *destf) +{ + return basic_readfile(&vzbas_tokens, partition, filename, fork, destf); +} + +static imgtoolerr_t vzbas_writefile(imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + return basic_writefile(&vzbas_tokens, partition, filename, fork, sourcef, opts); +} + +void filter_vzbas_getinfo(UINT32 state, union filterinfo *info) +{ + switch(state) + { + case FILTINFO_STR_NAME: info->s = "vzbas"; break; + case FILTINFO_STR_HUMANNAME: info->s = "Laser/VZ Tokenized Basic Files"; break; + case FILTINFO_PTR_READFILE: info->read_file = vzbas_readfile; break; + case FILTINFO_PTR_WRITEFILE: info->write_file = vzbas_writefile; break; + } +} + + + +/*************************************************************************** + BML3 BASIC +***************************************************************************/ + +static const basictoken_tableent bml3bas_tokenents[] = +{ + { 0x00, 0x80, bml3bas_statements, ARRAY_LENGTH(bml3bas_statements) }, + { 0xff, 0x80, bml3bas_functions, ARRAY_LENGTH(bml3bas_functions) } +}; + +static const basictokens bml3bas_tokens = +{ + 0x2600, + 3, + TRUE, + bml3bas_tokenents, + ARRAY_LENGTH(bml3bas_tokenents) +}; + +static imgtoolerr_t bml3bas_readfile(imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *destf) +{ + return basic_readfile(&bml3bas_tokens, partition, filename, fork, destf); +} + +static imgtoolerr_t bml3bas_writefile(imgtool_partition *partition, const char *filename, + const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + return basic_writefile(&bml3bas_tokens, partition, filename, fork, sourcef, opts); +} + +void filter_bml3bas_getinfo(UINT32 state, union filterinfo *info) +{ + switch(state) + { + case FILTINFO_STR_NAME: info->s = "bml3bas"; break; + case FILTINFO_STR_HUMANNAME: info->s = "Basic Master Level 3 Tokenized Basic Files"; break; + case FILTINFO_PTR_READFILE: info->read_file = bml3bas_readfile; break; + case FILTINFO_PTR_WRITEFILE: info->write_file = bml3bas_writefile; break; + } +} diff --git a/src/mame/tools/imgtool/filteoln.c b/src/mame/tools/imgtool/filteoln.c new file mode 100644 index 00000000000..30fb52ed429 --- /dev/null +++ b/src/mame/tools/imgtool/filteoln.c @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/**************************************************************************** + + filteoln.c + + Native end-of-line filter + +*****************************************************************************/ + +#include + +#include "imgtool.h" + +#define EOLN (CRLF == 1 ? "\r" : (CRLF == 2 ? "\n" : (CRLF == 3 ? "\r\n" : NULL))) + + + +static imgtoolerr_t convert_stream_eolns(imgtool_stream *source, imgtool_stream *dest, const char *eoln) +{ + size_t len, i, pos; + char buffer[2000]; + int hit_cr = FALSE; + + while((len = stream_read(source, buffer, sizeof(buffer))) > 0) + { + pos = 0; + + for (i = 0; i < len; i++) + { + switch(buffer[i]) + { + case '\r': + case '\n': + if (!hit_cr || (buffer[i] != '\n')) + { + if (i > pos) + stream_write(dest, buffer + pos, i - pos); + stream_write(dest, eoln, strlen(eoln)); + } + pos = i + 1; + break; + } + hit_cr = (buffer[i] == '\r'); + } + + if (i > pos) + stream_write(dest, buffer + pos, i - pos); + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t ascii_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t err; + imgtool_stream *mem_stream; + + mem_stream = stream_open_mem(NULL, 0); + if (!mem_stream) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + err = imgtool_partition_read_file(partition, filename, fork, mem_stream, NULL); + if (err) + goto done; + + stream_seek(mem_stream, SEEK_SET, 0); + err = convert_stream_eolns(mem_stream, destf, EOLN); + if (err) + goto done; + +done: + if (mem_stream) + stream_close(mem_stream); + return err; +} + + + +static imgtoolerr_t ascii_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtoolerr_t err; + imgtool_stream *mem_stream = NULL; + const char *eoln; + + /* create a stream */ + mem_stream = stream_open_mem(NULL, 0); + if (!mem_stream) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + eoln = imgtool_partition_get_info_string(partition, IMGTOOLINFO_STR_EOLN); + + err = convert_stream_eolns(sourcef, mem_stream, eoln); + if (err) + goto done; + stream_seek(mem_stream, SEEK_SET, 0); + + err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL); + if (err) + goto done; + +done: + if (mem_stream) + stream_close(mem_stream); + return err; +} + + + +void filter_eoln_getinfo(UINT32 state, union filterinfo *info) +{ + switch(state) + { + case FILTINFO_STR_NAME: info->s = "ascii"; break; + case FILTINFO_STR_HUMANNAME: info->s = "Ascii"; break; + case FILTINFO_PTR_READFILE: info->read_file = ascii_readfile; break; + case FILTINFO_PTR_WRITEFILE: info->write_file = ascii_writefile; break; + } +} diff --git a/src/mame/tools/imgtool/filter.c b/src/mame/tools/imgtool/filter.c new file mode 100644 index 00000000000..5887d6b501d --- /dev/null +++ b/src/mame/tools/imgtool/filter.c @@ -0,0 +1,82 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + filter.c + + Imgtool filters + +***************************************************************************/ + +#include + +#include "imgtool.h" + +/* ----------------------------------------------------------------------- */ + +INT64 filter_get_info_int(filter_getinfoproc get_info, UINT32 state) +{ + union filterinfo info; + info.i = 0; + get_info(state, &info); + return info.i; +} + +void *filter_get_info_ptr(filter_getinfoproc get_info, UINT32 state) +{ + union filterinfo info; + info.p = NULL; + get_info(state, &info); + return info.p; +} + +void *filter_get_info_fct(filter_getinfoproc get_info, UINT32 state) +{ + union filterinfo info; + info.f = NULL; + get_info(state, &info); + return info.f; +} + +const char *filter_get_info_string(filter_getinfoproc get_info, UINT32 state) +{ + union filterinfo info; + info.s = NULL; + get_info(state, &info); + return info.s; +} + +/* ----------------------------------------------------------------------- */ + +const filter_getinfoproc filters[] = +{ + filter_eoln_getinfo, + filter_cocobas_getinfo, + filter_dragonbas_getinfo, + filter_macbinary_getinfo, + filter_vzsnapshot_getinfo, + filter_vzbas_getinfo, + filter_thombas5_getinfo, + filter_thombas7_getinfo, + filter_thombas128_getinfo, + filter_thomcrypt_getinfo, + filter_bml3bas_getinfo, + NULL +}; + + + +filter_getinfoproc filter_lookup(const char *name) +{ + int i; + const char *filter_name; + + for (i = 0; filters[i]; i++) + { + filter_name = filter_get_info_string(filters[i], FILTINFO_STR_NAME); + if (!strcmp(name, filter_name)) + return filters[i]; + } + + return NULL; +} diff --git a/src/mame/tools/imgtool/filter.h b/src/mame/tools/imgtool/filter.h new file mode 100644 index 00000000000..814d813d598 --- /dev/null +++ b/src/mame/tools/imgtool/filter.h @@ -0,0 +1,66 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + filter.h + + Imgtool filters + +***************************************************************************/ + +#ifndef FILTER_H +#define FILTER_H + +#include +#include + +#include "library.h" + +struct imgtool_filter; + +enum +{ + /* --- the following bits of info are returned as 64-bit signed integers --- */ + FILTINFO_INT_FIRST = 0x00000, + FILTINFO_INT_STATESIZE, + + /* --- the following bits of info are returned as pointers to data or functions --- */ + FILTINFO_PTR_FIRST = 0x10000, + FILTINFO_PTR_READFILE, + FILTINFO_PTR_WRITEFILE, + FILTINFO_PTR_CHECKSTREAM, + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + FILTINFO_STR_FIRST = 0x20000, + FILTINFO_STR_NAME, + FILTINFO_STR_HUMANNAME, + FILTINFO_STR_EXTENSION +}; + +extern const filter_getinfoproc filters[]; + +filter_getinfoproc filter_lookup(const char *name); + +/* ----------------------------------------------------------------------- */ + +INT64 filter_get_info_int(filter_getinfoproc get_info, UINT32 state); +void *filter_get_info_ptr(filter_getinfoproc get_info, UINT32 state); +void *filter_get_info_fct(filter_getinfoproc get_info, UINT32 state); +const char *filter_get_info_string(filter_getinfoproc get_info, UINT32 state); + +/* ----------------------------------------------------------------------- */ + +extern void filter_eoln_getinfo(UINT32 state, union filterinfo *info); +extern void filter_cocobas_getinfo(UINT32 state, union filterinfo *info); +extern void filter_dragonbas_getinfo(UINT32 state, union filterinfo *info); +extern void filter_macbinary_getinfo(UINT32 state, union filterinfo *info); +extern void filter_vzsnapshot_getinfo(UINT32 state, union filterinfo *info); +extern void filter_vzbas_getinfo(UINT32 state, union filterinfo *info); +extern void filter_thombas5_getinfo(UINT32 state, union filterinfo *info); +extern void filter_thombas7_getinfo(UINT32 state, union filterinfo *info); +extern void filter_thombas128_getinfo(UINT32 state, union filterinfo *info); +extern void filter_thomcrypt_getinfo(UINT32 state, union filterinfo *info); +extern void filter_bml3bas_getinfo(UINT32 state, union filterinfo *info); + + +#endif /* FILTER_H */ diff --git a/src/mame/tools/imgtool/formats/coco_dsk.c b/src/mame/tools/imgtool/formats/coco_dsk.c new file mode 100644 index 00000000000..9674ed9de11 --- /dev/null +++ b/src/mame/tools/imgtool/formats/coco_dsk.c @@ -0,0 +1,1194 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/********************************************************************* + + formats/coco_dsk.c + + Tandy Color Computer / Dragon disk images + +*********************************************************************/ + +#include +#include +#include + +#include "formats/coco_dsk.h" +#include "formats/basicdsk.h" +#include "formats/imageutl.h" +#include "coretmpl.h" + +/* ----------------------------------------------------------------------- + * JVC (Jeff Vavasour CoCo) format + * + * Used by Jeff Vavasour's CoCo Emulators + * + * Documentation taken from Tim Linder's web site: + * http://home.netcom.com/~tlindner/JVC.html + * + * A. Header length + * The header length is determined by the file length modulo 256: + * headerSize = fileLength % 256; + * This means that the header is variable length and the minimum size + * is zero bytes, and the maximum size of 255 bytes. + * + * B. Header + * Here is a description of the header bytes: + * Byte Offset Description Default + * ----------- ----------------- ------- + * 0 Sectors per track 18 + * 1 Side count 1 + * 2 Sector size code 1 + * 3 First sector ID 1 + * 4 Sector attribute flag 0 + * + * If the sector attribute flag is zero then the track count is determined + * by the formula: + * + * (fileLength - headerSize) / (sectorsPerTrack * (128 << + * sectorSizeCode)) / sideCount + * + * If the sector attribute flag is non zero then the track count is + * determined by the more complex formula: + * + * (fileLength - headerSize) / (sectorsPerTrack * ((128 << + * sectorSizeCode) + 1) ) / sideCount + * + * If the length of the header is to short to contain the geometry desired, + * then the default values are assumed. If the header length is zero the all + * of the geometry is assumed. When creating disk images it is desirable to + * make the header length as short as possible. The header should only be + * used to deviate from the default values. + * + * The sector data begins immediately after the header. If the header length + * is zero then the sector data is at the beginning file. + * + * C. Sectors per track + * This is the number of sectors per track (ones based). A value of 18 + * means there are 18 sectors per track + * + * D. Side Count + * This is the number of sides in the disk image. Values of 1 or 2 are + * acceptable. If there are two sides then the tracks are interleaved. + * The first track in the image file is track zero side 1, the second + * track in the image file is track zero side 2. + * + * E. Sector size + * The is the same value that is stored in the wd179x ID field to + * determine sector size: + * + * 0x00 128 bytes + * 0x01 256 bytes + * 0x02 512 bytes + * 0x03 1024 bytes + * + * Other values are undefined. Every sector in the disk image must be the + * same size. + * + * F. First sector ID + * This determines the first sector ID for each track. Each successive + * sector adds one to the previous ID. If the first sector ID is 1, then + * the second sector has an ID of 2, and the third has an ID of 3. + * + * G. Sector Attribute Flag + * If this byte is non zero, then each sector contains an additional + * byte prepended to the sector data. If the attribute flag is zero then + * there are no extra bytes in front of the sector data. + * + * H. Sector attribute byte + * This byte is put at the beginning of every sector if the header flag + * is turned on. The information this byte contains is the same as the + * status register (of the wd179x) would contain when a 'Read Sector' + * command was issued. The bit fields are defined as: + * + * Bit position: + * --------------- + * 7 6 5 4 3 2 1 0 + * | | | | | | | | + * | | | | | | | +--- Not used. Set to zero. + * | | | | | | +----- Not used. Set to zero. + * | | | | | +------- Not used. Set to zero. + * | | | | +--------- Set on CRC error. + * | | | +----------- Set if sector not found. + * | | +------------- Record type: 1 - Deleted Data Mark, 0 - Data Mark. + * | +--------------- Not Used. Set to zero. + * +----------------- Not Used. Set to zero. + * + * ----------------------------------------------------------------------- */ + +static int coco_jvc_decode_header(floppy_image_legacy *floppy, UINT64 size, + struct basicdsk_geometry *geometry) +{ + UINT8 header[256]; + UINT8 sector_attribute_flag; + UINT16 physical_bytes_per_sector; + UINT32 header_size, file_size; + struct basicdsk_geometry dummy_geometry; + + if (geometry) + memset(geometry, 0, sizeof(*geometry)); + else + geometry = &dummy_geometry; + + if (size > 0xFFFFFFFF) + return -1; + file_size = (UINT32) size; + + /* read the header */ + header_size = (UINT32) file_size % 0x100; + floppy_image_read(floppy, header, 0, header_size); + geometry->offset = header_size; + + /* byte offset 0 - sectors per track */ + geometry->sectors = (header_size > 0) ? header[0] : 18; + if (geometry->sectors <= 0) + return -1; + + /* byte offset 1 - side count */ + geometry->heads = (header_size > 1) ? header[1] : 1; + if (geometry->heads <= 0) + return -1; + + /* byte offset 2 - sector size code */ + geometry->sector_length = 128 << ((header_size > 2) ? header[2] : 1); + if (geometry->sector_length <= 0) + return -1; + + /* byte offset 3 - first sector ID */ + geometry->first_sector_id = (header_size > 3) ? header[3] : 1; + + /* byte offset 4 - sector attribute flag */ + sector_attribute_flag = (header_size > 4) ? header[4] : 0; + if (sector_attribute_flag != 0) + return -1; /* we do not support sector attribute flags */ + + physical_bytes_per_sector = geometry->sector_length; + if (sector_attribute_flag) + physical_bytes_per_sector++; + + geometry->tracks = (file_size - header_size) / geometry->sectors / geometry->heads / physical_bytes_per_sector; + + /* do we have an oddball size? reject this file if not */ + if ((file_size - header_size) % physical_bytes_per_sector) + return -1; + + /* minimum of 35 tracks; support degenerate JVC files */ + if (geometry->tracks < 35) + geometry->tracks = 35; + + return 0; +} + + + +static FLOPPY_IDENTIFY(coco_jvc_identify) +{ + UINT64 size; + size = floppy_image_size(floppy); + *vote = coco_jvc_decode_header(floppy, size, NULL) ? 0 : 100; + return FLOPPY_ERROR_SUCCESS; +} + + + +static FLOPPY_CONSTRUCT(coco_jvc_construct) +{ + struct basicdsk_geometry geometry; + UINT8 header[5]; + size_t header_size; + + if (params) + { + /* create */ + memset(&geometry, 0, sizeof(geometry)); + geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); + geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); + geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + + header[0] = (UINT8) geometry.sectors; + header[1] = (UINT8) geometry.heads; + header[2] = (UINT8) compute_log2(geometry.sector_length) - 7; + header[3] = (UINT8) geometry.first_sector_id; + header[4] = 0; + + /* now that we have the header computed, figure out the header size */ + header_size = 0; + if (header[0] != 18) + header_size = 1; + if (header[1] != 1) + header_size = 2; + if (header[2] != 1) + header_size = 3; + if (header[3] != 1) + header_size = 4; + if (header[4] != 0) + header_size = 5; + + geometry.offset = header_size; + + floppy_image_write(floppy, header, 0, header_size); + } + else + { + /* load */ + if (coco_jvc_decode_header(floppy, floppy_image_size(floppy), &geometry)) + return FLOPPY_ERROR_INVALIDIMAGE; + } + return basicdsk_construct(floppy, &geometry); +} + + +/* ----------------------------------------------------------------------- + * OS-9 file format + * + * This file format is largely a hack because there are a large amount of + * disk images that do not have geometry image separate from the disk image + * itself. So we support OS-9 images with are simply basic disks whose + * geometry is determined by the disk image. + * + * OS-9 images identified by an LSN; which are simply blocks of 256 bytes + * + * LSN0 + * Byte size use + * $00 3 sectors on disk + * $03 1 track size in sectors + * $04 2 bytes in allocation bit map; typically 1bit/sector so for + * 35 tracks of 18 sectors each that's $4E (single sided disk) + * 40 tracks per side, 18 sectors each = $B4 + * $06 2 sectors per bit in allocation map; normally 1 + * $08 3 LSN of root directory; normally 2 but depends on size of + * $04 value + * $0B 2 owner's user number; normally 0 + * $0D 1 disk attributes; normally $FF + * $0E 2 psuedo random number for identification + * $10 1 disk format; typical is 3 + * %00000001 0=single side 1=double side + * %00000010 0=single density (non Coco) 1=double density + * %00000100 0=48tracks/inch 1=96tracks/inch + * $11 2 sectors per track; normal is $12 skip several not needed + * for Format + * $1A 5 date of creation Y:M:D:H:M + * $1F 32 ASCII name of disk, last letter has $80 added to it, + * the full 32 bytes do not need to be used. + * + * Allocation bit map, fill with zeros and set bits from low to high as + * sectors are used. So, for a fresh disk sectors LSN0,LSN1,LSN2, and LSN3 + * will be in use so the first byte will be $FF $C0 and all others + * in the map are $00 + * + * Root directory LSN2 + * Byte size use + * $00 1 attributes will be $BF + * $01 2 owners ID will be $0000 + * $03 5 date last modified will be creation date Y:M:D:H:M + * $08 1 link count; set to $02 + * $09 4 file size in bytes, set to $40 + * $0D 3 date created Y:M:D + * $10 3 block LSN set to current sector number+1 ie $03 in this case + * $13 2 size in sectors of directory block, set to $07 + * All other bytes in sector set to $00 + * LSN3 first sector of directory with names + * Fill sector with all $00 and then set listed bytes + * $00 2 value $2EAE which is .. with last byte+$80 + * $1F 1 value $02 LSN for start of this directory as there is + * none higher in tree + * $20 1 value $AE which is . with $80 added + * $3F 1 value $02 LSN for start of this directory + * ----------------------------------------------------------------------- */ + +static floperr_t coco_os9_readheader(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) +{ + UINT8 header[0x20]; + int total_sectors; + + floppy_image_read(floppy, header, 0, sizeof(header)); + + total_sectors = (header[0x00] << 16) | (header[0x01] << 8) | header[0x02]; + + memset(geometry, 0, sizeof(*geometry)); + geometry->first_sector_id = 1; + geometry->sector_length = 256; + geometry->sectors = (header[0x11] << 8) + header[0x12]; + geometry->heads = (header[0x10] & 0x01) ? 2 : 1; + + if (!geometry->sectors) + return FLOPPY_ERROR_INVALIDIMAGE; + + geometry->tracks = total_sectors / geometry->sectors / geometry->heads; + + if (total_sectors != geometry->tracks * geometry->sectors * geometry->heads) + return FLOPPY_ERROR_INVALIDIMAGE; + + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_os9_post_format(floppy_image_legacy *floppy, option_resolution *params) +{ + UINT8 header[0x0400]; + floperr_t err; + time_t t; + struct tm *ltime; + int heads, tracks, sectors, total_sectors; + + heads = option_resolution_lookup_int(params, PARAM_HEADS); + tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + total_sectors = heads * tracks * sectors; + + /* write the initial header */ + time(&t); + ltime = localtime(&t); + + memset(&header, 0, sizeof(header)); + header[0x0000] = (UINT8) (total_sectors >> 16); + header[0x0001] = (UINT8) (total_sectors >> 8); + header[0x0002] = (UINT8) (total_sectors >> 0); + header[0x0003] = (UINT8) sectors; + header[0x0004] = (UINT8) (((total_sectors + 7) / 8) >> 8); + header[0x0005] = (UINT8) (((total_sectors + 7) / 8) >> 0); + header[0x0006] = 0x00; + header[0x0007] = 0x01; + header[0x0008] = 0x00; + header[0x0009] = 0x00; + header[0x000a] = 0x02; + header[0x000b] = 0x00; + header[0x000c] = 0x00; + header[0x000d] = 0xff; + header[0x000e] = floppy_random_byte(floppy); + header[0x000f] = floppy_random_byte(floppy); + header[0x0010] = (heads == 2) ? 3 : 2; + header[0x0011] = (UINT8) (sectors >> 8); + header[0x0012] = (UINT8) (sectors >> 0); + header[0x001A] = (UINT8) ltime->tm_year; + header[0x001B] = (UINT8) ltime->tm_mon + 1; + header[0x001C] = (UINT8) ltime->tm_mday; + header[0x001D] = (UINT8) ltime->tm_hour; + header[0x001E] = (UINT8) ltime->tm_min; + header[0x001F] = 0xA0; + header[0x0100] = 0xFF; + header[0x0101] = 0xC0; + header[0x0200] = 0xBF; + header[0x0201] = 0x00; + header[0x0202] = 0x00; + header[0x0203] = (UINT8) ltime->tm_year; + header[0x0204] = (UINT8) ltime->tm_mon + 1; + header[0x0205] = (UINT8) ltime->tm_mday; + header[0x0206] = (UINT8) ltime->tm_hour; + header[0x0207] = (UINT8) ltime->tm_min; + header[0x0208] = 0x02; + header[0x0209] = 0x00; + header[0x020A] = 0x00; + header[0x020B] = 0x00; + header[0x020C] = 0x40; + header[0x020D] = (UINT8) (ltime->tm_year % 100); + header[0x020E] = (UINT8) ltime->tm_mon; + header[0x020F] = (UINT8) ltime->tm_mday; + header[0x0210] = 0x00; + header[0x0211] = 0x00; + header[0x0212] = 0x03; + header[0x0213] = 0x00; + header[0x0214] = 0x07; + header[0x0300] = 0x2E; + header[0x0301] = 0xAE; + header[0x031F] = 0x02; + header[0x0320] = 0xAE; + header[0x033F] = 0x02; + + if (total_sectors % 8) + header[0x0100 + (total_sectors / 8)] = 0xFF >> (total_sectors % 8); + + err = floppy_write_sector(floppy, 0, 0, 1, 0, &header[0x0000], 256, 0); + if (err) + return err; + + err = floppy_write_sector(floppy, 0, 0, 2, 0, &header[0x0100], 256, 0); + if (err) + return err; + + err = floppy_write_sector(floppy, 0, 0, 3, 0, &header[0x0200], 256, 0); + if (err) + return err; + + err = floppy_write_sector(floppy, 0, 0, 4, 0, &header[0x0300], 256, 0); + if (err) + return err; + + return FLOPPY_ERROR_SUCCESS; +} + + + +static FLOPPY_IDENTIFY(coco_os9_identify) +{ + struct basicdsk_geometry geometry; + *vote = coco_os9_readheader(floppy, &geometry) ? 0 : 100; + return FLOPPY_ERROR_SUCCESS; +} + + + +static FLOPPY_CONSTRUCT(coco_os9_construct) +{ + floperr_t err; + struct basicdsk_geometry geometry; + + if (params) + { + /* create */ + memset(&geometry, 0, sizeof(geometry)); + geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); + geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); + geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + } + else + { + /* open */ + err = coco_os9_readheader(floppy, &geometry); + if (err) + return err; + } + + /* actually construct the image */ + err = basicdsk_construct(floppy, &geometry); + floppy_callbacks(floppy)->post_format = coco_os9_post_format; + return err; +} + + + +/* ----------------------------------------------------------------------- + * VDK file format + * + * Used by Paul Burgin's PC-Dragon emulator + * + * Offset Bytes Field Description + * ------ ----- ------------ ----------- + * 0 1 magic1 Signature byte 1 ('d') + * 1 1 magic2 Signature byte 2 ('k') + * 2 2 header_len Total header length (little endian) + * 4 1 ver_actual Version of the VDK format (0x10) + * 5 1 ver_compat Backwards compatibility version (0x10) + * 6 1 source_id Identify of the file source + * 7 1 source_ver Version of the file source + * 8 1 tracks Number of tracks + * 9 1 sides Number of sides (1-2) + * 10 1 flags Various flags + * bit 0: Write protect + * bit 1: A Lock + * bit 2: F Lock + * bit 3: Disk set + * 11 1 compression Compression flags (bits 0-2) and name length + * ----------------------------------------------------------------------- */ + + + +static int coco_vdk_decode_header(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) +{ + UINT8 header[12]; + UINT8 heads, tracks, sectors; + UINT16 sector_length, offset; + UINT64 size; + + size = floppy_image_size(floppy); + + floppy_image_read(floppy, header, 0, sizeof(header)); + + if (header[0] != 'd') + return -1; + if (header[1] != 'k') + return -1; + if (header[5] != 0x10) + return -1; + if (header[11] & 0x07) + return -1; + + heads = header[9]; + tracks = header[8]; + sectors = 18; + sector_length = 0x100; + + offset = header[3] * 0x100 + header[2]; + + if (size != ((UINT32) heads * tracks * sectors * sector_length + offset)) + return -1; + + if (geometry) + { + memset(geometry, 0, sizeof(*geometry)); + geometry->heads = heads; + geometry->tracks = tracks; + geometry->sectors = sectors; + geometry->first_sector_id = 1; + geometry->sector_length = sector_length; + geometry->offset = offset; + } + return 0; +} + + + +static FLOPPY_IDENTIFY(coco_vdk_identify) +{ + *vote = coco_vdk_decode_header(floppy, NULL) ? 0 : 100; + return FLOPPY_ERROR_SUCCESS; +} + + + +static FLOPPY_CONSTRUCT(coco_vdk_construct) +{ + struct basicdsk_geometry geometry; + UINT8 header[12]; + + if (params) + { + /* create */ + memset(&geometry, 0, sizeof(geometry)); + geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); + geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + geometry.sectors = 18; + geometry.first_sector_id = 1; + geometry.sector_length = 256; + geometry.offset = sizeof(header); + + memset(&header, 0, sizeof(header)); + header[0] = 'd'; + header[1] = 'k'; + header[2] = (UINT8) (sizeof(header) >> 0); + header[3] = (UINT8) (sizeof(header) >> 8); + header[4] = 0x10; + header[5] = 0x10; + header[8] = (UINT8) geometry.tracks; + header[9] = (UINT8) geometry.heads; + + floppy_image_write(floppy, header, 0, sizeof(header)); + } + else + { + /* load */ + if (coco_vdk_decode_header(floppy, &geometry)) + return FLOPPY_ERROR_INVALIDIMAGE; + } + return basicdsk_construct(floppy, &geometry); +} + + + +/* ----------------------------------------------------------------------- + * DMK file format + * + * David M. Keil's disk image format is aptly called an 'on disk' image + * format. This means that whatever written to the disk is enocded into + * the image file. IDAMS, sector headers, traling CRCs, and intra sector + * spacing. * + * + * HEADER DESCRIPTION: + * + * Offset Bytes Field Description + * ------ ----- ------------ ----------- + * 0 1 write_prot 0xff = Writed Protected, 0x00 = R/W + * 1 1 tracks Number of tracks + * 2 2 track_length Bytes per track (little endian) + * 4 1 disk_options Miscellaneous flags + * bit 0-3: Unused + * bit 4: 1=single sided 0=dbl + * bit 5: Unused + * bit 6: Single density? + * bit 6: Ignore density flags? + * 5 7 reserved Reserved for future use + * 12 4 real_disk_code If this is 0x12345678 (little endian) + * then access a real disk drive + * (unsupported) + * + * Each track begins with a track TOC, consisting of 64 little endian 16-bit + * integers. Each integer has the following format: + * bit 0-13: Offset from beginning of track to 'FE' byte of IDAM + * Note these are always sorted from first to last. All empty + * entries are 0x00 + * bit 14: Undefined (reserved) + * bit 15: Sector double density (0=SD 1=DD) + * ----------------------------------------------------------------------- */ + +struct dmk_tag +{ + int heads; + int tracks; + UINT32 track_size; +}; + +#define DMK_HEADER_LEN 16 +#define DMK_TOC_LEN 64 +#define DMK_IDAM_LENGTH 7 +#define DMK_DATA_GAP 80 +#define DMK_LEAD_IN 32 +#define DMK_EXTRA_TRACK_LENGTH 156 + +#define dmk_idam_type(x) (x)[0] +#define dmk_idam_track(x) (x)[1] +#define dmk_idam_side(x) (x)[2] +#define dmk_idam_sector(x) (x)[3] +#define dmk_idam_sectorlength(x) (x)[4] +#define dmk_idam_crc(x) (((x)[5] << 8) + (x)[6]) +#define dmk_idam_set_crc(x, crc) (x)[5] = ((crc) >> 8); (x)[6] = ((crc) >> 0); + + +static struct dmk_tag *get_dmk_tag(floppy_image_legacy *floppy) +{ + return (dmk_tag *)floppy_tag(floppy); +} + + +static floperr_t coco_dmk_get_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset) +{ + struct dmk_tag *tag = get_dmk_tag(floppy); + + if ((head < 0) || (head >= tag->heads) || (track < 0) || (track >= tag->tracks)) + return FLOPPY_ERROR_SEEKERROR; + + *offset = track; + *offset *= tag->heads; + *offset += head; + *offset *= tag->track_size; + *offset += DMK_HEADER_LEN; + return FLOPPY_ERROR_SUCCESS; +} + + + +static UINT32 coco_dmk_min_track_size(int sectors, int sector_length) +{ + int sector_physical_length; + sector_physical_length = 8 + 3 + DMK_IDAM_LENGTH + 22 + 12 + 3 + 1 + sector_length + 2 + 24; + return DMK_TOC_LEN * 2 + DMK_LEAD_IN + (sectors * sector_physical_length); +} + + + +static floperr_t coco_dmk_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen) +{ + floperr_t err; + UINT64 track_offset; + + err = coco_dmk_get_offset(floppy, head, track, &track_offset); + if (err) + return err; + + floppy_image_read(floppy, buffer, offset + track_offset, buflen); + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen) +{ + floperr_t err; + UINT64 track_offset; + + err = coco_dmk_get_offset(floppy, head, track, &track_offset); + if (err) + return err; + + floppy_image_write(floppy, buffer, offset + track_offset, buflen); + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_get_track_data_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset) +{ + *offset = DMK_TOC_LEN + 1; + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_format_track(floppy_image_legacy *floppy, int head, int track, option_resolution *params) +{ + int sectors; + int sector_length; + int interleave; + int first_sector_id; + floperr_t err; + int physical_sector; + int logical_sector; + int track_position; + UINT16 idam_offset; + UINT16 crc; + UINT8 *track_data; + void *track_data_v; + UINT32 max_track_size; + std::vector sector_map; + + sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + interleave = option_resolution_lookup_int(params, PARAM_INTERLEAVE); + first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); + + max_track_size = get_dmk_tag(floppy)->track_size; + + if (sectors > DMK_TOC_LEN) + { + err = FLOPPY_ERROR_INTERNAL; + goto done; + } + + if (max_track_size < coco_dmk_min_track_size(sectors, sector_length)) + { + err = FLOPPY_ERROR_NOSPACE; + goto done; + } + + err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL); + if (err) + goto done; + track_data = (UINT8 *) track_data_v; + + /* set up sector map */ + memset(§or_map[0], 0xff, sectors*sizeof(int)); + + physical_sector = 0; + for (logical_sector = 0; logical_sector < sectors; logical_sector++) + { + while(sector_map[physical_sector] >= 0) + { + physical_sector++; + physical_sector %= sectors; + } + + sector_map[physical_sector] = logical_sector + first_sector_id; + physical_sector += interleave + 1; + physical_sector %= sectors; + } + + /* set up track table of contents */ + physical_sector = 0; + track_position = DMK_TOC_LEN * 2 + DMK_LEAD_IN; + while(physical_sector < DMK_TOC_LEN) + { + if (physical_sector >= sectors) + { + /* no more sectors */ + idam_offset = 0; + } + else + { + /* this is a sector */ + logical_sector = sector_map[physical_sector]; + + /* write the sector */ + memset(&track_data[track_position], 0x00, 8); + track_position += 8; + + memset(&track_data[track_position], 0xA1, 3); + track_position += 3; + + idam_offset = track_position | 0x8000; + dmk_idam_type( &track_data[track_position]) = 0xFE; + dmk_idam_track( &track_data[track_position]) = track; + dmk_idam_side( &track_data[track_position]) = head; + dmk_idam_sector( &track_data[track_position]) = logical_sector; + dmk_idam_sectorlength( &track_data[track_position]) = compute_log2(sector_length / 128); + crc = ccitt_crc16(0xcdb4, &track_data[track_position], DMK_IDAM_LENGTH - 2); + dmk_idam_set_crc( &track_data[track_position], crc); + track_position += DMK_IDAM_LENGTH; + + memset(&track_data[track_position], 0x4E, 22); + track_position += 22; + + memset(&track_data[track_position], 0x00, 12); + track_position += 12; + + memset(&track_data[track_position], 0xA1, 3); + track_position += 3; + + /* write sector body */ + track_data[track_position] = 0xFB; + memset(&track_data[track_position + 1], floppy_get_filler(floppy), sector_length); + crc = ccitt_crc16(0xcdb4, &track_data[track_position], sector_length + 1); + track_data[track_position + sector_length + 1] = (UINT8) (crc >> 8); + track_data[track_position + sector_length + 2] = (UINT8) (crc >> 0); + track_position += sector_length + 3; + + /* write sector footer */ + memset(&track_data[track_position], 0x4E, 24); + track_position += 24; + } + + /* write the TOC entry */ + track_data[physical_sector * 2 + 0] = (UINT8) (idam_offset >> 0); + track_data[physical_sector * 2 + 1] = (UINT8) (idam_offset >> 8); + + physical_sector++; + } + + /* write track lead in */ + memset(&track_data[physical_sector * 2], 0x4e, DMK_LEAD_IN); + + /* write track footer */ + assert(max_track_size >= (UINT32)track_position); + memset(&track_data[track_position], 0x4e, max_track_size - track_position); + +done: + return err; +} + + + +static int coco_dmk_get_heads_per_disk(floppy_image_legacy *floppy) +{ + return get_dmk_tag(floppy)->heads; +} + + + +static int coco_dmk_get_tracks_per_disk(floppy_image_legacy *floppy) +{ + return get_dmk_tag(floppy)->tracks; +} + + + +static UINT32 coco_dmk_get_track_size(floppy_image_legacy *floppy, int head, int track) +{ + return get_dmk_tag(floppy)->track_size; +} + + + +static floperr_t coco_dmk_seek_sector_in_track(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, int dirtify, UINT8 **sector_data, UINT32 *sector_length) +{ + struct dmk_tag *tag = get_dmk_tag(floppy); + floperr_t err; + UINT32 idam_offset = 0; + UINT16 calculated_crc; + size_t i; + size_t offs; + int state; + UINT8 *track_data; + void *track_data_v; + size_t track_length; + size_t sec_len; + + err = floppy_load_track(floppy, head, track, dirtify, &track_data_v, &track_length); + if (err) + return err; + track_data = (UINT8 *) track_data_v; + + /* search for matching IDAM */ + for (i = 0; i < DMK_TOC_LEN; i++) + { + idam_offset = track_data[i * 2 + 1]; + idam_offset <<= 8; + idam_offset |= track_data[i * 2 + 0]; + idam_offset &= 0x3FFF; + + if (idam_offset == 0) + { + /* we've reached the end of the road */ + i = DMK_TOC_LEN; + break; + } + + if ((idam_offset + DMK_IDAM_LENGTH) >= tag->track_size) + continue; + + calculated_crc = ccitt_crc16(0xCDB4, &track_data[idam_offset], DMK_IDAM_LENGTH - 2); + + if (calculated_crc == dmk_idam_crc(&track_data[idam_offset])) + { + if (sector_is_index) + { + /* the sector is indexed; decrement the index and go */ + if (sector-- == 0) + break; + } + else + { + /* check IDAM integrity and check for matching sector */ + if (sector == dmk_idam_sector(&track_data[idam_offset]) +/* && (track == dmk_idam_track(&track_data[idam_offset])) */ +/* && (head == dmk_idam_side(&track_data[idam_offset])) */ + ) + break; + } + } + } + + if (i >= DMK_TOC_LEN) + return FLOPPY_ERROR_SEEKERROR; + + /* we found a matching sector ID */ + state = 0; + offs = idam_offset + DMK_IDAM_LENGTH; + + /* find pattern 0xA1A1FB; this represents the start of a data sector */ + for (i = 0; i < DMK_DATA_GAP; i++) + { + /* overflowing the track? */ + if ((i + offs) >= tag->track_size) + return FLOPPY_ERROR_SEEKERROR; + + if (track_data[offs + i] == 0xA1) + state++; + else if ((track_data[offs + i] == 0xFB) && state) + break; + else + state = 0; + } + if (i >= DMK_DATA_GAP) + return FLOPPY_ERROR_SEEKERROR; + + offs += i + 1; + sec_len = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); + + if ((offs + sec_len) > track_length) + return FLOPPY_ERROR_INVALIDIMAGE; + + if (sector_data) + *sector_data = track_data + offs; + if (sector_length) + *sector_length = sec_len; + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length) +{ + return coco_dmk_seek_sector_in_track(floppy, head, track, sector, FALSE, FALSE, NULL, sector_length); +} + + + +static floperr_t coco_dmk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags) +{ + floperr_t err; + UINT32 idam_offset; + const UINT8 *track_data; + void *track_data_v; + + if (sector_index*2 >= DMK_TOC_LEN) + return FLOPPY_ERROR_SEEKERROR; + + err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, NULL); + if (err) + return err; + track_data = (UINT8 *) track_data_v; + + idam_offset = track_data[sector_index * 2 + 1]; + idam_offset <<= 8; + idam_offset |= track_data[sector_index * 2 + 0]; + idam_offset &= 0x3FFF; + + if (idam_offset == 0) + return FLOPPY_ERROR_SEEKERROR; + + if (cylinder) + *cylinder = dmk_idam_track(&track_data[idam_offset]); + if (side) + *side = dmk_idam_side(&track_data[idam_offset]); + if (sector) + *sector = dmk_idam_sector(&track_data[idam_offset]); + if (sector_length) + *sector_length = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); + if (flags) + /* TODO: read DAM or DDAM and determine flags */ + *flags = 0; + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t internal_coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen) +{ + floperr_t err; + UINT32 sector_length; + UINT16 crc_on_disk; + UINT16 calculated_crc; + UINT8 *sector_data; + + err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, FALSE, §or_data, §or_length); + if (err) + return err; + + crc_on_disk = sector_data[sector_length + 0]; + crc_on_disk <<= 8; + crc_on_disk += sector_data[sector_length + 1]; + + calculated_crc = ccitt_crc16(0xE295, sector_data, sector_length); + if (calculated_crc != crc_on_disk) + return FLOPPY_ERROR_INVALIDIMAGE; + + memcpy(buffer, sector_data, MIN(sector_length, buflen)); + + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t internal_coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam) +{ + floperr_t err; + UINT32 sector_length; + UINT8 *sector_data; + UINT16 crc; + + err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, TRUE, §or_data, §or_length); + if (err) + return err; + + if (buflen > sector_length) + return FLOPPY_ERROR_INTERNAL; + + memcpy(sector_data, buffer, buflen); + + crc = ccitt_crc16(0xE295, sector_data, sector_length); + sector_data[sector_length + 0] = crc >> 8; + sector_data[sector_length + 1] = crc >> 0; + return FLOPPY_ERROR_SUCCESS; +} + + + +static floperr_t coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen) +{ + return internal_coco_dmk_read_sector(floppy, head, track, sector, FALSE, buffer, buflen); +} + +static floperr_t coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) +{ + return internal_coco_dmk_write_sector(floppy, head, track, sector, FALSE, buffer, buflen, ddam); +} + +static floperr_t coco_dmk_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen) +{ + return internal_coco_dmk_read_sector(floppy, head, track, sector, TRUE, buffer, buflen); +} + +static floperr_t coco_dmk_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) +{ + return internal_coco_dmk_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam); +} + + + +static void coco_dmk_interpret_header(floppy_image_legacy *floppy, int *heads, int *tracks, int *track_size) +{ + UINT8 header[DMK_HEADER_LEN]; + + floppy_image_read(floppy, header, 0, DMK_HEADER_LEN); + + if (tracks) + *tracks = header[1]; + if (heads) + *heads = (header[4] & 0x10) ? 1 : 2; + if (track_size) + *track_size = ((int) header[3]) * 0x100 + header[2]; +} + + + +FLOPPY_CONSTRUCT(coco_dmk_construct) +{ + struct FloppyCallbacks *callbacks; + struct dmk_tag *tag; + UINT8 header[DMK_HEADER_LEN]; + int heads, tracks, track_size, sectors, sector_length; + + if (params) + { + heads = option_resolution_lookup_int(params, PARAM_HEADS); + tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + + track_size = coco_dmk_min_track_size(sectors, sector_length) + DMK_EXTRA_TRACK_LENGTH; + + memset(header, 0, sizeof(header)); + header[1] = tracks; + header[2] = track_size >> 0; + header[3] = track_size >> 8; + header[4] = (heads == 2) ? 0x00 : 0x10; + + floppy_image_write(floppy, header, 0, sizeof(header)); + } + else + { + coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); + } + + tag = (dmk_tag *)floppy_create_tag(floppy, sizeof(struct dmk_tag)); + if (!tag) + return FLOPPY_ERROR_OUTOFMEMORY; + tag->heads = heads; + tag->track_size = track_size; + tag->tracks = tracks; + + callbacks = floppy_callbacks(floppy); + callbacks->read_track = coco_dmk_read_track; + callbacks->write_track = coco_dmk_write_track; + callbacks->get_track_data_offset = coco_dmk_get_track_data_offset; + callbacks->format_track = coco_dmk_format_track; + callbacks->get_heads_per_disk = coco_dmk_get_heads_per_disk; + callbacks->get_tracks_per_disk = coco_dmk_get_tracks_per_disk; + callbacks->get_track_size = coco_dmk_get_track_size; + callbacks->get_sector_length = coco_dmk_get_sector_length; + callbacks->get_indexed_sector_info = coco_dmk_get_indexed_sector_info; + callbacks->read_sector = coco_dmk_read_sector; + callbacks->write_sector = coco_dmk_write_sector; + callbacks->read_indexed_sector = coco_dmk_read_indexed_sector; + callbacks->write_indexed_sector = coco_dmk_write_indexed_sector; + + return FLOPPY_ERROR_SUCCESS; +} + + + +FLOPPY_IDENTIFY(coco_dmk_identify) +{ + int heads, tracks, track_size; + UINT64 size, expected_size; + + size = floppy_image_size(floppy); + coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); + expected_size = DMK_HEADER_LEN + (heads * tracks * track_size); + *vote = (size == expected_size) ? 100 : 0; + return FLOPPY_ERROR_SUCCESS; +} + + + +/* ----------------------------------------------------------------------- */ + +LEGACY_FLOPPY_OPTIONS_START( coco ) + LEGACY_FLOPPY_OPTION( coco_jvc, "dsk", "CoCo JVC disk image", coco_jvc_identify, coco_jvc_construct, NULL, + HEADS([1]-2) + TRACKS([35]-255) + SECTORS(1-[18]-255) + SECTOR_LENGTH(128/[256]/512/1024) + FIRST_SECTOR_ID(0-[1])) + LEGACY_FLOPPY_OPTION( coco_os9, "os9", "CoCo OS-9 disk image", coco_os9_identify, coco_os9_construct, NULL, + HEADS([1]-2) + TRACKS([35]-255) + SECTORS(1-[18]-255) + SECTOR_LENGTH([256]) + FIRST_SECTOR_ID([1])) + LEGACY_FLOPPY_OPTION( coco_vdk, "vdk", "CoCo VDK disk image", coco_vdk_identify, coco_vdk_construct, NULL, + HEADS([1]-2) + TRACKS([35]-255) + SECTORS([18]) + SECTOR_LENGTH([256]) + FIRST_SECTOR_ID([1])) + LEGACY_FLOPPY_OPTION( coco_dmk, "dsk,dmk", "CoCo DMK disk image", coco_dmk_identify, coco_dmk_construct, NULL, + HEADS([1]-2) + TRACKS([35]-255) + SECTORS(1-[18]) + SECTOR_LENGTH(128/[256]/512/1024/2048/4096/8192) + INTERLEAVE(0-[6]-17) + FIRST_SECTOR_ID(0-[1])) +LEGACY_FLOPPY_OPTIONS_END diff --git a/src/mame/tools/imgtool/formats/coco_dsk.h b/src/mame/tools/imgtool/formats/coco_dsk.h new file mode 100644 index 00000000000..797911d40a1 --- /dev/null +++ b/src/mame/tools/imgtool/formats/coco_dsk.h @@ -0,0 +1,24 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/********************************************************************* + + formats/coco_dsk.h + + Tandy Color Computer / Dragon disk images + +*********************************************************************/ + +#ifndef COCO_DSK_H +#define COCO_DSK_H + +#include "formats/flopimg.h" + + +/**************************************************************************/ + +LEGACY_FLOPPY_OPTIONS_EXTERN(coco); + +FLOPPY_IDENTIFY(coco_dmk_identify); +FLOPPY_CONSTRUCT(coco_dmk_construct); + +#endif /* COCO_DSK_H */ diff --git a/src/mame/tools/imgtool/formats/vt_dsk.c b/src/mame/tools/imgtool/formats/vt_dsk.c new file mode 100644 index 00000000000..4e75e843d28 --- /dev/null +++ b/src/mame/tools/imgtool/formats/vt_dsk.c @@ -0,0 +1,57 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/********************************************************************* + + formats/vt_dsk.c + + VTech Laser/VZ disk images + +*********************************************************************/ + +#include +#include +#include +#include "formats/vt_dsk.h" +#include "formats/basicdsk.h" + +static FLOPPY_IDENTIFY(vz_identify) +{ + UINT64 size = floppy_image_size(floppy); + *vote = ((size == 98560) || (size == 99200) || (size == 99184)) ? 100 : 0; + return FLOPPY_ERROR_SUCCESS; +} + +static FLOPPY_CONSTRUCT(vz_construct) +{ + struct basicdsk_geometry geometry; + memset(&geometry, 0, sizeof(geometry)); + + if (params) + { + geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); + geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); + geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); + geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); + geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); + } + else + { + geometry.heads = 1; + geometry.tracks = 40; + geometry.sectors = 16; + geometry.first_sector_id = 0; + geometry.sector_length = floppy_image_size(floppy)/geometry.tracks/geometry.sectors; + } + + return basicdsk_construct(floppy, &geometry); +} + + +LEGACY_FLOPPY_OPTIONS_START(vz) + LEGACY_FLOPPY_OPTION(vtech1, "dsk", "Laser/VZ disk image", vz_identify, vz_construct, NULL, + HEADS([1]) + TRACKS([40]) + SECTORS([16]) + SECTOR_LENGTH([154]) + FIRST_SECTOR_ID([0])) +LEGACY_FLOPPY_OPTIONS_END diff --git a/src/mame/tools/imgtool/formats/vt_dsk.h b/src/mame/tools/imgtool/formats/vt_dsk.h new file mode 100644 index 00000000000..a3f9a86b44e --- /dev/null +++ b/src/mame/tools/imgtool/formats/vt_dsk.h @@ -0,0 +1,18 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/********************************************************************* + + formats/vt_dsk.h + + Tandy Color Computer / Dragon disk images + +*********************************************************************/ + +#ifndef VT_DSK_H +#define VT_DSK_H + +#include "formats/flopimg.h" + +LEGACY_FLOPPY_OPTIONS_EXTERN(vz); + +#endif /* VT_DSK_H */ diff --git a/src/mame/tools/imgtool/iflopimg.c b/src/mame/tools/imgtool/iflopimg.c new file mode 100644 index 00000000000..9e8493f9477 --- /dev/null +++ b/src/mame/tools/imgtool/iflopimg.c @@ -0,0 +1,363 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/********************************************************************* + + iflopimg.c + + Bridge code for Imgtool into the standard floppy code + +*********************************************************************/ + +#include "imgtool.h" +#include "formats/flopimg.h" +#include "library.h" +#include "iflopimg.h" + +imgtoolerr_t imgtool_floppy_error(floperr_t err) +{ + switch(err) + { + case FLOPPY_ERROR_SUCCESS: + return IMGTOOLERR_SUCCESS; + + case FLOPPY_ERROR_OUTOFMEMORY: + return IMGTOOLERR_OUTOFMEMORY; + + case FLOPPY_ERROR_INVALIDIMAGE: + return IMGTOOLERR_CORRUPTIMAGE; + + case FLOPPY_ERROR_SEEKERROR: + return IMGTOOLERR_SEEKERROR; + + case FLOPPY_ERROR_UNSUPPORTED: + return IMGTOOLERR_UNIMPLEMENTED; + + default: + return IMGTOOLERR_UNEXPECTED; + } +} + + + +/********************************************************************* + Imgtool ioprocs +*********************************************************************/ + +static void imgtool_floppy_closeproc(void *file) +{ + stream_close((imgtool_stream *) file); +} + +static int imgtool_floppy_seekproc(void *file, INT64 offset, int whence) +{ + stream_seek((imgtool_stream *) file, offset, whence); + return 0; +} + +static size_t imgtool_floppy_readproc(void *file, void *buffer, size_t length) +{ + return stream_read((imgtool_stream *) file, buffer, length); +} + +static size_t imgtool_floppy_writeproc(void *file, const void *buffer, size_t length) +{ + stream_write((imgtool_stream *) file, buffer, length); + return length; +} + +static UINT64 imgtool_floppy_filesizeproc(void *file) +{ + return stream_size((imgtool_stream *) file); +} + +static const struct io_procs imgtool_ioprocs = +{ + imgtool_floppy_closeproc, + imgtool_floppy_seekproc, + imgtool_floppy_readproc, + imgtool_floppy_writeproc, + imgtool_floppy_filesizeproc +}; + +static const struct io_procs imgtool_noclose_ioprocs = +{ + NULL, + imgtool_floppy_seekproc, + imgtool_floppy_readproc, + imgtool_floppy_writeproc, + imgtool_floppy_filesizeproc +}; + + + +/********************************************************************* + Imgtool handlers +*********************************************************************/ + +struct imgtool_floppy_image +{ + floppy_image_legacy *floppy; +}; + + + + +static imgtoolerr_t imgtool_floppy_open_internal(imgtool_image *image, imgtool_stream *f, int noclose) +{ + floperr_t ferr; + imgtoolerr_t err; + struct imgtool_floppy_image *fimg; + const imgtool_class *imgclass; + const struct FloppyFormat *format; + imgtoolerr_t (*open)(imgtool_image *image, imgtool_stream *f); + + fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(image); + imgclass = &imgtool_image_module(image)->imgclass; + format = (const struct FloppyFormat *) imgclass->derived_param; + open = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_OPEN); + + /* open up the floppy */ + ferr = floppy_open(f, noclose ? &imgtool_noclose_ioprocs : &imgtool_ioprocs, + NULL, format, FLOPPY_FLAGS_READWRITE, &fimg->floppy); + if (ferr) + { + err = imgtool_floppy_error(ferr); + return err; + } + + if (open) + { + err = open(image, NULL); + if (err) + return err; + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t imgtool_floppy_open(imgtool_image *image, imgtool_stream *f) +{ + return imgtool_floppy_open_internal(image, f, FALSE); +} + + + +static imgtoolerr_t imgtool_floppy_create(imgtool_image *image, imgtool_stream *f, option_resolution *opts) +{ + floperr_t ferr; + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + struct imgtool_floppy_image *fimg; + const imgtool_class *imgclass; + const struct FloppyFormat *format; + imgtoolerr_t (*create)(imgtool_image *, imgtool_stream *, option_resolution *); + imgtoolerr_t (*open)(imgtool_image *image, imgtool_stream *f); + + fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(image); + imgclass = &imgtool_image_module(image)->imgclass; + format = (const struct FloppyFormat *) imgclass->derived_param; + create = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *, option_resolution *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_CREATE); + open = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_OPEN); + + /* open up the floppy */ + ferr = floppy_create(f, &imgtool_ioprocs, format, opts, &fimg->floppy); + if (ferr) + { + err = imgtool_floppy_error(ferr); + goto done; + } + + /* do we have to do extra stuff when creating the image? */ + if (create) + { + err = create(image, NULL, opts); + if (err) + goto done; + } + + /* do we have to do extra stuff when opening the image? */ + if (open) + { + err = open(image, NULL); + if (err) + goto done; + } + +done: + return err; +} + + + +static void imgtool_floppy_close(imgtool_image *img) +{ + floppy_close(imgtool_floppy(img)); +} + + + +static imgtoolerr_t imgtool_floppy_get_sector_size(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size) +{ + floperr_t ferr; + + ferr = floppy_get_sector_length(imgtool_floppy(image), head, track, sector, sector_size); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t imgtool_floppy_read_sector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len) +{ + floperr_t ferr; + + ferr = floppy_read_sector(imgtool_floppy(image), head, track, sector, 0, buffer, len); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t imgtool_floppy_write_sector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam) +{ + floperr_t ferr; + + ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, len, ddam); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static void imgtool_floppy_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + const struct FloppyFormat *format; + imgtool_class derived_class; + + format = (const struct FloppyFormat *) imgclass->derived_param; + memset(&derived_class, 0, sizeof(derived_class)); + derived_class.get_info = imgclass->derived_get_info; + + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: + info->i = sizeof(struct imgtool_floppy_image) + + imgtool_get_info_int(&derived_class, IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES); + break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: + sprintf(info->s = imgtool_temp_str(), "%s_%s", format->name, + imgtool_get_info_string(&derived_class, IMGTOOLINFO_STR_NAME)); + break; + case IMGTOOLINFO_STR_DESCRIPTION: + sprintf(info->s = imgtool_temp_str(), "%s (%s)", format->description, + imgtool_get_info_string(&derived_class, IMGTOOLINFO_STR_DESCRIPTION)); + break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), format->extensions); break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: info->p = (void*)format->param_guidelines; break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_OPEN: info->open = imgtool_floppy_open; break; + case IMGTOOLINFO_PTR_CREATE: info->create = imgtool_floppy_create; break; + case IMGTOOLINFO_PTR_CLOSE: info->close = imgtool_floppy_close; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = format->param_guidelines ? floppy_option_guide : NULL; break; + case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = imgtool_floppy_get_sector_size; break; + case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = imgtool_floppy_read_sector; break; + case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = imgtool_floppy_write_sector; break; + + default: imgclass->derived_get_info(imgclass, state, info); break; + } +} + + + +int imgtool_floppy_make_class(int index, imgtool_class *imgclass) +{ + const struct FloppyFormat *format; + + /* get the format */ + format = (const struct FloppyFormat *) + imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_FORMAT); + assert(format); + if (!format[index].construct) + return FALSE; + + imgclass->derived_get_info = imgclass->get_info; + imgclass->get_info = imgtool_floppy_get_info; + imgclass->derived_param = (void *) &format[index]; + return TRUE; +} + + + +floppy_image_legacy *imgtool_floppy(imgtool_image *img) +{ + struct imgtool_floppy_image *fimg; + fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(img); + return fimg->floppy; +} + + + +static imgtoolerr_t imgtool_floppy_transfer_sector_tofrom_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f, int direction) +{ + floperr_t err; + floppy_image_legacy *floppy; + dynamic_buffer buffer; + + floppy = imgtool_floppy(img); + + buffer.resize(length); + + if (direction) + { + err = floppy_read_sector(floppy, head, track, sector, offset, &buffer[0], length); + if (err) + goto done; + stream_write(f, &buffer[0], length); + } + else + { + stream_read(f, &buffer[0], length); + err = floppy_write_sector(floppy, head, track, sector, offset, &buffer[0], length, 0); /* TODO: pass ddam argument from imgtool */ + if (err) + goto done; + } + + err = FLOPPY_ERROR_SUCCESS; + +done: + return imgtool_floppy_error(err); +} + + + +imgtoolerr_t imgtool_floppy_read_sector_to_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f) +{ + return imgtool_floppy_transfer_sector_tofrom_stream(img, head, track, sector, offset, length, f, 1); +} + + + +imgtoolerr_t imgtool_floppy_write_sector_from_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f) +{ + return imgtool_floppy_transfer_sector_tofrom_stream(img, head, track, sector, offset, length, f, 0); +} + + + +void *imgtool_floppy_extrabytes(imgtool_image *img) +{ + struct imgtool_floppy_image *fimg; + fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(img); + return fimg + 1; +} diff --git a/src/mame/tools/imgtool/iflopimg.h b/src/mame/tools/imgtool/iflopimg.h new file mode 100644 index 00000000000..8e298330845 --- /dev/null +++ b/src/mame/tools/imgtool/iflopimg.h @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/********************************************************************* + + iflopimg.h + + Bridge code for Imgtool into the standard floppy code + +*********************************************************************/ + +#ifndef IFLOPIMG_H +#define IFLOPIMG_H + +#include "formats/flopimg.h" +#include "library.h" + +/*************************************************************************** + + Prototypes + +***************************************************************************/ + +enum +{ + IMGTOOLINFO_PTR_FLOPPY_FORMAT = IMGTOOLINFO_PTR_CLASS_SPECIFIC, + IMGTOOLINFO_PTR_FLOPPY_OPEN, + IMGTOOLINFO_PTR_FLOPPY_CREATE +}; + +int imgtool_floppy_make_class(int index, imgtool_class *imgclass); + +floppy_image_legacy *imgtool_floppy(imgtool_image *img); +imgtoolerr_t imgtool_floppy_error(floperr_t err); + +imgtoolerr_t imgtool_floppy_read_sector_to_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f); +imgtoolerr_t imgtool_floppy_write_sector_from_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f); + + +void *imgtool_floppy_extrabytes(imgtool_image *img); + +#endif /* IFLOPIMG_H */ diff --git a/src/mame/tools/imgtool/imghd.c b/src/mame/tools/imgtool/imghd.c new file mode 100644 index 00000000000..8ac129751f9 --- /dev/null +++ b/src/mame/tools/imgtool/imghd.c @@ -0,0 +1,273 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet +/* + Code to interface the MESS image code with MAME's harddisk core. + + We do not support diff files as it will involve some changes in the MESS + image code. + + Raphael Nabet 2003 +*/ + +#include "imgtool.h" +#include "harddisk.h" +#include "imghd.h" + + +static imgtoolerr_t map_chd_error(chd_error chderr) +{ + imgtoolerr_t err; + + switch(chderr) + { + case CHDERR_NONE: + err = IMGTOOLERR_SUCCESS; + break; + case CHDERR_OUT_OF_MEMORY: + err = IMGTOOLERR_OUTOFMEMORY; + break; + case CHDERR_FILE_NOT_WRITEABLE: + err = IMGTOOLERR_READONLY; + break; + case CHDERR_NOT_SUPPORTED: + err = IMGTOOLERR_UNIMPLEMENTED; + break; + default: + err = IMGTOOLERR_UNEXPECTED; + break; + } + return err; +} + + + +/* + imghd_create() + + Create a MAME HD image +*/ +imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 hunksize, UINT32 cylinders, UINT32 heads, UINT32 sectors, UINT32 seclen) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + dynamic_buffer cache; + chd_file chd; + chd_error rc; + UINT64 logicalbytes; + int hunknum, totalhunks; + std::string metadata; + chd_codec_type compression[4] = { CHD_CODEC_NONE }; + + /* sanity check args */ + if (hunksize >= 2048) + { + err = IMGTOOLERR_PARAMCORRUPT; + goto done; + } + if (hunksize <= 0) + hunksize = 1024; /* default value */ + + /* bail if we are read only */ + if (stream_isreadonly(stream)) + { + err = IMGTOOLERR_READONLY; + goto done; + } + + /* calculations */ + logicalbytes = (UINT64)cylinders * heads * sectors * seclen; + + /* create the new hard drive */ + rc = chd.create(*stream_core_file(stream), logicalbytes, hunksize, seclen, compression); + if (rc != CHDERR_NONE) + { + err = map_chd_error(rc); + goto done; + } + + /* open the new hard drive */ + rc = chd.open(*stream_core_file(stream)); + + if (rc != CHDERR_NONE) + { + err = map_chd_error(rc); + goto done; + } + + /* write the metadata */ + strprintf(metadata,HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen); + err = (imgtoolerr_t)chd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata); + if (rc != CHDERR_NONE) + { + err = map_chd_error(rc); + goto done; + } + + /* alloc and zero buffer */ + cache.resize(hunksize); + memset(&cache[0], 0, hunksize); + + /* zero out every hunk */ + totalhunks = (logicalbytes + hunksize - 1) / hunksize; + for (hunknum = 0; hunknum < totalhunks; hunknum++) + { + rc = chd.write_units(hunknum, &cache[0]); + if (rc) + { + err = IMGTOOLERR_WRITEERROR; + goto done; + } + } + +done: + return err; +} + + + +/* + imghd_open() + + Open stream as a MAME HD image +*/ +imgtoolerr_t imghd_open(imgtool_stream *stream, struct mess_hard_disk_file *hard_disk) +{ + chd_error chderr; + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + + hard_disk->hard_disk = NULL; + hard_disk->chd = NULL; + + chderr = hard_disk->chd->open(*stream_core_file(stream), stream_isreadonly(stream)); + if (chderr) + { + err = map_chd_error(chderr); + goto done; + } + + hard_disk->hard_disk = hard_disk_open(hard_disk->chd); + if (!hard_disk->hard_disk) + { + err = IMGTOOLERR_UNEXPECTED; + goto done; + } + hard_disk->stream = stream; + +done: + if (err) + imghd_close(hard_disk); + return err; +} + + + +/* + imghd_close() + + Close MAME HD image +*/ +void imghd_close(struct mess_hard_disk_file *disk) +{ + if (disk->hard_disk) + { + hard_disk_close(disk->hard_disk); + disk->hard_disk = NULL; + } + if (disk->stream) + stream_close(disk->stream); +} + + + +/* + imghd_read() + + Read sector(s) from MAME HD image +*/ +imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, UINT32 lbasector, void *buffer) +{ + UINT32 reply; + reply = hard_disk_read(disk->hard_disk, lbasector, buffer); + return (imgtoolerr_t)(reply ? IMGTOOLERR_SUCCESS : map_chd_error((chd_error)reply)); +} + + + +/* + imghd_write() + + Write sector(s) from MAME HD image +*/ +imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, UINT32 lbasector, const void *buffer) +{ + UINT32 reply; + reply = hard_disk_write(disk->hard_disk, lbasector, buffer); + return (imgtoolerr_t)(reply ? IMGTOOLERR_SUCCESS : map_chd_error((chd_error)reply)); +} + + + +/* + imghd_get_header() + + Return pointer to the header of MAME HD image +*/ +const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk) +{ + const hard_disk_info *reply; + reply = hard_disk_get_info(disk->hard_disk); + return reply; +} + + +static imgtoolerr_t mess_hd_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions); + +enum +{ + mess_hd_createopts_blocksize = 'B', + mess_hd_createopts_cylinders = 'C', + mess_hd_createopts_heads = 'D', + mess_hd_createopts_sectors = 'E', + mess_hd_createopts_seclen = 'F' +}; + +static OPTION_GUIDE_START( mess_hd_create_optionguide ) + OPTION_INT(mess_hd_createopts_blocksize, "blocksize", "Sectors Per Block" ) + OPTION_INT(mess_hd_createopts_cylinders, "cylinders", "Cylinders" ) + OPTION_INT(mess_hd_createopts_heads, "heads", "Heads" ) + OPTION_INT(mess_hd_createopts_sectors, "sectors", "Total Sectors" ) + OPTION_INT(mess_hd_createopts_seclen, "seclen", "Sector Bytes" ) +OPTION_GUIDE_END + +#define mess_hd_create_optionspecs "B[1]-2048;C1-[32]-65536;D1-[8]-64;E1-[128]-4096;F128/256/[512]/1024/2048/4096/8192/16384/32768/65536" + + +void hd_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mess_hd"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "MESS hard disk image"); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break; + + case IMGTOOLINFO_PTR_CREATE: info->create = mess_hd_image_create; break; + + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = mess_hd_create_optionguide; break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), mess_hd_create_optionspecs); break; + } +} + + + +static imgtoolerr_t mess_hd_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions) +{ + UINT32 blocksize, cylinders, heads, sectors, seclen; + + /* read options */ + blocksize = option_resolution_lookup_int(createoptions, mess_hd_createopts_blocksize); + cylinders = option_resolution_lookup_int(createoptions, mess_hd_createopts_cylinders); + heads = option_resolution_lookup_int(createoptions, mess_hd_createopts_heads); + sectors = option_resolution_lookup_int(createoptions, mess_hd_createopts_sectors); + seclen = option_resolution_lookup_int(createoptions, mess_hd_createopts_seclen); + + return imghd_create(f, blocksize, cylinders, heads, sectors, seclen); +} diff --git a/src/mame/tools/imgtool/imghd.h b/src/mame/tools/imgtool/imghd.h new file mode 100644 index 00000000000..3dba7d40d4f --- /dev/null +++ b/src/mame/tools/imgtool/imghd.h @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/**************************************************************************** + + imghd.h + + Bridge between Imgtool and CHD hard disk images + +****************************************************************************/ + +#ifndef IMGHD_H +#define IMGHD_H + +#include "harddisk.h" + +struct mess_hard_disk_file +{ + imgtool_stream *stream; + hard_disk_file *hard_disk; + chd_file *chd; +}; + + +/* create a new hard disk */ +imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 blocksize, UINT32 cylinders, UINT32 heads, UINT32 sectors, UINT32 seclen); + +/* opens a hard disk given an Imgtool stream */ +imgtoolerr_t imghd_open(imgtool_stream *stream, struct mess_hard_disk_file *hard_disk); + +/* close a hard disk */ +void imghd_close(struct mess_hard_disk_file *disk); + +/* reads data from a hard disk */ +imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, UINT32 lbasector, void *buffer); + +/* writes data to a hard disk */ +imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, UINT32 lbasector, const void *buffer); + +/* gets the header from a hard disk */ +const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk); + +#endif /* IMGHD_H */ diff --git a/src/mame/tools/imgtool/imgterrs.c b/src/mame/tools/imgtool/imgterrs.c new file mode 100644 index 00000000000..bd679440309 --- /dev/null +++ b/src/mame/tools/imgtool/imgterrs.c @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + imgterrs.c + + Imgtool errors + +***************************************************************************/ + +#include "imgtool.h" +#include "imgterrs.h" +#include "osdcomm.h" + +static const char *const msgs[] = +{ + "Out of memory", + "Unexpected error", + "Argument too long", + "Read error", + "Write error", + "Image is read only", + "Corrupt image", + "Corrupt file", + "Corrupt directory", + "File not found", + "Unrecognized format", + "Not implemented", + "Parameter too small", + "Parameter too large", + "Missing parameter not found", + "Inappropriate parameter", + "Invalid parameter", + "Bad file name", + "Out of space on image", + "Input past end of file", + "Cannot specify path", + "Invalid path", + "Path not found", + "Directory not empty", + "Seek error", + "File system does not support forks", + "Fork not found", + "Invalid partition" +}; + + + +const char *imgtool_error(imgtoolerr_t err) +{ + err = (imgtoolerr_t)(ERRORCODE(err) - 1); + assert(err >= 0); + assert(err < ARRAY_LENGTH(msgs)); + return msgs[err]; +} diff --git a/src/mame/tools/imgtool/imgterrs.h b/src/mame/tools/imgtool/imgterrs.h new file mode 100644 index 00000000000..1cdafb6cef2 --- /dev/null +++ b/src/mame/tools/imgtool/imgterrs.h @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + imgterrs.h + + Imgtool errors + +***************************************************************************/ + +#ifndef IMGTERRS_H +#define IMGTERRS_H + +/* Error codes */ +enum imgtoolerr_t +{ + IMGTOOLERR_SUCCESS, + IMGTOOLERR_OUTOFMEMORY, + IMGTOOLERR_UNEXPECTED, + IMGTOOLERR_BUFFERTOOSMALL, + IMGTOOLERR_READERROR, + IMGTOOLERR_WRITEERROR, + IMGTOOLERR_READONLY, + IMGTOOLERR_CORRUPTIMAGE, + IMGTOOLERR_CORRUPTFILE, + IMGTOOLERR_CORRUPTDIR, + IMGTOOLERR_FILENOTFOUND, + IMGTOOLERR_MODULENOTFOUND, + IMGTOOLERR_UNIMPLEMENTED, + IMGTOOLERR_PARAMTOOSMALL, + IMGTOOLERR_PARAMTOOLARGE, + IMGTOOLERR_PARAMNEEDED, + IMGTOOLERR_PARAMNOTNEEDED, + IMGTOOLERR_PARAMCORRUPT, + IMGTOOLERR_BADFILENAME, + IMGTOOLERR_NOSPACE, + IMGTOOLERR_INPUTPASTEND, + IMGTOOLERR_CANNOTUSEPATH, + IMGTOOLERR_INVALIDPATH, + IMGTOOLERR_PATHNOTFOUND, + IMGTOOLERR_DIRNOTEMPTY, + IMGTOOLERR_SEEKERROR, + IMGTOOLERR_NOFORKS, + IMGTOOLERR_FORKNOTFOUND, + IMGTOOLERR_INVALIDPARTITION +}; + + + +/* These error codes are actually modifiers that make it easier to distinguish + * the cause of an error + * + * Note - drivers should not use these modifiers + */ +#define IMGTOOLERR_SRC_MODULE 0x1000 +#define IMGTOOLERR_SRC_FUNCTIONALITY 0x2000 +#define IMGTOOLERR_SRC_IMAGEFILE 0x3000 +#define IMGTOOLERR_SRC_FILEONIMAGE 0x4000 +#define IMGTOOLERR_SRC_NATIVEFILE 0x5000 + +#define ERRORCODE(err) ((err) & 0x0fff) +#define ERRORSOURCE(err) ((err) & 0xf000) +#define ERRORPARAM(err) (((err) & 0xf0000) / 0x10000) + +#define PARAM_TO_ERROR(errcode, param) ((errcode) | ((param) * 0x10000)) + + +const char *imgtool_error(imgtoolerr_t err); + +#endif /* IMGTERRS_H */ diff --git a/src/mame/tools/imgtool/imgtool.c b/src/mame/tools/imgtool/imgtool.c new file mode 100644 index 00000000000..df44a9bbff2 --- /dev/null +++ b/src/mame/tools/imgtool/imgtool.c @@ -0,0 +1,2814 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + imgtool.c + + Core code for Imgtool + +***************************************************************************/ + +#include +#include + +#include "imgtool.h" +#include "formats/imageutl.h" +#include "library.h" +#include "modules.h" +#include "pool.h" + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +struct imgtool_image +{ + const imgtool_module *module; + object_pool *pool; +}; + +struct imgtool_partition +{ + imgtool_image *image; + object_pool *pool; + int partition_index; + UINT64 base_block; + UINT64 block_count; + + imgtool_class imgclass; + size_t partition_extra_bytes; + size_t directory_extra_bytes; + + char path_separator; + char alternate_path_separator; + + unsigned int prefer_ucase : 1; + unsigned int supports_creation_time : 1; + unsigned int supports_lastmodified_time : 1; + unsigned int supports_bootblock : 1; /* this module supports loading/storing the boot block */ + + imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path); + imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent); + void (*close_enum) (imgtool_directory *enumeration); + imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size); + imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); + imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts); + imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename); + imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len); + imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path); + imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path); + imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len); + imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values); + imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values); + imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len); + imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo); + imgtoolerr_t (*suggest_transfer)(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length); + imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size); + + const option_guide *writefile_optguide; + const char *writefile_optspec; +}; + +struct imgtool_directory +{ + imgtool_partition *partition; +}; + + + +/*************************************************************************** + GLOBALS +***************************************************************************/ + +static imgtool_library *global_imgtool_library; + +static int global_omit_untested; +static void (*global_warn)(const char *message); + + +void CLIB_DECL ATTR_PRINTF(1,2) logerror(const char *format, ...) +{ + va_list arg; + va_start(arg, format); + vprintf(format, arg); + va_end(arg); +} + +/*************************************************************************** + + Imgtool initialization and basics + +***************************************************************************/ +void rtrim(char *buf) +{ + size_t buflen; + char *s; + + buflen = strlen(buf); + if (buflen) + { + for (s = &buf[buflen-1]; s >= buf && (*s >= '\0') && isspace(*s); s--) + *s = '\0'; + } +} + +char *strncpyz(char *dest, const char *source, size_t len) +{ + char *s; + if (len) { + s = strncpy(dest, source, len - 1); + dest[len-1] = '\0'; + } + else { + s = dest; + } + return s; +} + +char *strncatz(char *dest, const char *source, size_t len) +{ + size_t l; + l = strlen(dest); + dest += l; + if (len > l) + len -= l; + else + len = 0; + return strncpyz(dest, source, len); +} + +/*------------------------------------------------- + markerrorsource - marks where an error source +-------------------------------------------------*/ + +static imgtoolerr_t markerrorsource(imgtoolerr_t err) +{ + switch(err) + { + case IMGTOOLERR_OUTOFMEMORY: + case IMGTOOLERR_UNEXPECTED: + case IMGTOOLERR_BUFFERTOOSMALL: + /* Do nothing */ + break; + + case IMGTOOLERR_FILENOTFOUND: + case IMGTOOLERR_BADFILENAME: + err = (imgtoolerr_t)(err | IMGTOOLERR_SRC_FILEONIMAGE); + break; + + default: + err = (imgtoolerr_t)(err | IMGTOOLERR_SRC_IMAGEFILE); + break; + } + return err; +} + +char *imgtool_basename(char *filename) +{ + char *c; + + // NULL begets NULL + if (!filename) + return NULL; + + // start at the end and return when we hit a slash or colon + for (c = filename + strlen(filename) - 1; c >= filename; c--) + if (*c == '\\' || *c == '/' || *c == ':') + return c + 1; + + // otherwise, return the whole thing + return filename; +} + +/*------------------------------------------------- + internal_error - debug function for raising + internal errors +-------------------------------------------------*/ + +static void internal_error(const imgtool_module *module, const char *message) +{ +#ifdef MAME_DEBUG + printf("%s: %s\n", module->name, message); +#endif +} + + +/*------------------------------------------------- + normalize_filename - convert a filename to the + native format used by the module +-------------------------------------------------*/ + +static char *normalize_filename(imgtool_partition *partition, const char *src) +{ + imgtool_charset charset; + + /* get charset from module */ + charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); + + /* and dupe it */ + return native_from_utf8(charset, src); +} + + + +/*------------------------------------------------- + imgtool_init - initializes the imgtool core +-------------------------------------------------*/ + +void imgtool_init(int omit_untested, void (*warn)(const char *message)) +{ + imgtoolerr_t err; + err = imgtool_create_cannonical_library(omit_untested, &global_imgtool_library); + assert(err == IMGTOOLERR_SUCCESS); + if (err == IMGTOOLERR_SUCCESS) + { + imgtool_library_sort(global_imgtool_library, ITLS_DESCRIPTION); + } + global_omit_untested = omit_untested; + global_warn = warn; +} + + + +/*------------------------------------------------- + imgtool_exit - closes out the imgtool core +-------------------------------------------------*/ + +void imgtool_exit(void) +{ + if (global_imgtool_library) + { + imgtool_library_close(global_imgtool_library); + global_imgtool_library = NULL; + } + global_warn = NULL; +} + + + +/*------------------------------------------------- + imgtool_find_module - looks up a module +-------------------------------------------------*/ + +const imgtool_module *imgtool_find_module(const char *modulename) +{ + return imgtool_library_findmodule(global_imgtool_library, modulename); +} + + + +/*------------------------------------------------- + imgtool_get_module_features - retrieves a + structure identifying this module's features + associated with an image +-------------------------------------------------*/ + +imgtool_module_features imgtool_get_module_features(const imgtool_module *module) +{ + imgtool_module_features features; + memset(&features, 0, sizeof(features)); + + if (module->create) + features.supports_create = 1; + if (module->open) + features.supports_open = 1; + if (module->read_sector) + features.supports_readsector = 1; + if (module->write_sector) + features.supports_writesector = 1; + return features; +} + + + +/*------------------------------------------------- + imgtool_warn - issues a warning +-------------------------------------------------*/ + +void imgtool_warn(const char *format, ...) +{ + va_list va; + char buffer[2000]; + + if (global_warn) + { + va_start(va, format); + vsprintf(buffer, format, va); + va_end(va); + global_warn(buffer); + } +} + + + +/*------------------------------------------------- + evaluate_module - evaluates a single file to + determine what module can best handle a file +-------------------------------------------------*/ + +static imgtoolerr_t evaluate_module(const char *fname, + const imgtool_module *module, float *result) +{ + imgtoolerr_t err; + imgtool_image *image = NULL; + imgtool_partition *partition = NULL; + imgtool_directory *imageenum = NULL; + imgtool_dirent ent; + float current_result; + + *result = 0.0; + + err = imgtool_image_open(module, fname, OSD_FOPEN_READ, &image); + if (err) + goto done; + + if (image) + { + current_result = module->open_is_strict ? 0.9 : 0.5; + + err = imgtool_partition_open(image, 0, &partition); + if (err) + goto done; + + err = imgtool_directory_open(partition, NULL, &imageenum); + if (err) + goto done; + + memset(&ent, 0, sizeof(ent)); + do + { + err = imgtool_directory_get_next(imageenum, &ent); + if (err) + goto done; + + if (ent.corrupt) + current_result = (current_result * 99 + 1.00f) / 100; + else + current_result = (current_result + 1.00f) / 2; + } + while(!ent.eof); + + *result = current_result; + } + +done: + if (ERRORCODE(err) == IMGTOOLERR_CORRUPTIMAGE) + err = IMGTOOLERR_SUCCESS; + if (imageenum) + imgtool_directory_close(imageenum); + if (partition) + imgtool_partition_close(partition); + if (image) + imgtool_image_close(image); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_image - retrieves the image + associated with this partition +-------------------------------------------------*/ + +imgtool_image *imgtool_partition_image(imgtool_partition *partition) +{ + return partition->image; +} + + + +/*------------------------------------------------- + imgtool_identify_file - attempts to determine the module + for any given image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules, size_t count) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + imgtool_library *library = global_imgtool_library; + imgtool_module *module = NULL; + imgtool_module *insert_module; + imgtool_module *temp_module; + size_t i = 0; + const char *extension; + float val, temp_val, *values = NULL; + + if (count <= 0) + { + err = IMGTOOLERR_UNEXPECTED; + goto done; + } + + for (i = 0; i < count; i++) + modules[i] = NULL; + if (count > 1) + count--; /* null terminate */ + + values = (float *) malloc(count * sizeof(*values)); + if (!values) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + for (i = 0; i < count; i++) + values[i] = 0.0; + + /* figure out the file extension, if any */ + extension = strrchr(fname, '.'); + if (extension) + extension++; + + /* iterate through all modules */ + while((module = imgtool_library_iterate(library, module)) != NULL) + { + if (!extension || image_find_extension(module->extensions, extension)) + { + err = evaluate_module(fname, module, &val); + if (err) + goto done; + + insert_module = module; + for (i = 0; (val > 0.0f) && (i < count); i++) + { + if (val > values[i]) + { + temp_val = values[i]; + temp_module = modules[i]; + values[i] = val; + modules[i] = insert_module; + val = temp_val; + insert_module = temp_module; + } + } + } + } + + if (!modules[0]) + err = (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_IMAGEFILE); + +done: + if (values) + free(values); + return err; +} + + + +/*------------------------------------------------- + imgtool_image_get_sector_size - gets the size + of a particular sector on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_get_sector_size(imgtool_image *image, UINT32 track, UINT32 head, + UINT32 sector, UINT32 *length) +{ + /* implemented? */ + if (!image->module->get_sector_size) + return (imgtoolerr_t )(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + return image->module->get_sector_size(image, track, head, sector, length); +} + + + +/*------------------------------------------------- + imgtool_image_get_geometry - gets the geometry + of an image; note that this may disagree with + particular sectors; this is a common copy + protection scheme +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors) +{ + UINT32 dummy; + + /* some sanitization, to make the callbacks easier to implement */ + if (!tracks) + tracks = &dummy; + if (!heads) + heads = &dummy; + if (!sectors) + sectors = &dummy; + *tracks = 0; + *heads = 0; + *sectors = 0; + + /* implemented? */ + if (!image->module->get_geometry) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + return image->module->get_geometry(image, tracks, heads, sectors); +} + + + +/*------------------------------------------------- + imgtool_image_read_sector - reads a sector on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_read_sector(imgtool_image *image, UINT32 track, UINT32 head, + UINT32 sector, void *buffer, size_t len) +{ + /* implemented? */ + if (!image->module->read_sector) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + return image->module->read_sector(image, track, head, sector, buffer, len); +} + + + +/*------------------------------------------------- + imgtool_image_write_sector - writes a sector on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_write_sector(imgtool_image *image, UINT32 track, UINT32 head, + UINT32 sector, const void *buffer, size_t len) +{ + /* implemented? */ + if (!image->module->write_sector) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + return image->module->write_sector(image, track, head, sector, buffer, len); +} + + + +/*------------------------------------------------- + imgtool_image_get_block_size - gets the size of + a standard block on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_get_block_size(imgtool_image *image, UINT32 *length) +{ + /* implemented? */ + if (image->module->block_size == 0) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + *length = image->module->block_size; + return IMGTOOLERR_SUCCESS; +} + + + +/*------------------------------------------------- + imgtool_image_read_block - reads a standard + block on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_read_block(imgtool_image *image, UINT64 block, void *buffer) +{ + /* implemented? */ + if (!image->module->read_block) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + return image->module->read_block(image, buffer, block); +} + + + +/*------------------------------------------------- + imgtool_image_write_block - writes a standard + block on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_write_block(imgtool_image *image, UINT64 block, const void *buffer) +{ + /* implemented? */ + if (!image->module->write_block) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + return image->module->write_block(image, buffer, block); +} + + + +/*------------------------------------------------- + imgtool_image_clear_block - clears a standard + block on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_clear_block(imgtool_image *image, UINT64 block, UINT8 data) +{ + imgtoolerr_t err; + UINT8 *block_data = NULL; + UINT32 length; + + err = imgtool_image_get_block_size(image, &length); + if (err) + goto done; + + block_data = (UINT8*)malloc(length); + if (!block_data) + { + err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; + goto done; + } + memset(block_data, data, length); + + err = imgtool_image_write_block(image, block, block_data); + if (err) + goto done; + +done: + if (block_data) + free(block_data); + return err; +} + + + +/*------------------------------------------------- + imgtool_image_list_partitions - lists the + partitions on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_list_partitions(imgtool_image *image, imgtool_partition_info *partitions, size_t len) +{ + /* implemented? */ + if (!image->module->list_partitions) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + memset(partitions, '\0', sizeof(*partitions) * len); + return image->module->list_partitions(image, partitions, len); +} + + + +/*------------------------------------------------- + imgtool_image_malloc - allocates memory associated with an + image +-------------------------------------------------*/ + +void *imgtool_image_malloc(imgtool_image *image, size_t size) +{ + return pool_malloc_lib(image->pool, size); +} + + + +/*------------------------------------------------- + imgtool_image_module - returns the module associated with + this image +-------------------------------------------------*/ + +const imgtool_module *imgtool_image_module(imgtool_image *img) +{ + return img->module; +} + + + +/*------------------------------------------------- + imgtool_image_extra_bytes - returns extra bytes on an image +-------------------------------------------------*/ + +void *imgtool_image_extra_bytes(imgtool_image *image) +{ + void *ptr = NULL; + if (image->module->image_extra_bytes > 0) + ptr = ((UINT8 *) image) + sizeof(*image); + assert(ptr); + return ptr; +} + + + +/*------------------------------------------------- + imgtool_image_rand - returns a random number +-------------------------------------------------*/ + +UINT64 imgtool_image_rand(imgtool_image *image) +{ + /* we can't use mame_rand() here */ +#ifdef rand +#undef rand +#endif + return ((UINT64) rand()) << 32 + | ((UINT64) rand()) << 0; +} + + + +/*************************************************************************** + + Imgtool partition management + +***************************************************************************/ + +static char *pool_strdup_allow_null(object_pool *pool, char *s) +{ + return s ? pool_strdup_lib(pool, s) : NULL; +} + + + +imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, imgtool_partition **partition) +{ + imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; + imgtool_partition *p = NULL; + imgtool_class imgclass; + imgtool_partition_info partition_info[32]; + UINT64 base_block, block_count; + size_t partition_extra_bytes; + object_pool *pool; + imgtoolerr_t (*open_partition)(imgtool_partition *partition, UINT64 first_block, UINT64 block_count); + + if (image->module->list_partitions) + { + /* this image supports partitions */ + if ((partition_index < 0) || (partition_index >= ARRAY_LENGTH(partition_info))) + return IMGTOOLERR_INVALIDPARTITION; + + /* retrieve the info on the partitions */ + memset(partition_info, '\0', sizeof(partition_info)); + err = image->module->list_partitions(image, partition_info, ARRAY_LENGTH(partition_info)); + if (err) + return err; + + /* is this a valid partition */ + if (!partition_info[partition_index].get_info) + return IMGTOOLERR_INVALIDPARTITION; + + /* use this partition */ + memset(&imgclass, 0, sizeof(imgclass)); + imgclass.get_info = partition_info[partition_index].get_info; + base_block = partition_info[partition_index].base_block; + block_count = partition_info[partition_index].block_count; + } + else + { + /* this image does not support partitions */ + if (partition_index != 0) + return IMGTOOLERR_INVALIDPARTITION; + + /* identify the image class */ + imgclass = imgtool_image_module(image)->imgclass; + base_block = 0; + block_count = ~0; + } + + /* does this partition type have extra bytes? */ + partition_extra_bytes = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES); + + /* allocate the new memory pool */ + pool = pool_alloc_lib(NULL); + if (!pool) + { + err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + /* allocate the new partition object */ + p = (imgtool_partition *) pool_malloc_lib(pool, sizeof(*p) + partition_extra_bytes); + if (!p) + { + err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; + goto done; + } + memset(p, 0, sizeof(*p) + partition_extra_bytes); + p->pool = pool; + + /* fill out the structure */ + p->image = image; + p->partition_index = partition_index; + p->base_block = base_block; + p->block_count = block_count; + p->imgclass = imgclass; + p->partition_extra_bytes = partition_extra_bytes; + p->directory_extra_bytes = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES); + p->path_separator = (char) imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PATH_SEPARATOR); + p->alternate_path_separator = (char) imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR); + p->prefer_ucase = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PREFER_UCASE) ? 1 : 0; + p->supports_creation_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME) ? 1 : 0; + p->supports_lastmodified_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME) ? 1 : 0; + p->supports_bootblock = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK) ? 1 : 0; + p->begin_enum = (imgtoolerr_t (*)(imgtool_directory *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_BEGIN_ENUM); + p->next_enum = (imgtoolerr_t (*)(imgtool_directory *, imgtool_dirent *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_NEXT_ENUM); + p->free_space = (imgtoolerr_t (*)(imgtool_partition *, UINT64 *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_FREE_SPACE); + p->read_file = (imgtoolerr_t (*)(imgtool_partition *, const char *, const char *, imgtool_stream *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_READ_FILE); + p->write_file = (imgtoolerr_t (*)(imgtool_partition *, const char *, const char *, imgtool_stream *, option_resolution *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_WRITE_FILE); + p->delete_file = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_DELETE_FILE); + p->list_forks = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_forkent *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_LIST_FORKS); + p->create_dir = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CREATE_DIR); + p->delete_dir = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_DELETE_DIR); + p->list_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, UINT32 *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_LIST_ATTRS); + p->get_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, const UINT32 *, imgtool_attribute *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_ATTRS); + p->set_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, const UINT32 *, const imgtool_attribute *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_SET_ATTRS); + p->attr_name = (imgtoolerr_t (*)(UINT32, const imgtool_attribute *, char *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_ATTR_NAME); + p->get_iconinfo = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_iconinfo *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_ICON_INFO); + p->suggest_transfer = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_transfer_suggestion *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_SUGGEST_TRANSFER); + p->get_chain = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_chainent *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_CHAIN); + p->writefile_optguide = (const option_guide *) imgtool_get_info_ptr(&imgclass, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE); + p->writefile_optspec = pool_strdup_allow_null(p->pool, (char*)imgtool_get_info_ptr(&imgclass, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC)); + + /* mask out if writing is untested */ + if (global_omit_untested && imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED)) + { + p->write_file = NULL; + p->delete_file = NULL; + p->create_dir = NULL; + p->delete_dir = NULL; + p->writefile_optguide = NULL; + p->writefile_optspec = NULL; + } + + /* call the partition open function, if present */ + open_partition = (imgtoolerr_t (*)(imgtool_partition *, UINT64, UINT64)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_OPEN_PARTITION); + if (open_partition) + { + /* we have an open partition function */ + err = (*open_partition)(p, base_block, block_count); + if (err) + goto done; + } + +done: + *partition = err ? NULL : p; + return err; +} + + + +void imgtool_partition_close(imgtool_partition *partition) +{ + pool_free_lib(partition->pool); +} + + + +/*************************************************************************** + + Imgtool partition operations + +***************************************************************************/ + +/*------------------------------------------------- + imgtool_partition_get_attribute_name - retrieves the human readable + name for an attribute +-------------------------------------------------*/ + +void imgtool_partition_get_attribute_name(imgtool_partition *partition, UINT32 attribute, const imgtool_attribute *attr_value, + char *buffer, size_t buffer_len) +{ + imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_UNIMPLEMENTED; + + buffer[0] = '\0'; + + if (attr_value) + { + if (partition->attr_name) + err = partition->attr_name(attribute, attr_value, buffer, buffer_len); + + if (err == (imgtoolerr_t)IMGTOOLERR_UNIMPLEMENTED) + { + switch(attribute & 0xF0000) + { + case IMGTOOLATTR_INT_FIRST: + snprintf(buffer, buffer_len, "%d", (int) attr_value->i); + break; + } + } + } + else + { + switch(attribute) + { + case IMGTOOLATTR_INT_MAC_TYPE: + snprintf(buffer, buffer_len, "File type"); + break; + case IMGTOOLATTR_INT_MAC_CREATOR: + snprintf(buffer, buffer_len, "File creator"); + break; + case IMGTOOLATTR_INT_MAC_FINDERFLAGS: + snprintf(buffer, buffer_len, "Finder flags"); + break; + case IMGTOOLATTR_INT_MAC_COORDX: + snprintf(buffer, buffer_len, "X coordinate"); + break; + case IMGTOOLATTR_INT_MAC_COORDY: + snprintf(buffer, buffer_len, "Y coordinate"); + break; + case IMGTOOLATTR_INT_MAC_FINDERFOLDER: + snprintf(buffer, buffer_len, "Finder folder"); + break; + case IMGTOOLATTR_INT_MAC_ICONID: + snprintf(buffer, buffer_len, "Icon ID"); + break; + case IMGTOOLATTR_INT_MAC_SCRIPTCODE: + snprintf(buffer, buffer_len, "Script code"); + break; + case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: + snprintf(buffer, buffer_len, "Extended flags"); + break; + case IMGTOOLATTR_INT_MAC_COMMENTID: + snprintf(buffer, buffer_len, "Comment ID"); + break; + case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: + snprintf(buffer, buffer_len, "Putaway directory"); + break; + case IMGTOOLATTR_TIME_CREATED: + snprintf(buffer, buffer_len, "Creation time"); + break; + case IMGTOOLATTR_TIME_LASTMODIFIED: + snprintf(buffer, buffer_len, "Last modified time"); + break; + } + } +} + + + +/*------------------------------------------------- + imgtool_validitychecks - checks the validity + of the imgtool modules +-------------------------------------------------*/ + +int imgtool_validitychecks(void) +{ + int error = 0; + int val; + imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; + const imgtool_module *module = NULL; + const option_guide *guide_entry; + imgtool_module_features features; + int created_library = FALSE; + + if (!global_imgtool_library) + { + imgtool_init(FALSE, NULL); + created_library = TRUE; + } + + while((module = imgtool_library_iterate(global_imgtool_library, module)) != NULL) + { + features = imgtool_get_module_features(module); + + if (!module->name) + { + printf("imgtool module %s has null 'name'\n", module->name); + error = 1; + } + if (!module->description) + { + printf("imgtool module %s has null 'description'\n", module->name); + error = 1; + } + if (!module->extensions) + { + printf("imgtool module %s has null 'extensions'\n", module->extensions); + error = 1; + } + +#if 0 + /* sanity checks on modules that do not support directories */ + if (!module->path_separator) + { + if (module->alternate_path_separator) + { + printf("imgtool module %s specified alternate_path_separator but not path_separator\n", module->name); + error = 1; + } + if (module->initial_path_separator) + { + printf("imgtool module %s specified initial_path_separator without directory support\n", module->name); + error = 1; + } + if (module->create_dir) + { + printf("imgtool module %s implements create_dir without directory support\n", module->name); + error = 1; + } + if (module->delete_dir) + { + printf("imgtool module %s implements delete_dir without directory support\n", module->name); + error = 1; + } + } +#endif + + /* sanity checks on sector operations */ + if (module->read_sector && !module->get_sector_size) + { + printf("imgtool module %s implements read_sector without supporting get_sector_size\n", module->name); + error = 1; + } + if (module->write_sector && !module->get_sector_size) + { + printf("imgtool module %s implements write_sector without supporting get_sector_size\n", module->name); + error = 1; + } + + /* sanity checks on creation options */ + if (module->createimage_optguide || module->createimage_optspec) + { + if (!module->create) + { + printf("imgtool module %s has creation options without supporting create\n", module->name); + error = 1; + } + if ((!module->createimage_optguide && module->createimage_optspec) + || (module->createimage_optguide && !module->createimage_optspec)) + { + printf("imgtool module %s does has partially incomplete creation options\n", module->name); + error = 1; + } + + if (module->createimage_optguide && module->createimage_optspec) + { + guide_entry = module->createimage_optguide; + while(guide_entry->option_type != OPTIONTYPE_END) + { + if (option_resolution_contains(module->createimage_optspec, guide_entry->parameter)) + { + switch(guide_entry->option_type) + { + case OPTIONTYPE_INT: + case OPTIONTYPE_ENUM_BEGIN: + err = (imgtoolerr_t)option_resolution_getdefault(module->createimage_optspec, + guide_entry->parameter, &val); + if (err) + goto done; + break; + + default: + break; + } + if (!guide_entry->identifier) + { + printf("imgtool module %s creation option %d has null identifier\n", + module->name, (int) (guide_entry - module->createimage_optguide)); + error = 1; + } + if (!guide_entry->display_name) + { + printf("imgtool module %s creation option %d has null display_name\n", + module->name, (int) (guide_entry - module->createimage_optguide)); + error = 1; + } + } + guide_entry++; + } + } + } + } + +done: + if (created_library) + imgtool_exit(); + if (err) + { + printf("imgtool: %s\n", imgtool_error(err)); + error = 1; + } + return error; +} + + + +/*------------------------------------------------- + imgtool_temp_str - provides a temporary string + buffer used for string passing +-------------------------------------------------*/ + +char *imgtool_temp_str(void) +{ + static int index; + static char temp_string_pool[32][256]; + return temp_string_pool[index++ % ARRAY_LENGTH(temp_string_pool)]; +} + + + +/*************************************************************************** + + Image handling functions + +***************************************************************************/ + +static imgtoolerr_t internal_open(const imgtool_module *module, const char *fname, + int read_or_write, option_resolution *createopts, imgtool_image **outimg) +{ + imgtoolerr_t err; + imgtool_stream *f = NULL; + imgtool_image *image = NULL; + object_pool *pool = NULL; + size_t size; + + if (outimg) + *outimg = NULL; + + /* is the requested functionality implemented? */ + if ((read_or_write == OSD_FOPEN_RW_CREATE) ? !module->create : !module->open) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + /* create a memory pool */ + pool = pool_alloc_lib(NULL); + if (!pool) + { + err = (imgtoolerr_t)(IMGTOOLERR_OUTOFMEMORY); + goto done; + } + + /* open the stream */ + f = stream_open(fname, read_or_write); + if (!f) + { + err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_IMAGEFILE); + goto done; + } + + /* setup the image structure */ + size = sizeof(imgtool_image) + module->image_extra_bytes; + image = (imgtool_image *) pool_malloc_lib(pool, size); + if (!image) + { + err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; + goto done; + } + memset(image, '\0', size); + image->pool = pool; + image->module = module; + + /* actually call create or open */ + if (read_or_write == OSD_FOPEN_RW_CREATE) + err = module->create(image, f, createopts); + else + err = module->open(image, f); + if (err) + { + err = markerrorsource(err); + goto done; + } + +done: + if (err) + { + if (f) + stream_close(f); + if (pool) + pool_free_lib(pool); + image = NULL; + } + + if (outimg) + *outimg = image; + else if (image) + imgtool_image_close(image); + return err; +} + + + +/*------------------------------------------------- + imgtool_image_open - open an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_open(const imgtool_module *module, const char *fname, int read_or_write, imgtool_image **outimg) +{ + read_or_write = read_or_write ? OSD_FOPEN_RW : OSD_FOPEN_READ; + return internal_open(module, fname, read_or_write, NULL, outimg); +} + + + +/*------------------------------------------------- + imgtool_image_open_byname - open an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_open_byname(const char *modulename, const char *fname, int read_or_write, imgtool_image **outimg) +{ + const imgtool_module *module; + + module = imgtool_find_module(modulename); + if (!module) + return (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); + + return imgtool_image_open(module, fname, read_or_write, outimg); +} + + + +/*------------------------------------------------- + imgtool_image_close - close an image +-------------------------------------------------*/ + +void imgtool_image_close(imgtool_image *image) +{ + if (image->module->close) + image->module->close(image); + pool_free_lib(image->pool); +} + + + +/*------------------------------------------------- + imgtool_image_create - creates an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_create(const imgtool_module *module, const char *fname, + option_resolution *opts, imgtool_image **image) +{ + imgtoolerr_t err; + option_resolution *alloc_resolution = NULL; + + /* allocate dummy options if necessary */ + if (!opts && module->createimage_optguide) + { + alloc_resolution = option_resolution_create(module->createimage_optguide, module->createimage_optspec); + if (!alloc_resolution) + { + err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; + goto done; + } + opts = alloc_resolution; + } + if (opts) + option_resolution_finish(opts); + + err = internal_open(module, fname, OSD_FOPEN_RW_CREATE, opts, image); + if (err) + goto done; + +done: + if (alloc_resolution) + option_resolution_close(alloc_resolution); + return err; +} + + + +/*------------------------------------------------- + imgtool_image_create_byname - creates an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_create_byname(const char *modulename, const char *fname, + option_resolution *opts, imgtool_image **image) +{ + const imgtool_module *module; + + module = imgtool_find_module(modulename); + if (!module) + return (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); + + return imgtool_image_create(module, fname, opts, image); +} + + + +/*------------------------------------------------- + imgtool_image_info - returns format specific information + about an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_image_info(imgtool_image *image, char *string, size_t len) +{ + if (len > 0) + { + string[0] = '\0'; + if (image->module->info) + image->module->info(image, string, len); + } + return IMGTOOLERR_SUCCESS; +} + + + +#define PATH_MUSTBEDIR 0x00000001 +#define PATH_LEAVENULLALONE 0x00000002 +#define PATH_CANBEBOOTBLOCK 0x00000004 + +/*------------------------------------------------- + cannonicalize_path - normalizes a path string + into a NUL delimited list +-------------------------------------------------*/ + +static imgtoolerr_t cannonicalize_path(imgtool_partition *partition, UINT32 flags, + const char **path, char **alloc_path) +{ + imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; + char *new_path = NULL; + char path_separator, alt_path_separator; + const char *s; + int in_path_separator, i, j; + + path_separator = partition->path_separator; + alt_path_separator = partition->alternate_path_separator; + + /* is this path NULL? if so, is that ignored? */ + if (!*path && (flags & PATH_LEAVENULLALONE)) + goto done; + + /* is this the special filename for bootblocks? */ + if (*path == FILENAME_BOOTBLOCK) + { + if (!(flags & PATH_CANBEBOOTBLOCK)) + err = (imgtoolerr_t)IMGTOOLERR_UNEXPECTED; + else if (!partition->supports_bootblock) + err = (imgtoolerr_t)IMGTOOLERR_FILENOTFOUND; + goto done; + } + + if (path_separator == '\0') + { + if (flags & PATH_MUSTBEDIR) + { + /* do we specify a path when paths are not supported? */ + if (*path && **path) + { + err = (imgtoolerr_t)(IMGTOOLERR_CANNOTUSEPATH | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + *path = NULL; /* normalize empty path */ + } + } + else + { + s = *path ? *path : ""; + + /* allocate space for a new cannonical path */ + new_path = (char*)malloc(strlen(s) + 4); + if (!new_path) + { + err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + /* copy the path */ + in_path_separator = TRUE; + i = j = 0; + do + { + if ((s[i] != '\0') && (s[i] != path_separator) && (s[i] != alt_path_separator)) + { + new_path[j++] = s[i]; + in_path_separator = FALSE; + } + else if (!in_path_separator) + { + new_path[j++] = '\0'; + in_path_separator = TRUE; + } + } + while(s[i++] != '\0'); + new_path[j++] = '\0'; + new_path[j++] = '\0'; + *path = new_path; + } + +done: + *alloc_path = new_path; + return err; +} + + + +static imgtoolerr_t cannonicalize_fork(imgtool_partition *partition, const char **fork) +{ + /* does this module support forks? */ + if (partition->list_forks) + { + /* this module supports forks; make sure that fork is non-NULL */ + if (!*fork) + *fork = ""; + } + else + { + /* this module does not support forks; make sure that fork is NULL */ + if (*fork) + return IMGTOOLERR_NOFORKS; + } + return IMGTOOLERR_SUCCESS; +} + + + +/*------------------------------------------------- + imgtool_partition_get_directory_entry - retrieves + the nth directory entry within a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_directory_entry(imgtool_partition *partition, const char *path, int index, imgtool_dirent *ent) +{ + imgtoolerr_t err; + imgtool_directory *imgenum = NULL; + + if (index < 0) + { + err = (imgtoolerr_t)IMGTOOLERR_PARAMTOOSMALL; + goto done; + } + + err = imgtool_directory_open(partition, path, &imgenum); + if (err) + goto done; + + do + { + err = imgtool_directory_get_next(imgenum, ent); + if (err) + goto done; + + if (ent->eof) + { + err = (imgtoolerr_t)IMGTOOLERR_FILENOTFOUND; + goto done; + } + } + while(index--); + +done: + if (err) + memset(ent->filename, 0, sizeof(ent->filename)); + if (imgenum) + imgtool_directory_close(imgenum); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_get_file_size - returns free + space on a partition, in bytes +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const char *fname, UINT64 *filesize) +{ + imgtoolerr_t err; + imgtool_directory *imgenum; + imgtool_dirent ent; + const char *path; + + path = NULL; /* TODO: Need to parse off the path */ + + *filesize = -1; + memset(&ent, 0, sizeof(ent)); + + err = imgtool_directory_open(partition, path, &imgenum); + if (err) + goto done; + + do + { + err = imgtool_directory_get_next(imgenum, &ent); + if (err) + goto done; + + if (!core_stricmp(fname, ent.filename)) + { + *filesize = ent.filesize; + goto done; + } + } + while(ent.filename[0]); + + err = (imgtoolerr_t)IMGTOOLERR_FILENOTFOUND; + +done: + if (imgenum) + imgtool_directory_close(imgenum); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_list_file_attributes - identifies + all attributes on a file +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + char *new_fname = NULL; + + memset(attrs, 0, sizeof(*attrs) * len); + + if (!partition->list_attrs) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + new_fname = normalize_filename(partition, path); + if (new_fname == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + path = new_fname; + + /* cannonicalize path */ + err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); + if (err) + goto done; + + err = partition->list_attrs(partition, path, attrs, len); + if (err) + goto done; + +done: + if (alloc_path != NULL) + free(alloc_path); + if (new_fname != NULL) + osd_free(new_fname); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_get_file_attributes - retrieves + attributes on a file +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + char *new_fname = NULL; + + if (!partition->get_attrs) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + new_fname = normalize_filename(partition, path); + if (new_fname == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + path = new_fname; + + /* cannonicalize path */ + err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); + if (err) + goto done; + + err = partition->get_attrs(partition, path, attrs, values); + if (err) + goto done; + +done: + if (alloc_path != NULL) + free(alloc_path); + if (new_fname != NULL) + osd_free(new_fname); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_put_file_attributes - sets + attributes on a file +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_put_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + + if (!partition->set_attrs) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + /* cannonicalize path */ + err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); + if (err) + goto done; + + err = partition->set_attrs(partition, path, attrs, values); + if (err) + goto done; + +done: + if (alloc_path) + free(alloc_path); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_get_file_attributes - retrieves + an attribute on a single file +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute *value) +{ + UINT32 attrs[2]; + attrs[0] = attr; + attrs[1] = 0; + return imgtool_partition_get_file_attributes(partition, path, attrs, value); +} + + + +/*------------------------------------------------- + imgtool_partition_put_file_attribute - sets + attributes on a single file +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_put_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute value) +{ + UINT32 attrs[2]; + attrs[0] = attr; + attrs[1] = 0; + return imgtool_partition_put_file_attributes(partition, path, attrs, &value); +} + + + +/*------------------------------------------------- + imgtool_partition_get_icon_info - retrieves the + icon for a file stored on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + char *new_fname = NULL; + + if (!partition->get_iconinfo) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + new_fname = normalize_filename(partition, path); + if (new_fname == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + path = new_fname; + + /* cannonicalize path */ + err = cannonicalize_path(partition, 0, &path, &alloc_path); + if (err) + goto done; + + memset(iconinfo, 0, sizeof(*iconinfo)); + err = partition->get_iconinfo(partition, path, iconinfo); + if (err) + goto done; + +done: + if (alloc_path) + free(alloc_path); + if (new_fname) + osd_free(new_fname); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_suggest_file_filters - suggests + a list of filters appropriate for a file on a + partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition, const char *path, + imgtool_stream *stream, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) +{ + imgtoolerr_t err; + int i, j; + char *alloc_path = NULL; + imgtoolerr_t (*check_stream)(imgtool_stream *stream, imgtool_suggestion_viability_t *viability); + size_t position; + + /* clear out buffer */ + memset(suggestions, 0, sizeof(*suggestions) * suggestions_length); + + if (!partition->suggest_transfer) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + /* cannonicalize path */ + err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); + if (err) + goto done; + + /* invoke the module's suggest call */ + err = partition->suggest_transfer(partition, path, suggestions, suggestions_length); + if (err) + goto done; + + /* Loop on resulting suggestions, and do the following: + * 1. Call check_stream if present, and remove disqualified streams + * 2. Fill in missing descriptions + */ + i = j = 0; + while(suggestions[i].viability) + { + if (stream && suggestions[i].filter) + { + check_stream = (imgtoolerr_t (*)(imgtool_stream *, imgtool_suggestion_viability_t *)) filter_get_info_fct(suggestions[i].filter, FILTINFO_PTR_CHECKSTREAM); + if (check_stream) + { + position = stream_tell(stream); + err = check_stream(stream, &suggestions[i].viability); + stream_seek(stream, position, SEEK_SET); + if (err) + goto done; + } + } + + /* the check_stream proc can remove the option by clearing out the viability */ + if (suggestions[i].viability) + { + /* we may have to move this suggestion, if one was removed */ + if (i != j) + memcpy(&suggestions[j], &suggestions[i], sizeof(*suggestions)); + + /* if the description is missing, fill it in */ + if (!suggestions[j].description) + { + if (suggestions[j].filter) + suggestions[j].description = filter_get_info_string(suggestions[i].filter, FILTINFO_STR_HUMANNAME); + else + suggestions[j].description = "Raw"; + } + + j++; + } + i++; + } + suggestions[j].viability = (imgtool_suggestion_viability_t)0; + +done: + if (alloc_path) + free(alloc_path); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_get_chain - retrieves the block + chain for a file or directory on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_chain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size) +{ + size_t i; + + assert(chain_size > 0); + + if (!partition->get_chain) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + /* initialize the chain array, so the module's get_chain function can be lazy */ + for (i = 0; i < chain_size; i++) + { + chain[i].level = 0; + chain[i].block = ~0; + } + + return partition->get_chain(partition, path, chain, chain_size - 1); +} + + + +/*------------------------------------------------- + imgtool_partition_get_chain_string - retrieves + the block chain for a file or directory on a + partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_chain_string(imgtool_partition *partition, const char *path, char *buffer, size_t buffer_len) +{ + imgtoolerr_t err; + imgtool_chainent chain[512]; + UINT64 last_block; + UINT8 cur_level = 0; + int len, i; + int comma_needed = FALSE; + + /* determine the last block identifier */ + chain[0].block = ~0; + last_block = chain[0].block; + + err = imgtool_partition_get_chain(partition, path, chain, ARRAY_LENGTH(chain)); + if (err) + return err; + + len = snprintf(buffer, buffer_len, "["); + buffer += len; + buffer_len -= len; + + for (i = 0; chain[i].block != last_block; i++) + { + while(cur_level < chain[i].level) + { + len = snprintf(buffer, buffer_len, " ["); + buffer += len; + buffer_len -= len; + cur_level++; + comma_needed = FALSE; + } + while(cur_level > chain[i].level) + { + len = snprintf(buffer, buffer_len, "]"); + buffer += len; + buffer_len -= len; + cur_level--; + } + + if (comma_needed) + { + len = snprintf(buffer, buffer_len, ", "); + buffer += len; + buffer_len -= len; + } + + len = snprintf(buffer, buffer_len, "%u", (unsigned) chain[i].block); + buffer += len; + buffer_len -= len; + comma_needed = TRUE; + } + + do + { + len = snprintf(buffer, buffer_len, "]"); + buffer += len; + buffer_len -= len; + } + while(cur_level-- > 0); + + return IMGTOOLERR_SUCCESS; +} + + + +/*------------------------------------------------- + imgtool_partition_get_free_space - returns the + amount of free space on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_free_space(imgtool_partition *partition, UINT64 *sz) +{ + imgtoolerr_t err; + UINT64 size; + + if (!partition->free_space) + return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + + err = partition->free_space(partition, &size); + if (err) + return (imgtoolerr_t)(err | IMGTOOLERR_SRC_IMAGEFILE); + + if (sz) + *sz = size; + return IMGTOOLERR_SUCCESS; +} + + + +/*------------------------------------------------- + imgtool_partition_read_file - starts reading + from a file on a partition with a stream +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + union filterinfo u; + + if (!partition->read_file) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + if (filter) + { + /* use a filter */ + filter(FILTINFO_PTR_READFILE, &u); + if (!u.read_file) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + err = u.read_file(partition, filename, fork, destf); + if (err) + { + err = markerrorsource(err); + goto done; + } + } + else + { + /* cannonicalize path */ + err = cannonicalize_path(partition, PATH_CANBEBOOTBLOCK, &filename, &alloc_path); + if (err) + goto done; + + err = cannonicalize_fork(partition, &fork); + if (err) + goto done; + + /* invoke the actual module */ + err = partition->read_file(partition, filename, fork, destf); + if (err) + { + err = markerrorsource(err); + goto done; + } + } + +done: + if (alloc_path) + free(alloc_path); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_write_file - starts writing + to a new file on an image with a stream +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts, filter_getinfoproc filter) +{ + imgtoolerr_t err; + char *buf = NULL; + char *s; + option_resolution *alloc_resolution = NULL; + char *alloc_path = NULL; + UINT64 free_space; + UINT64 file_size; + union filterinfo u; + + if (!partition->write_file) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + if (filter) + { + /* use a filter */ + filter(FILTINFO_PTR_WRITEFILE, &u); + if (!u.write_file) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + err = u.write_file(partition, filename, fork, sourcef, opts); + if (err) + { + err = markerrorsource(err); + goto done; + } + } + else + { + /* does this partition prefer upper case file names? */ + if (partition->prefer_ucase) + { + buf = (char*)malloc(strlen(filename) + 1); + if (!buf) + { + err = (imgtoolerr_t)(IMGTOOLERR_OUTOFMEMORY); + goto done; + } + strcpy(buf, filename); + for (s = buf; *s; s++) + *s = toupper(*s); + filename = buf; + } + + /* cannonicalize path */ + err = cannonicalize_path(partition, PATH_CANBEBOOTBLOCK, &filename, &alloc_path); + if (err) + goto done; + + err = cannonicalize_fork(partition, &fork); + if (err) + goto done; + + /* allocate dummy options if necessary */ + if (!opts && partition->writefile_optguide) + { + alloc_resolution = option_resolution_create(partition->writefile_optguide, partition->writefile_optspec); + if (!alloc_resolution) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + opts = alloc_resolution; + } + if (opts) + option_resolution_finish(opts); + + /* if free_space is implemented; do a quick check to see if space is available */ + if (partition->free_space) + { + err = partition->free_space(partition, &free_space); + if (err) + { + err = markerrorsource(err); + goto done; + } + + file_size = stream_size(sourcef); + + if (file_size > free_space) + { + err = markerrorsource(IMGTOOLERR_NOSPACE); + goto done; + } + } + + /* actually invoke the write file handler */ + err = partition->write_file(partition, filename, fork, sourcef, opts); + if (err) + { + err = markerrorsource(err); + goto done; + } + } + +done: + if (buf) + free(buf); + if (alloc_path) + free(alloc_path); + if (alloc_resolution) + option_resolution_close(alloc_resolution); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_get_file - read a file from + an image, storing it into a native file +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char *filename, const char *fork, + const char *dest, filter_getinfoproc filter) +{ + imgtoolerr_t err; + imgtool_stream *f; + char *new_fname = NULL; + char *alloc_dest = NULL; + const char *filter_extension = NULL; + + if (!dest) + { + /* determine the filter extension, if appropriate */ + if (filter != NULL) + filter_extension = filter_get_info_string(filter, FILTINFO_STR_EXTENSION); + + if (filter_extension != NULL) + { + alloc_dest = (char*)malloc(strlen(filename) + 1 + strlen(filter_extension) + 1); + if (!alloc_dest) + return IMGTOOLERR_OUTOFMEMORY; + + sprintf(alloc_dest, "%s.%s", filename, filter_extension); + dest = alloc_dest; + } + else + { + if (filename == FILENAME_BOOTBLOCK) + dest = "boot.bin"; + else + dest = filename; + } + } + + f = stream_open(dest, OSD_FOPEN_WRITE); + if (!f) + { + err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE); + goto done; + } + + new_fname = normalize_filename(partition, filename); + if (new_fname == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + err = imgtool_partition_read_file(partition, new_fname, fork, f, filter); + if (err) + goto done; + +done: + if (f != NULL) + stream_close(f); + if (alloc_dest != NULL) + free(alloc_dest); + if (new_fname != NULL) + osd_free(new_fname); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_put_file - read a native file + and store it on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char *newfname, const char *fork, + const char *source, option_resolution *opts, filter_getinfoproc filter) +{ + imgtoolerr_t err; + imgtool_stream *f = NULL; + imgtool_charset charset; + char *alloc_newfname = NULL; + + if (!newfname) + newfname = (const char *) imgtool_basename((char *) source); + + charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); + if (charset != IMGTOOL_CHARSET_UTF8) + { + /* convert to native format */ + alloc_newfname = native_from_utf8(charset, newfname); + if (alloc_newfname == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_NATIVEFILE); + goto done; + } + + newfname = alloc_newfname; + } + + f = stream_open(source, OSD_FOPEN_READ); + if (f) + err = imgtool_partition_write_file(partition, newfname, fork, f, opts, filter); + else + err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE); + +done: + /* clean up */ + if (f != NULL) + stream_close(f); + if (alloc_newfname != NULL) + osd_free(alloc_newfname); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_delete_file - delete a file + on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const char *fname) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + char *new_fname = NULL; + + if (!partition->delete_file) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + new_fname = normalize_filename(partition, fname); + if (new_fname == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + fname = new_fname; + + /* cannonicalize path */ + err = cannonicalize_path(partition, 0, &fname, &alloc_path); + if (err) + goto done; + + err = partition->delete_file(partition, fname); + if (err) + { + err = markerrorsource(err); + goto done; + } + +done: + if (alloc_path) + free(alloc_path); + if (new_fname) + osd_free(new_fname); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_list_file_forks - lists all + forks on an image +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + char *new_fname = NULL; + + if (!partition->list_forks) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + new_fname = normalize_filename(partition, path); + if (new_fname == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + path = new_fname; + + /* cannonicalize path */ + err = cannonicalize_path(partition, 0, &path, &alloc_path); + if (err) + goto done; + + err = partition->list_forks(partition, path, ents, len); + if (err) + goto done; + +done: + if (alloc_path) + free(alloc_path); + if (new_fname) + osd_free(new_fname); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_create_directory - creates a + directory on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, const char *path) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + char *new_path = NULL; + + /* implemented? */ + if (!partition->create_dir) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + new_path = normalize_filename(partition, path); + if (new_path == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + path = new_path; + + /* cannonicalize path */ + err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); + if (err) + goto done; + + err = partition->create_dir(partition, path); + if (err) + goto done; + +done: + if (alloc_path) + free(alloc_path); + if (new_path) + osd_free(new_path); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_delete_directory - deletes a + directory on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, const char *path) +{ + imgtoolerr_t err; + char *alloc_path = NULL; + char *new_path = NULL; + + /* implemented? */ + if (!partition->delete_dir) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + new_path = normalize_filename(partition, path); + if (new_path == NULL) + { + err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + path = new_path; + + /* cannonicalize path */ + err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); + if (err) + goto done; + + err = partition->delete_dir(partition, path); + if (err) + goto done; + +done: + if (alloc_path) + free(alloc_path); + if (new_path) + osd_free(new_path); + return err; +} + + + +/*------------------------------------------------- + imgtool_partition_get_block_size - gets the + size of a standard block on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_get_block_size(imgtool_partition *partition, UINT32 *length) +{ + return imgtool_image_get_block_size(partition->image, length); +} + + + +/*------------------------------------------------- + imgtool_partition_read_block - reads a standard + block on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_read_block(imgtool_partition *partition, UINT64 block, void *buffer) +{ + if (block >= partition->block_count) + return IMGTOOLERR_SEEKERROR; + return imgtool_image_read_block(partition->image, block + partition->base_block, buffer); +} + + + +/*------------------------------------------------- + imgtool_partition_write_block - writes a + standard block on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_partition_write_block(imgtool_partition *partition, UINT64 block, const void *buffer) +{ + if (block >= partition->block_count) + return IMGTOOLERR_SEEKERROR; + return imgtool_image_write_block(partition->image, block + partition->base_block, buffer); +} + + + +/*------------------------------------------------- + imgtool_partition_get_features - retrieves a + structure identifying this partition's features + associated with an image +-------------------------------------------------*/ + +imgtool_partition_features imgtool_partition_get_features(imgtool_partition *partition) +{ + imgtool_partition_features features; + memset(&features, 0, sizeof(features)); + + if (partition->read_file) + features.supports_reading = 1; + if (partition->write_file) + features.supports_writing = 1; + if (partition->delete_file) + features.supports_deletefile = 1; + if (partition->path_separator) + features.supports_directories = 1; + if (partition->free_space) + features.supports_freespace = 1; + if (partition->create_dir) + features.supports_createdir = 1; + if (partition->delete_dir) + features.supports_deletedir = 1; + if (partition->supports_creation_time) + features.supports_creation_time = 1; + if (partition->supports_lastmodified_time) + features.supports_lastmodified_time = 1; + if (!features.supports_writing && !features.supports_createdir && !features.supports_deletefile && !features.supports_deletedir) + features.is_read_only = 1; + return features; +} + + + +/*------------------------------------------------- + imgtool_partition_get_info_ptr - retrieves a + pointer associated with a partition's format +-------------------------------------------------*/ + +void *imgtool_partition_get_info_ptr(imgtool_partition *partition, UINT32 state) +{ + return imgtool_get_info_ptr(&partition->imgclass, state); +} + + + +/*------------------------------------------------- + imgtool_partition_get_info_string - retrieves a + string associated with a partition's format +-------------------------------------------------*/ + +const char *imgtool_partition_get_info_string(imgtool_partition *partition, UINT32 state) +{ + return imgtool_get_info_string(&partition->imgclass, state); +} + + + +/*------------------------------------------------- + imgtool_partition_get_info_int - retrieves a + pointer associated with a partition's format +-------------------------------------------------*/ + +UINT64 imgtool_partition_get_info_int(imgtool_partition *partition, UINT32 state) +{ + return imgtool_get_info_int(&partition->imgclass, state); +} + + + +/*------------------------------------------------- + imgtool_partition_extra_bytes - returns extra + bytes on a partition +-------------------------------------------------*/ + +void *imgtool_partition_extra_bytes(imgtool_partition *partition) +{ + void *ptr = NULL; + if (partition->partition_extra_bytes > 0) + ptr = ((UINT8 *) partition) + sizeof(*partition); + assert(ptr); + return ptr; +} + + + +/*------------------------------------------------- + imgtool_partition_rand - returns random number +-------------------------------------------------*/ + +UINT64 imgtool_partition_rand(imgtool_partition *partition) +{ + return imgtool_image_rand(partition->image); +} + + + +/*************************************************************************** + + Path handling functions + +***************************************************************************/ + +/*------------------------------------------------- + imgtool_partition_get_root_path - retrieves + the path root of this partition +-------------------------------------------------*/ + +const char *imgtool_partition_get_root_path(imgtool_partition *partition) +{ + int initial_path_separator; + char path_separator; + char *buf; + int pos = 0; + + initial_path_separator = imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR) ? 1 : 0; + path_separator = (char) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_PATH_SEPARATOR); + buf = imgtool_temp_str(); + + if (initial_path_separator) + buf[pos++] = path_separator; + buf[pos] = '\0'; + return buf; +} + + + +/*------------------------------------------------- + imgtool_partition_path_concatenate - retrieves + a pointer associated with a partition's format +-------------------------------------------------*/ + +const char *imgtool_partition_path_concatenate(imgtool_partition *partition, const char *path1, const char *path2) +{ + char path_separator; + size_t len; + char *buffer; + size_t buffer_len; + + path_separator = (char) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_PATH_SEPARATOR); + len = strlen(path1); + + /* prepare buffer */ + buffer = imgtool_temp_str(); + buffer_len = 256; + + if (!strcmp(path2, ".")) + { + /* keep the same directory */ + snprintf(buffer, buffer_len, "%s", path1); + } + else if (!strcmp(path2, "..")) + { + /* up one directory */ + while((len > 0) && (path1[len - 1] == path_separator)) + len--; + while((len > 0) && (path1[len - 1] != path_separator)) + len--; + while((len > 1) && (path1[len - 1] == path_separator)) + len--; + snprintf(buffer, buffer_len, "%s", path1); + buffer[len] = '\0'; + } + else + { + /* append a path */ + if ((*path1 != 0) && (path1[strlen(path1) - 1] != path_separator)) + snprintf(buffer, buffer_len, "%s%c%s", path1, path_separator, path2); + else + snprintf(buffer, buffer_len, "%s%s", path1, path2); + } + return buffer; +} + + + +/*------------------------------------------------- + imgtool_partition_get_base_name - retrieves + a base name for a partition specific path +-------------------------------------------------*/ + +const char *imgtool_partition_get_base_name(imgtool_partition *partition, const char *path) +{ + char path_separator; + const char *new_path = path; + int i; + + path_separator = (char) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_PATH_SEPARATOR); + + for (i = 0; path[i]; i++) + { + if (path[i] == path_separator) + new_path = &path[i + 1]; + } + return new_path; +} + + + +/*************************************************************************** + + Directory handling functions + +***************************************************************************/ + +/*------------------------------------------------- + imgtool_directory_open - begins + enumerating files on a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *path, imgtool_directory **outenum) +{ + imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; + imgtool_directory *enumeration = NULL; + char *alloc_path = NULL; + char *new_path = NULL; + size_t size; + + /* sanity checks */ + assert(partition); + assert(outenum); + + *outenum = NULL; + + if (!partition->next_enum) + { + err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); + goto done; + } + + new_path = normalize_filename(partition, path); + path = new_path; + + err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); + if (err) + goto done; + + size = sizeof(imgtool_directory) + partition->directory_extra_bytes; + enumeration = (imgtool_directory *) malloc(size); + if (!enumeration) + { + err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; + goto done; + } + memset(enumeration, '\0', size); + enumeration->partition = partition; + + if (partition->begin_enum) + { + err = partition->begin_enum(enumeration, path); + if (err) + { + err = markerrorsource(err); + goto done; + } + } + +done: + if (alloc_path != NULL) + free(alloc_path); + if (new_path != NULL) + osd_free(new_path); + if (err && (enumeration != NULL)) + { + free(enumeration); + enumeration = NULL; + } + *outenum = enumeration; + return err; +} + + + +/*------------------------------------------------- + imgtool_directory_close - closes a directory +-------------------------------------------------*/ + +void imgtool_directory_close(imgtool_directory *directory) +{ + imgtool_partition *partition; + partition = imgtool_directory_partition(directory); + if (partition->close_enum) + partition->close_enum(directory); + free(directory); +} + + + +/*------------------------------------------------- + imgtool_directory_get_next - continues + enumerating files within a partition +-------------------------------------------------*/ + +imgtoolerr_t imgtool_directory_get_next(imgtool_directory *directory, imgtool_dirent *ent) +{ + imgtoolerr_t err; + imgtool_partition *partition; + int charset; + + partition = imgtool_directory_partition(directory); + + /* This makes it so that drivers don't have to take care of clearing + * the attributes if they don't apply + */ + memset(ent, 0, sizeof(*ent)); + + err = partition->next_enum(directory, ent); + if (err) + return markerrorsource(err); + + charset = imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); + + if (charset) + { + char *new_fname = utf8_from_native((imgtool_charset)charset, ent->filename); + + if (!new_fname) + return IMGTOOLERR_BADFILENAME; + + strcpy(ent->filename, new_fname); + osd_free(new_fname); + } + + /* don't trust the module! */ + if (!partition->supports_creation_time && (ent->creation_time != 0)) + { + internal_error(NULL, "next_enum() specified creation_time, which is marked as unsupported by this module"); + return IMGTOOLERR_UNEXPECTED; + } + if (!partition->supports_lastmodified_time && (ent->lastmodified_time != 0)) + { + internal_error(NULL, "next_enum() specified lastmodified_time, which is marked as unsupported by this module"); + return IMGTOOLERR_UNEXPECTED; + } + if (!partition->path_separator && ent->directory) + { + internal_error(NULL, "next_enum() returned a directory, which is marked as unsupported by this module"); + return IMGTOOLERR_UNEXPECTED; + } + return IMGTOOLERR_SUCCESS; +} + + + +/*------------------------------------------------- + imgtool_directory_module - returns the module associated + with this directory +-------------------------------------------------*/ + +const imgtool_module *imgtool_directory_module(imgtool_directory *directory) +{ + return directory->partition->image->module; +} + + + +/*------------------------------------------------- + imgtool_directory_extrabytes - returns extra + bytes on a directory +-------------------------------------------------*/ + +void *imgtool_directory_extrabytes(imgtool_directory *directory) +{ + assert(directory->partition->directory_extra_bytes > 0); + return ((UINT8 *) directory) + sizeof(*directory); +} + + + +/*------------------------------------------------- + imgtool_directory_partition - returns the + partition associated with this directory +-------------------------------------------------*/ + +imgtool_partition *imgtool_directory_partition(imgtool_directory *directory) +{ + return directory->partition; +} + + + +/*------------------------------------------------- + imgtool_directory_image - returns the image + associated with this directory +-------------------------------------------------*/ + +imgtool_image *imgtool_directory_image(imgtool_directory *directory) +{ + return directory->partition->image; +} + + + +/*------------------------------------------------- + unknown_partition_get_info - represents an + unknown partition +-------------------------------------------------*/ + +void unknown_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "unknown"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Unknown partition type"); break; + } +} diff --git a/src/mame/tools/imgtool/imgtool.h b/src/mame/tools/imgtool/imgtool.h new file mode 100644 index 00000000000..e688dfb60f1 --- /dev/null +++ b/src/mame/tools/imgtool/imgtool.h @@ -0,0 +1,169 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + imgtool.h + + Main headers for Imgtool core + +***************************************************************************/ + +#ifndef IMGTOOL_H +#define IMGTOOL_H + +#include +#include +#include + +#include "corestr.h" +#include "formats/flopimg.h" +#include "opresolv.h" +#include "library.h" +#include "filter.h" + +/* ----------------------------------------------------------------------- */ + +#define EOLN_CR "\x0d" +#define EOLN_LF "\x0a" +#define EOLN_CRLF "\x0d\x0a" + +#define FILENAME_BOOTBLOCK ((const char *) 1) + +enum +{ + OSD_FOPEN_READ, + OSD_FOPEN_WRITE, + OSD_FOPEN_RW, + OSD_FOPEN_RW_CREATE +}; + +/* --------------------------------------------------------------------------- + * Image calls + * + * These are the calls that front ends should use for manipulating images. You + * should never call the module functions directly because they may not be + * implemented (i.e. - the function pointers are NULL). The img_* functions are + * aware of these issues and will make the appropriate checks as well as + * marking up return codes with the source. In addition, some of the img_* + * calls are high level calls that simply image manipulation + * + * Calls that return 'int' that are not explictly noted otherwise return + * imgtool error codes + * --------------------------------------------------------------------------- + */ + +struct imgtool_module_features +{ + unsigned int supports_create : 1; + unsigned int supports_open : 1; + unsigned int supports_readsector : 1; + unsigned int supports_writesector : 1; + unsigned int is_read_only : 1; +}; + +struct imgtool_partition_features +{ + unsigned int supports_reading : 1; + unsigned int supports_writing : 1; + unsigned int supports_deletefile : 1; + unsigned int supports_directories : 1; + unsigned int supports_freespace : 1; + unsigned int supports_createdir : 1; + unsigned int supports_deletedir : 1; + unsigned int supports_creation_time : 1; + unsigned int supports_lastmodified_time : 1; + unsigned int supports_forks : 1; + unsigned int supports_geticoninfo : 1; + unsigned int is_read_only : 1; +}; + +/* ----- initialization and basics ----- */ +void imgtool_init(int omit_untested, void (*warning)(const char *message)); +void imgtool_exit(void); +const imgtool_module *imgtool_find_module(const char *modulename); +imgtool_module_features imgtool_get_module_features(const imgtool_module *module); +void imgtool_warn(const char *format, ...) ATTR_PRINTF(1,2); +char *imgtool_basename(char *filename); + +/* ----- image management ----- */ +imgtoolerr_t imgtool_identify_file(const char *filename, imgtool_module **modules, size_t count); +imgtoolerr_t imgtool_image_open(const imgtool_module *module, const char *filename, int read_or_write, imgtool_image **outimg); +imgtoolerr_t imgtool_image_open_byname(const char *modulename, const char *filename, int read_or_write, imgtool_image **outimg); +imgtoolerr_t imgtool_image_create(const imgtool_module *module, const char *fname, option_resolution *opts, imgtool_image **image); +imgtoolerr_t imgtool_image_create_byname(const char *modulename, const char *fname, option_resolution *opts, imgtool_image **image); +void imgtool_image_close(imgtool_image *image); +imgtoolerr_t imgtool_image_info(imgtool_image *image, char *string, size_t len); +imgtoolerr_t imgtool_image_get_sector_size(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *length); +imgtoolerr_t imgtool_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors); +imgtoolerr_t imgtool_image_read_sector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len); +imgtoolerr_t imgtool_image_write_sector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len); +imgtoolerr_t imgtool_image_get_block_size(imgtool_image *image, UINT32 *length); +imgtoolerr_t imgtool_image_read_block(imgtool_image *image, UINT64 block, void *buffer); +imgtoolerr_t imgtool_image_write_block(imgtool_image *image, UINT64 block, const void *buffer); +imgtoolerr_t imgtool_image_clear_block(imgtool_image *image, UINT64 block, UINT8 data); +imgtoolerr_t imgtool_image_list_partitions(imgtool_image *image, imgtool_partition_info *partitions, size_t len); +void *imgtool_image_malloc(imgtool_image *image, size_t size); +const imgtool_module *imgtool_image_module(imgtool_image *image); +void *imgtool_image_extra_bytes(imgtool_image *image); +UINT64 imgtool_image_rand(imgtool_image *image); + +/* ----- partition management ----- */ +imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, imgtool_partition **partition); +void imgtool_partition_close(imgtool_partition *partition); +imgtool_image *imgtool_partition_image(imgtool_partition *partition); + +/* ----- partition operations ----- */ +imgtoolerr_t imgtool_partition_get_directory_entry(imgtool_partition *partition, const char *path, int index, imgtool_dirent *ent); +imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const char *filename, UINT64 *filesize); +imgtoolerr_t imgtool_partition_get_free_space(imgtool_partition *partition, UINT64 *sz); +imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter); +imgtoolerr_t imgtool_partition_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *resolution, filter_getinfoproc filter); +imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char *filename, const char *fork, const char *dest, filter_getinfoproc filter); +imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char *newfname, const char *fork, const char *source, option_resolution *opts, filter_getinfoproc filter); +imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const char *fname); +imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len); +imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, const char *path); +imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, const char *path); +imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len); +imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values); +imgtoolerr_t imgtool_partition_put_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values); +imgtoolerr_t imgtool_partition_get_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute *value); +imgtoolerr_t imgtool_partition_put_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute value); +void imgtool_partition_get_attribute_name(imgtool_partition *partition, UINT32 attribute, const imgtool_attribute *attr_value, char *buffer, size_t buffer_len); +imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo); +imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition, const char *path, imgtool_stream *stream, imgtool_transfer_suggestion *suggestions, size_t suggestions_length); +imgtoolerr_t imgtool_partition_get_block_size(imgtool_partition *partition, UINT32 *length); +imgtoolerr_t imgtool_partition_read_block(imgtool_partition *partition, UINT64 block, void *buffer); +imgtoolerr_t imgtool_partition_write_block(imgtool_partition *partition, UINT64 block, const void *buffer); +imgtoolerr_t imgtool_partition_get_chain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size); +imgtoolerr_t imgtool_partition_get_chain_string(imgtool_partition *partition, const char *path, char *buffer, size_t buffer_len); +imgtool_partition_features imgtool_partition_get_features(imgtool_partition *partition); +void * imgtool_partition_get_info_ptr(imgtool_partition *partition, UINT32 state); +const char * imgtool_partition_get_info_string(imgtool_partition *partition, UINT32 state); +UINT64 imgtool_partition_get_info_int(imgtool_partition *partition, UINT32 state); +void * imgtool_partition_extra_bytes(imgtool_partition *partition); +UINT64 imgtool_partition_rand(imgtool_partition *partition); + +/* ----- path management ----- */ +const char * imgtool_partition_get_root_path(imgtool_partition *partition); +const char * imgtool_partition_path_concatenate(imgtool_partition *partition, const char *path1, const char *path2); +const char * imgtool_partition_get_base_name(imgtool_partition *partition, const char *path); + +/* ----- directory management ----- */ +imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *path, imgtool_directory **outenum); +void imgtool_directory_close(imgtool_directory *enumeration); +imgtoolerr_t imgtool_directory_get_next(imgtool_directory *enumeration, imgtool_dirent *ent); +const imgtool_module *imgtool_directory_module(imgtool_directory *enumeration); +void *imgtool_directory_extrabytes(imgtool_directory *enumeration); +imgtool_partition *imgtool_directory_partition(imgtool_directory *directory); +imgtool_image *imgtool_directory_image(imgtool_directory *enumeration); + +/* ----- special ----- */ +int imgtool_validitychecks(void); +void unknown_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); + +char *strncpyz(char *dest, const char *source, size_t len); +char *strncatz(char *dest, const char *source, size_t len); +void rtrim(char *buf); + +#endif /* IMGTOOL_H */ diff --git a/src/mame/tools/imgtool/library.c b/src/mame/tools/imgtool/library.c new file mode 100644 index 00000000000..e2ce14d4461 --- /dev/null +++ b/src/mame/tools/imgtool/library.c @@ -0,0 +1,282 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/**************************************************************************** + + library.c + + Code relevant to the Imgtool library; analgous to the MESS/MAME driver + list. + +****************************************************************************/ + +#include + +#include "imgtool.h" +#include "library.h" +#include "pool.h" + +struct imgtool_library +{ + object_pool *pool; + imgtool_module *first; + imgtool_module *last; +}; + + + +imgtool_library *imgtool_library_create(void) +{ + imgtool_library *library; + object_pool *pool; + + /* create a memory pool */ + pool = pool_alloc_lib(NULL); + if (!pool) + goto error; + + /* allocate the main structure */ + library = (imgtool_library *)pool_malloc_lib(pool, sizeof(imgtool_library)); + if (!library) + goto error; + + /* initialize the structure */ + memset(library, 0, sizeof(*library)); + library->pool = pool; + + return library; + +error: + if (pool) + pool_free_lib(pool); + return NULL; +} + + + +void imgtool_library_close(imgtool_library *library) +{ + pool_free_lib(library->pool); +} + + + +static void imgtool_library_add_class(imgtool_library *library, const imgtool_class *imgclass) +{ + imgtool_module *module; + char *s1, *s2; + + /* allocate the module and place it in the chain */ + module = (imgtool_module *)imgtool_library_malloc(library, sizeof(*module)); + memset(module, 0, sizeof(*module)); + module->previous = library->last; + if (library->last) + library->last->next = module; + else + library->first = module; + library->last = module; + + /* extensions have a weird format */ + s1 = imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_FILE_EXTENSIONS); + s2 = (char*)imgtool_library_malloc(library, strlen(s1) + 1); + strcpy(s2, s1); + module->extensions = s2; + + module->imgclass = *imgclass; + module->name = imgtool_library_strdup(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_NAME)); + module->description = imgtool_library_strdup(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_DESCRIPTION)); + module->eoln = imgtool_library_strdup_allow_null(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_EOLN)); + module->initial_path_separator = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR) ? 1 : 0; + module->open_is_strict = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_OPEN_IS_STRICT) ? 1 : 0; + module->tracks_are_called_cylinders = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS) ? 1 : 0; + module->writing_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED) ? 1 : 0; + module->creation_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_CREATION_UNTESTED) ? 1 : 0; + module->open = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_OPEN); + module->create = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *, option_resolution *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CREATE); + module->close = (void (*)(imgtool_image *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CLOSE); + module->info = (void (*)(imgtool_image *, char *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_INFO); + module->read_sector = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_SECTOR); + module->write_sector = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, const void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_SECTOR); + module->get_geometry = (imgtoolerr_t (*)(imgtool_image *, UINT32 *, UINT32 *, UINT32 *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_GEOMETRY); + module->get_sector_size = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, UINT32 *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_SECTOR_SIZE); + module->read_block = (imgtoolerr_t (*)(imgtool_image *, void *, UINT64)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_BLOCK); + module->write_block = (imgtoolerr_t (*)(imgtool_image *, const void *, UINT64)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_BLOCK); + module->list_partitions = (imgtoolerr_t (*)(imgtool_image *, imgtool_partition_info *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_LIST_PARTITIONS); + module->block_size = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_BLOCK_SIZE); + module->createimage_optguide = (const option_guide *) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE); + module->createimage_optspec = imgtool_library_strdup_allow_null(library, (const char*)imgtool_get_info_ptr(imgclass, IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC)); + module->image_extra_bytes += imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES); +} + + + +void imgtool_library_add(imgtool_library *library, imgtool_get_info get_info) +{ + int (*make_class)(int index, imgtool_class *imgclass); + imgtool_class imgclass; + int i, result; + + /* try this class */ + memset(&imgclass, 0, sizeof(imgclass)); + imgclass.get_info = get_info; + + /* do we have derived getinfo functions? */ + make_class = (int (*)(int index, imgtool_class *imgclass)) + imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_MAKE_CLASS); + + if (make_class) + { + i = 0; + do + { + /* clear out the class */ + memset(&imgclass, 0, sizeof(imgclass)); + imgclass.get_info = get_info; + + /* make the class */ + result = make_class(i++, &imgclass); + if (result) + imgtool_library_add_class(library, &imgclass); + } + while(result); + } + else + { + imgtool_library_add_class(library, &imgclass); + } +} + + + +const imgtool_module *imgtool_library_unlink(imgtool_library *library, + const char *module) +{ + imgtool_module *m; + imgtool_module **previous; + imgtool_module **next; + + for (m = library->first; m; m = m->next) + { + if (!core_stricmp(m->name, module)) + { + previous = m->previous ? &m->previous->next : &library->first; + next = m->next ? &m->next->previous : &library->last; + *previous = m->next; + *next = m->previous; + m->previous = NULL; + m->next = NULL; + return m; + } + } + return NULL; +} + + + +static int module_compare(const imgtool_module *m1, + const imgtool_module *m2, imgtool_libsort_t sort) +{ + int rc = 0; + switch(sort) + { + case ITLS_NAME: + rc = strcmp(m1->name, m2->name); + break; + case ITLS_DESCRIPTION: + rc = core_stricmp(m1->name, m2->name); + break; + } + return rc; +} + + + +void imgtool_library_sort(imgtool_library *library, imgtool_libsort_t sort) +{ + imgtool_module *m1; + imgtool_module *m2; + imgtool_module *target; + imgtool_module **before; + imgtool_module **after; + + for (m1 = library->first; m1; m1 = m1->next) + { + target = m1; + for (m2 = m1->next; m2; m2 = m2->next) + { + while(module_compare(target, m2, sort) > 0) + target = m2; + } + + if (target != m1) + { + /* unlink the target */ + before = target->previous ? &target->previous->next : &library->first; + after = target->next ? &target->next->previous : &library->last; + *before = target->next; + *after = target->previous; + + /* now place the target before m1 */ + target->previous = m1->previous; + target->next = m1; + before = m1->previous ? &m1->previous->next : &library->first; + *before = target; + m1->previous = target; + + /* since we changed the order, we have to replace ourselves */ + m1 = target; + } + } +} + + + +const imgtool_module *imgtool_library_findmodule( + imgtool_library *library, const char *module_name) +{ + const imgtool_module *module; + + assert(library); + module = library->first; + while(module && module_name && strcmp(module->name, module_name)) + module = module->next; + return module; +} + + + +imgtool_module *imgtool_library_iterate(imgtool_library *library, const imgtool_module *module) +{ + return module ? module->next : library->first; +} + + + +imgtool_module *imgtool_library_index(imgtool_library *library, int i) +{ + imgtool_module *module; + module = library->first; + while(module && i--) + module = module->next; + return module; +} + + + +void *imgtool_library_malloc(imgtool_library *library, size_t mem) +{ + return pool_malloc_lib(library->pool, mem); +} + + + +char *imgtool_library_strdup(imgtool_library *library, const char *s) +{ + return pool_strdup_lib(library->pool, s); +} + + + +char *imgtool_library_strdup_allow_null(imgtool_library *library, const char *s) +{ + return s ? imgtool_library_strdup(library, s) : NULL; +} diff --git a/src/mame/tools/imgtool/library.h b/src/mame/tools/imgtool/library.h new file mode 100644 index 00000000000..25c923c1f4d --- /dev/null +++ b/src/mame/tools/imgtool/library.h @@ -0,0 +1,408 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/**************************************************************************** + + library.h + + Code relevant to the Imgtool library; analgous to the MESS/MAME driver + list. + + Unlike MESS and MAME which have static driver lists, Imgtool has a + concept of a library and this library is built at startup time. + dynamic for which modules are added to. This makes "dynamic" modules + much easier + +****************************************************************************/ + +#ifndef LIBRARY_H +#define LIBRARY_H + +#include + +#include "corestr.h" +#include "opresolv.h" +#include "stream.h" +#include "unicode.h" +#include "charconv.h" + + +struct imgtool_image; +struct imgtool_partition; +struct imgtool_directory; +struct imgtool_library; + +enum imgtool_suggestion_viability_t +{ + SUGGESTION_END, + SUGGESTION_POSSIBLE, + SUGGESTION_RECOMMENDED +}; + +union filterinfo +{ + INT64 i; /* generic integers */ + void * p; /* generic pointers */ + void * f; /* generic function pointers */ + const char *s; /* generic strings */ + + imgtoolerr_t (*read_file)(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); + imgtoolerr_t (*write_file)(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts); + imgtoolerr_t (*check_stream)(imgtool_stream *stream, imgtool_suggestion_viability_t *viability); +}; + +typedef void (*filter_getinfoproc)(UINT32 state, union filterinfo *info); + +enum imgtool_libsort_t +{ + ITLS_NAME, + ITLS_DESCRIPTION +}; + +struct imgtool_dirent +{ + char filename[1024]; + char attr[64]; + UINT64 filesize; + + time_t creation_time; + time_t lastmodified_time; + time_t lastaccess_time; + + char softlink[1024]; + char comment[256]; + + /* flags */ + unsigned int eof : 1; + unsigned int corrupt : 1; + unsigned int directory : 1; + unsigned int hardlink : 1; +}; + +struct imgtool_chainent +{ + UINT8 level; + UINT64 block; +}; + +enum imgtool_forktype_t +{ + FORK_END, + FORK_DATA, + FORK_RESOURCE, + FORK_ALTERNATE +}; + +struct imgtool_forkent +{ + imgtool_forktype_t type; + UINT64 size; + char forkname[64]; +}; + +struct imgtool_transfer_suggestion +{ + imgtool_suggestion_viability_t viability; + filter_getinfoproc filter; + const char *fork; + const char *description; +}; + +enum +{ + /* --- the following bits of info are returned as 64-bit signed integers --- */ + IMGTOOLATTR_INT_FIRST = 0x00000, + IMGTOOLATTR_INT_MAC_TYPE, + IMGTOOLATTR_INT_MAC_CREATOR, + IMGTOOLATTR_INT_MAC_FINDERFLAGS, + IMGTOOLATTR_INT_MAC_COORDX, + IMGTOOLATTR_INT_MAC_COORDY, + IMGTOOLATTR_INT_MAC_FINDERFOLDER, + IMGTOOLATTR_INT_MAC_ICONID, + IMGTOOLATTR_INT_MAC_SCRIPTCODE, + IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS, + IMGTOOLATTR_INT_MAC_COMMENTID, + IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY, + + /* --- the following bits of info are returned as pointers to data or functions --- */ + IMGTOOLATTR_PTR_FIRST = 0x10000, + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + IMGTOOLATTR_STR_FIRST = 0x20000, + + /* --- the following bits of info are returned as time_t values --- */ + IMGTOOLATTR_TIME_FIRST = 0x30000, + IMGTOOLATTR_TIME_CREATED, + IMGTOOLATTR_TIME_LASTMODIFIED +}; + +union imgtool_attribute +{ + INT64 i; + time_t t; +}; + +struct imgtool_iconinfo +{ + unsigned icon16x16_specified : 1; + unsigned icon32x32_specified : 1; + UINT32 icon16x16[16][16]; + UINT32 icon32x32[32][32]; +}; + +enum +{ + /* --- the following bits of info are returned as 64-bit signed integers --- */ + IMGTOOLINFO_INT_FIRST = 0x00000, + IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES, + IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES, + IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES, + IMGTOOLINFO_INT_PATH_SEPARATOR, + IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR, + IMGTOOLINFO_INT_PREFER_UCASE, + IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR, + IMGTOOLINFO_INT_OPEN_IS_STRICT, + IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME, + IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME, + IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS, + IMGTOOLINFO_INT_WRITING_UNTESTED, + IMGTOOLINFO_INT_CREATION_UNTESTED, + IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK, + IMGTOOLINFO_INT_BLOCK_SIZE, + IMGTOOLINFO_INT_CHARSET, + + IMGTOOLINFO_INT_CLASS_SPECIFIC = 0x08000, + + /* --- the following bits of info are returned as pointers to data or functions --- */ + IMGTOOLINFO_PTR_FIRST = 0x10000, + + IMGTOOLINFO_PTR_OPEN, + IMGTOOLINFO_PTR_CREATE, + IMGTOOLINFO_PTR_CLOSE, + IMGTOOLINFO_PTR_OPEN_PARTITION, + IMGTOOLINFO_PTR_CREATE_PARTITION, + IMGTOOLINFO_PTR_INFO, + IMGTOOLINFO_PTR_BEGIN_ENUM, + IMGTOOLINFO_PTR_NEXT_ENUM, + IMGTOOLINFO_PTR_CLOSE_ENUM, + IMGTOOLINFO_PTR_FREE_SPACE, + IMGTOOLINFO_PTR_READ_FILE, + IMGTOOLINFO_PTR_WRITE_FILE, + IMGTOOLINFO_PTR_DELETE_FILE, + IMGTOOLINFO_PTR_LIST_FORKS, + IMGTOOLINFO_PTR_CREATE_DIR, + IMGTOOLINFO_PTR_DELETE_DIR, + IMGTOOLINFO_PTR_LIST_ATTRS, + IMGTOOLINFO_PTR_GET_ATTRS, + IMGTOOLINFO_PTR_SET_ATTRS, + IMGTOOLINFO_PTR_ATTR_NAME, + IMGTOOLINFO_PTR_GET_ICON_INFO, + IMGTOOLINFO_PTR_SUGGEST_TRANSFER, + IMGTOOLINFO_PTR_GET_CHAIN, + IMGTOOLINFO_PTR_GET_SECTOR_SIZE, + IMGTOOLINFO_PTR_GET_GEOMETRY, + IMGTOOLINFO_PTR_READ_SECTOR, + IMGTOOLINFO_PTR_WRITE_SECTOR, + IMGTOOLINFO_PTR_READ_BLOCK, + IMGTOOLINFO_PTR_WRITE_BLOCK, + IMGTOOLINFO_PTR_APPROVE_FILENAME_CHAR, + IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE, + IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE, + IMGTOOLINFO_PTR_MAKE_CLASS, + IMGTOOLINFO_PTR_LIST_PARTITIONS, + + IMGTOOLINFO_PTR_CLASS_SPECIFIC = 0x18000, + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + IMGTOOLINFO_STR_FIRST = 0x20000, + + IMGTOOLINFO_STR_NAME, + IMGTOOLINFO_STR_DESCRIPTION, + IMGTOOLINFO_STR_FILE, + IMGTOOLINFO_STR_FILE_EXTENSIONS, + IMGTOOLINFO_STR_EOLN, + IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC, + IMGTOOLINFO_STR_WRITEFILE_OPTSPEC, + + IMGTOOLINFO_STR_CLASS_SPECIFIC = 0x28000 +}; + + + +union imgtoolinfo; + +struct imgtool_class; +typedef void (*imgtool_get_info)(const imgtool_class *, UINT32, union imgtoolinfo *); + +struct imgtool_class +{ + imgtool_get_info get_info; + imgtool_get_info derived_get_info; + void *derived_param; +}; + + + +struct imgtool_partition_info +{ + imgtool_get_info get_info; + UINT64 base_block; + UINT64 block_count; +}; + + + +union imgtoolinfo +{ + INT64 i; /* generic integers */ + void * p; /* generic pointers */ + void * f; /* generic function pointers */ + char * s; /* generic strings */ + + imgtoolerr_t (*open) (imgtool_image *image, imgtool_stream *stream); + void (*close) (imgtool_image *image); + imgtoolerr_t (*create) (imgtool_image *image, imgtool_stream *stream, option_resolution *opts); + imgtoolerr_t (*create_partition) (imgtool_image *image, UINT64 first_block, UINT64 block_count); + void (*info) (imgtool_image *image, char *string, size_t len); + imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path); + imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent); + void (*close_enum) (imgtool_directory *enumeration); + imgtoolerr_t (*open_partition) (imgtool_partition *partition, UINT64 first_block, UINT64 block_count); + imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size); + imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); + imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts); + imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename); + imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len); + imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path); + imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path); + imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len); + imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values); + imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values); + imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len); + imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo); + imgtoolerr_t (*suggest_transfer) (imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length); + imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size); + imgtoolerr_t (*get_sector_size) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size); + imgtoolerr_t (*get_geometry) (imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors); + imgtoolerr_t (*read_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len); + imgtoolerr_t (*write_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam); + imgtoolerr_t (*read_block) (imgtool_image *image, void *buffer, UINT64 block); + imgtoolerr_t (*write_block) (imgtool_image *image, const void *buffer, UINT64 block); + imgtoolerr_t (*list_partitions) (imgtool_image *image, imgtool_partition_info *partitions, size_t len); + int (*approve_filename_char)(unicode_char ch); + int (*make_class)(int index, imgtool_class *imgclass); + + const option_guide *createimage_optguide; + const option_guide *writefile_optguide; +}; + + + +INLINE INT64 imgtool_get_info_int(const imgtool_class *imgclass, UINT32 state) +{ + union imgtoolinfo info; + info.i = 0; + imgclass->get_info(imgclass, state, &info); + return info.i; +} + +INLINE void *imgtool_get_info_ptr(const imgtool_class *imgclass, UINT32 state) +{ + union imgtoolinfo info; + info.p = NULL; + imgclass->get_info(imgclass, state, &info); + return info.p; +} + +INLINE void *imgtool_get_info_fct(const imgtool_class *imgclass, UINT32 state) +{ + union imgtoolinfo info; + info.f = NULL; + imgclass->get_info(imgclass, state, &info); + return info.f; +} + +INLINE char *imgtool_get_info_string(const imgtool_class *imgclass, UINT32 state) +{ + union imgtoolinfo info; + info.s = NULL; + imgclass->get_info(imgclass, state, &info); + return info.s; +} + +/* circular string buffer */ +char *imgtool_temp_str(void); + + + +struct imgtool_module +{ + imgtool_module *previous; + imgtool_module *next; + + imgtool_class imgclass; + + const char *name; + const char *description; + const char *extensions; + const char *eoln; + + size_t image_extra_bytes; + + /* flags */ + unsigned int initial_path_separator : 1; + unsigned int open_is_strict : 1; + unsigned int tracks_are_called_cylinders : 1; /* used for hard drivers */ + unsigned int writing_untested : 1; /* used when we support writing, but not in main build */ + unsigned int creation_untested : 1; /* used when we support creation, but not in main build */ + + imgtoolerr_t (*open) (imgtool_image *image, imgtool_stream *f); + void (*close) (imgtool_image *image); + void (*info) (imgtool_image *image, char *string, size_t len); + imgtoolerr_t (*create) (imgtool_image *image, imgtool_stream *f, option_resolution *opts); + imgtoolerr_t (*get_sector_size)(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size); + imgtoolerr_t (*get_geometry) (imgtool_image *image, UINT32 *track, UINT32 *heads, UINT32 *sectors); + imgtoolerr_t (*read_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len); + imgtoolerr_t (*write_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len); + imgtoolerr_t (*read_block) (imgtool_image *image, void *buffer, UINT64 block); + imgtoolerr_t (*write_block) (imgtool_image *image, const void *buffer, UINT64 block); + imgtoolerr_t (*list_partitions)(imgtool_image *image, imgtool_partition_info *partitions, size_t len); + + UINT32 block_size; + + const option_guide *createimage_optguide; + const char *createimage_optspec; + + const void *extra; +}; + +/* creates an imgtool library */ +imgtool_library *imgtool_library_create(void); + +/* closes an imgtool library */ +void imgtool_library_close(imgtool_library *library); + +/* adds a module to an imgtool library */ +void imgtool_library_add(imgtool_library *library, imgtool_get_info get_info); + +/* seeks out and removes a module from an imgtool library */ +const imgtool_module *imgtool_library_unlink(imgtool_library *library, + const char *module); + +/* sorts an imgtool library */ +void imgtool_library_sort(imgtool_library *library, imgtool_libsort_t sort); + +/* finds a module */ +const imgtool_module *imgtool_library_findmodule( + imgtool_library *library, const char *module_name); + +/* memory allocators for pooled library memory */ +void *imgtool_library_malloc(imgtool_library *library, size_t mem); +char *imgtool_library_strdup(imgtool_library *library, const char *s); +char *imgtool_library_strdup_allow_null(imgtool_library *library, const char *s); + +imgtool_module *imgtool_library_iterate( + imgtool_library *library, const imgtool_module *module); +imgtool_module *imgtool_library_index( + imgtool_library *library, int i); + +#endif /* LIBRARY_H */ diff --git a/src/mame/tools/imgtool/main.c b/src/mame/tools/imgtool/main.c new file mode 100644 index 00000000000..6825b71fa81 --- /dev/null +++ b/src/mame/tools/imgtool/main.c @@ -0,0 +1,972 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + main.c + + Imgtool command line front end + +***************************************************************************/ + +#include +#include +#include +#include +#include + +#include "imgtool.h" +#include "main.h" +#include "modules.h" +/* ---------------------------------------------------------------------- */ + +static void writeusage(FILE *f, int write_word_usage, const struct command *c, char *argv[]) +{ + fprintf(f, "%s %s %s %s\n", + (write_word_usage ? "Usage:" : " "), + imgtool_basename(argv[0]), + c->name, + c->usage ? c->usage : ""); +} + + + +/* ----------------------------------------------------------------------- */ + +static int parse_options(int argc, char *argv[], int minunnamed, int maxunnamed, + option_resolution *resolution, filter_getinfoproc *filter, const char **fork) +{ + int i; + int lastunnamed = 0; + char *s; + char *name = NULL; + char *value = NULL; + optreserr_t oerr; + static char buf[256]; + + if (filter) + *filter = NULL; + if (fork) + *fork = NULL; + + for (i = 0; i < argc; i++) + { + /* Named or unamed arg */ + if ((argv[i][0] != '-') || (argv[i][1] != '-')) + { + /* Unnamed */ + if (i >= maxunnamed) + goto error; /* Too many unnamed */ + lastunnamed = i + 1; + } + else + { + /* Named */ + name = argv[i] + 2; + s = strchr(name, '='); + if (!s) + goto error; + *s = 0; + value = s + 1; + + if (!strcmp(name, "filter")) + { + /* filter option */ + if (!filter) + goto error; /* this command doesn't use filters */ + if (*filter) + goto optionalreadyspecified; + *filter = filter_lookup(value); + if (!(*filter)) + goto filternotfound; + + } + else if (!strcmp(name, "fork")) + { + /* fork option */ + if (!fork) + goto error; /* this command doesn't use filters */ + if (*fork) + goto optionalreadyspecified; + + snprintf(buf, ARRAY_LENGTH(buf), "%s", value); + *fork = buf; + } + else + { + /* Other named option */ + if (i < minunnamed) + goto error; /* Too few unnamed */ + + oerr = option_resolution_add_param(resolution, name, value); + if (oerr) + goto opterror; + } + } + } + return lastunnamed; + +filternotfound: + fprintf(stderr, "%s: Unknown filter type\n", value); + return -1; + +optionalreadyspecified: + fprintf(stderr, "Cannot specify multiple %ss\n", name); + return -1; + +opterror: + fprintf(stderr, "%s: %s\n", name, option_resolution_error_string(oerr)); + return -1; + +error: + fprintf(stderr, "%s: Unrecognized option\n", argv[i]); + return -1; +} + + + +void reporterror(imgtoolerr_t err, const struct command *c, const char *format, const char *imagename, + const char *filename, const char *newname, option_resolution *opts) +{ + const char *src = "imgtool"; + const char *err_name; + + err_name = imgtool_error(err); + + switch(ERRORSOURCE(err)) { + case IMGTOOLERR_SRC_MODULE: + src = format; + break; + case IMGTOOLERR_SRC_FUNCTIONALITY: + src = c->name; + break; + case IMGTOOLERR_SRC_IMAGEFILE: + src = imagename; + break; + case IMGTOOLERR_SRC_FILEONIMAGE: + src = filename; + break; + case IMGTOOLERR_SRC_NATIVEFILE: + src = newname ? newname : filename; + break; + } + fflush(stdout); + fflush(stderr); + + if (!src) + src = c->name; + fprintf(stderr, "%s: %s\n", src, err_name); +} + + + +static const char *interpret_filename(const char *filename) +{ + if (!strcmp(filename, "??BOOT??") + || !strcmp(filename, "\'??BOOT??\'") + || !strcmp(filename, "\"??BOOT??\"")) + filename = FILENAME_BOOTBLOCK; + return filename; +} + + + +/* ----------------------------------------------------------------------- */ + +static int cmd_dir(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + int total_count, total_size, freespace_err; + UINT64 freespace; + imgtool_image *image = NULL; + imgtool_partition *partition = NULL; + imgtool_directory *imgenum = NULL; + imgtool_dirent ent; + char buf[512]; + char last_modified[19]; + const char *path; + int partition_index = 0; + + /* attempt to open image */ + err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_READ, &image); + if (err) + goto done; + + /* attempt to open partition */ + err = imgtool_partition_open(image, partition_index, &partition); + if (err) + goto done; + + path = argc > 2 ? argv[2] : NULL; + + err = imgtool_directory_open(partition, path, &imgenum); + if (err) + goto done; + + memset(&ent, 0, sizeof(ent)); + last_modified[0] = '\0'; + total_count = 0; + total_size = 0; + + fprintf(stdout, "Contents of %s:%s\n", argv[1], path ? path : ""); + + imgtool_image_info(image, buf, sizeof(buf)); + if (buf[0]) + fprintf(stdout, "%s\n", buf); + fprintf(stdout, "------------------------------ -------- --------------- ------------------\n"); + + while (((err = imgtool_directory_get_next(imgenum, &ent)) == 0) && !ent.eof) + { + if (ent.directory) + snprintf(buf, sizeof(buf), ""); + else + snprintf(buf, sizeof(buf), "%u", (unsigned int) ent.filesize); + + if (ent.lastmodified_time != 0) + strftime(last_modified, sizeof(last_modified), "%d-%b-%y %H:%M:%S", + localtime(&ent.lastmodified_time)); + + if (ent.hardlink) + strcat(ent.filename, " "); + + fprintf(stdout, "%-30s %8s %15s %18s\n", ent.filename, buf, ent.attr, last_modified); + + if (ent.softlink && ent.softlink[0] != '\0') + fprintf(stdout, "-> %s\n", ent.softlink); + + if (ent.comment && ent.comment[0] != '\0') + fprintf(stdout, ": %s\n", ent.comment); + + total_count++; + total_size += ent.filesize; + + memset(&ent, 0, sizeof(ent)); + } + + freespace_err = imgtool_partition_get_free_space(partition, &freespace); + + if (err) + goto done; + + fprintf(stdout, "------------------------ ------ ---------------\n"); + fprintf(stdout, "%8i File(s) %8i bytes\n", total_count, total_size); + if (!freespace_err) + fprintf(stdout, " %8u bytes free\n", (unsigned int) freespace); + +done: + if (imgenum) + imgtool_directory_close(imgenum); + if (partition) + imgtool_partition_close(partition); + if (image) + imgtool_image_close(image); + if (err) + reporterror(err, c, argv[0], argv[1], NULL, NULL, NULL); + return err ? -1 : 0; +} + + + +static int cmd_get(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + imgtool_image *image = NULL; + imgtool_partition *partition = NULL; + const char *filename; + char *new_filename; + int unnamedargs = 0; + filter_getinfoproc filter; + const char *fork; + int partition_index = 0; + + err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_READ, &image); + if (err) + goto done; + + err = imgtool_partition_open(image, partition_index, &partition); + if (err) + goto done; + + filename = interpret_filename(argv[2]); + + unnamedargs = parse_options(argc, argv, 3, 4, NULL, &filter, &fork); + if (unnamedargs < 0) + goto done; + + new_filename = (unnamedargs == 4) ? argv[3] : NULL; + + err = imgtool_partition_get_file(partition, filename, fork, new_filename, filter); + if (err) + goto done; + + err = IMGTOOLERR_SUCCESS; + +done: + if (err) + reporterror(err, c, argv[0], argv[1], argv[2], argv[3], NULL); + if (partition) + imgtool_partition_close(partition); + if (image) + imgtool_image_close(image); + return (err || (unnamedargs < 0)) ? -1 : 0; +} + + + +static int cmd_put(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + int i; + imgtool_image *image = NULL; + imgtool_partition *partition = NULL; + const char *filename = NULL; + int unnamedargs; + filter_getinfoproc filter; + const imgtool_module *module; + option_resolution *resolution = NULL; + const char *fork; + const char *new_filename; + char **filename_list; + int filename_count; + int partition_index = 0; + const option_guide *writefile_optguide; + const char *writefile_optspec; + + module = imgtool_find_module(argv[0]); + if (!module) + { + err = (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); + goto done; + } + + /* ugh I hate the way this function is set up, this is because the + * arguments depend on the partition; something that requires some + * rudimentary parsing */ + if (argc >= 2) + { + /* open up the image */ + err = imgtool_image_open(module, argv[1], OSD_FOPEN_RW, &image); + if (err) + goto done; + + /* open up the partition */ + err = imgtool_partition_open(image, partition_index, &partition); + if (err) + goto done; + + writefile_optguide = (const option_guide *) imgtool_partition_get_info_ptr(partition, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE); + writefile_optspec = (const char *)imgtool_partition_get_info_ptr(partition, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC); + + if (writefile_optguide && writefile_optspec) + { + resolution = option_resolution_create(writefile_optguide, writefile_optspec); + if (!resolution) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + } + } + + unnamedargs = parse_options(argc, argv, 4, 0xffff, resolution, &filter, &fork); + if (unnamedargs < 0) + return -1; + + /* pick out which args are filenames, and which one is the destination */ + new_filename = interpret_filename(argv[unnamedargs - 1]); + filename_list = &argv[2]; + filename_count = unnamedargs - 3; + + /* loop through the filenames, and put them */ + for (i = 0; i < filename_count; i++) + { + filename = filename_list[i]; + printf("Putting file '%s'...\n", filename); + err = imgtool_partition_put_file(partition, new_filename, fork, filename, resolution, filter); + if (err) + goto done; + } + +done: + if (partition) + imgtool_partition_close(partition); + if (image) + imgtool_image_close(image); + if (resolution) + option_resolution_close(resolution); + if (err) + reporterror(err, c, argv[0], argv[1], filename, NULL, resolution); + return err ? -1 : 0; +} + + + +static int cmd_getall(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + imgtool_image *image = NULL; + imgtool_partition *partition = NULL; + imgtool_directory *imgenum = NULL; + imgtool_dirent ent; + filter_getinfoproc filter; + int unnamedargs; + const char *path = NULL; + int arg; + int partition_index = 0; + + err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_READ, &image); + if (err) + goto done; + + err = imgtool_partition_open(image, partition_index, &partition); + if (err) + goto done; + + arg = 2; + if ((argc > 2) && (argv[2][0] != '-')) + { + path = argv[arg++]; + } + + unnamedargs = parse_options(argc, argv, arg, arg, NULL, &filter, NULL); + if (unnamedargs < 0) + goto done; + + err = imgtool_directory_open(partition, path, &imgenum); + if (err) + goto done; + + memset(&ent, 0, sizeof(ent)); + + while (((err = imgtool_directory_get_next(imgenum, &ent)) == 0) && !ent.eof) + { + fprintf(stdout, "Retrieving %s (%u bytes)\n", ent.filename, (unsigned int) ent.filesize); + + err = imgtool_partition_get_file(partition, ent.filename, NULL, NULL, filter); + if (err) + goto done; + } + +done: + if (imgenum) + imgtool_directory_close(imgenum); + if (partition) + imgtool_partition_close(partition); + if (image) + imgtool_image_close(image); + if (err) + reporterror(err, c, argv[0], argv[1], NULL, NULL, NULL); + return err ? -1 : 0; +} + + + +static int cmd_del(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + imgtool_image *image = NULL; + imgtool_partition *partition = NULL; + int partition_index = 0; + + err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); + if (err) + goto done; + + err = imgtool_partition_open(image, partition_index, &partition); + if (err) + goto done; + + err = imgtool_partition_delete_file(partition, argv[2]); + if (err) + goto done; + +done: + if (partition) + imgtool_partition_close(partition); + if (image) + imgtool_image_close(image); + if (err) + reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); + return err ? -1 : 0; +} + + + +static int cmd_mkdir(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + imgtool_image *image = NULL; + imgtool_partition *partition = NULL; + int partition_index = 0; + + err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); + if (err) + goto done; + + err = imgtool_partition_open(image, partition_index, &partition); + if (err) + goto done; + + err = imgtool_partition_create_directory(partition, argv[2]); + if (err) + goto done; + +done: + if (partition) + imgtool_partition_close(partition); + if (image) + imgtool_image_close(image); + if (err) + reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); + return err ? -1 : 0; +} + + + +static int cmd_rmdir(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + imgtool_image *image = NULL; + imgtool_partition *partition = NULL; + int partition_index = 0; + + err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); + if (err) + goto done; + + err = imgtool_partition_open(image, partition_index, &partition); + if (err) + goto done; + + err = imgtool_partition_delete_directory(partition, argv[2]); + if (err) + goto done; + +done: + if (partition) + imgtool_partition_close(partition); + if (image) + imgtool_image_close(image); + if (err) + reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); + return err ? -1 : 0; +} + + + +static int cmd_identify(const struct command *c, int argc, char *argv[]) +{ + imgtool_module *modules[128]; + imgtoolerr_t err; + int i; + + err = imgtool_identify_file(argv[0], modules, ARRAY_LENGTH(modules)); + if (err) + goto error; + + for (i = 0; modules[i]; i++) + { + printf("%.16s %s\n", modules[i]->name, modules[i]->description); + } + + return 0; + +error: + reporterror(err, c, NULL, argv[0], NULL, NULL, 0); + return -1; +} + + + +static int cmd_create(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + int unnamedargs; + const imgtool_module *module; + option_resolution *resolution = NULL; + + module = imgtool_find_module(argv[0]); + if (!module) + { + err = (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); + goto error; + } + + if (module->createimage_optguide && module->createimage_optspec) + { + resolution = option_resolution_create(module->createimage_optguide, module->createimage_optspec); + if (!resolution) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto error; + } + } + + unnamedargs = parse_options(argc, argv, 2, 3, resolution, NULL, NULL); + if (unnamedargs < 0) + return -1; + + err = imgtool_image_create(module, argv[1], resolution, NULL); + if (err) + goto error; + + if (resolution) + option_resolution_close(resolution); + return 0; + +error: + if (resolution) + option_resolution_close(resolution); + reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); + return -1; +} + + + +static int cmd_readsector(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + imgtool_image *img; + imgtool_stream *stream = NULL; + dynamic_buffer buffer; + UINT32 size, track, head, sector; + + /* attempt to open image */ + err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_READ, &img); + if (err) + goto done; + + track = atoi(argv[2]); + head = atoi(argv[3]); + sector = atoi(argv[4]); + + err = imgtool_image_get_sector_size(img, track, head, sector, &size); + if (err) + goto done; + + buffer.resize(size); + + err = imgtool_image_read_sector(img, track, head, sector, &buffer[0], size); + if (err) + goto done; + + + stream = stream_open(argv[5], OSD_FOPEN_WRITE); + if (!stream) + { + err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE); + goto done; + } + + stream_write(stream, &buffer[0], size); + +done: + if (stream) + stream_close(stream); + if (err) + reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); + return err ? -1 : 0; +} + + + +static int cmd_writesector(const struct command *c, int argc, char *argv[]) +{ + imgtoolerr_t err; + imgtool_image *img; + imgtool_stream *stream = NULL; + dynamic_buffer buffer; + UINT32 size, track, head, sector; + + /* attempt to open image */ + err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &img); + if (err) + goto done; + + track = atoi(argv[2]); + head = atoi(argv[3]); + sector = atoi(argv[4]); + + stream = stream_open(argv[5], OSD_FOPEN_READ); + if (!stream) + { + err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE); + goto done; + } + + size = (UINT32) stream_size(stream); + + buffer.resize(size); + + stream_read(stream, &buffer[0], size); + + err = imgtool_image_write_sector(img, track, head, sector, &buffer[0], size); + if (err) + goto done; + +done: + if (stream) + stream_close(stream); + if (err) + reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); + return err ? -1 : 0; +} + + + +static int cmd_listformats(const struct command *c, int argc, char *argv[]) +{ + const imgtool_module *mod; + + fprintf(stdout, "Image formats supported by imgtool:\n\n"); + + mod = imgtool_find_module(NULL); + while(mod) + { + fprintf(stdout, " %-25s%s\n", mod->name, mod->description); + mod = mod->next; + } + + return 0; +} + + + +static int cmd_listfilters(const struct command *c, int argc, char *argv[]) +{ + int i; + + fprintf(stdout, "Filters supported by imgtool:\n\n"); + + for (i = 0; filters[i]; i++) + { + fprintf(stdout, " %-11s%s\n", + filter_get_info_string(filters[i], FILTINFO_STR_NAME), + filter_get_info_string(filters[i], FILTINFO_STR_HUMANNAME)); + } + + return 0; +} + +static void listoptions(const option_guide *opt_guide, const char *opt_spec) +{ + char opt_name[32]; + const char *opt_desc; + struct OptionRange range[32]; + char range_buffer[512]; + char buf[32]; + int i; + + assert(opt_guide); + + fprintf(stdout, "Option Allowed values Description\n"); + fprintf(stdout, "---------------- ------------------------------ -----------\n"); + + while(opt_guide->option_type != OPTIONTYPE_END) + { + range_buffer[0] = 0; + snprintf(opt_name, ARRAY_LENGTH(opt_name), "--%s", opt_guide->identifier); + opt_desc = opt_guide->display_name; + + /* is this option relevant? */ + if (!strchr(opt_spec, opt_guide->parameter)) + { + opt_guide++; + continue; + } + + switch(opt_guide->option_type) { + case OPTIONTYPE_INT: + option_resolution_listranges(opt_spec, opt_guide->parameter, + range, ARRAY_LENGTH(range)); + + for (i = 0; range[i].max >= 0; i++) + { + if (range[i].min == range[i].max) + snprintf(buf, ARRAY_LENGTH(buf), "%i", range[i].min); + else + snprintf(buf, ARRAY_LENGTH(buf), "%i-%i", range[i].min, range[i].max); + + if (i > 0) + strncatz(range_buffer, "/", sizeof(range_buffer)); + strncatz(range_buffer, buf, sizeof(range_buffer)); + } + break; + + case OPTIONTYPE_ENUM_BEGIN: + i = 0; + while(opt_guide[1].option_type == OPTIONTYPE_ENUM_VALUE) + { + if (i > 0) + strncatz(range_buffer, "/", sizeof(range_buffer)); + strncatz(range_buffer, opt_guide[1].identifier, sizeof(range_buffer)); + + opt_guide++; + i++; + } + break; + + case OPTIONTYPE_STRING: + snprintf(range_buffer, sizeof(range_buffer), "(string)"); + break; + default: + assert(0); + break; + } + + fprintf(stdout, "%16s %-30s %s\n", + opt_name, + range_buffer, + opt_desc); + opt_guide++; + } +} + + + +static int cmd_listdriveroptions(const struct command *c, int argc, char *argv[]) +{ + const imgtool_module *mod; + const option_guide *opt_guide; + const char *opt_spec; + + mod = imgtool_find_module(argv[0]); + if (!mod) + goto error; + + fprintf(stdout, "Driver specific options for module '%s':\n\n", argv[0]); + + /* list write options */ + opt_guide = (const option_guide *) imgtool_get_info_ptr(&mod->imgclass, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE); + opt_spec = imgtool_get_info_string(&mod->imgclass, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC); + if (opt_guide) + { + fprintf(stdout, "Image specific file options (usable on the 'put' command):\n\n"); + listoptions(opt_guide, opt_spec); + puts("\n"); + } + else + { + fprintf(stdout, "No image specific file options\n\n"); + } + + /* list create options */ + opt_guide = mod->createimage_optguide; + if (opt_guide) + { + fprintf(stdout, "Image specific creation options (usable on the 'create' command):\n\n"); + listoptions(opt_guide, mod->createimage_optspec); + puts("\n"); + } + else + { + fprintf(stdout, "No image specific creation options\n\n"); + } + + return 0; + +error: + reporterror((imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND|IMGTOOLERR_SRC_MODULE), c, argv[0], NULL, NULL, NULL, NULL); + return -1; +} + + + +/* ----------------------------------------------------------------------- */ + +static const struct command cmds[] = +{ + { "create", cmd_create, " [--(createoption)=value]", 2, 8, 0}, + { "dir", cmd_dir, " [path]", 2, 3, 0 }, + { "get", cmd_get, " [newname] [--filter=filter] [--fork=fork]", 3, 4, 0 }, + { "put", cmd_put, " ... [--(fileoption)==value] [--filter=filter] [--fork=fork]", 3, 0xffff, 0 }, + { "getall", cmd_getall, " [path] [--filter=filter]", 2, 3, 0 }, + { "del", cmd_del, " ...", 3, 3, 1 }, + { "mkdir", cmd_mkdir, " ", 3, 3, 0 }, + { "rmdir", cmd_rmdir, " ...", 3, 3, 1 }, + { "readsector", cmd_readsector, " ", 6, 6, 0 }, + { "writesector", cmd_writesector, " ", 6, 6, 0 }, + { "identify", cmd_identify, "", 1, 1 }, + { "listformats", cmd_listformats, NULL, 0, 0, 0 }, + { "listfilters", cmd_listfilters, NULL, 0, 0, 0 }, + { "listdriveroptions", cmd_listdriveroptions, "", 1, 1, 0 } +}; + +int CLIB_DECL main(int argc, char *argv[]) +{ + int i; + int result; + const struct command *c; + const char *sample_format = "coco_jvc_rsdos"; + +#ifdef MAME_DEBUG + if (imgtool_validitychecks()) + return -1; +#endif /* MAME_DEBUG */ + + putchar('\n'); + + if (argc > 1) + { + /* figure out what command they are running, and run it */ + for (i = 0; i < ARRAY_LENGTH(cmds); i++) + { + c = &cmds[i]; + if (!core_stricmp(c->name, argv[1])) + { + /* check argument count */ + if (c->minargs > (argc - 2)) + goto cmderror; + + /* initialize the imgtool core */ + imgtool_init(TRUE, NULL); + + if (c->lastargrepeats && (argc > c->maxargs)) + { + for (i = c->maxargs+1; i < argc; i++) + { + argv[c->maxargs+1] = argv[i]; + + result = c->cmdproc(c, c->maxargs, argv + 2); + if (result) + goto done; + } + result = 0; + goto done; + } + else + { + if ((c->maxargs > 0) && (c->maxargs < (argc - 2))) + goto cmderror; + + result = c->cmdproc(c, argc - 2, argv + 2); + goto done; + } + } + } + } + + /* Usage */ + fprintf(stderr, "imgtool - Generic image manipulation tool for use with MESS\n\n"); + for (i = 0; i < ARRAY_LENGTH(cmds); i++) + { + writeusage(stdout, (i == 0), &cmds[i], argv); + } + + fprintf(stderr, "\n is the image format, e.g. %s\n", sample_format); + fprintf(stderr, " is the image filename; can specify a ZIP file for image name\n"); + + fprintf(stderr, "\nExample usage:\n"); + fprintf(stderr, "\t%s dir %s myimageinazip.zip\n", imgtool_basename(argv[0]), sample_format); + fprintf(stderr, "\t%s get %s myimage.dsk myfile.bin mynewfile.txt\n", imgtool_basename(argv[0]), sample_format); + fprintf(stderr, "\t%s getall %s myimage.dsk\n", imgtool_basename(argv[0]), sample_format); + result = 0; + goto done; + +cmderror: + writeusage(stdout, 1, &cmds[i], argv); + result = -1; + +done: + imgtool_exit(); + return result; +} diff --git a/src/mame/tools/imgtool/main.h b/src/mame/tools/imgtool/main.h new file mode 100644 index 00000000000..d4089686437 --- /dev/null +++ b/src/mame/tools/imgtool/main.h @@ -0,0 +1,20 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +#include "imgtool.h" + +struct command +{ + const char *name; + int (*cmdproc)(const struct command *c, int argc, char *argv[]); + const char *usage; + int minargs; + int maxargs; + int lastargrepeats; +}; + +void reporterror(imgtoolerr_t err, const struct command *c, const char *format, const char *imagename, + const char *filename, const char *newname, option_resolution *opts); + +#ifdef MAME_DEBUG +int cmd_testsuite(struct command *c, int argc, char *argv[]); +#endif diff --git a/src/mame/tools/imgtool/modules.c b/src/mame/tools/imgtool/modules.c new file mode 100644 index 00000000000..e5f0c43690c --- /dev/null +++ b/src/mame/tools/imgtool/modules.c @@ -0,0 +1,119 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + modules.c + + List of Imgtool modules + +***************************************************************************/ + +#include "imgtool.h" +#include "modules.h" + +#ifndef MODULES_RECURSIVE +#define MODULES_RECURSIVE + +/* step 1: declare all external references */ +#define MODULE(name) extern void name##_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); +#include "modules.c" +#undef MODULE + +/* step 2: define the modules[] array */ +#define MODULE(name) name##_get_info, +static void (*const modules[])(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) = +{ +#include "modules.c" +}; + +/* step 3: declare imgtool_create_cannonical_library() */ +imgtoolerr_t imgtool_create_cannonical_library(int omit_untested, imgtool_library **library) +{ + imgtoolerr_t err; + size_t i; + imgtool_library *lib; + imgtool_module *module; + + /* list of modules that we drop */ + static const char *const irrelevant_modules[] = + { + "coco_os9_rsdos" + }; + + lib = imgtool_library_create(); + if (!lib) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto error; + } + + /* create all modules */ + for (i = 0; i < ARRAY_LENGTH(modules); i++) + imgtool_library_add(lib, modules[i]); + + /* remove irrelevant modules */ + for (i = 0; i < ARRAY_LENGTH(irrelevant_modules); i++) + { + imgtool_library_unlink(lib, irrelevant_modules[i]); + } + + /* if we are omitting untested, go through and block out the functionality in question */ + if (omit_untested) + { + module = NULL; + while((module = imgtool_library_iterate(lib, module)) != NULL) + { + if (module->writing_untested) + { + module->write_sector = NULL; + } + if (module->creation_untested) + { + module->create = NULL; + module->createimage_optguide = NULL; + module->createimage_optspec = NULL; + } + } + } + + *library = lib; + return IMGTOOLERR_SUCCESS; + +error: + if (lib) + imgtool_library_close(lib); + return err; + +} + + +#else /* MODULES_RECURSIVE */ + +MODULE(amiga_floppy) +MODULE(concept) +MODULE(mac_mfs) +MODULE(mac_hfs) +MODULE(hd) +MODULE(rsdos) +MODULE(vzdos) +MODULE(os9) +MODULE(ti99_old) +MODULE(ti99_v9t9) +MODULE(ti99_pc99fm) +MODULE(ti99_pc99mfm) +MODULE(ti99_ti99hd) +MODULE(ti990) +MODULE(pc_floppy) +MODULE(pc_chd) +MODULE(prodos_525) +MODULE(prodos_35) +MODULE(thom_fd_basic) +MODULE(thom_qd_basic) +MODULE(thom_sap_basic) +MODULE(cybiko) +MODULE(cybikoxt) +MODULE(psion) +MODULE(bml3) +MODULE(hp48) + +#endif /* MODULES_RECURSIVE */ diff --git a/src/mame/tools/imgtool/modules.h b/src/mame/tools/imgtool/modules.h new file mode 100644 index 00000000000..6f5a3786c6b --- /dev/null +++ b/src/mame/tools/imgtool/modules.h @@ -0,0 +1,18 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/**************************************************************************** + + modules.h + + Code that creates the "canonical" Imgtool library + +****************************************************************************/ + +#ifndef MODULES_H +#define MODULES_H + +#include "library.h" + +imgtoolerr_t imgtool_create_cannonical_library(int omit_untested, imgtool_library **library); + +#endif /* MODULES_H */ diff --git a/src/mame/tools/imgtool/modules/amiga.c b/src/mame/tools/imgtool/modules/amiga.c new file mode 100644 index 00000000000..7723748cbd2 --- /dev/null +++ b/src/mame/tools/imgtool/modules/amiga.c @@ -0,0 +1,2411 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/**************************************************************************** + + amiga.c + + Amiga floppies + +****************************************************************************/ + + +/***************************************************************************** + Includes +*****************************************************************************/ + + +#include +#include +#include + +#include "imgtool.h" +#include "iflopimg.h" +#include "formats/imageutl.h" + + + +/***************************************************************************** + Data structures +*****************************************************************************/ + + +#define BSIZE (512) /* Block size is always 512 bytes for floppies */ +#define TSIZE ((BSIZE/4) - 56) /* Size of data tables */ +#define MSIZE ((BSIZE/4) - 1) /* Size of bitmaps */ + + +enum disk_type +{ + DT_UNKNOWN = -1, + DT_OFS = 0, + DT_FFS = 1, + DT_OFS_INTL = 2, + DT_FFS_INTL = 3, + DT_OFS_INTL_DIRC = 4, + DT_FFS_INTL_DIRC = 5 +}; + + +enum +{ + T_INVALID = 0, + T_HEADER = 2, + T_DATA = 8, + T_LIST = 16, + T_DIRCACHE = 33 +}; + + +enum sec_type +{ + ST_INVALID = 0, + ST_ROOT = 1, + ST_USERDIR = 2, + ST_FILE = -3, + ST_LINKFILE = -4, + ST_LINKDIR = 4, + ST_SOFTLINK = 3 +}; + + +struct amiga_date +{ + UINT32 days; /* days since 1 jan 78 */ + UINT32 mins; /* minutes past midnight */ + UINT32 ticks; /* ticks (1/50 sec) past last minute */ +}; + + +struct root_block +{ + UINT32 ht_size; /* Hash table size in long */ + UINT32 chksum; /* Rootblock checksum */ + UINT32 ht[TSIZE]; /* Hash table (entry block number) */ + UINT32 bm_flag; /* bitmap flag, -1 means VALID */ + UINT32 bm_pages[25]; /* bitmap blocks pointers (first one at bm_pages[0]) */ + amiga_date r; /* last root alteration date */ + UINT8 name_len; /* volume name length */ + UINT8 diskname[30]; /* volume name */ + amiga_date v; /* last disk alteration date */ + amiga_date c; /* filesystem creation date */ + UINT32 extension; /* FFS: first directory cache block, 0 otherwise */ +}; + + +struct bitmap_block +{ + UINT32 chksum; /* checksum, normal algorithm */ + UINT32 map[MSIZE]; /* bitmap */ +}; + + +struct bitmap_ext_block +{ + UINT32 map[MSIZE]; /* bitmap */ + UINT32 next; /* next extension block */ +}; + + +struct file_block +{ + UINT32 header_key; /* self pointer (to this block) */ + UINT32 high_seq; /* number of data block ptr stored here */ + UINT32 first_data; /* first data block ptr */ + UINT32 chksum; /* same algorithm as rootblock */ + UINT32 data_blocks[TSIZE]; /* data blk ptr */ + UINT16 uid; /* UserID */ + UINT16 gid; /* GroupID */ + UINT32 protect; /* protection flags (0 by default) */ + UINT32 byte_size; /* file size in bytes */ + UINT8 comm_len; /* file comment length */ + UINT8 comment[79]; /* comment (max. 79 chars permitted) */ + amiga_date date; /* last change date */ + UINT8 name_len; /* filename length */ + UINT8 filename[30]; /* filename (max. 30 chars permitted) */ + UINT32 real_entry; /* FFS: unused, set to 0 */ + UINT32 next_link; /* FFS: hardlinks chained list (first == newest */ + UINT32 hash_chain; /* next entry ptr with same hash */ + UINT32 parent; /* parent directory */ + UINT32 extension; /* pointer to 1st file extension block */ +}; + + +struct file_ext_block +{ + UINT32 header_key; /* self pointer (to this block) */ + UINT32 high_seq; /* number of data block ptr stored here */ + UINT32 chksum; /* same algorithm as rootblock */ + UINT32 data_blocks[TSIZE]; /* data blk ptr */ + UINT32 parent; /* file header block */ + UINT32 extension; /* pointer to next file extension block */ +}; + + +struct data_block +{ + UINT32 header_key; /* self pointer (to this block) */ + UINT32 seq_num; /* file data block number */ + UINT32 data_size; /* data size */ + UINT32 next_data; /* next data block ptr */ + UINT32 chksum; /* checksum, rootblock algorithm */ + UINT8 data[BSIZE-24]; /* file data */ +}; + + +struct dir_block +{ + UINT32 header_key; /* self pointer (to this block) */ + UINT32 chksum; /* same algorithm as rootblock */ + UINT32 ht[TSIZE]; /* hash table (entry block number) */ + UINT8 uid; /* UserID */ + UINT8 gid; /* GroupID */ + UINT32 protect; /* protection flags (0 by default) */ + UINT8 comm_len; /* file comment length */ + UINT8 comment[79]; /* comment (max. 79 chars permitted) */ + amiga_date date; /* last access date */ + UINT8 name_len; /* directory name length */ + UINT8 dirname[30]; /* directory name (max. 30 chars permitted) */ + UINT32 next_link; /* FFS: hardlinks chained list (first == newest */ + UINT32 hash_chain; /* next entry ptr with same hash */ + UINT32 parent; /* parent directory */ + UINT32 extension; /* FFS: first directory cache block */ +}; + + +struct hardlink_block +{ + UINT32 header_key; /* self pointer (to this block) */ + UINT32 chksum; /* same algorithm as rootblock */ + UINT32 protect; /* protection flags (0 by default) */ + UINT8 comm_len; /* file comment length */ + UINT8 comment[79]; /* comment (max. 79 chars permitted) */ + amiga_date date; /* last access date */ + UINT8 name_len; /* hard link name length */ + UINT8 hlname[30]; /* hard link name (max. 30 chars permitted) */ + UINT32 real_entry; /* FFS: pointer to "real" file or directory */ + UINT32 next_link; /* FFS: hardlinks chained list (first == newest */ + UINT32 hash_chain; /* next entry ptr with same hash */ + UINT32 parent; /* parent directory */ + UINT32 sec_type; /* secondary type, ST_LINKFILE/ST_LINKDIR */ +}; + + +struct softlink_block +{ + UINT32 header_key; /* self pointer (to this block) */ + UINT32 chksum; /* same algorithm as rootblock */ + UINT8 symbolic_name[BSIZE-224]; /* path name to referenced object */ + UINT32 protect; /* protection flags (0 by default) */ + UINT8 comm_len; /* file comment length */ + UINT8 comment[79]; /* comment (max. 79 chars permitted) */ + amiga_date date; /* last access date */ + UINT8 name_len; /* soft link name length */ + UINT8 slname[30]; /* soft link name (max. 30 chars permitted) */ + UINT32 hash_chain; /* next entry ptr with same hash */ + UINT32 parent; /* parent directory */ +}; + + +/* Basic Amiga floppy disk image info */ +struct amiga_floppy +{ + imgtool_stream *stream; + UINT8 sectors; +}; + + +/* iterator used to walk through directory entries */ +struct amiga_iterator +{ + unsigned int index; /* current file index */ + int block; /* block number we are iterating */ + UINT32 next_block; /* next block in hash chain */ + int ht_index; /* current index in the hash table */ + unsigned int eof : 1; /* end of file listing reached? */ +}; + + +/***************************************************************************** + Prototypes +*****************************************************************************/ + + +static imgtoolerr_t amiga_image_read_sector(imgtool_image* img, + UINT32 track, UINT32 head, UINT32 sector, void *buf, size_t len); +static imgtoolerr_t amiga_image_write_sector(imgtool_image* img, + UINT32 track, UINT32 head, UINT32 sector, const void *buf, size_t len, int ddam); + + + +/***************************************************************************** + Utility functions +*****************************************************************************/ + + +/* Amiga version of the toupper function */ +static int intl_toupper(int c) +{ + return (c>='a' && c<='z') || (c>=224 && c<=254 && c!=247) ? c - ('a'-'A') : c ; +} + + +/* Amiga filename case insensitive string compare */ +static int intl_stricmp(const char *s1, const char *s2) +{ + for (;;) + { + int c1 = intl_toupper(*s1++); + int c2 = intl_toupper(*s2++); + + if (c1 == 0 || c1 != c2) + return c1 - c2; + } +} + + +/* Calculate the hash value for a filename */ +static int hash_name(const char *name, int intl) +{ + int i, l = strlen(name); + UINT32 hash = l; + + for(i = 0; i < l; i++) + { + hash *= 13; + hash += (UINT8) (intl ? intl_toupper(name[i]) : toupper(name[i])); + hash &= 0x7ff; + } + + return hash % TSIZE; /* 0 < hash < 71 in case of BSIZE=512 */ +} + + +/* Returns TRUE if year is a leap year */ +static int is_leap(int year) +{ + return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); +} + + +/* Convert amiga time to standard time */ +static time_t amiga_crack_time(amiga_date *date) +{ + int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + int year = 1978, month = 1, year_days = 365; /* base date */ + int day = date->days; + struct tm t; + + /* initialize struct */ + memset(&t, 0, sizeof(t)); + + /* first calculate the year */ + while (day >= year_days) + { + day -= year_days; + year_days = is_leap(++year) ? 366 : 365; + } + + /* then the month */ + while(day >= month_days[month-1]) + { + day -= month_days[month-1]; + if (month == 2 && is_leap(year)) + day -= 1; + month++; + } + + /* fill the struct with our calculated values */ + t.tm_year = year - 1900; + t.tm_mon = month - 1; + t.tm_mday = day + 1; + t.tm_hour = date->mins / 60; + t.tm_min = date->mins % 60; + t.tm_sec = date->ticks / 50; + + return mktime(&t); +} + + +/* convert standard time to amiga time */ +static void amiga_setup_time(time_t time, amiga_date *dest) +{ + struct tm t = *localtime(&time); + int year; + + dest->days = 0; + + for (year = 1978; year < t.tm_year + 1900; year++) + { + dest->days += is_leap(year) ? 366 : 365; + } + + dest->days += t.tm_yday; + dest->mins = t.tm_hour * 60 + t.tm_min; + dest->ticks = t.tm_sec * 50; +} + + +/* convert flags to human readable form */ +static void amiga_decode_flags(UINT32 flags, char *dest) +{ + /* test for flags */ + dest[0] = (flags & 0x80) ? 'h' : '-'; + dest[1] = (flags & 0x40) ? 's' : '-'; + dest[2] = (flags & 0x20) ? 'p' : '-'; + dest[3] = (flags & 0x10) ? 'a' : '-'; + dest[4] = (flags & 0x08) ? '-' : 'r'; + dest[5] = (flags & 0x04) ? '-' : 'w'; + dest[6] = (flags & 0x02) ? '-' : 'e'; + dest[7] = (flags & 0x01) ? '-' : 'd'; + dest[8] = '\0'; +} + + +static void copy_integer_array_be(UINT32 *dest, const UINT32 *source, int size) +{ + int i; + + for (i = 0; i < size; i++) + { + dest[i] = BIG_ENDIANIZE_INT32(source[i]); + } +} + + +/* This function converts an array of UINT32s to an amiga_date */ +static void copy_date_be(amiga_date *dest, const UINT32 *source) +{ + dest->days = BIG_ENDIANIZE_INT32(source[0]); + dest->mins = BIG_ENDIANIZE_INT32(source[1]); + dest->ticks = BIG_ENDIANIZE_INT32(source[2]); +} + + +/* Calculate the block checksum of a byte array */ +static UINT32 block_checksum(UINT8 *buffer, int length) +{ + UINT32 chksum = 0; + int i; + + for (i = 0; i < length/4; i++) + { + chksum += pick_integer_be(buffer, i*4, 4); + } + + return -chksum; +} + + +/* Returns the total number of blocks in the image */ +static int get_total_blocks(imgtool_image *img) +{ + amiga_floppy *f = (amiga_floppy *)imgtool_image_extra_bytes(img); + + return 2 * 80 * f->sectors; +} + + +/* Returns track, head and sector for a block */ +static void find_block(amiga_floppy *f, int block, int *track, + int *head, int *sector) +{ + *track = block / f->sectors; + *head = (block - *track * f->sectors) / f->sectors; + *sector = (block - *track * f->sectors) % f->sectors; +} + + +/* Generic read block */ +static imgtoolerr_t read_block(imgtool_image *img, int block, UINT8 *buffer) +{ + imgtoolerr_t ret; + int track, head, sector; + + find_block((amiga_floppy *) imgtool_image_extra_bytes(img), block, &track, &head, §or); + + /* get block from image */ + ret = amiga_image_read_sector(img, track, head, sector, buffer, BSIZE); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +/* Generic write block */ +static imgtoolerr_t write_block(imgtool_image *img, int block, const UINT8 *buffer) +{ + imgtoolerr_t ret; + int track, head, sector; + + find_block((amiga_floppy *) imgtool_image_extra_bytes(img), block, &track, &head, §or); + + /* write block to image */ + ret = amiga_image_write_sector(img, track, head, sector, buffer, BSIZE, 0); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +/* Return the type a block */ +static sec_type get_block_type(imgtool_image *img, int block) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* get data */ + ret = read_block(img, block, buffer); + if (ret) return ST_INVALID; + + /* return type */ + switch ((INT32) pick_integer_be(buffer, BSIZE-4, 4)) + { + case 1: return ST_ROOT; + case 2: return ST_USERDIR; + case -3: return ST_FILE; + case -4: return ST_LINKFILE; + case 4: return ST_LINKDIR; + case 3: return ST_SOFTLINK; + default: return ST_INVALID; + } +} + + +/* Read a bitmap block */ +static imgtoolerr_t read_bitmap_block(imgtool_image *img, int block, bitmap_block *bm) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* fill in data */ + bm->chksum = pick_integer_be(buffer, 0, 4); + copy_integer_array_be(bm->map, (UINT32 *) &buffer[4], MSIZE); + + return IMGTOOLERR_SUCCESS; +} + + +/* Write a bitmap block */ +static imgtoolerr_t write_bitmap_block(imgtool_image *img, int block, const bitmap_block *bm) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* Setup buffer */ + place_integer_be(buffer, 0, 4, bm->chksum); + copy_integer_array_be((UINT32 *) &buffer[4], bm->map, MSIZE); + + /* write block */ + ret = write_block(img, block, buffer); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +#ifdef UNUSED_FUNCTION +/* Read a bitmap extended block */ +static imgtoolerr_t read_bitmap_ext_block(imgtool_image *img, int block, bitmap_ext_block *bm) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* fill in data */ + copy_integer_array_be(bm->map, (UINT32 *) &buffer, MSIZE); + bm->next = pick_integer_be(buffer, BSIZE-4, 4); + + return IMGTOOLERR_SUCCESS; +} +#endif + + +/* Read the root block */ +static imgtoolerr_t read_root_block(imgtool_image *img, root_block *root) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* get raw root block from image */ + ret = read_block(img, get_total_blocks(img)/2, buffer); + if (ret) return ret; + + /* copy data to root_block */ + memset(root, 0, sizeof(root_block)); + + root->ht_size = pick_integer_be(buffer, 12, 4); + root->chksum = pick_integer_be(buffer, 20, 4); + copy_integer_array_be(root->ht, (UINT32 *) &buffer[24], TSIZE); + root->bm_flag = pick_integer_be(buffer, BSIZE-200, 4); + copy_integer_array_be(root->bm_pages, (UINT32 *) &buffer[BSIZE-196], 25); + copy_date_be(&root->r, (UINT32 *) &buffer[BSIZE-92]); + root->name_len = pick_integer_be(buffer, BSIZE-80, 1); + memcpy(root->diskname, &buffer[BSIZE-79], 30); + copy_date_be(&root->v, (UINT32 *) &buffer[BSIZE-40]); + copy_date_be(&root->c, (UINT32 *) &buffer[BSIZE-28]); + root->extension = pick_integer_be(buffer, BSIZE-8, 4); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t write_root_block(imgtool_image *img, const root_block *root) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* Setup buffer */ + memset(buffer, 0, BSIZE); + + place_integer_be(buffer, 0, 4, T_HEADER); + place_integer_be(buffer, 12, 4, root->ht_size); + place_integer_be(buffer, 20, 4, root->chksum); + copy_integer_array_be((UINT32 *) &buffer[24], root->ht, TSIZE); + place_integer_be(buffer, BSIZE-200, 4, root->bm_flag); + copy_integer_array_be((UINT32 *) &buffer[BSIZE-196], root->bm_pages, 25); + place_integer_be(buffer, BSIZE-92, 4, root->r.days); + place_integer_be(buffer, BSIZE-88, 4, root->r.mins); + place_integer_be(buffer, BSIZE-84, 4, root->r.ticks); + place_integer_be(buffer, BSIZE-80, 1, root->name_len); + memcpy(&buffer[BSIZE-79], root->diskname, root->name_len); + place_integer_be(buffer, BSIZE-40, 4, root->v.days); + place_integer_be(buffer, BSIZE-36, 4, root->v.mins); + place_integer_be(buffer, BSIZE-32, 4, root->v.ticks); + place_integer_be(buffer, BSIZE-28, 4, root->c.days); + place_integer_be(buffer, BSIZE-24, 4, root->c.mins); + place_integer_be(buffer, BSIZE-20, 4, root->c.ticks); + place_integer_be(buffer, BSIZE-8, 4, root->extension); + place_integer_be(buffer, BSIZE-4, 4, ST_ROOT); + + /* write root block to image */ + ret = write_block(img, get_total_blocks(img)/2, buffer); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +/* Read a file block */ +static imgtoolerr_t read_file_block(imgtool_image *img, int block, file_block *fb) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* fill in data */ + fb->header_key = pick_integer_be(buffer, 4, 4); + fb->high_seq = pick_integer_be(buffer, 8, 4); + fb->first_data = pick_integer_be(buffer, 16, 4); + fb->chksum = pick_integer_be(buffer, 20, 4); + copy_integer_array_be(fb->data_blocks, (UINT32 *) &buffer[24], TSIZE); + fb->uid = pick_integer_be(buffer, BSIZE-196, 2); + fb->gid = pick_integer_be(buffer, BSIZE-194, 2); + fb->protect = pick_integer_be(buffer, BSIZE-192, 4); + fb->byte_size = pick_integer_be(buffer, BSIZE-188, 4); + fb->comm_len = pick_integer_be(buffer, BSIZE-184, 1); + memcpy(fb->comment, &buffer[BSIZE-183], 79); + copy_date_be(&fb->date, (UINT32 *) &buffer[BSIZE-92]); + fb->name_len = pick_integer_be(buffer, BSIZE-80, 1); + memcpy(fb->filename, (UINT32 *) &buffer[BSIZE-79], 30); + fb->real_entry = pick_integer_be(buffer, BSIZE-44, 4); + fb->next_link = pick_integer_be(buffer, BSIZE-40, 4); + fb->hash_chain = pick_integer_be(buffer, BSIZE-16, 4); + fb->parent = pick_integer_be(buffer, BSIZE-12, 4); + fb->extension = pick_integer_be(buffer, BSIZE-8, 4); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t read_file_ext_block(imgtool_image *img, int block, file_ext_block *fe) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* fill in data */ + fe->header_key = pick_integer_be(buffer, 4, 4); + fe->high_seq = pick_integer_be(buffer, 8, 4); + fe->chksum = pick_integer_be(buffer, 20, 4); + copy_integer_array_be(fe->data_blocks, (UINT32 *) &buffer[24], TSIZE); + fe->parent = pick_integer_be(buffer, BSIZE-12, 4); + fe->extension = pick_integer_be(buffer, BSIZE-8, 4); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t read_data_block(imgtool_image *img, int block, data_block *d) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* fill in data */ + d->header_key = pick_integer_be(buffer, 4, 4); + d->seq_num = pick_integer_be(buffer, 8, 4); + d->data_size = pick_integer_be(buffer, 12, 4); + d->next_data = pick_integer_be(buffer, 16, 4); + d->chksum = pick_integer_be(buffer, 20, 4); + memcpy(d->data, &buffer[24], BSIZE-24); + + return IMGTOOLERR_SUCCESS; +} + + +/* Read a directory block */ +static imgtoolerr_t read_dir_block(imgtool_image *img, int block, dir_block *db) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* fill in data */ + db->header_key = pick_integer_be(buffer, 4, 4); + db->chksum = pick_integer_be(buffer, 20, 4); + copy_integer_array_be(db->ht, (UINT32 *) &buffer[24], TSIZE); + db->uid = pick_integer_be(buffer, BSIZE-196, 2); + db->gid = pick_integer_be(buffer, BSIZE-194, 2); + db->protect = pick_integer_be(buffer, BSIZE-192, 4); + db->comm_len = pick_integer_be(buffer, BSIZE-184, 1); + memcpy(db->comment, &buffer[BSIZE-183], 79); + copy_date_be(&db->date, (UINT32 *) &buffer[BSIZE-92]); + db->name_len = pick_integer_be(buffer, BSIZE-80, 1); + memcpy(db->dirname, (UINT32 *) &buffer[BSIZE-79], 30); + db->next_link = pick_integer_be(buffer, BSIZE-40, 4); + db->hash_chain = pick_integer_be(buffer, BSIZE-16, 4); + db->parent = pick_integer_be(buffer, BSIZE-12, 4); + db->extension = pick_integer_be(buffer, BSIZE-8, 4); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t write_dir_block(imgtool_image *img, int block, const dir_block *db) +{ + UINT8 buffer[BSIZE]; + + /* Setup buffer */ + memset(buffer, 0, BSIZE); + + /* Copy data */ + place_integer_be(buffer, 0, 4, T_HEADER); + place_integer_be(buffer, 4, 4, db->header_key); + place_integer_be(buffer, 20, 4, db->chksum); + copy_integer_array_be((UINT32 *) &buffer[24], db->ht, TSIZE); + place_integer_be(buffer, BSIZE-196, 2, db->uid); + place_integer_be(buffer, BSIZE-194, 2, db->gid); + place_integer_be(buffer, BSIZE-192, 4, db->protect); + place_integer_be(buffer, BSIZE-184, 1, db->comm_len); + memcpy((UINT32 *) &buffer[BSIZE-183], db->comment, db->comm_len); + place_integer_be(buffer, BSIZE-92, 4, db->date.days); + place_integer_be(buffer, BSIZE-88, 4, db->date.mins); + place_integer_be(buffer, BSIZE-84, 4, db->date.ticks); + place_integer_be(buffer, BSIZE-80, 1, db->name_len); + memcpy((UINT32 *) &buffer[BSIZE-79], db->dirname, db->name_len); + place_integer_be(buffer, BSIZE-40, 4, db->next_link); + place_integer_be(buffer, BSIZE-16, 4, db->hash_chain); + place_integer_be(buffer, BSIZE-12, 4, db->parent); + place_integer_be(buffer, BSIZE-8, 4, db->extension); + place_integer_be(buffer, BSIZE-4, 4, ST_USERDIR); + + /* Write block to disk */ + return write_block(img, block, buffer); +} + + +static imgtoolerr_t read_hardlink_block(imgtool_image *img, int block, hardlink_block *hl) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* fill in data */ + hl->header_key = pick_integer_be(buffer, 4, 4); + hl->chksum = pick_integer_be(buffer, 20, 4); + hl->protect = pick_integer_be(buffer, BSIZE-192, 4); + hl->comm_len = pick_integer_be(buffer, BSIZE-184, 1); + memcpy(hl->comment, &buffer[BSIZE-183], 79); + copy_date_be(&hl->date, (UINT32 *) &buffer[BSIZE-92]); + hl->name_len = pick_integer_be(buffer, BSIZE-80, 1); + memcpy(hl->hlname, (UINT32 *) &buffer[BSIZE-79], 30); + hl->real_entry = pick_integer_be(buffer, BSIZE-44, 4); + hl->next_link = pick_integer_be(buffer, BSIZE-40, 4); + hl->hash_chain = pick_integer_be(buffer, BSIZE-16, 4); + hl->parent = pick_integer_be(buffer, BSIZE-12, 4); + hl->sec_type = pick_integer_be(buffer, BSIZE-4, 4); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t read_softlink_block(imgtool_image *img, int block, softlink_block *sl) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* fill in data */ + sl->header_key = pick_integer_be(buffer, 4, 4); + sl->chksum = pick_integer_be(buffer, 20, 4); + memcpy(sl->symbolic_name, &buffer[24], BSIZE-224); + sl->protect = pick_integer_be(buffer, BSIZE-192, 4); + sl->comm_len = pick_integer_be(buffer, BSIZE-184, 1); + memcpy(sl->comment, &buffer[BSIZE-183], 79); + copy_date_be(&sl->date, (UINT32 *) &buffer[BSIZE-92]); + sl->name_len = pick_integer_be(buffer, BSIZE-80, 1); + memcpy(sl->slname, (UINT32 *) &buffer[BSIZE-79], 30); + sl->hash_chain = pick_integer_be(buffer, BSIZE-16, 4); + sl->parent = pick_integer_be(buffer, BSIZE-12, 4); + + return IMGTOOLERR_SUCCESS; +} + + +/* Returns the disk type */ +static disk_type get_disk_type(imgtool_image *img) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + ret = read_block(img, 0, buffer); + if (ret) return DT_UNKNOWN; + + switch(buffer[3]) + { + case 0: return DT_OFS; + case 1: return DT_FFS; + case 2: return DT_OFS_INTL; + case 3: return DT_FFS_INTL; + case 4: return DT_OFS_INTL_DIRC; + case 5: return DT_FFS_INTL_DIRC; + default: return DT_UNKNOWN; + } +} + + +/* Returns TRUE if the disk is formatted with the FastFileSystem */ +static int is_ffs(imgtool_image *img) +{ + disk_type t = get_disk_type(img); + + return ((t == DT_FFS || + t == DT_FFS_INTL || + t == DT_FFS_INTL_DIRC) ? TRUE : FALSE); +} + + +/* Returns TRUE if the disk uses the international mode */ +static int is_intl(imgtool_image *img) +{ + disk_type t = get_disk_type(img); + + return ((t == DT_OFS_INTL || + t == DT_FFS_INTL || + t == DT_OFS_INTL_DIRC || + t == DT_FFS_INTL_DIRC) ? TRUE : FALSE); +} + +#ifdef UNUSED_FUNCTION +/* Returns TRUE if the disk uses the directory cache mode */ +static int is_dirc(imgtool_image *img) +{ + disk_type t = get_disk_type(img); + + return ((t == DT_OFS_INTL_DIRC || + t == DT_FFS_INTL_DIRC) ? TRUE : FALSE); +} +#endif + +static imgtoolerr_t get_hash_table(imgtool_image *img, int block, UINT32 *ht) +{ + imgtoolerr_t ret; + + switch (get_block_type(img, block)) + { + case ST_USERDIR: + { + dir_block dir; + + /* get the directory block */ + ret = read_dir_block(img, block, &dir); + if (ret) return ret; + + /* copy data */ + memcpy(ht, &dir.ht, TSIZE*4); + + return IMGTOOLERR_SUCCESS; + } + + case ST_ROOT: + { + root_block root; + + /* get the root block */ + ret = read_root_block(img, &root); + if (ret) return ret; + + /* copy data */ + memcpy(ht, &root.ht, TSIZE*4); + + return IMGTOOLERR_SUCCESS; + } + + default: + return IMGTOOLERR_UNEXPECTED; + } +} + + +static imgtoolerr_t set_hash_table(imgtool_image *img, int block, const UINT32 *ht) +{ + UINT8 buffer[BSIZE]; + imgtoolerr_t ret; + + /* Read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* Copy new hash table into it */ + copy_integer_array_be((UINT32 *) &buffer[24], ht, TSIZE); + + /* Write it back again */ + ret = write_block(img, block, buffer); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + +#ifdef UNUSED_FUNCTION +static imgtoolerr_t get_root_hash_table(imgtool_image *img, UINT32 *ht) +{ + return get_hash_table(img, get_total_blocks(img)/2, ht); +} +#endif + +static imgtoolerr_t get_blockname(imgtool_image *img, int block, char *dest) +{ + UINT8 buffer[BSIZE]; + imgtoolerr_t ret; + + /* Read the block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* Copy filename out of the buffer */ + memset(dest, 0, 31); + memcpy(dest, &buffer[BSIZE-79], buffer[BSIZE-80]); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t get_hash_chain(imgtool_image *img, int block, UINT32 *chain) +{ + UINT8 buffer[BSIZE]; + imgtoolerr_t ret; + + /* Read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* Get chain value */ + *chain = pick_integer_be(buffer, BSIZE-16, 4); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t set_hash_chain(imgtool_image *img, int block, UINT32 chain) +{ + UINT8 buffer[BSIZE]; + imgtoolerr_t ret; + + /* Read block */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* Copy new hash chain value into it */ + place_integer_be(buffer, BSIZE-16, 4, chain); + + /* Write it back again */ + ret = write_block(img, block, buffer); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t walk_hash_chain(imgtool_image *img, const char *path, int start_block, int *prev_block, int *block) +{ + imgtoolerr_t err; + UINT32 hash_chain; + char name[31]; + + /* choose compare function depending on intl mode */ + int (*cmp)(const char *, const char *) = is_intl(img) ? &intl_stricmp : &core_stricmp; + + /* initialize filenames */ + memset(name, 0, sizeof(name)); + + switch (get_block_type(img, start_block)) + { + case ST_USERDIR: + { + dir_block dir; + + /* read block */ + err = read_dir_block(img, start_block, &dir); + if (err) return err; + + /* copy filename string and next hash */ + memcpy(name, dir.dirname, dir.name_len); + hash_chain = dir.hash_chain; + + break; + } + + case ST_FILE: + { + file_block file; + + /* read block */ + err = read_file_block(img, start_block, &file); + if (err) return err; + + /* copy filename string and next hash */ + memcpy(name, file.filename, file.name_len); + hash_chain = file.hash_chain; + + break; + } + + case ST_SOFTLINK: + { + softlink_block sl; + + /* read block */ + err = read_softlink_block(img, start_block, &sl); + if (err) return err; + + /* copy filename string and next hash */ + memcpy(name, sl.slname, sl.name_len); + hash_chain = sl.hash_chain; + + break; + } + + case ST_LINKDIR: + case ST_LINKFILE: + { + hardlink_block hl; + + /* read block */ + err = read_hardlink_block(img, start_block, &hl); + if (err) return err; + + /* copy filename string and next hash */ + memcpy(name, hl.hlname, hl.name_len); + hash_chain = hl.hash_chain; + break; + } + + default: + return IMGTOOLERR_UNEXPECTED; + + } + + /* if we haven't found the right filename but there are linked entries, + * walk up the chain */ + if ((*cmp)(name, path) != 0 && hash_chain != 0) + { + *prev_block = start_block; + return walk_hash_chain(img, path, hash_chain, prev_block, block); + } + + /* found the correct block, return */ + if ((*cmp)(name, path) == 0) + { + *block = start_block; + return IMGTOOLERR_SUCCESS; + } + + /* we should never get here */ + return IMGTOOLERR_UNEXPECTED; +} + + +/* Returns the block number for a dir/file/link entry given as NUL delimited + * list of path parts, for example "dir1\0dir2\0dir3" returns the block number + * for directory "dir3" */ +static imgtoolerr_t find_entry(imgtool_image *img, const char *path, int start_block, int *block) +{ + imgtoolerr_t ret; + const char *next_path; + int current_block, prev; + UINT32 ht[TSIZE]; + + /* get the hash table */ + ret = get_hash_table(img, start_block, ht); + if (ret) return ret; + + /* calculate hash and get block for initial entry */ + current_block = ht[hash_name(path, is_intl(img))]; + + /* check if there was a match in the hash table */ + if (current_block == 0) + { + return IMGTOOLERR_PATHNOTFOUND; + } + + /* walk the linked hash list */ + ret = walk_hash_chain(img, path, current_block, &prev, block); + if (ret) return ret; + + /* follow links */ + switch (get_block_type(img, *block)) + { + case ST_SOFTLINK: + + /* TODO: Softlink support */ + return IMGTOOLERR_UNIMPLEMENTED; + + case ST_LINKDIR: + case ST_LINKFILE: + { + hardlink_block hl; + + ret = read_hardlink_block(img, *block, &hl); + if (ret) return ret; + + *block = hl.real_entry; + + break; + } + + default: + break; + } + + /* get next path part */ + next_path = path + strlen(path) + 1; + + /* if there are more path parts, search the next block */ + if (next_path[0]) + { + return find_entry(img, next_path, *block, block); + } + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t get_block_chksum(imgtool_image *img, int block, UINT32 *chksum, int bitmap) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* get block data */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* clear old checksum */ + if (bitmap) + { + memset(buffer, 0, 4); + } + else + { + memset(&buffer[20], 0, 4); + } + + /* calulate checksum */ + *chksum = block_checksum(buffer, BSIZE); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t fix_chksum(imgtool_image *img, int block, int bitmap) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + UINT32 chksum; + + /* calculate block checksum */ + ret = get_block_chksum(img, block, &chksum, bitmap); + if (ret) return ret; + + /* read block data */ + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* update checksum */ + if (bitmap) + { + place_integer_be(buffer, 0, 4, chksum); + } + else + { + place_integer_be(buffer, 20, 4, chksum); + } + + /* write back new block data */ + ret = write_block(img, block, buffer); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t fix_block_chksum(imgtool_image *img, int block) +{ + return fix_chksum(img, block, FALSE); +} + + +static imgtoolerr_t fix_bitmap_chksum(imgtool_image *img, int block) +{ + return fix_chksum(img, block, TRUE); +} + + +/* Set a block as used */ +static imgtoolerr_t bitmap_mark(imgtool_image *img, int block, int used) +{ + imgtoolerr_t ret; + bitmap_block bm; + root_block root; + int page; + + block -= 2; /* subtract boot block sectors, 2 only for floppies! */ + + ret = read_root_block(img, &root); + if (ret) return ret; + + /* figure out bitmap block location */ + page = root.bm_pages[block / (MSIZE * 32)]; + + /* get bitmap */ + ret = read_bitmap_block(img, page, &bm); + if (ret) return ret; + + /* subtract pages we skip */ + block -= MSIZE * 32 * (block / (MSIZE * 32)); + + /* mark as used or free */ + if (used) + { + bm.map[block/32] &= ~(1 << block % 32); + } + else + { + bm.map[block/32] |= (1 << block % 32); + } + + /* write changed bitmap block back to disk */ + ret = write_bitmap_block(img, page, &bm); + if (ret) return ret; + + /* update checksum */ + ret = fix_bitmap_chksum(img, page); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t bitmap_mark_used(imgtool_image *img, int block) +{ + return bitmap_mark(img, block, TRUE); +} + + +static imgtoolerr_t bitmap_mark_free(imgtool_image *img, int block) +{ + return bitmap_mark(img, block, FALSE); +} + + +static imgtoolerr_t update_block_modified_date(imgtool_image *img, int block) +{ + UINT8 buffer[BSIZE]; + imgtoolerr_t ret; + amiga_date date; + time_t now; + + ret = read_block(img, block, buffer); + if (ret) return ret; + + /* Set new time */ + time(&now); + amiga_setup_time(now, &date); + + /* Write new time into block */ + place_integer_be(buffer, BSIZE-92, 4, date.days); + place_integer_be(buffer, BSIZE-88, 4, date.mins); + place_integer_be(buffer, BSIZE-84, 4, date.ticks); + + /* Write block back to disk */ + ret = write_block(img, block, buffer); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t clear_hash_table_entry(imgtool_image *img, int parent, char *filename) +{ + imgtoolerr_t ret; + UINT32 ht[TSIZE], chain; + int index, entry, prev, block; + + ret = get_hash_table(img, parent, ht); + if (ret) return ret; + + /* Calculate hash and get block for initial entry */ + index = hash_name(filename, is_intl(img)); + entry = ht[index]; + + /* Walk the hash chain to get the real entry */ + ret = walk_hash_chain(img, filename, entry, &prev, &block); + if (ret) return ret; + + /* Get chained value from block */ + ret = get_hash_chain(img, block, &chain); + if (ret) return ret; + + /* Check if we need to change the hash table */ + if (entry == block) + { + /* Set new value (might be 0 if there were no linked entries) */ + ht[index] = chain; + + /* Save changed hash table */ + ret = set_hash_table(img, parent, ht); + if (ret) return ret; + + /* Update last modified date */ + ret = update_block_modified_date(img, parent); + if (ret) return ret; + + /* Calculate new checksum */ + ret = fix_block_chksum(img, parent); + if (ret) return ret; + } + else + { + /* Save chained value to previous chain element */ + ret = set_hash_chain(img, prev, chain); + if (ret) return ret; + + /* Calculate new checksum */ + ret = fix_block_chksum(img, prev); + if (ret) return ret; + } + + /* Mark our block as free */ + ret = bitmap_mark_free(img, block); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +/* Returns the number of the first bit that is set in the array */ +static int get_first_bit(UINT32 *array, int size) +{ + int i; + + for (i = 0; i < size; i++) + { + if (array[i] != 0) + { + UINT32 v = array[i]; + int c; + + /* get first bit that is set */ + for (c = 0; (v & 1) == 0; c++) v >>= 1; + + /* return bit number */ + return i * 32 + c; + } + } + + return -1; +} + + +#ifdef UNUSED_FUNCTION +static imgtoolerr_t walk_bitmap_ext_blocks(imgtool_image *img, int start, int *block) +{ + imgtoolerr_t ret; + bitmap_ext_block bm_ext; + int bit; + + /* if we don't have a valid block, bail out */ + if (start == 0) + { + return IMGTOOLERR_NOSPACE; + } + + /* get the extended bitmap block */ + ret = read_bitmap_ext_block(img, start, &bm_ext); + if (ret) return ret; + + /* get the first bit that is set in the map */ + bit = get_first_bit(bm_ext.map, MSIZE); + + /* if we found one, return */ + if (bit != -1) + { + *block += bit; + return IMGTOOLERR_SUCCESS; + } + + /* increase on each call */ + *block += MSIZE * 32; + + /* else continue walking the list */ + return walk_bitmap_ext_blocks(img, bm_ext.next, block); +} +#endif + + +/* Searches for a block marked as free + * TODO: bm_ext support for HDs */ +static imgtoolerr_t find_free_block(imgtool_image *img, int *block) +{ + imgtoolerr_t ret; + root_block root; + int i; + + /* get root block */ + ret = read_root_block(img, &root); + if (ret) return ret; + + /* iterate bitmap pointers */ + for (i = 0; i < 25; i++) + { + bitmap_block bm; + + /* get bitmap block pointed to */ + ret = read_bitmap_block(img, root.bm_pages[i], &bm); + if (ret) return ret; + + *block = i * 32 * MSIZE + get_first_bit(bm.map, MSIZE); + + if (*block != -1) + { + *block += 2; + return IMGTOOLERR_SUCCESS; + } + } + + /* if we get here we haven't found a free block */ + return IMGTOOLERR_NOSPACE; +} + + +static imgtoolerr_t add_entry(imgtool_image *img, int parent, int block) +{ + imgtoolerr_t ret; + UINT32 ht[TSIZE]; + char name[31]; + int hash; + + ret = get_blockname(img, block, name); + if (ret) return ret; + + ret = get_hash_table(img, parent, ht); + if (ret) return ret; + + hash = hash_name(name, is_intl(img)); + + /* Check if there is already an entry with that name */ + if (ht[hash] != 0) + { + /* Save the old value to our hash chain */ + ret = set_hash_chain(img, block, ht[hash]); + if (ret) return ret; + } + + /* Write our block number into the table */ + ht[hash] = block; + + /* Write table back to disk */ + ret = set_hash_table(img, parent, ht); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +/* Recursively create new directory entries */ +static imgtoolerr_t makedir(imgtool_image *img, const char *path, int parent) +{ + imgtoolerr_t ret; + dir_block dir; + time_t now; + int block; + + if (!path) + { + return IMGTOOLERR_PARAMNEEDED; + } + + if (!path[0]) + { + return IMGTOOLERR_SUCCESS; + } + + /* Get a free block */ + ret = find_free_block(img, &block); + if (ret) return ret; + + /* Initialize entry */ + memset(&dir, 0, sizeof(dir_block)); + + /* Copy data */ + time(&now); + amiga_setup_time(now, &dir.date); + dir.name_len = strlen(path); + memcpy(dir.dirname, path, dir.name_len); + dir.header_key = block; + dir.parent = parent; + + /* Write block */ + ret = write_dir_block(img, block, &dir); + if (ret) return ret; + + /* Fix checksum */ + ret = fix_block_chksum(img, block); + if (ret) return ret; + + /* Link the new entry in the parent */ + ret = add_entry(img, parent, block); + if (ret) return ret; + + /* Mark it as used */ + ret = bitmap_mark_used(img, block); + if (ret) return ret; + + /* Create the next entry */ + return makedir(img, path + strlen(path) + 1, block); +} + + +/* Recursively checks the path parts and creates directories for them */ +static imgtoolerr_t checkdir(imgtool_image *img, const char *path, int parent) +{ + imgtoolerr_t ret; + int block; + char first_part[31]; + + memset(first_part, 0, sizeof(first_part)); + strcpy(first_part, path); + + /* Directories all the way down, bail out */ + if (!path[0]) + { + return IMGTOOLERR_CANNOTUSEPATH; + } + + /* Search for the entry */ + ret = find_entry(img, first_part, parent, &block); + + switch (ret) + { + case IMGTOOLERR_PATHNOTFOUND: + + /* There is no entry with this name yet, so we can just create them */ + return makedir(img, path, parent); + + case IMGTOOLERR_SUCCESS: + + if (get_block_type(img, block) == ST_USERDIR) + { + /* Go down one level */ + return checkdir(img, path + strlen(path) + 1, block); + } + else + { + /* There is an entry but it's not a directory, create it */ + return makedir(img, path, parent); + } + + default: return ret; + } +} + + +/* Writes the file data from the specified block into the stream */ +static imgtoolerr_t write_file_block_data(imgtool_image *img, int block, int size, imgtool_stream *destf) +{ + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + + /* Check if we even need to write something */ + if (size == 0) + { + return IMGTOOLERR_SUCCESS; + } + + if (is_ffs(img)) + { + /* Get block and read directly into buffer */ + ret = read_block(img, block, buffer); + if (ret) return ret; + } + else + { + data_block db; + UINT32 chksum; + + ret = read_data_block(img, block, &db); + if (ret) return ret; + + /* Verify data checksum */ + ret = get_block_chksum(img, block, &chksum, FALSE); + if (ret) return ret; + + if (db.chksum != chksum) + { + return IMGTOOLERR_CORRUPTFILE; + } + + /* Copy data to buffer */ + memcpy(buffer, db.data, size); + } + + /* Write data to stream */ + if (stream_write (destf, buffer, size) != size) + { + return IMGTOOLERR_WRITEERROR; + } + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t walk_data_block_ptr(imgtool_image *img, UINT32 *ptr, int *filesize, imgtool_stream *destf, int write) +{ + int i, blocksize = is_ffs(img) ? BSIZE : BSIZE-24; + imgtoolerr_t ret; + + for (i = TSIZE-1; i >= 0; i--) + { + /* We write either blocksize bytes or whats remaining */ + int bytes_left = (*filesize >= blocksize) ? blocksize : *filesize; + + if (write) + { + ret = write_file_block_data(img, ptr[i], bytes_left, destf); + if (ret) return ret; + } + else + { + ret = bitmap_mark_free(img, ptr[i]); + if (ret) return ret; + } + + *filesize -= bytes_left; + + /* Check if we are finished early */ + if (*filesize == 0) break; + } + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t write_data_block_ptr(imgtool_image *img, UINT32 *ptr, int *filesize, imgtool_stream *destf) +{ + return walk_data_block_ptr(img, ptr, filesize, destf, TRUE); +} + + +/* Marks all blocks pointed to by the data block pointers as free */ +static imgtoolerr_t clear_data_block_ptr(imgtool_image *img, UINT32 *ptr, int *filesize) +{ + return walk_data_block_ptr(img, ptr, filesize, NULL, FALSE); +} + + +static imgtoolerr_t walk_file_ext_data(imgtool_image *img, int block, int *filesize, imgtool_stream *destf, int write) +{ + file_ext_block file_ext; + imgtoolerr_t ret; + + /* Get file extension block */ + ret = read_file_ext_block(img, block, &file_ext); + if (ret) return ret; + + /* Write all data pointers in the table */ + ret = walk_data_block_ptr(img, file_ext.data_blocks, filesize, destf, write); + if (ret) return ret; + + /* Check if we are finished */ + if (*filesize != 0) + { + if (file_ext.extension == 0) + { + /* We are not finished, but there are no more extension blocks */ + return IMGTOOLERR_CORRUPTFILE; + } + else + { + /* Write the next file extension block */ + return walk_file_ext_data(img, file_ext.extension, filesize, destf, write); + } + } + + /* Mark ourself as free if we not writing */ + if (!write) + { + ret = bitmap_mark_free(img, block); + if (ret) return ret; + } + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t write_file_ext_data(imgtool_image *img, int block, int *filesize, imgtool_stream *destf) +{ + return walk_file_ext_data(img, block, filesize, destf, TRUE); +} + + +static imgtoolerr_t clear_file_ext_data(imgtool_image *img, int block, int *filesize) +{ + return walk_file_ext_data(img, block, filesize, NULL, FALSE); +} + + +/* Updates the disk alteration date stored in the root block */ +static imgtoolerr_t update_disk_alteration_date(imgtool_image *img) +{ + imgtoolerr_t ret; + root_block root; + time_t now; + + /* Get root block */ + ret = read_root_block(img, &root); + if (ret) return ret; + + /* Get current time */ + time(&now); + amiga_setup_time(now, &root.v); + + /* Write back new root block */ + ret = write_root_block(img, &root); + if (ret) return ret; + + /* And update its checksum */ + ret = fix_block_chksum(img, get_total_blocks(img)/2); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +/***************************************************************************** + Imgtool functions +*****************************************************************************/ + + +static imgtoolerr_t amiga_image_open(imgtool_image *img, imgtool_stream *stream) +{ + amiga_floppy *f = (amiga_floppy *) imgtool_image_extra_bytes(img); + UINT64 size = stream_size(stream); + + f->stream = stream; + f->sectors = size/BSIZE/80/2; + + if (f->sectors != 11 && f->sectors != 22) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + + return IMGTOOLERR_SUCCESS; +} + + +static void amiga_image_exit(imgtool_image *img) +{ +} + + +static void amiga_image_info(imgtool_image *img, char *string, size_t len) +{ + imgtoolerr_t ret; + root_block root; + char info[255]; + time_t t_c, t_v, t_r; + char c[19], v[19], r[19]; + + ret = read_root_block(img, &root); + if (ret) return; + + t_c = amiga_crack_time(&root.c); + t_v = amiga_crack_time(&root.v); + t_r = amiga_crack_time(&root.r); + + strftime(c, sizeof(c), "%d-%b-%y %H:%M:%S", localtime(&t_c)); + strftime(v, sizeof(v), "%d-%b-%y %H:%M:%S", localtime(&t_v)); + strftime(r, sizeof(r), "%d-%b-%y %H:%M:%S", localtime(&t_r)); + + strcpy(info, "Volume name: "); + strncat(info, (char *)root.diskname, root.name_len); + strcat(info, "\nVolume created: "); + strcat(info, c); + strcat(info, "\nVolume modified: "); + strcat(info, v); + strcat(info, "\n Root modified: "); + strcat(info, r); + + strncpy(string, info, len); +} + + +static imgtoolerr_t amiga_image_read_sector(imgtool_image* img, UINT32 track, UINT32 head, UINT32 sector, void *buf, size_t len) +{ + amiga_floppy *f = (amiga_floppy *) imgtool_image_extra_bytes(img); + + /* skip ahead to the area we want to read */ + stream_seek(f->stream, track * (head+1) * f->sectors * BSIZE + sector * BSIZE, SEEK_CUR); + + if (stream_read(f->stream, buf, len) != len) + { + return IMGTOOLERR_READERROR; + } + + /* reset stream */ + stream_seek(f->stream, 0, 0); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t amiga_image_write_sector(imgtool_image* img, UINT32 track, UINT32 head, UINT32 sector, const void *buf, size_t len, int ddam) +{ + amiga_floppy *f = (amiga_floppy *) imgtool_image_extra_bytes(img); + + /* skip ahead to the area we want to write */ + stream_seek(f->stream, track * (head+1) * f->sectors * BSIZE + sector * BSIZE, SEEK_CUR); + + /* write data */ + if (stream_write(f->stream, buf, len) != len) + { + return IMGTOOLERR_WRITEERROR; + } + + /* reset stream */ + stream_seek(f->stream, 0, 0); + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t amiga_image_get_sector_size(imgtool_image* img, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size) +{ + *sector_size = BSIZE; + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t amiga_image_beginenum(imgtool_directory *enumeration, const char *path) +{ + int blocks = get_total_blocks(imgtool_directory_image(enumeration)); + imgtoolerr_t ret; + amiga_iterator *iter; + + iter = (amiga_iterator *) imgtool_directory_extrabytes(enumeration); + if (!iter) return IMGTOOLERR_OUTOFMEMORY; + + iter->index = 1; + iter->ht_index = 0; + iter->eof = 0; + + if (path[0]) + { + /* search for the directory block, start with the root block */ + ret = find_entry(imgtool_directory_image(enumeration), path, blocks/2, &iter->block); + if (ret) return ret; + } + else + { + /* we didn't get a path, use the root directory */ + iter->block = blocks / 2; + } + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + amiga_iterator *iter = (amiga_iterator *) imgtool_directory_extrabytes(enumeration); + imgtoolerr_t ret; + UINT32 ht[TSIZE]; + int block; + + /* finished listing all entries? */ + if (iter->eof == 1 || iter->ht_index == TSIZE) + { + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + + /* get hash table */ + ret = get_hash_table(imgtool_directory_image(enumeration), iter->block, ht); + if (ret) return ret; + + /* skip empty hash table entries */ + while (ht[iter->ht_index] == 0) + { + iter->ht_index++; + /* check if we are already at the end */ + if (iter->ht_index == TSIZE) + { + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + } + + /* get block number */ + block = (iter->next_block == 0) ? ht[iter->ht_index] : iter->next_block; + + switch (get_block_type(imgtool_directory_image(enumeration), block)) + { + case ST_FILE: + { + file_block file; + + /* get block */ + ret = read_file_block(imgtool_directory_image(enumeration), block, &file); + if (ret) return ret; + + /* fill directory entry */ + strncpyz(ent->filename, (char *)file.filename, file.name_len + 1); + ent->filesize = file.byte_size; + ent->lastmodified_time = amiga_crack_time(&file.date); + amiga_decode_flags(file.protect, ent->attr); + strncpyz(ent->comment, (char *)file.comment, file.comm_len + 1); + + iter->next_block = file.hash_chain; + + break; + } + + case ST_USERDIR: + { + dir_block dir; + + /* get block */ + ret = read_dir_block(imgtool_directory_image(enumeration), block, &dir); + if (ret) return ret; + + /* fill directory entry */ + strncpyz(ent->filename, (char *)dir.dirname, dir.name_len + 1); + ent->lastmodified_time = amiga_crack_time(&dir.date); + amiga_decode_flags(dir.protect, ent->attr); + strncpyz(ent->comment, (char *)dir.comment, dir.comm_len + 1); + ent->directory = 1; + + iter->next_block = dir.hash_chain; + + break; + } + + case ST_SOFTLINK: + { + softlink_block sl; + + /* get block */ + ret = read_softlink_block(imgtool_directory_image(enumeration), block, &sl); + if (ret) return ret; + + /* fill directory entry */ + strncpyz(ent->filename, (char *)sl.slname, sl.name_len + 1); + ent->lastmodified_time = amiga_crack_time(&sl.date); + amiga_decode_flags(sl.protect, ent->attr); + strncpyz(ent->comment, (char *)sl.comment, sl.comm_len + 1); + strcpy(ent->softlink, (char *)sl.symbolic_name); + + iter->next_block = sl.hash_chain; + + break; + } + + case ST_LINKDIR: + + ent->directory = 1; + + case ST_LINKFILE: + { + hardlink_block hl; + + /* get block */ + ret = read_hardlink_block(imgtool_directory_image(enumeration), block, &hl); + if (ret) return ret; + + /* get filesize from linked file */ + if (!ent->directory) + { + file_block file; + ret = read_file_block(imgtool_directory_image(enumeration), hl.real_entry, &file); + if (ret) return ret; + ent->filesize = file.byte_size; + } + + /* fill directory entry */ + strncpyz(ent->filename, (char *)hl.hlname, hl.name_len + 1); + ent->lastmodified_time = amiga_crack_time(&hl.date); + amiga_decode_flags(hl.protect, ent->attr); + strncpyz(ent->comment, (char *)hl.comment, hl.comm_len + 1); + ent->hardlink = 1; + + iter->next_block = hl.hash_chain; + + break; + } + + default: + return IMGTOOLERR_UNIMPLEMENTED; + } + + /* if there are no linked entries, go to the next hash table entry */ + if (iter->next_block == 0) + { + iter->ht_index++; + } + + /* jump to next index */ + iter->index++; + + return IMGTOOLERR_SUCCESS; +} + + +static void amiga_image_closeenum(imgtool_directory *enumeration) +{ + free(enumeration); +} + + +static imgtoolerr_t amiga_image_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtoolerr_t ret; + imgtool_image *image = imgtool_partition_image(partition); + const int data_size = is_ffs(image) ? BSIZE : BSIZE-24; + root_block root; + bitmap_block bm; + int blocks, blocks_processed = 0, pages, i, c; + UINT32 v; + + /* initialize size */ + *size = 0; + + /* get root block */ + ret = read_root_block(image, &root); + if (ret) return ret; + + /* get total number of blocks in the image */ + blocks = get_total_blocks(image); + + /* subtract the two bootblock blocks (only for floppies!) */ + blocks -= 2; + + /* iterate all bitmap pages */ + for (pages = 0; pages < 25; pages++) + { + ret = read_bitmap_block(image, root.bm_pages[pages], &bm); + if (ret) return ret; + + for (i = 0; i < MSIZE; i++) + { + v = bm.map[i]; + + /* clear half used value */ + if ((blocks_processed + 32) > blocks) + v &= ~(~0 << (blocks - blocks_processed)); + + /* count bits */ + for (c = 0; v; c++) + v &= v - 1; + + *size += c * data_size; + + blocks_processed += 32; + + if (blocks_processed >= blocks) + return IMGTOOLERR_SUCCESS; + } + } + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t amiga_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtool_image *img = imgtool_partition_image(partition); + imgtoolerr_t ret; + file_block file; + int filesize, block; + + /* Search for the block number */ + ret = find_entry(img, filename, get_total_blocks(img)/2, &block); + if (ret == IMGTOOLERR_PATHNOTFOUND) return IMGTOOLERR_FILENOTFOUND; + if (ret) return ret; /* Other errors */ + + /* Phase 1: Follow data pointers */ + ret = read_file_block(img, block, &file); + if (ret) return ret; + + filesize = file.byte_size; + + /* Write out file data pointed to by data block pointers */ + ret = write_data_block_ptr(img, file.data_blocks, &filesize, destf); + if (ret) return ret; + + /* Check if we are done already */ + if (filesize == 0) return IMGTOOLERR_SUCCESS; + + /* Phase 2: Follow file extension blocks */ + ret = write_file_ext_data(img, file.extension, &filesize, destf); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +/* When a file is deleted, only its File header block number is cleared from + * the Directory block (or from the same-hash-value list) and the bitmap is + * updated. File header block, Data blocks and File extension blocks are not + * cleared, but the bitmap blocks are updated. */ +static imgtoolerr_t amiga_image_deletefile(imgtool_partition *partition, const char *fname) +{ + imgtool_image *img = imgtool_partition_image(partition); + imgtoolerr_t ret; + int parent, block; + char filename[31]; + + /* Initialize filename */ + memset(filename, 0, sizeof(filename)); + + /* Search for the block number */ + ret = find_entry(img, fname, get_total_blocks(img)/2, &block); + if (ret == IMGTOOLERR_PATHNOTFOUND) return IMGTOOLERR_FILENOTFOUND; + if (ret) return ret; + + /* Get the parent block, where we need to clear the hash */ + switch (get_block_type(img, block)) + { + case ST_FILE: + { + file_block file; + int filesize; + + ret = read_file_block(img, block, &file); + if (ret) return ret; + + filesize = file.byte_size; + parent = file.parent; + memcpy(filename, file.filename, file.name_len); + + /* Clear all linked data sectors */ + ret = clear_data_block_ptr(img, file.data_blocks, &filesize); + if (ret) return ret; + + /* Clear extended file data sectors */ + if (filesize != 0) + { + ret = clear_file_ext_data(img, file.extension, &filesize); + if (ret) return ret; + } + + break; + } + + case ST_LINKFILE: + { + softlink_block link; + + ret = read_softlink_block(img, block, &link); + if (ret) return ret; + + parent = link.parent; + memcpy(filename, link.slname, link.name_len); + + break; + } + + default: + return IMGTOOLERR_UNEXPECTED; + } + + /* Clear hash table entry */ + ret = clear_hash_table_entry(img, parent, filename); + if (ret) return ret; + + /* Update disk alteration date */ + ret = update_disk_alteration_date(img); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t amiga_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + return IMGTOOLERR_UNIMPLEMENTED; +} + + +static imgtoolerr_t amiga_image_create(imgtool_image *img, imgtool_stream *stream, option_resolution *opts) +{ + amiga_floppy *f = (amiga_floppy *) imgtool_image_extra_bytes(img); + const char *dskname = option_resolution_lookup_string(opts, 'N'); + imgtoolerr_t ret; + UINT8 buffer[BSIZE]; + root_block root; + bitmap_block bm; + time_t now; + int blocks; + + f->stream = stream; + + switch (option_resolution_lookup_int(opts, 'S')) + { + case 0: f->sectors = 11; break; + case 1: f->sectors = 22; break; + default: return IMGTOOLERR_PARAMCORRUPT; + } + + /* initialize with zeros */ + memset(buffer, 0, BSIZE); + + /* add DOS magic string and flags */ + buffer[0] = 'D'; + buffer[1] = 'O'; + buffer[2] = 'S'; + buffer[3] = 0; + + /* File system */ + buffer[3] += (option_resolution_lookup_int(opts, 'F')); + + /* File system mode */ + buffer[3] += (option_resolution_lookup_int(opts, 'M')); + + /* write first bootblock sector */ + ret = write_block(img, 0, buffer); + if (ret) return ret; + + /* reset with zeros */ + memset(buffer, 0, BSIZE); + + /* write second bootblock sector */ + ret = write_block(img, 1, buffer); + if (ret) return ret; + + /* rootblock */ + memset(&root, 0, sizeof(root_block)); + + blocks = get_total_blocks(img); + + root.chksum = 0; + root.ht_size = TSIZE; + root.bm_flag = -1; + root.bm_pages[0] = blocks/2 + 1; /* generally it's located here */ + + time(&now); + amiga_setup_time(now, &root.r); + amiga_setup_time(now, &root.v); + amiga_setup_time(now, &root.c); + + /* volume name */ + if (dskname) + { + root.name_len = strlen(dskname); + memcpy(&root.diskname, dskname, root.name_len); + } + else + { + root.name_len = strlen("Empty"); + memcpy(&root.diskname, "Empty", root.name_len); + } + + /* write root block to disk */ + ret = write_root_block(img, &root); + if (ret) return ret; + + /* calculate block checksum */ + ret = fix_block_chksum(img, blocks/2); + if (ret) return ret; + + /* bitmap block */ + memset(&bm, 0xff, sizeof(bitmap_block)); + + /* write bitmap block to disk */ + ret = write_bitmap_block(img, root.bm_pages[0], &bm); + if (ret) return ret; + + /* set root and bitmap block as used */ + ret = bitmap_mark_used(img, blocks/2); + if (ret) return ret; + + ret = bitmap_mark_used(img, root.bm_pages[0]); + if (ret) return ret; + + /* write empty last block so that we don't get a truncated image */ + memset(buffer, 0, BSIZE); + + ret = write_block(img, blocks - 1, buffer); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t amiga_image_createdir(imgtool_partition *partition, const char *path) +{ + imgtool_image *img = imgtool_partition_image(partition); + imgtoolerr_t ret; + + /* Create directories */ + ret = checkdir(img, path, get_total_blocks(img)/2); + if (ret) return ret; + + /* Update disk alteration date */ + ret = update_disk_alteration_date(img); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t amiga_image_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) +{ + return IMGTOOLERR_UNIMPLEMENTED; +} + + +static imgtoolerr_t amiga_image_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) +{ + return IMGTOOLERR_UNIMPLEMENTED; +} + + +static imgtoolerr_t amiga_image_geticoninfo(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo) +{ + return IMGTOOLERR_UNIMPLEMENTED; +} + + +static imgtoolerr_t amiga_image_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) +{ + return IMGTOOLERR_UNIMPLEMENTED; +} + + + +/***************************************************************************** + Create image options +*****************************************************************************/ + + +static OPTION_GUIDE_START(amiga_createimage_optionguide) + OPTION_STRING( 'N', "name", "Volume name" ) + OPTION_ENUM_START( 'S', "density", "Density" ) + OPTION_ENUM( 0, "dd", "Double Density" ) + OPTION_ENUM( 1, "hd", "High Density" ) + OPTION_ENUM_END + OPTION_ENUM_START( 'F', "filesystem", "File system" ) + OPTION_ENUM( 0, "ofs", "OldFileSystem" ) + OPTION_ENUM( 1, "ffs", "FastFileSystem" ) + OPTION_ENUM_END + OPTION_ENUM_START( 'M', "mode", "File system options" ) + OPTION_ENUM( 0, "none", "None" ) + OPTION_ENUM( 2, "intl", "International Mode" ) + OPTION_ENUM( 4, "dirc", "International Mode with Directory Cache" ) + OPTION_ENUM_END +OPTION_GUIDE_END + + + +/***************************************************************************** + Imgtool module declaration +*****************************************************************************/ + + +/* Amiga floppy disk attributes */ +void amiga_floppy_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(amiga_floppy); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(amiga_iterator); break; + case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break; + case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break; + case IMGTOOLINFO_INT_CHARSET: info->i = IMGTOOL_CHARSET_ISO_8859_1; break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "amiga_floppy"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Amiga floppy disk image (OFS/FFS format)"); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "adf"); break; + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), EOLN_LF); break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "S[0]-1;F[0]-1;M[0]/2/4"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_OPEN: info->open = amiga_image_open; break; + case IMGTOOLINFO_PTR_CLOSE: info->close = amiga_image_exit; break; + case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = amiga_image_read_sector; break; + case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = amiga_image_write_sector; break; + case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = amiga_image_get_sector_size; break; + case IMGTOOLINFO_PTR_CREATE: info->create = amiga_image_create; break; + case IMGTOOLINFO_PTR_INFO: info->info = amiga_image_info; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = amiga_image_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = amiga_image_nextenum; break; + case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = amiga_image_closeenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = amiga_image_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = amiga_image_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = amiga_image_writefile; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = amiga_image_deletefile; break; + case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = amiga_image_createdir; break; + case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = amiga_image_getattrs; break; + case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = amiga_image_setattrs; break; + case IMGTOOLINFO_PTR_GET_ICON_INFO: info->get_iconinfo = amiga_image_geticoninfo; break; + case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = amiga_image_suggesttransfer; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = amiga_createimage_optionguide; break; + } +} diff --git a/src/mame/tools/imgtool/modules/bml3.c b/src/mame/tools/imgtool/modules/bml3.c new file mode 100644 index 00000000000..1ed1b645f69 --- /dev/null +++ b/src/mame/tools/imgtool/modules/bml3.c @@ -0,0 +1,928 @@ +// license:GPL-2.0+ +// copyright-holders:Jonathan Edwards +/**************************************************************************** + + bml3.c + + Hitachi bml3 disk images + + By Jonathan Edwards, based on rsdos.c (both use Microsoft BASIC) + +****************************************************************************/ + +/* Supported Hitachi floppy formats are: + - 3" or 5"1/4 single density, single-sided: 40 tracks, 16 sectors/track, 128 bytes/sector + - (used with MP-1805 floppy disk controller card) + - 5"1/4 double density, double-sided: 40 tracks, 16 sectors/track, 256 bytes/sector + - (first track on first head may be single density) + - (used with MP-1802 floppy disk controller card) +*/ + +#include +#include +#include +#include "imgtool.h" +#include "iflopimg.h" + +#define MAX_SECTOR_SIZE 256 + +struct bml3_diskinfo +{ + UINT16 sector_size; /* 128 or 256 */ + UINT8 heads; /* 1 or 2 */ + UINT8 fat_start_sector; /* in cylinder 20, start sector of FAT */ + UINT8 fat_start_offset; /* start byte of FAT in sector */ + UINT8 fat_sectors; /* the number of sectors in the FAT */ + UINT8 dirent_start_sector; /* in cylinder 20, start sector of directory entries */ + UINT8 granule_sectors; /* how many sectors per granule */ + UINT8 first_granule_cylinder; /* the number of the first cylinder with granule numbers assigned */ + UINT8 variant; /* 0 - older version, uses EOF to terminate files, 1 - newer version, stores file length */ +}; + +/* this structure mirrors the structure of a directory entry on disk */ +struct bml3_dirent +{ + char fname[8]; + char fext[3]; + UINT8 ftype; + UINT8 asciiflag; + UINT8 first_granule; + UINT16 lastsectorbytes; + // TODO there are some 'unused' bytes here that are sometimes used to store a timestamp, maybe support this? +}; + +struct bml3_direnum +{ + int index; + int eof; +}; + +#define MAX_GRANULEMAP_SIZE 256 + +struct granule_list_t { + UINT8 granules[MAX_GRANULEMAP_SIZE]; + UINT8 granule_count; + UINT8 last_granule_sectors; +}; + +#define BML3_OPTIONS_FTYPE 'T' +#define BML3_OPTIONS_ASCII 'M' + +static imgtoolerr_t bml3_diskimage_deletefile(imgtool_partition *partition, const char *fname); + + + +/********************************************************************* + Imgtool module code +*********************************************************************/ + +static bml3_diskinfo *bml3_get_diskinfo(imgtool_image *image) +{ + return (bml3_diskinfo *) imgtool_floppy_extrabytes(image); +} + + + +static int max_dirents(imgtool_image *image) +{ + bml3_diskinfo *info = bml3_get_diskinfo(image); + return (16 * info->heads + 1 - info->dirent_start_sector)*(info->sector_size/32); +} + + + +static void dirent_location(imgtool_image *image, int index_loc, UINT8 *head, UINT8 *track, UINT8 *sector, UINT8 *offset) +{ + bml3_diskinfo *info = bml3_get_diskinfo(image); + *track = 20; + *sector = info->dirent_start_sector + index_loc / (info->sector_size / 32); + *head = 0; + if (*sector > 16) { + // wrap to second head + *sector -= 16; + (*head)++; + } + *offset = index_loc % (info->sector_size/32) * 32; +} + + + +static floperr_t get_bml3_dirent(imgtool_image *f, int index_loc, struct bml3_dirent *ent) +{ + floperr_t err; + UINT8 head, track, sector, offset; + UINT8 buf[32]; + bml3_diskinfo *info = bml3_get_diskinfo(f); + dirent_location(f, index_loc, &head, &track, §or, &offset); + err = floppy_read_sector(imgtool_floppy(f), head, track, sector, offset, (void *) buf, sizeof(buf)); + memset(ent, 0, sizeof(*ent)); + switch (info->variant) { + case 0: + memcpy(&ent->fname, &buf[0], 8); + ent->ftype = buf[11]; + ent->asciiflag = buf[12]; + ent->first_granule = buf[14]; + break; + case 1: + memcpy(&ent->fname, &buf[0], 8); + memcpy(&ent->fext, &buf[8], 3); + ent->ftype = buf[11]; + ent->asciiflag = buf[12]; + ent->first_granule = buf[13]; + ent->lastsectorbytes = (buf[14] << 8) | buf[15]; + break; + default: + return FLOPPY_ERROR_INVALIDIMAGE; + } + return err; +} + + + +static floperr_t put_bml3_dirent(imgtool_image *f, int index_loc, const struct bml3_dirent *ent) +{ + floperr_t err; + UINT8 head, track, sector, offset; + UINT8 buf[32]; + bml3_diskinfo *info = bml3_get_diskinfo(f); + if (index_loc >= max_dirents(f)) + return (floperr_t)IMGTOOLERR_FILENOTFOUND; + dirent_location(f, index_loc, &head, &track, §or, &offset); + memset(buf, 0, sizeof(buf)); + switch (info->variant) { + case 0: + memcpy(&buf[0], &ent->fname, 8); + buf[11] = ent->ftype; + buf[12] = ent->asciiflag; + buf[14] = ent->first_granule; + break; + case 1: + memcpy(&buf[0], &ent->fname, 8); + memcpy(&buf[8], &ent->fext, 3); + buf[11] = ent->ftype; + buf[12] = ent->asciiflag; + buf[13] = ent->first_granule; + buf[14] = ent->lastsectorbytes >> 8; + buf[15] = ent->lastsectorbytes & 0xff; + break; + default: + return FLOPPY_ERROR_INVALIDIMAGE; + } + err = floppy_write_sector(imgtool_floppy(f), head, track, sector, offset, (void *) buf, sizeof(buf), 0); /* TODO: pass ddam argument from imgtool */ + return err; +} + + + +/* fnamebuf must have at least 13 bytes */ +static void get_dirent_fname(char *fnamebuf, const struct bml3_dirent *ent) +{ + char *s; + + memset(fnamebuf, 0, 13); + memcpy(fnamebuf, ent->fname, sizeof(ent->fname)); + rtrim(fnamebuf); + s = fnamebuf + strlen(fnamebuf); + *(s++) = '.'; + memcpy(s, ent->fext, sizeof(ent->fext)); + rtrim(s); + + /* If no extension, remove period */ + if (*s == '\0') + s[-1] = '\0'; +} + + + +static imgtoolerr_t lookup_bml3_file(imgtool_image *f, const char *fname, struct bml3_dirent *ent, int *position) +{ + int i; + floperr_t ferr; + char fnamebuf[13]; + + i = 0; + fnamebuf[0] = '\0'; + + do + { + do + { + ferr = get_bml3_dirent(f, i++, ent); + if (ferr) + return imgtool_floppy_error(ferr); + } + while(ent->fname[0] == '\0'); + + + if (ent->fname[0] != -1) + get_dirent_fname(fnamebuf, ent); + } + while((ent->fname[0] != -1) && core_stricmp(fnamebuf, fname)); + + if (ent->fname[0] == -1) + return IMGTOOLERR_FILENOTFOUND; + + if (position) + *position = i - 1; + return (imgtoolerr_t)0; +} + + + +static UINT8 get_granule_count(imgtool_image *img) +{ + // UINT16 tracks; + UINT16 disk_granules; + bml3_diskinfo *info = bml3_get_diskinfo(img); + + // This always returns 82 for D88, so not quite right + // tracks = floppy_get_tracks_per_disk(imgtool_floppy(img)); + + // The number of granules is primarily constrained by the disk capacity. + disk_granules = (40 - 1 - info->first_granule_cylinder) * info->heads * (16 / info->granule_sectors); + // Also, granule numbers from 0xC0 upwards are reserved for terminating a granule chain + return (UINT8)((disk_granules < 0xC0) ? disk_granules : 0xC0); +} + +/* granule_map must be an array of MAX_GRANULEMAP_SIZE bytes */ +static floperr_t get_granule_map(imgtool_image *img, UINT8 *granule_map, UINT8 *granule_count) +{ + bml3_diskinfo *info = bml3_get_diskinfo(img); + UINT8 count; + + count = get_granule_count(img); + if (granule_count) + *granule_count = count; + + // The first byte of the granule map sector is ignored (and expected to be 0) + return floppy_read_sector(imgtool_floppy(img), 0, 20, info->fat_start_sector, info->fat_start_offset, granule_map, count); +} + + + +static floperr_t put_granule_map(imgtool_image *img, const UINT8 *granule_map, UINT8 granule_count) +{ + bml3_diskinfo *info = bml3_get_diskinfo(img); + return floppy_write_sector(imgtool_floppy(img), 0, 20, info->fat_start_sector, info->fat_start_offset, granule_map, granule_count, 0); /* TODO: pass ddam argument from imgtool */ +} + + + + +static void granule_location(imgtool_image *image, UINT8 granule, UINT8 *head, UINT8 *track, UINT8 *sector) +{ + bml3_diskinfo *info = bml3_get_diskinfo(image); + UINT16 abs_track = granule * info->granule_sectors / 16; + *head = abs_track % info->heads; + *track = abs_track / info->heads + info->first_granule_cylinder; + // skip filesystem cylinder + if (*track >= 20) + (*track)++; + *sector = granule * info->granule_sectors % 16 + 1; +} + + + +static imgtoolerr_t transfer_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *f, imgtoolerr_t (*proc)(imgtool_image *, int, int, int, int, size_t, imgtool_stream *)) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + UINT8 head, track, sector; + granule_location(img, granule, &head, &track, §or); + if (length > 0) + err = proc(img, head, track, sector, 0, length, f); + return err; +} + + +static imgtoolerr_t transfer_from_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *destf) +{ + return transfer_granule(img, granule, length, destf, imgtool_floppy_read_sector_to_stream); +} + + + +static imgtoolerr_t transfer_to_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *sourcef) +{ + return transfer_granule(img, granule, length, sourcef, imgtool_floppy_write_sector_from_stream); +} + + + +static floperr_t read_granule(imgtool_image *img, UINT8 granule, int offset, int length, UINT8 *buf) +{ + UINT8 head, track, sector; + granule_location(img, granule, &head, &track, §or); + return floppy_read_sector(imgtool_floppy(img), head, track, sector, offset, buf, length); +} + + + +static floperr_t write_granule(imgtool_image *img, UINT8 granule, int offset, int length, const UINT8 *buf) +{ + UINT8 head, track, sector; + granule_location(img, granule, &head, &track, §or); + return floppy_write_sector(imgtool_floppy(img), head, track, sector, offset, buf, length, 0); /* TODO: pass ddam argument from imgtool */ +} + + + +static imgtoolerr_t list_granules(struct bml3_dirent *ent, imgtool_image *img, struct granule_list_t *granule_list) +{ + floperr_t ferr; + UINT8 max_granules; + UINT8 granule; + UINT8 usedmap[MAX_GRANULEMAP_SIZE]; /* Used to detect infinite loops */ + UINT8 granule_map[MAX_GRANULEMAP_SIZE]; + bml3_diskinfo *info = bml3_get_diskinfo(img); + + ferr = get_granule_map(img, granule_map, &max_granules); + if (ferr) + return imgtool_floppy_error(ferr); + + memset(usedmap, 0, max_granules); + + granule = ent->first_granule; + granule_list->granule_count = 0; + + while(!usedmap[granule] && granule < max_granules) + { + usedmap[granule] = 1; + granule_list->granules[granule_list->granule_count++] = granule; + granule = granule_map[granule]; + } + + granule_list->last_granule_sectors = granule - 0xc0; + if (info->variant == 0) { + // add final incomplete sector + granule_list->last_granule_sectors++; + } + + // A value of zero (variant 1) and max (variant 0) seem to indicate a file open for writing. + // Strictly speaking this means the image is corrupt, although a real system will happily read + // garbage from the file. + if (granule_list->last_granule_sectors > info->granule_sectors) + return IMGTOOLERR_CORRUPTIMAGE; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t get_file_size(struct bml3_dirent *ent, imgtool_image *img, const struct granule_list_t *granule_list, size_t *size) +{ + floperr_t ferr; + size_t last_sector_bytes = 0; + bml3_diskinfo *info = bml3_get_diskinfo(img); + + // TODO are these special cases valid, or maybe indicate a corrupt image? + if (granule_list->granule_count == 0) { + *size = 0; + return IMGTOOLERR_SUCCESS; + } + else if (granule_list->last_granule_sectors == 0) { + *size = info->sector_size * ((granule_list->granule_count - 1) * info->granule_sectors); + return IMGTOOLERR_SUCCESS; + } + + // determine size excluding final sector + *size = info->sector_size * ((granule_list->granule_count - 1) * info->granule_sectors + granule_list->last_granule_sectors - 1); + + // determine bytes used in final sector + switch (info->variant) { + case 0: + // look for EOF (ASCII SUB) and trailing NULs in final sector + { + UINT8 buf[MAX_SECTOR_SIZE]; + ferr = read_granule(img, granule_list->granules[granule_list->granule_count-1], info->sector_size * (granule_list->last_granule_sectors - 1), info->sector_size, buf); + if (ferr) + return imgtool_floppy_error(ferr); + for (last_sector_bytes = info->sector_size - 1; ; last_sector_bytes--) { + if (buf[last_sector_bytes] != 0) + break; + if (last_sector_bytes == 0) + break; + } + if (buf[last_sector_bytes] != 0x1a) { + last_sector_bytes++; + } + } + break; + case 1: + last_sector_bytes = ent->lastsectorbytes; + break; + } + + // TODO is it valid for last_sector_bytes == 0? + if (last_sector_bytes > info->sector_size) { + return IMGTOOLERR_CORRUPTIMAGE; + } + *size += last_sector_bytes; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t process_bml3_file(struct bml3_dirent *ent, imgtool_image *img, imgtool_stream *destf, size_t *size) +{ + imgtoolerr_t err; + size_t remaining_size, granule_size; + bml3_diskinfo *info = bml3_get_diskinfo(img); + struct granule_list_t granule_list; + granule_list.granule_count = 0; + + err = list_granules(ent, img, &granule_list); + if (err) + return err; + err = get_file_size(ent, img, &granule_list, size); + if (err) + return err; + + if (destf) { + remaining_size = *size; + granule_size = info->granule_sectors * info->sector_size; + + for (int c = 0; c < granule_list.granule_count; c++) { + if (granule_size >= remaining_size) + granule_size = remaining_size; + transfer_from_granule(img, granule_list.granules[c], granule_size, destf); + remaining_size -= granule_size; + } + } + return IMGTOOLERR_SUCCESS; +} + + + +/* create a new directory entry with a specified name */ +static imgtoolerr_t prepare_dirent(UINT8 variant, struct bml3_dirent *ent, const char *fname) +{ + const char *fname_end; + const char *fname_ext; + int fname_ext_len; + + memset(ent, '\0', sizeof(*ent)); + memset(ent->fname, ' ', sizeof(ent->fname)); + memset(ent->fext, ' ', sizeof(ent->fext)); + + fname_end = strchr(fname, '.'); + if (fname_end) + fname_ext = fname_end + 1; + else + fname_end = fname_ext = fname + strlen(fname); + + fname_ext_len = strlen(fname_ext); + + switch (variant) { + case 0: + /* 8-character max filename */ + if (((fname_end - fname) > 8) || (fname_ext_len > 0)) + return IMGTOOLERR_BADFILENAME; + break; + case 1: + /*8.3 filename */ + if (((fname_end - fname) > 8) || (fname_ext_len > 3)) + return IMGTOOLERR_BADFILENAME; + break; + default: + return IMGTOOLERR_CORRUPTIMAGE; + } + + memcpy(ent->fname, fname, fname_end - fname); + memcpy(ent->fext, fname_ext, fname_ext_len); + + /* By default, set as a type 2 binary file */ + ent->ftype = 2; + ent->asciiflag = 0; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t bml3_diskimage_open(imgtool_image *image, imgtool_stream *stream) +{ + // imgtoolerr_t err; + floperr_t ferr; + bml3_diskinfo *info = bml3_get_diskinfo(image); + floppy_image_legacy *floppy = imgtool_floppy(image); + const struct FloppyCallbacks *callbacks = floppy_callbacks(floppy); + + // probe disk geometry to guess format + int heads_per_disk = callbacks->get_heads_per_disk(floppy); + UINT32 sector_length; + ferr = callbacks->get_sector_length(floppy, 0, 20, 1, §or_length); + if (ferr) + return imgtool_floppy_error(ferr); + int sectors_per_track = callbacks->get_sectors_per_track(floppy, 0, 20); + + if (heads_per_disk == 2 && sector_length == 128 && sectors_per_track == 16) { + // single-sided, single-density + info->sector_size = 128; + info->heads = 1; + info->fat_start_sector = 1; + info->fat_start_offset = 5; + info->fat_sectors = 2; + info->dirent_start_sector = 7; + info->granule_sectors = 4; + info->first_granule_cylinder = 0; + info->variant = 0; + } + else if (heads_per_disk == 2 && sector_length == 256 && sectors_per_track == 16) { + // double-sided, double-density + info->sector_size = 256; + info->heads = 2; + info->fat_start_sector = 2; + info->fat_start_offset = 1; + info->fat_sectors = 1; + info->dirent_start_sector = 5; + info->granule_sectors = 8; + info->first_granule_cylinder = 1; + info->variant = 1; + } + else { + // invalid or unsupported format + return IMGTOOLERR_CORRUPTIMAGE; + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t bml3_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + floperr_t ferr; + imgtoolerr_t err; + size_t filesize; + struct bml3_direnum *rsenum; + struct bml3_dirent rsent; + char fname[13]; + imgtool_image *image; + + image = imgtool_directory_image(enumeration); + rsenum = (struct bml3_direnum *) imgtool_directory_extrabytes(enumeration); + + /* Did we hit the end of file before? */ + if (rsenum->eof) + goto eof; + + do + { + if (rsenum->index >= max_dirents(image)) + goto eof; + + ferr = get_bml3_dirent(image, rsenum->index++, &rsent); + if (ferr) + return imgtool_floppy_error(ferr); + } + while(rsent.fname[0] == '\0'); + + /* Now are we at the eof point? */ + if (rsent.fname[0] == -1) + { + rsenum->eof = 1; +eof: + ent->eof = 1; + } + else + { + /* Not the end of file */ + err = process_bml3_file(&rsent, image, NULL, &filesize); + if (err) + return err; + + if (filesize == ((size_t) -1)) + { + /* corrupt! */ + ent->filesize = 0; + ent->corrupt = 1; + } + else + { + ent->filesize = filesize; + ent->corrupt = 0; + } + ent->eof = 0; + + get_dirent_fname(fname, &rsent); + + snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fname); + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B')); + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t bml3_diskimage_freespace(imgtool_partition *partition, UINT64 *size) +{ + floperr_t ferr; + UINT8 i; + size_t s = 0; + UINT8 granule_count; + UINT8 granule_map[MAX_GRANULEMAP_SIZE]; + imgtool_image *image = imgtool_partition_image(partition); + bml3_diskinfo *info = bml3_get_diskinfo(image); + + ferr = get_granule_map(image, granule_map, &granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + for (i = 0; i < granule_count; i++) + { + if (granule_map[i] == 0xff) + s += (info->granule_sectors * info->sector_size); + } + *size = s; + return (imgtoolerr_t)FLOPPY_ERROR_SUCCESS; +} + + + +static imgtoolerr_t delete_entry(imgtool_image *img, struct bml3_dirent *ent, int pos) +{ + floperr_t ferr; + unsigned char g, i; + UINT8 granule_count; + UINT8 granule_map[MAX_GRANULEMAP_SIZE]; + + /* Write a NUL in the filename, marking it deleted */ + ent->fname[0] = 0; + ferr = put_bml3_dirent(img, pos, ent); + if (ferr) + return imgtool_floppy_error(ferr); + + ferr = get_granule_map(img, granule_map, &granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + /* Now free up the granules */ + g = ent->first_granule; + while (g < granule_count) + { + i = granule_map[g]; + granule_map[g] = 0xff; + g = i; + } + + ferr = put_granule_map(img, granule_map, granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t bml3_diskimage_readfile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t err; + struct bml3_dirent ent; + size_t size; + imgtool_image *img = imgtool_partition_image(partition); + + err = lookup_bml3_file(img, fname, &ent, NULL); + if (err) + return err; + + err = process_bml3_file(&ent, img, destf, &size); + if (err) + return err; + + if (size == (size_t) -1) + return IMGTOOLERR_CORRUPTIMAGE; + + return (imgtoolerr_t)0; +} + + + +static imgtoolerr_t bml3_diskimage_writefile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) +{ + floperr_t ferr; + imgtoolerr_t err; + imgtool_image *img = imgtool_partition_image(partition); + bml3_diskinfo *info = bml3_get_diskinfo(img); + struct bml3_dirent ent, ent2; + size_t i; + UINT64 sz, read_sz; + UINT64 freespace = 0; + unsigned char *gptr; + UINT8 granule_count; + UINT8 granule_map[MAX_GRANULEMAP_SIZE]; + UINT8 eof_buf[MAX_SECTOR_SIZE]; + + // one-time setup of eof_buf + memset(eof_buf, 0, sizeof(eof_buf)); + eof_buf[0] = 0x1A; + + /* can we write to this image? */ + if (floppy_is_read_only(imgtool_floppy(img))) + return IMGTOOLERR_READONLY; + + err = bml3_diskimage_freespace(partition, &freespace); + if (err) + return err; + + /* is there enough space? */ + sz = read_sz = stream_size(sourcef); + if (info->variant == 0) { + // also need to write EOF + sz++; + } + if (sz > freespace) + return IMGTOOLERR_NOSPACE; + + /* setup our directory entry */ + err = prepare_dirent(info->variant, &ent, fname); + if (err) + return err; + + ent.ftype = option_resolution_lookup_int(writeoptions, BML3_OPTIONS_FTYPE); + ent.asciiflag = ((UINT8) option_resolution_lookup_int(writeoptions, BML3_OPTIONS_ASCII)) - 1; + gptr = &ent.first_granule; + + ferr = get_granule_map(img, granule_map, &granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + unsigned char g = 0x00; + UINT32 granule_bytes = info->granule_sectors * info->sector_size; + + do + { + while (granule_map[g] != 0xff) + { + g++; + if ((g >= granule_count) || (g == 0)) + return IMGTOOLERR_UNEXPECTED; /* We should have already verified that there is enough space */ + } + *gptr = g; + gptr = &granule_map[g]; + + + i = MIN(read_sz, granule_bytes); + if (i > 0) { + err = transfer_to_granule(img, g, i, sourcef); + if (err) + return err; + read_sz -= i; + sz -= i; + } + if (i < info->granule_sectors * info->sector_size && sz > 0) { + // write EOF and trailing NULs in the final sector + ferr = write_granule(img, g, i, (info->granule_sectors * info->sector_size - i - 1) % info->sector_size + 1, eof_buf); + if (ferr) + return imgtool_floppy_error(ferr); + sz--; + i++; + } + + /* Go to next granule */ + g++; + } + while(sz > 0); + + /* Now that we are done with the file, we need to specify the final entry + * in the file allocation table + */ + *gptr = 0xc0 + ((i + info->sector_size-1) / info->sector_size) - (info->variant == 0 ? 1 : 0); + ent.lastsectorbytes = (i - 1) % info->sector_size + 1; + + /* delete file if it already exists */ + err = bml3_diskimage_deletefile(partition, fname); + if (err && err != IMGTOOLERR_FILENOTFOUND) + return err; + + /* Now we need to find an empty directory entry */ + i = -1; + do + { + ferr = get_bml3_dirent(img, ++i, &ent2); + if (ferr) + return imgtool_floppy_error(ferr); + } + while(ent2.fname[0] != '\0' && ent2.fname[0] != -1); + + ferr = put_bml3_dirent(img, i, &ent); + if (ferr) + return imgtool_floppy_error(ferr); + + /* write the granule map back out */ + ferr = put_granule_map(img, granule_map, granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t bml3_diskimage_deletefile(imgtool_partition *partition, const char *fname) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + int pos = 0; + struct bml3_dirent ent; + + err = lookup_bml3_file(image, fname, &ent, &pos); + if (err) + return err; + + return delete_entry(image, &ent, pos); +} + + + +static imgtoolerr_t bml3_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + struct bml3_dirent ent; + int pos; + + if (fname) + { + err = lookup_bml3_file(image, fname, &ent, &pos); + if (err) + return err; + + if (ent.asciiflag == 0xFF) + { + /* ASCII file */ + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = filter_eoln_getinfo; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = NULL; + } + else if (ent.ftype == 0) + { + /* tokenized BASIC file */ + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = NULL; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = filter_bml3bas_getinfo; + } + } + else + { + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = NULL; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = filter_eoln_getinfo; + suggestions[2].viability = SUGGESTION_POSSIBLE; + suggestions[2].filter = filter_bml3bas_getinfo; + } + + return IMGTOOLERR_SUCCESS; +} + + + +/********************************************************************* + Imgtool module declaration +*********************************************************************/ + +static OPTION_GUIDE_START( bml3_writefile_optionguide ) + OPTION_ENUM_START( BML3_OPTIONS_FTYPE, "ftype", "File type" ) + OPTION_ENUM( 0, "basic", "Basic" ) + OPTION_ENUM( 1, "data", "Data" ) + OPTION_ENUM( 2, "binary", "Binary" ) + OPTION_ENUM( 3, "assembler", "Assembler Source" ) + OPTION_ENUM_END + OPTION_ENUM_START( BML3_OPTIONS_ASCII, "ascii", "Ascii flag" ) + OPTION_ENUM( 0, "ascii", "Ascii" ) + OPTION_ENUM( 1, "binary", "Binary" ) + OPTION_ENUM_END +OPTION_GUIDE_END + + + +void bml3_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break; + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(bml3_diskinfo); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct bml3_direnum); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "bml3"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Basic Master Level 3 format"); break; + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; + case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T0-[2]-3;M0-[1]"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; + case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = bml3_diskimage_open; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = bml3_diskimage_nextenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = bml3_diskimage_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = bml3_diskimage_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = bml3_diskimage_writefile; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = bml3_diskimage_deletefile; break; + case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = bml3_diskimage_suggesttransfer; break; + case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = bml3_writefile_optionguide; break; + case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_default; break; + } +} diff --git a/src/mame/tools/imgtool/modules/concept.c b/src/mame/tools/imgtool/modules/concept.c new file mode 100644 index 00000000000..a5c5a37b1ad --- /dev/null +++ b/src/mame/tools/imgtool/modules/concept.c @@ -0,0 +1,492 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/* + Handlers for concept floppy images + + Disk images are in MESS format. + + Raphael Nabet, 2003 +*/ + +#include +#include +#include +#include +#include "imgtool.h" + +struct UINT16xE +{ + UINT8 bytes[2]; +}; + +/* + get_UINT16xE + + Read a 16-bit word, whether it is little-endian or big-endian + + little_endian (I): non-zero if word is little-endian, zero if word is + big-endian + word (I): pointer to word to read + + Returns value of word in native format +*/ +INLINE UINT16 get_UINT16xE(int little_endian, UINT16xE word) +{ + return little_endian ? (word.bytes[0] | (word.bytes[1] << 8)) : ((word.bytes[0] << 8) | word.bytes[1]); +} + +#if 0 +/* + set_UINT16xE + + Write a 16-bit word, whether it is little-endian or big-endian + + little_endian (I): non-zero if word is little-endian, zero if word is + big-endian + word (O): pointer to word to write + data (I): value to write in word, in native format +*/ +INLINE void set_UINT16xE(int little_endian, UINT16xE *word, UINT16 data) +{ + if (little_endian) + { + word->bytes[0] = data & 0xff; + word->bytes[1] = (data >> 8) & 0xff; + } + else + { + word->bytes[0] = (data >> 8) & 0xff; + word->bytes[1] = data & 0xff; + } +} +#endif + +/* + Disk structure: + + Track 0 Sector 0 & 1: bootstrap loader + Track 0 Sector 2 through 5: disk directory + Remaining sectors are used for data. +*/ + +/* + device directory record (Disk sector 2-5) +*/ + +struct concept_vol_hdr_entry +{ + UINT16xE first_block; + UINT16xE next_block; + UINT16xE ftype; + + unsigned char volname[8]; + UINT16xE last_block; + UINT16xE num_files; + UINT16xE last_boot; + UINT16xE last_access; + char mem_flipped; + char disk_flipped; + UINT16xE unused; +}; + +struct concept_file_dir_entry +{ + UINT16xE first_block; + UINT16xE next_block; + UINT16xE ftype; + + unsigned char filename[16]; + UINT16xE last_byte; + UINT16xE last_access; +}; + +struct concept_dev_dir +{ + concept_vol_hdr_entry vol_hdr; + concept_file_dir_entry file_dir[77]; + char unused[20]; +}; + +/* + concept disk image descriptor +*/ +struct concept_image +{ + imgtool_stream *file_handle; /* imgtool file handle */ + concept_dev_dir dev_dir; /* cached copy of device directory */ +}; + +/* + concept catalog iterator, used when imgtool reads the catalog +*/ +struct concept_iterator +{ + concept_image *image; + int index; /* current index */ +}; + + +static imgtoolerr_t concept_image_init(imgtool_image *img, imgtool_stream *f); +static void concept_image_exit(imgtool_image *img); +static void concept_image_info(imgtool_image *img, char *string, size_t len); +static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path); +static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); +static void concept_image_closeenum(imgtool_directory *enumeration); +static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64 *size); +static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); +#if 0 +static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions); +static imgtoolerr_t concept_image_deletefile(imgtool_partition *partition, const char *filename); +static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool_stream *f, option_resolution *createoptions); +#endif + +void concept_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(concept_image); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(concept_iterator); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "concept"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Concept floppy disk image"); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "img"); break; + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_OPEN: info->open = concept_image_init; break; + case IMGTOOLINFO_PTR_CLOSE: info->close = concept_image_exit; break; + case IMGTOOLINFO_PTR_INFO: info->info = concept_image_info; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = concept_image_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = concept_image_nextenum; break; + case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = concept_image_closeenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = concept_image_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = concept_image_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = concept_image_writefile */; break; + case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = concept_image_deletefile */; break; + case IMGTOOLINFO_PTR_CREATE: /* info->create = concept_image_create */; break; + } +} + +/* + read_physical_record + + Read one 512-byte physical record from a disk image + + file_handle: imgtool file handle + secnum: physical record address + dest: pointer to destination buffer + + Return non-zero on error +*/ +static int read_physical_record(imgtool_stream *file_handle, int secnum, void *dest) +{ + int reply; + + /* seek to sector */ + reply = stream_seek(file_handle, secnum*512, SEEK_SET); + if (reply) + return 1; + /* read it */ + reply = stream_read(file_handle, dest, 512); + if (reply != 512) + return 1; + + return 0; +} + +#ifdef UNUSED_FUNCTION +/* + write_physical_record + + Write one 512-byte physical record to a disk image + + file_handle: imgtool file handle + secnum: logical sector address + src: pointer to source buffer + + Return non-zero on error +*/ +static int write_physical_record(imgtool_stream *file_handle, int secnum, const void *src) +{ + int reply; + + /* seek to sector */ + reply = stream_seek(file_handle, secnum*512, SEEK_SET); + if (reply) + return 1; + /* read it */ + reply = stream_write(file_handle, src, 512); + if (reply != 512) + return 1; + + return 0; +} +#endif + +/* + Search for a file name on a concept_image + + image (I): image reference + filename (I): name of the file to search + entry_index (O): index of file in disk catalog + + Return non-zero on error +*/ +static int get_catalog_entry(concept_image *image, const unsigned char *filename, int *entry_index) +{ + int filename_len = filename[0]; + int i; + + if (filename_len > 15) + /* file name is bad */ + return 1; + + for (i = 0; i < 77; i++) + { + if (!memcmp(filename, image->dev_dir.file_dir[i].filename, filename_len+1)) + { + /* file found */ + *entry_index = i; + return 0; + } + } + + /* file not found */ + return 1; +} + +/* + Open a file as a concept_image. +*/ +static imgtoolerr_t concept_image_init(imgtool_image *img, imgtool_stream *f) +{ + concept_image *image = (concept_image *) imgtool_image_extra_bytes(img); + int reply; + int i; + unsigned totphysrecs; + + image->file_handle = f; + + /* read device directory */ + for (i=0; i<4; i++) + { + reply = read_physical_record(f, i+2, ((char *) & image->dev_dir)+i*512); + if (reply) + return IMGTOOLERR_READERROR; + } + + /* do primitive checks */ + totphysrecs = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.last_block) + - get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.first_block); + + if ((get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.first_block) != 0) + || (get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.next_block) != 6) + || (totphysrecs < 6) /*|| (stream_size(f) != totphysrecs*512)*/ + || (image->dev_dir.vol_hdr.volname[0] > 7)) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + + return IMGTOOLERR_SUCCESS; +} + +/* + close a concept_image +*/ +static void concept_image_exit(imgtool_image *img) +{ + /*concept_image *image = (concept_image *) imgtool_image_extra_bytes(img);*/ +} + +/* + get basic information on a concept_image + + Currently returns the volume name +*/ +static void concept_image_info(imgtool_image *img, char *string, size_t len) +{ + concept_image *image = (concept_image *) imgtool_image_extra_bytes(img); + char vol_name[8]; + + memcpy(vol_name, image->dev_dir.vol_hdr.volname + 1, image->dev_dir.vol_hdr.volname[0]); + vol_name[image->dev_dir.vol_hdr.volname[0]] = 0; + + snprintf(string, len, "%s", vol_name); +} + +/* + Open the disk catalog for enumeration +*/ +static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path) +{ + concept_iterator *iter; + + iter = (concept_iterator *) imgtool_directory_extrabytes(enumeration); + iter->image = (concept_image *) imgtool_image_extra_bytes(imgtool_directory_image(enumeration)); + iter->index = 0; + return IMGTOOLERR_SUCCESS; +} + +/* + Enumerate disk catalog next entry +*/ +static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + concept_iterator *iter = (concept_iterator *) imgtool_directory_extrabytes(enumeration); + + + ent->corrupt = 0; + ent->eof = 0; + + if ((iter->image->dev_dir.file_dir[iter->index].filename[0] == 0) || (iter->index > 77)) + { + ent->eof = 1; + } + else if (iter->image->dev_dir.file_dir[iter->index].filename[0] > 15) + { + ent->corrupt = 1; + } + else + { + int len = iter->image->dev_dir.file_dir[iter->index].filename[0]; + const char *type; + + if (len > ARRAY_LENGTH(ent->filename)) + len = ARRAY_LENGTH(ent->filename); + memcpy(ent->filename, iter->image->dev_dir.file_dir[iter->index].filename + 1, len); + ent->filename[len] = 0; + + /* parse flags */ + switch (get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].ftype) & 0xf) + { + case 0: + case 8: + type = "DIRHDR"; + break; + case 2: + type = "CODE"; + break; + case 3: + type = "TEXT"; + break; + case 5: + type = "DATA"; + break; + default: + type = "???"; + break; + } + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%s", type); + + /* len in physrecs */ + ent->filesize = get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].next_block) + - get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].first_block); + + iter->index++; + } + + return (imgtoolerr_t)0; +} + +/* + Free enumerator +*/ +static void concept_image_closeenum(imgtool_directory *enumeration) +{ +} + +/* + Compute free space on disk image +*/ +static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtool_image *img = imgtool_partition_image(partition); + concept_image *image = (concept_image*) img; + int free_blocks; + int i; + + /* first get number of data blocks */ + free_blocks = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.last_block) + - get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.next_block); + + /* next substract length of each file */ + for (i=0; (image->dev_dir.file_dir[i].filename[0] != 0) && (i <= 77); i++) + { + free_blocks -= get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[i].next_block) + - get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[i].first_block); + } + + *size = free_blocks; + + return IMGTOOLERR_SUCCESS; +} + +/* + Extract a file from a concept_image. +*/ +static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtool_image *img = imgtool_partition_image(partition); + concept_image *image = (concept_image *) imgtool_image_extra_bytes(img); + size_t filename_len = strlen(filename); + unsigned char concept_fname[16]; + int catalog_index; + int i; + UINT8 buf[512]; + + if (filename_len > 15) + return IMGTOOLERR_BADFILENAME; + + concept_fname[0] = filename_len; + memcpy(concept_fname+1, filename, filename_len); + + if (get_catalog_entry(image, concept_fname, &catalog_index)) + return IMGTOOLERR_FILENOTFOUND; + + for (i = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[catalog_index].first_block); + i < get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[catalog_index].next_block); + i++) + { + if (read_physical_record(image->file_handle, i, buf)) + return IMGTOOLERR_READERROR; + + if (stream_write(destf, buf, 512) != 512) + return IMGTOOLERR_WRITEERROR; + } + + return (imgtoolerr_t)0; +} + +#if 0 +/* + Add a file to a concept_image. +*/ +static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) +{ + /* ... */ + + return 0; +} + +/* + Delete a file from a concept_image. +*/ +static imgtoolerr_t concept_image_deletefile(imgtool_partition *partition, const char *filename) +{ + /* ... */ + + return 0; +} + +/* + Create a blank concept_image. +*/ +static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool_stream *f, option_resolution *createoptions) +{ + /* ... */ + + return 0; +} +#endif diff --git a/src/mame/tools/imgtool/modules/cybiko.c b/src/mame/tools/imgtool/modules/cybiko.c new file mode 100644 index 00000000000..1fc2afd319b --- /dev/null +++ b/src/mame/tools/imgtool/modules/cybiko.c @@ -0,0 +1,578 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/* + + Cybiko Classic File System + + (c) 2007 Tim Schuerewegen + +*/ + +#include "imgtool.h" + +#include + +struct cybiko_file_system +{ + imgtool_stream *stream; + UINT32 page_count, page_size, block_count_boot, block_count_file; + UINT16 write_count; +}; + +struct cybiko_iter +{ + UINT16 block; +}; + +struct cfs_file +{ + char name[64]; // name of the file + UINT32 date; // date/time of the file (seconds since 1900/01/01) + UINT32 size; // size of the file + UINT32 blocks; // number of blocks occupied by the file +}; + +enum +{ + BLOCK_TYPE_INVALID, + BLOCK_TYPE_BOOT, + BLOCK_TYPE_FILE +}; + +#define MAX_PAGE_SIZE (264 * 2) + +#define INVALID_FILE_ID 0xFFFF + +enum +{ + FLASH_TYPE_INVALID, + FLASH_TYPE_AT45DB041, + FLASH_TYPE_AT45DB081, + FLASH_TYPE_AT45DB161 +}; + +#define BLOCK_USED(x) (x[0] & 0x80) +#define BLOCK_FILE_ID(x) buffer_read_16_be( x + 2) +#define BLOCK_PART_ID(x) buffer_read_16_be( x + 4) +#define BLOCK_FILENAME(x) (char*)(x + 7) + +#define FILE_HEADER_SIZE 0x48 + +// 2208988800 is the number of seconds between 1900/01/01 and 1970/01/01 + +static time_t time_crack( UINT32 cfs_time) +{ + return (time_t)(cfs_time - 2208988800UL); +} + +static UINT32 time_setup( time_t ansi_time) +{ + return (UINT32)(ansi_time + 2208988800UL); +} + +static UINT32 buffer_read_32_be( UINT8 *buffer) +{ + return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | (buffer[3] << 0); +} + +static UINT16 buffer_read_16_be( UINT8 *buffer) +{ + return (buffer[0] << 8) | (buffer[1] << 0); +} + +static void buffer_write_32_be( UINT8 *buffer, UINT32 data) +{ + buffer[0] = (data >> 24) & 0xFF; + buffer[1] = (data >> 16) & 0xFF; + buffer[2] = (data >> 8) & 0xFF; + buffer[3] = (data >> 0) & 0xFF; +} + +static void buffer_write_16_be( UINT8 *buffer, UINT16 data) +{ + buffer[0] = (data >> 8) & 0xFF; + buffer[1] = (data >> 0) & 0xFF; +} + +// page = crc1 (4) + wcnt (2) + crc2 (2) + data (x) + unk (2) + +static UINT32 page_buffer_calc_checksum_1( UINT8 *buffer, UINT32 size, int block_type) +{ + return crc32( 0, buffer + 8, (block_type == BLOCK_TYPE_BOOT) ? 250 : size - 10); +} + +static UINT16 page_buffer_calc_checksum_2( UINT8 *buffer) +{ + UINT16 val = 0xAF17; + val ^= buffer_read_16_be( buffer + 0); + val ^= buffer_read_16_be( buffer + 2); + val ^= buffer_read_16_be( buffer + 4); + return FLIPENDIAN_INT16(val); +} + +static int page_buffer_verify( UINT8 *buffer, UINT32 size, int block_type) +{ + UINT32 checksum_page, checksum_calc; + // checksum 1 + checksum_calc = page_buffer_calc_checksum_1( buffer, size, block_type); + checksum_page = buffer_read_32_be( buffer + 0); + if (checksum_calc != checksum_page) return FALSE; + // checksum 2 + checksum_calc = page_buffer_calc_checksum_2( buffer); + checksum_page = buffer_read_16_be( buffer + 6); + if (checksum_calc != checksum_page) return FALSE; + // ok + return TRUE; +} + +static int cfs_block_to_page( cybiko_file_system *cfs, int block_type, UINT32 block, UINT32 *page) +{ + switch (block_type) + { + case BLOCK_TYPE_BOOT : if (page) *page = block; return TRUE; + case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return TRUE; + default : return FALSE; + } +} + +static int cfs_page_to_block( cybiko_file_system *cfs, UINT32 page, int *block_type, UINT32 *block) +{ + UINT32 tmp = page; + // boot block + if (tmp < cfs->block_count_boot) + { + if (block_type) *block_type = BLOCK_TYPE_BOOT; + if (block) *block = tmp; + return TRUE; + } + tmp -= cfs->block_count_boot; + // file block + if (tmp < cfs->block_count_file) + { + if (block_type) *block_type = BLOCK_TYPE_FILE; + if (block) *block = tmp; + return TRUE; + } + tmp -= cfs->block_count_file; + // error + return FALSE; +} + +static int cfs_page_read( cybiko_file_system *cfs, UINT8 *buffer, UINT32 page) +{ + if (page >= cfs->page_count) return FALSE; + stream_seek( cfs->stream, page * cfs->page_size, SEEK_SET); + stream_read( cfs->stream, buffer, cfs->page_size); + return TRUE; +} + +static int cfs_page_write( cybiko_file_system *cfs, UINT8 *buffer, UINT32 page) +{ + if (page >= cfs->page_count) return FALSE; + stream_seek( cfs->stream, page * cfs->page_size, SEEK_SET); + stream_write( cfs->stream, buffer, cfs->page_size); + return TRUE; +} + +static int cfs_block_read( cybiko_file_system *cfs, UINT8 *buffer, int block_type, UINT32 block) +{ + UINT8 buffer_page[MAX_PAGE_SIZE]; + UINT32 page; + if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE; + if (!cfs_page_read( cfs, buffer_page, page)) return FALSE; + memcpy( buffer, buffer_page + 8, cfs->page_size - 10); + return TRUE; +} + +static int cfs_block_write( cybiko_file_system *cfs, UINT8 *buffer, int block_type, UINT32 block) +{ + UINT8 buffer_page[MAX_PAGE_SIZE]; + UINT32 page; + memcpy( buffer_page + 8, buffer, cfs->page_size - 10); + buffer_write_32_be( buffer_page + 0, page_buffer_calc_checksum_1( buffer_page, cfs->page_size, block_type)); + buffer_write_16_be( buffer_page + 4, cfs->write_count++); + buffer_write_16_be( buffer_page + 6, page_buffer_calc_checksum_2( buffer_page)); + buffer_write_16_be( buffer_page + cfs->page_size - 2, 0xFFFF); + if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE; + if (!cfs_page_write( cfs, buffer_page, page)) return FALSE; + return TRUE; +} + +static int cfs_file_delete( cybiko_file_system *cfs, UINT16 file_id) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id)) + { + buffer[0] &= ~0x80; + if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + } + } + return TRUE; +} + +static int cfs_file_info( cybiko_file_system *cfs, UINT16 file_id, cfs_file *file) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + file->blocks = file->size = 0; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id)) + { + if (BLOCK_PART_ID(buffer) == 0) + { + strcpy( file->name, BLOCK_FILENAME(buffer)); + file->date = buffer_read_32_be( buffer + 6 + FILE_HEADER_SIZE - 4); + } + file->size += buffer[1]; + file->blocks++; + } + } + return (file->blocks > 0) ? TRUE : FALSE; +} + +static int cfs_file_find( cybiko_file_system *cfs, const char *filename, UINT16 *file_id) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + if (BLOCK_USED(buffer) && (strncmp( filename, BLOCK_FILENAME(buffer), 40) == 0)) + { + *file_id = i; + return TRUE; + } + } + return FALSE; +} + +static int cfs_verify( cybiko_file_system *cfs) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i, block_type; + for (i=0;ipage_count;i++) + { + if (!cfs_page_read( cfs, buffer, i)) return FALSE; + if (!cfs_page_to_block( cfs, i, &block_type, NULL)) return FALSE; + if (!page_buffer_verify( buffer, cfs->page_size, block_type)) return FALSE; + } + return TRUE; +} + +static int cfs_init( cybiko_file_system *cfs, imgtool_stream *stream, int flash_type) +{ + cfs->stream = stream; + switch (flash_type) + { + case FLASH_TYPE_AT45DB041 : cfs->page_count = 2048; cfs->page_size = 264; break; + case FLASH_TYPE_AT45DB081 : cfs->page_count = 4096; cfs->page_size = 264; break; + case FLASH_TYPE_AT45DB161 : cfs->page_count = 4096; cfs->page_size = 528; break; + default : return FALSE; + } + cfs->block_count_boot = 5; + cfs->block_count_file = cfs->page_count - cfs->block_count_boot; + cfs->write_count = 0; + return TRUE; +} + +static int cfs_format( cybiko_file_system *cfs) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + // boot blocks + memset( buffer, 0xFF, sizeof( buffer)); + for (i=0;iblock_count_boot;i++) + { + if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return FALSE; + } + // file blocks + memset( buffer, 0xFF, sizeof( buffer)); + buffer[0] &= ~0x80; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + } + // ok + return TRUE; +} + +static UINT16 cfs_calc_free_blocks( cybiko_file_system *cfs) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + UINT16 blocks = 0; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return 0; + if (!BLOCK_USED(buffer)) blocks++; + } + return blocks; +} + +static UINT32 cfs_calc_free_space( cybiko_file_system *cfs, UINT16 blocks) +{ + UINT32 free_space; + free_space = blocks * (cfs->page_size - 0x10); + if (free_space > 0) free_space -= FILE_HEADER_SIZE; + return free_space; +} + +static int flash_size_to_flash_type( size_t size) +{ + switch (size) + { + case 0x084000 : return FLASH_TYPE_AT45DB041; + case 0x108000 : return FLASH_TYPE_AT45DB081; + case 0x210000 : return FLASH_TYPE_AT45DB161; + default : return FLASH_TYPE_INVALID; + } +} + +static int flash_option_to_flash_type( int option) +{ + switch (option) + { + case 0 : return FLASH_TYPE_AT45DB041; + case 1 : return FLASH_TYPE_AT45DB081; + case 2 : return FLASH_TYPE_AT45DB161; + default : return FLASH_TYPE_INVALID; + } +} + +static imgtoolerr_t cybiko_image_open( imgtool_image *image, imgtool_stream *stream) +{ + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + int flash_type; + // init + flash_type = flash_size_to_flash_type( stream_size( stream)); + if (!cfs_init( cfs, stream, flash_type)) return IMGTOOLERR_CORRUPTIMAGE; + // verify + if (!cfs_verify( cfs)) return IMGTOOLERR_CORRUPTIMAGE; + // ok + return IMGTOOLERR_SUCCESS; +} + +static void cybiko_image_close( imgtool_image *image) +{ + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + stream_close( cfs->stream); +} + +static imgtoolerr_t cybiko_image_create( imgtool_image *image, imgtool_stream *stream, option_resolution *opts) +{ + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + int flash_type; + // init + flash_type = flash_option_to_flash_type( option_resolution_lookup_int( opts, 'F')); + if (!cfs_init( cfs, stream, flash_type)) return IMGTOOLERR_CORRUPTIMAGE; + // format + if (!cfs_format( cfs)) return IMGTOOLERR_CORRUPTIMAGE; + // ok + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_begin_enum( imgtool_directory *enumeration, const char *path) +{ + cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration); + iter->block = 0; + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_next_enum( imgtool_directory *enumeration, imgtool_dirent *ent) +{ + imgtool_image *image = imgtool_directory_image( enumeration); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration); + UINT8 buffer[MAX_PAGE_SIZE]; + UINT16 file_id = INVALID_FILE_ID; + cfs_file file; + // find next file + while (iter->block < cfs->block_count_file) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, iter->block++)) return IMGTOOLERR_READERROR; + if (BLOCK_USED(buffer) && (BLOCK_PART_ID(buffer) == 0)) + { + file_id = BLOCK_FILE_ID(buffer); + break; + } + } + // get file information + if ((file_id != INVALID_FILE_ID) && cfs_file_info( cfs, file_id, &file)) + { + strcpy( ent->filename, file.name); + ent->filesize = file.size; + ent->lastmodified_time = time_crack( file.date); + ent->filesize = file.size; + } + else + { + ent->eof = 1; + } + // ok + return IMGTOOLERR_SUCCESS; +} + +static void cybiko_image_close_enum( imgtool_directory *enumeration) +{ + // nothing +} + +static imgtoolerr_t cybiko_image_free_space( imgtool_partition *partition, UINT64 *size) +{ + imgtool_image *image = imgtool_partition_image( partition); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + if (size) *size = cfs_calc_free_space( cfs, cfs_calc_free_blocks( cfs)); + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_read_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtool_image *image = imgtool_partition_image( partition); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + UINT8 buffer[MAX_PAGE_SIZE]; + UINT16 file_id, part_id = 0, old_part_id; + int i; + // find file + if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND; + // read file + do + { + old_part_id = part_id; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR; + if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id) && (BLOCK_PART_ID(buffer) == part_id)) + { + stream_write( destf, buffer + 6 + ((part_id == 0) ? FILE_HEADER_SIZE : 0), buffer[1]); + part_id++; + } + } + } while (old_part_id != part_id); + // ok + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtool_image *image = imgtool_partition_image( partition); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + UINT8 buffer[MAX_PAGE_SIZE]; + UINT16 file_id, part_id = 0, free_blocks; + UINT64 bytes_left; + cfs_file file; + int i; + // find file + if (!cfs_file_find( cfs, filename, &file_id)) file_id = INVALID_FILE_ID; + // check free space + free_blocks = cfs_calc_free_blocks( cfs); + if (file_id != INVALID_FILE_ID) + { + if (!cfs_file_info( cfs, file_id, &file)) return IMGTOOLERR_UNEXPECTED; + free_blocks += file.blocks; + } + if (cfs_calc_free_space( cfs, free_blocks) < stream_size( sourcef)) return IMGTOOLERR_NOSPACE; + // delete file + if (file_id != INVALID_FILE_ID) + { + if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED; + } + // create/write destination file + bytes_left = stream_size( sourcef); + i = 0; + while ((bytes_left > 0) && (i < cfs->block_count_file)) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR; + if (!BLOCK_USED(buffer)) + { + if (part_id == 0) file_id = i; + memset( buffer, 0xFF, cfs->page_size - 0x10); + buffer[0] = 0x80; + buffer[1] = cfs->page_size - 0x10 - ((part_id == 0) ? FILE_HEADER_SIZE : 0); + if (bytes_left < buffer[1]) buffer[1] = bytes_left; + buffer_write_16_be( buffer + 2, file_id); + buffer_write_16_be( buffer + 4, part_id); + if (part_id == 0) + { + buffer[6] = 0; + strcpy( BLOCK_FILENAME(buffer), filename); + buffer_write_32_be( buffer + 6 + FILE_HEADER_SIZE - 4, time_setup( time( NULL))); + stream_read( sourcef, buffer + 6 + FILE_HEADER_SIZE, buffer[1]); + } + else + { + stream_read( sourcef, buffer + 6, buffer[1]); + } + if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_WRITEERROR; + bytes_left -= buffer[1]; + part_id++; + } + i++; + } + // ok + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_delete_file( imgtool_partition *partition, const char *filename) +{ + imgtool_image *image = imgtool_partition_image( partition); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + UINT16 file_id; + // find file + if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND; + // delete file + if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED; + // ok + return IMGTOOLERR_SUCCESS; +} + +static OPTION_GUIDE_START( cybiko_image_createimage_optguide ) + OPTION_ENUM_START( 'F', "flash", "Flash Type" ) + OPTION_ENUM( 0, "AT45DB041", "AT45DB041 (528 KByte)" ) + OPTION_ENUM( 1, "AT45DB081", "AT45DB081 (1056 KByte)" ) + OPTION_ENUM( 2, "AT45DB161", "AT45DB161 (2112 KByte)" ) + OPTION_ENUM_END +OPTION_GUIDE_END + +//OPTION_GUIDE_START( cybiko_image_writefile_optguide ) +// OPTION_INT( 'B', "boot", "Boot Flag" ) +//OPTION_GUIDE_END + +void cybiko_get_info( const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch (state) + { + // --- the following bits of info are returned as 64-bit signed integers --- + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES : info->i = sizeof( cybiko_file_system); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES : info->i = sizeof( cybiko_iter); break; +// case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME : info->i = 1; break; + case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME : info->i = 1; break; +// case IMGTOOLINFO_INT_BLOCK_SIZE : info->i = 264; break; + // --- the following bits of info are returned as pointers to data or functions --- + case IMGTOOLINFO_PTR_OPEN : info->open = cybiko_image_open; break; + case IMGTOOLINFO_PTR_CREATE : info->create = cybiko_image_create; break; + case IMGTOOLINFO_PTR_CLOSE : info->close = cybiko_image_close; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = cybiko_image_begin_enum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = cybiko_image_next_enum; break; + case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = cybiko_image_close_enum; break; + case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = cybiko_image_free_space; break; + case IMGTOOLINFO_PTR_READ_FILE : info->read_file = cybiko_image_read_file; break; + case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = cybiko_image_write_file; break; + case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = cybiko_image_delete_file; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE : info->createimage_optguide = cybiko_image_createimage_optguide; break; +// case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE : info->writefile_optguide = cybiko_image_writefile_optguide; break; + // --- the following bits of info are returned as NULL-terminated strings --- + case IMGTOOLINFO_STR_NAME : strcpy( info->s = imgtool_temp_str(), "cybiko"); break; + case IMGTOOLINFO_STR_DESCRIPTION : strcpy( info->s = imgtool_temp_str(), "Cybiko Classic File System"); break; + case IMGTOOLINFO_STR_FILE : strcpy( info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "bin,nv"); break; + case IMGTOOLINFO_STR_EOLN : strcpy( info->s = imgtool_temp_str(), "\r\n"); break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "F[0]-2"); break; +// case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "B[0]-1"); break; + } +} diff --git a/src/mame/tools/imgtool/modules/cybikoxt.c b/src/mame/tools/imgtool/modules/cybikoxt.c new file mode 100644 index 00000000000..a1908dc9c76 --- /dev/null +++ b/src/mame/tools/imgtool/modules/cybikoxt.c @@ -0,0 +1,539 @@ +// license:BSD-3-Clause +// copyright-holders:Tim Schuerewegen +/* + + Cybiko Xtreme File System + + (c) 2010 Tim Schuerewegen + +*/ + +#include "imgtool.h" + +#include + +struct cybiko_file_system +{ + imgtool_stream *stream; + UINT32 page_count, page_size, block_count_boot, block_count_file; + UINT16 write_count; +}; + +struct cybiko_iter +{ + UINT16 block; +}; + +struct cfs_file +{ + char name[64]; // name of the file + UINT32 date; // date/time of the file (seconds since 1900/01/01) + UINT32 size; // size of the file + UINT32 blocks; // number of blocks occupied by the file +}; + +enum +{ + BLOCK_TYPE_INVALID, + BLOCK_TYPE_BOOT, + BLOCK_TYPE_FILE +}; + +#define MAX_PAGE_SIZE (264 * 2) + +#define INVALID_FILE_ID 0xFFFF + +#define BLOCK_USED(x) (x[0] & 0x80) +#define BLOCK_FILE_ID(x) buffer_read_16_be( x + 2) +#define BLOCK_PART_ID(x) buffer_read_16_be( x + 4) +#define BLOCK_FILENAME(x) (char*)(x + 7) + +#define FILE_HEADER_SIZE 0x48 + +// 2208988800 is the number of seconds between 1900/01/01 and 1970/01/01 + +static time_t time_crack( UINT32 cfs_time) +{ + return (time_t)(cfs_time - 2208988800UL); +} + +static UINT32 time_setup( time_t ansi_time) +{ + return (UINT32)(ansi_time + 2208988800UL); +} + +static UINT32 buffer_read_32_be( UINT8 *buffer) +{ + return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | (buffer[3] << 0); +} + +static UINT16 buffer_read_16_be( UINT8 *buffer) +{ + return (buffer[0] << 8) | (buffer[1] << 0); +} + +static void buffer_write_32_be( UINT8 *buffer, UINT32 data) +{ + buffer[0] = (data >> 24) & 0xFF; + buffer[1] = (data >> 16) & 0xFF; + buffer[2] = (data >> 8) & 0xFF; + buffer[3] = (data >> 0) & 0xFF; +} + +static void buffer_write_16_be( UINT8 *buffer, UINT16 data) +{ + buffer[0] = (data >> 8) & 0xFF; + buffer[1] = (data >> 0) & 0xFF; +} + +// page = crc (2) + data (x) + +static UINT16 page_buffer_calc_checksum( UINT8 *data, UINT32 size) +{ + int i; + UINT32 val = 0; + for (i = 0; i < size; i++) + { + val = (val ^ data[i] ^ i) << 1; + val = val | ((val >> 16) & 0x0001); + } + return val; +} + +static int page_buffer_verify( UINT8 *buffer, UINT32 size, int block_type) +{ + // checksum + if (block_type == BLOCK_TYPE_FILE) + { + UINT32 checksum_page, checksum_calc; + checksum_calc = page_buffer_calc_checksum( buffer + 2, size - 2); + checksum_page = buffer_read_16_be( buffer + 0); + if (checksum_calc != checksum_page) return FALSE; + } + // ok + return TRUE; +} + +static int cfs_block_to_page( cybiko_file_system *cfs, int block_type, UINT32 block, UINT32 *page) +{ + switch (block_type) + { + case BLOCK_TYPE_BOOT : if (page) *page = block; return TRUE; + case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return TRUE; + default : return FALSE; + } +} + +static int cfs_page_to_block( cybiko_file_system *cfs, UINT32 page, int *block_type, UINT32 *block) +{ + UINT32 tmp = page; + // boot block + if (tmp < cfs->block_count_boot) + { + if (block_type) *block_type = BLOCK_TYPE_BOOT; + if (block) *block = tmp; + return TRUE; + } + tmp -= cfs->block_count_boot; + // file block + if (tmp < cfs->block_count_file) + { + if (block_type) *block_type = BLOCK_TYPE_FILE; + if (block) *block = tmp; + return TRUE; + } + tmp -= cfs->block_count_file; + // error + return FALSE; +} + +static int cfs_page_read( cybiko_file_system *cfs, UINT8 *buffer, UINT32 page) +{ + if (page >= cfs->page_count) return FALSE; + stream_seek( cfs->stream, page * cfs->page_size, SEEK_SET); + stream_read( cfs->stream, buffer, cfs->page_size); + return TRUE; +} + +static int cfs_page_write( cybiko_file_system *cfs, UINT8 *buffer, UINT32 page) +{ + if (page >= cfs->page_count) return FALSE; + stream_seek( cfs->stream, page * cfs->page_size, SEEK_SET); + stream_write( cfs->stream, buffer, cfs->page_size); + return TRUE; +} + +static int cfs_block_read( cybiko_file_system *cfs, UINT8 *buffer, int block_type, UINT32 block) +{ + UINT8 buffer_page[MAX_PAGE_SIZE]; + UINT32 page; + if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE; + if (!cfs_page_read( cfs, buffer_page, page)) return FALSE; + memcpy( buffer, buffer_page + 2, cfs->page_size - 2); + return TRUE; +} + +static int cfs_block_write( cybiko_file_system *cfs, UINT8 *buffer, int block_type, UINT32 block) +{ + UINT8 buffer_page[MAX_PAGE_SIZE]; + UINT32 page; + UINT16 checksum; + memcpy( buffer_page + 2, buffer, cfs->page_size - 2); + if (block_type == BLOCK_TYPE_BOOT) + { + checksum = 0xFFFF; + } + else + { + checksum = page_buffer_calc_checksum( buffer_page + 2, cfs->page_size - 2); + } + buffer_write_16_be( buffer_page + 0, checksum); + if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE; + if (!cfs_page_write( cfs, buffer_page, page)) return FALSE; + return TRUE; +} + +static int cfs_file_delete( cybiko_file_system *cfs, UINT16 file_id) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id)) + { + buffer[0] &= ~0x80; + if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + } + } + return TRUE; +} + +static int cfs_file_info( cybiko_file_system *cfs, UINT16 file_id, cfs_file *file) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + file->blocks = file->size = 0; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id)) + { + if (BLOCK_PART_ID(buffer) == 0) + { + strcpy( file->name, BLOCK_FILENAME(buffer)); + file->date = buffer_read_32_be( buffer + 6 + FILE_HEADER_SIZE - 4); + } + file->size += buffer[1]; + file->blocks++; + } + } + return (file->blocks > 0) ? TRUE : FALSE; +} + +static int cfs_file_find( cybiko_file_system *cfs, const char *filename, UINT16 *file_id) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + if (BLOCK_USED(buffer) && (BLOCK_PART_ID(buffer) == 0) && (strcmp( filename, BLOCK_FILENAME(buffer)) == 0)) + { + *file_id = i; + return TRUE; + } + } + return FALSE; +} + +static int cfs_verify( cybiko_file_system *cfs) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i, block_type; + for (i=0;ipage_count;i++) + { + if (!cfs_page_read( cfs, buffer, i)) return FALSE; + if (!cfs_page_to_block( cfs, i, &block_type, NULL)) return FALSE; + if (!page_buffer_verify( buffer, cfs->page_size, block_type)) return FALSE; + } + return TRUE; +} + +static int cfs_init( cybiko_file_system *cfs, imgtool_stream *stream) +{ + cfs->stream = stream; + cfs->page_count = 2005; + cfs->page_size = 258; + cfs->block_count_boot = 5; + cfs->block_count_file = cfs->page_count - cfs->block_count_boot; + cfs->write_count = 0; + return TRUE; +} + +static int cfs_format( cybiko_file_system *cfs) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + // boot blocks + memset( buffer, 0xFF, sizeof( buffer)); + for (i=0;iblock_count_boot;i++) + { + if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return FALSE; + } + // file blocks + memset( buffer, 0xFF, sizeof( buffer)); + buffer[0] &= ~0x80; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; + } + // padding + buffer[0] = 0xFF; + for (i=0;i<0x1B56;i++) + { + stream_write( cfs->stream, buffer, 1); + } + // ok + return TRUE; +} + +static UINT16 cfs_calc_free_blocks( cybiko_file_system *cfs) +{ + UINT8 buffer[MAX_PAGE_SIZE]; + int i; + UINT16 blocks = 0; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return 0; + if (!BLOCK_USED(buffer)) blocks++; + } + return blocks; +} + +static UINT32 cfs_calc_free_space( cybiko_file_system *cfs, UINT16 blocks) +{ + UINT32 free_space; + free_space = blocks * ((cfs->page_size - 2) - 6); + if (free_space > 0) free_space -= FILE_HEADER_SIZE; + return free_space; +} + +static imgtoolerr_t cybiko_image_open( imgtool_image *image, imgtool_stream *stream) +{ + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + // init + if (!cfs_init( cfs, stream)) return IMGTOOLERR_CORRUPTIMAGE; + // verify + if (!cfs_verify( cfs)) return IMGTOOLERR_CORRUPTIMAGE; + // ok + return IMGTOOLERR_SUCCESS; +} + +static void cybiko_image_close( imgtool_image *image) +{ + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + stream_close( cfs->stream); +} + +static imgtoolerr_t cybiko_image_create( imgtool_image *image, imgtool_stream *stream, option_resolution *opts) +{ + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + // init + if (!cfs_init( cfs, stream)) return IMGTOOLERR_CORRUPTIMAGE; + // format + if (!cfs_format( cfs)) return IMGTOOLERR_CORRUPTIMAGE; + // ok + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_begin_enum( imgtool_directory *enumeration, const char *path) +{ + cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration); + iter->block = 0; + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_next_enum( imgtool_directory *enumeration, imgtool_dirent *ent) +{ + imgtool_image *image = imgtool_directory_image( enumeration); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration); + UINT8 buffer[MAX_PAGE_SIZE]; + UINT16 file_id = INVALID_FILE_ID; + cfs_file file; + // find next file + while (iter->block < cfs->block_count_file) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, iter->block++)) return IMGTOOLERR_READERROR; + if (BLOCK_USED(buffer) && (BLOCK_PART_ID(buffer) == 0)) + { + file_id = BLOCK_FILE_ID(buffer); + break; + } + } + // get file information + if ((file_id != INVALID_FILE_ID) && cfs_file_info( cfs, file_id, &file)) + { + strcpy( ent->filename, file.name); + ent->filesize = file.size; + ent->lastmodified_time = time_crack( file.date); + ent->filesize = file.size; + } + else + { + ent->eof = 1; + } + // ok + return IMGTOOLERR_SUCCESS; +} + +static void cybiko_image_close_enum( imgtool_directory *enumeration) +{ + // nothing +} + +static imgtoolerr_t cybiko_image_free_space( imgtool_partition *partition, UINT64 *size) +{ + imgtool_image *image = imgtool_partition_image( partition); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + if (size) *size = cfs_calc_free_space( cfs, cfs_calc_free_blocks( cfs)); + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_read_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtool_image *image = imgtool_partition_image( partition); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + UINT8 buffer[MAX_PAGE_SIZE]; + UINT16 file_id, part_id = 0, old_part_id; + int i; + // check filename + if (strlen( filename) > 58) return IMGTOOLERR_BADFILENAME; + // find file + if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND; + // read file + do + { + old_part_id = part_id; + for (i=0;iblock_count_file;i++) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR; + if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id) && (BLOCK_PART_ID(buffer) == part_id)) + { + stream_write( destf, buffer + 6 + ((part_id == 0) ? FILE_HEADER_SIZE : 0), buffer[1]); + part_id++; + } + } + } while (old_part_id != part_id); + // ok + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtool_image *image = imgtool_partition_image( partition); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + UINT8 buffer[MAX_PAGE_SIZE]; + UINT16 file_id, part_id = 0, free_blocks; + UINT64 bytes_left; + cfs_file file; + int i; + // check filename + if (strlen( filename) > 58) return IMGTOOLERR_BADFILENAME; + // find file + if (!cfs_file_find( cfs, filename, &file_id)) file_id = INVALID_FILE_ID; + // check free space + free_blocks = cfs_calc_free_blocks( cfs); + if (file_id != INVALID_FILE_ID) + { + if (!cfs_file_info( cfs, file_id, &file)) return IMGTOOLERR_UNEXPECTED; + free_blocks += file.blocks; + } + if (cfs_calc_free_space( cfs, free_blocks) < stream_size( sourcef)) return IMGTOOLERR_NOSPACE; + // delete file + if (file_id != INVALID_FILE_ID) + { + if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED; + } + // create/write destination file + bytes_left = stream_size( sourcef); + i = 0; + while (i < cfs->block_count_file) + { + if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR; + if (!BLOCK_USED(buffer)) + { + if (part_id == 0) file_id = i; + memset( buffer, 0xFF, cfs->page_size - 0x02); + buffer[0] = 0x80; + buffer[1] = (cfs->page_size - 2) - 6 - ((part_id == 0) ? FILE_HEADER_SIZE : 0); + if (bytes_left < buffer[1]) buffer[1] = bytes_left; + buffer_write_16_be( buffer + 2, file_id); + buffer_write_16_be( buffer + 4, part_id); + if (part_id == 0) + { + buffer[6] = 0x20; + strcpy( BLOCK_FILENAME(buffer), filename); + buffer_write_32_be( buffer + 6 + FILE_HEADER_SIZE - 4, time_setup( time( NULL))); + stream_read( sourcef, buffer + 6 + FILE_HEADER_SIZE, buffer[1]); + } + else + { + stream_read( sourcef, buffer + 6, buffer[1]); + } + if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_WRITEERROR; + bytes_left -= buffer[1]; + if (bytes_left == 0) break; + part_id++; + } + i++; + } + // ok + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t cybiko_image_delete_file( imgtool_partition *partition, const char *filename) +{ + imgtool_image *image = imgtool_partition_image( partition); + cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); + UINT16 file_id; + // check filename + if (strlen( filename) > 58) return IMGTOOLERR_BADFILENAME; + // find file + if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND; + // delete file + if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED; + // ok + return IMGTOOLERR_SUCCESS; +} + +void cybikoxt_get_info( const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch (state) + { + // --- the following bits of info are returned as 64-bit signed integers --- + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES : info->i = sizeof( cybiko_file_system); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES : info->i = sizeof( cybiko_iter); break; +// case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME : info->i = 1; break; + case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME : info->i = 1; break; +// case IMGTOOLINFO_INT_BLOCK_SIZE : info->i = 264; break; + // --- the following bits of info are returned as pointers to data or functions --- + case IMGTOOLINFO_PTR_OPEN : info->open = cybiko_image_open; break; + case IMGTOOLINFO_PTR_CREATE : info->create = cybiko_image_create; break; + case IMGTOOLINFO_PTR_CLOSE : info->close = cybiko_image_close; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = cybiko_image_begin_enum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = cybiko_image_next_enum; break; + case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = cybiko_image_close_enum; break; + case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = cybiko_image_free_space; break; + case IMGTOOLINFO_PTR_READ_FILE : info->read_file = cybiko_image_read_file; break; + case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = cybiko_image_write_file; break; + case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = cybiko_image_delete_file; break; + // --- the following bits of info are returned as NULL-terminated strings --- + case IMGTOOLINFO_STR_NAME : strcpy( info->s = imgtool_temp_str(), "cybikoxt"); break; + case IMGTOOLINFO_STR_DESCRIPTION : strcpy( info->s = imgtool_temp_str(), "Cybiko Xtreme File System"); break; + case IMGTOOLINFO_STR_FILE : strcpy( info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "bin,nv"); break; + case IMGTOOLINFO_STR_EOLN : strcpy( info->s = imgtool_temp_str(), "\r\n"); break; + } +} diff --git a/src/mame/tools/imgtool/modules/fat.c b/src/mame/tools/imgtool/modules/fat.c new file mode 100644 index 00000000000..4f2fca17c25 --- /dev/null +++ b/src/mame/tools/imgtool/modules/fat.c @@ -0,0 +1,2111 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/**************************************************************************** + + fat.c + + PC FAT disk images + +***************************************************************************** + + Master boot record format: + + Offset Length Description + ------ ------ ----------- + 0 446 Boot machine code + 446 16 Partion #1 info + 462 16 Partion #2 info + 478 16 Partion #3 info + 494 16 Partion #4 info + 510 2 Magic bytes (0x55 0xAA) + + + Partition info format: + + Offset Length Description + ------ ------ ----------- + 0 1 Active byte (0x80=active 0x00=inactive) + 1 1 Starting head + 2 1 Starting sector (bits 5-0) and high bits of starting track (bits 6-5) + 3 1 Low bits of starting track + 4 1 Partition type: + 0x00 Unused + 0x?1 FAT12 (0-15 MB) + 0x?2 XENIX + 0x?4 FAT16 (16-32 MB) + 0x?6 FAT16` (32 MB-2 GB) + 0x?7 HPFS or NTFS + 0x?A Boot Manager + 0x?B FAT32 (512 MB-2 TB) + 0x?C FAT32 (512 MB-2 TB LBA) + 0x1? OS/2 Boot manager/Win95 hidden + 0xC? DR-DOS secured partition + 0xD? Multiuser DOS secured partition + 0xE? SpeedStor extended partition + 5 1 Ending head + 6 1 Ending sector (bits 5-0) and high bits of ending track (bits 6-5) + 7 1 Low bits of ending track + 8 4 Sector index of beginning of partition + 12 4 Total sectors in partition + + + Boot sector format: + + Offset Length Description + ------ ------ ----------- + 0 3 Jump instruction (to skip over header on boot) + 3 8 OEM Name + 11 2 Bytes per sector + 13 1 Sectors per cluster + 14 2 Reserved sector count (including boot sector) + 16 1 Number of FATs (file allocation tables) + 17 2 Number of root directory entries + 19 2 Total sectors (bits 0-15) + 21 1 Media descriptor + 22 2 Sectors per FAT + 24 2 Sectors per track + 26 2 Number of heads + 28 4 Hidden sectors + 32 4 Total sectors (bits 16-47) + 36 1 Physical drive number + 37 1 Current head + 38 1 Signature + 39 4 ID + 43 11 Volume Label + 54 8 FAT file system type + 62 448 Boot machine code + 510 2 Magic bytes (0x55 0xAA) + + For more information: + http://support.microsoft.com/kb/q140418/ + + + Directory Entry Format: + + Offset Length Description + ------ ------ ----------- + 0 8 DOS File Name (padded with spaces) + 8 3 DOS File Extension (padded with spaces) + 11 1 File Attributes + 12 2 Unknown + 14 4 Time of Creation + 18 2 Last Access Time + 20 2 EA-Index (OS/2 stuff) + 22 4 Last Modified Time + 26 2 First Cluster + 28 4 File Size + + + Dates and times are stored in separate words; when together, the time is + first and the date is second. + + Time: + bits 15-11 Hour + bits 10- 5 Minute + bits 4- 0 Second / 2 + + Date: + bits 15- 9 Year - 1980 + bits 8- 5 Month + bits 4- 0 Day + + LFN Entry Format: + + Offset Length Description + ------ ------ ----------- + 0 1 Sequence Number (bit 6 is set on highest sequence) + 1 10 Name characters (five UTF-16LE chars) + 11 1 Attributes (always 0x0F) + 12 1 Reserved (always 0x00) + 13 1 Checksum of short filename entry + 14 12 Name characters (six UTF-16LE chars) + 26 2 Entry Cluster (always 0x00) + 28 4 Name characters (two UTF-16LE chars) + + Valid characters in DOS file names: + - Upper case letters A-Z + - Numbers 0-9 + - Space (though there is no way to identify a trailing space) + - ! # $ % & ( ) - @ ^ _ ` { } ~ + - Characters 128-255 (though the code page is indeterminate) + + For more information: + http://en.wikipedia.org/wiki/File_Allocation_Table + +****************************************************************************/ + +#include +#include +#include "imgtool.h" +#include "formats/imageutl.h" +#include "unicode.h" +#include "fat.h" + +#define FAT_DIRENT_SIZE 32 +#define FAT_SECLEN 512 + +#define LOG(x) + +struct fat_partition_info +{ + UINT32 fat_bits; + UINT32 sectors_per_cluster; + UINT32 cluster_size; + UINT32 reserved_sectors; + UINT32 fat_count; + UINT32 root_entries; + UINT32 sectors_per_fat; + UINT64 total_sectors; + UINT32 total_clusters; +}; + +struct fat_file +{ + unsigned int root : 1; + unsigned int directory : 1; + unsigned int eof : 1; + UINT32 index; + UINT32 filesize; + UINT32 first_cluster; + UINT32 parent_first_cluster; + UINT32 cluster; + UINT32 cluster_index; + UINT32 dirent_sector_index; + UINT32 dirent_sector_offset; +}; + +struct fat_dirent +{ + char long_filename[512]; + char short_filename[13]; + unsigned int directory : 1; + unsigned int eof : 1; + UINT32 filesize; + UINT32 first_cluster; + UINT32 dirent_sector_index; + UINT32 dirent_sector_offset; + time_t creation_time; + time_t lastmodified_time; +}; + +struct fat_freeentry_info +{ + UINT32 required_size; + UINT32 candidate_position; + UINT32 position; +}; + +struct fat_mediatype +{ + UINT8 media_descriptor; + UINT8 heads; + UINT8 tracks; + UINT8 sectors; +}; + +enum creation_policy_t +{ + CREATE_NONE, + CREATE_FILE, + CREATE_DIR +}; + + + +static const fat_mediatype known_media[] = +{ + { 0xF0, 2, 80, 36 }, + { 0xF0, 2, 80, 18 }, + { 0xF9, 2, 80, 9 }, + { 0xF9, 2, 80, 15 }, + { 0xFD, 2, 40, 9 }, + { 0xFF, 2, 40, 8 }, + { 0xFC, 1, 40, 9 }, + { 0xFE, 1, 40, 8 }, + { 0xF8, 0, 0, 0 } +}; + +/* boot sector code taken from FreeDOS */ +static const UINT8 boot_sector_code[] = +{ + 0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xd8, 0xbd, 0x00, 0x7c, 0xb8, 0xe0, 0x1f, + 0x8e, 0xc0, 0x89, 0xee, 0x89, 0xef, 0xb9, 0x00, 0x01, 0xf3, 0xa5, 0xea, + 0x5e, 0x7c, 0xe0, 0x1f, 0x00, 0x00, 0x60, 0x00, 0x8e, 0xd8, 0x8e, 0xd0, + 0x8d, 0x66, 0xa0, 0xfb, 0x80, 0x7e, 0x24, 0xff, 0x75, 0x03, 0x88, 0x56, + 0x24, 0xc7, 0x46, 0xc0, 0x10, 0x00, 0xc7, 0x46, 0xc2, 0x01, 0x00, 0x8b, + 0x76, 0x1c, 0x8b, 0x7e, 0x1e, 0x03, 0x76, 0x0e, 0x83, 0xd7, 0x00, 0x89, + 0x76, 0xd2, 0x89, 0x7e, 0xd4, 0x8a, 0x46, 0x10, 0x98, 0xf7, 0x66, 0x16, + 0x01, 0xc6, 0x11, 0xd7, 0x89, 0x76, 0xd6, 0x89, 0x7e, 0xd8, 0x8b, 0x5e, + 0x0b, 0xb1, 0x05, 0xd3, 0xeb, 0x8b, 0x46, 0x11, 0x31, 0xd2, 0xf7, 0xf3, + 0x89, 0x46, 0xd0, 0x01, 0xc6, 0x83, 0xd7, 0x00, 0x89, 0x76, 0xda, 0x89, + 0x7e, 0xdc, 0x8b, 0x46, 0xd6, 0x8b, 0x56, 0xd8, 0x8b, 0x7e, 0xd0, 0xc4, + 0x5e, 0x5a, 0xe8, 0xac, 0x00, 0xc4, 0x7e, 0x5a, 0xb9, 0x0b, 0x00, 0xbe, + 0xf1, 0x7d, 0x57, 0xf3, 0xa6, 0x5f, 0x26, 0x8b, 0x45, 0x1a, 0x74, 0x0b, + 0x83, 0xc7, 0x20, 0x26, 0x80, 0x3d, 0x00, 0x75, 0xe7, 0x72, 0x68, 0x50, + 0xc4, 0x5e, 0x5a, 0x8b, 0x7e, 0x16, 0x8b, 0x46, 0xd2, 0x8b, 0x56, 0xd4, + 0xe8, 0x7e, 0x00, 0x58, 0x1e, 0x07, 0x8e, 0x5e, 0x5c, 0xbf, 0x00, 0x20, + 0xab, 0x89, 0xc6, 0x01, 0xf6, 0x01, 0xc6, 0xd1, 0xee, 0xad, 0x73, 0x04, + 0xb1, 0x04, 0xd3, 0xe8, 0x80, 0xe4, 0x0f, 0x3d, 0xf8, 0x0f, 0x72, 0xe8, + 0x31, 0xc0, 0xab, 0x0e, 0x1f, 0xc4, 0x5e, 0x5a, 0xbe, 0x00, 0x20, 0xad, + 0x09, 0xc0, 0x75, 0x05, 0x88, 0xd3, 0xff, 0x6e, 0x5a, 0x48, 0x48, 0x8b, + 0x7e, 0x0d, 0x81, 0xe7, 0xff, 0x00, 0xf7, 0xe7, 0x03, 0x46, 0xda, 0x13, + 0x56, 0xdc, 0xe8, 0x34, 0x00, 0xeb, 0xe0, 0x5e, 0xac, 0x56, 0xb4, 0x0e, + 0xcd, 0x10, 0x3c, 0x2e, 0x75, 0xf5, 0xc3, 0xe8, 0xf1, 0xff, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x21, 0x20, 0x48, 0x69, 0x74, 0x20, 0x61, 0x20, 0x6b, + 0x65, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74, + 0x2e, 0x30, 0xe4, 0xcd, 0x13, 0xcd, 0x16, 0xcd, 0x19, 0x56, 0x89, 0x46, + 0xc8, 0x89, 0x56, 0xca, 0x8c, 0x46, 0xc6, 0x89, 0x5e, 0xc4, 0xe8, 0xbe, + 0xff, 0x2e, 0xb4, 0x41, 0xbb, 0xaa, 0x55, 0x8a, 0x56, 0x24, 0x84, 0xd2, + 0x74, 0x19, 0xcd, 0x13, 0x72, 0x15, 0xd1, 0xe9, 0x81, 0xdb, 0x54, 0xaa, + 0x75, 0x0d, 0x8d, 0x76, 0xc0, 0x89, 0x5e, 0xcc, 0x89, 0x5e, 0xce, 0xb4, + 0x42, 0xeb, 0x26, 0x8b, 0x4e, 0xc8, 0x8b, 0x56, 0xca, 0x8a, 0x46, 0x18, + 0xf6, 0x66, 0x1a, 0x91, 0xf7, 0xf1, 0x92, 0xf6, 0x76, 0x18, 0x89, 0xd1, + 0x88, 0xc6, 0x86, 0xe9, 0xd0, 0xc9, 0xd0, 0xc9, 0x08, 0xe1, 0x41, 0xc4, + 0x5e, 0xc4, 0xb8, 0x01, 0x02, 0x8a, 0x56, 0x24, 0xcd, 0x13, 0x0f, 0x82, + 0x75, 0xff, 0x8b, 0x46, 0x0b, 0xf6, 0x76, 0xc0, 0x01, 0x46, 0xc6, 0x83, + 0x46, 0xc8, 0x01, 0x83, 0x56, 0xca, 0x00, 0x4f, 0x75, 0x98, 0x8e, 0x46, + 0xc6, 0x5e, 0xc3, 0x4d, 0x45, 0x54, 0x41, 0x4b, 0x45, 0x52, 0x4e, 0x53, + 0x59, 0x53, 0x00, 0x00, 0x55, 0xaa +}; + +static const char fat8_string[8] = { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' }; +static const char fat12_string[8] = { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' }; +static const char fat16_string[8] = { 'F', 'A', 'T', '1', '6', ' ', ' ', ' ' }; +static const char fat32_string[8] = { 'F', 'A', 'T', '3', '2', ' ', ' ', ' ' }; + + + +static fat_partition_info *fat_get_partition_info(imgtool_partition *partition) +{ + return (fat_partition_info *) imgtool_partition_extra_bytes(partition); +} + + + +static imgtoolerr_t fat_read_sector(imgtool_partition *partition, UINT32 sector_index, + int offset, void *buffer, size_t buffer_len) +{ + //const fat_partition_info *disk_info; + imgtoolerr_t err; + UINT8 data[FAT_SECLEN]; + UINT32 block_size; + size_t len; + + //disk_info = fat_get_partition_info(partition); + + /* sanity check */ + err = imgtool_partition_get_block_size(partition, &block_size); + if (err) + return err; + assert(block_size == sizeof(data)); + + while(buffer_len > 0) + { + err = imgtool_partition_read_block(partition, sector_index++, data); + if (err) + return err; + + len = MIN(buffer_len, sizeof(data) - offset); + memcpy(buffer, data + offset, len); + + buffer = ((UINT8 *) buffer) + len; + buffer_len -= len; + offset = 0; + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_write_sector(imgtool_partition *partition, UINT32 sector_index, + int offset, const void *buffer, size_t buffer_len) +{ + //const fat_partition_info *disk_info; + imgtoolerr_t err; + UINT8 data[FAT_SECLEN]; + const void *write_data; + UINT32 block_size; + size_t len; + + //disk_info = fat_get_partition_info(partition); + + /* sanity check */ + err = imgtool_partition_get_block_size(partition, &block_size); + if (err) + return err; + assert(block_size == sizeof(data)); + + while(buffer_len > 0) + { + len = MIN(buffer_len, sizeof(data) - offset); + + if ((offset != 0) || (buffer_len < sizeof(data))) + { + err = imgtool_partition_read_block(partition, sector_index, data); + if (err) + return err; + memcpy(data + offset, buffer, len); + write_data = data; + } + else + { + write_data = buffer; + } + + err = imgtool_partition_write_block(partition, sector_index++, write_data); + if (err) + return err; + + buffer = ((UINT8 *) buffer) + len; + buffer_len -= len; + offset = 0; + } + return IMGTOOLERR_SUCCESS; +} + + +#ifdef UNUSED_FUNCTION +static imgtoolerr_t fat_clear_sector(imgtool_partition *partition, UINT32 sector_index, UINT8 data) +{ + char buf[FAT_SECLEN]; + memset(buf, data, sizeof(buf)); + return fat_write_sector(partition, sector_index, 0, buf, sizeof(buf)); +} +#endif + + +static imgtoolerr_t fat_partition_open(imgtool_partition *partition, UINT64 first_block, UINT64 block_count) +{ + UINT8 header[FAT_SECLEN]; + imgtoolerr_t err; + fat_partition_info *info; + UINT32 fat_bits, total_sectors_l, total_sectors_h, sector_size; + UINT64 available_sectors; + //int has_extended_bios_param_block = TRUE; + + info = fat_get_partition_info(partition); + + /* read the boot/root sector */ + err = fat_read_sector(partition, 0, 0, header, sizeof(header)); + if (err) + return err; + + /* magic bytes present? */ + if ((header[510] != 0x55) || (header[511] != 0xAA)) + return IMGTOOLERR_CORRUPTIMAGE; + + /* determine which type of FAT is on this disk */ + if (!memcmp(&header[54], fat8_string, sizeof(fat8_string))) + fat_bits = 8; + else if (!memcmp(&header[54], fat12_string, sizeof(fat12_string))) + fat_bits = 12; + else if (!memcmp(&header[54], fat16_string, sizeof(fat16_string))) + fat_bits = 16; + else if (!memcmp(&header[54], fat32_string, sizeof(fat32_string))) + fat_bits = 32; + else + { + fat_bits = 8; + //has_extended_bios_param_block = FALSE; + } + + info->fat_bits = fat_bits; + sector_size = pick_integer_le(header, 11, 2); + info->sectors_per_cluster = pick_integer_le(header, 13, 1); + info->reserved_sectors = pick_integer_le(header, 14, 2); + info->fat_count = pick_integer_le(header, 16, 1); + info->root_entries = pick_integer_le(header, 17, 2); + total_sectors_l = pick_integer_le(header, 19, 2); + info->sectors_per_fat = pick_integer_le(header, 22, 2); + total_sectors_h = pick_integer_le(header, 32, 4); + + if (info->sectors_per_cluster == 0) + return IMGTOOLERR_CORRUPTIMAGE; + + info->total_sectors = total_sectors_l + (((UINT64) total_sectors_h) << 16); + available_sectors = info->total_sectors - info->reserved_sectors + - (info->sectors_per_fat * info->fat_count) + - (info->root_entries * FAT_DIRENT_SIZE + FAT_SECLEN - 1) / FAT_SECLEN; + info->total_clusters = (available_sectors + info->sectors_per_cluster - 1) / info->sectors_per_cluster; + info->cluster_size = FAT_SECLEN * info->sectors_per_cluster; + + if (info->fat_count == 0) + return IMGTOOLERR_CORRUPTIMAGE; + if (sector_size != FAT_SECLEN) + return IMGTOOLERR_CORRUPTIMAGE; + if (info->sectors_per_fat == 0) + return IMGTOOLERR_CORRUPTIMAGE; + if (info->sectors_per_cluster == 0) + return IMGTOOLERR_CORRUPTIMAGE; + if (info->reserved_sectors == 0) + return IMGTOOLERR_CORRUPTIMAGE; + if (info->total_clusters * info->fat_bits > info->sectors_per_fat * FAT_SECLEN * 8) + return IMGTOOLERR_CORRUPTIMAGE; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_partition_create(imgtool_image *image, UINT64 first_block, UINT64 block_count) +{ + imgtoolerr_t err; + UINT32 heads, tracks, sectors_per_track; + UINT32 fat_bits, sectors_per_cluster, reserved_sectors, hidden_sectors; + UINT32 root_dir_count, root_dir_sectors; + UINT32 sectors_per_fat, fat_count, i; + UINT32 boot_sector_offset; + UINT64 total_clusters; + UINT8 media_descriptor; + //const char *title; + const char *fat_bits_string; + UINT8 header[FAT_SECLEN]; +#if 0 + UINT64 first_fat_entries; +#endif + + /* check for limits */ + if (block_count > U64(0xFFFFFFFFFFFF)) + return IMGTOOLERR_PARAMTOOLARGE; + + /* get the geometry */ + err = imgtool_image_get_geometry(image, &tracks, &heads, §ors_per_track); + if (err) + return err; + + /* cap our sector count so that we only use FAT12/16 */ + sectors_per_cluster = (block_count + 65524 - 1) / 65524; + + /* compute the FAT file system type */ + if ((block_count / sectors_per_cluster) <= 4084) + { + fat_bits = 12; + fat_bits_string = fat12_string; + } + else if ((block_count / sectors_per_cluster) <= 65524) + { + fat_bits = 16; + fat_bits_string = fat16_string; + } + else + { + fat_bits = 32; + fat_bits_string = fat32_string; + } + + /* figure out media type */ + i = 0; + while((known_media[i].heads > 0) && ((known_media[i].heads != heads) + || (known_media[i].tracks != tracks) + || (known_media[i].sectors != sectors_per_track))) + { + i++; + } + media_descriptor = known_media[i].media_descriptor; + + /* other miscellaneous settings */ + //title = ""; + fat_count = 2; + root_dir_count = 512; + hidden_sectors = 0; + reserved_sectors = 1; + + /* calculated settings */ + root_dir_sectors = (root_dir_count * FAT_DIRENT_SIZE + FAT_SECLEN - 1) / FAT_SECLEN; + total_clusters = (block_count - reserved_sectors - hidden_sectors - root_dir_sectors) + / sectors_per_cluster; + sectors_per_fat = (total_clusters * fat_bits + (FAT_SECLEN * 8) - 1) + / (FAT_SECLEN * 8); + + /* prepare the header */ + memset(header, 0, sizeof(header)); + memcpy(&header[3], "IMGTOOL ", 8); + place_integer_le(header, 11, 2, FAT_SECLEN); + place_integer_le(header, 13, 1, sectors_per_cluster); + place_integer_le(header, 14, 1, reserved_sectors); + place_integer_le(header, 16, 1, fat_count); + place_integer_le(header, 17, 2, root_dir_count); + place_integer_le(header, 19, 2, (UINT16) (block_count >> 0)); + place_integer_le(header, 21, 1, media_descriptor); + place_integer_le(header, 22, 2, sectors_per_fat); + place_integer_le(header, 24, 2, sectors_per_track); + place_integer_le(header, 26, 2, heads); + place_integer_le(header, 28, 4, hidden_sectors); + place_integer_le(header, 32, 4, (UINT32) (block_count >> 16)); + place_integer_le(header, 36, 1, 0xFF); + place_integer_le(header, 38, 1, 0x28); + place_integer_le(header, 39, 4, imgtool_image_rand(image)); + memcpy(&header[43], " ", 11); + memcpy(&header[54], fat_bits_string, 8); + + /* store boot code */ + boot_sector_offset = sizeof(header) - sizeof(boot_sector_code); + if (boot_sector_offset < 62) + return IMGTOOLERR_UNEXPECTED; /* sanity check */ + if (boot_sector_offset > 510) + return IMGTOOLERR_UNEXPECTED; /* sanity check */ + memcpy(&header[boot_sector_offset], boot_sector_code, sizeof(boot_sector_code)); + + /* specify jump instruction */ + if (boot_sector_offset <= 129) + { + header[0] = 0xEB; /* JMP rel8 */ + header[1] = (UINT8) (boot_sector_offset - 2); /* (offset) */ + header[2] = 0x90; /* NOP */ + } + else + { + header[0] = 0xE9; /* JMP rel16 */ + header[1] = (UINT8) ((boot_sector_offset - 2) >> 0); /* (offset) */ + header[2] = (UINT8) ((boot_sector_offset - 2) >> 8); /* (offset) */ + } + + err = imgtool_image_write_block(image, first_block, header); + if (err) + return err; + + /* clear out file allocation table */ + for (i = reserved_sectors; i < (reserved_sectors + sectors_per_fat * fat_count + root_dir_sectors); i++) + { + err = imgtool_image_clear_block(image, first_block + i, 0); + if (err) + return err; + } + + // FIXME: this causes a corrupt PC floppy image since it doubles the FAT partition header - works without it though +#if 0 + /* set first two FAT entries */ + first_fat_entries = ((UINT64) media_descriptor) | 0xFFFFFF00; + first_fat_entries &= (((UINT64) 1) << fat_bits) - 1; + first_fat_entries |= ((((UINT64) 1) << fat_bits) - 1) << fat_bits; + first_fat_entries = LITTLE_ENDIANIZE_INT64(first_fat_entries); + + for (i = 0; i < fat_count; i++) + { + err = imgtool_image_write_block(image, first_block + 1 + (i * sectors_per_fat), &first_fat_entries); + if (err) + return err; + } +#endif + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_load_fat(imgtool_partition *partition, UINT8 **fat_table) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + const fat_partition_info *disk_info; + UINT8 *table; + UINT32 table_size; + UINT32 pos, len; + UINT32 sector_index; + + disk_info = fat_get_partition_info(partition); + + table_size = disk_info->sectors_per_fat * disk_info->fat_count * FAT_SECLEN; + + /* allocate the table with extra bytes, in case we "overextend" our reads */ + table = (UINT8*)malloc(table_size + sizeof(UINT64)); + if (!table) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + memset(table, 0, table_size + sizeof(UINT64)); + + pos = 0; + sector_index = disk_info->reserved_sectors; + + while(pos < table_size) + { + len = MIN(table_size - pos, FAT_SECLEN); + + err = fat_read_sector(partition, sector_index++, 0, &table[pos], len); + if (err) + goto done; + + pos += FAT_SECLEN; + } + +done: + if (err && table) + { + free(table); + table = NULL; + } + *fat_table = table; + return err; +} + + + +static imgtoolerr_t fat_save_fat(imgtool_partition *partition, const UINT8 *fat_table) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + const fat_partition_info *disk_info; + UINT32 table_size; + UINT32 pos, len; + UINT32 sector_index; + + disk_info = fat_get_partition_info(partition); + + table_size = disk_info->sectors_per_fat * disk_info->fat_count * FAT_SECLEN; + + pos = 0; + sector_index = disk_info->reserved_sectors; + + while(pos < table_size) + { + len = MIN(table_size - pos, FAT_SECLEN); + + err = fat_write_sector(partition, sector_index++, 0, &fat_table[pos], len); + if (err) + goto done; + + pos += FAT_SECLEN; + } + +done: + return err; +} + + + +static UINT32 fat_get_fat_entry(imgtool_partition *partition, const UINT8 *fat_table, UINT32 fat_entry) +{ + const fat_partition_info *disk_info; + UINT64 entry; + UINT32 bit_index, i; + UINT32 last_entry = 0; + UINT32 bit_mask; + + disk_info = fat_get_partition_info(partition); + bit_index = fat_entry * disk_info->fat_bits; + bit_mask = 0xFFFFFFFF >> (32 - disk_info->fat_bits); + + if (fat_entry >= disk_info->total_clusters) + { + assert(0); + return 1; + } + + /* make sure that the cluster is free in all fats */ + for (i = 0; i < disk_info->fat_count; i++) + { + memcpy(&entry, fat_table + (i * FAT_SECLEN + * disk_info->sectors_per_fat) + (bit_index / 8), sizeof(entry)); + + /* we've extracted the bytes; we now need to normalize it */ + entry = LITTLE_ENDIANIZE_INT64(entry); + entry >>= bit_index % 8; + entry &= bit_mask; + + if (i == 0) + last_entry = (UINT32) entry; + else if (last_entry != (UINT32) entry) + return 1; /* if the FATs disagree; mark this as reserved */ + } + + /* normalize special clusters */ + if (last_entry >= (0xFFFFFFF0 & bit_mask)) + { + last_entry |= 0xFFFFFFF0; + if (last_entry >= 0xFFFFFFF8) + last_entry = 0xFFFFFFFF; + } + return last_entry; +} + + + +static void fat_set_fat_entry(imgtool_partition *partition, UINT8 *fat_table, UINT32 fat_entry, UINT32 value) +{ + const fat_partition_info *disk_info; + UINT64 entry; + UINT32 bit_index, i; + + disk_info = fat_get_partition_info(partition); + bit_index = fat_entry * disk_info->fat_bits; + value &= 0xFFFFFFFF >> (32 - disk_info->fat_bits); + + for (i = 0; i < disk_info->fat_count; i++) + { + memcpy(&entry, fat_table + (i * FAT_SECLEN + * disk_info->sectors_per_fat) + (bit_index / 8), sizeof(entry)); + + entry = LITTLE_ENDIANIZE_INT64(entry); + entry &= (~((UINT64) 0xFFFFFFFF >> (32 - disk_info->fat_bits)) << (bit_index % 8)) | ((1 << (bit_index % 8)) - 1); + entry |= ((UINT64) value) << (bit_index % 8); + entry = LITTLE_ENDIANIZE_INT64(entry); + + memcpy(fat_table + (i * FAT_SECLEN + * disk_info->sectors_per_fat) + (bit_index / 8), &entry, sizeof(entry)); + } +} + + + +static void fat_debug_integrity_check(imgtool_partition *partition, const UINT8 *fat_table, const fat_file *file) +{ +#ifdef MAME_DEBUG + /* debug function to test the integrity of a file */ + UINT32 cluster; + const fat_partition_info *disk_info; + + disk_info = fat_get_partition_info(partition); + cluster = file->first_cluster ? file->first_cluster : 0xFFFFFFFF; + + if (!file->root) + { + while(cluster != 0xFFFFFFFF) + { + assert((cluster >= 2) && (cluster < disk_info->total_clusters)); + cluster = fat_get_fat_entry(partition, fat_table, cluster); + } + } +#endif +} + + + +static imgtoolerr_t fat_seek_file(imgtool_partition *partition, fat_file *file, UINT32 pos) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + const fat_partition_info *disk_info; + UINT32 new_cluster; + UINT8 *fat_table = NULL; + + disk_info = fat_get_partition_info(partition); + + /* can't seek past end of file */ + if (!file->directory && (pos > file->filesize)) + pos = file->filesize; + + if (file->first_cluster == 0) + { + /* special case; the root directory */ + file->index = pos; + } + else + { + /* first, we need to check to see if we have to go back to the beginning */ + if (pos < file->index) + { + file->cluster = file->first_cluster; + file->cluster_index = 0; + file->eof = 0; + } + + /* skip ahead clusters */ + while((file->cluster_index + disk_info->cluster_size) <= pos) + { + if (!fat_table) + { + err = fat_load_fat(partition, &fat_table); + if (err) + goto done; + } + + new_cluster = fat_get_fat_entry(partition, fat_table, file->cluster); + + file->cluster = new_cluster; + file->cluster_index += disk_info->cluster_size; + + /* are we at the end of the file? */ + if (new_cluster == 0xFFFFFFFF) + { + pos = file->cluster_index; + file->eof = 1; + } + } + file->index = pos; + } + +done: + if (fat_table) + free(fat_table); + return err; +} + + + +static UINT32 fat_get_filepos_sector_index(imgtool_partition *partition, fat_file *file) +{ + UINT32 sector_index; + const fat_partition_info *disk_info; + + disk_info = fat_get_partition_info(partition); + + sector_index = disk_info->reserved_sectors + (disk_info->sectors_per_fat * disk_info->fat_count); + if (file->root) + { + /* special case for the root file */ + sector_index += file->index / FAT_SECLEN; + } + else + { + /* cluster out of range? */ + if ((file->cluster < 2) || (file->cluster >= disk_info->total_clusters)) + return 0; + + sector_index += (disk_info->root_entries * FAT_DIRENT_SIZE + FAT_SECLEN - 1) / FAT_SECLEN; + sector_index += (file->cluster - 2) * disk_info->sectors_per_cluster; + sector_index += (file->index / FAT_SECLEN) % disk_info->sectors_per_cluster; + } + return sector_index; +} + + + +static imgtoolerr_t fat_corrupt_file_error(const fat_file *file) +{ + imgtoolerr_t err; + if (file->root) + err = IMGTOOLERR_CORRUPTIMAGE; + else if (file->directory) + err = IMGTOOLERR_CORRUPTDIR; + else + err = IMGTOOLERR_CORRUPTFILE; + return err; +} + + + +static imgtoolerr_t fat_readwrite_file(imgtool_partition *partition, fat_file *file, + void *buffer, size_t buffer_len, size_t *bytes_read, int read_or_write) +{ + imgtoolerr_t err; +// const fat_partition_info *disk_info; + UINT32 sector_index; + int offset; + size_t len; + +// disk_info = + fat_get_partition_info(partition); + if (bytes_read) + *bytes_read = 0; + if (!file->directory) + buffer_len = MIN(buffer_len, file->filesize - file->index); + + while(!file->eof && (buffer_len > 0)) + { + sector_index = fat_get_filepos_sector_index(partition, file); + if (sector_index == 0) + return fat_corrupt_file_error(file); + + offset = file->index % FAT_SECLEN; + len = MIN(buffer_len, FAT_SECLEN - offset); + + /* read or write the data from the disk */ + if (read_or_write) + err = fat_write_sector(partition, sector_index, offset, buffer, len); + else + err = fat_read_sector(partition, sector_index, offset, buffer, len); + if (err) + return err; + + /* and move the file pointer ahead */ + err = fat_seek_file(partition, file, file->index + len); + if (err) + return err; + + buffer = ((UINT8 *) buffer) + len; + buffer_len -= len; + if (bytes_read) + *bytes_read += len; + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_read_file(imgtool_partition *partition, fat_file *file, + void *buffer, size_t buffer_len, size_t *bytes_read) +{ + return fat_readwrite_file(partition, file, buffer, buffer_len, bytes_read, 0); +} + + + +static imgtoolerr_t fat_write_file(imgtool_partition *partition, fat_file *file, + const void *buffer, size_t buffer_len, size_t *bytes_read) +{ + return fat_readwrite_file(partition, file, (void *) buffer, buffer_len, bytes_read, 1); +} + + + +static UINT32 fat_allocate_cluster(imgtool_partition *partition, UINT8 *fat_table) +{ + const fat_partition_info *disk_info; + UINT32 i, val; + + disk_info = fat_get_partition_info(partition); + + for (i = 2; i < disk_info->total_clusters; i++) + { + val = fat_get_fat_entry(partition, fat_table, i); + if (val == 0) + { + fat_set_fat_entry(partition, fat_table, i, 1); + return i; + } + } + return 0; +} + + + +/* sets the size of a file; ~0 means 'delete' */ +static imgtoolerr_t fat_set_file_size(imgtool_partition *partition, fat_file *file, + UINT32 new_size) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + const fat_partition_info *disk_info; + UINT32 new_cluster_count; + UINT32 old_cluster_count; + UINT32 cluster, write_cluster, last_cluster, new_pos, i; + UINT8 *fat_table = NULL; + UINT8 dirent[32]; + size_t clear_size; + void *clear_buffer = NULL; + int delete_file = FALSE; + int rest_free = FALSE; + + disk_info = fat_get_partition_info(partition); + + LOG(("fat_set_file_size(): file->first_cluster=%d new_size=0x%08x\n", file->first_cluster, new_size)); + + /* special case */ + if (new_size == ~0) + { + delete_file = TRUE; + new_size = 0; + } + + /* if this is the trivial case (not changing the size), succeed */ + if (!delete_file && (file->filesize == new_size)) + { + err = IMGTOOLERR_SUCCESS; + goto done; + } + + /* what is the new position? */ + new_pos = MIN(file->index, new_size); + + if (file->root) + { + /* this is the root directory; this is a special case */ + if (new_size > (disk_info->root_entries * FAT_DIRENT_SIZE)) + { + err = IMGTOOLERR_NOSPACE; + goto done; + } + } + else + { + old_cluster_count = (file->filesize + disk_info->cluster_size - 1) / disk_info->cluster_size; + new_cluster_count = (new_size + disk_info->cluster_size - 1) / disk_info->cluster_size; + cluster = 0; + + /* load the dirent */ + err = fat_read_sector(partition, file->dirent_sector_index, file->dirent_sector_offset, dirent, sizeof(dirent)); + if (err) + goto done; + + /* need to load the FAT whether we are growing or shrinking the file */ + if (old_cluster_count != new_cluster_count) + { + err = fat_load_fat(partition, &fat_table); + if (err) + goto done; + + cluster = 0; + i = 0; + do + { + last_cluster = cluster; + write_cluster = 0; + + /* identify the next cluster */ + if (cluster != 0) + cluster = fat_get_fat_entry(partition, fat_table, cluster); + else + cluster = file->first_cluster ? file->first_cluster : 0xFFFFFFFF; + + /* do we need to grow the file by a cluster? */ + if (i < new_cluster_count && ((cluster < 2) || (cluster >= disk_info->total_clusters))) + { + /* grow this file by a cluster */ + cluster = fat_allocate_cluster(partition, fat_table); + if (cluster == 0) + { + err = IMGTOOLERR_NOSPACE; + goto done; + } + + write_cluster = cluster; + } + else if (i >= new_cluster_count) + { + /* we are shrinking the file; we need to unlink this node */ + if ((cluster < 2) || (cluster >= disk_info->total_clusters)) + cluster = 0xFFFFFFFF; /* ack file is corrupt! recover */ + write_cluster = 0xFFFFFFFF; + } + + /* write out the entry, if appropriate */ + if (write_cluster != 0) + { + /* are we tieing up loose ends? */ + if (rest_free && (write_cluster == 0xFFFFFFFF)) + write_cluster = 0; + + if (last_cluster == 0) + file->first_cluster = (write_cluster != 0xFFFFFFFF) ? write_cluster : 0; + else + fat_set_fat_entry(partition, fat_table, last_cluster, write_cluster); + + /* did we write the last cluster? if so, the rest (if any) are free */ + if (write_cluster == 0xFFFFFFFF) + rest_free = TRUE; + } + } + while((++i < new_cluster_count) || (cluster != 0xFFFFFFFF)); + } + + /* record the new file size */ + place_integer_le(dirent, 26, 2, file->first_cluster); + place_integer_le(dirent, 28, 4, new_size); + + /* delete the file, if appropriate */ + if (delete_file) + dirent[0] = 0xE5; + + /* save the dirent */ + err = fat_write_sector(partition, file->dirent_sector_index, file->dirent_sector_offset, dirent, sizeof(dirent)); + if (err) + goto done; + + /* if we've modified the FAT, save it out */ + if (fat_table) + { + err = fat_save_fat(partition, fat_table); + if (err) + goto done; + } + + /* update the file structure */ + if (!file->directory) + file->filesize = new_size; + file->cluster = file->first_cluster; + file->index = 0; + file->cluster_index = 0; + file->eof = (new_cluster_count == 0); + } + + /* special case; clear out stale bytes on non-root directories */ + if (file->directory && !delete_file) + { + if (file->root) + clear_size = MIN(file->filesize - new_size, FAT_DIRENT_SIZE); + else + clear_size = (disk_info->cluster_size - (new_size % disk_info->cluster_size)) % disk_info->cluster_size; + + if (clear_size > 0) + { + err = fat_seek_file(partition, file, new_size); + if (err) + goto done; + + clear_buffer = malloc(clear_size); + if (!clear_buffer) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + memset(clear_buffer, '\0', clear_size); + + err = fat_write_file(partition, file, clear_buffer, clear_size, NULL); + if (err) + goto done; + } + } + + /* seek back to original pos */ + err = fat_seek_file(partition, file, new_pos); + if (err) + goto done; + + if (fat_table) + fat_debug_integrity_check(partition, fat_table, file); + +done: + if (fat_table) + free(fat_table); + if (clear_buffer) + free(clear_buffer); + return err; +} + + + +static void prepend_lfn_bytes(utf16_char *lfn_buf, size_t lfn_buflen, size_t *lfn_len, + const UINT8 *entry, int offset, int chars) +{ + UINT16 w; + int i; + size_t move_len; + + move_len = MIN(*lfn_len + 1, lfn_buflen - chars - 1); + memmove(&lfn_buf[chars], &lfn_buf[0], move_len * sizeof(*lfn_buf)); + + for (i = 0; i < chars; i++) + { + /* read the character */ + memcpy(&w, &entry[offset + i * 2], 2); + w = LITTLE_ENDIANIZE_INT16(w); + + /* append to buffer */ + lfn_buf[i] = (w != 0xFFFF) ? w : 0; + } + *lfn_len += chars; +} + + + +static UINT8 fat_calc_filename_checksum(const UINT8 *short_filename) +{ + UINT8 checksum; + int i, j; + + checksum = 0; + for (i = 0; i < 11; i++) + { + j = checksum & 1; + checksum >>= 1; + if (j) + checksum |= 0x80; + checksum += short_filename[i]; + } + return checksum; +} + + + +static void fat_calc_dirent_lfnchecksum(UINT8 *entry, size_t entry_len) +{ + UINT8 checksum; + int i; + + checksum = fat_calc_filename_checksum(entry + entry_len - FAT_DIRENT_SIZE); + + for (i = 0; i < (entry_len / FAT_DIRENT_SIZE - 1); i++) + entry[i * FAT_DIRENT_SIZE + 13] = checksum; +} + + + +static char fat_cannonicalize_sfn_char(char ch) +{ + /* return the display version of this short file name character */ + return tolower(ch); +} + + + +static void fat_cannonicalize_sfn(char *sfn, const UINT8 *sfn_bytes) +{ + /* return the display version of this short file name */ + int i; + + memset(sfn, '\0', 13); + memcpy(sfn, sfn_bytes, 8); + rtrim(sfn); + if (sfn[0] == 0x05) + sfn[0] = (char) 0xE5; + if ((sfn_bytes[8] != ' ') || (sfn_bytes[9] != ' ') || (sfn_bytes[10] != ' ')) + { + strcat(sfn, "."); + memcpy(sfn + strlen(sfn), &sfn_bytes[8], 3); + rtrim(sfn); + } + for (i = 0; sfn[i]; i++) + sfn[i] = fat_cannonicalize_sfn_char(sfn[i]); +} + + + +static time_t fat_crack_time(UINT32 fat_time) +{ + struct tm t; + time_t now; + + time(&now); + t = *localtime(&now); + + t.tm_sec = ((fat_time >> 0) & 0x001F) * 2; + t.tm_min = ((fat_time >> 5) & 0x003F); + t.tm_hour = ((fat_time >> 11) & 0x001F); + t.tm_mday = ((fat_time >> 16) & 0x001F); + t.tm_mon = ((fat_time >> 21) & 0x000F); + t.tm_year = ((fat_time >> 25) & 0x007F) + 1980 - 1900; + + return mktime(&t); +} + + + +static UINT32 fat_setup_time(time_t ansi_time) +{ + struct tm t; + UINT32 result = 0; + + t = *localtime(&ansi_time); + + result |= (((UINT32) (t.tm_sec / 2)) & 0x001F) << 0; + result |= (((UINT32) t.tm_min) & 0x003F) << 5; + result |= (((UINT32) t.tm_hour) & 0x001F) << 11; + result |= (((UINT32) t.tm_mday) & 0x001F) << 16; + result |= (((UINT32) t.tm_mon) & 0x000F) << 21; + result |= (((UINT32) (t.tm_year + 1900 - 1980)) & 0x007F) << 25; + + return result; +} + + + +static imgtoolerr_t fat_read_dirent(imgtool_partition *partition, fat_file *file, + fat_dirent *ent, fat_freeentry_info *freeent) +{ + imgtoolerr_t err; + //const fat_partition_info *disk_info; + UINT8 entry[FAT_DIRENT_SIZE]; + size_t bytes_read; + int i, j; + unicode_char ch; + utf16_char lfn_buf[512]; + size_t lfn_len = 0; + int lfn_lastentry = 0; + UINT8 lfn_checksum = 0; + UINT32 entry_index, entry_sector_index, entry_sector_offset; + + assert(file->directory); + lfn_buf[0] = '\0'; + memset(ent, 0, sizeof(*ent)); + //disk_info = fat_get_partition_info(partition); + + /* The first eight bytes of a FAT directory entry is a blank padded name + * + * The first byte can be special: + * 0x00 - entry is available and no further entry is used + * 0x05 - first character is actually 0xe5 + * 0x2E - dot entry; either '.' or '..' + * 0xE5 - entry has been erased and is available + * + * Byte 11 is the attributes; and 0x0F denotes a LFN entry + */ + do + { + entry_index = file->index; + entry_sector_index = fat_get_filepos_sector_index(partition, file); + entry_sector_offset = file->index % FAT_SECLEN; + + err = fat_read_file(partition, file, entry, sizeof(entry), &bytes_read); + if (err) + return err; + if (bytes_read < sizeof(entry)) + memset(entry, 0, sizeof(entry)); + + if (entry[11] == 0x0F) + { + /* this is an LFN entry */ + if ((lfn_lastentry == 0) + || ((entry[0] & 0x3F) != (lfn_lastentry - 1)) + || (lfn_checksum != entry[13])) + { + lfn_buf[0] = 0; + lfn_len = 0; + lfn_checksum = entry[13]; + } + lfn_lastentry = entry[0] & 0x3F; + prepend_lfn_bytes(lfn_buf, ARRAY_LENGTH(lfn_buf), + &lfn_len, entry, 28, 2); + prepend_lfn_bytes(lfn_buf, ARRAY_LENGTH(lfn_buf), + &lfn_len, entry, 14, 6); + prepend_lfn_bytes(lfn_buf, ARRAY_LENGTH(lfn_buf), + &lfn_len, entry, 1, 5); + } + else if (freeent && (freeent->position == ~0)) + { + /* do a quick check to find out if we found space */ + if ((entry[0] == '\0') || (entry[0] == 0xE5)) + { + if (freeent->candidate_position > entry_index) + freeent->candidate_position = entry_index; + + if ((entry[0] == '\0') || (freeent->candidate_position + freeent->required_size < file->index)) + freeent->position = freeent->candidate_position; + } + else + { + freeent->candidate_position = ~0; + } + } + } + while((entry[0] == 0x2E) || (entry[0] == 0xE5) || (entry[11] == 0x0F)); + + /* no more directory entries? */ + if (entry[0] == '\0') + { + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + + /* pick apart short filename */ + fat_cannonicalize_sfn(ent->short_filename, entry); + + /* and the long filename */ + if (lfn_lastentry == 1) + { + /* only use the LFN if the checksum passes */ + if (lfn_checksum == fat_calc_filename_checksum(entry)) + { + i = 0; + j = 0; + do + { + i += uchar_from_utf16(&ch, &lfn_buf[i], ARRAY_LENGTH(lfn_buf) - i); + j += utf8_from_uchar(&ent->long_filename[j], ARRAY_LENGTH(ent->long_filename) - j, ch); + } + while(ch != 0); + } + } + + /* other attributes */ + ent->filesize = pick_integer_le(entry, 28, 4); + ent->directory = (entry[11] & 0x10) ? 1 : 0; + ent->first_cluster = pick_integer_le(entry, 26, 2); + ent->dirent_sector_index = entry_sector_index; + ent->dirent_sector_offset = entry_sector_offset; + ent->creation_time = fat_crack_time(pick_integer_le(entry, 14, 4)); + ent->lastmodified_time = fat_crack_time(pick_integer_le(entry, 22, 4)); + return IMGTOOLERR_SUCCESS; +} + + + +enum sfn_disposition_t +{ + SFN_SUFFICIENT, /* name fully representable in short file name */ + SFN_DERIVATIVE, /* name not fully representable in short file name, but no need to tildize */ + SFN_MANGLED /* name not representable in short file name; must tildize */ +}; + +static imgtoolerr_t fat_construct_dirent(const char *filename, creation_policy_t create, + UINT8 **entry, size_t *entry_len) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + UINT8 *created_entry = NULL; + UINT8 *new_created_entry; + UINT32 now; + size_t created_entry_len = FAT_DIRENT_SIZE; + size_t created_entry_pos = 0; + unicode_char ch; + char last_short_char = ' '; + char short_char = '\0'; + char cannonical_short_char; + utf16_char buf[UTF16_CHAR_MAX]; + int i, len; + int sfn_pos = 0; + sfn_disposition_t sfn_disposition = SFN_SUFFICIENT; + int sfn_in_extension = 0; + + /* sanity check */ + if (*filename == '\0') + { + err = IMGTOOLERR_BADFILENAME; + goto done; + } + + /* construct intial entry */ + created_entry = (UINT8 *) malloc(FAT_DIRENT_SIZE); + if (!created_entry) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + /* set up the basics for the new dirent */ + memset(created_entry + 0, ' ', 11); + memset(created_entry + 12, '\0', FAT_DIRENT_SIZE - 12); + created_entry[11] = (create == CREATE_DIR) ? 0x10 : 0x00; + + /* set up file dates in the new dirent */ + now = fat_setup_time(time(NULL)); + place_integer_le(created_entry, 14, 4, now); + place_integer_le(created_entry, 18, 2, now); + place_integer_le(created_entry, 22, 4, now); + + while(*filename) + { + filename += uchar_from_utf8(&ch, filename, UTF8_CHAR_MAX); + + /* append to short filename, if possible */ + if ((ch < 32) || (ch > 128)) + short_char = '\0'; + else if (isalnum((char) ch)) + short_char = toupper((char) ch); + else if (strchr(".!#$%^()-@^_`{}~", (char) ch)) + short_char = (char) ch; + else + short_char = '\0'; /* illegal SFN char */ + cannonical_short_char = fat_cannonicalize_sfn_char((char) ch); + if (!short_char || (short_char != cannonical_short_char)) + { + if (toupper(short_char) == toupper(cannonical_short_char)) + sfn_disposition = MAX(sfn_disposition, SFN_DERIVATIVE); + else + sfn_disposition = SFN_MANGLED; + } + + /* append the short filename char */ + if (short_char == '.') + { + /* multiple extensions or trailing spaces? */ + if (sfn_in_extension) + sfn_disposition = SFN_MANGLED; + else if (last_short_char == ' ') + sfn_disposition = MAX(sfn_disposition, SFN_DERIVATIVE); + + sfn_in_extension = 1; + sfn_pos = 8; + created_entry[created_entry_len - FAT_DIRENT_SIZE + 8] = ' '; + created_entry[created_entry_len - FAT_DIRENT_SIZE + 9] = ' '; + created_entry[created_entry_len - FAT_DIRENT_SIZE + 10] = ' '; + } + else if (sfn_pos == (sfn_in_extension ? 11 : 8)) + { + /* ran out of characters for short filename */ + sfn_disposition = SFN_MANGLED; + } + else if (short_char != '\0') + { + created_entry[created_entry_len - FAT_DIRENT_SIZE + sfn_pos++] = short_char; + } + last_short_char = short_char; + + + /* convert to UTF-16 and add a long filename entry */ + len = utf16le_from_uchar(buf, UTF16_CHAR_MAX, ch); + for (i = 0; i < len; i++) + { + switch(created_entry_pos) + { + case 0: + case 32: + /* need to grow */ + new_created_entry = (UINT8 *) malloc(created_entry_len + FAT_DIRENT_SIZE); + if (!new_created_entry) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + /* move existing entries forward */ + memmove(new_created_entry + 32, created_entry, created_entry_len); + + if (created_entry) free(created_entry); + created_entry = new_created_entry; + created_entry_len += 32; + + /* set up this LFN */ + memset(created_entry, '\0', 32); + memset(&created_entry[1], '\xFF', 10); + memset(&created_entry[14], '\xFF', 12); + memset(&created_entry[28], '\xFF', 4); + created_entry[11] = 0x0F; + + /* specify entry index */ + created_entry[0] = (created_entry_len / 32) - 1; + if (created_entry[0] >= 0x40) + { + err = IMGTOOLERR_BADFILENAME; + goto done; + } + created_entry_pos = 1; + break; + + case 11: + created_entry_pos = 14; + break; + + case 26: + created_entry_pos = 28; + break; + } + + memcpy(&created_entry[created_entry_pos], &buf[i], 2); + created_entry_pos += 2; + } + } + + /* trailing spaces? */ + if (short_char == ' ') + sfn_disposition = MAX(sfn_disposition, SFN_DERIVATIVE); + + if (sfn_disposition == SFN_SUFFICIENT) + { + /* the short filename suffices; remove the LFN stuff */ + memcpy(created_entry, created_entry + created_entry_len - FAT_DIRENT_SIZE, FAT_DIRENT_SIZE); + created_entry_len = FAT_DIRENT_SIZE; + free(created_entry); + new_created_entry = (UINT8 *) malloc(created_entry_len); + if (!new_created_entry) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + created_entry = new_created_entry; + } + else + { + /* need to do finishing touches on the LFN */ + created_entry[0] |= 0x40; + + /* if necessary, mangle the name */ + if (sfn_disposition == SFN_MANGLED) + { + i = 6; + while((i > 0) && isspace(created_entry[created_entry_len - FAT_DIRENT_SIZE + i - 1])) + i--; + created_entry[created_entry_len - FAT_DIRENT_SIZE + i + 0] = '~'; + created_entry[created_entry_len - FAT_DIRENT_SIZE + i + 1] = '1'; + } + fat_calc_dirent_lfnchecksum(created_entry, created_entry_len); + } + +done: + if (err && created_entry) + { + free(created_entry); + created_entry = NULL; + } + *entry = created_entry; + *entry_len = created_entry_len; + return err; +} + + + +static void fat_bump_dirent(imgtool_partition *partition, UINT8 *entry, size_t entry_len) +{ + UINT8 *sfn_entry; + int pos, digit_count, i; + UINT32 digit_place, val = 0; + + sfn_entry = &entry[entry_len - FAT_DIRENT_SIZE]; + + digit_place = 1; + for (pos = 7; (pos >= 0) && isdigit((char) sfn_entry[pos]); pos--) + { + val += (sfn_entry[pos] - '0') * digit_place; + digit_place *= 10; + } + val++; + pos++; + + /* count the digits */ + digit_place = 1; + digit_count = 1; + while(val >= digit_place * 10) + { + digit_count++; + digit_place *= 10; + } + + /* give us some more space, if necessary */ + while ((pos > 0) && ((pos + digit_count) > 8)) + pos--; + + /* have we actually ran out of digits */ + if ((pos + digit_count) > 8) + { + /* extreme degenerate case; simply randomize the filename */ + for (i = 0; i < 6; i++) + sfn_entry[i] = 'A' + (imgtool_partition_rand(partition) % 26); + sfn_entry[6] = '~'; + sfn_entry[7] = '0'; + } + else + { + /* write the tilde, if possible */ + if (pos > 0) + sfn_entry[pos - 1] = '~'; + + /* write out the number */ + while(digit_place > 0) + { + sfn_entry[pos++] = (val / digit_place) + '0'; + val %= digit_place; + digit_place /= 10; + } + } + + /* since we changed the short file name, we need to recalc the checksums + * in the LFN entries */ + fat_calc_dirent_lfnchecksum(entry, entry_len); +} + + + +static imgtoolerr_t fat_lookup_path(imgtool_partition *partition, const char *path, + creation_policy_t create, fat_file *file) +{ + imgtoolerr_t err; + const fat_partition_info *disk_info; + fat_dirent ent; + fat_freeentry_info freeent = { 0, }; + const char *next_path_part; + UINT8 *created_entry = NULL; + size_t created_entry_len = 0; + UINT32 entry_sector_index, entry_sector_offset; + UINT32 parent_first_cluster; + int bumped_sfn; + char sfn[13]; + + disk_info = fat_get_partition_info(partition); + + memset(file, 0, sizeof(*file)); + file->root = 1; + file->directory = 1; + file->filesize = disk_info->root_entries * FAT_DIRENT_SIZE; + + while(*path) + { + if (!file->directory) + { + err = IMGTOOLERR_PATHNOTFOUND; + goto done; + } + + next_path_part = path + strlen(path) + 1; + if (create && (*next_path_part == '\0')) + { + /* this is the last entry, and we are creating a file */ + err = fat_construct_dirent(path, create, &created_entry, &created_entry_len); + if (err) + goto done; + + freeent.required_size = created_entry_len; + freeent.candidate_position = ~0; + freeent.position = ~0; + } + + do + { + err = fat_read_dirent(partition, file, &ent, created_entry ? &freeent : NULL); + if (err) + goto done; + + LOG(("fat_lookup_path(): %s/%s: %d\n", ent.short_filename, ent.long_filename, ent.dirent_sector_offset)); + } + while(!ent.eof && core_stricmp(path, ent.short_filename) && core_stricmp(path, ent.long_filename)); + + parent_first_cluster = file->first_cluster; + + if (ent.eof) + { + /* it seems that we have reached the end of this directory */ + if (!created_entry) + { + err = IMGTOOLERR_FILENOTFOUND; + goto done; + } + + if (created_entry_len > FAT_DIRENT_SIZE) + { + /* must ensure uniqueness of the short filename */ + do + { + /* rewind to the beginning of the directory */ + err = fat_seek_file(partition, file, 0); + if (err) + goto done; + + bumped_sfn = FALSE; + fat_cannonicalize_sfn(sfn, &created_entry[created_entry_len - FAT_DIRENT_SIZE]); + + do + { + err = fat_read_dirent(partition, file, &ent, NULL); + if (err) + goto done; + + if (!core_stricmp(sfn, ent.short_filename)) + { + bumped_sfn = TRUE; + fat_bump_dirent(partition, created_entry, created_entry_len); + fat_cannonicalize_sfn(sfn, &created_entry[created_entry_len - FAT_DIRENT_SIZE]); + } + } + while(!ent.eof); + } + while(bumped_sfn); + } + + LOG(("fat_lookup_path(): creating entry; pos=%u length=%u\n", freeent.position, freeent.required_size)); + + err = fat_set_file_size(partition, file, MAX(file->filesize, freeent.position + created_entry_len)); + if (err) + goto done; + + err = fat_seek_file(partition, file, freeent.position); + if (err) + goto done; + + err = fat_write_file(partition, file, created_entry, created_entry_len, NULL); + if (err) + goto done; + + /* we have to do a special seek operation to get the main dirent */ + err = fat_seek_file(partition, file, freeent.position + created_entry_len - FAT_DIRENT_SIZE); + if (err) + goto done; + entry_sector_index = fat_get_filepos_sector_index(partition, file); + entry_sector_offset = file->index % FAT_SECLEN; + + /* build the file struct for the newly created file/directory */ + memset(file, 0, sizeof(*file)); + file->directory = (created_entry[created_entry_len - FAT_DIRENT_SIZE + 11] & 0x10) ? 1 : 0; + file->dirent_sector_index = entry_sector_index; + file->dirent_sector_offset = entry_sector_offset; + } + else + { + /* update the current file */ + memset(file, 0, sizeof(*file)); + file->directory = ent.directory; + file->filesize = ent.filesize; + file->cluster = ent.first_cluster; + file->first_cluster = ent.first_cluster; + file->dirent_sector_index = ent.dirent_sector_index; + file->dirent_sector_offset = ent.dirent_sector_offset; + } + + path = next_path_part; + file->parent_first_cluster = parent_first_cluster; + } + + err = IMGTOOLERR_SUCCESS; + +done: + if (created_entry) + free(created_entry); + return err; +} + + + +static imgtoolerr_t fat_partition_beginenum(imgtool_directory *enumeration, const char *path) +{ + imgtoolerr_t err; + fat_file *file; + + file = (fat_file *) imgtool_directory_extrabytes(enumeration); + + err = fat_lookup_path(imgtool_directory_partition(enumeration), path, CREATE_NONE, file); + if (err) + return err; + if (!file->directory) + return IMGTOOLERR_PATHNOTFOUND; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_partition_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + imgtoolerr_t err; + fat_file *file; + fat_dirent fatent; + + file = (fat_file *) imgtool_directory_extrabytes(enumeration); + err = fat_read_dirent(imgtool_directory_partition(enumeration), file, &fatent, NULL); + if (err) + return err; + + /* copy stuff from the FAT dirent to the Imgtool dirent */ + snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fatent.long_filename[0] + ? fatent.long_filename : fatent.short_filename); + ent->filesize = fatent.filesize; + ent->directory = fatent.directory; + ent->eof = fatent.eof; + ent->creation_time = fatent.creation_time; + ent->lastmodified_time = fatent.lastmodified_time; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_read_bootblock(imgtool_partition *partition, imgtool_stream *stream) +{ + imgtoolerr_t err; + UINT8 block[FAT_SECLEN]; + + err = fat_read_sector(partition, 0, 0, block, sizeof(block)); + if (err) + return err; + + stream_write(stream, block, sizeof(block)); + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_write_bootblock(imgtool_partition *partition, imgtool_stream *stream) +{ + imgtoolerr_t err; + UINT8 block[FAT_SECLEN]; + UINT8 new_block[FAT_SECLEN]; + + if (stream_size(stream) != sizeof(new_block)) + return IMGTOOLERR_UNEXPECTED; + stream_read(stream, new_block, sizeof(new_block)); + + if (new_block[510] != 0x55) + return IMGTOOLERR_UNEXPECTED; + if (new_block[511] != 0xAA) + return IMGTOOLERR_UNEXPECTED; + + /* read current boot sector */ + err = fat_read_sector(partition, 0, 0, block, sizeof(block)); + if (err) + return err; + + /* merge in the new stuff */ + memcpy(&block[ 0], &new_block[ 0], 3); + memcpy(&block[62], &new_block[62], 448); + + /* and write it out */ + err = fat_write_sector(partition, 0, 0, block, sizeof(block)); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_partition_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t err; + fat_file file; + size_t bytes_read; + char buffer[1024]; + + /* special case for bootblock */ + if (filename == FILENAME_BOOTBLOCK) + return fat_read_bootblock(partition, destf); + + err = fat_lookup_path(partition, filename, CREATE_NONE, &file); + if (err) + return err; + + if (file.directory) + return IMGTOOLERR_FILENOTFOUND; + + do + { + err = fat_read_file(partition, &file, buffer, sizeof(buffer), &bytes_read); + if (err) + return err; + + stream_write(destf, buffer, bytes_read); + } + while(bytes_read > 0); + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_partition_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtoolerr_t err; + fat_file file; + UINT32 bytes_left, len; + char buffer[1024]; + + /* special case for bootblock */ + if (filename == FILENAME_BOOTBLOCK) + return fat_write_bootblock(partition, sourcef); + + err = fat_lookup_path(partition, filename, CREATE_FILE, &file); + if (err) + return err; + + if (file.directory) + return IMGTOOLERR_FILENOTFOUND; + + bytes_left = (UINT32) stream_size(sourcef); + + err = fat_set_file_size(partition, &file, bytes_left); + if (err) + return err; + + while(bytes_left > 0) + { + len = MIN(bytes_left, sizeof(buffer)); + stream_read(sourcef, buffer, len); + + err = fat_write_file(partition, &file, buffer, len, NULL); + if (err) + return err; + + bytes_left -= len; + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_partition_delete(imgtool_partition *partition, const char *filename, unsigned int dir) +{ + imgtoolerr_t err; + fat_file file; + fat_dirent ent; + + err = fat_lookup_path(partition, filename, CREATE_NONE, &file); + if (err) + return err; + if (file.directory != dir) + return IMGTOOLERR_FILENOTFOUND; + + if (dir) + { + err = fat_read_dirent(partition, &file, &ent, NULL); + if (err) + return err; + if (!ent.eof) + return IMGTOOLERR_DIRNOTEMPTY; + } + + err = fat_set_file_size(partition, &file, ~0); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_partition_deletefile(imgtool_partition *partition, const char *filename) +{ + return fat_partition_delete(partition, filename, 0); +} + + + +static imgtoolerr_t fat_partition_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtoolerr_t err; + const fat_partition_info *disk_info; + UINT8 *fat_table; + UINT32 i; + + disk_info = fat_get_partition_info(partition); + + err = fat_load_fat(partition, &fat_table); + if (err) + goto done; + + *size = 0; + for (i = 2; i < disk_info->total_clusters; i++) + { + if (fat_get_fat_entry(partition, fat_table, i) == 0) + *size += disk_info->cluster_size; + } + +done: + if (fat_table) + free(fat_table); + return err; +} + + + +static imgtoolerr_t fat_partition_createdir(imgtool_partition *partition, const char *path) +{ + imgtoolerr_t err; + fat_file file; + UINT8 initial_data[64]; + + err = fat_lookup_path(partition, path, CREATE_DIR, &file); + if (err) + return err; + if (!file.directory) + return IMGTOOLERR_FILENOTFOUND; + + err = fat_set_file_size(partition, &file, sizeof(initial_data)); + if (err) + return err; + + /* set up the two directory entries in all directories */ + memset(initial_data, 0, sizeof(initial_data)); + memcpy(&initial_data[0], ". ", 11); + place_integer_le(initial_data, 11, 1, 0x10); + place_integer_le(initial_data, 26, 2, file.first_cluster); + memcpy(&initial_data[32], ". ", 11); + place_integer_le(initial_data, 43, 1, 0x10); + place_integer_le(initial_data, 58, 2, file.parent_first_cluster); + + err = fat_write_file(partition, &file, initial_data, sizeof(initial_data), NULL); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_partition_deletedir(imgtool_partition *partition, const char *path) +{ + return fat_partition_delete(partition, path, 1); +} + + + +void fat_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break; + case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break; + case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: info->i = 1; break; + case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break; + case IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK: info->i = 1; break; + case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '\\'; break; + case IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR: info->i = '/'; break; + case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES: info->i = sizeof(fat_partition_info); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(fat_file); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r\n"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_CREATE_PARTITION: info->create_partition = fat_partition_create; break; + case IMGTOOLINFO_PTR_OPEN_PARTITION: info->open_partition = fat_partition_open; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = fat_partition_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = fat_partition_nextenum; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = fat_partition_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = fat_partition_writefile; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = fat_partition_deletefile; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = fat_partition_freespace; break; + case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = fat_partition_createdir; break; + case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = fat_partition_deletedir; break; + } +} diff --git a/src/mame/tools/imgtool/modules/fat.h b/src/mame/tools/imgtool/modules/fat.h new file mode 100644 index 00000000000..46f741999c3 --- /dev/null +++ b/src/mame/tools/imgtool/modules/fat.h @@ -0,0 +1,3 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +void fat_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); diff --git a/src/mame/tools/imgtool/modules/hp48.c b/src/mame/tools/imgtool/modules/hp48.c new file mode 100644 index 00000000000..e54908c9c1e --- /dev/null +++ b/src/mame/tools/imgtool/modules/hp48.c @@ -0,0 +1,739 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/**************************************************************************** + + hp48.c + + Memory cards for HP48 SX/GX + + Antoine Mine' 2014 + +***************************************************************************** +*/ + +/* + HP memory cards can contain two kinds of objects: + - attached libraries + - backup objects (encapsulating any kind of object) + + Attached libraries appear with a LIB attribute in imgtool's listing, and in + the global "LIBRARY" menu on the HP48. + Backup objects appear with a BAK attribute in imgtool's listing, and + in the relevant "PORTS" menu on the HP48. + + Currently, we only support storing host files into backup objects and + retreiving backup objects into files. + For attached library objects in the memory card, we only show their name, but + cannot retrieve their contents. + + To install a library contained in a host file, copy it with imgtool to + the card; it creates a backup object visible in the "PORTS" menu; + then evalue the object, store it into some port (e.g, 0 STO), + turn off the HP48 and back on; the library should now be attached and + visible in the "LIBRARY" menu. + (The process is similar to installing a library from a file you get + from the serial interface.) +*/ + + +/* + HP memory cards have size from 32 KB to 4096 KB. + However, cards with size greater than 128 KB are seen as multiple ports of + size 128 KB on the HP48 GX. In imgtool, we see them as distinct 128 KB + partitions. + Unfortunately, at the moment, partitions do not seem to be supported in the + command-line tool... + */ + + +/* + Here is the format of backup objects (addresses are in 4-bit nibbles): + + offset field size value + 0 prolog 5 02B62 prolog for overall backup object + 5 size 5 len total size in nibble without prolog + 10 name length 2 nbcar object name, in characters + 12 name 2*nbcar - + 12+2*nbcar name length 2 nbcar same value as name length at 10 + 14+2*nbcar object - - + len-5 prolog 5 02911 prolog for inlined system integer + len - 1 0 + len+1 CRC 4 - CRC from 5 to len + + total length: len+4 + + i.e., the backup object is a container containing the object name + and two objects: the backuped object itself and a system integer + that contains the CRC. + + HP48 host files start with a "HPHP48-X" header (where X can be any + single letter, which denotes a ROM revision and, implicitly, whether + the program is for the S/SX or the G/GX family). + When storing a file to the memory card, we strip the header and + embed the object into a backup object with the correct CRC. + When copying from the memory card to a host file, we extract the object + from the backup container, stripping its CRC, and add the HPHP48-X header. + + */ + + + + + +/***************************************************************************** + Includes +*****************************************************************************/ + +#include "imgtool.h" + + + +/***************************************************************************** + Data structures +*****************************************************************************/ + + +struct hp48_card +{ + imgtool_stream *stream; + int modified; + + /* size, in bytes of card data: from 32 KB to 4 MB */ + int size; + + /* we store each nibble (4-bit) into its own byte, for simpler addressing; + hence, data has 2*size + */ + UINT8* data; + +}; + +struct hp48_partition +{ + /* pointer to the beginning of the partition inside the hp48_card */ + UINT8* data; + + /* size, in bytes (128 KB or less) */ + int size; + +}; + +struct hp48_directory +{ + int pos; +}; + + +#define PROLOG_BACKUP 0x02B62 +#define PROLOG_LIBRARY 0x02B40 +#define PROLOG_SYSINT 0x02911 + +/* memory cards are composed solely of libraries and backup objects */ +#define IS_OBJECT(prolog) ((prolog) == PROLOG_LIBRARY || (prolog) == PROLOG_BACKUP) + +/* host files begin with this prefix (up to the last letter) */ +static const char* hp48_prefix = "HPHP48-R"; + + + +static OPTION_GUIDE_START( hp48_create_optionguide ) + OPTION_INT('S', "size", "Size in KB" ) +OPTION_GUIDE_END + +/* size in KB, 128 KB being the default */ +static const char hp48_create_optionspec[] = "S32/64/[128]/256/512/1024/2048/4096"; + + + +/***************************************************************************** + Utility functions +*****************************************************************************/ + + +/* byes to nibbles */ +static void unpack(UINT8* dst, UINT8* src, int nsize) +{ + int i; + + if ( nsize & 1 ) + { + dst[nsize-1] = src[nsize/2] & 0xf; + } + + for ( i = nsize/2-1; i >= 0; i-- ) + { + dst[2*i+1] = src[i] >> 4; + dst[2*i ] = src[i] & 0xf; + } +} + +/* nibbles to bytes */ +static void pack(UINT8* dst, UINT8* src, int nsize) +{ + int i; + + for ( i = 0 ; i < nsize/2; i++ ) + { + dst[i] = (src[2*i] & 0xf) | (src[2*i+1] << 4); + } + + if ( nsize & 1 ) + { + dst[nsize/2] = src[nsize-1] & 0xf; + } + } + + +static int read20(UINT8* data) +{ + return data[0] | (data[1] << 4) | (data[2] << 8) | (data[3] << 12) | (data[4] << 16); +} + +static int read8(UINT8* data) +{ + return data[0] | (data[1] << 4); +} + +static void readstring(char* dst, UINT8* data, int nb) +{ + int i; + for ( i = 0; i < nb; i++ ) + { + dst[i] = read8( data + 2*i ); + } + dst[nb] = 0; +} + +static void write20(UINT8* data, int v) +{ + data[0] = v & 0xf; + data[1] = (v >> 4) & 0xf; + data[2] = (v >> 8) & 0xf; + data[3] = (v >> 12) & 0xf; + data[4] = (v >> 16) & 0xf; +} + +static void write8(UINT8* data, int v) +{ + data[0] = v & 0xf; + data[1] = (v >> 4) & 0xf; +} + +static void writestring(UINT8* data, const char* str, int nb) +{ + int i; + for ( i = 0; i < nb; i++ ) + { + write8( data + 2*i, str[i] ); + } +} + + +/* go to the end, return its offset */ +static int find_end(hp48_partition* p) +{ + int pos = 0; + while (1) + { + if ( pos + 10 > 2*p->size) break; + + int prolog = read20( p->data + pos ); + if ( !IS_OBJECT( prolog )) break; + + pos += read20( p->data + pos + 5 ) + 5; + } + + if ( pos > 2*p->size ) pos = 2*p->size; + return pos; +} + + +/* find the backup object with the given name, returns its offset or -1 (not found) */ +static int find_file(hp48_partition* p, const char* filename, int *ptotalsize, int* pstart, int* pcontentsize) +{ + UINT8* data = p->data; + int pos = 0; + + /* find file */ + while (1) + { + if ( pos + 10 > 2*p->size) return -1; + + /* get prolog */ + int prolog = read20( data+pos ); + if ( !IS_OBJECT(prolog)) return -1; + + /* get size */ + int totalsize = read20( data+pos+5 ); + if ( totalsize < 14) return -1; + if ( pos + 5 + totalsize > 2*p->size ) return -1; + + if ( prolog == PROLOG_BACKUP ) + { + /* get name */ + int namelen = read8( data + pos + 10 ); + char name[257]; + if ( 9 + 2*namelen > totalsize ) return -1; + readstring( name, data + pos + 12, namelen ); + + /* check name */ + if ( !strcmp( name, filename ) ) + { + /* found! */ + if ( ptotalsize ) *ptotalsize = totalsize; + if ( pstart ) *pstart = pos + 14 + 2*namelen; + if ( pcontentsize ) *pcontentsize = totalsize - (9 + 2*namelen); + return pos; + } + else + { + /* skip */ + pos += totalsize + 5; + } + } + else + { + /* skip */ + pos += totalsize + 5; + } + + } + + // never executed + //return -1; +} + + +/* CRC computing. + This is the same CRC that is computed by the HP48 hardware. + */ +static UINT16 crc(UINT8* data, int len) +{ + UINT16 crc = 0; + int i; + + for ( i = 0; i < len; i++ ) + { + crc = (crc >> 4) ^ (((crc ^ data[i]) & 0xf) * 0x1081); + } + + return crc; +} + + + +/***************************************************************************** + Imgtool functions +*****************************************************************************/ + + +static imgtoolerr_t hp48_open(imgtool_image *img, imgtool_stream *stream) +{ + hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + int size = stream_size( stream ); + + /* check that size is a power of 2 between 32 KB and 4 MG */ + if ( (size < 32 * 1024) || + (size > 4 * 1024 * 1024) || + (size & (size-1)) ) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + + /* store info */ + c->stream = stream; + c->modified = 0; + c->size = size; + c->data = (UINT8*) malloc( 2 * size ); + if ( !c->data ) + { + return IMGTOOLERR_READERROR; + } + + /* fully load image */ + stream_seek( stream, 0, SEEK_SET ); + if ( stream_read( stream, c->data, size ) < size ) + { + return IMGTOOLERR_READERROR; + } + unpack( c->data, c->data, 2 * size ); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t hp48_create(imgtool_image* img, + imgtool_stream *stream, + option_resolution *opts) +{ + hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + int size; + + size = option_resolution_lookup_int(opts, 'S'); + + c->stream = stream; + c->modified = 1; + c->size = size * 1024; + c->data = (UINT8*) malloc( 2 * c->size ); + if ( !c->data ) + { + return IMGTOOLERR_READERROR; + } + + /* zeroing the image seems fine */ + memset( c->data, 0, 2 * c->size ); + + return IMGTOOLERR_SUCCESS; +} + + + +static void hp48_close(imgtool_image *img) +{ + hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + + if ( c->modified ) + { + /* save image */ + pack( c->data, c->data, 2 * c->size ); + stream_seek( c->stream, 0, SEEK_SET ); + stream_write( c->stream, c->data, c->size ); + } + + /* clean up */ + free( c->data ); + stream_close( c->stream ); +} + + + +/* each 128 KB chunk is a distinct partition */ +#define MAX_PORT_SIZE (128*1024) + +void hp48_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); + +static imgtoolerr_t hp48_list_partitions(imgtool_image *img, + imgtool_partition_info *partitions, + size_t len) +{ + hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + + int i; + for ( i = 0; i < len && i * MAX_PORT_SIZE < c->size ; i++ ) + { + /* offset and size in bytes */ + partitions[i].base_block = i * MAX_PORT_SIZE; + partitions[i].block_count = c->size - partitions[i].base_block; + if ( partitions[i].block_count > MAX_PORT_SIZE ) + { + partitions[i].block_count = MAX_PORT_SIZE; + } + + partitions[i].get_info = hp48_partition_get_info; + } + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t hp48_open_partition(imgtool_partition *part, + UINT64 first_block, UINT64 block_count) +{ + imgtool_image* img = imgtool_partition_image( part ); + hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); + + if ( first_block + block_count > c->size ) + return IMGTOOLERR_INVALIDPARTITION; + + /* store partition position */ + p->data = c->data + first_block; + p->size = block_count; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t hp48_beginenum(imgtool_directory *enumeration, + const char *path) +{ + hp48_directory* d = (hp48_directory*) imgtool_directory_extrabytes( enumeration ); + + d->pos = 0; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t hp48_nextenum(imgtool_directory *enumeration, + imgtool_dirent *ent) +{ + imgtool_partition *part = imgtool_directory_partition( enumeration ); + //imgtool_image* img = imgtool_partition_image( part ); + //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); + hp48_directory* d = (hp48_directory*) imgtool_directory_extrabytes( enumeration ); + + UINT8* data = p->data; + int pos = d->pos; + + if ( pos < 0 || pos+12 > 2*p->size ) + { + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + + int prolog = read20( data+pos ); + + if ( IS_OBJECT(prolog) ) + { + pos += 5; + int totalsize = read20( data+pos ); + pos += 5; + + int namelen = read8( data+pos ); + pos += 2; + if ( (pos + 2*namelen > 2*p->size) || + (namelen >= sizeof(ent->filename)) ) + { + ent->eof = 1; + return IMGTOOLERR_CORRUPTFILE; + } + readstring( ent->filename, data+pos, namelen ); + + /* compute size in bytes, removing name, length & CRC fields */ + ent->filesize = ((totalsize - 19 - 2*namelen) + 1) / 2; + + switch (prolog) + { + case PROLOG_LIBRARY: strncpy( ent->attr, "LIB", sizeof(ent->attr) ); break; + case PROLOG_BACKUP: strncpy( ent->attr, "BAK", sizeof(ent->attr) ); break; + default: strncpy( ent->attr, "?", sizeof(ent->attr) ); + } + + d->pos = d->pos + totalsize + 5; + } + else + { + /* 0 or unknown object => end */ + ent->eof = 1; + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t hp48_freespace(imgtool_partition *part, UINT64 *size) +{ + //imgtool_image* img = imgtool_partition_image( part ); + //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); + + *size = p->size - (find_end(p)+1)/2; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t hp48_readfile(imgtool_partition *part, + const char *filename, + const char *fork, + imgtool_stream *destf) +{ + //imgtool_image* img = imgtool_partition_image( part ); + //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); + + /* find entry */ + int totalsize, start, size; + int pos = find_file(p, filename, &totalsize, &start, &size); + if ( pos == -1 ) + { + return IMGTOOLERR_FILENOTFOUND; + } + + /* CRC check */ + UINT16 objcrc = read20( p->data + pos + totalsize ) >> 4; + UINT16 mycrc = crc( p->data + pos + 5, totalsize - 4); + if ( objcrc != mycrc ) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + size -= 10; + + /* save header */ + stream_write( destf, hp48_prefix, 8); + + /* save contents to host file */ + int bytesize = (size + 1) / 2; + UINT8* buf = (UINT8*) malloc( bytesize ); + if (!buf) + { + return IMGTOOLERR_FILENOTFOUND; + } + pack( buf, p->data + start, size ); + stream_write( destf, buf, bytesize ); + free( buf ); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t hp48_deletefile(imgtool_partition *part, + const char *filename) +{ + imgtool_image* img = imgtool_partition_image( part ); + hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); + + /* find entry */ + int totalsize; + int pos = find_file(p, filename, &totalsize, NULL, NULL ); + if ( pos == -1 ) + { + return IMGTOOLERR_FILENOTFOUND; + } + + /* move */ + totalsize += 5; + memmove( p->data+pos, p->data+pos+totalsize, 2*p->size-(pos+totalsize) ); + memset( p->data + 2*p->size-totalsize, 0, totalsize); + c->modified = 1; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t hp48_writefile(imgtool_partition *part, + const char *filename, + const char *fork, + imgtool_stream *sourcef, + option_resolution *opts) +{ + imgtool_image* img = imgtool_partition_image( part ); + hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); + hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); + + /* check header */ + char head[8]; + stream_read( sourcef, head, 8 ); + if ( memcmp( head, hp48_prefix, 7) ) + { + return IMGTOOLERR_READERROR; + } + + /* ensure that the file does not exist */ + /* TODO: resize the existing file instead, to keep it in place? */ + hp48_deletefile( part, filename ); + + /* goto end */ + //UINT8* data = p->data; + int pos = find_end(p); + + int len = strlen( filename ); + if ( len > 255 ) len = 255; + + /* check size */ + int filesize = stream_size( sourcef ) - 8; + if ( pos + 2*filesize + 24 + 2*len > 2 * p->size ) + { + return IMGTOOLERR_NOSPACE; + } + + /* load file */ + UINT8* buf = (UINT8*) malloc( filesize ); + if ( !buf ) return IMGTOOLERR_NOSPACE; + stream_read( sourcef, buf, filesize ); + + /* store backup object */ + int org = pos; + int totalsize = 2*filesize + 19 + 2*len; + write20( p->data+pos, PROLOG_BACKUP ); + pos +=5; + write20( p->data+pos, totalsize ); + pos +=5; + write8( p->data+pos, len ); + pos += 2; + writestring( p->data+pos, filename, len ); + pos += 2*len; + write8( p->data+pos, len ); + pos += 2; + unpack( p->data+pos, buf, 2*filesize ); + pos += 2*filesize; + + /* store crc */ + write20( p->data+pos, PROLOG_SYSINT ); + pos += 5; + p->data[pos] = 0; + write20( p->data+pos, crc(p->data+org+5, totalsize-4) << 4 ); + + free(buf); + + c->modified = 1; + + return IMGTOOLERR_SUCCESS; +} + + + + +/***************************************************************************** + Imgtool module declaration +*****************************************************************************/ + + + +void hp48_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "hp48"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "HP48 SX/GX memory card"); break; + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "crd"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_OPEN_PARTITION: info->open_partition = hp48_open_partition; break; + case IMGTOOLINFO_PTR_CLOSE: info->close = hp48_close; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = hp48_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = hp48_nextenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = hp48_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = hp48_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = hp48_writefile; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = hp48_deletefile; break; + + case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES: info->i = sizeof(hp48_partition); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(hp48_directory); break; + + } +} + +void hp48_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "hp48"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "HP48 SX/GX memory card"); break; + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "crd"); break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), hp48_create_optionspec); break; + + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = hp48_create_optionguide; break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_OPEN: info->open = hp48_open; break; + case IMGTOOLINFO_PTR_CREATE: info->create = hp48_create; break; + case IMGTOOLINFO_PTR_CLOSE: info->close = hp48_close; break; + case IMGTOOLINFO_PTR_LIST_PARTITIONS: info->list_partitions = hp48_list_partitions; break; + + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(hp48_card); break; + } +} diff --git a/src/mame/tools/imgtool/modules/mac.c b/src/mame/tools/imgtool/modules/mac.c new file mode 100644 index 00000000000..53ae4be3ec0 --- /dev/null +++ b/src/mame/tools/imgtool/modules/mac.c @@ -0,0 +1,6418 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/**************************************************************************** + + mac.c + + Handlers for Classic MacOS images (MFS and HFS formats). + + Raphael Nabet, 2003 + + TODO: + * add support for HFS write + +***************************************************************************** + + terminology: + disk block: 512-byte logical block. With sectors of 512 bytes, one logical + block is equivalent to one sector; when the sector size is not 512 + bytes, sectors are split or grouped to make 512-byte disk blocks. + allocation block: The File Manager always allocates logical disk blocks to + a file in groups called allocation blocks; an allocation block is + simply a group of consecutive logical blocks. The size of a volume's + allocation blocks depends on the capacity of the volume; there can be + at most 4094 (MFS) or 65535 (HFS) allocation blocks on a volume. + MFS (Macintosh File System): File system used by the early Macintosh. This + File system does not support folders (you may create folders on a MFS + disk, but such folders are not implemented on File System level but in + the Desktop file, and they are just a hint of how programs should list + files, i.e. you can't have two files with the same name on a volume + even if they are in two different folders), and it is not adequate for + large volumes. + HFS (Hierarchical File System): File system introduced with the HD20 + harddisk, the Macintosh Plus ROMs, and system 3.2 (IIRC). Contrary to + MFS, it supports hierarchical folders. Also, it is suitable for larger + volumes. + HFS+ (HFS Plus): New file system introduced with MacOS 8.1. It has a lot + in common with HFS, but it supports more allocation blocks (up to 4 + billions IIRC), and many extra features, including longer file names + (up to 255 UTF-16 Unicode chars). + tag data: with the GCR encoding, each disk block is associated with a 12 + (3.5" floppies) or 20 (HD20) byte tag record. This tag record contains + information on the block allocation status (whether it is allocated + in a file or free, which file is it belongs to, what offset the block + has in the file). This enables to recover all files whose data blocks + are still on the disk surface even if the disk catalog has been trashed + completely (though most file properties, like the name, type and + logical EOF, are not saved in the tag record and cannot be recovered). + + Organization of an MFS volume: + + Logical Contents Allocation block + block + + 0 - 1: System startup information + 2 - m: Master directory block (MDB) + + allocation block link pointers + m+1 - n: Directory file + n+1 - p-2: Other files and free space 0 - ((p-2)-(n+1))/k + p-1: Alternate MDB + p: Not used + usually, k = 2, m = 3, n = 16, p = 799 (SSDD 3.5" floppy) + with DSDD 3.5" floppy, I assume that p = 1599, but I don't know the other + values + + + Master Directory Block: + + Offset Length Description + ------ ------ ----------- + 0 2 Volume Signature + 2 4 Creation Date + 6 4 Last Modification Date + 10 2 Volume Attributes + 12 2 Number of Files In Root Directory + 14 2 First Block of Volume Bitmap + ... + + Links: + http://developer.apple.com/documentation/mac/Files/Files-99.html + http://developer.apple.com/documentation/mac/Files/Files-100.html + http://developer.apple.com/documentation/mac/Files/Files-101.html + http://developer.apple.com/documentation/mac/Files/Files-102.html + http://developer.apple.com/documentation/mac/Files/Files-103.html + http://developer.apple.com/documentation/mac/Files/Files-104.html + http://developer.apple.com/documentation/mac/Files/Files-105.html + http://developer.apple.com/documentation/mac/Files/Files-106.html + http://developer.apple.com/documentation/mac/Devices/Devices-121.html#MARKER-2-169 + http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html + +*****************************************************************************/ + +#include +#include +#include +#include +#include + +#include "formats/imageutl.h" +#include "imgtool.h" +#include "macutil.h" +#include "iflopimg.h" +#include "formats/ap_dsk35.h" + +/* if 1, check consistency of B-Tree (most of the checks will eventually be + suppressed when the image is opened as read-only and only enabled when + the image is opened as read/write) */ +#define BTREE_CHECKS 1 +/* if 1, check consistency of tag data when we are at risk of corrupting the + disk (file write and allocation) */ +#define TAG_CHECKS 1 +/* if 1, check consistency of tag data when reading files (not recommended + IMHO) */ +#define TAG_EXTRA_CHECKS 0 + +#if 0 +#pragma mark MISCELLANEOUS UTILITIES +#endif + +struct UINT16BE +{ + UINT8 bytes[2]; +}; + +struct UINT24BE +{ + UINT8 bytes[3]; +}; + +struct UINT32BE +{ + UINT8 bytes[4]; +}; + +INLINE UINT16 get_UINT16BE(UINT16BE word) +{ + return (word.bytes[0] << 8) | word.bytes[1]; +} + +INLINE void set_UINT16BE(UINT16BE *word, UINT16 data) +{ + word->bytes[0] = (data >> 8) & 0xff; + word->bytes[1] = data & 0xff; +} + +#if 0 +INLINE UINT32 get_UINT24BE(UINT24BE word) +{ + return (word.bytes[0] << 16) | (word.bytes[1] << 8) | word.bytes[2]; +} + +INLINE void set_UINT24BE(UINT24BE *word, UINT32 data) +{ + word->bytes[0] = (data >> 16) & 0xff; + word->bytes[1] = (data >> 8) & 0xff; + word->bytes[2] = data & 0xff; +} +#endif + +INLINE UINT32 get_UINT32BE(UINT32BE word) +{ + return (word.bytes[0] << 24) | (word.bytes[1] << 16) | (word.bytes[2] << 8) | word.bytes[3]; +} + +INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) +{ + word->bytes[0] = (data >> 24) & 0xff; + word->bytes[1] = (data >> 16) & 0xff; + word->bytes[2] = (data >> 8) & 0xff; + word->bytes[3] = data & 0xff; +} + +/* + Macintosh string: first byte is length +*/ +typedef UINT8 mac_str27[28]; +typedef UINT8 mac_str31[32]; +typedef UINT8 mac_str63[64]; +typedef UINT8 mac_str255[256]; + +/* + Macintosh type/creator code: 4 char value +*/ +typedef UINT32BE mac_type; + +/* + point record, with the y and x coordinates +*/ +struct mac_point +{ + UINT16BE v; /* actually signed */ + UINT16BE h; /* actually signed */ +}; + +/* + rect record, with the corner coordinates +*/ +struct mac_rect +{ + UINT16BE top; /* actually signed */ + UINT16BE left; /* actually signed */ + UINT16BE bottom;/* actually signed */ + UINT16BE right; /* actually signed */ +}; + +/* + FInfo (Finder file info) record +*/ +struct mac_FInfo +{ + mac_type type; /* file type */ + mac_type creator; /* file creator */ + UINT16BE flags; /* Finder flags */ + mac_point location; /* file's location in window */ + /* If set to {0, 0}, and the inited flag is + clear, the Finder will place the item + automatically */ + UINT16BE fldr; /* MFS: window that contains file */ + /* -3: trash */ + /* -2: desktop */ + /* -1: new folder template?????? */ + /* 0: disk window ("root") */ + /* > 0: specific folder, index of FOBJ resource??? */ + /* The FOBJ resource contains some folder info; + the name of the resource is the folder name. */ + /* HFS & HFS+: + System 7: The window in which the file???s icon appears + System 8: reserved (set to 0) */ +}; + +/* + FXInfo (Finder extended file info) record -- not found in MFS +*/ +struct mac_FXInfo +{ + UINT16BE iconID; /* System 7: An ID number for the file???s icon; the + numbers that identify icons are assigned by the + Finder */ + /* System 8: Reserved (set to 0) */ + UINT16BE reserved[3]; /* Reserved (set to 0) */ + UINT8 script; /* System 7: if high-bit is set, the script code + for displaying the file name; ignored otherwise */ + /* System 8: Extended flags MSB(?) */ + UINT8 XFlags; /* Extended flags */ + UINT16BE comment; /* System 7: Comment ID if high-bit is clear */ + /* System 8: Reserved (set to 0) */ + UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the + file onto the desktop, the directory ID of the + folder from which the user moves the file is + saved here) */ +}; + +/* + DInfo (Finder folder info) record -- not found in MFS +*/ +struct mac_DInfo +{ + mac_rect rect; /* Folder's window bounds */ + UINT16BE flags; /* Finder flags, e.g. kIsInvisible, kNameLocked, etc */ + mac_point location; /* Location of the folder in parent window */ + /* If set to {0, 0}, and the initied flag is + clear, the Finder will place the item + automatically */ + UINT16BE view; /* System 7: The manner in which folders are + displayed */ + /* System 8: reserved (set to 0) */ +}; + +/* + DXInfo (Finder extended folder info) record -- not found in MFS +*/ +struct mac_DXInfo +{ + mac_point scroll; /* Scroll position */ + UINT32BE openChain; /* System 7: chain of directory IDs for open folders */ + /* System 8: reserved (set to 0) */ + UINT8 script; /* System 7: if high-bit is set, the script code + for displaying the folder name; ignored otherwise */ + /* System 8: Extended flags MSB(?) */ + UINT8 XFlags; /* Extended flags */ + UINT16BE comment; /* System 7: Comment ID if high-bit is clear */ + /* System 8: Reserved (set to 0) */ + UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the + folder onto the desktop, the directory ID of + the folder from which the user moves it is + saved here) */ +}; + +/* + defines for FInfo & DInfo flags fields +*/ +enum +{ + fif_isOnDesk = 0x0001, /* System 6: set if item is located on desktop (files and folders) */ + /* System 7: Unused (set to 0) */ + fif_color = 0x000E, /* color coding (files and folders) */ + fif_colorReserved = 0x0010, /* System 6: reserved??? */ + /* System 7: Unused (set to 0) */ + fif_requiresSwitchLaunch= 0x0020, /* System 6: ??? */ + /* System 7: Unused (set to 0) */ + fif_isShared = 0x0040, /* Applications files: if set, the */ + /* application can be executed by */ + /* multiple users simultaneously. */ + /* Otherwise, set to 0. */ + fif_hasNoINITs = 0x0080, /* Extensions/Control Panels: if set(?), */ + /* this file contains no INIT */ + /* resource */ + /* Otherwise, set to 0. */ + fif_hasBeenInited = 0x0100, /* System 6: The Finder has recorded information from + the file???s bundle resource into the desktop + database and given the file or folder a + position on the desktop. */ + /* System 7? 8?: Clear if the file contains desktop database */ + /* resources ('BNDL', 'FREF', 'open', 'kind'...) */ + /* that have not been added yet. Set only by the Finder */ + /* Reserved for folders - make sure this bit is cleared for folders */ + + /* bit 0x0200 was at a point (AOCE for system 7.x?) the letter bit for + AOCE, but was reserved before and it is reserved again in recent MacOS + releases. */ + + fif_hasCustomIcon = 0x0400, /* (files and folders) */ + fif_isStationery = 0x0800, /* System 7: (files only) */ + fif_nameLocked = 0x1000, /* (files and folders) */ + fif_hasBundle = 0x2000, /* Files only */ + fif_isInvisible = 0x4000, /* (files and folders) */ + fif_isAlias = 0x8000 /* System 7: (files only) */ +}; + +/* + mac_to_c_strncpy() + + Encode a macintosh string as a C string. The NUL character is escaped, + using the "%00" sequence. To avoid any ambiguity, '%' is escaped with + '%25'. + + dst (O): C string + n (I): length of buffer pointed to by dst + src (I): macintosh string (first byte is length) +*/ +static void mac_to_c_strncpy(char *dst, int n, UINT8 *src) +{ + size_t len = src[0]; + int i, j; + + i = j = 0; + while ((i < len) && (j < n-1)) + { + switch (src[i+1]) + { + case '\0': + if (j >= n-3) + goto exit; + dst[j] = '%'; + dst[j+1] = '0'; + dst[j+2] = '0'; + j += 3; + break; + + case '%': + if (j >= n-3) + goto exit; + dst[j] = '%'; + dst[j+1] = '2'; + dst[j+2] = '5'; + j += 3; + break; + + default: + dst[j] = src[i+1]; + j++; + break; + } + i++; + } + +exit: + if (n > 0) + dst[j] = '\0'; +} + +/* + c_to_mac_strncpy() + + Decode a C string to a macintosh string. The NUL character is escaped, + using the "%00" sequence. To avoid any ambiguity, '%' is escaped with + '%25'. + + dst (O): macintosh string (first byte is length) + src (I): C string + n (I): length of string pointed to by src +*/ +static void c_to_mac_strncpy(mac_str255 dst, const char *src, int n) +{ + size_t len; + int i; + char buf[3]; + + + len = 0; + i = 0; + while ((i < n) && (len < 255)) + { + switch (src[i]) + { + case '%': + if (i >= n-2) + goto exit; + buf[0] = src[i+1]; + buf[1] = src[i+2]; + buf[2] = '\0'; + dst[len+1] = strtoul(buf, NULL, 16); + i += 3; + break; + + default: + dst[len+1] = src[i]; + i++; + break; + } + len++; + } + +exit: + dst[0] = len; +} + +/* + mac_strcmp() + + Compare two macintosh strings + + s1 (I): the string to compare + s2 (I): the comparison string + + Return a zero if s1 and s2 are equal, a negative value if s1 is less than + s2, and a positive value if s1 is greater than s2. +*/ +#ifdef UNUSED_FUNCTION +static int mac_strcmp(const UINT8 *s1, const UINT8 *s2) +{ + size_t common_len; + + common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0]; + + return memcmp(s1+1, s2+1, common_len) || ((int)s1[0] - s2[0]); +} +#endif + +/* + mac_stricmp() + + Compare two macintosh strings in a manner compatible with the macintosh HFS + file system. + + This functions emulates the way HFS (and MFS???) sorts string: this is + equivalent to the RelString macintosh toolbox call with the caseSensitive + parameter as false and the diacSensitive parameter as true. + + s1 (I): the string to compare + s2 (I): the comparison string + + Return a zero if s1 and s2 are equal, a negative value if s1 is less than + s2, and a positive value if s1 is greater than s2. + +Known issues: + Using this function makes sense with the MacRoman encoding, as it means the + computer will regard "DeskTop File", "Desktop File", "Desktop file", etc, + as the same file. (UNIX users will probably regard this as an heresy, but + you must consider that, unlike UNIX, the Macintosh was not designed for + droids, but error-prone human beings that may forget about case.) + + (Also, letters with diatrical signs follow the corresponding letters + without diacritical signs in the HFS catalog file. This does not matter, + though, since the Finder will not display files in the HFS catalog order, + but it will instead sort files according to whatever order is currently + selected in the View menu.) + + However, with other text encodings, the behavior will be completely absurd. + For instance, with the Greek encoding, it will think that the degree symbol + is the same letter (with different case) as the upper-case Psi, so that if + a program asks for a file called "90??" on a greek HFS volume, and there is + a file called "90??" on this volume, file "90??" will be opened. + Results will probably be even weirder with 2-byte scripts like Japanese or + Chinese. Of course, we are not going to fix this issue, since doing so + would break the compatibility with the original Macintosh OS. +*/ + +static int mac_stricmp(const UINT8 *s1, const UINT8 *s2) +{ + static const unsigned char mac_char_sort_table[256] = + { + /* \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + /* \x08 \x09 \x0a \x0b \x0c \x0d \x0e \x0f */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + /* \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + /* \x18 \x19 \x1a \x1b \x1c \x1d \x1e \x1f */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + /* \x20 \x21 \x22 \x23 \x24 \x25 \x26 \x27 */ + 0x20, 0x21, 0x22, 0x27, 0x28, 0x29, 0x2a, 0x2b, + /* \x28 \x29 \x2a \x2b \x2c \x2d \x2e \x2f */ + 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, + /* \x30 \x31 \x32 \x33 \x34 \x35 \x36 \x37 */ + 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, + /* \x38 \x39 \x3a \x3b \x3c \x3d \x3e \x3f */ + 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, + /* \x40 \x41 \x42 \x43 \x44 \x45 \x46 \x47 */ + 0x46, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b, + /* \x48 \x49 \x4a \x4b \x4c \x4d \x4e \x4f */ + 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68, + /* \x50 \x51 \x52 \x53 \x54 \x55 \x56 \x57 */ + 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d, + /* \x58 \x59 \x5a \x5b \x5c \x5d \x5e \x5f */ + 0x7e, 0x7f, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, + /* \x60 \x61 \x62 \x63 \x64 \x65 \x66 \x67 */ + 0x4d, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b, + /* \x68 \x69 \x6a \x6b \x6c \x6d \x6e \x6f */ + 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68, + /* \x70 \x71 \x72 \x73 \x74 \x75 \x76 \x77 */ + 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d, + /* \x78 \x79 \x7a \x7b \x7c \x7d \x7e \x7f */ + 0x7e, 0x7f, 0x81, 0x87, 0x88, 0x89, 0x8a, 0x8b, + /* \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 */ + 0x49, 0x4b, 0x53, 0x56, 0x67, 0x69, 0x78, 0x4e, + /* \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f */ + 0x48, 0x4f, 0x49, 0x4a, 0x4b, 0x53, 0x56, 0x57, + /* \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97 */ + 0x58, 0x59, 0x5e, 0x5f, 0x60, 0x61, 0x67, 0x6d, + /* \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f */ + 0x6e, 0x6f, 0x69, 0x6a, 0x79, 0x7a, 0x7b, 0x78, + /* \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 */ + 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x75, + /* \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf */ + 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x4c, 0x6b, + /* \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 */ + 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, + /* \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf */ + 0xa1, 0xa2, 0xa3, 0x50, 0x70, 0xa4, 0x4c, 0x6b, + /* \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 */ + 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0x25, + /* \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf */ + 0x26, 0xac, 0x20, 0x48, 0x4a, 0x6a, 0x6c, 0x6c, + /* \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 */ + 0xad, 0xae, 0x23, 0x24, 0x2c, 0x2d, 0xaf, 0xb0, + /* \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf */ + 0x80, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + /* \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + /* \xe8 \xe9 \xea \xeb \xec \xed \xee \xef */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + /* \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + /* \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7 + }; + + size_t common_len; + int i; + int c1, c2; + + common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0]; + + for (i=0; i n) + len = n; + dest[0] = len; + memcpy(dest+1, src+1, len); +} +#endif + +/* + disk image reference +*/ +struct mac_l1_imgref +{ + imgtool_image *image; + UINT32 heads; +}; + + + +static imgtoolerr_t mac_find_block(mac_l1_imgref *image, int block, + UINT32 *track, UINT32 *head, UINT32 *sector) +{ + *track = 0; + while(block >= (apple35_sectors_per_track(imgtool_floppy(image->image), *track) * image->heads)) + { + block -= (apple35_sectors_per_track(imgtool_floppy(image->image), (*track)++) * image->heads); + if (*track >= 80) + return IMGTOOLERR_SEEKERROR; + } + + *head = block / apple35_sectors_per_track(imgtool_floppy(image->image), *track); + *sector = block % apple35_sectors_per_track(imgtool_floppy(image->image), *track); + return IMGTOOLERR_SUCCESS; +} + + + +/* + image_read_block() + + Read one 512-byte block of data from a macintosh disk image + + image (I/O): level-1 image reference + block (I): address of block to read + dest (O): buffer where block data should be stored + + Return imgtool error code +*/ +static imgtoolerr_t image_read_block(mac_l1_imgref *image, UINT32 block, void *dest) +{ + imgtoolerr_t err; + floperr_t ferr; + UINT32 track, head, sector; + + err = mac_find_block(image, block, &track, &head, §or); + if (err) + return err; + + ferr = floppy_read_sector(imgtool_floppy(image->image), head, track, sector, 0, dest, 512); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + +/* + image_write_block() + + Read one 512-byte block of data from a macintosh disk image + + image (I/O): level-1 image reference + block (I): address of block to write + src (I): buffer with the block data + + Return imgtool error code +*/ +static imgtoolerr_t image_write_block(mac_l1_imgref *image, UINT32 block, const void *src) +{ + imgtoolerr_t err; + floperr_t ferr; + UINT32 track, head, sector; + + err = mac_find_block(image, block, &track, &head, §or); + if (err) + return err; + + ferr = floppy_write_sector(imgtool_floppy(image->image), head, track, sector, 0, src, 512, 0); /* TODO: pass ddam argument from imgtool */ + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + +/* + image_get_tag_len() + + Get length of tag data (12 for GCR floppies, 20 for HD20, 0 otherwise) + + image (I/O): level-1 image reference + + Return tag length +*/ +INLINE int image_get_tag_len(mac_l1_imgref *image) +{ + return 0; +} + + + +/* + image_read_tag() + + Read a 12- or 20-byte tag record associated with a disk block + + image (I/O): level-1 image reference + block (I): address of block to read + dest (O): buffer where tag data should be stored + + Return imgtool error code +*/ +static imgtoolerr_t image_read_tag(mac_l1_imgref *image, UINT32 block, void *dest) +{ + return IMGTOOLERR_UNEXPECTED; +} + +/* + image_write_tag() + + Write a 12- or 20-byte tag record associated with a disk block + + image (I/O): level-1 image reference + block (I): address of block to write + src (I): buffer with the tag data + + Return imgtool error code +*/ +static imgtoolerr_t image_write_tag(mac_l1_imgref *image, UINT32 block, const void *src) +{ + return IMGTOOLERR_UNEXPECTED; +} + +#if 0 +#pragma mark - +#pragma mark MFS/HFS WRAPPERS +#endif + +enum mac_format +{ + L2I_MFS, + L2I_HFS +}; + +enum mac_forkID { data_fork = 0x00, rsrc_fork = 0xff }; + +/* + MFS image ref +*/ +struct mfs_l2_imgref +{ + UINT16 dir_num_files; + UINT16 dir_start; + UINT16 dir_blk_len; + + UINT16 ABStart; + + mac_str27 volname; + + unsigned char ABlink_dirty[13]; /* dirty flag for each disk block in the ABlink array */ + UINT8 ABlink[6141]; +}; + +/* + HFS extent descriptor +*/ +struct hfs_extent +{ + UINT16BE stABN; /* first allocation block */ + UINT16BE numABlks; /* number of allocation blocks */ +}; + +/* + HFS likes to group extents by 3 (it is 8 with HFS+), so we create a + specific type. +*/ +typedef hfs_extent hfs_extent_3[3]; + +/* + MFS open file ref +*/ +struct mfs_fileref +{ + UINT16 stBlk; /* first allocation block of file */ +}; + +/* + HFS open file ref +*/ +struct hfs_fileref +{ + hfs_extent_3 extents; /* first 3 file extents */ + + UINT32 parID; /* CNID of parent directory (undefined for extent & catalog files) */ + mac_str31 filename; /* file name (undefined for extent & catalog files) */ +}; + +struct mac_l2_imgref; + +/* + MFS/HFS open file ref +*/ +struct mac_fileref +{ + struct mac_l2_imgref *l2_img; /* image pointer */ + + UINT32 fileID; /* file ID (a.k.a. CNID in HFS/HFS+) */ + + mac_forkID forkType; /* 0x00 for data, 0xff for resource */ + + UINT32 eof; /* logical end-of-file */ + UINT32 pLen; /* physical end-of-file */ + + UINT32 crPs; /* current position in file */ + + UINT8 reload_buf; + UINT8 block_buffer[512]; /* buffer with current file block */ + + union + { + mfs_fileref mfs; + hfs_fileref hfs; + }; +}; + +/* + open BT ref +*/ +struct mac_BTref +{ + struct mac_fileref fileref; /* open B-tree file ref */ + + UINT16 nodeSize; /* size of a node, in bytes */ + UINT32 rootNode; /* node number of root node */ + UINT32 firstLeafNode; /* node number of first leaf node */ + UINT32 attributes; /* persistent attributes about the tree */ + UINT16 treeDepth; /* maximum height (usually leaf nodes) */ + UINT16 maxKeyLength; /* maximum key length */ + + /* function to compare keys during tree searches */ + int (*key_compare_func)(const void *key1, const void *key2); + + void *node_buf; /* current node buffer */ +}; + +/* + Constants for BTHeaderRec attributes field +*/ +enum +{ + btha_badCloseMask = 0x00000001, /* reserved */ + btha_bigKeysMask = 0x00000002, /* key length field is 16 bits */ + btha_variableIndexKeysMask = 0x00000004 /* keys in index nodes are variable length */ +}; + +/* + HFS image ref +*/ +struct hfs_l2_imgref +{ + UINT16 VBM_start; + + UINT16 ABStart; + + mac_str27 volname; + + mac_BTref extents_BT; + mac_BTref cat_BT; + + UINT8 VBM[8192]; +}; + +/* + MFS/HFS image ref +*/ +struct mac_l2_imgref +{ + mac_l1_imgref l1_img; + + UINT16 numABs; + UINT16 blocksperAB; + + UINT16 freeABs; + + UINT32 nxtCNID; /* nxtFNum in MFS, nxtCNID in HFS */ + + mac_format format; + union + { + mfs_l2_imgref mfs; + hfs_l2_imgref hfs; + } u; +}; + +/* + MFS Master Directory Block +*/ +struct mfs_mdb +{ + UINT8 sigWord[2]; /* volume signature - always $D2D7 */ + UINT32BE crDate; /* date and time of volume creation */ + UINT32BE lsMod/*lsBkUp???*/;/* date and time of last modification (backup???) */ + UINT16BE atrb; /* volume attributes (0x0000) */ + /* bit 15 is set if volume is locked by software */ + UINT16BE nmFls; /* number of files in directory */ + UINT16BE dirSt; /* first block of directory */ + + UINT16BE blLn; /* length of directory in blocks (0x000C) */ + UINT16BE nmAlBlks; /* number of allocation blocks in volume (0x0187) */ + UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks (0x00000400) */ + UINT32BE clpSiz; /* default clump size - number of bytes to allocate + when a file grows (0x00002000) */ + UINT16BE alBlSt; /* first allocation block in volume (0x0010) */ + + UINT32BE nxtFNum; /* next unused file number */ + UINT16BE freeABs; /* number of unused allocation blocks */ + + mac_str27 VN; /* volume name */ + + UINT8 ABlink[512-64];/* Link array for file ABs. Array of nmAlBlks + 12-bit-long entries, indexed by AB address. If an + AB belongs to no file, the entry is 0; if an AB is + the last in any file, the entry is 1; if an AB + belongs to a file and is not the last one, the + entry is the AB address of the next file AB plus 1. + Note that the array extends on as many consecutive + disk blocks as needed (usually the MDB block plus + the next one). Incidentally, this array is not + saved in the secondary MDB: presumably, the idea + was that the disk utility could rely on the tag + data to rebuild the link array if it should ever + be corrupted. */ +}; + +/* + HFS Master Directory Block +*/ +struct hfs_mdb +{ +/* First fields are similar to MFS, though several fields have a different meaning */ + UINT8 sigWord[2]; /* volume signature - always $D2D7 */ + UINT32BE crDate; /* date and time of volume creation */ + UINT32BE lsMod; /* date and time of last modification */ + UINT16BE atrb; /* volume attributes (0x0000) */ + /* bit 15 is set if volume is locked by software */ + UINT16BE nmFls; /* number of files in root folder */ + UINT16BE VBMSt; /* first block of volume bitmap */ + UINT16BE allocPtr; /* start of next allocation search */ + + UINT16BE nmAlBlks; /* number of allocation blocks in volume */ + UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks */ + UINT32BE clpSiz; /* default clump size - number of bytes to allocate + when a file grows */ + UINT16BE alBlSt; /* first allocation block in volume (0x0010) */ + UINT32BE nxtCNID; /* next unused catalog node ID */ + UINT16BE freeABs; /* number of unused allocation blocks */ + mac_str27 VN; /* volume name */ + +/* next fields are HFS-specific */ + + UINT32BE volBkUp; /* date and time of last backup */ + UINT16BE vSeqNum; /* volume backup sequence number */ + UINT32BE wrCnt; /* volume write count */ + UINT32BE xtClpSiz; /* clump size for extents overflow file */ + UINT32BE ctClpSiz; /* clump size for catalog file */ + UINT16BE nmRtDirs; /* number of directories in root folder */ + UINT32BE filCnt; /* number of files in volume */ + UINT32BE dirCnt; /* number of directories in volume */ + UINT8 fndrInfo[32]; /* information used by the Finder */ + + union + { + struct + { + UINT16BE VCSize; /* size (in blocks) of volume cache */ + UINT16BE VBMCSize; /* size (in blocks) of volume bitmap cache */ + UINT16BE ctlCSize; /* size (in blocks) of common volume cache */ + }; + struct + { + UINT16BE embedSigWord; /* embedded volume signature */ + hfs_extent embedExtent; /* embedded volume location and size */ + } v2; + } u; + + UINT32BE xtFlSize; /* size (in bytes) of extents overflow file */ + hfs_extent_3 xtExtRec; /* extent record for extents overflow file */ + UINT32BE ctFlSize; /* size (in bytes) of catalog file */ + hfs_extent_3 ctExtRec; /* extent record for catalog file */ +}; + +/* to save a little stack space, we use the same buffer for MDB and next blocks */ +union img_open_buf +{ + struct mfs_mdb mfs_mdb; + struct hfs_mdb hfs_mdb; + UINT8 raw[512]; +}; + +/* + Information extracted from catalog/directory +*/ +struct mac_dirent +{ + UINT16 dataRecType; /* type of data record */ + + mac_FInfo flFinderInfo; /* information used by the Finder */ + mac_FXInfo flXFinderInfo; /* information used by the Finder */ + + UINT8 flags; /* bit 0=1 if file locked */ + + UINT32 fileID; /* file ID in directory/catalog */ + + UINT32 dataLogicalSize; /* logical EOF of data fork */ + UINT32 dataPhysicalSize; /* physical EOF of data fork */ + UINT32 rsrcLogicalSize; /* logical EOF of resource fork */ + UINT32 rsrcPhysicalSize; /* physical EOF of resource fork */ + + UINT32 createDate; /* date and time of creation */ + UINT32 modifyDate; /* date and time of last modification */ +}; + +/* + Tag record for GCR floppies (12 bytes) + + And, no, I don't know the format of the 20-byte tag record of the HD20 +*/ +struct floppy_tag_record +{ + UINT32BE fileID; /* a.k.a. CNID */ + /* a value of 1 seems to be the default for non-AB blocks, but this is not consistent */ + UINT8 ftype; /* bit 1 = 1 if resource fork */ + /* bit 0 = 1 if block is allocated to user file (i.e. it is not + in HFS extent & catalog, and not in non-AB blocks such + as MDB and MFS directory)??? */ + /* bit 7 seems to be used, but I don't know what it means */ + /* a value of $FF seems to be the default for non-AB blocks, but this is not consistent */ + UINT8 fattr; /* bit 0 = 1 if locked(?) */ + /* a value of $FF seems to be the default for non-AB blocks, but this is not consistent */ + UINT16BE fblock; /* relative file block number (enough for any volume up to 32 MBytes in size) */ + UINT32BE wrCnt; /* MFS: date and time of last write */ + /* HFS: seems related to the wrCnt field in the mdb, i.e. + each time a volume is written to, the current value of + wrCnt is written in the tag field, then it is incremented */ + /* (DV17 says "disk block number", but it cannot be true) */ +}; + +#ifdef UNUSED_FUNCTION +static void hfs_image_close(struct mac_l2_imgref *l2_img); +#endif +static imgtoolerr_t mfs_file_get_nth_block_address(struct mac_fileref *fileref, UINT32 block_num, UINT32 *block_address); +static imgtoolerr_t hfs_file_get_nth_block_address(struct mac_fileref *fileref, UINT32 block_num, UINT32 *block_address); +static imgtoolerr_t mfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, mac_str255 filename, mac_dirent *cat_info, int create_it); +static imgtoolerr_t hfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info); +static imgtoolerr_t mfs_file_open(struct mac_l2_imgref *l2_img, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref); +static imgtoolerr_t hfs_file_open(struct mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref); +static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABeof); +static imgtoolerr_t mfs_dir_update(struct mac_fileref *fileref); + +static struct mac_l2_imgref *get_imgref(imgtool_image *img) +{ + return (struct mac_l2_imgref *) imgtool_floppy_extrabytes(img); +} + + +#ifdef UNUSED_FUNCTION +/* + mac_image_close + + Close a macintosh image. + + l2_img (I/O): level-2 image reference +*/ +static void mac_image_close(struct mac_l2_imgref *l2_img) +{ + switch (l2_img->format) + { + case L2I_MFS: + break; + + case L2I_HFS: + hfs_image_close(l2_img); + break; + } +} +#endif + +/* + mac_lookup_path + + Resolve a file path, and translate it to a parID + filename pair that enables + to do an efficient file search on a HFS volume (and an inefficient one on + MFS, but it is not an issue as MFS volumes typically have a few dozens + files, vs. possibly thousands with HFS volumes). + + l2_img (I/O): level-2 image reference + fpath (I): file path (C string) + parID (O): set to the CNID of the parent directory if the volume is in HFS + format (reserved for MFS volumes) + filename (O): set to the actual name of the file, with capitalization matching + the one on the volume rather than the one in the fpath parameter (Mac + string) + cat_info (O): catalog info for this file extracted from the catalog file + (may be NULL) + + Return imgtool error code +*/ +static imgtoolerr_t mac_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info, int create_it) +{ + imgtoolerr_t err = IMGTOOLERR_UNEXPECTED; + + switch (l2_img->format) + { + case L2I_MFS: + *parID = 0; + err = mfs_lookup_path(l2_img, fpath, filename, cat_info, create_it); + break; + + case L2I_HFS: + err = hfs_lookup_path(l2_img, fpath, parID, filename, cat_info); + break; + } + return err; +} + +/* + mac_file_open + + Open a file located on a macintosh image + + l2_img (I/O): level-2 image reference + parID (I): CNID of the parent directory if the volume is in HFS format + (reserved for MFS volumes) + filename (I): name of the file (Mac string) + mac_forkID (I): tells which fork should be opened + fileref (O): mac file reference to open + + Return imgtool error code +*/ +static imgtoolerr_t mac_file_open(struct mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref) +{ + switch (l2_img->format) + { + case L2I_MFS: + return mfs_file_open(l2_img, filename, fork, fileref); + + case L2I_HFS: + return hfs_file_open(l2_img, parID, filename, fork, fileref); + } + + return IMGTOOLERR_UNEXPECTED; +} + +/* + mac_file_read + + Read data from an open mac file, starting at current position in file + + fileref (I/O): mac file reference + len (I): number of bytes to read + dest (O): destination buffer + + Return imgtool error code +*/ +static imgtoolerr_t mac_file_read(struct mac_fileref *fileref, UINT32 len, void *dest) +{ + UINT32 block = 0; + floppy_tag_record tag; + int run_len; + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + + if ((fileref->crPs + len) > fileref->eof) + /* EOF */ + return IMGTOOLERR_UNEXPECTED; + + while (len > 0) + { + if (fileref->reload_buf) + { + switch (fileref->l2_img->format) + { + case L2I_MFS: + err = mfs_file_get_nth_block_address(fileref, fileref->crPs/512, &block); + break; + + case L2I_HFS: + err = hfs_file_get_nth_block_address(fileref, fileref->crPs/512, &block); + break; + } + if (err) + return err; + err = image_read_block(&fileref->l2_img->l1_img, block, fileref->block_buffer); + if (err) + return err; + fileref->reload_buf = FALSE; + + if (TAG_EXTRA_CHECKS) + { + /* optional check */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + err = image_read_tag(&fileref->l2_img->l1_img, block, &tag); + if (err) + return err; + + if ((get_UINT32BE(tag.fileID) != fileref->fileID) + || (((tag.ftype & 2) != 0) != (fileref->forkType == rsrc_fork)) + || (get_UINT16BE(tag.fblock) != ((fileref->crPs/512) & 0xffff))) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + } + } + } + run_len = 512 - (fileref->crPs % 512); + if (run_len > len) + run_len = len; + + memcpy(dest, fileref->block_buffer+(fileref->crPs % 512), run_len); + len -= run_len; + dest = (UINT8 *)dest + run_len; + fileref->crPs += run_len; + if ((fileref->crPs % 512) == 0) + fileref->reload_buf = TRUE; + } + + return IMGTOOLERR_SUCCESS; +} + +/* + mac_file_write + + Write data to an open mac file, starting at current position in file + + fileref (I/O): mac file reference + len (I): number of bytes to read + dest (O): destination buffer + + Return imgtool error code +*/ +static imgtoolerr_t mac_file_write(struct mac_fileref *fileref, UINT32 len, const void *src) +{ + UINT32 block = 0; + floppy_tag_record tag; + int run_len; + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + + if ((fileref->crPs + len) > fileref->eof) + /* EOF */ + return IMGTOOLERR_UNEXPECTED; + + while (len > 0) + { + switch (fileref->l2_img->format) + { + case L2I_MFS: + err = mfs_file_get_nth_block_address(fileref, fileref->crPs/512, &block); + break; + + case L2I_HFS: + err = hfs_file_get_nth_block_address(fileref, fileref->crPs/512, &block); + break; + } + if (err) + return err; + + if (TAG_CHECKS) + { + /* optional check */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + err = image_read_tag(&fileref->l2_img->l1_img, block, &tag); + if (err) + return err; + + if ((get_UINT32BE(tag.fileID) != fileref->fileID) + || (((tag.ftype & 2) != 0) != (fileref->forkType == rsrc_fork)) + || (get_UINT16BE(tag.fblock) != ((fileref->crPs/512) & 0xffff))) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + } + } + + if (fileref->reload_buf) + { + err = image_read_block(&fileref->l2_img->l1_img, block, fileref->block_buffer); + if (err) + return err; + fileref->reload_buf = FALSE; + } + run_len = 512 - (fileref->crPs % 512); + if (run_len > len) + run_len = len; + + memcpy(fileref->block_buffer+(fileref->crPs % 512), src, run_len); + err = image_write_block(&fileref->l2_img->l1_img, block, fileref->block_buffer); + if (err) + return err; + /* update tag data */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + if (!TAG_CHECKS) + { + err = image_read_tag(&fileref->l2_img->l1_img, block, &tag); + if (err) + return err; + } + + switch (fileref->l2_img->format) + { + case L2I_MFS: + set_UINT32BE(&tag.wrCnt, mac_time_now()); + break; + + case L2I_HFS: + /*set_UINT32BE(&tag.wrCnt, ++fileref->l2_img.u.hfs.wrCnt);*/ /* ***TODO*** */ + break; + } + + err = image_write_tag(&fileref->l2_img->l1_img, block, &tag); + if (err) + return err; + } + len -= run_len; + src = (const UINT8 *)src + run_len; + fileref->crPs += run_len; + if ((fileref->crPs % 512) == 0) + fileref->reload_buf = TRUE; + } + + return IMGTOOLERR_SUCCESS; +} + +#ifdef UNUSED_FUNCTION +/* + mac_file_tell + + Get current position in an open mac file + + fileref (I/O): mac file reference + filePos (O): current position in file + + Return imgtool error code +*/ +static imgtoolerr_t mac_file_tell(struct mac_fileref *fileref, UINT32 *filePos) +{ + *filePos = fileref->crPs; + + return IMGTOOLERR_SUCCESS; +} +#endif + +/* + mac_file_seek + + Set current position in an open mac file + + fileref (I/O): mac file reference + filePos (I): new position in file + + Return imgtool error code +*/ +static imgtoolerr_t mac_file_seek(struct mac_fileref *fileref, UINT32 filePos) +{ + if ((fileref->crPs / 512) != (filePos / 512)) + fileref->reload_buf = TRUE; + + fileref->crPs = filePos; + + return IMGTOOLERR_SUCCESS; +} + +/* + mac_file_seteof + + Set the position of the EOF in an open mac file + + fileref (I/O): mac file reference + newEof (I): new position of EOF in file + + Return imgtool error code +*/ +static imgtoolerr_t mac_file_seteof(struct mac_fileref *fileref, UINT32 newEof) +{ + UINT32 newABEof; + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + + newABEof = (newEof + fileref->l2_img->blocksperAB * 512 - 1) / (fileref->l2_img->blocksperAB * 512); + +#if 0 + if (fileref->pLen % (fileref->l2_img->blocksperAB * 512)) + return IMGTOOLERR_CORRUPTIMAGE; +#endif + + if (newEof < fileref->eof) + fileref->eof = newEof; + + switch (fileref->l2_img->format) + { + case L2I_MFS: + err = mfs_file_setABeof(fileref, newABEof); + break; + + case L2I_HFS: + err = IMGTOOLERR_UNIMPLEMENTED; + break; + } + if (err) + return err; + + fileref->eof = newEof; + + err = mfs_dir_update(fileref); + if (err) + return err; + + /* update current pos if beyond new EOF */ +#if 0 + if (fileref->crPs > newEof) + { + if ((fileref->crPs / 512) != (newEof / 512)) + fileref->reload_buf = TRUE; + + fileref->crPs = newEof; + } +#endif + + return IMGTOOLERR_SUCCESS; +} + +#if 0 +#pragma mark - +#pragma mark MFS IMPLEMENTATION +#endif + +/* + directory entry for use in the directory file + + Note the structure is variable length. It is always word-aligned, and + cannot cross block boundaries. + + Note that the directory does not seem to be sorted: the order in which + files appear does not match file names, and it does not always match file + IDs. +*/ +struct mfs_dir_entry +{ + UINT8 flags; /* bit 7=1 if entry used, bit 0=1 if file locked */ + /* 0x00 means end of block: if we are not done + with reading the directory, the remnants will + be read from next block */ + UINT8 flVersNum; /* version number (usually 0x00, but I don't + have the IM volume that describes it) */ + mac_FInfo flFinderInfo; /* information used by the Finder */ + + UINT32BE fileID; /* file ID */ + + UINT16BE dataStartBlock; /* first allocation block of data fork */ + UINT32BE dataLogicalSize; /* logical EOF of data fork */ + UINT32BE dataPhysicalSize; /* physical EOF of data fork */ + UINT16BE rsrcStartBlock; /* first allocation block of resource fork */ + UINT32BE rsrcLogicalSize; /* logical EOF of resource fork */ + UINT32BE rsrcPhysicalSize; /* physical EOF of resource fork */ + + UINT32BE createDate; /* date and time of creation */ + UINT32BE modifyDate; /* date and time of last modification */ + + UINT8 name[1]; /* first char is length of file name */ + /* next chars are file name - 255 chars at most */ + /* IIRC, Finder 7 only supports 31 chars, + wheareas earlier versions support 63 chars */ +}; + +/* + FOBJ desktop resource: describes a folder, or the location of the volume + icon. + + In typical Apple manner, this resource is not documented. However, I have + managed to reverse engineer some parts of it. +*/ +struct mfs_FOBJ +{ + UINT8 unknown0[2]; /* $00: $0004 for disk, $0008 for folder??? */ + mac_point location; /* $02: location in parent window */ + UINT8 unknown1[4]; /* $06: ??? */ + UINT8 view; /* $0A: manner in which folders are displayed??? */ + UINT8 unknown2; /* $0B: ??? */ + UINT16BE par_fldr; /* $0C: parent folder ID */ + UINT8 unknown3[10]; /* $0E: ??? */ + UINT16BE unknown4; /* $18: ??? */ + UINT32BE createDate; /* $1A: date and time of creation */ + UINT32BE modifyDate; /* $1E: date and time of last modification */ + UINT16BE unknown5; /* $22: put-away folder ID?????? */ + UINT8 unknown6[8]; /* $24: ??? */ + mac_rect bounds; /* $2C: window bounds */ + mac_point scroll; /* $34: current scroll offset??? */ + union + { /* I think there are two versions of the structure */ + struct + { + UINT16BE item_count; /* number of items (folders and files) in + this folder */ + UINT32BE item_descs[1]; /* this variable-length array has + item_count entries - meaning of entry is unknown */ + } v1; + struct + { + UINT16BE zerofill; /* always 0? */ + UINT16BE unknown0; /* always 0??? */ + UINT16BE item_count; /* number of items (folders and files) in + this folder */ + UINT8 unknown1[20]; /* ??? */ + UINT8 name[1]; /* variable-length macintosh string */ + } v2; + } u; +}; + +/* + MFS open dir ref +*/ +struct mfs_dirref +{ + struct mac_l2_imgref *l2_img; /* image pointer */ + UINT16 index; /* current file index in the disk directory */ + UINT16 cur_block; /* current block offset in directory file */ + UINT16 cur_offset; /* current byte offset in current block of directory file */ + UINT8 block_buffer[512]; /* buffer with current directory block */ +}; + + + +static imgtoolerr_t mfs_image_create(imgtool_image *image, imgtool_stream *stream, option_resolution *opts) +{ + imgtoolerr_t err; + UINT8 buffer[512]; + UINT32 heads, tracks, sector_bytes, i; + UINT32 total_disk_blocks, total_allocation_blocks, allocation_block_size; + UINT32 free_allocation_blocks; + + heads = option_resolution_lookup_int(opts, 'H'); + tracks = option_resolution_lookup_int(opts, 'T'); + sector_bytes = option_resolution_lookup_int(opts, 'L'); + + get_imgref(image)->l1_img.image = image; + get_imgref(image)->l1_img.heads = heads; + + if (sector_bytes != 512) + return IMGTOOLERR_UNEXPECTED; + + /* computation */ + allocation_block_size = 1024; + total_disk_blocks = 0; + for (i = 0; i < tracks; i++) + total_disk_blocks += heads * apple35_sectors_per_track(imgtool_floppy(image), i) * sector_bytes / 512; + total_allocation_blocks = total_disk_blocks / (allocation_block_size / 512); + free_allocation_blocks = total_allocation_blocks - 3; + + /* write master directory block */ + memset(buffer, 0, sizeof(buffer)); + place_integer_be(buffer, 0, 2, 0xd2d7); /* signature */ + place_integer_be(buffer, 2, 4, mac_time_now()); /* creation date */ + place_integer_be(buffer, 6, 4, mac_time_now()); /* last modified date */ + place_integer_be(buffer, 10, 2, 0); /* volume attributes */ + place_integer_be(buffer, 12, 2, 0); /* number of files in directory */ + place_integer_be(buffer, 14, 2, 4); /* first block of directory */ + place_integer_be(buffer, 16, 2, 12); /* length of directory in blocks */ + place_integer_be(buffer, 18, 2, total_allocation_blocks); /* allocation blocks on volume count */ + place_integer_be(buffer, 20, 4, allocation_block_size); /* allocation block size */ + place_integer_be(buffer, 24, 4, 8192); /* default clumping size */ + place_integer_be(buffer, 28, 2, 16); /* first allocation block on volume */ + place_integer_be(buffer, 30, 4, 2); /* next unused catalog node */ + place_integer_be(buffer, 34, 2, free_allocation_blocks); /* free allocation block count */ + pascal_from_c_string(&buffer[36], 28, "Untitled"); /* volume title */ + + err = image_write_block(&get_imgref(image)->l1_img, 2, buffer); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +/* + mfs_image_open + + Open a MFS image. Image must already be open on level 1. This function + should not be called directly: call mac_image_open() instead. + + l2_img (I/O): level-2 image reference to open (l1_img and format fields + must be initialized) + img_open_buf (I): buffer with the MDB block + + Return imgtool error code +*/ +static imgtoolerr_t mfs_image_open(imgtool_image *image, imgtool_stream *stream) +{ + imgtoolerr_t err; + struct mac_l2_imgref *l2_img; + img_open_buf buf_local; + img_open_buf *buf; + + l2_img = get_imgref(image); + l2_img->l1_img.image = image; + l2_img->l1_img.heads = 1; + l2_img->format = L2I_MFS; + + /* read MDB */ + err = image_read_block(&l2_img->l1_img, 2, &buf_local.raw); + if (err) + return err; + buf = &buf_local; + + /* check signature word */ + if ((buf->mfs_mdb.sigWord[0] != 0xd2) || (buf->mfs_mdb.sigWord[1] != 0xd7) + || (buf->mfs_mdb.VN[0] > 27)) + return IMGTOOLERR_CORRUPTIMAGE; + + l2_img->u.mfs.dir_num_files = get_UINT16BE(buf->mfs_mdb.nmFls); + l2_img->u.mfs.dir_start = get_UINT16BE(buf->mfs_mdb.dirSt); + l2_img->u.mfs.dir_blk_len = get_UINT16BE(buf->mfs_mdb.blLn); + + l2_img->numABs = get_UINT16BE(buf->mfs_mdb.nmAlBlks); + if ((get_UINT32BE(buf->mfs_mdb.alBlkSiz) % 512) || (get_UINT32BE(buf->mfs_mdb.alBlkSiz) == 0)) + return IMGTOOLERR_CORRUPTIMAGE; + l2_img->blocksperAB = get_UINT32BE(buf->mfs_mdb.alBlkSiz) / 512; + l2_img->u.mfs.ABStart = get_UINT16BE(buf->mfs_mdb.alBlSt); + + l2_img->nxtCNID = get_UINT32BE(buf->mfs_mdb.nxtFNum); + + l2_img->freeABs = get_UINT16BE(buf->mfs_mdb.freeABs); + + mac_strcpy(l2_img->u.mfs.volname, buf->mfs_mdb.VN); + + if (l2_img->numABs > 4094) + return IMGTOOLERR_CORRUPTIMAGE; + + /* extract link array */ + { + int byte_len = l2_img->numABs + ((l2_img->numABs + 1) >> 1); + int cur_byte; + int cur_block; + int block_len = sizeof(buf->mfs_mdb.ABlink); + + /* clear dirty flags */ + for (cur_block=0; cur_block<13; cur_block++) + l2_img->u.mfs.ABlink_dirty[cur_block] = 0; + + /* append the chunk after MDB to link array */ + cur_byte = 0; + if (block_len > (byte_len - cur_byte)) + block_len = byte_len - cur_byte; + memcpy(l2_img->u.mfs.ABlink+cur_byte, buf->mfs_mdb.ABlink, block_len); + cur_byte += block_len; + cur_block = 2; + while (cur_byte < byte_len) + { + /* read next block */ + cur_block++; + err = image_read_block(&l2_img->l1_img, cur_block, buf->raw); + if (err) + return err; + block_len = 512; + + /* append this block to link array */ + if (block_len > (byte_len - cur_byte)) + block_len = byte_len - cur_byte; + memcpy(l2_img->u.mfs.ABlink+cur_byte, buf->raw, block_len); + cur_byte += block_len; + } + /* check that link array and directory don't overlap */ + if (cur_block >= l2_img->u.mfs.dir_start) + return IMGTOOLERR_CORRUPTIMAGE; + } + + return IMGTOOLERR_SUCCESS; +} + +/* + mfs_update_mdb + + Update MDB on disk + + l2_img (I/O): level-2 image reference + + Return imgtool error code +*/ +static imgtoolerr_t mfs_update_mdb(struct mac_l2_imgref *l2_img) +{ + imgtoolerr_t err; + union + { + struct mfs_mdb mfs_mdb; + UINT8 raw[512]; + } buf; + + assert(l2_img->format == L2I_MFS); + + /* read MDB */ + err = image_read_block(&l2_img->l1_img, 2, &buf.mfs_mdb); + if (err) + return err; + + set_UINT16BE(&buf.mfs_mdb.nmFls, l2_img->u.mfs.dir_num_files); +#if 0 /* these fields are never changed */ + set_UINT16BE(&buf.mfs_mdb.dirSt, l2_img->u.mfs.dir_start); + set_UINT16BE(&buf.mfs_mdb.blLn, l2_img->u.mfs.dir_blk_len); + + set_UINT16BE(&buf.mfs_mdb.nmAlBlks, l2_img->numABs); + set_UINT32BE(&buf.mfs_mdb.alBlkSiz, l2_img->blocksperAB*512); + set_UINT16BE(&buf.mfs_mdb.alBlSt, l2_img->u.mfs.ABStart); +#endif + + set_UINT32BE(&buf.mfs_mdb.nxtFNum, l2_img->nxtCNID); + + set_UINT16BE(&buf.mfs_mdb.freeABs, l2_img->freeABs); + +#if 0 /* these fields are never changed */ + mac_strcpy(buf.mfs_mdb.VN, l2_img->u.mfs.volname); +#endif + + /* save link array */ + { + int byte_len = l2_img->numABs + ((l2_img->numABs + 1) >> 1); + int cur_byte = 0; + int cur_block = 2; + int block_len = sizeof(buf.mfs_mdb.ABlink); + + /* update the chunk of link array after the MDB */ + if (block_len > (byte_len - cur_byte)) + block_len = byte_len - cur_byte; + memcpy(buf.mfs_mdb.ABlink, l2_img->u.mfs.ABlink+cur_byte, block_len); + cur_byte += block_len; + + if (block_len < sizeof(buf.mfs_mdb.ABlink)) + memset(buf.mfs_mdb.ABlink+block_len, 0, sizeof(buf.mfs_mdb.ABlink)-block_len); + + l2_img->u.mfs.ABlink_dirty[0] = 0; + + /* write back modified MDB+link */ + err = image_write_block(&l2_img->l1_img, 2, &buf.mfs_mdb); + if (err) + return err; + + while (cur_byte < byte_len) + { + /* advance to next block */ + cur_block++; + block_len = 512; + + /* extract the current chunk of link array */ + if (block_len > (byte_len - cur_byte)) + block_len = byte_len - cur_byte; + + if (l2_img->u.mfs.ABlink_dirty[cur_block-2]) + { + memcpy(buf.raw, l2_img->u.mfs.ABlink+cur_byte, block_len); + if (block_len < 512) + memset(buf.raw+block_len, 0, 512-block_len); + /* write back link array */ + err = image_write_block(&l2_img->l1_img, cur_block, buf.raw); + if (err) + return err; + l2_img->u.mfs.ABlink_dirty[cur_block-2] = 0; + } + + cur_byte += block_len; + } + } + + return IMGTOOLERR_SUCCESS; +} + +/* + mfs_dir_open + + Open the directory file + + l2_img (I/O): level-2 image reference + dirref (O): open directory file reference + + Return imgtool error code +*/ +static imgtoolerr_t mfs_dir_open(struct mac_l2_imgref *l2_img, const char *path, mfs_dirref *dirref) +{ + imgtoolerr_t err; + + assert(l2_img->format == L2I_MFS); + + if (path[0]) + return IMGTOOLERR_PATHNOTFOUND; + + dirref->l2_img = l2_img; + dirref->index = 0; + + dirref->cur_block = 0; + dirref->cur_offset = 0; + err = image_read_block(&l2_img->l1_img, l2_img->u.mfs.dir_start + dirref->cur_block, dirref->block_buffer); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + +/* + mfs_dir_read + + Read one entry of directory file + + dirref (I/O): open directory file reference + dir_entry (O): set to point to the entry read: set to NULL if EOF or error + + Return imgtool error code +*/ +static imgtoolerr_t mfs_dir_read(mfs_dirref *dirref, mfs_dir_entry **dir_entry) +{ + mfs_dir_entry *cur_dir_entry; + size_t cur_dir_entry_len; + imgtoolerr_t err; + + + if (dir_entry) + *dir_entry = NULL; + + if (dirref->index == dirref->l2_img->u.mfs.dir_num_files) + /* EOF */ + return IMGTOOLERR_SUCCESS; + + /* get cat entry pointer */ + cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset); + while ((dirref->cur_offset == 512) || ! (cur_dir_entry->flags & 0x80)) + { + dirref->cur_block++; + dirref->cur_offset = 0; + if (dirref->cur_block > dirref->l2_img->u.mfs.dir_blk_len) + /* aargh! */ + return IMGTOOLERR_CORRUPTIMAGE; + err = image_read_block(&dirref->l2_img->l1_img, dirref->l2_img->u.mfs.dir_start + dirref->cur_block, dirref->block_buffer); + if (err) + return err; + cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset); + } + + cur_dir_entry_len = offsetof(mfs_dir_entry, name) + cur_dir_entry->name[0] + 1; + + if ((dirref->cur_offset + cur_dir_entry_len) > 512) + /* aargh! */ + return IMGTOOLERR_CORRUPTIMAGE; + + /* entry looks valid: set pointer to entry */ + if (dir_entry) + *dir_entry = cur_dir_entry; + + /* update offset in block */ + dirref->cur_offset += cur_dir_entry_len; + /* align to word boundary */ + dirref->cur_offset = (dirref->cur_offset + 1) & ~1; + + /* update file count */ + dirref->index++; + + return IMGTOOLERR_SUCCESS; +} + +/* + mfs_dir_insert + + Add an entry in the directory file + + l2_img (I/O): level-2 image reference + dirref (I/O): open directory file reference + filename (I): name of the file for which an entry is created (Mac string) + dir_entry (O): set to point to the created entry: set to NULL if EOF or + error + + Return imgtool error code +*/ +static imgtoolerr_t mfs_dir_insert(struct mac_l2_imgref *l2_img, mfs_dirref *dirref, const UINT8 *new_fname, mfs_dir_entry **dir_entry) +{ + size_t new_dir_entry_len; + mfs_dir_entry *cur_dir_entry; + size_t cur_dir_entry_len; + UINT32 cur_date; + imgtoolerr_t err; + + dirref->l2_img = l2_img; + dirref->index = 0; + + new_dir_entry_len = offsetof(mfs_dir_entry, name) + new_fname[0] + 1; + + for (dirref->cur_block = 0; dirref->cur_block < dirref->l2_img->u.mfs.dir_blk_len; dirref->cur_block++) + { + /* read current block */ + err = image_read_block(&dirref->l2_img->l1_img, dirref->l2_img->u.mfs.dir_start + dirref->cur_block, dirref->block_buffer); + if (err) + return err; + + /* get free chunk in this block */ + dirref->cur_offset = 0; + cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset); + while ((dirref->cur_offset < 512) && (cur_dir_entry->flags & 0x80)) + { /* skip cur_dir_entry */ + cur_dir_entry_len = offsetof(mfs_dir_entry, name) + cur_dir_entry->name[0] + 1; + /* update offset in block */ + dirref->cur_offset += cur_dir_entry_len; + /* align to word boundary */ + dirref->cur_offset = (dirref->cur_offset + 1) & ~1; + /* update entry pointer */ + cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset); + /* update file index (useless, but can't harm) */ + dirref->index++; + } + + if (new_dir_entry_len <= (/*512*/510 - dirref->cur_offset)) + { + /*memcpy(cur_dir_entry, new_dir_entry, new_dir_entry_len);*/ + cur_dir_entry->flags = 0x80; + cur_dir_entry->flVersNum = 0x00; + memset(&cur_dir_entry->flFinderInfo, 0, sizeof(cur_dir_entry->flFinderInfo)); + set_UINT32BE(&cur_dir_entry->fileID, dirref->l2_img->nxtCNID++); + set_UINT16BE(&cur_dir_entry->dataStartBlock, 1); + set_UINT32BE(&cur_dir_entry->dataLogicalSize, 0); + set_UINT32BE(&cur_dir_entry->dataPhysicalSize, 0); + set_UINT16BE(&cur_dir_entry->rsrcStartBlock, 1); + set_UINT32BE(&cur_dir_entry->rsrcLogicalSize, 0); + set_UINT32BE(&cur_dir_entry->rsrcPhysicalSize, 0); + cur_date = mac_time_now(); + set_UINT32BE(&cur_dir_entry->createDate, cur_date); + set_UINT32BE(&cur_dir_entry->modifyDate, cur_date); + mac_strcpy(cur_dir_entry->name, new_fname); + + /* update offset in block */ + dirref->cur_offset += new_dir_entry_len; + /* align to word boundary */ + dirref->cur_offset = (dirref->cur_offset + 1) & ~1; + if (dirref->cur_offset < 512) + /* mark remaining space as free record */ + dirref->block_buffer[dirref->cur_offset] = 0; + /* write back directory */ + err = image_write_block(&dirref->l2_img->l1_img, dirref->l2_img->u.mfs.dir_start + dirref->cur_block, dirref->block_buffer); + if (err) + return err; + /* update file count */ + dirref->l2_img->u.mfs.dir_num_files++; + + /* update MDB (nxtCNID & dir_num_files fields) */ + err = mfs_update_mdb(dirref->l2_img); + if (err) + return err; + + if (dir_entry) + *dir_entry = cur_dir_entry; + return IMGTOOLERR_SUCCESS; + } + } + + return IMGTOOLERR_NOSPACE; +} + +/* + mfs_dir_update + + Update one entry of directory file + + fileref (I/O): open file reference + + Return imgtool error code +*/ +static imgtoolerr_t mfs_dir_update(struct mac_fileref *fileref) +{ + UINT16 cur_block; + UINT16 cur_offset; + UINT8 block_buffer[512]; + mfs_dir_entry *cur_dir_entry; + size_t cur_dir_entry_len; + imgtoolerr_t err; + + for (cur_block = 0; cur_block < fileref->l2_img->u.mfs.dir_blk_len; cur_block++) + { + /* read current block */ + err = image_read_block(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.dir_start + cur_block, block_buffer); + if (err) + return err; + + /* get free chunk in this block */ + cur_offset = 0; + cur_dir_entry = (mfs_dir_entry *) (block_buffer + cur_offset); + while ((cur_offset < 512) && (cur_dir_entry->flags & 0x80)) + { + if (get_UINT32BE(cur_dir_entry->fileID) == fileref->fileID) + { /* found it: update directory entry */ + switch (fileref->forkType) + { + case data_fork: + set_UINT16BE(&cur_dir_entry->dataStartBlock, fileref->mfs.stBlk); + set_UINT32BE(&cur_dir_entry->dataLogicalSize, fileref->eof); + set_UINT32BE(&cur_dir_entry->dataPhysicalSize, fileref->pLen); + break; + + case rsrc_fork: + set_UINT16BE(&cur_dir_entry->rsrcStartBlock, fileref->mfs.stBlk); + set_UINT32BE(&cur_dir_entry->rsrcLogicalSize, fileref->eof); + set_UINT32BE(&cur_dir_entry->rsrcPhysicalSize, fileref->pLen); + break; + } + /* write back directory */ + err = image_write_block(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.dir_start + cur_block, block_buffer); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; + } + /* skip cur_dir_entry */ + cur_dir_entry_len = offsetof(mfs_dir_entry, name) + cur_dir_entry->name[0] + 1; + /* update offset in block */ + cur_offset += cur_dir_entry_len; + /* align to word boundary */ + cur_offset = (cur_offset + 1) & ~1; + /* update entry pointer */ + cur_dir_entry = (mfs_dir_entry *) (block_buffer + cur_offset); + } + } + + return IMGTOOLERR_UNEXPECTED; +} + + +/* + mfs_find_dir_entry + + Find a file in an MFS directory + + dirref (I/O): open directory file reference + filename (I): file name (Mac string) + dir_entry (O): set to point to the entry read: set to NULL if EOF or error + + Return imgtool error code +*/ +static imgtoolerr_t mfs_find_dir_entry(mfs_dirref *dirref, const mac_str255 filename, mfs_dir_entry **dir_entry) +{ + mfs_dir_entry *cur_dir_entry; + imgtoolerr_t err; + + if (dir_entry) + *dir_entry = NULL; + + /* scan dir for file */ + while (1) + { + err = mfs_dir_read(dirref, &cur_dir_entry); + if (err) + return err; + if (!cur_dir_entry) + /* EOF */ + break; + if ((! mac_stricmp(filename, cur_dir_entry->name)) && (cur_dir_entry->flVersNum == 0)) + { /* file found */ + + if (dir_entry) + *dir_entry = cur_dir_entry; + + return IMGTOOLERR_SUCCESS; + } + } + + return IMGTOOLERR_FILENOTFOUND; +} + +/* + mfs_lookup_path + + Resolve a file path for MFS volumes. This function should not be called + directly: call mac_lookup_path instead. + + l2_img (I/O): level-2 image reference + fpath (I): file path (C string) + filename (O): set to the actual name of the file, with capitalization matching + the one on the volume rather than the one in the fpath parameter (Mac + string) + cat_info (I/O): on output, catalog info for this file extracted from the + catalog file (may be NULL) + If create_it is TRUE, created info will first be set according to the + data from cat_info + create_it (I): TRUE if entry should be created if not found + + Return imgtool error code +*/ +static imgtoolerr_t mfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, mac_str255 filename, mac_dirent *cat_info, int create_it) +{ + mfs_dirref dirref; + mfs_dir_entry *dir_entry; + imgtoolerr_t err; + + /* rapid check */ + if (strchr(fpath, ':')) + return IMGTOOLERR_BADFILENAME; + + /* extract file name */ + c_to_mac_strncpy(filename, fpath, strlen(fpath)); + + /* open dir */ + mfs_dir_open(l2_img, "", &dirref); + + /* find file */ + err = mfs_find_dir_entry(&dirref, filename, &dir_entry); + if ((err == IMGTOOLERR_FILENOTFOUND) && create_it) + err = mfs_dir_insert(l2_img, &dirref, filename, &dir_entry); + if (err) + return err; + + mac_strcpy(filename, dir_entry->name); + + if (create_it && cat_info) + { + dir_entry->flFinderInfo = cat_info->flFinderInfo; + dir_entry->flags = (dir_entry->flags & 0x80) | (cat_info->flags & 0x7f); + set_UINT32BE(&dir_entry->createDate, cat_info->createDate); + set_UINT32BE(&dir_entry->modifyDate, cat_info->modifyDate); + + /* write current directory block */ + err = image_write_block(&l2_img->l1_img, l2_img->u.mfs.dir_start + dirref.cur_block, dirref.block_buffer); + if (err) + return err; + } + + if (cat_info) + { + cat_info->flFinderInfo = dir_entry->flFinderInfo; + memset(&cat_info->flXFinderInfo, 0, sizeof(cat_info->flXFinderInfo)); + cat_info->flags = dir_entry->flags; + cat_info->fileID = get_UINT32BE(dir_entry->fileID); + cat_info->dataLogicalSize = get_UINT32BE(dir_entry->dataLogicalSize); + cat_info->dataPhysicalSize = get_UINT32BE(dir_entry->dataPhysicalSize); + cat_info->rsrcLogicalSize = get_UINT32BE(dir_entry->rsrcLogicalSize); + cat_info->rsrcPhysicalSize = get_UINT32BE(dir_entry->rsrcPhysicalSize); + cat_info->createDate = get_UINT32BE(dir_entry->createDate); + cat_info->modifyDate = get_UINT32BE(dir_entry->modifyDate); + cat_info->dataRecType = 0x200; /* hcrt_File */ + } + + return IMGTOOLERR_SUCCESS; +} + +/* + mfs_file_open_internal + + Open a file fork, given its directory entry. This function should not be + called directly: call mfs_file_open instead. + + l2_img (I/O): level-2 image reference + dir_entry (I): directory entry for the file to open + mac_forkID (I): tells which fork should be opened + fileref (O): mac file reference to open + + Return imgtool error code +*/ +static imgtoolerr_t mfs_file_open_internal(struct mac_l2_imgref *l2_img, const mfs_dir_entry *dir_entry, mac_forkID fork, struct mac_fileref *fileref) +{ + assert(l2_img->format == L2I_MFS); + + fileref->l2_img = l2_img; + + fileref->fileID = get_UINT32BE(dir_entry->fileID); + fileref->forkType = fork; + + switch (fork) + { + case data_fork: + fileref->mfs.stBlk = get_UINT16BE(dir_entry->dataStartBlock); + fileref->eof = get_UINT32BE(dir_entry->dataLogicalSize); + fileref->pLen = get_UINT32BE(dir_entry->dataPhysicalSize); + break; + + case rsrc_fork: + fileref->mfs.stBlk = get_UINT16BE(dir_entry->rsrcStartBlock); + fileref->eof = get_UINT32BE(dir_entry->rsrcLogicalSize); + fileref->pLen = get_UINT32BE(dir_entry->rsrcPhysicalSize); + break; + } + + fileref->crPs = 0; + + fileref->reload_buf = TRUE; + + return IMGTOOLERR_SUCCESS; +} + +/* + mfs_file_open + + Open a file located on a MFS volume. This function should not be called + directly: call mac_file_open instead. + + l2_img (I/O): level-2 image reference + filename (I): name of the file (Mac string) + mac_forkID (I): tells which fork should be opened + fileref (O): mac file reference to open + + Return imgtool error code +*/ +static imgtoolerr_t mfs_file_open(struct mac_l2_imgref *l2_img, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref) +{ + mfs_dirref dirref; + mfs_dir_entry *dir_entry; + imgtoolerr_t err; + + /* open dir */ + mfs_dir_open(l2_img, "", &dirref); + + /* find file */ + err = mfs_find_dir_entry(&dirref, filename, &dir_entry); + if (err) + return err; + + /* open it */ + return mfs_file_open_internal(l2_img, dir_entry, fork, fileref); +} + +/* + mfs_get_ABlink + + Read one entry of the Allocation Bitmap link array, on an MFS volume. + + l2_img (I/O): level-2 image reference + AB_address (I): index in the array, which is an AB address + + Returns the 12-bit value read in array. +*/ +static UINT16 mfs_get_ABlink(struct mac_l2_imgref *l2_img, UINT16 AB_address) +{ + UINT16 reply; + int base; + + assert(l2_img->format == L2I_MFS); + + base = (AB_address >> 1) * 3; + + if (! (AB_address & 1)) + reply = (l2_img->u.mfs.ABlink[base] << 4) | ((l2_img->u.mfs.ABlink[base+1] >> 4) & 0x0f); + else + reply = ((l2_img->u.mfs.ABlink[base+1] << 8) & 0xf00) | l2_img->u.mfs.ABlink[base+2]; + + return reply; +} + +/* + mfs_set_ABlink + + Set one entry of the Allocation Bitmap link array, on an MFS volume. + + l2_img (I/O): level-2 image reference + AB_address (I): index in the array, which is an AB address + data (I): 12-bit value to write in array +*/ +static void mfs_set_ABlink(struct mac_l2_imgref *l2_img, UINT16 AB_address, UINT16 data) +{ + int base; + + assert(l2_img->format == L2I_MFS); + + base = (AB_address >> 1) * 3; + + if (! (AB_address & 1)) + { + l2_img->u.mfs.ABlink[base] = (data >> 4) & 0xff; + l2_img->u.mfs.ABlink[base+1] = (l2_img->u.mfs.ABlink[base+1] & 0x0f) | ((data << 4) & 0xf0); + + l2_img->u.mfs.ABlink_dirty[(base+64)/512] = 1; + l2_img->u.mfs.ABlink_dirty[(base+1+64)/512] = 1; + } + else + { + l2_img->u.mfs.ABlink[base+1] = (l2_img->u.mfs.ABlink[base+1] & 0xf0) | ((data >> 8) & 0x0f); + l2_img->u.mfs.ABlink[base+2] = data & 0xff; + + l2_img->u.mfs.ABlink_dirty[(base+1+64)/512] = 1; + l2_img->u.mfs.ABlink_dirty[(base+2+64)/512] = 1; + } +} + +/* + mfs_file_get_nth_block_address + + Get the disk block address of a given block in an open file on a MFS image. + Called by macintosh file code. + + fileref (I/O): open mac file reference + block_num (I): file block index + block_address (O): disk block address for the file block + + Return imgtool error code +*/ +static imgtoolerr_t mfs_file_get_nth_block_address(struct mac_fileref *fileref, UINT32 block_num, UINT32 *block_address) +{ + UINT32 AB_num; + UINT32 i; + UINT16 AB_address; + + assert(fileref->l2_img->format == L2I_MFS); + + AB_num = block_num / fileref->l2_img->blocksperAB; + + AB_address = fileref->mfs.stBlk; + if ((AB_address == 0) || (AB_address >= fileref->l2_img->numABs+2)) + /* 0 -> ??? */ + return IMGTOOLERR_CORRUPTIMAGE; + if (AB_address == 1) + /* EOF */ + return IMGTOOLERR_UNEXPECTED; + AB_address -= 2; + for (i=0; il2_img, AB_address); + if ((AB_address == 0) || (AB_address >= fileref->l2_img->numABs+2)) + /* 0 -> empty block: there is no way an empty block could make it + into the link chain!!! */ + return IMGTOOLERR_CORRUPTIMAGE; + if (AB_address == 1) + /* EOF */ + return IMGTOOLERR_UNEXPECTED; + AB_address -= 2; + } + + *block_address = fileref->l2_img->u.mfs.ABStart + AB_address * fileref->l2_img->blocksperAB + + block_num % fileref->l2_img->blocksperAB; + + return IMGTOOLERR_SUCCESS; +} + +/* + mfs_file_allocABs + + Allocate a chunk of ABs + + fileref (I/O): open mac file reference + lastAB (I): AB address on disk of last file AB (only if + fileref->mfs.stBlk != 1) + allocABs (I): number of ABs to allocate in addition to the current file + allocation + fblock (I): first file block to allocate (used for tag data) + + Return imgtool error code +*/ +static imgtoolerr_t mfs_file_allocABs(struct mac_fileref *fileref, UINT16 lastAB, UINT32 allocABs, UINT32 fblock) +{ + int numABs = fileref->l2_img->numABs; + int free_ABs; + int i, j; + floppy_tag_record tag; + int extentBaseAB, extentABlen; + int firstBestExtentBaseAB = 0, firstBestExtentABlen; + int secondBestExtentBaseAB = 0, secondBestExtentABlen; + imgtoolerr_t err; + + /* return if done */ + if (! allocABs) + return IMGTOOLERR_SUCCESS; + + /* compute free space */ + free_ABs = 0; + for (i=0; il2_img, i) == 0) + { + if (TAG_CHECKS) + { + /* optional check */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + for (j=0; jl2_img->blocksperAB; j++) + { + err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + i * fileref->l2_img->blocksperAB + j, &tag); + if (err) + return err; + + if (get_UINT32BE(tag.fileID) != 0) + { + /*return IMGTOOLERR_CORRUPTIMAGE;*/ + goto corrupt_free_block; + } + } + } + } + + free_ABs++; + } +corrupt_free_block: + ; + } + + /* check we have enough free space */ + if (free_ABs < allocABs) + return IMGTOOLERR_NOSPACE; + + if (fileref->mfs.stBlk != 1) + { /* try to extend last file extent */ + /* append free ABs after last AB */ + for (i=lastAB+1; (mfs_get_ABlink(fileref->l2_img, i) == 0) && (allocABs > 0) && (i < numABs); i++) + { + if (TAG_CHECKS) + { + /* optional check */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + for (j=0; jl2_img->blocksperAB; j++) + { + err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + i * fileref->l2_img->blocksperAB + j, &tag); + if (err) + return err; + + if (get_UINT32BE(tag.fileID) != 0) + { + /*return IMGTOOLERR_CORRUPTIMAGE;*/ + goto corrupt_free_block2; + } + } + } + } + + mfs_set_ABlink(fileref->l2_img, lastAB, i+2); + lastAB = i; + allocABs--; + free_ABs--; + } +corrupt_free_block2: + /* return if done */ + if (! allocABs) + { + mfs_set_ABlink(fileref->l2_img, lastAB, 1); + fileref->l2_img->freeABs = free_ABs; + return IMGTOOLERR_SUCCESS; /* done */ + } + } + + while (allocABs) + { + /* find smallest data block at least nb_alloc_physrecs in length, and largest data block less than nb_alloc_physrecs in length */ + firstBestExtentABlen = INT_MAX; + secondBestExtentABlen = 0; + for (i=0; il2_img, i) == 0) + { /* found one free block */ + /* compute its length */ + extentBaseAB = i; + extentABlen = 0; + while ((il2_img, i) == 0)) + { + if (TAG_CHECKS) + { + /* optional check */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + for (j=0; jl2_img->blocksperAB; j++) + { + err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + i * fileref->l2_img->blocksperAB + j, &tag); + if (err) + return err; + + if (get_UINT32BE(tag.fileID) != 0) + { + /*return IMGTOOLERR_CORRUPTIMAGE;*/ + goto corrupt_free_block3; + } + } + } + } + + extentABlen++; + i++; + } +corrupt_free_block3: + /* compare to previous best and second-best blocks */ + if ((extentABlen < firstBestExtentABlen) && (extentABlen >= allocABs)) + { + firstBestExtentBaseAB = extentBaseAB; + firstBestExtentABlen = extentABlen; + if (extentABlen == allocABs) + /* no need to search further */ + break; + } + else if ((extentABlen > secondBestExtentABlen) && (extentABlen < allocABs)) + { + secondBestExtentBaseAB = extentBaseAB; + secondBestExtentABlen = extentABlen; + } + } + } + + if (firstBestExtentABlen != INT_MAX) + { /* found one contiguous block which can hold it all */ + extentABlen = allocABs; + for (i=0; imfs.stBlk != 1) + mfs_set_ABlink(fileref->l2_img, lastAB, firstBestExtentBaseAB+i+2); + else + fileref->mfs.stBlk = firstBestExtentBaseAB+i+2; + lastAB = firstBestExtentBaseAB+i; + free_ABs--; + /* set tag to allocated */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + set_UINT32BE(&tag.fileID, fileref->fileID); + tag.ftype = 1; + if ((fileref->forkType) == rsrc_fork) + tag.ftype |= 2; + tag.fattr = /*fattr*/ 0; /* ***TODO*** */ + for (j=0; jl2_img->blocksperAB; j++) + { + set_UINT16BE(&tag.fblock, fblock & 0xffff); + set_UINT32BE(&tag.wrCnt, mac_time_now()); + err = image_write_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + lastAB * fileref->l2_img->blocksperAB + j, &tag); + if (err) + { + mfs_set_ABlink(fileref->l2_img, lastAB, 1); + fileref->l2_img->freeABs = free_ABs; + return err; + } + fblock++; + } + } + } + allocABs = 0; + mfs_set_ABlink(fileref->l2_img, lastAB, 1); + fileref->l2_img->freeABs = free_ABs; + /*return IMGTOOLERR_SUCCESS;*/ /* done */ + } + else if (secondBestExtentABlen != 0) + { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */ + for (i=0; imfs.stBlk != 1) + mfs_set_ABlink(fileref->l2_img, lastAB, secondBestExtentBaseAB+i+2); + else + fileref->mfs.stBlk = secondBestExtentBaseAB+i+2; + lastAB = secondBestExtentBaseAB+i; + free_ABs--; + /* set tag to allocated */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + set_UINT32BE(&tag.fileID, fileref->fileID); + tag.ftype = 1; + if ((fileref->forkType) == rsrc_fork) + tag.ftype |= 2; + tag.fattr = /*fattr*/ 0; /* ***TODO*** */ + for (j=0; jl2_img->blocksperAB; j++) + { + set_UINT16BE(&tag.fblock, fblock & 0xffff); + set_UINT32BE(&tag.wrCnt, mac_time_now()); + err = image_write_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + lastAB * fileref->l2_img->blocksperAB + j, &tag); + if (err) + { + mfs_set_ABlink(fileref->l2_img, lastAB, 1); + fileref->l2_img->freeABs = free_ABs; + return err; + } + fblock++; + } + } + } + allocABs -= secondBestExtentABlen; + } + else + { + mfs_set_ABlink(fileref->l2_img, lastAB, 1); + return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */ + } + } + + return IMGTOOLERR_SUCCESS; +} + +/* + mfs_file_setABeof + + Set physical file EOF in ABs + + fileref (I/O): open mac file reference + newABeof (I): desired number of allocated ABs for this file + + Return imgtool error code +*/ +static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABeof) +{ + UINT16 AB_address = 0; + UINT16 AB_link; + int i, j; + floppy_tag_record tag; + int MDB_dirty = 0; + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + + + assert(fileref->l2_img->format == L2I_MFS); + + /* run through link chain until we reach the old or the new EOF */ + AB_link = fileref->mfs.stBlk; + if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2)) + /* 0 -> ??? */ + return IMGTOOLERR_CORRUPTIMAGE; + for (i=0; (il2_img, AB_address); + if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2)) + /* 0 -> empty block: there is no way an empty block could make it + into the link chain!!! */ + return IMGTOOLERR_CORRUPTIMAGE; + + if (TAG_CHECKS) + { + /* optional check */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + for (j=0; jl2_img->blocksperAB; j++) + { + err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + AB_address * fileref->l2_img->blocksperAB + j, &tag); + if (err) + return err; + + if ((get_UINT32BE(tag.fileID) != fileref->fileID) + || (((tag.ftype & 2) != 0) != (fileref->forkType == rsrc_fork)) + || (get_UINT16BE(tag.fblock) != ((i * fileref->l2_img->blocksperAB + j) & 0xffff))) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + } + } + } + } + + if (i == newABeof) + { /* new EOF is shorter than old one */ + /* mark new eof */ + if (i==0) + fileref->mfs.stBlk = 1; + else + { + mfs_set_ABlink(fileref->l2_img, AB_address, 1); + MDB_dirty = 1; + } + + /* free all remaining blocks */ + while (AB_link != 1) + { + AB_address = AB_link - 2; + AB_link = mfs_get_ABlink(fileref->l2_img, AB_address); + if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2)) + { /* 0 -> empty block: there is no way an empty block could make + it into the link chain!!! */ + if (MDB_dirty) + { /* update MDB (freeABs field) and ABLink array */ + err = mfs_update_mdb(fileref->l2_img); + if (err) + return err; + } + return IMGTOOLERR_CORRUPTIMAGE; + } + + if (TAG_CHECKS) + { + /* optional check */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + for (j=0; jl2_img->blocksperAB; j++) + { + err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + AB_address * fileref->l2_img->blocksperAB + j, &tag); + if (err) + return err; + + if ((get_UINT32BE(tag.fileID) != fileref->fileID) + || (((tag.ftype & 2) != 0) != (fileref->forkType == rsrc_fork)) + || (get_UINT16BE(tag.fblock) != ((i * fileref->l2_img->blocksperAB + j) & 0xffff))) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + } + } + } + + mfs_set_ABlink(fileref->l2_img, AB_address, 0); + fileref->l2_img->freeABs++; + MDB_dirty = 1; + /* set tag to free */ + if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) + { + memset(&tag, 0, sizeof(tag)); + for (j=0; jl2_img->blocksperAB; j++) + { + err = image_write_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + AB_address * fileref->l2_img->blocksperAB + j, &tag); + if (err) + return err; + } + } + i++; + } + } + else + { /* new EOF is larger than old one */ + err = mfs_file_allocABs(fileref, AB_address, newABeof - i, i * fileref->l2_img->blocksperAB); + if (err) + return err; + MDB_dirty = 1; + } + + if (MDB_dirty) + { /* update MDB (freeABs field) and ABLink array */ + err = mfs_update_mdb(fileref->l2_img); + if (err) + return err; + } + + fileref->pLen = newABeof * (fileref->l2_img->blocksperAB * 512); + + return IMGTOOLERR_SUCCESS; +} + +#ifdef UNUSED_FUNCTION +/* + mfs_hashString + + Hash a string: under MFS, this provides the resource ID of the comment + resource associated with the file whose name is provided (FCMT resource + type). + + Ripped from Apple technote TB06 (converted from 68k ASM to C) + + string (I): string to hash + + Returns hash value +*/ +static int mfs_hashString(const mac_str255 string) +{ + int reply; + int len; + int i; + + len = string[0]; + + reply = 0; + for (i=0; i> 1) & 0x7fff) | ~0x7fff; + else + reply = ((reply >> 1) & 0x7fff); + if (! (reply & 0x8000)) + reply = - reply; + } + + return reply; +} +#endif + +#if 0 +#pragma mark - +#pragma mark HFS IMPLEMENTATION +#endif + +/* + HFS extents B-tree key +*/ +struct hfs_extentKey +{ + UINT8 keyLength; /* length of key, excluding this field */ + UINT8 forkType; /* 0 = data fork, FF = resource fork */ + UINT32BE fileID; /* file ID */ + UINT16BE startBlock; /* first file allocation block number in this extent */ +}; +enum +{ + keyLength_hfs_extentKey = sizeof(hfs_extentKey) - sizeof(UINT8) +}; + +/* + HFS catalog B-tree key +*/ +struct hfs_catKey +{ + UINT8 keyLen; /* key length */ + UINT8 resrv1; /* reserved */ + UINT32BE parID; /* parent directory ID */ + mac_str31 cName; /* catalog node name */ + /* note that in index nodes, it is a mac_str31, but + in leaf keys it's a variable-length string */ +}; + +/* + HFS catalog data record for a folder - 70 bytes +*/ +struct hfs_catFolderData +{ + UINT16BE recordType; /* record type */ + UINT16BE flags; /* folder flags */ + UINT16BE valence; /* folder valence */ + UINT32BE folderID; /* folder ID */ + UINT32BE createDate; /* date and time of creation */ + UINT32BE modifyDate; /* date and time of last modification */ + UINT32BE backupDate; /* date and time of last backup */ + mac_DInfo userInfo; /* Finder information */ + mac_DXInfo finderInfo; /* additional Finder information */ + UINT32BE reserved[4]; /* reserved - set to zero */ +}; + +/* + HFS catalog data record for a file - 102 bytes +*/ +struct hfs_catFileData +{ + UINT16BE recordType; /* record type */ + UINT8 flags; /* file flags */ + UINT8 fileType; /* file type (reserved, always 0?) */ + mac_FInfo userInfo; /* Finder information */ + UINT32BE fileID; /* file ID */ + UINT16BE dataStartBlock; /* not used - set to zero */ + UINT32BE dataLogicalSize; /* logical EOF of data fork */ + UINT32BE dataPhysicalSize; /* physical EOF of data fork */ + UINT16BE rsrcStartBlock; /* not used - set to zero */ + UINT32BE rsrcLogicalSize; /* logical EOF of resource fork */ + UINT32BE rsrcPhysicalSize; /* physical EOF of resource fork */ + UINT32BE createDate; /* date and time of creation */ + UINT32BE modifyDate; /* date and time of last modification */ + UINT32BE backupDate; /* date and time of last backup */ + mac_FXInfo finderInfo; /* additional Finder information */ + UINT16BE clumpSize; /* file clump size (not used) */ + hfs_extent_3 dataExtents; /* first data fork extent record */ + hfs_extent_3 rsrcExtents; /* first resource fork extent record */ + UINT32BE reserved; /* reserved - set to zero */ +}; + +/* + HFS catalog data record for a thread - 46 bytes + + The key for a thread record features the CNID of the item and an empty + name, instead of the CNID of the parent and the item name. +*/ +struct hfs_catThreadData +{ + UINT16BE recordType; /* record type */ + UINT32BE reserved[2]; /* reserved - set to zero */ + UINT32BE parID; /* parent ID for this catalog node */ + mac_str31 nodeName; /* name of this catalog node */ +}; + +/* + union for all types at once +*/ +union hfs_catData +{ + UINT16BE dataType; + hfs_catFolderData folder; + hfs_catFileData file; + hfs_catThreadData thread; +}; + +/* + HFS catalog record types +*/ +enum +{ + hcrt_Folder = 0x0100, /* Folder record */ + hcrt_File = 0x0200, /* File record */ + hcrt_FolderThread = 0x0300, /* Folder thread record */ + hcrt_FileThread = 0x0400 /* File thread record */ +}; + +/* + Catalog file record flags + + This is similar to the MFS catalog flag field, but the "thread exists" flag + (0x02) is specific to HFS/HFS+, whereas the "Record in use" flag (0x80) is + only used by MFS. +*/ +enum +{ + cfrf_fileLocked = 0x01, /* file is locked and cannot be written to */ + cfrf_threadExists = 0x02 /* a file thread record exists for this file */ +}; + +/* + BT functions used by HFS functions +*/ +struct BT_leaf_rec_enumerator +{ + mac_BTref *BTref; + UINT32 cur_node; + int cur_rec; +}; + +static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void *key1, const void *key2), int is_extent); +static void BT_close(mac_BTref *BTref); +static imgtoolerr_t BT_search_leaf_rec(mac_BTref *BTref, const void *search_key, + UINT32 *node_ID, int *record_ID, + void **record_ptr, int *record_len, + int search_exact_match, int *match_found); +static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, int rec_len, void **data_ptr, int *data_len); +static imgtoolerr_t BT_leaf_rec_enumerator_open(mac_BTref *BTref, BT_leaf_rec_enumerator *enumerator); +static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerator, void **record_ptr, int *rec_len); + +struct hfs_cat_enumerator +{ + struct mac_l2_imgref *l2_img; + BT_leaf_rec_enumerator BT_enumerator; + UINT32 parID; +}; + +/* + hfs_open_extents_file + + Open the file extents B-tree file + + l2_img (I/O): level-2 image reference + mdb (I): copy of the MDB block + fileref (O): mac open file reference + + Return imgtool error code +*/ +static imgtoolerr_t hfs_open_extents_file(struct mac_l2_imgref *l2_img, const struct hfs_mdb *mdb, struct mac_fileref *fileref) +{ + assert(l2_img->format == L2I_HFS); + + fileref->l2_img = l2_img; + + fileref->fileID = 3; + fileref->forkType = (mac_forkID)0x00; + + fileref->eof = fileref->pLen = get_UINT32BE(mdb->xtFlSize); + memcpy(fileref->hfs.extents, mdb->xtExtRec, sizeof(hfs_extent_3)); + + fileref->crPs = 0; + + fileref->reload_buf = TRUE; + + return IMGTOOLERR_SUCCESS; +} + +/* + hfs_open_cat_file + + Open the disk catalog B-tree file + + l2_img (I/O): level-2 image reference + mdb (I): copy of the MDB block + fileref (O): mac open file reference + + Return imgtool error code +*/ +static imgtoolerr_t hfs_open_cat_file(struct mac_l2_imgref *l2_img, const struct hfs_mdb *mdb, struct mac_fileref *fileref) +{ + assert(l2_img->format == L2I_HFS); + + fileref->l2_img = l2_img; + + fileref->fileID = 4; + fileref->forkType = (mac_forkID)0x00; + + fileref->eof = fileref->pLen = get_UINT32BE(mdb->ctFlSize); + memcpy(fileref->hfs.extents, mdb->ctExtRec, sizeof(hfs_extent_3)); + + fileref->crPs = 0; + + fileref->reload_buf = TRUE; + + return IMGTOOLERR_SUCCESS; +} + +/* + hfs_extentKey_compare + + key compare function for file extents B-tree + + p1 (I): pointer to first key + p2 (I): pointer to second key + + Return a zero the two keys are equal, a negative value if the key pointed + to by p1 is less than the key pointed to by p2, and a positive value if the + key pointed to by p1 is greater than the key pointed to by p2. +*/ +static int hfs_extentKey_compare(const void *p1, const void *p2) +{ + const hfs_extentKey *key1 = (const hfs_extentKey*)p1; + const hfs_extentKey *key2 = (const hfs_extentKey*)p2; + + /* let's keep it simple for now */ + return memcmp(key1, key2, sizeof(hfs_extentKey)); +} + +/* + hfs_catKey_compare + + key compare function for disk catalog B-tree + + p1 (I): pointer to first key + p2 (I): pointer to second key + + Return a zero the two keys are equal, a negative value if the key pointed + to by p1 is less than the key pointed to by p2, and a positive value if the + key pointed to by p1 is greater than the key pointed to by p2. +*/ +static int hfs_catKey_compare(const void *p1, const void *p2) +{ + const hfs_catKey *key1 = (const hfs_catKey *)p1; + const hfs_catKey *key2 = (const hfs_catKey *)p2; + + if (get_UINT32BE(key1->parID) != get_UINT32BE(key2->parID)) + return (get_UINT32BE(key1->parID) < get_UINT32BE(key2->parID)) ? -1 : +1; + + return mac_stricmp(key1->cName, key2->cName); +} + +/* + hfs_image_open + + Open a HFS image. Image must already be open on level 1. + + l2_img (I/O): level-2 image reference to open (l1_img and format fields + must be initialized) + img_open_buf (I): buffer with the MDB block + + Return imgtool error code +*/ +static imgtoolerr_t hfs_image_open(imgtool_image *image, imgtool_stream *stream) +{ + imgtoolerr_t err; + struct mac_l2_imgref *l2_img; + img_open_buf buf_local; + img_open_buf *buf; + + l2_img = get_imgref(image); + l2_img->l1_img.image = image; + l2_img->l1_img.heads = 2; + l2_img->format = L2I_HFS; + + /* read MDB */ + err = image_read_block(&l2_img->l1_img, 2, &buf_local.raw); + if (err) + return err; + buf = &buf_local; + + /* check signature word */ + if ((buf->hfs_mdb.sigWord[0] != 0x42) || (buf->hfs_mdb.sigWord[1] != 0x44) + || (buf->hfs_mdb.VN[0] > 27)) + return IMGTOOLERR_CORRUPTIMAGE; + + l2_img->u.hfs.VBM_start = get_UINT16BE(buf->hfs_mdb.VBMSt); + + l2_img->numABs = get_UINT16BE(buf->hfs_mdb.nmAlBlks); + if (get_UINT32BE(buf->hfs_mdb.alBlkSiz) % 512) + return IMGTOOLERR_CORRUPTIMAGE; + l2_img->blocksperAB = get_UINT32BE(buf->hfs_mdb.alBlkSiz) / 512; + l2_img->u.hfs.ABStart = get_UINT16BE(buf->hfs_mdb.alBlSt); + + l2_img->nxtCNID = get_UINT32BE(buf->hfs_mdb.nxtCNID); + + l2_img->freeABs = get_UINT16BE(buf->hfs_mdb.freeABs); + + mac_strcpy(l2_img->u.hfs.volname, buf->hfs_mdb.VN); + + /* open extents and catalog BT */ + err = hfs_open_extents_file(l2_img, &buf->hfs_mdb, &l2_img->u.hfs.extents_BT.fileref); + if (err) + return err; + err = BT_open(&l2_img->u.hfs.extents_BT, hfs_extentKey_compare, TRUE); + if (err) + return err; + if ((l2_img->u.hfs.extents_BT.attributes & btha_bigKeysMask) + /*|| (l2_img->u.hfs.extents_BT.attributes & kBTVariableIndexKeysMask)*/ + || (l2_img->u.hfs.extents_BT.maxKeyLength != 7)) + { /* This is not supported by the HFS format */ + /* Variable Index keys are not supported either, but hopefully it will + not break this imgtool module if it set (though it would probably break + a real macintosh) */ + BT_close(&l2_img->u.hfs.extents_BT); + return IMGTOOLERR_CORRUPTIMAGE; + } + err = hfs_open_cat_file(l2_img, &buf->hfs_mdb, &l2_img->u.hfs.cat_BT.fileref); + if (err) + { + BT_close(&l2_img->u.hfs.extents_BT); + return err; + } + err = BT_open(&l2_img->u.hfs.cat_BT, hfs_catKey_compare, FALSE); + if (err) + { + return err; + } + if ((l2_img->u.hfs.cat_BT.attributes & btha_bigKeysMask) + /*|| (l2_img->u.hfs.cat_BT.attributes & kBTVariableIndexKeysMask)*/ + || (l2_img->u.hfs.cat_BT.maxKeyLength != 37)) + { /* This is not supported by the HFS format */ + /* Variable Index keys are not supported either, but hopefully it will + not break this imgtool module if it set (though it would probably break + a real macintosh) */ + BT_close(&l2_img->u.hfs.extents_BT); + BT_close(&l2_img->u.hfs.cat_BT); + return IMGTOOLERR_CORRUPTIMAGE; + } + + /* extract volume bitmap */ + { + int byte_len = (l2_img->numABs + 7) / 8; + int cur_byte = 0; + int cur_block = l2_img->u.hfs.VBM_start; + + while (cur_byte < byte_len) + { + /* read next block */ + err = image_read_block(&l2_img->l1_img, cur_block, buf->raw); + if (err) + return err; + cur_block++; + + /* append this block to VBM */ + memcpy(l2_img->u.hfs.VBM+cur_byte, buf->raw, 512); + cur_byte += 512; + } + } + + return IMGTOOLERR_SUCCESS; +} + +#ifdef UNUSED_FUNCTION +/* + hfs_image_close + + Close a HFS image. + + l2_img (I/O): level-2 image reference +*/ +static void hfs_image_close(struct mac_l2_imgref *l2_img) +{ + assert(l2_img->format == L2I_HFS); + + BT_close(&l2_img->u.hfs.extents_BT); + BT_close(&l2_img->u.hfs.cat_BT); +} +#endif + +/* + hfs_get_cat_record_data + + extract data from a catalog B-tree leaf record + + l2_img (I/O): level-2 image reference + rec_raw (I): pointer to record key and data, as returned by + BT_node_get_keyed_record + rec_len (I): total length of record, as returned by + BT_node_get_keyed_record + rec_key (O): set to point to record key + rec_data (O): set to point to record data + + Return imgtool error code +*/ +static imgtoolerr_t hfs_get_cat_record_data(struct mac_l2_imgref *l2_img, void *rec_raw, int rec_len, hfs_catKey **rec_key, hfs_catData **rec_data) +{ + hfs_catKey *lrec_key; + void *rec_data_raw; + hfs_catData *lrec_data; + int rec_data_len; + int min_data_size; + imgtoolerr_t err; + + + assert(l2_img->format == L2I_HFS); + + lrec_key = (hfs_catKey*)rec_raw; + /* check that key is long enough to hold it all */ + if ((lrec_key->keyLen+1) < (offsetof(hfs_catKey, cName) + lrec_key->cName[0] + 1)) + return IMGTOOLERR_CORRUPTIMAGE; + + /* get pointer to record data */ + err = BT_get_keyed_record_data(&l2_img->u.hfs.cat_BT, rec_raw, rec_len, &rec_data_raw, &rec_data_len); + if (err) + return err; + lrec_data = (hfs_catData*)rec_data_raw; + + /* extract record type */ + if (rec_data_len < 2) + return IMGTOOLERR_CORRUPTIMAGE; + + /* check that the record is large enough for its type */ + switch (get_UINT16BE(lrec_data->dataType)) + { + case hcrt_Folder: + min_data_size = sizeof(hfs_catFolderData); + break; + + case hcrt_File: + min_data_size = sizeof(hfs_catFileData); + break; + + case hcrt_FolderThread: + case hcrt_FileThread: + min_data_size = sizeof(hfs_catThreadData); + break; + + default: + /* records of unknown type can be safely ignored */ + min_data_size = 0; + break; + } + + if (rec_data_len < min_data_size) + return IMGTOOLERR_CORRUPTIMAGE; + + if (rec_key) + *rec_key = lrec_key; + if (rec_data) + *rec_data = lrec_data; + + return IMGTOOLERR_SUCCESS; +} + +/* + hfs_cat_open + + Open an enumerator on the disk catalog + + l2_img (I/O): level-2 image reference + enumerator (O): open catalog enumerator reference + + Return imgtool error code +*/ +static imgtoolerr_t hfs_cat_open(struct mac_l2_imgref *l2_img, const char *path, hfs_cat_enumerator *enumerator) +{ + imgtoolerr_t err; + UINT32 parID; + mac_str255 filename; + mac_dirent cat_info; + + assert(l2_img->format == L2I_HFS); + + /* resolve path and fetch file info from directory/catalog */ + err = mac_lookup_path(l2_img, path, &parID, filename, &cat_info, FALSE); + if (err) + return err; + if (cat_info.dataRecType != hcrt_Folder) + return IMGTOOLERR_FILENOTFOUND; + + enumerator->l2_img = l2_img; + enumerator->parID = parID; + + return BT_leaf_rec_enumerator_open(&l2_img->u.hfs.cat_BT, &enumerator->BT_enumerator); +} + +/* + hfs_cat_read + + Enumerate the disk catalog + + enumerator (I/O): open catalog enumerator reference + rec_key (O): set to point to record key + rec_data (O): set to point to record data + + Return imgtool error code +*/ +static imgtoolerr_t hfs_cat_read(hfs_cat_enumerator *enumerator, hfs_catKey **rec_key, hfs_catData **rec_data) +{ + void *rec; + int rec_len = 0; + imgtoolerr_t err; + + + *rec_key = NULL; + *rec_data = NULL; + + /* read next record */ + err = BT_leaf_rec_enumerator_read(&enumerator->BT_enumerator, &rec, &rec_len); + if (err) + return err; + + /* check EOList condition */ + if (rec == NULL) + return IMGTOOLERR_SUCCESS; + + /* extract record data */ + err = hfs_get_cat_record_data(enumerator->l2_img, rec, rec_len, rec_key, rec_data); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + +/* + hfs_cat_search + + Search the catalog for a given file + + l2_img (I/O): level-2 image reference + parID (I): CNID of file parent directory + cName (I): file name + rec_key (O): set to point to record key + rec_data (O): set to point to record data + + Return imgtool error code +*/ +static imgtoolerr_t hfs_cat_search(struct mac_l2_imgref *l2_img, UINT32 parID, const mac_str31 cName, hfs_catKey **rec_key, hfs_catData **rec_data) +{ + hfs_catKey search_key; + void *rec; + int rec_len; + imgtoolerr_t err; + + assert(l2_img->format == L2I_HFS); + + if (cName[0] > 31) + return IMGTOOLERR_UNEXPECTED; + + /* generate search key */ + search_key.keyLen = search_key.resrv1 = 0; /* these fields do not matter + to the compare function, so we + don't fill them */ + set_UINT32BE(&search_key.parID, parID); + mac_strcpy(search_key.cName, cName); + + /* search key */ + err = BT_search_leaf_rec(&l2_img->u.hfs.cat_BT, &search_key, NULL, NULL, &rec, &rec_len, TRUE, NULL); + if (err) + return err; + + /* extract record data */ + err = hfs_get_cat_record_data(l2_img, rec, rec_len, rec_key, rec_data); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + +/* + hfs_lookup_path + + Resolve a file path + + l2_img (I/O): level-2 image reference + fpath (I): file path (C string) + parID (O): set to the CNID of the file parent directory + filename (O): set to the actual name of the file, with capitalization matching + the one on the volume rather than the one in the fpath parameter (Mac + string) + cat_info (O): catalog info for this file extracted from the catalog file + (may be NULL) + + Return imgtool error code +*/ +static imgtoolerr_t hfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info) +{ + const char *element_start; + int element_len; + mac_str255 mac_element_name; + //int level; + imgtoolerr_t err; + hfs_catKey *catrec_key = NULL; + hfs_catData *catrec_data = NULL; + UINT16 dataRecType = hcrt_Folder; + + /* iterate each path element */ + element_start = fpath; + //level = 0; + *parID = 2; /* root parID is 2 */ + + while(*element_start) + { + /* find next path element */ + element_len = strlen(element_start); + /* decode path element name */ + c_to_mac_strncpy(mac_element_name, element_start, element_len); + + err = hfs_cat_search(l2_img, *parID, mac_element_name, &catrec_key, &catrec_data); + if (err) + return err; + + dataRecType = get_UINT16BE(catrec_data->dataType); + + /* regular folder/file name */ + if (dataRecType == hcrt_Folder) + *parID = get_UINT32BE(catrec_data->folder.folderID); + else if (element_start[element_len + 1]) + return IMGTOOLERR_BADFILENAME; + + /* iterate */ + element_start += element_len + 1; + } + + if (catrec_key && (dataRecType == hcrt_File)) + { + /* save ref */ + *parID = get_UINT32BE(catrec_key->parID); + mac_strcpy(filename, catrec_key->cName); + } + + if (cat_info) + { + if (catrec_data && (dataRecType == hcrt_File)) + { + cat_info->flFinderInfo = catrec_data->file.userInfo; + cat_info->flXFinderInfo = catrec_data->file.finderInfo; + cat_info->flags = catrec_data->file.flags; + cat_info->fileID = get_UINT32BE(catrec_data->file.fileID); + cat_info->dataLogicalSize = get_UINT32BE(catrec_data->file.dataLogicalSize); + cat_info->dataPhysicalSize = get_UINT32BE(catrec_data->file.dataPhysicalSize); + cat_info->rsrcLogicalSize = get_UINT32BE(catrec_data->file.rsrcLogicalSize); + cat_info->rsrcPhysicalSize = get_UINT32BE(catrec_data->file.rsrcPhysicalSize); + cat_info->createDate = get_UINT32BE(catrec_data->file.createDate); + cat_info->modifyDate = get_UINT32BE(catrec_data->file.modifyDate); + } + else + { + memset(cat_info, 0, sizeof(*cat_info)); + } + cat_info->dataRecType = dataRecType; + } + + return IMGTOOLERR_SUCCESS; +} + +/* + hfs_file_open_internal + + Open a file fork, given its catalog entry. This function should not be + called directly: call hfs_file_open instead. + + l2_img (I/O): level-2 image reference + file_rec (I): catalog entry for the file to open + mac_forkID (I): tells which fork should be opened + fileref (O): mac file reference to open + + Return imgtool error code +*/ +static imgtoolerr_t hfs_file_open_internal(struct mac_l2_imgref *l2_img, const hfs_catFileData *file_rec, mac_forkID fork, struct mac_fileref *fileref) +{ + assert(l2_img->format == L2I_HFS); + + fileref->l2_img = l2_img; + + fileref->fileID = get_UINT32BE(file_rec->fileID); + fileref->forkType = fork; + + switch (fork) + { + case data_fork: + fileref->eof = get_UINT32BE(file_rec->dataLogicalSize); + fileref->pLen = get_UINT32BE(file_rec->dataPhysicalSize); + memcpy(fileref->hfs.extents, file_rec->dataExtents, sizeof(hfs_extent_3)); + break; + + case rsrc_fork: + fileref->eof = get_UINT32BE(file_rec->rsrcLogicalSize); + fileref->pLen = get_UINT32BE(file_rec->rsrcPhysicalSize); + memcpy(fileref->hfs.extents, file_rec->rsrcExtents, sizeof(hfs_extent_3)); + break; + } + + fileref->crPs = 0; + + fileref->reload_buf = TRUE; + + return IMGTOOLERR_SUCCESS; +} + +/* + hfs_file_open + + Open a file located on a HFS volume. This function should not be called + directly: call mac_file_open instead. + + l2_img (I/O): level-2 image reference + parID (I): CNID of file parent directory + filename (I): name of the file (Mac string) + mac_forkID (I): tells which fork should be opened + fileref (O): mac file reference to open + + Return imgtool error code +*/ +static imgtoolerr_t hfs_file_open(struct mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref) +{ + hfs_catKey *catrec_key; + hfs_catData *catrec_data; + UINT16 dataRecType; + imgtoolerr_t err; + + /* lookup file in catalog */ + err = hfs_cat_search(l2_img, parID, filename, &catrec_key, &catrec_data); + if (err) + return err; + + dataRecType = get_UINT16BE(catrec_data->dataType); + + /* file expected */ + if (dataRecType != hcrt_File) + return IMGTOOLERR_BADFILENAME; + + fileref->hfs.parID = get_UINT32BE(catrec_key->parID); + mac_strcpy(fileref->hfs.filename, catrec_key->cName); + + /* open it */ + return hfs_file_open_internal(l2_img, &catrec_data->file, fork, fileref); +} + +/* + hfs_file_get_nth_block_address + + Get the disk block address of a given block in an open file on a MFS image. + Called by macintosh file code. + + fileref (I/O): open mac file reference + block_num (I): file block index + block_address (O): disk block address for the file block + + Return imgtool error code +*/ +static imgtoolerr_t hfs_file_get_nth_block_address(struct mac_fileref *fileref, UINT32 block_num, UINT32 *block_address) +{ + UINT32 AB_num; + UINT32 cur_AB; + UINT32 i; + void *cur_extents_raw; + hfs_extent *cur_extents; + int cur_extents_len; + void *extents_BT_rec; + int extents_BT_rec_len; + imgtoolerr_t err; + UINT16 AB_address; + + assert(fileref->l2_img->format == L2I_HFS); + + AB_num = block_num / fileref->l2_img->blocksperAB; + cur_AB = 0; + cur_extents = fileref->hfs.extents; + + /* first look in catalog tree extents */ + for (i=0; i<3; i++) + { + if (AB_num < cur_AB+get_UINT16BE(cur_extents[i].numABlks)) + break; + cur_AB += get_UINT16BE(cur_extents[i].numABlks); + } + if (i == 3) + { + /* extent not found: read extents record from extents BT */ + hfs_extentKey search_key; + hfs_extentKey *found_key; + + search_key.keyLength = keyLength_hfs_extentKey; + search_key.forkType = fileref->forkType; + set_UINT32BE(&search_key.fileID, fileref->fileID); + set_UINT16BE(&search_key.startBlock, AB_num); + + /* search for the record with the largest key lower than or equal to + search_key. The keys are constructed in such a way that, if a record + includes AB_num, it is that one. */ + err = BT_search_leaf_rec(&fileref->l2_img->u.hfs.extents_BT, &search_key, + NULL, NULL, &extents_BT_rec, &extents_BT_rec_len, + FALSE, NULL); + if (err) + return err; + + if (extents_BT_rec == NULL) + return IMGTOOLERR_CORRUPTIMAGE; + + found_key = (hfs_extentKey*)extents_BT_rec; + /* check that this record concerns the correct file */ + if ((found_key->forkType != fileref->forkType) + || (get_UINT32BE(found_key->fileID) != fileref->fileID)) + return IMGTOOLERR_CORRUPTIMAGE; + + /* extract start AB */ + cur_AB = get_UINT16BE(found_key->startBlock); + /* get extents pointer */ + err = BT_get_keyed_record_data(&fileref->l2_img->u.hfs.extents_BT, extents_BT_rec, extents_BT_rec_len, &cur_extents_raw, &cur_extents_len); + if (err) + return err; + if (cur_extents_len < 3*sizeof(hfs_extent)) + return IMGTOOLERR_CORRUPTIMAGE; + cur_extents = (hfs_extent*)cur_extents_raw; + + /* pick correct extent in record */ + for (i=0; i<3; i++) + { + if (AB_num < cur_AB+get_UINT16BE(cur_extents[i].numABlks)) + break; + cur_AB += get_UINT16BE(cur_extents[i].numABlks); + } + if (i == 3) + /* extent not found */ + return IMGTOOLERR_CORRUPTIMAGE; + } + + AB_address = get_UINT16BE(cur_extents[i].stABN) + (AB_num-cur_AB); + + if (AB_address >= fileref->l2_img->numABs) + return IMGTOOLERR_CORRUPTIMAGE; + + *block_address = fileref->l2_img->u.hfs.ABStart + AB_address * fileref->l2_img->blocksperAB + + block_num % fileref->l2_img->blocksperAB; + + return IMGTOOLERR_SUCCESS; +} + +#if 0 +#pragma mark - +#pragma mark B-TREE IMPLEMENTATION +#endif + +/* + B-tree (Balanced search tree) files are used by the HFS and HFS+ file + systems: the Extents and Catalog files are both B-Tree. + + Note that these B-trees are B+-trees: data is only on the leaf level, and + nodes located on the same level are also linked sequentially, which allows + fast sequenctial access to the catalog file. + + These files are normal files, except for the fact that they are not + referenced from the catalog but the MDB. They are allocated in fixed-size + records of 512 bytes (HFS). (HFS+ supports any power of two from 512 + through 32768, and uses a default of 1024 for Extents, and 4096 for both + Catalog and Attributes.) + + Nodes can contain any number of records. The nodes can be of any of four + types: header node (unique node with b-tree information, pointer to root + node and start of the node allocation bitmap), map nodes (which are created + when the node allocation bitmap outgrows the header node), index nodes + (root and branch node that enable to efficiently search the leaf nodes for + a specific key value), and leaf nodes (which hold the actual user data + records with keys and data). The first node is always a header node. + Other nodes can be of any of the 3 other type, or they can be free. +*/ + +/* + BTNodeHeader + + Header of a node record +*/ +struct BTNodeHeader +{ + UINT32BE fLink; /* (index of) next node at this level */ + UINT32BE bLink; /* (index of) previous node at this level */ + UINT8 kind; /* kind of node (leaf, index, header, map) */ + UINT8 height; /* zero for header, map; 1 for leaf, 2 through + treeDepth for index (child is one LESS than + parent, whatever IM says) */ + UINT16BE numRecords; /* number of records in this node */ + UINT16BE reserved; /* reserved; set to zero */ +}; + +/* + Constants for BTNodeHeader kind field +*/ +enum +{ + btnk_leafNode = 0xff, /* leaf nodes hold the actual user data records + with keys and data */ + btnk_indexNode = 0, /* root and branch node that enable to efficiently + search the leaf nodes for a specific key value */ + btnk_headerNode = 1, /* unique node with b-tree information, pointer to + root node and start of the node allocation + bitmap */ + btnk_mapNode = 2 /* map nodes are created when the node allocation + bitmap outgrows the header node */ +}; + +/* + BTHeaderRecord: first record of a B-tree header node (second record is + unused, and third is node allocation bitmap). +*/ +struct BTHeaderRecord +{ + UINT16BE treeDepth; /* maximum height (usually leaf nodes) */ + UINT32BE rootNode; /* node number of root node */ + UINT32BE leafRecords; /* number of leaf records in all leaf nodes */ + UINT32BE firstLeafNode; /* node number of first leaf node */ + UINT32BE lastLeafNode; /* node number of last leaf node */ + UINT16BE nodeSize; /* size of a node, in bytes */ + UINT16BE maxKeyLength; /* maximum length of data (index + leaf) record keys; + length of all index record keys if + btha_variableIndexKeysMask attribute flag is not set */ + UINT32BE totalNodes; /* total number of nodes in tree */ + UINT32BE freeNodes; /* number of unused (free) nodes in tree */ + + UINT16BE reserved1; /* unused */ + UINT32BE clumpSize; /* used in some HFS implementations? (reserved in + early HFS implementations, and in HFS Plus) */ + UINT8 btreeType; /* reserved - set to 0 */ + UINT8 reserved2; /* reserved */ + UINT32BE attributes; /* persistent attributes about the tree */ + UINT32BE reserved3[16]; /* reserved */ +}; + +static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent); + +/* + BT_open + + Open a file as a B-tree. The file must be already open as a macintosh + file. + + BTref (I/O): B-tree file handle to open (BTref->fileref must have been + open previously) + key_compare_func (I): function that compares two keys + is_extent (I): TRUE if we are opening the extent B-tree (we want to do + extra checks in this case because the extent B-Tree may include extent + records for the extent B-tree itself, and if an extent record for the + extent B-tree is located in an extent that has not been defined by + previous extent records, then we can never retreive this extent record) + + Return imgtool error code +*/ +static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void *key1, const void *key2), int is_extent) +{ + imgtoolerr_t err; + BTNodeHeader node_header; + BTHeaderRecord header_rec; + + /* seek to node 0 */ + err = mac_file_seek(&BTref->fileref, 0); + if (err) + return err; + + /* read node header */ + err = mac_file_read(&BTref->fileref, sizeof(node_header), &node_header); + if (err) + return err; + + if ((node_header.kind != btnk_headerNode) || (get_UINT16BE(node_header.numRecords) < 3) + || (node_header.height != 0)) + return IMGTOOLERR_CORRUPTIMAGE; /* right??? */ + + /* CHEESY HACK: we assume that the header record immediately follows the + node header. This is because we need to know the node length to know where + the record pointers are located, but we need to read the header record to + know the node length. */ + err = mac_file_read(&BTref->fileref, sizeof(header_rec), &header_rec); + if (err) + return err; + + BTref->nodeSize = get_UINT16BE(header_rec.nodeSize); + BTref->rootNode = get_UINT32BE(header_rec.rootNode); + BTref->firstLeafNode = get_UINT32BE(header_rec.firstLeafNode); + BTref->attributes = get_UINT32BE(header_rec.attributes); + BTref->treeDepth = get_UINT16BE(header_rec.treeDepth); + BTref->maxKeyLength = get_UINT16BE(header_rec.maxKeyLength); + + BTref->key_compare_func = key_compare_func; + + BTref->node_buf = malloc(BTref->nodeSize); + if (!BTref->node_buf) + return IMGTOOLERR_OUTOFMEMORY; + + if (BTREE_CHECKS) + { + /* optional: check integrity of B-tree */ + err = BT_check(BTref, is_extent); + if (err) + return err; + } + + return IMGTOOLERR_SUCCESS; +} + +/* + BT_close + + Close a B-tree + + BTref (I/O): open B-tree file handle +*/ +static void BT_close(mac_BTref *BTref) +{ + free(BTref->node_buf); +} + +/* + BT_read_node + + Read a node from a B-tree + + BTref (I/O): open B-tree file handle + node_ID (I): index of the node to read + expected_kind (I): kind of the node to read + expected_depth (I): depth of the node to read + dest (O): destination buffer + + Return imgtool error code +*/ +static imgtoolerr_t BT_read_node(mac_BTref *BTref, UINT32 node_ID, int expected_kind, int expected_depth, void *dest) +{ + imgtoolerr_t err; + + /* seek to node */ + err = mac_file_seek(&BTref->fileref, node_ID*BTref->nodeSize); + if (err) + return err; + + /* read it */ + err = mac_file_read(&BTref->fileref, BTref->nodeSize, dest); + if (err) + return err; + + /* check node kind and depth */ + if ((((BTNodeHeader *) dest)->kind != expected_kind) + || (((BTNodeHeader *) dest)->height != expected_depth)) + return IMGTOOLERR_CORRUPTIMAGE; + + return IMGTOOLERR_SUCCESS; +} + +/* + BT_node_get_record + + Extract a raw record from a B-tree node + + BTref (I/O): open B-tree file handle + node_buf (I): buffer with the node the record should be extracted from + recnum (I): index of record to read + rec_ptr (O): set to point to start of record (key + data) + rec_len (O): set to total length of record (key + data) + + Return imgtool error code +*/ +static imgtoolerr_t BT_node_get_record(mac_BTref *BTref, void *node_buf, unsigned recnum, void **rec_ptr, int *rec_len) +{ + UINT16 node_numRecords = get_UINT16BE(((BTNodeHeader *) node_buf)->numRecords); + UINT16 offset; + UINT16 next_offset; + + if (recnum >= node_numRecords) + return IMGTOOLERR_UNEXPECTED; + + offset = get_UINT16BE(((UINT16BE *)((UINT8 *) node_buf + BTref->nodeSize))[-recnum-1]); + next_offset = get_UINT16BE(((UINT16BE *)((UINT8 *) node_buf + BTref->nodeSize))[-recnum-2]); + + if ((offset < sizeof(BTNodeHeader)) || (offset > BTref->nodeSize-2*node_numRecords) + || (next_offset < sizeof(BTNodeHeader)) || (next_offset > BTref->nodeSize-2*node_numRecords) + || (offset & 1) || (next_offset & 1) + || (offset > next_offset)) + return IMGTOOLERR_CORRUPTIMAGE; + + *rec_ptr = (UINT8 *)node_buf + offset; + *rec_len = next_offset - offset; + + return IMGTOOLERR_SUCCESS; +} + +/* + BT_node_get_keyed_record + + Extract a keyed record from a B-tree node. Equivalent to + BT_node_get_record, only we do extra checks. + + BTref (I/O): open B-tree file handle + node_buf (I): buffer with the node the record should be extracted from + node_is_index (I): TRUE if node is index node + recnum (I): index of record to read + rec_ptr (O): set to point to start of record (key + data) + rec_len (O): set to total length of record (key + data) + + Return imgtool error code +*/ +static imgtoolerr_t BT_node_get_keyed_record(mac_BTref *BTref, void *node_buf, int node_is_index, unsigned recnum, void **rec_ptr, int *rec_len) +{ + imgtoolerr_t err; + void *lrec_ptr; + int lrec_len; + int key_len; + + /* extract record */ + err = BT_node_get_record(BTref, node_buf, recnum, &lrec_ptr, &lrec_len); + if (err) + return err; + + /* read key len */ + key_len = (BTref->attributes & btha_bigKeysMask) + ? get_UINT16BE(* (UINT16BE *)lrec_ptr) + : (* (UINT8 *)lrec_ptr); + + /* check that key fits in record */ + if ((key_len + ((BTref->attributes & btha_bigKeysMask) ? 2 : 1)) > lrec_len) + /* hurk! */ + return IMGTOOLERR_CORRUPTIMAGE; + + if (key_len > BTref->maxKeyLength) + return IMGTOOLERR_CORRUPTIMAGE; + + if (node_is_index && (! (BTref->attributes & btha_variableIndexKeysMask)) && (key_len != BTref->maxKeyLength)) + return IMGTOOLERR_CORRUPTIMAGE; + + if (rec_ptr) + *rec_ptr = lrec_ptr; + if (rec_len) + *rec_len = lrec_len; + + return IMGTOOLERR_SUCCESS; +} + +/* + BT_get_keyed_record_data + + extract data from a keyed record + + BTref (I/O): open B-tree file handle + rec_ptr (I): point to start of record (key + data) + rec_len (I): total length of record (key + data) + data_ptr (O): set to point to record data + data_len (O): set to length of record data + + Return imgtool error code +*/ +static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, int rec_len, void **data_ptr, int *data_len) +{ + int lkey_len; + int data_offset; + + /* read key len */ + lkey_len = (BTref->attributes & btha_bigKeysMask) + ? get_UINT16BE(* (UINT16BE *)rec_ptr) + : (* (UINT8 *)rec_ptr); + + /* compute offset to data record */ + data_offset = lkey_len + ((BTref->attributes & btha_bigKeysMask) ? 2 : 1); + if (data_offset > rec_len) + /* hurk! */ + return IMGTOOLERR_CORRUPTIMAGE; + /* fix alignment */ + if (data_offset & 1) + data_offset++; + + if (data_ptr) + *data_ptr = (UINT8 *)rec_ptr + data_offset; + if (data_len) + *data_len = (rec_len > data_offset) ? rec_len-data_offset : 0; + + return IMGTOOLERR_SUCCESS; +} + +/* + BT_check + + Check integrity of a complete B-tree + + BTref (I/O): open B-tree file handle + is_extent (I): TRUE if we are opening the extent B-tree (we want to do + extra checks in this case because the extent B-Tree may include extent + records for the extent B-tree itself, and if an extent record for the + extent B-tree is located in an extent that has not been defined by + previous extent records, then we can never retreive this extent record) + + Return imgtool error code +*/ +struct data_nodes_t +{ + void *buf; + UINT32 node_num; + UINT32 cur_rec; + UINT32 num_recs; +}; +static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent) +{ + UINT16 node_numRecords; + BTHeaderRecord *header_rec; + UINT8 *bitmap; + + data_nodes_t *data_nodes; + int i, j; + UINT32 cur_node, prev_node; + void *rec1, *rec2; + int rec1_len, rec2_len; + void *rec1_data; + int rec1_data_len; + UINT32 totalNodes, lastLeafNode; + UINT32 freeNodes; + int compare_result; + UINT32 map_count, map_len; + UINT32 run_len; + UINT32 run_bit_len; + UINT32 actualFreeNodes; + imgtoolerr_t err; + UINT32 maxExtentAB = 0, maxExtentNode = 0, extentEOL = 0; /* if is_extent is TRUE */ + + if (is_extent) + { + switch (BTref->fileref.l2_img->format) + { + case L2I_MFS: + /* MFS does not feature any extents B-tree! */ + return IMGTOOLERR_UNEXPECTED; + + case L2I_HFS: + maxExtentAB = 0; + for (j=0; j<3; j++) + maxExtentAB += get_UINT16BE(BTref->fileref.hfs.extents[j].numABlks); + maxExtentNode = (UINT64)maxExtentAB * 512 * BTref->fileref.l2_img->blocksperAB + / BTref->nodeSize; + extentEOL = FALSE; + break; + } + } + + /* read header node */ + if ((! is_extent) || (0 < maxExtentNode)) + err = BT_read_node(BTref, 0, btnk_headerNode, 0, BTref->node_buf); + else + err = IMGTOOLERR_CORRUPTIMAGE; + if (err) + return err; + + /* check we have enough records */ + node_numRecords = get_UINT16BE(((BTNodeHeader *) BTref->node_buf)->numRecords); + if (node_numRecords < 3) + return IMGTOOLERR_CORRUPTIMAGE; + + /* get header record */ + err = BT_node_get_record(BTref, BTref->node_buf, 0, &rec1, &rec1_len); + if (err) + return err; + header_rec = (BTHeaderRecord *)rec1; + + /* check length of header record */ + if (rec1_len < sizeof(BTHeaderRecord)) + return IMGTOOLERR_CORRUPTIMAGE; + + totalNodes = get_UINT32BE(header_rec->totalNodes); + if (totalNodes == 0) + /* we need at least one header node */ + return IMGTOOLERR_CORRUPTIMAGE; + lastLeafNode = get_UINT32BE(header_rec->lastLeafNode); + freeNodes = get_UINT32BE(header_rec->freeNodes); + + /* check file length */ + if ((BTref->nodeSize * totalNodes) > BTref->fileref.pLen) + return IMGTOOLERR_CORRUPTIMAGE; + + /* initialize for the function postlog ("bail:" tag) */ + err = IMGTOOLERR_SUCCESS; + bitmap = NULL; + data_nodes = NULL; + + /* alloc buffer for reconstructed bitmap */ + map_len = (totalNodes + 7) / 8; + bitmap = (UINT8*)malloc(map_len); + if (! bitmap) + return IMGTOOLERR_OUTOFMEMORY; + memset(bitmap, 0, map_len); + + /* check B-tree data nodes (i.e. index and leaf nodes) */ + if (BTref->treeDepth == 0) + { + /* B-tree is empty */ + if (BTref->rootNode || BTref->firstLeafNode || lastLeafNode) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto bail; + } + } + else + { + /* alloc array of buffers for catalog data nodes */ + data_nodes = (data_nodes_t *)malloc(sizeof(data_nodes_t) * BTref->treeDepth); + if (! data_nodes) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto bail; + } + for (i=0; itreeDepth; i++) + data_nodes[i].buf = NULL; /* required for function postlog to work should next loop fail */ + for (i=0; itreeDepth; i++) + { + data_nodes[i].buf = malloc(BTref->nodeSize); + if (!data_nodes[i].buf) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto bail; + } + } + + /* read first data nodes */ + cur_node = BTref->rootNode; + for (i=BTref->treeDepth-1; i>=0; i--) + { + /* check node index */ + if (cur_node >= totalNodes) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + /* check that node has not been used for another purpose */ + /* this check is unecessary because the current consistency checks + that forward and back linking match and that node height is correct + are enough to detect such errors */ +#if 0 + if (bitmap[cur_node >> 3] & (0x80 >> (cur_node & 7))) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } +#endif + /* add node in bitmap */ + bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7)); + /* read node */ + if ((! is_extent) || (cur_node < maxExtentNode)) + err = BT_read_node(BTref, cur_node, i ? btnk_indexNode : btnk_leafNode, i+1, data_nodes[i].buf); + else + err = IMGTOOLERR_CORRUPTIMAGE; + if (err) + goto bail; + /* check that it is the first node at this level */ + if (get_UINT32BE(((BTNodeHeader *) data_nodes[i].buf)->bLink)) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + /* fill other fields */ + data_nodes[i].node_num = cur_node; + data_nodes[i].cur_rec = 0; + data_nodes[i].num_recs = get_UINT16BE(((BTNodeHeader *) data_nodes[i].buf)->numRecords); + /* check that there is at least one record */ + if (data_nodes[i].num_recs == 0) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + + /* iterate to next level if applicable */ + if (i != 0) + { + /* extract first record */ + err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, TRUE, 0, &rec1, &rec1_len); + if (err) + goto bail; + + /* extract record data ptr */ + err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len); + if (err) + goto bail; + if (rec1_data_len < sizeof(UINT32BE)) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + + /* iterate to next level */ + cur_node = get_UINT32BE(* (UINT32BE *)rec1_data); + } + } + + /* check that a) the root node has no successor, and b) that we have really + read the first leaf node */ + if (get_UINT32BE(((BTNodeHeader *) data_nodes[BTref->treeDepth-1].buf)->fLink) + || (cur_node != BTref->firstLeafNode)) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + + /* check that keys are ordered correctly */ + while (1) + { + /* iterate through parent nodes */ + i = 0; + while ((itreeDepth) && ((data_nodes[i].cur_rec == 0) || (data_nodes[i].cur_rec == data_nodes[i].num_recs))) + { + /* read next node if necessary */ + if (data_nodes[i].cur_rec == data_nodes[i].num_recs) + { + /* get link to next node */ + cur_node = get_UINT32BE(((BTNodeHeader *) data_nodes[i].buf)->fLink); + if (cur_node == 0) + { + if (i == 0) + /* normal End of List */ + goto end_of_list; + else + { + /* error */ + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + } + /* add node in bitmap */ + bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7)); + /* read node */ + if ((! is_extent) || (cur_node < maxExtentNode)) + err = BT_read_node(BTref, cur_node, i ? btnk_indexNode : btnk_leafNode, i+1, data_nodes[i].buf); + else + err = IMGTOOLERR_CORRUPTIMAGE; + if (err) + goto bail; + /* check that backward linking match forward linking */ + if (get_UINT32BE(((BTNodeHeader *) data_nodes[i].buf)->bLink) != data_nodes[i].node_num) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + /* fill other fields */ + data_nodes[i].node_num = cur_node; + data_nodes[i].cur_rec = 0; + data_nodes[i].num_recs = get_UINT16BE(((BTNodeHeader *) data_nodes[i].buf)->numRecords); + /* check that there is at least one record */ + if (data_nodes[i].num_recs == 0) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + /* next test is not necessary because we have checked that + the root node has no successor */ +#if 0 + if (i < BTref->treeDepth-1) + { +#endif + data_nodes[i+1].cur_rec++; +#if 0 + } + else + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } +#endif + } + i++; + } + + if (is_extent && !extentEOL) + { + /* extract current leaf record and update maxExtentAB and + maxExtentNode */ + hfs_extentKey *extentKey; + hfs_extent *extentData; + + /* extract current leaf record */ + err = BT_node_get_keyed_record(BTref, data_nodes[0].buf, FALSE, data_nodes[0].cur_rec, &rec1, &rec1_len); + if (err) + goto bail; + + extentKey = (hfs_extentKey*)rec1; + if ((extentKey->keyLength < 7) || (extentKey->forkType != 0) || (get_UINT32BE(extentKey->fileID) != 3) + || (get_UINT16BE(extentKey->startBlock) != maxExtentAB)) + /* the key is corrupt or does not concern the extent + B-tree: set the extentEOL flag so that we stop looking for + further extent records for the extent B-tree */ + extentEOL = TRUE; + else + { /* this key concerns the extent B-tree: update maxExtentAB + and maxExtentNode */ + /* extract record data ptr */ + err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len); + if (err) + goto bail; + if (rec1_data_len < sizeof(hfs_extent)*3) + /* the record is corrupt: set the extentEOL flag so + that we stop looking for further extent records for the + extent B-tree */ + extentEOL = TRUE; + else + { + extentData = (hfs_extent*)rec1_data; + + for (j=0; j<3; j++) + maxExtentAB += get_UINT16BE(extentData[j].numABlks); + maxExtentNode = (UINT64)maxExtentAB * 512 * BTref->fileref.l2_img->blocksperAB + / BTref->nodeSize; + } + } + if (extentEOL) + { + /* check that the extent B-Tree has been defined entirely */ + if (maxExtentNode < totalNodes) + { /* no good */ + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + } + } + + if (itreeDepth) + { + /* extract current record */ + err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, i > 0, data_nodes[i].cur_rec, &rec1, &rec1_len); + if (err) + goto bail; + + /* extract previous record */ + err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, i > 0, data_nodes[i].cur_rec-1, &rec2, &rec2_len); + if (err) + goto bail; + + /* check that it is sorted correctly */ + compare_result = (*BTref->key_compare_func)(rec1, rec2); + if (compare_result <= 0) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + + i--; + } + else + { + i--; + if (i>0) + { /* extract first record of root if it is an index node */ + err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, TRUE, data_nodes[i].cur_rec, &rec1, &rec1_len); + if (err) + goto bail; + } + i--; + } + + while (i>=0) + { + /* extract first record of current level */ + err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, i > 0, data_nodes[i].cur_rec, &rec2, &rec2_len); + if (err) + goto bail; + + /* compare key with key of current record of upper level */ + compare_result = (*BTref->key_compare_func)(rec1, rec2); + if (compare_result != 0) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + + /* extract record data ptr */ + err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len); + if (err) + goto bail; + if (rec1_data_len < sizeof(UINT32BE)) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + cur_node = get_UINT32BE(* (UINT32BE *)rec1_data); + + /* compare node index with data of current record of upper + level */ + if (cur_node != data_nodes[i].node_num) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + + /* iterate to next level */ + rec1 = rec2; + rec1_len = rec2_len; + i--; + } + + /* next leaf record */ + data_nodes[0].cur_rec++; + } + +end_of_list: + /* check that we are at the end of list for each index level */ + for (i=1; itreeDepth; i++) + { + if ((data_nodes[i].cur_rec != (data_nodes[i].num_recs-1)) + || get_UINT32BE(((BTNodeHeader *) data_nodes[i].buf)->fLink)) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + } + /* check that the last leaf node is what it is expected to be */ + if (data_nodes[0].node_num != lastLeafNode) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + } + + /* check map node chain */ + cur_node = 0; /* node 0 is the header node... */ + bitmap[0] |= 0x80; + /* check back linking */ + if (get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->bLink)) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + /* get pointer to next node */ + cur_node = get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->fLink); + while (cur_node != 0) + { + /* save node address */ + prev_node = cur_node; + /* check that node has not been used for another purpose */ + /* this check is unecessary because the current consistency checks that + forward and back linking match and that node height is correct are + enough to detect such errors */ +#if 0 + if (bitmap[cur_node >> 3] & (0x80 >> (cur_node & 7))) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } +#endif + /* add node in bitmap */ + bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7)); + /* read map node */ + if ((! is_extent) || (cur_node < maxExtentNode)) + err = BT_read_node(BTref, cur_node, btnk_mapNode, 0, BTref->node_buf); + else + err = IMGTOOLERR_CORRUPTIMAGE; + if (err) + goto bail; + /* check back linking */ + if (get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->bLink) != prev_node) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + /* get pointer to next node */ + cur_node = get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->fLink); + } + + /* re-read header node */ + err = BT_read_node(BTref, 0, btnk_headerNode, 0, BTref->node_buf); + if (err) + goto bail; + + /* get header bitmap record */ + err = BT_node_get_record(BTref, BTref->node_buf, 2, &rec1, &rec1_len); + if (err) + goto bail; + + /* check bitmap, iterating map nodes */ + map_count = 0; + actualFreeNodes = 0; + while (map_count < map_len) + { + /* compute compare len */ + run_len = rec1_len; + if (run_len > (map_len-map_count)) + run_len = map_len-map_count; + /* check that all used nodes are marked as such in the B-tree bitmap */ + for (i=0; i (totalNodes-map_count*8)) + run_bit_len = totalNodes-map_count*8; + for (i=0; i>3] & (0x80 >> (i & 7)))) + actualFreeNodes++; + map_count += run_len; + /* read next map node if required */ + if (map_count < map_len) + { + /* get pointer to next node */ + cur_node = get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->fLink); + if (cur_node == 0) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto bail; + } + /* read map node */ + err = BT_read_node(BTref, cur_node, btnk_mapNode, 0, BTref->node_buf); + if (err) + goto bail; + /* get map record */ + err = BT_node_get_record(BTref, BTref->node_buf, 0, &rec1, &rec1_len); + if (err) + goto bail; + header_rec = (BTHeaderRecord *)rec1; + } + } + + /* check free node count */ + if (freeNodes != actualFreeNodes) + return IMGTOOLERR_CORRUPTIMAGE; + +bail: + /* free buffers */ + if (data_nodes) + { + for (i=0; itreeDepth; i++) + if (data_nodes[i].buf) + free(data_nodes[i].buf); + free(data_nodes); + } + if (bitmap) + free(bitmap); + + return err; +} + +/* + BT_search_leaf_rec + + Search for a given key in a B-Tree. If exact match found, returns + corresponding leaf record. Otherwise, may return the greatest record less + than the requested key (of course, this will fail if the key is lower than + all keys in the B-Tree). + + BTref (I/O): open B-tree file handle + search_key (I): key to search the B-Tree for + node_ID (O): set to the node ID of the node the record is located in (may + be NULL) + record_ID (O): set to the index of the record in the node (may be NULL) + record_ptr (O): set to point to record in node buffer (may be NULL) + record_len (O): set to total record len (may be NULL) + search_exact_match (I): if TRUE, the function will search for a record + equal to search_key; if FALSE, the function will search for the + greatest record less than or equal to search_key + match_found (O): set to TRUE if an exact match for search_key has been + found (only makes sense if search_exact_match is FALSE) (may be NULL) + + Return imgtool error code +*/ +static imgtoolerr_t BT_search_leaf_rec(mac_BTref *BTref, const void *search_key, + UINT32 *node_ID, int *record_ID, + void **record_ptr, int *record_len, + int search_exact_match, int *match_found) +{ + imgtoolerr_t err; + int i; + UINT32 cur_node; + void *cur_rec; + int cur_rec_len; + void *last_rec; + int last_rec_len = 0; + void *rec_data; + int rec_data_len; + int depth; + UINT16 node_numRecords; + int compare_result = 0; + + /* start with root node */ + if ((BTref->rootNode == 0) || (BTref->treeDepth == 0)) + /* tree is empty */ + return ((BTref->rootNode == 0) == (BTref->treeDepth == 0)) + ? IMGTOOLERR_FILENOTFOUND + : IMGTOOLERR_CORRUPTIMAGE; + + cur_node = BTref->rootNode; + depth = BTref->treeDepth; + + while (1) + { + /* read current node */ + err = BT_read_node(BTref, cur_node, (depth > 1) ? btnk_indexNode : btnk_leafNode, depth, BTref->node_buf); + if (err) + return err; + + /* search for key */ + node_numRecords = get_UINT16BE(((BTNodeHeader *) BTref->node_buf)->numRecords); + last_rec = cur_rec = NULL; + for (i=0; inode_buf, depth > 1, i, &cur_rec, &cur_rec_len); + if (err) + return err; + + compare_result = (*BTref->key_compare_func)(cur_rec, search_key); + if (compare_result > 0) + break; + last_rec = cur_rec; + last_rec_len = cur_rec_len; + if (compare_result == 0) + break; + } + + if (! last_rec) + { /* all keys are greater than the search key: the search key is + nowhere in the tree */ + if (search_exact_match) + return IMGTOOLERR_FILENOTFOUND; + + if (match_found) + *match_found = FALSE; + + if (node_ID) + *node_ID = 0; + + if (record_ID) + *record_ID = -1; + + if (record_ptr) + *record_ptr = NULL; + + return IMGTOOLERR_SUCCESS; + } + + if (((BTNodeHeader *) BTref->node_buf)->kind == btnk_leafNode) + /* leaf node -> end of search */ + break; + + /* extract record data ptr */ + err = BT_get_keyed_record_data(BTref, last_rec, last_rec_len, &rec_data, &rec_data_len); + if (err) + return err; + if (rec_data_len < sizeof(UINT32BE)) + return IMGTOOLERR_CORRUPTIMAGE; + + /* iterate to next level */ + cur_node = get_UINT32BE(* (UINT32BE *)rec_data); + depth--; + } + + if (compare_result != 0) + /* key not found */ + if (search_exact_match) + return IMGTOOLERR_FILENOTFOUND; + + if (match_found) + *match_found = (compare_result == 0); + + if (node_ID) + *node_ID = cur_node; + + if (record_ID) + *record_ID = i; + + if (record_ptr) + *record_ptr = last_rec; + + if (record_len) + *record_len = last_rec_len; + + return IMGTOOLERR_SUCCESS; +} + +/* + BT_leaf_rec_enumerator_open + + Open enumerator for leaf records of a B-Tree + + BTref (I/O): open B-tree file handle + enumerator (O): B-Tree enumerator to open + + Return imgtool error code +*/ +static imgtoolerr_t BT_leaf_rec_enumerator_open(mac_BTref *BTref, BT_leaf_rec_enumerator *enumerator) +{ + enumerator->BTref = BTref; + enumerator->cur_node = BTref->firstLeafNode; + enumerator->cur_rec = 0; + + return IMGTOOLERR_SUCCESS; +} + +/* + BT_leaf_rec_enumerator_read + + Read next leaf record of a B-Tree + + enumerator (I/O): open B-Tree enumerator + + Return imgtool error code +*/ +static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerator, void **record_ptr, int *rec_len) +{ + UINT16 node_numRecords; + imgtoolerr_t err; + + + *record_ptr = NULL; + + /* check EOList condition */ + if (enumerator->cur_node == 0) + return IMGTOOLERR_SUCCESS; + + /* read current node */ + err = BT_read_node(enumerator->BTref, enumerator->cur_node, btnk_leafNode, 1, enumerator->BTref->node_buf); + if (err) + return err; + node_numRecords = get_UINT16BE(((BTNodeHeader *) enumerator->BTref->node_buf)->numRecords); + + /* skip nodes until we find a record */ + while ((enumerator->cur_rec >= node_numRecords) && (enumerator->cur_node != 0)) + { + enumerator->cur_node = get_UINT32BE(((BTNodeHeader *) enumerator->BTref->node_buf)->fLink); + enumerator->cur_rec = 0; + + /* read node */ + err = BT_read_node(enumerator->BTref, enumerator->cur_node, btnk_leafNode, 1, enumerator->BTref->node_buf); + if (err) + return err; + node_numRecords = get_UINT16BE(((BTNodeHeader *) enumerator->BTref->node_buf)->numRecords); + } + + /* check EOList condition */ + if (enumerator->cur_node == 0) + return IMGTOOLERR_SUCCESS; + + /* get current record */ + err = BT_node_get_keyed_record(enumerator->BTref, enumerator->BTref->node_buf, FALSE, enumerator->cur_rec, record_ptr, rec_len); + if (err) + return err; + + /* iterate to next record */ + enumerator->cur_rec++; + if (enumerator->cur_rec >= node_numRecords) + { /* iterate to next node if last record (not required, but will improve + performance on next iteration) */ + enumerator->cur_node = get_UINT32BE(((BTNodeHeader *) enumerator->BTref->node_buf)->fLink); + enumerator->cur_rec = 0; + } + return IMGTOOLERR_SUCCESS; +} + +/* + B-Tree extend EOF algorithm: + * see if the bitmap will need to be extended + * extend EOF by min 1 (if bitmap is large engough) or 2 (if bitmap needs + to be extended) and max ClumpSiz (see extClpSiz and ctClpSiz in MDB) + ***If we are extending the extent B-Tree, we need to defer the possible + creation of an additional extent record, or we might enter an endless + recursion loop*** + + Empty node alloc algorithm: + + * see if there is any free node in B-tree bitmap + * optionally, try to compact the B-tree if file is full + * if file is still full, extend EOF and try again + * mark new block as used and return its index + + + Empty node delete algorithm: + + * remove node from link list + * mark node as free in the B-tree bitmap + * optionally, if more than N% of the B-tree is free, compact the B-tree and + free some disk space + * Count nodes on this level; if there is only one left, delete parent index + node and mark the relaining node as root; if it was the last leaf node, + update header node with an empty B-tree; in either case, decrement tree + depth + + + Record shifting algorithm: + + For a given node and its first non-empty successor node: + + * compute how much free room there is in the node + * see if the first record of the first non-empty successor can fit + * if so, move it (i.e. delete the first record of the later node, and add a + copy of it to the end of the former) + + + Node merging algorithm + + * Consider node and its predecessor. If there is room, shift all records + from later to former, then delete empty later node, and delete later + record from parent index node. + + + Node splitting algorithm (non-first) + + * Consider node and its predecessor. Create new middle node and split + records in 3 even sets. Update record for last node and insert record + for middle node in parent index node. + + + Node splitting algorithm (first node) + + * Create new successor node, and split records in 2 1/3 and 2/3 sets. + Insert record for later node in parent index node. + + + Record delete algorithm: + + * remove record from node + * if record was first in node, test if node is now empty + * if node is not empty, substitute key of deleted record with key of + new head record in index tree + * if node is empty, delete key of deleted record in index tree, then + delete empty node + * optionally, look the predecessor node. Merge the two nodes if possible. + + + Record insert algorithm: + + * if there room, just insert new record in node; if new record is in first + position, update record in parent index node + * else consider predecessor: see if we can make enough room by shifting + records. If so, do shift records, insert new record, update record in + parent index node + * else split the nodes and insert record +*/ +/* + Possible additions: + + Node compaction algorithm: + + This algorithm can be executed with a specific start point and max number + of nodes, or with all nodes on a level. + + * see how many nodes we can save by shifting records left + * if we will save at least one node, do shift as many records as possible + (try to leave free space split homogeneously???) +*/ + +/*static void*/ + +#if 0 +#pragma mark - +#pragma mark RESOURCE IMPLEMENTATION +#endif + +/* + Resource manager + + The resource manager stores arbitrary chunks of data (resource) identified + by a type/id pair. The resource type is a 4-char code, which generally + implies the format of the data (e.g. 'PICT' is for a quickdraw picture, + 'STR ' for a macintosh string, 'CODE' for 68k machine code, etc). The + resource id is a signed 16-bit number that uniquely identifies each + resource of a given type. Note that, with most resource types, resources + with id < 128 are system resources that are available to all applications, + whereas resources with id >= 128 are application resources visible only to + the application that defines them. + + Each resource can optionally have a resource name, which is a macintosh + string of 255 chars at most. + + Limits: + 16MBytes of data + 64kbytes of type+reference lists + 64kbytes of resource names + + The Macintosh toolbox can open several resource files simulteanously to + overcome these restrictions. + + Resources are used virtually everywhere in the Macintosh Toolbox, so it is + no surprise that file comments and MFS folders are stored in resource files. +*/ + +/* + Resource header +*/ +struct rsrc_header +{ + UINT32BE data_offs; /* Offset from beginning of resource fork to resource data */ + UINT32BE map_offs; /* Offset from beginning of resource fork to resource map */ + UINT32BE data_len; /* Length of resource data */ + UINT32BE map_len; /* Length of resource map */ +}; + +/* + Resource data: each data entry is preceded by its len (UINT32BE) + Offset to specific data fields are gotten from the resource map +*/ + +/* + Resource map: +*/ +struct rsrc_map_header +{ + rsrc_header reserved0; /* Reserved for copy of resource header */ + UINT32BE reserved1; /* Reserved for handle to next resource map */ + UINT16BE reserved2; /* Reserved for file reference number */ + + UINT16BE attr; /* Resource fork attributes */ + UINT16BE typelist_offs; /* Offset from beginning of map to resource type list */ + UINT16BE namelist_offs; /* Offset from beginning of map to resource name list */ + UINT16BE type_count; /* Number of types in the map minus 1 */ + /* This is actually part of the type list, which matters for offsets */ +}; + +/* + Resource type list entry +*/ +struct rsrc_type_entry +{ + UINT32BE type; /* Resource type */ + UINT16BE ref_count; /* Number of resources of this type in map minus 1 */ + UINT16BE ref_offs; /* Offset from beginning of resource type list to reference list for this type */ +}; + +/* + Resource reference list entry +*/ +struct rsrc_ref_entry +{ + UINT16BE id; /* Resource ID */ + UINT16BE name_offs; /* Offset from beginning of resource name list to resource name */ + /* (-1 if none) */ + UINT8 attr; /* Resource attributes */ + UINT24BE data_offs; /* Offset from beginning of resource data to data for this resource */ + UINT32BE reserved; /* Reserved for handle to resource */ +}; + +/* + Resource name list entry: this is just a standard macintosh string +*/ + +struct mac_resfileref +{ + mac_fileref fileref; /* open resource fork ref (you may open resources + files in data fork, too, if you ever need to, + but Classic MacOS never does such a thing + (MacOS X often does so, though)) */ + UINT32 data_offs; /* Offset from beginning of resource file to resource data */ + UINT32 map_offs; /* Offset from beginning of resource file to resource data */ + + UINT16 typelist_offs; /* Offset from beginning of map to resource type list */ + UINT16 namelist_offs; /* Offset from beginning of map to resource name list */ + UINT16 type_count; /* Number of types in the map minus 1 */ + /* This is actually part of the type list, which matters for offsets */ +}; + +#ifdef UNUSED_FUNCTION +/* + resfile_open + + Open a file as a resource file. The file must be already open as a + macintosh file. + + resfileref (I/O): resource file handle to open (resfileref->fileref must + have been opened previously) + + Return imgtool error code +*/ +static imgtoolerr_t resfile_open(mac_resfileref *resfileref) +{ + imgtoolerr_t err; + rsrc_header header; + rsrc_map_header map_header; + + /* seek to resource header */ + err = mac_file_seek(&resfileref->fileref, 0); + if (err) + return err; + + err = mac_file_read(&resfileref->fileref, sizeof(header), &header); + if (err) + return err; + + resfileref->data_offs = get_UINT32BE(header.data_offs); + resfileref->map_offs = get_UINT32BE(header.map_offs); + + /* seek to resource map header */ + err = mac_file_seek(&resfileref->fileref, resfileref->map_offs); + if (err) + return err; + + err = mac_file_read(&resfileref->fileref, sizeof(map_header), &map_header); + if (err) + return err; + + resfileref->typelist_offs = get_UINT16BE(map_header.typelist_offs); + resfileref->namelist_offs = get_UINT16BE(map_header.namelist_offs); + resfileref->type_count = get_UINT16BE(map_header.type_count); + + return IMGTOOLERR_SUCCESS; +} + +/* + resfile_get_entry + + Get the resource entry in the resource map associated with a given type/id + pair. + + resfileref (I/O): open resource file handle + type (I): type of the resource + id (I): id of the resource + entry (O): resource entry that has been read + + Return imgtool error code +*/ +static imgtoolerr_t resfile_get_entry(mac_resfileref *resfileref, UINT32 type, UINT16 id, rsrc_ref_entry *entry) +{ + imgtoolerr_t err; + rsrc_type_entry type_entry; + UINT16 ref_count; + int i; + + /* seek to resource type list in resource map */ + err = mac_file_seek(&resfileref->fileref, resfileref->map_offs+resfileref->typelist_offs+2); + if (err) + return err; + + if (resfileref->type_count == 0xffff) + /* type list is empty */ + return IMGTOOLERR_FILENOTFOUND; + + for (i=0; i<=resfileref->type_count; i++) + { + err = mac_file_read(&resfileref->fileref, sizeof(type_entry), &type_entry); + if (err) + return err; + if (type == get_UINT32BE(type_entry.type)) + break; + } + if (i > resfileref->type_count) + /* type not found in list */ + return IMGTOOLERR_FILENOTFOUND; + + ref_count = get_UINT16BE(type_entry.ref_count); + + /* seek to resource ref list for this type in resource map */ + err = mac_file_seek(&resfileref->fileref, resfileref->map_offs+resfileref->typelist_offs+get_UINT16BE(type_entry.ref_offs)); + if (err) + return err; + + if (ref_count == 0xffff) + /* ref list is empty */ + return IMGTOOLERR_FILENOTFOUND; + + for (i=0; i<=ref_count; i++) + { + err = mac_file_read(&resfileref->fileref, sizeof(*entry), entry); + if (err) + return err; + if (id == get_UINT16BE(entry->id)) + break; + } + if (i > ref_count) + /* id not found in list */ + return IMGTOOLERR_FILENOTFOUND; + + /* type+id have been found... */ + return IMGTOOLERR_SUCCESS; +} + +/* + resfile_get_resname + + Get the name of a resource. + + resfileref (I/O): open resource file handle + entry (I): resource entry in the resource map (returned by + resfile_get_entry) + string (O): resource name + + Return imgtool error code +*/ +static imgtoolerr_t resfile_get_resname(mac_resfileref *resfileref, const rsrc_ref_entry *entry, mac_str255 string) +{ + imgtoolerr_t err; + UINT16 name_offs; + UINT8 len; + + name_offs = get_UINT16BE(entry->name_offs); + + if (name_offs == 0xffff) + /* ref list is empty */ + return IMGTOOLERR_UNEXPECTED; + + /* seek to resource name in name list in resource map */ + err = mac_file_seek(&resfileref->fileref, resfileref->map_offs+name_offs); + if (err) + return err; + + /* get string length */ + err = mac_file_read(&resfileref->fileref, 1, &len); + if (err) + return err; + + string[0] = len; + + /* get string data */ + err = mac_file_read(&resfileref->fileref, len, string+1); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + +/* + resfile_get_reslen + + Get the data length for a given resource. + + resfileref (I/O): open resource file handle + entry (I): resource entry in the resource map (returned by + resfile_get_entry) + len (O): resource length + + Return imgtool error code +*/ +static imgtoolerr_t resfile_get_reslen(mac_resfileref *resfileref, const rsrc_ref_entry *entry, UINT32 *len) +{ + imgtoolerr_t err; + UINT32 data_offs; + UINT32BE llen; + + data_offs = get_UINT24BE(entry->data_offs); + + /* seek to resource data in resource data section */ + err = mac_file_seek(&resfileref->fileref, resfileref->data_offs+data_offs); + if (err) + return err; + + /* get data length */ + err = mac_file_read(&resfileref->fileref, sizeof(llen), &llen); + if (err) + return err; + + *len = get_UINT32BE(llen); + + return IMGTOOLERR_SUCCESS; +} + +/* + resfile_get_resdata + + Get the data for a given resource. + + resfileref (I/O): open resource file handle + entry (I): resource entry in the resource map (returned by + resfile_get_entry) + offset (I): offset the data should be read from, usually 0 + len (I): length of the data to read, usually the value returned by + resfile_get_reslen + dest (O): resource data + + Return imgtool error code +*/ +static imgtoolerr_t resfile_get_resdata(mac_resfileref *resfileref, const rsrc_ref_entry *entry, UINT32 offset, UINT32 len, void *dest) +{ + imgtoolerr_t err; + UINT32 data_offs; + UINT32BE llen; + + data_offs = get_UINT24BE(entry->data_offs); + + /* seek to resource data in resource data section */ + err = mac_file_seek(&resfileref->fileref, resfileref->data_offs+data_offs); + if (err) + return err; + + /* get data length */ + err = mac_file_read(&resfileref->fileref, sizeof(llen), &llen); + if (err) + return err; + + /* check that we do not ask to read more data than avalaible */ + if ((offset + len) > get_UINT32BE(llen)) + return IMGTOOLERR_UNEXPECTED; + + if (offset) + { /* seek to resource data offset in resource data section */ + err = mac_file_seek(&resfileref->fileref, resfileref->data_offs+data_offs+4+offset); + if (err) + return err; + } + + /* get data */ + err = mac_file_read(&resfileref->fileref, len, dest); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} +#endif + +#if 0 +#pragma mark - +#pragma mark DESKTOP FILE IMPLEMENTATION +#endif +/* + All macintosh volumes have information stored in the desktop file or the + desktop database. + + Such information include file comments, copy of BNDL and FREF resources + that describes supported file types for each application on the volume, + copy of icons for each file type registered by each application on the + volume, etc. On MFS volumes, the list of folders is stored in the desktop + file as well. + + + There have been two implementations of the desktop metadata: + + * The original desktop file. The database is stored in the resource fork + of a (usually invisible) file called "Desktop" (case may change + according to system versions), located at the root of the volume. The + desktop file is used by System 6 and earlier for all volumes (unless + Appleshare 2 is installed and the volume is shared IIRC), and by System + 7 and later for volumes smaller than 2MBytes (so that floppy disks + remain fully compatible with earlier versions of system). The desktop + file is incompletely documented by Apple technote TB06. + + * The desktop database. The database is stored in the resource fork is + stored in the data fork of two (usually invisible) files called + "Desktop DF" and "Desktop DF". The desktop database is used for + volumes shared by Appleshare 2, and for most volumes under System 7 and + later. The format of these file is not documented AFAIK. + + + The reasons for the introduction of the desktop database were: + * the macintosh resource manager cannot share resource files, which was + a problem for Appleshare + * the macintosh resource manager is pretty limited (+/-16MByte of data and + 2727 resources at most), which was a problem for large hard disks with + many programs/comments +*/ + +#ifdef UNUSED_FUNCTION +/* + get_comment + + Get a comment from the Desktop file + + l2_img (I): macintosh image the data should be read from + id (I): comment id (from mfs_hashString(), or HFS FXInfo/DXInfo records) + comment (O): comment that has been read + + Return imgtool error code +*/ +static imgtoolerr_t get_comment(struct mac_l2_imgref *l2_img, UINT16 id, mac_str255 comment) +{ + static const UINT8 desktop_fname[] = {'\7','D','e','s','k','t','o','p'}; + #define restype_FCMT (('F' << 24) | ('C' << 16) | ('M' << 8) | 'T') + mac_resfileref resfileref; + rsrc_ref_entry resentry; + UINT32 reslen; + imgtoolerr_t err; + + /* open rsrc fork of file Desktop in root directory */ + err = mac_file_open(l2_img, 2, desktop_fname, rsrc_fork, &resfileref.fileref); + if (err) + return err; + + /* open resource structures */ + err = resfile_open(&resfileref); + if (err) + return err; + + /* look for resource FCMT #id */ + err = resfile_get_entry(&resfileref, restype_FCMT, id, &resentry); + if (err) + return err; + + /* extract comment len */ + err = resfile_get_reslen(&resfileref, &resentry, &reslen); + if (err) + return err; + + /* check comment len */ + if (reslen > 256) + /* hurk */ + /*return IMGTOOLERR_CORRUPTIMAGE;*/ + /* people willing to extend the MFM comment field (you know, the kind + of masochists that try to support 20-year-old OSes) might append extra + fields, so we just truncate the resource */ + reslen = 256; + + /* extract comment data */ + err = resfile_get_resdata(&resfileref, &resentry, 0, reslen, comment); + if (err) + return err; + + /* phew, we are done! */ + return IMGTOOLERR_SUCCESS; +} +#endif + +#if 0 +#pragma mark - +#pragma mark IMGTOOL MODULE IMPLEMENTATION +#endif + +#ifdef UNUSED_FUNCTION +static void mac_image_exit(imgtool_image *img); +#endif +static void mac_image_info(imgtool_image *img, char *string, size_t len); +static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path); +static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); +static imgtoolerr_t mac_image_freespace(imgtool_partition *partition, UINT64 *size); +static imgtoolerr_t mac_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); +static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions); + +#ifdef UNUSED_FUNCTION +/* + close a mfs/hfs image +*/ +static void mac_image_exit(imgtool_image *img) +{ + struct mac_l2_imgref *image = get_imgref(img); + + mac_image_close(image); +} +#endif + +/* + get basic information on a mfs/hfs image + + Currently returns the volume name +*/ +static void mac_image_info(imgtool_image *img, char *string, size_t len) +{ + struct mac_l2_imgref *image = get_imgref(img); + + switch (image->format) + { + case L2I_MFS: + mac_to_c_strncpy(string, len, image->u.mfs.volname); + break; + + case L2I_HFS: + mac_to_c_strncpy(string, len, image->u.hfs.volname); + break; + } +} + +/* + MFS/HFS catalog iterator, used when imgtool reads the catalog +*/ +struct mac_iterator +{ + mac_format format; + struct mac_l2_imgref *l2_img; + union + { + struct + { + mfs_dirref dirref; /* open directory reference */ + } mfs; + struct + { + hfs_cat_enumerator catref; /* catalog file enumerator */ + } hfs; + } u; +}; + +/* + Open the disk catalog for enumeration +*/ +static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path) +{ + struct mac_l2_imgref *image = get_imgref(imgtool_directory_image(enumeration)); + mac_iterator *iter = (mac_iterator *) imgtool_directory_extrabytes(enumeration); + imgtoolerr_t err = IMGTOOLERR_UNEXPECTED; + + iter->format = image->format; + iter->l2_img = image; + + switch (iter->format) + { + case L2I_MFS: + err = mfs_dir_open(image, path, &iter->u.mfs.dirref); + break; + + case L2I_HFS: + err = hfs_cat_open(image, path, &iter->u.hfs.catref); + break; + } + + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + +/* + Enumerate disk catalog next entry (MFS) +*/ +static imgtoolerr_t mfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent) +{ + mfs_dir_entry *cur_dir_entry; + imgtoolerr_t err; + + + assert(iter->format == L2I_MFS); + + ent->corrupt = 0; + ent->eof = 0; + + err = mfs_dir_read(&iter->u.mfs.dirref, &cur_dir_entry); + if (err) + { + /* error */ + ent->corrupt = 1; + return err; + } + else if (!cur_dir_entry) + { + /* EOF */ + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + + /* copy info */ + mac_to_c_strncpy(ent->filename, ARRAY_LENGTH(ent->filename), cur_dir_entry->name); + ent->filesize = get_UINT32BE(cur_dir_entry->dataPhysicalSize) + + get_UINT32BE(cur_dir_entry->rsrcPhysicalSize); + + return IMGTOOLERR_SUCCESS; +} + +#if 0 +/* + Concatenate path elements in the reverse order + + dest (O): destination buffer + dest_cur_pos (I/O): current position in destination buffer (buffer is + filled from end to start) + dest_max_len (I): length of destination buffer (use length minus one if you + want to preserve a trailing NUL character) + src (I): source C string +*/ +static void concat_fname(char *dest, int *dest_cur_pos, int dest_max_len, const char *src) +{ + static const char ellipsis[] = { '.', '.', '.' }; + int src_len = strlen(src); /* number of chars from src to insert */ + + if (src_len <= *dest_cur_pos) + { + *dest_cur_pos -= src_len; + memcpy(dest + *dest_cur_pos, src, src_len); + } + else + { + memcpy(dest, src + src_len - *dest_cur_pos, *dest_cur_pos); + *dest_cur_pos = 0; + memcpy(dest, ellipsis, (sizeof(ellipsis) <= dest_max_len) + ? sizeof(ellipsis) + : dest_max_len); + } +} +#endif + +/* + Enumerate disk catalog next entry (HFS) +*/ +static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent) +{ + hfs_catKey *catrec_key; + hfs_catData *catrec_data; + UINT16 dataRecType; + imgtoolerr_t err; + /* currently, the mac->C conversion transcodes one mac char with at most 3 + C chars */ + int cur_name_head; + + assert(iter->format == L2I_HFS); + + ent->corrupt = 0; + ent->eof = 0; + + do + { + err = hfs_cat_read(&iter->u.hfs.catref, &catrec_key, &catrec_data); + if (err) + { + /* error */ + ent->corrupt = 1; + return err; + } + else if (!catrec_key) + { + /* EOF */ + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + dataRecType = get_UINT16BE(catrec_data->dataType); + } while (((dataRecType != hcrt_Folder) && (dataRecType != hcrt_File)) + || (get_UINT32BE(catrec_key->parID) != iter->u.hfs.catref.parID)); + + /* copy info */ + switch (get_UINT16BE(catrec_data->dataType)) + { + case hcrt_Folder: + ent->directory = 1; + ent->filesize = 0; + break; + + case hcrt_File: + ent->directory = 0; + ent->filesize = get_UINT32BE(catrec_data->file.dataPhysicalSize) + + get_UINT32BE(catrec_data->file.rsrcPhysicalSize); + break; + } + + /* initialize file path buffer */ + cur_name_head = ARRAY_LENGTH(ent->filename); + if (cur_name_head > 0) + { + cur_name_head--; + ent->filename[cur_name_head] = '\0'; + } + + /* insert folder/file name in buffer */ + mac_to_c_strncpy(ent->filename, ARRAY_LENGTH(ent->filename), catrec_key->cName); +// concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, buf); + +#if 0 + /* extract parent directory ID */ + parID = get_UINT32BE(catrec_key->parID); + + /* looping while (parID != 1) will display the volume name; looping while + (parID != 2) won't */ + while (parID != /*1*/2) + { + /* search catalog for folder thread */ + err = hfs_cat_search(iter->l2_img, parID, mac_empty_str, &catrec_key, &catrec_data); + if (err) + { + /* error */ + concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, ":"); + concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, "???"); + + memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename) - cur_name_head); + ent->corrupt = 1; + return err; + } + + dataRecType = get_UINT16BE(catrec_data->dataType); + + if (dataRecType != hcrt_FolderThread) + { + /* error */ + concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename)-1, ":"); + concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename)-1, "???"); + + memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename)-cur_name_head); + ent->corrupt = 1; + return IMGTOOLERR_CORRUPTIMAGE; + } + + /* got folder thread record: insert the folder name at the start of + file path, then iterate */ + mac_to_c_strncpy(buf, sizeof(buf), catrec_data->thread.nodeName); + concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, ":"); + concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, buf); + + /* extract parent directory ID */ + parID = get_UINT32BE(catrec_data->thread.parID); + } + memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename) -cur_name_head); +#endif + return IMGTOOLERR_SUCCESS; +} + +/* + Enumerate disk catalog next entry +*/ +static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + imgtoolerr_t err; + mac_iterator *iter = (mac_iterator *) imgtool_directory_extrabytes(enumeration); + + switch (iter->format) + { + case L2I_MFS: + err = mfs_image_nextenum(iter, ent); + break; + + case L2I_HFS: + err = hfs_image_nextenum(iter, ent); + break; + + default: + assert(1); + err = IMGTOOLERR_UNEXPECTED; + break; + } + return err; +} + +/* + Compute free space on disk image in bytes +*/ +static imgtoolerr_t mac_image_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtool_image *image = imgtool_partition_image(partition); + *size = ((UINT64) get_imgref(image)->freeABs) * 512; + return IMGTOOLERR_SUCCESS; +} + +#ifdef UNUSED_FUNCTION +static imgtoolerr_t mac_get_comment(struct mac_l2_imgref *image, mac_str255 filename, const mac_dirent *cat_info, mac_str255 comment) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + UINT16 commentID; + + comment[0] = '\0'; + + /* get comment from Desktop file */ + switch (image->format) + { + case L2I_MFS: + commentID = mfs_hashString(filename); + err = get_comment(image, commentID, comment); + break; + + case L2I_HFS: + /* This is the way to get Finder comments in system <= 7. Attached + comments use another method, and Finder 8 uses yet another one. */ + commentID = get_UINT16BE(cat_info->flXFinderInfo.comment); + if (commentID) + err = get_comment(image, commentID, comment); + break; + } + return err; +} +#endif + + +/* + Extract a file from a disk image. +*/ +static imgtoolerr_t mac_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t err; + imgtool_image *img = imgtool_partition_image(partition); + struct mac_l2_imgref *image = get_imgref(img); + UINT32 parID; + mac_str255 filename; + mac_dirent cat_info; + mac_fileref fileref; + UINT8 buf[512]; + UINT32 i, run_len, data_len; + mac_fork_t fork_num; + + err = mac_identify_fork(fork, &fork_num); + if (err) + return err; + + /* resolve path and fetch file info from directory/catalog */ + err = mac_lookup_path(image, fpath, &parID, filename, &cat_info, FALSE); + if (err) + return err; + if (cat_info.dataRecType != hcrt_File) + return IMGTOOLERR_FILENOTFOUND; + + /* open file */ + err = mac_file_open(image, parID, filename, fork_num ? rsrc_fork : data_fork, &fileref); + if (err) + return err; + + data_len = fork_num ? cat_info.rsrcLogicalSize : cat_info.dataLogicalSize; + + /* extract DF */ + i = 0; + while(i < data_len) + { + run_len = MIN(data_len - i, sizeof(buf)); + + err = mac_file_read(&fileref, run_len, buf); + if (err) + return err; + if (stream_write(destf, buf, run_len) != run_len) + return IMGTOOLERR_WRITEERROR; + i += run_len; + } + + return IMGTOOLERR_SUCCESS; +} + +/* + Add a file to a disk image. +*/ +static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) +{ + imgtool_image *img = imgtool_partition_image(partition); + struct mac_l2_imgref *image = get_imgref(img); + UINT32 parID; + mac_str255 filename; + mac_dirent cat_info; + mac_fileref fileref; + UINT32 fork_len; + /*UINT16 commentID;*/ + /*mac_str255 comment;*/ + UINT8 buf[512]; + UINT32 i, run_len; + imgtoolerr_t err; + mac_fork_t fork_num; + + (void) writeoptions; + + if (image->format == L2I_HFS) + return IMGTOOLERR_UNIMPLEMENTED; + + err = mac_identify_fork(fork, &fork_num); + if (err) + return err; + +#if 0 + if (header.version_old != 0) + return IMGTOOLERR_UNIMPLEMENTED; +#endif + /*mac_strcpy(filename, header.filename);*/ + memset(&cat_info, 0, sizeof(cat_info)); + set_UINT32BE(&cat_info.flFinderInfo.type, 0x3F3F3F3F); + set_UINT32BE(&cat_info.flFinderInfo.creator, 0x3F3F3F3F); + fork_len = stream_size(sourcef); + /*comment[0] = get_UINT16BE(header.comment_len);*/ /* comment length */ + /* Next two fields are set to 0 with MFS volumes. IIRC, 0 normally + means system script: I don't think MFS stores the file name script code + anywhere on disk, so it should be a reasonable approximation. */ + + /* create file */ + /* clear inited flag and file location in window */ + set_UINT16BE(&cat_info.flFinderInfo.flags, get_UINT16BE(cat_info.flFinderInfo.flags) & ~fif_hasBeenInited); + set_UINT16BE(&cat_info.flFinderInfo.location.v, 0); + set_UINT16BE(&cat_info.flFinderInfo.location.h, 0); + + /* resolve path and create file */ + err = mac_lookup_path(image, fpath, &parID, filename, &cat_info, TRUE); + if (err) + return err; + + /* open file fork */ + err = mac_file_open(image, parID, filename, (fork_num ? rsrc_fork : data_fork), &fileref); + if (err) + return err; + + err = mac_file_seteof(&fileref, fork_len); + if (err) + return err; + + /* extract fork */ + for (i=0; i 512) + run_len = 512; + if (stream_read(sourcef, buf, run_len) != run_len) + return IMGTOOLERR_READERROR; + err = mac_file_write(&fileref, run_len, buf); + if (err) + return err; + i += run_len; + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t mac_image_listforks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len) +{ + imgtoolerr_t err; + UINT32 parID; + mac_str255 filename; + mac_dirent cat_info; + int fork_num = 0; + imgtool_image *img = imgtool_partition_image(partition); + struct mac_l2_imgref *image = get_imgref(img); + + /* resolve path and fetch file info from directory/catalog */ + err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE); + if (err) + return err; + if (cat_info.dataRecType != hcrt_File) + return IMGTOOLERR_FILENOTFOUND; + + /* specify data fork */ + ents[fork_num].type = FORK_DATA; + ents[fork_num].forkname[0] = '\0'; + ents[fork_num].size = cat_info.dataLogicalSize; + fork_num++; + + if (cat_info.rsrcLogicalSize > 0) + { + /* specify the resource fork */ + ents[fork_num].type = FORK_RESOURCE; + strcpy(ents[fork_num].forkname, "RESOURCE_FORK"); + ents[fork_num].size = cat_info.rsrcLogicalSize; + fork_num++; + } + + ents[fork_num].type = FORK_END; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t mac_image_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) +{ + imgtoolerr_t err; + imgtool_image *img = imgtool_partition_image(partition); + UINT32 parID; + mac_str255 filename; + mac_dirent cat_info; + struct mac_l2_imgref *image = get_imgref(img); + int i; + + /* resolve path and fetch file info from directory/catalog */ + err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE); + if (err) + return err; + if (cat_info.dataRecType != hcrt_File) + return IMGTOOLERR_FILENOTFOUND; + + for (i = 0; attrs[i]; i++) + { + switch(attrs[i]) + { + case IMGTOOLATTR_INT_MAC_TYPE: + values[i].i = get_UINT32BE(cat_info.flFinderInfo.type); + break; + case IMGTOOLATTR_INT_MAC_CREATOR: + values[i].i = get_UINT32BE(cat_info.flFinderInfo.creator); + break; + case IMGTOOLATTR_INT_MAC_FINDERFLAGS: + values[i].i = get_UINT16BE(cat_info.flFinderInfo.flags); + break; + case IMGTOOLATTR_INT_MAC_COORDX: + values[i].i = get_UINT16BE(cat_info.flFinderInfo.location.h); + break; + case IMGTOOLATTR_INT_MAC_COORDY: + values[i].i = get_UINT16BE(cat_info.flFinderInfo.location.v); + break; + case IMGTOOLATTR_INT_MAC_FINDERFOLDER: + values[i].i = get_UINT16BE(cat_info.flFinderInfo.fldr); + break; + case IMGTOOLATTR_INT_MAC_ICONID: + values[i].i = get_UINT16BE(cat_info.flXFinderInfo.iconID); + break; + case IMGTOOLATTR_INT_MAC_SCRIPTCODE: + values[i].i = cat_info.flXFinderInfo.script; + break; + case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: + values[i].i = cat_info.flXFinderInfo.XFlags; + break; + case IMGTOOLATTR_INT_MAC_COMMENTID: + values[i].i = get_UINT16BE(cat_info.flXFinderInfo.comment); + break; + case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: + values[i].i = get_UINT32BE(cat_info.flXFinderInfo.putAway); + break; + + case IMGTOOLATTR_TIME_CREATED: + values[i].t = mac_crack_time(cat_info.createDate); + break; + case IMGTOOLATTR_TIME_LASTMODIFIED: + values[i].t = mac_crack_time(cat_info.modifyDate); + break; + } + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t mac_image_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) +{ + imgtoolerr_t err; + UINT32 parID; + mac_str255 filename; + mac_dirent cat_info; + imgtool_image *img = imgtool_partition_image(partition); + struct mac_l2_imgref *image = get_imgref(img); + int i; + + /* resolve path and fetch file info from directory/catalog */ + err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE); + if (err) + return err; + if (cat_info.dataRecType != hcrt_File) + return IMGTOOLERR_FILENOTFOUND; + + for (i = 0; attrs[i]; i++) + { + switch(attrs[i]) + { + case IMGTOOLATTR_INT_MAC_TYPE: + set_UINT32BE(&cat_info.flFinderInfo.type, values[i].i); + break; + case IMGTOOLATTR_INT_MAC_CREATOR: + set_UINT32BE(&cat_info.flFinderInfo.creator, values[i].i); + break; + case IMGTOOLATTR_INT_MAC_FINDERFLAGS: + set_UINT16BE(&cat_info.flFinderInfo.flags, values[i].i); + break; + case IMGTOOLATTR_INT_MAC_COORDX: + set_UINT16BE(&cat_info.flFinderInfo.location.h, values[i].i); + break; + case IMGTOOLATTR_INT_MAC_COORDY: + set_UINT16BE(&cat_info.flFinderInfo.location.v, values[i].i); + break; + case IMGTOOLATTR_INT_MAC_FINDERFOLDER: + set_UINT16BE(&cat_info.flFinderInfo.fldr, values[i].i); + break; + case IMGTOOLATTR_INT_MAC_ICONID: + set_UINT16BE(&cat_info.flXFinderInfo.iconID, values[i].i); + break; + case IMGTOOLATTR_INT_MAC_SCRIPTCODE: + cat_info.flXFinderInfo.script = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: + cat_info.flXFinderInfo.XFlags = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_COMMENTID: + set_UINT16BE(&cat_info.flXFinderInfo.comment, values[i].i); + break; + case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: + set_UINT32BE(&cat_info.flXFinderInfo.putAway, values[i].i); + break; + + case IMGTOOLATTR_TIME_CREATED: + cat_info.createDate = mac_setup_time(values[i].t); + break; + case IMGTOOLATTR_TIME_LASTMODIFIED: + cat_info.modifyDate = mac_setup_time(values[i].t); + break; + } + } + + /* resolve path and fetch file info from directory/catalog */ + err = mac_lookup_path(image, path, &parID, filename, &cat_info, TRUE); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +/************************************* + * + * Our very own resource manager + * + *************************************/ + +static const void *mac_walk_resources(const void *resource_fork, size_t resource_fork_length, + UINT32 resource_type, + int (*discriminator)(const void *resource, UINT16 id, UINT32 length, void *param_), + void *param, UINT16 *resource_id, UINT32 *resource_length) +{ + UINT32 resource_data_offset, resource_data_length; + UINT32 resource_map_offset, resource_map_length; + UINT32 resource_typelist_count, resource_typelist_offset; + UINT32 resource_entry_offset, resource_entry_count; + UINT32 i, this_resource_type; + UINT32 this_resource_data, this_resource_length; + UINT16 this_resource_id; + const void *this_resource_ptr; + + if (resource_fork_length < 16) + return NULL; + + /* read resource header; its ok if anything past this point fails */ + resource_data_offset = pick_integer_be(resource_fork, 0, 4); + resource_map_offset = pick_integer_be(resource_fork, 4, 4); + resource_data_length = pick_integer_be(resource_fork, 8, 4); + resource_map_length = pick_integer_be(resource_fork, 12, 4); + if ((resource_data_offset + resource_data_length) > resource_fork_length) + return NULL; + if ((resource_map_offset + resource_map_length) > resource_fork_length) + return NULL; + if (resource_map_length < 30) + return NULL; + + /* read resource map and locate the resource type list */ + resource_typelist_offset = pick_integer_be(resource_fork, + resource_map_offset + 24, 2) + resource_map_offset; + if ((resource_typelist_offset + 2) > resource_fork_length) + return NULL; + resource_typelist_count = pick_integer_be(resource_fork, + resource_typelist_offset, 2) + 1; + if ((resource_typelist_offset + resource_typelist_count * 16 + 2) > resource_fork_length) + return NULL; + + /* scan the resource type list and locate the entries for this type */ + resource_entry_count = 0; + resource_entry_offset = 0; + for (i = 0; i < resource_typelist_count; i++) + { + this_resource_type = pick_integer_be(resource_fork, resource_typelist_offset + + (i * 8) + 2 + 0, 4); + if (this_resource_type == resource_type) + { + resource_entry_count = pick_integer_be(resource_fork, resource_typelist_offset + + (i * 8) + 2 + 4, 2) + 1; + resource_entry_offset = pick_integer_be(resource_fork, resource_typelist_offset + + (i * 8) + 2 + 6, 2) + resource_typelist_offset; + break; + } + } + + /* scan the resource entries, and find the correct resource */ + for (i = 0; i < resource_entry_count; i++) + { + this_resource_id = pick_integer_be(resource_fork, resource_entry_offset + + (i * 12) + 0, 2); + this_resource_data = pick_integer_be(resource_fork, resource_entry_offset + + (i * 12) + 5, 3) + resource_data_offset; + if ((this_resource_data + 4) > resource_fork_length) + return NULL; + + /* gauge the length */ + this_resource_length = pick_integer_be(resource_fork, this_resource_data, 4); + this_resource_data += 4; + if ((this_resource_data + this_resource_length) > resource_fork_length) + return NULL; + + this_resource_ptr = ((const UINT8 *) resource_fork) + this_resource_data; + if (discriminator(this_resource_ptr, this_resource_id, + this_resource_length, param)) + { + if (resource_length) + *resource_length = this_resource_length; + if (resource_id) + *resource_id = this_resource_id; + return this_resource_ptr; + } + } + + return NULL; +} + + + +static int get_resource_discriminator(const void *resource, UINT16 id, UINT32 length, void *param) +{ + const UINT16 *id_ptr = (const UINT16 *) param; + return id == *id_ptr; +} + + + +static const void *mac_get_resource(const void *resource_fork, size_t resource_fork_length, + UINT32 resource_type, UINT16 resource_id, UINT32 *resource_length) +{ + return mac_walk_resources(resource_fork, resource_fork_length, + resource_type, get_resource_discriminator, &resource_id, NULL, resource_length); +} + + + +/************************************* + * + * Custom icons + * + *************************************/ + +static int bundle_discriminator(const void *resource, UINT16 id, UINT32 length, void *param) +{ + UINT32 this_creator_code = pick_integer_be(resource, 0, 4); + UINT32 desired_creator_code = *((UINT32 *) param); + return this_creator_code == desired_creator_code; +} + + + +static int get_pixel(const UINT8 *src, int width, int height, int bpp, + int x, int y) +{ + UINT8 byte, mask; + int bit_position; + + byte = src[(y * width + x) * bpp / 8]; + bit_position = 8 - ((x % (8 / bpp)) + 1) * bpp; + mask = (1 << bpp) - 1; + return (byte >> bit_position) & mask; +} + + + +static int load_icon(UINT32 *dest, const void *resource_fork, UINT64 resource_fork_length, + UINT32 resource_type, UINT16 resource_id, int width, int height, int bpp, + const UINT32 *palette, int has_mask) +{ + int success = FALSE; + int y, x, color, is_masked; + UINT32 pixel; + const UINT8 *src; + UINT32 resource_length; + UINT32 frame_length; + UINT32 total_length; + + frame_length = width * height * bpp / 8; + total_length = frame_length * (has_mask ? 2 : 1); + + /* attempt to fetch resource */ + src = (const UINT8*)mac_get_resource(resource_fork, resource_fork_length, resource_type, + resource_id, &resource_length); + if (src && (resource_length == total_length)) + { + for (y = 0; y < height; y++) + { + for (x = 0; x < width; x ++) + { + /* first check mask bit */ + if (has_mask) + is_masked = get_pixel(src + frame_length, width, height, bpp, x, y); + else + is_masked = dest[y * width + x] >= 0x80000000; + + if (is_masked) + { + /* mask is ok; check the actual icon */ + color = get_pixel(src, width, height, bpp, x, y); + pixel = palette[color] | 0xFF000000; + } + else + { + /* masked out; nothing */ + pixel = 0; + } + + dest[y * width + x] = pixel; + } + } + success = TRUE; + } + return success; +} + + + +static imgtoolerr_t mac_image_geticoninfo(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo) +{ + static const UINT32 mac_palette_1bpp[2] = { 0xFFFFFF, 0x000000 }; + + static const UINT32 mac_palette_4bpp[16] = + { + 0xFFFFFF, 0xFCF305, 0xFF6402, 0xDD0806, 0xF20884, 0x4600A5, + 0x0000D4, 0x02ABEA, 0x1FB714, 0x006411, 0x562C05, 0x90713A, + 0xC0C0C0, 0x808080, 0x404040, 0x000000 + }; + + static const UINT32 mac_palette_8bpp[256] = + { + 0xFFFFFF, 0xFFFFCC, 0xFFFF99, 0xFFFF66, 0xFFFF33, 0xFFFF00, + 0xFFCCFF, 0xFFCCCC, 0xFFCC99, 0xFFCC66, 0xFFCC33, 0xFFCC00, + 0xFF99FF, 0xFF99CC, 0xFF9999, 0xFF9966, 0xFF9933, 0xFF9900, + 0xFF66FF, 0xFF66CC, 0xFF6699, 0xFF6666, 0xFF6633, 0xFF6600, + 0xFF33FF, 0xFF33CC, 0xFF3399, 0xFF3366, 0xFF3333, 0xFF3300, + 0xFF00FF, 0xFF00CC, 0xFF0099, 0xFF0066, 0xFF0033, 0xFF0000, + 0xCCFFFF, 0xCCFFCC, 0xCCFF99, 0xCCFF66, 0xCCFF33, 0xCCFF00, + 0xCCCCFF, 0xCCCCCC, 0xCCCC99, 0xCCCC66, 0xCCCC33, 0xCCCC00, + 0xCC99FF, 0xCC99CC, 0xCC9999, 0xCC9966, 0xCC9933, 0xCC9900, + 0xCC66FF, 0xCC66CC, 0xCC6699, 0xCC6666, 0xCC6633, 0xCC6600, + 0xCC33FF, 0xCC33CC, 0xCC3399, 0xCC3366, 0xCC3333, 0xCC3300, + 0xCC00FF, 0xCC00CC, 0xCC0099, 0xCC0066, 0xCC0033, 0xCC0000, + 0x99FFFF, 0x99FFCC, 0x99FF99, 0x99FF66, 0x99FF33, 0x99FF00, + 0x99CCFF, 0x99CCCC, 0x99CC99, 0x99CC66, 0x99CC33, 0x99CC00, + 0x9999FF, 0x9999CC, 0x999999, 0x999966, 0x999933, 0x999900, + 0x9966FF, 0x9966CC, 0x996699, 0x996666, 0x996633, 0x996600, + 0x9933FF, 0x9933CC, 0x993399, 0x993366, 0x993333, 0x993300, + 0x9900FF, 0x9900CC, 0x990099, 0x990066, 0x990033, 0x990000, + 0x66FFFF, 0x66FFCC, 0x66FF99, 0x66FF66, 0x66FF33, 0x66FF00, + 0x66CCFF, 0x66CCCC, 0x66CC99, 0x66CC66, 0x66CC33, 0x66CC00, + 0x6699FF, 0x6699CC, 0x669999, 0x669966, 0x669933, 0x669900, + 0x6666FF, 0x6666CC, 0x666699, 0x666666, 0x666633, 0x666600, + 0x6633FF, 0x6633CC, 0x663399, 0x663366, 0x663333, 0x663300, + 0x6600FF, 0x6600CC, 0x660099, 0x660066, 0x660033, 0x660000, + 0x33FFFF, 0x33FFCC, 0x33FF99, 0x33FF66, 0x33FF33, 0x33FF00, + 0x33CCFF, 0x33CCCC, 0x33CC99, 0x33CC66, 0x33CC33, 0x33CC00, + 0x3399FF, 0x3399CC, 0x339999, 0x339966, 0x339933, 0x339900, + 0x3366FF, 0x3366CC, 0x336699, 0x336666, 0x336633, 0x336600, + 0x3333FF, 0x3333CC, 0x333399, 0x333366, 0x333333, 0x333300, + 0x3300FF, 0x3300CC, 0x330099, 0x330066, 0x330033, 0x330000, + 0x00FFFF, 0x00FFCC, 0x00FF99, 0x00FF66, 0x00FF33, 0x00FF00, + 0x00CCFF, 0x00CCCC, 0x00CC99, 0x00CC66, 0x00CC33, 0x00CC00, + 0x0099FF, 0x0099CC, 0x009999, 0x009966, 0x009933, 0x009900, + 0x0066FF, 0x0066CC, 0x006699, 0x006666, 0x006633, 0x006600, + 0x0033FF, 0x0033CC, 0x003399, 0x003366, 0x003333, 0x003300, + 0x0000FF, 0x0000CC, 0x000099, 0x000066, 0x000033, 0xEE0000, + 0xDD0000, 0xBB0000, 0xAA0000, 0x880000, 0x770000, 0x550000, + 0x440000, 0x220000, 0x110000, 0x00EE00, 0x00DD00, 0x00BB00, + 0x00AA00, 0x008800, 0x007700, 0x005500, 0x004400, 0x002200, + 0x001100, 0x0000EE, 0x0000DD, 0x0000BB, 0x0000AA, 0x000088, + 0x000077, 0x000055, 0x000044, 0x000022, 0x000011, 0xEEEEEE, + 0xDDDDDD, 0xBBBBBB, 0xAAAAAA, 0x888888, 0x777777, 0x555555, + 0x444444, 0x222222, 0x111111, 0x000000 + }; + + static const UINT32 attrs[4] = + { + IMGTOOLATTR_INT_MAC_TYPE, + IMGTOOLATTR_INT_MAC_CREATOR, + IMGTOOLATTR_INT_MAC_FINDERFLAGS + }; + + imgtoolerr_t err; + imgtool_attribute attr_values[3]; + UINT32 type_code, creator_code, finder_flags; + imgtool_stream *stream = NULL; + const void *resource_fork; + UINT64 resource_fork_length; + const void *bundle; + UINT32 bundle_length, pos, fref_pos, icn_pos, i; + UINT16 local_id = 0, resource_id; + UINT32 fref_bundleentry_length, icn_bundleentry_length; + const void *fref; + UINT32 resource_length; + + assert((ARRAY_LENGTH(attrs) - 1) + == ARRAY_LENGTH(attr_values)); + + /* first retrieve type and creator code */ + err = mac_image_getattrs(partition, path, attrs, attr_values); + if (err) + goto done; + type_code = (UINT32) attr_values[0].i; + creator_code = (UINT32) attr_values[1].i; + finder_flags = (UINT32) attr_values[2].i; + + /* check the bundle bit; if clear (and the type is not 'APPL'), use the + * desktop file */ + if (!(finder_flags & 0x2000) && (type_code != /* APPL */ 0x4150504C)) + path = "Desktop\0"; + + stream = stream_open_mem(NULL, 0); + if (!stream) + { + err = IMGTOOLERR_SUCCESS; + goto done; + } + + /* read in the resource fork */ + err = mac_image_readfile(partition, path, "RESOURCE_FORK", stream); + if (err) + goto done; + resource_fork = stream_getptr(stream); + resource_fork_length = stream_size(stream); + + /* attempt to look up the bundle */ + bundle = mac_walk_resources(resource_fork, resource_fork_length, /* BNDL */ 0x424E444C, + bundle_discriminator, &creator_code, NULL, &bundle_length); + if (!bundle) + goto done; + + /* find the FREF and the icon family */ + pos = 8; + fref_pos = icn_pos = 0; + fref_bundleentry_length = icn_bundleentry_length = 0; + while((pos + 10) <= bundle_length) + { + UINT32 this_bundleentry_type = pick_integer_be(bundle, pos + 0, 4); + UINT32 this_bundleentry_length = pick_integer_be(bundle, pos + 4, 2) + 1; + + if (this_bundleentry_type == /* FREF */ 0x46524546) + { + fref_pos = pos; + fref_bundleentry_length = this_bundleentry_length; + } + if (this_bundleentry_type == /* ICN# */ 0x49434E23) + { + icn_pos = pos; + icn_bundleentry_length = this_bundleentry_length; + } + pos += 6 + this_bundleentry_length * 4; + } + if (!fref_pos || !icn_pos) + goto done; + + /* look up the FREF */ + for (i = 0; i < fref_bundleentry_length; i++) + { + local_id = pick_integer_be(bundle, fref_pos + (i * 4) + 6, 2); + resource_id = pick_integer_be(bundle, fref_pos + (i * 4) + 8, 2); + + fref = mac_get_resource(resource_fork, resource_fork_length, + /* FREF */ 0x46524546, resource_id, &resource_length); + if (fref && (resource_length >= 7)) + { + if (pick_integer_be(fref, 0, 4) == type_code) + break; + } + } + if (i >= fref_bundleentry_length) + goto done; + + /* now look up the icon family */ + resource_id = 0; + for (i = 0; i < icn_bundleentry_length; i++) + { + if (pick_integer_be(bundle, icn_pos + (i * 4) + 6, 2) == local_id) + { + resource_id = pick_integer_be(bundle, icn_pos + (i * 4) + 8, 2); + break; + } + } + if (i >= icn_bundleentry_length) + goto done; + + /* fetch 32x32 icons (ICN#, icl4, icl8) */ + if (load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, + /* ICN# */ 0x49434E23, resource_id, 32, 32, 1, mac_palette_1bpp, TRUE)) + { + iconinfo->icon32x32_specified = 1; + + load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, + /* icl4 */ 0x69636C34, resource_id, 32, 32, 4, mac_palette_4bpp, FALSE); + load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, + /* icl8 */ 0x69636C38, resource_id, 32, 32, 8, mac_palette_8bpp, FALSE); + } + + /* fetch 16x16 icons (ics#, ics4, ics8) */ + if (load_icon((UINT32 *) iconinfo->icon16x16, resource_fork, resource_fork_length, + /* ics# */ 0x69637323, resource_id, 16, 16, 1, mac_palette_1bpp, TRUE)) + { + iconinfo->icon16x16_specified = 1; + + load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, + /* ics4 */ 0x69637334, resource_id, 32, 32, 4, mac_palette_4bpp, FALSE); + load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, + /* ics8 */ 0x69637338, resource_id, 32, 32, 8, mac_palette_8bpp, FALSE); + } + +done: + if (stream) + stream_close(stream); + return err; +} + + + +/************************************* + * + * File transfer suggestions + * + *************************************/ + +static imgtoolerr_t mac_image_suggesttransfer(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) +{ + imgtoolerr_t err; + UINT32 parID; + mac_str255 filename; + mac_dirent cat_info; + imgtool_image *img = imgtool_partition_image(partition); + struct mac_l2_imgref *image = get_imgref(img); + mac_filecategory_t file_category = MAC_FILECATEGORY_DATA; + + if (path) + { + /* resolve path and fetch file info from directory/catalog */ + err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE); + if (err) + return err; + if (cat_info.dataRecType != hcrt_File) + return IMGTOOLERR_FILENOTFOUND; + + file_category = (cat_info.rsrcLogicalSize > 0) ? MAC_FILECATEGORY_FORKED : MAC_FILECATEGORY_DATA; + } + + mac_suggest_transfer(file_category, suggestions, suggestions_length); + return IMGTOOLERR_SUCCESS; +} + + + +/************************************* + * + * Module population + * + *************************************/ + +static void generic_mac_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break; + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(struct mac_l2_imgref); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct mac_iterator); break; + case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = ':'; break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; + case IMGTOOLINFO_PTR_CLOSE: /* info->close = mac_image_exit */; break; + case IMGTOOLINFO_PTR_INFO: info->info = mac_image_info; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = mac_image_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = mac_image_nextenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = mac_image_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = mac_image_readfile; break; + case IMGTOOLINFO_PTR_LIST_FORKS: info->list_forks = mac_image_listforks; break; + case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = mac_image_getattrs; break; + case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = mac_image_setattrs; break; + case IMGTOOLINFO_PTR_GET_ICON_INFO: info->get_iconinfo = mac_image_geticoninfo; break; + case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = mac_image_suggesttransfer; break; + case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_mac; break; + } +} + + + +void mac_mfs_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mac_mfs"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Mac MFS Floppy"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = mfs_image_create; break; + case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = mfs_image_open; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = mac_image_writefile; break; + + default: generic_mac_get_info(imgclass, state, info); break; + } +} + + + +void mac_hfs_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mac_hfs"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Mac HFS Floppy"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = hfs_image_open; break; + + default: generic_mac_get_info(imgclass, state, info); break; + } +} diff --git a/src/mame/tools/imgtool/modules/macbin.c b/src/mame/tools/imgtool/modules/macbin.c new file mode 100644 index 00000000000..3ef85a039d1 --- /dev/null +++ b/src/mame/tools/imgtool/modules/macbin.c @@ -0,0 +1,377 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/**************************************************************************** + + macbin.c + + MacBinary filter for use with Mac and ProDOS drivers + +***************************************************************************** + + MacBinary file format + + Offset Length Description + ------ ------ ----------- + 0 1 [I] Magic byte (0x00) + 1 64 [I] File name (Pascal String) + 65 4 [I] File Type Code + 69 4 [I] File Creator Code + 73 1 [I] Finder Flags (bits 15-8) + 74 1 [I] Magic byte (0x00) + 75 2 [I] File Vertical Position + 77 2 [I] File Horizontal Position + 79 2 [I] Window/Folder ID + 81 1 [I] Protected (bit 0) + 82 1 [I] Magic byte (0x00) + 83 4 [I] Data Fork Length + 87 4 [I] Resource Fork Length + 91 4 [I] Creation Date + 95 4 [I] Last Modified Date + 99 2 [I] "Get Info" comment length + 101 1 [II] Finder Flags (bits 7-0) + 102 4 [III] MacBinary III Signature 'mBIN' + 106 1 [III] Script of Filename + 107 1 [III] Extended Finder Flags + 116 4 [II] Unpacked Length + 120 2 [II] Secondary Header Length + 122 1 [II] MacBinary II Version Number (II: 0x81, III: 0x82) + 123 1 [II] Minimum Compatible MacBinary II Version Number (0x81) + 124 2 [II] CRC of previous 124 bytes + + For more information, consult http://www.lazerware.com/formats/macbinary.html + + TODO: I believe that the script code is some sort of identifier identifying + the character set used for the filename. If this is true, we are not + handling that properly + +*****************************************************************************/ + +#include + +#include "imgtool.h" +#include "formats/imageutl.h" +#include "macutil.h" + + + +static UINT32 pad128(UINT32 length) +{ + if (length % 128) + length += 128 - (length % 128); + return length; +} + + + +static imgtoolerr_t macbinary_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + static const UINT32 attrs[] = + { + IMGTOOLATTR_TIME_CREATED, + IMGTOOLATTR_TIME_LASTMODIFIED, + IMGTOOLATTR_INT_MAC_TYPE, + IMGTOOLATTR_INT_MAC_CREATOR, + IMGTOOLATTR_INT_MAC_FINDERFLAGS, + IMGTOOLATTR_INT_MAC_COORDX, + IMGTOOLATTR_INT_MAC_COORDY, + IMGTOOLATTR_INT_MAC_FINDERFOLDER, + IMGTOOLATTR_INT_MAC_SCRIPTCODE, + IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS, + 0 + }; + imgtoolerr_t err; + UINT8 header[128]; + const char *basename; + int i; + + UINT32 type_code = 0x3F3F3F3F; + UINT32 creator_code = 0x3F3F3F3F; + UINT16 finder_flags = 0; + UINT16 coord_x = 0; + UINT16 coord_y = 0; + UINT16 finder_folder = 0; + UINT8 script_code = 0; + UINT8 extended_flags = 0; + + imgtool_forkent fork_entries[4]; + const imgtool_forkent *data_fork = NULL; + const imgtool_forkent *resource_fork = NULL; + UINT32 creation_time = 0; + UINT32 lastmodified_time = 0; + imgtool_attribute attr_values[10]; + + /* get the forks */ + err = imgtool_partition_list_file_forks(partition, filename, fork_entries, sizeof(fork_entries)); + if (err) + return err; + for (i = 0; fork_entries[i].type != FORK_END; i++) + { + if (fork_entries[i].type == FORK_DATA) + data_fork = &fork_entries[i]; + else if (fork_entries[i].type == FORK_RESOURCE) + resource_fork = &fork_entries[i]; + } + + /* get the attributes */ + err = imgtool_partition_get_file_attributes(partition, filename, attrs, attr_values); + if (err && (ERRORCODE(err) != IMGTOOLERR_UNIMPLEMENTED)) + return err; + if (err == IMGTOOLERR_SUCCESS) + { + creation_time = mac_setup_time(attr_values[0].t); + lastmodified_time = mac_setup_time(attr_values[1].t); + type_code = attr_values[2].i; + creator_code = attr_values[3].i; + finder_flags = attr_values[4].i; + coord_x = attr_values[5].i; + coord_y = attr_values[6].i; + finder_folder = attr_values[7].i; + script_code = attr_values[8].i; + extended_flags = attr_values[9].i; + } + + memset(header, 0, sizeof(header)); + + /* place filename */ + basename = filename; + while(basename[strlen(basename) + 1]) + basename += strlen(basename) + 1; + pascal_from_c_string((unsigned char *) &header[1], 64, basename); + + place_integer_be(header, 65, 4, type_code); + place_integer_be(header, 69, 4, creator_code); + place_integer_be(header, 73, 1, (finder_flags >> 8) & 0xFF); + place_integer_be(header, 75, 2, coord_x); + place_integer_be(header, 77, 2, coord_y); + place_integer_be(header, 79, 2, finder_folder); + place_integer_be(header, 83, 4, data_fork ? data_fork->size : 0); + place_integer_be(header, 87, 4, resource_fork ? resource_fork->size : 0); + place_integer_be(header, 91, 4, creation_time); + place_integer_be(header, 95, 4, lastmodified_time); + place_integer_be(header, 101, 1, (finder_flags >> 0) & 0xFF); + place_integer_be(header, 102, 4, 0x6D42494E); + place_integer_be(header, 106, 1, script_code); + place_integer_be(header, 107, 1, extended_flags); + place_integer_be(header, 122, 1, 0x82); + place_integer_be(header, 123, 1, 0x81); + place_integer_be(header, 124, 2, ccitt_crc16(0, header, 124)); + + stream_write(destf, header, sizeof(header)); + + if (data_fork) + { + err = imgtool_partition_read_file(partition, filename, "", destf, NULL); + if (err) + return err; + + stream_fill(destf, 0, pad128(data_fork->size)); + } + + if (resource_fork) + { + err = imgtool_partition_read_file(partition, filename, "RESOURCE_FORK", destf, NULL); + if (err) + return err; + + stream_fill(destf, 0, pad128(resource_fork->size)); + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t write_fork(imgtool_partition *partition, const char *filename, const char *fork, + imgtool_stream *sourcef, UINT64 pos, UINT64 fork_len, option_resolution *opts) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + imgtool_stream *mem_stream = NULL; + size_t len; + + if (fork_len > 0) + { + mem_stream = stream_open_mem(NULL, 0); + if (!mem_stream) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + stream_seek(sourcef, pos, SEEK_SET); + len = stream_transfer(mem_stream, sourcef, fork_len); + if (len < fork_len) + stream_fill(mem_stream, 0, fork_len); + + stream_seek(mem_stream, 0, SEEK_SET); + err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL); + if (err) + goto done; + } + +done: + if (mem_stream) + stream_close(mem_stream); + return err; +} + + + +static imgtoolerr_t macbinary_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + static const UINT32 attrs[] = + { + IMGTOOLATTR_TIME_CREATED, + IMGTOOLATTR_TIME_LASTMODIFIED, + IMGTOOLATTR_INT_MAC_TYPE, + IMGTOOLATTR_INT_MAC_CREATOR, + IMGTOOLATTR_INT_MAC_FINDERFLAGS, + IMGTOOLATTR_INT_MAC_COORDX, + IMGTOOLATTR_INT_MAC_COORDY, + IMGTOOLATTR_INT_MAC_FINDERFOLDER, + IMGTOOLATTR_INT_MAC_SCRIPTCODE, + IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS, + 0 + }; + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + UINT8 header[128]; + UINT32 datafork_size; + UINT32 resourcefork_size; + UINT64 total_size; + UINT32 creation_time; + UINT32 lastmodified_time; + //int version; + imgtool_attribute attr_values[10]; + + UINT32 type_code; + UINT32 creator_code; + UINT16 finder_flags; + UINT16 coord_x; + UINT16 coord_y; + UINT16 finder_folder; + UINT8 script_code = 0; + UINT8 extended_flags = 0; + + /* read in the header */ + memset(header, 0, sizeof(header)); + stream_read(sourcef, header, sizeof(header)); + + /* check magic and zero fill bytes */ + if (header[0] != 0x00) + return IMGTOOLERR_CORRUPTFILE; + if (header[74] != 0x00) + return IMGTOOLERR_CORRUPTFILE; + if (header[82] != 0x00) + return IMGTOOLERR_CORRUPTFILE; + + datafork_size = pick_integer_be(header, 83, 4); + resourcefork_size = pick_integer_be(header, 87, 4); + total_size = stream_size(sourcef); + + /* size of a MacBinary header is always 128 bytes */ + if (total_size - pad128(datafork_size) - pad128(resourcefork_size) != 128) + return IMGTOOLERR_CORRUPTFILE; + + /* check filename length byte */ + if ((header[1] <= 0x00) || (header[1] > 0x3F)) + return IMGTOOLERR_CORRUPTFILE; + + /* check the CRC */ + if (pick_integer_be(header, 124, 2) != ccitt_crc16(0, header, 124)) + { + /* the CRC does not match; this file is MacBinary I */ + //version = 1; + } + else if (pick_integer_be(header, 102, 4) != 0x6D42494E) + { + /* did not see 'mBIN'; this file is MacBinary II */ + if (header[122] < 0x81) + return IMGTOOLERR_CORRUPTFILE; + if (header[123] < 0x81) + return IMGTOOLERR_CORRUPTFILE; + //version = 2; + } + else + { + /* we did see 'mBIN'; this file is MacBinary III */ + if (header[122] < 0x82) + return IMGTOOLERR_CORRUPTFILE; + if (header[123] < 0x81) + return IMGTOOLERR_CORRUPTFILE; + //version = 3; + } + + type_code = pick_integer_be(header, 65, 4); + creator_code = pick_integer_be(header, 69, 4); + finder_flags = pick_integer_be(header, 73, 1) << 8; + coord_x = pick_integer_be(header, 75, 2); + coord_y = pick_integer_be(header, 77, 2); + finder_folder = pick_integer_be(header, 79, 2); + creation_time = pick_integer_be(header, 91, 4); + lastmodified_time = pick_integer_be(header, 95, 4); + + if (image) + { + /* write out both forks */ + err = write_fork(partition, filename, "", sourcef, sizeof(header), datafork_size, opts); + if (err) + return err; + err = write_fork(partition, filename, "RESOURCE_FORK", sourcef, sizeof(header) + pad128(datafork_size), resourcefork_size, opts); + if (err) + return err; + + /* set up attributes */ + attr_values[0].t = mac_crack_time(creation_time); + attr_values[1].t = mac_crack_time(lastmodified_time); + attr_values[2].i = type_code; + attr_values[3].i = creator_code; + attr_values[4].i = finder_flags; + attr_values[5].i = coord_x; + attr_values[6].i = coord_y; + attr_values[7].i = finder_folder; + attr_values[8].i = script_code; + attr_values[9].i = extended_flags; + + err = imgtool_partition_put_file_attributes(partition, filename, attrs, attr_values); + if (err) + return err; + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t macbinary_checkstream(imgtool_stream *stream, imgtool_suggestion_viability_t *viability) +{ + imgtoolerr_t err; + + err = macbinary_writefile(NULL, NULL, NULL, stream, NULL); + if (err == IMGTOOLERR_CORRUPTFILE) + { + /* the filter returned corrupt; this is not a valid file */ + *viability = SUGGESTION_END; + err = IMGTOOLERR_SUCCESS; + } + else if (err == IMGTOOLERR_SUCCESS) + { + /* success; lets recommend this filter */ + *viability = SUGGESTION_RECOMMENDED; + } + return err; +} + + + +void filter_macbinary_getinfo(UINT32 state, union filterinfo *info) +{ + switch(state) + { + case FILTINFO_STR_NAME: info->s = "macbinary"; break; + case FILTINFO_STR_HUMANNAME: info->s = "MacBinary"; break; + case FILTINFO_STR_EXTENSION: info->s = "bin"; break; + case FILTINFO_PTR_READFILE: info->read_file = macbinary_readfile; break; + case FILTINFO_PTR_WRITEFILE: info->write_file = macbinary_writefile; break; + case FILTINFO_PTR_CHECKSTREAM: info->check_stream = macbinary_checkstream; break; + } +} diff --git a/src/mame/tools/imgtool/modules/macutil.c b/src/mame/tools/imgtool/modules/macutil.c new file mode 100644 index 00000000000..fe2e1ade51a --- /dev/null +++ b/src/mame/tools/imgtool/modules/macutil.c @@ -0,0 +1,89 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/**************************************************************************** + + macutil.c + + Imgtool Utility code for manipulating certain Apple/Mac data structures + and conventions + +*****************************************************************************/ + +#include "macutil.h" + + +time_t mac_crack_time(UINT32 t) +{ + /* not sure if this is correct... */ + return t - (((1970 - 1904) * 365) + 17) * 24 * 60 * 60; +} + + + +UINT32 mac_setup_time(time_t t) +{ + /* not sure if this is correct... */ + return t + (((1970 - 1904) * 365) + 17) * 24 * 60 * 60; +} + + + +UINT32 mac_time_now(void) +{ + time_t now; + time(&now); + return mac_setup_time(now); +} + + + +imgtoolerr_t mac_identify_fork(const char *fork_string, mac_fork_t *fork_num) +{ + if (!strcmp(fork_string, "")) + *fork_num = MAC_FORK_DATA; + else if (!strcmp(fork_string, "RESOURCE_FORK")) + *fork_num = MAC_FORK_RESOURCE; + else + return IMGTOOLERR_FORKNOTFOUND; + return IMGTOOLERR_SUCCESS; +} + + + +void mac_suggest_transfer(mac_filecategory_t file_category, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) +{ + suggestions[0].viability = (file_category == MAC_FILECATEGORY_FORKED) ? SUGGESTION_RECOMMENDED : SUGGESTION_POSSIBLE; + suggestions[0].filter = filter_macbinary_getinfo; + suggestions[0].fork = NULL; + suggestions[0].description = NULL; + + suggestions[1].viability = (file_category == MAC_FILECATEGORY_TEXT) ? SUGGESTION_RECOMMENDED : SUGGESTION_POSSIBLE; + suggestions[1].filter = filter_eoln_getinfo; + suggestions[1].fork = NULL; + suggestions[1].description = NULL; + + suggestions[2].viability = (file_category == MAC_FILECATEGORY_DATA) ? SUGGESTION_RECOMMENDED : SUGGESTION_POSSIBLE; + suggestions[2].filter = NULL; + suggestions[2].fork = ""; + suggestions[2].description = "Raw (data fork)"; + + suggestions[3].viability = SUGGESTION_POSSIBLE; + suggestions[3].filter = NULL; + suggestions[3].fork = "RESOURCE_FORK"; + suggestions[3].description = "Raw (resource fork)"; +} + + + +void pascal_from_c_string(unsigned char *pstring, size_t pstring_len, const char *cstring) +{ + size_t cstring_len, i; + + cstring_len = strlen(cstring); + pstring[0] = MIN(cstring_len, pstring_len - 1); + + for (i = 0; i < pstring[0]; i++) + pstring[1 + i] = cstring[i]; + while(i < pstring_len - 1) + pstring[1 + i++] = '\0'; +} diff --git a/src/mame/tools/imgtool/modules/macutil.h b/src/mame/tools/imgtool/modules/macutil.h new file mode 100644 index 00000000000..71121dade31 --- /dev/null +++ b/src/mame/tools/imgtool/modules/macutil.h @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/**************************************************************************** + + macutil.h + + Imgtool Utility code for manipulating certain Apple/Mac data structures + and conventions + +*****************************************************************************/ + +#ifndef MACUTIL_H +#define MACUTIL_H + +#include "imgtool.h" + +enum mac_fork_t +{ + MAC_FORK_DATA, + MAC_FORK_RESOURCE +}; + +enum mac_filecategory_t +{ + MAC_FILECATEGORY_DATA, + MAC_FILECATEGORY_TEXT, + MAC_FILECATEGORY_FORKED +}; + + +/* converting Classic Mac OS time <==> Imgtool time */ +time_t mac_crack_time(UINT32 t); +UINT32 mac_setup_time(time_t t); +UINT32 mac_time_now(void); + +imgtoolerr_t mac_identify_fork(const char *fork_string, mac_fork_t *fork_num); + +void mac_suggest_transfer(mac_filecategory_t file_category, imgtool_transfer_suggestion *suggestions, size_t suggestions_length); + +void pascal_from_c_string(unsigned char *pstring, size_t pstring_len, const char *cstring); + +#endif /* MACUTIL_H */ diff --git a/src/mame/tools/imgtool/modules/os9.c b/src/mame/tools/imgtool/modules/os9.c new file mode 100644 index 00000000000..2a9e2fb0292 --- /dev/null +++ b/src/mame/tools/imgtool/modules/os9.c @@ -0,0 +1,1244 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/**************************************************************************** + + os9.c + + CoCo OS-9 disk images + +****************************************************************************/ + +#include + +#include "imgtool.h" +#include "formats/imageutl.h" +#include "formats/coco_dsk.h" +#include "iflopimg.h" + +enum creation_policy_t +{ + CREATE_NONE, + CREATE_FILE, + CREATE_DIR +}; + +struct os9_diskinfo +{ + UINT32 total_sectors; + UINT32 sectors_per_track; + UINT32 allocation_bitmap_bytes; + UINT32 cluster_size; + UINT32 root_dir_lsn; + UINT32 owner_id; + UINT32 attributes; + UINT32 disk_id; + UINT32 format_flags; + UINT32 bootstrap_lsn; + UINT32 bootstrap_size; + UINT32 sector_size; + + unsigned int sides : 2; + unsigned int double_density : 1; + unsigned int double_track : 1; + unsigned int quad_track_density : 1; + unsigned int octal_track_density : 1; + + char name[33]; + UINT8 *allocation_bitmap; +}; + + +struct os9_fileinfo +{ + unsigned int directory : 1; + unsigned int non_sharable : 1; + unsigned int public_execute : 1; + unsigned int public_write : 1; + unsigned int public_read : 1; + unsigned int user_execute : 1; + unsigned int user_write : 1; + unsigned int user_read : 1; + + UINT32 lsn; + UINT32 owner_id; + UINT32 link_count; + UINT32 file_size; + + struct + { + UINT32 lsn; + UINT32 count; + } sector_map[48]; +}; + + +struct os9_direnum +{ + struct os9_fileinfo dir_info; + UINT32 index; +}; + + + +static void pick_string(const void *ptr, size_t offset, size_t length, char *dest) +{ + UINT8 b; + + while(length--) + { + b = ((UINT8 *) ptr)[offset++]; + *(dest++) = b & 0x7F; + if (b & 0x80) + length = 0; + } + *dest = '\0'; +} + + + +static void place_string(void *ptr, size_t offset, size_t length, const char *s) +{ + size_t i; + UINT8 b; + UINT8 *bptr; + + bptr = (UINT8 *) ptr; + bptr += offset; + + bptr[0] = 0x80; + + for (i = 0; s[i] && (i < length); i++) + { + b = ((UINT8) s[i]) & 0x7F; + if (s[i+1] == '\0') + b |= 0x80; + bptr[i] = b; + } +} + + + +static os9_diskinfo *os9_get_diskinfo(imgtool_image *image) +{ + return (os9_diskinfo *) imgtool_floppy_extrabytes(image); +} + + + +static struct os9_direnum *os9_get_dirinfo(imgtool_directory *directory) +{ + return (struct os9_direnum *) imgtool_directory_extrabytes(directory); +} + + + +static imgtoolerr_t os9_locate_lsn(imgtool_image *image, UINT32 lsn, UINT32 *head, UINT32 *track, UINT32 *sector) +{ + const os9_diskinfo *disk_info; + + disk_info = os9_get_diskinfo(image); + if (lsn > disk_info->total_sectors) + return IMGTOOLERR_CORRUPTIMAGE; + + *track = lsn / (disk_info->sectors_per_track * disk_info->sides); + *head = (lsn / disk_info->sectors_per_track) % disk_info->sides; + *sector = (lsn % disk_info->sectors_per_track) + 1; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t os9_read_lsn(imgtool_image *img, UINT32 lsn, int offset, void *buffer, size_t buffer_len) +{ + imgtoolerr_t err; + floperr_t ferr; + UINT32 head, track, sector; + + err = os9_locate_lsn(img, lsn, &head, &track, §or); + if (err) + return err; + + ferr = floppy_read_sector(imgtool_floppy(img), head, track, sector, offset, buffer, buffer_len); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t os9_write_lsn(imgtool_image *img, UINT32 lsn, int offset, const void *buffer, size_t buffer_len) +{ + imgtoolerr_t err; + floperr_t ferr; + UINT32 head, track, sector; + + err = os9_locate_lsn(img, lsn, &head, &track, §or); + if (err) + return err; + + ferr = floppy_write_sector(imgtool_floppy(img), head, track, sector, offset, buffer, buffer_len, 0); /* TODO: pass ddam argument from imgtool */ + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static UINT32 os9_lookup_lsn(imgtool_image *img, + const struct os9_fileinfo *file_info, UINT32 *index) +{ + int i; + UINT32 lsn; + const os9_diskinfo *disk_info; + + disk_info = os9_get_diskinfo(img); + lsn = *index / disk_info->sector_size; + + i = 0; + while(lsn >= file_info->sector_map[i].count) + lsn -= file_info->sector_map[i++].count; + + lsn = file_info->sector_map[i].lsn + lsn; + *index %= disk_info->sector_size; + return lsn; +} + + + +static int os9_interpret_dirent(void *entry, char **filename, UINT32 *lsn, int *corrupt) +{ + int i; + char *entry_b = (char *) entry; + + *filename = NULL; + *lsn = 0; + if (corrupt) + *corrupt = FALSE; + + if (entry_b[28] != '\0') + { + if (corrupt) + *corrupt = TRUE; + } + + for (i = 0; (i < 28) && !(entry_b[i] & 0x80); i++) + ; + entry_b[i] &= 0x7F; + entry_b[i+1] = '\0'; + + *lsn = pick_integer_be(entry, 29, 3); + if (strcmp(entry_b, ".") && strcmp(entry_b, "..")) + *filename = entry_b; + return *filename != NULL; +} + + + +/*------------------------------------------------- + os9_decode_file_header - reads a file/directory + entry from an LSN, and decodes it +-------------------------------------------------*/ + +static imgtoolerr_t os9_decode_file_header(imgtool_image *image, + int lsn, struct os9_fileinfo *info) +{ + imgtoolerr_t err; + UINT32 attributes, count; + int max_entries, i; + const os9_diskinfo *disk_info; + UINT8 header[256]; + + disk_info = os9_get_diskinfo(image); + + err = os9_read_lsn(image, lsn, 0, header, sizeof(header)); + if (err) + return err; + + info->lsn = lsn; + attributes = pick_integer_be(header, 0, 1); + info->owner_id = pick_integer_be(header, 1, 2); + info->link_count = pick_integer_be(header, 8, 1); + info->file_size = pick_integer_be(header, 9, 4); + info->directory = (attributes & 0x80) ? 1 : 0; + info->non_sharable = (attributes & 0x40) ? 1 : 0; + info->public_execute = (attributes & 0x20) ? 1 : 0; + info->public_write = (attributes & 0x10) ? 1 : 0; + info->public_read = (attributes & 0x08) ? 1 : 0; + info->user_execute = (attributes & 0x04) ? 1 : 0; + info->user_write = (attributes & 0x02) ? 1 : 0; + info->user_read = (attributes & 0x01) ? 1 : 0; + + if (info->directory && (info->file_size % 32 != 0)) + return IMGTOOLERR_CORRUPTIMAGE; + + /* read all sector map entries */ + max_entries = (disk_info->sector_size - 16) / 5; + max_entries = MIN(max_entries, ARRAY_LENGTH(info->sector_map) - 1); + for (i = 0; i < max_entries; i++) + { + lsn = pick_integer_be(header, 16 + (i * 5) + 0, 3); + count = pick_integer_be(header, 16 + (i * 5) + 3, 2); + if (count <= 0) + break; + + info->sector_map[i].lsn = lsn; + info->sector_map[i].count = count; + } + info->sector_map[i].lsn = 0; + info->sector_map[i].count = 0; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t os9_allocate_lsn(imgtool_image *image, UINT32 *lsn) +{ + UINT32 i; + os9_diskinfo *disk_info; + UINT8 b, mask; + + disk_info = os9_get_diskinfo(image); + + for (i = 0; i < disk_info->total_sectors; i++) + { + b = disk_info->allocation_bitmap[i / 8]; + mask = 1 << (7 - (i % 8)); + + if ((b & mask) == 0) + { + disk_info->allocation_bitmap[i / 8] |= mask; + *lsn = i; + return os9_write_lsn(image, 1, 0, disk_info->allocation_bitmap, disk_info->allocation_bitmap_bytes); + } + } + return IMGTOOLERR_NOSPACE; +} + + + +static imgtoolerr_t os9_deallocate_lsn(imgtool_image *image, UINT32 lsn) +{ + UINT8 mask; + os9_diskinfo *disk_info; + + disk_info = os9_get_diskinfo(image); + mask = 1 << (7 - (lsn % 8)); + disk_info->allocation_bitmap[lsn / 8] &= ~mask; + return os9_write_lsn(image, 1, 0, disk_info->allocation_bitmap, disk_info->allocation_bitmap_bytes); +} + + + +static UINT32 os9_get_free_lsns(imgtool_image *image) +{ + const os9_diskinfo *disk_info; + UINT32 i, free_lsns; + UINT8 b; + + disk_info = os9_get_diskinfo(image); + free_lsns = 0; + + for (i = 0; i < disk_info->total_sectors; i++) + { + b = disk_info->allocation_bitmap[i / 8]; + b >>= (7 - (i % 8)); + free_lsns += ~b & 1; + } + + return free_lsns; +} + + + +static imgtoolerr_t os9_corrupt_file_error(const struct os9_fileinfo *file_info) +{ + imgtoolerr_t err; + if (file_info->directory) + err = IMGTOOLERR_CORRUPTDIR; + else + err = IMGTOOLERR_CORRUPTFILE; + return err; +} + + + +static imgtoolerr_t os9_set_file_size(imgtool_image *image, + struct os9_fileinfo *file_info, UINT32 new_size) +{ + imgtoolerr_t err; + const os9_diskinfo *disk_info; + UINT32 new_lsn_count, current_lsn_count; + UINT32 free_lsns, lsn, i; + int sector_map_length = -1; + UINT8 header[256]; + + /* easy way out? */ + if (file_info->file_size == new_size) + return IMGTOOLERR_SUCCESS; + + disk_info = os9_get_diskinfo(image); + + free_lsns = os9_get_free_lsns(image); + current_lsn_count = (file_info->file_size + disk_info->sector_size - 1) / disk_info->sector_size; + new_lsn_count = (new_size + disk_info->sector_size - 1) / disk_info->sector_size; + + /* check to see if the file is growing and we do not have enough space */ + if ((new_lsn_count > current_lsn_count) && (new_lsn_count - current_lsn_count > free_lsns)) + return IMGTOOLERR_NOSPACE; + + if (current_lsn_count != new_lsn_count) + { + /* first find out the size of our sector map */ + sector_map_length = 0; + lsn = 0; + while((lsn < current_lsn_count) && (sector_map_length < ARRAY_LENGTH(file_info->sector_map))) + { + if (file_info->sector_map[sector_map_length].count == 0) + return os9_corrupt_file_error(file_info); + + lsn += file_info->sector_map[sector_map_length].count; + sector_map_length++; + } + + /* keep in mind that the sector_map might not parallel our expected + * current LSN count; we should tolerate this abnormality */ + current_lsn_count = lsn; + + while(current_lsn_count > new_lsn_count) + { + /* shrink this file */ + lsn = file_info->sector_map[sector_map_length - 1].lsn + + file_info->sector_map[sector_map_length - 1].count - 1; + + err = os9_deallocate_lsn(image, lsn); + if (err) + return err; + + file_info->sector_map[sector_map_length - 1].count--; + while(sector_map_length > 0 && (file_info->sector_map[sector_map_length - 1].count == 0)) + sector_map_length--; + current_lsn_count--; + } + + while(current_lsn_count < new_lsn_count) + { + /* grow this file */ + err = os9_allocate_lsn(image, &lsn); + if (err) + return err; + + if ((sector_map_length > 0) && ((file_info->sector_map[sector_map_length - 1].lsn + + file_info->sector_map[sector_map_length - 1].count) == lsn)) + { + file_info->sector_map[sector_map_length - 1].count++; + } + else if (sector_map_length >= ARRAY_LENGTH(file_info->sector_map)) + { + return IMGTOOLERR_NOSPACE; + } + else + { + file_info->sector_map[sector_map_length].lsn = lsn; + file_info->sector_map[sector_map_length].count = 1; + sector_map_length++; + file_info->sector_map[sector_map_length].lsn = 0; + file_info->sector_map[sector_map_length].count = 0; + } + current_lsn_count++; + } + } + + /* now lets write back the sector */ + err = os9_read_lsn(image, file_info->lsn, 0, header, sizeof(header)); + if (err) + return err; + + file_info->file_size = new_size; + place_integer_be(header, 9, 4, file_info->file_size); + + /* do we have to write the sector map? */ + if (sector_map_length >= 0) + { + for (i = 0; i < MIN(sector_map_length + 1, ARRAY_LENGTH(file_info->sector_map)); i++) + { + place_integer_be(header, 16 + (i * 5) + 0, 3, file_info->sector_map[i].lsn); + place_integer_be(header, 16 + (i * 5) + 3, 2, file_info->sector_map[i].count); + } + } + + err = os9_write_lsn(image, file_info->lsn, 0, header, disk_info->sector_size); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +/*------------------------------------------------- + os9_lookup_path - walks an OS-9 directory + structure to find a file, or optionally, create + a file +-------------------------------------------------*/ + +static imgtoolerr_t os9_lookup_path(imgtool_image *img, const char *path, + creation_policy_t create, struct os9_fileinfo *file_info, + UINT32 *parent_lsn, UINT32 *dirent_lsn, UINT32 *dirent_index) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + struct os9_fileinfo dir_info; + UINT32 index, current_lsn, dir_size; + UINT32 entry_index = 0; + UINT32 free_entry_index = 0xffffffff; + UINT32 entry_lsn = 0; + UINT32 allocated_lsn = 0; + UINT8 entry[32]; + UINT8 block[64]; + char *filename; + const os9_diskinfo *disk_info; + + disk_info = os9_get_diskinfo(img); + current_lsn = disk_info->root_dir_lsn; + + if (parent_lsn) + *parent_lsn = 0; + + /* we have to transverse each path element */ + while(*path) + { + if (parent_lsn) + *parent_lsn = current_lsn; + + /* decode the directory header of this directory */ + err = os9_decode_file_header(img, current_lsn, &dir_info); + if (err) + goto done; + dir_size = dir_info.file_size; + + /* sanity check directory */ + if (!dir_info.directory) + { + err = (current_lsn == disk_info->root_dir_lsn) ? IMGTOOLERR_CORRUPTIMAGE : IMGTOOLERR_INVALIDPATH; + goto done; + } + + /* walk the directory */ + for (index = 0; index < dir_size; index += 32) + { + entry_index = index; + entry_lsn = os9_lookup_lsn(img, &dir_info, &entry_index); + + err = os9_read_lsn(img, entry_lsn, entry_index, entry, sizeof(entry)); + if (err) + goto done; + + /* remember first free entry found */ + if( free_entry_index == 0xffffffff ) + { + if( entry[0] == 0 ) + free_entry_index = index; + } + + if (os9_interpret_dirent(entry, &filename, ¤t_lsn, NULL)) + { + if (!strcmp(path, filename)) + break; + } + + } + + /* at the end of the file? */ + if (index >= dir_size) + { + /* if we're not creating, or we are creating but we have not fully + * transversed the directory, error out */ + if (!create || path[strlen(path) + 1]) + { + err = IMGTOOLERR_PATHNOTFOUND; + goto done; + } + + /* allocate a new LSN */ + err = os9_allocate_lsn(img, &allocated_lsn); + if (err) + goto done; + + /* write the file */ + memset(block, 0, sizeof(block)); + place_integer_be(block, 0, 1, 0x1B | ((create == CREATE_DIR) ? 0x80 : 0x00)); + err = os9_write_lsn(img, allocated_lsn, 0, block, sizeof(block)); + if (err) + goto done; + + if( free_entry_index == 0xffffffff ) + { + /* expand the directory to hold the new entry */ + err = os9_set_file_size(img, &dir_info, dir_size + 32); + if (err) + goto done; + } + else + /* use first unused entry in directory */ + dir_size = free_entry_index; + + /* now prepare the directory entry */ + memset(entry, 0, sizeof(entry)); + place_string(entry, 0, 28, path); + place_integer_be(entry, 29, 3, allocated_lsn); + + /* now write the directory entry */ + entry_index = dir_size; + entry_lsn = os9_lookup_lsn(img, &dir_info, &entry_index); + err = os9_write_lsn(img, entry_lsn, entry_index, entry, 32); + if (err) + goto done; + + /* directory entry append complete; no need to hold this lsn */ + current_lsn = allocated_lsn; + allocated_lsn = 0; + } + path += strlen(path) + 1; + } + + if (file_info) + { + err = os9_decode_file_header(img, current_lsn, file_info); + if (err) + goto done; + } + + if (dirent_lsn) + *dirent_lsn = entry_lsn; + if (dirent_index) + *dirent_index = entry_index; + +done: + if (allocated_lsn != 0) + os9_deallocate_lsn(img, allocated_lsn); + return err; +} + + + +static imgtoolerr_t os9_diskimage_open(imgtool_image *image, imgtool_stream *stream) +{ + imgtoolerr_t err; + floperr_t ferr; + os9_diskinfo *info; + UINT32 track_size_in_sectors, i; //, attributes; + UINT8 header[256]; + UINT32 allocation_bitmap_lsns; + UINT8 b, mask; + + info = os9_get_diskinfo(image); + + ferr = floppy_read_sector(imgtool_floppy(image), 0, 0, 1, 0, header, sizeof(header)); + if (ferr) + return imgtool_floppy_error(ferr); + + info->total_sectors = pick_integer_be(header, 0, 3); + track_size_in_sectors = pick_integer_be(header, 3, 1); + info->allocation_bitmap_bytes = pick_integer_be(header, 4, 2); + info->cluster_size = pick_integer_be(header, 6, 2); + info->root_dir_lsn = pick_integer_be(header, 8, 3); + info->owner_id = pick_integer_be(header, 11, 2); +// attributes = + pick_integer_be(header, 13, 1); + info->disk_id = pick_integer_be(header, 14, 2); + info->format_flags = pick_integer_be(header, 16, 1); + info->sectors_per_track = pick_integer_be(header, 17, 2); + info->bootstrap_lsn = pick_integer_be(header, 21, 3); + info->bootstrap_size = pick_integer_be(header, 24, 2); + info->sector_size = pick_integer_be(header, 104, 2); + + info->sides = (info->format_flags & 0x01) ? 2 : 1; + info->double_density = (info->format_flags & 0x02) ? 1 : 0; + info->double_track = (info->format_flags & 0x04) ? 1 : 0; + info->quad_track_density = (info->format_flags & 0x08) ? 1 : 0; + info->octal_track_density = (info->format_flags & 0x10) ? 1 : 0; + + pick_string(header, 31, 32, info->name); + + if (info->sector_size == 0) + info->sector_size = 256; + + /* does the root directory and allocation bitmap collide? */ + allocation_bitmap_lsns = (info->allocation_bitmap_bytes + info->sector_size - 1) / info->sector_size; + if (1 + allocation_bitmap_lsns > info->root_dir_lsn) + return IMGTOOLERR_CORRUPTIMAGE; + + /* is the allocation bitmap too big? */ + info->allocation_bitmap = (UINT8*)imgtool_image_malloc(image, info->allocation_bitmap_bytes); + if (!info->allocation_bitmap) + return IMGTOOLERR_OUTOFMEMORY; + memset(info->allocation_bitmap, 0, info->allocation_bitmap_bytes); + + /* sectors per track and track size don't jive? */ + if (info->sectors_per_track != track_size_in_sectors) + return IMGTOOLERR_CORRUPTIMAGE; + + /* zero sectors per track? */ + if (info->sectors_per_track == 0) + return IMGTOOLERR_CORRUPTIMAGE; + + /* do we have an odd number of sectors? */ + if (info->total_sectors % info->sectors_per_track) + return IMGTOOLERR_CORRUPTIMAGE; + + /* read the allocation bitmap */ + for (i = 0; i < allocation_bitmap_lsns; i++) + { + err = os9_read_lsn(image, 1 + i, 0, &info->allocation_bitmap[i * info->sector_size], + MIN(info->allocation_bitmap_bytes - (i * info->sector_size), info->sector_size)); + if (err) + return err; + } + + /* check to make sure that the allocation bitmap and root sector are reserved */ + for (i = 0; i <= allocation_bitmap_lsns; i++) + { + b = info->allocation_bitmap[i / 8]; + mask = 1 << (7 - (i % 8)); + if ((b & mask) == 0) + return IMGTOOLERR_CORRUPTIMAGE; + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t os9_diskimage_create(imgtool_image *img, imgtool_stream *stream, option_resolution *opts) +{ + imgtoolerr_t err; + dynamic_buffer header; + UINT32 heads, tracks, sectors, sector_bytes, first_sector_id; + UINT32 cluster_size, owner_id; + UINT32 allocation_bitmap_bits, allocation_bitmap_lsns; + UINT32 attributes, format_flags, disk_id; + UINT32 i; + INT32 total_allocated_sectors; + const char *title; + time_t t; + struct tm *ltime; + + time(&t); + ltime = localtime(&t); + + heads = option_resolution_lookup_int(opts, 'H'); + tracks = option_resolution_lookup_int(opts, 'T'); + sectors = option_resolution_lookup_int(opts, 'S'); + sector_bytes = option_resolution_lookup_int(opts, 'L'); + first_sector_id = option_resolution_lookup_int(opts, 'F'); + title = ""; + + header.resize(sector_bytes); + + if (sector_bytes > 256) + sector_bytes = 256; + cluster_size = 1; + owner_id = 1; + disk_id = 1; + attributes = 0; + allocation_bitmap_bits = heads * tracks * sectors / cluster_size; + allocation_bitmap_lsns = (allocation_bitmap_bits / 8 + sector_bytes - 1) / sector_bytes; + format_flags = ((heads > 1) ? 0x01 : 0x00) | ((tracks > 40) ? 0x02 : 0x00); + + memset(&header[0], 0, sector_bytes); + place_integer_be(&header[0], 0, 3, heads * tracks * sectors); + place_integer_be(&header[0], 3, 1, sectors); + place_integer_be(&header[0], 4, 2, (allocation_bitmap_bits + 7) / 8); + place_integer_be(&header[0], 6, 2, cluster_size); + place_integer_be(&header[0], 8, 3, 1 + allocation_bitmap_lsns); + place_integer_be(&header[0], 11, 2, owner_id); + place_integer_be(&header[0], 13, 1, attributes); + place_integer_be(&header[0], 14, 2, disk_id); + place_integer_be(&header[0], 16, 1, format_flags); + place_integer_be(&header[0], 17, 2, sectors); + place_string(&header[0], 31, 32, title); + place_integer_be(&header[0], 103, 2, sector_bytes / 256); + + /* path descriptor options */ + place_integer_be(&header[0], 0x3f+0x00, 1, 1); /* device class */ + place_integer_be(&header[0], 0x3f+0x01, 1, 1); /* drive number */ + place_integer_be(&header[0], 0x3f+0x03, 1, 0x20); /* device type */ + place_integer_be(&header[0], 0x3f+0x04, 1, 1); /* density capability */ + place_integer_be(&header[0], 0x3f+0x05, 2, tracks); /* number of tracks */ + place_integer_be(&header[0], 0x3f+0x07, 1, heads); /* number of sides */ + place_integer_be(&header[0], 0x3f+0x09, 2, sectors); /* sectors per track */ + place_integer_be(&header[0], 0x3f+0x0b, 2, sectors); /* sectors on track zero */ + place_integer_be(&header[0], 0x3f+0x0d, 1, 3); /* sector interleave factor */ + place_integer_be(&header[0], 0x3f+0x0e, 1, 8); /* default sectors per allocation */ + + err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id, 0, &header[0], sector_bytes, 0); /* TODO: pass ddam argument from imgtool */ + if (err) + goto done; + + total_allocated_sectors = 1 + allocation_bitmap_lsns + 1 + 7; + + for (i = 0; i < allocation_bitmap_lsns; i++) + { + memset(&header[0], 0x00, sector_bytes); + + if (total_allocated_sectors > (8 * 256)) + { + memset(&header[0], 0xff, sector_bytes); + total_allocated_sectors -= (8 * 256); + } + else if (total_allocated_sectors > 1 ) + { + int offset; + UINT8 mask; + + while( total_allocated_sectors >= 0 ) + { + offset = total_allocated_sectors / 8; + mask = 1 << (7 - ( total_allocated_sectors % 8 ) ); + + header[offset] |= mask; + total_allocated_sectors--; + } + } + + err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + i, 0, &header[0], sector_bytes, 0); /* TODO: pass ddam argument from imgtool */ + if (err) + goto done; + } + + memset(&header[0], 0, sector_bytes); + header[0x00] = 0xBF; + header[0x01] = 0x00; + header[0x02] = 0x00; + header[0x03] = (UINT8) ltime->tm_year; + header[0x04] = (UINT8) ltime->tm_mon + 1; + header[0x05] = (UINT8) ltime->tm_mday; + header[0x06] = (UINT8) ltime->tm_hour; + header[0x07] = (UINT8) ltime->tm_min; + header[0x08] = 0x02; + header[0x09] = 0x00; + header[0x0A] = 0x00; + header[0x0B] = 0x00; + header[0x0C] = 0x40; + header[0x0D] = (UINT8) (ltime->tm_year % 100); + header[0x0E] = (UINT8) ltime->tm_mon; + header[0x0F] = (UINT8) ltime->tm_mday; + place_integer_be(&header[0], 0x10, 3, 1 + allocation_bitmap_lsns + 1); + place_integer_be(&header[0], 0x13, 2, 8); + + err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + allocation_bitmap_lsns, 0, &header[0], sector_bytes, 0); /* TODO: pass ddam argument from imgtool */ + if (err) + goto done; + + memset(&header[0], 0, sector_bytes); + header[0x00] = 0x2E; + header[0x01] = 0xAE; + header[0x1F] = 1 + allocation_bitmap_lsns; + header[0x20] = 0xAE; + header[0x3F] = 1 + allocation_bitmap_lsns; + err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 2 + allocation_bitmap_lsns, 0, &header[0], sector_bytes, 0); /* TOOD: pass ddam argument from imgtool */ + if (err) + goto done; + +done: + return err; +} + + + +static imgtoolerr_t os9_diskimage_beginenum(imgtool_directory *enumeration, const char *path) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + struct os9_direnum *os9enum; + imgtool_image *image; + + image = imgtool_directory_image(enumeration); + os9enum = os9_get_dirinfo(enumeration); + + err = os9_lookup_path(image, path, CREATE_NONE, &os9enum->dir_info, NULL, NULL, NULL); + if (err) + goto done; + + /* this had better be a directory */ + if (!os9enum->dir_info.directory) + { + err = IMGTOOLERR_CORRUPTIMAGE; + goto done; + } + +done: + return err; +} + + + +static imgtoolerr_t os9_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + struct os9_direnum *os9enum; + UINT32 lsn, index; + imgtoolerr_t err; + UINT8 dir_entry[32]; + char filename[29]; + struct os9_fileinfo file_info; + imgtool_image *image; + + image = imgtool_directory_image(enumeration); + os9enum = os9_get_dirinfo(enumeration); + + do + { + /* check for EOF */ + if (os9enum->index >= os9enum->dir_info.file_size) + { + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + + /* locate the LSN and offset for this directory entry */ + index = os9enum->index; + lsn = os9_lookup_lsn(image, &os9enum->dir_info, &index); + + /* read the directory entry out of the lSN */ + err = os9_read_lsn(image, lsn, index, dir_entry, sizeof(dir_entry)); + if (err) + return err; + + if (dir_entry[0]) + { + /* read the file or directory name */ + pick_string(dir_entry, 0, 28, filename); + + /* we have certain expectations of the directory contents; the + * first directory entry should be "..", the second ".", and + * subsequent entries should never be "." or ".." */ + switch(os9enum->index) + { + case 0: + if (strcmp(filename, "..")) + imgtool_warn("First entry in directory should be \"..\" and not \"%s\"", filename); + break; + + case 32: + if (strcmp(filename, ".")) + imgtool_warn("Second entry in directory should be \".\" and not \"%s\"", filename); + break; + + default: + if (!strcmp(filename, ".") || !strcmp(filename, "..")) + imgtool_warn("Directory entry %d should not be \"%s\"", index / 32, filename); + break; + } + + /* if the filename is ".", the file should point to the current directory */ + if (!strcmp(filename, ".") && (pick_integer_be(dir_entry, 29, 3) != os9enum->dir_info.lsn)) + { + imgtool_warn("Directory \".\" does not point back to same directory"); + } + } + else + { + /* no more directory entries */ + filename[0] = '\0'; + } + + /* move on to the next directory entry */ + os9enum->index += 32; + } + while(!filename[0] || !strcmp(filename, ".") || !strcmp(filename, "..")); + + /* read file attributes */ + lsn = pick_integer_be(dir_entry, 29, 3); + err = os9_decode_file_header(imgtool_directory_image(enumeration), lsn, &file_info); + if (err) + return err; + + /* fill out imgtool_dirent structure */ + snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", filename); + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c%c%c%c%c%c%c%c", + file_info.directory ? 'd' : '-', + file_info.non_sharable ? 's' : '-', + file_info.public_execute ? 'x' : '-', + file_info.public_write ? 'w' : '-', + file_info.public_read ? 'r' : '-', + file_info.user_execute ? 'x' : '-', + file_info.user_write ? 'w' : '-', + file_info.user_read ? 'r' : '-'); + + ent->directory = file_info.directory; + ent->corrupt = (dir_entry[28] != 0); + ent->filesize = file_info.file_size; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t os9_diskimage_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtool_image *image = imgtool_partition_image(partition); + const os9_diskinfo *disk_info; + UINT32 free_lsns; + + disk_info = os9_get_diskinfo(image); + free_lsns = os9_get_free_lsns(image); + + *size = free_lsns * disk_info->sector_size; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t os9_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t err; + imgtool_image *img = imgtool_partition_image(partition); + const os9_diskinfo *disk_info; + struct os9_fileinfo file_info; + UINT8 buffer[256]; + int i, j; + UINT32 file_size; + UINT32 used_size; + + disk_info = os9_get_diskinfo(img); + + err = os9_lookup_path(img, filename, CREATE_NONE, &file_info, NULL, NULL, NULL); + if (err) + return err; + if (file_info.directory) + return IMGTOOLERR_FILENOTFOUND; + file_size = file_info.file_size; + + for (i = 0; file_info.sector_map[i].count > 0; i++) + { + for (j = 0; j < file_info.sector_map[i].count; j++) + { + used_size = MIN(file_size, disk_info->sector_size); + err = os9_read_lsn(img, file_info.sector_map[i].lsn + j, 0, + buffer, used_size); + if (err) + return err; + stream_write(destf, buffer, used_size); + file_size -= used_size; + } + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t os9_diskimage_writefile(imgtool_partition *partition, const char *path, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + struct os9_fileinfo file_info; + size_t write_size; + dynamic_buffer buf; + int i = -1; + UINT32 lsn = 0; + UINT32 count = 0; + UINT32 sz; + const os9_diskinfo *disk_info; + + disk_info = os9_get_diskinfo(image); + + buf.resize(disk_info->sector_size); + + err = os9_lookup_path(image, path, CREATE_FILE, &file_info, NULL, NULL, NULL); + if (err) + goto done; + + sz = (UINT32) stream_size(sourcef); + + err = os9_set_file_size(image, &file_info, sz); + if (err) + goto done; + + while(sz > 0) + { + write_size = (size_t) MIN(sz, (UINT64) disk_info->sector_size); + + stream_read(sourcef, &buf[0], write_size); + + while(count == 0) + { + i++; + lsn = file_info.sector_map[i].lsn; + count = file_info.sector_map[i].count; + } + + err = os9_write_lsn(image, lsn, 0, &buf[0], write_size); + if (err) + goto done; + + lsn++; + count--; + sz -= write_size; + } + +done: + return err; +} + + + +static imgtoolerr_t os9_diskimage_delete(imgtool_partition *partition, const char *path, + unsigned int delete_directory) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + //const os9_diskinfo *disk_info; + struct os9_fileinfo file_info; + UINT32 dirent_lsn, dirent_index; + UINT32 entry_lsn, entry_index; + UINT32 i, j, lsn; + UINT8 b; + + //disk_info = os9_get_diskinfo(image); + + err = os9_lookup_path(image, path, CREATE_NONE, &file_info, NULL, &dirent_lsn, &dirent_index); + if (err) + return err; + if (file_info.directory != delete_directory) + return IMGTOOLERR_FILENOTFOUND; + + /* make sure that if we are deleting a directory, it is empty */ + if (delete_directory) + { + for (i = 64; i < file_info.file_size; i += 32) + { + entry_index = i; + entry_lsn = os9_lookup_lsn(image, &file_info, &entry_index); + + err = os9_read_lsn(image, entry_lsn, entry_index, &b, 1); + if (err) + return err; + + /* this had better be a deleted file, if not we can't delete */ + if (b != 0) + return IMGTOOLERR_DIRNOTEMPTY; + } + } + + /* zero out the file entry */ + b = '\0'; + err = os9_write_lsn(image, dirent_lsn, dirent_index, &b, 1); + if (err) + return err; + + /* get the link count */ + err = os9_read_lsn(image, file_info.lsn, 8, &b, 1); + if (err) + return err; + + if (b > 0) + b--; + if (b > 0) + { + /* link count is greater than zero */ + err = os9_write_lsn(image, file_info.lsn, 8, &b, 1); + if (err) + return err; + } + else + { + /* no more links; outright delete the file */ + err = os9_deallocate_lsn(image, file_info.lsn); + if (err) + return err; + + for (i = 0; (i < ARRAY_LENGTH(file_info.sector_map)) && file_info.sector_map[i].count; i++) + { + lsn = file_info.sector_map[i].lsn; + for (j = 0; j < file_info.sector_map[i].count; j++) + { + err = os9_deallocate_lsn(image, lsn + j); + if (err) + return err; + } + } + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t os9_diskimage_deletefile(imgtool_partition *partition, const char *path) +{ + return os9_diskimage_delete(partition, path, 0); +} + + + +static imgtoolerr_t os9_diskimage_createdir(imgtool_partition *partition, const char *path) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + struct os9_fileinfo file_info; + UINT8 dir_data[64]; + UINT32 parent_lsn; + + err = os9_lookup_path(image, path, CREATE_DIR, &file_info, &parent_lsn, NULL, NULL); + if (err) + goto done; + + err = os9_set_file_size(image, &file_info, 64); + if (err) + goto done; + + /* create intial directories */ + memset(dir_data, 0, sizeof(dir_data)); + place_string(dir_data, 0, 32, ".."); + place_integer_be(dir_data, 29, 3, parent_lsn); + place_string(dir_data, 32, 32, "."); + place_integer_be(dir_data, 61, 3, file_info.lsn); + + err = os9_write_lsn(image, file_info.sector_map[0].lsn, 0, dir_data, sizeof(dir_data)); + if (err) + goto done; + +done: + return err; +} + + + +static imgtoolerr_t os9_diskimage_deletedir(imgtool_partition *partition, const char *path) +{ + return os9_diskimage_delete(partition, path, 1); +} + + + +void os9_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break; + case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break; + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(os9_diskinfo); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct os9_direnum); break; + case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "os9"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "OS-9 format"); break; + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; + case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = os9_diskimage_create; break; + case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = os9_diskimage_open; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = os9_diskimage_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = os9_diskimage_nextenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = os9_diskimage_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = os9_diskimage_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = os9_diskimage_writefile; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = os9_diskimage_deletefile; break; + case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = os9_diskimage_createdir; break; + case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = os9_diskimage_deletedir; break; + case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_coco; break; + } +} diff --git a/src/mame/tools/imgtool/modules/pc_flop.c b/src/mame/tools/imgtool/modules/pc_flop.c new file mode 100644 index 00000000000..916cf873c46 --- /dev/null +++ b/src/mame/tools/imgtool/modules/pc_flop.c @@ -0,0 +1,173 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/**************************************************************************** + + pc_flop.c + + PC floppies + +****************************************************************************/ + +#include "imgtool.h" +#include "formats/imageutl.h" +#include "formats/pc_dsk.h" +#include "fat.h" +#include "iflopimg.h" + +#define FAT_SECLEN 512 + + +static imgtoolerr_t fat_image_create(imgtool_image *image, imgtool_stream *stream, option_resolution *opts) +{ + imgtoolerr_t err; + UINT32 tracks, heads, sectors; + UINT8 buffer[FAT_SECLEN]; + imgtool_class imgclass = { fat_get_info }; + imgtoolerr_t (*fat_partition_create)(imgtool_image *image, UINT64 first_block, UINT64 block_count); + + tracks = option_resolution_lookup_int(opts, 'T'); + heads = option_resolution_lookup_int(opts, 'H'); + sectors = option_resolution_lookup_int(opts, 'S'); + + /* set up just enough of a boot sector to specify geometry */ + memset(buffer, 0, sizeof(buffer)); + place_integer_le(buffer, 24, 2, sectors); + place_integer_le(buffer, 26, 2, heads); + place_integer_le(buffer, 19, 2, (UINT16) (((UINT64) tracks * heads * sectors) >> 0)); + place_integer_le(buffer, 32, 4, (UINT16) (((UINT64) tracks * heads * sectors) >> 16)); + err = imgtool_image_write_block(image, 0, buffer); + if (err) + goto done; + + /* load fat_partition_create */ + fat_partition_create = (imgtoolerr_t (*)(imgtool_image *, UINT64, UINT64)) + imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CREATE_PARTITION); + + /* actually create the partition */ + err = fat_partition_create(image, 0, ((UINT64) tracks) * heads * sectors); + if (err) + goto done; + +done: + return err; +} + + + +static imgtoolerr_t fat_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors) +{ + imgtoolerr_t err; + UINT64 total_sectors; + UINT8 buffer[FAT_SECLEN]; + + err = imgtool_image_read_block(image, 0, buffer); + if (err) + return err; + + total_sectors = pick_integer_le(buffer, 19, 2) + | (pick_integer_le(buffer, 32, 4) << 16); + + *sectors = pick_integer_le(buffer, 24, 2); + *heads = pick_integer_le(buffer, 26, 2); + *tracks = total_sectors / *heads / *sectors; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_get_sector_position(imgtool_image *image, UINT32 sector_index, + UINT32 *track, UINT32 *head, UINT32 *sector) +{ + imgtoolerr_t err; + UINT32 tracks, heads, sectors; + + if (sector_index == 0) + { + /* special case */ + *head = 0; + *track = 0; + *sector = 1; + } + else + { + err = imgtool_image_get_geometry(image, &tracks, &heads, §ors); + if (err) + return err; + + *track = sector_index / sectors / heads; + *head = (sector_index / sectors) % heads; + *sector = 1 + (sector_index % sectors); + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_image_readblock(imgtool_image *image, void *buffer, UINT64 block) +{ + imgtoolerr_t err; + floperr_t ferr; + UINT32 track, head, sector; + UINT32 block_size; + + err = imgtool_image_get_block_size(image, &block_size); + if (err) + return err; + + err = fat_get_sector_position(image, block, &track, &head, §or); + if (err) + return err; + + ferr = floppy_read_sector(imgtool_floppy(image), head, track, sector, 0, buffer, block_size); + if (ferr) + return imgtool_floppy_error(ferr); + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t fat_image_writeblock(imgtool_image *image, const void *buffer, UINT64 block) +{ + imgtoolerr_t err; + floperr_t ferr; + UINT32 track, head, sector; + UINT32 block_size; + + err = imgtool_image_get_block_size(image, &block_size); + if (err) + return err; + + err = fat_get_sector_position(image, block, &track, &head, §or); + if (err) + return err; + + ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, block_size, 0); /* TODO: pass ddam argument from imgtool */ + if (ferr) + return imgtool_floppy_error(ferr); + return IMGTOOLERR_SUCCESS; +} + + + +void pc_floppy_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_BLOCK_SIZE: info->i = FAT_SECLEN; break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "fat"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "FAT format"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; + case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = fat_image_create; break; + case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_pc; break; + case IMGTOOLINFO_PTR_READ_BLOCK: info->read_block = fat_image_readblock; break; + case IMGTOOLINFO_PTR_WRITE_BLOCK: info->write_block = fat_image_writeblock; break; + case IMGTOOLINFO_PTR_GET_GEOMETRY: info->get_geometry = fat_image_get_geometry; break; + + default: fat_get_info(imgclass, state, info); break; + } +} diff --git a/src/mame/tools/imgtool/modules/pc_hard.c b/src/mame/tools/imgtool/modules/pc_hard.c new file mode 100644 index 00000000000..915032932c7 --- /dev/null +++ b/src/mame/tools/imgtool/modules/pc_hard.c @@ -0,0 +1,470 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/**************************************************************************** + + pc_hard.c + + PC hard drives + +***************************************************************************** + + Master boot record format: + + Offset Length Description + ------ ------ ----------- + 0 446 Boot machine code + 446 16 Partion #1 info + 462 16 Partion #2 info + 478 16 Partion #3 info + 494 16 Partion #4 info + 510 2 Magic bytes (0x55 0xAA) + + + Partition info format: + + Offset Length Description + ------ ------ ----------- + 0 1 Bootable (0x80=bootable 0x00=not bootable) + 1 1 Starting head + 2 1 Starting sector (bits 5-0) and high bits of starting track (bits 6-5) + 3 1 Low bits of starting track + 4 1 Partition type: + 0x00 Unused + 0x?1 FAT12 (0-15 MB) + 0x?2 XENIX + 0x?4 FAT16 (16-32 MB) + 0x?6 FAT16` (32 MB-2 GB) + 0x?7 HPFS or NTFS + 0x?A Boot Manager + 0x?B FAT32 (512 MB-2 TB) + 0x?C FAT32 (512 MB-2 TB LBA) + 0x1? OS/2 Boot manager/Win95 hidden + 0xC? DR-DOS secured partition + 0xD? Multiuser DOS secured partition + 0xE? SpeedStor extended partition + 5 1 Ending head + 6 1 Ending sector (bits 5-0) and high bits of ending track (bits 6-5) + 7 1 Low bits of ending track + 8 4 Sector index of beginning of partition + 12 4 Total sectors in partition + +****************************************************************************/ +#include "imgtool.h" +#include "formats/imageutl.h" +#include "imghd.h" + +#define FAT_SECLEN 512 + +static OPTION_GUIDE_START( pc_chd_create_optionguide ) + OPTION_INT('T', "cylinders", "Cylinders" ) + OPTION_INT('H', "heads", "Heads" ) + OPTION_INT('S', "sectors", "Sectors" ) +OPTION_GUIDE_END + +static const char pc_chd_create_optionspec[] = "H1-[16]S1-[32]-63T10/20/30/40/50/60/70/80/90/[100]/110/120/130/140/150/160/170/180/190/200"; + +static const char fat8_string[8] = { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' }; +static const char fat12_string[8] = { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' }; +static const char fat16_string[8] = { 'F', 'A', 'T', '1', '6', ' ', ' ', ' ' }; +//static const char fat32_string[8] = { 'F', 'A', 'T', '3', '2', ' ', ' ', ' ' }; + +/* imports from fat.c */ +extern void fat_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); + + +struct pc_chd_image_info +{ + struct mess_hard_disk_file hard_disk; + + struct + { + unsigned int corrupt : 1; + UINT8 partition_type; + UINT32 fat_bits; + UINT32 starting_track; + UINT32 starting_head; + UINT32 starting_sector; + UINT32 ending_track; + UINT32 ending_head; + UINT32 ending_sector; + UINT32 sector_index; + UINT32 total_sectors; + } partitions[4]; +}; + + + +static pc_chd_image_info *pc_chd_get_image_info(imgtool_image *image) +{ + return (pc_chd_image_info *) imgtool_image_extra_bytes(image); +} + + + +static void pc_chd_locate_block(imgtool_image *image, UINT64 block, UINT32 *cylinder, UINT32 *head, UINT32 *sector) +{ + pc_chd_image_info *info; + const hard_disk_info *hd_info; + + info = pc_chd_get_image_info(image); + hd_info = imghd_get_header(&info->hard_disk); + + *sector = block % hd_info->sectors; + *head = (block / hd_info->sectors) % hd_info->heads; + *cylinder = block / hd_info->sectors / hd_info->heads; +} + + + +static imgtoolerr_t pc_chd_partition_create(imgtool_image *image, int partition_index, UINT64 first_block, UINT64 block_count) +{ + imgtoolerr_t err; + UINT8 header_block[FAT_SECLEN]; + UINT8 partition_block[FAT_SECLEN]; + UINT8 partition_type; + UINT8 *fat_type; + UINT8 *partition_entry; + UINT32 first_cylinder, first_head, first_sector; + UINT32 last_cylinder, last_head, last_sector; + imgtool_class imgclass = { fat_get_info }; + imgtoolerr_t (*fat_partition_create)(imgtool_image *image, UINT64 first_block, UINT64 block_count); + + /* sanity checks */ + assert((partition_index >= 0) && (partition_index <= 3)); + + /* compute geometry */ + pc_chd_locate_block(image, first_block, &first_cylinder, &first_head, &first_sector); + pc_chd_locate_block(image, first_block + block_count - 1, &last_cylinder, &last_head, &last_sector); + + /* load fat_partition_create */ + fat_partition_create = (imgtoolerr_t (*)(imgtool_image *, UINT64, UINT64)) + imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CREATE_PARTITION); + + /* first create the actual partition */ + err = fat_partition_create(image, first_block, block_count); + if (err) + goto done; + + /* read the first block of the partition, to determine the type of FAT */ + err = imgtool_image_read_block(image, first_block, partition_block); + if (err) + goto done; + fat_type = &partition_block[54]; + if (!memcmp(fat_type, fat8_string, sizeof(fat8_string))) + partition_type = 0x01; + else if (!memcmp(fat_type, fat12_string, sizeof(fat12_string))) + partition_type = 0x01; + else if ((!memcmp(fat_type, fat16_string, sizeof(fat16_string))) && (block_count < 32*1024*1024/FAT_SECLEN)) + partition_type = 0x04; + else if ((!memcmp(fat_type, fat16_string, sizeof(fat16_string))) && (block_count >= 32*1024*1024/FAT_SECLEN)) + partition_type = 0x06; + else + partition_type = 0x0B; + + /* read the partition header */ + err = imgtool_image_read_block(image, 0, header_block); + if (err) + goto done; + + /* fill out the partition entry */ + partition_entry = &header_block[446 + (partition_index * 16)]; + place_integer_le(partition_entry, 0, 1, 0x80); + place_integer_le(partition_entry, 1, 1, first_head); + place_integer_le(partition_entry, 2, 1, ((first_sector & 0x3F) | (first_cylinder >> 8 << 2))); + place_integer_le(partition_entry, 3, 1, first_cylinder); + place_integer_le(partition_entry, 4, 1, partition_type); + place_integer_le(partition_entry, 5, 1, last_head); + place_integer_le(partition_entry, 6, 1, ((last_sector & 0x3F) | (last_cylinder >> 8 << 2))); + place_integer_le(partition_entry, 7, 1, last_cylinder); + place_integer_le(partition_entry, 8, 4, first_block); + place_integer_le(partition_entry, 12, 4, block_count); + + /* write the partition header */ + err = imgtool_image_write_block(image, 0, header_block); + if (err) + goto done; + +done: + return err; +} + + + +static imgtoolerr_t pc_chd_read_partition_header(imgtool_image *image) +{ + imgtoolerr_t err; + int i; + const UINT8 *partition_info; + pc_chd_image_info *info; + UINT8 buffer[FAT_SECLEN]; + + info = pc_chd_get_image_info(image); + + /* read the initial block */ + err = imgtool_image_read_block(image, 0, buffer); + if (err) + return err; + + /* magic bytes present? */ + if ((buffer[510] != 0x55) || (buffer[511] != 0xAA)) + return IMGTOOLERR_CORRUPTIMAGE; + + for (i = 0; i < ARRAY_LENGTH(info->partitions); i++) + { + partition_info = &buffer[446 + i * 16]; + + info->partitions[i].partition_type = partition_info[4]; + info->partitions[i].starting_head = partition_info[1]; + info->partitions[i].starting_track = ((partition_info[2] << 2) & 0xFF00) | partition_info[3]; + info->partitions[i].starting_sector = partition_info[2] & 0x3F; + info->partitions[i].ending_head = partition_info[5]; + info->partitions[i].ending_track = ((partition_info[6] << 2) & 0xFF00) | partition_info[7]; + info->partitions[i].ending_sector = partition_info[6] & 0x3F; + + info->partitions[i].sector_index = pick_integer_le(partition_info, 8, 4); + info->partitions[i].total_sectors = pick_integer_le(partition_info, 12, 4); + + if (info->partitions[i].starting_track > info->partitions[i].ending_track) + return IMGTOOLERR_CORRUPTIMAGE; + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t pc_chd_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *opts) +{ + imgtoolerr_t err; + UINT32 cylinders, heads, sectors; + pc_chd_image_info *info; + UINT8 header_block[FAT_SECLEN]; + + cylinders = option_resolution_lookup_int(opts, 'T'); + heads = option_resolution_lookup_int(opts, 'H'); + sectors = option_resolution_lookup_int(opts, 'S'); + + info = pc_chd_get_image_info(image); + + /* create the hard disk image */ + err = imghd_create(f, 0, cylinders, heads, sectors, FAT_SECLEN); + if (err) + goto done; + + err = imghd_open(f, &info->hard_disk); + if (err) + goto done; + + /* set up partition header block */ + memset(header_block, 0, sizeof(header_block)); + header_block[510] = 0x55; + header_block[511] = 0xAA; + err = imgtool_image_write_block(image, 0, header_block); + if (err) + goto done; + + err = pc_chd_partition_create(image, 0, 1, cylinders * heads * sectors - 1); + if (err) + goto done; + + err = pc_chd_read_partition_header(image); + if (err) + goto done; + +done: + if (err) + imghd_close(&info->hard_disk); + return err; +} + + + +static imgtoolerr_t pc_chd_image_open(imgtool_image *image, imgtool_stream *stream) +{ + imgtoolerr_t err; + pc_chd_image_info *info; + + info = pc_chd_get_image_info(image); + + /* open the hard drive */ + err = imghd_open(stream, &info->hard_disk); + if (err) + return err; + + err = pc_chd_read_partition_header(image); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static void pc_chd_image_close(imgtool_image *image) +{ + pc_chd_image_info *info; + info = pc_chd_get_image_info(image); + imghd_close(&info->hard_disk); +} + + + +static imgtoolerr_t pc_chd_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors) +{ + pc_chd_image_info *info; + const hard_disk_info *hd_info; + + info = pc_chd_get_image_info(image); + hd_info = imghd_get_header(&info->hard_disk); + + *tracks = hd_info->cylinders; + *heads = hd_info->heads; + *sectors = hd_info->sectors; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t pc_chd_image_getsectorsize(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size) +{ + pc_chd_image_info *info; + info = pc_chd_get_image_info(image); + *sector_size = imghd_get_header(&info->hard_disk)->sectorbytes; + return IMGTOOLERR_SUCCESS; +} + + + +static UINT32 pc_chd_calc_lbasector(pc_chd_image_info *info, UINT32 track, UINT32 head, UINT32 sector) +{ + UINT32 lbasector; + const hard_disk_info *hd_info; + + hd_info = imghd_get_header(&info->hard_disk); + lbasector = track; + lbasector *= hd_info->heads; + lbasector += head; + lbasector *= hd_info->sectors; + lbasector += sector; + return lbasector; +} + + + +static imgtoolerr_t pc_chd_image_readsector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len) +{ + pc_chd_image_info *info; + info = pc_chd_get_image_info(image); + return imghd_read(&info->hard_disk, + pc_chd_calc_lbasector(info, track, head, sector), + buffer); +} + + + +static imgtoolerr_t pc_chd_image_writesector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam) +{ + pc_chd_image_info *info; + info = pc_chd_get_image_info(image); + return imghd_write(&info->hard_disk, + pc_chd_calc_lbasector(info, track, head, sector), + buffer); +} + + + +static imgtoolerr_t pc_chd_image_readblock(imgtool_image *image, void *buffer, UINT64 block) +{ + pc_chd_image_info *info; + info = pc_chd_get_image_info(image); + return imghd_read(&info->hard_disk, block, buffer); +} + + + +static imgtoolerr_t pc_chd_image_writeblock(imgtool_image *image, const void *buffer, UINT64 block) +{ + pc_chd_image_info *info; + info = pc_chd_get_image_info(image); + return imghd_write(&info->hard_disk, block, buffer); +} + + + +static imgtoolerr_t pc_chd_list_partitions(imgtool_image *image, imgtool_partition_info *partitions, size_t len) +{ + pc_chd_image_info *info; + size_t i; + + info = pc_chd_get_image_info(image); + + for (i = 0; i < MIN(4, len); i++) + { + partitions[i].base_block = info->partitions[i].sector_index; + partitions[i].block_count = info->partitions[i].total_sectors; + + switch(info->partitions[i].partition_type) + { + case 0x00: /* Empty Partition */ + partitions[i].get_info = NULL; + break; + + case 0x01: /* FAT12 */ + case 0x04: /* FAT16 (-32 MB) */ + case 0x06: /* FAT16 (32+ MB) */ + case 0x0B: /* FAT32 */ + case 0x0C: /* FAT32 (LBA Mapped) */ + case 0x0E: /* FAT16 (LBA Mapped) */ + case 0x11: /* OS/2 FAT12 */ + case 0x14: /* OS/2 FAT16 (-32 MB) */ + case 0x16: /* OS/2 FAT16 (32+ MB) */ + case 0x1B: /* Hidden Win95 FAT32 */ + case 0x1C: /* Hidden Win95 FAT32 (LBA Mapped) */ + case 0x1D: /* Hidden Win95 FAT16 (LBA Mapped) */ + case 0xC1: /* DR-DOS FAT12 */ + case 0xC4: /* DR-DOS FAT16 (-32 MB) */ + case 0xC6: /* DR-DOS FAT16 (32+ MB) */ + case 0xD1: /* Old Multiuser DOS FAT12 */ + case 0xD4: /* Old Multiuser DOS FAT16 (-32 MB) */ + case 0xD6: /* Old Multiuser DOS FAT16 (32+ MB) */ + partitions[i].get_info = fat_get_info; + break; + + default: + partitions[i].get_info = unknown_partition_get_info; + break; + } + } + return IMGTOOLERR_SUCCESS; +} + + + +void pc_chd_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_BLOCK_SIZE: info->i = FAT_SECLEN; break; + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(pc_chd_image_info); break; + case IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS: info->i = 1; break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc_chd"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "PC CHD disk image"); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "chd"); break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), pc_chd_create_optionspec); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_CREATE: info->create = pc_chd_image_create; break; + case IMGTOOLINFO_PTR_OPEN: info->open = pc_chd_image_open; break; + case IMGTOOLINFO_PTR_CLOSE: info->close = pc_chd_image_close; break; + case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = pc_chd_image_readsector; break; + case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = pc_chd_image_writesector; break; + case IMGTOOLINFO_PTR_READ_BLOCK: info->read_block = pc_chd_image_readblock; break; + case IMGTOOLINFO_PTR_WRITE_BLOCK: info->write_block = pc_chd_image_writeblock; break; + case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = pc_chd_image_getsectorsize; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = pc_chd_create_optionguide; break; + case IMGTOOLINFO_PTR_GET_GEOMETRY: info->get_geometry = pc_chd_image_get_geometry; break; + case IMGTOOLINFO_PTR_LIST_PARTITIONS: info->list_partitions = pc_chd_list_partitions; break; + } +} diff --git a/src/mame/tools/imgtool/modules/prodos.c b/src/mame/tools/imgtool/modules/prodos.c new file mode 100644 index 00000000000..5800e2bf9f3 --- /dev/null +++ b/src/mame/tools/imgtool/modules/prodos.c @@ -0,0 +1,2282 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/**************************************************************************** + + prodos.c + + Apple II ProDOS disk images + +***************************************************************************** + + Notes: + - ProDOS disks are split into 512 byte blocks. + + ProDOS directory structure: + + Offset Length Description + ------ ------ ----------- + 0 2 ??? + 2 2 Next block (0 if end) + 4 39 Directory Entry + 43 39 Directory Entry + ... + 472 39 Directory Entry + 511 1 ??? + + + ProDOS directory entry structure: + + Offset Length Description + ------ ------ ----------- + 0 1 Storage type (bits 7-4) + 10 - Seedling File (1 block) + 20 - Sapling File (2-256 blocks) + 30 - Tree File (257-32768 blocks) + 40 - Pascal Areas on ProFile HDs (???) + 50 - GS/OS Extended File (data and rsrc fork) + E0 - Subdirectory Header + F0 - Volume Header + 1 15 File name (NUL padded) + 16 1 File type + 17 2 Key pointer + 19 2 Blocks used + 21 3 File size + 24 4 Creation date + 28 1 ProDOS version that created the file + 29 1 Minimum ProDOS version needed to read the file + 30 1 Access byte + 31 2 Auxilary file type + 33 4 Last modified date + 37 2 Header pointer + + + In "seedling files", the key pointer points to a single block that is the + whole file. In "sapling files", the key pointer points to an index block + that contains 256 2-byte index pointers that point to the actual blocks of + the files. These 2-byte values are not contiguous; the low order byte is + in the first half of the block, and the high order byte is in the second + half of the block. In "tree files", the key pointer points to an index + block of index blocks. + + ProDOS dates are 32-bit little endian values + + bits 0- 4 Day + bits 5- 8 Month (0-11) + bits 9-15 Year (0-49 is 2000-2049, 50-99 is 1950-1999) + bits 16-21 Minute + bits 24-28 Hour + + + ProDOS directory and volume headers have this information: + + Offset Length Description + ------ ------ ----------- + 31 1 Length of the entry; generally is 39 + 32 1 Number of entries per block; generally is 13 + 33 2 Active entry count in directory + 35 2 Volume bitmap block number + 37 2 Total blocks on volume + + GS/OS Extended Files (storage type $5) point to an extended key block that + contains information about the two forks. The first half of the extended + key block contains info about the data form, and the second half the + resource fork. Both sides have the following format: + + Offset Length Description + ------ ------ ----------- + 0 1 Storage type (bits 3-0, unlike the directory entry) + 1 2 Key pointer + 3 2 Blocks used + 5 3 File size + 8 1 Size of secondary info #1 (must be 18 to be valid) + 9 1 Secondary info #1 type (1=FInfo 2=xFInfo) + 10 16 FInfo or xFInfo + 26 1 Size of secondary info #2 (must be 18 to be valid) + 27 1 Secondary info #2 type (1=FInfo 2=xFInfo) + 28 16 FInfo or xFInfo + + FInfo format: + + Offset Length Description + ------ ------ ----------- + 0 4 File type + 4 4 File creator + 8 2 Finder flags + 10 2 X Coordinate + 12 2 Y Coordinate + 14 2 Finder folder + + xFInfo format: + + Offset Length Description + ------ ------ ----------- + 0 2 Icon ID + 2 6 Reserved + 8 1 Script Code + 9 1 Extended flags + 10 2 Comment ID + 12 4 Put Away Directory + + + For more info, consult ProDOS technical note #25 + (http://web.pdx.edu/~heiss/technotes/pdos/tn.pdos.25.html) + +*****************************************************************************/ + +#include "imgtool.h" +#include "formats/imageutl.h" +#include "formats/ap2_dsk.h" +#include "formats/ap_dsk35.h" +#include "iflopimg.h" +#include "macutil.h" + +#define ROOTDIR_BLOCK 2 +#define BLOCK_SIZE 512 + +struct prodos_diskinfo +{ + imgtoolerr_t (*load_block)(imgtool_image *image, int block, void *buffer); + imgtoolerr_t (*save_block)(imgtool_image *image, int block, const void *buffer); + UINT8 dirent_size; + UINT8 dirents_per_block; + UINT16 volume_bitmap_block; + UINT16 total_blocks; +}; + +struct prodos_direnum +{ + UINT32 block; + UINT32 index; + UINT8 block_data[BLOCK_SIZE]; +}; + +struct prodos_dirent +{ + char filename[16]; + UINT8 storage_type; + UINT16 extkey_pointer; + UINT16 key_pointer[2]; + UINT32 filesize[2]; + int depth[2]; + UINT32 lastmodified_time; + UINT32 creation_time; + + /* FInfo */ + UINT32 file_type; + UINT32 file_creator; + UINT16 finder_flags; + UINT16 coord_x; + UINT16 coord_y; + UINT16 finder_folder; + + /* xFInfo */ + UINT16 icon_id; + UINT8 script_code; + UINT8 extended_flags; + UINT16 comment_id; + UINT32 putaway_directory; +}; + +enum creation_policy_t +{ + CREATE_NONE, + CREATE_FILE, + CREATE_DIR +}; + + + +static time_t prodos_crack_time(UINT32 prodos_time) +{ + struct tm t; + time_t now; + + time(&now); + t = *localtime(&now); + + t.tm_sec = 0; + t.tm_min = (prodos_time >> 16) & 0x3F; + t.tm_hour = (prodos_time >> 24) & 0x1F; + t.tm_mday = (prodos_time >> 0) & 0x1F; + t.tm_mon = (prodos_time >> 5) & 0x0F; + t.tm_year = (prodos_time >> 9) & 0x7F; + + if (t.tm_year <= 49) + t.tm_year += 100; + return mktime(&t); +} + + + +static UINT32 prodos_setup_time(time_t ansi_time) +{ + struct tm t; + UINT32 result = 0; + + t = *localtime(&ansi_time); + if ((t.tm_year >= 100) && (t.tm_year <= 149)) + t.tm_year -= 100; + + result |= (((UINT32) t.tm_min) & 0x003F) << 16; + result |= (((UINT32) t.tm_hour) & 0x001F) << 24; + result |= (((UINT32) t.tm_mday) & 0x001F) << 0; + result |= (((UINT32) t.tm_mon) & 0x000F) << 5; + result |= (((UINT32) t.tm_year) & 0x007F) << 9; + return result; +} + + + +static UINT32 prodos_time_now(void) +{ + time_t now; + time(&now); + return prodos_setup_time(now); +} + + + +static int is_file_storagetype(UINT8 storage_type) +{ + return ((storage_type >= 0x10) && (storage_type <= 0x3F)) + || ((storage_type >= 0x50) && (storage_type <= 0x5F)); +} + + + +static int is_normalfile_storagetype(UINT8 storage_type) +{ + return ((storage_type >= 0x10) && (storage_type <= 0x3F)); +} + + + +static int is_extendedfile_storagetype(UINT8 storage_type) +{ + return ((storage_type >= 0x50) && (storage_type <= 0x5F)); +} + + + +static int is_dir_storagetype(UINT8 storage_type) +{ + return (storage_type >= 0xE0) && (storage_type <= 0xEF); +} + + + +static prodos_diskinfo *get_prodos_info(imgtool_image *image) +{ + prodos_diskinfo *info; + info = (prodos_diskinfo *) imgtool_floppy_extrabytes(image); + return info; +} + + + +/* ----------------------------------------------------------------------- */ + +static void prodos_find_block_525(imgtool_image *image, int block, + UINT32 *track, UINT32 *head, UINT32 *sector1, UINT32 *sector2) +{ + static const UINT8 skewing[] = + { + 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, + 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F + }; + + block *= 2; + + *track = block / APPLE2_SECTOR_COUNT; + *head = 0; + *sector1 = skewing[block % APPLE2_SECTOR_COUNT + 0]; + *sector2 = skewing[block % APPLE2_SECTOR_COUNT + 1]; +} + + + +static imgtoolerr_t prodos_load_block_525(imgtool_image *image, + int block, void *buffer) +{ + floperr_t ferr; + UINT32 track, head, sector1, sector2; + + prodos_find_block_525(image, block, &track, &head, §or1, §or2); + + /* read first sector */ + ferr = floppy_read_sector(imgtool_floppy(image), head, track, + sector1, 0, ((UINT8 *) buffer) + 0, 256); + if (ferr) + return imgtool_floppy_error(ferr); + + /* read second sector */ + ferr = floppy_read_sector(imgtool_floppy(image), head, track, + sector2, 0, ((UINT8 *) buffer) + 256, 256); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_save_block_525(imgtool_image *image, + int block, const void *buffer) +{ + floperr_t ferr; + UINT32 track, head, sector1, sector2; + + prodos_find_block_525(image, block, &track, &head, §or1, §or2); + + /* read first sector */ + ferr = floppy_write_sector(imgtool_floppy(image), head, track, + sector1, 0, ((const UINT8 *) buffer) + 0, 256, 0); /* TODO: pass ddam argument from imgtool */ + if (ferr) + return imgtool_floppy_error(ferr); + + /* read second sector */ + ferr = floppy_write_sector(imgtool_floppy(image), head, track, + sector2, 0, ((const UINT8 *) buffer) + 256, 256, 0); /* TODO: pass ddam argument from imgtool */ + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static void prodos_setprocs_525(imgtool_image *image) +{ + prodos_diskinfo *info; + info = get_prodos_info(image); + info->load_block = prodos_load_block_525; + info->save_block = prodos_save_block_525; +} + + + +/* ----------------------------------------------------------------------- */ + +static imgtoolerr_t prodos_find_block_35(imgtool_image *image, int block, + UINT32 *track, UINT32 *head, UINT32 *sector) +{ + int sides = 2; + + *track = 0; + while(block >= (apple35_sectors_per_track(imgtool_floppy(image), *track) * sides)) + { + block -= (apple35_sectors_per_track(imgtool_floppy(image), (*track)++) * sides); + if (*track >= 80) + return IMGTOOLERR_SEEKERROR; + } + + *head = block / apple35_sectors_per_track(imgtool_floppy(image), *track); + *sector = block % apple35_sectors_per_track(imgtool_floppy(image), *track); + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_load_block_35(imgtool_image *image, + int block, void *buffer) +{ + imgtoolerr_t err; + floperr_t ferr; + UINT32 track, head, sector; + + err = prodos_find_block_35(image, block, &track, &head, §or); + if (err) + return err; + + ferr = floppy_read_sector(imgtool_floppy(image), head, track, sector, 0, buffer, 512); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_save_block_35(imgtool_image *image, + int block, const void *buffer) +{ + imgtoolerr_t err; + floperr_t ferr; + UINT32 track, head, sector; + + err = prodos_find_block_35(image, block, &track, &head, §or); + if (err) + return err; + + ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, 512, 0); /* TODO: pass ddam argument from imgtool */ + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static void prodos_setprocs_35(imgtool_image *image) +{ + prodos_diskinfo *info; + info = get_prodos_info(image); + info->load_block = prodos_load_block_35; + info->save_block = prodos_save_block_35; +} + + + +/* ----------------------------------------------------------------------- */ + +static imgtoolerr_t prodos_load_block(imgtool_image *image, + int block, void *buffer) +{ + prodos_diskinfo *diskinfo; + diskinfo = get_prodos_info(image); + return diskinfo->load_block(image, block, buffer); +} + + + +static imgtoolerr_t prodos_save_block(imgtool_image *image, + int block, const void *buffer) +{ + prodos_diskinfo *diskinfo; + diskinfo = get_prodos_info(image); + return diskinfo->save_block(image, block, buffer); +} + + + +static imgtoolerr_t prodos_clear_block(imgtool_image *image, int block) +{ + UINT8 buffer[BLOCK_SIZE]; + memset(buffer, 0, sizeof(buffer)); + return prodos_save_block(image, block, buffer); +} + + + +/* ----------------------------------------------------------------------- */ + +static imgtoolerr_t prodos_diskimage_open(imgtool_image *image) +{ + imgtoolerr_t err; + UINT8 buffer[BLOCK_SIZE]; + prodos_diskinfo *di; + const UINT8 *ent; + + di = get_prodos_info(image); + + /* specify defaults */ + di->dirent_size = 39; + di->dirents_per_block = 13; + + /* load the first block, hoping that the volume header is first */ + err = prodos_load_block(image, ROOTDIR_BLOCK, buffer); + if (err) + return err; + + ent = &buffer[4]; + + /* did we find the volume header? */ + if ((ent[0] & 0xF0) == 0xF0) + { + di->dirent_size = pick_integer_le(ent, 31, 1); + di->dirents_per_block = pick_integer_le(ent, 32, 1); + di->volume_bitmap_block = pick_integer_le(ent, 35, 2); + di->total_blocks = pick_integer_le(ent, 37, 2); + } + + /* sanity check these values */ + if (di->dirent_size < 39) + return IMGTOOLERR_CORRUPTIMAGE; + if (di->dirents_per_block * di->dirent_size >= BLOCK_SIZE) + return IMGTOOLERR_CORRUPTIMAGE; + if (di->volume_bitmap_block >= di->total_blocks) + return IMGTOOLERR_CORRUPTIMAGE; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_open_525(imgtool_image *image, imgtool_stream *stream) +{ + prodos_setprocs_525(image); + return prodos_diskimage_open(image); +} + + + +static imgtoolerr_t prodos_diskimage_open_35(imgtool_image *image, imgtool_stream *stream) +{ + prodos_setprocs_35(image); + return prodos_diskimage_open(image); +} + + + +/* ----------------------------------------------------------------------- */ + +static imgtoolerr_t prodos_load_volume_bitmap(imgtool_image *image, UINT8 **bitmap) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + UINT8 *alloc_bitmap; + UINT32 bitmap_blocks, i; + + di = get_prodos_info(image); + + bitmap_blocks = (di->total_blocks + (BLOCK_SIZE * 8) - 1) / (BLOCK_SIZE * 8); + alloc_bitmap = (UINT8*)malloc(bitmap_blocks * BLOCK_SIZE); + if (!alloc_bitmap) + { + err = IMGTOOLERR_OUTOFMEMORY; + goto done; + } + + for (i = 0; i < bitmap_blocks; i++) + { + err = prodos_load_block(image, di->volume_bitmap_block + i, + &alloc_bitmap[i * BLOCK_SIZE]); + if (err) + goto done; + } + + err = IMGTOOLERR_SUCCESS; + +done: + if (err && alloc_bitmap) + { + free(alloc_bitmap); + alloc_bitmap = NULL; + } + *bitmap = alloc_bitmap; + return err; +} + + + +static imgtoolerr_t prodos_save_volume_bitmap(imgtool_image *image, const UINT8 *bitmap) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + UINT32 bitmap_blocks, i; + + di = get_prodos_info(image); + + bitmap_blocks = (di->total_blocks + (BLOCK_SIZE * 8) - 1) / (BLOCK_SIZE * 8); + + for (i = 0; i < bitmap_blocks; i++) + { + err = prodos_save_block(image, di->volume_bitmap_block + i, + &bitmap[i * BLOCK_SIZE]); + if (err) + return err; + } + return IMGTOOLERR_SUCCESS; +} + + + +static void prodos_set_volume_bitmap_bit(UINT8 *buffer, UINT16 block, int value) +{ + UINT8 mask; + buffer += block / 8; + mask = 1 << (7 - (block % 8)); + if (value) + *buffer |= mask; + else + *buffer &= ~mask; +} + + + +static int prodos_get_volume_bitmap_bit(const UINT8 *buffer, UINT16 block) +{ + UINT8 mask; + buffer += block / 8; + mask = 1 << (7 - (block % 8)); + return (*buffer & mask) ? 1 : 0; +} + + + +static imgtoolerr_t prodos_alloc_block(imgtool_image *image, UINT8 *bitmap, + UINT16 *block) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + prodos_diskinfo *di; + UINT16 bitmap_blocks, i; + UINT8 *alloc_bitmap = NULL; + + di = get_prodos_info(image); + *block = 0; + bitmap_blocks = (di->total_blocks + (BLOCK_SIZE * 8) - 1) / (BLOCK_SIZE * 8); + + if (!bitmap) + { + err = prodos_load_volume_bitmap(image, &alloc_bitmap); + if (err) + goto done; + bitmap = alloc_bitmap; + } + + for (i = (di->volume_bitmap_block + bitmap_blocks); i < di->total_blocks; i++) + { + if (!prodos_get_volume_bitmap_bit(bitmap, i)) + { + prodos_set_volume_bitmap_bit(bitmap, i, 1); + *block = i; + break; + } + } + + if (*block > 0) + { + if (alloc_bitmap) + { + err = prodos_save_volume_bitmap(image, bitmap); + if (err) + goto done; + } + } + else + { + err = IMGTOOLERR_NOSPACE; + } + +done: + if (err) + *block = 0; + if (alloc_bitmap) + free(alloc_bitmap); + return err; +} + + + +/* ----------------------------------------------------------------------- */ + +static imgtoolerr_t prodos_diskimage_create(imgtool_image *image, option_resolution *opts) +{ + imgtoolerr_t err; + UINT32 heads, tracks, sectors, sector_bytes; + UINT32 dirent_size, volume_bitmap_block, i; + UINT32 volume_bitmap_block_count, total_blocks; + UINT8 buffer[BLOCK_SIZE]; + + heads = option_resolution_lookup_int(opts, 'H'); + tracks = option_resolution_lookup_int(opts, 'T'); + sectors = option_resolution_lookup_int(opts, 'S'); + sector_bytes = option_resolution_lookup_int(opts, 'L'); + + dirent_size = 39; + volume_bitmap_block = 6; + total_blocks = tracks * heads * sectors * sector_bytes / BLOCK_SIZE; + volume_bitmap_block_count = (total_blocks + (BLOCK_SIZE * 8) - 1) / (BLOCK_SIZE * 8); + + /* prepare initial dir block */ + memset(buffer, 0, sizeof(buffer)); + place_integer_le(buffer, 4 + 0, 1, 0xF0); + place_integer_le(buffer, 4 + 31, 1, dirent_size); + place_integer_le(buffer, 4 + 32, 1, BLOCK_SIZE / dirent_size); + place_integer_le(buffer, 4 + 35, 2, volume_bitmap_block); + place_integer_le(buffer, 4 + 37, 2, total_blocks); + + err = prodos_save_block(image, ROOTDIR_BLOCK, buffer); + if (err) + return err; + + /* setup volume bitmap */ + memset(buffer, 0, sizeof(buffer)); + for (i = 0; i < (volume_bitmap_block + volume_bitmap_block_count); i++) + prodos_set_volume_bitmap_bit(buffer, i, 1); + prodos_save_block(image, volume_bitmap_block, buffer); + + /* and finally open the image */ + return prodos_diskimage_open(image); +} + + + +static imgtoolerr_t prodos_diskimage_create_525(imgtool_image *image, imgtool_stream *stream, option_resolution *opts) +{ + prodos_setprocs_525(image); + return prodos_diskimage_create(image, opts); +} + + + +static imgtoolerr_t prodos_diskimage_create_35(imgtool_image *image, imgtool_stream *stream, option_resolution *opts) +{ + prodos_setprocs_35(image); + return prodos_diskimage_create(image, opts); +} + + + +/* ----------------------------------------------------------------------- */ + +static imgtoolerr_t prodos_enum_seek(imgtool_image *image, + prodos_direnum *appleenum, UINT32 block, UINT32 index) +{ + imgtoolerr_t err; + UINT8 buffer[BLOCK_SIZE]; + + if (appleenum->block != block) + { + if (block != 0) + { + err = prodos_load_block(image, block, buffer); + if (err) + return err; + memcpy(appleenum->block_data, buffer, sizeof(buffer)); + } + appleenum->block = block; + } + + appleenum->index = index; + return IMGTOOLERR_SUCCESS; +} + + + +static UINT8 *next_info_block(UINT8 *buffer, size_t *position) +{ + size_t side = *position & 0x100; + size_t subpos = *position & 0x0FF; + UINT8 *result; + + if (subpos < 8) + { + subpos = 8; + *position = side + subpos; + } + + while((buffer[side + subpos] == 0x00) || (subpos + buffer[side + subpos] > 0x100)) + { + if (side) + return NULL; + + side = 0x100; + subpos = 8; + } + + result = &buffer[side + subpos]; + subpos += *result; + *position = side + subpos; + return result; +} + + + +static UINT8 *alloc_info_block(UINT8 *buffer, size_t block_size, UINT8 block_type) +{ + size_t position = 0; + size_t side; + size_t subpos; + UINT8 *result; + + while(next_info_block(buffer, &position)) + ; + + side = position & 0x100; + subpos = position & 0x0FF; + + if ((subpos + block_size) > 0x100) + return NULL; + + result = &buffer[side + subpos]; + *(result++) = (UINT8) block_size; + *(result++) = block_type; + memset(result, 0, block_size - 2); + return result; +} + + + +static imgtoolerr_t prodos_get_next_dirent(imgtool_image *image, + prodos_direnum *appleenum, prodos_dirent *ent) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + size_t finfo_offset; + UINT32 next_block, next_index; + UINT32 offset; + UINT8 buffer[BLOCK_SIZE]; + const UINT8 *info_ptr; + int fork_num; + + di = get_prodos_info(image); + memset(ent, 0, sizeof(*ent)); + + /* have we hit the end of the file? */ + if (appleenum->block == 0) + return IMGTOOLERR_SUCCESS; + + /* populate the resulting dirent */ + offset = appleenum->index * di->dirent_size + 4; + ent->storage_type = appleenum->block_data[offset + 0]; + memcpy(ent->filename, &appleenum->block_data[offset + 1], 15); + ent->filename[15] = '\0'; + ent->creation_time = pick_integer_le(appleenum->block_data, offset + 24, 4); + ent->lastmodified_time = pick_integer_le(appleenum->block_data, offset + 33, 4); + ent->file_type = 0x3F3F3F3F; + ent->file_creator = 0x3F3F3F3F; + ent->finder_flags = 0; + ent->coord_x = 0; + ent->coord_y = 0; + ent->finder_folder = 0; + ent->icon_id = 0; + ent->script_code = 0; + ent->extended_flags = 0; + ent->comment_id = 0; + ent->putaway_directory = 0; + + if (is_extendedfile_storagetype(ent->storage_type)) + { + /* this is a ProDOS extended file; we need to get the extended info + * block */ + ent->extkey_pointer = pick_integer_le(appleenum->block_data, offset + 17, 2); + + err = prodos_load_block(image, ent->extkey_pointer, buffer); + if (err) + return err; + + for (fork_num = 0; fork_num <= 1; fork_num++) + { + ent->key_pointer[fork_num] = pick_integer_le(buffer, 1 + (fork_num * 256), 2); + ent->filesize[fork_num] = pick_integer_le(buffer, 5 + (fork_num * 256), 3); + ent->depth[fork_num] = buffer[fork_num * 256] & 0x0F; + } + + finfo_offset = 0; + while((info_ptr = next_info_block(buffer, &finfo_offset)) != NULL) + { + if (*(info_ptr++) == 18) + { + switch(*(info_ptr++)) + { + case 1: /* FInfo */ + ent->file_type = pick_integer_be(info_ptr, 0, 4); + ent->file_creator = pick_integer_be(info_ptr, 4, 4); + ent->finder_flags = pick_integer_be(info_ptr, 8, 2); + ent->coord_x = pick_integer_be(info_ptr, 10, 2); + ent->coord_y = pick_integer_be(info_ptr, 12, 2); + ent->finder_folder = pick_integer_be(info_ptr, 14, 4); + break; + + case 2: /* xFInfo */ + ent->icon_id = pick_integer_be(info_ptr, 0, 2); + ent->script_code = pick_integer_be(info_ptr, 8, 1); + ent->extended_flags = pick_integer_be(info_ptr, 9, 1); + ent->comment_id = pick_integer_be(info_ptr, 10, 2); + ent->putaway_directory = pick_integer_be(info_ptr, 12, 4); + break; + } + } + } + } + else + { + /* normal ProDOS files have all of the info right here */ + ent->key_pointer[0] = pick_integer_le(appleenum->block_data, offset + 17, 2); + ent->filesize[0] = pick_integer_le(appleenum->block_data, offset + 21, 3); + ent->depth[0] = ent->storage_type >> 4; + } + + /* identify next entry */ + next_block = appleenum->block; + next_index = appleenum->index + 1; + if (next_index >= di->dirents_per_block) + { + next_block = pick_integer_le(appleenum->block_data, 2, 2); + next_index = 0; + } + + /* seek next block */ + err = prodos_enum_seek(image, appleenum, next_block, next_index); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +/* changes a normal file to a ProDOS extended file */ +static imgtoolerr_t prodos_promote_file(imgtool_image *image, UINT8 *bitmap, prodos_dirent *ent) +{ + imgtoolerr_t err; + UINT16 new_block; + UINT8 buffer[BLOCK_SIZE]; + + assert(is_normalfile_storagetype(ent->storage_type)); + + err = prodos_alloc_block(image, bitmap, &new_block); + if (err) + return err; + + /* create raw extended info block */ + memset(buffer, 0, sizeof(buffer)); + err = prodos_save_block(image, new_block, buffer); + if (err) + return err; + + ent->storage_type = (ent->storage_type & 0x0F) | 0x50; + ent->extkey_pointer = new_block; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_put_dirent(imgtool_image *image, + prodos_direnum *appleenum, prodos_dirent *ent) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + UINT32 offset; + size_t finfo_offset; + UINT8 buffer[BLOCK_SIZE]; + int fork_num; + int needs_finfo = FALSE; + int needs_xfinfo = FALSE; + UINT8 *info_ptr; + UINT8 *finfo; + UINT8 *xfinfo; + + di = get_prodos_info(image); + offset = appleenum->index * di->dirent_size + 4; + + /* determine whether we need FInfo and/or xFInfo */ + if (is_normalfile_storagetype(ent->storage_type)) + { + needs_finfo = (ent->file_type != 0x3F3F3F3F) || + (ent->file_creator != 0x3F3F3F3F) || + (ent->finder_flags != 0) || + (ent->coord_x != 0) || + (ent->coord_y != 0) || + (ent->finder_folder != 0); + + needs_xfinfo = (ent->icon_id != 0) || + (ent->script_code != 0) || + (ent->extended_flags != 0) || + (ent->comment_id != 0) || + (ent->putaway_directory != 0); + } + + /* do we need to promote this file to an extended file? */ + if (!is_extendedfile_storagetype(ent->storage_type) + && (needs_finfo || needs_xfinfo)) + { + err = prodos_promote_file(image, NULL, ent); + if (err) + return err; + } + + /* write out the storage type, filename, creation and lastmodified times */ + appleenum->block_data[offset + 0] = ent->storage_type; + memcpy(&appleenum->block_data[offset + 1], ent->filename, 15); + place_integer_le(appleenum->block_data, offset + 24, 4, ent->creation_time); + place_integer_le(appleenum->block_data, offset + 33, 4, ent->lastmodified_time); + + if (is_extendedfile_storagetype(ent->storage_type)) + { + /* ProDOS extended file */ + err = prodos_load_block(image, ent->extkey_pointer, buffer); + if (err) + return err; + + finfo = NULL; + xfinfo = NULL; + + for (fork_num = 0; fork_num <= 1; fork_num++) + { + place_integer_le(buffer, 1 + (fork_num * 256), 2, ent->key_pointer[fork_num]); + place_integer_le(buffer, 5 + (fork_num * 256), 3, ent->filesize[fork_num]); + buffer[fork_num * 256] = ent->depth[fork_num]; + } + + finfo_offset = 0; + while((info_ptr = next_info_block(buffer, &finfo_offset)) != NULL) + { + if (*(info_ptr++) == 18) + { + switch(*(info_ptr++)) + { + case 1: /* FInfo */ + finfo = info_ptr; + break; + + case 2: /* xFInfo */ + xfinfo = info_ptr; + break; + } + } + } + + /* allocate the finfo and/or xinfo blocks, if we need them */ + if (needs_finfo && !finfo) + finfo = alloc_info_block(buffer, 18, 1); + if (needs_xfinfo && !xfinfo) + xfinfo = alloc_info_block(buffer, 18, 2); + + if (finfo) + { + place_integer_be(finfo, 0, 4, ent->file_type); + place_integer_be(finfo, 4, 4, ent->file_creator); + place_integer_be(finfo, 8, 2, ent->finder_flags); + place_integer_be(finfo, 10, 2, ent->coord_x); + place_integer_be(finfo, 12, 2, ent->coord_y); + place_integer_be(finfo, 14, 4, ent->finder_folder); + } + + if (xfinfo) + { + place_integer_be(xfinfo, 0, 2, ent->icon_id); + place_integer_be(xfinfo, 8, 1, ent->script_code); + place_integer_be(xfinfo, 9, 1, ent->extended_flags); + place_integer_be(xfinfo, 10, 2, ent->comment_id); + place_integer_be(xfinfo, 12, 4, ent->putaway_directory); + } + + err = prodos_save_block(image, ent->extkey_pointer, buffer); + if (err) + return err; + + place_integer_le(appleenum->block_data, offset + 17, 2, ent->extkey_pointer); + place_integer_le(appleenum->block_data, offset + 21, 3, BLOCK_SIZE); + } + else + { + /* normal file */ + place_integer_le(appleenum->block_data, offset + 17, 2, ent->key_pointer[0]); + place_integer_le(appleenum->block_data, offset + 21, 3, ent->filesize[0]); + } + + err = prodos_save_block(image, appleenum->block, appleenum->block_data); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_lookup_path(imgtool_image *image, const char *path, + creation_policy_t create, prodos_direnum *direnum, prodos_dirent *ent) +{ + imgtoolerr_t err; + prodos_direnum my_direnum; + UINT32 block = ROOTDIR_BLOCK; + const char *old_path; + UINT16 this_block; + UINT32 this_index; + UINT16 free_block = 0; + UINT32 free_index = 0; + UINT16 new_file_block; + UINT8 buffer[BLOCK_SIZE]; + + if (!direnum) + direnum = &my_direnum; + + while(*path) + { + memset(direnum, 0, sizeof(*direnum)); + err = prodos_enum_seek(image, direnum, block, 0); + if (err) + goto done; + + do + { + this_block = direnum->block; + this_index = direnum->index; + + err = prodos_get_next_dirent(image, direnum, ent); + if (err) + goto done; + + /* if we need to create a file entry and this is free, track it */ + if (create && this_block && !free_block && !ent->storage_type) + { + free_block = this_block; + free_index = this_index; + } + } + while(direnum->block && (strcmp(path, ent->filename) || ( + !is_file_storagetype(ent->storage_type) && + !is_dir_storagetype(ent->storage_type)))); + + old_path = path; + path += strlen(path) + 1; + if (*path) + { + /* we have found part of the path; we are not finished yet */ + if (!is_dir_storagetype(ent->storage_type)) + { + err = IMGTOOLERR_FILENOTFOUND; + goto done; + } + block = ent->key_pointer[0]; + } + else if (!direnum->block) + { + /* did not find file; maybe we need to create it */ + if (create == CREATE_NONE) + { + err = IMGTOOLERR_FILENOTFOUND; + goto done; + } + + /* do we need to expand the directory? */ + if (!free_block) + { + if (this_block == 0) + { + err = IMGTOOLERR_CORRUPTFILE; + goto done; + } + + err = prodos_load_block(image, this_block, buffer); + if (err) + goto done; + + /* allocate a block */ + err = prodos_alloc_block(image, NULL, &free_block); + if (err) + goto done; + + /* clear out this new block */ + err = prodos_clear_block(image, free_block); + if (err) + goto done; + + /* save this link */ + place_integer_le(buffer, 2, 2, free_block); + err = prodos_save_block(image, this_block, buffer); + if (err) + goto done; + + free_index = 0; + } + + /* seek back to the free space */ + err = prodos_enum_seek(image, direnum, free_block, free_index); + if (err) + goto done; + + new_file_block = 0; + if (create == CREATE_DIR) + { + /* if we are creating a directory, we need to create a new block */ + err = prodos_alloc_block(image, NULL, &new_file_block); + if (err) + goto done; + + err = prodos_clear_block(image, new_file_block); + if (err) + goto done; + } + + /* prepare the dirent */ + memset(ent, 0, sizeof(*ent)); + ent->storage_type = (create == CREATE_DIR) ? 0xe0 : 0x10; + ent->creation_time = ent->lastmodified_time = prodos_time_now(); + ent->key_pointer[0] = new_file_block; + ent->file_type = 0x3F3F3F3F; + ent->file_creator = 0x3F3F3F3F; + strncpy(ent->filename, old_path, ARRAY_LENGTH(ent->filename)); + + /* and place it */ + err = prodos_put_dirent(image, direnum, ent); + if (err) + goto done; + + this_block = free_block; + this_index = free_index; + } + else + { + /* we've found the file; seek that dirent */ + err = prodos_enum_seek(image, direnum, this_block, this_index); + if (err) + goto done; + } + } + + err = IMGTOOLERR_SUCCESS; +done: + return err; +} + + + +static imgtoolerr_t prodos_fill_file(imgtool_image *image, UINT8 *bitmap, + UINT16 key_block, int key_block_allocated, + int depth, UINT32 blockcount, UINT32 block_index) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + int dirty; + int sub_block_allocated; + UINT16 i, sub_block, new_sub_block; + UINT8 buffer[BLOCK_SIZE]; + + di = get_prodos_info(image); + + if (key_block_allocated) + { + /* we are on a recently allocated key block; start fresh */ + memset(buffer, 0, sizeof(buffer)); + dirty = TRUE; + } + else + { + /* this is a preexisting key block */ + err = prodos_load_block(image, key_block, buffer); + if (err) + return err; + dirty = FALSE; + } + + for (i = 0; i < 256; i++) + { + sub_block_allocated = FALSE; + + sub_block = buffer[i + 256]; + sub_block <<= 8; + sub_block += buffer[i + 0]; + + new_sub_block = sub_block; + if ((block_index < blockcount) && (sub_block == 0)) + { + err = prodos_alloc_block(image, bitmap, &new_sub_block); + if (err) + return err; + sub_block_allocated = TRUE; + } + else if ((block_index >= blockcount) && (sub_block != 0)) + { + new_sub_block = 0; + if (sub_block < di->total_blocks) + prodos_set_volume_bitmap_bit(bitmap, sub_block, 0); + } + + /* did we change the block? */ + if (new_sub_block != sub_block) + { + dirty = TRUE; + buffer[i + 0] = new_sub_block >> 0; + buffer[i + 256] = new_sub_block >> 8; + if (sub_block == 0) + sub_block = new_sub_block; + } + + /* call recursive function */ + if (depth > 2) + { + err = prodos_fill_file(image, bitmap, sub_block, sub_block_allocated, depth - 1, blockcount, block_index); + if (err) + return err; + } + + /* increment index */ + block_index += 1 << ((depth - 2) * 8); + } + + /* if we changed anything, then save the block */ + if (dirty) + { + err = prodos_save_block(image, key_block, buffer); + if (err) + return err; + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_set_file_block_count(imgtool_image *image, prodos_direnum *direnum, + prodos_dirent *ent, UINT8 *bitmap, int fork_num, UINT32 new_blockcount) +{ + imgtoolerr_t err; + int depth, new_depth, i; + UINT16 new_block, block; + UINT8 buffer[BLOCK_SIZE]; + UINT16 key_pointer; + + if (fork_num && (new_blockcount > 0) && !is_extendedfile_storagetype(ent->storage_type)) + { + /* need to change a normal file to an extended file */ + err = prodos_promote_file(image, bitmap, ent); + if (err) + return err; + } + + key_pointer = ent->key_pointer[fork_num]; + depth = ent->depth[fork_num]; + + /* determine the new tree depth */ + if (new_blockcount <= 1) + new_depth = 1; + else if (new_blockcount <= 256) + new_depth = 2; + else + new_depth = 3; + + /* are we zero length, and do we have to create a block? */ + if ((new_blockcount >= 1) && (key_pointer == 0)) + { + err = prodos_alloc_block(image, bitmap, &new_block); + if (err) + return err; + key_pointer = new_block; + } + + /* do we have to grow the tree? */ + while(new_depth > depth) + { + err = prodos_alloc_block(image, bitmap, &new_block); + if (err) + return err; + + /* create this new key block, with a link to the previous one */ + memset(buffer, 0, sizeof(buffer)); + buffer[0] = (UINT8) (key_pointer >> 0); + buffer[256] = (UINT8) (key_pointer >> 8); + err = prodos_save_block(image, new_block, buffer); + if (err) + return err; + + depth++; + key_pointer = new_block; + } + + /* do we have to shrink the tree? */ + while(new_depth < depth) + { + err = prodos_load_block(image, key_pointer, buffer); + if (err) + return err; + + for (i = 1; i < 256; i++) + { + block = buffer[i + 256]; + block <<= 8; + block |= buffer[i + 0]; + + if (block > 0) + { + if (depth > 2) + { + /* remove this block's children */ + err = prodos_fill_file(image, bitmap, block, FALSE, depth - 1, 0, 0); + if (err) + return err; + } + + /* and remove this block */ + prodos_set_volume_bitmap_bit(bitmap, block, 0); + } + } + + /* remove this key block */ + prodos_set_volume_bitmap_bit(bitmap, key_pointer, 0); + + /* set the new key pointer */ + block = buffer[256]; + block <<= 8; + block |= buffer[0]; + key_pointer = block; + + depth--; + } + + if (new_blockcount > 0) + { + /* fill out the file tree */ + err = prodos_fill_file(image, bitmap, key_pointer, FALSE, depth, new_blockcount, 0); + if (err) + return err; + } + else if (key_pointer != 0) + { + /* we are now zero length, and don't need a key pointer */ + prodos_set_volume_bitmap_bit(bitmap, key_pointer, 0); + key_pointer = 0; + } + + /* change the depth if we are not an extended file */ + if (is_normalfile_storagetype(ent->storage_type)) + { + ent->storage_type &= ~0xF0; + ent->storage_type |= depth * 0x10; + } + + ent->key_pointer[fork_num] = key_pointer; + ent->depth[fork_num] = depth; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_set_file_size(imgtool_image *image, prodos_direnum *direnum, + prodos_dirent *ent, int fork_num, UINT32 new_size) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + UINT32 blockcount, new_blockcount; + UINT8 *bitmap = NULL; + + if (ent->filesize[fork_num] != new_size) + { + blockcount = (ent->filesize[fork_num] + BLOCK_SIZE - 1) / BLOCK_SIZE; + new_blockcount = (new_size + BLOCK_SIZE - 1) / BLOCK_SIZE; + + /* do we need to change the block chain? */ + if (new_blockcount != blockcount) + { + err = prodos_load_volume_bitmap(image, &bitmap); + if (err) + goto done; + + err = prodos_set_file_block_count(image, direnum, ent, bitmap, fork_num, new_blockcount); + if (err) + goto done; + + err = prodos_save_volume_bitmap(image, bitmap); + if (err) + goto done; + } + + ent->filesize[fork_num] = new_size; + err = prodos_put_dirent(image, direnum, ent); + if (err) + goto done; + } + +done: + if (bitmap) + free(bitmap); + return err; +} + + + +static UINT32 prodos_get_storagetype_maxfilesize(UINT8 storage_type) +{ + UINT32 max_filesize = 0; + switch(storage_type & 0xF0) + { + case 0x10: + max_filesize = BLOCK_SIZE * 1; + break; + case 0x20: + max_filesize = BLOCK_SIZE * 256; + break; + case 0x30: + case 0x50: + max_filesize = BLOCK_SIZE * 32768; + break; + } + return max_filesize; +} + + + +static imgtoolerr_t prodos_diskimage_beginenum(imgtool_directory *enumeration, const char *path) +{ + imgtoolerr_t err; + imgtool_image *image; + prodos_direnum *appleenum; + prodos_dirent ent; + UINT16 block = ROOTDIR_BLOCK; + + image = imgtool_directory_image(enumeration); + appleenum = (prodos_direnum *) imgtool_directory_extrabytes(enumeration); + + /* find subdirectory, if appropriate */ + if (*path) + { + err = prodos_lookup_path(image, path, CREATE_NONE, NULL, &ent); + if (err) + return err; + + /* only work on directories */ + if (!is_dir_storagetype(ent.storage_type)) + return IMGTOOLERR_FILENOTFOUND; + + block = ent.key_pointer[0]; + } + + /* seek initial block */ + err = prodos_enum_seek(image, appleenum, block, 0); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + imgtoolerr_t err; + imgtool_image *image; + prodos_direnum *appleenum; + prodos_dirent pd_ent; + UINT32 max_filesize; + + image = imgtool_directory_image(enumeration); + appleenum = (prodos_direnum *) imgtool_directory_extrabytes(enumeration); + + do + { + err = prodos_get_next_dirent(image, appleenum, &pd_ent); + if (err) + return err; + } + while(appleenum->block + && !is_file_storagetype(pd_ent.storage_type) + && !is_dir_storagetype(pd_ent.storage_type)); + + /* end of file? */ + if (pd_ent.storage_type == 0x00) + { + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + + strcpy(ent->filename, pd_ent.filename); + ent->directory = is_dir_storagetype(pd_ent.storage_type); + ent->creation_time = prodos_crack_time(pd_ent.creation_time); + ent->lastmodified_time = prodos_crack_time(pd_ent.lastmodified_time); + + if (!ent->directory) + { + ent->filesize = pd_ent.filesize[0]; + + max_filesize = prodos_get_storagetype_maxfilesize(pd_ent.storage_type); + if (ent->filesize > max_filesize) + { + ent->corrupt = 1; + ent->filesize = max_filesize; + } + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_read_file_tree(imgtool_image *image, UINT32 *filesize, + UINT32 block, int nest_level, imgtool_stream *destf) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + UINT8 buffer[BLOCK_SIZE]; + UINT16 sub_block; + size_t bytes_to_write; + int i; + + /* check bounds */ + di = get_prodos_info(image); + if (block >= di->total_blocks) + return IMGTOOLERR_CORRUPTFILE; + + err = prodos_load_block(image, block, buffer); + if (err) + return err; + + if (nest_level > 0) + { + /* this is an index block */ + for (i = 0; i < 256; i++) + { + /* retrieve the block pointer; the two bytes are on either half + * of the block */ + sub_block = buffer[i + 256]; + sub_block <<= 8; + sub_block |= buffer[i + 0]; + + if (sub_block != 0) + { + err = prodos_read_file_tree(image, filesize, sub_block, nest_level - 1, destf); + if (err) + return err; + } + } + } + else + { + /* this is a leaf block */ + bytes_to_write = MIN(*filesize, sizeof(buffer)); + stream_write(destf, buffer, bytes_to_write); + *filesize -= bytes_to_write; + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_write_file_tree(imgtool_image *image, UINT32 *filesize, + UINT32 block, int nest_level, imgtool_stream *sourcef) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + UINT8 buffer[BLOCK_SIZE]; + UINT16 sub_block; + size_t bytes_to_read; + int i; + + /* nothing more to read? bail */ + if (*filesize == 0) + return IMGTOOLERR_SUCCESS; + + /* check bounds */ + di = get_prodos_info(image); + if (block >= di->total_blocks) + return IMGTOOLERR_CORRUPTFILE; + + err = prodos_load_block(image, block, buffer); + if (err) + return err; + + if (nest_level > 0) + { + for (i = 0; i < 256; i++) + { + sub_block = buffer[i + 256]; + sub_block <<= 8; + sub_block |= buffer[i + 0]; + + if (sub_block != 0) + { + err = prodos_write_file_tree(image, filesize, sub_block, nest_level - 1, sourcef); + if (err) + return err; + } + } + } + else + { + /* this is a leaf block */ + bytes_to_read = MIN(*filesize, sizeof(buffer)); + stream_read(sourcef, buffer, bytes_to_read); + *filesize -= bytes_to_read; + + err = prodos_save_block(image, block, buffer); + if (err) + return err; + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_diskinfo *di; + UINT8 *bitmap = NULL; + UINT16 i; + + di = get_prodos_info(image); + *size = 0; + + err = prodos_load_volume_bitmap(image, &bitmap); + if (err) + goto done; + + for (i = 0; i < di->total_blocks; i++) + { + if (!prodos_get_volume_bitmap_bit(bitmap, i)) + *size += BLOCK_SIZE; + } + +done: + if (bitmap) + free(bitmap); + return err; +} + + + +static imgtoolerr_t prodos_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + UINT16 key_pointer; + int nest_level; + mac_fork_t fork_num; + + err = prodos_lookup_path(image, filename, CREATE_NONE, NULL, &ent); + if (err) + return err; + + if (is_dir_storagetype(ent.storage_type)) + return IMGTOOLERR_FILENOTFOUND; + + err = mac_identify_fork(fork, &fork_num); + if (err) + return err; + + key_pointer = ent.key_pointer[fork_num]; + nest_level = ent.depth[fork_num] - 1; + + if (key_pointer != 0) + { + err = prodos_read_file_tree(image, &ent.filesize[fork_num], key_pointer, + nest_level, destf); + if (err) + return err; + } + + /* have we not actually received the correct amount of bytes? if not, fill in the rest */ + if (ent.filesize[fork_num] > 0) + stream_fill(destf, 0, ent.filesize[fork_num]); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + prodos_direnum direnum; + UINT64 file_size; + mac_fork_t fork_num; + + file_size = stream_size(sourcef); + + err = prodos_lookup_path(image, filename, CREATE_FILE, &direnum, &ent); + if (err) + return err; + + /* only work on files */ + if (is_dir_storagetype(ent.storage_type)) + return IMGTOOLERR_FILENOTFOUND; + + err = mac_identify_fork(fork, &fork_num); + if (err) + return err; + + /* set the file size */ + err = prodos_set_file_size(image, &direnum, &ent, fork_num, file_size); + if (err) + return err; + + err = prodos_write_file_tree(image, &ent.filesize[fork_num], ent.key_pointer[fork_num], + ent.depth[fork_num] - 1, sourcef); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_deletefile(imgtool_partition *partition, const char *path) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + prodos_direnum direnum; + + err = prodos_lookup_path(image, path, CREATE_NONE, &direnum, &ent); + if (err) + return err; + + /* only work on files */ + if (is_dir_storagetype(ent.storage_type)) + return IMGTOOLERR_FILENOTFOUND; + + /* empty out both forks */ + err = prodos_set_file_size(image, &direnum, &ent, 0, 0); + if (err) + return err; + err = prodos_set_file_size(image, &direnum, &ent, 1, 0); + if (err) + return err; + + memset(&ent, 0, sizeof(ent)); + err = prodos_put_dirent(image, &direnum, &ent); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_listforks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + prodos_direnum direnum; + int fork_num = 0; + + err = prodos_lookup_path(image, path, CREATE_NONE, &direnum, &ent); + if (err) + return err; + + if (is_dir_storagetype(ent.storage_type)) + return IMGTOOLERR_FILENOTFOUND; + + /* specify data fork */ + ents[fork_num].type = FORK_DATA; + ents[fork_num].forkname[0] = '\0'; + ents[fork_num].size = ent.filesize[0]; + fork_num++; + + if (is_extendedfile_storagetype(ent.storage_type)) + { + /* specify the resource fork */ + ents[fork_num].type = FORK_RESOURCE; + strcpy(ents[fork_num].forkname, "RESOURCE_FORK"); + ents[fork_num].size = ent.filesize[1]; + fork_num++; + } + + ents[fork_num].type = FORK_END; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_createdir(imgtool_partition *partition, const char *path) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + prodos_direnum direnum; + + err = prodos_lookup_path(image, path, CREATE_DIR, &direnum, &ent); + if (err) + return err; + + /* only work on directories */ + if (!is_dir_storagetype(ent.storage_type)) + return IMGTOOLERR_FILENOTFOUND; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_free_directory(imgtool_image *image, UINT8 *volume_bitmap, UINT16 key_pointer) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + int i; + UINT16 next_block; + UINT32 offset; + UINT8 buffer[BLOCK_SIZE]; + + di = get_prodos_info(image); + + if (key_pointer != 0) + { + err = prodos_load_block(image, key_pointer, buffer); + if (err) + return err; + + for (i = 0; i < di->dirents_per_block; i++) + { + offset = i * di->dirent_size + 4; + + if (is_file_storagetype(buffer[offset]) || is_file_storagetype(buffer[offset])) + return IMGTOOLERR_DIRNOTEMPTY; + } + + next_block = pick_integer_le(buffer, 2, 2); + + err = prodos_free_directory(image, volume_bitmap, next_block); + if (err) + return err; + + prodos_set_volume_bitmap_bit(volume_bitmap, key_pointer, 0); + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_deletedir(imgtool_partition *partition, const char *path) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + prodos_direnum direnum; + UINT8 *volume_bitmap = NULL; + + err = prodos_lookup_path(image, path, CREATE_NONE, &direnum, &ent); + if (err) + goto done; + + /* only work on directories */ + if (!is_dir_storagetype(ent.storage_type)) + { + err = IMGTOOLERR_FILENOTFOUND; + goto done; + } + + err = prodos_load_volume_bitmap(image, &volume_bitmap); + if (err) + goto done; + + err = prodos_free_directory(image, volume_bitmap, ent.key_pointer[0]); + if (err) + goto done; + + err = prodos_save_volume_bitmap(image, volume_bitmap); + if (err) + goto done; + + memset(&ent, 0, sizeof(ent)); + err = prodos_put_dirent(image, &direnum, &ent); + if (err) + goto done; + +done: + if (volume_bitmap) + free(volume_bitmap); + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_get_file_tree(imgtool_image *image, imgtool_chainent *chain, size_t chain_size, + size_t *chain_pos, UINT16 block, UINT8 total_depth, UINT8 cur_depth) +{ + imgtoolerr_t err; + prodos_diskinfo *di; + int i; + UINT16 sub_block; + UINT8 buffer[BLOCK_SIZE]; + + if (block == 0) + return IMGTOOLERR_SUCCESS; + if (*chain_pos >= chain_size) + return IMGTOOLERR_SUCCESS; + + /* check bounds */ + di = get_prodos_info(image); + if (block >= di->total_blocks) + return IMGTOOLERR_CORRUPTFILE; + + chain[*chain_pos].level = cur_depth; + chain[*chain_pos].block = block; + (*chain_pos)++; + + /* must we recurse into the tree? */ + if (cur_depth < total_depth) + { + err = prodos_load_block(image, block, buffer); + if (err) + return err; + + for (i = 0; i < 256; i++) + { + sub_block = buffer[i + 256]; + sub_block <<= 8; + sub_block |= buffer[i + 0]; + + err = prodos_get_file_tree(image, chain, chain_size, chain_pos, sub_block, total_depth, cur_depth + 1); + if (err) + return err; + } + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + int i; + + err = prodos_lookup_path(image, path, CREATE_NONE, NULL, &ent); + if (err) + return err; + + for (i = 0; attrs[i]; i++) + { + switch(attrs[i]) + { + case IMGTOOLATTR_INT_MAC_TYPE: + values[i].i = ent.file_type; + break; + case IMGTOOLATTR_INT_MAC_CREATOR: + values[i].i = ent.file_creator; + break; + case IMGTOOLATTR_INT_MAC_FINDERFLAGS: + values[i].i = ent.finder_flags; + break; + case IMGTOOLATTR_INT_MAC_COORDX: + values[i].i = ent.coord_x; + break; + case IMGTOOLATTR_INT_MAC_COORDY: + values[i].i = ent.coord_y; + break; + case IMGTOOLATTR_INT_MAC_FINDERFOLDER: + values[i].i = ent.finder_folder; + break; + case IMGTOOLATTR_INT_MAC_ICONID: + values[i].i = ent.icon_id; + break; + case IMGTOOLATTR_INT_MAC_SCRIPTCODE: + values[i].i = ent.script_code; + break; + case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: + values[i].i = ent.extended_flags; + break; + case IMGTOOLATTR_INT_MAC_COMMENTID: + values[i].i = ent.comment_id; + break; + case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: + values[i].i = ent.putaway_directory; + break; + + case IMGTOOLATTR_TIME_CREATED: + values[i].t = prodos_crack_time(ent.creation_time); + break; + case IMGTOOLATTR_TIME_LASTMODIFIED: + values[i].t = prodos_crack_time(ent.lastmodified_time); + break; + } + } + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + prodos_direnum direnum; + int i; + + err = prodos_lookup_path(image, path, CREATE_NONE, &direnum, &ent); + if (err) + return err; + + for (i = 0; attrs[i]; i++) + { + switch(attrs[i]) + { + case IMGTOOLATTR_INT_MAC_TYPE: + ent.file_type = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_CREATOR: + ent.file_creator = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_FINDERFLAGS: + ent.finder_flags = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_COORDX: + ent.coord_x = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_COORDY: + ent.coord_y = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_FINDERFOLDER: + ent.finder_folder = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_ICONID: + ent.icon_id = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_SCRIPTCODE: + ent.script_code = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: + ent.extended_flags = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_COMMENTID: + ent.comment_id = values[i].i; + break; + case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: + ent.putaway_directory = values[i].i; + break; + + case IMGTOOLATTR_TIME_CREATED: + ent.creation_time = prodos_setup_time(values[i].t); + break; + case IMGTOOLATTR_TIME_LASTMODIFIED: + ent.lastmodified_time = prodos_setup_time(values[i].t); + break; + } + } + + err = prodos_put_dirent(image, &direnum, &ent); + if (err) + return err; + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_suggesttransfer(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + mac_filecategory_t file_category = MAC_FILECATEGORY_DATA; + + if (path) + { + err = prodos_lookup_path(image, path, CREATE_NONE, NULL, &ent); + if (err) + return err; + + file_category = is_extendedfile_storagetype(ent.storage_type) + ? MAC_FILECATEGORY_FORKED : MAC_FILECATEGORY_DATA; + } + + mac_suggest_transfer(file_category, suggestions, suggestions_length); + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t prodos_diskimage_getchain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + prodos_dirent ent; + size_t chain_pos = 0; + int fork_num; + + err = prodos_lookup_path(image, path, CREATE_NONE, NULL, &ent); + if (err) + return err; + + switch(ent.storage_type & 0xF0) + { + case 0x10: + case 0x20: + case 0x30: + /* normal ProDOS file */ + err = prodos_get_file_tree(image, chain, chain_size, &chain_pos, + ent.key_pointer[0], ent.depth[0] - 1, 0); + if (err) + return err; + break; + + case 0x50: + /* extended ProDOS file */ + chain[chain_pos].level = 0; + chain[chain_pos].block = ent.extkey_pointer; + chain_pos++; + + for (fork_num = 0; fork_num <= 1; fork_num++) + { + if (ent.key_pointer[fork_num]) + { + err = prodos_get_file_tree(image, chain, chain_size, &chain_pos, + ent.key_pointer[fork_num], ent.depth[fork_num] - 1, 1); + if (err) + return err; + } + } + break; + + case 0xE0: + /* directory */ + return IMGTOOLERR_UNIMPLEMENTED; + + default: + return IMGTOOLERR_UNEXPECTED; + } + + return IMGTOOLERR_SUCCESS; +} + + + +static void generic_prodos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break; + case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break; + case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: info->i = 1; break; + case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break; + case IMGTOOLINFO_INT_WRITING_UNTESTED: info->i = 1; break; + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(prodos_diskinfo); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(prodos_direnum); break; + case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "ProDOS format"); break; + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = prodos_diskimage_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = prodos_diskimage_nextenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = prodos_diskimage_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = prodos_diskimage_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = prodos_diskimage_writefile; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = prodos_diskimage_deletefile; break; + case IMGTOOLINFO_PTR_LIST_FORKS: info->list_forks = prodos_diskimage_listforks; break; + case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = prodos_diskimage_createdir; break; + case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = prodos_diskimage_deletedir; break; + case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = prodos_diskimage_getattrs; break; + case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = prodos_diskimage_setattrs; break; + case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = prodos_diskimage_suggesttransfer; break; + case IMGTOOLINFO_PTR_GET_CHAIN: info->get_chain = prodos_diskimage_getchain; break; + } +} + + + +void prodos_525_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "prodos_525"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = prodos_diskimage_create_525; break; + case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = prodos_diskimage_open_525; break; + case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple2; break; + + default: generic_prodos_get_info(imgclass, state, info); break; + } +} + + + +void prodos_35_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "prodos_35"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = prodos_diskimage_create_35; break; + case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = prodos_diskimage_open_35; break; + case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_iigs; break; + + default: generic_prodos_get_info(imgclass, state, info); break; + } +} diff --git a/src/mame/tools/imgtool/modules/psion.c b/src/mame/tools/imgtool/modules/psion.c new file mode 100644 index 00000000000..d343dde5c6a --- /dev/null +++ b/src/mame/tools/imgtool/modules/psion.c @@ -0,0 +1,683 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Psion Organiser II Datapack + + 08/18/2010 Sandro Ronco + + Known file types: + 0x00 invalid record + 0x01 - 0x7e deleted record + 0x7f invalid deleted record + 0x80 long record + 0x81 file name + 0x82 diary + 0x83 OPL/OB3 procedure + 0x84 RS232 setup + 0x85 - 0x8f reserved + 0x90 MAIN Record + 0x91 - 0xfe data records from files + 0xff invalid record + +****************************************************************************/ + +#include "imgtool.h" + +#define MAXFILES 256 + +struct psion_file +{ + char filename[9]; + UINT8 type; + UINT8 id; + + UINT16 name_rec; + UINT16 data_rec; +}; + +struct psion_pack +{ + imgtool_stream *stream; + + UINT16 eop; + struct psion_file pack_index[MAXFILES]; +}; + +struct psion_iter +{ + UINT16 index; +}; + +UINT16 head_checksum(UINT8* data) +{ + UINT16 checksum = 0; + + for (int i=0; i<6; i+=2) + checksum += (data[i]<<8 | data[i+1]); + + return checksum; +} + +UINT16 get_long_rec_size(imgtool_stream *stream) +{ + UINT8 size_h, size_l; + + stream_read(stream, &size_h, 1); + stream_read(stream, &size_l, 1); + + return (size_h<<8) | size_l; +} + +UINT32 update_pack_index(psion_pack *pack) +{ + UINT8 data, type; + UINT16 size; + UINT16 index = 0; + + memset(pack->pack_index, 0, sizeof(psion_file) * MAXFILES); + + // start at the first record + stream_seek(pack->stream, 0x10, SEEK_SET); + + do + { + stream_read(pack->stream, &data, 1); + + if(data == 0xff) + { + pack->eop = stream_tell(pack->stream) - 1; + return TRUE; + } + else if (data == 0x02) + { + // long record without name are ignored + stream_read(pack->stream, &data, 1); + size = get_long_rec_size(pack->stream); + stream_seek(pack->stream, size, SEEK_CUR); + } + else + { + stream_read(pack->stream, &type, 1); + + // deleted record are not listed + if (type < 0x90 && (type & 0x80)) + { + pack->pack_index[index].type = type; + stream_read(pack->stream, &pack->pack_index[index].filename, 8); + stream_read(pack->stream, &pack->pack_index[index].id, 1); + pack->pack_index[index].name_rec = stream_tell(pack->stream) - 11; + + //check for data record + stream_read(pack->stream, &data, 1); + if (data == 0x02) + pack->pack_index[index].data_rec = stream_tell(pack->stream) - 1; + + stream_seek(pack->stream, -1, SEEK_CUR); + + index++; + } + else + stream_seek(pack->stream, data, SEEK_CUR); + } + + } while (stream_size(pack->stream) > stream_tell(pack->stream)); + + // corrupted image + return FALSE; +} + +int seek_next_record(imgtool_stream *stream, UINT8 id) +{ + UINT8 data, rec_id; + UINT16 size; + + do + { + stream_read(stream, &data, 1); + + if(data == 0xff) + break; + + if (data == 2) + { + stream_read(stream, &rec_id, 1); + size = get_long_rec_size(stream); + + } + else + { + stream_read(stream, &rec_id, 1); + if (id == rec_id) + { + stream_seek(stream, -2, SEEK_CUR); + return TRUE; + } + size = data; + } + + // next record + stream_seek(stream, size, SEEK_CUR); + + } while (stream_size(stream) > stream_tell(stream)); + + return FALSE; +} + +// if there are multiple files with the same name, only the first is found +int seek_file_name(psion_pack *pack, const char *filename) +{ + UINT16 index = 0; + + while (pack->pack_index[index].name_rec) + { + if (!strncmp(filename, pack->pack_index[index].filename, strlen(filename))) + return index; + index++; + } + + // filename not found + return -1; +} + +UINT8 get_free_file_id(psion_pack *pack) +{ + for (UINT8 file_id=0x91; file_id<0xff; file_id++) + { + int index = 0; + + while (pack->pack_index[index].id != file_id) + if (pack->pack_index[index++].name_rec == 0) + return file_id; + } + + return 0xff; +} + +void put_name_record(imgtool_stream *stream, const char* filename, UINT8 record_type, UINT8 record_id) +{ + char data[0x10]; + int i = 0; + + data[i++] = 0x09; + data[i++] = record_type; + + // filename is 8 char long space filled + for (int j=0; j<8; j++) + if (j < strlen(filename)) + data[i++] = filename[j]; + else + data[i++] = 0x20; + + data[i++] = record_id; + + stream_write(stream, data, i); +} + +void update_opk_head(imgtool_stream *stream) +{ + UINT16 size = stream_size(stream) - 6; + + stream_seek(stream, 4, SEEK_SET); + stream_putc(stream, (size>>8) & 0xff); + stream_putc(stream, size & 0xff); +} + +char *stream_getline(imgtool_stream *source, UINT16 max_len) +{ + UINT16 pos = 0; + char data; + char *line = (char*)malloc(max_len); + memset(line, 0, max_len); + + while (pos < max_len && stream_size(source) > stream_tell(source)) + { + stream_read(source, &data, 1); + + switch(data) + { + case '\r': + stream_read(source, &data, 1); + if (data != '\n') + stream_seek(source, -1, SEEK_CUR); + case '\n': + return line; + default: + line[pos++] = data; + break; + } + } + + if (pos) + return line; + + free(line); + return NULL; +} + +UINT16 put_odb(imgtool_stream *instream, imgtool_stream *outstream, UINT8 file_id) +{ + char *line; + UINT16 out_size = 0; + + // reset stream + stream_seek(instream, 0, SEEK_SET); + + while ((line = stream_getline(instream, 256))) + { + UINT16 len = strlen(line); + + stream_putc(outstream, (UINT8)len); + stream_putc(outstream, file_id); + stream_write(outstream, line, len); + + out_size += (len + 1); + + free(line); + } + + // end of pack + stream_fill(outstream, 0xff, 2); + + return out_size + 4; +} + +UINT16 put_ob3(imgtool_stream *instream, imgtool_stream *outstream) +{ + UINT16 size = stream_size(instream) - 6; + dynamic_buffer buffer(size); + + stream_seek(instream, 6, SEEK_SET); + stream_read(instream, &buffer[0], size); + + stream_write(outstream, &buffer[0], size); + + // end of pack + stream_fill(outstream, 0xff, 2); + + return size; +} + +UINT16 put_opl(imgtool_stream *instream, imgtool_stream *outstream) +{ + UINT16 out_size = 0; + UINT32 rec_start = stream_tell(outstream); + char *line; + + // reset stream + stream_seek(instream, 0, SEEK_SET); + + stream_fill(outstream, 0x00, 4); + + // replace all eol with 0x00 + while ((line = stream_getline(instream, 256))) + { + // replace tab with space + for (int i=0; i>8) & 0xff); + stream_putc(outstream, out_size & 0xff); + + return out_size + 4; +} + +UINT16 get_odb(imgtool_stream *instream, imgtool_stream *outstream, UINT8 type, UINT8 file_id) +{ + UINT8 data, *buffer; + UINT16 out_size = 0; + + if (file_id >= 0x90) + while (seek_next_record(instream, file_id)) + { + stream_read(instream, &data, 1); + stream_seek(instream, 1, SEEK_CUR); + buffer = (UINT8*)malloc(data); + stream_read(instream, buffer, data); + stream_write(outstream, buffer, data); + stream_putc(outstream, '\r'); + stream_putc(outstream, '\n'); + free (buffer); + out_size += data; + } + + return out_size; +} + +UINT16 get_ob3(imgtool_stream *instream, imgtool_stream *outstream, UINT8 type, UINT8 file_id) +{ + UINT8 data, *buffer = NULL; + UINT16 size = 0; + static const char ob3_magic[3] = {'O', 'R', 'G'}; + + stream_read(instream, &data, 1); + + if (data == 0x02) + { + stream_seek(instream, 1, SEEK_CUR); + size = get_long_rec_size(instream); + buffer = (UINT8*)malloc(size); + stream_read(instream, buffer, size); + } + + stream_write(outstream, ob3_magic, 3); + stream_putc(outstream, (size>>8) & 0xff); + stream_putc(outstream, size & 0xff); + stream_putc(outstream, type | 0x80); + + if (buffer) + { + stream_write(outstream, buffer, size); + free (buffer); + } + + return size; +} + +static imgtoolerr_t datapack_open( imgtool_image *image, imgtool_stream *stream) +{ + psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); + char opk_magic[4]; + + stream_read(stream, opk_magic, 4); + + if(strcmp(opk_magic, "OPK\0")) + return IMGTOOLERR_UNEXPECTED; + + pack->stream = stream; + + if (update_pack_index(pack)) + return IMGTOOLERR_SUCCESS; + else + return IMGTOOLERR_CORRUPTIMAGE; +} + +static imgtoolerr_t datapack_create( imgtool_image *image, imgtool_stream *stream, option_resolution *opts) +{ + psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); + static const UINT8 opk_magic[4] = {'O', 'P', 'K', 0x00}; + UINT8 pack_head[8] = {0x40, 0x00, 0x59, 0x01, 0x01, 0x01, 0x00, 0x00}; + UINT16 checksum; + + pack_head[0] |= (option_resolution_lookup_int(opts, 'R')) ? 0x00 : 0x02; + pack_head[0] |= (option_resolution_lookup_int(opts, 'P')) ? 0x04 : 0x00; + pack_head[0] |= (option_resolution_lookup_int(opts, 'W')) ? 0x00 : 0x08; + pack_head[0] |= (option_resolution_lookup_int(opts, 'B')) ? 0x00 : 0x10; + pack_head[0] |= (option_resolution_lookup_int(opts, 'C')) ? 0x20 : 0x00; + pack_head[1] = option_resolution_lookup_int(opts, 'S'); + + checksum = head_checksum(pack_head); + + stream_write(stream, opk_magic, 4); + stream_fill(stream, 0x00, 2); + stream_write(stream, pack_head, 8); + + stream_putc(stream, (checksum>>8) & 0xff); + stream_putc(stream, checksum & 0xff); + + put_name_record(stream, "MAIN", 0x81, 0x90); + + stream_fill(stream, 0xff, 2); + + update_opk_head(stream); + + pack->stream = stream; + + if (update_pack_index(pack)) + return IMGTOOLERR_SUCCESS; + else + return IMGTOOLERR_CORRUPTIMAGE; +} + +static void datapack_close( imgtool_image *image) +{ + psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); + + stream_close( pack->stream ); +} + +static imgtoolerr_t datapack_begin_enum(imgtool_directory *enumeration, const char *path) +{ + psion_iter *iter = (psion_iter*)imgtool_directory_extrabytes(enumeration); + iter->index = 0; + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t datapack_next_enum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + imgtool_image *image = imgtool_directory_image(enumeration); + psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); + psion_iter *iter = (psion_iter*)imgtool_directory_extrabytes(enumeration); + UINT8 data = 0; + + if (!pack->pack_index[iter->index].name_rec) + { + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + memcpy(ent->filename, pack->pack_index[iter->index].filename, 8); + sprintf(ent->attr, "Type: %02x ID: %02x", pack->pack_index[iter->index].type, pack->pack_index[iter->index].id); + + if (pack->pack_index[iter->index].data_rec) + { + stream_seek(pack->stream, pack->pack_index[iter->index].data_rec + 2, SEEK_SET); + ent->filesize = get_long_rec_size(pack->stream); + } + + // seek all file's records + if (pack->pack_index[iter->index].id >= 0x90) + { + stream_seek(pack->stream, 0x10, SEEK_SET); + while (seek_next_record(pack->stream, pack->pack_index[iter->index].id)) + { + stream_read(pack->stream, &data, 1); + stream_seek(pack->stream, data + 1, SEEK_CUR); + ent->filesize +=data; + } + } + + iter->index++; + return IMGTOOLERR_SUCCESS; +} + +static void datapack_close_enum( imgtool_directory *enumeration) +{ +} + +static imgtoolerr_t datapack_free_space( imgtool_partition *partition, UINT64 *size) +{ + imgtool_image *image = imgtool_partition_image( partition); + psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); + UINT32 pack_size = 0; + + stream_seek(pack->stream, 0x07, SEEK_SET); + stream_read(pack->stream, &pack_size, 1); + + if (size) + *size = (pack_size * 0x2000) - pack->eop; + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t datapack_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtool_image *image = imgtool_partition_image(partition); + psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); + int index = seek_file_name(pack, filename); + + if (index >= 0) + { + if ((pack->pack_index[index].type & 0x7f) == 0x01) + { + // ODB files + stream_seek(pack->stream, 0x10, SEEK_SET); + get_odb(pack->stream, destf, pack->pack_index[index].type, pack->pack_index[index].id); + } + else if ((pack->pack_index[index].type & 0x7f) == 0x03) + { + // OB3/OPL files + stream_seek(pack->stream, pack->pack_index[index].data_rec, SEEK_SET); + get_ob3(pack->stream, destf, pack->pack_index[index].type, pack->pack_index[index].id); + } + else + { + // Other files + return IMGTOOLERR_UNIMPLEMENTED; + } + + return IMGTOOLERR_SUCCESS; + } + else + return IMGTOOLERR_FILENOTFOUND; +} + +static imgtoolerr_t datapack_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtool_image *image = imgtool_partition_image(partition); + psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); + static const UINT8 data_head[4] = {0x02, 0x80, 0x00, 0x00}; + UINT8 head[3]; + UINT16 size = 0; + UINT8 type = option_resolution_lookup_int(opts, 'T'); + UINT8 file_id = option_resolution_lookup_int(opts, 'I'); + + if (!pack->eop) + return IMGTOOLERR_CORRUPTIMAGE; + + // if not file_id is specified get the first free (for ODB only) + if (file_id == 0 && type == 3) + { + file_id = get_free_file_id(pack); + + if (file_id == 0xff) + return IMGTOOLERR_NOSPACE; + } + + stream_read(sourcef, head, 3); + stream_seek(pack->stream, pack->eop, SEEK_SET); + + if (type == 0) + type = (!strncmp((char*)head, "ORG", 3)) ? 1 : 2; + + switch (type) + { + case 1: //OB3 file + put_name_record(pack->stream, filename, 0x83, file_id); + stream_write(pack->stream, data_head, 4); + size = put_ob3(sourcef, pack->stream); + break; + case 2: //OPL file + put_name_record(pack->stream, filename, 0x83, file_id); + stream_write(pack->stream, data_head, 4); + size = put_opl(sourcef, pack->stream); + break; + case 3: //ODB file + put_name_record(pack->stream, filename, 0x81, file_id); + size = put_odb(sourcef, pack->stream, file_id); + break; + } + + if (type != 3) + { + // update the OB3/OPL long record size + stream_seek(pack->stream, pack->eop + 13, SEEK_SET); + stream_putc(pack->stream, (size>>8) & 0xff); + stream_putc(pack->stream, size & 0xff); + } + + update_opk_head(pack->stream); + + if (update_pack_index(pack)) + return IMGTOOLERR_SUCCESS; + else + return IMGTOOLERR_CORRUPTIMAGE; +} + +static imgtoolerr_t datapack_delete_file( imgtool_partition *partition, const char *filename) +{ + imgtool_image *image = imgtool_partition_image(partition); + psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); + int index = seek_file_name(pack, filename); + + if (index >= 0) + { + // clear the bit 7 of the file type to mark the file as deleted + stream_seek(pack->stream, pack->pack_index[index].name_rec + 1, SEEK_SET); + stream_putc(pack->stream, pack->pack_index[index].type & 0x7f); + + if (update_pack_index(pack)) + return IMGTOOLERR_SUCCESS; + else + return IMGTOOLERR_CORRUPTIMAGE; + } + else + return IMGTOOLERR_FILENOTFOUND; +} + +static OPTION_GUIDE_START( psion_create_optguide ) + OPTION_ENUM_START( 'S', "size", "datapack size" ) + OPTION_ENUM( 1, "8k", "8 kbyte" ) + OPTION_ENUM( 2, "16k", "16 kbyts" ) + OPTION_ENUM( 4, "32k", "32 kbyte" ) + OPTION_ENUM( 8, "64k", "64 kbyte" ) + OPTION_ENUM( 16, "128k", "128 kbyte" ) // only paged datapacks can have this size + OPTION_ENUM_END + OPTION_INT('R', "ram", "EPROM/RAM datapack" ) + OPTION_INT('P', "paged", "linear/paged datapack" ) + OPTION_INT('W', "protect", "write-protected datapack" ) + OPTION_INT('B', "boot", "bootable datapack" ) + OPTION_INT('C', "copy", "copyable datapack" ) +OPTION_GUIDE_END + +static OPTION_GUIDE_START( psion_write_optguide ) + OPTION_ENUM_START( 'T', "type", "file type" ) + OPTION_ENUM( 1, "OB3", "OB3 files" ) + OPTION_ENUM( 2, "OPL", "OPL files" ) + OPTION_ENUM( 3, "ODB", "ODB or text files" ) + OPTION_ENUM_END + OPTION_INT( 'I', "id", "File ID" ) +OPTION_GUIDE_END + +void psion_get_info( const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch (state) + { + // --- the following bits of info are returned as 64-bit signed integers --- + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES : info->i = sizeof(psion_pack); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES : info->i = sizeof(psion_iter); break; + + // --- the following bits of info are returned as pointers to data or functions --- + case IMGTOOLINFO_PTR_OPEN : info->open = datapack_open; break; + case IMGTOOLINFO_PTR_CREATE : info->create = datapack_create; break; + case IMGTOOLINFO_PTR_CLOSE : info->close = datapack_close; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = datapack_begin_enum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = datapack_next_enum; break; + case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = datapack_close_enum; break; + case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = datapack_free_space; break; + case IMGTOOLINFO_PTR_READ_FILE : info->read_file = datapack_read_file; break; + case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = datapack_write_file; break; + case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = datapack_delete_file; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE : info->createimage_optguide = psion_create_optguide; break; + case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE : info->createimage_optguide = psion_write_optguide; break; + + // --- the following bits of info are returned as NULL-terminated strings --- + case IMGTOOLINFO_STR_NAME : strcpy( info->s = imgtool_temp_str(), "psionpack"); break; + case IMGTOOLINFO_STR_DESCRIPTION : strcpy( info->s = imgtool_temp_str(), "Psion Organiser II Datapack"); break; + case IMGTOOLINFO_STR_FILE : strcpy( info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "opk"); break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "S1/2/[4]/8/16;R[0]/1;P[0]/1;W0/[1];B[0]/1;C0/[1]"); break; + case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "T[1]/2/3;I[0]/145-255"); break; + } +} diff --git a/src/mame/tools/imgtool/modules/rsdos.c b/src/mame/tools/imgtool/modules/rsdos.c new file mode 100644 index 00000000000..8323574b001 --- /dev/null +++ b/src/mame/tools/imgtool/modules/rsdos.c @@ -0,0 +1,623 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/**************************************************************************** + + rsdos.c + + CoCo RS-DOS disk images + +****************************************************************************/ + +#include +#include +#include +#include "imgtool.h" +#include "formats/coco_dsk.h" +#include "iflopimg.h" + +/* this structure mirrors the structure of an RS-DOS directory entry on disk */ +struct rsdos_dirent +{ + char fname[8]; + char fext[3]; + char ftype; + char asciiflag; + unsigned char first_granule; + unsigned char lastsectorbytes_msb; + unsigned char lastsectorbytes_lsb; + unsigned char unused[16]; +}; + +struct rsdos_direnum +{ + int index; + int eof; +}; + +#define RSDOS_OPTIONS_FTYPE 'T' +#define RSDOS_OPTIONS_ASCII 'M' + + + +/********************************************************************* + Imgtool module code +*********************************************************************/ + +#define MAX_DIRENTS ((18-2)*(256/32)) +static floperr_t get_rsdos_dirent(imgtool_image *f, int index_loc, struct rsdos_dirent *ent) +{ + return floppy_read_sector(imgtool_floppy(f), 0, 17, 3, index_loc * 32, (void *) ent, sizeof(*ent)); +} + + + +static floperr_t put_rsdos_dirent(imgtool_image *f, int index_loc, const struct rsdos_dirent *ent) +{ + if (index_loc >= MAX_DIRENTS) + return (floperr_t)IMGTOOLERR_FILENOTFOUND; + return floppy_write_sector(imgtool_floppy(f), 0, 17, 3, index_loc * 32, (void *) ent, sizeof(*ent), 0); /* TODO: pass ddam argument from imgtool */ +} + + + +/* fnamebuf must have at least 13 bytes */ +static void get_dirent_fname(char *fnamebuf, const struct rsdos_dirent *ent) +{ + char *s; + + memset(fnamebuf, 0, 13); + memcpy(fnamebuf, ent->fname, sizeof(ent->fname)); + rtrim(fnamebuf); + s = fnamebuf + strlen(fnamebuf); + *(s++) = '.'; + memcpy(s, ent->fext, sizeof(ent->fext)); + rtrim(s); + + /* If no extension, remove period */ + if (*s == '\0') + s[-1] = '\0'; +} + + + +static imgtoolerr_t lookup_rsdos_file(imgtool_image *f, const char *fname, struct rsdos_dirent *ent, int *position) +{ + int i; + floperr_t ferr; + char fnamebuf[13]; + + i = 0; + fnamebuf[0] = '\0'; + + do + { + do + { + ferr = get_rsdos_dirent(f, i++, ent); + if (ferr) + return imgtool_floppy_error(ferr); + } + while(ent->fname[0] == '\0'); + + + if (ent->fname[0] != -1) + get_dirent_fname(fnamebuf, ent); + } + while((ent->fname[0] != -1) && core_stricmp(fnamebuf, fname)); + + if (ent->fname[0] == -1) + return IMGTOOLERR_FILENOTFOUND; + + if (position) + *position = i - 1; + return (imgtoolerr_t)0; +} + + + +static UINT8 get_granule_count(imgtool_image *img) +{ + UINT16 tracks; + UINT16 granules; + + tracks = floppy_get_tracks_per_disk(imgtool_floppy(img)); + granules = (tracks - 1) * 2; + return (granules > 255) ? 255 : (UINT8) granules; +} + +#define MAX_GRANULEMAP_SIZE 256 + +/* granule_map must be an array of MAX_GRANULEMAP_SIZE bytes */ +static floperr_t get_granule_map(imgtool_image *img, UINT8 *granule_map, UINT8 *granule_count) +{ + UINT8 count; + + count = get_granule_count(img); + if (granule_count) + *granule_count = count; + + return floppy_read_sector(imgtool_floppy(img), 0, 17, 2, 0, granule_map, count); +} + + + +static floperr_t put_granule_map(imgtool_image *img, const UINT8 *granule_map, UINT8 granule_count) +{ + return floppy_write_sector(imgtool_floppy(img), 0, 17, 2, 0, granule_map, granule_count, 0); /* TODO: pass ddam argument from imgtool */ +} + + + + +static imgtoolerr_t transfer_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *f, imgtoolerr_t (*proc)(imgtool_image *, int, int, int, int, size_t, imgtool_stream *)) +{ + imgtoolerr_t err = IMGTOOLERR_SUCCESS; + UINT8 track, sector; + + track = granule / 2; + if (track >= 17) + track++; + + sector = (granule % 2) ? 10 : 1; + + if (length > 0) + err = proc(img, 0, track, sector, 0, length, f); + return err; +} + + + +static imgtoolerr_t transfer_from_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *destf) +{ + return transfer_granule(img, granule, length, destf, imgtool_floppy_read_sector_to_stream); +} + + + +static imgtoolerr_t transfer_to_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *sourcef) +{ + return transfer_granule(img, granule, length, sourcef, imgtool_floppy_write_sector_from_stream); +} + + + +static imgtoolerr_t process_rsdos_file(struct rsdos_dirent *ent, imgtool_image *img, imgtool_stream *destf, size_t *size) +{ + floperr_t ferr; + size_t s, lastgransize; + UINT8 granule_count; + unsigned char i = 0, granule; + UINT8 usedmap[MAX_GRANULEMAP_SIZE]; /* Used to detect infinite loops */ + UINT8 granule_map[MAX_GRANULEMAP_SIZE]; + + ferr = get_granule_map(img, granule_map, &granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + memset(usedmap, 0, granule_count); + + lastgransize = ent->lastsectorbytes_lsb + (((int) ent->lastsectorbytes_msb) << 8); + s = 0; + granule = ent->first_granule; + + while(!usedmap[granule] && ((i = granule_map[granule]) < granule_count)) + { + usedmap[granule] = 1; + if (destf) + transfer_from_granule(img, granule, 9*256, destf); + + /* i is the next granule */ + s += (256 * 9); + granule = i; + } + + if ((i < 0xc0) || (i > 0xc9)) + return IMGTOOLERR_CORRUPTIMAGE; + + if (lastgransize) + i--; + lastgransize += (256 * (i - 0xc0)); + + if (destf) + transfer_from_granule(img, granule, lastgransize, destf); + + if (size) + *size = s + lastgransize; + return IMGTOOLERR_SUCCESS; +} + + + +/* create a new directory entry with a specified name */ +static imgtoolerr_t prepare_dirent(struct rsdos_dirent *ent, const char *fname) +{ + const char *fname_end; + const char *fname_ext; + int fname_ext_len; + + memset(ent, '\0', sizeof(*ent)); + memset(ent->fname, ' ', sizeof(ent->fname)); + memset(ent->fext, ' ', sizeof(ent->fext)); + + fname_end = strchr(fname, '.'); + if (fname_end) + fname_ext = fname_end + 1; + else + fname_end = fname_ext = fname + strlen(fname); + + fname_ext_len = strlen(fname_ext); + + /* We had better be an 8.3 filename */ + if (((fname_end - fname) > 8) || (fname_ext_len > 3)) + return IMGTOOLERR_BADFILENAME; + + memcpy(ent->fname, fname, fname_end - fname); + memcpy(ent->fext, fname_ext, fname_ext_len); + + /* For now, all files are type 2 binary files */ + ent->ftype = 2; + ent->asciiflag = 0; + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t rsdos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + floperr_t ferr; + imgtoolerr_t err; + size_t filesize; + struct rsdos_direnum *rsenum; + struct rsdos_dirent rsent; + char fname[13]; + imgtool_image *image; + + image = imgtool_directory_image(enumeration); + rsenum = (struct rsdos_direnum *) imgtool_directory_extrabytes(enumeration); + + /* Did we hit the end of file before? */ + if (rsenum->eof) + goto eof; + + do + { + if (rsenum->index >= MAX_DIRENTS) + goto eof; + + ferr = get_rsdos_dirent(image, rsenum->index++, &rsent); + if (ferr) + return imgtool_floppy_error(ferr); + } + while(rsent.fname[0] == '\0'); + + /* Now are we at the eof point? */ + if (rsent.fname[0] == -1) + { + rsenum->eof = 1; +eof: + ent->eof = 1; + } + else + { + /* Not the end of file */ + err = process_rsdos_file(&rsent, image, NULL, &filesize); + if (err) + return err; + + if (filesize == ((size_t) -1)) + { + /* corrupt! */ + ent->filesize = 0; + ent->corrupt = 1; + } + else + { + ent->filesize = filesize; + ent->corrupt = 0; + } + ent->eof = 0; + + get_dirent_fname(fname, &rsent); + + snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fname); + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B')); + } + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t rsdos_diskimage_freespace(imgtool_partition *partition, UINT64 *size) +{ + floperr_t ferr; + UINT8 i; + size_t s = 0; + UINT8 granule_count; + UINT8 granule_map[MAX_GRANULEMAP_SIZE]; + imgtool_image *image = imgtool_partition_image(partition); + + ferr = get_granule_map(image, granule_map, &granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + for (i = 0; i < granule_count; i++) + { + if (granule_map[i] == 0xff) + s += (9 * 256); + } + *size = s; + return (imgtoolerr_t)FLOPPY_ERROR_SUCCESS; +} + + + +static imgtoolerr_t delete_entry(imgtool_image *img, struct rsdos_dirent *ent, int pos) +{ + floperr_t ferr; + unsigned char g, i; + UINT8 granule_count; + UINT8 granule_map[MAX_GRANULEMAP_SIZE]; + + /* Write a NUL in the filename, marking it deleted */ + ent->fname[0] = 0; + ferr = put_rsdos_dirent(img, pos, ent); + if (ferr) + return imgtool_floppy_error(ferr); + + ferr = get_granule_map(img, granule_map, &granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + /* Now free up the granules */ + g = ent->first_granule; + while (g < granule_count) + { + i = granule_map[g]; + granule_map[g] = 0xff; + g = i; + } + + ferr = put_granule_map(img, granule_map, granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t rsdos_diskimage_readfile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t err; + struct rsdos_dirent ent; + size_t size; + imgtool_image *img = imgtool_partition_image(partition); + + err = lookup_rsdos_file(img, fname, &ent, NULL); + if (err) + return err; + + err = process_rsdos_file(&ent, img, destf, &size); + if (err) + return err; + + if (size == (size_t) -1) + return IMGTOOLERR_CORRUPTIMAGE; + + return (imgtoolerr_t)0; +} + + + +static imgtoolerr_t rsdos_diskimage_writefile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) +{ + floperr_t ferr; + imgtoolerr_t err; + imgtool_image *img = imgtool_partition_image(partition); + struct rsdos_dirent ent, ent2; + size_t i; + UINT64 sz; + UINT64 freespace = 0; + unsigned char g; + unsigned char *gptr; + UINT8 granule_count; + UINT8 granule_map[MAX_GRANULEMAP_SIZE]; + + /* can we write to this image? */ + if (floppy_is_read_only(imgtool_floppy(img))) + return IMGTOOLERR_READONLY; + + err = rsdos_diskimage_freespace(partition, &freespace); + if (err) + return err; + + /* is there enough space? */ + sz = stream_size(sourcef); + if (sz > freespace) + return IMGTOOLERR_NOSPACE; + + /* setup our directory entry */ + err = prepare_dirent(&ent, fname); + if (err) + return err; + + ent.ftype = option_resolution_lookup_int(writeoptions, RSDOS_OPTIONS_FTYPE); + ent.asciiflag = ((UINT8) option_resolution_lookup_int(writeoptions, RSDOS_OPTIONS_ASCII)) - 1; + ent.lastsectorbytes_lsb = sz % 256; + ent.lastsectorbytes_msb = (((sz % 256) == 0) && (sz > 0)) ? 1 : 0; + gptr = &ent.first_granule; + + ferr = get_granule_map(img, granule_map, &granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + g = 0x00; + + do + { + while (granule_map[g] != 0xff) + { + g++; + if ((g >= granule_count) || (g == 0)) + return IMGTOOLERR_UNEXPECTED; /* We should have already verified that there is enough space */ + } + *gptr = g; + gptr = &granule_map[g]; + + + i = MIN(sz, (9*256)); + err = transfer_to_granule(img, g, i, sourcef); + if (err) + return err; + + sz -= i; + + /* Go to next granule */ + g++; + } + while(sz > 0); + + /* Now that we are done with the file, we need to specify the final entry + * in the file allocation table + */ + *gptr = 0xc0 + ((i + 255) / 256); + + /* Now we need to find an empty directory entry */ + i = -1; + do + { + ferr = get_rsdos_dirent(img, ++i, &ent2); + if (ferr) + return imgtool_floppy_error(ferr); + } + while((ent2.fname[0] != '\0') && strcmp(ent.fname, ent2.fname) && (ent2.fname[0] != -1)); + + /* delete file if it already exists */ + if (ent2.fname[0] && (ent2.fname[0] != -1)) + { + err = delete_entry(img, &ent2, i); + if (err) + return err; + } + + ferr = put_rsdos_dirent(img, i, &ent); + if (ferr) + return imgtool_floppy_error(ferr); + + /* write the granule map back out */ + ferr = put_granule_map(img, granule_map, granule_count); + if (ferr) + return imgtool_floppy_error(ferr); + + return IMGTOOLERR_SUCCESS; +} + + + +static imgtoolerr_t rsdos_diskimage_deletefile(imgtool_partition *partition, const char *fname) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + int pos; + struct rsdos_dirent ent; + + err = lookup_rsdos_file(image, fname, &ent, &pos); + if (err) + return err; + + return delete_entry(image, &ent, pos); +} + + + +static imgtoolerr_t rsdos_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) +{ + imgtoolerr_t err; + imgtool_image *image = imgtool_partition_image(partition); + struct rsdos_dirent ent; + int pos; + + if (fname) + { + err = lookup_rsdos_file(image, fname, &ent, &pos); + if (err) + return err; + + if (ent.asciiflag == (char) 0xFF) + { + /* ASCII file */ + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = filter_eoln_getinfo; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = NULL; + } + else if (ent.ftype == 0) + { + /* tokenized BASIC file */ + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = NULL; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = filter_cocobas_getinfo; + } + } + else + { + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = NULL; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = filter_eoln_getinfo; + suggestions[2].viability = SUGGESTION_POSSIBLE; + suggestions[2].filter = filter_cocobas_getinfo; + } + + return IMGTOOLERR_SUCCESS; +} + + + +/********************************************************************* + Imgtool module declaration +*********************************************************************/ + +static OPTION_GUIDE_START( coco_rsdos_writefile_optionguide ) + OPTION_ENUM_START( RSDOS_OPTIONS_FTYPE, "ftype", "File type" ) + OPTION_ENUM( 0, "basic", "Basic" ) + OPTION_ENUM( 1, "data", "Data" ) + OPTION_ENUM( 2, "binary", "Binary" ) + OPTION_ENUM( 3, "assembler", "Assembler Source" ) + OPTION_ENUM_END + OPTION_ENUM_START( RSDOS_OPTIONS_ASCII, "ascii", "Ascii flag" ) + OPTION_ENUM( 0, "ascii", "Ascii" ) + OPTION_ENUM( 1, "binary", "Binary" ) + OPTION_ENUM_END +OPTION_GUIDE_END + + + +void rsdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct rsdos_direnum); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "rsdos"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "RS-DOS format"); break; + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; + case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T0-[2]-3;M0-[1]"); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = rsdos_diskimage_nextenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = rsdos_diskimage_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = rsdos_diskimage_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = rsdos_diskimage_writefile; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = rsdos_diskimage_deletefile; break; + case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = rsdos_diskimage_suggesttransfer; break; + case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = coco_rsdos_writefile_optionguide; break; + case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_coco; break; + } +} diff --git a/src/mame/tools/imgtool/modules/thomson.c b/src/mame/tools/imgtool/modules/thomson.c new file mode 100644 index 00000000000..43684bc0aea --- /dev/null +++ b/src/mame/tools/imgtool/modules/thomson.c @@ -0,0 +1,1681 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/**************************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Thomson 8-bit micro-computers. + + Handles SAP, QD and FD floppy formats with a BASIC-DOS filesystem + (most floppies except some games and demo). + +*****************************************************************************/ + +/* TODO: + - improve two-sided floppy support + - check & correct BASIC read filter + - implement BASIC write filter + - handle accented letters + */ + + +/* Thomson floppy geometry are: + - 5"1/4 single density: 40 tracks, 16 sectors/track, 128 bytes/sector + - 5"1/4 double density: 40 tracks, 16 sectors/track, 256 bytes/sector + - 3"1/2 double density: 80 tracks, 16 sectors/track, 256 bytes/sector + - 2"8: 25 logical tracks, 16 logical sectors/track, 128 bytes/sector + + Notes: + + - 2"8 QDD actually contain a single spiraling track, with 400 128-byte + sectors; however, the filesystem considers it has 25 virtual tracks of + 16 sectors => we do the same in imgtool (but thomflop.c uses a 400-sector + addressing to emulate the device hardware) + + - tracks always have 16 sectors, this is requred by the filesystem + + - two-sided floppies are handled as two one-sided floppies in two + logical floppy drives on the original Thomsons; each has its own + independent FAT and directory. + In imgtool, we handle two-sided images as two partitions. + For now, only 3"1/2 .fd and QDD .qd files can be two-sided. + + - it seems possible to create 3"1/2 single density floppies on the TO9, + I am not sure this is standard, and we do not support it... + +*/ + + +/* Microsoft BASIC Filesystem. + + The floppy is divided into blocks, with always two blocks / track. + Also, in double density, only the first 255 bytes of each 256-byte + sector is used. Thus, blocks are 1024 bytes in single density, and + 2040 bytes in double density. + Depending on the number of tracks, there can be 50, 80 or 160 blocks. + + Filesystem data always occupy track 20, whatever the floppy geometry. + + * sector 1: + - bytes 0-7: floppy name + - remaining bytes: undocumented, seem unused + + * sector 2: FAT, 1 byte info per block + - byte 0: always 0 + - byte 1: block 0 + ... + - byte i: block i-1 + ... + - byte 160: block 159 + - remaining bytes: undocumented, seem unused + + The byte has the following meaning: + - ff: block is free + - fb: block is reserved + - 00-bf: block allocated, points to then next file block + - c1-c8: last block in file, (value & 15) is the number of sectors + actually allocated to the file + + Note: in single density, we can reference only 127 blocks. This is not + a problem because single density floppies can only have 50 or 80 blocks, + never 160. + + * sector 3-16: directory + + no subdirectories + + each file entry occupies 32 bytes: + - bytes 00-07: filename, padded with whitespaces + - bytes 08-0A: file extension, padedd with whitespaces + - byte 0B: file type + . 0 = BASIC, ASCII or binary program (B) + . 1 = BASIC or ASCII data (D) + . 2 = machine code (M) + . 3 = ASCII assembler file (A) + - byte 0C: format flag + . 00 = binary (tokenized) + . ff = ASCII + - byte 0D: first block + - bytes 0E-0F: bytes used in the last sector + - bytes 10-17: comment + - byte 18: day (of month) + - byte 19: month + - byte 1A: year (two last digits) + - bytes 1B-1f: unknown + + Note that byte 0 has a special significance: + - 00: free directory entry + - 20-7F: actual directory entry, value is the first character ini filename + - ff: end of directory + + There can be 56 files in single density, 112 in double density. + */ + +#include "imgtool.h" +#include "iflopimg.h" + +#include + + +#define MAXSIZE 80*16*256*2 /* room for two faces, double-density, 80 tracks */ + +struct thom_floppy { + imgtool_stream *stream; + + UINT16 sector_size; /* 128 or 256 */ + UINT16 sectuse_size; /* bytes used in sector: 128 or 255 */ + UINT8 tracks; /* 25, 40, or 80 */ + UINT8 heads; /* 1 or 2 */ + UINT8 data[MAXSIZE]; /* image data */ + + int modified; /* data need to be copied back to image file */ + +}; + + +enum thom_dirent_type { + THOM_DIRENT_END, + THOM_DIRENT_FREE, + THOM_DIRENT_FILE, + THOM_DIRENT_INVALID, + +}; + + +struct thom_dirent { + thom_dirent_type type; + int index; + + char name[9]; + char ext[4]; + char comment[9]; + UINT8 ftype; + UINT8 format; + UINT8 firstblock; + UINT16 lastsectsize; + UINT8 day; + UINT8 month; + UINT8 year; + +}; + + +static void thom_basic_get_info(const imgtool_class *clas, UINT32 param, + union imgtoolinfo *info); + +static UINT8* thom_get_sector(thom_floppy* f, unsigned head, + unsigned track, unsigned sector); + + +/*********************** .fd / .qd format ************************/ + +/* .fd and .qd formats are very simple: the sectors are simply put one after + another, starting at sector 1 of track 0 to sector 16 track 0, then + starting again at sector 1 of track 1, and so on. + There is no image or sector header, and no gap between sectors. + The number of tracks and sector size are determined by the extension + (.fd have 40 or 80 tracks, .qd have 25 tracks) and the file size. +*/ + +static imgtoolerr_t thom_open_fd_qd(imgtool_image *img, imgtool_stream *stream) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + int size = stream_size( stream ); + + f->stream = stream; + f->modified = 0; + + /* guess format */ + switch ( size ) { + case 81920: + f->tracks = 40; + f->sector_size = 128; + f->sectuse_size = 128; + f->heads = 1; + break; + + case 163840: + f->tracks = 40; + f->sector_size = 256; + f->sectuse_size = 255; + f->heads = 1; + /* could also be: sector_size=128, heads=2 */ + /* maight even be: tracks=80, sector_size=128 */ + break; + + case 327680: + f->tracks = 80; + f->sector_size = 256; + f->sectuse_size = 255; + f->heads = 1; + /* could also be: tracks=40, heads=2 */ + break; + + case 655360: + f->tracks = 80; + f->sector_size = 256; + f->sectuse_size = 255; + f->heads = 2; + break; + + case 51200: + f->tracks = 25; + f->sector_size = 128; + f->sectuse_size = 128; + f->heads = 1; + break; + + case 62400: + f->tracks = 25; + f->sector_size = 128; + f->sectuse_size = 128; + f->heads = 2; + break; + + default: + return IMGTOOLERR_CORRUPTIMAGE; + } + + assert( size == f->heads * f->tracks * 16 * f->sector_size ); + + stream_seek( stream, 0, SEEK_SET ); + if ( stream_read( stream, f->data, size ) < size ) + return IMGTOOLERR_READERROR; + + return IMGTOOLERR_SUCCESS; +} + +static void thom_close_fd_qd(imgtool_image *img) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + + /* save image */ + if ( f->modified ) { + int size = f->heads * f->tracks * 16 * f->sector_size; + stream_seek( f->stream, 0, SEEK_SET ); + if ( stream_write( f->stream, f->data, size ) < size ) + { + /* logerror( "thom_diskimage_close_fd_qd: write error\n" ); */ + } + } + + stream_close( f->stream ); +} + + +/*********************** .sap format ************************/ + +/* SAP format, Copyright 1998 by Alexandre Pukall + + image is composed of: + - byte 0: version (0 or 1) + - bytes 1..65: signature + - bytes 66..end: sectors + + each sector is composed of + - a 4-byte header: + . byte 0: format + 0 3"1/2 double density + 1 5"1/4 low density + . byte 1: protection (?) + . byte 2: track index, in 0..79 + . byte 3: sector index, in 1..16 + - sector data, XOR 0xB3 + - 2-byte CRC of header + data, high byte first + + there is no provision for two-sided images in sap + */ + +static const int sap_magic_num = 0xB3; /* simple XOR crypt */ + +static const char sap_header[]= + "\001SYSTEME D'ARCHIVAGE PUKALL S.A.P. " + "(c) Alexandre PUKALL Avril 1998"; + +static const UINT16 sap_crc[] = { + 0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387, + 0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f, +}; + +static UINT16 thom_sap_crc( UINT8* data, int size ) +{ + int i; + UINT16 crc = 0xffff, crc2; + for ( i = 0; i < size; i++ ) { + crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ]; + crc = ( crc2 >> 4 ) ^ sap_crc[ ( crc2 ^ (data[i] >> 4) ) & 15 ]; + } + return crc; +} + +static imgtoolerr_t thom_open_sap(imgtool_image *img, imgtool_stream *stream) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + UINT8 buf[262]; + + f->stream = stream; + f->modified = 0; + + /* check image header */ + stream_seek( stream, 0, SEEK_SET ); + stream_read( stream, buf, 66 ); + if ( memcmp( buf+1, sap_header+1, 65 ) ) return IMGTOOLERR_CORRUPTIMAGE; + + /* guess format */ + stream_read( stream, buf, 1 ); + switch ( buf[0] ) { + case 1: + case 3: + f->heads = 1; + f->tracks = 40; + f->sector_size = 128; + f->sectuse_size = 128; + break; + case 0: + case 2: + case 4: + f->heads = 1; + f->tracks = 80; + f->sector_size = 256; + f->sectuse_size = 255; + break; + default: return IMGTOOLERR_CORRUPTIMAGE; + } + + stream_seek( stream, 66, SEEK_SET ); + while ( 1) { + int i, sector, track; + UINT16 crc; + + /* load sector */ + if ( stream_read( stream, buf, 6 + f->sector_size ) < 6 + f->sector_size ) + break; + + /* parse sector header */ + track = buf[2]; + sector = buf[3]; + if ( sector < 1 || sector > 16 || track >= f->tracks ) + return IMGTOOLERR_CORRUPTIMAGE; + + /* decrypt */ + for ( i = 0; i < f->sector_size; i++ ) buf[ i + 4 ] ^= sap_magic_num; + memcpy( thom_get_sector( f, 0, track, sector ), buf + 4, f->sector_size ); + + /* check CRC */ + crc = thom_sap_crc( buf, f->sector_size + 4 ); + if ( ( (crc >> 8) != buf[ f->sector_size + 4 ] ) || + ( (crc & 0xff) != buf[ f->sector_size + 5 ] ) ) + return IMGTOOLERR_CORRUPTIMAGE; + } + + return IMGTOOLERR_SUCCESS; +} + +static void thom_close_sap(imgtool_image *img) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + + if ( f->modified ) { + int i, sector, track; + UINT8 buf[262]; + UINT16 crc; + + /* rewind */ + stream_seek( f->stream, 0, SEEK_SET ); + + /* image header */ + if ( stream_write( f->stream, sap_header, 66 ) < 66 ) { + /* logerror( "thom_diskimage_close_sap: write error\n" ); */ + return; + } + + for ( track = 0; track < f->tracks; track++ ) + for ( sector = 1; sector <= 16; sector++ ) { + /* sector header & data */ + buf[0] = ( f->tracks == 80 ) ? 2 : 1; + buf[1] = 0; + buf[2] = track; + buf[3] = sector; + memcpy( buf + 4, + thom_get_sector( f, 0, track, sector), f->sector_size ); + + /* compute crc */ + crc = thom_sap_crc( buf, f->sector_size + 4 ); + buf[ f->sector_size + 4 ] = crc >> 8; + buf[ f->sector_size + 5 ] = crc & 0xff; + + /* crypt */ + for ( i = 0; i < f->sector_size; i++ ) buf[ i + 4 ] ^= sap_magic_num; + + /* save */ + if ( stream_write( f->stream, buf, f->sector_size + 6 ) < + f->sector_size + 6 ) { + /* logerror( "thom_diskimage_close_sap: write error\n" ); */ + return; + } + } + } + + stream_close( f->stream ); +} + + +/*********************** low-level functions *********************/ + +static UINT8* thom_get_sector(thom_floppy* f, unsigned head, + unsigned track, unsigned sector) +{ + assert( head < f->heads); + assert( track < f->tracks ); + assert( sector > 0 && sector <= 16 ); + return & f->data[ ( (head * f->tracks + track) * 16 + (sector-1) ) * + f->sector_size ]; +} + +static int thom_nb_blocks(thom_floppy* f) +{ + int n1 = f->tracks * 2; /* 2 blocks per track */ + int n2 = f->sector_size - 1; /* FAT entries */ + return (n1 < n2) ? n1 : n2; +} + +static int thom_max_dirent(thom_floppy* f) +{ + return 14 * f->sector_size / 32; +} + +/* remove trailing spaces */ +static void thom_stringify(char* str) +{ + char* s = str + strlen(str) - 1; + while ( s >= str && *s == ' ' ) { *s = 0; s--; } + for ( s = str; *s; s++ ) + if ( (UINT8)*s == 0xff ) *s = 0; + else if ( *s < ' ' || *s >= 127 ) *s = '?'; +} + +/* pad with spaces until the length is nb */ +static void thom_unstringity(char* str, int nb) +{ + char* s = str; + while ( s < str + nb && *s ) s++; + while ( s < str + nb ) { *s = ' '; s++; } +} + +/* get filename and extension & truncate them to 8 + 3 */ +static void thom_conv_filename(const char* s, char name[9], char ext[4]) +{ + int i; + memset( name, 0, 9 ); + memset( ext, 0, 4 ); + for ( i = 0; i < 8 && *s && *s != '.'; i++, s++ ) name[i] = *s; + while ( *s && *s != '.' ) s++; + if ( *s == '.' ) { + s++; + for ( i = 0; i < 3 && *s; i++, s++ ) ext[i] = *s; + } +} + +static time_t thom_crack_time(thom_dirent* d) +{ + struct tm t; + time_t now; + + /* check */ + if ( d->day < 1 || d->day > 31 || d->month < 1 || d->month > 12 ) return 0; + + /* converts */ + time( &now ); + t = *localtime( &now ); + t.tm_sec = 0; + t.tm_min = 0; + t.tm_hour = 0; + t.tm_mday = d->day; + t.tm_mon = d->month - 1; + t.tm_year = (d->year < 65 ) ? d->year + 100 : d->year; + return mktime(&t); +} + +static void thom_make_time(thom_dirent* d, time_t time) +{ + if ( ! time ) { + d->day = d->month = d->year = 0; + } + else { + struct tm t = *localtime( &time ); + d->day = t.tm_mday; + d->month = t.tm_mon + 1; + d->year = t.tm_year % 100; + } +} + +static void thom_make_time_now(thom_dirent* d) +{ + time_t now; + time( &now ); + thom_make_time( d, now ); +} + +static void thom_get_dirent(thom_floppy* f, unsigned head, + unsigned n, thom_dirent* d) +{ + UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32; + memset( d, 0, sizeof(*d) ); + d->index = n; + if ( n >= thom_max_dirent( f ) ) + d->type = THOM_DIRENT_END; + else if ( *base == 0xff ) + d->type = THOM_DIRENT_END; + else if ( *base == 0 ) + d->type = THOM_DIRENT_FREE; + else { + int i; + /* fill regular entry */ + d->type = THOM_DIRENT_FILE; + memcpy( d->name, base, 8 ); + memcpy( d->ext, base + 8, 3 ); + memcpy( d->comment, base + 16, 8 ); + thom_stringify( d->name ); + thom_stringify( d->ext ); + thom_stringify( d->comment ); + d->ftype = base[11]; + d->format = base[12]; + d->firstblock = base[13]; + d->lastsectsize = ((int)base[14] << 8) + base[15]; + d->day = base[24]; + d->month = base[25]; + d->year = base[26]; + /* sanity check */ + for ( i = 0; i < 11; i++ ) + if ( base[i] < ' ' || base[i] > 127 ) d->type = THOM_DIRENT_INVALID; + } +} + +static void thom_set_dirent(thom_floppy* f, unsigned head, + unsigned n, thom_dirent* d) +{ + UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32; + if ( n >= thom_max_dirent( f ) ) return; + memset( base, 0, 32 ); + if ( d->type == THOM_DIRENT_END ) base[ 0 ] = 0xff; + else if ( d->type == THOM_DIRENT_FREE ) base[ 0 ] = 0; + else { + memcpy( base, d->name, 8 ); + memcpy( base + 8, d->ext, 3 ); + memcpy( base + 16, d->comment, 8 ); + thom_unstringity( (char*)base, 8 ); + thom_unstringity( (char*)base + 8, 3 ); + if ( base[16] ) thom_unstringity( (char*)base + 16, 8 ); + base[11] = d->ftype; + base[12] = d->format; + base[13] = d->firstblock; + base[14] = d->lastsectsize >> 8; + base[15] = d->lastsectsize & 0xff; + base[24] = d->day; + base[25] = d->month; + base[26] = d->year; + } + f->modified = 1; +} + +/* returns 1 if file found, 0 if not */ +static int thom_find_dirent(thom_floppy* f, unsigned head, + const char* name, thom_dirent* d) +{ + int n = 0; + while ( 1 ) { + thom_get_dirent( f, head, n, d ); + if ( d->type == THOM_DIRENT_END ) return 0; + if ( d->type == THOM_DIRENT_FILE ) { + char buf[13]; + sprintf( buf, "%s.%s", d->name, d->ext ); + if ( ! strcmp( buf, name ) ) return 1; + } + n++; + } +} + +/* returns 1 if free entry found, 0 if none available */ +static int thom_find_free_dirent(thom_floppy* f, unsigned head, thom_dirent* d) +{ + int n = 0; + while ( 1 ) { + thom_get_dirent( f, head, n, d ); + if ( d->type == THOM_DIRENT_FREE ) return 1; + if ( d->type == THOM_DIRENT_END ) break; + n++; + } + if ( n + 1 >= thom_max_dirent( f ) ) return 0; + thom_set_dirent( f, head, n+1, d ); + d->type = THOM_DIRENT_FREE; + return 1; +} + +/* returns the file size in bytes, or -1 if error */ +static int thom_get_file_size(thom_floppy* f, unsigned head, thom_dirent* d) +{ + UINT8* fat = thom_get_sector( f, head, 20, 2 ); + int nbblocks = thom_nb_blocks(f); + int block = d->firstblock; + int size = 0; + int timeout = nbblocks; + if ( d->type != THOM_DIRENT_FILE ) return -1; + if ( block >= nbblocks ) return -1; + block = fat[ block + 1 ]; + while ( 1 ) { + if ( block < nbblocks ) { + /* full block */ + size += 8 * f->sectuse_size; + block = fat[ block + 1 ]; + } + else if ( block >= 0xc1 && block <= 0xc8 ) { + /* last block in file */ + size += (block-0xc1) * f->sectuse_size; + size += d->lastsectsize; + return size; + } + else return -1; + timeout--; + if ( timeout < 0 ) return -1; + } +} + +/* number of blocks used by file */ +static int thom_get_file_blocks(thom_floppy* f, unsigned head, thom_dirent* d) +{ + UINT8* fat = thom_get_sector( f, head, 20, 2 ); + int nbblocks = thom_nb_blocks(f); + int block = d->firstblock; + int nb = 0; + if ( d->type != THOM_DIRENT_FILE ) return 0; + if ( block >= nbblocks ) return 0; + block = fat[ block + 1 ]; + while ( 1 ) { + if ( block < nbblocks ) { + /* full block */ + nb++; + block = fat[ block + 1 ]; + } + else if ( block >= 0xc1 && block <= 0xc8 ) { + /* last block in file */ + nb++; + return nb; + } + else return nb; + } +} + +/* number of free blocks */ +static int thom_get_free_blocks(thom_floppy* f, unsigned head) +{ + UINT8* fat = thom_get_sector( f, head, 20, 2 ); + int nbblocks = thom_nb_blocks(f); + int i, nb = 0; + for ( i = 1; i <= nbblocks; i++ ) + if ( fat[i] == 0xff ) nb++; + return nb; +} + +/* dump file contents into dst */ +static void thom_get_file(thom_floppy* f, unsigned head, + thom_dirent* d, imgtool_stream *dst) +{ + UINT8* fat = thom_get_sector( f, head, 20, 2 ); + int nbblocks = thom_nb_blocks(f); + int block = d->firstblock; + if ( block >= nbblocks ) return; + while ( 1 ) { + int nextblock = fat[ block + 1 ]; + int track = block / 2; + int firstsect = (block % 2) ? 9 : 1; + if ( nextblock < nbblocks ) { + /* full block */ + int i; + for ( i = 0; i < 8; i++ ) { + UINT8* data = thom_get_sector( f, head, track, firstsect + i ); + stream_write( dst, data, f->sectuse_size ); + } + block = fat[ block + 1 ]; + } + else if ( nextblock >= 0xc1 && nextblock <= 0xc8 ) { + /* last block in file */ + int i; + UINT8* data; + for ( i = 0; i < nextblock - 0xc1; i++ ) { + data = thom_get_sector( f, head, track, firstsect + i ); + stream_write( dst, data, f->sectuse_size ); + } + data = thom_get_sector( f, head, track, firstsect + i ); + stream_write( dst, data, d->lastsectsize ); + return; + } + else { + /* invalid, assume last block */ + UINT8* data = thom_get_sector( f, head, track, firstsect ); + stream_write( dst, data, d->lastsectsize ); + return; + } + block = nextblock; + } +} + +static void thom_del_file(thom_floppy* f, unsigned head, thom_dirent* d) +{ + UINT8* fat = thom_get_sector( f, head, 20, 2 ); + int nbblocks = thom_nb_blocks(f); + int block = d->firstblock; + if ( d->type != THOM_DIRENT_FILE ) return; + if ( block >= nbblocks ) return; + while ( 1 ) { + int nextblock = fat[ block + 1 ]; + fat[ block ] = 0xff; + if ( nextblock < nbblocks ) block = fat[ block + 1 ]; + else break; + } + d->type = THOM_DIRENT_FREE; + thom_set_dirent( f, head, d->index, d ); + f->modified = 1; +} + +/* create a new file or overwrite an old one, with the contents of src */ +static void thom_put_file(thom_floppy* f, unsigned head, + thom_dirent* d, imgtool_stream *src) +{ + int size = stream_size( src ); + UINT8* fat = thom_get_sector( f, head, 20, 2 ); + int nbblocks = thom_nb_blocks(f); + int block; + + /* find first free block */ + for ( block = 0; block < nbblocks && fat[ block + 1 ] != 0xff; block++ ); + if ( block >= nbblocks ) return; + d->firstblock = block; + + /* store file */ + while (1) { + int track = block / 2; + int firstsect = (block % 2) ? 9 : 1; + int i; + + /* store data, full sectors */ + for ( i = 0; i < 8 && size > f->sectuse_size; i++ ) { + UINT8* dst = thom_get_sector( f, head, track, firstsect + i ); + stream_read( src, dst, f->sectuse_size ); + size -= f->sectuse_size; + } + + /* store data, last sector */ + if ( i < 8 ) { + UINT8* dst = thom_get_sector( f, head, track, firstsect + i ); + stream_read( src, dst, size ); + fat[ block + 1 ] = 0xc1 + i; + d->lastsectsize = size; + break; + } + + /* find next free block & update fat */ + i = block; + for ( block++; block < nbblocks && fat[ block + 1 ] != 0xff; block++ ); + if ( block >= nbblocks ) { + /* out of memory! */ + fat[ i + 1 ] = 0; + d->lastsectsize = 0; + break; + } + fat[ i + 1 ] = block; + } + + d->type = THOM_DIRENT_FILE; + thom_set_dirent( f, head, d->index, d ); + f->modified = 1; +} + + +/********************** module functions ***********************/ + +static imgtoolerr_t thom_get_sector_size(imgtool_image* img, UINT32 track, + UINT32 head, UINT32 sector, + UINT32 *sector_size) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + + if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) { + if ( sector_size ) *sector_size = 0; + return IMGTOOLERR_SEEKERROR; + } + if ( sector_size ) *sector_size = f->sector_size; + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_get_geometry(imgtool_image* img, UINT32* tracks, + UINT32* heads, UINT32* sectors) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + if ( tracks ) *tracks = f->tracks; + if ( heads ) *heads = f->heads; + if ( sectors ) *sectors = 16; + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_read_sector(imgtool_image* img, UINT32 track, + UINT32 head, UINT32 sector, void *buf, + size_t len) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) + return IMGTOOLERR_SEEKERROR; + if ( len > f->sector_size) return IMGTOOLERR_READERROR; + memcpy( buf, thom_get_sector( f, head, track, sector ), len ); + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_write_sector(imgtool_image *img, UINT32 track, + UINT32 head, UINT32 sector, + const void *buf, size_t len, int ddam) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR; + if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) + return IMGTOOLERR_SEEKERROR; + if ( len > f->sector_size) return IMGTOOLERR_WRITEERROR; + f->modified = 1; + memcpy( thom_get_sector( f, head, track, sector ), buf, len ); + return IMGTOOLERR_SUCCESS; +} + +/* returns floopy name */ +/* actually, each side has its own name, but we only return the one on side 0. + */ +static void thom_info(imgtool_image *img, char *string, size_t len) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + UINT8* base = thom_get_sector( f, 0, 20, 1 ); + char buf[9]; + memcpy( buf, base, 8 ); + buf[8] = 0; + thom_stringify( buf ); + strncpy( string, buf, len ); +} + +/* each side of a floppy has its own filesystem, we treat them as'partitions' + */ +static imgtoolerr_t thom_list_partitions(imgtool_image *img, + imgtool_partition_info *partitions, + size_t len) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + if ( len >= 1 ) { + partitions[0].get_info = thom_basic_get_info; + partitions[0].base_block = 0; + partitions[0].block_count = 1; + } + if ( len >= 2 && f->heads >= 2 ) { + partitions[1].get_info = thom_basic_get_info; + partitions[1].base_block = 1; + partitions[1].block_count = 1; + } + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_open_partition(imgtool_partition *part, + UINT64 first_block, UINT64 block_count) +{ + imgtool_image* img = imgtool_partition_image( part ); + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + if ( first_block >= f->heads ) + return IMGTOOLERR_INVALIDPARTITION; + * ( (int*) imgtool_partition_extra_bytes( part ) ) = first_block; + return IMGTOOLERR_SUCCESS; +} + + +static imgtoolerr_t thom_begin_enum(imgtool_directory *enumeration, + const char *path) +{ + int* n = (int*) imgtool_directory_extrabytes( enumeration ); + *n = 0; + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration, + imgtool_dirent *ent) +{ + imgtool_partition *part = imgtool_directory_partition( enumeration); + int head = *( (int*) imgtool_partition_extra_bytes( part ) ); + imgtool_image* img = imgtool_partition_image( part ); + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + int* n = (int*) imgtool_directory_extrabytes( enumeration ); + thom_dirent d; + + do { + thom_get_dirent( f, head, *n, &d ); + (*n) ++; + } + while ( d.type == THOM_DIRENT_FREE ); + if ( d.type == THOM_DIRENT_END ) ent->eof = 1; + else if ( d.type == THOM_DIRENT_INVALID ) { + ent->corrupt = 1; + } + else { + int size; + snprintf( ent->filename, sizeof(ent->filename), "%s.%s", d.name, d.ext ); + snprintf( ent->attr, sizeof(ent->attr), "%c %c %s", + (d.ftype == 0) ? 'B' : (d.ftype == 1) ? 'D' : + (d.ftype == 2) ? 'M' : (d.ftype == 3) ? 'A' : '?', + (d.format == 0) ? 'B' : (d.format == 0xff) ? 'A' : '?', + d.comment ); + ent->creation_time = thom_crack_time( &d ); + size = thom_get_file_size( f, head, &d ); + if ( size >= 0 ) ent->filesize = size; + else { + ent->filesize = 0; + ent->corrupt = 1; + } + } + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_free_space(imgtool_partition *part, UINT64 *size) +{ + int head = *( (int*) imgtool_partition_extra_bytes( part ) ); + imgtool_image* img = imgtool_partition_image( part ); + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + int nb = thom_get_free_blocks( f, head ); + (*size) = nb * f->sectuse_size * 8; + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_read_file(imgtool_partition *part, + const char *filename, + const char *fork, + imgtool_stream *destf) +{ + int head = *( (int*) imgtool_partition_extra_bytes( part ) ); + imgtool_image* img = imgtool_partition_image( part ); + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + thom_dirent d; + char name[9], ext[4], fname[14]; + int size; + + /* convert filename */ + thom_conv_filename( filename, name, ext ); + sprintf( fname, "%s.%s", name, ext ); + + if ( ! thom_find_dirent( f, head, fname, &d ) ) + return IMGTOOLERR_FILENOTFOUND; + size = thom_get_file_size( f, head, &d ); + if ( size < 0 ) return IMGTOOLERR_CORRUPTFILE; + thom_get_file( f, head, &d, destf ); + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_delete_file(imgtool_partition *part, + const char *filename) +{ + int head = *( (int*) imgtool_partition_extra_bytes( part ) ); + imgtool_image* img = imgtool_partition_image( part ); + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + thom_dirent d; + char name[9], ext[4], fname[14]; + + /* convert filename */ + thom_conv_filename( filename, name, ext ); + sprintf( fname, "%s.%s", name, ext ); + + if ( ! thom_find_dirent( f, head, fname, &d ) ) + return IMGTOOLERR_FILENOTFOUND; + /*if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE;*/ + if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR; + thom_del_file( f, head, &d ); + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_write_file(imgtool_partition *part, + const char *filename, + const char *fork, + imgtool_stream *sourcef, + option_resolution *opts) +{ + int head = *( (int*) imgtool_partition_extra_bytes( part ) ); + imgtool_image* img = imgtool_partition_image( part ); + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + thom_dirent d; + int size = stream_size( sourcef ); + int blocks = thom_get_free_blocks( f, head ); + char name[9], ext[4], fname[14]; + const char* comment; + int is_new = 1; + + if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR; + + /* convert filename */ + thom_conv_filename( filename, name, ext ); + sprintf( fname, "%s.%s", name, ext ); + + /* check available space & find dir entry */ + if ( thom_find_dirent( f, head, fname, &d ) ) { + /* file already exists: delete it */ + if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE; + blocks += thom_get_file_blocks( f, head, &d ); + if ( blocks * 8 * f->sectuse_size < size ) return IMGTOOLERR_NOSPACE; + thom_del_file( f, head, &d ); + is_new = 0; + } + else { + /* new file, need new dir entry */ + if ( blocks * 8 * f->sectuse_size < size ) return IMGTOOLERR_NOSPACE; + if ( ! thom_find_free_dirent( f, head, &d ) ) return IMGTOOLERR_NOSPACE; + thom_make_time_now( &d ); + } + + /* fill-in dir entry */ + memcpy( d.name, name, 9 ); + memcpy( d.ext, ext, 4 ); + + /* file type */ + switch ( option_resolution_lookup_int( opts, 'T' ) ) { + case 0: + if ( ! is_new ) break; + if ( ! core_stricmp( ext, "BAS" ) ) d.ftype = 0; + else if ( ! core_stricmp( ext, "BAT" ) ) d.ftype = 0; + else if ( ! core_stricmp( ext, "DAT" ) ) d.ftype = 1; + else if ( ! core_stricmp( ext, "ASC" ) ) d.ftype = 1; + else if ( ! core_stricmp( ext, "BIN" ) ) d.ftype = 2; + else if ( ! core_stricmp( ext, "MAP" ) ) d.ftype = 2; + else if ( ! core_stricmp( ext, "CFG" ) ) d.ftype = 2; + else if ( ! core_stricmp( ext, "ASM" ) ) d.ftype = 3; + else d.ftype = 2; + break; + case 1: d.ftype = 0; break; + case 2: d.ftype = 1; break; + case 3: d.ftype = 2; break; + case 4: d.ftype = 3; break; + } + + /* format flag */ + switch ( option_resolution_lookup_int( opts, 'F' ) ) { + case 0: + if ( ! is_new ) break; + if ( ! core_stricmp( ext, "DAT" ) ) d.format = 0xff; + else if ( ! core_stricmp( ext, "ASC" ) ) d.format = 0xff; + else if ( ! core_stricmp( ext, "ASM" ) ) d.format = 0xff; + else d.format = 0; + break; + case 1: d.format = 0; break; + case 2: d.format = 0xff; break; + } + + /* comment */ + comment = option_resolution_lookup_string( opts, 'C' ); + if ( comment && *comment ) + strncpy( d.comment, comment, 8 ); + + /* write file */ + thom_put_file( f, head, &d, sourcef ); + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_suggest_transfer(imgtool_partition *part, + const char *fname, + imgtool_transfer_suggestion *suggestions, + size_t suggestions_length) +{ + int head = *( (int*) imgtool_partition_extra_bytes( part ) ); + imgtool_image* img = imgtool_partition_image( part ); + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + thom_dirent d; + int is_basic = 0; + + if ( suggestions_length < 1 ) return IMGTOOLERR_SUCCESS; + + if ( fname ) { + if ( ! thom_find_dirent( f, head, fname, &d ) ) + return IMGTOOLERR_FILENOTFOUND; + if ( d.ftype == 0 && d.format == 0 ) is_basic = 1; + } + + if ( is_basic ) { + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = filter_thombas128_getinfo; + if ( suggestions_length >= 2 ) { + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = filter_thombas7_getinfo; + } + if ( suggestions_length >= 3 ) { + suggestions[2].viability = SUGGESTION_POSSIBLE; + suggestions[2].filter = filter_thombas5_getinfo; + } + if ( suggestions_length >= 4 ) { + suggestions[3].viability = SUGGESTION_POSSIBLE; + suggestions[3].filter = NULL; + } + } + else { + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = NULL; + } + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_create(imgtool_image* img, + imgtool_stream *stream, + option_resolution *opts) +{ + thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); + int i; + UINT8* buf; + const char* name; + + f->stream = stream; + f->modified = 0; + + /* get parameters */ + f->heads = option_resolution_lookup_int( opts, 'H' ); + f->tracks = option_resolution_lookup_int( opts, 'T' ); + name = option_resolution_lookup_string( opts, 'N' ); + switch ( option_resolution_lookup_int( opts, 'D' ) ) { + case 0: f->sector_size = 128; f->sectuse_size = 128; break; + case 1: f->sector_size = 256; f->sectuse_size = 255; break; + default: return IMGTOOLERR_PARAMCORRUPT; + } + + /* sanity checks */ + switch ( f->tracks ) { + case 25: if ( f->sector_size != 128 ) return IMGTOOLERR_PARAMCORRUPT; break; + case 40: break; + case 80: if ( f->sector_size != 256 ) return IMGTOOLERR_PARAMCORRUPT; break; + default: return IMGTOOLERR_PARAMCORRUPT; + } + + memset( f->data, 0xe5, sizeof( f->data ) ); + + for ( i = 0; i < f->heads; i++ ) { + /* disk info */ + buf = thom_get_sector( f, i, 20, 1 ); + memset( buf, 0xff, f->sector_size ); + if ( name ) { + strncpy( (char*)buf, name, 8 ); + thom_unstringity( (char*)buf, 8 ); + } + else memset( buf, ' ', 8 ); + + /* FAT */ + buf = thom_get_sector( f, i, 20, 2 ); + memset( buf, 0, f->sector_size ); + memset( buf + 1, 0xff, thom_nb_blocks( f ) ); + buf[ 41 ] = buf[ 42 ] = 0xfe; /* reserved for FAT */ + + /* (empty) directory */ + buf = thom_get_sector( f, i, 20, 3 ); + memset( buf, 0xff, 14 * f->sector_size ); + } + + f->modified = 1; + + return IMGTOOLERR_SUCCESS; +} + + +/****************** BASIC tokenization *********************/ + +/* character codes >= 128 are reserved for BASIC keywords */ + +static const char *const thombas7[2][128] = { + { /* statements */ + "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF", + "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", + "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO", + "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", + "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT", + "CONT", "LIST", "CLEAR", "WHILE", "WHEN", "NEW", "SAVE", "LOAD", "MERGE", + "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", + "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", + "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", + ">", "=", "<", + /* DOS specific */ + "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", + "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", + "BACKUP", "COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "DENSITY", + }, + { /* functions: 0xff prefix */ + "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN", + "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", "CSNG", + "CDBL", "FIX", "HEX$", "OCT$", "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$", + "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT", + "SCREEN", "POS", "PTRIG", + /* DOS specific */ + "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF", + "SPACE$", "STRING$", "DSKI$", + } +}; + +/* MO5: some keywords ar missing; DOS and TUNE are added */ +static const char *const thombas5[2][128] = { + { /* statements */ + "END", "FOR", "NEXT", "DATA", "DIM", "READ", NULL, "GO", "RUN", "IF", + "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", + "DEFINT", "DEFSNG", NULL, "ON", "TUNE", "ERROR", "RESUME", "AUTO", + "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", + "BEEP", "COLOR", "LINE", "BOX", NULL, "ATTRB", "DEF", "POKE", "PRINT", + "CONT", "LIST", "CLEAR", "DOS", NULL, "NEW", "SAVE", "LOAD", "MERGE", + "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", + "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", + "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", + ">", "=", "<", + /* DOS specific */ + "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", + "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", + "BACKUP","COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "SEARCH", + "DENSITY", + }, + { /* functions: 0xff prefix */ + "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN", + "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", NULL, + NULL, "FIX", "HEX$", NULL, "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$", + "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT", + "SCREEN", "POS", "PTRIG", + /* DOS specific */ + "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF", + "SPACE$", "STRING$", "DSKI$", + } +}; + +/* BASIC 128 has many new keywords */ +/* DENSITY is missing on BASIC 512 & BASIC 128 for MO6 but, otherwise, they + have the same tokens +*/ +static const char *const thombas128[2][128] = { + { /* statements */ + "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF", + "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", + "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO", + "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", + "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT", + "CONT", "LIST", "CLEAR", "INTERVAL", "KEY", "NEW", "SAVE", "LOAD", "MERGE", + "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", + "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", + "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", + ">", "=", "<", + "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", + "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", + "BACKUP", "COPY", "CIRCLE", "PAINT", "RESET", "RENUM", "SWAP", "DENSITY", + "WINDOW", "PATTERN", "DO", "LOOP", "EXIT", "INMOUSE", "MOUSE", "CHAINE", + "COMMON", "SEARCH", "FWD", "TURTLE", + }, + { /* functions: 0xff prefix */ + "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN", + "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", "CSNG", + "CDBL", "FIX", "HEX$", "OCT$", "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$", + "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT", + "SCREEN", "POS", "PTRIG", + "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF", + "SPACE$", "STRING$", "DSKI$", + "FKEY$", "MIN(", "MAX(", "ATN", "CRUNCH$", "MTRIG", "EVAL", "PALETTE", + "BANK", "HEAD", "ROT", "SHOW", "ZOOM", "TRACE", + } +}; + +/* tables for simple XOR encryption sieve */ +static const UINT8 crypt1[11] = { + 0x80, 0x19, 0x56, 0xAA, 0x80, 0x76, 0x22, 0xF1, 0x82, 0x38, 0xAA +}; + +static const UINT8 crypt2[13] = { + 0x86, 0x1E, 0xD7, 0xBA, 0x87, 0x99, 0x26, 0x64, 0x87, 0x23, 0x34, 0x58, 0x86 +}; + +/* decrypt BASIC protected files */ +static void thom_decrypt(imgtool_stream* out, imgtool_stream* in) +{ + int i1 = 11, i2 = 13; + while ( 1 ) { + UINT8 b; + if ( stream_read( in, &b, 1) < 1 ) break; + b = ( (UINT8)(b - i2) ^ crypt2[i2-1] ^ crypt1[i1-1] ) + i1; + stream_putc( out, b ); + i1--; i2--; + if ( !i1 ) i1 = 11; + if ( !i2 ) i2 = 13; + } +} + +/* encrypt BASIC protected files */ +static void thom_encrypt(imgtool_stream* out, imgtool_stream* in) +{ + int i1 = 11, i2 = 13; + while ( 1 ) { + UINT8 b; + if ( stream_read( in, &b, 1) < 1 ) break; + b = ( (UINT8)(b - i1) ^ crypt2[i2-1] ^ crypt1[i1-1] ) + i2; + stream_putc( out, b ); + i1--; i2--; + if ( !i1 ) i1 = 11; + if ( !i2 ) i2 = 13; + } +} + +static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part, + const char *name, + const char *fork, imgtool_stream *dst) +{ + UINT8 buf[3]; + imgtool_stream *org = stream_open_mem( NULL, 0 ); + imgtoolerr_t err; + if ( !org ) return IMGTOOLERR_OUTOFMEMORY; + + /* read file */ + err = thom_read_file( part, name, fork, org ); + if ( err ) { + stream_close( org ); + return err; + } + + stream_seek( org, 0, SEEK_SET ); + if ( stream_read( org, buf, 3 ) < 3 || buf[0] != 0xfe ) { + /* regular file */ + stream_seek( org, 0, SEEK_SET ); + stream_transfer_all( dst, org ); + } + else { + /* encrypted file */ + stream_putc( dst, '\xff' ); + stream_write( dst, buf+1, 2 ); + thom_decrypt( dst, org ); + } + + stream_close( org ); + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thomcrypt_write_file(imgtool_partition *part, + const char *name, + const char *fork, imgtool_stream *src, + option_resolution *opts) +{ + UINT8 buf[3]; + + if ( stream_read( src, buf, 3 ) < 3 || buf[0] == 0xfe ) { + /* too short or already encrypted file */ + stream_seek( src, 0, SEEK_SET ); + return thom_write_file( part, name, fork, src, opts ); + } + else { + /* regular file */ + imgtool_stream *dst = stream_open_mem( NULL, 0 ); + imgtoolerr_t err; + if ( !dst ) return IMGTOOLERR_OUTOFMEMORY; + stream_putc( dst, '\xfe' ); + stream_write( dst, buf+1, 2 ); + thom_encrypt( dst, src ); + stream_seek( dst, 0, SEEK_SET ); + err = thom_write_file( part, name, fork, dst, opts ); + stream_close( dst); + return err; + } +} + +void filter_thomcrypt_getinfo(UINT32 state, union filterinfo *info) +{ + switch(state) { + case FILTINFO_STR_NAME: + info->s = "thomcrypt"; + break; + case FILTINFO_STR_HUMANNAME: + info->s = "Thomson BASIC, Protected file encryption (no tokenization)"; + break; + case FILTINFO_PTR_READFILE: + info->read_file = thomcrypt_read_file; + break; + case FILTINFO_PTR_WRITEFILE: + info->write_file = thomcrypt_write_file; + break; + } +} + +/* untokenization automatically decrypt protected files */ +static imgtoolerr_t thom_basic_read_file(imgtool_partition *part, + const char *name, + const char *fork, + imgtool_stream *dst, + const char *const table[2][128]) +{ + imgtool_stream *org = stream_open_mem( NULL, 0 ); + imgtoolerr_t err; + UINT8 buf[4]; + int i; + + if ( !org ) return IMGTOOLERR_OUTOFMEMORY; + + err = thomcrypt_read_file( part, name, fork, org ); + if ( err ) { + stream_close( org ); + return err; + } + stream_seek( org, 3, SEEK_SET ); /* skip header */ + + while ( 1 ) { + int in_str = 0, in_fun = 0; + int linelength, linenum; + + /* line header: line length and line number */ + /* I am not sure this is 100% correct but it works in many cases */ + if ( stream_read( org, buf, 2 ) < 2 ) goto end; + linelength = ((int)buf[0] << 8) + (int)buf[1] - 4; + if ( linelength <= 0 ) goto end; + if ( stream_read( org, buf, 2 ) < 2 ) goto end; + linenum = ((int)buf[0] << 8) + buf[1]; + stream_printf( dst, "%u ", linenum ); + + /* process line */ + for ( i = 0; i < linelength; i++ ) { + UINT8 c; + if ( stream_read( org, &c, 1 ) < 1 ) break; + if ( c == 0 ) { + /* Sometimes, linelength seems wrong and we must rely on the fact that + BASIC lines are 0-terminated. + At other times, there are 0 embedded within lines or extra stuff + between the 0 and the following line, and so, we must rely + on linelength to cut the line (!) + */ + if ( linelength > 256 ) break; + } + else if ( c == 0xff && ! in_str ) in_fun = 1; /* function prefix */ + else { + if ( c >= 0x80 && ! in_str ) { + /* token */ + const char* token = table[ in_fun ][ c - 0x80 ]; + if ( token ) stream_puts( dst, token ); + else stream_puts( dst, "???" ); + } + else { + /* regular character */ + if ( c == '"' ) in_str = 1 - in_str; + stream_putc( dst, c ); /* normal letter */ + } + in_fun = 0; + } + } + stream_putc( dst, '\n' ); + } + end: + + stream_close( org ); + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t thom_basic_write_file(imgtool_partition *part, + const char *name, + const char *fork, + imgtool_stream *src, + option_resolution *opts, + const char *const table[2][128]) +{ + return IMGTOOLERR_UNIMPLEMENTED; +} + + +#define FILTER(short,long) \ + static imgtoolerr_t short##_read_file(imgtool_partition *part, \ + const char *name, \ + const char *fork, \ + imgtool_stream *dst) \ + { \ + return thom_basic_read_file( part, name, fork, dst, short ); \ + } \ + static imgtoolerr_t short##_write_file(imgtool_partition *part, \ + const char *name, \ + const char *fork, \ + imgtool_stream *src, \ + option_resolution *opts) \ + { \ + return thom_basic_write_file( part, name, fork, src, opts, short ); \ + } \ + void filter_##short##_getinfo(UINT32 state, union filterinfo *info) \ + { \ + switch(state) \ + { \ + case FILTINFO_STR_NAME: \ + info->s = #short; \ + break; \ + case FILTINFO_STR_HUMANNAME: \ + info->s = long; \ + break; \ + case FILTINFO_PTR_READFILE: \ + info->read_file = short##_read_file; \ + break; \ + case FILTINFO_PTR_WRITEFILE: \ + info->write_file = short##_write_file; \ + break; \ + } \ + } + +FILTER( thombas5, + "Thomson MO5 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" ) +FILTER( thombas7, + "Thomson TO7 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" ) +FILTER( thombas128, + "Thomson w/ BASIC 128/512, Tokenized Files (read-only, auto-decrypt)" ) + + +/************************* driver ***************************/ + +static OPTION_GUIDE_START( thom_createimage_optguide ) + OPTION_INT( 'H', "heads", "Heads" ) + OPTION_INT( 'T', "tracks", "Tracks" ) + OPTION_ENUM_START( 'D', "density", "Density" ) + OPTION_ENUM( 0, "SD", "Single density (128 bytes)" ) + OPTION_ENUM( 1, "DD", "Double density (256 bytes)" ) + OPTION_ENUM_END + OPTION_STRING( 'N', "name", "Floppy name" ) +OPTION_GUIDE_END + +static OPTION_GUIDE_START( thom_writefile_optguide ) + OPTION_ENUM_START( 'T', "ftype", "File type" ) + OPTION_ENUM( 0, "auto", "Automatic (by extension)" ) + OPTION_ENUM( 1, "B", "Program" ) + OPTION_ENUM( 2, "D", "Data" ) + OPTION_ENUM( 3, "M", "Machine Code" ) + OPTION_ENUM( 4, "A", "Assembler Source" ) + OPTION_ENUM_END + OPTION_ENUM_START( 'F', "format", "Format flag" ) + OPTION_ENUM( 0, "auto", "Automatic (by extension)" ) + OPTION_ENUM( 1, "B", "Binary, Tokenized BASIC" ) + OPTION_ENUM( 2, "A", "ASCII" ) + OPTION_ENUM_END + OPTION_STRING( 'C', "comment", "Comment" ) +OPTION_GUIDE_END + +static void thom_basic_get_info(const imgtool_class *clas, + UINT32 param, + union imgtoolinfo *info) +{ + switch ( param ) { + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: + info->i = sizeof(thom_floppy); break; + case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES: + info->i = sizeof(int); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: + info->i = sizeof(int); break; + case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: + case IMGTOOLINFO_INT_PREFER_UCASE: + info->i = 1; break; + case IMGTOOLINFO_INT_PATH_SEPARATOR: + info->i = 0; break; + case IMGTOOLINFO_STR_FILE: + strcpy( info->s = imgtool_temp_str(), __FILE__ ); break; + case IMGTOOLINFO_STR_NAME: + strcpy( info->s = imgtool_temp_str(), "thom" ); break; + case IMGTOOLINFO_STR_DESCRIPTION: + strcpy( info->s = imgtool_temp_str(), "Thomson BASIC filesystem" ); + break; + case IMGTOOLINFO_PTR_CREATE: + info->create = thom_create; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: + info->createimage_optguide = thom_createimage_optguide; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: + info->begin_enum = thom_begin_enum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: + info->next_enum = thom_next_enum; break; + case IMGTOOLINFO_PTR_READ_FILE: + info->read_file = thom_read_file; break; + case IMGTOOLINFO_PTR_WRITE_FILE: + info->write_file = thom_write_file; break; + case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: + info->writefile_optguide = thom_writefile_optguide; break; + case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: + strcpy( info->s = imgtool_temp_str(), "T[0]-4;F[0]-2;C" ); break; + case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: + info->suggest_transfer = thom_suggest_transfer; break; + case IMGTOOLINFO_PTR_DELETE_FILE: + info->delete_file = thom_delete_file; break; + case IMGTOOLINFO_PTR_FREE_SPACE: + info->free_space = thom_free_space; break; + case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: + info->get_sector_size = thom_get_sector_size; break; + case IMGTOOLINFO_PTR_GET_GEOMETRY: + info->get_geometry = thom_get_geometry; break; + case IMGTOOLINFO_PTR_INFO: + info->info = thom_info; break; + case IMGTOOLINFO_PTR_READ_SECTOR: + info->read_sector = thom_read_sector; break; + case IMGTOOLINFO_PTR_WRITE_SECTOR: + info->write_sector = thom_write_sector; break; + case IMGTOOLINFO_PTR_LIST_PARTITIONS: + info->list_partitions = thom_list_partitions; break; + case IMGTOOLINFO_PTR_OPEN_PARTITION: + info->open_partition = thom_open_partition; break; + } +} + +void thom_fd_basic_get_info(const imgtool_class *clas, + UINT32 param, + union imgtoolinfo *info) +{ + switch ( param ) { + case IMGTOOLINFO_STR_NAME: + strcpy( info->s = imgtool_temp_str(), "thom_fd" ); break; + case IMGTOOLINFO_STR_DESCRIPTION: + strcpy( info->s = imgtool_temp_str(), + "Thomson .fd disk image, BASIC format" ); + break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: + strcpy( info->s = imgtool_temp_str(), "fd" ); break; + case IMGTOOLINFO_PTR_OPEN: + info->open = thom_open_fd_qd; break; + case IMGTOOLINFO_PTR_CLOSE: + info->close = thom_close_fd_qd; break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: + strcpy( info->s = imgtool_temp_str(), "H[1]-2;T40/[80];D0-[1];N" ); break; + default: + thom_basic_get_info( clas, param, info ); + } +} + +void thom_qd_basic_get_info(const imgtool_class *clas, + UINT32 param, + union imgtoolinfo *info) +{ + switch ( param ) { + case IMGTOOLINFO_STR_NAME: + strcpy( info->s = imgtool_temp_str(), "thom_qd" ); break; + case IMGTOOLINFO_STR_DESCRIPTION: + strcpy( info->s = imgtool_temp_str(), + "Thomson .qd disk image, BASIC format" ); + break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: + strcpy( info->s = imgtool_temp_str(), "qd" ); break; + case IMGTOOLINFO_PTR_OPEN: + info->open = thom_open_fd_qd; break; + case IMGTOOLINFO_PTR_CLOSE: + info->close = thom_close_fd_qd; break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: + strcpy( info->s = imgtool_temp_str(), "H[1]-2;T[25];D[0];N" ); break; + default: + thom_basic_get_info( clas, param, info ); + } +} + +void thom_sap_basic_get_info(const imgtool_class *clas, + UINT32 param, + union imgtoolinfo *info) +{ + switch ( param ) { + case IMGTOOLINFO_STR_NAME: + strcpy( info->s = imgtool_temp_str(), "thom_sap" ); break; + case IMGTOOLINFO_STR_DESCRIPTION: + strcpy( info->s = imgtool_temp_str(), + "Thomson .sap disk image, BASIC format" ); + break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: + strcpy( info->s = imgtool_temp_str(), "sap" ); break; + case IMGTOOLINFO_PTR_OPEN: + info->open = thom_open_sap; break; + case IMGTOOLINFO_PTR_CLOSE: + info->close = thom_close_sap; break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: + strcpy( info->s = imgtool_temp_str(), "H[1];T40/[80];D0-[1];N" ); break; + default: + thom_basic_get_info( clas, param, info ); + } +} diff --git a/src/mame/tools/imgtool/modules/ti99.c b/src/mame/tools/imgtool/modules/ti99.c new file mode 100644 index 00000000000..220cbebdb27 --- /dev/null +++ b/src/mame/tools/imgtool/modules/ti99.c @@ -0,0 +1,5360 @@ +// license:BSD-3-Clause +// copyright-holders:Raphael Nabet +/* + Handlers for ti99 disk images + + We support the following types of image: + * floppy disks ("DSK format") in v9t9, pc99 and old mess image format + * hard disks ("WIN format") in MAME harddisk format (256-byte sectors only, + i.e. no SCSI) + Files are extracted in TIFILES format. There is a compile-time option to + extract text files in flat format instead, but I need to re-implement it + properly (using filters comes to mind). + + Raphael Nabet, 2002-2004 + + TODO: + - finish and test hd support ***test sibling FDR support*** + - check allocation bitmap against corruption when an image is opened +*/ + +#include +#include +#include +#include +#include +#include "imgtool.h" +#include "harddisk.h" +#include "imghd.h" + +/* + Concepts shared by both disk structures: + ---------------------------------------- + + In both formats, the entire disk surface is split into physical records, + each 256-byte-long. For best efficiency, the sector size is usually 256 + bytes so that one sector is equivalent to a physical record (this is true + with floppies and HFDC hard disks). If the sector size is not 256 bytes + (e.g. 512 bytes with SCSI hard disks, possibly 128 bytes on a TI-99 + simulator running on TI-990), sectors are grouped or split to form 256-byte + physical records. Physical records are numbered from 0, with the first + starting on sector 0 track 0. To avoid confusion with physical records in + files, such physical records will be called "absolute physical records", + abbreviated as "absolute physrecs" or "aphysrecs". + + Disk space is allocated in units referred to as AUs. Each AU represents an + integral number of 256-byte physical records. The number of physrecs per + AU varies depending on the disk format and size. AUs are numbered from 0, + with the first starting with absolute physrec 0. + + Absolute physrec 0 contains a 256-byte record with volume information, + which is called "Volume Information Block", abbreviated as "vib". + + To keep track of which areas on the disk are allocated and which are free, + disk managers maintain a bit map of allocated AUs (called "allocation + bitmap", abbreviated as "abm"). Each bit in the allocation bitmap + represents an AU: if a bit is 0, the AU is free; if a bit is 1, the AU is + allocated (or possibly bad if the disk manager can track bad sectors). + Where on the disk the abm is located depends on the disk structure (see + structure-specific description for details). + + Files are implemented as a succession of 256-byte physical records. To + avoid confusion with absolute physical records, these physical records will + be called "file physical records", abbreviated as "file physrecs" or + "fphysrecs". + + Programs do normally not access file physical records directly. They may + call high-level file routines that enable to create either fixed-length + logical records of any size from 1 through 255, or variable-length records + of any size from 0 through 254: logical records are grouped by file + managers into 256-byte physical records. Some disk managers (HFDC and + SCSI) allow programs to create fixed-length records larger than 255 bytes, + too, but few programs use this possibility. Additionally, program files + can be created: program files do not implement any logical record, and can + be seen as a flat byte stream, not unlike files under MSDOS, UNIX and the C + standard library. (Unfortunately, the API for program files lacks + flexibility, and most programs that need to process a flat byte stream + will use fixed-size records of 128 bytes.) + + Fixed-length records (reclen < 256) are grouped like this: + fphysrec 0 fphysrec 1 + _______________ _______________ + |R0 |R1 |R2 |X| |R3 |R4 |R5 |X| + --------------- --------------- + \_/ \_/ + unused unused + (size < reclen) (size < reclen) + + Fixed-length records (reclen > 256) are grouped like this: + fphysrec 0 fphysrec 1 fphysrec 2 fphysrec 3 ... + _________________ _________________ _________________ _________________ + | R0 (#0-255) | | R0 (#256-511) | |R0 (#512-end)|X| | R1 (#0-255) | ... + ----------------- ----------------- ----------------- ----------------- + \_/ + unused + + Variable length records are grouped like this: + fphysrec 0: + byte: + ------------------------------ + 0 |l0 = length of record 0 data| + |----------------------------| + 1 | | + | | + : | record 0 data | + | | + l0 | | + |----------------------------| + l0+1 |l1 = length of record 1 data| + |----------------------------| + l0+2 | | + | | + : | record 1 data | + | | + l0+l1+1 | | + |----------------------------| + : : : + : : : + |----------------------------| + n |lm = length of record m data| + |----------------------------| + n+1 | | + | | + : | record m data | + | | + n+lm | | + |----------------------------| + n+lm+1 |>ff: EOR mark | + |----------------------------| + n+lm+2 | | + | | + : | unused | + : |(we should have size < lm+1)| + | | + 255 | | + ------------------------------ + + fphysrec 1: + byte: + ------------------------------ + 0 |lm+1=length of record 0 data| + |----------------------------| + 1 | | + | | + : | record m+1 data | + | | + lm+1 | | + |----------------------------| + : : : + : : : + + I think the EOR mark is not required if all 256 bytes of a physical + record are used by logical records. + + + All files are associated with a "file descriptor record" ("fdr") that holds + file information (name, format, length) and points to the data AUs. The WIN + disk structure also supports sibling FDRs, in case a file is so fragmented + that all the data pointers cannot fit in one FDR; the DSK disk structure + does not implement any such feature, and you may be unable to append data + to an existing file if it is too fragmented, even though the disk is not + full. + + + DSK disk structure: + ------------------- + + The DSK disk structure is used for floppy disks, and a few RAMDISKs as + well. It supports 1600 AUs and 16 MBytes at most (the 16 MByte value is a + theorical maximum, as I doubt anyone has ever created so big a DSK volume). + + The disk sector size is always 256 bytes (the only potential exceptions are + the SCSI floppy disk units and the TI-99 simulator on TI-990, but I don't + know anything about either). + + For some reason, the number of physrecs per AU is always a power of 2. + Originally, AUs always were one physical record each. However, since the + allocation bitmap cannot support more than 1600 AUs, disks larger than + 400kbytes need to have several physical records per AU. Note that + relatively few disk controllers implement AUs that span multiple physical + records (IIRC, these are Myarc's HFDC, SCSI DSR with floppy disk interface, + and some upgraded Myarc and Corcomp DD floppy controllers). + + The allocation bitmap is located in the VIB. It is 200 bytes long, and + supports 1600 AUs at most. + + Directories are implemented with a "File Descriptor Index Record" (FDIR) + for each directory. The FDIR is array of 0 through 128 words, containing + the aphysrec address of each fdr in the directory, sorted by ascending file + name, terminated with a 0. Note that, while we should be prepared to read + images images with 128 entries, I think (not 100% sure) that we should + write no more than 127 for compatibility with some existing disk managers. + + Originally, the DSK structure only supported one directory level (i.e. the + root directory level). The FDIR record for the root directory is always + located in aphysrec 1. Moreover, Myarc extended the DSK structure to + support up to 3 subdirectories in the root directory (note that there is no + support for more subdirs, or for subdirs located in subdirs). To do so, + they used an unused field of the VIB to hold the 10-char name of each + directory and the aphysrec address of the associated FDIR record. + + aphysrec 0: Volume Information Block (VIB): see below + aphysrec 1: FDIR for root directory + Remaining AUs are used for fdr and data (and subdirectory FDIR if + applicable). There is one FDIR record per directory; the FDIR points to + the FDR for each file in the directory. The FDR (File Descriptor Record) + contains the file information (name, format, length, pointers to data + physrecs/AUs, etc). + + + WIN disk structure: + ------------------- + + The WIN disk structure is used for hard disks. It supports 65535 AUs and + 256 MBytes at most. + + The disk sector size is 256 bytes on HFDC, 512 bytes on SCSI. 512-byte + sectors are split into 256-byte physical records. + + We may have from 1 through 16 physrecs per AUs. Since we cannot have more + than 65535 AUs, we need to have several physical records per AU in disks + larger than 16 Mbytes. + + Contrary to the DSK disk structure, the WIN disk structure supports + hierarchic subdirectories, with a limit of 114 subdirectories and 127 files + per directory. Each directory is associated with both a "Directory + Descriptor Record" (DDR) and a "File Descriptor Index Record" (FDIR). The + only exception is the root directory, which uses the VIB instead of a DDR + (the VIB includes all the important fields of the DDR). The DDR contains + some directory info (name, number of files and subdirectories directly + enclosed in the directory, AU address of the FDIR of the parent directory, + etc), the AU address of the associated FDIR, and the AU address of the DDR + of up to 114 subdirectories, sorted by ascending directory name. The WIN + FDIR is similar to, yet different from, the DSK FDIR: it contains up to 127 + (vs. 128) AU address (vs. aphysrec address) of each fdr in the directory, + sorted by ascending file name. Additionally, it includes the AU address of + the associated DDR. + + When a file has more than 54 data fragments, the disk manager creates + sibling FDRs that hold additional fragments. (Sibling FDRs are called + offspring FDRs in most existing documentation, but I prefer "sibling FDRs" + as "offspring FDRs" wrongly suggests a directory-like hierarchy. + Incidentally, I cannot really figure out why they chose to duplicate the + FDR rather than create a file extension record, but there must be a + reason.) Note that sibling FDRs usually fill unused physrecs in the AU + allocated for the eldest FDR, and a new AU is allocated for new sibling + FDRs only when the first AU is full. + + aphysrec 0: Volume Information Block (VIB): see below + aphysrec 1-n (where n = 1+SUP(number_of_AUs/2048)): Volume bitmap + Remaining AUs are used for ddr, fdir, fdr and data. +*/ + +/* Since string length is encoded with a byte, the maximum length of a string +is 255. Since we need to add a device name (1 char minimum, typically 4 chars) +and a '.' separator, we chose a practical value of 250 (though few applications +will accept paths of such length). */ +#define MAX_PATH_LEN 253 +#define MAX_SAFE_PATH_LEN 250 + +#define MAX_DIR_LEVEL 125 /* We need to put a recursion limit to avoid endless recursion hazard */ + + +#if 0 +#pragma mark MISCELLANEOUS UTILITIES +#endif + +/* + Miscellaneous utilities that are used to handle TI data types +*/ + +struct UINT16BE +{ + UINT8 bytes[2]; +}; + +struct UINT16LE +{ + UINT8 bytes[2]; +}; + +INLINE UINT16 get_UINT16BE(UINT16BE word) +{ + return (word.bytes[0] << 8) | word.bytes[1]; +} + +INLINE void set_UINT16BE(UINT16BE *word, UINT16 data) +{ + word->bytes[0] = (data >> 8) & 0xff; + word->bytes[1] = data & 0xff; +} + +INLINE UINT16 get_UINT16LE(UINT16LE word) +{ + return word.bytes[0] | (word.bytes[1] << 8); +} + +INLINE void set_UINT16LE(UINT16LE *word, UINT16 data) +{ + word->bytes[0] = data & 0xff; + word->bytes[1] = (data >> 8) & 0xff; +} + +/* + Convert a C string to a 10-character file name (padded with spaces if necessary) + + dst (O): destination 10-character array + src (I): source C string +*/ +static void str_to_fname(char dst[10], const char *src) +{ + int i; + + + i = 0; + + /* copy 10 characters at most */ + if (src) + while ((i<10) && (src[i]!='\0')) + { + dst[i] = src[i]; + i++; + } + + /* pad with spaces */ + while (i<10) + { + dst[i] = ' '; + i++; + } +} + +/* + Convert a 10-character file name to a C string (removing trailing spaces if necessary) + + dst (O): destination C string + src (I): source 10-character array + n (I): length of dst buffer (string may be truncated if less than 11) +*/ +static void fname_to_str(char *dst, const char src[10], int n) +{ + int i; + int last_nonspace; + + + /* copy 10 characters at most */ + if (--n > 10) + n = 10; + + /* copy filename */ + i = 0; + last_nonspace = -1; + + while (i MAX_PATH_LEN) || strchr(fpath, ' ')) + return 1; + + /* check that each path element has an acceptable length */ + element_start = fpath; + do + { + /* find next path element */ + element_end = strchr(element_start, '.'); + element_len = element_end ? (element_end - element_start) : strlen(element_start); + if ((element_len > 10) || (element_len == 0)) + return 1; + + /* iterate */ + if (element_end) + element_start = element_end+1; + else + element_start = NULL; + } + while (element_start); + + return 0; +} + +#if 0 +#pragma mark - +#pragma mark LEVEL 1 DISK ROUTINES +#endif + +/* + Level 1 deals with accessing the disk hardware (in our case, the raw disk + image). + + Higher level routines will only know the disk as a succession of + 256-byte-long physical records addressed by a linear address. +*/ + +/* + Disk geometry +*/ +struct ti99_geometry +{ + int secspertrack; + int cylinders; + int heads; +}; + +/* + Physical sector address +*/ +struct ti99_sector_address +{ + int sector; + int cylinder; + int side; +}; + +/* + Time stamp (used in fdr, and WIN VIB/DDR) +*/ +struct ti99_date_time +{ + UINT8 time_MSB, time_LSB;/* 0-4: hour, 5-10: minutes, 11-15: seconds/2 */ + UINT8 date_MSB, date_LSB;/* 0-6: year, 7-10: month, 11-15: day */ +}; + +/* + Subdirectory descriptor (HFDC only) + + The HFDC supports up to 3 subdirectories. +*/ +struct dsk_subdir +{ + char name[10]; /* subdirectory name (10 characters, pad with spaces) */ + UINT16BE fdir_aphysrec; /* aphysrec address of fdir record for this subdirectory */ +}; + +/* + DSK VIB record + + Most fields in this record are only relevant to level 2 routines, but level + 1 routines need the disk geometry information extracted from the VIB. +*/ +struct dsk_vib +{ + char name[10]; /* disk volume name (10 characters, pad with spaces) */ + UINT16BE totphysrecs; /* total number of physrecs on disk (usually 360, */ + /* 720, 640, 1280 or 1440). (TI originally */ + /* said it should be the total number of AUs, */ + /* but, in practice, DSRs that supports disks */ + /* over 400kbytes (e.g. HFDC) write the total */ + /* number of physrecs.) */ + UINT8 secspertrack; /* sectors per track (usually 9 (FM SD), */ + /* 16 or 18 (MFM DD), or 36 (MFM HD) */ + UINT8 id[3]; /* 'DSK' */ + UINT8 protection; /* 'P' if disk is protected, ' ' otherwise. */ + UINT8 cylinders; /* tracks per side (usually 40) */ + UINT8 heads; /* sides (1 or 2) */ + UINT8 density; /* density: 1 (FM SD), 2 (MFM DD), or 3 (MFM HD) */ + dsk_subdir subdir[3]; /* descriptor for up to 3 subdirectories (HFDC only) */ + /* reserved by TI */ + UINT8 abm[200]; /* allocation bitmap: there is one bit per AU. */ + /* A binary 1 in a bit position indicates that */ + /* the allocation unit associated with that */ + /* bit has been allocated. */ + /* Bits corresponding to system reserved AUs, */ + /* non-existant AUs, and bad AUs, are set to one, too. */ + /* (AU 0 is associated to LSBit of byte 0, */ + /* AU 7 to MSBit of byte 0, AU 8 to LSBit */ + /* of byte 1, etc.) */ +}; + +enum ti99_img_format +{ + if_mess, + if_v9t9, + if_pc99_fm, + if_pc99_mfm, + if_harddisk +}; + +/* + level-1 disk image descriptor +*/ +struct ti99_lvl1_imgref +{ + ti99_img_format img_format; /* tells the image format */ + imgtool_stream *file_handle; /* imgtool file handle */ + struct mess_hard_disk_file harddisk_handle; /* MAME harddisk handle (harddisk format) */ + ti99_geometry geometry; /* geometry */ + unsigned pc99_track_len; /* unformatted track length (pc99 format) */ + UINT32 *pc99_data_offset_array; /* offset for each sector (pc99 format) */ +}; + +/* + calculate CRC for data address marks or sector data + + crc (I/O): current CRC value to be updated (initialize to 0xffff before + calling this function for the first time) + value: new byte of data to update the CRC with +*/ +static void calc_crc(UINT16 *crc, UINT8 value) +{ + UINT8 l, h; + + l = value ^ (*crc >> 8); + *crc = (*crc & 0xff) | (l << 8); + l >>= 4; + l ^= (*crc >> 8); + *crc <<= 8; + *crc = (*crc & 0xff00) | l; + l = (l << 4) | (l >> 4); + h = l; + l = (l << 2) | (l >> 6); + l &= 0x1f; + *crc = *crc ^ (l << 8); + l = h & 0xf0; + *crc = *crc ^ (l << 8); + l = (h << 1) | (h >> 7); + l &= 0xe0; + *crc = *crc ^ l; +} + +/* + Parse a PC99 disk image + + file_handle (I/O): imgtool file handle + fm_format (I): if true, the image is in FM format, otherwise it is in MFM + format + pass (I): 0 for first pass, 1 for second pass + vib (O): buffer where the vib should be stored (first pass) + geometry (O): disk image geometry (second pass) + data_offset_array (O): array of data offset to generate (second pass) + out_track_len (O): track length is returned there + + Return imgtool error code +*/ +#define MAX_TRACK_LEN 6872 +#define DATA_OFFSET_NONE 0xffffffff +static int parse_pc99_image(imgtool_stream *file_handle, int fm_format, int pass, dsk_vib *vib, const ti99_geometry *geometry, UINT32 *data_offset_array, unsigned *out_track_len) +{ + int track_len, num_tracks; /* length of a track in bytes, and number of tracks */ + int phys_track; + int expected_cylinder, expected_head; + int track_start_pos, track_pos; + UINT8 c; + UINT8 cylinder, head, sector; + int seclen; + UINT8 crc1, crc2; + UINT16 crc; + long data_offset; + UINT8 track_buf[MAX_TRACK_LEN]; + int i; + + if (fm_format) + track_len = 3253; + else + track_len = 6872; + + if (out_track_len) + *out_track_len = track_len; + + if (stream_size(file_handle) % track_len) + return IMGTOOLERR_CORRUPTIMAGE; + + num_tracks = stream_size(file_handle) / track_len; + if (num_tracks <= 0) + return IMGTOOLERR_CORRUPTIMAGE; + + /* we only support 40-track-per-side images */ + if ((num_tracks != 40) && (num_tracks != 80)) + return IMGTOOLERR_UNIMPLEMENTED; + + if (pass == 1) + { + /* initialize offset map */ + for (head = 0; head < geometry->heads; head++) + for (cylinder = 0; cylinder < geometry->cylinders; cylinder++) + for (sector = 0; sector < geometry->secspertrack; sector++) + data_offset_array[(head*geometry->cylinders + cylinder)*geometry->secspertrack + sector] = DATA_OFFSET_NONE; + } + /* rewind to start of file */ + stream_seek(file_handle, 0, SEEK_SET); + + /* pass 0 only looks for vib in track 0; pass 1 scans every track */ + for (phys_track=0; phys_track < ((pass == 1) ? num_tracks : 1); phys_track++) + { + if (stream_read(file_handle, track_buf, track_len) != track_len) + return IMGTOOLERR_READERROR; + + /* we only support 40-track-per-side images */ + expected_cylinder = phys_track % 40; + expected_head = phys_track / 40; + + track_start_pos = 0; + + while (track_start_pos < track_len) + { + if (fm_format) + { + do + { + c = track_buf[track_start_pos]; + track_start_pos++; + } while ((c != 0xfe) && (track_start_pos < track_len)); + + if (c != 0xfe) + break; + + track_pos = track_start_pos; + + crc = 0xffff; + calc_crc(& crc, c); + } + else + { + do + { + c = track_buf[track_start_pos]; + track_start_pos++; + } while ((c != 0xa1) && (track_start_pos < track_len)); + + if (c != 0xa1) + break; + + track_pos = track_start_pos; + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + if (c != 0xa1) + continue; + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + if (c != 0xa1) + continue; + + crc = 0xffff; + calc_crc(& crc, c); + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + if (c != 0xfe) + continue; + } + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + cylinder = c; + calc_crc(& crc, c); + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + head = c; + calc_crc(& crc, c); + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + sector = c; + calc_crc(& crc, c); + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + seclen = 128 << c; + calc_crc(& crc, c); + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + crc1 = c; + calc_crc(& crc, c); + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + crc2 = c; + calc_crc(& crc, c); + +#if 0 + /* CRC seems to be completely hosed */ + if (crc) + printf("aargh!"); +#endif + if ((seclen != 256) || (crc1 != 0xf7) || (crc2 != 0xf7) + || (cylinder != expected_cylinder) || (head != expected_head) + || ((pass == 1) && ((cylinder >= geometry->cylinders) + || (head >= geometry->heads) + || (sector >= geometry->secspertrack)))) + continue; + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + while (c == (fm_format ? 0xff : 0x4e)) + { + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + } + + while (c == 0x00) + { + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + } + + if (fm_format) + { + if (c != 0xfb) + continue; + + crc = 0xffff; + calc_crc(& crc, c); + } + else + { + if (c != 0xa1) + continue; + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + if (c != 0xa1) + continue; + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + if (c != 0xa1) + continue; + + crc = 0xffff; + calc_crc(& crc, c); + + c = track_buf[track_pos]; + track_pos++; + if (track_pos == track_len) + track_pos = 0; + + if (c != 0xfb) + continue; + } + data_offset = track_pos; + for (i=0; icylinders + cylinder)*geometry->secspertrack + sector] != DATA_OFFSET_NONE) + /* error: duplicate sector */ + return IMGTOOLERR_CORRUPTIMAGE; + data_offset_array[(head*geometry->cylinders + cylinder)*geometry->secspertrack + sector] = data_offset; + break; + } + } + } + + if (pass == 0) + return IMGTOOLERR_CORRUPTIMAGE; + + if (pass == 1) + { + /* check offset map */ + for (head = 0; head < geometry->heads; head++) + for (cylinder = 0; cylinder < geometry->cylinders; cylinder++) + for (sector = 0; sector < geometry->secspertrack; sector++) + if (data_offset_array[(head*geometry->cylinders + cylinder)*geometry->secspertrack + sector] == DATA_OFFSET_NONE) + /* error: missing sector */ + return IMGTOOLERR_CORRUPTIMAGE; + } + + return 0; +} + + +/* + Read the volume information block (aphysrec 0) assuming no geometry + information. (Called when an image is opened to figure out the + geometry information.) + + file_handle (I/O): imgtool file handle + img_format (I): image format (MESS, V9T9 or PC99) + dest (O): pointer to 256-byte destination buffer + + Return imgtool error code +*/ +static int read_image_vib_no_geometry(imgtool_stream *file_handle, ti99_img_format img_format, dsk_vib *dest) +{ + int reply; + + switch (img_format) + { + case if_mess: + case if_v9t9: + /* seek to sector */ + reply = stream_seek(file_handle, 0, SEEK_SET); + if (reply) + return IMGTOOLERR_READERROR; + /* read it */ + reply = stream_read(file_handle, dest, 256); + if (reply != 256) + return IMGTOOLERR_READERROR; + return 0; + + case if_pc99_fm: + case if_pc99_mfm: + return parse_pc99_image(file_handle, img_format == if_pc99_fm, 0, dest, NULL, NULL, NULL); + + case if_harddisk: + /* not implemented, because we don't need it */ + break; + } + + return IMGTOOLERR_UNIMPLEMENTED; +} + +/* + Open a disk image at level 1 + + file_handle (I/O): imgtool file handle + img_format (I): image format (MESS, V9T9, PC99, or MAME harddisk) + l1_img (O): level-1 image handle + vib (O): buffer where the vib should be stored (floppy images only) + + Return imgtool error code +*/ +static imgtoolerr_t open_image_lvl1(imgtool_stream *file_handle, ti99_img_format img_format, ti99_lvl1_imgref *l1_img, dsk_vib *vib) +{ + imgtoolerr_t err; + int reply; + UINT16 totphysrecs; + + + l1_img->img_format = img_format; + l1_img->file_handle = file_handle; + + if (img_format == if_harddisk) + { + const hard_disk_info *info; + + err = imghd_open(file_handle, &l1_img->harddisk_handle); + if (err) + return err; + + info = imghd_get_header(&l1_img->harddisk_handle); + l1_img->geometry.cylinders = info->cylinders; + l1_img->geometry.heads = info->heads; + l1_img->geometry.secspertrack = info->sectors; + if (info->sectorbytes != 256) + { + imghd_close(&l1_img->harddisk_handle); + return IMGTOOLERR_CORRUPTIMAGE; /* TODO: support 512-byte sectors */ + } + +#if 0 + /* read vib */ + reply = read_absolute_physrec(l1_img, 0, vib); + if (reply) + return reply; +#endif + } + else + { + /* read vib */ + reply = read_image_vib_no_geometry(file_handle, img_format, vib); + if (reply) + return (imgtoolerr_t)reply; + + /* extract geometry information */ + totphysrecs = get_UINT16BE(vib->totphysrecs); + + l1_img->geometry.secspertrack = vib->secspertrack; + if (l1_img->geometry.secspertrack == 0) + /* Some images might be like this, because the original SSSD TI + controller always assumes 9. */ + l1_img->geometry.secspertrack = 9; + l1_img->geometry.cylinders = vib->cylinders; + if (l1_img->geometry.cylinders == 0) + /* Some images are like this, because the original SSSD TI + controller always assumes 40. */ + l1_img->geometry.cylinders = 40; + l1_img->geometry.heads = vib->heads; + if (l1_img->geometry.heads == 0) + /* Some images are like this, because the original SSSD TI + controller always assumes that tracks beyond 40 are on side 2. */ + l1_img->geometry.heads = totphysrecs / (l1_img->geometry.secspertrack * l1_img->geometry.cylinders); + + /* check information */ + if ((totphysrecs != (l1_img->geometry.secspertrack * l1_img->geometry.cylinders * l1_img->geometry.heads)) + || (totphysrecs < 2) + || memcmp(vib->id, "DSK", 3) || (! strchr(" P", vib->protection)) + || (((img_format == if_mess) || (img_format == if_v9t9)) + && (stream_size(file_handle) != totphysrecs*256U))) + return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; + + if ((img_format == if_pc99_fm) || (img_format == if_pc99_mfm)) + { + l1_img->pc99_data_offset_array = (UINT32*)malloc(sizeof(*l1_img->pc99_data_offset_array)*totphysrecs); + if (! l1_img->pc99_data_offset_array) + return IMGTOOLERR_OUTOFMEMORY; + reply = parse_pc99_image(file_handle, img_format == if_pc99_fm, 1, NULL, & l1_img->geometry, l1_img->pc99_data_offset_array, &l1_img->pc99_track_len); + if (reply) + { + free(l1_img->pc99_data_offset_array); + return (imgtoolerr_t)reply; + } + } + } + + return (imgtoolerr_t)0; +} + +/* + Close a disk image at level 1 + + l1_img (I/O): level-1 image handle + + Return imgtool error code +*/ +static void close_image_lvl1(ti99_lvl1_imgref *l1_img) +{ + if (l1_img->img_format == if_harddisk) + { + imghd_close(&l1_img->harddisk_handle); + } + + stream_close(l1_img->file_handle); + + if ((l1_img->img_format == if_pc99_fm) || (l1_img->img_format == if_pc99_mfm)) + free(l1_img->pc99_data_offset_array); +} + +/* + Convert physical sector address to offset in disk image (old MESS and V9T9 + formats only) + + l1_img (I/O): level-1 image handle + address (I): physical sector address + + Return offset in image +*/ +INLINE int sector_address_to_image_offset(const ti99_lvl1_imgref *l1_img, const ti99_sector_address *address) +{ + int offset = 0; + + switch (l1_img->img_format) + { + case if_mess: + /* old MESS format */ + offset = (((address->cylinder*l1_img->geometry.heads) + address->side)*l1_img->geometry.secspertrack + address->sector)*256; + break; + + case if_v9t9: + /* V9T9 format */ + if (address->side & 1) + /* on side 1, tracks are stored in the reverse order */ + offset = (((address->side*l1_img->geometry.cylinders) + (l1_img->geometry.cylinders-1 - address->cylinder))*l1_img->geometry.secspertrack + address->sector)*256; + else + offset = (((address->side*l1_img->geometry.cylinders) + address->cylinder)*l1_img->geometry.secspertrack + address->sector)*256; + break; + + case if_pc99_fm: + case if_pc99_mfm: + /* pc99 format */ + case if_harddisk: + /* harddisk format */ + assert(1); /* not implemented */ + break; + } + + return offset; +} + +/* + Read one 256-byte sector from a disk image + + l1_img (I/O): level-1 image handle + address (I): physical sector address + dest (O): pointer to 256-byte destination buffer + + Return non-zero on error +*/ +static int read_sector(ti99_lvl1_imgref *l1_img, const ti99_sector_address *address, void *dest) +{ + int reply; + UINT32 track_len, track_offset, sector_offset; + + switch (l1_img->img_format) + { + case if_mess: + /* old MESS format */ + case if_v9t9: + /* V9T9 format */ + /* seek to sector */ + reply = stream_seek(l1_img->file_handle, sector_address_to_image_offset(l1_img, address), SEEK_SET); + if (reply) + return 1; + /* read it */ + reply = stream_read(l1_img->file_handle, dest, 256); + if (reply != 256) + return 1; + break; + + case if_pc99_fm: + case if_pc99_mfm: + /* pc99 format */ + track_len = l1_img->pc99_track_len; + track_offset = (address->side*l1_img->geometry.cylinders + address->cylinder)*track_len; + sector_offset = l1_img->pc99_data_offset_array[(address->side*l1_img->geometry.cylinders + address->cylinder)*l1_img->geometry.secspertrack + address->sector]; + + if ((sector_offset + 256) <= track_len) + { + /* seek to sector */ + reply = stream_seek(l1_img->file_handle, track_offset+sector_offset, SEEK_SET); + if (reply) + return 1; + /* read it */ + reply = stream_read(l1_img->file_handle, dest, 256); + if (reply != 256) + return 1; + } + else + { + /* seek to sector */ + reply = stream_seek(l1_img->file_handle, track_offset+sector_offset, SEEK_SET); + if (reply) + return 1; + /* read first chunk (until end of track) */ + reply = stream_read(l1_img->file_handle, (UINT8 *)dest, track_len-sector_offset); + if (reply != track_len-sector_offset) + return 1; + + /* wrap to start of track */ + reply = stream_seek(l1_img->file_handle, track_offset, SEEK_SET); + if (reply) + return 1; + /* read remnant of sector */ + reply = stream_read(l1_img->file_handle, (UINT8 *)dest + (track_len-sector_offset), 256-(track_len-sector_offset)); + if (reply != 256-(track_len-sector_offset)) + return 1; + } + break; + + case if_harddisk: + /* not implemented */ + assert(1); + /*return imghd_read(l1_img->harddisk_handle, ((address->cylinder*l1_img->geometry.heads) + address->side)*l1_img->geometry.secspertrack + address->sector, 1, dest) != 1;*/ + break; + } + + return 0; +} + +/* + Write one 256-byte sector to a disk image + + l1_img (I/O): level-1 image handle + address (I): physical sector address + src (I): pointer to 256-byte source buffer + + Return non-zero on error +*/ +static int write_sector(ti99_lvl1_imgref *l1_img, const ti99_sector_address *address, const void *src) +{ + int reply; + UINT32 track_len, track_offset, sector_offset; + + switch (l1_img->img_format) + { + case if_mess: + /* old MESS format */ + case if_v9t9: + /* V9T9 format */ + /* seek to sector */ + reply = stream_seek(l1_img->file_handle, sector_address_to_image_offset(l1_img, address), SEEK_SET); + if (reply) + return 1; + /* write it */ + reply = stream_write(l1_img->file_handle, src, 256); + if (reply != 256) + return 1; + break; + + case if_pc99_fm: + case if_pc99_mfm: + /* pc99 format */ + track_len = l1_img->pc99_track_len; + track_offset = (address->side*l1_img->geometry.cylinders + address->cylinder)*track_len; + sector_offset = l1_img->pc99_data_offset_array[(address->side*l1_img->geometry.cylinders + address->cylinder)*l1_img->geometry.secspertrack + address->sector]; + + if ((sector_offset + 256) <= track_len) + { + /* seek to sector */ + reply = stream_seek(l1_img->file_handle, track_offset+sector_offset, SEEK_SET); + if (reply) + return 1; + /* write it */ + reply = stream_write(l1_img->file_handle, src, 256); + if (reply != 256) + return 1; + } + else + { + /* seek to sector */ + reply = stream_seek(l1_img->file_handle, track_offset+sector_offset, SEEK_SET); + if (reply) + return 1; + /* write first chunk (until end of track) */ + reply = stream_write(l1_img->file_handle, (UINT8 *)src, track_len-sector_offset); + if (reply != track_len-sector_offset) + return 1; + + /* wrap to start of track */ + reply = stream_seek(l1_img->file_handle, track_offset, SEEK_SET); + if (reply) + return 1; + /* write remnant of sector */ + reply = stream_write(l1_img->file_handle, (UINT8 *)src + (track_len-sector_offset), 256-(track_len-sector_offset)); + if (reply != 256-(track_len-sector_offset)) + return 1; + } + break; + + case if_harddisk: + /* not implemented */ + assert(1); + /*return imghd_write(l1_img->harddisk_handle, ((address->cylinder*l1_img->geometry.heads) + address->side)*l1_img->geometry.secspertrack + address->sector, 1, src) != 1;*/ + break; + } + + return 0; +} + +/* + Convert physical record address to sector address (DSK format) + + aphysrec (I): absolute physrec address + geometry (I): disk image geometry + address (O): physical sector address +*/ +static void dsk_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address) +{ + address->sector = aphysrec % geometry->secspertrack; + aphysrec /= geometry->secspertrack; + address->cylinder = aphysrec % geometry->cylinders; + address->side = aphysrec / geometry->cylinders; + if (address->side & 1) + /* on side 1, tracks are stored in the reverse order */ + address->cylinder = geometry->cylinders-1 - address->cylinder; +} + +/* + Convert physical record address to sector address (WIN format for HFDC) + + Note that physical address translation makes sense for HFDC, but not SCSI. + + aphysrec (I): absolute physrec address + geometry (I): disk image geometry + address (O): physical sector address +*/ +#ifdef UNUSED_FUNCTION +static void win_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address) +{ + address.sector = aphysrec % l1_img->geometry.secspertrack; + aphysrec /= l1_img->geometry.secspertrack; + address.side = aphysrec % l1_img->geometry.heads; + address.cylinder = aphysrec / l1_img->geometry.heads; +} +#endif + +/* + Read one 256-byte physical record from a disk image + + l1_img (I/O): level-1 image handle + aphysrec (I): absolute physrec address + dest (O): pointer to 256-byte destination buffer + + Return non-zero on error +*/ +static int read_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, void *dest) +{ + ti99_sector_address address; + + + if (l1_img->img_format == if_harddisk) + { +#if 0 + win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); + return read_sector(l1_img, & address, dest); +#endif + + return imghd_read(&l1_img->harddisk_handle, aphysrec, dest) != IMGTOOLERR_SUCCESS; + } + else + { + dsk_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); + + return read_sector(l1_img, & address, dest); + } +} + +/* + Write one 256-byte physical record to a disk image + + l1_img (I/O): level-1 image handle + aphysrec (I): absolute physrec address + src (I): pointer to 256-byte source buffer + + Return non-zero on error +*/ +static int write_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, const void *src) +{ + ti99_sector_address address; + + + if (l1_img->img_format == if_harddisk) + { +#if 0 + win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); + return write_sector(l1_img, & address, dest); +#endif + + return imghd_write(&l1_img->harddisk_handle, aphysrec, src) != IMGTOOLERR_SUCCESS; + } + else + { + dsk_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); + + return write_sector(l1_img, & address, src); + } +} + +#if 0 +#pragma mark - +#pragma mark LEVEL 2 DISK ROUTINES +#endif + +/* + Level 2 implements files as a succession of 256-byte-long physical records. + + Level 2 implements allocation bitmap (and AU), disk catalog, etc. +*/ + +/* + WIN VIB/DDR record +*/ +struct win_vib_ddr +{ + char name[10]; /* disk volume name (10 characters, pad with spaces) */ + UINT16BE totAUs; /* total number of AUs */ + UINT8 secspertrack; /* HFDC: sectors per track (typically 32) */ + /* SCSI: reserved */ + union + { + struct + { + UINT8 id[3]; /* V1 VIB: 'WIN' */ + } vib_v1; + + struct /* V2 VIB: extra params */ + { + UINT8 res_AUs; /* # AUs reserved for vib, bitmap, ddr, fdir and fdr, divided by 64 */ + UINT8 step_spd; /* HFDC: step speed (0-7) */ + /* SCSI: reserved */ + UINT8 red_w_cur;/* HFDC: reduced write current cylinder, divided by 8 */ + /* SCSI: reserved */ + } vib_v2; + + struct + { + UINT8 id[3]; /* DDR: 'DIR' */ + } ddr; + } u; + UINT16BE params; /* bits 0-3: sectors/AU - 1 */ + /* HFDC: */ + /* bits 4-7: # heads - 1 */ + /* bit 8: V1: buffered head stepping flag */ + /* V2: reserved */ + /* bit 9-15: write precompensation track, divided by 16 */ + /* SCSI: */ + /* bits 4-15: reserved */ + ti99_date_time creation;/* date and time of creation */ + UINT8 num_files; /* number of files in directory */ + UINT8 num_subdirs; /* number of subdirectories in directory */ + UINT16BE fdir_AU; /* points to root directory fdir */ + union + { + struct + { + UINT16BE dsk1_AU; /* HFDC: points to current dsk1 emulation image (0 if none) */ + /* SCSI: reserved */ + } vib; + + struct + { + UINT16BE parent_ddr_AU; /* points to parent directory DDR */ + } ddr; + } u2; + UINT16BE subdir_AU[114];/* points to all subdirectory DDRs */ +}; + +/* + AU format +*/ +struct ti99_AUformat +{ + int totAUs; /* total number of AUs */ + int physrecsperAU; /* number of 256-byte physical records per AU */ +}; + +/* + DSK directory reference: 0 for root, 1 for 1st subdir, 2 for 2nd subdir, 3 + for 3rd subdir +*/ +/*typedef int dir_ref;*/ + +/* + catalog entry (used for in-memory catalog) +*/ +struct dir_entry +{ + UINT16 dir_ptr; /* DSK: unused */ + /* WIN: AU address of the DDR for this directory */ + char name[10]; /* name of this directory (copied from the VIB for DSK, DDR for WIN) */ +}; + +struct file_entry +{ + UINT16 fdr_ptr; /* DSK: aphysrec address of the FDR for this file */ + /* WIN: AU address of the FDR for this file */ + char name[10]; /* name of this file (copied from FDR) */ +}; + +struct ti99_catalog +{ + int num_subdirs; /* number of subdirectories */ + int num_files; /* number of files */ + dir_entry subdirs[114]; /* description of each subdir */ + file_entry files[128]; /* description of each file */ +}; + +/* + level-2 disk image descriptor +*/ +struct ti99_lvl2_imgref_dsk +{ + UINT16 totphysrecs; /* total number of aphysrecs (extracted from vib record in aphysrec 0) */ + ti99_catalog catalogs[4]; /* catalog of root directory and up to 3 subdirectories */ + UINT16 fdir_aphysrec[4]; /* fdir aphysrec address for root directory + and up to 3 subdirectories */ +}; + +enum win_vib_t +{ + win_vib_v1, + win_vib_v2 +}; +struct ti99_lvl2_imgref_win +{ + win_vib_t vib_version; /* version of the vib record in aphysrec 0 (see win_vib_ddr) */ +}; + +enum l2i_t +{ + L2I_DSK, + L2I_WIN +}; + +struct ti99_lvl2_imgref +{ + ti99_lvl1_imgref l1_img;/* image format, imgtool image handle, image geometry */ + ti99_AUformat AUformat; /* AU format */ + int data_offset; /* In order to reduce seek times when searching the + disk for a given file name, fdr (and ddr, and + fdir) records are preferentially allocated in + AUs n to data_offset, whereas data records are + preferentially allocated in AUs starting at + data_offset. */ + /* With the DSK disk structure, n is always 2 (if 1 + physrec per AU) or 1 (if 2 physrecs per AU or + more), and data_offset is arbitrarily chosen as + 34. */ + /* With the WIN disk structure, n depends on the + size of the volume bitmap, which itself depends + on the number of AUs on disk (we always have n + <= 33), and data_offset is read from the vib + record (except with the obsolete v1 VIB, where + we use a default value of 64). */ + char vol_name[10]; /* cached volume name (extracted from vib record in aphysrec 0) */ + + UINT8 abm[8192]; /* allocation bitmap */ + + l2i_t type; /* structure format */ + + union + { + ti99_lvl2_imgref_dsk dsk; + ti99_lvl2_imgref_win win; + }; /* structure-specific info */ +}; + +/* + file flags found in fdr (and tifiles) +*/ +enum +{ + fdr99_f_program = 0x01, /* set for program files */ + fdr99_f_int = 0x02, /* set for binary files */ + fdr99_f_wp = 0x08, /* set if file is write-protected */ + /*fdr99_f_backup = 0x10,*/ /* set if file has been modified since last backup */ + /*fdr99_f_dskimg = 0x20,*/ /* set if file is a DSK image (HFDC HD only) */ + fdr99_f_var = 0x80 /* set if file uses variable-length records*/ +}; + +/* + DSK FDR record +*/ +struct dsk_fdr +{ + char name[10]; /* file name (10 characters, pad with spaces) */ + UINT16BE xreclen; /* extended record len: if record len is >= 256, */ + /* reclen is set to 0 and the actual reclen is */ + /* stored here (Myarc HFDC only). TI reserved */ + /* this field for data chain pointer extension, */ + /* but this was never implemented. */ + UINT8 flags; /* file status flags (see enum above) */ + UINT8 recsperphysrec; /* logical records per physrec */ + /* ignored for variable length record files and */ + /* program files */ + UINT16BE fphysrecs; /* file length in physrecs */ + /* Note that the HFDC defines this field as the */ + /* number of allocated physrecs in the cluster */ + /* chain (i.e. rounded on the next AU */ + /* boundary), so level-3 routines should use */ + /* the fixrecs field instead to determine the */ + /* logical length of field. IIRC, the HFDC */ + /* implementation is regarded as a bug because */ + /* program files do not define the fixrecs field */ + /* field, so program field saved by the HFDC */ + /* DSR may be larger whan they should. */ + UINT8 eof; /* EOF offset in last physrec for variable length */ + /* record files and program files (0->256)*/ + UINT8 reclen; /* logical record size in bytes ([1,255] 0->256) */ + /* Maximum allowable record size for variable */ + /* length record files. Reserved for program */ + /* files (set to 0). Set to 0 if reclen >=256 */ + /* (HFDC only). */ + UINT16LE fixrecs; /* file length in logical records */ + /* For variable length record files, number of */ + /* 256-byte records actually used. */ + ti99_date_time creation;/* date and time of creation (HFDC and BwG only; */ + /* reserved in TI) */ + ti99_date_time update; /* date and time of last write to file (HFDC and */ + /* BwG only; reserved in TI) */ + UINT8 clusters[76][3]; /* data cluster table: 0 through 76 entries (3 */ + /* bytes each), one entry for each file cluster. */ + /* 12 bits: address of first AU of cluster */ + /* 12 bits: offset of last 256-byte record in cluster */ +}; + +/* + WIN FDR record +*/ +struct win_fdr +{ + char name[10]; /* file name (10 characters, pad with spaces) */ + UINT16BE xreclen; /* extended record len: if record len is >= 256, */ + /* reclen is set to 0 and the actual reclen is */ + /* stored here (Myarc HFDC only). TI reserved */ + /* this field for data chain pointer extension, */ + /* but this was never implemented. */ + UINT8 flags; /* file status flags (see enum above) */ + UINT8 recsperphysrec; /* logical records per physrec */ + /* ignored for variable length record files and */ + /* program files */ + UINT16BE fphysrecs_LSW; /* eldest FDR: file length in physrecs */ + /* Note that the HFDC defines this field as the */ + /* number of allocated physrecs in the cluster */ + /* chain (i.e. rounded on the next AU */ + /* boundary), so level-3 routines should use */ + /* the fixrecs field instead to determine the */ + /* logical length of field. IIRC, the HFDC */ + /* implementation is regarded as a bug because */ + /* program files do not define the fixrecs field */ + /* field, so program field saved by the HFDC */ + /* DSR may be larger whan they should. */ + /* other sibling FDRs: index of the first file */ + /* physrec in this particular sibling FDR */ + UINT8 eof; /* EOF offset in last physrec for variable length */ + /* record files and program files (0->256)*/ + UINT8 reclen; /* logical record size in bytes ([1,255]) */ + /* Maximum allowable record size for variable */ + /* length record files. Reserved for program */ + /* files (set to 0). Set to 0 if reclen >=256 */ + /* (HFDC only). */ + UINT16LE fixrecs_LSW; /* file length in logical records */ + /* For variable length record files, number of */ + /* 256-byte records actually used. */ + ti99_date_time creation;/* date and time of creation */ + ti99_date_time update; /* date and time of last write to file */ + + char id[2]; /* 'FI' */ + UINT16BE prevsibFDR_AU; /* address of the AU where previous sibling FDR is */ + /* (see also xinfo_LSB) */ + UINT16BE nextsibFDR_AU; /* address of the AU where next sibling FDR is */ + /* (see also xinfo_LSB) */ + UINT16BE sibFDR_AUlen; /* total number of data AUs allocated in this particular sibling FDR */ + UINT16BE parent_FDIR_AU;/* FDIR the file is listed in */ + UINT8 xinfo_MSB; /* extended information (MSByte) */ + /* bits 0-3: MSN of fphysrecs */ + /* bits 4-7: MSN of fixrecs */ + UINT8 xinfo_LSB; /* extended information (LSByte) */ + /* bits 8-11: physrec offset within AU for */ + /* previous sibling FDR (see prevsibFDR_AU) */ + /* bits 12-15: physrec offset within AU for */ + /* next sibling FDR (see nextsibFDR_AU) */ + UINT16BE clusters[54][2];/* data cluster table: 0 through 54 entries (4 */ + /* bytes each), one entry for each file cluster. */ + /* 16 bits: address of first AU of cluster */ + /* 16 bits: address of last AU of cluster */ +}; + +/* + tifile header: stand-alone file +*/ +struct tifile_header +{ + char tifiles[8]; /* always '\7TIFILES' */ + UINT16BE fphysrecs; /* file length in physrecs */ + UINT8 flags; /* see enum above */ + UINT8 recsperphysrec; /* records per physrec */ + UINT8 eof; /* current position of eof in last physrec (0->255)*/ + UINT8 reclen; /* bytes per record ([1,255] 0->256) */ + UINT16BE fixrecs; /* file length in records */ + UINT8 res[128-16]; /* reserved */ + /* * variant a: */ + /* 112 chars: 0xCA53 repeated 56 times */ + /* * variant b: */ + /* 4 chars: unknown */ + /* 108 chars: 0xCA53 repeated 54 times */ + /* * variant c: */ + /* 10 chars: original TI file name filed with spaces */ + /* 102 chars: spaces */ + /* * variant d: */ + /* 10 chars: original TI file name filed with spaces */ + /* 2 chars: CR+LF */ + /* 98 chars: spaces */ + /* 2 chars: CR+LF */ + /* * variant e: */ + /* 10 chars: original TI file name */ + /* 4 bytes: unknown */ + /* 4 bytes: time & date of creation */ + /* 4 bytes: time & date of last update */ + /* 90 chars: spaces */ + /* * variant f: */ + /* 6 bytes: 'MYTERM' */ + /* 4 bytes: time & date of creation */ + /* 4 bytes: time & date of last update */ + /* 2 bytes: unknown (always >0000) */ + /* 96 chars: 0xCA53 repeated 56 times */ +}; + +/* + level-2 file descriptor +*/ +struct ti99_lvl2_fileref_dsk +{ + struct ti99_lvl2_imgref *l2_img; + int fdr_aphysrec; + dsk_fdr fdr; +}; + +struct ti99_lvl2_fileref_win +{ + struct ti99_lvl2_imgref *l2_img; + unsigned fphysrecs; /* copy of field in the eldest FDR */ + unsigned eldestfdr_aphysrec; /* aphysrec address of the eldest FDR */ + unsigned curfdr_aphysrec; /* aphysrec address of the currently open sibling FDR */ + win_fdr curfdr; /* buffer with currently open sibling FDR */ +}; + +struct ti99_lvl2_fileref_tifiles +{ + imgtool_stream *file_handle; + tifile_header hdr; +}; + +enum l2f_type_t +{ + L2F_DSK, + L2F_WIN, + L2F_TIFILES +}; + +struct ti99_lvl2_fileref +{ + l2f_type_t type; + union + { + ti99_lvl2_fileref_dsk dsk; + ti99_lvl2_fileref_win win; + ti99_lvl2_fileref_tifiles tifiles; + }; +}; + +/* + Compare two (possibly empty) catalog entry for qsort +*/ +static int cat_file_compare_qsort(const void *p1, const void *p2) +{ + const file_entry *entry1 = (const file_entry *)p1; + const file_entry *entry2 = (const file_entry *)p2; + + if ((entry1->fdr_ptr == 0) && (entry2->fdr_ptr == 0)) + return 0; + else if (entry1->fdr_ptr == 0) + return +1; + else if (entry2->fdr_ptr == 0) + return -1; + else + return memcmp(entry1->name, entry2->name, 10); +} + +static int cat_dir_compare_qsort(const void *p1, const void *p2) +{ + const dir_entry *entry1 = (const dir_entry *)p1; + const dir_entry *entry2 = (const dir_entry *)p2; + + if ((entry1->dir_ptr == 0) && (entry2->dir_ptr == 0)) + return 0; + else if (entry1->dir_ptr == 0) + return +1; + else if (entry2->dir_ptr == 0) + return -1; + else + return memcmp(entry1->name, entry2->name, 10); +} + +/* + Read a directory catalog from disk image + + l2_img: image reference + aphysrec: physical record address of the FDIR + dest: pointer to the destination buffer where the catalog should be written + + Return an error code if there was an error, 0 otherwise. +*/ +static int dsk_read_catalog(struct ti99_lvl2_imgref *l2_img, int aphysrec, ti99_catalog *dest) +{ + int totphysrecs = l2_img->dsk.totphysrecs; + UINT16BE fdir_buf[128]; + dsk_fdr fdr; + int i; + int reply; + + + /* Read FDIR record */ + reply = read_absolute_physrec(& l2_img->l1_img, aphysrec, fdir_buf); + if (reply) + return IMGTOOLERR_READERROR; + + /* Copy FDIR info to catalog structure */ + for (i=0; i<128; i++) + dest->files[i].fdr_ptr = get_UINT16BE(fdir_buf[i]); + + /* Check FDIR pointers and check and extract file names from DDRs */ + for (i=0; i<128; i++) + { + if (dest->files[i].fdr_ptr >= totphysrecs) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + else if (dest->files[i].fdr_ptr) + { + reply = read_absolute_physrec(& l2_img->l1_img, dest->files[i].fdr_ptr, &fdr); + if (reply) + return IMGTOOLERR_READERROR; + + /* check and copy file name */ + if (check_fname(fdr.name)) + return IMGTOOLERR_CORRUPTIMAGE; + memcpy(dest->files[i].name, fdr.name, 10); + } + } + + /* Check catalog */ + for (i=0; i<127; i++) + { + if (((! dest->files[i].fdr_ptr) && dest->files[i+1].fdr_ptr) + || ((dest->files[i].fdr_ptr && dest->files[i+1].fdr_ptr) && (memcmp(dest->files[i].name, dest->files[i+1].name, 10) >= 0))) + { + /* if the catalog is not sorted, we repair it */ + qsort(dest->files, ARRAY_LENGTH(dest->files), sizeof(dest->files[0]), + cat_file_compare_qsort); + break; + } + } + + /* Set file count */ + for (i=0; (i<128) && (dest->files[i].fdr_ptr != 0); i++) + ; + dest->num_files = i; + + /* Set subdir count to 0 (subdirs are loaded elsewhere) */ + dest->num_subdirs = 0; + + return 0; +} + +/* + Read a directory catalog from disk image + + l2_img: image reference + DDR_AU: AU address of the VIB/DDR + dest: pointer to the destination buffer where the catalog should be written + + Return an error code if there was an error, 0 otherwise. +*/ +static int win_read_catalog(struct ti99_lvl2_imgref *l2_img, int DDR_AU, ti99_catalog *dest) +{ + win_vib_ddr ddr_buf; + UINT16BE fdir_buf[128]; + win_fdr fdr_buf; + int i; + int reply; + + + /* Read DDR record */ + reply = read_absolute_physrec(& l2_img->l1_img, DDR_AU*l2_img->AUformat.physrecsperAU, &ddr_buf); + if (reply) + return IMGTOOLERR_READERROR; + + /* sanity checks */ + if ((ddr_buf.num_files > 127) || (ddr_buf.num_subdirs > 114) || (get_UINT16BE(ddr_buf.fdir_AU) > l2_img->AUformat.totAUs)) + return IMGTOOLERR_CORRUPTIMAGE; + + /* set file count and subdir count */ + dest->num_files = ddr_buf.num_files; + dest->num_subdirs = ddr_buf.num_subdirs; + + /* Copy DDR info to catalog structure */ + for (i=0; isubdirs[i].dir_ptr = get_UINT16BE(ddr_buf.subdir_AU[i]); + + /* Read FDIR record */ + reply = read_absolute_physrec(& l2_img->l1_img, get_UINT16BE(ddr_buf.fdir_AU)*l2_img->AUformat.physrecsperAU, fdir_buf); + if (reply) + return IMGTOOLERR_READERROR; + + /* Copy FDIR info to catalog structure */ + for (i=0; inum_files; i++) + dest->files[i].fdr_ptr = get_UINT16BE(fdir_buf[i]); + + /* Check DDR pointers and check and extract file names from FDRs */ + for (i=0; inum_subdirs; i++) + { + if (dest->subdirs[i].dir_ptr >= l2_img->AUformat.totAUs) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + else if (dest->subdirs[i].dir_ptr) + { + reply = read_absolute_physrec(& l2_img->l1_img, dest->subdirs[i].dir_ptr*l2_img->AUformat.physrecsperAU, &ddr_buf); + if (reply) + return IMGTOOLERR_READERROR; + + /* check and copy file name */ + if (check_fname(ddr_buf.name)) + return IMGTOOLERR_CORRUPTIMAGE; + memcpy(dest->subdirs[i].name, ddr_buf.name, 10); + } + } + + /* Check FDIR pointers and check and extract file names from FDRs */ + for (i=0; inum_files; i++) + { + if (dest->files[i].fdr_ptr >= l2_img->AUformat.totAUs) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + else if (dest->files[i].fdr_ptr) + { + reply = read_absolute_physrec(& l2_img->l1_img, dest->files[i].fdr_ptr*l2_img->AUformat.physrecsperAU, &fdr_buf); + if (reply) + return IMGTOOLERR_READERROR; + + /* check and copy file name */ + if (check_fname(fdr_buf.name)) + return IMGTOOLERR_CORRUPTIMAGE; + memcpy(dest->files[i].name, fdr_buf.name, 10); + } + } + + /* Check catalog */ + + /* Check subdir order */ + for (i=0; inum_subdirs-1; i++) + { + if (((! dest->subdirs[i].dir_ptr) && dest->subdirs[i+1].dir_ptr) + || ((dest->subdirs[i].dir_ptr && dest->subdirs[i+1].dir_ptr) && (memcmp(dest->subdirs[i].name, dest->subdirs[i+1].name, 10) >= 0))) + { + /* if the subdir catalog is not sorted, we repair it */ + qsort(dest->subdirs, dest->num_subdirs, sizeof(dest->subdirs[0]), cat_dir_compare_qsort); + break; + } + } + + /* Fix subdir count */ + while (dest->num_subdirs && (dest->subdirs[dest->num_subdirs-1].dir_ptr == 0)) + dest->num_subdirs--; + + /* Check file order */ + for (i=0; inum_files-1; i++) + { + if (((! dest->files[i].fdr_ptr) && dest->files[i+1].fdr_ptr) + || ((dest->files[i].fdr_ptr && dest->files[i+1].fdr_ptr) && (memcmp(dest->files[i].name, dest->files[i+1].name, 10) >= 0))) + { + /* if the file catalog is not sorted, we repair it */ + qsort(dest->files, dest->num_files, sizeof(dest->files[0]), cat_file_compare_qsort); + break; + } + } + + /* Fix file count */ + while (dest->num_files && (dest->files[dest->num_files-1].fdr_ptr == 0)) + dest->num_files--; + + return 0; +} + +/* + Search for a file path on a floppy image + + l2_img: image reference + fpath: path of the file to search + parent_ref_valid: set to TRUE if either the file was found or the file was + not found but its parent dir was + parent_ref: reference to parent dir (0 for root) + out_is_dir: TRUE if element is a directory + catalog_index: on output, index of file catalog entry (may be NULL) +*/ +static int dsk_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *fpath, int *parent_ref_valid, int *parent_ref, int *out_is_dir, int *catalog_index) +{ + int i; + const ti99_catalog *cur_catalog; + const char *element_start, *element_end; + int element_len; + char element[10]; + int is_dir = FALSE; + + + cur_catalog = & l2_img->dsk.catalogs[0]; + if (parent_ref_valid) + (* parent_ref_valid) = FALSE; + if (parent_ref) + *parent_ref = 0; + + element_start = fpath; + do + { + /* find next path element */ + element_end = strchr(element_start, '.'); + element_len = element_end ? (element_end - element_start) : strlen(element_start); + if ((element_len > 10) || (element_len == 0)) + return IMGTOOLERR_BADFILENAME; + /* last path element */ + if ((!element_end) && parent_ref_valid) + (* parent_ref_valid) = TRUE; + + /* generate file name */ + memcpy(element, element_start, element_len); + memset(element+element_len, ' ', 10-element_len); + + /* search entry in subdirectories */ + for (i = 0; inum_subdirs; i++) + { + if (! memcmp(element, cur_catalog->subdirs[i].name, 10)) + { + is_dir = TRUE; + break; + } + } + + /* if it failed, search entry in files */ + if (i == cur_catalog->num_subdirs) + { + for (i = 0; inum_files; i++) + { + if (! memcmp(element, cur_catalog->files[i].name, 10)) + { + is_dir = FALSE; + break; + } + } + /* exit if not found */ + if (i == cur_catalog->num_files) + { + return IMGTOOLERR_FILENOTFOUND; + } + } + + /* iterate */ + if (element_end) + { + element_start = element_end+1; + + if (! is_dir) + /* this is not a directory */ + return IMGTOOLERR_BADFILENAME; + + /* initialize cur_catalog */ + cur_catalog = & l2_img->dsk.catalogs[i+1]; + if (parent_ref) + *parent_ref = i+1; + } + else + element_start = NULL; + } + while (element_start); + + if (out_is_dir) + *out_is_dir = is_dir; + + if (catalog_index) + *catalog_index = i; + + return 0; +} + +/* + Search for a file path on a harddisk image + + l2_img: image reference + fpath: path of the file to search + parent_ref_valid: set to TRUE if either the file was found or the file was + not found but its parent dir was + parent_ddr_AU: parent DDR AU address (0 for root) + parent_catalog: catalog of parent dir (cannot be NULL) + out_is_dir: TRUE if element is a directory + catalog_index: on output, index of file catalog entry (may be NULL) +*/ +static int win_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *fpath, + int *parent_ref_valid, int *parent_ddr_AU, ti99_catalog *parent_catalog, + int *out_is_dir, int *catalog_index) +{ + int i; + const char *element_start, *element_end; + int element_len; + char element[10]; + int is_dir = FALSE; + int errorcode; + + if (parent_ref_valid) + (* parent_ref_valid) = FALSE; + if (parent_ddr_AU) + *parent_ddr_AU = 0; + + errorcode = win_read_catalog(l2_img, 0, parent_catalog); + if (errorcode) + return errorcode; + + element_start = fpath; + do + { + /* find next path element */ + element_end = strchr(element_start, '.'); + element_len = element_end ? (element_end - element_start) : strlen(element_start); + if ((element_len > 10) || (element_len == 0)) + return IMGTOOLERR_BADFILENAME; + /* last path element */ + if ((!element_end) && parent_ref_valid) + (* parent_ref_valid) = TRUE; + + /* generate file name */ + memcpy(element, element_start, element_len); + memset(element+element_len, ' ', 10-element_len); + + /* search entry in subdirectories */ + for (i = 0; inum_subdirs; i++) + { + if (! memcmp(element, parent_catalog->subdirs[i].name, 10)) + { + is_dir = TRUE; + break; + } + } + + /* if it failed, search entry in files */ + if (i == parent_catalog->num_subdirs) + { + for (i = 0; inum_files; i++) + { + if (! memcmp(element, parent_catalog->files[i].name, 10)) + { + is_dir = FALSE; + break; + } + } + /* exit if not found */ + if (i == parent_catalog->num_files) + { + return IMGTOOLERR_FILENOTFOUND; + } + } + + /* iterate */ + if (element_end) + { + element_start = element_end+1; + + if (! is_dir) + /* this is not a directory */ + return IMGTOOLERR_BADFILENAME; + + if (parent_ddr_AU) + *parent_ddr_AU = parent_catalog->subdirs[i].dir_ptr; + + errorcode = win_read_catalog(l2_img, parent_catalog->subdirs[i].dir_ptr, parent_catalog); + if (errorcode) + return errorcode; + } + else + element_start = NULL; + } + while (element_start); + + if (out_is_dir) + *out_is_dir = is_dir; + + if (catalog_index) + *catalog_index = i; + + return 0; +} + +/* + Allocate one AU on disk, for use as a fdr record + + l2_img: image reference + fdr_AU: on output, address of allocated AU +*/ +static int alloc_fdr_AU(struct ti99_lvl2_imgref *l2_img, unsigned *fdr_AU) +{ + int totAUs = l2_img->AUformat.totAUs; + int i; + + for (i=0; iabm[i >> 3] & (1 << (i & 7)))) + { + *fdr_AU = i; + l2_img->abm[i >> 3] |= 1 << (i & 7); + + return 0; + } + } + + return IMGTOOLERR_NOSPACE; +} + +INLINE int get_dsk_fdr_cluster_baseAU(struct ti99_lvl2_imgref *l2_img, dsk_fdr *fdr, int cluster_index) +{ + int reply; + + /* read base AU/physrec for this cluster */ + reply = ((fdr->clusters[cluster_index][1] & 0xf) << 8) | fdr->clusters[cluster_index][0]; + /* convert to AU address */ + if (l2_img->AUformat.physrecsperAU <= 2) + reply /= l2_img->AUformat.physrecsperAU; + + return reply; +} + +INLINE int get_dsk_fdr_cluster_baseaphysrec(struct ti99_lvl2_imgref *l2_img, dsk_fdr *fdr, int cluster_index) +{ + int reply; + + /* read base AU/physrec for this cluster */ + reply = ((fdr->clusters[cluster_index][1] & 0xf) << 8) | fdr->clusters[cluster_index][0]; + /* convert to physrec address */ + if (l2_img->AUformat.physrecsperAU > 2) + reply *= l2_img->AUformat.physrecsperAU; + + return reply; +} + +INLINE int get_dsk_fdr_cluster_lastfphysrec(dsk_fdr *fdr, int cluster_index) +{ + return (fdr->clusters[cluster_index][2] << 4) | (fdr->clusters[cluster_index][1] >> 4); +} + +INLINE void set_dsk_fdr_cluster_lastfphysrec(dsk_fdr *fdr, int cluster_index, int data) +{ + fdr->clusters[cluster_index][1] = (fdr->clusters[cluster_index][1] & 0x0f) | (data << 4); + fdr->clusters[cluster_index][2] = data >> 4; +} + +INLINE void set_dsk_fdr_cluster(struct ti99_lvl2_imgref *l2_img, dsk_fdr *fdr, int cluster_index, int baseAU, int lastfphysrec) +{ + /* convert AU address to FDR value */ + if (l2_img->AUformat.physrecsperAU <= 2) + baseAU *= l2_img->AUformat.physrecsperAU; + + /* write cluster entry */ + fdr->clusters[cluster_index][0] = baseAU; + fdr->clusters[cluster_index][1] = ((baseAU >> 8) & 0x0f) | (lastfphysrec << 4); + fdr->clusters[cluster_index][2] = lastfphysrec >> 4; +} + +INLINE unsigned get_win_fdr_fphysrecs(win_fdr *fdr) +{ + return (((unsigned) fdr->xinfo_MSB << 12) & 0xf0000) | get_UINT16BE(fdr->fphysrecs_LSW); +} + +INLINE void set_win_fdr_fphysrecs(win_fdr *fdr, unsigned data) +{ + fdr->xinfo_MSB = (fdr->xinfo_MSB & 0x0f) | ((data >> 12) & 0xf0); + set_UINT16BE(&fdr->fphysrecs_LSW, data & 0xffff); +} + +INLINE unsigned get_win_fdr_fixrecs(win_fdr *fdr) +{ + return (((unsigned) fdr->xinfo_MSB << 16) & 0xf0000) | get_UINT16LE(fdr->fixrecs_LSW); +} + +INLINE void set_win_fdr_fixrecs(win_fdr *fdr, unsigned data) +{ + fdr->xinfo_MSB = (fdr->xinfo_MSB & 0xf0) | ((data >> 16) & 0x0f); + set_UINT16LE(&fdr->fixrecs_LSW, data & 0xffff); +} + +INLINE unsigned get_win_fdr_prevsibFDR_aphysrec(struct ti99_lvl2_imgref *l2_img, win_fdr *fdr) +{ + unsigned prevsibFDR_AU = get_UINT16BE(fdr->prevsibFDR_AU); + + return prevsibFDR_AU + ? (prevsibFDR_AU * l2_img->AUformat.physrecsperAU + ((fdr->xinfo_LSB >> 4) & 0xf)) + : 0; +} + +INLINE unsigned get_win_fdr_nextsibFDR_aphysrec(struct ti99_lvl2_imgref *l2_img, win_fdr *fdr) +{ + unsigned nextsibFDR_AU = get_UINT16BE(fdr->nextsibFDR_AU); + + return nextsibFDR_AU + ? (nextsibFDR_AU * l2_img->AUformat.physrecsperAU + (fdr->xinfo_LSB & 0xf)) + : 0; +} + +INLINE unsigned get_win_fdr_cursibFDR_basefphysrec(win_fdr *fdr) +{ + return get_UINT16BE(fdr->prevsibFDR_AU) ? get_win_fdr_fphysrecs(fdr) : 0; +} + +/* + Advance to next sibling FDR +*/ +static int win_goto_next_sibFDR(ti99_lvl2_fileref_win *win_file) +{ + if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU) == 0) + return IMGTOOLERR_UNEXPECTED; + + win_file->curfdr_aphysrec = get_win_fdr_nextsibFDR_aphysrec(win_file->l2_img, &win_file->curfdr); + if (read_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr)) + return IMGTOOLERR_READERROR; + + return 0; +} + +/* + Back to previous sibling FDR +*/ +static int win_goto_prev_sibFDR(ti99_lvl2_fileref_win *win_file) +{ + if (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) == 0) + return IMGTOOLERR_UNEXPECTED; + + win_file->curfdr_aphysrec = get_win_fdr_prevsibFDR_aphysrec(win_file->l2_img, &win_file->curfdr); + if (read_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr)) + return IMGTOOLERR_READERROR; + + return 0; +} + +/* + Append a new sibling FDR at the end of the sibling FDR list, and open it. + + You must have gone to the end of the list. +*/ +static int win_alloc_sibFDR(ti99_lvl2_fileref_win *win_file) +{ + unsigned oldfdr_AU, oldfdr_physrecinAU; + unsigned newfdr_AU, newfdr_physrecinAU; + int allocated = FALSE; + int errorcode; + unsigned cursibFDR_basefphysrec; + + if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU)) + return IMGTOOLERR_UNEXPECTED; + + oldfdr_AU = win_file->curfdr_aphysrec / win_file->l2_img->AUformat.physrecsperAU; + oldfdr_physrecinAU = win_file->curfdr_aphysrec % win_file->l2_img->AUformat.physrecsperAU; + + if (oldfdr_physrecinAU != (win_file->l2_img->AUformat.physrecsperAU - 1)) + { /* current AU is not full */ + newfdr_AU = oldfdr_AU; + newfdr_physrecinAU = oldfdr_physrecinAU + 1; + } + else + { /* current AU is full: allocate another */ + errorcode = alloc_fdr_AU(win_file->l2_img, &newfdr_AU); + if (errorcode) + return errorcode; + newfdr_physrecinAU = 0; + allocated = TRUE; + } + + set_UINT16BE(&win_file->curfdr.nextsibFDR_AU, newfdr_AU); + win_file->curfdr.xinfo_LSB = (win_file->curfdr.xinfo_LSB & 0xf0) | newfdr_physrecinAU; + + /* save current sibling FDR */ + if (write_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr)) + { + /* clear pointer */ + set_UINT16BE(&win_file->curfdr.nextsibFDR_AU, 0); + win_file->curfdr.xinfo_LSB = win_file->curfdr.xinfo_LSB & 0xf0; + if (allocated) + /* free AU */ + win_file->l2_img->abm[newfdr_AU >> 3] |= 1 << (newfdr_AU & 7); + return IMGTOOLERR_WRITEERROR; + } + + /* now update in-memory structure to describe new sibling FDR */ + cursibFDR_basefphysrec = get_win_fdr_cursibFDR_basefphysrec(&win_file->curfdr) + + get_UINT16BE(win_file->curfdr.sibFDR_AUlen) * win_file->l2_img->AUformat.physrecsperAU; + + set_UINT16BE(&win_file->curfdr.nextsibFDR_AU, 0); + set_UINT16BE(&win_file->curfdr.prevsibFDR_AU, oldfdr_AU); + win_file->curfdr.xinfo_LSB = oldfdr_physrecinAU << 4; + + win_file->curfdr_aphysrec = newfdr_AU * win_file->l2_img->AUformat.physrecsperAU + newfdr_physrecinAU; + + set_win_fdr_fphysrecs(&win_file->curfdr, cursibFDR_basefphysrec); + set_UINT16BE(&win_file->curfdr.sibFDR_AUlen, 0); + memset(win_file->curfdr.clusters, 0, sizeof(win_file->curfdr.clusters)); + + return 0; +} + +/* + Extend a file with nb_alloc_physrecs extra physrecs + + dsk_file: file reference + nb_alloc_physrecs: number of physical records to allocate +*/ +static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc_physrecs) +{ + int totAUs = dsk_file->l2_img->AUformat.totAUs; + int free_physrecs; + int fphysrecs; + int i; + int cluster_index; + int last_sec, p_last_sec = 0; + int cur_block_seclen; + int cluster_baseAU, cluster_AUlen; + int first_best_block_baseAU = 0, first_best_block_seclen; + int second_best_block_baseAU = 0, second_best_block_seclen; + int search_start; + + /* compute free space */ + free_physrecs = 0; + for (i=0; il2_img->abm[i >> 3] & (1 << (i & 7)))) + free_physrecs += dsk_file->l2_img->AUformat.physrecsperAU; + } + + /* check we have enough free space */ + if (free_physrecs < nb_alloc_physrecs) + return IMGTOOLERR_NOSPACE; + + /* current number of data physrecs in file */ + fphysrecs = get_UINT16BE(dsk_file->fdr.fphysrecs); + + if (fphysrecs == 0) + { /* cluster array must be empty */ + cluster_index = 0; + } + else + { /* try to extend last block */ + last_sec = -1; + for (cluster_index=0; cluster_index<76; cluster_index++) + { + p_last_sec = last_sec; + last_sec = get_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index); + if (last_sec >= (fphysrecs-1)) + break; + } + if (cluster_index == 76) + /* that sucks */ + return IMGTOOLERR_CORRUPTIMAGE; + + if (last_sec > (fphysrecs-1)) + { /* some extra space has already been allocated */ + cur_block_seclen = last_sec - (fphysrecs-1); + if (cur_block_seclen > nb_alloc_physrecs) + cur_block_seclen = nb_alloc_physrecs; + + fphysrecs += cur_block_seclen; + set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); + nb_alloc_physrecs -= cur_block_seclen; + if (! nb_alloc_physrecs) + return 0; /* done */ + } + + /* round up to next AU boundary */ + last_sec = last_sec + dsk_file->l2_img->AUformat.physrecsperAU - (last_sec % dsk_file->l2_img->AUformat.physrecsperAU) - 1; + + if (last_sec > (fphysrecs-1)) + { /* some extra space has already been allocated */ + cur_block_seclen = last_sec - (fphysrecs-1); + if (cur_block_seclen > nb_alloc_physrecs) + cur_block_seclen = nb_alloc_physrecs; + + fphysrecs += cur_block_seclen; + set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); + set_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index, fphysrecs-1); + nb_alloc_physrecs -= cur_block_seclen; + if (! nb_alloc_physrecs) + return 0; /* done */ + } + + /* read base AU address for this cluster */ + cluster_baseAU = get_dsk_fdr_cluster_baseAU(dsk_file->l2_img, &dsk_file->fdr, cluster_index); + /* point past cluster end */ + cluster_baseAU += (last_sec-p_last_sec/*+file->l2_img->AUformat.physrecsperAU-1*/) / dsk_file->l2_img->AUformat.physrecsperAU; + /* count free physrecs after last block */ + cur_block_seclen = 0; + for (i=cluster_baseAU; (! (dsk_file->l2_img->abm[i >> 3] & (1 << (i & 7)))) && (cur_block_seclen < nb_alloc_physrecs) && (i < totAUs); i++) + cur_block_seclen += dsk_file->l2_img->AUformat.physrecsperAU; + if (cur_block_seclen) + { /* extend last block */ + if (cur_block_seclen > nb_alloc_physrecs) + cur_block_seclen = nb_alloc_physrecs; + + fphysrecs += cur_block_seclen; + set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); + last_sec += cur_block_seclen; + nb_alloc_physrecs -= cur_block_seclen; + set_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index, last_sec); + cluster_AUlen = (cur_block_seclen + dsk_file->l2_img->AUformat.physrecsperAU - 1) / dsk_file->l2_img->AUformat.physrecsperAU; + for (i=0; il2_img->abm[(i+cluster_baseAU) >> 3] |= 1 << ((i+cluster_baseAU) & 7); + if (! nb_alloc_physrecs) + return 0; /* done */ + } + cluster_index++; + if (cluster_index == 76) + /* that sucks */ + return IMGTOOLERR_NOSPACE; + } + + search_start = dsk_file->l2_img->data_offset; /* initially, search for free space only in data space */ + while (nb_alloc_physrecs) + { + /* find smallest data block at least nb_alloc_physrecs in length, and largest data block less than nb_alloc_physrecs in length */ + first_best_block_seclen = INT_MAX; + second_best_block_seclen = 0; + for (i=search_start; il2_img->abm[i >> 3] & (1 << (i & 7)))) + { /* found one free block */ + /* compute its length */ + cluster_baseAU = i; + cur_block_seclen = 0; + while ((il2_img->abm[i >> 3] & (1 << (i & 7))))) + { + cur_block_seclen += dsk_file->l2_img->AUformat.physrecsperAU; + i++; + } + /* compare to previous best and second-best blocks */ + if ((cur_block_seclen < first_best_block_seclen) && (cur_block_seclen >= nb_alloc_physrecs)) + { + first_best_block_baseAU = cluster_baseAU; + first_best_block_seclen = cur_block_seclen; + if (cur_block_seclen == nb_alloc_physrecs) + /* no need to search further */ + break; + } + else if ((cur_block_seclen > second_best_block_seclen) && (cur_block_seclen < nb_alloc_physrecs)) + { + second_best_block_baseAU = cluster_baseAU; + second_best_block_seclen = cur_block_seclen; + } + } + } + + if (first_best_block_seclen != INT_MAX) + { /* found one contiguous block which can hold it all */ + fphysrecs += nb_alloc_physrecs; + set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); + + set_dsk_fdr_cluster(dsk_file->l2_img, &dsk_file->fdr, cluster_index, first_best_block_baseAU, fphysrecs-1); + cluster_AUlen = (nb_alloc_physrecs + dsk_file->l2_img->AUformat.physrecsperAU - 1) / dsk_file->l2_img->AUformat.physrecsperAU; + for (i=0; il2_img->abm[(i+first_best_block_baseAU) >> 3] |= 1 << ((i+first_best_block_baseAU) & 7); + + nb_alloc_physrecs = 0; + } + else if (second_best_block_seclen != 0) + { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */ + fphysrecs += second_best_block_seclen; + set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); + + set_dsk_fdr_cluster(dsk_file->l2_img, &dsk_file->fdr, cluster_index, second_best_block_baseAU, fphysrecs-1); + cluster_AUlen = (second_best_block_seclen + dsk_file->l2_img->AUformat.physrecsperAU - 1) / dsk_file->l2_img->AUformat.physrecsperAU; + for (i=0; il2_img->abm[(i+second_best_block_baseAU) >> 3] |= 1 << ((i+second_best_block_baseAU) & 7); + + nb_alloc_physrecs -= second_best_block_seclen; + + cluster_index++; + if (cluster_index == 76) + /* that sucks */ + return IMGTOOLERR_NOSPACE; + } + else if (search_start != 0) + { /* we did not find any free physrec in the data section of the disk */ + search_start = 0; /* time to fall back to fdr space */ + } + else + return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */ + } + + return 0; +} + +/* + Extend a file with nb_alloc_physrecs extra physrecs + + win_file: file reference + nb_alloc_physrecs: number of physical records to allocate +*/ +static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc_physrecs) +{ + int totAUs = win_file->l2_img->AUformat.totAUs; + int free_physrecs; + int fphysrecs; + int i; + int cluster_index; + int num_fphysrec; + int cur_block_seclen; + int cluster_baseAU, cluster_AUlen; + int first_best_block_baseAU = 0, first_best_block_seclen; + int second_best_block_baseAU = 0, second_best_block_seclen; + int search_start; + int errorcode; + + /* compute free space */ + free_physrecs = 0; + for (i=0; il2_img->abm[i >> 3] & (1 << (i & 7)))) + free_physrecs += win_file->l2_img->AUformat.physrecsperAU; + } + + /* check we have enough free space */ + if (free_physrecs < nb_alloc_physrecs) + return IMGTOOLERR_NOSPACE; + + /* move to last sibling non-empty FDR */ + while ((get_UINT16BE(win_file->curfdr.nextsibFDR_AU) != 0) && + (get_UINT16BE(win_file->curfdr.clusters[53][0]) != 0)) + { + errorcode = win_goto_next_sibFDR(win_file); + if (errorcode) + return errorcode; + } + if ((get_UINT16BE(win_file->curfdr.clusters[0][0]) == 0) && (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) != 0)) + { /* this is annoying: we have found a sibling FDR filled with 0s: rewind + to last non-empty sibling if applicable */ + errorcode = win_goto_prev_sibFDR(win_file); + if (errorcode) + return errorcode; + } + + /* current number of data physrecs in file */ + fphysrecs = win_file->fphysrecs; + + /* current number of allocated physrecs */ + num_fphysrec = get_win_fdr_cursibFDR_basefphysrec(&win_file->curfdr) + + get_UINT16BE(win_file->curfdr.sibFDR_AUlen) * win_file->l2_img->AUformat.physrecsperAU; + + if (num_fphysrec > fphysrecs) + { /* some extra space has already been allocated */ + cur_block_seclen = num_fphysrec - fphysrecs; + if (cur_block_seclen > nb_alloc_physrecs) + cur_block_seclen = nb_alloc_physrecs; + + fphysrecs += cur_block_seclen; + win_file->fphysrecs = fphysrecs; + /* TODO: update eldest FDR fphysrecs field */ + /*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/ + nb_alloc_physrecs -= cur_block_seclen; + if (! nb_alloc_physrecs) + return 0; /* done */ + } + + /* find last non-empty cluster */ + for (cluster_index=0; (cluster_index<54) && (get_UINT16BE(win_file->curfdr.clusters[cluster_index][0]) != 0); cluster_index++) + ; + /* if we are dealing with an empty file, we will have (cluster_index == 0)... */ + if (cluster_index != 0) + { + cluster_index--; + /* try to extend last cluster */ + /* point past cluster end */ + cluster_baseAU = get_UINT16BE(win_file->curfdr.clusters[cluster_index][1]) + 1; + /* count free physrecs after last block */ + cur_block_seclen = 0; + for (i=cluster_baseAU; (! (win_file->l2_img->abm[i >> 3] & (1 << (i & 7)))) && (cur_block_seclen < nb_alloc_physrecs) && (i < totAUs); i++) + cur_block_seclen += win_file->l2_img->AUformat.physrecsperAU; + if (cur_block_seclen) + { /* extend last block */ + if (cur_block_seclen > nb_alloc_physrecs) + cur_block_seclen = nb_alloc_physrecs; + + fphysrecs += cur_block_seclen; + cluster_AUlen = (cur_block_seclen + win_file->l2_img->AUformat.physrecsperAU - 1) / win_file->l2_img->AUformat.physrecsperAU; + win_file->fphysrecs = fphysrecs; + /* TODO: update eldest FDR fphysrecs field */ + /*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/ + set_UINT16BE(&win_file->curfdr.sibFDR_AUlen, + get_UINT16BE(win_file->curfdr.sibFDR_AUlen)+cluster_AUlen); + set_UINT16BE(&win_file->curfdr.clusters[cluster_index][1], + get_UINT16BE(win_file->curfdr.clusters[cluster_index][1])+cluster_AUlen); + for (i=0; il2_img->abm[(i+cluster_baseAU) >> 3] |= 1 << ((i+cluster_baseAU) & 7); + nb_alloc_physrecs -= cur_block_seclen; + if (! nb_alloc_physrecs) + return 0; /* done */ + } + /* now point to first free entry in cluster table */ + cluster_index++; + } + + search_start = win_file->l2_img->data_offset; /* initially, search for free space only in data space */ + while (nb_alloc_physrecs) + { + /* find smallest data block at least nb_alloc_physrecs in length, and largest data block less than nb_alloc_physrecs in length */ + first_best_block_seclen = INT_MAX; + second_best_block_seclen = 0; + for (i=search_start; il2_img->abm[i >> 3] & (1 << (i & 7)))) + { /* found one free block */ + /* compute its length */ + cluster_baseAU = i; + cur_block_seclen = 0; + while ((il2_img->abm[i >> 3] & (1 << (i & 7))))) + { + cur_block_seclen += win_file->l2_img->AUformat.physrecsperAU; + i++; + } + /* compare to previous best and second-best blocks */ + if ((cur_block_seclen < first_best_block_seclen) && (cur_block_seclen >= nb_alloc_physrecs)) + { + first_best_block_baseAU = cluster_baseAU; + first_best_block_seclen = cur_block_seclen; + if (cur_block_seclen == nb_alloc_physrecs) + /* no need to search further */ + break; + } + else if ((cur_block_seclen > second_best_block_seclen) && (cur_block_seclen < nb_alloc_physrecs)) + { + second_best_block_baseAU = cluster_baseAU; + second_best_block_seclen = cur_block_seclen; + } + } + } + + if ((first_best_block_seclen != INT_MAX) || (second_best_block_seclen != 0)) + { + if (cluster_index == 54) + { + /* end of cluster list: go to next sibling FDR */ + if (write_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr)) + return IMGTOOLERR_WRITEERROR; + if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU) != 0) + { /* read next sibling FDR */ + errorcode = win_goto_next_sibFDR(win_file); + if (errorcode) + return errorcode; + } + else + { /* allocate new sibling FDR */ + errorcode = win_alloc_sibFDR(win_file); + if (errorcode) + return errorcode; + } + cluster_index = 0; + } + } + + if (first_best_block_seclen != INT_MAX) + { /* found one contiguous block which can hold it all */ + fphysrecs += nb_alloc_physrecs; + cluster_AUlen = (nb_alloc_physrecs + win_file->l2_img->AUformat.physrecsperAU - 1) / win_file->l2_img->AUformat.physrecsperAU; + win_file->fphysrecs = fphysrecs; + /* TODO: update eldest FDR fphysrecs field */ + /*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/ + set_UINT16BE(&win_file->curfdr.sibFDR_AUlen, + get_UINT16BE(win_file->curfdr.sibFDR_AUlen)+cluster_AUlen); + set_UINT16BE(&win_file->curfdr.clusters[cluster_index][0], first_best_block_baseAU); + set_UINT16BE(&win_file->curfdr.clusters[cluster_index][1], + first_best_block_baseAU+cluster_AUlen-1); + + for (i=0; il2_img->abm[(i+first_best_block_baseAU) >> 3] |= 1 << ((i+first_best_block_baseAU) & 7); + + nb_alloc_physrecs = 0; + } + else if (second_best_block_seclen != 0) + { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */ + fphysrecs += second_best_block_seclen; + cluster_AUlen = (second_best_block_seclen + win_file->l2_img->AUformat.physrecsperAU - 1) / win_file->l2_img->AUformat.physrecsperAU; + win_file->fphysrecs = fphysrecs; + /* TODO: update eldest FDR fphysrecs field */ + /*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/ + set_UINT16BE(&win_file->curfdr.sibFDR_AUlen, + get_UINT16BE(win_file->curfdr.sibFDR_AUlen)+cluster_AUlen); + set_UINT16BE(&win_file->curfdr.clusters[cluster_index][0], second_best_block_baseAU); + set_UINT16BE(&win_file->curfdr.clusters[cluster_index][1], + second_best_block_baseAU+cluster_AUlen-1); + + for (i=0; il2_img->abm[(i+second_best_block_baseAU) >> 3] |= 1 << ((i+second_best_block_baseAU) & 7); + + nb_alloc_physrecs -= second_best_block_seclen; + + /* now point to first free entry in cluster table */ + cluster_index++; + } + else if (search_start != 0) + { /* we did not find any free physrec in the data section of the disk */ + search_start = 0; /* time to fall back to fdr space */ + } + else + return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */ + } + + return 0; +} + +/* + Allocate a new (empty) file +*/ +static int new_file_lvl2_dsk(struct ti99_lvl2_imgref *l2_img, int parent_ref, char filename[10], struct ti99_lvl2_fileref *l2_file) +{ + ti99_catalog *catalog = &l2_img->dsk.catalogs[parent_ref]; + unsigned fdr_AU, fdr_aphysrec; + int catalog_index, i; + int reply = 0; + int errorcode; + + + if (catalog->num_files >= 127) + /* if num_files == 128, catalog is full */ + /* if num_files == 127, catalog is not full, but we don't want to write + a 128th entry for compatibility with some existing DSRs that detect the + end of the FDIR array with a 0 entry (and do not check that the index + has not reached 128) */ + return IMGTOOLERR_NOSPACE; + + /* find insertion point in catalog */ + for (i=0; (i < catalog->num_files) && ((reply = memcmp(catalog->files[i].name, filename, 10)) < 0); i++) + ; + + if ((inum_files) && (reply == 0)) + /* file already exists */ + return IMGTOOLERR_BADFILENAME; + else + { + /* otherwise insert new entry */ + catalog_index = i; + errorcode = alloc_fdr_AU(l2_img, &fdr_AU); + if (errorcode) + return errorcode; + fdr_aphysrec = fdr_AU * l2_img->AUformat.physrecsperAU; + + /* shift catalog entries until the insertion point */ + for (i=catalog->num_files; i>catalog_index; i--) + catalog->files[i] = catalog->files[i-1]; + + /* write new catalog entry */ + catalog->files[catalog_index].fdr_ptr = fdr_aphysrec; + memcpy(catalog->files[catalog_index].name, filename, 10); + + /* update catalog len */ + catalog->num_files++; + } + + /* set up file handle */ + l2_file->type = L2F_DSK; + l2_file->dsk.l2_img = l2_img; + l2_file->dsk.fdr_aphysrec = fdr_aphysrec; + memset(&l2_file->dsk.fdr, 0, sizeof(l2_file->dsk.fdr)); + memcpy(l2_file->dsk.fdr.name, filename, 10); + + return 0; +} + +/* + Allocate a new (empty) file +*/ +static int new_file_lvl2_win(struct ti99_lvl2_imgref *l2_img, ti99_catalog *parent_catalog, char filename[10], struct ti99_lvl2_fileref *l2_file) +{ + unsigned fdr_AU; + int catalog_index, i; + int reply = 0; + int errorcode; + + + if (parent_catalog->num_files >= 127) + /* if num_files == 127, catalog is full */ + return IMGTOOLERR_NOSPACE; + + /* find insertion point in catalog */ + for (i=0; (i < parent_catalog->num_files) && ((reply = memcmp(parent_catalog->files[i].name, filename, 10)) < 0); i++) + ; + + if ((inum_files) && (reply == 0)) + /* file already exists */ + return IMGTOOLERR_BADFILENAME; + else + { + /* otherwise insert new entry */ + catalog_index = i; + errorcode = alloc_fdr_AU(l2_img, &fdr_AU); + if (errorcode) + return errorcode; + + /* shift catalog entries until the insertion point */ + for (i=parent_catalog->num_files; i>catalog_index; i--) + parent_catalog->files[i] = parent_catalog->files[i-1]; + + /* write new catalog entry */ + parent_catalog->files[catalog_index].fdr_ptr = fdr_AU; + memcpy(parent_catalog->files[catalog_index].name, filename, 10); + + /* update catalog len */ + parent_catalog->num_files++; + } + + /* set up file handle */ + l2_file->type = L2F_WIN; + l2_file->win.l2_img = l2_img; + l2_file->win.fphysrecs = 0; + l2_file->win.eldestfdr_aphysrec = fdr_AU * l2_img->AUformat.physrecsperAU; + l2_file->win.curfdr_aphysrec = l2_file->win.eldestfdr_aphysrec; + memset(&l2_file->win.curfdr, 0, sizeof(l2_file->win.curfdr)); + memcpy(l2_file->win.curfdr.name, filename, 10); + + return 0; +} + +/* + Allocate a new (empty) file +*/ +static int new_file_lvl2_tifiles(imgtool_stream *file_handle, struct ti99_lvl2_fileref *l2_file) +{ + /* set up file handle */ + l2_file->type = L2F_TIFILES; + l2_file->tifiles.file_handle = file_handle; + memset(&l2_file->tifiles.hdr, 0, sizeof(l2_file->tifiles.hdr)); + l2_file->tifiles.hdr.tifiles[0] = '\7'; + l2_file->tifiles.hdr.tifiles[1] = 'T'; + l2_file->tifiles.hdr.tifiles[2] = 'I'; + l2_file->tifiles.hdr.tifiles[3] = 'F'; + l2_file->tifiles.hdr.tifiles[4] = 'I'; + l2_file->tifiles.hdr.tifiles[5] = 'L'; + l2_file->tifiles.hdr.tifiles[6] = 'E'; + l2_file->tifiles.hdr.tifiles[7] = 'S'; + + return 0; +} + +/* + Open an existing file on a floppy image + + l2_img: level 2 image the file is located on + fpath: access path to the file + file: set up if open is successful +*/ +static int open_file_lvl2_dsk(struct ti99_lvl2_imgref *l2_img, const char *fpath, struct ti99_lvl2_fileref *l2_file) +{ + int parent_ref, is_dir, catalog_index; + int reply; + + + reply = dsk_find_catalog_entry(l2_img, fpath, NULL, &parent_ref, &is_dir, &catalog_index); + if (reply) + return reply; + + if (is_dir) + /* this is not a file */ + return IMGTOOLERR_BADFILENAME; + + l2_file->type = L2F_DSK; + l2_file->dsk.l2_img = l2_img; + l2_file->dsk.fdr_aphysrec = l2_img->dsk.catalogs[parent_ref].files[catalog_index].fdr_ptr; + if (read_absolute_physrec(& l2_img->l1_img, l2_file->dsk.fdr_aphysrec, &l2_file->dsk.fdr)) + return IMGTOOLERR_READERROR; + + return 0; +} + +/* + Open an existing file on a harddisk image + + l2_img: level 2 image the file is located on + fpath: access path to the file + file: set up if open is successful +*/ +static int open_file_lvl2_win(struct ti99_lvl2_imgref *l2_img, const char *fpath, struct ti99_lvl2_fileref *l2_file) +{ + int parent_ref, is_dir, catalog_index; + ti99_catalog catalog; + int reply; + + reply = win_find_catalog_entry(l2_img, fpath, NULL, &parent_ref, &catalog, &is_dir, &catalog_index); + if (reply) + return reply; + + if (is_dir) + /* this is not a file */ + return IMGTOOLERR_BADFILENAME; + + l2_file->type = L2F_WIN; + l2_file->win.l2_img = l2_img; + l2_file->win.eldestfdr_aphysrec = catalog.files[catalog_index].fdr_ptr * l2_img->AUformat.physrecsperAU; + l2_file->win.curfdr_aphysrec = l2_file->win.eldestfdr_aphysrec; + if (read_absolute_physrec(& l2_img->l1_img, l2_file->win.curfdr_aphysrec, &l2_file->win.curfdr)) + return IMGTOOLERR_READERROR; + l2_file->win.fphysrecs = get_win_fdr_fphysrecs(&l2_file->win.curfdr); + + /* check integrity of FDR sibling chain */ + /* note that as we check that the back chain is consistent with the forward + chain, we will also detect any cycle in the sibling chain, so we do not + need to check against them explicitely */ + if (get_UINT16BE(l2_file->win.curfdr.prevsibFDR_AU) != 0) + return IMGTOOLERR_CORRUPTIMAGE; + + { + int i, pastendoflist_flag; + unsigned cur_fphysrec, sibFDR_AUlen; + win_fdr *cur_fdr, fdr_buf; + unsigned curfdr_aphysrec, prevfdr_aphysrec; + + cur_fphysrec = 0; + pastendoflist_flag = 0; + cur_fdr = &l2_file->win.curfdr; + curfdr_aphysrec = l2_file->win.eldestfdr_aphysrec; + + while (1) + { + sibFDR_AUlen = 0; + i=0; + if (! pastendoflist_flag) + { + /* compute number of allocated AUs and check number of AUs */ + for (; i<54; i++) + { + if (get_UINT16BE(cur_fdr->clusters[i][0]) == 0) + { + pastendoflist_flag = TRUE; + break; + } + sibFDR_AUlen += get_UINT16BE(cur_fdr->clusters[i][1]) + - get_UINT16BE(cur_fdr->clusters[i][0]) + + 1; + } + } + /* clear remainder of cluster table */ + for (; i<54; i++) + { +#if 0 + set_UINT16BE(&cur_fdr->clusters[i][0], 0); + set_UINT16BE(&cur_fdr->clusters[i][1], 0); +#endif + if ((get_UINT16BE(cur_fdr->clusters[i][0]) != 0) || (get_UINT16BE(cur_fdr->clusters[i][1]) != 0)) + return IMGTOOLERR_CORRUPTIMAGE; + } + + /* check sibFDR_AUlen field */ + if (get_UINT16BE(cur_fdr->sibFDR_AUlen) != sibFDR_AUlen) + return IMGTOOLERR_CORRUPTIMAGE; + + /* update current file physrec position to point to end of sibling FDR */ + cur_fphysrec += sibFDR_AUlen * l2_file->win.l2_img->AUformat.physrecsperAU; + + /* exit loop if end of sibling chain */ + if (! get_UINT16BE(cur_fdr->nextsibFDR_AU)) + break; + + /* otherwise read next FDR */ + if (get_UINT16BE(cur_fdr->nextsibFDR_AU) >= l2_file->win.l2_img->AUformat.totAUs) + return IMGTOOLERR_CORRUPTIMAGE; + + prevfdr_aphysrec = curfdr_aphysrec; + curfdr_aphysrec = get_win_fdr_nextsibFDR_aphysrec(l2_file->win.l2_img, cur_fdr); + if (read_absolute_physrec(& l2_file->win.l2_img->l1_img, curfdr_aphysrec, &fdr_buf)) + return IMGTOOLERR_READERROR; + cur_fdr = &fdr_buf; + + /* check that back chaining is consistent with forward chaining */ + if (get_win_fdr_prevsibFDR_aphysrec(l2_file->win.l2_img, &fdr_buf) != prevfdr_aphysrec) + return IMGTOOLERR_CORRUPTIMAGE; + /* check fphysrecs field */ + if (get_win_fdr_fphysrecs(&fdr_buf) != cur_fphysrec) + return IMGTOOLERR_CORRUPTIMAGE; + + /* check consistency of informative fields (name, record format, flags, etc) */ + if (memcmp(fdr_buf.name, l2_file->win.curfdr.name, 10) + || (get_UINT16BE(fdr_buf.xreclen) != get_UINT16BE(l2_file->win.curfdr.xreclen)) + || (fdr_buf.flags != l2_file->win.curfdr.flags) + || (fdr_buf.recsperphysrec != l2_file->win.curfdr.recsperphysrec) + || (fdr_buf.eof != l2_file->win.curfdr.eof) + || (fdr_buf.reclen != l2_file->win.curfdr.reclen) + || (get_UINT16LE(fdr_buf.fixrecs_LSW) != get_UINT16LE(l2_file->win.curfdr.fixrecs_LSW)) + || memcmp(&fdr_buf.creation, &l2_file->win.curfdr.creation, 4) + || memcmp(&fdr_buf.update, &l2_file->win.curfdr.update, 4) + /*|| memcmp(fdr_buf.id, l2_file->win.curfdr.id, 2)*/ + || (get_UINT16BE(fdr_buf.parent_FDIR_AU) != get_UINT16BE(l2_file->win.curfdr.parent_FDIR_AU)) + || ((fdr_buf.xinfo_MSB & 0xf) != (l2_file->win.curfdr.xinfo_MSB & 0xf))) + return IMGTOOLERR_CORRUPTIMAGE; + } + if (cur_fphysrec < l2_file->win.fphysrecs) + return IMGTOOLERR_CORRUPTIMAGE; + } + + return 0; +} + +/* + Open an existing file in TIFILES format +*/ +static int open_file_lvl2_tifiles(imgtool_stream *file_handle, struct ti99_lvl2_fileref *l2_file) +{ + /* set up file handle */ + l2_file->type = L2F_TIFILES; + l2_file->tifiles.file_handle = file_handle; + + /* seek to header */ + if (stream_seek(l2_file->tifiles.file_handle, 0, SEEK_SET)) + return IMGTOOLERR_READERROR; + /* read it */ + if (stream_read(l2_file->tifiles.file_handle, &l2_file->tifiles.hdr, sizeof(l2_file->tifiles.hdr)) != sizeof(l2_file->tifiles.hdr)) + return IMGTOOLERR_READERROR; + + return 0; +} + +/* + compute the aphysrec address for a given file physical record (fphysrec) + + l2_img: image where the file is located +*/ +static int dsk_fphysrec_to_aphysrec(ti99_lvl2_fileref_dsk *dsk_file, unsigned fphysrec, unsigned *aphysrec) +{ + int cluster_index; + int cluster_firstfphysrec, cluster_lastfphysrec; + int cluster_baseaphysrec; + + + /* check parameter */ + if (fphysrec >= get_UINT16BE(dsk_file->fdr.fphysrecs)) + return IMGTOOLERR_UNEXPECTED; + + + /* search for the cluster in the data chain pointers array */ + cluster_firstfphysrec = 0; + for (cluster_index=0; cluster_index<76; cluster_index++) + { + /* read curent file block table entry */ + cluster_lastfphysrec = get_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index); + if (cluster_lastfphysrec >= fphysrec) + break; + cluster_firstfphysrec = cluster_lastfphysrec+1; + } + if (cluster_index == 76) + /* if not found, the file is corrupt */ + return IMGTOOLERR_CORRUPTIMAGE; + + /* read base aphysrec address for this cluster */ + cluster_baseaphysrec = get_dsk_fdr_cluster_baseaphysrec(dsk_file->l2_img, &dsk_file->fdr, cluster_index); + /* return absolute physrec address */ + *aphysrec = cluster_baseaphysrec + (fphysrec - cluster_firstfphysrec); + return 0; +} + +/* + compute the aphysrec address for a given file physical record (fphysrec) + + l2_img: image where the file is located +*/ +static int win_fphysrec_to_aphysrec(ti99_lvl2_fileref_win *win_file, unsigned fphysrec, unsigned *aphysrec) +{ + int cluster_index; + int cluster_firstfphysrec, cluster_lastfphysrec; + int cluster_baseaphysrec; + int errorcode; + + + /* check parameter */ + if (fphysrec >= win_file->fphysrecs) + return IMGTOOLERR_UNEXPECTED; + + /* look for correct sibling */ + if (fphysrec < get_win_fdr_cursibFDR_basefphysrec(& win_file->curfdr)) + { + while (fphysrec < get_win_fdr_cursibFDR_basefphysrec(& win_file->curfdr)) + { + if (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) == 0) + return IMGTOOLERR_CORRUPTIMAGE; + errorcode = win_goto_prev_sibFDR(win_file); + if (errorcode) + return errorcode; + } + } + else /*if (fphysrec >= get_win_fdr_cursibFDR_basefphysrec(& dsk_file->curfdr))*/ + { + while (fphysrec >= (get_win_fdr_cursibFDR_basefphysrec(& win_file->curfdr) + + get_UINT16BE(win_file->curfdr.sibFDR_AUlen) * win_file->l2_img->AUformat.physrecsperAU)) + { + if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU) == 0) + return IMGTOOLERR_CORRUPTIMAGE; + errorcode = win_goto_next_sibFDR(win_file); + if (errorcode) + return errorcode; + } + } + + + /* search for the cluster in the data chain pointers array */ + cluster_firstfphysrec = get_win_fdr_cursibFDR_basefphysrec(& win_file->curfdr); + for (cluster_index = 0; cluster_index<54; cluster_index++) + { + cluster_lastfphysrec = cluster_firstfphysrec + + (get_UINT16BE(win_file->curfdr.clusters[cluster_index][1]) + - get_UINT16BE(win_file->curfdr.clusters[cluster_index][0]) + + 1) + * win_file->l2_img->AUformat.physrecsperAU; + if (fphysrec < cluster_lastfphysrec) + break; + + cluster_firstfphysrec = cluster_lastfphysrec; + } + + if (cluster_index == 54) + return IMGTOOLERR_CORRUPTIMAGE; + + + /* read base aphysrec address for this cluster */ + cluster_baseaphysrec = get_UINT16BE(win_file->curfdr.clusters[cluster_index][0]) * win_file->l2_img->AUformat.physrecsperAU; + /* return absolute physrec address */ + *aphysrec = cluster_baseaphysrec + (fphysrec - cluster_firstfphysrec); + return 0; +} + +/* + read a 256-byte physical record from a file +*/ +static int read_file_physrec(struct ti99_lvl2_fileref *l2_file, unsigned fphysrec, void *dest) +{ + int errorcode; + unsigned aphysrec; + + switch (l2_file->type) + { + case L2F_DSK: + /* compute absolute physrec address */ + errorcode = dsk_fphysrec_to_aphysrec(&l2_file->dsk, fphysrec, &aphysrec); + if (errorcode) + return errorcode; + /* read physrec */ + if (read_absolute_physrec(& l2_file->dsk.l2_img->l1_img, aphysrec, dest)) + return IMGTOOLERR_READERROR; + break; + + case L2F_WIN: + /* compute absolute physrec address */ + errorcode = win_fphysrec_to_aphysrec(&l2_file->win, fphysrec, &aphysrec); + if (errorcode) + return errorcode; + /* read physrec */ + if (read_absolute_physrec(& l2_file->win.l2_img->l1_img, aphysrec, dest)) + return IMGTOOLERR_READERROR; + break; + + case L2F_TIFILES: + /* seek to physrec */ + if (stream_seek(l2_file->tifiles.file_handle, 128+256*fphysrec, SEEK_SET)) + return IMGTOOLERR_READERROR; + /* read it */ + if (stream_read(l2_file->tifiles.file_handle, dest, 256) != 256) + return IMGTOOLERR_READERROR; + break; + } + + return 0; +} + +/* + read a 256-byte physical record from a file +*/ +static int write_file_physrec(struct ti99_lvl2_fileref *l2_file, unsigned fphysrec, const void *src) +{ + int errorcode; + unsigned aphysrec; + + switch (l2_file->type) + { + case L2F_DSK: + /* compute absolute physrec address */ + errorcode = dsk_fphysrec_to_aphysrec(&l2_file->dsk, fphysrec, &aphysrec); + if (errorcode) + return errorcode; + /* write physrec */ + if (write_absolute_physrec(& l2_file->dsk.l2_img->l1_img, aphysrec, src)) + return IMGTOOLERR_WRITEERROR; + break; + + case L2F_WIN: + /* compute absolute physrec address */ + errorcode = win_fphysrec_to_aphysrec(&l2_file->win, fphysrec, &aphysrec); + if (errorcode) + return errorcode; + /* write physrec */ + if (write_absolute_physrec(& l2_file->win.l2_img->l1_img, aphysrec, src)) + return IMGTOOLERR_WRITEERROR; + break; + + case L2F_TIFILES: + /* seek to physrec */ + if (stream_seek(l2_file->tifiles.file_handle, 128+256*fphysrec, SEEK_SET)) + return IMGTOOLERR_WRITEERROR; + /* write it */ + if (stream_write(l2_file->tifiles.file_handle, src, 256) != 256) + return IMGTOOLERR_WRITEERROR; + break; + } + + return 0; +} + +/* + Write a field in every fdr record associated to a file +*/ +#ifdef UNUSED_FUNCTION +static int set_win_fdr_field(struct ti99_lvl2_fileref *l2_file, size_t offset, size_t size, void *data) +{ + win_fdr fdr_buf; + unsigned fdr_aphysrec; + int errorcode = 0; + + for (fdr_aphysrec = l2_file->win.eldestfdr_aphysrec; + fdr_aphysrec && ((errorcode = (read_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf) ? IMGTOOLERR_READERROR : 0)) == 0); + fdr_aphysrec = get_win_fdr_nextsibFDR_physrec(l2_file->win.l2_img, &fdr_buf)) + { + memcpy(((UINT8 *) &fdr_buf) + offset, data, size); + if (write_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf)) + { + errorcode = IMGTOOLERR_WRITEERROR; + break; + } + } + + return errorcode; +} +#endif + +static UINT8 get_file_flags(struct ti99_lvl2_fileref *l2_file) +{ + int reply = 0; + + switch (l2_file->type) + { + case L2F_DSK: + reply = l2_file->dsk.fdr.flags; + break; + + case L2F_WIN: + reply = l2_file->win.curfdr.flags; + break; + + case L2F_TIFILES: + reply = l2_file->tifiles.hdr.flags; + break; + } + + return reply; +} + +static void set_file_flags(struct ti99_lvl2_fileref *l2_file, UINT8 data) +{ + switch (l2_file->type) + { + case L2F_DSK: + l2_file->dsk.fdr.flags = data; + break; + + case L2F_WIN: + l2_file->win.curfdr.flags = data; + break; + + case L2F_TIFILES: + l2_file->tifiles.hdr.flags = data; + break; + } +} + +static UINT8 get_file_recsperphysrec(struct ti99_lvl2_fileref *l2_file) +{ + int reply = 0; + + switch (l2_file->type) + { + case L2F_DSK: + reply = l2_file->dsk.fdr.recsperphysrec; + break; + + case L2F_WIN: + reply = l2_file->win.curfdr.recsperphysrec; + break; + + case L2F_TIFILES: + reply = l2_file->tifiles.hdr.recsperphysrec; + break; + } + + return reply; +} + +static void set_file_recsperphysrec(struct ti99_lvl2_fileref *l2_file, UINT8 data) +{ + switch (l2_file->type) + { + case L2F_DSK: + l2_file->dsk.fdr.recsperphysrec = data; + break; + + case L2F_WIN: + l2_file->win.curfdr.recsperphysrec = data; + break; + + case L2F_TIFILES: + l2_file->tifiles.hdr.recsperphysrec = data; + break; + } +} + +static unsigned get_file_fphysrecs(struct ti99_lvl2_fileref *l2_file) +{ + int reply = 0; + + switch (l2_file->type) + { + case L2F_DSK: + reply = get_UINT16BE(l2_file->dsk.fdr.fphysrecs); + break; + + case L2F_WIN: + reply = l2_file->win.fphysrecs; + break; + + case L2F_TIFILES: + reply = get_UINT16BE(l2_file->tifiles.hdr.fphysrecs); + break; + } + + return reply; +} + +static int set_file_fphysrecs(struct ti99_lvl2_fileref *l2_file, unsigned data) +{ + switch (l2_file->type) + { + case L2F_DSK: + if (data >= 65536) + return IMGTOOLERR_UNIMPLEMENTED; + set_UINT16BE(&l2_file->dsk.fdr.fphysrecs, data); + break; + + case L2F_WIN: + l2_file->win.fphysrecs = data; + break; + + case L2F_TIFILES: + if (data >= 65536) + return IMGTOOLERR_UNIMPLEMENTED; + set_UINT16BE(&l2_file->tifiles.hdr.fphysrecs, data); + break; + } + + return 0; +} + +static UINT8 get_file_eof(struct ti99_lvl2_fileref *l2_file) +{ + int reply = 0; + + switch (l2_file->type) + { + case L2F_DSK: + reply = l2_file->dsk.fdr.eof; + break; + + case L2F_WIN: + reply = l2_file->win.curfdr.eof; + break; + + case L2F_TIFILES: + reply = l2_file->tifiles.hdr.eof; + break; + } + + return reply; +} + +static void set_file_eof(struct ti99_lvl2_fileref *l2_file, UINT8 data) +{ + switch (l2_file->type) + { + case L2F_DSK: + l2_file->dsk.fdr.eof = data; + break; + + case L2F_WIN: + l2_file->win.curfdr.eof = data; + break; + + case L2F_TIFILES: + l2_file->tifiles.hdr.eof = data; + break; + } +} + +static UINT16 get_file_reclen(struct ti99_lvl2_fileref *l2_file) +{ + int reply = 0; + + switch (l2_file->type) + { + case L2F_DSK: + reply = l2_file->dsk.fdr.reclen; + if ((reply == 0) && (! (l2_file->dsk.fdr.flags & (fdr99_f_program /*| fdr99_f_var*/)))) + reply = get_UINT16BE(l2_file->dsk.fdr.xreclen); + break; + + case L2F_WIN: + reply = l2_file->win.curfdr.reclen; + if ((reply == 0) && (! (l2_file->win.curfdr.flags & (fdr99_f_program /*| fdr99_f_var*/)))) + reply = get_UINT16BE(l2_file->win.curfdr.xreclen); + break; + + case L2F_TIFILES: + reply = l2_file->tifiles.hdr.reclen; + break; + } + + return reply; +} + +static int set_file_reclen(struct ti99_lvl2_fileref *l2_file, UINT16 data) +{ + switch (l2_file->type) + { + case L2F_DSK: + if (data < 256) + { + l2_file->dsk.fdr.reclen = data; + set_UINT16BE(&l2_file->dsk.fdr.xreclen, 0); + } + else + { + l2_file->dsk.fdr.reclen = 0; + set_UINT16BE(&l2_file->dsk.fdr.xreclen, data); + } + break; + + case L2F_WIN: + if (data < 256) + { + l2_file->win.curfdr.reclen = data; + set_UINT16BE(&l2_file->win.curfdr.xreclen, 0); + } + else + { + l2_file->win.curfdr.reclen = 0; + set_UINT16BE(&l2_file->win.curfdr.xreclen, data); + } + break; + + case L2F_TIFILES: + if (data >= 256) + return IMGTOOLERR_UNIMPLEMENTED; + l2_file->tifiles.hdr.reclen = data; + break; + } + + return 0; +} + +static unsigned get_file_fixrecs(struct ti99_lvl2_fileref *l2_file) +{ + int reply = 0; + + switch (l2_file->type) + { + case L2F_DSK: + reply = get_UINT16LE(l2_file->dsk.fdr.fixrecs); + break; + + case L2F_WIN: + reply = get_win_fdr_fixrecs(&l2_file->win.curfdr); + break; + + case L2F_TIFILES: + reply = get_UINT16BE(l2_file->tifiles.hdr.fixrecs); + break; + } + + return reply; +} + +static int set_file_fixrecs(struct ti99_lvl2_fileref *l2_file, unsigned data) +{ + switch (l2_file->type) + { + case L2F_DSK: + if (data >= 65536) + return IMGTOOLERR_UNIMPLEMENTED; + set_UINT16LE(&l2_file->dsk.fdr.fixrecs, data); + break; + + case L2F_WIN: + set_win_fdr_fixrecs(&l2_file->win.curfdr, data); + break; + + case L2F_TIFILES: + if (data >= 65536) + return IMGTOOLERR_UNIMPLEMENTED; + set_UINT16BE(&l2_file->tifiles.hdr.fixrecs, data); + break; + } + + return 0; +} + +static void get_file_creation_date(struct ti99_lvl2_fileref *l2_file, ti99_date_time *reply) +{ + switch (l2_file->type) + { + case L2F_DSK: + *reply = l2_file->dsk.fdr.creation; + break; + + case L2F_WIN: + *reply = l2_file->win.curfdr.creation; + break; + + case L2F_TIFILES: + memset(reply, 0, sizeof(*reply)); + break; + } +} + +static void set_file_creation_date(struct ti99_lvl2_fileref *l2_file, ti99_date_time data) +{ + switch (l2_file->type) + { + case L2F_DSK: + l2_file->dsk.fdr.creation = data; + break; + + case L2F_WIN: + l2_file->win.curfdr.creation = data; + break; + + case L2F_TIFILES: + break; + } +} + +static void get_file_update_date(struct ti99_lvl2_fileref *l2_file, ti99_date_time *reply) +{ + switch (l2_file->type) + { + case L2F_DSK: + *reply = l2_file->dsk.fdr.update; + break; + + case L2F_WIN: + *reply = l2_file->win.curfdr.update; + break; + + case L2F_TIFILES: + memset(reply, 0, sizeof(*reply)); + break; + } +} + +static void set_file_update_date(struct ti99_lvl2_fileref *l2_file, ti99_date_time data) +{ + switch (l2_file->type) + { + case L2F_DSK: + l2_file->dsk.fdr.update = data; + break; + + case L2F_WIN: + l2_file->win.curfdr.update = data; + break; + + case L2F_TIFILES: + break; + } +} + +#ifdef UNUSED_FUNCTION +static void current_date_time(ti99_date_time *reply) +{ + /* All these functions should be ANSI */ + time_t cur_time = time(NULL); + struct tm expanded_time = *localtime(& cur_time); + + reply->time_MSB = (expanded_time.tm_hour << 3) | (expanded_time.tm_min >> 3); + reply->time_LSB = (expanded_time.tm_min << 5) | (expanded_time.tm_sec >> 1); + reply->date_MSB = ((expanded_time.tm_year % 100) << 1) | ((expanded_time.tm_mon+1) >> 3); + reply->date_LSB = ((expanded_time.tm_mon+1) << 5) | expanded_time.tm_mday; +} +#endif + +#if 0 +#pragma mark - +#pragma mark LEVEL 3 DISK ROUTINES +#endif + +/* + Level 3 implements files as a succession of logical records. + + There are three types of files: + * program files that are not implemented at level 3 (no logical record) + * files with fixed-size records (random-access files) + * files with variable-size records (sequential-access) +*/ + +struct ti99_lvl3_fileref +{ + ti99_lvl2_fileref l2_file; + + int cur_log_rec; + int cur_phys_rec; + int cur_pos_in_phys_rec; +}; + +#ifdef UNUSED_FUNCTION +/* + Open a file on level 3. + + To open a file on level 3, you must open (or create) the file on level 2, + then pass the file reference to open_file_lvl3. +*/ +static int open_file_lvl3(ti99_lvl3_fileref *l3_file) +{ + l3_file->cur_log_rec = 0; + l3_file->cur_phys_rec = 0; + l3_file->cur_pos_in_phys_rec = 0; + + /*if ()*/ + + return 0; +} + +/* + Test a file for EOF +*/ +static int is_eof(ti99_lvl3_fileref *l3_file) +{ + int flags = get_file_flags(&l3_file->l2_file); + int fphysrecs = get_file_fphysrecs(&l3_file->l2_file); + int fdr_eof = get_file_eof(&l3_file->l2_file); + + if (flags & fdr99_f_var) + { + return (l3_file->cur_phys_rec >= fphysrecs); + } + else + { + return ((l3_file->cur_phys_rec >= fphysrecs) + || ((l3_file->cur_phys_rec == (fphysrecs-1)) + && (l3_file->cur_pos_in_phys_rec >= (fdr_eof ? fdr_eof : 256)))); + } +} + +/* + Read next record from a file +*/ +static int read_next_record(ti99_lvl3_fileref *l3_file, void *dest, int *out_reclen) +{ + int errorcode; + UINT8 physrec_buf[256]; + int reclen; + int flags = get_file_flags(&l3_file->l2_file); + int fphysrecs = get_file_fphysrecs(&l3_file->l2_file); + int fdr_eof = get_file_eof(&l3_file->l2_file); + + if (flags & fdr99_f_program) + { + /* program files have no level-3 record */ + return IMGTOOLERR_UNEXPECTED; + } + else if (flags & fdr99_f_var) + { + /* variable-length records */ + if (is_eof(l3_file)) + return IMGTOOLERR_UNEXPECTED; + errorcode = read_file_physrec(&l3_file->l2_file, l3_file->cur_phys_rec, physrec_buf); + if (errorcode) + return errorcode; + /* read reclen */ + reclen = physrec_buf[l3_file->cur_pos_in_phys_rec]; + /* check integrity */ + if ((reclen == 0xff) || (reclen > get_file_reclen(&l3_file->l2_file)) + || ((l3_file->cur_pos_in_phys_rec + 1 + reclen) > 256)) + return IMGTOOLERR_CORRUPTIMAGE; + /* copy to buffer */ + memcpy(dest, physrec_buf + l3_file->cur_pos_in_phys_rec + 1, reclen); + l3_file->cur_pos_in_phys_rec += reclen + 1; + /* skip to next physrec if needed */ + if ((l3_file->cur_pos_in_phys_rec == 256) + || (physrec_buf[l3_file->cur_pos_in_phys_rec] == 0xff)) + { + l3_file->cur_pos_in_phys_rec = 0; + l3_file->cur_phys_rec++; + } + (* out_reclen) = reclen; + } + else + { + /* fixed len records */ + reclen = get_file_reclen(&l3_file->l2_file); + if (is_eof(l3_file)) + return IMGTOOLERR_UNEXPECTED; + if ((l3_file->cur_pos_in_phys_rec + reclen) > 256) + { + l3_file->cur_pos_in_phys_rec = 0; + l3_file->cur_phys_rec++; + } + if ((l3_file->cur_phys_rec >= fphysrecs) + || ((l3_file->cur_phys_rec == (fphysrecs-1)) + && ((l3_file->cur_pos_in_phys_rec + reclen) >= (fdr_eof ? fdr_eof : 256)))) + return IMGTOOLERR_CORRUPTIMAGE; + errorcode = read_file_physrec(&l3_file->l2_file, l3_file->cur_phys_rec, physrec_buf); + if (errorcode) + return errorcode; + memcpy(dest, physrec_buf + l3_file->cur_pos_in_phys_rec, reclen); + l3_file->cur_pos_in_phys_rec += reclen; + if (l3_file->cur_pos_in_phys_rec == 256) + { + l3_file->cur_pos_in_phys_rec = 0; + l3_file->cur_phys_rec++; + } + (* out_reclen) = reclen; + } + + return 0; +} +#endif + +#if 0 +#pragma mark - +#pragma mark IMGTOOL MODULE IMPLEMENTATION +#endif + +/* + ti99 catalog iterator, used when imgtool reads the catalog +*/ +struct dsk_iterator +{ + struct ti99_lvl2_imgref *image; + int level; + int listing_subdirs; /* true if we are listing subdirectories at current level */ + int index[2]; /* current index in the disk catalog */ + ti99_catalog *cur_catalog; /* current catalog */ +}; + +struct win_iterator +{ + struct ti99_lvl2_imgref *image; + int level; + int listing_subdirs; /* true if we are listing subdirectories at current level */ + int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */ + ti99_catalog catalog[MAX_DIR_LEVEL]; /* current catalog */ +}; + + +static imgtoolerr_t dsk_image_init_mess(imgtool_image *image, imgtool_stream *f); +static imgtoolerr_t dsk_image_init_v9t9(imgtool_image *image, imgtool_stream *f); +static imgtoolerr_t dsk_image_init_pc99_fm(imgtool_image *image, imgtool_stream *f); +static imgtoolerr_t dsk_image_init_pc99_mfm(imgtool_image *image, imgtool_stream *f); +static imgtoolerr_t win_image_init(imgtool_image *image, imgtool_stream *f); +static void ti99_image_exit(imgtool_image *img); +static void ti99_image_info(imgtool_image *img, char *string, size_t len); +static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path); +static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); +static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path); +static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); +static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *size); +static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf); +static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions); +static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const char *fpath); +static imgtoolerr_t win_image_deletefile(imgtool_partition *partition, const char *fpath); +static imgtoolerr_t dsk_image_create_mess(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions); +static imgtoolerr_t dsk_image_create_v9t9(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions); + +enum +{ + dsk_createopts_volname = 'A', + dsk_createopts_sides = 'B', + dsk_createopts_tracks = 'C', + dsk_createopts_sectors = 'D', + dsk_createopts_protection = 'E', + dsk_createopts_density = 'F' +}; + +static OPTION_GUIDE_START( dsk_create_optionguide ) + OPTION_STRING(dsk_createopts_volname, "label", "Volume name" ) + OPTION_INT(dsk_createopts_sides, "sides", "Sides" ) + OPTION_INT(dsk_createopts_tracks, "tracks", "Tracks" ) + OPTION_INT(dsk_createopts_sectors, "sectors", "Sectors (1->9 for SD, 1->18 for DD, 1->36 for HD)" ) + OPTION_INT(dsk_createopts_protection, "protection", "Protection (0 for normal, 1 for protected)" ) + OPTION_ENUM_START(dsk_createopts_density, "density", "Density" ) + OPTION_ENUM( 0, "Auto", "Auto" ) + OPTION_ENUM( 1, "SD", "Single Density" ) + OPTION_ENUM( 2, "DD", "Double Density" ) + OPTION_ENUM( 3, "HD", "High Density" ) + OPTION_ENUM_END +OPTION_GUIDE_END + +#define dsk_create_optionspecs "B1-[2];C1-[40]-80;D1-[18]-36;E[0]-1;F[0]-3" + +static void ti99_getinfo(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(ti99_lvl2_imgref); break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(dsk_iterator); break; + + case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; + case IMGTOOLINFO_PTR_CLOSE: info->close = ti99_image_exit; break; + case IMGTOOLINFO_PTR_INFO: info->info = ti99_image_info; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = ti99_image_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = ti99_image_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = ti99_image_writefile; break; + } +} + +static void ti99_dsk_getinfo(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "dsk"); break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = dsk_image_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = dsk_image_nextenum; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = dsk_image_deletefile; break; + default: ti99_getinfo(imgclass, state, info); + } +} + +void ti99_old_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti99_old"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (old MESS format)"); break; + case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_mess; break; + case IMGTOOLINFO_PTR_CREATE: info->create = dsk_image_create_mess; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = dsk_create_optionguide; break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), dsk_create_optionspecs); break; + default: ti99_dsk_getinfo(imgclass, state, info); break; + } +} + +void ti99_v9t9_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "v9t9"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (V9T9 format)"); break; + case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_v9t9; break; + case IMGTOOLINFO_PTR_CREATE: info->create = dsk_image_create_v9t9; break; + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = dsk_create_optionguide; break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), dsk_create_optionspecs); break; + default: ti99_dsk_getinfo(imgclass, state, info); break; + } +} + +void ti99_pc99fm_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc99fm"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (PC99 FM format)"); break; + case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_pc99_fm; break; + case IMGTOOLINFO_PTR_CREATE: /* info->create = dsk_image_create_pc99fm; */ break; + default: ti99_dsk_getinfo(imgclass, state, info); break; + } +} + +void ti99_pc99mfm_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc99mfm"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (PC99 MFM format)"); break; + case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_pc99_mfm; break; + case IMGTOOLINFO_PTR_CREATE: /* info->create = dsk_image_create_pc99mfm; */ break; + default: ti99_dsk_getinfo(imgclass, state, info); break; + } +} + +void ti99_ti99hd_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti99hd"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Harddisk"); break; + case IMGTOOLINFO_PTR_OPEN: info->open = win_image_init; break; + case IMGTOOLINFO_PTR_CREATE: /* info->create = hd_image_create; */ break; + + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = win_image_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = win_image_nextenum; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = win_image_deletefile; break; + default: ti99_getinfo(imgclass, state, info); + } +} + + + +/* + Open a file as a ti99_image (common code). +*/ +static int dsk_image_init(imgtool_image *img, imgtool_stream *f, ti99_img_format img_format) +{ + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + dsk_vib vib; + int reply; + int totphysrecs; + unsigned fdir_aphysrec; + int i; + + /* open disk image at level 1 */ + reply = open_image_lvl1(f, img_format, &image->l1_img, &vib); + if (reply) + return reply; + + /* open disk image at level 2 */ + image->type = L2I_DSK; + + /* @BN@ */ + /* Copy in the allocation bit map! */ + memcpy(image->abm, vib.abm, 200); + /* first compute AU size and number of AUs */ + totphysrecs = get_UINT16BE(vib.totphysrecs); + + image->AUformat.physrecsperAU = (totphysrecs + 1599) / 1600; + /* round to next larger power of 2 */ + for (i = 1; i < image->AUformat.physrecsperAU; i <<= 1) + ; + image->AUformat.physrecsperAU = i; + image->AUformat.totAUs = totphysrecs / image->AUformat.physrecsperAU; + + /* extract number of physrecs */ + image->dsk.totphysrecs = get_UINT16BE(vib.totphysrecs); + + /* read and check main volume catalog */ + reply = dsk_read_catalog(image, 1, &image->dsk.catalogs[0]); + if (reply) + return reply; + + image->dsk.fdir_aphysrec[0] = 1; + + /* read and check subdirectory catalogs */ + /* Note that the reserved areas used for HFDC subdirs may be used for other + purposes by other FDRs, so, if we get any error, we will assume there is no + subdir after all... */ + image->dsk.catalogs[0].num_subdirs = 0; + for (i=0; i<3; i++) + { + fdir_aphysrec = get_UINT16BE(vib.subdir[i].fdir_aphysrec); + if ((! memcmp(vib.subdir[i].name, "\0\0\0\0\0\0\0\0\0\0", 10)) + || (! memcmp(vib.subdir[i].name, " ", 10))) + { + /* name is empty: fine with us unless there is a fdir pointer */ + if (fdir_aphysrec != 0) + { + image->dsk.catalogs[0].num_subdirs = 0; + break; + } + } + else if (check_fname(vib.subdir[i].name)) + { + /* name is invalid: this is not an HFDC format floppy */ + image->dsk.catalogs[0].num_subdirs = 0; + break; + } + else + { + /* there is a non-empty name */ + if ((fdir_aphysrec == 0) || (fdir_aphysrec >= totphysrecs)) + { + /* error: fdir pointer is invalid or NULL */ + image->dsk.catalogs[0].num_subdirs = 0; + break; + } + /* fill in descriptor fields */ + image->dsk.fdir_aphysrec[image->dsk.catalogs[0].num_subdirs+1] = fdir_aphysrec; + /*image->dsk.catalogs[0].subdirs[image->dsk.catalogs[0].num_subdirs].dir_ptr = fdir_aphysrec;*/ + memcpy(image->dsk.catalogs[0].subdirs[image->dsk.catalogs[0].num_subdirs].name, vib.subdir[i].name, 10); + reply = dsk_read_catalog(image, fdir_aphysrec, &image->dsk.catalogs[image->dsk.catalogs[0].num_subdirs+1]); + if (reply) + { + /* error: invalid fdir */ + image->dsk.catalogs[0].num_subdirs = 0; + break; + } + /* found valid subdirectory: increment subdir count */ + image->dsk.catalogs[0].num_subdirs++; + } + } + + /* extract volume name */ + memcpy(image->vol_name, vib.name, 10); + + /* initialize default data_offset */ + image->data_offset = 32+2; + + return 0; +} + +/* + Open a file as a ti99_image (MESS format). +*/ +static imgtoolerr_t dsk_image_init_mess(imgtool_image *image, imgtool_stream *f) +{ + return (imgtoolerr_t)dsk_image_init(image, f, if_mess); +} + +/* + Open a file as a ti99_image (V9T9 format). +*/ +static imgtoolerr_t dsk_image_init_v9t9(imgtool_image *image, imgtool_stream *f) +{ + return (imgtoolerr_t)dsk_image_init(image, f, if_v9t9); +} + +/* + Open a file as a ti99_image (PC99 FM format). +*/ +static imgtoolerr_t dsk_image_init_pc99_fm(imgtool_image *image, imgtool_stream *f) +{ + return (imgtoolerr_t)dsk_image_init(image, f, if_pc99_fm); +} + +/* + Open a file as a ti99_image (PC99 MFM format). +*/ +static imgtoolerr_t dsk_image_init_pc99_mfm(imgtool_image *image, imgtool_stream *f) +{ + return (imgtoolerr_t)dsk_image_init(image, f, if_pc99_mfm); +} + +/* + Open a file as a ti99_image (harddisk format). +*/ +static imgtoolerr_t win_image_init(imgtool_image *img, imgtool_stream *f) +{ + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + win_vib_ddr vib; + int reply; + int i; + + /* open disk image at level 1 */ + reply = open_image_lvl1(f, if_harddisk, & image->l1_img, NULL); + if (reply) + return (imgtoolerr_t)reply; + + /* open disk image at level 2 */ + image->type = L2I_WIN; + + /* read VIB */ + reply = read_absolute_physrec(&image->l1_img, 0, &vib); + if (reply) + return (imgtoolerr_t)reply; + + /* guess VIB version */ + image->win.vib_version = memcmp(vib.u.vib_v1.id, "WIN", 3) ? win_vib_v2 : win_vib_v1; + + /* extract AU size and number of AUs */ + image->AUformat.physrecsperAU = ((get_UINT16BE(vib.params) >> 12) & 0xf) + 1; + image->AUformat.totAUs = get_UINT16BE(vib.totAUs); + + /* extract volume name */ + memcpy(image->vol_name, vib.name, 10); + + /* extract data_offset */ + switch (image->win.vib_version) + { + case win_vib_v1: + image->data_offset = 64; + break; + + case win_vib_v2: + image->data_offset = vib.u.vib_v2.res_AUs * 64; + break; + } + + /* read allocation bitmap (aphysrecs 1 through n, n<=33) */ + for (i=0; i < (image->AUformat.totAUs+2047)/2048; i++) + { + reply = read_absolute_physrec(&image->l1_img, i+1, image->abm+i*256); + if (reply) + return (imgtoolerr_t)reply; + } + + return (imgtoolerr_t)0; +} + +/* + close a ti99_image +*/ +static void ti99_image_exit(imgtool_image *img) +{ + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + + close_image_lvl1(&image->l1_img); +} + +/* + get basic information on a ti99_image + + Currently returns the volume name +*/ +static void ti99_image_info(imgtool_image *img, char *string, size_t len) +{ + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + char vol_name[11]; + + fname_to_str(vol_name, image->vol_name, 11); + + snprintf(string, len, "%s", vol_name); +} + +/* + Open the disk catalog for enumeration +*/ +static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path) +{ + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(imgtool_directory_image(enumeration)); + dsk_iterator *iter = (dsk_iterator *) imgtool_directory_extrabytes(enumeration); + + iter->image = image; + iter->level = 0; + iter->listing_subdirs = 1; + iter->index[0] = 0; + iter->cur_catalog = &iter->image->dsk.catalogs[0]; + + return (imgtoolerr_t)0; +} + +/* + Enumerate disk catalog next entry +*/ +static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + dsk_iterator *iter = (dsk_iterator*) imgtool_directory_extrabytes(enumeration); + dsk_fdr fdr; + int reply; + unsigned fdr_aphysrec; + + + ent->corrupt = 0; + ent->eof = 0; + + /* iterate through catalogs to next file or dir entry */ + while ((iter->level >= 0) + && (iter->index[iter->level] >= (iter->listing_subdirs + ? iter->cur_catalog->num_subdirs + : iter->cur_catalog->num_files))) + { + if (iter->listing_subdirs) + { + iter->listing_subdirs = 0; + iter->index[iter->level] = 0; + } + else + { + iter->listing_subdirs = 1; + if (! iter->level) + iter->level = -1; + else + { + iter->level = 0; + iter->index[0]++; + iter->cur_catalog = &iter->image->dsk.catalogs[0]; + } + } + } + + if (iter->level < 0) + { + ent->eof = 1; + } + else + { + if (iter->listing_subdirs) + { + fname_to_str(ent->filename, iter->image->dsk.catalogs[0].subdirs[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename)); + + /* set type of DIR */ + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "DIR"); + + /* len in physrecs */ + /* @BN@ return length in bytes */ + /* ent->filesize = 1; */ + ent->filesize = 256; + + /* recurse subdirectory */ + iter->listing_subdirs = 0; /* no need to list subdirs as only the + root dir has subdirs in DSK format */ + iter->level = 1; + iter->cur_catalog = &iter->image->dsk.catalogs[iter->index[0]+1]; + iter->index[iter->level] = 0; + } + else + { + fdr_aphysrec = iter->cur_catalog->files[iter->index[iter->level]].fdr_ptr; + reply = read_absolute_physrec(& iter->image->l1_img, fdr_aphysrec, & fdr); + if (reply) + return IMGTOOLERR_READERROR; +#if 0 + fname_to_str(ent->filename, fdr.name, ARRAY_LENGTH(ent->filename)); +#else + { + char buf[11]; + + ent->filename[0] = '\0'; + if (iter->level) + { + fname_to_str(ent->filename, iter->image->dsk.catalogs[0].subdirs[iter->index[0]].name, ARRAY_LENGTH(ent->filename)); + strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1); + } + fname_to_str(buf, fdr.name, 11); + strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); + } +#endif + /* parse flags */ + if (fdr.flags & fdr99_f_program) + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "PGM%s", + (fdr.flags & fdr99_f_wp) ? " R/O" : ""); + else + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c/%c %d%s", + (fdr.flags & fdr99_f_int) ? 'I' : 'D', + (fdr.flags & fdr99_f_var) ? 'V' : 'F', + fdr.reclen, + (fdr.flags & fdr99_f_wp) ? " R/O" : ""); + /* len in physrecs */ + /* @BN@ return length in bytes */ + /* ent->filesize = get_UINT16BE(fdr.fphysrecs); */ + ent->filesize = (get_UINT16BE(fdr.fphysrecs)+1)*256; + + iter->index[iter->level]++; + } + } + + return (imgtoolerr_t)0; +} + +/* + Open the disk catalog for enumeration +*/ +static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path) +{ + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(imgtool_directory_image(enumeration)); + win_iterator *iter = (win_iterator *) imgtool_directory_extrabytes(enumeration); + imgtoolerr_t errorcode; + + iter->image = image; + iter->level = 0; + iter->listing_subdirs = 1; + iter->index[0] = 0; + errorcode = (imgtoolerr_t)win_read_catalog(image, 0, &iter->catalog[0]); + if (errorcode) + return errorcode; + + return (imgtoolerr_t)0; +} + +/* + Enumerate disk catalog next entry +*/ +static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + win_iterator *iter = (win_iterator *) imgtool_directory_extrabytes(enumeration); + unsigned fdr_aphysrec; + win_fdr fdr; + int reply; + int i; + + + ent->corrupt = 0; + ent->eof = 0; + + /* iterate through catalogs to next file or dir entry */ + while ((iter->level >= 0) + && (iter->index[iter->level] >= (iter->listing_subdirs + ? iter->catalog[iter->level].num_subdirs + : iter->catalog[iter->level].num_files))) + { + if (iter->listing_subdirs) + { + iter->listing_subdirs = 0; + iter->index[iter->level] = 0; + } + else + { + iter->listing_subdirs = 1; + iter->level--; + iter->index[iter->level]++; + } + } + + if (iter->level < 0) + { + ent->eof = 1; + } + else + { + if (iter->listing_subdirs) + { +#if 0 + fname_to_str(ent->filename, iter->catalog[iter->level].subdirs[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename)); +#else + { + char buf[11]; + + ent->filename[0] = '\0'; + for (i=0; ilevel; i++) + { + fname_to_str(buf, iter->catalog[i].subdirs[iter->index[i]].name, 11); + strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); + strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1); + } + fname_to_str(buf, iter->catalog[iter->level].subdirs[iter->index[iter->level]].name, 11); + strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); + } +#endif + + /* set type of DIR */ + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "DIR"); + + /* len in physrecs */ + /* @BN@ return length in bytes */ + /* ent->filesize = 2; */ + ent->filesize = 512; + + /* recurse subdirectory */ + /*iter->listing_subdirs = 1;*/ + iter->level++; + iter->index[iter->level] = 0; + reply = win_read_catalog(iter->image, iter->catalog[iter->level-1].subdirs[iter->index[iter->level-1]].dir_ptr, &iter->catalog[iter->level]); + if (reply) + { + ent->corrupt = 1; + return (imgtoolerr_t)reply; + } + } + else + { + fdr_aphysrec = iter->catalog[iter->level].files[iter->index[iter->level]].fdr_ptr*iter->image->AUformat.physrecsperAU; + reply = read_absolute_physrec(& iter->image->l1_img, fdr_aphysrec, & fdr); + if (reply) + return IMGTOOLERR_READERROR; +#if 0 + fname_to_str(ent->filename, iter->catalog[iter->level].files[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename)); +#else + { + char buf[11]; + + ent->filename[0] = '\0'; + for (i=0; ilevel; i++) + { + fname_to_str(buf, iter->catalog[i].subdirs[iter->index[i]].name, 11); + strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); + strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1); + } + fname_to_str(buf, iter->catalog[iter->level].files[iter->index[iter->level]].name, 11); + strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); + } +#endif + /* parse flags */ + if (fdr.flags & fdr99_f_program) + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "PGM%s", + (fdr.flags & fdr99_f_wp) ? " R/O" : ""); + else + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c/%c %d%s", + (fdr.flags & fdr99_f_int) ? 'I' : 'D', + (fdr.flags & fdr99_f_var) ? 'V' : 'F', + fdr.reclen, + (fdr.flags & fdr99_f_wp) ? " R/O" : ""); + /* len in physrecs */ + /* @BN@ return length in bytes */ + /* ent->filesize = get_win_fdr_fphysrecs(&fdr); */ + ent->filesize = (get_win_fdr_fphysrecs(&fdr)+1)*256; + + iter->index[iter->level]++; + } + } + + return (imgtoolerr_t)0; +} + +/* + Compute free space on disk image (in AUs) +*/ +static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtool_image *img = imgtool_partition_image(partition); + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + size_t freeAUs; + int i; + + freeAUs = 0; + for (i=0; iAUformat.totAUs; i++) + { + if (! (image->abm[i >> 3] & (1 << (i & 7)))) + freeAUs++; + } + + /* @BN@ return free space in bytes */ + /* *size = freeAUs; */ + *size = freeAUs*256; + + return IMGTOOLERR_SUCCESS; +} + +/* + Extract a file from a ti99_image. The file is saved in tifile format. +*/ +static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf) +{ + imgtool_image *img = imgtool_partition_image(partition); +#if 1 + + /* extract data as TIFILES */ + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + ti99_lvl2_fileref src_file; + ti99_lvl2_fileref dst_file; + ti99_date_time date_time; + int fphysrecs; + int i; + UINT8 buf[256]; + imgtoolerr_t errorcode; + + + if (check_fpath(fpath)) + return IMGTOOLERR_BADFILENAME; + + /* open file on TI image */ + switch (image->type) + { + case L2I_DSK: + errorcode = (imgtoolerr_t)open_file_lvl2_dsk(image, fpath, &src_file); + break; + + case L2I_WIN: + errorcode = (imgtoolerr_t)open_file_lvl2_win(image, fpath, &src_file); + break; + + default: + errorcode = (imgtoolerr_t)-1; + break; + } + if (errorcode) + return errorcode; + + errorcode = (imgtoolerr_t)new_file_lvl2_tifiles(destf, &dst_file); + if (errorcode) + return errorcode; + + /* write TIFILE header */ + /* set up parameters */ + set_file_flags(&dst_file, get_file_flags(&src_file)); + set_file_recsperphysrec(&dst_file, get_file_recsperphysrec(&src_file)); + errorcode = (imgtoolerr_t)set_file_fphysrecs(&dst_file, get_file_fphysrecs(&src_file)); + if (errorcode) + return errorcode; + set_file_eof(&dst_file, get_file_eof(&src_file)); + errorcode = (imgtoolerr_t)set_file_reclen(&dst_file, get_file_reclen(&src_file)); + if (errorcode) + return errorcode; + errorcode = (imgtoolerr_t)set_file_fixrecs(&dst_file, get_file_fixrecs(&src_file)); + if (errorcode) + return errorcode; + + get_file_creation_date(&src_file, &date_time); +#if 0 + if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) + || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) + current_date_time(&date_time); +#endif + set_file_creation_date(&dst_file, date_time); + + get_file_update_date(&src_file, &date_time); +#if 0 + if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) + || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) + current_date_time(&date_time); +#endif + set_file_update_date(&dst_file, date_time); + + if (stream_write(destf, & dst_file.tifiles.hdr, 128) != 128) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + + /* copy data to TIFILE */ + fphysrecs = get_file_fphysrecs(&src_file); + + for (i=0; itype) + { + case L2I_DSK: + errorcode = open_file_lvl2_dsk(image, fpath, &src_file.l2_file); + break; + + case L2I_WIN: + errorcode = open_file_lvl2_win(image, fpath, &src_file.l2_file); + break; + } + if (errorcode) + return errorcode; + + errorcode = open_file_lvl3(& src_file); + if (errorcode) + return errorcode; + + /* write text data */ + while (! is_eof(& src_file)) + { + errorcode = read_next_record(& src_file, buf, & reclen); + if (errorcode) + return errorcode; + if (stream_write(destf, buf, reclen) != reclen) + return IMGTOOLERR_WRITEERROR; + if (stream_write(destf, &lineend, 1) != 1) + return IMGTOOLERR_WRITEERROR; + } + + return 0; + +#endif +} + +/* + Add a file to a ti99_image. The file must be in tifile format. +*/ +static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) +{ + imgtool_image *img = imgtool_partition_image(partition); + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + const char *filename; + char ti_fname[10]; + ti99_lvl2_fileref src_file; + ti99_lvl2_fileref dst_file; + ti99_date_time date_time; + int i; + int fphysrecs; + UINT8 buf[256]; + imgtoolerr_t errorcode; + int parent_ref_valid, parent_ref = 0; + ti99_catalog *catalog, catalog_buf = {0, }; + + + (void) writeoptions; + + if (check_fpath(fpath)) + return IMGTOOLERR_BADFILENAME; + + switch (image->type) + { + case L2I_DSK: + errorcode = (imgtoolerr_t)dsk_find_catalog_entry(image, fpath, &parent_ref_valid, &parent_ref, NULL, NULL); + if (errorcode == 0) + /* file already exists: causes an error for now */ + return (imgtoolerr_t)IMGTOOLERR_UNEXPECTED; + else if ((! parent_ref_valid) || (errorcode != IMGTOOLERR_FILENOTFOUND)) + return (imgtoolerr_t)errorcode; + break; + + case L2I_WIN: + errorcode = (imgtoolerr_t)win_find_catalog_entry(image, fpath, &parent_ref_valid, &parent_ref, &catalog_buf, NULL, NULL); + if (errorcode == 0) + /* file already exists: causes an error for now */ + return (imgtoolerr_t)IMGTOOLERR_UNEXPECTED; + else if ((! parent_ref_valid) || (errorcode != IMGTOOLERR_FILENOTFOUND)) + return (imgtoolerr_t)errorcode; + break; + } + + errorcode =(imgtoolerr_t) open_file_lvl2_tifiles(sourcef, & src_file); + if (errorcode) + return (imgtoolerr_t)errorcode; + + /* create new file */ + filename = strrchr(fpath, '.'); + if (filename) + filename++; + else + filename = fpath; + str_to_fname(ti_fname, filename); + switch (image->type) + { + case L2I_DSK: + errorcode = (imgtoolerr_t)new_file_lvl2_dsk(image, parent_ref, ti_fname, &dst_file); + if (errorcode) + return (imgtoolerr_t)errorcode; + break; + + case L2I_WIN: + errorcode = (imgtoolerr_t)new_file_lvl2_win(image, &catalog_buf, ti_fname, &dst_file); + if (errorcode) + return (imgtoolerr_t)errorcode; + break; + } + + /* set up parameters */ + set_file_flags(&dst_file, get_file_flags(&src_file)); + set_file_recsperphysrec(&dst_file, get_file_recsperphysrec(&src_file)); + errorcode = (imgtoolerr_t)set_file_fphysrecs(&dst_file, /*get_file_fphysrecs(&src_file)*/0); + if (errorcode) + return (imgtoolerr_t)errorcode; + set_file_eof(&dst_file, get_file_eof(&src_file)); + errorcode = (imgtoolerr_t)set_file_reclen(&dst_file, get_file_reclen(&src_file)); + if (errorcode) + return (imgtoolerr_t)errorcode; + errorcode = (imgtoolerr_t)set_file_fixrecs(&dst_file, get_file_fixrecs(&src_file)); + if (errorcode) + return (imgtoolerr_t)errorcode; + + get_file_creation_date(&src_file, &date_time); +#if 0 + if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) + || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) + current_date_time(&date_time); +#endif + set_file_creation_date(&dst_file, date_time); + + get_file_update_date(&src_file, &date_time); +#if 0 + if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) + || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) + current_date_time(&date_time); +#endif + set_file_update_date(&dst_file, date_time); + + /* alloc data physrecs */ + fphysrecs = get_file_fphysrecs(&src_file); + switch (dst_file.type) + { + case L2F_DSK: + errorcode = (imgtoolerr_t)dsk_alloc_file_physrecs(&dst_file.dsk, fphysrecs); + if (errorcode) + return (imgtoolerr_t)errorcode; + break; + + case L2F_WIN: + errorcode = (imgtoolerr_t)win_alloc_file_physrecs(&dst_file.win, fphysrecs); + if (errorcode) + return (imgtoolerr_t)errorcode; + break; + + case L2F_TIFILES: + break; + } + + /* copy data */ + for (i=0; itype) + { + case L2I_DSK: + if (write_absolute_physrec(& image->l1_img, dst_file.dsk.fdr_aphysrec, &dst_file.dsk.fdr)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + break; + + case L2I_WIN: + /* save fphysrecs field as well */ + if (dst_file.win.curfdr_aphysrec == dst_file.win.eldestfdr_aphysrec) + set_win_fdr_fphysrecs(&dst_file.win.curfdr, dst_file.win.fphysrecs); + if (write_absolute_physrec(& image->l1_img, dst_file.win.curfdr_aphysrec, &dst_file.win.curfdr)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + if (dst_file.win.curfdr_aphysrec != dst_file.win.eldestfdr_aphysrec) + { + dst_file.win.curfdr_aphysrec = dst_file.win.eldestfdr_aphysrec; + if (read_absolute_physrec(& image->l1_img, dst_file.win.curfdr_aphysrec, &dst_file.win.curfdr)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + set_win_fdr_fphysrecs(&dst_file.win.curfdr, dst_file.win.fphysrecs); + if (write_absolute_physrec(& image->l1_img, dst_file.win.curfdr_aphysrec, &dst_file.win.curfdr)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + } + break; + } + + /* update catalog */ + switch (image->type) + { + case L2I_DSK: + catalog = &image->dsk.catalogs[parent_ref]; + for (i=0; i<128; i++) + { + buf[2*i] = catalog->files[i].fdr_ptr >> 8; + buf[2*i+1] = catalog->files[i].fdr_ptr & 0xff; + } + if (write_absolute_physrec(& image->l1_img, image->dsk.fdir_aphysrec[parent_ref], buf)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + break; + + case L2I_WIN: + { + win_vib_ddr parent_ddr; + int fdir_AU; + + /* update VIB/DDR and get FDIR AU address */ + if (read_absolute_physrec(& image->l1_img, parent_ref * image->AUformat.physrecsperAU, &parent_ddr)) + return (imgtoolerr_t)IMGTOOLERR_READERROR; + parent_ddr.num_files = catalog_buf.num_files; + if (write_absolute_physrec(& image->l1_img, parent_ref * image->AUformat.physrecsperAU, &parent_ddr)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + fdir_AU = get_UINT16BE(parent_ddr.fdir_AU); + + /* generate FDIR and save it */ + for (i=0; i<127; i++) + { + buf[2*i] = catalog_buf.files[i].fdr_ptr >> 8; + buf[2*i+1] = catalog_buf.files[i].fdr_ptr & 0xff; + } + buf[254] = parent_ref >> 8; + buf[255] = parent_ref & 0xff; + if (write_absolute_physrec(& image->l1_img, fdir_AU * image->AUformat.physrecsperAU, buf)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + } + break; + } + + /* update bitmap */ + switch (image->type) + { + case L2I_DSK: + { + dsk_vib vib; + + if (read_absolute_physrec(& image->l1_img, 0, &vib)) + return (imgtoolerr_t)IMGTOOLERR_READERROR; + memcpy(vib.abm, image->abm, 200); + if (write_absolute_physrec(& image->l1_img, 0, &vib)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + } + break; + + case L2I_WIN: + /* save allocation bitmap (aphysrecs 1 through n, n<=33) */ + for (i=0; i < (image->AUformat.totAUs+2047)/2048; i++) + if (write_absolute_physrec(&image->l1_img, i+1, image->abm+i*256)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + break; + } + + return (imgtoolerr_t)0; +} + +/* + Delete a file from a ti99_image. +*/ +static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const char *fpath) +{ + imgtool_image *img = imgtool_partition_image(partition); + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + dsk_fdr fdr; + int i, cluster_index; + unsigned cur_AU, cluster_lastfphysrec; +// int fphysrecs; + int parent_ref, is_dir, catalog_index; + imgtoolerr_t errorcode; + UINT8 buf[256]; + ti99_catalog *catalog; + + + if (check_fpath(fpath)) + return IMGTOOLERR_BADFILENAME; + + errorcode = (imgtoolerr_t)dsk_find_catalog_entry(image, fpath, NULL, &parent_ref, &is_dir, &catalog_index); + if (errorcode) + return errorcode; + + if (is_dir) + { + catalog = &image->dsk.catalogs[catalog_index+1]; + + if ((catalog->num_files != 0) || (catalog->num_subdirs != 0)) + return IMGTOOLERR_UNIMPLEMENTED; + + catalog = &image->dsk.catalogs[0]; + + /* free fdir AU */ + cur_AU = image->dsk.fdir_aphysrec[catalog_index+1] / image->AUformat.physrecsperAU; + image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); + + /* delete catalog entry */ + for (i=catalog_index; i<2; i++) + { + catalog->subdirs[i] = catalog->subdirs[i+1]; + image->dsk.fdir_aphysrec[i+1] = image->dsk.fdir_aphysrec[i+2]; + } + memset(catalog->subdirs[2].name, 0, 10); + catalog->subdirs[2].dir_ptr = 0; + image->dsk.fdir_aphysrec[3] = 0; + catalog->num_subdirs--; + + /* update directory and bitmap in vib */ + { + dsk_vib vib; + + if (read_absolute_physrec(& image->l1_img, 0, &vib)) + return IMGTOOLERR_READERROR; + + for (i=0; i<3; i++) + { + memcpy(vib.subdir[i].name, catalog->subdirs[i].name, 10); + set_UINT16BE(&vib.subdir[i].fdir_aphysrec, image->dsk.fdir_aphysrec[i+1]); + } + + memcpy(vib.abm, image->abm, 200); + + if (write_absolute_physrec(& image->l1_img, 0, &vib)) + return IMGTOOLERR_WRITEERROR; + } + } + else + { + catalog = &image->dsk.catalogs[parent_ref]; + + if (read_absolute_physrec(& image->l1_img, catalog->files[catalog_index].fdr_ptr, &fdr)) + return IMGTOOLERR_READERROR; + + /* free data AUs */ +// fphysrecs = + get_UINT16BE(fdr.fphysrecs); + + i = 0; + cluster_index = 0; + while (cluster_index < 76) + { + cur_AU = get_dsk_fdr_cluster_baseAU(image, & fdr, cluster_index); + if (cur_AU == 0) + /* end of cluster list */ + break; + cluster_lastfphysrec = get_dsk_fdr_cluster_lastfphysrec(& fdr, cluster_index); + + while (i<=cluster_lastfphysrec) + { + /* the condition below is an error, but it should not prevent + us from deleting the file */ + if (cur_AU >= image->AUformat.totAUs) + /*return IMGTOOLERR_CORRUPTIMAGE;*/ + break; + + image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); + + i += image->AUformat.physrecsperAU; + cur_AU++; + } + + cluster_index++; + } + /* the condition below is an error, but it should not prevent us from + deleting the file */ +#if 0 + if (ifiles[catalog_index].fdr_ptr / image->AUformat.physrecsperAU; + image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); + + /* delete catalog entry */ + for (i=catalog_index; i<127; i++) + catalog->files[i] = catalog->files[i+1]; + catalog->files[127].fdr_ptr = 0; + catalog->num_files--; + + /* update parent fdir */ + for (i=0; i<128; i++) + { + buf[2*i] = catalog->files[i].fdr_ptr >> 8; + buf[2*i+1] = catalog->files[i].fdr_ptr & 0xff; + } + if (write_absolute_physrec(& image->l1_img, image->dsk.fdir_aphysrec[parent_ref], buf)) + return IMGTOOLERR_WRITEERROR; + + /* update bitmap */ + { + dsk_vib vib; + + if (read_absolute_physrec(& image->l1_img, 0, &vib)) + return IMGTOOLERR_READERROR; + memcpy(vib.abm, image->abm, 200); + if (write_absolute_physrec(& image->l1_img, 0, &vib)) + return IMGTOOLERR_WRITEERROR; + } + } + + return (imgtoolerr_t)0; +} + +static imgtoolerr_t win_image_deletefile(imgtool_partition *partition, const char *fpath) +{ + imgtool_image *img = imgtool_partition_image(partition); + struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); + int parent_ddr_AU, is_dir, catalog_index; + win_fdr fdr; + int i; + unsigned cur_AU, end_AU; + unsigned curfdr_aphysrec; + unsigned cursibFDR_index, endsibFDR_index = 0; + int errorcode; + UINT8 buf[256]; + ti99_catalog catalog; + + + if (check_fpath(fpath)) + return (imgtoolerr_t)IMGTOOLERR_BADFILENAME; + + errorcode = win_find_catalog_entry(image, fpath, NULL, &parent_ddr_AU, &catalog, &is_dir, &catalog_index); + if (errorcode) + return (imgtoolerr_t)errorcode; + + if (is_dir) + { + unsigned DDR_AU; + win_vib_ddr ddr_buf; + + /* Read DDR record */ + DDR_AU = catalog.subdirs[catalog_index].dir_ptr; + if (read_absolute_physrec(& image->l1_img, DDR_AU*image->AUformat.physrecsperAU, &ddr_buf)) + return (imgtoolerr_t)IMGTOOLERR_READERROR; + + /* read FDIR AU pointer */ + cur_AU = get_UINT16BE(ddr_buf.fdir_AU); + + /* sanity checks */ + if ((ddr_buf.num_files > 127) || (ddr_buf.num_subdirs > 114) || (cur_AU > image->AUformat.totAUs)) + return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; + + if ((ddr_buf.num_files != 0) || (ddr_buf.num_subdirs != 0)) + return (imgtoolerr_t)IMGTOOLERR_UNIMPLEMENTED; + + /* free fdir AU */ + image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); + + /* free ddr AU */ + image->abm[DDR_AU >> 3] &= ~ (1 << (DDR_AU & 7)); + + /* delete parent catalog entry */ + for (i=catalog_index; i<113; i++) + catalog.subdirs[i] = catalog.subdirs[i+1]; + catalog.subdirs[113].dir_ptr = 0; + catalog.num_subdirs--; + + /* update parent VIB/DDR */ + if (read_absolute_physrec(& image->l1_img, parent_ddr_AU * image->AUformat.physrecsperAU, &ddr_buf)) + return (imgtoolerr_t)IMGTOOLERR_READERROR; + ddr_buf.num_subdirs = catalog.num_subdirs; + for (i=0; i<114; i++) + set_UINT16BE(&ddr_buf.subdir_AU[i], catalog.subdirs[i].dir_ptr); + if (write_absolute_physrec(& image->l1_img, parent_ddr_AU * image->AUformat.physrecsperAU, &ddr_buf)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + + /* save allocation bitmap (aphysrecs 1 through n, n<=33) */ + for (i=0; i < (image->AUformat.totAUs+2047)/2048; i++) + if (write_absolute_physrec(&image->l1_img, i+1, image->abm+i*256)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + } + else + { + /* check integrity of FDR sibling chain, and go to last sibling */ + /* note that as we check that the back chain is consistent with the forward + chain, we will also detect any cycle in the sibling chain, so we do not + need to check against them explicitely */ + { + int pastendoflist_flag; + unsigned prevfdr_aphysrec; + + + pastendoflist_flag = 0; + cursibFDR_index = 0; + curfdr_aphysrec = catalog.files[catalog_index].fdr_ptr * image->AUformat.physrecsperAU; + if (read_absolute_physrec(& image->l1_img, curfdr_aphysrec, &fdr)) + return (imgtoolerr_t)IMGTOOLERR_READERROR; + + if (get_UINT16BE(fdr.prevsibFDR_AU) != 0) + return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; + + while (1) + { + if (! pastendoflist_flag) + { + /* look for end of list */ + for (i=0; i<54; i++) + { + if (get_UINT16BE(fdr.clusters[i][0]) == 0) + { + endsibFDR_index = cursibFDR_index; + pastendoflist_flag = TRUE; + break; + } + } + } + + /* exit loop if end of sibling chain */ + if (! get_UINT16BE(fdr.nextsibFDR_AU)) + break; + + /* otherwise read next FDR */ + if (get_UINT16BE(fdr.nextsibFDR_AU) >= image->AUformat.totAUs) + return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; + + prevfdr_aphysrec = curfdr_aphysrec; + curfdr_aphysrec = get_win_fdr_nextsibFDR_aphysrec(image, &fdr); + if (read_absolute_physrec(& image->l1_img, curfdr_aphysrec, &fdr)) + return (imgtoolerr_t)IMGTOOLERR_READERROR; + cursibFDR_index++; + + /* check that back chaining is consistent with forward chaining */ + if (get_win_fdr_prevsibFDR_aphysrec(image, &fdr) != prevfdr_aphysrec) + return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; + } + if (! pastendoflist_flag) + endsibFDR_index = cursibFDR_index; + } + + + while (1) + { + if (cursibFDR_index <= endsibFDR_index) + { + for (i = 0; i < 54; i++) + { + cur_AU = get_UINT16BE(fdr.clusters[i][0]); + if (cur_AU == 0) + /* end of cluster list */ + break; + end_AU = get_UINT16BE(fdr.clusters[i][1]); + + while (cur_AU<=end_AU) + { + /* the condition below is an error, but it should not prevent + us from deleting the file */ + if (cur_AU >= image->AUformat.totAUs) + /*return IMGTOOLERR_CORRUPTIMAGE;*/ + break; + + image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); + + cur_AU++; + } + } + } + + /* free fdr AU if applicable */ + if ((curfdr_aphysrec % image->AUformat.physrecsperAU) == 0) + { + cur_AU = curfdr_aphysrec / image->AUformat.physrecsperAU; + image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); + } + + if (cursibFDR_index == 0) + break; + curfdr_aphysrec = get_win_fdr_prevsibFDR_aphysrec(image, &fdr); + if (read_absolute_physrec(& image->l1_img, curfdr_aphysrec, &fdr)) + return (imgtoolerr_t)IMGTOOLERR_READERROR; + cursibFDR_index--; + } + + + /* delete catalog entry */ + for (i=catalog_index; i<127; i++) + catalog.files[i] = catalog.files[i+1]; + catalog.files[127].fdr_ptr = 0; + catalog.num_files--; + + + /* update VIB/DDR and get FDIR AU address */ + { + win_vib_ddr parent_ddr; + + if (read_absolute_physrec(& image->l1_img, parent_ddr_AU * image->AUformat.physrecsperAU, &parent_ddr)) + return (imgtoolerr_t)IMGTOOLERR_READERROR; + parent_ddr.num_files = catalog.num_files; + if (write_absolute_physrec(& image->l1_img, parent_ddr_AU * image->AUformat.physrecsperAU, &parent_ddr)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + cur_AU = get_UINT16BE(parent_ddr.fdir_AU); + } + + /* generate FDIR and save it */ + for (i=0; i<127; i++) + { + buf[2*i] = catalog.files[i].fdr_ptr >> 8; + buf[2*i+1] = catalog.files[i].fdr_ptr & 0xff; + } + buf[254] = parent_ddr_AU >> 8; + buf[255] = parent_ddr_AU & 0xff; + if (write_absolute_physrec(& image->l1_img, cur_AU * image->AUformat.physrecsperAU, buf)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + + /* save allocation bitmap (aphysrecs 1 through n, n<=33) */ + for (i=0; i < (image->AUformat.totAUs+2047)/2048; i++) + if (write_absolute_physrec(&image->l1_img, i+1, image->abm+i*256)) + return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; + } + + return (imgtoolerr_t)0; +} + +/* + Create a blank ti99_image (common code). + + Supports MESS and V9T9 formats only +*/ +static imgtoolerr_t dsk_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions, ti99_img_format img_format) +{ + const char *volname; + int density; + ti99_lvl1_imgref l1_img; + int protected_var; + + int totphysrecs, physrecsperAU, totAUs; + + dsk_vib vib; + UINT8 empty_sec[256]; + + int i; + + l1_img.img_format = img_format; + l1_img.file_handle = f; + + /* read options */ + volname = option_resolution_lookup_string(createoptions, dsk_createopts_volname); + l1_img.geometry.heads = option_resolution_lookup_int(createoptions, dsk_createopts_sides); + l1_img.geometry.cylinders = option_resolution_lookup_int(createoptions, dsk_createopts_tracks); + l1_img.geometry.secspertrack = option_resolution_lookup_int(createoptions, dsk_createopts_sectors); + protected_var = option_resolution_lookup_int(createoptions, dsk_createopts_protection); + density = option_resolution_lookup_int(createoptions, dsk_createopts_density); + + /* NPW 03-DEC-2003 - Fixes a crash if volname is NULL */ + if (!volname) + volname = ""; + + totphysrecs = l1_img.geometry.secspertrack * l1_img.geometry.cylinders * l1_img.geometry.heads; + physrecsperAU = (totphysrecs + 1599) / 1600; + /* round to next larger power of 2 */ + for (i = 1; i < physrecsperAU; i <<= 1) + ; + physrecsperAU = i; + totAUs = totphysrecs / physrecsperAU; + + /* auto-density */ + if (density == 0) + { + if (l1_img.geometry.secspertrack <= 9) + density = 1; + else if (l1_img.geometry.secspertrack <= 18) + density = 2; + else + density = 3; + } + + /* check volume name */ + if (strchr(volname, '.') || strchr(volname, ' ') || (strlen(volname) > 10)) + return /*IMGTOOLERR_BADFILENAME*/IMGTOOLERR_PARAMCORRUPT; + + /* FM disks can hold fewer sector per track than MFM disks */ + if ((density == 1) && (l1_img.geometry.secspertrack > 9)) + return IMGTOOLERR_PARAMTOOLARGE; + + /* DD disks can hold fewer sector per track than HD disks */ + if ((density == 2) && (l1_img.geometry.secspertrack > 18)) + return IMGTOOLERR_PARAMTOOLARGE; + + /* check total disk size */ + if (totphysrecs < 2) + return IMGTOOLERR_PARAMTOOSMALL; + + /* initialize vib in aphysrec 0 */ + + /* set volume name */ + str_to_fname(vib.name, volname); + + /* set every header field */ + set_UINT16BE(& vib.totphysrecs, totphysrecs); + vib.secspertrack = l1_img.geometry.secspertrack; + vib.id[0] = 'D'; + vib.id[1] = 'S'; + vib.id[2] = 'K'; + vib.protection = protected_var ? 'P' : ' '; + vib.cylinders = l1_img.geometry.cylinders; + vib.heads = l1_img.geometry.heads; + vib.density = density; + for (i=0; i<3; i++) + { + memset(vib.subdir[i].name, '\0', 10); + set_UINT16BE(& vib.subdir[i].fdir_aphysrec, 0); + } + + /* clear bitmap */ + for (i=0; i < (totAUs>>3); i++) + vib.abm[i] = 0; + + if (totAUs & 7) + { + vib.abm[i] = 0xff << (totAUs & 7); + i++; + } + + for (; i < 200; i++) + vib.abm[i] = 0xff; + + /* mark first 2 aphysrecs (vib and fdir) as used */ + vib.abm[0] |= (physrecsperAU == 1) ? 3 : 1; + + /* write aphysrec 0 */ + if (write_absolute_physrec(& l1_img, 0, &vib)) + return IMGTOOLERR_WRITEERROR; + + + /* now clear every other physrecs, including the FDIR record */ + memset(empty_sec, 0, sizeof(empty_sec)); + + for (i=1; i +#include +#include +#include +#include "imgtool.h" + +/* Max sector length is bytes. Generally 256, except for a few older disk +units which use 288-byte-long sectors, and SCSI units which generally use +standard 512-byte-long sectors. */ +/* I chose a limit of 512. No need to use more until someone creates CD-ROMs +for TI990. */ +#define MAX_SECTOR_SIZE 512 +#define MIN_SECTOR_SIZE 256 + +#define MAX_CYLINDERS 2047 +#define MAX_HEADS 31 +#define MAX_SECTORS_PER_TRACK 256 /* 255 for 512-byte-long sector, so that the total number of words that can be recorded on a track may fit in one 16-bit word (store registers command) */ + +/* Max path len in chars: this value is 48 characters in DX10, but since the +path includes at least a leading '.', our value is 47. */ +/* Since path generally include a volume name that can be up to 8 character +long, we should display a warning message when the user wants to create a path +that is longer than 39 characters. */ +#define MAX_PATH_LEN 47 +#define MAX_SAFE_PATH_LEN 39 + +#define MAX_DIR_LEVEL 25 /* We need to put a recursion limit to avoid endless recursion hazard */ + + +struct UINT16BE +{ + UINT8 bytes[2]; +}; + +struct UINT32BE +{ + UINT8 bytes[4]; +}; + +INLINE UINT16 get_UINT16BE(UINT16BE word) +{ + return (word.bytes[0] << 8) | word.bytes[1]; +} + +INLINE void set_UINT16BE(UINT16BE *word, UINT16 data) +{ + word->bytes[0] = (data >> 8) & 0xff; + word->bytes[1] = data & 0xff; +} + +INLINE UINT32 get_UINT32BE(UINT32BE word) +{ + return (word.bytes[0] << 24) | (word.bytes[1] << 16) | (word.bytes[2] << 8) | word.bytes[3]; +} + +INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) +{ + word->bytes[0] = (data >> 24) & 0xff; + word->bytes[1] = (data >> 16) & 0xff; + word->bytes[2] = (data >> 8) & 0xff; + word->bytes[3] = data & 0xff; +} + +/* + disk image header +*/ +struct disk_image_header +{ + UINT32BE cylinders; /* number of cylinders on hard disk (big-endian) */ + UINT32BE heads; /* number of heads on hard disk (big-endian) */ + UINT32BE sectors_per_track; /* number of sectors per track on hard disk (big-endian) */ + UINT32BE bytes_per_sector; /* number of bytes of data per sector on hard disk (big-endian) */ +}; + +enum +{ + header_len = sizeof(disk_image_header) +}; + +/* + Disk structure: + + Track 0 Sector 0: see below + Track 0 Sector 1: list of bad ADU + Track 0 Sector 2 through N: disk allocation bitmap + Track 1 Sector 0 through N-2: optional disk program image loader + Track 1 Sector N-1: copy of Track 0 Sector 0 + Track 1 Sector N: copy of Track 0 Sector 1 + Last cylinder has disagnostic information (reported as .S$DIAG) + Remaining sectors are used for fdr and data. +*/ + +/* + SC0 record (Disk sector 0) +*/ +struct ti990_sc0 +{ + char vnm[8]; /* volume name */ + UINT16BE tna; /* total number of ADUs */ + UINT8 sbm; /* starting sector of bit maps */ + UINT8 tbm; /* total bit maps */ + UINT16BE rl; /* track 01 record length */ + UINT16BE slt; /* system loader track address */ + UINT8 fill00[6]; /* * * RESERVED * * */ + UINT16BE nba; /* total number of bad ADUs on disk */ + UINT16BE sle; /* system loader entry point */ + UINT16BE sll; /* system loader length */ + UINT8 fill01[8]; /* * * RESERVED * * */ + UINT16BE lt1; /* system loader track (copy 2) */ + UINT8 fill02[8]; /* * * RESERVED * * */ + char pi1[8]; /* primary system file name */ + char pi2[8]; /* secondary system file name */ + UINT16BE pif; /* system selector */ + UINT16BE vda; /* volume directory ADU */ + UINT16BE vpl; /* vcatalog physical record length */ + UINT16BE spa; /* sectors per ADU */ + UINT8 dcd[4]; /* disk creation date */ + char pf1[8]; /* primary program file */ + char pf2[8]; /* secondary program file */ + UINT16BE pff; /* program file switch */ + char of1[8]; /* primary overlay file */ + char of2[8]; /* secondary overlay file */ + UINT16BE off; /* overlay file switch */ + char il1[8]; /* primary intermediate loader */ + char il2[8]; /* secondary intermediate loader */ + UINT16BE ilf; /* intermediate loader flag */ + char din[8]; /* diagnostic file name */ + UINT16BE dif; /* diagnostic flag */ + UINT16BE drs; /* default physical record size "DBUILD DETERMINES DEFAULT PRS" (whatever it means) */ + UINT16BE bal; /* starting sector of bad ADU list */ + UINT16BE spr; /* track 0 sectors per record */ + char wf1[8]; /* WCS primary microcode file */ + char wf2[8]; /* WCS secondary microcode file */ + UINT16BE wff; /* WCS flag switch */ + UINT16BE vif; /* track 1 select flag (whatever it means) volume information copied flag */ + UINT16BE sta; /* state of disk: */ + /* 1 = disk surface has not been tested for defects */ + /* 2 = disk surface has been tested, but no file system has been installed */ + /* 3 = a file system has been installed */ + UINT16BE dct; /* disk creation time */ + UINT16BE fsf; /* * * RESERVED * * */ + /* SCOSIZ = >AA */ +}; + +/* + DOR (Directory Overhead Record) +*/ +struct ti990_dor +{ + UINT16BE nrc; /* # records in directory (minus DOR) nrc = nfl + nar (+ tfc???) */ + UINT16BE nfl; /* # files currently in directory */ + UINT16BE nar; /* # of available records */ + UINT16BE tfc; /* number of temporary files */ + char dnm[8]; /* directory file name (VCATALOG for root) */ + UINT16BE lvl; /* level # of directory (0 for root, 1 for children of root, 2 for grandchildren, etc) */ + char pnm[8]; /* name of parent directory (VCATALOG for root, even though it makes little sense) */ + UINT16BE prs; /* "default physical record length (used for file creation)" */ + /* DORSIZ = >1C */ +}; + +/* + file flags found in fdr +*/ +enum +{ + ace_flg_rdf = 0x8000, /* read access flag */ + ace_flg_wrf = 0x4000, /* write access flag */ + ace_flg_dlf = 0x2000, /* delete access flag */ + ace_flg_exf = 0x1000, /* execute access flag */ + ace_flg_ctf = 0x0800, /* control access flag */ + + fdr_fl1_sec = 0x8000, /* file secured flag */ + + fdr_flg_fu = 0xc000, /* file usage bits */ + fdr_flg_fu_shift = 14, + fdr_flg_fmt = 0x3000, /* file format bits */ + fdr_flg_fmt_shift = 12, + fdr_flg_all = 0x0800, /* extendable file flag */ + fdr_flg_ft = 0x0600, /* file type bits */ + fdr_flg_ft_shift = 9, + fdr_flg_wpb = 0x0100, /* write protect bit */ + fdr_flg_dpb = 0x0080, /* delete protect bit */ + fdr_flg_tmp = 0x0040, /* temporary file flag */ + fdr_flg_blb = 0x0020, /* blocked file flag */ + fdr_flg_ali = 0x0010, /* alias flag bit */ + fdr_flg_fwt = 0x0008, /* forced write / partial logging */ + fdr_flg_cdr = 0x0001 /* record is CDR */ +}; + +/* + ACE subrecord found in FDR +*/ +struct ti990_ace +{ + char agn[8]; /* access group name */ + UINT16BE flg; /* flags */ +}; + +/* + FDR record +*/ +struct ti990_fdr +{ + UINT16BE hkc; /* hask key count: the number of file descriptor records that are present in the directory that hashed to this record number */ + UINT16BE hkv; /* hask key value: the result of the hash algorithm for the file name actually covered in this record */ + char fnm[8]; /* file name */ + UINT8 rsv[2]; /* reserved */ + UINT16BE fl1; /* flags word 1 */ + UINT16BE flg; /* flags word 2 */ + UINT16BE prs; /* physical record size */ + UINT16BE lrs; /* logical record size */ + UINT16BE pas; /* primary allocation size: # of ADUs allocated in primary allocation block? */ + UINT16BE paa; /* primary allocation address: first ADU of primary allocation block? */ + UINT16BE sas; /* secondary allocation size: used to determinate the # of blocks allocated per secondary allocation */ + UINT16BE saa; /* offset of secondary table: ???? "offset into this FDR of the secondary allocation table, if any. No secondary allocation table is denoted by 0. Secondary allocations are present only for unbounded files." */ + UINT16BE rfa; /* record number of first alias */ + UINT32BE eom; /* end of medium record number */ + UINT32BE bkm; /* end of medium block number */ + UINT16BE ofm; /* end of medium offset / */ + /* prelog number for KIF */ + UINT32BE fbq; /* free block queue head */ + UINT16BE btr; /* B-tree roots block # */ + UINT32BE ebq; /* empty block queue head */ + UINT16BE kdr; /* key descriptions record # */ + UINT8 ud[6]; /* last update date */ + UINT8 cd[6]; /* creation date */ + UINT8 apb; /* ADU's per block */ + UINT8 bpa; /* blocks per ADU */ + UINT16BE mrs; /* minimumu KIF record size */ + UINT8 sat[64]; /* secondary allocation table: 16 2-word entries. The first word of an entry contains the size, in ADUs, of the secondary allocation. The second word contains the starting ADU of the allocation. */ + +/* bytes >86 to >100 are optional */ + UINT8 res[10]; /* reserved: seem to be actually meaningful (at least under DX10 3.6.x) */ + char uid[8]; /* user id of file creator */ + UINT16BE psa; /* public security attribute */ + ti990_ace ace[9]; /* 9 access control entries */ + UINT8 fil[2]; /* not used */ +}; + +/* + ADR record: variant of FDR for Aliases + + The fields marked here with *** are in the ADR template to maintain + compatability with the FDR template. +*/ +struct ti990_adr +{ + UINT16BE hkc; /* hask key count */ + UINT16BE hkv; /* hask key value */ + char fnm[8]; /* file name */ + char psw[4]; /* "password" (whatever it means) */ + UINT16BE flg; /* flags (same as fdr.flg) */ + UINT16BE fill00; /* *** physical record size */ + UINT16BE fill01; /* *** logical record size */ + UINT16BE fill02; /* *** primary allocation size */ + UINT16BE fill03; /* *** primary allocation address */ + UINT16BE fill04; /* *** secondary allocation size */ + UINT16BE fill05; /* *** secondary allocation address */ + UINT16BE rna; /* record number of next ADR */ + UINT16BE raf; /* record # of actual FDR (from 1 through dor.nrc) */ +}; + +/* + CDR record: variant of FDR for Channel + + The CDR is the permanent record of a channel. It is carried as an alias + of the program file in which the channel owner task resides. +*/ +struct ti990_cdr +{ + UINT16BE hkc; /* hask key count */ + UINT16BE hkv; /* hask key value */ + char fnm[8]; /* file name */ + UINT16BE fill00; /* reserved */ + UINT16BE fill01; /* reserved */ + UINT16BE fdf; /* flags (same as fdr.flg) */ + UINT8 flg; /* channel flzgs */ + UINT8 iid; /* owner task installed ID */ + UINT8 typ; /* default resource type */ + UINT8 tf; /* resource type flags */ + UINT16BE mxl; /* maximum message length */ + UINT8 fill04[6]; /* reserved (and, no, I don't know where fill02 and fill03 have gone) */ + UINT16BE rna; /* record number of next CDR or ADR */ + UINT16BE raf; /* record # of actual FDR */ + UINT8 fill05[110]; /* reserved */ + char uid[8]; /* user ID of channel creator */ + UINT16BE psa; /* public security attribute */ + UINT8 scg[94]; /* "SDT with 9 control groups" (whatever it means - and, no, 94 is not dividable by 9) */ + UINT8 fill06[8]; /* reserved */ +}; + +/* + Based on contents of the flags field, catalog entries may be either an FDR, + an ADR or a CDR. + + They may be a KDR, too, but confusion is impossible because the KDR FILL00 + field starts at offset 4, and therefore if we try to interpret a KDR as an + FDR (or ADR, CDR), we will find fnm[0] and assume the FDR is empty. +*/ +union directory_entry +{ + ti990_fdr fdr; + ti990_adr adr; + ti990_cdr cdr; +}; + +#if 0 + +/* + tifile header: stand-alone file +*/ +struct tifile_header +{ + char tifiles[8]; /* always '\7TIFILES' */ + UINT8 secsused_MSB; /* file length in sectors (big-endian) */ + UINT8 secsused_LSB; + UINT8 flags; /* see enum above */ + UINT8 recspersec; /* records per sector */ + UINT8 eof; /* current position of eof in last sector (0->255)*/ + UINT8 reclen; /* bytes per record ([1,255] 0->256) */ + UINT8 fixrecs_MSB; /* file length in records (big-endian) */ + UINT8 fixrecs_LSB; + UINT8 res[128-16]; /* reserved */ +}; + + +/* + catalog entry (used for in-memory catalog) +*/ +struct catalog_entry +{ + UINT16 fdr_secnum; + char filename[10]; +}; + +#endif + +/* + Disk geometry +*/ +struct ti990_geometry +{ + unsigned int cylinders, heads, sectors_per_track, bytes_per_sector; +}; + +/* + Physical sector address +*/ +struct ti990_phys_sec_address +{ + int cylinder; + int head; + int sector; +}; + +/* + ti99 disk image descriptor +*/ +struct ti990_image +{ + imgtool_stream *file_handle; /* imgtool file handle */ + ti990_geometry geometry; /* geometry */ + ti990_sc0 sec0; /* cached copy of sector 0 */ +}; + +/* + ti990 catalog iterator, used when imgtool reads the catalog +*/ +struct ti990_iterator +{ + ti990_image *image; + int level; /* current recursion level */ + int nrc[MAX_DIR_LEVEL]; /* length of disk catalogs in records */ + int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */ + directory_entry xdr[MAX_DIR_LEVEL]; /* fdr records */ +}; + + +static imgtoolerr_t ti990_image_init(imgtool_image *img, imgtool_stream *f); +static void ti990_image_exit(imgtool_image *img); +static void ti990_image_info(imgtool_image *img, char *string, size_t len); +static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path); +static imgtoolerr_t ti990_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); +static void ti990_image_closeenum(imgtool_directory *enumeration); +static imgtoolerr_t ti990_image_freespace(imgtool_partition *partition, UINT64 *size); +#ifdef UNUSED_FUNCTION +static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const char *fpath, imgtool_stream *destf); +static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const char *fpath, imgtool_stream *sourcef, option_resolution *writeoptions); +static imgtoolerr_t ti990_image_deletefile(imgtool_partition *partition, const char *fpath); +#endif +static imgtoolerr_t ti990_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions); + +enum +{ + /*ti990_createopts_volname = 'A',*/ + ti990_createopts_cylinders = 'B', + ti990_createopts_heads = 'C', + ti990_createopts_sectors = 'D', + ti990_createopts_sectorsize = 'E' +}; + +static OPTION_GUIDE_START( ti990_create_optionguide ) + /*OPTION_STRING(ti990_createopts_volname, "label", "Volume name" )*/ + OPTION_INT(ti990_createopts_cylinders, "cylinders", "Cylinders" ) + OPTION_INT(ti990_createopts_heads, "heads", "Heads" ) + OPTION_INT(ti990_createopts_sectors, "sectors", "Sectors" ) + OPTION_INT(ti990_createopts_sectorsize, "bytes per sector (typically 256)", "Bytes Per Sector" ) +OPTION_GUIDE_END + +#define symb2str2(a) #a +#define symb2str(a) symb2str2(a) +#define ti990_create_optionspecs "B1-[145]-" symb2str(MAX_CYLINDERS)";C1-[4]-" symb2str(MAX_HEADS)";D1-[32]-" symb2str(MAX_SECTORS_PER_TRACK)";E" symb2str(MIN_SECTOR_SIZE)"-[256]-" symb2str(MAX_SECTOR_SIZE)";" + +void ti990_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti990hd"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI990 Hard Disk"); break; + case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break; + case IMGTOOLINFO_STR_EOLN: /* strcpy(info->s = imgtool_temp_str(), "\r"); */ break; + + case IMGTOOLINFO_PTR_OPEN: info->open = ti990_image_init; break; + case IMGTOOLINFO_PTR_CLOSE: info->close = ti990_image_exit; break; + case IMGTOOLINFO_PTR_INFO: info->info = ti990_image_info; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = ti990_image_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = ti990_image_nextenum; break; + case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = ti990_image_closeenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = ti990_image_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: /* info->read_file = ti990_image_readfile; */ break; + case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = ti990_image_writefile; */ break; + case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = ti990_image_deletefile; */ break; + case IMGTOOLINFO_PTR_CREATE: info->create = ti990_image_create; break; + + case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = ti990_create_optionguide; break; + case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), ti990_create_optionspecs); break; + } +} + +#ifdef UNUSED_FUNCTION +/* + Convert a C string to a 8-character file name (padded with spaces if necessary) +*/ +static void str_to_fname(char dst[8], const char *src) +{ + int i; + + + i = 0; + + /* copy 8 characters at most */ + if (src) + while ((i<8) && (src[i]!='\0')) + { + dst[i] = src[i]; + i++; + } + + /* pad with spaces */ + while (i<8) + { + dst[i] = ' '; + i++; + } +} +#endif + +/* + Convert a 8-character file name to a C string (removing trailing spaces if necessary) +*/ +static void fname_to_str(char *dst, const char src[8], int n) +{ + int i; + int last_nonspace; + + + /* copy 8 characters at most */ + if (--n > 8) + n = 8; + + /* copy filename */ + i = 0; + last_nonspace = -1; + + while (icylinder*geometry->heads) + address->head)*geometry->sectors_per_track + address->sector)*geometry->bytes_per_sector + header_len; + + return offset; +} + +/* + Read one sector from a disk image + + file_handle: imgtool file handle + address: physical sector address + geometry: disk geometry (sectors per track, tracks per side, sides) + dest: pointer to destination buffer + len: length of data to read +*/ +static int read_sector_physical_len(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest, int len) +{ + int reply; + + if (len > geometry->bytes_per_sector) + return 1; + + /* seek to sector */ + reply = stream_seek(file_handle, phys_address_to_offset(address, geometry), SEEK_SET); + if (reply) + return 1; + /* read it */ + reply = stream_read(file_handle, dest, len); + if (reply != len) + return 1; + + return 0; +} + +#ifdef UNUSED_FUNCTION +/* + Read one sector from a disk image + + file_handle: imgtool file handle + address: physical sector address + geometry: disk geometry (sectors per track, tracks per side, sides) + dest: pointer to a destination buffer of geometry->bytes_per_sector bytes +*/ +static int read_sector_physical(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest) +{ + return read_sector_physical_len(file_handle, address, geometry, dest, geometry->bytes_per_sector); +} +#endif + +/* + Write one sector to a disk image + + file_handle: imgtool file handle + address: physical sector address + geometry: disk geometry (sectors per track, tracks per side, sides) + src: pointer to source buffer + len: length of source buffer +*/ +static int write_sector_physical_len(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src, int len) +{ + int reply; + + if (len > geometry->bytes_per_sector) + return 1; + + /* seek to sector */ + reply = stream_seek(file_handle, phys_address_to_offset(address, geometry), SEEK_SET); + if (reply) + return 1; + /* write it */ + reply = stream_write(file_handle, src, len); + if (reply != len) + return 1; + /* pad with 0s if needed */ + if (len < geometry->bytes_per_sector) + { + reply = stream_fill(file_handle, 0, geometry->bytes_per_sector - len); + + if (reply != geometry->bytes_per_sector - len) + return 1; + } + + return 0; +} + +#ifdef UNUSED_FUNCTION +/* + Write one sector to a disk image + + file_handle: imgtool file handle + address: physical sector address + geometry: disk geometry (sectors per track, tracks per side, sides) + dest: pointer to a source buffer of geometry->bytes_per_sector bytes +*/ +static int write_sector_physical(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src) +{ + return write_sector_physical_len(file_handle, address, geometry, src, geometry->bytes_per_sector); +} +#endif + +/* + Convert logical sector address to physical sector address +*/ +static void log_address_to_phys_address(int secnum, const ti990_geometry *geometry, ti990_phys_sec_address *address) +{ + address->sector = secnum % geometry->sectors_per_track; + secnum /= geometry->sectors_per_track; + address->head = secnum % geometry->heads; + address->cylinder = secnum / geometry->heads; +} + +/* + Read one sector from a disk image + + file_handle: imgtool file handle + secnum: logical sector address + geometry: disk geometry (sectors per track, tracks per side, sides) + dest: pointer to destination buffer + len: length of data to read +*/ +static int read_sector_logical_len(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest, int len) +{ + ti990_phys_sec_address address; + + + log_address_to_phys_address(secnum, geometry, &address); + + return read_sector_physical_len(file_handle, &address, geometry, dest, len); +} + +#ifdef UNUSED_FUNCTION +/* + Read one sector from a disk image + + file_handle: imgtool file handle + secnum: logical sector address + geometry: disk geometry (sectors per track, tracks per side, sides) + dest: pointer to a destination buffer of geometry->bytes_per_sector bytes +*/ +static int read_sector_logical(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest) +{ + return read_sector_logical_len(file_handle, secnum, geometry, dest, geometry->bytes_per_sector); +} +#endif + +/* + Write one sector to a disk image + + file_handle: imgtool file handle + secnum: logical sector address + geometry: disk geometry (sectors per track, tracks per side, sides) + src: pointer to source buffer + len: length of source buffer +*/ +static int write_sector_logical_len(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, const void *src, int len) +{ + ti990_phys_sec_address address; + + + log_address_to_phys_address(secnum, geometry, &address); + + return write_sector_physical_len(file_handle, &address, geometry, src, len); +} + +/* + Write one sector to a disk image + + file_handle: imgtool file handle + secnum: logical sector address + geometry: disk geometry (sectors per track, tracks per side, sides) + dest: pointer to a source buffer of geometry->bytes_per_sector bytes +*/ +static int write_sector_logical(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, const void *src) +{ + return write_sector_logical_len(file_handle, secnum, geometry, src, geometry->bytes_per_sector); +} + +#if 0 +#pragma mark - +#pragma mark CATALOG FILE ROUTINES +#endif + +#ifdef UNUSED_FUNCTION +/* + Find the catalog entry and fdr record associated with a file name + + image: ti990_image image record + fpath: path of the file to search + fdr: pointer to buffer where the fdr record should be stored (may be NULL) + catalog_index: on output, index of file catalog entry (may be NULL) + out_fdr_secnum: on output, sector address of the fdr (may be NULL) + out_parent_fdr_secnum: on output, sector offset of the fdr for the parent + directory fdr (-1 if root) (may be NULL) +*/ +static int find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *catalog_index, int *out_fdr_secnum, int *out_parent_fdr_secnum) +{ + int fdr_secnum = -1, parent_fdr_secnum; + int i; + const char *element_start, *element_end; + int element_len; + char element[8]; + ti990_dor dor; + directory_entry xdr; + int hash_key; + int nrc; + unsigned base; + int reply; + int flag; + + + base = (unsigned) get_UINT16BE(image->sec0.vda) * get_UINT16BE(image->sec0.spa); + + element_start = fpath; + do + { + /* read directory header */ + reply = read_sector_logical_len(image->file_handle, base, & image->geometry, &dor, sizeof(dor)); + if (reply) + return IMGTOOLERR_READERROR; + + nrc = get_UINT16BE(dor.nrc); + + /* find next path element */ + element_end = strchr(element_start, '.'); + element_len = element_end ? (element_end - element_start) : strlen(element_start); + if ((element_len > 8) || (element_len == 0)) + return IMGTOOLERR_BADFILENAME; + /* generate file name and hash key */ + hash_key = 1; + for (i=0; ifile_handle, base + i, & image->geometry, + & xdr, 0x86); + if (reply) + return IMGTOOLERR_READERROR; + if (!memcmp(element, xdr.fdr.fnm, 8)) + { /* found match !!! */ + parent_fdr_secnum = fdr_secnum; + fdr_secnum = base + i; + break; + } + + /* next record */ + if (i != nrc) + i++; + else + i = 1; + + /* exit if we have tested every record */ + if (i == hash_key) + return IMGTOOLERR_FILENOTFOUND; + } + + /* iterate */ + if (element_end) + { + element_start = element_end+1; + /* we need to check that this is a directory */ + /* if it is an alias to a directory, we need to follow it, too. */ + + /* parse flags */ + flag = get_UINT16BE(xdr.fdr.flg); + + if (flag & fdr_flg_ali) + { + /* read original fdr */ + reply = read_sector_logical_len(image->file_handle, base + get_UINT16BE(xdr.adr.raf), + & image->geometry, & xdr, 0x86); + + flag = get_UINT16BE(xdr.fdr.flg); + } + + if (flag & fdr_flg_cdr) + /* This is a channel, not a file */ + return IMGTOOLERR_BADFILENAME; + else if (flag & fdr_flg_ali) + /* WTH??? */ + return IMGTOOLERR_CORRUPTIMAGE; + else if (((flag >> fdr_flg_fu_shift) & 3) != 1) + { + /* This file is not a directory */ + return IMGTOOLERR_BADFILENAME; + } + + /* initialize base */ + base = (unsigned) get_UINT16BE(xdr.fdr.paa) * get_UINT16BE(image->sec0.spa); + } + else + element_start = NULL; + } + while (element_start); + + if (catalog_index) + *catalog_index = i; + + if (out_fdr_secnum) + *out_fdr_secnum = fdr_secnum; + + if (out_parent_fdr_secnum) + *out_parent_fdr_secnum = parent_fdr_secnum; + + return 0; +} +#endif + +#if 0 +/* + Allocate one sector on disk, for use as a fdr record + + image: ti99_image image record + fdr_secnum: on output, logical address of a free sector +*/ +static int alloc_fdr_sector(ti99_image *image, int *fdr_secnum) +{ + int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; + int i; + + + for (i=0; isec0.abm[i >> 3] & (1 << (i & 7)))) + { + *fdr_secnum = i; + image->sec0.abm[i >> 3] |= 1 << (i & 7); + + return 0; + } + } + + return IMGTOOLERR_NOSPACE; +} + +/* + Extend a file with nb_alloc_sectors extra sectors + + image: ti99_image image record + fdr: file fdr record + nb_alloc_sectors: number of sectors to allocate +*/ +static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sectors) +{ + int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; + int free_sectors; + int secsused; + int i; + int lnks_index; + int cur_sec, last_sec, p_last_sec; + int cur_block_len, cur_block_start; + int first_best_block_len, first_best_block_start = 0; + int second_best_block_len, second_best_block_start = 0; + int search_start; + + /* compute free space */ + free_sectors = 0; + for (i=0; isec0.abm[i >> 3] & (1 << (i & 7)))) + free_sectors++; + } + + /* check we have enough free space */ + if (free_sectors < nb_alloc_sectors) + return IMGTOOLERR_NOSPACE; + + /* current number of data sectors in file */ + secsused = get_fdr_secsused(fdr); + + if (secsused == 0) + { /* links array must be empty */ + lnks_index = 0; + } + else + { /* try to extend last block */ + last_sec = -1; + for (lnks_index=0; lnks_index<76; lnks_index++) + { + p_last_sec = last_sec; + last_sec = (fdr->lnks[lnks_index][2] << 4) | (fdr->lnks[lnks_index][1] >> 4); + if (last_sec >= (secsused-1)) + break; + } + if (lnks_index == 76) + /* that sucks */ + return IMGTOOLERR_CORRUPTIMAGE; + + if (last_sec > (secsused-1)) + { /* some extra space has already been allocated */ + cur_block_len = last_sec - (secsused-1); + if (cur_block_len > nb_alloc_sectors) + cur_block_len = nb_alloc_sectors; + + secsused += cur_block_len; + set_fdr_secsused(fdr, secsused); + nb_alloc_sectors -= cur_block_len; + if (! nb_alloc_sectors) + return 0; /* done */ + } + + /* block base */ + cur_sec = ((fdr->lnks[lnks_index][1] & 0xf) << 8) | fdr->lnks[lnks_index][0]; + /* point past block end */ + cur_sec += last_sec-p_last_sec; + /* count free sectors after last block */ + cur_block_len = 0; + for (i=cur_sec; (! (image->sec0.abm[i >> 3] & (1 << (i & 7)))) && (cur_block_len < nb_alloc_sectors) && (i < totsecs); i++) + cur_block_len++; + if (cur_block_len) + { /* extend last block */ + secsused += cur_block_len; + set_fdr_secsused(fdr, secsused); + last_sec += cur_block_len; + nb_alloc_sectors -= cur_block_len; + fdr->lnks[lnks_index][1] = (fdr->lnks[lnks_index][1] & 0x0f) | (last_sec << 4); + fdr->lnks[lnks_index][2] = last_sec >> 4; + for (i=0; isec0.abm[(i+cur_sec) >> 3] |= 1 << ((i+cur_sec) & 7); + if (! nb_alloc_sectors) + return 0; /* done */ + } + lnks_index++; + if (lnks_index == 76) + /* that sucks */ + return IMGTOOLERR_NOSPACE; + } + + search_start = image->data_offset; /* initially, search for free space only in data space */ + while (nb_alloc_sectors) + { + /* find smallest data block at least nb_alloc_sectors in length, and largest data block less than nb_alloc_sectors in length */ + first_best_block_len = INT_MAX; + second_best_block_len = 0; + for (i=search_start; isec0.abm[i >> 3] & (1 << (i & 7)))) + { /* found one free block */ + /* compute its length */ + cur_block_start = i; + cur_block_len = 0; + while ((isec0.abm[i >> 3] & (1 << (i & 7))))) + { + cur_block_len++; + i++; + } + /* compare to previous best and second-best blocks */ + if ((cur_block_len < first_best_block_len) && (cur_block_len >= nb_alloc_sectors)) + { + first_best_block_start = cur_block_start; + first_best_block_len = cur_block_len; + if (cur_block_len == nb_alloc_sectors) + /* no need to search further */ + break; + } + else if ((cur_block_len > second_best_block_len) && (cur_block_len < nb_alloc_sectors)) + { + second_best_block_start = cur_block_start; + second_best_block_len = cur_block_len; + } + } + } + + if (first_best_block_len != INT_MAX) + { /* found one contiguous block which can hold it all */ + secsused += nb_alloc_sectors; + set_fdr_secsused(fdr, secsused); + + fdr->lnks[lnks_index][0] = first_best_block_start; + fdr->lnks[lnks_index][1] = ((first_best_block_start >> 8) & 0x0f) | ((secsused-1) << 4); + fdr->lnks[lnks_index][2] = (secsused-1) >> 4; + for (i=0; isec0.abm[(i+first_best_block_start) >> 3] |= 1 << ((i+first_best_block_start) & 7); + + nb_alloc_sectors = 0; + } + else if (second_best_block_len != 0) + { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */ + secsused += second_best_block_len; + set_fdr_secsused(fdr, secsused); + + fdr->lnks[lnks_index][0] = second_best_block_start; + fdr->lnks[lnks_index][1] = ((second_best_block_start >> 8) & 0x0f) | ((secsused-1) << 4); + fdr->lnks[lnks_index][2] = (secsused-1) >> 4; + for (i=0; isec0.abm[(i+second_best_block_start) >> 3] |= 1 << ((i+second_best_block_start) & 7); + + nb_alloc_sectors -= second_best_block_len; + + lnks_index++; + if (lnks_index == 76) + /* that sucks */ + return IMGTOOLERR_NOSPACE; + } + else if (search_start != 0) + { /* we did not find any free sector in the data section of the disk */ + search_start = 0; /* time to fall back to fdr space */ + } + else + return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */ + } + + return 0; +} + +/* + Allocate a new (empty) file +*/ +static int new_file(ti99_image *image, char filename[10], int *out_fdr_secnum/*, ti99_fdr *fdr,*/) +{ + int fdr_secnum; + int catalog_index, i; + int reply = 0; + + + /* find insertion point in catalog */ + i = 0; + if ((image->catalog[0].fdr_secnum == 0) && (image->catalog[1].fdr_secnum != 0)) + i = 1; /* skip empty entry 0 (it must be a non-listable catalog) */ + + for (; (i<128) && ((fdr_secnum = image->catalog[i].fdr_secnum) != 0) && ((reply = memcmp(image->catalog[i].filename, filename, 10)) < 0); i++) + ; + + if (i == 128) + /* catalog is full */ + return IMGTOOLERR_NOSPACE; + else if (fdr_secnum && (reply == 0)) + /* file already exists */ + return IMGTOOLERR_BADFILENAME; + else + { + catalog_index = i; + reply = alloc_fdr_sector(image, &fdr_secnum); + if (reply) + return reply; + + /* look for first free entry in catalog */ + for (i=catalog_index; image->catalog[i].fdr_secnum != 0; i++) + ; + + if (i == 128) + /* catalog is full */ + return IMGTOOLERR_NOSPACE; + + /* shift catalog entries until the insertion point */ + for (/*i=127*/; i>catalog_index; i--) + image->catalog[i] = image->catalog[i-1]; + + /* write new catalog entry */ + image->catalog[catalog_index].fdr_secnum = fdr_secnum; + memcpy(image->catalog[catalog_index].filename, filename, 10); + if (out_fdr_secnum) + *out_fdr_secnum = fdr_secnum; + } + + return 0; +} + +/* + Compare two (possibly empty) catalog entry for qsort +*/ +static int qsort_catalog_compare(const void *p1, const void *p2) +{ + const catalog_entry *entry1 = p1; + const catalog_entry *entry2 = p2; + + if ((entry1->fdr_secnum == 0) && (entry2->fdr_secnum == 0)) + return 0; + else if (entry1->fdr_secnum == 0) + return +1; + else if (entry2->fdr_secnum == 0) + return -1; + else + return memcmp(entry1->filename, entry2->filename, 10); +} +#endif + +/* + Open a file as a ti990_image. +*/ +static imgtoolerr_t ti990_image_init(imgtool_image *img, imgtool_stream *f) +{ + ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); + disk_image_header header; + int reply; + unsigned totsecs; + + image->file_handle = f; + reply = stream_read(f, &header, sizeof(header)); + if (reply != sizeof(header)) + return IMGTOOLERR_READERROR; + + image->geometry.cylinders = get_UINT32BE(header.cylinders); + image->geometry.heads = get_UINT32BE(header.heads); + image->geometry.sectors_per_track = get_UINT32BE(header.sectors_per_track); + image->geometry.bytes_per_sector = get_UINT32BE(header.bytes_per_sector); + + totsecs = image->geometry.cylinders*image->geometry.heads*image->geometry.sectors_per_track; + + if ((image->geometry.bytes_per_sector < MIN_SECTOR_SIZE) + || (image->geometry.bytes_per_sector > MAX_SECTOR_SIZE) + || (image->geometry.sectors_per_track > MAX_SECTORS_PER_TRACK) + || (image->geometry.heads > MAX_HEADS) + || (image->geometry.cylinders > MAX_CYLINDERS) + || (totsecs < 1) + || (stream_size(f) != header_len + totsecs*image->geometry.bytes_per_sector)) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + + { + ti990_phys_sec_address address = { 0, 0, 0 }; + reply = read_sector_physical_len(f, &address, &image->geometry, & image->sec0, sizeof(image->sec0)); + } + if (reply) + { + return IMGTOOLERR_READERROR; + } + + if ((get_UINT16BE(image->sec0.tna)*get_UINT16BE(image->sec0.spa) > totsecs) + || ((get_UINT16BE(image->sec0.spa) != 1) && (get_UINT16BE(image->sec0.spa) % 3))) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + + if ((get_UINT16BE(image->sec0.vpl) != 0x86) && (get_UINT16BE(image->sec0.vpl) != 0x100)) + { + return IMGTOOLERR_CORRUPTIMAGE; + } + + return IMGTOOLERR_SUCCESS; +} + +/* + close a ti990_image +*/ +static void ti990_image_exit(imgtool_image *img) +{ + ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); + stream_close(image->file_handle); +} + +/* + get basic information on a ti990_image + + Currently returns the volume name +*/ +static void ti990_image_info(imgtool_image *img, char *string, size_t len) +{ + ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); + char vol_name[9]; + + fname_to_str(vol_name, image->sec0.vnm, 9); + + snprintf(string, len, "%s", vol_name); +} + +/* + Open the disk catalog for enumeration +*/ +static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path) +{ + ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(imgtool_directory_image(enumeration)); + ti990_iterator *iter = (ti990_iterator *) imgtool_directory_extrabytes(enumeration); + ti990_dor dor; + int reply; + + iter->image = image; + + reply = read_sector_logical_len(iter->image->file_handle, + (unsigned) get_UINT16BE(iter->image->sec0.vda) * get_UINT16BE(iter->image->sec0.spa), + & iter->image->geometry, &dor, sizeof(dor)); + + if (reply) + return IMGTOOLERR_READERROR; + + iter->level = 0; + iter->nrc[0] = get_UINT16BE(dor.nrc); + iter->index[0] = 0; + + return IMGTOOLERR_SUCCESS; +} + +/* + Enumerate disk catalog next entry +*/ +static imgtoolerr_t ti990_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + ti990_iterator *iter = (ti990_iterator *) imgtool_directory_extrabytes(enumeration); + int flag; + int reply = 0; + + + ent->corrupt = 0; + ent->eof = 0; + + while ((iter->level >= 0) + && (! (reply = read_sector_logical_len(iter->image->file_handle, + iter->level ? (unsigned) get_UINT16BE(iter->xdr[iter->level-1].fdr.paa) * get_UINT16BE(iter->image->sec0.spa) + (iter->index[iter->level]+1) + : (unsigned) get_UINT16BE(iter->image->sec0.vda) * get_UINT16BE(iter->image->sec0.spa) + (iter->index[iter->level]+1), + & iter->image->geometry, &iter->xdr[iter->level], + iter->level ? get_UINT16BE(iter->xdr[iter->level-1].fdr.prs) + : get_UINT16BE(iter->image->sec0.vpl)))) + && (iter->xdr[iter->level].fdr.fnm[0] == 0)) + { + iter->index[iter->level]++; + while (iter->index[iter->level] >= iter->nrc[iter->level]) + iter->level--; + } + + if (iter->level < 0) + { + ent->eof = 1; + } + else if (reply) + return IMGTOOLERR_READERROR; + else + { +#if 0 + fname_to_str(ent->filename, iter->xdr[iter->level].fdr.fnm, ARRAY_LENGTH(ent->filename)); +#else + { + int i; + char buf[9]; + + ent->filename[0] = '\0'; + for (i=0; ilevel; i++) + { + fname_to_str(buf, iter->xdr[i].fdr.fnm, 9); + strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); + strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1); + } + fname_to_str(buf, iter->xdr[iter->level].fdr.fnm, 9); + strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); + } +#endif + + /* parse flags */ + flag = get_UINT16BE(iter->xdr[iter->level].fdr.flg); + if (flag & fdr_flg_cdr) + { + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "CHANNEL"); + + ent->filesize = 0; + } + else if (flag & fdr_flg_ali) + { + ti990_fdr target_fdr; + char buf[9]; + + reply = read_sector_logical_len(iter->image->file_handle, + iter->level ? ((unsigned) get_UINT16BE(iter->xdr[iter->level-1].fdr.paa) * get_UINT16BE(iter->image->sec0.spa) + get_UINT16BE(iter->xdr[iter->level].adr.raf)) + : ((unsigned) get_UINT16BE(iter->image->sec0.vda) * get_UINT16BE(iter->image->sec0.spa) + get_UINT16BE(iter->xdr[iter->level].adr.raf)), + & iter->image->geometry, &target_fdr, + iter->level ? get_UINT16BE(iter->xdr[iter->level-1].fdr.prs) + : get_UINT16BE(iter->image->sec0.vpl)); + + fname_to_str(buf, target_fdr.fnm, 9); + + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "ALIAS OF %s", buf); + + ent->filesize = 0; + } + else + { + const char *fmt, *type; + + switch ((flag >> fdr_flg_fmt_shift) & 3) + { + case 0: + fmt = "NBS"; + break; + case 1: + fmt = "BS "; + break; + default: + fmt = "???"; + break; + } + + switch ((flag >> fdr_flg_fu_shift) & 3) + { + case 1: + type = "DIR"; + break; + case 2: + type = "PRO"; + break; + case 3: + type = "IMG"; + break; + default: + switch ((flag >> fdr_flg_ft_shift) & 3) + { + case 1: + type = "SEQ"; + break; + case 2: + type = "REL"; + break; + case 3: + type = "KIF"; + break; + default: + type = "???"; + break; + } + break; + } + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), + "%s %c %s%s%s%s%s", fmt, (flag & fdr_flg_all) ? 'N' : 'C', type, + (flag & fdr_flg_blb) ? "" : " BLK", + (flag & fdr_flg_tmp) ? " TMP" : "", + (flag & fdr_flg_wpb) ? " WPT" : "", + (flag & fdr_flg_dpb) ? " DPT" : ""); + + /* len in blocks */ + ent->filesize = get_UINT32BE(iter->xdr[iter->level].fdr.bkm); + if ((((flag >> fdr_flg_ft_shift) & 3) == 3) || get_UINT16BE(iter->xdr[iter->level].fdr.ofm)) + ent->filesize++; + + /* convert to ADUs */ + if (iter->xdr[iter->level].fdr.apb > 1) + /* more than one ADU per block */ + ent->filesize *= iter->xdr[iter->level].fdr.apb; + else if (iter->xdr[iter->level].fdr.bpa > 1) + /* more than one block per ADU */ + ent->filesize = (ent->filesize + iter->xdr[iter->level].fdr.bpa - 1) / iter->xdr[iter->level].fdr.bpa; + } + iter->index[iter->level]++; + + if (get_UINT16BE(iter->xdr[iter->level].fdr.saa) != 0) + printf("roupoupou"); + else + { + int i; + for (i=0; i<64; i++) + if (iter->xdr[iter->level].fdr.sat[i]) + { + printf("roupoupou"); + break; + } + } + + /* recurse subdirectory if applicable */ + if ((((flag >> fdr_flg_fu_shift) & 3) == 1) + && (! (flag & fdr_flg_ali)) + && (! (flag & fdr_flg_cdr)) + && (iter->level < MAX_DIR_LEVEL) + && ! ((iter->level == 0) && ! memcmp(iter->xdr[iter->level].fdr.fnm, "VCATALOG", 8))) + { + ti990_dor dor; + + if (get_UINT16BE(iter->xdr[iter->level].fdr.saa) != 0) + printf("ninou"); + + read_sector_logical_len(iter->image->file_handle, + get_UINT16BE(iter->xdr[iter->level].fdr.paa) * get_UINT16BE(iter->image->sec0.spa), + & iter->image->geometry, &dor, sizeof(dor)); + + iter->level++; + iter->nrc[iter->level] = get_UINT16BE(dor.nrc)/*get_UINT32BE(iter->fdr[iter->level-1].eom)-1*/; + iter->index[iter->level] = 0; +#if 0 + if (get_UINT16BE(dor.nrc) != (get_UINT32BE(iter->xdr[iter->level-1].fdr.eom)-1)) + printf("hiha"); +#endif + } + + /* go to upper level if applicable */ + while (iter->index[iter->level] >= iter->nrc[iter->level]) + iter->level--; + } + + return (imgtoolerr_t)0; +} + +/* + Free enumerator +*/ +static void ti990_image_closeenum(imgtool_directory *enumeration) +{ +} + +/* + Compute free space on disk image (in ADUs) +*/ +static imgtoolerr_t ti990_image_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtool_image *img = imgtool_partition_image(partition); + ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); + int totadus = get_UINT16BE(image->sec0.tna); + int adu, record, sub_adu; + char buf[256]; + size_t freeadus = 0; + + if ((totadus+2031)/2032 != image->sec0.tbm) + /*return IMGTOOLERR_CORRUPTIMAGE;*/ + return (imgtoolerr_t)0; + + adu = 0; + record = 0; + sub_adu = 0; + while (adufile_handle, image->sec0.sbm + record, &image->geometry, buf, sizeof(buf)); + + while ((adu < totadus) && (sub_adu < 2032)) + { + if (! (buf[(sub_adu >> 3) + 2] & (1 << (sub_adu & 7)))) + freeadus++; + sub_adu++; + adu++; + } + sub_adu = 0; + record++; + } + + * size = freeadus; + + return IMGTOOLERR_SUCCESS; +} + +#ifdef UNUSED_FUNCTION +/* + Extract a file from a ti990_image. +*/ +static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const char *fpath, imgtool_stream *destf) +{ + imgtool_image *img = imgtool_partition_image(partition); + ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); + int catalog_index, fdr_secnum, parent_fdr_secnum; + imgtoolerr_t reply; + + + reply = find_fdr(image, fpath, &catalog_index, &fdr_secnum, &parent_fdr_secnum); + if (reply) + return reply; + + /* ... */ + + return 0; + +#if 0 + ti99_image *image = (ti99_image*) img; + int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; + char ti_fname[10]; + ti99_fdr fdr; + tifile_header dst_header; + int i, lnks_index; + int cur_sec, last_sec; + int secsused; + UINT8 buf[256]; + int reply; + + str_to_fname(ti_fname, filename); + + reply = find_fdr(image, ti_fname, &fdr, NULL); + if (reply) + return reply; + + dst_header.tifiles[0] = '\7'; + dst_header.tifiles[1] = 'T'; + dst_header.tifiles[2] = 'I'; + dst_header.tifiles[3] = 'F'; + dst_header.tifiles[4] = 'I'; + dst_header.tifiles[5] = 'L'; + dst_header.tifiles[6] = 'E'; + dst_header.tifiles[7] = 'S'; + dst_header.secsused_MSB = fdr.secsused_MSB; + dst_header.secsused_LSB = fdr.secsused_LSB; + dst_header.flags = fdr.flags; + dst_header.recspersec = fdr.recspersec; + dst_header.eof = fdr.eof; + dst_header.reclen = fdr.reclen; + dst_header.fixrecs_MSB = fdr.fixrecs_MSB; + dst_header.fixrecs_LSB = fdr.fixrecs_LSB; + for (i=0; i<(128-14); i++) + dst_header.res[i] = 0; + + if (stream_write(destf, & dst_header, 128) != 128) + return IMGTOOLERR_WRITEERROR; + + + secsused = get_fdr_secsused(&fdr); + + i = 0; /* file logical sector #0 */ + lnks_index = 0; /* start of file block table */ + while (i> 4); + + /* copy current file block */ + while ((i<=last_sec) && (i= totsecs) + return IMGTOOLERR_CORRUPTIMAGE; + + if (read_sector_logical(image->file_handle, cur_sec, & image->geometry, buf)) + return IMGTOOLERR_READERROR; + + if (stream_write(destf, buf, 256) != 256) + return IMGTOOLERR_WRITEERROR; + + i++; + cur_sec++; + } + + /* next entry in file block table */ + lnks_index++; + } + + return 0; +#endif +} + +/* + Add a file to a ti990_image. +*/ +static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const char *fpath, imgtool_stream *sourcef, option_resolution *writeoptions) +{ + imgtool_image *img = imgtool_partition_image(partition); + ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); + int catalog_index, fdr_secnum, parent_fdr_secnum; + imgtoolerr_t reply; + + + /* check that file does not exist */ + reply = find_fdr(image, fpath, &catalog_index, &fdr_secnum, &parent_fdr_secnum); + if ((reply) && (reply != IMGTOOLERR_FILENOTFOUND)) + return reply; + + /* ... */ + + return 0; + +#if 0 + ti99_image *image = (ti99_image*) img; + int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; + char ti_fname[10]; + ti99_fdr fdr; + tifile_header src_header; + int i, lnks_index; + int cur_sec, last_sec; + int secsused; + UINT8 buf[256]; + int reply; + int fdr_secnum; + + str_to_fname(ti_fname, filename); + + reply = find_fdr(image, ti_fname, &fdr, NULL); + if (reply == 0) + { /* file already exists: causes an error for now */ + return IMGTOOLERR_UNEXPECTED; + } + else if (reply != IMGTOOLERR_FILENOTFOUND) + { + return reply; + } + + if (stream_read(sourcef, & src_header, 128) != 128) + return IMGTOOLERR_READERROR; + + /* create new file */ + reply = new_file(image, ti_fname, &fdr_secnum); + if (reply) + return reply; + + memcpy(fdr.name, ti_fname, 10); + fdr.res10[1] = fdr.res10[0] = 0; + fdr.flags = src_header.flags; + fdr.recspersec = src_header.recspersec; + fdr.secsused_MSB = /*src_header.secsused_MSB*/0; + fdr.secsused_LSB = /*src_header.secsused_LSB*/0; + fdr.eof = src_header.eof; + fdr.reclen = src_header.reclen; + fdr.fixrecs_LSB = src_header.fixrecs_LSB; + fdr.fixrecs_MSB = src_header.fixrecs_MSB; + for (i=0; i<8; i++) + fdr.res20[i] = 0; + for (i=0; i<76; i++) + fdr.lnks[i][2] = fdr.lnks[i][1] = fdr.lnks[i][0] = 0; + + /* alloc data sectors */ + secsused = (src_header.secsused_MSB << 8) | src_header.secsused_LSB; + reply = alloc_file_sectors(image, &fdr, secsused); + if (reply) + return reply; + + /* copy data */ + i = 0; + lnks_index = 0; + while (i> 4); + + while ((i= totsecs) + return IMGTOOLERR_CORRUPTIMAGE; + + if (stream_read(sourcef, buf, 256) != 256) + return IMGTOOLERR_READERROR; + + if (write_sector_logical(image->file_handle, cur_sec, & image->geometry, buf)) + return IMGTOOLERR_WRITEERROR; + + i++; + cur_sec++; + } + + lnks_index++; + } + + /* write fdr */ + if (write_sector_logical(image->file_handle, fdr_secnum, & image->geometry, &fdr)) + return IMGTOOLERR_WRITEERROR; + + /* update catalog */ + for (i=0; i<128; i++) + { + buf[2*i] = image->catalog[i].fdr_secnum >> 8; + buf[2*i+1] = image->catalog[i].fdr_secnum & 0xff; + } + if (write_sector_logical(image->file_handle, 1, & image->geometry, buf)) + return IMGTOOLERR_WRITEERROR; + + /* update bitmap */ + if (write_sector_logical(image->file_handle, 0, & image->geometry, &image->sec0)) + return IMGTOOLERR_WRITEERROR; + + return 0; +#endif +} + +/* + Delete a file from a ti990_image. +*/ +static imgtoolerr_t ti990_image_deletefile(imgtool_partition *partition, const char *fpath) +{ + imgtool_image *img = imgtool_partition_image(partition); + ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); + int catalog_index, fdr_secnum, parent_fdr_secnum; + imgtoolerr_t reply; + + + reply = find_fdr(image, fpath, &catalog_index, &fdr_secnum, &parent_fdr_secnum); + if (reply) + return reply; + + /* ... */ + + return 0; + +#if 0 + ti99_image *image = (ti99_image*) img; + int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; + char ti_fname[10]; + ti99_fdr fdr; + int i, lnks_index; + int cur_sec, last_sec; + int secsused; + int catalog_index; + int reply; + UINT8 buf[256]; + + str_to_fname(ti_fname, filename); + + reply = find_fdr(image, ti_fname, &fdr, &catalog_index); + if (reply) + return reply; + + /* free data sectors */ + secsused = get_fdr_secsused(&fdr); + + i = 0; + lnks_index = 0; + while (i> 4); + + while ((i= totsecs) + return IMGTOOLERR_CORRUPTIMAGE; + + image->sec0.abm[cur_sec >> 3] &= ~ (1 << (cur_sec & 7)); + + i++; + cur_sec++; + } + + lnks_index++; + } + + /* free fdr sector */ + image->sec0.abm[image->catalog[catalog_index].fdr_secnum >> 3] &= ~ (1 << (image->catalog[catalog_index].fdr_secnum & 7)); + + /* delete catalog entry */ + for (i=catalog_index; i<127; i++) + image->catalog[i] = image->catalog[i+1]; + image->catalog[127].fdr_secnum = 0; + + /* update catalog */ + for (i=0; i<128; i++) + { + buf[2*i] = image->catalog[i].fdr_secnum >> 8; + buf[2*i+1] = image->catalog[i].fdr_secnum & 0xff; + } + if (write_sector_logical(image->file_handle, 1, & image->geometry, buf)) + return IMGTOOLERR_WRITEERROR; + + /* update bitmap */ + if (write_sector_logical(image->file_handle, 0, & image->geometry, &image->sec0)) + return IMGTOOLERR_WRITEERROR; + + return 0; +#endif +} +#endif + +/* + Create a blank ti990_image. +*/ +static imgtoolerr_t ti990_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions) +{ + //const char *volname; + ti990_geometry geometry; + unsigned totsecs; + disk_image_header header; + ti990_sc0 sec0; + UINT8 empty_sec[MAX_SECTOR_SIZE]; + int reply; + int i; + + /* read options */ + //volname = option_resolution_lookup_string(createoptions, ti990_createopts_volname); + geometry.cylinders = option_resolution_lookup_int(createoptions, ti990_createopts_cylinders); + geometry.heads = option_resolution_lookup_int(createoptions, ti990_createopts_heads); + geometry.sectors_per_track = option_resolution_lookup_int(createoptions, ti990_createopts_sectors); + geometry.bytes_per_sector = option_resolution_lookup_int(createoptions, ti990_createopts_sectorsize); + + totsecs = geometry.cylinders * geometry.heads * geometry.sectors_per_track; + + /* write header */ + set_UINT32BE(& header.cylinders, geometry.cylinders); + set_UINT32BE(& header.heads, geometry.heads); + set_UINT32BE(& header.sectors_per_track, geometry.sectors_per_track); + set_UINT32BE(& header.bytes_per_sector, geometry.bytes_per_sector); + + reply = stream_write(f, &header, sizeof(header)); + if (reply != sizeof(header)) + { + return IMGTOOLERR_WRITEERROR; + } + + + /* initialize sector 0 */ + /* mark disk as uninitialized */ + set_UINT16BE(& sec0.sta, 2); + + + /* write sector 0 */ + if (write_sector_logical(f, 0, & geometry, &sec0)) + return IMGTOOLERR_WRITEERROR; + + + /* now clear every other sector, including catalog */ + memset(empty_sec, 0, geometry.bytes_per_sector); + + for (i=1; i +#include +#include +#include +#include "imgtool.h" +#include "formats/imageutl.h" +#include "formats/vt_dsk.h" +#include "iflopimg.h" + +/* + +sector format + +| GAP1 | IDAM | GAP2 | DATA | CHECKSUM | ... + +GAP1 = 80 80 80 80 80 00 6 +IDAM = FE E7 18 C3 Track# Sector# Checksum-8 of prev. 2 bytes 7 +GAP2 = 80 80 80 80 80 80 00 C3 18 E7 FE 11 +DATA = 126 bytes actual data 126 + = nextTrack# nextSector# 2 +CHECKSUM = Checksum-16 of the previous 128 bytes 2 + --- + 154 bytes + +sectors 0 to 14 are used for the disk directory. sector 15 is used +as track map, with one bit for each sector used. + +*/ + +#define DATA_SIZE (126) +#define SECTOR_SIZE (0x9b) +#define MAX_DIRENTS (15*8) + +/* vzdos directry entry */ +struct vzdos_dirent +{ + char ftype; + char delimitor; + char fname[8]; + UINT8 start_track; + UINT8 start_sector; + UINT16 start_address; + UINT16 end_address; +}; + +struct vz_iterator +{ + int index; + int eof; +}; + +static const UINT8 sector_order[] = +{ + 0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13 +}; + +/********************************************************************* + Internal functions +*********************************************************************/ + +/* get length of filename without trailing spaces */ +static int vzdos_get_fname_len(const char *fname) +{ + int len; + + for (len = 7; len > 0; len--) + if (fname[len] != 0x20) + break; + + return len; +} + +/* calculate checksum-16 of buffer */ +static UINT16 chksum16(UINT8 *buffer, int len) +{ + int i; + UINT16 sum = 0; + + for (i = 0; i < len; i++) + sum += buffer[i]; + + return sum; +} + +/* returns the offset where the actual sector data starts */ +static imgtoolerr_t vzdos_get_data_start(imgtool_image *img, int track, int sector, int *start) +{ + imgtoolerr_t ret; + UINT8 buffer[25]; /* enough to read the sector header */ + + ret = (imgtoolerr_t)floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], 0, &buffer, sizeof(buffer)); + if (ret) return ret; + + /* search for start of data */ + if (memcmp(buffer + 19, "\xC3\x18\xE7\xFE", 4) == 0) + *start = 23; + else if (memcmp(buffer + 20, "\xC3\x18\xE7\xFE", 4) == 0) + *start = 24; + else if (memcmp(buffer + 21, "\xC3\x18\xE7\xFE", 4) == 0) + *start = 25; + else + return IMGTOOLERR_CORRUPTIMAGE; + + return IMGTOOLERR_SUCCESS; +} + +/* return the actual data of a sector */ +static imgtoolerr_t vzdos_read_sector_data(imgtool_image *img, int track, int sector, UINT8 *data) +{ + int ret, data_start; + UINT8 buffer[DATA_SIZE + 4]; /* data + checksum */ + + ret = vzdos_get_data_start(img, track, sector, &data_start); + if (ret) return (imgtoolerr_t)ret; + + ret = floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], data_start, &buffer, sizeof(buffer)); + if (ret) return (imgtoolerr_t)ret; + + /* verify sector checksums */ + if (pick_integer_le(buffer, DATA_SIZE + 2, 2) != chksum16(buffer, DATA_SIZE + 2)) + return IMGTOOLERR_CORRUPTFILE; + + memcpy(data, &buffer, DATA_SIZE + 2); + + return IMGTOOLERR_SUCCESS; +} + +/* write data to sector */ +static imgtoolerr_t vzdos_write_sector_data(imgtool_image *img, int track, int sector, UINT8 *data) +{ + int ret, data_start; + UINT8 buffer[DATA_SIZE + 4]; /* data + checksum */ + + ret = vzdos_get_data_start(img, track, sector, &data_start); + if (ret) return (imgtoolerr_t)ret; + + memcpy(buffer, data, DATA_SIZE + 2); + place_integer_le(buffer, DATA_SIZE + 2, 2, chksum16(data, DATA_SIZE + 2)); + + ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], data_start, buffer, sizeof(buffer), 0); /* TODO: pass ddam argument from imgtool */ + if (ret) return (imgtoolerr_t)ret; + + return IMGTOOLERR_SUCCESS; +} + +/* write formatted empty sector */ +static imgtoolerr_t vzdos_clear_sector(imgtool_image *img, int track, int sector) +{ + UINT8 data[DATA_SIZE + 2]; + + memset(data, 0x00, sizeof(data)); + + return vzdos_write_sector_data(img, track, sector, data); +} + +/* return a directory entry for an index */ +static imgtoolerr_t vzdos_get_dirent(imgtool_image *img, int index, vzdos_dirent *ent) +{ + int ret, entry; + UINT8 buffer[DATA_SIZE + 2]; + + ret = vzdos_read_sector_data(img, 0, (int) index / 8, buffer); + if (ret) return (imgtoolerr_t)ret; + + entry = ((index % 8) * sizeof(vzdos_dirent)); + + memcpy(ent, &buffer[entry], 10); + ent->start_track = pick_integer_le(&buffer[entry], 10, 1); + ent->start_sector = pick_integer_le(&buffer[entry], 11, 1); + ent->start_address = pick_integer_le(&buffer[entry], 12, 2); + ent->end_address = pick_integer_le(&buffer[entry], 14, 2); + + if (ent->ftype == 0x00) + return IMGTOOLERR_FILENOTFOUND; + + /* check values */ + if (ent->start_track > 39) + return IMGTOOLERR_CORRUPTFILE; + + if (ent->start_sector > 15) + return IMGTOOLERR_CORRUPTFILE; + + return IMGTOOLERR_SUCCESS; +} + +/* save a directory entry to disk */ +static imgtoolerr_t vzdos_set_dirent(imgtool_image *img, int index, vzdos_dirent ent) +{ + int ret, entry; + UINT8 buffer[DATA_SIZE + 2]; + + /* read current sector with entries */ + ret = vzdos_read_sector_data(img, 0, (int) index / 8, buffer); + if (ret) return (imgtoolerr_t)ret; + + entry = ((index % 8) * sizeof(vzdos_dirent)); + + memcpy(&buffer[entry], &ent, 10); + place_integer_le(buffer, entry + 10, 1, ent.start_track); + place_integer_le(buffer, entry + 11, 1, ent.start_sector); + place_integer_le(buffer, entry + 12, 2, ent.start_address); + place_integer_le(buffer, entry + 14, 2, ent.end_address); + + /* save new sector */ + ret = vzdos_write_sector_data(img, 0, (int) index / 8, buffer); + if (ret) return (imgtoolerr_t)ret; + + return IMGTOOLERR_SUCCESS; +} + +/* clear a directory entry */ +static imgtoolerr_t vzdos_clear_dirent(imgtool_image *img, int index) +{ + int ret; + vzdos_dirent entry; + + memset(&entry, 0x00, sizeof(vzdos_dirent)); + + ret = vzdos_set_dirent(img, index, entry); + if (ret) return (imgtoolerr_t)ret; + + return IMGTOOLERR_SUCCESS; +} + +/* search the index for a directory entry */ +static imgtoolerr_t vzdos_searchentry(imgtool_image *image, const char *fname, int *entry) { + int i, len, ret; + vzdos_dirent ent; + char filename[9]; + + /* check for invalid filenames */ + if (strlen(fname) > 8) + return IMGTOOLERR_BADFILENAME; + + /* TODO: check for invalid characters */ + + *entry = -1; + + for (i = 0; i < MAX_DIRENTS; i++) { + ret = vzdos_get_dirent(image, i, &ent); + if (ret) return (imgtoolerr_t)ret; + + len = vzdos_get_fname_len(ent.fname) + 1; + + if (strlen(fname) != len) + continue; + + memset(filename, 0x00, sizeof(filename)); + memcpy(filename, ent.fname, len); + + if (!core_stricmp(fname, filename)) { + *entry = i; + break; + } + + } + + if (*entry == -1) + return IMGTOOLERR_FILENOTFOUND; + + return IMGTOOLERR_SUCCESS; +} + +/* return a directory entry for a filename */ +static imgtoolerr_t vzdos_get_dirent_fname(imgtool_image *img, const char *fname, vzdos_dirent *ent) +{ + int ret, index; + + ret = vzdos_searchentry(img, fname, &index); + if (ret) return (imgtoolerr_t)ret; + + ret = vzdos_get_dirent(img, index, ent); + if (ret) return (imgtoolerr_t)ret; + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t vzdos_toggle_trackmap(imgtool_image *img, int track, int sector, int clear) +{ + int ret, value, bit; + UINT8 buffer[DATA_SIZE + 2]; + + /* get trackmap from image */ + ret = vzdos_read_sector_data(img, 0, 15, buffer); + if (ret) return (imgtoolerr_t)ret; + + value = (int) (floor(((double)track * 16 + sector) / 8) - 1); + bit = 0x01 << ((track * 16 + sector) % 8); + + if (clear) + buffer[value-1] &= ~bit; + else + buffer[value-1] |= bit; + + ret = vzdos_write_sector_data(img, 0, 15, buffer); + if (ret) return (imgtoolerr_t)ret; + + return IMGTOOLERR_SUCCESS; +} + +/* clear a trackmap entry */ +static imgtoolerr_t vzdos_clear_trackmap(imgtool_image *img, int track, int sector) +{ + return vzdos_toggle_trackmap(img, track, sector, 1); +} + +/* enable a trackmap entry */ +static imgtoolerr_t vzdos_set_trackmap(imgtool_image *img, int track, int sector) +{ + return vzdos_toggle_trackmap(img, track, sector, 0); +} + +/* return the status of a trackmap entry */ +static imgtoolerr_t vzdos_get_trackmap(imgtool_image *img, int track, int sector, int *used) +{ + int ret, value, bit; + UINT8 buffer[DATA_SIZE + 2]; + + /* get trackmap from image */ + ret = vzdos_read_sector_data(img, 0, 15, buffer); + if (ret) return (imgtoolerr_t)ret; + + value = (int) (floor(((double)track * 16 + sector) / 8) - 1); + bit = 0x01 << ((track * 16 + sector) % 8); + + if (buffer[value-1] & bit) + *used = 1; + else + *used = 0; + + return IMGTOOLERR_SUCCESS; +} + +/* return the next free sector */ +static imgtoolerr_t vzdos_free_trackmap(imgtool_image *img, int *track, int *sector) +{ + int ret, used = 0; + + for (*track = 1; *track < 40; (*track)++) { + for (*sector = 0; *sector < 16; (*sector)++) { + ret = vzdos_get_trackmap(img, *track, *sector, &used); + if (ret) return (imgtoolerr_t)ret; + if (!used) return IMGTOOLERR_SUCCESS; + } + } + + return IMGTOOLERR_NOSPACE; +} + +static imgtoolerr_t vzdos_write_formatted_sector(imgtool_image *img, int track, int sector) +{ + int ret; + UINT8 sector_data[DATA_SIZE + 4 + 24]; + + static const UINT8 sector_header[24] = { + 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0xFE, 0xE7, + 0x18, 0xC3, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x00, 0xC3, 0x18, 0xE7, 0xFE + }; + + memset(sector_data, 0x00, sizeof(sector_data)); + memcpy(sector_data, sector_header, sizeof(sector_header)); + + sector_data[10] = (UINT8) track; /* current track */ + sector_data[11] = (UINT8) sector; /* current sector */ + sector_data[12] = (UINT8) track + sector; /* checksum-8 */ + + ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], 0, sector_data, sizeof(sector_data), 0); /* TODO: pass ddam argument from imgtool */ + if (ret) return (imgtoolerr_t)ret; + + return IMGTOOLERR_SUCCESS; +} + +/********************************************************************* + Imgtool module code +*********************************************************************/ + +static imgtoolerr_t vzdos_diskimage_beginenum(imgtool_directory *enumeration, const char *path) +{ + vz_iterator *iter; + + iter = (vz_iterator *) imgtool_directory_extrabytes(enumeration); + if (!iter) return IMGTOOLERR_OUTOFMEMORY; + + iter->index = 1; + iter->eof = 0; + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t vzdos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) +{ + vz_iterator *iter = (vz_iterator *) imgtool_directory_extrabytes(enumeration); + + if (iter->eof == 1 || iter->index > MAX_DIRENTS) { + ent->eof = 1; + + } else { + const char *type; + int ret, len; + vzdos_dirent dirent; + + ret = vzdos_get_dirent(imgtool_directory_image(enumeration), iter->index - 1, &dirent); + + if (ret == IMGTOOLERR_FILENOTFOUND) + { + iter->eof = 1; + ent->eof = 1; + return IMGTOOLERR_SUCCESS; + } + + if (ret == IMGTOOLERR_CORRUPTFILE) + ent->corrupt = 1; + + /* kill trailing spaces */ + for (len = 7; len > 0; len--) { + if (dirent.fname[len] != 0x20) { + break; + } + } + + memcpy(ent->filename, &dirent.fname, len + 1); + ent->filesize = dirent.end_address - dirent.start_address; + + switch (dirent.ftype) + { + case 0x01: type = "Deleted"; break; + case 'T': type = "Basic"; break; + case 'B': type = "Binary"; break; + case 'D': type = "Data"; break; + case 'F': type = "Quickwrite"; break; + case 'A': type = "Assembler"; break; + case 'S': type = "Diskops"; break; + case 'W': type = "Wordpro"; break; + default: type = "Unknown"; + } + + snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%s", type); + + iter->index++; + } + + return IMGTOOLERR_SUCCESS; +} + +/* TRK 0 sector 15 is used to hold the track map of the disk with one bit + corresponding to a sector used. */ +static imgtoolerr_t vzdos_diskimage_freespace(imgtool_partition *partition, UINT64 *size) +{ + imgtoolerr_t ret; + int i; + imgtool_image *image = imgtool_partition_image(partition); + UINT8 c, v, buffer[DATA_SIZE + 2]; + *size = 0; + + ret = vzdos_read_sector_data(image, 0, 15, buffer); + if (ret) return ret; + + for (i = 0; i < DATA_SIZE; i++) { + v = buffer[i]; + for (c = 0; v; c++) { + v &= v - 1; + } + *size += c * DATA_SIZE; + } + *size = (DATA_SIZE * 16 * 39) - *size; + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t vzdos_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t ret; + imgtool_image *image = imgtool_partition_image(partition); + int filesize, track, sector; + vzdos_dirent ent; + UINT8 buffer[DATA_SIZE + 2]; + + ret = vzdos_get_dirent_fname(image, filename, &ent); + if (ret) return ret; + + filesize = ent.end_address - ent.start_address; + track = ent.start_track; + sector = ent.start_sector; + + while (filesize > 0) { + int towrite; + + ret = vzdos_read_sector_data(image, track, sector, buffer); + if (ret) return ret; + + /* detect sectors pointing to themselfs */ + if ((track == (int)pick_integer_le(buffer, DATA_SIZE, 1)) && (sector == (int)pick_integer_le(buffer, DATA_SIZE + 1, 1))) + return IMGTOOLERR_CORRUPTIMAGE; + + /* load next track and sector values */ + track = pick_integer_le(buffer, DATA_SIZE, 1); + sector = pick_integer_le(buffer, DATA_SIZE + 1, 1); + + /* track 0 is invalid */ + if ((track == 0) && (filesize > DATA_SIZE)) + return IMGTOOLERR_CORRUPTIMAGE; + + /* write either DATA_SIZE or the remaining bytes */ + towrite = filesize > DATA_SIZE ? DATA_SIZE : filesize; + + if (stream_write(destf, buffer, towrite) != towrite) + return IMGTOOLERR_WRITEERROR; + + filesize -= DATA_SIZE; + } + + return IMGTOOLERR_SUCCESS; +} + +/* deletes directory entry, clears trackmap entries and sectors */ +static imgtoolerr_t vzdos_diskimage_deletefile(imgtool_partition *partition, const char *fname) +{ + imgtoolerr_t ret; + imgtool_image *img = imgtool_partition_image(partition); + int index, filesize, track, sector, next_track, next_sector; + vzdos_dirent entry, next_entry; + UINT8 buffer[DATA_SIZE + 2]; + + ret = vzdos_get_dirent_fname(img, fname, &entry); + if (ret) return ret; + + ret = (imgtoolerr_t)floppy_read_sector(imgtool_floppy(img), 0, entry.start_track, sector_order[entry.start_sector], 24, &buffer, DATA_SIZE + 2); + if (ret) return ret; + + filesize = entry.end_address - entry.start_address; + track = entry.start_track; + sector = entry.start_sector; + + /* delete directory entry */ + ret = vzdos_searchentry(img, fname, &index); + if (ret) return ret; + + ret = vzdos_get_dirent(img, index + 1, &next_entry); + + if (ret == IMGTOOLERR_FILENOTFOUND) { + /* we are the last directory entry, just delete it */ + ret = vzdos_clear_dirent(img, index); + if (ret) return ret; + + } else if (ret) { + /* an error occurred */ + return ret; + + } else { + ret = vzdos_set_dirent(img, index++, next_entry); + if (ret) return ret; + + while ((ret = vzdos_get_dirent(img, index + 1, &next_entry)) != IMGTOOLERR_FILENOTFOUND) { + if (ret) return ret; + ret = vzdos_set_dirent(img, index++, next_entry); + if (ret) return ret; + } + + ret = vzdos_clear_dirent(img, index); + if (ret) return ret; + + } + + /* clear sectors and trackmap entries */ + while (filesize > 0) { + filesize -= DATA_SIZE; + + /* clear trackmap entry */ + ret = vzdos_clear_trackmap(img, track, sector); + if (ret) return ret; + + /* load next track and sector values */ + next_track = pick_integer_le(buffer, DATA_SIZE, 1); + next_sector = pick_integer_le(buffer, DATA_SIZE + 1, 1); + + /* overwrite sector with default values */ + ret = vzdos_clear_sector(img, track, sector); + if (ret) return ret; + + /* read next sector */ + track = next_track; + sector = next_sector; + + if (filesize > 0) { + ret = (imgtoolerr_t)floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], 24, &buffer, DATA_SIZE + 2); + if (ret) return ret; + } + + } + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t vzdos_writefile(imgtool_partition *partition, int offset, imgtool_stream *sourcef, vzdos_dirent *entry) +{ + imgtoolerr_t ret; + imgtool_image *img = imgtool_partition_image(partition); + int index, track, sector, toread, next_track, next_sector; + vzdos_dirent temp_entry; + UINT64 filesize = 0, freespace = 0; + UINT8 buffer[DATA_SIZE + 2]; + char filename[9]; + + /* is the image writeable? */ + if (floppy_is_read_only(imgtool_floppy(img))) + return IMGTOOLERR_READONLY; + + /* check for already existing filename -> overwrite */ + strcpy(filename, entry->fname); + filename[vzdos_get_fname_len(entry->fname) + 1] = 0x00; + ret = vzdos_get_dirent_fname(img, filename, &temp_entry); + if (!ret) { + /* file already exists, delete it */ + ret = vzdos_diskimage_deletefile(partition, filename); + if (ret) return ret; + } else if (ret != IMGTOOLERR_FILENOTFOUND) { + /* another error occurred, return it */ + return ret; + } + + ret = (imgtoolerr_t)stream_seek(sourcef, offset, SEEK_SET); + if (ret) return ret; + + /* check if there is enough space */ + filesize = stream_size(sourcef) - offset; + + ret = vzdos_diskimage_freespace(partition, &freespace); + if (ret) return ret; + + if (filesize > freespace) + return IMGTOOLERR_NOSPACE; + + /* get next free track and sector */ + ret = vzdos_free_trackmap(img, &track, §or); + if (ret) return ret; + + entry->end_address = entry->start_address + (unsigned int) filesize; + entry->start_track = track; + entry->start_sector = sector; + + /* search for next free directory entry */ + for (index = 0; index < MAX_DIRENTS; index++) { + ret = vzdos_get_dirent(img, index, &temp_entry); + if (ret == IMGTOOLERR_FILENOTFOUND) + break; + else if (ret) + return (ret); + } + + /* write directory entry to disk */ + ret = vzdos_set_dirent(img, index, *entry); + if (ret) return ret; + + next_track = 0; + next_sector = 0; + + /* write data to disk */ + while (filesize > 0) { + toread = filesize > DATA_SIZE ? DATA_SIZE : filesize; + stream_read(sourcef, buffer, toread); + + filesize -= toread; + + /* mark sector as used */ + ret = vzdos_set_trackmap(img, track, sector); + if (ret) return ret; + + /* get track and sector for next sector */ + if (filesize > 0) { + ret = vzdos_free_trackmap(img, &next_track, &next_sector); + if (ret) return ret; + } else { + next_track = 0; + next_sector = 0; + } + buffer[DATA_SIZE] = next_track; + buffer[DATA_SIZE + 1] = next_sector; + + /* write sector to disk */ + ret = vzdos_write_sector_data(img, track, sector, buffer); + if (ret) return ret; + + track = next_track; + sector = next_sector; + } + + return IMGTOOLERR_SUCCESS; + +} + +/* create a new file or overwrite a file */ +static imgtoolerr_t vzdos_diskimage_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtoolerr_t ret; + int ftype; + vzdos_dirent entry; + + /* TODO: check for leading spaces and strip */ + if (strlen(filename) > 8 || strlen(filename) < 1) + return IMGTOOLERR_BADFILENAME; + + /* prepare directory entry */ + ftype = option_resolution_lookup_int(opts, 'T'); + + switch (ftype) { + case 0: + entry.ftype = 'T'; + entry.start_address = 31465; + break; + case 1: + entry.ftype = 'B'; + entry.start_address = 31465; /* ??? */ + break; + case 2: + entry.ftype = 'D'; + entry.start_address = 31465; /* ??? */ + break; + default: + break; + } + + entry.delimitor = ':'; + memset(&entry.fname, 0x20, 8); /* pad with spaces */ + memcpy(&entry.fname, filename, strlen(filename)); + + /* write file to disk */ + ret = vzdos_writefile(partition, 0, sourcef, &entry); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t vzdos_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) +{ + imgtoolerr_t ret; + imgtool_image *image = imgtool_partition_image(partition); + vzdos_dirent entry; + + if (fname) { + ret = vzdos_get_dirent_fname(image, fname, &entry); + if (ret) return ret; + + switch (entry.ftype) { + case 'B': + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = filter_vzsnapshot_getinfo; + suggestions[0].description = "VZ Snapshot"; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = NULL; + suggestions[1].description = "Raw"; + break; + case 'T': + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = filter_vzsnapshot_getinfo; + suggestions[0].description = "VZ Snapshot"; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = NULL; + suggestions[1].description = "Raw"; + suggestions[2].viability = SUGGESTION_POSSIBLE; + suggestions[2].filter = filter_vzbas_getinfo; + suggestions[2].description = "Tokenized Basic"; + break; + default: + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = NULL; + suggestions[0].description = "Raw"; + } + + } else { + suggestions[0].viability = SUGGESTION_RECOMMENDED; + suggestions[0].filter = NULL; + suggestions[0].description = "Raw"; + suggestions[1].viability = SUGGESTION_POSSIBLE; + suggestions[1].filter = filter_vzsnapshot_getinfo; + suggestions[1].description = "VZ Snapshot"; + } + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t vzdos_diskimage_create(imgtool_image *img, imgtool_stream *stream, option_resolution *opts) +{ + imgtoolerr_t ret; + int track, sector; + + for (track = 0; track < 40; track++) { + for (sector = 0; sector < 16; sector++) { + ret = vzdos_write_formatted_sector(img, track, sector); + if (ret) return ret; + } + } + + return IMGTOOLERR_SUCCESS; +} + +/********************************************************************* + Imgtool vz filter code +*********************************************************************/ + +static imgtoolerr_t vzsnapshot_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) +{ + imgtoolerr_t ret; + imgtool_image *image = imgtool_partition_image(partition); + vzdos_dirent entry; + UINT8 header[24]; + + /* get directory entry from disk */ + ret = vzdos_get_dirent_fname(image, filename, &entry); + if (ret) return ret; + + /* prepare header */ + header[0] = 'V'; + header[1] = 'Z'; + header[2] = 'F'; + + switch (entry.ftype) { + case 'B': + header[3] = '1'; + header[21] = 0xF1; + break; + case 'T': + header[3] = '0'; + header[21] = 0xF0; + break; + default: + memset(header, 0x00, 4); + header[21] = 0x00; + } + + memset(header + 4, 0x00, 17); + memcpy(header + 4, entry.fname, vzdos_get_fname_len(entry.fname) + 1); + place_integer_le(header, 22, 2, entry.start_address); + + /* write header to file */ + stream_write(destf, header, sizeof(header)); + + /* write data to file */ + ret = vzdos_diskimage_readfile(partition, filename, "", destf); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + +static imgtoolerr_t vzsnapshot_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) +{ + imgtoolerr_t ret; + int fnameopt; + vzdos_dirent entry; + UINT8 header[24]; + + /* get header infos from file */ + stream_read(sourcef, header, sizeof(header)); + + /* prepare directory entry */ + entry.ftype = header[21] == 0xF1 ? 'B' : 'T'; + entry.delimitor = ':'; + entry.start_address = pick_integer_le(header, 22, 2); + + /* filename from header or directly? */ + fnameopt = option_resolution_lookup_int(opts, 'F'); + + if (fnameopt == 0) { + memcpy(&entry.fname, &header[4], 8); + } else { + /* TODO: check for leading spaces and strip */ + if (strlen(filename) > 8 || strlen(filename) < 1) + return IMGTOOLERR_BADFILENAME; + + memcpy(&entry.fname, filename, strlen(filename) - 3); + } + + /* write file to disk */ + ret = vzdos_writefile(partition, 24, sourcef, &entry); + if (ret) return ret; + + return IMGTOOLERR_SUCCESS; +} + +void filter_vzsnapshot_getinfo(UINT32 state, union filterinfo *info) +{ + switch(state) + { + case FILTINFO_STR_NAME: info->s = "vzsnapshot"; break; + case FILTINFO_STR_HUMANNAME: info->s = "VZ Snapshot"; break; + case FILTINFO_STR_EXTENSION: info->s = "vz"; break; + case FILTINFO_PTR_READFILE: info->read_file = vzsnapshot_readfile; break; + case FILTINFO_PTR_WRITEFILE: info->write_file = vzsnapshot_writefile; break; + } +} + +/********************************************************************* + Imgtool module declaration +*********************************************************************/ + +static OPTION_GUIDE_START(vzdos_writefile_optionguide) + OPTION_ENUM_START( 'T', "ftype", "File type" ) + OPTION_ENUM( 0, "basic", "Basic" ) + OPTION_ENUM( 1, "binary", "Binary" ) + OPTION_ENUM( 2, "data", "Data" ) + OPTION_ENUM_END + OPTION_ENUM_START( 'F', "fname", "Filename" ) + OPTION_ENUM( 0, "intern", "Filename from VZ-Header" ) + OPTION_ENUM( 1, "extern", "Actual filename" ) + OPTION_ENUM_END +OPTION_GUIDE_END + +/* +T Basic Editor File +B Binary File +D Sequential Access Program Data File +F Quickwrite Document +A Russell Harrison's Edit Ass. File +S Dave Mitchell/Mark Hardwood Edit Ass. File Start Addr A280H +S Quickwrite/Diskops System File/Label Except Above +W Edit Ass. with Diskops File Start Addr A813H +W E & F Word Pro with Patch 3.3 File End Addr D000H +W Russell Harrison Word Pro File Except above two +*/ + +void vzdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) +{ + switch(state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break; + case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(vz_iterator); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "vzdos"); break; + case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "VZ-DOS format"); break; + case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; + case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T[0]-2;F[0]-1"); break; + case IMGTOOLINFO_STR_EOLN: info->s = NULL; break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; + case IMGTOOLINFO_PTR_OPEN: info->open = NULL; break; + case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = vzdos_diskimage_beginenum; break; + case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = vzdos_diskimage_nextenum; break; + case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = vzdos_diskimage_freespace; break; + case IMGTOOLINFO_PTR_READ_FILE: info->read_file = vzdos_diskimage_readfile; break; + case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = vzdos_diskimage_writefile; break; + case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = vzdos_diskimage_deletefile; break; + case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = vzdos_diskimage_create; break; + case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = vzdos_writefile_optionguide; break; + case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = vzdos_diskimage_suggesttransfer; break; + case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_vz; break; + } +} diff --git a/src/mame/tools/imgtool/stream.c b/src/mame/tools/imgtool/stream.c new file mode 100644 index 00000000000..5c9cf4050c6 --- /dev/null +++ b/src/mame/tools/imgtool/stream.c @@ -0,0 +1,536 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + stream.c + + Code for implementing Imgtool streams + +***************************************************************************/ + +#include +#include +#include + +#include "unzip.h" +#include "osdcore.h" +#include "imgtool.h" + +enum imgtype_t +{ + IMG_FILE, + IMG_MEM +}; + +struct imgtool_stream +{ + imgtype_t imgtype; + int write_protect; + const char *name; // needed for clear + UINT64 position; + UINT64 filesize; + + union + { + core_file *file; + UINT8 *buffer; + } u; +}; + + + +static imgtool_stream *stream_open_zip(const char *zipname, const char *subname, int read_or_write) +{ + imgtool_stream *imgfile = NULL; +// zip_error ziperr; + zip_file *z = NULL; + const zip_file_header *zipent; + FILE *f; + + if (read_or_write) + goto error; + + /* check to see if the file exists */ + f = fopen(zipname, "r"); + if (!f) + goto error; + fclose(f); + + imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); + if (!imgfile) + goto error; + + memset(imgfile, 0, sizeof(*imgfile)); + imgfile->imgtype = IMG_MEM; + imgfile->write_protect = 1; + imgfile->position = 0; + +// ziperr = + zip_file_open(zipname, &z); + if (!z) + goto error; + + zipent = zip_file_first_file(z); + while(zipent && subname && strcmp(subname, zipent->filename)) + zipent = zip_file_next_file(z); + if (!zipent) + goto error; + + imgfile->filesize = zipent->uncompressed_length; + imgfile->u.buffer = (UINT8*)malloc(zipent->uncompressed_length); + if (!imgfile->u.buffer) + goto error; + + if (zip_file_decompress(z, imgfile->u.buffer, zipent->uncompressed_length)) + goto error; + + zip_file_close(z); + return imgfile; + +error: + if (z) + zip_file_close(z); + if (imgfile) + { + if (imgfile->u.buffer) + free(imgfile->u.buffer); + free(imgfile); + } + return NULL; +} + + + +imgtool_stream *stream_open(const char *fname, int read_or_write) +{ + file_error filerr; + const char *ext; + imgtool_stream *imgfile = NULL; + static const UINT32 write_modes[] = + { + OPEN_FLAG_READ, + OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, + OPEN_FLAG_READ | OPEN_FLAG_WRITE, + OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE + }; + core_file *f = NULL; + char *buf = NULL; + int len, i; + imgtool_stream *s = NULL; + char c; + + /* maybe we are just a ZIP? */ + ext = strrchr(fname, '.'); + if (ext && !core_stricmp(ext, ".zip")) + return stream_open_zip(fname, NULL, read_or_write); + + filerr = core_fopen(fname, write_modes[read_or_write], &f); + if (filerr != FILERR_NONE) + { + if (!read_or_write) + { + len = strlen(fname); + + /* can't open the file; try opening ZIP files with other names */ + buf = (char*)malloc(len + 1); + if (!buf) + goto error; + strcpy(buf, fname); + + for(i = len-1; !s && (i >= 0); i--) + { + if ((buf[i] == '\\') || (buf[i] == '/')) + { + c = buf[i]; + buf[i] = '\0'; + s = stream_open_zip(buf, buf + i + 1, read_or_write); + buf[i] = c; + } + } + free(buf); + buf = NULL; + + if (s) + return s; + } + + /* ah well, it was worth a shot */ + goto error; + } + + imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); + if (!imgfile) + goto error; + + /* Normal file */ + memset(imgfile, 0, sizeof(*imgfile)); + imgfile->imgtype = IMG_FILE; + imgfile->position = 0; + imgfile->filesize = core_fsize(f); + imgfile->write_protect = read_or_write ? 0 : 1; + imgfile->u.file = f; + imgfile->name = fname; + return imgfile; + +error: + if (imgfile != NULL) + free((void *) imgfile); + if (f != NULL) + core_fclose(f); + if (buf) + free(buf); + return (imgtool_stream *) NULL; +} + + + +imgtool_stream *stream_open_write_stream(int size) +{ + imgtool_stream *imgfile; + + imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); + if (!imgfile) + return NULL; + + imgfile->imgtype = IMG_MEM; + imgfile->write_protect = 0; + imgfile->position = 0; + imgfile->filesize = size; + imgfile->u.buffer = (UINT8*)malloc(size); + + if (!imgfile->u.buffer) + { + free(imgfile); + return NULL; + } + + return imgfile; +} + + + +imgtool_stream *stream_open_mem(void *buf, size_t sz) +{ + imgtool_stream *imgfile; + + imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); + if (!imgfile) + return NULL; + + memset(imgfile, 0, sizeof(*imgfile)); + imgfile->imgtype = IMG_MEM; + imgfile->position = 0; + imgfile->write_protect = 0; + + imgfile->filesize = sz; + imgfile->u.buffer = (UINT8*)buf; + return imgfile; +} + + + +void stream_close(imgtool_stream *s) +{ + assert(s != NULL); + + switch(s->imgtype) + { + case IMG_FILE: + if (s->u.file != NULL) + { + core_fclose(s->u.file); + s->u.file = NULL; + } + break; + + case IMG_MEM: + if (s->u.buffer != NULL) + { + free(s->u.buffer); + s->u.buffer = NULL; + } + break; + + default: + assert(0); + break; + } + free((void *) s); +} + + + +core_file *stream_core_file(imgtool_stream *stream) +{ + return (stream->imgtype == IMG_FILE) ? stream->u.file : NULL; +} + + + +UINT32 stream_read(imgtool_stream *stream, void *buf, UINT32 sz) +{ + UINT32 result = 0; + + switch(stream->imgtype) + { + case IMG_FILE: + assert(sz == (UINT32) sz); + core_fseek(stream->u.file, stream->position, SEEK_SET); + result = core_fread(stream->u.file, buf, (UINT32) sz); + break; + + case IMG_MEM: + /* do we have to limit sz? */ + if (sz > (stream->filesize - stream->position)) + sz = (UINT32) (stream->filesize - stream->position); + + memcpy(buf, stream->u.buffer + stream->position, sz); + result = sz; + break; + + default: + assert(0); + break; + } + stream->position += result; + return result; +} + + + +UINT32 stream_write(imgtool_stream *s, const void *buf, UINT32 sz) +{ + void *new_buffer; + UINT32 result = 0; + + switch(s->imgtype) + { + case IMG_MEM: + if (!s->write_protect) + { + /* do we have to expand the buffer? */ + if (s->filesize < s->position + sz) + { + /* try to expand the buffer */ + if (s->u.buffer) free(s->u.buffer); + new_buffer = malloc(s->position + sz); + if (new_buffer) + { + s->u.buffer = (UINT8*)new_buffer; + s->filesize = s->position + sz; + } + } + + /* do we have to limit sz? */ + if (sz > (s->filesize - s->position)) + sz = (UINT32) (s->filesize - s->position); + + memcpy(s->u.buffer + s->position, buf, sz); + result = sz; + } + break; + + case IMG_FILE: + core_fseek(s->u.file, s->position, SEEK_SET); + result = core_fwrite(s->u.file, buf, sz); + break; + + default: + assert(0); + break; + } + + /* advance the file pointer */ + s->position += result; + + /* did we grow the file */ + if (s->position > s->filesize) + s->filesize = s->position; + return result; +} + + + +UINT64 stream_size(imgtool_stream *s) +{ + return s->filesize; +} + + + +void *stream_getptr(imgtool_stream *f) +{ + void *ptr; + + switch(f->imgtype) + { + case IMG_MEM: + ptr = f->u.buffer; + break; + + default: + ptr = NULL; + break; + } + return ptr; +} + + + +int stream_seek(imgtool_stream *s, INT64 pos, int where) +{ + UINT64 size; + + size = stream_size(s); + + switch(where) + { + case SEEK_CUR: + pos += s->position; + break; + case SEEK_END: + pos += size; + break; + } + + if (pos < 0) + s->position = 0; + else + s->position = MIN(size, pos); + + if (s->position < pos) + stream_fill(s, '\0', pos - s->position); + + return 0; +} + + + +UINT64 stream_tell(imgtool_stream *s) +{ + return s->position; +} + + + +UINT64 stream_transfer(imgtool_stream *dest, imgtool_stream *source, UINT64 sz) +{ + UINT64 result = 0; + UINT64 readsz; + char buf[1024]; + + while(sz && (readsz = stream_read(source, buf, MIN(sz, sizeof(buf))))) + { + stream_write(dest, buf, readsz); + sz -= readsz; + result += readsz; + } + return result; +} + + + +UINT64 stream_transfer_all(imgtool_stream *dest, imgtool_stream *source) +{ + return stream_transfer(dest, source, stream_size(source)); +} + + + +int stream_crc(imgtool_stream *s, unsigned long *result) +{ + size_t sz; + void *ptr; + + switch(s->imgtype) + { + case IMG_MEM: + *result = crc32(0, (unsigned char *) s->u.buffer, (size_t) s->filesize); + break; + + default: + sz = stream_size(s); + ptr = malloc(sz); + if (!ptr) + return IMGTOOLERR_OUTOFMEMORY; + stream_seek(s, 0, SEEK_SET); + if (stream_read(s, ptr, sz) != sz) + { + free(ptr); + return IMGTOOLERR_READERROR; + } + *result = crc32(0, (const Bytef*)ptr, sz); + free(ptr); + break; + } + return 0; +} + + + +int file_crc(const char *fname, unsigned long *result) +{ + int err; + imgtool_stream *f; + + f = stream_open(fname, OSD_FOPEN_READ); + if (!f) + return IMGTOOLERR_FILENOTFOUND; + + err = stream_crc(f, result); + stream_close(f); + return err; +} + + + +UINT64 stream_fill(imgtool_stream *f, unsigned char b, UINT64 sz) +{ + UINT64 outsz; + char buf[1024]; + + outsz = 0; + memset(buf, b, MIN(sz, sizeof(buf))); + + while(sz) + { + outsz += stream_write(f, buf, MIN(sz, sizeof(buf))); + sz -= MIN(sz, sizeof(buf)); + } + return outsz; +} + + + +int stream_isreadonly(imgtool_stream *s) +{ + return s->write_protect; +} + + + +UINT32 stream_putc(imgtool_stream *stream, char c) +{ + return stream_write(stream, &c, 1); +} + + + +UINT32 stream_puts(imgtool_stream *stream, const char *s) +{ + return stream_write(stream, s, strlen(s)); +} + + + +UINT32 stream_printf(imgtool_stream *stream, const char *fmt, ...) +{ + va_list va; + char buf[256]; + + va_start(va, fmt); + vsprintf(buf, fmt, va); + va_end(va); + + return stream_puts(stream, buf); +} diff --git a/src/mame/tools/imgtool/stream.h b/src/mame/tools/imgtool/stream.h new file mode 100644 index 00000000000..13e6e0d727f --- /dev/null +++ b/src/mame/tools/imgtool/stream.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + stream.h + + Code for implementing Imgtool streams + +***************************************************************************/ + +#ifndef STREAM_H +#define STREAM_H + +#include "imgterrs.h" +#include "corefile.h" + +struct imgtool_stream; + +imgtool_stream *stream_open(const char *fname, int read_or_write); /* similar params to mame_fopen */ +imgtool_stream *stream_open_write_stream(int filesize); +imgtool_stream *stream_open_mem(void *buf, size_t sz); +void stream_close(imgtool_stream *stream); +core_file *stream_core_file(imgtool_stream *stream); +UINT32 stream_read(imgtool_stream *stream, void *buf, UINT32 sz); +UINT32 stream_write(imgtool_stream *stream, const void *buf, UINT32 sz); +UINT64 stream_size(imgtool_stream *stream); +int stream_seek(imgtool_stream *stream, INT64 pos, int where); +UINT64 stream_tell(imgtool_stream *stream); +void *stream_getptr(imgtool_stream *stream); +UINT32 stream_putc(imgtool_stream *stream, char c); +UINT32 stream_puts(imgtool_stream *stream, const char *s); +UINT32 stream_printf(imgtool_stream *stream, const char *fmt, ...) ATTR_PRINTF(2,3); + +/* Transfers sz bytes from source to dest */ +UINT64 stream_transfer(imgtool_stream *dest, imgtool_stream *source, UINT64 sz); +UINT64 stream_transfer_all(imgtool_stream *dest, imgtool_stream *source); + +/* Fills sz bytes with b */ +UINT64 stream_fill(imgtool_stream *f, unsigned char b, UINT64 sz); + +/* Returns the CRC of a file */ +int stream_crc(imgtool_stream *f, unsigned long *result); +int file_crc(const char *fname, unsigned long *result); + +/* Returns whether a stream is read only or not */ +int stream_isreadonly(imgtool_stream *f); + +#endif /* STREAM_H */ diff --git a/src/mame/video/733_asr.c b/src/mame/video/733_asr.c new file mode 100644 index 00000000000..da1286d69f5 --- /dev/null +++ b/src/mame/video/733_asr.c @@ -0,0 +1,815 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + 733 ASR emulation + + We are emulating a TI Model 733 ASR ("Silent 700") data terminal, + interfaced through a TI asynchronous EIA/TTY interface module. + + The ASR features a printer, a keyboard and a tape unit (which is not + emulated). The ASR is attached to the computer with a serial interface. + + References: + 945401-9701 Model 990/4 Computer System Field Maintenance Manual p. C-1, + 945250-9701 990 Computer Family Systems Handbook pp. 5-9 through 5-16, + 0943442-9701 Model 990 Computer Reference Manual Preliminary pp. 3-13 + through 3-21 and 3-39 through 3-44. + + TODO: + * separate ASR emulation from EIA interface emulation? + * implement tape interface? + + Raphael Nabet 2003 + + Rewritten as class + Michael Zapf, 2014 +*/ + +#include "emu.h" +#include "733_asr.h" + +enum +{ + /*ASROutQueueSize = 32,*/ + + asr_window_offset_x = 0, + asr_window_offset_y = 0, + asr_window_width = 640, + asr_window_height = 480, + asr_scroll_step = 8 +}; + +enum +{ + AS_wrq_mask = 1 << 3, + AS_rrq_mask = 1 << 4, + AS_dsr_mask = 1 << 6, + AS_int_mask = 1 << 7, + + AM_dtr_mask = 1 << 1, + AM_rts_mask = 1 << 2, + AM_enint_mask = 1 << 6 +}; + +enum +{ + asrfontdata_size = 96/*128*/*8 +}; + +static const gfx_layout fontlayout = +{ + 6, 8, /* 6*8 characters */ + /*96*/128, /* 96 characters */ + 1, /* 1 bit per pixel */ + { 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 /* every char takes 8 consecutive bytes */ +}; + +static GFXDECODE_START( asr733 ) + GFXDECODE_ENTRY( asr733_chr_region, 0, fontlayout, 0, 1 ) +GFXDECODE_END + +PALETTE_INIT_MEMBER(asr733_device, asr733) +{ + palette.set_pen_color(0,rgb_t::white); /* white */ + palette.set_pen_color(1,rgb_t::black); /* black */ +} + + +const device_type ASR733 = &device_creator; + +asr733_device::asr733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ASR733, "733 ASR", tag, owner, clock, "asr733", __FILE__), + m_palette(*this, "palette"), + m_gfxdecode(*this, "gfxdecode"), + m_keyint_line(*this), + m_lineint_line(*this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void asr733_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void asr733_device::device_start() +{ + screen_device *screen = machine().first_screen(); + int width = screen->width(); + int height = screen->height(); + const rectangle &visarea = screen->visible_area(); + + m_last_key_pressed = 0x80; + m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); + + m_bitmap->fill(0, visarea); + + m_keyint_line.resolve(); + m_lineint_line.resolve(); + + m_line_timer = timer_alloc(0); + + UINT8 *dst; + + static const unsigned char fontdata6x8[asrfontdata_size] = + { /* ASCII characters */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, + 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00, + 0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08, + 0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00, + 0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00, + 0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00, + 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00, + 0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00, + 0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, + 0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00, + 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00, + 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60, + 0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, + 0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, + 0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, + 0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, + 0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, + 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00, + 0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, + 0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08, + 0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, + 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, + 0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00, + 0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00, + 0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00, + 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00, + 0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc, + 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, + 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00, + 0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, + 0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, + 0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00, + 0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00, + 0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, + 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, + 0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, + 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00, + 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00, + 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, + 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, + 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00 + }; + + dst = machine().root_device().memregion(asr733_chr_region)->base(); + + memcpy(dst, fontdata6x8, asrfontdata_size); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void asr733_device::device_reset() +{ + /*m_OutQueueLen = 0;*/ + + m_status = AS_dsr_mask | AS_wrq_mask; + m_mode = 0; + m_line_timer->adjust(attotime::from_msec(0), 0, attotime::from_hz(60)); + + set_interrupt_line(); +} + +void asr733_device::set_interrupt_line() +{ + if ((m_mode & AM_enint_mask) && (m_new_status_flag)) /* right??? */ + { + m_status |= AS_int_mask; + m_keyint_line(ASSERT_LINE); + } + else + { + m_status &= ~AS_int_mask; + m_keyint_line(CLEAR_LINE); + } +} + +/* write a single char on screen */ +void asr733_device::draw_char(int character, int x, int y, int color) +{ + m_gfxdecode->gfx(0)->opaque(*m_bitmap, m_bitmap->cliprect(), character-32, color, 0, 0, x+1, y); +} + +void asr733_device::linefeed() +{ + UINT8 buf[asr_window_width]; + + for (int y=asr_window_offset_y; ypens()); + } + + const rectangle asr_scroll_clear_window( + asr_window_offset_x, /* min_x */ + asr_window_offset_x+asr_window_width-1, /* max_x */ + asr_window_offset_y+asr_window_height-asr_scroll_step, /* min_y */ + asr_window_offset_y+asr_window_height-1 /* max_y */ + ); + m_bitmap->fill(0, asr_scroll_clear_window); +} + +void asr733_device::transmit(UINT8 data) +{ + switch (data) + { + /* aux device control chars */ + case 0x05: + /* ENQ -> "WRU": ??? */ + break; + + case 0x11: + /* DC1 -> "X-ON": transmit on??? */ + break; + + case 0x12: + /* DC2 -> "X-OFF": transmit off??? */ + break; + + case 0x13: + /* DC3 -> "TAPE": tape on??? */ + break; + + case 0x14: + /* DC4 -> "-T-A-P-E-" ("TAPE" with overstrike): tape off??? */ + break; + + + /* printer control chars */ + case 0x07: + /* BELL: 250ms beep */ + break; + + case 0x08: + /* BS: backspace */ + if (m_x > 0) + m_x--; + break; + + case 0x0A: + /* LF: line feed */ + linefeed(); + break; + + case 0x0D: + /* CR: carriage return */ + m_x = 0; + break; + + + default: + if ((data < 0x20) || (data == 0x7f) || (data >= 0x80)) + /* ignore control characters */ + break; + + if (m_x == 80) + { + m_x = 0; + linefeed(); + } + draw_char(data, asr_window_offset_x + m_x*8, asr_window_offset_y+asr_window_height-8, 0); + m_x++; + break; + } + + m_status |= AS_wrq_mask; + m_new_status_flag = 1; /* right??? */ + set_interrupt_line(); +} + +#if 0 +void asr733_device::receive_callback(int dummy) +{ + (void) dummy; + + m_recv_buf = m_OutQueue[m_OutQueueHead]; + m_OutQueueHead = (m_OutQueueHead + 1) % ASROutQueueSize; + m_OutQueueLen--; + + m_status |= AS_rrq_mask; + m_new_status_flag = 1; /* right??? */ + set_interrupt_line(); +} +#endif + +/* + 0-7: receive buffer + 8: XMITING transmit in progress, 1 if transmitting + 9: TIMERR timing error, 1 if error + 10: RCR reverse channel receive, not used + "ASR733/33 ID" 1 -> TTY (???) (2270509-9701 pp. G-9 & G-10) + 11: WRQ write request, 1 if ready to transmit + 12: RRQ read request, 1 if ready to receive + 13: DCD data carrier detect, not used + 14: DSR data set ready, 1 if online + 15: INT interrupt, 1 if interrupt +*/ +READ8_MEMBER( asr733_device::cru_r ) +{ + int reply = 0; + + switch (offset) + { + case 0: + /* receive buffer */ + reply = m_recv_buf; + break; + + case 1: + /* status register */ + reply = m_status; + break; + } + + return reply; +} + +/* + 0-7: transmit buffer + 8: not used + 9: DTR data terminal ready (set to 1) + 10: RTS request to send (set to 1) + 11: CLRWRQ clear write request (write any value to execute) + 12: CLRRRQ clear read request (write any value to execute) + 13: CLRNSF clear new status flag - clear DSR/DCD interrupts (write any value to execute) + 14: enable interrupts, 1 to enable interrupts + 15: diagnostic mode, 0 for normal mode +*/ +WRITE8_MEMBER( asr733_device::cru_w ) +{ + switch (offset) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + /* transmit buffer */ + if (data) + m_xmit_buf |= 1 << offset; + else + m_xmit_buf &= ~ (1 << offset); + if ((offset == 7) && (m_mode & AM_dtr_mask) && (m_mode & AM_rts_mask)) /* right??? */ + transmit(m_xmit_buf); + break; + + case 8: /* not used */ + break; + + case 9: /* data terminal ready (set to 1) */ + case 10: /* request to send (set to 1) */ + case 14: /* enable interrupts, 1 to enable interrupts */ + case 15: /* diagnostic mode, 0 for normal mode */ + if (data) + m_mode |= 1 << (offset - 8); + else + m_mode &= ~ (1 << (offset - 8)); + if (offset == 14) + set_interrupt_line(); + break; + + case 11: /* clear write request (write any value to execute) */ + case 12: /* clear read request (write any value to execute) */ + m_status &= ~ (1 << (offset - 8)); + set_interrupt_line(); + break; + + case 13: /* clear new status flag - whatever it means (write any value to execute) */ + m_new_status_flag = 0; + set_interrupt_line(); + break; + } +} + +/* + Video refresh +*/ +void asr733_device::refresh(bitmap_ind16 &bitmap, int x, int y) +{ + copybitmap(bitmap, *m_bitmap, 0, 0, x, y, m_bitmap->cliprect()); +} + + +/* + Time callbacks +*/ +void asr733_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + check_keyboard(); + m_lineint_line(ASSERT_LINE); + m_lineint_line(CLEAR_LINE); +} + +static const unsigned char key_translate[3][51] = +{ + { /* unshifted */ + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '0', + ':', + '-', + + 0x1b, + 'Q', + 'W', + 'E', + 'R', + 'T', + 'Y', + 'U', + 'I', + 'O', + 'P', + 0x0a, + 0x0d, + + 0, + 'A', + 'S', + 'D', + 'F', + 'G', + 'H', + 'J', + 'K', + 'L', + ';', + 0x08, + 0, + + 0, + 'Z', + 'X', + 'C', + 'V', + 'B', + 'N', + 'M', + ',', + '.', + '/', + 0, + + ' ' + }, + { /* shifted */ + '!', + '"', + '#', + '$', + '%', + '&', + '^', + '(', + ')', + ' ', + '*', + '=', + + 0x1b, + 'Q', + 'W', + 'E', + 'R', + 'T', + 'Y', + 'U', + 'I', + '_', + '@', + 0x0a, + 0x0d, + + 0, + 'A', + 'S', + 'D', + 'F', + 'G', + 'H', + 'J', + 0, + '/', + '+', + 0x08, + 0, + + 0, + 'Z', + 'X', + 'C', + 'V', + 'B', + '^', + '|', + '<', + '>', + '?', + 0, + + ' ' + }, + { /* control */ + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '0', + ':', + '-', + + 0x1b, + 0x11, + 0x17, + 0x05, + 0x12, + 0x14, + 0x19, + 0x15, + 0x09, + 0x0f, + 0x10, + 0x0a, + 0x0d, + + 0, + 0x01, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0a, + 0x0b, + 0x0c, + ';', + 0x08, + 0, + + 0, + 0x1a, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0e, + 0x0d, + ',', + '.', + '/', + 0, + + ' ' + } +}; + + +/* + keyboard handler: should be called regularly by machine code, for instance + every Video Blank Interrupt. +*/ +void asr733_device::check_keyboard() +{ + enum modifier_state_t + { + /* key modifier states */ + unshifted = 0, shift, control, + /* special value to stop repeat if the modifier state changes */ + special_debounce = -1 + } ; + + enum { repeat_delay = 5 /* approx. 1/10s */ }; + + //UINT16 key_buf[6]; + UINT16 key_buf[4]; + int i, j; + modifier_state_t modifier_state; + int repeat_mode; + + static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" }; + + /* read current key state */ + /* 2008-05 FP: in 733_asr.h there are only 4 input ports defined... */ + /* for (i = 0; i < 6; i++) */ + for (i = 0; i < 4; i++) + { + key_buf[i] = ioport(keynames[i])->read(); + } + + /* process key modifiers */ + if (key_buf[1] & 0x0200) + modifier_state = control; + else if ((key_buf[2] & 0x0040) || (key_buf[3] & 0x0002)) + modifier_state = shift; + else + modifier_state = unshifted; + + /* test repeat key */ + repeat_mode = key_buf[2] & 0x0020; + + /* remove modifier keys */ + key_buf[1] &= ~0x0200; + key_buf[2] &= ~0x0060; + key_buf[3] &= ~0x0002; + + if (! repeat_mode) + /* reset REPEAT timer if the REPEAT key is not pressed */ + m_repeat_timer = 0; + + if ( !(m_last_key_pressed & 0x80) && (key_buf[m_last_key_pressed >> 4] & (1 << (m_last_key_pressed & 0xf)))) + { + /* last key has not been released */ + if (modifier_state == m_last_modifier_state) + { + /* handle REPEAT mode if applicable */ + if ((repeat_mode) && (++m_repeat_timer == repeat_delay)) + { + if (m_status & AS_rrq_mask) + { /* keyboard buffer full */ + m_repeat_timer--; + } + else + { /* repeat current key */ + m_status |= AS_rrq_mask; + m_new_status_flag = 1; /* right??? */ + set_interrupt_line(); + m_repeat_timer = 0; + } + } + } + else + { + m_repeat_timer = 0; + m_last_modifier_state = special_debounce; + } + } + else + { + m_last_key_pressed = 0x80; + + if (m_status & AS_rrq_mask) + { /* keyboard buffer full */ + /* do nothing */ + } + else + { + //for (i=0; i<6; i++) + for (i=0; i<4; i++) + { + for (j=0; j<16; j++) + { + if (key_buf[i] & (1 << j)) + { + m_last_key_pressed = (i << 4) | j; + m_last_modifier_state = modifier_state; + + m_recv_buf = (int)key_translate[modifier_state][m_last_key_pressed]; + m_status |= AS_rrq_mask; + m_new_status_flag = 1; /* right??? */ + set_interrupt_line(); + return; + } + } + } + } + } +} + +UINT32 asr733_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + refresh(bitmap, 0, 0); + return 0; +} + +static MACHINE_CONFIG_FRAGMENT( asr733 ) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", asr733) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(asr733_device, asr733) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, asr733_device, screen_update) + + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_PALETTE("palette") +MACHINE_CONFIG_END + +INPUT_PORTS_START( asr733 ) + PORT_START("KEY0") /* keys 1-16 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_MINUS) \ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS) \ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) \ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) \ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) \ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) \ + \ + PORT_START("KEY1") /* keys 17-32 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_CLOSEBRACE) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) \ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) \ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) \ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) \ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) \ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) \ + \ + PORT_START("KEY2") /* keys 33-48 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RUB OUT") PORT_CODE(KEYCODE_BACKSPACE) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_RALT) \ + /* hack for my mac that does not disciminate the right ALT key */ \ + /* PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_LALT) */ \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) \ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) \ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) \ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) \ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) \ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) \ + \ + PORT_START("KEY3") /* keys 49-51 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(SPACE)") PORT_CODE(KEYCODE_SPACE) +INPUT_PORTS_END + +ioport_constructor asr733_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( asr733 ); +} + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor asr733_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( asr733 ); +} diff --git a/src/mame/video/733_asr.h b/src/mame/video/733_asr.h new file mode 100644 index 00000000000..6182a21eb52 --- /dev/null +++ b/src/mame/video/733_asr.h @@ -0,0 +1,88 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet + +#define asr733_chr_region ":gfx1" + +enum +{ + /* 8 bytes per character definition */ + asr733_single_char_len = 8, + asr733_chr_region_len = 128*asr733_single_char_len +}; + +class asr733_device : public device_t +{ +public: + asr733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_PALETTE_INIT(asr733); + + DECLARE_READ8_MEMBER(cru_r); + DECLARE_WRITE8_MEMBER(cru_w); + + template static devcb_base &static_set_keyint_callback(device_t &device, _Object object) + { + return downcast(device).m_keyint_line.set_callback(object); + } + template static devcb_base &static_set_lineint_callback(device_t &device, _Object object) + { + return downcast(device).m_lineint_line.set_callback(object); + } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + void device_config_complete(); + void device_start(); + void device_reset(); + machine_config_constructor device_mconfig_additions() const; + void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + ioport_constructor device_input_ports() const; + +private: + // internal state +#if 0 + UINT8 m_OutQueue[ASROutQueueSize]; + int m_OutQueueHead; + int m_OutQueueLen; +#endif + + void check_keyboard(); + void refresh(bitmap_ind16 &bitmap, int x, int y); + + void set_interrupt_line(); + void draw_char(int character, int x, int y, int color); + void linefeed(); + void transmit(UINT8 data); + + emu_timer *m_line_timer; // screen line timer + + UINT8 m_recv_buf; + UINT8 m_xmit_buf; + + UINT8 m_status; + UINT8 m_mode; + UINT8 m_last_key_pressed; + int m_last_modifier_state; + + unsigned char m_repeat_timer; + int m_new_status_flag; + + int m_x; + + bitmap_ind16* m_bitmap; + + required_device m_palette; + required_device m_gfxdecode; + devcb_write_line m_keyint_line; + devcb_write_line m_lineint_line; +}; + +extern const device_type ASR733; + +#define MCFG_ASR733_KEYINT_HANDLER( _intcallb ) \ + devcb = &asr733_device::static_set_keyint_callback( *device, DEVCB_##_intcallb ); + +#define MCFG_ASR733_LINEINT_HANDLER( _intcallb ) \ + devcb = &asr733_device::static_set_lineint_callback( *device, DEVCB_##_intcallb ); diff --git a/src/mame/video/911_chr.h b/src/mame/video/911_chr.h new file mode 100644 index 00000000000..6d24b5d0415 --- /dev/null +++ b/src/mame/video/911_chr.h @@ -0,0 +1,3516 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + 911_chr.h: character definitions for 911_vdt.c + + We define the character matrix for each character. + + The US terminal uses the standard 7-bit ASCII character set, with + additional graphic characters in the 32 first positions. + + The various European terminals use variants of the 7-bit ASCII character + set with national characters instead of various punctuation characters. + I think these national character sets were standardized at a point, but + I don't know how close to this standard the character sets used by the + 911 VDT are. + + The Japanese terminal uses 8-bit character codes. The 128 first characters + are identical to the US character set (except that '\' is replaced by the + Yen symbol), and the next 128 characters include the katakana syllabus. + Kanji ideograms are not supported in this scheme. + + The Arabic terminal uses 8-bit character codes, too. It requires + additional code in the TI990 OS for correct operation, as the keyboard + returns codes for isolated characters (i.e. without ligatures), which need + to be substituted with codes with correct context-dependent ligatures. + And both OS and application programs need to support the fact that the + writing direction can be either right-to-left or left-to-right, according + to whether the characters are Latin or Arabic. + + As the original ROMs have not been dumped yet, I recreated the matrices + from various matrix printouts in TI documentation. +*/ +/* + The Arabic character set is not implemented, because documentation is ambiguous + (it says there are 115 characters, but I can hardly see 80 characters in the + attached table), and the character matrices are not documented. +*/ + + +/* + Offsets in the char_defs array +*/ +enum +{ + /* US ASCII: 128 characters (32 symbols + 95 ASCII + 1 blank (delete character)) */ + char_defs_US_base = 0, + /* additionnal katakana set (128 characters, including JIS set) */ + char_defs_katakana_base = char_defs_US_base+128, + /* extra symbols for national character sets */ + char_defs_pound = char_defs_katakana_base+128, /* pound sign (UK 0x23, French WP 0x23) */ + char_defs_yen, /* yen sign (Japan 0x5C) */ + char_defs_auml, /* Latin small letter a with diaeresis (Swedish/Finish 0x7B, German 0x7B) */ + char_defs_Auml, /* Latin capital letter A with diaeresis (Swedish/Finish 0x5B, German 0x5B) */ + char_defs_Aring, /* Latin capital letter A with ring above (Swedish/Finish 0x5D, Norwegian/Danish 0x5D) */ + char_defs_uuml, /* Latin small letter u with diaeresis (Swedish/Finish 0x7E, German 0x7D) */ + char_defs_aring, /* Latin small letter a with ring above (Swedish/Finish 0x7D, Norwegian/Danish 0x7D) */ + char_defs_Uuml, /* Latin capital letter U with diaeresis (German 0x5D) */ + char_defs_ouml, /* Latin small letter o with diaeresis (German 0x7C) */ + char_defs_Ouml, /* Latin capital letter O with diaeresis (German 0x5C) */ + char_defs_szlig, /* Latin small letter sharp s (German 0x7E) */ + char_defs_aelig, /* Latin small letter ae (Norwegian/Danish 0x7B) */ + char_defs_AElig, /* Latin capital letter AE (Norwegian/Danish 0x5B) */ + char_defs_oslash, /* Latin small letter o with stroke (Norwegian/Danish 0x7C) */ + char_defs_Oslash, /* Latin capital letter O with stroke (Norwegian/Danish 0x5C) */ + char_defs_agrave, /* Latin small letter a with grave (French WP 0x40) */ + char_defs_deg, /* degree sign (French WP 0x5B) */ + char_defs_ccedil, /* Latin small letter c with cedilla (French WP 0x5C) */ + char_defs_sect, /* section sign (French WP 0x5D) */ + char_defs_egrave, /* Latin small letter e with grave (French WP 0x7B) */ + char_defs_ugrave, /* Latin small letter u with grave (French WP 0x7C) */ + char_defs_eacute, /* Latin small letter e with acute (French WP 0x7D) */ + char_defs_uml, /* diaeresis (French WP 0x7E) */ + + char_defs_count /* total character count */ +}; + +/* structure used to describe differences between national character sets and +US character set */ +/* much more compact than defining the complete 128-char vector */ +struct char_override_t +{ + unsigned char char_index; /* char to replace */ + unsigned short symbol_index; /* replacement symbol */ +}; + +/* One UK-specific character */ +static const char_override_t UK_overrides[1] = +{ + { 0x23, char_defs_pound } +}; + +/* One Japan-specific character (see below for the 128 additionnal characters) */ +static const char_override_t japanese_overrides[1] = +{ + { 0x5C, char_defs_yen } +}; + +/* 5 Sweden/Finland-specific characters */ +static const char_override_t swedish_overrides[/*5*/7] = +{ + { 0x7B, char_defs_auml }, + { 0x5B, char_defs_Auml }, + { 0x5D, char_defs_Aring }, + { 0x7E, char_defs_uuml }, + { 0x7D, char_defs_aring }, + /* next characters described in D-4 but not 1-10 */ + { 0x5C, char_defs_Ouml }, + { 0x7C, char_defs_ouml } +}; + +/* 7 German-specific characters */ +static const char_override_t german_overrides[7] = +{ + { 0x5D, char_defs_Uuml }, + { 0x7D, char_defs_uuml }, + { 0x7C, char_defs_ouml }, + { 0x5C, char_defs_Ouml }, + { 0x7B, char_defs_auml }, + { 0x7E, char_defs_szlig }, + { 0x5B, char_defs_Auml } /* 945423-9701 rev. B p. 1-10 says 0x5D, but it must be a mistake */ +}; + +/* 6 Norway/Denmark-specific characters */ +static const char_override_t norwegian_overrides[6] = +{ + { 0x5D, char_defs_Aring }, + { 0x7B, char_defs_aelig }, + { 0x5B, char_defs_AElig }, + { 0x7D, char_defs_aring }, + { 0x7C, char_defs_oslash}, + { 0x5C, char_defs_Oslash} +}; + +/* 9 French-specific characters (word-processing model only: the data-processing model uses +the US character set, although the keyboard mapping is different from the US model) */ +/* WARNING: I have created the character matrices from scratch, as I have no printout of +the original matrices. */ +static const char_override_t frenchWP_overrides[9] = +{ + { 0x23, char_defs_pound }, + { 0x40, char_defs_agrave}, + { 0x5B, char_defs_deg }, + { 0x5C, char_defs_ccedil}, + { 0x5D, char_defs_sect }, + { 0x7B, char_defs_eacute}, /* 945423-9701 rev. B says char_defs_egrave, but it must be a mistake */ + { 0x7C, char_defs_ugrave}, + { 0x7D, char_defs_egrave}, /* 945423-9701 rev. B says char_defs_eacute, but it must be a mistake */ + { 0x7E, char_defs_uml } +}; + +/* + char_defs array: character matrices for each character +*/ +static const UINT8 char_defs[char_defs_count][10] = +{ +/* US character set: 128 7*10 character matrix */ + { /* 0x00 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c + }, + { /* 0x01 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c + }, + { /* 0x02 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x03 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x04 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x05 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x06 */ + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x07 */ + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x08 */ + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x09 */ + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x0A */ + 0x00, + 0x00, + 0x00, + 0x1f, + 0x1f, + 0x1f, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x0B */ + 0x1c, + 0x1c, + 0x1c, + 0x7c, + 0x7c, + 0x7c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x0C */ + 0x00, + 0x00, + 0x00, + 0x7f, + 0x7f, + 0x7f, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x0D */ + 0x1c, + 0x1c, + 0x1c, + 0x1f, + 0x1f, + 0x1f, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x0E */ + 0x01, + 0x03, + 0x06, + 0x04, + 0x08, + 0x08, + 0x10, + 0x30, + 0x60, + 0x40 + }, + { /* 0x0F */ + 0x00, + 0x00, + 0x7f, + 0x00, + 0x00, + 0x00, + 0x7f, + 0x00, + 0x00, + 0x00 + }, + { /* 0x10 */ + 0x00, + 0x00, + 0x00, + 0x40, + 0x40, + 0x40, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x11 */ + 0x00, + 0x00, + 0x00, + 0x60, + 0x60, + 0x60, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x12 */ + 0x00, + 0x00, + 0x00, + 0x70, + 0x70, + 0x70, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x13 */ + 0x00, + 0x00, + 0x00, + 0x78, + 0x78, + 0x78, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x14*/ + 0x00, + 0x00, + 0x00, + 0x7c, + 0x7c, + 0x7c, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x15 */ + 0x00, + 0x00, + 0x00, + 0x7e, + 0x7e, + 0x7e, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x16 */ + 0x00, + 0x00, + 0x00, + 0x7f, + 0x7f, + 0x7f, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x17*/ + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x18 */ + 0x1c, + 0x1c, + 0x1c, + 0x7f, + 0x7f, + 0x7f, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x19 */ + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f + }, + { /* 0x1A */ + 0x00, + 0x00, + 0x00, + 0x7c, + 0x7c, + 0x7c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x1B */ + 0x1c, + 0x1c, + 0x1c, + 0x1f, + 0x1f, + 0x1f, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x1C */ + 0x1c, + 0x1c, + 0x1c, + 0x7f, + 0x7f, + 0x7f, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x1D */ + 0x1c, + 0x1c, + 0x1c, + 0x7c, + 0x7c, + 0x7c, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x1E */ + 0x40, + 0x60, + 0x30, + 0x10, + 0x08, + 0x08, + 0x04, + 0x06, + 0x03, + 0x01 + }, + { /* 0x1F */ + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22 + }, + { /* 0x20 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x21 */ + 0x00, + 0x18, + 0x18, + 0x18, + 0x18, + 0x18, + 0x00, + 0x18, + 0x00, + 0x00 + }, + { /* 0x22 */ + 0x00, + 0x14, + 0x14, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x23 */ + 0x00, + 0x00, + 0x14, + 0x36, + 0x00, + 0x36, + 0x14, + 0x00, + 0x00, + 0x00 + }, + { /* 0x24 */ + 0x00, + 0x1c, + 0x2a, + 0x28, + 0x1c, + 0x0a, + 0x2a, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x25 */ + 0x00, + 0x30, + 0x32, + 0x04, + 0x08, + 0x10, + 0x26, + 0x06, + 0x00, + 0x00 + }, + { /* 0x26 */ + 0x00, + 0x10, + 0x28, + 0x28, + 0x10, + 0x2a, + 0x24, + 0x1a, + 0x00, + 0x00 + }, + { /* 0x27 */ + 0x00, + 0x04, + 0x08, + 0x10, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x28 */ + 0x00, + 0x02, + 0x04, + 0x08, + 0x08, + 0x08, + 0x04, + 0x02, + 0x00, + 0x00 + }, + { /* 0x29 */ + 0x00, + 0x20, + 0x10, + 0x08, + 0x08, + 0x08, + 0x10, + 0x20, + 0x00, + 0x00 + }, + { /* 0x2A */ + 0x00, + 0x00, + 0x08, + 0x1c, + 0x3e, + 0x1c, + 0x08, + 0x00, + 0x00, + 0x00 + }, + { /* 0x2B */ + 0x00, + 0x00, + 0x08, + 0x08, + 0x3e, + 0x08, + 0x08, + 0x00, + 0x00, + 0x00 + }, + { /* 0x2C */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x18, + 0x18, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0x2D */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x3e, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x2E */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x18, + 0x18, + 0x00, + 0x00 + }, + { /* 0x2F */ + 0x00, + 0x00, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x00, + 0x00, + 0x00 + }, + { /* 0x30 */ + 0x00, + 0x0c, + 0x12, + 0x12, + 0x12, + 0x12, + 0x12, + 0x0c, + 0x00, + 0x00 + }, + { /* 0x31 */ + 0x00, + 0x08, + 0x18, + 0x08, + 0x08, + 0x08, + 0x08, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x32 */ + 0x00, + 0x1c, + 0x22, + 0x02, + 0x1c, + 0x20, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x33 */ + 0x00, + 0x1c, + 0x22, + 0x02, + 0x0c, + 0x02, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x34 */ + 0x00, + 0x04, + 0x0c, + 0x14, + 0x24, + 0x3e, + 0x04, + 0x04, + 0x00, + 0x00 + }, + { /* 0x35 */ + 0x00, + 0x3e, + 0x20, + 0x3c, + 0x02, + 0x02, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x36 */ + 0x00, + 0x0c, + 0x10, + 0x20, + 0x3c, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x37 */ + 0x00, + 0x3e, + 0x02, + 0x04, + 0x08, + 0x10, + 0x10, + 0x10, + 0x00, + 0x00 + }, + { /* 0x38 */ + 0x00, + 0x1c, + 0x22, + 0x22, + 0x1c, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x39 */ + 0x00, + 0x1c, + 0x22, + 0x22, + 0x1e, + 0x02, + 0x04, + 0x18, + 0x00, + 0x00 + }, + { /* 0x3A */ + 0x00, + 0x00, + 0x18, + 0x18, + 0x00, + 0x18, + 0x18, + 0x00, + 0x00, + 0x00 + }, + { /* 0x3B */ + 0x00, + 0x18, + 0x18, + 0x00, + 0x18, + 0x18, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0x3C */ + 0x00, + 0x02, + 0x04, + 0x08, + 0x10, + 0x08, + 0x04, + 0x02, + 0x00, + 0x00 + }, + { /* 0x3D */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x00, + 0x3e, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x3E */ + 0x00, + 0x20, + 0x10, + 0x08, + 0x04, + 0x08, + 0x10, + 0x20, + 0x00, + 0x00 + }, + { /* 0x3F */ + 0x00, + 0x1c, + 0x22, + 0x04, + 0x08, + 0x08, + 0x00, + 0x08, + 0x00, + 0x00 + }, + { /* 0x40 */ + 0x00, + 0x1c, + 0x22, + 0x2e, + 0x2a, + 0x2e, + 0x20, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x41 */ + 0x00, + 0x1c, + 0x22, + 0x22, + 0x3e, + 0x22, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* 0x42 */ + 0x00, + 0x3c, + 0x12, + 0x12, + 0x1c, + 0x12, + 0x12, + 0x3c, + 0x00, + 0x00 + }, + { /* 0x43 */ + 0x00, + 0x1c, + 0x22, + 0x20, + 0x20, + 0x20, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x44 */ + 0x00, + 0x3c, + 0x12, + 0x12, + 0x12, + 0x12, + 0x12, + 0x3c, + 0x00, + 0x00 + }, + { /* 0x45 */ + 0x00, + 0x3e, + 0x20, + 0x20, + 0x3c, + 0x20, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x46 */ + 0x00, + 0x3e, + 0x20, + 0x20, + 0x3c, + 0x20, + 0x20, + 0x20, + 0x00, + 0x00 + }, + { /* 0x47 */ + 0x00, + 0x1e, + 0x20, + 0x20, + 0x2e, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x48 */ + 0x00, + 0x22, + 0x22, + 0x22, + 0x3e, + 0x22, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* 0x49 */ + 0x00, + 0x1c, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x4A */ + 0x00, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x4B */ + 0x00, + 0x22, + 0x24, + 0x28, + 0x30, + 0x28, + 0x24, + 0x22, + 0x00, + 0x00 + }, + { /* 0x4C */ + 0x00, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x4D */ + 0x00, + 0x22, + 0x36, + 0x2a, + 0x22, + 0x22, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* 0x4E */ + 0x00, + 0x22, + 0x32, + 0x2a, + 0x26, + 0x22, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* 0x4F */ + 0x00, + 0x3e, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x50 */ + 0x00, + 0x3c, + 0x22, + 0x22, + 0x3c, + 0x20, + 0x20, + 0x20, + 0x00, + 0x00 + }, + { /* 0x51 */ + 0x00, + 0x3e, + 0x22, + 0x22, + 0x22, + 0x2a, + 0x24, + 0x3a, + 0x00, + 0x00 + }, + { /* 0x52 */ + 0x00, + 0x3c, + 0x22, + 0x22, + 0x3c, + 0x28, + 0x24, + 0x22, + 0x00, + 0x00 + }, + { /* 0x53 */ + 0x00, + 0x1c, + 0x20, + 0x10, + 0x08, + 0x04, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x54 */ + 0x00, + 0x3e, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x00, + 0x00 + }, + { /* 0x55 */ + 0x00, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x56 */ + 0x00, + 0x22, + 0x22, + 0x22, + 0x14, + 0x14, + 0x08, + 0x08, + 0x00, + 0x00 + }, + { /* 0x57 */ + 0x00, + 0x22, + 0x22, + 0x22, + 0x2a, + 0x2a, + 0x2a, + 0x14, + 0x00, + 0x00 + }, + { /* 0x58 */ + 0x00, + 0x22, + 0x22, + 0x14, + 0x08, + 0x14, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* 0x59 */ + 0x00, + 0x22, + 0x22, + 0x14, + 0x08, + 0x08, + 0x08, + 0x08, + 0x00, + 0x00 + }, + { /* 0x5A */ + 0x00, + 0x3e, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x5B */ + 0x00, + 0x0e, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x0e, + 0x00, + 0x00 + }, + { /* 0x5C */ + 0x00, + 0x00, + 0x20, + 0x10, + 0x08, + 0x04, + 0x02, + 0x00, + 0x00, + 0x00 + }, + { /* 0x5D */ + 0x00, + 0x38, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x38, + 0x00, + 0x00 + }, + { /* 0x5E */ + 0x00, + 0x08, + 0x14, + 0x22, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x5F */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x60 */ + 0x00, + 0x10, + 0x08, + 0x04, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x61 */ + 0x00, + 0x00, + 0x00, + 0x1c, + 0x22, + 0x3e, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* 0x62 */ + 0x00, + 0x00, + 0x00, + 0x3c, + 0x12, + 0x1c, + 0x12, + 0x3c, + 0x00, + 0x00 + }, + { /* 0x63 */ + 0x00, + 0x00, + 0x00, + 0x1e, + 0x20, + 0x20, + 0x20, + 0x1e, + 0x00, + 0x00 + }, + { /* 0x64 */ + 0x00, + 0x00, + 0x00, + 0x3c, + 0x12, + 0x12, + 0x12, + 0x3c, + 0x00, + 0x00 + }, + { /* 0x65 */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x20, + 0x3c, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x66 */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x20, + 0x3c, + 0x20, + 0x20, + 0x00, + 0x00 + }, + { /* 0x67 */ + 0x00, + 0x00, + 0x00, + 0x1e, + 0x20, + 0x2e, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x68 */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x22, + 0x3e, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* 0x69 */ + 0x00, + 0x00, + 0x00, + 0x1c, + 0x08, + 0x08, + 0x08, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x6A */ + 0x00, + 0x00, + 0x00, + 0x0e, + 0x04, + 0x04, + 0x24, + 0x3c, + 0x00, + 0x00 + }, + { /* 0x6B */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x24, + 0x38, + 0x24, + 0x22, + 0x00, + 0x00 + }, + { /* 0x6C */ + 0x00, + 0x00, + 0x00, + 0x20, + 0x20, + 0x20, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x6D */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x36, + 0x2a, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* 0x6E */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x32, + 0x2a, + 0x26, + 0x22, + 0x00, + 0x00 + }, + { /* 0x6F */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x22, + 0x22, + 0x22, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x70 */ + 0x00, + 0x00, + 0x00, + 0x3c, + 0x22, + 0x3c, + 0x20, + 0x20, + 0x00, + 0x00 + }, + { /* 0x71 */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x22, + 0x2a, + 0x24, + 0x3a, + 0x00, + 0x00 + }, + { /* 0x72 */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x22, + 0x3e, + 0x24, + 0x22, + 0x00, + 0x00 + }, + { /* 0x73 */ + 0x00, + 0x00, + 0x00, + 0x1e, + 0x20, + 0x1c, + 0x02, + 0x3c, + 0x00, + 0x00 + }, + { /* 0x74 */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x08, + 0x08, + 0x08, + 0x08, + 0x00, + 0x00 + }, + { /* 0x75 */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x22, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0x76 */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x22, + 0x24, + 0x28, + 0x10, + 0x00, + 0x00 + }, + { /* 0x77 */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x22, + 0x2a, + 0x36, + 0x22, + 0x00, + 0x00 + }, + { /* 0x78 */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x14, + 0x08, + 0x14, + 0x22, + 0x00, + 0x00 + }, + { /* 0x79 */ + 0x00, + 0x00, + 0x00, + 0x22, + 0x14, + 0x08, + 0x08, + 0x08, + 0x00, + 0x00 + }, + { /* 0x7A */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x04, + 0x08, + 0x10, + 0x3e, + 0x00, + 0x00 + }, + { /* 0x7B */ + 0x00, + 0x06, + 0x08, + 0x08, + 0x10, + 0x08, + 0x08, + 0x06, + 0x00, + 0x00 + }, + { /* 0x7C */ + 0x00, + 0x08, + 0x08, + 0x08, + 0x00, + 0x08, + 0x08, + 0x08, + 0x00, + 0x00 + }, + { /* 0x7D */ + 0x00, + 0x30, + 0x08, + 0x08, + 0x04, + 0x08, + 0x08, + 0x30, + 0x00, + 0x00 + }, + { /* 0x7E */ + 0x00, + 0x10, + 0x2a, + 0x04, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x7F */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + + +/* 128 additional characters for Japanese terminals */ + { /* 0x80 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c + }, + { /* 0x81 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c + }, + { /* 0x82 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x83 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x84 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x85 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x86 */ + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x87 */ + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x88 */ + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x89 */ + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x8A */ + 0x00, + 0x00, + 0x00, + 0x1f, + 0x1f, + 0x1f, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x8B */ + 0x1c, + 0x1c, + 0x1c, + 0x7c, + 0x7c, + 0x7c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x8C */ + 0x00, + 0x00, + 0x00, + 0x7f, + 0x7f, + 0x7f, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x8D */ + 0x1c, + 0x1c, + 0x1c, + 0x1f, + 0x1f, + 0x1f, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x8E */ + 0x01, + 0x03, + 0x06, + 0x04, + 0x08, + 0x08, + 0x10, + 0x30, + 0x30, + 0x20 + }, + { /* 0x8F */ + 0x00, + 0x00, + 0x7f, + 0x00, + 0x00, + 0x00, + 0x7f, + 0x00, + 0x00, + 0x00 + }, + { /* 0x90 */ + 0x00, + 0x00, + 0x00, + 0x40, + 0x40, + 0x40, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x91 */ + 0x00, + 0x00, + 0x00, + 0x60, + 0x60, + 0x60, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x92 */ + 0x00, + 0x00, + 0x00, + 0x70, + 0x70, + 0x70, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x93 */ + 0x00, + 0x00, + 0x00, + 0x78, + 0x78, + 0x78, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x94*/ + 0x00, + 0x00, + 0x00, + 0x7c, + 0x7c, + 0x7c, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x95 */ + 0x00, + 0x00, + 0x00, + 0x7e, + 0x7e, + 0x7e, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x96 */ + 0x00, + 0x00, + 0x00, + 0x7f, + 0x7f, + 0x7f, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x97*/ + 0x00, + 0x00, + 0x00, + 0x1c, + 0x1c, + 0x1c, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x98 */ + 0x1c, + 0x1c, + 0x1c, + 0x7f, + 0x7f, + 0x7f, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x99 */ + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f, + 0x7f + }, + { /* 0x9A */ + 0x00, + 0x00, + 0x00, + 0x7c, + 0x7c, + 0x7c, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x9B */ + 0x1c, + 0x1c, + 0x1c, + 0x1f, + 0x1f, + 0x1f, + 0x1c, + 0x1c, + 0x1c, + 0x1c + }, + { /* 0x9C */ + 0x1c, + 0x1c, + 0x1c, + 0x7f, + 0x7f, + 0x7f, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x9D */ + 0x1c, + 0x1c, + 0x1c, + 0x7c, + 0x7c, + 0x7c, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0x9E */ + 0x40, + 0x60, + 0x30, + 0x10, + 0x08, + 0x08, + 0x04, + 0x06, + 0x06, + 0x02 + }, + { /* 0x9F */ + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22, + 0x22 + }, + { /* 0xA0 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xA1 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x38, + 0x28, + 0x38, + 0x00, + 0x00 + }, + { /* 0xA2 */ + 0x00, + 0x0e, + 0x08, + 0x08, + 0x08, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xA3 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x08, + 0x08, + 0x08, + 0x38, + 0x00, + 0x00 + }, + { /* 0xA4 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x10, + 0x08, + 0x00, + 0x00 + }, + { /* 0xA5 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x10, + 0x10, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xA6 */ + 0x00, + 0x00, + 0x3e, + 0x02, + 0x1e, + 0x02, + 0x04, + 0x08, + 0x00, + 0x00 + }, + { /* 0xA7 */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x02, + 0x0c, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xA8 */ + 0x00, + 0x00, + 0x00, + 0x04, + 0x08, + 0x18, + 0x28, + 0x08, + 0x00, + 0x00 + }, + { /* 0xA9 */ + 0x00, + 0x00, + 0x00, + 0x08, + 0x3e, + 0x22, + 0x02, + 0x0c, + 0x00, + 0x00 + }, + { /* 0xAA */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x08, + 0x08, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xAB */ + 0x00, + 0x00, + 0x00, + 0x04, + 0x3e, + 0x0c, + 0x14, + 0x24, + 0x00, + 0x00 + }, + { /* 0xAC */ + 0x00, + 0x00, + 0x00, + 0x10, + 0x3e, + 0x12, + 0x14, + 0x10, + 0x00, + 0x00 + }, + { /* 0xAD */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x1c, + 0x04, + 0x04, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xAE */ + 0x00, + 0x00, + 0x00, + 0x3c, + 0x04, + 0x3c, + 0x04, + 0x3c, + 0x00, + 0x00 + }, + { /* 0xAF */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x2a, + 0x2a, + 0x02, + 0x0c, + 0x00, + 0x00 + }, + { /* 0xB0 */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x3e, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xB1 */ + 0x00, + 0x00, + 0x3e, + 0x02, + 0x0c, + 0x08, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xB2 */ + 0x00, + 0x04, + 0x08, + 0x18, + 0x28, + 0x08, + 0x08, + 0x08, + 0x00, + 0x00 + }, + { /* 0xB3 */ + 0x00, + 0x08, + 0x3e, + 0x22, + 0x02, + 0x04, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xB4 */ + 0x00, + 0x00, + 0x3e, + 0x08, + 0x08, + 0x08, + 0x08, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xB5 */ + 0x00, + 0x04, + 0x3e, + 0x04, + 0x0c, + 0x14, + 0x24, + 0x04, + 0x00, + 0x00 + }, + { /* 0xB6 */ + 0x00, + 0x08, + 0x08, + 0x3e, + 0x0a, + 0x0a, + 0x12, + 0x24, + 0x00, + 0x00 + }, + { /* 0xB7 */ + 0x00, + 0x08, + 0x3e, + 0x08, + 0x3e, + 0x08, + 0x08, + 0x08, + 0x00, + 0x00 + }, + { /* 0xB8 */ + 0x00, + 0x00, + 0x1e, + 0x12, + 0x22, + 0x04, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xB9 */ + 0x00, + 0x10, + 0x10, + 0x1e, + 0x24, + 0x04, + 0x04, + 0x08, + 0x00, + 0x00 + }, + { /* 0xBA */ + 0x00, + 0x00, + 0x3e, + 0x02, + 0x02, + 0x02, + 0x02, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xBB */ + 0x00, + 0x14, + 0x3e, + 0x14, + 0x14, + 0x04, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xBC */ + 0x00, + 0x00, + 0x30, + 0x00, + 0x32, + 0x02, + 0x04, + 0x38, + 0x00, + 0x00 + }, + { /* 0xBD */ + 0x00, + 0x00, + 0x3e, + 0x02, + 0x04, + 0x08, + 0x14, + 0x22, + 0x00, + 0x00 + }, + { /* 0xBE */ + 0x00, + 0x10, + 0x3e, + 0x12, + 0x14, + 0x10, + 0x10, + 0x1e, + 0x00, + 0x00 + }, + { /* 0xBF */ + 0x00, + 0x00, + 0x22, + 0x22, + 0x12, + 0x02, + 0x04, + 0x18, + 0x00, + 0x00 + }, + { /* 0xC0 */ + 0x00, + 0x00, + 0x1e, + 0x12, + 0x2a, + 0x04, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xC1 */ + 0x00, + 0x04, + 0x38, + 0x08, + 0x3e, + 0x08, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xC2 */ + 0x00, + 0x00, + 0x2a, + 0x2a, + 0x2a, + 0x02, + 0x04, + 0x08, + 0x00, + 0x00 + }, + { /* 0xC3 */ + 0x00, + 0x00, + 0x1c, + 0x00, + 0x3e, + 0x08, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xC4 */ + 0x00, + 0x10, + 0x10, + 0x10, + 0x18, + 0x14, + 0x10, + 0x10, + 0x00, + 0x00 + }, + { /* 0xC5 */ + 0x00, + 0x08, + 0x08, + 0x3e, + 0x08, + 0x08, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xC6 */ + 0x00, + 0x00, + 0x1c, + 0x00, + 0x00, + 0x00, + 0x00, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xC7 */ + 0x00, + 0x00, + 0x3e, + 0x02, + 0x14, + 0x08, + 0x14, + 0x20, + 0x00, + 0x00 + }, + { /* 0xC8 */ + 0x00, + 0x08, + 0x3e, + 0x04, + 0x08, + 0x1c, + 0x2a, + 0x08, + 0x00, + 0x00 + }, + { /* 0xC9 */ + 0x00, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xCA */ + 0x00, + 0x00, + 0x04, + 0x02, + 0x12, + 0x12, + 0x12, + 0x22, + 0x00, + 0x00 + }, + { /* 0xCB */ + 0x00, + 0x00, + 0x20, + 0x20, + 0x3e, + 0x20, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xCC */ + 0x00, + 0x00, + 0x3e, + 0x02, + 0x02, + 0x04, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xCD */ + 0x00, + 0x00, + 0x10, + 0x28, + 0x04, + 0x02, + 0x02, + 0x00, + 0x00, + 0x00 + }, + { /* 0xCE */ + 0x00, + 0x08, + 0x3e, + 0x08, + 0x2a, + 0x2a, + 0x2a, + 0x08, + 0x00, + 0x00 + }, + { /* 0xCF */ + 0x00, + 0x00, + 0x3e, + 0x02, + 0x02, + 0x14, + 0x08, + 0x04, + 0x00, + 0x00 + }, + { /* 0xD0 */ + 0x00, + 0x10, + 0x0e, + 0x00, + 0x0e, + 0x00, + 0x10, + 0x0e, + 0x00, + 0x00 + }, + { /* 0xD1 */ + 0x00, + 0x00, + 0x04, + 0x08, + 0x10, + 0x22, + 0x3e, + 0x02, + 0x00, + 0x00 + }, + { /* 0xD2 */ + 0x00, + 0x00, + 0x02, + 0x02, + 0x14, + 0x08, + 0x14, + 0x20, + 0x00, + 0x00 + }, + { /* 0xD3 */ + 0x00, + 0x00, + 0x3c, + 0x10, + 0x3e, + 0x10, + 0x10, + 0x1e, + 0x00, + 0x00 + }, + { /* 0xD4 */ + 0x00, + 0x10, + 0x10, + 0x3e, + 0x12, + 0x14, + 0x10, + 0x10, + 0x00, + 0x00 + }, + { /* 0xD5 */ + 0x00, + 0x00, + 0x1c, + 0x04, + 0x04, + 0x04, + 0x04, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xD6 */ + 0x00, + 0x00, + 0x3e, + 0x02, + 0x3e, + 0x02, + 0x02, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xD7 */ + 0x00, + 0x00, + 0x1c, + 0x00, + 0x3e, + 0x02, + 0x02, + 0x0c, + 0x00, + 0x00 + }, + { /* 0xD8 */ + 0x00, + 0x00, + 0x12, + 0x12, + 0x12, + 0x02, + 0x04, + 0x08, + 0x00, + 0x00 + }, + { /* 0xD9 */ + 0x00, + 0x00, + 0x28, + 0x28, + 0x28, + 0x2a, + 0x2a, + 0x2c, + 0x00, + 0x00 + }, + { /* 0xDA */ + 0x00, + 0x00, + 0x20, + 0x20, + 0x22, + 0x24, + 0x28, + 0x30, + 0x00, + 0x00 + }, + { /* 0xDB */ + 0x00, + 0x00, + 0x3e, + 0x22, + 0x22, + 0x22, + 0x22, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xDC */ + 0x00, + 0x00, + 0x3e, + 0x22, + 0x22, + 0x02, + 0x04, + 0x08, + 0x00, + 0x00 + }, + { /* 0xDD */ + 0x00, + 0x00, + 0x30, + 0x00, + 0x02, + 0x02, + 0x04, + 0x38, + 0x00, + 0x00 + }, + { /* 0xDE */ + 0x00, + 0x28, + 0x28, + 0x28, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xDF */ + 0x00, + 0x38, + 0x28, + 0x38, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xE0 */ + 0x00, + 0x1c, + 0x22, + 0x04, + 0x08, + 0x08, + 0x00, + 0x08, + 0x00, + 0x00 + }, + { /* 0xE1 */ + 0x00, + 0x18, + 0x18, + 0x18, + 0x18, + 0x00, + 0x18, + 0x18, + 0x00, + 0x00 + }, + { /* 0xE2 */ + 0x00, + 0x14, + 0x14, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xE3 */ + 0x00, + 0x00, + 0x14, + 0x36, + 0x00, + 0x36, + 0x14, + 0x00, + 0x00, + 0x00 + }, + { /* 0xE4 */ + 0x00, + 0x1c, + 0x2a, + 0x28, + 0x1c, + 0x0a, + 0x2a, + 0x1c, + 0x00, + 0x00 + }, + { /* 0xE5 */ + 0x00, + 0x30, + 0x32, + 0x04, + 0x08, + 0x10, + 0x26, + 0x06, + 0x00, + 0x00 + }, + { /* 0xE6 */ + 0x00, + 0x10, + 0x28, + 0x28, + 0x10, + 0x2a, + 0x24, + 0x1a, + 0x00, + 0x00 + }, + { /* 0xE7 */ + 0x00, + 0x04, + 0x08, + 0x10, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xE8 */ + 0x00, + 0x02, + 0x04, + 0x08, + 0x08, + 0x08, + 0x04, + 0x02, + 0x00, + 0x00 + }, + { /* 0xE9 */ + 0x00, + 0x20, + 0x10, + 0x08, + 0x08, + 0x08, + 0x10, + 0x20, + 0x00, + 0x00 + }, + { /* 0xEA */ + 0x00, + 0x00, + 0x08, + 0x1c, + 0x3e, + 0x1c, + 0x08, + 0x00, + 0x00, + 0x00 + }, + { /* 0xEB */ + 0x00, + 0x00, + 0x08, + 0x08, + 0x3e, + 0x08, + 0x08, + 0x00, + 0x00, + 0x00 + }, + { /* 0xEC */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x18, + 0x18, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xED */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x3e, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xEE */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x18, + 0x18, + 0x00, + 0x00 + }, + { /* 0xEF */ + 0x00, + 0x00, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x00, + 0x00, + 0x00 + }, + { /* 0xF0 */ + 0x00, + 0x0c, + 0x12, + 0x12, + 0x12, + 0x12, + 0x12, + 0x0c, + 0x00, + 0x00 + }, + { /* 0xF1 */ + 0x00, + 0x08, + 0x18, + 0x08, + 0x08, + 0x08, + 0x08, + 0x1c, + 0x00, + 0x00 + }, + { /* 0xF2 */ + 0x00, + 0x1c, + 0x22, + 0x02, + 0x1c, + 0x20, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* 0xF3 */ + 0x00, + 0x1c, + 0x22, + 0x02, + 0x0c, + 0x02, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0xF4 */ + 0x00, + 0x04, + 0x0c, + 0x14, + 0x24, + 0x3e, + 0x04, + 0x04, + 0x00, + 0x00 + }, + { /* 0xF5 */ + 0x00, + 0x3e, + 0x20, + 0x3c, + 0x02, + 0x02, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0xF6 */ + 0x00, + 0x0c, + 0x10, + 0x20, + 0x3c, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0xF7 */ + 0x00, + 0x3e, + 0x02, + 0x04, + 0x08, + 0x10, + 0x10, + 0x10, + 0x00, + 0x00 + }, + { /* 0xF8 */ + 0x00, + 0x1c, + 0x22, + 0x22, + 0x1c, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* 0xF9 */ + 0x00, + 0x1c, + 0x22, + 0x22, + 0x1e, + 0x02, + 0x04, + 0x18, + 0x00, + 0x00 + }, + { /* 0xFA */ + 0x00, + 0x00, + 0x18, + 0x18, + 0x00, + 0x18, + 0x18, + 0x00, + 0x00, + 0x00 + }, + { /* 0xFB */ + 0x00, + 0x18, + 0x18, + 0x00, + 0x18, + 0x18, + 0x08, + 0x10, + 0x00, + 0x00 + }, + { /* 0xFC */ + 0x00, + 0x02, + 0x04, + 0x08, + 0x10, + 0x08, + 0x04, + 0x02, + 0x00, + 0x00 + }, + { /* 0xFD */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x00, + 0x3e, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* 0xFE */ + 0x00, + 0x20, + 0x10, + 0x08, + 0x04, + 0x08, + 0x10, + 0x20, + 0x00, + 0x00 + }, + { /* 0xFF */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + + +/* extra symbols for various national terminals, which use slightly modified +variants of the US character set */ + { /* pound */ + 0x00, + 0x0c, + 0x12, + 0x10, + 0x38, + 0x10, + 0x3a, + 0x34, + 0x00, + 0x00 + }, + { /* yen */ + 0x00, + 0x22, + 0x14, + 0x08, + 0x3e, + 0x08, + 0x3e, + 0x08, + 0x00, + 0x00 + }, + { /* auml */ + 0x00, + 0x00, + 0x22, + 0x00, + 0x1c, + 0x22, + 0x3e, + 0x22, + 0x00, + 0x00 + }, + { /* Auml */ + 0x00, + 0x22, + 0x00, + 0x1c, + 0x22, + 0x3e, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* Aring */ + 0x00, + 0x08, + 0x00, + 0x1c, + 0x22, + 0x3e, + 0x22, + 0x22, + 0x00, + 0x00 + }, + { /* uuml */ + 0x00, + 0x00, + 0x22, + 0x00, + 0x22, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* aring */ + 0x00, + 0x00, + 0x08, + 0x00, + 0x1c, + 0x22, + 0x3e, + 0x22, + 0x00, + 0x00 + }, + + { /* Uuml */ + 0x00, + 0x22, + 0x00, + 0x22, + 0x22, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + + { /* ouml */ + 0x00, + 0x00, + 0x22, + 0x00, + 0x3e, + 0x22, + 0x22, + 0x3e, + 0x00, + 0x00 + }, + { /* Ouml */ + 0x00, + 0x22, + 0x00, + 0x3e, + 0x22, + 0x22, + 0x22, + 0x3e, + 0x00, + 0x00 + }, + { /* szlig */ + 0x00, + 0x18, + 0x24, + 0x24, + 0x2c, + 0x22, + 0x22, + 0x2c, + 0x00, + 0x00 + }, + { /* aelig */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x28, + 0x3e, + 0x28, + 0x2e, + 0x00, + 0x00 + }, + { /* AElig */ + 0x00, + 0x3e, + 0x28, + 0x28, + 0x3e, + 0x28, + 0x28, + 0x2e, + 0x00, + 0x00 + }, + { /* Oslash */ + 0x00, + 0x00, + 0x00, + 0x3e, + 0x26, + 0x2a, + 0x32, + 0x3e, + 0x00, + 0x00 + }, + { /* oslash */ + 0x00, + 0x3e, + 0x22, + 0x26, + 0x2a, + 0x32, + 0x22, + 0x3e, + 0x00, + 0x00 + }, +/* WARNING: I have created the next 8 French character matrices from scratch, +as I have no printout of the original matrices. */ + { /* agrave */ + 0x00, + 0x10, + 0x08, + 0x00, + 0x1c, + 0x22, + 0x3e, + 0x22, + 0x00, + 0x00 + }, + { /* deg */ + 0x00, + 0x38, + 0x28, + 0x38, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + }, + { /* ccedil */ + 0x00, + 0x00, + 0x00, + 0x1e, + 0x20, + 0x20, + 0x20, + 0x1e, + 0x08, + 0x04 + }, + { /* sect */ + 0x00, + 0x1c, + 0x20, + 0x1c, + 0x22, + 0x1c, + 0x02, + 0x1c, + 0x00, + 0x00 + }, + { /* egrave */ + 0x00, + 0x10, + 0x08, + 0x3e, + 0x20, + 0x3c, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* ugrave */ + 0x00, + 0x10, + 0x08, + 0x22, + 0x22, + 0x22, + 0x22, + 0x1c, + 0x00, + 0x00 + }, + { /* eacute */ + 0x00, + 0x04, + 0x08, + 0x3e, + 0x20, + 0x3c, + 0x20, + 0x3e, + 0x00, + 0x00 + }, + { /* uml */ + 0x00, + 0x22, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + } +}; diff --git a/src/mame/video/911_key.h b/src/mame/video/911_key.h new file mode 100644 index 00000000000..108bf85fd7d --- /dev/null +++ b/src/mame/video/911_key.h @@ -0,0 +1,4028 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + key translation table for both US and UK terminals + + The only difference is that the US # character is a Pound character in UK. +*/ +static const unsigned char US_key_translate[4][91] = +{ + { /* lower case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x5F, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x71, + 0x77, + 0x65, + 0x72, + 0x74, + 0x79, + 0x75, + 0x69, + 0x6F, + 0x70, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x61, + 0x73, + 0x64, + 0x66, + 0x67, + 0x68, + 0x6A, + 0x6B, + 0x6C, + 0x3B, + 0x27, + 0, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x7A, + 0x78, + 0x63, + 0x76, + 0x62, + 0x6E, + 0x6D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* upper case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x5F, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x3B, + 0x27, + 0, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* shifted */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x21, + 0x40, + 0x23, + 0x24, + 0x25, + 0x5E, + 0x26, + 0x2A, + 0x28, + 0x29, + 0x5B, + 0x5D, + 0x3D, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x8A, + 0x8C, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x3A, + 0x22, + 0, + 0x83, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x3C, + 0x3E, + 0x3F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* control */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x90, + 0x91, + 0x00, + 0xA1, + 0x8D, + 0x8E, + 0x8F, + 0x7C, + 0x60, + 0x7E, + 0x1D, + 0x7F, + 0x5C, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x11, + 0x17, + 0x05, + 0x12, + 0x14, + 0x19, + 0x15, + 0x09, + 0x0F, + 0x10, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x01, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0A, + 0x0B, + 0x0C, + 0x7B, + 0x7D, + 0, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x1A, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0E, + 0x0D, + 0x1C, + 0x1E, + 0x1F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + } +}; + + +/* + key translation table for French terminals +*/ +static const unsigned char French_key_translate[4][91] = +{ + { /* lower case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x5F, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x61, + 0x7A, + 0x65, + 0x72, + 0x74, + 0x79, + 0x75, + 0x69, + 0x6F, + 0x70, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x71, + 0x73, + 0x64, + 0x66, + 0x67, + 0x68, + 0x6A, + 0x6B, + 0x6C, + 0x6D, + 0x27, + 0, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x77, + 0x78, + 0x63, + 0x76, + 0x62, + 0x6E, + 0x3B, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0 + }, + { /* upper case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x5F, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x41, + 0x5A, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x51, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x27, + 0, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x57, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x3B, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0 + }, + { /* shifted */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x21, + 0x40, + 0x23, + 0x24, + 0x25, + 0x5E, + 0x26, + 0x2A, + 0x28, + 0x29, + 0x5B, + 0x5D, + 0x3D, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x41, + 0x5A, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x8A, + 0x8C, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x51, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x22, + 0, + 0x83, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x57, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x3A, + 0x3C, + 0x3E, + 0x3F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0 + }, + { /* control */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x90, + 0x91, + 0x00, + 0xA1, + 0x8D, + 0x8E, + 0x8F, + 0x7C, + 0x60, + 0x7E, + 0x1D, + 0x7F, + 0x5C, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x01, + 0x1A, + 0x05, + 0x12, + 0x14, + 0x19, + 0x15, + 0x09, + 0x0F, + 0x10, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x11, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0A, + 0x0B, + 0x0C, + 0x0D, + 0x7D, + 0, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x17, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0E, + 0x7B, + 0x1C, + 0x1E, + 0x1F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0 + } +}; + + +/* + key translation table for German terminals +*/ +static const unsigned char German_key_translate[4][91] = +{ + { /* lower case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x7E, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x71, + 0x77, + 0x65, + 0x72, + 0x74, + 0x7A, + 0x75, + 0x69, + 0x6F, + 0x70, + 0x7D, + 0x88, + 0x87, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x61, + 0x73, + 0x64, + 0x66, + 0x67, + 0x68, + 0x6A, + 0x6B, + 0x6C, + 0x7C, + 0x7B, + 0x3B, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x79, + 0x78, + 0x63, + 0x76, + 0x62, + 0x6E, + 0x6D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* upper case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x27, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x5A, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x5D, + 0x88, + 0x87, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x5C, + 0x5B, + 0x3B, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x59, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* shifted */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x21, + 0x40, + 0x23, + 0x24, + 0x25, + 0x5E, + 0x26, + 0x2A, + 0x28, + 0x29, + 0x5F, + 0x3D, + 0x22, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x5A, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x5D, + 0x8A, + 0x8C, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x5C, + 0x5B, + 0x3A, + 0x83, /* 945423-9701 rev. B says 0x85, but it must be a mistake */ + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x59, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x3C, + 0x3E, + 0x3F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* control */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x90, + 0x91, + 0x00, + 0xA1, + 0x8D, + 0x8E, + 0x8F, + 0x7C, + 0x60, + 0x00, + 0x1D, + 0x7F, + 0x00, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x11, + 0x17, + 0x05, + 0x12, + 0x14, + 0x1A, + 0x15, + 0x09, + 0x0F, + 0x10, + 0x00, + 0x88, + 0x87, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x01, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0A, + 0x0B, + 0x0C, + 0x00, + 0x00, + 0x00, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x19, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0E, + 0x0D, + 0x1C, + 0x1E, + 0x1F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + } +}; + + +/* + key translation table for Swedish/Finnish terminals +*/ +static const unsigned char Swedish_key_translate[4][91] = +{ + { /* lower case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x7E, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x71, + 0x77, + 0x65, + 0x72, + 0x74, + 0x79, + 0x75, + 0x69, + 0x6F, + 0x70, + 0x7D, + 0x88, + 0x87, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x61, + 0x73, + 0x64, + 0x66, + 0x67, + 0x68, + 0x6A, + 0x6B, + 0x6C, + 0x7C, + 0x7B, + 0x3B, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x7A, + 0x78, + 0x63, + 0x76, + 0x62, + 0x6E, + 0x6D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* upper case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x27, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x5D, + 0x88, + 0x87, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x5C, + 0x5B, + 0x3B, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* shifted */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x21, + 0x40, + 0x23, + 0x24, + 0x25, + 0x5E, + 0x26, + 0x2A, + 0x28, + 0x29, + 0x5F, + 0x3D, + 0x22, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x5D, + 0x8A, + 0x8C, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x5C, + 0x5B, + 0x3A, + 0x83, /* 945423-9701 rev. B says 0x85, but it must be a mistake */ + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x3C, + 0x3E, + 0x3F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* control */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x90, + 0x91, + 0x00, + 0xA1, + 0x8D, + 0x8E, + 0x8F, + 0x00, + 0x60, + 0x00, + 0x1D, + 0x7F, + 0x00, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x11, + 0x17, + 0x05, + 0x12, + 0x14, + 0x19, + 0x15, + 0x09, + 0x0F, + 0x10, + 0x00, + 0x88, + 0x87, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x01, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0A, + 0x0B, + 0x0C, + 0x00, + 0x00, + 0x00, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x1A, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0E, + 0x0D, + 0x1C, + 0x1E, + 0x1F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + } +}; + + +/* + key translation table for Norwegian/Danish terminals +*/ +static const unsigned char Norwegian_key_translate[4][91] = +{ + { /* lower case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x27, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x71, + 0x77, + 0x65, + 0x72, + 0x74, + 0x79, + 0x75, + 0x69, + 0x6F, + 0x70, + 0x7D, + 0x88, + 0x87, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x61, + 0x73, + 0x64, + 0x66, + 0x67, + 0x68, + 0x6A, + 0x6B, + 0x6C, + 0x7B, + 0x7C, + 0x3B, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x7A, + 0x78, + 0x63, + 0x76, + 0x62, + 0x6E, + 0x6D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* upper case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x27, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x5D, + 0x88, + 0x87, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x5B, + 0x5C, + 0x3B, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* shifted */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x21, + 0x40, + 0x23, + 0x24, + 0x25, + 0x5E, + 0x26, + 0x2A, + 0x28, + 0x29, + 0x5F, + 0x3D, + 0x22, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x5D, + 0x8A, /* 945423-9701 rev. B says 0x88, but it must be a mistake */ + 0x8C, /* 945423-9701 rev. B says 0x87, but it must be a mistake */ + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x5B, + 0x5C, + 0x3A, + 0x83, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x3C, + 0x3E, + 0x3F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + }, + { /* control */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x90, + 0x91, + 0x00, + 0xA1, + 0x8D, + 0x8E, + 0x8F, + 0x00, + 0x60, + 0x00, + 0x1D, + 0x7F, + 0x00, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x11, + 0x17, + 0x05, + 0x12, + 0x14, + 0x19, + 0x15, + 0x09, + 0x0F, + 0x10, + 0x00, + 0x88, /* 945423-9701 rev. B says 0x8A, but it must be a mistake */ + 0x87, /* 945423-9701 rev. B says 0x8C, but it must be a mistake */ + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x01, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0A, + 0x0B, + 0x0C, + 0x00, + 0x00, + 0x00, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x1A, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0E, + 0x0D, + 0x1C, + 0x1E, + 0x1F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0x0D + } +}; + + +/* + key translation table for Japanese katakana terminals +*/ +static const unsigned char Japanese_key_translate[6][91] = +{ + { /* lower case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x5F, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x71, + 0x77, + 0x65, + 0x72, + 0x74, + 0x79, + 0x75, + 0x69, + 0x6F, + 0x70, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x61, + 0x73, + 0x64, + 0x66, + 0x67, + 0x68, + 0x6A, + 0x6B, + 0x6C, + 0x3B, + 0x27, + 0x5C, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x7A, + 0x78, + 0x63, + 0x76, + 0x62, + 0x6E, + 0x6D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* upper case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x5F, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x3B, + 0x27, + 0x5C, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* shifted */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x21, + 0x40, + 0x23, + 0x24, + 0x25, + 0x5E, + 0x26, + 0x2A, + 0x28, + 0x29, + 0x5B, + 0x5D, + 0x3D, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x8A, + 0x8C, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x3A, + 0x22, + 0x00, + 0x83, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x3C, + 0x3E, + 0x3F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* control */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x90, + 0x91, + 0x00, + 0xA1, + 0x8D, + 0x8E, + 0x8F, + 0x7C, + 0x60, + 0x7E, + 0x1D, + 0x7F, + 0x5C, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays the back quote character, whereas it actually display the Yen symbol) */ + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x11, + 0x17, + 0x05, + 0x12, + 0x14, + 0x19, + 0x15, + 0x09, + 0x0F, + 0x10, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x01, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0A, + 0x0B, + 0x0C, + 0x7B, + 0x7D, + 0x00, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x1A, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0E, + 0x0D, + 0x1C, + 0x1E, + 0x1F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* katakana */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0xC7, + 0xCC, + 0xB1, + 0xB3, + 0xB4, + 0xB5, + 0xD4, + 0xD5, + 0xD6, + 0xDC, + 0xCE, + 0xCD, + 0xDB, + 0x1B, /* 945423-9701 rev. B says 0x00, but it must be a mistake */ + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0xC0, + 0xC3, + 0xB2, + 0xBD, + 0xB6, + 0xDD, + 0xC5, + 0xC6, + 0xD7, + 0xBE, + 0x88, /* 945423-9701 rev. B says 0x00, but it must be a mistake */ + 0x87, /* 945423-9701 rev. B says 0x00, but it must be a mistake */ + 0x0D, /* 945423-9701 rev. B says 0x00, but it must be a mistake */ + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0xC1, + 0xC4, + 0xBC, + 0xCA, + 0xB7, + 0xB8, + 0xCF, + 0xC9, + 0xD8, /* 945423-9701 rev. B says 0xC8, but it must be a mistake */ + 0xDA, + 0xB9, + 0xD1, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0xC2, + 0xBB, + 0xBF, + 0xCB, + 0xBA, + 0xD0, + 0xD3, + 0xC8, + 0xD9, + 0xD2, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* shifted katakana */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x00, + 0x00, + 0xA7, + 0xA9, + 0xAA, + 0xAB, + 0xAC, + 0xAD, + 0xAE, + 0xA6, + 0xDE, + 0xDF, + 0xB0, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x00, + 0x00, + 0xAB, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x8A, + 0x8C, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xA2, + 0xA3, + 0x83, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0xAF, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xA4, + 0xA1, + 0xA5, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + } +}; + + +#if 0 +/* + key translation table for Arabic terminals +*/ +static const unsigned char Arabic_key_translate[6][91] = +{ + { /* lower case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x5F, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x71, + 0x77, + 0x65, + 0x72, + 0x74, + 0x79, + 0x75, + 0x69, + 0x6F, + 0x70, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x61, + 0x73, + 0x64, + 0x66, + 0x67, + 0x68, + 0x6A, + 0x6B, + 0x6C, + 0x3B, + 0x27, + 0x5C, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x7A, + 0x78, + 0x63, + 0x76, + 0x62, + 0x6E, + 0x6D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* upper case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x2B, + 0x2D, + 0x5F, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x3B, + 0x27, + 0x5C, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x2C, + 0x2E, + 0x2F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* shifted */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x21, + 0x40, + 0x23, + 0x24, + 0x25, + 0x5E, + 0x26, + 0x2A, + 0x28, + 0x29, + 0x5B, + 0x5D, + 0x3D, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x51, + 0x57, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x8A, + 0x8C, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x41, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x3A, + 0x22, + 0x00, + 0x83, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x5A, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x4D, + 0x3C, + 0x3E, + 0x3F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* control */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x90, + 0x91, + 0x00, + 0xA1, + 0x8D, + 0x8E, + 0x8F, + 0x7C, + 0x60, + 0x7E, + 0x1D, + 0x7F, + 0x5C, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x11, + 0x17, + 0x05, + 0x12, + 0x14, + 0x19, + 0x15, + 0x09, + 0x0F, + 0x10, + 0x88, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x01, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0A, + 0x0B, + 0x0C, + 0x7B, + 0x7D, + 0x00, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x1A, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0E, + 0x0D, + 0x1C, + 0x1E, + 0x1F, + 0, + + 0x30, + 0x2E, + + 0, + 0x20, + 0 + }, + { /* arabic */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0xC7, + 0xCC, + 0xB1, + 0xB3, + 0xB4, + 0xB5, + 0xD4, + 0xD5, + 0xD6, + 0xDC, + 0xCE, + 0xCD, + 0xDB, + 0x1B, + + 0x37, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x38, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x39, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0xC0, + 0xC3, + 0xB2, + 0xBD, + 0xB6, + 0xDD, + 0xC5, + 0xC6, + 0xD7, + 0xBE, + 0x88, + 0x87, + 0x0D, + + 0x34, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x35, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x36, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + + + 0x88, + 0x82, + 0x8A, + + 0, + 0xC1, + 0xC4, + 0xBC, + 0xCA, + 0xB7, + 0xB8, + 0xCF, + 0xC9, + 0xD8, + 0xDA, + 0xB9, + 0xD1, + 0x85, + + 0x31, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x32, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x33, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + + + 0x86, + 0x8B, + 0x84, + + 0, + 0xC2, + 0xBB, + 0xBF, + 0xCB, + 0xBA, + 0xD0, + 0xD3, + 0xC8, + 0xD9, + 0xD2, + 0, + + 0x30, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x2E, + + 0, + 0x20, + 0 + }, + { /* shifted arabic */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x00, + 0x00, + 0xA7, + 0xA9, + 0xAA, + 0xAB, + 0xAC, + 0xAD, + 0xAE, + 0xA6, + 0xDE, + 0xDF, + 0xB0, + 0x1B, + + 0x37, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x38, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x39, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x00, + 0x00, + 0xAB, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x8A, + 0x8C, + 0x0D, + + 0x34, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x35, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x36, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xA2, + 0xA3, + 0x83, + + 0x31, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x32, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x33, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + + + 0x86, + 0x8B, + 0x84, + + 0, + 0xAF, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xA4, + 0xA1, + 0xA5, + 0, + + 0x30, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ + 0x2E, + + 0, + 0x20, + 0 + } +}; +#endif + + +/* + key translation table for French word-processing terminals +*/ +static const unsigned char FrenchWP_key_translate[4][91] = +{ + { /* lower case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x26, + 0x7B, + 0x22, + 0x27, + 0x28, + 0x5D, + 0x7D, + 0x21, + 0x5C, + 0x40, + 0x29, + 0x2D, + 0x24, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x61, + 0x7A, + 0x65, + 0x72, + 0x74, + 0x79, + 0x75, + 0x69, + 0x6F, + 0x70, + 0x5E, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x71, + 0x73, + 0x64, + 0x66, + 0x67, + 0x68, + 0x6A, + 0x6B, + 0x6C, + 0x6D, + 0x7C, + 0x2A, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x77, + 0x78, + 0x63, + 0x76, + 0x62, + 0x6E, + 0x2C, + 0x3B, + 0x3A, + 0x3D, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0 + }, + { /* upper case */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x5B, + 0x5F, + 0x23, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x41, + 0x5A, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x7E, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x51, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x25, + 0x60, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x57, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x3F, + 0x2E, + 0x2F, + 0x2B, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0 + }, + { /* shifted */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x30, + 0x5B, + 0x5F, + 0x23, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x41, + 0x5A, + 0x45, + 0x52, + 0x54, + 0x59, + 0x55, + 0x49, + 0x4F, + 0x50, + 0x7E, + 0x8C, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x51, + 0x53, + 0x44, + 0x46, + 0x47, + 0x48, + 0x4A, + 0x4B, + 0x4C, + 0x4D, + 0x25, + 0x60, + 0x83, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x57, + 0x58, + 0x43, + 0x56, + 0x42, + 0x4E, + 0x3F, + 0x2E, + 0x2F, + 0x2B, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0 + }, + { /* control */ + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9B, + 0x9C, + + + 0x80, + 0x81, + 0x9F, + + 0, + 0x90, + 0x91, + 0x00, + 0xA1, + 0x8D, + 0x8E, + 0x8F, + 0x3C, + 0x3E, + 0x00, + 0x1D, + 0x7F, + 0x00, + 0x1B, + + 0x37, + 0x38, + 0x39, + + + 0x9A, + 0x89, + 0, + + 0xA0, + 0x01, + 0x1A, + 0x05, + 0x12, + 0x14, + 0x19, + 0x15, + 0x09, + 0x0F, + 0x10, + 0x00, + 0x87, + 0x0D, + + 0x34, + 0x35, + 0x36, + + + 0x88, + 0x82, + 0x8A, + + 0, + 0x11, + 0x13, + 0x04, + 0x06, + 0x07, + 0x08, + 0x0A, + 0x0B, + 0x0C, + 0x0D, + 0x00, + 0x00, + 0x85, + + 0x31, + 0x32, + 0x33, + + + 0x86, + 0x8B, + 0x84, + + 0, + 0x17, + 0x18, + 0x03, + 0x16, + 0x02, + 0x0E, + 0x00, + 0x1C, + 0x1E, + 0x1F, + 0, + + 0x30, + 0x2C, + + 0, + 0x20, + 0 + } +}; diff --git a/src/mame/video/911_vdt.c b/src/mame/video/911_vdt.c new file mode 100644 index 00000000000..c0d30600681 --- /dev/null +++ b/src/mame/video/911_vdt.c @@ -0,0 +1,844 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + TI 911 VDT core. To be operated with the TI 990 line of computers (can be connected to + any model, as communication uses the CRU bus). + + Raphael Nabet 2002 + +TODO: + * add more flexibility, so that we can create multiple-terminal configurations. + * support test mode??? +*/ + + +#include "emu.h" +#include "911_vdt.h" +#include "911_chr.h" +#include "911_key.h" + +#define MAX_VDT 1 + +static const gfx_layout fontlayout_7bit = +{ + 7, 10, /* 7*10 characters */ + 128, /* 128 characters */ + 1, /* 1 bit per pixel */ + { 0 }, + { 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 10*8 /* every char takes 10 consecutive bytes */ +}; + +static const gfx_layout fontlayout_8bit = +{ + 7, 10, /* 7*10 characters */ + 128, /* 128 characters */ + 1, /* 1 bit per pixel */ + { 0 }, + { 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 10*8 /* every char takes 10 consecutive bytes */ +}; + +static GFXDECODE_START( vdt911 ) + // Caution: Array must use same order as vdt911_model_t + // US + GFXDECODE_ENTRY( vdt911_chr_region, vdt911_US_chr_offset, fontlayout_7bit, 0, 4 ) + + // UK + GFXDECODE_ENTRY( vdt911_chr_region, vdt911_UK_chr_offset, fontlayout_7bit, 0, 4 ) + + // French (without accented characters) + GFXDECODE_ENTRY( vdt911_chr_region, vdt911_US_chr_offset, fontlayout_7bit, 0, 4 ) + + // German + GFXDECODE_ENTRY( vdt911_chr_region, vdt911_german_chr_offset, fontlayout_7bit, 0, 4 ) + + // Swedish + GFXDECODE_ENTRY( vdt911_chr_region, vdt911_swedish_chr_offset, fontlayout_7bit, 0, 4 ) + + // Norwegian + GFXDECODE_ENTRY( vdt911_chr_region, vdt911_norwegian_chr_offset, fontlayout_7bit, 0, 4 ) + + // Japanese + GFXDECODE_ENTRY( vdt911_chr_region, vdt911_japanese_chr_offset, fontlayout_8bit, 0, 4 ) + + // Arabic + // GFXDECODE_ENTRY( vdt911_chr_region, vdt911_arabic_chr_offset, fontlayout_8bit, 0, 4 ) + + // FrenchWP (contains accented characters) + GFXDECODE_ENTRY( vdt911_chr_region, vdt911_frenchWP_chr_offset, fontlayout_7bit, 0, 4 ) +GFXDECODE_END + +static const unsigned char vdt911_colors[] = +{ + 0x00,0x00,0x00, /* black */ + 0xC0,0xC0,0xC0, /* low intensity */ + 0xFF,0xFF,0xFF /* high intensity */ +}; + +static const unsigned short vdt911_palette[] = +{ + 0, 2, /* high intensity */ + 0, 1, /* low intensity */ + 2, 0, /* high intensity, reverse */ + 2, 1 /* low intensity, reverse */ +}; + +/* + Macros for model features +*/ +/* TRUE for Japanese and Arabic terminals, which use 8-bit charcodes and keyboard shift modes */ +#define USES_8BIT_CHARCODES() ((m_model == vdt911_model_Japanese) /*|| (m_model == vdt911_model_Arabic)*/) +/* TRUE for keyboards which have this extra key (on the left of TAB/SKIP) + (Most localized keyboards have it) */ +#define HAS_EXTRA_KEY_67() (! ((m_model == vdt911_model_US) || (m_model == vdt911_model_UK) || (m_model == vdt911_model_French))) +/* TRUE for keyboards which have this extra key (on the right of space), + AND do not use it as a modifier */ +#define HAS_EXTRA_KEY_91() ((m_model == vdt911_model_German) || (m_model == vdt911_model_Swedish) || (m_model == vdt911_model_Norwegian)) + +/* + Initialize vdt911 palette +*/ +PALETTE_INIT_MEMBER(vdt911_device, vdt911) +{ + UINT8 i, r, g, b; + + for ( i = 0; i < 3; i++ ) + { + r = vdt911_colors[i*3]; g = vdt911_colors[i*3+1]; b = vdt911_colors[i*3+2]; + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + for(i=0;i<8;i++) + palette.set_pen_indirect(i, vdt911_palette[i]); +} + +/* + Copy a character bitmap array to another location in memory +*/ +static void copy_character_matrix_array(const UINT8 char_array[128][10], UINT8 *dest) +{ + int i, j; + + for (i=0; i<128; i++) + for (j=0; j<10; j++) + *(dest++) = char_array[i][j]; +} + +/* + Patch a character bitmap array according to an array of char_override_t +*/ +static void apply_char_overrides(int nb_char_overrides, const char_override_t char_overrides[], UINT8 *dest) +{ + int i, j; + + for (i=0; i; + +vdt911_device::vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VDT911, "911 VDT", tag, owner, clock, "vdt911", __FILE__), + m_beeper(*this, "beeper"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_keyint_line(*this), + m_lineint_line(*this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vdt911_device::device_config_complete() +{ +} + +enum +{ + BLINK_TIMER, + BEEP_TIMER, + LINE_TIMER +}; + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vdt911_device::device_start() +{ + m_last_key_pressed = 0x80; + + m_keyboard_data_ready = false; + m_display_enable = false; + m_blink_state = false; + + m_keyint_line.resolve(); + m_lineint_line.resolve(); + + /* set up cursor blink clock. 2Hz frequency -> .25s half-period. */ + /*m_blink_clock =*/ + + // m_beeper->set_frequency(2000); + + m_blink_timer = timer_alloc(BLINK_TIMER); + m_beep_timer = timer_alloc(BEEP_TIMER); + m_line_timer = timer_alloc(LINE_TIMER); + + m_blink_timer->adjust(attotime::from_msec(0), 0, attotime::from_msec(250)); + + UINT8 *base; + UINT8 *chr = machine().root_device().memregion(vdt911_chr_region)->base(); + + /* set up US character definitions */ + base = chr+vdt911_US_chr_offset; + copy_character_matrix_array(char_defs+char_defs_US_base, base); + + /* set up UK character definitions */ + base = chr+vdt911_UK_chr_offset; + copy_character_matrix_array(char_defs+char_defs_US_base, base); + apply_char_overrides(sizeof(UK_overrides)/sizeof(char_override_t), UK_overrides, base); + + /* French character set is identical to US character set */ + + /* set up German character definitions */ + base = chr+vdt911_german_chr_offset; + copy_character_matrix_array(char_defs+char_defs_US_base, base); + apply_char_overrides(sizeof(german_overrides)/sizeof(char_override_t), german_overrides, base); + + /* set up Swedish/Finnish character definitions */ + base = chr+vdt911_swedish_chr_offset; + copy_character_matrix_array(char_defs+char_defs_US_base, base); + apply_char_overrides(sizeof(swedish_overrides)/sizeof(char_override_t), swedish_overrides, base); + + /* set up Norwegian/Danish character definitions */ + base = chr+vdt911_norwegian_chr_offset; + copy_character_matrix_array(char_defs+char_defs_US_base, base); + apply_char_overrides(sizeof(norwegian_overrides)/sizeof(char_override_t), norwegian_overrides, base); + + /* set up French word processing character definitions */ + base = chr+vdt911_frenchWP_chr_offset; + copy_character_matrix_array(char_defs+char_defs_US_base, base); + apply_char_overrides(sizeof(frenchWP_overrides)/sizeof(char_override_t), frenchWP_overrides, base); + + /* set up Katakana Japanese character definitions */ + base = chr+vdt911_japanese_chr_offset; + copy_character_matrix_array(char_defs+char_defs_US_base, base); + apply_char_overrides(sizeof(japanese_overrides)/sizeof(char_override_t), japanese_overrides, base); + base = chr+vdt911_japanese_chr_offset+128*vdt911_single_char_len; + copy_character_matrix_array(char_defs+char_defs_katakana_base, base); + +#if 0 + /* set up Arabic character definitions */ + base = chr+vdt911_arabic_chr_offset; + copy_character_matrix_array(char_defs+char_defs_US_base, base); + apply_char_overrides(sizeof(arabic_overrides)/sizeof(char_override_t), arabic_overrides, base); + base = chr+vdt911_arabic_chr_offset+128*vdt911_single_char_len; + copy_character_matrix_array(char_defs+char_defs_arabic_base, base); +#endif +} + + +void vdt911_device::device_reset() +{ + m_model = (vdt911_model_t)ioport("LOCALE")->read(); + m_screen_size = (vdt911_screen_size_t)ioport("SCREEN")->read(); + + if (m_screen_size == char_960) + m_cursor_address_mask = 0x3ff; /* 1kb of RAM */ + else + m_cursor_address_mask = 0x7ff; /* 2 kb of RAM */ + + m_line_timer->adjust(attotime::from_msec(0), 0, attotime::from_hz(get_refresh_rate())); +} + +/* + Timer callbacks +*/ +void vdt911_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case BLINK_TIMER: + m_blink_state = !m_blink_state; + break; + case BEEP_TIMER: + m_beeper->set_state(0); + break; + case LINE_TIMER: + check_keyboard(); + m_lineint_line(ASSERT_LINE); + m_lineint_line(CLEAR_LINE); + break; + } +} + +/* + CRU interface read +*/ +READ8_MEMBER( vdt911_device::cru_r ) +{ + int reply=0; + + offset &= 0x1; + + if (!m_word_select) + { /* select word 0 */ + switch (offset) + { + case 0: + reply = m_display_RAM[m_cursor_address]; + break; + + case 1: + reply = m_keyboard_data & 0x7f; + if (m_keyboard_data_ready) + reply |= 0x80; + break; + } + } + else + { /* select word 1 */ + switch (offset) + { + case 0: + reply = m_cursor_address & 0xff; + break; + + case 1: + reply = (m_cursor_address >> 8) & 0x07; + if (m_keyboard_data & 0x80) + reply |= 0x08; + /*if (!m_terminal_ready) + reply |= 0x10;*/ + if (m_previous_word_select) + reply |= 0x20; + /*if (m_keyboard_parity_error) + reply |= 0x40;*/ + if (m_keyboard_data_ready) + reply |= 0x80; + break; + } + } + + return reply; +} + +/* + CRU interface write +*/ +WRITE8_MEMBER( vdt911_device::cru_w ) +{ + offset &= 0xf; + + if (!m_word_select) + { /* select word 0 */ + switch (offset) + { + case 0x0: + case 0x1: + case 0x2: + case 0x3: + case 0x4: + case 0x5: + case 0x6: + case 0x7: + /* display memory write data */ + if (data) + m_data_reg |= (1 << offset); + else + m_data_reg &= ~ (1 << offset); + break; + + case 0x8: + /* write data strobe */ + m_display_RAM[m_cursor_address] = m_data_reg; + break; + + case 0x9: + /* test mode */ + /* ... */ + break; + + case 0xa: + /* cursor move */ + if (data) + m_cursor_address--; + else + m_cursor_address++; + m_cursor_address &= m_cursor_address_mask; + break; + + case 0xb: + /* blinking cursor enable */ + m_blinking_cursor_enable = data; + break; + + case 0xc: + /* keyboard interrupt enable */ + m_keyboard_interrupt_enable = data; + m_keyint_line(m_keyboard_interrupt_enable && m_keyboard_data_ready); + break; + + case 0xd: + /* dual intensity enable */ + m_dual_intensity_enable = data; + break; + + case 0xe: + /* display enable */ + m_display_enable = data; + break; + + case 0xf: + /* select word */ + m_previous_word_select = m_word_select; + m_word_select = data; + break; + } + } + else + { /* select word 1 */ + switch (offset) + { + case 0x0: + case 0x1: + case 0x2: + case 0x3: + case 0x4: + case 0x5: + case 0x6: + case 0x7: + case 0x8: + case 0x9: + case 0xa: + /* cursor address */ + if (data) + m_cursor_address |= (1 << offset); + else + m_cursor_address &= ~ (1 << offset); + m_cursor_address &= m_cursor_address_mask; + break; + + case 0xb: + /* not used */ + break; + + case 0xc: + /* display cursor */ + m_display_cursor = data; + break; + + case 0xd: + /* keyboard acknowledge */ + if (m_keyboard_data_ready) + { + m_keyboard_data_ready = 0; + if (m_keyboard_interrupt_enable) + m_keyint_line(CLEAR_LINE); + } + /*m_keyboard_parity_error = 0;*/ + break; + + case 0xe: + /* beep enable strobe - not tested */ + m_beeper->set_state(1); + m_beep_timer->adjust(attotime::from_usec(300)); + break; + + case 0xf: + /* select word */ + m_previous_word_select = m_word_select; + m_word_select = data; + break; + } + } +} + +/* + Video refresh +*/ +void vdt911_device::refresh(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y) +{ + gfx_element *gfx = m_gfxdecode->gfx(m_model); + int height = (m_screen_size == char_960) ? 12 : /*25*/24; + + int use_8bit_charcodes = USES_8BIT_CHARCODES(); + int address = 0; + int i, j; + int cur_char; + int color; + + /*if (use_8bit_charcodes) + color = vdt->dual_intensity_enable ? 1 : 0;*/ + + if (!m_display_enable) + { + rectangle my_rect(x, x + 80*7 - 1, y, y + height*10 - 1); + + bitmap.fill(0, my_rect); + } + else + { + for (i=0; iopaque(bitmap, cliprect, cur_char, color, 0, 0, + x+j*7, y+i*10); + } + } + } +} + +static const unsigned char (*const key_translate[])[91] = +{ /* array must use same order as vdt911_model_t!!! */ + /* US */ + US_key_translate, + /* UK */ + US_key_translate, + /* French */ + French_key_translate, + /* German */ + German_key_translate, + /* Swedish */ + Swedish_key_translate, + /* Norwegian */ + Norwegian_key_translate, + /* Japanese */ + Japanese_key_translate, + /* Arabic */ + /*Arabic_key_translate,*/ + /* FrenchWP */ + FrenchWP_key_translate +}; + +/* + keyboard handler: should be called regularly by machine code, for instance + every Video Blank Interrupt. +*/ +void vdt911_device::check_keyboard() +{ + enum modifier_state_t + { + /* states for Western keyboards and katakana/Arabic keyboards in romaji/Latin mode */ + lower_case = 0, upper_case, shift, control, + /* states for katakana/Arabic keyboards in katakana/Arabic mode */ + foreign, foreign_shift, + /* special value to stop repeat if the modifier state changes */ + special_debounce = -1 + }; + + static unsigned char repeat_timer; + enum { repeat_delay = 5 /* approx. 1/10s */ }; + + UINT16 key_buf[6]; + int i, j; + modifier_state_t modifier_state; + int repeat_mode; + + static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" }; + + /* read current key state */ + for (i = 0; i < 6; i++) + { + key_buf[i] = ioport(keynames[i])->read(); + } + + /* parse modifier keys */ + if ((USES_8BIT_CHARCODES()) + && ((key_buf[5] & 0x0400) || ((!(key_buf[5] & 0x0100)) && m_foreign_mode))) + { /* we are in katakana/Arabic mode */ + m_foreign_mode = true; + + if ((key_buf[4] & 0x0400) || (key_buf[5] & 0x0020)) + modifier_state = foreign_shift; + else + modifier_state = foreign; + } + else + { /* we are using a Western keyboard, or a katakana/Arabic keyboard in + romaji/Latin mode */ + m_foreign_mode = false; + + if (key_buf[3] & 0x0040) + modifier_state = control; + else if ((key_buf[4] & 0x0400) || (key_buf[5] & 0x0020)) + modifier_state = shift; + else if ((key_buf[0] & 0x2000)) + modifier_state = upper_case; + else + modifier_state = lower_case; + } + + + /* test repeat key */ + repeat_mode = key_buf[2] & 0x0002; + + + /* remove modifier keys */ + key_buf[0] &= ~0x2000; + key_buf[2] &= ~0x0002; + key_buf[3] &= ~0x0040; + key_buf[4] &= ~0x0400; + key_buf[5] &= ~0x0120; + + /* remove unused keys */ + if (! HAS_EXTRA_KEY_91()) + key_buf[5] &= ~0x0400; + + if (! HAS_EXTRA_KEY_67()) + key_buf[4] &= ~0x0004; + + + if (! repeat_mode) + /* reset REPEAT timer if the REPEAT key is not pressed */ + repeat_timer = 0; + + if (!(m_last_key_pressed & 0x80) && (key_buf[m_last_key_pressed >> 4] & (1 << (m_last_key_pressed & 0xf)))) + { + /* last key has not been released */ + if (modifier_state == m_last_modifier_state) + { + /* handle REPEAT mode if applicable */ + if ((repeat_mode) && (++repeat_timer == repeat_delay)) + { + if (m_keyboard_data_ready) + { /* keyboard buffer full */ + repeat_timer--; + } + else + { /* repeat current key */ + m_keyboard_data_ready = 1; + repeat_timer = 0; + } + } + } + else + { + repeat_timer = 0; + m_last_modifier_state = special_debounce; + } + } + else + { + m_last_key_pressed = 0x80; + + if (m_keyboard_data_ready) + { /* keyboard buffer full */ + /* do nothing */ + } + else + { + for (i=0; i<6; i++) + { + for (j=0; j<16; j++) + { + if (key_buf[i] & (1 << j)) + { + m_last_key_pressed = (i << 4) | j; + m_last_modifier_state = modifier_state; + + m_keyboard_data = (int)key_translate[m_model][modifier_state][m_last_key_pressed]; + m_keyboard_data_ready = 1; + if (m_keyboard_interrupt_enable) + m_keyint_line(ASSERT_LINE); + return; + } + } + } + } + } +} + +int vdt911_device::get_refresh_rate() +{ + // European models have 50 Hz + return ((m_model == vdt911_model_US) || (m_model == vdt911_model_Japanese))? 60 : 50; +} + +UINT32 vdt911_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + refresh(bitmap, cliprect, 0, 0); + return 0; +} + +INPUT_PORTS_START( vdt911 ) + PORT_START( "LOCALE" ) + PORT_CONFNAME( 0x0f, 0x00, "Terminal language" ) + PORT_CONFSETTING( vdt911_model_US, "English US" ) + PORT_CONFSETTING( vdt911_model_UK, "English UK" ) + PORT_CONFSETTING( vdt911_model_French, "French" ) + PORT_CONFSETTING( vdt911_model_German, "German" ) + PORT_CONFSETTING( vdt911_model_Swedish, "Swedish" ) + PORT_CONFSETTING( vdt911_model_Norwegian, "Norwegian" ) + PORT_CONFSETTING( vdt911_model_Japanese, "Japanese" ) + // PORT_CONFSETTING( vdt911_model_Arabic, "Arabic" ) + PORT_CONFSETTING( vdt911_model_FrenchWP, "French Word Processing" ) + + PORT_START( "SCREEN" ) + PORT_CONFNAME( 0x01, char_960, "Terminal screen size" ) + PORT_CONFSETTING( char_960, "960 chars (12 lines)") + PORT_CONFSETTING( char_1920, "1920 chars (24 lines)") + + PORT_START("KEY0") /* keys 1-16 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CMD") PORT_CODE(KEYCODE_F9) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(red)") PORT_CODE(KEYCODE_F10) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ERASE FIELD") PORT_CODE(KEYCODE_END) \ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ERASE INPUT") PORT_CODE(KEYCODE_PGDN) \ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(grey)") PORT_CODE(KEYCODE_F11) \ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UPPER CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE\ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) \ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) \ + \ + PORT_START("KEY1") /* keys 17-32 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ [") PORT_CODE(KEYCODE_MINUS) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- ]") PORT_CODE(KEYCODE_EQUALS) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_ =") PORT_CODE(KEYCODE_BACKSPACE) \ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) \ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 (numpad)") PORT_CODE(KEYCODE_7_PAD) \ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (numpad)") PORT_CODE(KEYCODE_8_PAD) \ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (numpad)") PORT_CODE(KEYCODE_9_PAD) \ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRINT") PORT_CODE(KEYCODE_PRTSCR) \ + \ + PORT_START("KEY2") /* keys 33-48 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(up)") PORT_CODE(KEYCODE_UP) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_LALT) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) \ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) \ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) \ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CHAR (left/right)") PORT_CODE(KEYCODE_OPENBRACE) \ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FIELD (left/right)") PORT_CODE(KEYCODE_CLOSEBRACE) \ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) \ + \ + PORT_START("KEY3") /* keys 49-64 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 (numpad)") PORT_CODE(KEYCODE_4_PAD) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 (numpad)") PORT_CODE(KEYCODE_5_PAD) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 (numpad)") PORT_CODE(KEYCODE_6_PAD) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(left)") PORT_CODE(KEYCODE_LEFT) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(right)") PORT_CODE(KEYCODE_RIGHT) \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) \ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) \ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) \ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) \ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) \ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) \ + \ + PORT_START("KEY4") /* keys 65-80 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(not on US keyboard)") PORT_CODE(KEYCODE_BACKSLASH) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SKIP TAB") PORT_CODE(KEYCODE_TAB) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 (numpad)") PORT_CODE(KEYCODE_1_PAD) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 (numpad)") PORT_CODE(KEYCODE_2_PAD) \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 (numpad)") PORT_CODE(KEYCODE_3_PAD) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS CHAR") PORT_CODE(KEYCODE_INSERT) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(down)") PORT_CODE(KEYCODE_DOWN) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL CHAR") PORT_CODE(KEYCODE_DEL) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) \ + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) \ + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) \ + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) \ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) \ + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) \ + \ + PORT_START("KEY5") /* keys 81-91 */ \ + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) \ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) \ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) \ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) \ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) \ + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) \ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 (numpad)") PORT_CODE(KEYCODE_0_PAD) \ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (numpad)") PORT_CODE(KEYCODE_DEL_PAD) \ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(not on US keyboard)") PORT_CODE(KEYCODE_MINUS_PAD) \ + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) \ + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(not on US keyboard)") PORT_CODE(KEYCODE_PLUS_PAD) +INPUT_PORTS_END + +static MACHINE_CONFIG_FRAGMENT( vdt911 ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, vdt911_device, screen_update) + + MCFG_SCREEN_SIZE(560, 280) + MCFG_SCREEN_VISIBLE_AREA(0, 560-1, 0, /*250*/280-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_SPEAKER_STANDARD_MONO("speaker") + MCFG_SOUND_ADD("beeper", BEEP, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.50) + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INDIRECT_ENTRIES(3) + MCFG_PALETTE_INIT_OWNER(vdt911_device, vdt911) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", vdt911) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor vdt911_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( vdt911 ); +} + +ioport_constructor vdt911_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( vdt911 ); +} diff --git a/src/mame/video/911_vdt.h b/src/mame/video/911_vdt.h new file mode 100644 index 00000000000..7eb0f55dbc1 --- /dev/null +++ b/src/mame/video/911_vdt.h @@ -0,0 +1,118 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet + +#include "sound/beep.h" + +#define vdt911_chr_region ":gfx1" +enum +{ + /* 10 bytes per character definition */ + vdt911_single_char_len = 10, + + vdt911_US_chr_offset = 0, + vdt911_UK_chr_offset = vdt911_US_chr_offset+128*vdt911_single_char_len, + vdt911_german_chr_offset = vdt911_UK_chr_offset+128*vdt911_single_char_len, + vdt911_swedish_chr_offset = vdt911_german_chr_offset+128*vdt911_single_char_len, + vdt911_norwegian_chr_offset = vdt911_swedish_chr_offset+128*vdt911_single_char_len, + vdt911_frenchWP_chr_offset = vdt911_norwegian_chr_offset+128*vdt911_single_char_len, + vdt911_japanese_chr_offset = vdt911_frenchWP_chr_offset+128*vdt911_single_char_len, + + vdt911_chr_region_len = vdt911_japanese_chr_offset+256*vdt911_single_char_len +}; + +enum vdt911_screen_size_t { char_960 = 0, char_1920 }; +enum vdt911_model_t +{ + vdt911_model_US = 0, + vdt911_model_UK, + vdt911_model_French, + vdt911_model_German, + vdt911_model_Swedish, // Swedish/Finnish + vdt911_model_Norwegian, // Norwegian/Danish + vdt911_model_Japanese, // Katakana Japanese + /*vdt911_model_Arabic,*/ // Arabic + vdt911_model_FrenchWP // French word processing +}; + +class vdt911_device : public device_t +{ +public: + vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER(cru_r); + DECLARE_WRITE8_MEMBER(cru_w); + + DECLARE_PALETTE_INIT(vdt911); + + template static devcb_base &static_set_keyint_callback(device_t &device, _Object object) + { + return downcast(device).m_keyint_line.set_callback(object); + } + + template static devcb_base &static_set_lineint_callback(device_t &device, _Object object) + { + return downcast(device).m_lineint_line.set_callback(object); + } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + void device_config_complete(); + void device_start(); + void device_reset(); + + machine_config_constructor device_mconfig_additions() const; + ioport_constructor device_input_ports() const; + + void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + void refresh(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y); + int get_refresh_rate(); + void check_keyboard(); + + vdt911_screen_size_t m_screen_size; // char_960 for 960-char, 12-line model; char_1920 for 1920-char, 24-line model + vdt911_model_t m_model; // country code + + UINT8 m_data_reg; // dt911 write buffer + UINT8 m_display_RAM[2048]; // vdt911 char buffer (1kbyte for 960-char model, 2kbytes for 1920-char model) + + unsigned int m_cursor_address; // current cursor address (controlled by the computer, affects both display and I/O protocol) + unsigned int m_cursor_address_mask; // 1023 for 960-char model, 2047 for 1920-char model + + emu_timer *m_beep_timer; // beep clock (beeps ends when timer times out) + emu_timer *m_blink_timer; // cursor blink clock + emu_timer *m_line_timer; // screen line timer + + UINT8 m_keyboard_data; // last code pressed on keyboard + bool m_keyboard_data_ready; // true if there is a new code in keyboard_data + bool m_keyboard_interrupt_enable; // true when keybord interrupts are enabled + + bool m_display_enable; // screen is black when false + bool m_dual_intensity_enable; // if true, MSBit of ASCII codes controls character highlight + bool m_display_cursor; // if true, the current cursor location is displayed on screen + bool m_blinking_cursor_enable; // if true, the cursor will blink when displayed + bool m_blink_state; // current cursor blink state + + bool m_word_select; // CRU interface mode + bool m_previous_word_select; // value of word_select is saved here + + UINT8 m_last_key_pressed; + int m_last_modifier_state; + char m_foreign_mode; + + required_device m_beeper; + required_device m_gfxdecode; + required_device m_palette; + devcb_write_line m_keyint_line; + devcb_write_line m_lineint_line; +}; + +extern const device_type VDT911; + +#define MCFG_VDT911_KEYINT_HANDLER( _intcallb ) \ + devcb = &vdt911_device::static_set_keyint_callback( *device, DEVCB_##_intcallb ); + +#define MCFG_VDT911_LINEINT_HANDLER( _intcallb ) \ + devcb = &vdt911_device::static_set_lineint_callback( *device, DEVCB_##_intcallb ); diff --git a/src/mame/video/abc1600.c b/src/mame/video/abc1600.c new file mode 100644 index 00000000000..2a312cb3ae7 --- /dev/null +++ b/src/mame/video/abc1600.c @@ -0,0 +1,1259 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Luxor ABC 1600 Mover emulation + +**********************************************************************/ + +#include "includes/abc1600.h" +#include "abc1600.lh" + + + +//************************************************************************** +// CONSTANTS / MACROS +//************************************************************************** + +#define LOG 0 + + +#define SY6845E_TAG "sy6845e" + + +// video RAM +#define VIDEORAM_SIZE 0x40000 +#define VIDEORAM16_MASK 0x3ffff +#define VIDEORAM8_MASK 0x7fffe + + +// flag register +#define L_P BIT(m_flag, 0) +#define BLANK BIT(m_flag, 1) +#define PIX_POL BIT(m_flag, 2) +#define FRAME_POL BIT(m_flag, 3) +#define HOLD_FY BIT(m_flag, 4) +#define HOLD_FX BIT(m_flag, 5) +#define COMP_MOVE BIT(m_flag, 6) +#define REPLACE BIT(m_flag, 7) + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ABC1600_MOVER = &device_creator; + + +DEVICE_ADDRESS_MAP_START( vram_map, 8, abc1600_mover_device ) + AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(video_ram_r, video_ram_w) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START( crtc_map, 8, abc1600_mover_device ) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xfe) AM_DEVREADWRITE(SY6845E_TAG, mc6845_device, status_r, address_w) + AM_RANGE(0x01, 0x01) AM_MIRROR(0xfe) AM_DEVREADWRITE(SY6845E_TAG, mc6845_device, register_r, register_w) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START( io_map, 8, abc1600_mover_device ) + AM_RANGE(0x000, 0x000) AM_MIRROR(0xff) AM_READ(iord0_r) + AM_RANGE(0x000, 0x000) AM_MIRROR(0xf8) AM_WRITE(ldsx_hb_w) + AM_RANGE(0x001, 0x001) AM_MIRROR(0xf8) AM_WRITE(ldsx_lb_w) + AM_RANGE(0x002, 0x002) AM_MIRROR(0xf8) AM_WRITE(ldsy_hb_w) + AM_RANGE(0x003, 0x003) AM_MIRROR(0xf8) AM_WRITE(ldsy_lb_w) + AM_RANGE(0x004, 0x004) AM_MIRROR(0xf8) AM_WRITE(ldtx_hb_w) + AM_RANGE(0x005, 0x005) AM_MIRROR(0xf8) AM_WRITE(ldtx_lb_w) + AM_RANGE(0x006, 0x006) AM_MIRROR(0xf8) AM_WRITE(ldty_hb_w) + AM_RANGE(0x007, 0x007) AM_MIRROR(0xf8) AM_WRITE(ldty_lb_w) + AM_RANGE(0x100, 0x100) AM_MIRROR(0xf8) AM_WRITE(ldfx_hb_w) + AM_RANGE(0x101, 0x101) AM_MIRROR(0xf8) AM_WRITE(ldfx_lb_w) + AM_RANGE(0x102, 0x102) AM_MIRROR(0xf8) AM_WRITE(ldfy_hb_w) + AM_RANGE(0x103, 0x103) AM_MIRROR(0xf8) AM_WRITE(ldfy_lb_w) + AM_RANGE(0x105, 0x105) AM_MIRROR(0xf8) AM_WRITE(wrml_w) + AM_RANGE(0x107, 0x107) AM_MIRROR(0xf8) AM_WRITE(wrdl_w) + AM_RANGE(0x200, 0x200) AM_MIRROR(0xf8) AM_WRITE(wrmask_strobe_hb_w) + AM_RANGE(0x201, 0x201) AM_MIRROR(0xf8) AM_WRITE(wrmask_strobe_lb_w) + AM_RANGE(0x202, 0x202) AM_MIRROR(0xf8) AM_WRITE(enable_clocks_w) + AM_RANGE(0x203, 0x203) AM_MIRROR(0xf8) AM_WRITE(flag_strobe_w) + AM_RANGE(0x204, 0x204) AM_MIRROR(0xf8) AM_WRITE(endisp_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( mover_map, AS_0, 16, abc1600_mover_device ) + AM_RANGE(0x00000, 0x7ffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// ROM( abc1600_mover ) +//------------------------------------------------- + +ROM_START( abc1600_mover ) + ROM_REGION16_BE( 0x2000, "wrmsk", 0 ) + ROM_LOAD16_BYTE( "wrmskl 6490362-01.1g", 0x0001, 0x1000, CRC(bc737538) SHA1(80e2c3757eb7f713018808d6e41ebef612425028) ) + ROM_LOAD16_BYTE( "wrmskh 6490363-01.1j", 0x0000, 0x1000, CRC(6b7c9f0b) SHA1(7155a993adcf08a5a8a2f22becf9fd66fda698be) ) + + ROM_REGION( 0x200, "shinf", 0 ) + ROM_LOAD( "shinf 6490361-01.1f", 0x000, 0x200, CRC(20260f8f) SHA1(29bf49c64e7cc7592e88cde2768ac57c7ce5e085) ) + + ROM_REGION16_BE( 0x40, "drmsk", 0 ) + ROM_LOAD16_BYTE( "drmskl 6490359-01.1k", 0x01, 0x20, CRC(6e71087c) SHA1(0acf67700d6227f4b315cf8fb0fb31c0e7fb9496) ) + ROM_LOAD16_BYTE( "drmskh 6490358-01.1l", 0x00, 0x20, CRC(a4a9a9dc) SHA1(d8575c0335d6021cbb5f7bcd298b41c35294a80a) ) + + ROM_REGION( 0x104, "plds", 0 ) + ROM_LOAD( "drmsk 6490360-01.1m", 0x000, 0x104, CRC(5f7143c1) SHA1(1129917845f8e505998b15288f02bf907487e4ac) ) // mover word mixer @ 1m,1n,1t,2t +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *abc1600_mover_device::device_rom_region() const +{ + return ROM_NAME( abc1600_mover ); +} + + +//------------------------------------------------- +// mc6845 +//------------------------------------------------- + +inline UINT16 abc1600_mover_device::get_crtca(UINT16 ma, UINT8 ra, UINT8 column) +{ + /* + + bit description + + CRTCA0 0 + CRTCA1 0 + CRTCA2 CC1/MA1 + CRTCA3 CC2/MA2 + CRTCA4 CC3/MA3 + CRTCA5 CC4/MA4 + CRTCA6 RA0 + CRTCA7 RA1 + CRTCA8 RA2 + CRTCA9 RA3 + CRTCA10 CR0/MA8 + CRTCA11 CR1/MA9 + CRTCA12 CR2/MA10 + CRTCA13 CR3/MA11 + CRTCA14 CR4/MA12 + CRTCA15 CR5/MA13 + + */ + + UINT8 cc = (ma & 0xff) + column; + UINT8 cr = ma >> 8; + + return (cr << 10) | ((ra & 0x0f) << 6) | ((cc << 1) & 0x3c); +} + +MC6845_UPDATE_ROW(abc1600_mover_device::crtc_update_row) +{ + int x = 0; + const pen_t *pen = m_palette->pens(); + + for (int column = 0; column < x_count; column += 2) + { + UINT16 dma = get_crtca(ma, ra, column); + + // data is read out of video RAM in nibble mode by strobing CAS 4 times + for (int cas = 0; cas < 4; cas++) + { + UINT16 data = read_videoram(dma + cas); + + for (int bit = 0; bit < 16; bit++) + { + int color = ((BIT(data, 15) ^ PIX_POL) && !BLANK) && de; + + bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + + data <<= 1; + } + } + } +} + +MC6845_ON_UPDATE_ADDR_CHANGED( abc1600_mover_device::crtc_update ) +{ +} + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( abc1600_mover ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( abc1600_mover ) + MCFG_DEFAULT_LAYOUT(layout_abc1600) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate + MCFG_SCREEN_UPDATE_DRIVER(abc1600_mover_device, screen_update) + MCFG_SCREEN_SIZE(958, 1067) + MCFG_SCREEN_VISIBLE_AREA(0, 958-1, 0, 1067-1) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") + + MCFG_MC6845_ADD(SY6845E_TAG, SY6845E, SCREEN_TAG, XTAL_64MHz/32) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(32) + MCFG_MC6845_UPDATE_ROW_CB(abc1600_mover_device, crtc_update_row) + MCFG_MC6845_ADDR_CHANGED_CB(abc1600_mover_device, crtc_update) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor abc1600_mover_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( abc1600_mover ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// abc1600_mover_device - constructor +//------------------------------------------------- + +abc1600_mover_device::abc1600_mover_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ABC1600_MOVER, "ABC 1600 Mover", tag, owner, clock, "abc1600mover", __FILE__), + device_memory_interface(mconfig, *this), + m_space_config("vram", ENDIANNESS_BIG, 16, 18, -1, *ADDRESS_MAP_NAME(mover_map)), + m_crtc(*this, SY6845E_TAG), + m_palette(*this, "palette"), + m_wrmsk_rom(*this, "wrmsk"), + m_shinf_rom(*this, "shinf"), + m_drmsk_rom(*this, "drmsk") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void abc1600_mover_device::device_start() +{ + // state saving + save_item(NAME(m_endisp)); + save_item(NAME(m_clocks_disabled)); + save_item(NAME(m_gmdi)); + save_item(NAME(m_wrm)); + save_item(NAME(m_ms)); + save_item(NAME(m_ds)); + save_item(NAME(m_flag)); + save_item(NAME(m_xsize)); + save_item(NAME(m_ysize)); + save_item(NAME(m_udx)); + save_item(NAME(m_udy)); + save_item(NAME(m_xfrom)); + save_item(NAME(m_xto)); + save_item(NAME(m_yto)); + save_item(NAME(m_ty)); + save_item(NAME(m_mfa)); + save_item(NAME(m_mta)); + save_item(NAME(m_sh)); + save_item(NAME(m_mdor)); + save_item(NAME(m_hold_1w_cyk)); + save_item(NAME(m_wrms0)); + save_item(NAME(m_wrms1)); + save_item(NAME(m_rmc)); + save_item(NAME(m_cmc)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void abc1600_mover_device::device_reset() +{ + // disable display + m_clocks_disabled = 1; + m_endisp = 0; +} + + +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *abc1600_mover_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == AS_0) ? &m_space_config : NULL; +} + + +//------------------------------------------------- +// read_videoram - +//------------------------------------------------- + +inline UINT16 abc1600_mover_device::read_videoram(offs_t offset) +{ + return space().read_word((offset & VIDEORAM16_MASK) << 1); +} + + +//------------------------------------------------- +// write_videoram - +//------------------------------------------------- + +inline void abc1600_mover_device::write_videoram(offs_t offset, UINT16 data, UINT16 mask) +{ + UINT16 old_data = read_videoram(offset); + + space().write_word((offset & VIDEORAM16_MASK) << 1, (data & mask) | (old_data & (mask ^ 0xffff))); +} + + +//------------------------------------------------- +// video_ram_r - +//------------------------------------------------- + +READ8_MEMBER( abc1600_mover_device::video_ram_r ) +{ + offs_t addr = (offset & VIDEORAM8_MASK) >> 1; + UINT8 data = 0; + + if (offset & 0x01) + { + data = read_videoram(addr) & 0xff; + } + else + { + data = read_videoram(addr) >> 8; + } + + return data; +} + + +//------------------------------------------------- +// video_ram_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::video_ram_w ) +{ + offs_t addr = (offset & VIDEORAM8_MASK) >> 1; + + if (offset & 0x01) + { + if (REPLACE) + { + // WRPORT_LB + m_wrm = (m_wrm & 0xff00) | data; + if (LOG) logerror("WRM LB %02x -> %04x\n", data, m_wrm); + } + else + { + // DATAPORT_LB + m_gmdi = (m_gmdi & 0xff00) | data; + if (LOG) logerror("GMDI LB %02x -> %04x\n", data, m_gmdi); + } + + write_videoram(addr, m_gmdi, m_wrm & 0x00ff); + + if (LOG) logerror("Video RAM write LB to %05x : %04x\n", addr, read_videoram(addr)); + } + else + { + if (REPLACE) + { + // WRPORT_HB + m_wrm = (data << 8) | (m_wrm & 0xff); + if (LOG) logerror("WRM HB %02x -> %04x\n", data, m_wrm); + } + else + { + // DATAPORT_HB + m_gmdi = (data << 8) | (m_gmdi & 0xff); + if (LOG) logerror("GMDI HB %02x -> %04x\n", data, m_gmdi); + } + + write_videoram(addr, m_gmdi, m_wrm & 0xff00); + + if (LOG) logerror("Video RAM write HB to %05x : %04x\n", addr, read_videoram(addr)); + } +} + + +//------------------------------------------------- +// iord0_r - +//------------------------------------------------- + +READ8_MEMBER( abc1600_mover_device::iord0_r ) +{ + /* + + bit description + + 0 0 + 1 SCREENPOS + 2 + 3 + 4 + 5 + 6 VSYNC + 7 BUSY + + */ + + UINT8 data = 0; + + // monitor orientation (portrait/landscape) + data |= machine().render().first_target()->view() << 1; + + // vertical sync + data |= m_crtc->vsync_r() << 6; + + return data; +} + + +//------------------------------------------------- +// ldsx_hb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldsx_hb_w ) +{ + /* + + bit description + + 0 XSIZE8 + 1 XSIZE9 + 2 U/D* Y + 3 U/D* X + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("%s LDSX HB: %02x\n", machine().describe_context(), data); + + m_xsize = ((data & 0x03) << 8) | (m_xsize & 0xff); + m_udy = BIT(data, 2); + m_udx = BIT(data, 3); +} + + +//------------------------------------------------- +// ldsx_lb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldsx_lb_w ) +{ + /* + + bit description + + 0 XSIZE0 + 1 XSIZE1 + 2 XSIZE2 + 3 XSIZE3 + 4 XSIZE4 + 5 XSIZE5 + 6 XSIZE6 + 7 XSIZE7 + + */ + + if (LOG) logerror("%s LDSX LB: %02x\n", machine().describe_context(), data); + + m_xsize = (m_xsize & 0x300) | data; +} + + +//------------------------------------------------- +// ldsy_hb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldsy_hb_w ) +{ + /* + + bit description + + 0 YSIZE8 + 1 YSIZE9 + 2 YSIZE10 + 3 YSIZE11 + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("%s LDSY HB: %02x\n", machine().describe_context(), data); + + m_ysize = ((data & 0x0f) << 8) | (m_ysize & 0xff); +} + + +//------------------------------------------------- +// ldsy_lb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldsy_lb_w ) +{ + /* + + bit description + + 0 YSIZE0 + 1 YSIZE1 + 2 YSIZE2 + 3 YSIZE3 + 4 YSIZE4 + 5 YSIZE5 + 6 YSIZE6 + 7 YSIZE7 + + */ + + if (LOG) logerror("%s LDSY LB: %02x\n", machine().describe_context(), data); + + m_ysize = (m_ysize & 0xf00) | data; +} + + +//------------------------------------------------- +// ldtx_hb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldtx_hb_w ) +{ + /* + + bit description + + 0 XTO8, MTA4 + 1 XTO9, MTA5 + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("%s LDTX HB: %02x\n", machine().describe_context(), data); + + m_xto = ((data & 0x03) << 8) | (m_xto & 0xff); + m_mta = (m_mta & 0x3ffcf) | ((data & 0x03) << 4); +} + + +//------------------------------------------------- +// ldtx_lb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldtx_lb_w ) +{ + /* + + bit description + + 0 XTO0 + 1 XTO1 + 2 XTO2 + 3 XTO3 + 4 XTO4, MTA0 + 5 XTO5, MTA1 + 6 XTO6, MTA2 + 7 XTO7, MTA3 + + */ + + if (LOG) logerror("%s LDTX LB: %02x\n", machine().describe_context(), data); + + m_xto = (m_xto & 0x300) | data; + m_mta = (m_mta & 0x3fff0) | (data >> 4); +} + + +//------------------------------------------------- +// ldty_hb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldty_hb_w ) +{ + /* + + bit description + + 0 YTO8, MTA14 + 1 YTO9, MTA15 + 2 YTO10, MTA16 + 3 YTO11, MTA17 + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("%s LDTY HB: %02x\n", machine().describe_context(), data); + + if (L_P) return; + + m_ty = ((data & 0x0f) << 8) | (m_yto & 0xff); + m_yto = ((data & 0x0f) << 8) | (m_yto & 0xff); + m_mta = ((data & 0x0f) << 14) | (m_mta & 0x3fff); +} + + +//------------------------------------------------- +// ldty_lb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldty_lb_w ) +{ + /* + + bit description + + 0 YTO0, MTA6 + 1 YTO1, MTA7 + 2 YTO2, MTA8 + 3 YTO3, MTA9 + 4 YTO4, MTA10 + 5 YTO5, MTA11 + 6 YTO6, MTA12 + 7 YTO7, MTA13 + + */ + + if (LOG) logerror("%s LDTY LB: %02x\n", machine().describe_context(), data); + + if (L_P) return; + + m_ty = (m_ty & 0xf00) | data; + m_yto = (m_yto & 0xf00) | data; + m_mta = (m_mta & 0x3c03f) | (data << 6); +} + + +//------------------------------------------------- +// ldfx_hb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldfx_hb_w ) +{ + /* + + bit description + + 0 XFROM8, MFA4 + 1 XFROM9, MFA5 + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("%s LDFX HB: %02x\n", machine().describe_context(), data); + + m_xfrom = ((data & 0x03) << 8) | (m_xfrom & 0xff); + m_mfa = (m_mfa & 0x3ffcf) | ((data & 0x03) << 4); +} + + +//------------------------------------------------- +// ldfx_lb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldfx_lb_w ) +{ + /* + + bit description + + 0 XFROM0 + 1 XFROM1 + 2 XFROM2 + 3 XFROM3 + 4 XFROM4, MFA0 + 5 XFROM5, MFA1 + 6 XFROM6, MFA2 + 7 XFROM7, MFA3 + + */ + + if (LOG) logerror("%s LDFX LB: %02x\n", machine().describe_context(), data); + + m_xfrom = (m_xfrom & 0x300) | data; + m_mfa = (m_mfa & 0x3fff0) | (data >> 4); +} + + +//------------------------------------------------- +// ldfy_hb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldfy_hb_w ) +{ + /* + + bit description + + 0 MFA14 + 1 MFA15 + 2 MFA16 + 3 MFA17 + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("%s LDFY HB: %02x\n", machine().describe_context(), data); + + m_mfa = ((data & 0x0f) << 14) | (m_mfa & 0x3fff); +} + + +//------------------------------------------------- +// ldfy_lb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::ldfy_lb_w ) +{ + /* + + bit description + + 0 MFA6 + 1 MFA7 + 2 MFA8 + 3 MFA9 + 4 MFA10 + 5 MFA11 + 6 MFA12 + 7 MFA13 + + */ + + if (LOG) logerror("%s LDFY LB: %02x\n", machine().describe_context(), data); + + m_mfa = (m_mfa & 0x3c03f) | (data << 6); + + mover(); +} + + +//------------------------------------------------- +// wrml_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::wrml_w ) +{ + /* + + bit description + + 0 MOVE CYK CLK + 1 DISP CYC SEL / DISP CYK PRE FETCH (+1 PIXCLK) + 2 DATA CLK + 3 _DISP MEM WE + 4 _CAS HB + 5 DTACK CLK / BLANK TEST (+2 PIXCLK) + 6 DISPREC CLK + 7 _RAS HB + + */ + + if (LOG) logerror("MS %u : %02x\n", (offset >> 4) & 0x0f, data); + + if (m_clocks_disabled) + { + m_ms[(offset >> 4) & 0x0f] = data; + } +} + + +//------------------------------------------------- +// wrdl_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::wrdl_w ) +{ + /* + + bit description + + 0 MOVE CYK CLK + 1 DISP CYC SEL / DISP CYK PRE FETCH (+1 PIXCLK) + 2 DATA CLK + 3 _DISP MEM WE + 4 _CAS HB + 5 DTACK CLK / BLANK TEST (+2 PIXCLK) + 6 DISPREC CLK + 7 _RAS HB + + */ + + if (LOG) logerror("WS %u : %02x\n", (offset >> 4) & 0x0f, data); + + if (m_clocks_disabled) + { + m_ds[(offset >> 4) & 0x0f] = data; + } +} + + +//------------------------------------------------- +// wrmask_strobe_hb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::wrmask_strobe_hb_w ) +{ + if (REPLACE) + { + // DATAPORT_HB + m_gmdi = (data << 8) | (m_gmdi & 0xff); + if (LOG) logerror("GMDI HB %04x\n", m_gmdi); + } + else + { + // WRPORT_HB + m_wrm = (data << 8) | (m_wrm & 0xff); + if (LOG) logerror("WRM HB %04x\n", m_gmdi); + } +} + + +//------------------------------------------------- +// wrmask_strobe_lb_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::wrmask_strobe_lb_w ) +{ + if (REPLACE) + { + // DATAPORT_LB + m_gmdi = (m_gmdi & 0xff00) | data; + if (LOG) logerror("GMDI LB %04x\n", m_gmdi); + } + else + { + // WRPORT_LB + m_wrm = (m_wrm & 0xff00) | data; + if (LOG) logerror("WRM LB %04x\n", m_gmdi); + } +} + + +//------------------------------------------------- +// enable_clocks_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::enable_clocks_w ) +{ + if (LOG) logerror("ENABLE CLOCKS\n"); + m_clocks_disabled = 0; +} + + +//------------------------------------------------- +// flag_strobe_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::flag_strobe_w ) +{ + /* + + bit description + + 0 L/_P FLAG + 1 BLANK FLAG + 2 PIX POL + 3 FRAME POL + 4 HOLD FY + 5 HOLD FX + 6 COMP MOVE FLAG + 7 REPLACE/SET & RESET + + */ + + m_flag = data; + if (LOG) logerror("FLAG %02x\n", m_flag); +} + + +//------------------------------------------------- +// endisp_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc1600_mover_device::endisp_w ) +{ + m_endisp = 1; + if (LOG) logerror("ENDISP\n"); +} + + + +//************************************************************************** +// MOVER +//************************************************************************** + +//------------------------------------------------- +// clock_mfa_x - +//------------------------------------------------- + +inline void abc1600_mover_device::clock_mfa_x() +{ + UINT16 mfa_y = m_mfa >> 6; + UINT8 mfa_x = m_mfa & 0x3f; + + if (!HOLD_FX) + { + mfa_x += m_udx ? 1 : -1; + mfa_x &= 0x3f; + } + + m_mfa = (mfa_y << 6) | mfa_x; +} + + +//------------------------------------------------- +// clock_mfa_y - +//------------------------------------------------- + +inline void abc1600_mover_device::clock_mfa_y() +{ + UINT16 mfa_y = m_mfa >> 6; + UINT8 mfa_x = m_mfa & 0x3f; + + if (!HOLD_FY) + { + mfa_y += m_udy ? 1 : -1; + mfa_y &= 0xfff; + } + + m_mfa = (mfa_y << 6) | mfa_x; +} + + +//------------------------------------------------- +// clock_mta_x - +//------------------------------------------------- + +inline void abc1600_mover_device::clock_mta_x() +{ + UINT16 mta_y = m_mta >> 6; + UINT8 mta_x = m_mta & 0x3f; + + mta_x += m_udx ? 1 : -1; + mta_x &= 0x3f; + + m_mta = (mta_y << 6) | mta_x; +} + + +//------------------------------------------------- +// clock_mta_y - +//------------------------------------------------- + +inline void abc1600_mover_device::clock_mta_y() +{ + UINT16 mta_y = m_mta >> 6; + UINT8 mta_x = m_mta & 0x3f; + + mta_y += m_udy ? 1 : -1; + mta_y &= 0xfff; + + m_mta = (mta_y << 6) | mta_x; +} + + +//------------------------------------------------- +// load_mfa_x - +//------------------------------------------------- + +inline void abc1600_mover_device::load_mfa_x() +{ + UINT16 mfa_y = m_mfa >> 6; + UINT8 mfa_x = m_xfrom >> 4; + + m_mfa = (mfa_y << 6) | mfa_x; +} + + +//------------------------------------------------- +// load_mta_x - +//------------------------------------------------- + +inline void abc1600_mover_device::load_mta_x() +{ + UINT16 mta_y = m_mta >> 6; + UINT8 mta_x = m_xto >> 4; + + m_mta = (mta_y << 6) | mta_x; +} + + +//------------------------------------------------- +// load_xy_reg - +//------------------------------------------------- + +inline void abc1600_mover_device::load_xy_reg() +{ + if (L_P) return; + + UINT16 sum = m_xto + m_xsize; + + m_xto = sum & 0x3ff; + m_yto = m_ty & 0xfff; + m_mta = (m_ty << 6) | (sum >> 4); +} + + +//------------------------------------------------- +// compare_mta_x - +//------------------------------------------------- + +inline void abc1600_mover_device::compare_mta_x() +{ + UINT8 mta_x_end = ((m_xto + m_xsize) >> 4) & 0x3f; + UINT8 mta_x = m_mta & 0x3f; + + if (mta_x == mta_x_end) + { + m_cmc = 0; + } + + m_wrms1 = m_cmc & m_amm; +} + + +//------------------------------------------------- +// compare_mta_y - +//------------------------------------------------- + +inline void abc1600_mover_device::compare_mta_y() +{ + int mta_y_end = (m_yto + m_ysize) & 0xfff; + UINT16 mta_y = m_mta >> 6; + + if (mta_y == mta_y_end) + { + m_rmc = 0; + } +} + + +//------------------------------------------------- +// get_shinf - +//------------------------------------------------- + +inline void abc1600_mover_device::get_shinf() +{ + /* + + bit description + + A0 XFROM0 + A1 XFROM1 + A2 XFROM2 + A3 XFROM3 + A4 XTO0 + A5 XTO1 + A6 XTO2 + A7 XTO3 + A8 U/D* X + + */ + + UINT16 shinf_addr = (m_udx << 8) | ((m_xto & 0x0f) << 4) | (m_xfrom & 0x0f); + UINT8 shinf = m_shinf_rom[shinf_addr]; + + m_sh = shinf & 0x0f; + m_hold_1w_cyk = BIT(shinf, 5); +} + + +//------------------------------------------------- +// get_drmsk - +//------------------------------------------------- + +inline UINT16 abc1600_mover_device::get_drmsk() +{ + /* + + bit description + + A0 SH0 + A1 SH1 + A2 SH2 + A3 SH3 + A4 U/D* X + + */ + + UINT16 drmsk_addr = (m_udx << 4) | (m_sh & 0x0f); + return m_drmsk_rom[drmsk_addr]; +} + + +//------------------------------------------------- +// get_wrmsk - get mover write mask +//------------------------------------------------- + +inline UINT16 abc1600_mover_device::get_wrmsk() +{ + /* + + bit description + + A0 XTO0 + A1 XTO1 + A2 XTO2 + A3 XTO3 + A4 XSIZE0 + A5 XSIZE1 + A6 XSIZE2 + A7 XSIZE3 + A8 U/D* X + A9 ANDED MASKS + A10 WRMS0 + A11 WRMS1 + + */ + + UINT16 wrmsk_addr = (m_wrms1 << 11) | (m_wrms0 << 10) | ((!m_wrms1 && !m_wrms0) << 9) | (m_udx << 8) | ((m_xsize & 0x0f) << 4) | (m_xto & 0x0f); + return m_wrmsk_rom[wrmsk_addr] ^ 0xffff; +} + + +//------------------------------------------------- +// barrel_shift - +//------------------------------------------------- + +inline UINT16 abc1600_mover_device::barrel_shift(UINT16 gmdr) +{ + UINT16 rot = gmdr; + + for (int sh = 0; sh < m_sh; sh++) + { + int msb = BIT(rot, 15); + rot <<= 1; + rot |= msb; + } + + return rot; +} + + +//------------------------------------------------- +// word_mixer - +//------------------------------------------------- + +inline UINT16 abc1600_mover_device::word_mixer(UINT16 rot) +{ + UINT16 drmsk = get_drmsk(); + UINT16 gmdi = (rot & drmsk) | (m_mdor & (drmsk ^ 0xffff)); + + if (COMP_MOVE) + { + gmdi ^= 0xffff; + } + + m_mdor = rot; + + return gmdi; +} + + +//------------------------------------------------- +// mover - +//------------------------------------------------- + +void abc1600_mover_device::mover() +{ + if (LOG) logerror("XFROM %u XSIZE %u YSIZE %u XTO %u YTO %u MFA %05x MTA %05x U/D*X %u U/D*Y %u\n", m_xfrom, m_xsize, m_ysize, m_xto, m_yto, m_mfa, m_mta, m_udx, m_udy); + + m_amm = 1; + + m_rmc = 1; + get_shinf(); + + do + { + compare_mta_y(); + + load_mfa_x(); + load_mta_x(); + m_cmc = 1; + m_wrms0 = 0; + + if (m_hold_1w_cyk) + { + // read one word in advance + UINT16 gmdr = read_videoram(m_mfa); + UINT16 rot = barrel_shift(gmdr); + word_mixer(rot); + + clock_mfa_x(); + } + + do + { + compare_mta_x(); + + UINT16 gmdr = read_videoram(m_mfa); + UINT16 rot = barrel_shift(gmdr); + UINT16 gmdi = word_mixer(rot); + UINT16 mask = get_wrmsk(); + + write_videoram(m_mta, gmdi, mask); + + clock_mfa_x(); + clock_mta_x(); + + m_wrms0 = 1; + } + while (m_cmc); + + clock_mfa_y(); + clock_mta_y(); + } + while (m_rmc); + + load_xy_reg(); + + m_amm = 0; +} + +UINT32 abc1600_mover_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (m_endisp) + { + bitmap.fill(m_palette->pen(FRAME_POL), cliprect); + m_crtc->screen_update(screen, bitmap, cliprect); + } + else + { + bitmap.fill(rgb_t::black, cliprect); + } + + return 0; +} diff --git a/src/mame/video/abc1600.h b/src/mame/video/abc1600.h new file mode 100644 index 00000000000..172967c783d --- /dev/null +++ b/src/mame/video/abc1600.h @@ -0,0 +1,151 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Luxor ABC 1600 Mover emulation + +**********************************************************************/ + +#pragma once + +#ifndef __ABC1600_MOVER__ +#define __ABC1600_MOVER__ + +#include "emu.h" +#include "video/mc6845.h" + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define ABC1600_MOVER_TAG "mover" + + +#define MCFG_ABC1600_MOVER_ADD() \ + MCFG_DEVICE_ADD(ABC1600_MOVER_TAG, ABC1600_MOVER, 0) + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> abc1600_mover_device + +class abc1600_mover_device : public device_t, + public device_memory_interface +{ +public: + // construction/destruction + abc1600_mover_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + + virtual DECLARE_ADDRESS_MAP(vram_map, 8); + virtual DECLARE_ADDRESS_MAP(crtc_map, 8); + virtual DECLARE_ADDRESS_MAP(io_map, 8); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + MC6845_UPDATE_ROW(crtc_update_row); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + +private: + inline UINT16 get_drmsk(); + inline void get_shinf(); + inline UINT16 get_wrmsk(); + inline UINT16 barrel_shift(UINT16 gmdr); + inline UINT16 word_mixer(UINT16 rot); + inline void clock_mfa_x(); + inline void clock_mfa_y(); + inline void clock_mta_x(); + inline void clock_mta_y(); + inline void load_mfa_x(); + inline void load_mta_x(); + inline void compare_mta_x(); + inline void compare_mta_y(); + inline void load_xy_reg(); + void mover(); + + DECLARE_READ8_MEMBER( video_ram_r ); + DECLARE_WRITE8_MEMBER( video_ram_w ); + + DECLARE_READ8_MEMBER( iord0_r ); + DECLARE_WRITE8_MEMBER( ldsx_hb_w ); + DECLARE_WRITE8_MEMBER( ldsx_lb_w ); + DECLARE_WRITE8_MEMBER( ldsy_hb_w ); + DECLARE_WRITE8_MEMBER( ldsy_lb_w ); + DECLARE_WRITE8_MEMBER( ldtx_hb_w ); + DECLARE_WRITE8_MEMBER( ldtx_lb_w ); + DECLARE_WRITE8_MEMBER( ldty_hb_w ); + DECLARE_WRITE8_MEMBER( ldty_lb_w ); + DECLARE_WRITE8_MEMBER( ldfx_hb_w ); + DECLARE_WRITE8_MEMBER( ldfx_lb_w ); + DECLARE_WRITE8_MEMBER( ldfy_hb_w ); + DECLARE_WRITE8_MEMBER( ldfy_lb_w ); + DECLARE_WRITE8_MEMBER( wrml_w ); + DECLARE_WRITE8_MEMBER( wrdl_w ); + DECLARE_WRITE8_MEMBER( wrmask_strobe_hb_w ); + DECLARE_WRITE8_MEMBER( wrmask_strobe_lb_w ); + DECLARE_WRITE8_MEMBER( enable_clocks_w ); + DECLARE_WRITE8_MEMBER( flag_strobe_w ); + DECLARE_WRITE8_MEMBER( endisp_w ); + + inline UINT16 read_videoram(offs_t offset); + inline void write_videoram(offs_t offset, UINT16 data, UINT16 mask); + inline UINT16 get_crtca(UINT16 ma, UINT8 ra, UINT8 column); + + const address_space_config m_space_config; + + required_device m_crtc; + required_device m_palette; + required_region_ptr m_wrmsk_rom; + required_region_ptr m_shinf_rom; + required_region_ptr m_drmsk_rom; + + int m_endisp; // enable display + int m_clocks_disabled; // clocks disabled + UINT16 m_gmdi; // video RAM data latch + UINT16 m_wrm; // write mask latch + UINT8 m_ms[16]; // mover sequence control + UINT8 m_ds[16]; // display sequence control + UINT8 m_flag; // flags + UINT16 m_xsize; // X size + UINT16 m_ysize; // Y size + int m_udx; // up/down X + int m_udy; // up/down Y + UINT16 m_xfrom; // X from + UINT16 m_xto; // X to + UINT16 m_yto; // Y to + UINT16 m_ty; // to Y + UINT32 m_mfa; // mover from address + UINT32 m_mta; // mover to address + UINT8 m_sh; // + UINT16 m_mdor; // + int m_hold_1w_cyk; // + int m_wrms0; // + int m_wrms1; // + int m_rmc; // row match count + int m_cmc; // column match count + int m_amm; // active mover mask +}; + + +// device type definition +extern const device_type ABC1600_MOVER; + + + +#endif diff --git a/src/mame/video/abc80.c b/src/mame/video/abc80.c new file mode 100644 index 00000000000..30272f3b0ea --- /dev/null +++ b/src/mame/video/abc80.c @@ -0,0 +1,205 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/***************************************************************************** + * + * video/abc80.c + * + ****************************************************************************/ + +#include "emu.h" +#include "includes/abc80.h" + + + +//------------------------------------------------- +// gfx_layout charlayout +//------------------------------------------------- + +static const gfx_layout charlayout = +{ + 6, 10, + 128, + 1, + { 0 }, + { 0, 1, 2, 3, 4, 5 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, + 10*8 +}; + + +//------------------------------------------------- +// GFXDECODE( abc80 ) +//------------------------------------------------- + +static GFXDECODE_START( abc80 ) + GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 1 ) // normal characters + GFXDECODE_ENTRY( "chargen", 0x500, charlayout, 0, 1 ) // graphics characters +GFXDECODE_END + + +//------------------------------------------------- +// update_screen - +//------------------------------------------------- + +void abc80_state::update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int c = 0; + int r = 0; + int mode = 0; + + for (int y = 0; y < 312; y++) + { + UINT8 vsync_data = m_vsync_prom->base()[y]; + UINT8 l = m_line_prom->base()[y]; + int dv = (vsync_data & ABC80_K2_DV) ? 1 : 0; + + if (!(vsync_data & ABC80_K2_FRAME_RESET)) + { + // reset F2 + r = 0; + } + + for (int sx = 0; sx < 64; sx++) + { + UINT8 hsync_data = m_hsync_prom->base()[sx]; + int dh = (hsync_data & ABC80_K5_DH) ? 1 : 0; + UINT8 data = 0; + + if (hsync_data & ABC80_K5_LINE_END) + { + // reset F4 + c = 0; + + // reset J5 + mode = 0; + } + + /* + + Video RAM Addressing Scheme + + A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 + R2 R1 R0 xx xx xx xx C2 C1 C0 + + A6 A5 A4 A3 = 00 C5 C4 C3 + R4 R3 R4 R3 + + */ + + int a = (c >> 3) & 0x07; + int b = ((r >> 1) & 0x0c) | ((r >> 3) & 0x03); + int s = (a + b) & 0x0f; + UINT16 videoram_addr = ((r & 0x07) << 7) | (s << 3) | (c & 0x07); + UINT8 videoram_data = m_latch; + UINT8 attr_addr = ((dh & dv) << 7) | (videoram_data & 0x7f); + UINT8 attr_data = m_attr_prom->base()[attr_addr]; + + int blank = (attr_data & ABC80_J3_BLANK) ? 1 : 0; + int j = (attr_data & ABC80_J3_TEXT) ? 1 : 0; + int k = (attr_data & ABC80_J3_GRAPHICS) ? 1 : 0; + int versal = (attr_data & ABC80_J3_VERSAL) ? 1 : 0; + int cursor = (videoram_data & ABC80_CHAR_CURSOR) ? 1 : 0; + + if (!j && k) mode = 0; + if (j && !k) mode = 1; + if (j && k) mode = !mode; + + if (mode & versal) + { + // graphics mode + int r0 = 1, r1 = 1, r2 = 1; + + if (l < 3) r0 = 0; else if (l < 7) r1 = 0; else r2 = 0; + + int c0 = BIT(videoram_data, 0) | r0; + int c1 = BIT(videoram_data, 1) | r0; + int c2 = BIT(videoram_data, 2) | r1; + int c3 = BIT(videoram_data, 3) | r1; + int c4 = BIT(videoram_data, 4) | r2; + int c5 = BIT(videoram_data, 6) | r2; + + if (!(c0 & c2 & c4)) data |= 0xe0; + if (!(c1 & c3 & c5)) data |= 0x1c; + } + else + { + // text mode + UINT16 chargen_addr = ((videoram_data & 0x7f) * 10) + l; + + data = m_char_rom->base()[chargen_addr]; + } + + // shift out pixels + for (int bit = 0; bit < 6; bit++) + { + int color = BIT(data, 7); + int x = (sx * 6) + bit; + + color ^= (cursor & m_blink); + color &= blank; + + bitmap.pix32(y, x) = m_palette->pen(color); + + data <<= 1; + } + + m_latch = m_video_ram[videoram_addr]; + + if (hsync_data & ABC80_K5_ROW_START) + { + // clock F4 + c++; + } + } + + if (vsync_data & ABC80_K2_FRAME_END) + { + // clock F2 + r++; + } + } +} + + +void abc80_state::video_start() +{ + screen_device *screen = machine().device(SCREEN_TAG); + + // start timers + m_pio_timer = timer_alloc(TIMER_ID_PIO); + m_pio_timer->adjust(screen->time_until_pos(0, 0), 0, screen->scan_period()); + + m_blink_timer = timer_alloc(TIMER_ID_BLINK); + m_blink_timer->adjust(attotime::from_hz(XTAL_11_9808MHz/2/6/64/312/16), 0, attotime::from_hz(XTAL_11_9808MHz/2/6/64/312/16)); + + m_vsync_on_timer = timer_alloc(TIMER_ID_VSYNC_ON); + m_vsync_on_timer->adjust(screen->time_until_pos(0, 0), 0, screen->frame_period()); + + m_vsync_off_timer = timer_alloc(TIMER_ID_VSYNC_OFF); + m_vsync_off_timer->adjust(screen->time_until_pos(16, 0), 0, screen->frame_period()); + + // allocate memory + m_video_ram.allocate(0x400); +} + + +UINT32 abc80_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + update_screen(bitmap, cliprect); + + return 0; +} + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( abc80_video ) +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( abc80_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(abc80_state, screen_update) + + MCFG_SCREEN_RAW_PARAMS(XTAL_11_9808MHz/2, ABC80_HTOTAL, ABC80_HBEND, ABC80_HBSTART, ABC80_VTOTAL, ABC80_VBEND, ABC80_VBSTART) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", abc80) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END diff --git a/src/mame/video/abc800.c b/src/mame/video/abc800.c new file mode 100644 index 00000000000..ee9fc3a19de --- /dev/null +++ b/src/mame/video/abc800.c @@ -0,0 +1,311 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/***************************************************************************** + * + * video/abc800.c + * + ****************************************************************************/ + +#include "includes/abc80x.h" + + + +// these are needed because the MC6845 emulation does +// not position the active display area correctly +#define HORIZONTAL_PORCH_HACK 115 +#define VERTICAL_PORCH_HACK 29 + + + +//************************************************************************** +// HIGH RESOLUTION GRAPHICS +//************************************************************************** + +//------------------------------------------------- +// hrs_w - high resolution scanline write +//------------------------------------------------- + +WRITE8_MEMBER( abc800_state::hrs_w ) +{ + m_hrs = data; +} + + +//------------------------------------------------- +// hrc_w - high resolution color write +//------------------------------------------------- + +WRITE8_MEMBER( abc800_state::hrc_w ) +{ + m_fgctl = data; +} + + + +//************************************************************************** +// ABC 800 COLOR +//************************************************************************** + +//------------------------------------------------- +// translate_trom_offset - +//------------------------------------------------- + +offs_t abc800c_state::translate_trom_offset(offs_t offset) +{ + int row = offset / 40; + int col = offset % 40; + + offset = ((row & 0x07) * 0x80) + col; + + if (row & 0x08) offset += 0x28; + if (row & 0x10) offset += 0x50; + + return offset; +} + + +//------------------------------------------------- +// hr_update - high resolution screen update +//------------------------------------------------- + +void abc800c_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const pen_t *pen = m_palette->pens(); + + UINT16 addr = 0; + + for (int y = m_hrs; y < MIN(cliprect.max_y + 1, m_hrs + 480); y += 2) + { + int x = 0; + + for (int sx = 0; sx < 64; sx++) + { + UINT8 data = m_video_ram[addr++]; + + for (int dot = 0; dot < 4; dot++) + { + UINT16 fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); + UINT8 fgctl = m_fgctl_prom->base()[fgctl_addr]; + int color = fgctl & 0x07; + + if (color) + { + bool black = bitmap.pix32(y, x) == rgb_t::black; + bool opaque = !BIT(fgctl, 3); + + if (black || opaque) + { + bitmap.pix32(y, x) = pen[color]; + bitmap.pix32(y, x + 1) = pen[color]; + + bitmap.pix32(y + 1, x) = pen[color]; + bitmap.pix32(y + 1, x + 1) = pen[color]; + } + } + + data <<= 2; + x += 2; + } + } + } +} + + +void abc800_state::video_start() +{ + // register for state saving + save_item(NAME(m_hrs)); + save_item(NAME(m_fgctl)); +} + + +//------------------------------------------------- +// SCREEN_UPDATE( abc800c ) +//------------------------------------------------- + +UINT32 abc800c_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // clear screen + bitmap.fill(rgb_t::black, cliprect); + + // draw text + if (!BIT(m_fgctl, 7)) + { + m_trom->screen_update(screen, bitmap, cliprect); + } + + // draw HR graphics + hr_update(bitmap, cliprect); + + return 0; +} + + +//------------------------------------------------- +// SAA5050_INTERFACE( trom_intf ) +//------------------------------------------------- + +READ8_MEMBER( abc800c_state::char_ram_r ) +{ + return m_char_ram[translate_trom_offset(offset)]; +} + + +//------------------------------------------------- +// PALETTE_INIT( abc800c ) +//------------------------------------------------- + +PALETTE_INIT_MEMBER( abc800c_state, abc800c ) +{ + palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black + palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red + palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green + palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow + palette.set_pen_color(4, rgb_t(0x00, 0x00, 0xff)); // blue + palette.set_pen_color(5, rgb_t(0xff, 0x00, 0xff)); // magenta + palette.set_pen_color(6, rgb_t(0x00, 0xff, 0xff)); // cyan + palette.set_pen_color(7, rgb_t(0xff, 0xff, 0xff)); // white +} + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( abc800c_video ) +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( abc800c_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(abc800c_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(480, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 480-1) + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(abc800c_state, abc800c) + + MCFG_DEVICE_ADD(SAA5052_TAG, SAA5052, XTAL_12MHz/2) + MCFG_SAA5050_D_CALLBACK(READ8(abc800c_state, char_ram_r)) + MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) +MACHINE_CONFIG_END + + + +//************************************************************************** +// ABC 800 MONOCHROME +//************************************************************************** + +//------------------------------------------------- +// hr_update - high resolution screen update +//------------------------------------------------- + +void abc800m_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT16 addr = 0; + + const pen_t *pen = m_palette->pens(); + + for (int y = m_hrs + VERTICAL_PORCH_HACK; y < MIN(cliprect.max_y + 1, m_hrs + VERTICAL_PORCH_HACK + 240); y++) + { + int x = HORIZONTAL_PORCH_HACK; + + for (int sx = 0; sx < 64; sx++) + { + UINT8 data = m_video_ram[addr++]; + + for (int dot = 0; dot < 4; dot++) + { + UINT16 fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); + int color = (m_fgctl_prom->base()[fgctl_addr] & 0x07) ? 1 : 0; + + bitmap.pix32(y, x++) = pen[color]; + bitmap.pix32(y, x++) = pen[color]; + + data <<= 2; + } + } + } +} + + +//------------------------------------------------- +// MC6845_UPDATE_ROW( abc800m_update_row ) +//------------------------------------------------- + +MC6845_UPDATE_ROW( abc800m_state::abc800m_update_row ) +{ + int column; + rgb_t fgpen = m_palette->pen(1); + + y += vbp; + + for (column = 0; column < x_count; column++) + { + int bit; + + UINT16 address = (m_char_ram[(ma + column) & 0x7ff] << 4) | (ra & 0x0f); + UINT8 data = (m_char_rom->base()[address & 0x7ff] & 0x3f); + + if (column == cursor_x) + { + data = 0x3f; + } + + data <<= 2; + + for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++) + { + int x = hbp + (column * ABC800_CHAR_WIDTH) + bit; + + if (BIT(data, 7) && de) + { + bitmap.pix32(y, x) = fgpen; + } + + data <<= 1; + } + } +} + + +//------------------------------------------------- +// SCREEN_UPDATE( abc800m ) +//------------------------------------------------- + +UINT32 abc800m_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // clear screen + bitmap.fill(rgb_t::black, cliprect); + + // draw HR graphics + hr_update(bitmap, cliprect); + + // draw text + if (!BIT(m_fgctl, 7)) + { + m_crtc->screen_update(screen, bitmap, cliprect); + } + + return 0; +} + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( abc800m_video ) +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( abc800m_video ) + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, ABC800_CCLK) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(ABC800_CHAR_WIDTH) + MCFG_MC6845_UPDATE_ROW_CB(abc800m_state, abc800m_update_row) + MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(Z80DART_TAG, z80dart_device, rib_w)) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(abc800m_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(768, 312) + MCFG_SCREEN_VISIBLE_AREA(0,768-1, 0, 312-1) + + MCFG_PALETTE_ADD_MONOCHROME_YELLOW("palette") +MACHINE_CONFIG_END diff --git a/src/mame/video/abc802.c b/src/mame/video/abc802.c new file mode 100644 index 00000000000..667f8cfe931 --- /dev/null +++ b/src/mame/video/abc802.c @@ -0,0 +1,220 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/***************************************************************************** + * + * video/abc802.c + * + ****************************************************************************/ + +#include "includes/abc80x.h" + + + +//------------------------------------------------- +// MC6845_UPDATE_ROW( abc802_update_row ) +//------------------------------------------------- + +MC6845_UPDATE_ROW( abc802_state::abc802_update_row ) +{ + /* + + PAL16R4 equation: + + IF (VCC) *OS = FC + RF / RC + *RG: = HS / *RG + *ATE / *RG + ATD / *RG + LL / + *RG + AT1 / *RG + AT0 / ATE + *ATD + *LL + + *AT1 + *AT0 + *RI: = *RI + *INV / *RI + LL / *INV + *LL + *RF: = HS / *RF + *ATE / *RF + ATD / *RF + LL / + *RF + AT1 / *RF + AT0 / ATE + *ATD + *LL + + *AT1 + AT0 + *RC: = HS / *RC + *ATE / *RC + *ATD / *RC + LL / + *RC + *ATI / *RC + AT0 / ATE + *LL + *AT1 + + *AT0 + IF (VCC) *O0 = *CUR + *AT0 / *CUR + ATE + *O1 = *CUR + *AT1 / *CUR + ATE + + + + = AND + / = OR + * = Inverted + + ATD Attribute data + ATE Attribute enable + AT0,AT1 Attribute address + CUR Cursor + FC FLSH clock + HS Horizontal sync + INV Inverted signal input + LL Load when Low + OEL Output Enable when Low + RC Row clear + RF Row flash + RG Row graphic + RI Row inverted + + */ + + const pen_t *pen = m_palette->pens(); + + int rf = 0, rc = 0, rg = 0; + + y += vbp; + + for (int column = 0; column < x_count; column++) + { + UINT8 code = m_char_ram[(ma + column) & 0x7ff]; + UINT16 address = code << 4; + UINT8 ra_latch = ra; + UINT8 data; + + int ri = (code & ABC802_INV) ? 1 : 0; + + if (column == cursor_x) + { + ra_latch = 0x0f; + } + + if ((m_flshclk && rf) || rc) + { + ra_latch = 0x0e; + } + + if (rg) + { + address |= 0x800; + } + + data = m_char_rom->base()[(address + ra_latch) & 0xfff]; + + if (data & ABC802_ATE) + { + int attr = data & 0x03; + int value = (data & ABC802_ATD) ? 1 : 0; + + switch (attr) + { + case 0x00: + // Row Graphic + rg = value; + break; + + case 0x01: + // Row Flash + rf = value; + break; + + case 0x02: + // Row Clear + rc = value; + break; + + case 0x03: + // undefined + break; + } + } + else + { + data <<= 2; + + if (m_80_40_mux) + { + for (int bit = 0; bit < ABC800_CHAR_WIDTH; bit++) + { + int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + bit; + int color = (BIT(data, 7) ^ ri) && de; + + bitmap.pix32(y, x) = pen[color]; + + data <<= 1; + } + } + else + { + for (int bit = 0; bit < ABC800_CHAR_WIDTH; bit++) + { + int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + (bit << 1); + int color = (BIT(data, 7) ^ ri) && de; + + bitmap.pix32(y, x) = pen[color]; + bitmap.pix32(y, x + 1) = pen[color]; + + data <<= 1; + } + + column++; + } + } + } +} + + +//------------------------------------------------- +// vs_w - vertical sync write +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc802_state::vs_w ) +{ + if (!state) + { + // flash clock + if (m_flshclk_ctr & 0x20) + { + m_flshclk = !m_flshclk; + m_flshclk_ctr = 0; + } + else + { + m_flshclk_ctr++; + } + } + + // signal _DEW to DART + m_dart->rib_w(!state); +} + + +void abc802_state::video_start() +{ + // register for state saving + save_item(NAME(m_flshclk_ctr)); + save_item(NAME(m_flshclk)); + save_item(NAME(m_80_40_mux)); +} + + +//------------------------------------------------- +// SCREEN_UPDATE( abc802 ) +//------------------------------------------------- + +UINT32 abc802_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // draw text + m_crtc->screen_update(screen, bitmap, cliprect); + + return 0; +} + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( abc802_video ) +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( abc802_video ) + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, ABC800_CCLK) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(ABC800_CHAR_WIDTH) + MCFG_MC6845_UPDATE_ROW_CB(abc802_state, abc802_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(abc802_state, vs_w)) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(abc802_state, screen_update) + + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(768, 312) + MCFG_SCREEN_VISIBLE_AREA(0,768-1, 0, 312-1) + + MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") +MACHINE_CONFIG_END diff --git a/src/mame/video/abc806.c b/src/mame/video/abc806.c new file mode 100644 index 00000000000..f958b025b1c --- /dev/null +++ b/src/mame/video/abc806.c @@ -0,0 +1,507 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/***************************************************************************** + * + * video/abc806.c + * + ****************************************************************************/ + +#include "includes/abc80x.h" + + + +#define HORIZONTAL_PORCH_HACK 109 +#define VERTICAL_PORCH_HACK 27 + + + +//------------------------------------------------- +// hrs_w - high resolution memory banking +//------------------------------------------------- + +WRITE8_MEMBER( abc806_state::hrs_w ) +{ + /* + + bit signal description + + 0 VM14 visible screen memory area bit 0 + 1 VM15 visible screen memory area bit 1 + 2 VM16 visible screen memory area bit 2 + 3 VM17 visible screen memory area bit 3 + 4 F14 cpu accessible screen memory area bit 0 + 5 F15 cpu accessible screen memory area bit 1 + 6 F16 cpu accessible screen memory area bit 2 + 7 F17 cpu accessible screen memory area bit 3 + + */ + + m_hrs = data; +} + + +//------------------------------------------------- +// hrc_w - high resolution color write +//------------------------------------------------- + +WRITE8_MEMBER( abc806_state::hrc_w ) +{ + int reg = (offset >> 8) & 0x0f; + + m_hrc[reg] = data; +} + + +//------------------------------------------------- +// charram_r - character RAM read +//------------------------------------------------- + +READ8_MEMBER( abc806_state::charram_r ) +{ + m_attr_data = m_attr_ram[offset]; + + return m_char_ram[offset]; +} + + +//------------------------------------------------- +// charram_w - character RAM write +//------------------------------------------------- + +WRITE8_MEMBER( abc806_state::charram_w ) +{ + m_attr_ram[offset] = m_attr_data; + + m_char_ram[offset] = data; +} + + +//------------------------------------------------- +// ami_r - attribute memory read +//------------------------------------------------- + +READ8_MEMBER( abc806_state::ami_r ) +{ + return m_attr_data; +} + + +//------------------------------------------------- +// amo_w - attribute memory write +//------------------------------------------------- + +WRITE8_MEMBER( abc806_state::amo_w ) +{ + m_attr_data = data; +} + + +//------------------------------------------------- +// cli_r - palette PROM read +//------------------------------------------------- + +READ8_MEMBER( abc806_state::cli_r ) +{ + /* + + bit description + + 0 HRU II data bit 0 + 1 HRU II data bit 1 + 2 HRU II data bit 2 + 3 HRU II data bit 3 + 4 + 5 + 6 + 7 RTC data output + + */ + + UINT16 hru2_addr = (m_hru2_a8 << 8) | (offset >> 8); + UINT8 data = m_hru2_prom->base()[hru2_addr] & 0x0f; + + logerror("HRU II %03x : %01x\n", hru2_addr, data); + + data |= m_rtc->dio_r() << 7; + + return data; +} + + +//------------------------------------------------- +// sti_r - protection device read +//------------------------------------------------- + +READ8_MEMBER( abc806_state::sti_r ) +{ + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 PROT DOUT + + */ + + return 0x7f; +} + + +//------------------------------------------------- +// sto_w - +//------------------------------------------------- + +WRITE8_MEMBER( abc806_state::sto_w ) +{ + int level = BIT(data, 7); + + switch (data & 0x07) + { + case 0: + // external memory enable + m_eme = level; + break; + case 1: + // 40/80 column display + m_40 = level; + break; + case 2: + // HRU II address line 8, PROT A0 + m_hru2_a8 = level; + break; + case 3: + // PROT INI + break; + case 4: + // text display enable + m_txoff = level; + break; + case 5: + // RTC chip select + m_rtc->cs_w(!level); + break; + case 6: + // RTC clock + m_rtc->clk_w(level); + break; + case 7: + // RTC data in, PROT DIN + m_rtc->dio_w(level); + break; + } +} + + +//------------------------------------------------- +// sso_w - sync offset write +//------------------------------------------------- + +WRITE8_MEMBER( abc806_state::sso_w ) +{ + m_sync = data & 0x3f; +} + + +//------------------------------------------------- +// MC6845_UPDATE_ROW( abc806_update_row ) +//------------------------------------------------- + +MC6845_UPDATE_ROW( abc806_state::abc806_update_row ) +{ + const pen_t *pen = m_palette->pens(); + + int fg_color = 7; + int bg_color = 0; + int underline = 0; + int flash = 0; + int e5 = m_40; + int e6 = m_40; + int th = 0; + + y += m_sync + vbp; + + for (int column = 0; column < x_count; column++) + { + UINT8 data = m_char_ram[(ma + column) & 0x7ff]; + UINT8 attr = m_attr_ram[(ma + column) & 0x7ff]; + UINT8 rad_data; + + if ((attr & 0x07) == ((attr >> 3) & 0x07)) + { + // special case + switch (attr >> 6) + { + case 0: + // use previously selected attributes + break; + + case 1: + // reserved for future use + break; + + case 2: + // blank + fg_color = 0; + bg_color = 0; + underline = 0; + flash = 0; + break; + + case 3: + // double width + e5 = BIT(attr, 0); + e6 = BIT(attr, 1); + + // read attributes from next byte + attr = m_attr_ram[(ma + column + 1) & 0x7ff]; + + if (attr != 0x00) + { + fg_color = attr & 0x07; + bg_color = (attr >> 3) & 0x07; + underline = BIT(attr, 6); + flash = BIT(attr, 7); + } + break; + } + } + else + { + // normal case + fg_color = attr & 0x07; + bg_color = (attr >> 3) & 0x07; + underline = BIT(attr, 6); + flash = BIT(attr, 7); + e5 = m_40; + e6 = m_40; + } + + if (column == cursor_x) + { + rad_data = 0x0f; + } + else + { + UINT16 rad_addr = (e6 << 8) | (e5 << 7) | (flash << 6) | (underline << 4) | (m_flshclk << 5) | (ra & 0x0f); + rad_data = m_rad_prom->base()[rad_addr] & 0x0f; + } + + UINT16 chargen_addr = (th << 12) | (data << 4) | rad_data; + UINT8 chargen_data = m_char_rom->base()[chargen_addr & 0xfff] << 2; + int x = hbp + (column + 4) * ABC800_CHAR_WIDTH; + + for (int bit = 0; bit < ABC800_CHAR_WIDTH; bit++) + { + int color = BIT(chargen_data, 7) ? fg_color : bg_color; + if (!de) color = 0; + + bitmap.pix32(y, x++) = pen[color]; + + if (e5 || e6) + { + bitmap.pix32(y, x++) = pen[color]; + } + + chargen_data <<= 1; + } + + if (e5 || e6) + { + column++; + } + } +} + + +//------------------------------------------------- +// hs_w - horizontal sync write +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc806_state::hs_w ) +{ + int vsync; + + if (!state) + { + m_v50_addr++; + + // clock current vsync value into the shift register + m_vsync_shift <<= 1; + m_vsync_shift |= m_vsync; + + vsync = BIT(m_vsync_shift, m_sync); + + if (!m_d_vsync && vsync) + { + // clear V50 address + m_v50_addr = 0; + } + else if (m_d_vsync && !vsync) + { + // flash clock + if (m_flshclk_ctr & 0x20) + { + m_flshclk = !m_flshclk; + m_flshclk_ctr = 0; + } + else + { + m_flshclk_ctr++; + } + } + + if (m_d_vsync != vsync) + { + // signal _DEW to DART + m_dart->rib_w(!vsync); + } + + m_d_vsync = vsync; + } +} + + +//------------------------------------------------- +// vs_w - vertical sync write +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc806_state::vs_w ) +{ + m_vsync = state; +} + + +//------------------------------------------------- +// hr_update - high resolution screen update +//------------------------------------------------- + +void abc806_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const pen_t *pen = m_palette->pens(); + + UINT32 addr = (m_hrs & 0x0f) << 15; + + for (int y = m_sync + VERTICAL_PORCH_HACK; y < MIN(cliprect.max_y + 1, m_sync + VERTICAL_PORCH_HACK + 240); y++) + { + for (int sx = 0; sx < 128; sx++) + { + UINT8 data = m_video_ram[addr++]; + UINT16 dot = (m_hrc[data >> 4] << 8) | m_hrc[data & 0x0f]; + + for (int pixel = 0; pixel < 4; pixel++) + { + int x = HORIZONTAL_PORCH_HACK + (ABC800_CHAR_WIDTH * 4) - 16 + (sx * 4) + pixel; + + if (BIT(dot, 15) || (bitmap.pix32(y, x) == rgb_t::black)) + { + bitmap.pix32(y, x) = pen[(dot >> 12) & 0x07]; + } + + dot <<= 4; + } + } + } +} + + +void abc806_state::video_start() +{ + // initialize variables + for (int i = 0; i < 16; i++) + { + m_hrc[i] = 0; + } + + m_sync = 10; + m_d_vsync = 1; + m_vsync = 1; + m_40 = 1; + + // allocate memory + m_char_ram.allocate(ABC806_CHAR_RAM_SIZE); + m_attr_ram.allocate(ABC806_ATTR_RAM_SIZE); + + // register for state saving + save_item(NAME(m_txoff)); + save_item(NAME(m_40)); + save_item(NAME(m_flshclk_ctr)); + save_item(NAME(m_flshclk)); + save_item(NAME(m_attr_data)); + save_item(NAME(m_hrs)); + save_item(NAME(m_hrc)); + save_item(NAME(m_sync)); + save_item(NAME(m_v50_addr)); + save_item(NAME(m_hru2_a8)); + save_item(NAME(m_vsync_shift)); + save_item(NAME(m_vsync)); + save_item(NAME(m_d_vsync)); +} + + +//------------------------------------------------- +// SCREEN_UPDATE( abc806 ) +//------------------------------------------------- + +UINT32 abc806_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // clear screen + bitmap.fill(rgb_t::black, cliprect); + + if (!m_txoff) + { + // draw text + m_crtc->screen_update(screen, bitmap, cliprect); + } + + // draw HR graphics + hr_update(bitmap, cliprect); + + return 0; +} + + +//------------------------------------------------- +// PALETTE_INIT( abc806 ) +//------------------------------------------------- + +PALETTE_INIT_MEMBER( abc806_state, abc806 ) +{ + palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black + palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red + palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green + palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow + palette.set_pen_color(4, rgb_t(0x00, 0x00, 0xff)); // blue + palette.set_pen_color(5, rgb_t(0xff, 0x00, 0xff)); // magenta + palette.set_pen_color(6, rgb_t(0x00, 0xff, 0xff)); // cyan + palette.set_pen_color(7, rgb_t(0xff, 0xff, 0xff)); // white +} + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( abc806_video ) +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( abc806_video ) + MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, ABC800_CCLK) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(ABC800_CHAR_WIDTH) + MCFG_MC6845_UPDATE_ROW_CB(abc806_state, abc806_update_row) + MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(abc806_state, hs_w)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(abc806_state, vs_w)) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(abc806_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(768, 312) + MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 312-1) + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(abc806_state, abc806) +MACHINE_CONFIG_END diff --git a/src/mame/video/ac1.c b/src/mame/video/ac1.c new file mode 100644 index 00000000000..8af6b695baa --- /dev/null +++ b/src/mame/video/ac1.c @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + AC1 video driver by Miodrag Milanovic + + 15/01/2009 Preliminary driver. + +****************************************************************************/ + +#include "emu.h" +#include "includes/ac1.h" + +#define AC1_VIDEO_MEMORY 0x1000 + +const gfx_layout ac1_charlayout = +{ + 6, 8, /* 6x8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {7, 6, 5, 4, 3, 2}, + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, + 8*8 /* size of one char */ +}; + +void ac1_state::video_start() +{ +} + +UINT32 ac1_state::screen_update_ac1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + address_space &space = m_maincpu->space(AS_PROGRAM); + + for(y = 0; y < 16; y++ ) + { + for(x = 0; x < 64; x++ ) + { + int code = space.read_byte(AC1_VIDEO_MEMORY + x + y*64); + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, 63*6-x*6,15*8-y*8); + } + } + return 0; +} + +UINT32 ac1_state::screen_update_ac1_32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + address_space &space = m_maincpu->space(AS_PROGRAM); + + for(y = 0; y < 32; y++ ) + { + for(x = 0; x < 64; x++ ) + { + int code = space.read_byte(AC1_VIDEO_MEMORY + x + y*64); + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, 63*6-x*6,31*8-y*8); + } + } + return 0; +} diff --git a/src/mame/video/advision.c b/src/mame/video/advision.c new file mode 100644 index 00000000000..086f61c6175 --- /dev/null +++ b/src/mame/video/advision.c @@ -0,0 +1,110 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + video/advision.c + + Routines to control the Adventurevision video hardware + + Video hardware is composed of a vertical array of 40 LEDs which is + reflected off a spinning mirror, to give a resolution of 150 x 40 at 15 FPS. + +***************************************************************************/ + +#include "emu.h" +#include "includes/advision.h" + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void advision_state::video_start() +{ + m_video_hpos = 0; + m_display.resize(8 * 8 * 256); + memset(&m_display[0], 0, 8*8*256); + save_item(NAME(m_display)); + save_item(NAME(m_video_hpos)); +} + +/*************************************************************************** + + Initialise the palette. + +***************************************************************************/ + +PALETTE_INIT_MEMBER(advision_state, advision) +{ + for (int i = 0; i < 8; i++) + { + /* 8 shades of RED */ + m_palette->set_pen_color(i, i * 0x22, 0x00, 0x00); + } +} + +/*************************************************************************** + + Update the display data. + +***************************************************************************/ + +void advision_state::vh_write(int data) +{ + if (m_video_bank >= 1 && m_video_bank <=5) + { + m_led_latch[m_video_bank] = data; + } +} + +void advision_state::vh_update(int x) +{ + UINT8 *dst = &m_display[x]; + + for (int y = 0; y < 8; y++) + { + UINT8 data = m_led_latch[7 - y]; + + for (int i = 0; i < 8; i++) + { + if (!BIT(data, 7 - i)) + dst[i * 256] = 8; + } + + m_led_latch[7 - y] = 0xff; + dst += 8 * 256; + } +} + + +/*************************************************************************** + + Refresh the video screen + +***************************************************************************/ + +UINT32 advision_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + if ((m_frame_count++ % 4) == 0) + { + m_frame_start = 1; + m_video_hpos = 0; + } + + for (int x = 0; x < 150; x++) + { + UINT8 *led = &m_display[x]; + + for (int y = 0; y < 128; y+=2) + { + if (*led > 0) + bitmap.pix16(30 + y, 85 + x) = --(*led); + else + bitmap.pix16(30 + y, 85 + x) = 0; + + led += 256; + } + } + return 0; +} diff --git a/src/mame/video/alesis.c b/src/mame/video/alesis.c new file mode 100644 index 00000000000..08f4554a4f2 --- /dev/null +++ b/src/mame/video/alesis.c @@ -0,0 +1,167 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + Alesis SR-16 LCD emulation + +****************************************************************************/ + +#include "emu.h" +#include "includes/alesis.h" + + +void alesis_state::update_lcd_symbols(bitmap_ind16 &bitmap, UINT8 pos, UINT8 y, UINT8 x, int state) +{ + if (pos == 6) + { + switch(x) + { + case 0: + switch(y) + { + case 0: output_set_value("a_next", state); break; + case 1: output_set_value("b_next", state); break; + case 2: output_set_value("fill_next", state); break; + case 3: output_set_value("user_next", state); break; + case 4: output_set_value("play", state); break; + case 5: output_set_value("record", state); break; + case 6: output_set_value("compose", state); break; + case 7: output_set_value("perform", state); break; + } + break; + case 1: + if (y == 0) + { + output_set_value("song", state); + } + else if (y < 8) + { + if (state) + m_lcd_digits[0] |= (1<<(y-1)); + else + m_lcd_digits[0] &= ~(1<<(y-1)); + + output_set_value("digit0", BITSWAP8(m_lcd_digits[0],7,3,1,4,6,5,2,0)); + } + break; + case 2: + if (y == 0) + { + output_set_value("pattern", state); + } + else if (y < 8) + { + if (state) + m_lcd_digits[1] |= (1<<(y-1)); + else + m_lcd_digits[1] &= ~(1<<(y-1)); + + output_set_value("digit1", BITSWAP8(m_lcd_digits[1],7,3,1,4,6,5,2,0)); + } + break; + case 3: + switch(y) + { + case 0: output_set_value("b", state); break; + case 1: output_set_value("a", state); break; + case 2: output_set_value("fill", state); break; + case 3: output_set_value("user", state); break; + case 4: output_set_value("edited", state); break; + case 5: output_set_value("set", state); break; + case 6: output_set_value("drum", state); break; + case 7: output_set_value("press_play", state); break; + } + break; + case 4: + if (y == 7) + { + output_set_value("metronome", state); + } + else if (y < 7) + { + if (state) + m_lcd_digits[4] |= (1<> 5) +#define CR0_MODE_0 0 +#define CR0_MODE_1 1 +#define CR0_MODE_VECTOR 2 +#define CR0_MODE_3 3 +#define CR0_MODE_BLT 4 +#define CR0_MODE_NORMAL 7 +#define CR0_SHIFT(a) ((a) & 0x1f) + +// control register 1 +#define CR1_INV 0x80 +#define CR1_AD_BIT 0x80 // 4- and 8-plane color +#define CR1_DADDR_16 0x40 +#define CR1_DV_CK 0x40 // 4- and 8-plane color +#define CR1_DH_CK 0x20 +#define CR1_ROP_EN 0x10 +#define CR1_RESET 0x08 +#define CR1_DP_CK 0x04 +#define CR1_SYNC_EN 0x02 +#define CR1_DISP_EN 0x01 + +// control register 2 +#define CR2_S_DATA(a) ((a) >> 6) +#define CR2_CONST_ACCESS 0x00 +#define CR2_PIXEL_ACCESS 0x01 +#define CR2_SHIFT_ACCESS 0x02 +#define CR2_PLANE_ACCESS 0x03 +#define CR2_S_PLANE(a) (((a) >> 4) & 0x03) +#define CR2_D_PLANE(a) ((a) & 0x0f) +#define CR2B_S_PLANE(a) ((a) & 0x07) +#define CR2A_D_PLANE(a) (a) + +// Lookup table control register +#define LUT_AD_CS 0x80 +#define LUT_CPAL_CS 0x40 +#define LUT_FIFO_CS 0x20 +#define LUT_FIFO_RST 0x10 +#define LUT_ST_LUK 0x08 +#define LUT_R_W 0x04 +#define LUT_C1 0x02 +#define LUT_C0 0x01 +#define LUT_C1_C0(a) ((a)& (LUT_C1|LUT_C0)) + + +apollo_graphics_15i::bt458::bt458(running_machine &running_machine) +{ + m_machine = &running_machine; +} + +void apollo_graphics_15i::bt458::start() +{ + MLOG1(("start apollo_graphics_15i::bt458")); +} + +void apollo_graphics_15i::bt458::reset() +{ + MLOG1(("reset apollo_graphics_15i::bt458")); + + m_color_counter = 0; + m_red = 0; + m_green = 0; + + m_address_register = 0; + memset(m_color_palette_RAM, 0, sizeof(m_color_palette_RAM)); + memset(m_overlay_color, 0, sizeof(m_overlay_color)); + m_read_mask_register = 0; + m_blink_mask_register = 0; + m_command_register = 0; + m_control_test_register = 0; +} + +void apollo_graphics_15i::bt458::write(UINT8 data, UINT8 c10) +{ + MLOG1(("writing Bt458 data=%02x C1,C0=%d", data, c10)); + switch (c10) + { + case 0: // address register + m_address_register = data; + m_color_counter = 0; + MLOG1(("bt458::write 0: addr=%02x", data)); + break; + case 1: // color palette RAM + switch (m_color_counter) + { + case 0: + m_red = data; + m_color_counter++; + break; + case 1: + m_green = data; + m_color_counter++; + break; + case 2: + m_color_palette_RAM[m_address_register] = (m_red << 16) | (m_green << 8) | data; + m_address_register++; + m_color_counter = 0; + break; + } + break; + case 2: // registers + switch (m_address_register) + { + case 0x04: + m_read_mask_register = data; + MLOG1(("bt458::write: writing Bt458 m_read_mask_register=%02x", data)) + break; + case 0x05: + m_blink_mask_register = data; + MLOG1(("bt458::write: writing Bt458 m_blink_mask_register=%02x", data)) + break; + case 0x06: + m_command_register = data; + MLOG1(("bt458::write: writing Bt458 m_command_register=%02x", data)) + break; + case 0x07: + m_control_test_register = data; + break; + default: + MLOG1(("bt458::write: writing unexpected Bt458 data=%02x C1,C0=%d at %02x", data, c10, m_address_register)) + break; + } + break; + case 3: // overlay color + switch (m_address_register) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + m_overlay_color[m_address_register] = data; + MLOG1(("bt458::write: writing Bt458 m_overlay_color[%d]=%02x",m_address_register, data)); + break; + default: + MLOG1(("bt458::write: writing unexpected Bt458 data=%02x C1,C0=%d at %02x", data, c10, m_address_register)); + break; + } + break; + default: + MLOG1(("bt458::write: writing unexpected Bt458 data=%02x C1,C0=%d", data, c10)) + ; + break; + } +} + +UINT8 apollo_graphics_15i::bt458::read(UINT8 c10) +{ + UINT8 data = 0xff; + + switch (c10) + { + case 0: // address register + data = m_address_register; + break; + case 1: // color palette RAM + switch (m_color_counter) + { + case 0: // red + data = (m_color_palette_RAM[m_address_register] >> 16) & 0xff; + m_color_counter++; + break; + case 1: // Green + data = (m_color_palette_RAM[m_address_register] >> 8) & 0xff; + m_color_counter++; + break; + case 2: // blue + data = m_color_palette_RAM[m_address_register] & 0xff; + m_address_register++; + m_color_counter = 0; + break; + } + break; + case 2: // registers + switch (m_address_register) + { + case 0x04: + data = m_read_mask_register; + MLOG1(("bt458::read: reading Bt458 m_read_mask_register=%02x", data)) + break; + case 0x05: + data = m_blink_mask_register; + MLOG1(("bt458::read: reading Bt458 m_blink_mask_register=%02x", data)) + break; + case 0x06: + data = m_command_register; + MLOG1(("bt458::read: reading Bt458 m_command_register=%02x", data)) + break; + case 0x07: + { + UINT32 rgb = m_color_palette_RAM[0]; + switch (m_control_test_register & 0x0f) + { + case 0x01: data = 0x01 | ((rgb >> 16) & 0xf0); break; + case 0x09: data = 0x09 | ((rgb >> 12) & 0xf0); break; + case 0x02: data = 0x02 | ((rgb >> 8) & 0xf0); break; + case 0x0a: data = 0x0a | ((rgb >> 4) & 0xf0); break; + case 0x04: data = 0x04 | ((rgb >> 0) & 0xf0); break; + case 0x0c: data = 0x0c | ((rgb << 4) & 0xf0); break; + default: data = 0xff; break; + } + } + break; + default: + MLOG1(("bt458::read: reading unexpected Bt458 data=%02x C1,C0=%d at %02x", data, c10, m_address_register)) + break; + } + break; + default: + MLOG1(("bt458::read: reading unexpected Bt458 data=%02x C1,C0=%d at %02x", data, c10, m_address_register)) + break; + } + +// MLOG1(("reading Bt458 data=%02x cs=%d", m_data, c10)); + return data; +} + +UINT32 apollo_graphics_15i::bt458::get_rgb(UINT8 index) +{ + return m_color_palette_RAM[index]; +} + +/*************************************************************************** + Monochrome Controller Registers at 0x5d800 - 0x5dc07 + ***************************************************************************/ + +const char *apollo_graphics_15i::cr_text(offs_t offset, UINT8 data, UINT8 rw) +{ + static const char *cr0[8] = + { "cr0 mode=0 CPU dest BLT", "cr0 mode=1 Alternating BLT", + "cr0 mode=2 Vector mode", "cr0 mode=3 CPU Source BLT", + "cr0 mode=4 Double access BLT ", "cr0 mode=5 ???", + "cr0 mode=6 ???", "cr0 mode=7 Normal" }; + + static const char *cr2[4] = + { "cr2 Constant access", "cr2 Pixel access", "cr2 ???", + "cr2 Plane access" }; + + static const char *cr2b[4] = + { "cr2b Constant access", "cr2b Pixel access", "cr2b ???", + "cr2b Plane access" }; + + switch (offset & 0x407) + { + case 0: + return rw ? "sr" : "we"; + case 1: + return rw ? "id" : "we"; + case 2: + case 3: + return "rop0"; + case 4: + case 5: + return m_n_planes == 8 ? "rop1" : "mem refresh"; + case 6: + case 7: + return m_n_planes == 8 ? "mem refresh" : "???"; + case 0x400: + return cr0[data >> 5]; + case 0x401: + return m_n_planes == 8 ? "LUT data" : "red"; + case 0x402: + return "cr1"; + case 0x403: + return m_n_planes == 8 ? "LUT ctrl" : "green"; + case 0x404: + return m_n_planes == 8 ? "cr2a" : cr2[data >> 6]; + case 0x405: + return m_n_planes == 8 ? cr2b[data >> 6] : "blue"; + case 0x406: + return "cr3"; + case 0x407: + return m_n_planes == 8 ? "cr3b" : "a/d"; + default: + return "???"; + } +} + +void apollo_graphics_15i::log_cr1(const char * text) +{ + MLOG2(("%s: cr0=%02x cr1=%02x sr=%02x pixel_clock=%3d/%3d bl=%d vb=%d vs=%d hs=%d hc=%d vck=%d hck=%d pck=%d vd=%d", + text, + m_cr0, + m_cr1, + m_sr, + m_p_clock, + m_data_clock, + m_sr & SR_BLANK ? 1 : 0, + m_sr & SR_V_BLANK ? 1 : 0, + m_sr & SR_V_SYNC ? 1 : 0, + m_sr & SR_H_SYNC ? 1 : 0, + m_sr & SR_H_CK ? 1 : 0, + m_cr1 & CR1_DV_CK ? 1 : 0, + m_cr1 & CR1_DH_CK ? 1 : 0, + m_cr1 & CR1_DP_CK ? 1 : 0, + m_sr & SR_V_DATA ? 1 : 0)); +} + +void apollo_graphics_15i::increment_h_clock() +{ + MLOG1(("increment_h_clock: sr=%02x m_h_clock=%d", m_sr, m_h_clock)); + + if (m_device_id == SCREEN_DEVICE_ID_19I) + { + // DISP7A.DEX Test 5 + // Note: 108 = 80 + 28 = 1280/16 + 448/16 + switch (m_h_clock %= 108) + { + case 8: // Not blanking + m_sr |= SR_BLANK; + break; + case 88: // blanking + m_sr &= ~SR_BLANK; + break; + case 93: // HSync active + m_sr &= ~SR_H_SYNC; + // DISP7A.DEX.1 Test 6 + increment_v_clock(); + break; + case 104: // HSync inactive + m_sr |= SR_H_SYNC; + break; + } + } + else if (m_n_planes == 1) + { + switch (m_h_clock %= 84) + { + case 1: // HSync inactive + m_sr |= SR_H_SYNC; + break; + case 8: // Not blanking + m_sr |= SR_BLANK; + break; + case 72: // blanking + m_sr &= ~SR_BLANK; + break; + case 77: // HSync active + m_sr &= ~SR_H_SYNC; + // DISP7D.DEX.1 Test 6 + increment_v_clock(); + break; + } + } + else if (m_n_planes == 4) + { + switch (m_h_clock %= 84) + { + case 8: // Not blanking + m_sr |= SR_BLANK; + if (m_sr & SR_V_BLANK) + { + m_sr |= SR_V_FLAG; + } + break; + case 73: // blanking + m_sr &= ~SR_BLANK; + if (m_sr & SR_V_BLANK) + { + m_sr &= ~SR_V_FLAG; + } + break; + } + } + else // m_n_planes == 8 + { + switch (m_h_clock %= 84) + { + case 9: // Not blanking + m_sr |= SR_BLANK; + break; + case 73: // blanking + m_sr &= ~SR_BLANK; + break; + } + } + m_h_clock++; +} + +void apollo_graphics_15i::increment_v_clock() +{ + MLOG1(("increment_v_clock: sr=%02x m_v_clock=%d", m_sr, m_v_clock)); + + if (m_device_id == SCREEN_DEVICE_ID_19I) + { + switch (m_v_clock %= 1066) + { + case 1023: // blanking + m_sr &= ~(SR_V_BLANK | SR_BLANK); + break; + case 1028: // VSync active + m_sr &= ~SR_V_SYNC; + break; + case 1032: // VSync inactive + m_sr |= SR_V_SYNC; + break; + case 1065: // not blanking + m_sr |= (SR_V_BLANK | SR_BLANK); + break; + } + } + else if (m_n_planes == 1) + { + switch (m_v_clock %= 842) + { + case 799: + m_sr &= ~SR_V_BLANK; + break; + case 804: + m_sr &= ~SR_SYNC; + break; + case 808: + m_sr |= SR_SYNC; + break; + case 841: + m_sr |= SR_V_BLANK; + break; + } + } + else if (m_n_planes == 4) + { + // DISP7B.DEX Test 6 and Test 20 + switch (m_v_clock %= 842) + { + case 799: + m_sr &= ~SR_V_BLANK; + m_sr &= ~SR_V_FLAG; + break; + case 803: + m_sr &= ~SR_SYNC; + break; + case 807: + m_sr |= SR_SYNC; + break; + case 836: + m_sr |= SR_V_FLAG; + break; + case 841: + m_sr |= SR_V_BLANK; + break; + } + } + else if (m_n_planes == 8) + { + // DISP7C.DEX Test 50 + switch (m_v_clock %= 842) + { + case 800: + m_sr &= ~SR_V_BLANK; + break; + case 804: + m_sr &= ~SR_SYNC; + break; + case 808: + m_sr |= SR_SYNC; + break; + case 0: + m_sr |= SR_V_BLANK; + break; + } + } + m_v_clock++; + m_p_clock = 0; + m_data_clock = 0; +} + +void apollo_graphics_15i::increment_p_clock() +{ + if (m_n_planes == 1) + { + if ((m_cr1 & CR1_DISP_EN) == 0) + { + m_sr &= ~SR_V_DATA; + } + else + { + int pixel_offset = (m_device_id == SCREEN_DEVICE_ID_19I) ? 10 : 8; + + if (m_p_clock > pixel_offset) + { + // FIXME: ok for DEX Test 5 6 17 19 - nok for 20 + int pixel_addr = m_v_clock * m_width + m_data_clock; + + // FIXME: ok for DEX Test 5 6 17 20 - nok for 19 + // Note: for dn3500_19i DEX Test 17 18 20 will fail !!!! + // Note: must NOT reset m_data_clock in increment_p_clock ! +// int pixel_addr = m_data_clock * 32; + + UINT16 pixel = m_image_memory[pixel_addr / 16] & (0x8000 >> (pixel_addr % 16)); + + pixel = (pixel ? 1 : 0) ^ ((m_cr1 & CR1_INV) ? 0 : 1); + + m_sr = pixel ? (m_sr | SR_V_DATA) : (m_sr & ~SR_V_DATA); + + m_data_clock++; + } + + m_p_clock++; + + // DEX Test 4: Pixel Counter Test + if ((m_p_clock % 8) == 0) + { + m_sr ^= SR_H_CK; + } + } + } + else if (m_n_planes == 4) + { + if ((m_p_clock % 8) == 0 && m_p_clock > 0) + { + m_sr ^= SR_H_CK; + } + m_p_clock++; + } + else // m_n_planes == 8 + { + if ((m_p_clock % 8) == 1 && m_p_clock > 1) + { + m_sr ^= SR_H_CK; + } + m_p_clock++; + } +} + +void apollo_graphics_15i::set_cr1(UINT8 data) +{ + UINT8 diffs = m_cr1 ^ data; + m_cr1 = data; + + UINT8 dp_clock = (diffs & CR1_DP_CK) && (m_cr1 & CR1_DP_CK) == 0; + UINT8 dh_clock = (diffs & CR1_DH_CK) && (m_cr1 & CR1_DH_CK) == 0; + UINT8 dv_clock = m_n_planes == 1 ? 0 : ((diffs & CR1_DV_CK) && (m_cr1 & CR1_DV_CK) == 0); + + if ((m_cr1 & CR1_RESET) == 0) + { + if (diffs & CR1_RESET) + { + MLOG1(("!!! set_cr1: CR1_RESET")); + + m_blt_cycle_count = 0; + m_sr &= ~SR_ALT; + m_image_offset = 0; + memset(m_guard_latch, 0, sizeof(m_guard_latch)); + + m_h_clock = 0; + m_v_clock = 0; + m_p_clock = 0; + m_data_clock = 0; + + if (m_device_id == SCREEN_DEVICE_ID_19I) + { + m_sr = SR_H_CK | SR_V_BLANK | SR_H_SYNC | SR_V_SYNC; + } + else if (m_n_planes == 1) + { + m_sr = SR_V_BLANK | SR_V_SYNC; + } + else + { + m_sr = SR_H_CK | SR_V_BLANK | SR_SYNC | SR_DONE; + } + } + log_cr1("CR1_RESET"); + } + else + { + if ((diffs & CR1_RESET) && (m_cr1 & CR1_RESET) != 0) + { + log_cr1("CR1_RESET"); + } + + if (dh_clock) + { + increment_h_clock(); + log_cr1("CR1_DH_CK"); + } + + if (dv_clock) + { + increment_v_clock(); + log_cr1("CR1_DV_CK"); + } + + if (dp_clock) + { + increment_p_clock(); + log_cr1("CR1_DP_CK"); + } + + if ((m_sr & SR_V_BLANK) == 0) + { + m_sr &= ~SR_BLANK; + } + + if (diffs & CR1_DISP_EN) + { + // update screen + m_update_flag = 1; + } + } +} + +void apollo_graphics_15i::set_cr3a(UINT8 data) +{ + m_cr3a = data; + if ((data & 0x80) == 0) + { + int shift = (data & 0x0f) >> 1; + UINT8 bit_mask = 1 << shift; + if (data & 0x01) + { + set_cr1(m_cr1 | bit_mask); + } + else + { + set_cr1(m_cr1 & ~bit_mask); + } + } +} + +void apollo_graphics_15i::set_cr3b(UINT8 data) +{ + m_cr3b = data; + if ((data & 0x80) == 0) + { + int shift = (data & 0x0f) >> 1; + UINT8 bit_mask = 1 << shift; + if (data & 0x01) + { + set_lut_cr(m_lut_control | bit_mask); + } + else + { + set_lut_cr(m_lut_control & ~bit_mask); + } + } +} + +void apollo_graphics_15i::set_lut_cr(UINT8 data) +{ + UINT8 diffs = m_lut_control ^ data; + m_lut_control = data; + + if ((diffs & LUT_CPAL_CS) && (data & LUT_CPAL_CS) != 0) + { + MLOG1(("writing Color Graphics Controller: LUT_CPAL_CS Disabled")); + while (!m_lut_fifo->is_empty()) + { + m_bt458->write(m_lut_fifo->get(), LUT_C1_C0(m_lut_control)); + } + } + + if ((diffs & LUT_FIFO_RST) && (data & LUT_FIFO_RST) == 0) + { + MLOG1(("writing Color Graphics Controller: LUT_FIFO_RST Active")); + m_lut_fifo->reset(); + m_sr |= SR_LUT_OK; + } + + if ((diffs & LUT_FIFO_CS) && (data & LUT_FIFO_CS) == 0) + { + MLOG1(("writing Color Graphics Controller: LUT_FIFO_CS Enabled")); + } + + if ((diffs & LUT_ST_LUK) && (data & LUT_ST_LUK) == 0) + { + MLOG1(("writing Color Graphics Controller: LUT_ST_LUK Active")); + m_sr &= ~SR_LUT_OK; + } +} + +READ8_MEMBER( apollo_graphics_15i::apollo_mcr_r ) +{ + UINT8 data; + switch (offset & 0x407) + { + case 0: + data = m_sr; + if (m_ad_pending) + { + m_ad_pending = 0; + m_sr &= ~SR_DONE; + } + break; + case 1: + data = m_n_planes == 1 ? m_device_id : 0xff; + break; + case 0x400: + data = m_cr0; + break; + case 0x402: + data = m_cr1; + break; + case 0x404: + data = m_cr2; + break; + case 0x406: + data = m_cr3a; + break; + default: + data = 0xff; + break; + } + + // omit excessive logging + static UINT8 status0 = 0xff; + if ((offset != 1) && (offset != 0 || data != status0)) + { + if (offset == 0) + status0 = data; + MLOG1(("reading Graphics Controller at offset %03x = %02x (%s)", offset, data, cr_text(offset, data, 1))); + } + + return data; +} + +WRITE8_MEMBER( apollo_graphics_15i::apollo_mcr_w ) +{ + MLOG1(("writing Graphics Controller at offset %03x = %02x (%s)", offset, data, cr_text(offset, data, 0))); + switch (offset & 0x407) + { + case 0: + m_write_enable_register = set_lsb0(m_write_enable_register, data); + break; + case 1: + m_write_enable_register = set_msb0(m_write_enable_register, data); + // FIXME: seems to be necessary for dex + m_blt_cycle_count = 0; + m_sr &= ~SR_ALT; + break; + case 2: + m_rop_register = set_lsb0(m_rop_register, data); + break; + case 3: + m_rop_register = set_msb0(m_rop_register, data); + set_status_rmw(); + break; + case 4: + case 5: + // trigger memory refresh in diagnostic mode + m_diag_mem_request = data; + break; + case 0x400: + m_cr0 = data; + break; + case 0x402: + set_cr1(data); + break; + case 0x404: + m_cr2 = data; + m_cr2_s_data = CR2_S_DATA(data); + m_cr2_s_plane = 0x00; + m_cr2_d_plane = 0x0e; + // for DISP7B.DEX Test 16 + m_sr |= SR_R_M_W; + break; + case 0x406: + set_cr3a(data); + break; + case 0x407: // A/D Channel Register + m_ad_pending = 1; + m_sr |= SR_DONE; + break; + } +} + +void apollo_graphics_15i::set_status_rmw() +{ + UINT8 plane, d_plane_bit; + UINT32 rop_reg; + + m_sr &= ~SR_R_M_W; + rop_reg = m_rop_register; + d_plane_bit = 0x01; + for (plane = 0; plane < m_n_planes; plane++) + { + if ((m_cr2_d_plane & d_plane_bit) == 0) + { + switch (rop_reg & 0x0f) + { + case 0: // zero + case 3: // Source + case 0x0c: // ~Source + case 0x0f: // one + break; + default: + m_sr |= SR_R_M_W; + break; + } + } + rop_reg >>= 4; + d_plane_bit <<= 1; + } +} + +UINT16 apollo_graphics_15i::rop(UINT16 dest_data, UINT16 src_data, UINT8 plane) +{ + UINT16 src_data1 = src_data; + if (m_cr1 & CR1_ROP_EN) + { + switch ((m_rop_register >> (plane * 4)) & 0x0f) + { + case 0: // zero + src_data = 0; + break; + case 1: // Source AND Destination + src_data = src_data & dest_data; + break; + case 2: // Source AND ~Destination + src_data = src_data & (~dest_data); + break; + case 3: // Source + break; + case 4: // ~Source AND Destination + src_data = (~src_data) & dest_data; + break; + case 5: // Destination + src_data = dest_data; + break; + case 6: // Source XOR Destination + src_data = src_data ^ dest_data; + break; + case 7: // Source OR Destination + src_data = src_data | dest_data; + break; + case 8: // Source NOR Destination + src_data = ~(src_data | dest_data); + break; + case 9: // Source XNOR Destination + src_data = ~(src_data ^ dest_data); + break; + case 0x0a: // ~Destination + src_data = ~dest_data; + break; + case 0x0b: // Source OR ~Destination + src_data = src_data | (~dest_data); + break; + case 0x0c: // ~Source + src_data = ~src_data; + break; + case 0x0d: // ~Source OR Destination + src_data = (~src_data) | dest_data; + break; + case 0x0e: // Source NAND Destination + src_data = ~(src_data & dest_data); + break; + case 0x0f: // One + src_data = 0xffff; + break; + } + } + MLOG2(("rop: cr0=%02x cr1=%02x cr2=%02x rop_register=%08x dest=%04x src=%04x plane=%d s_plane=%d ->%04x", m_cr0, m_cr1, m_cr2, m_rop_register,dest_data, src_data1, plane, m_cr2_s_plane, src_data )) + return src_data; +} + +void apollo_graphics_15i::set_source_data(UINT32 offset) +{ + if (m_n_planes == 1 || (m_cr1 & CR1_AD_BIT)) + { + offset += m_image_plane_size * m_cr2_s_plane; + m_guard_latch[m_cr2_s_plane] <<= 16; + m_guard_latch[m_cr2_s_plane] |= m_image_memory[offset]; + } + else + { + UINT8 plane; + for (plane = 0; plane < m_n_planes; plane++) + { + m_guard_latch[plane] <<= 16; + m_guard_latch[plane] |= m_image_memory[offset]; + offset += m_image_plane_size; + } + } +} + +UINT32 apollo_graphics_15i::get_source_data(UINT8 plane) +{ + UINT32 src_data; + + if (m_n_planes == 1 || (m_cr1 & CR1_AD_BIT)) + { + src_data = m_guard_latch[m_cr2_s_plane]; + } + else + { + src_data = m_guard_latch[plane]; + } + + switch (m_cr2_s_data) + { + case CR2_CONST_ACCESS: // 0x00 + // set source to all ones (used for vectors) + src_data = 0xffff; + break; + case CR2_PIXEL_ACCESS: // 0x01 + // replicate 4 LSB of data bus + src_data = src_data & (1 << plane) ? 0xffff : 0; + break; + case CR2_SHIFT_ACCESS: // 0x02 + // replicate LSB of shifter + src_data = src_data & 1 ? 0xffff : 0; + break; + case CR2_PLANE_ACCESS: // 0x03 + // use source data unchanged (normal use) + if (CR0_SHIFT(m_cr0) >= 16) + { + src_data = (src_data << 16) | (src_data >> 16); + } + src_data >>= (CR0_SHIFT(m_cr0) & 0x0f); + break; + } + return src_data; +} + +void apollo_graphics_15i::blt(UINT32 dest_addr, UINT16 mem_mask) +{ + UINT16 src_data, dest_data; + UINT8 d_plane_bit; + UINT8 plane; + + d_plane_bit = 0x01; + for (plane = 0; plane < m_n_planes; plane++) + { + if ((m_cr2_d_plane & d_plane_bit) == 0) + { + dest_data = m_image_memory[dest_addr]; + src_data = get_source_data(plane); + src_data = rop(dest_data, src_data, plane); + src_data &= ~(m_write_enable_register | ~mem_mask); + dest_data &= (m_write_enable_register | ~mem_mask); + m_image_memory[dest_addr] = dest_data | src_data; + } + dest_addr += m_image_plane_size; + d_plane_bit <<= 1; + } +} + +/*************************************************************************** + Monochrome graphics memory space at FA0000 - FDFFFF + Color graphics memory space at A0000 - BFFFF + ***************************************************************************/ + +READ16_MEMBER( apollo_graphics_15i::apollo_mem_r ) +{ + UINT16 data; + UINT32 src_addr; + + if (offset >= m_image_memory_size) + { + // 128 kB display buffer of 15" screen seems to be shadowed from $fa0000 to $fc0000 + MLOG1(("reading Graphics Memory at invalid offset %05x", offset)); + offset %= m_image_memory_size; + } + + src_addr = offset + m_image_plane_size * m_cr2_s_plane; + + switch (CR0_MODE(m_cr0)) + { + case CR0_MODE_VECTOR: // vector or fill mode + case CR0_MODE_3: // CPU source BLT: read internal data bus + data = m_guard_latch[m_cr2_s_plane]; + break; + + default: + set_source_data(offset); + data = m_image_memory[src_addr]; + break; + } + + // omit excessive logging + if ((offset & (m_image_plane_size - 1)) < 8) + { + MLOG1(("reading Graphics Memory with mode %d: src_addr %05x = %04x & %04x", CR0_MODE(m_cr0), src_addr, data, mem_mask)); + } + else if ((offset & (m_image_plane_size - 1)) == 8) + { + MLOG1(("...")); + } + return data; +} + +WRITE16_MEMBER( apollo_graphics_15i::apollo_mem_w ) +{ + UINT32 dest_addr; + UINT32 src_addr; + + if (offset >= m_image_memory_size) + { + // 128 kB display buffer of 15" screen seems to be shadowed from $fa0000 to $fc0000 + MLOG1(("writing Graphics Memory at invalid offset %05x = %04x & %04x ", offset, data, mem_mask)); + offset %= m_image_memory_size; + } + + // omit excessive logging + if (offset < 24) + { + MLOG1(("writing Graphics Memory with mode %d: offset=%04x data=%04x mask=%04x", CR0_MODE(m_cr0), offset, data, mem_mask)); + } + else if (offset == 24) + { + MLOG1(("...")); + } + + switch (CR0_MODE(m_cr0)) + { + case CR0_MODE_0: + // CPU destination BLT + // 1. bus write to provide display memory address + // 2. bus read to get data + src_addr = offset + m_image_plane_size * m_cr2_s_plane; + m_guard_latch[m_cr2_s_plane] <<= 16; + m_guard_latch[m_cr2_s_plane] |= m_image_memory[src_addr]; + break; + + case CR0_MODE_1: + // Alternating BLT + // alternating bus writes provide src/dest address + // second write provides Write-enables + if (++m_blt_cycle_count == 1) + { + m_sr |= SR_ALT; + set_source_data(offset); + } + else + { + m_blt_cycle_count = 0; + m_sr &= ~SR_ALT; + m_write_enable_register = data; + blt(offset, mem_mask); + } + break; + + case CR0_MODE_VECTOR: + // Vector or fill mode + // write provides Write-enables and address + m_write_enable_register = data; + blt(offset, mem_mask); + break; + + case CR0_MODE_3: + // CPU source BLT + // 1. bus write to provide src data + // 2. bus write to provide Write-enables and address + if (++m_blt_cycle_count == 1) + { + m_sr |= SR_ALT; + + // strange: must fix byte access for /systest/grtest on sr10.2 + if (mem_mask == 0xff00) + { + data >>= 8; + mem_mask >>= 8; + } + + m_guard_latch[m_cr2_s_plane] <<= 16; + m_guard_latch[m_cr2_s_plane] |= (data & mem_mask); + } + else + { + m_blt_cycle_count = 0; + m_sr &= ~SR_ALT; + + m_write_enable_register = data; + blt(offset, mem_mask); + } + break; + + case CR0_MODE_BLT: + // Double access BLT + // bus write to provide src addr on address lines + // dest addr on data lines (16-bit WORD Offset) + + set_source_data(offset); + dest_addr = (data & mem_mask); + if (m_device_id == SCREEN_DEVICE_ID_19I && (m_cr1 & CR1_DADDR_16)) + { + dest_addr += 0x10000; + } + blt(dest_addr, 0xffff); + break; + + case CR0_MODE_NORMAL: + m_guard_latch[m_cr2_s_plane] <<= 16; + m_guard_latch[m_cr2_s_plane] |= (data & mem_mask); + blt(offset, mem_mask); + break; + + default: + MLOG(("writing Graphics Memory - unexpected cr0 mode %d", CR0_MODE(m_cr0))) + ; + break; + } + m_update_flag = 1; +} + +/*************************************************************************** + Color Screen + ***************************************************************************/ + +READ8_MEMBER( apollo_graphics_15i::apollo_ccr_r ) +{ + UINT8 data; + + if (m_n_planes == 4) + { + switch (offset & 0x407) + { + case 1: + data = m_n_planes == 4 ? m_device_id : 0xff; + break; + case 0x407: + data = m_ad_result; + break; + default: + return apollo_mcr_r(space, offset, mem_mask); + } + } + else if (m_n_planes == 8) + { + switch (offset & 0x407) + { + case 1: + data = m_n_planes == 8 ? m_device_id : 0xff; + break; + case 4: + data = get_lsb1(m_rop_register); + break; + case 5: + data = get_msb1(m_rop_register); + break; + + case 0x401: + // LUT data register + if ((m_lut_control & LUT_FIFO_CS) == 0) + { + data = m_lut_fifo->get(); + } + else if ((m_lut_control & LUT_R_W) == 0) + { + MLOG1(("apollo_graphics_15i::apollo_ccr_r: reading LUT data register with unexpected RW = 0 in LUT Control register")); + data = m_lut_data; + } + else if ((m_lut_control & LUT_AD_CS) == 0) + { + data = m_ad_result; + } + else if ((m_lut_control & LUT_CPAL_CS) == 0) + { + data = m_bt458->read(LUT_C1_C0(m_lut_control)); + } + else + { + MLOG1(("apollo_graphics_15i::apollo_ccr_r: reading LUT data register with unexpected CS in LUT Control register")); + data = m_lut_data; + } + break; + case 0x403: + // LUT control register + data = m_lut_control; + break; + case 0x404: + // cr2a + data = m_cr2; + break; + case 0x405: + // cr2b + data = m_cr2b; + break; + case 0x407: + // cr3b + data = m_cr3b; + break; + default: + return apollo_mcr_r(space, offset, mem_mask); + } + } + else + { + data = 0xff; + } + + // omit excessive logging + static UINT8 status1 = 0xff; + if ((offset != 1) && (offset != 0 || data != status1)) + { + if (offset == 0) + status1 = data; + MLOG1(("reading Color Graphics Controller at offset %03x = %02x (%s)", offset, data, cr_text(offset, data, 1))); + } + + return data; +} + +UINT8 apollo_graphics_15i::get_pixel(UINT32 offset, UINT16 mask) +{ + UINT8 data = 0; + UINT16 *source_ptr = m_image_memory + offset; + + if (m_n_planes == 4) + { + UINT16 data0 = source_ptr[0]; + UINT16 data1 = source_ptr[m_image_plane_size]; + UINT16 data2 = source_ptr[m_image_plane_size * 2]; + UINT16 data3 = source_ptr[m_image_plane_size * 3]; + + data = (data0 & mask) ? 1 : 0; + data |= (data1 & mask) ? 2 : 0; + data |= (data2 & mask) ? 4 : 0; + data |= (data3 & mask) ? 8 : 0; + } + else if (m_n_planes == 8) + { + UINT16 data0 = source_ptr[0]; + UINT16 data1 = source_ptr[m_image_plane_size]; + UINT16 data2 = source_ptr[m_image_plane_size * 2]; + UINT16 data3 = source_ptr[m_image_plane_size * 3]; + UINT16 data4 = source_ptr[m_image_plane_size * 4]; + UINT16 data5 = source_ptr[m_image_plane_size * 5]; + UINT16 data6 = source_ptr[m_image_plane_size * 6]; + UINT16 data7 = source_ptr[m_image_plane_size * 7]; + + data = (data0 & mask) ? 1 : 0; + data |= (data1 & mask) ? 2 : 0; + data |= (data2 & mask) ? 4 : 0; + data |= (data3 & mask) ? 8 : 0; + data |= (data4 & mask) ? 0x10 : 0; + data |= (data5 & mask) ? 0x20 : 0; + data |= (data6 & mask) ? 0x40 : 0; + data |= (data7 & mask) ? 0x80 : 0; + } + + return data; +} + +// read the 4-plane ADC value for data + +UINT8 apollo_graphics_15i::c4p_read_adc(UINT8 data) +{ + UINT8 value = 0; + + if ((data & 0x0c) == 0x04) + { + UINT8 red, green, blue; + UINT8 pixel = get_pixel((m_v_clock * m_buffer_width / 16) + m_h_clock, + 0x8000); + UINT32 rgb = m_color_lookup_table[pixel]; + + if ((m_sr & SR_BLANK) != 0) + { + // not blanking + red = 30 + ((rgb >> 16) & 0xff) / 4; + green = 60 + ((rgb >> 8) & 0xff) / 4; + blue = 30 + (rgb & 0xff) / 4; + } + else if (m_h_clock > 2) + { + // blanking + red = 20; + green = 50; + blue = 20; + } + else + { + // sync + red = 20; + green = 10; + blue = 20; + } + + switch (data & 3) + { + case 0: // Red + value = red; + break; + case 1: // Green + value = green; + break; + case 2: // Blue + value = blue; + break; + default: // unused + value = 0; + break; + } + } + return value; +} + +// read the 8-plane ADC value for data + +UINT8 apollo_graphics_15i::c8p_read_adc(UINT8 data) +{ + UINT8 value = 0; + + if ((data & 0x0c) == 0x04) + { + UINT8 red, green, blue; + UINT8 pixel = get_pixel((m_v_clock * m_buffer_width / 16) + m_h_clock, 0x8000); + UINT32 rgb = m_bt458->get_rgb(pixel); + + if ((m_sr & SR_BLANK) != 0) + { + // not blanking + red = 10 + ((rgb >> 16) & 0xff) / 2; + green = 70 + ((rgb >> 8) & 0xff) / 2; + blue = 10 + (rgb & 0xff) / 2; + } + else if (m_h_clock < 20) + { + // blanking + red = 5; + green = 60; + blue = 5; + } + else + { + // sync + red = 5; + green = 5; + blue = 5; + } + + switch (data & 3) + { + case 0: // Red + value = red; + break; + case 1: // Green + value = green; + break; + case 2: // Blue + value = blue; + break; + default: // unused + value = 0; + break; + } + } + return value; +} + +WRITE8_MEMBER( apollo_graphics_15i::apollo_ccr_w ) +{ + static const UINT8 rgb_value[16] = + { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, + 0xcc, 0xdd, 0xee, 0xff }; + + if (m_n_planes == 4) + { + switch (offset & 0x407) + { + case 0x401: + // red lookup table register + m_color_lookup_table[data >> 4] &= 0xff00ffff; + m_color_lookup_table[data >> 4] |= rgb_value[data & 0x0f] << 16; + break; + case 0x403: + // green lookup table register + m_color_lookup_table[data >> 4] &= 0xffff00ff; + m_color_lookup_table[data >> 4] |= rgb_value[data & 0x0f] << 8; + break; + case 0x404: + // cr2 + m_cr2 = data; + m_cr2_s_data = CR2_S_DATA(data); + m_cr2_s_plane = CR2_S_PLANE(data); + m_cr2_d_plane = CR2_D_PLANE(data); + // for DISP7B.DEX Test 16 + m_sr |= SR_R_M_W; + break; + case 0x405: + // blue lookup table register + m_color_lookup_table[data >> 4] &= 0xffffff00; + m_color_lookup_table[data >> 4] |= rgb_value[data & 0x0f]; + break; + case 0x407: + // A/D channel register + m_ad_result = c4p_read_adc(data); + m_ad_pending = 1; + m_sr |= SR_DONE; + break; + default: + apollo_mcr_w(space, offset, data, mem_mask); + return; + } + } + else if (m_n_planes == 8) + { + switch (offset & 0x407) + { + case 2: + m_rop_register = set_lsb0(m_rop_register, data); + break; + case 3: + m_rop_register = set_msb0(m_rop_register, data); + set_status_rmw(); + break; + case 4: + m_rop_register = set_lsb1(m_rop_register, data); + break; + case 5: + m_rop_register = set_msb1(m_rop_register, data); + set_status_rmw(); + break; + case 6: + case 7: + // trigger memory refresh in diagnostic mode + m_diag_mem_request = data; + break; + case 0x401: + // LUT data register + m_lut_data = data; + if ((m_lut_control & LUT_R_W) == 1) + { + MLOG1(("apollo_graphics_15i::apollo_ccr_w: writing LUT data register with RW = 1 in LUT Control register")); + } + else if ((m_lut_control & LUT_AD_CS) == 0) + { + m_ad_result = c8p_read_adc(data); + m_ad_pending = 1; + m_sr |= SR_DONE; + } + else if ((m_lut_control & LUT_CPAL_CS) == 0) + { + m_bt458->write(data, LUT_C1_C0(m_lut_control)); + } + else if ((m_lut_control & LUT_FIFO_CS) == 0) + { + m_lut_fifo->put(data); + } + else + { + MLOG1(("apollo_graphics_15i::apollo_ccr_w: writing LUT data register with unexpected CS in LUT Control register")); + } + break; + case 0x403: + // LUT control register + set_lut_cr(data); + break; + case 0x404: + // cr2a + m_cr2 = data; + m_cr2_d_plane = CR2A_D_PLANE(data); + m_sr |= SR_R_M_W; + break; + case 0x405: + // cr2b + m_cr2b = data; + m_cr2_s_data = CR2_S_DATA(data); + m_cr2_s_plane = CR2B_S_PLANE(data); + break; + case 0x407: + // cr3b + set_cr3b(data); + break; + default: + apollo_mcr_w(space, offset, data, mem_mask); + return; + } + } + + MLOG1(("writing Color Graphics Controller at offset %03x = %02x (%s)", offset, data, cr_text(offset, data, 0))); +} + +READ16_MEMBER( apollo_graphics_15i::apollo_cgm_r ) +{ + if (!is_mono()) + { + return apollo_mem_r(space, offset, mem_mask); + } + else + { + return 0xffff; + } +} + +WRITE16_MEMBER( apollo_graphics_15i::apollo_cgm_w ) +{ + if (!is_mono()) + { + apollo_mem_w(space, offset, data, mem_mask); + } +} + +/*************************************************************************** + VIDEO HARDWARE + ***************************************************************************/ + +UINT32 apollo_graphics_15i::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int has_changed = 0; + + if (m_update_flag && !m_update_pending) + { + has_changed = 1; + m_update_flag = 0; + m_update_pending = 1; + screen_update1(bitmap, cliprect); + m_update_pending = 0; + } + return has_changed ? 0 : UPDATE_HAS_NOT_CHANGED; +} + +void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT16 *source_ptr = m_image_memory; + int x, y; + UINT16 data, mask; + UINT16 inverse = (m_cr1 & CR1_INV) ? 0xffff : 0; + + MLOG1(("screen_update1: size=%0x rowpixels=%d", m_image_memory_size, bitmap.rowpixels())); + + if ((m_cr1 & CR1_DISP_EN) == 0) + { + // display is disabled + for (y = 0; y < m_height; y++) + { + int dest = 0; + for (x = 0; x < m_width; x += 16) + { + for (mask = 0x8000; mask; mask >>= 1) + { + bitmap.pix32(y, dest++) = 0; + } + } + source_ptr += (m_buffer_width - m_width) / 16; + } + } + else if (m_n_planes == 4) + { + for (y = 0; y < m_height; y++) + { + int dest = 0; + for (x = 0; x < m_width; x += 16) + { + UINT16 data0 = source_ptr[0]; + UINT16 data1 = source_ptr[m_image_plane_size]; + UINT16 data2 = source_ptr[m_image_plane_size * 2]; + UINT16 data3 = source_ptr[m_image_plane_size * 3]; + source_ptr++; + for (mask = 0x8000; mask; mask >>= 1) + { + data = (data0 & mask) ? 1 : 0; + data |= (data1 & mask) ? 2 : 0; + data |= (data2 & mask) ? 4 : 0; + data |= (data3 & mask) ? 8 : 0; + bitmap.pix32(y, dest++) = m_color_lookup_table[data]; + } + } + source_ptr += (m_buffer_width - m_width) / 16; + } + } + else if (m_n_planes == 8) + { + for (y = 0; y < m_height; y++) + { + int dest = 0; + for (x = 0; x < m_width; x += 16) + { + UINT16 data0 = source_ptr[0]; + UINT16 data1 = source_ptr[m_image_plane_size]; + UINT16 data2 = source_ptr[m_image_plane_size * 2]; + UINT16 data3 = source_ptr[m_image_plane_size * 3]; + UINT16 data4 = source_ptr[m_image_plane_size * 4]; + UINT16 data5 = source_ptr[m_image_plane_size * 5]; + UINT16 data6 = source_ptr[m_image_plane_size * 6]; + UINT16 data7 = source_ptr[m_image_plane_size * 7]; + source_ptr++; + for (mask = 0x8000; mask; mask >>= 1) + { + data = (data0 & mask) ? 1 : 0; + data |= (data1 & mask) ? 2 : 0; + data |= (data2 & mask) ? 4 : 0; + data |= (data3 & mask) ? 8 : 0; + data |= (data4 & mask) ? 0x10 : 0; + data |= (data5 & mask) ? 0x20 : 0; + data |= (data6 & mask) ? 0x40 : 0; + data |= (data7 & mask) ? 0x80 : 0; + bitmap.pix32(y, dest++) = m_bt458->get_rgb(data); + } + } + source_ptr += (m_buffer_width - m_width) / 16; + } + } + else // m_n_planes == 1 + { + for (y = 0; y < m_height; y++) + { + int dest = 0; + for (x = 0; x < m_width; x += 16) + { + data = *source_ptr++ ^ inverse; + for (mask = 0x8000; mask; mask >>= 1) + { + bitmap.pix32(y, dest++) = data & mask ? 0 : 0x00ffffff; + } + } + source_ptr += (m_buffer_width - m_width) / 16; + } + } +} + +/*------------------------------------------------- + vblank_state_changed - + called on each state change of the VBLANK signal + -------------------------------------------------*/ + +void apollo_graphics_15i::vblank_state_changed(screen_device &screen, bool vblank_state) +{ + if ((m_cr1 & CR1_RESET) && (m_cr1 & CR1_SYNC_EN)) + { + if (vblank_state) + { + m_sr &= ~(SR_V_BLANK | SR_BLANK); + if (m_n_planes == 1) + { + // faking V_DATA for disp.dex test 16 + if (m_image_memory[0]) + { + m_sr |= SR_V_DATA; + } + } + else if (m_n_planes == 4) + { + m_sr &= ~SR_V_FLAG; + } + } + else + { + m_sr |= (SR_V_BLANK | SR_BLANK); + if (m_n_planes == 1) + { + m_sr &= ~SR_V_DATA; + } + else if (m_n_planes == 4) + { + m_sr |= SR_V_FLAG; + } + } + } +} + +void apollo_graphics_15i::register_vblank_callback() +{ + MLOG1(("register_vblank_callback")); + + /* register for VBLANK callbacks */ + screen_device *screen = (screen_device *)machine().device(VIDEO_SCREEN_TAG); + screen->register_vblank_callback(vblank_state_delegate(FUNC(apollo_graphics_15i::vblank_state_changed),this)); +} + + +/*************************************************************************** + MACHINE DRIVERS + ***************************************************************************/ + +MACHINE_CONFIG_FRAGMENT( apollo_graphics ) + MCFG_DEFAULT_LAYOUT( layout_apollo_15i ) + MCFG_SCREEN_ADD(VIDEO_SCREEN_TAG, RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) + MCFG_SCREEN_REFRESH_RATE(76) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(657)) + MCFG_SCREEN_SIZE(1024, 800) + MCFG_SCREEN_VISIBLE_AREA(0, 1023, 0, 799) + MCFG_SCREEN_UPDATE_DEVICE(APOLLO_SCREEN_TAG, apollo_graphics_15i, screen_update) +MACHINE_CONFIG_END + +const device_type APOLLO_GRAPHICS = &device_creator ; + +apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig,const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, APOLLO_GRAPHICS, "Apollo Screen", tag, owner, clock,"apollo_graphics_15i", __FILE__), + m_lut_fifo(NULL), + m_bt458(NULL) +{ +} + +apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig,const char *tag, device_t *owner, UINT32 clock, device_type type,const char *name, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + m_lut_fifo(NULL), + m_bt458(NULL) +{ +} + +apollo_graphics_15i::~apollo_graphics_15i() +{ + if (m_lut_fifo) global_free(m_lut_fifo); + if (m_bt458) global_free(m_bt458); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void apollo_graphics_15i::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apollo_graphics_15i::device_start() +{ + MLOG1(("apollo_graphics_15i::device_start")) + + m_n_planes = 0; + m_width = 0; + m_height = 0; + m_buffer_width = 0; + m_buffer_height = 0; + + m_sr = 0; + m_device_id = 0; + m_write_enable_register = 0; + m_rop_register = 0; + m_diag_mem_request = 0; + m_cr0 = 0; + m_cr1 = 0; + m_cr2 = 0; + m_cr2b = 0; + m_cr2_s_data = 0; + m_cr2_s_plane = 0x00; + m_cr2_d_plane = 0x0e; + m_cr3a = 0; + m_cr3b = 0; + m_ad_result = 0; + m_ad_pending = 0; + + m_lut_control = 0; + m_lut_data = 0; + + m_update_flag = 0; + m_update_pending = 0; + + m_blt_cycle_count = 0; + m_image_offset = 0; + memset(m_guard_latch, 0, sizeof(m_guard_latch)); + + m_h_clock = 0; + m_v_clock = 0; + m_p_clock = 0; + m_data_clock = 0; + + m_image_memory = 0; + m_image_plane_size = 0; + m_image_memory_size = 0; + + memset(m_color_lookup_table, 0, sizeof(m_color_lookup_table)); + + m_lut_fifo = NULL; + m_bt458 = NULL; +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apollo_graphics_15i::device_reset() +{ + MLOG1(("apollo_graphics_15i::device_reset")); + + if (m_n_planes == 0) + { + if (apollo_config(APOLLO_CONF_MONO_19I)) + { + // monochrome 1280x1024 + m_n_planes = 1; + m_device_id = SCREEN_DEVICE_ID_19I; + m_width = 1280; + m_height = 1024; + m_buffer_width = 2048; + m_buffer_height = 1024; + } + else if (apollo_config(APOLLO_CONF_MONO_15I)) + { + // monochrome 1024x800 + m_n_planes = 1; + m_device_id = SCREEN_DEVICE_ID_15I; + m_width = 1024; + m_height = 800; + m_buffer_width = 1024; + m_buffer_height = 1024; + } + else if (apollo_config(APOLLO_CONF_4_PLANES)) + { + // 4-planes color 1024x800 + m_n_planes = 4; + m_device_id = SCREEN_DEVICE_ID_C4P; + m_width = 1024; + m_height = 800; + m_buffer_width = 1024; + m_buffer_height = 1024; + } + else + { + // 8-planes color 1024x800 + m_n_planes = 8; + m_device_id = SCREEN_DEVICE_ID_C8P; + m_width = 1024; + m_height = 800; + m_buffer_width = 1024; + m_buffer_height = 1024; + + if (m_lut_fifo) global_free(m_lut_fifo); + if (m_bt458) global_free(m_bt458); + + m_lut_fifo = global_alloc(lut_fifo); + + m_bt458 = global_alloc(bt458(machine())); + m_bt458->start(); + m_bt458->reset(); + } + } + + if (m_image_memory == NULL) + { + /* allocate the memory image */ + m_image_plane_size = m_buffer_height * m_buffer_width / 16; + m_image_memory_size = m_image_plane_size * m_n_planes; + m_image_memory + = auto_alloc_array(machine(), UINT16, m_image_memory_size); + assert(m_image_memory != NULL); + + MLOG1(("device reset apollo graphics: buffer=%p size=%0x", (void *) m_image_memory, m_image_memory_size)); + } + + memset(m_color_lookup_table, 0, sizeof(m_color_lookup_table)); + memset(m_image_memory, 0, m_image_memory_size * 2); + + // register_vblank_callback(this); + + /* FIXME: register for VBLANK callbacks */ + register_vblank_callback(); +} + +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( apollo_mono19i ) + MCFG_DEFAULT_LAYOUT( layout_apollo ) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_SCREEN_ADD(VIDEO_SCREEN_TAG, RASTER) + MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) + MCFG_SCREEN_REFRESH_RATE(64) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(616)) + MCFG_SCREEN_SIZE(1280, 1024) + MCFG_SCREEN_VISIBLE_AREA(0, 1279, 0, 1023) + MCFG_SCREEN_UPDATE_DEVICE(APOLLO_SCREEN_TAG, apollo_graphics_19i, screen_update) + MACHINE_CONFIG_END + +const device_type APOLLO_MONO19I = &device_creator ; + +apollo_graphics_19i::apollo_graphics_19i(const machine_config &mconfig, + const char *tag, device_t *owner, UINT32 clock) : + apollo_graphics_15i(mconfig, tag, owner, clock, APOLLO_MONO19I, + "Apollo 19\" Monochrome Screen", "apollo_graphics_19i", __FILE__) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void apollo_graphics_19i::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apollo_graphics_19i::device_start() +{ + MLOG1(("apollo_graphics_19i::device_start")); + + apollo_graphics_15i::device_start(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apollo_graphics_19i::device_reset() +{ + MLOG1(("apollo_graphics_19i::device_reset")); + + if (m_n_planes == 0) + { + // monochrome 1280x1024 + m_n_planes = 1; + m_device_id = SCREEN_DEVICE_ID_19I; + m_width = 1280; + m_height = 1024; + m_buffer_width = 2048; + m_buffer_height = 1024; + } + + apollo_graphics_15i::device_reset(); + + /* FIXME: register for VBLANK callbacks */ + register_vblank_callback(); +} + + +READ16_MEMBER( apollo_graphics_15i::apollo_mgm_r ) +{ + if (is_mono()) + { + return apollo_mem_r(space, offset, mem_mask); + } + else + { + return 0xffff; + } +} + +WRITE16_MEMBER( apollo_graphics_15i::apollo_mgm_w ) +{ + if (is_mono()) + { + apollo_mem_w(space, offset, data, mem_mask); + } +} diff --git a/src/mame/video/apple1.c b/src/mame/video/apple1.c new file mode 100644 index 00000000000..f6485dc7ee5 --- /dev/null +++ b/src/mame/video/apple1.c @@ -0,0 +1,392 @@ +// license:??? +// copyright-holders:Paul Daniels, Colin Howell, R. Belmont +/*************************************************************************** + + apple1.c + + Functions to emulate the video hardware of the Apple I. + + The Apple I video hardware was basically a dumb video terminal; in + fact it was based on Steve Wozniak's own design for a simple video + terminal. It had 40 columns by 24 lines of uppercase-only text. + Text could only be output at 60 characters per second, one character + per video frame. The cursor (a blinking @) could only be advanced + using spaces or carriage returns. Carriage returns were the only + control characters recognized. Previously written text could not be + altered, only scrolled off the top of the screen. + + The video memory used seven 1k-bit dynamic shift registers. Six of + these held the 6-bit visible character codes, and one stored the + cursor location as a simple bitmap--the bit for the cursor position + was set to 0, and all the other bits were 1. + + These shift registers were continuously recirculated, completing one + cycle per video frame. As a new line of characters was about to be + scanned by the video beam, that character line would be recirculated + into the shift registers and would simultaneously be stored into a + 6x40-bit line buffer (also a shift register). At this point, if the + cursor location was in this line, a new character could be written + into that location in the shift registers and the cursor could be + advanced. (Carriage returns were not written into the shift + registers; they only advanced the cursor.) + + The characters in the line buffer were recirculated 7 times to + display the 8 scan lines of the characters, before being replaced by + a new line of characters from the main shift registers. + + Cursor blinking was performed by a Signetics 555 timer IC whose + output was gated into the character code signals as they passed into + the line buffer. + + Character images were provided by a Signetics 2513 character + generator ROM, a chip also used in computer terminals such as the + ADM-3A. This ROM had 9 address lines and 5 data lines; it contained + 64 character images, each 5 pixels wide by 8 pixels high, with one + line of pixels being blank for vertical separation. The video + circuitry added the 2 pixels of horizontal separation for each + character. + + A special CLEAR SCREEN switch on the keyboard, directly connected to + the video hardware, could be used to clear the video memory and + return the cursor to the home position. This was completely + independent of the processor. + + A schematic of the Apple I video hardware can be found in the + Apple-1 Operation Manual; look for the schematic titled "Terminal + Section". Most of the functionality modeled here was determined by + reading this schematic. Many of the chips used were standard 74xx + TTL chips, but the shift registers used for the video memory and + line buffer were Signetics 25xx PMOS ICs. These were already + becoming obsolete when the Apple I was built, and detailed + information on them is very hard to find today. + +***************************************************************************/ + +#include "emu.h" +#include "includes/apple1.h" + + +/*************************************************************************** + + Terminal code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(apple1_state::terminal_gettileinfo) +{ + int ch, gfxfont, code, color; + + ch = m_current_terminal->mem[tile_index]; + code = ch & ((1 << m_current_terminal->char_bits) - 1); + color = ch >> m_current_terminal->char_bits; + gfxfont = m_current_terminal->gfx; + + if ((tile_index == m_current_terminal->cur_offset) && !m_current_terminal->cur_hidden && m_current_terminal->getcursorcode) + code = m_current_terminal->getcursorcode(code); + + SET_TILE_INFO_MEMBER(gfxfont, /* gfx */ + code, /* character */ + color, /* color */ + 0); /* flags */ +} + +void apple1_state::terminal_draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal) +{ + m_current_terminal = terminal; + terminal->tm->draw(screen, dest, cliprect, 0, 0); + m_current_terminal = NULL; +} + +void apple1_state::verify_coords(terminal_t *terminal, int x, int y) +{ + assert(x >= 0); + assert(y >= 0); + assert(x < terminal->num_cols); + assert(y < terminal->num_rows); +} + +void apple1_state::terminal_putchar(terminal_t *terminal, int x, int y, int ch) +{ + int offs; + + verify_coords(terminal, x, y); + + offs = y * terminal->num_cols + x; + if (terminal->mem[offs] != ch) + { + terminal->mem[offs] = ch; + terminal->tm->mark_tile_dirty(offs); + } +} + +int apple1_state::terminal_getchar(terminal_t *terminal, int x, int y) +{ + int offs; + + verify_coords(terminal, x, y); + offs = y * terminal->num_cols + x; + return terminal->mem[offs]; +} + +void apple1_state::terminal_putblank(terminal_t *terminal, int x, int y) +{ + terminal_putchar(terminal, x, y, terminal->blank_char); +} + +void apple1_state::terminal_dirtycursor(terminal_t *terminal) +{ + if (terminal->cur_offset >= 0) + terminal->tm->mark_tile_dirty(terminal->cur_offset); +} + +void apple1_state::terminal_setcursor(terminal_t *terminal, int x, int y) +{ + terminal_dirtycursor(terminal); + terminal->cur_offset = y * terminal->num_cols + x; + terminal_dirtycursor(terminal); +} + +void apple1_state::terminal_hidecursor(terminal_t *terminal) +{ + terminal->cur_hidden = 1; + terminal_dirtycursor(terminal); +} + +void apple1_state::terminal_showcursor(terminal_t *terminal) +{ + terminal->cur_hidden = 0; + terminal_dirtycursor(terminal); +} + +void apple1_state::terminal_getcursor(terminal_t *terminal, int *x, int *y) +{ + *x = terminal->cur_offset % terminal->num_cols; + *y = terminal->cur_offset / terminal->num_cols; +} + +void apple1_state::terminal_fill(terminal_t *terminal, int val) +{ + int i; + for (i = 0; i < terminal->num_cols * terminal->num_rows; i++) + terminal->mem[i] = val; + terminal->tm->mark_all_dirty(); +} + +void apple1_state::terminal_clear(terminal_t *terminal) +{ + terminal_fill(terminal, terminal->blank_char); +} + +terminal_t *apple1_state::terminal_create( + int gfx, int blank_char, int char_bits, + int (*getcursorcode)(int original_code), + int num_cols, int num_rows) +{ + terminal_t *term; + int char_width, char_height; + + char_width = m_gfxdecode->gfx(gfx)->width(); + char_height = m_gfxdecode->gfx(gfx)->height(); + + term = (terminal_t *) auto_alloc_array(machine(), char, sizeof(terminal_t) - sizeof(term->mem) + + (num_cols * num_rows * sizeof(termchar_t))); + + term->tm = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(apple1_state::terminal_gettileinfo),this), TILEMAP_SCAN_ROWS, + char_width, char_height, num_cols, num_rows); + + term->gfx = gfx; + term->blank_char = blank_char; + term->char_bits = char_bits; + term->num_cols = num_cols; + term->num_rows = num_rows; + term->getcursorcode = getcursorcode; + term->cur_offset = -1; + term->cur_hidden = 0; + terminal_clear(term); + return term; +} + + +/**************************************************************************/ + + + +/* The cursor blinking is generated by a free-running timer with a + 0.52-second period. It is on for 2/3 of this period and off for + 1/3. */ +#define CURSOR_OFF_LENGTH (0.52/3) + +/**************************************************************************/ + +static int apple1_getcursorcode(int original_code) +{ + /* Cursor uses symbol 0 (an @ sign) in the character generator ROM. */ + return 0; +} + +/**************************************************************************/ + +void apple1_state::video_start() +{ + m_blink_on = 1; /* cursor is visible initially */ + m_terminal = terminal_create( + 0, /* graphics font 0 (the only one we have) */ + 32, /* Blank character is symbol 32 in the ROM */ + 8, /* use 8 bits for the character code */ + apple1_getcursorcode, + 40, 24); /* 40 columns, 24 rows */ + + terminal_setcursor(m_terminal, 0, 0); +} + +/* This function handles all writes to the video display. */ +void apple1_state::apple1_vh_dsp_w (int data) +{ + int x, y; + int cursor_x, cursor_y; + + /* While CLEAR SCREEN is being held down, the hardware is forced + to clear the video memory, so video writes have no effect. */ + if (m_vh_clrscrn_pressed) + return; + + /* The video display port only accepts the 7 lowest bits of the char. */ + data &= 0x7f; + + terminal_getcursor(m_terminal, &cursor_x, &cursor_y); + + if (data == '\r') { + /* Carriage-return moves the cursor to the start of the next + line. */ + cursor_x = 0; + cursor_y++; + } + else if (data < ' ') { + /* Except for carriage-return, the video hardware completely + ignores all control characters. */ + return; + } + else { + /* For visible characters, only 6 bits of the ASCII code are + used, because the 2513 character generator ROM only + contains 64 symbols. The low 5 bits of the ASCII code are + used directly. Bit 6 is ignored, since it is the same for + all the available characters in the ROM. Bit 7 is inverted + before being used as the high bit of the 6-bit ROM symbol + index, because the block of 32 ASCII symbols containing the + uppercase letters comes first in the ROM. */ + + int romindx = (data & 0x1f) | (((data ^ 0x40) & 0x40) >> 1); + + terminal_putchar(m_terminal, cursor_x, cursor_y, romindx); + if (cursor_x < 39) + { + cursor_x++; + } + else + { + cursor_x = 0; + cursor_y++; + } + } + + /* If the cursor went past the bottom line, scroll the text up one line. */ + if (cursor_y == 24) + { + for (y = 1; y < 24; y++) + for (x = 0; x < 40; x++) + terminal_putchar(m_terminal, x, y-1, + terminal_getchar(m_terminal, x, y)); + + for (x = 0; x < 40; x++) + terminal_putblank(m_terminal, x, 23); + + cursor_y--; + } + + terminal_setcursor(m_terminal, cursor_x, cursor_y); +} + +/* This function handles clearing the video display on cold-boot or in + response to a press of the CLEAR SCREEN switch. */ +void apple1_state::apple1_vh_dsp_clr () +{ + terminal_setcursor(m_terminal, 0, 0); + terminal_clear(m_terminal); +} + +/* Calculate how long it will take for the display to assert the RDA + signal in response to a video display write. This signal indicates + the display has completed the write and is ready to accept another + write. */ +attotime apple1_state::apple1_vh_dsp_time_to_ready () +{ + int cursor_x, cursor_y; + int cursor_scanline; + double scanline_period = m_screen->scan_period().as_double(); + double cursor_hfrac; + + /* The video hardware refreshes the screen by reading the + character codes from its circulating shift-register memory. + Because of the way this memory works, a new character can only + be written into the cursor location at the moment this location + is about to be read. This happens during the first scanline of + the cursor's character line, when the beam reaches the cursor's + horizontal position. */ + + terminal_getcursor(m_terminal, &cursor_x, &cursor_y); + cursor_scanline = cursor_y * apple1_charlayout.height; + + /* Each scanline is composed of 455 pixel times. The first 175 of + these are the horizontal blanking period; the remaining 280 are + for the visible part of the scanline. */ + cursor_hfrac = (175 + cursor_x * apple1_charlayout.width) / 455; + + if (m_screen->vpos() == cursor_scanline) { + /* video_screen_get_hpos() doesn't account for the horizontal + blanking interval; it acts as if the scanline period is + entirely composed of visible pixel times. However, we can + still use it to find what fraction of the current scanline + period has elapsed. */ + double current_hfrac = m_screen->hpos() / + m_screen->width(); + if (current_hfrac < cursor_hfrac) + return attotime::from_double(scanline_period * (cursor_hfrac - current_hfrac)); + } + + return attotime::from_double( + m_screen->time_until_pos(cursor_scanline, 0).as_double() + + scanline_period * cursor_hfrac); +} + +/* Blink the cursor on or off, as appropriate. */ +void apple1_state::apple1_vh_cursor_blink () +{ + int new_blink_on; + + /* The cursor is on for 2/3 of its blink period and off for 1/3. + This is most easily handled by dividing the total elapsed time + by the length of the off-portion of the cycle, giving us the + number of one-third-cycles elapsed, then checking the result + modulo 3. */ + + if (((int) (machine().time().as_double() / CURSOR_OFF_LENGTH)) % 3 < 2) + new_blink_on = 1; + else + new_blink_on = 0; + + if (new_blink_on != m_blink_on) { /* have we changed state? */ + if (new_blink_on) + terminal_showcursor(m_terminal); + else + terminal_hidecursor(m_terminal); + m_blink_on = new_blink_on; + } +} + +UINT32 apple1_state::screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + apple1_vh_cursor_blink(); + terminal_draw(screen, bitmap, cliprect, m_terminal); + return 0; +} diff --git a/src/mame/video/apple2.c b/src/mame/video/apple2.c new file mode 100644 index 00000000000..195fed4ce8f --- /dev/null +++ b/src/mame/video/apple2.c @@ -0,0 +1,1540 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + video/apple2.c + +***************************************************************************/ + +#include "emu.h" +#include "includes/apple2.h" +#include "machine/ram.h" + +#include "video/apple2.h" + +/***************************************************************************/ + + +#define BLACK 0 +#define DKRED 1 +#define DKBLUE 2 +#define PURPLE 3 +#define DKGREEN 4 +#define DKGRAY 5 +#define BLUE 6 +#define LTBLUE 7 +#define BROWN 8 +#define ORANGE 9 +#define GRAY 10 +#define PINK 11 +#define GREEN 12 +#define YELLOW 13 +#define AQUA 14 +#define WHITE 15 + +#define ALWAYS_REFRESH 0 +#define PROFILER_VIDEOTOUCH PROFILER_USER3 + +/*************************************************************************** + HELPERS +***************************************************************************/ + +/*------------------------------------------------- + effective_a2 - calculates the effective a2 + register +-------------------------------------------------*/ + +inline UINT32 apple2_state::effective_a2() +{ + return m_flags & m_a2_videomask; +} + + +/*------------------------------------------------- + compute_video_address - performs funky Apple II + video address lookup +-------------------------------------------------*/ + +UINT32 apple2_state::compute_video_address(int col, int row) +{ + /* special Apple II addressing - gotta love it */ + return (((row & 0x07) << 7) | ((row & 0x18) * 5 + col)); +} + + + +/*------------------------------------------------- + adjust_begin_and_end_row - processes the cliprect +-------------------------------------------------*/ + +void apple2_state::adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow) +{ + /* assumptions of the code */ + assert((*beginrow % 8) == 0); + assert((*endrow % 8) == 7); + + *beginrow = MAX(*beginrow, cliprect.min_y - (cliprect.min_y % 8)); + *endrow = MIN(*endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + + /* sanity check again */ + assert((*beginrow % 8) == 0); + assert((*endrow % 8) == 7); +} + + + +/*************************************************************************** + TEXT +***************************************************************************/ + +/*------------------------------------------------- + apple2_plot_text_character - plots a single + textual character +-------------------------------------------------*/ + +inline void apple2_state::apple2_plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, + const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2) +{ + int x, y, i; + int fg = m_fgcolor; + int bg = m_bgcolor; + const UINT8 *chardata; + UINT16 color; + + if (m_sysconfig != NULL) + { + switch (m_sysconfig->read() & 0x03) + { + case 0: + break; // leave alone + + case 1: + if ((m_machinetype == APPLE_II) || (m_machinetype == LABA2P) || (m_machinetype == SPACE84)) + { + bg = WHITE; + } + else + { + fg = WHITE; + } + break; + + case 2: + if ((m_machinetype == APPLE_II) || (m_machinetype == LABA2P) || (m_machinetype == SPACE84)) + { + bg = GREEN; + } + else + { + fg = GREEN; + } + break; + + case 3: + if ((m_machinetype == APPLE_II) || (m_machinetype == LABA2P) || (m_machinetype == SPACE84)) + { + bg = ORANGE; + } + else + { + fg = ORANGE; + } + break; + } + } + + + if (my_a2 & VAR_ALTCHARSET) + { + /* we're using an alternate charset */ + code |= m_alt_charset_value; + } + else if (m_flash && (code >= 0x40) && (code <= 0x7f)) + { + /* we're flashing; swap */ + i = fg; + fg = bg; + bg = i; + } + + /* look up the character data */ + chardata = &textgfx_data[(code * 8) % textgfx_datalen]; + + /* and finally, plot the character itself */ + if ((m_machinetype == SPACE84) || (m_machinetype == LABA2P)) + { + for (y = 0; y < 8; y++) + { + for (x = 0; x < 7; x++) + { + color = (chardata[y] & (1 << (6-x))) ? bg : fg; + + for (i = 0; i < xscale; i++) + { + bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + } + } + } + } + else + { + for (y = 0; y < 8; y++) + { + for (x = 0; x < 7; x++) + { + color = (chardata[y] & (1 << x)) ? bg : fg; + + for (i = 0; i < xscale; i++) + { + bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + } + } + } + } +} + + + +/*------------------------------------------------- + apple2_text_draw - renders text (either 40 + column or 80 column) +-------------------------------------------------*/ + +void apple2_state::apple2_text_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) +{ + int row, col; + UINT32 start_address = (page ? 0x0800 : 0x0400); + UINT32 address; + UINT32 my_a2 = effective_a2(); + + /* perform adjustments */ + adjust_begin_and_end_row(cliprect, &beginrow, &endrow); + + for (row = beginrow; row <= endrow; row += 8) + { + for (col = 0; col < 40; col++) + { + /* calculate adderss */ + address = start_address + compute_video_address(col, row / 8); + + if (my_a2 & VAR_80COL) + { + apple2_plot_text_character(bitmap, col * 14 + 0, row, 1, m_a2_videoaux[address], + m_textgfx_data, m_textgfx_datalen, my_a2); + apple2_plot_text_character(bitmap, col * 14 + 7, row, 1, m_a2_videoram[address], + m_textgfx_data, m_textgfx_datalen, my_a2); + } + else + { + apple2_plot_text_character(bitmap, col * 14, row, 2, m_a2_videoram[address], + m_textgfx_data, m_textgfx_datalen, my_a2); + } + } + } +} + + +/*------------------------------------------------- + apple2_lores_draw - renders lo-res text +-------------------------------------------------*/ + +void apple2_state::apple2_lores_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) +{ + int row, col, y, x; + UINT8 code; + UINT32 start_address = (page ? 0x0800 : 0x0400); + UINT32 address; + + /* perform adjustments */ + adjust_begin_and_end_row(cliprect, &beginrow, &endrow); + + for (row = beginrow; row <= endrow; row += 8) + { + for (col = 0; col < 40; col++) + { + /* calculate adderss */ + address = start_address + compute_video_address(col, row / 8); + + /* perform the lookup */ + code = m_a2_videoram[address]; + + /* and now draw */ + for (y = 0; y < 4; y++) + { + for (x = 0; x < 14; x++) + bitmap.pix16(row + y, col * 14 + x) = (code >> 0) & 0x0F; + } + for (y = 4; y < 8; y++) + { + for (x = 0; x < 14; x++) + bitmap.pix16(row + y, col * 14 + x) = (code >> 4) & 0x0F; + } + } + } +} + + +/*************************************************************************** + HIGH RESOLUTION GRAPHICS +***************************************************************************/ + +void apple2_state::apple2_hires_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) +{ + const UINT8 *vram, *vaux; + int row, col, b; + int offset; + int columns; + UINT8 vram_row[82]; + UINT16 v; + UINT16 *p; + UINT32 w; + UINT16 *artifact_map_ptr; + int mon_type = 0; + + if (m_sysconfig != NULL) + { + mon_type = m_sysconfig->read() & 0x03; + } + + /* sanity checks */ + if (beginrow < cliprect.min_y) + beginrow = cliprect.min_y; + if (endrow > cliprect.max_y) + endrow = cliprect.max_y; + if (endrow < beginrow) + return; + + if (m_machinetype == TK2000) + { + vram = m_a2_videoram + (page ? 0xa000 : 0x2000); + vaux = m_a2_videoaux + (page ? 0xa000 : 0x2000); + } + else + { + vram = m_a2_videoram + (page ? 0x4000 : 0x2000); + vaux = m_a2_videoaux + (page ? 0x4000 : 0x2000); + } + columns = ((effective_a2() & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40; + + vram_row[0] = 0; + vram_row[columns + 1] = 0; + + for (row = beginrow; row <= endrow; row++) + { + for (col = 0; col < 40; col++) + { + offset = compute_video_address(col, row / 8) | ((row & 7) << 10); + + switch(columns) + { + case 40: + vram_row[1+col] = vram[offset]; + break; + + case 80: + vram_row[1+(col*2)+0] = vaux[offset]; + vram_row[1+(col*2)+1] = vram[offset]; + break; + + default: + fatalerror("Invalid column count\n"); + } + } + + p = &bitmap.pix16(row); + + for (col = 0; col < columns; col++) + { + w = (((UINT32) vram_row[col+0] & 0x7f) << 0) + | (((UINT32) vram_row[col+1] & 0x7f) << 7) + | (((UINT32) vram_row[col+2] & 0x7f) << 14); + + switch(columns) + { + case 40: + switch (mon_type) + { + case 0: + artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; + for (b = 0; b < 7; b++) + { + v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + *(p++) = v; + *(p++) = v; + } + break; + + case 1: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? WHITE : BLACK; + *(p++) = v ? WHITE : BLACK; + } + break; + + case 2: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? GREEN : BLACK; + *(p++) = v ? GREEN : BLACK; + } + break; + + case 3: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? ORANGE : BLACK; + *(p++) = v ? ORANGE : BLACK; + } + break; + } + break; + + case 80: + if (m_monochrome_dhr) + { + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? WHITE : BLACK; + } + } + else + { + switch (mon_type) + { + case 0: + for (b = 0; b < 7; b++) + { + v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; + *(p++) = v; + } + break; + + case 1: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? WHITE : BLACK; + } + break; + + case 2: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? GREEN : BLACK; + } + break; + + case 3: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? ORANGE : BLACK; + } + break; + } + } + break; + + default: + fatalerror("Invalid column count\n"); + } + } + } +} + + + +/*************************************************************************** + VIDEO CORE +***************************************************************************/ + +void apple2_state::apple2_video_start(const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo) +{ + int i, j; + UINT16 c; + UINT8 *apple2_font; + + static const UINT8 hires_artifact_color_table[] = + { + BLACK, PURPLE, GREEN, WHITE, + BLACK, BLUE, ORANGE, WHITE + }; + + static const UINT8 dhires_artifact_color_table[] = + { + BLACK, DKGREEN, BROWN, GREEN, + DKRED, DKGRAY, ORANGE, YELLOW, + DKBLUE, BLUE, GRAY, AQUA, + PURPLE, LTBLUE, PINK, WHITE + }; + + m_fgcolor = 15; + m_bgcolor = 0; + m_flash = 0; + apple2_font = memregion("gfx1")->base(); + m_alt_charset_value = memregion("gfx1")->bytes() / 16; + m_a2_videoram = vram; + m_a2_videoaux = aux_vram; + + m_textgfx_data = memregion("gfx1")->base(); + m_textgfx_datalen = memregion("gfx1")->bytes(); + + /* 2^3 dependent pixels * 2 color sets * 2 offsets */ + m_hires_artifact_map = auto_alloc_array(machine(), UINT16, 8 * 2 * 2); + + /* 2^4 dependent pixels */ + m_dhires_artifact_map = auto_alloc_array(machine(), UINT16, 16); + + /* build hires artifact map */ + for (i = 0; i < 8; i++) + { + for (j = 0; j < 2; j++) + { + if (i & 0x02) + { + if ((i & 0x05) != 0) + c = 3; + else + c = j ? 2 : 1; + } + else + { + if ((i & 0x05) == 0x05) + c = j ? 1 : 2; + else + c = 0; + } + m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % hires_modulo]; + m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % hires_modulo]; + } + } + + /* Fix for Ivel Ultra */ + if (!strcmp(machine().system().name, "ivelultr")) { + int len = memregion("gfx1")->bytes(); + for (i = 0; i < len; i++) + { + apple2_font[i] = BITSWAP8(apple2_font[i], 7, 7, 6, 5, 4, 3, 2, 1); + } + } + + /* do we need to flip the gfx? */ + if (!strcmp(machine().system().name, "apple2") + || !strcmp(machine().system().name, "apple2p") + || !strcmp(machine().system().name, "prav82") + || !strcmp(machine().system().name, "prav8m") + || !strcmp(machine().system().name, "ivelultr") + || !strcmp(machine().system().name, "apple2jp")) + { + int len = memregion("gfx1")->bytes(); + for (i = 0; i < len; i++) + { + apple2_font[i] = BITSWAP8(apple2_font[i], 7, 0, 1, 2, 3, 4, 5, 6); + } + } + + + /* build double hires artifact map */ + for (i = 0; i < 16; i++) + { + m_dhires_artifact_map[i] = dhires_artifact_color_table[i]; + } + + memset(&m_old_a2, 0, sizeof(m_old_a2)); + m_a2_videomask = ~ignored_softswitches; +} + + + +VIDEO_START_MEMBER(apple2_state,apple2) +{ + apple2_video_start(m_ram->pointer(), m_ram->pointer()+0x10000, VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 4); + + /* hack to fix the colors on apple2/apple2p */ + m_fgcolor = 0; + m_bgcolor = 15; + + m_monochrome_dhr = false; +} + + +VIDEO_START_MEMBER(apple2_state,apple2p) +{ + apple2_video_start(m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 8); + + /* hack to fix the colors on apple2/apple2p */ + m_fgcolor = 0; + m_bgcolor = 15; + + m_monochrome_dhr = false; +} + + +VIDEO_START_MEMBER(apple2_state,apple2e) +{ + device_a2eauxslot_card_interface *auxslotdevice = m_a2eauxslot->get_a2eauxslot_card(); + if (auxslotdevice) + { + apple2_video_start(m_ram->pointer(), auxslotdevice->get_vram_ptr(), auxslotdevice->allow_dhr() ? 0 : VAR_DHIRES, 8); + } + else + { + apple2_video_start(m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_DHIRES, 8); + } +} + + +VIDEO_START_MEMBER(apple2_state,apple2c) +{ + apple2_video_start(m_ram->pointer(), m_ram->pointer()+0x10000, 0, 8); +} + +UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int page; + UINT32 new_a2; + + /* calculate the m_flash value */ + m_flash = ((machine().time() * 4).seconds() & 1) ? 1 : 0; + + /* read out relevant softswitch variables; to see what has changed */ + new_a2 = effective_a2(); + if (new_a2 & VAR_80STORE) + new_a2 &= ~VAR_PAGE2; + new_a2 &= VAR_TEXT | VAR_MIXED | VAR_HIRES | VAR_DHIRES | VAR_80COL | VAR_PAGE2 | VAR_ALTCHARSET; + + if (ALWAYS_REFRESH || (new_a2 != m_old_a2)) + { + m_old_a2 = new_a2; + } + + /* choose which page to use */ + page = (new_a2 & VAR_PAGE2) ? 1 : 0; + + /* choose the video mode to draw */ + if (effective_a2() & VAR_TEXT) + { + /* text screen - TK2000 uses HGR for text */ + if (m_machinetype == TK2000) + { + apple2_hires_draw(bitmap, cliprect, page, 0, 191); + } + else + { + apple2_text_draw(bitmap, cliprect, page, 0, 191); + } + } + else if ((effective_a2() & VAR_HIRES) && (effective_a2() & VAR_MIXED)) + { + /* hi-res on top; text at bottom */ + apple2_hires_draw(bitmap, cliprect, page, 0, 159); + apple2_text_draw(bitmap, cliprect, page, 160, 191); + } + else if (effective_a2() & VAR_HIRES) + { + /* hi-res screen */ + apple2_hires_draw(bitmap, cliprect, page, 0, 191); + } + else if (effective_a2() & VAR_MIXED) + { + /* lo-res on top; text at bottom */ + apple2_lores_draw(bitmap, cliprect, page, 0, 159); + apple2_text_draw(bitmap, cliprect, page, 160, 191); + } + else + { + /* lo-res screen */ + apple2_lores_draw(bitmap, cliprect, page, 0, 191); + } + return 0; +} + +/* + New implementation +*/ + +const device_type APPLE2_VIDEO = &device_creator; + +//------------------------------------------------- +// a2_video_device - constructor +//------------------------------------------------- + +a2_video_device::a2_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, APPLE2_VIDEO, "Apple II video", tag, owner, clock, "a2video", __FILE__) +{ +} + +void a2_video_device::device_start() +{ + static const UINT8 hires_artifact_color_table[] = + { + BLACK, PURPLE, GREEN, WHITE, + BLACK, BLUE, ORANGE, WHITE + }; + static const UINT8 dhires_artifact_color_table[] = + { + BLACK, DKGREEN, BROWN, GREEN, + DKRED, DKGRAY, ORANGE, YELLOW, + DKBLUE, BLUE, GRAY, AQUA, + PURPLE, LTBLUE, PINK, WHITE + }; + + // generate hi-res artifact data + int i, j; + UINT16 c; + + /* 2^3 dependent pixels * 2 color sets * 2 offsets */ + m_hires_artifact_map = auto_alloc_array(machine(), UINT16, 8 * 2 * 2); + + /* build hires artifact map */ + for (i = 0; i < 8; i++) + { + for (j = 0; j < 2; j++) + { + if (i & 0x02) + { + if ((i & 0x05) != 0) + c = 3; + else + c = j ? 2 : 1; + } + else + { + if ((i & 0x05) == 0x05) + c = j ? 1 : 2; + else + c = 0; + } + m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % 8]; + m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % 8]; + } + } + + /* 2^4 dependent pixels */ + m_dhires_artifact_map = auto_alloc_array(machine(), UINT16, 16); + + /* build double hires artifact map */ + for (i = 0; i < 16; i++) + { + m_dhires_artifact_map[i] = dhires_artifact_color_table[i]; + } + + save_item(NAME(m_page2)); + save_item(NAME(m_flash)); + save_item(NAME(m_mix)); + save_item(NAME(m_graphics)); + save_item(NAME(m_hires)); + save_item(NAME(m_dhires)); + save_item(NAME(m_80col)); + save_item(NAME(m_altcharset)); +} + +void a2_video_device::device_reset() +{ + m_page2 = false; + m_graphics = false; + m_hires = false; + m_80col = false; + m_altcharset = false; + m_dhires = false; + m_flash = false; + m_mix = false; + m_sysconfig = 0; +} + +void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, + const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg) +{ + int x, y, i; + const UINT8 *chardata; + UINT16 color; + + if (!m_altcharset) + { + if ((code >= 0x40) && (code <= 0x7f)) + { + code &= 0x3f; + + if (m_flash) + { + i = fg; + fg = bg; + bg = i; + } + } + } + else + { + if ((code >= 0x60) && (code <= 0x7f)) + { + code |= 0x80; // map to lowercase normal + i = fg; // and flip the color + fg = bg; + bg = i; + } + } + + /* look up the character data */ + chardata = &textgfx_data[(code * 8)]; + + for (y = 0; y < 8; y++) + { + for (x = 0; x < 7; x++) + { + color = (chardata[y] & (1 << x)) ? bg : fg; + + for (i = 0; i < xscale; i++) + { + bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + } + } + } +} + +void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, + const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg) +{ + int x, y, i; + const UINT8 *chardata; + UINT16 color; + + if ((code >= 0x40) && (code <= 0x7f)) + { + if (m_flash) + { + i = fg; + fg = bg; + bg = i; + } + } + + /* look up the character data */ + chardata = &textgfx_data[(code * 8)]; + + for (y = 0; y < 8; y++) + { + for (x = 0; x < 7; x++) + { + color = (chardata[y] & (1 << (6-x))) ? fg : bg; + + for (i = 0; i < xscale; i++) + { + bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + } + } + } +} + +void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, + const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg) +{ + int x, y, i; + const UINT8 *chardata; + UINT16 color; + + if ((code >= 0x40) && (code <= 0x7f)) + { + if (m_flash) + { + i = fg; + fg = bg; + bg = i; + } + } + + /* look up the character data */ + chardata = &textgfx_data[(code * 8)]; + + for (y = 0; y < 8; y++) + { + for (x = 1; x < 8; x++) + { + color = (chardata[y] & (1 << x)) ? fg : bg; + + for (i = 0; i < xscale; i++) + { + bitmap.pix16(ypos + y, xpos + ((x-1) * xscale) + i) = color; + } + } + } +} + +void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + int row, col, y, x; + UINT8 code; + UINT32 start_address = m_page2 ? 0x0800 : 0x0400; + UINT32 address; + int fg = 0; + + switch (m_sysconfig & 0x03) + { + case 0: fg = WHITE; break; + case 1: fg = WHITE; break; + case 2: fg = GREEN; break; + case 3: fg = ORANGE; break; + } + + /* perform adjustments */ + beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); + endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + + if (!(m_sysconfig & 0x03)) + { + for (row = beginrow; row <= endrow; row += 8) + { + for (col = 0; col < 40; col++) + { + /* calculate adderss */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + + /* perform the lookup */ + code = m_ram_ptr[address]; + + /* and now draw */ + for (y = 0; y < 4; y++) + { + for (x = 0; x < 14; x++) + bitmap.pix16(row + y, col * 14 + x) = (code >> 0) & 0x0F; + } + for (y = 4; y < 8; y++) + { + for (x = 0; x < 14; x++) + bitmap.pix16(row + y, col * 14 + x) = (code >> 4) & 0x0F; + } + } + } + } + else + { + for (row = beginrow; row <= endrow; row += 8) + { + for (col = 0; col < 40; col++) + { + UINT8 bits; + + /* calculate adderss */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + + /* perform the lookup */ + code = m_ram_ptr[address]; + + bits = (code >> 0) & 0x0F; + /* and now draw */ + for (y = 0; y < 4; y++) + { + for (x = 0; x < 14; x++) + { + bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; + } + } + + bits = (code >> 4) & 0x0F; + for (y = 4; y < 8; y++) + { + for (x = 0; x < 14; x++) + bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; + } + } + } + } +} + +void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + int row, col, y; + UINT8 code, auxcode; + UINT32 start_address = m_page2 ? 0x0800 : 0x0400; + UINT32 address; + static const int aux_colors[16] = { 0, 2, 4, 6, 8, 0xa, 0xc, 0xe, 1, 3, 5, 7, 9, 0xb, 0xd, 0xf }; + int fg = 0; + + switch (m_sysconfig & 0x03) + { + case 0: fg = WHITE; break; + case 1: fg = WHITE; break; + case 2: fg = GREEN; break; + case 3: fg = ORANGE; break; + } + + /* perform adjustments */ + beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); + endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + + if (!(m_sysconfig & 0x03)) + { + for (row = beginrow; row <= endrow; row += 8) + { + for (col = 0; col < 40; col++) + { + /* calculate adderss */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + + /* perform the lookup */ + code = m_ram_ptr[address]; + auxcode = m_aux_ptr[address]; + + /* and now draw */ + for (y = 0; y < 4; y++) + { + UINT16 *vram = &bitmap.pix16(row + y, (col * 14)); + + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + } + for (y = 4; y < 8; y++) + { + UINT16 *vram = &bitmap.pix16(row + y, (col * 14)); + + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + } + } + } + } + else + { + for (row = beginrow; row <= endrow; row += 8) + { + for (col = 0; col < 40; col++) + { + UINT8 bits, abits; + + /* calculate adderss */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + + /* perform the lookup */ + code = m_ram_ptr[address]; + auxcode = m_aux_ptr[address]; + + bits = (code >> 0) & 0x0F; + abits = (auxcode >> 0) & 0x0F; + + /* and now draw */ + for (y = 0; y < 4; y++) + { + UINT16 *vram = &bitmap.pix16(row + y, (col * 14)); + + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = abits & (1 << 3) ? fg : 0; + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 3) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + } + + bits = (code >> 4) & 0x0F; + abits = (auxcode >> 4) & 0x0F; + + for (y = 4; y < 8; y++) + { + UINT16 *vram = &bitmap.pix16(row + y, (col * 14)); + + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = abits & (1 << 3) ? fg : 0; + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 3) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + } + } + } + } +} + +void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + int row, col; + UINT32 start_address; + UINT32 address; + UINT8 *aux_page = m_ram_ptr; + int fg = 0; + int bg = 0; + + if (m_80col) + { + start_address = 0x400; + if (m_aux_ptr) + { + aux_page = m_aux_ptr; + } + } + else + { + start_address = m_page2 ? 0x800 : 0x400; + } + + beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); + endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + + switch (m_sysconfig & 0x03) + { + case 0: fg = WHITE; break; + case 1: fg = WHITE; break; + case 2: fg = GREEN; break; + case 3: fg = ORANGE; break; + } + + for (row = beginrow; row <= endrow; row += 8) + { + if (m_80col) + { + for (col = 0; col < 40; col++) + { + /* calculate address */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + + plot_text_character(bitmap, col * 14, row, 1, aux_page[address], + m_char_ptr, m_char_size, fg, bg); + plot_text_character(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], + m_char_ptr, m_char_size, fg, bg); + } + } + else + { + for (col = 0; col < 40; col++) + { + /* calculate address */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], + m_char_ptr, m_char_size, fg, bg); + } + } + } +} + +void a2_video_device::text_update_orig(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + int row, col; + UINT32 start_address = m_page2 ? 0x800 : 0x400; + UINT32 address; + int fg = 0; + int bg = 0; + + beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); + endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + + switch (m_sysconfig & 0x03) + { + case 0: fg = WHITE; break; + case 1: fg = WHITE; break; + case 2: fg = GREEN; break; + case 3: fg = ORANGE; break; + } + + for (row = beginrow; row <= endrow; row += 8) + { + for (col = 0; col < 40; col++) + { + /* calculate address */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], + m_char_ptr, m_char_size, fg, bg); + } + } +} + +void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + int row, col; + UINT32 start_address = m_page2 ? 0x800 : 0x400; + UINT32 address; + int fg = 0; + int bg = 0; + + beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); + endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + + switch (m_sysconfig & 0x03) + { + case 0: fg = WHITE; break; + case 1: fg = WHITE; break; + case 2: fg = GREEN; break; + case 3: fg = ORANGE; break; + } + + for (row = beginrow; row <= endrow; row += 8) + { + for (col = 0; col < 40; col++) + { + /* calculate address */ + address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + plot_text_character_ultr(bitmap, col * 14, row, 2, m_ram_ptr[address], + m_char_ptr, m_char_size, fg, bg); + } + } +} + +void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + const UINT8 *vram; + int row, col, b; + int offset; + UINT8 vram_row[42]; + UINT16 v; + UINT16 *p; + UINT32 w; + UINT16 *artifact_map_ptr; + int mon_type = m_sysconfig & 0x03; + + /* sanity checks */ + if (beginrow < cliprect.min_y) + beginrow = cliprect.min_y; + if (endrow > cliprect.max_y) + endrow = cliprect.max_y; + if (endrow < beginrow) + return; + + vram = &m_ram_ptr[(m_page2 ? 0x4000 : 0x2000)]; + + vram_row[0] = 0; + vram_row[41] = 0; + + for (row = beginrow; row <= endrow; row++) + { + for (col = 0; col < 40; col++) + { + offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + vram_row[1+col] = vram[offset]; + } + + p = &bitmap.pix16(row); + + for (col = 0; col < 40; col++) + { + w = (((UINT32) vram_row[col+0] & 0x7f) << 0) + | (((UINT32) vram_row[col+1] & 0x7f) << 7) + | (((UINT32) vram_row[col+2] & 0x7f) << 14); + + switch (mon_type) + { + case 0: + // verified on h/w: setting dhires w/o 80col emulates a rev. 0 Apple ][ with no orange/blue + if (m_dhires) + { + artifact_map_ptr = m_hires_artifact_map; + } + else + { + artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16]; + } + for (b = 0; b < 7; b++) + { + v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + *(p++) = v; + *(p++) = v; + } + break; + + case 1: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? WHITE : BLACK; + *(p++) = v ? WHITE : BLACK; + } + break; + + case 2: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? GREEN : BLACK; + *(p++) = v ? GREEN : BLACK; + } + break; + + case 3: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? ORANGE : BLACK; + *(p++) = v ? ORANGE : BLACK; + } + break; + } + } + } +} + +// similar to regular A2 except page 2 is at $A000 +void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + const UINT8 *vram; + int row, col, b; + int offset; + UINT8 vram_row[42]; + UINT16 v; + UINT16 *p; + UINT32 w; + UINT16 *artifact_map_ptr; + int mon_type = m_sysconfig & 0x03; + + /* sanity checks */ + if (beginrow < cliprect.min_y) + beginrow = cliprect.min_y; + if (endrow > cliprect.max_y) + endrow = cliprect.max_y; + if (endrow < beginrow) + return; + + vram = &m_ram_ptr[(m_page2 ? 0xa000 : 0x2000)]; + + vram_row[0] = 0; + vram_row[41] = 0; + + for (row = beginrow; row <= endrow; row++) + { + for (col = 0; col < 40; col++) + { + offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + vram_row[1+col] = vram[offset]; + } + + p = &bitmap.pix16(row); + + for (col = 0; col < 40; col++) + { + w = (((UINT32) vram_row[col+0] & 0x7f) << 0) + | (((UINT32) vram_row[col+1] & 0x7f) << 7) + | (((UINT32) vram_row[col+2] & 0x7f) << 14); + + switch (mon_type) + { + case 0: + artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; + for (b = 0; b < 7; b++) + { + v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + *(p++) = v; + *(p++) = v; + } + break; + + case 1: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? WHITE : BLACK; + *(p++) = v ? WHITE : BLACK; + } + break; + + case 2: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? GREEN : BLACK; + *(p++) = v ? GREEN : BLACK; + } + break; + + case 3: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? ORANGE : BLACK; + *(p++) = v ? ORANGE : BLACK; + } + break; + } + } + } +} + +void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +{ + const UINT8 *vram, *vaux; + int row, col, b; + int offset; + UINT8 vram_row[82]; + UINT16 v; + UINT16 *p; + UINT32 w; + int page = m_page2 ? 0x4000 : 0x2000; + int mon_type = m_sysconfig & 0x03; + + /* sanity checks */ + if (beginrow < cliprect.min_y) + beginrow = cliprect.min_y; + if (endrow > cliprect.max_y) + endrow = cliprect.max_y; + if (endrow < beginrow) + return; + + vram = &m_ram_ptr[page]; + if (m_aux_ptr) + { + vaux = m_aux_ptr; + } + else + { + vaux = vram; + } + vaux += page; + + vram_row[0] = 0; + vram_row[81] = 0; + + for (row = beginrow; row <= endrow; row++) + { + for (col = 0; col < 40; col++) + { + offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + vram_row[1+(col*2)+0] = vaux[offset]; + vram_row[1+(col*2)+1] = vram[offset]; + } + + p = &bitmap.pix16(row); + + for (col = 0; col < 80; col++) + { + w = (((UINT32) vram_row[col+0] & 0x7f) << 0) + | (((UINT32) vram_row[col+1] & 0x7f) << 7) + | (((UINT32) vram_row[col+2] & 0x7f) << 14); + + switch (mon_type) + { + case 0: + for (b = 0; b < 7; b++) + { + v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; + *(p++) = v; + } + break; + + case 1: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? WHITE : BLACK; + } + break; + + case 2: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? GREEN : BLACK; + } + break; + + case 3: + w >>= 7; + for (b = 0; b < 7; b++) + { + v = (w & 1); + w >>= 1; + *(p++) = v ? ORANGE : BLACK; + } + break; + } + } + } +} + +/* according to Steve Nickolas (author of Dapple), our original palette would + * have been more appropriate for an Apple IIgs. So we've substituted in the + * Robert Munafo palette instead, which is more accurate on 8-bit Apples + */ +static const rgb_t apple2_palette[] = +{ + rgb_t::black, + rgb_t(0xE3, 0x1E, 0x60), /* Dark Red */ + rgb_t(0x60, 0x4E, 0xBD), /* Dark Blue */ + rgb_t(0xFF, 0x44, 0xFD), /* Purple */ + rgb_t(0x00, 0xA3, 0x60), /* Dark Green */ + rgb_t(0x9C, 0x9C, 0x9C), /* Dark Gray */ + rgb_t(0x14, 0xCF, 0xFD), /* Medium Blue */ + rgb_t(0xD0, 0xC3, 0xFF), /* Light Blue */ + rgb_t(0x60, 0x72, 0x03), /* Brown */ + rgb_t(0xFF, 0x6A, 0x3C), /* Orange */ + rgb_t(0x9C, 0x9C, 0x9C), /* Light Grey */ + rgb_t(0xFF, 0xA0, 0xD0), /* Pink */ + rgb_t(0x14, 0xF5, 0x3C), /* Light Green */ + rgb_t(0xD0, 0xDD, 0x8D), /* Yellow */ + rgb_t(0x72, 0xFF, 0xD0), /* Aquamarine */ + rgb_t(0xFF, 0xFF, 0xFF) /* White */ +}; + +/* Initialize the palette */ +PALETTE_INIT_MEMBER(a2_video_device, apple2) +{ + palette.set_pen_colors(0, apple2_palette, ARRAY_LENGTH(apple2_palette)); +} diff --git a/src/mame/video/apple2.h b/src/mame/video/apple2.h new file mode 100644 index 00000000000..6f5f76e4cbf --- /dev/null +++ b/src/mame/video/apple2.h @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + video/apple2.h - Video handling for 8-bit Apple IIs + +*********************************************************************/ + +#ifndef __A2_VIDEO__ +#define __A2_VIDEO__ + +#include "emu.h" + +class a2_video_device : + public device_t +{ +public: + // construction/destruction + a2_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_PALETTE_INIT(apple2); + + bool m_page2; + bool m_flash; + bool m_mix; + bool m_graphics; + bool m_hires; + bool m_dhires; + bool m_80col; + bool m_altcharset; + UINT16 *m_hires_artifact_map; + UINT16 *m_dhires_artifact_map; + + UINT8 *m_ram_ptr, *m_aux_ptr, *m_char_ptr; + int m_char_size; + + int m_sysconfig; + + void text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void text_update_ultr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void text_update_orig(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void lores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void dlores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + +protected: + virtual void device_reset(); + virtual void device_start(); + +private: + void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg); + void plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg); + void plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg); +}; + +// device type definition +extern const device_type APPLE2_VIDEO; + +#endif diff --git a/src/mame/video/apple2gs.c b/src/mame/video/apple2gs.c new file mode 100644 index 00000000000..fb00047c30a --- /dev/null +++ b/src/mame/video/apple2gs.c @@ -0,0 +1,168 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,R. Belmont +/********************************************************************* + + video/apple2gs.c + + Apple IIgs video code + +*********************************************************************/ + + +#include "emu.h" +#include "includes/apple2.h" +#include "includes/apple2gs.h" + + + +VIDEO_START_MEMBER(apple2gs_state,apple2gs) +{ + m_bordercolor = 0; + apple2_video_start(m_slowmem, m_slowmem+0x10000, 0, 8); + m_legacy_gfx = auto_bitmap_ind16_alloc(machine(), 560, 192); + + save_item(m_bordercolor, "BORDERCLR"); + save_item(NAME(m_fgcolor)); + save_item(NAME(m_bgcolor)); +} + + + +UINT32 apple2gs_state::screen_update_apple2gs(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const UINT8 *vram; + UINT32 *scanline; + UINT8 scb, b; + int col, palette; + UINT32 last_pixel = 0, pixel; + int beamy; + UINT16 *a2pixel; + + beamy = cliprect.min_y; + + if (m_newvideo & 0x80) + { + // in top or bottom border? + if ((beamy < BORDER_TOP) || (beamy >= 200+BORDER_TOP)) + { + // don't draw past the bottom border + if (beamy >= 231+BORDER_TOP) + { + return 0; + } + + scanline = &bitmap.pix32(beamy); + for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) + { + scanline[col] = m_a2_palette[m_bordercolor]; + } + } + else // regular screen area + { + int shrline = beamy - BORDER_TOP; + + scb = m_slowmem[0x19D00 + shrline]; + palette = ((scb & 0x0f) << 4); + + vram = &m_slowmem[0x12000 + (shrline * 160)]; + scanline = &bitmap.pix32(beamy); + + // draw left and right borders + for (col = 0; col < BORDER_LEFT; col++) + { + scanline[col] = m_a2_palette[m_bordercolor]; + scanline[col+BORDER_LEFT+640] = m_a2_palette[m_bordercolor]; + } + + if (scb & 0x80) // 640 mode + { + for (col = 0; col < 160; col++) + { + b = vram[col]; + scanline[col * 4 + 0 + BORDER_LEFT] = m_shr_palette[palette + 0 + ((b >> 6) & 0x03)]; + scanline[col * 4 + 1 + BORDER_LEFT] = m_shr_palette[palette + 4 + ((b >> 4) & 0x03)]; + scanline[col * 4 + 2 + BORDER_LEFT] = m_shr_palette[palette + 8 + ((b >> 2) & 0x03)]; + scanline[col * 4 + 3 + BORDER_LEFT] = m_shr_palette[palette + 12 + ((b >> 0) & 0x03)]; + } + } + else // 320 mode + { + for (col = 0; col < 160; col++) + { + b = vram[col]; + pixel = (b >> 4) & 0x0f; + + if ((scb & 0x20) && !pixel) + pixel = last_pixel; + else + last_pixel = pixel; + pixel += palette; + scanline[col * 4 + 0 + BORDER_LEFT] = m_shr_palette[pixel]; + scanline[col * 4 + 1 + BORDER_LEFT] = m_shr_palette[pixel]; + + b = vram[col]; + pixel = (b >> 0) & 0x0f; + + if ((scb & 0x20) && !pixel) + pixel = last_pixel; + else + last_pixel = pixel; + pixel += palette; + scanline[col * 4 + 2 + BORDER_LEFT] = m_shr_palette[pixel]; + scanline[col * 4 + 3 + BORDER_LEFT] = m_shr_palette[pixel]; + } + } + } + } + else + { + /* call legacy Apple II video rendering at scanline 0 to draw into the off-screen buffer */ + if (beamy == 0) + { + // check if DHR should be monochrome 560x192 + if (m_newvideo & 0x20) + { + m_monochrome_dhr = true; + } + else + { + m_monochrome_dhr = false; + } + + rectangle new_cliprect(0, 559, 0, 191); + screen_update_apple2(screen, *m_legacy_gfx, new_cliprect); + } + + if ((beamy < (BORDER_TOP+4)) || (beamy >= (192+4+BORDER_TOP))) + { + if (beamy >= (231+BORDER_TOP)) + { + return 0; + } + + scanline = &bitmap.pix32(beamy); + for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) + { + scanline[col] = m_a2_palette[m_bordercolor]; + } + } + else + { + scanline = &bitmap.pix32(beamy); + + // draw left and right borders + for (col = 0; col < BORDER_LEFT + 40; col++) + { + scanline[col] = m_a2_palette[m_bordercolor]; + scanline[col+BORDER_LEFT+600] = m_a2_palette[m_bordercolor]; + } + + a2pixel = &m_legacy_gfx->pix16(beamy-(BORDER_TOP+4)); + for (int x = 0; x < 560; x++) + { + scanline[40 + BORDER_LEFT + x] = m_a2_palette[*a2pixel++]; + } + } + } + return 0; +} diff --git a/src/mame/video/apple3.c b/src/mame/video/apple3.c new file mode 100644 index 00000000000..e733199bd87 --- /dev/null +++ b/src/mame/video/apple3.c @@ -0,0 +1,518 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,R. Belmont +/*************************************************************************** + + video/apple3.c + + Apple /// + +***************************************************************************/ + + +#include "emu.h" +#include "includes/apple3.h" +#include "machine/ram.h" + +#define BLACK 0 +#define DKRED 1 +#define DKBLUE 2 +#define PURPLE 3 +#define DKGREEN 4 +#define DKGRAY 5 +#define BLUE 6 +#define LTBLUE 7 +#define BROWN 8 +#define ORANGE 9 +#define GRAY 10 +#define PINK 11 +#define GREEN 12 +#define YELLOW 13 +#define AQUA 14 +#define WHITE 15 + +// derived from the IIgs palette then adjusted to match Sara +static const unsigned char apple3_palette[] = +{ + // text colors, which don't match the Apple II palette + 0x0, 0x0, 0x0, /* Black $0 */ + 0x5, 0x0, 0x5, /* Magenta $1 */ + 0x0, 0x0, 0x9, /* Dark Blue $2 */ + 0xD, 0x2, 0xD, /* Purple $3 */ + 0x0, 0x7, 0x2, /* Dark Green $4 */ + 0xa, 0xa, 0xa, /* Light Gray $5 */ + 0x2, 0x2, 0xF, /* Medium Blue $6 */ + 0x6, 0xA, 0xF, /* Light Blue $7 */ + 0x8, 0x5, 0x0, /* Brown $8 */ + 0xF, 0x6, 0x0, /* Orange $9 */ + 0x5, 0x5, 0x5, /* Dark Gray $A */ + 0xF, 0x9, 0xF, /* Pink $B */ + 0x1, 0xD, 0x0, /* Light Green $C */ + 0xe, 0xe, 0x0, /* Yellow $D */ + 0x4, 0xe, 0xd, /* Cyan $E */ + 0xF, 0xF, 0xF, /* White $F */ + // graphics colors, which *are* Apple II order + 0x0, 0x0, 0x0, /* Black $0 */ + 0xD, 0x0, 0x3, /* Deep Red $1 */ + 0x0, 0x0, 0x9, /* Dark Blue $2 */ + 0xD, 0x2, 0xD, /* Purple $3 */ + 0x0, 0x7, 0x2, /* Dark Green $4 */ + 0x5, 0x5, 0x5, /* Dark Gray $5 */ + 0x2, 0x2, 0xF, /* Medium Blue $6 */ + 0x6, 0xA, 0xF, /* Light Blue $7 */ + 0x8, 0x5, 0x0, /* Brown $8 */ + 0xF, 0x6, 0x0, /* Orange $9 */ + 0xA, 0xA, 0xA, /* Light Gray $A */ + 0xF, 0x9, 0x8, /* Pink $B */ + 0x1, 0xD, 0x0, /* Light Green $C */ + 0xF, 0xF, 0x0, /* Yellow $D */ + 0x4, 0xF, 0x9, /* Aquamarine $E */ + 0xF, 0xF, 0xF /* White $F */ + +}; + +static const UINT32 text_map[] = +{ + 0x400, 0x480, 0x500, 0x580, 0x600, 0x680, 0x700, 0x780, + 0x428, 0x4a8, 0x528, 0x5a8, 0x628, 0x6a8, 0x728, 0x7a8, + 0x450, 0x4d0, 0x550, 0x5d0, 0x650, 0x6d0, 0x750, 0x7d0 +}; + + +PALETTE_INIT_MEMBER(apple3_state, apple3) +{ + int i; + + for (i = 0; i < 32; i++) + { + m_palette->set_pen_color(i, + apple3_palette[(3*i)]*17, + apple3_palette[(3*i)+1]*17, + apple3_palette[(3*i)+2]*17); + } +} + +void apple3_state::apple3_write_charmem() +{ + address_space& space = m_maincpu->space(AS_PROGRAM); + static const UINT32 screen_hole_map[] = + { + 0x478, 0x4f8, 0x578, 0x5f8, 0x678, 0x6f8, 0x778, 0x7f8 + }; + int i, j, addr; + UINT8 val; + + for (i = 0; i < 8; i++) + { + for (j = 0; j < 4; j++) + { + addr = 0x7f & space.read_byte(screen_hole_map[i] + 0x400 + j + 0); + val = space.read_byte(screen_hole_map[i] + j + 0); + m_char_mem[((addr * 8) + ((i & 3) * 2) + 0) & 0x3ff] = val; + + addr = 0x7f & space.read_byte(screen_hole_map[i] + 0x400 + j + 4); + val = space.read_byte(screen_hole_map[i] + j + 4); + m_char_mem[((addr * 8) + ((i & 3) * 2) + 1) & 0x3ff] = val; + } + } +} + + + +VIDEO_START_MEMBER(apple3_state,apple3) +{ + int i, j; + UINT32 v; + + memset(m_char_mem, 0, 0x800); + + m_hgr_map = auto_alloc_array(machine(), UINT32, 192); + for (i = 0; i < 24; i++) + { + v = text_map[i] - 0x0400; + for (j = 0; j < 8; j++) + { + m_hgr_map[(i * 8) + j] = 0x2000 + v + (j * 0x400); + } + } +} + + + +void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap) +{ + int x, y, col, row, lc; + offs_t offset; + UINT8 ch; + const UINT8 *char_data; + pen_t fg, bg, temp; + UINT16 *dest; + UINT8 *ram = m_ram->pointer(); + UINT32 ram_size = m_ram->size(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (y = 0; y < 24; y++) + { + for (x = 0; x < 40; x++) + { + offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); + ch = ram[offset]; + + // no color text in emulation mode + if ((m_flags & VAR_VM0) && (m_via_1_a & 0x40)) + { + /* color text */ + offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0000 : 0x0400); + bg = (ram[offset] >> 0) & 0x0F; + fg = (ram[offset] >> 4) & 0x0F; + } + else + { + /* monochrome - on a real /// with an RGB monitor, text is white */ + bg = BLACK; + fg = WHITE; + } + + /* inverse? */ + if (!(ch & 0x80)) + { + temp = fg; + fg = bg; + bg = temp; + } + + char_data = &m_char_mem[(ch & 0x7F) * 8]; + + for (row = 0; row < 8; row++) + { + for (col = 0; col < 7; col++) + { + if (m_smoothscr) + { + // get the offset into the group of 8 lines + lc = (col + smooth) & 7; + } + else + { + lc = col; + } + + dest = &bitmap.pix16(y * 8 + row, x * 14 + lc * 2); + dest[0] = (char_data[row] & (1 << col)) ? fg : bg; + dest[1] = (char_data[row] & (1 << col)) ? fg : bg; + } + } + } + } +} + + + +void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap) +{ + int x, y, col, row, lc; + offs_t offset; + UINT8 ch; + const UINT8 *char_data; + pen_t fg, bg; + UINT16 *dest; + UINT8 *ram = m_ram->pointer(); + UINT32 ram_size = m_ram->size(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (y = 0; y < 24; y++) + { + for (x = 0; x < 40; x++) + { + offset = ram_size - 0x8000 + text_map[y] + x; + + /* first character */ + ch = ram[offset + 0x0000]; + char_data = &m_char_mem[(ch & 0x7F) * 8]; + fg = (ch & 0x80) ? GREEN : BLACK; + bg = (ch & 0x80) ? BLACK : GREEN; + + for (row = 0; row < 8; row++) + { + for (col = 0; col < 7; col++) + { + if (m_smoothscr) + { + // get the offset into the group of 8 lines + lc = (col + smooth) & 7; + } + else + { + lc = col; + } + + dest = &bitmap.pix16(y * 8 + row, x * 14 + lc + 0); + *dest = (char_data[row] & (1 << col)) ? fg : bg; + } + } + + /* second character */ + ch = ram[offset + 0x0400]; + char_data = &m_char_mem[(ch & 0x7F) * 8]; + fg = (ch & 0x80) ? GREEN : BLACK; + bg = (ch & 0x80) ? BLACK : GREEN; + + for (row = 0; row < 8; row++) + { + for (col = 0; col < 7; col++) + { + dest = &bitmap.pix16(y * 8 + row, x * 14 + col + 7); + *dest = (char_data[row] & (1 << col)) ? fg : bg; + } + } + } + } +} + + + +void apple3_state::apple3_video_graphics_hgr(bitmap_ind16 &bitmap) +{ + /* hi-res mode: 280x192x2 */ + int y, i, x, ly, lyb; + const UINT8 *pix_info; + UINT16 *ptr; + UINT8 b; + UINT8 *ram = m_ram->pointer(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (y = 0; y < 192; y++) + { + ly = y; + if (m_smoothscr) + { + // get our base Y position + ly = y & ~7; + // get the offset into the group of 8 lines + lyb = ((y % 8) + smooth) & 7; + // add to the base + ly += lyb; + } + + if (m_flags & VAR_VM2) + pix_info = &ram[m_hgr_map[ly]]; + else + pix_info = &ram[m_hgr_map[ly] - 0x2000]; + ptr = &bitmap.pix16(y); + + for (i = 0; i < 40; i++) + { + b = *(pix_info++); + + for (x = 0; x < 7; x++) + { + ptr[0] = ptr[1] = (b & 0x01) ? WHITE : BLACK; + ptr += 2; + b >>= 1; + } + } + } +} + +void apple3_state::apple3_video_graphics_chgr(bitmap_ind16 &bitmap) +{ + /* color hi-res mode: 280x192x16 */ + int y, i, x, ly, lyb; + const UINT8 *pix_info; + const UINT8 *col_info; + UINT16 *ptr; + UINT8 b; + UINT16 fgcolor, bgcolor; + UINT8 *ram = m_ram->pointer(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (y = 0; y < 192; y++) + { + ly = y; + if (m_smoothscr) + { + // get our base Y position + ly = y & ~7; + // get the offset into the group of 8 lines + lyb = ((y % 8) + smooth) & 7; + // add to the base + ly += lyb; + } + + if (m_flags & VAR_VM2) + { + pix_info = &ram[m_hgr_map[ly] + 0x2000]; + col_info = &ram[m_hgr_map[ly] + 0x4000]; + } + else + { + pix_info = &ram[m_hgr_map[ly] - 0x2000]; + col_info = &ram[m_hgr_map[ly]]; + } + ptr = &bitmap.pix16(y); + + for (i = 0; i < 40; i++) + { + bgcolor = ((*col_info >> 0) & 0x0F) + 16; + fgcolor = ((*col_info >> 4) & 0x0F) + 16; + + b = *pix_info; + + for (x = 0; x < 7; x++) + { + ptr[0] = ptr[1] = (b & 1) ? fgcolor : bgcolor; + ptr += 2; + b >>= 1; + } + pix_info++; + col_info++; + } + } +} + + + +void apple3_state::apple3_video_graphics_shgr(bitmap_ind16 &bitmap) +{ + /* super hi-res mode: 560x192x2 */ + int y, i, x, ly, lyb; + const UINT8 *pix_info1; + const UINT8 *pix_info2; + UINT16 *ptr; + UINT8 b1, b2; + UINT8 *ram = m_ram->pointer(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (y = 0; y < 192; y++) + { + ly = y; + if (m_smoothscr) + { + // get our base Y position + ly = y & ~7; + // get the offset into the group of 8 lines + lyb = ((y % 8) + smooth) & 7; + // add to the base + ly += lyb; + } + + if (m_flags & VAR_VM2) + { + pix_info1 = &ram[m_hgr_map[ly] + 0x2000]; + pix_info2 = &ram[m_hgr_map[ly] + 0x4000]; + } + else + { + pix_info1 = &ram[m_hgr_map[ly] - 0x2000]; + pix_info2 = &ram[m_hgr_map[ly]]; + } + ptr = &bitmap.pix16(y); + + for (i = 0; i < 40; i++) + { + b1 = *(pix_info1++); + b2 = *(pix_info2++); + + for (x = 0; x < 7; x++) + { + *(ptr++) = (b1 & 0x01) ? WHITE : BLACK; + b1 >>= 1; + } + + for (x = 0; x < 7; x++) + { + *(ptr++) = (b2 & 0x01) ? WHITE : BLACK; + b2 >>= 1; + } + } + } +} + + + +void apple3_state::apple3_video_graphics_chires(bitmap_ind16 &bitmap) +{ + UINT16 *pen; + UINT8 p1, p2, p3, p4; + int y, i, ly, lyb; + UINT8 *ram = m_ram->pointer(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (y = 0; y < 192; y++) + { + ly = y; + if (m_smoothscr) + { + // get our base Y position + ly = y & ~7; + // get the offset into the group of 8 lines + lyb = ((y % 8) + smooth) & 7; + // add to the base + ly += lyb; + } + + pen = &bitmap.pix16(y); + for (i = 0; i < 20; i++) + { + if (m_flags & VAR_VM2) + { + p1 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 0]; + p2 = ram[m_hgr_map[ly] + 0x4000 + (i * 2) + 0]; + p3 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 1]; + p4 = ram[m_hgr_map[ly] + 0x4000 + (i * 2) + 1]; + } + else + { + p1 = ram[m_hgr_map[ly] - 0x2000 + (i * 2) + 0]; + p2 = ram[m_hgr_map[ly] - 0x0000 + (i * 2) + 0]; + p3 = ram[m_hgr_map[ly] - 0x2000 + (i * 2) + 1]; + p4 = ram[m_hgr_map[ly] - 0x0000 + (i * 2) + 1]; + } + + pen[ 0] = pen[ 1] = pen[ 2] = pen[ 3] = (p1 & 0x0f); + pen[ 4] = pen[ 5] = pen[ 6] = pen[ 7] = ((p1 >> 4) & 0x07) | ((p2 & 1) << 3); + pen[ 8] = pen[ 9] = pen[10] = pen[11] = ((p2 >> 1) & 0x0F); + pen[12] = pen[13] = pen[14] = pen[15] = ((p2 >> 5) & 0x03) | ((p3 & 3) << 2); + pen[16] = pen[17] = pen[18] = pen[19] = ((p3 >> 2) & 0x0F); + pen[20] = pen[21] = pen[22] = pen[23] = ((p3 >> 6) & 0x01) | ((p4 << 1) & 0xe); + pen[24] = pen[25] = pen[26] = pen[27] = ((p4 >> 3) & 0x0F); + pen += 28; + } + } +} + + + +UINT32 apple3_state::screen_update_apple3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +// printf("gfx mode %x\n", m_flags & (VAR_VM3|VAR_VM1|VAR_VM0)); + + switch(m_flags & (VAR_VM3|VAR_VM1|VAR_VM0)) + { + case 0: + case VAR_VM0: + apple3_video_text40(bitmap); + break; + + case VAR_VM1: + case VAR_VM1|VAR_VM0: + apple3_video_text80(bitmap); + break; + + case VAR_VM3: + apple3_video_graphics_hgr(bitmap); /* hgr mode */ + break; + + case VAR_VM3|VAR_VM0: + apple3_video_graphics_chgr(bitmap); + break; + + case VAR_VM3|VAR_VM1: + apple3_video_graphics_shgr(bitmap); + break; + + case VAR_VM3|VAR_VM1|VAR_VM0: + apple3_video_graphics_chires(bitmap); + break; + } + return 0; +} diff --git a/src/mame/video/aquarius.c b/src/mame/video/aquarius.c new file mode 100644 index 00000000000..3d644bfd8b2 --- /dev/null +++ b/src/mame/video/aquarius.c @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/*************************************************************************** + + aquarius.c + + Functions to emulate the video hardware of the aquarius. + +***************************************************************************/ + +#include "emu.h" +#include "includes/aquarius.h" + + +static const unsigned short aquarius_palette[] = +{ + 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0,10, 0,11, 0,12, 0,13, 0,14, 0,15, 0, + 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1,10, 1,11, 1,12, 1,13, 1,14, 1,15, 1, + 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2,10, 2,11, 2,12, 2,13, 2,14, 2,15, 2, + 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3,10, 3,11, 3,12, 3,13, 3,14, 3,15, 3, + 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4,10, 4,11, 4,12, 4,13, 4,14, 4,15, 4, + 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5,10, 5,11, 5,12, 5,13, 5,14, 5,15, 5, + 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, 6,10, 6,11, 6,12, 6,13, 6,14, 6,15, 6, + 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, 7, 8, 7, 9, 7,10, 7,11, 7,12, 7,13, 7,14, 7,15, 7, + 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, 8, 8, 8, 9, 8,10, 8,11, 8,12, 8,13, 8,14, 8,15, 8, + 0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9, 9, 9,10, 9,11, 9,12, 9,13, 9,14, 9,15, 9, + 0,10, 1,10, 2,10, 3,10, 4,10, 5,10, 6,10, 7,10, 8,10, 9,10,10,10,11,10,12,10,13,10,14,10,15,10, + 0,11, 1,11, 2,11, 3,11, 4,11, 5,11, 6,11, 7,11, 8,11, 9,11,10,11,11,11,12,11,13,11,14,11,15,11, + 0,12, 1,12, 2,12, 3,12, 4,12, 5,12, 6,12, 7,12, 8,12, 9,12,10,12,11,12,12,12,13,12,14,12,15,12, + 0,13, 1,13, 2,13, 3,13, 4,13, 5,13, 6,13, 7,13, 8,13, 9,13,10,13,11,13,12,13,13,13,14,13,15,13, + 0,14, 1,14, 2,14, 3,14, 4,14, 5,14, 6,14, 7,14, 8,14, 9,14,10,14,11,14,12,14,13,14,14,14,15,14, + 0,15, 1,15, 2,15, 3,15, 4,15, 5,15, 6,15, 7,15, 8,15, 9,15,10,15,11,15,12,15,13,15,14,15,15,15, +}; + +PALETTE_INIT_MEMBER(aquarius_state, aquarius) +{ + int i; + + for (i = 0; i < 16; i++) + m_palette->set_indirect_color(i, m_tea1002->color(i)); + + for (i = 0; i < 512; i++) + m_palette->set_pen_indirect(i, aquarius_palette[i]); +} + +WRITE8_MEMBER(aquarius_state::aquarius_videoram_w) +{ + UINT8 *videoram = m_videoram; + videoram[offset] = data; + m_tilemap->mark_tile_dirty(offset); +} + +WRITE8_MEMBER(aquarius_state::aquarius_colorram_w) +{ + m_colorram[offset] = data; + m_tilemap->mark_tile_dirty(offset); +} + +TILE_GET_INFO_MEMBER(aquarius_state::aquarius_gettileinfo) +{ + UINT8 *videoram = m_videoram; + int bank = 0; + int code = videoram[tile_index]; + int color = m_colorram[tile_index]; + int flags = 0; + + SET_TILE_INFO_MEMBER(bank, code, color, flags); +} + +void aquarius_state::video_start() +{ + m_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(aquarius_state::aquarius_gettileinfo),this), TILEMAP_SCAN_ROWS, 8, 8, 40, 25); +} + +UINT32 aquarius_state::screen_update_aquarius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} diff --git a/src/mame/video/arcadia.c b/src/mame/video/arcadia.c new file mode 100644 index 00000000000..869439aef10 --- /dev/null +++ b/src/mame/video/arcadia.c @@ -0,0 +1,676 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** +Consolidation and enhancment of documentation by Manfred Schneider based on previous work from + PeT mess@utanet.at and Paul Robson (autismuk@aol.com) + + Schematics, manuals and anything you can desire for at http://amigan.1emu.net/ + + TODO: find a dump of the charactyer ROM + convert the drawing code to tilemap + + emulation of signetics 2637 video/audio device + +General +The UVI is capable of controlling 512 Bytes of RAM. It also generates a select signal +for a 128 byte wide area. +This whole addres space maps in the arcadia and compatible machines from $1800 - $1AFF. + +1. Video Memory + +The screen table is at 1800-CF and 1A00-CF. Each page has 13 lines of the +screen (16 bytes per line,26 lines in total, 208 scan lines). The 2 most +significant bits of each byte are colour data, the 6 least significant +are character data. The resolution of the Arcadia is 128 x 208 pixels. + +It is possible to halve the screen resolution so 1A00..1ACF can +be used for code. This is controlled by bit 6 of $19F8. + +The byte at location $18FF is the current Character Line address, lower +4 bits only. The start line goes from 1800 to 18C0 then from 1900 to 19C0. +The 4 least significant bits of this count 0123456789ABC0123456789ABC, +going to D when in vertical blank. The 4 most significant bits are always +'1'. Some games do use this for scrolling effects - a good example of this +is the routine at $010F in Alien Invaders which scrolls the various bits of +the screen about using the memory locations $18FF and $18FE. + +The screen can be scrolled upto 7 pixels to the left using the high 3 bits +of $18FE. This is used in Alien Invaders. + +A line beginning with $C0 contains block graphics. Each square contains +3 wide x 2 high pixels, coloured as normal. The 3 least significant bits +are the top, the next 3 bits are the bottom. Alien Invaders uses this for +shields. The graphics are returned to normal for the next line. + +The VBlank signal (maybe VSYNC) is connected to the SENSE input. This is +logic '1' when the system is in VBLANK. + +The Flag line does.... something graphical - it might make the sprites +half width/double height perhaps. Breakaway sets this when the bats are +double size in vertical mode. + + +2. Character codes + +Character codes 00..37 to be in a ROM somewhere in the Emerson. These +are known, others may be discovered by comparing the screen snapshots +against the character tables. If the emulator displays an exclamation +mark you've found one. Get a snapshot to see what it looks like +normally and let me know. Codes 38..3F are taken from RAM. + +00 (space) +01..0F Graphic Characters +10..19 0..9 +1A..33 A..Z +34 Decimal Point +35 comma +36 + +37 $ +38..3F User Defined Characters (8 off, from 1980..19FF) + +Character data is stored 8 bits per character , as a single plane graphic +The 2nd and 3rd bits of palette data come from the screen tables, so there +are two colours per character and 4 possible palette selections for the +background. + + +3. Sound + +fixed frequency sound and random Noise generator. +18FD pitch (lower 7 bits) +18FE volume ( bits 0 - 2) +18fe bit 3 set means sound on +18fe bit 4 set means random noise on + +Calculation of sound frequency is done as follows + 1/Freq = 2 (pitch +1) * (horizontal line period) + + +4. Sprites + +Sprite pointers are at 18F0..18F7 (there are four of them). The graphics +used are the ones in the 1980..19BF UDG table (the first four). + +Sprite addresses (x,y) are converted to offsets in the 128 x 208 as follows: + +1) 1's complement the y coordinate +2) subtract 16 from the y coordinate +3) subtract 43 from the x coordinate + +5. Palette + +The Palette is encoded between 19F8-19FB. This section describes the method +by which colours are allocated. There are 8 colours, information is coded +3 bits per colour (usually 2 colours per byte) + + Colour Code Name + ------ ----- ------- + 7 111 Black + 6 110 Blue + 5 101 Red + 4 100 Magenta + 3 011 Green + 2 010 Cyan + 1 001 Yellow + 0 000 White + +Bits 0..2 of $19F9 are the screen colour +Bits 3..5 of $19F9 are the colours of characters +Bit 6 of $19f9 is for poti axis +Bit 7 of $19f9 is for character size (1 = 8x8; 0 = 8x16) +Bits 0..5 of $19FA are the colours of Sprites 2 & 3 (sprite 3 is low bits) +Bit 6 of $19FA is for size of sprite 3 (0 = 8x16; 1 = 8x8) +Bit 7 of $19FA is for size of sprite 2 (0 = 8x16; 1 = 8x8) +Bits 0..5 of $19FB are the colours of Sprites 0 & 1 (sprite 1 is low bits) +Bit 6 of $19FB is for size of sprite 1 (0 = 8x16; 1 = 8x8) +Bit 7 of $19FB is for size of sprite 0 (0 = 8x16; 1 = 8x8) + + +6. Collision Detection + +Bits are set to zero on a collision - I think they are reset at the +frame start. There are two locations : one is for sprite/background +collisions, one is for sprite/sprite collisions. + +19FC bits 0..3 are collision between sprites 0..3 and the background. + +19FD bit 0 is sprite 0 / 1 collision + bit 1 is sprite 0 / 2 collision + bit 2 is sprite 0 / 3 collision + bit 3 is sprite 1 / 2 collision + bit 4 is sprite 1 / 3 collision (guess) + bit 5 is sprite 2 / 3 collision (guess) + + +7. Graphic Mode +19f8 bit 7 graphics mode on (lower 6 bits descripe rectangles) +0xc0 in line switches to graphics mode in this line +0x40 in line switches to char mode in this line + 22211100 + 22211100 + 22211100 + 22211100 + 55544433 + 55544433 + 55544433 + 55544433 + + 8. Memory Map + The offsets in the following memory Map are from the view of the UVI. + In the arcadia and compatibles the base offset is $1800 thats how the CPU sees the UVI + + 0000 - 00FF external RAM + 0000 - 00CF upper screen character/graphics codes organised as 16 char x 13 rows + 00D0 - 00EF RAM (not used by UVI, can be used by CPU) + 00F0 vertical offset object 0 + 00F1 horizontal offset object 0 + 00F2 vertical offset object 1 + 00F3 horizontal offset object 1 + 00F4 vertical offset object 2 + 00F5 horizontal offset object 2 + 00F6 vertical offset object 3 + 00F7 horizontal offset object 3 + 00F8 - 00FB RAM (not used by UVI, can be used by CPU) + 00FC complement number of rows from the trailing edge of VRST + to the start of character display + 00FD bit0 - 6 sound frequeny, bit 7 color mode + 00FE bit0 - 2 loudness, bit 3 sound enable when set, bit 4 random noise enable when set + bit 5 - 7 delay for row of characters + 00FF bit 0 - 3 DMA number, bit 4 - 7 unused +0100 - 017F CE area. In arcadia used for keypad. +0180 - 01FF internal UVI registers + 0180 - 0187 image of object 0 or UDC-code $38 + 0188 - 018F image of object 1 or UDC-code $39 + 0190 - 0197 image of object 2 or UDC-code $3A + 0198 - 019F image of object 3 or UDC-code $3B + 01A0 - 01A7 image of UDC-code $3C + 01A8 - 01AF image of UDC-code $3D + 01B0 - 01B7 image of UDC-code $3E + 01B8 - 01BF image of UDC-code $3F + 01C0 - 01F7 unused + 01F8 bit 0 - 2 alternate screen color, bit 3 - 5 alternate character color + bit 6 Refresh mode when set entire character field will be display twice + bit 7 Grahics mode + 01F9 bit 0 - 2 screen color, bit 3 - 5 character color + bit 6 poti mux control + bit 7 character size when set size=8x8 else size=8x16 + 01FA bit 0 - 2 color of object 3, bit 3 - 5 color of object 2 + bit 6 size of object 3 when set size=8x8 else size=8x16 + bit 7 size of object 2 when set size=8x8 else size=8x16 + 01FB bit 0 - 2 color of object 1, bit 3 - 5 color of object 0 + bit 6 size of object 1 when set size=8x8 else size=8x16 + bit 7 size of object 0 when set size=8x8 else size=8x16 + 01FC object - character collision bits + bit 0 when low object 0 collided with character + bit 1 when low object 1 collided with character + bit 2 when low object 2 collided with character + bit 3 when low object 3 collided with character + bit 4 - 7 unused set to high + 01FD inter object collision + bit 0 - when low object 1 and 2 collide + bit 1 - when low object 1 and 3 collide + bit 2 - when low object 1 and 4 collide + bit 3 - when low object 2 and 3 collide + bit 4 - when low object 2 and 4 collide + bit 5 - when low object 3 and 4 collide + bit 6 - 7 unused set to high + 01FE digital value of POT1 or POT3 input. Valid only during VRST + 01FF digital value of POT2 or POT4 input. Valid only furing VRST +0200 - 02FF 2nd external RAM + 0200 - 02CF lower screen character/graphics codes organised as 16 char x 13 rows + 02D0 - 02FF RAM (not used by UVI, can be used by CPU) +*/ + + +#include "includes/arcadia.h" + +static const UINT8 chars[0x40][8]={ + // read from the screen generated from a palladium + { 0,0,0,0,0,0,0,0 }, // 00 (space) + { 1,2,4,8,16,32,64,128 }, // 01 (\) + { 128,64,32,16,8,4,2,1 }, // 02 (/) + { 255,255,255,255,255,255,255,255 }, // 03 (solid block) + { 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00 },// 04 (?) + { 3,3,3,3,3,3,3,3 }, // 05 (half square right on) + { 0,0,0,0,0,0,255,255 }, // 06 (horz lower line) + { 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },// 07 (half square left on) + { 0xff,0xff,3,3,3,3,3,3 }, // 08 (?) + { 0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },// 09 (?) + { 192,192,192,192,192,192,255,255 }, // 0A (!_) + { 3,3,3,3,3,3,255,255 }, // 0B (_!) + { 1,3,7,15,31,63,127,255 }, // 0C (diagonal block) + { 128,192,224,240,248,252,254,255 }, // 0D (diagonal block) + { 255,254,252,248,240,224,192,128 }, // 0E (diagonal block) + { 255,127,63,31,15,7,3,1 }, // 0F (diagonal block) + { 0x00,0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c },// 10 0 + { 0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x1c },// 11 1 + { 0x00,0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e },// 12 2 + { 0x00,0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c },// 13 3 + { 0x00,0x04,0x0c,0x14,0x24,0x3e,0x04,0x04 },// 14 4 + { 0x00,0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c },// 15 5 + { 0x00,0x0c,0x10,0x20,0x3c,0x22,0x22,0x1c },// 16 6 + { 0x00,0x7c,0x02,0x04,0x08,0x10,0x10,0x10 },// 17 7 + { 0x00,0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c },// 18 8 + { 0x00,0x1c,0x22,0x22,0x3e,0x02,0x04,0x18 },// 19 9 + { 0x00,0x08,0x14,0x22,0x22,0x3e,0x22,0x22 },// 1A A + { 0x00,0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c },// 1B B + { 0x00,0x1c,0x22,0x20,0x20,0x20,0x22,0x1c },// 1C C + { 0x00,0x3c,0x22,0x22,0x22,0x22,0x22,0x3c },// 1D D + { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e },// 1E E + { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x20 },// 1F F + { 0x00,0x1e,0x20,0x20,0x20,0x26,0x22,0x1e },// 20 G + { 0x00,0x22,0x22,0x22,0x3e,0x22,0x22,0x22 },// 21 H + { 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x1c },// 22 I + { 0x00,0x02,0x02,0x02,0x02,0x02,0x22,0x1c },// 23 J + { 0x00,0x22,0x24,0x28,0x30,0x28,0x24,0x22 },// 24 K + { 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x3e },// 25 L + { 0x00,0x22,0x36,0x2a,0x2a,0x22,0x22,0x22 },// 26 M + { 0x00,0x22,0x22,0x32,0x2a,0x26,0x22,0x22 },// 27 N + { 0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c },// 28 O + { 0x00,0x3c,0x22,0x22,0x3c,0x20,0x20,0x20 },// 29 P + { 0x00,0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a },// 2A Q + { 0x00,0x3c,0x22,0x22,0x3c,0x28,0x24,0x22 },// 2B R + { 0x00,0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c },// 2C S + { 0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08 },// 2D T + { 0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1c },// 2E U + { 0x00,0x22,0x22,0x22,0x22,0x22,0x14,0x08 },// 2F V + { 0x00,0x22,0x22,0x22,0x2a,0x2a,0x36,0x22 },// 30 W + { 0x00,0x22,0x22,0x14,0x08,0x14,0x22,0x22 },// 31 X + { 0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08 },// 32 Y + { 0x00,0x3e,0x02,0x04,0x08,0x10,0x20,0x3e },// 33 Z + { 0,0,0,0,0,0,0,8 }, // 34 . + { 0,0,0,0,0,8,8,0x10 }, // 35 , + { 0,0,8,8,0x3e,8,8,0 }, // 36 + + { 0,8,0x1e,0x28,0x1c,0xa,0x3c,8 }, // 37 $ + // 8x user defined +}; + +void arcadia_state::video_start() +{ + int i; + memcpy(&m_chars, chars, sizeof(chars)); + for (i=0; i<0x40; i++) + { + m_rectangle[i][0]=0; + m_rectangle[i][4]=0; + if (i&1) m_rectangle[i][0]|=3; + if (i&2) m_rectangle[i][0]|=0x1c; + if (i&4) m_rectangle[i][0]|=0xe0; + if (i&8) m_rectangle[i][4]|=3; + if (i&0x10) m_rectangle[i][4]|=0x1c; + if (i&0x20) m_rectangle[i][4]|=0xe0; + m_rectangle[i][1]=m_rectangle[i][2]=m_rectangle[i][3]=m_rectangle[i][0]; + m_rectangle[i][5]=m_rectangle[i][6]=m_rectangle[i][7]=m_rectangle[i][4]; + } + + { + int width = m_screen->width(); + int height = m_screen->height(); + m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); + } +} + +READ8_MEMBER( arcadia_state::video_r ) +{ + UINT8 data=0; + switch (offset) + { + case 0xff: data = m_charline|0xf0;break; + case 0x100: data = m_controller1_col1->read();break; + case 0x101: data = m_controller1_col2->read();break; + case 0x102: data = m_controller1_col3->read();break; + case 0x103: data = m_controller1_extra->read();break; + case 0x104: data = m_controller2_col1->read();break; + case 0x105: data = m_controller2_col2->read();break; + case 0x106: data = m_controller2_col3->read();break; + case 0x107: data = m_controller2_extra->read();break; + case 0x108: data = m_panel->read();break; +#if 0 + case 0x1fe: + if (m_ad_select) + data=ioport("controller1_joy_y")->read()<<3; + else + data=ioport("controller1_joy_x")->read()<<3; + break; + case 0x1ff: + if (m_ad_select) + data=ioport("controller2_joy_y")->read()<<3; + else + data=ioport("controller2_joy_x")->read()<<3; + break; +#else + case 0x1fe: + data = 0x80; + if (m_ad_select) + { + if (m_joysticks->read()&0x10) data=0; + if (m_joysticks->read()&0x20) data=0xff; + } + else + { + if (m_joysticks->read()&0x40) data=0xff; + if (m_joysticks->read()&0x80) data=0; + } + break; + case 0x1ff: + data = 0x6f; // 0x7f too big for alien invaders (move right) + if (m_ad_select) + { + if (m_joysticks->read()&0x1) data=0; + if (m_joysticks->read()&0x2) data=0xff; + } + else + { + if (m_joysticks->read()&0x4) data=0xff; + if (m_joysticks->read()&0x8) data=0; + } + break; +#endif + default: + data = m_reg.data[offset]; + } + return data; +} + +WRITE8_MEMBER( arcadia_state::video_w ) +{ + m_reg.data[offset]=data; + switch (offset) + { + case 0xfc: + m_ypos=255-data+YPOS; + break; + case 0xfd: + m_custom->write(space, offset&3, data); + m_multicolor = data & 0x80; + break; + case 0xfe: + m_custom->write(space, offset&3, data); + m_shift = (data>>5); + break; + case 0xf0: + case 0xf2: + case 0xf4: + case 0xf6: + m_pos[(offset>>1)&3].y = (data^0xff)+1; + break; + case 0xf1: + case 0xf3: + case 0xf5: + case 0xf7: + m_pos[(offset>>1)&3].x = data-43; + break; + case 0x180: case 0x181: case 0x182: case 0x183: case 0x184: case 0x185: case 0x186: case 0x187: + case 0x188: case 0x189: case 0x18a: case 0x18b: case 0x18c: case 0x18d: case 0x18e: case 0x18f: + case 0x190: case 0x191: case 0x192: case 0x193: case 0x194: case 0x195: case 0x196: case 0x197: + case 0x198: case 0x199: case 0x19a: case 0x19b: case 0x19c: case 0x19d: case 0x19e: case 0x19f: + case 0x1a0: case 0x1a1: case 0x1a2: case 0x1a3: case 0x1a4: case 0x1a5: case 0x1a6: case 0x1a7: + case 0x1a8: case 0x1a9: case 0x1aa: case 0x1ab: case 0x1ac: case 0x1ad: case 0x1ae: case 0x1af: + case 0x1b0: case 0x1b1: case 0x1b2: case 0x1b3: case 0x1b4: case 0x1b5: case 0x1b6: case 0x1b7: + case 0x1b8: case 0x1b9: case 0x1ba: case 0x1bb: case 0x1bc: case 0x1bd: case 0x1be: case 0x1bf: + m_chars[0x38|((offset>>3)&7)][offset&7] = data; + break; + case 0x1f8: + m_lines26 = data & 0x40; + m_graphics = data & 0x80; + break; + case 0x1f9: + m_doublescan =! (data&0x80); + m_ad_delay = 10; + break; + } +} + +void arcadia_state::draw_char(UINT8 *ch, int charcode, int y, int x) +{ + int k,b,cc,sc, colour; + if (m_multicolor) + { + if (charcode&0x40) + cc=((m_reg.d.pal[1]>>3)&7); + else + cc=((m_reg.d.pal[0]>>3)&7); + + if (charcode&0x80) + sc=(m_reg.d.pal[1]&7); + else + sc=(m_reg.d.pal[0]&7); + } + else + { + cc=((m_reg.d.pal[1]>>3)&1)|((charcode>>5)&6); + sc=(m_reg.d.pal[1]&7); + } + colour = (((sc << 3) | cc) + 4); + + if (m_doublescan) + { + for (k=0; (k<8)&&(yheight()); k++, y+=2) + { + b=ch[k]; + m_bg[y][x>>3]|=b>>(x&7); + m_bg[y][(x>>3)+1]|=b<<(8-(x&7)); + + if (y+1height()) + { + m_bg[y+1][x>>3]|=b>>(x&7); + m_bg[y+1][(x>>3)+1]|=b<<(8-(x&7)); + m_gfxdecode->gfx(0)->opaque(*m_bitmap,m_bitmap->cliprect(), b,colour, 0,0,x,y); + m_gfxdecode->gfx(0)->opaque(*m_bitmap,m_bitmap->cliprect(), b,colour, 0,0,x,y+1); + } + } + } + else + { + for (k=0; (k<8)&&(yheight()); k++, y++) + { + b=ch[k]; + m_bg[y][x>>3]|=b>>(x&7); + m_bg[y][(x>>3)+1]|=b<<(8-(x&7)); + + m_gfxdecode->gfx(0)->opaque(*m_bitmap,m_bitmap->cliprect(), b,colour, 0,0,x,y); + } + } +} + + +void arcadia_state::vh_draw_line(int y, UINT8 chars1[16]) +{ + int x, ch, j, h; + int graphics = m_graphics; + h = m_doublescan ? 16 : 8 ; + + if (m_bitmap->height() - m_line < h) + h = m_bitmap->height() - m_line; + + m_bitmap->plot_box(0, y, m_bitmap->width(), h, (m_reg.d.pal[1]&7)); + memset(m_bg[y], 0, sizeof(m_bg[0])*h); + + for (x=XPOS+m_shift, j=0; j<16;j++,x+=8) + { + ch=chars1[j]; +// hangman switches with 0x40 +// alien invaders shield lines start with 0xc0 + if ((ch&0x3f)==0) + { + switch (ch) + { + case 0xc0: graphics=TRUE;break; + case 0x40: graphics=FALSE;break; +// case 0x80: +// alien invaders shields are empty 0x80 +// popmessage(5, "graphics code 0x80 used"); + } + } + if (graphics) + draw_char(m_rectangle[ch&0x3f], ch, y, x); + else + draw_char(m_chars[ch&0x3f], ch, y, x); + } +} + + +int arcadia_state::sprite_collision(int n1, int n2) +{ + int k, b1, b2, x; + if (m_pos[n1].x+8<=m_pos[n2].x) + return FALSE; + if (m_pos[n1].x>=m_pos[n2].x+8) + return FALSE; + + for (k=0; k<8; k++) + { + if (m_pos[n1].y+k=m_pos[n2].y+8) + break; + x=m_pos[n1].x-m_pos[n2].x; + b1=m_reg.d.chars[n1][k]; + b2=m_reg.d.chars[n2][m_pos[n1].y+k-m_pos[n2].y]; + if (x<0) + b2>>=-x; + if (x>0) + b1>>=x; + if (b1&b2) + return TRUE; + } + return FALSE; +} + + +void arcadia_state::draw_sprites() +{ + int i, k, x, y, color=0; + UINT8 b; + + m_reg.d.collision_bg|=0xf; + m_reg.d.collision_sprite|=0x3f; + for (i=0; i<4; i++) + { + int doublescan = FALSE; + if (m_pos[i].y<=-YPOS) continue; + if (m_pos[i].y>=m_bitmap->height()-YPOS-8) continue; + if (m_pos[i].x<=-XPOS) continue; + if (m_pos[i].x>=128+XPOS-8) continue; + + switch (i) + { + case 0: + color=(m_reg.d.pal[3]>>3)&7; + doublescan=m_reg.d.pal[3]&0x80?FALSE:TRUE; + break; + case 1: + color=m_reg.d.pal[3]&7; + doublescan=m_reg.d.pal[3]&0x40?FALSE:TRUE; + break; + case 2: + color=(m_reg.d.pal[2]>>3)&7; + doublescan=m_reg.d.pal[2]&0x80?FALSE:TRUE; + break; + case 3: + color=m_reg.d.pal[2]&7; + doublescan=m_reg.d.pal[2]&0x40?FALSE:TRUE; + break; + } + for (k=0; k<8; k++) + { + int j, m; + b=m_reg.d.chars[i][k]; + x=m_pos[i].x+XPOS; + if (!doublescan) + { + y=m_pos[i].y+YPOS+k; + for (j=0,m=0x80; j<8; j++, m>>=1) + { + if (b & m) + m_bitmap->pix16(y, x + j) = color; + } + } + else + { + y=m_pos[i].y+YPOS+k*2; + for (j=0,m=0x80; j<8; j++, m>>=1) + { + if (b & m) + { + m_bitmap->pix16(y, x + j) = color; + m_bitmap->pix16(y+1, x + j) = color; + } + } + } + if (m_reg.d.collision_bg&(1<>3]<<8) | m_bg[y][(x>>3)+1]) ) + m_reg.d.collision_bg&=~(1<width(); + + if (m_ad_delay<=0) + m_ad_select=m_reg.d.pal[1]&0x40; + else m_ad_delay--; + + m_line++; + m_line%=262; + // unbelievable, reflects only charline, but alien invaders uses it for + // alien scrolling + + if (m_lineplot_box(0, m_line, width, 1, (m_reg.d.pal[1])&7); + memset(m_bg[m_line], 0, sizeof(m_bg[0])); + } + else + { + int h=m_doublescan?16:8; + + m_charline=(m_line-m_ypos)/h; + + if (m_charline<13) + { + if (((m_line-m_ypos)&(h-1))==0) + { + vh_draw_line(m_charline*h+m_ypos, m_reg.d.chars1[m_charline]); + } + } + else + if (m_lines26 && (m_charline<26)) + { + if (((m_line-m_ypos)&(h-1))==0) + { + vh_draw_line(m_charline*h+m_ypos, m_reg.d.chars2[m_charline-13]); + } + m_charline-=13; + } + else + { + m_charline=0xd; + m_bitmap->plot_box(0, m_line, width, 1, (m_reg.d.pal[1])&7); + memset(m_bg[m_line], 0, sizeof(m_bg[0])); + } + } + if (m_line==261) + draw_sprites(); +} + +READ8_MEMBER( arcadia_state::vsync_r ) +{ + return m_line>=216 ? 0x80 : 0 ; +} + +UINT32 arcadia_state::screen_update_arcadia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, *m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} diff --git a/src/mame/video/atarist.c b/src/mame/video/atarist.c new file mode 100644 index 00000000000..2c80d6beb9a --- /dev/null +++ b/src/mame/video/atarist.c @@ -0,0 +1,1131 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Olivier Galibert +/* + + TODO: + + - rewrite shifter + - STe pixelofs + - blitter hog + - high resolution + +*/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/ram.h" +#include "video/atarist.h" +#include "includes/atarist.h" + + + +//************************************************************************** +// CONSTANTS / MACROS +//************************************************************************** + +#define LOG 0 + +static const int BLITTER_NOPS[16][4] = +{ + { 1, 1, 1, 1 }, + { 2, 2, 3, 3 }, + { 2, 2, 3, 3 }, + { 1, 1, 2, 2 }, + { 2, 2, 3, 3 }, + { 2, 2, 2, 2 }, + { 2, 2, 3, 3 }, + { 2, 2, 3, 3 }, + { 2, 2, 3, 3 }, + { 2, 2, 3, 3 }, + { 2, 2, 2, 2 }, + { 2, 2, 3, 3 }, + { 1, 1, 2, 2 }, + { 2, 2, 3, 3 }, + { 2, 2, 3, 3 }, + { 1, 1, 1, 1 } +}; + + +//************************************************************************** +// SHIFTER +//************************************************************************** + +//------------------------------------------------- +// shift_mode_0 - +//------------------------------------------------- + +inline pen_t st_state::shift_mode_0() +{ + int color = (BIT(m_shifter_rr[3], 15) << 3) | (BIT(m_shifter_rr[2], 15) << 2) | (BIT(m_shifter_rr[1], 15) << 1) | BIT(m_shifter_rr[0], 15); + + m_shifter_rr[0] <<= 1; + m_shifter_rr[1] <<= 1; + m_shifter_rr[2] <<= 1; + m_shifter_rr[3] <<= 1; + + return m_palette->pen(color); +} + + +//------------------------------------------------- +// shift_mode_1 - +//------------------------------------------------- + +inline pen_t st_state::shift_mode_1() +{ + int color = (BIT(m_shifter_rr[1], 15) << 1) | BIT(m_shifter_rr[0], 15); + + m_shifter_rr[0] <<= 1; + m_shifter_rr[1] <<= 1; + m_shifter_shift++; + + if (m_shifter_shift == 16) + { + m_shifter_rr[0] = m_shifter_rr[2]; + m_shifter_rr[1] = m_shifter_rr[3]; + m_shifter_rr[2] = m_shifter_rr[3] = 0; + m_shifter_shift = 0; + } + + return m_palette->pen(color); +} + + +//------------------------------------------------- +// shift_mode_2 - +//------------------------------------------------- + +inline pen_t st_state::shift_mode_2() +{ + int color = BIT(m_shifter_rr[0], 15); + + m_shifter_rr[0] <<= 1; + m_shifter_shift++; + + switch (m_shifter_shift) + { + case 16: + m_shifter_rr[0] = m_shifter_rr[1]; + m_shifter_rr[1] = m_shifter_rr[2]; + m_shifter_rr[2] = m_shifter_rr[3]; + m_shifter_rr[3] = 0; + break; + + case 32: + m_shifter_rr[0] = m_shifter_rr[1]; + m_shifter_rr[1] = m_shifter_rr[2]; + m_shifter_rr[2] = 0; + break; + + case 48: + m_shifter_rr[0] = m_shifter_rr[1]; + m_shifter_rr[1] = 0; + m_shifter_shift = 0; + break; + } + + return m_palette->pen(color); +} + + +//------------------------------------------------- +// shifter_tick - +//------------------------------------------------- + +void st_state::shifter_tick() +{ + int y = machine().first_screen()->vpos(); + int x = machine().first_screen()->hpos(); + + pen_t pen; + + switch (m_shifter_mode) + { + case 0: + pen = shift_mode_0(); + break; + + case 1: + pen = shift_mode_1(); + break; + + case 2: + pen = shift_mode_2(); + break; + + default: + pen = m_palette->black_pen(); + break; + } + + m_bitmap.pix32(y, x) = pen; +} + + +//------------------------------------------------- +// shifter_load - +//------------------------------------------------- + +inline void st_state::shifter_load() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT16 data = program.read_word(m_shifter_ofs); + + m_shifter_ir[m_shifter_bitplane] = data; + m_shifter_bitplane++; + m_shifter_ofs += 2; + + if (m_shifter_bitplane == 4) + { + m_shifter_bitplane = 0; + + m_shifter_rr[0] = m_shifter_ir[0]; + m_shifter_rr[1] = m_shifter_ir[1]; + m_shifter_rr[2] = m_shifter_ir[2]; + m_shifter_rr[3] = m_shifter_ir[3]; + } +} + + +//------------------------------------------------- +// glue_tick - +//------------------------------------------------- + +void st_state::glue_tick() +{ + int y = machine().first_screen()->vpos(); + int x = machine().first_screen()->hpos(); + + int v = (y >= m_shifter_y_start) && (y < m_shifter_y_end); + int h = (x >= m_shifter_x_start) && (x < m_shifter_x_end); + + if(m_shifter_mode == 1) { + int dt = 8; + h = (x >= m_shifter_x_start-dt) && (x < m_shifter_x_end-dt); + } + int de = h && v; + + if(!x) { + m_shifter_bitplane = 0; + m_shifter_shift = 0; + } + + if (de != m_shifter_de) + { + m_mfp->tbi_w(de); + m_shifter_de = de; + } + + if (de) + { + shifter_load(); + } + + if ((y == m_shifter_vblank_start) && (x == 0)) + { + m_maincpu->set_input_line(M68K_IRQ_4, HOLD_LINE); + m_shifter_ofs = m_shifter_base; + } + + if (x == m_shifter_hblank_start) + { + m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); +// m_shifter_ofs += (m_shifter_lineofs * 2); // STe + } + + pen_t pen; + + switch (m_shifter_mode) + { + case 0: + pen = shift_mode_0(); + m_bitmap.pix32(y, x) = pen; + m_bitmap.pix32(y, x+1) = pen; + pen = shift_mode_0(); + m_bitmap.pix32(y, x+2) = pen; + m_bitmap.pix32(y, x+3) = pen; + pen = shift_mode_0(); + m_bitmap.pix32(y, x+4) = pen; + m_bitmap.pix32(y, x+5) = pen; + pen = shift_mode_0(); + m_bitmap.pix32(y, x+6) = pen; + m_bitmap.pix32(y, x+7) = pen; + break; + + case 1: + pen = shift_mode_1(); + m_bitmap.pix32(y, x) = pen; + pen = shift_mode_1(); + m_bitmap.pix32(y, x+1) = pen; + pen = shift_mode_1(); + m_bitmap.pix32(y, x+2) = pen; + pen = shift_mode_1(); + m_bitmap.pix32(y, x+3) = pen; + pen = shift_mode_1(); + m_bitmap.pix32(y, x+4) = pen; + pen = shift_mode_1(); + m_bitmap.pix32(y, x+5) = pen; + pen = shift_mode_1(); + m_bitmap.pix32(y, x+6) = pen; + pen = shift_mode_1(); + m_bitmap.pix32(y, x+7) = pen; + break; + + case 2: + pen = shift_mode_2(); + break; + + default: + pen = m_palette->black_pen(); + break; + } +} + + +//------------------------------------------------- +// set_screen_parameters - +//------------------------------------------------- + +void st_state::set_screen_parameters() +{ + if (m_shifter_sync & 0x02) + { + m_shifter_x_start = ATARIST_HBDEND_PAL*2; + m_shifter_x_end = ATARIST_HBDSTART_PAL*2; + m_shifter_y_start = ATARIST_VBDEND_PAL; + m_shifter_y_end = ATARIST_VBDSTART_PAL; + m_shifter_hblank_start = ATARIST_HBSTART_PAL*2; + m_shifter_vblank_start = ATARIST_VBSTART_PAL; + } + else + { + m_shifter_x_start = ATARIST_HBDEND_NTSC*2; + m_shifter_x_end = ATARIST_HBDSTART_NTSC*2; + m_shifter_y_start = ATARIST_VBDEND_NTSC; + m_shifter_y_end = ATARIST_VBDSTART_NTSC; + m_shifter_hblank_start = ATARIST_HBSTART_NTSC*2; + m_shifter_vblank_start = ATARIST_VBSTART_NTSC; + } +} + + +//------------------------------------------------- +// shifter_base_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::shifter_base_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0x00: + data = (m_shifter_base >> 16) & 0x3f; + break; + + case 0x01: + data = (m_shifter_base >> 8) & 0xff; + break; + } + + return data; +} + + +//------------------------------------------------- +// shifter_base_w - +//------------------------------------------------- + +WRITE8_MEMBER( st_state::shifter_base_w ) +{ + switch (offset) + { + case 0x00: + m_shifter_base = (m_shifter_base & 0x00ff00) | (data & 0x3f) << 16; + logerror("SHIFTER Video Base Address %06x\n", m_shifter_base); + break; + + case 0x01: + m_shifter_base = (m_shifter_base & 0x3f0000) | (data << 8); + logerror("SHIFTER Video Base Address %06x\n", m_shifter_base); + break; + } +} + + +//------------------------------------------------- +// shifter_counter_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::shifter_counter_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0x00: + data = (m_shifter_ofs >> 16) & 0x3f; + break; + + case 0x01: + data = (m_shifter_ofs >> 8) & 0xff; + break; + + case 0x02: + data = m_shifter_ofs & 0xff; + break; + } + + return data; +} + + +//------------------------------------------------- +// shifter_sync_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::shifter_sync_r ) +{ + return m_shifter_sync; +} + + +//------------------------------------------------- +// shifter_sync_w - +//------------------------------------------------- + +WRITE8_MEMBER( st_state::shifter_sync_w ) +{ + m_shifter_sync = data; + logerror("SHIFTER Sync %x\n", m_shifter_sync); + set_screen_parameters(); +} + + +//------------------------------------------------- +// shifter_mode_r - +//------------------------------------------------- + +READ8_MEMBER( st_state::shifter_mode_r ) +{ + return m_shifter_mode; +} + + +//------------------------------------------------- +// shifter_mode_w - +//------------------------------------------------- + +WRITE8_MEMBER( st_state::shifter_mode_w ) +{ + m_shifter_mode = data; + logerror("SHIFTER Mode %x\n", m_shifter_mode); +} + + +//------------------------------------------------- +// shifter_palette_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::shifter_palette_r ) +{ + return m_shifter_palette[offset] | 0xf888; +} + + +//------------------------------------------------- +// shifter_palette_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::shifter_palette_w ) +{ + m_shifter_palette[offset] = data; + // logerror("SHIFTER Palette[%x] = %x\n", offset, data); + + m_palette->set_pen_color(offset, pal3bit(data >> 8), pal3bit(data >> 4), pal3bit(data)); +} + + + +//************************************************************************** +// STE SHIFTER +//************************************************************************** + +//------------------------------------------------- +// shifter_base_low_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::shifter_base_low_r ) +{ + return m_shifter_base & 0xfe; +} + + +//------------------------------------------------- +// shifter_base_low_w - +//------------------------------------------------- + +WRITE8_MEMBER( ste_state::shifter_base_low_w ) +{ + m_shifter_base = (m_shifter_base & 0x3fff00) | (data & 0xfe); + logerror("SHIFTER Video Base Address %06x\n", m_shifter_base); +} + + +//------------------------------------------------- +// shifter_counter_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::shifter_counter_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 0x00: + data = (m_shifter_ofs >> 16) & 0x3f; + break; + + case 0x01: + data = (m_shifter_ofs >> 8) & 0xff; + break; + + case 0x02: + data = m_shifter_ofs & 0xfe; + break; + } + + return data; +} + + +//------------------------------------------------- +// shifter_counter_w - +//------------------------------------------------- + +WRITE8_MEMBER( ste_state::shifter_counter_w ) +{ + switch (offset) + { + case 0x00: + m_shifter_ofs = (m_shifter_ofs & 0x00fffe) | (data & 0x3f) << 16; + logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs); + break; + + case 0x01: + m_shifter_ofs = (m_shifter_ofs & 0x3f00fe) | (data << 8); + logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs); + break; + + case 0x02: + m_shifter_ofs = (m_shifter_ofs & 0x3fff00) | (data & 0xfe); + logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs); + break; + } +} + + +//------------------------------------------------- +// shifter_palette_w - +//------------------------------------------------- + +WRITE16_MEMBER( ste_state::shifter_palette_w ) +{ + int r = ((data >> 7) & 0x0e) | BIT(data, 11); + int g = ((data >> 3) & 0x0e) | BIT(data, 7); + int b = ((data << 1) & 0x0e) | BIT(data, 3); + + m_shifter_palette[offset] = data; + logerror("SHIFTER palette %x = %x\n", offset, data); + + m_palette->set_pen_color(offset, r, g, b); +} + + +//------------------------------------------------- +// shifter_lineofs_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::shifter_lineofs_r ) +{ + return m_shifter_lineofs; +} + + +//------------------------------------------------- +// shifter_lineofs_w - +//------------------------------------------------- + +WRITE8_MEMBER( ste_state::shifter_lineofs_w ) +{ + m_shifter_lineofs = data; + logerror("SHIFTER Line Offset %x\n", m_shifter_lineofs); +} + + +//------------------------------------------------- +// shifter_pixelofs_r - +//------------------------------------------------- + +READ8_MEMBER( ste_state::shifter_pixelofs_r ) +{ + return m_shifter_pixelofs; +} + + +//------------------------------------------------- +// shifter_pixelofs_w - +//------------------------------------------------- + +WRITE8_MEMBER( ste_state::shifter_pixelofs_w ) +{ + m_shifter_pixelofs = data & 0x0f; + logerror("SHIFTER Pixel Offset %x\n", m_shifter_pixelofs); +} + + + +//************************************************************************** +// BLITTER +//************************************************************************** + +//------------------------------------------------- +// blitter_source - +//------------------------------------------------- + +void st_state::blitter_source() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + UINT16 data = program.read_word(m_blitter_src); + + if (m_blitter_src_inc_x < 0) + { + m_blitter_srcbuf = (data << 16) | (m_blitter_srcbuf >> 16); + } + else + { + m_blitter_srcbuf = (m_blitter_srcbuf << 16) | data; + } +} + + +//------------------------------------------------- +// blitter_hop - +//------------------------------------------------- + +UINT16 st_state::blitter_hop() +{ + UINT16 source = m_blitter_srcbuf >> (m_blitter_skew & 0x0f); + UINT16 halftone = m_blitter_halftone[m_blitter_ctrl & 0x0f]; + + if (m_blitter_ctrl & ATARIST_BLITTER_CTRL_SMUDGE) + { + halftone = m_blitter_halftone[source & 0x0f]; + } + + switch (m_blitter_hop) + { + case 0: + return 0xffff; + case 1: + return halftone; + case 2: + return source; + case 3: + return source & halftone; + } + + return 0; +} + + +//------------------------------------------------- +// blitter_op - +//------------------------------------------------- + +void st_state::blitter_op(UINT16 s, UINT32 dstaddr, UINT16 mask) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + UINT16 d = program.read_word(dstaddr); + UINT16 result = 0; + + if (m_blitter_op & 0x08) result = (~s & ~d); + if (m_blitter_op & 0x04) result |= (~s & d); + if (m_blitter_op & 0x02) result |= (s & ~d); + if (m_blitter_op & 0x01) result |= (s & d); + + program.write_word(dstaddr, result); +} + + +//------------------------------------------------- +// blitter_tick - +//------------------------------------------------- + +void st_state::blitter_tick() +{ + do + { + if (m_blitter_skew & ATARIST_BLITTER_SKEW_FXSR) + { + blitter_source(); + m_blitter_src += m_blitter_src_inc_x; + } + + blitter_source(); + blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask1); + m_blitter_xcount--; + + while (m_blitter_xcount > 0) + { + m_blitter_src += m_blitter_src_inc_x; + m_blitter_dst += m_blitter_dst_inc_x; + + if (m_blitter_xcount == 1) + { + if (!(m_blitter_skew & ATARIST_BLITTER_SKEW_NFSR)) + { + blitter_source(); + } + + blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask3); + } + else + { + blitter_source(); + blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask2); + } + + m_blitter_xcount--; + } + + m_blitter_src += m_blitter_src_inc_y; + m_blitter_dst += m_blitter_dst_inc_y; + + if (m_blitter_dst_inc_y < 0) + { + m_blitter_ctrl = (m_blitter_ctrl & 0xf0) | (((m_blitter_ctrl & 0x0f) - 1) & 0x0f); + } + else + { + m_blitter_ctrl = (m_blitter_ctrl & 0xf0) | (((m_blitter_ctrl & 0x0f) + 1) & 0x0f); + } + + m_blitter_xcount = m_blitter_xcountl; + m_blitter_ycount--; + } + while (m_blitter_ycount > 0); + + m_blitter_ctrl &= 0x7f; + + m_mfp->i3_w(0); +} + + +//------------------------------------------------- +// blitter_halftone_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_halftone_r ) +{ + return m_blitter_halftone[offset]; +} + + +//------------------------------------------------- +// blitter_src_inc_x_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_src_inc_x_r ) +{ + return m_blitter_src_inc_x; +} + + +//------------------------------------------------- +// blitter_src_inc_y_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_src_inc_y_r ) +{ + return m_blitter_src_inc_y; +} + + +//------------------------------------------------- +// blitter_src_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_src_r ) +{ + switch (offset) + { + case 0: + return (m_blitter_src >> 16) & 0xff; + case 1: + return m_blitter_src & 0xfffe; + } + + return 0; +} + + +//------------------------------------------------- +// blitter_end_mask_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_end_mask_r ) +{ + switch (offset) + { + case 0: + return m_blitter_endmask1; + case 1: + return m_blitter_endmask2; + case 2: + return m_blitter_endmask3; + } + + return 0; +} + + +//------------------------------------------------- +// blitter_dst_inc_x_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_dst_inc_x_r ) +{ + return m_blitter_dst_inc_x; +} + + +//------------------------------------------------- +// blitter_dst_inc_y_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_dst_inc_y_r ) +{ + return m_blitter_dst_inc_y; +} + + +//------------------------------------------------- +// blitter_dst_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_dst_r ) +{ + switch (offset) + { + case 0: + return (m_blitter_dst >> 16) & 0xff; + case 1: + return m_blitter_dst & 0xfffe; + } + + return 0; +} + + +//------------------------------------------------- +// blitter_count_x_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_count_x_r ) +{ + return m_blitter_xcount; +} + + +//------------------------------------------------- +// blitter_count_y_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_count_y_r ) +{ + return m_blitter_ycount; +} + + +//------------------------------------------------- +// blitter_op_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_op_r ) +{ + if (ACCESSING_BITS_0_7) + { + return m_blitter_hop; + } + else + { + return m_blitter_op; + } +} + + +//------------------------------------------------- +// blitter_ctrl_r - +//------------------------------------------------- + +READ16_MEMBER( st_state::blitter_ctrl_r ) +{ + if (ACCESSING_BITS_0_7) + { + return m_blitter_ctrl; + } + else + { + return m_blitter_skew; + } +} + + +//------------------------------------------------- +// blitter_halftone_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_halftone_w ) +{ + m_blitter_halftone[offset] = data; +} + + +//------------------------------------------------- +// blitter_src_inc_x_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_src_inc_x_w ) +{ + m_blitter_src_inc_x = data & 0xfffe; +} + + +//------------------------------------------------- +// blitter_src_inc_y_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_src_inc_y_w ) +{ + m_blitter_src_inc_y = data & 0xfffe; +} + + +//------------------------------------------------- +// blitter_src_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_src_w ) +{ + switch (offset) + { + case 0: + m_blitter_src = (data & 0xff) | (m_blitter_src & 0xfffe); + break; + + case 1: + m_blitter_src = (m_blitter_src & 0xff0000) | (data & 0xfffe); + break; + } +} + + +//------------------------------------------------- +// blitter_end_mask_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_end_mask_w ) +{ + switch (offset) + { + case 0: + m_blitter_endmask1 = data; + break; + + case 1: + m_blitter_endmask2 = data; + break; + + case 2: + m_blitter_endmask3 = data; + break; + } +} + + +//------------------------------------------------- +// blitter_dst_inc_x_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_dst_inc_x_w ) +{ + m_blitter_dst_inc_x = data & 0xfffe; +} + + +//------------------------------------------------- +// blitter_dst_inc_y_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_dst_inc_y_w ) +{ + m_blitter_dst_inc_y = data & 0xfffe; +} + + +//------------------------------------------------- +// blitter_dst_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_dst_w ) +{ + switch (offset) + { + case 0: + m_blitter_dst = (data & 0xff) | (m_blitter_dst & 0xfffe); + break; + + case 1: + m_blitter_dst = (m_blitter_dst & 0xff0000) | (data & 0xfffe); + break; + } +} + + +//------------------------------------------------- +// blitter_count_x_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_count_x_w ) +{ + m_blitter_xcount = data; +} + + +//------------------------------------------------- +// blitter_count_y_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_count_y_w ) +{ + m_blitter_ycount = data; +} + + +//------------------------------------------------- +// blitter_op_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_op_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_blitter_hop = (data >> 8) & 0x03; + } + else + { + m_blitter_op = data & 0x0f; + } +} + + +//------------------------------------------------- +// blitter_ctrl_w - +//------------------------------------------------- + +WRITE16_MEMBER( st_state::blitter_ctrl_w ) +{ + if (ACCESSING_BITS_0_7) + { + m_blitter_ctrl = (data >> 8) & 0xef; + + if (!(m_blitter_ctrl & ATARIST_BLITTER_CTRL_BUSY)) + { + if ((data >> 8) & ATARIST_BLITTER_CTRL_BUSY) + { + m_mfp->i3_w(1); + + int nops = BLITTER_NOPS[m_blitter_op][m_blitter_hop]; // each NOP takes 4 cycles + timer_set(attotime::from_hz((Y2/4)/(4*nops)), TIMER_BLITTER_TICK); + } + } + } + else + { + m_blitter_skew = data & 0xcf; + } +} + + + +//************************************************************************** +// VIDEO +//************************************************************************** + +void st_state::video_start() +{ + m_shifter_timer = timer_alloc(TIMER_SHIFTER_TICK); + m_glue_timer = timer_alloc(TIMER_GLUE_TICK); + +// m_shifter_timer->adjust(machine().first_screen()->time_until_pos(0), 0, attotime::from_hz(Y2/4)); // 125 ns + m_glue_timer->adjust(machine().first_screen()->time_until_pos(0), 0, attotime::from_hz(Y2/16)); // 500 ns + + machine().first_screen()->register_screen_bitmap(m_bitmap); + + /* register for state saving */ + save_item(NAME(m_shifter_base)); + save_item(NAME(m_shifter_ofs)); + save_item(NAME(m_shifter_sync)); + save_item(NAME(m_shifter_mode)); + save_item(NAME(m_shifter_palette)); + save_item(NAME(m_shifter_rr)); + save_item(NAME(m_shifter_ir)); + save_item(NAME(m_shifter_bitplane)); + save_item(NAME(m_shifter_shift)); + save_item(NAME(m_shifter_h)); + save_item(NAME(m_shifter_v)); + save_item(NAME(m_shifter_de)); + + save_item(NAME(m_blitter_halftone)); + save_item(NAME(m_blitter_src_inc_x)); + save_item(NAME(m_blitter_src_inc_y)); + save_item(NAME(m_blitter_dst_inc_x)); + save_item(NAME(m_blitter_dst_inc_y)); + save_item(NAME(m_blitter_src)); + save_item(NAME(m_blitter_dst)); + save_item(NAME(m_blitter_endmask1)); + save_item(NAME(m_blitter_endmask2)); + save_item(NAME(m_blitter_endmask3)); + save_item(NAME(m_blitter_xcount)); + save_item(NAME(m_blitter_ycount)); + save_item(NAME(m_blitter_xcountl)); + save_item(NAME(m_blitter_hop)); + save_item(NAME(m_blitter_op)); + save_item(NAME(m_blitter_ctrl)); + save_item(NAME(m_blitter_skew)); + + set_screen_parameters(); +} + + +void ste_state::video_start() +{ + st_state::video_start(); + + // register for state saving + save_item(NAME(m_shifter_lineofs)); + save_item(NAME(m_shifter_pixelofs)); +} + +void stbook_state::video_start() +{ +} + + +UINT32 st_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} diff --git a/src/mame/video/atarist.h b/src/mame/video/atarist.h new file mode 100644 index 00000000000..da66ff3a17e --- /dev/null +++ b/src/mame/video/atarist.h @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Olivier Galibert +#ifndef _VIDEO_ATARIST_H_ +#define _VIDEO_ATARIST_H_ + +// 32028400 also exists +#define Y2 32084988.0 +#define Y2_NTSC 32042400.0 + +#define ATARIST_HBSTART_PAL 128*4 +#define ATARIST_HBEND_PAL 0 +#define ATARIST_HBSTART_NTSC 127*4 +#define ATARIST_HBEND_NTSC 0 +#define ATARIST_HTOT_PAL 129*4 +#define ATARIST_HTOT_NTSC 128*4 + +#define ATARIST_HBDEND_PAL 14*4 +#define ATARIST_HBDSTART_PAL 94*4 +#define ATARIST_HBDEND_NTSC 13*4 +#define ATARIST_HBDSTART_NTSC 93*4 + +#define ATARIST_VBEND_PAL 0 +#define ATARIST_VBEND_NTSC 0 +#define ATARIST_VBSTART_PAL 312 +#define ATARIST_VBSTART_NTSC 262 +#define ATARIST_VTOT_PAL 313 +#define ATARIST_VTOT_NTSC 263 + +#define ATARIST_VBDEND_PAL 63 +#define ATARIST_VBDSTART_PAL 263 +#define ATARIST_VBDEND_NTSC 34 +#define ATARIST_VBDSTART_NTSC 234 + +#define ATARIST_BLITTER_SKEW_NFSR 0x40 +#define ATARIST_BLITTER_SKEW_FXSR 0x80 + +#define ATARIST_BLITTER_CTRL_SMUDGE 0x20 +#define ATARIST_BLITTER_CTRL_HOG 0x40 +#define ATARIST_BLITTER_CTRL_BUSY 0x80 + +#endif diff --git a/src/mame/video/aussiebyte.c b/src/mame/video/aussiebyte.c new file mode 100644 index 00000000000..f3f758fe4f6 --- /dev/null +++ b/src/mame/video/aussiebyte.c @@ -0,0 +1,196 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*********************************************************** + + Video + Graphics not working properly. + Mode 0 - lores (wide, chunky) + Mode 1 - external, *should* be ok + Mode 2 - thin graphics, not explained well enough to code + Mode 3 - alphanumeric, works + + + +************************************************************/ +#include "includes/aussiebyte.h" +/*********************************************************** + + I/O Ports + +************************************************************/ + +// dummy read port, forces requested action to happen +READ8_MEMBER( aussiebyte_state::port33_r ) +{ + return 0xff; +} + +/* +Video control - needs to be fully understood +d0, d1, d2, d3 - can replace RA0-3 in graphics mode +d4 - GS - unknown +d5 - /SRRD - controls write of data to either vram or aram (1=vram, 0=aram) +d6 - /VWR - 0 = enable write vdata to vram, read from aram to vdata ; 1 = enable write to aram from vdata +d7 - OE on port 35 +*/ +WRITE8_MEMBER( aussiebyte_state::port34_w ) +{ + m_port34 = data; +} + +WRITE8_MEMBER( aussiebyte_state::port35_w ) +{ + m_port35 = data; +} + +READ8_MEMBER( aussiebyte_state::port36_r ) +{ + if BIT(m_port34, 5) + { + if BIT(m_p_attribram[m_alpha_address & 0x7ff], 7) + return m_p_videoram[m_alpha_address]; + else + return m_p_videoram[m_graph_address]; + } + else + return m_p_attribram[m_alpha_address & 0x7ff]; +} + +READ8_MEMBER( aussiebyte_state::port37_r ) +{ + return m_crtc->de_r() ? 0xff : 0xfe; +} + + +/*********************************************************** + + Video + +************************************************************/ +MC6845_ON_UPDATE_ADDR_CHANGED( aussiebyte_state::crtc_update_addr ) +{ +/* not sure what goes in here - parameters passed are device, address, strobe */ +// m_video_address = address;// & 0x7ff; +} + +WRITE8_MEMBER( aussiebyte_state::address_w ) +{ + m_crtc->address_w( space, 0, data ); + + m_video_index = data & 0x1f; + + if (m_video_index == 31) + { + m_alpha_address++; + m_alpha_address &= 0x3fff; + m_graph_address = (m_alpha_address << 4) | (m_port34 & 15); + + if BIT(m_port34, 5) + { + if BIT(m_p_attribram[m_alpha_address & 0x7ff], 7) + m_p_videoram[m_alpha_address] = m_port35; + else + m_p_videoram[m_graph_address] = m_port35; + } + else + m_p_attribram[m_alpha_address & 0x7ff] = m_port35; + } +} + +WRITE8_MEMBER( aussiebyte_state::register_w ) +{ + m_crtc->register_w( space, 0, data ); + UINT16 temp = m_alpha_address; + + // Get transparent address + if (m_video_index == 18) + m_alpha_address = (data << 8 ) | (temp & 0xff); + else + if (m_video_index == 19) + m_alpha_address = data | (temp & 0xff00); +} + +UINT8 aussiebyte_state::crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16 ac_cnt, bool ac_curs) +{ + UINT8 gfx = 0; + switch (ac_attr & 3) + { + case 0: // lores gfx + switch (ac_ra) + { + case 0: + case 1: + case 2: + gfx = (BIT(ac_chr, 7) ? 0xf8 : 0) | (BIT(ac_chr, 3) ? 7 : 0); + break; + case 3: + case 4: + case 5: + gfx = (BIT(ac_chr, 6) ? 0xf8 : 0) | (BIT(ac_chr, 2) ? 7 : 0); + break; + case 6: + case 7: + case 8: + gfx = (BIT(ac_chr, 5) ? 0xf8 : 0) | (BIT(ac_chr, 1) ? 7 : 0); + break; + default: + gfx = (BIT(ac_chr, 4) ? 0xf8 : 0) | (BIT(ac_chr, 0) ? 7 : 0); + break; + } + break; + case 1: // external mode + gfx = BITSWAP8(ac_chr, 0,1,2,3,4,5,6,7); + break; + case 2: // thin gfx + break; + case 3: // alpha + gfx = m_p_chargen[((ac_chr & 0x7f)<<4) | ac_ra]; + break; + } + + if (BIT(ac_attr, 3) & (ac_ra == 11)) // underline + gfx = 0xff; + if (BIT(ac_attr, 2) & ((ac_ra == 5) | (ac_ra == 6))) // strike-through + gfx = 0xff; + if (BIT(ac_attr, 6) & BIT(ac_cnt, 13)) // flash + gfx = 0; + if BIT(ac_attr, 5) // blank + gfx = 0; + if (ac_curs & BIT(ac_cnt, 14)) // cursor + gfx ^= 0xff; + if BIT(ac_attr, 4) // reverse video + gfx ^= 0xff; + return gfx; +} + +MC6845_UPDATE_ROW( aussiebyte_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,attr; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + ra &= 15; + m_cnt++; + + for (x = 0; x < x_count; x++) + { + mem = ma + x; + attr = m_p_attribram[mem & 0x7ff]; + if BIT(attr, 7) + chr = m_p_videoram[mem & 0x3fff]; // alpha + else + chr = m_p_videoram[(mem << 4) | ra]; // gfx + + gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); + + /* Display a scanline of a character (8 pixels) */ + *p++ = palette[BIT(gfx, 7)]; + *p++ = palette[BIT(gfx, 6)]; + *p++ = palette[BIT(gfx, 5)]; + *p++ = palette[BIT(gfx, 4)]; + *p++ = palette[BIT(gfx, 3)]; + *p++ = palette[BIT(gfx, 2)]; + *p++ = palette[BIT(gfx, 1)]; + *p++ = palette[BIT(gfx, 0)]; + } +} diff --git a/src/mame/video/avigo.c b/src/mame/video/avigo.c new file mode 100644 index 00000000000..0177023fe9f --- /dev/null +++ b/src/mame/video/avigo.c @@ -0,0 +1,118 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/*************************************************************************** + + avigo.c + + Functions to emulate the video hardware of the TI Avigo 10 PDA + +***************************************************************************/ + +#include "emu.h" +#include "includes/avigo.h" + +/*************************************************************************** + Start the video hardware emulation. +***************************************************************************/ + +/* mem size = 0x017c0 */ + + +/* current column to read/write */ + +#define AVIGO_VIDEO_DEBUG 0 +#define LOG(x) do { if (AVIGO_VIDEO_DEBUG) logerror x; } while (0) + + +READ8_MEMBER(avigo_state::vid_memory_r) +{ + if (!offset) + return m_screen_column; + + if ((offset<0x0100) || (offset>=0x01f0) || (m_screen_column >= (AVIGO_SCREEN_WIDTH>>3))) + { + LOG(("vid mem read: %04x\n", offset)); + return 0; + } + + /* 0x0100-0x01f0 contains data for selected column */ + return m_video_memory[m_screen_column + ((offset&0xff)*(AVIGO_SCREEN_WIDTH>>3))]; +} + +WRITE8_MEMBER(avigo_state::vid_memory_w) +{ + if (!offset) + { + /* select column to read/write */ + m_screen_column = data; + + LOG(("vid mem column write: %02x\n",data)); + + if (data>=(AVIGO_SCREEN_WIDTH>>3)) + { + LOG(("error: vid mem column write: %02x\n",data)); + } + return; + } + + if ((offset<0x0100) || (offset>=0x01f0) || (m_screen_column >= (AVIGO_SCREEN_WIDTH>>3))) + { + LOG(("vid mem write: %04x %02x\n", offset, data)); + return; + } + + /* 0x0100-0x01f0 contains data for selected column */ + m_video_memory[m_screen_column + ((offset&0xff)*(AVIGO_SCREEN_WIDTH>>3))] = data; +} + +void avigo_state::video_start() +{ + /* current selected column to read/write */ + m_screen_column = 0; + + /* allocate video memory */ + m_video_memory = machine().memory().region_alloc( "videoram", (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1, 1, ENDIANNESS_LITTLE )->base(); + memset(m_video_memory, 0, (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1); + + save_pointer(NAME(m_video_memory), (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1); +} + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(avigo_state, avigo) +{ + m_palette->set_pen_color(0,rgb_t(0xff,0xff,0xff)); /* white */ + m_palette->set_pen_color(1,rgb_t(0x00,0x00,0x00)); /* black */ +} + +UINT32 avigo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int y; + int b; + int x; + + /* draw avigo display */ + for (y=0; y>3)); + + x = 0; + for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) + { + int px; + UINT8 byte = line_ptr[0]; + + px = x; + for (b=7; b>=0; b--) + { + bitmap.pix16(y, px) = ((byte>>7) & 0x01); + px++; + byte = byte<<1; + } + + x = px; + line_ptr = line_ptr+1; + } + } + return 0; +} diff --git a/src/mame/video/b2m.c b/src/mame/video/b2m.c new file mode 100644 index 00000000000..9cd59b2ec42 --- /dev/null +++ b/src/mame/video/b2m.c @@ -0,0 +1,60 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Bashkiria-2M video driver by Miodrag Milanovic + + 28/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/b2m.h" +#include "machine/ram.h" + +void b2m_state::video_start() +{ +} + +UINT32 b2m_state::screen_update_b2m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code1; + UINT8 code2; + UINT8 col; + int y, x, b; + UINT8 *ram = m_ram->pointer(); + + for (x = 0; x < 48; x++) + { + for (y = 0; y < 256; y++) + { + if (m_b2m_video_page==0) { + code1 = ram[0x11000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)]; + code2 = ram[0x15000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)]; + } else { + code1 = ram[0x19000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)]; + code2 = ram[0x1d000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)]; + } + for (b = 7; b >= 0; b--) + { + col = (((code2 >> b) & 0x01)<<1) + ((code1 >> b) & 0x01); + bitmap.pix16(y, x*8+b) = col; + } + } + } + + return 0; +} + +static const rgb_t b2m_palette[4] = { + rgb_t(0x00, 0x00, 0x00), // 0 + rgb_t(0x00, 0x00, 0x00), // 1 + rgb_t(0x00, 0x00, 0x00), // 2 + rgb_t(0x00, 0x00, 0x00), // 3 +}; + +PALETTE_INIT_MEMBER(b2m_state, b2m) +{ + palette.set_pen_colors(0, b2m_palette, ARRAY_LENGTH(b2m_palette)); +} diff --git a/src/mame/video/bbc.c b/src/mame/video/bbc.c new file mode 100644 index 00000000000..5e059647705 --- /dev/null +++ b/src/mame/video/bbc.c @@ -0,0 +1,306 @@ +// license:BSD-3-Clause +// copyright-holders:Gordon Jefferyes, Nigel Barnes +/****************************************************************************** + BBC Model B + + MESS Driver By: + + Gordon Jefferyes + mess_bbc@romvault.com + + This is the first go around at converting the BBC code over to using + mames built in mc6845, there are a number of features now incorrect + or missing in this build: + + BBC split modes no longer work (Like is used in Elite.) + +******************************************************************************/ + +#include "emu.h" +#include "includes/bbc.h" +#include "video/saa5050.h" +#include "video/mc6845.h" + +/************************************************************************ + * C0 and C1 along with MA12 output from the 6845 drive 4 NAND gates in ICs 27,36 and 40 + * the outputs from these NAND gates (B1 to B4) along with MA8 to MA11 from the 6845 (A1 to B4) are added together + * in IC39 74LS283 4 bit adder to form (S1 to S4) the logic is used to loop the screen memory for hardware scrolling. + * when MA13 from the 6845 is low the latches IC8 and IC9 are enabled + * they control the memory addressing for the Hi-Res modes. + * when MA13 from the 6845 is high the latches IC10 and IC11 are enabled + * they control the memory addressing for the Teletext mode. + * IC 8 or IC10 drives the row select in the memory (the lower 7 bits in the memory address) and + * IC 9 or IC11 drives the column select in the memory (the next 7 bits in the memory address) this + * gives control of the bottom 14 bits of the memory, in a 32K model B 15 bits are needed to access + * all the RAM, so S4 for the adder drives the CAS0 and CAS1 to access the top bit, in a 16K model A + * the output of S4 is linked out to a 0v supply by link S25 to just access the 16K memory area. + ************************************************************************/ + +unsigned int bbc_state::calculate_video_address(int ma,int ra) +{ + // ma = output from IC2 6845 MA address + + int c0=m_b4_video0; // output from IC32 74LS259 bits 4 and 5 + int c1=m_b5_video1; + + /* the 4 bit input port b on IC39 are produced by 4 NAND gates. + these NAND gates take their + inputs from c0 and c1 (from IC32) and ma12 (from the 6845) */ + + /* get bit m12 from the 6845 */ + int ma12=(ma>>12)&1; + + // 4 bit input B on IC39 74LS283 (4 bit adder) + /* 3 input NAND part of IC 36 */ + int b1=(~(c1 & c0 & ma12)) & 1; + /* 2 input NAND part of IC40 (b3 is calculated before b2 and b4 because b3 feed back into b2 and b4) */ + int b3=(~(c0 & ma12)) & 1; + /* 3 input NAND part of IC 36 */ + int b2=(~(c1 & b3 & ma12)) & 1; + /* 2 input NAND part of IC 27 */ + int b4=(~(b3 & ma12)) & 1; + + /* inputs port b to IC39 are taken from the NAND gates b1 to b4 */ + int b=(b1<<0)|(b2<<1)|(b3<<2)|(b4<<3); + + /* inputs port a to IC39 are MA8 to MA11 from the 6845 */ + int a=(ma>>8)&0xf; + + /* IC39 performs the 4 bit add with the carry input set high */ + int s=(a+b+1)&0xf; + + /* if MA13 (TTXVDU) is low then IC8 and IC9 are used to calculate + the memory location required for the hi res video. + if MA13 is hight then IC10 and IC11 are used to calculate the memory location for the teletext chip*/ + unsigned int m; + if ((ma>>13)&1) + { + // IC 10 and IC 11 + m=((ma&0x3ff)|0x3c00)|((s&0x8)<<11); + } else { + // IC 8 and IC 9 + m=((ma&0xff)<<3)|(s<<11)|(ra&0x7); + } + if (m_memorySize==16) + return m & 0x3fff; + + return m; +} + +/************************************************************************ + * VideoULA + ************************************************************************/ + +static const int pixels_per_byte_set[8]={ 2,4,8,16,1,2,4,8 }; + +static const int width_of_cursor_set[8]={ 0,0,1,2,1,0,2,4 }; + +/* this is a quick lookup array that puts bits 0,2,4,6 into bits 0,1,2,3 + this is used by the palette lookup in the video ULA */ +void bbc_state::set_pixel_lookup() +{ + for (int i=0; i<256; i++) + { + m_pixel_bits[i] = (((i>>7)&1)<<3) | (((i>>5)&1)<<2) | (((i>>3)&1)<<1) | (((i>>1)&1)<<0); + } +} + + +WRITE8_MEMBER(bbc_state::bbc_videoULA_w) +{ + // Make sure vpos is never <0 2008-10-11 PHS. + int vpos=machine().first_screen()->vpos(); + if(vpos==0) + machine().first_screen()->update_partial(vpos); + else + machine().first_screen()->update_partial(vpos -1 ); + + logerror("setting videoULA %.4x to:%.4x at :%d \n",data,offset,machine().first_screen()->vpos() ); + + + switch (offset&0x01) + { + // Set the control register in the Video ULA + case 0: + { + m_videoULA_Reg=data; + m_videoULA_master_cursor_size= (m_videoULA_Reg>>7)&0x01; + m_videoULA_width_of_cursor= (m_videoULA_Reg>>5)&0x03; + m_videoULA_6845_clock_rate= (m_videoULA_Reg>>4)&0x01; + m_videoULA_characters_per_line= (m_videoULA_Reg>>2)&0x03; + m_videoULA_teletext_normal_select=(m_videoULA_Reg>>1)&0x01; + m_videoULA_flash_colour_select= m_videoULA_Reg &0x01; + + m_videoULA_pallet_lookup=m_videoULA_flash_colour_select?m_videoULA_pallet0:m_videoULA_pallet1; + + m_emulation_cursor_size=width_of_cursor_set[m_videoULA_width_of_cursor|(m_videoULA_master_cursor_size<<2)]; + + // this is the number of BBC pixels held in each byte + if (m_videoULA_teletext_normal_select) + { + m_pixels_per_byte=6; + } else { + m_pixels_per_byte=pixels_per_byte_set[m_videoULA_characters_per_line|(m_videoULA_6845_clock_rate<<2)]; + } + m_mc6845->set_hpixels_per_column(m_pixels_per_byte); + if (m_videoULA_6845_clock_rate) + m_mc6845->set_clock(2000000); + else + m_mc6845->set_clock(1000000); + } + break; + // Set a pallet register in the Video ULA + case 1: + int tpal=(data>>4)&0x0f; + int tcol=data&0x0f; + m_videoULA_pallet0[tpal]=tcol; + m_videoULA_pallet1[tpal]=tcol<8?tcol:tcol^7; + break; + } +} + +/************************************************************************ + * BBC circuits controlled by 6845 Outputs + ************************************************************************/ + +MC6845_UPDATE_ROW( bbc_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + if (m_videoULA_teletext_normal_select) + { + m_trom->lose_w(1); + m_trom->lose_w(0); + + for(int x_pos=0; x_pos>13)&1)==0) + { + m_Teletext_Latch=0; + } + else + { + m_Teletext_Latch=(m_BBC_Video_RAM[calculate_video_address(ma+x_pos,ra)]); + } + + m_trom->write((m_Teletext_Latch&0x3f)|(m_Teletext_Latch&0x40)); + + m_trom->f1_w(1); + m_trom->f1_w(0); + + for(int pixelno=0;pixelno<6;pixelno++) + { + m_trom->tr6_w(1); + m_trom->tr6_w(0); + + int col=m_trom->get_rgb() ^ ((x_pos==cursor_x) ? 7 : 0); + + int r = BIT(col, 0) * 0xff; + int g = BIT(col, 1) * 0xff; + int b = BIT(col, 2) * 0xff; + + rgb_t rgb = rgb_t(r, g, b); + + bitmap.pix32(y, (x_pos*m_pixels_per_byte)+pixelno) = rgb; + } + } + + if (ra == 18) + { + m_trom->lose_w(1); + m_trom->lose_w(0); + } + } + else + { + // this is IC38 and IC41 takes 6845 DisplayEnabled and 6845 RA3 + int DE= !(ra>=8); + + if (DE) + { + for(int x_pos=0; x_posdew_w(state); +} + + +/**** BBC B+ Shadow Ram change ****/ + +void bbc_state::bbcbp_setvideoshadow(int vdusel) +{ + if (vdusel) + { + m_BBC_Video_RAM= m_region_maincpu->base()+0x8000; + } else { + m_BBC_Video_RAM= m_region_maincpu->base(); + } +} + +/************************************************************************ + * bbc_vh_start + * Initialize the BBC video emulation + ************************************************************************/ + +void bbc_state::common_init(int memorySize) +{ + m_emulation_cursor_size = 1; + + m_VideoULA_CR = 7; + m_VideoULA_CR_counter = 0; + + set_pixel_lookup(); + + m_BBC_Video_RAM = m_region_maincpu->base(); + m_memorySize=memorySize; + +} + +VIDEO_START_MEMBER(bbc_state,bbca) +{ + common_init(m_ram->size()/1024); +} + +VIDEO_START_MEMBER(bbc_state,bbcb) +{ + common_init(32); +} + +VIDEO_START_MEMBER(bbc_state,bbcbp) +{ + common_init(32); +} + +VIDEO_START_MEMBER(bbc_state,bbcm) +{ + common_init(32); +} diff --git a/src/mame/video/bk.c b/src/mame/video/bk.c new file mode 100644 index 00000000000..103c78779bd --- /dev/null +++ b/src/mame/video/bk.c @@ -0,0 +1,40 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + BK video driver by Miodrag Milanovic + + 10/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/bk.h" + + +void bk_state::video_start() +{ +} + +UINT32 bk_state::screen_update_bk0010(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 code; + int y, x, b; + int nOfs; + + nOfs = (m_scrool - 728) % 256; + + for (y = 0; y < 256; y++) + { + for (x = 0; x < 32; x++) + { + code = m_bk0010_video_ram[((y+nOfs) %256)*32 + x]; + for (b = 0; b < 16; b++) + { + bitmap.pix16(y, x*16 + b) = (code >> b) & 0x01; + } + } + } + return 0; +} diff --git a/src/mame/video/busicom.c b/src/mame/video/busicom.c new file mode 100644 index 00000000000..0c97258a002 --- /dev/null +++ b/src/mame/video/busicom.c @@ -0,0 +1,1860 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Busicom 141-PF + + 04/08/2009 Initial driver by Miodrag Milanovic + +****************************************************************************/ +#include "emu.h" +#include "includes/busicom.h" + +// Printer font 34x44 as provided by MIT Media Lab + + +static const UINT8 printer_font[]= { +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,3,4,5,6,6,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,4,6,7,7,7,7,7,7,7,7,6,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,5,7,7,7,7,7,7,7,7,7,7,7,7,5,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,7,7,5,3,2,1,1,2,3,5,7,7,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,6,7,7,7,6,2,0,0,0,0,0,0,0,0,1,5,7,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,1,0,0,0,0,0,0, +0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0, +0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0, +0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0, +0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0, +0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0, +0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0, +0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0, +0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0, +0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0, +0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0, +0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0, +0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0, +0,0,0,0,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0, +0,0,0,0,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0, +0,0,0,0,5,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0, +0,0,0,0,5,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0, +0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0,0,0,0, +0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,5,0,0,0,0,0,0, +0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0, +0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,1,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,5,2,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,7,7,5,2,0,0,0,0,1,4,6,7,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,2,6,7,7,7,7,7,6,6,5,5,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,6,5,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,7,6,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,5,7,7,7,7,6,1,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,2,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,5,2,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,3,3,2,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,2,1,1,1,1,1,0,4,7,7,7,2,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,3,1,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,2,3,4,4,4,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,5,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,6,7,7,7,7,7,5,5,5,6,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,1,6,7,7,7,5,2,0,0,0,0,0,1,1,4,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,5,0,0,0,0,0,0,0,0,0, +0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,5,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,1,0,0,0,0,0,0,0, +0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0, +0,0,1,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0, +0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,1,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,4,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,6,7,7,5,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,0,0,0,0,0,0,0,0, +0,0,0,6,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0, +0,0,0,1,3,4,4,4,4,4,4,4,3,3,4,4,4,4,4,4,4,5,5,5,5,5,4,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, +0,0,0,5,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0, +0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0, +0,0,0,0,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,1,0,5,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,2,0,1,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,5,6,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,7,6,5,5,5,5,4,6,7,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,3,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,2,5,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,3,5,7,7,7,7,6,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,2,4,6,7,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,3,7,7,7,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,3,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,3,4,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,2,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,6,7,7,7,4,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,6,7,7,4,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,6,7,7,6,4,4,4,3,3,3,2,2,2,3,2,5,7,7,7,4,3,3,3,2,2,2,1,0,0,0,0, +0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0, +0,0,0,2,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0, +0,0,0,0,0,1,3,4,4,4,4,5,5,5,5,4,4,4,6,7,7,7,4,3,4,4,4,5,4,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,2,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,2,4,4,3,3,3,3,3,3,4,3,3,3,3,4,4,4,4,4,4,4,4,2,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0, +0,0,0,0,6,7,7,5,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,6,5,4,1,0,0,0,0,0,0,0, +0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,1,3,4,6,6,7,6,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,6,2,4,5,7,7,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,6,6,6,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,7,7,7,7,5,3,2,1,0,0,0,2,6,7,7,7,6,2,0,0,0,0,0,0,0,0, +0,0,0,0,2,7,7,7,7,6,4,2,0,0,0,0,0,0,0,0,1,5,7,7,7,6,1,0,0,0,0,0,0,0, +0,0,0,0,0,1,3,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,4,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,2,3,5,6,7,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,3,7,7,7,7,7,7,7,5,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,6,7,7,7,6,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,5,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,4,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,7,7,7,4,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,7,7,7,7,7,7,6,4,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,5,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,6,4,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,5,7,7,7,2,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,1,7,7,7,6,0,0,1,3,5,7,7,7,7,6,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,2,7,7,7,5,1,5,7,7,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,4,7,7,7,7,7,7,7,7,5,2,0,1,1,2,4,6,7,7,7,6,1,0,0,0,0,0,0,0,0, +0,0,0,0,4,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,4,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,1,0,0,0,0,0, +0,0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,3,0,0,0,0,0, +0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0, +0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0, +0,0,0,0,5,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0, +0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0, +0,0,0,0,3,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0, +0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,5,0,0,0,0,0, +0,0,0,0,0,6,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0, +0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0, +0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,0,0,1,5,7,7,7,3,0,0,0,0,0,0,0,0,0,1,4,7,7,7,4,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,6,7,7,7,5,2,0,0,0,0,0,1,4,6,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,1,5,7,7,7,7,5,3,4,5,5,6,7,7,7,7,5,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,4,6,7,7,7,7,7,7,6,4,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,3,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,0,0,0,0,0, +0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0, +0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0, +0,0,0,0,3,7,7,7,7,6,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,6,7,7,2,0,0,0,0,0, +0,0,0,0,3,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,6,0,0,0,0,0,0, +0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0, +0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,0, +0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,3,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,1,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,1,2,4,5,5,6,6,6,5,5,4,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,5,7,7,7,7,7,6,6,5,5,6,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,4,7,7,7,7,5,2,0,0,0,0,0,1,4,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,1,4,7,7,7,5,0,0,0,0,0,0,0,0,0, +0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,6,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,1,0,0,0,0,0,0,0, +0,0,0,0,4,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,4,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,4,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,6,2,0,0,0,0,0,0,1,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,7,7,6,5,5,5,5,6,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,6,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,6,7,7,7,7,5,3,2,1,1,0,1,2,5,7,7,7,7,5,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,3,7,7,7,6,2,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0, +0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,0, +0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0, +0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0, +0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0, +0,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0, +0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0, +0,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0, +0,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0, +0,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0, +0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0, +0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0, +0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,2,7,7,7,6,3,2,0,0,0,0,0,0,0,0,0,4,7,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,2,7,7,7,7,7,6,4,3,3,2,2,3,4,6,7,7,7,7,6,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,1,2,2,3,3,4,4,4,5,4,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,5,7,7,7,7,7,6,5,4,4,5,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,6,7,7,7,6,2,1,0,0,0,0,0,1,2,5,7,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,4,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0, +0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0, +0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0, +0,0,0,4,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0, +0,0,0,4,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0, +0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0, +0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0, +0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,0, +0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,4,0,0,0,0,0, +0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,4,0,0,0,0,0, +0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,4,0,0,0,0,0, +0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,4,0,0,0,0,0, +0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,3,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,6,3,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,1,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,7,7,5,1,0,0,0,0,1,3,6,7,7,6,6,7,7,6,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,6,7,7,7,7,6,6,6,5,7,7,7,7,7,4,5,7,7,5,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,7,5,2,6,7,7,5,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,4,2,0,0,7,7,7,4,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,3,2,2,1,0,0,0,1,7,7,7,3,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,6,1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,4,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,5,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,2,2,3,5,6,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,7,7,7,7,7,7,7,6,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,6,5,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,3,6,7,7,7,6,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,2,4,7,7,7,5,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,5,5,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,6,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,4,6,7,7,7,7,7,7,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,4,6,6,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,2,0,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,6,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,6,0,4,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,1,0,1,5,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,1,5,7,7,7,7,2,0,0,0,1,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,1,6,7,7,7,5,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,7,4,0,0,0,0,0,0,0,0,0,2,6,7,7,7,5,1,0,0,0,0,0,0, +0,0,0,0,0,2,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,5,0,0,0,0,0,0, +0,0,0,0,3,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,5,0,0,0,0,0, +0,0,0,2,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0,0, +0,0,2,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0, +0,1,6,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0, +0,4,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0, +0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0, +0,0,5,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,1,0,0, +0,0,1,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0, +0,0,0,1,5,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0, +0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0, +0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0, +0,0,0,0,0,0,2,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,1,0,1,2,2,2,2,3,4,5,7,7,7,7,7,7,7,7,7,6,5,5,5,4,4,4,4,4,3,0,0,0, +2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0, +2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0, +0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0, +0,1,2,2,2,3,3,3,3,3,3,4,7,7,7,7,7,7,7,5,3,2,2,2,2,2,2,1,1,2,1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,5,5,5,5,4,4,3,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0, +0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,4,2,0,0,0, +0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0, +0,6,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,4,0,0, +0,4,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,2,0,0, +0,0,4,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,3,0,0,0, +0,0,0,5,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,3,0,0,0,0, +0,0,0,0,5,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,4,0,0,0,0,0, +0,0,0,0,0,4,7,7,7,7,7,4,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,4,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,3,0,0,0,0,0,0,4,7,7,7,7,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,7,7,7,4,0,0,0,1,5,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,7,7,3,0,0,5,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,4,5,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,4,2,6,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,1,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,7,7,7,4,0,0,0,0,3,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,3,0,0,0,0,0,0,3,7,7,7,7,7,6,1,0,0,0,0,0,0,0, +0,0,0,0,1,5,7,7,7,7,7,3,0,0,0,0,0,0,0,0,4,7,7,7,7,7,6,1,0,0,0,0,0,0, +0,0,0,1,6,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,6,1,0,0,0,0,0, +0,0,1,6,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,6,1,0,0,0,0, +0,2,6,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,5,0,0,0,0, +1,6,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,7,4,0,0,0, +1,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,3,0,0, +0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,3,0,0, +0,0,4,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,7,3,0,0,0, +0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,6,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,3,4,5,5,5,2,0,0, +2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +0,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,5,5,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,4,5,5,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,1,0,0, +5,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,5,0,0, +5,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,6,0,0, +5,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,7,7,6,0,0, +5,7,7,7,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,6,0,0, +5,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,6,0,0, +5,7,7,7,5,3,5,7,7,7,7,3,0,0,0,0,0,0,0,0,4,7,7,7,7,6,4,6,7,7,7,6,0,0, +5,7,7,7,3,0,0,4,7,7,7,7,3,0,0,0,0,0,0,3,7,7,7,7,6,1,0,2,7,7,7,6,0,0, +5,7,7,7,3,0,0,0,2,6,7,7,7,4,1,0,0,0,4,7,7,7,7,5,0,0,0,1,7,7,7,6,0,0, +5,7,7,7,3,0,0,0,0,1,6,7,7,7,6,3,3,5,7,7,7,7,5,0,0,0,0,0,6,7,7,6,1,0, +5,7,7,7,3,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,4,7,7,7,1,0, +4,7,7,7,3,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,3,7,7,7,1,0, +4,7,7,7,3,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,0,0,0,0,0,0,3,7,7,7,1,0, +4,7,7,7,3,0,0,0,0,0,0,0,0,0,3,7,7,6,2,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, +4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,1,3,1,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, +4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +2,7,7,7,3,0,0,0,0,0,0,0,0,0,1,2,2,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0, +2,7,7,7,3,0,0,0,0,0,0,0,0,0,3,7,7,6,1,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, +1,7,7,7,2,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,2,6,7,4,0,0, +0,2,4,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,4,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,4,4,4,4,4,5,5,5,6,7,7,7,7,7,7,7,7,6,5,5,5,5,5,5,2,0,0,0,0,0, +0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0, +0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0, +0,0,0,0,2,4,5,5,5,5,5,5,4,5,7,7,7,7,7,6,3,2,2,3,3,3,2,2,1,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +1,5,6,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,5,5,3,0,0,0, +3,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0, +4,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,7,7,7,7,7,7,4,0,0, +5,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,5,0,0, +6,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,5,0,0, +5,7,7,7,6,6,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,6,7,7,7,7,5,0,0, +5,7,7,7,4,0,3,6,7,7,7,5,0,0,0,0,0,0,0,1,6,7,7,7,6,2,0,3,7,7,7,5,0,0, +5,7,7,7,3,0,0,1,5,7,7,7,4,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,6,7,7,5,0,0, +5,7,7,7,2,0,0,0,0,4,7,7,7,4,0,0,0,1,6,7,7,7,4,1,0,0,0,0,5,7,7,5,0,0, +5,7,7,7,2,0,0,0,0,0,4,7,7,7,3,0,1,5,7,7,7,4,0,0,0,0,0,0,5,7,7,6,0,0, +5,7,7,7,2,0,0,0,0,0,0,3,7,7,7,6,6,7,7,7,3,0,0,0,0,0,0,0,4,7,7,6,0,0, +5,7,7,7,2,0,0,0,0,0,0,0,3,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,4,7,7,6,0,0, +5,7,7,7,2,0,0,0,0,0,0,0,0,2,6,7,7,7,3,0,0,0,0,0,0,0,0,0,3,7,7,7,0,0, +5,7,7,7,2,0,0,0,0,0,0,0,0,0,2,5,5,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, +5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0, +5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0, +5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, +4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,0,0, +4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,1,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,0,0, +4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,0,0, +2,6,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,4,0,0, +0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,0,0,0,0,0,0, +0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0, +0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0, +0,0,0,0,1,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,5,7,4,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,4,5,6,7,7,7,7,7,5,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,5,6,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0, +0,0,0,0,0,0,0,0,0,1,3,4,5,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0, +0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0, +0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,6,4,4,6,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,1,4,7,7,7,7,3,0,0,0,0,3,7,7,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,6,7,7,7,7,2,0,0,0,0,0,0,5,7,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,7,6,1,0,0,0,0,0,0,0,1,6,7,7,3,0,0,0,0,0,0,0,0,0, +0,0,0,0,1,5,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,3,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,0,2,6,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,3,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +3,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,3,5,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +1,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,4,4,4,4,3,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +1,3,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,4,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,5,5,5,5,5,6,6,6,6,6,6,4,0,0, +6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +1,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,2,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,3,3,3,3,3,3,3,3,4,4,4,3,4,5,5,3,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,6,6,6,6,6,6,5,5,5,5,5,5,5,2,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,2,3,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,3,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,6,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,1,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,1,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,2,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,6,6,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +3,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +3,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +3,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,3,4,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1,4,7,7,7,7,7,6,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,1,0,0, +0,0,2,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,4,0,0, +0,1,6,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,4,0,0, +0,5,7,7,7,6,3,1,1,3,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0, +2,7,7,7,6,1,0,0,0,0,1,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +2,7,7,7,1,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0, +3,7,7,7,1,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0,0, +4,7,7,7,3,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0, +3,7,7,7,4,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0, +1,6,7,7,6,2,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0, +0,4,7,7,7,7,4,1,2,2,5,7,7,7,4,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0, +0,0,6,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,2,6,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,2,7,7,7,7,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,2,5,7,7,7,7,7,5,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,1,3,6,7,7,5,1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0,0,2,6,7,7,7,7,7,7,7,5,2,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,2,6,7,7,7,7,7,7,7,7,7,6,1,0,0,0, +0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,1,6,7,7,7,7,6,4,5,7,7,7,7,4,0,0,0, +0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,4,7,7,7,6,2,0,0,0,2,5,7,7,7,1,0,0, +0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,2,7,7,7,4,0,0, +0,0,0,0,1,5,7,7,7,4,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,6,7,7,4,0,0, +0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0,0,3,7,7,4,0,0, +0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,5,7,7,3,0,0, +0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,1,7,7,7,3,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,3,7,7,7,2,0,0, +0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,3,1,0,1,5,7,7,7,5,0,0,0, +0,4,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,6,6,7,7,7,6,1,0,0,0, +0,2,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,1,0,0,0,0, +0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,5,5,6,7,5,4,3,1,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,3,4,5,5,5,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,2,5,7,7,7,7,7,7,7,7,7,7,5,2,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,4,7,7,7,7,7,7,7,6,5,5,6,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,7,7,4,1,0,0,0,0,0,1,2,5,7,7,7,7,5,1,0,0,0,0,0,0, +0,0,0,0,0,4,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,5,1,0,0,0,0,0, +0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,0,0,0,0,0, +0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,3,0,0,0,0, +0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0, +0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,4,0,0,0,0, +0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0, +0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,3,1,0,0,0, +0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,5,0,0,0, +0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0, +0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0, +0,0,0,0,2,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,5,0,0,0,0,0, +0,0,0,0,0,4,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,5,1,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,7,7,4,2,1,0,0,0,0,1,3,7,7,7,7,7,4,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,6,6,7,7,7,7,7,7,6,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,3,5,6,7,7,7,7,7,7,7,6,5,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,2,4,5,5,5,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,3,1,0,0,0,0,0,0,0,0, +0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0, +0,0,4,7,7,7,7,6,6,6,6,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,4,0,0,0,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,4,6,7,7,7,4,0,0,0,0,0, +0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,6,1,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0, +0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0, +0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0, +0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0, +0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0, +0,0,4,7,7,7,7,4,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,5,7,7,7,5,1,0,0,0,0,0, +0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0, +0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0, +0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0, +0,0,3,7,7,7,7,4,1,1,1,1,1,2,2,1,1,2,6,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,4,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,1,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0, +0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0, +0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0, +0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,1,0,0,0,0,0, +0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0, +0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,1,0,0,0,0, +0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0, +0,0,0,6,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,7,4,0,0,0,0, +0,0,0,1,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,5,6,1,0,0,0,0,0,0,0,0,0,0,0,1,6,7,5,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,1,1,1,0,0,0,0, +0,0,0,0,0,2,7,7,7,7,5,0,0,0,0,0,0,0,0,1,4,7,7,7,7,7,7,7,7,7,6,1,0,0, +0,0,1,2,4,6,7,7,7,7,7,6,5,4,3,3,3,4,5,6,7,7,7,7,7,7,7,7,7,7,7,2,0,0, +0,2,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0, +1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,3,2,1,0,0,0,0, +2,7,7,7,7,7,7,7,7,7,7,7,6,5,5,4,4,3,3,3,4,7,7,7,7,7,2,0,0,0,0,0,0,0, +0,5,7,7,7,7,7,7,7,7,7,3,1,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,1,1,4,6,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,5,2,2,1,1,0,0,0, +0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,4,0,0, +0,0,0,0,0,0,4,7,7,7,7,5,3,3,3,4,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,3,1,0,0, +1,3,5,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,2,1,0,0,0,0,0, +2,7,7,7,7,7,7,7,7,7,7,7,7,4,3,2,2,2,3,2,2,6,7,7,7,6,0,0,0,0,0,0,0,0, +1,5,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,1,2,3,4,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,2,7,7,3,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,3,4,2,0,0,0,0,0,0,0,0,0,0,0,0,2,5,3,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,5,7,7,3,0,0,0,0,0,0,0,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,4,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,2,6,7,5,0,4,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,5,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +1,4,4,3,4,5,5,5,6,5,3,2,3,6,7,7,7,7,4,3,4,5,5,5,5,5,5,5,5,6,5,2,0,0, +4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, +3,7,7,7,7,7,7,7,7,7,6,6,7,7,7,7,7,7,4,4,5,6,7,7,7,7,7,7,7,7,7,3,0,0, +0,0,1,1,1,2,2,2,1,0,0,0,4,7,7,5,7,7,1,0,0,0,1,1,1,2,2,2,2,1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,7,4,0,6,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,3,7,7,1,0,2,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,2,7,7,6,0,0,0,5,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,6,7,7,5,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,1,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,6,7,7,7,6,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,5,7,7,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,1,5,6,1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,4,5,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,1,2,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,6,5,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,1,4,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,5,5,6,7,7,7,7,7,7,7,6,6,6,4,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,4,4,4,4,4,4,4,4,4,4,4,4,4,2,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,1,0,0,0,0, +0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0, +0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0, +0,0,0,1,2,4,6,7,7,7,7,5,3,3,3,3,3,3,3,3,5,7,7,7,7,7,4,3,2,0,0,0,0,0, +0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,1,1,1,2,5,7,7,7,7,5,2,1,1,0,0,0,0,1,3,7,7,7,7,6,2,2,2,0,0,0,0,0, +0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0, +0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0, +0,0,1,2,3,3,3,4,4,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,4,1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0, +0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0, +0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0, +0,0,0,2,4,4,7,7,7,7,6,2,2,4,7,7,7,7,7,4,3,5,7,7,7,7,6,4,2,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,3,0,0,0,6,7,7,7,3,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,2,0,0,0,5,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,2,0,0,0,4,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,2,0,0,0,4,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,2,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,2,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,2,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,7,7,7,3,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,6,7,7,3,0,0,0,3,7,7,7,2,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,6,7,7,3,0,0,0,3,7,7,7,3,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,3,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,3,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,3,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,3,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,3,0,0,0,2,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,3,0,0,0,2,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,3,0,0,0,2,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,3,0,0,0,1,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,3,0,0,0,1,7,7,7,5,0,0,0,1,6,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,3,0,0,0,1,7,7,7,5,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,4,0,0,0,1,7,7,7,5,0,0,0,0,6,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,4,0,0,0,1,7,7,7,6,0,0,0,0,6,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,4,0,0,0,1,7,7,7,6,0,0,0,0,6,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,4,0,0,0,1,7,7,7,6,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,4,0,0,0,1,7,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,3,7,7,4,0,0,0,0,6,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,3,7,7,4,0,0,0,0,6,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,3,7,7,4,0,0,0,0,6,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,3,7,7,5,0,0,0,0,7,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,7,7,6,1,0,0,2,7,7,7,7,3,0,0,0,6,7,7,4,0,0,0,0,0,0,0, +0,0,0,0,0,1,4,7,7,7,7,6,4,5,6,7,7,7,7,6,3,3,4,7,7,7,7,5,3,1,0,0,0,0, +0,0,1,5,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0, +0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0, +0,0,1,4,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,5,4,0,0,0,0, +0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +2,6,7,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,5,5,1,0,0, +5,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,4,0,0, +5,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,5,0,0, +5,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,5,0,0, +5,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,6,0,0, +5,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,1,0, +5,7,7,7,5,3,6,7,7,7,7,5,1,0,0,0,0,0,0,0,4,7,7,7,7,6,3,5,7,7,7,7,2,0, +6,7,7,7,1,0,0,3,7,7,7,7,6,2,0,0,0,0,0,4,7,7,7,7,5,1,0,1,7,7,7,7,1,0, +6,7,7,6,0,0,0,0,2,6,7,7,7,7,3,0,0,0,4,7,7,7,7,5,0,0,0,0,5,7,7,7,1,0, +5,7,7,6,0,0,0,0,0,1,5,7,7,7,7,6,5,6,7,7,7,7,4,0,0,0,0,0,3,7,7,7,1,0, +5,7,7,7,1,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,3,7,7,7,1,0, +5,7,7,7,1,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,2,7,7,7,1,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,2,6,7,6,1,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, +3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, +3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, +2,7,7,7,1,0,0,0,0,0,0,0,0,0,3,7,7,4,0,0,0,0,0,0,0,0,0,0,1,6,7,7,1,0, +2,7,7,7,1,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,4,7,4,0,0, +1,4,5,3,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,3,4,4,5,5,5,5,5,5,6,7,7,7,7,7,6,6,5,5,5,5,5,5,5,3,0,0,0,0,0, +0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0,0, +0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,6,6,5,3,0,0,0,0,0, +0,0,0,0,0,1,4,4,4,4,4,5,5,6,7,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +1,4,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0, +4,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,7,7,4,0,0, +5,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,5,0,0, +5,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,5,0,0, +6,7,7,7,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,6,0,0, +6,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,6,0,0, +6,7,7,7,6,4,5,7,7,7,6,1,0,0,0,0,0,0,0,0,3,7,7,7,7,5,2,5,7,7,7,6,0,0, +6,7,7,7,2,0,1,4,7,7,7,6,1,0,0,0,0,0,0,3,7,7,7,7,4,0,0,2,7,7,7,6,0,0, +6,7,7,7,1,0,0,0,3,6,7,7,6,1,0,0,0,0,4,7,7,7,7,4,0,0,0,0,5,7,7,6,0,0, +6,7,7,7,1,0,0,0,0,1,6,7,7,7,3,1,2,5,7,7,7,7,3,0,0,0,0,0,3,7,7,6,0,0, +6,7,7,7,1,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,5,2,0,0,0,0,0,0,4,7,7,6,0,0, +5,7,7,7,1,0,0,0,0,0,0,1,6,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,4,7,7,6,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,1,4,7,7,7,7,5,1,0,0,0,0,0,0,0,0,5,7,7,6,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,3,7,6,3,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0, +4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, +3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,0,0, +2,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,5,0,0, +2,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,2,0,0, +0,2,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, +0,0,0,0,4,5,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,4,1,0,0,0,0,0, +0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0, +0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,4,0,0,0,0,0,0, +0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,7,7,7,7,7,7,7,7,7,7,7,6,6,6,5,5,5,5,5,5,5,5,5,5,6,6,3,0,0,0,0, +0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0, +0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0, +0,0,0,1,1,1,1,1,2,2,2,2,3,7,7,7,7,7,6,3,2,2,1,1,1,1,1,1,1,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,2,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,5,1,0,0,0,0,0,0, +0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,4,0,0,0,0,0,0,0, +0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,4,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,3,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,3,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,4,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,1,5,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,1,5,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,7,2,2,6,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,7,7,7,7,7,7,6,2,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,7,7,7,7,6,1,0,1,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,7,7,7,6,1,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,7,7,6,2,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,7,6,1,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,7,2,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,1,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,1,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,0,0,0,0,0,0,0,0, +0,0,1,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0, +0,0,0,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,0, +0,0,0,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0, +0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0,0,0, +0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0, +0,0,0,5,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0, +0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0, +0,0,0,4,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,5,0,0,0,0, +0,0,0,3,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,2,0,0,0,0, +0,0,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,0,0,0,0, +0,0,1,3,4,4,4,5,5,5,5,5,5,5,5,5,5,5,4,4,3,4,5,6,6,7,7,7,7,7,2,0,0,0, +0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0, +0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0, +0,3,7,7,7,7,6,4,3,3,3,3,3,3,4,4,4,4,4,4,4,5,5,5,5,5,6,5,5,3,1,0,0,0, +0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,6,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,6,7,7,7,7,7,6,6,6,5,5,5,6,6,6,6,6,6,6,6,6,3,0,0,0,0,0,0,0,0,0,0, +0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0, +0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, +0,0,6,7,7,7,6,4,3,4,4,4,4,5,6,5,5,4,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,0, +0,0,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,5,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,2,0,0,0, +0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0, +0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0, +0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,2,0,0,0, +0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,3,3,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +2,5,5,5,5,5,5,4,4,4,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,5,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,5,1,0,0,0,0,0,0,0,2,2,0,0,0, +3,7,7,7,5,1,0,1,1,1,1,1,0,0,0,0,0,0,4,7,7,6,1,0,0,0,0,1,5,7,6,1,0,0, +3,7,7,7,7,7,6,7,7,7,7,7,4,1,0,0,0,0,4,7,7,7,3,0,0,0,0,3,7,7,7,1,0,0, +3,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,1,6,7,7,6,1,0,0,1,6,7,7,5,0,0,0, +2,7,7,7,7,6,5,5,5,6,6,7,6,3,0,0,0,0,0,3,7,7,7,3,0,0,4,7,7,7,2,0,0,0, +2,7,7,7,4,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,5,7,7,5,0,1,6,7,7,4,0,0,0,0, +2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,2,7,7,7,2,0,0,0,0, +3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,5,6,7,7,4,0,0,0,0,0, +3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,6,0,0,0,0,0,0, +3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,0, +3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,1,0,0,0,0,0,0, +3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,4,0,0,0,0,0,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,6,1,0,0,0,0,0, +4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,5,0,0,0,0,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,4,7,7,7,2,0,0,0,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,5,7,7,5,0,0,0,0, +4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,1,6,7,7,3,0,0,0, +4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,3,7,7,6,1,0,0, +4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,5,7,7,3,0,0, +4,7,7,7,6,4,3,2,2,1,1,1,1,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,1,7,7,5,0,0, +3,7,7,7,7,7,7,7,7,7,7,7,7,6,4,1,0,0,5,7,7,7,1,0,0,0,0,0,0,4,7,5,0,0, +1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,4,7,7,4,0,0,0,0,0,0,0,1,5,3,0,0, +0,3,6,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,1,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,3,3,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,3,5,6,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,2,7,7,7,7,7,6,3,2,2,2,2,2,4,5,6,7,7,7,7,6,2,0,0,0,0,0,0, +0,0,0,0,0,1,6,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,6,0,0,0,0,0,0, +0,0,0,0,1,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0,0,0, +0,0,0,0,4,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0, +0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,3,0,0,0,0, +0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,2,0,0,0,0, +0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0, +0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,1,0,0,0, +0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,7,7,4,0,0,0, +0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0, +0,0,0,0,0,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0, +0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0, +0,0,0,0,0,0,4,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,1,0,0,0,0,0, +0,0,0,0,0,0,0,4,7,7,7,7,5,2,0,0,0,0,0,0,1,2,5,7,7,7,6,2,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,7,7,7,7,7,5,4,3,2,2,4,6,7,7,7,7,5,1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,2,4,6,7,7,7,7,7,7,7,7,5,4,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,4,4,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,3,5,5,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0, +0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,3,0,0,0,0, +0,0,6,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0, +0,1,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,5,0,0,0,0, +0,1,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,6,0,0,0,0, +0,1,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,6,0,0,0,0, +0,1,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,6,0,0,0,0, +0,1,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,6,0,0,0,0, +0,1,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,6,1,0,0,0, +0,1,7,7,7,6,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,1,0,0,0, +0,1,7,7,7,4,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,4,7,7,7,5,5,7,7,7,1,0,0,0, +0,1,7,7,7,5,0,2,7,7,7,5,0,0,0,0,0,0,0,0,1,6,7,7,7,1,3,7,7,7,1,0,0,0, +0,1,7,7,7,5,0,0,6,7,7,7,2,0,0,0,0,0,0,0,5,7,7,7,4,0,4,7,7,7,1,0,0,0, +0,1,7,7,7,5,0,0,4,7,7,7,3,0,0,0,0,0,0,1,7,7,7,7,1,0,4,7,7,7,1,0,0,0, +0,1,7,7,7,5,0,0,1,7,7,7,5,0,0,0,0,0,0,3,7,7,7,5,0,0,4,7,7,7,2,0,0,0, +0,1,7,7,7,5,0,0,0,5,7,7,7,1,0,0,0,0,0,6,7,7,7,2,0,0,4,7,7,7,2,0,0,0, +0,1,7,7,7,6,0,0,0,2,7,7,7,4,0,0,0,0,3,7,7,7,5,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,6,0,0,0,0,6,7,7,6,0,0,0,0,6,7,7,7,2,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,6,0,0,0,0,3,7,7,7,1,0,0,2,7,7,7,5,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,6,1,0,0,0,1,7,7,7,3,0,0,4,7,7,7,3,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,7,1,0,0,0,0,4,7,7,5,0,0,6,7,7,6,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,7,1,0,0,0,0,2,7,7,7,2,1,7,7,7,2,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,6,7,7,7,1,0,0,0,0,0,6,7,7,5,5,7,7,6,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,0,6,7,7,6,1,0,0,0,0,0,4,7,7,7,7,7,7,4,0,0,0,0,0,0,4,7,7,7,2,0,0,0, +0,0,6,7,7,6,1,0,0,0,0,0,2,7,7,7,7,7,7,2,0,0,0,0,0,0,4,7,7,7,2,0,0,0, +0,0,6,7,7,6,0,0,0,0,0,0,0,5,7,7,7,7,5,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0, +0,0,6,7,7,6,0,0,0,0,0,0,0,1,6,7,7,7,1,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0, +0,0,6,7,7,6,0,0,0,0,0,0,0,0,2,6,7,4,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0, +0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0, +0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0, +0,1,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0, +0,1,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,1,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, +0,0,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0, +0,0,5,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,0,0,0,0, +0,0,4,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,5,0,0,0,0, +0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; + +void busicom_state::video_start() +{ +} + +UINT32 busicom_state::screen_update_busicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int y, x, b, j; + //34x44 + for (y = 0; y < 11; y++) + { + UINT8 col = 8 * m_printer_line_color[y]; + for (x = 0; x < 17; x++) + { + UINT8 chr = m_printer_line[y][x]; + for (j = 0; j < 44; j++) { + for (b = 0; b < 34; b++) + { + bitmap.pix16((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; + } + for (b = 34; b < 40; b++) + { + bitmap.pix16((y*44)+j, x*40+b) = 0; + } + + } + } + } + return 0; +} +static const UINT8 color[] = { 0xFF,0xDB,0xB7,0x92,0x6E,0x49,0x25,0x00 }; + +static const UINT8 color_red[] = { 0xb0,0xb5,0xc0,0xc5,0xd0,0xd5,0xdf }; + +PALETTE_INIT_MEMBER(busicom_state, busicom) +{ + int i; + for(i=0;i<8;i++) { + m_palette->set_pen_color( i, rgb_t(color[i],color[i],color[i]) ); + } + m_palette->set_pen_color( 8, rgb_t(0xff,0xff,0xff) ); + for(i=0;i<7;i++) { + m_palette->set_pen_color( i+9, rgb_t(color_red[i],0x00,0x00) ); + } +} diff --git a/src/mame/video/cgc7900.c b/src/mame/video/cgc7900.c new file mode 100644 index 00000000000..0eb1cda1dd6 --- /dev/null +++ b/src/mame/video/cgc7900.c @@ -0,0 +1,237 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "emu.h" +#include "includes/cgc7900.h" + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +#define OVERLAY_CUR BIT(cell, 31) /* places a cursor in the cell if SET */ +#define OVERLAY_BLK BIT(cell, 30) /* blinks the foreground character in the cell if SET */ +#define OVERLAY_VF BIT(cell, 28) /* makes the foreground visible if SET (else transparent) */ +#define OVERLAY_VB BIT(cell, 27) /* makes the background visible if SET (else transparent) */ +#define OVERLAY_PL BIT(cell, 24) /* uses bits 0-7 as PLOT DOT descriptor if SET (else ASCII) */ +#define OVERLAY_BR BIT(cell, 18) /* turns on Red in background if SET */ +#define OVERLAY_BG BIT(cell, 17) /* turns on Green in background if SET */ +#define OVERLAY_BB BIT(cell, 16) /* turns on Blue in background if SET */ +#define OVERLAY_FR BIT(cell, 10) /* turns on Red in foreground if SET */ +#define OVERLAY_FG BIT(cell, 9) /* turns on Green in foreground if SET */ +#define OVERLAY_FB BIT(cell, 8) /* turns on Blue in background if SET */ +#define OVERLAY_DATA (cell & 0xff) /* ASCII or Plot Dot character */ + +#define IMAGE_SELECT BIT(m_roll_overlay[0], 13) +#define OVERLAY_CURSOR_BLINK BIT(m_roll_overlay[0], 12) +#define OVERLAY_CHARACTER_BLINK BIT(m_roll_overlay[0], 11) + +PALETTE_INIT_MEMBER(cgc7900_state, cgc7900) +{ + palette.set_pen_color(0, rgb_t::black); + palette.set_pen_color(1, rgb_t(0x00, 0x00, 0xff)); + palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); + palette.set_pen_color(3, rgb_t(0x00, 0xff, 0xff)); + palette.set_pen_color(4, rgb_t(0xff, 0x00, 0x00)); + palette.set_pen_color(5, rgb_t(0xff, 0x00, 0xff)); + palette.set_pen_color(6, rgb_t(0xff, 0xff, 0x00)); + palette.set_pen_color(7, rgb_t::white); +} + +/*************************************************************************** + READ/WRITE HANDLERS +***************************************************************************/ + +/*------------------------------------------------- + cgc7900_z_mode_r - Z mode read +-------------------------------------------------*/ + +READ16_MEMBER( cgc7900_state::z_mode_r ) +{ + return 0; +} + +/*------------------------------------------------- + cgc7900_z_mode_w - Z mode write +-------------------------------------------------*/ + +WRITE16_MEMBER( cgc7900_state::z_mode_w ) +{ +} + +/*------------------------------------------------- + cgc7900_color_status_w - color status write +-------------------------------------------------*/ + +WRITE16_MEMBER( cgc7900_state::color_status_w ) +{ +} + +/*------------------------------------------------- + cgc7900_sync_r - sync information read +-------------------------------------------------*/ + +READ16_MEMBER( cgc7900_state::sync_r ) +{ + /* + + bit signal description + + 0 _VERT vertical retrace (0=vblank) + 1 interlace (1=first field, 0=second field) + 2 _HG horizontal retrace (0=hblank) + 3 1 + 4 1 + 5 1 + 6 1 + 7 1 + 8 1 + 9 1 + 10 1 + 11 1 + 12 1 + 13 1 + 14 1 + 15 1 + + */ + + return 0xffff; +} + +/*************************************************************************** + VIDEO +***************************************************************************/ + +/*------------------------------------------------- + update_clut - update color lookup table +-------------------------------------------------*/ + +void cgc7900_state::update_clut() +{ + for (int i = 0; i < 256; i++) + { + UINT16 addr = i * 2; + UINT32 data = (m_clut_ram[addr + 1] << 16) | m_clut_ram[addr]; + UINT8 b = data & 0xff; + UINT8 g = (data >> 8) & 0xff; + UINT8 r = (data >> 16) & 0xff; + + m_clut[i] = rgb_t(r, g, b); + } +} + +/*------------------------------------------------- + draw_bitmap - draw bitmap image +-------------------------------------------------*/ + +void cgc7900_state::draw_bitmap(screen_device *screen, bitmap_rgb32 &bitmap) +{ +} + +/*------------------------------------------------- + draw_overlay - draw text overlay +-------------------------------------------------*/ + +void cgc7900_state::draw_overlay(screen_device *screen, bitmap_rgb32 &bitmap) +{ + const pen_t *pen = m_palette->pens(); + for (int y = 0; y < 768; y++) + { + int sy = y / 8; + int line = y % 8; + + for (int sx = 0; sx < 85; sx++) + { + UINT16 addr = (sy * 170) + (sx * 2); + UINT32 cell = (m_overlay_ram[addr] << 16) | m_overlay_ram[addr + 1]; + UINT8 data = m_char_rom->base()[(OVERLAY_DATA << 3) | line]; + int fg = (cell >> 8) & 0x07; + int bg = (cell >> 16) & 0x07; + + for (int x = 0; x < 8; x++) + { + if (OVERLAY_CUR) + { + if (!OVERLAY_CURSOR_BLINK || m_blink) + { + bitmap.pix32(y, (sx * 8) + x) = pen[7]; + } + } + else + { + if (BIT(data, x) && (!OVERLAY_CHARACTER_BLINK || m_blink)) + { + if (OVERLAY_VF) bitmap.pix32(y, (sx * 8) + x) = pen[fg]; + } + else + { + if (OVERLAY_VB) bitmap.pix32(y, (sx * 8) + x) = pen[bg]; + } + } + } + } + } +} + +/*------------------------------------------------- + TIMER_DEVICE_CALLBACK_MEMBER( blink_tick ) +-------------------------------------------------*/ + +TIMER_DEVICE_CALLBACK_MEMBER(cgc7900_state::blink_tick) +{ + m_blink = !m_blink; +} + +UINT32 cgc7900_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + update_clut(); + draw_bitmap(&screen, bitmap); + draw_overlay(&screen, bitmap); + + return 0; +} + +/*------------------------------------------------- + gfx_layout cgc7900_charlayout +-------------------------------------------------*/ + +static const gfx_layout cgc7900_charlayout = +{ + 8,8, + RGN_FRAC(1,1), + 1, + { RGN_FRAC(0,1) }, + { STEP8(7,-1) }, + { STEP8(0,8) }, + 8*8 +}; + +/*------------------------------------------------- + GFXDECODE( cgc7900 ) +-------------------------------------------------*/ + +static GFXDECODE_START( cgc7900 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, cgc7900_charlayout, 0, 1 ) +GFXDECODE_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +/*------------------------------------------------- + MACHINE_DRIVER( cgc7900_video ) +-------------------------------------------------*/ + +MACHINE_CONFIG_FRAGMENT( cgc7900_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_UPDATE_DRIVER(cgc7900_state, screen_update) + MCFG_SCREEN_SIZE(1024, 768) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", cgc7900) + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(cgc7900_state, cgc7900) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("blink", cgc7900_state, blink_tick, attotime::from_hz(XTAL_28_48MHz/7500000)) +MACHINE_CONFIG_END diff --git a/src/mame/video/channelf.c b/src/mame/video/channelf.c new file mode 100644 index 00000000000..03a5310e934 --- /dev/null +++ b/src/mame/video/channelf.c @@ -0,0 +1,71 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle +#include "includes/channelf.h" + +static const rgb_t channelf_palette[] = +{ + rgb_t(0x10, 0x10, 0x10), /* black */ + rgb_t(0xfd, 0xfd, 0xfd), /* white */ + rgb_t(0xff, 0x31, 0x53), /* red */ + rgb_t(0x02, 0xcc, 0x5d), /* green */ + rgb_t(0x4b, 0x3f, 0xf3), /* blue */ + rgb_t(0xe0, 0xe0, 0xe0), /* ltgray */ + rgb_t(0x91, 0xff, 0xa6), /* ltgreen */ + rgb_t(0xce, 0xd0, 0xff) /* ltblue */ +}; + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define LTGRAY 5 +#define LTGREEN 6 +#define LTBLUE 7 + +static const UINT16 colormap[] = { + BLACK, WHITE, WHITE, WHITE, + LTBLUE, BLUE, RED, GREEN, + LTGRAY, BLUE, RED, GREEN, + LTGREEN, BLUE, RED, GREEN, +}; + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(channelf_state, channelf) +{ + palette.set_pen_colors(0, channelf_palette, ARRAY_LENGTH(channelf_palette)); +} + +void channelf_state::video_start() +{ + m_p_videoram = memregion("vram")->base(); +} + +int channelf_state::recalc_palette_offset(int reg1, int reg2) +{ + /* Note: This is based on the decoding they used to */ + /* determine which palette this line is using */ + + return ((reg2&0x2)|(reg1>>1)) << 2; +} + +UINT32 channelf_state::screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,col; + UINT16 ma=0,x; + int palette_offset; + + for(y = 0; y < 64; y++ ) + { + UINT16 *p = &bitmap.pix16(y); + palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3); + + for (x = ma; x < ma + 128; x++) + { + col = palette_offset+(m_p_videoram[x|(y<<7)]&3); + *p++ = colormap[col]; + } + ma+=128; + } + return 0; +} diff --git a/src/mame/video/comquest.c b/src/mame/video/comquest.c new file mode 100644 index 00000000000..cbfb1014fe7 --- /dev/null +++ b/src/mame/video/comquest.c @@ -0,0 +1,24 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#include "emu.h" + +#include "includes/comquest.h" + +void comquest_state::video_start() +{ +} + +UINT32 comquest_state::screen_update_comquest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, j; + + for (y=0; y<128;y++) { + for (x=0, j=0; j<8;j++,x+=8*4) { +#if 0 + m_gfxdecode->gfx(0)->opaque(bitmap,0, state->m_data[y][j],0, + 0,0,x,y); +#endif + } + } + return 0; +} diff --git a/src/mame/video/comx35.c b/src/mame/video/comx35.c new file mode 100644 index 00000000000..4c214006776 --- /dev/null +++ b/src/mame/video/comx35.c @@ -0,0 +1,126 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "emu.h" +#include "rendlay.h" +#include "includes/comx35.h" +#include "cpu/cosmac/cosmac.h" +#include "sound/cdp1869.h" +#include "sound/wave.h" +#include "video/mc6845.h" + +WRITE8_MEMBER( comx35_state::cdp1869_w ) +{ + UINT16 ma = m_maincpu->get_memory_address(); + + switch (offset) + { + case 3: + m_vis->out3_w(space, ma, data); + break; + + case 4: + m_vis->out4_w(space, ma, data); + break; + + case 5: + m_vis->out5_w(space, ma, data); + break; + + case 6: + m_vis->out6_w(space, ma, data); + break; + + case 7: + m_vis->out7_w(space, ma, data); + break; + } +} + +/* CDP1869 */ + +static ADDRESS_MAP_START( cdp1869_page_ram, AS_0, 8, driver_device ) + AM_RANGE(0x000, 0x7ff) AM_RAM +ADDRESS_MAP_END + +CDP1869_CHAR_RAM_READ_MEMBER( comx35_state::comx35_charram_r ) +{ + UINT8 column = pmd & 0x7f; + UINT16 charaddr = (column << 4) | cma; + + return m_char_ram[charaddr]; +} + +CDP1869_CHAR_RAM_WRITE_MEMBER( comx35_state::comx35_charram_w ) +{ + UINT8 column = pmd & 0x7f; + UINT16 charaddr = (column << 4) | cma; + + m_char_ram[charaddr] = data; +} + +CDP1869_PCB_READ_MEMBER( comx35_state::comx35_pcb_r ) +{ + return BIT(pmd, 7); +} + +WRITE_LINE_MEMBER( comx35_state::prd_w ) +{ + if ((m_prd == CLEAR_LINE) && (state == ASSERT_LINE)) + { + m_cr1 = m_iden ? CLEAR_LINE : ASSERT_LINE; + check_interrupt(); + } + + m_prd = state; + + m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF1, state); +} + + +void comx35_state::video_start() +{ + // allocate memory + m_char_ram.allocate(COMX35_CHARRAM_SIZE); +} + +/* Machine Drivers */ + +MACHINE_CONFIG_FRAGMENT( comx35_pal_video ) + MCFG_CDP1869_SCREEN_PAL_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_CDP1869_ADD(CDP1869_TAG, CDP1869_DOT_CLK_PAL, cdp1869_page_ram) + MCFG_CDP1869_COLOR_CLOCK(CDP1869_COLOR_CLK_PAL) + MCFG_CDP1869_CHAR_PCB_READ_OWNER(comx35_state, comx35_pcb_r) + MCFG_CDP1869_CHAR_RAM_READ_OWNER(comx35_state, comx35_charram_r) + MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(comx35_state, comx35_charram_w) + MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_CDP1869_PRD_CALLBACK(WRITELINE(comx35_state, prd_w)) + MCFG_CDP1869_SET_SCREEN(SCREEN_TAG) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( comx35_ntsc_video ) + MCFG_CDP1869_SCREEN_NTSC_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_NTSC) + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_CDP1869_ADD(CDP1869_TAG, CDP1869_DOT_CLK_NTSC, cdp1869_page_ram) + MCFG_CDP1869_COLOR_CLOCK(CDP1869_COLOR_CLK_NTSC) + MCFG_CDP1869_CHAR_PCB_READ_OWNER(comx35_state, comx35_pcb_r) + MCFG_CDP1869_CHAR_RAM_READ_OWNER(comx35_state, comx35_charram_r) + MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(comx35_state, comx35_charram_w) + MCFG_CDP1869_PAL_NTSC_CALLBACK(GND) + MCFG_CDP1869_PRD_CALLBACK(WRITELINE(comx35_state, prd_w)) + MCFG_CDP1869_SET_SCREEN(SCREEN_TAG) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END diff --git a/src/mame/video/crt.c b/src/mame/video/crt.c new file mode 100644 index 00000000000..d075600baf7 --- /dev/null +++ b/src/mame/video/crt.c @@ -0,0 +1,184 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + video/crt.c + + CRT video emulation for TX-0 and PDP-1. + + +Theory of operation: + + What makes such CRT devices so odd is that there is no video processor, no + scan logic, no refresh logic. The beam position and intensity is + controlled by the program completely: in order to draw an object, the + program must direct the beam to each point of the object, and in order to + refresh it, the program must redraw the object periodically. + + Since the refresh rates are highly variable (completely controlled by the + program), I need to simulate CRT remanence: the intensity of each pixel on + display decreases regularly. In order to keep this efficient, I keep a + list of non-black pixels, and only process these pixels on each refresh. + In order to improve efficiency further, I keep a distinct list for each + line of the display: I have found that it improves drawing speed slightly + (probably because it improves the cache hit rate). + + + Raphael Nabet 2002-2004 + Based on earlier work by Chris Salomon +*/ + +#include "emu.h" +#include "video/crt.h" + + +// special value that tells that the node is not in list +enum +{ + intensity_pixel_not_in_list = -1 +}; + + +// device type definition +const device_type CRT = &device_creator; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// crt_device - constructor +//------------------------------------------------- + +crt_device::crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CRT, "CRT Video", tag, owner, clock, "crt", __FILE__), + m_list(NULL), + m_list_head(NULL), + m_decay_counter(0), + m_num_intensity_levels(0), + m_window_offset_x(0), + m_window_offset_y(0), + m_window_width(0), + m_window_height(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void crt_device::device_start() +{ + /* alloc the arrays */ + m_list = auto_alloc_array(machine(), crt_point, m_window_width * m_window_height); + m_list_head = auto_alloc_array(machine(), int, m_window_height); + + /* fill with black and set up list as empty */ + for (int i = 0; i < (m_window_width * m_window_height); i++) + m_list[i].intensity = intensity_pixel_not_in_list; + + for (int i = 0; i < m_window_height; i++) + m_list_head[i] = -1; + + m_decay_counter = 0; +} + + +// +// crt_plot +// +// schedule a pixel to be plotted +// +void crt_device::plot(int x, int y) +{ + crt_point *node; + int list_index; + + /* compute pixel coordinates */ + if (x<0) x=0; + if (y<0) y=0; + if ((x>(m_window_width-1)) || ((y>m_window_height-1))) + return; + y = (m_window_height-1) - y; + + /* find entry in list */ + list_index = x + y*m_window_width; + + node = &m_list[list_index]; + + if (node->intensity == intensity_pixel_not_in_list) + { /* insert node in list if it is not in it */ + node->next = m_list_head[y]; + m_list_head[y] = list_index; + } + /* set intensity */ + node->intensity = m_num_intensity_levels; +} + + +// +// crt_eof +// +// keep track of time +// +void crt_device::eof() +{ + m_decay_counter++; +} + + +// +// crt_update +// +// update the bitmap +// +void crt_device::update(bitmap_ind16 &bitmap) +{ + int i, p_i; + int y; + + //if (m_decay_counter) + { + /* some time has elapsed: let's update the screen */ + for (y=0; yintensity == m_num_intensity_levels) + /* new pixel: set to max intensity */ + node->intensity = m_num_intensity_levels-1; + else + { + /* otherwise, apply intensity decay */ + node->intensity -= m_decay_counter; + if (node->intensity < 0) + node->intensity = 0; + } + + /* draw pixel on screen */ + //plot_pixel(bitmap, x, y+m_window_offset_y, node->intensity); + line[x] = node->intensity; + + if (node->intensity != 0) + p_i = i; /* current node will be next iteration's previous node */ + else + { /* delete current node */ + node->intensity = intensity_pixel_not_in_list; + if (p_i != -1) + m_list[p_i].next = node->next; + else + m_list_head[y] = node->next; + } + } + } + + m_decay_counter = 0; + } +} diff --git a/src/mame/video/crt.h b/src/mame/video/crt.h new file mode 100644 index 00000000000..cb0767ad0d9 --- /dev/null +++ b/src/mame/video/crt.h @@ -0,0 +1,93 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/************************************************************************* + + video/crt.h + + CRT video emulation for TX-0 and PDP-1 + +*************************************************************************/ + +#ifndef __CRT_H__ +#define __CRT_H__ + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_CRT_NUM_LEVELS(_lev) \ + crt_device::set_num_levels(*device, _lev); + +#define MCFG_CRT_OFFSETS(_xoffs, _yoffs) \ + crt_device::set_offsets(*device, _xoffs, _yoffs); + +#define MCFG_CRT_SIZE(_width, _height) \ + crt_device::set_size(*device, _width, _height); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +struct crt_point +{ + crt_point() : + intensity(0), + next(0) {} + + int intensity; /* current intensity of the pixel */ + /* a node is not in the list when (intensity == -1) */ + int next; /* index of next pixel in list */ +}; + +// ======================> crt_device + +class crt_device : public device_t +{ +public: + crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~crt_device() { } + + static void set_num_levels(device_t &device, int levels) { downcast(device).m_num_intensity_levels = levels; } + static void set_offsets(device_t &device, int x_offset, int y_offset) + { + crt_device &dev = downcast(device); + dev.m_window_offset_x = x_offset; + dev.m_window_offset_y = y_offset; + } + static void set_size(device_t &device, int width, int height) + { + crt_device &dev = downcast(device); + dev.m_window_width = width; + dev.m_window_height = height; + } + + void plot(int x, int y); + void eof(); + void update(bitmap_ind16 &bitmap); + +protected: + // device-level overrides + virtual void device_start(); + +private: + crt_point *m_list; /* array of (crt_window_width*crt_window_height) point */ + int *m_list_head; /* head of the list of lit pixels (index in the array) */ + /* keep a separate list for each display line (makes the video code slightly faster) */ + + int m_decay_counter; /* incremented each frame (tells for how many frames the CRT has decayed between two screen refresh) */ + + /* CRT window */ + int m_num_intensity_levels; + int m_window_offset_x; + int m_window_offset_y; + int m_window_width; + int m_window_height; +}; + +extern const device_type CRT; + + + +#endif /* CRT_H_ */ diff --git a/src/mame/video/dai.c b/src/mame/video/dai.c new file mode 100644 index 00000000000..a0d36a8097c --- /dev/null +++ b/src/mame/video/dai.c @@ -0,0 +1,764 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha, Nathan Woods +/*************************************************************************** + + dai.c + + Functions to emulate the video hardware of DAI. + + Krzysztof Strzecha + + All video modes are emulated but not fully tested yet. + dai_state::screen_update_dai() function needs strong cleanup and optimalisation. + + +***************************************************************************/ + +#include "emu.h" +#include "includes/dai.h" + +#define DEBUG_DAI_VIDEO 0 + +#define LOG_DAI_VIDEO_LINE(_mode, _unit, _resolution, _repeat, _scan) do { if (DEBUG_DAI_VIDEO) logerror ("Mode: %02x, Unit: %02x, Resolution: %02x, Repeat: %d, Current line: %d\n", _mode, _unit, _resolution, _repeat, _scan); } while (0) + +const unsigned char dai_palette[16*3] = +{ + 0x00, 0x00, 0x00, /* 0 Black */ + 0x00, 0x00, 0x8b, /* 1 Dark Blue */ + 0xb1, 0x00, 0x95, /* 2 Purple Red */ + 0xff, 0x00, 0x00, /* 3 Red */ + 0x75, 0x2e, 0x50, /* 4 Purple Brown */ + 0x00, 0xb2, 0x38, /* 5 Emerald Green */ + 0x98, 0x62, 0x00, /* 6 Kakhi Brown */ + 0xae, 0x7a, 0x00, /* 7 Mustard Brown */ + 0x89, 0x89, 0x89, /* 8 Grey */ + 0xa1, 0x6f, 0xff, /* 9 Middle Blue */ + 0xff, 0xa5, 0x00, /* 10 Orange */ + 0xff, 0x99, 0xff, /* 11 Pink */ + 0x9e, 0xf4, 0xff, /* 12 Light Blue */ + 0xb3, 0xff, 0xbb, /* 13 Light Green */ + 0xff, 0xff, 0x28, /* 14 Light Yellow */ + 0xff, 0xff, 0xff, /* 15 White */ +}; + + +PALETTE_INIT_MEMBER(dai_state, dai) +{ + int i; + + for ( i = 0; i < sizeof(dai_palette) / 3; i++ ) + { + m_palette->set_pen_color(i, dai_palette[i * 3], dai_palette[i * 3 + 1], dai_palette[i * 3 + 2]); + } +} + + +void dai_state::video_start() +{ +} + +UINT32 dai_state::screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int i, j, k, l; + + UINT8* char_rom = memregion("gfx1")->base(); + + UINT16 dai_video_memory_start = 0xbfff; + UINT16 dai_scan_lines = 604; /* scan lines of PAL tv */ + + UINT16 current_scan_line = 0; + UINT16 current_video_memory_address = dai_video_memory_start; + + UINT8 mode; /* mode byte of line + bits 0-3 - line repeat count + bits 4-5 - resolution control + bits 6-7 - display mode control */ + UINT8 colour; /* colour byte of line + bits 0-3 - one of 16 colours + bits 4-5 - colour register for update + bit 6 - if unset force 'unit colour mode' + bit 7 - enable coulor change + if unset bits 0-5 are ignored */ + UINT8 line_repeat_count; /* number of horizontalraster scans + for which same data will be displayed + 0000 - 2 lines + each additional repeat adds 2 scans */ + UINT8 horizontal_resolution; /* number of blobs per line + 00 - 88 (low resolution graphics) + 01 - 176 (medium resolution graphics) + 10 - 352 (high resolution graphics) + 11 - 528 (text with 66 chars per line) */ + UINT8 display_mode; /* determine how data will be used + to generate the picture + 00 - four colour graphics + 01 - four colour characters + 10 - sixteen colour graphics + 11 - sixteen colour characters */ + UINT8 unit_mode; + + UINT8 current_data_1, current_data_2; + + UINT8 current_colour; + + while (current_scan_line < dai_scan_lines) + { + mode = space.read_byte(current_video_memory_address--); + colour = space.read_byte(current_video_memory_address--); + line_repeat_count = mode & 0x0f; + horizontal_resolution = (mode & 0x30) >> 4; + display_mode = (mode & 0xc0) >> 6; + unit_mode = (colour & 0x40) >> 6; + + if (colour & 0x80) + m_4_colours_palette[(colour & 0x30) >> 4] = colour & 0x0f; + + switch (display_mode) + { + case 0x00: /* 4 colour grahics modes */ + switch (horizontal_resolution) + { + case 0x00: /* 88 pixels */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + + for (i=0; i<11; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (l=0; l<12; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + case 1: + for (i=0; i<11; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (l=0; l<12; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + } + } + } + break; + } + break; + + case 0x01: /* 176 pixels */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<22; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (l=0; l<6; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + case 1: + for (i=0; i<22; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (l=0; l<6; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + } + } + } + break; + } + break; + + case 0x02: /* 352 pixels */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<44; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (l=0; l<3; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + } + } + } + break; + case 1: + for (i=0; i<44; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (l=0; l<3; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + } + } + } + break; + } + break; + + case 0x03: /* 528 pixels */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<66; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (l=0; l<2; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + } + } + } + break; + case 1: + for (i=0; i<66; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (l=0; l<2; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + } + } + } + break; + } + break; + } + break; + + case 0x01: /* 4 colour characters */ + switch (horizontal_resolution) + { + case 0x00: /* 11 chars */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address); + current_data_2 = space.read_byte(current_video_memory_address-1); + current_video_memory_address-=2; + for (i=0; i<11; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (l=0; l<12; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + case 1: + for (i=0; i<11; i++) + { + current_data_1 = space.read_byte(current_video_memory_address); + current_data_2 = space.read_byte(current_video_memory_address-1); + current_video_memory_address-=2; + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (l=0; l<12; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + } + break; + case 0x01: /* 22 chars */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address); + current_data_2 = space.read_byte(current_video_memory_address-1); + current_video_memory_address-=2; + for (i=0; i<22; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (l=0; l<6; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + case 1: + for (i=0; i<22; i++) + { + current_data_1 = space.read_byte(current_video_memory_address); + current_data_2 = space.read_byte(current_video_memory_address-1); + current_video_memory_address-=2; + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (l=0; l<6; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + } + break; + case 0x02: /* 44 chars */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address); + current_data_2 = space.read_byte(current_video_memory_address-1); + current_video_memory_address-=2; + for (i=0; i<44; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (l=0; l<3; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + } + } + } + break; + case 1: + for (i=0; i<44; i++) + { + current_data_1 = space.read_byte(current_video_memory_address); + current_data_2 = space.read_byte(current_video_memory_address-1); + current_video_memory_address-=2; + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (l=0; l<3; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + } + } + } + break; + } + break; + case 0x03: /* 66 chars */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address); + current_data_2 = space.read_byte(current_video_memory_address-1); + current_video_memory_address-=2; + for (i=0; i<66; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (l=0; l<2; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + } + } + } + break; + case 1: + for (i=0; i<66; i++) + { + current_data_1 = space.read_byte(current_video_memory_address); + current_data_2 = space.read_byte(current_video_memory_address-1); + current_video_memory_address-=2; + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (l=0; l<2; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + } + } + } + break; + } + break; + } + break; + case 0x02: /* 16 colour graphics */ + switch (horizontal_resolution) + { + case 0x00: /* 88 pixels */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + + for (i=0; i<11; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<12; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + case 1: + for (i=0; i<11; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<12; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + } + } + } + break; + } + break; + + case 0x01: /* 176 pixels */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<22; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<6; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + case 1: + for (i=0; i<22; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<6; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + } + } + } + break; + } + break; + + case 0x02: /* 352 pixels */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<44; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<3; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + } + } + } + break; + case 1: + for (i=0; i<44; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<3; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + } + } + } + break; + } + break; + + case 0x03: /* 528 pixels */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<66; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<2; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + } + } + } + break; + case 1: + for (i=0; i<66; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<2; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + } + } + } + break; + } + break; + } + break; + case 0x03: /* 16 colour characters */ + switch (horizontal_resolution) + { + case 0x00: /* 11 chars */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<11; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<12; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + case 1: + for (i=0; i<11; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<12; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + } + break; + case 0x01: /* 22 chars */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<22; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<6; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + case 1: + for (i=0; i<22; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<6; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + } + } + } + current_video_memory_address-=2; + break; + } + break; + case 0x02: /* 44 chars */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<44; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<3; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + } + } + } + break; + case 1: + for (i=0; i<44; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<3; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + } + } + } + break; + } + break; + case 0x03: /* 66 chars */ + switch (unit_mode) + { + case 0: + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (i=0; i<66; i++) + { + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<2; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + } + } + } + break; + case 1: + for (i=0; i<66; i++) + { + current_data_1 = space.read_byte(current_video_memory_address--); + current_data_2 = space.read_byte(current_video_memory_address--); + for (j=0; j<=line_repeat_count; j++) + { + for (k=0; k<8; k++) + { + current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (l=0; l<2; l++) + bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + } + } + } + break; + } + break; + } + break; + } + current_scan_line += line_repeat_count*2+2; + LOG_DAI_VIDEO_LINE(display_mode, unit_mode, horizontal_resolution, line_repeat_count, current_scan_line); + } + return 0; +} diff --git a/src/mame/video/dgn_beta.c b/src/mame/video/dgn_beta.c new file mode 100644 index 00000000000..41cb1fde657 --- /dev/null +++ b/src/mame/video/dgn_beta.c @@ -0,0 +1,286 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/* + video/dgn_beta.c + +The Dragon Beta uses a 68B45 for it's display generation, this is used in the +conventional wat with a character generator ROM in the two text modes, which are +standard 40x25 and 80x25. In adition to the 6845 there is some TTL logic which +provides colour and attributes. In text modes the video ram is organised as pairs +of character and attribute, in alternate bytes. + +The attributes decode as follows :- + + 7-6-5-4-3-2-1-0 + f-u-F-F-F-B-B-B + + f=flash + u=underline + + FFF = foreground colour + BBB = bakcground colour + + 000 black + 001 red + 010 green + 011 yellow + 100 blue + 101 magenta + 110 cyan + 111 white + + If flash is true, foreground and background colours will be exchanged. + +It is interesting to note that the 6845 uses 16 bit wide access to the ram, in contrast +to the 8 bit accesses from the CPUs, this allows each increment of the MA lines to move +2 bytes at a time, and therefore feed both the character rom and the attribute decode +circuit simultaniously. + +The RAM addresses are made up of two parts, the MA0..13 from the 6845, plus two output +lines from the 6821 PIA, I28, the lines are BP6 and PB7, with PB7 being the most +significant. This effectivly allows the 6845 access to the first 128K of memory, as there +are 16 address lines, accessing a 16 bit wide memory. + +The relationship between how the cpu sees the RAM, and the way the 6845 sees it is simply +CPU addr=2x6845 addr. So for the default video address of $1F000, the CPU sees this as +being at $1F000 (after DAT trasnlation). The 6845 is programmed to start it's MA lines +counting at $3800, plus A14 and A15 being supplied by PB6 and PB7 from I28, gives an address +of $F800, which is the same as $1F000 / 2. + +I am currently at this time not sure of how any of the graphics modes, work, this will need +further investigation. + +However the modes supported are :- + +Text Modes + width height colours + 40 25 8 + 80 25 8 +Graphics modes + 320 256 4 + 320 256 16 + 640 512 4 + 640 256 4** + 640 512 2 + +Looking at the parts of the circuit sheet that I have seen it looks like the graphics modes +are driven using a combination of the 6845 MA and RA lines to address more than 64K or memory +which is needed for some of the modes above (specifically, 640x512x4, which needs 80K). + +2006-11-30, Text mode is almost completely implemented, in both 40 and 80 column modes. +I have made a start on implementing the graphics modes of the beta, drawing from technical +documents, from the project, this is still a work in progress. I have however managed to get +it to display a distorted graphical image, so I know I am going in the correct direction ! + +** 2006-12-05, this mode is not documented in any of the printed documentation, however it +is supported and displayed by the graphics test rom, it is basically the 640x512x4 mode with +half the number of vertical lines, and in non-interlaced mode. + +It seems that the 640x512 modes operate the 6845 in interlaced mode, just how this affects +the access to the video memory is unclear to me at the moment. + +*/ + +#include "emu.h" +#include "includes/dgn_beta.h" + +/* GCtrl bitmasks, infered from bits of Beta schematic */ +#define GCtrlWI 0x01 +#define GCtrlSWChar 0x02 /* Character set select */ +#define GCtrlHiLo 0x04 /* Hi/Lo res graphics, Hi=1, Lo=0 */ +#define GCtrlChrGfx 0x08 /* Character=1 / Graphics=0 */ +#define GCtrlControl 0x10 /* Control bit, sets direct drive mode */ +#define GCtrlFS 0x20 /* labeled F/S, not yet sure of function Fast or Slow scan ? */ +#define GCtrlAddrLines 0xC0 /* Top two address lines for text mode */ + +#define IsTextMode (m_GCtrl & GCtrlChrGfx) ? 1 : 0 // Is this text mode ? +#define IsGfx16 ((~m_GCtrl & GCtrlChrGfx) && (~m_GCtrl & GCtrlControl)) ? 1 : 0 // is this 320x256x16bpp mode +#define IsGfx2 ((m_GCtrl & GCtrlHiLo) && (~m_GCtrl & GCtrlFS)) ? 1 : 0 // Is this a 2 colour mode +#define SWChar (m_GCtrl & GCtrlSWChar)>>1 // Swchar bit + +MC6845_UPDATE_ROW( dgn_beta_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 *videoram = m_videoram; + UINT32 *p = &bitmap.pix32(y); + int i; + if(IsTextMode) + { + UINT8 *chr_gen = memregion("gfx1")->base(); + for ( i = 0; i < x_count; i++ ) + { + UINT32 offset = ( ( ma + i ) | ((m_GCtrl & GCtrlAddrLines)<<8)) << 1; + UINT8 chr = videoram[ offset ]; + UINT8 attr = videoram[ offset +1 ]; + + /* Extract non-colour attributes, in character set 1, undeline is used */ + /* We will extract the colours below, when we have decoded inverse */ + /* to indicate a double height character */ + int UnderLine=(attr & 0x40) >> 6; // Underline active + int FlashChar=(attr & 0x80) >> 7; // Flashing char + + // underline is active for character set 0, on character row 9 + int ULActive=(UnderLine && (ra==9) && ~SWChar); + + /* Invert forground and background if flashing char and flash acive */ + int Invert=(FlashChar & m_FlashBit); + + /* Underline inverts flash */ + if (ULActive) + Invert=~Invert; + + /* Cursor on also inverts */ + if (i == cursor_x) + Invert=~Invert; + + UINT16 fg = 0; + UINT16 bg = 0; + + /* Invert colours if invert is true */ + if(!Invert) + { + fg = (attr & 0x38) >> 3; + bg = (attr & 0x07); + } + else + { + bg = (attr & 0x38) >> 3; + fg = (attr & 0x07); + } + + + + UINT8 data = chr_gen[ chr * 16 + ra ]; + + *p = palette[( data & 0x80 ) ? fg : bg]; p++; + *p = palette[( data & 0x80 ) ? fg : bg]; p++; + *p = palette[( data & 0x40 ) ? fg : bg]; p++; + *p = palette[( data & 0x40 ) ? fg : bg]; p++; + *p = palette[( data & 0x20 ) ? fg : bg]; p++; + *p = palette[( data & 0x20 ) ? fg : bg]; p++; + *p = palette[( data & 0x10 ) ? fg : bg]; p++; + *p = palette[( data & 0x10 ) ? fg : bg]; p++; + *p = palette[( data & 0x08 ) ? fg : bg]; p++; + *p = palette[( data & 0x08 ) ? fg : bg]; p++; + *p = palette[( data & 0x04 ) ? fg : bg]; p++; + *p = palette[( data & 0x04 ) ? fg : bg]; p++; + *p = palette[( data & 0x02 ) ? fg : bg]; p++; + *p = palette[( data & 0x02 ) ? fg : bg]; p++; + *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p = palette[( data & 0x01 ) ? fg : bg]; p++; + } + + } + else + { + for ( i = 0; i < x_count; i++ ) + { + UINT32 offset = ((((ma + i ) & 0x1FFF) << 3) | (ra & 0x07)) << 1; + + UINT8 Lo = videoram[ offset ]; + UINT8 Hi = videoram[ offset +1 ]; + UINT16 Word = (Hi<<8) | Lo; + int Red; + int Green; + int Blue; + int Intense; + int Colour; + int Dot; + + /* If contol is low then we are plotting 4 bit per pixel, 16 colour mode */ + /* This directly drives the colour output lines, from the pixel value */ + /* If Control is high, then we lookup the colour from the LS670 4x4 bit */ + /* palate register */ + if (IsGfx16) + { + Intense =(Lo & 0x0F); + Red =(Lo & 0xF0)>>4; + Green =(Hi & 0x0F); + Blue =(Hi & 0xF0)>>4; + Colour=((Intense&0x08) | (Red&0x08)>>1) | ((Green&0x08)>>2) | ((Blue&0x08)>>3); + + for (Dot=0;Dot<4;Dot++) + { + *p = palette[Colour]; p++; + *p = palette[Colour]; p++; + *p = palette[Colour]; p++; + *p = palette[Colour]; p++; + + Intense =Intense<<1; + Red =Red<<1; + Green =Green<<1; + Blue =Blue<<1; + } + } + else if (IsGfx2) + { + for (Dot=0;Dot<16;Dot=Dot+1) + { + Colour=m_ColourRAM[((Word&0x8000)>>15)]; + + *p = palette[Colour]; p++; + + Hi=(Word&0x8000) >> 15; + Word=((Word<<1)&0xFFFE) | Hi; + } + } + else + { + for (Dot=0;Dot<8;Dot++) + { + Colour=m_ColourRAM[((Word&0x8000)>>14) | ((Word&0x80)>>7)]; + *p = palette[Colour]; p++; + *p = palette[Colour]; p++; + + Hi=(Word&0x8000) >> 15; + Word=((Word<<1)&0xFFFE) | Hi; + } + } + } + } + +} + +WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_vsync_changed) +{ + m_beta_VSync=state; + if (!m_beta_VSync) + { + m_FlashCount++; + if(m_FlashCount==10) + { + m_FlashCount=0; // Reset counter + m_FlashBit=(!m_FlashBit) & 0x01; // Invert flash bit. + } + } + + dgn_beta_frame_interrupt(state); +} + + +/* Set video control register from I28 port B, the control register is laid out as */ +/* follows :- */ +/* bit function */ +/* 0 WI, unknown */ +/* 1 Character set select, drives A12 of character rom in text mode */ +/* 2 High (1) or Low(0) resolution if in graphics mode. */ +/* 3 Text (1) or Graphics(0) mode */ +/* 4 Control bit, Selects between colour palate and drirect drive */ +/* 5 F/S bit, 1=80 bytes/line, 0=40bytes/line */ +/* 6 Effective A14, to ram, in text mode */ +/* 7 Effective A15, to ram, in text mode */ +/* the top two address lines for the video ram, are supplied by the BB6 and PB7 on */ +/* 6821-I28, this allows the 6845 to access the full 64K address range, however */ +/* since the ram data is addressed as a 16bit wide unit, this allows the 6845 */ +/* access to the first 128K or ram. */ +void dgn_beta_state::dgnbeta_vid_set_gctrl(int data) +{ + m_GCtrl=data; +} + + +/* Write handler for colour, pallate ram */ +WRITE8_MEMBER(dgn_beta_state::dgnbeta_colour_ram_w) +{ + m_ColourRAM[offset]=data&0x0f; /* Colour ram 4 bit and write only to CPU */ +} diff --git a/src/mame/video/electron.c b/src/mame/video/electron.c new file mode 100644 index 00000000000..e77904ef8e6 --- /dev/null +++ b/src/mame/video/electron.c @@ -0,0 +1,273 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/****************************************************************************** + Acorn Electron driver + + MESS Driver By: + + Wilbert Pol + +******************************************************************************/ + +#include "emu.h" +#include "includes/electron.h" + +/* + From the ElectrEm site: + +Timing is somewhat of a thorny issue on the Electron. It is almost certain the Electron could have been a much faster machine if BBC Micro OS level compatibility had not been not a design requirement. + +When accessing the ROM regions, the CPU always runs at 2MHz. When accessing the FC (1 MHz bus) or FD (JIM) pages, the CPU always runs at 1MHz. + +The timing for RAM accesses varies depending on the graphics mode, and how many bytes are required to be read by the video circuits per scanline. When accessing RAM in modes 4-6, the CPU is simply moved to a 1MHz clock. This occurs for any RAM access at any point during the frame. + +In modes 0-3, if the CPU tries to access RAM at any time during which the video circuits are fetching bytes, it is halted by means of receiving a stopped clock until the video circuits next stop fetching bytes. + +Each scanline is drawn in exactly 64us, and of that the video circuits fetch bytes for 40us. In modes 0, 1 and 2, 256 scanlines have pixels on, whereas in mode 3 only 250 scanlines are affected as mode 3 is a 'spaced' mode. + +As opposed to one clock generator which changes pace, the 1MHz and 2MHz clocks are always available, so the ULA acts to simply change which clock is piped to the CPU. This means in half of all cases, a further 2MHz cycle is lost waiting for the 2MHz and 1MHz clocks to synchronise during a 2MHz to 1MHz step. + +The video circuits run from a constant 2MHz clock, and generate 312 scanlines a frame, one scanline every 128 cycles. This actually gives means the Electron is running at 50.08 frames a second. + +Creating a scanline numbering scheme where the first scanline with pixels is scanline 0, in all modes the end of display interrupt is generated at the end of scanline 255, and the RTC interrupt is generated upon the end of scanline 99. + +From investigating some code for vertical split modes printed in Electron User volume 7, issue 7 it seems that the exact timing of the end of display interrupt is somewhere between 24 and 40 cycles after the end of pixels. This may coincide with HSYNC. I have no similarly accurate timing for the real time clock interrupt at this time. + +Mode changes are 'immediate', so any change in RAM access timing occurs exactly after the write cycle of the changing instruction. Similarly palette changes take effect immediately. VSYNC is not signalled in any way. + +*/ + + + + +void electron_state::video_start() +{ + int i; + for( i = 0; i < 256; i++ ) { + m_map4[i] = ( ( i & 0x10 ) >> 3 ) | ( i & 0x01 ); + m_map16[i] = ( ( i & 0x40 ) >> 3 ) | ( ( i & 0x10 ) >> 2 ) | ( ( i & 0x04 ) >> 1 ) | ( i & 0x01 ); + } + m_scanline_timer = timer_alloc(TIMER_SCANLINE_INTERRUPT); + m_scanline_timer->adjust( machine().first_screen()->time_until_pos(0), 0, machine().first_screen()->scan_period() ); +} + +inline UINT8 electron_state::read_vram( UINT16 addr ) +{ + return m_ula.vram[ addr % m_ula.screen_size ]; +} + +inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix16(y, x) = (UINT16)color; +} + +UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int i; + int x = 0; + int pal[16]; + int scanline = screen.vpos(); + rectangle r = cliprect; + r.min_y = r.max_y = scanline; + + /* set up palette */ + switch( m_ula.screen_mode ) + { + case 0: case 3: case 4: case 6: case 7: /* 2 colour mode */ + pal[0] = m_ula.current_pal[0]; + pal[1] = m_ula.current_pal[8]; + break; + case 1: case 5: /* 4 colour mode */ + pal[0] = m_ula.current_pal[0]; + pal[1] = m_ula.current_pal[2]; + pal[2] = m_ula.current_pal[8]; + pal[3] = m_ula.current_pal[10]; + break; + case 2: /* 16 colour mode */ + for( i = 0; i < 16; i++ ) + pal[i] = m_ula.current_pal[i]; + } + + /* draw line */ + switch( m_ula.screen_mode ) + { + case 0: + for( i = 0; i < 80; i++ ) + { + UINT8 pattern = read_vram( m_ula.screen_addr + (i << 3) ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)& 1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)& 1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)& 1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)& 1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)& 1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)& 1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)& 1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)& 1] ); + } + m_ula.screen_addr++; + if ( ( scanline & 0x07 ) == 7 ) + m_ula.screen_addr += 0x278; + break; + + case 1: + for( i = 0; i < 80; i++ ) + { + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); + } + m_ula.screen_addr++; + if ( ( scanline & 0x07 ) == 7 ) + m_ula.screen_addr += 0x278; + break; + + case 2: + for( i = 0; i < 80; i++ ) + { + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>0]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>0]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>0]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>0]] ); + } + m_ula.screen_addr++; + if ( ( scanline & 0x07 ) == 7 ) + m_ula.screen_addr += 0x278; + break; + + case 3: + if ( ( scanline > 249 ) || ( scanline % 10 >= 8 ) ) + bitmap.fill(7, r ); + else + { + for( i = 0; i < 80; i++ ) + { + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); + } + m_ula.screen_addr++; + } + if ( scanline % 10 == 9 ) + m_ula.screen_addr += 0x278; + break; + + case 4: + case 7: + for( i = 0; i < 40; i++ ) + { + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); + } + m_ula.screen_addr++; + if ( ( scanline & 0x07 ) == 7 ) + m_ula.screen_addr += 0x138; + break; + + case 5: + for( i = 0; i < 40; i++ ) + { + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); + electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); + } + m_ula.screen_addr++; + if ( ( scanline & 0x07 ) == 7 ) + m_ula.screen_addr += 0x138; + break; + + case 6: + if ( ( scanline > 249 ) || ( scanline % 10 >= 8 ) ) + bitmap.fill(7, r ); + else + { + for( i = 0; i < 40; i++ ) + { + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); + electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); + } + m_ula.screen_addr++; + if ( ( scanline % 10 ) == 7 ) + m_ula.screen_addr += 0x138; + } + break; + } + + return 0; +} + +TIMER_CALLBACK_MEMBER(electron_state::electron_scanline_interrupt) +{ + switch (machine().first_screen()->vpos()) + { + case 43: + electron_interrupt_handler( INT_SET, INT_RTC ); + break; + case 199: + electron_interrupt_handler( INT_SET, INT_DISPLAY_END ); + break; + case 0: + m_ula.screen_addr = m_ula.screen_start - m_ula.screen_base; + break; + } +} diff --git a/src/mame/video/fm7.c b/src/mame/video/fm7.c new file mode 100644 index 00000000000..298e98c9262 --- /dev/null +++ b/src/mame/video/fm7.c @@ -0,0 +1,1493 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + * + * Fujitsu Micro 7 Video functions + * + */ + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "includes/fm7.h" + + +/* + * Main CPU: Sub-CPU interface (port 0xfd05) + * + * Read: + * bit 7: Sub-CPU busy (or halted) + * bit 0: EXTDET (?) + * Write: + * bit 7: Sub-CPU halt + * bit 6: Sub-CPU cancel IRQ + */ + +READ8_MEMBER(fm7_state::fm7_subintf_r) +{ + UINT8 ret = 0x00; + + if(m_video.sub_busy != 0 || m_video.sub_halt != 0) + ret |= 0x80; + + ret |= 0x7e; + //ret |= 0x01; // EXTDET (not implemented yet) + + return ret; +} + +WRITE8_MEMBER(fm7_state::fm7_subintf_w) +{ + m_video.sub_halt = data & 0x80; + if(data & 0x80) + m_video.sub_busy = data & 0x80; + + m_sub->set_input_line(INPUT_LINE_HALT,(data & 0x80) ? ASSERT_LINE : CLEAR_LINE); + if(data & 0x40) + m_sub->set_input_line(M6809_IRQ_LINE,ASSERT_LINE); + //popmessage("Sub CPU Interface write: %02x\n",data); +} + +READ8_MEMBER(fm7_state::fm7_sub_busyflag_r) +{ + if(m_video.sub_halt == 0) + m_video.sub_busy = 0x00; + return 0x00; +} + +WRITE8_MEMBER(fm7_state::fm7_sub_busyflag_w) +{ + m_video.sub_busy = 0x80; +} + +/* + * Sub-CPU port 0xd402 + * Read-only: Acknowledge Cancel IRQ + */ +READ8_MEMBER(fm7_state::fm7_cancel_ack) +{ + m_sub->set_input_line(M6809_IRQ_LINE,CLEAR_LINE); + return 0x00; +} + +/* + * Reading from 0xd404 (sub-CPU) causes an "Attention" FIRQ on the main CPU + */ +READ8_MEMBER(fm7_state::fm7_attn_irq_r) +{ + m_video.attn_irq = 1; + m_maincpu->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); + return 0xff; +} + +/* + * Sub CPU: I/O port 0xd409 + * + * On read, enables VRAM access + * On write, disables VRAM access + */ +READ8_MEMBER(fm7_state::fm7_vram_access_r) +{ + m_video.vram_access = 1; + return 0xff; +} + +WRITE8_MEMBER(fm7_state::fm7_vram_access_w) +{ + m_video.vram_access = 0; +} + +TIMER_CALLBACK_MEMBER(fm7_state::fm77av_alu_task_end) +{ + m_alu.busy = 0; +} + +void fm7_state::fm7_alu_mask_write(UINT32 offset, int bank, UINT8 dat) +{ + UINT8 temp; + int page = 0; + + if(offset >= 0xc000) + page = 1; + + if((m_alu.command & 0x40) == 0) + { // "always" write mode + m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = dat; + return; + } + + temp = m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)]; + if(m_alu.command & 0x20) + { // "not equal" write mode + temp &= m_alu.compare_data; + dat &= ~m_alu.compare_data; + } + else + { // "equal" write mode + temp &= ~m_alu.compare_data; + dat &= m_alu.compare_data; + } + + m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = temp | dat; +} + +void fm7_state::fm7_alu_function_compare(UINT32 offset) +{ + // COMPARE - compares which colors match those in the compare registers + // can be used on its own, or when bit 6 of the command register is high. + + UINT8 red,green,blue; + UINT8 dat = 0; + UINT8 colour; + UINT8 banks; + int x,y; + int match; + int page = 0; + UINT8 bit = 0x80; + + if(offset >= 0xc000) + { + page = 1; + offset += m_video.vram_offset2; + } + else + offset += m_video.vram_offset; + + blue = m_video_ram[(offset & 0x3fff) + (page * 0xc000)]; + red = m_video_ram[(offset & 0x3fff) + 0x4000 + (page * 0xc000)]; + green = m_video_ram[(offset & 0x3fff) + 0x8000 + (page * 0xc000)]; + + banks = (~m_alu.bank_disable) & 0x07; + + for(x=0;x<8;x++) // loop through each pixel + { + colour = 0; + if(blue & bit) + colour |= 1; + if(red & bit) + colour |= 2; + if(green & bit) + colour |= 4; + + match = 0; + for(y=0;y<8;y++) // loop through each compare register + { + if(!(m_alu.compare[y] & 0x80)) // don't compare if register is masked + { + if((m_alu.compare[y] & banks) == (colour & banks)) + match = 1; + } + } + if(match != 0) + dat |= bit; + + bit >>= 1; + } + m_alu.compare_data = dat; +} + +void fm7_state::fm7_alu_function_pset(UINT32 offset) +{ + // PSET - simply sets the pixels to the selected logical colour + int x; + UINT8 dat; + int page = 0; + UINT8 mask; + + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); + + if(offset >= 0xc000) + { + page = 1; + offset += m_video.vram_offset2; + } + else + offset += m_video.vram_offset; + + for(x=0;x<3;x++) // cycle through banks + { + if(!(m_alu.bank_disable & (1 << x))) + { + if(m_alu.lcolour & (1 << x)) + dat = 0xff; + else + dat = 0; + + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & m_alu.mask; + dat &= ~m_alu.mask; + dat |= mask; + + fm7_alu_mask_write(offset,x,dat); + } + } +} + +void fm7_state::fm7_alu_function_or(UINT32 offset) +{ + int x; + UINT8 dat; + int page = 0; + UINT8 mask; + + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); + + if(offset >= 0xc000) + { + page = 1; + offset += m_video.vram_offset2; + } + else + offset += m_video.vram_offset; + + for(x=0;x<3;x++) // cycle through banks + { + if(!(m_alu.bank_disable & (1 << x))) + { + if(m_alu.lcolour & (1 << x)) + dat = 0xff; + else + dat = 0; + + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + dat |= mask; + + mask &= m_alu.mask; + dat &= ~m_alu.mask; + dat |= mask; + + fm7_alu_mask_write(offset,x,dat); + } + } +} + +void fm7_state::fm7_alu_function_and(UINT32 offset) +{ + int x; + UINT8 dat; + int page = 0; + UINT8 mask; + + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); + + if(offset >= 0xc000) + { + page = 1; + offset += m_video.vram_offset2; + } + else + offset += m_video.vram_offset; + + for(x=0;x<3;x++) // cycle through banks + { + if(!(m_alu.bank_disable & (1 << x))) + { + if(m_alu.lcolour & (1 << x)) + dat = 0xff; + else + dat = 0; + + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + dat &= mask; + + mask &= m_alu.mask; + dat &= ~m_alu.mask; + dat |= mask; + + fm7_alu_mask_write(offset,x,dat); + } + } +} + +void fm7_state::fm7_alu_function_xor(UINT32 offset) +{ + int x; + UINT8 dat; + int page = 0; + UINT8 mask; + + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); + + if(offset >= 0xc000) + { + page = 1; + offset += m_video.vram_offset2; + } + else + offset += m_video.vram_offset; + + for(x=0;x<3;x++) // cycle through banks + { + if(!(m_alu.bank_disable & (1 << x))) + { + if(m_alu.lcolour & (1 << x)) + dat = 0xff; + else + dat = 0; + + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + dat ^= mask; + + mask &= m_alu.mask; + dat &= ~m_alu.mask; + dat |= mask; + + fm7_alu_mask_write(offset,x,dat); + } + } +} + +void fm7_state::fm7_alu_function_not(UINT32 offset) +{ + int x; + UINT8 dat; + int page = 0; + UINT8 mask; + + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); + + if(offset >= 0xc000) + { + page = 1; + offset += m_video.vram_offset2; + } + else + offset += m_video.vram_offset; + + for(x=0;x<3;x++) // cycle through banks + { + if(!(m_alu.bank_disable & (1 << x))) + { + if(m_alu.lcolour & (1 << x)) + dat = 0xff; + else + dat = 0; + + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + dat = ~mask; + + mask &= m_alu.mask; + dat &= ~m_alu.mask; + dat |= mask; + + fm7_alu_mask_write(offset,x,dat); + } + } +} + +void fm7_state::fm7_alu_function_invalid(UINT32 offset) +{ + // Invalid function, still does something though (used by Laydock) + int x; + UINT8 dat; + int page = 0; + UINT8 mask; + + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); + + if(offset >= 0xc000) + { + page = 1; + offset += m_video.vram_offset2; + } + else + offset += m_video.vram_offset; + + for(x=0;x<3;x++) // cycle through banks + { + if(!(m_alu.bank_disable & (1 << x))) + { + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + + dat = mask & m_alu.mask; + + fm7_alu_mask_write(offset,x,dat); + } + } +} + +void fm7_state::fm7_alu_function_tilepaint(UINT32 offset) +{ + // TILEPAINT - writes to VRAM based on the tilepaint colour registers + int x; + UINT8 dat = 0; + int page = 0; + UINT8 mask; + + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); + + if(offset >= 0xc000) + { + page = 1; + offset += m_video.vram_offset2; + } + else + offset += m_video.vram_offset; + + for(x=0;x<3;x++) // cycle through banks + { + if(!(m_alu.bank_disable & (1 << x))) + { + switch(x) + { + case 0: + dat = m_alu.tilepaint_b; + break; + case 1: + dat = m_alu.tilepaint_r; + break; + case 2: + dat = m_alu.tilepaint_g; + break; + } + dat &= ~m_alu.mask; + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & m_alu.mask; + dat |= mask; + + fm7_alu_mask_write(offset,x,dat); + } + } +} + +void fm7_state::fm7_alu_function(UINT32 offset) +{ + switch(m_alu.command & 0x07) + { + case 0x00: // PSET + fm7_alu_function_pset(offset); + break; + case 0x02: // OR + fm7_alu_function_or(offset); + break; + case 0x03: // AND + fm7_alu_function_and(offset); + break; + case 0x04: // XOR + fm7_alu_function_xor(offset); + break; + case 0x05: // NOT + fm7_alu_function_not(offset); + break; + case 0x06: // TILEPAINT + fm7_alu_function_tilepaint(offset); + break; + case 0x07: // COMPARE + fm7_alu_function_compare(offset); + break; + case 0x01: + default: + fm7_alu_function_invalid(offset); + } +} + +UINT32 fm7_state::fm7_line_set_pixel(int x, int y) +{ + UINT32 addr; + static const UINT8 pixel_mask[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe }; + + + if(m_video.modestatus & 0x40) // 320 pixels wide + { + addr = (x >> 3) + (y * 40); + } + else // 640 pixels wide + { + addr = (x >> 3) + (y * 80); + } + addr += (m_alu.addr_offset << 1); + addr &= 0x3fff; + if(m_video.active_video_page != 0) + addr += 0xc000; + + if(m_alu.command & 0x80) // ALU must be active + { + m_alu.mask = pixel_mask[x & 0x07]; + fm7_alu_function(addr); + } + + return addr; +} + +void fm7_state::fm77av_line_draw() +{ + int x1 = m_alu.x0; + int x2 = m_alu.x1; + int y1 = m_alu.y0; + int y2 = m_alu.y1; + + int dx = abs(x2 - x1); + int dy = abs(y2 - y1); + int stepx, stepy; + int err,err2; + int byte_count = 0; + + if(x1 < x2) + stepx = 1; + else + stepx = -1; + if(y1 < y2) + stepy = 1; + else + stepy = -1; + + err = dx - dy; + + for(;;) + { + fm7_line_set_pixel(x1, y1); + byte_count++; + + if(x1 == x2 && y1 == y2) + break; + + err2 = 2*err; + if(err2 > -dy) + { + err -= dy; + x1 += stepx; + } + if(err2 < dx) + { + err += dx; + y1 += stepy; + } + } + + // set timer to disable busy flag + // 1/16 us for each byte changed + timer_set(attotime::from_usec(byte_count/16), TIMER_FM77AV_ALU_TASK_END); +} + +READ8_MEMBER(fm7_state::fm7_vram_r) +{ + int offs; + UINT16 page = 0x0000; + + if(m_video.active_video_page != 0) + page = 0xc000; + + if(offset < 0x4000 && (m_video.multi_page & 0x01)) + return 0xff; + if((offset < 0x8000 && offset >=0x4000) && (m_video.multi_page & 0x02)) + return 0xff; + if((offset < 0xc000 && offset >=0x8000) && (m_video.multi_page & 0x04)) + return 0xff; + + if(m_alu.command & 0x80) // ALU active, writes to VRAM even when reading it (go figure) + { + fm7_alu_function(offset+page); + } + + if(m_video.modestatus & 0x40) + { + if(m_video.active_video_page != 0) + offs = (offset & 0xe000) | ((offset + m_video.vram_offset2) & 0x1fff); + else + offs = (offset & 0xe000) | ((offset + m_video.vram_offset) & 0x1fff); + } + else + { + if(m_video.active_video_page != 0) + offs = (offset & 0xc000) | ((offset + m_video.vram_offset2) & 0x3fff); + else + offs = (offset & 0xc000) | ((offset + m_video.vram_offset) & 0x3fff); + } + return m_video_ram[offs + page]; +} + +WRITE8_MEMBER(fm7_state::fm7_vram_w) +{ + int offs; + UINT16 page = 0x0000; + + if(m_video.active_video_page != 0) + page = 0xc000; + + if(offset < 0x4000 && (m_video.multi_page & 0x01)) + return; + if((offset < 0x8000 && offset >=0x4000) && (m_video.multi_page & 0x02)) + return; + if((offset < 0xc000 && offset >=0x8000) && (m_video.multi_page & 0x04)) + return; + + if(m_alu.command & 0x80) // ALU active + { + fm7_alu_function(offset+page); + return; + } + + if(m_video.modestatus & 0x40) + { + if(m_video.active_video_page != 0) + offs = (offset & 0xe000) | ((offset + m_video.vram_offset2) & 0x1fff); + else + offs = (offset & 0xe000) | ((offset + m_video.vram_offset) & 0x1fff); + } + else + { + if(m_video.active_video_page != 0) + offs = (offset & 0xc000) | ((offset + m_video.vram_offset2) & 0x3fff); + else + offs = (offset & 0xc000) | ((offset + m_video.vram_offset) & 0x3fff); + } +// if(m_video.vram_access != 0) + m_video_ram[offs+page] = data; +} + +// not pretty, but it should work. +WRITE8_MEMBER(fm7_state::fm7_vram_banked_w) +{ + int offs; + UINT16 page = 0x0000; + + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return; + + if(m_video.active_video_page != 0) + page = 0xc000; + + if(offset < 0x4000 && (m_video.multi_page & 0x01)) + return; + if((offset < 0x8000 && offset >=0x4000) && (m_video.multi_page & 0x02)) + return; + if((offset < 0xc000 && offset >=0x8000) && (m_video.multi_page & 0x04)) + return; + + if(m_alu.command & 0x80) // ALU active + { + fm7_alu_function(offset+page); + return; + } + + if(m_video.modestatus & 0x40) + { + if(m_video.active_video_page != 0) + offs = (offset & 0xe000) | ((offset + m_video.vram_offset2) & 0x1fff); + else + offs = (offset & 0xe000) | ((offset + m_video.vram_offset) & 0x1fff); + } + else + { + if(m_video.active_video_page != 0) + offs = (offset & 0xc000) | ((offset + m_video.vram_offset2) & 0x3fff); + else + offs = (offset & 0xc000) | ((offset + m_video.vram_offset) & 0x3fff); + } + m_video_ram[offs+page] = data; +} + +READ8_MEMBER(fm7_state::fm7_vram0_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset); +} + +READ8_MEMBER(fm7_state::fm7_vram1_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x1000); +} + +READ8_MEMBER(fm7_state::fm7_vram2_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x2000); +} + +READ8_MEMBER(fm7_state::fm7_vram3_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x3000); +} + +READ8_MEMBER(fm7_state::fm7_vram4_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x4000); +} + +READ8_MEMBER(fm7_state::fm7_vram5_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x5000); +} + +READ8_MEMBER(fm7_state::fm7_vram6_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x6000); +} + +READ8_MEMBER(fm7_state::fm7_vram7_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x7000); +} + +READ8_MEMBER(fm7_state::fm7_vram8_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x8000); +} + +READ8_MEMBER(fm7_state::fm7_vram9_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0x9000); +} + +READ8_MEMBER(fm7_state::fm7_vramA_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0xa000); +} + +READ8_MEMBER(fm7_state::fm7_vramB_r) +{ + if(!m_video.sub_halt) // no access if sub CPU is not halted. + return 0xff; + return fm7_vram_r(space,offset+0xb000); +} + +WRITE8_MEMBER(fm7_state::fm7_vram0_w) +{ + fm7_vram_banked_w(space,offset,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram1_w) +{ + fm7_vram_banked_w(space,offset+0x1000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram2_w) +{ + fm7_vram_banked_w(space,offset+0x2000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram3_w) +{ + fm7_vram_banked_w(space,offset+0x3000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram4_w) +{ + fm7_vram_banked_w(space,offset+0x4000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram5_w) +{ + fm7_vram_banked_w(space,offset+0x5000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram6_w) +{ + fm7_vram_banked_w(space,offset+0x6000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram7_w) +{ + fm7_vram_banked_w(space,offset+0x7000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram8_w) +{ + fm7_vram_banked_w(space,offset+0x8000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vram9_w) +{ + fm7_vram_banked_w(space,offset+0x9000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vramA_w) +{ + fm7_vram_banked_w(space,offset+0xa000,data); +} + +WRITE8_MEMBER(fm7_state::fm7_vramB_w) +{ + fm7_vram_banked_w(space,offset+0xb000,data); +} + +/* + * Sub CPU: I/O port 0xd408 + * + * On read, enables the CRT display + * On write, disables the CRT display + */ +READ8_MEMBER(fm7_state::fm7_crt_r) +{ + m_video.crt_enable = 1; + return 0xff; +} + +WRITE8_MEMBER(fm7_state::fm7_crt_w) +{ + m_video.crt_enable = 0; +} + +/* + * Sub CPU: I/O ports 0xd40e - 0xd40f + * + * 0xd40e: bits 0-6 - offset in bytes (high byte) (bit 6 is used for 400 line video only) + * 0xd40f: bits 0-7 - offset in bytes (low byte) + */ +WRITE8_MEMBER(fm7_state::fm7_vram_offset_w) +{ + UINT16 new_offset = 0; + + switch(offset) + { + case 0: + if(m_video.active_video_page != 0) + new_offset = ((data & 0x3f) << 8) | (m_video.vram_offset2 & 0x00ff); + else + new_offset = ((data & 0x3f) << 8) | (m_video.vram_offset & 0x00ff); + break; + case 1: // low 5 bits are used on FM-77AV and later only + if(m_type == SYS_FM7) + new_offset = (m_video.vram_offset & 0xff00) | (data & 0xe0); + else + { + if(m_video.active_video_page != 0) + { + if(m_video.fine_offset != 0) + new_offset = (m_video.vram_offset2 & 0xff00) | (data & 0xff); + else + new_offset = (m_video.vram_offset2 & 0xff00) | (data & 0xe0); + } + else + { + if(m_video.fine_offset != 0) + new_offset = (m_video.vram_offset & 0xff00) | (data & 0xff); + else + new_offset = (m_video.vram_offset & 0xff00) | (data & 0xe0); + } + } + break; + } + if(m_video.active_video_page != 0) + m_video.vram_offset2 = new_offset; + else + m_video.vram_offset = new_offset; +} + +/* + * Main CPU: port 0xfd37 + * Multipage + * Port is write-only + * + * bits 6-4: VRAM planes to display (G,R,B) (1=disable) + * bits 2-0: VRAM CPU access (G,R,B) (1=disable) + */ +WRITE8_MEMBER(fm7_state::fm7_multipage_w) +{ + m_video.multi_page = data & 0x77; +} + +/* + * Main CPU: I/O ports 0xfd38-0xfd3f + * Colour palette. + * Each port represents one of eight colours. Palette is 3-bit. + * bit 2 = Green + * bit 1 = Red + * bit 0 = Blue + */ +READ8_MEMBER(fm7_state::fm7_palette_r) +{ + return m_video.fm7_pal[offset]; +} + +WRITE8_MEMBER(fm7_state::fm7_palette_w) +{ + m_palette->set_pen_color(offset, rgb_t(pal1bit(data >> 1), pal1bit(data >> 2), pal1bit(data >> 0))); + m_video.fm7_pal[offset] = data & 0x07; +} + +/* + * Main CPU: 0xfd30 - 0xfd34 + * Analog colour palette (FM-77AV and later only) + * All ports are write-only. + * + * fd30: colour select(?) high 4 bits (LC11-LC8) + * fd31: colour select(?) low 8 bits (LC7-LC0) + * fd32: blue level (4 bits) + * fd33: red level (4 bits) + * fd34: green level (4 bits) + */ +WRITE8_MEMBER(fm7_state::fm77av_analog_palette_w) +{ + int val; + + switch(offset) + { + case 0: + val = ((data & 0x0f) << 8) | (m_video.fm77av_pal_selected & 0x00ff); + m_video.fm77av_pal_selected = val; + break; + case 1: + val = data | (m_video.fm77av_pal_selected & 0x0f00); + m_video.fm77av_pal_selected = val; + break; + case 2: + m_av_palette->set_pen_blue_level(m_video.fm77av_pal_selected, data << 4); + break; + case 3: + m_av_palette->set_pen_red_level(m_video.fm77av_pal_selected, data << 4); + break; + case 4: + m_av_palette->set_pen_green_level(m_video.fm77av_pal_selected, data << 4); + break; + } +} + + +/* + * Sub CPU: 0xd430 - BUSY/NMI/Bank register (FM77AV series only) + * + * On read: bit 7 - 0 if in VBlank + * bit 4 - ALU busy(0)/ready(1) + * bit 2 - VSync status (1 if active?) + * bit 0 - RESET + * + * On write: bits 1-0 - CGROM select (maps to 0xd800) + * bit 2 - fine offset enable (enables OA4-OA0 bits in VRAM offset) + * bit 5 - active VRAM page + * bit 6 - display VRAM page + * bit 7 - NMI mask register (1=mask) + */ +READ8_MEMBER(fm7_state::fm77av_video_flags_r) +{ + UINT8 ret = 0xff; + + if(machine().first_screen()->vblank()) + ret &= ~0x80; + + if(m_alu.busy != 0) + ret &= ~0x10; + + if(m_video.vsync_flag == 0) + ret &= ~0x04; + + if(!m_video.sub_reset) + ret &= ~0x01; + + return ret; +} + +WRITE8_MEMBER(fm7_state::fm77av_video_flags_w) +{ + UINT8* RAM = memregion("subsyscg")->base(); + + m_video.cgrom = data & 0x03; + membank("bank20")->set_base(RAM+(m_video.cgrom*0x800)); + m_video.fine_offset = data & 0x04; + m_video.active_video_page = data & 0x20; + m_video.display_video_page = data & 0x40; + m_video.nmi_mask = data & 0x80; +} + +/* + * Main CPU: port 0xfd12 + * Sub mode status register (FM-77AV or later) + * bit 6 (R/W) - Video mode width(?) 0=640 (default) 1=320. + * bit 1 (R/O) - DISPTMG status (0=blank) + * bit 0 (R/O) - VSync status (1=sync?) + */ +READ8_MEMBER(fm7_state::fm77av_sub_modestatus_r) +{ + UINT8 ret = 0x00; + + ret |= 0xbc; + ret |= (m_video.modestatus & 0x40); + + if(!machine().first_screen()->vblank()) + ret |= 0x02; + + if(m_video.vsync_flag != 0) + ret |= 0x01; + + return ret; +} + +WRITE8_MEMBER(fm7_state::fm77av_sub_modestatus_w) +{ + m_video.modestatus = data & 0x40; + if(data & 0x40) + { + rectangle rect(0, 320-1, 0, 200-1); + machine().first_screen()->configure(320,200,rect,HZ_TO_ATTOSECONDS(60)); + } + else + { + rectangle rect(0, 640-1, 0, 200-1); + machine().first_screen()->configure(640,200,rect,HZ_TO_ATTOSECONDS(60)); + } +} + +/* + * Main CPU: port 0xfd13 + * Sub Bank select register + * + * bits 1 and 0 select which subsys ROM to be banked into sub CPU space + * on the FM-77AV40 and later, bit 2 can also selected to bank in sub monitor RAM. + */ +WRITE8_MEMBER(fm7_state::fm77av_sub_bank_w) +{ +// UINT8* RAM = memregion("sub")->base(); + UINT8* ROM; + + if((data & 0x03) == (m_sb_prev & 0x03)) + return; + + m_video.subrom = data & 0x03; + switch (data & 0x03) + { + case 0x00: // Type C, 640x200 (as used on the FM-7) + ROM = memregion("subsys_c")->base(); + // membank(20)->set_base(ROM); + membank("bank21")->set_base(ROM+0x800); + logerror("VID: Sub ROM Type C selected\n"); + break; + case 0x01: // Type A, 640x200 + ROM = memregion("subsys_a")->base(); + // membank(20)->set_base(RAM+0xd800); + membank("bank21")->set_base(ROM); + logerror("VID: Sub ROM Type A selected\n"); + break; + case 0x02: // Type B, 320x200 + ROM = memregion("subsys_b")->base(); + // membank(20)->set_base(RAM+0xd800); + membank("bank21")->set_base(ROM); + logerror("VID: Sub ROM Type B selected\n"); + break; + case 0x03: // CG Font? + ROM = memregion("subsyscg")->base(); + // membank(20)->set_base(RAM+0xd800); + membank("bank21")->set_base(ROM); + logerror("VID: Sub ROM CG selected\n"); + break; + } + // reset sub CPU, set busy flag, set reset flag + m_sub->set_input_line(INPUT_LINE_RESET,PULSE_LINE); + m_video.sub_busy = 0x80; + m_video.sub_halt = 0; + m_video.sub_reset = 1; + m_sb_prev = data; +} + +/* + * Sub CPU: ports 0xd410-0xd42b (FM-77AV and later only) + * Video operations + * + * 0xd410 (R/W): Command register + * bit 7: 0=DIS 1=Start + * bits 6-5: MBIT1, MBIT2 + * bits 2-0: Draw mode + * 0 0 0 - PSET + * 0 1 0 - OR + * 0 1 1 - AND + * 1 0 0 - XOR + * 1 0 1 - NOT + * 1 1 0 - TILEPAINT + * 1 1 1 - COMPARE + * 0xd411 (R/W): Logical colour (bits 2-0, G-R-B) + * 0xd412 (R/W): Mask register + * 0xd413 (R) : Compare data (?) + * 0xd413-1a(W): Compare registers (bits 2-0, G-R-B, 1=mask (bit 7)) + * 0xd41b (R/W): Bank disable register (bits 2-0, G-R-B, 1=disable, bit 3 must always be 1) + * 0xd41c-1e(W): Tilepaint registers (B-R-G) + * 0xd420-21(W): Line Address offset register (High-Low, A13-A1) + * 0xd422-23(W): Line style pattern register (High-Low, P15-P0) + * 0xd424-25(W): Line X0 (High-Low, X9-X0) + * 0xd426-27(W): Line Y0 (High-Low, Y8-Y0) + * 0xd428-29(W): Line X1 (High-Low, X9-X0) + * 0xd42a-2b(W): Line Y1 (High-Low, Y8-Y0) + */ +READ8_MEMBER(fm7_state::fm77av_alu_r) +{ + switch(offset) + { + case 0x00: + logerror("ALU: read from command register (%02x)\n",m_alu.command); + return m_alu.command; + case 0x01: + logerror("ALU: read from logical colour\n"); + return m_alu.lcolour; + case 0x02: + logerror("ALU: read from mask register\n"); + return m_alu.mask; + case 0x03: + logerror("ALU: read from compare data register (%02x)\n",m_alu.compare_data); + return m_alu.compare_data; + case 0x0b: + logerror("ALU: read from bank disable register\n"); + return 0xf7 | m_alu.bank_disable; + default: + logerror("ALU: read from invalid register 0x%02x\n",offset); + return 0xff; + } +} + +WRITE8_MEMBER(fm7_state::fm77av_alu_w) +{ + UINT16 dat; + + switch(offset) + { + case 0x00: + m_alu.command = data; + logerror("ALU: write to command register - %02x\n",data); + break; + case 0x01: + m_alu.lcolour = data & 0x07; + logerror("ALU: write to logical colour - %02x\n",data); + break; + case 0x02: + m_alu.mask = data; + logerror("ALU: write to mask register - %02x\n",data); + break; + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case 0x09: + case 0x0a: + m_alu.compare[offset-3] = data; + logerror("ALU: write to compare register %i - %02x\n",offset-3,data); + break; + case 0x0b: + m_alu.bank_disable = data & 0x03; +// logerror("ALU: write to bank disable register - %02x\n",data); + break; + case 0x0c: + m_alu.tilepaint_b = data; +// logerror("ALU: write to tilepaint (blue) register - %02x\n",data); + break; + case 0x0d: + m_alu.tilepaint_r = data; +// logerror("ALU: write to tilepaint (red) register - %02x\n",data); + break; + case 0x0e: + m_alu.tilepaint_g = data; +// logerror("ALU: write to tilepaint (green) register - %02x\n",data); + break; + case 0x10: + dat = ((data & 0x1f) << 8) | (m_alu.addr_offset & 0x00ff); + m_alu.addr_offset = dat; +// logerror("ALU: write to address offset (high) register - %02x (%04x)\n",data,m_alu.addr_offset); + break; + case 0x11: + dat = (m_alu.addr_offset & 0xff00) | data; + m_alu.addr_offset = dat; +// logerror("ALU: write to address offset (low) register - %02x (%04x)\n",data,m_alu.addr_offset); + break; + case 0x12: + dat = (data << 8) | (m_alu.line_style & 0x00ff); + m_alu.line_style = dat; +// logerror("ALU: write to line style (high) register - %02x (%04x)\n",data,m_alu.line_style); + break; + case 0x13: + dat = (m_alu.line_style & 0xff00) | data; + m_alu.line_style = dat; +// logerror("ALU: write to line style (low) register - %02x (%04x)\n",data,m_alu.line_style); + break; + case 0x14: + dat = ((data & 0x03) << 8) | (m_alu.x0 & 0x00ff); + m_alu.x0 = dat; +// logerror("ALU: write to X0 (high) register - %02x (%04x)\n",data,m_alu.x0); + break; + case 0x15: + dat = (m_alu.x0 & 0xff00) | data; + m_alu.x0 = dat; +// logerror("ALU: write to X0 (low) register - %02x (%04x)\n",data,m_alu.x0); + break; + case 0x16: + dat = ((data & 0x01) << 8) | (m_alu.y0 & 0x00ff); + m_alu.y0 = dat; +// logerror("ALU: write to Y0 (high) register - %02x (%04x)\n",data,m_alu.y0); + break; + case 0x17: + dat = (m_alu.y0 & 0xff00) | data; + m_alu.y0 = dat; +// logerror("ALU: write to Y0 (low) register - %02x (%04x)\n",data,m_alu.y0); + break; + case 0x18: + dat = ((data & 0x03) << 8) | (m_alu.x1 & 0x00ff); + m_alu.x1 = dat; +// logerror("ALU: write to X1 (high) register - %02x (%04x)\n",data,m_alu.x1); + break; + case 0x19: + dat = (m_alu.x1 & 0xff00) | data; + m_alu.x1 = dat; +// logerror("ALU: write to X1 (low) register - %02x (%04x)\n",data,m_alu.x1); + break; + case 0x1a: + dat = ((data & 0x01) << 8) | (m_alu.y1 & 0x00ff); + m_alu.y1 = dat; +// logerror("ALU: write to Y1 (high) register - %02x (%04x)\n",data,m_alu.y1); + break; + case 0x1b: + dat = (m_alu.y1 & 0xff00) | data; + m_alu.y1 = dat; + // draw line + fm77av_line_draw(); +// logerror("ALU: write to Y1 (low) register - %02x (%04x)\n",data,m_alu.y1); + break; + default: + logerror("ALU: write 0x%02x to invalid register 0x%02x\n",data,offset); + } +} + +TIMER_CALLBACK_MEMBER(fm7_state::fm77av_vsync) +{ + if(param == 0) // start of vsync + { + m_video.vsync_flag = 1; + m_fm77av_vsync_timer->adjust(attotime::from_usec(510),1); // VSync length for 200 line modes = 0.51ms + } + else + { + m_video.vsync_flag = 0; + m_fm77av_vsync_timer->adjust(machine().first_screen()->time_until_vblank_end()); + } +} + +// called when banked into main CPU space by the MMR, available only if sub CPU is halted +READ8_MEMBER(fm7_state::fm7_sub_ram_ports_banked_r) +{ + UINT8* RAM = memregion("maincpu")->base(); + UINT8* ROM; + + if(!m_video.sub_halt) + return 0xff; + + if(offset < 0x380) // work RAM + return RAM[0x1d000+offset]; + if(offset >= 0x380 && offset < 0x400) // shared RAM + return m_shared_ram[offset-0x380]; + if(offset >= 0x500 && offset < 0x800) // work RAM + return RAM[0x1d000+offset]; + if(offset > 0x800) // CGROM + { + ROM = memregion("subsyscg")->base(); + return ROM[(m_video.cgrom*0x800)+(offset-0x800)]; + } + + if(offset >= 0x410 && offset <= 0x42b) + return fm77av_alu_r(space,offset-0x410); + + switch(offset) + { + case 0x400: + case 0x401: + return fm7_sub_keyboard_r(space,offset-0x400); + case 0x402: + return fm7_cancel_ack(space,0); + case 0x403: + return fm7_sub_beeper_r(space,0); + case 0x404: + return fm7_attn_irq_r(space,0); + case 0x408: + return fm7_crt_r(space,0); + case 0x409: + return fm7_vram_access_r(space,0); + case 0x40a: + return fm7_sub_busyflag_r(space,0); + case 0x430: + return fm77av_video_flags_r(space,0); + case 0x431: + case 0x432: + return fm77av_key_encoder_r(space,offset-0x431); + default: + logerror("Unmapped read from sub CPU port 0xd%03x via MMR banking\n",offset); + return 0xff; + } +} + +WRITE8_MEMBER(fm7_state::fm7_sub_ram_ports_banked_w) +{ + UINT8* RAM = memregion("maincpu")->base(); + + if(!m_video.sub_halt) + return; + + if(offset < 0x380) // work RAM + { + RAM[0x1d000+offset] = data; + return; + } + if(offset >= 0x380 && offset < 0x400) // shared RAM + { + m_shared_ram[offset-0x380] = data; + return; + } + if(offset >= 0x500 && offset < 0x800) // work RAM + { + RAM[0x1d000+offset] = data; + return; + } + + if(offset >= 0x410 && offset <= 0x42b) + { + fm77av_alu_w(space,offset-0x410,data); + return; + } + + switch(offset) + { + case 0x408: + fm7_crt_w(space,0,data); + break; + case 0x409: + fm7_vram_access_w(space,0,data); + break; + case 0x40a: + fm7_sub_busyflag_w(space,0,data); + break; + case 0x40e: + case 0x40f: + fm7_vram_offset_w(space,offset-0x40e,data); + break; + case 0x430: + fm77av_video_flags_w(space,0,data); + break; + case 0x431: + case 0x432: + fm77av_key_encoder_w(space,offset-0x431,data); + break; + default: + logerror("Unmapped write of 0x%02x to sub CPU port 0xd%03x via MMR banking\n",data,offset); + } +} + +READ8_MEMBER(fm7_state::fm7_console_ram_banked_r) +{ + UINT8* RAM = memregion("maincpu")->base(); + + if(!m_video.sub_halt) + return 0xff; + + return RAM[0x1c000+offset]; +} + +WRITE8_MEMBER(fm7_state::fm7_console_ram_banked_w) +{ + UINT8* RAM = memregion("maincpu")->base(); + + if(!m_video.sub_halt) + return; + + RAM[0x1c000+offset] = data; +} + +void fm7_state::video_start() +{ + m_video.vram_access = 0; + m_video.crt_enable = 0; + m_video.vram_offset = 0x0000; + m_video.vram_offset2 = 0x0000; + m_video.sub_reset = 0; + m_video.multi_page = 0; + m_video.subrom = 0; + m_video.cgrom = 0; + m_video.fine_offset = 0; + m_video.nmi_mask = 0; + m_video.active_video_page = 0; + m_video.display_video_page = 0; + m_video.vsync_flag = 0; +} + +UINT32 fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT8 code_r = 0,code_g = 0,code_b = 0; + UINT8 code_r2 = 0,code_g2 = 0,code_b2 = 0; + UINT8 code_r3 = 0,code_g3 = 0,code_b3 = 0; + UINT8 code_r4 = 0,code_g4 = 0,code_b4 = 0; + UINT16 col; + int y, x, b; + UINT16 page = 0x0000; + + if(m_video.display_video_page != 0) + page = 0xc000; + + if(m_video.crt_enable == 0) + return 0; + + if(m_video.modestatus & 0x40) // 320x200 mode + { + for (y = 0; y < 200; y++) + { + for (x = 0; x < 40; x++) + { + if(!(m_video.multi_page & 0x40)) + { + code_r = m_video_ram[0x8000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; + code_r2 = m_video_ram[0xa000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; + code_r3 = m_video_ram[0x14000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; + code_r4 = m_video_ram[0x16000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; + } + if(!(m_video.multi_page & 0x20)) + { + code_g = m_video_ram[0x4000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; + code_g2 = m_video_ram[0x6000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; + code_g3 = m_video_ram[0x10000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; + code_g4 = m_video_ram[0x12000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; + } + if(!(m_video.multi_page & 0x10)) + { + code_b = m_video_ram[0x0000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; + code_b2 = m_video_ram[0x2000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; + code_b3 = m_video_ram[0xc000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; + code_b4 = m_video_ram[0xe000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; + } + for (b = 0; b < 8; b++) + { + col = (((code_b >> b) & 0x01) ? 8 : 0) | (((code_b2 >> b) & 0x01) ? 4 : 0) | (((code_b3 >> b) & 0x01) ? 2 : 0) | (((code_b4 >> b) & 0x01) ? 1 : 0); + col |= (((code_g >> b) & 0x01) ? 128 : 0) | (((code_g2 >> b) & 0x01) ? 64 : 0) | (((code_g3 >> b) & 0x01) ? 32 : 0) | (((code_g4 >> b) & 0x01) ? 16 : 0); + col |= (((code_r >> b) & 0x01) ? 2048 : 0) | (((code_r2 >> b) & 0x01) ? 1024 : 0) | (((code_r3 >> b) & 0x01) ? 512 : 0) | (((code_r4 >> b) & 0x01) ? 256 : 0); + bitmap.pix32(y, x*8+(7-b)) = m_av_palette->pen_color(col); + } + } + } + } + else + { + for (y = 0; y < 200; y++) + { + for (x = 0; x < 80; x++) + { + if(!(m_video.multi_page & 0x40)) + code_r = m_video_ram[page + 0x8000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; + if(!(m_video.multi_page & 0x20)) + code_g = m_video_ram[page + 0x4000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; + if(!(m_video.multi_page & 0x10)) + code_b = m_video_ram[page + 0x0000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; + for (b = 0; b < 8; b++) + { + col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); + bitmap.pix32(y, x*8+(7-b)) = m_palette->pen_color(col); + } + } + } + } + return 0; +} diff --git a/src/mame/video/fmtowns.c b/src/mame/video/fmtowns.c new file mode 100644 index 00000000000..1790f856bc4 --- /dev/null +++ b/src/mame/video/fmtowns.c @@ -0,0 +1,1729 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald + +/* + * FM Towns video hardware + * + * Resolution: from 320x200 to 768x512 + * + * Up to two graphics layers + * + * Sprites + * + * CRTC registers (16-bit): + * + * 0: HSync width 1 + * 1: HSync width 2 + * 4: HSync total + * 5: VSync width 1 + * 6: VSync width 2 + * 7: Equalising pulse accountable time (what?) + * 8: VSync total + * + * 9: + * 10: Graphic layer 0 horizontal start/end + * 11: + * 12: Graphic layer 1 horizontal start/end + * + * 13: + * 14: Graphic layer 0 vertical start/end + * 15: + * 16: Graphic layer 1 vertical start/end + * + * 17: Graphic layer 0 initial address? + * 18: Graphic layer 0 horizontal adjust + * 19: Graphic layer 0 field indirect address offset + * 20: Graphic layer 0 line indirect address offset + * + * 21-24: As above, but for Graphic layer 1 + * + * 27: Layer zoom. bit 0 = x2 horizontal zoom layer 0 + * to be confirmed bit 5 = x2 vertical zoom layer 0 + * bit 9 = x2 horizontal zoom layer 1 + * bit 13 = x2 vertical zoom layer 1 + * + * 28: Control register 0 + * VSync enable (bit 15) (blank display?) + * Scroll type (layer 0 = bit 4, layer 1 = bit 5) + * 0 = spherical scroll, 1 = cylindrical scroll + * + * 29: Control register 1 + * Dot clock (bits 1 and 0) + * 0x00 = 28.6363MHz + * 0x01 = 24.5454MHz + * 0x02 = 25.175MHz + * 0x03 = 21.0525MHz (default?) + * + * 30: Dummy register + * + * 31: Control register 2 + * + * Video registers: + * + * 0: Graphic layer(s) type: (others likely exist) + * bit 4 = 2 layers + * bits 2-3 = layer 1 mode + * bits 0-1 = layer 0 mode + * mode: 1 = 16 colours, 2 = 256 colours, 3 = highcolour (16-bit) + * 0 = disabled? + * + * 1: Layer reverse (priority?) (bit 0) + * YM (bit 2) - unknown + * peltype (bits 4 and 5) + * + * + * Sprite registers: + * + * 0,1: Maximum sprite (last one to render?) (10-bit) + * + * 1 (bit 7): Enable sprite display + * + * 2,3: X offset (9-bit) + * + * 4,5: Y offset (9-bit) + * + * 6 (bit 4): VRAM location (0=0x40000,1=0x60000) + * + */ + +#include "emu.h" +#include "machine/pic8259.h" +#include "machine/ram.h" +#include "includes/fmtowns.h" + +//#define CRTC_REG_DISP 1 +//#define SPR_DEBUG 1 + +//static UINT32 pshift; // for debugging + +void towns_state::towns_crtc_refresh_mode() +{ + unsigned int width,height; + + rectangle scr(0, m_video.towns_crtc_reg[4], 0, m_video.towns_crtc_reg[8] / 2); + + // layer 0 + width = m_video.towns_crtc_reg[10] - m_video.towns_crtc_reg[9]; + height = (m_video.towns_crtc_reg[14] - m_video.towns_crtc_reg[13]) / 2; + m_video.towns_crtc_layerscr[0].min_x = scr.xcenter() - (width / 2); + m_video.towns_crtc_layerscr[0].min_y = scr.ycenter() - (height / 2); + m_video.towns_crtc_layerscr[0].max_x = scr.xcenter() + (width / 2); + m_video.towns_crtc_layerscr[0].max_y = scr.ycenter() + (height / 2); + + // layer 1 + width = m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]; + height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / 2; + m_video.towns_crtc_layerscr[1].min_x = scr.xcenter() - (width / 2); + m_video.towns_crtc_layerscr[1].min_y = scr.ycenter() - (height / 2); + m_video.towns_crtc_layerscr[1].max_x = scr.xcenter() + (width / 2); + m_video.towns_crtc_layerscr[1].max_y = scr.ycenter() + (height / 2); + + // sanity checks + if(scr.max_x == 0 || scr.max_y == 0) + return; + if(scr.max_x <= scr.min_x || scr.max_y <= scr.min_y) + return; + + machine().first_screen()->configure(scr.max_x+1,scr.max_y+1,scr,HZ_TO_ATTOSECONDS(60)); +} + +READ8_MEMBER( towns_state::towns_gfx_high_r ) +{ + return m_towns_gfxvram[offset]; +} + +WRITE8_MEMBER( towns_state::towns_gfx_high_w ) +{ + m_towns_gfxvram[offset] = data; +} + +READ8_MEMBER( towns_state::towns_gfx_r ) +{ + UINT8 ret = 0; + + if(m_towns_mainmem_enable != 0) + return m_messram->pointer()[offset+0xc0000]; + + offset = offset << 2; + + if(m_video.towns_vram_page_sel != 0) + offset += 0x20000; + + ret = (((m_towns_gfxvram[offset] >> m_video.towns_vram_rplane) << 7) & 0x80) + | (((m_towns_gfxvram[offset] >> m_video.towns_vram_rplane) << 2) & 0x40) + | (((m_towns_gfxvram[offset+1] >> m_video.towns_vram_rplane) << 5) & 0x20) + | (((m_towns_gfxvram[offset+1] >> m_video.towns_vram_rplane)) & 0x10) + | (((m_towns_gfxvram[offset+2] >> m_video.towns_vram_rplane) << 3) & 0x08) + | (((m_towns_gfxvram[offset+2] >> m_video.towns_vram_rplane) >> 2) & 0x04) + | (((m_towns_gfxvram[offset+3] >> m_video.towns_vram_rplane) << 1) & 0x02) + | (((m_towns_gfxvram[offset+3] >> m_video.towns_vram_rplane) >> 4) & 0x01); + + return ret; +} + +WRITE8_MEMBER( towns_state::towns_gfx_w ) +{ + if(m_towns_mainmem_enable != 0) + { + m_messram->pointer()[offset+0xc0000] = data; + return; + } + offset = offset << 2; + if(m_video.towns_vram_page_sel != 0) + offset += 0x20000; + if(m_video.towns_vram_wplane & 0x08) + { + m_towns_gfxvram[offset] &= ~0x88; + m_towns_gfxvram[offset] |= ((data & 0x80) >> 4) | ((data & 0x40) << 1); + m_towns_gfxvram[offset + 1] &= ~0x88; + m_towns_gfxvram[offset + 1] |= ((data & 0x20) >> 2) | ((data & 0x10) << 3); + m_towns_gfxvram[offset + 2] &= ~0x88; + m_towns_gfxvram[offset + 2] |= ((data & 0x08)) | ((data & 0x04) << 5); + m_towns_gfxvram[offset + 3] &= ~0x88; + m_towns_gfxvram[offset + 3] |= ((data & 0x02) << 2) | ((data & 0x01) << 7); + } + if(m_video.towns_vram_wplane & 0x04) + { + m_towns_gfxvram[offset] &= ~0x44; + m_towns_gfxvram[offset] |= ((data & 0x80) >> 5) | ((data & 0x40)); + m_towns_gfxvram[offset + 1] &= ~0x44; + m_towns_gfxvram[offset + 1] |= ((data & 0x20) >> 3) | ((data & 0x10) << 2); + m_towns_gfxvram[offset + 2] &= ~0x44; + m_towns_gfxvram[offset + 2] |= ((data & 0x08) >> 1) | ((data & 0x04) << 4); + m_towns_gfxvram[offset + 3] &= ~0x44; + m_towns_gfxvram[offset + 3] |= ((data & 0x02) << 1) | ((data & 0x01) << 6); + } + if(m_video.towns_vram_wplane & 0x02) + { + m_towns_gfxvram[offset] &= ~0x22; + m_towns_gfxvram[offset] |= ((data & 0x80) >> 6) | ((data & 0x40) >> 1); + m_towns_gfxvram[offset + 1] &= ~0x22; + m_towns_gfxvram[offset + 1] |= ((data & 0x20) >> 4) | ((data & 0x10) << 1); + m_towns_gfxvram[offset + 2] &= ~0x22; + m_towns_gfxvram[offset + 2] |= ((data & 0x08) >> 2) | ((data & 0x04) << 3); + m_towns_gfxvram[offset + 3] &= ~0x22; + m_towns_gfxvram[offset + 3] |= ((data & 0x02)) | ((data & 0x01) << 5); + } + if(m_video.towns_vram_wplane & 0x01) + { + m_towns_gfxvram[offset] &= ~0x11; + m_towns_gfxvram[offset] |= ((data & 0x80) >> 7) | ((data & 0x40) >> 2); + m_towns_gfxvram[offset + 1] &= ~0x11; + m_towns_gfxvram[offset + 1] |= ((data & 0x20) >> 5) | ((data & 0x10)); + m_towns_gfxvram[offset + 2] &= ~0x11; + m_towns_gfxvram[offset + 2] |= ((data & 0x08) >> 3) | ((data & 0x04) << 2); + m_towns_gfxvram[offset + 3] &= ~0x11; + m_towns_gfxvram[offset + 3] |= ((data & 0x02) >> 1) | ((data & 0x01) << 4); + } +} + +void towns_state::towns_update_kanji_offset() +{ + // this is a little over the top... + if(m_video.towns_kanji_code_h < 0x30) + { + m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) + | (((m_video.towns_kanji_code_l - 0x20) & 0x20) << 8) + | (((m_video.towns_kanji_code_l - 0x20) & 0x40) << 6) + | ((m_video.towns_kanji_code_h & 0x07) << 9); + } + else if(m_video.towns_kanji_code_h < 0x70) + { + m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) + + (((m_video.towns_kanji_code_l - 0x20) & 0x60) << 8) + + ((m_video.towns_kanji_code_h & 0x0f) << 9) + + (((m_video.towns_kanji_code_h - 0x30) & 0x70) * 0xc00) + + 0x8000; + } + else + { + m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) + | (((m_video.towns_kanji_code_l - 0x20) & 0x20) << 8) + | (((m_video.towns_kanji_code_l - 0x20) & 0x40) << 6) + | ((m_video.towns_kanji_code_h & 0x07) << 9) + | 0x38000; + } +} + +READ8_MEMBER( towns_state::towns_video_cff80_r ) +{ + UINT8* ROM = m_user->base(); + + switch(offset) + { + case 0x00: // mix register + return m_video.towns_crtc_mix; + case 0x01: // read/write plane select (bit 0-3 write, bit 6-7 read) + return ((m_video.towns_vram_rplane << 6) & 0xc0) | m_video.towns_vram_wplane; + case 0x02: // display planes (bits 0-2,5), display page select (bit 4) + return m_video.towns_display_plane | m_video.towns_display_page_sel; + case 0x03: // VRAM page select (bit 5) + if(m_video.towns_vram_page_sel != 0) + return 0x10; + else + return 0x00; + case 0x06: + if(m_video.towns_vblank_flag != 0) + return 0x10; + else + return 0x00; + case 0x16: // Kanji character data + return ROM[(m_video.towns_kanji_offset << 1) + 0x180000]; + case 0x17: // Kanji character data + return ROM[(m_video.towns_kanji_offset++ << 1) + 0x180001]; + case 0x19: // ANK CG ROM + if(m_towns_ankcg_enable != 0) + return 0x01; + else + return 0x00; + default: + logerror("VGA: read from invalid or unimplemented memory-mapped port %05x\n",0xcff80+offset*4); + } + + return 0; +} + +WRITE8_MEMBER( towns_state::towns_video_cff80_w ) +{ + switch(offset) + { + case 0x00: // mix register + m_video.towns_crtc_mix = data; + break; + case 0x01: // read/write plane select (bit 0-3 write, bit 6-7 read) + m_video.towns_vram_wplane = data & 0x0f; + m_video.towns_vram_rplane = (data & 0xc0) >> 6; + towns_update_video_banks(space); + //logerror("VGA: VRAM wplane select = 0x%02x\n",towns_vram_wplane); + break; + case 0x02: // display plane (bits 0-2), display page select (bit 4) + m_video.towns_display_plane = data & 0x27; + m_video.towns_display_page_sel = data & 0x10; + break; + case 0x03: // VRAM page select (bit 4) + m_video.towns_vram_page_sel = data & 0x10; + break; + case 0x14: // Kanji offset (high) + m_video.towns_kanji_code_h = data & 0x7f; + towns_update_kanji_offset(); + //logerror("VID: Kanji code set (high) = %02x %02x\n",towns_kanji_code_h,towns_kanji_code_l); + break; + case 0x15: // Kanji offset (low) + m_video.towns_kanji_code_l = data & 0x7f; + towns_update_kanji_offset(); + //logerror("VID: Kanji code set (low) = %02x %02x\n",towns_kanji_code_h,towns_kanji_code_l); + break; + case 0x19: // ANK CG ROM + m_towns_ankcg_enable = data & 0x01; + towns_update_video_banks(space); + break; + default: + logerror("VGA: write %08x to invalid or unimplemented memory-mapped port %05x\n",data,0xcff80+offset); + } +} + +READ8_MEMBER( towns_state::towns_video_cff80_mem_r ) +{ + if(m_towns_mainmem_enable != 0) + return m_messram->pointer()[offset+0xcff80]; + + return towns_video_cff80_r(space,offset); +} + +WRITE8_MEMBER( towns_state::towns_video_cff80_mem_w ) +{ + if(m_towns_mainmem_enable != 0) + { + m_messram->pointer()[offset+0xcff80] = data; + return; + } + towns_video_cff80_w(space,offset,data); +} + +/* + * port 0x440-0x443 - CRTC + * 0x440 = register select + * 0x442/3 = register data (16-bit) + * 0x448 = shifter register select + * 0x44a = shifter register data (8-bit) + * + */ +READ8_MEMBER(towns_state::towns_video_440_r) +{ + UINT8 ret = 0; + UINT16 xpos,ypos; + + switch(offset) + { + case 0x00: + return m_video.towns_crtc_sel; + case 0x02: +// logerror("CRTC: reading register %i (0x442) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]); + if(m_video.towns_crtc_sel == 30) + return 0x00; + return m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0x00ff; + case 0x03: +// logerror("CRTC: reading register %i (0x443) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]); + if(m_video.towns_crtc_sel == 30) + { + // check video position + xpos = space.machine().first_screen()->hpos(); + ypos = space.machine().first_screen()->vpos(); + + if(xpos < (m_video.towns_crtc_reg[0] & 0xfe)) + ret |= 0x02; + if(ypos < (m_video.towns_crtc_reg[6] & 0x1f)) + ret |= 0x04; + if(xpos < m_video.towns_crtc_layerscr[0].max_x && xpos > m_video.towns_crtc_layerscr[0].min_x) + ret |= 0x10; + if(xpos < m_video.towns_crtc_layerscr[1].max_x && xpos > m_video.towns_crtc_layerscr[1].min_x) + ret |= 0x20; + if(ypos < m_video.towns_crtc_layerscr[0].max_y && ypos > m_video.towns_crtc_layerscr[0].min_y) + ret |= 0x40; + if(ypos < m_video.towns_crtc_layerscr[1].max_y && ypos > m_video.towns_crtc_layerscr[1].min_y) + ret |= 0x80; + + return ret; + } + return (m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0xff00) >> 8; + case 0x08: + return m_video.towns_video_sel; + case 0x0a: + logerror("Video: reading register %i (0x44a) [%02x]\n",m_video.towns_video_sel,m_video.towns_video_reg[m_video.towns_video_sel]); + return m_video.towns_video_reg[m_video.towns_video_sel]; + case 0x0c: + if(m_video.towns_dpmd_flag != 0) + { + m_video.towns_dpmd_flag = 0; + ret |= 0x80; + } + ret |= (m_video.towns_sprite_flag ? 0x02 : 0x00); // Sprite drawing flag + ret |= m_video.towns_sprite_page & 0x01; + return ret; + case 0x10: + return m_video.towns_sprite_sel; + case 0x12: + logerror("SPR: reading register %i (0x452) [%02x]\n",m_video.towns_sprite_sel,m_video.towns_sprite_reg[m_video.towns_sprite_sel]); + return m_video.towns_sprite_reg[m_video.towns_sprite_sel]; + //default: + //logerror("VID: read port %04x\n",offset+0x440); + } + return 0x00; +} + +WRITE8_MEMBER(towns_state::towns_video_440_w) +{ + switch(offset) + { + case 0x00: + m_video.towns_crtc_sel = data; + break; + case 0x02: +// logerror("CRTC: writing register %i (0x442) [%02x]\n",towns_crtc_sel,data); + m_video.towns_crtc_reg[m_video.towns_crtc_sel] = + (m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0xff00) | data; + towns_crtc_refresh_mode(); + break; + case 0x03: +// logerror("CRTC: writing register %i (0x443) [%02x]\n",towns_crtc_sel,data); + m_video.towns_crtc_reg[m_video.towns_crtc_sel] = + (m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0x00ff) | (data << 8); + towns_crtc_refresh_mode(); + break; + case 0x08: + m_video.towns_video_sel = data & 0x01; + break; + case 0x0a: + logerror("Video: writing register %i (0x44a) [%02x]\n",m_video.towns_video_sel,data); + m_video.towns_video_reg[m_video.towns_video_sel] = data; + break; + case 0x10: + m_video.towns_sprite_sel = data & 0x07; + break; + case 0x12: + logerror("SPR: writing register %i (0x452) [%02x]\n",m_video.towns_sprite_sel,data); + m_video.towns_sprite_reg[m_video.towns_sprite_sel] = data; + break; + default: + logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0x440); + } +} + +READ8_MEMBER(towns_state::towns_video_5c8_r) +{ + //logerror("VID: read port %04x\n",offset+0x5c8); + switch(offset) + { + case 0x00: // 0x5c8 - disable TVRAM? + if(m_video.towns_tvram_enable != 0) + { + m_video.towns_tvram_enable = 0; + return 0x80; + } + else + return 0x00; + } + return 0x00; +} + +WRITE8_MEMBER(towns_state::towns_video_5c8_w) +{ + pic8259_device* dev = m_pic_slave; + + switch(offset) + { + case 0x02: // 0x5ca - VSync clear? + dev->ir3_w(0); + if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set low\n"); + //towns_vblank_flag = 0; + break; + } + logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0x5c8); +} + +void towns_state::towns_update_palette() +{ + UINT8 entry = m_video.towns_palette_select; + UINT8 r = m_video.towns_palette_r[entry]; + UINT8 g = m_video.towns_palette_g[entry]; + UINT8 b = m_video.towns_palette_b[entry]; + m_palette->set_pen_color(entry, r, g, b); +} + +/* Video/CRTC + * + * 0xfd90 - palette colour select + * 0xfd92/4/6 - BRG value + * 0xfd98-9f - degipal(?) + */ +READ8_MEMBER(towns_state::towns_video_fd90_r) +{ + UINT8 ret = 0; + UINT16 xpos; + +// logerror("VID: read port %04x\n",offset+0xfd90); + switch(offset) + { + case 0x00: + return m_video.towns_palette_select; + case 0x02: + return m_video.towns_palette_b[m_video.towns_palette_select]; + case 0x04: + return m_video.towns_palette_r[m_video.towns_palette_select]; + case 0x06: + return m_video.towns_palette_g[m_video.towns_palette_select]; + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + return m_video.towns_degipal[offset-0x08]; + case 0x10: // "sub status register" + // check video position + xpos = space.machine().first_screen()->hpos(); + + if(xpos < m_video.towns_crtc_layerscr[0].max_x && xpos > m_video.towns_crtc_layerscr[0].min_x) + ret |= 0x02; + if(m_video.towns_vblank_flag) + ret |= 0x01; + return ret; + } + return 0x00; +} + +WRITE8_MEMBER(towns_state::towns_video_fd90_w) +{ + switch(offset) + { + case 0x00: + m_video.towns_palette_select = data; + break; + case 0x02: + m_video.towns_palette_b[m_video.towns_palette_select] = data; + towns_update_palette(); + break; + case 0x04: + m_video.towns_palette_r[m_video.towns_palette_select] = data; + towns_update_palette(); + break; + case 0x06: + m_video.towns_palette_g[m_video.towns_palette_select] = data; + towns_update_palette(); + break; + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + m_video.towns_degipal[offset-0x08] = data; + m_video.towns_dpmd_flag = 1; + break; + case 0x10: + m_video.towns_layer_ctrl = data; + break; + } + logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0xfd90); +} + +READ8_MEMBER(towns_state::towns_video_ff81_r) +{ + return ((m_video.towns_vram_rplane << 6) & 0xc0) | m_video.towns_vram_wplane; +} + +WRITE8_MEMBER(towns_state::towns_video_ff81_w) +{ + m_video.towns_vram_wplane = data & 0x0f; + m_video.towns_vram_rplane = (data & 0xc0) >> 6; + towns_update_video_banks(space); + logerror("VGA: VRAM wplane select (I/O) = 0x%02x\n",m_video.towns_vram_wplane); +} + +READ8_MEMBER(towns_state::towns_video_unknown_r) +{ + return 0x00; +} + +/* + * Sprite RAM, low memory + * Writing to 0xc8xxx or 0xcaxxx activates TVRAM + * Writing to I/O port 0x5c8 disables TVRAM + * (bit 7 returns high if TVRAM was previously active) + * + * In TVRAM mode: + * 0xc8000-0xc8fff: ASCII text (2 bytes each: ISO646 code, then attribute) + * 0xca000-0xcafff: JIS code + */ +READ8_MEMBER(towns_state::towns_spriteram_low_r) +{ + UINT8* RAM = m_messram->pointer(); + UINT8* ROM = m_user->base(); + + if(offset < 0x1000) + { // 0xc8000-0xc8fff + if(m_towns_mainmem_enable == 0) + { +// if(towns_tvram_enable == 0) +// return towns_sprram[offset]; +// else + return m_towns_txtvram[offset]; + } + else + return RAM[offset + 0xc8000]; + } + if(offset >= 0x1000 && offset < 0x2000) + { // 0xc9000-0xc9fff + return RAM[offset + 0xc9000]; + } + if(offset >= 0x2000 && offset < 0x3000) + { // 0xca000-0xcafff + if(m_towns_mainmem_enable == 0) + { + if(m_towns_ankcg_enable != 0 && offset < 0x2800) + return ROM[0x180000 + 0x3d000 + (offset-0x2000)]; +// if(towns_tvram_enable == 0) +// return m_towns_sprram[offset]; +// else + return m_towns_txtvram[offset]; + } + else + return RAM[offset + 0xca000]; + } + return 0x00; +} + +WRITE8_MEMBER(towns_state::towns_spriteram_low_w) +{ + UINT8* RAM = m_messram->pointer(); + + if(offset < 0x1000) + { // 0xc8000-0xc8fff + m_video.towns_tvram_enable = 1; + if(m_towns_mainmem_enable == 0) + m_towns_txtvram[offset] = data; + else + RAM[offset + 0xc8000] = data; + } + if(offset >= 0x1000 && offset < 0x2000) + { + RAM[offset + 0xc9000] = data; + } + if(offset >= 0x2000 && offset < 0x3000) + { // 0xca000-0xcafff + m_video.towns_tvram_enable = 1; + if(m_towns_mainmem_enable == 0) + m_towns_txtvram[offset] = data; + else + RAM[offset + 0xca000] = data; + } +} + +READ8_MEMBER( towns_state::towns_spriteram_r ) +{ + return m_towns_txtvram[offset]; +} + +WRITE8_MEMBER( towns_state::towns_spriteram_w ) +{ + m_towns_txtvram[offset] = data; +} + +/* + * Sprites + * + * Max. 1024, 16x16, 16 colours per sprite + * 128kB Sprite RAM (8kB attributes, 120kB pattern/colour data) + * Sprites are rendered directly to VRAM layer 1 (VRAM offset 0x40000 or 0x60000) + * + * Sprite RAM format: + * 4 words per sprite + * +0: X position (10-bit) + * +2: Y position (10-bit) + * +4: Sprite Attribute + * bit 15: enforce offsets (regs 2-5) + * bit 12,13: flip sprite + * bits 10-0: Sprite RAM offset containing sprite pattern + * TODO: other attributes (zoom?) + * +6: Sprite Colour + * bit 15: use colour data in located in sprite RAM offset in bits 11-0 (x32) + */ +void towns_state::render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) +{ + UINT16 xpos,ypos; + UINT16 col,pixel; + UINT32 voffset; + UINT16 xstart,xend,ystart,yend; + int xdir,ydir; + int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1); + int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2); + + if(xflip) + { + xstart = x+14; + xend = x-2; + xdir = -2; + } + else + { + xstart = x+1; + xend = x+17; + xdir = 2; + } + if(yflip) + { + ystart = y+15; + yend = y-1; + ydir = -1; + } + else + { + ystart = y; + yend = y+16; + ydir = 1; + } + xstart &= 0x1ff; + xend &= 0x1ff; + ystart &= 0x1ff; + yend &= 0x1ff; + poffset &= 0x1ffff; + + for(ypos=ystart;ypos!=yend;ypos+=ydir,ypos&=0x1ff) + { + for(xpos=xstart;xpos!=xend;xpos+=xdir,xpos&=0x1ff) + { + if(m_video.towns_sprite_page != 0) + voffset = 0x20000; + else + voffset = 0x00000; + pixel = (m_towns_txtvram[poffset] & 0xf0) >> 4; + col = m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8); + voffset += (m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos + voffset += (xpos & 0x1ff) * 2; + if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) + || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) + { + if(xpos < width && ypos < height && pixel != 0) + { + m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; + m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; + } + } + if(xflip) + voffset+=2; + else + voffset-=2; + pixel = m_towns_txtvram[poffset] & 0x0f; + col = m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8); + if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) + || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) + { + if(xpos < width && ypos < height && pixel != 0) + { + m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; + m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; + } + } + poffset++; + poffset &= 0x1ffff; + } + } +} + +void towns_state::render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) +{ + UINT16 xpos,ypos; + UINT16 col; + UINT32 voffset; + UINT16 xstart,ystart,xend,yend; + int xdir,ydir; + int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1); + int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2); + + if(xflip) + { + xstart = x+16; + xend = x; + xdir = -1; + } + else + { + xstart = x+1; + xend = x+17; + xdir = 1; + } + if(yflip) + { + ystart = y+15; + yend = y-1; + ydir = -1; + } + else + { + ystart = y; + yend = y+16; + ydir = 1; + } + xstart &= 0x1ff; + xend &= 0x1ff; + ystart &= 0x1ff; + yend &= 0x1ff; + poffset &= 0x1ffff; + + for(ypos=ystart;ypos!=yend;ypos+=ydir,ypos&=0x1ff) + { + for(xpos=xstart;xpos!=xend;xpos+=xdir,xpos&=0x1ff) + { + if(m_video.towns_sprite_page != 0) + voffset = 0x20000; + else + voffset = 0x00000; + col = m_towns_txtvram[poffset] | (m_towns_txtvram[poffset+1] << 8); + voffset += (m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos + voffset += (xpos & 0x1ff) * 2; + if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) + || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) + { + if(xpos < width && ypos < height && col < 0x8000) + { + m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; + m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; + } + } + poffset+=2; + poffset &= 0x1ffff; + } + } +} + +void towns_state::draw_sprites(const rectangle* rect) +{ + UINT16 sprite_limit = (m_video.towns_sprite_reg[0] | (m_video.towns_sprite_reg[1] << 8)) & 0x3ff; + int n; + UINT16 x,y,attr,colour; + UINT16 xoff = (m_video.towns_sprite_reg[2] | (m_video.towns_sprite_reg[3] << 8)) & 0x1ff; + UINT16 yoff = (m_video.towns_sprite_reg[4] | (m_video.towns_sprite_reg[5] << 8)) & 0x1ff; + UINT32 poffset,coffset; + + if(!(m_video.towns_sprite_reg[1] & 0x80)) + return; + + // clears VRAM for each frame? + if(m_video.towns_sprite_page == 0) + memset(m_towns_gfxvram+0x40000,0x80,0x20000); + else + memset(m_towns_gfxvram+0x60000,0x80,0x20000); + + for(n=sprite_limit;n<1024;n++) + { + x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); + y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); + attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); + colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); + if(attr & 0x8000) + { + x += xoff; + y += yoff; + } + x &= 0x1ff; + y &= 0x1ff; + + if(colour & 0x8000) + { + poffset = (attr & 0x3ff) << 7; + coffset = (colour & 0xfff) << 5; +#ifdef SPR_DEBUG + printf("Sprite4 #%i, X %i Y %i Attr %04x Col %04x Poff %08x Coff %08x\n", + n,x,y,attr,colour,poffset,coffset); +#endif + if(!(colour & 0x2000)) + render_sprite_4((poffset)&0x1ffff,coffset,x,y,attr&0x2000,attr&0x1000,rect); + } + else + { + poffset = (attr & 0x3ff) << 7; +#ifdef SPR_DEBUG + printf("Sprite16 #%i, X %i Y %i Attr %04x Col %04x Poff %08x", + n,x,y,attr,colour,poffset); +#endif + if(!(colour & 0x2000)) + render_sprite_16((poffset)&0x1ffff,x,y,attr&0x2000,attr&0x1000,rect); + } + } + + if(m_video.towns_sprite_page == 0) // flip VRAM page + m_video.towns_sprite_page = 1; + else + m_video.towns_sprite_page = 0; + + m_video.towns_sprite_flag = 1; // we are now drawing + m_video.sprite_timer->adjust(m_maincpu->cycles_to_attotime(128 * (1025-sprite_limit))); +} + +void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) +{ + UINT32 off = 0; + int x; + UINT16 colour; + int hzoom = 1; + int linesize; + UINT32 scroll; + + if(layer == 0) + linesize = m_video.towns_crtc_reg[20] * 4; + else + linesize = m_video.towns_crtc_reg[24] * 4; + + if(m_video.towns_display_page_sel != 0) + off = 0x20000; + +// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) +// off = 0x20000; + + if(layer != 0) + { + if(!(m_video.towns_video_reg[0] & 0x10)) + return; + if(!(m_video.towns_crtc_reg[28] & 0x10)) + off += (m_video.towns_crtc_reg[21]) << 2; // initial offset + else + { + scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 2)); + off += scroll; + } + off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); + hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; + } + else + { + if(!(m_video.towns_crtc_reg[28] & 0x20)) + off += (m_video.towns_crtc_reg[17]) << 2; // initial offset + else + { + scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 2)); + off += scroll; + } + off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); + hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; + } + + off += line * linesize; + off &= ~0x01; + + if(hzoom == 1) + { + for(x=rect->min_x;xmax_x;x++) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; + if(colour < 0x8000) + { + bitmap.pix32(scanline, x) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + } + off+=2; + } + } + + if(hzoom == 2) + { // x2 horizontal zoom + for(x=rect->min_x;xmax_x;x+=2) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; + if(colour < 0x8000) + { + bitmap.pix32(scanline, x) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+1) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + } + off+=2; + } + } + + if(hzoom == 3) + { // x3 horizontal zoom + for(x=rect->min_x;xmax_x;x+=3) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; + if(colour < 0x8000) + { + bitmap.pix32(scanline, x) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+1) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+2) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + } + off+=2; + } + } + + if(hzoom == 4) + { // x4 horizontal zoom + for(x=rect->min_x;xmax_x;x+=4) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; + if(colour < 0x8000) + { + bitmap.pix32(scanline, x) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+1) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+2) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+3) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + } + off+=2; + } + } + + if(hzoom == 5) + { // x5 horizontal zoom + for(x=rect->min_x;xmax_x;x+=5) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; + if(colour < 0x8000) + { + bitmap.pix32(scanline, x) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+1) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+2) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+3) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + bitmap.pix32(scanline, x+4) = + ((colour & 0x001f) << 3) + | ((colour & 0x7c00) << 1) + | ((colour & 0x03e0) << 14); + } + off+=2; + } + } +} + +void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) +{ + int off = 0; + int x; + UINT8 colour; + int hzoom = 1; + int linesize; + UINT32 scroll; + + if(m_video.towns_display_page_sel != 0) + off = 0x20000; + +// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) +// off = 0x20000; + + if(layer == 0) + linesize = m_video.towns_crtc_reg[20] * 8; + else + linesize = m_video.towns_crtc_reg[24] * 8; + + if(layer != 0) + { + if(!(m_video.towns_video_reg[0] & 0x10)) + return; + if(!(m_video.towns_crtc_reg[28] & 0x10)) + off += m_video.towns_crtc_reg[21] << 3; // initial offset + else + { + scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 3)); + off += scroll; + } + off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); + hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; + } + else + { + if(!(m_video.towns_crtc_reg[28] & 0x20)) + off += m_video.towns_crtc_reg[17] << 3; // initial offset + else + { + scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3)); + off += scroll; + } + off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); + hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; + } + + off += line * linesize; + + if(hzoom == 1) + { + for(x=rect->min_x;xmax_x;x++) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)]; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + } + off++; + } + } + + if(hzoom == 2) + { // x2 horizontal zoom + for(x=rect->min_x;xmax_x;x+=2) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)+1]; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + } + off++; + } + } + + if(hzoom == 3) + { // x3 horizontal zoom + for(x=rect->min_x;xmax_x;x+=3) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)+1]; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + bitmap.pix32(scanline, x+2) = m_palette->pen(colour); + } + off++; + } + } + + if(hzoom == 4) + { // x4 horizontal zoom + for(x=rect->min_x;xmax_x;x+=4) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)+1]; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + bitmap.pix32(scanline, x+2) = m_palette->pen(colour); + bitmap.pix32(scanline, x+3) = m_palette->pen(colour); + } + off++; + } + } + + if(hzoom == 5) + { // x5 horizontal zoom + for(x=rect->min_x;xmax_x;x+=5) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)+1]; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + bitmap.pix32(scanline, x+2) = m_palette->pen(colour); + bitmap.pix32(scanline, x+3) = m_palette->pen(colour); + bitmap.pix32(scanline, x+4) = m_palette->pen(colour); + } + off++; + } + } +} + +void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) +{ + int off = 0; + int x; + UINT8 colour; + int hzoom = 1; + int linesize; + UINT32 scroll; + + if(m_video.towns_display_page_sel != 0) + off = 0x20000; + +// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) +// off = 0x20000; + + if(layer == 0) + linesize = m_video.towns_crtc_reg[20] * 4; + else + linesize = m_video.towns_crtc_reg[24] * 4; + + if(layer != 0) + { + if(!(m_video.towns_video_reg[0] & 0x10)) + return; + if(!(m_video.towns_crtc_reg[28] & 0x10)) + off += m_video.towns_crtc_reg[21]; // initial offset + else + { + scroll = ((m_video.towns_crtc_reg[21] & 0xfc00)<<2) | (((m_video.towns_crtc_reg[21] & 0x3ff)<<2)); + off += scroll; + } + off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); + hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; + } + else + { + if(!(m_video.towns_crtc_reg[28] & 0x20)) + off += m_video.towns_crtc_reg[17]; // initial offset + else + { + scroll = ((m_video.towns_crtc_reg[17] & 0xfc00)<<2) | (((m_video.towns_crtc_reg[17] & 0x3ff)<<2)); + off += scroll; + } + off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); + hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; + } + + off += line * linesize; + + if(hzoom == 1) + { + for(x=rect->min_x;xmax_x;x+=2) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; + if(colour != 0) + { + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + } + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + } + off++; + } + } + + if(hzoom == 2) + { // x2 horizontal zoom + for(x=rect->min_x;xmax_x;x+=4) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; + if(colour != 0) + { + bitmap.pix32(scanline, x+2) = m_palette->pen(colour); + bitmap.pix32(scanline, x+3) = m_palette->pen(colour); + } + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + } + off++; + } + } + + if(hzoom == 3) + { // x3 horizontal zoom + for(x=rect->min_x;xmax_x;x+=6) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; + if(colour != 0) + { + bitmap.pix32(scanline, x+3) = m_palette->pen(colour); + bitmap.pix32(scanline, x+4) = m_palette->pen(colour); + bitmap.pix32(scanline, x+5) = m_palette->pen(colour); + } + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + bitmap.pix32(scanline, x+2) = m_palette->pen(colour); + } + off++; + } + } + + if(hzoom == 4) + { // x4 horizontal zoom + for(x=rect->min_x;xmax_x;x+=8) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; + if(colour != 0) + { + bitmap.pix32(scanline, x+4) = m_palette->pen(colour); + bitmap.pix32(scanline, x+5) = m_palette->pen(colour); + bitmap.pix32(scanline, x+6) = m_palette->pen(colour); + bitmap.pix32(scanline, x+7) = m_palette->pen(colour); + } + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + bitmap.pix32(scanline, x+2) = m_palette->pen(colour); + bitmap.pix32(scanline, x+3) = m_palette->pen(colour); + } + off++; + } + } + + if(hzoom == 5) + { // x5 horizontal zoom + for(x=rect->min_x;xmax_x;x+=10) + { + if(m_video.towns_video_reg[0] & 0x10) + off &= 0x3ffff; // 2 layers + else + off &= 0x7ffff; // 1 layer + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; + if(colour != 0) + { + bitmap.pix32(scanline, x+5) = m_palette->pen(colour); + bitmap.pix32(scanline, x+6) = m_palette->pen(colour); + bitmap.pix32(scanline, x+7) = m_palette->pen(colour); + bitmap.pix32(scanline, x+8) = m_palette->pen(colour); + bitmap.pix32(scanline, x+9) = m_palette->pen(colour); + } + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + if(colour != 0) + { + bitmap.pix32(scanline, x) = m_palette->pen(colour); + bitmap.pix32(scanline, x+1) = m_palette->pen(colour); + bitmap.pix32(scanline, x+2) = m_palette->pen(colour); + bitmap.pix32(scanline, x+3) = m_palette->pen(colour); + bitmap.pix32(scanline, x+4) = m_palette->pen(colour); + } + off++; + } + } +} + +void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer) +{ + int line; + int scanline; + int height; + + if(layer == 0) + { + scanline = rect->min_y; + height = (rect->max_y - rect->min_y); + if(m_video.towns_crtc_reg[27] & 0x0010) + height /= 2; + switch(m_video.towns_video_reg[0] & 0x03) + { + case 0x01: + for(line=0;linemin_y; + height = (rect->max_y - rect->min_y); + if(m_video.towns_crtc_reg[27] & 0x1000) + height /= 2; + switch(m_video.towns_video_reg[0] & 0x0c) + { + case 0x04: + for(line=0;linebase(); + int a,b; + + // all characters are 16 pixels high + vram_addr = (x * 4) + (y * (linesize * 16)); + + if((attr & 0xc0) == 0) + rom_addr = 0x3d800 + (ascii * 128); + else + { + code_h = (jis & 0xff00) >> 8; + code_l = jis & 0x00ff; + if(code_h < 0x30) + { + rom_addr = ((code_l & 0x1f) << 4) + | (((code_l - 0x20) & 0x20) << 8) + | (((code_l - 0x20) & 0x40) << 6) + | ((code_h & 0x07) << 9); + } + else if(code_h < 0x70) + { + rom_addr = ((code_l & 0x1f) << 4) + + (((code_l - 0x20) & 0x60) << 8) + + ((code_h & 0x0f) << 9) + + (((code_h - 0x30) & 0x70) * 0xc00) + + 0x8000; + } + else + { + rom_addr = ((code_l & 0x1f) << 4) + | (((code_l - 0x20) & 0x20) << 8) + | (((code_l - 0x20) & 0x40) << 6) + | ((code_h & 0x07) << 9) + | 0x38000; + } + } + colour = attr & 0x07; + if(attr & 0x20) + colour |= 0x08; + + for(a=0;a<16;a++) // for each scanline + { + if((attr & 0xc0) == 0) + data = font_rom[0x180000 + rom_addr + a]; + else + { + if((attr & 0xc0) == 0x80) + data = font_rom[0x180000 + rom_addr + (a*2)]; + else + data = font_rom[0x180000 + rom_addr + (a*2) + 1]; + } + + if(attr & 0x08) + data = ~data; // inverse + + // and finally, put the data in VRAM + for(b=0;b<8;b+=2) + { + temp = 0; + if(data & (1<(dev)->ir3_w(0); // IRQ11 = VSync + if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set low\n"); + m_video.towns_vblank_flag = 0; +} + +INTERRUPT_GEN_MEMBER(towns_state::towns_vsync_irq) +{ + pic8259_device* dev = m_pic_slave; + dev->ir3_w(1); // IRQ11 = VSync + if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set high\n"); + m_video.towns_vblank_flag = 1; + machine().scheduler().timer_set(machine().first_screen()->time_until_vblank_end(), timer_expired_delegate(FUNC(towns_state::towns_vblank_end),this), 0, (void*)dev); + if(m_video.towns_tvram_enable) + draw_text_layer(); + if(m_video.towns_sprite_reg[1] & 0x80) + draw_sprites(&m_video.towns_crtc_layerscr[1]); +} + +void towns_state::video_start() +{ + m_video.towns_vram_wplane = 0x00; + m_video.towns_sprite_page = 0; + m_video.sprite_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(towns_state::towns_sprite_done),this)); +} + +UINT32 towns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0x00000000, cliprect); + + if(!(m_video.towns_video_reg[1] & 0x01)) + { + if(!machine().input().code_pressed(KEYCODE_Q)) + { + if((m_video.towns_layer_ctrl & 0x03) != 0) + towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[1],1); + } + if(!machine().input().code_pressed(KEYCODE_W)) + { + if((m_video.towns_layer_ctrl & 0x0c) != 0) + towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[0],0); + } + } + else + { + if(!machine().input().code_pressed(KEYCODE_Q)) + { + if((m_video.towns_layer_ctrl & 0x0c) != 0) + towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[0],0); + } + if(!machine().input().code_pressed(KEYCODE_W)) + { + if((m_video.towns_layer_ctrl & 0x03) != 0) + towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[1],1); + } + } + +#if 0 +#ifdef SPR_DEBUG + if(machine().input().code_pressed(KEYCODE_O)) + pshift+=0x80; + if(machine().input().code_pressed(KEYCODE_I)) + pshift-=0x80; + popmessage("Pixel shift = %08x",pshift); +#endif +#endif + +#ifdef CRTC_REG_DISP + popmessage("CRTC: %i %i %i %i %i %i %i %i %i\n%i %i %i %i | %i %i %i %i\n%04x %i %i %i | %04x %i %i %i\nZOOM: %04x\nVideo: %02x %02x\nText=%i Spr=%02x\nReg28=%04x", + m_video.towns_crtc_reg[0],m_video.towns_crtc_reg[1],m_video.towns_crtc_reg[2],m_video.towns_crtc_reg[3], + m_video.towns_crtc_reg[4],m_video.towns_crtc_reg[5],m_video.towns_crtc_reg[6],m_video.towns_crtc_reg[7], + m_video.towns_crtc_reg[8], + m_video.towns_crtc_reg[9],m_video.towns_crtc_reg[10],m_video.towns_crtc_reg[11],m_video.towns_crtc_reg[12], + m_video.towns_crtc_reg[13],m_video.towns_crtc_reg[14],m_video.towns_crtc_reg[15],m_video.towns_crtc_reg[16], + m_video.towns_crtc_reg[17],m_video.towns_crtc_reg[18],m_video.towns_crtc_reg[19],m_video.towns_crtc_reg[20], + m_video.towns_crtc_reg[21],m_video.towns_crtc_reg[22],m_video.towns_crtc_reg[23],m_video.towns_crtc_reg[24], + m_video.towns_crtc_reg[27],m_video.towns_video_reg[0],m_video.towns_video_reg[1],m_video.towns_tvram_enable,m_video.towns_sprite_reg[1] & 0x80, + m_video.towns_crtc_reg[28]); +#endif + + return 0; +} diff --git a/src/mame/video/galaxy.c b/src/mame/video/galaxy.c new file mode 100644 index 00000000000..0f8184916f8 --- /dev/null +++ b/src/mame/video/galaxy.c @@ -0,0 +1,134 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha, Miodrag Milanovic +/*************************************************************************** + + galaxy.c + + Functions to emulate the video hardware of the Galaksija. + + 20/05/2008 - Real video implementation by Miodrag Milanovic + 01/03/2008 - Update by Miodrag Milanovic to make Galaksija video work with new SVN code +***************************************************************************/ + +#include "emu.h" +#include "includes/galaxy.h" +#include "cpu/z80/z80.h" + + +TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int y, x; + if (m_interrupts_enabled == TRUE) + { + UINT8 *gfx = m_region_gfx1->base(); + UINT8 dat = (m_latch_value & 0x3c) >> 2; + if ((m_gal_cnt >= 48 * 2) && (m_gal_cnt < 48 * 210)) // display on screen just m_first 208 lines + { + UINT8 mode = (m_latch_value >> 1) & 1; // bit 2 latch represents mode + UINT16 addr = (m_maincpu->state_int(Z80_I) << 8) | m_maincpu->state_int(Z80_R) | ((m_latch_value & 0x80) ^ 0x80); + if (mode == 0) + { + // Text mode + if (m_first == 0 && (m_maincpu->state_int(Z80_R) & 0x1f) == 0) + { + // Due to a fact that on real processor latch value is set at + // the end of last cycle we need to skip dusplay of double + // m_first char in each row + m_code = 0x00; + m_first = 1; + } + else + { + m_code = space.read_byte(addr) & 0xbf; + m_code += (m_code & 0x80) >> 1; + m_code = gfx[(m_code & 0x7f) +(dat << 7 )] ^ 0xff; + m_first = 0; + } + y = m_gal_cnt / 48 - 2; + x = (m_gal_cnt % 48) * 8; + + m_bitmap.pix16(y, x ) = (m_code >> 0) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 1) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 2) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 3) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 4) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 5) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 6) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 7) & 1; + } + else + { // Graphics mode + if (m_first < 4 && (m_maincpu->state_int(Z80_R) & 0x1f) == 0) + { + // Due to a fact that on real processor latch value is set at + // the end of last cycle we need to skip dusplay of 4 times + // m_first char in each row + m_code = 0x00; + m_first++; + } + else + { + m_code = space.read_byte(addr) ^ 0xff; + m_first = 0; + } + y = m_gal_cnt / 48 - 2; + x = (m_gal_cnt % 48) * 8; + + /* hack - until calc of R is fixed in Z80 */ + if (x == 11 * 8 && y == 0) + { + m_start_addr = addr; + } + if ((x / 8 >= 11) && (x / 8 < 44)) + { + m_code = space.read_byte(m_start_addr + y * 32 + (m_gal_cnt % 48) - 11) ^ 0xff; + } + else + { + m_code = 0x00; + } + /* end of hack */ + + m_bitmap.pix16(y, x ) = (m_code >> 0) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 1) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 2) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 3) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 4) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 5) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 6) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 7) & 1; + } + } + m_gal_cnt++; + } +} + +void galaxy_state::galaxy_set_timer() +{ + m_gal_cnt = 0; + m_gal_video_timer->adjust(attotime::zero, 0, attotime::from_hz(6144000 / 8)); +} + +void galaxy_state::video_start() +{ + m_gal_cnt = 0; + + m_gal_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxy_state::gal_video),this)); + m_gal_video_timer->adjust(attotime::zero, 0, attotime::never); + + machine().first_screen()->register_screen_bitmap(m_bitmap); +} + +UINT32 galaxy_state::screen_update_galaxy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_gal_video_timer->adjust(attotime::zero, 0, attotime::never); + if (m_interrupts_enabled == FALSE) + { + const rectangle black_area(0, 384 - 1, 0, 208 - 1); + m_bitmap.fill(0, black_area); + } + m_interrupts_enabled = FALSE; + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} diff --git a/src/mame/video/galeb.c b/src/mame/video/galeb.c new file mode 100644 index 00000000000..d7bd7bb7b4a --- /dev/null +++ b/src/mame/video/galeb.c @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Galeb video driver by Miodrag Milanovic + + 01/03/2008 Updated to work with latest SVN code + 22/02/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/galeb.h" + + +const gfx_layout galeb_charlayout = +{ + 8, 8, /* 8x8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {7, 6, 5, 4, 3, 2, 1, 0}, + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, + 8*8 /* size of one char */ +}; + +void galeb_state::video_start() +{ +} + +UINT32 galeb_state::screen_update_galeb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + + for(y = 0; y < 16; y++ ) + { + for(x = 0; x < 48; x++ ) + { + int code = m_video_ram[15 + x + y*64]; + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*8); + } + } + return 0; +} diff --git a/src/mame/video/gamecom.c b/src/mame/video/gamecom.c new file mode 100644 index 00000000000..29bad2d9ce7 --- /dev/null +++ b/src/mame/video/gamecom.c @@ -0,0 +1,71 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol, Robbbert + +#include "includes/gamecom.h" + +#define Y_PIXELS 200 + + +TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) + { + // draw line + m_base_address = ( m_p_ram[SM8521_LCDC] & 0x40 ) ? 0x2000 : 0x0000; + + if ( ~m_p_ram[SM8521_LCDC] & 0x80 ) + { + rectangle rec(0, Y_PIXELS - 1, m_scanline, m_scanline); + m_bitmap.fill(0, rec ); + return; + } + else + { + UINT8 *line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; + int pal[4]; + int i; + + switch( m_p_ram[SM8521_LCDC] & 0x30 ) + { + case 0x00: + pal[0] = 4; + pal[1] = 3; + pal[2] = 2; + pal[3] = 0; + break; + case 0x10: + pal[0] = 4; + pal[1] = 3; + pal[2] = 1; + pal[3] = 0; + break; + case 0x20: + pal[0] = 4; + pal[1] = 3; + pal[2] = 1; + pal[3] = 0; + break; + case 0x30: + pal[0] = 4; + pal[1] = 2; + pal[2] = 1; + pal[3] = 0; + break; + } + for( i = 0; i < 40; i++ ) + { + UINT8 p = line[i]; + m_bitmap.pix16(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; + m_bitmap.pix16(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; + m_bitmap.pix16(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; + m_bitmap.pix16(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; + } + } + + m_scanline = ( m_scanline + 1 ) % Y_PIXELS; +} + +void gamecom_state::video_start() +{ + m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_scanline),this)); + m_scanline_timer->adjust( machine().first_screen()->time_until_pos(0 ), 0, machine().first_screen()->scan_period() ); + machine().first_screen()->register_screen_bitmap(m_bitmap); +} diff --git a/src/mame/video/gb_lcd.c b/src/mame/video/gb_lcd.c new file mode 100644 index 00000000000..b46aece5a15 --- /dev/null +++ b/src/mame/video/gb_lcd.c @@ -0,0 +1,2852 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + gb_lcd.c + + Video file to handle emulation of the Nintendo Game Boy. + + Original code Carsten Sorensen 1998 + Mess modifications, bug fixes and speedups Hans de Goede 1998 + Bug fixes, SGB and GBC code Anthony Kruize 2002 + Improvements to match real hardware Wilbert Pol 2006-2008 + + Timing is not accurate enough: + - Mode 3 takes 172 cycles (measuered with logic analyzer by costis) + +***************************************************************************/ + +#include "emu.h" +//#include "cpu/lr35902/lr35902.h" +#include "video/gb_lcd.h" + +/* Interrupts (copied from includes/gb.h)... */ +#define VBL_INT 0 /* V-Blank */ +#define LCD_INT 1 /* LCD Status */ +#define TIM_INT 2 /* Timer */ +#define SIO_INT 3 /* Serial I/O */ +#define EXT_INT 4 /* Joypad */ + + + +#define LCDCONT m_vid_regs[0x00] /* LCD control register */ +#define LCDSTAT m_vid_regs[0x01] /* LCD status register */ +#define SCROLLY m_vid_regs[0x02] /* Starting Y position of the background */ +#define SCROLLX m_vid_regs[0x03] /* Starting X position of the background */ +#define CURLINE m_vid_regs[0x04] /* Current screen line being scanned */ +#define CMPLINE m_vid_regs[0x05] /* Gen. int. when scan reaches this line */ +#define BGRDPAL m_vid_regs[0x07] /* Background palette */ +#define SPR0PAL m_vid_regs[0x08] /* Sprite palette #0 */ +#define SPR1PAL m_vid_regs[0x09] /* Sprite palette #1 */ +#define WNDPOSY m_vid_regs[0x0A] /* Window Y position */ +#define WNDPOSX m_vid_regs[0x0B] /* Window X position */ +#define KEY1 m_vid_regs[0x0D] /* Prepare speed switch */ +#define HDMA1 m_vid_regs[0x11] /* HDMA source high byte */ +#define HDMA2 m_vid_regs[0x12] /* HDMA source low byte */ +#define HDMA3 m_vid_regs[0x13] /* HDMA destination high byte */ +#define HDMA4 m_vid_regs[0x14] /* HDMA destination low byte */ +#define HDMA5 m_vid_regs[0x15] /* HDMA length/mode/start */ +#define GBCBCPS m_vid_regs[0x28] /* Backgound palette spec */ +#define GBCBCPD m_vid_regs[0x29] /* Backgound palette data */ +#define GBCOCPS m_vid_regs[0x2A] /* Object palette spec */ +#define GBCOCPD m_vid_regs[0x2B] /* Object palette data */ + +/* -- Super Game Boy specific -- */ +#define SGB_BORDER_PAL_OFFSET 64 /* Border colours stored from pal 4-7 */ +#define SGB_XOFFSET 48 /* GB screen starts at column 48 */ +#define SGB_YOFFSET 40 /* GB screen starts at row 40 */ + + +enum { + UNLOCKED=0, + LOCKED +}; + + +enum { + GB_LCD_STATE_LYXX_M3=1, + GB_LCD_STATE_LYXX_PRE_M0, + GB_LCD_STATE_LYXX_M0, + GB_LCD_STATE_LYXX_M0_SCX3, + GB_LCD_STATE_LYXX_M0_GBC_PAL, + GB_LCD_STATE_LYXX_M0_PRE_INC, + GB_LCD_STATE_LYXX_M0_INC, + GB_LCD_STATE_LY00_M2, + GB_LCD_STATE_LYXX_M2, + GB_LCD_STATE_LY9X_M1, + GB_LCD_STATE_LY9X_M1_INC, + GB_LCD_STATE_LY00_M1, + GB_LCD_STATE_LY00_M1_1, + GB_LCD_STATE_LY00_M1_2, + GB_LCD_STATE_LY00_M0 +}; + + +/* OAM contents on power up. + + The OAM area seems contain some kind of unit fingerprint. On each boot + the data is almost always the same. Some random bits are flipped between + different boots. It is currently unknown how much these fingerprints + differ between different units. + + OAM fingerprints taken from Wilbert Pol's own unit. + */ + +static const UINT8 dmg_oam_fingerprint[0x100] = { + 0xD8, 0xE6, 0xB3, 0x89, 0xEC, 0xDE, 0x11, 0x62, 0x0B, 0x7E, 0x48, 0x9E, 0xB9, 0x6E, 0x26, 0xC9, + 0x36, 0xF4, 0x7D, 0xE4, 0xD9, 0xCE, 0xFA, 0x5E, 0xA3, 0x77, 0x60, 0xFC, 0x1C, 0x64, 0x8B, 0xAC, + 0xB6, 0x74, 0x3F, 0x9A, 0x0E, 0xFE, 0xEA, 0xA9, 0x40, 0x3A, 0x7A, 0xB6, 0xF2, 0xED, 0xA8, 0x3E, + 0xAF, 0x2C, 0xD2, 0xF2, 0x01, 0xE0, 0x5B, 0x3A, 0x53, 0x6A, 0x1C, 0x6C, 0x20, 0xD9, 0x22, 0xB4, + 0x8C, 0x38, 0x71, 0x69, 0x3E, 0x93, 0xA3, 0x22, 0xCE, 0x76, 0x24, 0xE7, 0x1A, 0x14, 0x6B, 0xB1, + 0xF9, 0x3D, 0xBF, 0x3D, 0x74, 0x64, 0xCB, 0xF5, 0xDC, 0x9A, 0x53, 0xC6, 0x0E, 0x78, 0x34, 0xCB, + 0x42, 0xB3, 0xFF, 0x07, 0x73, 0xAE, 0x6C, 0xA2, 0x6F, 0x6A, 0xA4, 0x66, 0x0A, 0x8C, 0x40, 0xB3, + 0x9A, 0x3D, 0x39, 0x78, 0xAB, 0x29, 0xE7, 0xC5, 0x7A, 0xDD, 0x51, 0x95, 0x2B, 0xE4, 0x1B, 0xF6, + 0x31, 0x16, 0x34, 0xFE, 0x11, 0xF2, 0x5E, 0x11, 0xF3, 0x95, 0x66, 0xB9, 0x37, 0xC2, 0xAD, 0x6D, + 0x1D, 0xA7, 0x79, 0x06, 0xD7, 0xE5, 0x8F, 0xFA, 0x9C, 0x02, 0x0C, 0x31, 0x8B, 0x17, 0x2E, 0x31, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const UINT8 mgb_oam_fingerprint[0x100] = { + 0xB9, 0xE9, 0x0D, 0x69, 0xBB, 0x7F, 0x00, 0x80, 0xE9, 0x7B, 0x79, 0xA2, 0xFD, 0xCF, 0xD8, 0x0A, + 0x87, 0xEF, 0x44, 0x11, 0xFE, 0x37, 0x10, 0x21, 0xFA, 0xFF, 0x00, 0x17, 0xF6, 0x4F, 0x83, 0x03, + 0x3A, 0xF4, 0x00, 0x24, 0xBB, 0xAE, 0x05, 0x01, 0xFF, 0xF7, 0x12, 0x48, 0xA7, 0x5E, 0xF6, 0x28, + 0x5B, 0xFF, 0x2E, 0x10, 0xFF, 0xB9, 0x50, 0xC8, 0xAF, 0x77, 0x2C, 0x1A, 0x62, 0xD7, 0x81, 0xC2, + 0xFD, 0x5F, 0xA0, 0x94, 0xAF, 0xFF, 0x51, 0x20, 0x36, 0x76, 0x50, 0x0A, 0xFD, 0xF6, 0x20, 0x00, + 0xFE, 0xF7, 0xA0, 0x68, 0xFF, 0xFC, 0x29, 0x51, 0xA3, 0xFA, 0x06, 0xC4, 0x94, 0xFF, 0x39, 0x0A, + 0xFF, 0x6C, 0x20, 0x20, 0xF1, 0xAD, 0x0C, 0x81, 0x56, 0xFB, 0x03, 0x82, 0xFF, 0xFF, 0x08, 0x58, + 0x96, 0x7E, 0x01, 0x4D, 0xFF, 0xE4, 0x82, 0xE3, 0x3D, 0xBB, 0x54, 0x00, 0x3D, 0xF3, 0x04, 0x21, + 0xB7, 0x39, 0xCC, 0x10, 0xF9, 0x5B, 0x80, 0x50, 0x3F, 0x6A, 0x1C, 0x21, 0x1F, 0xFA, 0xA8, 0x52, + 0x5F, 0xB3, 0x44, 0xA1, 0x96, 0x1E, 0x00, 0x27, 0x63, 0x77, 0x30, 0x54, 0x37, 0x6F, 0x60, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const UINT8 cgb_oam_fingerprint[0x100] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0xFF, 0x09, 0x00, 0x9D, 0x61, 0xA8, 0x28, 0x36, 0x1E, 0x58, 0xAA, 0x75, 0x74, 0xA1, 0x42, + 0x05, 0x96, 0x40, 0x09, 0x41, 0x02, 0x60, 0x00, 0x1F, 0x11, 0x22, 0xBC, 0x31, 0x52, 0x22, 0x54, + 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04, + 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04, + 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04, + 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04 +}; + +/* + For an AGS in CGB mode this data is: */ +#if 0 +static const UINT8 abs_oam_fingerprint[0x100] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, + 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, + 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, + 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +}; +#endif + + +const device_type GB_LCD_DMG = &device_creator; +const device_type GB_LCD_MGB = &device_creator; +const device_type GB_LCD_SGB = &device_creator; +const device_type GB_LCD_CGB = &device_creator; + + + +gb_lcd_device::gb_lcd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_video_interface(mconfig, *this), + m_sgb_border_hack(0) +{ +} + +gb_lcd_device::gb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GB_LCD_DMG, "DMG LCD", tag, owner, clock, "dmg_lcd", __FILE__), + device_video_interface(mconfig, *this), + m_sgb_border_hack(0) +{ +} + +mgb_lcd_device::mgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : gb_lcd_device(mconfig, GB_LCD_MGB, "MGB LCD", tag, owner, clock, "mgb_lcd", __FILE__) +{ +} + +sgb_lcd_device::sgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : gb_lcd_device(mconfig, GB_LCD_SGB, "SGB LCD", tag, owner, clock, "sgb_lcd", __FILE__) +{ +} + +cgb_lcd_device::cgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : gb_lcd_device(mconfig, GB_LCD_CGB, "CGB LCD", tag, owner, clock, "cgb_lcd", __FILE__) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gb_lcd_device::common_start() +{ + m_screen->register_screen_bitmap(m_bitmap); + save_item(NAME(m_bitmap)); + m_oam = auto_alloc_array_clear(machine(), UINT8, 0x100); + + machine().save().register_postload(save_prepost_delegate(FUNC(gb_lcd_device::videoptr_restore), this)); + + m_maincpu = machine().device("maincpu"); + + save_pointer(NAME(m_oam), 0x100); + save_item(NAME(m_window_lines_drawn)); + save_item(NAME(m_vid_regs)); + save_item(NAME(m_bg_zbuf)); + + save_item(NAME(m_cgb_bpal)); + save_item(NAME(m_cgb_spal)); + + save_item(NAME(m_gb_bpal)); + save_item(NAME(m_gb_spal0)); + save_item(NAME(m_gb_spal1)); + + save_item(NAME(m_current_line)); + save_item(NAME(m_cmp_line)); + save_item(NAME(m_sprCount)); + save_item(NAME(m_sprite)); + save_item(NAME(m_previous_line)); + save_item(NAME(m_start_x)); + save_item(NAME(m_end_x)); + save_item(NAME(m_mode)); + save_item(NAME(m_state)); + save_item(NAME(m_lcd_irq_line)); + save_item(NAME(m_triggering_line_irq)); + save_item(NAME(m_line_irq)); + save_item(NAME(m_triggering_mode_irq)); + save_item(NAME(m_mode_irq)); + save_item(NAME(m_delayed_line_irq)); + save_item(NAME(m_sprite_cycles)); + save_item(NAME(m_scrollx_adjust)); + save_item(NAME(m_oam_locked)); + save_item(NAME(m_vram_locked)); + save_item(NAME(m_pal_locked)); + save_item(NAME(m_hdma_enabled)); + save_item(NAME(m_hdma_possible)); + save_item(NAME(m_gbc_mode)); + save_item(NAME(m_gb_tile_no_mod)); + save_item(NAME(m_vram_bank)); + + save_item(NAME(m_gb_chrgen_offs)); + save_item(NAME(m_gb_bgdtab_offs)); + save_item(NAME(m_gb_wndtab_offs)); + save_item(NAME(m_gbc_chrgen_offs)); + save_item(NAME(m_gbc_bgdtab_offs)); + save_item(NAME(m_gbc_wndtab_offs)); + + save_item(NAME(m_layer[0].enabled)); + save_item(NAME(m_layer[0].xindex)); + save_item(NAME(m_layer[0].xshift)); + save_item(NAME(m_layer[0].xstart)); + save_item(NAME(m_layer[0].xend)); + save_item(NAME(m_layer[0].bgline)); + save_item(NAME(m_layer[1].enabled)); + save_item(NAME(m_layer[1].xindex)); + save_item(NAME(m_layer[1].xshift)); + save_item(NAME(m_layer[1].xstart)); + save_item(NAME(m_layer[1].xend)); + save_item(NAME(m_layer[1].bgline)); +} + + +void gb_lcd_device::videoptr_restore() +{ + m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; + m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; + m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; +} + +void cgb_lcd_device::videoptr_restore() +{ + m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; + m_layer[0].gbc_map = m_vram + m_gbc_bgdtab_offs; + m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; + m_layer[1].gbc_map = m_vram + m_gbc_wndtab_offs; +} + + +void gb_lcd_device::device_start() +{ + common_start(); + m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_lcd_device::lcd_timer_proc),this)); + + m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); + save_pointer(NAME(m_vram), 0x2000); + + memcpy(m_oam, dmg_oam_fingerprint, 0x100); +} + +void mgb_lcd_device::device_start() +{ + common_start(); + m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mgb_lcd_device::lcd_timer_proc),this)); + + m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); + save_pointer(NAME(m_vram), 0x2000); + + memcpy(m_oam, mgb_oam_fingerprint, 0x100); +} + +void sgb_lcd_device::device_start() +{ + common_start(); + m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sgb_lcd_device::lcd_timer_proc),this)); + + m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); + save_pointer(NAME(m_vram), 0x2000); + + m_sgb_tile_data = auto_alloc_array_clear(machine(), UINT8, 0x2000); + save_pointer(NAME(m_sgb_tile_data), 0x2000); + + memset(m_sgb_tile_map, 0, sizeof(m_sgb_tile_map)); + + /* Some default colours for non-SGB games */ + m_sgb_pal[0] = 32767; + m_sgb_pal[1] = 21140; + m_sgb_pal[2] = 10570; + m_sgb_pal[3] = 0; + /* The rest of the colortable can be black */ + for (int i = 4; i < 8 * 16; i++) + m_sgb_pal[i] = 0; + + save_item(NAME(m_sgb_atf_data)); + save_item(NAME(m_sgb_atf)); + save_item(NAME(m_sgb_pal_data)); + save_item(NAME(m_sgb_pal_map)); + save_item(NAME(m_sgb_pal)); + save_item(NAME(m_sgb_tile_map)); + save_item(NAME(m_sgb_window_mask)); +} + +void cgb_lcd_device::device_start() +{ + common_start(); + m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cgb_lcd_device::lcd_timer_proc),this)); + + m_vram = auto_alloc_array_clear(machine(), UINT8, 0x4000); + save_pointer(NAME(m_vram), 0x4000); + + memcpy(m_oam, cgb_oam_fingerprint, 0x100); + + /* Background is initialised as white */ + for (int i = 0; i < 32; i++) + m_cgb_bpal[i] = 32767; + /* Sprites are supposed to be uninitialized, but we'll make them black */ + for (int i = 0; i < 32; i++) + m_cgb_spal[i] = 0; +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void gb_lcd_device::common_reset() +{ + m_window_lines_drawn = 0; + + m_current_line = 0; + m_cmp_line = 0; + m_sprCount = 0; + m_previous_line = 0; + m_start_x = 0; + m_end_x = 0; + m_mode = 0; + m_state = 0; + m_lcd_irq_line = 0; + m_triggering_line_irq = 0; + m_line_irq = 0; + m_triggering_mode_irq = 0; + m_mode_irq = 0; + m_delayed_line_irq = 0; + m_sprite_cycles = 0; + m_scrollx_adjust = 0; + m_oam_locked = 0; + m_vram_locked = 0; + m_pal_locked = 0; + m_gbc_mode = 0; + m_gb_tile_no_mod = 0; + m_vram_bank = 0; + + m_gb_chrgen_offs = 0; + m_gb_bgdtab_offs = 0x1c00; + m_gb_wndtab_offs = 0x1c00; + + memset(&m_vid_regs, 0, sizeof(m_vid_regs)); + memset(&m_bg_zbuf, 0, sizeof(m_bg_zbuf)); + memset(&m_cgb_bpal, 0, sizeof(m_cgb_bpal)); + memset(&m_cgb_spal, 0, sizeof(m_cgb_spal)); + memset(&m_sprite, 0, sizeof(m_sprite)); + memset(&m_layer[0], 0, sizeof(m_layer[0])); + memset(&m_layer[1], 0, sizeof(m_layer[1])); + + // specific reg initialization + m_vid_regs[0x06] = 0xff; + + for (int i = 0x0c; i < _NR_GB_VID_REGS; i++) + m_vid_regs[i] = 0xff; + + LCDSTAT = 0x80; + LCDCONT = 0x00; /* Video hardware is turned off at boot time */ + m_current_line = CURLINE = CMPLINE = 0x00; + SCROLLX = SCROLLY = 0x00; + SPR0PAL = SPR1PAL = 0xFF; + WNDPOSX = WNDPOSY = 0x00; + + // Initialize palette arrays + for (int i = 0; i < 4; i++) + m_gb_bpal[i] = m_gb_spal0[i] = m_gb_spal1[i] = i; + +} + + +void gb_lcd_device::device_reset() +{ + common_reset(); + + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(456)); +} + +void sgb_lcd_device::device_reset() +{ + common_reset(); + + memset(m_sgb_tile_data, 0, 0x2000); + + m_sgb_window_mask = 0; + + memset(m_sgb_pal_map, 0, sizeof(m_sgb_pal_map)); + memset(m_sgb_atf_data, 0, sizeof(m_sgb_atf_data)); +} + +void cgb_lcd_device::device_reset() +{ + common_reset(); + + m_gbc_chrgen_offs = 0x2000; + m_gbc_bgdtab_offs = 0x3c00; + m_gbc_wndtab_offs = 0x3c00; + + /* HDMA disabled */ + m_hdma_enabled = 0; + m_hdma_possible = 0; + + m_gbc_mode = 1; +} + + + +inline void gb_lcd_device::plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix16(y, x) = (UINT16)color; +} + +/* + Select which sprites should be drawn for the current scanline and return the + number of sprites selected. + */ +void gb_lcd_device::select_sprites() +{ + int /*yindex,*/ line, height; + UINT8 *oam = m_oam + 39 * 4; + + m_sprCount = 0; + + /* If video hardware is enabled and sprites are enabled */ + if ((LCDCONT & 0x80) && (LCDCONT & 0x02)) + { + /* Check for stretched sprites */ + if (LCDCONT & 0x04) + height = 16; + else + height = 8; + + //yindex = m_current_line; + line = m_current_line + 16; + + for (int i = 39; i >= 0; i--) + { + if (line >= oam[0] && line < (oam[0] + height) && oam[1] && oam[1] < 168) + { + /* We limit the sprite count to max 10 here; + proper games should not exceed this... */ + if (m_sprCount < 10) + { + m_sprite[m_sprCount] = i; + m_sprCount++; + } + } + oam -= 4; + } + } +} + +void gb_lcd_device::update_sprites() +{ + bitmap_ind16 &bitmap = m_bitmap; + UINT8 height, tilemask, line, *oam, *vram; + int yindex; + + if (LCDCONT & 0x04) + { + height = 16; + tilemask = 0xFE; + } + else + { + height = 8; + tilemask = 0xFF; + } + + yindex = m_current_line; + line = m_current_line + 16; + + oam = m_oam + 39 * 4; + vram = m_vram; + for (int i = 39; i >= 0; i--) + { + /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ + if (line >= oam[0] && line < (oam[0] + height) && oam[1] && oam[1] < 168) + { + UINT16 data; + UINT8 bit, *spal; + int xindex, adr; + + spal = (oam[3] & 0x10) ? m_gb_spal1 : m_gb_spal0; + xindex = oam[1] - 8; + if (oam[3] & 0x40) /* flip y ? */ + { + adr = (oam[2] & tilemask) * 16 + (height - 1 - line + oam[0]) * 2; + } + else + { + adr = (oam[2] & tilemask) * 16 + (line - oam[0]) * 2; + } + data = (vram[adr + 1] << 8) | vram[adr]; + + switch (oam[3] & 0xA0) + { + case 0xA0: /* priority is set (behind bgnd & wnd, flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); + if (colour && !m_bg_zbuf[xindex] && xindex >= 0 && xindex < 160) + plot_pixel(bitmap, xindex, yindex, spal[colour]); + data >>= 1; + } + break; + case 0x20: /* priority is not set (overlaps bgnd & wnd, flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); + if (colour && xindex >= 0 && xindex < 160) + plot_pixel(bitmap, xindex, yindex, spal[colour]); + data >>= 1; + } + break; + case 0x80: /* priority is set (behind bgnd & wnd, don't flip x) */ + for (bit = 0; bit < 8 && xindex < 160; bit++, xindex++) + { + register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + if (colour && !m_bg_zbuf[xindex] && xindex >= 0 && xindex < 160) + plot_pixel(bitmap, xindex, yindex, spal[colour]); + data <<= 1; + } + break; + case 0x00: /* priority is not set (overlaps bgnd & wnd, don't flip x) */ + for (bit = 0; bit < 8 && xindex < 160; bit++, xindex++) + { + register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + if (colour && xindex >= 0 && xindex < 160) + plot_pixel(bitmap, xindex, yindex, spal[colour]); + data <<= 1; + } + break; + } + } + oam -= 4; + } +} + +void gb_lcd_device::update_scanline() +{ + bitmap_ind16 &bitmap = m_bitmap; + + g_profiler.start(PROFILER_VIDEO); + + /* Make sure we're in mode 3 */ + if ((LCDSTAT & 0x03) == 0x03) + { + /* Calculate number of pixels to render based on time still left on the timer */ + UINT32 cycles_to_go = m_maincpu->attotime_to_cycles(m_lcd_timer->remaining()); + int l = 0; + + if (m_start_x < 0) + { + /* Window is enabled if the hardware says so AND the current scanline is + * within the window AND the window X coordinate is <=166 */ + m_layer[1].enabled = ((LCDCONT & 0x20) && (m_current_line >= WNDPOSY) && (WNDPOSX <= 166)) ? 1 : 0; + + /* BG is enabled if the hardware says so AND (window_off OR (window_on + * AND window's X position is >=7)) */ + m_layer[0].enabled = ((LCDCONT & 0x01) && ((!m_layer[1].enabled) || (m_layer[1].enabled && (WNDPOSX >= 7)))) ? 1 : 0; + + if (m_layer[0].enabled) + { + m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; + m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; + m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[0].xindex = SCROLLX >> 3; + m_layer[0].xshift = SCROLLX & 7; + m_layer[0].xstart = 0; + m_layer[0].xend = 160; + } + + if (m_layer[1].enabled) + { + int xpos = WNDPOSX - 7; /* Window is offset by 7 pixels */ + if (xpos < 0) + xpos = 0; + + m_layer[1].bgline = m_window_lines_drawn; + m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; + m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[1].xindex = 0; + m_layer[1].xshift = 0; + m_layer[1].xstart = xpos; + m_layer[1].xend = 160; + m_layer[0].xend = xpos; + } + m_start_x = 0; + } + + if (cycles_to_go < 160) + { + m_end_x = MIN(160 - cycles_to_go, 160); + /* Draw empty pixels when the background is disabled */ + if (!(LCDCONT & 0x01)) + { + rectangle r(m_start_x, m_end_x - 1, m_current_line, m_current_line); + bitmap.fill(m_gb_bpal[0], r); + } + while (l < 2) + { + UINT8 xindex, *map, *tiles; + UINT16 data; + int i, tile_index; + + if (!m_layer[l].enabled) + { + l++; + continue; + } + map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); + tiles = m_layer[l].bg_tiles + ((m_layer[l].bgline & 7) << 1); + xindex = m_start_x; + if (xindex < m_layer[l].xstart) + xindex = m_layer[l].xstart; + i = m_end_x; + if (i > m_layer[l].xend) + i = m_layer[l].xend; + i = i - xindex; + + tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; + data = tiles[tile_index] | (tiles[tile_index+1] << 8); + data <<= m_layer[l].xshift; + + while (i > 0) + { + while ((m_layer[l].xshift < 8) && i) + { + register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + plot_pixel(bitmap, xindex, m_current_line, m_gb_bpal[colour]); + m_bg_zbuf[xindex] = colour; + xindex++; + data <<= 1; + m_layer[l].xshift++; + i--; + } + if (m_layer[l].xshift == 8) + { + /* Take possible changes to SCROLLY into account */ + if (l == 0) + { + m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; + map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); + tiles = m_layer[l].bg_tiles + ((m_layer[l].bgline & 7) << 1); + } + + m_layer[l].xindex = (m_layer[l].xindex + 1) & 31; + m_layer[l].xshift = 0; + tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; + data = tiles[tile_index] | (tiles[tile_index + 1] << 8); + } + } + l++; + } + if (m_end_x == 160 && LCDCONT & 0x02) + { + update_sprites(); + } + m_start_x = m_end_x; + } + } + else + { + if (!(LCDCONT & 0x80)) + { + /* Draw an empty line when LCD is disabled */ + if (m_previous_line != m_current_line) + { + if (m_current_line < 144) + { + const rectangle &r = m_screen->visible_area(); + rectangle r1(r.min_x, r.max_x, m_current_line, m_current_line); + bitmap.fill(0, r1); + } + m_previous_line = m_current_line; + } + } + } + + g_profiler.stop(); +} + +/* --- Super Game Boy Specific --- */ + +void sgb_lcd_device::update_sprites() +{ + bitmap_ind16 &bitmap = m_bitmap; + UINT8 height, tilemask, line, *oam, *vram, pal; + INT16 yindex; + + if (LCDCONT & 0x04) + { + height = 16; + tilemask = 0xFE; + } + else + { + height = 8; + tilemask = 0xFF; + } + + /* Offset to center of screen */ + yindex = m_current_line + SGB_YOFFSET; + line = m_current_line + 16; + + oam = m_oam + 39 * 4; + vram = m_vram; + for (int i = 39; i >= 0; i--) + { + /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ + if (line >= oam[0] && line < (oam[0] + height) && oam[1] && oam[1] < 168) + { + UINT16 data; + UINT8 bit, *spal; + INT16 xindex; + int adr; + + spal = (oam[3] & 0x10) ? m_gb_spal1 : m_gb_spal0; + xindex = oam[1] - 8; + if (oam[3] & 0x40) /* flip y ? */ + { + adr = (oam[2] & tilemask) * 16 + (height - 1 - line + oam[0]) * 2; + } + else + { + adr = (oam[2] & tilemask) * 16 + (line - oam[0]) * 2; + } + data = (vram[adr + 1] << 8) | vram[adr]; + + /* Find the palette to use */ + // If sprite started before the start of the line we may need to pick a different pal_map entry? + pal = m_sgb_pal_map[(xindex < 0) ? 0 : (xindex >> 3)][((yindex - SGB_YOFFSET) >> 3)] << 2; + + /* Offset to center of screen */ + xindex += SGB_XOFFSET; + + switch (oam[3] & 0xA0) + { + case 0xA0: /* priority is set (behind bgnd & wnd, flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); + if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour && !m_bg_zbuf[xindex - SGB_XOFFSET]) + plot_pixel(bitmap, xindex, yindex, m_sgb_pal[pal + spal[colour]]); + data >>= 1; + } + break; + case 0x20: /* priority is not set (overlaps bgnd & wnd, flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); + if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour) + plot_pixel(bitmap, xindex, yindex, m_sgb_pal[pal + spal[colour]]); + data >>= 1; + } + break; + case 0x80: /* priority is set (behind bgnd & wnd, don't flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour && !m_bg_zbuf[xindex - SGB_XOFFSET]) + plot_pixel(bitmap, xindex, yindex, m_sgb_pal[pal + spal[colour]]); + data <<= 1; + } + break; + case 0x00: /* priority is not set (overlaps bgnd & wnd, don't flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour) + plot_pixel(bitmap, xindex, yindex, m_sgb_pal[pal + spal[colour]]); + data <<= 1; + } + break; + } + } + oam -= 4; + } +} + + +void sgb_lcd_device::refresh_border() +{ + UINT16 data, data2; + UINT8 *tiles, *tiles2; + + for (UINT16 yidx = 0; yidx < 224; yidx++) + { + UINT8 *map = m_sgb_tile_map + ((yidx >> 3) * 64); + UINT16 xindex = 0; + + for (UINT16 xidx = 0; xidx < 64; xidx += 2) + { + if (map[xidx + 1] & 0x80) /* Vertical flip */ + tiles = m_sgb_tile_data + ((7 - (yidx % 8)) << 1); + else /* No vertical flip */ + tiles = m_sgb_tile_data + ((yidx % 8) << 1); + tiles2 = tiles + 16; + + UINT8 pal = (map[xidx + 1] & 0x1C) >> 2; + if (pal == 0) + pal = 1; + pal <<= 4; + + if (m_sgb_border_hack) + { /* A few games do weird stuff */ + UINT8 tileno = map[xidx]; + if (tileno >= 128) tileno = ((64 + tileno) % 128) + 128; + else tileno = (64 + tileno) % 128; + data = tiles[tileno * 32] | (tiles[(tileno * 32) + 1] << 8); + data2 = tiles2[tileno * 32] | (tiles2[(tileno * 32) + 1] << 8); + } + else + { + data = tiles[map[xidx] * 32] | (tiles[(map[xidx] * 32) + 1] << 8); + data2 = tiles2[map[xidx] * 32] | (tiles2[(map[xidx] * 32) + 1] << 8); + } + + for (int i = 0; i < 8; i++) + { + register UINT8 colour; + if ((map[xidx + 1] & 0x40)) /* Horizontal flip */ + { + colour = ((data & 0x0001) ? 1 : 0) | ((data & 0x0100) ? 2 : 0) | + ((data2 & 0x0001) ? 4 : 0) | ((data2 & 0x0100) ? 8 : 0); + data >>= 1; + data2 >>= 1; + } + else /* No horizontal flip */ + { + colour = ((data & 0x0080) ? 1 : 0) | ((data & 0x8000) ? 2 : 0) | + ((data2 & 0x0080) ? 4 : 0) | ((data2 & 0x8000) ? 8 : 0); + data <<= 1; + data2 <<= 1; + } + /* A slight hack below so we don't draw over the GB screen. + * Drawing there is allowed, but due to the way we draw the + * scanline, it can obscure the screen even when it shouldn't. + */ + if (!((yidx >= SGB_YOFFSET && yidx < SGB_YOFFSET + 144) && + (xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160))) + { + plot_pixel(m_bitmap, xindex, yidx, m_sgb_pal[pal + colour]); + } + xindex++; + } + } + } +} + +void sgb_lcd_device::update_scanline() +{ + bitmap_ind16 &bitmap = m_bitmap; + + g_profiler.start(PROFILER_VIDEO); + + if ((LCDSTAT & 0x03) == 0x03) + { + /* Calcuate number of pixels to render based on time still left on the timer */ + UINT32 cycles_to_go = m_maincpu->attotime_to_cycles(m_lcd_timer->remaining()); + int l = 0; + + if (m_start_x < 0) + { + /* Window is enabled if the hardware says so AND the current scanline is + * within the window AND the window X coordinate is <=166 */ + m_layer[1].enabled = ((LCDCONT & 0x20) && m_current_line >= WNDPOSY && WNDPOSX <= 166) ? 1 : 0; + + /* BG is enabled if the hardware says so AND (window_off OR (window_on + * AND window's X position is >=7 )) */ + m_layer[0].enabled = ((LCDCONT & 0x01) && ((!m_layer[1].enabled) || (m_layer[1].enabled && WNDPOSX >= 7))) ? 1 : 0; + + if (m_layer[0].enabled) + { + m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; + m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; + m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[0].xindex = SCROLLX >> 3; + m_layer[0].xshift = SCROLLX & 7; + m_layer[0].xstart = 0; + m_layer[0].xend = 160; + } + + if (m_layer[1].enabled) + { + int xpos; + + /* Window X position is offset by 7 so we'll need to adjust */ + xpos = WNDPOSX - 7; + if (xpos < 0) + xpos = 0; + + m_layer[1].bgline = m_window_lines_drawn; + m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; + m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[1].xindex = 0; + m_layer[1].xshift = 0; + m_layer[1].xstart = xpos; + m_layer[1].xend = 160; + m_layer[0].xend = xpos; + } + m_start_x = 0; + } + + if (cycles_to_go == 0) + { + /* Does this belong here? or should it be moved to the else block */ + /* Handle SGB mask */ + switch (m_sgb_window_mask) + { + case 1: /* Freeze screen */ + return; + case 2: /* Blank screen (black) */ + { + rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160-1, SGB_YOFFSET, SGB_YOFFSET + 144 - 1); + bitmap.fill(0, r); + } + return; + case 3: /* Blank screen (white - or should it be color 0?) */ + { + rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, SGB_YOFFSET, SGB_YOFFSET + 144 - 1); + bitmap.fill(32767, r); + } + return; + } + + /* Draw the "border" if we're on the first line */ + if (m_current_line == 0) + { + refresh_border(); + } + } + if (cycles_to_go < 160) + { + m_end_x = MIN(160 - cycles_to_go,160); + + /* if background or screen disabled clear line */ + if (!(LCDCONT & 0x01)) + { + rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, m_current_line + SGB_YOFFSET, m_current_line + SGB_YOFFSET); + bitmap.fill(0, r); + } + while (l < 2) + { + UINT8 xindex, sgb_palette, *map, *tiles; + UINT16 data; + int i, tile_index; + + if (!m_layer[l].enabled) + { + l++; + continue; + } + map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); + tiles = m_layer[l].bg_tiles + ((m_layer[l].bgline & 7) << 1); + xindex = m_start_x; + if (xindex < m_layer[l].xstart) + xindex = m_layer[l].xstart; + i = m_end_x; + if (i > m_layer[l].xend) + i = m_layer[l].xend; + i = i - xindex; + + tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; + data = tiles[tile_index] | (tiles[tile_index + 1] << 8); + data <<= m_layer[l].xshift; + + while (i > 0) + { + /* Figure out which palette we're using */ + assert(((m_end_x - i) >> 3) >= 0 && ((m_end_x - i) >> 3) < ARRAY_LENGTH(m_sgb_pal_map)); + sgb_palette = m_sgb_pal_map[(m_end_x - i) >> 3][m_current_line >> 3] << 2; + + while ((m_layer[l].xshift < 8) && i) + { + register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + plot_pixel(bitmap, xindex + SGB_XOFFSET, m_current_line + SGB_YOFFSET, m_sgb_pal[sgb_palette + m_gb_bpal[colour]]); + m_bg_zbuf[xindex] = colour; + xindex++; + data <<= 1; + m_layer[l].xshift++; + i--; + } + if (m_layer[l].xshift == 8) + { + /* Take possible changes to SCROLLY into account */ + if (l == 0) + { + m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; + map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); + tiles = m_layer[l].bg_tiles + ((m_layer[l].bgline & 7) << 1); + } + + m_layer[l].xindex = (m_layer[l].xindex + 1) & 31; + m_layer[l].xshift = 0; + tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; + data = tiles[tile_index] | (tiles[tile_index + 1] << 8); + } + } + l++; + } + if ((m_end_x == 160) && (LCDCONT & 0x02)) + { + update_sprites(); + } + m_start_x = m_end_x; + } + } + else + { + if (!(LCDCONT * 0x80)) + { + /* if screen disabled clear line */ + if (m_previous_line != m_current_line) + { + /* Also refresh border here??? */ + if (m_current_line < 144) + { + rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, m_current_line + SGB_YOFFSET, m_current_line + SGB_YOFFSET); + bitmap.fill(0, r); + } + m_previous_line = m_current_line; + } + } + } + + g_profiler.stop(); +} + +/* --- Game Boy Color Specific --- */ + +void cgb_lcd_device::update_sprites() +{ + bitmap_ind16 &bitmap = m_bitmap; + UINT8 height, tilemask, line, *oam; + int xindex, yindex; + + if (LCDCONT & 0x04) + { + height = 16; + tilemask = 0xFE; + } + else + { + height = 8; + tilemask = 0xFF; + } + + yindex = m_current_line; + line = m_current_line + 16; + + oam = m_oam + 39 * 4; + for (int i = 39; i >= 0; i--) + { + /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ + if (line >= oam[0] && line < (oam[0] + height) && oam[1] && oam[1] < 168) + { + UINT16 data; + UINT8 bit, pal; + + /* Handle mono mode for GB games */ + if (!m_gbc_mode) + pal = (oam[3] & 0x10) ? 4 : 0; + else + pal = ((oam[3] & 0x7) * 4); + + xindex = oam[1] - 8; + if (oam[3] & 0x40) /* flip y ? */ + { + data = *((UINT16 *) &m_vram[((oam[3] & 0x8)<<10) + (oam[2] & tilemask) * 16 + (height - 1 - line + oam[0]) * 2]); + } + else + { + data = *((UINT16 *) &m_vram[((oam[3] & 0x8)<<10) + (oam[2] & tilemask) * 16 + (line - oam[0]) * 2]); + } + + data = LITTLE_ENDIANIZE_INT16(data); + + switch (oam[3] & 0xA0) + { + case 0xA0: /* priority is set (behind bgnd & wnd, flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); + if (colour && !m_bg_zbuf[xindex] && xindex >= 0 && xindex < 160) + { + if (!m_gbc_mode) + colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour]; + plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]); + } + data >>= 1; + } + break; + case 0x20: /* priority is not set (overlaps bgnd & wnd, flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); + if ((m_bg_zbuf[xindex] & 0x80) && (m_bg_zbuf[xindex] & 0x7f) && (LCDCONT & 0x1)) + colour = 0; + if (colour && xindex >= 0 && xindex < 160) + { + if (!m_gbc_mode) + colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour]; + plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]); + } + data >>= 1; + } + break; + case 0x80: /* priority is set (behind bgnd & wnd, don't flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + if (colour && !m_bg_zbuf[xindex] && xindex >= 0 && xindex < 160) + { + if (!m_gbc_mode) + colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour]; + plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]); + } + data <<= 1; + } + break; + case 0x00: /* priority is not set (overlaps bgnd & wnd, don't flip x) */ + for (bit = 0; bit < 8; bit++, xindex++) + { + if (xindex >= 0 && xindex < 160) + { + register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + if ((m_bg_zbuf[xindex] & 0x80) && (m_bg_zbuf[xindex] & 0x7f) && (LCDCONT & 0x1)) + colour = 0; + if (colour) + { + if (!m_gbc_mode) + colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour]; + plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]); + } + } + data <<= 1; + } + break; + } + } + oam -= 4; + } +} + +void cgb_lcd_device::update_scanline() +{ + bitmap_ind16 &bitmap = m_bitmap; + + g_profiler.start(PROFILER_VIDEO); + + if ((LCDSTAT & 0x03) == 0x03) + { + /* Calcuate number of pixels to render based on time still left on the timer */ + UINT32 cycles_to_go = m_maincpu->attotime_to_cycles(m_lcd_timer->remaining()); + int l = 0; + + if (m_start_x < 0) + { + /* Window is enabled if the hardware says so AND the current scanline is + * within the window AND the window X coordinate is <=166 */ + m_layer[1].enabled = ((LCDCONT & 0x20) && (m_current_line >= WNDPOSY) && (WNDPOSX <= 166)) ? 1 : 0; + + /* BG is enabled if the hardware says so AND (window_off OR (window_on + * AND window's X position is >=7 )) */ + m_layer[0].enabled = ((LCDCONT & 0x01) && ((!m_layer[1].enabled) || (m_layer[1].enabled && (WNDPOSX >= 7)))) ? 1 : 0; + + if (m_layer[0].enabled) + { + m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; + m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; + m_layer[0].gbc_map = m_vram + m_gbc_bgdtab_offs; + m_layer[0].xindex = SCROLLX >> 3; + m_layer[0].xshift = SCROLLX & 7; + m_layer[0].xstart = 0; + m_layer[0].xend = 160; + } + + if (m_layer[1].enabled) + { + int xpos; + + /* Window X position is offset by 7 so we'll need to adust */ + xpos = WNDPOSX - 7; + if (xpos < 0) + xpos = 0; + + m_layer[1].bgline = m_window_lines_drawn; + m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; + m_layer[1].gbc_map = m_vram + m_gbc_wndtab_offs; + m_layer[1].xindex = 0; + m_layer[1].xshift = 0; + m_layer[1].xstart = xpos; + m_layer[1].xend = 160; + m_layer[0].xend = xpos; + } + m_start_x = 0; + } + + if (cycles_to_go < 160) + { + m_end_x = MIN(160 - cycles_to_go, 160); + /* Draw empty line when the background is disabled */ + if (!(LCDCONT & 0x01)) + { + rectangle r(m_start_x, m_end_x - 1, m_current_line, m_current_line); + bitmap.fill((!m_gbc_mode) ? 0 : 32767, r); + } + while (l < 2) + { + UINT8 xindex, *map, *tiles, *gbcmap; + UINT16 data; + int i, tile_index; + + if (!m_layer[l].enabled) + { + l++; + continue; + } + map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); + gbcmap = m_layer[l].gbc_map + ((m_layer[l].bgline << 2) & 0x3E0); + tiles = (gbcmap[m_layer[l].xindex] & 0x08) ? (m_vram + m_gbc_chrgen_offs) : (m_vram + m_gb_chrgen_offs); + + /* Check for vertical flip */ + if (gbcmap[m_layer[l].xindex] & 0x40) + { + tiles += ((7 - (m_layer[l].bgline & 0x07)) << 1); + } + else + { + tiles += ((m_layer[l].bgline & 0x07) << 1); + } + xindex = m_start_x; + if (xindex < m_layer[l].xstart) + xindex = m_layer[l].xstart; + i = m_end_x; + if (i > m_layer[l].xend) + i = m_layer[l].xend; + i = i - xindex; + + tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; + data = tiles[tile_index] | (tiles[tile_index + 1] << 8); + /* Check for horinzontal flip */ + if (gbcmap[m_layer[l].xindex] & 0x20) + { + data >>= m_layer[l].xshift; + } + else + { + data <<= m_layer[l].xshift; + } + + while (i > 0) + { + while ((m_layer[l].xshift < 8) && i) + { + int colour; + /* Check for horinzontal flip */ + if (gbcmap[m_layer[l].xindex] & 0x20) + { + colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); + data >>= 1; + } + else + { + colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); + data <<= 1; + } + plot_pixel(bitmap, xindex, m_current_line, m_cgb_bpal[(!m_gbc_mode) ? m_gb_bpal[colour] : (((gbcmap[m_layer[l].xindex] & 0x07) * 4) + colour)]); + m_bg_zbuf[xindex] = colour + (gbcmap[m_layer[l].xindex] & 0x80); + xindex++; + m_layer[l].xshift++; + i--; + } + if (m_layer[l].xshift == 8) + { + /* Take possible changes to SCROLLY into account */ + if (l == 0) + { + m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; + map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); + gbcmap = m_layer[l].gbc_map + ((m_layer[l].bgline << 2) & 0x3E0); + } + + m_layer[l].xindex = (m_layer[l].xindex + 1) & 31; + m_layer[l].xshift = 0; + tiles = (gbcmap[m_layer[l].xindex] & 0x08) ? (m_vram + m_gbc_chrgen_offs) : (m_vram + m_gb_chrgen_offs); + + /* Check for vertical flip */ + if (gbcmap[m_layer[l].xindex] & 0x40) + { + tiles += ((7 - (m_layer[l].bgline & 0x07)) << 1); + } + else + { + tiles += ((m_layer[l].bgline & 0x07) << 1); + } + tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; + data = tiles[tile_index] | (tiles[tile_index + 1] << 8); + } + } + l++; + } + if (m_end_x == 160 && (LCDCONT & 0x02)) + { + update_sprites(); + } + m_start_x = m_end_x; + } + } + else + { + if (!(LCDCONT & 0x80)) + { + /* Draw an empty line when LCD is disabled */ + if (m_previous_line != m_current_line) + { + if (m_current_line < 144) + { + const rectangle &r1 = m_screen->visible_area(); + rectangle r(r1.min_x, r1.max_x, m_current_line, m_current_line); + bitmap.fill((!m_gbc_mode) ? 0 : 32767 , r); + } + m_previous_line = m_current_line; + } + } + } + + g_profiler.stop(); +} + + +TIMER_CALLBACK_MEMBER(gb_lcd_device::video_init_vbl) +{ + m_maincpu->set_input_line(VBL_INT, ASSERT_LINE); +} + +UINT32 gb_lcd_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + + +void gb_lcd_device::increment_scanline() +{ + m_current_line = (m_current_line + 1) % 154; + if (LCDCONT & 0x80) + { + CURLINE = m_current_line; + } + if (m_current_line == 0) + { + m_window_lines_drawn = 0; + } +} + +TIMER_CALLBACK_MEMBER(gb_lcd_device::lcd_timer_proc) +{ + static const int gb_sprite_cycles[] = { 0, 8, 20, 32, 44, 52, 64, 76, 88, 96, 108 }; + + m_state = param; + + if (LCDCONT & 0x80) + { + switch (m_state) + { + case GB_LCD_STATE_LYXX_PRE_M0: /* Just before switching to mode 0 */ + m_mode = 0; + if (LCDSTAT & 0x08) + { + if (!m_mode_irq) + { + if (!m_line_irq && !m_delayed_line_irq) + { + m_mode_irq = 1; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + else + { + m_mode_irq = 0; + } + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0); + break; + case GB_LCD_STATE_LYXX_M0: /* Switch to mode 0 */ + /* update current scanline */ + update_scanline(); + /* Increment the number of window lines drawn if enabled */ + if (m_layer[1].enabled) + { + m_window_lines_drawn++; + } + m_previous_line = m_current_line; + /* Set Mode 0 lcdstate */ + m_mode = 0; + LCDSTAT &= 0xFC; + m_oam_locked = UNLOCKED; + m_vram_locked = UNLOCKED; + /* + There seems to a kind of feature in the Game Boy hardware when the lowest bits of the + SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later + than usual. + The SGB probably has the same bug. + */ + if ((SCROLLX & 0x03) == 0x03) + { + m_scrollx_adjust += 4; + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3); + break; + } + case GB_LCD_STATE_LYXX_M0_SCX3: + /* Generate lcd interrupt if requested */ + if (!m_mode_irq && (LCDSTAT & 0x08) && + ((!m_line_irq && m_delayed_line_irq) || !(LCDSTAT & 0x40))) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(196 - m_scrollx_adjust - m_sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); + break; + case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ + if (CURLINE < 143) + { + m_mode = 2; + m_triggering_mode_irq = (LCDSTAT & 0x20) ? 1 : 0; + if (m_triggering_mode_irq) + { + if (!m_mode_irq) + { + if (!m_line_irq && !m_delayed_line_irq) + { + m_mode_irq = 1; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + else + { + m_mode_irq = 0; + } + } + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC); + break; + case GB_LCD_STATE_LYXX_M0_INC: /* Increment LY, stay in M0 for 4 more cycles */ + increment_scanline(); + m_delayed_line_irq = m_line_irq; + m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; + m_line_irq = 0; + if (!m_mode_irq && !m_delayed_line_irq && m_triggering_line_irq && !m_triggering_mode_irq) + { + m_line_irq = m_triggering_line_irq; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + /* Reset LY==LYC STAT bit */ + LCDSTAT &= 0xFB; + /* Check if we're going into VBlank next */ + if (CURLINE == 144) + { + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); + } + else + { + /* Internally switch to mode 2 */ + m_mode = 2; + /* Generate lcd interrupt if requested */ + if (!m_mode_irq && m_triggering_mode_irq && + ((!m_triggering_line_irq && !m_delayed_line_irq) || !(LCDSTAT & 0x40))) + { + m_mode_irq = 1; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2); + } + break; + case GB_LCD_STATE_LY00_M2: /* Switch to mode 2 on line #0 */ + /* Set Mode 2 lcdstate */ + m_mode = 2; + LCDSTAT = (LCDSTAT & 0xFC) | 0x02; + m_oam_locked = LOCKED; + /* Generate lcd interrupt if requested */ + if ((LCDSTAT & 0x20) && !m_line_irq) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + /* Check for regular compensation of x-scroll register */ + m_scrollx_adjust = (SCROLLX & 0x04) ? 4 : 0; + /* Mode 2 lasts approximately 80 clock cycles */ + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); + break; + case GB_LCD_STATE_LYXX_M2: /* Switch to mode 2 */ + /* Update STAT register to the correct state */ + LCDSTAT = (LCDSTAT & 0xFC) | 0x02; + m_oam_locked = LOCKED; + /* Generate lcd interrupt if requested */ + if ((m_delayed_line_irq && m_triggering_line_irq && !(LCDSTAT & 0x20)) || + (!m_mode_irq && !m_line_irq && !m_delayed_line_irq && m_triggering_mode_irq)) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_line_irq = m_triggering_line_irq; + m_triggering_mode_irq = 0; + /* Check if LY==LYC STAT bit should be set */ + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + } + /* Check for regular compensation of x-scroll register */ + m_scrollx_adjust = (SCROLLX & 0x04) ? 4 : 0; + /* Mode 2 last for approximately 80 clock cycles */ + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); + break; + case GB_LCD_STATE_LYXX_M3: /* Switch to mode 3 */ + select_sprites(); + m_sprite_cycles = gb_sprite_cycles[m_sprCount]; + /* Set Mode 3 lcdstate */ + m_mode = 3; + LCDSTAT = (LCDSTAT & 0xFC) | 0x03; + m_vram_locked = LOCKED; + /* Check for compensations of x-scroll register */ + /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */ + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(168 + m_scrollx_adjust + m_sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0); + m_start_x = -1; + break; + case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ + if (CURLINE == 144) + { + /* Trigger VBlank interrupt */ + m_maincpu->set_input_line(VBL_INT, ASSERT_LINE); + /* Set VBlank lcdstate */ + m_mode = 1; + LCDSTAT = (LCDSTAT & 0xFC) | 0x01; + /* Trigger LCD interrupt if requested */ + if (LCDSTAT & 0x10) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + /* Check if LY==LYC STAT bit should be set */ + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + } + if (m_delayed_line_irq && m_triggering_line_irq) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC); + break; + case GB_LCD_STATE_LY9X_M1_INC: /* Increment scanline counter */ + increment_scanline(); + m_delayed_line_irq = m_line_irq; + m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; + m_line_irq = 0; + if (!m_delayed_line_irq && m_triggering_line_irq) + { + m_line_irq = m_triggering_line_irq; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + /* Reset LY==LYC STAT bit */ + LCDSTAT &= 0xFB; + if (m_current_line == 153) + { + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1); + } + else + { + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); + } + break; + case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ + /* Check LY=LYC for line #153 */ + if (m_delayed_line_irq) + { + if (m_triggering_line_irq) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + m_delayed_line_irq = m_delayed_line_irq | m_line_irq; + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + } + increment_scanline(); + m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; + m_line_irq = 0; + LCDSTAT &= 0xFB; + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4/*8*/), GB_LCD_STATE_LY00_M1_1); + break; + case GB_LCD_STATE_LY00_M1_1: + if (!m_delayed_line_irq && m_triggering_line_irq) + { + m_line_irq = m_triggering_line_irq; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2); + break; + case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ + if (m_delayed_line_irq && m_triggering_line_irq) + { + m_line_irq = m_triggering_line_irq; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0); + break; + case GB_LCD_STATE_LY00_M0: /* The STAT register seems to go to 0 for about 4 cycles */ + /* Set Mode 0 lcdstat */ + m_mode = 0; + LCDSTAT = (LCDSTAT & 0xFC); + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2); + break; + } + } + else + { + increment_scanline(); + if (m_current_line < 144) + { + update_scanline(); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(456)); + } +} + + +// CGB specific code + +void cgb_lcd_device::hdma_trans(UINT16 length) +{ + UINT16 src, dst; + address_space &space = m_maincpu->space(AS_PROGRAM); + + src = ((UINT16)HDMA1 << 8) | (HDMA2 & 0xF0); + dst = ((UINT16)(HDMA3 & 0x1F) << 8) | (HDMA4 & 0xF0); + dst |= 0x8000; + while (length > 0) + { + space.write_byte(dst++, space.read_byte(src++)); + length--; + } + HDMA1 = src >> 8; + HDMA2 = src & 0xF0; + HDMA3 = 0x1f & (dst >> 8); + HDMA4 = dst & 0xF0; + HDMA5--; + if ((HDMA5 & 0x7f) == 0x7f) + { + HDMA5 = 0xff; + m_hdma_enabled = 0; + } +} + + +TIMER_CALLBACK_MEMBER(cgb_lcd_device::lcd_timer_proc) +{ + static const int cgb_sprite_cycles[] = { 0, 8, 20, 32, 44, 52, 64, 76, 88, 96, 108 }; + + m_state = param; + + if (LCDCONT & 0x80) + { + switch (m_state) + { + case GB_LCD_STATE_LYXX_PRE_M0: /* Just before switching to mode 0 */ + m_mode = 0; + if (LCDSTAT & 0x08) + { + if (!m_mode_irq) + { + if (!m_line_irq && !m_delayed_line_irq) + { + m_mode_irq = 1; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + else + { + m_mode_irq = 0; + } + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0); + break; + case GB_LCD_STATE_LYXX_M0: /* Switch to mode 0 */ + /* update current scanline */ + update_scanline(); + /* Increment the number of window lines drawn if enabled */ + if (m_layer[1].enabled) + { + m_window_lines_drawn++; + } + m_previous_line = m_current_line; + /* Set Mode 0 lcdstate */ + m_mode = 0; + LCDSTAT &= 0xFC; + m_oam_locked = UNLOCKED; + m_vram_locked = UNLOCKED; + /* + There seems to a kind of feature in the Game Boy hardware when the lowest bits of the + SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later + than usual. + The SGB probably has the same bug. + */ + m_triggering_mode_irq = (LCDSTAT & 0x08) ? 1 : 0; + if ((SCROLLX & 0x03) == 0x03) + { + m_scrollx_adjust += 4; + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3); + break; + } + case GB_LCD_STATE_LYXX_M0_SCX3: + /* Generate lcd interrupt if requested */ + if (!m_mode_irq && m_triggering_mode_irq && + ((!m_line_irq && m_delayed_line_irq) || !(LCDSTAT & 0x40))) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + m_triggering_mode_irq = 0; + } + if ((SCROLLX & 0x03) == 0x03) + { + m_pal_locked = UNLOCKED; + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_GBC_PAL); + break; + case GB_LCD_STATE_LYXX_M0_GBC_PAL: + m_pal_locked = UNLOCKED; + /* Check for HBLANK DMA */ + if (m_hdma_enabled) + { + hdma_trans(0x10); +// cpunum_set_reg(0, LR35902_DMA_CYCLES, 36); + } + else + { + m_hdma_possible = 1; + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(192 - m_scrollx_adjust - m_sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); + break; + case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ + m_cmp_line = CMPLINE; + if (CURLINE < 143) + { + m_mode = 2; + if (LCDSTAT & 0x20) + { + if (!m_mode_irq) + { + if (!m_line_irq && !m_delayed_line_irq) + { + m_mode_irq = 1; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + else + { + m_mode_irq = 0; + } + } + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC); + break; + case GB_LCD_STATE_LYXX_M0_INC: /* Increment LY, stay in M0 for 4 more cycles */ + increment_scanline(); + m_delayed_line_irq = m_line_irq; + m_triggering_line_irq = ((m_cmp_line == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; + m_line_irq = 0; + if (!m_mode_irq && !m_delayed_line_irq && m_triggering_line_irq && !(LCDSTAT & 0x20)) + { + m_line_irq = m_triggering_line_irq; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_hdma_possible = 0; + /* Check if we're going into VBlank next */ + if (CURLINE == 144) + { + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); + } + else + { + /* Internally switch to mode 2 */ + m_mode = 2; + /* Generate lcd interrupt if requested */ + if (!m_mode_irq && (LCDSTAT & 0x20) && + ((!m_triggering_line_irq && !m_delayed_line_irq) || !(LCDSTAT & 0x40))) + { + m_mode_irq = 1; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2); + } + break; + case GB_LCD_STATE_LY00_M2: /* Switch to mode 2 on line #0 */ + /* Set Mode 2 lcdstate */ + m_mode = 2; + LCDSTAT = (LCDSTAT & 0xFC) | 0x02; + m_oam_locked = LOCKED; + /* Generate lcd interrupt if requested */ + if ((LCDSTAT & 0x20) && !m_line_irq) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + /* Check for regular compensation of x-scroll register */ + m_scrollx_adjust = (SCROLLX & 0x04) ? 4 : 0; + /* Mode 2 lasts approximately 80 clock cycles */ + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); + break; + case GB_LCD_STATE_LYXX_M2: /* Switch to mode 2 */ + /* Update STAT register to the correct state */ + LCDSTAT = (LCDSTAT & 0xFC) | 0x02; + m_oam_locked = LOCKED; + /* Generate lcd interrupt if requested */ + if ((m_delayed_line_irq && m_triggering_line_irq && !(LCDSTAT & 0x20)) || + (!m_mode_irq && !m_line_irq && !m_delayed_line_irq && (LCDSTAT & 0x20))) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_line_irq = m_triggering_line_irq; + /* Check if LY==LYC STAT bit should be set */ + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + } + else + { + LCDSTAT &= ~0x04; + } + /* Check for regular compensation of x-scroll register */ + m_scrollx_adjust = (SCROLLX & 0x04) ? 4 : 0; + /* Mode 2 last for approximately 80 clock cycles */ + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); + break; + case GB_LCD_STATE_LYXX_M3: /* Switch to mode 3 */ + select_sprites(); + m_sprite_cycles = cgb_sprite_cycles[m_sprCount]; + /* Set Mode 3 lcdstate */ + m_mode = 3; + LCDSTAT = (LCDSTAT & 0xFC) | 0x03; + m_vram_locked = LOCKED; + m_pal_locked = LOCKED; + /* Check for compensations of x-scroll register */ + /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */ + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(168 + m_scrollx_adjust + m_sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0); + m_start_x = -1; + break; + case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ + if (CURLINE == 144) + { + /* Trigger VBlank interrupt */ + m_maincpu->set_input_line(VBL_INT, ASSERT_LINE); + /* Set VBlank lcdstate */ + m_mode = 1; + LCDSTAT = (LCDSTAT & 0xFC) | 0x01; + /* Trigger LCD interrupt if requested */ + if (LCDSTAT & 0x10) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + /* Check if LY==LYC STAT bit should be set */ + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + } + else + { + LCDSTAT &= ~0x04; + } + if (m_delayed_line_irq && m_triggering_line_irq) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC); + break; + case GB_LCD_STATE_LY9X_M1_INC: /* Increment scanline counter */ + increment_scanline(); + m_delayed_line_irq = m_line_irq; + m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; + m_line_irq = 0; + if (!m_delayed_line_irq && m_triggering_line_irq) + { + m_line_irq = m_triggering_line_irq; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + if (m_current_line == 153) + { + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1); + } + else + { + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); + } + break; + case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ + /* Check LY=LYC for line #153 */ + if (m_delayed_line_irq) + { + if (m_triggering_line_irq) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + m_delayed_line_irq = m_delayed_line_irq | m_line_irq; + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + } + else + { + LCDSTAT &= ~0x04; + } + increment_scanline(); + m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; + m_line_irq = 0; + LCDSTAT &= 0xFB; + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_1); + break; + case GB_LCD_STATE_LY00_M1_1: + if (!m_delayed_line_irq && m_triggering_line_irq) + { + m_line_irq = m_triggering_line_irq; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2); + break; + case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ + if (m_delayed_line_irq && m_triggering_line_irq) + { + m_line_irq = m_triggering_line_irq; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + } + else + { + LCDSTAT &= ~0x04; + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0); + break; + case GB_LCD_STATE_LY00_M0: /* The STAT register seems to go to 0 for about 4 cycles */ + /* Set Mode 0 lcdstat */ + m_mode = 0; + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2); + break; + } + } + else + { + increment_scanline(); + if (m_current_line < 144) + { + update_scanline(); + } + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(456)); + } +} + + +void gb_lcd_device::lcd_switch_on() +{ + m_current_line = 0; + m_previous_line = 153; + m_window_lines_drawn = 0; + m_line_irq = 0; + m_delayed_line_irq = 0; + m_mode = 0; + m_oam_locked = LOCKED; /* TODO: Investigate whether this OAM locking is correct. */ + /* Check for LY=LYC coincidence */ + if (CURLINE == CMPLINE) + { + LCDSTAT |= 0x04; + /* Generate lcd interrupt if requested */ + if (LCDSTAT & 0x40) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + m_state = GB_LCD_STATE_LY00_M2; + m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); +} + + + + +READ8_MEMBER(gb_lcd_device::vram_r) +{ + return (m_vram_locked == LOCKED) ? 0xff : m_vram[offset + (m_vram_bank * 0x2000)]; +} + +WRITE8_MEMBER(gb_lcd_device::vram_w) +{ + if (m_vram_locked == LOCKED) + return; + + m_vram[offset + (m_vram_bank * 0x2000)] = data; +} + +READ8_MEMBER(gb_lcd_device::oam_r) +{ + return (m_oam_locked == LOCKED) ? 0xff : m_oam[offset]; +} + +WRITE8_MEMBER(gb_lcd_device::oam_w) +{ + if (m_oam_locked == LOCKED || offset >= 0xa0) + return; + + m_oam[offset] = data; +} + + + +READ8_MEMBER(gb_lcd_device::video_r) +{ + return m_vid_regs[offset]; +} + +WRITE8_MEMBER(gb_lcd_device::video_w) +{ + switch (offset) + { + case 0x00: /* LCDC - LCD Control */ + m_gb_chrgen_offs = (data & 0x10) ? 0x0000 : 0x0800; + m_gb_tile_no_mod = (data & 0x10) ? 0x00 : 0x80; + m_gb_bgdtab_offs = (data & 0x08) ? 0x1c00 : 0x1800; + m_gb_wndtab_offs = (data & 0x40) ? 0x1c00 : 0x1800; + /* if LCD controller is switched off, set STAT and LY to 00 */ + if (!(data & 0x80)) + { + LCDSTAT &= ~0x03; + CURLINE = 0; + m_oam_locked = UNLOCKED; + m_vram_locked = UNLOCKED; + } + /* If LCD is being switched on */ + if (!(LCDCONT & 0x80) && (data & 0x80)) + { + lcd_switch_on(); + } + break; + case 0x01: /* STAT - LCD Status */ + data = 0x80 | (data & 0x78) | (LCDSTAT & 0x07); + /* + Check for the STAT bug: + Writing to STAT when the LCD controller is active causes a STAT + interrupt to be triggered. + */ + if (LCDCONT & 0x80) + { + /* Triggers seen so far: + - 0x40 -> 0x00 - trigger + - 0x00 -> 0x08 - trigger + - 0x08 -> 0x00 - don't trigger + - 0x00 -> 0x20 (mode 3) - trigger + - 0x00 -> 0x60 (mode 2) - don't trigger + - 0x20 -> 0x60 (mode 3) - trigger + - 0x20 -> 0x40 (mode 3) - trigger + - 0x40 -> 0x20 (mode 2) - don't trigger + - 0x40 -> 0x08 (mode 0) - don't trigger + - 0x00 -> 0x40 - trigger only if LY==LYC + - 0x20 -> 0x00/0x08/0x10/0x20/0x40 (mode 2, after m2int) - don't trigger + - 0x20 -> 0x00/0x08/0x10/0x20/0x40 (mode 3, after m2int) - don't trigger + */ + if (!m_mode_irq && ((m_mode == 1) || + ((LCDSTAT & 0x40) && !(data & 0x68)) || + (!(LCDSTAT & 0x40) && (data & 0x40) && (LCDSTAT & 0x04)) || + (!(LCDSTAT & 0x48) && (data & 0x08)) || + ((LCDSTAT & 0x60) == 0x00 && (data & 0x60) == 0x20) || + ((LCDSTAT & 0x60) == 0x20 && (data & 0x40)) + )) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + /* + - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger + - 0x20 -> 0x00/0x10/0x20/0x40 (mode 0, after m2int) - trigger (stat bug) + - 0x00 -> 0xXX (mode 0) - trigger stat bug + */ + if (m_mode_irq && m_mode == 0) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + break; + case 0x04: /* LY - LCD Y-coordinate */ + return; + case 0x05: /* LYC */ + if (CMPLINE != data) + { + if (CURLINE == data) + { + if (m_state != GB_LCD_STATE_LYXX_M0_INC && m_state != GB_LCD_STATE_LY9X_M1_INC) + { + LCDSTAT |= 0x04; + /* Generate lcd interrupt if requested */ + if (LCDSTAT & 0x40) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + } + else + { + LCDSTAT &= 0xFB; + m_triggering_line_irq = 0; + } + } + break; + case 0x06: /* DMA - DMA Transfer and Start Address */ + { + UINT8 *P = m_oam; + offset = (UINT16) data << 8; + for (data = 0; data < 0xA0; data++) + *P++ = space.read_byte(offset++); + } + return; + case 0x07: /* BGP - Background Palette */ + update_scanline(); + m_gb_bpal[0] = data & 0x3; + m_gb_bpal[1] = (data & 0xC) >> 2; + m_gb_bpal[2] = (data & 0x30) >> 4; + m_gb_bpal[3] = (data & 0xC0) >> 6; + break; + case 0x08: /* OBP0 - Object Palette 0 */ +// update_scanline(); + m_gb_spal0[0] = data & 0x3; + m_gb_spal0[1] = (data & 0xC) >> 2; + m_gb_spal0[2] = (data & 0x30) >> 4; + m_gb_spal0[3] = (data & 0xC0) >> 6; + break; + case 0x09: /* OBP1 - Object Palette 1 */ +// update_scanline(); + m_gb_spal1[0] = data & 0x3; + m_gb_spal1[1] = (data & 0xC) >> 2; + m_gb_spal1[2] = (data & 0x30) >> 4; + m_gb_spal1[3] = (data & 0xC0) >> 6; + break; + case 0x02: /* SCY - Scroll Y */ + case 0x03: /* SCX - Scroll X */ + update_scanline(); + break; + case 0x0A: /* WY - Window Y position */ + case 0x0B: /* WX - Window X position */ + break; + default: /* Unknown register, no change */ + return; + } + m_vid_regs[offset] = data; +} + +READ8_MEMBER(cgb_lcd_device::video_r) +{ + switch (offset) + { + case 0x11: /* FF51 */ + case 0x12: /* FF52 */ + case 0x13: /* FF53 */ + case 0x14: /* FF54 */ + return 0xFF; + case 0x29: /* FF69 */ + case 0x2B: /* FF6B */ + if (m_pal_locked == LOCKED) + { + return 0xFF; + } + break; + } + return m_vid_regs[offset]; +} + +WRITE8_MEMBER(cgb_lcd_device::video_w) +{ + switch (offset) + { + case 0x00: /* LCDC - LCD Control */ + m_gb_chrgen_offs = (data & 0x10) ? 0x0000 : 0x0800; + m_gbc_chrgen_offs = (data & 0x10) ? 0x2000 : 0x2800; + m_gb_tile_no_mod = (data & 0x10) ? 0x00 : 0x80; + m_gb_bgdtab_offs = (data & 0x08) ? 0x1c00 : 0x1800; + m_gbc_bgdtab_offs = (data & 0x08) ? 0x3c00 : 0x3800; + m_gb_wndtab_offs = (data & 0x40) ? 0x1c00 : 0x1800; + m_gbc_wndtab_offs = (data & 0x40) ? 0x3c00 : 0x3800; + /* if LCD controller is switched off, set STAT to 00 */ + if (!(data & 0x80)) + { + LCDSTAT &= ~0x03; + CURLINE = 0; + m_oam_locked = UNLOCKED; + m_vram_locked = UNLOCKED; + m_pal_locked = UNLOCKED; + } + /* If LCD is being switched on */ + if (!(LCDCONT & 0x80) && (data & 0x80)) + { + lcd_switch_on(); + } + break; + case 0x01: /* STAT - LCD Status */ + data = 0x80 | (data & 0x78) | (LCDSTAT & 0x07); + if (LCDCONT & 0x80) + { + /* + - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger + */ + if (m_mode_irq && m_mode == 0 && (LCDSTAT & 0x28) == 0x20 && (data & 0x08)) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + /* Check if line irqs are being disabled */ + if (!(data & 0x40)) + { + m_delayed_line_irq = 0; + } + /* Check if line irqs are being enabled */ + if (!(LCDSTAT & 0x40) && (data & 0x40)) + { + if (CMPLINE == CURLINE) + { + m_line_irq = 1; + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + } + break; + case 0x05: /* LYC */ + if (CMPLINE != data) + { + if ((m_state != GB_LCD_STATE_LYXX_M0_PRE_INC && CURLINE == data) || + (m_state == GB_LCD_STATE_LYXX_M0_INC && m_triggering_line_irq)) + { + LCDSTAT |= 0x04; + /* Generate lcd interrupt if requested */ + if (LCDSTAT & 0x40) + { + m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); + } + } + else + { + LCDSTAT &= 0xFB; + m_triggering_line_irq = 0; + m_cmp_line = data; + } + } + break; + case 0x07: /* BGP - GB background palette */ + update_scanline(); + m_gb_bpal[0] = data & 0x3; + m_gb_bpal[1] = (data & 0xC) >> 2; + m_gb_bpal[2] = (data & 0x30) >> 4; + m_gb_bpal[3] = (data & 0xC0) >> 6; + break; + case 0x08: /* OBP0 - GB Object 0 palette */ + m_gb_spal0[0] = data & 0x3; + m_gb_spal0[1] = (data & 0xC) >> 2; + m_gb_spal0[2] = (data & 0x30) >> 4; + m_gb_spal0[3] = (data & 0xC0) >> 6; + break; + case 0x09: /* OBP1 - GB Object 1 palette */ + m_gb_spal1[0] = data & 0x3; + m_gb_spal1[1] = (data & 0xC) >> 2; + m_gb_spal1[2] = (data & 0x30) >> 4; + m_gb_spal1[3] = (data & 0xC0) >> 6; + break; + case 0x0c: /* Undocumented register involved in selecting gb/gbc mode */ + logerror("Write to undocumented register: %X = %X\n", offset, data); + break; + case 0x0F: /* VBK - VRAM bank select */ + m_vram_bank = data & 0x01; + data |= 0xFE; + break; + case 0x11: /* HDMA1 - HBL General DMA - Source High */ + break; + case 0x12: /* HDMA2 - HBL General DMA - Source Low */ + data &= 0xF0; + break; + case 0x13: /* HDMA3 - HBL General DMA - Destination High */ + data &= 0x1F; + break; + case 0x14: /* HDMA4 - HBL General DMA - Destination Low */ + data &= 0xF0; + break; + case 0x15: /* HDMA5 - HBL General DMA - Mode, Length */ + if (!(data & 0x80)) + { + if (m_hdma_enabled) + { + m_hdma_enabled = 0; + data = HDMA5 & 0x80; + } + else + { + /* General DMA */ + hdma_trans(((data & 0x7F) + 1) * 0x10); +// cpunum_set_reg(0, LR35902_DMA_CYCLES, 4 + (((data & 0x7F) + 1) * 32)); + data = 0xff; + } + } + else + { + /* H-Blank DMA */ + m_hdma_enabled = 1; + data &= 0x7f; + m_vid_regs[offset] = data; + /* Check if HDMA should be immediately performed */ + if (m_hdma_possible) + { + hdma_trans(0x10); +// cpunum_set_reg(0, LR35902_DMA_CYCLES, 36); + m_hdma_possible = 0; + } + } + break; + case 0x28: /* BCPS - Background palette specification */ + GBCBCPS = data; + if (data & 0x01) + GBCBCPD = m_cgb_bpal[(data >> 1) & 0x1F] >> 8; + else + GBCBCPD = m_cgb_bpal[(data >> 1) & 0x1F] & 0xFF; + break; + case 0x29: /* BCPD - background palette data */ + if (m_pal_locked == LOCKED) + { + return; + } + GBCBCPD = data; + if (GBCBCPS & 0x01) + m_cgb_bpal[(GBCBCPS >> 1) & 0x1F] = ((data << 8) | (m_cgb_bpal[(GBCBCPS >> 1) & 0x1F] & 0xFF)) & 0x7FFF; + else + m_cgb_bpal[(GBCBCPS >> 1) & 0x1F] = ((m_cgb_bpal[(GBCBCPS >> 1) & 0x1F] & 0xFF00) | data) & 0x7FFF; + if (GBCBCPS & 0x80) + { + GBCBCPS++; + GBCBCPS &= 0xBF; + } + break; + case 0x2A: /* OCPS - Object palette specification */ + GBCOCPS = data; + if (data & 0x01) + GBCOCPD = m_cgb_spal[(data >> 1) & 0x1F] >> 8; + else + GBCOCPD = m_cgb_spal[(data >> 1) & 0x1F] & 0xFF; + break; + case 0x2B: /* OCPD - Object palette data */ + if (m_pal_locked == LOCKED) + { + return; + } + GBCOCPD = data; + if (GBCOCPS & 0x01) + m_cgb_spal[(GBCOCPS >> 1) & 0x1F] = ((data << 8) | (m_cgb_spal[(GBCOCPS >> 1) & 0x1F] & 0xFF)) & 0x7FFF; + else + m_cgb_spal[(GBCOCPS >> 1) & 0x1F] = ((m_cgb_spal[(GBCOCPS >> 1) & 0x1F] & 0xFF00) | data) & 0x7FFF; + if (GBCOCPS & 0x80) + { + GBCOCPS++; + GBCOCPS &= 0xBF; + } + break; + /* Undocumented registers */ + case 0x2C: + /* bit 0 can be read/written */ + logerror("Write to undocumented register: %X = %X\n", offset, data); + data = 0xFE | (data & 0x01); + if (data & 0x01) + { + m_gbc_mode = 0; + } + break; + case 0x32: + case 0x33: + case 0x34: + /* whole byte can be read/written */ + logerror("Write to undocumented register: %X = %X\n", offset, data); + break; + case 0x35: + /* bit 4-6 can be read/written */ + logerror("Write to undocumented register: %X = %X\n", offset, data); + data = 0x8F | (data & 0x70); + break; + case 0x36: + case 0x37: + logerror("Write to undocumented register: %X = %X\n", offset, data); + return; + default: + /* we didn't handle the write, so pass it to the GB handler */ + gb_lcd_device::video_w(space, offset, data); + return; + } + + m_vid_regs[offset] = data; +} + +// Super Game Boy + +void sgb_lcd_device::sgb_io_write_pal(int offs, UINT8 *data) +{ + switch (offs) + { + case 0x00: /* PAL01 */ + m_sgb_pal[0 * 4 + 0] = data[1] | (data[2] << 8); + m_sgb_pal[0 * 4 + 1] = data[3] | (data[4] << 8); + m_sgb_pal[0 * 4 + 2] = data[5] | (data[6] << 8); + m_sgb_pal[0 * 4 + 3] = data[7] | (data[8] << 8); + m_sgb_pal[1 * 4 + 0] = data[1] | (data[2] << 8); + m_sgb_pal[1 * 4 + 1] = data[9] | (data[10] << 8); + m_sgb_pal[1 * 4 + 2] = data[11] | (data[12] << 8); + m_sgb_pal[1 * 4 + 3] = data[13] | (data[14] << 8); + break; + case 0x01: /* PAL23 */ + m_sgb_pal[2 * 4 + 0] = data[1] | (data[2] << 8); + m_sgb_pal[2 * 4 + 1] = data[3] | (data[4] << 8); + m_sgb_pal[2 * 4 + 2] = data[5] | (data[6] << 8); + m_sgb_pal[2 * 4 + 3] = data[7] | (data[8] << 8); + m_sgb_pal[3 * 4 + 0] = data[1] | (data[2] << 8); + m_sgb_pal[3 * 4 + 1] = data[9] | (data[10] << 8); + m_sgb_pal[3 * 4 + 2] = data[11] | (data[12] << 8); + m_sgb_pal[3 * 4 + 3] = data[13] | (data[14] << 8); + break; + case 0x02: /* PAL03 */ + m_sgb_pal[0 * 4 + 0] = data[1] | (data[2] << 8); + m_sgb_pal[0 * 4 + 1] = data[3] | (data[4] << 8); + m_sgb_pal[0 * 4 + 2] = data[5] | (data[6] << 8); + m_sgb_pal[0 * 4 + 3] = data[7] | (data[8] << 8); + m_sgb_pal[3 * 4 + 0] = data[1] | (data[2] << 8); + m_sgb_pal[3 * 4 + 1] = data[9] | (data[10] << 8); + m_sgb_pal[3 * 4 + 2] = data[11] | (data[12] << 8); + m_sgb_pal[3 * 4 + 3] = data[13] | (data[14] << 8); + break; + case 0x03: /* PAL12 */ + m_sgb_pal[1 * 4 + 0] = data[1] | (data[2] << 8); + m_sgb_pal[1 * 4 + 1] = data[3] | (data[4] << 8); + m_sgb_pal[1 * 4 + 2] = data[5] | (data[6] << 8); + m_sgb_pal[1 * 4 + 3] = data[7] | (data[8] << 8); + m_sgb_pal[2 * 4 + 0] = data[1] | (data[2] << 8); + m_sgb_pal[2 * 4 + 1] = data[9] | (data[10] << 8); + m_sgb_pal[2 * 4 + 2] = data[11] | (data[12] << 8); + m_sgb_pal[2 * 4 + 3] = data[13] | (data[14] << 8); + break; + case 0x04: /* ATTR_BLK */ + { + UINT8 I, J, K, o; + for( K = 0; K < data[1]; K++ ) + { + o = K * 6; + if( data[o + 2] & 0x1 ) + { + for( I = data[ o + 4]; I <= data[o + 6]; I++ ) + { + for( J = data[o + 5]; J <= data[o + 7]; J++ ) + { + m_sgb_pal_map[I][J] = data[o + 3] & 0x3; + } + } + } + } + } + break; + case 0x05: /* ATTR_LIN */ + { + UINT8 J, K; + if( data[1] > 15 ) + data[1] = 15; + for( K = 0; K < data[1]; K++ ) + { + if( data[K + 1] & 0x80 ) + { + for( J = 0; J < 20; J++ ) + { + m_sgb_pal_map[J][data[K + 1] & 0x1f] = (data[K + 1] & 0x60) >> 5; + } + } + else + { + for( J = 0; J < 18; J++ ) + { + m_sgb_pal_map[data[K + 1] & 0x1f][J] = (data[K + 1] & 0x60) >> 5; + } + } + } + } + break; + case 0x06: /* ATTR_DIV */ + { + UINT8 I, J; + if( data[1] & 0x40 ) /* Vertical */ + { + for( I = 0; I < data[2]; I++ ) + { + for( J = 0; J < 20; J++ ) + { + m_sgb_pal_map[J][I] = (data[1] & 0xC) >> 2; + } + } + for( J = 0; J < 20; J++ ) + { + m_sgb_pal_map[J][data[2]] = (data[1] & 0x30) >> 4; + } + for( I = data[2] + 1; I < 18; I++ ) + { + for( J = 0; J < 20; J++ ) + { + m_sgb_pal_map[J][I] = data[1] & 0x3; + } + } + } + else /* Horizontal */ + { + for( I = 0; I < data[2]; I++ ) + { + for( J = 0; J < 18; J++ ) + { + m_sgb_pal_map[I][J] = (data[1] & 0xC) >> 2; + } + } + for( J = 0; J < 18; J++ ) + { + m_sgb_pal_map[data[2]][J] = (data[1] & 0x30) >> 4; + } + for( I = data[2] + 1; I < 20; I++ ) + { + for( J = 0; J < 18; J++ ) + { + m_sgb_pal_map[I][J] = data[1] & 0x3; + } + } + } + } + break; + case 0x07: /* ATTR_CHR */ + { + UINT16 I, sets; + UINT8 x, y; + sets = (data[3] | (data[4] << 8) ); + if( sets > 360 ) + sets = 360; + sets >>= 2; + sets += 6; + x = data[1]; + y = data[2]; + if( data[5] ) /* Vertical */ + { + for( I = 6; I < sets; I++ ) + { + m_sgb_pal_map[x][y++] = (data[I] & 0xC0) >> 6; + if( y > 17 ) + { + y = 0; + x++; + if( x > 19 ) + x = 0; + } + + m_sgb_pal_map[x][y++] = (data[I] & 0x30) >> 4; + if( y > 17 ) + { + y = 0; + x++; + if( x > 19 ) + x = 0; + } + + m_sgb_pal_map[x][y++] = (data[I] & 0xC) >> 2; + if( y > 17 ) + { + y = 0; + x++; + if( x > 19 ) + x = 0; + } + + m_sgb_pal_map[x][y++] = data[I] & 0x3; + if( y > 17 ) + { + y = 0; + x++; + if( x > 19 ) + x = 0; + } + } + } + else /* horizontal */ + { + for( I = 6; I < sets; I++ ) + { + m_sgb_pal_map[x++][y] = (data[I] & 0xC0) >> 6; + if( x > 19 ) + { + x = 0; + y++; + if( y > 17 ) + y = 0; + } + + m_sgb_pal_map[x++][y] = (data[I] & 0x30) >> 4; + if( x > 19 ) + { + x = 0; + y++; + if( y > 17 ) + y = 0; + } + + m_sgb_pal_map[x++][y] = (data[I] & 0xC) >> 2; + if( x > 19 ) + { + x = 0; + y++; + if( y > 17 ) + y = 0; + } + + m_sgb_pal_map[x++][y] = data[I] & 0x3; + if( x > 19 ) + { + x = 0; + y++; + if( y > 17 ) + y = 0; + } + } + } + } + break; + case 0x08: /* SOUND */ + /* This command enables internal sound effects */ + /* Not Implemented */ + break; + case 0x09: /* SOU_TRN */ + /* This command sends data to the SNES sound processor. + We'll need to emulate that for this to be used */ + /* Not Implemented */ + break; + case 0x0A: /* PAL_SET */ + { + UINT16 index_; + + /* Palette 0 */ + index_ = (UINT16)(data[1] | (data[2] << 8)) * 4; + m_sgb_pal[0] = m_sgb_pal_data[index_]; + m_sgb_pal[1] = m_sgb_pal_data[index_ + 1]; + m_sgb_pal[2] = m_sgb_pal_data[index_ + 2]; + m_sgb_pal[3] = m_sgb_pal_data[index_ + 3]; + /* Palette 1 */ + index_ = (UINT16)(data[3] | (data[4] << 8)) * 4; + m_sgb_pal[4] = m_sgb_pal_data[index_]; + m_sgb_pal[5] = m_sgb_pal_data[index_ + 1]; + m_sgb_pal[6] = m_sgb_pal_data[index_ + 2]; + m_sgb_pal[7] = m_sgb_pal_data[index_ + 3]; + /* Palette 2 */ + index_ = (UINT16)(data[5] | (data[6] << 8)) * 4; + m_sgb_pal[8] = m_sgb_pal_data[index_]; + m_sgb_pal[9] = m_sgb_pal_data[index_ + 1]; + m_sgb_pal[10] = m_sgb_pal_data[index_ + 2]; + m_sgb_pal[11] = m_sgb_pal_data[index_ + 3]; + /* Palette 3 */ + index_ = (UINT16)(data[7] | (data[8] << 8)) * 4; + m_sgb_pal[12] = m_sgb_pal_data[index_]; + m_sgb_pal[13] = m_sgb_pal_data[index_ + 1]; + m_sgb_pal[14] = m_sgb_pal_data[index_ + 2]; + m_sgb_pal[15] = m_sgb_pal_data[index_ + 3]; + /* Attribute File */ + if (data[9] & 0x40) + m_sgb_window_mask = 0; + m_sgb_atf = (data[9] & 0x3f) * (18 * 5); + if (data[9] & 0x80) + { + for (int j = 0; j < 18; j++ ) + { + for (int i = 0; i < 5; i++ ) + { + m_sgb_pal_map[i * 4][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0xC0) >> 6; + m_sgb_pal_map[(i * 4) + 1][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0x30) >> 4; + m_sgb_pal_map[(i * 4) + 2][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0xC) >> 2; + m_sgb_pal_map[(i * 4) + 3][j] = m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0x3; + } + } + } + } + break; + case 0x0B: /* PAL_TRN */ + { + UINT16 col; + + for (int i = 0; i < 2048; i++ ) + { + col = (m_vram[0x0800 + (i * 2) + 1] << 8) | m_vram[0x0800 + (i * 2)]; + m_sgb_pal_data[i] = col; + } + } + break; + case 0x0C: /* ATRC_EN */ + /* Not Implemented */ + break; + case 0x0D: /* TEST_EN */ + /* Not Implemented */ + break; + case 0x0E: /* ICON_EN */ + /* Not Implemented */ + break; + case 0x0F: /* DATA_SND */ + /* Not Implemented */ + break; + case 0x10: /* DATA_TRN */ + /* Not Implemented */ + break; + case 0x12: /* JUMP */ + /* Not Implemented */ + break; + case 0x13: /* CHR_TRN */ + if (data[1] & 0x1) + memcpy(m_sgb_tile_data + 4096, m_vram + 0x0800, 4096); + else + memcpy(m_sgb_tile_data, m_vram + 0x0800, 4096); + break; + case 0x14: /* PCT_TRN */ + { + UINT16 col; + if (m_sgb_border_hack) + { + memcpy(m_sgb_tile_map, m_vram + 0x1000, 2048); + for (int i = 0; i < 64; i++) + { + col = (m_vram[0x0800 + (i * 2) + 1 ] << 8) | m_vram[0x0800 + (i * 2)]; + m_sgb_pal[SGB_BORDER_PAL_OFFSET + i] = col; + } + } + else /* Do things normally */ + { + memcpy(m_sgb_tile_map, m_vram + 0x0800, 2048); + for (int i = 0; i < 64; i++) + { + col = (m_vram[0x1000 + (i * 2) + 1] << 8) | m_vram[0x1000 + (i * 2)]; + m_sgb_pal[SGB_BORDER_PAL_OFFSET + i] = col; + } + } + } + break; + case 0x15: /* ATTR_TRN */ + memcpy(m_sgb_atf_data, m_vram + 0x0800, 4050); + break; + case 0x16: /* ATTR_SET */ + { + /* Attribute File */ + if (data[1] & 0x40) + m_sgb_window_mask = 0; + m_sgb_atf = (data[1] & 0x3f) * (18 * 5); + for (int j = 0; j < 18; j++) + { + for (int i = 0; i < 5; i++) + { + m_sgb_pal_map[i * 4][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0xC0) >> 6; + m_sgb_pal_map[(i * 4) + 1][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0x30) >> 4; + m_sgb_pal_map[(i * 4) + 2][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0xC) >> 2; + m_sgb_pal_map[(i * 4) + 3][j] = m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0x3; + } + } + } + break; + case 0x17: /* MASK_EN */ + m_sgb_window_mask = data[1]; + break; + case 0x18: /* OBJ_TRN */ + /* Not Implemnted */ + break; + case 0x19: /* ? */ + /* Called by: dkl,dkl2,dkl3,zeldadx + But I don't know what it is for. */ + /* Not Implemented */ + break; + case 0x1E: /* Used by bootrom to transfer the gb cart header */ + break; + case 0x1F: /* Used by bootrom to transfer the gb cart header */ + break; + default: + logerror( "SGB: Unknown Command 0x%02x!\n", data[0] >> 3 ); + } + +} diff --git a/src/mame/video/gb_lcd.h b/src/mame/video/gb_lcd.h new file mode 100644 index 00000000000..31bd0c30403 --- /dev/null +++ b/src/mame/video/gb_lcd.h @@ -0,0 +1,215 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/***************************************************************************** + * + * video/gb_lcd.h + * + ****************************************************************************/ + +#ifndef __GB_LCD_H__ +#define __GB_LCD_H__ + +#include "emu.h" + + +#define _NR_GB_VID_REGS 0x40 + + +struct layer_struct { + UINT8 enabled; + UINT8 *bg_tiles; + UINT8 *bg_map; + UINT8 xindex; + UINT8 xshift; + UINT8 xstart; + UINT8 xend; + /* GBC specific */ + UINT8 *gbc_map; + INT16 bgline; +}; + + +class gb_lcd_device : public device_t, + public device_video_interface +{ +public: + gb_lcd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + gb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER(vram_r); + DECLARE_WRITE8_MEMBER(vram_w); + DECLARE_READ8_MEMBER(oam_r); + DECLARE_WRITE8_MEMBER(oam_w); + virtual DECLARE_READ8_MEMBER(video_r); + virtual DECLARE_WRITE8_MEMBER(video_w); + + // FIXME: remove it when proper sgb support is added + void set_sgb_hack(bool val) { m_sgb_border_hack = val ? 1 : 0; } + +protected: + inline void plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + + void select_sprites(); + virtual void update_sprites(); + virtual void update_scanline(); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + void common_start(); + void common_reset(); + + // pointer to the main system + cpu_device *m_maincpu; + + // state variables + bitmap_ind16 m_bitmap; + + UINT8 m_sgb_atf_data[4050]; /* (SGB) Attributes files */ + UINT32 m_sgb_atf; + UINT16 m_sgb_pal_data[4096]; + UINT8 m_sgb_pal_map[20][18]; + UINT16 m_sgb_pal[128]; + UINT8 *m_sgb_tile_data; + UINT8 m_sgb_tile_map[2048]; + UINT8 m_sgb_window_mask; + + // this is temporarily needed for a bunch of games which draw the border differently... + int m_sgb_border_hack; + + int m_window_lines_drawn; + + UINT8 m_vid_regs[_NR_GB_VID_REGS]; + UINT8 m_bg_zbuf[160]; + + UINT16 m_cgb_bpal[32]; /* CGB current background palette table */ + UINT16 m_cgb_spal[32]; /* CGB current sprite palette table */ + + UINT8 m_gb_bpal[4]; /* Background palette */ + UINT8 m_gb_spal0[4]; /* Sprite 0 palette */ + UINT8 m_gb_spal1[4]; /* Sprite 1 palette */ + + /* Things used to render current line */ + int m_current_line; /* Current line */ + int m_cmp_line; /* Compare line */ + int m_sprCount; /* Number of sprites on current line */ + int m_sprite[10]; /* References to sprites to draw on current line */ + int m_previous_line; /* Previous line we've drawn in */ + int m_start_x; /* Pixel to start drawing from (inclusive) */ + int m_end_x; /* Pixel to end drawing (exclusive) */ + int m_mode; /* Keep track of internal STAT mode */ + int m_state; /* Current state of the video state machine */ + int m_lcd_irq_line; + int m_triggering_line_irq; + int m_line_irq; + int m_triggering_mode_irq; + int m_mode_irq; + int m_delayed_line_irq; + int m_sprite_cycles; + int m_scrollx_adjust; + int m_oam_locked; + int m_vram_locked; + int m_pal_locked; + int m_hdma_enabled; + int m_hdma_possible; + struct layer_struct m_layer[2]; + emu_timer *m_lcd_timer; + int m_gbc_mode; + + UINT8 *m_vram; // Pointer to VRAM + UINT8 *m_oam; // Pointer to OAM memory + UINT8 m_gb_tile_no_mod; + UINT32 m_gb_chrgen_offs; // GB Character generator + UINT32 m_gb_bgdtab_offs; // GB Background character table + UINT32 m_gb_wndtab_offs; // GB Window character table + UINT32 m_gbc_chrgen_offs; // CGB Character generator + UINT32 m_gbc_bgdtab_offs; // CGB Background character table + UINT32 m_gbc_wndtab_offs; // CGB Window character table + int m_vram_bank; + + TIMER_CALLBACK_MEMBER(video_init_vbl); + virtual TIMER_CALLBACK_MEMBER(lcd_timer_proc); + virtual void videoptr_restore(); + void save_gb_video(); + void increment_scanline(); + void lcd_switch_on(); +}; + + +class mgb_lcd_device : public gb_lcd_device +{ +public: + mgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + + // device-level overrides + virtual void device_start(); +}; + + +class sgb_lcd_device : public gb_lcd_device +{ +public: + sgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + void sgb_io_write_pal(int offs, UINT8 *data); + +protected: + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + virtual void update_sprites(); + virtual void update_scanline(); + void refresh_border(); +}; + + +class cgb_lcd_device : public gb_lcd_device +{ +public: + cgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual DECLARE_READ8_MEMBER(video_r); + virtual DECLARE_WRITE8_MEMBER(video_w); + +protected: + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + virtual void update_sprites(); + virtual void update_scanline(); + + virtual TIMER_CALLBACK_MEMBER(lcd_timer_proc); + virtual void videoptr_restore(); + void hdma_trans(UINT16 length); +}; + + +extern const device_type GB_LCD_DMG; +extern const device_type GB_LCD_MGB; +extern const device_type GB_LCD_SGB; +extern const device_type GB_LCD_CGB; + + +#define MCFG_GB_LCD_DMG_ADD(_tag ) \ + MCFG_DEVICE_ADD( _tag, GB_LCD_DMG, 0 ) + +#define MCFG_GB_LCD_MGB_ADD(_tag ) \ + MCFG_DEVICE_ADD( _tag, GB_LCD_MGB, 0 ) + +#define MCFG_GB_LCD_SGB_ADD(_tag ) \ + MCFG_DEVICE_ADD( _tag, GB_LCD_SGB, 0 ) + +#define MCFG_GB_LCD_CGB_ADD(_tag ) \ + MCFG_DEVICE_ADD( _tag, GB_LCD_CGB, 0 ) + + +#endif /* GB_LCD_H_ */ diff --git a/src/mame/video/gba.c b/src/mame/video/gba.c new file mode 100644 index 00000000000..0699f047c98 --- /dev/null +++ b/src/mame/video/gba.c @@ -0,0 +1,1901 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont,Ryan Holtz +/*************************************************************************** + + gba.c + + File to handle emulation of the video hardware of the Game Boy Advance + + By R. Belmont, MooglyGuy + +***************************************************************************/ + +#include "emu.h" +#include "includes/gba.h" + +#define VERBOSE_LEVEL (0) + +INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ...) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%08x: %s", machine.driver_data()->m_maincpu->pc(), buf ); + } +} + +static const int coeff[32] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +/* Utility functions */ +INLINE UINT32 alpha_blend_pixel(UINT32 color0, UINT32 color1, int ca, int cb); +INLINE UINT32 increase_brightness(UINT32 color, int coeff_); +INLINE UINT32 decrease_brightness(UINT32 color, int coeff_); + +#define GBA_MODE0 0 +#define GBA_MODE1 1 +#define GBA_MODE2 2 +#define GBA_MODE345 3 + +#define GBA_SUBMODE0 0 +#define GBA_SUBMODE1 1 +#define GBA_SUBMODE2 2 + +inline void gba_state::update_mask(UINT8* mask, int mode, int submode, UINT32* obj_win, UINT8 inwin0, UINT8 inwin1, UINT8 in0_mask, UINT8 in1_mask, UINT8 out_mask) +{ + UINT8 mode_mask = 0; + if (submode == GBA_SUBMODE2) + { + for (int x = 0; x < 240; x++) + { + mask[x] = out_mask; + + if ((obj_win[x] & 0x80000000) == 0) + mask[x] = m_WINOUT >> 8; + + if (inwin1) + { + if (is_in_window(x, 1)) + mask[x] = in1_mask; + } + + if (inwin0) + { + if (is_in_window(x, 0)) + mask[x] = in0_mask; + } + } + } + + if (mode == GBA_MODE1) + { + // disable line3 + mode_mask = ~0x08; + } + else if (mode == GBA_MODE2) + { + // disable line0 & line1 + mode_mask = ~0x03; + } + else if (mode == GBA_MODE345) + { + // disable line0, line1 & line3 + mode_mask = ~0x0b; + } + + + if (mode_mask) + { + for (int x = 0; x < 240; x++) + mask[x] &= mode_mask; + } +} + +void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) +{ + UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; + int inWindow0 = 0; + int inWindow1 = 0; + UINT8 inWin0Mask = m_WININ & 0x00ff; + UINT8 inWin1Mask = m_WININ >> 8; + UINT8 outMask = m_WINOUT & 0x00ff; + UINT8 masks[240]; // this puts together WinMasks with the fact that some modes/submodes skip specific layers! + + if (submode == GBA_SUBMODE2) + { + if (m_DISPCNT & DISPCNT_WIN0_EN) + { + UINT8 v0 = m_WIN0V >> 8; + UINT8 v1 = m_WIN0V & 0x00ff; + inWindow0 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; + if (v1 >= v0) + inWindow0 |= (y >= v0 && y < v1) ? 1 : 0; + else + inWindow0 |= (y >= v0 || y < v1) ? 1 : 0; + } + + if (m_DISPCNT & DISPCNT_WIN1_EN) + { + UINT8 v0 = m_WIN1V >> 8; + UINT8 v1 = m_WIN1V & 0x00ff; + inWindow1 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; + if (v1 >= v0) + inWindow1 |= (y >= v0 && y < v1) ? 1 : 0; + else + inWindow1 |= (y >= v0 || y < v1) ? 1 : 0; + } + } + + // Draw BG + switch (mode) + { + case 0: + draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); + draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); + draw_bg_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2HOFS, m_BG2VOFS); + draw_bg_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3HOFS, m_BG3VOFS); + break; + case 1: + draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); + draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); + draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); + break; + case 2: + draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); + draw_roz_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3X, m_BG3Y, m_BG3PA, m_BG3PB, m_BG3PC, m_BG3PD, &m_gfxBG3X, &m_gfxBG3Y, m_gfxBG3Changed); + break; + case 3: + case 4: + case 5: + draw_roz_bitmap_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed, bpp); + break; + } + + // Draw OAM + draw_gba_oam(lineOBJ, y); + if (submode == GBA_SUBMODE2) + draw_gba_oam_window(lineOBJWin, y); + + memset(masks, 0xff, sizeof(masks)); + update_mask(&masks[0], mode, submode, lineOBJWin, inWindow0, inWindow1, inWin0Mask, inWin1Mask, outMask); + + for (int x = 0; x < 240; x++) + { + UINT32 color = backdrop; + UINT8 top = 0x20; + + if ((UINT8)(line0[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x01) + { + color = line0[x]; + top = 0x01; + } + + if ((UINT8)(line1[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x02) + { + color = line1[x]; + top = 0x02; + } + + if ((UINT8)(line2[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x04) + { + color = line2[x]; + top = 0x04; + } + + if ((UINT8)(line3[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x08) + { + color = line3[x]; + top = 0x08; + } + + if ((UINT8)(lineOBJ[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x10) + { + color = lineOBJ[x]; + top = 0x10; + } + + if (color & 0x00010000) + { + if (submode != GBA_SUBMODE0 || top == 0x10) + { + UINT32 back = backdrop; + UINT8 top2 = 0x20; + + if ((UINT8)(line0[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x01) + { + back = line0[x]; + top2 = 0x01; + } + + if ((UINT8)(line1[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x02) + { + back = line1[x]; + top2 = 0x02; + } + + if ((UINT8)(line2[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x04) + { + back = line2[x]; + top2 = 0x04; + } + + if ((UINT8)(line3[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x08) + { + back = line3[x]; + top2 = 0x08; + } + + if (top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) + color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); + else + { + if (top & m_BLDCNT) + { + switch(m_BLDCNT & BLDCNT_SFX) + { + case BLDCNT_SFX_LIGHTEN: + color = increase_brightness(color, coeff[m_BLDY & 0x1f]); + break; + case BLDCNT_SFX_DARKEN: + color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); + break; + } + } + } + } + } + else if (submode == GBA_SUBMODE1 || (submode == GBA_SUBMODE2 && masks[x] & 0x20)) + { + if (top & m_BLDCNT) + { + switch(m_BLDCNT & BLDCNT_SFX) + { + case BLDCNT_SFX_NONE: + break; + case BLDCNT_SFX_ALPHA: + { + UINT32 back = backdrop; + UINT8 top2 = 0x20; + + if ((UINT8)(line0[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x01) + { + if (top != 0x01) + { + back = line0[x]; + top2 = 0x01; + } + } + + if ((UINT8)(line1[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x02) + { + if (top != 0x02) + { + back = line1[x]; + top2 = 0x02; + } + } + + if ((UINT8)(line2[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x04) + { + if (top != 0x04) + { + back = line2[x]; + top2 = 0x04; + } + } + + if ((UINT8)(line3[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x08) + { + if (top != 0x08) + { + back = line3[x]; + top2 = 0x08; + } + } + + if ((UINT8)(lineOBJ[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x10) + { + if (top != 0x10) + { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if (top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) + color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); + } + break; + case BLDCNT_SFX_LIGHTEN: + color = increase_brightness(color, coeff[m_BLDY & 0x1f]); + break; + case BLDCNT_SFX_DARKEN: + color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); + break; + } + } + } + lineMix[x] = color; + } + if (mode == GBA_MODE1 || mode == GBA_MODE2 || mode == GBA_MODE345) + m_gfxBG2Changed = 0; + if (mode == GBA_MODE2) + m_gfxBG3Changed = 0; +} + +void gba_state::draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth) +{ + UINT8 *src8 = (UINT8 *)m_gba_vram.target(); + UINT16 *src16 = (UINT16 *)m_gba_vram.target(); + UINT16 *palette = (UINT16 *)m_gba_pram.target(); + INT32 sx = (depth == 4) ? 160 : 240; + INT32 sy = (depth == 4) ? 128 : 160; + UINT32 prio = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; + INT32 cx, cy, pixx, pixy, x; + + if ((depth == 8) && (m_DISPCNT & DISPCNT_FRAMESEL)) + src8 += 0xa000; + + if ((depth == 4) && (m_DISPCNT & DISPCNT_FRAMESEL)) + src16 += 0xa000/2; + + // sign extend roz parameters + if (X & 0x08000000) X |= 0xf0000000; + if (Y & 0x08000000) Y |= 0xf0000000; + if (PA & 0x8000) PA |= 0xffff0000; + if (PB & 0x8000) PB |= 0xffff0000; + if (PC & 0x8000) PC |= 0xffff0000; + if (PD & 0x8000) PD |= 0xffff0000; + + if(ypos == 0) + changed = 3; + + if(changed & 1) + *currentx = X; + else + *currentx += PB; + + if(changed & 2) + *currenty = Y; + else + *currenty += PD; + + cx = *currentx; + cy = *currenty; + + if(ctrl & BGCNT_MOSAIC) + { + INT32 mosaic_line = ((m_MOSAIC & 0xf0) >> 4) + 1; + INT32 tempy = (ypos / mosaic_line) * mosaic_line; + cx = X + tempy*PB; + cy = Y + tempy*PD; + } + + pixx = cx >> 8; + pixy = cy >> 8; + + for(x = 0; x < 240; x++) + { + if(pixx < 0 || pixy < 0 || pixx >= sx || pixy >= sy) + { + scanline[x] = 0x80000000; + } + else + { + if (depth == 8) + { + UINT8 color = src8[pixy*sx + pixx]; + scanline[x] = color ? (palette[color] | prio) : 0x80000000; + } + else + { + scanline[x] = src16[pixy*sx + pixx] | prio; + } + } + + cx += PA; + cy += PC; + + pixx = cx >> 8; + pixy = cy >> 8; + } + + if(ctrl & BGCNT_MOSAIC) + { + INT32 mosaicx = (m_MOSAIC & 0x0f) + 1; + if(mosaicx > 1) + { + INT32 m = 1; + for(x = 0; x < 239; x++) + { + scanline[x+1] = scanline[x]; + m++; + if(m == mosaicx) + { + m = 1; + x++; + } + } + } + } +} + +void gba_state::draw_roz_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed) +{ + UINT32 base, mapbase, size; + static const INT32 sizes[4] = { 128, 256, 512, 1024 }; + INT32 cx, cy, pixx, pixy; + UINT8 *mgba_vram = (UINT8 *)m_gba_vram.target(); + UINT32 tile; + UINT16 *pgba_pram = (UINT16 *)m_gba_pram.target(); + UINT16 pixel; + UINT32 prio = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; + int x = 0; + + for (x = 0; x < 240; x++) + scanline[x] = 0x80000000; + + if (m_DISPCNT & enablemask) + { + base = ((ctrl & BGCNT_CHARBASE) >> BGCNT_CHARBASE_SHIFT) * 0x4000; // VRAM base of tiles + mapbase = ((ctrl & BGCNT_SCREENBASE) >> BGCNT_SCREENBASE_SHIFT) * 0x800; // VRAM base of map + size = (ctrl & BGCNT_SCREENSIZE) >> BGCNT_SCREENSIZE_SHIFT; // size of map in submaps + + // sign extend roz parameters + if (X & 0x08000000) X |= 0xf0000000; + if (Y & 0x08000000) Y |= 0xf0000000; + if (PA & 0x8000) PA |= 0xffff0000; + if (PB & 0x8000) PB |= 0xffff0000; + if (PC & 0x8000) PC |= 0xffff0000; + if (PD & 0x8000) PD |= 0xffff0000; + + if(ypos == 0) + changed = 3; + + if(changed & 1) + *currentx = X; + else + *currentx += PB; + + if(changed & 2) + *currenty = Y; + else + *currenty += PD; + + cx = *currentx; + cy = *currenty; + + if(ctrl & BGCNT_MOSAIC) + { + int mosaic_line = ((m_MOSAIC & 0xf0) >> 4) + 1; + int y = ypos % mosaic_line; + cx -= y*PB; + cy -= y*PD; + } + + pixx = cx >> 8; + pixy = cy >> 8; + + if(ctrl & BGCNT_PALETTESET_WRAP) + { + pixx %= sizes[size]; + pixy %= sizes[size]; + if(pixx < 0) + { + pixx += sizes[size]; + } + if(pixy < 0) + { + pixy += sizes[size]; + } + } + + for(x = 0; x < 240; x++) + { + if(pixx < 0 || pixy < 0 || pixx >= sizes[size] || pixy >= sizes[size]) + { + scanline[x] = 0x80000000; + } + else + { + int tilex = pixx & 7; + int tiley = pixy & 7; + + // shall we shift for (ctrl & BGCNT_PALETTE256)?? or is not effective for ROZ? + tile = mgba_vram[mapbase + (pixx >> 3) + (pixy >> 3) * (sizes[size] >> 3)]; + pixel = mgba_vram[base + (tile << 6) + (tiley << 3) + tilex]; + + // plot it + scanline[x] = pixel ? (pgba_pram[pixel] | prio) : 0x80000000; + } + + cx += PA; + cy += PC; + + pixx = cx >> 8; + pixy = cy >> 8; + + if(ctrl & BGCNT_PALETTESET_WRAP) + { + pixx %= sizes[size]; + pixy %= sizes[size]; + if(pixx < 0) + { + pixx += sizes[size]; + } + if(pixy < 0) + { + pixy += sizes[size]; + } + } + } + + if(ctrl & BGCNT_MOSAIC) + { + int mosaicx = (m_MOSAIC & 0x0f) + 1; + if(mosaicx > 1) + { + int m = 1; + for(x = 0; x < 239; x++) + { + scanline[x+1] = scanline[x]; + m++; + if(m == mosaicx) + { + m = 1; + x++; + } + } + } + } + } +} + +void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, UINT32 hofs, UINT32 vofs) +{ + UINT8 *vram = (UINT8*)m_gba_vram.target(); + UINT16 *palette = (UINT16*)m_gba_pram.target(); + UINT8 *chardata = &vram[((ctrl & BGCNT_CHARBASE) >> BGCNT_CHARBASE_SHIFT) * 0x4000]; + UINT16 *screendata = (UINT16*)&vram[((ctrl & BGCNT_SCREENBASE) >> BGCNT_SCREENBASE_SHIFT) * 0x800]; + UINT32 priority = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; + INT32 width = 256; + INT32 height = 256; + INT32 maskx, masky, pixx, pixy; + UINT8 use_mosaic = (ctrl & BGCNT_MOSAIC) ? 1 : 0; + INT32 mosaicx = (m_MOSAIC & 0x000f) + 1; + INT32 mosaicy = ((m_MOSAIC & 0x00f0) >> 4) + 1; + INT32 stride; + int x = 0; + + for (x = 0; x < 240; x++) + scanline[x] = 0x80000000; + + if(m_DISPCNT & enablemask) + { + switch((ctrl & BGCNT_SCREENSIZE) >> BGCNT_SCREENSIZE_SHIFT) + { + case 1: + width = 512; + break; + case 2: + height = 512; + break; + case 3: + width = 512; + height = 512; + break; + } + + maskx = width - 1; + masky = height - 1; + + pixx = hofs & maskx; + pixy = (vofs + ypos) & masky; + + if(use_mosaic) + { + if((ypos % mosaicy) != 0) + { + mosaicy = (ypos / mosaicy) * mosaicy; + pixy = (vofs + mosaicy) & masky; + } + } + + if(pixy > 255 && height > 256) + { + pixy &= 0x000000ff; + screendata += 0x400; + if(width > 256) + { + screendata += 0x400; + } + } + + stride = (pixy >> 3) << 5; + + UINT16 *src = screendata + 0x400 * (pixx >> 8) + ((pixx & 255) >> 3) + stride; + for(x = 0; x < 240; x++) + { + UINT16 data = *src; + INT32 tile = data & TILEOBJ_TILE; + INT32 tilex = pixx & 7; + INT32 tiley = pixy & 7; + UINT8 color; + UINT8 palindex; + + if(data & TILEOBJ_HFLIP) + { + tilex = 7 - tilex; + } + if(data & TILEOBJ_VFLIP) + { + tiley = 7 - tiley; + } + + if (ctrl & BGCNT_PALETTE256) + { + color = chardata[(tile << 6) + (tiley << 3) + tilex]; + palindex = 0; + } + else + { + color = chardata[(tile << 5) + (tiley << 2) + (tilex >> 1)]; + + if (tilex & 1) + color >>= 4; + else + color &= 0x0f; + palindex = (data >> 8) & 0x00f0; + } + + if (color) + scanline[x] = palette[palindex + color] | priority; + else + scanline[x] = 0x80000000; + + if (data & TILEOBJ_HFLIP) + { + if (tilex == 0) + { + src++; + } + } + else if (tilex == 7) + { + src++; + } + + pixx++; + if(pixx == 256) + { + if(width > 256) + { + src = screendata + 0x400 + stride; + } + else + { + src = screendata + stride; + pixx = 0; + } + } + else if(pixx >= width) + { + pixx = 0; + src = screendata + stride; + } + } + + if(use_mosaic) + { + if(mosaicx > 1) + { + INT32 m = 1; + for(x = 0; x < 239; x++) + { + scanline[x+1] = scanline[x]; + m++; + if(m == mosaicx) + { + m = 1; + x++; + } + } + } + } + + } +} + +void gba_state::draw_gba_oam_window(UINT32 *scanline, int y) +{ + INT16 gba_oamindex; + UINT32 tilebytebase, tileindex, tiledrawindex; + UINT32 width, height; + UINT16 *pgba_oam = (UINT16 *)m_gba_oam.target(); + UINT8 *src = (UINT8*)m_gba_vram.target(); + int x = 0; + + for (x = 0; x < 240; x++) + scanline[x] = 0x80000000; + + if (m_DISPCNT & DISPCNT_OBJWIN_EN) + { + for( gba_oamindex = 127; gba_oamindex >= 0; gba_oamindex-- ) + { + INT32 sx, sy; + UINT16 attr0, attr1, attr2; + INT32 cury; + + attr0 = pgba_oam[(4*gba_oamindex)+0]; + attr1 = pgba_oam[(4*gba_oamindex)+1]; + attr2 = pgba_oam[(4*gba_oamindex)+2]; + + sx = (attr1 & OBJ_X_COORD); + sy = (attr0 & OBJ_Y_COORD); + + if(sy > 160) + { + sy -= 256; + } + + if ((attr0 & OBJ_MODE) != OBJ_MODE_WINDOW) + { + continue; + } + else + { + width = 0; + height = 0; + switch (attr0 & OBJ_SHAPE ) + { + case OBJ_SHAPE_SQR: + switch(attr1 & OBJ_SIZE ) + { + case OBJ_SIZE_8: + width = 1; + height = 1; + break; + case OBJ_SIZE_16: + width = 2; + height = 2; + break; + case OBJ_SIZE_32: + width = 4; + height = 4; + break; + case OBJ_SIZE_64: + width = 8; + height = 8; + break; + } + break; + case OBJ_SHAPE_HORIZ: + switch(attr1 & OBJ_SIZE ) + { + case OBJ_SIZE_8: + width = 2; + height = 1; + break; + case OBJ_SIZE_16: + width = 4; + height = 1; + break; + case OBJ_SIZE_32: + width = 4; + height = 2; + break; + case OBJ_SIZE_64: + width = 8; + height = 4; + break; + } + break; + case OBJ_SHAPE_VERT: + switch(attr1 & OBJ_SIZE ) + { + case OBJ_SIZE_8: + width = 1; + height = 2; + break; + case OBJ_SIZE_16: + width = 1; + height = 4; + break; + case OBJ_SIZE_32: + width = 2; + height = 4; + break; + case OBJ_SIZE_64: + width = 4; + height = 8; + break; + } + break; + default: + width = 0; + height = 0; + verboselog(machine(), 0, "OAM error: Trying to draw OBJ with OBJ_SHAPE = 3!\n" ); + break; + } + + tiledrawindex = tileindex = (attr2 & OBJ_TILENUM); + tilebytebase = 0x10000; // the index doesn't change in the higher modes, we just ignore sprites that are out of range + + if (attr0 & OBJ_ROZMODE_ROZ) + { + INT32 fx, fy, ax, ay, rx, ry; + INT16 dx, dy, dmx, dmy; + UINT8 color; + + width *= 8; + height *= 8; + + if ((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DISABLE) + { + continue; + } + + fx = width; + fy = height; + + if((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DBLROZ) + { + fx *= 2; + fy *= 2; + } + + cury = y - sy; + + if(cury >= 0 && cury < fy) + { + if(sx < 240 || ((sx + fx) & 0x1ff) < 240) + { + int rot = (attr1 & OBJ_SCALE_PARAM) >> OBJ_SCALE_PARAM_SHIFT; + dx = (INT16)pgba_oam[(rot << 4)+3]; + dmx = (INT16)pgba_oam[(rot << 4)+7]; + dy = (INT16)pgba_oam[(rot << 4)+11]; + dmy = (INT16)pgba_oam[(rot << 4)+15]; + + rx = (width << 7) - (fx >> 1)*dx - (fy >> 1)*dmx + cury * dmx; + ry = (height << 7) - (fx >> 1)*dy - (fy >> 1)*dmy + cury * dmy; + + if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) + { + int inc = 32; + if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) + { + continue; + } + if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) + { + inc = sx >> 2; + } + else + { + tiledrawindex &= 0x3fe; + } + for(x = 0; x < fx; x++) + { + ax = rx >> 8; + ay = ry >> 8; + + if(ax < 0 || ax >= sx || ay < 0 || ay >= sy) + { + } + else + { + color = src[tilebytebase + ((((tiledrawindex + (ay >> 3) * inc) << 5) + ((ay & 0x07) << 3) + ((ax >> 3) << 6) + (ax & 0x07)) & 0x7fff)]; + + if(color) + { + scanline[sx] = 1; + } + } + + sx = (sx + 1) & 0x1ff; + + rx += dx; + ry += dy; + } + } + else + { + int inc = 32; + if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) + { + continue; + } + if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) + { + inc = sx >> 3; + } + for(x = 0; x < fx; x++) + { + ax = rx >> 8; + ay = ry >> 8; + + if(ax < 0 || ax >= sx || ay < 0 || ay >= sy) + { + } + else + { + color = src[tilebytebase + ((((tiledrawindex + (ay >> 3) * inc) << 5) + ((ay & 0x07) << 2) + ((ax >> 3) << 5) + ((ax & 0x07) >> 1)) & 0x7fff)]; + + if(ax & 1) + { + color >>= 4; + } + else + { + color &= 0x0f; + } + + if(color) + { + scanline[sx] = 1; + } + } + + sx = (sx + 1) & 0x1ff; + + rx += dx; + ry += dy; + } + } + } + } + } + else + { + INT32 ax; + int cury_ = y - sy; + + width *= 8; + height *= 8; + + if(cury_ >= 0 && cury_ < height) + { + if( ( (sx < 240) || ( ( (sx + width) & 0x1ff ) < 240 ) ) && (attr0 & OBJ_ROZMODE_DISABLE) == 0) + { + if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) + { + int inc = 32; + int address = 0; + if(attr1 & OBJ_VFLIP) + { + cury_ = height - cury_ - 1; + } + if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) + { + continue; + } + + if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) + { + inc = width >> 2; + } + else + { + tiledrawindex &= 0x3fe; + } + + ax = 0; + if(attr1 & OBJ_HFLIP) + { + ax = width - 1; + } + + address = 0x10000 + ((((tiledrawindex + (cury_ >> 3) * inc) << 5) + ((cury_ & 7) << 3) + ((ax >> 3) << 6) + (ax & 7)) & 0x7fff); + + if(attr1 & OBJ_HFLIP) + { + ax = 7; + } + + for(x = 0; x < width; x++) + { + if(sx < 240) + { + UINT8 color = src[address]; + + if(color) + { + scanline[sx] = 1; + } + } + + sx = (sx + 1) & 0x1ff; + + if(attr1 & OBJ_HFLIP) + { + ax--; + address--; + if(ax == -1) + { + address -= 56; + ax = 7; + } + if(address < 0x10000) + { + address += 0x8000; + } + } + else + { + ax++; + address++; + if(ax == 8) + { + address += 56; + ax = 0; + } + if(address > 0x17fff) + { + address -= 0x8000; + } + } + } + } + else + { + int inc = 32; + UINT32 address; + if(attr1 & OBJ_VFLIP) + { + cury_ = height - cury_ - 1; + } + if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) + { + continue; + } + + if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) + { + inc = width >> 3; + } + + ax = 0; + if(attr1 & OBJ_HFLIP) + { + ax = width - 1; + } + + address = 0x10000 + ((((tiledrawindex + (cury_ >> 3) * inc) << 5) + ((cury_ & 0x07) << 2) + ((ax >> 3) << 5) + ((ax & 0x07) >> 1)) & 0x7fff); + if(attr1 & OBJ_HFLIP) + { + ax = 7; + for(x = width - 1; x >= 0; x--) + { + if(sx < 240) + { + UINT8 color = src[address]; + if(x & 1) + { + color >>= 4; + } + else + { + color &= 0x0f; + } + + if(color) + { + scanline[sx] = 1; + } + } + + sx = (sx + 1) & 0x1ff; + ax--; + if((x & 1) == 0) + { + address--; + } + if(ax == -1) + { + ax = 7; + address -= 28; + } + if(address < 0x10000) + { + address += 0x8000; + } + } + } + else + { + for(x = 0; x < width; x++) + { + if(sx < 240) + { + UINT8 color = src[address]; + + if(x & 1) + { + color >>= 4; + } + else + { + color &= 0x0f; + } + + if(color) + { + scanline[sx] = 1; + } + } + + sx = (sx + 1) & 0x1ff; + ax++; + if(x & 1) + { + address++; + } + if(ax == 8) + { + address += 28; + ax = 0; + } + if(address > 0x17fff) + { + address -= 0x8000; + } + } + } + } + } + } + } + } + } + } +} + +void gba_state::draw_gba_oam(UINT32 *scanline, int y) +{ + INT16 gba_oamindex; + INT32 mosaiccnt = 0; + INT32 mosaicy = ((m_MOSAIC & 0xf000) >> 12) + 1; + INT32 mosaicx = ((m_MOSAIC & 0x0f00) >> 8) + 1; + UINT32 tileindex, tiledrawindex; //, tilebytebase + UINT8 width, height; + UINT16 *pgba_oam = (UINT16 *)m_gba_oam.target(); + UINT8 *src = (UINT8 *)m_gba_vram.target(); + UINT16 *palette = (UINT16*)m_gba_pram.target(); + int x = 0; + + for (x = 0; x < 240; x++) + scanline[x] = 0x80000000; + + if( m_DISPCNT & DISPCNT_OBJ_EN ) + { + for( gba_oamindex = 0; gba_oamindex < 128; gba_oamindex++ ) + { + UINT16 attr0, attr1, attr2; + INT32 cury; + UINT32 prio; + UINT32 priority; + + attr0 = pgba_oam[(4*gba_oamindex)+0]; + attr1 = pgba_oam[(4*gba_oamindex)+1]; + attr2 = pgba_oam[(4*gba_oamindex)+2]; + priority = (attr2 & OBJ_PRIORITY) >> OBJ_PRIORITY_SHIFT; + prio = (priority << 25) | ((attr0 & OBJ_MODE) << 6); + + if ((attr0 & OBJ_MODE) != OBJ_MODE_WINDOW) + { + width = 0; + height = 0; + switch (attr0 & OBJ_SHAPE) + { + case OBJ_SHAPE_SQR: + switch(attr1 & OBJ_SIZE ) + { + case OBJ_SIZE_8: + width = 1; + height = 1; + break; + case OBJ_SIZE_16: + width = 2; + height = 2; + break; + case OBJ_SIZE_32: + width = 4; + height = 4; + break; + case OBJ_SIZE_64: + width = 8; + height = 8; + break; + } + break; + case OBJ_SHAPE_HORIZ: + switch(attr1 & OBJ_SIZE ) + { + case OBJ_SIZE_8: + width = 2; + height = 1; + break; + case OBJ_SIZE_16: + width = 4; + height = 1; + break; + case OBJ_SIZE_32: + width = 4; + height = 2; + break; + case OBJ_SIZE_64: + width = 8; + height = 4; + break; + } + break; + case OBJ_SHAPE_VERT: + switch(attr1 & OBJ_SIZE ) + { + case OBJ_SIZE_8: + width = 1; + height = 2; + break; + case OBJ_SIZE_16: + width = 1; + height = 4; + break; + case OBJ_SIZE_32: + width = 2; + height = 4; + break; + case OBJ_SIZE_64: + width = 4; + height = 8; + break; + } + break; + default: + width = 0; + height = 0; + verboselog(machine(), 0, "OAM error: Trying to draw OBJ with OBJ_SHAPE = 3!\n" ); + break; + } + + tiledrawindex = tileindex = (attr2 & OBJ_TILENUM); +// tilebytebase = 0x10000; // the index doesn't change in the higher modes, we just ignore sprites that are out of range + + if (attr0 & OBJ_ROZMODE_ROZ) + { + INT32 sx, sy; + INT32 fx, fy, rx, ry; + INT16 dx, dy, dmx, dmy; + + width *= 8; + height *= 8; + + if ((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DISABLE) + { + continue; + } + + sx = (attr1 & OBJ_X_COORD); + sy = (attr0 & OBJ_Y_COORD); + + if(sy > 160) + { + sy -= 256; + } + + fx = width; + fy = height; + + if((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DBLROZ) + { + fx *= 2; + fy *= 2; + } + + cury = y - sy; + + if(cury >= 0 && cury < fy) + { + if(sx < 240 || ((sx + fx) & 0x1ff) < 240) + { + INT32 oamparam = (attr1 & OBJ_SCALE_PARAM) >> OBJ_SCALE_PARAM_SHIFT; + + dx = (INT16)pgba_oam[(oamparam << 4)+3]; + dmx = (INT16)pgba_oam[(oamparam << 4)+7]; + dy = (INT16)pgba_oam[(oamparam << 4)+11]; + dmy = (INT16)pgba_oam[(oamparam << 4)+15]; + + if(attr0 & OBJ_MOSAIC) + { + cury -= (cury % mosaicy); + } + + rx = (width << 7) - (fx >> 1)*dx - (fy >> 1)*dmx + cury*dmx; + ry = (height << 7) - (fx >> 1)*dy - (fy >> 1)*dmy + cury*dmy; + + if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) + { + INT32 inc = 32; + + if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) + { + continue; + } + + if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) + { + inc = width >> 2; + } + else + { + tiledrawindex &= 0x3fe; + } + + for(x = 0; x < fx; x++) + { + INT32 pixx = rx >> 8; + INT32 pixy = ry >> 8; + + if(!(pixx < 0 || pixx >= width || pixy < 0 || pixy >= height || sx >= 240)) + { + UINT8 color = src[0x10000 + ((((tiledrawindex + (pixy >> 3) * inc) << 5) + ((pixy & 7) << 3) + ((pixx >> 3) << 6) + (pixx & 7)) & 0x7fff)]; + if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) + { + scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + else if(color != 0 && prio < (scanline[sx] & 0xff000000)) + { + scanline[sx] = palette[256 + color] | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + + if(attr0 & OBJ_MOSAIC) + { + mosaiccnt++; + if(mosaiccnt == mosaicx) + { + mosaiccnt = 0; + } + } + } + + sx++; + sx &= 0x1ff; + + rx += dx; + ry += dy; + } + } + else + { + INT32 inc = 32; + INT32 palentry = (attr2 >> 8) & 0xf0; + + if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) + { + continue; + } + + if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) + { + inc = width >> 3; + } + + for(x = 0; x < fx; x++) + { + INT32 pixx = rx >> 8; + INT32 pixy = ry >> 8; + + if(!(pixx < 0 || pixx >= width || pixy < 0 || pixy >= height || sx >= 240)) + { + UINT8 color = src[0x10000 + ((((tiledrawindex + (pixy >> 3) * inc) << 5) + ((pixy & 7) << 2) + ((pixx >> 3) << 5) + ((pixx & 7) >> 1)) & 0x7fff)]; + + if(pixx & 1) + { + color >>= 4; + } + else + { + color &= 0x0f; + } + + if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) + { + scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + else if(color != 0 && prio < (scanline[sx] & 0xff000000)) + { + scanline[sx] = palette[256 + palentry + color] | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + } + + if(attr0 & OBJ_MOSAIC) + { + mosaiccnt++; + if(mosaiccnt == mosaicx) + { + mosaiccnt = 0; + } + } + + sx++; + + sx &= 0x1ff; + + rx += dx; + ry += dy; + } + } + } + } + } + else + { + INT32 sx, sy; + INT32 vflip = (attr1 & OBJ_VFLIP) ? 1 : 0; + INT32 hflip = (attr1 & OBJ_HFLIP) ? 1 : 0; + + width *= 8; + height *= 8; + + if ((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DISABLE) + { + continue; + } + + sx = (attr1 & OBJ_X_COORD); + sy = (attr0 & OBJ_Y_COORD); + + if(sy > 160) + { + sy -= 256; + } + + cury = y - sy; + if(cury >= 0 && cury < height) + { + if(sx < 240 || ((sx + width) & 0x1ff) < 240) + { + if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) + { + INT32 pixx; + INT32 inc = 32; + INT32 address = 0; + + if(vflip) + { + cury = height - cury - 1; + } + + if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) + { + continue; + } + + if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) + { + inc = width >> 2; + } + else + { + tiledrawindex &= 0x3fe; + } + + pixx = 0; + if(hflip) + { + pixx = width - 1; + } + + if(attr0 & OBJ_MOSAIC) + { + cury -= (cury % mosaicy); + } + + address = 0x10000 + ((((tiledrawindex + (cury >> 3) * inc) << 5) + ((cury & 7) << 3) + ((pixx >> 3) << 6) + (pixx & 7)) & 0x7fff); + + if(hflip) + { + pixx = 7; + } + + for(x = 0; x < width; x++) + { + if(sx < 240) + { + UINT8 color = src[address]; + if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) + { + scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + else if(color != 0 && prio < (scanline[sx] & 0xff000000)) + { + scanline[sx] = palette[256 + color] | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + } + + if(attr0 & OBJ_MOSAIC) + { + mosaiccnt++; + if(mosaiccnt == mosaicx) + { + mosaiccnt = 0; + } + } + + sx++; + sx &= 0x1ff; + + if(hflip) + { + pixx--; + address--; + if(pixx == -1) + { + address -= 56; + pixx = 7; + } + if(address < 0x10000) + { + address += 0x8000; + } + } + else + { + pixx++; + address++; + if(pixx == 8) + { + address += 56; + pixx = 0; + } + if(address > 0x17fff) + { + address -= 0x8000; + } + } + } + } + else + { + INT32 pixx; + INT32 inc = 32; + UINT32 address = 0; + + if(vflip) + { + cury = height - cury - 1; + } + + if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) + { + continue; + } + + if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) + { + inc = width >> 3; + } + + pixx = 0; + if(hflip) + { + pixx = width - 1; + } + + if(attr0 & OBJ_MOSAIC) + { + cury -= (cury % mosaicy); + } + + address = 0x10000 + ((((tiledrawindex + (cury >> 3) * inc) << 5) + ((cury & 7) << 2) + ((pixx >> 3) << 5) + ((pixx & 7) >> 1)) & 0x7fff); + + if(hflip) + { + pixx = 7; + for(x = width - 1; x >= 0; x--) + { + if(sx < 240) + { + UINT8 color = src[address]; + UINT8 palentry = (attr2 >> 8) & 0xf0; + + if(x & 1) + { + color >>= 4; + } + else + { + color &= 0x0f; + } + + if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) + { + scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + else if(color != 0 && prio < (scanline[sx] & 0xff000000)) + { + scanline[sx] = palette[256 + palentry + color] | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + } + + sx++; + sx &= 0x1ff; + + pixx--; + if(!(x & 1)) + { + address--; + } + if(pixx == -1) + { + address -= 28; + pixx = 7; + } + if(address < 0x10000) + { + address += 0x8000; + } + } + } + else + { + for(x = 0; x < width; x++) + { + if(sx < 240) + { + UINT8 color = src[address]; + UINT8 palentry = (attr2 >> 8) & 0xf0; + + if(x & 1) + { + color >>= 4; + } + else + { + color &= 0x0f; + } + + if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) + { + scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + else if(color != 0 && prio < (scanline[sx] & 0xff000000)) + { + scanline[sx] = palette[256 + palentry + color] | prio; + if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) + { + scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; + } + } + } + + if(attr0 & OBJ_MOSAIC) + { + mosaiccnt++; + if(mosaiccnt == mosaicx) + { + mosaiccnt = 0; + } + } + + sx++; + sx &= 0x1ff; + + pixx++; + if(x & 1) + { + address++; + } + if(pixx == 8) + { + address += 28; + pixx = 0; + } + if(address > 0x17fff) + { + address -= 0x8000; + } + } + } + } + } + } + } + } + } + } +} + +inline int gba_state::is_in_window(int x, int window) +{ + int x0 = m_WIN0H >> 8; + int x1 = m_WIN0H & 0x00ff; + + if(window == 1) + { + x0 = m_WIN1H >> 8; + x1 = m_WIN1H & 0x00ff; + } + + if(x0 <= x1) + { + if(x >= x0 && x < x1) + { + return 1; + } + } + else + { + if(x >= x0 || x < x1) + { + return 1; + } + } + + return 0; +} + +INLINE UINT32 alpha_blend_pixel(UINT32 color0, UINT32 color1, int ca, int cb) +{ + if(color0 < 0x80000000) + { + int r0 = (color0 >> 0) & 0x1f; + int g0 = (color0 >> 5) & 0x1f; + int b0 = (color0 >> 10) & 0x1f; + int r1 = (color1 >> 0) & 0x1f; + int g1 = (color1 >> 5) & 0x1f; + int b1 = (color1 >> 10) & 0x1f; + int r = ((r0 * ca) >> 4) + ((r1 * cb) >> 4); + int g = ((g0 * ca) >> 4) + ((g1 * cb) >> 4); + int b = ((b0 * ca) >> 4) + ((b1 * cb) >> 4); + + if(r > 0x1f) r = 0x1f; + if(g > 0x1f) g = 0x1f; + if(b > 0x1f) b = 0x1f; + + return (color0 & 0xffff0000) | (b << 10) | (g << 5) | r; + } + return color0; +} + +INLINE UINT32 increase_brightness(UINT32 color, int coeff_) +{ + int r = (color >> 0) & 0x1f; + int g = (color >> 5) & 0x1f; + int b = (color >> 10) & 0x1f; + + r += ((0x1f - r) * coeff_) >> 4; + g += ((0x1f - g) * coeff_) >> 4; + b += ((0x1f - b) * coeff_) >> 4; + + if(r > 0x1f) r = 0x1f; + if(g > 0x1f) g = 0x1f; + if(b > 0x1f) b = 0x1f; + + return (color & 0xffff0000) | (b << 10) | (g << 5) | r; +} + +INLINE UINT32 decrease_brightness(UINT32 color, int coeff_) +{ + int r = (color >> 0) & 0x1f; + int g = (color >> 5) & 0x1f; + int b = (color >> 10) & 0x1f; + + r -= (r * coeff_) >> 4; + g -= (g * coeff_) >> 4; + b -= (b * coeff_) >> 4; + + if(r < 0) r = 0; + if(g < 0) g = 0; + if(b < 0) b = 0; + + return (color & 0xffff0000) | (b << 10) | (g << 5) | r; +} + +void gba_state::draw_scanline(int y) +{ + bitmap_ind16 &bitmap = m_bitmap; + UINT16 *scanline = &bitmap.pix16(y); + UINT8 submode = 0; + int depth = 0; + + // forced blank + if (m_DISPCNT & DISPCNT_BLANK) + { + // forced blank is white + for (int x = 0; x < 240; x++) + scanline[x] = 0x7fff; + return; + } + + if(!m_fxOn && !m_windowOn && !(m_DISPCNT & DISPCNT_OBJWIN_EN)) + submode = GBA_SUBMODE0; + else if(m_fxOn && !m_windowOn && !(m_DISPCNT & DISPCNT_OBJWIN_EN)) + submode = GBA_SUBMODE1; + else + submode = GBA_SUBMODE2; + + if ((m_DISPCNT & 7) == 3) + depth = 16; + else if ((m_DISPCNT & 7) == 4) + depth = 8; + else if ((m_DISPCNT & 7) == 5) + depth = 4; + + //printf("mode = %d, %d\n", m_DISPCNT & 7, submode); + + switch(m_DISPCNT & 7) + { + case 0: + case 1: + case 2: + draw_modes(m_DISPCNT & 7, submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], depth); + break; + case 3: + case 4: + case 5: + draw_modes(GBA_MODE345, submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], depth); + break; + default: + fatalerror("Invalid screen mode (6 or 7)!\n"); + } + + for (int x = 0; x < 240; x++) + { + scanline[x] = m_xferscan[6][1024 + x] & 0x7fff; + } + + return; +} + +void gba_state::video_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); +} + +UINT32 gba_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} diff --git a/src/mame/video/gime.c b/src/mame/video/gime.c new file mode 100644 index 00000000000..83b78e92b25 --- /dev/null +++ b/src/mame/video/gime.c @@ -0,0 +1,2077 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/********************************************************************* + + gime.c + + Implementation of CoCo GIME (Graphics Interrupt Memory Enhancement) + video chip. + + Mid frame raster effects (source John Kowalski) + + Here are the things that get changed mid-frame: + + - Palette registers ($FFB0-$FFBF) + - Horizontal resolution (switches between 256 and 320 pixels, $FF99) + - Horizontal scroll position (bits 0-6 $FF9F) + - Horizontal virtual screen (bit 7 $FF9F) + - Pixel height (bits 0-2 $FF98) + - Border color ($FF9A) + + On the positive side, you don't have to worry about registers + $FF9D/$FF9E being changed mid-frame. Even if they are changed + mid-frame, they have no effect on the displayed image. The video + address only gets latched at the top of the frame. + + + TIMING + + We divide a single frame into five regions + + Region Scanlines (on 192) Field Sync (before right border) + ------ ------------------ -------------------------------- + Top Border 25 1 + Body 192 1 + Bottom Border 26 1 + Vertical Retrace 6 0 + Vertical Blanking 13 (or 13.5) 1 + + Horizontal sync appears to be low only during retrace/blanking but + field sync switches as soon as the last body pixel is displayed + + Note that the GIME trailing edges field sync after the bottom + border; this is different than the MC6847 + +********************************************************************** + + SOFTWARE FOR TIMING TESTING + + Various CoCo 3 programs can "stress test" timing in various ways + + COLOR3: This program was in Rainbow January 1987. It will synchronize + with field sync by polling bit 7 of $FF03 (PIA0) (specifically, it polls + until the rising edge of writes to PIA0 CB1). This causes the loop to + be broken out at the top of vblank. COLOR3 also synchronizes on + horizontal sync through PIA0; it counts 70 hsyncs to get to a point 32 + scanlines into the body. + + DEMO: This SockMaster demo has a main loop that adjusts GIME registers + and shuffles some graphics bytes. From a timing perspective, the + critical piece is a SYNC with PIA field sync (specifically, it SYNCs + with the trailing edge of writes to PIA0 CB1). DEMO does not attempt + to synchronize on horizontal sync; it relies on CPU timing. + + MOON: SockMaster demo. Uses GIME interrupts; FIRQ gets TMR interrupts + and IRQ gets VBORD interrupts. Since it does not use the PIA field + sync, it can be used to demonstrate how the GIME's VBORD interrupt + is distinct. + + BOINK: SockMaster demo. Like DEMO, it SYNCs on the trailing edge + of PIA field sync. Also uses non standard $FF99 LPF mode. If + BOINK "wobbles vertically", it suggests that the main loop is not + executing within a single field sync. BOINK also makes extensive + use of $FF9F scrolling with bit 7 cleared. + + CRYSTAL CITY: Jeremy Spiller game. The intro uses an attribute-less + GIME text mode + +**********************************************************************/ + + +#include "emu.h" +#include "video/gime.h" +#include "machine/6883sam.h" +#include "bus/coco/cococart.h" +#include "machine/ram.h" + + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define USE_HORIZONTAL_CLIP false +#define GIME_TYPE_1987 0 +#define NO_ATTRIBUTE 0x80 + +#define LOG_INT_MASKING 0 +#define LOG_GIME 0 +#define LOG_TIMER 0 + + + +//************************************************************************** +// DEVICE SETUP +//************************************************************************** + +//------------------------------------------------- +// ctor +//------------------------------------------------- + +gime_base_device::gime_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const UINT8 *fontdata, const char *shortname, const char *source) + : mc6847_friend_device(mconfig, type, name, tag, owner, clock, fontdata, true, 263, 25+192+26+3, false, shortname, source), + m_write_irq(*this), + m_write_firq(*this), + m_read_floating_bus(*this), + m_maincpu_tag(NULL), + m_ram_tag(NULL), + m_ext_tag(NULL) +{ +} + + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gime_base_device::device_start(void) +{ + // find the RAM device - make sure that it is started + m_ram = machine().device(m_ram_tag); + if (!m_ram->started()) + throw device_missing_dependencies(); + + // find the CART device - make sure that it is started + m_cart_device = machine().device(m_ext_tag); + if (!m_cart_device->started()) + throw device_missing_dependencies(); + + // find the CPU device - make sure that it is started + m_cpu = machine().device(m_maincpu_tag); + if (!m_cpu->started()) + throw device_missing_dependencies(); + + // inherited device_start - need to do this after checking dependencies + super::device_start(); + + // initialize variables + memset(m_scanlines, 0, sizeof(m_scanlines)); + m_interrupt_value = 0x00; + m_irq = 0x00; + m_firq = 0x00; + + // allocate timer + m_gime_clock_timer = timer_alloc(TIMER_GIME_CLOCK); + + // setup banks + assert(ARRAY_LENGTH(m_read_banks) == ARRAY_LENGTH(m_write_banks)); + for (int i = 0; i < ARRAY_LENGTH(m_read_banks); i++) + { + char buffer[8]; + snprintf(buffer, ARRAY_LENGTH(buffer), "rbank%d", i); + m_read_banks[i] = machine().root_device().membank(buffer); + snprintf(buffer, ARRAY_LENGTH(buffer), "wbank%d", i); + m_write_banks[i] = machine().root_device().membank(buffer); + } + + // resolve callbacks + m_write_irq.resolve_safe(); + m_write_firq.resolve_safe(); + m_read_floating_bus.resolve_safe(0); + + // set up ROM/RAM pointers + m_rom = machine().root_device().memregion(m_maincpu_tag)->base(); + m_cart_rom = m_cart_device->get_cart_base(); + + // populate palettes + for (int color = 0; color < 64; color++) + { + m_composite_palette[color] = get_composite_color(color); + m_composite_bw_palette[color] = black_and_white(m_composite_palette[color]); + m_rgb_palette[color] = get_rgb_color(color); + } + + // set up save states + save_pointer(NAME(m_gime_registers), ARRAY_LENGTH(m_gime_registers)); + save_pointer(NAME(m_mmu), ARRAY_LENGTH(m_mmu)); + save_item(NAME(m_sam_state)); + save_item(NAME(m_ff22_value)); + save_item(NAME(m_interrupt_value)); + save_item(NAME(m_irq)); + save_item(NAME(m_firq)); + save_item(NAME(m_timer_value)); + save_item(NAME(m_is_blinking)); + save_pointer(NAME(m_palette_rotated[0]), 16); +} + + + +//------------------------------------------------- +// get_composite_color +//------------------------------------------------- + +inline gime_base_device::pixel_t gime_base_device::get_composite_color(int color) +{ + /* CMP colors + * + * These colors are of the format IICCCC, where II is the intensity and + * CCCC is the base color. There is some weirdness because intensity + * is often different for each base color. + * + * The code below is based on an algorithm specified in the following + * CoCo BASIC program was used to approximate composite colors. + * (Program by SockMaster): + * + * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 + * 20 SAT=92:CON=70:BRI=-50:L(0)=0:L(1)=47:L(2)=120:L(3)=255 + * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 + * 40 BRI=BRI+CON:FORG=1TO15:R(P)=COS(A)*SAT+BRI + * 50 G(P)=(COS(S)*SAT)*1+BRI:B(P)=(COS(D)*SAT)*1+BRI:P=P+1 + * 55 A=A+W:S=S+W:D=D+W:NEXT:R(P-16)=L(H):G(P-16)=L(H):B(P-16)=L(H) + * 60 NEXT:R(63)=R(48):G(63)=G(48):B(63)=B(48) + * 70 FORH=0TO63STEP1:R=INT(R(H)):G=INT(G(H)):B=INT(B(H)):IFR<0THENR=0 + * 80 IFG<0THENG=0 + * 90 IFB<0THENB=0 + * 91 IFR>255THENR=255 + * 92 IFG>255THENG=255 + * 93 IFB>255THENB=255 + * 100 PRINTRIGHT$(STR$(H),2);" $";:R=R+256:G=G+256:B=B+256 + * 110 PRINTRIGHT$(HEX$(R),2);",$";RIGHT$(HEX$(G),2);",$";RIGHT$(HEX$(B),2) + * 115 IF(H AND15)=15 THENIFINKEY$=""THEN115ELSEPRINT + * 120 NEXT + * + * At one point, we used a different SockMaster program, but the colors + * produced were too dark for people's taste + * + * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 + * 20 SAT=92:CON=53:BRI=-16:L(0)=0:L(1)=47:L(2)=120:L(3)=255 + * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 + * 40 BRI=BRI+CON:FORG=1TO15:R(P)=COS(A)*SAT+BRI + * 50 G(P)=(COS(S)*SAT)*.50+BRI:B(P)=(COS(D)*SAT)*1.9+BRI:P=P+1 + * 55 A=A+W:S=S+W:D=D+W:NEXT:R(P-16)=L(H):G(P-16)=L(H):B(P-16)=L(H) + * 60 NEXT:R(63)=R(48):G(63)=G(48):B(63)=B(48) + * 70 FORH=0TO63STEP1:R=INT(R(H)):G=INT(G(H)):B=INT(B(H)):IFR<0THENR=0 + * 80 IFG<0THENG=0 + * 90 IFB<0THENB=0 + * 91 IFR>255THENR=255 + * 92 IFG>255THENG=255 + * 93 IFB>255THENB=255 + * 100 PRINTRIGHT$(STR$(H),2);" $";:R=R+256:G=G+256:B=B+256 + * 110 PRINTRIGHT$(HEX$(R),2);",$";RIGHT$(HEX$(G),2);",$";RIGHT$(HEX$(B),2) + * 115 IF(H AND15)=15 THENIFINKEY$=""THEN115ELSEPRINT + * 120 NEXT + */ + + double saturation, brightness, contrast; + int offset; + double w; + int r, g, b; + + switch(color) + { + case 0: + r = g = b = 0; + break; + + case 16: + r = g = b = 47; + break; + + case 32: + r = g = b = 120; + break; + + case 48: + case 63: + r = g = b = 255; + break; + + default: + w = .4195456981879*1.01; + contrast = 70; + saturation = 92; + brightness = -50; + brightness += ((color / 16) + 1) * contrast; + offset = (color % 16) - 1 + (color / 16)*15; + r = cos(w*(offset + 9.2)) * saturation + brightness; + g = cos(w*(offset + 14.2)) * saturation + brightness; + b = cos(w*(offset + 19.2)) * saturation + brightness; + + if (r < 0) + r = 0; + else if (r > 255) + r = 255; + + if (g < 0) + g = 0; + else if (g > 255) + g = 255; + + if (b < 0) + b = 0; + else if (b > 255) + b = 255; + break; + } + return (pixel_t) ((r << 16) | (g << 8) | (b << 0)); +} + + + +//------------------------------------------------- +// get_rgb_color +//------------------------------------------------- + +inline gime_base_device::pixel_t gime_base_device::get_rgb_color(int color) +{ + return (((color >> 4) & 2) | ((color >> 2) & 1)) * 0x550000 + | (((color >> 3) & 2) | ((color >> 1) & 1)) * 0x005500 + | (((color >> 2) & 2) | ((color >> 0) & 1)) * 0x000055; +} + + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void gime_base_device::device_reset(void) +{ + /* Tepolt verifies that the GIME registers are all cleared on initialization */ + memset(m_gime_registers, 0, sizeof(m_gime_registers)); + + /* initialize MMU */ + for (int i = 0; i < 8; i++) + m_mmu[i] = m_mmu[i + 8] = 56 + i; + + /* initialize palette */ + memset(m_palette_rotated, 0, sizeof(m_palette_rotated)); + m_palette_rotated_position = 0; + m_palette_rotated_position_used = false; + + /* clear SAM state */ + m_sam_state = 0x0000; + + /* clear interrupts */ + m_interrupt_value = 0x00; + m_irq = 0x00; + m_firq = 0x00; + m_is_blinking = false; + + m_legacy_video = false; + + m_displayed_rgb = false; + + update_memory(); + reset_timer(); +} + + + +//------------------------------------------------- +// device_timer - handle timer callbacks +//------------------------------------------------- + +void gime_base_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case TIMER_GIME_CLOCK: + timer_elapsed(); + break; + + default: + super::device_timer(timer, id, param, ptr); + break; + } +} + + + +//------------------------------------------------- +// device_pre_save - device-specific pre save +//------------------------------------------------- + +void gime_base_device::device_pre_save() +{ + super::device_pre_save(); + + // copy to palette rotation position zero + for (offs_t i = 0; i < 16; i++) + m_palette_rotated[0][i] = m_palette_rotated[m_palette_rotated_position][i]; +} + + +//------------------------------------------------- +// device_post_load - device-specific post load +//------------------------------------------------- + +void gime_base_device::device_post_load() +{ + super::device_post_load(); + update_memory(); + update_cpu_clock(); + + // we update to position zero + m_palette_rotated_position = 0; + m_palette_rotated_position_used = false; +} + + + +//------------------------------------------------- +// device_input_ports +//------------------------------------------------- + +ioport_constructor gime_base_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(mc6847_artifacting); +} + + + +//************************************************************************** +// TIMER +// +// The CoCo 3 had a timer that had would activate when first written to, and +// would decrement over and over again until zero was reached, and at that +// point, would flag an interrupt. At this point, the timer starts back up +// again. +// +// I am deducing that the timer interrupt line was asserted if the timer was +// zero and unasserted if the timer was non-zero. Since we never truly track +// the timer, we just use timer callback (coco3_timer_callback() asserts the +// line) +// +// Most CoCo 3 docs, including the specs that Tandy released, say that the +// high speed timer is 70ns (half of the speed of the main clock crystal). +// However, it seems that this is in error, and the GIME timer is really a +// 280ns timer (one eighth the speed of the main clock crystal. Gault's +// FAQ agrees with this +// +//************************************************************************** + +//------------------------------------------------- +// timer_type +//------------------------------------------------- + +gime_base_device::timer_type_t gime_base_device::timer_type(void) +{ + // wraps the GIME register access and returns an enumeration + return (m_gime_registers[0x01] & 0x20) ? GIME_TIMER_CLOCK : GIME_TIMER_HBORD; +} + + + +//------------------------------------------------- +// timer_type_string +//------------------------------------------------- + +const char *gime_base_device::timer_type_string(void) +{ + const char *result; + switch(timer_type()) + { + case GIME_TIMER_CLOCK: + result = "CLOCK"; + break; + case GIME_TIMER_HBORD: + result = "HBORD"; + break; + default: + fatalerror("Should not get here\n"); + } + return result; +} + + + +//------------------------------------------------- +// timer_elapsed +//------------------------------------------------- + +void gime_base_device::timer_elapsed(void) +{ + /* reset the timer; give her another run! */ + reset_timer(); + + /* change the blinking value - note that we don't have to use update_value() */ + m_is_blinking = !m_is_blinking; + + /* twiddle the timer interrupt */ + set_interrupt_value(INTERRUPT_TMR, true); + set_interrupt_value(INTERRUPT_TMR, false); +} + + + +//------------------------------------------------- +// reset_timer +//------------------------------------------------- + +void gime_base_device::reset_timer(void) +{ + /* value is from 0-4095 */ + m_timer_value = ((m_gime_registers[0x04] & 0x0F) * 0x100) | m_gime_registers[0x05]; + + /* depending on the GIME type, cannonicalize the value */ + if (m_timer_value > 0) + { + if (GIME_TYPE_1987) + m_timer_value += 1; /* the 1987 GIME reset to the value plus one */ + else + m_timer_value += 2; /* the 1986 GIME reset to the value plus two */ + } + + attotime duration; + if ((timer_type() == GIME_TIMER_CLOCK) && (m_timer_value > 0)) + { + /* we're starting a countdown on the GIME clock timer */ + attotime current_time = machine().time(); + UINT64 current_tick = current_time.as_ticks(m_clock); + duration = attotime::from_ticks(current_tick + m_timer_value, m_clock) - current_time; + } + else + { + /* either the timer is off, or were not using the GIME clock timer */ + duration = attotime::never; + } + m_gime_clock_timer->adjust(duration); + + if (LOG_TIMER) + logerror("%s: reset_timer(): timer_type=%s value=%d\n", describe_context(), timer_type_string(), m_timer_value); +} + + + +//************************************************************************** +// MEMORY AND REGISTERS +//************************************************************************** + +//------------------------------------------------- +// update_memory +//------------------------------------------------- + +inline void gime_base_device::update_memory(void) +{ + for (int bank = 0; bank <= 8; bank++) + { + update_memory(bank); + } +} + + + +//------------------------------------------------- +// update_memory +//------------------------------------------------- + +void gime_base_device::update_memory(int bank) +{ + // choose bank + assert((bank >= 0) && (bank < ARRAY_LENGTH(m_read_banks)) && (bank < ARRAY_LENGTH(m_write_banks))); + memory_bank *read_bank = m_read_banks[bank]; + memory_bank *write_bank = m_write_banks[bank]; + + // bank 8 is really $FE00-$FEFF; it is weird so adjust for it + offs_t offset; + bool force_ram; + bool enable_mmu = (m_gime_registers[0] & 0x40) ? true : false; + if (bank == 8) + { + bank = 7; + offset = 0x1E00; + force_ram = true; + enable_mmu = enable_mmu && !(m_gime_registers[0] & 0x08); + } + else + { + offset = 0x0000; + force_ram = false; + } + + // is the MMU enabled at $FF90? + int block; + if (enable_mmu) + { + // check TR register at $FF91 + bank += (m_gime_registers[1] & 0x01) ? 8 : 0; + + // perform the MMU lookup + block = m_mmu[bank]; + + // also check $FF9B - relevant for the 2-8 MB upgrade + block |= ((UINT32) ((m_gime_registers[11] >> 4) & 0x03)) << 8; + } + else + { + // the MMU is not enabled + block = bank + 56; + } + + // are we actually in ROM? + UINT8 *memory; + bool is_read_only; + if (((block & 0x3F) >= 0x3C) && !(m_sam_state & SAM_STATE_TY) && !force_ram) + { + // we're in ROM + static const UINT8 rom_map[4][4] = + { + { 0, 1, 6, 7 }, + { 0, 1, 6, 7 }, + { 0, 1, 2, 3 }, + { 4, 5, 6, 7 } + }; + + // look up the block in the ROM map + block = rom_map[m_gime_registers[0] & 3][(block & 0x3F) - 0x3C]; + + // are we in onboard ROM or cart ROM? + UINT8 *rom_ptr = (block & 4) ? m_cart_rom : m_rom; + // TODO: make this unmapped + if (rom_ptr==NULL) rom_ptr = m_rom; + // perform the look up + memory = &rom_ptr[(block & 3) * 0x2000]; + is_read_only = true; + } + else + { + // we're in RAM + memory = memory_pointer(block * 0x2000); + is_read_only = false; + } + + // compensate for offset + memory += offset; + + // set the banks + read_bank->set_base(memory); + write_bank->set_base(is_read_only ? m_dummy_bank : memory); +} + + + +//------------------------------------------------- +// memory_pointer +//------------------------------------------------- + +UINT8 *gime_base_device::memory_pointer(UINT32 address) +{ + return &m_ram->pointer()[address % m_ram->size()]; +} + + + +//------------------------------------------------- +// update_cart_rom +//------------------------------------------------- + +void gime_base_device::update_cart_rom(void) +{ + m_cart_rom = m_cart_device->get_cart_base(); + update_memory(); +} + + + +//------------------------------------------------- +// read +//------------------------------------------------- + +UINT8 gime_base_device::read(offs_t offset) +{ + UINT8 data = 0x00; + + switch(offset & 0xF0) + { + case 0x00: + data = read_gime_register(offset); + break; + + case 0x10: + data = read_mmu_register(offset); + break; + + case 0x20: + data = read_palette_register(offset); + break; + + default: + data = read_floating_bus(); + break; + } + + return data; +} + + + +//------------------------------------------------- +// read_gime_register +//------------------------------------------------- + +inline UINT8 gime_base_device::read_gime_register(offs_t offset) +{ + offset &= 0x0F; + + UINT8 result; + switch(offset) + { + case 2: // read pending IRQs + result = m_irq; + if (result != 0x00) + { + m_irq = 0x00; + recalculate_irq(); + } + break; + + case 3: // read pending FIRQs + result = m_firq; + if (result != 0x00) + { + m_firq = 0x00; + recalculate_firq(); + } + break; + + case 14: + case 15: + // these (I guess) are readable (Mametesters bug #05135) + result = m_gime_registers[offset]; + break; + + default: + // the others are not readable; read floating bus (Mametesters bug #05135) + result = read_floating_bus(); + break; + } + return result; +} + + + +//------------------------------------------------- +// read_mmu_register +//------------------------------------------------- + +inline UINT8 gime_base_device::read_mmu_register(offs_t offset) +{ + return (m_mmu[offset & 0x0F] & 0x3F) | (read_floating_bus() & 0xC0); +} + + + +//------------------------------------------------- +// read_palette_register +//------------------------------------------------- + +inline UINT8 gime_base_device::read_palette_register(offs_t offset) +{ + // Bits 7/6 are floating, and behave oddly. On a real CoCo 3 + // + // POKE&HFFB1,255:PRINTPEEK(&HFFB1) returns 127. + // POKE&HFFB1,0:PRINTPEEK(&HFFB1) returns 64 + // + // This is because of the floating bus + return m_palette_rotated[m_palette_rotated_position][offset & 0x0F] + | (read_floating_bus() & 0xC0); +} + + + +//------------------------------------------------- +// read_floating_bus +//------------------------------------------------- + +inline UINT8 gime_base_device::read_floating_bus(void) +{ + return m_read_floating_bus(0); +} + + + +//------------------------------------------------- +// write +//------------------------------------------------- + +void gime_base_device::write(offs_t offset, UINT8 data) +{ + switch(offset & 0xF0) + { + case 0x00: + write_gime_register(offset & 0x0F, data); + break; + + case 0x10: + write_mmu_register(offset & 0x0F, data); + break; + + case 0x20: + write_palette_register(offset & 0x0F, data & 0x3F); + break; + + case 0x30: + case 0x40: + write_sam_register(offset - 0x30); + break; + } +} + + + +//------------------------------------------------- +// write_gime_register +//------------------------------------------------- + +inline void gime_base_device::write_gime_register(offs_t offset, UINT8 data) +{ + // this is needed for writes to FF95 + bool timer_was_off = (m_gime_registers[0x04] == 0x00) && (m_gime_registers[0x05] == 0x00); + + // sanity check input + offset &= 0x0F; + + // perform logging + if (LOG_GIME) + logerror("%s: CoCo3 GIME: $%04x <== $%02x\n", describe_context(), offset + 0xff90, data); + + // make the change, and track the difference + UINT8 xorval = m_gime_registers[offset] ^ data; + m_gime_registers[offset] = data; + + switch(offset) + { + case 0x00: + // $FF90 Initialization register 0 + // Bit 7 COCO 1=CoCo compatible mode + // Bit 6 MMUEN 1=MMU enabled + // Bit 5 IEN 1 = GIME chip IRQ enabled + // Bit 4 FEN 1 = GIME chip FIRQ enabled + // Bit 3 MC3 1 = RAM at FEXX is constant + // Bit 2 MC2 1 = standard SCS (Spare Chip Select) + // Bit 1 MC1 ROM map control + // Bit 0 MC0 ROM map control + if (xorval & 0x4B) + update_memory(); + break; + + case 0x01: + // $FF91 Initialization register 1 + // Bit 7 Unused + // Bit 6 Unused + // Bit 5 TINS Timer input select; 1 = 280 nsec, 0 = 63.5 usec + // Bit 4 Unused + // Bit 3 Unused + // Bit 2 Unused + // Bit 1 Unused + // Bit 0 TR Task register select + if (xorval & 0x01) + update_memory(); + + // I'm not sure about this one; as written this code will reset the timer + // with the _original_ value. This is probably not correct. + if (xorval & 0x20) + reset_timer(); + break; + + case 0x02: + // $FF92 Interrupt request enable register + // Bit 7 Unused + // Bit 6 Unused + // Bit 5 TMR Timer interrupt + // Bit 4 HBORD Horizontal border interrupt + // Bit 3 VBORD Vertical border interrupt + // ! Bit 2 EI2 Serial data interrupt + // Bit 1 EI1 Keyboard interrupt + // Bit 0 EI0 Cartridge interrupt + if (LOG_INT_MASKING) + { + logerror("%s: GIME IRQ: Interrupts { %s%s%s%s%s%s} enabled\n", + describe_context(), + (data & 0x20) ? "TMR " : "", + (data & 0x10) ? "HBORD " : "", + (data & 0x08) ? "VBORD " : "", + (data & 0x04) ? "EI2 " : "", + (data & 0x02) ? "EI1 " : "", + (data & 0x01) ? "EI0 " : ""); + } + break; + + case 0x03: + // $FF93 Fast interrupt request enable register + // Bit 7 Unused + // Bit 6 Unused + // Bit 5 TMR Timer interrupt + // Bit 4 HBORD Horizontal border interrupt + // Bit 3 VBORD Vertical border interrupt + // ! Bit 2 EI2 Serial data interrupt + // Bit 1 EI1 Keyboard interrupt + // Bit 0 EI0 Cartridge interrupt + if (LOG_INT_MASKING) + { + logerror("%s: GIME FIRQ: Interrupts { %s%s%s%s%s%s} enabled\n", + describe_context(), + (data & 0x20) ? "TMR " : "", + (data & 0x10) ? "HBORD " : "", + (data & 0x08) ? "VBORD " : "", + (data & 0x04) ? "EI2 " : "", + (data & 0x02) ? "EI1 " : "", + (data & 0x01) ? "EI0 " : ""); + } + break; + + case 0x04: + // $FF94 Timer register MSB + // Bits 4-7 Unused + // Bits 0-3 High order four bits of the timer + reset_timer(); + break; + + case 0x05: + // $FF95 Timer register LSB + // Bits 0-7 Low order eight bits of the timer + if (timer_was_off && (m_gime_registers[0x05] != 0x00)) + { + // Writes to $FF95 do not cause the timer to reset, but MESS + // will invoke coco3_timer_reset() if $FF94/5 was previously + // $0000. The reason for this is because the timer is not + // actually off when $FF94/5 are loaded with $0000; rather it + // is continuously reloading the GIME's internal countdown + // register, even if it isn't causing interrupts to be raised. + // + // Failure to do this was the cause of bug #1065. Special + // thanks to John Kowalski for pointing me in the right + // direction + reset_timer(); + } + break; + + case 0x08: + // $FF98 Video Mode Register + // Bit 7 BP 0 = Text modes, 1 = Graphics modes + // Bit 6 Unused + // ! Bit 5 BPI Burst Phase Invert (Color Set) + // Bit 4 MOCH 1 = Monochrome on Composite + // ! Bit 3 H50 1 = 50 Hz power, 0 = 60 Hz power + // Bits 0-2 LPR Lines per row + break; + + case 0x09: + // $FF99 Video Resolution Register + // Bit 7 Undefined + // Bits 5-6 LPF Lines per Field (Number of Rows) + // Bits 2-4 HRES Horizontal Resolution + // 000=16 bytes per row + // 001=20 bytes per row + // 010=32 bytes per row + // 011=40 bytes per row + // 100=64 bytes per row + // 101=80 bytes per row + // 110=128 bytes per row + // 111=160 bytes per row + // Bits 0-1 CRES Color Resolution + if (xorval & 0x60) + update_geometry(); + break; + + case 0x0A: + // $FF9A Border Register + // Bits 6,7 Unused + // Bits 0-5 BRDR Border color + break; + + case 0x0C: + // $FF9C Vertical Scroll Register + // Bits 4-7 Reserved + // Bits 0-3 VSC Vertical Scroll bits + break; + + case 0x0B: + // $FF9B Two/Eight Megabyte Upgrade register + // + // This variable is weird; it affects both the video position, but + // it also affects normal memory mapping. However, changing $FF9B + // alone won't affect the MMU; writes to $FFAx are required to "latch" + // in the $FF9B value. + // + // The reason that $FF9B is not mentioned in offical documentation + // is because it is only meaningful in CoCo 3's with the 2MB upgrade + break; + + case 0x0D: + case 0x0E: + // $FF9B,$FF9D,$FF9E Vertical Offset Registers + // + // According to JK, if an odd value is placed in $FF9E on the 1986 + // GIME, the GIME crashes + break; + + case 0x0F: + // $FF9F Horizontal Offset Register + // Bit 7 HVEN Horizontal Virtual Enable + // Bits 0-6 X0-X6 Horizontal Offset Address + // + // Unline $FF9D-E, this value can be modified mid frame + // + // Note that the FF9F offset is shifted by one bit (e.g. - $FF9F=$03 will + // be a six byte offset). Also note that scanlines wrap at 256 byte boundaries + // without regard to bit 7. + break; + } +} + + + +//------------------------------------------------- +// write_mmu_register +//------------------------------------------------- + +inline void gime_base_device::write_mmu_register(offs_t offset, UINT8 data) +{ + offset &= 0x0F; + + // Check to see if the MMU register has changed. If we have more than 512k of RAM + // then we have to always update because this is the point at which the MMU makes + // decisions based off of $FF9B + if ((m_mmu[offset] != data) || (m_ram->size() > 512*1024)) + { + m_mmu[offset] = data; + update_memory(offset & 0x07); + } +} + + + +//------------------------------------------------- +// write_palette_register +//------------------------------------------------- + +inline void gime_base_device::write_palette_register(offs_t offset, UINT8 data) +{ + offset &= 0x0F; + + /* has this entry changed? */ + if (m_palette_rotated[m_palette_rotated_position][offset] != data) + { + /* do we need to rotate the palette? */ + if (m_palette_rotated_position_used) + { + /* identify the new position */ + UINT16 new_palette_rotated_position = (m_palette_rotated_position + 1) % ARRAY_LENGTH(m_palette_rotated); + + /* copy the palette */ + for (int i = 0; i < ARRAY_LENGTH(m_palette_rotated[0]); i++) + m_palette_rotated[new_palette_rotated_position][i] = m_palette_rotated[m_palette_rotated_position][i]; + + /* and advance */ + m_palette_rotated_position = new_palette_rotated_position; + m_palette_rotated_position_used = false; + } + + /* record the change */; + m_palette_rotated[m_palette_rotated_position][offset] = data; + } +} + + + +//------------------------------------------------- +// write_sam_register +//------------------------------------------------- + +inline void gime_base_device::write_sam_register(offs_t offset) +{ + /* change the SAM state */ + UINT16 xorval = alter_sam_state(offset); + + /* $FFDE-F can trigger a memory update */ + if (xorval & SAM_STATE_TY) + update_memory(); + + if (xorval & (SAM_STATE_R1|SAM_STATE_R0)) + update_cpu_clock(); +} + + + +//------------------------------------------------- +// interrupt_rising_edge +//------------------------------------------------- + +void gime_base_device::interrupt_rising_edge(UINT8 interrupt) +{ + /* evaluate IRQ */ + if ((m_gime_registers[0x00] & 0x20) && (m_gime_registers[0x02] & interrupt)) + { + m_irq |= interrupt; + recalculate_irq(); + } + + /* evaluate FIRQ */ + if ((m_gime_registers[0x00] & 0x10) && (m_gime_registers[0x03] & interrupt)) + { + m_firq |= interrupt; + recalculate_firq(); + } +} + + + +//------------------------------------------------- +// recalculate_irq +//------------------------------------------------- + +void gime_base_device::recalculate_irq(void) +{ + m_write_irq(irq_r()); +} + + + +//------------------------------------------------- +// recalculate_firq +//------------------------------------------------- + +void gime_base_device::recalculate_firq(void) +{ + m_write_firq(firq_r()); +} + + + +//************************************************************************** +// VIDEO STATE +//************************************************************************** + +//------------------------------------------------- +// get_video_base +// +// The purpose of the ff9d_mask and ff9e_mask is to mask out bits that are +// ignored in lo-res mode. Specifically, $FF9D is masked with $E0, and +// $FF9E is masked with $3F +// +// John Kowalski confirms this behavior +//------------------------------------------------- + +inline offs_t gime_base_device::get_video_base(void) +{ + offs_t result; + UINT8 ff9d_mask, ff9e_mask; + + if (m_legacy_video) + { + /* legacy video gets the base address from the SAM addresses, and masks out GIME variables */ + result = display_offset(); + ff9d_mask = 0xE0; + ff9e_mask = 0x3F; + } + else + { + /* GIME video ignores the SAM addresses, relying on the GIME variables exclusively */ + result = 0; + ff9d_mask = 0xFF; + ff9e_mask = 0xFF; + } + + result += ((offs_t) (m_gime_registers[0x0E] & ff9e_mask) * 0x00008) + | ((offs_t) (m_gime_registers[0x0D] & ff9d_mask) * 0x00800) + | ((offs_t) (m_gime_registers[0x0B] & 0x0F) * 0x80000); + return result; +} + + + +//------------------------------------------------- +// new_frame +//------------------------------------------------- + +void gime_base_device::new_frame(void) +{ + /* call inherited function */ + super::new_frame(); + + /* latch in legacy video value */ + bool legacy_video_changed = update_value(&m_legacy_video, m_gime_registers[0] & 0x80 ? true : false); + + /* latch in the video position */ + m_video_position = get_video_base(); + m_line_in_row = m_gime_registers[0x0C] & 0x0F; + + /* update the geometry, as appropriate */ + if (legacy_video_changed) + update_geometry(); +} + + + +//------------------------------------------------- +// horizontal_sync_changed +//------------------------------------------------- + +void gime_base_device::horizontal_sync_changed(bool line) +{ + set_interrupt_value(INTERRUPT_HBORD, line); + + /* decrement timer if appropriate */ + if ((timer_type() == GIME_TIMER_HBORD) && (m_timer_value > 0) && line) + { + if (--m_timer_value == 0) + timer_elapsed(); + } + +} + + + +//------------------------------------------------- +// enter_bottom_border +//------------------------------------------------- + +void gime_base_device::enter_bottom_border(void) +{ + set_interrupt_value(INTERRUPT_VBORD, true); + set_interrupt_value(INTERRUPT_VBORD, false); +} + + + +//------------------------------------------------- +// update_border +//------------------------------------------------- + +void gime_base_device::update_border(UINT16 physical_scanline) +{ + UINT8 border; + if (m_legacy_video) + { + /* legacy video */ + switch(border_value(m_ff22_value, true)) + { + case BORDER_COLOR_GREEN: + border = 0x12; /* green */ + break; + case BORDER_COLOR_WHITE: + border = 0x3F; /* white */ + break; + case BORDER_COLOR_BLACK: + border = 0x00; /* black */ + break; + case BORDER_COLOR_ORANGE: + border = 0x26; /* orange */ + break; + default: + fatalerror("Should not get here\n"); + } + } + else + { + /* get the border value from $FF9A */ + border = m_gime_registers[0x0A] & 0x3F; + } + update_value(&m_scanlines[physical_scanline].m_border, border); +} + + + +//------------------------------------------------- +// record_border_scanline +//------------------------------------------------- + +void gime_base_device::record_border_scanline(UINT16 physical_scanline) +{ + m_line_in_row = 0; + update_border(physical_scanline); + update_value(&m_scanlines[physical_scanline].m_line_in_row, (UINT8) ~0); +} + + + +//------------------------------------------------- +// get_lines_per_row +//------------------------------------------------- + +inline UINT16 gime_base_device::get_lines_per_row(void) +{ + UINT16 lines_per_row; + if (m_legacy_video) + { + switch(m_ff22_value & (MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0)) + { + case 0: + case MODE_GM0: + case MODE_GM1: + case MODE_GM1|MODE_GM0: + case MODE_GM2: + case MODE_GM2|MODE_GM0: + case MODE_GM2|MODE_GM1: + case MODE_GM2|MODE_GM1|MODE_GM0: + lines_per_row = 12; + break; + + case MODE_AG: + case MODE_AG|MODE_GM0: + case MODE_AG|MODE_GM1: + lines_per_row = 3; + break; + + case MODE_AG|MODE_GM1|MODE_GM0: + case MODE_AG|MODE_GM2: + lines_per_row = 2; + break; + + case MODE_AG|MODE_GM2|MODE_GM0: + case MODE_AG|MODE_GM2|MODE_GM1: + case MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0: + lines_per_row = 1; + break; + + default: + fatalerror("Should not get here\n"); + } + } + else + { + switch(m_gime_registers[0x08] & 0x07) + { + case 0x00: + case 0x01: + lines_per_row = 1; + break; + case 0x02: + lines_per_row = 2; + break; + case 0x03: + lines_per_row = 8; + break; + case 0x04: + lines_per_row = 9; + break; + case 0x05: + lines_per_row = 10; + break; + case 0x06: + lines_per_row = 11; + break; + case 0x07: + lines_per_row = 0xFFFF; + break; + default: + fatalerror("Should not get here\n"); + } + } + return lines_per_row; +} + + + +//------------------------------------------------- +// record_scanline_res +//------------------------------------------------- + +template +inline UINT32 gime_base_device::record_scanline_res(int scanline) +{ + int column; + UINT32 base_offset = m_legacy_video ? 0 : (m_gime_registers[0x0F] & 0x7F) * 2; + UINT32 offset = 0; + + /* main loop */ + for (column = 0; column < xres; column++) + { + /* input data */ + UINT8 data, mode; + offset += ((*this).*(get_data))(m_video_position + ((base_offset + offset) & 0xFF), &data, &mode); + + /* and record the pertinent values */ + if (record_mode) + update_value(&m_scanlines[scanline].m_mode[column], mode); + update_value(&m_scanlines[scanline].m_data[column], data); + update_value(&m_scanlines[scanline].m_palette[column], m_palette_rotated_position); + } + + return offset; +} + + + +//------------------------------------------------- +// get_data_mc6847 - used for retrieving data/mode +// in legacy video modes +//------------------------------------------------- + +UINT32 gime_base_device::get_data_mc6847(UINT32 video_position, UINT8 *data, UINT8 *mode) +{ + *data = *memory_pointer(video_position); + *mode = (m_ff22_value & (MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0|MODE_CSS)) + | ((*data & 0x80) == 0x80 ? MODE_AS : 0) + | ((*data & 0xC0) == 0x40 ? MODE_INV : 0); + + // postprocess the mode to remove unnecessary flags + *mode = mc6847_friend_device::simplify_mode(*data, *mode); + return 1; +} + + + +//------------------------------------------------- +// get_data_without_attributes - used for +// retrieving data/mode in GIME graphics or GIME +// text modes without attributes +//------------------------------------------------- + +UINT32 gime_base_device::get_data_without_attributes(UINT32 video_position, UINT8 *data, UINT8 *mode) +{ + *data = *memory_pointer(video_position); + *mode = NO_ATTRIBUTE; + return 1; +} + + + +//------------------------------------------------- +// get_data_with_attributes - used for retrieving +// data/mode in GIME text modes with attributes +//------------------------------------------------- + +UINT32 gime_base_device::get_data_with_attributes(UINT32 video_position, UINT8 *data, UINT8 *mode) +{ + *data = *memory_pointer(video_position + 0); + *mode = *memory_pointer(video_position + 1); + + /* is the blink attribute specified? */ + if (UNEXPECTED(*mode & 0x80)) + { + /* if so - and we're blinking - then clear the character */ + if (m_is_blinking) + { + *data = 0x20; + *mode &= ~0x40; + } + + /* clear the blink bit */ + *mode &= ~0x80; + } + return 2; +} + + + +//------------------------------------------------- +// record_body_scanline +//------------------------------------------------- + +void gime_base_device::record_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline) +{ + /* update the border first */ + update_border(physical_scanline); + + /* set the line in row */ + update_value(&m_scanlines[physical_scanline].m_line_in_row, m_line_in_row); + + /* we're using this palette rotation */ + m_palette_rotated_position_used = true; + + UINT32 pitch = 0; + if (m_legacy_video) + { + /* legacy video */ + update_value(&m_scanlines[physical_scanline].m_ff22_value, m_ff22_value); + + switch(m_ff22_value & (MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0)) + { + case MODE_AG: + case MODE_AG|MODE_GM0: + case MODE_AG|MODE_GM1|MODE_GM0: + case MODE_AG|MODE_GM2|MODE_GM0: + pitch = record_scanline_res<16, &gime_base_device::get_data_mc6847, true>(physical_scanline); + break; + + case 0: + case MODE_GM0: + case MODE_GM1: + case MODE_GM1|MODE_GM0: + case MODE_GM2: + case MODE_GM2|MODE_GM0: + case MODE_GM2|MODE_GM1: + case MODE_GM2|MODE_GM1|MODE_GM0: + case MODE_AG|MODE_GM1: + case MODE_AG|MODE_GM2: + case MODE_AG|MODE_GM2|MODE_GM1: + case MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0: + pitch = record_scanline_res<32, &gime_base_device::get_data_mc6847, true>(physical_scanline); + break; + + default: + /* should not get here */ + fatalerror("Should not get here\n"); + } + } + else + { + /* CoCo 3 video */ + update_value(&m_scanlines[physical_scanline].m_ff98_value, m_gime_registers[0x08]); + update_value(&m_scanlines[physical_scanline].m_ff99_value, m_gime_registers[0x09]); + + /* is this graphics or text? */ + if (m_gime_registers[0x08] & 0x80) + { + /* graphics */ + switch(m_gime_registers[0x09] & 0x1C) + { + case 0x00: pitch = record_scanline_res< 16, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; + case 0x04: pitch = record_scanline_res< 20, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; + case 0x08: pitch = record_scanline_res< 32, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; + case 0x0C: pitch = record_scanline_res< 40, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; + case 0x10: pitch = record_scanline_res< 64, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; + case 0x14: pitch = record_scanline_res< 80, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; + case 0x18: pitch = record_scanline_res<128, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; + case 0x1C: pitch = record_scanline_res<160, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; + default: + fatalerror("Should not get here\n"); + } + } + else + { + /* text */ + switch(m_gime_registers[0x09] & 0x15) + { + case 0x00: pitch = record_scanline_res< 32, &gime_base_device::get_data_without_attributes, true>(physical_scanline); break; + case 0x01: pitch = record_scanline_res< 32, &gime_base_device::get_data_with_attributes, true>(physical_scanline); break; + case 0x04: pitch = record_scanline_res< 40, &gime_base_device::get_data_without_attributes, true>(physical_scanline); break; + case 0x05: pitch = record_scanline_res< 40, &gime_base_device::get_data_with_attributes, true>(physical_scanline); break; + case 0x10: pitch = record_scanline_res< 64, &gime_base_device::get_data_without_attributes, true>(physical_scanline); break; + case 0x11: pitch = record_scanline_res< 64, &gime_base_device::get_data_with_attributes, true>(physical_scanline); break; + case 0x14: pitch = record_scanline_res< 80, &gime_base_device::get_data_without_attributes, true>(physical_scanline); break; + case 0x15: pitch = record_scanline_res< 80, &gime_base_device::get_data_with_attributes, true>(physical_scanline); break; + default: + fatalerror("Should not get here\n"); + } + } + + /* is the GIME hoizontal virtual screen enabled? */ + if (m_gime_registers[0x0F] & 0x80) + { + pitch = 256; + } + } + + /* sanity checks */ + assert(pitch > 0); + + /* are we moving on to the next line? */ + if (++m_line_in_row >= get_lines_per_row()) + { + /* next row */ + m_line_in_row = 0; + m_video_position += pitch; + } +} + + + +//------------------------------------------------- +// record_partial_body_scanline +//------------------------------------------------- + +void gime_base_device::record_partial_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline, INT32 start_clock, INT32 end_clock) +{ + fatalerror("NYI"); +} + + + +//------------------------------------------------- +// update_geometry +//------------------------------------------------- + +void gime_base_device::update_geometry(void) +{ + UINT16 top_border_scanlines, body_scanlines; + + switch(m_legacy_video ? 0x00 : (m_gime_registers[9] & 0x60)) + { + case 0x00: + // 192 lines (and legacy video) + top_border_scanlines = 25; + body_scanlines = 192; + break; + + case 0x20: + // 200 lines + top_border_scanlines = 23; + body_scanlines = 200; + break; + + case 0x40: + // zero/infinite lines + // + // If specified within the border, the border will go forever. If specified within the body, the body will go forever. This + // suggests that there is a counter that counts scanlines, and we switch border <=> body when we hit some maximum count + top_border_scanlines = ~0; + body_scanlines = ~0; + break; + + case 0x60: + // 225 lines + top_border_scanlines = 8; + body_scanlines = 225; + break; + + default: + fatalerror("Should not get here\n"); + } + + // bit 3 of $FF99 controls "wideness" + bool wide = !m_legacy_video && (m_gime_registers[9] & 0x08); + + // set the geometry + set_geometry(top_border_scanlines, body_scanlines, wide); +} + + + +//************************************************************************** +// VIDEO BLITTING +//************************************************************************** + +//------------------------------------------------- +// emit_dummy_samples +//------------------------------------------------- + +UINT32 gime_base_device::emit_dummy_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) +{ + fatalerror("Should not get here\n"); +} + +//------------------------------------------------- +// emit_mc6847_samples +//------------------------------------------------- + +inline UINT32 gime_base_device::emit_mc6847_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) +{ + return super::emit_mc6847_samples<2>( + scanline->m_mode[sample_start], + &scanline->m_data[sample_start], + sample_count, + pixels, + palette, + super::m_charrom_cb, + sample_start, + scanline->m_line_in_row); +} + + + +//------------------------------------------------- +// emit_gime_graphics_samples +//------------------------------------------------- + +template +inline UINT32 gime_base_device::emit_gime_graphics_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) +{ + const UINT8 *data = &scanline->m_data[sample_start]; + mc6847_friend_device::emit_graphics(data, sample_count, pixels, 0, palette); + return sample_count * (8 / bits_per_pixel) * xscale; +} + + + +//------------------------------------------------- +// emit_gime_text_samples +//------------------------------------------------- + +template +inline UINT32 gime_base_device::emit_gime_text_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) +{ + UINT8 attribute = scanline->m_mode[sample_start]; + const UINT8 *data = &scanline->m_data[sample_start]; + + /* determine the background/foreground colors */ + UINT8 bg = (attribute == NO_ATTRIBUTE) ? 0 : ((attribute >> 0) & 0x07) + 0x00; + UINT8 fg = (attribute == NO_ATTRIBUTE) ? 1 : ((attribute >> 3) & 0x07) + 0x08; + + /* underline attribute */ + int underline_line = -1; + if ((attribute != NO_ATTRIBUTE) && (attribute & 0x40)) + { + /* to quote SockMaster: + * + * The underline attribute will light up the bottom scan line of the character + * if the lines are set to 8 or 9. Not appear at all when less, or appear on + * the 2nd to bottom scan line if set higher than 9. Further exception being + * the $x7 setting where the whole screen is filled with only one line of data + * - but it's glitched - the line repeats over and over again every 16 scan + * lines.. Nobody will use this mode, but that's what happens if you want to + * make things really authentic :) + */ + switch(scanline->m_ff98_value & 0x07) + { + case 0x03: + underline_line = 7; + break; + case 0x04: + case 0x05: + underline_line = 8; + break; + case 0x06: + underline_line = 9; + break; + } + } + + for (int i = 0; i < sample_count; i++) + { + for (int j = 0; j < 8; j++) + { + for (int k = 0; k < xscale; k++) + { + UINT8 font_byte = hires_font[data[i] & 0x7F][scanline->m_line_in_row]; + bool bit = (scanline->m_line_in_row == underline_line) || ((font_byte >> (7 - j)) & 0x01); + pixels[(i * 8 + j) * xscale + k] = bit ? palette[fg] : palette[bg]; + } + } + } + return sample_count * 8 * xscale; +} + + + +//------------------------------------------------- +// render_scanline +//------------------------------------------------- + +template +inline void gime_base_device::render_scanline(const scanline_record *scanline, pixel_t *pixels, int min_x, int max_x, palette_resolver *resolver) +{ + int left_border, right_border; + int x, x2, pixel_position; + pixel_t border_color = resolver->lookup(scanline->m_border); + const pixel_t *resolved_palette = NULL; + + /* is this a wide video mode? */ + bool wide = !m_legacy_video && (scanline->m_ff99_value & 0x04); + + /* size up the borders */ + if (sample_count > 0) + { + left_border = wide ? 0 : 64; + right_border = wide ? 640 : 512; + } + else + { + left_border = 640; + right_border = 640; + } + + /* left border */ + for (x = min_x; x < left_border; x++) + { + pixels[x] = border_color; + } + + /* right border */ + for (x = right_border; x <= max_x; x++) + { + pixels[x] = border_color; + } + + /* offset the pixel counts depending on wide */ + pixels += wide ? 0 : 64; + + /* body */ + x = 0; + pixel_position = 0; + while(x < sample_count) + { + /* determine how many bytes exist for which the mode is identical */ + for (x2 = x + 1; (x2 < sample_count) && (scanline->m_mode[x] == scanline->m_mode[x2]) && (scanline->m_palette[x] == scanline->m_palette[x2]); x2++) + ; + + /* resolve the palette */ + resolved_palette = resolver->get_palette(scanline->m_palette[x]); + + /* emit the samples, with a (hopefully) aggressively inlined function */ + pixel_position += ((*this).*(emit_samples))(scanline, x, x2 - x, &pixels[pixel_position], resolved_palette); + + /* update x */ + x = x2; + } + + /* artifacting */ + if (m_legacy_video && (sample_count > 0)) + { + m_artifacter.process_artifacts<2>(pixels, scanline->m_mode[0], resolved_palette); + } +} + + + +//------------------------------------------------- +// update_screen +//------------------------------------------------- + +bool gime_base_device::update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect, const pixel_t *RESTRICT palette) +{ + int base_x = 64; + int min_x = USE_HORIZONTAL_CLIP ? cliprect.min_x : 0; + int max_x = USE_HORIZONTAL_CLIP ? cliprect.max_x : (base_x * 2 + 512 - 1); + int min_y = cliprect.min_y; + int max_y = cliprect.max_y; + palette_resolver resolver(this, palette); + + /* if the video didn't change, indicate as much */ + if (!has_video_changed()) + return UPDATE_HAS_NOT_CHANGED; + + for (int y = min_y; y <= max_y; y++) + { + const scanline_record *scanline = &m_scanlines[y]; + pixel_t *RESTRICT pixels = bitmap_addr(bitmap, y, 0); + + /* render the scanline */ + if (m_scanlines[y].m_line_in_row == (UINT8) ~0) + { + /* this is a border scanline */ + render_scanline<0, &gime_base_device::emit_dummy_samples>(scanline, pixels, min_x, max_x, &resolver); + } + else if (m_legacy_video) + { + /* this is a legacy body scanline */ + switch(scanline->m_ff22_value & (MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0)) + { + case MODE_AG: + case MODE_AG|MODE_GM0: + case MODE_AG|MODE_GM1|MODE_GM0: + case MODE_AG|MODE_GM2|MODE_GM0: + render_scanline<16, &gime_base_device::emit_mc6847_samples>(scanline, pixels, min_x, max_x, &resolver); + break; + + default: + render_scanline<32, &gime_base_device::emit_mc6847_samples>(scanline, pixels, min_x, max_x, &resolver); + break; + } + } + else if (scanline->m_ff98_value & 0x80) + { + /* GIME graphics */ + switch(scanline->m_ff99_value & 0x1F) + { + case 0x00: render_scanline< 16, &gime_base_device::emit_gime_graphics_samples< 4, 1> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x01: render_scanline< 16, &gime_base_device::emit_gime_graphics_samples< 8, 2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x02: + case 0x03: render_scanline< 16, &gime_base_device::emit_gime_graphics_samples<16, 4> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x04: render_scanline< 20, &gime_base_device::emit_gime_graphics_samples< 4, 1> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x05: render_scanline< 20, &gime_base_device::emit_gime_graphics_samples< 8, 2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x06: + case 0x07: render_scanline< 20, &gime_base_device::emit_gime_graphics_samples<16, 4> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x08: render_scanline< 32, &gime_base_device::emit_gime_graphics_samples< 2, 1> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x09: render_scanline< 32, &gime_base_device::emit_gime_graphics_samples< 4, 2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x0A: + case 0x0B: render_scanline< 32, &gime_base_device::emit_gime_graphics_samples< 8, 4> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x0C: render_scanline< 40, &gime_base_device::emit_gime_graphics_samples< 2, 1> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x0D: render_scanline< 40, &gime_base_device::emit_gime_graphics_samples< 4, 2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x0E: + case 0x0F: render_scanline< 40, &gime_base_device::emit_gime_graphics_samples< 8, 4> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x10: render_scanline< 64, &gime_base_device::emit_gime_graphics_samples< 1, 1> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x11: render_scanline< 64, &gime_base_device::emit_gime_graphics_samples< 2, 2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x12: + case 0x13: render_scanline< 64, &gime_base_device::emit_gime_graphics_samples< 4, 4> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x14: render_scanline< 80, &gime_base_device::emit_gime_graphics_samples< 1, 1> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x15: render_scanline< 80, &gime_base_device::emit_gime_graphics_samples< 2, 2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x16: + case 0x17: render_scanline< 80, &gime_base_device::emit_gime_graphics_samples< 4, 4> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x18: + case 0x19: render_scanline<128, &gime_base_device::emit_gime_graphics_samples< 1, 2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x1A: + case 0x1B: render_scanline<128, &gime_base_device::emit_gime_graphics_samples< 2, 4> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x1C: + case 0x1D: render_scanline<160, &gime_base_device::emit_gime_graphics_samples< 1, 2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x1E: + case 0x1F: render_scanline<160, &gime_base_device::emit_gime_graphics_samples< 2, 4> >(scanline, pixels, min_x, max_x, &resolver); break; + } + } + else + { + /* GIME text */ + switch(scanline->m_ff99_value & 0x14) + { + case 0x00: render_scanline<32, &gime_base_device::emit_gime_text_samples<2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x04: render_scanline<40, &gime_base_device::emit_gime_text_samples<2> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x10: render_scanline<64, &gime_base_device::emit_gime_text_samples<1> >(scanline, pixels, min_x, max_x, &resolver); break; + case 0x14: render_scanline<80, &gime_base_device::emit_gime_text_samples<1> >(scanline, pixels, min_x, max_x, &resolver); break; + } + } + } + return 0; +} + + + +//------------------------------------------------- +// update_composite +//------------------------------------------------- + +bool gime_base_device::update_composite(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + update_value(&m_displayed_rgb, false); + const pixel_t *palette = (m_gime_registers[0x08] & 0x10) + ? m_composite_bw_palette + : m_composite_palette; + return update_screen(bitmap, cliprect, palette); +} + + + +//------------------------------------------------- +// update_rgb +//------------------------------------------------- + +bool gime_base_device::update_rgb(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + update_value(&m_displayed_rgb, true); + return update_screen(bitmap, cliprect, m_rgb_palette); +} + + + +//************************************************************************** +// PALETTE RESOLVER MEMBER CLASS +//************************************************************************** + +//------------------------------------------------- +// palette_resolver::palette_resolver +//------------------------------------------------- + +inline gime_base_device::palette_resolver::palette_resolver(gime_base_device *gime, const pixel_t *palette) +{ + m_gime = gime; + m_palette = palette; + memset(m_resolved_palette, 0, sizeof(m_resolved_palette)); + m_current_resolved_palette = -1; +} + + + +//------------------------------------------------- +// palette_resolver::get_palette +//------------------------------------------------- + +inline const gime_base_device::pixel_t *gime_base_device::palette_resolver::get_palette(UINT16 palette_rotation) +{ + if (UNEXPECTED(m_current_resolved_palette != palette_rotation)) + { + for (int i = 0; i < 16; i++) + m_resolved_palette[i] = lookup(m_gime->m_palette_rotated[palette_rotation][i]); + m_current_resolved_palette = palette_rotation; + } + return m_resolved_palette; +} + + + +//------------------------------------------------- +// palette_resolver::lookup +//------------------------------------------------- + +inline gime_base_device::pixel_t gime_base_device::palette_resolver::lookup(UINT8 color) +{ + assert(color <= 63); + return m_palette[color]; +} + + + +//------------------------------------------------- +// hires_font +//------------------------------------------------- + +const UINT8 gime_base_device::hires_font[128][12] = +{ + { 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x10}, { 0x44, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00}, + { 0x08, 0x10, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, { 0x10, 0x28, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, + { 0x28, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, { 0x20, 0x10, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, + { 0x10, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, { 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x10}, + { 0x10, 0x28, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, { 0x28, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, + { 0x20, 0x10, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, { 0x28, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00}, + { 0x10, 0x28, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00}, { 0x00, 0x18, 0x24, 0x38, 0x24, 0x24, 0x38, 0x40}, + { 0x44, 0x10, 0x28, 0x44, 0x7C, 0x44, 0x44, 0x00}, { 0x10, 0x10, 0x28, 0x44, 0x7C, 0x44, 0x44, 0x00}, + { 0x08, 0x10, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, { 0x00, 0x00, 0x68, 0x14, 0x3C, 0x50, 0x3C, 0x00}, + { 0x3C, 0x50, 0x50, 0x78, 0x50, 0x50, 0x5C, 0x00}, { 0x10, 0x28, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, + { 0x28, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, { 0x00, 0x00, 0x38, 0x4C, 0x54, 0x64, 0x38, 0x00}, + { 0x10, 0x28, 0x00, 0x44, 0x44, 0x4C, 0x34, 0x00}, { 0x20, 0x10, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00}, + { 0x38, 0x4C, 0x54, 0x54, 0x54, 0x64, 0x38, 0x00}, { 0x44, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00}, + { 0x28, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00}, { 0x38, 0x40, 0x38, 0x44, 0x38, 0x04, 0x38, 0x00}, + { 0x08, 0x14, 0x10, 0x38, 0x10, 0x50, 0x3C, 0x00}, { 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x7C, 0x00}, + { 0x10, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x20, 0x40}, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00}, + { 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00}, + { 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00}, { 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00}, + { 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00}, { 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00}, + { 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00}, { 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00}, + { 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00}, { 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00}, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20}, { 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00}, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00}, { 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00}, + { 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00}, { 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00}, + { 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00}, { 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00}, + { 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00}, { 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00}, + { 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00}, { 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00}, + { 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00}, { 0x38, 0x44, 0x44, 0x38, 0x04, 0x04, 0x38, 0x00}, + { 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00}, { 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20}, + { 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00}, { 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00}, + { 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00}, { 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00}, + { 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00}, { 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00}, + { 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00}, { 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00}, + { 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00}, { 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00}, + { 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00}, { 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00}, + { 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00}, { 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00}, + { 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00}, { 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00}, + { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00}, { 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00}, + { 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00}, { 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00}, + { 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00}, { 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00}, + { 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00}, { 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00}, + { 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00}, { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00}, + { 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00}, { 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00}, + { 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00}, { 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00}, + { 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00}, { 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00}, + { 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00}, { 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00}, + { 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00}, { 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00}, + { 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, + { 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00}, { 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00}, + { 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00}, { 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, + { 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00}, { 0x00, 0x00, 0x34, 0x4C, 0x4C, 0x34, 0x04, 0x38}, + { 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00}, { 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00}, + { 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x44, 0x38}, { 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00}, + { 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00}, { 0x00, 0x00, 0x68, 0x54, 0x54, 0x54, 0x54, 0x00}, + { 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00}, { 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, + { 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40}, { 0x00, 0x00, 0x3C, 0x44, 0x44, 0x3C, 0x04, 0x04}, + { 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00}, { 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00}, + { 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00}, { 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00}, + { 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00}, { 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00}, + { 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00}, { 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38}, + { 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00}, { 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00}, + { 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00}, { 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00}, + { 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00} +}; + + + +//************************************************************************** +// VARIATIONS +//************************************************************************** + +const device_type GIME_NTSC = &device_creator; +const device_type GIME_PAL = &device_creator; + + + +//------------------------------------------------- +// gime_ntsc_device +//------------------------------------------------- + +gime_ntsc_device::gime_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : gime_base_device(mconfig, GIME_NTSC, "GIME_NTSC", tag, owner, clock, ntsc_round_fontdata8x12, "gime_ntsc", __FILE__) +{ +} + + + +//------------------------------------------------- +// gime_pal_device +//------------------------------------------------- + +gime_pal_device::gime_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : gime_base_device(mconfig, GIME_PAL, "GIME_PAL", tag, owner, clock, pal_round_fontdata8x12, "gime_pal", __FILE__) +{ +} diff --git a/src/mame/video/gime.h b/src/mame/video/gime.h new file mode 100644 index 00000000000..862dfeec3b0 --- /dev/null +++ b/src/mame/video/gime.h @@ -0,0 +1,311 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods +/********************************************************************* + + gime.h + + Implementation of CoCo GIME (Graphics Interrupt Memory Enhancement) + video chip. + +***************************************************************************/ + +#pragma once + +#ifndef __GIME__ +#define __GIME__ + +#include "video/mc6847.h" +#include "machine/6883sam.h" +#include "machine/ram.h" + + +//************************************************************************** +// GIME CONFIG/INTERFACE +//************************************************************************** + +#define MCFG_GIME_HSYNC_CALLBACK MCFG_MC6847_HSYNC_CALLBACK + +#define MCFG_GIME_FSYNC_CALLBACK MCFG_MC6847_FSYNC_CALLBACK + +#define MCFG_GIME_IRQ_CALLBACK(_write) \ + devcb = &gime_base_device::set_irq_wr_callback(*device, DEVCB_##_write); + +#define MCFG_GIME_FIRQ_CALLBACK(_write) \ + devcb = &gime_base_device::set_firq_wr_callback(*device, DEVCB_##_write); + +#define MCFG_GIME_FLOATING_BUS_CALLBACK(_read) \ + devcb = &gime_base_device::set_floating_bus_rd_callback(*device, DEVCB_##_read); + +#define MCFG_GIME_MAINCPU(_tag) \ + gime_base_device::set_maincpu_tag(*device, _tag); + +#define MCFG_GIME_RAM(_tag) \ + gime_base_device::set_ram_tag(*device, _tag); + +#define MCFG_GIME_EXT(_tag) \ + gime_base_device::set_ext_tag(*device, _tag); + + +//************************************************************************** +// GIME CORE +//************************************************************************** + +class cococart_slot_device; + +class gime_base_device : public mc6847_friend_device, public sam6883_friend_device +{ +public: + template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_irq.set_callback(object); } + template static devcb_base &set_firq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_firq.set_callback(object); } + template static devcb_base &set_floating_bus_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_floating_bus.set_callback(object); } + static void set_maincpu_tag(device_t &device, const char *tag) { downcast(device).m_maincpu_tag = tag; } + static void set_ram_tag(device_t &device, const char *tag) { downcast(device).m_ram_tag = tag; } + static void set_ext_tag(device_t &device, const char *tag) { downcast(device).m_ext_tag = tag; } + + // read/write + DECLARE_READ8_MEMBER( read ) { return read(offset); } + DECLARE_WRITE8_MEMBER( write ) { write(offset, data); } + + // used to turn on/off reading/writing to $FF40-$FF5F + bool spare_chip_select_enabled(void) { return m_gime_registers[0] & 0x04 ? true : false; } + + // the GIME seems to intercept writes to $FF22 (not precisely sure how) + void ff22_write(UINT8 data) { m_ff22_value = data; } + + // updates the cart ROM + void update_cart_rom(void); + + /* updates the screen -- this will call begin_update(), + followed by update_row() reapeatedly and after all row + updating is complete, end_update() */ + bool update_composite(bitmap_rgb32 &bitmap, const rectangle &cliprect); + bool update_rgb(bitmap_rgb32 &bitmap, const rectangle &cliprect); + + // interrupt outputs + bool firq_r(void) { return m_firq != 0x00; } + bool irq_r(void) { return m_irq != 0x00; } + + // interrupt inputs + void set_il0(bool value) { set_interrupt_value(INTERRUPT_EI0, value); } + void set_il1(bool value) { set_interrupt_value(INTERRUPT_EI1, value); } + void set_il2(bool value) { set_interrupt_value(INTERRUPT_EI2, value); } + +protected: + gime_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const UINT8 *fontdata, const char *shortname, const char *source); + + // device-level overrides + virtual void device_start(void); + virtual void device_reset(void); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void device_pre_save(void); + virtual void device_post_load(void); + virtual ioport_constructor device_input_ports() const; + + // other overrides + virtual void new_frame(void); + virtual void horizontal_sync_changed(bool line); + virtual void enter_bottom_border(void); + virtual void record_border_scanline(UINT16 physical_scanline); + virtual void record_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline); + virtual void record_partial_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline, INT32 start_clock, INT32 end_clock); + +private: + typedef mc6847_friend_device super; + + struct scanline_record + { + UINT8 m_border; + UINT8 m_line_in_row; + UINT8 m_ff22_value; + UINT8 m_ff98_value; + UINT8 m_ff99_value; + UINT8 m_mode[160]; + UINT8 m_data[160]; + UINT16 m_palette[160]; + }; + + typedef UINT32 (gime_base_device::*get_data_func)(UINT32, UINT8 *, UINT8 *); + + class palette_resolver + { + public: + palette_resolver(gime_base_device *gime, const pixel_t *palette); + const pixel_t *get_palette(UINT16 palette_rotation); + pixel_t lookup(UINT8 color); + + private: + gime_base_device *m_gime; + const pixel_t *m_palette; + pixel_t m_resolved_palette[16]; + int m_current_resolved_palette; + }; + + enum + { + INTERRUPT_TMR = 0x20, + INTERRUPT_HBORD = 0x10, + INTERRUPT_VBORD = 0x08, + INTERRUPT_EI2 = 0x04, + INTERRUPT_EI1 = 0x02, + INTERRUPT_EI0 = 0x01 + }; + + enum timer_type_t + { + GIME_TIMER_HBORD, + GIME_TIMER_CLOCK + }; + + // timer constants + static const device_timer_id TIMER_GIME_CLOCK = 4; + + // statics + static const UINT8 hires_font[128][12]; + + // callbacks + devcb_write_line m_write_irq; + devcb_write_line m_write_firq; + devcb_read8 m_read_floating_bus; + + // device state + UINT8 m_gime_registers[16]; + UINT8 m_mmu[16]; + UINT8 m_ff22_value; + UINT8 m_interrupt_value; + UINT8 m_irq; + UINT8 m_firq; + UINT16 m_timer_value; + bool m_is_blinking; + + // video state + bool m_legacy_video; + UINT32 m_video_position; + UINT8 m_line_in_row; + scanline_record m_scanlines[25+192+26]; + bool m_displayed_rgb; + + // palette state + UINT8 m_palette_rotated[1024][16]; + UINT16 m_palette_rotated_position; + bool m_palette_rotated_position_used; + + // incidentals + ram_device * m_ram; + emu_timer * m_gime_clock_timer; + cococart_slot_device * m_cart_device; + memory_bank * m_read_banks[9]; + memory_bank * m_write_banks[9]; + UINT8 * m_rom; + UINT8 * m_cart_rom; + pixel_t m_composite_palette[64]; + pixel_t m_composite_bw_palette[64]; + pixel_t m_rgb_palette[64]; + UINT8 m_dummy_bank[0x2000]; + + const char *m_maincpu_tag; /* tag of main CPU */ + const char *m_ram_tag; /* tag of RAM device */ + const char *m_ext_tag; /* tag of expansion device */ + + // timer constants + static const device_timer_id TIMER_FRAME = 0; + static const device_timer_id TIMER_HSYNC_OFF = 1; + static const device_timer_id TIMER_HSYNC_ON = 2; + static const device_timer_id TIMER_FSYNC_OFF = 3; + static const device_timer_id TIMER_FSYNC_ON = 4; + + // read/write + UINT8 read(offs_t offset); + UINT8 read_gime_register(offs_t offset); + UINT8 read_mmu_register(offs_t offset); + UINT8 read_palette_register(offs_t offset); + UINT8 read_floating_bus(void); + void write(offs_t offset, UINT8 data); + void write_gime_register(offs_t offset, UINT8 data); + void write_mmu_register(offs_t offset, UINT8 data); + void write_palette_register(offs_t offset, UINT8 data); + void write_sam_register(offs_t offset); + + // memory + void update_memory(void); + void update_memory(int bank); + UINT8 *memory_pointer(UINT32 address); + + // interrupts + void interrupt_rising_edge(UINT8 interrupt); + void recalculate_irq(void); + void recalculate_firq(void); + + ATTR_FORCE_INLINE void set_interrupt_value(UINT8 interrupt, bool value) + { + /* save the old interrupt value */ + UINT8 old_interrupt_value = m_interrupt_value; + + /* update the interrupt value */ + if (value) + m_interrupt_value |= interrupt; + else + m_interrupt_value &= ~interrupt; + + /* was this a rising edge? */ + if (value && ((old_interrupt_value & interrupt) == 0)) + { + interrupt_rising_edge(interrupt); + } + } + + // timer + timer_type_t timer_type(void); + const char *timer_type_string(void); + void reset_timer(void); + void timer_elapsed(void); + + // video + bool update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect, const pixel_t *palette); + void update_geometry(void); + void update_border(UINT16 physical_scanline); + pixel_t get_composite_color(int color); + pixel_t get_rgb_color(int color); + offs_t get_video_base(void); + UINT16 get_lines_per_row(void); + UINT32 get_data_mc6847(UINT32 video_position, UINT8 *data, UINT8 *mode); + UINT32 get_data_without_attributes(UINT32 video_position, UINT8 *data, UINT8 *mode); + UINT32 get_data_with_attributes(UINT32 video_position, UINT8 *data, UINT8 *mode); + bool is_blinking(void); + + // template function for doing video update collection + template + UINT32 record_scanline_res(int scanline); + + // rendering sampled graphics + typedef UINT32 (gime_base_device::*emit_samples_proc)(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); + UINT32 emit_dummy_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); + UINT32 emit_mc6847_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); + template + UINT32 emit_gime_text_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); + template + UINT32 emit_gime_graphics_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); + template + void render_scanline(const scanline_record *scanline, pixel_t *pixels, int min_x, int max_x, palette_resolver *resolver); +}; + + +//************************************************************************** +// VARIATIONS +//************************************************************************** + +class gime_ntsc_device : public gime_base_device +{ +public: + gime_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +class gime_pal_device : public gime_base_device +{ +public: + gime_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type GIME_NTSC; +extern const device_type GIME_PAL; + +#endif /* __GIME__ */ diff --git a/src/mame/video/hec2video.c b/src/mame/video/hec2video.c new file mode 100644 index 00000000000..f16f23b8363 --- /dev/null +++ b/src/mame/video/hec2video.c @@ -0,0 +1,141 @@ +// license:BSD-3-Clause +// copyright-holders:JJ Stacino +///////////////////////////////////////////////////////////////////////////////// +///// Hector video +///////////////////////////////////////////////////////////////////////////////// +/* Hector 2HR+ + Victor + Hector 2HR + Hector HRX + Hector MX40c + Hector MX80c + Hector 1 + Interact + + 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com + 31/06/2009 Video - Robbbert + + 29/10/2009 Update skeleton to functional machine + by yo_fr (jj.stac @ aliceadsl.fr) + + => add Keyboard, + => add color, + => add cassette, + => add sn76477 sound and 1bit sound, + => add joysticks (stick, pot, fire) + => add BR/HR switching + => add bank switch for HRX + => add device MX80c and bank switching for the ROM + Importante note : the keyboard function add been piked from + DChector project : http://dchector.free.fr/ made by DanielCoulom + (thank's Daniel) + TODO : Add the cartridge function, + Adjust the one shot and A/D timing (sn76477) +*/ + +#include "emu.h" + +#include "includes/hec2hrp.h" + + +void hec2hrp_state::Init_Hector_Palette() +{ + UINT8 *hector_color = m_hector_color; + // basic colors ! + hector_color[0] = 0; // fond (noir) + hector_color[1] = 1; // HECTOR HRX (rouge) + hector_color[2] = 7; // Point interrogation (Blanc) + hector_color[3] = 3; // Ecriture de choix (jaune) + + // Color initialisation : full lightning + m_palette->set_pen_color( 0,rgb_t(000,000,000));//Noir + m_palette->set_pen_color( 1,rgb_t(255,000,000));//Rouge + m_palette->set_pen_color( 2,rgb_t(000,255,000));//Vert + m_palette->set_pen_color( 3,rgb_t(255,255,000));//Jaune + m_palette->set_pen_color( 4,rgb_t(000,000,255));//Bleu + m_palette->set_pen_color( 5,rgb_t(255,000,255));//Magneta + m_palette->set_pen_color( 6,rgb_t(000,255,255));//Cyan + m_palette->set_pen_color( 7,rgb_t(255,255,255));//Blanc + // 1/2 lightning + + m_palette->set_pen_color( 8,rgb_t(000,000,000));//Noir + m_palette->set_pen_color( 9,rgb_t(128,000,000));//Rouge + m_palette->set_pen_color( 10,rgb_t(000,128,000));//Vert + m_palette->set_pen_color( 11,rgb_t(128,128,000));//Jaune + m_palette->set_pen_color( 12,rgb_t(000,000,128));//Bleu + m_palette->set_pen_color( 13,rgb_t(128,000,128));//Magneta + m_palette->set_pen_color( 14,rgb_t(000,128,128));//Cyan + m_palette->set_pen_color( 15,rgb_t(128,128,128));//Blanc +} + +void hec2hrp_state::hector_hr(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) +{ + UINT8 *hector_color = m_hector_color; + UINT8 gfx,y; + UINT16 sy=0,ma=0,x; + for (y = 0; y <= ymax; y++) { //224 + UINT16 *p = &bitmap.pix16(sy++); + for (x = ma; x < ma + yram; x++) { // 64 + gfx = *(page+x); + /* Display a scanline of a character (4 pixels !) */ + *p++ = hector_color[(gfx >> 0) & 0x03]; + *p++ = hector_color[(gfx >> 2) & 0x03]; + *p++ = hector_color[(gfx >> 4) & 0x03]; + *p++ = hector_color[(gfx >> 6) & 0x03]; + } + ma+=yram; + } +} + +void hec2hrp_state::hector_80c(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) +{ + UINT8 gfx,y; + UINT16 sy=0,ma=0,x; + for (y = 0; y <= ymax; y++) { //224 + UINT16 *p = &bitmap.pix16(sy++); + for (x = ma; x < ma + yram; x++) { // 64 + gfx = *(page+x); + /* Display a scanline of a character (8 pixels !) */ + *p++ = (gfx & 0x01) ? 7 : 0; + *p++ = (gfx & 0x02) ? 7 : 0; + *p++ = (gfx & 0x04) ? 7 : 0; + *p++ = (gfx & 0x08) ? 7 : 0; + *p++ = (gfx & 0x10) ? 7 : 0; + *p++ = (gfx & 0x20) ? 7 : 0; + *p++ = (gfx & 0x40) ? 7 : 0; + *p++ = (gfx & 0x80) ? 7 : 0; + } + ma+=yram; + } +} + + +VIDEO_START_MEMBER(hec2hrp_state,hec2hrp) +{ + Init_Hector_Palette(); +} + +UINT32 hec2hrp_state::screen_update_hec2hrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_videoram; + UINT8 *videoram_HR = m_hector_videoram; + if (m_hector_flag_hr==1) + { + if (m_hector_flag_80c==0) + { + screen.set_visible_area(0, 243, 0, 227); + hector_hr(bitmap , &videoram_HR[0], 227, 64); + } + else + { + screen.set_visible_area(0, 243*2, 0, 227); + hector_80c(bitmap , &videoram_HR[0], 227, 64); + } + } + else + { + screen.set_visible_area(0, 113, 0, 75); + hector_hr(bitmap, videoram, 77, 32); + } + return 0; +} diff --git a/src/mame/video/hp48.c b/src/mame/video/hp48.c new file mode 100644 index 00000000000..03883f17100 --- /dev/null +++ b/src/mame/video/hp48.c @@ -0,0 +1,203 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2008 + + Hewlett Packard HP48 S/SX & G/GX/G+ + +**********************************************************************/ + +#include "emu.h" +#include "includes/hp48.h" + +/*************************************************************************** + DEBUGGING +***************************************************************************/ + + +#define VERBOSE 0 + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + + + +/*************************************************************************** + GLOBAL VARIABLES & CONSTANTS +***************************************************************************/ + +/* base colors */ +static const int hp48_bg_color[3] = { 136, 147, 109 }; /* yellow */ +static const int hp48_fg_color[3] = { 0, 0, 64 }; /* dark blue */ + +/* color mixing */ +#define mix(c1,c2,x) (c1)*(1-(x))+(c2)*(x) +#define mix2(i,x) mix(hp48_bg_color[i],hp48_fg_color[i],x) + + + + +/*************************************************************************** + FUNCTIONS +***************************************************************************/ + +PALETTE_INIT_MEMBER(hp48_state, hp48) +{ + int i; + for ( i = 0; i < 255; i++ ) + { + float c = i/255.; + m_palette->set_pen_color( i, rgb_t( 0, mix2(0,c), mix2(1,c), mix2(2,c) ) ); + } +} + + + +/* The screen is organised as follows: + + + + announciators + + ---------------------- ^ ^ + | | | | + | | | | + | | | | + | | M lines | + | main screen | | | + | | | | + | | | 64 lines + | | | | + | | | | + |----------------------| - | + | | | | + | menu | m lines | + | | | | + ---------------------- v v + + <----- 131 columns ----> + + + + The LCD is 131x64 pixels and has two components: + - a main screen + - a menu screen + + The main height (M) and the menu height (m) can be changed with the constraints: + - m+M=64 + - M>=2 + + Pixels are 1-bit, packed in memory. + + The start address of both screens can be changed independently + (this allows smooth, pixel-precise vertical scrooling of both parts). + They must be even addresses (in nibbles). + + The stride (offset in nibbles between two scanlines) can be changed for the main screen. + It must be even. + It is fixed to 34 for the menu screen. + + The bit offset for the first column of the main screen can be changed + (this allows smooth, pixel-precise horizontal scrooling). + It is always 0 for the menu screen. + + Above the LCD, there are 6 annonciators that can be independently turned + on and off (and independetly from the LCD). + They are not handled here, but through output_set_value. + */ + + +/* + In theory, the LCD is monorchrome, with a global adjustable contrast (32 levels). + However, by switching between screens at each refresh (64 Hz), one can achieve the + illusion of grayscale, with moderate flickering. + This technique was very widespread. + We emulate it by simply averaging between the last few (HP48_NB_SCREENS) frames. + + HP48_NB_SCREENS should be a multiple of the period of screen flips to avoid + flickering in the emulation. + */ + + +#define draw_pixel \ + m_screens[ m_cur_screen ][ y ][ xp + 8 ] = (data & 1) ? fg : 0; \ + xp++; \ + data >>= 1 + +#define draw_quart \ + UINT8 data = space.read_byte( addr ); \ + draw_pixel; draw_pixel; draw_pixel; draw_pixel; + + +UINT32 hp48_state::screen_update_hp48(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int x, y, xp, i, addr; + int display = HP48_IO_4(0) >> 3; /* 1=on, 0=off */ + int left_margin = HP48_IO_4(0) & 7; /* 0..7 pixels for main bitmap */ + int contrast = HP48_IO_8(1) & 0x1f; /* 0..31 */ + int refresh = HP48_IO_4(3) >> 3; /* vertical refresh */ + int bitmap_start = HP48_IO_20(0x20) & ~1; /* main bitmap address */ + int right_margin = HP48_IO_12(0x25) & ~1; /* -2048..2046 nibbles for main bitmap */ + int last_line = HP48_IO_8(0x28) & 0x3f; /* 2..63 lines of main bitmap before menu */ + int menu_start = HP48_IO_20(0x30) & ~1; /* menu bitmap address */ + int fg = contrast + 2; + + LOG(( "%f hp48 video_update called: ", machine().time().as_double())); + + if ( !display || refresh ) + { + LOG(( "display off\n" )); + bitmap.fill(0 ); + return 0; + } + + /* correcting factors */ + if ( right_margin & 0x800 ) right_margin -= 0x1000; + if ( last_line <= 1 ) last_line = 0x3f; + + LOG(( "on=%i lmargin=%i rmargin=%i contrast=%i start=%05x lline=%i menu=%05x\n", + display, left_margin, right_margin, contrast, bitmap_start, last_line, menu_start )); + + /* draw main bitmap */ + addr = bitmap_start; + for ( y = 0; y <= last_line; y++ ) + { + xp = -left_margin; + for ( x = 0; x < 34; x++, addr++ ) + { + draw_quart; + } + addr += (right_margin + (left_margin / 4) + 1) & ~1; + } + + /* draw menu bitmap */ + addr = menu_start; + for ( ; y <= 0x3f; y++ ) + { + xp = 0; + for ( x = 0; x < 34; x++, addr++ ) + { + draw_quart; + } + } + + /* draw averaged frames */ + for ( y = 0; y < 64; y++ ) + { + for ( x = 0; x < 131; x++ ) + { + int acc = 0; + for ( i = 0; i < HP48_NB_SCREENS; i++ ) + { + acc += m_screens[ i ][ y ][ x+8 ]; + } + acc = (acc * 255) / (33 * HP48_NB_SCREENS); + bitmap.pix16(y, x ) = acc; + } + } + + m_cur_screen = (m_cur_screen + 1) % HP48_NB_SCREENS; + + return 0; +} diff --git a/src/mame/video/intv.c b/src/mame/video/intv.c new file mode 100644 index 00000000000..42c12b743a8 --- /dev/null +++ b/src/mame/video/intv.c @@ -0,0 +1,137 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,Frank Palazzolo +#include "emu.h" +#include "includes/intv.h" + +void intv_state::video_start() +{ + m_tms9927_num_rows = 25; +} + + +/* very rudimentary support for the tms9927 character generator IC */ + + +READ8_MEMBER( intv_state::intvkbd_tms9927_r ) +{ + UINT8 rv; + switch (offset) + { + case 8: + rv = m_tms9927_cursor_row; + break; + case 9: + /* note: this is 1-based */ + rv = m_tms9927_cursor_col; + break; + case 11: + m_tms9927_last_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows; + rv = m_tms9927_last_row; + break; + default: + rv = 0; + } + return rv; +} + +WRITE8_MEMBER( intv_state::intvkbd_tms9927_w ) +{ + switch (offset) + { + case 3: + m_tms9927_num_rows = (data & 0x3f) + 1; + break; + case 6: + m_tms9927_last_row = data; + break; + case 11: + m_tms9927_last_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows; + break; + case 12: + /* note: this is 1-based */ + m_tms9927_cursor_col = data; + break; + case 13: + m_tms9927_cursor_row = data; + break; + } +} + + +UINT32 intv_state::screen_update_intv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_stic->screen_update(screen, bitmap, cliprect); + return 0; +} + + +UINT32 intv_state::screen_update_intvkbd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_videoram; + int x,y,offs; + int current_row; +// char c; + + /* Draw the underlying INTV screen first */ + m_stic->screen_update(screen, bitmap, cliprect); + + /* if the intvkbd text is not blanked, overlay it */ + if (!m_intvkbd_text_blanked) + { + current_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows; + for(y=0;y<24;y++) + { + for(x=0;x<40;x++) + { + offs = current_row*64+x; + + m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, + videoram[offs], + 7, /* white */ + 0,0, + x<<3,y<<3, 0); + } + if (current_row == m_tms9927_cursor_row) + { + /* draw the cursor as a solid white block */ + /* (should use a filled rect here!) */ + + m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, + 191, /* a block */ + 7, /* white */ + 0,0, + (m_tms9927_cursor_col-1)<<3,y<<3, 0); + } + current_row = (current_row + 1) % m_tms9927_num_rows; + } + } + +#if 0 + // debugging + c = tape_motor_mode_desc[m_tape_motor_mode][0]; + m_gfxdecode->gfx(0)->transpen(bitmap,&machine().screen[0].visarea, + c, + 1, + 0,0, + 0*8,0*8, 0); + for(y=0;y<5;y++) + { + m_gfxdecode->gfx(0)->transpen(bitmap,&machine().screen[0].visarea, + m_tape_unknown_write[y]+'0', + 1, + 0,0, + 0*8,(y+2)*8, 0); + } + m_gfxdecode->gfx(0)->transpen(bitmap,&machine().screen[0].visarea, + m_tape_unknown_write[5]+'0', + 1, + 0,0, + 0*8,8*8, 0); + m_gfxdecode->gfx(0)->transpen(bitmap,&machine().screen[0].visarea, + m_tape_interrupts_enabled+'0', + 1, + 0,0, + 0*8,10*8, 0); +#endif + return 0; +} diff --git a/src/mame/video/k1ge.c b/src/mame/video/k1ge.c new file mode 100644 index 00000000000..94e0398fd1a --- /dev/null +++ b/src/mame/video/k1ge.c @@ -0,0 +1,918 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/****************************************************************************** + + K1GE/K2GE graphics emulation + + The K1GE graphics were used in the Neogeo pocket mono; the K2GE graphics were + used in the Neogeo pocket color. + +******************************************************************************/ + +#include "emu.h" +#include "k1ge.h" + + +PALETTE_INIT_MEMBER(k1ge_device, k1ge) +{ + int i; + + for ( i = 0; i < 8; i++ ) + { + int j = ( i << 5 ) | ( i << 2 ) | ( i >> 1 ); + + palette.set_pen_color( 7-i, j, j, j ); + } +} + + +PALETTE_INIT_MEMBER(k2ge_device, k2ge) +{ + int r,g,b; + + for ( b = 0; b < 16; b++ ) + { + for ( g = 0; g < 16; g++ ) + { + for ( r = 0; r < 16; r++ ) + { + palette.set_pen_color( ( b << 8 ) | ( g << 4 ) | r, ( r << 4 ) | r, ( g << 4 ) | g, ( b << 4 ) | b ); + } + } + } +} + + +READ8_MEMBER( k1ge_device::read ) +{ + assert(offset < 0x4000); + + UINT8 data = m_vram[offset]; + + switch( offset ) + { + case 0x008: /* RAS.H */ + data = m_screen->hpos() >> 2; + break; + case 0x009: /* RAS.V */ + data = m_screen->vpos(); + break; + } + return data; +} + + +WRITE8_MEMBER( k1ge_device::write ) +{ + assert(offset < 0x4000); + + switch( offset ) + { + case 0x000: + m_vblank_pin_w( ( data & 0x80 ) ? ( ( m_vram[0x010] & 0x40 ) ? 1 : 0 ) : 0 ); + break; + case 0x030: + data &= 0x80; + break; + case 0x101: case 0x102: case 0x103: + case 0x105: case 0x106: case 0x107: + case 0x109: case 0x10a: case 0x10b: + case 0x10d: case 0x10e: case 0x10f: + case 0x111: case 0x112: case 0x113: + case 0x115: case 0x116: case 0x117: + data &= 0x07; + break; + case 0x7e2: + if ( m_vram[0x7f0] != 0xaa ) + return; + data &= 0x80; + break; + } + + /* Only the lower 4 bits of the palette entry high bytes can be written */ + if ( offset >= 0x0200 && offset < 0x0400 && ( offset & 1 ) ) + { + data &= 0x0f; + } + + m_vram[offset] = data; +} + + +void k1ge_device::draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, int pal_base ) +{ + int i; + int offset_x = ( scroll_x >> 3 ) * 2; + int px = scroll_x & 0x07; + UINT16 map_data; + UINT16 hflip; + UINT16 pcode; + UINT16 tile_addr; + UINT16 tile_data; + + base += ( ( ( ( scroll_y + line ) >> 3 ) * 0x0040 ) & 0x7ff ); + + /* setup */ + map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); + hflip = map_data & 0x8000; + pcode = pal_base + ( ( map_data & 0x2000 ) ? 4 : 0 ); + tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); + if ( map_data & 0x4000 ) + tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; + else + tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + if ( hflip ) + tile_data >>= 2 * ( scroll_x & 0x07 ); + else + tile_data <<= 2 * ( scroll_x & 0x07 ); + + /* draw pixels */ + for ( i = 0; i < 160; i++ ) + { + UINT16 col; + + if ( hflip ) + { + col = tile_data & 0x0003; + tile_data >>= 2; + } + else + { + col = tile_data >> 14; + tile_data <<= 2; + } + + if ( col ) + { + p[ i ] = m_vram[ pcode + col ]; + } + + px++; + if ( px >= 8 ) + { + offset_x = ( offset_x + 2 ) & 0x3f; + map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); + hflip = map_data & 0x8000; + pcode = pal_base + ( ( map_data & 0x2000 ) ? 4 : 0 ); + tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); + if ( map_data & 0x4000 ) + tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; + else + tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + px = 0; + } + } +} + + +void k1ge_device::draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ) +{ + struct { + UINT16 spr_data; + UINT8 x; + UINT8 y; + } spr[64]; + int num_sprites = 0; + UINT8 spr_y = 0; + UINT8 spr_x = 0; + int i; + + priority <<= 11; + + /* Select sprites */ + for ( i = 0; i < 256; i += 4 ) + { + UINT16 spr_data = m_vram[ 0x800 + i ] | ( m_vram[ 0x801 + i ] << 8 ); + UINT8 x = m_vram[ 0x802 + i ]; + UINT8 y = m_vram[ 0x803 + i ]; + + spr_x = ( spr_data & 0x0400 ) ? ( spr_x + x ) : ( scroll_x + x ); + spr_y = ( spr_data & 0x0200 ) ? ( spr_y + y ) : ( scroll_y + y ); + + if ( ( spr_data & 0x1800 ) == priority ) + { + if ( ( line >= spr_y || spr_y > 0xf8 ) && line < ( ( spr_y + 8 ) & 0xff ) ) + { + spr[num_sprites].spr_data = spr_data; + spr[num_sprites].y = spr_y; + spr[num_sprites].x = spr_x; + num_sprites++; + } + } + } + + /* Draw sprites */ + for ( i = num_sprites-1; i >= 0; i-- ) + { + int j; + UINT16 tile_addr; + UINT16 tile_data; + UINT16 pcode = 0x100 + ( ( spr[i].spr_data & 0x2000 ) ? 4 : 0 ); + + tile_addr = 0x2000 + ( ( spr[i].spr_data & 0x1ff ) * 16 ); + if ( spr[i].spr_data & 0x4000 ) + tile_addr += ( 7 - ( ( line - spr[i].y ) & 0x07 ) ) * 2; + else + tile_addr += ( ( line - spr[i].y ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + + for ( j = 0; j < 8; j++ ) + { + UINT16 col; + + spr_x = spr[i].x + j; + + if ( spr[i].spr_data & 0x8000 ) + { + col = tile_data & 0x03; + tile_data >>= 2; + } + else + { + col = tile_data >> 14; + tile_data <<= 2; + } + + if ( spr_x < 160 && col ) + { + p[ spr_x ] = m_vram[ pcode + col ]; + } + } + } +} + + +void k1ge_device::draw( int line ) +{ + UINT16 *p = &m_bitmap->pix16(line); + UINT16 oowcol = m_vram[0x012] & 0x07; + int i; + + if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) + { + for( i = 0; i < 160; i++ ) + { + p[i] = oowcol; + } + } + else + { + UINT16 col = ( ( m_vram[0x118] & 0xc0 ) == 0x80 ) ? m_vram[0x118] & 0x07 : 0; + + for ( i = 0; i < 160; i++ ) + p[i] = col; + + if ( m_vram[0x030] & 0x80 ) + { + /* Draw sprites with 01 priority */ + draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF1 */ + draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x108 ); + + /* Draw sprites with 10 priority */ + draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF2 */ + draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x110 ); + + /* Draw sprites with 11 priority */ + draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); + } + else + { + /* Draw sprites with 01 priority */ + draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF2 */ + draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x110 ); + + /* Draw sprites with 10 priority */ + draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF1 */ + draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x108 ); + + /* Draw sprites with 11 priority */ + draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); + } + + for( i = 0; i < m_wba_h; i++ ) + { + p[i] = oowcol; + } + + for( i = m_wba_h + m_wsi_h; i < 160; i++ ) + { + p[i] = oowcol; + } + } +} + + +void k2ge_device::draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_base ) +{ + int i; + int offset_x = ( scroll_x >> 3 ) * 2; + int px = scroll_x & 0x07; + UINT16 map_data; + UINT16 hflip; + UINT16 pcode; + UINT16 tile_addr; + UINT16 tile_data; + + base += ( ( ( ( scroll_y + line ) >> 3 ) * 0x0040 ) & 0x7ff ); + + /* setup */ + map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); + hflip = map_data & 0x8000; + pcode = pal_base + ( ( map_data & 0x1e00 ) >> 6 ); + tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); + if ( map_data & 0x4000 ) + tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; + else + tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + if ( hflip ) + tile_data >>= 2 * ( scroll_x & 0x07 ); + else + tile_data <<= 2 * ( scroll_x & 0x07 ); + + /* draw pixels */ + for ( i = 0; i < 160; i++ ) + { + UINT16 col; + + if ( hflip ) + { + col = tile_data & 0x0003; + tile_data >>= 2; + } + else + { + col = tile_data >> 14; + tile_data <<= 2; + } + + if ( col ) + { + p[ i ] = m_vram[ pcode + col * 2 ] | ( m_vram[ pcode + col * 2 + 1 ] << 8 ); + } + + px++; + if ( px >= 8 ) + { + offset_x = ( offset_x + 2 ) & 0x3f; + map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); + hflip = map_data & 0x8000; + pcode = pal_base + ( ( map_data & 0x1e00 ) >> 6 ); + tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); + if ( map_data & 0x4000 ) + tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; + else + tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + px = 0; + } + } +} + + +void k2ge_device::draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ) +{ + struct { + UINT16 spr_data; + UINT8 x; + UINT8 y; + UINT8 index; + } spr[64]; + int num_sprites = 0; + UINT8 spr_y = 0; + UINT8 spr_x = 0; + int i; + + priority <<= 11; + + /* Select sprites */ + for ( i = 0; i < 256; i += 4 ) + { + UINT16 spr_data = m_vram[ 0x800 + i ] | ( m_vram[ 0x801 + i ] << 8 ); + UINT8 x = m_vram[ 0x802 + i ]; + UINT8 y = m_vram[ 0x803 + i ]; + + spr_x = ( spr_data & 0x0400 ) ? ( spr_x + x ) : ( scroll_x + x ); + spr_y = ( spr_data & 0x0200 ) ? ( spr_y + y ) : ( scroll_y + y ); + + if ( ( spr_data & 0x1800 ) == priority ) + { + if ( ( line >= spr_y || spr_y > 0xf8 ) && line < ( ( spr_y + 8 ) & 0xff ) ) + { + spr[num_sprites].spr_data = spr_data; + spr[num_sprites].y = spr_y; + spr[num_sprites].x = spr_x; + spr[num_sprites].index = i >> 2; + num_sprites++; + } + } + } + + /* Draw sprites */ + for ( i = num_sprites-1; i >= 0; i-- ) + { + int j; + UINT16 tile_addr; + UINT16 tile_data; + UINT16 pcode = 0x0200 + ( ( m_vram[0x0c00 + spr[i].index ] & 0x0f ) << 3 ); + + tile_addr = 0x2000 + ( ( spr[i].spr_data & 0x1ff ) * 16 ); + if ( spr[i].spr_data & 0x4000 ) + tile_addr += ( 7 - ( ( line - spr[i].y ) & 0x07 ) ) * 2; + else + tile_addr += ( ( line - spr[i].y ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + + for ( j = 0; j < 8; j++ ) + { + UINT16 col; + + spr_x = spr[i].x + j; + + if ( spr[i].spr_data & 0x8000 ) + { + col = tile_data & 0x03; + tile_data >>= 2; + } + else + { + col = tile_data >> 14; + tile_data <<= 2; + } + + if ( spr_x < 160 && col ) + { + p[ spr_x ] = m_vram[ pcode + col * 2 ] | ( m_vram[ pcode + col * 2 + 1 ] << 8 ); + } + } + } +} + + +void k2ge_device::k1ge_draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_lut_base, UINT16 k2ge_lut_base ) +{ + int i; + int offset_x = ( scroll_x >> 3 ) * 2; + int px = scroll_x & 0x07; + UINT16 map_data; + UINT16 hflip; + UINT16 pcode; + UINT16 tile_addr; + UINT16 tile_data; + + base += ( ( ( ( scroll_y + line ) >> 3 ) * 0x0040 ) & 0x7ff ); + + /* setup */ + map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); + hflip = map_data & 0x8000; + pcode = ( map_data & 0x2000 ) ? 1 : 0; + tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); + if ( map_data & 0x4000 ) + tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; + else + tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + if ( hflip ) + tile_data >>= 2 * ( scroll_x & 0x07 ); + else + tile_data <<= 2 * ( scroll_x & 0x07 ); + + /* draw pixels */ + for ( i = 0; i < 160; i++ ) + { + UINT16 col; + + if ( hflip ) + { + col = tile_data & 0x0003; + tile_data >>= 2; + } + else + { + col = tile_data >> 14; + tile_data <<= 2; + } + + if ( col ) + { + UINT16 col2 = 16 * pcode + ( m_vram[ pal_lut_base + 4 * pcode + col ] * 2 ); + p[ i ] = m_vram[ k2ge_lut_base + col2 ] | ( m_vram[ k2ge_lut_base + col2 + 1 ] << 8 ); + } + + px++; + if ( px >= 8 ) + { + offset_x = ( offset_x + 2 ) & 0x3f; + map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); + hflip = map_data & 0x8000; + pcode = ( map_data & 0x2000 ) ? 1 : 0; + tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); + if ( map_data & 0x4000 ) + tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; + else + tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + px = 0; + } + } +} + + +void k2ge_device::k1ge_draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ) +{ + struct { + UINT16 spr_data; + UINT8 x; + UINT8 y; + } spr[64]; + int num_sprites = 0; + UINT8 spr_y = 0; + UINT8 spr_x = 0; + int i; + + priority <<= 11; + + /* Select sprites */ + for ( i = 0; i < 256; i += 4 ) + { + UINT16 spr_data = m_vram[ 0x800 + i ] | ( m_vram[ 0x801 + i ] << 8 ); + UINT8 x = m_vram[ 0x802 + i ]; + UINT8 y = m_vram[ 0x803 + i ]; + + spr_x = ( spr_data & 0x0400 ) ? ( spr_x + x ) : ( scroll_x + x ); + spr_y = ( spr_data & 0x0200 ) ? ( spr_y + y ) : ( scroll_y + y ); + + if ( ( spr_data & 0x1800 ) == priority ) + { + if ( ( line >= spr_y || spr_y > 0xf8 ) && line < ( ( spr_y + 8 ) & 0xff ) ) + { + spr[num_sprites].spr_data = spr_data; + spr[num_sprites].y = spr_y; + spr[num_sprites].x = spr_x; + num_sprites++; + } + } + } + + /* Draw sprites */ + for ( i = num_sprites-1; i >= 0; i-- ) + { + int j; + UINT16 tile_addr; + UINT16 tile_data; + UINT16 pcode = ( spr[i].spr_data & 0x2000 ) ? 1 : 0; + + tile_addr = 0x2000 + ( ( spr[i].spr_data & 0x1ff ) * 16 ); + if ( spr[i].spr_data & 0x4000 ) + tile_addr += ( 7 - ( ( line - spr[i].y ) & 0x07 ) ) * 2; + else + tile_addr += ( ( line - spr[i].y ) & 0x07 ) * 2; + tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); + + for ( j = 0; j < 8; j++ ) + { + UINT16 col; + + spr_x = spr[i].x + j; + + if ( spr[i].spr_data & 0x8000 ) + { + col = tile_data & 0x03; + tile_data >>= 2; + } + else + { + col = tile_data >> 14; + tile_data <<= 2; + } + + if ( spr_x < 160 && col ) + { + UINT16 col2 = 16 * pcode + m_vram[ 0x100 + 4 * pcode + col ] * 2; + p[ spr_x ] = m_vram[ 0x380 + col2 ] | ( m_vram[ 0x381 + col2 ] << 8 ); + } + } + } +} + + +void k2ge_device::draw( int line ) +{ + UINT16 *p = &m_bitmap->pix16(line); + UINT16 col = 0; + UINT16 oowcol; + int i; + + oowcol = ( m_vram[0x012] & 0x07 ) * 2; + oowcol = m_vram[0x3f0 + oowcol ] | ( m_vram[0x3f1 + oowcol ] << 8 ); + + if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) + { + for( i = 0; i < 160; i++ ) + { + p[i] = oowcol; + } + } + else + { + /* Determine the background color */ + if ( ( m_vram[0x118] & 0xc0 ) == 0x80 ) + { + col = ( m_vram[0x118] & 0x07 ) * 2; + } + col = m_vram[0x3e0 + col ] | ( m_vram[0x3e1 + col ] << 8 ); + + /* Set the bacground color */ + for ( i = 0; i < 160; i++ ) + { + p[i] = col; + } + + if ( m_vram[0x7e2] & 0x80 ) + { + /* K1GE compatibility mode */ + if ( m_vram[0x030] & 0x80 ) + { + /* Draw sprites with 01 priority */ + k1ge_draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF1 */ + k1ge_draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x108, 0x3a0 ); + + /* Draw sprites with 10 priority */ + k1ge_draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF2 */ + k1ge_draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x110, 0x3c0 ); + + /* Draw sprites with 11 priority */ + k1ge_draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); + } + else + { + /* Draw sprites with 01 priority */ + k1ge_draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF2 */ + k1ge_draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x110, 0x3c0 ); + + /* Draw sprites with 10 priority */ + k1ge_draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF1 */ + k1ge_draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x108, 0x3a0 ); + + /* Draw sprites with 11 priority */ + k1ge_draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); + } + } + else + { + /* K2GE mode */ + if ( m_vram[0x030] & 0x80 ) + { + /* Draw sprites with 01 priority */ + draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF1 */ + draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x280 ); + + /* Draw sprites with 10 priority */ + draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF2 */ + draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x300 ); + + /* Draw sprites with 11 priority */ + draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); + } + else + { + /* Draw sprites with 01 priority */ + draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF2 */ + draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x300 ); + + /* Draw sprites with 10 priority */ + draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); + + /* Draw PF1 */ + draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x280 ); + + /* Draw sprites with 11 priority */ + draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); + } + } + + for ( i = 0; i < m_wba_h; i++ ) + { + p[i] = oowcol; + } + + for ( i = m_wba_h + m_wsi_h; i < 160; i++ ) + { + p[i] = oowcol; + } + } +} + + +TIMER_CALLBACK_MEMBER( k1ge_device::hblank_on_timer_callback ) +{ + m_hblank_pin_w(0); +} + + +TIMER_CALLBACK_MEMBER( k1ge_device::timer_callback ) +{ + int y = m_screen->vpos(); + + /* Check for start of VBlank */ + if ( y >= 152 ) + { + m_vram[0x010] |= 0x40; + if (m_vram[0x000] & 0x80) + { + m_vblank_pin_w(1); + } + } + + /* Check for end of VBlank */ + if ( y == 0 ) + { + m_wba_h = m_vram[0x002]; + m_wba_v = m_vram[0x003]; + m_wsi_h = m_vram[0x004]; + m_wsi_v = m_vram[0x005]; + m_vram[0x010] &= ~ 0x40; + if (m_vram[0x000] & 0x80) + { + m_vblank_pin_w(0); + } + } + + /* Check if Hint should be triggered */ + if ( y == K1GE_SCREEN_HEIGHT - 1 || y < 151 ) + { + if (!m_hblank_pin_w.isnull()) + { + if (m_vram[0x000] & 0x40) + { + m_hblank_pin_w(1); + } + m_hblank_on_timer->adjust( m_screen->time_until_pos(y, 480 ) ); + } + } + + /* Draw a line when inside visible area */ + if ( y && y < 153 ) + { + draw( y - 1 ); + } + + m_timer->adjust( m_screen->time_until_pos(( y + 1 ) % K1GE_SCREEN_HEIGHT, 0 ) ); +} + + +void k1ge_device::update( bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + copybitmap( bitmap, *m_bitmap, 0, 0, 0, 0, cliprect ); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k1ge_device::device_start() +{ + m_vblank_pin_w.resolve(); + m_hblank_pin_w.resolve(); + + m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k1ge_device::timer_callback), this)); + m_hblank_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k1ge_device::hblank_on_timer_callback), this)); + m_vram = auto_alloc_array_clear(machine(), UINT8, 0x4000); + m_bitmap = auto_bitmap_ind16_alloc( machine(), m_screen->width(), m_screen->height() ); + + save_pointer(NAME(m_vram), 0x4000); + save_item(NAME(m_wba_h)); + save_item(NAME(m_wba_v)); + save_item(NAME(m_wsi_h)); + save_item(NAME(m_wsi_v)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k1ge_device::device_reset() +{ + m_vram[0x000] = 0x00; /* Interrupt enable */ + m_vram[0x002] = 0x00; /* WBA.H */ + m_vram[0x003] = 0x00; /* WVA.V */ + m_vram[0x004] = 0xFF; /* WSI.H */ + m_vram[0x005] = 0xFF; /* WSI.V */ + m_vram[0x007] = 0xc6; /* REF */ + m_vram[0x012] = 0x00; /* 2D control */ + m_vram[0x020] = 0x00; /* PO.H */ + m_vram[0x021] = 0x00; /* PO.V */ + m_vram[0x030] = 0x00; /* PF */ + m_vram[0x032] = 0x00; /* S1SO.H */ + m_vram[0x033] = 0x00; /* S1SO.V */ + m_vram[0x034] = 0x00; /* S2SO.H */ + m_vram[0x035] = 0x00; /* S2SO.V */ + m_vram[0x101] = 0x07; /* SPPLT01 */ + m_vram[0x102] = 0x07; /* SPPLT02 */ + m_vram[0x103] = 0x07; /* SPPLT03 */ + m_vram[0x105] = 0x07; /* SPPLT11 */ + m_vram[0x106] = 0x07; /* SPPLT12 */ + m_vram[0x107] = 0x07; /* SPPLT13 */ + m_vram[0x109] = 0x07; /* SC1PLT01 */ + m_vram[0x10a] = 0x07; /* SC1PLT02 */ + m_vram[0x10b] = 0x07; /* SC1PLT03 */ + m_vram[0x10d] = 0x07; /* SC1PLT11 */ + m_vram[0x10e] = 0x07; /* SC1PLT12 */ + m_vram[0x10f] = 0x07; /* SC1PLT13 */ + m_vram[0x111] = 0x07; /* SC2PLT01 */ + m_vram[0x112] = 0x07; /* SC2PLT02 */ + m_vram[0x113] = 0x07; /* SC2PLT03 */ + m_vram[0x115] = 0x07; /* SC2PLT11 */ + m_vram[0x116] = 0x07; /* SC2PLT12 */ + m_vram[0x117] = 0x07; /* SC2PLT13 */ + m_vram[0x118] = 0x07; /* BG */ + m_vram[0x400] = 0xFF; /* LED control */ + m_vram[0x402] = 0x80; /* LEDFREG */ + m_vram[0x7e0] = 0x52; /* RESET */ + m_vram[0x7e2] = 0x00; /* MODE */ + + m_timer->adjust( m_screen->time_until_pos(( m_screen->vpos() + 1 ) % K1GE_SCREEN_HEIGHT, 0 ) ); +} + + +const device_type K1GE = &device_creator; + +k1ge_device::k1ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K1GE, "K1GE Monochrome Graphics + LCD", tag, owner, clock, "k1ge", __FILE__) + , device_video_interface(mconfig, *this) + , m_vblank_pin_w(*this) + , m_hblank_pin_w(*this) +{ +} + +k1ge_device::k1ge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , device_video_interface(mconfig, *this) + , m_vblank_pin_w(*this) + , m_hblank_pin_w(*this) +{ +} + +static MACHINE_CONFIG_FRAGMENT( k1ge ) + MCFG_PALETTE_ADD("palette", 8 ) + MCFG_PALETTE_INIT_OWNER(k1ge_device, k1ge) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor k1ge_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( k1ge ); +} + + +const device_type K2GE = &device_creator; + +k2ge_device::k2ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : k1ge_device(mconfig, K2GE, "K2GE Color Graphics + LCD", tag, owner, clock, "k2ge", __FILE__) +{ +} + +static MACHINE_CONFIG_FRAGMENT( k2ge ) + MCFG_PALETTE_ADD("palette", 4096 ) + MCFG_PALETTE_INIT_OWNER(k2ge_device, k2ge) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor k2ge_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( k2ge ); +} diff --git a/src/mame/video/k1ge.h b/src/mame/video/k1ge.h new file mode 100644 index 00000000000..6ecb2e771bc --- /dev/null +++ b/src/mame/video/k1ge.h @@ -0,0 +1,92 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/****************************************************************************** + + K1GE/K2GE graphics emulation + +******************************************************************************/ + +#ifndef __K2GE_H_ +#define __K2GE_H_ + + +#define MCFG_K1GE_ADD(_tag, _clock, _screen, _vblank, _hblank ) \ + MCFG_DEVICE_ADD( _tag, K1GE, _clock ) \ + MCFG_VIDEO_SET_SCREEN( _screen ) \ + devcb = &k1ge_device::static_set_vblank_callback( *device, DEVCB_##_vblank ); \ + devcb = &k1ge_device::static_set_hblank_callback( *device, DEVCB_##_hblank ); + +#define MCFG_K2GE_ADD(_tag, _clock, _screen, _vblank, _hblank ) \ + MCFG_DEVICE_ADD( _tag, K2GE, _clock ) \ + MCFG_VIDEO_SET_SCREEN( _screen ) \ + devcb = &k1ge_device::static_set_vblank_callback( *device, DEVCB_##_vblank ); \ + devcb = &k1ge_device::static_set_hblank_callback( *device, DEVCB_##_hblank ); + + +class k1ge_device : public device_t, + public device_video_interface +{ +public: + k1ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + k1ge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_PALETTE_INIT(k1ge); + + void update( bitmap_ind16 &bitmap, const rectangle &cliprect ); + + // Static methods + template static devcb_base &static_set_vblank_callback(device_t &device, _Object object) { return downcast(device).m_vblank_pin_w.set_callback(object); } + template static devcb_base &static_set_hblank_callback(device_t &device, _Object object) { return downcast(device).m_hblank_pin_w.set_callback(object); } + + static const int K1GE_SCREEN_HEIGHT = 199; +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; + + devcb_write_line m_vblank_pin_w; + devcb_write_line m_hblank_pin_w; + UINT8 *m_vram; + UINT8 m_wba_h, m_wba_v, m_wsi_h, m_wsi_v; + + emu_timer *m_timer; + emu_timer *m_hblank_on_timer; + bitmap_ind16 *m_bitmap; + + virtual void draw(int line); + + void draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, int pal_base ); + void draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ); + TIMER_CALLBACK_MEMBER( hblank_on_timer_callback ); + TIMER_CALLBACK_MEMBER( timer_callback ); + +}; + + +class k2ge_device : public k1ge_device +{ +public: + k2ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_PALETTE_INIT(k2ge); +protected: + virtual machine_config_constructor device_mconfig_additions() const; + + virtual void draw(int line); + + void draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_base ); + void draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ); + void k1ge_draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_lut_base, UINT16 k2ge_lut_base ); + void k1ge_draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ); + +}; + +extern const device_type K1GE; +extern const device_type K2GE; + + +#endif diff --git a/src/mame/video/kaypro.c b/src/mame/video/kaypro.c new file mode 100644 index 00000000000..d9e6d10340b --- /dev/null +++ b/src/mame/video/kaypro.c @@ -0,0 +1,312 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert + +#include "includes/kaypro.h" + + + +/*********************************************************** + + Video + +************************************************************/ + +PALETTE_INIT_MEMBER(kaypro_state,kaypro) +{ + palette.set_pen_color(0, rgb_t::black); /* black */ + palette.set_pen_color(1, rgb_t(0, 220, 0)); /* green */ + palette.set_pen_color(2, rgb_t(0, 110, 0)); /* low intensity green */ +} + +UINT32 kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +/* The display consists of 80 columns and 24 rows. Each row is allocated 128 bytes of ram, + but only the first 80 are used. The total video ram therefore is 0x0c00 bytes. + There is one video attribute: bit 7 causes blinking. The first half of the + character generator is blank, with the visible characters in the 2nd half. + During the "off" period of blanking, the first half is used. Only 5 pixels are + connected from the rom to the shift register, the remaining pixels are held high. */ + + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + m_framecnt++; + + for (y = 0; y < 24; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 80; x++) + { + gfx = 0; + + if (ra < 8) + { + chr = m_p_videoram[x]^0x80; + + /* Take care of flashing characters */ + if ((chr < 0x80) && (m_framecnt & 0x08)) + chr |= 0x80; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<3) | ra ]; + } + + /* Display a scanline of a character (7 pixels) */ + *p++ = 0; + *p++ = BIT( gfx, 4 ); + *p++ = BIT( gfx, 3 ); + *p++ = BIT( gfx, 2 ); + *p++ = BIT( gfx, 1 ); + *p++ = BIT( gfx, 0 ); + *p++ = 0; + } + } + ma+=128; + } + return 0; +} + +UINT32 kaypro_state::screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + m_framecnt++; + + for (y = 0; y < 24; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 80; x++) + { + gfx = 0; + + if (ra < 8) + { + chr = m_p_videoram[x]; + + /* Take care of flashing characters */ + if ((chr > 0x7f) && (m_framecnt & 0x08)) + chr |= 0x80; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<3) | ra ]; + } + + /* Display a scanline of a character (7 pixels) */ + *p++ = BIT( gfx, 6 ); + *p++ = BIT( gfx, 5 ); + *p++ = BIT( gfx, 4 ); + *p++ = BIT( gfx, 3 ); + *p++ = BIT( gfx, 2 ); + *p++ = BIT( gfx, 1 ); + *p++ = BIT( gfx, 0 ); + } + } + ma+=128; + } + return 0; +} + +UINT32 kaypro_state::screen_update_kaypro2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_framecnt++; + m_crtc->screen_update(screen, bitmap, cliprect); + return 0; +} + +/* bit 6 of kaypro2x_system_port selects alternate characters (A12 on character generator rom). + The diagram specifies a 2732 with 28 pins, and more address pins. Possibly a 2764 or 27128. + Since our dump only goes up to A11, the alternate character set doesn't exist. + + 0000-07FF of videoram is memory-mapped characters; 0800-0FFF is equivalent attribute bytes. + d3 Underline + d2 blinking (at unknown rate) + d1 low intensity + d0 reverse video + + Not sure how the attributes interact, for example does an underline blink? */ + + +MC6845_UPDATE_ROW( kaypro_state::kaypro2x_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + UINT16 x; + UINT8 gfx,fg,bg; + + for (x = 0; x < x_count; x++) // for each character + { + UINT8 inv=0; + // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ + UINT16 mem = (ma + x) & 0x7ff; + UINT8 chr = m_p_videoram[mem]; + UINT8 attr = m_p_videoram[mem | 0x800]; + + if ((attr & 3) == 3) + { + fg = 0; + bg = 2; + } + else + if ((attr & 3) == 2) + { + fg = 2; + bg = 0; + } + else + if ((attr & 3) == 1) + { + fg = 0; + bg = 1; + } + else + { + fg = 1; + bg = 0; + } + + /* Take care of flashing characters */ + if ( (BIT(attr, 2)) & (BIT(m_framecnt, 3)) ) + fg = bg; + + /* process cursor */ + if (x == cursor_x) + inv ^= m_mc6845_cursor[ra]; + + /* get pattern of pixels for that character scanline */ + if ( (ra == 15) & (BIT(attr, 3)) ) /* underline */ + gfx = 0xff; + else + gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; + + /* Display a scanline of a character (8 pixels) */ + *p++ = palette[BIT( gfx, 7 ) ? fg : bg]; + *p++ = palette[BIT( gfx, 6 ) ? fg : bg]; + *p++ = palette[BIT( gfx, 5 ) ? fg : bg]; + *p++ = palette[BIT( gfx, 4 ) ? fg : bg]; + *p++ = palette[BIT( gfx, 3 ) ? fg : bg]; + *p++ = palette[BIT( gfx, 2 ) ? fg : bg]; + *p++ = palette[BIT( gfx, 1 ) ? fg : bg]; + *p++ = palette[BIT( gfx, 0 ) ? fg : bg]; + } +} + +/************************************* MC6845 SUPPORT ROUTINES ***************************************/ + +/* The 6845 can produce a variety of cursor shapes - all are emulated here - remove when mame fixed */ +void kaypro_state::mc6845_cursor_configure() +{ + UINT8 i,curs_type=0,r9,r10,r11; + + /* curs_type holds the general cursor shape to be created + 0 = no cursor + 1 = partial cursor (only shows on a block of scan lines) + 2 = full cursor + 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ + + for ( i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) m_mc6845_cursor[i] = 0; // prepare cursor by erasing old one + + r9 = m_mc6845_reg[9]; // number of scan lines - 1 + r10 = m_mc6845_reg[10] & 0x1f; // cursor start line = last 5 bits + r11 = m_mc6845_reg[11]+1; // cursor end line incremented to suit for-loops below + + /* decide the curs_type by examining the registers */ + if (r10 < r11) curs_type=1; // start less than end, show start to end + else + if (r10 == r11) curs_type=2; // if equal, show full cursor + else curs_type=3; // if start greater than end, it's a two-part cursor + + if ((r11 - 1) > r9) curs_type=2; // if end greater than scan-lines, show full cursor + if (r10 > r9) curs_type=0; // if start greater than scan-lines, then no cursor + if (r11 > 16) r11=16; // truncate 5-bit register to fit our 4-bit hardware + + /* create the new cursor */ + if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(m_mc6845_cursor);i++) m_mc6845_cursor[i]=0xff; // turn on full cursor + + if (curs_type == 1) for (i = r10;i < r11;i++) m_mc6845_cursor[i]=0xff; // for each line that should show, turn on that scan line + + if (curs_type == 3) for (i = r11; i < r10;i++) m_mc6845_cursor[i]=0; // now take a bite out of the middle +} + +/* Resize the screen within the limits of the hardware. Expand the image to fill the screen area. + Standard screen is 640 x 400 = 0x7d0 bytes. */ + +void kaypro_state::mc6845_screen_configure() +{ + UINT16 width = m_mc6845_reg[1]*8-1; // width in pixels + UINT16 height = m_mc6845_reg[6]*(m_mc6845_reg[9]+1)-1; // height in pixels + UINT16 bytes = m_mc6845_reg[1]*m_mc6845_reg[6]-1; // video ram needed -1 + + /* Resize the screen */ + if ((width < 640) && (height < 400) && (bytes < 0x800)) /* bounds checking to prevent an assert or violation */ + machine().first_screen()->set_visible_area(0, width, 0, height); +} + + +/**************************** I/O PORTS *****************************************************************/ + +READ8_MEMBER( kaypro_state::kaypro2x_status_r ) +{ +/* Need bit 7 high or computer hangs */ + + return 0x80 | m_crtc->register_r(space, 0); +} + +WRITE8_MEMBER( kaypro_state::kaypro2x_index_w ) +{ + m_mc6845_ind = data & 0x1f; + m_crtc->address_w( space, 0, data ); +} + +WRITE8_MEMBER( kaypro_state::kaypro2x_register_w ) +{ + static const UINT8 mcmask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0}; + + if (m_mc6845_ind < 16) + m_mc6845_reg[m_mc6845_ind] = data & mcmask[m_mc6845_ind]; /* save data in register */ + else + m_mc6845_reg[m_mc6845_ind] = data; + + m_crtc->register_w( space, 0, data ); + + if ((m_mc6845_ind == 1) || (m_mc6845_ind == 6) || (m_mc6845_ind == 9)) + mc6845_screen_configure(); /* adjust screen size */ + + if ((m_mc6845_ind > 8) && (m_mc6845_ind < 12)) + mc6845_cursor_configure(); /* adjust cursor shape - remove when mame fixed */ + + if ((m_mc6845_ind > 17) && (m_mc6845_ind < 20)) + m_mc6845_video_address = m_mc6845_reg[19] | ((m_mc6845_reg[18] & 0x3f) << 8); /* internal ULA address */ +} + +READ8_MEMBER( kaypro_state::kaypro_videoram_r ) +{ + return m_p_videoram[offset]; +} + +WRITE8_MEMBER( kaypro_state::kaypro_videoram_w ) +{ + m_p_videoram[offset] = data; +} + +READ8_MEMBER( kaypro_state::kaypro2x_videoram_r ) +{ + return m_p_videoram[m_mc6845_video_address]; +} + +WRITE8_MEMBER( kaypro_state::kaypro2x_videoram_w ) +{ + m_p_videoram[m_mc6845_video_address] = data; +} + +VIDEO_START_MEMBER(kaypro_state,kaypro) +{ + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("roms")->base()+0x3000; +} diff --git a/src/mame/video/kc.c b/src/mame/video/kc.c new file mode 100644 index 00000000000..9a9dcbce29b --- /dev/null +++ b/src/mame/video/kc.c @@ -0,0 +1,240 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/*************************************************************************** + + kc.c + + Functions to emulate the video hardware of the kc85/4,kc85/3 + +***************************************************************************/ + +#include "emu.h" +#include "includes/kc.h" + +// 3 bit colour value. bit 2->green, bit 1->red, bit 0->blue +static const UINT8 kc85_palette[KC85_PALETTE_SIZE * 3] = +{ + // foreground colours, "full" of each component + 0x00, 0x00, 0x00, // black + 0x00, 0x00, 0xd0, // blue + 0xd0, 0x00, 0x00, // red + 0xd0, 0x00, 0xd0, // magenta + 0x00, 0xd0, 0x00, // green + 0x00, 0xd0, 0xd0, // cyan + 0xd0, 0xd0, 0x00, // yellow + 0xd0, 0xd0, 0xd0, // white + + // full of each component + half of another component + 0x00, 0x00, 0x00, // black + 0x60, 0x00, 0xa0, // violet + 0xa0, 0x60, 0x00, // brown + 0xa0, 0x00, 0x60, // red/purple + 0x00, 0xa0, 0x60, // pastel green + 0x00, 0x60, 0xa0, // sky blue + 0xa0, 0xa0, 0x60, // yellow/green + 0xd0, 0xd0, 0xd0, // white + + // background colours are slightly darker than foreground colours + 0x00, 0x00, 0x00, // black + 0x00, 0x00, 0xa0, // dark blue + 0xa0, 0x00, 0x00, // dark red + 0xa0, 0x00, 0xa0, // dark magenta + 0x00, 0xa0, 0x00, // dark green + 0x00, 0xa0, 0xa0, // dark cyan + 0xa0, 0xa0, 0x00, // dark yellow + 0xa0, 0xa0, 0xa0 // dark white (grey) +}; + + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(kc_state,kc85) +{ + for (int i = 0; i < sizeof(kc85_palette) / 3; i++ ) + palette.set_pen_color(i, kc85_palette[i*3], kc85_palette[i*3+1], kc85_palette[i*3+2]); +} + +/* set new blink state */ +WRITE_LINE_MEMBER( kc_state::video_toggle_blink_state ) +{ + if (state) + { + machine().first_screen()->update_partial(machine().first_screen()->vpos()); + + m_kc85_blink_state = !m_kc85_blink_state; + } +} + + +/* draw 8 pixels */ +void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, UINT8 colour_byte, UINT8 gfx_byte) +{ + int pens[4]; + int px; + + if (m_high_resolution) + { + /* High resolution: 4 colors for block */ + + pens[0] = 0; // black + pens[1] = 2; // red + pens[2] = 5; // cyan + pens[3] = 7; // white + + px = x; + + for (int a=0; a<8; a++) + { + int pen = pens[((gfx_byte>>7) & 0x07) | ((colour_byte>>6) & 0x02)]; + + if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) + { + bitmap.pix16(y, px) = pen; + } + + px++; + colour_byte <<= 1; + gfx_byte <<= 1; + } + } + else + { + /* Low resolution: 2 colors for block */ + /* 16 foreground colours, 8 background colours */ + + /* bit 7 = 1: flash between foreground and background colour 0: no flash */ + /* bit 6: adjusts foreground colours by adding half of another component */ + /* bit 5,4,3 = foreground colour */ + /* bit 5: background colour -> Green */ + /* bit 4: background colour -> Red */ + /* bit 3: background colour -> Blue */ + /* bit 2,1,0 = background colour */ + /* bit 2: background colour -> Green */ + /* bit 1: background colour -> Red */ + /* bit 0: background colour -> Blue */ + + int background_pen = (colour_byte&7) + 16; + int foreground_pen = ((colour_byte>>3) & 0x0f); + + if ((colour_byte & 0x80) && m_kc85_blink_state && (m_pio_data[1] & 0x80)) + { + foreground_pen = background_pen; + } + + pens[0] = background_pen; + pens[1] = foreground_pen; + + px = x; + + for (int a=0; a<8; a++) + { + int pen = pens[(gfx_byte>>7) & 0x01]; + + if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) + { + bitmap.pix16(y, px) = pen; + } + px++; + gfx_byte = gfx_byte<<1; + } + } +} + + +/*************************************************************************** + KC85/4 video hardware +***************************************************************************/ + +void kc85_4_state::video_start() +{ + m_video_ram = machine().memory().region_alloc("videoram", (KC85_4_SCREEN_COLOUR_RAM_SIZE*2) + (KC85_4_SCREEN_PIXEL_RAM_SIZE*2), 1, ENDIANNESS_LITTLE)->base(); + memset(m_video_ram, 0, (KC85_4_SCREEN_COLOUR_RAM_SIZE*2) + (KC85_4_SCREEN_PIXEL_RAM_SIZE*2)); + m_display_video_ram = m_video_ram; + + m_kc85_blink_state = 0; +} + +void kc85_4_state::video_control_w(int data) +{ + /* calculate address of video ram to display */ + if (data & 1) + m_display_video_ram = m_video_ram + (KC85_4_SCREEN_PIXEL_RAM_SIZE + KC85_4_SCREEN_COLOUR_RAM_SIZE); + else + m_display_video_ram = m_video_ram; + + m_high_resolution = (data & 0x08) ? 0 : 1; +} + + +UINT32 kc85_4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *pixel_ram = m_display_video_ram; + UINT8 *colour_ram = pixel_ram + 0x04000; + + for (int y=cliprect.min_y; y<=cliprect.max_y; y++) + { + for (int x=0; x<(KC85_SCREEN_WIDTH>>3); x++) + { + UINT16 offset = y | (x<<8); + + UINT8 colour_byte = colour_ram[offset]; + UINT8 gfx_byte = pixel_ram[offset]; + + video_draw_8_pixels(bitmap, (x<<3), y, colour_byte, gfx_byte); + } + } + + return 0; +} + +/*************************************************************************** + KC85/3 video +***************************************************************************/ + +void kc_state::video_start() +{ + m_video_ram = machine().memory().region_alloc("videoram", 0x4000, 1, ENDIANNESS_LITTLE)->base(); + memset(m_video_ram, 0, 0x4000); + + m_kc85_blink_state = 0; +} + +UINT32 kc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + /* colour ram takes up 0x02800 bytes */ + UINT8 *pixel_ram = m_video_ram; + UINT8 *colour_ram = m_video_ram + 0x02800; + + for (int y=cliprect.min_y; y<=cliprect.max_y; y++) + { + for (int x=0; x<(KC85_SCREEN_WIDTH>>3); x++) + { + int pixel_offset,colour_offset; + + if ((x & 0x020)==0) + { + pixel_offset = (x & 0x01f) | (((y>>2) & 0x03)<<5) | + ((y & 0x03)<<7) | (((y>>4) & 0x0f)<<9); + + colour_offset = (x & 0x01f) | (((y>>2) & 0x03f)<<5); + } + else + { + /* 1 0 1 0 0 V7 V6 V1 V0 V3 V2 V5 V4 H2 H1 H0 */ + /* 1 0 1 1 0 0 0 V7 V6 V3 V2 V5 V4 H2 H1 H0 */ + + pixel_offset = 0x02000+((x & 0x07) | (((y>>4) & 0x03)<<3) | + (((y>>2) & 0x03)<<5) | ((y & 0x03)<<7) | ((y>>6) & 0x03)<<9); + + colour_offset = 0x0800+((x & 0x07) | (((y>>4) & 0x03)<<3) | + (((y>>2) & 0x03)<<5) | ((y>>6) & 0x03)<<7); + } + + UINT8 colour_byte = colour_ram[colour_offset]; + UINT8 gfx_byte = pixel_ram[pixel_offset]; + + video_draw_8_pixels(bitmap,(x<<3),y, colour_byte, gfx_byte); + } + } + + return 0; +} diff --git a/src/mame/video/kramermc.c b/src/mame/video/kramermc.c new file mode 100644 index 00000000000..a5609e8259f --- /dev/null +++ b/src/mame/video/kramermc.c @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Kramer MC video driver by Miodrag Milanovic + + 13/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/kramermc.h" + +#define KRAMERMC_VIDEO_MEMORY 0xFC00 + +const gfx_layout kramermc_charlayout = +{ + 8, 8, /* 8x8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {0, 1, 2, 3, 4, 5, 6, 7}, + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, + 8*8 /* size of one char */ +}; + +void kramermc_state::video_start() +{ +} + +UINT32 kramermc_state::screen_update_kramermc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + address_space &space = m_maincpu->space(AS_PROGRAM); + + for(y = 0; y < 16; y++ ) + { + for(x = 0; x < 64; x++ ) + { + int code = space.read_byte(KRAMERMC_VIDEO_MEMORY + x + y*64); + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*8); + } + } + return 0; +} diff --git a/src/mame/video/kyocera.c b/src/mame/video/kyocera.c new file mode 100644 index 00000000000..34c3d60f95d --- /dev/null +++ b/src/mame/video/kyocera.c @@ -0,0 +1,89 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "includes/kyocera.h" + +PALETTE_INIT_MEMBER(kc85_state,kc85) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +PALETTE_INIT_MEMBER(tandy200_state,tandy200) +{ + palette.set_pen_color(0, rgb_t(138, 146, 148)); + palette.set_pen_color(1, rgb_t(92, 83, 88)); +} + +UINT32 kc85_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_lcdc0->screen_update(screen, bitmap, cliprect); + m_lcdc1->screen_update(screen, bitmap, cliprect); + m_lcdc2->screen_update(screen, bitmap, cliprect); + m_lcdc3->screen_update(screen, bitmap, cliprect); + m_lcdc4->screen_update(screen, bitmap, cliprect); + m_lcdc5->screen_update(screen, bitmap, cliprect); + m_lcdc6->screen_update(screen, bitmap, cliprect); + m_lcdc7->screen_update(screen, bitmap, cliprect); + m_lcdc8->screen_update(screen, bitmap, cliprect); + m_lcdc9->screen_update(screen, bitmap, cliprect); + + return 0; +} + +UINT32 tandy200_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_lcdc->screen_update(screen, bitmap, cliprect); + + return 0; +} + +static ADDRESS_MAP_START( tandy200_lcdc, AS_0, 8, tandy200_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + AM_RANGE(0x0000, 0x1fff) AM_RAM +ADDRESS_MAP_END + +MACHINE_CONFIG_FRAGMENT( kc85_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(44) + MCFG_SCREEN_UPDATE_DRIVER(kc85_state, screen_update) + MCFG_SCREEN_SIZE(240, 64) + MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(kc85_state,kc85) + + MCFG_HD44102_ADD(HD44102_0_TAG, SCREEN_TAG, 0, 0) + MCFG_HD44102_ADD(HD44102_1_TAG, SCREEN_TAG, 50, 0) + MCFG_HD44102_ADD(HD44102_2_TAG, SCREEN_TAG, 100, 0) + MCFG_HD44102_ADD(HD44102_3_TAG, SCREEN_TAG, 150, 0) + MCFG_HD44102_ADD(HD44102_4_TAG, SCREEN_TAG, 200, 0) + MCFG_HD44102_ADD(HD44102_5_TAG, SCREEN_TAG, 0, 32) + MCFG_HD44102_ADD(HD44102_6_TAG, SCREEN_TAG, 50, 32) + MCFG_HD44102_ADD(HD44102_7_TAG, SCREEN_TAG, 100, 32) + MCFG_HD44102_ADD(HD44102_8_TAG, SCREEN_TAG, 150, 32) + MCFG_HD44102_ADD(HD44102_9_TAG, SCREEN_TAG, 200, 32) + +// MCFG_HD44103_MASTER_ADD("m11", SCREEN_TAG, CAP_P(18), RES_K(100), HD44103_FS_HIGH, HD44103_DUTY_1_32) +// MCFG_HD44103_SLAVE_ADD( "m12", "m11", SCREEN_TAG, HD44103_FS_HIGH, HD44103_DUTY_1_32) +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( tandy200_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(80) + MCFG_SCREEN_UPDATE_DRIVER(tandy200_state, screen_update) + MCFG_SCREEN_SIZE(240, 128) + MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 128-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_DEFAULT_LAYOUT(layout_lcd) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(tandy200_state,tandy200) + + MCFG_DEVICE_ADD(HD61830_TAG, HD61830, XTAL_4_9152MHz/2/2) + MCFG_DEVICE_ADDRESS_MAP(AS_0, tandy200_lcdc) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) +MACHINE_CONFIG_END diff --git a/src/mame/video/llc.c b/src/mame/video/llc.c new file mode 100644 index 00000000000..dd9ba725500 --- /dev/null +++ b/src/mame/video/llc.c @@ -0,0 +1,96 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic, Robbbert +/*************************************************************************** + + LLC driver by Miodrag Milanovic + + 17/04/2009 Preliminary driver. + +****************************************************************************/ + + +#include "includes/llc.h" + + +void llc_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 llc_state::screen_update_llc1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,inv; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x++) + { + inv = (m_p_videoram[x] & 0x80) ? 0xff : 0; + chr = m_p_videoram[x] & 0x7f; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[ chr | (ra << 7) ] ^ inv; + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} + +UINT32 llc_state::screen_update_llc2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,inv, inv1=m_rv ? 0xff : 0; + UINT16 sy=0,ma=0,x; + + for (y = 0; y < 32; y++) + { + for (ra = 0; ra < 8; ra++) + { + inv = 0; + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x++) + { + chr = m_p_videoram[x]; + if (chr==0x11) // inverse on + { + inv=0xff; + chr=0x0f; // must not show + } + else + if (chr==0x10) // inverse off + inv=0; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[ (chr << 3) | ra ] ^ inv ^ inv1; + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} diff --git a/src/mame/video/lviv.c b/src/mame/video/lviv.c new file mode 100644 index 00000000000..affc58516f0 --- /dev/null +++ b/src/mame/video/lviv.c @@ -0,0 +1,91 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/*************************************************************************** + + lviv.c + + Functions to emulate the video hardware of PK-01 Lviv. + + Krzysztof Strzecha + +***************************************************************************/ + +#include "emu.h" +#include "includes/lviv.h" + +const unsigned char lviv_palette[8*3] = +{ + 0x00, 0x00, 0x00, + 0x00, 0x00, 0xa4, + 0x00, 0xa4, 0x00, + 0x00, 0xa4, 0xa4, + 0xa4, 0x00, 0x00, + 0xa4, 0x00, 0xa4, + 0xa4, 0xa4, 0x00, + 0xa4, 0xa4, 0xa4 +}; + + +PALETTE_INIT_MEMBER(lviv_state, lviv) +{ + int i; + + for ( i = 0; i < sizeof(lviv_palette) / 3; i++ ) { + m_palette->set_pen_color(i, lviv_palette[i*3], lviv_palette[i*3+1], lviv_palette[i*3+2]); + } +} + + +void lviv_state::lviv_update_palette(UINT8 pal) +{ + m_colortable[0][0] = 0; + m_colortable[0][1] = 0; + m_colortable[0][2] = 0; + m_colortable[0][3] = 0; + + m_colortable[0][0] |= (((pal>>3)&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; + m_colortable[0][0] |= ((pal>>5)&0x01) ? 0x02 : 0x00; + m_colortable[0][0] |= (((pal>>2)&0x01) == ((pal>>6)&0x01)) ? 0x01 : 0x00; + + m_colortable[0][1] |= ((pal&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; + m_colortable[0][1] |= ((pal>>5)&0x01) ? 0x02 : 0x00; + m_colortable[0][1] |= ((pal>>6)&0x01) ? 0x00 : 0x01; + + m_colortable[0][2] |= ((pal>>4)&0x01) ? 0x04 : 0x00; + m_colortable[0][2] |= ((pal>>5)&0x01) ? 0x00 : 0x02; + m_colortable[0][2] |= ((pal>>6)&0x01) ? 0x01 : 0x00; + + m_colortable[0][3] |= ((pal>>4)&0x01) ? 0x00 : 0x04; + m_colortable[0][3] |= (((pal>>1)&0x01) == ((pal>>5)&0x01)) ? 0x02 : 0x00; + m_colortable[0][3] |= ((pal>>6)&0x01) ? 0x01 : 0x00; +} + +void lviv_state::video_start() +{ +} + +UINT32 lviv_state::screen_update_lviv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + int pen; + UINT8 data; + + for (y=0; y<256; y++) + for (x=0; x<256; x+=4) + { + data = m_video_ram[y*64+x/4]; + + pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; + bitmap.pix16(y, x + 0) = pen; + + pen = m_colortable[0][((data & 0x04) >> 2) | ((data & 0x40) >> (2+3))]; + bitmap.pix16(y, x + 1) = pen; + + pen = m_colortable[0][((data & 0x02) >> 1) | ((data & 0x20) >> (1+3))]; + bitmap.pix16(y, x + 2) = pen; + + pen = m_colortable[0][((data & 0x01) >> 0) | ((data & 0x10) >> (0+3))]; + bitmap.pix16(y, x + 3) = pen; + } + return 0; +} diff --git a/src/mame/video/mac.c b/src/mame/video/mac.c new file mode 100644 index 00000000000..289c62feb57 --- /dev/null +++ b/src/mame/video/mac.c @@ -0,0 +1,1257 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont +/*************************************************************************** + + video/mac.c + + Macintosh video hardware + + Emulates the video hardware for compact Macintosh series (original + Macintosh (128k, 512k, 512ke), Macintosh Plus, Macintosh SE, Macintosh + Classic) + + Also emulates on-board video for systems with the + RBV, V8, Eagle, Sonora, and DAFB chips. + + ---------------------------------------------------------------------- + Monitor sense codes + + Apple assigns 3 pins for monitor IDs. These allow 8 possible codes: + + 000 - color 2-Page Display (21") + 001 - monochrome Full Page display (15") + 010 - color 512x384 (12") + 011 - monochrome 2 Page display (21") + 100 - NTSC + 101 - color Full Page display (15") + 110 - High-Resolution Color (13" 640x480) or use "type 6" extended codes + 111 - No monitor connected or use "type 7" extended codes + + For extended codes, you drive one of the 3 pins at a time and read the 2 + undriven pins. See http://support.apple.com/kb/TA21618?viewlocale=en_US + for details. + +Extended codes: + + Sense 2 Low Sense 1 Low Sense 0 Low + 1 & 0 2 & 0 2 & 1 + +Multiple Scan 14" 00 00 11 +Multiple Scan 16" 00 10 11 +Multiple Scan 21" 10 00 11 +PAL Encoder 00 00 00 +NTSC Encoder 01 01 00 +VGA/Super VGA 01 01 11 +RGB 16" 10 11 01 +PAL Monitor 11 00 00 +RGB 19" 11 10 10 +Radius color TPD 11 00 01 (TPD = Two Page Display) +Radius mono TPD 11 01 00 +Apple TPD 11 01 01 +Apple color FPD 01 11 10 (FPD = Full Page Display) + +***************************************************************************/ + + +#include "emu.h" +#include "sound/asc.h" +#include "includes/mac.h" +#include "machine/ram.h" + +PALETTE_INIT_MEMBER(mac_state,mac) +{ + palette.set_pen_color(0, 0xff, 0xff, 0xff); + palette.set_pen_color(1, 0x00, 0x00, 0x00); +} + +// 4-level grayscale +PALETTE_INIT_MEMBER(mac_state,macgsc) +{ + palette.set_pen_color(0, 0xff, 0xff, 0xff); + palette.set_pen_color(1, 0x7f, 0x7f, 0x7f); + palette.set_pen_color(2, 0x3f, 0x3f, 0x3f); + palette.set_pen_color(3, 0x00, 0x00, 0x00); +} + +VIDEO_START_MEMBER(mac_state,mac) +{ +} + +#define MAC_MAIN_SCREEN_BUF_OFFSET 0x5900 +#define MAC_ALT_SCREEN_BUF_OFFSET 0xD900 + +UINT32 mac_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT32 video_base; + const UINT16 *video_ram; + UINT16 word; + UINT16 *line; + int y, x, b; + + video_base = m_ram->size() - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); + video_ram = (const UINT16 *) (m_ram->pointer() + video_base); + + for (y = 0; y < MAC_V_VIS; y++) + { + line = &bitmap.pix16(y); + + for (x = 0; x < MAC_H_VIS; x += 16) + { + word = *(video_ram++); + for (b = 0; b < 16; b++) + { + line[x + b] = (word >> (15 - b)) & 0x0001; + } + } + } + return 0; +} + +UINT32 mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT32 video_base; + const UINT16 *video_ram; + UINT16 word; + UINT16 *line; + int y, x, b; + + video_base = m_screen_buffer ? 0x8000 : 0; + video_base += (MAC_H_VIS/8); + video_ram = (const UINT16 *) &m_vram[video_base/4]; + + for (y = 0; y < MAC_V_VIS; y++) + { + line = &bitmap.pix16(y); + + for (x = 0; x < MAC_H_VIS; x += 16) + { + word = video_ram[((y * MAC_H_VIS)/16) + ((x/16)^1)]; + for (b = 0; b < 16; b++) + { + line[x + b] = (word >> (15 - b)) & 0x0001; + } + } + } + return 0; +} + +UINT32 mac_state::screen_update_macprtb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + const UINT16 *video_ram; + UINT16 word; + UINT16 *line; + int y, x, b; + + video_ram = (const UINT16 *) m_vram16.target(); + + for (y = 0; y < 400; y++) + { + line = &bitmap.pix16(y); + + for (x = 0; x < 640; x += 16) + { + word = video_ram[((y * 640)/16) + ((x/16))]; + for (b = 0; b < 16; b++) + { + line[x + b] = (word >> (15 - b)) & 0x0001; + } + } + } + return 0; +} + +UINT32 mac_state::screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + const UINT16 *video_ram; + UINT16 word; + UINT16 *line; + int y, x, b; + + video_ram = (const UINT16 *) m_vram.target(); + + for (y = 0; y < 400; y++) + { + line = &bitmap.pix16(y); + + for (x = 0; x < 640; x += 16) + { + word = video_ram[((y * 640)/16) + ((x/16)^1)]; + for (b = 0; b < 16; b++) + { + line[x + b] = (word >> (15 - b)) & 0x0001; + } + } + } + return 0; +} + +UINT32 mac_state::screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 *line; + int y, x; + UINT8 pixels; + UINT8 *vram8 = (UINT8 *)m_vram.target(); + + for (y = 0; y < 400; y++) + { + line = &bitmap.pix16(y); + + for (x = 0; x < 640/4; x++) + { + pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; + + *line++ = ((pixels>>6)&3); + *line++ = ((pixels>>4)&3); + *line++ = ((pixels>>2)&3); + *line++ = (pixels&3); + + } + } + return 0; +} + +// IIci/IIsi RAM-Based Video (RBV) and children: V8, Eagle, Spice, VASP, Sonora + +VIDEO_START_MEMBER(mac_state,macrbv) +{ +} + +VIDEO_RESET_MEMBER(mac_state,maceagle) +{ + m_rbv_montype = 32; + m_rbv_palette[0xfe] = 0xffffff; + m_rbv_palette[0xff] = 0; +} + +VIDEO_RESET_MEMBER(mac_state,macrbv) +{ + rectangle visarea; + int htotal, vtotal; + double framerate; + int view; + + memset(m_rbv_regs, 0, sizeof(m_rbv_regs)); + + m_rbv_count = 0; + m_rbv_clutoffs = 0; + m_rbv_immed10wr = 0; + + m_rbv_regs[2] = 0x7f; + m_rbv_regs[3] = 0; + + m_rbv_type = RBV_TYPE_RBV; + + visarea.min_x = 0; + visarea.min_y = 0; + view = 0; + if (m_montype) + { + m_rbv_montype = m_montype->read(); + } + else + { + m_rbv_montype = 2; + } + switch (m_rbv_montype) + { + case 1: // 15" portrait display + visarea.max_x = 640-1; + visarea.max_y = 870-1; + htotal = 832; + vtotal = 918; + framerate = 75.0; + view = 1; + break; + + case 2: // 12" RGB + visarea.max_x = 512-1; + visarea.max_y = 384-1; + htotal = 640; + vtotal = 407; + framerate = 60.15; + break; + + case 6: // 13" RGB + default: + visarea.max_x = 640-1; + visarea.max_y = 480-1; + htotal = 800; + vtotal = 525; + framerate = 59.94; + break; + } + +// printf("RBV reset: monitor is %dx%d @ %f Hz\n", visarea.max_x+1, visarea.max_y+1, framerate); + machine().first_screen()->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS(framerate)); + render_target *target = machine().render().first_target(); + target->set_view(view); +} + +VIDEO_RESET_MEMBER(mac_state,macsonora) +{ + rectangle visarea; + int htotal, vtotal; + double framerate; + int view = 0; + + memset(m_rbv_regs, 0, sizeof(m_rbv_regs)); + + m_rbv_count = 0; + m_rbv_clutoffs = 0; + m_rbv_immed10wr = 0; + + m_rbv_regs[2] = 0x7f; + m_rbv_regs[3] = 0; + + m_rbv_type = RBV_TYPE_SONORA; + + visarea.min_x = 0; + visarea.min_y = 0; + + m_rbv_montype = m_montype ? m_montype->read() : 2; + switch (m_rbv_montype) + { + case 1: // 15" portrait display + visarea.max_x = 640-1; + visarea.max_y = 870-1; + htotal = 832; + vtotal = 918; + framerate = 75.0; + view = 1; + break; + + case 2: // 12" RGB + visarea.max_x = 512-1; + visarea.max_y = 384-1; + htotal = 640; + vtotal = 407; + framerate = 60.15; + break; + + case 6: // 13" RGB + default: + visarea.max_x = 640-1; + visarea.max_y = 480-1; + htotal = 800; + vtotal = 525; + framerate = 59.94; + break; + } + +// printf("Sonora reset: monitor is %dx%d @ %f Hz\n", visarea.max_x+1, visarea.max_y+1, framerate); + machine().first_screen()->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS(framerate)); + render_target *target = machine().render().first_target(); + target->set_view(view); +} + +VIDEO_START_MEMBER(mac_state,macsonora) +{ + memset(m_rbv_regs, 0, sizeof(m_rbv_regs)); + + m_rbv_count = 0; + m_rbv_clutoffs = 0; + m_rbv_immed10wr = 0; + + m_rbv_regs[2] = 0x7f; + m_rbv_regs[3] = 0; + m_rbv_regs[4] = 0x6; + m_rbv_regs[5] = 0x3; + + m_sonora_vctl[0] = 0x9f; + m_sonora_vctl[1] = 0; + m_sonora_vctl[2] = 0; + + m_rbv_type = RBV_TYPE_SONORA; +} + +VIDEO_START_MEMBER(mac_state,macv8) +{ + memset(m_rbv_regs, 0, sizeof(m_rbv_regs)); + + m_rbv_count = 0; + m_rbv_clutoffs = 0; + m_rbv_immed10wr = 0; + + m_rbv_regs[0] = 0x4f; + m_rbv_regs[1] = 0x06; + m_rbv_regs[2] = 0x7f; + + m_rbv_type = RBV_TYPE_V8; +} + +UINT32 mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y, hres, vres; + UINT8 *vram8 = (UINT8 *)m_ram->pointer(); + + switch (m_rbv_montype) + { + case 32: // classic II built-in display + hres = MAC_H_VIS; + vres = MAC_V_VIS; + vram8 += 0x1f9a80; // Classic II apparently doesn't use VRAM? + break; + + case 1: // 15" portrait display + hres = 640; + vres = 870; + break; + + case 2: // 12" RGB + hres = 512; + vres = 384; + break; + + case 6: // 13" RGB + default: + hres = 640; + vres = 480; + break; + } + + switch (m_rbv_regs[0x10] & 7) + { + case 0: // 1bpp + { + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < hres; x+=8) + { + pixels = vram8[(y * (hres/8)) + ((x/8)^3)]; + + *scanline++ = m_rbv_palette[0xfe|(pixels>>7)]; + *scanline++ = m_rbv_palette[0xfe|((pixels>>6)&1)]; + *scanline++ = m_rbv_palette[0xfe|((pixels>>5)&1)]; + *scanline++ = m_rbv_palette[0xfe|((pixels>>4)&1)]; + *scanline++ = m_rbv_palette[0xfe|((pixels>>3)&1)]; + *scanline++ = m_rbv_palette[0xfe|((pixels>>2)&1)]; + *scanline++ = m_rbv_palette[0xfe|((pixels>>1)&1)]; + *scanline++ = m_rbv_palette[0xfe|(pixels&1)]; + } + } + } + break; + + case 1: // 2bpp + { + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < hres/4; x++) + { + pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; + *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; + *scanline++ = m_rbv_palette[0xfc|((pixels>>2)&3)]; + *scanline++ = m_rbv_palette[0xfc|(pixels&3)]; + } + } + } + break; + + case 2: // 4bpp + { + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres/2; x++) + { + pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; + *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; + } + } + } + break; + + case 3: // 8bpp + { + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres; x++) + { + pixels = vram8[(y * hres) + (BYTE4_XOR_BE(x))]; + *scanline++ = m_rbv_palette[pixels]; + } + } + } + } + + return 0; +} + +UINT32 mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y, hres, vres; + + switch (m_rbv_montype) + { + case 1: // 15" portrait display + hres = 640; + vres = 870; + break; + + case 2: // 12" RGB + hres = 512; + vres = 384; + break; + + case 6: // 13" RGB + default: + hres = 640; + vres = 480; + break; + } + + switch (m_rbv_regs[0x10] & 7) + { + case 0: // 1bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < hres; x+=8) + { + pixels = vram8[(y * 0x400) + ((x/8)^3)]; + + *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<2)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<3)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<4)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<5)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<6)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<7)&0x80)]; + } + } + } + break; + + case 1: // 2bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < hres/4; x++) + { + pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; + *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; + *scanline++ = m_rbv_palette[0xfc|((pixels>>2)&3)]; + *scanline++ = m_rbv_palette[0xfc|(pixels&3)]; + } + } + } + break; + + case 2: // 4bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres/2; x++) + { + pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; + *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; + } + } + } + break; + + case 3: // 8bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres; x++) + { + pixels = vram8[(y * 2048) + (BYTE4_XOR_BE(x))]; + *scanline++ = m_rbv_palette[pixels]; + } + } + } + } + + return 0; +} + +UINT32 mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y, hres, vres; + + switch (m_rbv_montype) + { + case 1: // 15" portrait display + hres = 640; + vres = 870; + break; + + case 2: // 12" RGB + hres = 512; + vres = 384; + break; + + case 6: // 13" RGB + default: + hres = 640; + vres = 480; + break; + } + + switch (m_rbv_regs[0x10] & 7) + { + case 0: // 1bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < hres; x+=8) + { + pixels = vram8[(y * 1024) + ((x/8)^3)]; + + *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<2)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<3)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<4)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<5)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<6)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<7)&0x80)]; + } + } + } + break; + + case 1: // 2bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < hres/4; x++) + { + pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; + *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; + *scanline++ = m_rbv_palette[0x3f|((pixels<<4)&0xc0)]; + *scanline++ = m_rbv_palette[0x3f|((pixels<<6)&0xc0)]; + } + } + } + break; + + case 2: // 4bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres/2; x++) + { + pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; + *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; + } + } + } + break; + + case 3: // 8bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres; x++) + { + pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + *scanline++ = m_rbv_palette[pixels]; + } + } + } + break; + } + + return 0; +} + +UINT32 mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y, hres, vres, stride; + + switch (m_rbv_montype) + { + case 1: // 15" portrait display + stride = hres = 640; + vres = 870; + break; + + case 2: // 12" RGB + stride = hres = 512; + vres = 384; + break; + + case 6: // 13" RGB + default: + stride = hres = 640; + vres = 480; + break; + } + + // forced blank? + if (m_sonora_vctl[0] & 0x80) + { + return 0; + } + + switch (m_sonora_vctl[1] & 7) + { + case 0: // 1bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < hres; x+=8) + { + pixels = vram8[(y * (stride/8)) + ((x/8)^3)]; + + *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<2)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<3)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<4)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<5)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<6)&0x80)]; + *scanline++ = m_rbv_palette[0x7f|((pixels<<7)&0x80)]; + } + } + } + break; + + case 1: // 2bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < hres/4; x++) + { + pixels = vram8[(y * (stride/4)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; + *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; + *scanline++ = m_rbv_palette[0x3f|((pixels<<4)&0xc0)]; + *scanline++ = m_rbv_palette[0x3f|((pixels<<6)&0xc0)]; + } + } + } + break; + + case 2: // 4bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres/2; x++) + { + pixels = vram8[(y * (stride/2)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; + *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; + } + } + } + break; + + case 3: // 8bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres; x++) + { + pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; + *scanline++ = m_rbv_palette[pixels]; + } + } + } + break; + + case 4: // 16bpp + { + UINT16 *vram16 = (UINT16 *)m_vram.target(); + UINT16 pixels; + + for (y = 0; y < vres; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < hres; x++) + { + pixels = vram16[(y * stride) + (x^1)]; + *scanline++ = rgb_t(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3); + } + } + } + break; + } + + return 0; +} + +// DAFB: video for Quadra 700/900 + +void mac_state::dafb_recalc_ints() +{ + if (m_dafb_int_status != 0) + { + nubus_slot_interrupt(0xf, ASSERT_LINE); + } + else + { + nubus_slot_interrupt(0xf, CLEAR_LINE); + } +} + +TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick) +{ + m_dafb_int_status |= 1; + dafb_recalc_ints(); + + m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); +} + +TIMER_CALLBACK_MEMBER(mac_state::dafb_cursor_tick) +{ + m_dafb_int_status |= 4; + dafb_recalc_ints(); + + m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); +} + +VIDEO_START_MEMBER(mac_state,macdafb) +{ + m_vbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_vbl_tick),this)); + m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_cursor_tick),this)); + + m_vbl_timer->adjust(attotime::never); + m_cursor_timer->adjust(attotime::never); +} + +VIDEO_RESET_MEMBER(mac_state,macdafb) +{ + m_rbv_count = 0; + m_rbv_clutoffs = 0; + m_rbv_montype = 6; + m_rbv_vbltime = 0; + m_dafb_int_status = 0; + m_rbv_type = RBV_TYPE_DAFB; + m_dafb_mode = 0; + m_dafb_base = 0x1000; + m_dafb_stride = 256*4; + + memset(m_rbv_palette, 0, sizeof(m_rbv_palette)); +} + +READ32_MEMBER(mac_state::dafb_r) +{ +// if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc()); + + switch (offset<<2) + { + case 0x1c: // inverse of monitor sense + return 7; // 21" color 2-page + + case 0x24: // SCSI 539x #1 status + return m_dafb_scsi1_drq<<9; + + case 0x28: // SCSI 539x #2 status + return m_dafb_scsi2_drq<<9; + + case 0x108: // IRQ/VBL status + return m_dafb_int_status; + + case 0x10c: // clear cursor scanline int + m_dafb_int_status &= ~4; + dafb_recalc_ints(); + break; + + case 0x114: // clear VBL int + m_dafb_int_status &= ~1; + dafb_recalc_ints(); + break; + } + return 0; +} + +WRITE32_MEMBER(mac_state::dafb_w) +{ +// if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc()); + + switch (offset<<2) + { + case 0: // bits 20-9 of base + m_dafb_base &= 0x1ff; + m_dafb_base |= (data & 0xffff) << 9; +// printf("DAFB baseH: %x\n", m_dafb_base); + break; + + case 4: // bits 8-5 of base + m_dafb_base &= ~0x1ff; + m_dafb_base |= (data & 0xf) << 5; +// printf("DAFB baseL: %x\n", m_dafb_base); + break; + + case 8: + m_dafb_stride = data<<2; // stride in DWORDs +// printf("DAFB stride: %x %x\n", m_dafb_stride, data); + break; + + case 0x104: + if (data & 1) // VBL enable + { + m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); + } + else + { + m_vbl_timer->adjust(attotime::never); + m_dafb_int_status &= ~1; + dafb_recalc_ints(); + } + + if (data & 2) // aux scanline interrupt enable + { + fatalerror("DAFB: Aux scanline interrupt enable not supported!\n"); + } + + if (data & 4) // cursor scanline interrupt enable + { + m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); + } + else + { + m_cursor_timer->adjust(attotime::never); + m_dafb_int_status &= ~4; + dafb_recalc_ints(); + } + break; + + case 0x10c: // clear cursor scanline int + m_dafb_int_status &= ~4; + dafb_recalc_ints(); + break; + + case 0x114: // clear VBL int + m_dafb_int_status &= ~1; + dafb_recalc_ints(); + break; + } +} + +READ32_MEMBER(mac_state::dafb_dac_r) +{ +// printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc()); + + return 0; +} + +WRITE32_MEMBER(mac_state::dafb_dac_w) +{ +// if ((offset > 0) && (offset != 0x10/4)) printf("DAFB: Write %08x to DAC @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc()); + + switch (offset<<2) + { + case 0: + m_rbv_clutoffs = data & 0xff; + m_rbv_count = 0; + break; + + case 0x10: + m_rbv_colors[m_rbv_count++] = data&0xff; + + if (m_rbv_count == 3) + { + m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2])); + m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); + m_rbv_clutoffs++; + m_rbv_count = 0; + } + break; + + case 0x20: + printf("%x to DAFB mode\n", data); + switch (data & 0x9f) + { + case 0x80: + m_dafb_mode = 0; // 1bpp + break; + + case 0x88: + m_dafb_mode = 1; // 2bpp + break; + + case 0x90: + m_dafb_mode = 2; // 4bpp + break; + + case 0x98: + m_dafb_mode = 3; // 8bpp + break; + + case 0x9c: + m_dafb_mode = 4; // 24bpp + break; + } + break; + } +} + +UINT32 mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y; + + switch (m_dafb_mode) + { + case 0: // 1bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + vram8 += m_dafb_base; + + for (y = 0; y < 870; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 1152; x+=8) + { + pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)]; + + *scanline++ = m_rbv_palette[(pixels>>7)&1]; + *scanline++ = m_rbv_palette[(pixels>>6)&1]; + *scanline++ = m_rbv_palette[(pixels>>5)&1]; + *scanline++ = m_rbv_palette[(pixels>>4)&1]; + *scanline++ = m_rbv_palette[(pixels>>3)&1]; + *scanline++ = m_rbv_palette[(pixels>>2)&1]; + *scanline++ = m_rbv_palette[(pixels>>1)&1]; + *scanline++ = m_rbv_palette[(pixels&1)]; + } + } + } + break; + + case 1: // 2bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + vram8 += m_dafb_base; + + for (y = 0; y < 870; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 1152/4; x++) + { + pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[((pixels>>6)&3)]; + *scanline++ = m_rbv_palette[((pixels>>4)&3)]; + *scanline++ = m_rbv_palette[((pixels>>2)&3)]; + *scanline++ = m_rbv_palette[(pixels&3)]; + } + } + } + break; + + case 2: // 4bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + vram8 += m_dafb_base; + + for (y = 0; y < 870; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < 1152/2; x++) + { + pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_rbv_palette[(pixels>>4)]; + *scanline++ = m_rbv_palette[(pixels&0xf)]; + } + } + } + break; + + case 3: // 8bpp + { + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + vram8 += m_dafb_base; + + for (y = 0; y < 870; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < 1152; x++) + { + pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + *scanline++ = m_rbv_palette[pixels]; + } + } + } + break; + + case 4: // 24 bpp + for (y = 0; y < 480; y++) + { + UINT32 *base; + + scanline = &bitmap.pix32(y); + base = (UINT32 *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)]; + for (x = 0; x < 640; x++) + { + *scanline++ = *base++; + } + } + break; + } + + return 0; +} + +UINT32 mac_state::screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)/* Color PowerBooks using an off-the-shelf WD video chipset */ +{ + UINT32 *scanline; + int x, y; + UINT8 *vram8 = (UINT8 *)m_vram.target(); + UINT8 pixels; + +// vram8 += 0x40000; + + for (y = 0; y < 480; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 640; x++) + { + pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; + *scanline++ = m_rbv_palette[pixels]; + } + } + + return 0; +} + +READ32_MEMBER(mac_state::macwd_r) +{ + switch (offset) + { + case 0xf6: + if (m_screen->vblank()) + { + return 0xffffffff; + } + else + { + return 0; + } + + default: +// printf("macwd_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, m_maincpu->pc()); + break; + } + return 0; +} + +WRITE32_MEMBER(mac_state::macwd_w) +{ + switch (offset) + { + case 0xf2: + if (mem_mask == 0xff000000) // DAC control + { + m_rbv_clutoffs = data>>24; + m_rbv_count = 0; + } + else if (mem_mask == 0x00ff0000) // DAC data + { + m_rbv_colors[m_rbv_count++] = (data>>16)&0xff; + if (m_rbv_count == 3) + { +// printf("RAMDAC: color %d = %02x %02x %02x\n", m_rbv_clutoffs, m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); + m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); + m_rbv_clutoffs++; + m_rbv_count = 0; + } + } + else + { + printf("macwd: Unknown DAC write, data %08x, mask %08x\n", data, mem_mask); + } + break; + + default: +// printf("macwd_w: %x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, m_maincpu->pc()); + break; + } +} diff --git a/src/mame/video/maria.c b/src/mame/video/maria.c new file mode 100644 index 00000000000..b2514770e82 --- /dev/null +++ b/src/mame/video/maria.c @@ -0,0 +1,484 @@ +// license:BSD-3-Clause +// copyright-holders:Dan Boris, Fabio Priuli, Mike Saarna, Robert Tuccitto +/*************************************************************************** + + Atari MARIA video emulation + + + - some history: + 2014-12-01 Mike Saarna, Robert Tuccitto Implemented "colorburst kill" bit + of the MARIA CTRL register. + 2014-10-05 Mike Saarna, Robert Tuccitto Last Line DMA value corrected + to 6. GCC and Atari docs both show a difference between + Other Line and Last Line as +6 at the lowest part of the + range. + Blank scanlines are drawn when DMA is off, like real + hardware. + If MARIA hits the DMA limit, the CPU doesn't run until + the next scanline. + + 2014-09-03 Mike Saarna, Robert Tuccitto reorganized DMA penalties to + support new rendering timeout code. + + 2014-08-29 Mike Saarna Timeout rendering added. + + 2014-08-26 Fabio Priuli Converted to device + + 2014-05-06 Mike Saarna Added interrupts to DMA cycle eating. Updates to + LL, OL, and spin accounting for HALT behavior. + + 2014-03-24 Mike Saarna Fixed DMA regarding startup, shutdown and + cycle stealing. + + 2013-05-08 huygens rewrite to emulate line ram buffers (mostly fixes Kung-Fu Master + Started DMA cycle stealing implementation + + 2003-06-23 ericball Kangaroo mode & 320 mode & other stuff + + 2002-05-14 kubecj vblank dma stop fix + + 2002-05-13 kubecj fixed 320C mode (displayed 2 pixels instead of one!) + noticed that Jinks uses 0x02-320D mode + implemented the mode - completely unsure if good! + implemented some Maria CTRL variables + + 2002-05-12 kubecj added cases for 0x01-160A, 0x05-160B as stated by docs + +***************************************************************************/ + +#include "emu.h" +#include "maria.h" + + +#define TRIGGER_HSYNC 64717 + +#define READ_MEM(x) space.read_byte(x) + +const device_type ATARI_MARIA = &device_creator; + + + +atari_maria_device::atari_maria_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ATARI_MARIA, "Atari MARIA", tag, owner, clock, "atari_maria", __FILE__) +{ +} + + +void atari_maria_device::device_start() +{ + m_cpu = machine().device(m_cpu_tag); + m_screen = machine().first_screen(); + m_screen->register_screen_bitmap(m_bitmap); + + save_item(NAME(m_maria_palette)); + save_item(NAME(m_line_ram)); + save_item(NAME(m_active_buffer)); + save_item(NAME(m_write_mode)); + save_item(NAME(m_dll)); + save_item(NAME(m_dl)); + save_item(NAME(m_holey)); + save_item(NAME(m_offset)); + save_item(NAME(m_vblank)); + save_item(NAME(m_dmaon)); + save_item(NAME(m_dpp)); + save_item(NAME(m_wsync)); + save_item(NAME(m_color_kill)); + save_item(NAME(m_cwidth)); + save_item(NAME(m_bcntl)); + save_item(NAME(m_kangaroo)); + save_item(NAME(m_rm)); + save_item(NAME(m_nmi)); + save_item(NAME(m_charbase)); +} + +void atari_maria_device::device_reset() +{ + for (int i = 0; i < 32; i++) + m_maria_palette[i] = 0; + + for (int i = 0; i < 2; i++) + for (int j = 0; j < 160; j++) + m_line_ram[i][j] = 0; + + m_active_buffer = 0; + + m_write_mode = 0; + m_dmaon = 0; + m_vblank = 0x80; + m_dll = 0; + m_wsync = 0; + + m_color_kill = 0; + m_cwidth = 0; + m_bcntl = 0; + m_kangaroo = 0; + m_rm = 0; + + m_dl = 0; + m_holey = 0; + m_offset = 0; + m_dpp = 0; + m_nmi = 0; + m_charbase = 0; +} + +/*************************************************************************** + + Stop the video hardware emulation. + +***************************************************************************/ + +int atari_maria_device::is_holey(unsigned int addr) +{ + if (((m_holey & 0x02) && ((addr & 0x9000) == 0x9000)) || ( (m_holey & 0x01) && ((addr & 0x8800) == 0x8800))) + return 1; + else + return 0; +} + +int atari_maria_device::write_line_ram(int addr, UINT8 offset, int pal) +{ + address_space& space = m_cpu->space(AS_PROGRAM); + int c; + + int data = READ_MEM(addr); + pal <<= 2; + + if (m_write_mode) + { + c = (pal & 0x10) | (data & 0x0c) | (data >> 6); // P2 D3 D2 D7 D6 + if (((c & 3) || m_kangaroo) && (offset < 160)) + m_line_ram[m_active_buffer][offset] = c; + offset++; + + c = (pal & 0x10) | ((data & 0x03) << 2) | ((data & 0x30) >> 4); // P2 D1 D0 D5 D4 + if (((c & 3) || m_kangaroo) && (offset < 160)) + m_line_ram[m_active_buffer][offset] = c; + } + else + { + for (int i = 0; i < 4; i++, offset++) + { + c = pal | ((data >> (6 - 2 * i)) & 0x03); + if (((c & 3) || m_kangaroo) && (offset < 160)) + m_line_ram[m_active_buffer][offset] = c; + } + } + return m_write_mode ? 2 : 4; +} + + +void atari_maria_device::draw_scanline() +{ + address_space& space = m_cpu->space(AS_PROGRAM); + UINT16 graph_adr, data_addr; + int width, pal, ind; + UINT8 hpos; + UINT16 dl; + int d, c, pixel_cell, cells; + int maria_cycles; + + cells = 0; + + if(m_dmaon) + { + // All lines in a zone have the same initial DMA startup time. We'll adjust + // cycles for the special last zone line later, as those penalties happen after + // MARIA is done rendering, or after its hit the maximum rendering time. + maria_cycles = 16; + + + /* Process this DLL entry */ + dl = m_dl; + + /* DMA */ + /* Step through DL's while we're within maximum rendering time. */ + /* max render time = ( scanline length - DMA start ) */ + /* 426 = ( 454 - 28 ) */ + + while (((READ_MEM(dl + 1) & 0x5f) != 0) && (maria_cycles<426)) + { + /* Extended header */ + if (!(READ_MEM(dl + 1) & 0x1f)) + { + graph_adr = (READ_MEM(dl + 2) << 8) | READ_MEM(dl); + width = ((READ_MEM(dl + 3) ^ 0xff) & 0x1f) + 1; + hpos = READ_MEM(dl + 4); + pal = READ_MEM(dl + 3) >> 5; + m_write_mode = (READ_MEM(dl + 1) & 0x80) >> 5; + ind = READ_MEM(dl + 1) & 0x20; + dl += 5; + maria_cycles += 10; + } + /* Normal header */ + else + { + graph_adr = (READ_MEM(dl + 2) << 8) | READ_MEM(dl); + width = ((READ_MEM(dl + 1) ^ 0xff) & 0x1f) + 1; + hpos = READ_MEM(dl + 3); + pal = READ_MEM(dl + 1) >> 5; + ind = 0x00; + dl += 4; + maria_cycles += 8; + } + + /*logerror("%x DL: ADR=%x width=%x hpos=%x pal=%x mode=%x ind=%x\n", m_screen->vpos(), graph_adr, width, hpos, pal, m_write_mode, ind);*/ + + for (int x = 0; x < width; x++) + { + if (maria_cycles >= 426) // ensure we haven't overrun the maximum render time + break; + + /* Do indirect mode */ + if (ind) + { + c = READ_MEM(graph_adr + x) & 0xff; + data_addr = (m_charbase | c) + (m_offset << 8); + if (is_holey(data_addr)) + continue; + + maria_cycles += 3; + if (m_cwidth) // two data bytes per map byte + { + cells = write_line_ram(data_addr, hpos, pal); + hpos += cells; + cells = write_line_ram(data_addr+1, hpos, pal); + hpos += cells; + maria_cycles += 6; + } + else + { + cells = write_line_ram(data_addr, hpos, pal); + hpos += cells; + maria_cycles += 3; + } + } + else // direct mode + { + data_addr = graph_adr + x + (m_offset << 8); + if (is_holey(data_addr)) + continue; + cells = write_line_ram(data_addr, hpos, pal); + hpos += cells; + maria_cycles += 3; + } + } + } + + // Last Line post-render DMA cycle penalties... + if (m_offset == 0) + { + maria_cycles += 6; // extra shutdown time + if (READ_MEM(m_dll + 3) & 0x80) + maria_cycles += 17; // interrupt overhead + } + + // If MARIA used up all of the DMA time then the CPU can't run until next line... + if (maria_cycles>=426) + { + m_cpu->spin_until_trigger(TRIGGER_HSYNC); + m_wsync = 1; + } + + // Spin the CPU for Maria DMA, if it's not already spinning for WSYNC. + // MARIA generates the 6502 clock by dividing its own clock by 4. It needs to HALT and unHALT + // the 6502 on ths same clock phase, so MARIA will wait until its clock divides evenly by 4. + // To spin until an even divisor, we just round-up any would-be truncations by adding 3. + if (!m_wsync) + m_cpu->spin_until_time(m_cpu->cycles_to_attotime((maria_cycles+3)/4)); + } + + // draw line buffer to screen + m_active_buffer = !m_active_buffer; // switch buffers + UINT16 *scanline; + scanline = &m_bitmap.pix16(m_screen->vpos()); + + + for (int i = 0; i < 160; i++) + { + switch (m_rm) + { + case 0x00: /* 160A, 160B */ + case 0x01: /* 160A, 160B */ + pixel_cell = m_line_ram[m_active_buffer][i]; + scanline[2 * i] = m_maria_palette[pixel_cell]; + scanline[2 * i + 1] = m_maria_palette[pixel_cell]; + break; + + case 0x02: /* 320B, 320D */ + pixel_cell = m_line_ram[m_active_buffer][i]; + d = (pixel_cell & 0x10) | (pixel_cell & 0x02) | ((pixel_cell >> 3) & 1); // b4 0 0 b1 b3 + scanline[2 * i] = m_maria_palette[d]; + d = (pixel_cell & 0x10) | ((pixel_cell << 1) & 0x02) | ((pixel_cell >> 2) & 1); // b4 0 0 b0 b2 + scanline[2 * i + 1] = m_maria_palette[d]; + break; + + case 0x03: /* 320A, 320C */ + pixel_cell = m_line_ram[m_active_buffer][i]; + d = (pixel_cell & 0x1c) | (pixel_cell & 0x02); // b4 b3 b2 b1 0 + scanline[2 * i] = m_maria_palette[d]; + d = (pixel_cell & 0x1c) | ((pixel_cell << 1) & 0x02); // b4 b3 b2 b0 0 + scanline[2 * i + 1] = m_maria_palette[d]; + break; + } + + if(m_color_kill) //remove color if there's no colorburst signal + { + scanline[2 * i] &= 0x0f; + scanline[2 * i + 1] &= 0x0f; + } + } + + for (int i = 0; i < 160; i++) // buffer automaticaly cleared once displayed + m_line_ram[m_active_buffer][i] = 0; +} + + +void atari_maria_device::interrupt(int lines) +{ + if (m_wsync) + { + machine().scheduler().trigger(TRIGGER_HSYNC); + m_wsync = 0; + } + + int frame_scanline = m_screen->vpos() % (lines + 1); + if (frame_scanline == 16) + m_vblank = 0x00; + + if (frame_scanline == (lines - 5)) + m_vblank = 0x80; +} + + +void atari_maria_device::startdma(int lines) +{ + address_space& space = m_cpu->space(AS_PROGRAM); + int maria_scanline = m_screen->vpos(); + int frame_scanline = maria_scanline % (lines + 1); + + if ((frame_scanline == 16) && m_dmaon) + { + /* end of vblank */ + m_dll = m_dpp; // currently only handle changes to dll during vblank + m_dl = (READ_MEM(m_dll + 1) << 8) | READ_MEM(m_dll+2); + m_offset = READ_MEM(m_dll) & 0x0f; + m_holey = (READ_MEM(m_dll) & 0x60) >> 5; + m_nmi = READ_MEM(m_dll) & 0x80; + /* logerror("DLL=%x\n",m_dll); */ + } + + if ((frame_scanline > 15) && (frame_scanline < (lines - 5))) + draw_scanline(); + + if ((frame_scanline > 16) && (frame_scanline < (lines - 5)) && m_dmaon) + { + if (m_offset == 0) + { + m_dll += 3; + m_dl = (READ_MEM(m_dll + 1) << 8) | READ_MEM(m_dll + 2); + m_offset = READ_MEM(m_dll) & 0x0f; + m_holey = (READ_MEM(m_dll) & 0x60) >> 5; + if (READ_MEM(m_dll & 0x10)) + logerror("dll bit 5 set!\n"); + m_nmi = READ_MEM(m_dll) & 0x80; + } + else + { + m_offset--; + } + } + + if (m_nmi) + { + m_cpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_nmi = 0; + } +} + +/*************************************************************************** + + Refresh the video screen + +***************************************************************************/ + +/* This routine is called at the start of vblank to refresh the screen */ +UINT32 atari_maria_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + + +READ8_MEMBER(atari_maria_device::read) +{ + switch (offset) + { + case 0x08: + return m_vblank; + + default: + logerror("undefined MARIA read %x\n",offset); + return 0x00; // don't know if this should be 0x00 or 0xff + } +} + +WRITE8_MEMBER(atari_maria_device::write) +{ + if ((offset & 3) != 0) + m_maria_palette[offset] = data; + + switch (offset) + { + case 0x00: + // all color ram addresses with 00 for their least significant bits point to the background color + for (int i = 0; i < 8; i++) + m_maria_palette[4 * i] = data; + break; + case 0x04: + m_cpu->spin_until_trigger(TRIGGER_HSYNC); + m_wsync = 1; + break; + case 0x0C: // DPPH + m_dpp = (m_dpp & 0x00ff) | (data << 8); + break; + case 0x10: // DPPL + m_dpp = (m_dpp & 0xff00) | data; + break; + case 0x14: + m_charbase = (data << 8); + break; + case 0x1C: + /*logerror("MARIA CTRL=%x\n",data);*/ + m_color_kill = data & 0x80; + switch ((data >> 5) & 3) + { + case 0x00: + case 01: + logerror("dma test mode, do not use.\n"); + break; + + case 0x02: + m_dmaon = 1; + break; + + case 0x03: + m_dmaon = 0; + break; + } + m_cwidth = data & 0x10; + m_bcntl = data & 0x08; // Currently unimplemented as we don't display the border + m_kangaroo = data & 0x04; + m_rm = data & 0x03; + + /*logerror( "MARIA CTRL: CK:%d DMA:%d CW:%d BC:%d KM:%d RM:%d\n", + m_color_kill ? 1 : 0, + (data & 0x60) >> 5, + m_cwidth ? 1 : 0, + m_bcntl ? 1 : 0, + m_kangaroo ? 1 : 0, + m_rm );*/ + + break; + } +} diff --git a/src/mame/video/maria.h b/src/mame/video/maria.h new file mode 100644 index 00000000000..8e91354cb06 --- /dev/null +++ b/src/mame/video/maria.h @@ -0,0 +1,72 @@ +// license:BSD-3-Clause +// copyright-holders:Dan Boris +#ifndef __ATARI_MARIA__ +#define __ATARI_MARIA__ + +#include "emu.h" + +// ======================> atari_maria_device + +class atari_maria_device : public device_t +{ +public: + // construction/destruction + atari_maria_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + static void set_cpu_tag(device_t &device, const char *tag) { downcast(device).m_cpu_tag = tag; } + + void interrupt(int lines); + void startdma(int lines); + + DECLARE_READ8_MEMBER(read); + DECLARE_WRITE8_MEMBER(write); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + + int m_maria_palette[32]; + int m_line_ram[2][160]; + int m_active_buffer; + int m_write_mode; + unsigned int m_dll; + unsigned int m_dl; + int m_holey; + int m_offset; + int m_vblank; + int m_dmaon; + int m_dpp; + int m_wsync; + int m_color_kill; + int m_cwidth; + int m_bcntl; + int m_kangaroo; + int m_rm; + int m_nmi; + unsigned int m_charbase; + bitmap_ind16 m_bitmap; + + void draw_scanline(); + int is_holey(unsigned int addr); + int write_line_ram(int addr, UINT8 offset, int pal); + + const char *m_cpu_tag; + cpu_device *m_cpu; // CPU whose space(AS_PROGRAM) serves as DMA source + screen_device *m_screen; +}; + + +// device type definition +extern const device_type ATARI_MARIA; + + +#define MCFG_MARIA_DMACPU(_tag) \ + atari_maria_device::set_cpu_tag(*device, _tag); + + +#endif diff --git a/src/mame/video/mbc55x.c b/src/mame/video/mbc55x.c new file mode 100644 index 00000000000..d7fdc80d41c --- /dev/null +++ b/src/mame/video/mbc55x.c @@ -0,0 +1,186 @@ +// license:BSD-3-Clause +// copyright-holders:Phill Harvey-Smith +/* + video/mbc55x.c + + Machine driver for the Sanyo MBC-550 and MBC-555. + + Phill Harvey-Smith + 2011-01-29. + +Taken from : http://www.seasip.info/VintagePC/sanyo.html + +Video Controller + +To a programmer, the MBC's video hardware appears as a 6845 chip and three bitmapped graphics planes. +The 6845 appears at I/O ports 30h (register select) and 32h (data). At system boot, it is programmed +for 25 lines x 72 columns. The RAM BIOS then reprograms it for 25 x 80. The ROM also provides timings +for what appears to be a different 80-column mode; it decides which to use by reading port 1Ch. +If bit 7 of the result is 1, the 72-column mode is used; otherwise, the 80-column mode is. + +Here are the values written to the 6845 in each case, plus (for comparison) the values used by a real CGA: + + 6845 Register | IO.SYS | ROM 80 | ROM 72 | Real CGA +=============================+========+========+========+========== + Horizontal total | 112 | 101 | 112 | 83 + Horizontal display end | 80 | 80 | 72 | 80 + Horizontal sync pos | 89 | 83 | 85 | 81 + Horizontal sync width | 72 | 72 | 74 | 1 + Vertical total | 65 | 105 | 65 | 26 + Vertical total adjust | 0 | 2 | 0 | 0 + Vertical displayed | 50 | 100 | 50 | 26 + Vertical sync position | 56 | 100 | 56 | 25 + Interlace | 0 | 0 | 0 | 2 + Max scan address | 3 | 3 | 3 | 7 + Cursor start | 0 | 0 | 0 | 6 + Cursor end | 0 | 0 | 0 | 7 +=============================+========+========+========+========== + +The important thing to note here is that from the 6845's point of view, a character is 4 lines high. +This explains why the framebuffer memory is mapped as it is. + +The framebuffers + +The MBC video RAM is composed of three planes - green, red and blue. The green plane occupies main memory, +and its position varies; writes to port 10h set its address: + +Value | Address +======+======== + 4 | 0C000h + 5 | 1C000h (other values have not been tested) + 6 | 2C000h + 7 | 3C000h +======+======== + +The red and blue planes appear to have fixed locations of F0000h and F4000h respectively. + +When output goes to a composite monitor, the green plane is usually used by itself. +The red plane becomes "blink", causing pixels in it to blink; and the blue plane becomes "bright". + +Within each plane, memory is organised as 50 rows of 320 bytes (288 bytes in 72-column mode). +This corresponds to a rectangle, 640 (576) pixels wide and four pixels high. The first four bytes +give the leftmost column of the rectangle, the next four give the next column, and so on: + +[--byte 0--] [--byte 4--] [--byte 8--] [--byte 12--] ... +[--byte 1--] [--byte 5--] [--byte 9--] [--byte 13--] ... +[--byte 2--] [--byte 6--] [--byte 10--] [--byte 14--] ... +[--byte 3--] [--byte 7--] [--byte 11--] [--byte 15--] ... + +*************************************************************************************************************/ + +#include "includes/mbc55x.h" + +#define DEBUG_LINES 1 +#define DEBUG_VSYNC 2 + +#define DEBUG_SET(flags) ((m_debug_video & (flags))==(flags)) + +static void video_debug(running_machine &machine, int ref, int params, const char *param[]) +{ + mbc55x_state *mstate = machine.driver_data(); + if(params>0) + { + int temp; + sscanf(param[0],"%d",&temp); mstate->m_debug_video = temp;; + } + else + { + debug_console_printf(machine,"Error usage : mbc55x_vid_debug \n"); + debug_console_printf(machine,"Current debuglevel=%02X\n",mstate->m_debug_video); + } +} + +MC6845_UPDATE_ROW( mbc55x_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + UINT8 *ram = &m_ram->pointer()[0]; + UINT8 *red = &m_video_mem[RED_PLANE_OFFSET]; + UINT8 *blue = &m_video_mem[BLUE_PLANE_OFFSET]; + UINT8 *green; + int offset; + UINT8 rpx,gpx,bpx; + UINT8 rb,gb,bb; + + int x_pos; + int pixelno; + UINT8 bitno; + UINT8 shifts; + UINT8 colour; + + switch(m_vram_page) + { + case 4 : green=&ram[0x08000]; break; + case 5 : green=&ram[0x1C000]; break; + case 6 : green=&ram[0x2C000]; break; + case 7 : green=&ram[0x3C000]; break; + default : + green=&ram[0x0C000]; + } + + if(DEBUG_SET(DEBUG_LINES)) + logerror("MC6845_UPDATE_ROW: ma=%d, ra=%d, y=%d, x_count=%d\n",ma,ra,y,x_count); + + offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; + + if(DEBUG_SET(DEBUG_LINES)) + logerror("offset=%05X\n",offset); + + for(x_pos=0; x_pos> shifts; + gb=(gpx & bitno) >> shifts; + bb=(bpx & bitno) >> shifts; + + colour=(rb<<2) | (gb<<1) | (bb<<0); + + bitmap.pix32(y, (x_pos*8)+pixelno)=palette[colour]; + //logerror("set pixel (%d,%d)=%d\n",y, ((x_pos*8)+pixelno),colour); + bitno=bitno>>1; + shifts--; + } + } +} + +WRITE_LINE_MEMBER( mbc55x_state::vid_hsync_changed ) +{ +} + +WRITE_LINE_MEMBER( mbc55x_state::vid_vsync_changed ) +{ +} + +void mbc55x_state::video_start() +{ + m_debug_video=0; + + logerror("video_start\n"); + + if (machine().debug_flags & DEBUG_FLAG_ENABLED) + { + debug_console_register_command(machine(), "mbc55x_vid_debug", CMDFLAG_NONE, 0, 0, 1, video_debug); + } +} + +void mbc55x_state::video_reset() +{ + // When we reset clear the video registers and video memory. + memset(&m_video_mem,0,sizeof(m_video_mem)); + + logerror("Video reset\n"); +} + +void mbc55x_state::screen_eof_mbc55x(screen_device &screen, bool state) +{ +// logerror("screen_eof_mbc55x\n"); +} diff --git a/src/mame/video/mbee.c b/src/mame/video/mbee.c new file mode 100644 index 00000000000..ce55969f6a3 --- /dev/null +++ b/src/mame/video/mbee.c @@ -0,0 +1,495 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + microbee.c + + video hardware + Originally written by Juergen Buchmueller, Dec 1999 + + Rewritten by Robbbert (see notes in driver file). + + Operation of old keyboard: + The design is taken from the SY6545 Application Note AN3. As the CRTC + renders the picture, the MA lines also scan the keyboard. When a keydown + is detected, the lightpen pin is activated, which sets bit 6 of the status + register. The CPU continuously monitors this register. Once bit 6 is set, + the CPU needs to determine which key is pressed. It firstly clears bit 6, + then sets port 0B to 1. This prevents the CRTC from scanning the keyboard + and causing interference. Next, the CPU writes an address to regs 18,19 and + then instigates the transparent access. This checks one keyboard row, which + if the pressed key is found, will once again set bit 6. If not found, the + next row will be checked. Once found, the CPU clears bit 6 and port 0B, then + works out the ascii key code of the pressed key. + + Tests of old keyboard. Start mbeeic. + 1. Load ASTEROIDS PLUS, stay in attract mode, hold down spacebar, + it should only fire bullets. If it sometimes starts turning, + thrusting or using the shield, then there is a problem. + + 2. Load SCAVENGER and make sure it doesn't go to the next level + until you find the Exit. + + 3. At the Basic prompt, type in EDASM press enter. At the memory size + prompt press enter. Now, make sure the keyboard works properly. + + Old keyboard ToDo: + - Occasional characters dropped while typing + - Lots of characters dropped when pasting + - On mbee128p, Simply Write doesn't accept any input + + New keyboard ToDo: + - On mbeett, various problems caused by phantom characters. + +****************************************************************************/ + + +#include "includes/mbee.h" + +WRITE_LINE_MEMBER( mbee_state::crtc_vs ) +{ + m_b7_vs = state; + if ((m_io_config->read() & 0xc0) == 0) // VS selected in config menu + m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); +} + +/*********************************************************** + + The 6845 can produce a variety of cursor shapes - all + are emulated here. + + Need to find out if the 6545 works the same way. + +************************************************************/ + +void mbee_state::sy6545_cursor_configure() +{ + UINT8 i,curs_type=0,r9,r10,r11; + + /* curs_type holds the general cursor shape to be created + 0 = no cursor + 1 = partial cursor (only shows on a block of scan lines) + 2 = full cursor + 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ + + for ( i = 0; i < ARRAY_LENGTH(m_sy6545_cursor); i++) m_sy6545_cursor[i] = 0; // prepare cursor by erasing old one + + r9 = m_sy6545_reg[9]; // number of scan lines - 1 + r10 = m_sy6545_reg[10] & 0x1f; // cursor start line = last 5 bits + r11 = m_sy6545_reg[11]+1; // cursor end line incremented to suit for-loops below + + /* decide the curs_type by examining the registers */ + if (r10 < r11) curs_type=1; // start less than end, show start to end + else + if (r10 == r11) curs_type=2; // if equal, show full cursor + else curs_type=3; // if start greater than end, it's a two-part cursor + + if ((r11 - 1) > r9) curs_type=2; // if end greater than scan-lines, show full cursor + if (r10 > r9) curs_type=0; // if start greater than scan-lines, then no cursor + if (r11 > 16) r11=16; // truncate 5-bit register to fit our 4-bit hardware + + /* create the new cursor */ + if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(m_sy6545_cursor);i++) m_sy6545_cursor[i]=0xff; // turn on full cursor + + if (curs_type == 1) for (i = r10;i < r11;i++) m_sy6545_cursor[i]=0xff; // for each line that should show, turn on that scan line + + if (curs_type == 3) for (i = r11; i < r10;i++) m_sy6545_cursor[i]=0; // now take a bite out of the middle +} + + +/*********************************************************** + + Handlers of video, colour, and attribute RAM + +************************************************************/ + + +READ8_MEMBER( mbee_state::video_low_r ) +{ + if (m_is_premium && ((m_1c & 0x9f) == 0x90)) + return m_p_attribram[offset]; + else + if (m_0b) + return m_p_gfxram[offset]; + else + return m_p_videoram[offset]; +} + +WRITE8_MEMBER( mbee_state::video_low_w ) +{ + if BIT(m_1c, 4) + { + // non-premium attribute writes are discarded + if (m_is_premium && BIT(m_1c, 7)) + m_p_attribram[offset] = data; + } + else + m_p_videoram[offset] = data; +} + +READ8_MEMBER( mbee_state::video_high_r ) +{ + if BIT(m_08, 6) + return m_p_colorram[offset]; + else + return m_p_gfxram[(((m_1c & 15) + 1) << 11) | offset]; +} + +WRITE8_MEMBER( mbee_state::video_high_w ) +{ + if (BIT(m_08, 6) && (~m_0b & 1)) + m_p_colorram[offset] = data; + else + m_p_gfxram[(((m_1c & 15) + 1) << 11) | offset] = data; +} + +WRITE8_MEMBER( mbee_state::port0b_w ) +{ + m_0b = data & 1; +} + +READ8_MEMBER( mbee_state::port08_r ) +{ + return m_08; +} + +WRITE8_MEMBER( mbee_state::port08_w ) +{ + m_08 = data & 0x4e; +} + +READ8_MEMBER( mbee_state::port1c_r ) +{ + return m_1c; +} + +WRITE8_MEMBER( mbee_state::port1c_w ) +{ +/* d7 extended graphics (1=allow attributes and pcg banks) + d5 bankswitch basic rom + d4 select attribute ram + d3..d0 select m_videoram bank */ + + if (m_is_premium && BIT(data, 7)) + m_1c = data; + else + m_1c = data & 0x30; + + if (m_basic) + m_basic->set_entry(BIT(data, 5)); +} + + +/*********************************************************** + + CRTC-driven keyboard + +************************************************************/ + + +void mbee_state::oldkb_matrix_r(UINT16 offs) +{ + if (m_has_oldkb) + { + UINT8 port = (offs >> 7) & 7; + UINT8 bit = (offs >> 4) & 7; + UINT8 extra = 0; + UINT8 data = m_io_oldkb[port]->read(); + bool keydown = BIT(data, bit); + + // This adds premium-style cursor keys to the old keyboard. + // They are used by the pc85 menu. Premium keyboards already + // have these keys fitted. + if (!keydown && !m_is_premium) + { + if ((port == 0) || (port == 2) || (port == 3)) + extra = m_io_x7->read(); + else + if (port == 7) + extra = data; + + if (extra) + { + if BIT(extra, 0) // cursor up + { + if( port == 7 && bit == 1 ) keydown = 1; + if( port == 0 && bit == 5 ) keydown = 1; // control E + } + else + if BIT(extra, 2) // cursor down + { + if( port == 7 && bit == 1 ) keydown = 1; + if( port == 3 && bit == 0 ) keydown = 1; // control X + } + else + if BIT(extra, 3) // cursor left + { + if( port == 7 && bit == 1 ) keydown = 1; + if( port == 2 && bit == 3 ) keydown = 1; // control S + } + else + if BIT(extra, 6) // cursor right + { + if( port == 7 && bit == 1 ) keydown = 1; + if( port == 0 && bit == 4 ) keydown = 1; // control D + } + } + } + + if( keydown ) + m_crtc->assert_light_pen_input(); //lpen_strobe + } +} + + +void mbee_state::oldkb_scan( UINT16 param ) +{ + if (m_0b) return; // IC5 (pins 11,12,13) + if (param & 15) return; // only scan once per row instead of 16 times + oldkb_matrix_r(param); +} + + +/*********************************************************** + + CRTC registers + +************************************************************/ + +WRITE8_MEMBER ( mbee_state::m6545_index_w ) +{ + data &= 0x1f; + m_sy6545_ind = data; + m_crtc->address_w( space, 0, data ); +} + +WRITE8_MEMBER ( mbee_state::m6545_data_w ) +{ + static const UINT8 sy6545_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0,0x3f,0xff}; + + switch( m_sy6545_ind ) + { + case 12: + data &= 0x3f; // select alternate character set + if( m_sy6545_reg[12] != data ) + memcpy(m_p_gfxram, memregion("gfx")->base() + (((data & 0x30) == 0x20) << 11), 0x800); + break; + } + m_sy6545_reg[m_sy6545_ind] = data & sy6545_mask[m_sy6545_ind]; /* save data in register */ + m_crtc->register_w( space, 0, data ); + if ((m_sy6545_ind > 8) && (m_sy6545_ind < 12)) sy6545_cursor_configure(); /* adjust cursor shape - remove when mame fixed */ +} + + + + +/*********************************************************** + + Video + +************************************************************/ + +VIDEO_START_MEMBER( mbee_state, mono ) +{ + m_p_videoram = memregion("videoram")->base(); + m_p_gfxram = memregion("gfx")->base()+0x1000; + m_p_colorram = 0; + m_p_attribram = 0; + m_is_premium = 0; +} + +VIDEO_START_MEMBER( mbee_state, standard ) +{ + m_p_videoram = memregion("videoram")->base(); + m_p_gfxram = memregion("gfx")->base()+0x1000; + m_p_colorram = memregion("colorram")->base(); + m_p_attribram = 0; + m_is_premium = 0; +} + +VIDEO_START_MEMBER( mbee_state, premium ) +{ + m_p_videoram = memregion("videoram")->base(); + m_p_colorram = memregion("colorram")->base(); + m_p_gfxram = memregion("gfx")->base()+0x1000; + m_p_attribram = memregion("attrib")->base(); + m_is_premium = 1; +} + +UINT32 mbee_state::screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_framecnt++; + m_crtc->screen_update(screen, bitmap, cliprect); + return 0; +} + + +MC6845_ON_UPDATE_ADDR_CHANGED( mbee_state::crtc_update_addr ) +{ +// parameters passed are device, address, strobe(always 0) +// not used on 256TC + + oldkb_matrix_r(address); +} + + +MC6845_UPDATE_ROW( mbee_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + + // colours + UINT8 colourm = (m_08 & 0x0e) >> 1; + UINT8 monopal = (m_io_config->read() & 0x30) >> 4; + // if colour chosen on mono bee, default to amber + if (!monopal && !m_p_colorram) + monopal = 2; + + UINT32 *p = &bitmap.pix32(y); + UINT8 inv, attr=0, gfx, fg=96+monopal, bg=96, col=0; + UINT16 mem, x, chr; + + for (x = 0; x < x_count; x++) // for each character + { + inv = 0; + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + + if BIT(m_1c, 7) // premium graphics enabled? + { + attr = m_p_attribram[mem]; + + if BIT(chr, 7) + chr += ((attr & 15) << 7); // bump chr to its particular pcg definition + + if BIT(attr, 6) + inv ^= 0xff; // inverse attribute + + if (BIT(attr, 7) & BIT(m_framecnt, 4)) // flashing attribute + chr = 0x20; + } + + oldkb_scan(x+ma); + + /* process cursor */ + if (x == cursor_x) + inv ^= m_sy6545_cursor[ra]; // cursor scan row + + /* get pattern of pixels for that character scanline */ + gfx = m_p_gfxram[(chr<<4) | ra] ^ inv; + + // get colours + if (!monopal) + { + col = m_p_colorram[mem]; // read a byte of colour + + if (m_is_premium) + { + fg = col & 15; + bg = col >> 4; + } + else + { + fg = (col & 0x1f) | 64; + bg = ((col & 0xe0) >> 2) | colourm; + } + } + + /* Display a scanline of a character (8 pixels) */ + *p++ = palette[BIT(gfx, 7) ? fg : bg]; + *p++ = palette[BIT(gfx, 6) ? fg : bg]; + *p++ = palette[BIT(gfx, 5) ? fg : bg]; + *p++ = palette[BIT(gfx, 4) ? fg : bg]; + *p++ = palette[BIT(gfx, 3) ? fg : bg]; + *p++ = palette[BIT(gfx, 2) ? fg : bg]; + *p++ = palette[BIT(gfx, 1) ? fg : bg]; + *p++ = palette[BIT(gfx, 0) ? fg : bg]; + } +} + + +/***************************************************************************************************** + + Palette + + Standard Palette: The 8 bits from the colour RAM are divided into 5 bits for foreground, and 3 + bits for background. The 5 foreground bits pass through a PAL, which has 6 outputs. A write to + port 8 produces 3 more background lines, giving 6 in total. These 12 lines travel to a pair of + 74LS157 switching chips, where the foreground or background lines are selected by the absence or + or presence of a pixel. The 6 chosen lines pass through a 7407 then are merged to the final 3 RGB + lines. Each pair is merged like this: + VCC --- 330 ohm --- primary colour line + out to monitor ---- 120 ohm --- secondary colour line + +*****************************************************************************************************/ + +PALETTE_INIT_MEMBER( mbee_state, standard ) +{ + const UINT8 *color_prom = memregion("proms")->base(); + UINT8 i=0, r, b, g, k, r1, g1, b1; + UINT8 bglevel[] = { 0, 0x54, 0xa0, 0xff }; + UINT8 fglevel[] = { 0, 0xa0, 0xff, 0xff }; + + // set up background colours (00-63) + for (b1 = 0; b1 < 4; b1++) + { + b = bglevel[b1]; + for (g1 = 0; g1 < 4; g1++) + { + g = bglevel[g1]; + for (r1 = 0; r1 < 4; r1++) + { + r = bglevel[r1]; + k = BITSWAP8(i, 7, 6, 5, 3, 1, 4, 2, 0); + palette.set_pen_color(k, rgb_t(r, g, b)); + i++; + } + } + } + + // set up foreground palette (64-95) by reading the prom + for (i = 0; i < 32; i++) + { + k = color_prom[i]; + r = fglevel[(BIT(k, 2))|(BIT(k, 5)<<1)]; + g = fglevel[(BIT(k, 1))|(BIT(k, 4)<<1)]; + b = fglevel[(BIT(k, 0))|(BIT(k, 3)<<1)]; + palette.set_pen_color(i|64, rgb_t(r, g, b)); + } + + // monochrome palette + palette.set_pen_color(96, rgb_t(0x00, 0x00, 0x00)); // black + palette.set_pen_color(97, rgb_t(0x00, 0xff, 0x00)); // green + palette.set_pen_color(98, rgb_t(0xf7, 0xaa, 0x00)); // amber + palette.set_pen_color(99, rgb_t(0xff, 0xff, 0xff)); // white +} + + +PALETTE_INIT_MEMBER( mbee_state, premium ) +{ + UINT8 i, r, b, g; + + /* set up 8 low intensity colours */ + for (i = 0; i < 7; i++) + { + r = BIT(i, 0) ? 0xc0 : 0; + g = BIT(i, 1) ? 0xc0 : 0; + b = BIT(i, 2) ? 0xc0 : 0; + palette.set_pen_color(i, rgb_t(r, g, b)); + } + + // colour 8 is dark grey, rather than black + palette.set_pen_color(8, rgb_t(96, 96, 96)); + + /* set up 8 high intensity colours */ + for (i = 9; i < 16; i++) + { + r = BIT(i, 0) ? 0xff : 0; + g = BIT(i, 1) ? 0xff : 0; + b = BIT(i, 2) ? 0xff : 0; + palette.set_pen_color(i, rgb_t(r, g, b)); + } + + // monochrome palette + palette.set_pen_color(96, rgb_t(0x00, 0x00, 0x00)); // black + palette.set_pen_color(97, rgb_t(0x00, 0xff, 0x00)); // green + palette.set_pen_color(98, rgb_t(0xf7, 0xaa, 0x00)); // amber + palette.set_pen_color(99, rgb_t(0xff, 0xff, 0xff)); // white +} diff --git a/src/mame/video/mc80.c b/src/mame/video/mc80.c new file mode 100644 index 00000000000..66f05dd8576 --- /dev/null +++ b/src/mame/video/mc80.c @@ -0,0 +1,173 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + MC-80.xx video by Miodrag Milanovic + + 15/05/2009 Initial implementation + 12/05/2009 Skeleton driver. + +****************************************************************************/ + +#include "includes/mc80.h" + +// This is not a content of U402 510 +// but order is fine + +static const UINT8 prom[] = { + 0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @ + 0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A + 0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B + 0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C + 0x1e,0x09,0x09,0x09,0x09,0x09,0x1e,0x00, // D + 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E + 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F + 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G + + 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H + 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I + 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J + 0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00, // K + 0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00, // L + 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M + 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N + 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O + + 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P + 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q + 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R + 0x0e,0x11,0x10,0x0e,0x01,0x11,0x0e,0x00, // S + 0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // T + 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U + 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V + 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W + + 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X + 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y + 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z + 0x1c,0x10,0x10,0x10,0x10,0x10,0x1c,0x00, // [ + 0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00, // backslash + 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ] + 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^ + 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _ + + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // + 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // ! + 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // " + 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // # + 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // [] + 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // % + 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // & + 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // ' + + 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // ( + 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // ) + 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // * + 0x00,0x04,0x04,0x1f,0x04,0x04,0x00,0x00, // + + 0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00, // , + 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // - + 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // . + 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // / + + 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0 + 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1 + 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2 + 0x1f,0x01,0x02,0x06,0x01,0x11,0x0e,0x00, // 3 + 0x02,0x06,0x0a,0x12,0x1f,0x02,0x02,0x00, // 4 + 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5 + 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6 + 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7 + + 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8 + 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9 + 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // : + 0x00,0x00,0x04,0x00,0x04,0x04,0x08,0x00, // ; + 0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00, // < + 0x00,0x00,0x1f,0x00,0x1f,0x00,0x00,0x00, // = + 0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00, // > + 0x0e,0x11,0x01,0x02,0x04,0x00,0x04,0x00 // ? +}; + +/*****************************************************************************/ +/* Implementation for MC80.2x */ +/*****************************************************************************/ + + + +VIDEO_START_MEMBER(mc80_state,mc8020) +{ +} + +UINT32 mc80_state::screen_update_mc8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + + for(y = 0; y < 8; y++ ) + { + for (ra = 0; ra < 16; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 32; x++) + { + if (ra > 3 && ra < 12) + { + chr = m_p_videoram[x]; + gfx = prom[(chr<<3) | (ra-4)]; + } + else + gfx = 0; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=32; + } + return 0; +} + +/*****************************************************************************/ +/* Implementation for MC80.3x */ +/*****************************************************************************/ + + +VIDEO_START_MEMBER(mc80_state,mc8030) +{ + m_p_videoram.set_target(memregion("vram")->base(),m_p_videoram.bytes()); +} + +UINT32 mc80_state::screen_update_mc8030(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 gfx; + UINT16 y=0,ma=0,x; + + for(y = 0; y < 256; y++ ) + { + UINT16 *p = &bitmap.pix16(y); + { + for (x = ma; x < ma + 64; x++) + { + gfx = m_p_videoram[x^0x3fff]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} diff --git a/src/mame/video/microtan.c b/src/mame/video/microtan.c new file mode 100644 index 00000000000..b6973e40fac --- /dev/null +++ b/src/mame/video/microtan.c @@ -0,0 +1,57 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/*************************************************************************** + * Microtan 65 + * + * video hardware + * + * Juergen Buchmueller , Jul 2000 + * + * Thanks go to Geoff Macdonald + * for his site http:://www.geo255.redhotant.com + * and to Fabrice Frances + * for his site http://www.ifrance.com/oric/microtan.html + * + ***************************************************************************/ + +#include "emu.h" +#include "includes/microtan.h" + + + + +WRITE8_MEMBER(microtan_state::microtan_videoram_w) +{ + UINT8 *videoram = m_videoram; + if ((videoram[offset] != data) || (m_chunky_buffer[offset] != m_chunky_graphics)) + { + videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); + m_chunky_buffer[offset] = m_chunky_graphics; + } +} + +TILE_GET_INFO_MEMBER(microtan_state::get_bg_tile_info) +{ + UINT8 *videoram = m_videoram; + int gfxn = m_chunky_buffer[tile_index]; + int code = videoram[tile_index]; + + SET_TILE_INFO_MEMBER(gfxn, code, 0, 0); +} + +void microtan_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(microtan_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, + 8, 16, 32, 16); + + m_chunky_buffer = auto_alloc_array(machine(), UINT8, 0x200); + memset(m_chunky_buffer, 0, 0x200); + m_chunky_graphics = 0; +} + +UINT32 microtan_state::screen_update_microtan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} diff --git a/src/mame/video/mikro80.c b/src/mame/video/mikro80.c new file mode 100644 index 00000000000..edab6f8cd06 --- /dev/null +++ b/src/mame/video/mikro80.c @@ -0,0 +1,40 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Mikro-80 video driver by Miodrag Milanovic + + 10/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/mikro80.h" + + +void mikro80_state::video_start() +{ +} + +UINT32 mikro80_state::screen_update_mikro80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *gfx = m_region_gfx1->base(); + int x,y,b; + + for(y = 0; y < 32*8; y++ ) + { + for(x = 0; x < 64; x++ ) + { + int addr = x + (y / 8)*64; + UINT8 code = gfx[m_video_ram [addr]*8+ (y % 8)]; + UINT8 attr = m_cursor_ram[addr+1] & 0x80 ? 1 : 0; + for (b = 7; b >= 0; b--) + { + UINT8 col = (code >> b) & 0x01; + bitmap.pix16(y, x*8+(7-b)) = attr ? col ^ 1 : col; + } + } + } + return 0; +} diff --git a/src/mame/video/mikromik.c b/src/mame/video/mikromik.c new file mode 100644 index 00000000000..e107a3c4421 --- /dev/null +++ b/src/mame/video/mikromik.c @@ -0,0 +1,126 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "includes/mikromik.h" + + + +//------------------------------------------------- +// i8275 crtc display pixels +//------------------------------------------------- + +I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels ) +{ + UINT8 romdata = m_char_rom->base()[(charcode << 4) | linecount]; + + int d0 = BIT(romdata, 0); + int d7 = BIT(romdata, 7); + int gpa0 = BIT(gpa, 0); + int llen = m_llen; + int i; + + UINT8 data = (romdata << 1) | (d7 & d0); + + for (i = 0; i < 8; i++) + { + int qh = BIT(data, i); + int video_in = ((((d7 & llen) | !vsp) & !gpa0) & qh) | lten; + int compl_in = rvv; + int hlt_in = hlgt; + + int color = hlt_in ? 2 : (video_in ^ compl_in); + + bitmap.pix32(y, x + i) = m_palette->pen(color); + } +} + + +//------------------------------------------------- +// ADDRESS_MAP( mm1_upd7220_map ) +//------------------------------------------------- + +static ADDRESS_MAP_START( mm1_upd7220_map, AS_0, 16, mm1_state ) + ADDRESS_MAP_GLOBAL_MASK(0x7fff) + AM_RANGE(0x0000, 0x7fff) AM_RAM AM_SHARE("video_ram") +ADDRESS_MAP_END + + +//------------------------------------------------- +// UPD7220_INTERFACE( hgdc_intf ) +//------------------------------------------------- + +UPD7220_DISPLAY_PIXELS_MEMBER( mm1_state::hgdc_display_pixels ) +{ + UINT16 data = m_video_ram[address >> 1]; + + for (int i = 0; i < 16; i++) + { + if (BIT(data, i)) bitmap.pix32(y, x + i) = m_palette->pen(1); + } +} + + +UINT32 mm1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + /* text */ + m_crtc->screen_update(screen, bitmap, cliprect); + + /* graphics */ + m_hgdc->screen_update(screen, bitmap, cliprect); + + return 0; +} + + +//------------------------------------------------- +// gfx_layout charlayout +//------------------------------------------------- + +static const gfx_layout charlayout = +{ + 8, 16, + RGN_FRAC(1,1), + 1, + { 0 }, + { 7, 6, 5, 4, 3, 2, 1, 0 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, + 8*16 +}; + + +//------------------------------------------------- +// GFXDECODE( mm1 ) +//------------------------------------------------- + +static GFXDECODE_START( mm1 ) + GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 1 ) +GFXDECODE_END + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( mm1m6_video ) +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( mm1m6_video ) + MCFG_SCREEN_ADD( SCREEN_TAG, RASTER ) + MCFG_SCREEN_REFRESH_RATE( 50 ) + MCFG_SCREEN_UPDATE_DRIVER(mm1_state, screen_update) + MCFG_SCREEN_SIZE( 800, 400 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 800-1, 0, 400-1 ) + //MCFG_SCREEN_RAW_PARAMS(XTAL_18_720MHz, ...) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", mm1) + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") + + MCFG_DEVICE_ADD(I8275_TAG, I8275, XTAL_18_720MHz/8) + MCFG_I8275_CHARACTER_WIDTH(8) + MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(mm1_state, crtc_display_pixels) + MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w)) + MCFG_I8275_VRTC_CALLBACK(DEVWRITELINE(UPD7220_TAG, upd7220_device, ext_sync_w)) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + + MCFG_DEVICE_ADD(UPD7220_TAG, UPD7220, XTAL_18_720MHz/8) + MCFG_DEVICE_ADDRESS_MAP(AS_0, mm1_upd7220_map) + MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mm1_state, hgdc_display_pixels) + MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) +MACHINE_CONFIG_END diff --git a/src/mame/video/mz700.c b/src/mame/video/mz700.c new file mode 100644 index 00000000000..b3f08dad1a3 --- /dev/null +++ b/src/mame/video/mz700.c @@ -0,0 +1,128 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Dirk Best +/*************************************************************************** + * Sharp MZ700 + * + * video hardware + * + * Juergen Buchmueller , Jul 2000 + * + * Reference: http://sharpmz.computingmuseum.com + * + ***************************************************************************/ + +#include "emu.h" +#include "includes/mz700.h" + + +#ifndef VERBOSE +#define VERBOSE 1 +#endif + +#define LOG(N,M,A) \ + do { \ + if(VERBOSE>=N) \ + { \ + if( M ) \ + logerror("%11.6f: %-24s",machine.time().as_double(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + + +PALETTE_INIT_MEMBER(mz_state, mz) +{ + int i; + + for (i = 0; i < 8; i++) + m_palette->set_indirect_color(i, rgb_t((i & 2) ? 0xff : 0x00, (i & 4) ? 0xff : 0x00, (i & 1) ? 0xff : 0x00)); + + for (i = 0; i < 256; i++) + { + m_palette->set_pen_indirect(i*2, i & 7); + m_palette->set_pen_indirect(i*2+1, (i >> 4) & 7); + } +} + + +UINT32 mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_videoram; + int offs; + + bitmap.fill(m_palette->black_pen(), cliprect); + + for(offs = 0; offs < 40*25; offs++) + { + int sx, sy, code, color; + + sy = (offs / 40) * 8; + sx = (offs % 40) * 8; + + color = m_colorram[offs]; + code = videoram[offs] | (color & 0x80) << 1; + + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code, color, 0, 0, sx, sy); + } + + return 0; +} + + +/*************************************************************************** + MZ-800 +***************************************************************************/ + +VIDEO_START_MEMBER(mz_state,mz800) +{ + m_gfxdecode->gfx(0)->set_source(m_cgram); +} + +UINT32 mz_state::screen_update_mz800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_videoram; + + bitmap.fill(m_palette->black_pen(), cliprect); + + if (m_mz700_mode) + return screen_update_mz700(screen, bitmap, cliprect); + else + { + if (m_hires_mode) + { + } + else + { + int x, y; + UINT8 *start_addr = videoram; + + for (x = 0; x < 40; x++) + { + for (y = 0; y < 200; y++) + { + bitmap.pix16(y, x * 8 + 0) = BIT(start_addr[x * 8 + y], 0); + bitmap.pix16(y, x * 8 + 1) = BIT(start_addr[x * 8 + y], 1); + bitmap.pix16(y, x * 8 + 2) = BIT(start_addr[x * 8 + y], 2); + bitmap.pix16(y, x * 8 + 3) = BIT(start_addr[x * 8 + y], 3); + bitmap.pix16(y, x * 8 + 4) = BIT(start_addr[x * 8 + y], 4); + bitmap.pix16(y, x * 8 + 5) = BIT(start_addr[x * 8 + y], 5); + bitmap.pix16(y, x * 8 + 6) = BIT(start_addr[x * 8 + y], 6); + bitmap.pix16(y, x * 8 + 7) = BIT(start_addr[x * 8 + y], 7); + } + } + } + + return 0; + } +} + +/*************************************************************************** + CGRAM +***************************************************************************/ + +WRITE8_MEMBER(mz_state::mz800_cgram_w) +{ + m_cgram[offset] = data; + + m_gfxdecode->gfx(0)->mark_dirty(offset/8); +} diff --git a/src/mame/video/mz80.c b/src/mame/video/mz80.c new file mode 100644 index 00000000000..d6bfa015c9c --- /dev/null +++ b/src/mame/video/mz80.c @@ -0,0 +1,143 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + MZ80 driver by Miodrag Milanovic + + 22/11/2008 Preliminary driver. + +****************************************************************************/ + +#include "includes/mz80.h" + +const gfx_layout mz80k_charlayout = +{ + 8, 8, /* 8x8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {0, 1, 2, 3, 4, 5, 6, 7}, + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, + 8*8 /* size of one char */ +}; + +const gfx_layout mz80kj_charlayout = +{ + 8, 8, /* 8x8 characters */ + 256, /* 256 characters + 256 blanks */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {7, 6, 5, 4, 3, 2, 1, 0}, + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, + 8*8 /* size of one char */ +}; + +/* Video hardware */ +void mz80_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); +} + +UINT32 mz80_state::screen_update_mz80k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_mz80k_vertical ^= 1; + m_mz80k_cursor_cnt++; + UINT8 y,ra,chr,gfx; + UINT16 x,sy=0,ma=0; + + for(y = 0; y < 25; y++ ) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 40; x++) + { + chr = m_p_videoram[x]; + gfx = m_p_chargen[(chr<<3) | ra]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=40; + } + return 0; +} + +// same as above except bits are in reverse order +UINT32 mz80_state::screen_update_mz80kj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_mz80k_vertical ^= 1; + m_mz80k_cursor_cnt++; + UINT8 y,ra,chr,gfx; + UINT16 x,sy=0,ma=0; + + for(y = 0; y < 25; y++ ) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 40; x++) + { + chr = m_p_videoram[x]; + gfx = m_p_chargen[(chr<<3) | ra]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 0); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 7); + } + } + ma+=40; + } + return 0; +} + +// has twice as much video ram and uses a scroll register +UINT32 mz80_state::screen_update_mz80a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_mz80k_vertical ^= 1; + m_mz80k_cursor_cnt++; + UINT8 y,ra,chr,gfx; + UINT16 x,sy=0, ma=m_p_ram[0x17d] | (m_p_ram[0x17e] << 8); + + for(y = 0; y < 25; y++ ) + { + for (ra = 0; ra < 8; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 40; x++) + { + chr = m_p_videoram[x&0x7ff]; + gfx = m_p_chargen[(chr<<3) | ra]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=40; + } + return 0; +} diff --git a/src/mame/video/nc.c b/src/mame/video/nc.c new file mode 100644 index 00000000000..934bfbfd3a3 --- /dev/null +++ b/src/mame/video/nc.c @@ -0,0 +1,120 @@ +// license:GPL-2.0+ +// copyright-holders:Wilbert Pol, Kevin Thacker +/*************************************************************************** + + nc.c + + Functions to emulate the video hardware of the Amstrad PCW. + +***************************************************************************/ + +#include "emu.h" +#include "includes/nc.h" +#include "machine/ram.h" + +/*************************************************************************** + Start the video hardware emulation. +***************************************************************************/ + +void nc_state::video_start() +{ +} + +#if 0 +/* two colours */ +static const unsigned short nc_colour_table[NC_NUM_COLOURS] = +{ + 0, 1,2,3 +}; +#endif + +/* black/white */ +static const rgb_t nc_palette[NC_NUM_COLOURS] = +{ + rgb_t(0x060, 0x060, 0x060), + rgb_t(0x000, 0x000, 0x000), + rgb_t(0x080, 0x0a0, 0x060), + rgb_t(0x000, 0x000, 0x000) +}; + + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(nc_state, nc) +{ + palette.set_pen_colors(0, nc_palette, ARRAY_LENGTH(nc_palette)); +} + + +void nc_state::nc200_video_set_backlight(int state) +{ + m_nc200_backlight = state; +} + + +/*************************************************************************** + Draw the game screen in the given bitmap_ind16. + Do NOT call osd_update_display() from this function, + it will be called by the main emulation engine. +***************************************************************************/ +UINT32 nc_state::screen_update_nc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int y; + int b; + int x; + int height, width; + int pens[2]; + + if (m_type==NC_TYPE_200) + { + height = NC200_SCREEN_HEIGHT; + width = NC200_SCREEN_WIDTH; + + if (m_nc200_backlight) + { + pens[0] = 2; + pens[1] = 3; + } + else + { + pens[0] = 0; + pens[1] = 1; + } + } + else + { + height = NC_SCREEN_HEIGHT; + width = NC_SCREEN_WIDTH; + pens[0] = 2; + pens[1] = 3; + } + + + for (y=0; ypointer()) + m_display_memory_start + (y<<6); + + x = 0; + for (by=0; by>3; by++) + { + int px; + unsigned char byte; + + byte = line_ptr[0]; + + px = x; + for (b=0; b<8; b++) + { + bitmap.pix16(y, px) = pens[(byte>>7) & 0x01]; + byte = byte<<1; + px++; + } + + x = px; + + line_ptr = line_ptr+1; + } + } + return 0; +} diff --git a/src/mame/video/nes.c b/src/mame/video/nes.c new file mode 100644 index 00000000000..077f4efe3a2 --- /dev/null +++ b/src/mame/video/nes.c @@ -0,0 +1,62 @@ +// license:BSD-3-Clause +// copyright-holders:Brad Oliver,Fabio Priuli +/*************************************************************************** + + video/nes.c + + Routines to control the unique NES video hardware/PPU. + +***************************************************************************/ + +#include "emu.h" +#include "includes/nes.h" + +void nes_state::video_reset() +{ + m_ppu->set_vidaccess_callback(ppu2c0x_vidaccess_delegate(FUNC(nes_state::nes_ppu_vidaccess),this)); +} + +void nes_state::video_start() +{ + m_last_frame_flip = 0; +} + +PALETTE_INIT_MEMBER(nes_state, nes) +{ + m_ppu->init_palette(palette, 0); +} + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +UINT32 nes_state::screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // render the ppu + m_ppu->render(bitmap, 0, 0, 0, 0); + + // if this is a disk system game, check for the flip-disk key + if ((m_cartslot && m_cartslot->exists() && (m_cartslot->get_pcb_id() == STD_DISKSYS)) // first scenario = disksys in m_cartslot (= famicom) + || m_disk) // second scenario = disk via fixed internal disk option (fds & famitwin) + { + if (m_io_disksel) + { + // latch this input so it doesn't go at warp speed + if ((m_io_disksel->read() & 0x01) && (!m_last_frame_flip)) + { + if (m_disk) + m_disk->disk_flip_side(); + else + m_cartslot->disk_flip_side(); + m_last_frame_flip = 1; + } + + if (!(m_io_disksel->read() & 0x01)) + m_last_frame_flip = 0; + } + } + return 0; +} diff --git a/src/mame/video/newbrain.c b/src/mame/video/newbrain.c new file mode 100644 index 00000000000..ae010c0b15c --- /dev/null +++ b/src/mame/video/newbrain.c @@ -0,0 +1,130 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "includes/newbrain.h" +#include "newbrain.lh" + +void newbrain_state::video_start() +{ + /* register for state saving */ + save_item(NAME(m_tvcnsl)); + save_item(NAME(m_tvctl)); + save_item(NAME(m_tvram)); + save_item(NAME(m_segment_data)); +} + +void newbrain_state::screen_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + int y, sx; + int columns = (m_tvctl & NEWBRAIN_VIDEO_80L) ? 80 : 40; + int excess = (m_tvctl & NEWBRAIN_VIDEO_32_40) ? 24 : 4; + int ucr = (m_tvctl & NEWBRAIN_VIDEO_UCR) ? 1 : 0; + int fs = (m_tvctl & NEWBRAIN_VIDEO_FS) ? 1 : 0; + int rv = (m_tvctl & NEWBRAIN_VIDEO_RV) ? 1 : 0; + int gr = 0; + + UINT16 videoram_addr = m_tvram; + UINT8 rc = 0; + + for (y = 0; y < 250; y++) + { + int x = 0; + + for (sx = 0; sx < columns; sx++) + { + int bit; + + UINT8 videoram_data = program.read_byte(videoram_addr + sx); + UINT8 charrom_data; + + if (gr) + { + /* render video ram data */ + charrom_data = videoram_data; + } + else + { + /* render character rom data */ + UINT16 charrom_addr = (rc << 8) | ((BIT(videoram_data, 7) & fs) << 7) | (videoram_data & 0x7f); + charrom_data = m_char_rom->base()[charrom_addr & 0xfff]; + + if ((videoram_data & 0x80) && !fs) + { + /* invert character */ + charrom_data ^= 0xff; + } + + if ((videoram_data & 0x60) && !ucr) + { + /* strip bit D0 */ + charrom_data &= 0xfe; + } + } + + for (bit = 0; bit < 8; bit++) + { + int color = BIT(charrom_data, 7) ^ rv; + + bitmap.pix32(y, x++) = m_palette->pen(color); + + if (columns == 40) + { + bitmap.pix32(y, x++) = m_palette->pen(color); + } + + charrom_data <<= 1; + } + } + + if (gr) + { + /* get new data for each line */ + videoram_addr += columns; + videoram_addr += excess; + } + else + { + /* increase row counter */ + rc++; + + if (rc == (ucr ? 8 : 10)) + { + /* reset row counter */ + rc = 0; + + videoram_addr += columns; + videoram_addr += excess; + } + } + } +} + +UINT32 newbrain_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (m_enrg1 & NEWBRAIN_ENRG1_TVP) + { + screen_update(bitmap, cliprect); + } + else + { + bitmap.fill(rgb_t::black, cliprect); + } + + return 0; +} + +/* Machine Drivers */ + +MACHINE_CONFIG_FRAGMENT( newbrain_video ) + MCFG_DEFAULT_LAYOUT(layout_newbrain) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(newbrain_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 250) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END diff --git a/src/mame/video/newport.c b/src/mame/video/newport.c new file mode 100644 index 00000000000..8d331fbb60f --- /dev/null +++ b/src/mame/video/newport.c @@ -0,0 +1,1667 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/* + SGI "Newport" graphics board used in the Indy and some Indigo2s + + Newport is modular, consisting of the following custom chips: + - REX3: Raster Engine, which is basically a blitter which can also draw antialiased lines. + REX also acts as the interface to the rest of the system - all the other chips on + a Newport board are accessed through it. + - RB2: Frame buffer input controller + - RO1: Frame buffer output controller + - XMAP9: Final display generator + - CMAP: Palette mapper + - VC2: Video timing controller / CRTC + + Taken from the Linux Newport driver, slave addresses for Newport devices are: + VC2 0 + Both CMAPs 1 + CMAP 0 2 + CMAP 1 3 + Both XMAPs 4 + XMAP 0 5 + XMAP 1 6 + RAMDAC 7 + VIDEO (CC1) 8 + VIDEO (AB1) 9 +*/ + +#include "emu.h" +#include "video/newport.h" + +#define VERBOSE_LEVEL ( 0 ) + +#if 0 +INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ... ) +{ + if( VERBOSE_LEVEL >= n_level ) + { + va_list v; + char buf[ 32768 ]; + va_start( v, s_fmt ); + vsprintf( buf, s_fmt, v ); + va_end( v ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); + } +} +#endif + +#define VC2_VIDENTRY m_VC2.nRegister[0x00] +#define VC2_CURENTRY m_VC2.nRegister[0x01] +#define VC2_CURSORX m_VC2.nRegister[0x02] +#define VC2_CURSORY m_VC2.nRegister[0x03] +#define VC2_CURCURSORX m_VC2.nRegister[0x04] +#define VC2_DIDENTRY m_VC2.nRegister[0x05] +#define VC2_SCANLINELEN m_VC2.nRegister[0x06] +#define VC2_RAMADDR m_VC2.nRegister[0x07] +#define VC2_VTFRAMEPTR m_VC2.nRegister[0x08] +#define VC2_VTLINEPTR m_VC2.nRegister[0x09] +#define VC2_VTLINERUN m_VC2.nRegister[0x0a] +#define VC2_VLINECNT m_VC2.nRegister[0x0b] +#define VC2_CURTABLEPTR m_VC2.nRegister[0x0c] +#define VC2_WORKCURSORY m_VC2.nRegister[0x0d] +#define VC2_DIDFRAMEPTR m_VC2.nRegister[0x0e] +#define VC2_DIDLINEPTR m_VC2.nRegister[0x0f] +#define VC2_DISPLAYCTRL m_VC2.nRegister[0x10] +#define VC2_CONFIG m_VC2.nRegister[0x1f] + +#define XMAP0_CONFIG m_XMAP0.nRegister[0x00] +#define XMAP0_REVISION m_XMAP0.nRegister[0x01] +#define XMAP0_ENTRIES m_XMAP0.nRegister[0x02] +#define XMAP0_CURCMAP m_XMAP0.nRegister[0x03] +#define XMAP0_POPUPCMAP m_XMAP0.nRegister[0x04] +#define XMAP0_MODETBLIDX m_XMAP0.nRegister[0x07] + +#define XMAP1_CONFIG m_XMAP1.nRegister[0x00] +#define XMAP1_REVISION m_XMAP1.nRegister[0x01] +#define XMAP1_ENTRIES m_XMAP1.nRegister[0x02] +#define XMAP1_CURCMAP m_XMAP1.nRegister[0x03] +#define XMAP1_POPUPCMAP m_XMAP1.nRegister[0x04] +#define XMAP1_MODETBLIDX m_XMAP1.nRegister[0x07] + + +const device_type NEWPORT_VIDEO = &device_creator; + + +newport_video_device::newport_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NEWPORT_VIDEO, "SGI Newport graphics board", tag, owner, clock, "newport_video", __FILE__) +{ +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void newport_video_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void newport_video_device::device_start() +{ + m_base = auto_alloc_array_clear(machine(), UINT32, (1280+64) * (1024+64)); + + save_pointer(NAME(m_base), (1280+64) * (1024+64)); + save_item(NAME(m_VC2.nRegister)); + save_item(NAME(m_VC2.nRAM)); + save_item(NAME(m_VC2.nRegIdx)); + save_item(NAME(m_VC2.nRegData)); + + save_item(NAME(m_XMAP0.nRegister)); + save_item(NAME(m_XMAP0.nModeTable)); + save_item(NAME(m_XMAP1.nRegister)); + save_item(NAME(m_XMAP1.nModeTable)); + + save_item(NAME(m_REX3.nDrawMode1)); + save_item(NAME(m_REX3.nDrawMode0)); + save_item(NAME(m_REX3.nLSMode)); + save_item(NAME(m_REX3.nLSPattern)); + save_item(NAME(m_REX3.nLSPatSave)); + save_item(NAME(m_REX3.nZPattern)); + save_item(NAME(m_REX3.nColorBack)); + save_item(NAME(m_REX3.nColorVRAM)); + save_item(NAME(m_REX3.nAlphaRef)); + save_item(NAME(m_REX3.nSMask0X)); + save_item(NAME(m_REX3.nSMask0Y)); + save_item(NAME(m_REX3.nSetup)); + save_item(NAME(m_REX3.nStepZ)); + save_item(NAME(m_REX3.nXStart)); + save_item(NAME(m_REX3.nYStart)); + save_item(NAME(m_REX3.nXEnd)); + save_item(NAME(m_REX3.nYEnd)); + + save_item(NAME(m_REX3.nXSave)); + save_item(NAME(m_REX3.nXYMove)); + save_item(NAME(m_REX3.nBresD)); + save_item(NAME(m_REX3.nBresS1)); + save_item(NAME(m_REX3.nBresOctInc1)); + save_item(NAME(m_REX3.nBresRndInc2)); + save_item(NAME(m_REX3.nBresE1)); + save_item(NAME(m_REX3.nBresS2)); + save_item(NAME(m_REX3.nAWeight0)); + save_item(NAME(m_REX3.nAWeight1)); + save_item(NAME(m_REX3.nXStartF)); + save_item(NAME(m_REX3.nYStartF)); + save_item(NAME(m_REX3.nXEndF)); + save_item(NAME(m_REX3.nYEndF)); + save_item(NAME(m_REX3.nXStartI)); + save_item(NAME(m_REX3.nXYStartI)); + save_item(NAME(m_REX3.nXYEndI)); + save_item(NAME(m_REX3.nXStartEndI)); + save_item(NAME(m_REX3.nColorRed)); + save_item(NAME(m_REX3.nColorAlpha)); + save_item(NAME(m_REX3.nColorGreen)); + save_item(NAME(m_REX3.nColorBlue)); + save_item(NAME(m_REX3.nSlopeRed)); + save_item(NAME(m_REX3.nSlopeAlpha)); + save_item(NAME(m_REX3.nSlopeGreen)); + save_item(NAME(m_REX3.nSlopeBlue)); + save_item(NAME(m_REX3.nWriteMask)); + save_item(NAME(m_REX3.nZeroFract)); + save_item(NAME(m_REX3.nZeroOverflow)); + save_item(NAME(m_REX3.nHostDataPortMSW)); + save_item(NAME(m_REX3.nHostDataPortLSW)); + save_item(NAME(m_REX3.nDCBMode)); + save_item(NAME(m_REX3.nDCBRegSelect)); + save_item(NAME(m_REX3.nDCBSlvSelect)); + save_item(NAME(m_REX3.nDCBDataMSW)); + save_item(NAME(m_REX3.nDCBDataLSW)); + save_item(NAME(m_REX3.nSMask1X)); + save_item(NAME(m_REX3.nSMask1Y)); + save_item(NAME(m_REX3.nSMask2X)); + save_item(NAME(m_REX3.nSMask2Y)); + save_item(NAME(m_REX3.nSMask3X)); + save_item(NAME(m_REX3.nSMask3Y)); + save_item(NAME(m_REX3.nSMask4X)); + save_item(NAME(m_REX3.nSMask4Y)); + save_item(NAME(m_REX3.nTopScanline)); + save_item(NAME(m_REX3.nXYWin)); + save_item(NAME(m_REX3.nClipMode)); + save_item(NAME(m_REX3.nConfig)); + save_item(NAME(m_REX3.nStatus)); + save_item(NAME(m_REX3.nXFerWidth)); +#if 0 + save_item(NAME(m_REX3.nCurrentX)); + save_item(NAME(m_REX3.nCurrentY)); +#endif + save_item(NAME(m_REX3.nKludge_SkipLine)); + + save_item(NAME(m_nDrawGreen)); + save_item(NAME(m_CMAP0.nPaletteIndex)); + save_item(NAME(m_CMAP0.nPalette)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void newport_video_device::device_reset() +{ + m_nDrawGreen = 0; + m_REX3.nDrawMode0 = 0x00000000; + m_REX3.nDrawMode1 = 0x3002f001; + m_REX3.nDCBMode = 0x00000780; + m_REX3.nKludge_SkipLine = 0; +} + + +UINT32 newport_video_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + /* loop over rows and copy to the destination */ + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + { + UINT32 *src = &m_base[1344 * y]; + UINT32 *dest = &bitmap.pix32(y, cliprect.min_x); + + /* loop over columns */ + for (int x = cliprect.min_x; x < cliprect.max_x; x++) + { + *dest++ = (*src++) & 0x00f8f8f8; + } + } + return 0; +} + + +WRITE32_MEMBER( newport_video_device::cmap0_w ) +{ + switch (m_REX3.nDCBRegSelect) + { + case 0x00: + //verboselog(machine(), 2, "CMAP0 Palette Index Write: %04x\n", data & 0x0000ffff ); + m_CMAP0.nPaletteIndex = data & 0x0000ffff; + break; + case 0x02: + //verboselog(machine(), 2, "CMAP0 Palette Entry %04x Write: %08x\n", m_CMAP0.nPaletteIndex, ( data >> 8 ) & 0x00ffffff ); + m_CMAP0.nPalette[m_CMAP0.nPaletteIndex] = ( data >> 8 ) & 0x00ffffff; + break; + default: + //verboselog(machine(), 2, "Unknown CMAP0 Register %d Write: %08x\n", m_REX3.nDCBRegSelect, data ); + break; + } +} + +READ32_MEMBER( newport_video_device::cmap0_r ) +{ + switch (m_REX3.nDCBRegSelect) + { + case 0x04: + //verboselog(machine(), 2, "CMAP0 Status Read: %08x\n", 0x00000008 ); + return 0x00000008; + case 0x06: /* Revision */ + //verboselog(machine(), 2, "CMAP0 Revision Read: CMAP Rev 1, Board Rev 2, 8bpp\n" ); + return 0x000000a1; + default: + //verboselog(machine(), 2, "Unknown CMAP0 Register %d Read\n", m_REX3.nDCBRegSelect ); + return 0x00000000; + } +} + +READ32_MEMBER( newport_video_device::cmap1_r ) +{ + switch (m_REX3.nDCBRegSelect) + { + case 0x04: + //verboselog(machine(), 2, "CMAP1 Status Read: %08x\n", 0x00000008 ); + return 0x00000008; + case 0x06: /* Revision */ + //verboselog(machine(), 2, "CMAP1 Revision Read: CMAP Rev 1, Board Rev 2, 8bpp\n" ); + return 0x000000a1; + default: + //verboselog(machine(), 2, "Unknown CMAP0 Register %d Read\n", m_REX3.nDCBRegSelect ); + return 0x00000000; + } +} + +READ32_MEMBER( newport_video_device::xmap0_r ) +{ + UINT8 nModeIdx; + + switch (m_REX3.nDCBRegSelect) + { + case 0: + //verboselog(machine(), 2, "XMAP0 Config Read: %08x\n", XMAP0_CONFIG ); + return XMAP0_CONFIG; + case 1: + //verboselog(machine(), 2, "XMAP0 Revision Read: %08x\n", 0x00 ); + return 0x00000000; + case 2: + //verboselog(machine(), 2, "XMAP0 FIFO Availability Read: %08x\n", 0x02 ); + return 0x00000002; + case 3: + //verboselog(machine(), 2, "XMAP0 Cursor CMAP MSB Read: %08x\n", XMAP0_CURCMAP ); + return XMAP0_CURCMAP; + case 4: + //verboselog(machine(), 2, "XMAP0 Pop Up CMAP MSB Read: %08x\n", XMAP0_POPUPCMAP ); + return XMAP0_POPUPCMAP; + case 5: + nModeIdx = ( XMAP0_MODETBLIDX & 0x0000007c ) >> 2; + switch (XMAP0_MODETBLIDX & 0x00000003) + { + case 0: + //verboselog(machine(), 2, "XMAP0 Mode Register Read: %02x (Byte 0): %08x\n", nModeIdx, ( m_XMAP0.nModeTable[ nModeIdx ] & 0x00ff0000 ) >> 16 ); + return ( m_XMAP0.nModeTable[ nModeIdx ] & 0x00ff0000 ) >> 16; + case 1: + //verboselog(machine(), 2, "XMAP0 Mode Register Read: %02x (Byte 1): %08x\n", nModeIdx, ( m_XMAP0.nModeTable[ nModeIdx ] & 0x0000ff00 ) >> 8 ); + return ( m_XMAP0.nModeTable[ nModeIdx ] & 0x0000ff00 ) >> 8; + case 2: + //verboselog(machine(), 2, "XMAP0 Mode Register Read: %02x (Byte 2): %08x\n", nModeIdx, ( m_XMAP0.nModeTable[ nModeIdx ] & 0x000000ff ) ); + return ( m_XMAP0.nModeTable[ nModeIdx ] & 0x000000ff ); + } + break; + case 6: + //verboselog(machine(), 2, "XMAP0 Unused Read: %08x\n", 0x00000000 ); + return 0x00000000; + case 7: + //verboselog(machine(), 2, "XMAP0 Mode Table Address Read: %08x\n", XMAP0_MODETBLIDX ); + return XMAP0_MODETBLIDX; + } + + //verboselog(machine(), 2, "XMAP0 Unknown m_REX3.nDCBRegSelect Value: %02x, returning 0\n", m_REX3.nDCBRegSelect ); + return 0x00000000; +} + +WRITE32_MEMBER( newport_video_device::xmap0_w ) +{ + UINT8 n8BitVal = data & 0x000000ff; + + switch (m_REX3.nDCBRegSelect) + { + case 0: + //verboselog(machine(), 2, "XMAP0 Config Write: %02x\n", n8BitVal ); + XMAP0_CONFIG = n8BitVal; + break; + case 1: + //verboselog(machine(), 2, "XMAP0 Revision Write (Ignored): %02x\n", n8BitVal ); + break; + case 2: + //verboselog(machine(), 2, "XMAP0 FIFO Availability Write (Ignored): %02x\n", n8BitVal ); + break; + case 3: + //verboselog(machine(), 2, "XMAP0 Cursor CMAP MSB Write: %02x\n", n8BitVal ); + XMAP0_CURCMAP = n8BitVal; + break; + case 4: + //verboselog(machine(), 2, "XMAP0 Pop Up CMAP MSB Write: %02x\n", n8BitVal ); + XMAP0_POPUPCMAP = n8BitVal; + break; + case 5: + //verboselog(machine(), 2, "XMAP0 Mode Register Write: %02x = %06x\n", ( data & 0xff000000 ) >> 24, data & 0x00ffffff ); + m_XMAP0.nModeTable[ ( data & 0xff000000 ) >> 24 ] = data & 0x00ffffff; + break; + case 6: + //verboselog(machine(), 2, "XMAP0 Unused Write (Ignored): %08x\n", data ); + break; + case 7: + //verboselog(machine(), 2, "XMAP0 Mode Table Address Write: %02x\n", n8BitVal ); + XMAP0_MODETBLIDX = n8BitVal; + break; + } +} + +READ32_MEMBER( newport_video_device::xmap1_r ) +{ + UINT8 nModeIdx; + + switch (m_REX3.nDCBRegSelect) + { + case 0: + //verboselog(machine(), 2, "XMAP1 Config Read: %08x\n", XMAP1_CONFIG ); + return XMAP1_CONFIG; + case 1: + //verboselog(machine(), 2, "XMAP1 Revision Read: %08x\n", 0x00 ); + return 0x00000000; + case 2: + //verboselog(machine(), 2, "XMAP1 FIFO Availability Read: %08x\n", 0x02 ); + return 0x00000002; + case 3: + //verboselog(machine(), 2, "XMAP1 Cursor CMAP MSB Read: %08x\n", XMAP1_CURCMAP ); + return XMAP1_CURCMAP; + case 4: + //verboselog(machine(), 2, "XMAP1 Pop Up CMAP MSB Read: %08x\n", XMAP1_POPUPCMAP ); + return XMAP1_POPUPCMAP; + case 5: + nModeIdx = ( XMAP1_MODETBLIDX & 0x0000007c ) >> 2; + switch (XMAP1_MODETBLIDX & 0x00000003) + { + case 0: + //verboselog(machine(), 2, "XMAP1 Mode Register Read: %02x (Byte 0): %08x\n", nModeIdx, ( m_XMAP1.nModeTable[ nModeIdx ] & 0x00ff0000 ) >> 16 ); + return ( m_XMAP1.nModeTable[ nModeIdx ] & 0x00ff0000 ) >> 16; + case 1: + //verboselog(machine(), 2, "XMAP1 Mode Register Read: %02x (Byte 1): %08x\n", nModeIdx, ( m_XMAP1.nModeTable[ nModeIdx ] & 0x0000ff00 ) >> 8 ); + return ( m_XMAP1.nModeTable[ nModeIdx ] & 0x0000ff00 ) >> 8; + case 2: + //verboselog(machine(), 2, "XMAP1 Mode Register Read: %02x (Byte 2): %08x\n", nModeIdx, ( m_XMAP1.nModeTable[ nModeIdx ] & 0x000000ff ) ); + return ( m_XMAP1.nModeTable[ nModeIdx ] & 0x000000ff ); + } + break; + case 6: + //verboselog(machine(), 2, "XMAP1 Unused Read: %08x\n", 0x00000000 ); + return 0x00000000; + case 7: + //verboselog(machine(), 2, "XMAP1 Mode Table Address Read: %08x\n", XMAP0_MODETBLIDX ); + return XMAP1_MODETBLIDX; + } + + //verboselog(machine(), 2, "XMAP1 Unknown m_REX3.nDCBRegSelect Value: %02x, returning 0\n", m_REX3.nDCBRegSelect ); + return 0x00000000; +} + +WRITE32_MEMBER( newport_video_device::xmap1_w ) +{ + UINT8 n8BitVal = data & 0x000000ff; + + switch (m_REX3.nDCBRegSelect) + { + case 0: + //verboselog(machine(), 2, "XMAP1 Config Write: %02x\n", n8BitVal ); + XMAP1_CONFIG = n8BitVal; + break; + case 1: + //verboselog(machine(), 2, "XMAP1 Revision Write (Ignored): %02x\n", n8BitVal ); + break; + case 2: + //verboselog(machine(), 2, "XMAP1 FIFO Availability Write (Ignored): %02x\n", n8BitVal ); + break; + case 3: + //verboselog(machine(), 2, "XMAP1 Cursor CMAP MSB Write: %02x\n", n8BitVal ); + XMAP1_CURCMAP = n8BitVal; + break; + case 4: + //verboselog(machine(), 2, "XMAP1 Pop Up CMAP MSB Write: %02x\n", n8BitVal ); + XMAP1_POPUPCMAP = n8BitVal; + break; + case 5: + //verboselog(machine(), 2, "XMAP1 Mode Register Write: %02x = %06x\n", ( data & 0xff000000 ) >> 24, data & 0x00ffffff ); + m_XMAP1.nModeTable[ ( data & 0xff000000 ) >> 24 ] = data & 0x00ffffff; + break; + case 6: + //verboselog(machine(), 2, "XMAP1 Unused Write (Ignored): %08x\n", data ); + break; + case 7: + //verboselog(machine(), 2, "XMAP1 Mode Table Address Write: %02x\n", n8BitVal ); + XMAP1_MODETBLIDX = n8BitVal; + break; + } +} + +READ32_MEMBER( newport_video_device::vc2_r ) +{ + UINT16 ret16; + + switch (m_REX3.nDCBRegSelect) + { + case 0x01: /* Register Read */ + //verboselog(machine(), 2, "VC2 Register Read: %02x, %08x\n", m_VC2.nRegIdx, m_VC2.nRegister[m_VC2.nRegIdx] ); + return m_VC2.nRegister[m_VC2.nRegIdx]; + case 0x03: /* RAM Read */ + //verboselog(machine(), 2, "VC2 RAM Read: %04x = %08x\n", VC2_RAMADDR, m_VC2.nRAM[VC2_RAMADDR] ); + ret16 = m_VC2.nRAM[VC2_RAMADDR]; + VC2_RAMADDR++; + if( VC2_RAMADDR == 0x8000 ) + { + VC2_RAMADDR = 0x0000; + } + return ret16; + default: + //verboselog(machine(), 2, "Unknown VC2 Register Read: %02x\n", m_REX3.nDCBRegSelect ); + return 0; + } +} + +WRITE32_MEMBER( newport_video_device::vc2_w ) +{ + switch (m_REX3.nXFerWidth) + { + case 0x01: /* Register Select */ + switch (m_REX3.nDCBRegSelect) + { + case 0x00: + m_VC2.nRegIdx = ( data & 0x000000ff ) >> 0; + //verboselog(machine(), 2, "VC2 Register Select: %02x\n", m_VC2.nRegIdx ); + break; + default: + //verboselog(machine(), 2, "Unknown VC2 Register Select: DCB Register %02x, data = 0x%08x\n", m_REX3.nDCBRegSelect, data ); + break; + } + break; + case 0x02: /* RAM Write */ + switch (m_REX3.nDCBRegSelect) + { + case 0x03: + //verboselog(machine(), 2, "VC2 RAM Write: %04x = %08x\n", VC2_RAMADDR, data & 0x0000ffff ); + m_VC2.nRAM[VC2_RAMADDR] = data & 0x0000ffff; + VC2_RAMADDR++; + if( VC2_RAMADDR == 0x8000 ) + { + VC2_RAMADDR = 0x0000; + } + break; + default: + //verboselog(machine(), 2, "Unknown 2-byte Write: DCB Register %02x, data = 0x%08x\n", m_REX3.nDCBRegSelect, data ); + break; + } + break; + case 0x03: /* Register Write */ + switch (m_REX3.nDCBRegSelect) + { + case 0x00: + //verboselog(machine(), 2, "VC2 Register Setup:\n" ); + m_VC2.nRegIdx = ( data & 0xff000000 ) >> 24; + m_VC2.nRegData = ( data & 0x00ffff00 ) >> 8; + switch( m_VC2.nRegIdx ) + { + case 0x00: + //verboselog(machine(), 2, " Video Entry Pointer: %04x\n", m_VC2.nRegData ); + break; + case 0x01: + //verboselog(machine(), 2, " Cursor Entry Pointer: %04x\n", m_VC2.nRegData ); + break; + case 0x02: + //verboselog(machine(), 2, " Cursor X Location: %04x\n", m_VC2.nRegData ); + break; + case 0x03: + //verboselog(machine(), 2, " Cursor Y Location: %04x\n", m_VC2.nRegData ); + break; + case 0x04: + //verboselog(machine(), 2, " Current Cursor X: %04x\n", m_VC2.nRegData ); + break; + case 0x05: + //verboselog(machine(), 2, " DID Entry Pointer: %04x\n", m_VC2.nRegData ); + break; + case 0x06: + //verboselog(machine(), 2, " Scanline Length: %04x\n", m_VC2.nRegData ); + break; + case 0x07: + //verboselog(machine(), 2, " RAM Address: %04x\n", m_VC2.nRegData ); + break; + case 0x08: + //verboselog(machine(), 2, " VT Frame Table Ptr: %04x\n", m_VC2.nRegData ); + break; + case 0x09: + //verboselog(machine(), 2, " VT Line Sequence Ptr: %04x\n", m_VC2.nRegData ); + break; + case 0x0a: + //verboselog(machine(), 2, " VT Lines in Run: %04x\n", m_VC2.nRegData ); + break; + case 0x0b: + //verboselog(machine(), 2, " Vertical Line Count: %04x\n", m_VC2.nRegData ); + break; + case 0x0c: + //verboselog(machine(), 2, " Cursor Table Ptr: %04x\n", m_VC2.nRegData ); + break; + case 0x0d: + //verboselog(machine(), 2, " Working Cursor Y: %04x\n", m_VC2.nRegData ); + break; + case 0x0e: + //verboselog(machine(), 2, " DID Frame Table Ptr: %04x\n", m_VC2.nRegData ); + break; + case 0x0f: + //verboselog(machine(), 2, " DID Line Table Ptr: %04x\n", m_VC2.nRegData ); + break; + case 0x10: + //verboselog(machine(), 2, " Display Control: %04x\n", m_VC2.nRegData ); + break; + case 0x1f: + //verboselog(machine(), 2, " Configuration: %04x\n", m_VC2.nRegData ); + m_VC2.nRegister[0x20] = m_VC2.nRegData; + break; + default: + //verboselog(machine(), 2, " Unknown VC2 Register: %04x\n", m_VC2.nRegData ); + break; + } + m_VC2.nRegister[m_VC2.nRegIdx] = m_VC2.nRegData; + break; + default: + //verboselog(machine(), 2, "Unknown VC2 Register Write: %02x = %08x\n", m_REX3.nDCBRegSelect, data ); + break; + } + break; + default: + //verboselog(machine(), 2, "Unknown VC2 XFer Width: Width %02x, DCB Register %02x, Value 0x%08x\n", m_REX3.nXFerWidth, m_REX3.nDCBRegSelect, data ); + break; + } +} + +READ32_MEMBER( newport_video_device::rex3_r ) +{ +// UINT32 nTemp; + +// if( offset >= ( 0x0800 / 4 ) ) +// { +// //verboselog(machine(), 2, "%08x:\n", 0xbf0f0000 + ( offset << 2 ) ); +// } + switch (offset) + { + case 0x0000/4: + case 0x0800/4: + //verboselog(machine(), 2, "REX3 Draw Mode 1 Read: %08x\n", m_REX3.nDrawMode1 ); + return m_REX3.nDrawMode1; + case 0x0004/4: + case 0x0804/4: + //verboselog(machine(), 2, "REX3 Draw Mode 0 Read: %08x\n", m_REX3.nDrawMode0 ); + return m_REX3.nDrawMode0; + case 0x0008/4: + case 0x0808/4: + //verboselog(machine(), 2, "REX3 Line Stipple Mode Read: %08x\n", m_REX3.nLSMode ); + return m_REX3.nLSMode; + case 0x000c/4: + case 0x080c/4: + //verboselog(machine(), 2, "REX3 Line Stipple Pattern Read: %08x\n", m_REX3.nLSPattern ); + return m_REX3.nLSPattern; + case 0x0010/4: + case 0x0810/4: + //verboselog(machine(), 2, "REX3 Line Stipple Pattern (Save) Read: %08x\n", m_REX3.nLSPatSave ); + return m_REX3.nLSPatSave; + case 0x0014/4: + case 0x0814/4: + //verboselog(machine(), 2, "REX3 Pattern Register Read: %08x\n", m_REX3.nZPattern ); + return m_REX3.nZPattern; + case 0x0018/4: + case 0x0818/4: + //verboselog(machine(), 2, "REX3 Opaque Pattern / Blendfunc Dest Color Read: %08x\n", m_REX3.nColorBack ); + return m_REX3.nColorBack; + case 0x001c/4: + case 0x081c/4: + //verboselog(machine(), 2, "REX3 VRAM Fastclear Color Read: %08x\n", m_REX3.nColorVRAM ); + return m_REX3.nColorVRAM; + case 0x0020/4: + case 0x0820/4: + //verboselog(machine(), 2, "REX3 AFUNCTION Reference Alpha Read: %08x\n", m_REX3.nAlphaRef ); + return m_REX3.nAlphaRef; + case 0x0028/4: + case 0x0828/4: + //verboselog(machine(), 2, "REX3 Screenmask 0 X Min/Max Read: %08x\n", m_REX3.nSMask0X ); + return m_REX3.nSMask0X; + case 0x002c/4: + case 0x082c/4: + //verboselog(machine(), 2, "REX3 Screenmask 0 Y Min/Max Read: %08x\n", m_REX3.nSMask0Y ); + return m_REX3.nSMask0Y; + case 0x0030/4: + case 0x0830/4: + //verboselog(machine(), 2, "REX3 Line/Span Setup Read: %08x\n", m_REX3.nSetup ); + return m_REX3.nSetup; + case 0x0034/4: + case 0x0834/4: + //verboselog(machine(), 2, "REX3 ZPattern Enable Read: %08x\n", m_REX3.nStepZ ); + return m_REX3.nStepZ; + case 0x0100/4: + case 0x0900/4: + //verboselog(machine(), 2, "REX3 X Start Read: %08x\n", m_REX3.nXStart ); + return m_REX3.nXStart; + case 0x0104/4: + case 0x0904/4: + //verboselog(machine(), 2, "REX3 YStart Read: %08x\n", m_REX3.nYStart ); + return m_REX3.nYStart; + case 0x0108/4: + case 0x0908/4: + //verboselog(machine(), 2, "REX3 XEnd Read: %08x\n", m_REX3.nXEnd ); + return m_REX3.nXEnd; + case 0x010c/4: + case 0x090c/4: + //verboselog(machine(), 2, "REX3 YEnd Read: %08x\n", m_REX3.nYEnd ); + return m_REX3.nYEnd; + case 0x0110/4: + case 0x0910/4: + //verboselog(machine(), 2, "REX3 XSave Read: %08x\n", m_REX3.nXSave ); + return m_REX3.nXSave; + case 0x0114/4: + case 0x0914/4: + //verboselog(machine(), 2, "REX3 XYMove Read: %08x\n", m_REX3.nXYMove ); + return m_REX3.nXYMove; + case 0x0118/4: + case 0x0918/4: + //verboselog(machine(), 2, "REX3 Bresenham D Read: %08x\n", m_REX3.nBresD ); + return m_REX3.nBresD; + case 0x011c/4: + case 0x091c/4: + //verboselog(machine(), 2, "REX3 Bresenham S1 Read: %08x\n", m_REX3.nBresS1 ); + return m_REX3.nBresS1; + case 0x0120/4: + case 0x0920/4: + //verboselog(machine(), 2, "REX3 Bresenham Octant & Incr1 Read: %08x\n", m_REX3.nBresOctInc1 ); + return m_REX3.nBresOctInc1; + case 0x0124/4: + case 0x0924/4: + //verboselog(machine(), 2, "REX3 Bresenham Octant Rounding Mode & Incr2 Read: %08x\n", m_REX3.nBresRndInc2 ); + return m_REX3.nBresRndInc2; + case 0x0128/4: + case 0x0928/4: + //verboselog(machine(), 2, "REX3 Bresenham E1 Read: %08x\n", m_REX3.nBresE1 ); + return m_REX3.nBresE1; + case 0x012c/4: + case 0x092c/4: + //verboselog(machine(), 2, "REX3 Bresenham S2 Read: %08x\n", m_REX3.nBresS2 ); + return m_REX3.nBresS2; + case 0x0130/4: + case 0x0930/4: + //verboselog(machine(), 2, "REX3 AA Line Weight Table 1/2 Read: %08x\n", m_REX3.nAWeight0 ); + return m_REX3.nAWeight0; + case 0x0134/4: + case 0x0934/4: + //verboselog(machine(), 2, "REX3 AA Line Weight Table 2/2 Read: %08x\n", m_REX3.nAWeight1 ); + return m_REX3.nAWeight1; + case 0x0138/4: + case 0x0938/4: + //verboselog(machine(), 2, "REX3 GL XStart Read: %08x\n", m_REX3.nXStartF ); + return m_REX3.nXStartF; + case 0x013c/4: + case 0x093c/4: + //verboselog(machine(), 2, "REX3 GL YStart Read: %08x\n", m_REX3.nYStartF ); + return m_REX3.nYStartF; + case 0x0140/4: + case 0x0940/4: + //verboselog(machine(), 2, "REX3 GL XEnd Read: %08x\n", m_REX3.nXEndF ); + return m_REX3.nXEndF; + case 0x0144/4: + case 0x0944/4: + //verboselog(machine(), 2, "REX3 GL YEnd Read: %08x\n", m_REX3.nYEndF ); + return m_REX3.nYEndF; + case 0x0148/4: + case 0x0948/4: + //verboselog(machine(), 2, "REX3 XStart (integer) Read: %08x\n", m_REX3.nXStartI ); + return m_REX3.nXStartI; + case 0x014c/4: + case 0x094c/4: + //verboselog(machine(), 2, "REX3 GL XEnd (copy) Read: %08x\n", m_REX3.nXEndF ); + return m_REX3.nXEndF; + case 0x0150/4: + case 0x0950/4: + //verboselog(machine(), 2, "REX3 XYStart (integer) Read: %08x\n", m_REX3.nXYStartI ); + return m_REX3.nXYStartI; + case 0x0154/4: + case 0x0954/4: + //verboselog(machine(), 2, "REX3 XYEnd (integer) Read: %08x\n", m_REX3.nXYEndI ); + return m_REX3.nXYEndI; + case 0x0158/4: + case 0x0958/4: + //verboselog(machine(), 2, "REX3 XStartEnd (integer) Read: %08x\n", m_REX3.nXStartEndI ); + return m_REX3.nXStartEndI; + case 0x0200/4: + case 0x0a00/4: + //verboselog(machine(), 2, "REX3 Red/CI Full State Read: %08x\n", m_REX3.nColorRed ); + return m_REX3.nColorRed; + case 0x0204/4: + case 0x0a04/4: + //verboselog(machine(), 2, "REX3 Alpha Full State Read: %08x\n", m_REX3.nColorAlpha ); + return m_REX3.nColorAlpha; + case 0x0208/4: + case 0x0a08/4: + //verboselog(machine(), 2, "REX3 Green Full State Read: %08x\n", m_REX3.nColorGreen ); + return m_REX3.nColorGreen; + case 0x020c/4: + case 0x0a0c/4: + //verboselog(machine(), 2, "REX3 Blue Full State Read: %08x\n", m_REX3.nColorBlue ); + return m_REX3.nColorBlue; + case 0x0210/4: + case 0x0a10/4: + //verboselog(machine(), 2, "REX3 Red/CI Slope Read: %08x\n", m_REX3.nSlopeRed ); + return m_REX3.nSlopeRed; + case 0x0214/4: + case 0x0a14/4: + //verboselog(machine(), 2, "REX3 Alpha Slope Read: %08x\n", m_REX3.nSlopeAlpha ); + return m_REX3.nSlopeAlpha; + case 0x0218/4: + case 0x0a18/4: + //verboselog(machine(), 2, "REX3 Green Slope Read: %08x\n", m_REX3.nSlopeGreen ); + return m_REX3.nSlopeGreen; + case 0x021c/4: + case 0x0a1c/4: + //verboselog(machine(), 2, "REX3 Blue Slope Read: %08x\n", m_REX3.nSlopeBlue ); + return m_REX3.nSlopeBlue; + case 0x0220/4: + case 0x0a20/4: + //verboselog(machine(), 2, "REX3 Write Mask Read: %08x\n", m_REX3.nWriteMask ); + return m_REX3.nWriteMask; + case 0x0224/4: + case 0x0a24/4: + //verboselog(machine(), 2, "REX3 Packed Color Fractions Read: %08x\n", m_REX3.nZeroFract ); + return m_REX3.nZeroFract; + case 0x0228/4: + case 0x0a28/4: + //verboselog(machine(), 2, "REX3 Color Index Zeros Overflow Read: %08x\n", m_REX3.nZeroOverflow ); + return m_REX3.nZeroOverflow; + case 0x022c/4: + case 0x0a2c/4: + //verboselog(machine(), 2, "REX3 Red/CI Slope (copy) Read: %08x\n", m_REX3.nSlopeRed ); + return m_REX3.nSlopeRed; + case 0x0230/4: + case 0x0a30/4: + //verboselog(machine(), 2, "REX3 Host Data Port MSW Read: %08x\n", m_REX3.nHostDataPortMSW ); + return m_REX3.nHostDataPortMSW; + case 0x0234/4: + case 0x0a34/4: + //verboselog(machine(), 2, "REX3 Host Data Port LSW Read: %08x\n", m_REX3.nHostDataPortLSW ); + return m_REX3.nHostDataPortLSW; + case 0x0238/4: + case 0x0a38/4: + //verboselog(machine(), 2, "REX3 Display Control Bus Mode Read: %08x\n", m_REX3.nDCBMode ); + return m_REX3.nDCBMode; + case 0x0240/4: + case 0x0a40/4: + switch (m_REX3.nDCBSlvSelect) + { + case 0x00: + return vc2_r(space, 0, mem_mask); + case 0x02: + return cmap0_r(space, 0, mem_mask); + case 0x03: + return cmap1_r(space, 0, mem_mask); + case 0x05: + return xmap0_r(space, 0, mem_mask); + case 0x06: + return xmap1_r(space, 0, mem_mask); + default: + //verboselog(machine(), 2, "REX3 Display Control Bus Data MSW Read: %08x\n", m_REX3.nDCBDataMSW ); + break; + } + return m_REX3.nDCBDataMSW; + case 0x0244/4: + case 0x0a44/4: + //verboselog(machine(), 2, "REX3 Display Control Bus Data LSW Read: %08x\n", m_REX3.nDCBDataLSW ); + return m_REX3.nDCBDataLSW; + case 0x1300/4: + //verboselog(machine(), 2, "REX3 Screenmask 1 X Min/Max Read: %08x\n", m_REX3.nSMask1X ); + return m_REX3.nSMask1X; + case 0x1304/4: + //verboselog(machine(), 2, "REX3 Screenmask 1 Y Min/Max Read: %08x\n", m_REX3.nSMask1Y ); + return m_REX3.nSMask1Y; + case 0x1308/4: + //verboselog(machine(), 2, "REX3 Screenmask 2 X Min/Max Read: %08x\n", m_REX3.nSMask2X ); + return m_REX3.nSMask2X; + case 0x130c/4: + //verboselog(machine(), 2, "REX3 Screenmask 2 Y Min/Max Read: %08x\n", m_REX3.nSMask2Y ); + return m_REX3.nSMask2Y; + case 0x1310/4: + //verboselog(machine(), 2, "REX3 Screenmask 3 X Min/Max Read: %08x\n", m_REX3.nSMask3X ); + return m_REX3.nSMask3X; + case 0x1314/4: + //verboselog(machine(), 2, "REX3 Screenmask 3 Y Min/Max Read: %08x\n", m_REX3.nSMask3Y ); + return m_REX3.nSMask3Y; + case 0x1318/4: + //verboselog(machine(), 2, "REX3 Screenmask 4 X Min/Max Read: %08x\n", m_REX3.nSMask4X ); + return m_REX3.nSMask4X; + case 0x131c/4: + //verboselog(machine(), 2, "REX3 Screenmask 4 Y Min/Max Read: %08x\n", m_REX3.nSMask4Y ); + return m_REX3.nSMask4Y; + case 0x1320/4: + //verboselog(machine(), 2, "REX3 Top of Screen Scanline Read: %08x\n", m_REX3.nTopScanline ); + return m_REX3.nTopScanline; + case 0x1324/4: + //verboselog(machine(), 2, "REX3 Clipping Mode Read: %08x\n", m_REX3.nXYWin ); + return m_REX3.nXYWin; + case 0x1328/4: + //verboselog(machine(), 2, "REX3 Clipping Mode Read: %08x\n", m_REX3.nClipMode ); + return m_REX3.nClipMode; + case 0x1330/4: + //verboselog(machine(), 2, "REX3 Config Read: %08x\n", m_REX3.nConfig ); + return m_REX3.nConfig; + case 0x1338/4: + //verboselog(machine(), 2, "REX3 Status Read: %08x\n", 0x00000001 ); +// nTemp = m_REX3.nStatus; + m_REX3.nStatus = 0; + return 0x00000001; + case 0x133c/4: + //verboselog(machine(), 2, "REX3 User Status Read: %08x\n", 0x00000001 ); + return 0x00000001; + default: + //verboselog(machine(), 2, "Unknown REX3 Read: %08x (%08x)\n", 0x1f0f0000 + ( offset << 2 ), mem_mask ); + return 0; + } +} + +void newport_video_device::DoREX3Command() +{ + UINT32 nCommand = ( ( m_REX3.nDrawMode0 & ( 1 << 15 ) ) >> 15 ) | + ( ( m_REX3.nDrawMode0 & ( 1 << 5 ) ) >> 4 ) | + ( ( m_REX3.nDrawMode0 & ( 1 << 9 ) ) >> 7 ) | + ( ( m_REX3.nDrawMode0 & ( 1 << 8 ) ) >> 5 ) | + ( ( m_REX3.nDrawMode0 & 0x0000001c ) << 2 ) | + ( ( m_REX3.nDrawMode0 & 0x00000003 ) << 7 ); + UINT16 nX, nY; + UINT16 nStartX = ( m_REX3.nXYStartI >> 16 ) & 0x0000ffff; + UINT16 nStartY = ( m_REX3.nXYStartI >> 0 ) & 0x0000ffff; + UINT16 nEndX = ( m_REX3.nXYEndI >> 16 ) & 0x0000ffff; + UINT16 nEndY = ( m_REX3.nXYEndI >> 0 ) & 0x0000ffff; + INT16 nMoveX, nMoveY; + + switch (nCommand) + { + case 0x00000110: + nX = nStartX; + nY = nStartY; + //verboselog(machine(), 3, "Tux Logo Draw: %04x, %04x = %08x\n", nX, nY, m_CMAP0.nPalette[ ( m_REX3.nHostDataPortMSW & 0xff000000 ) >> 24 ] ); +// m_REX3.nKludge_SkipLine = 1; + m_REX3.nBresOctInc1 = 0; + m_base[ nY*(1280+64) + nX ] = m_CMAP0.nPalette[ ( m_REX3.nHostDataPortMSW & 0xff000000 ) >> 24 ]; + nX++; + if( nX > ( ( m_REX3.nXYEndI & 0xffff0000 ) >> 16 ) ) + { + nY++; + nX = m_REX3.nXSave; + } + m_REX3.nXYStartI = ( nX << 16 ) | nY; + m_REX3.nXStartI = nX; + m_REX3.nXStart = 0 | ( ( m_REX3.nXYStartI & 0xffff0000 ) >> 5 ); + m_REX3.nYStart = 0 | ( ( m_REX3.nXYStartI & 0x0000ffff ) << 11 ); + break; + case 0x0000011e: + //verboselog(machine(), 3, "Block draw: %04x, %04x to %04x, %04x = %08x\n", nStartX, nStartY, nEndX, nEndY, m_CMAP0.nPalette[ m_REX3.nZeroFract ] ); + for( nY = nStartY; nY <= nEndY; nY++ ) + { + //verboselog(machine(), 3, "Pixel: %04x, %04x = %08x\n", nStartX, nY, m_CMAP0.nPalette[ m_REX3.nZeroFract ] ); + for( nX = nStartX; nX <= nEndX; nX++ ) + { + m_base[ nY*(1280+64) + nX ] = m_CMAP0.nPalette[ m_REX3.nZeroFract ]; + } + } + break; + case 0x00000119: + if( !m_REX3.nKludge_SkipLine ) + { + //verboselog(machine(), 3, "Pattern Line Draw: %08x at %04x, %04x color %08x\n", m_REX3.nZPattern, m_REX3.nXYStartI >> 16, m_REX3.nXYStartI & 0x0000ffff, m_CMAP0.nPalette[ m_REX3.nZeroFract ] ); + for( nX = nStartX; nX <= nEndX && nX < ( nStartX + 32 ); nX++ ) + { + if( m_REX3.nZPattern & ( 1 << ( 31 - ( nX - nStartX ) ) ) ) + { + m_base[ nStartY*(1280+64) + nX ] = m_CMAP0.nPalette[ m_REX3.nZeroFract ]; + } + } + if( m_REX3.nBresOctInc1 & 0x01000000 ) + { + nStartY--; + } + else + { + nStartY++; + } + m_REX3.nXYStartI = ( nStartX << 16 ) | nStartY; + m_REX3.nYStart = 0 | ( ( m_REX3.nXYStartI & 0x0000ffff ) << 11 ); + } + break; + case 0x0000019e: + nMoveX = (INT16)( ( m_REX3.nXYMove >> 16 ) & 0x0000ffff ); + nMoveY = (INT16)( m_REX3.nXYMove & 0x0000ffff ); + //verboselog(machine(), 1, "FB to FB Copy: %04x, %04x - %04x, %04x to %04x, %04x\n", nStartX, nStartY, nEndX, nEndY, nStartX + nMoveX, nStartY + nMoveY ); + for( nY = nStartY; nY <= nEndY; nY++ ) + { + for( nX = nStartX; nX <= nEndX; nX++ ) + { + m_base[ (nY + nMoveY)*(1280+64) + (nX + nMoveX) ] = m_base[ nY*(1280+64) + nX ]; + } + } + break; + default: + //verboselog(machine(), 1, "Unknown draw command: %08x\n", nCommand ); + break; + } +} + +WRITE32_MEMBER( newport_video_device::rex3_w ) +{ + UINT32 nTemp = 0; + + if( offset & 0x00000200 ) + { + //verboselog(machine(), 2, "Start Cmd\n" ); + } + switch( offset ) + { + case 0x0000/4: + case 0x0800/4: + //verboselog(machine(), 2, "REX3 Draw Mode 1 Write: %08x\n", data ); + switch( data & 0x00000007 ) + { + case 0x00: + //verboselog(machine(), 2, " Planes Enabled: None\n" ); + break; + case 0x01: + //verboselog(machine(), 2, " Planes Enabled: R/W RGB/CI\n" ); + break; + case 0x02: + //verboselog(machine(), 2, " Planes Enabled: R/W RGBA\n" ); + break; + case 0x03: + //verboselog(machine(), 2, " Planes Enabled: R/W OLAY\n" ); + break; + case 0x04: + //verboselog(machine(), 2, " Planes Enabled: R/W PUP\n" ); + break; + case 0x05: + //verboselog(machine(), 2, " Planes Enabled: R/W CID\n" ); + break; + default: + //verboselog(machine(), 2, " Unknown Plane Enable Value\n" ); + break; + } + switch( ( data & 0x00000018 ) >> 3 ) + { + case 0x00: + //verboselog(machine(), 2, " Plane Draw Depth: 4 bits\n" ); + break; + case 0x01: + //verboselog(machine(), 2, " Plane Draw Depth: 8 bits\n" ); + break; + case 0x02: + //verboselog(machine(), 2, " Plane Draw Depth: 12 bits\n" ); + break; + case 0x03: + //verboselog(machine(), 2, " Plane Draw Depth: 32 bits\n" ); + break; + } + //verboselog(machine(), 2, " DBuf Source Buffer: %d\n", ( data & 0x00000020 ) >> 5 ); + //verboselog(machine(), 2, " GL Y Coordinates: %d\n", ( data & 0x00000040 ) >> 6 ); + //verboselog(machine(), 2, " Enable Pxl Packing: %d\n", ( data & 0x00000080 ) >> 7 ); + switch( ( data & 0x00000300 ) >> 8 ) + { + case 0x00: + //verboselog(machine(), 2, " HOSTRW Depth: 4 bits\n" ); + break; + case 0x01: + //verboselog(machine(), 2, " HOSTRW Depth: 8 bits\n" ); + break; + case 0x02: + //verboselog(machine(), 2, " HOSTRW Depth: 12 bits\n" ); + break; + case 0x03: + //verboselog(machine(), 2, " HOSTRW Depth: 32 bits\n" ); + break; + } + //verboselog(machine(), 2, " DWord Transfers: %d\n", ( data & 0x00000400 ) >> 10 ); + //verboselog(machine(), 2, " Swap Endianness: %d\n", ( data & 0x00000800 ) >> 11 ); + //verboselog(machine(), 2, " Compare Src > Dest: %d\n", ( data & 0x00001000 ) >> 12 ); + //verboselog(machine(), 2, " Compare Src = Dest: %d\n", ( data & 0x00002000 ) >> 13 ); + //verboselog(machine(), 2, " Compare Src < Dest: %d\n", ( data & 0x00004000 ) >> 14 ); + //verboselog(machine(), 2, " RGB Mode Select: %d\n", ( data & 0x00008000 ) >> 15 ); + //verboselog(machine(), 2, " Enable Dithering: %d\n", ( data & 0x00010000 ) >> 16 ); + //verboselog(machine(), 2, " Enable Fast Clear: %d\n", ( data & 0x00020000 ) >> 17 ); + //verboselog(machine(), 2, " Enable Blending: %d\n", ( data & 0x00040000 ) >> 18 ); + switch( ( data & 0x00380000 ) >> 19 ) + { + case 0x00: + //verboselog(machine(), 2, " Src Blend Factor: 0\n" ); + break; + case 0x01: + //verboselog(machine(), 2, " Src Blend Factor: 1\n" ); + break; + case 0x02: + //verboselog(machine(), 2, " Src Blend Factor: Normalized Dest (or COLORBACK)\n" ); + break; + case 0x03: + //verboselog(machine(), 2, " Src Blend Factor: 1 - Normalized Dest (or COLORBACK)\n" ); + break; + case 0x04: + //verboselog(machine(), 2, " Src Blend Factor: Normalized Src\n" ); + break; + case 0x05: + //verboselog(machine(), 2, " Src Blend Factor: 1 - Normalized Src\n" ); + break; + default: + //verboselog(machine(), 2, " Unknown Src Blend Factor: %02x\n", ( data & 0x00380000 ) >> 19 ); + break; + } + switch( ( data & 0x01c00000 ) >> 22 ) + { + case 0x00: + //verboselog(machine(), 2, " Dest Blend Factor: 0\n" ); + break; + case 0x01: + //verboselog(machine(), 2, " Dest Blend Factor: 1\n" ); + break; + case 0x02: + //verboselog(machine(), 2, " Dest Blend Factor: Normalized Dest (or COLORBACK)\n" ); + break; + case 0x03: + //verboselog(machine(), 2, " Dest Blend Factor: 1 - Normalized Dest (or COLORBACK)\n" ); + break; + case 0x04: + //verboselog(machine(), 2, " Dest Blend Factor: Normalized Src\n" ); + break; + case 0x05: + //verboselog(machine(), 2, " Dest Blend Factor: 1 - Normalized Src\n" ); + break; + default: + //verboselog(machine(), 2, " Unknown Src Blend Factor: %02x\n", ( data & 0x00380000 ) >> 19 ); + break; + } + //verboselog(machine(), 2, " COLORBACK Dest Blend: %d\n", ( data & 0x02000000 ) >> 25 ); + //verboselog(machine(), 2, " Enable Pxl Prefetch: %d\n", ( data & 0x04000000 ) >> 26 ); + //verboselog(machine(), 2, " SFACTOR Src Alpha: %d\n", ( data & 0x08000000 ) >> 27 ); + switch( ( data & 0xf0000000 ) >> 28 ) + { + case 0x00: + //verboselog(machine(), 2, " Logical Op. Type: 0\n" ); + break; + case 0x01: + //verboselog(machine(), 2, " Logical Op. Type: Src & Dst\n" ); + break; + case 0x02: + //verboselog(machine(), 2, " Logical Op. Type: Src & ~Dst\n" ); + break; + case 0x03: + //verboselog(machine(), 2, " Logical Op. Type: Src\n" ); + break; + case 0x04: + //verboselog(machine(), 2, " Logical Op. Type: ~Src & Dst\n" ); + break; + case 0x05: + //verboselog(machine(), 2, " Logical Op. Type: Dst\n" ); + break; + case 0x06: + //verboselog(machine(), 2, " Logical Op. Type: Src ^ Dst\n" ); + break; + case 0x07: + //verboselog(machine(), 2, " Logical Op. Type: Src | Dst\n" ); + break; + case 0x08: + //verboselog(machine(), 2, " Logical Op. Type: ~(Src | Dst)\n" ); + break; + case 0x09: + //verboselog(machine(), 2, " Logical Op. Type: ~(Src ^ Dst)\n" ); + break; + case 0x0a: + //verboselog(machine(), 2, " Logical Op. Type: ~Dst\n" ); + break; + case 0x0b: + //verboselog(machine(), 2, " Logical Op. Type: Src | ~Dst\n" ); + break; + case 0x0c: + //verboselog(machine(), 2, " Logical Op. Type: ~Src\n" ); + break; + case 0x0d: + //verboselog(machine(), 2, " Logical Op. Type: ~Src | Dst\n" ); + break; + case 0x0e: + //verboselog(machine(), 2, " Logical Op. Type: ~(Src & Dst)\n" ); + break; + case 0x0f: + //verboselog(machine(), 2, " Logical Op. Type: 1\n" ); + break; + } + m_REX3.nDrawMode1 = data; +// if( offset >= ( 0x800 / 4 ) ) +// { +// DoREX3Command(); +// } + break; + case 0x0004/4: + //verboselog(machine(), 2, "REX3 Draw Mode 0 Write: %08x\n", data ); + switch( data & 0x00000003 ) + { + case 0x00: + //verboselog(machine(), 2, " Primitive Function: No Op\n" ); + break; + case 0x01: + //verboselog(machine(), 2, " Primitive Function: Read From FB\n" ); + break; + case 0x02: + //verboselog(machine(), 2, " Primitive Function: Draw To FB\n" ); + break; + case 0x03: + //verboselog(machine(), 2, " Primitive Function: Copy FB To FB\n" ); + break; + } + switch( ( data & 0x0000001c ) >> 2 ) + { + case 0x00: + //verboselog(machine(), 2, " Addressing Mode: Span/Point\n" ); + break; + case 0x01: + //verboselog(machine(), 2, " Addressing Mode: Block\n" ); + break; + case 0x02: + //verboselog(machine(), 2, " Addressing Mode: Bresenham Line, Integer Endpoints\n" ); + break; + case 0x03: + //verboselog(machine(), 2, " Addressing Mode: Bresenham Line, Fractional Endpoints\n" ); + break; + case 0x04: + //verboselog(machine(), 2, " Addressing Mode: AA Bresenham Line\n" ); + break; + default: + //verboselog(machine(), 2, " Unknown Addressing Mode: %02x\n", ( data & 0x0000001c ) >> 2 ); + break; + } + //verboselog(machine(), 2, " Iterator Setup: %d\n", ( data & 0x00000020 ) >> 5 ); + //verboselog(machine(), 2, " RGB/CI Draw Source: %d\n", ( data & 0x00000040 ) >> 6 ); + //verboselog(machine(), 2, " Alpha Draw Source: %d\n", ( data & 0x00000080 ) >> 7 ); + //verboselog(machine(), 2, " Stop On X: %d\n", ( data & 0x00000100 ) >> 8 ); + //verboselog(machine(), 2, " Stop On Y: %d\n", ( data & 0x00000200 ) >> 9 ); + //verboselog(machine(), 2, " Skip Start Point: %d\n", ( data & 0x00000400 ) >> 10 ); + //verboselog(machine(), 2, " Skip End Point: %d\n", ( data & 0x00000800 ) >> 11 ); + //verboselog(machine(), 2, " Enable Patterning: %d\n", ( data & 0x00001000 ) >> 12 ); + //verboselog(machine(), 2, " Enable Stippling: %d\n", ( data & 0x00002000 ) >> 13 ); + //verboselog(machine(), 2, " Stipple Advance: %d\n", ( data & 0x00004000 ) >> 14 ); + //verboselog(machine(), 2, " Limit Draw To 32px: %d\n", ( data & 0x00008000 ) >> 15 ); + //verboselog(machine(), 2, " Z Opaque Stipple %d\n", ( data & 0x00010000 ) >> 16 ); + //verboselog(machine(), 2, " LS Opaque Stipple: %d\n", ( data & 0x00020000 ) >> 17 ); + //verboselog(machine(), 2, " Enable Lin. Shade: %d\n", ( data & 0x00040000 ) >> 18 ); + //verboselog(machine(), 2, " Left-Right Only: %d\n", ( data & 0x00080000 ) >> 19 ); + //verboselog(machine(), 2, " Offset by XYMove: %d\n", ( data & 0x00100000 ) >> 20 ); + //verboselog(machine(), 2, " Enable CI Clamping: %d\n", ( data & 0x00200000 ) >> 21 ); + //verboselog(machine(), 2, " Enable End Filter: %d\n", ( data & 0x00400000 ) >> 22 ); + //verboselog(machine(), 2, " Enable Y+2 Stride: %d\n", ( data & 0x00800000 ) >> 23 ); + m_REX3.nDrawMode0 = data; + break; + case 0x0804/4: + //verboselog(machine(), 2, "REX3 Draw Mode 0 Write: %08x\n", data ); + m_REX3.nDrawMode0 = data; + break; + case 0x0008/4: + case 0x0808/4: + //verboselog(machine(), 2, "REX3 Line Stipple Mode Write: %08x\n", data ); + m_REX3.nLSMode = data & 0x0fffffff; + break; + case 0x000C/4: + case 0x080c/4: + //verboselog(machine(), 2, "REX3 Line Stipple Pattern Write: %08x\n", data ); + m_REX3.nLSPattern = data; + break; + case 0x0010/4: + case 0x0810/4: + //verboselog(machine(), 2, "REX3 Line Stipple Pattern (Save) Write: %08x\n", data ); + m_REX3.nLSPatSave = data; + break; + case 0x0014/4: + case 0x0814/4: + //verboselog(machine(), 2, "REX3 Pattern Register Write: %08x\n", data ); + m_REX3.nZPattern = data; + if (offset & 0x00000200) + { + DoREX3Command(); + } + break; + case 0x0018/4: + case 0x0818/4: + //verboselog(machine(), 2, "REX3 Opaque Pattern / Blendfunc Dest Color Write: %08x\n", data ); + m_REX3.nColorBack = data; + break; + case 0x001c/4: + case 0x081c/4: + //verboselog(machine(), 2, "REX3 VRAM Fastclear Color Write: %08x\n", data ); + m_REX3.nColorVRAM = data; + break; + case 0x0020/4: + case 0x0820/4: + //verboselog(machine(), 2, "REX3 AFUNCTION Reference Alpha Write: %08x\n", data ); + m_REX3.nAlphaRef = data & 0x000000ff; + break; + case 0x0024/4: + case 0x0824/4: + //verboselog(machine(), 2, "REX3 Stall GFIFO Write: %08x\n", data ); + break; + case 0x0028/4: + case 0x0828/4: + //verboselog(machine(), 2, "REX3 Screenmask 0 X Min/Max Write: %08x\n", data ); + m_REX3.nSMask0X = data; + break; + case 0x002c/4: + case 0x082c/4: + //verboselog(machine(), 2, "REX3 Screenmask 0 Y Min/Max Write: %08x\n", data ); + m_REX3.nSMask0Y = data; + break; + case 0x0030/4: + case 0x0830/4: + //verboselog(machine(), 2, "REX3 Line/Span Setup Write: %08x\n", data ); + m_REX3.nSetup = data; + break; + case 0x0034/4: + case 0x0834/4: + //verboselog(machine(), 2, "REX3 ZPattern Enable Write: %08x\n", data ); + m_REX3.nStepZ = data; + break; + case 0x0038/4: + case 0x0838/4: + //verboselog(machine(), 2, "REX3 Update LSPATTERN/LSRCOUNT\n" ); + m_REX3.nLSPattern = m_REX3.nLSPatSave; + break; + case 0x003c/4: + case 0x083c/4: + //verboselog(machine(), 2, "REX3 Update LSPATSAVE/LSRCNTSAVE\n" ); + m_REX3.nLSPatSave = m_REX3.nLSPattern; + break; + case 0x0100/4: + case 0x0900/4: + //verboselog(machine(), 2, "REX3 XStart Write: %08x\n", data ); + m_REX3.nXStart = data & ( 0x0000fffff << 7 ); + break; + case 0x0104/4: + case 0x0904/4: + //verboselog(machine(), 2, "REX3 YStart Write: %08x\n", data ); + m_REX3.nYStart = data & ( 0x0000fffff << 7 ); + break; + case 0x0108/4: + case 0x0908/4: + //verboselog(machine(), 2, "REX3 XEnd Write: %08x\n", data ); + m_REX3.nXEnd = data & ( 0x0000fffff << 7 ); + break; + case 0x010c/4: + case 0x090c/4: + //verboselog(machine(), 2, "REX3 YEnd Write: %08x\n", data ); + m_REX3.nYEnd = data & ( 0x0000fffff << 7 ); + break; + case 0x0110/4: + case 0x0910/4: + //verboselog(machine(), 2, "REX3 XSave Write: %08x\n", data ); + m_REX3.nXSave = data & 0x0000ffff; + m_REX3.nXStartI = m_REX3.nXSave & 0x0000ffff; + break; + case 0x0114/4: + case 0x0914/4: + //verboselog(machine(), 2, "REX3 XYMove Write: %08x\n", data ); + m_REX3.nXYMove = data; + if (offset & 0x00000200) + { + DoREX3Command(); + } + break; + case 0x0118/4: + case 0x0918/4: + //verboselog(machine(), 2, "REX3 Bresenham D Write: %08x\n", data ); + m_REX3.nBresD = data & 0x07ffffff; + break; + case 0x011c/4: + case 0x091c/4: + //verboselog(machine(), 2, "REX3 Bresenham S1 Write: %08x\n", data ); + m_REX3.nBresS1 = data & 0x0001ffff; + break; + case 0x0120/4: + case 0x0920/4: + //verboselog(machine(), 2, "REX3 Bresenham Octant & Incr1 Write: %08x\n", data ); + m_REX3.nBresOctInc1 = data & 0x070fffff; + break; + case 0x0124/4: + case 0x0924/4: + //verboselog(machine(), 2, "REX3 Bresenham Octant Rounding Mode & Incr2 Write: %08x\n", data ); + m_REX3.nBresRndInc2 = data & 0xff1fffff; + break; + case 0x0128/4: + case 0x0928/4: + //verboselog(machine(), 2, "REX3 Bresenham E1 Write: %08x\n", data ); + m_REX3.nBresE1 = data & 0x0000ffff; + break; + case 0x012c/4: + case 0x092c/4: + //verboselog(machine(), 2, "REX3 Bresenham S2 Write: %08x\n", data ); + m_REX3.nBresS2 = data & 0x03ffffff; + break; + case 0x0130/4: + case 0x0930/4: + //verboselog(machine(), 2, "REX3 AA Line Weight Table 1/2 Write: %08x\n", data ); + m_REX3.nAWeight0 = data; + break; + case 0x0134/4: + case 0x0934/4: + //verboselog(machine(), 2, "REX3 AA Line Weight Table 2/2 Write: %08x\n", data ); + m_REX3.nAWeight1 = data; + break; + case 0x0138/4: + case 0x0938/4: + //verboselog(machine(), 2, "REX3 GL XStart Write: %08x\n", data ); + m_REX3.nXStartF = data & ( 0x0000ffff << 7 ); + break; + case 0x013c/4: + case 0x093c/4: + //verboselog(machine(), 2, "REX3 GL YStart Write: %08x\n", data ); + m_REX3.nYStartF = data & ( 0x0000ffff << 7 ); + break; + case 0x0140/4: + case 0x0940/4: + //verboselog(machine(), 2, "REX3 GL XEnd Write: %08x\n", data ); + m_REX3.nXEndF = data & ( 0x0000ffff << 7 ); + break; + case 0x0144/4: + case 0x0944/4: + //verboselog(machine(), 2, "REX3 GL YEnd Write: %08x\n", data ); + m_REX3.nYEndF = data & ( 0x0000ffff << 7 ); + break; + case 0x0148/4: + case 0x0948/4: + //verboselog(machine(), 2, "REX3 XStart (integer) Write: %08x\n", data ); + m_REX3.nXStartI = data & 0x0000ffff; + m_REX3.nXSave = m_REX3.nXStartI; + m_REX3.nXStart = 0 | ( ( m_REX3.nXStartI & 0x0000ffff ) << 11 ); + break; + case 0x014c/4: + case 0x094c/4: + //verboselog(machine(), 2, "REX3 GL XEnd (copy) Write: %08x\n", data ); + m_REX3.nXEndF = data & ( 0x0000ffff << 7 ); + break; + case 0x0150/4: + case 0x0950/4: + //verboselog(machine(), 2, "REX3 XYStart (integer) Write: %08x\n", data ); + m_REX3.nXYStartI = data; + m_REX3.nXStartI = ( data & 0xffff0000 ) >> 16; + m_REX3.nXSave = m_REX3.nXStartI; + m_REX3.nXStart = 0 | ( ( m_REX3.nXYStartI & 0xffff0000 ) >> 5 ); + m_REX3.nYStart = 0 | ( ( m_REX3.nXYStartI & 0x0000ffff ) << 11 ); + break; + case 0x0154/4: + case 0x0954/4: + //verboselog(machine(), 2, "REX3 XYEnd (integer) Write: %08x\n", data ); + m_REX3.nXYEndI = data; + m_REX3.nXEnd = 0 | ( ( m_REX3.nXYEndI & 0xffff0000 ) >> 5 ); + m_REX3.nYEnd = 0 | ( ( m_REX3.nXYEndI & 0x0000ffff ) << 11 ); + if (offset & 0x00000200) + { + DoREX3Command(); + } + break; + case 0x0158/4: + case 0x0958/4: + //verboselog(machine(), 2, "REX3 XStartEnd (integer) Write: %08x\n", data ); + m_REX3.nXStartEndI = data; + m_REX3.nXYEndI = ( m_REX3.nXYEndI & 0x0000ffff ) | ( ( m_REX3.nXStartEndI & 0x0000ffff ) << 16 ); + m_REX3.nXYStartI = ( m_REX3.nXYStartI & 0x0000ffff ) | ( m_REX3.nXStartEndI & 0xffff0000 ); + m_REX3.nXSave = m_REX3.nXStartI; + m_REX3.nXStart = 0 | ( ( m_REX3.nXStartEndI & 0xffff0000 ) >> 5 ); + m_REX3.nXEnd = 0 | ( ( m_REX3.nXStartEndI & 0x0000ffff ) << 11 ); + break; + case 0x0200/4: + case 0x0a00/4: + //verboselog(machine(), 2, "REX3 Red/CI Full State Write: %08x\n", data ); + m_REX3.nColorRed = data & 0x00ffffff; + break; + case 0x0204/4: + case 0x0a04/4: + //verboselog(machine(), 2, "REX3 Alpha Full State Write: %08x\n", data ); + m_REX3.nColorAlpha = data & 0x000fffff; + break; + case 0x0208/4: + case 0x0a08/4: + //verboselog(machine(), 2, "REX3 Green Full State Write: %08x\n", data ); + m_REX3.nColorGreen = data & 0x000fffff; + break; + case 0x020c/4: + case 0x0a0c/4: + //verboselog(machine(), 2, "REX3 Blue Full State Write: %08x\n", data ); + m_REX3.nColorBlue = data & 0x000fffff; + break; + case 0x0210/4: + case 0x0a10/4: + //verboselog(machine(), 2, "REX3 Red/CI Slope Write: %08x\n", data ); + data &= 0x807fffff; + switch( data & 0x80000000 ) + { + case 0x00000000: + nTemp = data & 0x007fffff; + break; + case 0x80000000: + nTemp = 0x00800000 - ( data & 0x007fffff ); + nTemp |= 0x00800000; + break; + } + m_REX3.nSlopeRed = nTemp; + break; + case 0x0214/4: + case 0x0a14/4: + //verboselog(machine(), 2, "REX3 Alpha Slope Write: %08x\n", data ); + data &= 0x8007ffff; + switch( data & 0x80000000 ) + { + case 0x00000000: + nTemp = data & 0x0007ffff; + break; + case 0x80000000: + nTemp = 0x00080000 - ( data & 0x0007ffff ); + nTemp |= 0x00080000; + break; + } + m_REX3.nSlopeAlpha = nTemp; + break; + case 0x0218/4: + case 0x0a18/4: + //verboselog(machine(), 2, "REX3 Green Slope Write: %08x\n", data ); + data &= 0x8007ffff; + switch( data & 0x80000000 ) + { + case 0x00000000: + nTemp = data & 0x0007ffff; + break; + case 0x80000000: + nTemp = 0x00080000 - ( data & 0x0007ffff ); + nTemp |= 0x00080000; + break; + } + m_REX3.nSlopeGreen = nTemp; + break; + case 0x021c/4: + case 0x0a1c/4: + //verboselog(machine(), 2, "REX3 Blue Slope Write: %08x\n", data ); + data &= 0x8007ffff; + switch( data & 0x80000000 ) + { + case 0x00000000: + nTemp = data & 0x0007ffff; + break; + case 0x80000000: + nTemp = 0x00080000 - ( data & 0x0007ffff ); + nTemp |= 0x00080000; + break; + } + m_REX3.nSlopeBlue = nTemp; + break; + case 0x0220/4: + case 0x0a20/4: + //verboselog(machine(), 2, "REX3 Write Mask Write: %08x\n", data ); + m_REX3.nWriteMask = data & 0x00ffffff; + break; + case 0x0224/4: + case 0x0a24/4: + //verboselog(machine(), 2, "REX3 Packed Color Fractions Write: %08x\n", data ); + m_REX3.nZeroFract = data; + break; + case 0x0228/4: + case 0x0a28/4: + //verboselog(machine(), 2, "REX3 Color Index Zeros Overflow Write: %08x\n", data ); + m_REX3.nZeroOverflow = data; + break; + case 0x022c/4: + case 0x0a2c/4: + //verboselog(machine(), 2, "REX3 Red/CI Slope (copy) Write: %08x\n", data ); + m_REX3.nSlopeRed = data; + break; + case 0x0230/4: + case 0x0a30/4: + //verboselog(machine(), 3, "REX3 Host Data Port MSW Write: %08x\n", data ); + m_REX3.nHostDataPortMSW = data; + if (offset & 0x00000200) + { + DoREX3Command(); + } + break; + case 0x0234/4: + case 0x0a34/4: + //verboselog(machine(), 2, "REX3 Host Data Port LSW Write: %08x\n", data ); + m_REX3.nHostDataPortLSW = data; + break; + case 0x0238/4: + case 0x0a38/4: + //verboselog(machine(), 2, "REX3 Display Control Bus Mode Write: %08x\n", data ); + switch( data & 0x00000003 ) + { + case 0x00: + //verboselog(machine(), 2, " Transfer Width: 4 bytes\n" ); + m_REX3.nXFerWidth = 4; + break; + case 0x01: + //verboselog(machine(), 2, " Transfer Width: 1 bytes\n" ); + m_REX3.nXFerWidth = 1; + break; + case 0x02: + //verboselog(machine(), 2, " Transfer Width: 2 bytes\n" ); + m_REX3.nXFerWidth = 2; + break; + case 0x03: + //verboselog(machine(), 2, " Transfer Width: 3 bytes\n" ); + m_REX3.nXFerWidth = 3; + break; + } + //verboselog(machine(), 2, " DCB Reg Select Adr: %d\n", ( data & 0x00000070 ) >> 4 ); + //verboselog(machine(), 2, " DCB Slave Address: %d\n", ( data & 0x00000780 ) >> 7 ); +// //verboselog(machine(), 2, " Use Sync XFer ACK: %d\n", ( data & 0x00000800 ) >> 11 ); +// //verboselog(machine(), 2, " Use Async XFer ACK: %d\n", ( data & 0x00001000 ) >> 12 ); +// //verboselog(machine(), 2, " GIO CLK Cycle Width: %d\n", ( data & 0x0003e000 ) >> 13 ); +// //verboselog(machine(), 2, " GIO CLK Cycle Hold: %d\n", ( data & 0x007c0000 ) >> 18 ); +// //verboselog(machine(), 2, " GIO CLK Cycle Setup: %d\n", ( data & 0x0f800000 ) >> 23 ); +// //verboselog(machine(), 2, " Swap Byte Ordering: %d\n", ( data & 0x10000000 ) >> 28 ); + m_REX3.nDCBRegSelect = ( data & 0x00000070 ) >> 4; + m_REX3.nDCBSlvSelect = ( data & 0x00000780 ) >> 7; + m_REX3.nDCBMode = data & 0x1fffffff; + break; + case 0x0240/4: + case 0x0a40/4: + m_REX3.nDCBDataMSW = data; + switch( m_REX3.nDCBSlvSelect ) + { + case 0x00: + vc2_w(space, 0, data, mem_mask); + break; + case 0x01: + cmap0_w(space, 0, data, mem_mask); + break; + case 0x04: + xmap0_w(space, 0, data, mem_mask); + xmap1_w(space, 0, data, mem_mask); + break; + case 0x05: + xmap0_w(space, 0, data, mem_mask); + break; + case 0x06: + xmap1_w(space, 0, data, mem_mask); + break; + default: + //verboselog(machine(), 2, "REX3 Display Control Bus Data MSW Write: %08x\n", data ); + break; + } + break; + case 0x0244/4: + case 0x0a44/4: + //verboselog(machine(), 2, "REX3 Display Control Bus Data LSW Write: %08x\n", data ); + m_REX3.nDCBDataLSW = data; + break; + case 0x1300/4: + //verboselog(machine(), 2, "REX3 Screenmask 1 X Min/Max Write: %08x\n", data ); + m_REX3.nSMask1X = data; + break; + case 0x1304/4: + //verboselog(machine(), 2, "REX3 Screenmask 1 Y Min/Max Write: %08x\n", data ); + m_REX3.nSMask1Y = data; + break; + case 0x1308/4: + //verboselog(machine(), 2, "REX3 Screenmask 2 X Min/Max Write: %08x\n", data ); + m_REX3.nSMask2X = data; + break; + case 0x130c/4: + //verboselog(machine(), 2, "REX3 Screenmask 2 Y Min/Max Write: %08x\n", data ); + m_REX3.nSMask2Y = data; + break; + case 0x1310/4: + //verboselog(machine(), 2, "REX3 Screenmask 3 X Min/Max Write: %08x\n", data ); + m_REX3.nSMask3X = data; + break; + case 0x1314/4: + //verboselog(machine(), 2, "REX3 Screenmask 3 Y Min/Max Write: %08x\n", data ); + m_REX3.nSMask3Y = data; + break; + case 0x1318/4: + //verboselog(machine(), 2, "REX3 Screenmask 4 X Min/Max Write: %08x\n", data ); + m_REX3.nSMask4X = data; + break; + case 0x131c/4: + //verboselog(machine(), 2, "REX3 Screenmask 4 Y Min/Max Write: %08x\n", data ); + m_REX3.nSMask4Y = data; + break; + case 0x1320/4: + //verboselog(machine(), 2, "REX3 Top of Screen Scanline Write: %08x\n", data ); + m_REX3.nTopScanline = data & 0x000003ff; + break; + case 0x1324/4: + //verboselog(machine(), 2, "REX3 Clipping Mode Write: %08x\n", data ); + m_REX3.nXYWin = data; + break; + case 0x1328/4: + //verboselog(machine(), 2, "REX3 Clipping Mode Write: %08x\n", data ); + m_REX3.nClipMode = data & 0x00001fff; + break; + case 0x132c/4: + //verboselog(machine(), 2, "Request GFIFO Stall\n" ); + break; + case 0x1330/4: + //verboselog(machine(), 2, "REX3 Config Write: %08x\n", data ); + m_REX3.nConfig = data & 0x001fffff; + break; + case 0x1340/4: + //verboselog(machine(), 2, "Reset DCB Bus and Flush BFIFO\n" ); + break; + default: + //verboselog(machine(), 2, "Unknown REX3 Write: %08x (%08x): %08x\n", 0xbf0f0000 + ( offset << 2 ), mem_mask, data ); + break; + } +} diff --git a/src/mame/video/newport.h b/src/mame/video/newport.h new file mode 100644 index 00000000000..16ee86065fb --- /dev/null +++ b/src/mame/video/newport.h @@ -0,0 +1,163 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/* + SGI "Newport" graphics board used in the Indy and some Indigo2s + +*/ + +#ifndef __VIDHRDW_NEWPORT__ +#define __VIDHRDW_NEWPORT__ + +struct VC2_t +{ + UINT16 nRegister[0x21]; + UINT16 nRAM[0x8000]; + UINT8 nRegIdx; + UINT16 nRegData; +}; + + +struct XMAP_t +{ + UINT32 nRegister[0x08]; + UINT32 nModeTable[0x20]; +}; + +struct REX3_t +{ + UINT32 nDrawMode1; + UINT32 nDrawMode0; + UINT32 nLSMode; + UINT32 nLSPattern; + UINT32 nLSPatSave; + UINT32 nZPattern; + UINT32 nColorBack; + UINT32 nColorVRAM; + UINT32 nAlphaRef; + //UINT32 nStall0; + UINT32 nSMask0X; + UINT32 nSMask0Y; + UINT32 nSetup; + UINT32 nStepZ; + UINT32 nXStart; + UINT32 nYStart; + UINT32 nXEnd; + UINT32 nYEnd; + UINT32 nXSave; + UINT32 nXYMove; + UINT32 nBresD; + UINT32 nBresS1; + UINT32 nBresOctInc1; + UINT32 nBresRndInc2; + UINT32 nBresE1; + UINT32 nBresS2; + UINT32 nAWeight0; + UINT32 nAWeight1; + UINT32 nXStartF; + UINT32 nYStartF; + UINT32 nXEndF; + UINT32 nYEndF; + UINT32 nXStartI; + //UINT32 nYEndF1; + UINT32 nXYStartI; + UINT32 nXYEndI; + UINT32 nXStartEndI; + UINT32 nColorRed; + UINT32 nColorAlpha; + UINT32 nColorGreen; + UINT32 nColorBlue; + UINT32 nSlopeRed; + UINT32 nSlopeAlpha; + UINT32 nSlopeGreen; + UINT32 nSlopeBlue; + UINT32 nWriteMask; + UINT32 nZeroFract; + UINT32 nZeroOverflow; + //UINT32 nColorIndex; + UINT32 nHostDataPortMSW; + UINT32 nHostDataPortLSW; + UINT32 nDCBMode; + UINT32 nDCBRegSelect; + UINT32 nDCBSlvSelect; + UINT32 nDCBDataMSW; + UINT32 nDCBDataLSW; + UINT32 nSMask1X; + UINT32 nSMask1Y; + UINT32 nSMask2X; + UINT32 nSMask2Y; + UINT32 nSMask3X; + UINT32 nSMask3Y; + UINT32 nSMask4X; + UINT32 nSMask4Y; + UINT32 nTopScanline; + UINT32 nXYWin; + UINT32 nClipMode; + UINT32 nConfig; + UINT32 nStatus; + UINT8 nXFerWidth; +#if 0 + UINT32 nCurrentX; + UINT32 nCurrentY; +#endif + UINT32 nKludge_SkipLine; +}; + + +struct CMAP_t +{ + UINT16 nPaletteIndex; + UINT32 nPalette[0x10000]; +}; + + +class newport_video_device : public device_t +{ +public: + newport_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~newport_video_device() {} + + + DECLARE_READ32_MEMBER( rex3_r ); + DECLARE_WRITE32_MEMBER( rex3_w ); + + UINT32 screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + +private: + // internal state + + DECLARE_READ32_MEMBER( cmap0_r ); + DECLARE_WRITE32_MEMBER( cmap0_w ); + DECLARE_READ32_MEMBER( cmap1_r ); + DECLARE_READ32_MEMBER( xmap0_r ); + DECLARE_WRITE32_MEMBER( xmap0_w ); + DECLARE_READ32_MEMBER( xmap1_r ); + DECLARE_WRITE32_MEMBER( xmap1_w ); + DECLARE_READ32_MEMBER( vc2_r ); + DECLARE_WRITE32_MEMBER( vc2_w ); + void DoREX3Command(); + + VC2_t m_VC2; + XMAP_t m_XMAP0; + XMAP_t m_XMAP1; + REX3_t m_REX3; + UINT32 *m_base; + UINT8 m_nDrawGreen; + CMAP_t m_CMAP0; +}; + + + +#define MCFG_NEWPORT_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, NEWPORT_VIDEO, 0) + + +extern const device_type NEWPORT_VIDEO; + + +#endif diff --git a/src/mame/video/nick.c b/src/mame/video/nick.c new file mode 100644 index 00000000000..afb16ff815b --- /dev/null +++ b/src/mame/video/nick.c @@ -0,0 +1,1055 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Intelligent Designs NICK emulation + +**********************************************************************/ + +#include "nick.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + +/* colour mode types */ +#define NICK_2_COLOUR_MODE 0 +#define NICK_4_COLOUR_MODE 1 +#define NICK_16_COLOUR_MODE 2 +#define NICK_256_COLOUR_MODE 3 + +/* Display mode types */ +#define NICK_VSYNC_MODE 0 +#define NICK_PIXEL_MODE 1 +#define NICK_ATTR_MODE 2 +#define NICK_CH256_MODE 3 +#define NICK_CH128_MODE 4 +#define NICK_CH64_MODE 5 +#define NICK_UNUSED_MODE 6 +#define NICK_LPIXEL_MODE 7 + +/* MODEBYTE defines */ +#define NICK_MB_VIRQ (1<<7) +#define NICK_MB_VRES (1<<4) +#define NICK_MB_LPT_RELOAD (1<<0) + +/* Left margin defines */ +#define NICK_LM_MSBALT (1<<7) +#define NICK_LM_LSBALT (1<<6) + +/* Right margin defines */ +#define NICK_RM_ALTIND1 (1<<7) +#define NICK_RM_ALTIND0 (1<<6) + +/* useful macros */ +#define NICK_GET_LEFT_MARGIN(x) (x & 0x03f) +#define NICK_GET_RIGHT_MARGIN(x) (x & 0x03f) +#define NICK_GET_DISPLAY_MODE(x) ((x>>1) & 0x07) +#define NICK_GET_COLOUR_MODE(x) ((x>>5) & 0x03) + +#define NICK_RELOAD_LPT(x) (x & 0x080) +#define NICK_CLOCK_LPT(x) (x & 0x040) + +/* Macros to generate memory address is CHx modes */ +/* x = LD2, y = buf1 */ +#define ADDR_CH256(x,y) (((x & 0x0ff)<<8) | (y & 0x0ff)) +#define ADDR_CH128(x,y) (((x & 0x01ff)<<7) | (y & 0x07f)) +#define ADDR_CH64(x,y) (((x & 0x03ff)<<6) | (y & 0x03f)) + +/* No of highest resolution pixels per "clock" */ +#define NICK_PIXELS_PER_CLOCK 16 + +/* "clocks" per line */ +#define NICK_TOTAL_CLOCKS_PER_LINE 64 + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type NICK = &device_creator; + + +DEVICE_ADDRESS_MAP_START( vram_map, 8, nick_device ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(vram_r, vram_w) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START( vio_map, 8, nick_device ) + AM_RANGE(0x00, 0x00) AM_WRITE(fixbias_w) + AM_RANGE(0x01, 0x01) AM_WRITE(border_w) + AM_RANGE(0x02, 0x02) AM_WRITE(lpl_w) + AM_RANGE(0x03, 0x03) AM_WRITE(lph_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( nick_map, AS_0, 8, nick_device ) + AM_RANGE(0x0000, 0xffff) AM_RAM +ADDRESS_MAP_END + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// nick_device - constructor +//------------------------------------------------- + +nick_device::nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NICK, "NICK", tag, owner, clock, "nick", __FILE__), + device_memory_interface(mconfig, *this), + device_video_interface(mconfig, *this), + m_space_config("vram", ENDIANNESS_LITTLE, 8, 16, 0, *ADDRESS_MAP_NAME(nick_map)), + m_write_virq(*this), + horizontal_clock(0), + m_scanline_count(0), + m_FIXBIAS(0), + m_BORDER(0), + m_LPL(0), + m_LPH(0), + m_LD1(0), + m_LD2(0), + m_virq(CLEAR_LINE) +{ + memset(&m_LPT, 0x00, sizeof(m_LPT)); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void nick_device::device_start() +{ + m_screen->register_screen_bitmap(m_bitmap); + calc_visible_clocks(ENTERPRISE_SCREEN_WIDTH); + + // initialize palette + initialize_palette(); + + // resolve callbacks + m_write_virq.resolve_safe(); + + // allocate timers + m_timer_scanline = timer_alloc(); + m_timer_scanline->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->scan_period()); + + // state saving + save_item(NAME(m_scanline_count)); + save_item(NAME(m_FIXBIAS)); + save_item(NAME(m_BORDER)); + save_item(NAME(m_LPL)); + save_item(NAME(m_LPH)); + save_item(NAME(m_LD1)); + save_item(NAME(m_LD2)); + save_item(NAME(m_LPT.SC)); + save_item(NAME(m_LPT.MB)); + save_item(NAME(m_LPT.LM)); + save_item(NAME(m_LPT.RM)); + save_item(NAME(m_LPT.LD1L)); + save_item(NAME(m_LPT.LD1H)); + save_item(NAME(m_LPT.LD2L)); + save_item(NAME(m_LPT.LD2H)); + save_item(NAME(m_LPT.COL)); + save_item(NAME(m_dest_pos)); + save_item(NAME(m_dest_max_pos)); + save_item(NAME(m_reg)); + save_item(NAME(m_first_visible_clock)); + save_item(NAME(m_last_visible_clock)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void nick_device::device_reset() +{ + m_write_virq(CLEAR_LINE); + m_virq = 0; + + m_scanline_count = 0; +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void nick_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + int scanline = m_screen->vpos(); + + if (scanline < ENTERPRISE_SCREEN_HEIGHT) + { + /* set write address for line */ + m_dest = &m_bitmap.pix32(scanline); + m_dest_pos = 0; + m_dest_max_pos = m_bitmap.width(); + + /* write line */ + do_line(); + } +} + + +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *nick_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == 0) ? &m_space_config : NULL; +} + + +//------------------------------------------------- +// update_screen - update screen +//------------------------------------------------- + +UINT32 nick_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + + return 0; +} + + +//------------------------------------------------- +// vram_r - video RAM read +//------------------------------------------------- + +READ8_MEMBER( nick_device::vram_r ) +{ + return this->space().read_byte(offset); +} + + +//------------------------------------------------- +// vram_w - video RAM write +//------------------------------------------------- + +WRITE8_MEMBER( nick_device::vram_w ) +{ + this->space().write_byte(offset, data); +} + + +//------------------------------------------------- +// fixbias_w - +//------------------------------------------------- + +WRITE8_MEMBER( nick_device::fixbias_w ) +{ + m_FIXBIAS = data; +} + + +//------------------------------------------------- +// border_w - +//------------------------------------------------- + +WRITE8_MEMBER( nick_device::border_w ) +{ + m_BORDER = data; +} + + +//------------------------------------------------- +// lpl_w - +//------------------------------------------------- + +WRITE8_MEMBER( nick_device::lpl_w ) +{ + m_LPL = m_reg[2] = data; + + update_lpt(); +} + + +//------------------------------------------------- +// lph_w - +//------------------------------------------------- + +WRITE8_MEMBER( nick_device::lph_w ) +{ + m_LPH = m_reg[3] = data; + + update_lpt(); +} + + +//------------------------------------------------- +// initialize_palette - +//------------------------------------------------- + +void nick_device::initialize_palette() +{ + const int resistances_rg[] = { (int) RES_R(470), (int) RES_R(220), (int) RES_R(100) }; + const int resistances_b[] = { (int) RES_R(220), (int) RES_R(82) }; + + double color_weights_rg[3], color_weights_b[2]; + + compute_resistor_weights(0, 0xff, -1.0, + 3, resistances_rg, color_weights_rg, 0, 0, + 2, resistances_b, color_weights_b, 0, 0, + 0, 0, 0, 0, 0); + + for (int i = 0; i < 256; i++) + { + /* + + bit description + + PC0 100R -- RED + PC1 100R -- GREEN + PC2 82R -- BLUE + PC3 220R -- RED + PC4 220R -- GREEN + PC5 220R -- BLUE + PC6 470R -- RED + PC7 470R -- GREEN + + */ + + int ra = BIT(i, 0); + int rb = BIT(i, 3); + int rc = BIT(i, 6); + + int ga = BIT(i, 1); + int gb = BIT(i, 4); + int gc = BIT(i, 7); + + int ba = BIT(i, 2); + int bb = BIT(i, 5); + + UINT8 r = combine_3_weights(color_weights_rg, rc, rb, ra); + UINT8 g = combine_3_weights(color_weights_rg, gc, gb, ga); + UINT8 b = combine_2_weights(color_weights_b, bb, ba); + + m_palette[i] = rgb_t(r, g, b); + } + + for (int i = 0; i < 256; i++) + { + int pen_index; + + pen_index = (BIT(i, 7) << 0) | (BIT(i, 3) << 1); + m_pen_idx_4col[i] = pen_index; + + pen_index = (BIT(i, 7) << 0) | (BIT(i, 3) << 1) | (BIT(i, 5) << 2) | (BIT(i, 1) << 3); + m_pen_idx_16col[i] = pen_index; + } +} + +// MESS specific +/* 8-bit pixel write! */ +void nick_device::write_pixel(int ci) +{ + if (m_dest_pos < m_dest_max_pos) + { + m_dest[m_dest_pos++] = m_palette[ci]; + } +} + +/* we align based on the clocks */ +void nick_device::calc_visible_clocks(int width) +{ + /* number of clocks we can see */ + int no_visible_clocks = width / NICK_PIXELS_PER_CLOCK; + m_first_visible_clock = (NICK_TOTAL_CLOCKS_PER_LINE - no_visible_clocks) >> 1; + m_last_visible_clock = m_first_visible_clock + no_visible_clocks; +} + + +/* write border colour */ +void nick_device::write_border(int clocks) +{ + int col_index = m_BORDER; + + for (int i = 0; i < (clocks << 4); i++) + write_pixel(col_index); +} + + +void nick_device::do_left_margin() +{ + UINT8 left = NICK_GET_LEFT_MARGIN(m_LPT.LM); + + if (left > m_first_visible_clock) + { + /* some of the left margin is visible */ + UINT8 left_visible = left - m_first_visible_clock; + + /* render the border */ + write_border(left_visible); + } +} + +void nick_device::do_right_margin() +{ + UINT8 right = NICK_GET_RIGHT_MARGIN(m_LPT.RM); + + if (right < m_last_visible_clock) + { + /* some of the right margin is visible */ + UINT8 right_visible = m_last_visible_clock - right; + + /* render the border */ + write_border(right_visible); + } +} + +int nick_device::get_color_index(int pen_index) +{ + if (pen_index & 0x08) + return ((m_FIXBIAS & 0x01f) << 3) | (pen_index & 0x07); + else + return m_LPT.COL[pen_index]; +} + +void nick_device::write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte) +{ + int col_index[2]; + int pen_index; + UINT8 data = data_byte; + + col_index[0] = get_color_index(pen0); + col_index[1] = get_color_index(pen1); + + for (int i = 0; i < 8; i++) + { + pen_index = col_index[BIT(data, 7)]; + write_pixel(pen_index); + data <<= 1; + } +} + +void nick_device::write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte) +{ + int col_index[2]; + int pen_index; + UINT8 data = data_byte; + + col_index[0] = get_color_index(pen0); + col_index[1] = get_color_index(pen1); + + for (int i = 0; i < 8; i++) + { + pen_index = col_index[BIT(data, 7)]; + write_pixel(pen_index); + write_pixel(pen_index); + data <<= 1; + } +} + + +void nick_device::write_pixels(UINT8 data_byte, UINT8 char_idx) +{ + /* pen index colour 2-C (0,1), 4-C (0..3) 16-C (0..16) */ + int pen_idx; + /* Col index = EP colour value */ + int pal_idx; + UINT8 color_mode = NICK_GET_COLOUR_MODE(m_LPT.MB); + UINT8 data = data_byte; + + switch (color_mode) + { + case NICK_2_COLOUR_MODE: + { + int pen_offs = 0; + + /* do before displaying byte */ + + /* left margin attributes */ + if (m_LPT.LM & NICK_LM_MSBALT) + { + if (data & 0x080) + { + pen_offs |= 2; + } + + data &=~0x080; + } + + if (m_LPT.LM & NICK_LM_LSBALT) + { + if (data & 0x001) + { + pen_offs |= 4; + } + + data &=~0x01; + } + + if (m_LPT.RM & NICK_RM_ALTIND1) + { + if (char_idx & 0x080) + { + pen_offs |= 0x02; + } + } + +#if 0 + if (m_LPT.RM & NICK_RM_ALTIND0) + { + if (data & 0x040) + { + pen_offs |= 0x04; + } + } +#endif + + + write_pixels2color(pen_offs, (pen_offs | 0x01), data); + } + break; + + case NICK_4_COLOUR_MODE: + { + //osd_printf_info("4 colour\r\n"); + + /* left margin attributes */ + if (m_LPT.LM & NICK_LM_MSBALT) + { + data &= ~0x080; + } + + if (m_LPT.LM & NICK_LM_LSBALT) + { + data &= ~0x01; + } + + + for (int i = 0; i < 4; i++) + { + pen_idx = m_pen_idx_4col[data]; + pal_idx = m_LPT.COL[pen_idx & 0x03]; + + write_pixel(pal_idx); + write_pixel(pal_idx); + + data <<= 1; + } + } + break; + + case NICK_16_COLOUR_MODE: + { + //osd_printf_info("16 colour\r\n"); + + /* left margin attributes */ + if (m_LPT.LM & NICK_LM_MSBALT) + { + data &= ~0x080; + } + + if (m_LPT.LM & NICK_LM_LSBALT) + { + data &= ~0x01; + } + + + for (int i = 0; i < 2; i++) + { + pen_idx = m_pen_idx_16col[data]; + + pal_idx = get_color_index(pen_idx); + + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + + data <<= 1; + } + } + break; + + case NICK_256_COLOUR_MODE: + { + /* left margin attributes */ + if (m_LPT.LM & NICK_LM_MSBALT) + { + data &= ~0x080; + } + + if (m_LPT.LM & NICK_LM_LSBALT) + { + data &= ~0x01; + } + + + pal_idx = data; + + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + + + } + break; + } +} + +void nick_device::write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx) +{ + /* pen index colour 2-C (0,1), 4-C (0..3) 16-C (0..16) */ + int pen_idx; + /* Col index = EP colour value */ + int pal_idx; + UINT8 color_mode = NICK_GET_COLOUR_MODE(m_LPT.MB); + UINT8 data = data_byte; + + switch (color_mode) + { + case NICK_2_COLOUR_MODE: + { + int pen_offs = 0; + + /* do before displaying byte */ + + /* left margin attributes */ + if (m_LPT.LM & NICK_LM_MSBALT) + { + if (data & 0x080) + { + pen_offs |= 2; + } + + data &=~0x080; + } + + if (m_LPT.LM & NICK_LM_LSBALT) + { + if (data & 0x001) + { + pen_offs |= 4; + } + + data &=~0x01; + } + + if (m_LPT.RM & NICK_RM_ALTIND1) + { + if (char_idx & 0x080) + { + pen_offs |= 0x02; + } + } + +#if 0 + if (m_LPT.RM & NICK_RM_ALTIND0) + { + if (data & 0x040) + { + pen_offs |= 0x04; + } + } +#endif + + + write_pixels2color_lpixel(pen_offs, (pen_offs | 0x01), data); + } + break; + + case NICK_4_COLOUR_MODE: + { + //osd_printf_info("4 colour\r\n"); + + /* left margin attributes */ + if (m_LPT.LM & NICK_LM_MSBALT) + { + data &= ~0x080; + } + + if (m_LPT.LM & NICK_LM_LSBALT) + { + data &= ~0x01; + } + + + for (int i = 0; i < 4; i++) + { + pen_idx = m_pen_idx_4col[data]; + pal_idx = m_LPT.COL[pen_idx & 0x03]; + + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + + data <<= 1; + } + } + break; + + case NICK_16_COLOUR_MODE: + { + //osd_printf_info("16 colour\r\n"); + + /* left margin attributes */ + if (m_LPT.LM & NICK_LM_MSBALT) + { + data &= ~0x080; + } + + if (m_LPT.LM & NICK_LM_LSBALT) + { + data &= ~0x01; + } + + + for (int i = 0; i < 2; i++) + { + pen_idx = m_pen_idx_16col[data]; + pal_idx = get_color_index(pen_idx); + + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + + data <<= 1; + } + } + break; + + case NICK_256_COLOUR_MODE: + { + /* left margin attributes */ + if (m_LPT.LM & NICK_LM_MSBALT) + { + data &= ~0x080; + } + + if (m_LPT.LM & NICK_LM_LSBALT) + { + data &= ~0x01; + } + + + pal_idx = data; + + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + write_pixel(pal_idx); + + + } + break; + } +} + + +void nick_device::do_pixel(int clocks_visible) +{ + UINT8 buf1, buf2; + + for (int i = 0; i < clocks_visible; i++) + { + buf1 = space().read_byte(m_LD1); + m_LD1++; + + buf2 = space().read_byte(m_LD1); + m_LD1++; + + write_pixels(buf1, buf1); + write_pixels(buf2, buf1); + } +} + + +void nick_device::do_lpixel(int clocks_visible) +{ + UINT8 buf1; + + for (int i = 0; i < clocks_visible; i++) + { + buf1 = space().read_byte(m_LD1); + m_LD1++; + + write_pixels_lpixel(buf1, buf1); + } +} + +void nick_device::do_attr(int clocks_visible) +{ + UINT8 buf1, buf2; + + for (int i = 0; i < clocks_visible; i++) + { + buf1 = space().read_byte(m_LD1); + m_LD1++; + + buf2 = space().read_byte(m_LD2); + m_LD2++; + + { + UINT8 bg_color = ((buf1 >> 4) & 0x0f); + UINT8 fg_color = (buf1 & 0x0f); + + write_pixels2color_lpixel(bg_color, fg_color, buf2); + } + } +} + +void nick_device::do_ch256(int clocks_visible) +{ + UINT8 buf1, buf2; + + for (int i = 0; i < clocks_visible; i++) + { + buf1 = space().read_byte(m_LD1); + m_LD1++; + buf2 = space().read_byte(ADDR_CH256(m_LD2, buf1)); + + write_pixels_lpixel(buf2, buf1); + } +} + +void nick_device::do_ch128(int clocks_visible) +{ + UINT8 buf1, buf2; + + for (int i = 0; i < clocks_visible; i++) + { + buf1 = space().read_byte(m_LD1); + m_LD1++; + buf2 = space().read_byte(ADDR_CH128(m_LD2, buf1)); + + write_pixels_lpixel(buf2, buf1); + } +} + +void nick_device::do_ch64(int clocks_visible) +{ + UINT8 buf1, buf2; + + for (int i = 0; i < clocks_visible; i++) + { + buf1 = space().read_byte(m_LD1); + m_LD1++; + buf2 = space().read_byte(ADDR_CH64(m_LD2, buf1)); + + write_pixels_lpixel(buf2, buf1); + } +} + + +void nick_device::do_display() +{ + LPT_ENTRY *pLPT = &m_LPT; + UINT8 clocks_visible; + UINT8 right_margin = NICK_GET_RIGHT_MARGIN(pLPT->RM); + UINT8 left_margin = NICK_GET_LEFT_MARGIN(pLPT->LM); + + clocks_visible = right_margin - left_margin; + + if (clocks_visible) + { + /* get display mode */ + UINT8 display_mode = NICK_GET_DISPLAY_MODE(pLPT->MB); + + if (m_scanline_count == 0) // || + //((pLPT->MB & NICK_MB_VRES)==0)) + { + /* doing first line */ + /* reload LD1, and LD2 (if necessary) regardless of display mode */ + m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8); + + if ((display_mode != NICK_LPIXEL_MODE) && (display_mode != NICK_PIXEL_MODE)) + { + /* lpixel and pixel modes don't use LD2 */ + m_LD2 = (pLPT->LD2L & 0xff) | ((pLPT->LD2H & 0xff) << 8); + } + } + else + { + /* not first line */ + switch (display_mode) + { + case NICK_ATTR_MODE: + { + /* reload LD1 */ + m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8); + } + break; + + case NICK_CH256_MODE: + case NICK_CH128_MODE: + case NICK_CH64_MODE: + { + /* reload LD1 */ + m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8); + m_LD2++; + } + break; + + default: + break; + } + } + + switch (display_mode) + { + case NICK_PIXEL_MODE: + { + do_pixel(clocks_visible); + } + break; + + case NICK_ATTR_MODE: + { + //osd_printf_info("attr mode\r\n"); + do_attr(clocks_visible); + } + break; + + case NICK_CH256_MODE: + { + //osd_printf_info("ch256 mode\r\n"); + do_ch256(clocks_visible); + } + break; + + case NICK_CH128_MODE: + { + do_ch128(clocks_visible); + } + break; + + case NICK_CH64_MODE: + { + //osd_printf_info("ch64 mode\r\n"); + do_ch64(clocks_visible); + } + break; + + case NICK_LPIXEL_MODE: + { + do_lpixel(clocks_visible); + } + break; + + default: + break; + } + } +} + +void nick_device::update_lpt() +{ + UINT16 CurLPT = (m_LPL & 0x0ff) | ((m_LPH & 0x0f) << 8); + CurLPT++; + m_LPL = CurLPT & 0x0ff; + m_LPH = (m_LPH & 0x0f0) | ((CurLPT >> 8) & 0x0f); +} + + +void nick_device::reload_lpt() +{ + /* get addr of LPT */ + UINT32 LPT_Addr = ((m_LPL & 0x0ff) << 4) | ((m_LPH & 0x0f) << (8+4)); + + /* update internal LPT state */ + m_LPT.SC = space().read_byte(LPT_Addr); + m_LPT.MB = space().read_byte(LPT_Addr + 1); + m_LPT.LM = space().read_byte(LPT_Addr + 2); + m_LPT.RM = space().read_byte(LPT_Addr + 3); + m_LPT.LD1L = space().read_byte(LPT_Addr + 4); + m_LPT.LD1H = space().read_byte(LPT_Addr + 5); + m_LPT.LD2L = space().read_byte(LPT_Addr + 6); + m_LPT.LD2H = space().read_byte(LPT_Addr + 7); + m_LPT.COL[0] = space().read_byte(LPT_Addr + 8); + m_LPT.COL[1] = space().read_byte(LPT_Addr + 9); + m_LPT.COL[2] = space().read_byte(LPT_Addr + 10); + m_LPT.COL[3] = space().read_byte(LPT_Addr + 11); + m_LPT.COL[4] = space().read_byte(LPT_Addr + 12); + m_LPT.COL[5] = space().read_byte(LPT_Addr + 13); + m_LPT.COL[6] = space().read_byte(LPT_Addr + 14); + m_LPT.COL[7] = space().read_byte(LPT_Addr + 15); +} + +/* call here to render a line of graphics */ +void nick_device::do_line() +{ + UINT8 scanline; + + m_write_virq((m_LPT.MB & NICK_MB_VIRQ) ? ASSERT_LINE : CLEAR_LINE); + + if (m_virq && !(m_LPT.MB & NICK_MB_VIRQ)) + { + m_timer_scanline->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->scan_period()); + } + + m_virq = (m_LPT.MB & NICK_MB_VIRQ) ? 1 : 0; + + if ((m_LPT.MB & NICK_MB_LPT_RELOAD)!=0) + { + /* reload LPT */ + + m_LPL = m_reg[2]; + m_LPH = m_reg[3]; + + reload_lpt(); + } + + /* left border */ + do_left_margin(); + + /* do visible part */ + do_display(); + + /* right border */ + do_right_margin(); + + // 0x0f7 is first! + /* scan line count for this LPT */ + scanline = ((~m_LPT.SC) + 1) & 0x0ff; + + //printf("scanline %02x\r\n", scanline); + + /* update count of scanlines done so far */ + m_scanline_count++; + + if (m_scanline_count == scanline) + { + /* done all scanlines of this Line Parameter Table, get next */ + + m_scanline_count = 0; + + update_lpt(); + reload_lpt(); + } +} diff --git a/src/mame/video/nick.h b/src/mame/video/nick.h new file mode 100644 index 00000000000..738d202e2a7 --- /dev/null +++ b/src/mame/video/nick.h @@ -0,0 +1,178 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Intelligent Designs NICK emulation + +**********************************************************************/ + +#pragma once + +#ifndef __NICK__ +#define __NICK__ + +#include "emu.h" +#include "machine/rescap.h" +#include "video/resnet.h" + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_NICK_ADD(_tag, _screen_tag, _clock) \ + MCFG_SCREEN_ADD(_screen_tag, RASTER) \ + MCFG_SCREEN_REFRESH_RATE(50) \ + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) \ + MCFG_SCREEN_SIZE(ENTERPRISE_SCREEN_WIDTH, ENTERPRISE_SCREEN_HEIGHT) \ + MCFG_SCREEN_VISIBLE_AREA(0, ENTERPRISE_SCREEN_WIDTH-1, 0, ENTERPRISE_SCREEN_HEIGHT-1) \ + MCFG_SCREEN_UPDATE_DEVICE(_tag, nick_device, screen_update) \ + MCFG_DEVICE_ADD(_tag, NICK, _clock) \ + MCFG_VIDEO_SET_SCREEN(_screen_tag) + + +#define MCFG_NICK_VIRQ_CALLBACK(_write) \ + devcb = &nick_device::set_virq_wr_callback(*device, DEVCB_##_write); + + +/* there are 64us per line, although in reality + about 50 are visible. */ +#define ENTERPRISE_SCREEN_WIDTH (50*16) + +/* there are 312 lines per screen, although in reality + about 35*8 are visible */ +#define ENTERPRISE_SCREEN_HEIGHT (35*8) + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +/* Nick executes a Display list, in the form of a list of Line Parameter + Tables, this is the form of the data */ +struct LPT_ENTRY +{ + UINT8 SC; /* scanlines in this modeline (two's complement) */ + UINT8 MB; /* the MODEBYTE (defines video display mode) */ + UINT8 LM; /* left margin etc */ + UINT8 RM; /* right margin etc */ + UINT8 LD1L; /* (a7..a0) of line data pointer LD1 */ + UINT8 LD1H; /* (a8..a15) of line data pointer LD1 */ + UINT8 LD2L; /* (a7..a0) of line data pointer LD2 */ + UINT8 LD2H; /* (a8..a15) of line data pointer LD2 */ + UINT8 COL[8]; /* COL0..COL7 */ +}; + + +// ======================> nick_device + +class nick_device : public device_t, + public device_memory_interface, + public device_video_interface +{ +public: + // construction/destruction + nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_virq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_virq.set_callback(object); } + + virtual DECLARE_ADDRESS_MAP(vram_map, 8); + virtual DECLARE_ADDRESS_MAP(vio_map, 8); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + + DECLARE_READ8_MEMBER( vram_r ); + DECLARE_WRITE8_MEMBER( vram_w ); + + DECLARE_WRITE8_MEMBER( fixbias_w ); + DECLARE_WRITE8_MEMBER( border_w ); + DECLARE_WRITE8_MEMBER( lpl_w ); + DECLARE_WRITE8_MEMBER( lph_w ); + + address_space_config m_space_config; + +private: + devcb_write_line m_write_virq; + + void initialize_palette(); + + void write_pixel(int ci); + void calc_visible_clocks(int width); + void init(); + void write_border(int clocks); + void do_left_margin(); + void do_right_margin(); + + int get_color_index(int pen_index); + void write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte); + void write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte); + void write_pixels(UINT8 data_byte, UINT8 char_idx); + void write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx); + + void do_pixel(int clocks_visible); + void do_lpixel(int clocks_visible); + void do_attr(int clocks_visible); + void do_ch256(int clocks_visible); + void do_ch128(int clocks_visible); + void do_ch64(int clocks_visible); + void do_display(); + void update_lpt(); + void reload_lpt(); + void do_line(); + + /* horizontal position */ + UINT8 horizontal_clock; + /* current scanline within LPT */ + UINT8 m_scanline_count; + + UINT8 m_FIXBIAS; + UINT8 m_BORDER; + UINT8 m_LPL; + UINT8 m_LPH; + + UINT16 m_LD1; + UINT16 m_LD2; + + LPT_ENTRY m_LPT; + + UINT32 *m_dest; + int m_dest_pos; + int m_dest_max_pos; + + UINT8 m_reg[4]; + + /* first clock visible on left hand side */ + int m_first_visible_clock; + /* first clock visible on right hand side */ + int m_last_visible_clock; + + /* given a bit pattern, this will get the pen index */ + UINT8 m_pen_idx_4col[256]; + /* given a bit pattern, this will get the pen index */ + UINT8 m_pen_idx_16col[256]; + + int m_virq; + + bitmap_rgb32 m_bitmap; + rgb_t m_palette[256]; + + emu_timer *m_timer_scanline; +}; + + +// device type definition +extern const device_type NICK; + + + +#endif diff --git a/src/mame/video/ondra.c b/src/mame/video/ondra.c new file mode 100644 index 00000000000..c5112f4729e --- /dev/null +++ b/src/mame/video/ondra.c @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Ondra driver by Miodrag Milanovic + + 08/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/ondra.h" +#include "machine/ram.h" + + + +void ondra_state::video_start() +{ + m_video_enable = 0; +} + +UINT32 ondra_state::screen_update_ondra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code1,code2; + int y, x, b; + int Vaddr = 0x2800; + + if (m_video_enable==1) { + for (x = 0; x < 40; x++) + { + for (y = 127; y >=0; y--) + { + code1 = m_ram->pointer()[0xd700 + Vaddr + 0x80]; + code2 = m_ram->pointer()[0xd700 + Vaddr + 0x00]; + for (b = 0; b < 8; b++) + { + bitmap.pix16(2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; + bitmap.pix16(2*y+1, x*8+b) = ((code2 << b) & 0x80) ? 1 : 0; + } + Vaddr++; + } + Vaddr = (Vaddr - 128) - 256; + } + } + return 0; +} diff --git a/src/mame/video/orao.c b/src/mame/video/orao.c new file mode 100644 index 00000000000..a41f060af8d --- /dev/null +++ b/src/mame/video/orao.c @@ -0,0 +1,38 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Orao video driver by Miodrag Milanovic + + 01/03/2008 Updated to work with latest SVN code + 22/02/2008 Preliminary driver. + +****************************************************************************/ + +#include "emu.h" +#include "includes/orao.h" + +void orao_state::video_start() +{ +} + +UINT32 orao_state::screen_update_orao(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code; + int y, x, b; + + int addr = 0; + for (y = 0; y < 256; y++) + { + int horpos = 0; + for (x = 0; x < 32; x++) + { + code = m_video_ram[addr++]; + for (b = 0; b < 8; b++) + { + bitmap.pix16(y, horpos++) = (code >> b) & 0x01; + } + } + } + return 0; +} diff --git a/src/mame/video/orion.c b/src/mame/video/orion.c new file mode 100644 index 00000000000..241080684cf --- /dev/null +++ b/src/mame/video/orion.c @@ -0,0 +1,114 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Orion video driver by Miodrag Milanovic + + 22/04/2008 Orion Pro added + 02/04/2008 Preliminary driver. + +****************************************************************************/ + + +#include "emu.h" +#include "includes/orion.h" + +VIDEO_START_MEMBER(orion_state,orion128) +{ +} + +UINT32 orion_state::screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code1,code2,code3,code4,color,val; + int y, x,b; + int orionproshift = (m_orion128_video_mode & 0x10) ? 1 : 0; + int part1addr = (3-((m_orion128_video_page & 3) | orionproshift)) * 0x4000; + int part2addr = part1addr + 0x10000; + int video_mode = m_orion128_video_mode & m_video_mode_mask; + UINT8 *ram = m_ram->pointer(); + + for (x = 0; x < m_orion128_video_width; x++) + { + for (y = 0; y < 256; y++) + { + code1 = ram[part1addr + y + x*256]; + code2 = ram[part2addr + y + x*256]; + code3 = ram[part1addr + y + x*256 + 0x4000]; + code4 = ram[part2addr + y + x*256 + 0x4000]; + if ((video_mode==14) || (video_mode==15)) { + code2 = m_orionpro_pseudo_color; + } + color = 0; + for (b = 7; b >= 0; b--) + { + switch(m_orion128_video_mode & m_video_mode_mask) { + case 0 : color = ((code1 >> b) & 0x01) ? 10 : 0; break; + case 1 : color = ((code1 >> b) & 0x01) ? 17 : 16; break; + case 4 : val = (((code1 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); + switch(val) { + case 0 : color = 0; break; // black + case 1 : color = 4; break; // red + case 2 : color = 2; break; // green + case 3 : color = 1; break; // blue + } + break; + case 5 : val = (((code1 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); + switch(val) { + case 0 : color = 7; break; // white + case 1 : color = 4; break; // red + case 2 : color = 2; break; // green + case 3 : color = 1; break; // blue + } + break; + case 6 : + case 7 : + case 14 : + case 15 : + color = ((code1 >> b) & 0x01) ? (code2 & 0x0f) : (code2 >> 4); break; + + default: + switch(m_orion128_video_mode & m_video_mode_mask & 20) { + case 16 : + color = (((code1 >> b) & 0x01) << 2) + (((code3 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); + break; + case 20 : + color = (((code1 >> b) & 0x01) << 2) + (((code3 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); + if ((((code4 >> b) & 0x01)==1) && (color!=0)) { + color += 8; + } + break; + } + } + bitmap.pix16(y, x*8+(7-b)) = color; + } + } + } + + return 0; +} + +static const rgb_t orion128_palette[18] = { + rgb_t(0x00, 0x00, 0x00), // 0 + rgb_t(0x00, 0x00, 0xc0), // 1 + rgb_t(0x00, 0xc0, 0x00), // 2 + rgb_t(0x00, 0xc0, 0xc0), // 3 + rgb_t(0xc0, 0x00, 0x00), // 4 + rgb_t(0xc0, 0x00, 0xc0), // 5 + rgb_t(0xc0, 0xc0, 0x00), // 6 + rgb_t(0xc0, 0xc0, 0xc0), // 7 + rgb_t(0x80, 0x80, 0x80), // 8 + rgb_t(0x00, 0x00, 0xff), // 9 + rgb_t(0x00, 0xff, 0x00), // A + rgb_t(0x00, 0xff, 0xff), // B + rgb_t(0xff, 0x00, 0x00), // C + rgb_t(0xff, 0x00, 0xff), // D + rgb_t(0xff, 0xff, 0x00), // E + rgb_t(0xff, 0xff, 0xff), // F + rgb_t(0xc8, 0xb4, 0x28), // 10 + rgb_t(0x32, 0xfa, 0xfa) // 11 +}; + +PALETTE_INIT_MEMBER(orion_state,orion128 ) +{ + palette.set_pen_colors(0, orion128_palette, ARRAY_LENGTH(orion128_palette)); +} diff --git a/src/mame/video/osi.c b/src/mame/video/osi.c new file mode 100644 index 00000000000..94dd155454b --- /dev/null +++ b/src/mame/video/osi.c @@ -0,0 +1,180 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, Robbbert, Wilbert Pol +#include "includes/osi.h" + +/* Palette Initialization */ + +PALETTE_INIT_MEMBER(sb2m600_state, osi630) +{ + /* black and white */ + palette.set_pen_color(0, 0x00, 0x00, 0x00); // black + palette.set_pen_color(1, 0xff, 0xff, 0xff); // white + + /* color enabled */ + palette.set_pen_color(2, 0xff, 0xff, 0x00); // yellow + palette.set_pen_color(3, 0xff, 0x00, 0x00); // red + palette.set_pen_color(4, 0x00, 0xff, 0x00); // green + palette.set_pen_color(5, 0x00, 0x80, 0x00); // olive green + palette.set_pen_color(6, 0x00, 0x00, 0xff); // blue + palette.set_pen_color(7, 0xff, 0x00, 0xff); // purple + palette.set_pen_color(8, 0x00, 0x00, 0x80); // sky blue + palette.set_pen_color(9, 0x00, 0x00, 0x00); // black +} + +/* Video Start */ + +void sb2m600_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); + UINT16 addr; + + /* randomize video memory contents */ + for (addr = 0; addr < OSI600_VIDEORAM_SIZE; addr++) + m_video_ram[addr] = machine().rand() & 0xff; + + /* randomize color memory contents */ + if (m_color_ram) + for (addr = 0; addr < OSI630_COLORRAM_SIZE; addr++) + m_color_ram[addr] = machine().rand() & 0x0f; +} + +/* Video Update */ + +UINT32 sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int y, bit, sx; + + if (m_32) + { + for (y = 0; y < 256; y++) + { + UINT16 videoram_addr = (y >> 4) * 64; + int line = (y >> 1) & 0x07; + int x = 0; + + for (sx = 0; sx < 64; sx++) + { + UINT8 videoram_data = m_video_ram[videoram_addr]; + UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff; + UINT8 charrom_data = m_p_chargen[charrom_addr]; + + for (bit = 0; bit < 8; bit++) + { + bool color = BIT(charrom_data, 7); + + if (m_coloren) + { + UINT8 colorram_data = m_color_ram[videoram_addr]; + color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; + } + + bitmap.pix16(y, x++) = color; + + charrom_data <<= 1; + } + + videoram_addr++; + } + } + } + else + { + for (y = 0; y < 256; y++) + { + UINT16 videoram_addr = (y >> 3) * 32; + int line = y & 0x07; + int x = 0; + + for (sx = 0; sx < 32; sx++) + { + UINT8 videoram_data = m_video_ram[videoram_addr]; + UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff; + UINT8 charrom_data = m_p_chargen[charrom_addr]; + + for (bit = 0; bit < 8; bit++) + { + bool color = BIT(charrom_data, 7); + + if (m_coloren) + { + UINT8 colorram_data = m_color_ram[videoram_addr]; + color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; + } + + bitmap.pix16(y, x++) = color; + bitmap.pix16(y, x++) = color; + + charrom_data <<= 1; + } + + videoram_addr++; + } + } + } + + return 0; +} + +UINT32 uk101_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int y, bit, sx; + + for (y = 0; y < 256; y++) + { + UINT16 videoram_addr = (y >> 4) * 64; + int line = (y >> 1) & 0x07; + int x = 0; + + for (sx = 0; sx < 64; sx++) + { + UINT8 videoram_data = m_video_ram[videoram_addr++]; + UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff; + UINT8 charrom_data = m_p_chargen[charrom_addr]; + + for (bit = 0; bit < 8; bit++) + { + bitmap.pix16(y, x) = BIT(charrom_data, 7); + x++; + charrom_data <<= 1; + } + } + } + + return 0; +} + +/* Machine Drivers */ + +MACHINE_CONFIG_FRAGMENT( osi600_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(X1/256/256) // 60 Hz + MCFG_SCREEN_UPDATE_DRIVER(sb2m600_state, screen_update) + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 32*8-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( uk101_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DRIVER(uk101_state, screen_update) + MCFG_SCREEN_SIZE(64*8, 16*16) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( osi630_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_REFRESH_RATE(X1/256/256) // 60 Hz + MCFG_SCREEN_UPDATE_DRIVER(sb2m600_state, screen_update) + MCFG_SCREEN_SIZE(64*8, 16*16) + MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 8+2) + MCFG_PALETTE_INIT_OWNER(sb2m600_state, osi630) +MACHINE_CONFIG_END diff --git a/src/mame/video/p2000m.c b/src/mame/video/p2000m.c new file mode 100644 index 00000000000..a75a994fe28 --- /dev/null +++ b/src/mame/video/p2000m.c @@ -0,0 +1,60 @@ +// license:??? +// copyright-holders:Paul Daniels +/********************************************************************** + + p2000m.c + + Functions to emulate video hardware of the p2000m + +**********************************************************************/ + +#include "includes/p2000t.h" + + + + +VIDEO_START_MEMBER(p2000t_state,p2000m) +{ + m_frame_count = 0; +} + + +UINT32 p2000t_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_videoram; + int offs, sx, sy, code, loop; + + for (offs = 0; offs < 80 * 24; offs++) + { + sy = (offs / 80) * 20; + sx = (offs % 80) * 12; + + if ((m_frame_count > 25) && (videoram[offs + 2048] & 0x40)) + code = 32; + else + { + code = videoram[offs]; + if ((videoram[offs + 2048] & 0x01) && (code & 0x20)) + { + code += (code & 0x40) ? 64 : 96; + } else { + code &= 0x7f; + } + if (code < 32) code = 32; + } + + m_gfxdecode->gfx(0)->zoom_opaque(bitmap,cliprect, code, + videoram[offs + 2048] & 0x08 ? 0 : 1, 0, 0, sx, sy, 0x20000, 0x20000); + + if (videoram[offs] & 0x80) + { + for (loop = 0; loop < 12; loop++) + { + bitmap.pix16(sy + 18, sx + loop) = 0; /* cursor */ + bitmap.pix16(sy + 19, sx + loop) = 0; /* cursor */ + } + } + } + + return 0; +} diff --git a/src/mame/video/pc1251.c b/src/mame/video/pc1251.c new file mode 100644 index 00000000000..c891306600f --- /dev/null +++ b/src/mame/video/pc1251.c @@ -0,0 +1,163 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#include "emu.h" + +#include "includes/pocketc.h" +#include "includes/pc1251.h" + +static const POCKETC_FIGURE /*busy={ + "11 1 1 11 1 1", + "1 1 1 1 1 1 1", + "11 1 1 1 1 1", + "1 1 1 1 1 1", + "11 1 11 1e" +},*/ def={ + "11 111 111", + "1 1 1 1", + "1 1 111 11", + "1 1 1 1", + "11 111 1e" +}, shift={ + " 11 1 1 1 111 111", + "1 1 1 1 1 1", + " 1 111 1 11 1", + " 1 1 1 1 1 1", + "11 1 1 1 1 1e" +}, /*hyp={ + "1 1 1 1 11", + "1 1 1 1 1 1", + "111 1 1 11", + "1 1 1 1", + "1 1 1 1e" +},*/ de={ + "11 111", + "1 1 1", + "1 1 111", + "1 1 1", + "11 111e" +}, g={ + " 11", + "1", + "1 1", + "1 1", + " 11e" +}, rad={ + "11 1 11", + "1 1 1 1 1 1", + "11 111 1 1", + "1 1 1 1 1 1", + "1 1 1 1 11e" +}, /*braces={ + " 1 1", + "1 1", + "1 1", + "1 1", + " 1 1e" +}, m={ + "1 1", + "11 11", + "1 1 1", + "1 1", + "1 1e" +}, e={ + "111", + "1", + "111", + "1", + "111e" +},*/ run={ + "11 1 1 1 1", + "1 1 1 1 11 1", + "11 1 1 1 11", + "1 1 1 1 1 1", + "1 1 1 1 1e" +}, pro={ + "11 11 1 ", + "1 1 1 1 1 1", + "11 11 1 1", + "1 1 1 1 1", + "1 1 1 1e" +}, /*japan={ + " 1 1 11 1 1 1", + " 1 1 1 1 1 1 1 11 1", + " 1 111 11 111 1 11", + "1 1 1 1 1 1 1 1 1", + " 1 1 1 1 1 1 1 1e" +}, sml={ + " 11 1 1 1", + "1 111 1", + " 1 1 1 1", + " 1 1 1 1", + "11 1 1 111e" +},*/ rsv={ + "11 11 1 1", + "1 1 1 1 1", + "11 1 1 1", + "1 1 1 1 1", + "1 1 11 1e" +}; + +READ8_MEMBER(pc1251_state::pc1251_lcd_read) +{ + UINT8 data = m_reg[offset&0xff]; + logerror("pc1251 read %.3x %.2x\n",offset,data); + return data; +} + +WRITE8_MEMBER(pc1251_state::pc1251_lcd_write) +{ + logerror("pc1251 write %.3x %.2x\n",offset,data); + m_reg[offset&0xff] = data; +} + +#define DOWN 62 +#define RIGHT 68 + +UINT32 pc1251_state::screen_update_pc1251(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, i, j; + int color[2]; + + bitmap.fill(11, cliprect); + + /* HJB: we cannot initialize array with values from other arrays, thus... */ + color[0] = 7; //pocketc_colortable[PC1251_CONTRAST][0]; + color[1] = 8; //pocketc_colortable[PC1251_CONTRAST][1]; + + for (x=RIGHT,y=DOWN, i=0; i<60; x+=3) + { + for (j=0; j<5; j++, i++, x+=3) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i], + PC1251_CONTRAST,0,0, + x,y); + } + for (i=0x7b; i>=0x40; x+=3) + { + for (j=0; j<5; j++, i--, x+=3) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i], + PC1251_CONTRAST,0,0, + x,y); + } + + pocketc_draw_special(bitmap, RIGHT+134, DOWN-10, de, + m_reg[0x3c] & 0x08 ? color[1] : color[0]); + pocketc_draw_special(bitmap, RIGHT+142, DOWN-10, g, + m_reg[0x3c] & 0x04 ? color[1] : color[0]); + pocketc_draw_special(bitmap, RIGHT+146, DOWN-10, rad, + m_reg[0x3d] & 0x04 ? color[1] : color[0]); + pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, def, + m_reg[0x3c] & 0x01 ? color[1] : color[0]); + pocketc_draw_special(bitmap, RIGHT, DOWN-10, shift, + m_reg[0x3d] & 0x02 ? color[1] : color[0]); + pocketc_draw_special(bitmap, RIGHT+38, DOWN-10, pro, + m_reg[0x3e] & 0x01 ? color[1] : color[0]); + pocketc_draw_special(bitmap, RIGHT+53, DOWN-10, run, + m_reg[0x3e] & 0x02 ? color[1] : color[0]); + pocketc_draw_special(bitmap, RIGHT+68, DOWN-10, rsv, + m_reg[0x3e] & 0x04 ? color[1] : color[0]); + + /* 0x3c 1 def?, 4 g, 8 de + 0x3d 2 shift, 4 rad, 8 error + 0x3e 1 pro?, 2 run?, 4rsv?*/ + return 0; +} diff --git a/src/mame/video/pc1350.c b/src/mame/video/pc1350.c new file mode 100644 index 00000000000..0804f75ed7c --- /dev/null +++ b/src/mame/video/pc1350.c @@ -0,0 +1,165 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#include "emu.h" + +#include "includes/pocketc.h" +#include "includes/pc1350.h" + +static const POCKETC_FIGURE /*busy={ + "11 1 1 11 1 1", + "1 1 1 1 1 1 1", + "11 1 1 1 1 1", + "1 1 1 1 1 1", + "11 1 11 1e" +},*/ def={ + "11 111 111", + "1 1 1 1", + "1 1 111 11", + "1 1 1 1", + "11 111 1e" +}, shift={ + " 11 1 1 1 111 111", + "1 1 1 1 1 1", + " 1 111 1 11 1", + " 1 1 1 1 1 1", + "11 1 1 1 1 1e" +}, /*hyp={ + "1 1 1 1 11", + "1 1 1 1 1 1", + "111 1 1 11", + "1 1 1 1", + "1 1 1 1e" +}, de={ + "11 111", + "1 1 1", + "1 1 111", + "1 1 1", + "11 111e" +}, g={ + " 11", + "1", + "1 1", + "1 1", + " 11e" +}, rad={ + "11 1 11", + "1 1 1 1 1 1", + "11 111 1 1", + "1 1 1 1 1 1", + "1 1 1 1 11e" +}, braces={ + " 1 1", + "1 1", + "1 1", + "1 1", + " 1 1e" +}, m={ + "1 1", + "11 11", + "1 1 1", + "1 1", + "1 1e" +}, e={ + "111", + "1", + "111", + "1", + "111e" +},*/ run={ + "11 1 1 1 1", + "1 1 1 1 11 1", + "11 1 1 1 11", + "1 1 1 1 1 1", + "1 1 1 1 1e" +}, pro={ + "11 11 1 ", + "1 1 1 1 1 1", + "11 11 1 1", + "1 1 1 1 1", + "1 1 1 1e" +}, japan={ + " 1 1 11 1 1 1", + " 1 1 1 1 1 1 1 11 1", + " 1 111 11 111 1 11", + "1 1 1 1 1 1 1 1 1", + " 1 1 1 1 1 1 1 1e" +}, sml={ + " 11 1 1 1", + "1 111 1", + " 1 1 1 1", + " 1 1 1 1", + "11 1 1 111e" +}/*, rsv={ + "11 11 1 1", + "1 1 1 1 1", + "11 1 1 1", + "1 1 1 1 1", + "1 1 11 1e" +}*/; + +READ8_MEMBER(pc1350_state::pc1350_lcd_read) +{ + UINT8 data = m_reg[offset&0xfff]; + logerror("pc1350 read %.3x %.2x\n",offset,data); + return data; +} + +WRITE8_MEMBER(pc1350_state::pc1350_lcd_write) +{ + logerror("pc1350 write %.3x %.2x\n",offset,data); + m_reg[offset&0xfff] = data; +} + +READ8_MEMBER(pc1350_state::pc1350_keyboard_line_r) +{ + return m_reg[0xe00]; +} + +/* pc1350 + 24x4 5x8 no space between chars + 7000 .. 701d, 7200..721d, 7400 ..741d, 7600 ..761d, 7800 .. 781d + 7040 .. 705d, 7240..725d, 7440 ..745d, 7640 ..765d, 7840 .. 785d + 701e .. 703b, 721e..723b, 741e ..743b, 761e ..763b, 781e .. 783b + 705e .. 707b, 725e..727b, 745e ..747b, 765e ..767b, 785e .. 787b + 783c: 0 SHIFT 1 DEF 4 RUN 5 PRO 6 JAPAN 7 SML */ +static const int pc1350_addr[4]={ 0, 0x40, 0x1e, 0x5e }; + +#define DOWN 45 +#define RIGHT 76 + +UINT32 pc1350_state::screen_update_pc1350(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y=DOWN, i, j, k=0, b; + int color[4]; + bitmap.fill(11, cliprect); + + /* HJB: we cannot initialize array with values from other arrays, thus... */ + color[0] = pocketc_colortable[PC1350_CONTRAST][0]; + color[1] = pocketc_colortable[PC1350_CONTRAST][1]; + color[2] = 8; + color[3] = 7; + + for (k=0, y=DOWN; k<4; y+=16, k++) + for (x=RIGHT, i=pc1350_addr[k]; i<0xa00; i+=0x200) + for (j=0; j<=0x1d; j++, x+=2) + for (b = 0; b < 8; b++) + bitmap.plot_box(x, y + b * 2, 2, 2, color[(m_reg[j+i] >> b) & 1]); + + + /* 783c: 0 SHIFT 1 DEF 4 RUN 5 PRO 6 JAPAN 7 SML */ + /* I don't know how they really look like in the lcd */ + pocketc_draw_special(bitmap, RIGHT-30, DOWN+45, shift, + m_reg[0x83c] & 0x01 ? color[2] : color[3]); + pocketc_draw_special(bitmap, RIGHT-30, DOWN+55, def, + m_reg[0x83c] & 0x02 ? color[2] : color[3]); + pocketc_draw_special(bitmap, RIGHT-30, DOWN+5, run, + m_reg[0x83c] & 0x10 ? color[2] : color[3]); + pocketc_draw_special(bitmap, RIGHT-30, DOWN+15, pro, + m_reg[0x83c] & 0x20 ? color[2] : color[3]); + pocketc_draw_special(bitmap, RIGHT-30, DOWN+25, japan, + m_reg[0x83c] & 0x40 ? color[2] : color[3]); + pocketc_draw_special(bitmap, RIGHT-30, DOWN+35, sml, + m_reg[0x83c] & 0x80 ? color[2] : color[3]); + + return 0; +} diff --git a/src/mame/video/pc1401.c b/src/mame/video/pc1401.c new file mode 100644 index 00000000000..d7663dce91b --- /dev/null +++ b/src/mame/video/pc1401.c @@ -0,0 +1,213 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#include "emu.h" + +#include "includes/pocketc.h" +#include "includes/pc1401.h" + +/* pc140x + 16 5x7 with space between char + 6000 .. 6027, 6067.. 6040 + 603c: 3 STAT + 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 HYP, 4 PRO, 5 RUN, 6 CAL + 607c: 0 E, 1 M, 2 (), 3 RAD, 4 G, 5 DE, 6 PRINT */ + +/* pc1421 + 16 5x7 with space between char + 6000 .. 6027, 6067.. 6040 + 603c: 3 RUN + 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 BGN, 4 STAT, 5 FIN, 6 PRINT + 607c: 0 E, 1 M, 2 BAL, 3 INT, 4 PRN, 5 Sum-Sign, 6 PRO */ + +READ8_MEMBER(pc1401_state::pc1401_lcd_read) +{ + return m_reg[offset & 0xff]; +} + +WRITE8_MEMBER(pc1401_state::pc1401_lcd_write) +{ + m_reg[offset & 0xff]=data; +} + +static const POCKETC_FIGURE line={ /* simple line */ + "11111", + "11111", + "11111e" +}; +static const POCKETC_FIGURE busy={ + "11 1 1 11 1 1", + "1 1 1 1 1 1 1", + "11 1 1 1 1 1", + "1 1 1 1 1 1", + "11 1 11 1e" +}, def={ + "11 111 111", + "1 1 1 1", + "1 1 111 11", + "1 1 1 1", + "11 111 1e" +}, shift={ + " 11 1 1 1 111 111", + "1 1 1 1 1 1", + " 1 111 1 11 1", + " 1 1 1 1 1 1", + "11 1 1 1 1 1e" +}, hyp={ + "1 1 1 1 11", + "1 1 1 1 1 1", + "111 1 1 11", + "1 1 1 1", + "1 1 1 1e" +}, de={ + "11 111", + "1 1 1", + "1 1 111", + "1 1 1", + "11 111e" +}, g={ + " 11", + "1", + "1 1", + "1 1", + " 11e" +}, rad={ + "11 1 11", + "1 1 1 1 1 1", + "11 111 1 1", + "1 1 1 1 1 1", + "1 1 1 1 11e" +}, braces={ + " 1 1", + "1 1", + "1 1", + "1 1", + " 1 1e" +}, m={ + "1 1", + "11 11", + "1 1 1", + "1 1", + "1 1e" +}, e={ + "111", + "1", + "111", + "1", + "111e" +}/*, run={ + "11 1 1 1 1", + "1 1 1 1 11 1", + "11 1 1 1 11", + "1 1 1 1 1 1", + "1 1 1 1 1e" +}, pro={ + "11 11 1 ", + "1 1 1 1 1 1", + "11 11 1 1", + "1 1 1 1 1", + "1 1 1 1e" +}, japan={ + " 1 1 11 1 1 1", + " 1 1 1 1 1 1 1 11 1", + " 1 111 11 111 1 11", + "1 1 1 1 1 1 1 1 1", + " 1 1 1 1 1 1 1 1e" +}, sml={ + " 11 1 1 1", + "1 111 1", + " 1 1 1 1", + " 1 1 1 1", + "11 1 1 111e" +}, rsv={ + "11 11 1 1", + "1 1 1 1 1", + "11 1 1 1", + "1 1 1 1 1", + "1 1 11 1e" +}*/; + +#define DOWN 57 +#define RIGHT 114 + +UINT32 pc1401_state::screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, i, j; + int color[2]; + + bitmap.fill(11, cliprect); + +#if 0 + /* HJB: we cannot initialize array with values from other arrays, thus... */ + color[0] = pocketc_colortable[CONTRAST][0]; + color[1] = pocketc_colortable[CONTRAST][1]; +#endif + /* Above can be unreadable or misleading at certain contrast settings, this is better */ + color[0] = 7; + color[1] = 8; + + if (m_portc&1) + { + for (x=RIGHT,y=DOWN,i=0; i<0x28;x+=2) + { + for (j=0; j<5;j++,i++,x+=2) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,x,y); + } + for (i=0x67; i>=0x40;x+=2) + { + for (j=0; j<5;j++,i--,x+=2) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,x,y); + } + } + + pocketc_draw_special(bitmap, RIGHT+149, DOWN+24, line, + m_reg[0x3c] & 0x08 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT, DOWN-10, busy, + m_reg[0x3d] & 0x01 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, def, + m_reg[0x3d] & 0x02 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+43, DOWN-10,shift, + m_reg[0x3d] & 0x04 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+63, DOWN-10,hyp, + m_reg[0x3d] & 0x08 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+38, DOWN+24,line, + m_reg[0x3d] & 0x10 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+23, DOWN+24,line, + m_reg[0x3d] & 0x20 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+8, DOWN+24,line, + m_reg[0x3d] & 0x40 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+183, DOWN-10,e, + m_reg[0x7c] & 0x01 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+176, DOWN-10,m, + m_reg[0x7c] & 0x02 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+168, DOWN-10,braces, + m_reg[0x7c] & 0x04 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+138, DOWN-10,rad, + m_reg[0x7c] & 0x08 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+134, DOWN-10,g, + m_reg[0x7c] & 0x10 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+126, DOWN-10,de, + m_reg[0x7c] & 0x20 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, RIGHT+165, DOWN+24,line, + m_reg[0x7c] & 0x40 ? color[1] : color[0]); + +/* + 603c: 3 STAT + 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 HYP, 4 PRO, 5 RUN, 6 CAL + 607c: 0 E, 1 M, 2 (), 3 RAD, 4 G, 5 DE, 6 PRINT +*/ + return 0; +} diff --git a/src/mame/video/pc1403.c b/src/mame/video/pc1403.c new file mode 100644 index 00000000000..0eb722c0319 --- /dev/null +++ b/src/mame/video/pc1403.c @@ -0,0 +1,246 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/***************************************************************************** + * + * pc1403.c + * portable sharp pc1403 video emulator interface + * (sharp pocket computers) + * + * Copyright (c) 2001 Peter Trauner, all rights reserved. + * + * History of changes: + * 21.07.2001 Several changes listed below were made by Mario Konegger + * (konegger@itp.tu-graz.ac.at) + * Placed the grafical symbols onto the right place and added + * some symbols, so the display is correct rebuit. + * Added a strange behaviour of the display concerning the on/off + * state and the BUSY-symbol, which I found out with experiments + * with my own pc1403. + *****************************************************************************/ + +#include "emu.h" + +#include "includes/pocketc.h" +#include "includes/pc1403.h" + + +void pc1403_state::video_start() +{ + if (strcmp(machine().system().name, "pc1403h") == 0) + { + m_DOWN = 69; + m_RIGHT = 155; + } + else + { + m_DOWN = 67; + m_RIGHT = 152; + } +} + +READ8_MEMBER(pc1403_state::pc1403_lcd_read) +{ + return m_reg[offset]; +} + +WRITE8_MEMBER(pc1403_state::pc1403_lcd_write) +{ + m_reg[offset]=data; +} + +static const POCKETC_FIGURE line={ /* simple line */ + "11111", + "11111", + "11111e" +}; +static const POCKETC_FIGURE busy={ + "11 1 1 11 1 1", + "1 1 1 1 1 1 1", + "11 1 1 1 1 1", + "1 1 1 1 1 1", + "11 1 11 1e" +}, def={ + "11 111 111", + "1 1 1 1", + "1 1 111 11", + "1 1 1 1", + "11 111 1e" +}, shift={ + " 11 1 1 1 111 111", + "1 1 1 1 1 1", + " 1 111 1 11 1", + " 1 1 1 1 1 1", + "11 1 1 1 1 1e" +}, hyp={ + "1 1 1 1 11", + "1 1 1 1 1 1", + "111 1 1 11", + "1 1 1 1", + "1 1 1 1e" +}, de={ + "11 111", + "1 1 1", + "1 1 111", + "1 1 1", + "11 111e" +}, g={ + " 11", + "1", + "1 1", + "1 1", + " 11e" +}, rad={ + "11 1 11", + "1 1 1 1 1 1", + "11 111 1 1", + "1 1 1 1 1 1", + "1 1 1 1 11e" +}, braces={ + " 1 1", + "1 1", + "1 1", + "1 1", + " 1 1e" +}, m={ + "1 1", + "11 11", + "1 1 1", + "1 1", + "1 1e" +}, e={ + "111", + "1", + "111", + "1", + "111e" +}, kana={ // katakana charset + " 1 1 ", + " 11111 111", + " 1 1 1 ", + " 1 1 1 ", + "1 1 1e" +}, shoo={ // minor + " 1 ", + " 1 1 1 ", + "1 1 1", + " 1 ", + " 1e" +}, sml={ + " 11 1 1 1", + "1 111 1", + " 1 1 1 1", + " 1 1 1 1", + "11 1 1 111e" +}; + +UINT32 pc1403_state::screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x, y, i, j; + int color[3]; + + bitmap.fill(11, cliprect); + + /* HJB: we cannot initialize array with values from other arrays, thus... */ + color[0] = 7; // pocketc_colortable[CONTRAST][0]; + color[2] = 8; // pocketc_colortable[CONTRAST][1]; + color[1] = (m_portc & 1) ? color[2] : color[0]; + + if (m_portc & 1) + { + for (x=m_RIGHT, y=m_DOWN, i=0; i<6*5; x+=2) { + for (j=0; j<5; j++, i++, x+=2) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, + x,y); + } + for (i=9*5; i<12*5; x+=2) + { + for (j=0; j<5; j++, i++, x+=2) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, + x,y); + } + for (i=6*5; i<9*5; x+=2) + { + for (j=0; j<5; j++, i++, x+=2) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, + x,y); + } + for (i=0x7b-3*5; i>0x7b-6*5; x+=2) + { + for (j=0; j<5; j++, i--, x+=2) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, + x,y); + } + for (i=0x7b; i>0x7b-3*5; x+=2) + { + for (j=0; j<5; j++, i--, x+=2) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, + x,y); + } + for (i=0x7b-6*5; i>0x7b-12*5; x+=2) + { + for (j=0; j<5; j++, i--, x+=2) + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, + x,y); + } + } + /* if display is off, busy is always visible? it seems to behave like that. */ + /* But if computer is off, busy is hidden. */ + if(!(m_portc&8)) + { + if (m_portc&1) + pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy, + m_reg[0x3d] & 1 ? color[2] : color[0]); + + else pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy, color[2]); + } + else + pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy, color[0]); + + pocketc_draw_special(bitmap, m_RIGHT+18, m_DOWN-13, def, + m_reg[0x3d] & 0x02 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+43, m_DOWN-13, shift, + m_reg[0x3d] & 0x04 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+63, m_DOWN-13, hyp, + m_reg[0x3d] & 0x08 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, m_RIGHT+155, m_DOWN-13, kana, + m_reg[0x3c] & 0x01 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+167, m_DOWN-13, shoo, + m_reg[0x3c] & 0x02 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+178, m_DOWN-13, sml, + m_reg[0x3c] & 0x04 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, m_RIGHT+191, m_DOWN-13, de, + m_reg[0x7c] & 0x20 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+199, m_DOWN-13, g, + m_reg[0x7c] & 0x10 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+203, m_DOWN-13, rad, + m_reg[0x7c] & 0x08 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, m_RIGHT+266, m_DOWN-13, braces, + m_reg[0x7c] & 0x04 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+274, m_DOWN-13, m, + m_reg[0x7c] & 0x02 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+281, m_DOWN-13, e, + m_reg[0x7c] & 0x01 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, m_RIGHT+10, m_DOWN+27, line /* empty */, + m_reg[0x3c] & 0x40 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+31, m_DOWN+27, line /*calc*/, + m_reg[0x3d] & 0x40 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+52, m_DOWN+27, line/*run*/, + m_reg[0x3d] & 0x20 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+73, m_DOWN+27, line/*prog*/, + m_reg[0x3d] & 0x10 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+94, m_DOWN+27, line /* empty */, + m_reg[0x3c] & 0x20 ? color[1] : color[0]); + + pocketc_draw_special(bitmap, m_RIGHT+232, m_DOWN+27, line/*matrix*/, + m_reg[0x3c] & 0x10 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+253, m_DOWN+27, line/*stat*/, + m_reg[0x3c] & 0x08 ? color[1] : color[0]); + pocketc_draw_special(bitmap, m_RIGHT+274, m_DOWN+27, line/*print*/, + m_reg[0x7c] & 0x40 ? color[1] : color[0]); + + return 0; +} diff --git a/src/mame/video/pc1512.c b/src/mame/video/pc1512.c new file mode 100644 index 00000000000..cecfe291d96 --- /dev/null +++ b/src/mame/video/pc1512.c @@ -0,0 +1,606 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "includes/pc1512.h" + + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define LOG 0 + + +static const rgb_t PALETTE_1512[] = +{ + rgb_t::black, + rgb_t(0x00, 0x00, 0xaa), + rgb_t(0x00, 0xaa, 0x00), + rgb_t(0x00, 0xaa, 0xaa), + rgb_t(0xaa, 0x00, 0x00), + rgb_t(0xaa, 0x00, 0xaa), + rgb_t(0xaa, 0x55, 0x00), + rgb_t(0xaa, 0xaa, 0xaa), + rgb_t(0x55, 0x55, 0x55), + rgb_t(0x55, 0x55, 0xff), + rgb_t(0x55, 0xff, 0x55), + rgb_t(0x55, 0xff, 0xff), + rgb_t(0xff, 0x55, 0x55), + rgb_t(0xff, 0x55, 0xff), + rgb_t(0xff, 0xff, 0x55), + rgb_t::white +}; + +static const int PALETTE_0[] = { 0, 3, 5, 7 }; +static const int PALETTE_1[] = { 0, 2, 4, 6 }; +static const int PALETTE_2[] = { 0, 3, 4, 7 }; + + +enum +{ + ALPHA_40 = 0, + ALPHA_80, + GRAPHICS_1, + GRAPHICS_2 +}; + + +#define MODE_ALPHA_80 0x01 +#define MODE_GRAPHICS 0x02 +#define MODE_PALETTE_2 0x04 +#define MODE_ENABLE_VIDEO 0x08 +#define MODE_GRAPHICS_2 0x10 +#define MODE_BLINK 0x20 + + +#define COLOR_INTENSITY 0x10 +#define COLOR_PALETTE_1 0x20 + + +#define VFP_LORES 22 +#define HFP_LORES 16 + + + +//************************************************************************** +// VIDEO RAM ACCESS +//************************************************************************** + +//------------------------------------------------- +// video_ram_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_state::video_ram_r ) +{ + UINT8 data = 0; + + switch (get_display_mode(m_vdu_mode)) + { + case ALPHA_40: + case ALPHA_80: + data = m_video_ram[offset]; + break; + + case GRAPHICS_1: + data = m_video_ram[(offset << 2) | 3]; + break; + + case GRAPHICS_2: + data = m_video_ram[(offset << 2) | (m_vdu_rdsel ^ 0x03)]; + break; + } + + return data; +} + + +//------------------------------------------------- +// video_ram_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_state::video_ram_w ) +{ + switch (get_display_mode(m_vdu_mode)) + { + case ALPHA_40: + case ALPHA_80: + m_video_ram[offset] = data; + break; + + case GRAPHICS_1: + m_video_ram[(offset << 2) | 3] = data; + m_video_ram[(offset << 2) | 2] = data; + m_video_ram[(offset << 2) | 1] = data; + m_video_ram[(offset << 2) | 0] = data; + break; + + case GRAPHICS_2: + if (BIT(m_vdu_plane, 0)) m_video_ram[(offset << 2) | 3] = data; + if (BIT(m_vdu_plane, 1)) m_video_ram[(offset << 2) | 2] = data; + if (BIT(m_vdu_plane, 2)) m_video_ram[(offset << 2) | 1] = data; + if (BIT(m_vdu_plane, 3)) m_video_ram[(offset << 2) | 0] = data; + break; + } +} + + +//------------------------------------------------- +// vdu_r - +//------------------------------------------------- + +READ8_MEMBER( pc1512_state::vdu_r ) +{ + UINT8 data = 0; + + switch (offset) + { + case 1: case 3: case 5: case 7: + data = m_vdu->register_r(space, 0); + break; + + case 0xa: // VDU Status + /* + + bit description + + 0 Toggle Bit + 1 Light-pen latch select + 2 Light-pen switch off + 3 Frame Flyback Time + 4 + 5 + 6 + 7 + + */ + + // toggle bit + data |= m_toggle; + m_toggle = !m_toggle; + + // light pen latch + data |= m_lpen << 1; + + // light pen switch + data |= 0x04; + + // vertical sync + //data |= m_vdu->vsync_r(); + int flyback = 0; + + if (machine().first_screen()->vpos() < VFP_LORES - 16) flyback = 1; + if (machine().first_screen()->vpos() > VFP_LORES + 200) flyback = 1; + + data |= flyback << 3; + break; + } + + return data; +} + + +//------------------------------------------------- +// vdu_w - +//------------------------------------------------- + +WRITE8_MEMBER( pc1512_state::vdu_w ) +{ + switch (offset) + { + case 0: case 2: case 4: case 6: + m_vdu->address_w(space, 0, data); + break; + + case 1: case 3: case 5: case 7: + m_vdu->register_w(space, 0, data); + break; + + case 8: // VDU Mode Control + /* + + bit description + + 0 Select Alpha 80 Char mode (de-select 40 Char mode) + 1 Select Graphics modes (de-select Alpha modes) + 2 Select Palette 2 (de-select palettes 0,1) + 3 Enable Video Display + 4 Select Graphics Mode 2 (de-select graphics mode 1) + 5 Enable Blinking Chars (disable intensified backgrounds) + 6 + 7 + + */ + + if (LOG) logerror("VDU Mode Control %02x\n", data); + + if ((get_display_mode(m_vdu_mode) != GRAPHICS_2) && (get_display_mode(data) == GRAPHICS_2)) + { + m_vdu_plane = 0x0f; + m_vdu_border = 0; + } + + if (get_display_mode(data) != GRAPHICS_2) + { + m_vdu_rdsel = 0; + } + + if (get_display_mode(m_vdu_mode) != get_display_mode(data)) + { + switch (get_display_mode(data)) + { + case ALPHA_40: + case GRAPHICS_1: + m_vdu->set_hpixels_per_column(8); + m_vdu->set_clock(XTAL_28_63636MHz/32); + break; + + case ALPHA_80: + m_vdu->set_hpixels_per_column(8); + m_vdu->set_clock(XTAL_28_63636MHz/16); + break; + + case GRAPHICS_2: + m_vdu->set_hpixels_per_column(16); + m_vdu->set_clock(XTAL_28_63636MHz/32); + break; + } + } + + m_vdu_mode = data; + break; + + case 9: // VDU Colour Select + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("VDU Colour Select %02x\n", data); + + m_vdu_color = data; + break; + + case 0xb: // Clear Light Pen Latch + if (LOG) logerror("VDU Clear Light Pen Latch\n"); + + m_lpen = 0; + break; + + case 0xc: // Set Light Pen Latch + if (LOG) logerror("VDU Set Light Pen Latch\n"); + + if (!m_lpen) + { + m_vdu->assert_light_pen_input(); + } + + m_lpen = 1; + break; + + case 0xd: // VDU Colour Plane Write + /* + + bit description + + 0 Allow CPU write to Blue Plane + 1 Allow CPU write to Green Plane + 2 Allow CPU write to Red Plane + 3 Allow CPU write to Intensity Plane + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("VDU Colour Plane Write %01x\n", data & 0x0f); + + if (get_display_mode(m_vdu_mode) == GRAPHICS_2) + { + m_vdu_plane = data; + } + break; + + case 0xe: // VDU Colour Plane Read + /* + + bit description + + 0 Read Select bit 0 (RDSEL0) + 1 Read Select bit 1 (RDSEL1) + 2 + 3 + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("VDU Colour Plane Read %u\n", data & 0x03); + + if (get_display_mode(m_vdu_mode) == GRAPHICS_2) + { + m_vdu_rdsel = data & 0x03; + } + break; + + case 0xf: // VDU Graphics Mode 2 Border + /* + + bit description + + 0 Border Blue + 1 Border Green + 2 Border Red + 3 Border Intensity + 4 + 5 + 6 + 7 + + */ + + if (LOG) logerror("VDU Graphics Mode 2 Border %u\n", data & 0x0f); + + m_vdu_border = data; + break; + } +} + + +//------------------------------------------------- +// mc6845 +//------------------------------------------------- + +int pc1512_state::get_display_mode(UINT8 mode) +{ + if (mode & MODE_GRAPHICS) + { + if (mode & MODE_GRAPHICS_2) + { + return GRAPHICS_2; + } + else + { + return GRAPHICS_1; + } + } + else + { + if (mode & MODE_ALPHA_80) + { + return ALPHA_80; + } + else + { + return ALPHA_40; + } + } +} + +offs_t pc1512_state::get_char_rom_offset() +{ + return ((m_lk->read() >> 5) & 0x03) << 11; +} + +MC6845_UPDATE_ROW( pc1512_state::draw_alpha ) +{ + offs_t char_rom_offset = get_char_rom_offset(); + UINT32 *p = &bitmap.pix32(y + vbp, hbp); + + if (get_display_mode(m_vdu_mode) == ALPHA_40) + p = &bitmap.pix32(y + vbp, hbp); + + if (y > 199) return; + + for (int column = 0; column < x_count; column++) + { + UINT8 code = m_video_ram[(ma + column) << 1]; + UINT8 attr = m_video_ram[((ma + column) << 1) + 1]; + int fg = attr & 0x0f; + int bg = attr >> 4; + + if (m_vdu_mode & MODE_BLINK) + { + bg &= 0x07; + + if (BIT(attr, 7) && !m_blink) + { + fg = bg; + } + } + + offs_t addr = char_rom_offset | (code << 3) | (ra & 0x07); + UINT8 data = m_char_rom->base()[addr & 0x1fff]; + + if ((column == cursor_x) && m_cursor) + { + data = 0xff; + } + + for (int bit = 0; bit < 8; bit++) + { + int color = BIT(data, 7) ? fg : bg; + + *p = PALETTE_1512[de ? color : 0]; p++; + + data <<= 1; + } + } +} + +int pc1512_state::get_color(UINT8 data) +{ + if (data == 0) return m_vdu_color & 0x0f; + + int color = PALETTE_0[data & 0x03]; + + if (m_vdu_color & COLOR_PALETTE_1) + { + color = PALETTE_1[data & 0x03]; + } + else if (m_vdu_mode & MODE_PALETTE_2) + { + color = PALETTE_2[data & 0x03]; + } + + if (m_vdu_color & COLOR_INTENSITY) + { + color += 8; + } + + return color; +} + +MC6845_UPDATE_ROW( pc1512_state::draw_graphics_1 ) +{ + if (y > 199) return; + + UINT32 *p = &bitmap.pix32(y + vbp, hbp); + + for (int column = 0; column < x_count; column++) + { + offs_t offset = ((ra & 0x01) << 15) | ((ma + column) << 3); + + UINT16 b = (m_video_ram[offset | 3] << 8) | m_video_ram[offset | 7]; + + for (int x = 0; x < 8; x++) + { + *p = PALETTE_1512[de ? get_color((BIT(b, 15) << 1) | BIT(b, 14)) : 0]; p++; + b <<= 2; + } + } +} + +MC6845_UPDATE_ROW( pc1512_state::draw_graphics_2 ) +{ + if (y > 199) return; + + UINT32 *p = &bitmap.pix32(y + vbp, hbp); + + for (int column = 0; column < x_count; column++) + { + offs_t offset = ((ra & 0x01) << 15) | ((ma + column) << 3); + + UINT16 i = BIT(m_vdu_color, 3) ? ((m_video_ram[offset | 0] << 8) | m_video_ram[offset | 4]) : 0; + UINT16 r = BIT(m_vdu_color, 2) ? ((m_video_ram[offset | 1] << 8) | m_video_ram[offset | 5]) : 0; + UINT16 g = BIT(m_vdu_color, 1) ? ((m_video_ram[offset | 2] << 8) | m_video_ram[offset | 6]) : 0; + UINT16 b = BIT(m_vdu_color, 0) ? ((m_video_ram[offset | 3] << 8) | m_video_ram[offset | 7]) : 0; + + for (int x = 0; x < 16; x++) + { + *p = PALETTE_1512[de ? (BIT(i, 15) << 3) | (BIT(r, 15) << 2) | (BIT(g, 15) << 1) | BIT(b, 15) : 0]; p++; + i <<= 1; r <<= 1; g <<= 1; b <<= 1; + } + } +} + +MC6845_UPDATE_ROW( pc1512_state::crtc_update_row ) +{ + switch (get_display_mode(m_vdu_mode)) + { + case ALPHA_40: + case ALPHA_80: + draw_alpha(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + + case GRAPHICS_1: + draw_graphics_1(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + + case GRAPHICS_2: + draw_graphics_2(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + } +} + + +void pc1512_state::video_start() +{ + // allocate memory + m_video_ram.allocate(0x10000); +} + + +UINT32 pc1512_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (m_vdu_mode & MODE_ENABLE_VIDEO) + { + m_blink_ctr++; + + if (m_blink_ctr == 0x08) + { + m_cursor = !m_cursor; + } + else if (m_blink_ctr == 0x10) + { + m_cursor = !m_cursor; + m_blink = !m_blink; + m_blink_ctr = 0; + } + + switch (get_display_mode(m_vdu_mode)) + { + case ALPHA_40: + case GRAPHICS_1: + screen.set_visible_area(0, 359, 0, 245); + break; + + case ALPHA_80: + case GRAPHICS_2: + screen.set_visible_area(0, 831, 0, 245); + break; + } + + switch (get_display_mode(m_vdu_mode)) + { + case ALPHA_40: + case ALPHA_80: + case GRAPHICS_1: + bitmap.fill(PALETTE_1512[m_vdu_color & 0x0f], cliprect); + break; + + case GRAPHICS_2: + bitmap.fill(PALETTE_1512[m_vdu_border & 0x0f], cliprect); + break; + } + + m_vdu->screen_update(screen, bitmap, cliprect); + } + else + { + bitmap.fill(rgb_t::black, cliprect); + } + + return 0; +} + + +//------------------------------------------------- +// MACHINE_CONFIG( pc1512 ) +//------------------------------------------------- + +MACHINE_CONFIG_FRAGMENT( pc1512_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(pc1512_state, screen_update) + MCFG_SCREEN_SIZE(80*8, 24*8) + MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_REFRESH_RATE(50) + + MCFG_MC6845_ADD(AMS40041_TAG, AMS40041, SCREEN_TAG, XTAL_28_63636MHz/32) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(pc1512_state, crtc_update_row) +MACHINE_CONFIG_END diff --git a/src/mame/video/pc4.c b/src/mame/video/pc4.c new file mode 100644 index 00000000000..ce743569bd2 --- /dev/null +++ b/src/mame/video/pc4.c @@ -0,0 +1,196 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + VTech Laser PC4 LCD controller emulation + +***************************************************************************/ + +#include "emu.h" +#include "includes/pc4.h" + +void pc4_state::set_busy_flag(UINT16 usec) +{ + m_busy_flag = 1; + m_busy_timer->adjust( attotime::from_usec( usec ) ); +} + +UINT32 pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0, cliprect); + + if (m_display_on) + for (int l=0; l<4; l++) + for (int i=0; i<40; i++) + { + UINT16 char_pos = l*40 + i; + + for (int y=0; y<8; y++) + for (int x=0; x<5; x++) + if (m_ddram[char_pos] <= 0x10) + { + //draw CGRAM characters + bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); + } + else + { + //draw CGROM characters + bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x); + + } + + // if is the correct position draw cursor and blink + if (char_pos == m_cursor_pos) + { + //draw the cursor + if (m_cursor_on) + for (int x=0; x<5; x++) + bitmap.pix16(l*9 + 7, i * 6 + x) = 1; + + if (!m_blink && m_blink_on) + for (int y=0; y<7; y++) + for (int x=0; x<5; x++) + bitmap.pix16(l*9 + y, i * 6 + x) = 1; + } + } + + return 0; + +} + +void pc4_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch(id) + { + case BUSY_TIMER: + m_busy_flag = 0; + break; + + case BLINKING_TIMER: + m_blink = !m_blink; + break; + } +} + +WRITE8_MEMBER(pc4_state::lcd_control_w) +{ + if (BIT(data, 7)) + { + m_ac_mode = 0; + m_cursor_pos = m_ac = data & 0x7f; + set_busy_flag(37); + } + else if (BIT(data, 6)) + { + m_ac_mode = 1; + m_ac = data & 0x3f; + set_busy_flag(37); + } + else if (BIT(data, 5)) + { + m_cursor_on = BIT(data, 3); + + set_busy_flag(37); + } + else if (BIT(data, 4)) + { + UINT8 direct = (BIT(data, 2)) ? +1 : -1; + + if (BIT(data, 3)) + m_disp_shift += direct; + else + { + m_ac += direct; + m_cursor_pos += direct; + } + + set_busy_flag(37); + } + else if (BIT(data, 3)) + { + m_display_on = BIT(data, 2); + //m_cursor_on = BIT(data, 1); + m_blink_on = BIT(data, 0); + + set_busy_flag(37); + } + else if (BIT(data, 2)) + { + m_direction = (BIT(data, 1)) ? +1 : -1; + m_shift_on = BIT(data, 0); + set_busy_flag(37); + } + else if (BIT(data, 1)) + { + m_ac = 0; + m_cursor_pos = 0; + m_ac_mode = 0; + m_direction = 1; + m_disp_shift = 0; + set_busy_flag(520); + } + else if (BIT(data, 0)) + { + m_ac = 0; + m_cursor_pos = 0; + m_ac_mode = 0; + m_direction = 1; + m_disp_shift = 0; + memset(m_ddram, 0x20, sizeof(m_ddram)); + set_busy_flag(520); + } +} + + +READ8_MEMBER(pc4_state::lcd_control_r) +{ + return m_busy_flag<<7 || m_ac&0x7f; +} + +void pc4_state::update_ac(void) +{ + int new_ac = m_ac + m_direction; + m_ac = (new_ac < 0) ? 0 : ((new_ac >= 0xa0) ? 0xa0 : new_ac); + + if (m_ac_mode == 0) + { + m_cursor_pos = m_ac; + // display is shifted only after a write + if (m_shift_on && m_data_bus_flag == 1) m_disp_shift += m_direction; + } + + m_data_bus_flag = 0; +} + +WRITE8_MEMBER( pc4_state::lcd_offset_w ) +{ + m_cursor_pos = m_ac = (data%0xa0); +} + + +WRITE8_MEMBER(pc4_state::lcd_data_w) +{ + if (m_ac_mode == 0) + m_ddram[m_ac] = data; + else + m_cgram[m_ac] = data; + + update_ac(); + set_busy_flag(41); +} + +READ8_MEMBER(pc4_state::lcd_data_r) +{ + UINT8 data; + + if (m_ac_mode == 0) + data = m_ddram[m_ac]; + else + data = m_cgram[m_ac]; + + m_data_bus_flag = 2; + update_ac(); + set_busy_flag(41); + + return data; +} diff --git a/src/mame/video/pc8401a.c b/src/mame/video/pc8401a.c new file mode 100644 index 00000000000..1cac970396a --- /dev/null +++ b/src/mame/video/pc8401a.c @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "includes/pc8401a.h" +#include "pc8500.lh" + +/* PC-8401A */ + +PALETTE_INIT_MEMBER(pc8401a_state,pc8401a) +{ + palette.set_pen_color(0, rgb_t(39, 108, 51)); + palette.set_pen_color(1, rgb_t(16, 37, 84)); +} + +void pc8401a_state::video_start() +{ +} + +/* PC-8500 */ + +void pc8500_state::video_start() +{ +} + +UINT32 pc8500_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +// m_lcdc->screen_update(screen, bitmap, cliprect); + + /* + if (strcmp(screen.tag(), SCREEN_TAG) == 0) + { + sed1330_update(m_lcdc, &bitmap, cliprect); + } + else + { + m_crtc->update(bitmap, cliprect); + } + */ + + return 0; +} + +/* SED1330 Interface */ + +static ADDRESS_MAP_START( pc8401a_lcdc, AS_0, 8, pc8401a_state ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + AM_RANGE(0x0000, 0x1fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pc8500_lcdc, AS_0, 8, pc8401a_state ) + ADDRESS_MAP_GLOBAL_MASK(0x3fff) + AM_RANGE(0x0000, 0x3fff) AM_RAM +ADDRESS_MAP_END + + +/* Machine Drivers */ + +MACHINE_CONFIG_FRAGMENT( pc8401a_video ) +// MCFG_DEFAULT_LAYOUT(layout_pc8401a) + + MCFG_PALETTE_ADD("palette", 2) + MCFG_PALETTE_INIT_OWNER(pc8401a_state,pc8401a) + + /* LCD */ + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(44) + MCFG_SCREEN_UPDATE_DEVICE(SED1330_TAG, sed1330_device, screen_update) + MCFG_SCREEN_SIZE(480, 128) + MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 128-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_SED1330_ADD(SED1330_TAG, 0, SCREEN_TAG, pc8401a_lcdc) +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( pc8500_video ) + MCFG_DEFAULT_LAYOUT(layout_pc8500) + + MCFG_PALETTE_ADD("palette", 2+8) + MCFG_PALETTE_INIT_OWNER(pc8401a_state,pc8401a) + + /* LCD */ + MCFG_SCREEN_ADD(SCREEN_TAG, LCD) + MCFG_SCREEN_REFRESH_RATE(44) + MCFG_SCREEN_UPDATE_DEVICE(SED1330_TAG, sed1330_device, screen_update) + MCFG_SCREEN_SIZE(480, 208) + MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 200-1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_SED1330_ADD(SED1330_TAG, 0, SCREEN_TAG, pc8500_lcdc) + + /* PC-8441A CRT */ + MCFG_SCREEN_ADD(CRT_SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(pc8500_state, screen_update) + MCFG_SCREEN_SIZE(80*8, 24*8) + MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_PALETTE("palette") + + MCFG_MC6845_ADD(MC6845_TAG, MC6845, CRT_SCREEN_TAG, 400000) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(6) +MACHINE_CONFIG_END diff --git a/src/mame/video/pc_t1t.c b/src/mame/video/pc_t1t.c new file mode 100644 index 00000000000..e77c5339bd0 --- /dev/null +++ b/src/mame/video/pc_t1t.c @@ -0,0 +1,1033 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + IBM PC junior + Tandy 1000 Graphics Adapter (T1T) section + + Note that in the IBM PC Junior world, the term 'vga' is not the 'vga' that + most people think of + +***************************************************************************/ + +#include "emu.h" +#include "pc_t1t.h" +#include "machine/pic8259.h" +#include "machine/ram.h" + +enum +{ + T1000_TEXT_INTEN = 0, + T1000_TEXT_BLINK, + T1000_GFX_1BPP, + T1000_GFX_2BPP, + T1000_GFX_4BPP, + T1000_GFX_2BPP_TGA, + PCJX_TEXT, + PCJR_GFX_2BPP_HIGH +}; + + +const device_type PCVIDEO_T1000 = &device_creator; +const device_type PCVIDEO_PCJR = &device_creator; + +pc_t1t_device::pc_t1t_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_video_interface(mconfig, *this), + m_mc6845(*this, T1000_MC6845_NAME), + m_mode_control(0), + m_color_select(0), + m_status(0), + m_bank(0), + m_pc_framecnt(0), + m_displayram(NULL), + m_chr_gen(NULL), + m_chr_size(0), + m_ra_offset(0), + m_address_data_ff(0), + m_update_row_type(-1), + m_display_enable(0), + m_vsync(0), + m_palette_base(0), + m_palette(*this,"palette") +{ +} + +pcvideo_t1000_device::pcvideo_t1000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : pc_t1t_device(mconfig, PCVIDEO_T1000, "Tandy 1000 Graphics Adapter", tag, owner, clock, "tandy_1000_graphics_adapter", __FILE__), + m_t1_displayram(NULL) +{ +} + +pcvideo_pcjr_device::pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : pc_t1t_device(mconfig, PCVIDEO_PCJR, "PC Jr Graphics Adapter", tag, owner, clock, "pcjr_graphics_adapter", __FILE__), + m_jxkanji(NULL) +{ +} + + +void pcvideo_t1000_device::device_start() +{ + m_chr_gen = machine().root_device().memregion("gfx1")->base(); + m_bank = 0; + m_chr_size = 1; + m_ra_offset = 256; +} + + +void pcvideo_pcjr_device::device_start() +{ + m_chr_gen = machine().root_device().memregion("gfx1")->base(); + m_bank = 0; + m_mode_control = 0x08; + m_chr_size = 8; + m_ra_offset = 1; + if(!strncmp(machine().system().name, "ibmpcjx", 7)) + m_jxkanji = machine().root_device().memregion("kanji")->base(); + else + m_jxkanji = NULL; +} + + +/*************************************************************************** + + Static declarations + +***************************************************************************/ + +MACHINE_CONFIG_FRAGMENT( pcvideo_t1000 ) + MCFG_SCREEN_ADD(T1000_SCREEN_NAME, RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,262,0,200) + MCFG_SCREEN_UPDATE_DEVICE( T1000_MC6845_NAME, mc6845_device, screen_update ) + + MCFG_PALETTE_ADD( "palette", 32 ) + MCFG_PALETTE_INIT_OWNER(pc_t1t_device, pcjr) + + MCFG_MC6845_ADD(T1000_MC6845_NAME, MC6845, T1000_SCREEN_NAME, XTAL_14_31818MHz/8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(pc_t1t_device, crtc_update_row) + MCFG_MC6845_OUT_DE_CB(WRITELINE(pc_t1t_device, t1000_de_changed)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(pcvideo_t1000_device, t1000_vsync_changed)) +MACHINE_CONFIG_END + +machine_config_constructor pcvideo_t1000_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pcvideo_t1000 ); +} + + +MACHINE_CONFIG_FRAGMENT( pcvideo_pcjr ) + MCFG_SCREEN_ADD(T1000_SCREEN_NAME, RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,262,0,200) + MCFG_SCREEN_UPDATE_DEVICE( T1000_MC6845_NAME, mc6845_device, screen_update ) + + MCFG_PALETTE_ADD( "palette", 32 ) + MCFG_PALETTE_INIT_OWNER(pc_t1t_device, pcjr) + + MCFG_MC6845_ADD(T1000_MC6845_NAME, MC6845, T1000_SCREEN_NAME, XTAL_14_31818MHz/16) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(pcvideo_pcjr_device, crtc_update_row) + MCFG_MC6845_OUT_DE_CB(WRITELINE(pc_t1t_device, t1000_de_changed)) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(pcvideo_pcjr_device, pcjr_vsync_changed)) +MACHINE_CONFIG_END + +machine_config_constructor pcvideo_pcjr_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pcvideo_pcjr ); +} + + +/*************************************************************************** + + Methods + +***************************************************************************/ + +/* Initialise the cga palette */ +PALETTE_INIT_MEMBER( pc_t1t_device, pcjr ) +{ + const static unsigned char tga_palette[16][3] = + { + { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0xaa }, { 0x00, 0xaa, 0x00 }, { 0x00, 0xaa, 0xaa }, + { 0xaa, 0x00, 0x00 }, { 0xaa, 0x00, 0xaa }, { 0xaa, 0x55, 0x00 }, { 0xaa, 0xaa, 0xaa }, + { 0x55, 0x55, 0x55 }, { 0x55, 0x55, 0xff }, { 0x55, 0xff, 0x55 }, { 0x55, 0xff, 0xff }, + { 0xff, 0x55, 0x55 }, { 0xff, 0x55, 0xff }, { 0xff, 0xff, 0x55 }, { 0xff, 0xff, 0xff } + }; + int i; + + /* colors */ + for(i = 0; i < 16; i++) + palette.set_pen_color(i, tga_palette[i][0], tga_palette[i][1], tga_palette[i][2]); + + /* b/w mode shades */ + for(i = 0; i < 16; i++) + palette.set_pen_color(16+i, ( i << 4 ) | i, ( i << 4 ) | i, ( i << 4 ) | i ); +} + + +MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + int i; + + if ( y == 0 ) logerror("t1000_text_inten_update_row\n"); + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ( ma + i ) << 1 ) & 0x3fff; + UINT8 chr = m_displayram[ offset ]; + UINT8 attr = m_displayram[ offset +1 ]; + UINT8 data = m_chr_gen[ chr * m_chr_size + ra * m_ra_offset ]; + UINT16 fg = m_palette_base + ( attr & 0x0F ); + UINT16 bg = m_palette_base + ( ( attr >> 4 ) & 0x07 ); + + if ( i == cursor_x && ( m_pc_framecnt & 0x08 ) ) + { + data = 0xFF; + } + + *p = palette[( data & 0x80 ) ? fg : bg]; p++; + *p = palette[( data & 0x40 ) ? fg : bg]; p++; + *p = palette[( data & 0x20 ) ? fg : bg]; p++; + *p = palette[( data & 0x10 ) ? fg : bg]; p++; + *p = palette[( data & 0x08 ) ? fg : bg]; p++; + *p = palette[( data & 0x04 ) ? fg : bg]; p++; + *p = palette[( data & 0x02 ) ? fg : bg]; p++; + *p = palette[( data & 0x01 ) ? fg : bg]; p++; + } +} + + +MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + int i; + + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ( ma + i ) << 1 ) & 0x3fff; + UINT8 chr = m_displayram[ offset ]; + UINT8 attr = m_displayram[ offset +1 ]; + UINT8 data = m_chr_gen[ chr * m_chr_size + ra * m_ra_offset ]; + UINT16 fg = m_palette_base + ( attr & 0x0F ); + UINT16 bg = m_palette_base + ( ( attr >> 4 ) & 0x07 ); + + if ( i == cursor_x ) + { + if ( m_pc_framecnt & 0x08 ) + { + data = 0xFF; + } + } + else + { + if ( ( attr & 0x80 ) && ( m_pc_framecnt & 0x10 ) ) + { + data = 0x00; + } + } + + *p = palette[( data & 0x80 ) ? fg : bg]; p++; + *p = palette[( data & 0x40 ) ? fg : bg]; p++; + *p = palette[( data & 0x20 ) ? fg : bg]; p++; + *p = palette[( data & 0x10 ) ? fg : bg]; p++; + *p = palette[( data & 0x08 ) ? fg : bg]; p++; + *p = palette[( data & 0x04 ) ? fg : bg]; p++; + *p = palette[( data & 0x02 ) ? fg : bg]; p++; + *p = palette[( data & 0x01 ) ? fg : bg]; p++; + } +} + +MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjx_text_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + int i; + + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ( ma + i ) << 1 ) & 0x3fff; + UINT8 chr = m_displayram[ offset ]; + UINT8 attr = m_displayram[ offset +1 ]; + UINT16 fg = m_palette_base + ( attr & 0x07 ); + UINT16 bg = m_palette_base + ( ( attr >> 4 ) & 0x07 ); + UINT16 code = chr & 0x1f; + if((attr & 0x88) == 0x88) + { + code = m_displayram[ offset - 2 ] & 0x1f; + code = (code << 8) + chr; + } + else if(attr & 0x80) + code = (code << 8) + m_displayram[ offset + 2 ]; + else + code = chr; + + UINT8 data; + if(ra < 16) + data = m_jxkanji[code * 16 * 2 + (ra * 2) + ((attr & 8)?1:0)]; + else + data = ((i == cursor_x) && (m_pc_framecnt & 8)) ? 0xff: 0; + + *p = palette[( data & 0x80 ) ? fg : bg]; p++; + *p = palette[( data & 0x40 ) ? fg : bg]; p++; + *p = palette[( data & 0x20 ) ? fg : bg]; p++; + *p = palette[( data & 0x10 ) ? fg : bg]; p++; + *p = palette[( data & 0x08 ) ? fg : bg]; p++; + *p = palette[( data & 0x04 ) ? fg : bg]; p++; + *p = palette[( data & 0x02 ) ? fg : bg]; p++; + *p = palette[( data & 0x01 ) ? fg : bg]; p++; + } +} + +MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_4bpp_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + UINT8 *vid = m_displayram + ( ra << 13 ); + int i; + + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; + UINT8 data = vid[ offset ]; + + *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; + *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; + *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + + data = vid[ offset + 1 ]; + + *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; + *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; + *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + } +} + + +MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + UINT8 *vid = m_displayram + ( ra << 13 ); + int i; + + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; + UINT8 data = vid[ offset ]; + + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; + + data = vid[ offset+1 ]; + + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; + } +} + + +MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjr_gfx_2bpp_high_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + UINT8 *vid = m_displayram + ( ra << 13 ); + int i; + + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; + UINT8 data0 = vid[ offset ]; + UINT8 data1 = vid[ offset + 1 ]; + + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x80 ) >> 7 ) | ( ( data1 & 0x80 ) >> 6 ) ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x40 ) >> 6 ) | ( ( data1 & 0x40 ) >> 5 ) ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x20 ) >> 5 ) | ( ( data1 & 0x20 ) >> 4 ) ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x10 ) >> 4 ) | ( ( data1 & 0x10 ) >> 3 ) ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x08 ) >> 3 ) | ( ( data1 & 0x08 ) >> 2 ) ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x04 ) >> 2 ) | ( ( data1 & 0x04 ) >> 1 ) ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x02 ) >> 1 ) | ( ( data1 & 0x02 ) ) ) ]]; p++; + *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x01 ) ) | ( ( data1 & 0x01 ) << 1 ) ) ]]; p++; + } +} + + +MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_tga_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + UINT8 *vid = m_displayram + ( ra << 13 ); + int i; + + if ( y == 0 ) logerror("t1000_gfx_2bpp_tga_update_row\n"); + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; + UINT8 data = vid[ offset ]; + UINT16 data2 = ( vid[ offset + 1 ] ) << 1; + + *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x100 ) | ( data & 0x80 ) ) >> 7 ) ]]; p++; + *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x80 ) | ( data & 0x40 ) ) >> 6 ) ]]; p++; + *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x40 ) | ( data & 0x20 ) ) >> 5 ) ]]; p++; + *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x20 ) | ( data & 0x10 ) ) >> 4 ) ]]; p++; + + *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x10 ) | ( data & 0x08 ) ) >> 3 ) ]]; p++; + *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x08 ) | ( data & 0x04 ) ) >> 2 ) ]]; p++; + *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x04 ) | ( data & 0x02 ) ) >> 1 ) ]]; p++; + *p = palette[m_reg.data[ 0x10 + ( ( data2 & 0x02 ) | ( data & 0x01 ) ) ]]; p++; + } +} + + +MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_1bpp_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(y); + UINT8 *vid = m_displayram + ( ra << 13 ); + UINT8 fg = m_palette_base + m_reg.data[0x11]; + UINT8 bg = m_palette_base + m_reg.data[0x10]; + int i; + + if ( y == 0 ) logerror("t1000_gfx_1bpp_update_row\n"); + for ( i = 0; i < x_count; i++ ) + { + UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; + UINT8 data = vid[ offset ]; + + *p = palette[( data & 0x80 ) ? fg : bg]; p++; + *p = palette[( data & 0x40 ) ? fg : bg]; p++; + *p = palette[( data & 0x20 ) ? fg : bg]; p++; + *p = palette[( data & 0x10 ) ? fg : bg]; p++; + *p = palette[( data & 0x08 ) ? fg : bg]; p++; + *p = palette[( data & 0x04 ) ? fg : bg]; p++; + *p = palette[( data & 0x02 ) ? fg : bg]; p++; + *p = palette[( data & 0x01 ) ? fg : bg]; p++; + + data = vid[ offset + 1 ]; + + *p = palette[( data & 0x80 ) ? fg : bg]; p++; + *p = palette[( data & 0x40 ) ? fg : bg]; p++; + *p = palette[( data & 0x20 ) ? fg : bg]; p++; + *p = palette[( data & 0x10 ) ? fg : bg]; p++; + *p = palette[( data & 0x08 ) ? fg : bg]; p++; + *p = palette[( data & 0x04 ) ? fg : bg]; p++; + *p = palette[( data & 0x02 ) ? fg : bg]; p++; + *p = palette[( data & 0x01 ) ? fg : bg]; p++; + } +} + +MC6845_UPDATE_ROW( pc_t1t_device::crtc_update_row ) +{ + if (m_update_row_type == -1) + return; + + switch (m_update_row_type) + { + case T1000_TEXT_INTEN: + t1000_text_inten_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + case T1000_TEXT_BLINK: + t1000_text_blink_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + case T1000_GFX_1BPP: + t1000_gfx_1bpp_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + case T1000_GFX_2BPP: + t1000_gfx_2bpp_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + case T1000_GFX_2BPP_TGA: + t1000_gfx_2bpp_tga_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + case T1000_GFX_4BPP: + t1000_gfx_4bpp_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + } +} + + +MC6845_UPDATE_ROW( pcvideo_pcjr_device::crtc_update_row ) +{ + if (m_update_row_type == -1) + return; + + switch (m_update_row_type) + { + case PCJX_TEXT: + pcjx_text_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + case PCJR_GFX_2BPP_HIGH: + pcjr_gfx_2bpp_high_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + default: + pc_t1t_device::crtc_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); + break; + } +} + + +READ8_MEMBER( pcvideo_t1000_device::videoram_r ) +{ + UINT8 *videoram = m_t1_displayram; + int data = 0xff; + if( videoram ) + data = videoram[offset]; + return data; +} + +WRITE8_MEMBER( pcvideo_t1000_device::videoram_w ) +{ + UINT8 *videoram = m_t1_displayram; + if( videoram ) + videoram[offset] = data; +} + +void pcvideo_t1000_device::mode_switch( void ) +{ + switch( m_mode_control & 0x3B ) + { + case 0x08: case 0x09: + m_update_row_type = T1000_TEXT_INTEN; + break; + case 0x28: case 0x29: + m_update_row_type = T1000_TEXT_BLINK; + break; + case 0x0A: case 0x0B: case 0x2A: case 0x2B: + switch( m_bank & 0xc0 ) + { + case 0x00: + case 0x40: + //logerror("t1t_gfx_2bpp - 1\n"); + m_update_row_type = T1000_GFX_2BPP; + if ( m_color_select ) + { + m_reg.data[0x10] = 0x00; + m_reg.data[0x11] = 0x0B; + m_reg.data[0x12] = 0x0D; + m_reg.data[0x13] = 0x0F; + } + else + { + m_reg.data[0x10] = 0x00; + m_reg.data[0x11] = 0x0A; + m_reg.data[0x12] = 0x0C; + m_reg.data[0x13] = 0x0E; + } + break; + case 0x80: + case 0xc0: + //logerror("t1t_gfx_4bpp\n"); + m_update_row_type = T1000_GFX_4BPP; + break; + } + break; + case 0x18: case 0x19: case 0x1A: case 0x1B: + case 0x38: case 0x39: case 0x3A: case 0x3B: + switch( m_bank & 0xc0 ) + { + case 0x00: + case 0x40: + //logerror("t1t_gfx_1bpp\n"); + m_update_row_type = T1000_GFX_1BPP; + break; + case 0x80: + case 0xc0: + //logerror("t1t_gfx_2bpp - 2\n"); + m_update_row_type = T1000_GFX_2BPP_TGA; + break; + } + break; + default: + m_update_row_type = -1; + break; + } +} + + +/* mode control 1 ( m_reg.data[0] ) */ +/* bit0 - 0 = low bandwidth, 1 = high bandwidth */ +/* bit1 - 0 = alpha, 1 = graphics */ +/* bit2 - 0 = color, 1 = b/w */ +/* bit3 - 0 = video disable, 1 = video enable */ +/* bit4 - 1 = 16 color graphics */ +/* mode control 2 ( m_reg.data[3] ) */ +/* bit1 - 1 = enable blink */ +/* bit3 - 1 = 2 color graphics */ + +void pcvideo_pcjr_device::pc_pcjr_mode_switch() +{ + switch( m_reg.data[0] & 0x1A ) + { + case 0x08: /* 01x0x */ + if(m_jxkanji) + { + m_update_row_type = PCJX_TEXT; + break; + } + if ( m_reg.data[3] & 0x02 ) + { + m_update_row_type = T1000_TEXT_BLINK; + } + else + { + m_update_row_type = T1000_TEXT_INTEN; + } + break; + case 0x0A: /* 01x1x */ + /* By default use medium resolution mode */ + m_update_row_type = T1000_GFX_2BPP; + + /* Check for high resolution mode */ + if ( ( m_bank & 0xc0 ) == 0xc0 ) + m_update_row_type = PCJR_GFX_2BPP_HIGH; + + /* Check for 640x200 b/w 2 shades mode */ + if ( ( m_reg.data[0] & 0x04 ) && ( m_reg.data[3] & 0x08 ) ) + { + m_update_row_type = T1000_GFX_1BPP; + } + break; + case 0x18: /* 11x0x - invalid?? */ + m_update_row_type = -1; + break; + case 0x1A: /* 11x1x */ + m_update_row_type = T1000_GFX_4BPP; + break; + default: + m_update_row_type = -1; + break; + } + + /* Determine mc6845 input clock */ + if ( m_reg.data[0] & 0x01 ) + { + m_mc6845->set_clock( XTAL_14_31818MHz/8 ); + } + else + { + m_mc6845->set_clock( XTAL_14_31818MHz/16 ); + } + + /* color or b/w? */ + m_palette_base = ( m_reg.data[0] & 0x04 ) ? 16 : 0; +} + + +/* + * 3d8 rW T1T mode control register (see #P138) + */ +void pcvideo_t1000_device::mode_control_w(int data) +{ + m_mode_control = data; + + mode_switch(); +} + +int pc_t1t_device::mode_control_r(void) +{ + int data = m_mode_control; + return data; +} + +/* + * 3d9 ?W color select register on color adapter + */ +void pc_t1t_device::color_select_w(int data) +{ + if (m_color_select == data) + return; + m_color_select = data; +} + +int pc_t1t_device::color_select_r(void) +{ + int data = m_color_select; + return data; +} + +/* Bitfields for T1T status register: + * Bit(s) Description (Table P179) + * 7-6 not used + * 5-4 color EGA, color ET4000: diagnose video display feedback, select + * from color plane enable + * 4 holds current dot being displayed + * 3 in vertical retrace + * 2 (CGA,color EGA) light pen switch is off + * (MCGA,color ET4000) reserved (0) + * 1 (CGA,color EGA) positive edge from light pen has set trigger + * (MCGA,color ET4000) reserved (0) + * 0 display enabled + * =0 do not use memory + * =1 memory access without interfering with display + * (Genoa SuperEGA) horizontal or vertical retrace + */ +int pc_t1t_device::status_r(void) +{ + int data = m_vsync | m_status | m_display_enable; + /* HACK HACK HACK */ + data |= ( m_display_enable ? 0x10 : 0x00 ); + /* end HACK */ + return data; +} + +/* + * 3db -W light pen strobe reset (on any value) + */ +void pc_t1t_device::lightpen_strobe_w(int data) +{ +// pc_port[0x3db] = data; +} + + +/* + * 3da -W (mono EGA/mono VGA) feature control register + * (see PORT 03DAh-W for details; VGA, see PORT 03CAh-R) + */ +void pc_t1t_device::vga_index_w(int data) +{ + m_reg.index = data; +} + +void pcvideo_t1000_device::vga_data_w(int data) +{ + m_reg.data[m_reg.index] = data; + + switch (m_reg.index) + { + case 0x00: /* mode control 1 */ + break; + case 0x01: /* palette mask (bits 3-0) */ + break; + case 0x02: /* border color (bits 3-0) */ + break; + case 0x03: /* mode control 2 */ + break; + case 0x04: /* reset register */ + break; + /* palette array */ + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: + case 0x1c: case 0x1d: case 0x1e: case 0x1f: + m_reg.data[m_reg.index] = data & 0x0F; + break; + } +} + + +void pcvideo_pcjr_device::pc_pcjr_vga_data_w(int data) +{ + m_reg.data[m_reg.index] = data; + + switch (m_reg.index) + { + case 0x00: /* mode control 1 */ + /* bit0 - 0 = low bandwidth, 1 = high bandwidth */ + /* bit1 - 0 = alpha, 1 = graphics */ + /* bit2 - 0 = color, 1 = b/w */ + /* bit3 - 0 = video disable, 1 = video enable */ + /* bit4 - 1 = 16 color graphics */ + pc_pcjr_mode_switch(); + break; + case 0x01: /* palette mask (bits 3-0) */ + break; + case 0x02: /* border color (bits 3-0) */ + break; + case 0x03: /* mode control 2 */ + /* bit1 - 1 = enable blink */ + /* bit3 - 1 = 2 color graphics */ + pc_pcjr_mode_switch(); + break; + case 0x04: /* reset register */ + break; + /* palette array */ + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: + case 0x1c: case 0x1d: case 0x1e: case 0x1f: + m_reg.data[m_reg.index] = data & 0x0F; + break; + } +} + + +int pc_t1t_device::vga_data_r(void) +{ + int data = m_reg.data[m_reg.index]; + + switch (m_reg.index) + { + case 0x00: /* mode control 1 */ + break; + case 0x01: /* palette mask (bits 3-0) */ + break; + case 0x02: /* border color (bits 3-0) */ + break; + case 0x03: /* mode control 2 */ + break; + case 0x04: /* reset register */ + break; + /* palette array */ + case 0x10: case 0x11: case 0x12: case 0x13: + case 0x14: case 0x15: case 0x16: case 0x17: + case 0x18: case 0x19: case 0x1a: case 0x1b: + case 0x1c: case 0x1d: case 0x1e: case 0x1f: + break; + } + return data; +} + +/* + * 3df RW display bank, access bank, mode + * bit 0-2 Identifies the page of main memory being displayed in units of 16K. + * 0: 0K, 1: 16K...7: 112K. In 32K modes (bits 6-7 = 2) only 0,2,4 and + * 6 are valid, as the next page will also be used. + * 3-5 Identifies the page of main memory that can be read/written at B8000h + * in units of 16K. 0: 0K, 1: 16K...7: 112K. In 32K modes (bits 6-7 = 2) + * only 0,2,4 and 6 are valid, as the next page will also be used. + * 6-7 Display mode. 0: Text, 1: 16K graphics mode (4,5,6,8) + * 2: 32K graphics mode (9,Ah) + */ +void pcvideo_t1000_device::bank_w(int data) +{ + if (m_bank != data) + { + UINT8 *ram = machine().root_device().memregion("maincpu")->base(); + int dram, vram; + m_bank = data; + /* it seems the video ram is mapped to the last 128K of main memory */ +#if 1 + if ((data&0xc0)==0xc0) /* needed for lemmings */ + { + dram = 0x80000 + ((data & 0x06) << 14); + vram = 0x80000 + ((data & 0x30) << (14-3)); + } + else + { + dram = 0x80000 + ((data & 0x07) << 14); + vram = 0x80000 + ((data & 0x38) << (14-3)); + } +#else + dram = (data & 0x07) << 14; + vram = (data & 0x38) << (14-3); +#endif + m_t1_displayram = &ram[vram]; + m_displayram = &ram[dram]; + mode_switch(); + } +} + + +void pcvideo_pcjr_device::pc_pcjr_bank_w(int data) +{ + if (m_bank != data) + { + int dram, vram; + m_bank = data; + /* it seems the video ram is mapped to the last 128K of main memory */ + if ((data&0xc0)==0xc0) /* needed for lemmings */ + { + dram = ((data & 0x06) << 14); + vram = ((data & 0x30) << (14-3)); + } + else + { + dram = ((data & 0x07) << 14); + vram = ((data & 0x38) << (14-3)); + } + machine().root_device().membank( "bank14" )->set_base( machine().device(RAM_TAG)->pointer() + vram ); + m_displayram = machine().device(RAM_TAG)->pointer() + dram; + pc_pcjr_mode_switch(); + } +} + +void pcvideo_pcjr_device::pc_pcjx_bank_w(int data) +{ + if (m_bank != data) + { + int dram, vram; + m_bank = data; + /* this probably isn't right, but otherwise the memory test stomps on the vram */ + if ((data&0xc0)==0xc0) /* needed for lemmings */ + { + dram = 0x80000 + ((data & 0x06) << 14); + vram = 0x80000 + ((data & 0x30) << (14-3)); + } + else + { + dram = 0x80000 + ((data & 0x07) << 14); + vram = 0x80000 + ((data & 0x38) << (14-3)); + } + machine().root_device().membank( "bank14" )->set_base( machine().device(RAM_TAG)->pointer() + vram ); + m_displayram = machine().device(RAM_TAG)->pointer() + dram; + pc_pcjr_mode_switch(); + } +} + +int pc_t1t_device::bank_r(void) +{ + return m_bank; +} + +/************************************************************************* + * + * T1T + * Tandy 1000 / PCjr + * + *************************************************************************/ + +WRITE8_MEMBER( pcvideo_t1000_device::write ) +{ + switch( offset ) + { + case 0: case 2: case 4: case 6: + m_mc6845->address_w( space, offset, data ); + break; + case 1: case 3: case 5: case 7: + m_mc6845->register_w( space, offset, data ); + break; + case 8: + mode_control_w(data); + break; + case 9: + color_select_w(data); + break; + case 10: + vga_index_w(data); + break; + case 11: + lightpen_strobe_w(data); + break; + case 12: + break; + case 13: + break; + case 14: + vga_data_w(data); + break; + case 15: + bank_w(data); + break; + } +} + + +WRITE8_MEMBER( pcvideo_pcjr_device::write ) +{ + switch( offset ) + { + case 0: case 4: + m_mc6845->address_w( space, offset, data ); + break; + case 1: case 5: + m_mc6845->register_w( space, offset, data ); + break; + case 10: + if ( m_address_data_ff & 0x01 ) + { + pc_pcjr_vga_data_w( data ); + } + else + { + vga_index_w( data ); + } + m_address_data_ff ^= 0x01; + break; + case 11: + lightpen_strobe_w(data); + break; + case 12: + break; + case 15: + if(m_jxkanji) + pc_pcjx_bank_w(data); + else + pc_pcjr_bank_w(data); + break; + + default: + break; + } +} + + +READ8_MEMBER( pc_t1t_device::read ) +{ + int data = 0xff; + + switch( offset ) + { + case 0: case 2: case 4: case 6: + /* return last written mc6845 address value here? */ + break; + + case 1: case 3: case 5: case 7: + data = m_mc6845->register_r( space, offset ); + break; + + case 8: + data = mode_control_r(); + break; + + case 9: + data = color_select_r(); + break; + + case 10: + m_address_data_ff = 0; + data = status_r(); + break; + + case 11: + /* -W lightpen strobe reset */ + break; + + case 12: + case 13: + break; + + case 14: + data = vga_data_r(); + break; + + case 15: + data = bank_r(); + break; + } + return data; +} + + +WRITE_LINE_MEMBER( pc_t1t_device::t1000_de_changed ) +{ + m_display_enable = state ? 1 : 0; +} + + +WRITE_LINE_MEMBER( pcvideo_t1000_device::t1000_vsync_changed ) +{ + m_vsync = state ? 8 : 0; + if ( state ) + { + m_pc_framecnt++; + } +} + + +WRITE_LINE_MEMBER( pcvideo_pcjr_device::pcjr_vsync_changed ) +{ + m_vsync = state ? 8 : 0; + if ( state ) + { + m_pc_framecnt++; + } + machine().device("pic8259")->ir5_w(state); +} diff --git a/src/mame/video/pc_t1t.h b/src/mame/video/pc_t1t.h new file mode 100644 index 00000000000..3c89cbc0b0f --- /dev/null +++ b/src/mame/video/pc_t1t.h @@ -0,0 +1,147 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef PC_T1T_H +#define PC_T1T_H + +#include "video/mc6845.h" + +#define T1000_SCREEN_NAME "screen" +#define T1000_MC6845_NAME "mc6845_t1000" + +// used in tandy1000hx; used in pcjr??? +struct reg +{ + reg() + { + index = 0; + memset(&data, 0, sizeof(data)); + } + + UINT8 index; + UINT8 data[0x20]; + /* see vgadoc + 0 mode control 1 + 1 palette mask + 2 border color + 3 mode control 2 + 4 reset + 0x10-0x1f palette registers + */ +}; + +class pc_t1t_device : public device_t, + public device_video_interface +{ +public: + // construction/destruction + pc_t1t_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + DECLARE_PALETTE_INIT( pcjr ); + + DECLARE_WRITE_LINE_MEMBER( t1000_de_changed ); + + virtual MC6845_UPDATE_ROW( crtc_update_row ); + MC6845_UPDATE_ROW( t1000_text_inten_update_row ); + MC6845_UPDATE_ROW( t1000_text_blink_update_row ); + MC6845_UPDATE_ROW( t1000_gfx_4bpp_update_row ); + MC6845_UPDATE_ROW( t1000_gfx_2bpp_update_row ); + MC6845_UPDATE_ROW( t1000_gfx_2bpp_tga_update_row ); + MC6845_UPDATE_ROW( t1000_gfx_1bpp_update_row ); + + required_device m_mc6845; + UINT8 m_mode_control, m_color_select; + UINT8 m_status; + + struct reg m_reg; + + UINT8 m_bank; + + int m_pc_framecnt; + + UINT8 *m_displayram; + + UINT8 *m_chr_gen; + UINT8 m_chr_size; + UINT16 m_ra_offset; + + UINT8 m_address_data_ff; + + int m_update_row_type; + UINT8 m_display_enable; + UINT8 m_vsync; + UINT8 m_palette_base; + + int mode_control_r(void); + void color_select_w(int data); + int color_select_r(void); + int status_r(void); + void lightpen_strobe_w(int data); + void vga_index_w(int data); + int vga_data_r(void); + int bank_r(void); + + DECLARE_READ8_MEMBER( read ); + required_device m_palette; +}; + +class pcvideo_t1000_device : public pc_t1t_device +{ +public: + // construction/destruction + pcvideo_t1000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( videoram_r ); + DECLARE_WRITE8_MEMBER( videoram_w ); + DECLARE_WRITE_LINE_MEMBER( t1000_vsync_changed ); + +protected: + virtual machine_config_constructor device_mconfig_additions() const; + virtual void device_start(); + +private: + UINT8 *m_t1_displayram; + void mode_switch( void ); + void vga_data_w(int data); + void bank_w(int data); + void mode_control_w(int data); +}; + +extern const device_type PCVIDEO_T1000; + +#define MCFG_PCVIDEO_T1000_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, PCVIDEO_T1000, 0) + +class pcvideo_pcjr_device : public pc_t1t_device +{ +public: + // construction/destruction + pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE8_MEMBER( write ); + DECLARE_WRITE_LINE_MEMBER( pcjr_vsync_changed ); + + UINT8 *m_jxkanji; + + virtual MC6845_UPDATE_ROW( crtc_update_row ); + MC6845_UPDATE_ROW( pcjx_text_update_row ); + MC6845_UPDATE_ROW( pcjr_gfx_2bpp_high_update_row ); + +protected: + virtual machine_config_constructor device_mconfig_additions() const; + virtual void device_start(); + +private: + void pc_pcjr_mode_switch(); + void pc_pcjr_vga_data_w(int data); + void pc_pcjr_bank_w(int data); + void pc_pcjx_bank_w(int data); +}; + +extern const device_type PCVIDEO_PCJR; + +#define MCFG_PCVIDEO_PCJR_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, PCVIDEO_PCJR, 0) + + +#endif /* PC_T1T_H */ diff --git a/src/mame/video/pcd.c b/src/mame/video/pcd.c new file mode 100644 index 00000000000..3c8f305c078 --- /dev/null +++ b/src/mame/video/pcd.c @@ -0,0 +1,396 @@ +// license:BSD-3-Clause +// copyright-holders:Carl + +#include "pcd.h" +#include "cpu/mcs51/mcs51.h" +#include "cpu/mcs48/mcs48.h" + +const device_type PCD_VIDEO = &device_creator; +const device_type PCX_VIDEO = &device_creator; + +pcdx_video_device::pcdx_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + m_maincpu(*this, ":maincpu"), + m_mcu(*this, "graphics"), + m_crtc(*this, "crtc"), + m_palette(*this, "palette"), + m_gfxdecode(*this, "gfxdecode") +{ +} + +pcd_video_device::pcd_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + pcdx_video_device(mconfig, PCD_VIDEO, "Siemens PC-D Video", tag, owner, clock, "pcd_video", __FILE__), + m_vram(32*1024), + m_charram(8*1024) +{ +} + +pcx_video_device::pcx_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + pcdx_video_device(mconfig, PCX_VIDEO, "Siemens PC-X Video", tag, owner, clock, "pcx_video", __FILE__), + device_serial_interface(mconfig, *this), + m_vram(4*1024), + m_charrom(*this, "char"), + m_pic2(*this, ":pic2"), + m_txd_handler(*this) +{ +} + +ROM_START( pcd_video ) + ROM_REGION(0x400, "graphics", 0) + ROM_LOAD("s36361-d321-v1.bin", 0x000, 0x400, CRC(69baeb2a) SHA1(98b9cd0f38c51b4988a3aed0efcf004bedd115ff)) +ROM_END + +const rom_entry *pcd_video_device::device_rom_region() const +{ + return ROM_NAME( pcd_video ); +} + +ROM_START( pcx_video ) + ROM_REGION(0x2000, "char", 0) + ROM_LOAD("d12-graka.bin", 0x0000, 0x2000, CRC(e4933c16) SHA1(932ae1f0cd2b029b7f5fc3d2d1679e70b25c0828)) + + ROM_REGION(0x6000, "graphics", 0) + ROM_LOAD("d40-graka.bin", 0x0000, 0x2000, CRC(dce48252) SHA1(0d9a575b2d001168a36864d7bd5db1c3aca5fb8d)) + ROM_LOAD("d39-graka.bin", 0x4000, 0x2000, CRC(02920e25) SHA1(145a6648d75c1dc4788f9bc7790281ef7e8f8426)) +ROM_END + +const rom_entry *pcx_video_device::device_rom_region() const +{ + return ROM_NAME( pcx_video ); +} + +static const gfx_layout pcd_charlayout = +{ + 8, 14, /* 8 x 14 characters */ + 512, /* 512 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8 }, + 8*16 +}; + +static GFXDECODE_START( pcx ) + GFXDECODE_ENTRY( "char", 0x0000, pcd_charlayout, 0, 1 ) +GFXDECODE_END + +static MACHINE_CONFIG_FRAGMENT( pcd_video ) + MCFG_CPU_ADD("graphics", I8741, XTAL_16MHz/2) + MCFG_DEVICE_DISABLE() + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_SIZE(640, 350) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 349) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DEVICE("crtc", scn2674_device, screen_update) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(pcdx_video_device, pcdx) + + MCFG_SCN2674_VIDEO_ADD("crtc", 0, NULL); + MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8) + MCFG_SCN2674_GFX_CHARACTER_WIDTH(16) + MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(pcd_video_device, display_pixels) + MCFG_VIDEO_SET_SCREEN("screen") +MACHINE_CONFIG_END + +machine_config_constructor pcd_video_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pcd_video ); +} + +static ADDRESS_MAP_START( pcx_vid_map, AS_PROGRAM, 8, pcx_video_device ) + AM_RANGE(0x0000, 0x5fff) AM_ROM AM_REGION("graphics", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pcx_vid_io, AS_IO, 8, pcx_video_device ) + AM_RANGE(0x8000, 0x8007) AM_DEVREADWRITE("crtc", scn2674_device, read, write) + AM_RANGE(0x8008, 0x8008) AM_READ(unk_r) + AM_RANGE(0xa000, 0xa001) AM_READWRITE(vram_latch_r, vram_latch_w) + AM_RANGE(0xa002, 0xa003) AM_READWRITE(term_mcu_r, term_mcu_w) + AM_RANGE(0xc000, 0xc7ff) AM_RAM + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_WRITE(p1_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pcx_vram, AS_0, 8, pcx_video_device ) + AM_RANGE(0x0000, 0x07ff) AM_READWRITE(vram_r, vram_w) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( pcx_video ) + MCFG_CPU_ADD("graphics", I8031, XTAL_24MHz/2) + MCFG_CPU_PROGRAM_MAP(pcx_vid_map) + MCFG_CPU_IO_MAP(pcx_vid_io) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_SIZE(640, 350) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 349) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_UPDATE_DEVICE("crtc", scn2674_device, screen_update) + + MCFG_GFXDECODE_ADD("gfxdecode", "palette", pcx) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + MCFG_SCN2674_VIDEO_ADD("crtc", 0, INPUTLINE("graphics", MCS51_INT0_LINE)); + MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8) + MCFG_SCN2674_GFX_CHARACTER_WIDTH(16) + MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(pcx_video_device, display_pixels) + MCFG_VIDEO_SET_SCREEN("screen") + MCFG_DEVICE_ADDRESS_MAP(AS_0, pcx_vram) +MACHINE_CONFIG_END + +machine_config_constructor pcx_video_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pcx_video ); +} + +SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) +{ + address <<= 1; + if(lg) + { + UINT16 data = m_vram[address + 1] | (m_vram[address] << 8); + for(int i = 0; i < 16; i++) + bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (15 - i))) ? 1 : 0); + } + else + { + UINT8 data, attr; + int bgnd = 0; + data = m_charram[m_vram[address] * 16 + linecount]; + attr = m_vram[address + 1]; + if(cursor && blink) + data = 0xff; + if(ul && (attr & 0x20)) + data = 0xff; + if(attr & 8) + bgnd = 2; + if(attr & 0x10) + data = ~data; + for(int i = 0; i < 8; i++) + bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? 1 : bgnd); + } +} + +SCN2674_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels) +{ + UINT8 data; + address <<= 1; + data = m_charrom[m_vram[address] * 16 + linecount + (m_vram[address + 1] & 0x20 ? 4096 : 0)]; + if(cursor && blink) + data = 0xff; + if(m_p1 & 0x20) + data = ~data; + for(int i = 0; i < 8; i++) + bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? 1 : 0); +} + +PALETTE_INIT_MEMBER(pcdx_video_device, pcdx) +{ + palette.set_pen_color(0,rgb_t::black); + palette.set_pen_color(1,rgb_t::white); + palette.set_pen_color(2,rgb_t(128,128,128)); +} + +WRITE8_MEMBER(pcd_video_device::vram_w) +{ + if(m_vram_sw) + m_vram[offset] = data; + else if(!(offset & 1)) + { + offset >>= 1; + m_charram[offset & 0x1fff] = data; + m_gfxdecode->gfx(0)->mark_dirty(offset/16); + } +} + +READ8_MEMBER(pcd_video_device::vram_r) +{ + return m_vram[offset]; +} + +WRITE8_MEMBER(pcd_video_device::vram_sw_w) +{ + m_vram_sw = data & 1; +} + + +READ8_MEMBER(pcd_video_device::mcu_r) +{ + return 0x20; +} + +WRITE8_MEMBER(pcd_video_device::mcu_w) +{ +} + +READ8_MEMBER(pcx_video_device::term_r) +{ + switch(offset) + { + case 0: + m_pic2->ir0_w(CLEAR_LINE); + m_term_stat &= ~2; + return m_term_key; + case 1: + m_pic2->ir0_w(CLEAR_LINE); + return m_term_stat >> 1; + } + return 0xff; +} + +WRITE8_MEMBER(pcx_video_device::term_w) +{ + if(!offset) + { + m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE); + m_term_char = data; + m_term_stat |= 4; + } +} + +READ8_MEMBER(pcx_video_device::term_mcu_r) +{ + switch(offset) + { + case 0: + m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE); + m_pic2->ir0_w(ASSERT_LINE); + m_term_stat &= ~4; + return m_term_char; + case 1: + return m_term_stat; + } + return 0; +} + +WRITE8_MEMBER(pcx_video_device::term_mcu_w) +{ + if(!offset) + { + m_term_key = data; + m_pic2->ir0_w(ASSERT_LINE); + m_term_stat |= 2; + } +} + +WRITE8_MEMBER(pcx_video_device::vram_w) +{ + offset <<= 1; + m_vram[offset] = m_vram_latch_w[0]; + m_vram[offset+1] = m_vram_latch_w[1]; +} + +READ8_MEMBER(pcx_video_device::vram_r) +{ + offset <<= 1; + m_vram_latch_r[0] = m_vram[offset]; + m_vram_latch_r[1] = m_vram[offset+1]; + return m_vram[offset]; +} + +WRITE8_MEMBER(pcx_video_device::vram_latch_w) +{ + m_vram_latch_w[offset] = data; +} + +READ8_MEMBER(pcx_video_device::vram_latch_r) +{ + return m_vram_latch_r[offset]; +} + +READ8_MEMBER(pcdx_video_device::detect_r) +{ + return 0; +} + +WRITE8_MEMBER(pcdx_video_device::detect_w) +{ +} + +READ8_MEMBER(pcx_video_device::unk_r) +{ + return 0x80; +} + +WRITE8_MEMBER(pcx_video_device::p1_w) +{ + m_p1 = data; +} + +void pcd_video_device::device_start() +{ + m_maincpu->space(AS_IO).install_readwrite_handler(0xfb00, 0xfb01, 0, 0, read8_delegate(FUNC(pcdx_video_device::detect_r), this), write8_delegate(FUNC(pcdx_video_device::detect_w), this), 0xff00); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf0000, 0xf7fff, 0, 0, read8_delegate(FUNC(pcd_video_device::vram_r), this), write8_delegate(FUNC(pcd_video_device::vram_w), this), 0xffff); + m_gfxdecode->set_gfx(0, global_alloc(gfx_element(machine().device("palette"), pcd_charlayout, &m_charram[0], 0, 1, 0))); +} + +void pcd_video_device::device_reset() +{ + m_vram_sw = 1; +} + +DEVICE_ADDRESS_MAP_START(map, 16, pcd_video_device) + AM_RANGE(0x00, 0x0f) AM_DEVWRITE8("crtc", scn2674_device, write, 0x00ff) + AM_RANGE(0x00, 0x0f) AM_DEVREAD8("crtc", scn2674_device, read, 0xff00) + AM_RANGE(0x20, 0x21) AM_WRITE8(vram_sw_w, 0x00ff) + AM_RANGE(0x30, 0x33) AM_READWRITE8(mcu_r, mcu_w, 0x00ff) +ADDRESS_MAP_END + +void pcx_video_device::device_start() +{ + mcs51_cpu_device *mcu = downcast(m_mcu.target()); + m_maincpu->space(AS_IO).install_readwrite_handler(0xfb00, 0xfb01, 0, 0, read8_delegate(FUNC(pcdx_video_device::detect_r), this), write8_delegate(FUNC(pcdx_video_device::detect_w), this), 0x00ff); + m_txd_handler.resolve_safe(); + + // set serial callbacks + mcu->i8051_set_serial_tx_callback(WRITE8_DELEGATE(pcx_video_device, tx_callback)); + mcu->i8051_set_serial_rx_callback(READ8_DELEGATE(pcx_video_device, rx_callback)); + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); + set_rate(600*2); // FIXME: fix the keyboard when the mc2661 baud rate calc is fixed +} + +void pcx_video_device::device_reset() +{ + m_term_key = 0; + m_term_stat = 0; + transmit_register_reset(); + receive_register_reset(); + + m_txd_handler(1); +} + +DEVICE_ADDRESS_MAP_START(map, 16, pcx_video_device) + AM_RANGE(0x0, 0xf) AM_READWRITE8(term_r, term_w, 0xffff) +ADDRESS_MAP_END + +READ8_MEMBER(pcx_video_device::rx_callback) +{ + return get_received_char(); +} + +WRITE8_MEMBER(pcx_video_device::tx_callback) +{ + transmit_register_setup(data); +} + +void pcx_video_device::tra_callback() +{ + m_txd_handler(transmit_register_get_data_bit()); +} + +void pcx_video_device::rcv_complete() +{ + receive_register_extract(); + m_mcu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); + m_mcu->set_input_line(MCS51_RX_LINE, CLEAR_LINE); +} + +void pcx_video_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + device_serial_interface::device_timer(timer, id, param, ptr); +} diff --git a/src/mame/video/pcd.h b/src/mame/video/pcd.h new file mode 100644 index 00000000000..52b61298d52 --- /dev/null +++ b/src/mame/video/pcd.h @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:Carl + +#ifndef _PCD_H_ +#define _PCD_H_ + +#include "emu.h" +#include "machine/pic8259.h" +#include "video/scn2674.h" + +#define MCFG_PCX_VIDEO_TXD_HANDLER(_devcb) \ + devcb = &pcx_video_device::set_txd_handler(*device, DEVCB_##_devcb); + +class pcdx_video_device : public device_t +{ +public: + pcdx_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + virtual DECLARE_ADDRESS_MAP(map, 16) = 0; + DECLARE_READ8_MEMBER(detect_r); + DECLARE_WRITE8_MEMBER(detect_w); + DECLARE_PALETTE_INIT(pcdx); + +protected: + required_device m_maincpu; + required_device m_mcu; + required_device m_crtc; + required_device m_palette; + required_device m_gfxdecode; +}; + +class pcd_video_device : public pcdx_video_device +{ +public: + pcd_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_ADDRESS_MAP(map, 16); + DECLARE_ADDRESS_MAP(vram_map, 8); + DECLARE_READ8_MEMBER(mcu_r); + DECLARE_WRITE8_MEMBER(mcu_w); + DECLARE_WRITE8_MEMBER(vram_sw_w); + DECLARE_READ8_MEMBER(vram_r); + DECLARE_WRITE8_MEMBER(vram_w); + + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + SCN2674_DRAW_CHARACTER_MEMBER(display_pixels); +protected: + void device_start(); + void device_reset(); +private: + dynamic_buffer m_vram; + dynamic_buffer m_charram; + UINT8 m_vram_sw; +}; + +class pcx_video_device : public pcdx_video_device, + public device_serial_interface +{ +public: + pcx_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + template static devcb_base &set_txd_handler(device_t &device, _Object object) { return downcast(device).m_txd_handler.set_callback(object); } + + DECLARE_ADDRESS_MAP(map, 16); + DECLARE_READ8_MEMBER(term_r); + DECLARE_WRITE8_MEMBER(term_w); + DECLARE_READ8_MEMBER(term_mcu_r); + DECLARE_WRITE8_MEMBER(term_mcu_w); + DECLARE_READ8_MEMBER(rx_callback); + DECLARE_WRITE8_MEMBER(tx_callback); + DECLARE_READ8_MEMBER(vram_r); + DECLARE_WRITE8_MEMBER(vram_w); + DECLARE_READ8_MEMBER(vram_latch_r); + DECLARE_WRITE8_MEMBER(vram_latch_w); + DECLARE_READ8_MEMBER(unk_r); + DECLARE_WRITE8_MEMBER(p1_w); + + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + SCN2674_DRAW_CHARACTER_MEMBER(display_pixels); +protected: + void device_start(); + void device_reset(); + void tra_callback(); + void rcv_complete(); + void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +private: + dynamic_buffer m_vram; + required_region_ptr m_charrom; + required_device m_pic2; + devcb_write_line m_txd_handler; + UINT8 m_term_key, m_term_char, m_term_stat, m_vram_latch_r[2], m_vram_latch_w[2], m_p1; +}; + +extern const device_type PCD_VIDEO; +extern const device_type PCX_VIDEO; + +#endif diff --git a/src/mame/video/pcw.c b/src/mame/video/pcw.c new file mode 100644 index 00000000000..f4d18761636 --- /dev/null +++ b/src/mame/video/pcw.c @@ -0,0 +1,187 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/*************************************************************************** + + pcw.c + + Functions to emulate the video hardware of the Amstrad PCW. + +***************************************************************************/ + +#include "emu.h" +#include "includes/pcw.h" +#include "machine/ram.h" + +inline void pcw_state::pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix16(y, x) = (UINT16)color; +} + +/*************************************************************************** + Start the video hardware emulation. +***************************************************************************/ + +void pcw_state::video_start() +{ + rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1); + + m_prn_output = auto_bitmap_ind16_alloc(machine(),PCW_PRINTER_WIDTH,PCW_PRINTER_HEIGHT); + m_prn_output->fill(1, rect); +} + +#if 0 +/* two colours */ +static const unsigned short pcw_colour_table[PCW_NUM_COLOURS] = +{ + 0, 1 +}; +#endif + +/* black/white */ +static const rgb_t pcw_palette[PCW_NUM_COLOURS] = +{ + rgb_t(0x000, 0x000, 0x000), + rgb_t(0x0ff, 0x0ff, 0x0ff) +}; + + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(pcw_state, pcw) +{ + palette.set_pen_colors(0, pcw_palette, ARRAY_LENGTH(pcw_palette)); +} + +/*************************************************************************** + Draw the game screen in the given bitmap_ind16. + Do NOT call osd_update_display() from this function, + it will be called by the main emulation engine. +***************************************************************************/ +UINT32 pcw_state::screen_update_pcw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,b; + unsigned short roller_ram_offs; + unsigned char *roller_ram_ptr; + int pen0,pen1; + + pen0 = 0; + pen1 = 1; + + /* invert? */ + if (m_vdu_video_control_register & (1<<7)) + { + /* yes */ + pen1^=1; + pen0^=1; + } + + /* video enable? */ + if ((m_vdu_video_control_register & (1<<6))!=0) + { + /* render top border */ + rectangle rect(0, PCW_SCREEN_WIDTH, 0, PCW_BORDER_HEIGHT); + bitmap.fill(pen0, rect); + + /* render bottom border */ + rect.set(0, PCW_SCREEN_WIDTH, PCW_BORDER_HEIGHT + PCW_DISPLAY_HEIGHT, PCW_BORDER_HEIGHT + PCW_DISPLAY_HEIGHT + PCW_BORDER_HEIGHT); + bitmap.fill(pen0, rect); + + /* offset to start in table */ + roller_ram_offs = (m_roller_ram_offset<<1); + + for (y=0; y<256; y++) + { + int by; + unsigned short line_data; + unsigned char *line_ptr; + + x = PCW_BORDER_WIDTH; + + roller_ram_ptr = m_ram->pointer() + m_roller_ram_addr + roller_ram_offs; + + /* get line address */ + /* 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. */ + line_data = ((unsigned char *)roller_ram_ptr)[0] | (((unsigned char *)roller_ram_ptr)[1]<<8); + + /* calculate address of pixel data */ + line_ptr = m_ram->pointer() + ((line_data & 0x0e000)<<1) + ((line_data & 0x01ff8)<<1) + (line_data & 0x07); + + for (by=0; by<90; by++) + { + unsigned char byte; + + byte = line_ptr[0]; + + for (b=0; b<8; b++) + { + if (byte & 0x080) + { + pcw_plot_pixel(bitmap,x+b, y+PCW_BORDER_HEIGHT, pen1); + } + else + { + pcw_plot_pixel(bitmap,x+b, y+PCW_BORDER_HEIGHT, pen0); + + } + byte = byte<<1; + } + + x = x + 8; + + + line_ptr = line_ptr+8; + } + + /* update offset, wrap within 512 byte range */ + roller_ram_offs+=2; + roller_ram_offs&=511; + + } + + /* render border */ + /* 8 pixels either side of display */ + for (y=0; y<256; y++) + { + pcw_plot_pixel(bitmap, 0, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, 1, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, 2, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, 3, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, 4, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, 5, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, 6, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, 7, y+PCW_BORDER_HEIGHT, pen0); + + pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+0, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+1, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+2, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+3, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+4, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+5, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+6, y+PCW_BORDER_HEIGHT, pen0); + pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+7, y+PCW_BORDER_HEIGHT, pen0); + } + } + else + { + /* not video - render whole lot in pen 0 */ + rectangle rect(0, PCW_SCREEN_WIDTH, 0, PCW_SCREEN_HEIGHT); + bitmap.fill(pen0, rect); + } + return 0; +} + +UINT32 pcw_state::screen_update_pcw_printer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // printer output + INT32 feed; + rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1); + feed = -(m_paper_feed / 2); + copyscrollbitmap(bitmap,*m_prn_output,0,NULL,1,&feed,rect); + bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos) = 0; + bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos) = 0; + bitmap.pix16(PCW_PRINTER_HEIGHT-3, m_printer_headpos) = 0; + bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos-1) = 0; + bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos-1) = 0; + bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos+1) = 0; + bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos+1) = 0; + return 0; +} diff --git a/src/mame/video/pcw16.c b/src/mame/video/pcw16.c new file mode 100644 index 00000000000..40324af4e7e --- /dev/null +++ b/src/mame/video/pcw16.c @@ -0,0 +1,268 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +#include "emu.h" +#include "includes/pcw16.h" +#include "machine/ram.h" + + +#if 0 +/* 16 colours, + 1 for border */ +static const unsigned short pcw16_colour_table[PCW16_NUM_COLOURS] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31 +}; +#endif + +static const rgb_t pcw16_palette[PCW16_NUM_COLOURS] = +{ + rgb_t(0x080, 0x080, 0x080), /* light grey */ + rgb_t(0x080, 0x080, 0x080), /* light grey */ + rgb_t(0x000, 0x080, 0x080), /* magenta */ + rgb_t(0x000, 0x080, 0x080), /* magenta */ + rgb_t(0x080, 0x080, 0x080), /* light grey */ + rgb_t(0x080, 0x080, 0x080), /* light grey */ + rgb_t(0x0ff, 0x080, 0x080), /* pastel green */ + rgb_t(0x0ff, 0x080, 0x080), /* pastel green */ + rgb_t(0x000, 0x000, 0x080), /* blue */ + rgb_t(0x000, 0x000, 0x000), /* black */ + rgb_t(0x000, 0x080, 0x0ff), /* mauve */ + rgb_t(0x000, 0x000, 0x0ff), /* bright blue */ + rgb_t(0x000, 0x080, 0x000), /* red */ + rgb_t(0x000, 0x0ff, 0x000), /* bright red */ + rgb_t(0x000, 0x0ff, 0x080), /* purple */ + rgb_t(0x000, 0x0ff, 0x0ff), /* bright magenta */ + rgb_t(0x0ff, 0x000, 0x080), /* sea green */ + rgb_t(0x0ff, 0x000, 0x0ff), /* bright green */ + rgb_t(0x0ff, 0x080, 0x0ff), /* pastel cyan */ + rgb_t(0x0ff, 0x000, 0x0ff), /* bright cyan */ + rgb_t(0x0ff, 0x080, 0x000), /* lime green */ + rgb_t(0x0ff, 0x0ff, 0x000), /* bright yellow */ + rgb_t(0x0ff, 0x0ff, 0x080), /* pastel yellow */ + rgb_t(0x0ff, 0x0ff, 0x0ff), /* bright white */ + rgb_t(0x080, 0x000, 0x080), /* cyan */ + rgb_t(0x080, 0x000, 0x000), /* green */ + rgb_t(0x080, 0x080, 0x0ff), /* pastel blue */ + rgb_t(0x080, 0x000, 0x0ff), /* sky blue */ + rgb_t(0x080, 0x080, 0x000), /* yellow */ + rgb_t(0x080, 0x0ff, 0x000), /* orange */ + rgb_t(0x080, 0x0ff, 0x080), /* pink */ + rgb_t(0x080, 0x0ff, 0x0ff), /* pastel magenta */ +}; + + +inline void pcw16_state::pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix16(y, x) = (UINT16)color; +} + +/* Initialise the palette */ +PALETTE_INIT_MEMBER(pcw16_state, pcw16) +{ + palette.set_pen_colors(0, pcw16_palette, ARRAY_LENGTH(pcw16_palette)); +} + +void pcw16_state::video_start() +{ +} + +/* 640, 1 bit per pixel */ +void pcw16_state::pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) +{ + int b; + int local_byte; + int cols[2]; + int px; + + local_byte = byte; + + cols[0] = m_colour_palette[0]; + cols[1] = m_colour_palette[1]; + + px = x; + for (b=0; b<8; b++) + { + pcw16_plot_pixel(bitmap, px, y, cols[(local_byte>>7) & 0x01]); + px++; + + local_byte = local_byte<<1; + } +} + +/* 320, 2 bits per pixel */ +void pcw16_state::pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) +{ + int b; + int px; + int local_byte; + int cols[4]; + + for (b=0; b<3; b++) + { + cols[b] = m_colour_palette[b]; + } + + local_byte = byte; + + px = x; + for (b=0; b<4; b++) + { + int col; + + col = cols[((local_byte>>6) & 0x03)]; + + pcw16_plot_pixel(bitmap, px, y, col); + px++; + pcw16_plot_pixel(bitmap, px, y, col); + px++; + + local_byte = local_byte<<2; + } +} + +/* 160, 4 bits per pixel */ +void pcw16_state::pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) +{ + int px; + int b; + int local_byte; + int cols[2]; + + cols[0] = m_colour_palette[0]; + cols[1] = m_colour_palette[1]; + local_byte = byte; + + px = x; + for (b=0; b<2; b++) + { + int col; + + col = cols[((local_byte>>4)&0x0f)]; + + pcw16_plot_pixel(bitmap, px, y, col); + px++; + pcw16_plot_pixel(bitmap, px, y, col); + px++; + pcw16_plot_pixel(bitmap, px, y, col); + px++; + pcw16_plot_pixel(bitmap, px, y, col); + px++; + + local_byte = local_byte<<4; + } +} + +/*************************************************************************** + Draw the game screen in the given bitmap_ind16. + Do NOT call osd_update_display() from this function, + it will be called by the main emulation engine. +***************************************************************************/ +UINT32 pcw16_state::screen_update_pcw16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *ram = m_ram->pointer(); + unsigned char *pScanLine = (unsigned char *)ram + 0x0fc00; //0x03c00; //0x020FC00; + + int y; + int x; + + int border_colour; + + border_colour = m_video_control & 31; + + /* reverse video? */ + if (m_video_control & (1<<7)) + { + /* colour 0 and colour 1 need to be inverted? - what happens in mode 1 and 2 - ignored? or is bit 1 toggled, + or is whole lot toggled? */ + + /* force border to be colour 1 */ + border_colour = m_colour_palette[1]; + } + + if ((m_video_control & (1<<6))==0) + { + /* blank */ + rectangle rect(0, PCW16_SCREEN_WIDTH, 0, PCW16_SCREEN_HEIGHT); + bitmap.fill(border_colour, rect); + } + else + { + /* no blank */ + + + /* render top border */ + rectangle rect(0, PCW16_SCREEN_WIDTH, 0, PCW16_BORDER_HEIGHT); + bitmap.fill(border_colour, rect); + + /* render bottom border */ + rect.set(0, PCW16_SCREEN_WIDTH, PCW16_BORDER_HEIGHT + PCW16_DISPLAY_HEIGHT, PCW16_BORDER_HEIGHT + PCW16_DISPLAY_HEIGHT + PCW16_BORDER_HEIGHT); + bitmap.fill(border_colour, rect); + + /* render border on either side of display */ + bitmap.plot_box(0, PCW16_BORDER_HEIGHT, 8, PCW16_DISPLAY_HEIGHT, border_colour); + bitmap.plot_box(PCW16_DISPLAY_WIDTH + PCW16_BORDER_WIDTH, PCW16_BORDER_HEIGHT, 8, PCW16_DISPLAY_HEIGHT, border_colour); + + /* render display */ + for (y=0; y>14) & 0x03); + + /* set initial x position */ + x = PCW16_BORDER_WIDTH; + + for (b=0; b<80; b++) + { + int byte; + + byte = ram[Addr]; + + switch (mode) + { + case 0: + { + pcw16_vh_decode_mode0(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); + } + break; + + case 1: + { + pcw16_vh_decode_mode1(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); + } + break; + + case 3: + case 2: + { + pcw16_vh_decode_mode2(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); + } + break; + } + + /* only lowest 16 bits are incremented between fetches */ + Addr = ((Addr+1) & 0x0ffff) | AddrUpper; + + x=x+8; + } + + pScanLine+=2; + } + } + return 0; +} diff --git a/src/mame/video/pdp1.c b/src/mame/video/pdp1.c new file mode 100644 index 00000000000..2e91b2cadeb --- /dev/null +++ b/src/mame/video/pdp1.c @@ -0,0 +1,591 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + video/pdp1.c + + PDP1 video emulation. + + We emulate three display devices: + * CRT screen + * control panel + * typewriter output + + For the actual emulation of these devices look at the machine/pdp1.c. This + file only includes the display routines. + + Raphael Nabet 2002-2004 + Based on earlier work by Chris Salomon +*/ + +#include + +#include "emu.h" +#include "cpu/pdp1/pdp1.h" +#include "includes/pdp1.h" + + + + +inline void pdp1_state::pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix16(y, x) = color; +} + +/* + video init +*/ +void pdp1_state::video_start() +{ + m_typewriter_color = color_typewriter_black; + + /* alloc bitmaps for our private fun */ + m_panel_bitmap.allocate(panel_window_width, panel_window_height, BITMAP_FORMAT_IND16); + m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16); + + /* set up out bitmaps */ + pdp1_draw_panel_backdrop(m_panel_bitmap); + + const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1); + m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds); +} + + +void pdp1_state::screen_eof_pdp1(screen_device &screen, bool state) +{ + // rising edge + if (state) + { + m_crt->eof(); + } +} + +/* + schedule a pixel to be plotted +*/ +void pdp1_state::pdp1_plot(int x, int y) +{ + /* compute pixel coordinates and plot */ + x = x*crt_window_width/01777; + y = y*crt_window_height/01777; + m_crt->plot(x, y); +} + + +/* + video_update_pdp1: effectively redraw the screen +*/ +UINT32 pdp1_state::screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + pdp1_erase_lightpen(bitmap); + m_crt->update(bitmap); + pdp1_draw_lightpen(bitmap); + + pdp1_draw_panel(m_panel_bitmap); + copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect); + + copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect); + return 0; +} + + + +/* + Operator control panel code +*/ + +enum +{ + x_panel_col1_offset = 8, + x_panel_col2_offset = x_panel_col1_offset+144+8, + x_panel_col3_offset = x_panel_col2_offset+96+8 +}; + +enum +{ + /* column 1: registers, test word, test address */ + y_panel_pc_offset = 0, + y_panel_ma_offset = y_panel_pc_offset+2*8, + y_panel_mb_offset = y_panel_ma_offset+2*8, + y_panel_ac_offset = y_panel_mb_offset+2*8, + y_panel_io_offset = y_panel_ac_offset+2*8, + y_panel_ta_offset = y_panel_io_offset+2*8, /* test address and extend switch */ + y_panel_tw_offset = y_panel_ta_offset+2*8, + + /* column 2: 1-bit indicators */ + y_panel_run_offset = 8, + y_panel_cyc_offset = y_panel_run_offset+8, + y_panel_defer_offset = y_panel_cyc_offset+8, + y_panel_hs_cyc_offset = y_panel_defer_offset+8, + y_panel_brk_ctr_1_offset = y_panel_hs_cyc_offset+8, + y_panel_brk_ctr_2_offset = y_panel_brk_ctr_1_offset+8, + y_panel_ov_offset = y_panel_brk_ctr_2_offset+8, + y_panel_rim_offset = y_panel_ov_offset+8, + y_panel_sbm_offset = y_panel_rim_offset+8, + y_panel_exd_offset = y_panel_sbm_offset+8, + y_panel_ioh_offset = y_panel_exd_offset+8, + y_panel_ioc_offset = y_panel_ioh_offset+8, + y_panel_ios_offset = y_panel_ioc_offset+8, + + /* column 3: power, single step, single inst, sense, flags, instr... */ + y_panel_power_offset = 8, + y_panel_sngl_step_offset = y_panel_power_offset+8, + y_panel_sngl_inst_offset = y_panel_sngl_step_offset+8, + y_panel_sep1_offset = y_panel_sngl_inst_offset+8, + y_panel_ss_offset = y_panel_sep1_offset+8, + y_panel_sep2_offset = y_panel_ss_offset+3*8, + y_panel_pf_offset = y_panel_sep2_offset+8, + y_panel_ir_offset = y_panel_pf_offset+2*8 +}; + +/* draw a small 8*8 LED (or is this a lamp? ) */ +void pdp1_state::pdp1_draw_led(bitmap_ind16 &bitmap, int x, int y, int state) +{ + int xx, yy; + + for (yy=1; yy<7; yy++) + for (xx=1; xx<7; xx++) + pdp1_plot_pixel(bitmap, x+xx, y+yy, state ? pen_lit_lamp : pen_unlit_lamp); +} + +/* draw nb_bits leds which represent nb_bits bits in value */ +void pdp1_state::pdp1_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) +{ + while (nb_bits) + { + nb_bits--; + + pdp1_draw_led(bitmap, x, y, (value >> nb_bits) & 1); + + x += 8; + } +} + + +/* draw a small 8*8 switch */ +void pdp1_state::pdp1_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state) +{ + int xx, yy; + int i; + + /* erase area */ + for (yy=0; yy<8; yy++) + for (xx=0; xx<8; xx++) + pdp1_plot_pixel(bitmap, x+xx, y+yy, pen_panel_bg); + + + /* draw nut (-> circle) */ + for (i=0; i<4;i++) + { + pdp1_plot_pixel(bitmap, x+2+i, y+1, pen_switch_nut); + pdp1_plot_pixel(bitmap, x+2+i, y+6, pen_switch_nut); + pdp1_plot_pixel(bitmap, x+1, y+2+i, pen_switch_nut); + pdp1_plot_pixel(bitmap, x+6, y+2+i, pen_switch_nut); + } + pdp1_plot_pixel(bitmap, x+2, y+2, pen_switch_nut); + pdp1_plot_pixel(bitmap, x+5, y+2, pen_switch_nut); + pdp1_plot_pixel(bitmap, x+2, y+5, pen_switch_nut); + pdp1_plot_pixel(bitmap, x+5, y+5, pen_switch_nut); + + /* draw button (->disc) */ + if (! state) + y += 4; + for (i=0; i<2;i++) + { + pdp1_plot_pixel(bitmap, x+3+i, y, pen_switch_button); + pdp1_plot_pixel(bitmap, x+3+i, y+3, pen_switch_button); + } + for (i=0; i<4;i++) + { + pdp1_plot_pixel(bitmap, x+2+i, y+1, pen_switch_button); + pdp1_plot_pixel(bitmap, x+2+i, y+2, pen_switch_button); + } +} + + +/* draw nb_bits switches which represent nb_bits bits in value */ +void pdp1_state::pdp1_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) +{ + while (nb_bits) + { + nb_bits--; + + pdp1_draw_switch(bitmap, x, y, (value >> nb_bits) & 1); + + x += 8; + } +} + + +/* write a single char on screen */ +void pdp1_state::pdp1_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color) +{ + m_gfxdecode->gfx(0)->transpen(bitmap,bitmap.cliprect(), character-32, color, 0, 0, + x+1, y, 0); +} + +/* write a string on screen */ +void pdp1_state::pdp1_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) +{ + while (* buf) + { + pdp1_draw_char(bitmap, *buf, x, y, color); + + x += 8; + buf++; + } +} + + +/* + draw the operator control panel (fixed backdrop) +*/ +void pdp1_state::pdp1_draw_panel_backdrop(bitmap_ind16 &bitmap) +{ + /* fill with black */ + const rectangle panel_bitmap_bounds(0, panel_window_width-1, 0, panel_window_height-1); + m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds); + + /* column 1: registers, test word, test address */ + pdp1_draw_string(bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption); + pdp1_draw_string(bitmap, "memory address", x_panel_col1_offset, y_panel_ma_offset, color_panel_caption); + pdp1_draw_string(bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption); + pdp1_draw_string(bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption); + pdp1_draw_string(bitmap, "in-out", x_panel_col1_offset, y_panel_io_offset, color_panel_caption); + pdp1_draw_string(bitmap, "extend address", x_panel_col1_offset, y_panel_ta_offset, color_panel_caption); + pdp1_draw_string(bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption); + + /* column separator */ + bitmap.plot_box(x_panel_col2_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption); + + /* column 2: 1-bit indicators */ + pdp1_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); + pdp1_draw_string(bitmap, "cycle", x_panel_col2_offset+8, y_panel_cyc_offset, color_panel_caption); + pdp1_draw_string(bitmap, "defer", x_panel_col2_offset+8, y_panel_defer_offset, color_panel_caption); + pdp1_draw_string(bitmap, "h. s. cycle", x_panel_col2_offset+8, y_panel_hs_cyc_offset, color_panel_caption); + pdp1_draw_string(bitmap, "brk. ctr. 1", x_panel_col2_offset+8, y_panel_brk_ctr_1_offset, color_panel_caption); + pdp1_draw_string(bitmap, "brk. ctr. 2", x_panel_col2_offset+8, y_panel_brk_ctr_2_offset, color_panel_caption); + pdp1_draw_string(bitmap, "overflow", x_panel_col2_offset+8, y_panel_ov_offset, color_panel_caption); + pdp1_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); + pdp1_draw_string(bitmap, "seq. break", x_panel_col2_offset+8, y_panel_sbm_offset, color_panel_caption); + pdp1_draw_string(bitmap, "extend", x_panel_col2_offset+8, y_panel_exd_offset, color_panel_caption); + pdp1_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); + pdp1_draw_string(bitmap, "i-o com'ds", x_panel_col2_offset+8, y_panel_ioc_offset, color_panel_caption); + pdp1_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); + + /* column separator */ + bitmap.plot_box(x_panel_col3_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption); + + /* column 3: power, single step, single inst, sense, flags, instr... */ + pdp1_draw_string(bitmap, "power", x_panel_col3_offset+16, y_panel_power_offset, color_panel_caption); + pdp1_draw_string(bitmap, "single step", x_panel_col3_offset+16, y_panel_sngl_step_offset, color_panel_caption); + pdp1_draw_string(bitmap, "single inst.", x_panel_col3_offset+16, y_panel_sngl_inst_offset, color_panel_caption); + /* separator */ + bitmap.plot_box(x_panel_col3_offset+8, y_panel_sep1_offset+4, 96, 1, pen_panel_caption); + pdp1_draw_string(bitmap, "sense switches", x_panel_col3_offset, y_panel_ss_offset, color_panel_caption); + /* separator */ + bitmap.plot_box(x_panel_col3_offset+8, y_panel_sep2_offset+4, 96, 1, pen_panel_caption); + pdp1_draw_string(bitmap, "program flags", x_panel_col3_offset, y_panel_pf_offset, color_panel_caption); + pdp1_draw_string(bitmap, "instruction", x_panel_col3_offset, y_panel_ir_offset, color_panel_caption); +} + +/* + draw the operator control panel (dynamic elements) +*/ +void pdp1_state::pdp1_draw_panel(bitmap_ind16 &bitmap) +{ + /* column 1: registers, test word, test address */ + pdp1_draw_multipleled(bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8,m_maincpu->state_int(PDP1_PC), 16); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8,m_maincpu->state_int(PDP1_MA), 16); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_mb_offset+8,m_maincpu->state_int(PDP1_MB), 18); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_ac_offset+8,m_maincpu->state_int(PDP1_AC), 18); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_io_offset+8,m_maincpu->state_int(PDP1_IO), 18); + pdp1_draw_switch(bitmap, x_panel_col1_offset, y_panel_ta_offset+8,m_maincpu->state_int(PDP1_EXTEND_SW)); + pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8,m_maincpu->state_int(PDP1_TA), 16); + pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset, y_panel_tw_offset+8,m_maincpu->state_int(PDP1_TW), 18); + + /* column 2: 1-bit indicators */ + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset,m_maincpu->state_int(PDP1_RUN)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_cyc_offset,m_maincpu->state_int(PDP1_CYC)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_defer_offset,m_maincpu->state_int(PDP1_DEFER)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */ + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset,m_maincpu->state_int(PDP1_BRK_CTR) & 1); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset,m_maincpu->state_int(PDP1_BRK_CTR) & 2); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ov_offset,m_maincpu->state_int(PDP1_OV)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset,m_maincpu->state_int(PDP1_RIM)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_sbm_offset,m_maincpu->state_int(PDP1_SBM)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_exd_offset,m_maincpu->state_int(PDP1_EXD)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset,m_maincpu->state_int(PDP1_IOH)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioc_offset,m_maincpu->state_int(PDP1_IOC)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset,m_maincpu->state_int(PDP1_IOS)); + + /* column 3: power, single step, single inst, sense, flags, instr... */ + pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */ + pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */ + pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_step_offset,m_maincpu->state_int(PDP1_SNGL_STEP)); + pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset,m_maincpu->state_int(PDP1_SNGL_STEP)); + pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset,m_maincpu->state_int(PDP1_SNGL_INST)); + pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset,m_maincpu->state_int(PDP1_SNGL_INST)); + pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ss_offset+8,m_maincpu->state_int(PDP1_SS), 6); + pdp1_draw_multipleswitch(bitmap, x_panel_col3_offset, y_panel_ss_offset+16,m_maincpu->state_int(PDP1_SS), 6); + pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_pf_offset+8,m_maincpu->state_int(PDP1_PF), 6); + pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ir_offset+8,m_maincpu->state_int(PDP1_IR), 5); +} + + +/* + Typewriter code +*/ + + + + +enum +{ + typewriter_line_height = 8, + typewriter_write_offset_y = typewriter_window_height-typewriter_line_height, + typewriter_scroll_step = typewriter_line_height +}; + +enum +{ + tab_step = 8 +}; + + +void pdp1_state::pdp1_typewriter_linefeed() +{ + UINT8 buf[typewriter_window_width]; + int y; + + for (y=0; ypens()); + } + + const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1); + m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window); +} + +void pdp1_state::pdp1_typewriter_drawchar(int character) +{ + static const char ascii_table[2][64] = + { /* n-s = non-spacing */ + { /* lower case */ + ' ', '1', '2', '3', + '4', '5', '6', '7', + '8', '9', '*', '*', + '*', '*', '*', '*', + '0', '/', 's', 't', + 'u', 'v', 'w', 'x', + 'y', 'z', '*', ',', + '*',/*black*/ '*',/*red*/ '*',/*Tab*/ '*', + '\200',/*n-s middle dot*/'j', 'k', 'l', + 'm', 'n', 'o', 'p', + 'q', 'r', '*', '*', + '-', ')', '\201',/*n-s overstrike*/'(', + '*', 'a', 'b', 'c', + 'd', 'e', 'f', 'g', + 'h', 'i', '*',/*Lower Case*/ '.', + '*',/*Upper Case*/ '*',/*Backspace*/ '*', '*'/*Carriage Return*/ + }, + { /* upper case */ + ' ', '"', '\'', '~', + '\202',/*implies*/ '\203',/*or*/ '\204',/*and*/ '<', + '>', '\205',/*up arrow*/ '*', '*', + '*', '*', '*', '*', + '\206',/*right arrow*/'?', 'S', 'T', + 'U', 'V', 'W', 'X', + 'Y', 'Z', '*', '=', + '*',/*black*/ '*',/*red*/ '*',/*Tab*/ '*', + '_',/*n-s???*/ 'J', 'K', 'L', + 'M', 'N', 'O', 'P', + 'Q', 'R', '*', '*', + '+', ']', '|',/*n-s???*/ '[', + '*', 'A', 'B', 'C', + 'D', 'E', 'F', 'G', + 'H', 'I', '*',/*Lower Case*/ '\207',/*multiply*/ + '*',/*Upper Case*/ '*',/*Backspace*/ '*', '*'/*Carriage Return*/ + } + }; + + + + character &= 0x3f; + + switch (character) + { + case 034: + /* Black */ + m_typewriter_color = color_typewriter_black; + break; + + case 035: + /* Red */ + m_typewriter_color = color_typewriter_red; + break; + + case 036: + /* Tab */ + m_pos = m_pos + tab_step - (m_pos % tab_step); + break; + + case 072: + /* Lower case */ + m_case_shift = 0; + break; + + case 074: + /* Upper case */ + m_case_shift = 1; + break; + + case 075: + /* Backspace */ + if (m_pos) + m_pos--; + break; + + case 077: + /* Carriage Return */ + m_pos = 0; + pdp1_typewriter_linefeed(); + break; + + default: + /* Any printable character... */ + + if (m_pos >= 80) + { /* if past right border, wrap around. (Right???) */ + pdp1_typewriter_linefeed(); /* next line */ + m_pos = 0; /* return to start of line */ + } + + /* print character (lookup ASCII equivalent in table) */ + pdp1_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character], + 8*m_pos, typewriter_write_offset_y, + m_typewriter_color); /* print char */ + + if ((character!= 040) && (character!= 056)) /* 040 and 056 are non-spacing characters */ + m_pos++; /* step carriage forward */ + + break; + } +} + + + +/* + lightpen code +*/ + +void pdp1_state::pdp1_update_lightpen_state(const lightpen_t *new_state) +{ + m_lightpen_state = *new_state; +} + +#if 1 +void pdp1_state::pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_) +{ + int interval; + int a; + + x = x*crt_window_width/01777; + y = y*crt_window_width/01777; + radius = radius*crt_window_width/01777; + + interval = ceil(radius/sqrt(2.)); + + for (a=0; a<=interval; a++) + { + int b = sqrt((double)radius*radius-a*a) + .5; + + if ((x-a >= 0) && (y-b >= 0)) + pdp1_plot_pixel(bitmap, x-a, y-b, color_); + if ((x-a >= 0) && (y+b <= crt_window_height-1)) + pdp1_plot_pixel(bitmap, x-a, y+b, color_); + if ((x+a <= crt_window_width-1) && (y-b >= 0)) + pdp1_plot_pixel(bitmap, x+a, y-b, color_); + if ((x+a <= crt_window_width-1) && (y+b <= crt_window_height-1)) + pdp1_plot_pixel(bitmap, x+a, y+b, color_); + + if ((x-b >= 0) && (y-a >= 0)) + pdp1_plot_pixel(bitmap, x-b, y-a, color_); + if ((x-b >= 0) && (y+a <= crt_window_height-1)) + pdp1_plot_pixel(bitmap, x-b, y+a, color_); + if ((x+b <= crt_window_width-1) && (y-a >= 0)) + pdp1_plot_pixel(bitmap, x+b, y-a, color_); + if ((x+b <= crt_window_width-1) && (y+a <= crt_window_height-1)) + pdp1_plot_pixel(bitmap, x+b, y+a, color_); + } +} +#else +void pdp1_state::pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color) +{ + float fx, fy; + float interval; + + + fx = (float)x*crt_window_width/01777; + fy = (float)y*crt_window_height/01777; + + interval = radius/sqrt(2.); + + for (x=/*ceil*/(fx-interval); x<=fx+interval; x++) + { + float dy = sqrt(radius*radius-(x-fx)*(x-fx)); + + if ((x >= 0) && (x <= crt_window_width-1) && (fy-dy >= 0)) + pdp1_plot_pixel(bitmap, x, fy-dy, color); + if ((x >= 0) && (x <= crt_window_width-1) && (y+dy <= crt_window_height-1)) + pdp1_plot_pixel(bitmap, x, fy+dy, color); + } + for (y=/*ceil*/(fy-interval); y<=fy+interval; y++) + { + float dx = sqrt(radius*radius-(y-fy)*(y-fy)); + + if ((fx-dx >= 0) && (y >= 0) && (y <= crt_window_height-1)) + pdp1_plot_pixel(bitmap, fx-dx, y, color); + if ((fx+dx <= crt_window_width-1) && (y >= 0) && (y <= crt_window_height-1)) + pdp1_plot_pixel(bitmap, fx+dx, y, color); + } +} +#endif + +void pdp1_state::pdp1_erase_lightpen(bitmap_ind16 &bitmap) +{ + if (m_previous_lightpen_state.active) + { +#if 0 + if (m_previous_lightpen_state.x>0) + pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2-1, m_previous_lightpen_state.y/2, pen_black); + if (m_previous_lightpen_state.x<1023) + pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2+1, m_previous_lightpen_state.y/2, pen_black); + if (m_previous_lightpen_state.y>0) + pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2, m_previous_lightpen_state.y/2-1, pen_black); + if (m_previous_lightpen_state.y<1023) + pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2, m_previous_lightpen_state.y/2+1, pen_black); +#endif + pdp1_draw_circle(bitmap, m_previous_lightpen_state.x, m_previous_lightpen_state.y, m_previous_lightpen_state.radius, pen_black); + } +} + +void pdp1_state::pdp1_draw_lightpen(bitmap_ind16 &bitmap) +{ + if (m_lightpen_state.active) + { + int color_ = m_lightpen_state.down ? pen_lightpen_pressed : pen_lightpen_nonpressed; +#if 0 + if (m_lightpen_state.x>0) + pdp1_plot_pixel(bitmap, m_lightpen_state.x/2-1, m_lightpen_state.y/2, color); + if (m_lightpen_state.x<1023) + pdp1_plot_pixel(bitmap, m_lightpen_state.x/2+1, m_lightpen_state.y/2, color); + if (m_lightpen_state.y>0) + pdp1_plot_pixel(bitmap, m_lightpen_state.x/2, m_lightpen_state.y/2-1, color); + if (m_lightpen_state.y<1023) + pdp1_plot_pixel(bitmap, m_lightpen_state.x/2, m_lightpen_state.y/2+1, color); +#endif + pdp1_draw_circle(bitmap, m_lightpen_state.x, m_lightpen_state.y, m_lightpen_state.radius, color_); + } + m_previous_lightpen_state = m_lightpen_state; +} diff --git a/src/mame/video/pecom.c b/src/mame/video/pecom.c new file mode 100644 index 00000000000..795e97f8ef4 --- /dev/null +++ b/src/mame/video/pecom.c @@ -0,0 +1,109 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Pecom driver by Miodrag Milanovic + + 08/11/2008 Preliminary driver. + +****************************************************************************/ + +#include "emu.h" +#include "sound/cdp1869.h" +#include "sound/wave.h" +#include "cpu/cosmac/cosmac.h" +#include "includes/pecom.h" + +WRITE8_MEMBER(pecom_state::pecom_cdp1869_w) +{ + UINT16 ma = m_cdp1802->get_memory_address(); + + switch (offset + 3) + { + case 3: + m_cdp1869->out3_w(space, ma, data); + break; + + case 4: + m_cdp1869->out4_w(space, ma, data); + break; + + case 5: + m_cdp1869->out5_w(space, ma, data); + break; + + case 6: + m_cdp1869->out6_w(space, ma, data); + break; + + case 7: + m_cdp1869->out7_w(space, ma, data); + break; + } +} + +static ADDRESS_MAP_START( cdp1869_page_ram, AS_0, 8, driver_device ) + AM_RANGE(0x000, 0x3ff) AM_MIRROR(0x400) AM_RAM +ADDRESS_MAP_END + +CDP1869_CHAR_RAM_READ_MEMBER(pecom_state::pecom_char_ram_r ) +{ + UINT8 column = pmd & 0x7f; + UINT16 charaddr = (column << 4) | cma; + + return m_charram[charaddr]; +} + +CDP1869_CHAR_RAM_WRITE_MEMBER(pecom_state::pecom_char_ram_w ) +{ + UINT8 column = pmd & 0x7f; + UINT16 charaddr = (column << 4) | cma; + + m_charram[charaddr] = data; +} + +CDP1869_PCB_READ_MEMBER(pecom_state::pecom_pcb_r ) +{ + return BIT(pmd, 7); +} + +WRITE_LINE_MEMBER(pecom_state::pecom_prd_w) +{ + // every other PRD triggers a DMAOUT request + if (m_dma) + { + m_cdp1802->set_input_line(COSMAC_INPUT_LINE_DMAOUT, HOLD_LINE); + } + + m_dma = !m_dma; +} + +VIDEO_START_MEMBER(pecom_state,pecom) +{ + /* allocate memory */ + m_charram = auto_alloc_array(machine(), UINT8, PECOM_CHAR_RAM_SIZE); + + /* register for state saving */ + save_item(NAME(m_reset)); + save_item(NAME(m_dma)); + save_pointer(NAME(m_charram), PECOM_CHAR_RAM_SIZE); +} + +MACHINE_CONFIG_FRAGMENT( pecom_video ) + MCFG_CDP1869_SCREEN_PAL_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL) + + MCFG_VIDEO_START_OVERRIDE(pecom_state,pecom) + + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_CDP1869_ADD(CDP1869_TAG, CDP1869_DOT_CLK_PAL, cdp1869_page_ram) + MCFG_CDP1869_COLOR_CLOCK(CDP1869_COLOR_CLK_PAL) + MCFG_CDP1869_CHAR_PCB_READ_OWNER(pecom_state, pecom_pcb_r) + MCFG_CDP1869_CHAR_RAM_READ_OWNER(pecom_state, pecom_char_ram_r) + MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(pecom_state, pecom_char_ram_w) + MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_CDP1869_PRD_CALLBACK(WRITELINE(pecom_state, pecom_prd_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END diff --git a/src/mame/video/pk8020.c b/src/mame/video/pk8020.c new file mode 100644 index 00000000000..31088bb6a53 --- /dev/null +++ b/src/mame/video/pk8020.c @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + PK-8020 driver by Miodrag Milanovic + based on work of Sergey Erokhin from pk8020.narod.ru + + 18/07/2008 Preliminary driver. + +****************************************************************************/ + +#include "emu.h" +#include "includes/pk8020.h" +#include "machine/ram.h" + +void pk8020_state::video_start() +{ +} + +UINT32 pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int y, x, b, j; + UINT8 *gfx = m_region_gfx1->base(); + UINT8 *ram = m_ram->pointer(); + + for (y = 0; y < 16; y++) + { + for (x = 0; x < 64; x++) + { + UINT8 chr = ram[x +(y*64) + 0x40000]; + UINT8 attr= ram[x +(y*64) + 0x40400]; + for (j = 0; j < 16; j++) { + UINT32 addr = 0x10000 + x + ((y*16+j)*64) + (m_video_page * 0xC000); + UINT8 code1 = ram[addr]; + UINT8 code2 = ram[addr + 0x4000]; + UINT8 code3 = ram[addr + 0x8000]; + UINT8 code4 = gfx[((chr<<4) + j) + (m_font*0x1000)]; + if (attr) code4 ^= 0xff; + for (b = 0; b < 8; b++) + { + UINT8 col = (((code4 >> b) & 0x01) ? 0x08 : 0x00); + col |= (((code3 >> b) & 0x01) ? 0x04 : 0x00); + col |= (((code2 >> b) & 0x01) ? 0x02 : 0x00); + col |= (((code1 >> b) & 0x01) ? 0x01 : 0x00); + bitmap.pix16((y*16)+j, x*8+(7-b)) = col; + } + } + } + } + return 0; +} + +PALETTE_INIT_MEMBER(pk8020_state, pk8020) +{ + int i; + for(i=0;i<16;i++) { + m_palette->set_pen_color( i, rgb_t(i*0x10,i*0x10,i*0x10) ); + } +} diff --git a/src/mame/video/pocketc.c b/src/mame/video/pocketc.c new file mode 100644 index 00000000000..0cf2f505349 --- /dev/null +++ b/src/mame/video/pocketc.c @@ -0,0 +1,70 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +#include "emu.h" +#include "includes/pocketc.h" + +/* PC126x + 24x2 5x7 space between char + 2000 .. 203b, 2800 .. 283b + 2040 .. 207b, 2840 .. 287b + 203d: 0 BUSY, 1 PRINT, 3 JAPAN, 4 SMALL, 5 SHIFT, 6 DEF + 207c: 1 DEF 1 RAD 2 GRAD 5 ERROR 6 FLAG */ + +static const UINT8 pocketc_palette[] = +{ + 99,107,99, + 94,111,103, + 255,255,255, + 255,255,255, + 60, 66, 60, + 0, 0, 0 +}; + +const unsigned short pocketc_state::pocketc_colortable[8][2] = { + { 5, 4 }, + { 5, 0 }, + { 5, 2 }, + { 4, 5 }, + { 1, 4 }, + { 0, 5 }, + { 1, 5 }, + { 3, 5 } +}; + +PALETTE_INIT_MEMBER(pocketc_state, pocketc) +{ + UINT8 i=0, r, b, g, color_count = 6; + + while (color_count--) + { + r = pocketc_palette[i++]; g = pocketc_palette[i++]; b = pocketc_palette[i++]; + palette.set_indirect_color(5 - color_count, rgb_t(r, g, b)); + } + + for( i = 0; i < 8; i++ ) + { + palette.set_pen_indirect(i*2, pocketc_colortable[i][0]); + palette.set_pen_indirect(i*2+1, pocketc_colortable[i][1]); + } +} + + +/* Draw an indicator (DEG, SHIFT, etc) */ +void pocketc_state::pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, const POCKETC_FIGURE fig, int color) +{ + int i,j; + for (i=0; fig[i]; i++, y++) + { + for (j=0; fig[i][j]!=0; j++) + { + switch(fig[i][j]) + { + case '1': + bitmap.pix16(y, x+j) = color; + break; + case 'e': + return; + } + } + } +} diff --git a/src/mame/video/poisk1.c b/src/mame/video/poisk1.c new file mode 100644 index 00000000000..99532e31fed --- /dev/null +++ b/src/mame/video/poisk1.c @@ -0,0 +1,322 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/* + * Poisk-1 does not have a real mc6845 and always runs in graphics mode. + * Text mode is emulated by BIOS. + * Video RAM in native graphics mode starts at 0xB8000, in emulated text mode -- at 0xBC000. + */ + +#include "emu.h" + +#include "includes/poisk1.h" + +#define CGA_PALETTE_SETS 83 +/* one for colour, one for mono, 81 for colour composite */ + +#include "video/cgapal.h" + +#define BG_COLOR(x) (((x) & 7)|(((x) & 0x10) >> 1)) + +#define VERBOSE_DBG 0 + +#define DBG_LOG(N,M,A) \ + do { \ + if(VERBOSE_DBG>=N) \ + { \ + if( M ) \ + logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \ + logerror A; \ + } \ + } while (0) + +// + +/* + * Poisk-1 doesn't have a mc6845 and always runs in graphics mode. Text mode is emulated by BIOS; + * NMI is triggered on access to video memory and to mc6845 ports. Address and data are latched into: + * + * Port 28H (offset 0) -- lower 8 bits of address + * Port 29H (offset 1) -- high -//- and mode bits + * Port 2AH (offset 2) -- data + */ + +READ8_MEMBER(p1_state::p1_trap_r) +{ + UINT8 data = m_video.trap[offset]; + DBG_LOG(1,"trap",("R %.2x $%02x\n", 0x28+offset, data)); + if (offset == 0) + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + return data; +} + +WRITE8_MEMBER(p1_state::p1_trap_w) +{ + DBG_LOG(1,"trap",("W %.2x $%02x\n", 0x28+offset, data)); +} + +READ8_MEMBER(p1_state::p1_cga_r) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + return 0; +} + +WRITE8_MEMBER(p1_state::p1_cga_w) +{ + UINT16 port = offset + 0x3d0; + + DBG_LOG(1,"cga",("W %.4x $%02x\n", port, data)); + m_video.trap[2] = data; + m_video.trap[1] = 0xC0 | ((port >> 8) & 0x3f); + m_video.trap[0] = port & 255; + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); +} + +WRITE8_MEMBER(p1_state::p1_vram_w) +{ + DBG_LOG(1,"vram",("W %.4x $%02x\n", offset, data)); + if (m_video.videoram_base) + m_video.videoram_base[offset] = data; + m_video.trap[2] = data; + m_video.trap[1] = 0x80 | ((offset >> 8) & 0x3f); + m_video.trap[0] = offset & 255; + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); +} + +// CGA emulator +/* +068h D42 0..2 R, G, B XXX Foreground/Background color + 3 NMI DISABLE NMI trap 1: Disabled 0: Enabled + 4 PALETTE XXX Colour palette 0: XXX 1: XXX + 5 I (INTENS) XXX Foreground/Background color intensity + 6 DISPLAY BANK XXX Video RAM page + 7 HIRES 1: 640x200 0: 320x200 +*/ + +WRITE8_MEMBER(p1_state::p1_ppi2_porta_w) +{ + address_space &space_prg = m_maincpu->space(AS_PROGRAM); + rectangle visarea; + + DBG_LOG(1,"color_select_68",("W $%02x\n", data)); + + // NMI DISABLE + if (BIT(data, 3) != BIT(m_video.color_select_68, 3)) { + if (BIT(data, 3)) { + space_prg.install_readwrite_bank( 0xb8000, 0xbbfff, "bank11" ); + } else { + space_prg.install_read_bank( 0xb8000, 0xbbfff, "bank11" ); + space_prg.install_write_handler( 0xb8000, 0xbbfff, WRITE8_DELEGATE(p1_state, p1_vram_w) ); + } + } + // DISPLAY BANK + if (BIT(data, 6) != BIT(m_video.color_select_68, 6)) { + if (BIT(data, 6)) + m_video.videoram = m_video.videoram_base + 0x4000; + else + m_video.videoram = m_video.videoram_base; + } + // HIRES -- XXX + if (BIT(data, 7) != BIT(m_video.color_select_68, 7)) { + if (BIT(data, 7)) + machine().first_screen()->set_visible_area(0, 640-1, 0, 200-1); + else + machine().first_screen()->set_visible_area(0, 320-1, 0, 200-1); + } + m_video.color_select_68 = data; + set_palette_luts(); +} + +/* +06Ah Dxx 6 Enable/Disable color burst (?) + 7 Enable/Disable D7H/D7L +*/ + +WRITE8_MEMBER(p1_state::p1_ppi_portc_w) +{ + DBG_LOG(1,"mode_control_6a",("W $%02x\n", data)); + + m_video.mode_control_6a = data; + set_palette_luts(); +} + +void p1_state::set_palette_luts(void) +{ + /* Setup 2bpp palette lookup table */ + // HIRES + if ( m_video.color_select_68 & 0x80 ) + { + m_video.palette_lut_2bpp[0] = 0; + } + else + { + m_video.palette_lut_2bpp[0] = BG_COLOR(m_video.color_select_68); + } + // B&W -- XXX +/* + if ( m_video.mode_control_6a & 0x40 ) + { + m_video.palette_lut_2bpp[1] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 3; + m_video.palette_lut_2bpp[2] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 4; + m_video.palette_lut_2bpp[3] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 7; + } + else +*/ + { + // PALETTE + if ( m_video.color_select_68 & 0x20 ) + { + m_video.palette_lut_2bpp[1] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 3; + m_video.palette_lut_2bpp[2] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 5; + m_video.palette_lut_2bpp[3] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 7; + } + else + { + m_video.palette_lut_2bpp[1] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 2; + m_video.palette_lut_2bpp[2] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 4; + m_video.palette_lut_2bpp[3] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 6; + } + } +} + +/*************************************************************************** + Draw graphics mode with 320x200 pixels (default) with 2 bits/pixel. + Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 + cga fetches 2 byte per mc6845 access. +***************************************************************************/ + +POISK1_UPDATE_ROW( p1_state::cga_gfx_2bpp_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(ra); + UINT16 odd, offset; + int i; + + if ( ra == 0 ) DBG_LOG(1,"cga_gfx_2bpp_update_row",("\n")); + odd = ( ra & 1 ) << 13; + offset = ( ma & 0x1fff ) | odd; + for ( i = 0; i < stride; i++ ) + { + UINT8 data = videoram[ offset++ ]; + + *p = palette[m_video.palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]]; p++; + *p = palette[m_video.palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]]; p++; + *p = palette[m_video.palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]]; p++; + *p = palette[m_video.palette_lut_2bpp[ data & 0x03 ]]; p++; + } +} + +/*************************************************************************** + Draw graphics mode with 640x200 pixels (default). + The cell size is 1x1 (1 scanline is the real default) + Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 +***************************************************************************/ + +POISK1_UPDATE_ROW( p1_state::cga_gfx_1bpp_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(ra); + UINT8 fg = 15, bg = BG_COLOR(m_video.color_select_68); + UINT16 odd, offset; + int i; + + if ( ra == 0 ) DBG_LOG(1,"cga_gfx_1bpp_update_row",("bg %d\n", bg)); + odd = ( ra & 1 ) << 13; + offset = ( ma & 0x1fff ) | odd; + for ( i = 0; i < stride; i++ ) + { + UINT8 data = videoram[ offset++ ]; + + *p = palette[( data & 0x80 ) ? fg : bg ]; p++; + *p = palette[( data & 0x40 ) ? fg : bg ]; p++; + *p = palette[( data & 0x20 ) ? fg : bg ]; p++; + *p = palette[( data & 0x10 ) ? fg : bg ]; p++; + *p = palette[( data & 0x08 ) ? fg : bg ]; p++; + *p = palette[( data & 0x04 ) ? fg : bg ]; p++; + *p = palette[( data & 0x02 ) ? fg : bg ]; p++; + *p = palette[( data & 0x01 ) ? fg : bg ]; p++; + } +} + +/*************************************************************************** + Draw graphics mode with 640x200 pixels + extra highlight color for text + mode emulation + Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 +***************************************************************************/ + +POISK1_UPDATE_ROW( p1_state::poisk1_gfx_1bpp_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT32 *p = &bitmap.pix32(ra); + UINT8 fg, bg = BG_COLOR(m_video.color_select_68); + UINT16 odd, offset; + int i; + + if ( ra == 0 ) DBG_LOG(1,"poisk1_gfx_1bpp_update_row",("bg %d\n", bg)); + odd = ( ra & 1 ) << 13; + offset = ( ma & 0x1fff ) | odd; + for ( i = 0; i < stride; i++ ) + { + UINT8 data = videoram[ offset++ ]; + + fg = (data & 0x80) ? ( (m_video.color_select_68 & 0x20) ? 10 : 11 ) : 15; // XXX + *p = palette[bg]; p++; + *p = palette[( data & 0x40 ) ? fg : bg ]; p++; + *p = palette[( data & 0x20 ) ? fg : bg ]; p++; + *p = palette[( data & 0x10 ) ? fg : bg ]; p++; + *p = palette[( data & 0x08 ) ? fg : bg ]; p++; + *p = palette[( data & 0x04 ) ? fg : bg ]; p++; + *p = palette[( data & 0x02 ) ? fg : bg ]; p++; + *p = palette[( data & 0x01 ) ? fg : bg ]; p++; + } +} + +/* Initialise the cga palette */ +PALETTE_INIT_MEMBER(p1_state, p1) +{ + int i; + + DBG_LOG(0,"init",("palette_init()\n")); + + for ( i = 0; i < CGA_PALETTE_SETS * 16; i++ ) + { + palette.set_pen_color(i, cga_palette[i][0], cga_palette[i][1], cga_palette[i][2] ); + } +} + +void p1_state::video_start() +{ + address_space &space = m_maincpu->space( AS_PROGRAM ); + + DBG_LOG(0,"init",("video_start()\n")); + + memset(&m_video, 0, sizeof(m_video)); + m_video.videoram = m_video.videoram_base = auto_alloc_array(machine(), UINT8, 0x8000); + m_video.stride = 80; + + space.install_readwrite_bank(0xb8000, 0xbffff, "bank11" ); + machine().root_device().membank("bank11")->set_base(m_video.videoram); +} + +UINT32 p1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT16 ra, ma = 0; + + if (!m_video.stride || !m_video.videoram) return 0; + + // bit 6 of 6Ah disables color burst -- not implemented + for (ra = cliprect.min_y; ra <= cliprect.max_y; ra++) + { + if (BIT(m_video.color_select_68, 7)) { + if (BIT(m_video.mode_control_6a, 7)) { + cga_gfx_1bpp_update_row(bitmap, cliprect, m_video.videoram, ma, ra, m_video.stride); + } else { + poisk1_gfx_1bpp_update_row(bitmap, cliprect, m_video.videoram, ma, ra, m_video.stride); + } + } else { + cga_gfx_2bpp_update_row(bitmap, cliprect, m_video.videoram, ma, ra, m_video.stride); + } + if (ra & 1) ma += m_video.stride; + } + + return 0; +} diff --git a/src/mame/video/poisk1.h b/src/mame/video/poisk1.h new file mode 100644 index 00000000000..092de267b1e --- /dev/null +++ b/src/mame/video/poisk1.h @@ -0,0 +1,10 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +#include "emu.h" + +#define CGA_PALETTE_SETS 83 +/* one for colour, one for mono, 81 for colour composite */ + +INPUT_PORTS_EXTERN( pcvideo_poisk1 ); + +MACHINE_CONFIG_EXTERN( pcvideo_poisk1 ); diff --git a/src/mame/video/poly88.c b/src/mame/video/poly88.c new file mode 100644 index 00000000000..83652770e56 --- /dev/null +++ b/src/mame/video/poly88.c @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Poly-88 video by Miodrag Milanovic + + 18/05/2009 Initial implementation + +****************************************************************************/ + +#include "emu.h" +#include "includes/poly88.h" + +static const UINT8 mcm6571a_shift[] = +{ + 0,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0, + 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0, + 1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0 +}; + +void poly88_state::video_start() +{ + m_FNT = memregion("chargen")->base(); +} + +UINT32 poly88_state::screen_update_poly88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y,j,b; + UINT16 addr; + int xpos; + UINT8 l,r; + + for(y = 0; y < 16; y++ ) + { + addr = y*64; + xpos = 0; + for(x = 0; x < 64; x++ ) + { + UINT8 code = m_video_ram[addr + x]; + if ((code & 0x80)==0) + { + for(j = 0; j < 15; j++ ) + { + l = j/5; + for(b = 0; b < 10; b++ ) + { + r = b/5; + if (l==0 && r==0) + bitmap.pix16(y*15+j, xpos+b ) = BIT(code,5) ? 0 : 1; + + if (l==0 && r==1) + bitmap.pix16(y*15+j, xpos+b ) = BIT(code,2) ? 0 : 1; + + if (l==1 && r==0) + bitmap.pix16(y*15+j, xpos+b ) = BIT(code,4) ? 0 : 1; + + if (l==1 && r==1) + bitmap.pix16(y*15+j, xpos+b ) = BIT(code,1) ? 0 : 1; + + if (l==2 && r==0) + bitmap.pix16(y*15+j, xpos+b ) = BIT(code,3) ? 0 : 1; + + if (l==2 && r==1) + bitmap.pix16(y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; + } + } + } + else + { + for(j = 0; j < 15; j++ ) + { + code &= 0x7f; + l = 0; + if (mcm6571a_shift[code]==0) + { + if (j < 9) + l = m_FNT[code*16 + j]; + } + else + { + if ((j > 2) && (j < 12)) + l = m_FNT[code*16 + j - 3]; + } + + for(b = 0; b < 7; b++ ) + bitmap.pix16(y*15+j, xpos+b ) = (l >> (6-b)) & 1; + + bitmap.pix16(y*15+j, xpos+7 ) = 0; + bitmap.pix16(y*15+j, xpos+8 ) = 0; + bitmap.pix16(y*15+j, xpos+9 ) = 0; + } + } + xpos += 10; + } + } + return 0; +} diff --git a/src/mame/video/pp01.c b/src/mame/video/pp01.c new file mode 100644 index 00000000000..da2ec5cfde7 --- /dev/null +++ b/src/mame/video/pp01.c @@ -0,0 +1,56 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + PP-01 driver by Miodrag Milanovic + + 08/09/2008 Preliminary driver. + +****************************************************************************/ + + +#include "includes/pp01.h" + +void pp01_state::video_start() +{ +} + +UINT32 pp01_state::screen_update_pp01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code_r,code_g,code_b; + UINT8 col; + int y, x, b; + UINT8 *ram = m_ram->pointer(); + + for (y = 0; y < 256; y++) + { + for (x = 0; x < 32; x++) + { + code_r = ram[0x6000 + ((y+m_video_scroll)&0xff)*32 + x]; + code_g = ram[0xa000 + ((y+m_video_scroll)&0xff)*32 + x]; + code_b = ram[0xe000 + ((y+m_video_scroll)&0xff)*32 + x]; + for (b = 0; b < 8; b++) + { + col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); + bitmap.pix16(y, x*8+(7-b)) = col; + } + } + } + return 0; +} + +static const rgb_t pp01_palette[8] = { + rgb_t(0x00, 0x00, 0x00), // 0 + rgb_t(0x00, 0x00, 0x80), // 1 + rgb_t(0x00, 0x80, 0x00), // 2 + rgb_t(0x00, 0x80, 0x80), // 3 + rgb_t(0x80, 0x00, 0x00), // 4 + rgb_t(0x80, 0x00, 0x80), // 5 + rgb_t(0x80, 0x80, 0x00), // 6 + rgb_t(0x80, 0x80, 0x80), // 7 +}; + +PALETTE_INIT_MEMBER(pp01_state, pp01) +{ + palette.set_pen_colors(0, pp01_palette, ARRAY_LENGTH(pp01_palette)); +} diff --git a/src/mame/video/primo.c b/src/mame/video/primo.c new file mode 100644 index 00000000000..55332149128 --- /dev/null +++ b/src/mame/video/primo.c @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha +/*************************************************************************** + + primo.c + + Functions to emulate the video hardware of Primo. + + Krzysztof Strzecha + +***************************************************************************/ + +#include "emu.h" +#include "includes/primo.h" + + + +void primo_state::primo_draw_scanline(bitmap_ind16 &bitmap, int primo_scanline) +{ + int x, i; + UINT8 data; + + /* set up scanline */ + UINT16 *scanline = &bitmap.pix16(primo_scanline); + + /* address of current line in Primo video memory */ + const UINT8* primo_video_ram_line = (const UINT8*)m_maincpu->space(AS_PROGRAM).get_read_ptr(m_video_memory_base + 32 * primo_scanline); + + for (x=0; x<256; x+=8) + { + data = primo_video_ram_line[x/8]; + + for (i=0; i<8; i++) + scanline[x+i]=(data & (0x80>>i)) ? 1 : 0; + + } +} + + +UINT32 primo_state::screen_update_primo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int primo_scanline; + + for (primo_scanline=0; primo_scanline<192; primo_scanline++) + primo_draw_scanline( bitmap, primo_scanline); + return 0; +} diff --git a/src/mame/video/rm380z.c b/src/mame/video/rm380z.c new file mode 100644 index 00000000000..4b00c5222db --- /dev/null +++ b/src/mame/video/rm380z.c @@ -0,0 +1,406 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol,Gabriele D'Antona + +/* + +RM 380Z video code + +*/ + + +#include "includes/rm380z.h" + + +void rm380z_state::put_point(int charnum,int x,int y,int col) +{ + int mx=3; + if (y==6) mx=4; + + for (unsigned int r=y;r<(y+mx);r++) + { + for (unsigned int c=x;c<(x+3);c++) + { + m_graphic_chars[charnum][c+(r*(RM380Z_CHDIMX+1))]=col; + } + } +} + +void rm380z_state::init_graphic_chars() +{ + for (int c=0;c<0x3f;c++) + { + if (c&0x01) put_point(c,0,0,1); + else put_point(c,0,0,0); + + if (c&0x02) put_point(c,3,0,1); + else put_point(c,3,0,0); + + if (c&0x04) put_point(c,0,3,1); + else put_point(c,0,3,0); + + if (c&0x08) put_point(c,3,3,1); + else put_point(c,3,3,0); + + if (c&0x10) put_point(c,0,6,1); + else put_point(c,0,6,0); + + if (c&0x20) put_point(c,3,6,1); + else put_point(c,3,6,0); + } +} + +void rm380z_state::config_videomode() +{ + if (m_port0&0x20) + { + // 80 cols + m_videomode=RM380Z_VIDEOMODE_80COL; + } + else + { + // 40 cols + m_videomode=RM380Z_VIDEOMODE_40COL; + } + + if (m_old_videomode!=m_videomode) + { + m_old_videomode=m_videomode; + } +} + +// char attribute bits in COS 4.0 + +// 0=alternate charset +// 1=underline +// 2=dim +// 3=reverse + + +void rm380z_state::decode_videoram_char(int pos,UINT8& chr,UINT8& attrib) +{ + UINT8 ch1=m_vramchars[pos]; + UINT8 ch2=m_vramattribs[pos]; + + // "special" (unknown) cases first + if ((ch1==0x80)&&(ch2==0x04)) + { + // blank out + chr=0x20; + attrib=0; + return; + } + else if ((ch1==0)&&(ch2==8)) + { + // cursor + chr=0x20; + attrib=8; + return; + } + else if ((ch1==0)&&(ch2==0)) + { + // delete char (?) + chr=0x20; + attrib=0; + return; + } + else if ((ch1==4)&&(ch2==4)) + { + // reversed cursor? + chr=0x20; + attrib=0; + return; + } + else if ((ch1==4)&&(ch2==8)) + { + // normal cursor + chr=0x20; + attrib=8; + return; + } + else + { + chr=ch1; + attrib=ch2; + + //printf("unhandled character combination [%x][%x]\n",ch1,ch2); + } +} + +void rm380z_state::scroll_videoram() +{ + int lineWidth=0x80; + if (m_videomode==RM380Z_VIDEOMODE_40COL) + { + lineWidth=0x40; + } + + // scroll up one row of videoram + + for (int row=1;rowr[1]) + { + scroll_videoram(); + } + else if ((r[2]==0x00)&&(r[1]==0x17)) + { + // wrap-scroll + scroll_videoram(); + } + + } +} + +// after ctrl-L (clear screen?): routine at EBBD is executed +// EB30??? next line? +// memory at FF02 seems to hold the line counter (same as FBFD) +// +// basics: +// 20e2: prints "Ready:" +// 0195: prints "\n" + +WRITE8_MEMBER( rm380z_state::videoram_write ) +{ + //printf("vramw [%2.2x][%2.2x] port0 [%2.2x] fbfd [%2.2x] fbfe [%2.2x] PC [%4.4x]\n",offset,data,m_port0,m_fbfd,m_fbfe,m_maincpu->safe_pc()); + + int lineWidth=0x80; + if (m_videomode==RM380Z_VIDEOMODE_40COL) + { + lineWidth=0x40; + } + + int rowadder=(m_fbfe&0x0f)*2; + if (m_videomode==RM380Z_VIDEOMODE_40COL) rowadder=0; // FBFE register is not used in VDU-40 + + int lineAdder=rowadder*lineWidth; + int realA=(offset+lineAdder); + + // we suppose videoram is being written as character/attribute couple + // fbfc 6th bit set=attribute, unset=char + + if (!(m_port0&0x40)) + { + m_vramchars[realA%RM380Z_SCREENSIZE]=data; + } + else + { + m_vramattribs[realA%RM380Z_SCREENSIZE]=data; + } + + // + + m_mainVideoram[offset]=data; +} + +READ8_MEMBER( rm380z_state::videoram_read ) +{ + return m_mainVideoram[offset]; +} + +void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bitmap,unsigned char* chsb,int vmode) +{ + //bool attrDim=false; + bool attrRev=false; + bool attrUnder=false; + + if (attribs&0x02) attrUnder=true; + //if (attribs&0x04) attrDim=true; + if (attribs&0x08) attrRev=true; + + if ((charnum>0)&&(charnum<=0x7f)) + { + // normal chars (base set) + + if (vmode==RM380Z_VIDEOMODE_80COL) + { + int basex=RM380Z_CHDIMX*(charnum/RM380Z_NCY); + int basey=RM380Z_CHDIMY*(charnum%RM380Z_NCY); + + for (int r=0;rbase(); + + int lineWidth=0x80; + int ncols=80; + + if (m_videomode==RM380Z_VIDEOMODE_40COL) + { + lineWidth=0x40; + ncols=40; + } + + // blank screen + bitmap.fill(0); + + for (int row=0;row>4) +#define SELECT_COL(x,c) (IS_80COL ? ((((x) & 1) ? ((c) << 2) : (c)) & 0xC) : (c)) +#define FILL_WORD(c) (((c) << 12) | ((c) << 8) | ((c) << 4) | (c)) + +#define IS_80COL (m_mode&0x10) +#define IS_XOR (m_op&8) + +#define DEBUG_TEXT 0x01 +#define DEBUG_DB 0x02 +#define DEBUG_PIXEL 0x04 + +#define DEBUG_SET(flags) ((m_debug_video & (flags))==(flags)) + +static void video_debug(running_machine &machine, int ref, int params, const char *param[]); + +READ16_MEMBER(rmnimbus_state::nimbus_video_io_r) +{ + UINT16 result = 0; + + switch (offset) + { + case 0x00: + case 0x08: + result = read_pixel_data(m_x, m_y); + break; + case 0x02: + case 0x0A: + result = read_pixel_data(m_x, ++m_y); + break; + case 0x05: + case 0x0D: + result = read_pixel_data(++m_x, m_y); + break; + + case 0x10: + result = m_yline; + break; + case 0x11: + result = m_op; + break; + case 0x12: + result = m_colours; + break; + case 0x13: + result = m_mode; + break; + case 0x14: + result = m_screen->vpos() % 0xb; // TODO: verify + break; + case 0x15: + result = m_x; + break; + case 0x16: + result = m_y; + break; + default: + logerror("nimbus: unknown video reg read %02x\n", offset); + break; + } + + if(DEBUG_SET(DEBUG_TEXT)) + logerror("Nimbus video IOR at %05X from %04X mask=%04X, data=%04X\n",space.device().safe_pc(),(offset*2),mem_mask,result); + + return result; +} + +UINT8 rmnimbus_state::get_pixel(UINT16 x, UINT16 y) +{ + UINT8 result = 0; + + if((x<640) && (y<250)) + { + if(IS_80COL) + result=m_video_mem.pix16(y, x) >> 2; + else + result=m_video_mem.pix16(y, x*2); + } + + return result; +} + +UINT16 rmnimbus_state::read_pixel_line(UINT16 x, UINT16 y, UINT8 pixels, UINT8 bpp) +{ + UINT16 colour = 0; + int i; + x *= pixels; + + if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) + logerror("read_pixel_line(x=%d, y=%d, width=%d, bpp=%d)\n",x,y,pixels,bpp); + + for(i = 0; i < pixels - 1; i++) + { + colour |= get_pixel(i + x, y); + + if(bpp==1) + colour=((colour==SELECT_COL(x + i, FG_COLOUR)) ? 1 : 0) << 1; + else + colour <<= bpp; + } + return colour | get_pixel(x + i, y); +} + +UINT16 rmnimbus_state::read_pixel_data(UINT16 x, UINT16 y) +{ + UINT16 result=0; + + if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) + logerror("read_pixel_data(x=%d, y=%d), reg022=%04X\n",x,y,m_op); + + if(IS_80COL) + { + switch (m_op & WIDTH_MASK) + { + case 0x00 : break; + + case 0x01 : break; + + case 0x02 : break; + + case 0x03 : break; + + case 0x04 : + result=read_pixel_line(x,y,4,2); + break; + + case 0x05 : break; + + case 0x06 : + result=read_pixel_line(x,y,8,2); + break; + + case 0x07 : break; + } + } + else /* 40 Col */ + { + switch (m_op & WIDTH_MASK) + { + case 0x00 : break; + + case 0x01 : break; + + case 0x02 : break; + + case 0x03 : break; + + case 0x04 : break; + + case 0x05 : break; + + case 0x06 : + result=read_pixel_line(x,y,4,4); + break; + + case 0x07 : break; + } + } + + return result; +} + +/* + Write to the video registers. + + Incase anyone wonders about the DEBUG_DB statement, this allows me to log which registers + are being written to and then play them back at the real machine, this has helped greatly + in figuring out what the video registers do. + +*/ + +WRITE16_MEMBER(rmnimbus_state::nimbus_video_io_w) +{ + UINT16 colours = data; + if(offset < 0x14) + { + if(DEBUG_SET(DEBUG_TEXT)) + logerror("Nimbus video IOW at %05X write of %04X to %04X mask=%04X\n",space.device().safe_pc(),data,(offset*2),mem_mask); + + if(DEBUG_SET(DEBUG_DB)) + logerror("dw %05X,%05X\n",(offset*2),data); + } + + switch (offset) + { + case 0x00: + case 0x08: + break; + + case 0x09: + colours = FILL_WORD(FG_COLOUR); + case 0x01: + m_x = data; + break; + + case 0x02: + case 0x0A: + m_y++; + break; + + case 0x0B: + colours = FILL_WORD(FG_COLOUR); + case 0x03: + m_x = data; + m_y++; + break; + + case 0x05: + case 0x0D: + m_x++; + break; + + case 0x0E: + colours = FILL_WORD(FG_COLOUR); + case 0x06: + m_y = data; + break; + + case 0x0F: + colours = FILL_WORD(FG_COLOUR); + case 0x07: + m_y = data; + m_x++; + break; + + case 0x10: + m_yline = data; + return; + case 0x11: + m_op = data; + return; + case 0x12: + m_colours = data; + return; + case 0x13: + /* + bits 0..3 of reg026 contain the border colour. + bit 5 contains the 40/80 column (320/640 pixel) flag. + */ + m_mode = data; + return; + case 0x14: + case 0x15: + case 0x16: + case 0x17: + change_palette(offset - 0x14, data); + return; + + default: + logerror("nimbus: unknown video reg write %02x %04x\n", offset, data); + return; + } + if(offset & 0x08) + write_pixel_data(m_x, m_y, colours); +} + +void rmnimbus_state::set_pixel(UINT16 x, UINT16 y, UINT8 colour) +{ + if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) + logerror("set_pixel(x=%d, y=%d, colour=%04X), IS_XOR=%02X\n",x,y,colour,IS_XOR); + + if((x<640) && (y<250)) + { + if(IS_XOR) + m_video_mem.pix16(y, x)^=colour; + else + m_video_mem.pix16(y, x)=colour; + } +} + +void rmnimbus_state::set_pixel40( UINT16 x, UINT16 y, UINT8 colour) +{ + set_pixel((x*2),y,colour); + set_pixel((x*2)+1,y,colour); +} + +void rmnimbus_state::write_pixel_line(UINT16 x, UINT16 y, UINT16 data, UINT8 pixels, UINT8 bpp) +{ + UINT8 colour; + UINT8 mask = (1 << bpp) - 1; + x *= pixels; + + if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) + logerror("write_pixel_line(x=%d, y=%d, data=%04X, width=%d, bpp=%d)\n",x,y,data,pixels,bpp); + + for(int i = (pixels - 1); i >= 0; i--) + { + if(bpp==1) + colour = SELECT_COL(x + i, (data & 1) ? FG_COLOUR : BG_COLOUR); + else if(IS_80COL) + colour = (data & mask) << 2; + else + colour = (data & mask); + + if(IS_80COL) + set_pixel(x + i,y,colour); + else + set_pixel40(x + i,y,colour); + + data >>= bpp; + } +} + +void rmnimbus_state::move_pixel_line(UINT16 x, UINT16 y, UINT8 pixels) +{ + x *= pixels; + if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) + logerror("move_pixel_line(x=%d, y=%d, width=%d)\n",x,y,pixels); + + for(int i = 0; i < pixels; i++) + { + if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) + logerror("x=%d\n",x + i); + m_video_mem.pix16(m_yline, x + i) = m_video_mem.pix16(y, x + i); + } +} + + + +/* + The values in the bottom 3 bits of reg022 seem to determine the number of bits per pixel + for following operations. + + The values that I have decoded so far are : + + 000 1bpp, foreground and background colours taken from reg024 + 001 2bpp, using the first 4 colours of the pallette + 010 + 011 + 100 4bpp, must be a 16 bit word, of which the upper byte is a mask anded with existing pixels then ored + with the lower byte containing the pixel data for two pixels. + 101 Move pixel data at x,reg020 to x,y, used for scrolling. + 110 if 40 col + 4bpp, 16 bit word containing the pixel data for 4 pixels. + else + 2bpp, 16 bit word containing the pixel data for 8 pixels. + 111 + + Bit 3 of reg022 is as follows : + + 0 pixels are written from supplied colour data + 1 pixels are xor'ed onto the screen +*/ + +void rmnimbus_state::write_pixel_data(UINT16 x, UINT16 y, UINT16 data) +{ + if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) + logerror("write_pixel_data(x=%d, y=%d, data=%04X), reg022=%04X\n",x,y,data,m_op); + + if(IS_80COL) + { + switch (m_op & WIDTH_MASK) + { + case 0x00: + write_pixel_line(x,y,data,16,1); + break; + + case 0x01: + write_pixel_line(x,y,data,8,1); + break; + + case 0x02: + write_pixel_line(x,y,data,8,1); + break; + + case 0x03: + set_pixel(x,y,SELECT_COL(x, FG_COLOUR)); + break; + + case 0x04: + write_pixel_line(x,y,(((data & 0xFF00)>>8) & (data & 0xFF)) | (~((data & 0xFF00)>>8) & read_pixel_line(x,y,4,2)),4,2); + break; + + case 0x05: + move_pixel_line(x,y,16); + break; + + case 0x06: + write_pixel_line(x,y,data,8,2); + break; + + case 0x07: + set_pixel(x,y,SELECT_COL(x, FG_COLOUR)); + break; + } + } + else /* 40 Col */ + { + switch (m_op & WIDTH_MASK) + { + case 0x00: + write_pixel_line(x,y,data,8,1); + break; + + case 0x01: + write_pixel_line(x,y,data,4,2); + break; + + case 0x02: + set_pixel40(x,y,FG_COLOUR); + break; + + case 0x03: + set_pixel(x,y,FG_COLOUR); + break; + + case 0x04: + write_pixel_line(x,y,(((data & 0xFF00)>>8) & (data & 0xFF)) | (~((data & 0xFF00)>>8) & read_pixel_line(x,y,2,4)),2,4); + break; + + case 0x05: + move_pixel_line(x,y,16); + break; + + case 0x06: + write_pixel_line(x,y,data,4,4); + break; + + case 0x07: + set_pixel(x,y,FG_COLOUR); + break; + } + } +} + +void rmnimbus_state::change_palette(UINT8 bank, UINT16 colours) +{ + // loop over changing colours + for(int colourno = (bank * 4); colourno < ((bank + 1) * 4); colourno++) + { + int i = (colours & 8) >> 3; + m_palette->set_pen_color(colourno, pal2bit((colours & 2) | i), pal2bit(((colours & 4) >> 1) | i), pal2bit(((colours & 1) << 1) | i)); + + if(DEBUG_SET(DEBUG_TEXT)) + logerror("set colourno[%02X], colour=%02X\n",colourno, colours & 0xf); + colours >>= 4; + } +} + +static void video_debug(running_machine &machine, int ref, int params, const char *param[]) +{ + rmnimbus_state *state = machine.driver_data(); + if(params>0) + { + int temp; + sscanf(param[0],"%d",&temp); state->m_debug_video = temp; + } + else + { + debug_console_printf(machine,"Error usage : nimbus_vid_debug \n"); + debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_video); + } +} + +void rmnimbus_state::video_start() +{ + m_debug_video=0; + + m_screen->register_screen_bitmap(m_video_mem); + + if (machine().debug_flags & DEBUG_FLAG_ENABLED) + { + debug_console_register_command(machine(), "nimbus_vid_debug", CMDFLAG_NONE, 0, 0, 1, video_debug); + } +} + +void rmnimbus_state::video_reset() +{ + m_mode = 0; + m_x = 0; + m_y = 0; + m_op = 0; + m_yline = 0; +} + +UINT32 rmnimbus_state::screen_update_nimbus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_video_mem, 0, 0, 0, 0, cliprect); + + return 0; +} diff --git a/src/mame/video/samcoupe.c b/src/mame/video/samcoupe.c new file mode 100644 index 00000000000..af931c952c7 --- /dev/null +++ b/src/mame/video/samcoupe.c @@ -0,0 +1,171 @@ +// license:GPL-2.0+ +// copyright-holders:Lee Hammerton, Dirk Best +/*************************************************************************** + + Miles Gordon Technology SAM Coupe + +***************************************************************************/ + +#include "emu.h" +#include "includes/samcoupe.h" + + +/*************************************************************************** + MACROS +***************************************************************************/ + +/* border color from border register */ +#define BORDER_COLOR(x) ((x & 0x20) >> 2 | (x & 0x07)) + +/* foreground and background color from attribute byte in mode 1 and 2 */ +#define ATTR_BG(x) ((x >> 3) & 0x07) +#define ATTR_FG(x) (((x >> 3) & 0x08) | (x & 0x07)) + + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +void samcoupe_state::video_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); +} + +UINT32 samcoupe_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + +void samcoupe_state::draw_mode4_line(int y, int hpos) +{ + UINT8 *videoram = m_videoram; + + /* get start address */ + UINT8 *vram = videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); + + for (int i = 0; i < (SAM_BLOCK*2)/4; i++) + { + /* draw 2 pixels (doublewidth) */ + m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; + + /* move to next address */ + vram++; + + /* attribute register contains the third displayed byte */ + if (i == 2) + m_attribute = *vram; + } +} + +void samcoupe_state::draw_mode3_line(int y, int hpos) +{ + UINT8 *videoram = m_videoram; + + /* get start address */ + UINT8 *vram = videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); + + for (int i = 0; i < (SAM_BLOCK*2)/4; i++) + { + /* draw 4 pixels */ + m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; + m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; + m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; + m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; + + /* move to next address */ + vram++; + + /* attribute register contains the third displayed byte */ + if (i == 2) + m_attribute = *vram; + } +} + +void samcoupe_state::draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask) +{ + /* extract colors from attribute */ + UINT8 ink = m_clut[ATTR_FG(m_attribute)]; + UINT8 pap = m_clut[ATTR_BG(m_attribute)]; + + /* draw block of 8 pixels (doubled to 16) */ + for (int i = 0; i < SAM_BLOCK; i++) + { + bitmap.pix16(vpos, hpos + i*2 + 0) = BIT(mask, 7 - i) ? ink : pap; + bitmap.pix16(vpos, hpos + i*2 + 1) = BIT(mask, 7 - i) ? ink : pap; + } +} + +void samcoupe_state::draw_mode2_line(int y, int hpos) +{ + UINT8 *videoram = m_videoram; + + int cell = (y - SAM_BORDER_TOP) * 32 + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2; + + UINT8 mask = videoram[cell]; + m_attribute = videoram[cell + 0x2000]; + + draw_mode12_block(m_bitmap, y, hpos, mask); +} + +void samcoupe_state::draw_mode1_line(int y, int hpos) +{ + UINT8 *videoram = m_videoram; + + UINT8 mask = videoram[((((y - SAM_BORDER_TOP) & 0xc0) << 5) | (((y - SAM_BORDER_TOP) & 0x07) << 8) | (((y - SAM_BORDER_TOP) & 0x38) << 2)) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2]; + m_attribute = videoram[32*192 + (((y - SAM_BORDER_TOP) & 0xf8) << 2) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2]; + + draw_mode12_block(m_bitmap, y, hpos, mask); +} + +TIMER_CALLBACK_MEMBER(samcoupe_state::sam_video_update_callback) +{ + int vpos = machine().first_screen()->vpos(); + int hpos = machine().first_screen()->hpos(); + + int next_vpos = vpos; + int next_hpos = hpos + SAM_BLOCK*2; + + /* next scanline? */ + if (next_hpos >= SAM_BORDER_LEFT + SAM_SCREEN_WIDTH + SAM_BORDER_RIGHT) + { + next_vpos = (vpos + 1) % (SAM_BORDER_TOP + SAM_SCREEN_HEIGHT + SAM_BORDER_BOTTOM); + next_hpos = 0; + } + + /* display disabled? (only in mode 3 or 4) */ + if (BIT(m_vmpr, 6) && BIT(m_border, 7)) + { + m_bitmap.plot_box(hpos, vpos, SAM_BLOCK*2, 1, 0); + } + else + { + /* border area? */ + if (vpos < SAM_BORDER_TOP || vpos >= SAM_BORDER_TOP + SAM_SCREEN_HEIGHT || hpos < SAM_BORDER_LEFT || hpos >= SAM_BORDER_LEFT + SAM_SCREEN_WIDTH) + { + m_attribute = 0xff; + m_bitmap.plot_box(hpos, vpos, SAM_BLOCK*2, 1, m_clut[BORDER_COLOR(m_border)]); + } + else + { + /* main screen area */ + switch ((m_vmpr & 0x60) >> 5) + { + case 0: draw_mode1_line(vpos, hpos); break; + case 1: draw_mode2_line(vpos, hpos); break; + case 2: draw_mode3_line(vpos, hpos); break; + case 3: draw_mode4_line(vpos, hpos); break; + } + } + } + + /* do we need to trigger the scanline interrupt (interrupt happens at the start of the right border before the specified line)? */ + if (m_line_int < SAM_SCREEN_HEIGHT && hpos == SAM_BORDER_LEFT + SAM_SCREEN_WIDTH && vpos == (m_line_int + SAM_BORDER_TOP - 1)) + samcoupe_irq(SAM_LINE_INT); + + /* schedule next update */ + m_video_update_timer->adjust(machine().first_screen()->time_until_pos(next_vpos, next_hpos)); +} diff --git a/src/mame/video/special.c b/src/mame/video/special.c new file mode 100644 index 00000000000..d868c9efded --- /dev/null +++ b/src/mame/video/special.c @@ -0,0 +1,153 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Specialist video driver by Miodrag Milanovic + + 15/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "includes/special.h" + + +VIDEO_START_MEMBER(special_state,special) +{ + m_palette->set_pen_color(0,rgb_t::black); /* black */ + m_palette->set_pen_color(1,rgb_t::white); /* white */ +} + +UINT32 special_state::screen_update_special(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code; + int y, x, b; + + for (x = 0; x < 48; x++) + { + for (y = 0; y < 256; y++) + { + code = m_p_videoram[y + x*256]; + for (b = 7; b >= 0; b--) + bitmap.pix16(y, x*8+(7-b)) = (code >> b) & 0x01; + } + } + return 0; +} +VIDEO_START_MEMBER(special_state,specialp) +{ +} + +UINT32 special_state::screen_update_specialp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code; + int y, x, b; + + for (x = 0; x < 64; x++) + { + for (y = 0; y < 256; y++) + { + code = m_p_videoram[y + x*256]; + for (b = 7; b >= 0; b--) + bitmap.pix16(y, x*8+(7-b)) = (code >> b) & 0x01; + } + } + return 0; +} + + +static const rgb_t specimx_palette[16] = { + rgb_t(0x00, 0x00, 0x00), // 0 + rgb_t(0x00, 0x00, 0xaa), // 1 + rgb_t(0x00, 0xaa, 0x00), // 2 + rgb_t(0x00, 0xaa, 0xaa), // 3 + rgb_t(0xaa, 0x00, 0x00), // 4 + rgb_t(0xaa, 0x00, 0xaa), // 5 + rgb_t(0xaa, 0x55, 0x00), // 6 + rgb_t(0xaa, 0xaa, 0xaa), // 7 + rgb_t(0x55, 0x55, 0x55), // 8 + rgb_t(0x55, 0x55, 0xff), // 9 + rgb_t(0x55, 0xff, 0x55), // A + rgb_t(0x55, 0xff, 0xff), // B + rgb_t(0xff, 0x55, 0x55), // C + rgb_t(0xff, 0x55, 0xff), // D + rgb_t(0xff, 0xff, 0x55), // E + rgb_t(0xff, 0xff, 0xff) // F +}; + +PALETTE_INIT_MEMBER(special_state,specimx) +{ + palette.set_pen_colors(0, specimx_palette, ARRAY_LENGTH(specimx_palette)); +} + + +VIDEO_START_MEMBER(special_state,specimx) +{ + m_specimx_colorram = auto_alloc_array(machine(), UINT8, 0x3000); +} + +UINT32 special_state::screen_update_specimx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code, color; + int y, x, b; + + for (x = 0; x < 48; x++) + { + for (y = 0; y < 256; y++) + { + code = m_ram->pointer()[0x9000 + y + x*256]; + color = m_specimx_colorram[y + x*256]; + for (b = 7; b >= 0; b--) + bitmap.pix16(y, x*8+(7-b)) = ((code >> b) & 0x01)==0 ? color & 0x0f : (color >> 4)& 0x0f ; + } + } + return 0; +} + +static const rgb_t erik_palette[8] = { + rgb_t(0x00, 0x00, 0x00), // 0 + rgb_t(0x00, 0x00, 0xff), // 1 + rgb_t(0xff, 0x00, 0x00), // 2 + rgb_t(0xff, 0x00, 0xff), // 3 + rgb_t(0x00, 0xff, 0x00), // 4 + rgb_t(0x00, 0xff, 0xff), // 5 + rgb_t(0xff, 0xff, 0x00), // 6 + rgb_t(0xff, 0xff, 0xff) // 7 +}; + +PALETTE_INIT_MEMBER(special_state,erik) +{ + palette.set_pen_colors(0, erik_palette, ARRAY_LENGTH(erik_palette)); +} + + +VIDEO_START_MEMBER(special_state,erik) +{ +} + +UINT32 special_state::screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code1, code2, color1, color2; + int y, x, b; + UINT8 *erik_video_ram_p1, *erik_video_ram_p2; + + erik_video_ram_p1 = m_ram->pointer() + 0x9000; + erik_video_ram_p2 = m_ram->pointer() + 0xd000; + + for (x = 0; x < 48; x++) + { + for (y = 0; y < 256; y++) + { + code1 = erik_video_ram_p1[y + x*256]; + code2 = erik_video_ram_p2[y + x*256]; + + for (b = 7; b >= 0; b--) + { + color1 = ((code1 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_1; + color2 = ((code2 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_2; + bitmap.pix16(y, x*8+(7-b)) = color1 | color2; + } + } + } + return 0; +} diff --git a/src/mame/video/spectrum.c b/src/mame/video/spectrum.c new file mode 100644 index 00000000000..c663aa5b865 --- /dev/null +++ b/src/mame/video/spectrum.c @@ -0,0 +1,298 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/*************************************************************************** + + spectrum.c + + Functions to emulate the video hardware of the ZX Spectrum. + + Changes: + + DJR 08/02/00 - Added support for FLASH 1. + DJR 16/05/00 - Support for TS2068/TC2048 hires and 64 column modes. + DJR 19/05/00 - Speeded up Spectrum 128 screen refresh. + DJR 23/05/00 - Preliminary support for border colour emulation. + +***************************************************************************/ + +#include "emu.h" +#include "includes/spectrum.h" + +/*************************************************************************** + Start the video hardware emulation. +***************************************************************************/ +VIDEO_START_MEMBER(spectrum_state,spectrum) +{ + m_frame_invert_count = 16; + m_frame_number = 0; + m_flash_invert = 0; + + m_previous_border_x = 0; + m_previous_border_y = 0; + machine().first_screen()->register_screen_bitmap(m_border_bitmap); + m_previous_screen_x = 0; + m_previous_screen_y = 0; + machine().first_screen()->register_screen_bitmap(m_screen_bitmap); + + m_screen_location = m_video_ram; +} + +VIDEO_START_MEMBER(spectrum_state,spectrum_128) +{ + m_frame_invert_count = 16; + m_frame_number = 0; + m_flash_invert = 0; + + m_previous_border_x = 0; + m_previous_border_y = 0; + machine().first_screen()->register_screen_bitmap(m_border_bitmap); + m_previous_screen_x = 0; + m_previous_screen_y = 0; + machine().first_screen()->register_screen_bitmap(m_screen_bitmap); + + m_screen_location = m_ram->pointer() + (5 << 14); +} + + +/* return the color to be used inverting FLASHing colors if necessary */ +inline unsigned char spectrum_state::get_display_color (unsigned char color, int invert) +{ + if (invert && (color & 0x80)) + return (color & 0xc0) + ((color & 0x38) >> 3) + ((color & 0x07) << 3); + else + return color; +} + +/* Code to change the FLASH status every 25 frames. Note this must be + independent of frame skip etc. */ +void spectrum_state::screen_eof_spectrum(screen_device &screen, bool state) +{ + // rising edge + if (state) + { + spectrum_UpdateBorderBitmap(); + spectrum_UpdateScreenBitmap(true); + + m_frame_number++; + + if (m_frame_number >= m_frame_invert_count) + { + m_frame_number = 0; + m_flash_invert = !m_flash_invert; + } + } +} + + + +/*************************************************************************** + Update the spectrum screen display. + + The screen consists of 312 scanlines as follows: + 64 border lines (the last 48 are actual border lines; the others may be + border lines or vertical retrace) + 192 screen lines + 56 border lines + + Each screen line has 48 left border pixels, 256 screen pixels and 48 right + border pixels. + + Each scanline takes 224 T-states divided as follows: + 128 Screen (reads a screen and ATTR byte [8 pixels] every 4 T states) + 24 Right border + 48 Horizontal retrace + 24 Left border + + The 128K Spectrums have only 63 scanlines before the TV picture (311 total) + and take 228 T-states per scanline. + +***************************************************************************/ + +inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix16(y, x) = (UINT16)color; +} + +UINT32 spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + static const rectangle rect(SPEC_LEFT_BORDER, SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE - 1, SPEC_TOP_BORDER, SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE - 1); + + if (m_border_bitmap.valid()) + copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect); + + spectrum_UpdateScreenBitmap(); + if (m_screen_bitmap.valid()) + copyscrollbitmap(bitmap, m_screen_bitmap, 0, 0, 0, 0, rect); + +#if 0 + // note, don't update borders in here, this can time travel w/regards to other timers and may end up giving you + // screen positions earlier than the last write handler gave you + + /* for now do a full-refresh */ + int x, y, b, scrx, scry; + unsigned short ink, pap; + unsigned char *attr, *scr; + // int full_refresh = 1; + + scr=m_screen_location; + + for (y=0; y<192; y++) + { + scrx=SPEC_LEFT_BORDER; + scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); + attr=m_screen_location + ((scry>>3)*32) + 0x1800; + + for (x=0;x<32;x++) + { + /* Get ink and paper colour with bright */ + if (m_flash_invert && (*attr & 0x80)) + { + ink=((*attr)>>3) & 0x0f; + pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + } + else + { + ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + pap=((*attr)>>3) & 0x0f; + } + + for (b=0x80;b!=0;b>>=1) + { + if (*scr&b) + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); + else + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); + } + + scr++; + attr++; + } + } +#endif + + return 0; +} + + +static const rgb_t spectrum_palette[16] = { + rgb_t(0x00, 0x00, 0x00), + rgb_t(0x00, 0x00, 0xbf), + rgb_t(0xbf, 0x00, 0x00), + rgb_t(0xbf, 0x00, 0xbf), + rgb_t(0x00, 0xbf, 0x00), + rgb_t(0x00, 0xbf, 0xbf), + rgb_t(0xbf, 0xbf, 0x00), + rgb_t(0xbf, 0xbf, 0xbf), + rgb_t(0x00, 0x00, 0x00), + rgb_t(0x00, 0x00, 0xff), + rgb_t(0xff, 0x00, 0x00), + rgb_t(0xff, 0x00, 0xff), + rgb_t(0x00, 0xff, 0x00), + rgb_t(0x00, 0xff, 0xff), + rgb_t(0xff, 0xff, 0x00), + rgb_t(0xff, 0xff, 0xff) +}; +/* Initialise the palette */ +PALETTE_INIT_MEMBER(spectrum_state,spectrum) +{ + palette.set_pen_colors(0, spectrum_palette, ARRAY_LENGTH(spectrum_palette)); +} + +void spectrum_state::spectrum_UpdateScreenBitmap(bool eof) +{ + unsigned int x = machine().first_screen()->hpos(); + unsigned int y = machine().first_screen()->vpos(); + int width = m_screen_bitmap.width(); + int height = m_screen_bitmap.height(); + + + if ((m_previous_screen_x == x) && (m_previous_screen_y == y) && !eof) + return; + + if (m_screen_bitmap.valid()) + { + //printf("update screen from %d,%d to %d,%d\n", m_previous_screen_x, m_previous_screen_y, x, y); + + do + { + UINT16 scrx = m_previous_screen_x - SPEC_LEFT_BORDER; + UINT16 scry = m_previous_screen_y - SPEC_TOP_BORDER; + + if (scrx < SPEC_DISPLAY_XSIZE && scry < SPEC_DISPLAY_YSIZE) + { + // this can/must be optimised + if ((scrx & 7) == 0) { + UINT16 *bm = &m_screen_bitmap.pix16(m_previous_screen_y, m_previous_screen_x); + UINT8 attr = *(m_screen_location + ((scry & 0xF8) << 2) + (scrx >> 3) + 0x1800); + UINT8 scr = *(m_screen_location + ((scry & 7) << 8) + ((scry & 0x38) << 2) + ((scry & 0xC0) << 5) + (scrx >> 3)); + UINT16 ink = (attr & 0x07) + ((attr >> 3) & 0x08); + UINT16 pap = (attr >> 3) & 0x0f; + + if (m_flash_invert && (attr & 0x80)) + scr = ~scr; + + for (UINT8 b = 0x80; b != 0; b >>= 1) + *bm++ = (scr & b) ? ink : pap; + } + } + + m_previous_screen_x += 1; + + if (m_previous_screen_x >= width) + { + m_previous_screen_x = 0; + m_previous_screen_y += 1; + + if (m_previous_screen_y >= height) + { + m_previous_screen_y = 0; + } + } + } while (!((m_previous_screen_x == x) && (m_previous_screen_y == y))); + + } +} + +/* The code below is just a per-pixel 'partial update' for the border */ + +void spectrum_state::spectrum_UpdateBorderBitmap() +{ + unsigned int x = machine().first_screen()->hpos(); + unsigned int y = machine().first_screen()->vpos(); + int width = m_border_bitmap.width(); + int height = m_border_bitmap.height(); + + + if (m_border_bitmap.valid()) + { + UINT16 border = m_port_fe_data & 0x07; + + //printf("update border from %d,%d to %d,%d\n", m_previous_border_x, m_previous_border_y, x, y); + + do + { + m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border; + + m_previous_border_x += 1; + + if (m_previous_border_x >= width) + { + m_previous_border_x = 0; + m_previous_border_y += 1; + + if (m_previous_border_y >= height) + { + m_previous_border_y = 0; + } + } + } + while (!((m_previous_border_x == x) && (m_previous_border_y == y))); + + } + else + { + // no border bitmap allocated? fatalerror? + } + + +} diff --git a/src/mame/video/ssystem3.c b/src/mame/video/ssystem3.c new file mode 100644 index 00000000000..a755dff5a4b --- /dev/null +++ b/src/mame/video/ssystem3.c @@ -0,0 +1,236 @@ +// license:GPL-2.0+ +// copyright-holders:Peter Trauner +/****************************************************************************** + PeT mess@utanet.at +******************************************************************************/ + +#include "emu.h" +#include "includes/ssystem3.h" + +void ssystem3_state::ssystem3_lcd_reset() +{ + m_lcd.count=0; m_lcd.clock=1; +} + +void ssystem3_state::ssystem3_lcd_write(int clock, int data) +{ + if (clock&&!m_lcd.clock) { + m_lcd.data[m_lcd.count/8]&=~(1<<(m_lcd.count&7)); + if (data) m_lcd.data[m_lcd.count/8]|=1<<(m_lcd.count&7); + if (m_lcd.count+1==40) { + logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)m_maincpu->pc(), + m_lcd.data[0], m_lcd.data[1], m_lcd.data[2], m_lcd.data[3], m_lcd.data[4]); + } + m_lcd.count=(m_lcd.count+1)%40; + } + m_lcd.clock=clock; +} + + + +static const unsigned char ssystem3_palette[] = +{ + 0,12,12, + 80,82,75, + 0,12,12 +}; + + +PALETTE_INIT_MEMBER(ssystem3_state, ssystem3) +{ + int i; + + for ( i = 0; i < sizeof(ssystem3_palette) / 3; i++ ) { + m_palette->set_pen_color(i, ssystem3_palette[i*3], ssystem3_palette[i*3+1], ssystem3_palette[i*3+2]); + } +} + + +void ssystem3_state::video_start() +{ + // artwork seams to need this + m_videoram = auto_alloc_array(machine(), UINT8, 6 * 2 + 24); +} + + +static const char led[]={ + " aaaaaaaaaaaa\r" + " f aaaaaaaaaa b\r" + " ff aaaaaaaa bb\r" + " fff aaaaaa bbb\r" + " ffff bbbb\r" + " ffff bbbb\r" + " ffff bbbb\r" + " ffff bbbb\r" + " ffff bbbb\r" + " ffff bbbb\r" + " fff bbb\r" + " f gggggggg b\r" + " gggggggggggg\r" + " gggggggggggg\r" + " e gggggggg c\r" + " eee ccc\r" + " eeee cccc\r" + " eeee cccc\r" + "eeee cccc\r" + "eeee cccc\r" + "eeee cccc\r" + "eeee cccc\r" + "eee dddddd ccc\r" + "ee dddddddd cc\r" + "e dddddddddd c\r" + " dddddddddddd" +}; + +void ssystem3_state::ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y) +{ + int i, xi, yi, mask, color; + + for (i=0, xi=0, yi=0; led[i]; i++) { + mask=0; + switch (led[i]) { + case 'a': mask=0x80; break; + case 'b': mask=0x40; break; + case 'c': mask=0x20; break; + case 'd': mask=0x10; break; + case 'e': mask=8; break; + case 'f': mask=4; break; + case 'g': mask=2; break; + case 'h': + // this is more likely wired to the separate leds + mask=1; + break; + } + + if (mask!=0) { + color=(value&mask)?1:0; + bitmap.pix16(y+yi, x+xi) = color; + } + if (led[i]!='\r') xi++; + else { yi++, xi=0; } + } +} + +static const struct { + int x,y; +} ssystem3_led_pos[5]={ + {150,123}, + {170,123}, + {200,123}, + {220,123}, + {125,123} +}; + +static const char single_led[]= +" c 1 1\r" +" bb ccccc bb 1 1\r" +" bb c bb 1 1\r" +" bb bb bb bb 1 1\r" +" bb bbbbbbbbbbb bb 111 111\r" +" 1 1\r" +" 99 9999999 99 1 1\r" +" 99 99 1 1\r" +" 88888888888 9 1 1\r" +" 88 8 9999\r" +" 8888 6666666 8 9999\r" +" 8888 6 6\r" +" 6 777 6\r" +" 6 777 6\r" +" 6 777 6\r" +" 6 777 6\r" +" 6 77777 6\r" +" 6 77777 6 2 2 4\r" +" 6 7777777 6 2 2 4\r" +" 6 7777777 6 2 2 4\r" +" 6 777777777 6 2 2 44444\r" +" 6 777777777 6 2 2 4\r" +" 6 77777777777 6 2 2 33433\r" +" 6 7 6 2 2 4\r" +" 6666666 7 6666666 2 2 4\r" +" 7 2 2 4\r" +" 77777777777777777\r" +"\r" +"\r" +"\r" +" 5555555555555555555 000000 000000 00 00 0000000 00 00 00000000 00 00 00 0000000\r" +"5 5 0000000 00000000 000 000 00000000 00 00 00000000 00 000 00 00000000\r" +"5 5 00 00 00 0000 0000 00 00 00 00 00 00 0000 00 00\r" +"5 5 00 00 00 00 00 00 00 00000000 00 00 00 00 00 00 00 00 0000\r" +"5 5 00 00 00 00 00 00 00 0000000 00 00 00 00 00 0000 00 00\r" +"5 5 0000000 00000000 00 0000 00 00 00000000 00 00 00 000 00000000\r" +" 55555555 55555555 000000 000000 00 00 00 00 000000 00 00 00 00 0000000" +; + +void ssystem3_state::ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch) +{ + int j, xi=0; + for (j=0; single_led[j]; j++) { + switch (single_led[j]) { + default: + if (ch==single_led[j]) { + bitmap.pix16(y, x+xi) = color; + } + xi++; + break; + case ' ': + xi++; + break; + case '\r': + xi=0; + y++; + break; + }; + } +} + +UINT32 ssystem3_state::screen_update_ssystem3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int i; + + for (i=0; i<4; i++) { + ssystem3_draw_7segment(bitmap, m_lcd.data[1+i], ssystem3_led_pos[i].x, ssystem3_led_pos[i].y); + } + + ssystem3_draw_led(bitmap, m_lcd.data[0]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '0'); //? + ssystem3_draw_led(bitmap, m_lcd.data[0]&2?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '5'); + ssystem3_draw_led(bitmap, m_lcd.data[0]&4?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '7'); + ssystem3_draw_led(bitmap, m_lcd.data[0]&8?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, 'b'); + ssystem3_draw_led(bitmap, m_lcd.data[0]&0x10?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '9'); + ssystem3_draw_led(bitmap, m_lcd.data[0]&0x20?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '8'); + ssystem3_draw_led(bitmap, m_lcd.data[0]&0x40?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, 'c'); + ssystem3_draw_led(bitmap, m_lcd.data[0]&0x80?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '6'); + ssystem3_draw_led(bitmap, m_lcd.data[1]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '2'); + ssystem3_draw_led(bitmap, m_lcd.data[2]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '1'); //? + ssystem3_draw_led(bitmap, m_lcd.data[3]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '3'); + ssystem3_draw_led(bitmap, m_lcd.data[4]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '4'); + + if (m_configuration->read() & 1) { // playfield(optional device) + static const int lcd_signs_on[]={ + 0, // empty + 1, // bauer + 3, // springer + 0x11, // l??ufer + 7, // turm + 0x1f, // dame + 0x17, // k??nig + 0 + }; + int y, x; + for (y=0; y<8; y++) { + for (x=0; x<8; x++) { + int figure, black; + int xp=263+x*22; + int yp=55+(y^7)*28; + ssystem3_playfield_getfigure(x, y, &figure, &black); + ssystem3_draw_led(bitmap, lcd_signs_on[figure]&1?1:0, xp, yp, '6'); + ssystem3_draw_led(bitmap, lcd_signs_on[figure]&2?1:0, xp, yp, '8'); + ssystem3_draw_led(bitmap, lcd_signs_on[figure]&4?1:0, xp, yp, '9'); + ssystem3_draw_led(bitmap, lcd_signs_on[figure]&8?1:0, xp, yp, 'b'); + ssystem3_draw_led(bitmap, lcd_signs_on[figure]&0x10?1:0, xp, yp, 'c'); + ssystem3_draw_led(bitmap, figure!=0 && black?1:0, xp, yp, '7'); + } + } + } + + return 0; +} diff --git a/src/mame/video/stic.c b/src/mame/video/stic.c new file mode 100644 index 00000000000..b5b8dbfb6a4 --- /dev/null +++ b/src/mame/video/stic.c @@ -0,0 +1,974 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,Frank Palazzolo +/********************************************************************** + + General Instruments AY-3-8900-1 a.k.a. Standard Television Interface Chip + (STIC) emulation for Mattel Intellivision + + *********************************************************************/ + +#include "emu.h" +#include "video/stic.h" + + +const device_type STIC = &device_creator; + +//------------------------------------------------- +// stic_device - constructor +//------------------------------------------------- + +stic_device::stic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, STIC, "STIC (Standard Television Interface Chip) Video Chip", tag, owner, clock, "stic", __FILE__), + m_grom(*this, "grom"), + m_x_scale(1), + m_y_scale(1) +{ +} + + +//------------------------------------------------- +// ~stic_device - destructor +//------------------------------------------------- + +stic_device::~stic_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void stic_device::device_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); + + save_item(NAME(m_stic_registers)); + save_item(NAME(m_gramdirty)); + save_item(NAME(m_gram)); + save_item(NAME(m_gramdirtybytes)); + save_item(NAME(m_color_stack_mode)); + save_item(NAME(m_color_stack_offset)); + save_item(NAME(m_stic_handshake)); + save_item(NAME(m_border_color)); + save_item(NAME(m_col_delay)); + save_item(NAME(m_row_delay)); + save_item(NAME(m_left_edge_inhibit)); + save_item(NAME(m_top_edge_inhibit)); + save_item(NAME(m_backtab_buffer)); + for (int sp = 0; sp < STIC_MOBS; sp++) + { + save_item(m_sprite[sp].visible, "STIC sprite/m_sprite[sp].visible", sp); + save_item(m_sprite[sp].xpos, "STIC sprite/m_sprite[sp].xpos", sp); + save_item(m_sprite[sp].ypos, "STIC sprite/m_sprite[sp].ypos", sp); + save_item(m_sprite[sp].coll, "STIC sprite/m_sprite[sp].coll", sp); + save_item(m_sprite[sp].collision, "STIC sprite/m_sprite[sp].collision", sp); + save_item(m_sprite[sp].doublex, "STIC sprite/m_sprite[sp].doublex", sp); + save_item(m_sprite[sp].doubley, "STIC sprite/m_sprite[sp].doubley", sp); + save_item(m_sprite[sp].quady, "STIC sprite/m_sprite[sp].quady", sp); + save_item(m_sprite[sp].xflip, "STIC sprite/m_sprite[sp].xflip", sp); + save_item(m_sprite[sp].yflip, "STIC sprite/m_sprite[sp].yflip", sp); + save_item(m_sprite[sp].behind_foreground, "STIC sprite/m_sprite[sp].behind_foreground", sp); + save_item(m_sprite[sp].grom, "STIC sprite/m_sprite[sp].grom", sp); + save_item(m_sprite[sp].card, "STIC sprite/m_sprite[sp].card", sp); + save_item(m_sprite[sp].color, "STIC sprite/m_sprite[sp].color", sp); + save_item(m_sprite[sp].doubleyres, "STIC sprite/m_sprite[sp].doubleyres", sp); + save_item(m_sprite[sp].dirty, "STIC sprite/m_sprite[sp].dirty", sp); + save_item(m_sprite_buffers[sp], "STIC sprite/m_sprite[sp].sprite_buffers", sp); + } +} + +void stic_device::device_reset() +{ + for (int i = 0; i < STIC_MOBS; i++) + { + intv_sprite_type* s = &m_sprite[i]; + s->visible = 0; + s->xpos = 0; + s->ypos = 0; + s->coll = 0; + s->collision = 0; + s->doublex = 0; + s->doubley = 0; + s->quady = 0; + s->xflip = 0; + s->yflip = 0; + s->behind_foreground = 0; + s->grom = 0; + s->card = 0; + s->color = 0; + s->doubleyres = 0; + s->dirty = 1; + for (int j = 0; j < 16; j++) + { + for (int k = 0; k < 128; k++) + { + m_sprite_buffers[i][j][k] = 0; + } + } + } + + memset(m_stic_registers, 0, sizeof(m_stic_registers)); + m_gramdirty = 1; + for (int i = 0; i < 64; i++) + { + m_gram[i] = 0; + m_gramdirtybytes[i] = 1; + } + + m_color_stack_mode = 0; + m_color_stack_offset = 0; + m_stic_handshake = 0; + m_border_color = 0; + m_col_delay = 0; + m_row_delay = 0; + m_left_edge_inhibit = 0; + m_top_edge_inhibit = 0; +} + +ROM_START( stic_grom ) + ROM_REGION( 0x800, "grom", ROMREGION_ERASEFF ) + ROM_LOAD( "ro-3-9503-003.u21", 0, 0x0800, CRC(683a4158) SHA1(f9608bb4ad1cfe3640d02844c7ad8e0bcd974917)) +ROM_END + +const rom_entry *stic_device::device_rom_region() const +{ + return ROM_NAME( stic_grom ); +} + + + +#define FOREGROUND_BIT 0x0010 + +// conversion from Intellivision color to internal representation +#define SET_COLOR(c) ((c * 2) + 1) +#define GET_COLOR(c) ((c - 1) / 2) + +/* initialized to non-zero, because we divide by it */ + +void stic_device::intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + int w, h; + + // output scaling + x *= m_x_scale; + y *= m_y_scale; + color = SET_COLOR(color); + + for (h = 0; h < m_y_scale; h++) + for (w = 0; w < m_x_scale; w++) + bitmap.pix16(y + h, x + w) = color; +} + +UINT32 stic_device::intv_get_pixel(bitmap_ind16 &bitmap, int x, int y) +{ + return GET_COLOR(bitmap.pix16(y * m_y_scale, x * m_x_scale)); +} + +void stic_device::intv_plot_box(bitmap_ind16 &bitmap, int x, int y, int w, int h, int color) +{ + bitmap.plot_box(x * m_x_scale, y * m_y_scale, w * m_x_scale, h * m_y_scale, SET_COLOR(color)); +} + + +int stic_device::sprites_collide(int spriteNum1, int spriteNum2) +{ + INT16 x0, y0, w0, h0, x1, y1, w1, h1, x2, y2, w2, h2; + + intv_sprite_type* s1 = &m_sprite[spriteNum1]; + intv_sprite_type* s2 = &m_sprite[spriteNum2]; + + x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH; + y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT; + x1 = (s1->xpos + x0) * STIC_X_SCALE; y1 = (s1->ypos + y0) * STIC_Y_SCALE; + x2 = (s2->xpos + x0) * STIC_X_SCALE; y2 = (s2->ypos + y0) * STIC_Y_SCALE; + w1 = (s1->doublex ? 2 : 1) * STIC_CARD_WIDTH; + w2 = (s2->doublex ? 2 : 1) * STIC_CARD_WIDTH; + h1 = (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) * (s1->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; + h2 = (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) * (s2->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; + + if ((x1 >= x2 + w2) || (y1 >= y2 + h2) || + (x2 >= x1 + w1) || (y2 >= y1 + h1)) + return FALSE; + + // iterate over the intersecting bits to see if any touch + x0 = MAX(x1, x2); + y0 = MAX(y1, y2); + w0 = MIN(x1 + w1, x2 + w2) - x0; + h0 = MIN(y1 + h1, y2 + h2) - y0; + x1 = x0 - x1; + y1 = y0 - y1; + x2 = x0 - x2; + y2 = y0 - y2; + for (x0 = 0; x0 < w0; x0++) + { + for (y0 = 0; y0 < h0; y0++) + { + if (m_sprite_buffers[spriteNum1][x0 + x1][y0 + y1] && + m_sprite_buffers[spriteNum2][x0 + x2][y0 + y2]) + return TRUE; + } + } + + return FALSE; +} + +void stic_device::determine_sprite_collisions() +{ + // check sprite to sprite collisions + for (int i = 0; i < STIC_MOBS - 1; i++) + { + intv_sprite_type* s1 = &m_sprite[i]; + if (s1->xpos == 0 || !s1->coll) + continue; + + for (int j = i + 1; j < STIC_MOBS; j++) + { + intv_sprite_type* s2 = &m_sprite[j]; + if (s2->xpos == 0 || !s2->coll) + continue; + + if (sprites_collide(i, j)) + { + s1->collision |= (1 << j); + s2->collision |= (1 << i); + } + } + } +} + +void stic_device::render_sprites() +{ + INT32 cardMemoryLocation, pixelSize; + INT32 spritePixelHeight; + INT32 nextMemoryLocation; + INT32 nextData; + INT32 nextX; + INT32 nextY; + INT32 xInc; + + for (int i = 0; i < STIC_MOBS; i++) + { + intv_sprite_type* s = &m_sprite[i]; + + if (s->grom) + cardMemoryLocation = (s->card * STIC_CARD_HEIGHT); + else + cardMemoryLocation = ((s->card & 0x003F) * STIC_CARD_HEIGHT); + + pixelSize = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1); + spritePixelHeight = pixelSize * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; + + for (int j = 0; j < spritePixelHeight; j++) + { + nextMemoryLocation = (cardMemoryLocation + (j/pixelSize)); + if (s->grom) + nextData = m_grom[nextMemoryLocation]; + else if (nextMemoryLocation < 0x200) + nextData = m_gram[nextMemoryLocation]; + else + nextData = 0xFFFF; + nextX = (s->xflip ? ((s->doublex ? 2 : 1) * STIC_CARD_WIDTH - 1) : 0); + nextY = (s->yflip ? (spritePixelHeight - j - 1) : j); + xInc = (s->xflip ? -1: 1); + + for (int k = 0; k < STIC_CARD_WIDTH * (1 + s->doublex); k++) + { + m_sprite_buffers[i][nextX + k * xInc][nextY] = (nextData & (1 << ((STIC_CARD_WIDTH - 1) - k / (1 + s->doublex)))) != 0; + } + } + } +} + +void stic_device::render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor) +{ + UINT32 color; + + for (int i = 0; i < STIC_CARD_WIDTH; i++) + { + color = (nextByte & (1 << ((STIC_CARD_WIDTH - 1) - i)) ? fgcolor : bgcolor); + intv_set_pixel(bitmap, x+i, y, color); + intv_set_pixel(bitmap, x+i, y+1, color); + } +} + +void stic_device::render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3) +{ + intv_plot_box(bitmap, x, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color0); + intv_plot_box(bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color1); + intv_plot_box(bitmap, x, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color2); + intv_plot_box(bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color3); +} + +void stic_device::render_color_stack_mode(bitmap_ind16 &bitmap) +{ + INT16 w, h, nextx, nexty; + UINT8 csPtr = 0; + UINT16 nextCard; + + for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; + h < STIC_BACKTAB_HEIGHT; + h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) + { + for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; + w < STIC_BACKTAB_WIDTH; + w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) + { + nextCard = m_backtab_buffer[h][w]; + + // colored squares mode + if ((nextCard & (STIC_CSTM_FG3|STIC_CSTM_SEL)) == STIC_CSTM_FG3) + { + UINT8 csColor = m_stic_registers[STIC_CSR + csPtr]; + UINT8 color0 = nextCard & STIC_CSQM_A; + UINT8 color1 = (nextCard & STIC_CSQM_B) >> 3; + UINT8 color2 = (nextCard & STIC_CSQM_C) >> 6; + UINT8 color3 = ((nextCard & STIC_CSQM_D2) >> 11) | + ((nextCard & (STIC_CSQM_D10)) >> 9); + render_colored_squares(bitmap, nextx, nexty, + (color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)), + (color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)), + (color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)), + (color3 == 7 ? csColor : (color3 | FOREGROUND_BIT))); + } + //color stack mode + else + { + UINT8 isGrom; + UINT16 memoryLocation, fgcolor, bgcolor; + UINT8* memory; + + //advance the color pointer, if necessary + if (nextCard & STIC_CSTM_ADV) + csPtr = (csPtr+1) & (STIC_CSRS - 1); + + fgcolor = ((nextCard & STIC_CSTM_FG3) >> 9) | + (nextCard & (STIC_CSTM_FG20)) | FOREGROUND_BIT; + bgcolor = m_stic_registers[STIC_CSR + csPtr] & STIC_CSR_BG; + + isGrom = !(nextCard & STIC_CSTM_SEL); + if (isGrom) + { + memoryLocation = nextCard & STIC_CSTM_C; + memory = m_grom; + for (int j = 0; j < STIC_CARD_HEIGHT; j++) + render_line(bitmap, memory[memoryLocation + j], + nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); + } + else + { + memoryLocation = nextCard & STIC_CSTM_C50; + memory = m_gram; + for (int j = 0; j < STIC_CARD_HEIGHT; j++) + render_line(bitmap, memory[memoryLocation + j], + nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); + } + } + } + } +} + +void stic_device::render_fg_bg_mode(bitmap_ind16 &bitmap) +{ + INT16 w, h, nextx, nexty; + UINT8 isGrom, fgcolor, bgcolor; + UINT16 nextCard, memoryLocation; + UINT8* memory; + + for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; + h < STIC_BACKTAB_HEIGHT; + h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) + { + for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; + w < STIC_BACKTAB_WIDTH; + w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) + { + nextCard = m_backtab_buffer[h][w]; + fgcolor = (nextCard & STIC_FBM_FG) | FOREGROUND_BIT; + bgcolor = ((nextCard & STIC_FBM_BG2) >> 11) | + ((nextCard & STIC_FBM_BG310) >> 9); + + isGrom = !(nextCard & STIC_FBM_SEL); + if (isGrom) + { + memoryLocation = nextCard & STIC_FBM_C; + memory = m_grom; + for (int j = 0; j < STIC_CARD_HEIGHT; j++) + render_line(bitmap, memory[memoryLocation + j], + nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); + } + else + { + memoryLocation = nextCard & STIC_FBM_C; + memory = m_gram; + for (int j = 0; j < STIC_CARD_HEIGHT; j++) + render_line(bitmap, memory[memoryLocation + j], + nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); + } + } + } +} + +void stic_device::copy_sprites_to_background(bitmap_ind16 &bitmap) +{ + UINT8 width, currentPixel; + UINT8 borderCollision, foregroundCollision; + UINT8 spritePixelHeight, x, y; + INT16 leftX, nextY; + INT16 leftBorder, rightBorder, topBorder, bottomBorder; + INT32 nextX; + + for (int i = STIC_MOBS - 1; i >= 0; i--) + { + intv_sprite_type *s = &m_sprite[i]; + if (s->xpos == 0 || (!s->coll && !s->visible)) + continue; + + borderCollision = FALSE; + foregroundCollision = FALSE; + + spritePixelHeight = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; + width = (s->doublex ? 2 : 1) * STIC_CARD_WIDTH; + + leftX = (s->xpos - STIC_CARD_WIDTH + STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; + nextY = (s->ypos - STIC_CARD_HEIGHT + STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; + + leftBorder = (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : 0)) * STIC_X_SCALE; + rightBorder = (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 - 1) * STIC_X_SCALE; + topBorder = (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : 0)) * STIC_Y_SCALE; + bottomBorder = (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE - 1; + + for (y = 0; y < spritePixelHeight; y++) + { + for (x = 0; x < width; x++) + { + //if this sprite pixel is not on, then don't paint it + if (!m_sprite_buffers[i][x][y]) + continue; + + nextX = leftX + x; + //if the next pixel location is on the border, then we + //have a border collision and we can ignore painting it + if ((nextX < leftBorder) || (nextX > rightBorder) || + (nextY < topBorder) || (nextY > bottomBorder)) + { + borderCollision = TRUE; + continue; + } + + currentPixel = intv_get_pixel(bitmap, nextX, nextY); + + //check for foreground collision + if (currentPixel & FOREGROUND_BIT) + { + foregroundCollision = TRUE; + if (s->behind_foreground) + continue; + } + + if (s->visible) + { + intv_set_pixel(bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT)); + } + } + nextY++; + } + + //update the collision bits + if (s->coll) + { + if (foregroundCollision) + s->collision |= STIC_MCR_BKGD; + if (borderCollision) + s->collision |= STIC_MCR_BRDR; + } + } +} + +void stic_device::render_background(bitmap_ind16 &bitmap) +{ + if (m_color_stack_mode) + render_color_stack_mode(bitmap); + else + render_fg_bg_mode(bitmap); +} + +#ifdef UNUSED_CODE +void stic_device::draw_background(bitmap_ind16 &bitmap, int transparency) +{ + // First, draw the background + int offs = 0; + int value = 0; + int row,col; + int fgcolor,bgcolor = 0; + int code; + + int colora, colorb, colorc, colord; + + int n_bit; + int p_bit; + int g_bit; + + int j; + + int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay; + int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay; + + if (m_color_stack_mode == 1) + { + m_color_stack_offset = 0; + for(row = 0; row < STIC_BACKTAB_HEIGHT; row++) + { + for(col = 0; col < STIC_BACKTAB_WIDTH; col++) + { + value = m_ram16[offs]; + + n_bit = value & STIC_CSTM_ADV; + p_bit = value & STIC_CSTM_FG3; + g_bit = value & STIC_CSTM_SEL; + + if (p_bit && (!g_bit)) // colored squares mode + { + colora = value & STIC_CSQM_A; + colorb = (value & STIC_CSQM_B) >> 3; + colorc = (value & STIC_CSQM_C) >> 6; + colord = ((n_bit & STIC_CSQM_D2) >> 11) + ((value & STIC_CSQM_D10) >> 9); + // color 7 if the top of the color stack in this mode + if (colora == 7) colora = m_stic_registers[STIC_CSR + STIC_CSR3]; + if (colorb == 7) colorb = m_stic_registers[STIC_CSR + STIC_CSR3]; + if (colorc == 7) colorc = m_stic_registers[STIC_CSR + STIC_CSR3]; + if (colord == 7) colord = m_stic_registers[STIC_CSR + STIC_CSR3]; + intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora); + intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb); + intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc); + intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colord); + } + else // normal color stack mode + { + if (n_bit) // next color + { + m_color_stack_offset += 1; + m_color_stack_offset &= (STIC_CSRS - 1); + } + + if (p_bit) // pastel color set + fgcolor = (value & STIC_CSTM_FG20) + 8; + else + fgcolor = value & STIC_CSTM_FG20; + + bgcolor = m_stic_registers[STIC_CSR + m_color_stack_offset]; + code = (value & STIC_CSTM_C)>>3; + + if (g_bit) // read from gram + { + code &= (STIC_CSTM_C50 >> 3); // keep from going outside the array + //if (m_gramdirtybytes[code] == 1) + { + decodechar(m_gfxdecode->gfx(1), + code, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + m_gramdirtybytes[code] = 0; + } + // Draw GRAM char + drawgfx(bitmap,m_gfxdecode->gfx(1), + code, + bgcolor*16+fgcolor, + 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, + 0,transparency,bgcolor); + + for(j=0;j<8;j++) + { + //intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 1); + } + + } + else // read from grom + { + drawgfx(bitmap,m_gfxdecode->gfx(0), + code, + bgcolor*16+fgcolor, + 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, + 0,transparency,bgcolor); + + for(j=0;j<8;j++) + { + //intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 2); + } + } + } + offs++; + } // next col + } // next row + } + else + { + // fg/bg mode goes here + for(row = 0; row < STIC_BACKTAB_HEIGHT; row++) + { + for(col = 0; col < STIC_BACKTAB_WIDTH; col++) + { + value = m_ram16[offs]; + fgcolor = value & STIC_FBM_FG; + bgcolor = ((value & STIC_FBM_BG2) >> 11) + ((value & STIC_FBM_BG310) >> 9); + code = (value & STIC_FBM_C) >> 3; + + if (value & STIC_FBM_SEL) // read for GRAM + { + //if (m_gramdirtybytes[code] == 1) + { + decodechar(m_gfxdecode->gfx(1), + code, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + m_gramdirtybytes[code] = 0; + } + // Draw GRAM char + drawgfx(bitmap,m_gfxdecode->gfx(1), + code, + bgcolor*16+fgcolor, + 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, + 0,transparency,bgcolor); + } + else // read from GROM + { + drawgfx(bitmap,m_gfxdecode->gfx(0), + code, + bgcolor*16+fgcolor, + 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, + 0,transparency,bgcolor); + } + offs++; + } // next col + } // next row + } +} +#endif + +/* TBD: need to handle sprites behind foreground? */ +#ifdef UNUSED_FUNCTION +void stic_device::draw_sprites(bitmap_ind16 &bitmap, int behind_foreground) +{ + int code; + int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH; + int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT; + + for (int i = STIC_MOBS - 1; i >= 0; --i) + { + intv_sprite_type *s = &m_sprite[i]; + if (s->visible && (s->behind_foreground == behind_foreground)) + { + code = s->card; + if (!s->grom) + { + code %= 64; // keep from going outside the array + if (s->yres == 1) + { + //if (m_gramdirtybytes[code] == 1) + { + decodechar(m_gfxdecode->gfx(1), + code, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + m_gramdirtybytes[code] = 0; + } + // Draw GRAM char + m_gfxdecode->gfx(1)->zoom_transpen(bitmap,&machine().screen[0].visarea, + code, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, + 0x8000 * s->xsize, 0x8000 * s->ysize,0); + } + else + { + //if ((m_gramdirtybytes[code] == 1) || (m_gramdirtybytes[code+1] == 1)) + { + decodechar(m_gfxdecode->gfx(1), + code, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + decodechar(m_gfxdecode->gfx(1), + code+1, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + m_gramdirtybytes[code] = 0; + m_gramdirtybytes[code+1] = 0; + } + // Draw GRAM char + m_gfxdecode->gfx(1)->zoom_transpen(bitmap,&machine().screen[0].visarea, + code, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, + 0x8000*s->xsize, 0x8000*s->ysize,0); + m_gfxdecode->gfx(1)->zoom_transpen(bitmap,&machine().screen[0].visarea, + code+1, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, + 0x8000*s->xsize, 0x8000*s->ysize,0); + } + } + else + { + if (s->yres == 1) + { + // Draw GROM char + m_gfxdecode->gfx(0)->zoom_transpen(bitmap,&machine().screen[0].visarea, + code, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, + 0x8000*s->xsize, 0x8000*s->ysize,0); + } + else + { + m_gfxdecode->gfx(0)->zoom_transpen(bitmap,&machine().screen[0].visarea, + code, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, + 0x8000*s->xsize, 0x8000*s->ysize,0); + m_gfxdecode->gfx(0)->zoom_transpen(bitmap,&machine().screen[0].visarea, + code+1, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, + 0x8000*s->xsize, 0x8000*s->ysize,0); + } + } + } + } +} +#endif + +void stic_device::draw_borders(bitmap_ind16 &bitmap) +{ + intv_plot_box(bitmap, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : m_col_delay)) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color); + intv_plot_box(bitmap, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1) * STIC_X_SCALE, 0, STIC_OVERSCAN_RIGHT_WIDTH, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color); + + intv_plot_box(bitmap, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : m_row_delay)) * STIC_Y_SCALE, m_border_color); + intv_plot_box(bitmap, 0, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT * STIC_Y_SCALE, m_border_color); +} + +void stic_device::screenrefresh() +{ + if (m_stic_handshake != 0) + { + m_stic_handshake = 0; + // Render the background + render_background(m_bitmap); + // Render the sprites into their buffers + render_sprites(); + for (int i = 0; i < STIC_MOBS; i++) + m_sprite[i].collision = 0; + // Copy the sprites to the background + copy_sprites_to_background(m_bitmap); + determine_sprite_collisions(); + for (int i = 0; i < STIC_MOBS; i++) + m_stic_registers[STIC_MCR + i] |= m_sprite[i].collision; + /* draw the screen borders if enabled */ + draw_borders(m_bitmap); + } + else + { + /* STIC disabled, just fill with border color */ + m_bitmap.fill(SET_COLOR(m_border_color)); + } +} + + + +READ16_MEMBER( stic_device::read ) +{ + //logerror("%x = stic_r(%x)\n",0,offset); + switch (offset) + { + case STIC_MXR + STIC_MOB0: + case STIC_MXR + STIC_MOB1: + case STIC_MXR + STIC_MOB2: + case STIC_MXR + STIC_MOB3: + case STIC_MXR + STIC_MOB4: + case STIC_MXR + STIC_MOB5: + case STIC_MXR + STIC_MOB6: + case STIC_MXR + STIC_MOB7: + return 0x3800 | (m_stic_registers[offset] & 0x07FF); + case STIC_MYR + STIC_MOB0: + case STIC_MYR + STIC_MOB1: + case STIC_MYR + STIC_MOB2: + case STIC_MYR + STIC_MOB3: + case STIC_MYR + STIC_MOB4: + case STIC_MYR + STIC_MOB5: + case STIC_MYR + STIC_MOB6: + case STIC_MYR + STIC_MOB7: + return 0x3000 | (m_stic_registers[offset] & 0x0FFF); + case STIC_MAR + STIC_MOB0: + case STIC_MAR + STIC_MOB1: + case STIC_MAR + STIC_MOB2: + case STIC_MAR + STIC_MOB3: + case STIC_MAR + STIC_MOB4: + case STIC_MAR + STIC_MOB5: + case STIC_MAR + STIC_MOB6: + case STIC_MAR + STIC_MOB7: + return m_stic_registers[offset] & 0x3FFF; + case STIC_MCR + STIC_MOB0: + case STIC_MCR + STIC_MOB1: + case STIC_MCR + STIC_MOB2: + case STIC_MCR + STIC_MOB3: + case STIC_MCR + STIC_MOB4: + case STIC_MCR + STIC_MOB5: + case STIC_MCR + STIC_MOB6: + case STIC_MCR + STIC_MOB7: + return 0x3C00 | (m_stic_registers[offset] & 0x03FF); + case STIC_GMR: + m_color_stack_mode = 1; + //logerror("Setting color stack mode\n"); + /*** fall through ***/ + case STIC_DER: + return 0x3FFF; + case STIC_CSR + STIC_CSR0: + case STIC_CSR + STIC_CSR1: + case STIC_CSR + STIC_CSR2: + case STIC_CSR + STIC_CSR3: + case STIC_BCR: + return 0x3FF0 | (m_stic_registers[offset] & 0x000F); + case STIC_HDR: + case STIC_VDR: + return 0x3FF8 | (m_stic_registers[offset] & 0x0007); + case STIC_CBR: + return 0x3FFC | (m_stic_registers[offset] & 0x0003); + default: + //logerror("unmapped read from STIC register %02X\n", offset); + return 0x3FFF; + } +} + +WRITE16_MEMBER( stic_device::write ) +{ + intv_sprite_type *s; + + //logerror("stic_w(%x) = %x\n",offset,data); + switch (offset) + { + // X Positions + case STIC_MXR + STIC_MOB0: + case STIC_MXR + STIC_MOB1: + case STIC_MXR + STIC_MOB2: + case STIC_MXR + STIC_MOB3: + case STIC_MXR + STIC_MOB4: + case STIC_MXR + STIC_MOB5: + case STIC_MXR + STIC_MOB6: + case STIC_MXR + STIC_MOB7: + s = &m_sprite[offset & (STIC_MOBS - 1)]; + s->doublex = !!(data & STIC_MXR_XSIZE); + s->visible = !!(data & STIC_MXR_VIS); + s->coll = !!(data & STIC_MXR_COL); + s->xpos = (data & STIC_MXR_X); + break; + // Y Positions + case STIC_MYR + STIC_MOB0: + case STIC_MYR + STIC_MOB1: + case STIC_MYR + STIC_MOB2: + case STIC_MYR + STIC_MOB3: + case STIC_MYR + STIC_MOB4: + case STIC_MYR + STIC_MOB5: + case STIC_MYR + STIC_MOB6: + case STIC_MYR + STIC_MOB7: + s = &m_sprite[offset & (STIC_MOBS - 1)]; + s->yflip = !!(data & STIC_MYR_YFLIP); + s->xflip = !!(data & STIC_MYR_XFLIP); + s->quady = !!(data & STIC_MYR_YSIZE); + s->doubley = !!(data & STIC_MYR_YFULL); + s->doubleyres = !!(data & STIC_MYR_YRES); + s->ypos = (data & STIC_MYR_Y); + break; + // Attributes + case STIC_MAR + STIC_MOB0: + case STIC_MAR + STIC_MOB1: + case STIC_MAR + STIC_MOB2: + case STIC_MAR + STIC_MOB3: + case STIC_MAR + STIC_MOB4: + case STIC_MAR + STIC_MOB5: + case STIC_MAR + STIC_MOB6: + case STIC_MAR + STIC_MOB7: + s = &m_sprite[offset & (STIC_MOBS - 1)]; + s->behind_foreground = !!(data & STIC_MAR_PRI); + s->grom = !(data & STIC_MAR_SEL); + s->card = ((data & STIC_MAR_C) >> 3); + s->color = ((data & STIC_MAR_FG3) >> 9) | (data & STIC_MAR_FG20); + break; + // Collision Detection - TBD + case STIC_MCR + STIC_MOB0: + case STIC_MCR + STIC_MOB1: + case STIC_MCR + STIC_MOB2: + case STIC_MCR + STIC_MOB3: + case STIC_MCR + STIC_MOB4: + case STIC_MCR + STIC_MOB5: + case STIC_MCR + STIC_MOB6: + case STIC_MCR + STIC_MOB7: + // a MOB's own collision bit is *always* zero, even if a + // one is poked into it + data &= ~(1 << (offset & (STIC_MOBS - 1))); + break; + // Display enable + case STIC_DER: + //logerror("***Writing a %x to the STIC handshake\n",data); + m_stic_handshake = 1; + break; + // Graphics Mode + case STIC_GMR: + m_color_stack_mode = 0; + break; + // Color Stack + case STIC_CSR + STIC_CSR0: + case STIC_CSR + STIC_CSR1: + case STIC_CSR + STIC_CSR2: + case STIC_CSR + STIC_CSR3: + logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, space.device().safe_pc()); + break; + // Border Color + case STIC_BCR: + //logerror("***Writing a %x to the border color\n",data); + m_border_color = data & STIC_BCR_BC; + break; + // Framing + case STIC_HDR: + m_col_delay = data & STIC_HDR_DEL; + break; + case STIC_VDR: + m_row_delay = data & STIC_VDR_DEL; + break; + case STIC_CBR: + m_left_edge_inhibit = (data & STIC_CBR_COL); + m_top_edge_inhibit = (data & STIC_CBR_ROW) >> 1; + break; + default: + //logerror("unmapped write to STIC register %02X: %04X\n", offset, data); + break; + } + + if (offset < ARRAY_LENGTH(m_stic_registers)) + m_stic_registers[offset] = data; +} + + +READ16_MEMBER( stic_device::gram_read ) +{ + return m_gram[offset]; +} + +WRITE16_MEMBER( stic_device::gram_write ) +{ + data &= 0xff; + m_gram[offset] = data; + m_gramdirtybytes[offset] = 1; + m_gramdirty = 1; +} + + + +UINT32 stic_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} diff --git a/src/mame/video/stic.h b/src/mame/video/stic.h new file mode 100644 index 00000000000..2865bfaef39 --- /dev/null +++ b/src/mame/video/stic.h @@ -0,0 +1,559 @@ +// license:BSD-3-Clause +// copyright-holders:Nathan Woods,Frank Palazzolo +/***************************************************************************** + * + * includes/stic.h + * + ****************************************************************************/ + +#ifndef STIC_H_ +#define STIC_H_ + +// GROM/GRAM cards are 8x8 +#define STIC_CARD_WIDTH 8 +#define STIC_CARD_HEIGHT 8 + +// Intellivision resolution is 20x12 BACKTAB CARDs, minus the rightmost column, +// for an effective resolution of (19 * 8 + 1 * 7) x (12 * 8) == 159x96. +// +// MOB scanline height can be half of a card scanline height, so y-coordinates +// are scaled by 2. +#define STIC_X_SCALE 1 +#define STIC_Y_SCALE 2 + +// the Intellivision emulation scales to match the output format at the last +// step. The Intellivision keyboard component appears to be 320x96, but can +// also run Intellivision carts, so x-coordinates are conditionally scaled +// by 2. +#define INTV_X_SCALE 1 +#define INTV_Y_SCALE 1 +#define INTVKBD_X_SCALE 2 +#define INTVKBD_Y_SCALE INTV_Y_SCALE + +// overscan sizes in intv pixels +// these values are approximate. +#define STIC_OVERSCAN_LEFT_WIDTH 13 +#define STIC_OVERSCAN_RIGHT_WIDTH 17 +#define STIC_OVERSCAN_TOP_HEIGHT 12 +#define STIC_OVERSCAN_BOTTOM_HEIGHT 12 + +//Timing constants based on Joe Zbiciak's documentation +#define STIC_CYCLES_PER_SCANLINE 57 +#define STIC_ROW_BUSRQ 110 // CPU paused during backtab row buffering +#define STIC_FRAME_BUSRQ 42 // CPU paused just after end of vblank and before first row fetch (approximate) +#define STIC_VBLANK_END 3790 +#define STIC_FIRST_FETCH 3933 + +/*** STIC registers *********************************************************/ + +// number of STIC registers +#define STIC_REGISTERS 0x33 + +// STIC MOBs (Moveable OBjects) +enum +{ + STIC_MOB0, + STIC_MOB1, + STIC_MOB2, + STIC_MOB3, + STIC_MOB4, + STIC_MOB5, + STIC_MOB6, + STIC_MOB7, + + STIC_MOBS +}; + +// STIC Color Stack +enum +{ + STIC_CSR0, + STIC_CSR1, + STIC_CSR2, + STIC_CSR3, + + STIC_CSRS +}; + +/**************************************************************************** + * * + * MXR 0000[..0007] MOB X REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-----+---+---+--+--+--+--+--+--+--+--+ * + * | | | | | |XSIZE|VIS|COL|X7|X6|X5|X4|X3|X2|X1|X0| * + * +-+-+-+-+-+-----+---+---+--+--+--+--+--+--+--+--+ * + * * + * Xn x-position [0..255] * + * COL collision detection [1=enable] * + * VIS visibility [1=visible] * + * XSIZE double width [1=double] * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. If X=0, the sprite is not visible and does not register collisions. * + * 2. The horizontal handle is 8 pixels from the left of the sprite, * + * regardless of width. * + * * + ****************************************************************************/ +#define STIC_MXR 0x0000 + +#define STIC_MXR_XSIZE 0x0400 +#define STIC_MXR_VIS 0x0200 +#define STIC_MXR_COL 0x0100 +#define STIC_MXR_X 0x00FF + +/**************************************************************************** + * * + * MYR 0008[..000F] MOB Y REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-----+-----+-----+-----+----+--+--+--+--+--+--+--+ * + * | | | | |YFLIP|XFLIP|YSIZE|YFULL|YRES|Y6|Y5|Y4|Y3|Y2|Y1|Y0| * + * +-+-+-+-+-----+-----+-----+-----+----+--+--+--+--+--+--+--+ * + * * + * Yn y-position [0..127] * + * YRES y-resolution [0=8 scanlines,1=16 scanlines] * + * YFULL double scanline height [1=double] * + * YSIZE quadruple scanline height [1=quadruple] * + * XFLIP horizontally flip image [1=flip] * + * YFLIP vertically flip image [1=flip] * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. A sprite with YRES=1 will display two cards. * + * 2. A sprite with YFULL=0 and YSIZE=0 will have scanlines half the * + * height of a background card. * + * 3, The minimum size of a sprite is 8x8 (XSIZE=YRES=YSIZE=YFULL=0). * + * 4. The maximum size of a sprite is 16x128 (XSIZE=YRES=YSIZE=YFULL=1). * + * 5. The Y-position is measured in double height scanlines. * + * 6. The vertical handle is 8 double height scanlines from the top of the * + * sprite, regardless of height. * + * * + ****************************************************************************/ +#define STIC_MYR 0x0008 + +#define STIC_MYR_YFLIP 0x0800 +#define STIC_MYR_XFLIP 0x0400 +#define STIC_MYR_YSIZE 0x0200 +#define STIC_MYR_YFULL 0x0100 +#define STIC_MYR_YRES 0x0080 +#define STIC_MYR_Y 0x007F + +/**************************************************************************** + * * + * SAR 0010[..0017] MOB ATTRIBUTE REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+---+---+---+-+-+--+--+--+--+--+--+---+---+---+ * + * | | |PRI|FG3|SEL| | |C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * + * +-+-+---+---+---+-+-+--+--+--+--+--+--+---+---+---+ * + * * + * FGn foreground color [0..15] * + * Cn card # [0..63] * + * SEL card memory select [0=GROM, 1=GRAM] * + * PRI sprite priority [1=behind set background bit] * + * * + ****************************************************************************/ +#define STIC_MAR 0x0010 + +#define STIC_MAR_PRI 0x2000 +#define STIC_MAR_FG3 0x1000 +#define STIC_MAR_SEL 0x0800 +#define STIC_MAR_C 0x07F8 +#define STIC_MAR_FG20 0x0007 + +/**************************************************************************** + * * + * SCR 0018[..001F] MOB COLLISION REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-+----+----+----+----+----+----+----+----+----+----+ * + * | | | | | | |BRDR|BKGD|SPR7|SPR6|SPR5|SPR4|SPR3|SPR2|SPR1|SPR0| * + * +-+-+-+-+-+-+----+----+----+----+----+----+----+----+----+----+ * + * * + * SPRn 1=collision with sprite #n * + * BKGD 1=collsion with set background bit * + * BRDR 1=collision with screen border * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. All collisions are latched. Successive reads read from the latch. * + * A write will reset the latch. * + * 2. Sprites with VIS=0 register collisions. * + * 3. Sprites with X=0 do not register collisions. * + * 4. Two overlapping sprites with different priorities, one completely * + * hidden behind the background, still register a collision. * + * * + ****************************************************************************/ +#define STIC_MCR 0x0018 + +#define STIC_MCR_BRDR 0x0200 +#define STIC_MCR_BKGD 0x0100 +#define STIC_MCR_SPR7 0x0080 +#define STIC_MCR_SPR6 0x0040 +#define STIC_MCR_SPR5 0x0020 +#define STIC_MCR_SPR4 0x0010 +#define STIC_MCR_SPR3 0x0008 +#define STIC_MCR_SPR2 0x0004 +#define STIC_MCR_SPR1 0x0002 +#define STIC_MCR_SPR0 0x0001 + +/**************************************************************************** + * * + * DER 0021 DISPLAY ENABLE REGISTER W * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * + * | | | | | | | | | | | | | | | | | * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. Any write during VBLANK enables STIC output. * + * * + ****************************************************************************/ +#define STIC_DER 0x0020 + +/**************************************************************************** + * * + * GMR 0021 GRAPHICS MODE REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * + * | | | | | | | | | | | | | | | | | * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. Any write during VBLANK enables FOREGROUND/BACKGROUND mode. * + * 2. Any read during VBLANK enables COLOR STACK/COLORED SQUARES mode. * + * * + ****************************************************************************/ +#define STIC_GMR 0x0021 + +/**************************************************************************** + * * + * CSR 0028 COLOR STACK REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * + * | | | | | | | | | | | | |BG3|BG2|BG1|BG0| * + * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * + * * + * BGn background color [0..15] * + * * + ****************************************************************************/ +#define STIC_CSR 0x0028 + +#define STIC_CSR_BG 0x000F + +/**************************************************************************** + * * + * BCR 002C BORDER COLOR REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * + * | | | | | | | | | | | | |BC3|BC2|BC1|BC0| * + * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * + * * + * BCn border color [0..15] * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. Affects overscan, and column and row blockouts. * + * * + ****************************************************************************/ +#define STIC_BCR 0x002C + +#define STIC_BCR_BC 0x000F + +/**************************************************************************** + * * + * HDR 0030 HORIZONTAL DELAY REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * + * | | | | | | | | | | | | | |DEL2|DEL1|DEL0| * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * + * * + * DELn horizontal delay [0..7] * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. Affects both BACKTAB and MOBs. * + * * + ****************************************************************************/ +#define STIC_HDR 0x0030 + +#define STIC_HDR_DEL 0x0007 + +/**************************************************************************** + * * + * STIC_VDR 0030 VERTICAL DELAY REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * + * | | | | | | | | | | | | | |DEL2|DEL1|DEL0| * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * + * * + * DELn vertical delay [0..7] * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. Affects both BACKTAB and MOBs. * + * * + ****************************************************************************/ +#define STIC_VDR 0x0031 + +#define STIC_VDR_DEL 0x0007 + +/**************************************************************************** + * * + * STIC_CBR 0032 CARD BLOCKOUT REGISTER RW * + * * + * (MSB) (LSB) * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+---+ * + * | | | | | | | | | | | | | | |ROW|COL| * + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+---+ * + * * + * COL blockout first card column [1=blockout] * + * ROW blockout first card row [1=blockout] * + * * + **************************************************************************** + * * + * NOTES * + * * + * 1. Generally used in conjunction with HDR and VDR registers, to achieve * + * smooth scrolling. * + * * + ****************************************************************************/ +#define STIC_CBR 0x0032 + +#define STIC_CBR_ROW 0x0002 +#define STIC_CBR_COL 0x0001 + +/*** BACKTAB ****************************************************************/ + +// BACKTAB is made up of 20x12 cards +// (the first 19 columns are 8x8, the 20th column is 7x8) +#define STIC_BACKTAB_WIDTH 20 +#define STIC_BACKTAB_HEIGHT 12 + +/**************************************************************************** + * * + * FOREGROUND/BACKGROUND MODE * + * * + * (MSB) (LSB) * + * +-+-+---+---+---+---+---+--+--+--+--+--+--+---+---+---+ * + * | | |BG2|BG3|SEL|BG1|BG0|C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * + * +-+-+---+---+---+---+---+--+--+--+--+--+--+---+---+---+ * + * * + * FGn foreground color [0..7] * + * Cn card # [0..63] * + * SEL card memory select [0=GROM, 1=GRAM] * + * BGn background color [0..15] * + * * + ****************************************************************************/ +#define STIC_FBM_BG2 0x2000 +#define STIC_FBM_BG310 0x1600 +#define STIC_FBM_SEL 0x0800 +#define STIC_FBM_C 0x01F8 +#define STIC_FBM_FG 0x0007 + +/**************************************************************************** + * * + * COLOR STACK MODE * + * * + * (MSB) (LSB) * + * +-+-+---+---+---+--+--+--+--+--+--+--+--+---+---+---+ * + * | | |ADV|FG3|SEL|C7|C6|C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * + * +-+-+---+---+---+--+--+--+--+--+--+--+--+---+---+---+ * + * * + * FGn foreground color [0..15] * + * Cn card # [GROM=0..212, GRAM=0..63] * + * SEL card memory select [0=GROM, 1=GRAM] * + * ADV advance color stack index [1=advance] * + * * + **************************************************************************** + * * + * NOTES: * + * * + * 1. When FG3=1 and SEL=0, COLORED SQUARES MODE is enabled. * + * 2. When SEL=1, C7 and C6 can be used as user-defined flags. * + * * + ****************************************************************************/ +#define STIC_CSTM_ADV 0x2000 +#define STIC_CSTM_FG3 0x1000 +#define STIC_CSTM_SEL 0x0800 +#define STIC_CSTM_C7 0x0400 +#define STIC_CSTM_C6 0x0200 +#define STIC_CSTM_C50 0x01F8 +#define STIC_CSTM_FG20 0x0007 + +#define STIC_CSTM_C (STIC_CSTM_C7|STIC_CSTM_C6|STIC_CSTM_C50) + +/**************************************************************************** + * * + * COLORED SQUARES MODE * + * * + * (MSB) (LSB) * + * +-+-+--+-+-+--+--+--+--+--+--+--+--+--+--+--+ * + * | | |D2|1|0|D1|D0|C2|C1|C0|B2|B1|B0|A2|A1|A0| * + * +-+-+--+-+-+--+--+--+--+--+--+--+--+--+--+--+ * + * * + * An color a [0..7] * + * Bn color b [0..7] * + * Cn color c [0..7] * + * Dn color d [0..7] * + * * + **************************************************************************** + * * + * NOTES: * + * * + * 1. Each color corresponds to one of the following 4 x 4 squares: * + * * + * +---+---+ * + * | a | b | * + * +---+---+ * + * | c | d | * + * +---+---+ * + * * + * 2. When color 7 is specified, the color is taken from the color stack. * + * * + ****************************************************************************/ +#define STIC_CSQM_D2 0x2000 +#define STIC_CSQM_D10 0x0600 +#define STIC_CSQM_C 0x01C0 +#define STIC_CSQM_B 0x0038 +#define STIC_CSQM_A 0x0007 + +#define STIC_CSQM_WIDTH (STIC_CARD_WIDTH / 2) +#define STIC_CSQM_HEIGHT (STIC_CARD_HEIGHT / 2) + + + +struct intv_sprite_type +{ + int visible; + int xpos; + int ypos; + int coll; + int collision; + int doublex; + int doubley; + int quady; + int xflip; + int yflip; + int behind_foreground; + int grom; + int card; + int color; + int doubleyres; + int dirty; +}; + + +// ======================> stic_device + +class stic_device : public device_t +{ +public: + // construction/destruction + stic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~stic_device(); + + DECLARE_READ16_MEMBER(read); + DECLARE_READ16_MEMBER(gram_read); + DECLARE_READ16_MEMBER(grom_read) { if (offset > 0x800) printf("help! %X\n", offset); return (0xff00 | m_grom[offset]); } + DECLARE_WRITE16_MEMBER(write); + DECLARE_WRITE16_MEMBER(gram_write); + + void write_to_btb(int h, int w, UINT16 data) { m_backtab_buffer[h][w] = data; } + int read_row_delay() { return m_row_delay; } + int read_stic_handshake() { return m_stic_handshake; } + void set_x_scale(int val) { m_x_scale = val; } + void set_y_scale(int val) { m_y_scale = val; } + + // device-level overrides + virtual void device_start(); + virtual const rom_entry *device_rom_region() const; + virtual void device_reset(); + + void screenrefresh(); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + + required_region_ptr m_grom; + + void intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + UINT32 intv_get_pixel(bitmap_ind16 &bitmap, int x, int y); + void intv_plot_box(bitmap_ind16 &bm, int x, int y, int w, int h, int color); + int sprites_collide(int spriteNum1, int spriteNum2); + void determine_sprite_collisions(); + void render_sprites(); + void render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor); + void render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3); + void render_color_stack_mode(bitmap_ind16 &bitmap); + void render_fg_bg_mode(bitmap_ind16 &bitmap); + void copy_sprites_to_background(bitmap_ind16 &bitmap); + void render_background(bitmap_ind16 &bitmap); + void draw_borders(bitmap_ind16 &bitmap); + +#ifdef UNUSED_CODE + void draw_background(bitmap_ind16 &bitmap, int transparency); + void draw_sprites(bitmap_ind16 &bitmap, int behind_foreground); +#endif + + bitmap_ind16 m_bitmap; + + intv_sprite_type m_sprite[STIC_MOBS]; + UINT8 m_sprite_buffers[STIC_MOBS][STIC_CARD_WIDTH * 2][STIC_CARD_HEIGHT * 4 * 2 * 2]; + UINT16 m_backtab_buffer[STIC_BACKTAB_HEIGHT][STIC_BACKTAB_WIDTH]; + int m_color_stack_mode; + int m_stic_registers[STIC_REGISTERS]; + int m_color_stack_offset; + int m_stic_handshake; + int m_border_color; + int m_col_delay; + int m_row_delay; + int m_left_edge_inhibit; + int m_top_edge_inhibit; + int m_x_scale; + int m_y_scale; + + UINT8 m_gramdirty; + UINT8 m_gram[512]; + UINT8 m_gramdirtybytes[512]; +}; + +// device type definition +extern const device_type STIC; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS + ***************************************************************************/ + +#define MCFG_STIC_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, STIC, 0) + + +#endif /* STIC_H_ */ diff --git a/src/mame/video/super80.c b/src/mame/video/super80.c new file mode 100644 index 00000000000..5adb90c170c --- /dev/null +++ b/src/mame/video/super80.c @@ -0,0 +1,426 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/* Super80.c written by Robbbert, 2005-2010. See the driver source for documentation. */ + +/* Notes on using MAME MC6845 Device (MMD). + 1. Speed of MMD is about 20% slower than pre-MMD coding + 2. Undocumented cursor start and end-lines is not supported by MMD, so we do it here. */ + + +#include "includes/super80.h" + + + +/**************************** PALETTES for super80m and super80v ******************************************/ + +PALETTE_INIT_MEMBER( super80_state, super80m ) +{ + // RGB + //palette_set_colors_rgb(super80_rgb_palette); + m_palette->set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); /* 0 Black */ + m_palette->set_pen_color(1, rgb_t(0x00, 0x00, 0x00)); /* 1 Black */ + m_palette->set_pen_color(2, rgb_t(0x00, 0x00, 0x7f)); /* 2 Blue */ + m_palette->set_pen_color(3, rgb_t(0x00, 0x00, 0xff)); /* 3 Light Blue */ + m_palette->set_pen_color(4, rgb_t(0x00, 0x7f, 0x00)); /* 4 Green */ + m_palette->set_pen_color(5, rgb_t(0x00, 0xff, 0x00)); /* 5 Bright Green */ + m_palette->set_pen_color(6, rgb_t(0x00, 0x7f, 0x7f)); /* 6 Cyan */ + m_palette->set_pen_color(7, rgb_t(0x00, 0xff, 0xff)); /* 7 Turquoise */ + m_palette->set_pen_color(8, rgb_t(0x7f, 0x00, 0x00)); /* 8 Dark Red */ + m_palette->set_pen_color(9, rgb_t(0xff, 0x00, 0x00)); /* 9 Red */ + m_palette->set_pen_color(10, rgb_t(0x7f, 0x00, 0x7f)); /* 10 Purple */ + m_palette->set_pen_color(11, rgb_t(0xff, 0x00, 0xff)); /* 11 Magenta */ + m_palette->set_pen_color(12, rgb_t(0x7f, 0x7f, 0x00)); /* 12 Lime */ + m_palette->set_pen_color(13, rgb_t(0xff, 0xff, 0x00)); /* 13 Yellow */ + m_palette->set_pen_color(14, rgb_t(0xbf, 0xbf, 0xbf)); /* 14 Off White */ + m_palette->set_pen_color(15, rgb_t(0xff, 0xff, 0xff)); /* 15 White */ + // Composite + m_palette->set_pen_color(16, rgb_t(0x00, 0x00, 0x00)); /* 0 Black */ + m_palette->set_pen_color(17, rgb_t(0x80, 0x80, 0x80)); /* 1 Grey */ + m_palette->set_pen_color(18, rgb_t(0x00, 0x00, 0xff)); /* 2 Blue */ + m_palette->set_pen_color(19, rgb_t(0xff, 0xff, 0x80)); /* 3 Light Yellow */ + m_palette->set_pen_color(20, rgb_t(0x00, 0xff, 0x00)); /* 4 Green */ + m_palette->set_pen_color(21, rgb_t(0xff, 0x80, 0xff)); /* 5 Light Magenta */ + m_palette->set_pen_color(22, rgb_t(0x00, 0xff, 0xff)); /* 6 Cyan */ + m_palette->set_pen_color(23, rgb_t(0xff, 0x40, 0x40)); /* 7 Light Red */ + m_palette->set_pen_color(24, rgb_t(0xff, 0x00, 0x00)); /* 8 Red */ + m_palette->set_pen_color(25, rgb_t(0x00, 0x80, 0x80)); /* 9 Dark Cyan */ + m_palette->set_pen_color(26, rgb_t(0xff, 0x00, 0xff)); /* 10 Magenta */ + m_palette->set_pen_color(27, rgb_t(0x80, 0xff, 0x80)); /* 11 Light Green */ + m_palette->set_pen_color(28, rgb_t(0xff, 0xff, 0x00)); /* 12 Yellow */ + m_palette->set_pen_color(29, rgb_t(0x00, 0x00, 0x80)); /* 13 Dark Blue */ + m_palette->set_pen_color(30, rgb_t(0xff, 0xff, 0xff)); /* 14 White */ + m_palette->set_pen_color(31, rgb_t(0x00, 0x00, 0x00)); /* 15 Black */ +} + + + +void super80_state::screen_eof_super80m(screen_device &screen, bool state) +{ + // rising edge + if (state) + { + /* if we chose another palette or colour mode, enable it */ + m_palette_index = (m_io_config->read() & 0x60) ? 0 : 16; + } +} + +UINT32 super80_state::screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr=32,gfx,screen_on=0; + UINT16 sy=0,ma=m_vidpg,x; + + output_set_value("cass_led",BIT(m_portf0, 5)); + + if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ + screen_on++; + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 32; x++) // done this way to avoid x overflowing on page FF + { + if (screen_on) + chr = m_p_ram[ma | x] & 0x3f; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=32; + } + return 0; +} + +UINT32 super80_state::screen_update_super80d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr=32,gfx,screen_on=0; + UINT16 sy=0,ma=m_vidpg,x; + + output_set_value("cass_led",BIT(m_portf0, 5)); + + if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ + screen_on++; + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 32; x++) + { + if (screen_on) + chr = m_p_ram[ma | x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0); + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=32; + } + return 0; +} + +UINT32 super80_state::screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr=32,gfx,screen_on=0; + UINT16 sy=0,ma=m_vidpg,x; + + output_set_value("cass_led",BIT(m_portf0, 5)); + + if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ + screen_on++; + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 32; x++) + { + if (screen_on) + chr = m_p_ram[ma | x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=32; + } + return 0; +} + +UINT32 super80_state::screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr=32,gfx,screen_on=0; + UINT16 sy=0,ma=m_vidpg,x; + UINT8 col, bg=0, fg=0, options=m_io_config->read(); + + /* get selected character generator */ + UINT8 cgen = m_current_charset ^ ((options & 0x10)>>4); /* bit 0 of port F1 and cgen config switch */ + + output_set_value("cass_led",BIT(m_portf0, 5)); + + if ((BIT(m_portf0, 2)) | (!BIT(options, 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ + screen_on++; + + if (screen_on) + { + if ((options & 0x60) == 0x60) + fg = 15; /* b&w */ + else + fg = 5; /* green */ + } + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 10; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 32; x++) + { + if (screen_on) + chr = m_p_ram[ma | x]; + + if (!(options & 0x40)) + { + col = m_p_ram[0xfe00 | ma | x]; /* byte of colour to display */ + fg = m_palette_index + (col & 0x0f); + bg = m_palette_index + (col >> 4); + } + + /* get pattern of pixels for that character scanline */ + if (cgen) + gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; + else + gfx = m_p_chargen[0x1000 | ((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0); + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7) ? fg : bg; + *p++ = BIT(gfx, 6) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 0) ? fg : bg; + } + } + ma+=32; + } + return 0; +} + +VIDEO_START_MEMBER(super80_state,super80) +{ + m_vidpg = 0xfe00; + m_p_chargen = memregion("chargen")->base(); + m_p_ram = memregion("maincpu")->base(); +} + +/**************************** I/O PORTS *****************************************************************/ + +WRITE8_MEMBER( super80_state::super80_f1_w ) +{ + m_vidpg = (data & 0xfe) << 8; + m_current_charset = data & 1; +} + +/*--------------------------------------------------------------- + + Super-80R and Super-80V + +---------------------------------------------------------------*/ + +static const UINT8 mc6845_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0}; + +READ8_MEMBER( super80_state::super80v_low_r ) +{ + if BIT(m_portf0, 2) + return m_p_videoram[offset]; + else + return m_p_colorram[offset]; +} + +WRITE8_MEMBER( super80_state::super80v_low_w ) +{ + if BIT(m_portf0, 2) + m_p_videoram[offset] = data; + else + m_p_colorram[offset] = data; +} + +READ8_MEMBER( super80_state::super80v_high_r ) +{ + if (!BIT(m_portf0, 2)) + return m_p_colorram[0x800 | offset]; + else + if BIT(m_portf0, 4) + return m_p_pcgram[0x800 | offset]; + else + return m_p_pcgram[offset]; +} + +WRITE8_MEMBER( super80_state::super80v_high_w ) +{ + if (!BIT(m_portf0, 2)) + m_p_colorram[0x800 | offset] = data; + else + { + m_p_videoram[0x800 | offset] = data; + + if BIT(m_portf0, 4) + m_p_pcgram[0x800 | offset] = data; + } +} + +/* The 6845 can produce a variety of cursor shapes - all are emulated here - remove when mame fixed */ +void super80_state::mc6845_cursor_configure() +{ + UINT8 i,curs_type=0,r9,r10,r11; + + /* curs_type holds the general cursor shape to be created + 0 = no cursor + 1 = partial cursor (only shows on a block of scan lines) + 2 = full cursor + 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ + + for ( i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) m_mc6845_cursor[i] = 0; // prepare cursor by erasing old one + + r9 = m_mc6845_reg[9]; // number of scan lines - 1 + r10 = m_mc6845_reg[10] & 0x1f; // cursor start line = last 5 bits + r11 = m_mc6845_reg[11]+1; // cursor end line incremented to suit for-loops below + + /* decide the curs_type by examining the registers */ + if (r10 < r11) curs_type=1; // start less than end, show start to end + else + if (r10 == r11) curs_type=2; // if equal, show full cursor + else curs_type=3; // if start greater than end, it's a two-part cursor + + if ((r11 - 1) > r9) curs_type=2; // if end greater than scan-lines, show full cursor + if (r10 > r9) curs_type=0; // if start greater than scan-lines, then no cursor + if (r11 > 16) r11=16; // truncate 5-bit register to fit our 4-bit hardware + + /* create the new cursor */ + if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(m_mc6845_cursor);i++) m_mc6845_cursor[i]=0xff; // turn on full cursor + + if (curs_type == 1) for (i = r10;i < r11;i++) m_mc6845_cursor[i]=0xff; // for each line that should show, turn on that scan line + + if (curs_type == 3) for (i = r11; i < r10;i++) m_mc6845_cursor[i]=0; // now take a bite out of the middle +} + +VIDEO_START_MEMBER(super80_state,super80v) +{ + m_p_pcgram = memregion("maincpu")->base()+0xf000; + m_p_videoram = memregion("videoram")->base(); + m_p_colorram = memregion("colorram")->base(); +} + +UINT32 super80_state::screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_s_options=m_io_config->read(); + output_set_value("cass_led",BIT(m_portf0, 5)); + m_crtc->screen_update(screen, bitmap, cliprect); + return 0; +} + +MC6845_UPDATE_ROW( super80_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,col,gfx,fg,bg=0; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) // for each character + { + UINT8 inv=0; + // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ + mem = (ma + x) & 0xfff; + chr = m_p_videoram[mem]; + + /* get colour or b&w */ + fg = 5; /* green */ + if ((m_s_options & 0x60) == 0x60) fg = 15; /* b&w */ + + if (~m_s_options & 0x40) + { + col = m_p_colorram[mem]; /* byte of colour to display */ + fg = m_palette_index + (col & 0x0f); + bg = m_palette_index + (col >> 4); + } + + /* if inverse mode, replace any pcgram chrs with inverse chrs */ + if ((!BIT(m_portf0, 4)) && (chr & 0x80)) // is it a high chr in inverse mode + { + inv ^= 0xff; // invert the chr + chr &= 0x7f; // and drop bit 7 + } + + /* process cursor */ + if (x == cursor_x) + inv ^= m_mc6845_cursor[ra]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_pcgram[(chr<<4) | ra] ^ inv; + + /* Display a scanline of a character */ + *p++ = palette[BIT(gfx, 7) ? fg : bg]; + *p++ = palette[BIT(gfx, 6) ? fg : bg]; + *p++ = palette[BIT(gfx, 5) ? fg : bg]; + *p++ = palette[BIT(gfx, 4) ? fg : bg]; + *p++ = palette[BIT(gfx, 3) ? fg : bg]; + *p++ = palette[BIT(gfx, 2) ? fg : bg]; + *p++ = palette[BIT(gfx, 1) ? fg : bg]; + } +} + +/**************************** I/O PORTS *****************************************************************/ + +WRITE8_MEMBER( super80_state::super80v_10_w ) +{ + data &= 0x1f; + m_mc6845_ind = data; + m_crtc->address_w( space, 0, data ); +} + +WRITE8_MEMBER( super80_state::super80v_11_w ) +{ + m_mc6845_reg[m_mc6845_ind] = data & mc6845_mask[m_mc6845_ind]; /* save data in register */ + m_crtc->register_w( space, 0, data ); + if ((m_mc6845_ind > 8) && (m_mc6845_ind < 12)) mc6845_cursor_configure(); /* adjust cursor shape - remove when mame fixed */ +} diff --git a/src/mame/video/thomson.c b/src/mame/video/thomson.c new file mode 100644 index 00000000000..a258bb529da --- /dev/null +++ b/src/mame/video/thomson.c @@ -0,0 +1,1387 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine +/********************************************************************** + + Copyright (C) Antoine Mine' 2006 + + Thomson 8-bit computers + +**********************************************************************/ + +#include +#include "includes/thomson.h" + + +#define VERBOSE 0 +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + + +/* One GPL is what is drawn in 1 us by the video system in the active window. + Most of the time, it corresponds to a 8-pixel wide horizontal span. + For some TO8/9/9+/MO6 modes, it can be 4-pixel or 16-pixel wide. + There are always 40 GPLs in an active row, and it is always defined by + two bytes in video memory (0x2000 bytes appart). +*/ + +#define THOM_GPL_PER_LINE 40 + + +/****************** dynamic screen size *****************/ + + +int thomson_state::thom_update_screen_size() +{ + const rectangle &visarea = m_screen->visible_area(); + UINT8 p = m_io_vconfig->read(); + int new_w, new_h, changed = 0; + + switch ( p & 3 ) + { + case 0: m_thom_bwidth = 56; m_thom_bheight = 47; break; /* as in original (?) */ + case 1: m_thom_bwidth = 16; m_thom_bheight = 16; break; /* small */ + default: m_thom_bwidth = 0; m_thom_bheight = 0; break; /* none */ + } + + switch ( p & 0xc ) + { + case 0: m_thom_hires = 0; break; /* low */ + case 4: m_thom_hires = 1; break; /* high */ + default: m_thom_hires = m_thom_hires_better; break; /* auto */ + } + + new_w = ( 320 + m_thom_bwidth * 2 ) * ( m_thom_hires + 1 ) - 1; + new_h = ( 200 + m_thom_bheight * 2 ) /** (m_thom_hires + 1 )*/ - 1; + if ( ( visarea.max_x != new_w ) || ( visarea.max_y != new_h ) ) + { + changed = 1; + m_screen->set_visible_area(0, new_w, 0, new_h ); + } + + return changed; +} + + + +/*********************** video timing ******************************/ + + +/* elapsed time from beginning of frame, in us */ +unsigned thomson_state::thom_video_elapsed() +{ + unsigned u; + attotime elapsed = m_thom_video_timer->elapsed(); + u = (elapsed * 1000000 ).seconds(); + if ( u >= 19968 ) + u = 19968; + return u; +} + + + +struct thom_vsignal thomson_state::thom_get_vsignal() +{ + struct thom_vsignal v; + int gpl = thom_video_elapsed() - 64 * THOM_BORDER_HEIGHT - 7; + if ( gpl < 0 ) + gpl += 19968; + + v.inil = ( gpl & 63 ) <= 40; + + v.init = gpl < (64 * THOM_ACTIVE_HEIGHT - 24); + + v.lt3 = ( gpl & 8 ) ? 1 : 0; + + v.line = gpl >> 6; + + v.count = v.line * 320 + ( gpl & 63 ) * 8; + + return v; +} + + + +/************************** lightpen *******************************/ + + + +void thomson_state::thom_get_lightpen_pos( int*x, int* y ) +{ + *x = m_io_lightpen_x->read(); + *y = m_io_lightpen_y->read(); + + if ( *x < 0 ) + *x = 0; + + if ( *y < 0 ) + *y = 0; + + if ( *x > 2 * m_thom_bwidth + 319 ) + *x = 2 * m_thom_bwidth + 319; + + if ( *y > 2 * m_thom_bheight + 199 ) + *y = 2 * m_thom_bheight + 199; +} + + + +struct thom_vsignal thomson_state::thom_get_lightpen_vsignal( int xdec, int ydec, int xdec2 ) +{ + struct thom_vsignal v; + int x, y; + int gpl; + + thom_get_lightpen_pos( &x, &y ); + x += xdec - m_thom_bwidth; + y += ydec - m_thom_bheight; + + gpl = (x >> 3) + y * 64; + if ( gpl < 0 ) + gpl += 19968; + + v.inil = (gpl & 63) <= 41; + + v.init = (gpl <= 64 * THOM_ACTIVE_HEIGHT - 24); + + v.lt3 = ( gpl & 8 ) ? 1 : 0; + + v.line = y; + + if ( v.inil && v.init ) + v.count = + ( gpl >> 6 ) * 320 + /* line */ + ( gpl & 63 ) * 8 + /* gpl inside line */ + ( (x + xdec2) & 7 ); /* pixel inside gpl */ + else + v.count = 0; + + return v; +} + + + +void thomson_state::thom_set_lightpen_callback( int nb ) +{ + LOG (( "%f thom_set_lightpen_callback called\n", machine().time().as_double())); + m_thom_lightpen_nb = nb; +} + +TIMER_CALLBACK_MEMBER( thomson_state::thom_lightpen_step ) +{ + int step = param; + + if ( m_thom_lightpen_cb ) + (this->*m_thom_lightpen_cb)( step ); + + if ( step < m_thom_lightpen_nb ) + m_thom_lightpen_timer->adjust(attotime::from_usec( 64 ), step + 1); +} + + + +/***************** scan-line oriented engine ***********************/ + +/* This code, common for all Thomson machines, emulates the TO8 + video hardware, with its 16-colors chosen among 4096, 9 video modes, + and 4 video pages. Moreover, it emulates changing the palette several times + per frame to simulate more than 16 colors per frame (and the same for mode + and page switchs) and cooper effects (distinguishing the left and right + border color of each row). + + TO7, TO7/70 and MO5 video hardware are much simpler (8 or 16 fixed colors, + one mode and one video page). Although the three are different, they can all + be emulated by the TO8 video hardware. + Thus, we use the same TO8-emulation code to deal with these simpler + hardware (although it is somewhat of an overkill). +*/ + + + +/* ---------------- state & state changes ---------------- */ + + +/* returns 1 if the mode is 640 pixel wide, 0 if it is 160 or 320 */ +int thomson_state::thom_mode_is_hires( int mode ) +{ + return ( mode == THOM_VMODE_80 ) || ( mode == THOM_VMODE_80_TO9 ); +} + + + +/* either the border index or its palette entry has changed */ +void thomson_state::thom_border_changed() +{ + unsigned l = thom_video_elapsed(); + unsigned y = l >> 6; + unsigned x = l & 63; + unsigned color = m_thom_pal[ m_thom_border_index ]; + + if ( y >= THOM_TOTAL_HEIGHT ) + { + /* end of page */ + m_thom_border_r[ THOM_TOTAL_HEIGHT ] = color; + } + else if ( ! x ) + { + /* start of line */ + m_thom_border_l[ y ] = color; + m_thom_border_r[ y ] = color; + } + else if ( x <= 19 ) + { + /* between left and right border */ + /* NOTE: this makes the lower right part of the color picker blink + in the TO8/TO9/TO9+, which actually happens on the real computer! + */ + m_thom_border_r[ y ] = color; + m_thom_border_l[ y + 1 ] = color; + } + else + { + /* end of line */ + m_thom_border_l[ y + 1 ] = color; + m_thom_border_r[ y + 1 ] = color; + } + m_thom_vstate_dirty = 1; +} + + + +/* the video mode or page has changed */ +void thomson_state::thom_gplinfo_changed() +{ + unsigned l = thom_video_elapsed() - THOM_BORDER_HEIGHT * 64 - 7; + unsigned y = l >> 6; + unsigned x = l & 63; + int modepage = ((int)m_thom_vmode << 8) | m_thom_vpage; + if ( y >= 200 || x>= 40 ) + m_thom_vmodepage[ 40 ] = modepage; + else + m_thom_vmodepage[ x ] = modepage; + m_thom_vmodepage_changed = 1; +} + + + +void thomson_state::thom_set_border_color( unsigned index ) +{ + assert( index < 16 ); + if ( index != m_thom_border_index ) + { + LOG (( "thom_set_border_color: %i at line %i col %i\n", index, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); + m_thom_border_index = index; + thom_border_changed(); + } +} + + + +void thomson_state::thom_set_palette( unsigned index, UINT16 color ) +{ + assert( index < 16 ); + + if ( color != 0x1000 ) + color &= 0xfff; + + if ( m_thom_pal[ index ] == color ) + return; + + LOG (( "thom_set_palette: %i to %03x at line %i col %i\n", index, color, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); + + m_thom_pal[ index ] = color; + if ( index == m_thom_border_index ) + thom_border_changed(); + m_thom_pal_changed = 1; + m_thom_vstate_dirty = 1; +} + + + +void thomson_state::thom_set_video_mode( unsigned mode ) +{ + assert( mode < THOM_VMODE_NB ); + + if ( mode != m_thom_vmode ) + { + LOG (( "thom_set_video_mode: %i at line %i, col %i\n", mode, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); + m_thom_vmode = mode; + thom_gplinfo_changed(); + m_thom_vstate_dirty = 1; + m_thom_hires_better |= thom_mode_is_hires( mode ); + } +} + + + +void thomson_state::thom_set_video_page( unsigned page ) +{ + assert( page < THOM_NB_PAGES ) + ; + if ( page != m_thom_vpage ) { + LOG (( "thom_set_video_page: %i at line %i col %i\n", page, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); + m_thom_vpage = page; + thom_gplinfo_changed(); + m_thom_vstate_dirty = 1; + } +} + + + +/* -------------- drawing --------------- */ + + + +typedef void ( thomson_state::*thom_scandraw ) ( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + + + +#define UPDATE( name, res ) \ + void thomson_state::name##_scandraw_##res ( \ + UINT8* vram, UINT16* dst, UINT16* pal, \ + int org, int len ) \ + { \ + unsigned gpl; \ + vram += org; \ + dst += org * res; \ + for ( gpl = 0; gpl < len; gpl++, dst += res, vram++ ) { \ + UINT8 rama = vram[ 0 ]; \ + UINT8 ramb = vram[ 0x2000 ]; + +#define END_UPDATE \ + } \ + } + +#define UPDATE_HI( name ) UPDATE( name, 16 ) +#define UPDATE_LOW( name ) UPDATE( name, 8 ) + + + +/* 320x200, 16-colors, constraints: 2 distinct colors per GPL (8 pixels) */ +/* this also works for TO7, assuming the 2 top bits of each color byte are 1 */ + +UPDATE_HI( to770 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ ((ramb & 7) | ((ramb>>4) & 8)) ^ 8 ]; + c[1] = pal[ ((ramb >> 3) & 15) ^ 8 ]; + for ( i = 0; i < 16; i += 2, rama >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; +} +END_UPDATE + +UPDATE_LOW( to770 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ ((ramb & 7) | ((ramb>>4) & 8)) ^ 8 ]; + c[1] = pal[ ((ramb >> 3) & 15) ^ 8 ]; + for ( i = 0; i < 8; i++, rama >>= 1 ) + dst[ 7 - i ] = c[ rama & 1 ]; +} +END_UPDATE + + + +/* as above, different (more logical but TO7-incompatible) color encoding */ + +UPDATE_HI( mo5 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ ramb & 15 ]; + c[1] = pal[ ramb >> 4 ]; + for ( i = 0; i < 16; i += 2, rama >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; +} +END_UPDATE + +UPDATE_LOW( mo5 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ ramb & 15 ]; + c[1] = pal[ ramb >> 4 ]; + for ( i = 0; i < 8; i++, rama >>= 1 ) + dst[ 7 - i ] = c[ rama & 1 ]; +} +END_UPDATE + + +/* as mo5, but with pastel bit switched */ + +UPDATE_HI( mo5alt ) +{ + int i; + pen_t c[2]; + c[0] = pal[ (ramb & 15) ^ 8 ]; + c[1] = pal[ (ramb >> 4) ^ 8 ]; + for ( i = 0; i < 16; i += 2, rama >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; +} +END_UPDATE + +UPDATE_LOW( mo5alt ) +{ + int i; + pen_t c[2]; + c[0] = pal[ (ramb & 15) ^ 8 ]; + c[1] = pal[ (ramb >> 4) ^ 8 ]; + for ( i = 0; i < 8; i++, rama >>= 1 ) + dst[ 7 - i ] = c[ rama & 1 ]; +} +END_UPDATE + + + +/* as to770, but with pastel color bit unswitched */ + +UPDATE_HI( to9 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ (ramb & 7) | ((ramb>>4) & 8) ]; + c[1] = pal[ (ramb >> 3) & 15 ]; + for ( i = 0; i < 16; i += 2, rama >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; +} +END_UPDATE + +UPDATE_LOW( to9 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ (ramb & 7) | ((ramb>>4) & 8) ]; + c[1] = pal[ (ramb >> 3) & 15 ]; + for ( i = 0; i < 8; i++, rama >>= 1 ) + dst[ 7 - i ] = c[ rama & 1 ]; +} +END_UPDATE + + + +/* 320x200, 4-colors, no constraint */ + +UPDATE_HI( bitmap4 ) +{ + int i; + pen_t c[2][2]; + c[0][0] = pal[ 0 ]; + c[0][1] = pal[ 1 ]; + c[1][0] = pal[ 2 ]; + c[1][1] = pal[ 3 ]; + for ( i = 0; i < 16; i += 2, rama >>= 1, ramb >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ] [ ramb & 1 ]; +} +END_UPDATE + +UPDATE_LOW( bitmap4 ) +{ + int i; + pen_t c[2][2]; + c[0][0] = pal[ 0 ]; + c[0][1] = pal[ 1 ]; + c[1][0] = pal[ 2 ]; + c[1][1] = pal[ 3 ]; + for ( i = 0; i < 8; i++, rama >>= 1, ramb >>= 1 ) + dst[ 7 - i ] = c[ rama & 1 ] [ ramb & 1 ]; +} +END_UPDATE + + + +/* as above, but using 2-bit pixels instead of 2 planes of 1-bit pixels */ + +UPDATE_HI( bitmap4alt ) +{ + int i; + pen_t c[4]; + c[0] = pal[ 0 ]; + c[1] = pal[ 1 ]; + c[2] = pal[ 2 ]; + c[3] = pal[ 3 ]; + for ( i = 0; i < 8; i += 2, ramb >>= 2 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ ramb & 3 ]; + for ( i = 0; i < 8; i += 2, rama >>= 2 ) + dst[ 7 - i ] = dst[ 6 - i ] = c[ rama & 3 ]; +} +END_UPDATE + +UPDATE_LOW( bitmap4alt ) +{ + int i; + pen_t c[4]; + c[0] = pal[ 0 ]; + c[1] = pal[ 1 ]; + c[2] = pal[ 2 ]; + c[3] = pal[ 3 ]; + for ( i = 0; i < 4; i++, ramb >>= 2 ) + dst[ 7 - i ] = c[ ramb & 3 ]; + for ( i = 0; i < 4; i++, rama >>= 2 ) + dst[ 3 - i ] = c[ rama & 3 ]; +} +END_UPDATE + + +/* 160x200, 4 colors, no constraint, using only one memory page (undocumented) */ + +UPDATE_HI( bitmap4althalf ) +{ + dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = pal[ rama >> 6 ]; + dst[ 4] = dst[ 5] = dst[ 6] = dst[ 7] = pal[ (rama >> 4) & 3 ]; + dst[ 8] = dst[ 9] = dst[10] = dst[11] = pal[ (rama >> 2) & 3]; + dst[12] = dst[13] = dst[14] = dst[15] = pal[ rama & 3 ]; + (void)ramb; // ramb is not used +} +END_UPDATE + +UPDATE_LOW( bitmap4althalf ) +{ + dst[0] = dst[1] = pal[ rama >> 6 ]; + dst[2] = dst[3] = pal[ (rama >> 4) & 3 ]; + dst[4] = dst[5] = pal[ (rama >> 2) & 3]; + dst[6] = dst[7] = pal[ rama & 3 ]; + (void)ramb; // ramb is not used +} +END_UPDATE + + + +/* 160x200, 16-colors, no constraint */ + +UPDATE_HI( bitmap16 ) +{ + dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = pal[ rama >> 4 ]; + dst[ 4] = dst[ 5] = dst[ 6] = dst[ 7] = pal[ rama & 15 ]; + dst[ 8] = dst[ 9] = dst[10] = dst[11] = pal[ ramb >> 4 ]; + dst[12] = dst[13] = dst[14] = dst[15] = pal[ ramb & 15 ]; +} +END_UPDATE + +UPDATE_LOW( bitmap16 ) +{ + dst[0] = dst[1] = pal[ rama >> 4 ]; + dst[2] = dst[3] = pal[ rama & 15 ]; + dst[4] = dst[5] = pal[ ramb >> 4 ]; + dst[6] = dst[7] = pal[ ramb & 15 ]; +} +END_UPDATE + + + +/* 640x200 (80 text column), 2-colors, no constraint */ + +UPDATE_HI( mode80 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ 0 ]; + c[1] = pal[ 1 ]; + for ( i = 0; i < 8; i++, ramb >>= 1 ) + dst[ 15 - i ] = c[ ramb & 1 ]; + for ( i = 0; i < 8; i++, rama >>= 1 ) + dst[ 7 - i ] = c[ rama & 1 ]; +} +END_UPDATE + +UPDATE_LOW( mode80 ) +{ + /* 640-pixel mode but 320 pixels emulated => we merge pixels */ + int i; + pen_t c[4]; + c[0] = pal[ 0 ]; + c[1] = c[2] = c[3] = pal[ 1 ]; + for ( i = 0; i < 4; i++, ramb >>= 2 ) + dst[ 7 - i ] = c[ ramb & 3 ]; + for ( i = 0; i < 4; i++, rama >>= 2 ) + dst[ 3 - i ] = c[ rama & 3 ]; +} +END_UPDATE + + + +/* as above, but TO9 flavor */ + +UPDATE_HI( mode80_to9 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ 0 ]; + c[1] = pal[ 6 ]; + for ( i = 0; i < 8; i++, ramb >>= 1 ) + dst[ 15 - i ] = c[ ramb & 1 ]; + for ( i = 0; i < 8; i++, rama >>= 1 ) + dst[ 7 - i ] = c[ rama & 1 ]; +} +END_UPDATE + +UPDATE_LOW( mode80_to9 ) +{ + int i; + pen_t c[4]; + c[0] = pal[ 0 ]; + c[1] = c[2] = c[3] = pal[ 6 ]; + for ( i = 0; i < 4; i++, ramb >>= 2 ) + dst[ 7 - i ] = c[ ramb & 3 ]; + for ( i = 0; i < 4; i++, rama >>= 2 ) + dst[ 3 - i ] = c[ rama & 3 ]; +} +END_UPDATE + + + +/* 320x200, 2-colors, two pages (untested) */ + +UPDATE_HI( page1 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ 0 ]; + c[1] = pal[ 1 ]; + for ( i = 0; i < 16; i += 2, rama >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; + (void)ramb; +} +END_UPDATE + +UPDATE_LOW( page1 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ 0 ]; + c[1] = pal[ 1 ]; + for ( i = 0; i < 8; i++, rama >>= 1 ) + dst[ 7 - i ] = c[ rama & 1 ]; + (void)ramb; +} +END_UPDATE + +UPDATE_HI( page2 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ 0 ]; + c[1] = pal[ 2 ]; + for ( i = 0; i < 16; i += 2, ramb >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ ramb & 1 ]; + (void)rama; +} +END_UPDATE + +UPDATE_LOW( page2 ) +{ + int i; + pen_t c[2]; + c[0] = pal[ 0 ]; + c[1] = pal[ 2 ]; + for ( i = 0; i < 8; i++, ramb >>= 1 ) + dst[ 7 - i ] = c[ ramb & 1 ]; + (void)rama; +} +END_UPDATE + + + +/* 320x200, 2-colors, two overlaid pages */ + +UPDATE_HI( overlay ) +{ + int i; + pen_t c[2][2]; + c[0][0] = pal[ 0 ]; + c[0][1] = c[1][1] = pal[ 1 ]; + c[1][0] = pal[ 2 ]; + for ( i = 0; i < 16; i += 2, rama >>= 1, ramb >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = c[ ramb & 1 ] [ rama & 1 ]; +} +END_UPDATE + +UPDATE_LOW( overlay ) +{ + int i; + pen_t c[2][2]; + c[0][0] = pal[ 0 ]; + c[0][1] = c[1][1] = pal[ 1 ]; + c[1][0] = pal[ 2 ]; + for ( i = 0; i < 8; i++, rama >>= 1, ramb >>= 1 ) + dst[ 7 - i ] = c[ ramb & 1 ] [ rama & 1 ]; +} +END_UPDATE + + +/* 160x200 undocumented variant of the above (2-colors, two overlaid pages) */ + +UPDATE_HI( overlayhalf ) +{ + int i; + pen_t c[2][2]; + c[0][0] = pal[ 0 ]; + c[0][1] = c[1][1] = pal[ 1 ]; + c[1][0] = pal[ 2 ]; + rama >>= 4; + ramb >>= 4; + for ( i = 0; i < 16; i += 4, rama >>= 1, ramb >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = dst[ 13 - i ] = dst[ 12 - i ] = + c[ ramb & 1 ] [ rama & 1 ]; +} +END_UPDATE + +UPDATE_LOW( overlayhalf ) +{ + int i; + pen_t c[2][2]; + c[0][0] = pal[ 0 ]; + c[0][1] = c[1][1] = pal[ 1 ]; + c[1][0] = pal[ 2 ]; + rama >>= 4; + ramb >>= 4; + for ( i = 0; i < 8; i += 2, rama >>= 1, ramb >>= 1 ) + dst[ 7 - i ] = dst[ 6 - i ] = c[ ramb & 1 ] [ rama & 1 ]; +} +END_UPDATE + + + +/* 160x200, 4-colors, four overlaid pages */ + +UPDATE_HI( overlay3 ) +{ + /* Note: "Manuel Technique" doc implies that the palette entries are 0,1,2,4,8; + we now use palette entries 0,1,2,3,4 instead, as this is what the TEO emulator uses and it has been confirmed correct + */ + static const int p[2][2][2][2] = { + { { { 0, 1 }, { 2, 1 } }, { { 3, 1 }, { 2, 1 } } }, + { { { 4, 1 }, { 2, 1 } }, { { 3, 1 }, { 2, 1 } } } + }; + int i; + for ( i = 0; i < 16; i += 4, rama >>= 1, ramb >>= 1 ) + dst[ 15 - i ] = dst[ 14 - i ] = dst[ 13 - i ] = dst[ 12 - i ] = + pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ] + [ rama & 1 ] [ (rama >> 4) & 1 ] ]; +} +END_UPDATE + +UPDATE_LOW( overlay3 ) +{ + static const int p[2][2][2][2] = { + { { { 0, 1 }, { 2, 1 } }, { { 3, 1 }, { 2, 1 } } }, + { { { 4, 1 }, { 2, 1 } }, { { 3, 1 }, { 2, 1 } } } + }; + int i; + for ( i = 0; i < 8; i += 2, rama >>= 1, ramb >>= 1 ) + dst[ 7 - i ] = dst[ 6 - i ] = + pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ] + [ rama & 1 ] [ (rama >> 4) & 1 ] ]; +} +END_UPDATE + + + +#define FUN(x) { &thomson_state::x##_scandraw_8, &thomson_state::x##_scandraw_16 } + + +static const thom_scandraw thom_scandraw_funcs[THOM_VMODE_NB][2] = +{ + FUN(to770), FUN(mo5), FUN(bitmap4), FUN(bitmap4alt), FUN(mode80), + FUN(bitmap16), FUN(page1), FUN(page2), FUN(overlay), FUN(overlay3), + FUN(to9), FUN(mode80_to9), + FUN(bitmap4althalf), FUN(mo5alt), FUN(overlayhalf), +}; + + + +/* called at the start of each scanline in the active area, just after + left border (-1<=y<199), and also after the last scanline (y=199) +*/ +TIMER_CALLBACK_MEMBER( thomson_state::thom_scanline_start ) +{ + int y = param; + + /* update active-area */ + if ( y >= 0 && (m_thom_vstate_dirty || m_thom_vstate_last_dirty || m_thom_vmem_dirty[y]) ) + { + int x = 0; + while ( x < 40 ) + { + int xx = x; + unsigned mode = m_thom_vmodepage[x] >> 8; + unsigned page = m_thom_vmodepage[x] & 0xff; + assert( mode < THOM_VMODE_NB ); + assert( page < 4 ); + if ( m_thom_vmodepage_changed ) + { + do + { + xx++; + } + while ( xx < 40 && m_thom_vmodepage[xx] == -1 ); + } + else + { + xx = 40; + } + (this->*thom_scandraw_funcs[ mode ][ m_thom_hires ]) + ( m_thom_vram + y * 40 + page * 0x4000, + m_thom_vbody + y * 320 * (m_thom_hires+1), + m_thom_last_pal, x, xx-x ); + x = xx; + } + m_thom_vmem_dirty[y] = 0; + } + + /* prepare for next scanline */ + if ( y == 199 ) + m_thom_scanline_timer->adjust(attotime::never); + else + { + if ( m_thom_vmodepage_changed ) + { + int x, m = 0; + for ( x = 0; x <= 40; x++ ) + { + if ( m_thom_vmodepage[x] !=-1 ) + { + m = m_thom_vmodepage[x]; + m_thom_vmodepage[x] = -1; + } + } + m_thom_vmodepage[0] = m; + m_thom_vmodepage_changed = 0; + } + + if ( m_thom_pal_changed ) + { + memcpy( m_thom_last_pal, m_thom_pal, 32 ); + m_thom_pal_changed = 0; + } + + m_thom_scanline_timer->adjust(attotime::from_usec(64), y + 1); + } +} + + + +/* -------------- misc --------------- */ + + +#define FLOP_STATE (m_thom_floppy_wcount ? 2 : m_thom_floppy_rcount ? 1 : 0) + + + +void thomson_state::thom_set_mode_point( int point ) +{ + assert( point >= 0 && point <= 1 ); + m_thom_mode_point = ( ! point ) * 0x2000; + m_vrambank->set_entry( ! point ); +} + + + +void thomson_state::thom_floppy_active( int write ) +{ + int fold = FLOP_STATE, fnew; + + /* stays up for a few frames */ + if ( write ) + m_thom_floppy_wcount = 25; + else + m_thom_floppy_rcount = 25; + + /* update icon */ + fnew = FLOP_STATE; + if ( fold != fnew ) + output_set_value( "floppy", fnew ); +} + + + +/* -------------- main update function --------------- */ + + + +UINT32 thomson_state::screen_update_thom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int y, ypos; + const int scale = m_thom_hires ? 2 : 1; + const int xbleft = m_thom_bwidth * scale; + const int xbright = ( m_thom_bwidth + THOM_ACTIVE_WIDTH ) * scale; + const int xright = ( m_thom_bwidth * 2 + THOM_ACTIVE_WIDTH ) * scale; + const int xwidth = THOM_ACTIVE_WIDTH * scale; + const int yup = THOM_BORDER_HEIGHT + THOM_ACTIVE_HEIGHT; + const int ybot = THOM_BORDER_HEIGHT + m_thom_bheight + 200; + UINT16* v = m_thom_vbody; + pen_t border = 0; + rectangle wrect(0, xright - 1, 0, 0); + rectangle lrect(0, xbleft - 1, 0, 0); + rectangle rrect(xbright, xright - 1, 0, 0); + + //LOG (( "%f thom: video update called\n", machine().time().as_double())); + + /* upper border */ + for ( y = 0; y < THOM_BORDER_HEIGHT - m_thom_bheight; y++ ) + { + if ( m_thom_border_l[ y ] != -1 ) + border = m_thom_border_l[ y ]; + } + ypos = 0; + while ( y < THOM_BORDER_HEIGHT ) + { + if ( m_thom_border_l[ y ] != -1 ) + border = m_thom_border_l[ y ]; + wrect.min_y = ypos; + do + { + y++; + ypos ++ /* += scale */; + } + while ( y < THOM_BORDER_HEIGHT && m_thom_border_l[ y ] == -1 ); + wrect.max_y = ypos - 1; + bitmap.fill(border, wrect ); + } + + /* left border */ + while ( y < yup ) + { + if ( m_thom_border_l[ y ] != -1 ) + border = m_thom_border_l[ y ]; + lrect.min_y = ypos; + do + { + y++; + ypos ++ /* += scale */; + } + while ( y < yup && m_thom_border_l[ y ] == -1 ); + lrect.max_y = ypos - 1; + bitmap.fill(border, lrect ); + } + + /* lower border */ + while (y < ybot ) + { + if ( m_thom_border_l[ y ] != -1 ) + border = m_thom_border_l[ y ]; + wrect.min_y = ypos; + do + { + y++; + ypos ++ /* += scale */; + } while ( y < ybot && m_thom_border_l[ y ] == -1 ); + wrect.max_y = ypos - 1; + bitmap.fill(border, wrect ); + } + + /* right border */ + for ( y = 0; y < THOM_BORDER_HEIGHT; y++ ) { + if ( m_thom_border_r[ y ] != -1 ) + border = m_thom_border_r[ y ]; + } + ypos = m_thom_bheight /* * scale */; + while ( y < yup ) + { + if ( m_thom_border_r[ y ] != -1 ) + border = m_thom_border_r[ y ]; + rrect.min_y = ypos; + do + { + y++; + ypos ++ /* += scale */; + } + while ( y < yup && m_thom_border_r[ y ] == -1 ); + rrect.max_y = ypos - 1; + bitmap.fill(border, rrect ); + } + + /* active area */ + ypos = m_thom_bheight /* * scale */; + for ( y = 0; y < 200; v += xwidth, y++ , ypos ++ /* += scale */ ) + { + draw_scanline16( bitmap, xbleft, ypos, xwidth, v, NULL ); +#if 0 + if ( thom_hires ) + draw_scanline16( bitmap, xbleft, ypos+1, xwidth, v, NULL ); +#endif + } + + return 0; +} + + + +/* -------------- frame start ------------------ */ + + +TIMER_CALLBACK_MEMBER( thomson_state::thom_set_init ) +{ + int init = param; + LOG (( "%f thom_set_init: %i, at line %i col %i\n", machine().time().as_double(), init, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); + + if ( m_thom_init_cb ) + (this->*m_thom_init_cb)( init ); + if ( ! init ) + m_thom_init_timer->adjust(attotime::from_usec( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init); +} + +/* call this at the very beginning of each new frame */ +void thomson_state::thom_vblank( screen_device &screen, bool state ) +{ + // rising edge + if (state) + { + int fnew, fold = FLOP_STATE; + int i; + UINT16 b = 0; + struct thom_vsignal l = thom_get_lightpen_vsignal( 0, -1, 0 ); + + LOG (( "%f thom: video eof called\n", machine().time().as_double() )); + + /* floppy indicator count */ + if ( m_thom_floppy_wcount ) + m_thom_floppy_wcount--; + if ( m_thom_floppy_rcount ) + m_thom_floppy_rcount--; + fnew = FLOP_STATE; + if ( fnew != fold ) + output_set_value( "floppy", fnew ); + + /* prepare state for next frame */ + for ( i = 0; i <= THOM_TOTAL_HEIGHT; i++ ) + { + if ( m_thom_border_l[ i ] != -1 ) + b = m_thom_border_l[ i ]; + if ( m_thom_border_r[ i ] != -1 ) + b = m_thom_border_r[ i ]; + } + memset( m_thom_border_l, 0xff, sizeof( m_thom_border_l ) ); + memset( m_thom_border_r, 0xff, sizeof( m_thom_border_r ) ); + m_thom_border_l[ 0 ] = b; + m_thom_border_r[ 0 ] = b; + m_thom_vstate_last_dirty = m_thom_vstate_dirty; + m_thom_vstate_dirty = 0; + + /* schedule first init signal */ + m_thom_init_timer->adjust(attotime::from_usec( 64 * THOM_BORDER_HEIGHT + 7 )); + + /* schedule first lightpen signal */ + l.line &= ~1; /* hack (avoid lock in MO6 palette selection) */ + m_thom_lightpen_timer->adjust( + attotime::from_usec( 64 * ( THOM_BORDER_HEIGHT + l.line - 2 ) + 16 ), 0); + + /* schedule first active-area scanline call-back */ + m_thom_scanline_timer->adjust(attotime::from_usec( 64 * THOM_BORDER_HEIGHT + 7), -1); + + /* reset video frame time */ + m_thom_video_timer->adjust(attotime::zero); + + /* update screen size according to user options */ + if ( thom_update_screen_size() ) + m_thom_vstate_dirty = 1; + + /* hi-res automatic */ + m_thom_hires_better = thom_mode_is_hires( m_thom_vmode ); + } +} + + + +/* -------------- initialization --------------- */ + + +/* TO7, TO7/70 palette, hardcoded in ROM + without further information, we assume that the hardcoded values + are the same as those setup by the TO8/TO9+/MO6 when booting up + */ +static const UINT16 thom_pal_init[16] = +{ + 0x1000, /* 0: black */ 0x000f, /* 1: red */ + 0x00f0, /* 2: geen */ 0x00ff, /* 3: yellow */ + 0x0f00, /* 4: blue */ 0x0f0f, /* 5: purple */ + 0x0ff0, /* 6: cyan */ 0x0fff, /* 7: white */ + 0x0777, /* 8: gray */ 0x033a, /* 9: pink */ + 0x03a3, /* a: light green */ 0x03aa, /* b: light yellow */ + 0x0a33, /* c: light blue */ 0x0a3a, /* d: redish pink */ + 0x0ee7, /* e: light cyan */ 0x007b, /* f: orange */ +}; + +/* MO5 palette, hardcoded in a ROM + values are from "Manuel Technique du MO5", p.19 + */ +static const UINT16 mo5_pal_init[16] = +{ + 0x1000, /* 0: black */ 0x055f, /* 1: red */ + 0x00f0, /* 2: geen */ 0x00ff, /* 3: yellow */ + 0x0f55, /* 4: blue */ 0x0f0f, /* 5: purple */ + 0x0ff5, /* 6: cyan */ 0x0fff, /* 7: white */ + 0x0aaa, /* 8: gray */ 0x0aaf, /* 9: pink */ + 0x0afa, /* a: light green */ 0x0aff, /* b: light yellow */ + 0x0fa5, /* c: light blue */ 0x0faf, /* d: parama pink */ + 0x0ffa, /* e: light cyan */ 0x05af, /* f: orange */ +}; + + +VIDEO_START_MEMBER( thomson_state, thom ) +{ + LOG (( "thom: video start called\n" )); + + /* scan-line state */ + memset( m_thom_border_l, 0xff, sizeof( m_thom_border_l ) ); + memset( m_thom_border_r, 0xff, sizeof( m_thom_border_r ) ); + memset( m_thom_vbody, 0, sizeof( m_thom_vbody ) ); + memset( m_thom_vmodepage, 0xffff, sizeof( m_thom_vmodepage ) ); + memset( m_thom_vmem_dirty, 0, sizeof( m_thom_vmem_dirty ) ); + m_thom_border_l[ 0 ] = 0; + m_thom_border_r[ 0 ] = 0; + m_thom_vmodepage[ 0 ] = 0; + m_thom_vmodepage_changed = 0; + m_thom_vmode = 0; + m_thom_vpage = 0; + m_thom_border_index = 0; + m_thom_vstate_dirty = 1; + m_thom_vstate_last_dirty = 1; + save_pointer(NAME(m_thom_last_pal), sizeof(m_thom_last_pal)); + save_pointer(NAME(m_thom_pal), sizeof(m_thom_pal)); + save_pointer(NAME(m_thom_border_l), sizeof(m_thom_border_l)); + save_pointer(NAME(m_thom_border_r), sizeof(m_thom_border_r)); + save_pointer(NAME(m_thom_vbody), sizeof(m_thom_vbody)); + save_pointer(NAME(m_thom_vmodepage), sizeof(m_thom_vmodepage)); + save_pointer(NAME(m_thom_vmem_dirty), sizeof(m_thom_vmem_dirty)); + save_item(NAME(m_thom_pal_changed)); + save_item(NAME(m_thom_vmodepage_changed)); + save_item(NAME(m_thom_vmode)); + save_item(NAME(m_thom_vpage)); + save_item(NAME(m_thom_border_index)); + save_item(NAME(m_thom_vstate_dirty)); + save_item(NAME(m_thom_vstate_last_dirty)); + + m_thom_mode_point = 0; + save_item(NAME(m_thom_mode_point)); + m_vrambank->set_entry( 0 ); + + m_thom_floppy_rcount = 0; + m_thom_floppy_wcount = 0; + save_item(NAME(m_thom_floppy_wcount)); + save_item(NAME(m_thom_floppy_rcount)); + output_set_value( "floppy", 0 ); + + m_thom_video_timer = machine().scheduler().timer_alloc(FUNC_NULL); + + m_thom_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_scanline_start),this)); + + m_thom_lightpen_nb = 0; + m_thom_lightpen_cb = NULL; + m_thom_lightpen_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_lightpen_step),this)); + save_item(NAME(m_thom_lightpen_nb)); + + m_thom_init_cb = NULL; + m_thom_init_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_set_init),this)); + + save_item(NAME(m_thom_bwidth)); + save_item(NAME(m_thom_bheight)); + save_item(NAME(m_thom_hires)); + save_item(NAME(m_thom_hires_better)); +} + + +/* sets the fixed palette (for MO5,TO7,TO7/70) and gamma correction */ +void thomson_state::thom_configure_palette(double gamma, const UINT16* pal, palette_device& palette) +{ + memcpy( m_thom_last_pal, pal, 32 ); + memcpy( m_thom_pal, pal, 32 ); + + for ( int i = 0; i < 4097; i++ ) + { + UINT8 r = 255. * pow( (i & 15) / 15., gamma ); + UINT8 g = 255. * pow( ((i>> 4) & 15) / 15., gamma ); + UINT8 b = 255. * pow( ((i >> 8) & 15) / 15., gamma ); + /* UINT8 alpha = i & 0x1000 ? 0 : 255; TODO: transparency */ + palette.set_pen_color(i, r, g, b ); + } +} + + +PALETTE_INIT_MEMBER(thomson_state, thom) +{ + LOG (( "thom: palette init called\n" )); + + /* TO8 and later use an EF9369 color palette chip + The spec shows a built-in gamma correction for gamma=2.8 + i.e., output is out = in ^ (1/2.8) + + For the TO7, the gamma correction is irrelevant. + + For the TO7/70, we use the same palette and gamma has the TO8, + which gives good results (but is not verified). + */ + thom_configure_palette(1.0 / 2.8, thom_pal_init, palette); +} + +PALETTE_INIT_MEMBER(thomson_state, mo5) +{ + LOG (( "thom: MO5 palette init called\n" )); + + /* The MO5 has a different fixed palette than the TO7/70. + We use a smaller gamma correction which gives intutively better + results (but is not verified). + */ + thom_configure_palette(1.0, mo5_pal_init, palette); +} + + + +/***************************** TO7 / T9000 *************************/ + + + +/* write to video memory through addresses 0x4000-0x5fff */ +WRITE8_MEMBER( thomson_state::to7_vram_w ) +{ + assert( offset < 0x2000 ); + /* force two topmost color bits to 1 */ + if ( m_thom_mode_point ) + data |= 0xc0; + if ( m_thom_vram[ offset + m_thom_mode_point ] == data ) + return; + m_thom_vram[ offset + m_thom_mode_point ] = data; + /* dirty whole scanline */ + m_thom_vmem_dirty[ offset / 40 ] = 1; +} + + + +/* bits 0-13 : latched gpl of lightpen position */ +/* bit 14: latched INIT */ +/* bit 15: latched INIL */ +unsigned thomson_state::to7_lightpen_gpl ( int decx, int decy ) +{ + int x,y; + thom_get_lightpen_pos( &x, &y ); + x -= m_thom_bwidth; + y -= m_thom_bheight; + if ( x < 0 || y < 0 || x >= 320 || y >= 200 ) + return 0; + x += decx; + y += decy; + return y*40 + x/8 + (x < 320 ? 0x4000 : 0) + 0x8000; +} + + + +/************************** TO7/70 / MO5 ****************************/ + + + +/* write to video memory through addresses 0x4000-0x5fff (TO) + or 0x0000-0x1fff (MO) */ +WRITE8_MEMBER( thomson_state::to770_vram_w ) +{ + assert( offset < 0x2000 ); + if ( m_thom_vram[ offset + m_thom_mode_point ] == data ) + return; + m_thom_vram[ offset + m_thom_mode_point ] = data; + /* dirty whole scanline */ + m_thom_vmem_dirty[ offset / 40 ] = 1; +} + + + + +/***************************** TO8 ******************************/ + + + +/* write to video memory through system space (always page 1) */ + +WRITE8_MEMBER( thomson_state::to8_sys_lo_w ) +{ + UINT8* dst = m_thom_vram + offset + 0x6000; + assert( offset < 0x2000 ); + if ( *dst == data ) + return; + *dst = data; + /* dirty whole scanline */ + m_thom_vmem_dirty[ offset / 40 ] = 1; +} + + + +WRITE8_MEMBER( thomson_state::to8_sys_hi_w ) +{ + UINT8* dst = m_thom_vram + offset + 0x4000; + assert( offset < 0x2000 ); + if ( *dst == data ) return; + *dst = data; + /* dirty whole scanline */ + m_thom_vmem_dirty[ offset / 40 ] = 1; +} + + + +/* write to video memory through data space */ + +WRITE8_MEMBER( thomson_state::to8_data_lo_w ) +{ + UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_data_vpage + 0x2000 ) & m_ram->mask() ); + assert( offset < 0x2000 ); + if ( *dst == data ) + return; + *dst = data; + /* dirty whole scanline */ + if ( m_to8_data_vpage >= 4 ) + return; + m_thom_vmem_dirty[ offset / 40 ] = 1; +} + + + +WRITE8_MEMBER( thomson_state::to8_data_hi_w ) +{ + UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_data_vpage ) & m_ram->mask() ); + assert( offset < 0x2000 ); + if ( *dst == data ) + return; + *dst = data; + /* dirty whole scanline */ + if ( m_to8_data_vpage >= 4 ) + return; + m_thom_vmem_dirty[ offset / 40 ] = 1; +} + + + +/* write to video memory page through cartridge addresses space */ +WRITE8_MEMBER( thomson_state::to8_vcart_w ) +{ + UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() ); + assert( offset < 0x4000 ); + if ( *dst == data ) + return; + *dst = data; + /* dirty whole scanline */ + if ( m_to8_cart_vpage >= 4 ) + return; + m_thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = 1; +} + +WRITE8_MEMBER( thomson_state::mo6_vcart_lo_w ) +{ + UINT8* dst = m_thom_vram + ( ( offset + 0x3000 + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() ); + assert( offset < 0x1000 ); + if ( *dst == data ) + return; + *dst = data; + /* dirty whole scanline */ + if ( m_to8_cart_vpage >= 4 ) + return; + m_thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = 1; +} + +WRITE8_MEMBER( thomson_state::mo6_vcart_hi_w ) +{ + UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() ); + assert( offset < 0x3000 ); + if ( *dst == data ) + return; + *dst = data; + /* dirty whole scanline */ + if ( m_to8_cart_vpage >= 4 ) + return; + m_thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = 1; +} diff --git a/src/mame/video/ti85.c b/src/mame/video/ti85.c new file mode 100644 index 00000000000..92ade7ae6fc --- /dev/null +++ b/src/mame/video/ti85.c @@ -0,0 +1,194 @@ +// license:BSD-3-Clause +// copyright-holders:Krzysztof Strzecha,Jon Sturm +/*************************************************************************** + TI-85 driver by Krzysztof Strzecha + + Functions to emulate the video hardware of the TI-85 + +***************************************************************************/ + +#include "emu.h" +#include "includes/ti85.h" + +#define TI81_VIDEO_MEMORY_SIZE 768 +#define TI81_SCREEN_X_SIZE 12 +#define TI81_SCREEN_Y_SIZE 64 +#define TI81_NUMBER_OF_FRAMES 6 + +#define TI85_VIDEO_MEMORY_SIZE 1024 +#define TI85_SCREEN_X_SIZE 16 +#define TI85_SCREEN_Y_SIZE 64 +#define TI85_NUMBER_OF_FRAMES 6 + +#define TI86_VIDEO_MEMORY_SIZE 1024 +#define TI86_SCREEN_X_SIZE 16 +#define TI86_SCREEN_Y_SIZE 64 +#define TI86_NUMBER_OF_FRAMES 6 + + + +static const unsigned char ti85_colors[32*7][3] = +{ + { 0xae, 0xcd, 0xb0 }, { 0xaa, 0xc9, 0xae }, { 0xa6, 0xc5, 0xad }, { 0xa3, 0xc1, 0xab }, { 0x9f, 0xbd, 0xaa }, { 0x9b, 0xb9, 0xa8 }, { 0x98, 0xb5, 0xa7 }, //0x00 + { 0xae, 0xcd, 0xb0 }, { 0xa9, 0xc8, 0xae }, { 0xa4, 0xc3, 0xac }, { 0xa0, 0xbe, 0xaa }, { 0x9b, 0xb9, 0xa8 }, { 0x96, 0xb4, 0xa6 }, { 0x92, 0xaf, 0xa4 }, //0x01 + { 0xae, 0xcd, 0xb0 }, { 0xa8, 0xc7, 0xad }, { 0xa2, 0xc1, 0xab }, { 0x9d, 0xbb, 0xa9 }, { 0x97, 0xb5, 0xa6 }, { 0x91, 0xaf, 0xa4 }, { 0x8c, 0xa9, 0xa2 }, //0x02 + { 0xae, 0xcd, 0xb0 }, { 0xa7, 0xc6, 0xad }, { 0xa0, 0xbf, 0xaa }, { 0x9a, 0xb8, 0xa7 }, { 0x93, 0xb1, 0xa4 }, { 0x8c, 0xaa, 0xa1 }, { 0x86, 0xa3, 0x9f }, //0x03 + { 0xae, 0xcd, 0xb0 }, { 0xa6, 0xc5, 0xac }, { 0x9f, 0xbd, 0xa9 }, { 0x97, 0xb5, 0xa6 }, { 0x90, 0xad, 0xa3 }, { 0x88, 0xa5, 0xa0 }, { 0x81, 0x9d, 0x9d }, //0x04 + { 0xae, 0xcd, 0xb0 }, { 0xa5, 0xc4, 0xac }, { 0x9d, 0xbb, 0xa8 }, { 0x94, 0xb2, 0xa5 }, { 0x8c, 0xa9, 0xa1 }, { 0x83, 0xa0, 0x9d }, { 0x7b, 0x97, 0x9a }, //0x05 + { 0xae, 0xcd, 0xb0 }, { 0xa4, 0xc3, 0xac }, { 0x9b, 0xb9, 0xa8 }, { 0x91, 0xaf, 0xa4 }, { 0x88, 0xa5, 0xa0 }, { 0x7e, 0x9b, 0x9c }, { 0x75, 0x92, 0x98 }, //0x06 + { 0xae, 0xcd, 0xb0 }, { 0xa3, 0xc2, 0xab }, { 0x99, 0xb7, 0xa7 }, { 0x8e, 0xac, 0xa3 }, { 0x84, 0xa1, 0x9e }, { 0x79, 0x96, 0x9a }, { 0x6f, 0x8c, 0x96 }, //0x07 + { 0xae, 0xcd, 0xb0 }, { 0xa2, 0xc1, 0xab }, { 0x97, 0xb5, 0xa6 }, { 0x8c, 0xa9, 0xa1 }, { 0x80, 0x9d, 0x9c }, { 0x75, 0x91, 0x97 }, { 0x6a, 0x86, 0x93 }, //0x08 + { 0xae, 0xcd, 0xb0 }, { 0xa1, 0xc0, 0xaa }, { 0x95, 0xb3, 0xa5 }, { 0x89, 0xa6, 0xa0 }, { 0x7c, 0x99, 0x9b }, { 0x70, 0x8c, 0x96 }, { 0x64, 0x80, 0x91 }, //0x09 + { 0xae, 0xcd, 0xb0 }, { 0xa0, 0xbf, 0xaa }, { 0x93, 0xb1, 0xa4 }, { 0x86, 0xa3, 0x9f }, { 0x78, 0x95, 0x99 }, { 0x6b, 0x87, 0x93 }, { 0x5e, 0x7a, 0x8e }, //0x0a + { 0xae, 0xcd, 0xb0 }, { 0x9f, 0xbe, 0xaa }, { 0x91, 0xaf, 0xa4 }, { 0x83, 0xa0, 0x9e }, { 0x74, 0x91, 0x98 }, { 0x66, 0x82, 0x92 }, { 0x58, 0x74, 0x8c }, //0x0b + { 0xae, 0xcd, 0xb0 }, { 0x9e, 0xbd, 0xa9 }, { 0x8f, 0xad, 0xa3 }, { 0x80, 0x9e, 0x9d }, { 0x71, 0x8e, 0x96 }, { 0x62, 0x7e, 0x90 }, { 0x53, 0x6f, 0x8a }, //0x0c + { 0xa9, 0xc8, 0xae }, { 0x9a, 0xb9, 0xa8 }, { 0x8c, 0xaa, 0xa2 }, { 0x7e, 0x9b, 0x9c }, { 0x6f, 0x8c, 0x96 }, { 0x61, 0x7d, 0x90 }, { 0x53, 0x6f, 0x8a }, //0x0d + { 0xa4, 0xc3, 0xac }, { 0x96, 0xb5, 0xa6 }, { 0x89, 0xa7, 0xa0 }, { 0x7b, 0x99, 0x9b }, { 0x6e, 0x8b, 0x95 }, { 0x60, 0x7d, 0x8f }, { 0x53, 0x6f, 0x8a }, //0x0e + { 0xa0, 0xbe, 0xaa }, { 0x93, 0xb0, 0xa4 }, { 0x86, 0xa3, 0x9f }, { 0x79, 0x96, 0x9a }, { 0x6c, 0x89, 0x94 }, { 0x5f, 0x7c, 0x8f }, { 0x53, 0x6f, 0x8a }, //0x0f + { 0x9b, 0xba, 0xa8 }, { 0x8f, 0xad, 0xa3 }, { 0x83, 0xa1, 0x9e }, { 0x77, 0x94, 0x99 }, { 0x6b, 0x88, 0x94 }, { 0x5f, 0x7b, 0x8f }, { 0x53, 0x6f, 0x8a }, //0x10 + { 0x97, 0xb5, 0xa6 }, { 0x8b, 0xa9, 0xa1 }, { 0x80, 0x9d, 0x9c }, { 0x75, 0x92, 0x98 }, { 0x69, 0x86, 0x93 }, { 0x5e, 0x7a, 0x8e }, { 0x53, 0x6f, 0x8a }, //0x11 + { 0x92, 0xb0, 0xa4 }, { 0x87, 0xa5, 0x9f }, { 0x7d, 0x9a, 0x9b }, { 0x72, 0x8f, 0x97 }, { 0x68, 0x84, 0x92 }, { 0x5d, 0x79, 0x8e }, { 0x53, 0x6f, 0x8a }, //0x12 + { 0x8e, 0xac, 0xa2 }, { 0x84, 0xa1, 0x9e }, { 0x7a, 0x97, 0x9a }, { 0x70, 0x8d, 0x96 }, { 0x66, 0x83, 0x92 }, { 0x5c, 0x79, 0x8e }, { 0x53, 0x6f, 0x8a }, //0x13 + { 0x89, 0xa7, 0xa0 }, { 0x80, 0x9d, 0x9c }, { 0x77, 0x94, 0x98 }, { 0x6e, 0x8b, 0x95 }, { 0x65, 0x81, 0x91 }, { 0x5c, 0x78, 0x8d }, { 0x53, 0x6f, 0x8a }, //0x14 + { 0x85, 0xa2, 0x9e }, { 0x7c, 0x99, 0x9a }, { 0x74, 0x91, 0x97 }, { 0x6c, 0x88, 0x94 }, { 0x63, 0x80, 0x90 }, { 0x5b, 0x77, 0x8d }, { 0x53, 0x6f, 0x8a }, //0x15 + { 0x80, 0x9e, 0x9d }, { 0x78, 0x96, 0x99 }, { 0x71, 0x8e, 0x96 }, { 0x69, 0x86, 0x93 }, { 0x62, 0x7e, 0x90 }, { 0x5a, 0x76, 0x8d }, { 0x53, 0x6f, 0x8a }, //0x16 + { 0x7c, 0x99, 0x9b }, { 0x75, 0x92, 0x98 }, { 0x6e, 0x8b, 0x95 }, { 0x67, 0x84, 0x92 }, { 0x60, 0x7d, 0x8f }, { 0x59, 0x76, 0x8c }, { 0x53, 0x6f, 0x8a }, //0x17 + { 0x77, 0x94, 0x99 }, { 0x71, 0x8d, 0x96 }, { 0x6b, 0x87, 0x94 }, { 0x65, 0x81, 0x91 }, { 0x5f, 0x7b, 0x8f }, { 0x59, 0x75, 0x8c }, { 0x53, 0x6f, 0x8a }, //0x18 + { 0x73, 0x90, 0x97 }, { 0x6d, 0x8a, 0x94 }, { 0x68, 0x85, 0x92 }, { 0x63, 0x7f, 0x90 }, { 0x5d, 0x7a, 0x8e }, { 0x58, 0x74, 0x8c }, { 0x53, 0x6f, 0x8a }, //0x19 + { 0x6e, 0x8b, 0x95 }, { 0x69, 0x86, 0x93 }, { 0x65, 0x81, 0x91 }, { 0x60, 0x7d, 0x8f }, { 0x5c, 0x78, 0x8d }, { 0x57, 0x73, 0x8b }, { 0x53, 0x6f, 0x8a }, //0x1a + { 0x6a, 0x86, 0x93 }, { 0x66, 0x82, 0x91 }, { 0x62, 0x7e, 0x90 }, { 0x5e, 0x7a, 0x8e }, { 0x5a, 0x76, 0x8d }, { 0x56, 0x72, 0x8b }, { 0x53, 0x6f, 0x8a }, //0x1b + { 0x65, 0x82, 0x91 }, { 0x62, 0x7e, 0x8f }, { 0x5f, 0x7b, 0x8e }, { 0x5c, 0x78, 0x8d }, { 0x59, 0x75, 0x8c }, { 0x56, 0x72, 0x8b }, { 0x53, 0x6f, 0x8a }, //0x1c + { 0x61, 0x7d, 0x8f }, { 0x5e, 0x7a, 0x8e }, { 0x5c, 0x78, 0x8d }, { 0x5a, 0x76, 0x8c }, { 0x57, 0x73, 0x8b }, { 0x55, 0x71, 0x8a }, { 0x53, 0x6f, 0x8a }, //0x1d + { 0x5c, 0x78, 0x8d }, { 0x5a, 0x76, 0x8c }, { 0x59, 0x75, 0x8c }, { 0x57, 0x73, 0x8b }, { 0x56, 0x72, 0x8b }, { 0x54, 0x70, 0x8a }, { 0x53, 0x6f, 0x8a }, //0x1e + { 0x57, 0x74, 0x8c }, { 0x56, 0x73, 0x8b }, { 0x55, 0x72, 0x8b }, { 0x55, 0x71, 0x8b }, { 0x54, 0x70, 0x8a }, { 0x53, 0x6f, 0x8a }, { 0x53, 0x6f, 0x8a } //0x1f +}; + +static const unsigned short ti85_palette[32][7] = +{ + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 }, + { 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d }, + { 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14 }, + { 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b }, + { 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22 }, + { 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29 }, + { 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30 }, + { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 }, + { 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e }, + { 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45 }, + { 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c }, + { 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53 }, + { 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a }, + { 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61 }, + { 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68 }, + { 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f }, + { 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76 }, + { 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d }, + { 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84 }, + { 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b }, + { 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92 }, + { 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 }, + { 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 }, + { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7 }, + { 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae }, + { 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5 }, + { 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc }, + { 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3 }, + { 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca }, + { 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1 }, + { 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 }, + { 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf } +}; + +PALETTE_INIT_MEMBER(ti85_state, ti85) +{ + UINT8 i, j, r, g, b; + + for ( i = 0; i < 224; i++ ) + { + r = ti85_colors[i][0]; g = ti85_colors[i][1]; b = ti85_colors[i][2]; + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + for (i=0; i < 32; i++) + for (j=0; j < 7; j++) + palette.set_pen_indirect(i*7+j, ti85_palette[i][j]); + + if (!strncmp(machine().system().name, "ti81", 4)) + { + m_ti_video_memory_size = TI81_VIDEO_MEMORY_SIZE; + m_ti_screen_x_size = TI81_SCREEN_X_SIZE; + m_ti_screen_y_size = TI81_SCREEN_Y_SIZE; + m_ti_number_of_frames = TI81_NUMBER_OF_FRAMES; + } + else if (!strncmp(machine().system().name, "ti85", 4)) + { + m_ti_video_memory_size = TI85_VIDEO_MEMORY_SIZE; + m_ti_screen_x_size = TI85_SCREEN_X_SIZE; + m_ti_screen_y_size = TI85_SCREEN_Y_SIZE; + m_ti_number_of_frames = TI85_NUMBER_OF_FRAMES; + } + else if (!strncmp(machine().system().name, "ti86", 4)) + { + m_ti_video_memory_size = TI86_VIDEO_MEMORY_SIZE; + m_ti_screen_x_size = TI86_SCREEN_X_SIZE; + m_ti_screen_y_size = TI86_SCREEN_Y_SIZE; + m_ti_number_of_frames = TI86_NUMBER_OF_FRAMES; + } + else + { + /* don't allocate memory for the others drivers */ + return; + } + + m_frames = auto_alloc_array_clear(machine(), UINT8, m_ti_number_of_frames*m_ti_video_memory_size); +} + +void ti85_state::video_start() +{ +} + +UINT32 ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + address_space &space = m_maincpu->space(AS_PROGRAM); + int x,y,b; + int brightnes; + int lcdmem; + + if (!m_LCD_status || !m_timer_interrupt_mask) + { + for (y=0; y>(7-b)) & 0x01) + + ((*(m_frames+1*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames+2*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames+3*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames+4*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames+5*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01); + + bitmap.pix16(y, x*8+b) = ti85_palette[m_LCD_contrast&0x1f][brightnes]; + } + return 0; +} + +PALETTE_INIT_MEMBER(ti85_state,ti82) +{ + palette.set_pen_color(0, rgb_t(160, 190, 170)); + palette.set_pen_color(1, rgb_t(83, 111, 138)); +} diff --git a/src/mame/video/timex.c b/src/mame/video/timex.c new file mode 100644 index 00000000000..6b7bd460366 --- /dev/null +++ b/src/mame/video/timex.c @@ -0,0 +1,270 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker +/*************************************************************************** + + timex.c + + Functions to emulate the video hardware of the Timex ZX Spectrum clones. + + Changes: + + DJR 08/02/00 - Added support for FLASH 1. + DJR 16/05/00 - Support for TS2068/TC2048 hires and 64 column modes. + DJR 19/05/00 - Speeded up Spectrum 128 screen refresh. + DJR 23/05/00 - Preliminary support for border colour emulation. + +***************************************************************************/ + +#include "emu.h" +#include "includes/spectrum.h" +#include "machine/ram.h" + +inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix16(y, x) = (UINT16)color; +} + +/* Update FLASH status for ts2068. Assumes flash update every 1/2s. */ +VIDEO_START_MEMBER(spectrum_state,ts2068) +{ + VIDEO_START_CALL_MEMBER( spectrum ); + m_frame_invert_count = 30; +} + +void spectrum_state::screen_eof_timex(screen_device &screen, bool state) +{ + // rising edge + if (state) + { + spectrum_UpdateBorderBitmap(); + + m_frame_number++; + + if (m_frame_number >= m_frame_invert_count) + { + m_frame_number = 0; + m_flash_invert = !m_flash_invert; + } + } +} + + +/******************************************************************* + * + * Update the TS2068 display. + * + * Port ff is used to set the display mode. + * + * bits 2..0 Video Mode Select + * 000 = Primary DFILE active (at 0x4000-0x5aff) + * 001 = Secondary DFILE active (at 0x6000-0x7aff) + * 010 = Extended Colour Mode (chars at 0x4000-0x57ff, colors 0x6000-0x7aff) + * 110 = 64 column mode (columns 0,2,4,...62 from DFILE 1 + * columns 1,3,5,...63 from DFILE 2) + * other = unpredictable results + * + * bits 5..3 64 column mode ink/paper selection (attribute value in brackets) + * 000 = Black/White (56) 100 = Green/Magenta (28) + * 001 = Blue/Yellow (49) 101 = Cyan/Red (21) + * 010 = Red/Cyan (42) 110 = Yellow/Blue (14) + * 011 = Magenta/Green (35) 111 = White/Black (7) + * + *******************************************************************/ + +/* Draw a scanline in TS2068/TC2048 hires mode (code modified from COUPE.C) */ +void spectrum_state::ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines) +{ + int x,b,scrx,scry; + unsigned short ink,pap; + unsigned char *attr, *scr; + + scrx=TS2068_LEFT_BORDER; + scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); + + scr=m_ram->pointer() + y*32; + attr=scr + 0x2000; + + for (x=0;x<32;x++) + { + /* Get ink and paper colour with bright */ + if (m_flash_invert && (*attr & 0x80)) + { + ink=((*attr)>>3) & 0x0f; + pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + } + else + { + ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + pap=((*attr)>>3) & 0x0f; + } + + for (b=0x80;b!=0;b>>=1) + { + if (*scr&b) + { + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,ink); + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,ink); + } + else + { + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,pap); + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,pap); + } + } + scr++; + attr++; + } +} + +/* Draw a scanline in TS2068/TC2048 64-column mode */ +void spectrum_state::ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor) +{ + int x,b,scrx,scry; + unsigned char *scr1, *scr2; + + scrx=TS2068_LEFT_BORDER; + scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); + + scr1=m_ram->pointer() + y*32; + scr2=scr1 + 0x2000; + + for (x=0;x<32;x++) + { + for (b=0x80;b!=0;b>>=1) + { + if (*scr1&b) + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,inkcolor); + else + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,7-inkcolor); + } + scr1++; + + for (b=0x80;b!=0;b>>=1) + { + if (*scr2&b) + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,inkcolor); + else + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,7-inkcolor); + } + scr2++; + } +} + +/* Draw a scanline in TS2068/TC2048 lores (normal Spectrum) mode */ +void spectrum_state::ts2068_lores_scanline(bitmap_ind16 &bitmap, int y, int borderlines, int screen) +{ + int x,b,scrx,scry; + unsigned short ink,pap; + unsigned char *attr, *scr; + + scrx=TS2068_LEFT_BORDER; + scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); + + scr = m_ram->pointer() + y*32 + screen*0x2000; + attr = m_ram->pointer() + ((scry>>3)*32) + screen*0x2000 + 0x1800; + + for (x=0;x<32;x++) + { + /* Get ink and paper colour with bright */ + if (m_flash_invert && (*attr & 0x80)) + { + ink=((*attr)>>3) & 0x0f; + pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + } + else + { + ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + pap=((*attr)>>3) & 0x0f; + } + + for (b=0x80;b!=0;b>>=1) + { + if (*scr&b) + { + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,ink); + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,ink); + } + else + { + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,pap); + spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,pap); + } + } + scr++; + attr++; + } +} + +UINT32 spectrum_state::screen_update_ts2068(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + /* for now TS2068 will do a full-refresh */ + int count; + + if (m_border_bitmap.valid()) + copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect); + + if ((m_port_ff_data & 7) == 6) + { + /* 64 Column mode */ + unsigned short inkcolor = (m_port_ff_data & 0x38) >> 3; + for (count = 0; count < 192; count++) + ts2068_64col_scanline(bitmap, count, TS2068_TOP_BORDER, inkcolor); + } + else if ((m_port_ff_data & 7) == 2) + { + /* Extended Color mode */ + for (count = 0; count < 192; count++) + ts2068_hires_scanline(bitmap, count, TS2068_TOP_BORDER); + } + else if ((m_port_ff_data & 7) == 1) + { + /* Screen 6000-7aff */ + for (count = 0; count < 192; count++) + ts2068_lores_scanline(bitmap, count, TS2068_TOP_BORDER, 1); + } + else + { + /* Screen 4000-5aff */ + for (count = 0; count < 192; count++) + ts2068_lores_scanline(bitmap, count, TS2068_TOP_BORDER, 0); + } + + return 0; +} + +UINT32 spectrum_state::screen_update_tc2048(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + /* for now TS2068 will do a full-refresh */ + int count; + + if (m_border_bitmap.valid()) + copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect); + + if ((m_port_ff_data & 7) == 6) + { + /* 64 Column mode */ + unsigned short inkcolor = (m_port_ff_data & 0x38) >> 3; + for (count = 0; count < 192; count++) + ts2068_64col_scanline(bitmap, count, SPEC_TOP_BORDER, inkcolor); + } + else if ((m_port_ff_data & 7) == 2) + { + /* Extended Color mode */ + for (count = 0; count < 192; count++) + ts2068_hires_scanline(bitmap, count, SPEC_TOP_BORDER); + } + else if ((m_port_ff_data & 7) == 1) + { + /* Screen 6000-7aff */ + for (count = 0; count < 192; count++) + ts2068_lores_scanline(bitmap, count, SPEC_TOP_BORDER, 1); + } + else + { + /* Screen 4000-5aff */ + for (count = 0; count < 192; count++) + ts2068_lores_scanline(bitmap, count, SPEC_TOP_BORDER, 0); + } + + return 0; +} diff --git a/src/mame/video/tmc1800.c b/src/mame/video/tmc1800.c new file mode 100644 index 00000000000..57aef139bef --- /dev/null +++ b/src/mame/video/tmc1800.c @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "emu.h" +#include "includes/tmc1800.h" +#include "cpu/cosmac/cosmac.h" +#include "video/cdp1861.h" +#include "sound/cdp1864.h" +#include "machine/rescap.h" + +/* Telmac 2000 */ + +READ_LINE_MEMBER( tmc2000_state::rdata_r ) +{ + return BIT(m_color, 2); +} + +READ_LINE_MEMBER( tmc2000_state::bdata_r ) +{ + return BIT(m_color, 1); +} + +READ_LINE_MEMBER( tmc2000_state::gdata_r ) +{ + return BIT(m_color, 0); +} + +/* OSM-200 */ + +UINT32 osc1000b_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +/* Machine Drivers */ + +MACHINE_CONFIG_FRAGMENT( tmc1800_video ) + MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, XTAL_1_75MHz) + MCFG_CDP1861_IRQ_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) + MCFG_CDP1861_DMA_OUT_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT)) + MCFG_CDP1861_EFX_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) + MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_1_75MHz) +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( osc1000b_video ) + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DRIVER(osc1000b_state, screen_update) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(320, 200) + MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 199) +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( tmc2000_video ) + MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) + MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(tmc2000_state, rdata_r), READLINE(tmc2000_state, bdata_r), READLINE(tmc2000_state, gdata_r)) + MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_K(2.05), RES_K(2.26), RES_K(3.92)) // RL64, RL63, RL61, RL65 (also RH62 (2K pot) in series, but ignored here) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( nano_video ) + MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) + MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, VCC, VCC, VCC) + MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_INF, RES_INF, 0) // R18 (unconfirmed) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END diff --git a/src/mame/video/tmc600.c b/src/mame/video/tmc600.c new file mode 100644 index 00000000000..f36568af698 --- /dev/null +++ b/src/mame/video/tmc600.c @@ -0,0 +1,141 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "emu.h" +#include "sound/cdp1869.h" +#include "includes/tmc600.h" + +WRITE8_MEMBER( tmc600_state::vismac_register_w ) +{ + m_vismac_reg_latch = data; +} + +WRITE8_MEMBER( tmc600_state::vismac_data_w ) +{ + UINT16 ma = m_maincpu->get_memory_address(); + + switch (m_vismac_reg_latch) + { + case 0x20: + // character color latch + m_vismac_color_latch = data; + break; + + case 0x30: + // background color latch + m_vismac_bkg_latch = data & 0x07; + + m_vis->out3_w(space, ma, data); + break; + + case 0x40: + m_vis->out4_w(space, ma, data); + break; + + case 0x50: + m_vis->out5_w(space, ma, data); + break; + + case 0x60: + m_vis->out6_w(space, ma, data); + break; + + case 0x70: + m_vis->out7_w(space, ma, data); + break; + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(tmc600_state::blink_tick) +{ + m_blink = !m_blink; +} + +UINT8 tmc600_state::get_color(UINT16 pma) +{ + UINT16 pageaddr = pma & TMC600_PAGE_RAM_MASK; + UINT8 color = m_color_ram[pageaddr]; + + if (BIT(color, 3) && m_blink) + { + color = m_vismac_bkg_latch; + } + + return color; +} + +WRITE8_MEMBER( tmc600_state::page_ram_w ) +{ + m_page_ram[offset] = data; + m_color_ram[offset] = m_vismac_color_latch; +} + +static ADDRESS_MAP_START( cdp1869_page_ram, AS_0, 8, tmc600_state ) + AM_RANGE(0x000, 0x3ff) AM_MIRROR(0x400) AM_RAM AM_SHARE("page_ram") AM_WRITE(page_ram_w) +ADDRESS_MAP_END + +CDP1869_CHAR_RAM_READ_MEMBER( tmc600_state::tmc600_char_ram_r ) +{ + UINT16 pageaddr = pma & TMC600_PAGE_RAM_MASK; + UINT8 color = get_color(pageaddr); + UINT16 charaddr = ((cma & 0x08) << 8) | (pmd << 3) | (cma & 0x07); + UINT8 cdb = m_char_rom[charaddr] & 0x3f; + + int ccb0 = BIT(color, 2); + int ccb1 = BIT(color, 1); + + return (ccb1 << 7) | (ccb0 << 6) | cdb; +} + +CDP1869_PCB_READ_MEMBER( tmc600_state::tmc600_pcb_r ) +{ + UINT16 pageaddr = pma & TMC600_PAGE_RAM_MASK; + UINT8 color = get_color(pageaddr); + + return BIT(color, 0); +} + +void tmc600_state::video_start() +{ + // allocate memory + m_color_ram.allocate(TMC600_PAGE_RAM_SIZE); + + // register for state saving + save_item(NAME(m_vismac_reg_latch)); + save_item(NAME(m_vismac_color_latch)); + save_item(NAME(m_vismac_bkg_latch)); + save_item(NAME(m_blink)); +} + +static const gfx_layout tmc600_charlayout = +{ + 6, 9, // 6 x 9 characters + 256, // 256 characters + 1, // 1 bits per pixel + { 0 }, // no bitplanes + // x offsets + { 2, 3, 4, 5, 6, 7 }, + // y offsets + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 2048*8 }, + 8*8 // every char takes 8 x 8 bytes +}; + +static GFXDECODE_START( tmc600 ) + GFXDECODE_ENTRY( "chargen", 0x0000, tmc600_charlayout, 0, 36 ) +GFXDECODE_END + +MACHINE_CONFIG_FRAGMENT( tmc600_video ) + // video hardware + MCFG_CDP1869_SCREEN_PAL_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL) + MCFG_TIMER_DRIVER_ADD_PERIODIC("blink", tmc600_state, blink_tick, attotime::from_hz(2)) + + MCFG_GFXDECODE_ADD("gfxdecode", CDP1869_TAG":palette", tmc600) + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_CDP1869_ADD(CDP1869_TAG, CDP1869_DOT_CLK_PAL, cdp1869_page_ram) + MCFG_CDP1869_COLOR_CLOCK(CDP1869_COLOR_CLK_PAL) + MCFG_CDP1869_CHAR_PCB_READ_OWNER(tmc600_state, tmc600_pcb_r) + MCFG_CDP1869_CHAR_RAM_READ_OWNER(tmc600_state, tmc600_char_ram_r) + MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END diff --git a/src/mame/video/trs80.c b/src/mame/video/trs80.c new file mode 100644 index 00000000000..beb34edc691 --- /dev/null +++ b/src/mame/video/trs80.c @@ -0,0 +1,588 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert and unknown others +/*************************************************************************** + + trs80.c + + Functions to emulate the video hardware of the TRS80. + +***************************************************************************/ + +#include "includes/trs80.h" + +/* Bit assignment for "state->m_mode" + d7 Page select + d6 LNW80 switch to graphics ram + d5 LNW80 colour or monochrome (1=colour) + d4 LNW80 lores or hires (1=hires) also does 64 or 80 chars per line + d3 LNW80 invert entire screen / Model III/4 Invert characters with bit 7 set (1=invert) + d2 80/40 or 64/32 characters per line (1=80) + d1 7 or 8 bit video (1=requires 7-bit, 0=don't care) + d0 80/64 or 40/32 characters per line (1=32) */ + + +WRITE8_MEMBER( trs80_state::trs80m4_88_w ) +{ +/* This is for the programming of the CRTC registers. + However this CRTC is mask-programmed, and only the + start address register can be used. The cursor and + light-pen facilities are ignored. The character clock + is changed depending on the screen size chosen. + Therefore it is easier to use normal + coding rather than the mc6845 device. */ + + if (!offset) m_crtc_reg = data & 0x1f; + + if (offset) switch (m_crtc_reg) + { + case 12: + m_start_address = (m_start_address & 0x00ff) | (data << 8); + break; + case 13: + m_start_address = (m_start_address & 0xff00) | data; + } +} + + +void trs80_state::video_start() +{ + m_p_chargen = memregion("chargen")->base(); + m_size_store = 0xff; + m_mode &= 2; +} + + +/* 7 or 8-bit video, 32/64 characters per line = trs80, trs80l2, sys80 */ +UINT32 trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,gfxbit; + UINT16 sy=0,ma=0,x; + UINT8 cols = BIT(m_mode, 0) ? 32 : 64; + UINT8 skip = BIT(m_mode, 0) ? 2 : 1; + + if (m_mode != m_size_store) + { + m_size_store = m_mode & 1; + screen.set_visible_area(0, cols*6-1, 0, 16*12-1); + } + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 12; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x+=skip) + { + chr = m_p_videoram[x]; + + if (chr & 0x80) + { + gfxbit = (ra & 0x0c)>>1; + /* Display one line of a lores character (6 pixels) */ + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + gfxbit++; + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + } + else + { + if (BIT(m_mode, 1) & (chr < 32)) chr+=64; + + // if g,j,p,q,y; lower the descender + if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79)) + { + if ((ra < 10) && (ra > 1)) + gfx = m_p_chargen[(chr<<3) | (ra-2) ]; + else + gfx = 0; + } + else + { + if (ra < 8) + gfx = m_p_chargen[(chr<<3) | ra ]; + else + gfx = 0; + } + + /* Display a scanline of a character (6 pixels) */ + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + } + ma+=64; + } + return 0; +} + +/* 8-bit video, 32/64/40/80 characters per line = trs80m3, trs80m4. */ +UINT32 trs80_state::screen_update_trs80m4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,gfxbit; + UINT16 sy=0,ma=0,x; + UINT8 skip=1; + UINT8 cols = BIT(m_mode, 2) ? 80 : 64; + UINT8 rows = BIT(m_mode, 2) ? 24 : 16; + UINT8 lines = BIT(m_mode, 2) ? 10 : 12; + UINT8 s_cols = cols; + UINT8 mask = BIT(m_mode, 5) ? 0xff : 0xbf; /* Select Japanese or extended chars */ + + if (m_mode & 1) + { + s_cols >>= 1; + skip = 2; + } + + if ((m_mode & 0x7f) != m_size_store) + { + m_size_store = m_mode & 5; + screen.set_visible_area(0, s_cols*8-1, 0, rows*lines-1); + } + + for (y = 0; y < rows; y++) + { + for (ra = 0; ra < lines; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + cols; x+=skip) + { + chr = m_p_videoram[x+m_start_address]; + + if (((chr & 0xc0) == 0xc0) && (~m_mode & 8)) + { + if (ra < 8) + gfx = m_p_chargen[((chr&mask)<<3) | ra ]; + else + gfx = 0; + + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + else + if ((chr & 0x80) && (~m_mode & 8)) + { + gfxbit = (ra & 0x0c)>>1; + /* Display one line of a lores character */ + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + gfxbit++; + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + } + else + { + /* get pattern of pixels for that character scanline */ + if (ra < 8) + gfx = m_p_chargen[((chr&0x7f)<<3) | ra ]; + else + gfx = 0; + + /* if inverse mode, and bit 7 set, invert gfx */ + if (BIT(m_mode, 3) & BIT(chr, 7)) + gfx ^= 0xff; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + } + ma+=cols; + } + return 0; +} + +/* 7 or 8-bit video, 64/32 characters per line = ht1080z, ht1080z2, ht108064 */ +UINT32 trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx,gfxbit; + UINT16 sy=0,ma=0,x; + UINT8 cols = BIT(m_mode, 0) ? 32 : 64; + UINT8 skip = BIT(m_mode, 0) ? 2 : 1; + + if (m_mode != m_size_store) + { + m_size_store = m_mode & 1; + screen.set_visible_area(0, cols*6-1, 0, 16*12-1); + } + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 12; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x+=skip) + { + chr = m_p_videoram[x]; + + if (chr & 0x80) + { + gfxbit = (ra & 0x0c)>>1; + /* Display one line of a lores character (6 pixels) */ + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + gfxbit++; + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + *p++ = BIT(chr, gfxbit); + } + else + { + if ((m_mode & 2) && (chr < 32)) chr+=64; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | ra ]; + + /* Display a scanline of a character (6 pixels) */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = 0; /* fix for ht108064 */ + } + } + } + ma+=64; + } + return 0; +} + +/* 8-bit video, 64/80 characters per line = lnw80 */ +UINT32 trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + static const UINT16 rows[] = { 0, 0x200, 0x100, 0x300, 1, 0x201, 0x101, 0x301 }; + UINT8 chr,gfx,gfxbit,bg=7,fg=0; + UINT16 sy=0,ma=0,x,y,ra; + UINT8 cols = BIT(m_mode, 4) ? 80 : 64; + + /* Although the OS can select 32-character mode, it is not supported by hardware */ + if (m_mode != m_size_store) + { + m_size_store = m_mode & 0x10; + screen.set_visible_area(0, cols*6-1, 0, 16*12-1); + } + + if (m_mode & 8) + { + bg = 0; + fg = 7; + } + + switch (m_mode & 0x30) + { + case 0: // MODE 0 + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 12; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x++) + { + chr = m_p_videoram[x]; + + if (chr & 0x80) + { + gfxbit = (ra & 0x0c)>>1; + /* Display one line of a lores character (6 pixels) */ + *p++ = BIT(chr, gfxbit) ? fg : bg; + *p++ = BIT(chr, gfxbit) ? fg : bg; + *p++ = BIT(chr, gfxbit) ? fg : bg; + gfxbit++; + *p++ = BIT(chr, gfxbit) ? fg : bg; + *p++ = BIT(chr, gfxbit) ? fg : bg; + *p++ = BIT(chr, gfxbit) ? fg : bg; + } + else + { + /* get pattern of pixels for that character scanline */ + if (ra < 8) + gfx = m_p_chargen[(chr<<1) | rows[ra] ]; + else + gfx = 0; + + /* Display a scanline of a character (6 pixels) */ + *p++ = BIT(gfx, 2) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 6) ? fg : bg; + *p++ = BIT(gfx, 7) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + *p++ = BIT(gfx, 3) ? fg : bg; + } + } + } + ma+=64; + } + break; + + case 0x10: // MODE 1 + for (y = 0; y < 0x400; y+=0x40) + { + for (ra = 0; ra < 0x3000; ra+=0x400) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 0x40; x++) + { + gfx = m_p_gfxram[ y | x | ra]; + /* Display 6 pixels in normal region */ + *p++ = BIT(gfx, 0) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + } + + for (x = 0; x < 0x10; x++) + { + gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; + /* Display 6 pixels in extended region */ + *p++ = BIT(gfx, 0) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + } + } + } + break; + + case 0x20: // MODE 2 + /* it seems the text video ram can have an effect in this mode, + not explained clearly, so not emulated */ + for (y = 0; y < 0x400; y+=0x40) + { + for (ra = 0; ra < 0x3000; ra+=0x400) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 0x40; x++) + { + gfx = m_p_gfxram[ y | x | ra]; + /* Display 6 pixels in normal region */ + fg = (gfx & 0x38) >> 3; + *p++ = fg; + *p++ = fg; + *p++ = fg; + fg = gfx & 0x07; + *p++ = fg; + *p++ = fg; + *p++ = fg; + } + } + } + break; + + case 0x30: // MODE 3 + /* the manual does not explain at all how colour is determined + for the extended area. Further, the background colour + is not mentioned anywhere. Black is assumed. */ + for (y = 0; y < 0x400; y+=0x40) + { + for (ra = 0; ra < 0x3000; ra+=0x400) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = 0; x < 0x40; x++) + { + gfx = m_p_gfxram[ y | x | ra]; + fg = (m_p_videoram[ 0x3c00 | x | y ] & 0x38) >> 3; + /* Display 6 pixels in normal region */ + *p++ = BIT(gfx, 0) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + fg = m_p_videoram[ 0x3c00 | x | y ] & 0x07; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + } + + for (x = 0; x < 0x10; x++) + { + gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; + fg = (m_p_gfxram[ 0x3c00 | x | y ] & 0x38) >> 3; + /* Display 6 pixels in extended region */ + *p++ = BIT(gfx, 0) ? fg : bg; + *p++ = BIT(gfx, 1) ? fg : bg; + *p++ = BIT(gfx, 2) ? fg : bg; + fg = m_p_gfxram[ 0x3c00 | x | y ] & 0x07; + *p++ = BIT(gfx, 3) ? fg : bg; + *p++ = BIT(gfx, 4) ? fg : bg; + *p++ = BIT(gfx, 5) ? fg : bg; + } + } + } + break; + } + return 0; +} + +/* lores characters are in the character generator. Each character is 8x16. */ +UINT32 trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + UINT8 cols = BIT(m_mode, 0) ? 32 : 64; + UINT8 skip = BIT(m_mode, 0) ? 2 : 1; + + if (m_mode != m_size_store) + { + m_size_store = m_mode & 1; + screen.set_visible_area(0, cols*8-1, 0, 16*16-1); + } + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 16; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x+=skip) + { + chr = m_p_videoram[x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<3) | (ra & 7) | (ra & 8) << 8]; + + /* Display a scanline of a character (8 pixels) */ + *p++ = BIT(gfx, 0); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 7); + } + } + ma+=64; + } + return 0; +} + +UINT32 trs80_state::screen_update_meritum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +/* lores characters are in the character generator. Each character is 6x11. */ +{ + UINT8 y,ra,chr,gfx; + UINT16 sy=0,ma=0,x; + UINT8 cols = BIT(m_mode, 0) ? 32 : 64; + UINT8 skip = BIT(m_mode, 0) ? 2 : 1; + + if (m_mode != m_size_store) + { + m_size_store = m_mode; + screen.set_visible_area(0, cols*6-1, 0, 16*11-1); + } + + for (y = 0; y < 16; y++) + { + for (ra = 0; ra < 11; ra++) + { + UINT16 *p = &bitmap.pix16(sy++); + + for (x = ma; x < ma + 64; x+=skip) + { + chr = m_p_videoram[x]; + + /* get pattern of pixels for that character scanline */ + gfx = m_p_chargen[(chr<<4) | ra]; + + /* Display a scanline of a character (6 pixels) */ + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); + } + } + ma+=64; + } + return 0; +} + + + +/*************************************************************************** + Write to video ram +***************************************************************************/ + +READ8_MEMBER( trs80_state::trs80_videoram_r ) +{ + if ((m_mode & 0x80) && (~m_model4 & 1)) offset |= 0x400; + return m_p_videoram[offset]; +} + +WRITE8_MEMBER( trs80_state::trs80_videoram_w ) +{ + if ((m_mode & 0x80) && (~m_model4 & 1)) offset |= 0x400; + m_p_videoram[offset] = data; +} + + +/*************************************************************************** + Write to graphics ram +***************************************************************************/ + +READ8_MEMBER( trs80_state::trs80_gfxram_r ) +{ + return m_p_gfxram[offset]; +} + +WRITE8_MEMBER( trs80_state::trs80_gfxram_w ) +{ + m_p_gfxram[offset] = data; +} + + +/*************************************************************************** + Palettes +***************************************************************************/ + +/* Levels are unknown - guessing */ +static const rgb_t lnw80_palette[] = +{ + rgb_t(220, 220, 220), // white + rgb_t(0, 175, 0), // green + rgb_t(200, 200, 0), // yellow + rgb_t(255, 0, 0), // red + rgb_t(255, 0, 255), // magenta + rgb_t(0, 0, 175), // blue + rgb_t(0, 255, 255), // cyan + rgb_t(0, 0, 0), // black +}; + +PALETTE_INIT_MEMBER(trs80_state,lnw80) +{ + palette.set_pen_colors(0, lnw80_palette, ARRAY_LENGTH(lnw80_palette)); +} diff --git a/src/mame/video/tx0.c b/src/mame/video/tx0.c new file mode 100644 index 00000000000..35e105107e7 --- /dev/null +++ b/src/mame/video/tx0.c @@ -0,0 +1,469 @@ +// license:GPL-2.0+ +// copyright-holders:Raphael Nabet +/* + TX-0 + + Raphael Nabet, 2004 +*/ + +#include "emu.h" + +#include "cpu/pdp1/tx0.h" +#include "includes/tx0.h" +#include "video/crt.h" + + + + +inline void tx0_state::tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix16(y, x) = color; +} + +/* + video init +*/ +void tx0_state::video_start() +{ + m_typewriter_color = color_typewriter_black; + + /* alloc bitmaps for our private fun */ + m_panel_bitmap.allocate(panel_window_width, panel_window_height, BITMAP_FORMAT_IND16); + m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16); + + /* set up out bitmaps */ + tx0_draw_panel_backdrop(m_panel_bitmap); + + const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1); + m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds); +} + + +void tx0_state::screen_eof_tx0(screen_device &screen, bool state) +{ + // rising edge + if (state) + { + m_crt->eof(); + } +} + + +/* + schedule a pixel to be plotted +*/ +void tx0_state::tx0_plot(int x, int y) +{ + /* compute pixel coordinates and plot */ + x = x*crt_window_width/0777; + y = y*crt_window_height/0777; + m_crt->plot(x, y); +} + + +/* + screen_update_tx0: effectively redraw the screen +*/ +UINT32 tx0_state::screen_update_tx0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_crt->update(bitmap); + + tx0_draw_panel(m_panel_bitmap); + copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect); + + copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect); + return 0; +} + + + +/* + Operator control panel code +*/ + +enum +{ + x_panel_col1a_offset = 0, + x_panel_col1b_offset = 24, + x_panel_col2_offset = x_panel_col1a_offset+184+8 +}; + +enum +{ + /* column 1: registers, test accumulator, test buffer, toggle switch storage */ + y_panel_pc_offset = 0, + y_panel_mar_offset = y_panel_pc_offset+2*8, + y_panel_mbr_offset = y_panel_mar_offset+2*8, + y_panel_ac_offset = y_panel_mbr_offset+2*8, + y_panel_lr_offset = y_panel_ac_offset+2*8, + y_panel_xr_offset = y_panel_lr_offset+2*8, + y_panel_tbr_offset = y_panel_xr_offset+2*8, + y_panel_tac_offset = y_panel_tbr_offset+2*8, + y_panel_tss_offset = y_panel_tac_offset+2*8, + + /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ + y_panel_stop_c0_offset = 8, + y_panel_stop_c1_offset = y_panel_stop_c0_offset+8, + y_panel_gbl_cm_sel_offset = y_panel_stop_c1_offset+8, + y_panel_run_offset = y_panel_gbl_cm_sel_offset+8, + y_panel_cycle1_offset = y_panel_run_offset+8, + y_panel_cycle2_offset = y_panel_cycle1_offset+8, + y_panel_rim_offset = y_panel_cycle2_offset+8, + y_panel_ioh_offset = y_panel_rim_offset+8, + y_panel_ios_offset = y_panel_ioh_offset+8, + y_panel_ir_offset = y_panel_ios_offset+8, + y_panel_pf_offset = y_panel_ir_offset+2*8 +}; + +/* draw a small 8*8 LED (or is this a lamp? ) */ +void tx0_state::tx0_draw_led(bitmap_ind16 &bitmap, int x, int y, int state) +{ + int xx, yy; + + for (yy=1; yy<7; yy++) + for (xx=1; xx<7; xx++) + tx0_plot_pixel(bitmap, x+xx, y+yy, state ? pen_lit_lamp : pen_unlit_lamp); +} + +/* draw nb_bits leds which represent nb_bits bits in value */ +void tx0_state::tx0_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) +{ + while (nb_bits) + { + nb_bits--; + + tx0_draw_led(bitmap, x, y, (value >> nb_bits) & 1); + + x += 8; + } +} + + +/* draw a small 8*8 switch */ +void tx0_state::tx0_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state) +{ + int xx, yy; + int i; + + /* erase area */ + for (yy=0; yy<8; yy++) + for (xx=0; xx<8; xx++) + tx0_plot_pixel(bitmap, x+xx, y+yy, pen_panel_bg); + + + /* draw nut (-> circle) */ + for (i=0; i<4;i++) + { + tx0_plot_pixel(bitmap, x+2+i, y+1, pen_switch_nut); + tx0_plot_pixel(bitmap, x+2+i, y+6, pen_switch_nut); + tx0_plot_pixel(bitmap, x+1, y+2+i, pen_switch_nut); + tx0_plot_pixel(bitmap, x+6, y+2+i, pen_switch_nut); + } + tx0_plot_pixel(bitmap, x+2, y+2, pen_switch_nut); + tx0_plot_pixel(bitmap, x+5, y+2, pen_switch_nut); + tx0_plot_pixel(bitmap, x+2, y+5, pen_switch_nut); + tx0_plot_pixel(bitmap, x+5, y+5, pen_switch_nut); + + /* draw button (->disc) */ + if (! state) + y += 4; + for (i=0; i<2;i++) + { + tx0_plot_pixel(bitmap, x+3+i, y, pen_switch_button); + tx0_plot_pixel(bitmap, x+3+i, y+3, pen_switch_button); + } + for (i=0; i<4;i++) + { + tx0_plot_pixel(bitmap, x+2+i, y+1, pen_switch_button); + tx0_plot_pixel(bitmap, x+2+i, y+2, pen_switch_button); + } +} + + +/* draw nb_bits switches which represent nb_bits bits in value */ +void tx0_state::tx0_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) +{ + while (nb_bits) + { + nb_bits--; + + tx0_draw_switch(bitmap, x, y, (value >> nb_bits) & 1); + + x += 8; + } +} + + +/* write a single char on screen */ +void tx0_state::tx0_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color) +{ + m_gfxdecode->gfx(0)->transpen(bitmap,bitmap.cliprect(), character-32, color, 0, 0, + x+1, y, 0); +} + +/* write a string on screen */ +void tx0_state::tx0_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) +{ + while (* buf) + { + tx0_draw_char(bitmap, *buf, x, y, color); + + x += 8; + buf++; + } +} + + +/* draw a vertical line */ +void tx0_state::tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color) +{ + while (height--) + tx0_plot_pixel(bitmap, x, y++, color); +} + +#ifdef UNUSED_FUNCTION +/* draw a horizontal line */ +void tx0_state::tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color) +{ + while (width--) + tx0_plot_pixel(bitmap, x++, y, color); +} +#endif + +/* + draw the operator control panel (fixed backdrop) +*/ +void tx0_state::tx0_draw_panel_backdrop(bitmap_ind16 &bitmap) +{ + int i; + char buf[3]; + + /* fill with black */ + const rectangle panel_bitmap_bounds(0, panel_window_width-1, 0, panel_window_height-1); + m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds); + + /* column 1: registers, test accumulator, test buffer, toggle switch storage */ + tx0_draw_string(bitmap, "program counter", x_panel_col1b_offset, y_panel_pc_offset, color_panel_caption); + tx0_draw_string(bitmap, "memory address reg.", x_panel_col1b_offset, y_panel_mar_offset, color_panel_caption); + tx0_draw_string(bitmap, "memory buffer reg.", x_panel_col1b_offset, y_panel_mbr_offset, color_panel_caption); + tx0_draw_string(bitmap, "accumulator", x_panel_col1b_offset, y_panel_ac_offset, color_panel_caption); + tx0_draw_string(bitmap, "live register", x_panel_col1b_offset, y_panel_lr_offset, color_panel_caption); + tx0_draw_string(bitmap, "index register", x_panel_col1b_offset, y_panel_xr_offset, color_panel_caption); + tx0_draw_string(bitmap, "TBR", x_panel_col1b_offset, y_panel_tbr_offset, color_panel_caption); + tx0_draw_string(bitmap, "TAC", x_panel_col1b_offset, y_panel_tac_offset, color_panel_caption); + tx0_draw_string(bitmap, "cm", x_panel_col1a_offset+8, y_panel_tss_offset, color_panel_caption); + tx0_draw_string(bitmap, "TSS", x_panel_col1a_offset+24, y_panel_tss_offset, color_panel_caption); + tx0_draw_string(bitmap, "lr", x_panel_col1a_offset+168, y_panel_tss_offset, color_panel_caption); + for (i=0; i<16; i++) + { + sprintf(buf, "%2o", i); + tx0_draw_string(bitmap, buf, x_panel_col1a_offset, y_panel_tss_offset+8+i*8, color_panel_caption); + } + + /* column separator */ + tx0_draw_vline(bitmap, x_panel_col2_offset-4, 8, 248, pen_panel_caption); + + /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ + tx0_draw_string(bitmap, "stop c0", x_panel_col2_offset+8, y_panel_stop_c0_offset, color_panel_caption); + tx0_draw_string(bitmap, "stop c1", x_panel_col2_offset+8, y_panel_stop_c1_offset, color_panel_caption); + tx0_draw_string(bitmap, "cm select", x_panel_col2_offset+8, y_panel_gbl_cm_sel_offset, color_panel_caption); + tx0_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); + tx0_draw_string(bitmap, "cycle1", x_panel_col2_offset+8, y_panel_cycle1_offset, color_panel_caption); + tx0_draw_string(bitmap, "cycle2", x_panel_col2_offset+8, y_panel_cycle2_offset, color_panel_caption); + tx0_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); + tx0_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); + tx0_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); + tx0_draw_string(bitmap, "instr", x_panel_col2_offset+8, y_panel_ir_offset, color_panel_caption); + tx0_draw_string(bitmap, "pgm flags", x_panel_col2_offset+8, y_panel_pf_offset, color_panel_caption); +} + + +/* + draw the operator control panel (dynamic elements) +*/ +void tx0_state::tx0_draw_panel(bitmap_ind16 &bitmap) +{ + int cm_sel, lr_sel; + int i; + + /* column 1: registers, test accumulator, test buffer, toggle switch storage */ + tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, m_maincpu->state_int(TX0_PC), 16); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, m_maincpu->state_int(TX0_MAR), 16); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, m_maincpu->state_int(TX0_MBR), 18); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, m_maincpu->state_int(TX0_AC), 18); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, m_maincpu->state_int(TX0_LR), 18); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, m_maincpu->state_int(TX0_XR), 14); + tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, m_maincpu->state_int(TX0_TBR), 18); + tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, m_maincpu->state_int(TX0_TAC), 18); + cm_sel = m_maincpu->state_int(TX0_CM_SEL); + lr_sel = m_maincpu->state_int(TX0_LR_SEL); + for (i=0; i<16; i++) + { + tx0_draw_switch(bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1); + tx0_draw_multipleswitch(bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, m_maincpu->state_int(TX0_TSS00+i), 18); + tx0_draw_switch(bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); + } + + /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ + tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, m_maincpu->state_int(TX0_STOP_CYC0)); + tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, m_maincpu->state_int(TX0_STOP_CYC1)); + tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, m_maincpu->state_int(TX0_GBL_CM_SEL)); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset, m_maincpu->state_int(TX0_RUN)); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle1_offset, m_maincpu->state_int(TX0_CYCLE) & 1); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle2_offset, m_maincpu->state_int(TX0_CYCLE) & 2); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset, m_maincpu->state_int(TX0_RIM)); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset, m_maincpu->state_int(TX0_IOH)); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset, m_maincpu->state_int(TX0_IOS)); + tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_ir_offset+8, m_maincpu->state_int(TX0_IR), 5); + tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_pf_offset+8, m_maincpu->state_int(TX0_PF), 6); +} + + + +/* + Typewriter code +*/ + + + + + +enum +{ + typewriter_line_height = 8, + typewriter_write_offset_y = typewriter_window_height-typewriter_line_height, + typewriter_scroll_step = typewriter_line_height +}; + +enum +{ + tab_step = 8 +}; + + +void tx0_state::tx0_typewriter_linefeed() +{ + UINT8 buf[typewriter_window_width]; + int y; + + for (y=0; ypens()); + } + + const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1); + m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window); +} + +void tx0_state::tx0_typewriter_drawchar(int character) +{ + static const char ascii_table[2][64] = + { + { /* lower case */ + '\0', '\0', 'e', '8', + '\0', '|', 'a', '3', + ' ', '=', 's', '4', + 'i', '+', 'u', '2', + '\0',/*color shift*/'.', 'd', '5', + 'r', '1', 'j', '7', + 'n', ',', 'f', '6', + 'c', '-', 'k', '\0', + 't', '\0', 'z', '\0',/*back space*/ + 'l', '\0',/*tab*/ 'w', '\0', + 'h', '\0',/*carr. return*/'y', '\0', + 'p', '\0', 'q', '\0', + 'o', '\0',/*stop*/ 'b', '\0', + 'g', '\0', '9', '\0', + 'm', '\0',/*upper case*/ 'x', '\0', + 'v', '\0',/*lower case*/ '0', '\0'/*delete*/ + }, + { /* upper case */ + '\0', '\0', 'E', '\210', + '\0', '_', 'A', '\203', + ' ', ':', 'S', '\204', + 'I', '/', 'U', '\202', + '\0',/*color shift*/')', 'D', '\205', + 'R', '\201', 'J', '\207', + 'N', '(', 'F', '\206', + 'C', '\212',/*macron*/ 'K', '\0', + 'T', '\0', 'Z', '\0',/*back space*/ + 'L', '\0',/*tab*/ 'W', '\0', + 'H', '\0',/*carr. return*/'Y', '\0', + 'P', '\0', 'Q', '\0', + 'O', '\0',/*stop*/ 'B', '\0', + 'G', '\0', '\211', '\0', + 'M', '\0',/*upper case*/ 'X', '\0', + 'V', '\0',/*lower case*/ '\200', '\0'/*delete*/ + } + }; + + + + character &= 0x3f; + + switch (character) + { + case 020: +#if 0 + /* color shift */ + m_typewriter_color = color_typewriter_black; + m_typewriter_color = color_typewriter_red; +#endif + break; + + case 043: + /* Backspace */ + if (m_pos) + m_pos--; + break; + + case 045: + /* Tab */ + m_pos = m_pos + tab_step - (m_pos % tab_step); + break; + + case 051: + /* Carriage Return */ + m_pos = 0; + tx0_typewriter_linefeed(); + break; + + case 061: + /* Stop */ + /* ?????? */ + break; + + case 071: + /* Upper case */ + m_case_shift = 1; + break; + + case 075: + /* Lower case */ + m_case_shift = 0; + break; + + case 077: + /* Delete */ + /* ?????? */ + break; + + default: + /* Any printable character... */ + + if (m_pos >= 80) + { /* if past right border, wrap around. (Right???) */ + tx0_typewriter_linefeed(); /* next line */ + m_pos = 0; /* return to start of line */ + } + + /* print character (lookup ASCII equivalent in table) */ + tx0_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character], + 8*m_pos, typewriter_write_offset_y, + m_typewriter_color); /* print char */ + + m_pos++; /* step carriage forward */ + break; + } +} diff --git a/src/mame/video/ut88.c b/src/mame/video/ut88.c new file mode 100644 index 00000000000..e5fcae9e678 --- /dev/null +++ b/src/mame/video/ut88.c @@ -0,0 +1,44 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + UT88 video driver by Miodrag Milanovic + + 06/03/2008 Preliminary driver. + +****************************************************************************/ + + +#include "includes/ut88.h" + + +const gfx_layout ut88_charlayout = +{ + 8, 8, /* 8x8 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + {0}, /* no bitplanes; 1 bit per pixel */ + {0, 1, 2, 3, 4, 5, 6, 7}, + {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, + 8*8 /* size of one char */ +}; + +VIDEO_START_MEMBER(ut88_state,ut88) +{ +} + +UINT32 ut88_state::screen_update_ut88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int x,y; + + for(y = 0; y < 28; y++ ) + { + for(x = 0; x < 64; x++ ) + { + int code = m_p_videoram[ x + y*64 ] & 0x7f; + int attr = m_p_videoram[ x+1 + y*64 ] & 0x80; + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code | attr, 0, 0,0, x*8,y*8); + } + } + return 0; +} diff --git a/src/mame/video/uv201.c b/src/mame/video/uv201.c new file mode 100644 index 00000000000..ae18cee5d2d --- /dev/null +++ b/src/mame/video/uv201.c @@ -0,0 +1,589 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + VideoBrain UV201/UV202 video chip emulation + +**********************************************************************/ + +#include "uv201.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 1 + + +// screen parameters +#define SCREEN_WIDTH 232 +#define SCREEN_HEIGHT 262 +#define VISAREA_WIDTH 193 +#define VBLANK_WIDTH 21 +#define HBLANK_WIDTH 39 +#define HSYNC_WIDTH 18 +#define HFP_WIDTH 16 +#define HBP_WIDTH 5 +#define HBLANK_END HSYNC_WIDTH + HFP_WIDTH +#define HBLANK_START HBLANK_END + VISAREA_WIDTH + + +// write-only registers +#define REGISTER_COMMAND 0xf7 +#define REGISTER_BACKGROUND 0xf5 +#define REGISTER_FINAL_MODIFIER 0xf2 +#define REGISTER_Y_INTERRUPT 0xf0 + + +// read-only registers +#define REGISTER_X_FREEZE 0xf8 +#define REGISTER_Y_FREEZE_LOW 0xf9 +#define REGISTER_Y_FREEZE_HIGH 0xfa +#define REGISTER_CURRENT_Y_LOW 0xfb + + +// read/write registers - RAM memory +#define RAM_RP_LO 0x00 // cartridge pointer low order +#define RAM_RP_HI_COLOR 0x10 // cartridge pointer high order and color +#define RAM_DX_INT_XCOPY 0x20 // dX, intensity, X-copy +#define RAM_DY 0x30 // dY +#define RAM_X 0x40 // X value +#define RAM_Y_LO_A 0x50 // Y value low order list A +#define RAM_Y_LO_B 0x60 // Y value low order list B +#define RAM_XY_HI_A 0x70 // Y value high order and X order list A +#define RAM_XY_HI_B 0x80 // Y value high order and X order list B + + +// command register bits +#define COMMAND_YINT_H_O 0x80 +#define COMMAND_A_B 0x40 +#define COMMAND_Y_ZM 0x20 +#define COMMAND_KBD 0x10 +#define COMMAND_INT 0x08 +#define COMMAND_ENB 0x04 +#define COMMAND_FRZ 0x02 +#define COMMAND_X_ZM 0x01 + + +#define IS_CHANGED(_bit) \ + ((m_cmd & _bit) != (data & _bit)) + +#define RAM(_offset) \ + m_ram[_offset + i] + +#define RAM_XORD(_offset) \ + m_ram[_offset + xord] + +#define IS_VISIBLE(_y) \ + ((_y >= cliprect.min_y) && (_y <= cliprect.max_y)) + +#define DRAW_PIXEL(_scanline, _dot) \ + if (IS_VISIBLE(_scanline)) bitmap.pix32((_scanline), HSYNC_WIDTH + HFP_WIDTH + _dot) = m_palette_val[pixel]; + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +// device type definition +const device_type UV201 = &device_creator; + + +//------------------------------------------------- +// uv201_device - constructor +//------------------------------------------------- + +uv201_device::uv201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, UV201, "UV201", tag, owner, clock, "uv201", __FILE__), + device_video_interface(mconfig, *this), + m_write_ext_int(*this), + m_write_hblank(*this), + m_read_db(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void uv201_device::device_start() +{ + // resolve callbacks + m_write_ext_int.resolve_safe(); + m_write_hblank.resolve_safe(); + m_read_db.resolve_safe(0); + + // allocate timers + m_timer_y_odd = timer_alloc(TIMER_Y_ODD); + m_timer_y_even = timer_alloc(TIMER_Y_EVEN); + m_timer_hblank_on = timer_alloc(TIMER_HBLANK_ON); + m_timer_hblank_off = timer_alloc(TIMER_HBLANK_OFF); + + initialize_palette(); + + memset(m_ram, 0x00, sizeof(m_ram)); + m_y_int = 0; + m_fmod = 0; + m_bg = 0; + m_cmd = 0; + m_freeze_x = 0; + m_freeze_y = 0; + m_field = 0; + + // state saving + save_item(NAME(m_ram)); + save_item(NAME(m_y_int)); + save_item(NAME(m_fmod)); + save_item(NAME(m_bg)); + save_item(NAME(m_cmd)); + save_item(NAME(m_freeze_x)); + save_item(NAME(m_freeze_y)); + save_item(NAME(m_field)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void uv201_device::device_reset() +{ + m_write_ext_int(CLEAR_LINE); + + m_write_hblank(1); + m_timer_hblank_off->adjust(attotime::from_ticks( HBLANK_END, m_clock )); +} + + +//------------------------------------------------- +// device_timer - handle timer events +//------------------------------------------------- + +void uv201_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + int scanline = m_screen->vpos(); + + switch (id) + { + case TIMER_Y_ODD: + case TIMER_Y_EVEN: + if ((m_cmd & COMMAND_INT) && !(m_cmd & COMMAND_FRZ)) + { + if (LOG) logerror("Y-Interrupt at scanline %u\n", scanline); + + m_freeze_y = scanline; + + m_write_ext_int(ASSERT_LINE); + m_write_ext_int(CLEAR_LINE); + } + break; + + case TIMER_HBLANK_ON: + m_write_hblank(1); + + m_timer_hblank_off->adjust(attotime::from_ticks( HBLANK_WIDTH, m_clock ) ); + break; + + case TIMER_HBLANK_OFF: + m_write_hblank(0); + + m_timer_hblank_on->adjust(attotime::from_ticks( VISAREA_WIDTH, m_clock ) ); + break; + } +} + + +//------------------------------------------------- +// initialize_palette - +//------------------------------------------------- + +void uv201_device::initialize_palette() +{ + UINT8 offlointensity = 0x00; + UINT8 offhiintensity = 0xc0; + + UINT8 onlointensity = 0xa0; + UINT8 onhiintensity = 0xff; + + for (int i = 0; i < 4; i++) + { + int offset = i * 8; + UINT8 onvalue, offvalue; + + if (offset < 16) + { + offvalue = offlointensity; + onvalue = onlointensity; + } + else + { + offvalue = offhiintensity; + onvalue = onhiintensity; + } + + m_palette_val[offset + 0] = rgb_t(offvalue, offvalue, offvalue); // black + m_palette_val[offset + 1] = rgb_t(onvalue, offvalue, offvalue); // red + m_palette_val[offset + 2] = rgb_t(offvalue, onvalue, offvalue); // green + m_palette_val[offset + 3] = rgb_t(onvalue, onvalue, offvalue); // red-green + m_palette_val[offset + 4] = rgb_t(offvalue, offvalue, onvalue); // blue + m_palette_val[offset + 5] = rgb_t(onvalue, offvalue, onvalue); // red-blue + m_palette_val[offset + 6] = rgb_t(offvalue, onvalue, onvalue); // green-blue + m_palette_val[offset + 7] = rgb_t(onvalue, onvalue, onvalue); // white + } +} + + +//------------------------------------------------- +// get_field_vpos - get scanline within field +//------------------------------------------------- + +int uv201_device::get_field_vpos() +{ + int vpos = m_screen->vpos(); + + if (vpos >= SCREEN_HEIGHT) + { + // even field + vpos -= SCREEN_HEIGHT; + } + + return vpos; +} + + +//------------------------------------------------- +// get_field - get video field +//------------------------------------------------- + +int uv201_device::get_field() +{ + return m_screen->vpos() < SCREEN_HEIGHT; +} + + +//------------------------------------------------- +// set_y_interrupt - set Y interrupt timer +//------------------------------------------------- + +void uv201_device::set_y_interrupt() +{ + int scanline = ((m_cmd & COMMAND_YINT_H_O) << 1) | m_y_int; + + m_timer_y_odd->adjust(m_screen->time_until_pos(scanline), 0, m_screen->frame_period()); + //m_timer_y_even->adjust(m_screen->time_until_pos(scanline + SCREEN_HEIGHT), 0, m_screen->frame_period()); +} + + +//------------------------------------------------- +// do_partial_update - update screen +//------------------------------------------------- + +void uv201_device::do_partial_update() +{ + int vpos = m_screen->vpos(); + + if (LOG) logerror("Partial screen update at scanline %u\n", vpos); + + m_screen->update_partial(vpos); +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( uv201_device::read ) +{ + UINT8 data = 0xff; + + switch (offset) + { + case REGISTER_X_FREEZE: + data = m_freeze_x; + + if (LOG) logerror("X-Freeze %02x\n", data); + break; + + case REGISTER_Y_FREEZE_LOW: + data = m_freeze_y & 0xff; + + if (LOG) logerror("Y-Freeze Low %02x\n", data); + break; + + case REGISTER_Y_FREEZE_HIGH: + /* + + bit signal description + + 0 Y-F8 Y freeze high order (MSB) bit + 1 Y-C8 current Y counter high order (MSB) bit + 2 + 3 + 4 + 5 + 6 + 7 O/_E odd/even field + + */ + + data = (get_field() << 7) | (BIT(get_field_vpos(), 8) << 1) | BIT(m_freeze_y, 8); + + if (LOG) logerror("Y-Freeze High %02x\n", data); + break; + + case REGISTER_CURRENT_Y_LOW: + data = get_field_vpos() & 0xff; + + if (LOG) logerror("Current-Y Low %02x\n", data); + break; + + default: + if (offset < 0x90) + data = m_ram[offset]; + else + if (LOG) logerror("Unknown VLSI read from %02x!\n", offset); + } + + return data; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( uv201_device::write ) +{ + switch (offset) + { + case REGISTER_Y_INTERRUPT: + if (LOG) logerror("Y-Interrupt %02x\n", data); + + if (m_y_int != data) + { + m_y_int = data; + set_y_interrupt(); + } + break; + + case REGISTER_FINAL_MODIFIER: + /* + + bit signal description + + 0 RED red + 1 GREEN green + 2 BLUE blue + 3 INT 0 intensity 0 + 4 INT 1 intensity 1 + 5 not used + 6 not used + 7 not used + + */ + + if (LOG) logerror("Final Modifier %02x\n", data); + + do_partial_update(); + m_fmod = data & 0x1f; + break; + + case REGISTER_BACKGROUND: + /* + + bit signal description + + 0 RED red + 1 GREEN green + 2 BLUE blue + 3 INT 0 intensity 0 + 4 INT 1 intensity 1 + 5 not used + 6 not used + 7 not used + + */ + + if (LOG) logerror("Background %02x\n", data); + + do_partial_update(); + m_bg = data & 0x1f; + break; + + case REGISTER_COMMAND: + /* + + bit signal description + + 0 X-ZM X zoom + 1 FRZ freeze + 2 ENB video enable + 3 INT interrupt enable + 4 KBD general purpose output + 5 Y-ZM Y zoom + 6 A/_B list selection + 7 YINT H.O. Y COMMAND_INT register high order bit + + */ + + if (LOG) logerror("Command %02x\n", data); + + if (IS_CHANGED(COMMAND_YINT_H_O)) + { + set_y_interrupt(); + } + + if (IS_CHANGED(COMMAND_A_B) || IS_CHANGED(COMMAND_Y_ZM) || IS_CHANGED(COMMAND_X_ZM)) + { + do_partial_update(); + } + + m_cmd = data; + break; + + default: + if (offset < 0x90) + m_ram[offset] = data; + else + logerror("Unknown VLSI write %02x to %02x!\n", data, offset); + } +} + + +//------------------------------------------------- +// ext_int_w - external interrupt write +//------------------------------------------------- + +WRITE_LINE_MEMBER( uv201_device::ext_int_w ) +{ + if (!state && (m_cmd & COMMAND_FRZ)) + { + m_freeze_y = get_field_vpos(); + m_freeze_x = m_screen->hpos(); + } +} + + +//------------------------------------------------- +// kbd_r - keyboard select read +//------------------------------------------------- + +READ_LINE_MEMBER( uv201_device::kbd_r ) +{ + return (m_cmd & COMMAND_KBD) ? 1 : 0; +} + + +//------------------------------------------------- +// screen_update - +//------------------------------------------------- + +UINT32 uv201_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(rgb_t(0x00,0x00,0x00), cliprect); + + if (!(m_cmd & COMMAND_ENB)) + { + return 0; + } + + for (int y = 0; y < SCREEN_HEIGHT; y++) + { + for (int x = 0; x < VISAREA_WIDTH; x++) + { + int pixel = m_bg; + DRAW_PIXEL(y, x); + } + } + + for (int i = 0; i < 16; i++) + { + UINT8 xy_hi = (m_cmd & COMMAND_A_B) ? RAM(RAM_XY_HI_A) : RAM(RAM_XY_HI_B); + UINT8 y_lo = (m_cmd & COMMAND_A_B) ? RAM(RAM_Y_LO_A) : RAM(RAM_Y_LO_B); + UINT16 y = (BIT(xy_hi, 7) << 8) | y_lo; + int xord = xy_hi & 0x0f; + + UINT8 rp_hi_color = RAM_XORD(RAM_RP_HI_COLOR); + UINT8 rp_lo = RAM_XORD(RAM_RP_LO); + UINT16 rp = ((rp_hi_color << 8) | rp_lo) & 0x1fff; + + if (rp < 0x800) rp |= 0x2000; + + UINT8 dx_int_xcopy = RAM_XORD(RAM_DX_INT_XCOPY); + int color = ((dx_int_xcopy & 0x60) >> 2) | (BIT(rp_hi_color, 5) << 2) | (BIT(rp_hi_color, 6) << 1) | (BIT(rp_hi_color, 7)); + UINT8 dx = dx_int_xcopy & 0x1f; + UINT8 dy = RAM_XORD(RAM_DY); + int xcopy = BIT(dx_int_xcopy, 7); + UINT8 x = RAM_XORD(RAM_X); + + if (LOG) logerror("Object %u xord %u y %u x %u dy %u dx %u xcopy %u color %u rp %04x\n", i, xord, y, x, dy, dx, xcopy, color, rp); + + if (rp == 0) continue; + if (y > SCREEN_HEIGHT) continue; + + for (int sy = 0; sy < dy; sy++) + { + for (int sx = 0; sx < dx; sx++) + { + UINT8 data = m_read_db(rp); + + for (int bit = 0; bit < 8; bit++) + { + int pixel = ((BIT(data, 7) ? color : m_bg) ^ m_fmod) & 0x1f; + + if (m_cmd & COMMAND_Y_ZM) + { + int scanline = y + (sy * 2); + + if (m_cmd & COMMAND_X_ZM) + { + int dot = (x * 2) + (sx * 16) + (bit * 2); + + DRAW_PIXEL(scanline, dot); + DRAW_PIXEL(scanline, dot + 1); + DRAW_PIXEL(scanline + 1, dot); + DRAW_PIXEL(scanline + 1, dot + 1); + } + else + { + int dot = x + (sx * 8) + bit; + + DRAW_PIXEL(scanline, dot); + DRAW_PIXEL(scanline + 1, dot); + } + } + else + { + int scanline = y + sy; + + if (m_cmd & COMMAND_X_ZM) + { + int dot = (x * 2) + (sx * 16) + (bit * 2); + + DRAW_PIXEL(scanline, dot); + DRAW_PIXEL(scanline, dot + 1); + } + else + { + int dot = x + (sx * 8) + bit; + + DRAW_PIXEL(scanline, dot); + } + } + + data <<= 1; + } + + if (!xcopy) rp++; + } + + if (xcopy) rp++; + } + } + + return 0; +} diff --git a/src/mame/video/uv201.h b/src/mame/video/uv201.h new file mode 100644 index 00000000000..336dd8f4141 --- /dev/null +++ b/src/mame/video/uv201.h @@ -0,0 +1,159 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + VideoBrain UV201/UV202 video chip emulation + +********************************************************************** + _____ _____ + GND 1 |* \_/ | 40 DMAREQ + G 2 | | 39 /CE + I 3 | | 38 RESET + B 4 | | 37 BISTROBE + R 5 | | 36 UMIREQ0 + BA0 6 | | 35 BRCLK + BA1 7 | | 34 HBLANK + BA2 8 | | 33 VBLANK + BA3 9 | | 32 R/W + BA4 10 | UV201 | 31 keypad column 8 + BA5 11 | | 30 EXT INT + BA6 12 | | 29 FIELD + BA7 13 | | 28 BD7 + BA8 14 | | 27 BD6 + BA9 15 | | 26 BD5 + BA10 16 | | 25 BD4 + BA11 17 | | 24 BD3 + BA12 18 | | 23 BD2 + +5V 19 | | 22 BD1 + +12V 20 |_____________| 21 BD0 + + _____ _____ + UMIREQ1 1 |* \_/ | 40 BISTROBE + UMIREQ0 2 | | 39 CPUREQ1 + CPUREQ0 3 | | 38 GND + XIN 4 | | 37 /800-BFF + XOUT 5 | | 36 RST + DMAREQ0 6 | | 35 DMAREQ1 + CPU CLK 7 | | 34 COLCLK + WACK 8 | | 33 BRCLK + D0 9 | | 32 D7 + BD0 10 | UV202 | 31 BD7 + D1 11 | | 30 D6 + BD1 12 | | 29 BD6 + D2 13 | | 28 D5 + BD2 14 | | 27 BD5 + D3 15 | | 26 D4 + BD3 16 | | 25 BD4 + HBLANK 17 | | 24 FIELD + VBLANK 18 | | 23 SCANLINE + BURST 19 | | 22 +12V + CSYNCH 20 |_____________| 21 +5V + +**********************************************************************/ + +#pragma once + +#ifndef __UV201__ +#define __UV201__ + +#include "emu.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_UV201_ADD(_tag, _screen_tag, _clock, _config) \ + MCFG_SCREEN_ADD(_screen_tag, RASTER) \ + MCFG_SCREEN_UPDATE_DEVICE(_tag, uv201_device, screen_update) \ + MCFG_SCREEN_RAW_PARAMS(_clock, 232, 18, 232, 262, 21, 262) \ + MCFG_DEVICE_ADD(_tag, UV201, _clock) \ + MCFG_VIDEO_SET_SCREEN(_screen_tag) + + +#define MCFG_UV201_EXT_INT_CALLBACK(_write) \ + devcb = &uv201_device::set_ext_int_wr_callback(*device, DEVCB_##_write); + +#define MCFG_UV201_HBLANK_CALLBACK(_write) \ + devcb = &uv201_device::set_hblank_wr_callback(*device, DEVCB_##_write); + +#define MCFG_UV201_DB_CALLBACK(_read) \ + devcb = &uv201_device::set_db_rd_callback(*device, DEVCB_##_read); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> uv201_device + +class uv201_device : public device_t, + public device_video_interface +{ +public: + // construction/destruction + uv201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_ext_int_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_ext_int.set_callback(object); } + template static devcb_base &set_hblank_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_hblank.set_callback(object); } + template static devcb_base &set_db_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_db.set_callback(object); } + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE_LINE_MEMBER( ext_int_w ); + DECLARE_READ_LINE_MEMBER( kbd_r ); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + enum + { + TIMER_Y_ODD, + TIMER_Y_EVEN, + TIMER_HBLANK_ON, + TIMER_HBLANK_OFF + }; + + void initialize_palette(); + int get_field_vpos(); + int get_field(); + void set_y_interrupt(); + void do_partial_update(); + + devcb_write_line m_write_ext_int; + devcb_write_line m_write_hblank; + devcb_read8 m_read_db; + + rgb_t m_palette_val[32]; + UINT8 m_ram[0x90]; + UINT8 m_y_int; + UINT8 m_fmod; + UINT8 m_bg; + UINT8 m_cmd; + UINT8 m_freeze_x; + UINT16 m_freeze_y; + int m_field; + + // timers + emu_timer *m_timer_y_odd; + emu_timer *m_timer_y_even; + emu_timer *m_timer_hblank_on; + emu_timer *m_timer_hblank_off; +}; + + +// device type definition +extern const device_type UV201; + + + +#endif diff --git a/src/mame/video/v1050.c b/src/mame/video/v1050.c new file mode 100644 index 00000000000..2154b01fb42 --- /dev/null +++ b/src/mame/video/v1050.c @@ -0,0 +1,124 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +#include "includes/v1050.h" + +/* + + TODO: + + - bright in reverse video + +*/ + +#define V1050_ATTR_BRIGHT 0x01 +#define V1050_ATTR_BLINKING 0x02 +#define V1050_ATTR_ATTEN 0x04 +#define V1050_ATTR_REVERSE 0x10 +#define V1050_ATTR_BLANK 0x20 +#define V1050_ATTR_BOLD 0x40 +#define V1050_ATTR_BLINK 0x80 + +/* Video RAM Access */ + +READ8_MEMBER( v1050_state::attr_r ) +{ + return m_attr; +} + +WRITE8_MEMBER( v1050_state::attr_w ) +{ + m_attr = data; +} + +READ8_MEMBER( v1050_state::videoram_r ) +{ + if (offset >= 0x2000) + { + m_attr = (m_attr & 0xfc) | (m_attr_ram[offset] & 0x03); + } + + return m_video_ram[offset]; +} + +WRITE8_MEMBER( v1050_state::videoram_w ) +{ + m_video_ram[offset] = data; + + if (offset >= 0x2000 && BIT(m_attr, 2)) + { + m_attr_ram[offset] = m_attr & 0x03; + } +} + +/* MC6845 Interface */ + +MC6845_UPDATE_ROW( v1050_state::crtc_update_row ) +{ + int column, bit; + + for (column = 0; column < x_count; column++) + { + UINT16 address = (((ra & 0x03) + 1) << 13) | ((ma & 0x1fff) + column); + UINT8 data = m_video_ram[address & V1050_VIDEORAM_MASK]; + UINT8 attr = (m_attr & 0xfc) | (m_attr_ram[address] & 0x03); + + for (bit = 0; bit < 8; bit++) + { + int x = (column * 8) + bit; + int color = BIT(data, 7); + + /* blinking */ + if ((attr & V1050_ATTR_BLINKING) && !(attr & V1050_ATTR_BLINK)) color = 0; + + /* reverse video */ + color ^= BIT(attr, 4); + + /* bright */ + if (color && (!(attr & V1050_ATTR_BOLD) ^ (attr & V1050_ATTR_BRIGHT))) color = 2; + + /* display blank */ + if (attr & V1050_ATTR_BLANK) color = 0; + + bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(de ? color : 0); + + data <<= 1; + } + } +} + +WRITE_LINE_MEMBER( v1050_state::crtc_vs_w ) +{ + m_subcpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); + + set_interrupt(INT_VSYNC, state); +} + +/* Video Start */ + +void v1050_state::video_start() +{ + /* allocate memory */ + m_attr_ram.allocate(V1050_VIDEORAM_SIZE); + + /* register for state saving */ + save_item(NAME(m_attr)); +} + +/* Machine Drivers */ + +MACHINE_CONFIG_FRAGMENT( v1050_video ) + MCFG_MC6845_ADD(H46505_TAG, H46505, SCREEN_TAG, XTAL_15_36MHz/8) + MCFG_MC6845_SHOW_BORDER_AREA(true) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(v1050_state, crtc_update_row) + MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(v1050_state, crtc_vs_w)) + + MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_UPDATE_DEVICE(H46505_TAG, h46505_device, screen_update) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) + + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") +MACHINE_CONFIG_END diff --git a/src/mame/video/vc4000.c b/src/mame/video/vc4000.c new file mode 100644 index 00000000000..d8ba1ca6f30 --- /dev/null +++ b/src/mame/video/vc4000.c @@ -0,0 +1,650 @@ +// license:??? +// copyright-holders:Peter Trauner, Manfred Schneider, Robbbert + +#include "includes/vc4000.h" + + +/* + emulation of signetics 2636 video/audio device + + seams to me like a special microcontroller + mask programmed + + note about mame s2636 emulation: + less encapsuled + missing grid, sound generation, retriggered sprites, paddle reading, score display + not "rasterline" based + */ + +#define STICKCENTRE (105) +#define STICKLOW (20) +#define STICKHIGH (225) + +#define VC4000_END_LINE (269) + + + +void vc4000_state::video_start() +{ + int i; + + for (i=0;i<0x20; i++) + { + m_sprite_collision[i]=0; + if ((i&3)==3) m_sprite_collision[i]|=0x20; + if ((i&5)==5) m_sprite_collision[i]|=0x10; + if ((i&9)==9) m_sprite_collision[i]|=8; + if ((i&6)==6) m_sprite_collision[i]|=4; + if ((i&0xa)==0xa) m_sprite_collision[i]|=2; + if ((i&0xc)==0xc) m_sprite_collision[i]|=1; + m_background_collision[i]=0; + if ((i&0x11)==0x11) m_background_collision[i]|=0x80; + if ((i&0x12)==0x12) m_background_collision[i]|=0x40; + if ((i&0x14)==0x14) m_background_collision[i]|=0x20; + if ((i&0x18)==0x18) m_background_collision[i]|=0x10; + } + + m_joy1_x = STICKCENTRE; + m_joy1_y = STICKCENTRE; + m_joy2_x = STICKCENTRE; + m_joy2_y = STICKCENTRE; + + memset(&m_video, 0, sizeof(m_video)); + for (i=0; i<3; i++) + { + m_video.sprites[i].data = &m_video.reg.d.sprites[i]; + m_video.sprites[i].mask = 1 << i; + } + m_video.sprites[3].data = &m_video.reg.d.sprite4; + m_video.sprites[3].mask = 1 << 3; + + m_bitmap = auto_bitmap_ind16_alloc(machine(), m_screen->width(), m_screen->height()); +} + +inline UINT8 vc4000_state::vc4000_joystick_return_to_centre(UINT8 joy) +{ + UINT8 data; + + if (joy > (STICKCENTRE+5)) + data=joy-5; + else + if (joy < (STICKCENTRE-5)) + data=joy+5; + else + data=105; + + return data; +} + +READ8_MEMBER( vc4000_state::vc4000_video_r ) +{ + UINT8 data=0; + if (offset > 0xcf) offset &= 0xcf; // c0-cf is mirrored at d0-df, e0-ef, f0-ff + switch (offset) + { + case 0xca: // Background-sprite collision (bit 7-4) and sprite finished (bit 3-0) + data |= m_video.background_collision; + m_video.background_collision=0; + if (m_video.sprites[3].finished) + { + data |= 1; + m_video.sprites[3].finished = FALSE; + } + + if (m_video.sprites[2].finished) + { + data |= 2; + m_video.sprites[2].finished = FALSE; + } + if (m_video.sprites[1].finished) + { + data |= 4; + m_video.sprites[1].finished = FALSE; + } + if (m_video.sprites[0].finished) + { + data |= 8; + m_video.sprites[0].finished = FALSE; + } + break; + + case 0xcb: // VRST-Flag (bit 6) and intersprite collision (bit5-0) + data = m_video.sprite_collision | (m_video.reg.d.sprite_collision & 0xc0); + m_video.sprite_collision = 0; + m_video.reg.d.sprite_collision &= 0xbf; + break; + +#ifndef ANALOG_HACK + case 0xcc: + if (!activeS2650_FO)) data = m_io_joy1_x->read(); + else data = m_io_joy1_y->read(); + break; + case 0xcd: + if (!activecpu_get_reg(S2650_FO)) data = m_io_joy2_x->read(); + else data = m_io_joy2_y->read(); + break; +#else + + case 0xcc: /* left joystick */ + if (m_config->read()&1) + { /* paddle */ + if (!m_maincpu->state_int(S2650_FO)) + { + data = m_joys->read() & 0x03; + switch (data) + { + case 0x01: + m_joy1_x-=5; + if (m_joy1_x < STICKLOW) m_joy1_x=STICKLOW; + break; + case 0x02: + m_joy1_x+=5; + if (m_joy1_x > STICKHIGH) m_joy1_x=STICKHIGH; + break; + case 0x00: + m_joy1_x = vc4000_joystick_return_to_centre(m_joy1_x); + } + data = m_joy1_x; + } + else + { + data = m_joys->read() & 0x0c; + switch (data) + { + case 0x08: + m_joy1_y-=5; + if (m_joy1_y < STICKLOW) m_joy1_y=STICKLOW; + break; + case 0x04: + m_joy1_y+=5; + if (m_joy1_y > STICKHIGH) m_joy1_y=STICKHIGH; + break; + // case 0x00: + // m_joy1_y = vc4000_joystick_return_to_centre(m_joy1_y); + } + data = m_joy1_y; + } + } + else + { /* buttons */ + if (!m_maincpu->state_int(S2650_FO)) + { + data = m_joys->read() & 0x03; + switch (data) + { + case 0x01: + m_joy1_x=STICKLOW; + break; + case 0x02: + m_joy1_x=STICKHIGH; + break; + default: /* autocentre */ + m_joy1_x=STICKCENTRE; + } + data = m_joy1_x; + } + else + { + data = m_joys->read() & 0x0c; + switch (data) + { + case 0x08: + m_joy1_y=STICKLOW; + break; + case 0x04: + m_joy1_y=STICKHIGH; + break; + default: + m_joy1_y=STICKCENTRE; + } + data = m_joy1_y; + } + } + break; + + case 0xcd: /* right joystick */ + if (m_config->read()&1) + { + if (!m_maincpu->state_int(S2650_FO)) + { + data = m_joys->read() & 0x30; + switch (data) + { + case 0x10: + m_joy2_x-=5; + if (m_joy2_x < STICKLOW) m_joy2_x=STICKLOW; + break; + case 0x20: + m_joy2_x+=5; + if (m_joy2_x > STICKHIGH) m_joy2_x=STICKHIGH; + case 0x00: + m_joy2_x = vc4000_joystick_return_to_centre(m_joy2_x); + break; + } + data = m_joy2_x; + } + else + { + data = m_joys->read() & 0xc0; + switch (data) + { + case 0x80: + m_joy2_y-=5; + if (m_joy2_y < STICKLOW) m_joy2_y=STICKLOW; + break; + case 0x40: + m_joy2_y+=5; + if (m_joy2_y > STICKHIGH) m_joy2_y=STICKHIGH; + break; + // case 0x00: + // m_joy2_y = vc4000_joystick_return_to_centre(m_joy2_y); + } + data = m_joy2_y; + } + } + else + { + if (!m_maincpu->state_int(S2650_FO)) + { + data = m_joys->read() & 0x30; + switch (data) + { + case 0x10: + m_joy2_x=STICKLOW; + break; + case 0x20: + m_joy2_x=STICKHIGH; + break; + default: /* autocentre */ + m_joy2_x=STICKCENTRE; + } + data = m_joy2_x; + } + else + { + data = m_joys->read() & 0xc0; + switch (data) + { + case 0x80: + m_joy2_y=STICKLOW; + break; + case 0x40: + m_joy2_y=STICKHIGH; + break; + default: + m_joy2_y=STICKCENTRE; + } + data = m_joy2_y; + } + } + break; +#endif + + default: + data = m_video.reg.data[offset]; + break; + } + return data; +} + +WRITE8_MEMBER( vc4000_state::vc4000_video_w ) +{ +// m_video.reg.data[offset]=data; + if (offset > 0xcf) offset &= 0xcf; // c0-cf is mirrored at d0-df, e0-ef, f0-ff + + switch (offset) + { + case 0xc0: // Sprite size + m_video.sprites[0].size=1<<(data&3); + m_video.sprites[1].size=1<<((data>>2)&3); + m_video.sprites[2].size=1<<((data>>4)&3); + m_video.sprites[3].size=1<<((data>>6)&3); + break; + + case 0xc1: // Sprite 1+2 color + m_video.sprites[0].scolor=((~data>>3)&7); + m_video.sprites[1].scolor=(~data&7); + break; + + case 0xc2: // Sprite 2+3 color + m_video.sprites[2].scolor=((~data>>3)&7); + m_video.sprites[3].scolor=(~data&7); + break; + + case 0xc3: // Score control + m_video.reg.d.score_control = data; + break; + + case 0xc6: // Background color + m_video.reg.d.background = data; + break; + + case 0xc7: // Soundregister + m_video.reg.data[offset] = data; + m_custom->soundport_w(0, data); + break; + + case 0xc8: // Digits 1 and 2 + m_video.reg.d.bcd[0] = data; + break; + + case 0xc9: // Digits 3 and 4 + m_video.reg.d.bcd[1] = data; + break; + + case 0xca: // Background-sprite collision (bit 7-4) and sprite finished (bit 3-0) + m_video.reg.data[offset]=data; + m_video.background_collision=data; + break; + + case 0xcb: // VRST-Flag (bit 6) and intersprite collision (bit5-0) + m_video.reg.data[offset]=data; + m_video.sprite_collision=data; + break; + + default: + m_video.reg.data[offset]=data; + } +} + + +READ8_MEMBER( vc4000_state::vc4000_vsync_r ) +{ + return m_video.line >= VC4000_END_LINE ? 0x80 : 0; +} + +static const char led[20][12+1] = +{ + "aaaabbbbcccc", + "aaaabbbbcccc", + "aaaabbbbcccc", + "aaaabbbbcccc", + "llll dddd", + "llll dddd", + "llll dddd", + "llll dddd", + "kkkkmmmmeeee", + "kkkkmmmmeeee", + "kkkkmmmmeeee", + "kkkkmmmmeeee", + "jjjj ffff", + "jjjj ffff", + "jjjj ffff", + "jjjj ffff", + "iiiihhhhgggg", + "iiiihhhhgggg", + "iiiihhhhgggg", + "iiiihhhhgggg" +}; + + +void vc4000_state::vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line) +{ + static const int digit_to_segment[0x10]={ + 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff + }; + + int i=line,j; + + for (j=0; j>4)&7)^7; + } +} + +inline void vc4000_state::vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale) +{ + int i,j,m; + + for (j=0,m=0x80; j<8; j++, m>>=1) + { + if (data&m) + for (i=0; iy=This->data->y1; + This->state=0; + This->delay=0; + This->finished=FALSE; + } + + This->finished_now=FALSE; + + if (m_video.line>VC4000_END_LINE) return; + + switch (This->state) + { + case 0: + if (m_video.line != This->y + 2) break; + This->state++; + + case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:case 9:case 10: + + vc4000_collision_plot(collision+This->data->x1, This->data->bitmap[This->state-1],This->mask,This->size); + + for (j=0,m=0x80; j<8; j++, m>>=1) + { + if (This->data->bitmap[This->state-1]&m) + { + for (i=0; isize; i++) + { + m_objects[This->data->x1 + i + j*This->size] |= This->scolor; + m_objects[This->data->x1 + i + j*This->size] &= 7; + } + } + } + + This->delay++; + + if (This->delay>=This->size) + { + This->delay=0; + This->state++; + } + + if (This->state>10) + { + This->finished=TRUE; + This->finished_now=TRUE; + } + + break; + + case 11: + This->y=This->data->y2; + + if (This->y==255) + This->y=0; + else + This->y++; + + if (This->y>252) break; + + This->delay=0; + This->state++; + + case 12: + if (This->y!=0) + { + This->y--; + break; + } + This->state++; + + case 13: case 14: case 15: case 16: case 17: case 18: case 19:case 20:case 21:case 22: + + vc4000_collision_plot(collision+This->data->x2,This->data->bitmap[This->state-13],This->mask,This->size); + for (j=0,m=0x80; j<8; j++, m>>=1) + { + if (This->data->bitmap[This->state-13]&m) + { + for (i=0; isize; i++) + { + int offset = This->data->x2 + i + j*This->size; + + // clip objects outside the object buffer. + // someone who knows this hardware should look at + // it properly. + if (offset < 256) + { + m_objects[offset] |= This->scolor; + m_objects[offset] &= 7; + } + } + } + } + This->delay++; + if (This->delaysize) break; + This->delay=0; + This->state++; + if (This->state<23) break; + This->finished=TRUE; + This->finished_now=TRUE; + This->state=11; + break; + } +} + +inline void vc4000_state::vc4000_draw_grid(UINT8 *collision) +{ + int width = m_screen->width(); + int height = m_screen->height(); + int i, j, m, x, line=m_video.line-20; + int w, k; + + if (m_video.line>=height) return; + + m_bitmap->plot_box(0, m_video.line, width, 1, (m_video.reg.d.background)&7); + + if (line<0 || line>=200) return; + if (~m_video.reg.d.background & 8) return; + + i=(line/20)*2; + if (line%20>=2) i++; + + k=m_video.reg.d.grid_control[i>>2]; + switch (k>>6) { + default: + case 0:case 2: w=1;break; + case 1: w=2;break; + case 3: w=4;break; + } + switch (i&3) { + case 0: + if (k&1) w=8;break; + case 1: + if ((line%40)<=10) { + if (k&2) w=8; + } else { + if (k&4) w=8; + } + break; + case 2: if (k&8) w=8;break; + case 3: + if ((line%40)<=30) { + if (k&0x10) w=8; + } else { + if (k&0x20) w=8; + } + break; + } + for (x=30, j=0, m=0x80; j<16; j++, x+=8, m>>=1) + { + if (m_video.reg.d.grid[i][j>>3]&m) + { + int l; + for (l=0; lplot_box(x, m_video.line, w, 1, (m_video.reg.d.background>>4)&7); + } + if (j==7) m=0x100; + } +} + +INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) +{ + int x,y,i; + UINT8 collision[400]={0}; // better alloca or gcc feature of non constant long automatic arrays + const rectangle &visarea = m_screen->visible_area(); + assert(ARRAY_LENGTH(collision) >= m_screen->width()); + + m_video.line++; + if (m_irq_pause) m_irq_pause++; + if (m_video.line>311) m_video.line=0; + + if (m_video.line==0) + { + m_video.background_collision=0; + m_video.sprite_collision=0; + m_video.reg.d.sprite_collision=0; +// logerror("begin of frame\n"); + } + + if (m_irq_pause>10) + { + m_maincpu->set_input_line(0, CLEAR_LINE); + m_irq_pause = 0; + } + + if (m_video.line <= VC4000_END_LINE) + { + vc4000_draw_grid(collision); + + /* init object colours */ + for (i=visarea.min_x; ipix16(m_video.line, i) = m_objects[i]; + } + + y = m_video.reg.d.score_control&1?200:20; + + if ((m_video.line>=y)&&(m_video.line>4, m_video.line-y); + vc4000_draw_digit(*m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y); + if (m_video.reg.d.score_control&2) x -= 16; + vc4000_draw_digit(*m_bitmap, x+48, y, m_video.reg.d.bcd[1]>>4, m_video.line-y); + vc4000_draw_digit(*m_bitmap, x+64, y, m_video.reg.d.bcd[1]&0xf, m_video.line-y); + } + } + if (m_video.line==VC4000_END_LINE) m_video.reg.d.sprite_collision |=0x40; + + if (((m_video.line == VC4000_END_LINE) | + (m_video.sprites[3].finished_now) | + (m_video.sprites[2].finished_now) | + (m_video.sprites[1].finished_now) | + (m_video.sprites[0].finished_now)) && (!m_irq_pause)) + { + m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 3); + m_irq_pause=1; + } +} + +UINT32 vc4000_state::screen_update_vc4000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, *m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} diff --git a/src/mame/video/vector06.c b/src/mame/video/vector06.c new file mode 100644 index 00000000000..9ae05a221f9 --- /dev/null +++ b/src/mame/video/vector06.c @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + Vector06c driver by Miodrag Milanovic + + 10/07/2008 Preliminary driver. + +****************************************************************************/ + + +#include "includes/vector06.h" + + +void vector06_state::video_start() +{ +} + +UINT32 vector06_state::screen_update_vector06(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 code1,code2,code3,code4; + UINT8 col; + int y, x, b,draw_y; + UINT8 *ram = m_ram->pointer(); + + int width = (m_video_mode==0x00) ? 256 : 512; + rectangle screen_area(0,width+64-1,0,256+64-1); + // fill border color + bitmap.fill(m_color_index, screen_area); + + // draw image + for (x = 0; x < 32; x++) + { + for (y = 0; y < 256; y++) + { + // port A of 8255 also used as scroll + draw_y = ((255-y-m_keyboard_mask) & 0xff) +32; + code1 = ram[0x8000 + x*256 + y]; + code2 = ram[0xa000 + x*256 + y]; + code3 = ram[0xc000 + x*256 + y]; + code4 = ram[0xe000 + x*256 + y]; + for (b = 0; b < 8; b++) + { + col = ((code1 >> b) & 0x01) * 8 + ((code2 >> b) & 0x01) * 4 + ((code3 >> b) & 0x01)* 2+ ((code4 >> b) & 0x01); + if (m_video_mode==0x00) { + bitmap.pix16(draw_y, x*8+(7-b)+32) = col; + } else { + bitmap.pix16(draw_y, x*16+(7-b)*2+1+32) = ((code2 >> b) & 0x01) * 2; + bitmap.pix16(draw_y, x*16+(7-b)*2+32) = ((code3 >> b) & 0x01) * 2; + } + } + } + } + return 0; +} + +PALETTE_INIT_MEMBER(vector06_state, vector06) +{ + for (UINT8 i=0; i<16; i++) + m_palette->set_pen_color( i, rgb_t::black ); +} diff --git a/src/mame/video/vtech2.c b/src/mame/video/vtech2.c new file mode 100644 index 00000000000..dedbf31efc9 --- /dev/null +++ b/src/mame/video/vtech2.c @@ -0,0 +1,312 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller +/*************************************************************************** + vtech2.c + + video hardware + Juergen Buchmueller MESS driver, Jan 2000 + Davide Moretti ROM dump and hardware description + +****************************************************************************/ + +#include "emu.h" + +#include "includes/vtech2.h" + +#define BORDER_H 64 +#define BORDER_V 32 + +/* public */ + +/* + * when in text mode (bit 3 of I/O area = 0) + * bit 3 2 1 0 mode + * 0 x x 0 40 columns x 24 rows display RAM at bank 7 1F800-1FFFF + * 1 x x 0 40 columns x 24 rows display RAM at bank 3 0F800-0FFFF + * 0 x x 1 80 columns x 24 rows display RAM at bank 7 1F800-1FFFF + * 1 x x 1 80 columns x 24 rows display RAM at bank 3 0F800-0FFFF + * + * when in graphics mode (bit 3 of I/O area = 1) + * bit 3 2 1 0 mode + * 0 0 0 x GR5 bank 7 1C000-1FFFF + * 1 0 0 x GR5 bank 3 0C000-0FFFF + * 0 0 1 0 GR4 bank 7 1C000-1FFFF + * 1 0 1 0 GR4 bank 3 0C000-0FFFF + * 0 0 1 1 GR3 bank 7 1C000-1FFFF + * 1 0 1 1 GR3 bank 3 1C000-1FFFF + * 0 1 0 x GR0 bank 7 1E000-1FFFF + * 1 1 0 x GR0 bank 3 0E000-0FFFF + * 0 1 1 0 GR2 bank 7 1E000-1FFFF + * 1 1 1 0 GR2 bank 3 0E000-0FFFF + * 0 1 1 1 GR1 bank 7 1E000-1FFFF + * 1 1 1 1 GR1 bank 3 0E000-0FFFF + */ + +void vtech2_state::video_start() +{ +} + +static const int offs_2[192] = { + 0x0000,0x0800,0x1000,0x1800,0x2000,0x2800,0x3000,0x3800, + 0x0100,0x0900,0x1100,0x1900,0x2100,0x2900,0x3100,0x3900, + 0x0200,0x0a00,0x1200,0x1a00,0x2200,0x2a00,0x3200,0x3a00, + 0x0300,0x0b00,0x1300,0x1b00,0x2300,0x2b00,0x3300,0x3b00, + 0x0400,0x0c00,0x1400,0x1c00,0x2400,0x2c00,0x3400,0x3c00, + 0x0500,0x0d00,0x1500,0x1d00,0x2500,0x2d00,0x3500,0x3d00, + 0x0600,0x0e00,0x1600,0x1e00,0x2600,0x2e00,0x3600,0x3e00, + 0x0700,0x0f00,0x1700,0x1f00,0x2700,0x2f00,0x3700,0x3f00, + 0x0050,0x0850,0x1050,0x1850,0x2050,0x2850,0x3050,0x3850, + 0x0150,0x0950,0x1150,0x1950,0x2150,0x2950,0x3150,0x3950, + 0x0250,0x0a50,0x1250,0x1a50,0x2250,0x2a50,0x3250,0x3a50, + 0x0350,0x0b50,0x1350,0x1b50,0x2350,0x2b50,0x3350,0x3b50, + 0x0450,0x0c50,0x1450,0x1c50,0x2450,0x2c50,0x3450,0x3c50, + 0x0550,0x0d50,0x1550,0x1d50,0x2550,0x2d50,0x3550,0x3d50, + 0x0650,0x0e50,0x1650,0x1e50,0x2650,0x2e50,0x3650,0x3e50, + 0x0750,0x0f50,0x1750,0x1f50,0x2750,0x2f50,0x3750,0x3f50, + 0x00a0,0x08a0,0x10a0,0x18a0,0x20a0,0x28a0,0x30a0,0x38a0, + 0x01a0,0x09a0,0x11a0,0x19a0,0x21a0,0x29a0,0x31a0,0x39a0, + 0x02a0,0x0aa0,0x12a0,0x1aa0,0x22a0,0x2aa0,0x32a0,0x3aa0, + 0x03a0,0x0ba0,0x13a0,0x1ba0,0x23a0,0x2ba0,0x33a0,0x3ba0, + 0x04a0,0x0ca0,0x14a0,0x1ca0,0x24a0,0x2ca0,0x34a0,0x3ca0, + 0x05a0,0x0da0,0x15a0,0x1da0,0x25a0,0x2da0,0x35a0,0x3da0, + 0x06a0,0x0ea0,0x16a0,0x1ea0,0x26a0,0x2ea0,0x36a0,0x3ea0, + 0x07a0,0x0fa0,0x17a0,0x1fa0,0x27a0,0x2fa0,0x37a0,0x3fa0 +}; + +static const int offs_1[192] = { + 0x2000,0x2080,0x2800,0x2880,0x3000,0x3080,0x3800,0x3880, + 0x2100,0x2180,0x2900,0x2980,0x3100,0x3180,0x3900,0x3980, + 0x2200,0x2280,0x2a00,0x2a80,0x3200,0x3280,0x3a00,0x3a80, + 0x2300,0x2380,0x2b00,0x2b80,0x3300,0x3380,0x3b00,0x3b80, + 0x2400,0x2480,0x2c00,0x2c80,0x3400,0x3480,0x3c00,0x3c80, + 0x2500,0x2580,0x2d00,0x2d80,0x3500,0x3580,0x3d00,0x3d80, + 0x2600,0x2680,0x2e00,0x2e80,0x3600,0x3680,0x3e00,0x3e80, + 0x2700,0x2780,0x2f00,0x2f80,0x3700,0x3780,0x3f00,0x3f80, + 0x2028,0x20a8,0x2828,0x28a8,0x3028,0x30a8,0x3828,0x38a8, + 0x2128,0x21a8,0x2928,0x29a8,0x3128,0x31a8,0x3928,0x39a8, + 0x2228,0x22a8,0x2a28,0x2aa8,0x3228,0x32a8,0x3a28,0x3aa8, + 0x2328,0x23a8,0x2b28,0x2ba8,0x3328,0x33a8,0x3b28,0x3ba8, + 0x2428,0x24a8,0x2c28,0x2ca8,0x3428,0x34a8,0x3c28,0x3ca8, + 0x2528,0x25a8,0x2d28,0x2da8,0x3528,0x35a8,0x3d28,0x3da8, + 0x2628,0x26a8,0x2e28,0x2ea8,0x3628,0x36a8,0x3e28,0x3ea8, + 0x2728,0x27a8,0x2f28,0x2fa8,0x3728,0x37a8,0x3f28,0x3fa8, + 0x2050,0x20d0,0x2850,0x28d0,0x3050,0x30d0,0x3850,0x38d0, + 0x2150,0x21d0,0x2950,0x29d0,0x3150,0x31d0,0x3950,0x39d0, + 0x2250,0x22d0,0x2a50,0x2ad0,0x3250,0x32d0,0x3a50,0x3ad0, + 0x2350,0x23d0,0x2b50,0x2bd0,0x3350,0x33d0,0x3b50,0x3bd0, + 0x2450,0x24d0,0x2c50,0x2cd0,0x3450,0x34d0,0x3c50,0x3cd0, + 0x2550,0x25d0,0x2d50,0x2dd0,0x3550,0x35d0,0x3d50,0x3dd0, + 0x2650,0x26d0,0x2e50,0x2ed0,0x3650,0x36d0,0x3e50,0x3ed0, + 0x2750,0x27d0,0x2f50,0x2fd0,0x3750,0x37d0,0x3f50,0x3fd0 +}; + +static const int offs_0[96] = { + 0x2000,0x2800,0x3000,0x3800,0x2100,0x2900,0x3100,0x3900, + 0x2200,0x2a00,0x3200,0x3a00,0x2300,0x2b00,0x3300,0x3b00, + 0x2400,0x2c00,0x3400,0x3c00,0x2500,0x2d00,0x3500,0x3d00, + 0x2600,0x2e00,0x3600,0x3e00,0x2700,0x2f00,0x3700,0x3f00, + 0x2050,0x2850,0x3050,0x3850,0x2150,0x2950,0x3150,0x3950, + 0x2250,0x2a50,0x3250,0x3a50,0x2350,0x2b50,0x3350,0x3b50, + 0x2450,0x2c50,0x3450,0x3c50,0x2550,0x2d50,0x3550,0x3d50, + 0x2650,0x2e50,0x3650,0x3e50,0x2750,0x2f50,0x3750,0x3f50, + 0x20a0,0x28a0,0x30a0,0x38a0,0x21a0,0x29a0,0x31a0,0x39a0, + 0x22a0,0x2aa0,0x32a0,0x3aa0,0x23a0,0x2ba0,0x33a0,0x3ba0, + 0x24a0,0x2ca0,0x34a0,0x3ca0,0x25a0,0x2da0,0x35a0,0x3da0, + 0x26a0,0x2ea0,0x36a0,0x3ea0,0x27a0,0x2fa0,0x37a0,0x3fa0 +}; + +UINT32 vtech2_state::screen_update_laser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT8 *videoram = m_videoram; + int offs, x, y; + int full_refresh = 1; + + if( full_refresh ) + bitmap.fill(((m_laser_bg_mode >> 4) & 15)<<1, cliprect); + + if (m_laser_latch & 0x08) + { + /* graphics modes */ + switch (m_laser_bg_mode & 7) + { + case 0: + case 1: + /* + * GR 5 + * 640x192 1bpp + */ + for( y = 0; y < 192; y++ ) + { + offs = offs_2[y]; + for( x = 0; x < 80; x++, offs++ ) + { + int sx, sy, code, color = m_laser_two_color; + sy = BORDER_V/2 + y; + sx = BORDER_H/2 + x * 8; + code = videoram[offs]; + m_gfxdecode->gfx(2)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); + } + } + break; + + case 2: + /* + * GR 4 + * 320x192 1bpp with two colors per 8 pixels + */ + for( y = 0; y < 192; y++ ) + { + offs = offs_2[y]; + for( x = 0; x < 40; x++, offs += 2 ) + { + int sx, sy, code, color; + sy = BORDER_V/2 + y; + sx = BORDER_H/2 + x * 16; + code = videoram[offs]; + color = videoram[offs+1]; + m_gfxdecode->gfx(3)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); + } + } + break; + + case 3: + /* + * GR 3 + * 160x192 4bpp + */ + for( y = 0; y < 192; y++ ) + { + offs = offs_2[y]; + for( x = 0; x < 80; x++, offs++ ) + { + int sx, sy, code; + sy = BORDER_V/2 + y; + sx = BORDER_H/2 + x * 8; + code = videoram[offs]; + m_gfxdecode->gfx(5)->opaque(bitmap,cliprect,code,0,0,0,sx,sy); + } + } + break; + + case 4: + case 5: + /* + * GR 0 + * 160x96 4bpp + */ + for( y = 0; y < 96; y++ ) + { + offs = offs_0[y]; + for( x = 0; x < 80; x++, offs++ ) + { + int sx, sy, code; + sy = BORDER_V/2 + y * 2; + sx = BORDER_H/2 + x * 8; + code = videoram[offs]; + m_gfxdecode->gfx(6)->opaque(bitmap,cliprect,code,0,0,0,sx,sy); + } + } + break; + + case 6: + /* + * GR 2 + * 320x192 1bpp + */ + for( y = 0; y < 192; y++ ) + { + offs = offs_1[y]; + for( x = 0; x < 40; x++, offs++ ) + { + int sx, sy, code, color = m_laser_two_color; + sy = BORDER_V/2 + y; + sx = BORDER_H/2 + x * 16; + code = videoram[offs]; + m_gfxdecode->gfx(3)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); + } + } + break; + + case 7: + /* + * GR 1 + * 160x192 1bpp with two colors per 8 pixels + */ + for( y = 0; y < 192; y++ ) + { + offs = offs_1[y]; + for( x = 0; x < 20; x++, offs += 2 ) + { + int sx, sy, code, color; + sy = BORDER_V/2 + y; + sx = BORDER_H/2 + x * 32; + code = videoram[offs]; + color = videoram[offs+1]; + m_gfxdecode->gfx(4)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); + } + } + break; + } + } + else + { + /* text modes */ + if (m_laser_bg_mode & 1) + { + /* 80 columns text mode */ + for( y = 0; y < 24; y++ ) + { + offs = ((y & 7) << 8) + ((y >> 3) * 80); + for( x = 0; x < 80; x++, offs++ ) + { + int sx, sy, code, color = m_laser_two_color; + sy = BORDER_V/2 + y * 8; + sx = BORDER_H/2 + x * 8; + code = videoram[0x3800+offs]; + m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); + } + } + } + else + { + /* 40 columns text mode */ + for( y = 0; y < 24; y++ ) + { + offs = ((y & 7) << 8) + ((y >> 3) * 80); + for( x = 0; x < 40; x++, offs += 2 ) + { + int sx, sy, code, color = 0; + sy = BORDER_V/2 + y * 8; + sx = BORDER_H/2 + x * 16; + code = videoram[0x3800+offs]; + color = videoram[0x3801+offs]; + m_gfxdecode->gfx(1)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); + } + } + } + } + + if( m_laser_frame_time > 0 ) + { + popmessage("%s", m_laser_frame_message); + } + return 0; +} + +WRITE8_MEMBER(vtech2_state::laser_bg_mode_w) +{ + if (m_laser_bg_mode != data) + { + m_laser_bg_mode = data; + logerror("laser border:$%X mode:$%X\n", data >> 4, data & 15); + } +} + +WRITE8_MEMBER(vtech2_state::laser_two_color_w) +{ + if (m_laser_two_color != data) + { + m_laser_two_color = data; + logerror("laser foreground:$%X background:$%X\n", data >> 4, data & 15); + } +} diff --git a/src/mame/video/vtvideo.c b/src/mame/video/vtvideo.c new file mode 100644 index 00000000000..5170143d749 --- /dev/null +++ b/src/mame/video/vtvideo.c @@ -0,0 +1,956 @@ +// license:GPL-2.0+ +// copyright-holders:Miodrag Milanovic,Karl-Ludwig Deisenhofer +/********************************************************************** +DEC VT Terminal video emulation +[ DC012 and DC011 emulation ] + +01/05/2009 Initial implementation [Miodrag Milanovic] +Enhancements (2013 - 2015) by Karl-Ludwig Deisenhofer. + +DEC VIDEO : STATE AS OF JULY 2014 +--------------------------------- +Code developed with Rainbow-100 hardware in mind (a PC-like machine with a video circuit similar to a VT100 equipped w. AVO) +Details (termination characters, option hardware, MHFU watchdog) differ when compared to VT. + +As of July 2014, the Rainbow video section is more mature than the 'VT100_VIDEO' part (essentially unchanged since 2009). +List of features not yet ported to VT: line doubler; 48 line mode; soft scroll; intensity / palette, AVO (ext.attributes) + +FIXME: work out the differences and identify common code between VT and Rainbow. Unify different code trees. + +- REQUIRED TODOS / TESTS : + * do line and character attributes (plus combinations) match real hardware? + * how does the AVO fit in? + +- SCROLLING REGIONS / SPLIT SCREEN SCROLLING UNTESTED (if you open > 1 file with the VAX editor EDT) + See VT100 Technical Manual: 4.7.4 Address Shuffling to 4.7.9 Split Screen Smooth Scrolling. + More on scrolling regions: Rainbow 100 B technical documentation (QV069-GZ) April 1985 page 22 + +- NEW - INTERLACED MODE (Rainbow only): + Vertical resolution increases from 240 to 480, while the refresh rate halves (flickers on CRTs). + To accomplish this, the display controller repeats even lines in odd scans. + VTVIDEO activates line doubling in 24 line, interlaced mode only. + + Although the DC12 has the ability to display 48 lines, most units are low on screen RAM and + won't even show 80 x 48. -> REASON: (83 x 48 = 3984 Byte) > (screen RAM) minus 'scratch area' + On a VT-180, BIOS scratch requires up to 700 bytes used for SETUP, flags, SILO, keyboard. + +- POSSIBLE IMPROVEMENTS: + +* exact colors for different VR201 monitors (for white, green and amber) + +* ACCURATE VIDEO DELAYS: + Position of the first visible scanline (relative to the vertical reset) depends on + content of fill bytes at the beginning of screen RAM. + + Six invisible, linked lines are initially provided (at location $EE000+ on a Rainbow). + Real-world DC hardware parses the (circular) chain until interrupted by blanking. + BIOS assumes 2 lines are omitted @ 60 and 5 lines are at 50 Hertz (-> longer blank). + + VTVIDEO keeps it simple and skips up to 6 lines considered 'illegal' (offset < $12). + Works even in cases where undocumented delays or lines are poked (SQUINT; VIDEO.PAS). + + Accurate timings for 4 modes (from VT-180 manual 6-30 on): + Vertical frequency = (2 * HF = 31.468 Khz) / DIVIDER + - 50 NI: (2 * HF = 31.468 Khz) / 630 + - 50 interlaced: (2 * HF = 31.468 Khz) / 629 + - 60 NI: (2 * HF = 31.468 Khz) / 524 + - 60 interlaced: (2 * HF = 31.468 Khz) / 525 +**********************************************************************/ + +#include "emu.h" +#include "video/vtvideo.h" + +/*************************************************************************** +PARAMETERS +***************************************************************************/ + +#define VERBOSE 1 + +#define LOG(x) do { if (VERBOSE) logerror x; } while (0) + + +const device_type VT100_VIDEO = &device_creator; +const device_type RAINBOW_VIDEO = &device_creator; + + +vt100_video_device::vt100_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) +: device_t(mconfig, type, name, tag, owner, clock, shortname, source), +device_video_interface(mconfig, *this), +m_read_ram(*this), +m_write_clear_video_interrupt(*this), +m_char_rom_tag(""), +m_palette(*this, "palette") +{ +} + + +vt100_video_device::vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +: device_t(mconfig, VT100_VIDEO, "VT100 Video", tag, owner, clock, "vt100_video", __FILE__), +device_video_interface(mconfig, *this), +m_read_ram(*this), +m_write_clear_video_interrupt(*this), +m_char_rom_tag(""), +m_palette(*this, "palette") +{ +} + + +rainbow_video_device::rainbow_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +: vt100_video_device(mconfig, RAINBOW_VIDEO, "Rainbow Video", tag, owner, clock, "rainbow_video", __FILE__) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vt100_video_device::device_start() +{ + /* resolve callbacks */ + m_read_ram.resolve_safe(0); + m_write_clear_video_interrupt.resolve_safe(); + + m_gfx = machine().root_device().memregion(m_char_rom_tag)->base(); + assert(m_gfx != NULL); + + // LBA7 is scan line frequency update + machine().scheduler().timer_pulse(attotime::from_nsec(31778), timer_expired_delegate(FUNC(vt100_video_device::lba7_change), this)); + + save_item(NAME(m_lba7)); + save_item(NAME(m_scroll_latch)); + save_item(NAME(m_blink_flip_flop)); + save_item(NAME(m_reverse_field)); + save_item(NAME(m_basic_attribute)); + save_item(NAME(m_columns)); + save_item(NAME(m_height)); + save_item(NAME(m_height_MAX)); + save_item(NAME(m_fill_lines)); + save_item(NAME(m_frequency)); + save_item(NAME(m_interlaced)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void vt100_video_device::device_reset() +{ + m_palette->set_pen_color(0, 0x00, 0x00, 0x00); // black + m_palette->set_pen_color(1, 0xff, 0xff, 0xff); // white + + m_height = 25; + m_height_MAX = 25; + + m_lba7 = 0; + + m_scroll_latch = 0; + m_scroll_latch_valid = false; + m_last_scroll = 0; + + m_blink_flip_flop = 0; + m_reverse_field = 0; + m_basic_attribute = 0; + + m_columns = 80; + m_frequency = 60; + + m_interlaced = 1; + m_fill_lines = 2; // for 60Hz + recompute_parameters(); +} + +// ****** RAINBOW ****** +// 4 color (= monochrome intensities) palette, 24 and 48 line modes. +void rainbow_video_device::device_reset() +{ + MHFU_FLAG = false; + MHFU_counter = 0; // **** MHFU: OFF ON COLD BOOT ! **** + + // (rest of the palette is set in the main program) + m_palette->set_pen_color(0, 0x00, 0x00, 0x00); // black + + m_height = 24; // <---- DEC-100 + m_height_MAX = 48; + + m_lba7 = 0; + + m_scroll_latch = 0; + m_scroll_latch_valid = false; + m_last_scroll = 0; + + m_blink_flip_flop = 0; + m_reverse_field = 0; + m_basic_attribute = 0; + + m_columns = 80; + + m_frequency = 60; + + m_interlaced = 1; + m_fill_lines = 2; // for 60Hz (not in use any longer -> detected) + recompute_parameters(); +} + +/*************************************************************************** +IMPLEMENTATION +***************************************************************************/ + +// Also used by Rainbow-100 ************ +void vt100_video_device::recompute_parameters() +{ + rectangle visarea; + int horiz_pix_total = 0; + + // RAINBOW: 240 scan lines in non-interlaced mode (480 interlaced). VT-100 : same (?) + m_linedoubler = false; // 24 "true" lines (240) -OR- 48 lines with NO ghost lines (true 480) + if ((m_interlaced) && (m_height == 24)) + m_linedoubler = true; // 24 lines with 'double scan' (false 480) + + int vert_pix_total = ((m_linedoubler == false) ? m_height : m_height_MAX) * 10; + + if (m_columns == 132) + horiz_pix_total = m_columns * 9; // display 1 less filler pixel in 132 char. mode + else + horiz_pix_total = m_columns * 10; // normal 80 character mode. + + visarea.set(0, horiz_pix_total - 1, 0, vert_pix_total - 1); + machine().first_screen()->configure(horiz_pix_total, vert_pix_total, visarea, HZ_TO_ATTOSECONDS((m_interlaced == 0) ? m_frequency : (m_frequency/2) )); + + if (VERBOSE) + { + printf("\n(RECOMPUTE) HPIX: %d - VPIX: %d", horiz_pix_total, vert_pix_total); + printf("\n(RECOMPUTE) FREQUENCY: %d", (m_interlaced == 0) ? m_frequency : (m_frequency / 2)); + if (m_interlaced) + printf("\n(RECOMPUTE) * INTERLACED *"); + if (m_linedoubler) + printf("\n(RECOMPUTE) * LINEDOUBLER *"); + } +} + + +READ8_MEMBER(vt100_video_device::lba7_r) +{ + return m_lba7; +} + + +// Also used by Rainbow-100 ************ +WRITE8_MEMBER(vt100_video_device::dc012_w) +{ + // Writes to [10C] and [0C] are treated differently + // - see 3.1.3.9.5 DC012 Programming Information (PC-100 spec) + + // MHFU is disabled by writing 00 to port 010C. + + // Code recognition is abysmal - sorry for that. + if (data == 0) + { + UINT8 *rom = machine().root_device().memregion("maincpu")->base(); + if (rom != NULL) + { + UINT32 PC = space.device().safe_pc(); + if ((rom[ PC - 1] == 0xe6) && + (rom[ PC ] == 0x0c) + ) + { + // OUT 0C,al < DO NOTHING > + } + else + { + //UINT8 magic1= rom[PC - 1]; + //printf("\n PC %05x - MHFU MAGIC -1 %02x\n", PC, magic1); + //UINT8 magic2 = rom[PC - 2]; + //printf("\n PC %05x - MHFU MAGIC -2 %02x\n", PC, magic2); + //if (VERBOSE) + + //if(1 ) + if ((rom[PC - 2] == 0x0C) && + (rom[PC - 1] == 0x01) + ) + { + if (MHFU_FLAG == true) + printf("MHFU *** DISABLED *** %05x \n", PC); + + MHFU_FLAG = false; + MHFU_counter = 0; + } + } + + } // DATA == 0 ONLY .... + + } + else + { + //if (VERBOSE) + if (MHFU_FLAG == false) + printf("MHFU ___ENABLED___ %05x \n", space.device().safe_pc()); + + // RESET + MHFU_FLAG = true; + MHFU_counter = 0; + } + + if (!(data & 0x08)) + { + if (!(data & 0x04)) + { + m_scroll_latch_valid = false; // LSB is written first. + // set lower part scroll + m_scroll_latch = data & 0x03; + } + else + { + // set higher part scroll + m_scroll_latch = (m_scroll_latch & 0x03) | ((data & 0x03) << 2); + m_scroll_latch_valid = true; + } + } + else + { + switch (data & 0x0f) + { + case 0x08: + // toggle blink flip flop + m_blink_flip_flop = !(m_blink_flip_flop) ? 1 : 0; + break; + case 0x09: + // clear vertical frequency interrupt; + m_write_clear_video_interrupt(0); + break; + case 0x0a: + // set reverse field on + m_reverse_field = 1; + break; + case 0x0b: + // set reverse field off + m_reverse_field = 0; + break; + + // Writing a 11XX bit combination clears the blink-flip flop (valid for 0x0C - 0x0F): + case 0x0c: + // set basic attribute to underline / blink flip-flop off + m_blink_flip_flop = 0; + m_basic_attribute = 0; // (VT-100 without AVO): reverse video is interpreted as underline (basic_attribute 0) + break; + + case 0x0d: + // (DEC Rainbow 100 DEFAULT) : reverse video with 24 lines / blink flip-flop off + m_blink_flip_flop = 0; + m_basic_attribute = 1; // (VT-100 without AVO): reverse video is interpreted as reverse (basic_attribute 1) + + if (m_height_MAX == 25) break; // Abort on VT-100 for now. + + m_height = 24; // (DEC Rainbow 100) : 24 line display + recompute_parameters(); + break; + + case 0x0e: + m_blink_flip_flop = 0; // 'unsupported' DC012 command. Turns blink flip-flop off (11XX). + break; + + case 0x0f: + // (DEC Rainbow 100): reverse video with 48 lines / blink flip-flop off + m_blink_flip_flop = 0; + m_basic_attribute = 1; + + // 0x0f = 'reserved' on VT 100 + // Abort on VT-100 for now. + if (m_height_MAX == 25) break; + + m_height = 48; // (DEC Rainbow 100) : 48 line display + recompute_parameters(); + break; + } + } +} + +// Writing to DC011 resets internal counters (& disturbs display) on real hardware. +WRITE8_MEMBER(vt100_video_device::dc011_w) +{ + if (!BIT(data, 5)) + { + m_interlaced = 1; + + if (!BIT(data, 4)) + m_columns = 80; + else + m_columns = 132; + } + else + { + m_interlaced = 0; + + if (!BIT(data, 4)) + { + m_frequency = 60; + m_fill_lines = 2; + } + else + { + m_frequency = 50; + m_fill_lines = 5; + } + } + + recompute_parameters(); +} + +WRITE8_MEMBER(vt100_video_device::brightness_w) +{ + //m_palette->set_pen_color(1, data, data, data); +} + + + +void vt100_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type) +{ + UINT8 line = 0; + int bit = 0, prevbit, invert = 0, j; + int double_width = (display_type == 2) ? 1 : 0; + + for (int i = 0; i < 10; i++) + { + switch (display_type) + { + case 0: // bottom half, double height + j = (i >> 1) + 5; break; + case 1: // top half, double height + j = (i >> 1); break; + case 2: // double width + case 3: // normal + j = i; break; + default: j = 0; break; + } + // modify line since that is how it is stored in rom + if (j == 0) j = 15; else j = j - 1; + + line = m_gfx[(code & 0x7f) * 16 + j]; + + if (m_basic_attribute == 1) + { + if ((code & 0x80) == 0x80) + invert = 1; + else + invert = 0; + } + + for (int b = 0; b < 8; b++) + { + prevbit = bit; + bit = BIT((line << b), 7); + if (double_width) + { + bitmap.pix16(y * 10 + i, x * 20 + b * 2) = (bit | prevbit) ^ invert; + bitmap.pix16(y * 10 + i, x * 20 + b * 2 + 1) = bit ^ invert; + } + else + { + bitmap.pix16(y * 10 + i, x * 10 + b) = (bit | prevbit) ^ invert; + } + } + prevbit = bit; + // char interleave is filled with last bit + if (double_width) + { + bitmap.pix16(y * 10 + i, x * 20 + 16) = (bit | prevbit) ^ invert; + bitmap.pix16(y * 10 + i, x * 20 + 17) = bit ^ invert; + bitmap.pix16(y * 10 + i, x * 20 + 18) = bit ^ invert; + bitmap.pix16(y * 10 + i, x * 20 + 19) = bit ^ invert; + } + else + { + bitmap.pix16(y * 10 + i, x * 10 + 8) = (bit | prevbit) ^ invert; + bitmap.pix16(y * 10 + i, x * 10 + 9) = bit ^ invert; + } + } +} + +void vt100_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 addr = 0; + int line = 0; + int xpos = 0; + int ypos = 0; + UINT8 code; + int x = 0; + UINT8 scroll_region = 1; // binary 1 + UINT8 display_type = 3; // binary 11 + UINT16 temp = 0; + + if (m_read_ram(0) != 0x7f) + return; + + while (line < (m_height + m_fill_lines)) + { + code = m_read_ram(addr + xpos); + if (code == 0x7f) + { + // end of line, fill empty till end of line + if (line >= m_fill_lines) + { + for (x = xpos; x < ((display_type == 2) ? (m_columns / 2) : m_columns); x++) + { + display_char(bitmap, code, x, ypos, scroll_region, display_type); + } + } + // move to new data + temp = m_read_ram(addr + xpos + 1) * 256 + m_read_ram(addr + xpos + 2); + addr = (temp)& 0x1fff; + // if A12 is 1 then it is 0x2000 block, if 0 then 0x4000 (AVO) + if (addr & 0x1000) addr &= 0xfff; else addr |= 0x2000; + scroll_region = (temp >> 15) & 1; + display_type = (temp >> 13) & 3; + if (line >= m_fill_lines) + { + ypos++; + } + xpos = 0; + line++; + } + else + { + // display regular char + if (line >= m_fill_lines) + { + display_char(bitmap, code, xpos, ypos, scroll_region, display_type); + } + xpos++; + if (xpos > m_columns) + { + line++; + xpos = 0; + } + } + } + +} + +// ****** RAINBOW ****** +// Display 10 scan lines (or 20 in interlaced mode) for one character @ position X/Y +// NOTE: X or Y indicate a character position! + +// 5 possible CHARACTER STATES (normal, reverse, bold, blink, underline) are encoded into display_type. +// From the VT-180 specs, chapter 6-43 (where multiple attributes are described): +// 1) reverse characters [ XOR of reverse video and reverse screen (A) ] normally have dim backgrounds with black characters (B) +// 2) bold and reverse together give a background of normal intensity + +// 3) blink controls intensity: normal chars vary between A) normal and dim (B) bold chars vary between bright and normal +// 4) blink applied to a +// A) reverse character causes it to alternate between normal and reverse video representation +// B) non-rev. " : alternate between usual intensity and the next lower intensity +// 5) underline causes the 9.th scan to be forced to +// A) white of the same intensity as the characters (for nonreversed characters), +// b) to black (for reverse characters) +// LINE ATTRIBUTE 'double_height' always is interpreted as 'double width + double height' + +// ATTRIBUTES: No attributes = 0x0E +// 1 = display char. in REVERSE (encoded as 8 in display_type) HIGH ACTIVE +// 0 = display char. in BOLD (encoded as 16 in display_type) LOW ACTIVE +// 0 = display char. w. BLINK (encoded as 32 in display_type) LOW ACTIVE +// 0 = display char. w. UNDERLINE (encoded as 64 in display_type) LOW ACTIVE +void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type) +{ + UINT16 x_preset = x << 3; // x_preset = x * 9 (= 132 column mode) + x_preset += x; + + if (m_columns == 80) + x_preset += x; // x_preset = x * 10 (80 column mode) + + UINT16 y_preset; + + UINT16 CHARPOS_y_preset = y << 3; // CHARPOS_y_preset = y * 10; + CHARPOS_y_preset += y; + CHARPOS_y_preset += y; + + UINT16 DOUBLE_x_preset = x_preset << 1; // 18 for 132 column mode, else 20 (x_preset * 2) + + UINT8 line = 0; + int bit = 0, j = 0; + int fg_intensity; + int back_intensity, back_default_intensity; + + int invert = (display_type & 8) ? 1 : 0; // REVERSE + int bold = (display_type & 16) ? 0 : 1; // BIT 4 + int blink = (display_type & 32) ? 0 : 1; // BIT 5 + int underline = (display_type & 64) ? 0 : 1; // BIT 6 + bool blank = (display_type & 128) ? true : false; // BIT 7 + + display_type = display_type & 3; + + // * SCREEN ATTRIBUTES (see VT-180 manual 6-30) * + // 'reverse field' = reverse video over entire screen + + // For reference: a complete truth table can be taken from TABLE 4-6-4 / VT100 technical manual. + // Following IF statements implement it in full. Code segments should not be shuffled. + invert = invert ^ m_reverse_field ^ m_basic_attribute; + + fg_intensity = bold + 2; // FOREGROUND (FG): normal (2) or bright (3) + + back_intensity = 0; // DO NOT SHUFFLE CODE AROUND !! + if ((blink != 0) && (m_blink_flip_flop != 0)) + fg_intensity -= 1; // normal => dim bright => normal (when bold) + + // INVERSION: background gets foreground intensity (reduced by 1). + // _RELIES ON_ on_ previous evaluation of the BLINK signal (fg_intensity). + if (invert != 0) + { + back_intensity = fg_intensity - 1; // BG: normal => dim; dim => OFF; bright => normal + + if (back_intensity != 0) // FG: avoid 'black on black' + fg_intensity = 0; + else + fg_intensity = fg_intensity + 1; // FG: dim => normal; normal => bright + } + + // BG: DEFAULT for entire character (underline overrides this for 1 line) - + back_default_intensity = back_intensity; + + bool double_width = (display_type != 3) ? true : false; // all except normal: double width + bool double_height = (display_type & 1) ? false : true; // 0,2 = double height + + int smooth_offset = 0; + if (scroll_region != 0) + smooth_offset = m_last_scroll; // valid after VBI + + int i = 0; + int extra_scan_line = 0; + for (int scan_line = 0; scan_line < (m_linedoubler ? 20 : 10); scan_line++) + { + y_preset = CHARPOS_y_preset + scan_line; + + // 'i' points to char-rom (plus scroll offset; if active) - + // IF INTERLACED: odd lines = even lines + i = (m_linedoubler ? (scan_line >> 1) : scan_line) + smooth_offset; + + if (i > 9) // handle everything in one loop (in case of smooth scroll): + { + extra_scan_line += 1; + + // Fetch appropriate character bitmap (one scan line) - + // IF INTERLACED: no odd lines + i = smooth_offset - (m_linedoubler ? (extra_scan_line >> 1) : extra_scan_line); + + if (CHARPOS_y_preset >= extra_scan_line) // If result not negative... + y_preset = CHARPOS_y_preset - extra_scan_line; // correct Y pos. + else + { + y_preset = (m_linedoubler ? 480 : 240) - extra_scan_line; + i = 0; // blank line. Might not work with TCS or other charsets (FIXME) + } + } + + switch (display_type) + { + case 0: // bottom half of 'double height, double width' char. + j = (i >> 1) + 5; + break; + + case 2: // top half of 'double height, double width' char. + j = (i >> 1); + break; + + default: // 1: double width + // 3: normal + j = i; + break; + } + + // modify line since that is how it is stored in rom + if (j == 0) j = 15; else j = j - 1; + + line = m_gfx[(code << 4) + j]; // code * 16 + + // UNDERLINED CHARACTERS (CASE 5 - different in 1 line): + back_intensity = back_default_intensity; // 0, 1, 2 + if (underline != 0) + { + if (i == 8) + { + if (invert == 0) + line = 0xff; // CASE 5 A) + else + { + line = 0x00; // CASE 5 B) + back_intensity = 0; // OVERRIDE: BLACK BACKGROUND + } + } + } + + for (int b = 0; b < 8; b++) // 0..7 + { + if (blank) + { + bit = m_reverse_field ^ m_basic_attribute; + } + else + { + bit = BIT((line << b), 7); + + if (bit > 0) + bit = fg_intensity; + else + bit = back_intensity; + } + + // Double, 'double_height + double_width', then normal. + if (double_width) + { + bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; + bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1)) = bit; + + if (double_height) + { + bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; + bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1)) = bit; + } + } + else + { + bitmap.pix16(y_preset, x_preset + b) = bit; + } + } // for (8 bit) + + // char interleave (X) is filled with last bit + if (double_width) + { + // double chars: 18 or 20 bits + bitmap.pix16(y_preset, DOUBLE_x_preset + 16) = bit; + bitmap.pix16(y_preset, DOUBLE_x_preset + 17) = bit; + + if (m_columns == 80) + { + bitmap.pix16(y_preset, DOUBLE_x_preset + 18) = bit; + bitmap.pix16(y_preset, DOUBLE_x_preset + 19) = bit; + } + } + else + { // normal chars: 9 or 10 bits + bitmap.pix16(y_preset, x_preset + 8) = bit; + + if (m_columns == 80) + bitmap.pix16(y_preset, x_preset + 9) = bit; + } + } // for (scan_line) + +} + +// ****** RAINBOW ****** +void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 addr = 0; + UINT16 attr_addr = 0; + int line = 0; + int xpos = 0; + int ypos = 0; + UINT8 code; + int x = 0; + UINT8 scroll_region = 0; // DEFAULT TO 0 = NOT PART OF scroll_region + UINT8 display_type = 3; // NORMAL DISPLAY - binary 11 + UINT16 temp = 0; + + if (m_read_ram(0) != 0xff) // video uninitialized? + return; + + // Skip fill (0xFF) lines and put result in ADDR. + for (int xp = 1; xp <= 6; xp += 1) // beware of circular references + { + // Fetch LINE ATTRIBUTE before it is gone + attr_addr = 0x1000 | ((addr + 1) & 0x0fff); + + temp = m_read_ram(addr + 2) * 256 + m_read_ram(addr + 1); + addr = (temp)& 0x0fff; + + temp = m_read_ram(attr_addr); + scroll_region = (temp)& 1; + display_type = (temp >> 1) & 3; + + if (addr >= 0x12) + break; + } + + int vert_charlines_MAX = ((m_linedoubler == false) ? m_height : m_height_MAX); + while (line < vert_charlines_MAX ) + { + code = m_read_ram(addr + xpos); + + if (code == 0x00) // TODO: investigate side effect on regular zero character! + display_type |= 0x80; // DEFAULT: filler chars (till end of line) and empty lines (00) will be blanked + else + display_type &= 0x7f; // else activate display. + + if (code == 0xff) // end of line, fill empty till end of line + { + // HINT: display_type is already shifted! All except 3 is DOUBLE WIDTH 40 or 66 chars per line + for (x = xpos; x < ((display_type != 3) ? (m_columns / 2) : m_columns); x++) + { + display_char(bitmap, code, x, ypos, scroll_region, display_type | 0x80); + } + + // LINE ATTRIBUTE - valid for all chars on next line ** DO NOT SHUFFLE ** + attr_addr = 0x1000 | ((addr + xpos + 1) & 0x0fff); + + // MOVE TO NEW DATA + temp = m_read_ram(addr + xpos + 2) * 256 + m_read_ram(addr + xpos + 1); + addr = (temp)& 0x0fff; + + temp = m_read_ram(attr_addr); + scroll_region = (temp)& 1; + display_type = (temp >> 1) & 3; + + ypos++; // Y + 1 in non-interlaced mode + if (m_linedoubler) + ypos++; // Y + 2 in 'double scan' mode (see -> 'display_char') + + if (ypos > vert_charlines_MAX) // prevent invalid Y pos. + break; + + xpos = 0; + line++; + } + else + { + attr_addr = 0x1000 | ((addr + xpos) & 0x0fff); + temp = (m_read_ram(attr_addr) & 15) << 3; // get character attributes + + // see 'display_char' for an explanation of attribute encoding - + display_char(bitmap, code, xpos, ypos, scroll_region, display_type | temp); + + xpos++; + if (xpos > m_columns) + { + xpos = 0; + line++; + } + } // (else) valid char + + } // while + +} + +void rainbow_video_device::notify_vblank(bool v) +{ + static bool v_last; + m_notify_vblank = v; + + if (m_scroll_latch_valid) + { + // Line linking / unlinking is done during VBI (see 4.7.4 and up in VT manual). + if ((v == false) && (v_last == true)) + m_last_scroll = m_scroll_latch; + } + + v_last = v; +} + +void rainbow_video_device::palette_select(int choice) +{ + switch (choice) + { + default: + case 0x01: + m_palette->set_pen_color(1, 0xff - 100, 0xff - 100, 0xff - 100); // WHITE (dim) + m_palette->set_pen_color(2, 0xff - 50, 0xff - 50, 0xff - 50); // WHITE NORMAL + m_palette->set_pen_color(3, 0xff, 0xff, 0xff); // WHITE (brighter) + break; + + case 0x02: + m_palette->set_pen_color(1, 35, 200 - 55, 75); // GREEN (dim) + m_palette->set_pen_color(2, 35 + 55, 200, 75 + 55); // GREEN (NORMAL) + m_palette->set_pen_color(3, 35 + 110, 200 + 55, 75 + 110); // GREEN (brighter) + break; + + case 0x03: + m_palette->set_pen_color(1, 213 - 47, 146 - 47, 82 - 47); // AMBER (dim) + m_palette->set_pen_color(2, 213, 146, 82); // AMBER (NORMAL) + m_palette->set_pen_color(3, 255, 193, 129); // AMBER (brighter) + break; + } +} + +// ****** RAINBOW ****** +void rainbow_video_device::video_blanking(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // 'In reverse screen mode, termination forces the beam to the screen background intensity' + // Background intensity means 'dim' (1) according to one source. + bitmap.fill(((m_reverse_field ^ m_basic_attribute) ? 1 : 0), cliprect); +} + + + +int rainbow_video_device::MHFU(int ASK) +{ + switch (ASK) + { + case 1: // "true": RETURN BOOLEAN (MHFU disabled or enabled?) + return MHFU_FLAG; + + case -1: // -1: increment IF ENABLED, return counter value (=> Rainbow.c) + if (MHFU_FLAG == true) + MHFU_counter++; + return MHFU_counter; + + case -100: // -100 : RESET and ENABLE MHFU counter + MHFU_counter = 0; + if(1) //if (VERBOSE) + printf("-100 MHFU * reset and ENABLE * \n"); + + if(1) // if (VERBOSE) + { + if (MHFU_FLAG == false) + printf("-100 MHFU ___ENABLED___\n"); + } + MHFU_FLAG = true; + + return -100; + + case -200: // -200 : RESET and DISABLE MHFU + MHFU_counter = 0; + + if(1) //if (VERBOSE) + { + if (MHFU_FLAG == true) + printf("MHFU *** DISABLED *** \n"); + } + MHFU_FLAG = false; + + return -200; + + default: + assert(1); + return -255; + } // switch +} + +TIMER_CALLBACK_MEMBER(vt100_video_device::lba7_change) +{ + m_lba7 = (m_lba7) ? 0 : 1; +} + +static MACHINE_CONFIG_FRAGMENT(vt100_video) +MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor vt100_video_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(vt100_video); +} + +static MACHINE_CONFIG_FRAGMENT(rainbow_video) +MCFG_PALETTE_ADD("palette", 4) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor rainbow_video_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(rainbow_video); +} diff --git a/src/mame/video/vtvideo.h b/src/mame/video/vtvideo.h new file mode 100644 index 00000000000..49dbcfef7cd --- /dev/null +++ b/src/mame/video/vtvideo.h @@ -0,0 +1,113 @@ +// license:GPL-2.0+ +// copyright-holders:Miodrag Milanovic,Karl-Ludwig Deisenhofer +/********************************************************************** + +DEC VT Terminal video emulation +[ DC012 and DC011 emulation ] + +01/05/2009 Initial implementation [Miodrag Milanovic] + +**********************************************************************/ + +#ifndef __VT_VIDEO__ +#define __VT_VIDEO__ + +#include "emu.h" + +class vt100_video_device : public device_t, + public device_video_interface +{ +public: + vt100_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vt100_video_device() {} + + template static devcb_base &set_ram_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_ram.set_callback(object); } + template static devcb_base &set_clear_video_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clear_video_interrupt.set_callback(object); } + + static void set_chargen_tag(device_t &device, const char *tag) { downcast(device).m_char_rom_tag = tag; } + + DECLARE_READ8_MEMBER(lba7_r); + DECLARE_WRITE8_MEMBER(dc012_w); + DECLARE_WRITE8_MEMBER(dc011_w); + DECLARE_WRITE8_MEMBER(brightness_w); + + virtual void video_update(bitmap_ind16 &bitmap, const rectangle &cliprect); +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; + + // internal state + void recompute_parameters(); + virtual void display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type); + TIMER_CALLBACK_MEMBER(lba7_change); + + devcb_read8 m_read_ram; + devcb_write8 m_write_clear_video_interrupt; + + UINT8 *m_gfx; /* content of char rom */ + + int m_lba7; + + bool MHFU_FLAG; + int MHFU_counter; + + // dc012 attributes + UINT8 m_scroll_latch; + bool m_scroll_latch_valid; + UINT8 m_blink_flip_flop; + UINT8 m_reverse_field; + UINT8 m_basic_attribute; + // dc011 attributes + UINT8 m_columns; + UINT8 m_height; + UINT8 m_height_MAX; + UINT8 m_fill_lines; + UINT8 m_frequency; + UINT8 m_interlaced; + + const char *m_char_rom_tag; /* character rom region */ + required_device m_palette; + + bool m_notify_vblank; + int m_last_scroll; + + bool m_linedoubler; +}; + + +class rainbow_video_device : public vt100_video_device +{ +public: + rainbow_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void video_update(bitmap_ind16 &bitmap, const rectangle &cliprect); + virtual void video_blanking(bitmap_ind16 &bitmap, const rectangle &cliprect); + + int MHFU(int); + void palette_select(int choice); + void notify_vblank(bool choice); +protected: + virtual void display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; +}; + +extern const device_type VT100_VIDEO; +extern const device_type RAINBOW_VIDEO; + + +#define MCFG_VT_SET_SCREEN MCFG_VIDEO_SET_SCREEN + +#define MCFG_VT_CHARGEN(_tag) \ + vt100_video_device::set_chargen_tag(*device, _tag); + +#define MCFG_VT_VIDEO_RAM_CALLBACK(_read) \ + devcb = &vt100_video_device::set_ram_rd_callback(*device, DEVCB_##_read); + +#define MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(_write) \ + devcb = &vt100_video_device::set_clear_video_irq_wr_callback(*device, DEVCB_##_write); + +#endif diff --git a/src/mame/video/wswan_video.c b/src/mame/video/wswan_video.c new file mode 100644 index 00000000000..8dbb60f0db8 --- /dev/null +++ b/src/mame/video/wswan_video.c @@ -0,0 +1,1216 @@ +// license:BSD-3-Clause +// copyright-holders:Anthony Kruize, Wilbert Pol +/*************************************************************************** + + wswan_video.c + + File to handle video emulation of the Bandai WonderSwan VDP. + + Anthony Kruize + Wilbert Pol + + TODO: + - remove the redundant parts of m_regs + - split the Color VDP from the Mono VDP? + + ***************************************************************************/ + +#include "wswan_video.h" + +const device_type WSWAN_VIDEO = &device_creator; + + +wswan_video_device::wswan_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, WSWAN_VIDEO, "Bandai WonderSwan VDP", tag, owner, clock, "wswan_video", __FILE__), + m_vdp_type(VDP_TYPE_WSWAN) +{ +} + + +void wswan_video_device::common_save() +{ + save_item(NAME(m_bitmap)); + save_item(NAME(m_vram)); + save_item(NAME(m_palette_port)); + save_item(NAME(m_pal)); + save_item(NAME(m_regs)); + + save_item(NAME(m_layer_bg_enable)); + save_item(NAME(m_layer_fg_enable)); + save_item(NAME(m_sprites_enable)); + save_item(NAME(m_window_sprites_enable)); + save_item(NAME(m_window_fg_mode)); + save_item(NAME(m_bg_control)); + save_item(NAME(m_current_line)); + save_item(NAME(m_line_compare)); + save_item(NAME(m_sprite_table_address)); + save_item(NAME(m_sprite_table_buffer)); + save_item(NAME(m_sprite_first)); + save_item(NAME(m_sprite_count)); + save_item(NAME(m_sprite_first_latch)); + save_item(NAME(m_sprite_count_latch)); + save_item(NAME(m_layer_bg_address)); + save_item(NAME(m_layer_fg_address)); + save_item(NAME(m_window_fg_left)); + save_item(NAME(m_window_fg_top)); + save_item(NAME(m_window_fg_right)); + save_item(NAME(m_window_fg_bottom)); + save_item(NAME(m_window_sprites_left)); + save_item(NAME(m_window_sprites_top)); + save_item(NAME(m_window_sprites_right)); + save_item(NAME(m_window_sprites_bottom)); + save_item(NAME(m_layer_bg_scroll_x)); + save_item(NAME(m_layer_bg_scroll_y)); + save_item(NAME(m_layer_fg_scroll_x)); + save_item(NAME(m_layer_fg_scroll_y)); + save_item(NAME(m_lcd_control)); + save_item(NAME(m_icons)); + save_item(NAME(m_color_mode)); + save_item(NAME(m_colors_16)); + save_item(NAME(m_tile_packed)); + save_item(NAME(m_timer_hblank_enable)); + save_item(NAME(m_timer_hblank_mode)); + save_item(NAME(m_timer_hblank_reload)); + save_item(NAME(m_timer_hblank_count)); + save_item(NAME(m_timer_vblank_enable)); + save_item(NAME(m_timer_vblank_mode)); + save_item(NAME(m_timer_vblank_reload)); + save_item(NAME(m_timer_vblank_count)); + save_item(NAME(m_main_palette)); +} + +void wswan_video_device::device_start() +{ + machine().first_screen()->register_screen_bitmap(m_bitmap); + + m_timer = timer_alloc(TIMER_SCANLINE); + m_timer->adjust(attotime::from_ticks(256, 3072000), 0, attotime::from_ticks(256, 3072000)); + + // bind callbacks + m_set_irq_cb.bind_relative_to(*owner()); + m_snd_dma_cb.bind_relative_to(*owner()); + + if (m_vdp_type == VDP_TYPE_WSC) + { + m_vram.resize(0x10000); + memset(&m_vram[0], 0, 0x10000); + m_palette_vram = &m_vram[0xfe00]; + } + else + { + m_vram.resize(0x4000); + memset(&m_vram[0], 0, 0x4000); + m_palette_vram = &m_vram[0]; + } + + common_save(); +} + +// This is a copy of ws_portram_init +// TODO: remove unneeded parts! +static const UINT8 vdp_regs_init[256] = +{ + 0x00, 0x00, 0x00/*?*/, 0xbb, 0x00, 0x00, 0x00, 0x26, 0xfe, 0xde, 0xf9, 0xfb, 0xdb, 0xd7, 0x7f, 0xf5, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x9e, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x99, 0xfd, 0xb7, 0xdf, + 0x30, 0x57, 0x75, 0x76, 0x15, 0x73, 0x70/*77?*/, 0x77, 0x20, 0x75, 0x50, 0x36, 0x70, 0x67, 0x50, 0x77, + 0x57, 0x54, 0x75, 0x77, 0x75, 0x17, 0x37, 0x73, 0x50, 0x57, 0x60, 0x77, 0x70, 0x77, 0x10, 0x73, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x87, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xdb, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x83, 0x00, + 0x2f, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1 +}; + + +void wswan_video_device::device_reset() +{ + m_layer_bg_enable = 0; + m_layer_fg_enable = 0; + m_sprites_enable = 0; + m_window_sprites_enable = 0; + m_window_fg_mode = 0; + m_bg_control = 0; + m_current_line = 145; // Randomly chosen, beginning of VBlank period to give cart some time to boot up + m_line_compare = 0; + m_sprite_table_address = 0; + m_sprite_first = 0; + m_sprite_count = 0; + m_sprite_first_latch = 0; + m_sprite_count_latch = 0; + m_layer_bg_address = 0; + m_layer_fg_address = 0; + m_window_fg_left = 0; + m_window_fg_top = 0; + m_window_fg_right = 0; + m_window_fg_bottom = 0; + m_window_sprites_left = 0; + m_window_sprites_top = 0; + m_window_sprites_right = 0; + m_window_sprites_bottom = 0; + m_layer_bg_scroll_x = 0; + m_layer_bg_scroll_y = 0; + m_layer_fg_scroll_x = 0; + m_layer_fg_scroll_y = 0; + m_lcd_control = 0x01; + m_icons = 0; + m_color_mode = 0; + m_colors_16 = 0; + m_tile_packed = 0; + m_timer_hblank_enable = 0; + m_timer_hblank_mode = 0; + m_timer_hblank_reload = 0; + m_timer_hblank_count = 0; + m_timer_vblank_enable = 0; + m_timer_vblank_mode = 0; + m_timer_vblank_reload = 0; + m_timer_vblank_count = 0; /* Vertical blank timer counter value */ + + memset(m_sprite_table_buffer, 0, sizeof(m_sprite_table_buffer)); + memset(m_main_palette, 0, sizeof(m_main_palette)); + memcpy(m_regs, vdp_regs_init, 256); + for (int i = 0; i < 0x20; i++) + m_palette_port[i] = m_regs[i + 0x20]; + + setup_palettes(); +} + + +void wswan_video_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SCANLINE: + scanline_interrupt(); + break; + } +} + + +void wswan_video_device::setup_palettes() +{ + if (m_color_mode) + { + for (int i = 0; i < 16; i++) + for (int j = 0; j < 16; j++) + m_pal[i][j] = ((m_palette_vram[(i << 5) + j * 2 + 1] << 8) | m_palette_vram[(i << 5) + j * 2]) & 0x0fff; + } + else + { + for (int i = 0; i < 16; i++) + { + m_pal[i][0] = (m_palette_port[(i << 1)] >> 0) & 0x07; + m_pal[i][1] = (m_palette_port[(i << 1)] >> 4) & 0x07; + m_pal[i][2] = (m_palette_port[(i << 1) + 1] >> 0) & 0x07; + m_pal[i][3] = (m_palette_port[(i << 1) + 1] >> 4) & 0x07; + } + } +} + +void wswan_video_device::draw_background() +{ + UINT16 map_addr = m_layer_bg_address + (((m_current_line + m_layer_bg_scroll_y) & 0xf8) << 3); + UINT8 start_column = (m_layer_bg_scroll_x >> 3); + + for (int column = 0; column < 29; column++) + { + UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; + int x_offset, tile_line, tile_address; + int tile_data = (m_vram[map_addr + (((start_column + column) & 0x1f) << 1) + 1] << 8) + | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; + int tile_number = tile_data & 0x01ff; + int tile_palette = (tile_data >> 9) & 0x0f; + + tile_line = (m_current_line + m_layer_bg_scroll_y) & 0x07; + if (tile_data & 0x8000) // vflip + tile_line = 7 - tile_line; + + if (m_colors_16) + { + tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = m_vram[tile_address + 2] << 2; + plane3 = m_vram[tile_address + 3] << 3; + } + } + else + { + tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = 0; + plane3 = 0; + } + } + + for (int x = 0; x < 8; x++) + { + int col; + if (m_tile_packed) + { + if (m_colors_16) + { + col = plane0 & 0x0f; + plane0 = plane0 >> 4; + } + else + { + col = plane0 & 0x03; + plane0 = plane0 >> 2; + } + } + else + { + col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); + plane3 = plane3 >> 1; + plane2 = plane2 >> 1; + plane1 = plane1 >> 1; + plane0 = plane0 >> 1; + } + + if (tile_data & 0x4000) + x_offset = x + (column << 3) - (m_layer_bg_scroll_x & 0x07); + else + x_offset = 7 - x + (column << 3) - (m_layer_bg_scroll_x & 0x07); + + if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) + { + if (m_colors_16) + { + if (col) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + { + /* Hmmmm, what should we do here... Is this correct?? */ + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + } + } + } + else + { + if (col || !(tile_palette & 4)) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + } + } + } + } + } +} + +void wswan_video_device::draw_foreground_0() +{ + UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); + UINT8 start_column = (m_layer_fg_scroll_x >> 3); + + for (int column = 0; column < 29; column++) + { + UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; + int x_offset, tile_line, tile_address; + int tile_data = (m_vram[map_addr + (((start_column + column) & 0x1f) << 1) + 1] << 8) + | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; + int tile_number = tile_data & 0x01ff; + int tile_palette = (tile_data >> 9) & 0x0f; + + tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; + if (tile_data & 0x8000) // vflip + tile_line = 7 - tile_line; + + if (m_colors_16) + { + tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = m_vram[tile_address + 2] << 2; + plane3 = m_vram[tile_address + 3] << 3; + } + } + else + { + tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = 0; + plane3 = 0; + } + } + + for (int x = 0; x < 8; x++ ) + { + int col; + if (m_tile_packed) + { + if (m_colors_16) + { + col = plane0 & 0x0f; + plane0 = plane0 >> 4; + } + else + { + col = plane0 & 0x03; + plane0 = plane0 >> 2; + } + } + else + { + col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); + plane3 = plane3 >> 1; + plane2 = plane2 >> 1; + plane1 = plane1 >> 1; + plane0 = plane0 >> 1; + } + + if (tile_data & 0x4000) + x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); + else + x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); + + if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) + { + if (m_colors_16) + { + if (col) + { +// if (m_color_mode) { + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; +// } else { +// /* Hmmmm, what should we do here... Is this correct?? */ +// m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; +// } + } + } + else + { + if (col || !(tile_palette & 4)) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + } + } + } + } + } +} + +void wswan_video_device::draw_foreground_2() +{ + UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); + UINT8 start_column = (m_layer_fg_scroll_x >> 3); + + for (int column = 0; column < 29; column++) + { + UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; + int x_offset, tile_line, tile_address; + int tile_data = (m_vram[map_addr + (((start_column + column) & 0x1f) << 1) + 1] << 8) + | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; + int tile_number = tile_data & 0x01ff; + int tile_palette = (tile_data >> 9) & 0x0f; + + tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; + if (tile_data & 0x8000) // vflip + tile_line = 7 - tile_line; + + + if (m_colors_16) + { + tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = m_vram[tile_address + 2] << 2; + plane3 = m_vram[tile_address + 3] << 3; + } + } + else + { + tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = 0; + plane3 = 0; + } + } + + for (int x = 0; x < 8; x++) + { + int col; + if (m_tile_packed) + { + if (m_colors_16) + { + col = plane0 & 0x0f; + plane0 = plane0 >> 4; + } + else + { + col = plane0 & 0x03; + plane0 = plane0 >> 2; + } + } + else + { + col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); + plane3 = plane3 >> 1; + plane2 = plane2 >> 1; + plane1 = plane1 >> 1; + plane0 = plane0 >> 1; + } + + if (tile_data & 0x4000) + x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); + else + x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); + + if (x_offset >= 0 && x_offset >= m_window_fg_left && x_offset < m_window_fg_right && x_offset < WSWAN_X_PIXELS) + { + if (m_colors_16) + { + if (col) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + /* Hmmmm, what should we do here... Is this correct?? */ + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + } + } + else + { + if (col || !(tile_palette & 4)) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + } + } + } + } + } +} + +void wswan_video_device::draw_foreground_3() +{ + UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); + UINT8 start_column = (m_layer_fg_scroll_x >> 3); + + for (int column = 0; column < 29; column++) + { + UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; + int x_offset, tile_line, tile_address; + int tile_data = (m_vram[map_addr + (((start_column + column) & 0x1f) << 1) + 1] << 8) + | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; + int tile_number = tile_data & 0x01ff; + int tile_palette = (tile_data >> 9) & 0x0f; + + tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; + if (tile_data & 0x8000) // vflip + tile_line = 7 - tile_line; + + if (m_colors_16) + { + tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = m_vram[tile_address + 2] << 2; + plane3 = m_vram[tile_address + 3] << 3; + } + } + else + { + tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = 0; + plane3 = 0; + } + } + + for (int x = 0; x < 8; x++) + { + int col; + if (m_tile_packed) + { + if (m_colors_16) + { + col = plane0 & 0x0f; + plane0 = plane0 >> 4; + } + else + { + col = plane0 & 0x03; + plane0 = plane0 >> 2; + } + } + else + { + col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); + plane3 = plane3 >> 1; + plane2 = plane2 >> 1; + plane1 = plane1 >> 1; + plane0 = plane0 >> 1; + } + + if (tile_data & 0x4000) + x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); + else + x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); + + if ((x_offset >= 0 && x_offset < m_window_fg_left) || (x_offset >= m_window_fg_right && x_offset < WSWAN_X_PIXELS)) + { + if (m_colors_16) + { + if (col) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + /* Hmmmm, what should we do here... Is this correct?? */ + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + } + } + else + { + if (col || !(tile_palette & 4)) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + } + } + } + } + } +} + +void wswan_video_device::handle_sprites(int mask) +{ + if (m_sprite_count == 0) + return; + + for (int i = m_sprite_first + m_sprite_count - 1; i >= m_sprite_first; i--) + { + UINT16 tile_data = (m_sprite_table_buffer[i * 4 + 1] << 8) | m_sprite_table_buffer[i * 4]; + UINT8 y = m_sprite_table_buffer[ i * 4 + 2 ]; + UINT8 x = m_sprite_table_buffer[ i * 4 + 3 ]; + int tile_line = (m_current_line - y) & 0xff; + + if ((tile_line >= 0) && (tile_line < 8) && ((tile_data & 0x2000) == mask)) + { + UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; + int x_offset, tile_address; + int tile_number = tile_data & 0x01ff; + int tile_palette = 8 + ((tile_data >> 9) & 0x07); + int check_clip = 0; + + if (tile_data & 0x8000) + tile_line = 7 - tile_line; + + if (m_colors_16) + { + tile_address = 0x4000 + (tile_number * 32) + (tile_line << 2); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = m_vram[tile_address + 2] << 2; + plane3 = m_vram[tile_address + 3] << 3; + } + } + else + { + tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); + if (m_tile_packed) + { + plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; + } + else + { + plane0 = m_vram[tile_address + 0]; + plane1 = m_vram[tile_address + 1] << 1; + plane2 = 0; + plane3 = 0; + } + } + + if (m_window_sprites_enable) + { + if (tile_data & 0x1000) + { + if (m_current_line >= m_window_sprites_top && m_current_line <= m_window_sprites_bottom) + check_clip = 1; + } + else + { + if (m_current_line < m_window_sprites_top || m_current_line > m_window_sprites_bottom) + continue; + } + } + + for (int j = 0; j < 8; j++) + { + int col; + if (m_tile_packed) + { + if (m_colors_16) + { + col = plane0 & 0x0f; + plane0 = plane0 >> 4; + } + else + { + col = plane0 & 0x03; + plane0 = plane0 >> 2; + } + } + else + { + col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); + plane3 = plane3 >> 1; + plane2 = plane2 >> 1; + plane1 = plane1 >> 1; + plane0 = plane0 >> 1; + } + + if (tile_data & 0x4000) + x_offset = x + j; + else + x_offset = x + 7 - j; + + x_offset = x_offset & 0xff; + + if (m_window_sprites_enable) + { + if (tile_data & 0x1000 && check_clip) + { + if (x_offset >= m_window_sprites_left && x_offset <= m_window_sprites_right) + continue; + } + else + { + if (x_offset < m_window_sprites_left || x_offset > m_window_sprites_right) + { +// continue; + } + } + } + if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) + { + if (m_colors_16) + { + if (col) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + /* Hmmmm, what should we do here... Is this correct?? */ + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + } + } + else + { + if (col || !(tile_palette & 4)) + { + if (m_color_mode) + m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + else + m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + } + } + } + } + } + } +} + + +void wswan_video_device::refresh_scanline() +{ + setup_palettes(); + + rectangle rec(0, WSWAN_X_PIXELS, m_current_line, m_current_line); + if (m_lcd_control) + { + /* Not sure if these background color checks and settings are correct */ + if (m_color_mode && m_colors_16) + m_bitmap.fill(m_pal[m_bg_control >> 4][m_bg_control & 0x0f], rec); + else + m_bitmap.fill(m_main_palette[m_bg_control & 0x07], rec); + } + else + { + m_bitmap.fill(0, rec); + return; + } + + // Draw background layer + if (m_layer_bg_enable) + draw_background(); + + // Draw sprites between background and foreground layers + if (m_sprites_enable) + handle_sprites(0); + + // Draw foreground layer, taking window settings into account + if (m_layer_fg_enable) + { + switch (m_window_fg_mode) + { + case 0: // FG inside & outside window area + draw_foreground_0(); + break; + case 1: // ??? + logerror("Unknown foreground mode 1 set\n"); + break; + case 2: // FG only inside window area + if (m_current_line >= m_window_fg_top && m_current_line <= m_window_fg_bottom) + draw_foreground_2(); + break; + case 3: // FG only outside window area + if (m_current_line < m_window_fg_top || m_current_line > m_window_fg_bottom) + draw_foreground_0(); + else + draw_foreground_3(); + break; + } + } + + // Draw sprites in front of foreground layer + if (m_sprites_enable) + handle_sprites(0x2000); +} + + + +UINT32 wswan_video_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} + + +READ8_MEMBER(wswan_video_device::reg_r) +{ + UINT8 value = m_regs[offset]; + + if (offset >= 0x20 && offset < 0x40) + return m_palette_port[offset & 0x1f]; + + switch (offset) + { + case 0x01: + value = m_bg_control; + break; + case 0x02: + value = m_current_line; + break; + case 0x14: + value = m_lcd_control; + break; + case 0xa8: + value = m_timer_hblank_count & 0xff; + break; + case 0xa9: + value = m_timer_hblank_count >> 8; + break; + case 0xaa: + value = m_timer_vblank_count & 0xff; + break; + case 0xab: + value = m_timer_vblank_count >> 8; + break; + } + + return value; +} + + +WRITE8_MEMBER(wswan_video_device::reg_w) +{ + if (offset >= 0x20 && offset < 0x40) + { + // 0x20-0x3f tile/sprite palette settings + // even offs + // Bit 0-3 - Palette (offs & 0x1f)/2 index 0 + // Bit 4-7 - Palette (offs & 0x1f)/2 index 1 + // odd offs + // Bit 0-3 - Palette (offs & 0x1f)/2 index 2 + // Bit 4-7 - Palette (offs & 0x1f)/2 index 3 + m_palette_port[offset & 0x1f] = data; + return; + } + + switch (offset) + { + case 0x00: // Display control + // Bit 0 - Background layer enable + // Bit 1 - Foreground layer enable + // Bit 2 - Sprites enable + // Bit 3 - Sprite window enable + // Bit 4-5 - Foreground window configuration + // 00 - Foreground layer is displayed inside and outside foreground window area + // 01 - Unknown + // 10 - Foreground layer is displayed only inside foreground window area + // 11 - Foreground layer is displayed outside foreground window area + // Bit 6-7 - Unknown + m_layer_bg_enable = data & 0x1; + m_layer_fg_enable = (data & 0x2) >> 1; + m_sprites_enable = (data & 0x4) >> 2; + m_window_sprites_enable = (data & 0x8) >> 3; + m_window_fg_mode = (data & 0x30) >> 4; + break; + case 0x01: // Background colour + // In 16 colour mode: + // Bit 0-3 - Palette index + // Bit 4-7 - Palette number + // Otherwise: + // Bit 0-2 - Main palette index + // Bit 3-7 - Unknown + m_bg_control = data; + break; + case 0x02: // Current scanline (Most likely read-only) + logerror("Write to current scanline! Current value: %d Data to write: %d\n", m_current_line, data); + // Returning so we don't overwrite the value here, not that it really matters + return; + case 0x03: // Line compare + m_line_compare = data; + logerror("Write to line compare: %d\n", data); + break; + case 0x04: // Sprite table base address + // Bit 0-5 - Determine sprite table base address 0 0xxxxxx0 00000000 + // Bit 6-7 - Unknown + m_sprite_table_address = (data & 0x3f) << 9; + break; + case 0x05: // First sprite number (the one we start drawing with) + m_sprite_first_latch = data; + if (data) logerror("non-zero first sprite %d\n", data); + break; + case 0x06: // Number of sprites to draw + m_sprite_count_latch = data; + break; + case 0x07: // Background/Foreground table base addresses + // Bit 0-2 - Determine background table base address 00xxx000 00000000 + // Bit 3 - Unknown + // Bit 4-6 - Determine foreground table base address 00xxx000 00000000 + // Bit 7 - Unknown + m_layer_bg_address = (data & 0x7) << 11; + m_layer_fg_address = (data & 0x70) << 7; + break; + case 0x08: // Left coordinate of foreground window + m_window_fg_left = data; + break; + case 0x09: // Top coordinate of foreground window + m_window_fg_top = data; + break; + case 0x0a: // Right coordinate of foreground window + m_window_fg_right = data; + break; + case 0x0b: // Bottom coordinate of foreground window + m_window_fg_bottom = data; + break; + case 0x0c: // Left coordinate of sprite window + m_window_sprites_left = data; + break; + case 0x0d: // Top coordinate of sprite window + m_window_sprites_top = data; + break; + case 0x0e: // Right coordinate of sprite window + m_window_sprites_right = data; + break; + case 0x0f: // Bottom coordinate of sprite window + m_window_sprites_bottom = data; + break; + case 0x10: // Background layer X scroll + m_layer_bg_scroll_x = data; + break; + case 0x11: // Background layer Y scroll + m_layer_bg_scroll_y = data; + break; + case 0x12: // Foreground layer X scroll + m_layer_fg_scroll_x = data; + break; + case 0x13: // Foreground layer Y scroll + m_layer_fg_scroll_y = data; + break; + case 0x14: // LCD control + // Bit 0 - LCD enable + // Bit 1-7 - Unknown + m_lcd_control = data; + break; + case 0x15: // LCD icons + // Bit 0 - LCD sleep icon enable + // Bit 1 - Vertical position icon enable + // Bit 2 - Horizontal position icon enable + // Bit 3 - Dot 1 icon enable + // Bit 4 - Dot 2 icon enable + // Bit 5 - Dot 3 icon enable + // Bit 6-7 - Unknown + m_icons = data; /* ummmmm */ + break; + case 0x1c: // Palette colors 0 and 1 + // Bit 0-3 - Gray tone setting for main palette index 0 + // Bit 4-7 - Gray tone setting for main palette index 1 + if (m_vdp_type == VDP_TYPE_WSC) + { + int i = 15 - (data & 0x0f); + int j = 15 - ((data & 0xf0) >> 4); + m_main_palette[0] = (i << 8) | (i << 4) | i; + m_main_palette[1] = (j << 8) | (j << 4) | j; + } + else + { + m_main_palette[0] = data & 0x0f; + m_main_palette[1] = (data & 0xf0) >> 4; + } + break; + case 0x1d: // Palette colors 2 and 3 + // Bit 0-3 - Gray tone setting for main palette index 2 + // Bit 4-7 - Gray tone setting for main palette index 3 + if (m_vdp_type == VDP_TYPE_WSC) + { + int i = 15 - (data & 0x0f); + int j = 15 - ((data & 0xf0) >> 4); + m_main_palette[2] = (i << 8) | (i << 4) | i; + m_main_palette[3] = (j << 8) | (j << 4) | j; + } + else + { + m_main_palette[2] = data & 0x0f; + m_main_palette[3] = (data & 0xf0) >> 4; + } + break; + case 0x1e: // Palette colors 4 and 5 + // Bit 0-3 - Gray tone setting for main palette index 4 + // Bit 4-7 - Gray tone setting for main palette index 5 + if (m_vdp_type == VDP_TYPE_WSC) + { + int i = 15 - (data & 0x0f); + int j = 15 - ((data & 0xf0) >> 4); + m_main_palette[4] = (i << 8) | (i << 4) | i; + m_main_palette[5] = (j << 8) | (j << 4) | j; + } + else + { + m_main_palette[4] = data & 0x0f; + m_main_palette[5] = (data & 0xf0) >> 4; + } + break; + case 0x1f: // Palette colors 6 and 7 + // Bit 0-3 - Gray tone setting for main palette index 6 + // Bit 4-7 - Gray tone setting for main palette index 7 + if (m_vdp_type == VDP_TYPE_WSC) + { + int i = 15 - (data & 0x0f); + int j = 15 - ((data & 0xf0) >> 4); + m_main_palette[6] = (i << 8) | (i << 4) | i; + m_main_palette[7] = (j << 8) | (j << 4) | j; + } + else + { + m_main_palette[6] = data & 0x0f; + m_main_palette[7] = (data & 0xf0) >> 4; + } + break; + case 0x60: // Video mode + // Bit 0-4 - Unknown + // Bit 5 - Packed mode 0 = not packed mode, 1 = packed mode + // Bit 6 - 4/16 colour mode select: 0 = 4 colour mode, 1 = 16 colour mode + // Bit 7 - monochrome/colour mode select: 0 = monochrome mode, 1 = colour mode + /* + * 111 - packed, 16 color, use 4000/8000, color + * 110 - not packed, 16 color, use 4000/8000, color + * 101 - packed, 4 color, use 2000, color + * 100 - not packed, 4 color, use 2000, color + * 011 - packed, 16 color, use 4000/8000, monochrome + * 010 - not packed, 16 color , use 4000/8000, monochrome + * 001 - packed, 4 color, use 2000, monochrome + * 000 - not packed, 4 color, use 2000, monochrome - Regular WS monochrome + */ + if (m_vdp_type == VDP_TYPE_WSC) + { + m_color_mode = data & 0x80; + m_colors_16 = data & 0x40; + m_tile_packed = data & 0x20; + } + break; + case 0xa2: // Timer control + // Bit 0 - HBlank Timer enable + // Bit 1 - HBlank Timer mode: 0 = one shot, 1 = auto reset + // Bit 2 - VBlank Timer(1/75s) enable + // Bit 3 - VBlank Timer mode: 0 = one shot, 1 = auto reset + // Bit 4-7 - Unknown + m_timer_hblank_enable = BIT(data, 0); + m_timer_hblank_mode = BIT(data, 1); + m_timer_vblank_enable = BIT(data, 2); + m_timer_vblank_mode = BIT(data, 3); + break; + case 0xa4: // HBlank timer frequency reload value (bits 0-7) + m_timer_hblank_reload &= 0xff00; + m_timer_hblank_reload += data; + m_timer_hblank_count = m_timer_hblank_reload; + break; + case 0xa5: // HBlank timer frequency reload value (bits 8-15) + m_timer_hblank_reload &= 0xff; + m_timer_hblank_reload += data << 8; + m_timer_hblank_count = m_timer_hblank_reload; + break; + case 0xa6: // VBlank timer frequency reload value (bits 0-7) + m_timer_vblank_reload &= 0xff00; + m_timer_vblank_reload += data; + m_timer_vblank_count = m_timer_vblank_reload; + break; + case 0xa7: // VBlank timer frequency reload value (bits 8-15) + m_timer_vblank_reload &= 0xff; + m_timer_vblank_reload += data << 8; + m_timer_vblank_count = m_timer_vblank_reload; + break; + case 0xa8: // HBlank counter (bits 0-7) + case 0xa9: // HBlank counter (bits 8-15) + case 0xaa: // VBlank counter (bits 0-7) + case 0xab: // VBlank counter (bits 8-15) + break; + } + + m_regs[offset] = data; +} + + +void wswan_video_device::scanline_interrupt() +{ + if (m_current_line < 144) + refresh_scanline(); + + // Decrement 12kHz (HBlank) counter + if (m_timer_hblank_enable && m_timer_hblank_reload != 0) + { + m_timer_hblank_count--; + logerror("timer_hblank_count: %X\n", m_timer_hblank_count); + if (m_timer_hblank_count == 0) + { + if (m_timer_hblank_mode) + m_timer_hblank_count = m_timer_hblank_reload; + else + m_timer_hblank_reload = 0; + + logerror( "triggering hbltmr interrupt\n" ); + m_set_irq_cb(WSWAN_VIDEO_IFLAG_HBLTMR); + } + } + + // Handle Sound DMA + m_snd_dma_cb(); + +// m_current_line = (m_current_line + 1) % 159; + + if (m_current_line == 144) // buffer sprite table + { + memcpy(m_sprite_table_buffer, &m_vram[m_sprite_table_address], 512); + m_sprite_first = m_sprite_first_latch; // always zero? + m_sprite_count = m_sprite_count_latch; + } + + if (m_current_line == 144) + { + m_set_irq_cb(WSWAN_VIDEO_IFLAG_VBL); + /* Decrement 75Hz (VBlank) counter */ + if (m_timer_vblank_enable && m_timer_vblank_reload != 0) + { + m_timer_vblank_count--; + logerror("timer_vblank_count: %X\n", m_timer_vblank_count); + if (m_timer_vblank_count == 0) + { + if (m_timer_vblank_mode) + m_timer_vblank_count = m_timer_vblank_reload; + else + m_timer_vblank_reload = 0; + + logerror("triggering vbltmr interrupt\n"); + m_set_irq_cb(WSWAN_VIDEO_IFLAG_VBLTMR); + } + } + } + +// m_current_line = (m_current_line + 1) % 159; + + if (m_current_line == m_line_compare) + m_set_irq_cb(WSWAN_VIDEO_IFLAG_LCMP); + + m_current_line = (m_current_line + 1) % 159; +} + + +READ8_MEMBER(wswan_video_device::vram_r) +{ + return m_vram[offset]; +} + +WRITE8_MEMBER(wswan_video_device::vram_w) +{ + m_vram[offset] = data; +} diff --git a/src/mame/video/wswan_video.h b/src/mame/video/wswan_video.h new file mode 100644 index 00000000000..2d51c9800c4 --- /dev/null +++ b/src/mame/video/wswan_video.h @@ -0,0 +1,149 @@ +// license:BSD-3-Clause +// copyright-holders:Anthony Kruize, Wilbert Pol +/********************************************************************** + + wswan.h + + File to handle video emulation of the Bandai WonderSwan. + + Anthony Kruize + Wilbert Pol + +**********************************************************************/ + +#ifndef __WSWAN_VIDEO__ +#define __WSWAN_VIDEO__ + +#include "emu.h" + +enum +{ + VDP_TYPE_WSWAN = 0, + VDP_TYPE_WSC +}; + +#define WSWAN_X_PIXELS (28*8) +#define WSWAN_Y_PIXELS (18*8) + + + +typedef device_delegate wswan_video_irq_cb_delegate; +#define WSWAN_VIDEO_IRQ_CB_MEMBER(_name) void _name(int irq) + +typedef device_delegate wswan_video_dmasnd_cb_delegate; +#define WSWAN_VIDEO_DMASND_CB_MEMBER(_name) void _name(void) + +#define MCFG_WSWAN_VIDEO_IRQ_CB(_class, _method) \ + wswan_video_device::set_irq_callback(*device, wswan_video_irq_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + +#define MCFG_WSWAN_VIDEO_DMASND_CB(_class, _method) \ + wswan_video_device::set_dmasnd_callback(*device, wswan_video_dmasnd_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + +#define MCFG_WSWAN_VIDEO_TYPE( _type) \ + wswan_video_device::set_vdp_type(*device, _type); + + +class wswan_video_device : public device_t +{ +public: + wswan_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~wswan_video_device() {} + + // static configuration + static void set_irq_callback(device_t &device, wswan_video_irq_cb_delegate callback) { downcast(device).m_set_irq_cb = callback; } + static void set_dmasnd_callback(device_t &device, wswan_video_dmasnd_cb_delegate callback) { downcast(device).m_snd_dma_cb = callback; } + static void set_vdp_type(device_t &device, int type) { downcast(device).m_vdp_type = type; } + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + virtual DECLARE_READ8_MEMBER(vram_r); + virtual DECLARE_WRITE8_MEMBER(vram_w); + virtual DECLARE_READ8_MEMBER(reg_r); + virtual DECLARE_WRITE8_MEMBER(reg_w); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + void setup_palettes(); + void draw_background(); + void draw_foreground_0(); + void draw_foreground_2(); + void draw_foreground_3(); + void handle_sprites(int mask); + void refresh_scanline(); + void scanline_interrupt(); + void common_save(); + + bitmap_ind16 m_bitmap; + UINT8 m_layer_bg_enable; /* Background layer on/off */ + UINT8 m_layer_fg_enable; /* Foreground layer on/off */ + UINT8 m_sprites_enable; /* Sprites on/off */ + UINT8 m_window_sprites_enable; /* Sprite window on/off */ + UINT8 m_window_fg_mode; /* 0:inside/outside, 1:??, 2:inside, 3:outside */ + UINT8 m_bg_control; + UINT8 m_current_line; /* Current scanline : 0-158 (159?) */ + UINT8 m_line_compare; /* Line to trigger line interrupt on */ + UINT32 m_sprite_table_address; /* Address of the sprite table */ + UINT8 m_sprite_table_buffer[512]; + UINT8 m_sprite_first; /* First sprite to draw */ + UINT8 m_sprite_count; /* Number of sprites to draw */ + UINT8 m_sprite_first_latch; + UINT8 m_sprite_count_latch; + UINT16 m_layer_bg_address; /* Address of the background screen map */ + UINT16 m_layer_fg_address; /* Address of the foreground screen map */ + UINT8 m_window_fg_left; /* Left coordinate of foreground window */ + UINT8 m_window_fg_top; /* Top coordinate of foreground window */ + UINT8 m_window_fg_right; /* Right coordinate of foreground window */ + UINT8 m_window_fg_bottom; /* Bottom coordinate of foreground window */ + UINT8 m_window_sprites_left; /* Left coordinate of sprites window */ + UINT8 m_window_sprites_top; /* Top coordinate of sprites window */ + UINT8 m_window_sprites_right; /* Right coordinate of sprites window */ + UINT8 m_window_sprites_bottom; /* Bottom coordinate of sprites window */ + UINT8 m_layer_bg_scroll_x; /* Background layer X scroll */ + UINT8 m_layer_bg_scroll_y; /* Background layer Y scroll */ + UINT8 m_layer_fg_scroll_x; /* Foreground layer X scroll */ + UINT8 m_layer_fg_scroll_y; /* Foreground layer Y scroll */ + UINT8 m_lcd_control; /* LCD on/off */ + UINT8 m_icons; /* FIXME: What do we do with these? Maybe artwork? */ + UINT8 m_color_mode; /* monochrome/color mode */ + UINT8 m_colors_16; /* 4/16 colors mode */ + UINT8 m_tile_packed; /* layered/packed tile mode switch */ + UINT8 m_timer_hblank_enable; /* Horizontal blank interrupt on/off */ + UINT8 m_timer_hblank_mode; /* Horizontal blank timer mode */ + UINT16 m_timer_hblank_reload; /* Horizontal blank timer reload value */ + UINT16 m_timer_hblank_count; /* Horizontal blank timer counter value */ + UINT8 m_timer_vblank_enable; /* Vertical blank interrupt on/off */ + UINT8 m_timer_vblank_mode; /* Vertical blank timer mode */ + UINT16 m_timer_vblank_reload; /* Vertical blank timer reload value */ + UINT16 m_timer_vblank_count; /* Vertical blank timer counter value */ + int m_main_palette[8]; + emu_timer *m_timer; + + dynamic_buffer m_vram; + UINT8 *m_palette_vram; + UINT8 m_palette_port[0x20]; + int m_pal[16][16]; + UINT8 m_regs[256]; + + wswan_video_irq_cb_delegate m_set_irq_cb; + wswan_video_dmasnd_cb_delegate m_snd_dma_cb; + int m_vdp_type; + + // timer IDs + static const device_timer_id TIMER_SCANLINE = 0; + + // interrupt flags + // these are the same as the wswan.h ones + static const UINT8 WSWAN_VIDEO_IFLAG_LCMP = 0x10; + static const UINT8 WSWAN_VIDEO_IFLAG_VBLTMR = 0x20; + static const UINT8 WSWAN_VIDEO_IFLAG_VBL = 0x40; + static const UINT8 WSWAN_VIDEO_IFLAG_HBLTMR = 0x80; +}; + +extern const device_type WSWAN_VIDEO; + + +#endif diff --git a/src/mame/video/x68k.c b/src/mame/video/x68k.c new file mode 100644 index 00000000000..fce9998286a --- /dev/null +++ b/src/mame/video/x68k.c @@ -0,0 +1,1267 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald,Carl +/* + + Sharp X68000 video functions + driver by Barry Rodewald + + X68000 video hardware (there are some minor revisions to these custom chips across various X680x0 models): + Custom sprite controller "Cynthia" + Custom CRT controller "Vinas / Vicon" + Custom video controller "VSOP / VIPS" + Custom video data selector "Cathy" + + In general terms: + 1 "Text" layer - effectively a 4bpp bitmap split into 4 planes at 1bpp each + 512kB "text" VRAM + can write to multiple planes at once + can copy one character line to another character line + is 1024x1024 in size + Up to 4 graphic layers - can be 4 layers with a 16 colour palette, 2 layers with a 256 colour palette, + or 1 layer at 16-bit RGB. + 512k graphic VRAM + all layers are 512x512, but at 16 colours, the 4 layers can be combined into 1 1024x1024 layer + one or more layers can be cleared at once quickly with a simple hardware function + 2 tilemapped layers - can be 8x8 or 16x16, 16 colours per tile, max 256 colours overall + 1 sprite layer - up to 128 16x16 sprites, 16 colours per sprite, maximum 16 sprites per scanline (not yet implemented). + + Questions: What do the other bits in m_video.reg[2] do? + What is "special priority mode"? + How is the intensity applied during blending if at all? + Black appears to be opaque only at priority 2 but not 3, is that right? + Are the gfx layers blended from the bottom up or all at once? + +*/ + +#include "emu.h" + +#include "machine/mc68901.h" +#include "includes/x68k.h" +#include "machine/ram.h" + + +PALETTE_DECODER_MEMBER(x68k_state, GGGGGRRRRRBBBBBI) +{ + UINT8 i = raw & 1; + UINT8 r = pal6bit(((raw >> 5) & 0x3e) | i); + UINT8 g = pal6bit(((raw >> 10) & 0x3e) | i); + UINT8 b = pal6bit(((raw >> 0) & 0x3e) | i); + return rgb_t(r, g, b); +} + +inline void x68k_state::x68k_plot_pixel(bitmap_rgb32 &bitmap, int x, int y, UINT32 color) +{ + bitmap.pix32(y, x) = (UINT16)color; +} +/* +bitmap_rgb32* ::x68k_get_gfx_page(int pri,int type) +{ + if(type == GFX16) + { + switch(pri) + { + case 0: + return x68k_gfx_0_bitmap_16; + case 1: + return x68k_gfx_1_bitmap_16; + case 2: + return x68k_gfx_2_bitmap_16; + case 3: + return x68k_gfx_3_bitmap_16; + default: + return x68k_gfx_0_bitmap_16; // should never reach here. + } + } + if(type == GFX256) + { + switch(pri) + { + case 0: + case 1: + return x68k_gfx_0_bitmap_256; + case 2: + case 3: + return x68k_gfx_1_bitmap_256; + default: + return x68k_gfx_0_bitmap_256; // should never reach here. + } + } + if(type == GFX65536) + return x68k_gfx_0_bitmap_65536; + + return NULL; // should never reach here either. +} +*/ +void x68k_state::x68k_crtc_text_copy(int src, int dest, UINT8 planes) +{ + // copys one raster in T-VRAM to another raster + int src_ram = src * 256; // 128 bytes per scanline + int dest_ram = dest * 256; + + // update RAM in each plane + if(planes & 1) + memcpy(&m_tvram[dest_ram],&m_tvram[src_ram],512); + if(planes & 2) + memcpy(&m_tvram[dest_ram+0x10000],&m_tvram[src_ram+0x10000],512); + if(planes & 4) + memcpy(&m_tvram[dest_ram+0x20000],&m_tvram[src_ram+0x20000],512); + if(planes & 8) + memcpy(&m_tvram[dest_ram+0x30000],&m_tvram[src_ram+0x30000],512); +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_operation_end) +{ + int bit = param; + m_crtc.operation &= ~bit; +} + +void x68k_state::x68k_crtc_refresh_mode() +{ +// rectangle rect; +// double scantime; + rectangle scr,visiblescr; + int length; + + // Calculate data from register values + m_crtc.vmultiple = 1; + if((m_crtc.reg[20] & 0x10) != 0 && (m_crtc.reg[20] & 0x0c) == 0) + m_crtc.vmultiple = 2; // 31.5kHz + 256 lines = doublescan + if(m_crtc.interlace != 0) + m_crtc.vmultiple = 0.5f; // 31.5kHz + 1024 lines or 15kHz + 512 lines = interlaced + m_crtc.htotal = (m_crtc.reg[0] + 1) * 8; + m_crtc.vtotal = (m_crtc.reg[4] + 1) / m_crtc.vmultiple; // default is 567 (568 scanlines) + m_crtc.hbegin = (m_crtc.reg[2] * 8) + 1; + m_crtc.hend = (m_crtc.reg[3] * 8); + m_crtc.vbegin = (m_crtc.reg[6]) / m_crtc.vmultiple; + m_crtc.vend = (m_crtc.reg[7] - 1) / m_crtc.vmultiple; + if((m_crtc.vmultiple == 2) && !(m_crtc.reg[7] & 1)) // otherwise if the raster irq line == vblank line, the raster irq fires too late + m_crtc.vend++; + m_crtc.hsync_end = (m_crtc.reg[1]) * 8; + m_crtc.vsync_end = (m_crtc.reg[5]) / m_crtc.vmultiple; + m_crtc.hsyncadjust = m_crtc.reg[8]; + scr.set(0, m_crtc.htotal - 8, 0, m_crtc.vtotal); + if(scr.max_y <= m_crtc.vend) + scr.max_y = m_crtc.vend + 2; + if(scr.max_x <= m_crtc.hend) + scr.max_x = m_crtc.hend + 2; + visiblescr.set(m_crtc.hbegin, m_crtc.hend, m_crtc.vbegin, m_crtc.vend); + + // expand visible area to the size indicated by CRTC reg 20 + length = m_crtc.hend - m_crtc.hbegin; + if (length < m_crtc.width) + { + visiblescr.min_x = m_crtc.hbegin - ((m_crtc.width - length)/2); + visiblescr.max_x = m_crtc.hend + ((m_crtc.width - length)/2); + } + length = m_crtc.vend - m_crtc.vbegin; + if (length < m_crtc.height) + { + visiblescr.min_y = m_crtc.vbegin - ((m_crtc.height - length)/2); + visiblescr.max_y = m_crtc.vend + ((m_crtc.height - length)/2); + } + // bounds check + if(visiblescr.min_x < 0) + visiblescr.min_x = 0; + if(visiblescr.min_y < 0) + visiblescr.min_y = 0; + if(visiblescr.max_x >= scr.max_x) + visiblescr.max_x = scr.max_x - 2; + if(visiblescr.max_y >= scr.max_y - 1) + visiblescr.max_y = scr.max_y - 2; + +// logerror("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i\n",m_crtc.reg[0],m_crtc.reg[1],m_crtc.reg[2],m_crtc.reg[3], +// m_crtc.reg[4],m_crtc.reg[5],m_crtc.reg[6],m_crtc.reg[7],m_crtc.reg[8],m_crtc.reg[9]); + logerror("video_screen_configure(machine.first_screen(),%i,%i,[%i,%i,%i,%i],55.45)\n",scr.max_x,scr.max_y,visiblescr.min_x,visiblescr.min_y,visiblescr.max_x,visiblescr.max_y); + m_screen->configure(scr.max_x,scr.max_y,visiblescr,HZ_TO_ATTOSECONDS(55.45)); +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_hsync) +{ + int hstate = param; + attotime hsync_time; + + m_crtc.hblank = hstate; + m_mfpdev->i7_w(!m_crtc.hblank); + + if(m_crtc.operation & 8) + x68k_crtc_text_copy((m_crtc.reg[22] & 0xff00) >> 8,(m_crtc.reg[22] & 0x00ff),(m_crtc.reg[21] & 0xf)); + + if(m_crtc.vmultiple == 2) // 256-line (doublescan) + { + if(hstate == 1) + { + if(m_oddscanline == 1) + { + int scan = m_screen->vpos(); + if(scan > m_crtc.vend) + scan = m_crtc.vbegin; + hsync_time = m_screen->time_until_pos(scan,(m_crtc.htotal + m_crtc.hend) / 2); + m_scanline_timer->adjust(hsync_time); + if(scan != 0) + { + if((ioport("options")->read() & 0x04)) + { + m_screen->update_partial(scan); + } + } + } + else + { + int scan = m_screen->vpos(); + if(scan > m_crtc.vend) + scan = m_crtc.vbegin; + hsync_time = m_screen->time_until_pos(scan,m_crtc.hend / 2); + m_scanline_timer->adjust(hsync_time); + if(scan != 0) + { + if((ioport("options")->read() & 0x04)) + { + m_screen->update_partial(scan); + } + } + } + } + if(hstate == 0) + { + if(m_oddscanline == 1) + { + int scan = m_screen->vpos(); + if(scan > m_crtc.vend) + scan = m_crtc.vbegin; + else + scan++; + hsync_time = m_screen->time_until_pos(scan,m_crtc.hbegin / 2); + m_scanline_timer->adjust(hsync_time, 1); + m_oddscanline = 0; + } + else + { + hsync_time = m_screen->time_until_pos(m_screen->vpos(),(m_crtc.htotal + m_crtc.hbegin) / 2); + m_scanline_timer->adjust(hsync_time, 1); + m_oddscanline = 1; + } + } + } + else // 512-line + { + if(hstate == 1) + { + int scan = m_screen->vpos(); + if(scan > m_crtc.vend) + scan = 0; + hsync_time = m_screen->time_until_pos(scan,m_crtc.hend); + m_scanline_timer->adjust(hsync_time); + if(scan != 0) + { + if((ioport("options")->read() & 0x04)) + { + m_screen->update_partial(scan); + } + } + } + if(hstate == 0) + { + hsync_time = m_screen->time_until_pos(m_screen->vpos()+1,m_crtc.hbegin); + m_scanline_timer->adjust(hsync_time, 1); + } + } +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_raster_end) +{ + m_mfpdev->i6_w(1); +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_raster_irq) +{ + int scan = param; + attotime irq_time; + attotime end_time; + + if(scan <= m_crtc.vtotal) + { + m_mfpdev->i6_w(0); + m_screen->update_partial(scan); + irq_time = m_screen->time_until_pos(scan,m_crtc.hbegin); + // end of HBlank period clears GPIP6 also? + end_time = m_screen->time_until_pos(scan,m_crtc.hend); + m_raster_irq->adjust(irq_time, scan); + timer_set(end_time, TIMER_X68K_CRTC_RASTER_END); + logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,m_screen->vpos()); + } +} + +TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_vblank_irq) +{ + int val = param; + attotime irq_time; + int vblank_line; + + if(val == 1) // V-DISP on + { + m_crtc.vblank = 1; + vblank_line = m_crtc.vbegin; + irq_time = m_screen->time_until_pos(vblank_line,2); + m_vblank_irq->adjust(irq_time); + logerror("CRTC: VBlank on\n"); + } + if(val == 0) // V-DISP off + { + m_crtc.vblank = 0; + vblank_line = m_crtc.vend; + if(vblank_line > m_crtc.vtotal) + vblank_line = m_crtc.vtotal; + irq_time = m_screen->time_until_pos(vblank_line,2); + m_vblank_irq->adjust(irq_time, 1); + logerror("CRTC: VBlank off\n"); + } + + m_mfpdev->tai_w(!m_crtc.vblank); + m_mfpdev->i4_w(!m_crtc.vblank); +} + + +// CRTC "VINAS 1+2 / VICON" at 0xe80000 +/* 0xe80000 - Registers (all are 16-bit): + * 0 - Horizontal Total (in characters) + * 1 - Horizontal Sync End + * 2 - Horizontal Display Begin + * 3 - Horizontal Display End + * 4 - Vertical Total (in scanlines) + * 5 - Vertical Sync End + * 6 - Vertical Display Begin + * 7 - Vertical Display End + * 8 - Fine Horizontal Sync Adjustment + * 9 - Raster Line (for Raster IRQ mapped to MFP GPIP6) + * 10/11 - Text Layer X and Y Scroll + * 12/13 - Graphic Layer 0 X and Y Scroll + * 14/15 - Graphic Layer 1 X and Y Scroll + * 16/17 - Graphic Layer 2 X and Y Scroll + * 18/19 - Graphic Layer 3 X and Y Scroll + * 20 - bit 12 - Text VRAM mode : 0 = display, 1 = buffer + * bit 11 - Graphic VRAM mode : 0 = display, 1 = buffer + * bit 10 - "Real" screen size : 0 = 512x512, 1 = 1024x1024 + * bits 8,9 - Colour mode : + * 00 = 16 colour 01 = 256 colour + * 10 = Undefined 11 = 65,536 colour + * bit 4 - Horizontal Frequency : 0 = 15.98kHz, 1 = 31.50kHz + * bits 2,3 - Vertical dots : + * 00 = 256 01 = 512 + * 10 or 11 = 1024 (interlaced) + * bits 0,1 - Horizontal dots : + * 00 = 256 01 = 512 + * 10 = 768 11 = 50MHz clock mode (Compact XVI or later) + * 21 - bit 9 - Text Screen Access Mask Enable + * bit 8 - Text Screen Simultaneous Plane Access Enable + * bits 4-7 - Text Screen Simultaneous Plane Access Select + * bits 0-3 - Text Screen Line Copy Plane Select + * Graphic Screen High-speed Clear Page Select + * 22 - Text Screen Line Copy + * bits 15-8 - Source Line + * bits 7-0 - Destination Line + * 23 - Text Screen Mask Pattern + * + * 0xe80481 - Operation Port (8-bit): + * bit 3 - Text Screen Line Copy Begin + * bit 1 - Graphic Screen High-speed Clear Begin + * bit 0 - Image Taking Begin (?) + * Operation Port bits are cleared automatically when the requested + * operation is completed. + */ +WRITE16_MEMBER(x68k_state::x68k_crtc_w ) +{ + if (offset < 0x24) + COMBINE_DATA(m_crtc.reg+offset); + switch(offset) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + x68k_crtc_refresh_mode(); + break; + case 9: // CRTC raster IRQ (GPIP6) + { + attotime irq_time; + data = m_crtc.reg[9]; + irq_time = m_screen->time_until_pos((data) / m_crtc.vmultiple,2); + + if(irq_time.as_double() > 0) + m_raster_irq->adjust(irq_time, (data) / m_crtc.vmultiple); + } + logerror("CRTC: Write to raster IRQ register - %i\n",data); + break; + case 20: + if(ACCESSING_BITS_0_7) + { + m_crtc.interlace = 0; + switch(data & 0x0c) + { + case 0x00: + m_crtc.height = 256; + break; + case 0x08: + case 0x0c: // TODO: 1024 vertical, if horizontal freq = 31kHz + m_crtc.height = 512; + m_crtc.interlace = 1; // if 31kHz, 1024 lines = interlaced + break; + case 0x04: + m_crtc.height = 512; + if(!(m_crtc.reg[20] & 0x0010)) // if 15kHz, 512 lines = interlaced + m_crtc.interlace = 1; + break; + } + switch(data & 0x03) + { + case 0x00: + m_crtc.width = 256; + break; + case 0x01: + m_crtc.width = 512; + break; + case 0x02: + case 0x03: // 0x03 = 50MHz clock mode (XVI only) + m_crtc.width = 768; + break; + } + } +/* if(ACCESSING_BITS_8_15) + { + m_crtc.interlace = 0; + if(data & 0x0400) + m_crtc.interlace = 1; + }*/ + x68k_crtc_refresh_mode(); + break; + case 576: // operation register + m_crtc.operation = data; + if(data & 0x02) // high-speed graphic screen clear + { + memset(&m_gvram[0],0,0x40000); + timer_set(attotime::from_msec(10), TIMER_X68K_CRTC_OPERATION_END, 0x02); // time taken to do operation is a complete guess. + } + break; + } +// logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",m_maincpu->safe_pc(),data,offset); +} + +READ16_MEMBER(x68k_state::x68k_crtc_r ) +{ + if(offset < 24) + { +// logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",m_maincpu->safe_pc(),m_crtc.reg[offset],offset); + switch(offset) + { + case 9: + return 0; + case 10: // Text X/Y scroll + case 11: + case 12: // Graphic layer 0 scroll + case 13: + return m_crtc.reg[offset] & 0x3ff; + case 14: // Graphic layer 1 scroll + case 15: + case 16: // Graphic layer 2 scroll + case 17: + case 18: // Graphic layer 3 scroll + case 19: + return m_crtc.reg[offset] & 0x1ff; + default: + return m_crtc.reg[offset]; + } + } + if(offset == 576) // operation port, operation bits are set to 0 when operation is complete + return m_crtc.operation; +// logerror("CRTC: [%08x] Read from unknown CRTC register %i\n",activecpu_get_pc(),offset); + return 0xffff; +} + +WRITE16_MEMBER(x68k_state::x68k_gvram_w ) +{ +// int xloc,yloc,pageoffset; + /* + G-VRAM usage is determined by colour depth and "real" screen size. + + For screen size of 1024x1024, all G-VRAM space is used, in one big page. + At 1024x1024 real screen size, colour depth is always 4bpp, and ranges from + 0xc00000-0xdfffff. + + For screen size of 512x512, the colour depth determines the page usage. + 16 colours = 4 pages + 256 colours = 2 pages + 65,536 colours = 1 page + Page 1 - 0xc00000-0xc7ffff Page 2 - 0xc80000-0xcfffff + Page 3 - 0xd00000-0xd7ffff Page 4 - 0xd80000-0xdfffff + */ + + // handle different G-VRAM page setups + if(m_crtc.reg[20] & 0x0800) // G-VRAM set to buffer + { + if(offset < 0x40000) + COMBINE_DATA(&m_gvram[offset]); + } + else + { + switch(m_crtc.reg[20] & 0x0300) + { + case 0x0300: + if(offset < 0x40000) + COMBINE_DATA(&m_gvram[offset]); + break; + case 0x0100: + if(offset < 0x40000) + { + m_gvram[offset] = (m_gvram[offset] & 0xff00) | (data & 0x00ff); + } + if(offset >= 0x40000 && offset < 0x80000) + { + m_gvram[offset-0x40000] = (m_gvram[offset-0x40000] & 0x00ff) | ((data & 0x00ff) << 8); + } + break; + case 0x0000: + if(offset < 0x40000) + { + m_gvram[offset] = (m_gvram[offset] & 0xfff0) | (data & 0x000f); + } + if(offset >= 0x40000 && offset < 0x80000) + { + m_gvram[offset-0x40000] = (m_gvram[offset-0x40000] & 0xff0f) | ((data & 0x000f) << 4); + } + if(offset >= 0x80000 && offset < 0xc0000) + { + m_gvram[offset-0x80000] = (m_gvram[offset-0x80000] & 0xf0ff) | ((data & 0x000f) << 8); + } + if(offset >= 0xc0000 && offset < 0x100000) + { + m_gvram[offset-0xc0000] = (m_gvram[offset-0xc0000] & 0x0fff) | ((data & 0x000f) << 12); + } + break; + default: + logerror("G-VRAM written while layer setup is undefined.\n"); + } + } +} + +WRITE16_MEMBER(x68k_state::x68k_tvram_w ) +{ + UINT16 text_mask; + + text_mask = ~(m_crtc.reg[23]) & mem_mask; + + if(!(m_crtc.reg[21] & 0x0200)) // text access mask enable + text_mask = 0xffff & mem_mask; + + mem_mask = text_mask; + + if(m_crtc.reg[21] & 0x0100) + { // simultaneous T-VRAM plane access (I think ;)) + int plane,wr; + offset = offset & 0x00ffff; + wr = (m_crtc.reg[21] & 0x00f0) >> 4; + for(plane=0;plane<4;plane++) + { + if(wr & (1 << plane)) + { + COMBINE_DATA(&m_tvram[offset+0x10000*plane]); + } + } + } + else + { + COMBINE_DATA(&m_tvram[offset]); + } +} + +READ16_MEMBER(x68k_state::x68k_gvram_r ) +{ + UINT16 ret = 0; + + if(m_crtc.reg[20] & 0x0800) // G-VRAM set to buffer + return m_gvram[offset]; + + switch(m_crtc.reg[20] & 0x0300) // colour setup determines G-VRAM use + { + case 0x0300: // 65,536 colour (RGB) - 16-bits per word + if(offset < 0x40000) + ret = m_gvram[offset]; + else + ret = 0xffff; + break; + case 0x0100: // 256 colour (paletted) - 8 bits per word + if(offset < 0x40000) + ret = m_gvram[offset] & 0x00ff; + if(offset >= 0x40000 && offset < 0x80000) + ret = (m_gvram[offset-0x40000] & 0xff00) >> 8; + if(offset >= 0x80000) + ret = 0xffff; + break; + case 0x0000: // 16 colour (paletted) - 4 bits per word + if(offset < 0x40000) + ret = m_gvram[offset] & 0x000f; + if(offset >= 0x40000 && offset < 0x80000) + ret = (m_gvram[offset-0x40000] & 0x00f0) >> 4; + if(offset >= 0x80000 && offset < 0xc0000) + ret = (m_gvram[offset-0x80000] & 0x0f00) >> 8; + if(offset >= 0xc0000 && offset < 0x100000) + ret = (m_gvram[offset-0xc0000] & 0xf000) >> 12; + break; + default: + logerror("G-VRAM read while layer setup is undefined.\n"); + ret = 0xffff; + } + + return ret; +} + +READ16_MEMBER(x68k_state::x68k_tvram_r ) +{ + return m_tvram[offset]; +} + +WRITE16_MEMBER(x68k_state::x68k_spritereg_w ) +{ + COMBINE_DATA(&m_spritereg[offset]); + switch(offset) + { + case 0x400: + m_bg0_8->set_scrollx(0,(data - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); + m_bg0_16->set_scrollx(0,(data - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); + break; + case 0x401: + m_bg0_8->set_scrolly(0,(data - m_crtc.vbegin) & 0x3ff); + m_bg0_16->set_scrolly(0,(data - m_crtc.vbegin) & 0x3ff); + break; + case 0x402: + m_bg1_8->set_scrollx(0,(data - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); + m_bg1_16->set_scrollx(0,(data - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); + break; + case 0x403: + m_bg1_8->set_scrolly(0,(data - m_crtc.vbegin) & 0x3ff); + m_bg1_16->set_scrolly(0,(data - m_crtc.vbegin) & 0x3ff); + break; + case 0x406: // BG H-DISP (normally equals CRTC reg 2 value + 4) + if(data != 0x00ff) + { + m_crtc.bg_visible_width = (m_crtc.reg[3] - ((data & 0x003f) - 4)) * 8; + m_crtc.bg_hshift = ((data - (m_crtc.reg[2]+4)) * 8); + if(m_crtc.bg_hshift > 0) + m_crtc.bg_hshift = 0; + } + break; + case 0x407: // BG V-DISP (like CRTC reg 6) + m_crtc.bg_vshift = m_crtc.vshift; + break; + case 0x408: // BG H/V-Res + m_crtc.bg_hvres = data & 0x1f; + if(data != 0xff) + { // Handle when the PCG is using 256 and the CRTC is using 512 + if((m_crtc.bg_hvres & 0x0c) == 0x00 && (m_crtc.reg[20] & 0x0c) == 0x04) + m_crtc.bg_double = 2; + else + m_crtc.bg_double = 1; + } + else + m_crtc.bg_double = 1; + break; + } +} + +READ16_MEMBER(x68k_state::x68k_spritereg_r ) +{ + if(offset >= 0x400 && offset < 0x404) + return m_spritereg[offset] & 0x3ff; + return m_spritereg[offset]; +} + +WRITE16_MEMBER(x68k_state::x68k_spriteram_w ) +{ + COMBINE_DATA(m_spriteram+offset); + m_video.tile8_dirty[offset / 16] = 1; + m_video.tile16_dirty[offset / 64] = 1; + if(offset < 0x2000) + { + m_bg1_8->mark_all_dirty(); + m_bg1_16->mark_all_dirty(); + m_bg0_8->mark_all_dirty(); + m_bg0_16->mark_all_dirty(); + } + if(offset >= 0x2000 && offset < 0x3000) + { + m_bg1_8->mark_tile_dirty(offset & 0x0fff); + m_bg1_16->mark_tile_dirty(offset & 0x0fff); + } + if(offset >= 0x3000) + { + m_bg0_8->mark_tile_dirty(offset & 0x0fff); + m_bg0_16->mark_tile_dirty(offset & 0x0fff); + } +} + +READ16_MEMBER(x68k_state::x68k_spriteram_r ) +{ + return m_spriteram[offset]; +} + +void x68k_state::x68k_draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle rect) +{ + unsigned int line,pixel; // location on screen + UINT32 loc; // location in TVRAM + UINT32 colour; + int bit; + + for(line=rect.min_y;line<=rect.max_y;line++) // per scanline + { + // adjust for scroll registers + loc = (((line - m_crtc.vbegin) + yscr) & 0x3ff) * 64; + loc += (xscr / 16) & 0x7f; + loc &= 0xffff; + bit = 15 - (xscr & 0x0f); + for(pixel=rect.min_x;pixel<=rect.max_x;pixel++) // per pixel + { + colour = (((m_tvram[loc] >> bit) & 0x01) ? 1 : 0) + + (((m_tvram[loc+0x10000] >> bit) & 0x01) ? 2 : 0) + + (((m_tvram[loc+0x20000] >> bit) & 0x01) ? 4 : 0) + + (((m_tvram[loc+0x30000] >> bit) & 0x01) ? 8 : 0); + // Colour 0 is displayable if the text layer is at the priority level 2 + if((m_pcgpalette->pen(colour) & 0xffffff) || ((m_video.reg[1] & 0x0c00) == 0x0800)) + bitmap.pix32(line, pixel) = m_pcgpalette->pen(colour); + bit--; + if(bit < 0) + { + bit = 15; + loc++; + loc &= 0xffff; + } + } + } +} + +bool x68k_state::x68k_draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, UINT8 priority) +{ + int pixel; + int page; + UINT32 loc; // location in GVRAM + UINT32 lineoffset; + UINT16 xscr,yscr; + UINT16 colour = 0; + int shift; + int scanline; + bool blend, ret = false; + UINT16 *pal = (UINT16 *)m_gfxpalette->basemem().base(); + + for(scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline + { + if(m_crtc.reg[20] & 0x0400) // 1024x1024 "real" screen size - use 1024x1024 16-colour gfx layer + { + // adjust for scroll registers + if(m_video.reg[2] & 0x0010 && priority == m_video.gfxlayer_pri[0]) + { + xscr = (m_crtc.reg[12] & 0x3ff); + yscr = (m_crtc.reg[13] & 0x3ff); + lineoffset = (((scanline - m_crtc.vbegin) + yscr) & 0x3ff) * 1024; + loc = xscr & 0x3ff; + for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) + { + switch(lineoffset & 0xc0000) + { + case 0x00000: + colour = m_gvram[lineoffset + (loc & 0x3ff)] & 0x000f; + break; + case 0x40000: + colour = (m_gvram[(lineoffset - 0x40000) + (loc & 0x3ff)] & 0x00f0) >> 4; + break; + case 0x80000: + colour = (m_gvram[(lineoffset - 0x80000) + (loc & 0x3ff)] & 0x0f00) >> 8; + break; + case 0xc0000: + colour = (m_gvram[(lineoffset - 0xc0000) + (loc & 0x3ff)] & 0xf000) >> 12; + break; + } + if(colour || (priority == 3)) + bitmap.pix16(scanline, pixel) = colour; + loc++; + loc &= 0x3ff; + } + } + } + else // else 512x512 "real" screen size + { + if(m_video.reg[2] & (1 << priority)) + { + page = m_video.gfxlayer_pri[priority]; + // adjust for scroll registers + switch(m_video.reg[0] & 0x03) + { + case 0x00: // 16 colours + xscr = ((m_crtc.reg[12+(page*2)])) & 0x1ff; + yscr = ((m_crtc.reg[13+(page*2)])) & 0x1ff; + lineoffset = (((scanline - m_crtc.vbegin) + yscr) & 0x1ff) * 512; + loc = xscr & 0x1ff; + shift = 4; + if((m_video.reg[2] & 0x1a00) == 0x1a00) + ret = true; + for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) + { + colour = ((m_gvram[lineoffset + loc] >> page*shift) & 0x000f); + if(ret && (colour & 1)) + { + blend = true; + colour &= 0xfe; + } + else + blend = false; + if(colour || (priority == 3)) + { + if(ret) + { + if(blend && bitmap.pix16(scanline, pixel)) + bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; + else + bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; + } + else + bitmap.pix16(scanline, pixel) = colour; + } + loc++; + loc &= 0x1ff; + } + break; + case 0x01: // 256 colours + if(page == 0 || page == 2) + { + xscr = ((m_crtc.reg[12+(page*2)])) & 0x1ff; + yscr = ((m_crtc.reg[13+(page*2)])) & 0x1ff; + lineoffset = (((scanline - m_crtc.vbegin) + yscr) & 0x1ff) * 512; + loc = xscr & 0x1ff; + shift = 4; + if((m_video.reg[2] & 0x1a00) == 0x1a00) + ret = true; + for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) + { + colour = ((m_gvram[lineoffset + loc] >> page*shift) & 0x00ff); + if(ret && (colour & 1)) + { + blend = true; + colour &= 0xfe; + } + else + blend = false; + if(colour || (priority == 3)) + { + if(ret) + { + if(blend && bitmap.pix16(scanline, pixel)) + bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; + else + bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; + } + else + bitmap.pix16(scanline, pixel) = colour; + } + loc++; + loc &= 0x1ff; + } + } + break; + case 0x03: // 65536 colours + xscr = ((m_crtc.reg[12])) & 0x1ff; + yscr = ((m_crtc.reg[13])) & 0x1ff; + lineoffset = (((scanline - m_crtc.vbegin) + yscr) & 0x1ff) * 512; + loc = xscr & 0x1ff; + for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) + { + colour = m_gvram[lineoffset + loc]; + if(colour || (priority == 3)) + bitmap.pix16(scanline, pixel) = colour; + loc++; + loc &= 0x1ff; + } + break; + } + } + } + } + return ret; +} + +void x68k_state::x68k_draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) +{ + int priority, scanline, pixel; + bool gfxblend=false; + //rectangle rect; + //int xscr,yscr; + //int gpage; + + if(m_crtc.reg[20] & 0x0800) // if graphic layers are set to buffer, then they aren't visible + return; + + m_gfxbitmap->fill(0, cliprect); + + for(priority=3;priority>=0;priority--) + { + gfxblend = x68k_draw_gfx_scanline(*m_gfxbitmap,cliprect,priority); + } + + for(scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) + { + UINT16 colour; + bool blend = false; + for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) + { + if((m_video.reg[0] & 0x03) == 3) + { + colour = m_gfxbitmap->pix16(scanline, pixel); + if(colour || (m_video.gfx_pri == 2)) + bitmap.pix32(scanline, pixel) = GGGGGRRRRRBBBBBI_decoder(colour); + } + else if(gfxblend) + { + colour = m_gfxbitmap->pix16(scanline, pixel); + if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) + blend = true; + else + blend = false; + if(colour || (m_video.gfx_pri == 2)) + { + if(blend) + bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((pal555(colour, 6, 11, 1) >> 1) & 0x7f7f7f); + else + bitmap.pix32(scanline, pixel) = pal555(colour, 6, 11, 1); + } + } + else + { + colour = m_gfxbitmap->pix16(scanline, pixel) & 0xff; + if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) + { + blend = true; + colour &= 0xfe; + } + else + blend = false; + if((colour && (m_gfxpalette->pen(colour) & 0xffffff)) || (m_video.gfx_pri == 2)) + { + if(blend) + bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((m_gfxpalette->pen(colour) >> 1) & 0x7f7f7f); + else + bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour); + } + } + } + } +} + +// Sprite controller "Cynthia" at 0xeb0000 +void x68k_state::x68k_draw_sprites(bitmap_ind16 &bitmap, int priority, rectangle cliprect) +{ + /* + 0xeb0000 - 0xeb07ff - Sprite registers (up to 128) + + 00 : b9-0, Sprite X position + + 02 : b9-0, Sprite Y position + + 04 : b15, Vertical Reversing (flipping?) + b14, Horizontal Reversing + b11-8, Sprite colour + b7-0, Sprite tile code (in PCG) + + 06 : b1-0, Priority + 00 = Sprite not displayed + + 0xeb0800 - BG0 X Scroll (10-bit) + 0xeb0802 - BG0 Y Scroll + 0xeb0804 - BG1 X Scroll + 0xeb0806 - BG1 Y Scroll + 0xeb0808 - BG control + b9, BG/Sprite display (RAM and register access is faster if 1) + b4, PCG area 1 available + b3, BG1 display enable + b1, PCG area 0 available + b0, BG0 display enable + 0xeb080a - Horizontal total (like CRTC reg 0 - is 0xff if in 256x256?) + 0xeb080c - Horizontal display position (like CRTC reg 2 - +4) + 0xeb080e - Vertical display position (like CRTC reg 6) + 0xeb0810 - Resolution setting + b4, "L/H" (apparently 15kHz/31kHz switch for sprites/BG?) + b3-2, V-Res + b1-0, H-Res (0 = 8x8 tilemaps, 1 = 16x16 tilemaps, 2 or 3 = unknown) + */ + int ptr,pri; + + for(ptr=508;ptr>=0;ptr-=4) // stepping through sprites + { + pri = m_spritereg[ptr+3] & 0x03; +#ifdef MAME_DEBUG + if(!(machine().input().code_pressed(KEYCODE_I))) +#endif + if(pri == priority) + { // if at the right priority level, draw the sprite + rectangle rect; + int code = m_spritereg[ptr+2] & 0x00ff; + int colour = (m_spritereg[ptr+2] & 0x0f00) >> 8; + int xflip = m_spritereg[ptr+2] & 0x4000; + int yflip = m_spritereg[ptr+2] & 0x8000; + int sx = (m_spritereg[ptr+0] & 0x3ff) - 16; + int sy = (m_spritereg[ptr+1] & 0x3ff) - 16; + + rect.min_x=m_crtc.hshift; + rect.min_y=m_crtc.vshift; + rect.max_x=rect.min_x + m_crtc.visible_width-1; + rect.max_y=rect.min_y + m_crtc.visible_height-1; + + sx += m_crtc.bg_hshift; + sx += m_sprite_shift; + + m_gfxdecode->gfx(1)->zoom_transpen(bitmap,cliprect,code,colour,xflip,yflip,m_crtc.hbegin+sx,m_crtc.vbegin+(sy*m_crtc.bg_double),0x10000,0x10000*m_crtc.bg_double,0x00); + } + } +} + +static const gfx_layout x68k_pcg_8 = +{ + 8,8, + 256, + 4, + { 0,1,2,3 }, + { 8,12,0,4,24,28,16,20 }, + { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, + 32*8 +}; + +static const gfx_layout x68k_pcg_16 = +{ + 16,16, + 256, + 4, + { 0,1,2,3 }, + { 8,12,0,4,24,28,16,20,8+64*8,12+64*8,64*8,4+64*8,24+64*8,28+64*8,16+64*8,20+64*8 }, + { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, + 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 }, + 128*8 +}; + +TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg0_tile) +{ + int code = m_spriteram[0x3000+tile_index] & 0x00ff; + int colour = (m_spriteram[0x3000+tile_index] & 0x0f00) >> 8; + int flags = (m_spriteram[0x3000+tile_index] & 0xc000) >> 14; + SET_TILE_INFO_MEMBER(0,code,colour,flags); +} + +TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg1_tile) +{ + int code = m_spriteram[0x2000+tile_index] & 0x00ff; + int colour = (m_spriteram[0x2000+tile_index] & 0x0f00) >> 8; + int flags = (m_spriteram[0x2000+tile_index] & 0xc000) >> 14; + SET_TILE_INFO_MEMBER(0,code,colour,flags); +} + +TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg0_tile_16) +{ + int code = m_spriteram[0x3000+tile_index] & 0x00ff; + int colour = (m_spriteram[0x3000+tile_index] & 0x0f00) >> 8; + int flags = (m_spriteram[0x3000+tile_index] & 0xc000) >> 14; + SET_TILE_INFO_MEMBER(1,code,colour,flags); +} + +TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg1_tile_16) +{ + int code = m_spriteram[0x2000+tile_index] & 0x00ff; + int colour = (m_spriteram[0x2000+tile_index] & 0x0f00) >> 8; + int flags = (m_spriteram[0x2000+tile_index] & 0xc000) >> 14; + SET_TILE_INFO_MEMBER(1,code,colour,flags); +} + +VIDEO_START_MEMBER(x68k_state,x68000) +{ + int gfx_index; + + for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) + if (m_gfxdecode->gfx(gfx_index) == 0) + break; + + /* create the char set (gfx will then be updated dynamically from RAM) */ + m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_pcgpalette, x68k_pcg_8, memregion("user1")->base(), 0, 32, 0))); + + gfx_index++; + + m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_pcgpalette, x68k_pcg_16, memregion("user1")->base(), 0, 32, 0))); + m_gfxdecode->gfx(gfx_index)->set_colors(32); + + /* Tilemaps */ + m_bg0_8 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(x68k_state::x68k_get_bg0_tile),this),TILEMAP_SCAN_ROWS,8,8,64,64); + m_bg1_8 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(x68k_state::x68k_get_bg1_tile),this),TILEMAP_SCAN_ROWS,8,8,64,64); + m_bg0_16 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(x68k_state::x68k_get_bg0_tile_16),this),TILEMAP_SCAN_ROWS,16,16,64,64); + m_bg1_16 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(x68k_state::x68k_get_bg1_tile_16),this),TILEMAP_SCAN_ROWS,16,16,64,64); + + m_bg0_8->set_transparent_pen(0); + m_bg1_8->set_transparent_pen(0); + m_bg0_16->set_transparent_pen(0); + m_bg1_16->set_transparent_pen(0); + + m_pcgbitmap = auto_bitmap_ind16_alloc(machine(), 1024, 1024); + m_pcgbitmap->fill(0); + + m_gfxbitmap = auto_bitmap_ind16_alloc(machine(), 1024, 1024); + m_gfxbitmap->fill(0); + +// m_scanline_timer->adjust(attotime::zero, 0, attotime::from_hz(55.45)/568); +} + +UINT32 x68k_state::screen_update_x68000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + rectangle rect(0,0,0,0); + int priority; + int xscr,yscr; + int x; + tilemap_t* x68k_bg0; + tilemap_t* x68k_bg1; + int pixel, scanline; + //UINT8 *rom; + + if((m_spritereg[0x408] & 0x03) == 0x00) // Sprite/BG H-Res 0=8x8, 1=16x16, 2 or 3 = undefined. + { + x68k_bg0 = m_bg0_8; + x68k_bg1 = m_bg1_8; + } + else + { + x68k_bg0 = m_bg0_16; + x68k_bg1 = m_bg1_16; + } +// rect.max_x=m_crtc.width; +// rect.max_y=m_crtc.height; + bitmap.fill(0, cliprect); + + if(m_sysport.contrast == 0) // if monitor contrast is 0, then don't bother displaying anything + return 0; + + rect.min_x=m_crtc.hbegin; + rect.min_y=m_crtc.vbegin; +// rect.max_x=rect.min_x + m_crtc.visible_width-1; +// rect.max_y=rect.min_y + m_crtc.visible_height-1; + rect.max_x=m_crtc.hend; + rect.max_y=m_crtc.vend; + + if(rect.min_y < cliprect.min_y) + rect.min_y = cliprect.min_y; + if(rect.max_y > cliprect.max_y) + rect.max_y = cliprect.max_y; + + // update tiles + //rom = memregion("user1")->base(); + for(x=0;x<256;x++) + { + if(m_video.tile16_dirty[x] != 0) + { + m_gfxdecode->gfx(1)->mark_dirty(x); + m_video.tile16_dirty[x] = 0; + } + if(m_video.tile8_dirty[x] != 0) + { + m_gfxdecode->gfx(0)->mark_dirty(x); + m_video.tile8_dirty[x] = 0; + } + } + + + for(priority=2;priority>=0;priority--) + { + // Graphics screen(s) + if(priority == m_video.gfx_pri) + x68k_draw_gfx(bitmap,rect); + + // Sprite / BG Tiles + if(priority == m_video.sprite_pri /*&& (m_spritereg[0x404] & 0x0200)*/ && (m_video.reg[2] & 0x0040)) + { + m_pcgbitmap->fill(0, rect); + x68k_draw_sprites(*m_pcgbitmap,1,rect); + if((m_spritereg[0x404] & 0x0008)) + { + if((m_spritereg[0x404] & 0x0030) == 0x10) // BG1 TXSEL + { + x68k_bg0->set_scrollx(0,(m_spritereg[0x402] - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); + x68k_bg0->set_scrolly(0,(m_spritereg[0x403] - m_crtc.vbegin) & 0x3ff); + x68k_bg0->draw(screen, *m_pcgbitmap,rect,0,0); + } + else + { + x68k_bg1->set_scrollx(0,(m_spritereg[0x402] - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); + x68k_bg1->set_scrolly(0,(m_spritereg[0x403] - m_crtc.vbegin) & 0x3ff); + x68k_bg1->draw(screen, *m_pcgbitmap,rect,0,0); + } + } + x68k_draw_sprites(*m_pcgbitmap,2,rect); + if((m_spritereg[0x404] & 0x0001)) + { + if((m_spritereg[0x404] & 0x0006) == 0x02) // BG0 TXSEL + { + x68k_bg0->set_scrollx(0,(m_spritereg[0x400] - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); + x68k_bg0->set_scrolly(0,(m_spritereg[0x401] - m_crtc.vbegin) & 0x3ff); + x68k_bg0->draw(screen, *m_pcgbitmap,rect,0,0); + } + else + { + x68k_bg1->set_scrollx(0,(m_spritereg[0x400] - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); + x68k_bg1->set_scrolly(0,(m_spritereg[0x401] - m_crtc.vbegin) & 0x3ff); + x68k_bg1->draw(screen, *m_pcgbitmap,rect,0,0); + } + } + x68k_draw_sprites(*m_pcgbitmap,3,rect); + + for(scanline=rect.min_y;scanline<=rect.max_y;scanline++) + { + for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) + { + UINT8 colour = m_pcgbitmap->pix16(scanline, pixel) & 0xff; + if((colour && (m_pcgpalette->pen(colour) & 0xffffff)) || ((m_video.reg[1] & 0x3000) == 0x2000)) + bitmap.pix32(scanline, pixel) = m_pcgpalette->pen(colour); + } + } + } + + // Text screen + if(m_video.reg[2] & 0x0020 && priority == m_video.text_pri) + { + xscr = (m_crtc.reg[10] & 0x3ff); + yscr = (m_crtc.reg[11] & 0x3ff); + if(!(m_crtc.reg[20] & 0x1000)) // if text layer is set to buffer, then it's not visible + x68k_draw_text(bitmap,xscr,yscr,rect); + } + } + +#ifdef MAME_DEBUG + if(machine().input().code_pressed(KEYCODE_9)) + { + m_sprite_shift--; + popmessage("Sprite shift = %i",m_sprite_shift); + } + if(machine().input().code_pressed(KEYCODE_0)) + { + m_sprite_shift++; + popmessage("Sprite shift = %i",m_sprite_shift); + } + +#endif + +#ifdef MAME_DEBUG +// popmessage("Layer priorities [%04x] - Txt: %i Spr: %i Gfx: %i Layer Pri0-3: %i %i %i %i",m_video.reg[1],m_video.text_pri,m_video.sprite_pri, +// m_video.gfx_pri,m_video.gfxlayer_pri[0],m_video.gfxlayer_pri[1],m_video.gfxlayer_pri[2],m_video.gfxlayer_pri[3]); +// popmessage("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i",m_crtc.reg[0],m_crtc.reg[1],m_crtc.reg[2],m_crtc.reg[3], +// m_crtc.reg[4],m_crtc.reg[5],m_crtc.reg[6],m_crtc.reg[7],m_crtc.reg[8],m_crtc.reg[9]); +// popmessage("Visible resolution = %ix%i (%s) Screen size = %ix%i",m_crtc.visible_width,m_crtc.visible_height,m_crtc.interlace ? "Interlaced" : "Non-interlaced",m_crtc.video_width,m_crtc.video_height); +// popmessage("VBlank : scanline = %i",m_scanline); +// popmessage("CRTC/BG compare H-TOTAL %i/%i H-DISP %i/%i V-DISP %i/%i BG Res %02x",m_crtc.reg[0],m_spritereg[0x405],m_crtc.reg[2],m_spritereg[0x406], +// m_crtc.reg[6],m_spritereg[0x407],m_spritereg[0x408]); +// popmessage("BG Scroll - BG0 X %i Y %i BG1 X %i Y %i",m_spriteram[0x400],m_spriteram[0x401],m_spriteram[0x402],m_spriteram[0x403]); +// popmessage("uPD72065 status = %02x",upd765_status_r(machine(), space, 0)); +// popmessage("Layer enable - 0x%02x",m_video.reg[2] & 0xff); +// popmessage("Graphic layer scroll - %i, %i - %i, %i - %i, %i - %i, %i", +// m_crtc.reg[12],m_crtc.reg[13],m_crtc.reg[14],m_crtc.reg[15],m_crtc.reg[16],m_crtc.reg[17],m_crtc.reg[18],m_crtc.reg[19]); +// popmessage("IOC IRQ status - %02x",m_ioc.irqstatus); +// popmessage("RAM: mouse data - %02x %02x %02x %02x",m_ram->pointer()[0x931],m_ram->pointer()[0x930],m_ram->pointer()[0x933],m_ram->pointer()[0x932]); +#endif + return 0; +} diff --git a/src/mame/video/z88.c b/src/mame/video/z88.c new file mode 100644 index 00000000000..4b9a0b07f88 --- /dev/null +++ b/src/mame/video/z88.c @@ -0,0 +1,175 @@ +// license:GPL-2.0+ +// copyright-holders:Kevin Thacker,Sandro Ronco +/*************************************************************************** + + z88.c + + Functions to emulate the video hardware of the Cambridge Z88 + +***************************************************************************/ + +#include "includes/z88.h" + + +inline void z88_state::plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT16 color) +{ + if (xset_pen_color(0, rgb_t(138, 146, 148)); + m_palette->set_pen_color(1, rgb_t(92, 83, 88)); + m_palette->set_pen_color(2, rgb_t(122, 126, 129)); +} + +/* temp - change to gfxelement structure */ + +void z88_state::vh_render_8x8(bitmap_ind16 &bitmap, int x, int y, UINT16 pen0, UINT16 pen1, UINT8 *gfx) +{ + for (int h=0; h<8; h++) + { + UINT8 data = gfx[h]; + + for (int b=0; b<8; b++) + { + plot_pixel(bitmap, x+b, y+h, (data & 0x80) ? pen1 : pen0); + + data = data<<1; + } + } +} + +void z88_state::vh_render_6x8(bitmap_ind16 &bitmap, int x, int y, UINT16 pen0, UINT16 pen1, UINT8 *gfx) +{ + for (int h=0; h<8; h++) + { + UINT8 data = gfx[h]<<2; + + for (int b=0; b<6; b++) + { + plot_pixel(bitmap, x+1+b, y+h, (data & 0x80) ? pen1 : pen0); + data = data<<1; + } + } +} + +void z88_state::vh_render_line(bitmap_ind16 &bitmap, int x, int y, UINT16 pen) +{ + for (int i=0; i<8; i++) + plot_pixel(bitmap, x + i, y + 7, pen); +} + +UPD65031_SCREEN_UPDATE(z88_state::lcd_update) +{ + if (sbf == 0) + { + // LCD disabled + bitmap.fill(0); + } + else + { + UINT8 *vram = convert_address(sbf<<11); + + for (int y=0; y<(Z88_SCREEN_HEIGHT>>3); y++) + { + int x = 0, c = 0; + + while (x < Z88_SCREEN_WIDTH) + { + UINT16 pen0, pen1; + UINT8 *char_gfx; + UINT8 byte0 = vram[(y * 0x100) + c]; + UINT8 byte1 = vram[(y * 0x100) + c + 1]; + + // inverted graphics? + if (byte1 & Z88_SCR_HW_REV) + { + pen0 = (byte1 & Z88_SCR_HW_GRY) ? 2 : 1; + pen1 = 0; + } + else + { + pen0 = 0; + pen1 = (byte1 & Z88_SCR_HW_GRY) ? 2 : 1; + } + + if ((byte1 & Z88_SCR_HW_NULL) == Z88_SCR_HW_NULL) + { + // hidden + } + else if (!(byte1 & Z88_SCR_HW_HRS) || (((byte1 & Z88_SCR_HW_CURS) == Z88_SCR_HW_CURS))) + { + // low-res 6x8 + UINT16 ch = (byte0 | (byte1<<8)) & 0x1ff; + + if ((ch & 0x01c0) == 0x01c0) + { + ch &= 0x3f; + + char_gfx = convert_address(lores0<<9); + } + else + { + char_gfx = convert_address(lores1<<12); + } + + char_gfx += (ch<<3); + + // cursor flash + if (flash && (byte1 & Z88_SCR_HW_CURS) == Z88_SCR_HW_CURS) + vh_render_6x8(bitmap, x,(y<<3), pen1, pen0, char_gfx); + else + vh_render_6x8(bitmap, x,(y<<3), pen0, pen1, char_gfx); + + // underline? + if (byte1 & Z88_SCR_HW_UND) + vh_render_line(bitmap, x, (y<<3), pen1); + + x += 6; + } + else if ((byte1 & Z88_SCR_HW_HRS) && !(byte1 & Z88_SCR_HW_REV)) + { + // high-res 8x8 + UINT16 ch = (byte0 | (byte1<<8)) & 0x3ff; + + if (ch & 0x0100) + { + ch &= 0xff; + char_gfx = convert_address(hires1<<11); + } + else + { + ch &= 0xff; + char_gfx = convert_address(hires0<<13); + } + + char_gfx += (ch<<3); + + // flash + if ((byte1 & Z88_SCR_HW_FLS) && flash) + pen0 = pen1 = 0; + + vh_render_8x8(bitmap, x,(y<<3), pen0, pen1, char_gfx); + + x += 8; + } + + // every char takes 2 bytes + c += 2; + } + } + } +} diff --git a/src/mame/video/zx.c b/src/mame/video/zx.c new file mode 100644 index 00000000000..8948a395246 --- /dev/null +++ b/src/mame/video/zx.c @@ -0,0 +1,223 @@ +// license:GPL-2.0+ +// copyright-holders:Juergen Buchmueller, Krzysztof Strzecha, Robbbert +/*************************************************************************** + zx.c + + video hardware + Juergen Buchmueller , Dec 1999 + + The ZX has a very unorthodox video RAM system. To start a scanline, + the CPU must jump to video RAM at 0xC000, which is a mirror of the + RAM at 0x4000. The video chip (ULA?) pulls a switcharoo and changes + the video bytes as they are fetched by the CPU. + + The video chip draws the scanline until a HALT instruction (0x76) is + reached, which indicates no further video RAM for this scanline. Any + other video byte is used to generate a tile and at the same time, + appears to the CPU as a NOP (0x00) instruction. + +****************************************************************************/ + +#include "includes/zx.h" + + +void zx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_TAPE_PULSE: + zx_tape_pulse(ptr, param); + break; + case TIMER_ULA_NMI: + zx_ula_nmi(ptr, param); + break; + case TIMER_ULA_IRQ: + zx_ula_irq(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in zx_state::device_timer"); + } +} + + +/* + * Toggle the video output between black and white. + * This happens whenever the ULA scanline IRQs are enabled/disabled. + * Normally this is done during the synchronized zx_ula_r() function, + * which outputs 8 pixels per code, but if the video sync is off + * (during tape IO or sound output) zx_ula_bkgnd() is used to + * simulate the display of a ZX80/ZX81. + */ +void zx_state::zx_ula_bkgnd(UINT8 color) +{ + int width = m_screen->width(); + int height = m_screen->height(); + const rectangle &visarea = m_screen->visible_area(); + + if (m_ula_frame_vsync == 0 && color != m_old_c) + { + int y, new_x, new_y; + rectangle r; + bitmap_ind16 &bitmap = m_bitmap; + + new_y = machine().first_screen()->vpos(); + new_x = machine().first_screen()->hpos(); +/* logerror("zx_ula_bkgnd: %3d,%3d - %3d,%3d\n", state->m_old_x, state->m_old_y, new_x, new_y);*/ + y = m_old_y; + for (;;) + { + if (y == new_y) + { + r.set(m_old_x, new_x, y, y); + bitmap.fill(color, r); + break; + } + else + { + r.set(m_old_x, visarea.max_x, y, y); + bitmap.fill(color, r); + m_old_x = 0; + } + if (++y == height) + y = 0; + } + m_old_x = (new_x + 1) % width; + m_old_y = new_y; + m_old_c = color; + } +} + +/* + * PAL: 310 total lines, + * 0.. 55 vblank + * 56..247 192 visible lines + * 248..303 vblank + * 304... vsync + * NTSC: 262 total lines + * 0.. 31 vblank + * 32..223 192 visible lines + * 224..233 vblank + */ +TIMER_CALLBACK_MEMBER(zx_state::zx_ula_nmi) +{ + /* + * An NMI is issued on the ZX81 every 64us for the blanked + * scanlines at the top and bottom of the display. + */ + int height = m_screen->height(); + const rectangle& r1 = m_screen->visible_area(); + rectangle r; + + bitmap_ind16 &bitmap = m_bitmap; + r.set(r1.min_x, r1.max_x, m_ula_scanline_count, m_ula_scanline_count); + bitmap.fill(1, r); +// logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine().first_screen()->vpos(), ula_scancode_count, (unsigned) m_maincpu->state_int(Z80_R), (unsigned) m_maincpu->state_int(Z80_PC)); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (++m_ula_scanline_count == height) + m_ula_scanline_count = 0; +} + +TIMER_CALLBACK_MEMBER(zx_state::zx_ula_irq) +{ + /* + * An IRQ is issued on the ZX80/81 whenever the R registers + * bit 6 goes low. In MESS this IRQ timed from the first read + * from the copy of the DFILE in the upper 32K in zx_ula_r(). + */ + if (m_ula_irq_active) + { +// logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", machine().first_screen()->vpos(), ula_scancode_count, (unsigned) m_maincpu->state_int(Z80_R), (unsigned) m_maincpu->state_int(Z80_PC)); + + m_ula_irq_active = 0; + m_maincpu->set_input_line(0, HOLD_LINE); + } +} + +void zx_state::zx_ula_r(int offs, memory_region *region, const UINT8 param) +{ + int offs0 = offs & 0x7fff; + UINT8 *rom = m_region_maincpu->base(); + UINT8 chr = rom[offs0]; + + if ((!m_ula_irq_active) && (chr == 0x76)) + { + bitmap_ind16 &bitmap = m_bitmap; + UINT16 y, *scanline; + UINT16 ireg = m_maincpu->state_int(Z80_I) << 8; + UINT8 data, *chrgen, creg; + + if (param) + creg = m_maincpu->state_int(Z80_B); + else + creg = m_maincpu->state_int(Z80_C); + + chrgen = region->base(); + + if ((++m_ula_scanline_count == m_screen->height()) || (creg == 32)) + { + m_ula_scanline_count = 0; + m_offs1 = offs0; + } + + m_ula_frame_vsync = 3; + + m_charline_ptr = 0; + + for (y = m_offs1+1; ((y < offs0) && (m_charline_ptr < ARRAY_LENGTH(m_charline))); y++) + { + m_charline[m_charline_ptr] = rom[y]; + m_charline_ptr++; + } + for (y = m_charline_ptr; y < ARRAY_LENGTH(m_charline); y++) + m_charline[y] = 0; + + timer_set(m_maincpu->cycles_to_attotime(((32 - m_charline_ptr) << 2)), TIMER_ULA_IRQ); + m_ula_irq_active++; + + scanline = &bitmap.pix16(m_ula_scanline_count); + y = 0; + + for (m_charline_ptr = 0; m_charline_ptr < ARRAY_LENGTH(m_charline); m_charline_ptr++) + { + chr = m_charline[m_charline_ptr]; + data = chrgen[ireg | ((chr & 0x3f) << 3) | ((8 - creg)&7) ]; + if (chr & 0x80) data ^= 0xff; + + scanline[y++] = (data >> 7) & 1; + scanline[y++] = (data >> 6) & 1; + scanline[y++] = (data >> 5) & 1; + scanline[y++] = (data >> 4) & 1; + scanline[y++] = (data >> 3) & 1; + scanline[y++] = (data >> 2) & 1; + scanline[y++] = (data >> 1) & 1; + scanline[y++] = (data >> 0) & 1; + m_charline[m_charline_ptr] = 0; + } + + if (creg == 1) m_offs1 = offs0; + } +} + +void zx_state::video_start() +{ + m_ula_nmi = timer_alloc(TIMER_ULA_NMI); + m_ula_irq_active = 0; + m_screen->register_screen_bitmap(m_bitmap); +} + +void zx_state::screen_eof_zx(screen_device &screen, bool state) +{ + // rising edge + if (state) + { + /* decrement video synchronization counter */ + if (m_ula_frame_vsync) + --m_ula_frame_vsync; + } +} + +UINT32 zx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + return 0; +} diff --git a/src/mame/video/zx8301.c b/src/mame/video/zx8301.c new file mode 100644 index 00000000000..a7c115e8237 --- /dev/null +++ b/src/mame/video/zx8301.c @@ -0,0 +1,334 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Sinclair ZX8301 emulation + +**********************************************************************/ + +/* + + TODO: + + - wait state on memory access during video update + - proper video timing + - get rid of flash timer + +*/ + +#include "zx8301.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + + +// low resolution palette +static const int ZX8301_COLOR_MODE4[] = { 0, 2, 4, 7 }; + + +static const rgb_t PALETTE_ZX8301[] = +{ + rgb_t(0x00, 0x00, 0x00), // black + rgb_t(0x00, 0x00, 0xff), // blue + rgb_t(0xff, 0x00, 0x00), // red + rgb_t(0xff, 0x00, 0xff), // magenta + rgb_t(0x00, 0xff, 0x00), // green + rgb_t(0x00, 0xff, 0xff), // cyan + rgb_t(0xff, 0xff, 0x00), // yellow + rgb_t(0xff, 0xff, 0xff) // white +}; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// devices +const device_type ZX8301 = &device_creator; + + +// default address map +static ADDRESS_MAP_START( zx8301, AS_0, 8, zx8301_device ) + AM_RANGE(0x00000, 0x1ffff) AM_RAM +ADDRESS_MAP_END + + +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *zx8301_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == AS_0) ? &m_space_config : NULL; +} + + + +//************************************************************************** +// INLINE HELPERS +//************************************************************************** + +//------------------------------------------------- +// readbyte - read a byte at the given address +//------------------------------------------------- + +inline UINT8 zx8301_device::readbyte(offs_t address) +{ + return space().read_byte(address); +} + + +//------------------------------------------------- +// writebyte - write a byte at the given address +//------------------------------------------------- + +inline void zx8301_device::writebyte(offs_t address, UINT8 data) +{ + space().write_byte(address, data); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// zx8301_device - constructor +//------------------------------------------------- + +zx8301_device::zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ZX8301, "Sinclair ZX8301", tag, owner, clock, "zx8301", __FILE__), + device_memory_interface(mconfig, *this), + device_video_interface(mconfig, *this), + m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(zx8301)), + m_cpu(*this), + m_write_vsync(*this), + m_dispoff(1), + m_mode8(0), + m_base(0), + m_flash(1), + m_vsync(1), + m_vda(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zx8301_device::device_start() +{ + // resolve callbacks + m_write_vsync.resolve_safe(); + + // allocate timers + m_vsync_timer = timer_alloc(TIMER_VSYNC); + m_flash_timer = timer_alloc(TIMER_FLASH); + + // adjust timer periods + m_vsync_timer->adjust(attotime::zero, 0, attotime::from_hz(50)); + m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); + + // register for state saving + save_item(NAME(m_dispoff)); + save_item(NAME(m_mode8)); + save_item(NAME(m_base)); + save_item(NAME(m_flash)); + save_item(NAME(m_vsync)); + save_item(NAME(m_vda)); +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void zx8301_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_VSYNC: + //m_vsync = !m_vsync; + m_write_vsync(m_vsync); + break; + + case TIMER_FLASH: + m_flash = !m_flash; + break; + } +} + + +//------------------------------------------------- +// control_w - display control register +//------------------------------------------------- + +WRITE8_MEMBER( zx8301_device::control_w ) +{ + /* + + bit description + + 0 + 1 display off + 2 + 3 graphics mode + 4 + 5 + 6 + 7 display base address + + */ + + if (LOG) logerror("ZX8301 Control: %02x\n", data); + + // display off + m_dispoff = BIT(data, 1); + + // graphics mode + m_mode8 = BIT(data, 3); + + // display base address + m_base = BIT(data, 7); +} + + +//------------------------------------------------- +// data_r - RAM read +//------------------------------------------------- + +READ8_MEMBER( zx8301_device::data_r ) +{ + if (LOG) logerror("ZX8301 RAM Read: %06x\n", offset); + + if (m_vda) + { + m_cpu->spin_until_time(m_screen->time_until_pos(256, 0)); + } + + return readbyte(offset); +} + + +//------------------------------------------------- +// data_w - RAM write +//------------------------------------------------- + +WRITE8_MEMBER( zx8301_device::data_w ) +{ + if (LOG) logerror("ZX8301 RAM Write: %06x = %02x\n", offset, data); + + if (m_vda) + { + m_cpu->spin_until_time(m_screen->time_until_pos(256, 0)); + } + + writebyte(offset, data); +} + + +//------------------------------------------------- +// draw_line_mode4 - draw mode 4 line +//------------------------------------------------- + +void zx8301_device::draw_line_mode4(bitmap_rgb32 &bitmap, int y, UINT16 da) +{ + int x = 0; + + for (int word = 0; word < 64; word++) + { + UINT8 byte_high = readbyte(da++); + UINT8 byte_low = readbyte(da++); + + for (int pixel = 0; pixel < 8; pixel++) + { + int red = BIT(byte_low, 7); + int green = BIT(byte_high, 7); + int color = (green << 1) | red; + + bitmap.pix32(y, x++) = PALETTE_ZX8301[ZX8301_COLOR_MODE4[color]]; + + byte_high <<= 1; + byte_low <<= 1; + } + } +} + + +//------------------------------------------------- +// draw_line_mode8 - draw mode 8 line +//------------------------------------------------- + +void zx8301_device::draw_line_mode8(bitmap_rgb32 &bitmap, int y, UINT16 da) +{ + int x = 0; + + for (int word = 0; word < 64; word++) + { + UINT8 byte_high = readbyte(da++); + UINT8 byte_low = readbyte(da++); + + for (int pixel = 0; pixel < 4; pixel++) + { + int red = BIT(byte_low, 7); + int green = BIT(byte_high, 7); + int blue = BIT(byte_low, 6); + int flash = BIT(byte_high, 6); + + int color = (green << 2) | (red << 1) | blue; + + if (flash && m_flash) + { + color = 0; + } + + bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; + bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; + + byte_high <<= 2; + byte_low <<= 2; + } + } +} + + +//------------------------------------------------- +// screen_update - +//------------------------------------------------- + +UINT32 zx8301_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (!m_dispoff) + { + UINT32 da = m_base << 15; + + for (int y = 0; y < 256; y++) + { + if (m_mode8) + { + draw_line_mode8(bitmap, y, da); + } + else + { + draw_line_mode4(bitmap, y, da); + } + + da += 128; + } + } + else + { + bitmap.fill(rgb_t::black, cliprect); + } + + return 0; +} diff --git a/src/mame/video/zx8301.h b/src/mame/video/zx8301.h new file mode 100644 index 00000000000..c91b1c65bca --- /dev/null +++ b/src/mame/video/zx8301.h @@ -0,0 +1,123 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Sinclair ZX8301 emulation + +********************************************************************** + _____ _____ + DTACKL 1 |* \_/ | 40 WEL + A17 2 | | 39 PCENL + A16 3 | | 38 VDA + RDWL 4 | | 37 ROWL + DSMCL 5 | | 36 TX0EL + VCC 6 | | 35 XTAL2 + CLKCPU 7 | | 34 XTAL1 + RASL 8 | | 33 ROM0EH + CAS0L 9 | | 32 BLUE + CAS1L 10 | ZX8301 | 31 GREEN + VSYNCH 11 | ULA | 30 RED + CSYNCL 12 | | 29 DB7 + DA0 13 | | 28 DA7 + DB0 14 | | 27 DA6 + VDD 15 | | 26 DB6 + DB1 16 | | 25 DB5 + DA1 17 | | 24 DA5 + DA2 18 | | 23 DB4 + DB2 19 | | 22 DA4 + DA3 20 |_____________| 21 DB3 + +**********************************************************************/ + +#pragma once + +#ifndef __ZX8301__ +#define __ZX8301__ + +#include "emu.h" + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_ZX8301_CPU(_tag) \ + zx8301_device::static_set_cpu_tag(*device, "^" _tag); + +#define MCFG_ZX8301_VSYNC_CALLBACK(_write) \ + devcb = &zx8301_device::set_vsync_wr_callback(*device, DEVCB_##_write); + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> zx8301_device + +class zx8301_device : public device_t, + public device_memory_interface, + public device_video_interface +{ +public: + // construction/destruction + zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template static devcb_base &set_vsync_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_vsync.set_callback(object); } + static void static_set_cpu_tag(device_t &device, const char *tag) { downcast(device).m_cpu.set_tag(tag); } + + DECLARE_WRITE8_MEMBER( control_w ); + DECLARE_READ8_MEMBER( data_r ); + DECLARE_WRITE8_MEMBER( data_w ); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // device_config_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + + // address space configurations + const address_space_config m_space_config; + + inline UINT8 readbyte(offs_t address); + inline void writebyte(offs_t address, UINT8 data); + + void draw_line_mode4(bitmap_rgb32 &bitmap, int y, UINT16 da); + void draw_line_mode8(bitmap_rgb32 &bitmap, int y, UINT16 da); + +private: + enum + { + TIMER_VSYNC, + TIMER_FLASH + }; + + required_device m_cpu; + + devcb_write_line m_write_vsync; + + //address_space *m_data; + + int m_dispoff; // display off + int m_mode8; // mode8 active + int m_base; // video ram base address + int m_flash; // flash + int m_vsync; // vertical sync + int m_vda; // valid data address + + emu_timer *m_vsync_timer; // vertical sync timer + emu_timer *m_flash_timer; // flash timer +}; + + +// device type definition +extern const device_type ZX8301; + + + +#endif diff --git a/src/mess/audio/alesis.c b/src/mess/audio/alesis.c deleted file mode 100644 index 7a253db43a2..00000000000 --- a/src/mess/audio/alesis.c +++ /dev/null @@ -1,157 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Alesis HR-16 sound (DM3AG + PCM54) emulation - - TODO: - - volume - - panning - - output 2 - -****************************************************************************/ - -#include "emu.h" -#include "includes/alesis.h" - -#define LOG 1 - -// device type definition -const device_type ALESIS_DM3AG = &device_creator; - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -static MACHINE_CONFIG_FRAGMENT( alesis_dm3ag ) - MCFG_SPEAKER_STANDARD_STEREO("out1_left", "out1_right") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "out1_left", 1.0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "out1_right", 1.0) -MACHINE_CONFIG_END - -//------------------------------------------------- -// alesis_dm3ag_device - constructor -//------------------------------------------------- - -alesis_dm3ag_device::alesis_dm3ag_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ALESIS_DM3AG, "Alesis DM3AG", tag, owner, clock, "alesis_dm3ag", __FILE__), - m_dac(*this, "dac"), - m_samples(*this, DEVICE_SELF) -{ -} - -//------------------------------------------------- -// device_mconfig_additions -//------------------------------------------------- - -machine_config_constructor alesis_dm3ag_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( alesis_dm3ag ); -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void alesis_dm3ag_device::device_start() -{ - m_dac_update_timer = timer_alloc(TIMER_DAC_UPDATE); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void alesis_dm3ag_device::device_reset() -{ - m_dac_update_timer->adjust(attotime::from_hz(48000), 0, attotime::from_hz(48000)); - - m_output_active = false; - m_count = 0; - m_cur_sample = 0; - m_shift = 0; - memset(m_cmd, 0, sizeof(m_cmd)); -} - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- -void alesis_dm3ag_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if (m_output_active) - { - INT16 sample = m_samples[m_cur_sample++]; - int count = 0; - - while (sample == -128) - { - count++; - - if (count == 1 && m_shift) - { - /* - The HR-16 seems to use a simple scheme to generate 16-bit samples from its 8-bit sample ROMs. - When the sound starts the 8-bit sample is sent to the most significant bits of the DAC and every - time a -1 sample is found the data is shifted one position to right. - */ - m_shift--; - - if (LOG) logerror("DM3AG '%s' shift: %02x\n", tag(), m_shift); - } - - // every block ends with three or more -1 samples - if (m_cur_sample == 0xfffff || count >= 3) - { - m_output_active = false; - sample = 0; - - if (LOG) logerror("DM3AG '%s' stop: %d, len: %d\n", tag(), m_cur_sample, m_cur_sample-((m_cmd[0]<<12) | (m_cmd[1]<<4) | ((m_cmd[2]>>4) & 0x0f))); - - break; - } - - sample = m_samples[m_cur_sample++]; - } - - m_dac->write_signed16((sample << m_shift) + 0x8000); - } -} - -WRITE8_MEMBER(alesis_dm3ag_device::write) -{ - if (LOG) logerror("DM3AG '%s' write: %02x\n", tag(), data); - - m_cmd[m_count++] = data; - - if (m_count == 5) - { - /* - commands are sent in block of 5 bytes (40 bits) - - bit 00-19 sample position in the roms - bit 20-23 ??? - bit 24-31 volume - bit 32-34 panning - bit 35 output selector: 0 = out2, 1 = out1 - bit 36-39 ??? - */ - - m_cur_sample = (m_cmd[0]<<12) | (m_cmd[1]<<4) | ((m_cmd[2]>>4) & 0x0f); - - if (m_cur_sample > 0) - { - m_output_active = true; - m_shift = 8; - - if (LOG) - { - bool good_pos = (m_cur_sample<2 || m_samples[m_cur_sample-2] == -128); - - logerror("DM3AG '%s' start: %d (%s), vol: %02x out: %d pan: %d\n", tag(), m_cur_sample, good_pos ? "ok": "no", m_cmd[3], m_cmd[4] & 0x10 ? 1 : 2, (m_cmd[4]>>5)&7); - } - } - - m_count = 0; - } -} diff --git a/src/mess/audio/arcadia.c b/src/mess/audio/arcadia.c deleted file mode 100644 index 306932a0b44..00000000000 --- a/src/mess/audio/arcadia.c +++ /dev/null @@ -1,177 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:David Viens, Peter Trauner -/*************************************************************************** - - PeT mess@utanet.at - main part in video/ - - Refined with recording/analysis on MPT-03 (PAL UVI chip) by plgDavid - - NTSC UVI sound clock: 15734Hz (arcadia) - PAL UVI sound clock: 15625Hz (Soundic MPT-03 - owned by plgDavid) -***************************************************************************/ - - -#include "includes/arcadia.h" - -//known UVI audio clocks -#define UVI_NTSC 15734 -#define UVI_PAL 15625 - -/* we need to create pulse transitions that sound 'decent' - with the current mess/mame interp scheme - - this is not needed anymore with the new trick in streams.c -*/ - -#define OSAMP 1 - -//lfsr is 9 bits long (and same as Atari TIA pure noise) -#define LFSR_MASK (1<<8) - -//makes alien invaders samples noise sync. -#define LFSR_INIT 0x00f0 - -//lfsr states at resynch borders -//0x01c1 -//0x01e0 -//0x00f0 //good synch -//0x0178 -//0x01bc - - -// device type definition -const device_type ARCADIA_SOUND = &device_creator; - -//------------------------------------------------- -// arcadia_sound_device - constructor -//------------------------------------------------- - -arcadia_sound_device::arcadia_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ARCADIA_SOUND, "Arcadia Audio Custom", tag, owner, clock, "arcadia_sound", __FILE__), - device_sound_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- -void arcadia_sound_device::device_start() -{ - m_channel = machine().sound().stream_alloc(*this, 0, 1, UVI_PAL*OSAMP); - m_lfsr = LFSR_INIT; - m_tval = 1; - logerror("arcadia_sound start\n"); -} - -//------------------------------------------------- -// device_start - device-specific reset -//------------------------------------------------- -void arcadia_sound_device::device_reset() -{ - memset(m_reg, 0, sizeof(m_reg)); - m_omode = 0; - m_pos = 0; -} - -//------------------------------------------------- -// sound_stream_update - handle update requests for -// our sound stream -//------------------------------------------------- - -void arcadia_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - int i; - stream_sample_t *buffer = outputs[0]; - - for (i = 0; i < samples; i++, buffer++) - { - *buffer = 0; - - //if minimal pitch ? - if (m_reg[1]){ - switch (m_mode){ - //dont play anything - case 0:break; - - //tone only - case 1: - *buffer = m_volume * m_tval; - break; - - //noise only - case 2: - *buffer = m_volume * m_nval; - break; - - //tone AND noise (bitwise and) - case 3: - *buffer = m_volume * (m_tval & m_nval); - break; - } - - //counter - m_pos++; - - if (m_pos >= m_size){ - //calculate new noise bit ( taps: 0000T000T) - unsigned char newBit = m_lfsr & 1; //first tap - newBit = (newBit ^ ((m_lfsr & 0x10)?1:0) );//xor with second tap - - m_nval = m_lfsr & 1; //taking new output from LSB - m_lfsr = m_lfsr >> 1;//shifting - - //insert new bit at end position (size-1) (only if non null) - if (newBit) - m_lfsr |= LFSR_MASK; - - //invert tone - m_tval = !m_tval; - - m_pos = 0; - } - } - } -} - - - -//------------------------------------------------- -// soundport_w -//------------------------------------------------- - -WRITE8_MEMBER(arcadia_sound_device::write) -{ - m_channel->update(); - m_reg[offset] = data; - - //logerror("arcadia_sound write:%x=%x\n",offset,data); - - switch (offset) - { - case 1: - //as per Gobbler samples: - //the freq counter is only applied on the next change in the flip flop - m_size = (data & 0x7f)*OSAMP; - //logerror("arcadia_sound write: frq:%d\n",data); - - //reset LFSR - if(!m_size) - m_lfsr = LFSR_INIT; - break; - - case 2: - m_volume = (data & 0x07) * 0x800; - m_mode = (data & 0x18) >> 3; - - //logerror("arcadia_sound write: vol:%d mode:%d\n",m_volume,m_mode ); - - if (m_mode != m_omode){ - //not 100% sure about this, maybe we should not reset anything - //m_pos = 0; - m_tval = 0; - } - m_omode = m_mode; - break; - } -} diff --git a/src/mess/audio/arcadia.h b/src/mess/audio/arcadia.h deleted file mode 100644 index fa54ba1c0a1..00000000000 --- a/src/mess/audio/arcadia.h +++ /dev/null @@ -1,44 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#ifndef ARCADIA_SOUND_H_ -#define ARCADIA_SOUND_H_ - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_ARCADIA_SOUND_ADD(_tag) \ - MCFG_SOUND_ADD(_tag, ARCADIA_SOUND, 0) - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> arcadia_sound_device - -class arcadia_sound_device : public device_t, - public device_sound_interface -{ -public: - // construction/destruction - arcadia_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_WRITE8_MEMBER(write); -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - - sound_stream *m_channel; - UINT8 m_reg[3]; - int m_size, m_pos,m_tval,m_nval; - unsigned m_mode, m_omode; - unsigned m_volume; - unsigned m_lfsr; -}; - -// device type definition -extern const device_type ARCADIA_SOUND; - -#endif /* ARCADIA_SOUND_H_ */ diff --git a/src/mess/audio/channelf.c b/src/mess/audio/channelf.c deleted file mode 100644 index c9e07cbd43c..00000000000 --- a/src/mess/audio/channelf.c +++ /dev/null @@ -1,143 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle -#include "emu.h" -#include "audio/channelf.h" - - -#define MAX_AMPLITUDE 0x7fff - -const device_type CHANNELF_SOUND = &device_creator; - -channelf_sound_device::channelf_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, CHANNELF_SOUND, "Channel F Sound", tag, owner, clock, "channelf_sound", __FILE__), - device_sound_interface(mconfig, *this), - m_channel(NULL), - m_sound_mode(0), - m_incr(0), - m_decay_mult(0), - m_envelope(0), - m_sample_counter(0), - m_forced_ontime(0), - m_min_ontime(0) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void channelf_sound_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void channelf_sound_device::device_start() -{ - int rate; - - m_channel = stream_alloc(0, 1, machine().sample_rate()); - rate = machine().sample_rate(); - - /* - * 2V = 1000Hz ~= 3579535/224/16 - * Note 2V on the schematic is not the 2V scanline counter - - * it is the 2V vertical pixel counter - * 1 pixel = 4 scanlines high - * - * - * This is a convenient way to generate the relevant frequencies, - * using a DDS (Direct Digital Synthesizer) - * - * Essentially, you want a counter to overflow some bit position - * at a fixed rate. So, you figure out a number which you can add - * to the counter at every sample, so that you will achieve this - * - * In this case, we want to overflow bit 16 and the 2V rate, 1000Hz. - * This means we also get bit 17 = 4V, bit 18 = 8V, etc. - */ - - /* This is the proper value to add per sample */ - m_incr = 65536.0/(rate/1000.0/2.0); - - // added for improved sound - /* This is the minimum forced ontime, in samples */ - m_min_ontime = rate/1000*2; /* approx 2ms - estimated, not verified on HW */ - - /* This was measured, decay envelope with half life of ~9ms */ - /* (this is decay multiplier per sample) */ - m_decay_mult = exp((-0.693/9e-3)/rate); - - /* initial conditions */ - m_envelope = 0; -} - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void channelf_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - UINT32 mask = 0, target = 0; - stream_sample_t *buffer = outputs[0]; - stream_sample_t *sample = buffer; - - switch( m_sound_mode ) - { - case 0: /* sound off */ - memset(buffer,0,sizeof(*buffer)*samples); - return; - - case 1: /* high tone (2V) - 1000Hz */ - mask = 0x00010000; - target = 0x00010000; - break; - case 2: /* medium tone (4V) - 500Hz */ - mask = 0x00020000; - target = 0x00020000; - break; - case 3: /* low (weird) tone (32V & 8V) */ - mask = 0x00140000; - target = 0x00140000; - break; - } - - while (samples-- > 0) - { - if ((m_forced_ontime > 0) || ((m_sample_counter & mask) == target)) // change made for improved sound - *sample++ = m_envelope; - else - *sample++ = 0; - m_sample_counter += m_incr; - m_envelope *= m_decay_mult; - if (m_forced_ontime > 0) // added for improved sound - m_forced_ontime -= 1; // added for improved sound - } -} - -void channelf_sound_device::sound_w(int mode) -{ - if (mode == m_sound_mode) - return; - - m_channel->update(); - m_sound_mode = mode; - - switch(mode) - { - case 0: - m_envelope = 0; - m_forced_ontime = 0; // added for improved sound - break; - case 1: - case 2: - case 3: - m_envelope = MAX_AMPLITUDE; - m_forced_ontime = m_min_ontime; // added for improved sound - break; - } -} diff --git a/src/mess/audio/channelf.h b/src/mess/audio/channelf.h deleted file mode 100644 index f227eb67c07..00000000000 --- a/src/mess/audio/channelf.h +++ /dev/null @@ -1,42 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle -/***************************************************************************** - * - * audio/channelf.h - * - ****************************************************************************/ - -#ifndef CHANNELF_SOUND_H_ -#define CHANNELF_SOUND_H_ - -class channelf_sound_device : public device_t, - public device_sound_interface -{ -public: - channelf_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - void sound_w(int mode); -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); -private: - // internal state - sound_stream *m_channel; - int m_sound_mode; - int m_incr; - float m_decay_mult; - int m_envelope; - UINT32 m_sample_counter; - int m_forced_ontime; // added for improved sound - int m_min_ontime; // added for improved sound - -}; - -extern const device_type CHANNELF_SOUND; - - -#endif /* CHANNELF_SOUND_H_ */ diff --git a/src/mess/audio/dai_snd.c b/src/mess/audio/dai_snd.c deleted file mode 100644 index ae0bf3c79c3..00000000000 --- a/src/mess/audio/dai_snd.c +++ /dev/null @@ -1,141 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/*************************************************************************** - - audio/dai_snd.c - - Functions to emulate sound hardware of DAI Personal Computer - - Krzysztof Strzecha - -****************************************************************************/ - -#include "emu.h" -#include "dai_snd.h" - -// device type definition -const device_type DAI_SOUND = &device_creator; - - -//------------------------------------------------- -// dai_sound_device - constructor -//------------------------------------------------- - -dai_sound_device::dai_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, DAI_SOUND, "DAI Audio Custom", tag, owner, clock, "dai_sound", __FILE__), - device_sound_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void dai_sound_device::device_start() -{ - m_mixer_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void dai_sound_device::device_reset() -{ - memset(m_dai_input, 0, sizeof(m_dai_input)); - memset(m_osc_volume, 0, sizeof(m_osc_volume)); - m_noise_volume = 0; -} - - -//------------------------------------------------- -// channels 0/1/2 volume table -//------------------------------------------------- - -const UINT16 dai_sound_device::s_osc_volume_table[] = { - 0, 500, 1000, 1500, - 2000, 2500, 3000, 3500, - 4000, 4500, 5000, 5500, - 6000, 6500, 7000, 7500 -}; - -//------------------------------------------------- -// noise volume table -//------------------------------------------------- - -const UINT16 dai_sound_device::s_noise_volume_table[] = { - 0, 0, 0, 0, - 0, 0, 0, 0, - 500, 1000, 1500, 2000, - 2500, 3000, 3500, 4000 -}; - - -//------------------------------------------------- -// set_volume -//------------------------------------------------- - -WRITE8_MEMBER(dai_sound_device::set_volume) -{ - m_mixer_channel->update(); - - switch (offset & 1) - { - case 0x00: - m_osc_volume[0] = data&0x0f; - m_osc_volume[1] = (data&0xf0)>>4; - break; - - case 0x01: - m_osc_volume[2] = data&0x0f; - m_noise_volume = (data&0xf0)>>4; - } -} - -//------------------------------------------------- -// PIT callbacks -//------------------------------------------------- - -WRITE_LINE_MEMBER(dai_sound_device::set_input_ch0) -{ - m_mixer_channel->update(); - m_dai_input[0] = state; -} - -WRITE_LINE_MEMBER(dai_sound_device::set_input_ch1) -{ - m_mixer_channel->update(); - m_dai_input[1] = state; -} - -WRITE_LINE_MEMBER(dai_sound_device::set_input_ch2) -{ - m_mixer_channel->update(); - m_dai_input[2] = state; -} - -//------------------------------------------------- -// sound_stream_update - handle update requests for -// our sound stream -//------------------------------------------------- - -void dai_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t *sample_left = outputs[0]; - stream_sample_t *sample_right = outputs[1]; - - INT16 channel_0_signal = m_dai_input[0] ? s_osc_volume_table[m_osc_volume[0]] : -s_osc_volume_table[m_osc_volume[0]]; - INT16 channel_1_signal = m_dai_input[1] ? s_osc_volume_table[m_osc_volume[1]] : -s_osc_volume_table[m_osc_volume[1]]; - INT16 channel_2_signal = m_dai_input[2] ? s_osc_volume_table[m_osc_volume[2]] : -s_osc_volume_table[m_osc_volume[2]]; - - while (samples--) - { - INT16 noise = machine().rand()&0x01 ? s_noise_volume_table[m_noise_volume] : -s_noise_volume_table[m_noise_volume]; - - /* channel 0 + channel 1 + noise */ - *sample_left++ = channel_0_signal + channel_1_signal + noise; - - /* channel 1 + channel 2 + noise */ - *sample_right++ = channel_1_signal + channel_2_signal + noise; - } -} diff --git a/src/mess/audio/dai_snd.h b/src/mess/audio/dai_snd.h deleted file mode 100644 index c1e5ae598e7..00000000000 --- a/src/mess/audio/dai_snd.h +++ /dev/null @@ -1,46 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/***************************************************************************** - * - * dai_snd.h - * - ****************************************************************************/ - -#ifndef DAI_SND_H_ -#define DAI_SND_H_ - -#include "emu.h" - -// ======================> dai_sound_device - -class dai_sound_device : public device_t, - public device_sound_interface -{ -public: - // construction/destruction - dai_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_WRITE_LINE_MEMBER(set_input_ch0); - DECLARE_WRITE_LINE_MEMBER(set_input_ch1); - DECLARE_WRITE_LINE_MEMBER(set_input_ch2); - DECLARE_WRITE8_MEMBER(set_volume); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -private: - sound_stream * m_mixer_channel; - int m_dai_input[3]; - UINT8 m_osc_volume[3]; - UINT8 m_noise_volume; - - static const UINT16 s_osc_volume_table[]; - static const UINT16 s_noise_volume_table[]; -}; - -extern const device_type DAI_SOUND; - -#endif /* DAI_H_ */ diff --git a/src/mess/audio/dave.c b/src/mess/audio/dave.c deleted file mode 100644 index 4adae892e16..00000000000 --- a/src/mess/audio/dave.c +++ /dev/null @@ -1,622 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Intelligent Designs DAVE emulation - -**********************************************************************/ - -#include "dave.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - -#define STEP 0x08000 - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type DAVE = &device_creator; - - -DEVICE_ADDRESS_MAP_START( z80_program_map, 8, dave_device ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(program_r, program_w) -ADDRESS_MAP_END - -DEVICE_ADDRESS_MAP_START( z80_io_map, 8, dave_device ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(io_r, io_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, dave_device ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( io_map, AS_IO, 8, dave_device ) -ADDRESS_MAP_END - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// dave_device - constructor -//------------------------------------------------- - -dave_device::dave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, DAVE, "DAVE", tag, owner, clock, "dave", __FILE__), - device_memory_interface(mconfig, *this), - device_sound_interface(mconfig, *this), - m_program_space_config("program", ENDIANNESS_LITTLE, 8, 22, 0, *ADDRESS_MAP_NAME(program_map)), - m_io_space_config("i/o", ENDIANNESS_LITTLE, 8, 16, 0, *ADDRESS_MAP_NAME(io_map)), - m_write_irq(*this), - m_write_lh(*this), - m_write_rh(*this), - m_irq_status(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void dave_device::device_start() -{ - // resolve callbacks - m_write_irq.resolve_safe(); - m_write_lh.resolve_safe(); - m_write_rh.resolve_safe(); - - // allocate timers - m_timer_1hz = timer_alloc(TIMER_1HZ); - m_timer_1hz->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); - - m_timer_50hz = timer_alloc(TIMER_50HZ); - m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000)); - - // state saving - save_item(NAME(m_segment)); - save_item(NAME(m_irq_status)); - save_item(NAME(m_irq_enable)); - save_item(NAME(m_period)); - save_item(NAME(m_count)); - save_item(NAME(m_level)); - save_item(NAME(m_level_or)); - save_item(NAME(m_level_and)); - save_item(NAME(m_mame_volumes)); - - for (int i = 0; i < ARRAY_LENGTH(m_period); i++) - m_period[i] = (STEP * machine().sample_rate()) / 125000; - - for (int i = 0; i < ARRAY_LENGTH(m_count); i++) - m_count[i] = (STEP * machine().sample_rate()) / 125000; - - for (int i = 0; i < ARRAY_LENGTH(m_level); i++) - m_level[i] = 0; - - for (int i = 0; i < ARRAY_LENGTH(m_level_or); i++) - m_level_or[i] = 0; - - for (int i = 0; i < ARRAY_LENGTH(m_level_and); i++) - m_level_and[i] = 0; - - for (int i = 0; i < ARRAY_LENGTH(m_mame_volumes); i++) - m_mame_volumes[i] = 0; - - /* dave has 3 tone channels and 1 noise channel. - the volumes are mixed internally and output as left and right volume */ - - /* 3 tone channels + 1 noise channel */ - m_sound_stream_var = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void dave_device::device_reset() -{ - m_write_irq(CLEAR_LINE); - - for (int i = 0; i < 4; i++) - m_segment[i] = 0; - - m_irq_status = 0; - m_irq_enable = 0; - - for (int i = 0; i < 32; i++) - m_regs[i] = 0; -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void dave_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_1HZ: - m_irq_status ^= IRQ_1HZ_DIVIDER; - - if (m_irq_status & IRQ_1HZ_DIVIDER) - m_irq_status |= IRQ_1HZ_LATCH; - break; - - case TIMER_50HZ: - m_irq_status ^= IRQ_50HZ_DIVIDER; - - if (m_irq_status & IRQ_50HZ_DIVIDER) - m_irq_status |= IRQ_50HZ_LATCH; - break; - } - - update_interrupt(); -} - - -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *dave_device::memory_space_config(address_spacenum spacenum) const -{ - switch (spacenum) - { - case AS_PROGRAM: return &m_program_space_config; - case AS_IO: return &m_io_space_config; - default: return NULL; - } -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void dave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t *buffer1, *buffer2; - /* 0 = channel 0 left volume, 1 = channel 0 right volume, - 2 = channel 1 left volume, 3 = channel 1 right volume, - 4 = channel 2 left volume, 5 = channel 2 right volume - 6 = noise channel left volume, 7 = noise channel right volume */ - int output_volumes[8]; - int left_volume; - int right_volume; - - //logerror("sound update!\n"); - - buffer1 = outputs[0]; - buffer2 = outputs[1]; - - while (samples) - { - int vol[4]; - - /* vol[] keeps track of how long each square wave stays */ - /* in the 1 position during the sample period. */ - vol[0] = vol[1] = vol[2] = vol[3] = 0; - - for (int i = 0; i < 3; i++) - { - if ((m_regs[7] & (1 << i))==0) - { - if (m_level[i]) vol[i] += m_count[i]; - m_count[i] -= STEP; - /* Period[i] is the half period of the square wave. Here, in each */ - /* loop I add Period[i] twice, so that at the end of the loop the */ - /* square wave is in the same status (0 or 1) it was at the start. */ - /* vol[i] is also incremented by Period[i], since the wave has been 1 */ - /* exactly half of the time, regardless of the initial position. */ - /* If we exit the loop in the middle, Output[i] has to be inverted */ - /* and vol[i] incremented only if the exit status of the square */ - /* wave is 1. */ - while (m_count[i] <= 0) - { - m_count[i] += m_period[i]; - if (m_count[i] > 0) - { - m_level[i] ^= 0x0ffffffff; - if (m_level[i]) vol[i] += m_period[i]; - break; - } - m_count[i] += m_period[i]; - vol[i] += m_period[i]; - } - if (m_level[i]) - vol[i] -= m_count[i]; - } - } - - /* update volume outputs */ - - /* setup output volumes for each channel */ - /* channel 0 */ - output_volumes[0] = ((m_level[0] & m_level_and[0]) | m_level_or[0]) & m_mame_volumes[0]; - output_volumes[1] = ((m_level[0] & m_level_and[1]) | m_level_or[1]) & m_mame_volumes[4]; - /* channel 1 */ - output_volumes[2] = ((m_level[1] & m_level_and[2]) | m_level_or[2]) & m_mame_volumes[1]; - output_volumes[3] = ((m_level[1] & m_level_and[3]) | m_level_or[3]) & m_mame_volumes[5]; - /* channel 2 */ - output_volumes[4] = ((m_level[2] & m_level_and[4]) | m_level_or[4]) & m_mame_volumes[2]; - output_volumes[5] = ((m_level[2] & m_level_and[5]) | m_level_or[5]) & m_mame_volumes[6]; - /* channel 3 */ - output_volumes[6] = ((m_level[3] & m_level_and[6]) | m_level_or[6]) & m_mame_volumes[3]; - output_volumes[7] = ((m_level[3] & m_level_and[7]) | m_level_or[7]) & m_mame_volumes[7]; - - left_volume = (output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6])>>2; - right_volume = (output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7])>>2; - - *(buffer1++) = left_volume; - *(buffer2++) = right_volume; - - samples--; - } -} - - -//------------------------------------------------- -// int1_w - interrupt 1 write -//------------------------------------------------- - -WRITE_LINE_MEMBER( dave_device::int1_w ) -{ - if (!(m_irq_status & IRQ_INT1) && state) - m_irq_status |= IRQ_INT1_LATCH; - - if (state) - m_irq_status |= IRQ_INT1; - else - m_irq_status &= ~IRQ_INT1; - - update_interrupt(); -} - - -//------------------------------------------------- -// int2_w - interrupt 2 write -//------------------------------------------------- - -WRITE_LINE_MEMBER( dave_device::int2_w ) -{ - if (!(m_irq_status & IRQ_INT2) && state) - m_irq_status |= IRQ_INT2_LATCH; - - if (state) - m_irq_status |= IRQ_INT2; - else - m_irq_status &= ~IRQ_INT2; - - update_interrupt(); -} - - -//------------------------------------------------- -// program_r - program space read -//------------------------------------------------- - -READ8_MEMBER( dave_device::program_r ) -{ - UINT8 segment = m_segment[offset >> 14]; - offset = (segment << 14) | (offset & 0x3fff); - - return this->space(AS_PROGRAM).read_byte(offset); -} - - -//------------------------------------------------- -// program_w - program space write -//------------------------------------------------- - -WRITE8_MEMBER( dave_device::program_w ) -{ - UINT8 segment = m_segment[offset >> 14]; - offset = (segment << 14) | (offset & 0x3fff); - - this->space(AS_PROGRAM).write_byte(offset, data); -} - - -//------------------------------------------------- -// io_r - I/O space read -//------------------------------------------------- - -READ8_MEMBER( dave_device::io_r ) -{ - UINT8 data = 0; - - switch (offset & 0xff) - { - case 0xa0: - case 0xa1: - case 0xa2: - case 0xa3: - case 0xa4: - case 0xa5: - case 0xa6: - case 0xa7: - case 0xa8: - case 0xa9: - case 0xaa: - case 0xab: - case 0xac: - case 0xad: - case 0xae: - case 0xaf: - case 0xb8: - case 0xb9: - case 0xba: - case 0xbb: - case 0xbc: - case 0xbd: - case 0xbe: - case 0xbf: - data = 0xff; - break; - - case 0xb0: case 0xb1: case 0xb2: case 0xb3: - data = m_segment[offset & 0x03]; - break; - - case 0xb4: - data = m_irq_status; - break; - - default: - data = this->space(AS_IO).read_byte(offset); - } - - return data; -} - - -//------------------------------------------------- -// io_w - I/O space write -//------------------------------------------------- - -WRITE8_MEMBER( dave_device::io_w ) -{ - switch (offset & 0xff) - { - /* channel 0 down-counter */ - case 0xa0: - case 0xa1: - /* channel 1 down-counter */ - case 0xa2: - case 0xa3: - /* channel 2 down-counter */ - case 0xa4: - case 0xa5: - { - int count = 0; - int channel_index = (offset>>1)&3; - - /* Fout = 125,000 / (n+1) Hz */ - - /* sample rate/clock */ - - - /* get down-count */ - switch (offset & 0x01) - { - case 0: - { - count = (data & 0x0ff) | ((m_regs[(offset & 0x1f) + 1] & 0x0f)<<8); - } - break; - - case 1: - { - count = (m_regs[(offset & 0x1f) - 1] & 0x0ff) | ((data & 0x0f)<<8); - - } - break; - } - - count++; - - - m_period[channel_index] = ((STEP * machine().sample_rate())/125000) * count; - - m_regs[offset & 0x1f] = data; - } - break; - - /* channel 0 left volume */ - case 0xa8: - /* channel 1 left volume */ - case 0xa9: - /* channel 2 left volume */ - case 0xaa: - /* noise channel left volume */ - case 0xab: - /* channel 0 right volume */ - case 0xac: - /* channel 1 right volume */ - case 0xad: - /* channel 2 right volume */ - case 0xae: - /* noise channel right volume */ - case 0xaf: - { - /* update mame version of volume from data written */ - /* 0x03f->0x07e00. Max is 0x07fff */ - /* I believe the volume is linear - to be checked! */ - m_mame_volumes[(offset & 0x1f) - 8] = (data & 0x03f) << 9; - - m_regs[offset & 0x1f] = data; - } - break; - - case 0xa6: - break; - - case 0xa7: - { - /* force => the value of this register is forced regardless of the wave - state, - remove => this value is force to zero so that it has no influence over - the final volume calculation, regardless of wave state - use => the volume value is dependant on the wave state and is included - in the final volume calculation */ - - //logerror("selectable int "); - switch ((data>>5) & 0x03) - { - case 0: - { - //logerror("1kHz\n"); - m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000)); - } - break; - - case 1: - { - //logerror("50Hz\n"); - m_timer_50hz->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); - } - break; - - case 2: - { - //logerror("tone channel 0\n"); - } - break; - - case 3: - { - //logerror("tone channel 1\n"); - } - break; - } - - - - /* turn L.H audio output into D/A, outputting value in R8 */ - if (data & (1<<3)) - { - /* force r8 value */ - m_level_or[0] = 0x0ffff; - m_level_and[0] = 0x00; - - /* remove r9 value */ - m_level_or[2] = 0x000; - m_level_and[2] = 0x00; - - /* remove r10 value */ - m_level_or[4] = 0x000; - m_level_and[4] = 0x00; - - /* remove r11 value */ - m_level_or[6] = 0x000; - m_level_and[6] = 0x00; - } - else - { - /* use r8 value */ - m_level_or[0] = 0x000; - m_level_and[0] = 0xffff; - - /* use r9 value */ - m_level_or[2] = 0x000; - m_level_and[2] = 0xffff; - - /* use r10 value */ - m_level_or[4] = 0x000; - m_level_and[4] = 0xffff; - - /* use r11 value */ - m_level_or[6] = 0x000; - m_level_and[6] = 0xffff; - } - - /* turn L.H audio output into D/A, outputting value in R12 */ - if (data & (1<<4)) - { - /* force r12 value */ - m_level_or[1] = 0x0ffff; - m_level_and[1] = 0x00; - - /* remove r13 value */ - m_level_or[3] = 0x000; - m_level_and[3] = 0x00; - - /* remove r14 value */ - m_level_or[5] = 0x000; - m_level_and[5] = 0x00; - - /* remove r15 value */ - m_level_or[7] = 0x000; - m_level_and[7] = 0x00; - } - else - { - /* use r12 value */ - m_level_or[1] = 0x000; - m_level_and[1] = 0xffff; - - /* use r13 value */ - m_level_or[3] = 0x000; - m_level_and[3] = 0xffff; - - /* use r14 value */ - m_level_or[5] = 0x000; - m_level_and[5] = 0xffff; - - /* use r15 value */ - m_level_or[7] = 0x000; - m_level_and[7] = 0xffff; - } - - m_regs[offset & 0x1f] = data; - } - break; - - case 0xb0: case 0xb1: case 0xb2: case 0xb3: - m_segment[offset & 0x03] = data; - - m_regs[offset & 0x1f] = data; - break; - - case 0xb4: - m_irq_enable = data; - m_irq_status &= ~(m_irq_enable & IRQ_LATCH); - update_interrupt(); - - m_regs[offset & 0x1f] = data; - break; - - case 0xbf: - m_regs[offset & 0x1f] = data; - break; - - default: - this->space(AS_IO).write_byte(offset, data); - } -} - - -//------------------------------------------------- -// update_interrupt - -//------------------------------------------------- - -void dave_device::update_interrupt() -{ - int state = ((m_irq_status & (m_irq_enable << 1)) & IRQ_LATCH) ? ASSERT_LINE : CLEAR_LINE; - - m_write_irq(state); -} diff --git a/src/mess/audio/dave.h b/src/mess/audio/dave.h deleted file mode 100644 index 9bab709bd62..00000000000 --- a/src/mess/audio/dave.h +++ /dev/null @@ -1,156 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Intelligent Designs DAVE emulation - -**********************************************************************/ - -#pragma once - -#ifndef __DAVE__ -#define __DAVE__ - -#include "emu.h" - - - -///************************************************************************* -// MACROS / CONSTANTS -///************************************************************************* - - - -///************************************************************************* -// INTERFACE CONFIGURATION MACROS -///************************************************************************* - -#define MCFG_DAVE_ADD(_tag, _clock, _program_map, _io_map) \ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") \ - MCFG_SOUND_ADD(_tag, DAVE, _clock) \ - MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) \ - MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) \ - MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _program_map) \ - MCFG_DEVICE_ADDRESS_MAP(AS_IO, _io_map) - - -#define MCFG_DAVE_IRQ_CALLBACK(_write) \ - devcb = &dave_device::set_irq_wr_callback(*device, DEVCB_##_write); - -#define MCFG_DAVE_LH_CALLBACK(_write) \ - devcb = &dave_device::set_lh_wr_callback(*device, DEVCB_##_write); - -#define MCFG_DAVE_RH_CALLBACK(_write) \ - devcb = &dave_device::set_rh_wr_callback(*device, DEVCB_##_write); - - - -///************************************************************************* -// TYPE DEFINITIONS -///************************************************************************* - -// ======================> dave_device - -class dave_device : public device_t, - public device_memory_interface, - public device_sound_interface -{ -public: - dave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_irq.set_callback(object); } - template static devcb_base &set_lh_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_lh.set_callback(object); } - template static devcb_base &set_rh_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_rh.set_callback(object); } - - virtual DECLARE_ADDRESS_MAP(z80_program_map, 8); - virtual DECLARE_ADDRESS_MAP(z80_io_map, 8); - - DECLARE_WRITE_LINE_MEMBER( int1_w ); - DECLARE_WRITE_LINE_MEMBER( int2_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - - DECLARE_READ8_MEMBER( program_r ); - DECLARE_WRITE8_MEMBER( program_w ); - - DECLARE_READ8_MEMBER( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - -private: - enum - { - TIMER_1HZ, - TIMER_50HZ - }; - - enum - { - IRQ_50HZ_DIVIDER = 0x01, - IRQ_50HZ_LATCH = 0x02, - IRQ_1HZ_DIVIDER = 0x04, - IRQ_1HZ_LATCH = 0x08, - IRQ_INT1 = 0x10, - IRQ_INT1_LATCH = 0x20, - IRQ_INT2 = 0x40, - IRQ_INT2_LATCH = 0x80, - IRQ_LATCH = IRQ_INT2_LATCH | IRQ_INT1_LATCH | IRQ_1HZ_LATCH | IRQ_50HZ_LATCH - }; - - void update_interrupt(); - - const address_space_config m_program_space_config; - const address_space_config m_io_space_config; - - devcb_write_line m_write_irq; - devcb_write8 m_write_lh; - devcb_write8 m_write_rh; - - UINT8 m_segment[4]; - - UINT8 m_irq_status; - UINT8 m_irq_enable; - - emu_timer *m_timer_1hz; - emu_timer *m_timer_50hz; - - /* SOUND SYNTHESIS */ - UINT8 m_regs[32]; - int m_period[4]; - int m_count[4]; - int m_level[4]; - - /* these are used to force channels on/off */ - /* if one of the or values is 0x0ff, this means - the volume will be forced on,else it is dependant on - the state of the wave */ - int m_level_or[8]; - /* if one of the values is 0x00, this means the - volume is forced off, else it is dependant on the wave */ - int m_level_and[8]; - - /* these are the current channel volumes in MAME form */ - int m_mame_volumes[8]; - - /* update step */ - //int m_update_step; - - sound_stream *m_sound_stream_var; -}; - - -// device type definition -extern const device_type DAVE; - - - -#endif diff --git a/src/mess/audio/gamate.c b/src/mess/audio/gamate.c deleted file mode 100644 index 19555dd7c44..00000000000 --- a/src/mess/audio/gamate.c +++ /dev/null @@ -1,253 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/*************************************************************************** - gamate sound hardware - - PeT mess@utanet.at 2015 -***************************************************************************/ - -#include "emu.h" -#include "includes/gamate.h" -#include "ui/ui.h" - - -enum { ClockDelay=32 }; - -// device type definition -const device_type GAMATE_SND = &device_creator; - -const int gamate_sound_device::DAConverter[]={ 0, 3, 7, 13, 23, 41, 75, 137, 249, 453, 825, 1499, 2726, 4956, 9011, 16383 }; // (*.55) on the real below index 8 bareless measureable -const UINT8 Mask[]={ 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0x1f, 0x3f, 0x1f, 0x1f, 0x1f, 0xff, 0xff, 0xf }; -const int EnvelopeVolumes[]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// gamate_sound_device - constructor -//------------------------------------------------- - -gamate_sound_device::gamate_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, GAMATE_SND, "Gamate Audio Custom", tag, owner, clock, "gamate_sound", __FILE__) - , device_sound_interface(mconfig, *this) - , m_mixer_channel(NULL) - {} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void gamate_sound_device::device_start() -{ - // bind callbacks -// m_irq_cb.bind_relative_to(*owner()); - - memset(m_channels, 0, sizeof(m_channels)); - memset(reg, 0, sizeof(reg)); - - m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void gamate_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t *left=outputs[0], *right=outputs[1]; - int i, j; - Tone *channel; - - for (i = 0; i < samples; i++, left++, right++) - { - noise.pos += noise.step; - while (noise.pos >= 1.0) - { - // guess (white noise register taken from supervision) - noise.level = noise.state & 0x40 ? 1 : 0; - bool b1 = (noise.state & 0x40) != 0, b2 = (noise.state & 0x20) != 0; - noise.state=(noise.state<<1)+(b1!=b2?1:0); - noise.pos -= 1; - } - - envelope.pos += envelope.step; - while (envelope.pos >= 1.0) { - envelope.pos -= 1; - envelope.index++; - switch (envelope.control) - { - case 0: case 1: case 2: case 3: - case 4: case 5: case 6: case 7: - case 8: case 9: case 0xb: - case 0xd: case 0xf: - if (envelope.index>=ARRAY_LENGTH(EnvelopeVolumes)/2) - { - envelope.index=0; - envelope.first=false; - } - break; - default: - if (envelope.index>=ARRAY_LENGTH(EnvelopeVolumes)) - { - envelope.index=0; - envelope.first=false; - } - break; - } - } - - *left = 0; - *right = 0; - for (channel=m_channels, j=0; jsize != 0) - { - channel->level= channel->pos <= channel->size / 2; - bool l= channel->full_cycle? true: channel->level; - if (!channel->tone) - l= l && noise.level; - int volume=0; - if (l) - { - if (channel->envelope_on) - { - switch (envelope.control) - { - case 0: case 1: case 2: case 3: - case 0x9: // one time falling, low - if (envelope.first && channel->level) - volume=0xf-EnvelopeVolumes[envelope.index]; - break; - case 4: case 5: case 6: case 7: - case 0xf: // one time rising, low - if (envelope.first && channel->level) - volume=EnvelopeVolumes[envelope.index]; - break; - case 8: // falling - if (channel->level) - volume=0xf-EnvelopeVolumes[envelope.index]; - break; - case 0xa: // rising, falling - if (channel->level) - volume=0xf-EnvelopeVolumes[envelope.index]; // cube up - break; - case 0xb: // one time falling, high - if (channel->level) - volume=envelope.first ? 0xf-EnvelopeVolumes[envelope.index] : 0xf; - break; - case 0xc: // rising, low - if (channel->level) - volume=envelope.indexlevel) - volume=envelope.first ? EnvelopeVolumes[envelope.index] : 0xf; - break; - case 0xe: // falling, rising - if (channel->level) - volume=0xf-EnvelopeVolumes[envelope.index]; - break; - } - } - else - { - volume=channel->volume; - } - } - if (j == Right) - *right += Value2Volume(volume); - else - if (j==Left) - *left += Value2Volume(volume); - else - { - *right += Value2Volume(volume); - *left += Value2Volume(volume); - } - channel->pos++; - if (channel->pos >= channel->size) - channel->pos = 0; - } - } - } -} - -WRITE8_MEMBER( gamate_sound_device::device_w ) -{ - UINT16 size; - - m_mixer_channel->update(); - reg[offset] = data; - int chan=-1; - - switch (offset&0xf) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - chan=offset/2; - size = reg[chan*2] | ((reg[chan*2+1] & 0xf) << 8); - if (size) - { - m_channels[chan].size= (int) (machine().sample_rate() * size*ClockDelay / m_clock); - } - else - { - m_channels[chan].size = 0; - } - m_channels[chan].pos = 0; - break; - case 6: - size=data&0x1f; - if (size==0) - size=1; - noise.step= m_clock / (1.0*ClockDelay*machine().sample_rate()*size); - break; - case 7: - m_channels[Right].full_cycle=data&1; - m_channels[Right].tone=data&8; - m_channels[Left].full_cycle=data&2; - m_channels[Left].tone=data&0x10; - m_channels[Both].full_cycle=data&4; - m_channels[Both].tone=data&0x20; - noise.state=1; - noise.pos=0.0; - noise.level=false; - break; - case 8: - case 9: - case 0xa: - chan=offset-8; - m_channels[chan].envelope_on = data & 0x10; // buggy aussetzer cube up - m_channels[chan].volume = data & 0xf; - break; - case 0xb: case 0xc: - size = reg[0xb] | ((reg[0xc]) << 8); - if (size==0) - size=1; - envelope.step= m_clock / (1.0*ClockDelay*machine().sample_rate()*size); - break; - case 0xd: - envelope.control=data&0xf; - envelope.pos=0; - envelope.index=0; - envelope.first=true; - break; - - } - envelope.pos=0; // guess - envelope.index=0; - envelope.first=true; -} - -READ8_MEMBER( gamate_sound_device::device_r ) -{ - UINT8 data=0; - if ((offset&0xf); - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// gameboy_sound_device - constructor -//------------------------------------------------- - -gameboy_sound_device::gameboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, GAMEBOY, "LR35902 Sound", tag, owner, clock, "gameboy_sound", __FILE__), - device_sound_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void gameboy_sound_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void gameboy_sound_device::device_start() -{ - m_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); - m_rate = machine().sample_rate(); - - save_item(NAME(m_snd_regs)); - // sound control - save_item(NAME(m_snd_control.on)); - save_item(NAME(m_snd_control.vol_left)); - save_item(NAME(m_snd_control.vol_right)); - save_item(NAME(m_snd_control.mode1_left)); - save_item(NAME(m_snd_control.mode1_right)); - save_item(NAME(m_snd_control.mode2_left)); - save_item(NAME(m_snd_control.mode2_right)); - save_item(NAME(m_snd_control.mode3_left)); - save_item(NAME(m_snd_control.mode3_right)); - save_item(NAME(m_snd_control.mode4_left)); - save_item(NAME(m_snd_control.mode4_right)); - // sound 1 - save_item(NAME(m_snd_1.on)); - save_item(NAME(m_snd_1.channel)); - save_item(NAME(m_snd_1.length)); - save_item(NAME(m_snd_1.pos)); - save_item(NAME(m_snd_1.period)); - save_item(NAME(m_snd_1.count)); - save_item(NAME(m_snd_1.mode)); - save_item(NAME(m_snd_1.duty)); - save_item(NAME(m_snd_1.env_value)); - save_item(NAME(m_snd_1.env_direction)); - save_item(NAME(m_snd_1.env_length)); - save_item(NAME(m_snd_1.env_count)); - save_item(NAME(m_snd_1.signal)); - save_item(NAME(m_snd_1.frequency)); - save_item(NAME(m_snd_1.swp_shift)); - save_item(NAME(m_snd_1.swp_direction)); - save_item(NAME(m_snd_1.swp_time)); - save_item(NAME(m_snd_1.swp_count)); - save_item(NAME(m_snd_1.level)); - save_item(NAME(m_snd_1.offset)); - save_item(NAME(m_snd_1.dutycount)); - save_item(NAME(m_snd_1.ply_step)); - save_item(NAME(m_snd_1.ply_value)); - // sound 2 - save_item(NAME(m_snd_2.on)); - save_item(NAME(m_snd_2.channel)); - save_item(NAME(m_snd_2.length)); - save_item(NAME(m_snd_2.pos)); - save_item(NAME(m_snd_2.period)); - save_item(NAME(m_snd_2.count)); - save_item(NAME(m_snd_2.mode)); - save_item(NAME(m_snd_2.duty)); - save_item(NAME(m_snd_2.env_value)); - save_item(NAME(m_snd_2.env_direction)); - save_item(NAME(m_snd_2.env_length)); - save_item(NAME(m_snd_2.env_count)); - save_item(NAME(m_snd_2.signal)); - save_item(NAME(m_snd_2.frequency)); - save_item(NAME(m_snd_2.swp_shift)); - save_item(NAME(m_snd_2.swp_direction)); - save_item(NAME(m_snd_2.swp_time)); - save_item(NAME(m_snd_2.swp_count)); - save_item(NAME(m_snd_2.level)); - save_item(NAME(m_snd_2.offset)); - save_item(NAME(m_snd_2.dutycount)); - save_item(NAME(m_snd_2.ply_step)); - save_item(NAME(m_snd_2.ply_value)); - // sound 3 - save_item(NAME(m_snd_3.on)); - save_item(NAME(m_snd_3.channel)); - save_item(NAME(m_snd_3.length)); - save_item(NAME(m_snd_3.pos)); - save_item(NAME(m_snd_3.period)); - save_item(NAME(m_snd_3.count)); - save_item(NAME(m_snd_3.mode)); - save_item(NAME(m_snd_3.duty)); - save_item(NAME(m_snd_3.env_value)); - save_item(NAME(m_snd_3.env_direction)); - save_item(NAME(m_snd_3.env_length)); - save_item(NAME(m_snd_3.env_count)); - save_item(NAME(m_snd_3.signal)); - save_item(NAME(m_snd_3.frequency)); - save_item(NAME(m_snd_3.swp_shift)); - save_item(NAME(m_snd_3.swp_direction)); - save_item(NAME(m_snd_3.swp_time)); - save_item(NAME(m_snd_3.swp_count)); - save_item(NAME(m_snd_3.level)); - save_item(NAME(m_snd_3.offset)); - save_item(NAME(m_snd_3.dutycount)); - save_item(NAME(m_snd_3.ply_step)); - save_item(NAME(m_snd_3.ply_value)); - // sound 4 - save_item(NAME(m_snd_4.on)); - save_item(NAME(m_snd_4.channel)); - save_item(NAME(m_snd_4.length)); - save_item(NAME(m_snd_4.pos)); - save_item(NAME(m_snd_4.period)); - save_item(NAME(m_snd_4.count)); - save_item(NAME(m_snd_4.mode)); - save_item(NAME(m_snd_4.duty)); - save_item(NAME(m_snd_4.env_value)); - save_item(NAME(m_snd_4.env_direction)); - save_item(NAME(m_snd_4.env_length)); - save_item(NAME(m_snd_4.env_count)); - save_item(NAME(m_snd_4.signal)); - save_item(NAME(m_snd_4.frequency)); - save_item(NAME(m_snd_4.swp_shift)); - save_item(NAME(m_snd_4.swp_direction)); - save_item(NAME(m_snd_4.swp_time)); - save_item(NAME(m_snd_4.swp_count)); - save_item(NAME(m_snd_4.level)); - save_item(NAME(m_snd_4.offset)); - save_item(NAME(m_snd_4.dutycount)); - save_item(NAME(m_snd_4.ply_step)); - save_item(NAME(m_snd_4.ply_value)); -} - -//------------------------------------------------- -// device_reset -//------------------------------------------------- - -void gameboy_sound_device::device_reset() -{ - memset(&m_snd_1, 0, sizeof(m_snd_1)); - memset(&m_snd_2, 0, sizeof(m_snd_2)); - memset(&m_snd_3, 0, sizeof(m_snd_3)); - memset(&m_snd_4, 0, sizeof(m_snd_4)); - - /* Calculate the envelope and sweep tables */ - for (int i = 0; i < 8; i++) - { - m_env_length_table[i] = (i * ((1 << FIXED_POINT) / 64) * m_rate) >> FIXED_POINT; - m_swp_time_table[i] = (((i << FIXED_POINT) / 128) * m_rate) >> (FIXED_POINT - 1); - } - - /* Calculate the period tables */ - for (int i = 0; i < MAX_FREQUENCIES; i++) - { - m_period_table[i] = ((1 << FIXED_POINT) / (131072 / (2048 - i))) * m_rate; - m_period_mode3_table[i] = ((1 << FIXED_POINT) / (65536 / (2048 - i))) * m_rate; - } - /* Calculate the period table for mode 4 */ - for (int i = 0; i < 8; i++) - { - for (int j = 0; j < 16; j++) - { - // i is the dividing ratio of frequencies - // j is the shift clock frequency - m_period_mode4_table[i][j] = ((1 << FIXED_POINT) / (524288 / ((i == 0) ? 0.5 : i) / (1 << (j + 1)))) * m_rate; - } - } - - /* Calculate the length table */ - for (int i = 0; i < 64; i++) - m_length_table[i] = ((64 - i) * ((1 << FIXED_POINT)/256) * m_rate) >> FIXED_POINT; - - /* Calculate the length table for mode 3 */ - for (int i = 0; i < 256; i++) - m_length_mode3_table[i] = ((256 - i) * ((1 << FIXED_POINT)/256) * m_rate) >> FIXED_POINT; - - sound_w_internal(NR52, 0x00); - m_snd_regs[AUD3W0] = 0xac; - m_snd_regs[AUD3W1] = 0xdd; - m_snd_regs[AUD3W2] = 0xda; - m_snd_regs[AUD3W3] = 0x48; - m_snd_regs[AUD3W4] = 0x36; - m_snd_regs[AUD3W5] = 0x02; - m_snd_regs[AUD3W6] = 0xcf; - m_snd_regs[AUD3W7] = 0x16; - m_snd_regs[AUD3W8] = 0x2c; - m_snd_regs[AUD3W9] = 0x04; - m_snd_regs[AUD3WA] = 0xe5; - m_snd_regs[AUD3WB] = 0x2c; - m_snd_regs[AUD3WC] = 0xac; - m_snd_regs[AUD3WD] = 0xdd; - m_snd_regs[AUD3WE] = 0xda; - m_snd_regs[AUD3WF] = 0x48; -} - - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -READ8_MEMBER( gameboy_sound_device::wave_r ) -{ - /* TODO: properly emulate scrambling of wave ram area when playback is active */ - return m_snd_regs[AUD3W0 + offset] | m_snd_3.on; -} - -READ8_MEMBER( gameboy_sound_device::sound_r ) -{ - switch (offset) - { - case 0x05: - case 0x0f: - return 0xff; - case NR52: - return 0x70 | m_snd_regs[offset]; - default: - return m_snd_regs[offset]; - } -} - -WRITE8_MEMBER( gameboy_sound_device::wave_w ) -{ - m_snd_regs[AUD3W0 + offset] = data; -} - -WRITE8_MEMBER( gameboy_sound_device::sound_w ) -{ - /* change in registers so update first */ - m_channel->update(); - - /* Only register NR52 is accessible if the sound controller is disabled */ - if (!m_snd_control.on && offset != NR52) - return; - - sound_w_internal(offset, data); -} - - -void gameboy_sound_device::sound_w_internal( int offset, UINT8 data ) -{ - /* Store the value */ - m_snd_regs[offset] = data; - - switch (offset) - { - /*MODE 1 */ - case NR10: /* Sweep (R/W) */ - m_snd_1.swp_shift = data & 0x7; - m_snd_1.swp_direction = (data & 0x8) >> 3; - m_snd_1.swp_direction |= m_snd_1.swp_direction - 1; - m_snd_1.swp_time = m_swp_time_table[ (data & 0x70) >> 4 ]; - break; - case NR11: /* Sound length/Wave pattern duty (R/W) */ - m_snd_1.duty = (data & 0xc0) >> 6; - m_snd_1.length = m_length_table[data & 0x3f]; - break; - case NR12: /* Envelope (R/W) */ - m_snd_1.env_value = data >> 4; - m_snd_1.env_direction = (data & 0x8) >> 3; - m_snd_1.env_direction |= m_snd_1.env_direction - 1; - m_snd_1.env_length = m_env_length_table[data & 0x7]; - break; - case NR13: /* Frequency lo (R/W) */ - m_snd_1.frequency = ((m_snd_regs[NR14] & 0x7) << 8) | m_snd_regs[NR13]; - m_snd_1.period = m_period_table[m_snd_1.frequency]; - break; - case NR14: /* Frequency hi / Initialize (R/W) */ - m_snd_1.mode = (data & 0x40) >> 6; - m_snd_1.frequency = ((m_snd_regs[NR14] & 0x7) << 8) | m_snd_regs[NR13]; - m_snd_1.period = m_period_table[m_snd_1.frequency]; - if (data & 0x80) - { - if (!m_snd_1.on) - m_snd_1.pos = 0; - m_snd_1.on = 1; - m_snd_1.count = 0; - m_snd_1.env_value = m_snd_regs[NR12] >> 4; - m_snd_1.env_count = 0; - m_snd_1.swp_count = 0; - m_snd_1.signal = 0x1; - m_snd_regs[NR52] |= 0x1; - } - break; - - /*MODE 2 */ - case NR21: /* Sound length/Wave pattern duty (R/W) */ - m_snd_2.duty = (data & 0xc0) >> 6; - m_snd_2.length = m_length_table[data & 0x3f]; - break; - case NR22: /* Envelope (R/W) */ - m_snd_2.env_value = data >> 4; - m_snd_2.env_direction = (data & 0x8) >> 3; - m_snd_2.env_direction |= m_snd_2.env_direction - 1; - m_snd_2.env_length = m_env_length_table[data & 0x7]; - break; - case NR23: /* Frequency lo (R/W) */ - m_snd_2.period = m_period_table[((m_snd_regs[NR24] & 0x7) << 8) | m_snd_regs[NR23]]; - break; - case NR24: /* Frequency hi / Initialize (R/W) */ - m_snd_2.mode = (data & 0x40) >> 6; - m_snd_2.period = m_period_table[((m_snd_regs[NR24] & 0x7) << 8) | m_snd_regs[NR23]]; - if (data & 0x80) - { - if (!m_snd_2.on) - m_snd_2.pos = 0; - m_snd_2.on = 1; - m_snd_2.count = 0; - m_snd_2.env_value = m_snd_regs[NR22] >> 4; - m_snd_2.env_count = 0; - m_snd_2.signal = 0x1; - m_snd_regs[NR52] |= 0x2; - } - break; - - /*MODE 3 */ - case NR30: /* Sound On/Off (R/W) */ - m_snd_3.on = (data & 0x80) >> 7; - break; - case NR31: /* Sound Length (R/W) */ - m_snd_3.length = m_length_mode3_table[data]; - break; - case NR32: /* Select Output Level */ - m_snd_3.level = (data & 0x60) >> 5; - break; - case NR33: /* Frequency lo (W) */ - m_snd_3.period = m_period_mode3_table[((m_snd_regs[NR34] & 0x7) << 8) + m_snd_regs[NR33]]; - break; - case NR34: /* Frequency hi / Initialize (W) */ - m_snd_3.mode = (data & 0x40) >> 6; - m_snd_3.period = m_period_mode3_table[((m_snd_regs[NR34] & 0x7) << 8) + m_snd_regs[NR33]]; - if (data & 0x80) - { - if (!m_snd_3.on) - { - m_snd_3.pos = 0; - m_snd_3.offset = 0; - m_snd_3.duty = 0; - } - m_snd_3.on = 1; - m_snd_3.count = 0; - m_snd_3.duty = 1; - m_snd_3.dutycount = 0; - m_snd_regs[NR52] |= 0x4; - } - break; - - /*MODE 4 */ - case NR41: /* Sound Length (R/W) */ - m_snd_4.length = m_length_table[data & 0x3f]; - break; - case NR42: /* Envelope (R/W) */ - m_snd_4.env_value = data >> 4; - m_snd_4.env_direction = (data & 0x8) >> 3; - m_snd_4.env_direction |= m_snd_4.env_direction - 1; - m_snd_4.env_length = m_env_length_table[data & 0x7]; - break; - case NR43: /* Polynomial Counter/Frequency */ - m_snd_4.period = m_period_mode4_table[data & 0x7][(data & 0xF0) >> 4]; - m_snd_4.ply_step = (data & 0x8) >> 3; - break; - case NR44: /* Counter/Consecutive / Initialize (R/W) */ - m_snd_4.mode = (data & 0x40) >> 6; - if (data & 0x80) - { - if (!m_snd_4.on) - m_snd_4.pos = 0; - m_snd_4.on = 1; - m_snd_4.count = 0; - m_snd_4.env_value = m_snd_regs[NR42] >> 4; - m_snd_4.env_count = 0; - m_snd_4.signal = machine().rand(); - m_snd_4.ply_value = 0x7fff; - m_snd_regs[NR52] |= 0x8; - } - break; - - /* CONTROL */ - case NR50: /* Channel Control / On/Off / Volume (R/W) */ - m_snd_control.vol_left = data & 0x7; - m_snd_control.vol_right = (data & 0x70) >> 4; - break; - case NR51: /* Selection of Sound Output Terminal */ - m_snd_control.mode1_right = data & 0x1; - m_snd_control.mode1_left = (data & 0x10) >> 4; - m_snd_control.mode2_right = (data & 0x2) >> 1; - m_snd_control.mode2_left = (data & 0x20) >> 5; - m_snd_control.mode3_right = (data & 0x4) >> 2; - m_snd_control.mode3_left = (data & 0x40) >> 6; - m_snd_control.mode4_right = (data & 0x8) >> 3; - m_snd_control.mode4_left = (data & 0x80) >> 7; - break; - case NR52: /* Sound On/Off (R/W) */ - /* Only bit 7 is writable, writing to bits 0-3 does NOT enable or - disable sound. They are read-only */ - m_snd_control.on = (data & 0x80) >> 7; - if (!m_snd_control.on) - { - sound_w_internal(NR10, 0x80); - sound_w_internal(NR11, 0xBF); - sound_w_internal(NR12, 0xF3); - sound_w_internal(NR13, 0xFF); - sound_w_internal(NR14, 0xBF); - //sound_w_internal(NR20, 0xFF); - sound_w_internal(NR21, 0x3F); - sound_w_internal(NR22, 0x00); - sound_w_internal(NR23, 0xFF); - sound_w_internal(NR24, 0xBF); - sound_w_internal(NR30, 0x7F); - sound_w_internal(NR31, 0xFF); - sound_w_internal(NR32, 0x9F); - sound_w_internal(NR33, 0xFF); - sound_w_internal(NR34, 0xBF); - //sound_w_internal(NR40, 0xFF); - sound_w_internal(NR41, 0xFF); - sound_w_internal(NR42, 0x00); - sound_w_internal(NR43, 0x00); - sound_w_internal(NR44, 0xBF); - sound_w_internal(NR50, 0x77); - sound_w_internal(NR51, 0xF3); - m_snd_1.on = 0; - m_snd_2.on = 0; - m_snd_3.on = 0; - m_snd_4.on = 0; - m_snd_regs[offset] = 0; - } - break; - } -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void gameboy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t sample, left, right, mode4_mask; - - while (samples-- > 0) - { - left = right = 0; - - /* Mode 1 - Wave with Envelope and Sweep */ - if (m_snd_1.on) - { - sample = m_snd_1.signal * m_snd_1.env_value; - m_snd_1.pos++; - if (m_snd_1.pos == (UINT32)(m_snd_1.period / wave_duty_table[m_snd_1.duty]) >> FIXED_POINT) - { - m_snd_1.signal = -m_snd_1.signal; - } - else if (m_snd_1.pos > (m_snd_1.period >> FIXED_POINT)) - { - m_snd_1.pos = 0; - m_snd_1.signal = -m_snd_1.signal; - } - - if (m_snd_1.length && m_snd_1.mode) - { - m_snd_1.count++; - if (m_snd_1.count >= m_snd_1.length) - { - m_snd_1.on = 0; - m_snd_regs[NR52] &= 0xFE; - } - } - - if (m_snd_1.env_length) - { - m_snd_1.env_count++; - if (m_snd_1.env_count >= m_snd_1.env_length) - { - m_snd_1.env_count = 0; - m_snd_1.env_value += m_snd_1.env_direction; - if (m_snd_1.env_value < 0) - m_snd_1.env_value = 0; - if (m_snd_1.env_value > 15) - m_snd_1.env_value = 15; - } - } - - if (m_snd_1.swp_time) - { - m_snd_1.swp_count++; - if (m_snd_1.swp_count >= m_snd_1.swp_time) - { - m_snd_1.swp_count = 0; - if (m_snd_1.swp_direction > 0) - { - m_snd_1.frequency -= m_snd_1.frequency / (1 << m_snd_1.swp_shift); - if (m_snd_1.frequency <= 0) - { - m_snd_1.on = 0; - m_snd_regs[NR52] &= 0xFE; - } - } - else - { - m_snd_1.frequency += m_snd_1.frequency / (1 << m_snd_1.swp_shift); - if (m_snd_1.frequency >= MAX_FREQUENCIES) - { - m_snd_1.frequency = MAX_FREQUENCIES - 1; - } - } - - m_snd_1.period = m_period_table[m_snd_1.frequency]; - } - } - - if (m_snd_control.mode1_left) - left += sample; - if (m_snd_control.mode1_right) - right += sample; - } - - /* Mode 2 - Wave with Envelope */ - if (m_snd_2.on) - { - sample = m_snd_2.signal * m_snd_2.env_value; - m_snd_2.pos++; - if( m_snd_2.pos == (UINT32)(m_snd_2.period / wave_duty_table[m_snd_2.duty]) >> FIXED_POINT) - { - m_snd_2.signal = -m_snd_2.signal; - } - else if (m_snd_2.pos > (m_snd_2.period >> FIXED_POINT)) - { - m_snd_2.pos = 0; - m_snd_2.signal = -m_snd_2.signal; - } - - if (m_snd_2.length && m_snd_2.mode) - { - m_snd_2.count++; - if (m_snd_2.count >= m_snd_2.length) - { - m_snd_2.on = 0; - m_snd_regs[NR52] &= 0xFD; - } - } - - if (m_snd_2.env_length) - { - m_snd_2.env_count++; - if (m_snd_2.env_count >= m_snd_2.env_length) - { - m_snd_2.env_count = 0; - m_snd_2.env_value += m_snd_2.env_direction; - if (m_snd_2.env_value < 0) - m_snd_2.env_value = 0; - if (m_snd_2.env_value > 15) - m_snd_2.env_value = 15; - } - } - - if (m_snd_control.mode2_left) - left += sample; - if (m_snd_control.mode2_right) - right += sample; - } - - /* Mode 3 - Wave patterns from WaveRAM */ - if (m_snd_3.on) - { - /* NOTE: This is extremely close, but not quite right. - The problem is for GB frequencies above 2000 the frequency gets - clipped. This is caused because m_snd_3.pos is never 0 at the test.*/ - sample = m_snd_regs[AUD3W0 + (m_snd_3.offset/2)]; - if (!(m_snd_3.offset % 2)) - { - sample >>= 4; - } - sample = (sample & 0xF) - 8; - - if (m_snd_3.level) - sample >>= (m_snd_3.level - 1); - else - sample = 0; - - m_snd_3.pos++; - if (m_snd_3.pos >= ((UINT32)(((m_snd_3.period) >> 21)) + m_snd_3.duty)) - { - m_snd_3.pos = 0; - if (m_snd_3.dutycount == ((UINT32)(((m_snd_3.period) >> FIXED_POINT)) % 32)) - { - m_snd_3.duty--; - } - m_snd_3.dutycount++; - m_snd_3.offset++; - if (m_snd_3.offset > 31) - { - m_snd_3.offset = 0; - m_snd_3.duty = 1; - m_snd_3.dutycount = 0; - } - } - - if (m_snd_3.length && m_snd_3.mode) - { - m_snd_3.count++; - if (m_snd_3.count >= m_snd_3.length) - { - m_snd_3.on = 0; - m_snd_regs[NR52] &= 0xFB; - } - } - - if (m_snd_control.mode3_left) - left += sample; - if (m_snd_control.mode3_right) - right += sample; - } - - /* Mode 4 - Noise with Envelope */ - if (m_snd_4.on) - { - /* Similar problem to Mode 3, we seem to miss some notes */ - sample = m_snd_4.signal & m_snd_4.env_value; - m_snd_4.pos++; - if (m_snd_4.pos == (m_snd_4.period >> (FIXED_POINT + 1))) - { - /* Using a Polynomial Counter (aka Linear Feedback Shift Register) - Mode 4 has a 7 bit and 15 bit counter so we need to shift the - bits around accordingly */ - mode4_mask = (((m_snd_4.ply_value & 0x2) >> 1) ^ (m_snd_4.ply_value & 0x1)) << (m_snd_4.ply_step ? 6 : 14); - m_snd_4.ply_value >>= 1; - m_snd_4.ply_value |= mode4_mask; - m_snd_4.ply_value &= (m_snd_4.ply_step ? 0x7f : 0x7fff); - m_snd_4.signal = (INT8)m_snd_4.ply_value; - } - else if (m_snd_4.pos > (m_snd_4.period >> FIXED_POINT)) - { - m_snd_4.pos = 0; - mode4_mask = (((m_snd_4.ply_value & 0x2) >> 1) ^ (m_snd_4.ply_value & 0x1)) << (m_snd_4.ply_step ? 6 : 14); - m_snd_4.ply_value >>= 1; - m_snd_4.ply_value |= mode4_mask; - m_snd_4.ply_value &= (m_snd_4.ply_step ? 0x7f : 0x7fff); - m_snd_4.signal = (INT8)m_snd_4.ply_value; - } - - if (m_snd_4.length && m_snd_4.mode) - { - m_snd_4.count++; - if (m_snd_4.count >= m_snd_4.length) - { - m_snd_4.on = 0; - m_snd_regs[NR52] &= 0xF7; - } - } - - if (m_snd_4.env_length) - { - m_snd_4.env_count++; - if (m_snd_4.env_count >= m_snd_4.env_length) - { - m_snd_4.env_count = 0; - m_snd_4.env_value += m_snd_4.env_direction; - if (m_snd_4.env_value < 0) - m_snd_4.env_value = 0; - if (m_snd_4.env_value > 15) - m_snd_4.env_value = 15; - } - } - - if (m_snd_control.mode4_left) - left += sample; - if (m_snd_control.mode4_right) - right += sample; - } - - /* Adjust for master volume */ - left *= m_snd_control.vol_left; - right *= m_snd_control.vol_right; - - /* pump up the volume */ - left <<= 6; - right <<= 6; - - /* Update the buffers */ - *(outputs[0]++) = left; - *(outputs[1]++) = right; - } - - m_snd_regs[NR52] = (m_snd_regs[NR52]&0xf0) | m_snd_1.on | (m_snd_2.on << 1) | (m_snd_3.on << 2) | (m_snd_4.on << 3); - -} diff --git a/src/mess/audio/gb.h b/src/mess/audio/gb.h deleted file mode 100644 index c86cad02b76..00000000000 --- a/src/mess/audio/gb.h +++ /dev/null @@ -1,105 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Anthony Kruize -#ifndef __GBSOUND_H__ -#define __GBSOUND_H__ - - -#define MAX_FREQUENCIES 2048 - - -struct SOUND -{ - /* Common */ - UINT8 on; - UINT8 channel; - INT32 length; - INT32 pos; - UINT32 period; - INT32 count; - INT8 mode; - /* Mode 1, 2, 3 */ - INT8 duty; - /* Mode 1, 2, 4 */ - INT32 env_value; - INT8 env_direction; - INT32 env_length; - INT32 env_count; - INT8 signal; - /* Mode 1 */ - UINT32 frequency; - INT32 swp_shift; - INT32 swp_direction; - INT32 swp_time; - INT32 swp_count; - /* Mode 3 */ - INT8 level; - UINT8 offset; - UINT32 dutycount; - /* Mode 4 */ - INT32 ply_step; - INT16 ply_value; -}; - -struct SOUNDC -{ - UINT8 on; - UINT8 vol_left; - UINT8 vol_right; - UINT8 mode1_left; - UINT8 mode1_right; - UINT8 mode2_left; - UINT8 mode2_right; - UINT8 mode3_left; - UINT8 mode3_right; - UINT8 mode4_left; - UINT8 mode4_right; -}; - - -class gameboy_sound_device : public device_t, - public device_sound_interface -{ -public: - gameboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_READ8_MEMBER(sound_r); - DECLARE_READ8_MEMBER(wave_r); - DECLARE_WRITE8_MEMBER(sound_w); - DECLARE_WRITE8_MEMBER(wave_w); - -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - - virtual void device_reset(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -private: - void sound_w_internal(int offset, UINT8 data); - - sound_stream *m_channel; - int m_rate; - - INT32 m_env_length_table[8]; - INT32 m_swp_time_table[8]; - UINT32 m_period_table[MAX_FREQUENCIES]; - UINT32 m_period_mode3_table[MAX_FREQUENCIES]; - UINT32 m_period_mode4_table[8][16]; - UINT32 m_length_table[64]; - UINT32 m_length_mode3_table[256]; - - struct SOUND m_snd_1; - struct SOUND m_snd_2; - struct SOUND m_snd_3; - struct SOUND m_snd_4; - struct SOUNDC m_snd_control; - - UINT8 m_snd_regs[0x30]; -}; - -extern const device_type GAMEBOY; - -#endif diff --git a/src/mess/audio/lynx.c b/src/mess/audio/lynx.c deleted file mode 100644 index 2e17abde91f..00000000000 --- a/src/mess/audio/lynx.c +++ /dev/null @@ -1,540 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - PeT mess@utanet.at 2000,2001 -******************************************************************************/ - -#include "emu.h" -#include "audio/lynx.h" - - -/* accordingly to atari's reference manual - there were no stereo lynx produced (the manual knows only production until mid 1991) - the howard/developement board might have stereo support - the revised lynx 2 hardware might have stereo support at least at the stereo jacks - - some games support stereo -*/ - - -/* -AUDIO_A EQU $FD20 -AUDIO_B EQU $FD28 -AUDIO_C EQU $FD30 -AUDIO_D EQU $FD38 - -VOLUME_CNTRL EQU 0 -FEEDBACK_ENABLE EQU 1 ; enables 11/10/5..0 -OUTPUT_VALUE EQU 2 -SHIFTER_L EQU 3 -AUD_BAKUP EQU 4 -AUD_CNTRL1 EQU 5 -AUD_COUNT EQU 6 -AUD_CNTRL2 EQU 7 - -; AUD_CNTRL1 -FEEDBACK_7 EQU %10000000 -AUD_RESETDONE EQU %01000000 -AUD_INTEGRATE EQU %00100000 -AUD_RELOAD EQU %00010000 -AUD_CNTEN EQU %00001000 -AUD_LINK EQU %00000111 -; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1 -AUD_64us EQU %00000110 -AUD_32us EQU %00000101 -AUD_16us EQU %00000100 -AUD_8us EQU %00000011 -AUD_4us EQU %00000010 -AUD_2us EQU %00000001 -AUD_1us EQU %00000000 - -; AUD_CNTRL2 (read only) -; B7..B4 ; shifter bits 11..8 -; B3 ; who knows -; B2 ; last clock state (0->1 causes count) -; B1 ; borrow in (1 causes count) -; B0 ; borrow out (count EQU 0 and borrow in) - -ATTEN_A EQU $FD40 -ATTEN_B EQU $FD41 -ATTEN_C EQU $FD42 -ATTEN_D EQU $FD43 -; B7..B4 attenuation left ear (0 silent ..15/16 volume) -; B3..B0 " right ear - -MPAN EQU $FD44 -; B7..B4 left ear -; B3..B0 right ear -; B7/B3 EQU Audio D -; a 1 enables attenuation for channel and side - - -MSTEREO EQU $FD50 ; a 1 disables audio connection -AUD_D_LEFT EQU %10000000 -AUD_C_LEFT EQU %01000000 -AUD_B_LEFT EQU %00100000 -AUD_A_LEFT EQU %00010000 -AUD_D_RIGHT EQU %00001000 -AUD_C_RIGHT EQU %00000100 -AUD_B_RIGHT EQU %00000010 -AUD_A_RIGHT EQU %00000001 - - */ - -#define LYNX_AUDIO_CHANNELS 4 - - -// device type definition -const device_type LYNX_SND = &device_creator; -const device_type LYNX2_SND = &device_creator; - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// lynx_sound_device - constructor -//------------------------------------------------- - -lynx_sound_device::lynx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, LYNX_SND, "Mikey", tag, owner, clock, "lynx_sound", __FILE__), - device_sound_interface(mconfig, *this) -{ - m_timer_delegate = lynx_sound_timer_delegate(); -} - -lynx_sound_device::lynx_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_sound_interface(mconfig, *this) -{ -} - - -lynx2_sound_device::lynx2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : lynx_sound_device(mconfig, LYNX2_SND, "Mikey (Lynx II)", tag, owner, clock, "lynx2_sound", __FILE__) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void lynx_sound_device::set_timer_delegate(device_t &device, lynx_sound_timer_delegate cb) -{ - lynx_sound_device &dev = downcast(device); - dev.m_timer_delegate = cb; -} - -void lynx_sound_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void lynx_sound_device::register_save() -{ - save_item(NAME(m_attenuation_enable)); - save_item(NAME(m_master_enable)); - for (int chan = 0; chan < LYNX_AUDIO_CHANNELS; chan++) - { - save_item(NAME(m_audio[chan].reg.volume), chan); - save_item(NAME(m_audio[chan].reg.feedback), chan); - save_item(NAME(m_audio[chan].reg.output), chan); - save_item(NAME(m_audio[chan].reg.shifter), chan); - save_item(NAME(m_audio[chan].reg.bakup), chan); - save_item(NAME(m_audio[chan].reg.control1), chan); - save_item(NAME(m_audio[chan].reg.counter), chan); - save_item(NAME(m_audio[chan].reg.control2), chan); - save_item(NAME(m_audio[chan].attenuation), chan); - save_item(NAME(m_audio[chan].mask), chan); - save_item(NAME(m_audio[chan].shifter), chan); - save_item(NAME(m_audio[chan].ticks), chan); - save_item(NAME(m_audio[chan].count), chan); - } -} - -void lynx_sound_device::init() -{ - m_shift_mask = auto_alloc_array_clear(machine(), int, 512); - m_shift_xor = auto_alloc_array_clear(machine(), int, 4096); - - for (int i = 0; i < 512; i++) - { - m_shift_mask[i] = 0; - if (i & 1) m_shift_mask[i] |= 1; - if (i & 2) m_shift_mask[i] |= 2; - if (i & 4) m_shift_mask[i] |= 4; - if (i & 8) m_shift_mask[i] |= 8; - if (i & 0x10) m_shift_mask[i] |= 0x10; - if (i & 0x20) m_shift_mask[i] |= 0x20; - if (i & 0x40) m_shift_mask[i] |= 0x400; - if (i & 0x80) m_shift_mask[i] |= 0x800; - if (i & 0x100) m_shift_mask[i] |= 0x80; - } - - for (int i = 0; i < 4096; i++) - { - m_shift_xor[i] = 1; - for (int j = 4096/2; j > 0; j >>= 1) - { - if (i & j) - m_shift_xor[i] ^= 1; - } - } -} - -void lynx_sound_device::device_start() -{ - m_mixer_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate()); - m_usec_per_sample = 1000000 / machine().sample_rate(); - m_timer_delegate.bind_relative_to(*owner()); - init(); - register_save(); -} - - -void lynx2_sound_device::device_start() -{ - m_mixer_channel = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); - m_usec_per_sample = 1000000 / machine().sample_rate(); - m_timer_delegate.bind_relative_to(*owner()); - init(); - register_save(); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void lynx_sound_device::device_reset() -{ - for (int i = 0; i < LYNX_AUDIO_CHANNELS; i++) - { - reset_channel(&m_audio[i]); - } -} - - -void lynx_sound_device::reset_channel(LYNX_AUDIO *channel) -{ - channel->reg.volume = 0; - channel->reg.feedback = 0; - channel->reg.output = 0; - channel->reg.shifter = 0; - channel->reg.bakup = 0; - channel->reg.control1 = 0; - channel->reg.counter = 0; - channel->reg.control2 = 0; - - channel->attenuation = 0; - channel->mask = 0; - channel->shifter = 0; - channel->ticks = 0; - channel->count = 0; -} - -void lynx_sound_device::count_down(int nr) -{ - LYNX_AUDIO *channel = &m_audio[nr]; - if (channel->reg.control1 & 8 && (channel->reg.control1 & 7) != 7) - return; - if (nr == 0) - m_mixer_channel->update(); - //if ((channel->reg.control1 & 0x0f) == 0x0f) //count down if linking enabled and count enabled - channel->count--; -} - -void lynx_sound_device::shift(int chan_nr) -{ - INT16 out_temp; - LYNX_AUDIO *channel; - - assert(chan_nr < 4); - - channel = &m_audio[chan_nr]; - //channel->shifter = ((channel->shifter<<1)&0xffe) | (m_shift_xor[ channel->shifter & channel->mask ]&1); - - // alternative method (functionally the same as above) - UINT8 xor_out = 0; - for (int bit = 0; bit < 12; bit++) - { - if ((channel->mask >> bit) & 1) - xor_out ^= (channel->shifter >> bit) & 1; - } - channel->shifter = ((channel->shifter << 1) & 0xffe) | (xor_out ^ 1); // output of xor is inverted - - - if (channel->reg.control1 & 0x20) // integrate mode enabled - { - if (channel->shifter & 1) - out_temp = channel->reg.output + channel->reg.volume; - else - out_temp = channel->reg.output - channel->reg.volume; - - // clipping - if (out_temp > 127) out_temp = 127; - if (out_temp < -128) out_temp = -128; - channel->reg.output = (INT16)out_temp; - } - - switch (chan_nr) - { - case 0: count_down(1); break; - case 1: count_down(2); break; - case 2: count_down(3); break; - case 3: - if (!m_timer_delegate.isnull()) - m_timer_delegate(); - break; - } -} - -void lynx_sound_device::execute(int chan_nr) -{ - LYNX_AUDIO *channel; - - assert(chan_nr < 4); - - channel = &m_audio[chan_nr]; - - if (channel->reg.control1 & 8) // count enable - { - channel->ticks += m_usec_per_sample; - if ((channel->reg.control1 & 7) == 7) // link - { - if (channel->count < 0) // counter finished - { - //channel->count+=channel->reg.counter; // reload (wrong?) - if (channel->reg.control1 & 0x10) - channel->count = channel->reg.bakup; - shift(chan_nr); - } - } - else - { - int t = 1 << (channel->reg.control1 & 7); // microseconds per count - for (;;) - { - for (; (channel->ticks >= t) && (channel->count >= 0); channel->ticks -= t) // at least one sampled worth of time left, timer not expired - channel->count--; - - if (channel->ticks < t) - break; - - if (channel->count < 0) - { - shift(chan_nr); - if (channel->reg.control1 & 0x10) - channel->count = channel->reg.bakup; - else - break; - } - } - } - - if (!(channel->reg.control1 & 0x20)) // normal mode - { - channel->reg.output = (channel->shifter & 1) ? channel->reg.volume : -channel->reg.volume; - } - } - else - { - channel->ticks = 0; - channel->count = 0; - } -} - -READ8_MEMBER(lynx_sound_device::read) -{ - UINT8 value = 0; - LYNX_AUDIO *channel = &m_audio[(offset >> 3) & 3]; - - m_mixer_channel->update(); - - if (offset < 0x40) - { - switch (offset & 7) - { - case 0: - value = channel->reg.volume; - break; - case 1: - value = channel->reg.feedback; - break; - case 2: - value = channel->reg.output; - break; - case 3: - // current shifter state (lower 8 bits) - value = channel->shifter & 0xff; - break; - case 4: - value = channel->reg.bakup; - break; - case 5: - value = channel->reg.control1; - break; - case 6: - //current timer value - if (channel->count >=0) - value = channel->count; - else - value = 0; - break; - case 7: - // current shifter state (upper 4 bits), status bits - value = (channel->shifter >> 4) & 0xf0; - value |= channel->reg.control2 & 0x0f; - break; - } - } - else - { - switch (offset) // Lynx II stereo control registers - { - case 0x40: case 0x41: case 0x42: case 0x43: - value = m_audio[offset & 3].attenuation; - break; - case 0x44: - value = m_attenuation_enable; - break; - case 0x50: - value = m_master_enable; - break; - } - - } - return value; -} - -WRITE8_MEMBER(lynx_sound_device::write) -{ - //logerror("audio write %.2x %.2x\n", offset, data); - LYNX_AUDIO *channel = &m_audio[(offset >> 3) & 3]; - - m_mixer_channel->update(); - - if (offset < 0x40) - { - switch (offset & 0x07) - { - // Volume control (signed) - case 0: - channel->reg.volume = data; - //logerror("write to volume %d\n", data); - break; - // Shift register feedback enable bits 0-5, 11,10 - case 1: - channel->reg.feedback = data; - channel->mask &= 0x80; - channel->mask |= (data & 0x3f) | ((data & 0xc0)<<4); - break; - // Output value - case 2: - channel->reg.output = data; - //logerror("write to output %d\n", data); - break; - // Lower 8 bits of shift register - case 3: - channel->shifter &= 0xf00; - channel->shifter |= data; - break; - // Audio timer backup value - case 4: - channel->reg.bakup = data; - break; - // Audio control bits - case 5: - channel->mask &= ~0x80; - channel->mask |= (data&0x80); - channel->reg.control1 = data; - break; - // Current count - case 6: - channel->count=data; - break; - // Upper 4 bits of shift register and audio status bits - case 7: - channel->shifter&=0xff; - channel->shifter|=(data&0xf0)<<4; - channel->reg.control2 = data; - break; - } - } - else - { - switch (offset) // Stereo Registers - { - case 0x40: case 0x41: case 0x42: case 0x43: - m_audio[offset&3].attenuation = data; - break; - case 0x44: - m_attenuation_enable = data; - break; - case 0x50: - m_master_enable = data; - break; - } - } -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void lynx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - int v; - stream_sample_t *buffer = outputs[0]; - - for (int i = 0; i < samples; i++, buffer++) - { - *buffer = 0; - for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++) - { - execute(channel); - v = m_audio[channel].reg.output; - *buffer += v * 15; // where does the *15 come from? - } - } -} - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void lynx2_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t *left=outputs[0], *right=outputs[1]; - int v; - - for (int i = 0; i < samples; i++, left++, right++) - { - *left = 0; - *right= 0; - for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++) - { - execute(channel); - v = m_audio[channel].reg.output; - if (!(m_master_enable & (0x10 << channel))) - { - if (m_attenuation_enable & (0x10 << channel)) - *left += v * (m_audio[channel].attenuation >> 4); - else - *left += v * 15; - } - if (!(m_master_enable & (1 << channel))) - { - if (m_attenuation_enable & (1 << channel)) - *right += v * (m_audio[channel].attenuation & 0xf); - else - *right += v * 15; - } - } - } -} diff --git a/src/mess/audio/lynx.h b/src/mess/audio/lynx.h deleted file mode 100644 index b99d2b04873..00000000000 --- a/src/mess/audio/lynx.h +++ /dev/null @@ -1,90 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner - -#ifndef __LYNXSOUND_H__ -#define __LYNXSOUND_H__ - -struct LYNX_AUDIO { - struct { - INT8 volume; - UINT8 feedback; - INT8 output; - UINT8 shifter; - UINT8 bakup; - UINT8 control1; - UINT8 counter; - UINT8 control2; - } reg; - UINT8 attenuation; - UINT16 mask; // 12-bit - UINT16 shifter; // 12-bit - float ticks; - int count; -}; - -typedef device_delegate lynx_sound_timer_delegate; - - -class lynx_sound_device : public device_t, - public device_sound_interface -{ -public: - lynx_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - lynx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); - void count_down(int nr); - static void set_timer_delegate(device_t &device, lynx_sound_timer_delegate cb); - -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - - virtual void device_reset(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - - void reset_channel(LYNX_AUDIO *channel); - void shift(int chan_nr); - void execute(int chan_nr); - void init(); - void register_save(); - - sound_stream *m_mixer_channel; - lynx_sound_timer_delegate m_timer_delegate; // this calls lynx_timer_count_down from the driver state - - float m_usec_per_sample; - int *m_shift_mask; - int *m_shift_xor; - UINT8 m_attenuation_enable; - UINT8 m_master_enable; - LYNX_AUDIO m_audio[4]; -}; - - -class lynx2_sound_device : public lynx_sound_device -{ -public: - lynx2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -protected: - // device-level overrides - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); -}; - - -extern const device_type LYNX_SND; -extern const device_type LYNX2_SND; - - -#define MCFG_LYNX_SND_SET_TIMER( _class, _method) \ - lynx_sound_device::set_timer_delegate(*device, lynx_sound_timer_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); - - -#endif diff --git a/src/mess/audio/mac.c b/src/mess/audio/mac.c deleted file mode 100644 index 7a0b7a93a62..00000000000 --- a/src/mess/audio/mac.c +++ /dev/null @@ -1,174 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/*************************************************************************** - - mac.c - - Sound handler - -****************************************************************************/ - - -#include "emu.h" -#include "sound/asc.h" -#include "includes/mac.h" -#include "machine/ram.h" - -/*************************************************************************** - MACROS / CONSTANTS -***************************************************************************/ - -#define MAC_MAIN_SND_BUF_OFFSET 0x0300 -#define MAC_ALT_SND_BUF_OFFSET 0x5F00 -#define MAC_SND_BUF_SIZE 370 /* total number of scan lines */ -#define MAC_SAMPLE_RATE ( MAC_SND_BUF_SIZE * 60 /*22255*/ ) /* scan line rate, should be 22254.5 Hz */ - - -/* intermediate buffer */ -#define SND_CACHE_SIZE 128 - - - - -const device_type MAC_SOUND = &device_creator; - -mac_sound_device::mac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, MAC_SOUND, "Mac Audio Custom", tag, owner, clock, "mac_sound", __FILE__), - device_sound_interface(mconfig, *this), - m_sample_enable(0), - m_mac_snd_buf_ptr(NULL), - m_snd_cache_len(0), - m_snd_cache_head(0), - m_snd_cache_tail(0), - m_indexx(0) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void mac_sound_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void mac_sound_device::device_start() -{ - mac_state *mac = machine().driver_data(); - - m_snd_cache = auto_alloc_array_clear(machine(), UINT8, SND_CACHE_SIZE); - m_mac_stream = machine().sound().stream_alloc(*this, 0, 1, MAC_SAMPLE_RATE); - - m_ram = machine().device(RAM_TAG); - m_mac_model = mac->m_model; - - save_pointer(NAME(m_snd_cache), SND_CACHE_SIZE); - save_item(NAME(m_sample_enable)); - save_item(NAME(m_snd_cache_len)); - save_item(NAME(m_snd_cache_head)); - save_item(NAME(m_snd_cache_tail)); - save_item(NAME(m_indexx)); -} - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void mac_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - INT16 last_val = 0; - stream_sample_t *buffer = outputs[0]; - - if ((m_mac_model == MODEL_MAC_PORTABLE) || (m_mac_model == MODEL_MAC_PB100)) - { - memset(buffer, 0, samples * sizeof(*buffer)); - return; - } - - /* if we're not enabled, just fill with 0 */ - if (machine().sample_rate() == 0) - { - memset(buffer, 0, samples * sizeof(*buffer)); - return; - } - - /* fill in the sample */ - while (samples && m_snd_cache_len) - { - *buffer++ = last_val = ((m_snd_cache[m_snd_cache_head] << 8) ^ 0x8000) & 0xff00; - m_snd_cache_head++; - m_snd_cache_head %= SND_CACHE_SIZE; - m_snd_cache_len--; - samples--; - } - - while (samples--) - { - /* should never happen */ - *buffer++ = last_val; - } -} - - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - - -// Set the sound enable flag (VIA port line) -void mac_sound_device::enable_sound(int on) -{ - m_sample_enable = on; -} - - -// Set the current sound buffer (one VIA port line) -void mac_sound_device::set_sound_buffer(int buffer) -{ - if (buffer) - m_mac_snd_buf_ptr = (UINT16 *) (m_ram->pointer() + m_ram->size() - MAC_MAIN_SND_BUF_OFFSET); - else - m_mac_snd_buf_ptr = (UINT16 *) (m_ram->pointer() + m_ram->size() - MAC_ALT_SND_BUF_OFFSET); -} - - - -// Set the current sound volume (3 VIA port line) -void mac_sound_device::set_volume(int volume) -{ - m_mac_stream->update(); - volume = (100 / 7) * volume; - m_mac_stream->set_output_gain(0, volume / 100.0); -} - - - -// Fetch one byte from sound buffer and put it to sound output (called every scanline) -void mac_sound_device::sh_updatebuffer() -{ - UINT16 *base = m_mac_snd_buf_ptr; - - m_indexx++; - m_indexx %= 370; - - if (m_snd_cache_len >= SND_CACHE_SIZE) - { - /* clear buffer */ - m_mac_stream->update(); - } - - if (m_snd_cache_len >= SND_CACHE_SIZE) - /* should never happen */ - return; - - m_snd_cache[m_snd_cache_tail] = m_sample_enable ? (base[m_indexx] >> 8) & 0xff : 0; - m_snd_cache_tail++; - m_snd_cache_tail %= SND_CACHE_SIZE; - m_snd_cache_len++; -} diff --git a/src/mess/audio/mea8000.c b/src/mess/audio/mea8000.c deleted file mode 100644 index 6936205b79f..00000000000 --- a/src/mess/audio/mea8000.c +++ /dev/null @@ -1,585 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Philips / Signetics MEA 8000 emulation. - - The MEA 8000 is a speech synthesis chip. - The French company TMPI (Techni-musique & parole informatique) provided - speech extensions for several 8-bit computers (Thomson, Amstrad, Oric). - It was quite popular in France because of its ability to spell 'u' - (unlike the more widespread SPO 296 chip). - - The synthesis is based on a 4-formant model. - First, an initial sawtooth noise signal is generated. - The signal passes through a cascade of 4 filters of increasing frequency. - Each filter is a second order digital filter with a programmable - frequency and bandwidth. - All parameters, including filter parameters, are smoothly interpolated - for the duration of a frame (8ms, 16ms, 32ms, or 64 ms). - - TODO: - - REQ output pin - - optimize mea8000_compute_sample - - should we accept new frames in slow-stop mode ? - -**********************************************************************/ - -#include - -#include "emu.h" -#include "mea8000.h" - - -#define VERBOSE 0 - -/* define to use double instead of int (slow but useful for debugging) */ -#undef FLOAT_MODE - - -/******************* utilitiy function and macros ********************/ - - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -/* digital filters work at 8 kHz */ -#define F0 8096 - -/* filtered output is supersampled x 8 */ -#define SUPERSAMPLING 8 - -/* actual output pediod */ -#define SAMPLING attotime::from_hz((SUPERSAMPLING*F0)) - - - -/************************* quantization tables ***********************/ - - - -/* frequency, in Hz */ - -static const int fm1_table[32] = -{ - 150, 162, 174, 188, 202, 217, 233, 250, - 267, 286, 305, 325, 346, 368, 391, 415, - 440, 466, 494, 523, 554, 587, 622, 659, - 698, 740, 784, 830, 880, 932, 988, 1047 -}; - -static const int fm2_table[32] = -{ - 440, 466, 494, 523, 554, 587, 622, 659, - 698, 740, 784, 830, 880, 932, 988, 1047, - 1100, 1179, 1254, 1337, 1428, 1528, 1639, 1761, - 1897, 2047, 2214, 2400, 2609, 2842, 3105, 3400 -}; - -static const int fm3_table[8] = -{ - 1179, 1337, 1528, 1761, 2047, 2400, 2842, 3400 -}; - -static const int fm4_table[1] = { 3500 }; - - - -/* bandwidth, in Hz */ -static const int bw_table[4] = { 726, 309, 125, 50 }; - - - -/* amplitude * 1000 */ -static const int ampl_table[16] = -{ - 0, 8, 11, 16, 22, 31, 44, 62, - 88, 125, 177, 250, 354, 500, 707, 1000 -}; - - - -/* pitch increment, in Hz / 8 ms */ -static const int pi_table[32] = -{ - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 0 /* noise */, -15, -14, -13, -12, -11, -10, -9, - -8, -7, -6, -5, -4, -3, -2, -1 -}; - - - -const device_type MEA8000 = &device_creator; - - -mea8000_device::mea8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, MEA8000, "Philips / Signetics MEA 8000 speech synthesizer", tag, owner, clock, "mea8000", __FILE__), - m_write_req(*this), - m_dac(*this) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void mea8000_device::device_start() -{ - m_write_req.resolve_safe(); - - init_tables(); - - m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mea8000_device::timer_expire),this)); - - save_item(NAME(m_state)); - save_item(NAME(m_buf)); - save_item(NAME(m_bufpos)); - save_item(NAME(m_cont)); - save_item(NAME(m_roe)); - save_item(NAME(m_framelength)); - save_item(NAME(m_framepos)); - save_item(NAME(m_framelog)); - save_item(NAME(m_lastsample)); - save_item(NAME(m_sample)); - save_item(NAME(m_phi)); - for (int i = 0; i < 4; i++) - { - save_item(NAME(m_f[i].fm), i); - save_item(NAME(m_f[i].last_fm), i); - save_item(NAME(m_f[i].bw), i); - save_item(NAME(m_f[i].last_bw), i); - save_item(NAME(m_f[i].output), i); - save_item(NAME(m_f[i].last_output), i); - } - save_item(NAME(m_last_ampl)); - save_item(NAME(m_ampl)); - save_item(NAME(m_last_pitch)); - save_item(NAME(m_pitch)); - save_item(NAME(m_noise)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void mea8000_device::device_reset() -{ - LOG(("mea8000_reset\n")); - m_timer->reset(); - m_phi = 0; - m_cont = 0; - m_roe = 0; - m_state = MEA8000_STOPPED; - update_req(); - for (int i = 0; i < 4; i++) - { - m_f[i].last_output = 0; - m_f[i].output = 0; - } -} - - - -/***************************** REQ **********************************/ - - -int mea8000_device::accept_byte() -{ - return m_state == MEA8000_STOPPED || m_state == MEA8000_WAIT_FIRST || (m_state == MEA8000_STARTED && m_bufpos < 4); -} - -void mea8000_device::update_req() -{ - // actually, req pulses less than 3us for each new byte, - // it goes back up if there space left in the buffer, or stays low if the - // buffer contains a complete frame and the CPU nees to wait for the next - // frame end to compose a new frame. - m_write_req(accept_byte()); -} - - - -/*********************** sound generation ***************************/ - - -/* precompute tables */ -void mea8000_device::init_tables() -{ - for (int i = 0; i < TABLE_LEN; i++) - { - double f = (double)i / F0; - m_cos_table[i] = 2. * cos(2. * M_PI * f) * QUANT; - m_exp_table[i] = exp(-M_PI * f) * QUANT; - m_exp2_table[i] = exp(-2 * M_PI * f) * QUANT; - } - for (int i = 0; i < NOISE_LEN; i++) - m_noise_table[i] = (machine().rand() % (2 * QUANT)) - QUANT; -} - - -#ifndef FLOAT_MODE /* UINT16 version */ - - - -/* linear interpolation */ -int mea8000_device::interp( UINT16 org, UINT16 dst ) -{ - return org + (((dst - org) * m_framepos) >> m_framelog); -} - - -/* apply second order digital filter, sampling at F0 */ -int mea8000_device::filter_step( int i, int input ) -{ - /* frequency */ - int fm = interp(m_f[i].last_fm, m_f[i].fm); - /* bandwidth */ - int bw = interp(m_f[i].last_bw, m_f[i].bw); - /* filter coefficients */ - int b = (m_cos_table[fm] * m_exp_table[bw]) / QUANT; - int c = m_exp2_table[bw]; - /* transfer function */ - int next_output = input + (b * m_f[i].output - c * m_f[i].last_output) / QUANT; - m_f[i].last_output = m_f[i].output; - m_f[i].output = next_output; - return next_output; -} - - -/* random waveform, in [-QUANT,QUANT] */ -int mea8000_device::noise_gen() -{ - m_phi = (m_phi + 1) % NOISE_LEN; - return m_noise_table[m_phi]; -} - - -/* sawtooth waveform at F0, in [-QUANT,QUANT] */ -int mea8000_device::freq_gen() -{ - int pitch = interp(m_last_pitch, m_pitch); - m_phi = (m_phi + pitch) % F0; - return ((m_phi % F0) * QUANT * 2) / F0 - QUANT; -} - - -/* sample in [-32768,32767], at F0 */ -int mea8000_device::compute_sample() -{ - int out; - int ampl = interp(m_last_ampl, m_ampl); - - if (m_noise) - out = noise_gen(); - else - out = freq_gen(); - - out *= ampl / 32; - - for (int i = 0; i < 4; i++) - out = filter_step(i, out); - - if (out > 32767) - out = 32767; - if (out < -32767) - out = -32767; - return out; -} - - - -#else /* float version */ - - - -/* linear interpolation */ -double mea8000_device::interp(double org, double dst) -{ - return org + ((dst - org) * m_framepos) / m_framelength; -} - - -/* apply second order digital filter, sampling at F0 */ -double mea8000_device::filter_step(int i, double input) -{ - double fm = interp(m_f[i].last_fm, m_f[i].fm); - double bw = interp(m_f[i].last_bw, m_f[i].bw); - double b = 2. * cos(2. * M_PI * fm / F0); - double c = -exp(-M_PI * bw / F0); - double next_output = input - c * (b * m_f[i].output + c * m_f[i].last_output); - m_f[i].last_output = m_f[i].output; - m_f[i].output = next_output; - return next_output; -} - - -/* noise, in [-1,1] */ -double mea8000_device::noise_gen() -{ - m_phi++; - return (double) m_noise_table[m_phi % NOISE_LEN] / QUANT; -} - - - -/* sawtooth waveform at F0, in [-1,1] */ -double mea8000_device::freq_gen() -{ - int pitch = interp(m_last_pitch, m_pitch); - m_phi += pitch; - return (double) (m_phi % F0) / (F0 / 2.) - 1.; -} - - -/* sample in [-32767,32767], at F0 */ -int mea8000_device::compute_sample() -{ - double out; - double ampl = interp(8. * m_last_ampl, 8. * m_ampl); - - if (m_noise) - out = noise_gen(); - else - out = freq_gen(); - - out *= ampl; - - for (int i = 0; i < 4; i++) - { - out = filter_step(i, out); - } - - if (out > 32767) - out = 32767; - if (out < -32767) - out = -32767; - return out; -} - - -#endif - - -/*********************** frame management ***************************/ - - - -/* shift frame parameters from current to last */ -void mea8000_device::shift_frame() -{ - m_last_pitch = m_pitch; - for (int i = 0; i < 4; i++) - { - m_f[i].last_bw = m_f[i].bw; - m_f[i].last_fm = m_f[i].fm; - } - m_last_ampl = m_ampl; -} - - - -/* decode fields from buffer to current frame */ -void mea8000_device::decode_frame() -{ - int fd = (m_buf[3] >> 5) & 3; /* 0=8ms, 1=16ms, 2=32ms, 3=64ms */ - int pi = pi_table[m_buf[3] & 0x1f] << fd; - m_noise = (m_buf[3] & 0x1f) == 16; - m_pitch = m_last_pitch + pi; - m_f[0].bw = bw_table[m_buf[0] >> 6]; - m_f[1].bw = bw_table[(m_buf[0] >> 4) & 3]; - m_f[2].bw = bw_table[(m_buf[0] >> 2) & 3]; - m_f[3].bw = bw_table[m_buf[0] & 3]; - m_f[3].fm = fm4_table[0]; - m_f[2].fm = fm3_table[m_buf[1] >> 5]; - m_f[1].fm = fm2_table[m_buf[1] & 0x1f]; - m_f[0].fm = fm1_table[m_buf[2] >> 3]; - m_ampl = ampl_table[((m_buf[2] & 7) << 1) | (m_buf[3] >> 7)]; - m_framelog = fd + 6 /* 64 samples / ms */ + 3; - m_framelength = 1 << m_framelog; - m_bufpos = 0; -#ifdef FLOAT_MODE - LOG(("mea800_decode_frame: pitch=%i noise=%i fm1=%gHz bw1=%gHz fm2=%gHz bw2=%gHz fm3=%gHz bw3=%gHz fm4=%gHz bw4=%gHz ampl=%g fd=%ims\n", - m_pitch, m_noise, - m_f[0].fm, m_f[0].bw, m_f[1].fm, m_f[1].bw, - m_f[2].fm, m_f[2].bw, m_f[3].fm, m_f[3].bw, - m_ampl/1000., 8 << fd)); -#else - LOG(("mea800_decode_frame: pitch=%i noise=%i fm1=%iHz bw1=%iHz fm2=%iHz bw2=%iHz fm3=%iHz bw3=%iHz fm4=%iHz bw4=%iHz ampl=%g fd=%ims\n", - m_pitch, m_noise, - m_f[0].fm, m_f[0].bw, m_f[1].fm, m_f[1].bw, - m_f[2].fm, m_f[2].bw, m_f[3].fm, m_f[3].bw, - m_ampl/1000., 8 << fd)); -#endif -} - - - -void mea8000_device::start_frame() -{ - /* enter or stay in active mode */ - m_timer->reset(SAMPLING); - m_framepos = 0; -} - - - -void mea8000_device::stop_frame() -{ - /* enter stop mode */ - m_timer->reset(); - m_state = MEA8000_STOPPED; - m_dac->write_signed16(0x8000); -} - - - -/* next sample in frame, sampling at 64 kHz */ -TIMER_CALLBACK_MEMBER( mea8000_device::timer_expire ) -{ - int pos = m_framepos % SUPERSAMPLING; - - if (!pos) - { - /* sample is really computed only every 8-th time */ - m_lastsample = m_sample; - m_sample = compute_sample(); - m_dac->write_signed16(0x8000 + m_lastsample); - } - else - { - /* other samples are simply interpolated */ - int sample = m_lastsample + ((pos * (m_sample-m_lastsample)) / SUPERSAMPLING); - m_dac->write_signed16(0x8000 + sample); - } - - m_framepos++; - if (m_framepos >= m_framelength) - { - shift_frame(); - /* end of frame */ - if (m_bufpos == 4) - { - /* we have a successor */ - LOG(("%f mea8000_timer_expire: new frame\n", machine().time().as_double())); - decode_frame(); - start_frame(); - } - else if (m_cont) - { - /* repeat mode */ - LOG(("%f mea8000_timer_expire: repeat frame\n", machine().time().as_double())); - start_frame(); - } - /* slow stop */ - else if (m_state == MEA8000_STARTED) - { - m_ampl = 0; - LOG(("%f mea8000_timer_expire: fade frame\n", machine().time().as_double())); - start_frame(); - m_state = MEA8000_SLOWING; - } - else if (m_state == MEA8000_SLOWING) - { - LOG(("%f mea8000_timer_expire: stop frame\n", machine().time().as_double())); - stop_frame(); - } - update_req(); - } - else - { - /* continue frame */ - m_timer->reset(SAMPLING); - } -} - - -/************************** CPU interface ****************************/ - - -READ8_MEMBER( mea8000_device::read ) -{ - switch (offset) - { - case 0: /* status register */ - case 1: - /* ready to accept next frame */ -#if 0 - LOG(("%s %f: mea8000_r ready=%i\n", machine().describe_context(), machine().time().as_double(), accept_byte())); -#endif - return accept_byte() << 7; - - default: - logerror("%s mea8000_r invalid read offset %i\n", machine().describe_context(), offset); - } - return 0; -} - -WRITE8_MEMBER( mea8000_device::write ) -{ - switch (offset) - { - case 0: /* data register */ - if (m_state == MEA8000_STOPPED) - { - /* got pitch byte before first frame */ - m_pitch = 2 * data; - LOG(("%s %f: mea8000_w pitch %i\n", machine().describe_context(), machine().time().as_double(), m_pitch)); - m_state = MEA8000_WAIT_FIRST; - m_bufpos = 0; - } - else if (m_bufpos == 4) - { - /* overflow */ - LOG(("%s %f: mea8000_w data overflow %02X\n", machine().describe_context(), machine().time().as_double(), data)); - } - else - { - /* enqueue frame byte */ - LOG(("%s %f: mea8000_w data %02X in frame pos %i\n", machine().describe_context(), machine().time().as_double(), - data, m_bufpos)); - m_buf[m_bufpos] = data; - m_bufpos++; - if (m_bufpos == 4 && m_state == MEA8000_WAIT_FIRST) - { - /* fade-in first frame */ - int old_pitch = m_pitch; - m_last_pitch = old_pitch; - decode_frame(); - shift_frame(); - m_last_pitch = old_pitch; - m_ampl = 0; - start_frame(); - m_state = MEA8000_STARTED; - } - } - update_req(); - break; - - case 1: /* command register */ - { - int stop = BIT(data, 4); - - if (data & 8) - m_cont = BIT(data, 2); - - if (data & 2) - m_roe = BIT(data, 0); - - if (stop) - stop_frame(); - - LOG(( "%s %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n", - machine().describe_context(), machine().time().as_double(), data, - stop, m_cont, m_roe)); - - update_req(); - break; - } - - default: - logerror( "%s mea8000_w invalid write offset %i\n", machine().describe_context(), offset); - } -} diff --git a/src/mess/audio/mea8000.h b/src/mess/audio/mea8000.h deleted file mode 100644 index 5d09ee938c9..00000000000 --- a/src/mess/audio/mea8000.h +++ /dev/null @@ -1,140 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Philips MEA 8000 emulation. - -**********************************************************************/ - -#ifndef __MEA8000_H__ -#define __MEA8000_H__ - -#include "sound/dac.h" - -#define MCFG_MEA8000_DAC(_tag) \ - mea8000_device::static_set_dac_tag(*device, "^" _tag); - -#define MCFG_MEA8000_REQ_CALLBACK(_write) \ - devcb = &mea8000_device::set_reqwr_callback(*device, DEVCB_##_write); - -/* table amplitude [-QUANT,QUANT] */ -#define QUANT 512 - -/* filter coefficients from frequencies */ -#define TABLE_LEN 3600 - -/* noise generator table */ -#define NOISE_LEN 8192 - - -/* finite machine state controling frames */ -enum mea8000_state -{ - MEA8000_STOPPED, /* nothing to do, timer disabled */ - MEA8000_WAIT_FIRST, /* received pitch, wait for first full trame, timer disabled */ - MEA8000_STARTED, /* playing a frame, timer on */ - MEA8000_SLOWING /* repeating last frame with decreasing amplitude, timer on */ -}; - -ALLOW_SAVE_TYPE( mea8000_state ); - - -struct filter_t -{ -#ifdef FLOAT_MODE - double fm, last_fm; /* frequency, in Hz */ - double bw, last_bw; /* band-width, in Hz */ - double output, last_output; /* filter state */ -#else - UINT16 fm, last_fm; - UINT16 bw, last_bw; - INT32 output, last_output; -#endif -}; - -class mea8000_device : public device_t -{ -public: - mea8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~mea8000_device() {} - - static void static_set_dac_tag(device_t &device, const char *tag) { downcast(device).m_dac.set_tag(tag); } - template static devcb_base &set_req_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_req.set_callback(object); } - - DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - // internal state - - int accept_byte(); - void update_req(); - void init_tables(); -#ifndef FLOAT_MODE /* UINT16 version */ - int interp(UINT16 org, UINT16 dst); - int filter_step(int i, int input); - int noise_gen(); - int freq_gen(); - int compute_sample(); -#else /* float version */ - double interp(double org, double dst); - double filter_step(int i, double input); - double noise_gen(); - double freq_gen(); - double compute_sample(); -#endif - - void shift_frame(); - void decode_frame(); - void start_frame(); - void stop_frame(); - - TIMER_CALLBACK_MEMBER(timer_expire); - - devcb_write8 m_write_req; - - required_device m_dac; - - /* state */ - mea8000_state m_state; /* current state */ - - UINT8 m_buf[4]; /* store 4 consecutive data to form a frame info */ - UINT8 m_bufpos; /* new byte to write in frame info buffer */ - - UINT8 m_cont; /* if no data 0=stop 1=repeat last frame */ - UINT8 m_roe; /* enable req output, now unimplemented */ - - UINT16 m_framelength; /* in samples */ - UINT16 m_framepos; /* in samples */ - UINT16 m_framelog; /* log2 of framelength */ - - INT16 m_lastsample, m_sample; /* output samples are interpolated */ - - UINT32 m_phi; /* absolute phase for frequency / noise generator */ - - filter_t m_f[4]; /* filters */ - - UINT16 m_last_ampl, m_ampl; /* amplitude * 1000 */ - UINT16 m_last_pitch, m_pitch; /* pitch of sawtooth signal, in Hz */ - UINT8 m_noise; - - emu_timer *m_timer; - - int m_cos_table[TABLE_LEN]; /* fm => cos coefficient */ - int m_exp_table[TABLE_LEN]; /* bw => exp coefficient */ - int m_exp2_table[TABLE_LEN]; /* bw => 2*exp coefficient */ - int m_noise_table[NOISE_LEN]; - -}; - -extern const device_type MEA8000; - - -#endif diff --git a/src/mess/audio/socrates.c b/src/mess/audio/socrates.c deleted file mode 100644 index c35896e5c25..00000000000 --- a/src/mess/audio/socrates.c +++ /dev/null @@ -1,127 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/*************************************************************************** - - audio/socrates.c - Copyright (C) 2010-2011 Jonathan Gevaryahu AKA Lord Nightmare - - This handles the two squarewaves (plus the one weird wave) channels - on the V-tech Socrates system 27-0769 ASIC. - - -****************************************************************************/ - -#include "emu.h" -#include "socrates.h" - - -// device type definition -const device_type SOCRATES_SOUND = &device_creator; - - -//------------------------------------------------- -// socrates_snd_device - constructor -//------------------------------------------------- - -socrates_snd_device::socrates_snd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, SOCRATES_SOUND, "Socrates Sound", tag, owner, clock, "socrates_snd", __FILE__), - device_sound_interface(mconfig, *this) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void socrates_snd_device::device_start() -{ - m_freq[0] = m_freq[1] = 0xff; /* channel 1,2 frequency */ - m_vol[0] = m_vol[1] = 0x07; /* channel 1,2 volume */ - m_enable[0] = m_enable[1] = 0x01; /* channel 1,2 enable */ - m_channel3 = 0x00; /* channel 3 weird register */ - m_DAC_output = 0x00; /* output */ - m_state[0] = m_state[1] = m_state[2] = 0; - m_accum[0] = m_accum[1] = m_accum[2] = 0xFF; - m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() ? clock() : machine().sample_rate()); -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void socrates_snd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - for (int i = 0; i < samples; i++) - { - snd_clock(); - outputs[0][i] = ((int)m_DAC_output<<4); - } -} - - -const UINT8 socrates_snd_device::s_volumeLUT[16] = -{ -0, 61, 100, 132, 158, 183, 201, 218, -233, 242, 253, 255, 250, 240, 224, 211 -}; // this table is actually quite weird on the real console. -// 0, 0.033, 0.055, 0.07175, 0.086, 0.1, 0.11, 0.119, 0.127, 0.132, 0.138, 0.139, 0.136, 0.131, 0.122, 0.115 are the voltage amplitudes for the steps on channel 2. the last four are particularly bizarre, probably caused by some sort of internal clipping. - -void socrates_snd_device::snd_clock() /* called once per clock */ -{ - for (int channel = 0; channel < 2; channel++) - { - if ((m_accum[channel] == 0) && m_enable[channel]) - { - m_state[channel] = (m_state[channel]^0x1); - m_accum[channel] = m_freq[channel]; - } - else if (m_enable[channel]) - { - m_accum[channel]--; - } - else - { - m_accum[channel] = 0; // channel is disabled - m_state[channel] = 0; - } - } - // handle channel 3 here - m_DAC_output = (m_state[0]?(s_volumeLUT[m_vol[0]]*9.4):0); // channel 1 is ~2.4 times as loud as channel 2 - m_DAC_output += (m_state[1]?(s_volumeLUT[m_vol[1]]<<2):0); - // add channel 3 to dac output here -} - - -void socrates_snd_device::reg0_w(int data) -{ - m_stream->update(); - m_freq[0] = data; -} - -void socrates_snd_device::reg1_w(int data) -{ - m_stream->update(); - m_freq[1] = data; -} - -void socrates_snd_device::reg2_w(int data) -{ - m_stream->update(); - m_vol[0] = data&0xF; - m_enable[0] = (data&0x10)>>4; -} - -void socrates_snd_device::reg3_w(int data) -{ - m_stream->update(); - m_vol[1] = data&0xF; - m_enable[1] = (data&0x10)>>4; -} - -void socrates_snd_device::reg4_w(int data) -{ - m_stream->update(); - m_channel3 = data; -} diff --git a/src/mess/audio/socrates.h b/src/mess/audio/socrates.h deleted file mode 100644 index f1d2b1dd002..00000000000 --- a/src/mess/audio/socrates.h +++ /dev/null @@ -1,44 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -#pragma once - -#ifndef __SOCR_SND_H__ -#define __SOCR_SND_H__ - -class socrates_snd_device : public device_t, - public device_sound_interface -{ -public: - socrates_snd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - void reg0_w(int data); - void reg1_w(int data); - void reg2_w(int data); - void reg3_w(int data); - void reg4_w(int data); - -protected: - // device-level overrides - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); -private: - void snd_clock(); - static const UINT8 s_volumeLUT[]; - - // internal state - sound_stream * m_stream; - UINT8 m_freq[2]; // channel 1,2 frequencies - UINT8 m_vol[2]; // channel 1,2 volume - UINT8 m_enable[2]; // channel 1,2 enable - UINT8 m_channel3; // channel 3 weird register - UINT8 m_state[3]; // output states for channels 1,2,3 - UINT8 m_accum[3]; // accumulators for channels 1,2,3 - UINT16 m_DAC_output; // output -}; - -extern const device_type SOCRATES_SOUND; - - -#endif /* __SOCR_SND_H__ */ diff --git a/src/mess/audio/specimx_snd.c b/src/mess/audio/specimx_snd.c deleted file mode 100644 index 2b56c6b25f8..00000000000 --- a/src/mess/audio/specimx_snd.c +++ /dev/null @@ -1,101 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - audio/special.c - - Functions to emulate sound hardware of Specialist MX - ( based on code of DAI interface ) - -****************************************************************************/ - -#include "specimx_snd.h" - - -// device type definition -const device_type SPECIMX_SND = &device_creator; - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// specimx_sound_device - constructor -//------------------------------------------------- - -specimx_sound_device::specimx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, SPECIMX_SND, "Specialist MX Audio Custom", tag, owner, clock, "specimx_sound", __FILE__), - device_sound_interface(mconfig, *this), - m_mixer_channel(NULL) -{ - memset(m_specimx_input, 0, sizeof(int)*3); -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void specimx_sound_device::device_start() -{ - m_specimx_input[0] = m_specimx_input[1] = m_specimx_input[2] = 0; - m_mixer_channel = stream_alloc(0, 1, machine().sample_rate()); -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void specimx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - INT16 channel_0_signal; - INT16 channel_1_signal; - INT16 channel_2_signal; - - stream_sample_t *sample_left = outputs[0]; - - channel_0_signal = m_specimx_input[0] ? 3000 : -3000; - channel_1_signal = m_specimx_input[1] ? 3000 : -3000; - channel_2_signal = m_specimx_input[2] ? 3000 : -3000; - - while (samples--) - { - *sample_left = 0; - - /* music channel 0 */ - *sample_left += channel_0_signal; - - /* music channel 1 */ - *sample_left += channel_1_signal; - - /* music channel 2 */ - *sample_left += channel_2_signal; - - sample_left++; - } -} - - -//------------------------------------------------- -// PIT callbacks -//------------------------------------------------- - -WRITE_LINE_MEMBER(specimx_sound_device::set_input_ch0) -{ - m_mixer_channel->update(); - m_specimx_input[0] = state; -} - -WRITE_LINE_MEMBER(specimx_sound_device::set_input_ch1) -{ - m_mixer_channel->update(); - m_specimx_input[1] = state; -} - -WRITE_LINE_MEMBER(specimx_sound_device::set_input_ch2) -{ - m_mixer_channel->update(); - m_specimx_input[2] = state; -} diff --git a/src/mess/audio/specimx_snd.h b/src/mess/audio/specimx_snd.h deleted file mode 100644 index 0e07b27dc4b..00000000000 --- a/src/mess/audio/specimx_snd.h +++ /dev/null @@ -1,39 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * specimx_snd.h - * - ****************************************************************************/ - -#ifndef SPECIAL_SND_H_ -#define SPECIAL_SND_H_ - -#include "emu.h" - -class specimx_sound_device : public device_t, - public device_sound_interface -{ -public: - specimx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~specimx_sound_device() { } - - DECLARE_WRITE_LINE_MEMBER(set_input_ch0); - DECLARE_WRITE_LINE_MEMBER(set_input_ch1); - DECLARE_WRITE_LINE_MEMBER(set_input_ch2); - -protected: - // device-level overrides - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -private: - sound_stream *m_mixer_channel; - int m_specimx_input[3]; -}; - -extern const device_type SPECIMX_SND; - -#endif /* SPECIAL_SND_H_ */ diff --git a/src/mess/audio/svis_snd.c b/src/mess/audio/svis_snd.c deleted file mode 100644 index 86408d26820..00000000000 --- a/src/mess/audio/svis_snd.c +++ /dev/null @@ -1,269 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/*************************************************************************** - supervision sound hardware - - PeT mess@utanet.at -***************************************************************************/ - -#include "emu.h" -#include "svis_snd.h" - - -// device type definition -const device_type SVISION_SND = &device_creator; - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// svision_sound_device - constructor -//------------------------------------------------- - -svision_sound_device::svision_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, SVISION_SND, "Super Vision Audio Custom", tag, owner, clock, "svision_sound", __FILE__), - device_sound_interface(mconfig, *this), - m_mixer_channel(NULL) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void svision_sound_device::device_start() -{ - // bind callbacks - m_irq_cb.bind_relative_to(*owner()); - - memset(&m_dma, 0, sizeof(m_dma)); - memset(&m_noise, 0, sizeof(m_noise)); - memset(m_channel, 0, sizeof(m_channel)); - - m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void svision_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t *left=outputs[0], *right=outputs[1]; - int i, j; - SVISION_CHANNEL *channel; - - for (i = 0; i < samples; i++, left++, right++) - { - *left = 0; - *right = 0; - for (channel=m_channel, j=0; jsize != 0) - { - if (channel->on||channel->count) - { - int on = FALSE; - switch (channel->waveform) - { - case 0: - on = channel->pos <= (28 * channel->size) >> 5; - break; - case 1: - on = channel->pos <= (24 * channel->size) >> 5; - break; - default: - case 2: - on = channel->pos <= channel->size / 2; - break; - case 3: - on = channel->pos <= (9 * channel->size) >> 5; - break; - } - { - INT16 s = on ? channel->volume << 8 : 0; - if (j == 0) - *right += s; - else - *left += s; - } - } - channel->pos++; - if (channel->pos >= channel->size) - channel->pos = 0; - } - } - if (m_noise.on && (m_noise.play || m_noise.count)) - { - INT16 s = (m_noise.value ? 1 << 8: 0) * m_noise.volume; - int b1, b2; - if (m_noise.left) - *left += s; - if (m_noise.right) - *right += s; - m_noise.pos += m_noise.step; - if (m_noise.pos >= 1.0) - { - switch (m_noise.type) - { - case SVISION_NOISE_Type7Bit: - m_noise.value = m_noise.state & 0x40 ? 1 : 0; - b1 = (m_noise.state & 0x40) != 0; - b2 = (m_noise.state & 0x20) != 0; - m_noise.state=(m_noise.state<<1)+(b1!=b2?1:0); - break; - case SVISION_NOISE_Type14Bit: - default: - m_noise.value = m_noise.state & 0x2000 ? 1 : 0; - b1 = (m_noise.state & 0x2000) != 0; - b2 = (m_noise.state & 0x1000) != 0; - m_noise.state = (m_noise.state << 1) + (b1 != b2 ? 1 : 0); - } - m_noise.pos -= 1; - } - } - if (m_dma.on) - { - UINT8 sample; - INT16 s; - UINT16 addr = m_dma.start + (unsigned) m_dma.pos / 2; - if (addr >= 0x8000 && addr < 0xc000) - { - sample = machine().root_device().memregion("user1")->base()[(addr & 0x3fff) | m_dma.ca14to16]; - } - else - { - sample = machine().device("maincpu")->memory().space(AS_PROGRAM).read_byte(addr); - } - if (((unsigned)m_dma.pos) & 1) - s = (sample & 0xf); - else - s = (sample & 0xf0) >> 4; - s <<= 8; - if (m_dma.left) - *left += s; - if (m_dma.right) - *right += s; - m_dma.pos += m_dma.step; - if (m_dma.pos >= m_dma.size) - { - m_dma.finished = TRUE; - m_dma.on = FALSE; - m_irq_cb(); - } - } - } -} - - -WRITE8_MEMBER( svision_sound_device::sounddma_w ) -{ - logerror("%.6f svision snddma write %04x %02x\n", space.machine().time().as_double(),offset+0x18,data); - m_dma.reg[offset] = data; - switch (offset) - { - case 0: - case 1: - m_dma.start = (m_dma.reg[0] | (m_dma.reg[1] << 8)); - break; - case 2: - m_dma.size = (data ? data : 0x100) * 32; - break; - case 3: - m_dma.step = space.machine().device("maincpu")->unscaled_clock() / (256.0 * space.machine().sample_rate() * (1 + (data & 3))); - m_dma.right = data & 4; - m_dma.left = data & 8; - m_dma.ca14to16 = ((data & 0x70) >> 4) << 14; - break; - case 4: - m_dma.on = data & 0x80; - if (m_dma.on) - { - m_dma.pos = 0.0; - } - break; - } -} - - -WRITE8_MEMBER( svision_sound_device::noise_w ) -{ - // logerror("%.6f svision noise write %04x %02x\n",machine.time(),offset+0x28,data); - m_noise.reg[offset]=data; - switch (offset) - { - case 0: - m_noise.volume=data&0xf; - m_noise.step= space.machine().device("maincpu")->unscaled_clock() / (256.0*space.machine().sample_rate()*(1+(data>>4))); - break; - case 1: - m_noise.count = data + 1; - break; - case 2: - m_noise.type = (SVISION_NOISE_Type) (data & 1); - m_noise.play = data & 2; - m_noise.right = data & 4; - m_noise.left = data & 8; - m_noise.on = data & 0x10; /* honey bee start */ - m_noise.state = 1; - break; - } - m_noise.pos=0.0; -} - - -int *svision_sound_device::dma_finished() -{ - return &m_dma.finished; -} - - -void svision_sound_device::sound_decrement() -{ - if (m_channel[0].count > 0) - m_channel[0].count--; - if (m_channel[1].count > 0) - m_channel[1].count--; - if (m_noise.count > 0) - m_noise.count--; -} - - -void svision_sound_device::soundport_w(int which, int offset, int data) -{ - SVISION_CHANNEL *channel = &m_channel[which]; - UINT16 size; - - m_mixer_channel->update(); - channel->reg[offset] = data; - - switch (offset) - { - case 0: - case 1: - size = channel->reg[0] | ((channel->reg[1] & 7) << 8); - if (size) - { - // channel->size=(int)(device->machine().sample_rate()*(size<<5)/4e6); - channel->size= (int) (machine().sample_rate() * (size << 5) / machine().device("maincpu")->unscaled_clock()); - } - else - { - channel->size = 0; - } - channel->pos = 0; - break; - case 2: - channel->on = data & 0x40; - channel->waveform = (data & 0x30) >> 4; - channel->volume = data & 0xf; - break; - case 3: - channel->count = data + 1; - break; - } -} diff --git a/src/mess/audio/svis_snd.h b/src/mess/audio/svis_snd.h deleted file mode 100644 index 7d21bc4fdfb..00000000000 --- a/src/mess/audio/svis_snd.h +++ /dev/null @@ -1,142 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * svis_snd.h - * - ****************************************************************************/ - -#ifndef SVIS_SND_H_ -#define SVIS_SND_H_ - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -enum SVISION_NOISE_Type -{ - SVISION_NOISE_Type7Bit, - SVISION_NOISE_Type14Bit -}; - -struct SVISION_NOISE -{ - SVISION_NOISE() : - on(0), - right(0), - left(0), - play(0), - type(SVISION_NOISE_Type7Bit), - state(0), - volume(0), - count(0), - step(0.0), - pos(0.0), - value(0) - { - memset(reg, 0, sizeof(UINT8)*3); - } - - UINT8 reg[3]; - int on, right, left, play; - SVISION_NOISE_Type type; - int state; - int volume; - int count; - double step, pos; - int value; // currently simple random function -}; - -struct SVISION_DMA -{ - SVISION_DMA() : - on(0), - right(0), - left(0), - ca14to16(0), - start(0), - size(0), - pos(0.0), - step(0.0), - finished(0) - { - memset(reg, 0, sizeof(UINT8)*5); - } - - UINT8 reg[5]; - int on, right, left; - int ca14to16; - int start,size; - double pos, step; - int finished; -}; - -struct SVISION_CHANNEL -{ - SVISION_CHANNEL() : - on(0), - waveform(0), - volume(0), - pos(0), - size(0), - count(0) - { - memset(reg, 0, sizeof(UINT8)*4); - } - - UINT8 reg[4]; - int on; - int waveform, volume; - int pos; - int size; - int count; -}; - -typedef device_delegate svision_snd_irq_delegate; -#define SVISION_SND_IRQ_MEMBER(_name) void _name(void) - -#define SVISION_SND_IRQ_CB(_class, _method) \ - svision_sound_device::set_irq_callback(*device, svision_snd_irq_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - -// ======================> svision_sound_device - -class svision_sound_device : public device_t, - public device_sound_interface -{ -public: - svision_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~svision_sound_device() { } - - // static configuration - static void set_irq_callback(device_t &device, svision_snd_irq_delegate callback) { downcast(device).m_irq_cb = callback; } - -protected: - // device-level overrides - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -public: - DECLARE_WRITE8_MEMBER( sounddma_w ); - DECLARE_WRITE8_MEMBER( noise_w ); - -public: - int *dma_finished(); - void sound_decrement(); - void soundport_w(int which, int offset, int data); - -private: - svision_snd_irq_delegate m_irq_cb; - - sound_stream *m_mixer_channel; - SVISION_DMA m_dma; - SVISION_NOISE m_noise; - SVISION_CHANNEL m_channel[2]; -}; - -extern const device_type SVISION_SND; - - -#endif /* SVIS_SND_H_ */ diff --git a/src/mess/audio/tvc_snd.c b/src/mess/audio/tvc_snd.c deleted file mode 100644 index 29d61b5dc7c..00000000000 --- a/src/mess/audio/tvc_snd.c +++ /dev/null @@ -1,142 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Videotone TVC 32/64 sound emulation - -***************************************************************************/ - -#include "emu.h" -#include "tvc_snd.h" - -// device type definition -const device_type TVC_SOUND = &device_creator; - -//------------------------------------------------- -// tvc_sound_device - constructor -//------------------------------------------------- - -tvc_sound_device::tvc_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, TVC_SOUND, "TVC 64 Audio Custom", tag, owner, clock, "tvc_sound", __FILE__), - device_sound_interface(mconfig, *this), - m_write_sndint(*this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- -void tvc_sound_device::device_start() -{ - // resolve callbacks - m_write_sndint.resolve_safe(); - - m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate()); - m_sndint_timer = timer_alloc(TIMER_SNDINT); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- -void tvc_sound_device::device_reset() -{ - m_enabled = 0; - m_freq = 0; - m_incr = 0; - m_signal = 1; - m_sndint_timer->reset(); -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void tvc_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - m_write_sndint(1); -} - -//------------------------------------------------- -// sound_stream_update - handle update requests for -// our sound stream -//------------------------------------------------- - -void tvc_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - int rate = machine().sample_rate() / 2; - - if (m_enabled && m_freq) - { - while( samples-- > 0 ) - { - *outputs[0]++ = m_signal * (m_volume * 0x0800); - m_incr -= m_freq; - while(m_incr < 0) - { - m_incr += rate; - m_signal = -m_signal; - } - } - } - else - { - // fill output with 0 if the sound is disabled - memset(outputs[0], 0, samples * sizeof(stream_sample_t)); - } -} - - - -//------------------------------------------------- -// ports write -//------------------------------------------------- - -WRITE8_MEMBER(tvc_sound_device::write) -{ - m_stream->update(); - - m_ports[offset] = data; - - switch(offset) - { - case 1: - m_enabled = BIT(data, 4); - // fall through - - case 0: - { - UINT16 pitch = (m_ports[0] | (m_ports[1]<<8)) & 0x0fff; - m_freq = (pitch == 0x0fff) ? 0 : (int)(195312.5 / (4096 - pitch)); - - if ((m_ports[1] & 0x20) && m_freq != 0) - m_sndint_timer->adjust(attotime::from_hz(m_freq), 0, attotime::from_hz(m_freq)); - else - m_sndint_timer->reset(); - - break; - } - - case 2: - m_volume = (data>>2) & 0x0f; - break; - } -} - - -//------------------------------------------------- -// tvc_sound_device::reset_divider -//------------------------------------------------- - -void tvc_sound_device::reset_divider() -{ - m_stream->update(); - - m_incr = 0; - m_signal = 1; - - if (m_ports[1] & 0x20 && m_freq != 0) - m_sndint_timer->adjust(attotime::from_hz(m_freq), 0, attotime::from_hz(m_freq)); - else - m_sndint_timer->reset(); -} diff --git a/src/mess/audio/tvc_snd.h b/src/mess/audio/tvc_snd.h deleted file mode 100644 index b8b955d3c45..00000000000 --- a/src/mess/audio/tvc_snd.h +++ /dev/null @@ -1,59 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/***************************************************************************** - * - * includes/tvc.h - * - ****************************************************************************/ - -#pragma once - -#ifndef _TVC_SND_H_ -#define _TVC_SND_H_ - -#define MCFG_TVC_SOUND_SNDINT_CALLBACK(_write) \ - devcb = &tvc_sound_device::set_sndint_wr_callback(*device, DEVCB_##_write); - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> tvc_sound_device - -class tvc_sound_device : public device_t, - public device_sound_interface -{ -public: - // construction/destruction - tvc_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_sndint_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_sndint.set_callback(object); } - - DECLARE_WRITE8_MEMBER(write); - void reset_divider(); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -private: - static const device_timer_id TIMER_SNDINT = 0; - - sound_stream * m_stream; - int m_freq; - int m_enabled; - int m_volume; - int m_incr; - int m_signal; - UINT8 m_ports[3]; - emu_timer * m_sndint_timer; - devcb_write_line m_write_sndint; -}; - -// device type definition -extern const device_type TVC_SOUND; - -#endif diff --git a/src/mess/audio/upd1771.c b/src/mess/audio/upd1771.c deleted file mode 100644 index 96b3b2bb062..00000000000 --- a/src/mess/audio/upd1771.c +++ /dev/null @@ -1,554 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Viens -/********************************************************************** - - NEC uPD1771-017 as used in the Epoch Super Cassette Vision (SCV) - - Made using recording/analysis on a Yeno (PAL Super Cassete Vision) - by plgDavid - - Full markings on my 2 specimens are - "NEC JAPAN 8431K9 D1771C 017" (31st week of 1984, mask rom #017) - - I've since (October 2012) got a Grandstand Firefox F-7 Handheld game - (AKA Epoch GalagaX6/Epoch Astro Thunder 7/Tandy Astro Thunder), - (http://www.handheldmuseum.com/Grandstand/Firefox.htm) - which includes a - "NEC JAPAN 8319K9 D1771C 011" (19th week of 1983, mask rom #011) - Thanks to user 'Blanka' from Dragonslairfans for the nice catch! - (http://www.dragonslairfans.com/smfor/index.php?topic=3061.0) - - Since the chip generates tones using ROM wavetables, - it is perfectly possible to generate other sounds with different rom code and data. - - Most upd17XXX devices are typically 4bit NEC MCUs, however based on information - in "Electronic Speech Synthesis" by Geoff Bristow (ISBN 0-07-007912-9, pages 148-152) - the upd1770/1771 is not one of these 4-bit ones. - - The uPD1770/uPD1771 SSM is a 16-bit-wide rom/ram mcu with 8kb (4kw) of rom code, - 64 bytes of ram (16x16bit words addressable as 16 or 2x8 bits each, the - remaining 32 bytes acting as an 8-level stack), 182 instructions, a complex - noise and tone internal interrupt system, external interrupts, - and two 8-bit ports with multiple modes allowing for chips to operate as master - or slave devices. - SSM stands for "Sound Synthesis Microcomputer". - - People who I *THINK* worked on the uPD1771 and what part I think they worked on: - Toshio Oura - Project Lead(?), VSRSSS/TSRSSS speech synthesis engine (on upd1776C), master/slave i/o controls, author of bristow article and primary author of the IEEE article - Hatsuhide Igarashi - Clock oscillator and pad layout, coauthor on the IEEE article, other IEEE stuff - Tomoaki Isozaki - ? (senior NEC engineer?), coauthor on the IEEE article - Sachiyuki Toufuku - ?, coauthor on the IEEE article - Tojiro Mukawa - IGFETs and the DAC - M. Sakai ? - digital filtering for VSRSSS? (IEEE 4131979, 1169295) - M. Endo ? - digital design system or speech synthesis? (IEEE 4069656, another? person: IEEE 150330, 225838) - H. Aoyama ? - logic design system used to assemble/lay out the chip? (IEEE 1585393) - I. Fujitaka ? (no IEEE) - Eiji Sugimoto - cpu design? 1156033 1155824 - F. Tsukuda ? (no IEEE) - N. Miyake ? switched capacitor stuff? (IEEE nnnnnn) - - - The uPD1771 internal workings are described to some extent by the Bristow book - and the IEEE article "A Single-Chip Sound Synthesis Microcomputer" which complements the book - and are covered by at least four US patents: - 4184152 - on IGFET-based DAC stuff - 4488061 - on the IGFET-based drive circuit part of the DAC. - 4408094 - covers the 3 pin DAC with the volume control/vref pin. Not all that interesting, - except it might describe to some extent how the (9->5bit?) PWM works in the text. - 4470113 - covers the multiplexed PB0/1/2/3 pins and their use as /CS /WR /RD and ALE - note as I have marked the pins below I assume the final pins connected - to /CS /WR /RD and /ALE are PB7,6,5,4 but this is just a guess of mine: - The actual order may well match the patent. - 4577343 - covers the VSRSSS implementation as discussed in the Bristow book. - This patent has an internal diagram of the workings of the chips and - a limited description of how many registers etc it has. - 4805508 - on the operation of the tone divider register and correction for accurate period when - the tone interrupt frequency is not perfectly divisible from the clock. - These next two may not be specific to the 1771 or even related at all! - 4321562 - on a self-adjusting circuit for internal coupling to the clock crystal inputs. - This may be a generic NEC invention and probably isn't limited to the upd1771. - 4656491 - on a new method of distributing resistors and transistors on anti-ESD pin buffers - This may be a generic NEC invention and probably isn't limited to the upd1771. - - - Based on the 4577343 patent mostly, plus the bristow and IEEE article: - * these are the registers: - 8bits: - AH, AL (forming the 16-bit A' accumulator), - B, C (a pair of general purpose registers), - 4bits (may be technically part of ALU): - H -> points to one of the 16 words of ram - 1bit: - L -> selector of left or right half of the ram word - ?bits: - D (having to do with the DAC) - N (3 bits? having to do with the pseudorandom noise interrupt, namely setting the clock divider ratio for the PRNG clock vs cpu clock) - MODE (5 or more bits? enabling/disabling/acking the noise interrupt, and the tone interrupts (there are four!)) - SP (the stack pointer, probably 5 bits, points to the stack ram; may encompass H and L as above!) - FLO: unsure. quite possibly 'flag overflow' used for branching. there likely exists other flags as well... - ODF: 'output data flag?', selects which half of a selected ram word is output to the dac not really sure of this? - - - Mask roms known: - uPD1776C: mentioned in the bristow book, implements VSRSSS speech concatenation - (see US Patent 4577343 which is a patent on this VSRSSS implementation) - uPD1771C-006: used in NEC APC for sound as the "MPU" - -011: used on Firefox F-4/Astro Thunder handheld - -015: unknown, known to exist from part scalper sites only. - -017: used on Epoch Super Cassete Vision for sound; This audio driver HLEs that part only. - - Used pinout in the SCV: - - NC 1 28 NC - NC 2 27 NC - NC 3 26 ACK - !WR 4 25 D7 - !CS 5 24 D6 - RESET 6 23 D5 - NC 7 22 D4 - VCC 8 21 D3 - 6Mhz XIN 9 20 D2 - 6Mhz XOUT 10 19 D1 - AUDOUT 11 18 D0 - NC(recheck!)12 17 GND - AUDOUT(inv) 13 16 VCC - GND 14 15 ? tied to pin 16 (VCC) through a resistor (pullup?) - - Pinout based on guesses and information in "Electronic Speech Synthesis" by Geoff Bristow - (ISBN 0-07-007912-9, pages 148-152), and the data on page 233 of the Nec APC technical manual at - http://bitsavers.trailing-edge.com/pdf/nec/APC/819-000100-1003_APC_System_Reference_Guide_Apr83.pdf - I/O pin purpose based on testing by kevtris. - [x] is unsure: - PB3 <> 1 28 <> PB2 - PB4(/ALE) <> 2 27 <> PB1 - PB5(/RD) <> 3 26 <> PB0 - PB6(/WR) <> 4 25 <> D7(PA7) - PB7(/CS) <> 5 24 <> D6(PA6) - /RESET -> 6 23 <> D5(PA5) - [/TSTOUT?] <- 7 22 <> D4(PA4) - VCC -- 8 21 <> D3(PA3) - XI(CLK) -> 9 20 <> D2(PA2) - XO <- 10 19 <> D1(PA1) - D/A OUT + <- 11 18 <> D0(PA0) - D/A POWER -- 12 17 <- CH2 - D/A OUT - <- 13 16 <> /EXTINT and [/TSTOUT2?] (test out is related to pin 15 state) - GND -- 14 15 <- CH1 tied to pin 16 (VCC) through a resistor, on APC to VCC thru a 12k resistor and thru a 10uf cap to gnd - - CH1 and CH2 are mode selects, purpose based on testing by kevtris: - CH1 CH2 - H L - 'master' mode, pb4-pb7 are i/o? /EXTINT is an input - L L - 'slave' mode where pb4-pb7 are /ale /rd /wr /cs? /EXTINT may be an output in this mode? - X H - test mode: the 512 byte 16-bit wide ROM is output sequentially on pins pa7-pa0 and pb7-pb0 for the high and low bytes of each word respectively - D/A POWER is the FET source for the D/A OUT+ and D/A OUT- push-pull dac drains; it should be tied to VCC or thereabouts - - In the SCV (info from plgDavid): - pin 5 is tied to the !SCPU pin on the Epoch TV chip pin 29 (0x3600 writes) - pin 6 is tied to the PC3 pin of the upD7801 CPU - pin 26 is tied to the INT1 pin of the upD7801 (CPU pin 12), - - 1,2,3,28,27 don't generate any digital signals - 6 seems to be lowered 2.5 ms before an audio write - 7 is always low. - 12 is always high - - (NOTE: the photomicrograph in the bristow book makes it fairly clear due to - pad thicknessess that the real VCC is pin 8 and the real GND is pin 14. - The function of pin 7 is unknown. - - Pins 11 and 13 go to a special circuit, which according to kevtris's analysis - of my schematics, consist of a balanced output (not unlike XLR cables), - which are then combined together then sent to the RF box. - (The bristow book explains that there are two DAC pins and one DAC - VREF/volume pin. The dac+ and dac- are pins 11 and 13, and based on the - photomicrograph it looks like dac vref is probably pin 12) - - HLE: - All writes are made through address 0x3600 on the upD7801 - Instead of using register=value, this chip require sending multiple - bytes for each command, one after the other. - -**********************************************************************/ - -#include "emu.h" -#include "audio/upd1771.h" - - -#define LOG 0 - -/* - Each of the 8 waveforms have been extracted from the uPD1771c-017 internal - ROM, from offset 0x1fd (start of first waveform) to offset 0x2fc (end of - last waveform). - (note: given test mode dumping offset non-clarity it may be 0x200-0x2ff) - The waveforms are stored in an 8-bit sign-magnitude format, so if in ROM the - upper bit is 0x80, invert the lower 7 bits to get the 2's complement result - seen here. - Note that only the last 4 waveforms appear to have been intended for use as - waveforms; the first four look as if they're playing back a piece of code as - wave data. -*/ -const char WAVEFORMS[8][32]={ -{ 0, 0,-123,-123, -61, -23, 125, 107, 94, 83,-128,-128,-128, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,-128,-128,-128, 0, 0, 0, 0, 0, 0}, -{ 37, 16, 32, -21, 32, 52, 4, 4, 33, 18, 60, 56, 0, 8, 5, 16, 65, 19, 69, 16, -2, 19, 37, 16, 97, 19, 0, 87, 127, -3, 1, 2}, -{ 0, 8, 1, 52, 4, 0, 0, 77, 81,-109, 47, 97, -83,-109, 38, 97, 0, 52, 4, 0, 1, 4, 1, 22, 2, -46, 33, 97, 0, 8, -85, -99}, -{ 47, 97, 40, 97, -3, 25, 64, 17, 0, 52, 12, 5, 12, 5, 12, 5, 12, 5, 12, 5, 8, 4,-114, 19, 0, 52,-122, 21, 2, 5, 0, 8}, -{ -52, -96,-118,-128,-111, -74, -37, -5, 31, 62, 89, 112, 127, 125, 115, 93, 57, 23, 0, -16, -8, 15, 37, 54, 65, 70, 62, 54, 43, 31, 19, 0}, -{ -81,-128, -61, 13, 65, 93, 127, 47, 41, 44, 52, 55, 56, 58, 58, 34, 0, 68, 76, 72, 61, 108, 55, 29, 32, 39, 43, 49, 50, 51, 51, 0}, -{ -21, -45, -67, -88,-105,-114,-122,-128,-123,-116,-103, -87, -70, -53, -28, -9, 22, 46, 67, 86, 102, 114, 123, 125, 127, 117, 104, 91, 72, 51, 28, 0}, -{ -78,-118,-128,-102, -54, -3, 40, 65, 84, 88, 84, 80, 82, 88, 94, 103, 110, 119, 122, 125, 122, 122, 121, 123, 125, 126, 127, 127, 125, 118, 82, 0} -}; - - -#define NOISE_SIZE 255 - - -static unsigned char noise_tbl[]= -{ - 0x1c,0x86,0x8a,0x8f,0x98,0xa1,0xad,0xbe,0xd9,0x8a,0x66,0x4d,0x40,0x33,0x2b,0x23, - 0x1e,0x8a,0x90,0x97,0xa4,0xae,0xb8,0xd6,0xec,0xe9,0x69,0x4a,0x3e,0x34,0x2d,0x27, - 0x24,0x24,0x89,0x8e,0x93,0x9c,0xa5,0xb0,0xc1,0xdd,0x40,0x36,0x30,0x29,0x27,0x24, - 0x8b,0x90,0x96,0x9e,0xa7,0xb3,0xc4,0xe1,0x25,0x21,0x8a,0x8f,0x93,0x9d,0xa5,0xb2, - 0xc2,0xdd,0xdd,0x98,0xa2,0xaf,0xbf,0xd8,0xfd,0x65,0x4a,0x3c,0x31,0x2b,0x24,0x22, - 0x1e,0x87,0x8c,0x91,0x9a,0xa3,0xaf,0xc0,0xdb,0xbe,0xd9,0x8c,0x66,0x4d,0x40,0x34, - 0x2c,0x24,0x1f,0x88,0x90,0x9a,0xa4,0xb2,0xc2,0xda,0xff,0x67,0x4d,0x3d,0x34,0x2d, - 0x26,0x24,0x20,0x89,0x8e,0x93,0x9c,0xa5,0xb1,0xc2,0xde,0xc1,0xda,0xff,0x67,0x4d, - 0x3d,0x33,0x2d,0x26,0x24,0x20,0x89,0x8e,0x93,0x9c,0xa5,0xb1,0xc2,0xdd,0xa3,0xb0, - 0xc0,0xd9,0xfe,0x66,0x4b,0x3c,0x32,0x2b,0x24,0x23,0x1e,0x88,0x8d,0x92,0x9b,0xa4, - 0xb0,0xc1,0xdc,0xad,0xbe,0xda,0x22,0x20,0x1c,0x85,0x8a,0x8f,0x98,0xa1,0xad,0xbe, - 0xda,0x20,0x1b,0x85,0x8d,0x97,0xa1,0xaf,0xbf,0xd8,0xfd,0x64,0x49,0x3a,0x30,0x2a, - 0x23,0x21,0x1d,0x86,0x8b,0x91,0x9a,0xa2,0xae,0xc0,0xdb,0x33,0x2b,0x24,0x1f,0x88, - 0x90,0x9a,0xa4,0xb2,0xc2,0xda,0xff,0x67,0x4c,0x3e,0x33,0x2d,0x25,0x24,0x1f,0x89, - 0x8e,0x93,0x9c,0xa5,0xb1,0xc2,0xde,0x85,0x8e,0x98,0xa2,0xb0,0xc0,0xd9,0xfe,0x64, - 0x4b,0x3b,0x31,0x2a,0x23,0x22,0x1e,0x88,0x8c,0x91,0x9b,0xa3,0xaf,0xc1,0xdc,0xdc -}; - - - -#define STATE_SILENCE 0 -#define STATE_NOISE 1 -#define STATE_TONE 2 -#define STATE_ADPCM 3 - - -const device_type UPD1771C = &device_creator; - - -upd1771c_device::upd1771c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, UPD1771C, "NEC uPD1771C 017", tag, owner, clock, "upd1771c", __FILE__), - device_sound_interface(mconfig, *this), - m_ack_handler(*this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void upd1771c_device::device_start() -{ - /* resolve callbacks */ - m_ack_handler.resolve_safe(); - - m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd1771c_device::ack_callback),this)); - - m_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 4); - - save_item(NAME(m_packet)); - save_item(NAME(m_index)); - save_item(NAME(m_expected_bytes)); - save_item(NAME(m_state)); - save_item(NAME(m_pc3)); - save_item(NAME(m_t_timbre)); - save_item(NAME(m_t_offset)); - save_item(NAME(m_t_period)); - save_item(NAME(m_t_volume)); - save_item(NAME(m_t_tpos)); - save_item(NAME(m_t_ppos)); - save_item(NAME(m_nw_timbre)); - save_item(NAME(m_nw_volume)); - save_item(NAME(m_nw_period)); - save_item(NAME(m_nw_tpos)); - save_item(NAME(m_nw_ppos)); - save_item(NAME(m_n_value)); - save_item(NAME(m_n_volume)); - save_item(NAME(m_n_period)); - save_item(NAME(m_n_ppos)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void upd1771c_device::device_reset() -{ - m_index = 0; - m_expected_bytes = 0; - m_pc3 = 0; - m_t_tpos = 0; - m_t_ppos = 0; - m_state = 0; - m_nw_tpos = 0; - memset(m_n_value, 0x00, sizeof(m_n_value)); - memset(m_n_ppos, 0x00, sizeof(m_n_ppos)); -} - - - -READ8_MEMBER( upd1771c_device::read ) -{ - return 0x80; // TODO -} - -/* -*************TONE***************** -Tone consists of a wavetable playback mechanism. -Each wavetable is a looping period of 32 samples but can be played with an offset from any point in the table -effectively shrinking the sample loop, thus allowing different pitch "macros ranges" to be played. -This method is rather crude because the spectrum of the sound get heavily altered... -unless that was the intent. - -Tone Write (4 bytes): - -Byte0: 0x02 - -Byte1: 0bTTTOOOOO - MSB 3 bits of Timbre (8 wavetables) - LSB 5 bits offset in the table. - -Byte2: 0bPPPPPPPP - 8bits of clock divider/period - Anything under <= 0x20 give the same value - -Byte3: 0b???VVVVV - MSB 3 bits unknown - LSB 5 bits of "Volume" - - Note: volume is not a volume in a normal sense but some kind - of bit cropping/rounding. -*/ - - -/* -*************NOISE***************** -Noise consists on 4 different components -A weird Wavetable LFSR (for lack of a better term), -and three independent (but equal) low frequency -50/50 pulse wavs. - -The 4 components are mixed in a mysterious way, -a weird ORing with volume having a huge effect. - -Byte0: 0x01 - -Byte1: 0bTTTOOOOO - MSB 3 bits of LFSR Timbre (8 wavetables) - LSB 5 bits ????????? - -Byte2: 0bPPPPPPPP - 8bits of clock divider/period - -Byte3: 0b???VVVVV - MSB 3 bits unknown - LSB 5 bits of "Volume" - - -Byte4: 0bPPPPPPPP Low Freq0 period(if not 0 this periodically resets the Wavetable LFSR) -Byte5: 0bPPPPPPPP Low Freq1 period(if not 0 this periodically resets the Wavetable LFSR) -Byte6: 0bPPPPPPPP Low Freq2 period(if not 0 this periodically resets the Wavetable LFSR) - -Byte7: 0b???VVVVV Low Freq0 volume -Byte8: 0b???VVVVV Low Freq1 volume -Byte9: 0b???VVVVV Low Freq2 volume -*/ - -WRITE8_MEMBER( upd1771c_device::write ) -{ - //if (LOG) - // logerror( "upd1771_w: received byte 0x%02x\n", data ); - - m_ack_handler(0); - - if (m_index < MAX_PACKET_SIZE) - m_packet[m_index++] = data; - else - { - logerror("upd1771_w: received byte 0x%02x overload!\n", data); - return; - } - - switch (m_packet[0]) - { - case 0: - m_state = STATE_SILENCE; - m_index = 0; - //logerror( "upd1771_w: ----------------silence state reset\n"); - break; - - case 1: - if (m_index == 10) - { - m_state = STATE_NOISE; - m_index = 0; - - m_nw_timbre = (m_packet[1] & 0xe0) >> 5; - m_nw_period = ((UINT32)m_packet[2] + 1) << 7; - m_nw_volume = m_packet[3] & 0x1f; - - //very long clocked periods.. used for engine drones - m_n_period[0] = (((UINT32)m_packet[4]) + 1) << 7; - m_n_period[1] = (((UINT32)m_packet[5]) + 1) << 7; - m_n_period[2] = (((UINT32)m_packet[6]) + 1) << 7; - - m_n_volume[0] = m_packet[7] & 0x1f; - m_n_volume[1] = m_packet[8] & 0x1f; - m_n_volume[2] = m_packet[9] & 0x1f; - - //logerror( "upd1771_w: ----------------noise state reset\n"); - } - else - m_timer->adjust(attotime::from_ticks(512, clock())); - break; - - case 2: - if (m_index == 4) - { - //logerror( "upd1771_w: ----------------tone state reset\n"); - m_t_timbre = (m_packet[1] & 0xe0) >> 5; - m_t_offset = (m_packet[1] & 0x1f); - m_t_period = m_packet[2]; - //smaller periods don't all equal to 0x20 - if (m_t_period < 0x20) - m_t_period = 0x20; - - m_t_volume = m_packet[3] & 0x1f; - m_state = STATE_TONE; - m_index = 0; - } - else - m_timer->adjust(attotime::from_ticks(512, clock())); - break; - - case 0x1f: - //6Khz(ish) DIGI playback - - //end capture - if (m_index >= 2 && m_packet[m_index - 2] == 0xfe && m_packet[m_index - 1] == 0x00) - { - //TODO play capture! - m_index = 0; - m_packet[0] = 0; - m_state = STATE_ADPCM; - } - else - m_timer->adjust(attotime::from_ticks(512, clock())); - break; - - //garbage: wipe stack - default: - m_state = STATE_SILENCE; - m_index = 0; - break; - } -} - - -WRITE_LINE_MEMBER( upd1771c_device::pcm_write ) -{ - //RESET upon HIGH - if (state != m_pc3) - { - logerror("upd1771_pc3 change!: state = %d\n", state); - m_index = 0; - m_packet[0] = 0; - } - - m_pc3 = state; -} - - -TIMER_CALLBACK_MEMBER( upd1771c_device::ack_callback ) -{ - m_ack_handler(1); -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void upd1771c_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t *buffer = outputs[0]; - - switch (m_state) - { - case STATE_TONE: - //logerror( "upd1771_STATE_TONE samps:%d %d %d %d %d %d\n",(int)samples, - // (int)m_t_timbre,(int)m_t_offset,(int)m_t_volume,(int)m_t_period,(int)m_t_tpos); - - while (--samples >= 0) - { - *buffer++ = (WAVEFORMS[m_t_timbre][m_t_tpos]) * m_t_volume * 2; - - m_t_ppos++; - if (m_t_ppos >= m_t_period) - { - m_t_tpos++; - if (m_t_tpos == 32) - m_t_tpos = m_t_offset; - - m_t_ppos = 0; - } - } - break; - - case STATE_NOISE: - while (--samples >= 0) - { - *buffer = 0; - - //"wavetable-LFSR" component - int wlfsr_val = ((int)noise_tbl[m_nw_tpos]) - 127;//data too wide - - m_nw_ppos++; - if (m_nw_ppos >= m_nw_period) - { - m_nw_tpos++; - if (m_nw_tpos == NOISE_SIZE) - m_nw_tpos = 0; - m_nw_ppos = 0; - } - - //mix in each of the noise's 3 pulse components - char res[3]; - for (int i = 0; i < 3; ++i) - { - res[i] = m_n_value[i] * 127; - m_n_ppos[i]++; - if (m_n_ppos[i] >= m_n_period[i]) - { - m_n_ppos[i] = 0; - m_n_value[i] = !m_n_value[i]; - } - } - //not quite, but close. - *buffer+= ( - (wlfsr_val * m_nw_volume) | - (res[0] * m_n_volume[0]) | - (res[1] * m_n_volume[1]) | - (res[2] * m_n_volume[2]) - ) ; - - buffer++; - } - break; - - default: - //fill buffer with silence - while (--samples >= 0) - { - *buffer++ = 0; - } - break; - } -} diff --git a/src/mess/audio/upd1771.h b/src/mess/audio/upd1771.h deleted file mode 100644 index e0757757e9c..00000000000 --- a/src/mess/audio/upd1771.h +++ /dev/null @@ -1,85 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/********************************************************************** - - NEC uPD1771 - -**********************************************************************/ - -#ifndef __UPD1771_H__ -#define __UPD1771_H__ - -#include "emu.h" - -#define MAX_PACKET_SIZE 0x8000 - -#define MCFG_UPD1771_ACK_HANDLER(_devcb) \ - devcb = &upd1771c_device::set_ack_handler(*device, DEVCB_##_devcb); - - -/*************************************************************************** - MACROS / CONSTANTS -***************************************************************************/ - -class upd1771c_device : public device_t, - public device_sound_interface -{ -public: - upd1771c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~upd1771c_device() {} - - template static devcb_base &set_ack_handler(device_t &device, _Object object) { return downcast(device).m_ack_handler.set_callback(object); } - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - WRITE_LINE_MEMBER( pcm_write ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -private: - // internal state - sound_stream *m_channel; - devcb_write_line m_ack_handler; - emu_timer *m_timer; - - TIMER_CALLBACK_MEMBER(ack_callback); - - UINT8 m_packet[MAX_PACKET_SIZE]; - UINT32 m_index; - UINT8 m_expected_bytes; - - UINT8 m_state;//0:silence, 1 noise, 2 tone - UINT8 m_pc3; - - //tone - UINT8 m_t_timbre; //[0; 7] - UINT8 m_t_offset; //[0; 32] - UINT16 m_t_period; //[0;255] - UINT8 m_t_volume; //[0; 31] - UINT8 m_t_tpos;//timbre pos - UINT16 m_t_ppos;//period pos - - //noise wavetable LFSR - UINT8 m_nw_timbre; //[0; 7] - UINT8 m_nw_volume; //[0; 31] - UINT32 m_nw_period; - UINT32 m_nw_tpos; //timbre pos - UINT32 m_nw_ppos; //period pos - - //noise pulse components - UINT8 m_n_value[3]; //[0;1] - UINT16 m_n_volume[3]; //[0; 31] - UINT32 m_n_period[3]; - UINT32 m_n_ppos[3]; //period pos -}; - -extern const device_type UPD1771C; - - -#endif /* __UPD1771_H__ */ diff --git a/src/mess/audio/vboy.c b/src/mess/audio/vboy.c deleted file mode 100644 index b808ee8a333..00000000000 --- a/src/mess/audio/vboy.c +++ /dev/null @@ -1,491 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/* - vboy.c - Virtual Boy audio emulation - - By Richard Bannister and Gil Pedersen. - MESS device adaptation by R. Belmont -*/ - -#include "emu.h" -#include "vboy.h" - -// device type definition -const device_type VBOYSND = &device_creator; - -//#define LAME_COMPILER_BUG - -#define SxINT 0x00 -#define SxLRV 0x04 -#define SxFQL 0x08 -#define SxFQH 0x0c -#define SxEV0 0x10 -#define SxEV1 0x14 -#define SxRAM 0x18 - -#define SxINTb 0x400+SxINT -#define SxLRVb 0x400+SxLRV -#define SxFQLb 0x400+SxFQL -#define SxFQHb 0x400+SxFQH -#define SxEV0b 0x400+SxEV0 -#define SxEV1b 0x400+SxEV1 -#define SxRAMb 0x400+SxRAM - -#define S5SWP 0x51c -#define SST0P 0x580 - -static const UINT16 outTbl[64][32] = { - { 0x0000, 0xffe0, 0xffc0, 0xffa0, 0xff80, 0xff60, 0xff40, 0xff20, 0xff00, 0xfee0, 0xfec0, 0xfea0, 0xfe80, 0xfe60, 0xfe40, 0xfe20, - 0xfe00, 0xfde0, 0xfdc0, 0xfda0, 0xfd80, 0xfd60, 0xfd40, 0xfd20, 0xfd00, 0xfce0, 0xfcc0, 0xfca0, 0xfc80, 0xfc60, 0xfc40, 0xfc20}, - { 0x0000, 0xffe1, 0xffc2, 0xffa3, 0xff84, 0xff65, 0xff46, 0xff27, 0xff08, 0xfee9, 0xfeca, 0xfeab, 0xfe8c, 0xfe6d, 0xfe4e, 0xfe2f, - 0xfe10, 0xfdf1, 0xfdd2, 0xfdb3, 0xfd94, 0xfd75, 0xfd56, 0xfd37, 0xfd18, 0xfcf9, 0xfcda, 0xfcbb, 0xfc9c, 0xfc7d, 0xfc5e, 0xfc3f}, - { 0x0000, 0xffe2, 0xffc4, 0xffa6, 0xff88, 0xff6a, 0xff4c, 0xff2e, 0xff10, 0xfef2, 0xfed4, 0xfeb6, 0xfe98, 0xfe7a, 0xfe5c, 0xfe3e, - 0xfe20, 0xfe02, 0xfde4, 0xfdc6, 0xfda8, 0xfd8a, 0xfd6c, 0xfd4e, 0xfd30, 0xfd12, 0xfcf4, 0xfcd6, 0xfcb8, 0xfc9a, 0xfc7c, 0xfc5e}, - { 0x0000, 0xffe3, 0xffc6, 0xffa9, 0xff8c, 0xff6f, 0xff52, 0xff35, 0xff18, 0xfefb, 0xfede, 0xfec1, 0xfea4, 0xfe87, 0xfe6a, 0xfe4d, - 0xfe30, 0xfe13, 0xfdf6, 0xfdd9, 0xfdbc, 0xfd9f, 0xfd82, 0xfd65, 0xfd48, 0xfd2b, 0xfd0e, 0xfcf1, 0xfcd4, 0xfcb7, 0xfc9a, 0xfc7d}, - { 0x0000, 0xffe4, 0xffc8, 0xffac, 0xff90, 0xff74, 0xff58, 0xff3c, 0xff20, 0xff04, 0xfee8, 0xfecc, 0xfeb0, 0xfe94, 0xfe78, 0xfe5c, - 0xfe40, 0xfe24, 0xfe08, 0xfdec, 0xfdd0, 0xfdb4, 0xfd98, 0xfd7c, 0xfd60, 0xfd44, 0xfd28, 0xfd0c, 0xfcf0, 0xfcd4, 0xfcb8, 0xfc9c}, - { 0x0000, 0xffe5, 0xffca, 0xffaf, 0xff94, 0xff79, 0xff5e, 0xff43, 0xff28, 0xff0d, 0xfef2, 0xfed7, 0xfebc, 0xfea1, 0xfe86, 0xfe6b, - 0xfe50, 0xfe35, 0xfe1a, 0xfdff, 0xfde4, 0xfdc9, 0xfdae, 0xfd93, 0xfd78, 0xfd5d, 0xfd42, 0xfd27, 0xfd0c, 0xfcf1, 0xfcd6, 0xfcbb}, - { 0x0000, 0xffe6, 0xffcc, 0xffb2, 0xff98, 0xff7e, 0xff64, 0xff4a, 0xff30, 0xff16, 0xfefc, 0xfee2, 0xfec8, 0xfeae, 0xfe94, 0xfe7a, - 0xfe60, 0xfe46, 0xfe2c, 0xfe12, 0xfdf8, 0xfdde, 0xfdc4, 0xfdaa, 0xfd90, 0xfd76, 0xfd5c, 0xfd42, 0xfd28, 0xfd0e, 0xfcf4, 0xfcda}, - { 0x0000, 0xffe7, 0xffce, 0xffb5, 0xff9c, 0xff83, 0xff6a, 0xff51, 0xff38, 0xff1f, 0xff06, 0xfeed, 0xfed4, 0xfebb, 0xfea2, 0xfe89, - 0xfe70, 0xfe57, 0xfe3e, 0xfe25, 0xfe0c, 0xfdf3, 0xfdda, 0xfdc1, 0xfda8, 0xfd8f, 0xfd76, 0xfd5d, 0xfd44, 0xfd2b, 0xfd12, 0xfcf9}, - { 0x0000, 0xffe8, 0xffd0, 0xffb8, 0xffa0, 0xff88, 0xff70, 0xff58, 0xff40, 0xff28, 0xff10, 0xfef8, 0xfee0, 0xfec8, 0xfeb0, 0xfe98, - 0xfe80, 0xfe68, 0xfe50, 0xfe38, 0xfe20, 0xfe08, 0xfdf0, 0xfdd8, 0xfdc0, 0xfda8, 0xfd90, 0xfd78, 0xfd60, 0xfd48, 0xfd30, 0xfd18}, - { 0x0000, 0xffe9, 0xffd2, 0xffbb, 0xffa4, 0xff8d, 0xff76, 0xff5f, 0xff48, 0xff31, 0xff1a, 0xff03, 0xfeec, 0xfed5, 0xfebe, 0xfea7, - 0xfe90, 0xfe79, 0xfe62, 0xfe4b, 0xfe34, 0xfe1d, 0xfe06, 0xfdef, 0xfdd8, 0xfdc1, 0xfdaa, 0xfd93, 0xfd7c, 0xfd65, 0xfd4e, 0xfd37}, - { 0x0000, 0xffea, 0xffd4, 0xffbe, 0xffa8, 0xff92, 0xff7c, 0xff66, 0xff50, 0xff3a, 0xff24, 0xff0e, 0xfef8, 0xfee2, 0xfecc, 0xfeb6, - 0xfea0, 0xfe8a, 0xfe74, 0xfe5e, 0xfe48, 0xfe32, 0xfe1c, 0xfe06, 0xfdf0, 0xfdda, 0xfdc4, 0xfdae, 0xfd98, 0xfd82, 0xfd6c, 0xfd56}, - { 0x0000, 0xffeb, 0xffd6, 0xffc1, 0xffac, 0xff97, 0xff82, 0xff6d, 0xff58, 0xff43, 0xff2e, 0xff19, 0xff04, 0xfeef, 0xfeda, 0xfec5, - 0xfeb0, 0xfe9b, 0xfe86, 0xfe71, 0xfe5c, 0xfe47, 0xfe32, 0xfe1d, 0xfe08, 0xfdf3, 0xfdde, 0xfdc9, 0xfdb4, 0xfd9f, 0xfd8a, 0xfd75}, - { 0x0000, 0xffec, 0xffd8, 0xffc4, 0xffb0, 0xff9c, 0xff88, 0xff74, 0xff60, 0xff4c, 0xff38, 0xff24, 0xff10, 0xfefc, 0xfee8, 0xfed4, - 0xfec0, 0xfeac, 0xfe98, 0xfe84, 0xfe70, 0xfe5c, 0xfe48, 0xfe34, 0xfe20, 0xfe0c, 0xfdf8, 0xfde4, 0xfdd0, 0xfdbc, 0xfda8, 0xfd94}, - { 0x0000, 0xffed, 0xffda, 0xffc7, 0xffb4, 0xffa1, 0xff8e, 0xff7b, 0xff68, 0xff55, 0xff42, 0xff2f, 0xff1c, 0xff09, 0xfef6, 0xfee3, - 0xfed0, 0xfebd, 0xfeaa, 0xfe97, 0xfe84, 0xfe71, 0xfe5e, 0xfe4b, 0xfe38, 0xfe25, 0xfe12, 0xfdff, 0xfdec, 0xfdd9, 0xfdc6, 0xfdb3}, - { 0x0000, 0xffee, 0xffdc, 0xffca, 0xffb8, 0xffa6, 0xff94, 0xff82, 0xff70, 0xff5e, 0xff4c, 0xff3a, 0xff28, 0xff16, 0xff04, 0xfef2, - 0xfee0, 0xfece, 0xfebc, 0xfeaa, 0xfe98, 0xfe86, 0xfe74, 0xfe62, 0xfe50, 0xfe3e, 0xfe2c, 0xfe1a, 0xfe08, 0xfdf6, 0xfde4, 0xfdd2}, - { 0x0000, 0xffef, 0xffde, 0xffcd, 0xffbc, 0xffab, 0xff9a, 0xff89, 0xff78, 0xff67, 0xff56, 0xff45, 0xff34, 0xff23, 0xff12, 0xff01, - 0xfef0, 0xfedf, 0xfece, 0xfebd, 0xfeac, 0xfe9b, 0xfe8a, 0xfe79, 0xfe68, 0xfe57, 0xfe46, 0xfe35, 0xfe24, 0xfe13, 0xfe02, 0xfdf1}, - { 0x0000, 0xfff0, 0xffe0, 0xffd0, 0xffc0, 0xffb0, 0xffa0, 0xff90, 0xff80, 0xff70, 0xff60, 0xff50, 0xff40, 0xff30, 0xff20, 0xff10, - 0xff00, 0xfef0, 0xfee0, 0xfed0, 0xfec0, 0xfeb0, 0xfea0, 0xfe90, 0xfe80, 0xfe70, 0xfe60, 0xfe50, 0xfe40, 0xfe30, 0xfe20, 0xfe10}, - { 0x0000, 0xfff1, 0xffe2, 0xffd3, 0xffc4, 0xffb5, 0xffa6, 0xff97, 0xff88, 0xff79, 0xff6a, 0xff5b, 0xff4c, 0xff3d, 0xff2e, 0xff1f, - 0xff10, 0xff01, 0xfef2, 0xfee3, 0xfed4, 0xfec5, 0xfeb6, 0xfea7, 0xfe98, 0xfe89, 0xfe7a, 0xfe6b, 0xfe5c, 0xfe4d, 0xfe3e, 0xfe2f}, - { 0x0000, 0xfff2, 0xffe4, 0xffd6, 0xffc8, 0xffba, 0xffac, 0xff9e, 0xff90, 0xff82, 0xff74, 0xff66, 0xff58, 0xff4a, 0xff3c, 0xff2e, - 0xff20, 0xff12, 0xff04, 0xfef6, 0xfee8, 0xfeda, 0xfecc, 0xfebe, 0xfeb0, 0xfea2, 0xfe94, 0xfe86, 0xfe78, 0xfe6a, 0xfe5c, 0xfe4e}, - { 0x0000, 0xfff3, 0xffe6, 0xffd9, 0xffcc, 0xffbf, 0xffb2, 0xffa5, 0xff98, 0xff8b, 0xff7e, 0xff71, 0xff64, 0xff57, 0xff4a, 0xff3d, - 0xff30, 0xff23, 0xff16, 0xff09, 0xfefc, 0xfeef, 0xfee2, 0xfed5, 0xfec8, 0xfebb, 0xfeae, 0xfea1, 0xfe94, 0xfe87, 0xfe7a, 0xfe6d}, - { 0x0000, 0xfff4, 0xffe8, 0xffdc, 0xffd0, 0xffc4, 0xffb8, 0xffac, 0xffa0, 0xff94, 0xff88, 0xff7c, 0xff70, 0xff64, 0xff58, 0xff4c, - 0xff40, 0xff34, 0xff28, 0xff1c, 0xff10, 0xff04, 0xfef8, 0xfeec, 0xfee0, 0xfed4, 0xfec8, 0xfebc, 0xfeb0, 0xfea4, 0xfe98, 0xfe8c}, - { 0x0000, 0xfff5, 0xffea, 0xffdf, 0xffd4, 0xffc9, 0xffbe, 0xffb3, 0xffa8, 0xff9d, 0xff92, 0xff87, 0xff7c, 0xff71, 0xff66, 0xff5b, - 0xff50, 0xff45, 0xff3a, 0xff2f, 0xff24, 0xff19, 0xff0e, 0xff03, 0xfef8, 0xfeed, 0xfee2, 0xfed7, 0xfecc, 0xfec1, 0xfeb6, 0xfeab}, - { 0x0000, 0xfff6, 0xffec, 0xffe2, 0xffd8, 0xffce, 0xffc4, 0xffba, 0xffb0, 0xffa6, 0xff9c, 0xff92, 0xff88, 0xff7e, 0xff74, 0xff6a, - 0xff60, 0xff56, 0xff4c, 0xff42, 0xff38, 0xff2e, 0xff24, 0xff1a, 0xff10, 0xff06, 0xfefc, 0xfef2, 0xfee8, 0xfede, 0xfed4, 0xfeca}, - { 0x0000, 0xfff7, 0xffee, 0xffe5, 0xffdc, 0xffd3, 0xffca, 0xffc1, 0xffb8, 0xffaf, 0xffa6, 0xff9d, 0xff94, 0xff8b, 0xff82, 0xff79, - 0xff70, 0xff67, 0xff5e, 0xff55, 0xff4c, 0xff43, 0xff3a, 0xff31, 0xff28, 0xff1f, 0xff16, 0xff0d, 0xff04, 0xfefb, 0xfef2, 0xfee9}, - { 0x0000, 0xfff8, 0xfff0, 0xffe8, 0xffe0, 0xffd8, 0xffd0, 0xffc8, 0xffc0, 0xffb8, 0xffb0, 0xffa8, 0xffa0, 0xff98, 0xff90, 0xff88, - 0xff80, 0xff78, 0xff70, 0xff68, 0xff60, 0xff58, 0xff50, 0xff48, 0xff40, 0xff38, 0xff30, 0xff28, 0xff20, 0xff18, 0xff10, 0xff08}, - { 0x0000, 0xfff9, 0xfff2, 0xffeb, 0xffe4, 0xffdd, 0xffd6, 0xffcf, 0xffc8, 0xffc1, 0xffba, 0xffb3, 0xffac, 0xffa5, 0xff9e, 0xff97, - 0xff90, 0xff89, 0xff82, 0xff7b, 0xff74, 0xff6d, 0xff66, 0xff5f, 0xff58, 0xff51, 0xff4a, 0xff43, 0xff3c, 0xff35, 0xff2e, 0xff27}, - { 0x0000, 0xfffa, 0xfff4, 0xffee, 0xffe8, 0xffe2, 0xffdc, 0xffd6, 0xffd0, 0xffca, 0xffc4, 0xffbe, 0xffb8, 0xffb2, 0xffac, 0xffa6, - 0xffa0, 0xff9a, 0xff94, 0xff8e, 0xff88, 0xff82, 0xff7c, 0xff76, 0xff70, 0xff6a, 0xff64, 0xff5e, 0xff58, 0xff52, 0xff4c, 0xff46}, - { 0x0000, 0xfffb, 0xfff6, 0xfff1, 0xffec, 0xffe7, 0xffe2, 0xffdd, 0xffd8, 0xffd3, 0xffce, 0xffc9, 0xffc4, 0xffbf, 0xffba, 0xffb5, - 0xffb0, 0xffab, 0xffa6, 0xffa1, 0xff9c, 0xff97, 0xff92, 0xff8d, 0xff88, 0xff83, 0xff7e, 0xff79, 0xff74, 0xff6f, 0xff6a, 0xff65}, - { 0x0000, 0xfffc, 0xfff8, 0xfff4, 0xfff0, 0xffec, 0xffe8, 0xffe4, 0xffe0, 0xffdc, 0xffd8, 0xffd4, 0xffd0, 0xffcc, 0xffc8, 0xffc4, - 0xffc0, 0xffbc, 0xffb8, 0xffb4, 0xffb0, 0xffac, 0xffa8, 0xffa4, 0xffa0, 0xff9c, 0xff98, 0xff94, 0xff90, 0xff8c, 0xff88, 0xff84}, - { 0x0000, 0xfffd, 0xfffa, 0xfff7, 0xfff4, 0xfff1, 0xffee, 0xffeb, 0xffe8, 0xffe5, 0xffe2, 0xffdf, 0xffdc, 0xffd9, 0xffd6, 0xffd3, - 0xffd0, 0xffcd, 0xffca, 0xffc7, 0xffc4, 0xffc1, 0xffbe, 0xffbb, 0xffb8, 0xffb5, 0xffb2, 0xffaf, 0xffac, 0xffa9, 0xffa6, 0xffa3}, - { 0x0000, 0xfffe, 0xfffc, 0xfffa, 0xfff8, 0xfff6, 0xfff4, 0xfff2, 0xfff0, 0xffee, 0xffec, 0xffea, 0xffe8, 0xffe6, 0xffe4, 0xffe2, - 0xffe0, 0xffde, 0xffdc, 0xffda, 0xffd8, 0xffd6, 0xffd4, 0xffd2, 0xffd0, 0xffce, 0xffcc, 0xffca, 0xffc8, 0xffc6, 0xffc4, 0xffc2}, - { 0x0000, 0xffff, 0xfffe, 0xfffd, 0xfffc, 0xfffb, 0xfffa, 0xfff9, 0xfff8, 0xfff7, 0xfff6, 0xfff5, 0xfff4, 0xfff3, 0xfff2, 0xfff1, - 0xfff0, 0xffef, 0xffee, 0xffed, 0xffec, 0xffeb, 0xffea, 0xffe9, 0xffe8, 0xffe7, 0xffe6, 0xffe5, 0xffe4, 0xffe3, 0xffe2, 0xffe1}, - { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f}, - { 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, 0x0010, 0x0012, 0x0014, 0x0016, 0x0018, 0x001a, 0x001c, 0x001e, - 0x0020, 0x0022, 0x0024, 0x0026, 0x0028, 0x002a, 0x002c, 0x002e, 0x0030, 0x0032, 0x0034, 0x0036, 0x0038, 0x003a, 0x003c, 0x003e}, - { 0x0000, 0x0003, 0x0006, 0x0009, 0x000c, 0x000f, 0x0012, 0x0015, 0x0018, 0x001b, 0x001e, 0x0021, 0x0024, 0x0027, 0x002a, 0x002d, - 0x0030, 0x0033, 0x0036, 0x0039, 0x003c, 0x003f, 0x0042, 0x0045, 0x0048, 0x004b, 0x004e, 0x0051, 0x0054, 0x0057, 0x005a, 0x005d}, - { 0x0000, 0x0004, 0x0008, 0x000c, 0x0010, 0x0014, 0x0018, 0x001c, 0x0020, 0x0024, 0x0028, 0x002c, 0x0030, 0x0034, 0x0038, 0x003c, - 0x0040, 0x0044, 0x0048, 0x004c, 0x0050, 0x0054, 0x0058, 0x005c, 0x0060, 0x0064, 0x0068, 0x006c, 0x0070, 0x0074, 0x0078, 0x007c}, - { 0x0000, 0x0005, 0x000a, 0x000f, 0x0014, 0x0019, 0x001e, 0x0023, 0x0028, 0x002d, 0x0032, 0x0037, 0x003c, 0x0041, 0x0046, 0x004b, - 0x0050, 0x0055, 0x005a, 0x005f, 0x0064, 0x0069, 0x006e, 0x0073, 0x0078, 0x007d, 0x0082, 0x0087, 0x008c, 0x0091, 0x0096, 0x009b}, - { 0x0000, 0x0006, 0x000c, 0x0012, 0x0018, 0x001e, 0x0024, 0x002a, 0x0030, 0x0036, 0x003c, 0x0042, 0x0048, 0x004e, 0x0054, 0x005a, - 0x0060, 0x0066, 0x006c, 0x0072, 0x0078, 0x007e, 0x0084, 0x008a, 0x0090, 0x0096, 0x009c, 0x00a2, 0x00a8, 0x00ae, 0x00b4, 0x00ba}, - { 0x0000, 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x002a, 0x0031, 0x0038, 0x003f, 0x0046, 0x004d, 0x0054, 0x005b, 0x0062, 0x0069, - 0x0070, 0x0077, 0x007e, 0x0085, 0x008c, 0x0093, 0x009a, 0x00a1, 0x00a8, 0x00af, 0x00b6, 0x00bd, 0x00c4, 0x00cb, 0x00d2, 0x00d9}, - { 0x0000, 0x0008, 0x0010, 0x0018, 0x0020, 0x0028, 0x0030, 0x0038, 0x0040, 0x0048, 0x0050, 0x0058, 0x0060, 0x0068, 0x0070, 0x0078, - 0x0080, 0x0088, 0x0090, 0x0098, 0x00a0, 0x00a8, 0x00b0, 0x00b8, 0x00c0, 0x00c8, 0x00d0, 0x00d8, 0x00e0, 0x00e8, 0x00f0, 0x00f8}, - { 0x0000, 0x0009, 0x0012, 0x001b, 0x0024, 0x002d, 0x0036, 0x003f, 0x0048, 0x0051, 0x005a, 0x0063, 0x006c, 0x0075, 0x007e, 0x0087, - 0x0090, 0x0099, 0x00a2, 0x00ab, 0x00b4, 0x00bd, 0x00c6, 0x00cf, 0x00d8, 0x00e1, 0x00ea, 0x00f3, 0x00fc, 0x0105, 0x010e, 0x0117}, - { 0x0000, 0x000a, 0x0014, 0x001e, 0x0028, 0x0032, 0x003c, 0x0046, 0x0050, 0x005a, 0x0064, 0x006e, 0x0078, 0x0082, 0x008c, 0x0096, - 0x00a0, 0x00aa, 0x00b4, 0x00be, 0x00c8, 0x00d2, 0x00dc, 0x00e6, 0x00f0, 0x00fa, 0x0104, 0x010e, 0x0118, 0x0122, 0x012c, 0x0136}, - { 0x0000, 0x000b, 0x0016, 0x0021, 0x002c, 0x0037, 0x0042, 0x004d, 0x0058, 0x0063, 0x006e, 0x0079, 0x0084, 0x008f, 0x009a, 0x00a5, - 0x00b0, 0x00bb, 0x00c6, 0x00d1, 0x00dc, 0x00e7, 0x00f2, 0x00fd, 0x0108, 0x0113, 0x011e, 0x0129, 0x0134, 0x013f, 0x014a, 0x0155}, - { 0x0000, 0x000c, 0x0018, 0x0024, 0x0030, 0x003c, 0x0048, 0x0054, 0x0060, 0x006c, 0x0078, 0x0084, 0x0090, 0x009c, 0x00a8, 0x00b4, - 0x00c0, 0x00cc, 0x00d8, 0x00e4, 0x00f0, 0x00fc, 0x0108, 0x0114, 0x0120, 0x012c, 0x0138, 0x0144, 0x0150, 0x015c, 0x0168, 0x0174}, - { 0x0000, 0x000d, 0x001a, 0x0027, 0x0034, 0x0041, 0x004e, 0x005b, 0x0068, 0x0075, 0x0082, 0x008f, 0x009c, 0x00a9, 0x00b6, 0x00c3, - 0x00d0, 0x00dd, 0x00ea, 0x00f7, 0x0104, 0x0111, 0x011e, 0x012b, 0x0138, 0x0145, 0x0152, 0x015f, 0x016c, 0x0179, 0x0186, 0x0193}, - { 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, - 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2}, - { 0x0000, 0x000f, 0x001e, 0x002d, 0x003c, 0x004b, 0x005a, 0x0069, 0x0078, 0x0087, 0x0096, 0x00a5, 0x00b4, 0x00c3, 0x00d2, 0x00e1, - 0x00f0, 0x00ff, 0x010e, 0x011d, 0x012c, 0x013b, 0x014a, 0x0159, 0x0168, 0x0177, 0x0186, 0x0195, 0x01a4, 0x01b3, 0x01c2, 0x01d1}, - { 0x0000, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050, 0x0060, 0x0070, 0x0080, 0x0090, 0x00a0, 0x00b0, 0x00c0, 0x00d0, 0x00e0, 0x00f0, - 0x0100, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0170, 0x0180, 0x0190, 0x01a0, 0x01b0, 0x01c0, 0x01d0, 0x01e0, 0x01f0}, - { 0x0000, 0x0011, 0x0022, 0x0033, 0x0044, 0x0055, 0x0066, 0x0077, 0x0088, 0x0099, 0x00aa, 0x00bb, 0x00cc, 0x00dd, 0x00ee, 0x00ff, - 0x0110, 0x0121, 0x0132, 0x0143, 0x0154, 0x0165, 0x0176, 0x0187, 0x0198, 0x01a9, 0x01ba, 0x01cb, 0x01dc, 0x01ed, 0x01fe, 0x020f}, - { 0x0000, 0x0012, 0x0024, 0x0036, 0x0048, 0x005a, 0x006c, 0x007e, 0x0090, 0x00a2, 0x00b4, 0x00c6, 0x00d8, 0x00ea, 0x00fc, 0x010e, - 0x0120, 0x0132, 0x0144, 0x0156, 0x0168, 0x017a, 0x018c, 0x019e, 0x01b0, 0x01c2, 0x01d4, 0x01e6, 0x01f8, 0x020a, 0x021c, 0x022e}, - { 0x0000, 0x0013, 0x0026, 0x0039, 0x004c, 0x005f, 0x0072, 0x0085, 0x0098, 0x00ab, 0x00be, 0x00d1, 0x00e4, 0x00f7, 0x010a, 0x011d, - 0x0130, 0x0143, 0x0156, 0x0169, 0x017c, 0x018f, 0x01a2, 0x01b5, 0x01c8, 0x01db, 0x01ee, 0x0201, 0x0214, 0x0227, 0x023a, 0x024d}, - { 0x0000, 0x0014, 0x0028, 0x003c, 0x0050, 0x0064, 0x0078, 0x008c, 0x00a0, 0x00b4, 0x00c8, 0x00dc, 0x00f0, 0x0104, 0x0118, 0x012c, - 0x0140, 0x0154, 0x0168, 0x017c, 0x0190, 0x01a4, 0x01b8, 0x01cc, 0x01e0, 0x01f4, 0x0208, 0x021c, 0x0230, 0x0244, 0x0258, 0x026c}, - { 0x0000, 0x0015, 0x002a, 0x003f, 0x0054, 0x0069, 0x007e, 0x0093, 0x00a8, 0x00bd, 0x00d2, 0x00e7, 0x00fc, 0x0111, 0x0126, 0x013b, - 0x0150, 0x0165, 0x017a, 0x018f, 0x01a4, 0x01b9, 0x01ce, 0x01e3, 0x01f8, 0x020d, 0x0222, 0x0237, 0x024c, 0x0261, 0x0276, 0x028b}, - { 0x0000, 0x0016, 0x002c, 0x0042, 0x0058, 0x006e, 0x0084, 0x009a, 0x00b0, 0x00c6, 0x00dc, 0x00f2, 0x0108, 0x011e, 0x0134, 0x014a, - 0x0160, 0x0176, 0x018c, 0x01a2, 0x01b8, 0x01ce, 0x01e4, 0x01fa, 0x0210, 0x0226, 0x023c, 0x0252, 0x0268, 0x027e, 0x0294, 0x02aa}, - { 0x0000, 0x0017, 0x002e, 0x0045, 0x005c, 0x0073, 0x008a, 0x00a1, 0x00b8, 0x00cf, 0x00e6, 0x00fd, 0x0114, 0x012b, 0x0142, 0x0159, - 0x0170, 0x0187, 0x019e, 0x01b5, 0x01cc, 0x01e3, 0x01fa, 0x0211, 0x0228, 0x023f, 0x0256, 0x026d, 0x0284, 0x029b, 0x02b2, 0x02c9}, - { 0x0000, 0x0018, 0x0030, 0x0048, 0x0060, 0x0078, 0x0090, 0x00a8, 0x00c0, 0x00d8, 0x00f0, 0x0108, 0x0120, 0x0138, 0x0150, 0x0168, - 0x0180, 0x0198, 0x01b0, 0x01c8, 0x01e0, 0x01f8, 0x0210, 0x0228, 0x0240, 0x0258, 0x0270, 0x0288, 0x02a0, 0x02b8, 0x02d0, 0x02e8}, - { 0x0000, 0x0019, 0x0032, 0x004b, 0x0064, 0x007d, 0x0096, 0x00af, 0x00c8, 0x00e1, 0x00fa, 0x0113, 0x012c, 0x0145, 0x015e, 0x0177, - 0x0190, 0x01a9, 0x01c2, 0x01db, 0x01f4, 0x020d, 0x0226, 0x023f, 0x0258, 0x0271, 0x028a, 0x02a3, 0x02bc, 0x02d5, 0x02ee, 0x0307}, - { 0x0000, 0x001a, 0x0034, 0x004e, 0x0068, 0x0082, 0x009c, 0x00b6, 0x00d0, 0x00ea, 0x0104, 0x011e, 0x0138, 0x0152, 0x016c, 0x0186, - 0x01a0, 0x01ba, 0x01d4, 0x01ee, 0x0208, 0x0222, 0x023c, 0x0256, 0x0270, 0x028a, 0x02a4, 0x02be, 0x02d8, 0x02f2, 0x030c, 0x0326}, - { 0x0000, 0x001b, 0x0036, 0x0051, 0x006c, 0x0087, 0x00a2, 0x00bd, 0x00d8, 0x00f3, 0x010e, 0x0129, 0x0144, 0x015f, 0x017a, 0x0195, - 0x01b0, 0x01cb, 0x01e6, 0x0201, 0x021c, 0x0237, 0x0252, 0x026d, 0x0288, 0x02a3, 0x02be, 0x02d9, 0x02f4, 0x030f, 0x032a, 0x0345}, - { 0x0000, 0x001c, 0x0038, 0x0054, 0x0070, 0x008c, 0x00a8, 0x00c4, 0x00e0, 0x00fc, 0x0118, 0x0134, 0x0150, 0x016c, 0x0188, 0x01a4, - 0x01c0, 0x01dc, 0x01f8, 0x0214, 0x0230, 0x024c, 0x0268, 0x0284, 0x02a0, 0x02bc, 0x02d8, 0x02f4, 0x0310, 0x032c, 0x0348, 0x0364}, - { 0x0000, 0x001d, 0x003a, 0x0057, 0x0074, 0x0091, 0x00ae, 0x00cb, 0x00e8, 0x0105, 0x0122, 0x013f, 0x015c, 0x0179, 0x0196, 0x01b3, - 0x01d0, 0x01ed, 0x020a, 0x0227, 0x0244, 0x0261, 0x027e, 0x029b, 0x02b8, 0x02d5, 0x02f2, 0x030f, 0x032c, 0x0349, 0x0366, 0x0383}, - { 0x0000, 0x001e, 0x003c, 0x005a, 0x0078, 0x0096, 0x00b4, 0x00d2, 0x00f0, 0x010e, 0x012c, 0x014a, 0x0168, 0x0186, 0x01a4, 0x01c2, - 0x01e0, 0x01fe, 0x021c, 0x023a, 0x0258, 0x0276, 0x0294, 0x02b2, 0x02d0, 0x02ee, 0x030c, 0x032a, 0x0348, 0x0366, 0x0384, 0x03a2}, - { 0x0000, 0x001f, 0x003e, 0x005d, 0x007c, 0x009b, 0x00ba, 0x00d9, 0x00f8, 0x0117, 0x0136, 0x0155, 0x0174, 0x0193, 0x01b2, 0x01d1, - 0x01f0, 0x020f, 0x022e, 0x024d, 0x026c, 0x028b, 0x02aa, 0x02c9, 0x02e8, 0x0307, 0x0326, 0x0345, 0x0364, 0x0383, 0x03a2, 0x03c1} -}; - -static const INT8 outLvlTbl[16][16] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2}, - { 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4}, - { 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6}, - { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8}, - { 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10}, - { 0, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12}, - { 0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 8, 10, 11, 12, 13, 14}, - { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, - { 0, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17}, - { 0, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19}, - { 0, 2, 3, 5, 6, 7, 9, 10, 12, 13, 14, 16, 17, 18, 20, 21}, - { 0, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23}, - { 0, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 18, 20, 22, 23, 25}, - { 0, 2, 4, 6, 8, 9, 11, 13, 15, 16, 18, 20, 22, 23, 25, 27}, - { 0, 2, 4, 6, 8, 10, 12, 14, 16, 17, 19, 21, 23, 25, 27, 29} -}; - -INLINE UINT8 mgetb(register UINT8 *ptr) { return *ptr; } -INLINE void mputb(UINT8 *ptr, INT8 data) { *ptr = data; } - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// vboysnd_device - constructor -//------------------------------------------------- - -vboysnd_device::vboysnd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, VBOYSND, "Virtual Boy audio", tag, owner, clock, "vboysnd", __FILE__), - device_sound_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void vboysnd_device::device_start() -{ - int i; - - // create the stream - m_stream = machine().sound().stream_alloc(*this, 0, 2, AUDIO_FREQ); - - for (i=0; i<2048; i++) - waveFreq2LenTbl[i] = AUDIO_FREQ / (5000000.0f/(float)((2048-i) * 32)); - for (i=0; i<32; i++) - waveTimer2LenTbl[i] = ((0.00384f*(float)(i+1)) * (float)AUDIO_FREQ); - for (i=0; i<8; i++) - waveEnv2LenTbl[i] = ((0.01536f*(float)(i+1)) * (float)AUDIO_FREQ); - - for (i = 0; i < 5; i++) - memset(&snd_channel[i], 0, sizeof(s_snd_channel)); - - memset(m_aram, 0, 0x600); - - m_timer = timer_alloc(0, NULL); - m_timer->adjust(attotime::zero, 0, attotime::from_hz(AUDIO_FREQ/4)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void vboysnd_device::device_reset() -{ - m_stream->update(); - - int i; - - for (i=0; i<4; i++) - snd_channel[i].playing = false; -} - -//------------------------------------------------- -// device_timer - called when our device timer expires -//------------------------------------------------- - -void vboysnd_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) -{ - m_stream->update(); -} - -//------------------------------------------------- -// sound_stream_update - handle update requests for -// our sound stream -//------------------------------------------------- - -void vboysnd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t *outL, *outR; - int len, i, j, channel; - - outL = outputs[0]; - outR = outputs[1]; - - len = samples; - -// if (mgetb(m_aram+SST0P) & 0x1) // Sound Stop Reg -// goto end; - - for (channel=0; channel<5; channel++) - { - float size; - int k = 0, waveAddr; - - i = channel * 0x40; - snd_channel[channel].sample_len = waveFreq2LenTbl[((mgetb(m_aram+SxFQHb+i) & 0x7) << 8) | mgetb(m_aram+SxFQLb+i)]; - waveAddr = (mgetb(m_aram + SxRAMb + i) & 0x3) << 7; - - size = (float)snd_channel[channel].sample_len / 32.0f; - for (j=0; j<32;) - { - INT8 byte = mgetb(m_aram + waveAddr + (j++ << 2)) & 0x3f; -// INT8 nbyte = mgetb(m_aram + waveAddr + (j << 2)) & 0x3f; - int end = (int)(((float)j)*size); - float val, add; - - val = (float)byte; - add = /*(nbyte-byte)/(end-k)*/ 0.0; // no interpolation - - for (; kplaying) - continue; - - outLeft = outLvlTbl[channel->volLeft][channel->envelope]; - outRight = outLvlTbl[channel->volRight][channel->envelope]; -// env1 = ((UINT8)mgetb(m_aram+SxEV1b+i*0x40)); - if (channel->env1 & 0x01) - { - channel->env_time++; - -// env0 = ((UINT8)mgetb(m_aram+SxEV0b+i*0x40)); - if (channel->env_time >= channel->env_steptime /*waveEnv2LenTbl[env0 & 0x7]*/) - { - // it's time for a step - channel->env_time = 0; - if (channel->env0 & 0x08) - { - // step up - channel->envelope++; - if (channel->envelope >= 0xf) - { - if (channel->env1 & 0x02) channel->envelope = channel->env0 >> 4; - else { channel->env1 &= ~0x01; channel->envelope = 0xf; } - } - } - else - { - // step down - channel->envelope--; - if (channel->envelope <= 0) - { - if (channel->env1 & 0x02) channel->envelope = channel->env0 >> 4; - else { channel->env1 &= ~0x01; channel->envelope = 0x0; } - } - } - } - } - - outTblPtr = (INT16 *) outTbl[channel->sample[channel->offset]]; - if (outLeft) note_left += outTblPtr[outLeft ]; - if (outRight) note_right += outTblPtr[outRight]; - channel->offset++; - - if (channel->offset >= channel->sample_len) - channel->offset = 0; - - if (channel->time > 0) - { - channel->time--; - if (channel->time <= 0) - channel->playing = false; - } - } - - - // scale to 16 bits - note_left = (note_left << 5) | ((note_left >> 6) & 0x1f); - note_right = (note_right << 5) | ((note_right >> 6) & 0x1f); - if (note_left < -32767) note_left = -32767; if (note_left > 32767) note_left = 32767; - if (note_right < -32767) note_right = -32767; if (note_right > 32767) note_right = 32767; - - *(outL++) = ((INT16)note_left); - *(outR++) = ((INT16)note_right); - } -} - -//------------------------------------------------- -// read - read from the chip's registers and internal RAM -//------------------------------------------------- - -READ8_MEMBER( vboysnd_device::read ) -{ - m_stream->update(); - return m_aram[offset]; -} - -//------------------------------------------------- -// write - write to the chip's registers and internal RAM -//------------------------------------------------- - -WRITE8_MEMBER( vboysnd_device::write ) -{ - int freq, i; -// int waveAddr; - int volReg, intervalReg; - int channel, ouroffs; - - mputb((UINT8 *)m_aram+offset, data); - if (offset < 0x400) - return; - - channel = (offset-0x400) >> 6; - ouroffs = offset & 0x3f; - - ///process_sound(cpu.vcount); - - if (channel == 6 && ouroffs == 0) - { - if (mgetb(m_aram+SST0P) & 0x1) - for (i=0; i<4; i++) - snd_channel[i].playing = 0; - return; - } - - // Extract frequencies and build the wave for the first 4 sound sources - i = channel * 0x40; - switch (ouroffs) - { - case SxLRV: - if (channel < 5) - { - volReg = mgetb(m_aram + SxLRVb + i); // 6-4-4 - L/R output level setting - if (snd_channel[channel].playing) - { - snd_channel[channel].volLeft = ((UINT8)volReg) >> 4; - snd_channel[channel].volRight = ((UINT8)volReg) & 0xf; - break; - } - } - case SxINT: - if (channel < 5) - { - UINT8 env0, env1; - // find out if the sound is playing - intervalReg = mgetb(m_aram + SxINTb + i); // 6-4-6 - Sound Interval - volReg = mgetb(m_aram + SxLRVb + i); // 6-4-4 - L/R output level setting - - if (((intervalReg & 0x80) == 0) || (volReg == 0)) - { - snd_channel[channel].playing = false; - return; - } - snd_channel[channel].playing = true; - - // 6-4-1 - Waveform address comes from SxRAM. -// waveAddr = (mgetb(m_aram + SxRAMb + i) & 0x3) << 7; - - // 6-4-15 - Frequency comes from here - freq = ((mgetb(m_aram+SxFQHb+i) & 0x7) << 8) | mgetb(m_aram+SxFQLb+i); - - env0 = mgetb(m_aram+SxEV0b+i); env1 = mgetb(m_aram+SxEV1b+i); - snd_channel[channel].env0 = env0; - snd_channel[channel].env1 = env1; - snd_channel[channel].volLeft = ((UINT8)volReg) >> 4; - snd_channel[channel].volRight = ((UINT8)volReg) & 0xf; - snd_channel[channel].env_steptime = (env1 & 0x1) ? waveEnv2LenTbl[env0 & 0x7] : 0; - snd_channel[channel].sample_len = waveFreq2LenTbl[freq]; - - snd_channel[channel].offset = 0; - snd_channel[channel].time = (intervalReg & 0x20) ? waveTimer2LenTbl[intervalReg & 0x1f] : 0; - snd_channel[channel].envelope = ((UINT8)mgetb(m_aram+SxEV0b+i)) >> 4; - snd_channel[channel].env_time = 0; - } - else - { - intervalReg = mgetb(m_aram + SxINTb + i); // 6-4-6 - Sound Interval - volReg = mgetb(m_aram + SxLRVb + i); // 6-4-4 - L/R output level setting - - if (((intervalReg & 0x80) == 0) || (volReg == 0)) - { -// snd_channel[channel].playing = false; - return; - } -// Debugger(); // uses white noise -// snd_channel[channel].playing = true; - } - break; - - case SxEV0: - if (channel < 5) - if (snd_channel[channel].playing) - snd_channel[channel].envelope = ((UINT8)mgetb(m_aram+SxEV0b+i)) >> 4; - break; - } -} diff --git a/src/mess/audio/vboy.h b/src/mess/audio/vboy.h deleted file mode 100644 index 8849ecf292e..00000000000 --- a/src/mess/audio/vboy.h +++ /dev/null @@ -1,108 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/* - vboy.h - Virtual Boy audio emulation - - By Richard Bannister and Gil Pedersen. - MESS device adaptation by R. Belmont -*/ - -#pragma once - -#ifndef __VBOY_SND_H__ -#define __VBOY_SND_H__ - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -#define AUDIO_FREQ 44100 -#define CHANNELS 4 - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VBOYSND_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, VBOYSND, AUDIO_FREQ) - -#define MCFG_VBOYSND_REPLACE(_tag) \ - MCFG_DEVICE_REPLACE(_tag, VBOYSND, AUDIO_FREQ) - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -struct s_snd_channel { - INT8 playing; // the sound is playing - - // state when sound was enabled - UINT32 env_steptime; // Envelope step time - UINT8 env0; // Envelope data - UINT8 env1; // Envelope data - UINT8 volLeft; // Left output volume - UINT8 volRight; // Right output volume - UINT8 sample[580]; // sample to play - int sample_len; // length of sample - - // values that change, as the sample is played - int offset; // current offset in sample - int time; // the duration that this sample is to be played - UINT8 envelope; // Current envelope level (604) - int env_time; // The duration between envelope decay/grow (608) -}; - -struct s_regchan { - INT32 sINT; - INT32 sLRV; - INT32 sFQL; - INT32 sFQH; - INT32 sEV0; - INT32 sEV1; - INT32 sRAM; -}; - -struct s_sreg { - // Sound registers structure - s_regchan c[4]; -}; - -// ======================> vboysnd_device - -class vboysnd_device : public device_t, public device_sound_interface -{ -public: - // construction/destruction - vboysnd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); - - sound_stream *m_stream; - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - - // inline data - s_sreg sound_registers(void); - - s_snd_channel snd_channel[5]; - - UINT16 waveFreq2LenTbl[2048]; - UINT16 waveTimer2LenTbl[32]; - UINT16 waveEnv2LenTbl[8]; - - emu_timer *m_timer; - - UINT8 m_aram[0x600]; -}; - -// device type definition -extern const device_type VBOYSND; - -#endif //__VBOY_SND_H__ diff --git a/src/mess/audio/vc4000snd.c b/src/mess/audio/vc4000snd.c deleted file mode 100644 index 00b33d308ae..00000000000 --- a/src/mess/audio/vc4000snd.c +++ /dev/null @@ -1,74 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/*************************************************************************** - - PeT mess@utanet.at - main part in video/ - -***************************************************************************/ - -#include "vc4000snd.h" - - -const device_type VC4000_SND = &device_creator; - -vc4000_sound_device::vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, VC4000_SND, "Intertion Electronic VC 4000 Audio Custom", tag, owner, clock, "vc4000_sound", __FILE__), - device_sound_interface(mconfig, *this), - m_channel(NULL), - m_size(0), - m_pos(0), - m_level(0) -{ - memset(m_reg, 0, sizeof(UINT8)*1); -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void vc4000_sound_device::device_start() -{ - m_channel = stream_alloc(0, 1, machine().sample_rate()); -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void vc4000_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - int i; - stream_sample_t *buffer = outputs[0]; - - for (i = 0; i < samples; i++, buffer++) - { - *buffer = 0; - if (m_reg[0] && m_pos <= m_size / 2) - { - *buffer = 0x7fff; - } - if (m_pos <= m_size) - m_pos++; - if (m_pos > m_size) - m_pos = 0; - } -} - - -void vc4000_sound_device::soundport_w(int offset, int data) -{ - m_channel->update(); - m_reg[offset] = data; - switch (offset) - { - case 0: - m_pos = 0; - m_level = TRUE; - // frequency 7874/(data+1) - m_size = machine().sample_rate() * (data + 1) /7874; - break; - } -} diff --git a/src/mess/audio/vc4000snd.h b/src/mess/audio/vc4000snd.h deleted file mode 100644 index 611ad0188d8..00000000000 --- a/src/mess/audio/vc4000snd.h +++ /dev/null @@ -1,47 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/vc4000snd.h - * - ****************************************************************************/ - -#ifndef _VC4000SND_H_ -#define _VC4000SND_H_ - -#include "emu.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> vc4000_sound_device - -class vc4000_sound_device : public device_t, - public device_sound_interface -{ -public: - vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~vc4000_sound_device() { } - -protected: - // device-level overrides - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -public: - void soundport_w(int mode, int data); - -private: - sound_stream *m_channel; - UINT8 m_reg[1]; - int m_size; - int m_pos; - unsigned m_level; -}; - -extern const device_type VC4000_SND; - -#endif /* _VC4000SND_H_ */ diff --git a/src/mess/audio/wswan_snd.c b/src/mess/audio/wswan_snd.c deleted file mode 100644 index 77a21d7cb3b..00000000000 --- a/src/mess/audio/wswan_snd.c +++ /dev/null @@ -1,374 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/************************************************************************************** - - Wonderswan sound emulation - - Wilbert Pol - - Sound emulation is preliminary and not complete - - -The noise taps and behavior are the same as the Virtual Boy. - -**************************************************************************************/ - -#include "wswan_snd.h" - - -// device type definition -const device_type WSWAN_SND = &device_creator; - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// wswan_sound_device - constructor -//------------------------------------------------- - -wswan_sound_device::wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, WSWAN_SND, "WonderSwan Audio Custom", tag, owner, clock, "wswan_sound", __FILE__), - device_sound_interface(mconfig, *this), - m_channel(NULL), - m_sweep_step(0), - m_sweep_time(0), - m_sweep_count(0), - m_noise_type(0), - m_noise_reset(0), - m_noise_enable(0), - m_sample_address(0), - m_audio2_voice(0), - m_audio3_sweep(0), - m_audio4_noise(0), - m_mono(0), - m_voice_data(0), - m_output_volume(0), - m_external_stereo(0), - m_external_speaker(0), - m_noise_shift(0), - m_master_volume(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void wswan_sound_device::device_start() -{ - m_channel = stream_alloc(0, 2, machine().sample_rate()); - - save_item(NAME(m_sweep_step)); - save_item(NAME(m_sweep_time)); - save_item(NAME(m_sweep_count)); - save_item(NAME(m_noise_type)); - save_item(NAME(m_noise_reset)); - save_item(NAME(m_noise_enable)); - save_item(NAME(m_sample_address)); - save_item(NAME(m_audio2_voice)); - save_item(NAME(m_audio3_sweep)); - save_item(NAME(m_audio4_noise)); - save_item(NAME(m_mono)); - save_item(NAME(m_voice_data)); - save_item(NAME(m_output_volume)); - save_item(NAME(m_external_stereo)); - save_item(NAME(m_external_speaker)); - save_item(NAME(m_noise_shift)); - save_item(NAME(m_master_volume)); - - save_item(NAME(m_audio1.freq)); - save_item(NAME(m_audio1.period)); - save_item(NAME(m_audio1.pos)); - save_item(NAME(m_audio1.vol_left)); - save_item(NAME(m_audio1.vol_right)); - save_item(NAME(m_audio1.on)); - save_item(NAME(m_audio1.signal)); - - save_item(NAME(m_audio2.freq)); - save_item(NAME(m_audio2.period)); - save_item(NAME(m_audio2.pos)); - save_item(NAME(m_audio2.vol_left)); - save_item(NAME(m_audio2.vol_right)); - save_item(NAME(m_audio2.on)); - save_item(NAME(m_audio2.signal)); - - save_item(NAME(m_audio3.freq)); - save_item(NAME(m_audio3.period)); - save_item(NAME(m_audio3.pos)); - save_item(NAME(m_audio3.vol_left)); - save_item(NAME(m_audio3.vol_right)); - save_item(NAME(m_audio3.on)); - save_item(NAME(m_audio3.signal)); - - save_item(NAME(m_audio4.freq)); - save_item(NAME(m_audio4.period)); - save_item(NAME(m_audio4.pos)); - save_item(NAME(m_audio4.vol_left)); - save_item(NAME(m_audio4.vol_right)); - save_item(NAME(m_audio4.on)); - save_item(NAME(m_audio4.signal)); -} - - -//------------------------------------------------- -// device_reset -//------------------------------------------------- - -void wswan_sound_device::device_reset() -{ - m_audio1.on = 0; - m_audio1.signal = 16; - m_audio1.pos = 0; - m_audio2.on = 0; - m_audio2.signal = 16; - m_audio2.pos = 0; - m_audio3.on = 0; - m_audio3.signal = 16; - m_audio3.pos = 0; - m_audio4.on = 0; - m_audio4.signal = 16; - m_audio4.pos = 0; -} - - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void wswan_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t sample, left, right; - - while( samples-- > 0 ) - { - left = right = 0; - - if ( m_audio1.on ) - { - sample = m_audio1.signal; - m_audio1.pos++; - if ( m_audio1.pos >= m_audio1.period / 2 ) - { - m_audio1.pos = 0; - m_audio1.signal = -m_audio1.signal; - } - left += m_audio1.vol_left * sample; - right += m_audio1.vol_right * sample; - } - - if ( m_audio2.on ) - { - if ( m_audio2_voice ) - { - left += (m_voice_data - 128)*(m_master_volume & 0x0f); - right += (m_voice_data - 128)*(m_master_volume & 0x0f); - } - else - { - sample = m_audio2.signal; - m_audio2.pos++; - if ( m_audio2.pos >= m_audio2.period / 2 ) - { - m_audio2.pos = 0; - m_audio2.signal = -m_audio2.signal; - } - left += m_audio2.vol_left * sample; - right += m_audio2.vol_right * sample; - } - } - - if ( m_audio3.on ) - { - sample = m_audio3.signal; - m_audio3.pos++; - if ( m_audio3.pos >= m_audio3.period / 2 ) - { - m_audio3.pos = 0; - m_audio3.signal = -m_audio3.signal; - } - if ( m_audio3_sweep && m_sweep_time ) - { - m_sweep_count++; - if ( m_sweep_count >= m_sweep_time ) - { - m_sweep_count = 0; - m_audio3.freq += m_sweep_step; - m_audio3.period = machine().sample_rate() / (3072000 / ((2048 - (m_audio3.freq & 0x7ff)) << 5)); - } - } - left += m_audio3.vol_left * sample; - right += m_audio3.vol_right * sample; - } - - if ( m_audio4.on ) - { - sample = m_audio4.signal; - m_audio4.pos++; - if ( m_audio4.pos >= m_audio4.period / 2 ) - { - m_audio4.signal = -m_audio4.signal; - m_audio4.pos = 0; - - if (m_noise_enable) - { - UINT16 new_bit = 0; - - if (m_noise_type == 0) - { - new_bit = (m_noise_shift ^ (m_noise_shift >> 5) ^ (m_noise_shift >> 8)) & 1; - } - else - { - static int shift_bit[] = { 0, 10, 13, 4, 8, 6, 9, 11 }; - - new_bit = (1 ^ (m_noise_shift >> 7) ^ (m_noise_shift >> shift_bit[m_noise_type])) & 1; - } - m_noise_shift = (m_noise_shift << 1) | new_bit; - - if (m_audio4_noise) - { - m_audio4.signal = (m_noise_shift & 0x8000) ? 16 : -16; - } - - m_noise_shift &= 0x7fff; - - if (m_noise_shift == 0x7fff) - { - m_noise_shift = (m_noise_type == 0) ? 0x80 : 0; - } - } - } - left += m_audio4.vol_left * sample; - right += m_audio4.vol_right * sample; - } - - left <<= 5; - right <<= 5; - - *(outputs[0]++) = left; - *(outputs[1]++) = right; - } -} - - -void wswan_sound_device::wswan_ch_set_freq( CHAN *ch, UINT16 freq ) -{ - freq &= 0x7ff; // docs say freq is 11bits and a few games (Morita Shougi, World Stadium + others) write 0x800 causing a divide by 0 crash - ch->freq = freq; - ch->period = machine().sample_rate() / (3072000 / ((2048 - freq) << 5)); -} - -WRITE8_MEMBER( wswan_sound_device::port_w ) -{ - m_channel->update(); - - switch( offset ) - { - case 0x80: /* Audio 1 freq (lo) */ - wswan_ch_set_freq(&m_audio1, (m_audio1.freq & 0xff00) | data); - break; - - case 0x81: /* Audio 1 freq (hi) */ - wswan_ch_set_freq(&m_audio1, (data << 8 ) | (m_audio1.freq & 0x00ff)); - break; - - case 0x82: /* Audio 2 freq (lo) */ - wswan_ch_set_freq(&m_audio2, (m_audio2.freq & 0xff00) | data); - break; - - case 0x83: /* Audio 2 freq (hi) */ - wswan_ch_set_freq(&m_audio2, (data << 8 ) | (m_audio2.freq & 0x00ff)); - break; - - case 0x84: /* Audio 3 freq (lo) */ - wswan_ch_set_freq(&m_audio3, (m_audio3.freq & 0xff00) | data); - break; - - case 0x85: /* Audio 3 freq (hi) */ - wswan_ch_set_freq(&m_audio3, (data << 8) | (m_audio3.freq & 0x00ff)); - break; - - case 0x86: /* Audio 4 freq (lo) */ - wswan_ch_set_freq(&m_audio4, (m_audio4.freq & 0xff00) | data); - break; - - case 0x87: /* Audio 4 freq (hi) */ - wswan_ch_set_freq(&m_audio4, (data << 8) | (m_audio4.freq & 0x00ff)); - break; - - case 0x88: /* Audio 1 volume */ - m_audio1.vol_left = ( data & 0xF0 ) >> 4; - m_audio1.vol_right = data & 0x0F; - break; - - case 0x89: /* Audio 2 volume */ - m_voice_data = data; - m_audio2.vol_left = ( data & 0xF0 ) >> 4; - m_audio2.vol_right = data & 0x0F; - break; - - case 0x8A: /* Audio 3 volume */ - m_audio3.vol_left = ( data & 0xF0 ) >> 4; - m_audio3.vol_right = data & 0x0F; - break; - - case 0x8B: /* Audio 4 volume */ - m_audio4.vol_left = ( data & 0xF0 ) >> 4; - m_audio4.vol_right = data & 0x0F; - break; - - case 0x8C: /* Sweep step */ - m_sweep_step = (INT8)data; - break; - - case 0x8D: /* Sweep time */ - m_sweep_time = space.machine().sample_rate() / ( 3072000 / ( 8192 * (data + 1) ) ); - break; - - case 0x8E: /* Noise control */ - m_noise_type = data & 0x07; - m_noise_reset = ( data & 0x08 ) >> 3; - m_noise_enable = ( data & 0x10 ) >> 4; - if (m_noise_reset) - { - m_noise_shift = (m_noise_type == 0) ? 0x80 : 0; - } - break; - - case 0x8F: /* Sample location */ - m_sample_address = data << 6; - break; - - case 0x90: /* Audio control */ - m_audio1.on = data & 0x01; - m_audio2.on = ( data & 0x02 ) >> 1; - m_audio3.on = ( data & 0x04 ) >> 2; - m_audio4.on = ( data & 0x08 ) >> 3; - m_audio2_voice = ( data & 0x20 ) >> 5; - m_audio3_sweep = ( data & 0x40 ) >> 6; - m_audio4_noise = ( data & 0x80 ) >> 7; - break; - - case 0x91: /* Audio output */ - m_mono = data & 0x01; - m_output_volume = ( data & 0x06 ) >> 1; - m_external_stereo = ( data & 0x08 ) >> 3; - m_external_speaker = 1; - break; - - case 0x92: /* Noise counter shift register (lo) */ - m_noise_shift = ( m_noise_shift & 0xFF00 ) | data; - break; - - case 0x93: /* Noise counter shift register (hi) */ - m_noise_shift = ( ( data & 0x7f ) << 8 ) | ( m_noise_shift & 0x00FF ); - break; - - case 0x94: /* Master volume */ - m_master_volume = data; - break; - } -} diff --git a/src/mess/audio/wswan_snd.h b/src/mess/audio/wswan_snd.h deleted file mode 100644 index 42ba3ed5160..00000000000 --- a/src/mess/audio/wswan_snd.h +++ /dev/null @@ -1,91 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/***************************************************************************** - * - * includes/wswan_snd.h - * - ****************************************************************************/ - -#pragma once - -#ifndef _WSWAN_SND_H_ -#define _WSWAN_SND_H_ - -#include "emu.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -struct CHAN -{ - CHAN() : - freq(0), - period(0), - pos(0), - vol_left(0), - vol_right(0), - on(0), - signal(0) { } - - UINT16 freq; /* frequency */ - UINT32 period; /* period */ - UINT32 pos; /* position */ - UINT8 vol_left; /* volume left */ - UINT8 vol_right; /* volume right */ - UINT8 on; /* on/off */ - INT8 signal; /* signal */ -}; - - -// ======================> wswan_sound_device - -class wswan_sound_device : public device_t, - public device_sound_interface -{ -public: - wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~wswan_sound_device() { } - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -public: - DECLARE_WRITE8_MEMBER( port_w ); - -private: - void wswan_ch_set_freq( CHAN *ch, UINT16 freq ); - -private: - sound_stream *m_channel; - CHAN m_audio1; /* Audio channel 1 */ - CHAN m_audio2; /* Audio channel 2 */ - CHAN m_audio3; /* Audio channel 3 */ - CHAN m_audio4; /* Audio channel 4 */ - INT8 m_sweep_step; /* Sweep step */ - UINT32 m_sweep_time; /* Sweep time */ - UINT32 m_sweep_count; /* Sweep counter */ - UINT8 m_noise_type; /* Noise generator type */ - UINT8 m_noise_reset; /* Noise reset */ - UINT8 m_noise_enable; /* Noise enable */ - UINT16 m_sample_address; /* Sample address */ - UINT8 m_audio2_voice; /* Audio 2 voice */ - UINT8 m_audio3_sweep; /* Audio 3 sweep */ - UINT8 m_audio4_noise; /* Audio 4 noise */ - UINT8 m_mono; /* mono */ - UINT8 m_voice_data; /* voice data */ - UINT8 m_output_volume; /* output volume */ - UINT8 m_external_stereo; /* external stereo */ - UINT8 m_external_speaker; /* external speaker */ - UINT16 m_noise_shift; /* Noise counter shift register */ - UINT8 m_master_volume; /* Master volume */ -}; - -extern const device_type WSWAN_SND; - -#endif diff --git a/src/mess/drivers/4004clk.c b/src/mess/drivers/4004clk.c deleted file mode 100644 index 0d750822b7c..00000000000 --- a/src/mess/drivers/4004clk.c +++ /dev/null @@ -1,193 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - 4004 Nixie Clock - - 03/08/2009 Initial driver - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i4004/i4004.h" -#include "sound/dac.h" -#include "4004clk.lh" - -class nixieclock_state : public driver_device -{ -public: - nixieclock_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac"), - m_input(*this, "INPUT") - { } - - required_device m_maincpu; - required_device m_dac; - required_ioport m_input; - DECLARE_READ8_MEMBER( data_r ); - DECLARE_WRITE8_MEMBER( nixie_w ); - DECLARE_WRITE8_MEMBER( neon_w ); - DECLARE_WRITE8_MEMBER( relays_w ); - UINT16 m_nixie[16]; - UINT8 m_timer; - virtual void machine_start(); - TIMER_DEVICE_CALLBACK_MEMBER(timer_callback); - UINT8 nixie_to_num(UINT16 val); - inline void output_set_nixie_value(int index, int value); - inline void output_set_neon_value(int index, int value); -}; - -READ8_MEMBER(nixieclock_state::data_r) -{ - return m_input->read() & 0x0f; -} - -UINT8 nixieclock_state::nixie_to_num(UINT16 val) -{ - if (BIT(val,0)) return 0; - if (BIT(val,1)) return 1; - if (BIT(val,2)) return 2; - if (BIT(val,3)) return 3; - if (BIT(val,4)) return 4; - if (BIT(val,5)) return 5; - if (BIT(val,6)) return 6; - if (BIT(val,7)) return 7; - if (BIT(val,8)) return 8; - if (BIT(val,9)) return 9; - return 10; -} - -inline void nixieclock_state::output_set_nixie_value(int index, int value) -{ - output_set_indexed_value("nixie", index, value); -} - -inline void nixieclock_state::output_set_neon_value(int index, int value) -{ - output_set_indexed_value("neon", index, value); -} - -WRITE8_MEMBER(nixieclock_state::nixie_w) -{ - m_nixie[offset] = data; - output_set_nixie_value(5,nixie_to_num(((m_nixie[2] & 3)<<8) | (m_nixie[1] << 4) | m_nixie[0])); - output_set_nixie_value(4,nixie_to_num((m_nixie[4] << 6) | (m_nixie[3] << 2) | (m_nixie[2] >>2))); - output_set_nixie_value(3,nixie_to_num(((m_nixie[7] & 3)<<8) | (m_nixie[6] << 4) | m_nixie[5])); - output_set_nixie_value(2,nixie_to_num((m_nixie[9] << 6) | (m_nixie[8] << 2) | (m_nixie[7] >>2))); - output_set_nixie_value(1,nixie_to_num(((m_nixie[12] & 3)<<8) | (m_nixie[11] << 4) | m_nixie[10])); - output_set_nixie_value(0,nixie_to_num((m_nixie[14] << 6) | (m_nixie[13] << 2) | (m_nixie[12] >>2))); -} - -WRITE8_MEMBER(nixieclock_state::neon_w) -{ - output_set_neon_value(0,BIT(data,3)); - output_set_neon_value(1,BIT(data,2)); - output_set_neon_value(2,BIT(data,1)); - output_set_neon_value(3,BIT(data,0)); -} - -WRITE8_MEMBER(nixieclock_state::relays_w) -{ - m_dac->write_unsigned8((data & 1) ? 0x80 : 0x40); //tick - tock -} - -static ADDRESS_MAP_START(4004clk_rom, AS_PROGRAM, 8, nixieclock_state) - AM_RANGE(0x0000, 0x0FFF) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(4004clk_mem, AS_DATA, 8, nixieclock_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x007F) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( 4004clk_io, AS_IO, 8, nixieclock_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x0e) AM_WRITE(nixie_w) - AM_RANGE(0x00, 0x00) AM_READ(data_r) - AM_RANGE(0x0f, 0x0f) AM_WRITE(neon_w) - AM_RANGE(0x10, 0x10) AM_WRITE(relays_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( 4004clk ) - PORT_START("INPUT") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Browse") PORT_CODE(KEYCODE_2) - - PORT_CONFNAME( 0x04, 0x00, "Tick-Tock") - PORT_CONFSETTING( 0x00, "ON" ) - PORT_CONFSETTING( 0x04, "OFF" ) - PORT_CONFNAME( 0x08, 0x08, "50/60 Hz") - PORT_CONFSETTING( 0x00, "50 Hz" ) - PORT_CONFSETTING( 0x08, "60 Hz" ) -INPUT_PORTS_END - -/* - 16ms Int generator - __ __ - _| |_| - 0 1 0 1 - -*/ - -TIMER_DEVICE_CALLBACK_MEMBER(nixieclock_state::timer_callback) -{ - m_maincpu->set_test(m_timer); - m_timer^=1; -} - -void nixieclock_state::machine_start() -{ - m_timer = 0; - - /* register for state saving */ - save_item(NAME(m_timer)); - save_pointer(NAME(m_nixie), 6); -} - -static MACHINE_CONFIG_START( 4004clk, nixieclock_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I4004, XTAL_5MHz / 8) - MCFG_CPU_PROGRAM_MAP(4004clk_rom) - MCFG_CPU_DATA_MAP(4004clk_mem) - MCFG_CPU_IO_MAP(4004clk_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_4004clk) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("4004clk_timer", nixieclock_state, timer_callback, attotime::from_hz(120)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( 4004clk ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "clock.u30", 0x0000, 0x0100, CRC(3d8608a5) SHA1(47fa0a91779e1afc34592f91068f8af2e74593d4)) - ROM_LOAD( "clock.u31", 0x0100, 0x0100, CRC(c83af4bc) SHA1(c8bd7ff1322e5ad280364ed87fc9e2ed38120c21)) - ROM_LOAD( "clock.u32", 0x0200, 0x0100, CRC(72442ae7) SHA1(dc25269cf9db7a9e70a86fededeb01efecf80fe7)) - ROM_LOAD( "clock.u33", 0x0300, 0x0100, CRC(74789383) SHA1(ca5ef2c42dae1761599ead56498fb0bfa0db80a5)) - ROM_LOAD( "clock.u34", 0x0400, 0x0100, CRC(d817cc54) SHA1(a54e744465dde20d37ba54bf2bdb1c4708235f9a)) - ROM_LOAD( "clock.u35", 0x0500, 0x0100, CRC(ece36d21) SHA1(c8cf7e08e90463e910ed2d21d8e562e73d7e0b08)) - ROM_LOAD( "clock.u36", 0x0600, 0x0100, CRC(65aa3cb1) SHA1(9b134bd46747a1bccc004c347b3162e9dc846426)) - ROM_LOAD( "clock.u37", 0x0700, 0x0100, CRC(4c2a2632) SHA1(5f75c2d67571ffcfb98f37944f7f4bc7f531c109)) - ROM_LOAD( "clock.u38", 0x0800, 0x0100, CRC(133da0d6) SHA1(08863a287471c0e77f27cea087cb4a3b372d49c1)) - ROM_LOAD( "clock.u39", 0x0900, 0x0100, CRC(0628593c) SHA1(34249753056cd425e0d48c188c830d64464006c9)) - ROM_LOAD( "clock.u40", 0x0A00, 0x0100, CRC(1c2e94b5) SHA1(89e6c70b936fd9882a229de671dcada7c39b9e8e)) - ROM_LOAD( "clock.u41", 0x0B00, 0x0100, CRC(48b4510d) SHA1(17c5eedc36b469bfae23e204c614ccc01bd4df02)) - ROM_LOAD( "clock.u42", 0x0C00, 0x0100, CRC(4b768675) SHA1(8862b9911bd5907e679539c1e98921f0686b8a76)) - ROM_LOAD( "clock.u43", 0x0D00, 0x0100, CRC(df8db80f) SHA1(34ef8e9ae9fd4e88659e1e14759a2baf1cf589a5)) - ROM_LOAD( "clock.u44", 0x0E00, 0x0100, CRC(23037c71) SHA1(87702bdf5985fa58d4cabcc0d4530e229bfebcbb)) - ROM_LOAD( "clock.u45", 0x0F00, 0x0100, CRC(a8d419ef) SHA1(86742a5ad410c027e9cf9a95e2006dc1128715e5)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -SYST( 2008, 4004clk, 0, 0, 4004clk, 4004clk, driver_device, 0, "John L. Weinrich", "4004 Nixie Clock", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/68ksbc.c b/src/mess/drivers/68ksbc.c deleted file mode 100644 index 2ff1bc85cac..00000000000 --- a/src/mess/drivers/68ksbc.c +++ /dev/null @@ -1,98 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Skeleton driver for 68k Single Board Computer - - 29/03/2011 - - http://www.kmitl.ac.th/~kswichit/68k/68k.html - - TODO: - - Add RTC (type DS12887) - - All of the address and i/o decoding is done by a pair of XC9536 - mask-programmed custom devices. - - There are some chips used for unclear purposes (GPI, GPO, LCD). - - This computer has no sound, and no facility for saving or loading programs. - - When started, press ? key for a list of commands. - - Has 1MB of flash (which is actually just 12k of program), - and 1MB of RAM. Memory map should probably be corrected. - - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "machine/6850acia.h" -#include "machine/clock.h" - - -class c68ksbc_state : public driver_device -{ -public: - c68ksbc_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_acia(*this, "acia") - { - } - - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - -private: - required_device m_maincpu; - required_device m_acia; -}; - -static ADDRESS_MAP_START(c68ksbc_mem, AS_PROGRAM, 16, c68ksbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x002fff) AM_ROM - AM_RANGE(0x003000, 0x5fffff) AM_RAM - AM_RANGE(0x600000, 0x600001) AM_DEVREADWRITE8("acia", acia6850_device, status_r, control_w, 0x00ff) - AM_RANGE(0x600002, 0x600003) AM_DEVREADWRITE8("acia", acia6850_device, data_r, data_w, 0x00ff) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( c68ksbc ) -INPUT_PORTS_END - - -WRITE_LINE_MEMBER(c68ksbc_state::write_acia_clock) -{ - m_acia->write_txc(state); - m_acia->write_rxc(state); -} - -static MACHINE_CONFIG_START( c68ksbc, c68ksbc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 8000000) // text says 8MHz, schematic says 10MHz - MCFG_CPU_PROGRAM_MAP(c68ksbc_mem) - - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(c68ksbc_state, write_acia_clock)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( 68ksbc ) - ROM_REGION(0x1000000, "maincpu", 0) - ROM_LOAD( "t68k.bin", 0x0000, 0x2f78, CRC(20a8d0d0) SHA1(544fd8bd8ed017115388c8b0f7a7a59a32253e43) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 2002, 68ksbc, 0, 0, c68ksbc, c68ksbc, driver_device, 0, "Wichit Sirichote", "68k Single Board Computer", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/a2600.c b/src/mess/drivers/a2600.c deleted file mode 100644 index cf61e133b62..00000000000 --- a/src/mess/drivers/a2600.c +++ /dev/null @@ -1,552 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Wilbert Pol -/*************************************************************************** - - Atari VCS 2600 driver - -TODO: -- Move the 2 32-in-1 rom dumps into their own driver -- Add 128-in-1 driver - -***************************************************************************/ - -#include "emu.h" -#include "machine/mos6530n.h" -#include "cpu/m6502/m6502.h" -#include "sound/tiaintf.h" -#include "video/tia.h" -#include "bus/vcs/vcs_slot.h" -#include "bus/vcs/rom.h" -#include "bus/vcs/dpc.h" -#include "bus/vcs/scharger.h" -#include "bus/vcs/compumat.h" -#include "bus/vcs_ctrl/ctrl.h" - -#define CONTROL1_TAG "joyport1" -#define CONTROL2_TAG "joyport2" - - -class a2600_state : public driver_device -{ -public: - a2600_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_riot_ram(*this, "riot_ram"), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG) , - m_cart(*this, "cartslot"), - m_tia(*this, "tia_video"), - m_maincpu(*this, "maincpu"), - m_screen(*this, "screen"), - m_swb(*this, "SWB") - { } - - required_shared_ptr m_riot_ram; - UINT16 m_current_screen_height; - - DECLARE_MACHINE_START(a2600); - DECLARE_WRITE8_MEMBER(switch_A_w); - DECLARE_READ8_MEMBER(switch_A_r); - DECLARE_WRITE8_MEMBER(switch_B_w); - DECLARE_WRITE_LINE_MEMBER(irq_callback); - DECLARE_READ8_MEMBER(riot_input_port_8_r); - DECLARE_READ16_MEMBER(a2600_read_input_port); - DECLARE_READ8_MEMBER(a2600_get_databus_contents); - DECLARE_WRITE16_MEMBER(a2600_tia_vsync_callback); - DECLARE_WRITE16_MEMBER(a2600_tia_vsync_callback_pal); - DECLARE_WRITE8_MEMBER(cart_over_tia_w); - // investigate how the carts mapped here (Mapper JVP) interact with the RIOT device - DECLARE_READ8_MEMBER(cart_over_riot_r); - DECLARE_WRITE8_MEMBER(cart_over_riot_w); - -protected: - required_device m_joy1; - required_device m_joy2; - required_device m_cart; - required_device m_tia; - - unsigned long detect_2600controllers(); - required_device m_maincpu; - required_device m_screen; - required_ioport m_swb; -}; - - - -#define MASTER_CLOCK_NTSC 3579545 -#define MASTER_CLOCK_PAL 3546894 -#define CATEGORY_SELECT 16 - -static const UINT16 supported_screen_heights[4] = { 262, 312, 328, 342 }; - - -static ADDRESS_MAP_START(a2600_mem, AS_PROGRAM, 8, a2600_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1fff) - AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0f00) AM_DEVREADWRITE("tia_video", tia_video_device, read, write) - AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0d00) AM_RAM AM_SHARE("riot_ram") - AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d00) AM_DEVICE("riot", mos6532_t, io_map) - // AM_RANGE(0x1000, 0x1fff) is cart data and it is configured at reset time, depending on the mounted cart! -ADDRESS_MAP_END - -WRITE8_MEMBER(a2600_state::switch_A_w) -{ - /* Left controller port */ - m_joy1->joy_w( data >> 4 ); - - /* Right controller port */ - m_joy2->joy_w( data & 0x0f ); - -// switch( ioport("CONTROLLERS")->read() % CATEGORY_SELECT ) -// { -// case 0x0a: /* KidVid voice module */ -// m_cassette->change_state(( data & 0x02 ) ? (cassette_state)CASSETTE_MOTOR_DISABLED : (cassette_state)(CASSETTE_MOTOR_ENABLED | CASSETTE_PLAY), (cassette_state)CASSETTE_MOTOR_DISABLED ); -// break; -// } -} - -READ8_MEMBER(a2600_state::switch_A_r) -{ - UINT8 val = 0; - - /* Left controller port PINs 1-4 ( 4321 ) */ - val |= ( m_joy1->joy_r() & 0x0F ) << 4; - - /* Right controller port PINs 1-4 ( 4321 ) */ - val |= m_joy2->joy_r() & 0x0F; - - return val; -} - -WRITE8_MEMBER(a2600_state::switch_B_w) -{ -} - -WRITE_LINE_MEMBER(a2600_state::irq_callback) -{ -} - -READ8_MEMBER(a2600_state::riot_input_port_8_r) -{ - return m_swb->read(); -} - - -READ16_MEMBER(a2600_state::a2600_read_input_port) -{ - switch( offset ) - { - case 0: /* Left controller port PIN 5 */ - return m_joy1->pot_x_r(); - - case 1: /* Left controller port PIN 9 */ - return m_joy1->pot_y_r(); - - case 2: /* Right controller port PIN 5 */ - return m_joy2->pot_x_r(); - - case 3: /* Right controller port PIN 9 */ - return m_joy2->pot_y_r(); - - case 4: /* Left controller port PIN 6 */ - return ( m_joy1->joy_r() & 0x20 ) ? 0xff : 0x7f; - - case 5: /* Right controller port PIN 6 */ - return ( m_joy2->joy_r() & 0x20 ) ? 0xff : 0x7f; - } - return 0xff; -} - -/* There are a few games that do an LDA ($80-$FF),Y instruction. - The contents off the databus then depend on whatever was read - from the RAM. To do this really properly the 6502 core would - need to keep track of the last databus contents so we can query - that. For now this is a quick hack to determine that value anyway. - Examples: - Q-Bert's Qubes (NTSC,F6) at 0x1594 - Berzerk at 0xF093. -*/ -READ8_MEMBER(a2600_state::a2600_get_databus_contents) -{ - UINT16 last_address, prev_address; - UINT8 last_byte, prev_byte; - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - - last_address = m_maincpu->pc() + 1; - if ( ! ( last_address & 0x1080 ) ) - { - return offset; - } - last_byte = prog_space.read_byte(last_address ); - if ( last_byte < 0x80 || last_byte == 0xFF ) - { - return last_byte; - } - prev_address = last_address - 1; - if ( ! ( prev_address & 0x1080 ) ) - { - return last_byte; - } - prev_byte = prog_space.read_byte(prev_address ); - if ( prev_byte == 0xB1 ) - { /* LDA (XX),Y */ - return prog_space.read_byte(last_byte + 1 ); - } - return last_byte; -} - -#if 0 -static const rectangle visarea[4] = { - { 26, 26 + 160 + 16, 24, 24 + 192 + 31 }, /* 262 */ - { 26, 26 + 160 + 16, 32, 32 + 228 + 31 }, /* 312 */ - { 26, 26 + 160 + 16, 45, 45 + 240 + 31 }, /* 328 */ - { 26, 26 + 160 + 16, 48, 48 + 240 + 31 } /* 342 */ -}; -#endif - -WRITE16_MEMBER(a2600_state::a2600_tia_vsync_callback) -{ - int i; - - for ( i = 0; i < ARRAY_LENGTH(supported_screen_heights); i++ ) - { - if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) - { - if ( supported_screen_heights[i] != m_current_screen_height ) - { - m_current_screen_height = supported_screen_heights[i]; -// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * m_current_screen_height ); - } - } - } -} - -WRITE16_MEMBER(a2600_state::a2600_tia_vsync_callback_pal) -{ - int i; - - for ( i = 0; i < ARRAY_LENGTH(supported_screen_heights); i++ ) - { - if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) - { - if ( supported_screen_heights[i] != m_current_screen_height ) - { - m_current_screen_height = supported_screen_heights[i]; -// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * m_current_screen_height ); - } - } - } -} - -// TODO: is this the correct behavior for the real hardware?!? -READ8_MEMBER(a2600_state::cart_over_riot_r) -{ - if (!space.debugger_access()) - m_cart->write_bank(space, offset, 0); - return m_riot_ram[0x20 + offset]; -} - -WRITE8_MEMBER(a2600_state::cart_over_riot_w) -{ - m_cart->write_bank(space, offset, 0); - m_riot_ram[0x20 + offset] = data; - -} - -WRITE8_MEMBER(a2600_state::cart_over_tia_w) -{ - // Both Cart & TIA see these addresses - m_cart->write_bank(space, offset, data); - m_tia->write(space, offset, data); -} - -MACHINE_START_MEMBER(a2600_state,a2600) -{ - m_current_screen_height = m_screen->height(); - memset(m_riot_ram, 0x00, 0x80); - - switch (m_cart->get_cart_type()) - { - case A26_2K: - case A26_4K: - case A26_F4: - case A26_F8: - case A26_F8SW: - case A26_FA: - case A26_E0: - case A26_E7: - case A26_CV: - case A26_DC: - case A26_FV: - case A26_8IN1: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); - break; - case A26_F6: - case A26_DPC: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(vcs_cart_slot_device::cart_opbase),(vcs_cart_slot_device*)m_cart)); - break; - case A26_FE: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_ram),(vcs_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x01fe, 0x01ff, read8_delegate(FUNC(vcs_cart_slot_device::read_bank),(vcs_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x01fe, 0x01fe, write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); - break; - case A26_3E: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_ram),(vcs_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x00, 0x3f, write8_delegate(FUNC(a2600_state::cart_over_tia_w), this)); - break; - case A26_3F: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x00, 0x3f, write8_delegate(FUNC(a2600_state::cart_over_tia_w), this)); - break; - case A26_UA: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x200, 0x27f, read8_delegate(FUNC(vcs_cart_slot_device::read_bank),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); - break; - case A26_JVP: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart), write8_delegate(FUNC(vcs_cart_slot_device::write_bank),(vcs_cart_slot_device*)m_cart)); - // to verify the actual behavior... - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xfa0, 0xfc0, read8_delegate(FUNC(a2600_state::cart_over_riot_r), this), write8_delegate(FUNC(a2600_state::cart_over_riot_w), this)); - break; - case A26_4IN1: - case A26_32IN1: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); - break; - case A26_SS: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); - break; - case A26_CM: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(vcs_cart_slot_device::read_rom),(vcs_cart_slot_device*)m_cart)); - break; - } - - /* Banks may have changed, reset the cpu so it uses the correct reset vector */ - m_maincpu->reset(); - - save_item(NAME(m_current_screen_height)); -} - - -#ifdef UNUSED_FUNCTIONS -// try to detect 2600 controller setup. returns 32bits with left/right controller info -unsigned a2600_state::long detect_2600controllers() -{ -#define JOYS 0x001 -#define PADD 0x002 -#define KEYP 0x004 -#define LGUN 0x008 -#define INDY 0x010 -#define BOOS 0x020 -#define KVID 0x040 -#define CMTE 0x080 -#define MLNK 0x100 -#define AMSE 0x200 -#define CX22 0x400 -#define CX80 0x800 - - unsigned int left,right; - int i,j,foundkeypad = 0; - UINT8 *cart; - static const unsigned char signatures[][5] = { - { 0x55, 0xa5, 0x3c, 0x29, 0}, // star raiders - { 0xf9, 0xff, 0xa5, 0x80, 1}, // sentinel - { 0x81, 0x02, 0xe8, 0x86, 1}, // shooting arcade - { 0x02, 0xa9, 0xec, 0x8d, 1}, // guntest4 tester - { 0x85, 0x2c, 0x85, 0xa7, 2}, // INDY 500 - { 0xa1, 0x8d, 0x9d, 0x02, 2}, // omega race INDY - { 0x65, 0x72, 0x44, 0x43, 2}, // Sprintmaster INDY - { 0x89, 0x8a, 0x99, 0xaa, 3}, // omega race - { 0x9a, 0x8e, 0x81, 0x02, 4}, - { 0xdd, 0x8d, 0x80, 0x02, 4}, - { 0x85, 0x8e, 0x81, 0x02, 4}, - { 0x8d, 0x81, 0x02, 0xe6, 4}, - { 0xff, 0x8d, 0x81, 0x02, 4}, - { 0xa9, 0x03, 0x8d, 0x81, 5}, - { 0xa9, 0x73, 0x8d, 0x80, 6}, - // { 0x82, 0x02, 0x85, 0x8f, 7}, // Mind Maze (really Mind Link??) - { 0xa9, 0x30, 0x8d, 0x80, 7}, // Bionic Breakthrough - { 0x02, 0x8e, 0x81, 0x02, 7}, // Telepathy - { 0x41, 0x6d, 0x69, 0x67, 9}, // Missile Command Amiga Mouse - { 0x43, 0x58, 0x2d, 0x32, 10}, // Missile Command CX22 TrackBall - { 0x43, 0x58, 0x2d, 0x38, 11}, // Missile Command CX80 TrackBall - { 0x4e, 0xa8, 0xa4, 0xa2, 12}, // Omega Race for Joystick ONLY - { 0xa6, 0xef, 0xb5, 0x38, 8} // Warlords.. paddles ONLY - }; - // start with this.. if anyone finds a game that does NOT work with both controllers enabled - // it can be fixed here with a new signature (note that the Coleco Gemini has this setup also) - left = JOYS+PADD; right = JOYS+PADD; - // default for bad dumps and roms too large to have special controllers - if ((m_cart_size > 0x4000) || (m_cart_size & 0x7ff)) return (left << 16) + right; - - cart = CART; - for (i = 0; i < m_cart_size - (sizeof signatures/sizeof signatures[0]); i++) - { - for (j = 0; j < (sizeof signatures/sizeof signatures[0]); j++) - { - if (!memcmp(&cart[i], &signatures[j],sizeof signatures[0] - 1)) - { - int k = signatures[j][4]; - if (k == 0) return (JOYS << 16) + KEYP; - if (k == 1) return (LGUN << 16); - if (k == 2) return (INDY << 16) + INDY; - if (k == 3) return (BOOS << 16) + BOOS; - if (k == 5) return (JOYS << 16) + KVID; - if (k == 6) return (CMTE << 16) + CMTE; - if (k == 7) return (MLNK << 16) + MLNK; - if (k == 8) return (PADD << 16) + PADD; - if (k == 9) return (AMSE << 16) + AMSE; - if (k == 10) return (CX22 << 16) + CX22; - if (k == 11) return (CX80 << 16) + CX80; - if (k == 12) return (JOYS << 16) + JOYS; - if (k == 4) foundkeypad = 1; - } - } - } - if (foundkeypad) return (KEYP << 16) + KEYP; - return (left << 16) + right; -} -#endif - - -static INPUT_PORTS_START( a2600 ) - PORT_START("SWB") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Reset Game") PORT_CODE(KEYCODE_2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Select Game") PORT_CODE(KEYCODE_1) - PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_DIPNAME( 0x08, 0x08, "TV Type" ) PORT_CODE(KEYCODE_C) PORT_TOGGLE - PORT_DIPSETTING( 0x08, "Color" ) - PORT_DIPSETTING( 0x00, "B&W" ) - PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_DIPNAME( 0x40, 0x00, "Left Diff. Switch" ) PORT_CODE(KEYCODE_3) PORT_TOGGLE - PORT_DIPSETTING( 0x40, "A" ) - PORT_DIPSETTING( 0x00, "B" ) - PORT_DIPNAME( 0x80, 0x00, "Right Diff. Switch" ) PORT_CODE(KEYCODE_4) PORT_TOGGLE - PORT_DIPSETTING( 0x80, "A" ) - PORT_DIPSETTING( 0x00, "B" ) -INPUT_PORTS_END - - -static SLOT_INTERFACE_START(a2600_cart) - SLOT_INTERFACE_INTERNAL("a26_2k", A26_ROM_2K) - SLOT_INTERFACE_INTERNAL("a26_4k", A26_ROM_4K) - SLOT_INTERFACE_INTERNAL("a26_f4", A26_ROM_F4) - SLOT_INTERFACE_INTERNAL("a26_f6", A26_ROM_F6) - SLOT_INTERFACE_INTERNAL("a26_f8", A26_ROM_F8) - SLOT_INTERFACE_INTERNAL("a26_f8sw", A26_ROM_F8_SW) - SLOT_INTERFACE_INTERNAL("a26_fa", A26_ROM_FA) - SLOT_INTERFACE_INTERNAL("a26_fe", A26_ROM_FE) - SLOT_INTERFACE_INTERNAL("a26_3e", A26_ROM_3E) - SLOT_INTERFACE_INTERNAL("a26_3f", A26_ROM_3F) - SLOT_INTERFACE_INTERNAL("a26_e0", A26_ROM_E0) - SLOT_INTERFACE_INTERNAL("a26_e7", A26_ROM_E7) - SLOT_INTERFACE_INTERNAL("a26_ua", A26_ROM_UA) - SLOT_INTERFACE_INTERNAL("a26_cv", A26_ROM_CV) - SLOT_INTERFACE_INTERNAL("a26_dc", A26_ROM_DC) - SLOT_INTERFACE_INTERNAL("a26_fv", A26_ROM_FV) - SLOT_INTERFACE_INTERNAL("a26_jvp", A26_ROM_JVP) - SLOT_INTERFACE_INTERNAL("a26_cm", A26_ROM_COMPUMATE) - SLOT_INTERFACE_INTERNAL("a26_ss", A26_ROM_SUPERCHARGER) - SLOT_INTERFACE_INTERNAL("a26_dpc", A26_ROM_DPC) - SLOT_INTERFACE_INTERNAL("a26_4in1", A26_ROM_4IN1) - SLOT_INTERFACE_INTERNAL("a26_8in1", A26_ROM_8IN1) - SLOT_INTERFACE_INTERNAL("a26_32in1", A26_ROM_32IN1) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_FRAGMENT(a2600_cartslot) - MCFG_VCS_CARTRIDGE_ADD("cartslot", a2600_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","a2600") - MCFG_SOFTWARE_LIST_ADD("cass_list","a2600_cass") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( a2600, a2600_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK_NTSC / 3) /* actually M6507 */ - MCFG_M6502_DISABLE_DIRECT() - MCFG_CPU_PROGRAM_MAP(a2600_mem) - - MCFG_MACHINE_START_OVERRIDE(a2600_state,a2600) - - /* video hardware */ - MCFG_DEVICE_ADD("tia_video", TIA_NTSC_VIDEO, 0) - MCFG_TIA_READ_INPUT_PORT_CB(READ16(a2600_state, a2600_read_input_port)) - MCFG_TIA_DATABUS_CONTENTS_CB(READ8(a2600_state, a2600_get_databus_contents)) - MCFG_TIA_VSYNC_CB(WRITE16(a2600_state, a2600_tia_vsync_callback)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( MASTER_CLOCK_NTSC, 228, 26, 26 + 160 + 16, 262, 24 , 24 + 192 + 31 ) - MCFG_SCREEN_UPDATE_DEVICE("tia_video", tia_video_device, screen_update) - MCFG_SCREEN_PALETTE("tia_video:palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_TIA_ADD("tia", MASTER_CLOCK_NTSC/114) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) - - /* devices */ - MCFG_DEVICE_ADD("riot", MOS6532n, MASTER_CLOCK_NTSC / 3) - MCFG_MOS6530n_IN_PA_CB(READ8(a2600_state, switch_A_r)) - MCFG_MOS6530n_OUT_PA_CB(WRITE8(a2600_state, switch_A_w)) - MCFG_MOS6530n_IN_PB_CB(READ8(a2600_state, riot_input_port_8_r)) - MCFG_MOS6530n_OUT_PB_CB(WRITE8(a2600_state, switch_B_w)) - MCFG_MOS6530n_IRQ_CB(WRITELINE(a2600_state, irq_callback)) - - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, "joy") - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) - - MCFG_FRAGMENT_ADD(a2600_cartslot) - MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( a2600p, a2600_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK_PAL / 3) /* actually M6507 */ - MCFG_CPU_PROGRAM_MAP(a2600_mem) - MCFG_M6502_DISABLE_DIRECT() - - MCFG_MACHINE_START_OVERRIDE(a2600_state,a2600) - - /* video hardware */ - MCFG_DEVICE_ADD("tia_video", TIA_PAL_VIDEO, 0) - MCFG_TIA_READ_INPUT_PORT_CB(READ16(a2600_state, a2600_read_input_port)) - MCFG_TIA_DATABUS_CONTENTS_CB(READ8(a2600_state, a2600_get_databus_contents)) - MCFG_TIA_VSYNC_CB(WRITE16(a2600_state, a2600_tia_vsync_callback_pal)) - - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( MASTER_CLOCK_PAL, 228, 26, 26 + 160 + 16, 312, 32, 32 + 228 + 31 ) - MCFG_SCREEN_UPDATE_DEVICE("tia_video", tia_video_device, screen_update) - MCFG_SCREEN_PALETTE("tia_video:palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_TIA_ADD("tia", MASTER_CLOCK_PAL/114) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) - - /* devices */ - MCFG_DEVICE_ADD("riot", MOS6532n, MASTER_CLOCK_PAL / 3) - MCFG_MOS6530n_IN_PA_CB(READ8(a2600_state, switch_A_r)) - MCFG_MOS6530n_OUT_PA_CB(WRITE8(a2600_state, switch_A_w)) - MCFG_MOS6530n_IN_PB_CB(READ8(a2600_state, riot_input_port_8_r)) - MCFG_MOS6530n_OUT_PB_CB(WRITE8(a2600_state, switch_B_w)) - MCFG_MOS6530n_IRQ_CB(WRITELINE(a2600_state, irq_callback)) - - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, "joy") - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) - - MCFG_FRAGMENT_ADD(a2600_cartslot) - MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") -MACHINE_CONFIG_END - - -ROM_START( a2600 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) -ROM_END - -#define rom_a2600p rom_a2600 - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1977, a2600, 0, 0, a2600, a2600, driver_device, 0, "Atari", "Atari 2600 (NTSC)" , MACHINE_SUPPORTS_SAVE ) -CONS( 1978, a2600p, a2600, 0, a2600p, a2600, driver_device, 0, "Atari", "Atari 2600 (PAL)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/a310.c b/src/mess/drivers/a310.c deleted file mode 100644 index 61764ca4cbd..00000000000 --- a/src/mess/drivers/a310.c +++ /dev/null @@ -1,453 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese, R. Belmont, Juergen Buchmueller -/****************************************************************************** - * - * Acorn Archimedes 310 - * - * Skeleton: Juergen Buchmueller , Jul 2000 - * Enhanced: R. Belmont, June 2007 - * Angelo Salese, August 2010 - * - * TODO: - * - Make floppies to work; - * - Attempting to load the GUI gives an exception; - * - Graphics in GUI misses some vram data on the right edges (for example white vertical stripe on the far right), rmw bug related to the above? - * - Apparently same deal happens to Arthur OS, on a bunch of icons; - * - Hook up mouse in AAKART; - * - Add shifted version of keyboard inputs, necessary especially for loading programs thru Supervisor Mode; - * - try to understand why bios 2 was working at some point and now isn't - * - * - * -======================================================================================= - * - * Memory map (from http://b-em.bbcmicro.com/arculator/archdocs.txt) - * - * 0000000 - 1FFFFFF - logical RAM (32 meg) - * 2000000 - 2FFFFFF - physical RAM (supervisor only - max 16MB - requires quad MEMCs) - * 3000000 - 33FFFFF - IOC (IO controllers - supervisor only) - * 3310000 - FDC - WD1772 - * 33A0000 - Econet - 6854 - * 33B0000 - Serial - 6551 - * 3240000 - 33FFFFF - internal expansion cards - * 32D0000 - hard disc controller (not IDE) - HD63463 - * 3350010 - printer - * 3350018 - latch A - * 3350040 - latch B - * 3270000 - external expansion cards - * - * 3400000 - 3FFFFFF - ROM (read - 12 meg - Arthur and RiscOS 2 512k, RiscOS 3 2MB) - * 3400000 - 37FFFFF - Low ROM (4 meg, I think this is expansion ROMs) - * 3800000 - 3FFFFFF - High ROM (main OS ROM) - * - * 3400000 - 35FFFFF - VICD10 (write - supervisor only) - * 3600000 - 3FFFFFF - MEMC (write - supervisor only) - * - *****************************************************************************/ -/* - DASM of code (bios 2 / RISC OS 2) - 0x380d4e0: MEMC: control to 0x10c (page size 32 kbytes, DRAM ram refresh only during flyback) - 0x380d4f0: VIDC: params (screen + sound frequency) - 0x380d51c: IOC: sets control to 0xff, clear IRQA and FIQ masks, sets IRQB mask to 0x80 (keyboard receive full irq) - 0x380d530: IOC: sets timer 0 to 0x4e20, go command - 0x380e0a8: work RAM physical check, max size etc. - 0x380e1f8: IOC: Disables DRAM ram refresh, sets timer 1 to 0x7ffe, go command, then it tests the latch of this timer, enables DRAM refresh - 0x380d00c: Set up default logical space - 0x380d16c: Set up case by case logical space - - -*/ - - -#include "emu.h" -#include "cpu/arm/arm.h" -#include "sound/dac.h" -#include "includes/archimds.h" -#include "machine/i2cmem.h" -//#include "machine/aakart.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "formats/applix_dsk.h" - - -class a310_state : public archimedes_state -{ -public: - a310_state(const machine_config &mconfig, device_type type, const char *tag) - : archimedes_state(mconfig, type, tag) - , m_physram(*this, "physicalram") - , m_ram(*this, RAM_TAG) - { } - - required_shared_ptr m_physram; - - DECLARE_READ32_MEMBER(a310_psy_wram_r); - DECLARE_WRITE32_MEMBER(a310_psy_wram_w); - DECLARE_WRITE_LINE_MEMBER(a310_wd177x_intrq_w); - DECLARE_WRITE_LINE_MEMBER(a310_wd177x_drq_w); - DECLARE_DRIVER_INIT(a310); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - -protected: - required_device m_ram; -}; - - -WRITE_LINE_MEMBER(a310_state::a310_wd177x_intrq_w) -{ - printf("%d IRQ\n",state); - if (state) - { - archimedes_request_fiq(ARCHIMEDES_FIQ_FLOPPY); - } - else - archimedes_clear_fiq(ARCHIMEDES_FIQ_FLOPPY); -} - -WRITE_LINE_MEMBER(a310_state::a310_wd177x_drq_w) -{ - printf("%d DRQ\n",state); - if (state) - { - archimedes_request_fiq(ARCHIMEDES_FIQ_FLOPPY_DRQ); - } - else - archimedes_clear_fiq(ARCHIMEDES_FIQ_FLOPPY_DRQ); -} - -READ32_MEMBER(a310_state::a310_psy_wram_r) -{ - return m_physram[offset]; -} - -WRITE32_MEMBER(a310_state::a310_psy_wram_w) -{ - COMBINE_DATA(&m_physram[offset]); -} - - -DRIVER_INIT_MEMBER(a310_state,a310) -{ - UINT32 ram_size = m_ram->size(); - - m_maincpu->space(AS_PROGRAM).install_readwrite_handler( 0x02000000, 0x02000000+(ram_size-1), read32_delegate(FUNC(a310_state::a310_psy_wram_r), this), write32_delegate(FUNC(a310_state::a310_psy_wram_w), this)); - - archimedes_driver_init(); -} - -void a310_state::machine_start() -{ - archimedes_init(); - - - - // reset the DAC to centerline - //m_dac->write_signed8(0x80); -} - -void a310_state::machine_reset() -{ - archimedes_reset(); -} - -static ADDRESS_MAP_START( a310_mem, AS_PROGRAM, 32, a310_state ) - AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(archimedes_memc_logical_r, archimedes_memc_logical_w) - AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_SHARE("physicalram") /* physical RAM - 16 MB for now, should be 512k for the A310 */ - AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(archimedes_ioc_r, archimedes_ioc_w) - AM_RANGE(0x03400000, 0x035fffff) AM_READWRITE(archimedes_vidc_r, archimedes_vidc_w) - AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(archimedes_memc_r, archimedes_memc_w) - AM_RANGE(0x03800000, 0x03ffffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITE(archimedes_memc_page_w) -ADDRESS_MAP_END - - -INPUT_CHANGED_MEMBER(a310_state::key_stroke) -{ - UINT8 row_val = (UINT8)(FPTR)(param) >> 4; - UINT8 col_val = (UINT8)(FPTR)(param) & 0xf; - - if(newval && !oldval) - m_kart->send_keycode_down(row_val,col_val); - - if(oldval && !newval) - m_kart->send_keycode_up(row_val,col_val); -} - -// TODO: -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0c) PORT_IMPULSE(1) <- led enabled & 4 -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1d) PORT_IMPULSE(1) <- English Pound symbol -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x21) PORT_IMPULSE(1) <- unknown but used (changes cursor to full) -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x22) PORT_IMPULSE(1) <- led enabled & 1 -// 0x37 - 0x39 another 7 - 9 (keypad?) -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3a) PORT_IMPULSE(1) <- another minus (keypad?) -// 0x48 - 0x4a another 4 - 6 (keypad?) -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4b) PORT_IMPULSE(1) <- + -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4c) PORT_IMPULSE(1) <- another English Pound -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x57) PORT_IMPULSE(1) <- another / -// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x5d) PORT_IMPULSE(1) <- led enabled & 2 - -static INPUT_PORTS_START( a310 ) - PORT_START("dip") /* DIP switches */ - PORT_BIT(0xfd, 0xfd, IPT_UNUSED) - - PORT_START("key0") /* KEY ROW 0 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x00) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x11) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x12) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x13) PORT_IMPULSE(1) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x14) PORT_IMPULSE(1) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x15) PORT_IMPULSE(1) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x16) PORT_IMPULSE(1) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x17) PORT_IMPULSE(1) - - PORT_START("key1") /* KEY ROW 1 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x18) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x19) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1a) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1b) PORT_IMPULSE(1) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1c) PORT_IMPULSE(1) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x10) PORT_IMPULSE(1) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1e) PORT_IMPULSE(1) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x26) PORT_IMPULSE(1) - - PORT_START("key2") /* KEY ROW 2 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x27) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("w W") PORT_CODE(KEYCODE_W) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x28) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("e E") PORT_CODE(KEYCODE_E) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x29) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("r R") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2a) PORT_IMPULSE(1) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("t T") PORT_CODE(KEYCODE_T) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2b) PORT_IMPULSE(1) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("y Y") PORT_CODE(KEYCODE_Y) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2c) PORT_IMPULSE(1) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("u U") PORT_CODE(KEYCODE_U) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2d) PORT_IMPULSE(1) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("i I") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2e) PORT_IMPULSE(1) - - PORT_START("key3") /* KEY ROW 3 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("o O") PORT_CODE(KEYCODE_O) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2f) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("p P") PORT_CODE(KEYCODE_P) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x30) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x31) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x32) PORT_IMPULSE(1) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x47) PORT_IMPULSE(1) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x61) PORT_IMPULSE(1) - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - - PORT_START("key4") /* KEY ROW 4 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3c) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("s S") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3d) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("d D") PORT_CODE(KEYCODE_D) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3e) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("f F") PORT_CODE(KEYCODE_F) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3f) PORT_IMPULSE(1) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("g G") PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x40) PORT_IMPULSE(1) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("h H") PORT_CODE(KEYCODE_H) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x41) PORT_IMPULSE(1) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("j J") PORT_CODE(KEYCODE_J) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x42) PORT_IMPULSE(1) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("k K") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x43) PORT_IMPULSE(1) - - PORT_START("key5") /* KEY ROW 5 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("l L") PORT_CODE(KEYCODE_L) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x44) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x45) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x46) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_ASTERISK) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x33) PORT_IMPULSE(1) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("SHIFT (L)") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("z Z") PORT_CODE(KEYCODE_Z) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4e) PORT_IMPULSE(1) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("x X") PORT_CODE(KEYCODE_X) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4f) PORT_IMPULSE(1) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("c C") PORT_CODE(KEYCODE_C) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x50) PORT_IMPULSE(1) - - PORT_START("key6") /* KEY ROW 6 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x51) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x52) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("n N") PORT_CODE(KEYCODE_N) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x53) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("m M") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x54) PORT_IMPULSE(1) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x55) PORT_IMPULSE(1) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x56) PORT_IMPULSE(1) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x23) PORT_IMPULSE(1) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("SHIFT (R)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x58) PORT_IMPULSE(1) - - PORT_START("key7") /* KEY ROW 7 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED") - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x5f) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("ENTER (KP)") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME(". (KP)") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("0 (KP)") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("1 (KP)") PORT_CODE(KEYCODE_1_PAD) - - PORT_START("key8") /* KEY ROW 8 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("2 (KP)") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("3 (KP)") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("4 (KP)") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("5 (KP)") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("6 (KP)") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("7 (KP)") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD) - - PORT_START("key9") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x20) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x24) PORT_IMPULSE(1) // (KP?) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("#") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x25) PORT_IMPULSE(1) // (KP?) - - PORT_START("keya") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x01) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x02) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x03) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x04) PORT_IMPULSE(1) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x05) PORT_IMPULSE(1) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x06) PORT_IMPULSE(1) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x07) PORT_IMPULSE(1) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x08) PORT_IMPULSE(1) - - PORT_START("keyb") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x09) PORT_IMPULSE(1) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0a) PORT_IMPULSE(1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0b) PORT_IMPULSE(1) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0c) PORT_IMPULSE(1) -// PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x05) PORT_IMPULSE(1) -// PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x06) PORT_IMPULSE(1) -// PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x07) PORT_IMPULSE(1) -// PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x08) PORT_IMPULSE(1) - - - PORT_START("via1a") /* VIA #1 PORT A */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_4WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_4WAY - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_4WAY - - PORT_START("tape")/* tape control */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("TAPE STOP") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("TAPE PLAY") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("TAPE REW") PORT_CODE(KEYCODE_F7) - PORT_BIT (0xf8, 0x80, IPT_UNUSED) -INPUT_PORTS_END - -FLOPPY_FORMATS_MEMBER( a310_state::floppy_formats ) - FLOPPY_APPLIX_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( a310_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER( archimedes_state::a310_kart_tx_w ) -{ - if(state) - archimedes_request_irq_b(ARCHIMEDES_IRQB_KBD_RECV_FULL); - else - archimedes_clear_irq_b(ARCHIMEDES_IRQB_KBD_RECV_FULL); -} - -WRITE_LINE_MEMBER( archimedes_state::a310_kart_rx_w ) -{ - if(state) - archimedes_request_irq_b(ARCHIMEDES_IRQB_KBD_XMIT_EMPTY); - else - archimedes_clear_irq_b(ARCHIMEDES_IRQB_KBD_XMIT_EMPTY); -} - -static MACHINE_CONFIG_START( a310, a310_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", ARM, 8000000) /* 8 MHz */ - MCFG_CPU_PROGRAM_MAP(a310_mem) - MCFG_ARM_COPRO(ARM_COPRO_TYPE_VL86C020) - - MCFG_DEVICE_ADD("kart", AAKART, 8000000/256) - MCFG_AAKART_OUT_TX_CB(WRITELINE(archimedes_state, a310_kart_tx_w)) - MCFG_AAKART_OUT_RX_CB(WRITELINE(archimedes_state, a310_kart_rx_w)) - - MCFG_I2CMEM_ADD("i2cmem") - MCFG_I2CMEM_DATA_SIZE(0x100) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1280, 1024) //TODO: default screen size - MCFG_SCREEN_VISIBLE_AREA(0*8, 1280 - 1, 0*16, 1024 - 1) - MCFG_SCREEN_UPDATE_DRIVER(archimedes_state, screen_update) - - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("512K, 1M, 4M, 8M, 16M") - - MCFG_WD1772_ADD("fdc", 8000000 / 1) // TODO: frequency - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE( a310_state, a310_wd177x_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(a310_state, a310_wd177x_drq_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", a310_floppies, "35dd", a310_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", a310_floppies, "35dd", a310_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "archimedes") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac0", DAC, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.10) - - MCFG_SOUND_ADD("dac1", DAC, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.10) - - MCFG_SOUND_ADD("dac2", DAC, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.10) - - MCFG_SOUND_ADD("dac3", DAC, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.10) - - MCFG_SOUND_ADD("dac4", DAC, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.10) - - MCFG_SOUND_ADD("dac5", DAC, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.10) - - MCFG_SOUND_ADD("dac6", DAC, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.10) - - MCFG_SOUND_ADD("dac7", DAC, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.10) -MACHINE_CONFIG_END - -ROM_START(a310) - ROM_REGION( 0x800000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "311", "RiscOS 3.11 (29 Sep 1992)" ) - ROMX_LOAD( "ic24.rom", 0x000000, 0x80000, CRC(c1adde84) SHA1(12d060e0401dd0523d44453f947bdc55dd2c3240), ROM_BIOS(1) ) - ROMX_LOAD( "ic25.rom", 0x080000, 0x80000, CRC(15d89664) SHA1(78f5d0e6f1e8ee603317807f53ff8fe65a3b3518), ROM_BIOS(1) ) - ROMX_LOAD( "ic26.rom", 0x100000, 0x80000, CRC(a81ceb7c) SHA1(46b870876bc1f68f242726415f0c49fef7be0c72), ROM_BIOS(1) ) - ROMX_LOAD( "ic27.rom", 0x180000, 0x80000, CRC(707b0c6c) SHA1(345199a33fed23996374b9db8170a52ab63f0380), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "120", "Arthur/RiscOS 1.20 (25 Sep 1987)" ) - ROMX_LOAD( "arthur.bin", 0x000000, 0x080000, CRC(eb3fda57) SHA1(1181ff9c2c2f3d6d414054ec33b2260404bafc81), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "200", "RiscOS 2.0 (05 Oct 1988)" ) - ROMX_LOAD( "riscos2.bin", 0x000000, 0x080000, CRC(89c4ad36) SHA1(b82a78830dac386f9b649b6d32a34f9c6910546d), ROM_BIOS(3) ) - - ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x100, "i2cmem", ROMREGION_ERASE00 ) -ROM_END - -ROM_START( a3010 ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD32_WORD( "0296,061-01.ic4" , 0x000000, 0x100000, CRC(b77fe215) SHA1(57b19ea4b97a9b6a240aa61211c2c134cb295aa0)) - ROM_LOAD32_WORD( "0296,062-01.ic15", 0x000002, 0x100000, CRC(d42e196e) SHA1(64243d39d1bca38b10761f66a8042c883bde87a4)) - ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) - ROM_REGION( 0x100, "i2cmem", ROMREGION_ERASE00 ) - - ROM_REGION( 0x10000, "battery", ROMREGION_ERASE00 ) - ROM_LOAD( "0296,063-2.ic40", 0x00000, 0x10000, CRC(9ca3a6be) SHA1(75905b031f49960605d55c3e7350d309559ed440)) -ROM_END - -ROM_START( a3020 ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD32_WORD( "riscos_3.11_1.bin", 0x000000, 0x100000, CRC(552fc3aa) SHA1(b2f1911e53d7377f2e69e1a870139745d3df494b)) - ROM_LOAD32_WORD( "riscos_3.11_2.bin", 0x000002, 0x100000, CRC(308d5a4a) SHA1(b309e1dd85670a06d77ec504dbbec6c42336329f)) - ROM_REGION( 0x200000, "vram", ROMREGION_ERASE00 ) - ROM_REGION( 0x100, "i2cmem", ROMREGION_ERASE00 ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1988, a310, 0, 0, a310, a310, a310_state, a310, "Acorn", "Archimedes 310", MACHINE_NOT_WORKING) -COMP( 1988, a3010, a310, 0, a310, a310, a310_state, a310, "Acorn", "Archimedes 3010", MACHINE_NOT_WORKING) -COMP( 1988, a3020, a310, 0, a310, a310, a310_state, a310, "Acorn", "Archimedes 3020", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/a5105.c b/src/mess/drivers/a5105.c deleted file mode 100644 index 03be992da60..00000000000 --- a/src/mess/drivers/a5105.c +++ /dev/null @@ -1,624 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Robbbert -/*************************************************************************** - - A5105 - - 12/05/2009 Skeleton driver. - - http://www.robotrontechnik.de/index.htm?/html/computer/a5105.htm - http://www.sax.de/~zander/bic/bic_bw.html - - - this looks like "somehow" inspired by the MSX1 machine? - - -ToDo: -- Fix hang when it should scroll -- Cassette Load (bit 7 of port 91) - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/upd7220.h" -#include "machine/ram.h" -#include "machine/upd765.h" -#include "formats/a5105_dsk.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" -#include "sound/wave.h" -#include "sound/beep.h" - - - -class a5105_state : public driver_device -{ -public: - a5105_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_hgdc(*this, "upd7220"), - m_cass(*this, "cassette"), - m_beep(*this, "beeper"), - m_fdc(*this, "upd765a"), - m_floppy0(*this, "upd765a:0"), - m_floppy1(*this, "upd765a:1"), - m_floppy2(*this, "upd765a:2"), - m_floppy3(*this, "upd765a:3"), - m_video_ram(*this, "video_ram"), - m_ram(*this, RAM_TAG), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_hgdc; - required_device m_cass; - required_device m_beep; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - - DECLARE_READ8_MEMBER(a5105_memsel_r); - DECLARE_READ8_MEMBER(key_r); - DECLARE_READ8_MEMBER(key_mux_r); - DECLARE_WRITE8_MEMBER(key_mux_w); - DECLARE_WRITE8_MEMBER(a5105_ab_w); - DECLARE_WRITE8_MEMBER(a5105_memsel_w); - DECLARE_WRITE8_MEMBER( a5105_upd765_w ); - DECLARE_WRITE8_MEMBER(pcg_addr_w); - DECLARE_WRITE8_MEMBER(pcg_val_w); - required_shared_ptr m_video_ram; - UINT8 *m_ram_base; - UINT8 *m_rom_base; - UINT8 *m_char_ram; - UINT16 m_pcg_addr; - UINT16 m_pcg_internal_addr; - UINT8 m_key_mux; - UINT8 m_memsel[4]; - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(a5105); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - required_device m_ram; - required_device m_gfxdecode; - required_device m_palette; - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); - UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); -}; - -/* TODO */ -UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - int xi,gfx; - UINT8 pen; - - gfx = m_video_ram[(address & 0x1ffff) >> 1]; - - for(xi=0;xi<16;xi++) - { - pen = ((gfx >> xi) & 1) ? 7 : 0; - - bitmap.pix32(y, x + xi) = palette[pen]; - } -} - -UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int x; - int xi,yi; - int tile,color; - UINT8 tile_data; - - for( x = 0; x < pitch; x++ ) - { - tile = (m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] & 0xff); - color = ((m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] >> 8) & 0x0f); - - for( yi = 0; yi < lr; yi++) - { - tile_data = m_char_ram[(tile*8+yi) & 0x7ff]; - - if(cursor_on && cursor_addr == addr+x && machine().first_screen()->frame_number() & 0x10) - tile_data^=0xff; - - for( xi = 0; xi < 8; xi++) - { - int res_x,res_y; - int pen = (tile_data >> xi) & 1 ? color : 0; - - res_x = x * 8 + xi; - res_y = y + yi; - - if(yi >= 8) { pen = 0; } - - if(!machine().first_screen()->visible_area().contains(res_x+0, res_y)) - continue; - - bitmap.pix32(res_y, res_x) = palette[pen]; - } - } - } -} - -static ADDRESS_MAP_START(a5105_mem, AS_PROGRAM, 8, a5105_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("bank4") -ADDRESS_MAP_END - -WRITE8_MEMBER( a5105_state::pcg_addr_w ) -{ - m_pcg_addr = data << 3; - m_pcg_internal_addr = 0; -} - -WRITE8_MEMBER( a5105_state::pcg_val_w ) -{ - m_char_ram[m_pcg_addr | m_pcg_internal_addr] = data; - - m_gfxdecode->gfx(0)->mark_dirty(m_pcg_addr >> 3); - - m_pcg_internal_addr++; - m_pcg_internal_addr&=7; -} - -READ8_MEMBER( a5105_state::key_r ) -{ - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", - "KEY4", "KEY5", "KEY6", "KEY7", - "KEY8", "KEY9", "KEYA", "UNUSED", - "UNUSED", "UNUSED", "UNUSED", "UNUSED" }; - - return ioport(keynames[m_key_mux & 0x0f])->read(); -} - -READ8_MEMBER( a5105_state::key_mux_r ) -{ - return m_key_mux; -} - -WRITE8_MEMBER( a5105_state::key_mux_w ) -{ - /* - xxxx ---- unknown - ---- xxxx keyboard mux - */ - - m_key_mux = data; -} - -WRITE8_MEMBER( a5105_state::a5105_ab_w ) -{ -/*port $ab - ---- 100x tape motor, active low - ---- 101x tape data - ---- 110x led (color green) - ---- 111x key click, active high -*/ - switch (data & 6) - { - case 0: - if (BIT(data, 0)) - m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - else - m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - break; - - case 2: - m_cass->output( BIT(data, 0) ? -1.0 : +1.0); - break; - - case 4: - //led - break; - - case 6: - m_beep->set_state(BIT(data, 0)); - break; - } -} - -READ8_MEMBER( a5105_state::a5105_memsel_r ) -{ - UINT8 res; - - res = (m_memsel[0] & 3) << 0; - res|= (m_memsel[1] & 3) << 2; - res|= (m_memsel[2] & 3) << 4; - res|= (m_memsel[3] & 3) << 6; - - return res; -} - -WRITE8_MEMBER( a5105_state::a5105_memsel_w ) -{ - address_space &prog = m_maincpu->space( AS_PROGRAM ); - - if (m_memsel[0] != ((data & 0x03) >> 0)) - { - m_memsel[0] = (data & 0x03) >> 0; - - switch (m_memsel[0]) - { - case 0: - membank("bank1")->set_base(m_rom_base); - prog.install_read_bank(0x0000, 0x3fff, "bank1"); - prog.unmap_write(0x0000, 0x3fff); - break; - case 2: - membank("bank1")->set_base(m_ram_base); - prog.install_readwrite_bank(0x0000, 0x3fff, "bank1"); - break; - default: - prog.unmap_readwrite(0x0000, 0x3fff); - break; - } - } - - if (m_memsel[1] != ((data & 0x0c) >> 2)) - { - m_memsel[1] = (data & 0x0c) >> 2; - - switch (m_memsel[1]) - { - case 0: - membank("bank2")->set_base(m_rom_base + 0x4000); - prog.install_read_bank(0x4000, 0x7fff, "bank2"); - prog.unmap_write(0x4000, 0x4000); - break; - case 1: - membank("bank2")->set_base(memregion("k5651")->base()); - prog.install_read_bank(0x4000, 0x7fff, "bank2"); - prog.unmap_write(0x4000, 0x4000); - break; - case 2: - membank("bank2")->set_base(m_ram_base + 0x4000); - prog.install_readwrite_bank(0x4000, 0x7fff, "bank2"); - break; - default: - prog.unmap_readwrite(0x4000, 0x7fff); - break; - } - } - - if (m_memsel[2] != ((data & 0x30) >> 4)) - { - m_memsel[2] = (data & 0x30) >> 4; - - switch (m_memsel[2]) - { - case 0: - membank("bank3")->set_base(m_rom_base + 0x8000); - prog.install_read_bank(0x8000, 0xbfff, "bank3"); - prog.unmap_write(0x8000, 0xbfff); - break; - case 2: - membank("bank3")->set_base(m_ram_base + 0x8000); - prog.install_readwrite_bank(0x8000, 0xbfff, "bank3"); - break; - default: - prog.unmap_readwrite(0x8000, 0xbfff); - break; - } - } - - if (m_memsel[3] != ((data & 0xc0) >> 6)) - { - m_memsel[3] = (data & 0xc0) >> 6; - - switch (m_memsel[3]) - { - case 2: - membank("bank4")->set_base(m_ram_base + 0xc000); - prog.install_readwrite_bank(0xc000, 0xffff, "bank4"); - break; - default: - prog.unmap_readwrite(0xc000, 0xffff); - break; - } - } - - //printf("Memsel change to %02x %02x %02x %02x\n",m_memsel[0],m_memsel[1],m_memsel[2],m_memsel[3]); -} - -WRITE8_MEMBER( a5105_state::a5105_upd765_w ) -{ - m_floppy0->get_device()->mon_w(!BIT(data,0)); - m_floppy1->get_device()->mon_w(!BIT(data,1)); - m_floppy2->get_device()->mon_w(!BIT(data,2)); - m_floppy3->get_device()->mon_w(!BIT(data,3)); - - m_fdc->tc_w(BIT(data, 4)); -} - -static ADDRESS_MAP_START(a5105_io, AS_IO, 8, a5105_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x41) AM_DEVICE("upd765a", upd765a_device, map) - AM_RANGE(0x48, 0x4f) AM_WRITE(a5105_upd765_w) - - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0x90, 0x93) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) - AM_RANGE(0x98, 0x99) AM_DEVREADWRITE("upd7220", upd7220_device, read, write) - - AM_RANGE(0x9c, 0x9c) AM_WRITE(pcg_val_w) -// AM_RANGE(0x9d, 0x9d) crtc area (ff-based), palette routes here - AM_RANGE(0x9e, 0x9e) AM_WRITE(pcg_addr_w) - -// AM_RANGE(0xa0, 0xa1) ay8910? - AM_RANGE(0xa8, 0xa8) AM_READWRITE(a5105_memsel_r,a5105_memsel_w) - AM_RANGE(0xa9, 0xa9) AM_READ(key_r) - AM_RANGE(0xaa, 0xaa) AM_READWRITE(key_mux_r,key_mux_w) - AM_RANGE(0xab, 0xab) AM_WRITE(a5105_ab_w) //misc output, see above -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( a5105 ) - PORT_START("KEY0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 =") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 \\") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\\') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 /") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - - PORT_START("KEY1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("< >") PORT_CODE(KEYCODE_COLON) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+ *") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb6 \xc3\x96") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa4 \xc3\x84") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xbc \xc3\x9c") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("# ^") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('^') - - PORT_START("KEY2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("' `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\'') PORT_CHAR('`') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("? beta") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". :") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // appears to do nothing - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - - PORT_START("KEY3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START("KEY4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - - PORT_START("KEY5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("KEY6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) /* gives keyclick but does nothing */PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CODE") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("KEY7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SELECT") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("KEY8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("KEY9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - - PORT_START("KEYA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - - PORT_START("UNUSED") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -void a5105_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - a5105_ab_w(space, 0, 9); // turn motor off - m_beep->set_frequency(500); - - m_ram_base = (UINT8*)m_ram->pointer(); - m_rom_base = (UINT8*)memregion("maincpu")->base(); - - membank("bank1")->set_base(m_rom_base); - membank("bank2")->set_base(m_rom_base + 0x4000); - membank("bank3")->set_base(m_ram_base); - membank("bank4")->set_base(m_ram_base + 0x4000); -} - - -static const gfx_layout a5105_chars_8x8 = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 7, 6, 5, 4, 3, 2, 1, 0 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( a5105 ) - GFXDECODE_ENTRY( "pcg", 0x0000, a5105_chars_8x8, 0, 8 ) -GFXDECODE_END - - -PALETTE_INIT_MEMBER(a5105_state, a5105) -{ - int i; - int r,g,b; - - for ( i = 0; i < 16; i++ ) - { - r = i & 4 ? ((i & 8) ? 0xaa : 0xff) : 0x00; - g = i & 2 ? ((i & 8) ? 0xaa : 0xff) : 0x00; - b = i & 1 ? ((i & 8) ? 0xaa : 0xff) : 0x00; - - palette.set_pen_color(i, rgb_t(r,g,b)); - } -} - -void a5105_state::video_start() -{ - // find memory regions - m_char_ram = memregion("pcg")->base(); -} - -static ADDRESS_MAP_START( upd7220_map, AS_0, 16, a5105_state) - ADDRESS_MAP_GLOBAL_MASK(0x1ffff) - AM_RANGE(0x00000, 0x1ffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -FLOPPY_FORMATS_MEMBER( a5105_state::floppy_formats ) - FLOPPY_A5105_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( a5105_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -static const z80_daisy_config a5105_daisy_chain[] = -{ - { "z80ctc" }, - { "z80pio" }, - { NULL } -}; - -static MACHINE_CONFIG_START( a5105, a5105_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_15MHz / 4) - MCFG_CPU_PROGRAM_MAP(a5105_mem) - MCFG_CPU_IO_MAP(a5105_io) - MCFG_CPU_CONFIG(a5105_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) - MCFG_SCREEN_SIZE(40*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 25*8-1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", a5105) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(a5105_state, a5105) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_15MHz / 16) // unk clock - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(a5105_state, hgdc_display_pixels) - MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(a5105_state, hgdc_draw_text) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_15MHz / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg2)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_15MHz / 4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", 0)) - - MCFG_CASSETTE_ADD( "cassette" ) - - MCFG_UPD765A_ADD("upd765a", true, true) - MCFG_FLOPPY_DRIVE_ADD("upd765a:0", a5105_floppies, "525qd", a5105_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765a:1", a5105_floppies, "525qd", a5105_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765a:2", a5105_floppies, "525qd", a5105_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765a:3", a5105_floppies, "525qd", a5105_state::floppy_formats) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( a5105 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "k1505_00.rom", 0x0000, 0x8000, CRC(0ed5f556) SHA1(5c33139db9f59e50da5c76729752f8e653ae34ae)) - ROM_LOAD( "k1505_80.rom", 0x8000, 0x2000, CRC(350e4958) SHA1(7e5b587c59676e8549561117ea0b70234f439a94)) - - ROM_REGION( 0x800, "pcg", ROMREGION_ERASE00 ) - - ROM_REGION( 0x4000, "k5651", ROMREGION_ERASEFF ) - ROM_LOAD( "k5651_40.rom", 0x0000, 0x2000, CRC(f4ad4739) SHA1(9a7bbe6f0d180dd513c7854f441cee986c8d9765)) - ROM_LOAD( "k5651_60.rom", 0x2000, 0x2000, CRC(c77dde3f) SHA1(7c16226be6c4c71013e8008fba9d2e9c5640b6a7)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, a5105, 0, 0, a5105, a5105, driver_device, 0, "VEB Robotron", "BIC A5105", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/a51xx.c b/src/mess/drivers/a51xx.c deleted file mode 100644 index 2155fce0124..00000000000 --- a/src/mess/drivers/a51xx.c +++ /dev/null @@ -1,177 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - A51xx - - 12/05/2009 Skeleton driver. - - http://www.robotrontechnik.de/index.htm?/html/computer/a5120.htm - http://www.robotrontechnik.de/index.htm?/html/computer/a5130.htm - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - - -class a51xx_state : public driver_device -{ -public: - a51xx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - DECLARE_MACHINE_RESET(a5130); - DECLARE_VIDEO_START(a5130); - UINT32 screen_update_a5120(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_a5130(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(a5120_mem, AS_PROGRAM, 8, a51xx_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x03ff ) AM_ROM - AM_RANGE( 0x0400, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( a5120_io, AS_IO, 8, a51xx_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(a5130_mem, AS_PROGRAM, 8, a51xx_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_ROM - AM_RANGE( 0x1000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( a5130_io, AS_IO, 8, a51xx_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( a5120 ) -INPUT_PORTS_END - - -void a51xx_state::machine_reset() -{ -} - -void a51xx_state::video_start() -{ -} - -UINT32 a51xx_state::screen_update_a5120(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - -/* Input ports */ -static INPUT_PORTS_START( a5130 ) -INPUT_PORTS_END - - -MACHINE_RESET_MEMBER(a51xx_state,a5130) -{ -} - -VIDEO_START_MEMBER(a51xx_state,a5130) -{ -} - -UINT32 a51xx_state::screen_update_a5130(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout a51xx_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 1024*8, 1025*8, 1026*8, 1027*8, 1028*8, 1029*8, 1030*8, 1031*8 }, - 8*8 /* every char takes 2 x 8 bytes */ -}; - -static GFXDECODE_START( a51xx ) - GFXDECODE_ENTRY( "chargen", 0x0000, a51xx_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( a5120, a51xx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(a5120_mem) - MCFG_CPU_IO_MAP(a5120_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(a51xx_state, screen_update_a5120) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", a51xx) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( a5130, a5120 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(a5130_mem) - MCFG_CPU_IO_MAP(a5130_io) - - MCFG_MACHINE_RESET_OVERRIDE(a51xx_state,a5130) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(a51xx_state, screen_update_a5130) - - MCFG_VIDEO_START_OVERRIDE(a51xx_state,a5130) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( a5120 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v1", "v1" ) - ROMX_LOAD( "a5120_v1.rom", 0x0000, 0x0400, CRC(b2b3fee0) SHA1(6198513b263d8a7a867f1dda368b415bb37fcdae), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v2", "v2" ) - ROMX_LOAD( "a5120_v2.rom", 0x0000, 0x0400, CRC(052386c2) SHA1(e545d30a0882cb7ee7acdbea842b57440552e4a6), ROM_BIOS(2)) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "bab47_1_lat.bin", 0x0000, 0x0400, CRC(93220886) SHA1(a5a1ab4e2e06eabc58c84991caa6a1cf55f1462d)) - ROM_LOAD( "bab46_2_lat.bin", 0x0400, 0x0400, CRC(7a578ec8) SHA1(d17d3f1c182c23e9e9fd4dd56f3ac3de4c18fb1a)) -ROM_END - -/* ROM definition */ -ROM_START( a5130 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "dzr5130.rom", 0x0000, 0x1000, CRC(4719beb7) SHA1(09295a658b8c5b75b20faea57ad925f69f07a9b5)) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "bab47_1_lat.bin", 0x0000, 0x0400, CRC(93220886) SHA1(a5a1ab4e2e06eabc58c84991caa6a1cf55f1462d)) - ROM_LOAD( "bab46_2_lat.bin", 0x0400, 0x0400, CRC(7a578ec8) SHA1(d17d3f1c182c23e9e9fd4dd56f3ac3de4c18fb1a)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, a5120, 0, 0, a5120, a5120, driver_device, 0, "VEB Robotron", "A5120", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1983, a5130, a5120, 0, a5130, a5130, driver_device, 0, "VEB Robotron", "A5130", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/a6809.c b/src/mess/drivers/a6809.c deleted file mode 100644 index 38a455614ca..00000000000 --- a/src/mess/drivers/a6809.c +++ /dev/null @@ -1,277 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert and unknown others -/*************************************************************************** - - Acorn 6809 - - 2009-05-12 Skeleton driver. - 2013-12-16 Fixed video [Robbbert] - - Acorn System 3 update? - http://acorn.chriswhy.co.uk/8bit_Upgrades/Acorn_6809_CPU.html - - This is a few boards emulated together: - - 6809 main board - - 80x25 video board - - FDC board (to come) - -The video board has a mc6845, and the characters do not go to a character -generator, instead they go to a SAA5050, which has its own CG inbuilt, plus -many other features. - -ToDo: - - FDC (address A00) - - Centronics Printer (VIA port A) - -Commands: -C - Echo to printer ( C '+' turns it on) -D - boot from disk -G - Go -L - Load tape -P - Run from pc reg -R - Display regs -S - Save tape -T - Trace -V - Set breakpoint - -M - Modify memory -MV - Modify memory at breakpoint address -MG - Modify memory from Go address -MP - Modify memory from pc-reg address -MR - Modify regs - -While modifying memory: -, show next address -- show previous address -enter show next address -; exit - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/6522via.h" -#include "machine/keyboard.h" -#include "video/saa5050.h" -#include "video/mc6845.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" - - -class a6809_state : public driver_device -{ -public: - a6809_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_p_videoram(*this, "videoram") - , m_via(*this, "via") - , m_cass(*this, "cassette") - , m_maincpu(*this, "maincpu") - , m_crtc(*this, "mc6845") - { } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(videoram_r); - DECLARE_WRITE8_MEMBER(a6809_address_w); - DECLARE_WRITE8_MEMBER(a6809_register_w); - DECLARE_WRITE_LINE_MEMBER(cass_w); - DECLARE_MACHINE_RESET(a6809); - TIMER_DEVICE_CALLBACK_MEMBER(a6809_c); - TIMER_DEVICE_CALLBACK_MEMBER(a6809_p); - required_shared_ptr m_p_videoram; - UINT16 m_start_address; - UINT16 m_cursor_address; -private: - UINT8 m_cass_data[4]; - bool m_cass_state; - bool m_cassold; - UINT8 m_video_index; - required_device m_via; - required_device m_cass; - required_device m_maincpu; - required_device m_crtc; -}; - - -static ADDRESS_MAP_START(a6809_mem, AS_PROGRAM, 8, a6809_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000,0x03ff) AM_RAM - AM_RANGE(0x0400,0x07ff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x0800,0x0800) AM_DEVREAD("mc6845", mc6845_device, status_r) AM_WRITE(a6809_address_w) - AM_RANGE(0x0801,0x0801) AM_DEVREAD("mc6845", mc6845_device, register_r) AM_WRITE(a6809_register_w) - AM_RANGE(0x0900,0x090f) AM_MIRROR(0xf0) AM_DEVREADWRITE("via", via6522_device, read, write) - AM_RANGE(0xf000,0xf7ff) // optional ROM - AM_RANGE(0xf800,0xffff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( a6809_io, AS_IO, 8, a6809_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( a6809 ) -INPUT_PORTS_END - - -MACHINE_RESET_MEMBER( a6809_state, a6809) -{ - m_via->write_pb0(0); - m_via->write_pb1(0); - m_via->write_pb2(0); - m_via->write_pb3(0); - m_via->write_pb4(0); - m_via->write_pb5(0); - m_via->write_pb6(0); - m_via->write_pb7(0); -} - -READ8_MEMBER( a6809_state::videoram_r ) -{ - offset += m_start_address; - - if (m_cursor_address == offset) - return 0x7f; // cheap cursor - else - return m_p_videoram[offset&0x3ff]; -} - -WRITE8_MEMBER( a6809_state::a6809_address_w ) -{ - m_crtc->address_w( space, 0, data ); - - m_video_index = data & 0x1f; -} - -WRITE8_MEMBER( a6809_state::a6809_register_w ) -{ - UINT16 temp = m_start_address; - UINT16 temq = m_cursor_address; - - // data is 18, but we need 19, to give the 20 rows needed by the SAA5050 - if (m_video_index == 9) - data++; - - m_crtc->register_w( space, 0, data ); - - // Get start address - if (m_video_index == 12) - m_start_address = ((data & 7) << 8 ) | (temp & 0xff); - else - if (m_video_index == 13) - m_start_address = data | (temp & 0x3f00); - - else - // Get cursor address - if (m_video_index == 14) - m_cursor_address = ((data & 7) << 8 ) | (temq & 0xff); - else - if (m_video_index == 15) - m_cursor_address = data | (temq & 0x3f00); -} - -WRITE_LINE_MEMBER( a6809_state::cass_w ) -{ - m_cass_state = state; -} - -TIMER_DEVICE_CALLBACK_MEMBER(a6809_state::a6809_c) -{ - m_cass_data[3]++; - - if (m_cass_state != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = m_cass_state; - } - - if (m_cass_state) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -TIMER_DEVICE_CALLBACK_MEMBER(a6809_state::a6809_p) -{ - /* cassette - turn 1200/2400Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_via->write_pb7(m_cass_data[1] < 12); - m_cass_data[1] = 0; - } -} - -WRITE8_MEMBER( a6809_state::kbd_put ) -{ - UINT8 d = data & 0x7f; - if (d == 8) d = 0x7f; // allow backspace to work - - m_via->write_pb0((d>>0)&1); - m_via->write_pb1((d>>1)&1); - m_via->write_pb2((d>>2)&1); - m_via->write_pb3((d>>3)&1); - m_via->write_pb4((d>>4)&1); - m_via->write_pb5((d>>5)&1); - m_via->write_pb6((d>>6)&1); - m_via->write_cb1(1); - m_via->write_cb1(0); -} - -static MACHINE_CONFIG_START( a6809, a6809_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6809E, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(a6809_mem) - MCFG_CPU_IO_MAP(a6809_io) - MCFG_MACHINE_RESET_OVERRIDE(a6809_state, a6809) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(40 * 12, 25 * 20) - MCFG_SCREEN_VISIBLE_AREA(0, 40 * 12 - 1, 0, 25 * 20 - 1) - MCFG_SCREEN_UPDATE_DEVICE("saa5050", saa5050_device, screen_update) - MCFG_PALETTE_ADD("palette", 8) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_DEVICE_ADD("via", VIA6522, XTAL_4MHz / 4) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(a6809_state, cass_w)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - - MCFG_MC6845_ADD("mc6845", MC6845, "screen", XTAL_4MHz / 2) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(12) - - MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000) - MCFG_SAA5050_D_CALLBACK(READ8(a6809_state, videoram_r)) - MCFG_SAA5050_SCREEN_SIZE(40, 25, 40) - - MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(a6809_state, kbd_put)) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_TIMER_DRIVER_ADD_PERIODIC("a6809_c", a6809_state, a6809_c, attotime::from_hz(4800)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("a6809_p", a6809_state, a6809_p, attotime::from_hz(40000)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( a6809 ) - ROM_REGION( 0x800, "maincpu", 0 ) - ROM_LOAD( "acorn6809.bin", 0x000, 0x800, CRC(5fa5b632) SHA1(b14a884bf82a7a8c23bc03c2e112728dd1a74896) ) - - ROM_REGION( 0x100, "proms", 0 ) - ROM_LOAD( "acorn6809.ic11", 0x0000, 0x0100, CRC(7908317d) SHA1(e0f1e5bd3a8598d3b62bc432dd1f3892ed7e66d8) ) // address decoder -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, a6809, 0, 0, a6809, a6809, driver_device, 0, "Acorn", "System 3 (6809 CPU)", 0 ) diff --git a/src/mess/drivers/a7150.c b/src/mess/drivers/a7150.c deleted file mode 100644 index 47935cf9b79..00000000000 --- a/src/mess/drivers/a7150.c +++ /dev/null @@ -1,83 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Robotron A7150 - - 04/10/2009 Skeleton driver. - - http://www.robotrontechnik.de/index.htm?/html/computer/a7150.htm - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" - - -class a7150_state : public driver_device -{ -public: - a7150_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_a7150(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(a7150_mem, AS_PROGRAM, 16, a7150_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0xeffff) AM_RAM - AM_RANGE(0xf8000,0xfffff) AM_ROM AM_REGION("user1", 0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( a7150 ) -INPUT_PORTS_END - - -void a7150_state::machine_reset() -{ -} - -void a7150_state::video_start() -{ -} - -UINT32 a7150_state::screen_update_a7150(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( a7150, a7150_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 4915000) - MCFG_CPU_PROGRAM_MAP(a7150_mem) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(a7150_state, screen_update_a7150) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( a7150 ) - ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "a7150.rom", 0x0000, 0x8000, CRC(57855abd) SHA1(b58f1363623d2c3ff1221e449529ecaa22573bff)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, a7150, 0, 0, a7150, a7150, driver_device, 0, "VEB Robotron", "A7150", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/a7800.c b/src/mess/drivers/a7800.c deleted file mode 100644 index 0d979502d7d..00000000000 --- a/src/mess/drivers/a7800.c +++ /dev/null @@ -1,1464 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Dan Boris, Fabio Priuli, Mike Saarna, Robert Tuccitto -/*************************************************************************** - - a7800.c - - Driver file to handle emulation of the Atari 7800. - - Dan Boris - - 2002/05/13 kubecj added more banks for bankswitching - added PAL machine description - changed clock to be precise - improved cart emulation (in machine/) - - 2012/10/25 Robert Tuccitto NTSC Color Generator utilized for - color palette with hue shift/start - based on observation of several - systems across multiple displays - - 2012/11/09 Robert Tuccitto Fixed 3 degree hue begin point - miscalculation of color palette - - 2012/12/05 Robert Tuccitto Implemented proper IRE and phase - value to the palette - - 2012/12/14 Robert Tuccitto Adjusted colorburst/tint/hue of entire - palette to closer reflect default hardware configuration - setting of ~180 degrees. Palette settings now correspond - documented and calculated settings as follows: - - Contrast = 0.0526 --> 0.05 - Brightness = 0.0 --> 0.00 - Color = 0.2162 --> 0.22 - Phase = 25.714 --> 25.7 - Colorburst/Hue = 180 degrees - - 2013/02/27 Robert Tuccitto Palette rebuild due to misaligned - data references. Corrected PAL color sequence order. - - 2013/03/19 Robert Tuccitto Stripped palette to raw video output - values removing YIQ/YUV infer data. - - 2013/04/02 Robert Tuccitto Corrected rotation values and errors - including duplicate entries for palette. - - 2013/04/07 Robert Tuccitto Address map locations for the XBOARD - added. - - 2013/05/01 Robert Tuccitto Red and Blue miscalculated proportions - fixed. - - 2013/08/04 Robert Tuccitto Green miscalculated proportions fixed. - - 2013/08/13 Robert Tuccitto Normalized contrast and brightness, - providing a standardize grayscale and adjusted color values. - - 2013/09/02 Robert Tuccitto Stored data for 26.7 & 27.7 phase shifts - with corrections and label for 25.7 values. Made 26.7 - (medium) default. Phase shifting falls outside the realm of - video controls and hope to implement a selectable toggle - hardware option similar to Donkey Kong TKG02/TKG04. - - 2013/09/19 Robert Tuccitto Cleanup of Address Maps, high score maps - added. - - 2013/10/16 Robert Tuccitto Added Phase Shifts 24.7, 25.2, 26.2, 27.2. - Phase Shifts 24.7 through 27.7 degrees with 0.5 degree - increments documented. Phase Shift 26.2 degrees made active. - Fixed typo under 26.7 7$. - - 2013/10/27 Robert Tuccitto Modernized screen parameters for NTSC & PAL. - - 2013/11/03 Robert Tuccitto Fixed correctly typo under 26.7 7$. - - 2013/11/23 Robert Tuccitto Added NTSC Palette Notes. - - 2014/01/02 Robert Tuccitto Corrected joystick buttons assignment & minor - palette notes cleanup. - - 2014/01/09 Robert Tuccitto Positional description for difficulty - switches added. - - 2014/02/15 Robert Tuccitto Added more details and clarification - regarding the potentiometer. - - 2014/03/25 Mike Saarna Fixed Riot Timer - - 2014/04/04 Mike Saarna Fix to controller button RIOT behavior - - 2014/05/06 Mike Saarna/Robert Tuccitto Brought initial Maria cycle counts - inline from measurements taken with logic analyzer and tests. - - 2014/08/25 Fabio Priuli Converted carts to be slot devices and cleaned - up the driver (removed the pokey, cleaned up rom regions, etc.) - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "sound/tiaintf.h" -#include "sound/tiasound.h" -#include "machine/mos6530n.h" -#include "video/maria.h" -#include "bus/a7800/a78_carts.h" - - -#define A7800_NTSC_Y1 XTAL_14_31818MHz -#define CLK_PAL 1773447 - - -class a7800_state : public driver_device -{ -public: - a7800_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_tia(*this, "tia"), - m_maria(*this, "maria"), - m_io_joysticks(*this, "joysticks"), - m_io_buttons(*this, "buttons"), - m_io_console_buttons(*this, "console_buttons"), - m_cart(*this, "cartslot"), - m_screen(*this, "screen"), - m_bios(*this, "maincpu") { } - - int m_lines; - int m_ispal; - - int m_ctrl_lock; - int m_ctrl_reg; - int m_maria_flag; - int m_p1_one_button; - int m_p2_one_button; - int m_bios_enabled; - - DECLARE_READ8_MEMBER(bios_or_cart_r); - DECLARE_WRITE8_MEMBER(ram0_w); - DECLARE_READ8_MEMBER(tia_r); - DECLARE_WRITE8_MEMBER(tia_w); - DECLARE_READ8_MEMBER(maria_r); - DECLARE_WRITE8_MEMBER(maria_w); - DECLARE_DRIVER_INIT(a7800_pal); - DECLARE_DRIVER_INIT(a7800_ntsc); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(a7800); - DECLARE_PALETTE_INIT(a7800p); - TIMER_DEVICE_CALLBACK_MEMBER(interrupt); - TIMER_CALLBACK_MEMBER(maria_startdma); - DECLARE_READ8_MEMBER(riot_joystick_r); - DECLARE_READ8_MEMBER(riot_console_button_r); - DECLARE_WRITE8_MEMBER(riot_button_pullup_w); - -protected: - required_device m_maincpu; - required_device m_tia; - required_device m_maria; - required_ioport m_io_joysticks; - required_ioport m_io_buttons; - required_ioport m_io_console_buttons; - required_device m_cart; - required_device m_screen; - required_region_ptr m_bios; -}; - - -/*************************************************************************** - MEMORY HANDLERS - ***************************************************************************/ - -// RIOT -READ8_MEMBER(a7800_state::riot_joystick_r) -{ - return m_io_joysticks->read(); -} - -READ8_MEMBER(a7800_state::riot_console_button_r) -{ - return m_io_console_buttons->read(); -} - -WRITE8_MEMBER(a7800_state::riot_button_pullup_w) -{ - if(m_maincpu->space(AS_PROGRAM).read_byte(0x283) & 0x04) - m_p1_one_button = data & 0x04; // pin 6 of the controller port is held high by the riot chip when reading two-button controllers (from schematic) - if(m_maincpu->space(AS_PROGRAM).read_byte(0x283) & 0x10) - m_p2_one_button = data & 0x10; -} - -READ8_MEMBER(a7800_state::tia_r) -{ - switch (offset & 0x0f) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - case 0x04: - case 0x05: - case 0x06: - case 0x07: - /* Even though the 7800 doesn't use the TIA graphics the collision registers should - still return a reasonable value */ - return 0x00; - case 0x08: - return ((m_io_buttons->read() & 0x02) << 6); - case 0x09: - return ((m_io_buttons->read() & 0x08) << 4); - case 0x0a: - return ((m_io_buttons->read() & 0x01) << 7); - case 0x0b: - return ((m_io_buttons->read() & 0x04) << 5); - case 0x0c: - if (((m_io_buttons->read() & 0x08) ||(m_io_buttons->read() & 0x02)) && m_p1_one_button) - return 0x00; - else - return 0x80; - case 0x0d: - if (((m_io_buttons->read() & 0x01) ||(m_io_buttons->read() & 0x04)) && m_p2_one_button) - return 0x00; - else - return 0x80; - default: - logerror("undefined TIA read %x\n",offset); - - } - return 0xff; -} - -// TIA -WRITE8_MEMBER(a7800_state::tia_w) -{ - if (offset < 0x20) - { //INPTCTRL covers TIA registers 0x00-0x1F until locked - if (data & 0x01) - { - if (m_ctrl_lock && offset == 0x01) - m_maria_flag = 1; - else if (!m_ctrl_lock) - m_maria_flag = 1; - } - if (!m_ctrl_lock) - { - m_ctrl_lock = data & 0x01; - m_ctrl_reg = data; - } - } - m_tia->tia_sound_w(space, offset, data); -} - - -// TIMERS - -TIMER_DEVICE_CALLBACK_MEMBER(a7800_state::interrupt) -{ - // DMA Begins 7 cycles after hblank - machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(7), timer_expired_delegate(FUNC(a7800_state::maria_startdma),this)); - m_maria->interrupt(m_lines); -} - -TIMER_CALLBACK_MEMBER(a7800_state::maria_startdma) -{ - m_maria->startdma(m_lines); -} - - - -// ROM -READ8_MEMBER(a7800_state::bios_or_cart_r) -{ - if (!(m_ctrl_reg & 0x04)) - return m_bios[offset]; - else - return m_cart->read_40xx(space, offset + 0x8000); -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( a7800_mem, AS_PROGRAM, 8, a7800_state ) - AM_RANGE(0x0000, 0x001f) AM_MIRROR(0x300) AM_READWRITE(tia_r, tia_w) - AM_RANGE(0x0020, 0x003f) AM_MIRROR(0x300) AM_DEVREADWRITE("maria", atari_maria_device, read, write) - AM_RANGE(0x0040, 0x00ff) AM_RAMBANK("zpmirror") // mirror of 0x2040-0x20ff, for zero page - AM_RANGE(0x0140, 0x01ff) AM_RAMBANK("spmirror") // mirror of 0x2140-0x21ff, for stack page - AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x60) AM_DEVICE("riot", mos6532_t, io_map) - AM_RANGE(0x0480, 0x04ff) AM_MIRROR(0x100) AM_DEVICE("riot", mos6532_t, ram_map) - AM_RANGE(0x1800, 0x1fff) AM_RAM AM_SHARE("6116_1") - AM_RANGE(0x2000, 0x27ff) AM_RAM AM_SHARE("6116_2") - // According to the official Software Guide, the RAM at 0x2000 is - // repeatedly mirrored up to 0x3fff, but this is evidently incorrect - // because the High Score Cartridge maps ROM at 0x3000-0x3fff - // Hardware tests show that only the page at 0x2700 appears at - // 0x2800, and only on some hardware (MARIA? motherboard?) revisions, - // and even then with inconsistent and unreliable results. - AM_RANGE(0x4000, 0xffff) AM_DEVWRITE("cartslot", a78_cart_slot_device, write_40xx) - AM_RANGE(0x4000, 0xbfff) AM_DEVREAD("cartslot", a78_cart_slot_device, read_40xx) - AM_RANGE(0xc000, 0xffff) AM_READ(bios_or_cart_r) // here also the BIOS can be accessed -ADDRESS_MAP_END - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( a7800 ) - PORT_START("joysticks") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY - - PORT_START("buttons") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("console_buttons") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select") PORT_CODE(KEYCODE_S) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_O) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_DIPNAME(0x40, 0x40, "Left Difficulty Switch") - PORT_DIPSETTING(0x40, "A - Right Position" ) - PORT_DIPSETTING(0x00, "B - Left Position" ) - PORT_DIPNAME(0x80, 0x80, "Right Difficulty Switch") - PORT_DIPSETTING(0x80, "A - Right Position" ) - PORT_DIPSETTING(0x00, "B - Left Position" ) -INPUT_PORTS_END - -/*************************************************************************** -Atari 7800 NTSC Palette Notes: - -Palette on a modern flat panel display (LCD, LED, Plasma, etc.) appears -different from a traditional CRT. The most outstanding difference is Hue 1x, -the hue begin point. Hue 1x looks very 'green' (~-60 to -45 degrees - -depending on how poor or well it handles the signal conversion and its -calibration) on a modern flat panel display, as opposed to 'gold' (~-33 -degrees) on a CRT. - -The potentiometer (pot adjustment) for the 7800 modifies the delay line -regarding colors it will exhibit and is extremely sensitive. The slightest -turn can have a significant impact. - -A system whose potentiometer is not properly calibrated via -'CPS 7800 Diagnostic Test Cartridge' or/and just slightly off from the -desired factory settings may exhibit consequences such as too much blue in -place of green (Pot adjusted slightly too far left) or washed out reddish -tones in place of where most other systems display a darker reddish tones -(Pot adjusted slightly too far right). - -This is a result of the phase shifting of lesser degrees (Pot adjusted more -to the left) or phase shifting of greater degrees (Pot adjusted more to the -right). - -Turning the pot adjustment to the right, it can be observed that the values -of the higher end of the scale will match the lower end of the scale. -For example, after some turning to the right, the values of Dx, Ex, Fx, -can be set to match 1x, 2x, 3x. - -After further turning to the right, now the palette can be brought to make -Ax, Bx, Cx, Dx, Ex, Fx will match 1x, 2x, 3x, 4x, 5x, 6x. - -Ultimately though, too much turning to the right results in all colors being -wiped from the scale, excluding the hue begin point 1x (Which remains -unchanged while tweaking the potentiometer either left or right). - -Continuously turning the pot adjustment to the left, red and blue become the -most dominant two colors encompassing the palette with only a slight -influence of green at the highest end of the palette (Fx), once turned all -the way leftward. - -The degree range for adjustment of the phase shifting on the 7800 appears -to be as low as approximately 15 degrees when tuned all the way left, and -seems to be able to achieve as high as approximately 45 degrees when turned -right before losing all color (Excluding 1x) from the palette scale. - -For even a properly calibrated system at power on, the system's phase -shift appears as low as ~23 degrees and after a considerable consistent -runtime ('warm-up'), can be as high as ~28 degrees. - -In general, the low end of ~23 degrees lasts for maybe several seconds, -whereas higher values such as ~25-27 degrees is the most dominant during -system run time. 180 degrees colorburst takes place at ~25.7 degrees (A -near exact match of Hue 1x and 15x - To the naked eye they appear to be -the same). - -However, consistent system run time causes Hue 15x (F$) to become -stronger/darker gold (More brown then ultimately red-brown); as well -as leans Hue 14x (E$) more brown than green. Once achieving a phase shift -of 27.7, Hue 14x (E$) and Hue 15x (F$) near-exact match Hue 1x and 2x -respectively. - -Therefore, an ideal phase shift while accounting for the reality of -shifting while warming up, as well as maintaining differences between 1x, -2x and 14x, 15x, would likely fall between a 25.7 and 27.7. Phase shifts -26.2 degrees and 26.7 degrees places Hue 15x (F$) between Hue 1x and -Hue 2x, having 26.2 degrees leaning closer to Hue 1x and 26.7 degrees -leaning closer to Hue 2x. - -The above notion would also harmonize with what has been documented for -the colors of 1x, 2x, 14x, 15x on the 7800. 1x = Gold, 2x = Orange, -14x (E$) = Orange-Green. 15x (F$) = Light Orange. Color descriptions are -best measured in the middle of the brightness scale. It should be -mentioned that Green-Yellow is referenced at Hue 13x (D$), nowhere near -Hue 1x. A Green-Yellow Hue 1x is how the palette is manipulated and -modified (in part) under a modern flat panel display. - -Additionally, the blue to red (And consequently blue to green) ratio -proportions may appear different on a modern flat panel display than a CRT -in some instances for the Atari 7800 system. Furthermore, you may have -some variation of proportions even within the same display type. - -One side effect of this on the console's palette is that some values of -red may appear too pinkish - Too much blue to red. This is not the same -as a traditional tint-hue control adjustment; rather, can be demonstrated -by changing the blue ratio values via MESS HLSL settings. - -Lastly, the Atari 2600 & 5200 NTSC color palettes hold the same hue -structure order and have similar appearance differences that are dependent -upon display type. -***************************************************************************/ - -/*************************************************************************** - PALETTE - 25.7 PHASE SHIFT -***************************************************************************/ - -#define NTSC_GREY \ - rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ - rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ - rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ - rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) - -#define NTSC_GOLD \ - rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ - rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ - rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ - rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) - -#define NTSC_ORANGE \ - rgb_t(0x31,0x00,0x00), rgb_t(0x42,0x06,0x00), rgb_t(0x53,0x17,0x00), rgb_t(0x64,0x28,0x00), \ - rgb_t(0x75,0x39,0x00), rgb_t(0x86,0X4A,0x00), rgb_t(0x97,0x5B,0x0A), rgb_t(0xA8,0x6C,0x1B), \ - rgb_t(0xB9,0x7D,0x2C), rgb_t(0xCA,0x8E,0x3D), rgb_t(0xDB,0x9F,0x4E), rgb_t(0xEC,0xB0,0x5F), \ - rgb_t(0xFD,0xC1,0x70), rgb_t(0xFF,0xD2,0x85), rgb_t(0xFF,0xE3,0x9C), rgb_t(0xFF,0xF4,0xB2 ) - -#define NTSC_RED_ORANGE \ - rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x08,0x00), rgb_t(0x71,0x19,0x00), \ - rgb_t(0x82,0x2A,0x0D), rgb_t(0x93,0x3B,0x1E), rgb_t(0xA4,0x4C,0x2F), rgb_t(0xB5,0x5D,0x40), \ - rgb_t(0xC6,0x6E,0x51), rgb_t(0xD7,0x7F,0x62), rgb_t(0xE8,0x90,0x73), rgb_t(0xF9,0xA1,0x83), \ - rgb_t(0xFF,0xB2,0x98), rgb_t(0xFF,0xC3,0xAE), rgb_t(0xFF,0xD4,0xC4), rgb_t(0xFF,0xE5,0xDA ) - -#define NTSC_PINK \ - rgb_t(0x3F,0x00,0x03), rgb_t(0x50,0x00,0x0F), rgb_t(0x61,0x00,0x1B), rgb_t(0x72,0x0F,0x2B), \ - rgb_t(0x83,0x20,0x3C), rgb_t(0x94,0x31,0x4D), rgb_t(0xA5,0x42,0x5E), rgb_t(0xB6,0x53,0x6F), \ - rgb_t(0xC7,0x64,0x80), rgb_t(0xD8,0x75,0x91), rgb_t(0xE9,0x86,0xA2), rgb_t(0xFA,0x97,0xB3), \ - rgb_t(0xFF,0xA8,0xC8), rgb_t(0xFF,0xB9,0xDE), rgb_t(0xFF,0xCA,0xEF), rgb_t(0xFF,0xDB,0xF4 ) - -#define NTSC_PURPLE \ - rgb_t(0x33,0x00,0x35), rgb_t(0x44,0x00,0x41), rgb_t(0x55,0x00,0x4C), rgb_t(0x66,0x0C,0x5C), \ - rgb_t(0x77,0x1D,0x6D), rgb_t(0x88,0x2E,0x7E), rgb_t(0x99,0x3F,0x8F), rgb_t(0xAA,0x50,0xA0), \ - rgb_t(0xBB,0x61,0xB1), rgb_t(0xCC,0x72,0xC2), rgb_t(0xDD,0x83,0xD3), rgb_t(0xEE,0x94,0xE4), \ - rgb_t(0xFF,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) - -#define NTSC_PURPLE_BLUE \ - rgb_t(0x1D,0x00,0x5C), rgb_t(0x2E,0x00,0x68), rgb_t(0x40,0x00,0x74), rgb_t(0x51,0x10,0x84), \ - rgb_t(0x62,0x21,0x95), rgb_t(0x73,0x32,0xA6), rgb_t(0x84,0x43,0xB7), rgb_t(0x95,0x54,0xC8), \ - rgb_t(0xA6,0x65,0xD9), rgb_t(0xB7,0x76,0xEA), rgb_t(0xC8,0x87,0xEB), rgb_t(0xD9,0x98,0xEB), \ - rgb_t(0xE9,0xA9,0xEC), rgb_t(0xFB,0xBA,0xEB), rgb_t(0xFF,0xCB,0xEF), rgb_t(0xFF,0xDC,0xF4 ) - -#define NTSC_BLUE1 \ - rgb_t(0x02,0x00,0x71), rgb_t(0x13,0x00,0x7D), rgb_t(0x24,0x0B,0x8C), rgb_t(0x35,0x1C,0x9D), \ - rgb_t(0x46,0x2D,0xAE), rgb_t(0x57,0x3E,0xBF), rgb_t(0x68,0x4F,0xD0), rgb_t(0x79,0x60,0xE1), \ - rgb_t(0x8A,0x71,0xF2), rgb_t(0x9B,0x82,0xF7), rgb_t(0xAC,0x93,0xF7), rgb_t(0xBD,0xA4,0xF7), \ - rgb_t(0xCE,0xB5,0xF7), rgb_t(0xDF,0xC6,0xF7), rgb_t(0xF0,0xD7,0xF7), rgb_t(0xFF,0xE8,0xF8 ) - -#define NTSC_BLUE2 \ - rgb_t(0x00,0x00,0x68), rgb_t(0x00,0x0A,0x7C), rgb_t(0x08,0x1B,0x90), rgb_t(0x19,0x2C,0xA1), \ - rgb_t(0x2A,0x3D,0xB2), rgb_t(0x3B,0x4E,0xC3), rgb_t(0x4C,0x5F,0xD4), rgb_t(0x5D,0x70,0xE5), \ - rgb_t(0x6E,0x81,0xF6), rgb_t(0x7F,0x92,0xFF), rgb_t(0x90,0xA3,0xFF), rgb_t(0xA1,0xB4,0xFF), \ - rgb_t(0xB2,0xC5,0xFF), rgb_t(0xC3,0xD6,0xFF), rgb_t(0xD4,0xE7,0xFF), rgb_t(0xE5,0xF8,0xFF ) - -#define NTSC_LIGHT_BLUE \ - rgb_t(0x00,0x0A,0x4D), rgb_t(0x00,0x1B,0x63), rgb_t(0x00,0x2C,0x79), rgb_t(0x02,0x3D,0x8F), \ - rgb_t(0x13,0x4E,0xA0), rgb_t(0x24,0x5F,0xB1), rgb_t(0x35,0x70,0xC2), rgb_t(0x46,0x81,0xD3), \ - rgb_t(0x57,0x92,0xE4), rgb_t(0x68,0xA3,0xF5), rgb_t(0x79,0xB4,0xFF), rgb_t(0x8A,0xC5,0xFF), \ - rgb_t(0x9B,0xD6,0xFF), rgb_t(0xAC,0xE7,0xFF), rgb_t(0xBD,0xF8,0xFF), rgb_t(0xCE,0xFF,0xFF ) - -#define NTSC_TURQUOISE \ - rgb_t(0x00,0x1A,0x26), rgb_t(0x00,0x2B,0x3C), rgb_t(0x00,0x3C,0x52), rgb_t(0x00,0x4D,0x68), \ - rgb_t(0x06,0x5E,0x7C), rgb_t(0x17,0x6F,0x8D), rgb_t(0x28,0x80,0x9E), rgb_t(0x39,0x91,0xAF), \ - rgb_t(0x4A,0xA2,0xC0), rgb_t(0x5B,0xB3,0xD1), rgb_t(0x6C,0xC4,0xE2), rgb_t(0x7D,0xD5,0xF3), \ - rgb_t(0x8E,0xE6,0xFF), rgb_t(0x9F,0xF7,0xFF), rgb_t(0xB0,0xFF,0xFF), rgb_t(0xC1,0xFF,0xFF ) - -#define NTSC_GREEN_BLUE \ - rgb_t(0x00,0x24,0x0B), rgb_t(0x00,0x35,0x10), rgb_t(0x00,0x46,0x22), rgb_t(0x00,0x57,0x38), \ - rgb_t(0x05,0x68,0x4D), rgb_t(0x16,0x79,0x5E), rgb_t(0x27,0x8A,0x6F), rgb_t(0x38,0x9B,0x80), \ - rgb_t(0x49,0xAC,0x91), rgb_t(0x5A,0xBD,0xA2), rgb_t(0x6B,0xCE,0xB3), rgb_t(0x7C,0xDF,0xC4), \ - rgb_t(0x8D,0xF0,0xD5), rgb_t(0x9E,0xFF,0xE5), rgb_t(0xAF,0xFF,0xF1), rgb_t(0xC0,0xFF,0xFD ) - -#define NTSC_GREEN \ - rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1B), \ - rgb_t(0x10,0x6B,0x1B), rgb_t(0x21,0x7C,0x2C), rgb_t(0x32,0x8D,0x3D), rgb_t(0x43,0x9E,0x4E), \ - rgb_t(0x54,0xAF,0x5F), rgb_t(0x65,0xC0,0x70), rgb_t(0x76,0xD1,0x81), rgb_t(0x87,0xE2,0x92), \ - rgb_t(0x98,0xF3,0xA3), rgb_t(0xA9,0xFF,0xB3), rgb_t(0xBA,0xFF,0xBF), rgb_t(0xCB,0xFF,0xCB ) - -#define NTSC_YELLOW_GREEN \ - rgb_t(0x00,0x23,0x0A), rgb_t(0x00,0x34,0x10), rgb_t(0x04,0x45,0x13), rgb_t(0x15,0x56,0x13), \ - rgb_t(0x26,0x67,0x13), rgb_t(0x37,0x78,0x13), rgb_t(0x48,0x89,0x14), rgb_t(0x59,0x9A,0x25), \ - rgb_t(0x6A,0xAB,0x36), rgb_t(0x7B,0xBC,0x47), rgb_t(0x8C,0xCD,0x58), rgb_t(0x9D,0xDE,0x69), \ - rgb_t(0xAE,0xEF,0x7A), rgb_t(0xBF,0xFF,0x8B), rgb_t(0xD0,0xFF,0x97), rgb_t(0xE1,0xFF,0xA3 ) - -#define NTSC_ORANGE_GREEN \ - rgb_t(0x00,0x17,0x07), rgb_t(0x0E,0x28,0x08), rgb_t(0x1F,0x39,0x08), rgb_t(0x30,0x4A,0x08), \ - rgb_t(0x41,0x5B,0x08), rgb_t(0x52,0x6C,0x08), rgb_t(0x63,0x7D,0x08), rgb_t(0x74,0x8E,0x0D), \ - rgb_t(0x85,0x9F,0x1E), rgb_t(0x96,0xB0,0x2F), rgb_t(0xA7,0xC1,0x40), rgb_t(0xB8,0xD2,0x51), \ - rgb_t(0xC9,0xE3,0x62), rgb_t(0xDA,0xF4,0x73), rgb_t(0xEB,0xFF,0x82), rgb_t(0xFC,0xFF,0x8E ) - -#define NTSC_LIGHT_ORANGE \ - rgb_t(0x19,0x07,0x00), rgb_t(0x2A,0x18,0x00), rgb_t(0x3B,0x29,0x00), rgb_t(0x4C,0x3A,0x00), \ - rgb_t(0x5D,0x4B,0x00), rgb_t(0x6E,0x5C,0x00), rgb_t(0x7F,0x6D,0x00), rgb_t(0x90,0x7E,0x09), \ - rgb_t(0xA1,0x8F,0x1A), rgb_t(0xB2,0xA0,0x2B), rgb_t(0xC3,0xB1,0x3C), rgb_t(0xD4,0xC2,0x4D), \ - rgb_t(0xE5,0xD3,0x5E), rgb_t(0xF6,0xE4,0x6F), rgb_t(0xFF,0xF5,0x82), rgb_t(0xFF,0xFF,0x96 ) - -static const rgb_t a7800_palette[256*3] = -{ - NTSC_GREY, - NTSC_GOLD, - NTSC_ORANGE, - NTSC_RED_ORANGE, - NTSC_PINK, - NTSC_PURPLE, - NTSC_PURPLE_BLUE, - NTSC_BLUE1, - NTSC_BLUE2, - NTSC_LIGHT_BLUE, - NTSC_TURQUOISE, - NTSC_GREEN_BLUE, - NTSC_GREEN, - NTSC_YELLOW_GREEN, - NTSC_ORANGE_GREEN, - NTSC_LIGHT_ORANGE -}; - -static const rgb_t a7800p_palette[256*3] = -{ - NTSC_GREY, - NTSC_ORANGE_GREEN, - NTSC_GOLD, - NTSC_ORANGE, - NTSC_RED_ORANGE, - NTSC_PINK, - NTSC_PURPLE, - NTSC_PURPLE_BLUE, - NTSC_BLUE1, - NTSC_BLUE2, - NTSC_LIGHT_BLUE, - NTSC_TURQUOISE, - NTSC_GREEN_BLUE, - NTSC_GREEN, - NTSC_YELLOW_GREEN, - NTSC_ORANGE_GREEN -}; - -/*************************************************************************** - PALETTE - 24.7 PHASE SHIFT - - -define NTSC_GREY - rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ - rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ - rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ - rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) - -define NTSC_GOLD - rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ - rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ - rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ - rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) - -define NTSC_ORANGE - rgb_t(0x30,0x00,0x00), rgb_t(0x41,0x07,0x00), rgb_t(0x52,0x18,0x00), rgb_t(0x63,0x29,0x00), \ - rgb_t(0x74,0x3A,0x00), rgb_t(0x85,0x4B,0x00), rgb_t(0x96,0x5C,0x0A), rgb_t(0xA7,0x6D,0x1B), \ - rgb_t(0xB8,0x7E,0x2C), rgb_t(0xC9,0x8F,0x3D), rgb_t(0xDA,0xA0,0x4E), rgb_t(0xEB,0xB1,0x5F), \ - rgb_t(0xFC,0xC2,0x70), rgb_t(0xFF,0xD3,0x85), rgb_t(0xFF,0xE4,0x9B), rgb_t(0xFF,0xF5,0xB1 ) - -define NTSC_RED_ORANGE - rgb_t(0x3D,0x00,0x00), rgb_t(0x4E,0x00,0x00), rgb_t(0x5F,0x09,0x00), rgb_t(0x70,0x1A,0x00), \ - rgb_t(0x81,0x2B,0x09), rgb_t(0x92,0x3C,0x1A), rgb_t(0xA3,0x4D,0x2B), rgb_t(0xB4,0x5E,0x3C), \ - rgb_t(0xC5,0x6F,0x4D), rgb_t(0xD6,0x80,0x5E), rgb_t(0xE7,0x91,0x6F), rgb_t(0xF8,0xA2,0x80), \ - rgb_t(0xFF,0xB3,0x94), rgb_t(0xFF,0xC4,0xAA), rgb_t(0xFF,0xD5,0xC0), rgb_t(0xFF,0xE6,0xD6 ) - -define NTSC_PINK - rgb_t(0x3F,0x00,0x00), rgb_t(0x50,0x00,0x09), rgb_t(0x61,0x00,0x15), rgb_t(0x72,0x10,0x26), \ - rgb_t(0x83,0x21,0x37), rgb_t(0x94,0x32,0x48), rgb_t(0xA5,0x43,0x59), rgb_t(0xB6,0x54,0x6A), \ - rgb_t(0xC7,0x65,0x7B), rgb_t(0xD8,0x76,0x8C), rgb_t(0xE9,0x87,0x9D), rgb_t(0xFA,0x98,0xAE), \ - rgb_t(0xFF,0xA9,0xC2), rgb_t(0xFF,0xBA,0xD8), rgb_t(0xFF,0xCB,0xEE), rgb_t(0xFF,0xDC,0xF4 ) - -define NTSC_PURPLE - rgb_t(0x36,0x00,0x2E), rgb_t(0x47,0x00,0x3A), rgb_t(0x58,0x00,0x46), rgb_t(0x69,0x0C,0x55), \ - rgb_t(0x7A,0x1D,0x66), rgb_t(0x8B,0x2E,0x77), rgb_t(0x9C,0x3F,0x88), rgb_t(0xAD,0x50,0x99), \ - rgb_t(0xBE,0x61,0xAA), rgb_t(0xCF,0x72,0xBB), rgb_t(0xE0,0x83,0xCC), rgb_t(0xF1,0x94,0xDD), \ - rgb_t(0xFF,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) - -define NTSC_PURPLE_BLUE - rgb_t(0x23,0x00,0x55), rgb_t(0x34,0x00,0x61), rgb_t(0x45,0x00,0x6D), rgb_t(0x56,0x0F,0x7E), \ - rgb_t(0x67,0x20,0x8F), rgb_t(0x78,0x31,0xA0), rgb_t(0x89,0x42,0xB1), rgb_t(0x9A,0x53,0xC2), \ - rgb_t(0xAB,0x64,0xD3), rgb_t(0xBC,0x75,0xE4), rgb_t(0xCD,0x86,0xEA), rgb_t(0xDE,0x97,0xEA), \ - rgb_t(0xEF,0xA8,0xEA), rgb_t(0xFF,0xB9,0xEA), rgb_t(0xFF,0xCA,0xEF), rgb_t(0xFF,0xDB,0xF4 ) - -define NTSC_BLUE1 - rgb_t(0x09,0x00,0x6E), rgb_t(0x1A,0x00,0x7A), rgb_t(0x2B,0x08,0x88), rgb_t(0x3C,0x19,0x99), \ - rgb_t(0x4D,0x2A,0xAA), rgb_t(0x5E,0x3B,0xBB), rgb_t(0x6F,0x4C,0xCC), rgb_t(0x80,0x5D,0xDD), \ - rgb_t(0x91,0x6E,0xEE), rgb_t(0xA2,0x7F,0xF4), rgb_t(0xB3,0x90,0xF4), rgb_t(0xC4,0xA1,0xF4), \ - rgb_t(0xD5,0xB2,0xF4), rgb_t(0xE6,0xC3,0xF4), rgb_t(0xF7,0xD4,0xF4), rgb_t(0xFF,0xE5,0xF7 ) - -define NTSC_BLUE2 - rgb_t(0x00,0x00,0x6D), rgb_t(0x00,0x05,0x80), rgb_t(0x10,0x16,0x91), rgb_t(0x21,0x27,0xA2), \ - rgb_t(0x32,0x38,0xB3), rgb_t(0x43,0x49,0xC4), rgb_t(0x54,0x5A,0xD5), rgb_t(0x65,0x6B,0xE6), \ - rgb_t(0x76,0x7C,0xF7), rgb_t(0x87,0x8D,0xFF), rgb_t(0x98,0x9E,0xFF), rgb_t(0xA9,0xAF,0xFF), \ - rgb_t(0xBA,0xC0,0xFF), rgb_t(0xCB,0xD1,0xFF), rgb_t(0xDC,0xE2,0xFF), rgb_t(0xED,0xF3,0xFF ) - -define NTSC_LIGHT_BLUE - rgb_t(0x00,0x05,0x57), rgb_t(0x00,0x16,0x6E), rgb_t(0x00,0x27,0x84), rgb_t(0x09,0x38,0x97), \ - rgb_t(0x1A,0x49,0xA8), rgb_t(0x2B,0x5A,0xB9), rgb_t(0x3C,0x6B,0xCA), rgb_t(0x4D,0x7C,0xDB), \ - rgb_t(0x5E,0x8D,0xEC), rgb_t(0x6F,0x9E,0xFD), rgb_t(0x80,0xAF,0xFF), rgb_t(0x91,0xC0,0xFF), \ - rgb_t(0xA2,0xD1,0xFF), rgb_t(0xB3,0xE2,0xFF), rgb_t(0xC4,0xF3,0xFF), rgb_t(0xD5,0xFF,0xFF ) - -define NTSC_TURQUOISE - rgb_t(0x00,0x15,0x34), rgb_t(0x00,0x26,0x4A), rgb_t(0x00,0x37,0x60), rgb_t(0x00,0x48,0x77), \ - rgb_t(0x0A,0x59,0x8A), rgb_t(0x1B,0x6A,0x9B), rgb_t(0x2C,0x7B,0xAC), rgb_t(0x3D,0x8C,0xBD), \ - rgb_t(0x4E,0x9D,0xCE), rgb_t(0x5F,0xAE,0xDF), rgb_t(0x70,0xBF,0xF0), rgb_t(0x81,0xD0,0xFF), \ - rgb_t(0x92,0xE1,0xFF), rgb_t(0xA3,0xF2,0xFF), rgb_t(0xB4,0xFF,0xFF), rgb_t(0xC5,0xFF,0xFF ) - -define NTSC_GREEN_BLUE - rgb_t(0x00,0x21,0x0A), rgb_t(0x00,0x32,0x1F), rgb_t(0x00,0x43,0x35), rgb_t(0x00,0x54,0x4B), \ - rgb_t(0x04,0x65,0x60), rgb_t(0x15,0x76,0x71), rgb_t(0x26,0x87,0x82), rgb_t(0x37,0x98,0x93), \ - rgb_t(0x48,0xA9,0xA4), rgb_t(0x59,0xBA,0xB5), rgb_t(0x6A,0xCB,0xC6), rgb_t(0x7B,0xDC,0xD7), \ - rgb_t(0x8C,0xED,0xE8), rgb_t(0x9D,0xFE,0xF9), rgb_t(0xAE,0xFF,0xFF), rgb_t(0xBF,0xFF,0xFF ) - -define NTSC_GREEN - rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1D), \ - rgb_t(0x0A,0x6B,0x30), rgb_t(0x1B,0x7C,0x41), rgb_t(0x2C,0x8D,0x52), rgb_t(0x3D,0x9E,0x63), \ - rgb_t(0x4E,0xAF,0x74), rgb_t(0x5F,0xC0,0x85), rgb_t(0x70,0xD1,0x96), rgb_t(0x81,0xE2,0xA7), \ - rgb_t(0x92,0xF3,0xB8), rgb_t(0xA3,0xFF,0xC8), rgb_t(0xB4,0xFF,0xD3), rgb_t(0xC5,0xFF,0xDF ) - -define NTSC_YELLOW_GREEN - rgb_t(0x00,0x26,0x0B), rgb_t(0x00,0x37,0x10), rgb_t(0x00,0x48,0x16), rgb_t(0x0A,0x59,0x18), \ - rgb_t(0x1B,0x6A,0x18), rgb_t(0x2C,0x7B,0x18), rgb_t(0x3D,0x8C,0x27), rgb_t(0x4E,0x9D,0x38), \ - rgb_t(0x5F,0xAE,0x49), rgb_t(0x70,0xBF,0x5A), rgb_t(0x81,0xD0,0x6B), rgb_t(0x92,0xE1,0x7C), \ - rgb_t(0xA3,0xF2,0x8D), rgb_t(0xB4,0xFF,0x9C), rgb_t(0xC5,0xFF,0xA8), rgb_t(0xD6,0xFF,0xB4 ) - -define NTSC_ORANGE_GREEN - rgb_t(0x00,0x1E,0x09), rgb_t(0x00,0x2F,0x0E), rgb_t(0x11,0x40,0x0E), rgb_t(0x22,0x51,0x0E), \ - rgb_t(0x33,0x62,0x0E), rgb_t(0x44,0x73,0x0E), rgb_t(0x55,0x84,0x0E), rgb_t(0x66,0x95,0x17), \ - rgb_t(0x77,0xA6,0x28), rgb_t(0x88,0xB7,0x39), rgb_t(0x99,0xC8,0x4A), rgb_t(0xAA,0xD9,0x5B), \ - rgb_t(0xBB,0xEA,0x6C), rgb_t(0xCC,0xFB,0x7D), rgb_t(0xDD,0xFF,0x8A), rgb_t(0xEE,0xFF,0x96 ) - -define NTSC_LIGHT_ORANGE - rgb_t(0x0A,0x11,0x02), rgb_t(0x1B,0x22,0x02), rgb_t(0x2C,0x33,0x02), rgb_t(0x3D,0x44,0x02), \ - rgb_t(0x4E,0x55,0x02), rgb_t(0x5F,0x66,0x02), rgb_t(0x70,0x77,0x02), rgb_t(0x81,0x88,0x09), \ - rgb_t(0x92,0x99,0x1A), rgb_t(0xA3,0xAA,0x2B), rgb_t(0xB4,0xBB,0x3C), rgb_t(0xC5,0xCC,0x4D), \ - rgb_t(0xD6,0xDD,0x5E), rgb_t(0xE7,0xEE,0x6F), rgb_t(0xF8,0xFF,0x80), rgb_t(0xFF,0xFF,0x8F ) -***************************************************************************/ - - -/*************************************************************************** - PALETTE - 25.2 PHASE SHIFT - - -define NTSC_GREY - rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ - rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ - rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ - rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) - -define NTSC_GOLD - rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ - rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ - rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ - rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) - -define NTSC_ORANGE - rgb_t(0x30,0x00,0x00), rgb_t(0x41,0x07,0x00), rgb_t(0x52,0x18,0x00), rgb_t(0x63,0x29,0x00), \ - rgb_t(0x74,0x3A,0x00), rgb_t(0x85,0x4B,0x00), rgb_t(0x96,0x5C,0x0A), rgb_t(0xA7,0x6D,0x1B), \ - rgb_t(0xB8,0x7E,0x2C), rgb_t(0xC9,0x8F,0x3D), rgb_t(0xDA,0xA0,0x4E), rgb_t(0xEB,0xB1,0x5F), \ - rgb_t(0xFC,0xC2,0x70), rgb_t(0xFF,0xD3,0x85), rgb_t(0xFF,0xE4,0x9B), rgb_t(0xFF,0xF5,0xB1 ) - -define NTSC_RED_ORANGE - rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x09,0x00), rgb_t(0x71,0x1A,0x00), \ - rgb_t(0x82,0x2B,0x0B), rgb_t(0x93,0x3C,0x1C), rgb_t(0xA4,0x4D,0x2D), rgb_t(0xB5,0x5E,0x3E), \ - rgb_t(0xC6,0x6F,0x4F), rgb_t(0xD7,0x80,0x60), rgb_t(0xE8,0x91,0x71), rgb_t(0xF9,0xA2,0x82), \ - rgb_t(0xFF,0xB3,0x96), rgb_t(0xFF,0xC4,0xAC), rgb_t(0xFF,0xD5,0xC2), rgb_t(0xFF,0xE6,0xD8 ) - -define NTSC_PINK - rgb_t(0x3F,0x00,0x00), rgb_t(0x50,0x00,0x0C), rgb_t(0x61,0x00,0x18), rgb_t(0x72,0x0F,0x28), \ - rgb_t(0x83,0x20,0x39), rgb_t(0x94,0x31,0x4A), rgb_t(0xA5,0x42,0x5B), rgb_t(0xB6,0x53,0x6C), \ - rgb_t(0xC7,0x64,0x7D), rgb_t(0xD8,0x75,0x8E), rgb_t(0xE9,0x86,0x9F), rgb_t(0xFA,0x97,0xB0), \ - rgb_t(0xFF,0xA8,0xC5), rgb_t(0xFF,0xB9,0xDB), rgb_t(0xFF,0xCA,0xEF), rgb_t(0xFF,0xDB,0xF4 ) - -define NTSC_PURPLE - rgb_t(0x35,0x00,0x31), rgb_t(0x46,0x00,0x3D), rgb_t(0x57,0x00,0x49), rgb_t(0x68,0x0C,0x58), \ - rgb_t(0x79,0x1D,0x69), rgb_t(0x8A,0x2E,0x7A), rgb_t(0x9B,0x3F,0x8B), rgb_t(0xAC,0x50,0x9C), \ - rgb_t(0xBD,0x61,0xAD), rgb_t(0xCE,0x72,0xBE), rgb_t(0xDF,0x83,0xCF), rgb_t(0xF0,0x94,0xE0), \ - rgb_t(0xFF,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) - -define NTSC_PURPLE_BLUE - rgb_t(0x20,0x00,0x59), rgb_t(0x31,0x00,0x65), rgb_t(0x42,0x00,0x71), rgb_t(0x53,0x10,0x82), \ - rgb_t(0x64,0x21,0x93), rgb_t(0x75,0x32,0xA4), rgb_t(0x86,0x43,0xB5), rgb_t(0x97,0x54,0xC6), \ - rgb_t(0xA8,0x65,0xD7), rgb_t(0xB9,0x76,0xE8), rgb_t(0xCA,0x87,0xEB), rgb_t(0xDB,0x98,0xEB), \ - rgb_t(0xEC,0xA9,0xEB), rgb_t(0xFD,0xBA,0xEB), rgb_t(0xFF,0xCB,0xEF), rgb_t(0xFF,0xDC,0xF4 ) - -define NTSC_BLUE1 - rgb_t(0x05,0x00,0x70), rgb_t(0x16,0x00,0x7C), rgb_t(0x27,0x09,0x8B), rgb_t(0x38,0x1A,0x9C), \ - rgb_t(0x49,0x2B,0xAD), rgb_t(0x5A,0x3C,0xBE), rgb_t(0x6B,0x4D,0xCF), rgb_t(0x7C,0x5E,0xE0), \ - rgb_t(0X8D,0x6F,0xF1), rgb_t(0x9E,0x80,0xF6), rgb_t(0xAF,0x91,0xF6), rgb_t(0xC0,0xA2,0xF6), \ - rgb_t(0xD1,0xB3,0xF6), rgb_t(0xE2,0xC4,0xF6), rgb_t(0xF3,0xD5,0xF6), rgb_t(0xFF,0xE6,0xF7 ) - -define NTSC_BLUE2 - rgb_t(0x00,0x00,0x6B), rgb_t(0x00,0x08,0x7E), rgb_t(0x0C,0x19,0x91), rgb_t(0x1D,0x2A,0xA2), \ - rgb_t(0x2E,0x3B,0xB3), rgb_t(0x3F,0x4C,0xC4), rgb_t(0x50,0x5D,0xD5), rgb_t(0x61,0x6E,0xE6), \ - rgb_t(0x72,0x7F,0xF7), rgb_t(0x83,0x90,0xFF), rgb_t(0x94,0xA1,0xFF), rgb_t(0xA5,0xB2,0xFF), \ - rgb_t(0xB6,0xC3,0xFF), rgb_t(0xC7,0xD4,0xFF), rgb_t(0xD8,0xE5,0xFF), rgb_t(0xE9,0xF6,0xFF ) - -define NTSC_LIGHT_BLUE - rgb_t(0x00,0x08,0x52), rgb_t(0x00,0x19,0x68), rgb_t(0x00,0x2A,0x7F), rgb_t(0x05,0x3B,0x93), \ - rgb_t(0x16,0x4C,0xA4), rgb_t(0x27,0x5D,0xB5), rgb_t(0x38,0x6E,0xC6), rgb_t(0x49,0x7F,0xD7), \ - rgb_t(0x5A,0x90,0xE8), rgb_t(0x6B,0xA1,0xF9), rgb_t(0x7C,0xB2,0xFF), rgb_t(0x8D,0xC3,0xFF), \ - rgb_t(0x9E,0xD4,0xFF), rgb_t(0xAF,0xE5,0xFF), rgb_t(0xC0,0xF6,0xFF), rgb_t(0xD1,0xFF,0xFF ) - -define NTSC_TURQUOISE - rgb_t(0x00,0x17,0x2D), rgb_t(0x00,0x28,0x43), rgb_t(0x00,0x39,0x59), rgb_t(0x00,0x4A,0x6F), \ - rgb_t(0x08,0x5B,0x83), rgb_t(0x19,0x6C,0x94), rgb_t(0x2A,0x7D,0xA5), rgb_t(0x3B,0x8E,0xB6), \ - rgb_t(0x4C,0x9F,0xC7), rgb_t(0x5D,0xB0,0xD8), rgb_t(0x6E,0xC1,0xE9), rgb_t(0x7F,0xD2,0xFA), \ - rgb_t(0x90,0xE3,0xFF), rgb_t(0xA1,0xF4,0xFF), rgb_t(0xB2,0xFF,0xFF), rgb_t(0xC3,0xFF,0xFF ) - -define NTSC_GREEN_BLUE - rgb_t(0x00,0x23,0x0A), rgb_t(0x00,0x34,0x15), rgb_t(0x00,0x45,0x2B), rgb_t(0x00,0x56,0x41), \ - rgb_t(0x04,0x67,0x56), rgb_t(0x15,0x78,0x67), rgb_t(0x26,0x89,0x78), rgb_t(0x37,0x9A,0x89), \ - rgb_t(0x48,0xAB,0x9A), rgb_t(0x59,0xBC,0xAB), rgb_t(0x6A,0xCD,0xBC), rgb_t(0x7B,0xDE,0xCD), \ - rgb_t(0x8C,0xEF,0xDE), rgb_t(0x9D,0xFF,0xEE), rgb_t(0xAE,0xFF,0xFA), rgb_t(0xBF,0xFF,0xFF ) - -define NTSC_GREEN - rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1B), \ - rgb_t(0x0D,0x6B,0x25), rgb_t(0x1E,0x7C,0x36), rgb_t(0x2F,0x8D,0x47), rgb_t(0x40,0x9E,0x58), \ - rgb_t(0x51,0xAF,0x69), rgb_t(0x62,0xC0,0x7A), rgb_t(0x73,0xD1,0x8B), rgb_t(0x84,0xE2,0x9C), \ - rgb_t(0x95,0xF3,0xAD), rgb_t(0xA6,0xFF,0xBD), rgb_t(0xB7,0xFF,0xC9), rgb_t(0xC8,0xFF,0xD4 ) - -define NTSC_YELLOW_GREEN - rgb_t(0x00,0x24,0x0B), rgb_t(0x00,0x35,0x10), rgb_t(0x00,0x46,0x15), rgb_t(0x10,0x57,0x15), \ - rgb_t(0x21,0x68,0x15), rgb_t(0x32,0x79,0x15), rgb_t(0x43,0x8A,0x1C), rgb_t(0x54,0x9B,0x2D), \ - rgb_t(0x65,0xAC,0x3E), rgb_t(0x76,0xBD,0x4F), rgb_t(0x87,0xCE,0x60), rgb_t(0x98,0xDF,0x71), \ - rgb_t(0xA9,0xF0,0x82), rgb_t(0xBA,0xFF,0x93), rgb_t(0xCB,0xFF,0x9F), rgb_t(0xDC,0xFF,0xAA ) - -define NTSC_ORANGE_GREEN - rgb_t(0x00,0x1B,0x08), rgb_t(0x08,0x2C,0x0B), rgb_t(0x19,0x3D,0x0B), rgb_t(0x2A,0x4E,0x0B), \ - rgb_t(0x3B,0x5F,0x0B), rgb_t(0x4C,0x70,0x0B), rgb_t(0x5D,0x81,0x0B), rgb_t(0x6E,0x92,0x11), \ - rgb_t(0x7F,0xA3,0x22), rgb_t(0x90,0xB4,0x33), rgb_t(0xA1,0xC5,0x44), rgb_t(0xB2,0xD6,0x55), \ - rgb_t(0xC3,0xE7,0x66), rgb_t(0xD4,0xF8,0x77), rgb_t(0xE5,0xFF,0x85), rgb_t(0xF6,0xFF,0x91 ) - -define NTSC_LIGHT_ORANGE - rgb_t(0x12,0x0C,0x00), rgb_t(0x23,0x1D,0x00), rgb_t(0x34,0x2E,0x00), rgb_t(0x45,0x3F,0x00), \ - rgb_t(0x56,0x50,0x00), rgb_t(0x67,0x61,0x00), rgb_t(0x78,0x72,0x00), rgb_t(0x89,0x83,0x08), \ - rgb_t(0x9A,0x94,0x19), rgb_t(0xAB,0xA5,0x2A), rgb_t(0xBC,0xB6,0x3B), rgb_t(0xCD,0xC7,0x4C), \ - rgb_t(0xDE,0xD8,0x5D), rgb_t(0xEF,0xE9,0x6E), rgb_t(0xFF,0xFA,0x80), rgb_t(0xFF,0xFF,0x92 ) -***************************************************************************/ - - -/*************************************************************************** - PALETTE - 25.7 PHASE SHIFT - - -define NTSC_GREY - rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ - rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ - rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ - rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) - -define NTSC_GOLD - rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ - rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ - rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ - rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) - -define NTSC_ORANGE - rgb_t(0x31,0x00,0x00), rgb_t(0x42,0x06,0x00), rgb_t(0x53,0x17,0x00), rgb_t(0x64,0x28,0x00), \ - rgb_t(0x75,0x39,0x00), rgb_t(0x86,0X4A,0x00), rgb_t(0x97,0x5B,0x0A), rgb_t(0xA8,0x6C,0x1B), \ - rgb_t(0xB9,0x7D,0x2C), rgb_t(0xCA,0x8E,0x3D), rgb_t(0xDB,0x9F,0x4E), rgb_t(0xEC,0xB0,0x5F), \ - rgb_t(0xFD,0xC1,0x70), rgb_t(0xFF,0xD2,0x85), rgb_t(0xFF,0xE3,0x9C), rgb_t(0xFF,0xF4,0xB2 ) - -define NTSC_RED_ORANGE - rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x08,0x00), rgb_t(0x71,0x19,0x00), \ - rgb_t(0x82,0x2A,0x0D), rgb_t(0x93,0x3B,0x1E), rgb_t(0xA4,0x4C,0x2F), rgb_t(0xB5,0x5D,0x40), \ - rgb_t(0xC6,0x6E,0x51), rgb_t(0xD7,0x7F,0x62), rgb_t(0xE8,0x90,0x73), rgb_t(0xF9,0xA1,0x83), \ - rgb_t(0xFF,0xB2,0x98), rgb_t(0xFF,0xC3,0xAE), rgb_t(0xFF,0xD4,0xC4), rgb_t(0xFF,0xE5,0xDA ) - -define NTSC_PINK - rgb_t(0x3F,0x00,0x03), rgb_t(0x50,0x00,0x0F), rgb_t(0x61,0x00,0x1B), rgb_t(0x72,0x0F,0x2B), \ - rgb_t(0x83,0x20,0x3C), rgb_t(0x94,0x31,0x4D), rgb_t(0xA5,0x42,0x5E), rgb_t(0xB6,0x53,0x6F), \ - rgb_t(0xC7,0x64,0x80), rgb_t(0xD8,0x75,0x91), rgb_t(0xE9,0x86,0xA2), rgb_t(0xFA,0x97,0xB3), \ - rgb_t(0xFF,0xA8,0xC8), rgb_t(0xFF,0xB9,0xDE), rgb_t(0xFF,0xCA,0xEF), rgb_t(0xFF,0xDB,0xF4 ) - -define NTSC_PURPLE - rgb_t(0x33,0x00,0x35), rgb_t(0x44,0x00,0x41), rgb_t(0x55,0x00,0x4C), rgb_t(0x66,0x0C,0x5C), \ - rgb_t(0x77,0x1D,0x6D), rgb_t(0x88,0x2E,0x7E), rgb_t(0x99,0x3F,0x8F), rgb_t(0xAA,0x50,0xA0), \ - rgb_t(0xBB,0x61,0xB1), rgb_t(0xCC,0x72,0xC2), rgb_t(0xDD,0x83,0xD3), rgb_t(0xEE,0x94,0xE4), \ - rgb_t(0xFF,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) - -define NTSC_PURPLE_BLUE - rgb_t(0x1D,0x00,0x5C), rgb_t(0x2E,0x00,0x68), rgb_t(0x40,0x00,0x74), rgb_t(0x51,0x10,0x84), \ - rgb_t(0x62,0x21,0x95), rgb_t(0x73,0x32,0xA6), rgb_t(0x84,0x43,0xB7), rgb_t(0x95,0x54,0xC8), \ - rgb_t(0xA6,0x65,0xD9), rgb_t(0xB7,0x76,0xEA), rgb_t(0xC8,0x87,0xEB), rgb_t(0xD9,0x98,0xEB), \ - rgb_t(0xE9,0xA9,0xEC), rgb_t(0xFB,0xBA,0xEB), rgb_t(0xFF,0xCB,0xEF), rgb_t(0xFF,0xDC,0xF4 ) - -define NTSC_BLUE1 - rgb_t(0x02,0x00,0x71), rgb_t(0x13,0x00,0x7D), rgb_t(0x24,0x0B,0x8C), rgb_t(0x35,0x1C,0x9D), \ - rgb_t(0x46,0x2D,0xAE), rgb_t(0x57,0x3E,0xBF), rgb_t(0x68,0x4F,0xD0), rgb_t(0x79,0x60,0xE1), \ - rgb_t(0x8A,0x71,0xF2), rgb_t(0x9B,0x82,0xF7), rgb_t(0xAC,0x93,0xF7), rgb_t(0xBD,0xA4,0xF7), \ - rgb_t(0xCE,0xB5,0xF7), rgb_t(0xDF,0xC6,0xF7), rgb_t(0xF0,0xD7,0xF7), rgb_t(0xFF,0xE8,0xF8 ) - -define NTSC_BLUE2 - rgb_t(0x00,0x00,0x68), rgb_t(0x00,0x0A,0x7C), rgb_t(0x08,0x1B,0x90), rgb_t(0x19,0x2C,0xA1), \ - rgb_t(0x2A,0x3D,0xB2), rgb_t(0x3B,0x4E,0xC3), rgb_t(0x4C,0x5F,0xD4), rgb_t(0x5D,0x70,0xE5), \ - rgb_t(0x6E,0x81,0xF6), rgb_t(0x7F,0x92,0xFF), rgb_t(0x90,0xA3,0xFF), rgb_t(0xA1,0xB4,0xFF), \ - rgb_t(0xB2,0xC5,0xFF), rgb_t(0xC3,0xD6,0xFF), rgb_t(0xD4,0xE7,0xFF), rgb_t(0xE5,0xF8,0xFF ) - -define NTSC_LIGHT_BLUE - rgb_t(0x00,0x0A,0x4D), rgb_t(0x00,0x1B,0x63), rgb_t(0x00,0x2C,0x79), rgb_t(0x02,0x3D,0x8F), \ - rgb_t(0x13,0x4E,0xA0), rgb_t(0x24,0x5F,0xB1), rgb_t(0x35,0x70,0xC2), rgb_t(0x46,0x81,0xD3), \ - rgb_t(0x57,0x92,0xE4), rgb_t(0x68,0xA3,0xF5), rgb_t(0x79,0xB4,0xFF), rgb_t(0x8A,0xC5,0xFF), \ - rgb_t(0x9B,0xD6,0xFF), rgb_t(0xAC,0xE7,0xFF), rgb_t(0xBD,0xF8,0xFF), rgb_t(0xCE,0xFF,0xFF ) - -define NTSC_TURQUOISE - rgb_t(0x00,0x1A,0x26), rgb_t(0x00,0x2B,0x3C), rgb_t(0x00,0x3C,0x52), rgb_t(0x00,0x4D,0x68), \ - rgb_t(0x06,0x5E,0x7C), rgb_t(0x17,0x6F,0x8D), rgb_t(0x28,0x80,0x9E), rgb_t(0x39,0x91,0xAF), \ - rgb_t(0x4A,0xA2,0xC0), rgb_t(0x5B,0xB3,0xD1), rgb_t(0x6C,0xC4,0xE2), rgb_t(0x7D,0xD5,0xF3), \ - rgb_t(0x8E,0xE6,0xFF), rgb_t(0x9F,0xF7,0xFF), rgb_t(0xB0,0xFF,0xFF), rgb_t(0xC1,0xFF,0xFF ) - -define NTSC_GREEN_BLUE - rgb_t(0x00,0x24,0x0B), rgb_t(0x00,0x35,0x10), rgb_t(0x00,0x46,0x22), rgb_t(0x00,0x57,0x38), \ - rgb_t(0x05,0x68,0x4D), rgb_t(0x16,0x79,0x5E), rgb_t(0x27,0x8A,0x6F), rgb_t(0x38,0x9B,0x80), \ - rgb_t(0x49,0xAC,0x91), rgb_t(0x5A,0xBD,0xA2), rgb_t(0x6B,0xCE,0xB3), rgb_t(0x7C,0xDF,0xC4), \ - rgb_t(0x8D,0xF0,0xD5), rgb_t(0x9E,0xFF,0xE5), rgb_t(0xAF,0xFF,0xF1), rgb_t(0xC0,0xFF,0xFD ) - -define NTSC_GREEN - rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1B), \ - rgb_t(0x10,0x6B,0x1B), rgb_t(0x21,0x7C,0x2C), rgb_t(0x32,0x8D,0x3D), rgb_t(0x43,0x9E,0x4E), \ - rgb_t(0x54,0xAF,0x5F), rgb_t(0x65,0xC0,0x70), rgb_t(0x76,0xD1,0x81), rgb_t(0x87,0xE2,0x92), \ - rgb_t(0x98,0xF3,0xA3), rgb_t(0xA9,0xFF,0xB3), rgb_t(0xBA,0xFF,0xBF), rgb_t(0xCB,0xFF,0xCB ) - -define NTSC_YELLOW_GREEN - rgb_t(0x00,0x23,0x0A), rgb_t(0x00,0x34,0x10), rgb_t(0x04,0x45,0x13), rgb_t(0x15,0x56,0x13), \ - rgb_t(0x26,0x67,0x13), rgb_t(0x37,0x78,0x13), rgb_t(0x48,0x89,0x14), rgb_t(0x59,0x9A,0x25), \ - rgb_t(0x6A,0xAB,0x36), rgb_t(0x7B,0xBC,0x47), rgb_t(0x8C,0xCD,0x58), rgb_t(0x9D,0xDE,0x69), \ - rgb_t(0xAE,0xEF,0x7A), rgb_t(0xBF,0xFF,0x8B), rgb_t(0xD0,0xFF,0x97), rgb_t(0xE1,0xFF,0xA3 ) - -define NTSC_ORANGE_GREEN - rgb_t(0x00,0x17,0x07), rgb_t(0x0E,0x28,0x08), rgb_t(0x1F,0x39,0x08), rgb_t(0x30,0x4A,0x08), \ - rgb_t(0x41,0x5B,0x08), rgb_t(0x52,0x6C,0x08), rgb_t(0x63,0x7D,0x08), rgb_t(0x74,0x8E,0x0D), \ - rgb_t(0x85,0x9F,0x1E), rgb_t(0x96,0xB0,0x2F), rgb_t(0xA7,0xC1,0x40), rgb_t(0xB8,0xD2,0x51), \ - rgb_t(0xC9,0xE3,0x62), rgb_t(0xDA,0xF4,0x73), rgb_t(0xEB,0xFF,0x82), rgb_t(0xFC,0xFF,0x8E ) - -define NTSC_LIGHT_ORANGE - rgb_t(0x19,0x07,0x00), rgb_t(0x2A,0x18,0x00), rgb_t(0x3B,0x29,0x00), rgb_t(0x4C,0x3A,0x00), \ - rgb_t(0x5D,0x4B,0x00), rgb_t(0x6E,0x5C,0x00), rgb_t(0x7F,0x6D,0x00), rgb_t(0x90,0x7E,0x09), \ - rgb_t(0xA1,0x8F,0x1A), rgb_t(0xB2,0xA0,0x2B), rgb_t(0xC3,0xB1,0x3C), rgb_t(0xD4,0xC2,0x4D), \ - rgb_t(0xE5,0xD3,0x5E), rgb_t(0xF6,0xE4,0x6F), rgb_t(0xFF,0xF5,0x82), rgb_t(0xFF,0xFF,0x96 ) -***************************************************************************/ - - -/*************************************************************************** - PALETTE - 26.2 PHASE SHIFT - - -#define NTSC_GREY \ - rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ - rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ - rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ - rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) - -#define NTSC_GOLD \ - rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ - rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ - rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ - rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) - -#define NTSC_ORANGE \ - rgb_t(0x31,0x00,0x00), rgb_t(0x42,0x06,0x00), rgb_t(0x53,0x17,0x00), rgb_t(0x64,0x28,0x00), \ - rgb_t(0x75,0x39,0x00), rgb_t(0x86,0X4A,0x00), rgb_t(0x97,0x5B,0x0B), rgb_t(0xA8,0x6C,0x1C), \ - rgb_t(0xB9,0x7D,0x2D), rgb_t(0xCA,0x8E,0x3E), rgb_t(0xDB,0x9F,0x4F), rgb_t(0xEC,0xB0,0x60), \ - rgb_t(0xFD,0xC1,0x71), rgb_t(0xFF,0xD2,0x86), rgb_t(0xFF,0xE3,0x9D), rgb_t(0xFF,0xF4,0xB3 ) - -#define NTSC_RED_ORANGE \ - rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x08,0x00), rgb_t(0x71,0x19,0x00), \ - rgb_t(0x82,0x2A,0x0F), rgb_t(0x93,0x3B,0x20), rgb_t(0xA4,0x4C,0x31), rgb_t(0xB5,0x5D,0x42), \ - rgb_t(0xC6,0x6E,0x53), rgb_t(0xD7,0x7F,0x64), rgb_t(0xE8,0x90,0x75), rgb_t(0xF9,0xA1,0x86), \ - rgb_t(0xFF,0xB2,0x9A), rgb_t(0xFF,0xC3,0xB0), rgb_t(0xFF,0xD4,0xC6), rgb_t(0xFF,0xE5,0xDC ) - -#define NTSC_PINK \ - rgb_t(0x3E,0x00,0x06), rgb_t(0x4F,0x00,0x12), rgb_t(0x60,0x00,0x1E), rgb_t(0x71,0x0E,0x2E), \ - rgb_t(0x82,0x1F,0x3F), rgb_t(0x93,0x30,0x50), rgb_t(0xA4,0x41,0x61), rgb_t(0xB5,0x52,0x72), \ - rgb_t(0xC6,0x63,0x83), rgb_t(0xD7,0x74,0x94), rgb_t(0xE8,0x85,0xA5), rgb_t(0xF9,0x96,0xB6), \ - rgb_t(0xFF,0xA7,0xCB), rgb_t(0xFF,0xB8,0xE1), rgb_t(0xFF,0xC9,0xEF), rgb_t(0xFF,0xDA,0xF4 ) - -#define NTSC_PURPLE \ - rgb_t(0x32,0x00,0x38), rgb_t(0x43,0x00,0x44), rgb_t(0x54,0x00,0x50), rgb_t(0x65,0x0C,0x5F), \ - rgb_t(0x76,0x1D,0x70), rgb_t(0x87,0x2E,0x81), rgb_t(0x98,0x3F,0x92), rgb_t(0xA9,0x50,0xA3), \ - rgb_t(0xBA,0x61,0xB4), rgb_t(0xCB,0x72,0xC5), rgb_t(0xDC,0x83,0xD6), rgb_t(0xED,0x94,0xE4), \ - rgb_t(0xFE,0xA5,0xE4), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) - -#define NTSC_PURPLE_BLUE \ - rgb_t(0x1B,0x00,0x5F), rgb_t(0x2C,0x00,0x6B), rgb_t(0x3D,0x00,0x77), rgb_t(0x4E,0x11,0x88), \ - rgb_t(0x5F,0x22,0x99), rgb_t(0x70,0x33,0xAA), rgb_t(0x81,0x44,0xBB), rgb_t(0x92,0x55,0xCC), \ - rgb_t(0xA3,0x66,0xDD), rgb_t(0xB4,0x77,0xED), rgb_t(0xC5,0x88,0xED), rgb_t(0xD6,0x99,0xED), \ - rgb_t(0xE7,0xAA,0xED), rgb_t(0xF8,0xBB,0xED), rgb_t(0xFF,0xCC,0xF0), rgb_t(0xFF,0xDD,0xF5 ) - -#define NTSC_BLUE1 \ - rgb_t(0x00,0x00,0x72), rgb_t(0x10,0x00,0x7E), rgb_t(0x21,0x0D,0x8E), rgb_t(0x32,0x1E,0x9F), \ - rgb_t(0x43,0x2F,0xB0), rgb_t(0x54,0x40,0xC1), rgb_t(0x65,0x51,0xD2), rgb_t(0x76,0x62,0xE3), \ - rgb_t(0x87,0x73,0xF4), rgb_t(0x98,0x84,0xF9), rgb_t(0xA9,0x95,0xF9), rgb_t(0xBA,0xA6,0xF9), \ - rgb_t(0xCB,0xB7,0xF9), rgb_t(0xDC,0xC8,0xF9), rgb_t(0xED,0xD9,0xF9), rgb_t(0xFE,0xEA,0xF9 ) - -#define NTSC_BLUE2 \ - rgb_t(0x00,0x00,0x65), rgb_t(0x00,0x0C,0x7A), rgb_t(0x05,0x1D,0x8E), rgb_t(0x16,0x2E,0x9F), \ - rgb_t(0x27,0x3F,0xB0), rgb_t(0x38,0x50,0xC1), rgb_t(0x49,0x61,0xD2), rgb_t(0x5A,0x72,0xE3), \ - rgb_t(0x6B,0x83,0xF4), rgb_t(0x7C,0x94,0xFF), rgb_t(0x8D,0xA5,0xFF), rgb_t(0x9E,0xB6,0xFF), \ - rgb_t(0xAF,0xC7,0xFF), rgb_t(0xC0,0xD8,0xFF), rgb_t(0xD1,0xE9,0xFF), rgb_t(0xE2,0xFA,0xFF ) - -#define NTSC_LIGHT_BLUE \ - rgb_t(0x00,0x0D,0x48), rgb_t(0x00,0x1E,0x5E), rgb_t(0x00,0x2F,0x74), rgb_t(0x00,0x40,0x8A), \ - rgb_t(0x11,0x51,0x9B), rgb_t(0x22,0x62,0xAC), rgb_t(0x33,0x73,0xBD), rgb_t(0x44,0x84,0xCE), \ - rgb_t(0x55,0x95,0xDF), rgb_t(0x66,0xA6,0xF0), rgb_t(0x77,0xB7,0xFF), rgb_t(0x88,0xC8,0xFF), \ - rgb_t(0x99,0xD9,0xFF), rgb_t(0xAA,0xEA,0xFF), rgb_t(0xBB,0xFB,0xFF), rgb_t(0xCC,0xFF,0xFF ) - -#define NTSC_TURQUOISE \ - rgb_t(0x00,0x1C,0x1C), rgb_t(0x00,0x2D,0x32), rgb_t(0x00,0x3E,0x49), rgb_t(0x00,0x4F,0x5F), \ - rgb_t(0x05,0x60,0x73), rgb_t(0x16,0x71,0x84), rgb_t(0x27,0x82,0x95), rgb_t(0x38,0x93,0xA6), \ - rgb_t(0x49,0xA4,0xB7), rgb_t(0x5A,0xB5,0xC8), rgb_t(0x6B,0xC6,0xD9), rgb_t(0x7C,0xD7,0xEA), \ - rgb_t(0x8D,0xE8,0xFB), rgb_t(0x9E,0xF9,0xFF), rgb_t(0xAF,0xFF,0xFF), rgb_t(0xC0,0xFF,0xFF ) - -#define NTSC_GREEN_BLUE \ - rgb_t(0x00,0x25,0x0B), rgb_t(0x00,0x36,0x10), rgb_t(0x00,0x47,0x18), rgb_t(0x00,0x58,0x2E), \ - rgb_t(0x07,0x69,0x42), rgb_t(0x18,0x7A,0x53), rgb_t(0x29,0x8B,0x64), rgb_t(0x3A,0x9C,0x75), \ - rgb_t(0x4B,0xAD,0x86), rgb_t(0x5C,0xBE,0x97), rgb_t(0x6D,0xCF,0xA8), rgb_t(0x7E,0xE0,0xB9), \ - rgb_t(0x8F,0xF1,0xCA), rgb_t(0xA0,0xFF,0xDA), rgb_t(0xB1,0xFF,0xE6), rgb_t(0xC2,0xFF,0xF2 ) - -#define NTSC_GREEN \ - rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x04,0x5A,0x1A), \ - rgb_t(0x15,0x6B,0x1A), rgb_t(0x26,0x7C,0x22), rgb_t(0x37,0x8D,0x33), rgb_t(0x48,0x9E,0x44), \ - rgb_t(0x59,0xAF,0x55), rgb_t(0x6A,0xC0,0x66), rgb_t(0x7B,0xD1,0x77), rgb_t(0x8C,0xE2,0x88), \ - rgb_t(0x9D,0xF3,0x99), rgb_t(0xAE,0xFF,0xA8), rgb_t(0xBF,0xFF,0xB4), rgb_t(0xD0,0xFF,0xC0 ) - -#define NTSC_YELLOW_GREEN \ - rgb_t(0x00,0x21,0x0A), rgb_t(0x00,0x32,0x0F), rgb_t(0x0A,0x43,0x11), rgb_t(0x1B,0x54,0x11), \ - rgb_t(0x2C,0x65,0x11), rgb_t(0x3D,0x76,0x11), rgb_t(0x4E,0x87,0x11), rgb_t(0x5F,0x98,0x1E), \ - rgb_t(0x70,0xA9,0x2F), rgb_t(0x81,0xBA,0x40), rgb_t(0x92,0xCB,0x51), rgb_t(0xA3,0xDC,0x62), \ - rgb_t(0xB4,0xED,0x73), rgb_t(0xC5,0xFE,0x84), rgb_t(0xD6,0xFF,0x90), rgb_t(0xE7,0xFF,0x9C ) - -#define NTSC_ORANGE_GREEN \ - rgb_t(0x05,0x13,0x04), rgb_t(0x16,0x24,0x04), rgb_t(0x27,0x35,0x04), rgb_t(0x38,0x46,0x04), \ - rgb_t(0x49,0x57,0x04), rgb_t(0x5A,0x68,0x04), rgb_t(0x6B,0x79,0x04), rgb_t(0x7C,0x8A,0x09), \ - rgb_t(0x8D,0x9B,0x1A), rgb_t(0x9E,0xAC,0x2B), rgb_t(0xAF,0xBD,0x3C), rgb_t(0xC0,0xCE,0x4D), \ - rgb_t(0xD1,0xDF,0x5E), rgb_t(0xE2,0xF0,0x6F), rgb_t(0xF3,0xFF,0x80), rgb_t(0xFF,0xFF,0x8D ) - -#define NTSC_LIGHT_ORANGE \ - rgb_t(0x21,0x02,0x00), rgb_t(0x32,0x13,0x00), rgb_t(0x43,0x24,0x00), rgb_t(0x54,0x35,0x00), \ - rgb_t(0x65,0x46,0x00), rgb_t(0x76,0x57,0x00), rgb_t(0x87,0x68,0x00), rgb_t(0x98,0x79,0x0C), \ - rgb_t(0xA9,0x8A,0x1D), rgb_t(0xBA,0x9B,0x2E), rgb_t(0xCB,0xAC,0x3F), rgb_t(0xDC,0xBD,0x50), \ - rgb_t(0xED,0xCE,0x61), rgb_t(0xFE,0xDF,0x72), rgb_t(0xFF,0xF0,0x87), rgb_t(0xFF,0xFF,0x9D ) -***************************************************************************/ - - -/*************************************************************************** - PALETTE - 26.7 PHASE SHIFT - - -define NTSC_GREY - rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ - rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ - rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ - rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) - -define NTSC_GOLD - rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ - rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ - rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ - rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xFF,0x97 ) - -define NTSC_ORANGE - rgb_t(0x32,0x00,0x00), rgb_t(0x43,0x06,0x00), rgb_t(0x54,0x17,0x00), rgb_t(0x65,0x28,0x00), \ - rgb_t(0x79,0x39,0x00), rgb_t(0x87,0x4A,0x00), rgb_t(0x98,0x5B,0x0C), rgb_t(0xA9,0x6C,0x1D), \ - rgb_t(0xBA,0x7D,0x2E), rgb_t(0xCB,0x8E,0x3F), rgb_t(0xDC,0x9F,0x50), rgb_t(0xED,0xB0,0x61), \ - rgb_t(0xFE,0xC1,0x72), rgb_t(0xFF,0xD2,0x87), rgb_t(0xFF,0xE3,0x9E), rgb_t(0xFF,0xF4,0xB4 ) - -define NTSC_RED_ORANGE - rgb_t(0x3E,0x00,0x00), rgb_t(0x4F,0x00,0x00), rgb_t(0x60,0x07,0x00), rgb_t(0x71,0x18,0x00), \ - rgb_t(0x82,0x29,0x10), rgb_t(0x93,0x3A,0x21), rgb_t(0xA4,0x4B,0x32), rgb_t(0xB5,0x5C,0x43), \ - rgb_t(0xC6,0x6D,0x54), rgb_t(0xD7,0x7E,0x65), rgb_t(0xE8,0x8F,0x76), rgb_t(0xF9,0xA0,0x87), \ - rgb_t(0xFF,0xB1,0x9C), rgb_t(0xFF,0xC2,0xB2), rgb_t(0xFF,0xD3,0xC8), rgb_t(0xFF,0xE4,0xDE ) - -define NTSC_PINK - rgb_t(0x3E,0x00,0x09), rgb_t(0x4F,0x00,0x15), rgb_t(0x60,0x00,0x21), rgb_t(0x71,0x0E,0x31), \ - rgb_t(0x82,0x1F,0x42), rgb_t(0x93,0x30,0x53), rgb_t(0xA4,0x41,0x64), rgb_t(0xB5,0x52,0x75), \ - rgb_t(0xC6,0x63,0x86), rgb_t(0xD7,0x74,0x97), rgb_t(0xE8,0x85,0xA8), rgb_t(0xF9,0x96,0xB9), \ - rgb_t(0xFF,0xA7,0xCE), rgb_t(0xFF,0xB8,0xE4), rgb_t(0xFF,0xC9,0xEF), rgb_t(0xFF,0xDA,0xF4 ) - -define NTSC_PURPLE - rgb_t(0x30,0x00,0x3D), rgb_t(0x41,0x00,0x48), rgb_t(0x52,0x00,0x54), rgb_t(0x63,0x0C,0x64), \ - rgb_t(0x74,0x1D,0x75), rgb_t(0x85,0x2E,0x86), rgb_t(0x96,0x3F,0x97), rgb_t(0xA7,0x50,0xA8), \ - rgb_t(0xB8,0x61,0xB9), rgb_t(0xC9,0x72,0xCA), rgb_t(0xDA,0x83,0xDB), rgb_t(0xEB,0x94,0xE5), \ - rgb_t(0xFC,0xA5,0xE5), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) - -define NTSC_PURPLE_BLUE - rgb_t(0x18,0x00,0x62), rgb_t(0x29,0x00,0x6E), rgb_t(0x3A,0x01,0x7A), rgb_t(0x4B,0x12,0x8B), \ - rgb_t(0x5C,0x23,0x9C), rgb_t(0x6D,0x34,0xAD), rgb_t(0x7E,0x45,0xBE), rgb_t(0x8F,0x56,0xCF), \ - rgb_t(0xA0,0x67,0xE0), rgb_t(0xB1,0x78,0xEE), rgb_t(0xC2,0x89,0xEE), rgb_t(0xD3,0x9A,0xEE), \ - rgb_t(0xE4,0xAB,0xEE), rgb_t(0xF5,0xBC,0xEE), rgb_t(0xFF,0xCD,0xE0), rgb_t(0xFF,0xDE,0xF5 ) - -define NTSC_BLUE1 - rgb_t(0x00,0x00,0x72), rgb_t(0x0C,0x00,0x7F), rgb_t(0x1D,0x0E,0x8F), rgb_t(0x2E,0x1F,0xA0), \ - rgb_t(0x3F,0x30,0xB1), rgb_t(0x50,0x41,0xC2), rgb_t(0x61,0x52,0xD3), rgb_t(0x72,0x63,0xE4), \ - rgb_t(0x83,0x74,0xF5), rgb_t(0x94,0x85,0xFA), rgb_t(0xA5,0x96,0xFA), rgb_t(0xB6,0xA7,0xFA), \ - rgb_t(0xC7,0xB8,0xFA), rgb_t(0xD8,0xC9,0xFA), rgb_t(0xE9,0xDA,0xFA), rgb_t(0xFA,0xE8,0xFA ) - -define NTSC_BLUE2 - rgb_t(0x00,0x00,0x62), rgb_t(0x00,0x0F,0x77), rgb_t(0x01,0x20,0x8D), rgb_t(0x12,0x31,0x9E), \ - rgb_t(0x23,0x42,0xAF), rgb_t(0x34,0x53,0xC0), rgb_t(0x45,0x64,0xD1), rgb_t(0x56,0x75,0xE2), \ - rgb_t(0x67,0x86,0xF3), rgb_t(0x78,0x97,0xFF), rgb_t(0x89,0xA8,0xFF), rgb_t(0x9A,0xB9,0xFF), \ - rgb_t(0xAB,0xCA,0xFF), rgb_t(0xBC,0xDB,0xFF), rgb_t(0xCD,0xEC,0xFF), rgb_t(0xDE,0xFD,0xFF ) - -define NTSC_LIGHT_BLUE - rgb_t(0x00,0x10,0x42), rgb_t(0x00,0x21,0x58), rgb_t(0x00,0x32,0x6E), rgb_t(0x00,0x43,0x84), \ - rgb_t(0x0E,0x54,0x96), rgb_t(0x1F,0x65,0xA7), rgb_t(0x30,0x76,0xB8), rgb_t(0x41,0x87,0xC9), \ - rgb_t(0x52,0x98,0xDA), rgb_t(0x63,0xA9,0xEB), rgb_t(0x74,0xBA,0xFC), rgb_t(0x85,0xCB,0xFF), \ - rgb_t(0x96,0xDC,0xFF), rgb_t(0xA7,0xED,0xFF), rgb_t(0xB8,0xFE,0xFF), rgb_t(0xC9,0xFF,0xFF ) - -define NTSC_TURQUOISE - rgb_t(0x00,0x1E,0x14), rgb_t(0x00,0x2F,0x2A), rgb_t(0x00,0x40,0x40), rgb_t(0x00,0x51,0x56), \ - rgb_t(0x04,0x62,0x6B), rgb_t(0x15,0x73,0x7C), rgb_t(0x26,0x84,0x8D), rgb_t(0x37,0x95,0x9E), \ - rgb_t(0x48,0xA6,0xAF), rgb_t(0x59,0xB7,0xC0), rgb_t(0x6A,0xC8,0xD1), rgb_t(0x7B,0xD9,0xE2), \ - rgb_t(0x8C,0xEA,0xF3), rgb_t(0x9D,0xFB,0xFF), rgb_t(0xAE,0xFF,0xFF), rgb_t(0xBF,0xFF,0xFF ) - -define NTSC_GREEN_BLUE - rgb_t(0x00,0x26,0x0B), rgb_t(0x00,0x37,0x10), rgb_t(0x00,0x48,0x16), rgb_t(0x00,0x59,0x25), \ - rgb_t(0x08,0x6A,0x38), rgb_t(0x19,0x7B,0x49), rgb_t(0x2A,0x8C,0x5A), rgb_t(0x3B,0x9D,0x6B), \ - rgb_t(0x4C,0xAE,0x7C), rgb_t(0x5D,0xBF,0x8D), rgb_t(0x6E,0xD0,0x9E), rgb_t(0x7F,0xE1,0xAF), \ - rgb_t(0x90,0xF2,0xC0), rgb_t(0xA1,0xFF,0xD0), rgb_t(0xB2,0xFF,0xDC), rgb_t(0xC3,0xFF,0xE8 ) - -define NTSC_GREEN - rgb_t(0x00,0x26,0x0B), rgb_t(0x00,0x37,0x10), rgb_t(0x00,0x48,0x16), rgb_t(0x08,0x59,0x18), \ - rgb_t(0x19,0x6A,0x18), rgb_t(0x2A,0x7B,0x18), rgb_t(0x3B,0x8C,0x29), rgb_t(0x4C,0x9D,0x3A), \ - rgb_t(0x5D,0xAE,0x4B), rgb_t(0x6E,0xBF,0x5C), rgb_t(0x7F,0xD0,0x6D), rgb_t(0x90,0xE1,0x7E), \ - rgb_t(0xA1,0xF2,0x8F), rgb_t(0xB2,0xFF,0x9F), rgb_t(0xC3,0xFF,0xAB), rgb_t(0xD4,0xFF,0xB7 ) - -define NTSC_YELLOW_GREEN - rgb_t(0x00,0x1E,0x09), rgb_t(0x00,0x2F,0x0E), rgb_t(0x11,0x40,0x0E), rgb_t(0x22,0x51,0x0E), \ - rgb_t(0x33,0x62,0x0E), rgb_t(0x44,0x73,0x0E), rgb_t(0x55,0x84,0x0E), rgb_t(0x66,0x95,0x17), \ - rgb_t(0x77,0xA6,0x28), rgb_t(0x88,0xB7,0x39), rgb_t(0x99,0xC8,0x4A), rgb_t(0xAA,0xD9,0x5B), \ - rgb_t(0xBB,0xEA,0x6C), rgb_t(0xCC,0xFB,0x7D), rgb_t(0xDD,0xFF,0x8A), rgb_t(0xEE,0xFF,0x96 ) - -define NTSC_ORANGE_GREEN - rgb_t(0x0D,0x0F,0x01), rgb_t(0x1E,0x20,0x01), rgb_t(0x2F,0x31,0x01), rgb_t(0x40,0x42,0x01), \ - rgb_t(0x51,0x53,0x01), rgb_t(0x62,0x64,0x01), rgb_t(0x73,0x75,0x01), rgb_t(0x84,0x86,0x08), \ - rgb_t(0x95,0x97,0x19), rgb_t(0xA6,0xA8,0x2A), rgb_t(0xB7,0xB9,0x3B), rgb_t(0xC8,0xCA,0x4C), \ - rgb_t(0xD9,0xDB,0x5D), rgb_t(0xEA,0xEC,0x6E), rgb_t(0xFB,0xFD,0x7F), rgb_t(0xFF,0xFF,0x8F ) - -define NTSC_LIGHT_ORANGE - rgb_t(0x28,0x00,0x00), rgb_t(0x39,0x0E,0x00), rgb_t(0x4A,0x1F,0x00), rgb_t(0x5B,0x30,0x00), \ - rgb_t(0x6C,0x41,0x00), rgb_t(0x7D,0x52,0x00), rgb_t(0x8E,0x63,0x00), rgb_t(0x9F,0x74,0x10), \ - rgb_t(0xB0,0x85,0x21), rgb_t(0xC1,0x96,0x32), rgb_t(0xD2,0xA7,0x43), rgb_t(0xE3,0xB8,0x54), \ - rgb_t(0xF4,0xC9,0x65), rgb_t(0xFF,0xDA,0x78), rgb_t(0xFF,0xEB,0x8E), rgb_t(0xFF,0xFC,0xA4 ) -***************************************************************************/ - - -/*************************************************************************** - PALETTE - 27.2 PHASE SHIFT - - -define NTSC_GREY - rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ - rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ - rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ - rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) - -define NTSC_GOLD - rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ - rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ - rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ - rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xF7,0x97 ) - -define NTSC_ORANGE - rgb_t(0x32,0x00,0x00), rgb_t(0x43,0x05,0x00), rgb_t(0x54,0x16,0x00), rgb_t(0x65,0x27,0x00), \ - rgb_t(0x76,0x38,0x00), rgb_t(0x87,0X49,0x00), rgb_t(0x98,0x5A,0x0C), rgb_t(0xA9,0x6B,0x1D), \ - rgb_t(0xBA,0x7C,0x2E), rgb_t(0xCB,0x8D,0x3F), rgb_t(0xDC,0x9E,0x50), rgb_t(0xED,0xAF,0x61), \ - rgb_t(0xFE,0xC0,0x72), rgb_t(0xFF,0xD1,0x88), rgb_t(0xFF,0xE2,0x9E), rgb_t(0xFF,0xF3,0xB4 ) - -define NTSC_RED_ORANGE - rgb_t(0x3F,0x00,0x00), rgb_t(0x50,0x00,0x00), rgb_t(0x61,0x07,0x00), rgb_t(0x72,0x18,0x01), \ - rgb_t(0x83,0x29,0x12), rgb_t(0x94,0x3A,0x23), rgb_t(0xA5,0x4B,0x34), rgb_t(0xB6,0x5C,0x45), \ - rgb_t(0xC7,0x6D,0x56), rgb_t(0xD8,0x7E,0x67), rgb_t(0xE9,0x8F,0x78), rgb_t(0xFA,0xA0,0x89), \ - rgb_t(0xFF,0xB1,0x9E), rgb_t(0xFF,0xC2,0xB4), rgb_t(0xFF,0xD3,0xCA), rgb_t(0xFF,0xE4,0xE0 ) - -define NTSC_PINK - rgb_t(0x3E,0x00,0x0C), rgb_t(0x4F,0x00,0x18), rgb_t(0x60,0x00,0x24), rgb_t(0x71,0x0E,0x34), \ - rgb_t(0x82,0x1F,0x45), rgb_t(0x93,0x30,0x56), rgb_t(0xA4,0x41,0x67), rgb_t(0xB5,0x52,0x78), \ - rgb_t(0xC6,0x63,0x89), rgb_t(0xD7,0x74,0x9A), rgb_t(0xE8,0x85,0xAB), rgb_t(0xF9,0x96,0xB6), \ - rgb_t(0xFF,0xA7,0xD1), rgb_t(0xFF,0xB8,0xE7), rgb_t(0xFF,0xC9,0xEF), rgb_t(0xFF,0xDA,0xF4 ) - -define NTSC_PURPLE - rgb_t(0x2F,0x00,0x3F), rgb_t(0x40,0x00,0x4B), rgb_t(0x51,0x00,0x57), rgb_t(0x62,0x0C,0x66), \ - rgb_t(0x73,0x1D,0x77), rgb_t(0x84,0x2E,0x88), rgb_t(0x95,0x3F,0x99), rgb_t(0xA6,0x50,0xAA), \ - rgb_t(0xB7,0x61,0xBB), rgb_t(0xC8,0x72,0xCC), rgb_t(0xD9,0x83,0xDD), rgb_t(0xEA,0x94,0xE5), \ - rgb_t(0xFB,0xA5,0xE5), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) - -define NTSC_PURPLE_BLUE - rgb_t(0x16,0x00,0x64), rgb_t(0x27,0x00,0x70), rgb_t(0x38,0x02,0x7D), rgb_t(0x49,0x13,0x8E), \ - rgb_t(0x5A,0x24,0x9F), rgb_t(0x6B,0x35,0xB0), rgb_t(0x7C,0x46,0xC1), rgb_t(0x8D,0x57,0xD2), \ - rgb_t(0x9E,0x68,0xE3), rgb_t(0xAF,0x79,0xEF), rgb_t(0xC0,0x8A,0xEF), rgb_t(0xD1,0x9D,0xEF), \ - rgb_t(0xE2,0xAC,0xEF), rgb_t(0xF3,0xBD,0xEF), rgb_t(0xFF,0xCE,0xF0), rgb_t(0xFF,0xDF,0xF5 ) - -define NTSC_BLUE1 - rgb_t(0x00,0x00,0x71), rgb_t(0x09,0x00,0x7F), rgb_t(0x1A,0x10,0x90), rgb_t(0x2B,0x21,0xA1), \ - rgb_t(0x3C,0x32,0xB2), rgb_t(0x4D,0x43,0xC3), rgb_t(0x5E,0x54,0xD4), rgb_t(0x6F,0x65,0xE5), \ - rgb_t(0x80,0x76,0xF6), rgb_t(0x91,0x87,0xFC), rgb_t(0xA2,0x98,0xFC), rgb_t(0xB3,0xA9,0xFC), \ - rgb_t(0xC4,0xBA,0xFC), rgb_t(0xD5,0xCB,0xFC), rgb_t(0xE6,0xDC,0xFC), rgb_t(0xF7,0xED,0xFC ) - -define NTSC_BLUE2 - rgb_t(0x00,0x00,0x5E), rgb_t(0x00,0x11,0x74), rgb_t(0x00,0x22,0x8A), rgb_t(0x0F,0x33,0x9C), \ - rgb_t(0x20,0x44,0xAD), rgb_t(0x31,0x55,0xBE), rgb_t(0x42,0x66,0xCF), rgb_t(0x53,0x77,0xE0), \ - rgb_t(0x64,0x88,0xF1), rgb_t(0x75,0x99,0xFF), rgb_t(0x86,0xAA,0xFF), rgb_t(0x97,0xBB,0xFF), \ - rgb_t(0xA8,0xCC,0xFF), rgb_t(0xB9,0xDD,0xFF), rgb_t(0xCA,0xEE,0xFF), rgb_t(0xDB,0xFF,0xFF ) - -define NTSC_LIGHT_BLUE - rgb_t(0x00,0x12,0x3B), rgb_t(0x00,0x23,0x51), rgb_t(0x00,0x34,0x68), rgb_t(0x00,0x45,0x7E), \ - rgb_t(0x0C,0x56,0x90), rgb_t(0x1D,0x67,0xA1), rgb_t(0x2E,0x78,0xB2), rgb_t(0x3F,0x89,0xC3), \ - rgb_t(0x50,0x9A,0xD4), rgb_t(0x61,0xAB,0xE5), rgb_t(0x72,0xBC,0xF6), rgb_t(0x83,0xCD,0xFF), \ - rgb_t(0x94,0xDE,0xFF), rgb_t(0xA5,0xEF,0xFF), rgb_t(0xB6,0xFF,0xFF), rgb_t(0xC7,0xFF,0xFF ) - -define NTSC_TURQUOISE - rgb_t(0x00,0x20,0x0C), rgb_t(0x00,0x31,0x22), rgb_t(0x00,0x42,0x38), rgb_t(0x00,0x53,0x4E), \ - rgb_t(0x04,0x64,0x63), rgb_t(0x15,0x75,0x74), rgb_t(0x26,0x86,0x85), rgb_t(0x37,0x97,0x96), \ - rgb_t(0x48,0xA8,0xA7), rgb_t(0x59,0xB9,0xB8), rgb_t(0x6A,0xCA,0xC9), rgb_t(0x7B,0xDB,0xDA), \ - rgb_t(0x8C,0xEC,0xEB), rgb_t(0x9D,0xFD,0xFC), rgb_t(0xAE,0xFF,0xFF), rgb_t(0xBF,0xFF,0xFF ) - -define NTSC_GREEN_BLUE - rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1C), \ - rgb_t(0x0B,0x6B,0x2F), rgb_t(0x1C,0x7C,0x40), rgb_t(0x2D,0x8D,0x51), rgb_t(0x3E,0x9E,0x62), \ - rgb_t(0x4F,0xAF,0x73), rgb_t(0x60,0xC0,0x84), rgb_t(0x71,0xD1,0x95), rgb_t(0x82,0xE2,0xA6), \ - rgb_t(0x93,0xF3,0xB7), rgb_t(0xA4,0xFF,0xC6), rgb_t(0xB5,0xFF,0xD2), rgb_t(0xC6,0xFF,0xDE ) - -define NTSC_GREEN - rgb_t(0x00,0x25,0x0B), rgb_t(0x00,0x36,0x10), rgb_t(0x00,0x47,0x15), rgb_t(0x0D,0x58,0x16), \ - rgb_t(0x1E,0x69,0x16), rgb_t(0x2F,0x7A,0x16), rgb_t(0x40,0x8B,0x21), rgb_t(0x51,0x9C,0x32), \ - rgb_t(0x62,0xAD,0x43), rgb_t(0x73,0xBE,0x54), rgb_t(0x84,0xCF,0x65), rgb_t(0x95,0xE0,0x76), \ - rgb_t(0xA6,0xF1,0x87), rgb_t(0xB7,0xFF,0x98), rgb_t(0xC8,0xFF,0xA3), rgb_t(0xD9,0xFF,0xAF ) - -define NTSC_YELLOW_GREEN - rgb_t(0x00,0x1B,0x08), rgb_t(0x06,0x2C,0x0B), rgb_t(0x17,0x3D,0x0B), rgb_t(0x28,0x4E,0x0B), \ - rgb_t(0x39,0x5F,0x0B), rgb_t(0x4A,0x70,0x0B), rgb_t(0x5B,0x81,0x0B), rgb_t(0x6C,0x92,0x12), \ - rgb_t(0x7D,0xA3,0x23), rgb_t(0x8E,0xB4,0x34), rgb_t(0x9F,0xC5,0x45), rgb_t(0xB0,0xD6,0x56), \ - rgb_t(0xC1,0xE7,0x67), rgb_t(0xD2,0xF8,0x78), rgb_t(0xE3,0xFF,0x86), rgb_t(0xF4,0xFF,0x92 ) - -define NTSC_ORANGE_GREEN - rgb_t(0x13,0x0B,0x00), rgb_t(0x24,0x1C,0x00), rgb_t(0x35,0x2D,0x00), rgb_t(0x46,0x3E,0x00), \ - rgb_t(0x57,0x4F,0x00), rgb_t(0x68,0x60,0x00), rgb_t(0x79,0x71,0x00), rgb_t(0x8A,0x82,0x08), \ - rgb_t(0x9B,0x93,0x19), rgb_t(0xAC,0xA4,0x2A), rgb_t(0xBD,0xB5,0x3B), rgb_t(0xCE,0xC6,0x4C), \ - rgb_t(0xDF,0xD7,0x5D), rgb_t(0xF0,0xE8,0x6E), rgb_t(0xFF,0xF9,0x7F), rgb_t(0xFF,0xFF,0x92 ) - -define NTSC_LIGHT_ORANGE - rgb_t(0x2D,0x00,0x00), rgb_t(0x3E,0x0A,0x00), rgb_t(0x4F,0x1B,0x00), rgb_t(0x60,0x2C,0x00), \ - rgb_t(0x71,0x3D,0x00), rgb_t(0x82,0x4E,0x00), rgb_t(0x93,0x5F,0x05), rgb_t(0xA4,0x70,0x16), \ - rgb_t(0xB5,0x81,0x27), rgb_t(0xC4,0x90,0x37), rgb_t(0xD7,0xA3,0x49), rgb_t(0xE8,0xB4,0x5A), \ - rgb_t(0xF9,0xC5,0x6B), rgb_t(0xFF,0xD6,0x80), rgb_t(0xFF,0xE7,0x96), rgb_t(0xFF,0xF8,0xAC ) -***************************************************************************/ - - -/*************************************************************************** - PALETTE - 27.7 PHASE SHIFT - - -define NTSC_GREY - rgb_t(0x00,0x00,0x00), rgb_t(0x11,0x11,0x11), rgb_t(0x22,0x22,0x22), rgb_t(0x33,0x33,0x33), \ - rgb_t(0x44,0x44,0x44), rgb_t(0x55,0x55,0x55), rgb_t(0x66,0x66,0x66), rgb_t(0x77,0x77,0x77), \ - rgb_t(0x88,0x88,0x88), rgb_t(0x99,0x99,0x99), rgb_t(0xAA,0xAA,0xAA), rgb_t(0xBB,0xBB,0xBB), \ - rgb_t(0xCC,0xCC,0xCC), rgb_t(0xDD,0xDD,0xDD), rgb_t(0xEE,0xEE,0xEE), rgb_t(0xFF,0xFF,0xFF ) - -define NTSC_GOLD - rgb_t(0x1A,0x07,0x00), rgb_t(0x2B,0x18,0x00), rgb_t(0x3C,0x29,0x00), rgb_t(0x4D,0x3A,0x00), \ - rgb_t(0x5E,0x4B,0x00), rgb_t(0x6F,0x5C,0x00), rgb_t(0x80,0x6D,0x00), rgb_t(0x91,0x7E,0x09), \ - rgb_t(0xA2,0x8F,0x1A), rgb_t(0xB3,0xA0,0x2B), rgb_t(0xC4,0xB1,0x3C), rgb_t(0xD5,0xC2,0x4D), \ - rgb_t(0xE6,0xD3,0x5E), rgb_t(0xF7,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xFF,0x97 ) - -define NTSC_ORANGE - rgb_t(0x32,0x00,0x00), rgb_t(0x43,0x05,0x00), rgb_t(0x54,0x16,0x00), rgb_t(0x65,0x27,0x00), \ - rgb_t(0x76,0x38,0x00), rgb_t(0x87,0x49,0x00), rgb_t(0x98,0x5A,0x0C), rgb_t(0xA9,0x6B,0x1D), \ - rgb_t(0xBA,0x7C,0x2E), rgb_t(0xCB,0x8D,0x3F), rgb_t(0xDC,0x9E,0x50), rgb_t(0xED,0xAF,0x61), \ - rgb_t(0xFE,0xC0,0x72), rgb_t(0xFF,0xD1,0x88), rgb_t(0xFF,0xE2,0x9E), rgb_t(0xFF,0xF3,0xB4 ) - -define NTSC_RED_ORANGE - rgb_t(0x3F,0x00,0x00), rgb_t(0x50,0x00,0x00), rgb_t(0x61,0x06,0x00), rgb_t(0x72,0x17,0x03), \ - rgb_t(0x83,0x28,0x14), rgb_t(0x94,0x39,0x25), rgb_t(0xA5,0x4A,0x36), rgb_t(0xB6,0x5B,0x47), \ - rgb_t(0xC7,0x6C,0x58), rgb_t(0xD8,0x7D,0x69), rgb_t(0xE9,0x8E,0x7A), rgb_t(0xFA,0x9F,0x8B), \ - rgb_t(0xFF,0xB0,0x9F), rgb_t(0xFF,0xC1,0xB5), rgb_t(0xFF,0xD2,0xCB), rgb_t(0xFF,0xE3,0xE1 ) - -define NTSC_PINK - rgb_t(0x3D,0x00,0x10), rgb_t(0x4E,0x00,0x1C), rgb_t(0x5F,0x00,0x27), rgb_t(0x70,0x0D,0x37), \ - rgb_t(0x81,0x1E,0x48), rgb_t(0x92,0x2F,0x59), rgb_t(0xA3,0x40,0x6A), rgb_t(0xB4,0x51,0x7B), \ - rgb_t(0xC5,0x62,0x8C), rgb_t(0xD6,0x73,0x9D), rgb_t(0xE7,0x84,0xAE), rgb_t(0xF8,0x95,0xBF), \ - rgb_t(0xFF,0xA6,0xD3), rgb_t(0xFF,0xB7,0xE9), rgb_t(0xFF,0xC8,0xEE), rgb_t(0xFF,0xD9,0xF4 ) - -define NTSC_PURPLE - rgb_t(0x2D,0x00,0x42), rgb_t(0x3E,0x00,0x4E), rgb_t(0x4F,0x00,0x5A), rgb_t(0x60,0x0C,0x6A), \ - rgb_t(0x71,0x1D,0x7B), rgb_t(0x82,0x2E,0x8C), rgb_t(0x93,0x3F,0x9D), rgb_t(0xA4,0x50,0xAE), \ - rgb_t(0xB5,0x61,0xBF), rgb_t(0xC6,0x72,0xD0), rgb_t(0xD7,0x83,0xE1), rgb_t(0xE8,0x94,0xE6), \ - rgb_t(0xF9,0xA5,0xE6), rgb_t(0xFF,0xB6,0xE9), rgb_t(0xFF,0xC7,0xEE), rgb_t(0xFF,0xD8,0xF3 ) - -define NTSC_PURPLE_BLUE - rgb_t(0x13,0x00,0x67), rgb_t(0x24,0x00,0x73), rgb_t(0x35,0x03,0x80), rgb_t(0x46,0x14,0x91), \ - rgb_t(0x57,0x25,0xA2), rgb_t(0x68,0x36,0xB3), rgb_t(0x79,0x47,0xC4), rgb_t(0x8A,0x58,0xD5), \ - rgb_t(0x9B,0x69,0xE6), rgb_t(0xAC,0x7A,0xF0), rgb_t(0xBD,0x8B,0xF0), rgb_t(0xCE,0x9C,0xF0), \ - rgb_t(0xDF,0xAD,0xF0), rgb_t(0xF0,0xBE,0xF0), rgb_t(0xFF,0xCF,0xF1), rgb_t(0xFF,0xE0,0xF6 ) - -define NTSC_BLUE1 - rgb_t(0x00,0x00,0x70), rgb_t(0x05,0x01,0x80), rgb_t(0x16,0x12,0x91), rgb_t(0x27,0x23,0xA2), \ - rgb_t(0x38,0x34,0xB3), rgb_t(0x49,0x45,0xC4), rgb_t(0x5A,0x56,0xD5), rgb_t(0x6B,0x67,0xE6), \ - rgb_t(0x7C,0x78,0xF7), rgb_t(0x8D,0x89,0xFE), rgb_t(0x9E,0x9A,0xFE), rgb_t(0xAF,0xAB,0xFE), \ - rgb_t(0xC0,0xBC,0xFE), rgb_t(0xD1,0xCD,0xFE), rgb_t(0xE2,0xDE,0xFE), rgb_t(0xF3,0xEF,0xFE ) - -define NTSC_BLUE2 - rgb_t(0x00,0x03,0x5B), rgb_t(0x00,0x14,0x71), rgb_t(0x00,0x25,0x87), rgb_t(0x0C,0x36,0x9A), \ - rgb_t(0x1D,0x47,0xAB), rgb_t(0x2E,0x58,0xBC), rgb_t(0x3F,0x69,0xCD), rgb_t(0x50,0x7A,0xDE), \ - rgb_t(0x61,0x8B,0xEF), rgb_t(0x72,0x9C,0xFF), rgb_t(0x83,0xAD,0xFF), rgb_t(0x94,0xBE,0xFF), \ - rgb_t(0xA5,0xCF,0xFF), rgb_t(0xB6,0xE0,0xFF), rgb_t(0xC7,0xF1,0xFF), rgb_t(0xD8,0xFF,0xFF ) - -define NTSC_LIGHT_BLUE - rgb_t(0x00,0x15,0x35), rgb_t(0x00,0x26,0x4B), rgb_t(0x00,0x37,0x61), rgb_t(0x00,0x48,0x78), \ - rgb_t(0x0A,0x59,0x8B), rgb_t(0x1B,0x6A,0x9C), rgb_t(0x2C,0x7B,0xAD), rgb_t(0x3D,0x8C,0xBE), \ - rgb_t(0x4E,0x9D,0xCF), rgb_t(0x5F,0xAE,0xE0), rgb_t(0x70,0xBF,0xF1), rgb_t(0x81,0xD0,0xFF), \ - rgb_t(0x92,0xE1,0xFF), rgb_t(0xA3,0xF2,0xFF), rgb_t(0xB4,0xFF,0xFF), rgb_t(0xC5,0xFF,0xFF ) - -define NTSC_TURQUOISE - rgb_t(0x00,0x22,0x0A), rgb_t(0x00,0x33,0x19), rgb_t(0x00,0x44,0x2F), rgb_t(0x00,0x55,0x45), \ - rgb_t(0x04,0x66,0x5A), rgb_t(0x15,0x77,0x6B), rgb_t(0x26,0x88,0x7C), rgb_t(0x37,0x99,0x8D), \ - rgb_t(0x48,0xAA,0x9E), rgb_t(0x59,0xBB,0xAF), rgb_t(0x6A,0xCC,0xC0), rgb_t(0x7B,0xDD,0xD1), \ - rgb_t(0x8C,0xEE,0xE2), rgb_t(0x9D,0xFF,0xF3), rgb_t(0xAE,0xFF,0xFF), rgb_t(0xBF,0xFF,0xFF ) - -define NTSC_GREEN_BLUE - rgb_t(0x00,0x27,0x0C), rgb_t(0x00,0x38,0x11), rgb_t(0x00,0x49,0x16), rgb_t(0x00,0x5A,0x1B), \ - rgb_t(0x0D,0x6B,0x25), rgb_t(0x1E,0x7C,0x36), rgb_t(0x2F,0x8D,0x47), rgb_t(0x40,0x9E,0x58), \ - rgb_t(0x51,0xAF,0x69), rgb_t(0x62,0xC0,0x7A), rgb_t(0x73,0xD1,0x8B), rgb_t(0x84,0xE2,0x9C), \ - rgb_t(0x95,0xF3,0xAD), rgb_t(0xA6,0xFF,0xBD), rgb_t(0xB7,0xFF,0xC9), rgb_t(0xC8,0xFF,0xD4 ) - -define NTSC_GREEN - rgb_t(0x00,0x24,0x0B), rgb_t(0x00,0x35,0x10), rgb_t(0x01,0x46,0x15), rgb_t(0x12,0x57,0x15), \ - rgb_t(0x23,0x68,0x15), rgb_t(0x34,0x79,0x15), rgb_t(0x45,0x8A,0x19), rgb_t(0x56,0x9B,0x2A), \ - rgb_t(0x67,0xAC,0x3B), rgb_t(0x78,0xBD,0x4C), rgb_t(0x89,0xCE,0x5D), rgb_t(0x9A,0xDF,0x6E), \ - rgb_t(0xAB,0xF0,0x7F), rgb_t(0xBC,0xFF,0x8F), rgb_t(0xCD,0xFF,0x9B), rgb_t(0xDE,0xFF,0xA7 ) - -define NTSC_YELLOW_GREEN - rgb_t(0x00,0x18,0x07), rgb_t(0x00,0x29,0x0C), rgb_t(0x1E,0x3A,0x08), rgb_t(0x2F,0x4B,0x08), \ - rgb_t(0x40,0x5C,0x08), rgb_t(0x51,0x6D,0x08), rgb_t(0x62,0x7E,0x08), rgb_t(0x73,0x8F,0x0D), \ - rgb_t(0x84,0xA0,0x1E), rgb_t(0x95,0xB1,0x2F), rgb_t(0xA6,0xC2,0x40), rgb_t(0xB7,0xD3,0x51), \ - rgb_t(0xC8,0xE4,0x62), rgb_t(0xD9,0xF5,0x73), rgb_t(0xEA,0xFF,0x82), rgb_t(0xFB,0xFF,0x8E ) - -define NTSC_ORANGE_GREEN - rgb_t(0x1B,0x07,0x00), rgb_t(0x2C,0x18,0x00), rgb_t(0x3D,0x29,0x00), rgb_t(0x4E,0x3A,0x00), \ - rgb_t(0x5F,0x4B,0x00), rgb_t(0x70,0x5C,0x00), rgb_t(0x81,0x6D,0x00), rgb_t(0x92,0x7E,0x09), \ - rgb_t(0xA3,0x8F,0x1A), rgb_t(0xB4,0xA0,0x2B), rgb_t(0xC5,0xB1,0x3C), rgb_t(0xD6,0xC2,0x4D), \ - rgb_t(0xE7,0xD3,0x5E), rgb_t(0xF8,0xE4,0x6F), rgb_t(0xFF,0xF5,0x83), rgb_t(0xFF,0xFF,0x97 ) - -define NTSC_LIGHT_ORANGE - rgb_t(0x33,0x00,0x00), rgb_t(0x44,0x05,0x00), rgb_t(0x55,0x16,0x00), rgb_t(0x66,0x27,0x00), \ - rgb_t(0x77,0x38,0x00), rgb_t(0x88,0x49,0x00), rgb_t(0x99,0x5A,0x0D), rgb_t(0xAA,0x6B,0x1E), \ - rgb_t(0xBB,0x7C,0x2F), rgb_t(0xCC,0x8D,0x40), rgb_t(0xDD,0x9E,0x51), rgb_t(0xEE,0xAF,0x62), \ - rgb_t(0xFF,0xC0,0x73), rgb_t(0xFF,0xD1,0x89), rgb_t(0xFF,0xE2,0x9F), rgb_t(0xFF,0xF3,0xB5 ) -***************************************************************************/ - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(a7800_state, a7800) -{ - palette.set_pen_colors(0, a7800_palette, ARRAY_LENGTH(a7800_palette)); -} - - -PALETTE_INIT_MEMBER(a7800_state,a7800p) -{ - palette.set_pen_colors(0, a7800p_palette, ARRAY_LENGTH(a7800p_palette)); -} - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -void a7800_state::machine_start() -{ - save_item(NAME(m_p1_one_button)); - save_item(NAME(m_p2_one_button)); - save_item(NAME(m_bios_enabled)); - save_item(NAME(m_ctrl_lock)); - save_item(NAME(m_ctrl_reg)); - save_item(NAME(m_maria_flag)); - - // set up RAM mirrors - UINT8 *ram = reinterpret_cast(memshare("6116_2")->ptr()); - membank("zpmirror")->set_base(ram + 0x0040); - membank("spmirror")->set_base(ram + 0x0140); - - // install additional handlers, if needed - if (m_cart->exists()) - { - switch (m_cart->get_cart_type()) - { - case A78_HSC: - // ROM+NVRAM accesses for HiScore - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x17ff, read8_delegate(FUNC(a78_cart_slot_device::read_10xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_10xx),(a78_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x3000, 0x3fff, read8_delegate(FUNC(a78_cart_slot_device::read_30xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_30xx),(a78_cart_slot_device*)m_cart)); - break; - case A78_XB_BOARD: - case A78_TYPE0_POK450: - case A78_TYPE1_POK450: - case A78_TYPE6_POK450: - case A78_TYPEA_POK450: - case A78_VERSA_POK450: - // POKEY and RAM regs at 0x400-0x47f - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0400, 0x047f, read8_delegate(FUNC(a78_cart_slot_device::read_04xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_04xx),(a78_cart_slot_device*)m_cart)); - break; - case A78_XM_BOARD: - // POKEY and RAM and YM regs at 0x400-0x47f - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0400, 0x047f, read8_delegate(FUNC(a78_cart_slot_device::read_04xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_04xx),(a78_cart_slot_device*)m_cart)); - // ROM+NVRAM accesses for HiScore - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x17ff, read8_delegate(FUNC(a78_cart_slot_device::read_10xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_10xx),(a78_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x3000, 0x3fff, read8_delegate(FUNC(a78_cart_slot_device::read_30xx),(a78_cart_slot_device*)m_cart), write8_delegate(FUNC(a78_cart_slot_device::write_30xx),(a78_cart_slot_device*)m_cart)); - break; - } - } -} - -void a7800_state::machine_reset() -{ - m_ctrl_lock = 0; - m_ctrl_reg = 0; - m_maria_flag = 0; - m_bios_enabled = 0; -} - -static MACHINE_CONFIG_START( a7800_ntsc, a7800_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, A7800_NTSC_Y1/8) /* 1.79 MHz (switches to 1.19 MHz on TIA or RIOT access) */ - MCFG_CPU_PROGRAM_MAP(a7800_mem) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a7800_state, interrupt, "screen", 0, 1) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( 7159090, 454, 0, 320, 263, 27, 27 + 192 + 32 ) - MCFG_SCREEN_UPDATE_DEVICE("maria", atari_maria_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(a7800_palette) / 3) - MCFG_PALETTE_INIT_OWNER(a7800_state, a7800) - - MCFG_DEVICE_ADD("maria", ATARI_MARIA, 0) - MCFG_MARIA_DMACPU("maincpu") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_TIA_ADD("tia", 31400) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_DEVICE_ADD("riot", MOS6532n, A7800_NTSC_Y1/8) - MCFG_MOS6530n_IN_PA_CB(READ8(a7800_state, riot_joystick_r)) - MCFG_MOS6530n_IN_PB_CB(READ8(a7800_state, riot_console_button_r)) - MCFG_MOS6530n_OUT_PB_CB(WRITE8(a7800_state, riot_button_pullup_w)) - - MCFG_A78_CARTRIDGE_ADD("cartslot", a7800_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","a7800") - MCFG_SOFTWARE_LIST_FILTER("cart_list","NTSC") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( a7800_pal, a7800_ntsc ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(CLK_PAL) -// MCFG_TIMER_ADD_SCANLINE("scantimer", a7800_interrupt, "screen", 0, 1) - - MCFG_SCREEN_MODIFY( "screen" ) - MCFG_SCREEN_RAW_PARAMS( 7093788, 454, 0, 320, 313, 35, 35 + 228 + 32 ) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(a7800_state, a7800p ) - - /* devices */ - MCFG_DEVICE_REMOVE("riot") - MCFG_DEVICE_ADD("riot", MOS6532n, CLK_PAL) - MCFG_MOS6530n_IN_PA_CB(READ8(a7800_state, riot_joystick_r)) - MCFG_MOS6530n_IN_PB_CB(READ8(a7800_state, riot_console_button_r)) - MCFG_MOS6530n_OUT_PB_CB(WRITE8(a7800_state, riot_button_pullup_w)) - - /* software lists */ - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list","a7800") - MCFG_SOFTWARE_LIST_FILTER("cart_list","PAL") -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( a7800 ) - ROM_REGION(0x4000, "maincpu", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "a7800", "Atari 7800" ) - ROMX_LOAD("7800.u7", 0x3000, 0x1000, CRC(5d13730c) SHA1(d9d134bb6b36907c615a594cc7688f7bfcef5b43), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "a7800pr", "Atari 7800 (prototype with Asteroids)" ) - ROMX_LOAD("c300558-001a.u7", 0x0000, 0x4000, CRC(a0e10edf) SHA1(14584b1eafe9721804782d4b1ac3a4a7313e455f), ROM_BIOS(2)) -ROM_END - -ROM_START( a7800p ) - ROM_REGION(0x4000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD("7800pal.rom", 0x0000, 0x4000, CRC(d5b61170) SHA1(5a140136a16d1d83e4ff32a19409ca376a8df874)) -ROM_END - - -/*************************************************************************** - DRIVER INIT - ***************************************************************************/ - -DRIVER_INIT_MEMBER(a7800_state,a7800_ntsc) -{ - m_ispal = FALSE; - m_lines = 263; - m_p1_one_button = 1; - m_p2_one_button = 1; -} - - -DRIVER_INIT_MEMBER(a7800_state,a7800_pal) -{ - m_ispal = TRUE; - m_lines = 313; - m_p1_one_button = 1; - m_p2_one_button = 1; -} - - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1986, a7800, 0, 0, a7800_ntsc, a7800, a7800_state, a7800_ntsc, "Atari", "Atari 7800 (NTSC)" , 0) -CONS( 1986, a7800p, a7800, 0, a7800_pal, a7800, a7800_state, a7800_pal, "Atari", "Atari 7800 (PAL)" , 0) diff --git a/src/mess/drivers/abc1600.c b/src/mess/drivers/abc1600.c deleted file mode 100644 index bdaa4823471..00000000000 --- a/src/mess/drivers/abc1600.c +++ /dev/null @@ -1,967 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Luxor ABC 1600 - - How to create HDD image: - ------------------------ - chdman createhd -chs 615,4,17 -ss 512 -o necd5126a.chd - - How to format HDD: - ------------------ - mf(2,0) - mf(2,0) - abcenix - sas/format/format - sa(40,0) - y - 5 - necd5126a - - How to install OS: - ------------------ - mf(2,0) - mf(2,0) - abcenix - loadsys1 - - - -*/ - -/* - - TODO: - - - short/long reset (RSTBUT) - - CIO - - optimize timers! - - port C, open drain output bit PC1 (RTC/NVRAM data) - - hard disk - - 4105 SASI interface card - - SASI interface (scsibus.c) - - connect RS-232 port A - -*/ - -#include "includes/abc1600.h" - - - -//************************************************************************** -// CONSTANTS / MACROS -//************************************************************************** - -#define LOG 0 - - -#define A1 BIT(offset, 1) -#define A2 BIT(offset, 2) -#define A4 BIT(offset, 4) -#define X11 BIT(offset, 11) -#define A1_A2 ((A1 << 1) | A2) -#define A2_A1 ((offset >> 1) & 0x03) - - -// external I/O -enum -{ - INP = 0, - STAT, - OPS -}; - -enum -{ - OUT = 0, - C1 = 2, - C2, - C3, - C4 -}; - - - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// bus_r - -//------------------------------------------------- - -READ8_MEMBER( abc1600_state::bus_r ) -{ - UINT8 data = 0; - - // card select pulse - UINT8 cs = (m_cs7 << 7) | ((offset >> 5) & 0x3f); - - m_bus0i->cs_w(cs); - m_bus0x->cs_w(cs); - m_bus1->cs_w(cs); - m_bus2->cs_w(cs); - - // card select b? - m_csb = m_bus2->csb_r(); - m_csb |= m_bus1->csb_r() << 1; - m_csb |= m_bus0x->xcsb2_r() << 2; - m_csb |= m_bus0x->xcsb3_r() << 3; - m_csb |= m_bus0x->xcsb4_r() << 4; - m_csb |= m_bus0x->xcsb5_r() << 5; - m_csb |= m_bus0x->csb_r() << 6; - m_csb |= m_bus0i->csb_r() << 7; - - m_bus0 = !((m_csb & 0xfc) == 0xfc); - - if (X11) - { - if (A4) - { - // EXP - data = m_bus0x->exp_r(); - - if (LOG) logerror("%s EXP %02x: %02x\n", machine().describe_context(), cs, data); - } - else - { - // RCSB - if (m_bus0) - { - /* - - bit description - - 0 1 - 1 1 - 2 LXCSB2* - 3 LXCSB3* - 4 LXCSB4* - 5 LXCSB5* - 6 LCSB*-0 - 7 LCSB*-0I - - */ - - data = (m_csb & 0xfc) | 0x03; - } - else - { - /* - - bit description - - 0 LCSB*-2 - 1 LCSB*-1 - 2 1 - 3 1 - 4 1 - 5 1 - 6 1 - 7 1 - - */ - - data = 0xfc | (m_csb & 0x03); - } - - if (LOG) logerror("%s RCSB %02x\n", machine().describe_context(), data); - } - } - else - { - data = 0xff; - - switch ((offset >> 1) & 0x07) - { - case INP: - if (m_bus0) - { - data &= m_bus0i->inp_r(); - data &= m_bus0x->inp_r(); - } - else - { - data &= m_bus1->inp_r(); - data &= m_bus2->inp_r(); - } - - if (LOG) logerror("%s INP %02x: %02x\n", machine().describe_context(), cs, data); - break; - - case STAT: - if (m_bus0) - { - data &= m_bus0i->stat_r(); - data &= m_bus0x->stat_r(); - } - else - { - data &= m_bus1->stat_r(); - data &= m_bus2->stat_r(); - } - - if (LOG) logerror("%s STAT %02x: %02x\n", machine().describe_context(), cs, data); - break; - - case OPS: - if (m_bus0) - { - data &= m_bus0i->ops_r(); - data &= m_bus0x->ops_r(); - } - else - { - data &= m_bus1->ops_r(); - data &= m_bus2->ops_r(); - } - - if (LOG) logerror("%s OPS %02x: %02x\n", machine().describe_context(), cs, data); - break; - - default: - if (LOG) logerror("%s Unmapped read from virtual I/O %06x\n", machine().describe_context(), offset); - } - } - - return data; -} - - -//------------------------------------------------- -// bus_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_state::bus_w ) -{ - UINT8 cs = (m_cs7 << 7) | ((offset >> 5) & 0x3f); - - m_bus0i->cs_w(cs); - m_bus0x->cs_w(cs); - m_bus1->cs_w(cs); - m_bus2->cs_w(cs); - - switch ((offset >> 1) & 0x07) - { - case OUT: - if (LOG) logerror("%s OUT %02x: %02x\n", machine().describe_context(), cs, data); - - if (m_bus0) - { - m_bus0i->out_w(data); - m_bus0x->out_w(data); - } - else - { - m_bus1->out_w(data); - m_bus2->out_w(data); - } - break; - - case C1: - if (LOG) logerror("%s C1 %02x: %02x\n", machine().describe_context(), cs, data); - - if (m_bus0) - { - m_bus0i->c1_w(data); - m_bus0x->c1_w(data); - } - else - { - m_bus1->c1_w(data); - m_bus2->c1_w(data); - } - break; - - case C2: - if (LOG) logerror("%s C2 %02x: %02x\n", machine().describe_context(), cs, data); - - if (m_bus0) - { - m_bus0i->c2_w(data); - m_bus0x->c2_w(data); - } - else - { - m_bus1->c2_w(data); - m_bus2->c2_w(data); - } - break; - - case C3: - if (LOG) logerror("%s C3 %02x: %02x\n", machine().describe_context(), cs, data); - - if (m_bus0) - { - m_bus0i->c3_w(data); - m_bus0x->c3_w(data); - } - else - { - m_bus1->c3_w(data); - m_bus2->c3_w(data); - } - break; - - case C4: - if (LOG) logerror("%s C4 %02x: %02x\n", machine().describe_context(), cs, data); - - if (m_bus0) - { - m_bus0i->c4_w(data); - m_bus0x->c4_w(data); - } - else - { - m_bus1->c4_w(data); - m_bus2->c4_w(data); - } - break; - - default: - if (LOG) logerror("%s Unmapped write %02x to virtual I/O %06x\n", machine().describe_context(), data, offset); - } -} - - -//------------------------------------------------- -// fw0_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_state::fw0_w ) -{ - /* - - bit description - - 0 SEL1 - 1 SEL2 - 2 SEL3 - 3 MOTOR - 4 LC/PC - 5 LC/PC - 6 - 7 - - */ - - if (LOG) logerror("FW0 %02x\n", data); - - // drive select - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - - m_fdc->set_floppy(floppy); - - // floppy motor - if (floppy) floppy->mon_w(!BIT(data, 3)); -} - - -//------------------------------------------------- -// fw1_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_state::fw1_w ) -{ - /* - - bit description - - 0 MR - 1 DDEN - 2 HLT - 3 MINI - 4 HLD - 5 P0 - 6 P1 - 7 P2 - - */ - - if (LOG) logerror("FW1 %02x\n", data); - - // FDC master reset - if (!BIT(data, 0)) m_fdc->reset(); - - // density select - m_fdc->dden_w(BIT(data, 1)); -} - - -//------------------------------------------------- -// spec_contr_reg_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_state::spec_contr_reg_w ) -{ - int state = BIT(data, 3); - - switch (data & 0x07) - { - case 0: // CS7 - m_cs7 = state; - break; - - case 1: - break; - - case 2: // _BTCE - m_btce = state; - break; - - case 3: // _ATCE - m_atce = state; - break; - - case 4: // PARTST - m_partst = state; - break; - - case 5: // _DMADIS - m_dmadis = state; - break; - - case 6: // SYSSCC - m_sysscc = state; - - m_cio->pb5_w(!state); - m_bus1->pren_w(!state); - - update_drdy1(); - break; - - case 7: // SYSFS - m_sysfs = state; - - m_cio->pb6_w(!state); - m_bus0i->pren_w(!state); - m_bus0x->pren_w(!state); - - update_drdy0(); - break; - } -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( abc1600_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc1600_mem, AS_PROGRAM, 8, abc1600_state ) - AM_RANGE(0x00000, 0xfffff) AM_DEVICE(ABC1600_MAC_TAG, abc1600_mac_device, map) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( mac_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( mac_mem, AS_PROGRAM, 8, abc1600_state ) - AM_RANGE(0x000000, 0x0fffff) AM_RAM - AM_RANGE(0x100000, 0x17ffff) AM_DEVICE(ABC1600_MOVER_TAG, abc1600_mover_device, vram_map) - AM_RANGE(0x1fe000, 0x1fefff) AM_READWRITE(bus_r, bus_w) - AM_RANGE(0x1ff000, 0x1ff000) AM_MIRROR(0xf9) AM_DEVREADWRITE(SAB1797_02P_TAG, fd1797_t, status_r, cmd_w) - AM_RANGE(0x1ff002, 0x1ff002) AM_MIRROR(0xf9) AM_DEVREADWRITE(SAB1797_02P_TAG, fd1797_t, track_r, track_w) - AM_RANGE(0x1ff004, 0x1ff004) AM_MIRROR(0xf9) AM_DEVREADWRITE(SAB1797_02P_TAG, fd1797_t, sector_r, sector_w) - AM_RANGE(0x1ff006, 0x1ff006) AM_MIRROR(0xf9) AM_DEVREADWRITE(SAB1797_02P_TAG, fd1797_t, data_r, data_w) - AM_RANGE(0x1ff100, 0x1ff101) AM_MIRROR(0xfe) AM_DEVICE(ABC1600_MOVER_TAG, abc1600_mover_device, crtc_map) - AM_RANGE(0x1ff200, 0x1ff207) AM_MIRROR(0xf8) AM_READWRITE(dart_r, dart_w) - AM_RANGE(0x1ff300, 0x1ff300) AM_MIRROR(0xff) AM_DEVREADWRITE(Z8410AB1_0_TAG, z80dma_device, read, write) - AM_RANGE(0x1ff400, 0x1ff400) AM_MIRROR(0xff) AM_DEVREADWRITE(Z8410AB1_1_TAG, z80dma_device, read, write) - AM_RANGE(0x1ff500, 0x1ff500) AM_MIRROR(0xff) AM_DEVREADWRITE(Z8410AB1_2_TAG, z80dma_device, read, write) - AM_RANGE(0x1ff600, 0x1ff607) AM_MIRROR(0xf8) AM_READWRITE(scc_r, scc_w) - AM_RANGE(0x1ff700, 0x1ff707) AM_MIRROR(0xf8) AM_READWRITE(cio_r, cio_w) - AM_RANGE(0x1ff800, 0x1ffaff) AM_DEVICE(ABC1600_MOVER_TAG, abc1600_mover_device, io_map) - AM_RANGE(0x1ffb00, 0x1ffb00) AM_MIRROR(0x7e) AM_WRITE(fw0_w) - AM_RANGE(0x1ffb01, 0x1ffb01) AM_MIRROR(0x7e) AM_WRITE(fw1_w) - AM_RANGE(0x1ffd00, 0x1ffd07) AM_MIRROR(0xf8) AM_DEVWRITE(ABC1600_MAC_TAG, abc1600_mac_device, dmamap_w) - AM_RANGE(0x1ffe00, 0x1ffe00) AM_MIRROR(0xff) AM_WRITE(spec_contr_reg_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( abc1600 ) -//------------------------------------------------- - -static INPUT_PORTS_START( abc1600 ) - // inputs defined in machine/abc99.c -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// Z80DMA 0 -//------------------------------------------------- - -void abc1600_state::update_drdy0() -{ - if (m_sysfs) - { - // floppy - m_dma0->rdy_w(!m_fdc->drq_r()); - } - else - { - // BUS0I/BUS0X - int trrq0 = m_bus0i->trrq_r() && m_bus0x->trrq_r(); - - m_dma0->rdy_w(trrq0); - } -} - -WRITE_LINE_MEMBER( abc1600_state::dbrq_w ) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state && m_dmadis); -} - -//------------------------------------------------- -// Z80DMA 1 -//------------------------------------------------- - -void abc1600_state::update_drdy1() -{ - if (m_sysscc) - { - // SCC - m_dma1->rdy_w(1); - } - else - { - // BUS1 - m_dma1->rdy_w(m_bus1->trrq_r()); - } -} - -//------------------------------------------------- -// Z80DMA 2 -//------------------------------------------------- - -void abc1600_state::update_drdy2() -{ - // Winchester - m_dma2->rdy_w(1); -} - -//------------------------------------------------- -// Z80DART -//------------------------------------------------- - -READ8_MEMBER( abc1600_state::dart_r ) -{ - return m_dart->ba_cd_r(space, A2_A1 ^ 0x03); -} - -WRITE8_MEMBER( abc1600_state::dart_w ) -{ - m_dart->ba_cd_w(space, A2_A1 ^ 0x03, data); -} - -//------------------------------------------------- -// SCC8530_INTERFACE( sc_intf ) -//------------------------------------------------- - -READ8_MEMBER( abc1600_state::scc_r ) -{ - return m_scc->reg_r(space, A1_A2); -} - -WRITE8_MEMBER( abc1600_state::scc_w ) -{ - m_scc->reg_w(space, A1_A2, data); -} - - -//------------------------------------------------- -// Z8536_INTERFACE( cio_intf ) -//------------------------------------------------- - -READ8_MEMBER( abc1600_state::cio_r ) -{ - return m_cio->read(space, A2_A1); -} - -WRITE8_MEMBER( abc1600_state::cio_w ) -{ - m_cio->write(space, A2_A1, data); -} - -READ8_MEMBER( abc1600_state::cio_pa_r ) -{ - /* - - bit description - - PA0 BUS2 - PA1 BUS1 - PA2 BUS0X*2 - PA3 BUS0X*3 - PA4 BUS0X*4 - PA5 BUS0X*5 - PA6 BUS0X - PA7 BUS0I - - */ - - UINT8 data = 0; - - data |= m_bus2->irq_r(); - data |= m_bus1->irq_r() << 1; - data |= m_bus0x->xint2_r() << 2; - data |= m_bus0x->xint3_r() << 3; - data |= m_bus0x->xint4_r() << 4; - data |= m_bus0x->xint5_r() << 5; - data |= m_bus0x->irq_r() << 6; - data |= m_bus0i->irq_r() << 7; - - return data; -} - -READ8_MEMBER( abc1600_state::cio_pb_r ) -{ - /* - - bit description - - PB0 - PB1 POWERFAIL - PB2 - PB3 - PB4 MINT - PB5 _PREN-1 - PB6 _PREN-0 - PB7 FINT - - */ - - UINT8 data = 0; - - data |= !m_sysscc << 5; - data |= !m_sysfs << 6; - - // floppy interrupt - data |= m_fdc->intrq_r() << 7; - - return data; -} - -WRITE8_MEMBER( abc1600_state::cio_pb_w ) -{ - /* - - bit description - - PB0 PRBR - PB1 - PB2 - PB3 - PB4 - PB5 - PB6 - PB7 - - */ - - // printer baudrate - int prbr = BIT(data, 0); - - m_dart->txca_w(prbr); - m_dart->rxca_w(prbr); -} - -READ8_MEMBER( abc1600_state::cio_pc_r ) -{ - /* - - bit description - - PC0 1 - PC1 DATA IN - PC2 1 - PC3 1 - - */ - - UINT8 data = 0x0d; - - // data in - data |= (m_rtc->dio_r() || m_nvram->do_r()) << 1; - - return data; -} - -WRITE8_MEMBER( abc1600_state::cio_pc_w ) -{ - /* - - bit description - - PC0 CLOCK - PC1 DATA OUT - PC2 RTC CS - PC3 NVRAM CS - - */ - - int clock = BIT(data, 0); - int data_out = BIT(data, 1); - int rtc_cs = BIT(data, 2); - int nvram_cs = BIT(data, 3); - - if (LOG) logerror("CLK %u DATA %u RTC %u NVRAM %u\n", clock, data_out, rtc_cs, nvram_cs); - - m_rtc->cs_w(rtc_cs); - m_rtc->dio_w(data_out); - m_rtc->clk_w(clock); - - m_nvram->cs_w(nvram_cs); - m_nvram->di_w(data_out); - m_nvram->sk_w(clock); -} - -static SLOT_INTERFACE_START( abc1600_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER( abc1600_state::fdc_drq_w ) -{ - update_drdy0(); -} - - -//------------------------------------------------- -// ABC1600BUS_INTERFACE( abcbus_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc1600_state::nmi_w ) -{ - if (state == ASSERT_LINE) - { - m_maincpu->set_input_line(M68K_IRQ_7, ASSERT_LINE); - } -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// IRQ_CALLBACK_MEMBER( abc1600_int_ack ) -//------------------------------------------------- - -IRQ_CALLBACK_MEMBER( abc1600_state::abc1600_int_ack ) -{ - int data = 0; - - switch (irqline) - { - case M68K_IRQ_2: - data = m_cio->intack_r(); - break; - - case M68K_IRQ_5: - data = m_dart->m1_r(); - break; - - case M68K_IRQ_7: - m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); - - data = M68K_INT_ACK_AUTOVECTOR; - break; - } - - return data; -} - - -void abc1600_state::machine_start() -{ - // state saving - save_item(NAME(m_dmadis)); - save_item(NAME(m_sysscc)); - save_item(NAME(m_sysfs)); - save_item(NAME(m_partst)); - save_item(NAME(m_cs7)); - save_item(NAME(m_bus0)); - save_item(NAME(m_csb)); - save_item(NAME(m_atce)); - save_item(NAME(m_btce)); -} - - -void abc1600_state::machine_reset() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - // clear special control register - for (int i = 0; i < 8; i++) - { - spec_contr_reg_w(program, 0, i); - } - - // clear floppy registers - fw0_w(program, 0, 0); - fw1_w(program, 0, 0); - - // clear NMI - m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( abc1600 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( abc1600, abc1600_state ) - // basic machine hardware - MCFG_CPU_ADD(MC68008P8_TAG, M68008, XTAL_64MHz/8) - MCFG_CPU_PROGRAM_MAP(abc1600_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(abc1600_state,abc1600_int_ack) - - MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1600)) // XTAL_64MHz/8/10/20000/8/8 - - // video hardware - MCFG_ABC1600_MOVER_ADD() - - // devices - MCFG_ABC1600_MAC_ADD(MC68008P8_TAG, mac_mem) - - MCFG_DEVICE_ADD(Z8410AB1_0_TAG, Z80DMA, XTAL_64MHz/16) - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(abc1600_state, dbrq_w)) - MCFG_Z80DMA_OUT_BAO_CB(DEVWRITELINE(Z8410AB1_1_TAG, z80dma_device, bai_w)) - MCFG_Z80DMA_IN_MREQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma0_mreq_r)) - MCFG_Z80DMA_OUT_MREQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma0_mreq_w)) - MCFG_Z80DMA_IN_IORQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma0_iorq_r)) - MCFG_Z80DMA_OUT_IORQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma0_iorq_w)) - - MCFG_DEVICE_ADD(Z8410AB1_1_TAG, Z80DMA, XTAL_64MHz/16) - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(abc1600_state, dbrq_w)) - MCFG_Z80DMA_OUT_BAO_CB(DEVWRITELINE(Z8410AB1_2_TAG, z80dma_device, bai_w)) - MCFG_Z80DMA_IN_MREQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma1_mreq_r)) - MCFG_Z80DMA_OUT_MREQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma1_mreq_w)) - MCFG_Z80DMA_IN_IORQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma1_iorq_r)) - MCFG_Z80DMA_OUT_IORQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma1_iorq_w)) - - MCFG_DEVICE_ADD(Z8410AB1_2_TAG, Z80DMA, XTAL_64MHz/16) - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(abc1600_state, dbrq_w)) - MCFG_Z80DMA_IN_MREQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma2_mreq_r)) - MCFG_Z80DMA_OUT_MREQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma2_mreq_w)) - MCFG_Z80DMA_IN_IORQ_CB(DEVREAD8(ABC1600_MAC_TAG, abc1600_mac_device, dma2_iorq_r)) - MCFG_Z80DMA_OUT_IORQ_CB(DEVWRITE8(ABC1600_MAC_TAG, abc1600_mac_device, dma2_iorq_w)) - - MCFG_Z80DART_ADD(Z8470AB1_TAG, XTAL_64MHz/16, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(MC68008P8_TAG, M68K_IRQ_5)) // shared with SCC - - MCFG_DEVICE_ADD(Z8530B1_TAG, SCC8530, XTAL_64MHz/16) - MCFG_Z8530_INTRQ_CALLBACK(INPUTLINE(MC68008P8_TAG, M68K_IRQ_5)) - - MCFG_DEVICE_ADD(Z8536B1_TAG, Z8536, XTAL_64MHz/16) - MCFG_Z8536_IRQ_CALLBACK(INPUTLINE(MC68008P8_TAG, M68K_IRQ_2)) - MCFG_Z8536_PA_IN_CALLBACK(READ8(abc1600_state, cio_pa_r)) - MCFG_Z8536_PB_IN_CALLBACK(READ8(abc1600_state, cio_pb_r)) - MCFG_Z8536_PB_OUT_CALLBACK(WRITE8(abc1600_state, cio_pb_w)) - MCFG_Z8536_PC_IN_CALLBACK(READ8(abc1600_state, cio_pc_r)) - MCFG_Z8536_PC_OUT_CALLBACK(WRITE8(abc1600_state, cio_pc_w)) - - MCFG_NMC9306_ADD(NMC9306_TAG) - MCFG_E0516_ADD(E050_C16PC_TAG, XTAL_32_768kHz) - MCFG_FD1797_ADD(SAB1797_02P_TAG, XTAL_64MHz/64) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pb7_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(abc1600_state, fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD(SAB1797_02P_TAG":0", abc1600_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(SAB1797_02P_TAG":1", abc1600_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(SAB1797_02P_TAG":2", abc1600_floppies, "525qd", floppy_image_device::default_floppy_formats) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z8470AB1_TAG, z80dart_device, rxa_w)) - - MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc99") - MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z8470AB1_TAG, z80dart_device, rxb_w)) - MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z8470AB1_TAG, z80dart_device, rxtxcb_w)) - MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z8470AB1_TAG, z80dart_device, dcdb_w)) - - MCFG_ABCBUS_SLOT_ADD("bus0i", abc1600bus_cards, NULL) - MCFG_ABCBUS_SLOT_IRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa7_w)) - MCFG_ABCBUS_SLOT_ADD("bus0x", abc1600bus_cards, NULL) - MCFG_ABCBUS_SLOT_IRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa6_w)) - MCFG_ABCBUS_SLOT_NMI_CALLBACK(WRITELINE(abc1600_state, nmi_w)) - MCFG_ABCBUS_SLOT_XINT2_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa2_w)) - MCFG_ABCBUS_SLOT_XINT3_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa3_w)) - MCFG_ABCBUS_SLOT_XINT4_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa4_w)) - MCFG_ABCBUS_SLOT_XINT5_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa5_w)) - MCFG_ABCBUS_SLOT_ADD("bus1", abc1600bus_cards, NULL) - MCFG_ABCBUS_SLOT_IRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa1_w)) - MCFG_ABCBUS_SLOT_ADD("bus2", abc1600bus_cards, "4105") - MCFG_ABCBUS_SLOT_IRQ_CALLBACK(DEVWRITELINE(Z8536B1_TAG, z8536_device, pa0_w)) - //MCFG_ABCBUS_SLOT_PREN_CALLBACK(DEVWRITELINE(Z8410AB1_2_TAG, z80dma_device, iei_w)) - MCFG_ABCBUS_SLOT_TRRQ_CALLBACK(DEVWRITELINE(Z8410AB1_2_TAG, z80dma_device, rdy_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1M") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "abc1600") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( abc1600 ) -//------------------------------------------------- - -ROM_START( abc1600 ) - ROM_REGION( 0x71c, "plds", 0 ) - ROM_LOAD( "1020 6490349-01.8b", 0x104, 0x104, CRC(1fa065eb) SHA1(20a95940e39fa98e97e59ea1e548ac2e0c9a3444) ) // expansion bus strobes - ROM_LOAD( "1021 6490350-01.5d", 0x208, 0x104, CRC(96f6f44b) SHA1(12d1cd153dcc99d1c4a6c834122f370d49723674) ) // interrupt encoder and ROM/RAM control - ROM_LOAD( "1023 6490352-01.11e", 0x410, 0x104, CRC(a2f350ac) SHA1(77e08654a197080fa2111bc3031cd2c7699bf82b) ) // interrupt acknowledge - ROM_LOAD( "1024 6490353-01.12e", 0x514, 0x104, CRC(67f1328a) SHA1(b585495fe14a7ae2fbb29f722dca106d59325002) ) // expansion bus timing and control - ROM_LOAD( "1025 6490354-01.6e", 0x618, 0x104, CRC(9bda0468) SHA1(ad373995dcc18532274efad76fa80bd13c23df25) ) // DMA transfer - //ROM_LOAD( "pal16r4.10c", 0x71c, 0x104, NO_DUMP ) // SCC read/write, mentioned in the preliminary service manual, but not present on the PCB -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1985, abc1600, 0, 0, abc1600, abc1600, driver_device, 0, "Luxor", "ABC 1600", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/abc80.c b/src/mess/drivers/abc80.c deleted file mode 100644 index 5bfb37c94db..00000000000 --- a/src/mess/drivers/abc80.c +++ /dev/null @@ -1,630 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Luxor ABC 80 - -PCB Layout ----------- - -55 10470-02 - - CN1 CN2 CN5 - SW1 |-----| |------------------------| |-----| -|-------| |--| |----------------------------------| |---| -| CN3 CN4 | -| 7912 | -| MC1488 | -| MC1489 7812 | -| LS245 LS138 | -| |-------| | -| |-----CN6-----| LS241 LS241 LS138 LS32 |SN76477| LS04 LM339 | -| |-------| | -| |--------------| |------------| PROM0 LS132 LS273 7406 LS08 | -| | Z80A PIO | | Z80A | | -| |--------------| |------------| LS04 LS74A LS86 LS161 LS166 74393 | -| | -| ROM3 LS107 4116 4116 LS10 LS257 LS74A LS08 LS107 PROM2 | -| | -| ROM2 LS257 4116 4116 LS139 74393 LS107 LS32 LS175 74393 | -| | -| ROM1 LS257 4116 4116 LS08 LS283 LS10 LS32 PROM1 74393 | -| | -| ROM0 LS257 4116 4116 LS257 74393 LS375 74S263 LS145 PROM4 | -| | -| DIPSW1 DIPSW2 4045 4045 LS257 LS245 LS375 LS273 LS166 PROM3 | -|--------------------------------------------------------------------------------------| - -Notes: - All IC's shown. - - ROM0-3 - Texas Instruments TMS4732 4Kx8 General Purpose Mask Programmable ROM - PROM0-2 - Philips Semiconductors N82S129 256x4 TTL Bipolar PROM - PROM3-4 - Philips Semiconductors N82S131 512x4 TTL Bipolar PROM - 4116 - Texas Instruments TMS4116-25 16Kx1 Dynamic RAM - 4045 - Texas Instruments TMS4045-15 1Kx4 General Purpose Static RAM with Multiplexed I/O - Z80A - Sharp LH0080A Z80A CPU - Z80APIO - SGS-Thomson Z8420AB1 Z80A PIO - SN76477 - Texas Instruments SN76477N Complex Sound Generator - 74S263 - Texas Instruments SN74S263N Row Output Character Generator - MC1488 - Texas Instruments MC1488 Quadruple Line Driver - MC1489 - Texas Instruments MC1489 Quadruple Line Receiver - CN1 - RS-232 connector - CN2 - ABC bus connector (DIN 41612) - CN3 - video connector - CN4 - cassette motor connector - CN5 - cassette connector - CN6 - keyboard connector - SW1 - reset switch - DIPSW1 - - DIPSW2 - - -*/ - -/* - - TODO: - - - proper keyboard controller emulation - - MyAB TKN80 80-column card - - GeJo 80-column card - - Mikrodatorn 64K expansion - - floppy - - Metric ABC CAD 1000 - -*/ - -#include "includes/abc80.h" - - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -#define LOG 0 - - - -//************************************************************************** -// MEMORY MANAGEMENT -//************************************************************************** - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( abc80_state::read ) -{ - UINT8 data = 0xff; - UINT8 mmu = m_mmu_rom->base()[0x40 | (offset >> 10)]; - - if (!(mmu & MMU_XM)) - { - data = m_bus->xmemfl_r(space, offset); - } - else if (!(mmu & MMU_ROM)) - { - data = m_rom->base()[offset & 0x3fff]; - } - else if (mmu & MMU_VRAMS) - { - data = m_video_ram[offset & 0x3ff]; - } - else if (!(mmu & MMU_RAM)) - { - data = m_ram->pointer()[offset & 0x3fff]; - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( abc80_state::write ) -{ - UINT8 mmu = m_mmu_rom->base()[0x40 | (offset >> 10)]; - - if (!(mmu & MMU_XM)) - { - m_bus->xmemw_w(space, offset, data); - } - else if (mmu & MMU_VRAMS) - { - m_video_ram[offset & 0x3ff] = data; - } - else if (!(mmu & MMU_RAM)) - { - m_ram->pointer()[offset & 0x3fff] = data; - } -} - - - -//************************************************************************** -// SOUND -//************************************************************************** - -//------------------------------------------------- -// vco_voltage_w - CSG VCO voltage select -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc80_state::vco_voltage_w ) -{ - m_psg->vco_voltage_w(state ? 2.5 : 0); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( abc80_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc80_mem, AS_PROGRAM, 8, abc80_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( abc80_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc80_io, AS_IO, 8, abc80_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x17) - AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, inp_r, out_w) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, stat_r, cs_w) - AM_RANGE(0x02, 0x02) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c1_w) - AM_RANGE(0x03, 0x03) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c2_w) - AM_RANGE(0x04, 0x04) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c3_w) - AM_RANGE(0x05, 0x05) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c4_w) - AM_RANGE(0x06, 0x06) AM_WRITE_PORT("SN76477") - AM_RANGE(0x07, 0x07) AM_DEVREAD(ABCBUS_TAG, abcbus_slot_t, rst_r) - AM_RANGE(0x10, 0x13) AM_MIRROR(0x04) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read_alt, write_alt) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( abc80 ) -//------------------------------------------------- - -static INPUT_PORTS_START( abc80 ) - PORT_START("SW1") - PORT_DIPUNKNOWN_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" ) - PORT_DIPUNKNOWN_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) - PORT_DIPUNKNOWN_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" ) - PORT_DIPUNKNOWN_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW1:5" ) - PORT_DIPUNKNOWN_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" ) - PORT_DIPUNKNOWN_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" ) - - PORT_START("SW2") - PORT_DIPUNKNOWN_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW2:1" ) - PORT_DIPUNKNOWN_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW2:2" ) - PORT_DIPUNKNOWN_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW2:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW2:4" ) - PORT_DIPUNKNOWN_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW2:5" ) - PORT_DIPUNKNOWN_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" ) - PORT_DIPUNKNOWN_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" ) - - PORT_START("SN76477") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, enable_w) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, abc80_state, vco_voltage_w) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, vco_w) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, mixer_b_w) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, mixer_a_w) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, mixer_c_w) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, envelope_2_w) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_WRITE_LINE_DEVICE_MEMBER(SN76477_TAG, sn76477_device, envelope_1_w) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// Z80PIO -//------------------------------------------------- - -READ8_MEMBER( abc80_state::pio_pa_r ) -{ - /* - - PIO Port A - - bit description - - 0 keyboard data - 1 keyboard data - 2 keyboard data - 3 keyboard data - 4 keyboard data - 5 keyboard data - 6 keyboard data - 7 keyboard strobe - - */ - - UINT8 data = 0; - - //data |= m_kb->data_r(); - data |= m_key_data; - data |= (m_key_strobe << 7); - - return data; -} - -READ8_MEMBER( abc80_state::pio_pb_r ) -{ - /* - - PIO Channel B - - 0 R RS-232C RxD - 1 R RS-232C _CTS - 2 R RS-232C _DCD - 3 W RS-232C TxD - 4 W RS-232C _RTS - 5 W Cassette Motor - 6 W Cassette Data - 7 R Cassette Data - - */ - - UINT8 data = 0; - - // receive data - data |= m_rs232->rxd_r(); - - // clear to send - data |= m_rs232->cts_r() << 1; - - // data carrier detect - data |= m_rs232->dcd_r() << 2; - - // cassette data - data |= m_tape_in_latch << 7; - - if (LOG) logerror("%s %s read tape latch %u\n", machine().time().as_string(), machine().describe_context(), m_tape_in_latch); - - return data; -} - -WRITE8_MEMBER( abc80_state::pio_pb_w ) -{ - /* - - PIO Channel B - - 0 R RS-232C RxD - 1 R RS-232C _CTS - 2 R RS-232C _DCD - 3 W RS-232C TxD - 4 W RS-232C _RTS - 5 W Cassette Motor - 6 W Cassette Data - 7 R Cassette Data - - */ - - // transmit data - m_rs232->write_txd(BIT(data, 3)); - - // request to send - m_rs232->write_rts(BIT(data, 4)); - - // cassette motor - if (BIT(data, 5)) - { - if (!m_motor) if (LOG) logerror("%s %s started cassette motor\n", machine().time().as_string(), machine().describe_context()); - m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_motor = true; - } - else - { - if (m_motor) if (LOG) logerror("%s %s stopped cassette motor\n", machine().time().as_string(), machine().describe_context()); - m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_motor = false; - } - - // cassette data - m_cassette->output(BIT(data, 6) ? -1.0 : +1.0); - - // cassette input latch - if (BIT(data, 6)) - { - if (LOG) logerror("%s %s clear tape in latch\n", machine().time().as_string(), machine().describe_context()); - - m_tape_in_latch = 1; - - m_pio->pb7_w(m_tape_in_latch); - } -} - - -//------------------------------------------------- -// Z80 Daisy Chain -//------------------------------------------------- - -static const z80_daisy_config abc80_daisy_chain[] = -{ - { Z80PIO_TAG }, - { NULL } -}; - - -//------------------------------------------------- -// ABC80_KEYBOARD_INTERFACE( kb_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc80_state::keydown_w ) -{ - m_key_strobe = state; - - m_pio->port_a_write(m_key_strobe << 7); -} - -WRITE8_MEMBER( abc80_state::kbd_w ) -{ - m_key_data = data; - m_key_strobe = 1; - - UINT8 pio_data = 0x80 | data; - m_pio->port_a_write(pio_data); - - timer_set(attotime::from_msec(50), TIMER_ID_FAKE_KEYBOARD_CLEAR); -} - -/* -DEVICE_INPUT_DEFAULTS_START( abc830_slow ) - DEVICE_INPUT_DEFAULTS("SW1", 0x0f, 0x03) - DEVICE_INPUT_DEFAULTS("S1", 0x01, 0x01) -DEVICE_INPUT_DEFAULTS_END -*/ - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void abc80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_ID_PIO: - m_pio_astb = !m_pio_astb; - - m_pio->strobe_a(m_pio_astb); - break; - - case TIMER_ID_CASSETTE: - { - if (!m_motor) return; - - int tape_in = m_cassette->input() > 0; - - if (m_tape_in != tape_in) - if (LOG) logerror("%s tape flank %u\n", machine().time().as_string(), tape_in); - - if (m_tape_in_latch && (m_tape_in != tape_in)) - { - if (LOG) logerror("%s set tape in latch\n", machine().time().as_string()); - m_tape_in_latch = 0; - - m_pio->port_b_write(m_tape_in_latch << 7); - } - - m_tape_in = tape_in; - } - break; - - case TIMER_ID_BLINK: - m_blink = !m_blink; - break; - - case TIMER_ID_VSYNC_ON: - if (LOG) logerror("%s vsync 1\n", machine().time().as_string()); - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - break; - - case TIMER_ID_VSYNC_OFF: - if (LOG) logerror("%s vsync 0\n", machine().time().as_string()); - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - break; - - case TIMER_ID_FAKE_KEYBOARD_CLEAR: - m_pio->port_a_write(m_key_data); - m_key_strobe = 0; - m_key_data = 0; - break; - } -} - - -//------------------------------------------------- -// MACHINE_START( abc80 ) -//------------------------------------------------- - -void abc80_state::machine_start() -{ - // start timers - m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE); - m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); - - // register for state saving - save_item(NAME(m_key_data)); - save_item(NAME(m_key_strobe)); - save_item(NAME(m_pio_astb)); - save_item(NAME(m_latch)); - save_item(NAME(m_blink)); - save_item(NAME(m_motor)); - save_item(NAME(m_tape_in)); - save_item(NAME(m_tape_in_latch)); -} - -QUICKLOAD_LOAD_MEMBER( abc80_state, bac ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - offs_t address = space.read_byte(BOFA + 1) << 8 | space.read_byte(BOFA); - if (LOG) logerror("BOFA %04x\n",address); - - dynamic_buffer data; - data.resize(quickload_size); - image.fread(&data[0], quickload_size); - for (int i = 1; i < quickload_size; i++) - space.write_byte(address++, data[i]); - - offs_t eofa = address; - space.write_byte(EOFA, eofa & 0xff); - space.write_byte(EOFA + 1, eofa >> 8); - if (LOG) logerror("EOFA %04x\n",address); - - offs_t head = address + 1; - space.write_byte(HEAD, head & 0xff); - space.write_byte(HEAD + 1, head >> 8); - if (LOG) logerror("HEAD %04x\n",address); - - return IMAGE_INIT_PASS; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( abc80 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( abc80, abc80_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_11_9808MHz/2/2) // 2.9952 MHz - MCFG_CPU_PROGRAM_MAP(abc80_mem) - MCFG_CPU_IO_MAP(abc80_io) - MCFG_CPU_CONFIG(abc80_daisy_chain) - - // video hardware - MCFG_FRAGMENT_ADD(abc80_video) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SN76477_TAG, SN76477, 0) - MCFG_SN76477_NOISE_PARAMS(RES_K(47), RES_K(330), CAP_P(390)) // noise + filter: R26 47k - R24 330k - C52 390p - MCFG_SN76477_DECAY_RES(RES_K(47)) // decay_res: R23 47k - MCFG_SN76477_ATTACK_PARAMS(CAP_U(10), RES_K(2.2)) // attack_decay_cap + attack_res: C50 10u/35V - R21 2.2k - MCFG_SN76477_AMP_RES(RES_K(33)) // amplitude_res: R19 33k - MCFG_SN76477_FEEDBACK_RES(RES_K(10)) // feedback_res: R18 10k - MCFG_SN76477_VCO_PARAMS(0, CAP_N(10), RES_K(100)) // VCO volt + cap + res: 0V or 2.5V - C48 10n - R20 100k - MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage: N/C - MCFG_SN76477_SLF_PARAMS(CAP_U(1), RES_K(220)) // slf caps + res: C51 1u/35V - R22 220k - MCFG_SN76477_ONESHOT_PARAMS(CAP_U(0.1), RES_K(330)) // oneshot caps + res: C53 0.1u - R25 330k - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_11_9808MHz/2/2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(abc80_state, pio_pa_r)) - MCFG_Z80PIO_IN_PB_CB(READ8(abc80_state, pio_pb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(abc80_state, pio_pb_w)) - - MCFG_CASSETTE_ADD(CASSETTE_TAG) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("abc80_cass") - - MCFG_DEVICE_ADD(ABC80_KEYBOARD_TAG, ABC80_KEYBOARD, 0) - MCFG_ABC80_KEYBOARD_KEYDOWN_CALLBACK(WRITELINE(abc80_state, keydown_w)) - - MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abc80_cards, "abcexp") - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(abc80_state, kbd_w)) - - MCFG_QUICKLOAD_ADD("quickload", abc80_state, bac, "bac", 2) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - - // software list - MCFG_SOFTWARE_LIST_ADD("cass_list", "abc80_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "abc80_flop") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( abc80 ) -//------------------------------------------------- - -ROM_START( abc80 ) - ROM_REGION( 0x4000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS("v2") - ROM_SYSTEM_BIOS( 0, "v1", "V1" ) - ROMX_LOAD( "3506_3.a5", 0x0000, 0x1000, CRC(7c004fb6) SHA1(9aee1d085122f4537c3e6ecdab9d799bd429ef52), ROM_BIOS(1) ) - ROMX_LOAD( "3507_3.a3", 0x1000, 0x1000, CRC(d1850a84) SHA1(f7719f3af9173601a2aa23ae38ae00de1a387ad8), ROM_BIOS(1) ) - ROMX_LOAD( "3508_3.a4", 0x2000, 0x1000, CRC(b55528e9) SHA1(3e5017e8cacad1f13215242f1bbd89d1d3eee131), ROM_BIOS(1) ) - ROMX_LOAD( "3509_3.a2", 0x3000, 0x1000, CRC(659cab1e) SHA1(181db748cef22cdcccd311a60aa6189c85343db7), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v2", "V2" ) - ROMX_LOAD( "3506_3_v2.a5", 0x0000, 0x1000, CRC(e2afbf48) SHA1(9883396edd334835a844dcaa792d29599a8c67b9), ROM_BIOS(2) ) - ROMX_LOAD( "3507_3_v2.a3", 0x1000, 0x1000, CRC(d224412a) SHA1(30968054bba7c2aecb4d54864b75a446c1b8fdb1), ROM_BIOS(2) ) - ROMX_LOAD( "3508_3_v2.a4", 0x2000, 0x1000, CRC(1502ba5b) SHA1(5df45909c2c4296e5701c6c99dfaa9b10b3a729b), ROM_BIOS(2) ) - ROMX_LOAD( "3509_3_v2.a2", 0x3000, 0x1000, CRC(bc8860b7) SHA1(28b6cf7f5a4f81e017c2af091c3719657f981710), ROM_BIOS(2) ) - - ROM_REGION( 0xa00, "chargen", 0 ) - ROM_LOAD( "sn74s263.h2", 0x0000, 0x0a00, BAD_DUMP CRC(9e064e91) SHA1(354783c8f2865f73dc55918c9810c66f3aca751f) ) // created by hand - - ROM_REGION( 0x100, "hsync", 0 ) - ROM_LOAD( "abc80_11.k5", 0x0000, 0x0100, CRC(e4f7e018) SHA1(63e718a39537f37286ea183e6469808c271dbfa5) ) // "64 40029-01" 82S129 256x4 horizontal sync - - ROM_REGION( 0x200, "vsync", 0 ) - ROM_LOAD( "abc80_21.k2", 0x0000, 0x0200, CRC(445a45b9) SHA1(bcc1c4fafe68b3500b03de785ca32abd63cea252) ) // "64 40030-01" 82S131 512x4 vertical sync - - ROM_REGION( 0x100, "attr", 0 ) - ROM_LOAD( "abc80_12.j3", 0x0000, 0x0100, CRC(6c46811c) SHA1(2d3bdf2d3a2a88ddb1c0c637967e1b2b9541a928) ) // "64 40056-01" 82S129 256x4 attribute - - ROM_REGION( 0x200, "line", 0 ) - ROM_LOAD( "abc80_22.k1", 0x0000, 0x0200, CRC(74de7a0b) SHA1(96f37b0ca65aa8af4242bad38124f410b7f657fe) ) // "64 40058-01" 82S131 512x4 chargen 74S263 row address - - ROM_REGION( 0x100, "mmu", 0 ) - ROM_LOAD( "abc80_13.e7", 0x0000, 0x0100, CRC(f7738834) SHA1(b02df3e678fb50c9cb75b4a97615222d3b4577a3) ) // "64 40057-01" 82S129 256x4 address decoder -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1978, abc80, 0, 0, abc80, abc80, driver_device, 0, "Luxor Datorer AB", "ABC 80", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_KEYBOARD ) diff --git a/src/mess/drivers/abc80x.c b/src/mess/drivers/abc80x.c deleted file mode 100644 index a328baa87c0..00000000000 --- a/src/mess/drivers/abc80x.c +++ /dev/null @@ -1,1641 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Luxor ABC 800C/800M - -Main PCB Layout ---------------- - -|-----------------------|-----------------------------------| -| 4116 4116 | | -| 4116 4116 | | -| 4116 4116 | | -| 4116 4116 | Z80 Z80CTC | -| 4116 4116 |CN1 | -| 4116 4116 | | -| 4116 4116 | Z80DART | -| | CN6 | -| ROM3 ROM7 | | -| | Z80SIO2 | -| ROM2 ROM6 |-----------------------------------| -| | -| ROM1 ROM5 | -| CN2 | -| ROM0 ROM4 | -| CN7 | -|-------------------------------------------| CN3 | -| | | -| | | -| | CN4 | -| | | -| VIDEO BOARD | | -| | CN5 | -| | | -| | | -| | | -|-------------------------------------------|---------------| - -Notes: - Relevant IC's shown. - - Z80 - ? Z80A CPU (labeled "Z80A (800) KASS.") - Z80CTC - Sharp LH0082A Z80A-CTC - Z80DART - SGS Z8470AB1 Z80A-DART - Z8OSIO2 - SGS Z8442AB1 Z80A-SIO/2 - 4116 - Toshiba TMS4116-20NL 1Kx8 RAM - ROM0 - NEC D2732D 4Kx8 EPROM "ABC M-12" - ROM1 - NEC D2732D 4Kx8 EPROM "ABC 1-12" - ROM2 - NEC D2732D 4Kx8 EPROM "ABC 2-12" - ROM3 - NEC D2732D 4Kx8 EPROM "ABC 3-12" - ROM4 - NEC D2732D 4Kx8 EPROM "ABC 4-12" - ROM5 - NEC D2732D 4Kx8 EPROM "ABC 5-12" - ROM6 - Hitachi HN462732G 4Kx8 EPROM "ABC 6-52" - ROM7 - NEC D2732D 4Kx8 EPROM "ABC 7-22" - CN1 - ABC bus connector - CN2 - tape connector - CN3 - RS-232 channel B connector - CN4 - RS-232 channel A connector - CN5 - video connector - CN6 - keyboard connector - CN7 - video board connector - - -Video PCB Layout (Color) ------------------------- - -55 10789-01 - -|-------------------------------------------| -| | -| | -| 2114 | -| | -| 2114 TROM | -| | -| 12MHz TIC | -| | -| | -|-------------------------------------------| - -Notes: - Relevant IC's shown. - - 2114 - GTE Microcircuits 2114-2CB 1Kx4 RAM - TIC - Philips SAA5020 Teletext Timing Chain - TROM - Philips SAA5052 Teletext Character Generator w/Swedish Character Set - - -Video PCB Layout (Monochrome) ------------------------------ - -55 10790-02 - -|-------------------------------------------| -| | -| 2114 | -| 2114 | -| 12MHz| -| 2114 | -| 2114 | -| | -| CRTC ROM0 | -| | -|-------------------------------------------| - -Notes: - Relevant IC's shown. - - 2114 - Toshiba TMM314AP-1 1Kx4 RAM - CRTC - Hitachi HD46505SP CRTC - ROM0 - NEC D2716D 2Kx8 EPROM "VUM SE" - - -Video PCB Layout (High Resolution) ----------------------------------- - -55 10791-01 - -|-------------------------------------------| -| | -| 4116 PROM1 | -| 4116 | -| 4116 | -| 4116 | -| 4116 | -| 4116 | -| 4116 | -| 4116 PROM0 | -|-------------------------------------------| - -Notes: - Relevant IC's shown. - - 4116 - Motorola MCM4116AC25 1Kx8 RAM - PROM0 - Philips 82S123 32x8 Bipolar PROM "HRU I" - PROM1 - Philips 82S131 512x4 Bipolar PROM "HRU II" - -*/ - -/* - - TODO: - - - cassette - - abc806 RTC - - abc806 disks except ufd631 won't boot - -*/ - -#include "includes/abc80x.h" - - - -//************************************************************************** -// SOUND -//************************************************************************** - -//------------------------------------------------- -// DISCRETE_SOUND( abc800 ) -//------------------------------------------------- - -static DISCRETE_SOUND_START( abc800 ) - DISCRETE_INPUT_LOGIC(NODE_01) - DISCRETE_OUTPUT(NODE_01, 5000) -DISCRETE_SOUND_END - - -//------------------------------------------------- -// pling_r - speaker read -//------------------------------------------------- - -READ8_MEMBER( abc800_state::pling_r ) -{ - m_pling = !m_pling; - - m_discrete->write(space, NODE_01, m_pling); - - return 0xff; -} - - -//------------------------------------------------- -// pling_r - speaker read -//------------------------------------------------- - -READ8_MEMBER( abc802_state::pling_r ) -{ - m_pling = !m_pling; - - m_discrete->write(space, NODE_01, m_pling); - - return 0xff; -} - - - -//************************************************************************** -// MEMORY BANKING -//************************************************************************** - -//------------------------------------------------- -// bankswitch -//------------------------------------------------- - -void abc800_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - if (m_fetch_charram) - { - // HR video RAM selected - program.install_ram(0x0000, 0x3fff, m_video_ram); - } - else - { - // BASIC ROM selected - program.install_rom(0x0000, 0x3fff, m_rom->base()); - } -} - - -//------------------------------------------------- -// bankswitch -//------------------------------------------------- - -void abc802_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - if (m_lrs) - { - // ROM and video RAM selected - program.install_rom(0x0000, 0x77ff, m_rom->base()); - program.install_ram(0x7800, 0x7fff, m_char_ram); - } - else - { - // low RAM selected - program.install_ram(0x0000, 0x7fff, m_ram->pointer()); - } -} - - -//------------------------------------------------- -// bankswitch -//------------------------------------------------- - -void abc806_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT32 videoram_mask = m_ram->size() - (32 * 1024) - 1; - int bank; - char bank_name[10]; - - if (!m_keydtr) - { - // 32K block mapping - - UINT32 videoram_start = (m_hrs & 0xf0) << 11; - - for (bank = 1; bank <= 8; bank++) - { - // 0x0000-0x7FFF is video RAM - - UINT16 start_addr = 0x1000 * (bank - 1); - UINT16 end_addr = start_addr + 0xfff; - UINT32 videoram_offset = (videoram_start + start_addr) & videoram_mask; - sprintf(bank_name,"bank%d",bank); - //logerror("%04x-%04x: Video RAM %04x (32K)\n", start_addr, end_addr, videoram_offset); - - program.install_readwrite_bank(start_addr, end_addr, bank_name); - membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset); - membank(bank_name)->set_entry(1); - } - - for (bank = 9; bank <= 16; bank++) - { - // 0x8000-0xFFFF is main RAM - - UINT16 start_addr = 0x1000 * (bank - 1); - UINT16 end_addr = start_addr + 0xfff; - sprintf(bank_name,"bank%d",bank); - //logerror("%04x-%04x: Work RAM (32K)\n", start_addr, end_addr); - - program.install_readwrite_bank(start_addr, end_addr, bank_name); - membank(bank_name)->set_entry(0); - } - } - else - { - // 4K block mapping - - for (bank = 1; bank <= 16; bank++) - { - UINT16 start_addr = 0x1000 * (bank - 1); - UINT16 end_addr = start_addr + 0xfff; - UINT8 map = m_map[bank - 1]; - UINT32 videoram_offset = ((map & 0x7f) << 12) & videoram_mask; - sprintf(bank_name,"bank%d",bank); - if (BIT(map, 7) && m_eme) - { - // map to video RAM - //logerror("%04x-%04x: Video RAM %04x (4K)\n", start_addr, end_addr, videoram_offset); - - program.install_readwrite_bank(start_addr, end_addr, bank_name); - membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset); - membank(bank_name)->set_entry(1); - } - else - { - // map to ROM/RAM - - switch (bank) - { - case 1: case 2: case 3: case 4: case 5: case 6: case 7: - // ROM - //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr); - - program.install_read_bank(start_addr, end_addr, bank_name); - program.unmap_write(start_addr, end_addr); - membank(bank_name)->set_entry(0); - break; - - case 8: - // ROM/char RAM - //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr); - - program.install_read_bank(0x7000, 0x77ff, bank_name); - program.unmap_write(0x7000, 0x77ff); - program.install_readwrite_handler(0x7800, 0x7fff, 0, 0, READ8_DELEGATE(abc806_state, charram_r), WRITE8_DELEGATE(abc806_state, charram_w)); - membank(bank_name)->set_entry(0); - break; - - default: - // work RAM - //logerror("%04x-%04x: Work RAM (4K)\n", start_addr, end_addr); - - program.install_readwrite_bank(start_addr, end_addr, bank_name); - membank(bank_name)->set_entry(0); - break; - } - } - } - } - - if (m_fetch_charram) - { - // 30K block mapping - - UINT32 videoram_start = (m_hrs & 0xf0) << 11; - - for (bank = 1; bank <= 8; bank++) - { - // 0x0000-0x77FF is video RAM - - UINT16 start_addr = 0x1000 * (bank - 1); - UINT16 end_addr = start_addr + 0xfff; - UINT32 videoram_offset = (videoram_start + start_addr) & videoram_mask; - sprintf(bank_name,"bank%d",bank); - //logerror("%04x-%04x: Video RAM %04x (30K)\n", start_addr, end_addr, videoram_offset); - - if (start_addr == 0x7000) - { - program.install_readwrite_bank(0x7000, 0x77ff, bank_name); - program.install_readwrite_handler(0x7800, 0x7fff, 0, 0, READ8_DELEGATE(abc806_state, charram_r), WRITE8_DELEGATE(abc806_state, charram_w)); - } - else - { - program.install_readwrite_bank(start_addr, end_addr, bank_name); - } - - membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset); - membank(bank_name)->set_entry(1); - } - } -} - - -//------------------------------------------------- -// mai_r - memory bank map read -//------------------------------------------------- - -READ8_MEMBER( abc806_state::mai_r ) -{ - int bank = offset >> 12; - - return m_map[bank]; -} - - -//------------------------------------------------- -// mao_w - memory bank map write -//------------------------------------------------- - -WRITE8_MEMBER( abc806_state::mao_w ) -{ - /* - - bit description - - 0 physical block address bit 0 - 1 physical block address bit 1 - 2 physical block address bit 2 - 3 physical block address bit 3 - 4 physical block address bit 4 - 5 - 6 - 7 allocate block - - */ - - int bank = offset >> 12; - - m_map[bank] = data; - - bankswitch(); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( abc800c_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc800c_mem, AS_PROGRAM, 8, abc800c_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0x4000, 0x7bff) AM_ROM - AM_RANGE(0x7c00, 0x7fff) AM_RAM AM_SHARE("char_ram") - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( abc800c_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc800c_io, AS_IO, 8, abc800_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_MIRROR(0x18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, inp_r, out_w) - AM_RANGE(0x01, 0x01) AM_MIRROR(0x18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, stat_r, cs_w) - AM_RANGE(0x02, 0x02) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c1_w) - AM_RANGE(0x03, 0x03) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c2_w) - AM_RANGE(0x04, 0x04) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c3_w) - AM_RANGE(0x05, 0x05) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c4_w) - AM_RANGE(0x05, 0x05) AM_MIRROR(0x18) AM_READ(pling_r) - AM_RANGE(0x06, 0x06) AM_MIRROR(0x18) AM_WRITE(hrs_w) - AM_RANGE(0x07, 0x07) AM_MIRROR(0x18) AM_DEVREAD(ABCBUS_TAG, abcbus_slot_t, rst_r) AM_WRITE(hrc_w) - AM_RANGE(0x20, 0x23) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x40, 0x43) AM_MIRROR(0x1c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio2_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x60, 0x63) AM_MIRROR(0x1c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( abc800m_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc800m_mem, AS_PROGRAM, 8, abc800_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0x4000, 0x77ff) AM_ROM - AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE("char_ram") - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( abc800m_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc800m_io, AS_IO, 8, abc800_state ) - AM_IMPORT_FROM( abc800c_io ) - AM_RANGE(0x31, 0x31) AM_MIRROR(0x06) AM_DEVREAD(MC6845_TAG, mc6845_device, register_r) - AM_RANGE(0x38, 0x38) AM_MIRROR(0x06) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) - AM_RANGE(0x39, 0x39) AM_MIRROR(0x06) AM_DEVWRITE(MC6845_TAG, mc6845_device, register_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( abc802_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc802_mem, AS_PROGRAM, 8, abc802_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x77ff) AM_ROM - AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE("char_ram") - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( abc802_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc802_io, AS_IO, 8, abc802_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_MIRROR(0x18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, inp_r, out_w) - AM_RANGE(0x01, 0x01) AM_MIRROR(0x18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, stat_r, cs_w) - AM_RANGE(0x02, 0x02) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c1_w) - AM_RANGE(0x03, 0x03) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c2_w) - AM_RANGE(0x04, 0x04) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c3_w) - AM_RANGE(0x05, 0x05) AM_MIRROR(0x18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c4_w) - AM_RANGE(0x05, 0x05) AM_MIRROR(0x08) AM_READ(pling_r) - AM_RANGE(0x07, 0x07) AM_MIRROR(0x18) AM_DEVREAD(ABCBUS_TAG, abcbus_slot_t, rst_r) - AM_RANGE(0x20, 0x23) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x31, 0x31) AM_MIRROR(0x06) AM_DEVREAD(MC6845_TAG, mc6845_device, register_r) - AM_RANGE(0x38, 0x38) AM_MIRROR(0x06) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) - AM_RANGE(0x39, 0x39) AM_MIRROR(0x06) AM_DEVWRITE(MC6845_TAG, mc6845_device, register_w) - AM_RANGE(0x40, 0x43) AM_MIRROR(0x1c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio2_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x60, 0x63) AM_MIRROR(0x1c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( abc806_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc806_mem, AS_PROGRAM, 8, abc806_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") - AM_RANGE(0x1000, 0x1fff) AM_RAMBANK("bank2") - AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") - AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4") - AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank5") - AM_RANGE(0x5000, 0x5fff) AM_RAMBANK("bank6") - AM_RANGE(0x6000, 0x6fff) AM_RAMBANK("bank7") - AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank8") - AM_RANGE(0x8000, 0x8fff) AM_RAMBANK("bank9") - AM_RANGE(0x9000, 0x9fff) AM_RAMBANK("bank10") - AM_RANGE(0xa000, 0xafff) AM_RAMBANK("bank11") - AM_RANGE(0xb000, 0xbfff) AM_RAMBANK("bank12") - AM_RANGE(0xc000, 0xcfff) AM_RAMBANK("bank13") - AM_RANGE(0xd000, 0xdfff) AM_RAMBANK("bank14") - AM_RANGE(0xe000, 0xefff) AM_RAMBANK("bank15") - AM_RANGE(0xf000, 0xffff) AM_RAMBANK("bank16") -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( abc806_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc806_io, AS_IO, 8, abc806_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, inp_r, out_w) - AM_RANGE(0x01, 0x01) AM_MIRROR(0xff18) AM_DEVREADWRITE(ABCBUS_TAG, abcbus_slot_t, stat_r, cs_w) - AM_RANGE(0x02, 0x02) AM_MIRROR(0xff18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c1_w) - AM_RANGE(0x03, 0x03) AM_MIRROR(0xff18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c2_w) - AM_RANGE(0x04, 0x04) AM_MIRROR(0xff18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c3_w) - AM_RANGE(0x05, 0x05) AM_MIRROR(0xff18) AM_DEVWRITE(ABCBUS_TAG, abcbus_slot_t, c4_w) - AM_RANGE(0x06, 0x06) AM_MIRROR(0xff18) AM_WRITE(hrs_w) - AM_RANGE(0x07, 0x07) AM_MIRROR(0xff18) AM_DEVREAD(ABCBUS_TAG, abcbus_slot_t, rst_r) AM_WRITE(hrc_w) - AM_RANGE(0x20, 0x23) AM_MIRROR(0xff0c) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x31, 0x31) AM_MIRROR(0xff00) AM_DEVREAD(MC6845_TAG, mc6845_device, register_r) - AM_RANGE(0x34, 0x34) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_READWRITE(mai_r, mao_w) - AM_RANGE(0x35, 0x35) AM_MIRROR(0xff00) AM_READWRITE(ami_r, amo_w) - AM_RANGE(0x36, 0x36) AM_MIRROR(0xff00) AM_READWRITE(sti_r, sto_w) - AM_RANGE(0x37, 0x37) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_READWRITE(cli_r, sso_w) - AM_RANGE(0x38, 0x38) AM_MIRROR(0xff00) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) - AM_RANGE(0x39, 0x39) AM_MIRROR(0xff00) AM_DEVWRITE(MC6845_TAG, mc6845_device, register_w) - AM_RANGE(0x40, 0x43) AM_MIRROR(0xff1c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio2_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x60, 0x63) AM_MIRROR(0xff1c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( abc800 ) -//------------------------------------------------- - -INPUT_PORTS_START( abc800 ) - PORT_START("SB") - PORT_DIPNAME( 0xff, 0xaa, "Serial Communications" ) PORT_DIPLOCATION("SB:1,2,3,4,5,6,7,8") - PORT_DIPSETTING( 0xaa, "Asynchronous, Single Speed" ) - PORT_DIPSETTING( 0x2e, "Asynchronous, Split Speed" ) - PORT_DIPSETTING( 0x50, "Synchronous" ) - PORT_DIPSETTING( 0x8b, "ABC NET" ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( abc802 ) -//------------------------------------------------- - -static INPUT_PORTS_START( abc802 ) - PORT_START("SB") - PORT_DIPNAME( 0xff, 0xaa, "Serial Communications" ) PORT_DIPLOCATION("SB:1,2,3,4,5,6,7,8") - PORT_DIPSETTING( 0xaa, "Asynchronous, Single Speed" ) - PORT_DIPSETTING( 0x2e, "Asynchronous, Split Speed" ) - PORT_DIPSETTING( 0x50, "Synchronous" ) - PORT_DIPSETTING( 0x8b, "ABC NET" ) - - PORT_START("CONFIG") - PORT_DIPNAME( 0x01, 0x00, "Clear Screen Time Out" ) PORT_DIPLOCATION("S1:1") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("S2:1") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "Characters Per Line" ) PORT_DIPLOCATION("S3:1") - PORT_DIPSETTING( 0x00, "40" ) - PORT_DIPSETTING( 0x04, "80" ) - PORT_DIPNAME( 0x08, 0x08, "Frame Frequency" ) - PORT_DIPSETTING( 0x00, "60 Hz" ) - PORT_DIPSETTING( 0x08, "50 Hz" ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( abc806 ) -//------------------------------------------------- - -static INPUT_PORTS_START( abc806 ) - PORT_START("SB") - PORT_DIPNAME( 0xff, 0xaa, "Serial Communications" ) PORT_DIPLOCATION("SB:1,2,3,4,5,6,7,8") - PORT_DIPSETTING( 0xaa, "Asynchronous, Single Speed" ) - PORT_DIPSETTING( 0x2e, "Asynchronous, Split Speed" ) - PORT_DIPSETTING( 0x50, "Synchronous" ) - PORT_DIPSETTING( 0x8b, "ABC NET" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// Z80CTC -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc800_state::ctc_z0_w ) -{ - if (BIT(m_sb, 2)) - { - m_sio->txca_w(state); - m_ctc->trg3(state); - } - - clock_cassette(state); -} - -WRITE_LINE_MEMBER( abc800_state::ctc_z1_w ) -{ - if (BIT(m_sb, 3)) - { - m_sio->rxca_w(state); - } - - if (BIT(m_sb, 4)) - { - m_sio->txca_w(state); - m_ctc->trg3(state); - } -} - -WRITE_LINE_MEMBER( abc800_state::ctc_z2_w ) -{ - m_dart->rxca_w(state); - m_dart->txca_w(state); -} - -//------------------------------------------------- -// Z80SIO -//------------------------------------------------- - -void abc800_state::clock_cassette(int state) -{ - if (m_cassette == NULL) return; - - if (m_ctc_z0 && !state) - { - m_sio_txcb = !m_sio_txcb; - m_sio->txcb_w(!m_sio_txcb); - - if (m_sio_txdb || m_sio_txcb) - { - m_dfd_out = !m_dfd_out; - m_cassette->output((m_dfd_out & m_sio_rtsb) ? +1.0 : -1.0); - } - - if (m_tape_ctr < 15) - { - m_tape_ctr++; - } - - m_sio->rxcb_w(m_tape_ctr == 15); - } - - m_ctc_z0 = state; -} - -WRITE_LINE_MEMBER( abc800_state::sio_txdb_w ) -{ - m_sio_txdb = state; -} - -WRITE_LINE_MEMBER( abc800_state::sio_dtrb_w ) -{ - if (m_cassette == NULL) return; - - if (state) - { - m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_cassette_timer->enable(true); - } - else - { - m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_cassette_timer->enable(false); - } -} - -WRITE_LINE_MEMBER( abc800_state::sio_rtsb_w ) -{ - if (m_cassette == NULL) return; - - m_sio_rtsb = state; - - if (!m_sio_rtsb) - { - m_cassette->output(-1.0); - } -} - -//------------------------------------------------- -// Z80DART abc802 -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc802_state::lrs_w ) -{ - m_lrs = state; - - bankswitch(); -} - -WRITE_LINE_MEMBER( abc802_state::mux80_40_w ) -{ - m_80_40_mux = state; -} - -//------------------------------------------------- -// Z80DART abc806 -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc806_state::keydtr_w ) -{ - m_keydtr = state; - - bankswitch(); -} - -//------------------------------------------------- -// z80_daisy_config abc800_daisy_chain -//------------------------------------------------- - -static const z80_daisy_config abc800_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80SIO_TAG }, - { Z80DART_TAG }, - { NULL } -}; - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void abc800_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_ID_CTC: - m_ctc->trg0(1); - m_ctc->trg0(0); - - m_ctc->trg1(1); - m_ctc->trg1(0); - - m_ctc->trg2(1); - m_ctc->trg2(0); - break; - - case TIMER_ID_CASSETTE: - { - int dfd_in = m_cassette->input() > 0; - - if (m_dfd_in && !dfd_in) - { - m_sio->rxb_w(!(m_tape_ctr == 15)); - } - - if (!dfd_in && (m_tape_ctr == 15)) - { - m_tape_ctr = 4; - } - - m_dfd_in = dfd_in; - } - break; - } -} - - -//------------------------------------------------- -// machine_start -//------------------------------------------------- - -void abc800_state::machine_start() -{ - // start timers - m_ctc_timer = timer_alloc(TIMER_ID_CTC); - m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2)); - - m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE); - m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); - m_cassette_timer->enable(false); - - // register for state saving - save_item(NAME(m_fetch_charram)); - save_item(NAME(m_pling)); - save_item(NAME(m_sb)); - save_item(NAME(m_ctc_z0)); - save_item(NAME(m_sio_txcb)); - save_item(NAME(m_sio_txdb)); - save_item(NAME(m_sio_rtsb)); - save_item(NAME(m_dfd_out)); - save_item(NAME(m_dfd_in)); - save_item(NAME(m_tape_ctr)); -} - - -//------------------------------------------------- -// machine_reset -//------------------------------------------------- - -void abc800_state::machine_reset() -{ - m_sb = m_io_sb->read(); - - m_fetch_charram = 0; - bankswitch(); - - m_dart->ria_w(1); - - // 50/60 Hz - m_dart->ctsb_w(0); // 0 = 50Hz, 1 = 60Hz - - m_dfd_in = 0; -} - - -//------------------------------------------------- -// machine_start -//------------------------------------------------- - -void abc802_state::machine_start() -{ - // start timers - m_ctc_timer = timer_alloc(TIMER_ID_CTC); - m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2)); - - m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE); - m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); - - // register for state saving - save_item(NAME(m_pling)); - save_item(NAME(m_sb)); - save_item(NAME(m_ctc_z0)); - save_item(NAME(m_sio_txcb)); - save_item(NAME(m_sio_txdb)); - save_item(NAME(m_sio_rtsb)); - save_item(NAME(m_dfd_out)); - save_item(NAME(m_dfd_in)); - save_item(NAME(m_tape_ctr)); - save_item(NAME(m_lrs)); -} - - -//------------------------------------------------- -// machine_reset -//------------------------------------------------- - -void abc802_state::machine_reset() -{ - UINT8 config = m_config->read(); - m_sb = m_io_sb->read(); - - // memory banking - m_lrs = 1; - bankswitch(); - - // clear screen time out (S1) - m_sio->dcdb_w(BIT(config, 0)); - - // unknown (S2) - m_sio->ctsb_w(BIT(config, 1)); - - // 40/80 char (S3) - m_dart->ria_w(BIT(config, 2)); // 0 = 40, 1 = 80 - - // 50/60 Hz - m_dart->ctsb_w(BIT(config, 3)); // 0 = 50Hz, 1 = 60Hz - - m_dfd_in = 0; -} - - -//------------------------------------------------- -// machine_start -//------------------------------------------------- - -void abc806_state::machine_start() -{ - // start timers - m_ctc_timer = timer_alloc(TIMER_ID_CTC); - m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2)); - - // setup memory banking - UINT8 *mem = m_rom->base(); - UINT32 videoram_size = m_ram->size() - (32 * 1024); - int bank; - char bank_name[10]; - - m_video_ram.allocate(videoram_size); - - for (bank = 1; bank <= 16; bank++) - { - sprintf(bank_name,"bank%d",bank); - membank(bank_name)->configure_entry(0, mem + (0x1000 * (bank - 1))); - membank(bank_name)->configure_entry(1, m_video_ram); - membank(bank_name)->set_entry(0); - } - - // register for state saving - save_item(NAME(m_fetch_charram)); - save_item(NAME(m_pling)); - save_item(NAME(m_sb)); - save_item(NAME(m_ctc_z0)); - save_item(NAME(m_sio_txcb)); - save_item(NAME(m_sio_txdb)); - save_item(NAME(m_sio_rtsb)); - save_item(NAME(m_dfd_out)); - save_item(NAME(m_dfd_in)); - save_item(NAME(m_tape_ctr)); - save_item(NAME(m_keydtr)); - save_item(NAME(m_eme)); - save_item(NAME(m_map)); -} - - -//------------------------------------------------- -// machine_reset -//------------------------------------------------- - -void abc806_state::machine_reset() -{ - m_sb = m_io_sb->read(); - - // setup memory banking - int bank; - char bank_name[10]; - - for (bank = 1; bank <= 16; bank++) - { - sprintf(bank_name,"bank%d",bank); - membank(bank_name)->set_entry(0); - } - - bankswitch(); - - // clear STO lines - m_eme = 0; - m_40 = 0; - m_hru2_a8 = 0; - m_txoff = 0; - m_rtc->cs_w(1); - m_rtc->clk_w(1); - m_rtc->dio_w(1); - - m_dart->ria_w(1); - - // 50/60 Hz - m_dart->ctsb_w(0); // 0 = 50Hz, 1 = 60Hz - - m_dfd_in = 0; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( abc800c ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( abc800c, abc800c_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) - MCFG_CPU_CONFIG(abc800_daisy_chain) - MCFG_CPU_PROGRAM_MAP(abc800c_mem) - MCFG_CPU_IO_MAP(abc800c_io) - - // video hardware - MCFG_FRAGMENT_ADD(abc800c_video) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(abc800) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - // peripheral hardware - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(abc800_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(abc800_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(abc800_state, ctc_z2_w)) - - MCFG_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) - - MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc800") - MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) - MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) - MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) - - // ABC bus - MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_cards, "abc830") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "abc800") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "abc800_hdd") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( abc800m ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( abc800m, abc800m_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) - MCFG_CPU_CONFIG(abc800_daisy_chain) - MCFG_CPU_PROGRAM_MAP(abc800m_mem) - MCFG_CPU_IO_MAP(abc800m_io) - - // video hardware - MCFG_FRAGMENT_ADD(abc800m_video) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(abc800) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - // peripheral hardware - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(abc800_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(abc800_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(abc800_state, ctc_z2_w)) - - MCFG_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) - - MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc800") - MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) - MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) - MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) - - // ABC bus - MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_cards, "abc830") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "abc800") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "abc800_hdd") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( abc802 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( abc802, abc802_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) - MCFG_CPU_CONFIG(abc800_daisy_chain) - MCFG_CPU_PROGRAM_MAP(abc802_mem) - MCFG_CPU_IO_MAP(abc802_io) - - // video hardware - MCFG_FRAGMENT_ADD(abc802_video) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(abc800) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - // peripheral hardware - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(abc800_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(abc800_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(abc800_state, ctc_z2_w)) - - MCFG_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) - MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc802_state, lrs_w)) - MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc802_state, mux80_40_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) - - MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc55") - MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) - MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) - MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) - - // ABC bus - MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_cards, "abc834") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // software list - //MCFG_SOFTWARE_LIST_ADD("flop_list", "abc802") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "abc800_hdd") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( abc806 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( abc806, abc806_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, ABC800_X01/2/2) - MCFG_CPU_CONFIG(abc800_daisy_chain) - MCFG_CPU_PROGRAM_MAP(abc806_mem) - MCFG_CPU_IO_MAP(abc806_io) - - // video hardware - MCFG_FRAGMENT_ADD(abc806_video) - - // peripheral hardware - MCFG_E0516_ADD(E0516_TAG, ABC806_X02) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(abc800_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(abc800_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(abc800_state, ctc_z2_w)) - - MCFG_Z80SIO2_ADD(Z80SIO_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(abc800_state, sio_txdb_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w)) - MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(abc806_state, keydtr_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) - - MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, "abc77") - MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) - MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) - MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) - - // ABC bus - MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_cards, "abc832") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("512K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "abc806") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "abc800_hdd") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -/* - - ABC800 DOS ROMs - - Label Drive Type - ---------------------------- - ABC 6-1X ABC830,DD82,DD84 - 800 8" DD88 - ABC 6-2X ABC832 - ABC 6-3X ABC838 - ABC 6-5X UFD dos - ABC 6-52 UFD dos with HD - UFD 6.XX Winchester - - - Floppy Controllers - - Art N/O - -------- - 55 10761-01 "old" controller - 55 10828-01 "old" controller - 55 20900-0x - 55 21046-11 Luxor Conkort 25 pin D-sub connector - 55 21046-21 Luxor Conkort 34 pin FDD connector - 55 21046-41 Luxor Conkort both of the above - -*/ - -//------------------------------------------------- -// ROM( abc800c ) -//------------------------------------------------- - -ROM_START( abc800c ) - ROM_REGION( 0x8000, Z80_TAG, 0 ) - ROM_LOAD( "abc c-1.1m", 0x0000, 0x1000, CRC(37009d29) SHA1(a1acd817ff8c2ed93935a163c5cf3d83d8bd6fb5) ) - ROM_LOAD( "abc 1-1.1l", 0x1000, 0x1000, CRC(ff15a28d) SHA1(bb4523ab1d190bc787f1923567b86795f66c26e2) ) - ROM_LOAD( "abc 2-1.1k", 0x2000, 0x1000, CRC(6ff2f528) SHA1(32d1639769c4a20b7a45c44f4c6993f77397f7a1) ) - ROM_LOAD( "abc 3-1.1j", 0x3000, 0x1000, CRC(9a43c47a) SHA1(964eb28e3d9779d1b13e0e938495133bbdb3aed3) ) - ROM_LOAD( "abc 4-1.2m", 0x4000, 0x1000, CRC(ba18db9c) SHA1(0c4543766fe9b10bee333f3f832f6f2209e449f8) ) - ROM_LOAD( "abc 5-1.2l", 0x5000, 0x1000, CRC(abbeb026) SHA1(44ebe417e3fa8d7878c23b56782aac8b443f1bfc) ) - ROM_LOAD( "abc 6-1.2k", 0x6000, 0x1000, CRC(4bd5e808) SHA1(5ca0a60571de6cfa3d6d166e0cde3c78560569f3) ) // 1981-01-12 - ROM_LOAD( "abc 7-22.2j", 0x7000, 0x1000, CRC(774511ab) SHA1(5171e43213a402c2d96dee33453c8306ac1aafc8) ) - - ROM_REGION( 0x20, "hru", 0 ) - ROM_LOAD( "hru i.4g", 0x00, 0x20, CRC(d970a972) SHA1(c47fdd61fccc68368d42f03a01c7af90ab1fe1ab) ) - - ROM_REGION( 0x200, "hru2", 0 ) - ROM_LOAD( "hru ii.3a", 0x000, 0x200, CRC(8e9d7cdc) SHA1(4ad16dc0992e31cdb2e644c7be81d334a56f7ad6) ) -ROM_END - - -//------------------------------------------------- -// ROM( abc800m ) -//------------------------------------------------- - -ROM_START( abc800m ) - ROM_REGION( 0x8000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS("ufd20") - ROM_LOAD( "abc m-12.1m", 0x0000, 0x1000, CRC(f85b274c) SHA1(7d0f5639a528d8d8130a22fe688d3218c77839dc) ) - ROM_LOAD( "abc 1-12.1l", 0x1000, 0x1000, CRC(1e99fbdc) SHA1(ec6210686dd9d03a5ed8c4a4e30e25834aeef71d) ) - ROM_LOAD( "abc 2-12.1k", 0x2000, 0x1000, CRC(ac196ba2) SHA1(64fcc0f03fbc78e4c8056e1fa22aee12b3084ef5) ) - ROM_LOAD( "abc 3-12.1j", 0x3000, 0x1000, CRC(3ea2b5ee) SHA1(5a51ac4a34443e14112a6bae16c92b5eb636603f) ) - ROM_LOAD( "abc 4-12.2m", 0x4000, 0x1000, CRC(695cb626) SHA1(9603ce2a7b2d7b1cbeb525f5493de7e5c1e5a803) ) - ROM_LOAD( "abc 5-12.2l", 0x5000, 0x1000, CRC(b4b02358) SHA1(95338efa3b64b2a602a03bffc79f9df297e9534a) ) - ROM_SYSTEM_BIOS( 0, "13", "ABC-DOS (1982-07-19)" ) - ROMX_LOAD( "abc 6-13.2k", 0x6000, 0x1000, CRC(6fa71fb6) SHA1(b037dfb3de7b65d244c6357cd146376d4237dab6), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "ufd19", "UFD-DOS v.19 (1983-05-31)" ) - ROMX_LOAD( "abc 6-11 ufd.2k", 0x6000, 0x1000, CRC(2a45be80) SHA1(bf08a18a74e8bdaee2656a3c8246c0122398b58f), ROM_BIOS(2) ) // is this "ABC 6-5" or "ABC 6-51" instead? - ROM_SYSTEM_BIOS( 2, "ufd20", "UFD-DOS v.20 (1984-03-02)" ) - ROMX_LOAD( "abc 6-52.2k", 0x6000, 0x1000, CRC(c311b57a) SHA1(4bd2a541314e53955a0d53ef2f9822a202daa485), ROM_BIOS(3) ) - ROM_LOAD_OPTIONAL( "abc 7-21.2j", 0x7000, 0x1000, CRC(fd137866) SHA1(3ac914d90db1503f61397c0ea26914eb38725044) ) - ROM_LOAD( "abc 7-22.2j", 0x7000, 0x1000, CRC(774511ab) SHA1(5171e43213a402c2d96dee33453c8306ac1aafc8) ) - - ROM_REGION( 0x800, MC6845_TAG, 0 ) - ROM_LOAD( "vum se.7c", 0x000, 0x800, CRC(f9152163) SHA1(997313781ddcbbb7121dbf9eb5f2c6b4551fc799) ) - - ROM_REGION( 0x20, "hru", 0 ) - ROM_LOAD( "hru i.4g", 0x00, 0x20, CRC(d970a972) SHA1(c47fdd61fccc68368d42f03a01c7af90ab1fe1ab) ) - - ROM_REGION( 0x200, "hru2", 0 ) - ROM_LOAD( "hru ii.3a", 0x000, 0x200, CRC(8e9d7cdc) SHA1(4ad16dc0992e31cdb2e644c7be81d334a56f7ad6) ) -ROM_END - - -//------------------------------------------------- -// ROM( abc802 ) -//------------------------------------------------- - -ROM_START( abc802 ) - ROM_REGION( 0x8000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS("ufd20") - ROM_LOAD( "abc 02-11.9f", 0x0000, 0x2000, CRC(b86537b2) SHA1(4b7731ef801f9a03de0b5acd955f1e4a1828355d) ) - ROM_LOAD( "abc 12-11.11f", 0x2000, 0x2000, CRC(3561c671) SHA1(f12a7c0fe5670ffed53c794d96eb8959c4d9f828) ) - ROM_LOAD( "abc 22-11.12f", 0x4000, 0x2000, CRC(8dcb1cc7) SHA1(535cfd66c84c0370fd022d6edf702d3d1ad1b113) ) - ROM_SYSTEM_BIOS( 0, "abc", "ABC-DOS (1983-05-31)" ) - ROMX_LOAD( "abc 32-12.14f", 0x6000, 0x2000, CRC(23cd0f43) SHA1(639daec4565dcdb4de408b808d0c6cd97baa35d2), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "ufd19", "UFD-DOS v.19 (1984-03-02)" ) - ROMX_LOAD( "abc 32-21.14f", 0x6000, 0x2000, CRC(57050b98) SHA1(b977e54d1426346a97c98febd8a193c3e8259574), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "ufd20", "UFD-DOS v.20 (1984-04-03)" ) - ROMX_LOAD( "abc 32-31.14f", 0x6000, 0x2000, CRC(fc8be7a8) SHA1(a1d4cb45cf5ae21e636dddfa70c99bfd2050ad60), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "mica620", "MICA DOS v.20 (1984-03-02)" ) - ROMX_LOAD( "mica820.14f", 0x6000, 0x2000, CRC(edf998af) SHA1(daae7e1ff6ef3e0ddb83e932f324c56f4a98f79b), ROM_BIOS(4) ) - - ROM_REGION( 0x1000, MC6845_TAG, 0 ) - ROM_LOAD( "abc t02-1.3g", 0x0000, 0x1000, CRC(4d54eed8) SHA1(04cb5fc5f3d7ba9b9a5ae0ec94241d1fe83647f7) ) // 64 90191-01 - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "abc p2-1.2g", 0x000, 0x400, NO_DUMP ) // PAL16R4 -ROM_END - - -//------------------------------------------------- -// ROM( abc806 ) -//------------------------------------------------- - -ROM_START( abc806 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS("ufd20") - ROM_LOAD( "abc 06-11.1m", 0x0000, 0x1000, CRC(27083191) SHA1(9b45592273a5673e4952c6fe7965fc9398c49827) ) // BASIC PROM ABC 06-11 "64 90231-02" - ROM_LOAD( "abc 16-11.1l", 0x1000, 0x1000, CRC(eb0a08fd) SHA1(f0b82089c5c8191fbc6a3ee2c78ce730c7dd5145) ) // BASIC PROM ABC 16-11 "64 90232-02" - ROM_LOAD( "abc 26-11.1k", 0x2000, 0x1000, CRC(97a95c59) SHA1(013bc0a2661f4630c39b340965872bf607c7bd45) ) // BASIC PROM ABC 26-11 "64 90233-02" - ROM_LOAD( "abc 36-11.1j", 0x3000, 0x1000, CRC(b50e418e) SHA1(991a59ed7796bdcfed310012b2bec50f0b8df01c) ) // BASIC PROM ABC 36-11 "64 90234-02" - ROM_LOAD( "abc 46-11.2m", 0x4000, 0x1000, CRC(17a87c7d) SHA1(49a7c33623642b49dea3d7397af5a8b9dde8185b) ) // BASIC PROM ABC 46-11 "64 90235-02" - ROM_LOAD( "abc 56-11.2l", 0x5000, 0x1000, CRC(b4b02358) SHA1(95338efa3b64b2a602a03bffc79f9df297e9534a) ) // BASIC PROM ABC 56-11 "64 90236-02" - ROM_SYSTEM_BIOS( 0, "ufd19", "UFD-DOS v.19 (1984-03-02)" ) - ROMX_LOAD( "abc 66-21.2k", 0x6000, 0x1000, CRC(c311b57a) SHA1(4bd2a541314e53955a0d53ef2f9822a202daa485), ROM_BIOS(1) ) // DOS PROM ABC 66-21 "64 90314-01" - ROM_SYSTEM_BIOS( 1, "ufd20", "UFD-DOS v.20 (1984-04-03)" ) - ROMX_LOAD( "abc 66-31.2k", 0x6000, 0x1000, CRC(a2e38260) SHA1(0dad83088222cb076648e23f50fec2fddc968883), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "mica20", "MICA DOS v.20 (1984-04-03)" ) - ROMX_LOAD( "mica2006.2k", 0x6000, 0x1000, CRC(58bc2aa8) SHA1(0604bd2396f7d15fcf3d65888b4b673f554037c0), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "catnet", "CAT-NET" ) - ROMX_LOAD( "cmd8_5.2k", 0x6000, 0x1000, CRC(25430ef7) SHA1(03a36874c23c215a19b0be14ad2f6b3b5fb2c839), ROM_BIOS(4) ) - ROM_LOAD_OPTIONAL( "abc 76-11.2j", 0x7000, 0x1000, CRC(3eb5f6a1) SHA1(02d4e38009c71b84952eb3b8432ad32a98a7fe16) ) // Options-PROM ABC 76-11 "64 90238-02" - ROM_LOAD( "abc 76-xx.2j", 0x7000, 0x1000, CRC(b364cc49) SHA1(9a2c373778856a31902cdbd2ae3362c200a38e24) ) // Enhanced Options-PROM - - ROM_REGION( 0x1000, MC6845_TAG, 0 ) - ROM_LOAD( "abc t6-11.7c", 0x0000, 0x1000, CRC(b17c51c5) SHA1(e466e80ec989fbd522c89a67d274b8f0bed1ff72) ) // 64 90243-01 - - ROM_REGION( 0x200, "rad", 0 ) - ROM_LOAD( "60 90241-01.9b", 0x000, 0x200, CRC(ad549ebb) SHA1(4fe228ce3b84ed6f0ffd5431f2f33b94c3e5268b) ) // "RAD" 7621/7643 (82S131/82S137), character line address - - ROM_REGION( 0x20, "hru", 0 ) - ROM_LOAD( "60 90128-01.6e", 0x00, 0x20, CRC(d970a972) SHA1(c47fdd61fccc68368d42f03a01c7af90ab1fe1ab) ) // "HRU I" 7603 (82S123), HR horizontal timing and video memory access - - ROM_REGION( 0x200, "hru2", 0 ) - ROM_LOAD( "60 90127-01.12g", 0x000, 0x200, CRC(8e9d7cdc) SHA1(4ad16dc0992e31cdb2e644c7be81d334a56f7ad6) ) // "HRU II" 7621 (82S131), ABC800C HR compatibility mode palette - - ROM_REGION( 0x200, "v50", 0 ) - ROM_LOAD( "60 90242-01.7e", 0x000, 0x200, CRC(788a56d8) SHA1(d81e55cdddc36f5d41bf0a33104c75fac590b764) ) // "V50" 7621 (82S131), HR vertical timing 50Hz - - //ROM_REGION( 0x200, "v60", 0 ) - //ROM_LOAD( "60 90319-01.7e", 0x000, 0x200, NO_DUMP ) // "V60" 7621 (82S131), HR vertical timing 60Hz - - ROM_REGION( 0x400, "att_hand", 0 ) - /* - 1 E6P (RAD A8) - 2 THP (chargen A12) - 3 CCLK - 4 B0 (TX ATT 6) - 5 B1 (TX ATT 7) - 6 CONDP (40/80) - 7 B2 (TX ATT 0) - 8 B3 (TX ATT 1) - 9 ULP (RAD A5) - 10 FLP (RAD A6) - 11 F2P (RTF) - 12 GND - 13 F3P (GTF) - 14 F4P (BTF) - 15 B5P (RTB) - 16 B4 (TX ATT 2) - 17 B5 (TX ATT 3) - 18 B6 (TX ATT 4) - 19 B7 (TX ATT 5) - 20 LP (*DEN+3) - 21 B6P (GTB) - 22 B7P (BTB) - 23 E5P (RAD A7) - 24 Vcc - */ - ROM_LOAD( "60 90225-01.11c", 0x000, 0x400, NO_DUMP ) // "VIDEO ATTRIBUTE" 40033A (?) - - ROM_REGION( 0x104, "abc_p3", 0 ) - ROM_LOAD( "60 90239-01.1b", 0x000, 0x104, CRC(f3d0ba00) SHA1(bcc0ee26ecac0028aef6bf5cb308133b509bb360) ) // "ABC P3-11" PAL16R4, color encoder - - ROM_REGION( 0x104, "abc_p4", 0 ) - ROM_LOAD( "60 90240-01.2d", 0x000, 0x104, CRC(3cc5518d) SHA1(343cf951d01c9d361b695bb4e80eaadf0820b6bc) ) // "ABC P4-11" PAL16L8, memory mapper -ROM_END - - - -//************************************************************************** -// DRIVER INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// DRIVER_INIT( abc800c ) -//------------------------------------------------- - -DIRECT_UPDATE_MEMBER( abc800c_state::direct_update_handler ) -{ - if (address >= 0x7c00 && address < 0x8000) - { - direct.explicit_configure(0x7c00, 0x7fff, 0x3ff, m_rom->base() + 0x7c00); - - if (!m_fetch_charram) - { - m_fetch_charram = 1; - bankswitch(); - } - - return ~0; - } - - if (m_fetch_charram) - { - m_fetch_charram = 0; - bankswitch(); - } - - return address; -} - -DRIVER_INIT_MEMBER(abc800c_state,driver_init) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc800c_state::direct_update_handler), this)); -} - - -//------------------------------------------------- -// DRIVER_INIT( abc800m ) -//------------------------------------------------- - -DIRECT_UPDATE_MEMBER( abc800m_state::direct_update_handler ) -{ - if (address >= 0x7800 && address < 0x8000) - { - direct.explicit_configure(0x7800, 0x7fff, 0x7ff, m_rom->base() + 0x7800); - - if (!m_fetch_charram) - { - m_fetch_charram = 1; - bankswitch(); - } - - return ~0; - } - - if (m_fetch_charram) - { - m_fetch_charram = 0; - bankswitch(); - } - - return address; -} - -DRIVER_INIT_MEMBER(abc800m_state,driver_init) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc800m_state::direct_update_handler), this)); -} - - -//------------------------------------------------- -// DRIVER_INIT( abc802 ) -//------------------------------------------------- - -DIRECT_UPDATE_MEMBER( abc802_state::direct_update_handler ) -{ - if (m_lrs) - { - if (address >= 0x7800 && address < 0x8000) - { - direct.explicit_configure(0x7800, 0x7fff, 0x7ff, m_rom->base() + 0x7800); - return ~0; - } - } - - return address; -} - -DRIVER_INIT_MEMBER(abc802_state,driver_init) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc802_state::direct_update_handler), this)); -} - - -//------------------------------------------------- -// DRIVER_INIT( abc806 ) -//------------------------------------------------- - -DIRECT_UPDATE_MEMBER( abc806_state::direct_update_handler ) -{ - if (address >= 0x7800 && address < 0x8000) - { - direct.explicit_configure(0x7800, 0x7fff, 0x7ff, m_rom->base() + 0x7800); - - if (!m_fetch_charram) - { - m_fetch_charram = 1; - bankswitch(); - } - - return ~0; - } - - if (m_fetch_charram) - { - m_fetch_charram = 0; - bankswitch(); - } - - return address; -} - -DRIVER_INIT_MEMBER(abc806_state,driver_init) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc806_state::direct_update_handler), this)); -} - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1981, abc800c, 0, 0, abc800c, abc800, abc800c_state, driver_init, "Luxor Datorer AB", "ABC 800 C/HR", MACHINE_SUPPORTS_SAVE ) -COMP( 1981, abc800m, abc800c, 0, abc800m, abc800, abc800m_state, driver_init, "Luxor Datorer AB", "ABC 800 M/HR", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, abc802, 0, 0, abc802, abc802, abc802_state, driver_init, "Luxor Datorer AB", "ABC 802", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, abc806, 0, 0, abc806, abc806, abc806_state, driver_init, "Luxor Datorer AB", "ABC 806", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/ac1.c b/src/mess/drivers/ac1.c deleted file mode 100644 index bf67bbfff9e..00000000000 --- a/src/mess/drivers/ac1.c +++ /dev/null @@ -1,218 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - AC1 video driver by Miodrag Milanovic - - 15/01/2009 Preliminary driver. - - 24/02/2011 Added cassette support ('ac1' and 'ac1_32' only) - - Note that Z command will get you into BASIC, and BYE command - takes you back to the Monitor. - - S xxxx yyyy = to save memory to tape. - L = to load it back in. - - Since there is no motor control, type in L then mount the tape. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80pio.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "includes/ac1.h" - -static GFXDECODE_START( ac1 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, ac1_charlayout, 0, 1 ) -GFXDECODE_END - -/* Address maps */ -static ADDRESS_MAP_START(ac1_mem, AS_PROGRAM, 8, ac1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff ) AM_ROM // Monitor - AM_RANGE( 0x0800, 0x0fff ) AM_ROM // BASIC - AM_RANGE( 0x1000, 0x17ff ) AM_RAM // Video RAM - AM_RANGE( 0x1800, 0x1fff ) AM_RAM // RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ac1_32_mem, AS_PROGRAM, 8, ac1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff ) AM_ROM // Monitor - AM_RANGE( 0x0800, 0x0fff ) AM_ROM // BASIC - AM_RANGE( 0x1000, 0x17ff ) AM_RAM // Video RAM - AM_RANGE( 0x1800, 0xffff ) AM_RAM // RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ac1_io, AS_IO, 8, ac1_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ac1 ) - PORT_START("LINE.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') - - PORT_START("LINE.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - - PORT_START("LINE.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("LINE.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - - PORT_START("LINE.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) -INPUT_PORTS_END - -/* Machine driver */ -static MACHINE_CONFIG_START( ac1, ac1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz / 4) - MCFG_CPU_PROGRAM_MAP(ac1_mem) - MCFG_CPU_IO_MAP(ac1_io) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_8MHz / 4) - MCFG_Z80PIO_IN_PA_CB(READ8(ac1_state, ac1_port_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(ac1_state, ac1_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(ac1_state, ac1_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(ac1_state, ac1_port_b_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*6, 16*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 16*8-1) - MCFG_SCREEN_UPDATE_DRIVER(ac1_state, screen_update_ac1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ac1 ) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ac1_32, ac1 ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(ac1_32_mem) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(64*6, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(ac1_state, screen_update_ac1_32) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ac1 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v1", "Version 3.1 (orig)" ) - ROMX_LOAD( "mon_v31_16.bin", 0x0000, 0x0800, CRC(1ba65e4d) SHA1(3382b8d03f31166a56aea49fd1ec1e82a7108300), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v2", "Version 3.1 (fixed)" ) - ROMX_LOAD( "mon_v31_16_v2.bin", 0x0000, 0x0800, CRC(8904beb4) SHA1(db8d00a2537ac3a662e3c91e55eb2bf824a72062), ROM_BIOS(2)) - // from Funkamateur 01/85 - ROM_LOAD( "minibasic.bin", 0x0800, 0x0800, CRC(06782639) SHA1(3fd57b3ae3f538374b0d794d8aa15d06bcaaddd8)) - ROM_REGION(0x0800, "gfx1",0) - // 64 chars - U402 BM513 - ROM_LOAD ("u402.bin", 0x0000, 0x0200, CRC(cfb67f28) SHA1(e3a62a3a8bce0d098887e31fd16410f38832fd18)) - ROM_COPY("gfx1", 0x0000, 0x0200, 0x0200) - ROM_COPY("gfx1", 0x0000, 0x0400, 0x0200) - ROM_COPY("gfx1", 0x0000, 0x0600, 0x0200) -ROM_END - -ROM_START( ac1_32 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mon_v31_32.bin", 0x0000, 0x0800, CRC(bea78b1a) SHA1(8a3e2ac2033aa0bb016be742cfea7e4b09c0813b)) - // from Funkamateur 01/85 - ROM_LOAD( "minibasic.bin", 0x0800, 0x0800, CRC(06782639) SHA1(3fd57b3ae3f538374b0d794d8aa15d06bcaaddd8)) - ROM_REGION(0x0800, "gfx1",0) - ROM_SYSTEM_BIOS( 0, "128", "128 chars" ) - // 128 chars - U555 or 2708 from Funkamateur 06/86 128 including pseudo graphics - ROMX_LOAD ("zg_128.bin", 0x0000, 0x0400, CRC(0a6f7796) SHA1(64d77639b1ea23f45b4bd38c251851acb2d03822), ROM_BIOS(1)) - ROMX_LOAD ("zg_128.bin", 0x0400, 0x0400, CRC(0a6f7796) SHA1(64d77639b1ea23f45b4bd38c251851acb2d03822), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "256", "256 chars" ) - // 256 chars - 2716 from Computerclub Dessau including pseudo graphics - ROMX_LOAD ("zg_256.bin", 0x0000, 0x0800, CRC(b4171df5) SHA1(abdec4e00257f86b1a57e02b9c6b4d2df2a2a2db), ROM_BIOS(2)) -ROM_END - -ROM_START( ac1scch ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v7", "Version 7" ) - ROMX_LOAD( "mon_v7.bin", 0x0000, 0x1000, CRC(fd17b0cf) SHA1(e47113025bd9dadc1522425e21703f43e584b00f),ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v8", "Version 8" ) - ROMX_LOAD( "mon_v8.bin", 0x0000, 0x1000, CRC(5af68da5) SHA1(e760d4400b9c937e7e789d52b8ec975ff253a122),ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v10", "Version 10" ) - ROMX_LOAD( "mon_v10.bin", 0x0000, 0x1000, CRC(f8e67ecb) SHA1(7953676fc8c22824ceff464c7177e9ac0343b8ce),ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "v1088", "Version 10/88" ) - ROMX_LOAD( "mon_v1088.bin", 0x0000, 0x1000, CRC(bbb0a6df) SHA1(de9389e142541a8b5ff238b59e98bf571c794bef),ROM_BIOS(4)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("zg_scch.bin", 0x0000, 0x0800, CRC(fbfaf5da) SHA1(667568c5909e9a17675cf09dfbce2fc090c420ab)) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, ac1, 0, 0, ac1, ac1, ac1_state, ac1, "Frank Heyder", "Amateurcomputer AC1 Berlin", 0 ) -COMP( 1984, ac1_32, ac1, 0, ac1_32, ac1, ac1_state, ac1, "Frank Heyder", "Amateurcomputer AC1 Berlin (32 lines)", 0 ) -COMP( 1984, ac1scch, ac1, 0, ac1_32, ac1, ac1_state, ac1, "Frank Heyder", "Amateurcomputer AC1 SCCH", 0 ) diff --git a/src/mess/drivers/acrnsys1.c b/src/mess/drivers/acrnsys1.c deleted file mode 100644 index 23d35f2807a..00000000000 --- a/src/mess/drivers/acrnsys1.c +++ /dev/null @@ -1,282 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Dirk Best, Robbbert -/****************************************************************************** - - Acorn System 1 (Microcomputer Kit) - - Skeleton driver - - Driver by Dirk Best - -2011-06-26 Keyboard & display fixed. [Robbbert] - - -http://speleotrove.com/acorn/ - -- (modify) Memory display and modification l (load) Reads a block of bytes from tape -X (go) Run program starting at an address r (return) Resume after a breakpoint -p (point) Inserts or removes breakpoint (up) Increment displayed address -s (store) Writes a block of bytes to tape (down) Decrement displayed address - -Pasting: - 0-F : as is - (inc) : ^ - (dec) : V - M (memory) : - - G (Go) : X - -Test Paste: - -0100^11^22^33^44^55^66^77^88^99^-0100^ - Now press up-arrow to confirm the data has been entered. - - -Example usage: Turn on. Press -. Mode letter will show 'A'. Type in an address - (example FE00). Press - (or any command key). Contents will show - on the right. Use Up & Down keys to cycle through addresses. - -To save a tape, press S then enter start address, press S, enter end address+1, - start recording and press S. The save only takes a few seconds. - -To load a tape, the display must just have dots, (reset if necessary), start - playing tape and immediately press L. The last digit will flicker - as the bytes load. At the end, the dots will show again. There's - no error checking, so if it doesn't work, reset and try again. - -Note that left-most digit is not wired up, and therefore will always be blank. - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/ins8154.h" -#include "machine/74145.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "acrnsys1.lh" - - -class acrnsys1_state : public driver_device -{ -public: - acrnsys1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ttl74145(*this, "ic8_7445"), - m_cass(*this, "cassette"), - m_digit(0) - { } - - DECLARE_READ8_MEMBER(ins8154_b1_port_a_r); - DECLARE_WRITE8_MEMBER(ins8154_b1_port_a_w); - DECLARE_WRITE8_MEMBER(acrnsys1_led_segment_w); - TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_c); - TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_p); -private: - required_device m_maincpu; - required_device m_ttl74145; - required_device m_cass; - UINT8 m_digit; - UINT8 m_cass_data[4]; - bool m_cass_state; - bool m_cassold; -}; - - - -/*************************************************************************** - KEYBOARD HANDLING -***************************************************************************/ -// bit 7 is cassin -READ8_MEMBER( acrnsys1_state::ins8154_b1_port_a_r ) -{ - UINT8 data = 0x7f, i, key_line = m_ttl74145->read(); - - for (i = 0; i < 8; i++) - { - if (BIT(key_line, i)) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",i); - data = (ioport(kbdrow)->read() & 0x38) | m_digit; - break; - } - } - data |= m_cass_data[2]; - return data; -} - -// bit 6 is cassout -WRITE8_MEMBER( acrnsys1_state::ins8154_b1_port_a_w ) -{ - m_digit = data & 0x47; - m_ttl74145->write(m_digit & 7); - m_cass_state = BIT(data, 6); -} - -TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_c) -{ - m_cass_data[3]++; - - if (m_cass_state != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = m_cass_state; - } - - if (m_cass_state) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -TIMER_DEVICE_CALLBACK_MEMBER(acrnsys1_state::acrnsys1_p) -{ - /* cassette - turn 1200/2400Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_cass_data[2] = ((m_cass_data[1] < 12) ? 128 : 0); - m_cass_data[1] = 0; - } -} - -/*************************************************************************** - LED DISPLAY -***************************************************************************/ - -WRITE8_MEMBER( acrnsys1_state::acrnsys1_led_segment_w ) -{ - UINT8 key_line = m_ttl74145->read(); - - output_set_digit_value(key_line, data); -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( acrnsys1_map, AS_PROGRAM, 8, acrnsys1_state ) - AM_RANGE(0x0000, 0x03ff) AM_RAM - AM_RANGE(0x0e00, 0x0e7f) AM_MIRROR(0x100) AM_DEVREADWRITE("b1", ins8154_device, ins8154_r, ins8154_w) - AM_RANGE(0x0e80, 0x0eff) AM_MIRROR(0x100) AM_RAM - AM_RANGE(0xf800, 0xf9ff) AM_MIRROR(0x600) AM_ROM -ADDRESS_MAP_END - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( acrnsys1 ) - PORT_START("X0") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X1") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X2") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X3") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X4") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X5") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X6") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X7") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0xc7, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("reset") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RST") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("switch") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Switch") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("config") - PORT_CONFNAME( 0x03, 0x00, "Switch connected to") - PORT_CONFSETTING( 0x00, "IRQ" ) - PORT_CONFSETTING( 0x01, "NMI" ) - PORT_CONFSETTING( 0x02, "RST" ) -INPUT_PORTS_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static MACHINE_CONFIG_START( acrnsys1, acrnsys1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 1008000) /* 1.008 MHz */ - MCFG_CPU_PROGRAM_MAP(acrnsys1_map) - - MCFG_DEFAULT_LAYOUT(layout_acrnsys1) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD("b1", INS8154, 0) - MCFG_INS8154_IN_A_CB(READ8(acrnsys1_state, ins8154_b1_port_a_r)) - MCFG_INS8154_OUT_A_CB(WRITE8(acrnsys1_state, ins8154_b1_port_a_w)) - MCFG_INS8154_OUT_B_CB(WRITE8(acrnsys1_state, acrnsys1_led_segment_w)) - MCFG_DEVICE_ADD("ic8_7445", TTL74145, 0) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_c", acrnsys1_state, acrnsys1_c, attotime::from_hz(4800)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("acrnsys1_p", acrnsys1_state, acrnsys1_p, attotime::from_hz(40000)) -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( acrnsys1 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("acrnsys1.bin", 0xf800, 0x0200, CRC(43dcfc16) SHA1(b987354c55beb5e2ced761970c3339b895a8c09d)) -ROM_END - - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, acrnsys1, 0, 0, acrnsys1, acrnsys1, driver_device, 0, "Acorn", "Acorn System 1", 0 ) diff --git a/src/mess/drivers/adam.c b/src/mess/drivers/adam.c deleted file mode 100644 index 75682bad25d..00000000000 --- a/src/mess/drivers/adam.c +++ /dev/null @@ -1,1147 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Coleco Adam - - The Coleco ADAM is a Z80-based micro with all peripheral devices - attached to an internal serial serial bus (ADAMnet) managed by 6801 - microcontrollers (processor, internal RAM, internal ROM, serial port).Each - device had its own 6801, and the ADAMnet was managed by a "master" 6801 on - the ADAM motherboard. Each device was allotted a block of 21 bytes in Z80 - address space; device control was accomplished by poking function codes into - the first byte of each device control block (hereafter DCB) after setup of - other DCB locations with such things as: buffer address in Z80 space, # of - bytes to transfer, block # to access if it was a block device like a tape - or disk drive, etc. The master 6801 would interpret this data, and pass - along internal ADAMnet requests to the desired peripheral, which would then - send/receive its data and return the status of the operation. The status - codes were left in the same byte of the DCB as the function request, and - certain bits of the status byte would reflect done/working on it/error/ - not present, and error codes were left in another DCB byte for things like - CRC error, write protected disk, missing block, etc. - - ADAM's ROM operating system, EOS (Elementary OS), was constructed - similar to CP/M in that it provided both a filesystem (like BDOS) and raw - device interface (BIOS). At the file level, sequential files could be - created, opened, read, written, appended, closed, and deleted. Forward- - only random access was implemented (you could not move the R/W pointer - backward, except clear to the beginning!), and all files had to be - contiguous on disk/tape. Directories could be initialized or searched - for a matching filename (no wildcards allowed). At the device level, - individual devices could be read/written by block (for disks/tapes) or - character-by-character (for printer, keyboard, and a prototype serial - board which was never released). Devices could be checked for their - ADAMnet status, and reset if necessary. There was no function provided - to do low-level formatting of disks/tapes. - - At system startup, the EOS was loaded from ROM into the highest - 8K of RAM, a function call made to initialize the ADAMnet, and then - any disks or tapes were checked for a boot medium; if found, block 0 of - the medium was loaded in, and a jump made to the start of the boot code. - The boot block would take over loading in the rest of the program. If no - boot media were found, a jump would be made to a ROM word processor (called - SmartWriter). - - Coleco designed the ADAMnet to have up to 15 devices attached. - Before they went bankrupt, Coleco had released a 64K memory expander and - a 300-baud internal modem, but surprisingly neither of these was an - ADAMnet device. Disassembly of the RAMdisk drivers in ADAM CP/M 2.2, and - of the ADAMlink terminal program revealed that these were simple port I/O - devices, banks of XRAM being accessed by a special memory switch port not - documented as part of the EOS. The modem did not even use the interrupt - capabilities of the Z80--it was simply polled. A combination serial/ - parallel interface, each port of which *was* an ADAMnet device, reached the - prototype stage, as did a 5MB hard disk, but neither was ever released to - the public. (One prototype serial/parallel board is still in existence, - but the microcontroller ROMs have not yet been succcessfully read.) So - when Coleco finally bailed out of the computer business, a maximum ADAM - system consisted of a daisy wheel printer, a keyboard, 2 tape drives, and - 2 disk drives (all ADAMnet devices), a 64K expander and a 300-baud modem - (which were not ADAMnet devices). - - Third-party vendors reverse-engineered the modem (which had a - 2651 UART at its heart) and made a popular serial interface board. It was - not an ADAMnet device, however, because nobody knew how to make a new ADAMnet - device (no design specs were ever released), and the 6801 microcontrollers - had unreadable mask ROMs. Disk drives, however, were easily upgraded from - 160K to as high as 1MB because, for some unknown reason, the disk controller - boards used a separate microprocessor and *socketed* EPROM (which was - promptly disassembled and reworked). Hard drives were cobbled together from - a Kaypro-designed board and accessed as standard I/O port devices. A parallel - interface card was similarly set up at its own I/O port. - - Devices (15 max): - Device 0 = Master 6801 ADAMnet controller (uses the adam_pcb as DCB) - Device 1 = Keyboard - Device 2 = ADAM printer - Device 3 = Copywriter (projected) - Device 4 = Disk drive 1 - Device 5 = Disk drive 2 - Device 6 = Disk drive 3 (third party) - Device 7 = Disk drive 4 (third party) - Device 8 = Tape drive 1 - Device 9 = Tape drive 3 (projected) - Device 10 = Unused - Device 11 = Non-ADAMlink modem - Device 12 = Hi-resolution monitor - Device 13 = ADAM parallel interface (never released) - Device 14 = ADAM serial interface (never released) - Device 15 = Gateway - Device 24 = Tape drive 2 (share DCB with Tape1) - Device 25 = Tape drive 4 (projected, may have share DCB with Tape3) - Device 26 = Expansion RAM disk drive (third party ID, not used by Coleco) - - Terminology: - EOS = Elementary Operating System - DCB = Device Control Block Table (21bytes each DCB, DCB+16=dev#, DCB+0=Status Byte) (0xFD7C) - - 0 Status byte - 1-2 Buffer start address (lobyte, hibyte) - 3-4 Buffer length (lobyte, hibyte) - 5-8 Block number accessed (loword, hiword in lobyte, hibyte format) - 9 High nibble of device number - 10-15 Always zero (unknown purpose) - 16 Low nibble of device number - 17-18 Maximum block length (lobyte, hibyte) - 19 Device type (0 for block device, 1 for character device) - 20 Node type - - - Writing to byte0 requests the following operations: - 1 Return current status - 2 Soft reset - 3 Write - 4 Read - - - FCB = File Control Block Table (32bytes, 2 max each application) (0xFCB0) - OCB = Overlay Control Block Table - adam_pcb = Processor Control Block Table, 4bytes (adam_pcb+3 = Number of valid DCBs) (0xFEC0 relocatable), current adam_pcb=[0xFD70] - adam_pcb+0 = Status, 0=Request Status of Z80 -> must return 0x81..0x82 to sync Master 6801 clk with Z80 clk - adam_pcb+1,adam_pcb+2 = address of adam_pcb start - adam_pcb+3 = device # - - - Writing to byte0: - 1 Synchronize the Z80 clock (should return 0x81) - 2 Synchronize the Master 6801 clock (should return 0x82) - 3 Relocate adam_pcb - - - Status values: - 0x80 -> Success - 0x81 -> Z80 clock in sync - 0x82 -> Master 6801 clock in sync - 0x83 -> adam_pcb relocated - 0x9B -> Time Out - - DEV_ID = Device id - - - The ColecoAdam I/O map is contolled by the MIOC (Memory Input Output Controller): - - 20-3F (W) = Adamnet Writes - 20-3F (R) = Adamnet Reads - - 42-42 (W) = Expansion RAM page selection, only useful if expansion greater than 64k - - 40-40 (W) = Printer Data Out - 40-40 (R) = Printer (Returns 0x41) - - 5E-5E (RW)= Modem Data I/O - 5F-5F (RW)= Modem Data Control Status - - 60-7F (W) = Set Memory configuration - 60-7F (R) = Read Memory configuration - - 80-9F (W) = Set both controllers to keypad mode - 80-9F (R) = Not Connected - - A0-BF (W) = Video Chip (TMS9928A), A0=0 -> Write Register 0 , A0=1 -> Write Register 1 - A0-BF (R) = Video Chip (TMS9928A), A0=0 -> Read Register 0 , A0=1 -> Read Register 1 - - C0-DF (W) = Set both controllers to joystick mode - C0-DF (R) = Not Connected - - E0-FF (W) = Sound Chip (SN76489A) - E0-FF (R) = Read Controller data, A1=0 -> read controller 1, A1=1 -> read controller 2 -*/ - -/* - Detailed Coleco ADAM Computer I/O Address Map - -Port # Device Input Output -__________________________________________________________________________________________ - -00 Powermate SASI Hard Drive Input Data Output Data -01 Powermate SASI Hard Drive Status Register Command Register -01 MIB2 RESET line * Not Used on MIB2 * Bit 3 = 1 for MIB2 RESET -01 Powermate IDE Hard Drive Error Register * Not Used on IDE HD * -02 Powermate IDE Hard Drive Sector Count Register Sector Count Register -03 Powermate IDE Hard Drive Sector Number Register Sector Number Register -04 Powermate IDE Hard Drive Cylinder Low Register Cylinder Low Register -05 Powermate IDE Hard Drive Cylinder High Register Cylinder High Register -06 Powermate IDE Hard Drive SDH Register SDH Register -07 Powermate IDE Hard Drive Status Register Command Register -08 Bonafide Sys MIDI Interface -09 Bonafide Sys MIDI Interface -0A Bonafide Sys MIDI Interface -0B Bonafide Sys MIDI Interface -0C Bonafide Sys MIDI Interface -0D Bonafide Sys MIDI Interface -0E Bonafide Sys MIDI Interface -0F Bonafide Sys MIDI Interface -10 Powermate Serial ports Mode Register A Mode Register A -11 Powermate Serial ports Status Register A Clock Select Reg A -12 Powermate Serial ports * DO NOT USE * Command Register A -13 Powermate Serial ports RX Holding Register A TX Holding Reg A -14 Powermate Serial ports Input Port Change Reg Aux Control Register -15 Powermate Serial ports Interrupt Status Reg Interrupt Mask Reg -16 Powermate Serial ports Read Counter Upper Set C/T Upper Register -17 Powermate Serial ports Read Counter Lower Set C/T Lower Register -18 Powermate Serial ports Mode Register B Mode Register B -19 Powermate Serial ports Status Register B Clock Select Reg B -1A Powermate Serial ports * DO NOT USE * Command Register B -1B Powermate Serial ports RX Holding Register B TX Holding Register B -1C Powermate Serial ports * Reserved (note 5) * MIB3 Serial Port RESET -1D Powermate Serial ports Read Input Port Bits Output Port Config Reg -1E Coleco AutoDialer ?? ?? -1E Powermate Serial ports Start Counter Cmd Port Set Output Port Bits -1F Powermate Serial ports Stop Counter Cmd Port Reset Output Port Bits -20-3F AdamNet Reset Input MAY be available Output is NOT available -40 Parallel Printer interface Printer status Output Data -41 May be unused (see note 1) Input may NOT be avail Output MAY be available -42 Expansion Memory * Not Used * Bank Number -43 May be unused (see note 1) Input may NOT be avail Output MAY be available -44-47 Eve/Orphanware Serial Port -48-4B Eve Speech Synth/Clock Card -4C-4F Orphanware Serial Port 2 (Standard Eve 80 column terminal ports) -4F Coleco Steering controller (Listed in Hackers guide as Expansion conn #2) -50-53 Super Game Module -54-57 Orphanware Serial Port 3 (Standard Orphanware 80 column terminal ports) -58 Powermate IDE Hard Disk Input Data Lower 8 bits Output Data Lower 8 bits -59 Powermate IDE Hard Disk Input Data Upper 8 bits Output Data Upper 8 bits -5A Powermate IDE Hard Disk Alternate Status Reg Fixed Disk Control Reg -5B Powermate IDE Hard Disk Digital Input Register ** Not Used by IDE HD ** -5C-5F Orphanware Serial Port 4 -5E Adamlink Modem Input Data Output Data -5F Adamlink Modem Status Control -60-7F Memory Bank Switch Port Input MAY be available Output is NOT available -80-8F *** Unused *** (see note 2) STA (?) -90-9F Orphanware Hard Drive STA (?) -A0-BF Video Display Processor -C0 Strobe Reset STB (?) -C1-DF *** Unused *** (see note 2) STB (?) -EO-FF Sound Chip (Out only) -FC Joystick #1 (In only) -FE Joystick #2 (In only) - - -Notes: - -1) Port 41 or port 43 is used by the Eve 80 column unit as a keyboard input port. -2) Not useable from expansion card slots (can't read or write data to or from ports) - - may be available on side port. -3) Powermate IDE hard disk drive will not interfere with Powermate serial ports. -4) Powermate serial ports will probably interfere with autodialer. -5) Reserved ports in Powermate serial port map: Input ports 12 and 1A - screw up serial - ports if used; Input port 1C doesn't bother anything but the 2681 drives the bus; -6) Orphanware serial port number 4 probably interferes with the ADAMlink modem. - 7) According to my analysis of circuit U6 in the ADAM computer, all of upper I/O address - space is decoded (by an LS138). However, not all outputs appear to be used. The - circuit description follows. Please correct any misassumptions I've made. Note that - if my analysis is correct, then the Orphanware hard disk should be interfering with - the signal STA\ (which is associated with the joysticks in some way). - - - - U6 - 74LS138 A6 A5 WR\ - |--------------| - WR\ -----|A Y0|o---- 0 0 0 80-9F Write (STA\) - | | - A5 -----|B Y1|o---- 0 0 1 80-9F Read (Not Used) - | | - A6 -----|C Y2|o---- 0 1 0 A0-BF Write (VDP CSW\) - | | - A7 -----|G1 Y3|o---- 0 1 1 A0-BF Read (VDP CSR\) - | | -IORQ\ ----o|G2A Y4|o---- 1 0 0 C0-DF Write (STB\) - | | -WAIT\ ----o|G2B Y5|o---- 1 0 1 C0-DF Read (Not Used) - | | - | Y6|o---- 1 1 0 E0-FF Write (Sound CE\) - | | - | Y7|o---- 1 1 1 E0-FF Read (Joystick Enables) - |--------------| - -Conventions: - -1) The "o" symbol next to an input or an output implies that the pin requires an active - low signal. -2) The "\" symbol following a signal mnemonic indicates that the signal is active low. - - -Rev. 3 -8/30/92 -Mark Gordon -*/ - -/* - - TODO: - - - spinner INT - - printer - - SPI - - http://drushel.cwru.edu/atm/atm.html - http://rich.dirocco.org/Coleco/adam/ADAM.htm - http://users.stargate.net/~drushel/pub/coleco/twwmca/index.html - -*/ - -#include "includes/adam.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -enum -{ - LO_SMARTWRITER = 0, - LO_INTERNAL_RAM, - LO_RAM_EXPANSION, - LO_OS7_ROM_INTERNAL_RAM -}; - - -enum -{ - HI_INTERNAL_RAM = 0, - HI_ROM_EXPANSION, - HI_RAM_EXPANSION, - HI_CARTRIDGE_ROM -}; - - -enum -{ - ADAMNET_MASTER = 0, - ADAMNET_KEYBOARD, - ADAMNET_DDP, - ADAMNET_PRINTER, - ADAMNET_FDC -}; - - - -//************************************************************************** -// MEMORY BANKING -//************************************************************************** - -//------------------------------------------------- -// mreq_r - memory request read -//------------------------------------------------- - -READ8_MEMBER( adam_state::mreq_r ) -{ - int bmreq = 0, biorq = 1, eos_enable = 1, boot_rom_cs = 1, aux_decode_1 = 1, aux_rom_cs = 1, cas1 = 1, cas2 = 1, cs1 = 1, cs2 = 1, cs3 = 1, cs4 = 1; - - UINT8 data = 0; - - if (offset < 0x8000) - { - switch (m_mioc & 0x03) - { - case LO_SMARTWRITER: - boot_rom_cs = 0; - eos_enable = BIT(m_an, 1); - break; - - case LO_INTERNAL_RAM: - cas1 = 0; - break; - - case LO_RAM_EXPANSION: - cas2 = 0; - break; - - case LO_OS7_ROM_INTERNAL_RAM: - if (offset < 0x2000) - { - aux_decode_1 = 0; - } - else - { - cas1 = 0; - } - break; - } - } - else - { - switch ((m_mioc >> 2) & 0x03) - { - case HI_INTERNAL_RAM: - cas1 = 0; - break; - - case HI_ROM_EXPANSION: - aux_rom_cs = 0; - break; - - case HI_RAM_EXPANSION: - if (m_game) - { - aux_decode_1 = 0; - } - else - { - cas2 = 0; - } - break; - - case HI_CARTRIDGE_ROM: - aux_decode_1 = 0; - break; - } - } - - if (!cas1) - { - data = m_ram->pointer()[offset]; - } - - if (!boot_rom_cs) - { - if (offset < 0x6000) - { - data = m_boot_rom->base()[offset]; - } - else - { - data = m_boot_rom->base()[(eos_enable << 13) + offset]; - } - } - - if (!aux_decode_1) - { - switch (offset >> 13) - { - case 0: // U2 - data = m_os7_rom->base()[offset]; - break; - - case 1: break; - case 2: break; - - case 4: - cs1 = 0; - break; - - case 5: - cs2 = 0; - break; - - case 6: - cs3 = 0; - break; - - case 7: - cs4 = 0; - break; - } - } - - data = m_cart->bd_r(space, offset & 0x7fff, data, cs1, cs2, cs3, cs4); - data = m_slot1->bd_r(space, offset & 0xff, data, 1, biorq, 1, 1, 1); - data = m_slot2->bd_r(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2); - data = m_slot3->bd_r(space, offset, data, 1, 1, 1, cas1, cas2); - - return data; -} - - -//------------------------------------------------- -// mreq_w - memory request write -//------------------------------------------------- - -WRITE8_MEMBER( adam_state::mreq_w ) -{ - int bmreq = 0, biorq = 1, aux_rom_cs = 1, cas1 = 1, cas2 = 1; - - if (offset < 0x8000) - { - switch (m_mioc & 0x03) - { - case LO_INTERNAL_RAM: - cas1 = 0; - break; - - case LO_RAM_EXPANSION: - cas2 = 0; - break; - - case LO_OS7_ROM_INTERNAL_RAM: - if (offset >= 0x2000) - { - cas1 = 0; - } - break; - } - } - else - { - switch ((m_mioc >> 2) & 0x03) - { - case HI_INTERNAL_RAM: - cas1 = 0; - break; - - case HI_RAM_EXPANSION: - if (!m_game) - { - cas2 = 0; - } - break; - } - } - - if (!cas1) - { - m_ram->pointer()[offset] = data; - } - - m_slot1->bd_w(space, offset & 0xff, data, 1, biorq, 1, 1, 1); - m_slot2->bd_w(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2); - m_slot3->bd_w(space, offset, data, 1, 1, 1, cas1, cas2); -} - - -//------------------------------------------------- -// iorq_r - I/O request read -//------------------------------------------------- - -READ8_MEMBER( adam_state::iorq_r ) -{ - int bmreq = 1, biorq = 0, aux_rom_cs = 1, cas1 = 1, cas2 = 1; - - UINT8 data = 0; - - switch ((offset >> 5) & 0x07) - { - case 1: - data = adamnet_r(space, 0); - break; - - case 3: - data = mioc_r(space, 0); - break; - - case 5: - if (BIT(offset, 0)) - { - data = m_vdc->register_read(space, 0); - } - else - { - data = m_vdc->vram_read(space, 0); - } - break; - - case 7: - if (BIT(offset, 1)) - { - data = m_joy2->read(); - } - else - { - data = m_joy1->read(); - } - break; - } - - data = m_slot1->bd_r(space, offset & 0xff, data, 1, biorq, 1, 1, 1); - data = m_slot2->bd_r(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2); - data = m_slot3->bd_r(space, offset, data, 1, 1, 1, cas1, cas2); - - return data; -} - - -//------------------------------------------------- -// iorq_w - I/O request write -//------------------------------------------------- - -WRITE8_MEMBER( adam_state::iorq_w ) -{ - int bmreq = 1, biorq = 0, aux_rom_cs = 1, cas1 = 1, cas2 = 1; - - switch ((offset >> 5) & 0x07) - { - case 1: - adamnet_w(space, 0, data); - break; - - case 3: - mioc_w(space, 0, data); - break; - - case 4: - m_joy1->common0_w(1); - m_joy1->common1_w(0); - m_joy2->common0_w(1); - m_joy2->common1_w(0); - break; - - case 5: - if (BIT(offset, 0)) - { - m_vdc->register_write(space, 0, data); - } - else - { - m_vdc->vram_write(space, 0, data); - } - break; - - case 6: - m_joy1->common0_w(0); - m_joy1->common1_w(1); - m_joy2->common0_w(0); - m_joy2->common1_w(1); - break; - - case 7: - m_psg->write(space, 0, data); - break; - } - - m_slot1->bd_w(space, offset & 0xff, data, 1, biorq, 1, 1, 1); - m_slot2->bd_w(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2); - m_slot3->bd_w(space, offset, data, 1, 1, 1, cas1, cas2); -} - - -//------------------------------------------------- -// mioc_r - -//------------------------------------------------- - -READ8_MEMBER( adam_state::mioc_r ) -{ - return m_mioc & 0x0f; -} - - -//------------------------------------------------- -// mioc_w - -//------------------------------------------------- - -WRITE8_MEMBER( adam_state::mioc_w ) -{ - /* - - bit description - - 0 Lower memory option 0 - 1 Lower memory option 1 - 2 Upper memory option 0 - 3 Upper memory option 1 - 4 - 5 - 6 - 7 - - */ - - m_mioc = data; -} - - - -//************************************************************************** -// ADAMNET -//************************************************************************** - -//------------------------------------------------- -// adamnet_r - -//------------------------------------------------- - -READ8_MEMBER( adam_state::adamnet_r ) -{ - return m_an & 0x0f; -} - - -//------------------------------------------------- -// adamnet_w - -//------------------------------------------------- - -WRITE8_MEMBER( adam_state::adamnet_w ) -{ - /* - - bit description - - 0 Network reset - 1 EOS enable - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - if (BIT(m_an, 0) && !BIT(data, 0)) - { - // network reset - m_adamnet->reset_w(ASSERT_LINE); - m_adamnet->reset_w(CLEAR_LINE); - } - - m_an = data; -} - - -//------------------------------------------------- -// m6801_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( adam_state::m6801_p1_w ) -{ - /* - - bit description - - 0 BA8 - 1 BA9 - 2 BA10 - 3 BA11 - 4 BA12 - 5 BA13 - 6 BA14 - 7 BA15 - - */ - - m_ba = (data << 8) | (m_ba & 0xff); -} - - -//------------------------------------------------- -// m6801_p2_r - -//------------------------------------------------- - -READ8_MEMBER( adam_state::m6801_p2_r ) -{ - /* - - bit description - - 0 M6801 mode bit 0 - 1 M6801 mode bit 1 - 2 M6801 mode bit 2 - 3 NET RXD - 4 - - */ - - UINT8 data = M6801_MODE_7; - - // NET RXD - data |= m_adamnet->rxd_r() << 3; - - return data; -} - - -//------------------------------------------------- -// m6801_p2_w - -//------------------------------------------------- - -WRITE8_MEMBER( adam_state::m6801_p2_w ) -{ - /* - - bit description - - 0 _DMA - 1 - 2 _BWR - 3 - 4 NET TXD - - */ - - // DMA - m_dma = BIT(data, 0); - - // write - m_bwr = BIT(data, 2); - - // NET TXD - m_adamnet->txd_w(BIT(data, 4)); -} - - -//------------------------------------------------- -// m6801_p3_r - -//------------------------------------------------- - -READ8_MEMBER( adam_state::m6801_p3_r ) -{ - /* - - bit description - - 0 BD0 - 1 BD1 - 2 BD2 - 3 BD3 - 4 BD4 - 5 BD5 - 6 BD6 - 7 BD7 - - */ - - return m_data_out; -} - - -//------------------------------------------------- -// m6801_p3_w - -//------------------------------------------------- - -WRITE8_MEMBER( adam_state::m6801_p3_w ) -{ - /* - - bit description - - 0 BD0 - 1 BD1 - 2 BD2 - 3 BD3 - 4 BD4 - 5 BD5 - 6 BD6 - 7 BD7 - - */ - - m_data_in = data; -} - - -//------------------------------------------------- -// m6801_p4_w - -//------------------------------------------------- - -WRITE8_MEMBER( adam_state::m6801_p4_w ) -{ - /* - - bit description - - 0 BA0 - 1 BA1 - 2 BA2 - 3 BA3 - 4 BA4 - 5 BA5 - 6 BA6 - 7 BA7 - - */ - - m_ba = (m_ba & 0xff00) | data; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( adam_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( adam_mem, AS_PROGRAM, 8, adam_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(mreq_r, mreq_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( adam_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( adam_io, AS_IO, 8, adam_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(iorq_r, iorq_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( m6801_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( m6801_mem, AS_PROGRAM, 8, adam_state ) - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(M6801_TAG, m6801_cpu_device, m6801_io_r, m6801_io_w) - AM_RANGE(0x0080, 0x00ff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6801_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( m6801_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( m6801_io, AS_IO, 8, adam_state ) - AM_RANGE(M6801_PORT1, M6801_PORT1) AM_WRITE(m6801_p1_w) - AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(m6801_p2_r, m6801_p2_w) - AM_RANGE(M6801_PORT3, M6801_PORT3) AM_READWRITE(m6801_p3_r, m6801_p3_w) - AM_RANGE(M6801_PORT4, M6801_PORT4) AM_WRITE(m6801_p4_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( adam ) -//------------------------------------------------- - -static INPUT_PORTS_START( adam ) - // defined in bus/adamnet/kb.c -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// TMS9928A_INTERFACE( vdc_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( adam_state::vdc_int_w ) -{ - if (state && !m_vdp_nmi) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } - - m_vdp_nmi = state; -} - -//------------------------------------------------- -// M6801_INTERFACE( m6801_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( adam_state::os3_w ) -{ - if (state && !m_dma) - { - if (!m_bwr) - { - //logerror("Master 6801 write to %04x data %02x\n", m_ba, m_data_in); - - m_ram->pointer()[m_ba] = m_data_in; - } - else - { - m_data_out = m_ram->pointer()[m_ba]; - - //logerror("Master 6801 read from %04x data %02x\n", m_ba, m_data_out); - - m_netcpu->set_input_line(M6801_SC1_LINE, ASSERT_LINE); - m_netcpu->set_input_line(M6801_SC1_LINE, CLEAR_LINE); - } - } -} - - -WRITE_LINE_MEMBER( adam_state::joy1_irq_w ) -{ - // TODO -} - -WRITE_LINE_MEMBER( adam_state::joy2_irq_w ) -{ - // TODO -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( adam ) -//------------------------------------------------- - -void adam_state::machine_start() -{ - // state saving - save_item(NAME(m_mioc)); - save_item(NAME(m_game)); - save_item(NAME(m_an)); - save_item(NAME(m_ba)); - save_item(NAME(m_dma)); - save_item(NAME(m_bwr)); - save_item(NAME(m_data_in)); - save_item(NAME(m_data_out)); - save_item(NAME(m_spindis)); - save_item(NAME(m_vdp_nmi)); -} - - -void adam_state::machine_reset() -{ - if (m_cart->exists()) - { - // game reset - m_game = 1; - m_mioc = (HI_CARTRIDGE_ROM << 2) | LO_OS7_ROM_INTERNAL_RAM; - } - else - { - // computer reset - m_game = 0; - m_mioc = 0; - } - - m_an = 0; - - m_maincpu->reset(); - m_netcpu->reset(); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// DEVICE_INPUT_DEFAULTS( drive2 ) -//------------------------------------------------- - -DEVICE_INPUT_DEFAULTS_START( drive2 ) - DEVICE_INPUT_DEFAULTS("SW3", 0x01, 0x01) -DEVICE_INPUT_DEFAULTS_END - - -//------------------------------------------------- -// MACHINE_CONFIG( adam ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( adam, adam_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_7_15909MHz/2) - MCFG_CPU_PROGRAM_MAP(adam_mem) - MCFG_CPU_IO_MAP(adam_io) - - MCFG_CPU_ADD(M6801_TAG, M6801, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(m6801_mem) - MCFG_CPU_IO_MAP(m6801_io) - MCFG_M6801_SC2(WRITELINE(adam_state, os3_w)) - MCFG_QUANTUM_PERFECT_CPU(M6801_TAG) - - // video hardware - MCFG_DEVICE_ADD(TMS9928A_TAG, TMS9928A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(adam_state, vdc_int_w)) - MCFG_TMS9928A_SCREEN_ADD_NTSC(SCREEN_TAG) - MCFG_SCREEN_UPDATE_DEVICE(TMS9928A_TAG, tms9928a_device, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SN76489A_TAG, SN76489A, XTAL_7_15909MHz/2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SN76496_READY_HANDLER(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) - - // devices - MCFG_ADAMNET_BUS_ADD() - MCFG_ADAMNET_SLOT_ADD("net1", adamnet_devices, "kb") - MCFG_ADAMNET_SLOT_ADD("net2", adamnet_devices, "prn") - MCFG_ADAMNET_SLOT_ADD("net3", adamnet_devices, "ddp") - MCFG_ADAMNET_SLOT_ADD("net4", adamnet_devices, "fdc") - MCFG_ADAMNET_SLOT_ADD("net5", adamnet_devices, "fdc") - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("fdc", drive2) - MCFG_ADAMNET_SLOT_ADD("net6", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net7", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net8", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net9", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net10", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net11", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net12", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net13", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net14", adamnet_devices, NULL) - MCFG_ADAMNET_SLOT_ADD("net15", adamnet_devices, NULL) - - MCFG_COLECOVISION_CARTRIDGE_SLOT_ADD(COLECOVISION_CARTRIDGE_SLOT_TAG, colecovision_cartridges, NULL) - MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_LEFT_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, adam_slot1_devices, "adamlink") - MCFG_ADAM_EXPANSION_SLOT_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_CENTER_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, adam_slot2_devices, NULL) - MCFG_ADAM_EXPANSION_SLOT_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_RIGHT_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, adam_slot3_devices, "ram") - - MCFG_COLECOVISION_CONTROL_PORT_ADD(CONTROL1_TAG, colecovision_control_port_devices, "hand") - MCFG_COLECOVISION_CONTROL_PORT_IRQ_CALLBACK(WRITELINE(adam_state, joy1_irq_w)) - MCFG_COLECOVISION_CONTROL_PORT_ADD(CONTROL2_TAG, colecovision_control_port_devices, NULL) - MCFG_COLECOVISION_CONTROL_PORT_IRQ_CALLBACK(WRITELINE(adam_state, joy2_irq_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("colec_cart_list", "coleco") - MCFG_SOFTWARE_LIST_ADD("adam_cart_list", "adam_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "adam_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "adam_flop") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( adam ) -//------------------------------------------------- - -ROM_START( adam ) - ROM_REGION( 0x2000, "os7", 0) - ROM_LOAD( "os7.u2", 0x0000, 0x2000, CRC(3aa93ef3) SHA1(45bedc4cbdeac66c7df59e9e599195c778d86a92) ) - - ROM_REGION( 0xa000, "boot", 0) - ROM_LOAD( "alf #1 rev 57 e3d5.u8", 0x0000, 0x2000, CRC(565b364a) SHA1(ebdafad6e268e7ed1674c1fb89607622748a5b36) ) - ROM_LOAD( "alf #2 rev 57 ae6a.u20", 0x2000, 0x2000, CRC(44a1cff4) SHA1(661cdf36d9699d6c21c5f9e205ebc41c707359dd) ) - ROM_LOAD( "alf #3 rev 57 8534.u21", 0x4000, 0x2000, CRC(77657b90) SHA1(d25d32ab6c8fafbc21b4b925b3e644fa26d111f7) ) - ROM_LOAD( "eos 6 rev 57 08dd.u22", 0x8000, 0x2000, CRC(ef6403c5) SHA1(28c7616cd02e4286f9b4c1c4a8b8850832b49fcb) ) - ROM_CONTINUE( 0x6000, 0x2000 ) - ROM_LOAD( "wp_r80.rom", 0x0000, 0x8000, BAD_DUMP CRC(58d86a2a) SHA1(d4aec4efe1431e56fe52d83baf9118542c525255) ) // should be separate 8/16K ROMs - - ROM_REGION( 0x800, M6801_TAG, 0 ) - ROM_LOAD( "master rev a 174b.u6", 0x000, 0x800, CRC(035a7a3d) SHA1(0426e6eaf18c2be9fe08066570c214ab5951ee14) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1982, adam, 0, coleco, adam, adam, driver_device, 0, "Coleco", "Adam", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/advision.c b/src/mess/drivers/advision.c deleted file mode 100644 index 5dfb5985964..00000000000 --- a/src/mess/drivers/advision.c +++ /dev/null @@ -1,113 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/************************************************************************* - - drivers/advision.c - - Driver for the Entex Adventure Vision - -**************************************************************************/ - -/* - - TODO: - - - Turtles music is monotonous - - convert to discrete sound - - screen pincushion distortion - -*/ - -#include "emu.h" -#include "includes/advision.h" -#include "cpu/mcs48/mcs48.h" -#include "cpu/cop400/cop400.h" -#include "sound/dac.h" - -/* Memory Maps */ - -READ8_MEMBER( advision_state::rom_r ) -{ - offset += 0x400; - return m_cart->read_rom(space, offset & 0xfff); -} - -static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, advision_state ) - AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1") - AM_RANGE(0x0400, 0x0fff) AM_READ(rom_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( io_map, AS_IO, 8, advision_state ) - AM_RANGE(0x00, 0xff) AM_READWRITE(ext_ram_r, ext_ram_w) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(controller_r, bankswitch_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(av_control_w) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(vsync_r) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( advision ) - PORT_START("joystick") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY -INPUT_PORTS_END - -/* Machine Driver */ - -static MACHINE_CONFIG_START( advision, advision_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I8048_TAG, I8048, XTAL_11MHz) - MCFG_CPU_PROGRAM_MAP(program_map) - MCFG_CPU_IO_MAP(io_map) - - MCFG_CPU_ADD(COP411_TAG, COP411, 52631*16) // COP411L-KCN/N - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_RAM_POWER_SUPPLY, COP400_MICROBUS_DISABLED) - MCFG_COP400_READ_L_CB(READ8(advision_state, sound_cmd_r)) - MCFG_COP400_WRITE_G_CB(WRITE8(advision_state, sound_g_w)) - MCFG_COP400_WRITE_D_CB(WRITE8(advision_state, sound_d_w)) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(4*15) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(advision_state, screen_update) - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(84, 235, 60, 142) - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(advision_state, advision) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "advision_cart") - MCFG_GENERIC_MANDATORY - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","advision") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( advision ) - ROM_REGION( 0x1000, I8048_TAG, ROMREGION_ERASE00 ) - ROM_LOAD( "b225__ins8048-11kdp_n.u5", 0x000, 0x400, CRC(279e33d1) SHA1(bf7b0663e9125c9bfb950232eab627d9dbda8460) ) // " /B225 \\ INS8048-11KDP/N" - - ROM_REGION( 0x200, COP411_TAG, 0 ) - ROM_LOAD( "b8223__cop411l-kcn_n.u8", 0x000, 0x200, CRC(81e95975) SHA1(8b6f8c30dd3e9d8e43f1ea20fba2361b383790eb) ) // " /B8223 \\ COP411L-KCN/N" -ROM_END - -/* Game Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1982, advision, 0, 0, advision, advision, driver_device, 0, "Entex", "Adventure Vision", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/aim65.c b/src/mess/drivers/aim65.c deleted file mode 100644 index 163ea0e2774..00000000000 --- a/src/mess/drivers/aim65.c +++ /dev/null @@ -1,288 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner, Dan Boris, Dirk Best, Robbbert -/****************************************************************************** - PeT mess@utanet.at Nov 2000pia6821_device -Updated by Dan Boris, 3/4/2007 -Rewrite in progress, Dirk Best, 2007-07-31 - -ToDo: - - Printer. Tried to implement this but it was not working, currently disabled. - - Dual tape interface (done, but see bugs below) - - Implement punchtape reader/writer and TTY keyboard - - Front panel Reset switch (switch S1) - - Front panel Run/Step switch (switch S2) - -Bugs - - Cassette should output data on PB7, but the bit stays High. - - At the end of saving, both motors sometimes get turned on! - - CA2 should switch the cassette circuits between input and output. - It goes High on Read (correct) but doesn't go Low for Write. - - Read of CA1 is to check the printer, but it never happens. - - Write to CB1 should occur to activate printer's Start line, but it - also never happens. - - The common factor is the 6522, maybe it has problems.. - -******************************************************************************/ - -#include "includes/aim65.h" -#include "aim65.lh" - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -/* Note: RAM is mapped dynamically in machine/aim65.c */ -static ADDRESS_MAP_START( aim65_mem, AS_PROGRAM, 8, aim65_state ) - AM_RANGE( 0x1000, 0x9fff ) AM_NOP /* User available expansions */ - AM_RANGE( 0xa000, 0xa00f ) AM_MIRROR(0x3f0) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) // user via - AM_RANGE( 0xa400, 0xa47f ) AM_DEVICE("riot", mos6532_t, ram_map) - AM_RANGE( 0xa480, 0xa497 ) AM_DEVICE("riot", mos6532_t, io_map) - AM_RANGE( 0xa498, 0xa7ff ) AM_NOP /* Not available */ - AM_RANGE( 0xa800, 0xa80f ) AM_MIRROR(0x3f0) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) // system via - AM_RANGE( 0xac00, 0xac03 ) AM_DEVREADWRITE("pia6821", pia6821_device, read, write) - AM_RANGE( 0xac04, 0xac43 ) AM_RAM /* PIA RAM */ - AM_RANGE( 0xac44, 0xafff ) AM_NOP /* Not available */ - AM_RANGE( 0xb000, 0xffff ) AM_ROM /* 5 ROM sockets */ -ADDRESS_MAP_END - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( aim65 ) - PORT_START("keyboard_0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("keyboard_1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LF @") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(10) PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("keyboard_2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Print") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("keyboard_3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') - - PORT_START("keyboard_4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("keyboard_5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("keyboard_6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("keyboard_7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("switches") - PORT_DIPNAME(0x08, 0x08, "KB/TTY") - PORT_DIPLOCATION("S3:1") - PORT_DIPSETTING( 0x00, "TTY") - PORT_DIPSETTING( 0x08, "KB") -INPUT_PORTS_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -int aim65_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag) -{ - UINT32 size = slot->common_get_size(slot_tag); - - if (size > 0x1000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - if (image.software_entry() != NULL && image.get_software_region(slot_tag) == NULL) - { - std::string errmsg; - strprintf(errmsg,"Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension", - slot_tag, slot_tag); - image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); - return IMAGE_INIT_FAIL; - } - - slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - slot->common_load_rom(slot->get_rom_base(), size, slot_tag); - - return IMAGE_INIT_PASS; -} - - -static MACHINE_CONFIG_START( aim65, aim65_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, AIM65_CLOCK) /* 1 MHz */ - MCFG_CPU_PROGRAM_MAP(aim65_mem) - - - MCFG_DEFAULT_LAYOUT(layout_aim65) - - /* alpha-numeric display */ - MCFG_DEVICE_ADD("ds1", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds1)) - MCFG_DEVICE_ADD("ds2", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds2)) - MCFG_DEVICE_ADD("ds3", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds3)) - MCFG_DEVICE_ADD("ds4", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds4)) - MCFG_DEVICE_ADD("ds5", DL1416T, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds5)) - - /* Sound - wave sound only */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* other devices */ - MCFG_DEVICE_ADD("riot", MOS6532n, AIM65_CLOCK) - MCFG_MOS6530n_OUT_PA_CB(WRITE8(aim65_state, aim65_riot_a_w)) - MCFG_MOS6530n_IN_PB_CB(READ8(aim65_state, aim65_riot_b_r)) - MCFG_MOS6530n_IRQ_CB(INPUTLINE("maincpu", M6502_IRQ_LINE)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) - MCFG_VIA6522_READPB_HANDLER(READ8(aim65_state, aim65_pb_r)) - // in CA1 printer ready? - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(aim65_state, aim65_pb_w)) - // out CB1 printer start - // out CA2 cass control (H=in) - // out CB2 turn printer on - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 0) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) - - MCFG_DEVICE_ADD("pia6821", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(aim65_state, aim65_pia_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(aim65_state, aim65_pia_b_w)) - - // Deck 1 can play and record - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - // Deck 2 can only record - MCFG_CASSETTE_ADD( "cassette2" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_RECORD | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_GENERIC_SOCKET_ADD("z26", generic_plain_slot, "aim65_cart") - MCFG_GENERIC_EXTENSIONS("z26") - MCFG_GENERIC_LOAD(aim65_state, z26_load) - - MCFG_GENERIC_SOCKET_ADD("z25", generic_plain_slot, "aim65_cart") - MCFG_GENERIC_EXTENSIONS("z25") - MCFG_GENERIC_LOAD(aim65_state, z25_load) - - MCFG_GENERIC_SOCKET_ADD("z24", generic_plain_slot, "aim65_cart") - MCFG_GENERIC_EXTENSIONS("z24") - MCFG_GENERIC_LOAD(aim65_state, z24_load) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("1K,2K,3K") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","aim65_cart") -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( aim65 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "aim65", "Rockwell AIM-65") - ROMX_LOAD("aim65mon.z23", 0xe000, 0x1000, CRC(90e44afe) SHA1(78e38601edf6bfc787b58750555a636b0cf74c5c), ROM_BIOS(1)) - ROMX_LOAD("aim65mon.z22", 0xf000, 0x1000, CRC(d01914b0) SHA1(e5b5ddd4cd43cce073a718ee4ba5221f2bc84eaf), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "dynatem", "Dynatem AIM-65") - ROMX_LOAD("dynaim65.z23", 0xe000, 0x1000, CRC(90e44afe) SHA1(78e38601edf6bfc787b58750555a636b0cf74c5c), ROM_BIOS(2)) - ROMX_LOAD("dynaim65.z22", 0xf000, 0x1000, CRC(83e1c6e7) SHA1(444134043edd83385bd70434cb100269901c4417), ROM_BIOS(2)) -ROM_END - -/* Currently dumped and available software: - * - * Name Loc CRC32 SHA1 - * ------------------------------------------------------------------------ - * Assembler Z24 0878b399 483e92b57d64be51643a9f6490521a8572aa2f68 - * Basic V1.1 Z25 d7b42d2a 4bbdb28d332429825adea0266ed9192786d9e392 - * Basic V1.1 Z26 36a61f39 f5ce0126cb594a565e730973fd140d03c298cefa - * Forth V1.3 Z25 0671d019 dd2a1613e435c833634100cf4a22c6cff70c7a26 - * Forth V1.3 Z26 a80ad472 42a2e8c86829a2fe48090e6665ff9fe25b12b070 - * Mathpack Z24 4889af55 5e9541ddfc06e3802d09b30d1bd89c5da914c76e - * Monitor Z22 d01914b0 e5b5ddd4cd43cce073a718ee4ba5221f2bc84eaf - * Monitor Z23 90e44afe 78e38601edf6bfc787b58750555a636b0cf74c5c - * Monitor Dynatem Z22 83e1c6e7 444134043edd83385bd70434cb100269901c4417 - * PL/65 V1.0 Z25 76dcf864 e937c54ed109401f796640cd45b27dfefb76667e - * PL/65 V1.0 Z26 2ac71abd 6df5e3125bebefac80d51d9337555f54bdf0d8ea - * - */ - - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP(1977, aim65, 0, 0, aim65, aim65, driver_device, 0, "Rockwell", "AIM 65", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/aim65_40.c b/src/mess/drivers/aim65_40.c deleted file mode 100644 index df749db8493..00000000000 --- a/src/mess/drivers/aim65_40.c +++ /dev/null @@ -1,145 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Rockwell AIM-65/40 - - Skeleton driver - -***************************************************************************/ - -/* - -Attached are the three main aim-65/40 roms, plus one unlabeled expansion rom for the 65/40 which someone had accidentally stuck into the aim-65 non/40 I was restoring on campus. (The rom pinout is different between the two systems, iirc.). I have no idea what that rom does. -The .zxx location on the rom filename (labeled R2332LP // R3224-11 // 8224) is hence wrong; it should probably be .z70 (at 0xc000-cfff) or .z72 (0xe000-0xefff) - - -The aim-65/40 has the following stuff on it: -XTALS: 16Mhz, 1.8432Mhz -6522 VIA ('Keyboard VIA' which reads the keyboard) -6522 VIA ('System VIA' which does the display and printer, and probably the cassette interface) -6522 VIA ('User VIA' which is in charge of the parallel port and expansion I/O) -6502 processor (clock is some division of the 16Mhz XTAL) -6551 ACIA (marked JACIA on board; used for serial port, has its own 1.8432Mhz XTAL) -Onboard beeper/speaker -Other chips: MC3242A, MC3480P, SN74159N, mc1488/1489 pair (for rs232) -ROM: 8 sockets meant for 2332 mask roms/mcm68732 eproms, or, if only 4 sockets are used, 2364 mask roms/mcm68764 eproms, selectable which mode by jumper. (normal 2732s won't work due to an inverted vpp pin i think, but theres jumpers on the board which will probably allow it), each socket addresses 0x1000 (or 0x2000) of space: -z63 is 0x8000-0x8fff, (see below about possible expansion ram here instead of rom) -z64 is 0x9000-0x9fff, (see below about possible expansion ram here instead of rom) -z65 is 0xa000-0xafff (first monitor rom lives here on my board),(see below about possible expansion ram here instead of rom) -z66 is 0xb000-0xbfff (second monitor rom lives here on my board),(see below about possible expansion ram here instead of rom) -z70 is 0xc000-0xcfff -z71 is 0xd000-0xdfff -z72 is 0xe000-0xefff -z73 is 0xf000-0xffff (i/o rom always lives here) -RAM: -The aim-65/40 comes standard with anywhere from 4k to 16k of ram at 0x0000-0x3fff, and can be populated in 4k increments with another 16k at 0x4000-0x7fff and another 16k at 0x8000-0xbfff (if installed, this last 16k prevents the first four rom sockets from being used since they address the same place, and the monitor roms must be moved to the z70 and z71, or z71 and z72 sockets. The i/o rom knows to search on 4k boundaries for the monitor roms) -The vias and acia are memory mapped over top of a blank area in the i/o rom from 0xff80 to 0xffe0, as such: -ff80-ff9f = unknown, open bus? -ffa0-ffaf = user via -ffb0-ffbf = system via -ffc0-ffcf = keyboars via -ffd0-ffd3 (mirrored at ffd4, ffd8, ffdc probably) = acia - -I have a copy of the official 'green book' Aim 65/40 i/o rom listing/asm source code, which is very informative about how the hardware works. However it is going to be a major pain in the ass to scan, owing to its small size and failing binding. -The source code there implies that *maybe* ff7e and ff7f are also open bus. - -*/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/6522via.h" -#include "machine/mos6551.h" -#include "aim65_40.lh" - - -//************************************************************************** -// MACROS/CONSTANTS -//************************************************************************** - -#define M6502_TAG "m6502" -#define M6522_0_TAG "m6522_0" -#define M6522_1_TAG "m6522_1" -#define M6522_2_TAG "m6522_2" -#define M6551_TAG "m6551" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class aim65_40_state : public driver_device -{ -public: - aim65_40_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } - - // devices - device_t *m_via0; - device_t *m_via1; - device_t *m_via2; - device_t *m_speaker; -}; - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( aim65_40_mem, AS_PROGRAM, 8, aim65_40_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAM - AM_RANGE(0xa000, 0xff7f) AM_ROM - AM_RANGE(0xffa0, 0xffaf) AM_DEVREADWRITE(M6522_0_TAG, via6522_device, read, write) - AM_RANGE(0xffb0, 0xffbf) AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write) - AM_RANGE(0xffc0, 0xffcf) AM_DEVREADWRITE(M6522_2_TAG, via6522_device, read, write) - AM_RANGE(0xffd0, 0xffd3) AM_DEVREADWRITE(M6551_TAG, mos6551_device, read, write) - AM_RANGE(0xffe0, 0xffff) AM_ROM -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( aim65_40 ) -INPUT_PORTS_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static MACHINE_CONFIG_START( aim65_40, aim65_40_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M6502_TAG, M6502, 1000000) - MCFG_CPU_PROGRAM_MAP(aim65_40_mem) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_aim65_40) - - /* sound hardware */ - - /* devices */ - MCFG_DEVICE_ADD(M6522_0_TAG, VIA6522, 0) - MCFG_DEVICE_ADD(M6522_1_TAG, VIA6522, 0) - MCFG_DEVICE_ADD(M6522_2_TAG, VIA6522, 0) - MCFG_DEVICE_ADD(M6551_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) -MACHINE_CONFIG_END - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( aim65_40 ) - ROM_REGION( 0x10000, M6502_TAG, 0 ) - ROM_LOAD( "mon a v1.0 r32u5-11.z65", 0xa000, 0x1000, CRC(8c970c67) SHA1(5c8aecb2155a10777a57d4f0f2d16b7ba7b1fb45) ) - ROM_LOAD( "mon b v1.0 r32u6-11.z66", 0xb000, 0x1000, CRC(38a1e0cd) SHA1(37c34e32ad25d27e9590ee3f325801ca311be7b1) ) - ROM_LOAD( "r2332lp r3224-11.z70", 0xc000, 0x1000, CRC(0878b399) SHA1(483e92b57d64be51643a9f6490521a8572aa2f68) ) // Assembler - ROM_LOAD( "i-of v1.0 r32t3-12.z73", 0xf000, 0x1000, CRC(a62bec4a) SHA1(a2fc69a33dc3b7684bf3399beff7b22eaf05c843) ) -ROM_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, aim65_40, 0, 0, aim65_40, aim65_40, driver_device, 0, "Rockwell", "AIM-65/40", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/alesis.c b/src/mess/drivers/alesis.c deleted file mode 100644 index 605305b6b64..00000000000 --- a/src/mess/drivers/alesis.c +++ /dev/null @@ -1,485 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Alesis HR-16 and SR-16 drum machines - - 06/04/2010 Skeleton driver. - - http://www.vintagesynth.com/misc/hr16.php - http://www.vintagesynth.com/misc/sr16.php - http://www.vintagesynth.com/misc/mmt8.php - -****************************************************************************/ - -#include "emu.h" -#include "includes/alesis.h" -#include "sr16.lh" - - -WRITE8_MEMBER( alesis_state::kb_matrix_w ) -{ - m_kb_matrix = data; -} - -READ8_MEMBER( alesis_state::kb_r ) -{ - UINT8 data = 0xff; - - if (!(m_kb_matrix & 0x01)) - data &= m_col1->read(); - if (!(m_kb_matrix & 0x02)) - data &= m_col2->read(); - if (!(m_kb_matrix & 0x04)) - data &= m_col3->read(); - if (!(m_kb_matrix & 0x08)) - data &= m_col4->read(); - if (!(m_kb_matrix & 0x10)) - data &= m_col5->read(); - if (!(m_kb_matrix & 0x20)) - data &= m_col6->read(); - - return data; -} - -WRITE8_MEMBER( alesis_state::led_w ) -{ - output_set_value("patt_led", data & 0x01 ? 1 : 0); - output_set_value("song_led", data & 0x01 ? 0 : 1); - output_set_value("play_led", data & 0x02 ? 0 : 1); - output_set_value("record_led",data & 0x04 ? 0 : 1); - output_set_value("voice_led", data & 0x08 ? 0 : 1); - output_set_value("tune_led", data & 0x10 ? 0 : 1); - output_set_value("mix_led", data & 0x20 ? 0 : 1); - output_set_value("tempo_led", data & 0x40 ? 0 : 1); - output_set_value("midi_led", data & 0x80 ? 0 : 1); -} - -READ8_MEMBER( alesis_state::p3_r ) -{ - UINT8 data = 0xff; - - data &= ~(m_cassette->input() > 0.01 ? 0x00 : 0x08); - - return data; -} - -WRITE8_MEMBER( alesis_state::p3_w ) -{ - m_cassette->output(data & 0x04 ? -1.0 : +1.0); -} - -WRITE8_MEMBER( alesis_state::sr16_lcd_w ) -{ - m_lcdc->write(space, BIT(m_kb_matrix,7), data); -} - -WRITE8_MEMBER( alesis_state::mmt8_led_w ) -{ - output_set_value("play_led", data & 0x01 ? 0 : 1); - output_set_value("record_led" , data & 0x02 ? 0 : 1); - output_set_value("part_led", data & 0x04 ? 0 : 1); - output_set_value("edit_led", data & 0x08 ? 0 : 1); - output_set_value("song_led", data & 0x10 ? 0 : 1); - output_set_value("echo_led", data & 0x20 ? 0 : 1); - output_set_value("loop_led", data & 0x40 ? 0 : 1); - - m_leds = data; -} - -READ8_MEMBER( alesis_state::mmt8_led_r ) -{ - return m_leds; -} - -WRITE8_MEMBER( alesis_state::track_led_w ) -{ - for (int i=0; i<8; i++) - output_set_indexed_value("track_led", i + 1, BIT(data, i)); -} - -READ8_MEMBER( alesis_state::mmt8_p3_r ) -{ - // ---- -x-- Tape in - // ---- x--- Start/Stop input - UINT8 data = 0xff; - - data &= ~(m_cassette->input() > 0.01 ? 0x00 : 0x04); - - return data; -} - -WRITE8_MEMBER( alesis_state::mmt8_p3_w ) -{ - // ---x ---- Tape out - // --x- ---- Click out - - m_cassette->output(data & 0x10 ? -1.0 : +1.0); -} - -static ADDRESS_MAP_START(hr16_mem, AS_PROGRAM, 8, alesis_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_MIRROR(0x8000) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(hr16_io, AS_IO, 8, alesis_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0000) AM_READ(kb_r) - AM_RANGE(0x0002, 0x0002) AM_DEVWRITE("dm3ag", alesis_dm3ag_device, write) - AM_RANGE(0x0004, 0x0004) AM_WRITE(led_w) - AM_RANGE(0x0006, 0x0007) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) - AM_RANGE(0x0008, 0x0008) AM_WRITE(kb_matrix_w) - AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READ_PORT("SELECT") AM_WRITENOP - AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITENOP - AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_r, p3_w) - AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("nvram") // 32Kx8 SRAM, (battery-backed) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sr16_mem, AS_PROGRAM, 8, alesis_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sr16_io, AS_IO, 8, alesis_state) - //ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0000) AM_MIRROR(0xff) AM_DEVWRITE("dm3ag", alesis_dm3ag_device, write) - AM_RANGE(0x0200, 0x0200) AM_MIRROR(0xff) AM_WRITE(sr16_lcd_w) - AM_RANGE(0x0300, 0x0300) AM_MIRROR(0xff) AM_WRITE(kb_matrix_w) - AM_RANGE(0x0400, 0x0400) AM_MIRROR(0xff) AM_READ(kb_r) - AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READNOP - AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITENOP - AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_r, p3_w) - AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("nvram") // 32Kx8 SRAM, (battery-backed) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mmt8_io, AS_IO, 8, alesis_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xff02, 0xff02) AM_WRITE(track_led_w) - AM_RANGE(0xff04, 0xff04) AM_READWRITE(mmt8_led_r, mmt8_led_w) - AM_RANGE(0xff06, 0xff06) AM_WRITE(kb_matrix_w) - AM_RANGE(0xff08, 0xff09) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) - AM_RANGE(0xff0e, 0xff0e) AM_READNOP - AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READ(kb_r) - AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITENOP - AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(mmt8_p3_r, mmt8_p3_w) - AM_RANGE(0x0000, 0xffff) AM_RAM AM_SHARE("nvram") // 2x32Kx8 SRAM, (battery-backed) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( hr16 ) - PORT_START("COL1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_C) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFFSET") PORT_CODE(KEYCODE_O) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SWING") PORT_CODE(KEYCODE_W) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("QUANT") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LENGTH") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PATT") PORT_CODE(KEYCODE_P) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI/UTIL") PORT_CODE(KEYCODE_U) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO") PORT_CODE(KEYCODE_T) - PORT_START("COL2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INSERT") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SONG") PORT_CODE(KEYCODE_S) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_START("COL3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FILL") PORT_CODE(KEYCODE_F) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_START("COL4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PLAY") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP/CONTINUE") PORT_CODE(KEYCODE_END) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RECORD") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("< -") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("> +") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("VOICE") PORT_CODE(KEYCODE_V) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TUNE") PORT_CODE(KEYCODE_H) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIX") PORT_CODE(KEYCODE_M) - PORT_START("COL5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIDE") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CRASH") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 1") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 2") PORT_CODE(KEYCODE_F8) - PORT_START("COL6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KICK") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SNARE") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLOSED HAT") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MID HAT") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OPEN HAT") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLAPS") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 3") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 4") PORT_CODE(KEYCODE_8_PAD) - - PORT_START("SELECT") - PORT_BIT(0xff, 0x00, IPT_DIAL) PORT_NAME("SELECT Slider") PORT_SENSITIVITY(50) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_DOWN) PORT_CODE_INC(KEYCODE_UP) -INPUT_PORTS_END - -static INPUT_PORTS_START( mmt8 ) - PORT_START("COL1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<<") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(">>") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRANS") PORT_CODE(KEYCODE_R) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PLAY") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP/CONTINUE") PORT_CODE(KEYCODE_END) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_C) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RECORD") PORT_CODE(KEYCODE_HOME) - PORT_START("COL2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRACK 8") PORT_CODE(KEYCODE_F8) - PORT_START("COL3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO") PORT_CODE(KEYCODE_T) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x38, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAGE DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAGE UP") PORT_CODE(KEYCODE_UP) - PORT_START("COL4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLICK") PORT_CODE(KEYCODE_G) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI CHAN") PORT_CODE(KEYCODE_I) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE") PORT_CODE(KEYCODE_Y) - PORT_START("COL5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLOCK") PORT_CODE(KEYCODE_K) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SONG") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MERGE") PORT_CODE(KEYCODE_M) - PORT_START("COL6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI FILTER") PORT_CODE(KEYCODE_F) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI ECHO") PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOOP") PORT_CODE(KEYCODE_J) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("QUANT") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LENGTH") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PART") PORT_CODE(KEYCODE_P) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EDIT") PORT_CODE(KEYCODE_E) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NAME") PORT_CODE(KEYCODE_N) -INPUT_PORTS_END - -static INPUT_PORTS_START( sr16 ) - PORT_START("COL1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRESET/USER") PORT_CODE(KEYCODE_U) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PATTERN/SONG") PORT_CODE(KEYCODE_P) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - PORT_START("COL2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RECORD SETUP") PORT_CODE(KEYCODE_R) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DRUM SET") PORT_CODE(KEYCODE_D) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_START("COL3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKUP") PORT_CODE(KEYCODE_K) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PLAY") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FILL") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_C) - PORT_START("COL4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI SETUP") PORT_CODE(KEYCODE_M) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO/PAGE UP") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIDE") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CRASH") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 1") PORT_CODE(KEYCODE_6_PAD) - PORT_START("COL5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERFORM/COMPOSE") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO/PAGE DOWN") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KICK") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SNARE") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLOSED HAT") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OPEN HAT") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLAPS") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 2") PORT_CODE(KEYCODE_F6) - PORT_START("COL6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -PALETTE_INIT_MEMBER(alesis_state, alesis) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -void alesis_state::machine_reset() -{ - m_kb_matrix = 0xff; - m_leds = 0; - memset(m_lcd_digits, 0, sizeof(m_lcd_digits)); -} - - -static HD44780_PIXEL_UPDATE(sr16_pixel_update) -{ - alesis_state *driv_state = device.machine().driver_data(); - - if (line == 1 && pos >= 6 && pos < 8) // last 2 characters of the second line are used to control the LCD symbols - driv_state->update_lcd_symbols(bitmap, pos, y, x, state); - else if (pos < 8) - bitmap.pix16(line*9 + y, pos*6 + x) = state; -} - -static MACHINE_CONFIG_START( hr16, alesis_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8031, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(hr16_mem) - MCFG_CPU_IO_MAP(hr16_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(6*16, 9*2) - MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_PALETTE_INIT_OWNER(alesis_state, alesis) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) - MCFG_CASSETTE_INTERFACE("hr16_cass") - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 16) - - /* sound hardware */ - MCFG_ALESIS_DM3AG_ADD("dm3ag", XTAL_12MHz/2) - - MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sr16, hr16 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sr16_mem) - MCFG_CPU_IO_MAP(sr16_io) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(6*8, 9*2) - MCFG_SCREEN_VISIBLE_AREA(0, 6*8-1, 0, 9*2-1) - MCFG_DEFAULT_LAYOUT(layout_sr16) - - MCFG_DEVICE_MODIFY("hd44780") - MCFG_HD44780_LCD_SIZE(2, 8) - MCFG_HD44780_PIXEL_UPDATE_CB(sr16_pixel_update) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mmt8, hr16 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(mmt8_io) - - MCFG_DEVICE_REMOVE("dm3ag") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( hr16 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS("v109") - ROM_SYSTEM_BIOS(0, "v106", "ver 1.06") - ROMX_LOAD( "hr16-v1.06.bin", 0x0000, 0x8000, CRC(f0cdb899) SHA1(f21cd87af15ad5a0bfec992e38131c4f4e4c5102), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v107", "ver 1.07") - ROMX_LOAD( "2-19-0256-v107.u11", 0x0000, 0x8000, CRC(2582b6a2) SHA1(f1f135335578c938be63b37ed207e82b7a0e13be), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v109", "ver 1.09") - ROMX_LOAD( "2-19-0256-v109.u11", 0x0000, 0x8000, CRC(a9bdbf20) SHA1(229b4230c7b5380efbfd42fa95645723d3fd6d55), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v200", "ver 2.00") - ROMX_LOAD( "hr16-v2.0.bin", 0x0000, 0x8000, CRC(a3fcba12) SHA1(4c94be7e94e5a1d86443571cd4d375158a6e7b65), ROM_BIOS(4)) - - ROM_REGION( 0x100000, "dm3ag", 0 ) - ROM_LOAD( "2-27-0004.u16", 0x00000, 0x80000, CRC(8e103536) SHA1(092e1cf649fbef171cfaf91e20707d89998b7a1e)) - ROM_LOAD( "2-27-0003.u15", 0x80000, 0x80000, CRC(82e9b78c) SHA1(89728cb38ae172b5e347a03018617c94a087dce0)) -ROM_END - -ROM_START( hr16b ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v200", "ver 2.00") - ROMX_LOAD( "2-19-0256-v200.u11",0x0000, 0x8000, CRC(19cf0fce) SHA1(f8b3786b32d68e3627a654b8b3916befbe9bc540), ROM_BIOS(1)) - - ROM_REGION( 0x100000, "dm3ag", 0 ) - ROM_LOAD( "2-27-0008.u16", 0x00000, 0x80000, CRC(11ca930e) SHA1(2f57fdd02f9b2146a551370a74cab1fa800145ab)) - ROM_LOAD( "2-27-0007.u15", 0x80000, 0x80000, CRC(319746db) SHA1(46b32a3ab2fbad67fb4566f607f578a2e9defd63)) -ROM_END - -ROM_START( mmt8 ) - ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v111", "ver 1.11") - ROMX_LOAD( "mt8v1-11.bin", 0x00000, 0x08000, CRC(c9951946) SHA1(149bc5ea46466537de4074820c66a2296ea43bc1), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v109", "ver 1.09") - ROMX_LOAD( "mt8v1-09.bin", 0x00000, 0x08000, CRC(0ec41dec) SHA1(2c283965e510b586a08f0290df4dd357e6b19b62), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v108", "ver 1.08") - ROMX_LOAD( "mt8v1-08.bin", 0x00000, 0x08000, CRC(a0615455) SHA1(77395c837b356b34d6b96f6f46eca8c89b57434e), ROM_BIOS(3)) -ROM_END - -ROM_START( sr16 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v104", "ver 1.04") - ROMX_LOAD( "sr16_v1_04.bin", 0x0000, 0x10000, CRC(d049af6e) SHA1(0bbeb4bd25e33a9eca64d5a31480f96a0040617e), ROM_BIOS(1)) - - ROM_REGION( 0x100000, "dm3ag", ROMREGION_ERASEFF ) - ROM_LOAD( "sr16.u6", 0x00000, 0x80000, CRC(6da96987) SHA1(3ec8627d440bc73841e1408a19def09a8b0b77f7)) - ROM_LOAD( "sr16.u5", 0x80000, 0x80000, CRC(8bb25cfa) SHA1(273ad59d017b54a7e8d5e1ec61c8cd807a0e4af3)) -ROM_END - - -DRIVER_INIT_MEMBER(alesis_state,hr16) -{ - int i; - UINT8 *ROM = memregion("maincpu")->base(); - UINT8 *orig = memregion("user1")->base(); - for (i = 0; i < 0x8000; i++) - { - ROM[BITSWAP16(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i]; - } -} - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -SYST( 1987, hr16, 0, 0, hr16, hr16, alesis_state, hr16, "Alesis", "HR-16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -SYST( 1987, mmt8, 0, 0, mmt8, mmt8, driver_device, 0, "Alesis", "MMT-8", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -SYST( 1989, hr16b, hr16, 0, hr16, hr16, alesis_state, hr16, "Alesis", "HR-16B", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -SYST( 1990, sr16, 0, 0, sr16, sr16, driver_device, 0, "Alesis", "SR-16 (Alesis)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/alphasma.c b/src/mess/drivers/alphasma.c deleted file mode 100644 index d20012238d4..00000000000 --- a/src/mess/drivers/alphasma.c +++ /dev/null @@ -1,479 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - AlphaSmart Pro - - driver by Sandro Ronco - - TODO: - - ADB and PS/2 - - charset ROM is wrong - -****************************************************************************/ - -#include "emu.h" -#include "cpu/mc68hc11/mc68hc11.h" -#include "machine/nvram.h" -#include "machine/ram.h" -#include "video/hd44780.h" -#include "rendlay.h" - -class alphasmart_state : public driver_device -{ -public: - alphasmart_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_lcdc0(*this, "ks0066_0"), - m_lcdc1(*this, "ks0066_1"), - m_nvram(*this, "nvram"), - m_ram(*this, RAM_TAG), - m_rambank(*this, "rambank"), - m_keyboard(*this, "COL"), - m_battery_status(*this, "BATTERY") - { } - - required_device m_maincpu; - required_device m_lcdc0; - required_device m_lcdc1; - required_device m_nvram; - required_device m_ram; - required_memory_bank m_rambank; - required_ioport_array<16> m_keyboard; - required_ioport m_battery_status; - - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(alphasmart); - virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_INPUT_CHANGED_MEMBER(kb_irq); - DECLARE_READ8_MEMBER(kb_r); - DECLARE_WRITE8_MEMBER(kb_matrixl_w); - DECLARE_WRITE8_MEMBER(kb_matrixh_w); - DECLARE_READ8_MEMBER(port_a_r); - virtual DECLARE_WRITE8_MEMBER(port_a_w); - DECLARE_READ8_MEMBER(port_d_r); - DECLARE_WRITE8_MEMBER(port_d_w); - void update_lcdc(address_space &space, bool lcdc0, bool lcdc1); - -protected: - UINT8 m_matrix[2]; - UINT8 m_port_a; - UINT8 m_port_d; - bitmap_ind16 * m_tmp_bitmap; -}; - -class asma2k_state : public alphasmart_state -{ -public: - asma2k_state(const machine_config &mconfig, device_type type, const char *tag) - : alphasmart_state(mconfig, type, tag), - m_intram(*this, "internal_ram") - { } - - required_shared_ptr m_intram; - - DECLARE_READ8_MEMBER(io_r); - DECLARE_WRITE8_MEMBER(io_w); - DECLARE_WRITE8_MEMBER(port_a_w); - -private: - UINT8 m_lcd_ctrl; -}; - -INPUT_CHANGED_MEMBER(alphasmart_state::kb_irq) -{ - m_maincpu->set_input_line(MC68HC11_IRQ_LINE, HOLD_LINE); -} - -READ8_MEMBER(alphasmart_state::kb_r) -{ - UINT16 matrix = (m_matrix[1]<<8) | m_matrix[0]; - UINT8 data = 0xff; - - for(int i=0; i<16; i++) - if (!(matrix & (1<read(); - - return data; -} - -WRITE8_MEMBER(alphasmart_state::kb_matrixl_w) -{ - m_matrix[0] = data; -} - -WRITE8_MEMBER(alphasmart_state::kb_matrixh_w) -{ - m_matrix[1] = data; -} - -READ8_MEMBER(alphasmart_state::port_a_r) -{ - return (m_port_a & 0xfd) | (m_battery_status->read() << 1); -} - -void alphasmart_state::update_lcdc(address_space &space, bool lcdc0, bool lcdc1) -{ - if (m_matrix[1] & 0x04) - { - UINT8 lcdc_data = 0; - - if (lcdc0) - lcdc_data |= m_lcdc0->read(space, BIT(m_matrix[1], 1)); - - if (lcdc1) - lcdc_data |= m_lcdc1->read(space, BIT(m_matrix[1], 1)); - - m_port_d = (m_port_d & 0xc3) | (lcdc_data>>2); - } - else - { - UINT8 lcdc_data = (m_port_d<<2) & 0xf0; - - if (lcdc0) - m_lcdc0->write(space, BIT(m_matrix[1], 1), lcdc_data); - - if (lcdc1) - m_lcdc1->write(space, BIT(m_matrix[1], 1), lcdc_data); - } -} - -WRITE8_MEMBER(alphasmart_state::port_a_w) -{ - UINT8 changed = (m_port_a ^ data) & data; - update_lcdc(space, changed & 0x80, changed & 0x20); - m_rambank->set_entry(((data>>3) & 0x01) | ((data>>4) & 0x02)); - m_port_a = data; -} - -READ8_MEMBER(alphasmart_state::port_d_r) -{ - return m_port_d; -} - -WRITE8_MEMBER(alphasmart_state::port_d_w) -{ - m_port_d = data; -} - - -static ADDRESS_MAP_START(alphasmart_mem, AS_PROGRAM, 8, alphasmart_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x003f ) AM_NOP // internal registers - AM_RANGE( 0x0040, 0x00ff ) AM_RAM // internal RAM - AM_RANGE( 0x0000, 0x7fff ) AM_RAMBANK("rambank") - AM_RANGE( 0x8000, 0x8000 ) AM_READWRITE(kb_r, kb_matrixh_w) - AM_RANGE( 0xc000, 0xc000 ) AM_WRITE(kb_matrixl_w) - AM_RANGE( 0x8000, 0xffff ) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(alphasmart_io, AS_IO, 8, alphasmart_state) - AM_RANGE( MC68HC11_IO_PORTA, MC68HC11_IO_PORTA ) AM_READWRITE(port_a_r, port_a_w) - AM_RANGE( MC68HC11_IO_PORTD, MC68HC11_IO_PORTD ) AM_READWRITE(port_d_r, port_d_w) -ADDRESS_MAP_END - -READ8_MEMBER(asma2k_state::io_r) -{ - if (offset == 0x2000) - return kb_r(space, offset); - - //else printf("unknown r: %x\n", offset); - - return 0; -} - -WRITE8_MEMBER(asma2k_state::io_w) -{ - if (offset == 0x2000) - kb_matrixh_w(space, offset, data); - else if (offset == 0x4000) - { - UINT8 changed = (m_lcd_ctrl ^ data) & data; - update_lcdc(space, changed & 0x01, changed & 0x02); - m_lcd_ctrl = data; - } - - //else printf("unknown w: %x %x\n", offset, data); -} - -WRITE8_MEMBER(asma2k_state::port_a_w) -{ - if ((m_port_a ^ data) & 0x40) - { - address_space &space = m_maincpu->space(AS_PROGRAM); - - if (data & 0x40) - space.install_readwrite_bank(0x0000, 0x7fff, "rambank"); - else - space.install_readwrite_handler(0x0000, 0x7fff, read8_delegate(FUNC(asma2k_state::io_r), this), write8_delegate(FUNC(asma2k_state::io_w), this)); - - // internal registers / RAM - space.nop_readwrite(0x00, 0x3f); - space.install_ram(0x40, 0xff, m_intram.target()); - } - - m_rambank->set_entry(((data>>4) & 0x03)); - m_port_a = data; -} - - -static ADDRESS_MAP_START(asma2k_mem, AS_PROGRAM, 8, asma2k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x003f ) AM_NOP // internal registers - AM_RANGE( 0x0040, 0x00ff ) AM_RAM AM_SHARE("internal_ram") // internal RAM - AM_RANGE( 0x0000, 0x7fff ) AM_RAMBANK("rambank") - AM_RANGE( 0x9000, 0x9000 ) AM_WRITE(kb_matrixl_w) - AM_RANGE( 0x8000, 0xffff ) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( alphasmart ) - PORT_START("COL.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("COL.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("COL.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Left Command") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Right Command") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL)// - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear File") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("COL.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_NAME("Send") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("COL.9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_NAME("Left Alt/Option") PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_NAME("Right Alt/Option") PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.10") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.11") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("Pause") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Backspace") PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("ScrLk") PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Return") PORT_CHAR(13) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.12") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.13") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.14") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_START("COL.15") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_CHANGED_MEMBER(DEVICE_SELF, alphasmart_state, kb_irq, NULL) - - PORT_START("BATTERY") - PORT_CONFNAME(0x01, 0x01, "Battery status") - PORT_CONFSETTING (0x00, DEF_STR(Low)) - PORT_CONFSETTING (0x01, DEF_STR(Normal)) -INPUT_PORTS_END - -PALETTE_INIT_MEMBER(alphasmart_state, alphasmart) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -UINT32 alphasmart_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_lcdc0->screen_update(screen, *m_tmp_bitmap, cliprect); - copybitmap(bitmap, *m_tmp_bitmap, 0, 0, 0, 0, cliprect); - m_lcdc1->screen_update(screen, *m_tmp_bitmap, cliprect); - copybitmap(bitmap, *m_tmp_bitmap, 0, 0, 0, 18,cliprect); - return 0; -} - -void alphasmart_state::machine_start() -{ - UINT8* ram = m_ram->pointer(); - - m_rambank->configure_entries(0, 4, ram, 0x8000); - m_nvram->set_base(ram, 0x8000*4); - - m_tmp_bitmap = auto_bitmap_ind16_alloc(machine(), 6*40, 9*4); -} - -void alphasmart_state::machine_reset() -{ - m_rambank->set_entry(0); - m_matrix[0] = m_matrix[1] = 0; - m_port_a = 0; - m_port_d = 0; -} - -static MACHINE_CONFIG_START( alphasmart, alphasmart_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", MC68HC11, XTAL_8MHz/2) // MC68HC11D0, XTAL is 8 Mhz, unknown divider - MCFG_CPU_PROGRAM_MAP(alphasmart_mem) - MCFG_CPU_IO_MAP(alphasmart_io) - MCFG_MC68HC11_CONFIG(0, 192, 0x00) - - MCFG_KS0066_F05_ADD("ks0066_0") - MCFG_HD44780_LCD_SIZE(2, 40) - MCFG_KS0066_F05_ADD("ks0066_1") - MCFG_HD44780_LCD_SIZE(2, 40) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(alphasmart_state, screen_update) - MCFG_SCREEN_SIZE(6*40, 9*4) - MCFG_SCREEN_VISIBLE_AREA(0, (6*40)-1, 0, (9*4)-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(alphasmart_state, alphasmart) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( asma2k, alphasmart, asma2k_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(asma2k_mem) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( asmapro ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "alphasmartpro212.rom", 0x0000, 0x8000, CRC(896ddf1c) SHA1(c3c6a421c9ced92db97431d04b4a3f09a39de716) ) // Checksum 8D24 on label -ROM_END - -ROM_START( asma2k ) - ROM_REGION( 0x10000, "maincpu", 0 ) - /* - These dumps 33,253 bytes each, probably contain 32768 bytes of rom, - plus the remaining area is pal data for the mapper/io pal, all of - which is integrated onto one plcc44 chip called a zpsd211r. - */ - ROM_SYSTEM_BIOS( 0, "v314", "v3.14" ) - ROMX_LOAD( "alphasmart__2000__v3.1.4__h4.zpsd211r.plcc44.bin", 0x0000, 0x81e5, CRC(49487f6d) SHA1(e0b777dc68c671c31ba808e214fb9d2573b9a853), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v308", "v3.08" ) - ROMX_LOAD( "alphasmart__2000__v3.0.8.zpsd211r.plcc44.bin", 0x0000, 0x81e5, CRC(0b3b1a0c) SHA1(97878819188a1ec40052fbce9d5a5059728d5aec), ROM_BIOS(2) ) - - ROM_REGION( 0x8000, "spellcheck", 0 ) - ROM_LOAD( "spellcheck.bin", 0x0000, 0x8000, NO_DUMP ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1995, asmapro, 0, 0, alphasmart, alphasmart, driver_device, 0, "Intelligent Peripheral Devices", "AlphaSmart Pro" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1997, asma2k , 0, 0, asma2k , alphasmart, driver_device, 0, "Intelligent Peripheral Devices", "AlphaSmart 2000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/alphatro.c b/src/mess/drivers/alphatro.c deleted file mode 100644 index f13841c8dc8..00000000000 --- a/src/mess/drivers/alphatro.c +++ /dev/null @@ -1,517 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald, Robbbert -/*************************************************************************** - - Triumph-Adler (or Royal) Alphatronic PC - - skeleton driver - - z80 + HD46505SP as a CRTC - - Other chips: 8251, 8257, 8259 - Crystals: 16MHz, 17.73447MHz - Floppy format: 13cm, 2 sides, 40 tracks, 16 sectors, 256 bytes = 320kb. - FDC (uPD765) is in a plug-in module, with an undumped rom. - - Has a socket for monochrome (to the standard amber monitor), - and another for RGB. We emulate this with a configuration switch. - - This machine has 64k RAM, the ROMs being copied into RAM when - needed. - - There are several mystery ports which might be connected to the floppy - disk system. These are Port 30 (in and out), Port 20 (out) and certain - bits of Port 10 (in). This unit communicates via a simple parallel - interface. - - Port 10 bit 6 when high switches A000-DFFF over to roms that are in - a cart which is plugged into the RomPack socket. If C3 is found at - A000 or C000, then a jump is made to that address. It is however - possible that one of these addresses might be for the rom in the - floppy controller unit. - - - ToDo: - - Add fdc, then connect up software list - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "machine/i8251.h" -#include "machine/clock.h" -#include "imagedev/cassette.h" -#include "sound/beep.h" -#include "sound/wave.h" -#include "machine/ram.h" - -#define MAIN_CLOCK XTAL_4MHz - - -class alphatro_state : public driver_device -{ -public: - enum - { - TIMER_SYSTEM - }; - - alphatro_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_p_videoram(*this, "videoram") - , m_maincpu(*this, "maincpu") - , m_crtc(*this, "crtc") - , m_usart(*this, "usart") - , m_cass(*this, "cassette") - , m_beep(*this, "beeper") - , m_p_ram(*this, "main_ram"), - m_palette(*this, "palette") - { } - - DECLARE_READ8_MEMBER(port10_r); - DECLARE_WRITE8_MEMBER(port10_w); - DECLARE_INPUT_CHANGED_MEMBER(alphatro_break); - DECLARE_WRITE_LINE_MEMBER(txdata_callback); - DECLARE_WRITE_LINE_MEMBER(write_usart_clock); - DECLARE_PALETTE_INIT(alphatro); - TIMER_DEVICE_CALLBACK_MEMBER(timer_c); - TIMER_DEVICE_CALLBACK_MEMBER(timer_p); - MC6845_UPDATE_ROW(crtc_update_row); - required_shared_ptr m_p_videoram; - UINT8 *m_p_chargen; - UINT8 m_flashcnt; - -private: - UINT8 m_timer_bit; - UINT8 m_cass_data[4]; - bool m_cass_state; - bool m_cassold; - emu_timer* m_sys_timer; - virtual void video_start(); - virtual void machine_start(); - virtual void machine_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - required_device m_maincpu; - required_device m_crtc; - required_device m_usart; - required_device m_cass; - required_device m_beep; - required_shared_ptr m_p_ram; -public: - required_device m_palette; -}; - -READ8_MEMBER( alphatro_state::port10_r ) -{ - //return (space.machine().device("screen")->vblank() ? 0x00 : 0x80); - return m_timer_bit; -} - -WRITE8_MEMBER( alphatro_state::port10_w ) -{ -// Bit 0 -> 0 = 40 cols; 1 = 80 cols -// Bit 1 ? each keystroke, and a lot when it scrolls -// Bit 2 ? after a cload -// Bit 3 -> cassette relay -// Bit 4 -> BEEP -// Bit 6 -> 1 = select ROM pack - - data &= 0xfe; - - m_beep->set_state(BIT(data, 4)); - - m_cass->change_state( BIT(data, 3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - if (BIT(data,2)) - m_cass_state = 1; -} - -void alphatro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_SYSTEM: - m_timer_bit ^= 0x80; - break; - default: - assert_always(FALSE, "Unknown id in alphatro_state::device_timer"); - } -} - -WRITE_LINE_MEMBER( alphatro_state::txdata_callback ) -{ - m_cass_state = state; -} - -WRITE_LINE_MEMBER( alphatro_state::write_usart_clock ) -{ - m_usart->write_txc(state); - m_usart->write_rxc(state); -} - -void alphatro_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -MC6845_UPDATE_ROW( alphatro_state::crtc_update_row ) -{ - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - bool palette = BIT(ioport("CONFIG")->read(), 5); - if (y==0) m_flashcnt++; - bool inv; - UINT8 chr,gfx,attr,bg,fg; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - inv = (x == cursor_x); - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - attr = m_p_videoram[mem | 0x800]; - bg = (palette) ? 8 : attr & 7; // amber or RGB - fg = (palette) ? 0 : (attr & 0x38) >> 3; - - if BIT(attr, 7) // reverse video - { - inv ^= 1; - chr &= 0x7f; - } - - if (BIT(attr, 6) & BIT(m_flashcnt, 4)) // flashing - { - inv ^= 1; - } - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra]; - - if (inv) - { - UINT8 t = bg; - bg = fg; - fg = t; - } - - /* Display a scanline of a character (8 pixels) */ - *p++ = pens[BIT(gfx, 7) ? fg : bg]; - *p++ = pens[BIT(gfx, 6) ? fg : bg]; - *p++ = pens[BIT(gfx, 5) ? fg : bg]; - *p++ = pens[BIT(gfx, 4) ? fg : bg]; - *p++ = pens[BIT(gfx, 3) ? fg : bg]; - *p++ = pens[BIT(gfx, 2) ? fg : bg]; - *p++ = pens[BIT(gfx, 1) ? fg : bg]; - *p++ = pens[BIT(gfx, 0) ? fg : bg]; - } -} - -INPUT_CHANGED_MEMBER( alphatro_state::alphatro_break ) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); -} - -static ADDRESS_MAP_START( alphatro_map, AS_PROGRAM, 8, alphatro_state ) - AM_RANGE(0x0000, 0xefff) AM_RAM AM_SHARE("main_ram") - AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( alphatro_io, AS_IO, 8, alphatro_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x10, 0x10) AM_READWRITE(port10_r,port10_w) - AM_RANGE(0x20, 0x20) AM_READ_PORT("X0") - AM_RANGE(0x21, 0x21) AM_READ_PORT("X1") - AM_RANGE(0x22, 0x22) AM_READ_PORT("X2") - AM_RANGE(0x23, 0x23) AM_READ_PORT("X3") - AM_RANGE(0x24, 0x24) AM_READ_PORT("X4") - AM_RANGE(0x25, 0x25) AM_READ_PORT("X5") - AM_RANGE(0x26, 0x26) AM_READ_PORT("X6") - AM_RANGE(0x27, 0x27) AM_READ_PORT("X7") - AM_RANGE(0x28, 0x28) AM_READ_PORT("X8") - AM_RANGE(0x29, 0x29) AM_READ_PORT("X9") - AM_RANGE(0x2a, 0x2a) AM_READ_PORT("XA") - AM_RANGE(0x2b, 0x2b) AM_READ_PORT("XB") - //AM_RANGE(0x30, 0x30) unknown - // USART for cassette reading and writing - AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("usart", i8251_device, data_r, data_w) - AM_RANGE(0x41, 0x41) AM_DEVREADWRITE("usart", i8251_device, status_r, control_w) - // CRTC - HD46505 / HD6845SP - AM_RANGE(0x50, 0x50) AM_DEVWRITE("crtc", mc6845_device, address_w) - AM_RANGE(0x51, 0x51) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( alphatro ) - PORT_START("X0") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - - PORT_START("X1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad - /") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ASTERISK) // keypad equals - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad + x") PORT_CODE(KEYCODE_PLUS_PAD) - - PORT_START("X2") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("X3") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("X4") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START("X5") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("X6") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xa3) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("X7") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_DEL) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - - PORT_START("X8") - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - - PORT_START("X9") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("XA") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Clear Home") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - - PORT_START("XB") - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - - PORT_START("other") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF,alphatro_state,alphatro_break,0) - - PORT_START("CONFIG") - PORT_CONFNAME( 0x20, 0x00, "Monitor") - PORT_CONFSETTING( 0x00, "RGB") - PORT_CONFSETTING( 0x20, "Amber") -INPUT_PORTS_END - -static const gfx_layout charlayout = -{ - 8,16, - RGN_FRAC(1,1), - 1, - { RGN_FRAC(0,1) }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 -}; - -static GFXDECODE_START( alphatro ) - GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 4 ) -GFXDECODE_END - -void alphatro_state::machine_start() -{ - m_sys_timer = timer_alloc(TIMER_SYSTEM); -} - -void alphatro_state::machine_reset() -{ - // do what the IPL does - UINT8* ROM = memregion("roms")->base(); - m_maincpu->set_pc(0xe000); - // If BASIC is missing then it boots into the Monitor - memcpy(m_p_ram, ROM, 0x6000); // Copy BASIC to RAM - // Top half of this rom has keyboard tables and appears to be unused - memcpy(m_p_ram+0xe000, ROM+0xe000, 0x1000); // copy BIOS + Monitor to RAM - - // probably not correct, exact meaning of port is unknown, vblank/vsync is too slow. - m_sys_timer->adjust(attotime::from_usec(10),0,attotime::from_usec(10)); - m_timer_bit = 0; - m_cass_data[0] = m_cass_data[1] = m_cass_data[2] = m_cass_data[3] = 0; - m_cass_state = 0; - m_cassold = 0; - m_usart->write_rxd(0); - m_beep->set_state(0); - m_beep->set_frequency(950); /* piezo-device needs to be measured */ -} - -PALETTE_INIT_MEMBER(alphatro_state, alphatro) -{ - // RGB colours - palette.set_pen_color(0, 0x00, 0x00, 0x00); - palette.set_pen_color(1, 0x00, 0x00, 0xff); - palette.set_pen_color(2, 0xff, 0x00, 0x00); - palette.set_pen_color(3, 0xff, 0x00, 0xff); - palette.set_pen_color(4, 0x00, 0xff, 0x00); - palette.set_pen_color(5, 0x00, 0xff, 0xff); - palette.set_pen_color(6, 0xff, 0xff, 0x00); - palette.set_pen_color(7, 0xff, 0xff, 0xff); - // Amber - palette.set_pen_color(8, 0xf7, 0xaa, 0x00); -} - - -TIMER_DEVICE_CALLBACK_MEMBER(alphatro_state::timer_c) -{ - m_cass_data[3]++; - - if (m_cass_state != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = m_cass_state; - } - - if (m_cass_state) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -TIMER_DEVICE_CALLBACK_MEMBER(alphatro_state::timer_p) -{ - /* cassette - turn 1200/2400Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_usart->write_rxd((m_cass_data[1] < 12) ? 1 : 0); - m_cass_data[1] = 0; - } -} - -static MACHINE_CONFIG_START( alphatro, alphatro_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80,MAIN_CLOCK) - MCFG_CPU_PROGRAM_MAP(alphatro_map) - MCFG_CPU_IO_MAP(alphatro_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not correct - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", alphatro) - MCFG_PALETTE_ADD("palette", 9) // 8 colours + amber - MCFG_PALETTE_INIT_OWNER(alphatro_state, alphatro) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12_288MHz / 8) // clk unknown - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(alphatro_state, crtc_update_row) - - MCFG_DEVICE_ADD("usart", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(alphatro_state, txdata_callback)) - - MCFG_DEVICE_ADD("usart_clock", CLOCK, 19218) // 19218 to load a real tape, 19222 to load a tape made by this driver - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(alphatro_state, write_usart_clock)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("alphatro_cass") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_c", alphatro_state, timer_c, attotime::from_hz(4800)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", alphatro_state, timer_p, attotime::from_hz(40000)) - - MCFG_RAM_ADD("ram") - MCFG_RAM_DEFAULT_SIZE("64K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "alphatro_flop") -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( alphatro ) - ROM_REGION( 0x10000, "roms", ROMREGION_ERASE00) - ROM_LOAD( "613256.ic-1058", 0x0000, 0x6000, CRC(ceea4cb3) SHA1(b332dea0a2d3bb2978b8422eb0723960388bb467) ) - ROM_LOAD( "2764.ic-1038", 0xe000, 0x2000, CRC(e337db3b) SHA1(6010bade6a21975636383179903b58a4ca415e49) ) - - ROM_REGION( 0x10000, "user1", ROMREGION_ERASE00 ) - ROM_LOAD( "ipl.bin", 0x8000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "2732.ic-1067", 0x0000, 0x1000, CRC(61f38814) SHA1(35ba31c58a10d5bd1bdb202717792ca021dbe1a8) ) -ROM_END - -COMP( 1983, alphatro, 0, 0, alphatro, alphatro, driver_device, 0, "Triumph-Adler", "Alphatronic PC", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/altair.c b/src/mess/drivers/altair.c deleted file mode 100644 index e324a807478..00000000000 --- a/src/mess/drivers/altair.c +++ /dev/null @@ -1,132 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - MITS Altair 8800b Turnkey - - 04/12/2009 Initial driver by Miodrag Milanovic - - Commands: - All commands must be in uppercase. Address and data is - specified in Octal format (not hex). - - Press space to input your command line (not return). - - D - Memory Dump - J - Jump to address - M - Modify memory - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/i8085/i8085.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "imagedev/snapquik.h" - - -class altair_state : public driver_device -{ -public: - altair_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_mc6850(*this, "mc6850"), - m_ram(*this, "ram") - { - } - - DECLARE_QUICKLOAD_LOAD_MEMBER(altair); - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - -protected: - virtual void machine_reset(); - -private: - required_device m_maincpu; - required_device m_mc6850; - required_shared_ptr m_ram; -}; - - - -static ADDRESS_MAP_START(altair_mem, AS_PROGRAM, 8, altair_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xfcff ) AM_RAM AM_SHARE("ram") - AM_RANGE( 0xfd00, 0xfdff ) AM_ROM - AM_RANGE( 0xff00, 0xffff ) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(altair_io, AS_IO, 8, altair_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // TODO: Remove AM_MIRROR() and use SIO address S0-S7 - AM_RANGE( 0x00, 0x00 ) AM_MIRROR(0x10) AM_DEVREADWRITE("mc6850", acia6850_device, status_r, control_w) - AM_RANGE( 0x01, 0x01 ) AM_MIRROR(0x10) AM_DEVREADWRITE("mc6850", acia6850_device, data_r, data_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( altair ) -INPUT_PORTS_END - - -QUICKLOAD_LOAD_MEMBER( altair_state,altair) -{ - int quick_length; - int read_; - quick_length = image.length(); - if (quick_length >= 0xfd00) - return IMAGE_INIT_FAIL; - read_ = image.fread(m_ram, quick_length); - if (read_ != quick_length) - return IMAGE_INIT_FAIL; - - return IMAGE_INIT_PASS; -} - -WRITE_LINE_MEMBER(altair_state::write_acia_clock) -{ - m_mc6850->write_txc(state); - m_mc6850->write_rxc(state); -} - -void altair_state::machine_reset() -{ - // Set startup addess done by turn-key - m_maincpu->set_state_int(I8085_PC, 0xFD00); -} - -static MACHINE_CONFIG_START( altair, altair_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(altair_mem) - MCFG_CPU_IO_MAP(altair_io) - - /* video hardware */ - MCFG_DEVICE_ADD("mc6850", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("mc6850", acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("mc6850", acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("mc6850", acia6850_device, write_cts)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) // TODO: this is set using jumpers S3/S2/S1/S0 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(altair_state, write_acia_clock)) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", altair_state, altair, "bin", 0) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( al8800bt ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "turnmon.bin", 0xfd00, 0x0100, CRC(5c629294) SHA1(125c76216954b681721fff84a3aca05094b21a28)) - ROM_LOAD( "88dskrom.bin", 0xff00, 0x0100, CRC(7c5232f3) SHA1(24f940ad70ad2829e1bc800c6790b6e993e6ebf6)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1975, al8800bt, 0, 0, altair, altair, driver_device, 0, "MITS", "Altair 8800bt", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/alto2.c b/src/mess/drivers/alto2.c deleted file mode 100644 index c2142b0c304..00000000000 --- a/src/mess/drivers/alto2.c +++ /dev/null @@ -1,303 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/*************************************************************************** - * Xerox AltoII driver for MESS - * - ***************************************************************************/ - -#include "emu.h" -#include "rendlay.h" -#include "cpu/alto2/alto2cpu.h" -#include "machine/diablo_hd.h" - -class alto2_state : public driver_device -{ -public: - alto2_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_io_row0(*this, "ROW0"), - m_io_row1(*this, "ROW1"), - m_io_row2(*this, "ROW2"), - m_io_row3(*this, "ROW3"), - m_io_row4(*this, "ROW4"), - m_io_row5(*this, "ROW5"), - m_io_row6(*this, "ROW6"), - m_io_row7(*this, "ROW7"), - m_io_config(*this, "CONFIG") - { } - - DECLARE_DRIVER_INIT(alto2); - DECLARE_MACHINE_RESET(alto2); - -protected: - required_device m_maincpu; - required_ioport m_io_row0; - required_ioport m_io_row1; - required_ioport m_io_row2; - required_ioport m_io_row3; - required_ioport m_io_row4; - required_ioport m_io_row5; - required_ioport m_io_row6; - required_ioport m_io_row7; - optional_ioport m_io_config; -}; - -/* Input Ports */ - -#define PORT_KEY(_bit,_code,_char1,_char2,_name) \ - PORT_BIT(_bit, IP_ACTIVE_LOW, IPT_KEYBOARD) \ - PORT_CODE(_code) PORT_NAME(_name) \ - PORT_CHAR(_char1) PORT_CHAR(_char2) -#define SPACING " " - -static INPUT_PORTS_START( alto2 ) - PORT_START("ROW0") - PORT_KEY(A2_KEY_5, KEYCODE_5, '5', '%', "5" SPACING "%") //!< normal: 5 shifted: % - PORT_KEY(A2_KEY_4, KEYCODE_4, '4', '$', "4" SPACING "$") //!< normal: 4 shifted: $ - PORT_KEY(A2_KEY_6, KEYCODE_6, '6', '~', "6" SPACING "~") //!< normal: 6 shifted: ~ - PORT_KEY(A2_KEY_E, KEYCODE_E, 'e', 'E', "e" SPACING "E") //!< normal: e shifted: E - PORT_KEY(A2_KEY_7, KEYCODE_7, '7', '&', "7" SPACING "&") //!< normal: 7 shifted: & - PORT_KEY(A2_KEY_D, KEYCODE_D, 'd', 'D', "d" SPACING "D") //!< normal: d shifted: D - PORT_KEY(A2_KEY_U, KEYCODE_U, 'u', 'U', "u" SPACING "U") //!< normal: u shifted: U - PORT_KEY(A2_KEY_V, KEYCODE_V, 'v', 'V', "v" SPACING "V") //!< normal: v shifted: V - PORT_KEY(A2_KEY_0, KEYCODE_0, '0', ')', "0" SPACING ")") //!< normal: 0 shifted: ) - PORT_KEY(A2_KEY_K, KEYCODE_K, 'k', 'K', "k" SPACING "K") //!< normal: k shifted: K - PORT_KEY(A2_KEY_MINUS, KEYCODE_MINUS, '-', '_', "-" SPACING "_") //!< normal: - shifted: _ - PORT_KEY(A2_KEY_P, KEYCODE_P, 'p', 'P', "p" SPACING "P") //!< normal: p shifted: P - PORT_KEY(A2_KEY_SLASH, KEYCODE_SLASH, '/', '?', "/" SPACING "?") //!< normal: / shifted: ? - PORT_KEY(A2_KEY_BACKSLASH, KEYCODE_BACKSLASH, '\\', '|', "\\" SPACING "|") //!< normal: \ shifted: | - PORT_KEY(A2_KEY_LF, KEYCODE_DOWN, 10, 10, "LF" ) //!< normal: LF shifted: ? - PORT_KEY(A2_KEY_BS, KEYCODE_BACKSPACE, 8, 8, "BS" ) //!< normal: BS shifted: ? - - PORT_START("ROW1") - PORT_KEY(A2_KEY_3, KEYCODE_3, '3', '#', "3" SPACING "#") //!< normal: 3 shifted: # - PORT_KEY(A2_KEY_2, KEYCODE_2, '2', '@', "2" SPACING "@") //!< normal: 2 shifted: @ - PORT_KEY(A2_KEY_W, KEYCODE_W, 'w', 'W', "w" SPACING "W") //!< normal: w shifted: W - PORT_KEY(A2_KEY_Q, KEYCODE_Q, 'q', 'Q', "q" SPACING "Q") //!< normal: q shifted: Q - PORT_KEY(A2_KEY_S, KEYCODE_S, 's', 'S', "s" SPACING "S") //!< normal: s shifted: S - PORT_KEY(A2_KEY_A, KEYCODE_A, 'a', 'A', "a" SPACING "A") //!< normal: a shifted: A - PORT_KEY(A2_KEY_9, KEYCODE_9, '9', '(', "9" SPACING "(") //!< normal: 9 shifted: ( - PORT_KEY(A2_KEY_I, KEYCODE_I, 'i', 'I', "i" SPACING "I") //!< normal: i shifted: I - PORT_KEY(A2_KEY_X, KEYCODE_X, 'x', 'X', "x" SPACING "X") //!< normal: x shifted: X - PORT_KEY(A2_KEY_O, KEYCODE_O, 'o', 'O', "o" SPACING "O") //!< normal: o shifted: O - PORT_KEY(A2_KEY_L, KEYCODE_L, 'l', 'L', "l" SPACING "L") //!< normal: l shifted: L - PORT_KEY(A2_KEY_COMMA, KEYCODE_COMMA, ',', '<', "," SPACING "<") //!< normal: , shifted: < - PORT_KEY(A2_KEY_QUOTE, KEYCODE_QUOTE, 39, 34, "'" SPACING "\"") //!< normal: ' shifted: " - PORT_KEY(A2_KEY_RBRACKET, KEYCODE_CLOSEBRACE, ']', '}', "]" SPACING "}") //!< normal: ] shifted: } - PORT_KEY(A2_KEY_BLANK_MID, KEYCODE_END, 0, 0, "MID" ) //!< middle blank key - PORT_KEY(A2_KEY_BLANK_TOP, KEYCODE_PGUP, 0, 0, "TOP" ) //!< top blank key - - PORT_START("ROW2") - PORT_KEY(A2_KEY_1, KEYCODE_1, '1', '!', "1" SPACING "!") //!< normal: 1 shifted: ! - PORT_KEY(A2_KEY_ESCAPE, KEYCODE_ESC, 27, 0, "ESC" ) //!< normal: ESC shifted: ? - PORT_KEY(A2_KEY_TAB, KEYCODE_TAB, 9, 0, "TAB" ) //!< normal: TAB shifted: ? - PORT_KEY(A2_KEY_F, KEYCODE_F, 'f', 'F', "f" SPACING "F") //!< normal: f shifted: F - PORT_KEY(A2_KEY_CTRL, KEYCODE_LCONTROL, 0, 0, "CTRL" ) //!< CTRL - PORT_KEY(A2_KEY_C, KEYCODE_C, 'c', 'C', "c" SPACING "C") //!< normal: c shifted: C - PORT_KEY(A2_KEY_J, KEYCODE_J, 'j', 'J', "j" SPACING "J") //!< normal: j shifted: J - PORT_KEY(A2_KEY_B, KEYCODE_B, 'b', 'B', "b" SPACING "B") //!< normal: b shifted: B - PORT_KEY(A2_KEY_Z, KEYCODE_Z, 'z', 'Z', "z" SPACING "Z") //!< normal: z shifted: Z - PORT_KEY(A2_KEY_LSHIFT, KEYCODE_LSHIFT, UCHAR_SHIFT_1, 0, "LSHIFT" ) //!< LSHIFT - PORT_KEY(A2_KEY_PERIOD, KEYCODE_STOP, '.', '>', "." SPACING ">") //!< normal: . shifted: > - PORT_KEY(A2_KEY_SEMICOLON, KEYCODE_COLON, ';', ':', ";" SPACING ":") //!< normal: ; shifted: : - PORT_KEY(A2_KEY_RETURN, KEYCODE_ENTER, 13, 0, "RETURN" ) //!< RETURN - PORT_KEY(A2_KEY_LEFTARROW, KEYCODE_LEFT, 0, 0, "???" SPACING "???") //!< normal: left arrow shifted: up arrow (caret) - PORT_KEY(A2_KEY_DEL, KEYCODE_DEL, UCHAR_MAMEKEY(DEL), 0, "DEL" ) //!< normal: DEL shifted: ? - PORT_KEY(A2_KEY_MSW_2_17, KEYCODE_MENU, 0, 0, "MSW2/17" ) //!< unused on Microswitch KDB - - PORT_START("ROW3") - PORT_KEY(A2_KEY_R, KEYCODE_R, 'r', 'R', "r" SPACING "R") //!< normal: r shifted: R - PORT_KEY(A2_KEY_T, KEYCODE_T, 't', 'T', "t" SPACING "T") //!< normal: t shifted: T - PORT_KEY(A2_KEY_G, KEYCODE_G, 'g', 'G', "g" SPACING "G") //!< normal: g shifted: G - PORT_KEY(A2_KEY_Y, KEYCODE_Y, 'y', 'Y', "y" SPACING "Y") //!< normal: y shifted: Y - PORT_KEY(A2_KEY_H, KEYCODE_H, 'h', 'H', "h" SPACING "H") //!< normal: h shifted: H - PORT_KEY(A2_KEY_8, KEYCODE_8, '8', '*', "8" SPACING "*") //!< normal: 8 shifted: * - PORT_KEY(A2_KEY_N, KEYCODE_N, 'n', 'N', "n" SPACING "N") //!< normal: n shifted: N - PORT_KEY(A2_KEY_M, KEYCODE_M, 'm', 'M', "m" SPACING "M") //!< normal: m shifted: M - PORT_KEY(A2_KEY_LOCK, KEYCODE_SCRLOCK, 0, 0, "LOCK" ) //!< LOCK - PORT_KEY(A2_KEY_SPACE, KEYCODE_SPACE, 32, 0, "SPACE" ) //!< SPACE - PORT_KEY(A2_KEY_LBRACKET, KEYCODE_OPENBRACE, '[', '{', "[" SPACING "{") //!< normal: [ shifted: { - PORT_KEY(A2_KEY_EQUALS, KEYCODE_EQUALS, '=', '+', "=" SPACING "+") //!< normal: = shifted: + - PORT_KEY(A2_KEY_RSHIFT, KEYCODE_RSHIFT, UCHAR_SHIFT_2, 0, "RSHIFT" ) //!< RSHIFT - PORT_KEY(A2_KEY_BLANK_BOT, KEYCODE_PGDN, 0, 0, "BOT" ) //!< bottom blank key - PORT_KEY(A2_KEY_MSW_3_16, KEYCODE_HOME, 0, 0, "MSW3/16" ) //!< unused on Microswitch KDB - PORT_KEY(A2_KEY_MSW_3_17, KEYCODE_INSERT, 0, 0, "MSW3/17" ) //!< unused on Microswitch KDB - - PORT_START("ROW4") - PORT_KEY(A2_KEY_FR2, KEYCODE_F6, 0, 0, "FR2" ) //!< ADL right function key 2 - PORT_KEY(A2_KEY_FL2, KEYCODE_F2, 0, 0, "FL2" ) //!< ADL left function key 2 - - PORT_START("ROW5") - PORT_KEY(A2_KEY_FR4, KEYCODE_F8, 0, 0, "FR4" ) //!< ADL right funtion key 4 - PORT_KEY(A2_KEY_BW, KEYCODE_F10, 0, 0, "BW" ) //!< ADL BW (?) - - PORT_START("ROW6") - PORT_KEY(A2_KEY_FR3, KEYCODE_F7, 0, 0, "FR3" ) //!< ADL right function key 3 - PORT_KEY(A2_KEY_FL1, KEYCODE_F1, 0, 0, "FL1" ) //!< ADL left function key 1 - PORT_KEY(A2_KEY_FL3, KEYCODE_F3, 0, 0, "FL3" ) //!< ADL left function key 3 - - PORT_START("ROW7") - PORT_KEY(A2_KEY_FR1, KEYCODE_F5, 0, 0, "FR1" ) //!< ADL right function key 1 - PORT_KEY(A2_KEY_FL4, KEYCODE_F4, 0, 0, "FL4" ) //!< ADL left function key 4 - PORT_KEY(A2_KEY_FR5, KEYCODE_F9, 0, 0, "FR5" ) //!< ADL right function key 5 - - PORT_START("mouseb0") // Mouse button 0 - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Mouse RED (left)") PORT_PLAYER(1) PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_button_0, 0 ) - PORT_START("mouseb1") // Mouse button 1 - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Mouse BLUE (right)") PORT_PLAYER(1) PORT_CODE(MOUSECODE_BUTTON2) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_button_1, 0 ) - PORT_START("mouseb2") // Mouse button 2 - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Mouse YELLOW (middle)") PORT_PLAYER(1) PORT_CODE(MOUSECODE_BUTTON3) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_button_2, 0 ) - - PORT_START("mousex") // Mouse - X AXIS - PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_motion_x, 0 ) - - PORT_START("mousey") // Mouse - Y AXIS - PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_motion_y, 0 ) - - PORT_START("CONFIG") /* Memory switch on AIM board */ - PORT_CONFNAME( 0x01, 0x01, "Memory switch") - PORT_CONFSETTING( 0x00, "on") - PORT_CONFSETTING( 0x01, "off") - PORT_CONFNAME( 0x70, 0x00, "Ethernet breath-of-life") - PORT_CONFSETTING( 0x00, "off") - PORT_CONFSETTING( 0x10, "5 seconds") - PORT_CONFSETTING( 0x20, "10 seconds") - PORT_CONFSETTING( 0x30, "15 seconds") - PORT_CONFSETTING( 0x40, "30 seconds") - PORT_CONFSETTING( 0x50, "60 seconds") - PORT_CONFSETTING( 0x60, "90 seconds") - PORT_CONFSETTING( 0x70, "120 seconds") - - PORT_START("ETHERID") - PORT_DIPNAME( 0377, 0042, "Ethernet ID") - PORT_DIPSETTING( 0000, "No ether") PORT_DIPSETTING( 0001, "ID 001") PORT_DIPSETTING( 0002, "ID 002") PORT_DIPSETTING( 0003, "ID 003") - PORT_DIPSETTING( 0004, "ID 004") PORT_DIPSETTING( 0005, "ID 005") PORT_DIPSETTING( 0006, "ID 006") PORT_DIPSETTING( 0007, "ID 007") - PORT_DIPSETTING( 0010, "ID 010") PORT_DIPSETTING( 0011, "ID 011") PORT_DIPSETTING( 0012, "ID 012") PORT_DIPSETTING( 0013, "ID 013") - PORT_DIPSETTING( 0014, "ID 014") PORT_DIPSETTING( 0015, "ID 015") PORT_DIPSETTING( 0016, "ID 016") PORT_DIPSETTING( 0017, "ID 017") - PORT_DIPSETTING( 0020, "ID 020") PORT_DIPSETTING( 0021, "ID 021") PORT_DIPSETTING( 0022, "ID 022") PORT_DIPSETTING( 0023, "ID 023") - PORT_DIPSETTING( 0024, "ID 024") PORT_DIPSETTING( 0025, "ID 025") PORT_DIPSETTING( 0026, "ID 026") PORT_DIPSETTING( 0027, "ID 027") - PORT_DIPSETTING( 0030, "ID 030") PORT_DIPSETTING( 0031, "ID 031") PORT_DIPSETTING( 0032, "ID 032") PORT_DIPSETTING( 0033, "ID 033") - PORT_DIPSETTING( 0034, "ID 034") PORT_DIPSETTING( 0035, "ID 035") PORT_DIPSETTING( 0036, "ID 036") PORT_DIPSETTING( 0037, "ID 037") - PORT_DIPSETTING( 0040, "ID 040") PORT_DIPSETTING( 0041, "ID 041") PORT_DIPSETTING( 0042, "ID 042") PORT_DIPSETTING( 0043, "ID 043") - PORT_DIPSETTING( 0044, "ID 044") PORT_DIPSETTING( 0045, "ID 045") PORT_DIPSETTING( 0046, "ID 046") PORT_DIPSETTING( 0047, "ID 047") - PORT_DIPSETTING( 0050, "ID 050") PORT_DIPSETTING( 0051, "ID 051") PORT_DIPSETTING( 0052, "ID 052") PORT_DIPSETTING( 0053, "ID 053") - PORT_DIPSETTING( 0054, "ID 054") PORT_DIPSETTING( 0055, "ID 055") PORT_DIPSETTING( 0056, "ID 056") PORT_DIPSETTING( 0057, "ID 057") - PORT_DIPSETTING( 0060, "ID 060") PORT_DIPSETTING( 0061, "ID 061") PORT_DIPSETTING( 0062, "ID 062") PORT_DIPSETTING( 0063, "ID 063") - PORT_DIPSETTING( 0064, "ID 064") PORT_DIPSETTING( 0065, "ID 065") PORT_DIPSETTING( 0066, "ID 066") PORT_DIPSETTING( 0067, "ID 067") - PORT_DIPSETTING( 0070, "ID 070") PORT_DIPSETTING( 0071, "ID 071") PORT_DIPSETTING( 0072, "ID 072") PORT_DIPSETTING( 0073, "ID 073") - PORT_DIPSETTING( 0074, "ID 074") PORT_DIPSETTING( 0075, "ID 075") PORT_DIPSETTING( 0076, "ID 076") PORT_DIPSETTING( 0077, "ID 077") - PORT_DIPSETTING( 0100, "ID 100") PORT_DIPSETTING( 0101, "ID 101") PORT_DIPSETTING( 0102, "ID 102") PORT_DIPSETTING( 0103, "ID 103") - PORT_DIPSETTING( 0104, "ID 104") PORT_DIPSETTING( 0105, "ID 105") PORT_DIPSETTING( 0106, "ID 106") PORT_DIPSETTING( 0107, "ID 107") - PORT_DIPSETTING( 0110, "ID 110") PORT_DIPSETTING( 0111, "ID 111") PORT_DIPSETTING( 0112, "ID 112") PORT_DIPSETTING( 0113, "ID 113") - PORT_DIPSETTING( 0114, "ID 114") PORT_DIPSETTING( 0115, "ID 115") PORT_DIPSETTING( 0116, "ID 116") PORT_DIPSETTING( 0117, "ID 117") - PORT_DIPSETTING( 0120, "ID 120") PORT_DIPSETTING( 0121, "ID 121") PORT_DIPSETTING( 0122, "ID 122") PORT_DIPSETTING( 0123, "ID 123") - PORT_DIPSETTING( 0124, "ID 124") PORT_DIPSETTING( 0125, "ID 125") PORT_DIPSETTING( 0126, "ID 126") PORT_DIPSETTING( 0127, "ID 127") - PORT_DIPSETTING( 0130, "ID 130") PORT_DIPSETTING( 0131, "ID 131") PORT_DIPSETTING( 0132, "ID 132") PORT_DIPSETTING( 0133, "ID 133") - PORT_DIPSETTING( 0134, "ID 134") PORT_DIPSETTING( 0135, "ID 135") PORT_DIPSETTING( 0136, "ID 136") PORT_DIPSETTING( 0137, "ID 137") - PORT_DIPSETTING( 0140, "ID 140") PORT_DIPSETTING( 0141, "ID 141") PORT_DIPSETTING( 0142, "ID 142") PORT_DIPSETTING( 0143, "ID 143") - PORT_DIPSETTING( 0144, "ID 144") PORT_DIPSETTING( 0145, "ID 145") PORT_DIPSETTING( 0146, "ID 146") PORT_DIPSETTING( 0147, "ID 147") - PORT_DIPSETTING( 0150, "ID 150") PORT_DIPSETTING( 0151, "ID 151") PORT_DIPSETTING( 0152, "ID 152") PORT_DIPSETTING( 0153, "ID 153") - PORT_DIPSETTING( 0154, "ID 154") PORT_DIPSETTING( 0155, "ID 155") PORT_DIPSETTING( 0156, "ID 156") PORT_DIPSETTING( 0157, "ID 157") - PORT_DIPSETTING( 0160, "ID 160") PORT_DIPSETTING( 0161, "ID 161") PORT_DIPSETTING( 0162, "ID 162") PORT_DIPSETTING( 0163, "ID 163") - PORT_DIPSETTING( 0164, "ID 164") PORT_DIPSETTING( 0165, "ID 165") PORT_DIPSETTING( 0166, "ID 166") PORT_DIPSETTING( 0167, "ID 167") - PORT_DIPSETTING( 0170, "ID 170") PORT_DIPSETTING( 0171, "ID 171") PORT_DIPSETTING( 0172, "ID 172") PORT_DIPSETTING( 0173, "ID 173") - PORT_DIPSETTING( 0174, "ID 174") PORT_DIPSETTING( 0175, "ID 175") PORT_DIPSETTING( 0176, "ID 176") PORT_DIPSETTING( 0177, "ID 177") - PORT_DIPSETTING( 0200, "ID 200") PORT_DIPSETTING( 0201, "ID 201") PORT_DIPSETTING( 0202, "ID 202") PORT_DIPSETTING( 0203, "ID 203") - PORT_DIPSETTING( 0204, "ID 204") PORT_DIPSETTING( 0205, "ID 205") PORT_DIPSETTING( 0206, "ID 206") PORT_DIPSETTING( 0207, "ID 207") - PORT_DIPSETTING( 0210, "ID 210") PORT_DIPSETTING( 0211, "ID 211") PORT_DIPSETTING( 0212, "ID 212") PORT_DIPSETTING( 0213, "ID 213") - PORT_DIPSETTING( 0214, "ID 214") PORT_DIPSETTING( 0215, "ID 215") PORT_DIPSETTING( 0216, "ID 216") PORT_DIPSETTING( 0217, "ID 217") - PORT_DIPSETTING( 0220, "ID 220") PORT_DIPSETTING( 0221, "ID 221") PORT_DIPSETTING( 0222, "ID 222") PORT_DIPSETTING( 0223, "ID 223") - PORT_DIPSETTING( 0224, "ID 224") PORT_DIPSETTING( 0225, "ID 225") PORT_DIPSETTING( 0226, "ID 226") PORT_DIPSETTING( 0227, "ID 227") - PORT_DIPSETTING( 0230, "ID 230") PORT_DIPSETTING( 0231, "ID 231") PORT_DIPSETTING( 0232, "ID 232") PORT_DIPSETTING( 0233, "ID 233") - PORT_DIPSETTING( 0234, "ID 234") PORT_DIPSETTING( 0235, "ID 235") PORT_DIPSETTING( 0236, "ID 236") PORT_DIPSETTING( 0237, "ID 237") - PORT_DIPSETTING( 0240, "ID 240") PORT_DIPSETTING( 0241, "ID 241") PORT_DIPSETTING( 0242, "ID 242") PORT_DIPSETTING( 0243, "ID 243") - PORT_DIPSETTING( 0244, "ID 244") PORT_DIPSETTING( 0245, "ID 245") PORT_DIPSETTING( 0246, "ID 246") PORT_DIPSETTING( 0247, "ID 247") - PORT_DIPSETTING( 0250, "ID 250") PORT_DIPSETTING( 0251, "ID 251") PORT_DIPSETTING( 0252, "ID 252") PORT_DIPSETTING( 0253, "ID 253") - PORT_DIPSETTING( 0254, "ID 254") PORT_DIPSETTING( 0255, "ID 255") PORT_DIPSETTING( 0256, "ID 256") PORT_DIPSETTING( 0257, "ID 257") - PORT_DIPSETTING( 0260, "ID 260") PORT_DIPSETTING( 0261, "ID 261") PORT_DIPSETTING( 0262, "ID 262") PORT_DIPSETTING( 0263, "ID 263") - PORT_DIPSETTING( 0264, "ID 264") PORT_DIPSETTING( 0265, "ID 265") PORT_DIPSETTING( 0266, "ID 266") PORT_DIPSETTING( 0267, "ID 267") - PORT_DIPSETTING( 0270, "ID 270") PORT_DIPSETTING( 0271, "ID 271") PORT_DIPSETTING( 0272, "ID 272") PORT_DIPSETTING( 0273, "ID 273") - PORT_DIPSETTING( 0274, "ID 274") PORT_DIPSETTING( 0275, "ID 275") PORT_DIPSETTING( 0276, "ID 276") PORT_DIPSETTING( 0277, "ID 277") - PORT_DIPSETTING( 0300, "ID 300") PORT_DIPSETTING( 0301, "ID 301") PORT_DIPSETTING( 0302, "ID 302") PORT_DIPSETTING( 0303, "ID 303") - PORT_DIPSETTING( 0304, "ID 304") PORT_DIPSETTING( 0305, "ID 305") PORT_DIPSETTING( 0306, "ID 306") PORT_DIPSETTING( 0307, "ID 307") - PORT_DIPSETTING( 0310, "ID 310") PORT_DIPSETTING( 0311, "ID 311") PORT_DIPSETTING( 0312, "ID 312") PORT_DIPSETTING( 0313, "ID 313") - PORT_DIPSETTING( 0314, "ID 314") PORT_DIPSETTING( 0315, "ID 315") PORT_DIPSETTING( 0316, "ID 316") PORT_DIPSETTING( 0317, "ID 317") - PORT_DIPSETTING( 0320, "ID 320") PORT_DIPSETTING( 0321, "ID 321") PORT_DIPSETTING( 0322, "ID 322") PORT_DIPSETTING( 0323, "ID 323") - PORT_DIPSETTING( 0324, "ID 324") PORT_DIPSETTING( 0325, "ID 325") PORT_DIPSETTING( 0326, "ID 326") PORT_DIPSETTING( 0327, "ID 327") - PORT_DIPSETTING( 0330, "ID 330") PORT_DIPSETTING( 0331, "ID 331") PORT_DIPSETTING( 0332, "ID 332") PORT_DIPSETTING( 0333, "ID 333") - PORT_DIPSETTING( 0334, "ID 334") PORT_DIPSETTING( 0335, "ID 335") PORT_DIPSETTING( 0336, "ID 336") PORT_DIPSETTING( 0337, "ID 337") - PORT_DIPSETTING( 0340, "ID 340") PORT_DIPSETTING( 0341, "ID 341") PORT_DIPSETTING( 0342, "ID 342") PORT_DIPSETTING( 0343, "ID 343") - PORT_DIPSETTING( 0344, "ID 344") PORT_DIPSETTING( 0345, "ID 345") PORT_DIPSETTING( 0346, "ID 346") PORT_DIPSETTING( 0347, "ID 347") - PORT_DIPSETTING( 0350, "ID 350") PORT_DIPSETTING( 0351, "ID 351") PORT_DIPSETTING( 0352, "ID 352") PORT_DIPSETTING( 0353, "ID 353") - PORT_DIPSETTING( 0354, "ID 354") PORT_DIPSETTING( 0355, "ID 355") PORT_DIPSETTING( 0356, "ID 356") PORT_DIPSETTING( 0357, "ID 357") - PORT_DIPSETTING( 0360, "ID 360") PORT_DIPSETTING( 0361, "ID 361") PORT_DIPSETTING( 0362, "ID 362") PORT_DIPSETTING( 0363, "ID 363") - PORT_DIPSETTING( 0364, "ID 364") PORT_DIPSETTING( 0365, "ID 365") PORT_DIPSETTING( 0366, "ID 366") PORT_DIPSETTING( 0367, "ID 367") - PORT_DIPSETTING( 0370, "ID 370") PORT_DIPSETTING( 0371, "ID 371") PORT_DIPSETTING( 0372, "ID 372") PORT_DIPSETTING( 0373, "ID 373") - PORT_DIPSETTING( 0374, "ID 374") PORT_DIPSETTING( 0375, "ID 375") -INPUT_PORTS_END - -/* ROM */ -ROM_START( alto2 ) - // dummy region for the maincpu - this is not used in any way - ROM_REGION( 0400, "maincpu", 0 ) - ROM_FILL(0, 0400, ALTO2_UCODE_INVERTED) -ROM_END - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -ADDRESS_MAP_START( alto2_ucode_map, AS_0, 32, alto2_state ) - AM_RANGE(0, ALTO2_UCODE_SIZE-1) AM_DEVICE32( "maincpu", alto2_cpu_device, ucode_map, 0xffffffffUL ) -ADDRESS_MAP_END - -ADDRESS_MAP_START( alto2_const_map, AS_1, 16, alto2_state ) - AM_RANGE(0, ALTO2_CONST_SIZE-1) AM_DEVICE16( "maincpu", alto2_cpu_device, const_map, 0xffffU ) -ADDRESS_MAP_END - -ADDRESS_MAP_START( alto2_iomem_map, AS_2, 16, alto2_state ) - AM_RANGE(0, 2*ALTO2_RAM_SIZE-1) AM_DEVICE16( "maincpu", alto2_cpu_device, iomem_map, 0xffffU ) -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( alto2, alto2_state ) - /* basic machine hardware */ - // SYSCLK is Display Control part A51 (tagged 29.4MHz) divided by 5(?) - // 5.8MHz according to de.wikipedia.org/wiki/Xerox_Alto - MCFG_CPU_ADD("maincpu", ALTO2, XTAL_29_4912MHz/5) - MCFG_CPU_PROGRAM_MAP(alto2_ucode_map) - MCFG_CPU_DATA_MAP(alto2_const_map) - MCFG_CPU_IO_MAP(alto2_iomem_map) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_20_16MHz, - ALTO2_DISPLAY_TOTAL_WIDTH, 0, ALTO2_DISPLAY_WIDTH, - ALTO2_DISPLAY_TOTAL_HEIGHT, 0, ALTO2_DISPLAY_HEIGHT + ALTO2_FAKE_STATUS_H) - MCFG_SCREEN_REFRESH_RATE(60) // two interlaced fields - MCFG_SCREEN_VBLANK_TIME(ALTO2_DISPLAY_VBLANK_TIME) - MCFG_SCREEN_UPDATE_DEVICE("maincpu", alto2_cpu_device, screen_update) - MCFG_SCREEN_VBLANK_DEVICE("maincpu", alto2_cpu_device, screen_eof) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT( layout_vertical ) - - MCFG_PALETTE_ADD_WHITE_AND_BLACK("palette") - - MCFG_DIABLO_DRIVES_ADD() -MACHINE_CONFIG_END - -/* Driver Init */ - -DRIVER_INIT_MEMBER( alto2_state, alto2 ) -{ - // make the diablo drives known to the CPU core - alto2_cpu_device* cpu = downcast(m_maincpu.target()); - cpu->set_diablo(0, downcast(machine().device(DIABLO_HD_0))); - cpu->set_diablo(1, downcast(machine().device(DIABLO_HD_1))); -} - -/* Game Drivers */ - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1977, alto2, 0, 0, alto2, alto2, alto2_state, alto2, "Xerox", "Alto-II", MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/altos5.c b/src/mess/drivers/altos5.c deleted file mode 100644 index 24136a110d7..00000000000 --- a/src/mess/drivers/altos5.c +++ /dev/null @@ -1,457 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Altos 5-15 - - Boots, terminal works, memory banking works. - - Error when reading floppy disk (bdos error) - - ToDo: - - Get floppy to read the disk (only ones found are .TD0 format) - - Further work once the floppy is fixed - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "machine/z80dma.h" -#include "machine/wd_fdc.h" - - -class altos5_state : public driver_device -{ -public: - altos5_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pio0(*this, "z80pio_0"), - m_pio1(*this, "z80pio_1"), - m_dart(*this, "z80dart"), - m_sio (*this, "z80sio"), - m_dma (*this, "z80dma"), - m_ctc (*this, "z80ctc"), - m_fdc (*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1") - { } - - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - DECLARE_READ8_MEMBER(port08_r); - DECLARE_READ8_MEMBER(port09_r); - DECLARE_WRITE8_MEMBER(port08_w); - DECLARE_WRITE8_MEMBER(port09_w); - DECLARE_WRITE8_MEMBER(port14_w); - DECLARE_DRIVER_INIT(altos5); - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); - DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); - DECLARE_WRITE_LINE_MEMBER(busreq_w); - DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); -private: - UINT8 m_port08; - UINT8 m_port09; - UINT8 *m_p_prom; - bool m_ipl; - offs_t m_curr_bank; - floppy_image_device *m_floppy; - UINT8 convert(offs_t offset, bool state); - void setup_banks(UINT8 source); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_pio0; - required_device m_pio1; - required_device m_dart; - required_device m_sio; - required_device m_dma; - required_device m_ctc; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; -}; - -static ADDRESS_MAP_START(altos5_mem, AS_PROGRAM, 8, altos5_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE( 0x1000, 0x1fff ) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") - AM_RANGE( 0x2000, 0x2fff ) AM_READ_BANK("bankr2") AM_WRITE_BANK("bankw2") - AM_RANGE( 0x3000, 0x3fff ) AM_READ_BANK("bankr3") AM_WRITE_BANK("bankw3") - AM_RANGE( 0x4000, 0x4fff ) AM_READ_BANK("bankr4") AM_WRITE_BANK("bankw4") - AM_RANGE( 0x5000, 0x5fff ) AM_READ_BANK("bankr5") AM_WRITE_BANK("bankw5") - AM_RANGE( 0x6000, 0x6fff ) AM_READ_BANK("bankr6") AM_WRITE_BANK("bankw6") - AM_RANGE( 0x7000, 0x7fff ) AM_READ_BANK("bankr7") AM_WRITE_BANK("bankw7") - AM_RANGE( 0x8000, 0x8fff ) AM_READ_BANK("bankr8") AM_WRITE_BANK("bankw8") - AM_RANGE( 0x9000, 0x9fff ) AM_READ_BANK("bankr9") AM_WRITE_BANK("bankw9") - AM_RANGE( 0xa000, 0xafff ) AM_READ_BANK("bankra") AM_WRITE_BANK("bankwa") - AM_RANGE( 0xb000, 0xbfff ) AM_READ_BANK("bankrb") AM_WRITE_BANK("bankwb") - AM_RANGE( 0xc000, 0xcfff ) AM_READ_BANK("bankrc") AM_WRITE_BANK("bankwc") - AM_RANGE( 0xd000, 0xdfff ) AM_READ_BANK("bankrd") AM_WRITE_BANK("bankwd") - AM_RANGE( 0xe000, 0xefff ) AM_READ_BANK("bankre") AM_WRITE_BANK("bankwe") - AM_RANGE( 0xf000, 0xffff ) AM_READ_BANK("bankrf") AM_WRITE_BANK("bankwf") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(altos5_io, AS_IO, 8, altos5_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80dma", z80dma_device, read, write) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("fdc", fd1797_t, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_0", z80pio_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("z80pio_1", z80pio_device, read, write) - AM_RANGE(0x14, 0x17) AM_WRITE(port14_w) - AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80dart", z80dart_device, ba_cd_r, ba_cd_w) - //AM_RANGE(0x20, 0x23) // Hard drive - AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80sio", z80sio0_device, ba_cd_r, ba_cd_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( altos5 ) -INPUT_PORTS_END - -UINT8 altos5_state::convert(offs_t offset, bool state) -{ - UINT8 data = m_p_prom[offset]; - - // if IPL and /A12, point at rom - if (!state && m_ipl && !BIT(offset, 0)) - data = 0x31; - else - // if WPRT point at nothing - if (state && BIT(data, 7)) - data = 0x30; - - // mask off wprt (no longer needed) - // normalise bank number (4x becomes 0x; 2x and 1x are already ok) - return data & 0x3f; -} - -void altos5_state::setup_banks(UINT8 source) -{ - offs_t offs,temp; - // WPRT | template | dma bank / cpu bank - - if (source == 1) // use DMA banks only if BUSACK is asserted - offs = ((~m_port09 & 0x20) << 3) | ((m_port09 & 0x06) << 5) | ((m_port09 & 0xc0) >> 2); - else - offs = ((~m_port09 & 0x20) << 3) | ((m_port09 & 0x06) << 5) | ((m_port09 & 0x18) << 1); - - temp = offs; - if ((source == 2) || (temp != m_curr_bank)) - { - membank("bankr0")->set_entry(convert(offs++, 0)); - membank("bankr1")->set_entry(convert(offs++, 0)); - membank("bankr2")->set_entry(convert(offs++, 0)); - membank("bankr3")->set_entry(convert(offs++, 0)); - membank("bankr4")->set_entry(convert(offs++, 0)); - membank("bankr5")->set_entry(convert(offs++, 0)); - membank("bankr6")->set_entry(convert(offs++, 0)); - membank("bankr7")->set_entry(convert(offs++, 0)); - membank("bankr8")->set_entry(convert(offs++, 0)); - membank("bankr9")->set_entry(convert(offs++, 0)); - membank("bankra")->set_entry(convert(offs++, 0)); - membank("bankrb")->set_entry(convert(offs++, 0)); - membank("bankrc")->set_entry(convert(offs++, 0)); - membank("bankrd")->set_entry(convert(offs++, 0)); - membank("bankre")->set_entry(convert(offs++, 0)); - membank("bankrf")->set_entry(convert(offs++, 0)); - - offs = temp; - membank("bankw0")->set_entry(convert(offs++, 1)); - membank("bankw1")->set_entry(convert(offs++, 1)); - membank("bankw2")->set_entry(convert(offs++, 1)); - membank("bankw3")->set_entry(convert(offs++, 1)); - membank("bankw4")->set_entry(convert(offs++, 1)); - membank("bankw5")->set_entry(convert(offs++, 1)); - membank("bankw6")->set_entry(convert(offs++, 1)); - membank("bankw7")->set_entry(convert(offs++, 1)); - membank("bankw8")->set_entry(convert(offs++, 1)); - membank("bankw9")->set_entry(convert(offs++, 1)); - membank("bankwa")->set_entry(convert(offs++, 1)); - membank("bankwb")->set_entry(convert(offs++, 1)); - membank("bankwc")->set_entry(convert(offs++, 1)); - membank("bankwd")->set_entry(convert(offs++, 1)); - membank("bankwe")->set_entry(convert(offs++, 1)); - membank("bankwf")->set_entry(convert(offs++, 1)); - } - - m_curr_bank = temp; -} - -void altos5_state::machine_reset() -{ - m_curr_bank = 0; - m_port08 = 0; - m_port09 = 0; - m_ipl = 1; - setup_banks(2); - m_maincpu->reset(); -} - -static const z80_daisy_config daisy_chain_intf[] = -{ - { "z80dma" }, - { "z80pio_0" }, - { "z80pio_1" }, - { "z80ctc" }, - { "z80dart" }, - { "z80sio" }, - { NULL } -}; - - -// turns off IPL mode, removes boot rom from memory map -WRITE8_MEMBER( altos5_state::port14_w ) -{ - m_ipl = 0; - setup_banks(2); -} - -READ8_MEMBER(altos5_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(altos5_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - prog_space.write_byte(offset, data); -} - -READ8_MEMBER(altos5_state::io_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(altos5_state::io_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - prog_space.write_byte(offset, data); -} - -WRITE_LINE_MEMBER( altos5_state::busreq_w ) -{ -// since our Z80 has no support for BUSACK, we assume it is granted immediately - m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); - m_maincpu->set_input_line(INPUT_LINE_HALT, state); // do we need this? - m_dma->bai_w(state); // tell dma that bus has been granted - setup_banks(state); // adjust banking for dma or cpu -} - -// baud rate generator and RTC. All inputs are 2MHz. -TIMER_DEVICE_CALLBACK_MEMBER(altos5_state::ctc_tick) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); - m_ctc->trg1(1); - m_ctc->trg1(0); - m_ctc->trg2(1); - m_ctc->trg2(0); - m_ctc->trg3(1); - m_ctc->trg3(0); -} - -WRITE_LINE_MEMBER( altos5_state::ctc_z1_w ) -{ - m_dart->rxca_w(state); - m_dart->txca_w(state); - m_sio->rxca_w(state); - m_sio->txca_w(state); -} - -/* -d0: L = a HD is present -d1: L = a 2nd hard drive is present -d2: unused configuration input (must be H to skip HD boot) -d3: selected floppy is single(L) or double sided(H) -d7: IRQ from FDC -*/ -READ8_MEMBER( altos5_state::port08_r ) -{ - UINT8 data = m_port08 | 0x87; - if (m_floppy) - data |= ((UINT8)m_floppy->twosid_r() << 3); // get number of sides - return data; -} - -/* -d0: HD IRQ -*/ -READ8_MEMBER( altos5_state::port09_r ) -{ - return m_port09 | 0x01; -} - -/* -d4: DDEN (H = double density) -d5: DS (H = drive 2) -d6: SS (H = side 2) -*/ -WRITE8_MEMBER( altos5_state::port08_w ) -{ - m_port08 = data & 0x70; - - m_floppy = NULL; - if (BIT(data, 5)) - m_floppy = m_floppy1->get_device(); - else - m_floppy = m_floppy0->get_device(); - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) - { - m_floppy->mon_w(0); - m_floppy->ss_w(BIT(data, 6)); - m_fdc->dden_w(!BIT(data, 4)); - } -} - -/* -d1, 2: Memory Map template selection (0 = diag; 1 = oasis; 2 = mp/m) -d3, 4: CPU bank select -d5: H = Write protect of common area -d6, 7: DMA bank select (not emulated) -*/ -WRITE8_MEMBER( altos5_state::port09_w ) -{ - m_port09 = data; - setup_banks(2); -} - -static SLOT_INTERFACE_START( altos5_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER( altos5_state::fdc_intrq_w ) -{ - UINT8 data = m_port08 | ((UINT8)(state) << 7); - m_pio0->port_a_write(data); -} - -DRIVER_INIT_MEMBER( altos5_state, altos5 ) -{ - m_p_prom = memregion("proms")->base(); - - UINT8 *RAM = memregion("maincpu")->base(); - - membank("bankr0")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr1")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr2")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr3")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr4")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr5")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr6")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr7")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr8")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankr9")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankra")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankrb")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankrc")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankrd")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankre")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankrf")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw0")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw1")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw2")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw3")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw4")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw5")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw6")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw7")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw8")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankw9")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankwa")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankwb")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankwc")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankwd")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankwe")->configure_entries(0, 50, &RAM[0], 0x1000); - membank("bankwf")->configure_entries(0, 50, &RAM[0], 0x1000); -} - -static MACHINE_CONFIG_START( altos5, altos5_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz / 2) - MCFG_CPU_PROGRAM_MAP(altos5_mem) - MCFG_CPU_IO_MAP(altos5_io) - MCFG_CPU_CONFIG(daisy_chain_intf) - - /* devices */ - MCFG_DEVICE_ADD("z80dma", Z80DMA, XTAL_8MHz / 2) - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(altos5_state, busreq_w)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - // BAO, not used - MCFG_Z80DMA_IN_MREQ_CB(READ8(altos5_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(altos5_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(altos5_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(altos5_state, io_write_byte)) - - MCFG_DEVICE_ADD("z80pio_0", Z80PIO, XTAL_8MHz / 2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(altos5_state, port08_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(altos5_state, port08_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(altos5_state, port09_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(altos5_state, port09_w)) - - MCFG_DEVICE_ADD("z80pio_1", Z80PIO, XTAL_8MHz / 2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_Z80DART_ADD("z80dart", XTAL_8MHz / 2, 0, 0, 0, 0 ) - // Channel A - console #3 - // Channel B - printer - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_Z80SIO0_ADD("z80sio", XTAL_8MHz / 2, 0, 0, 0, 0 ) - // Channel A - console #2 - // WRDY connects to (altos5_state, fdc_intrq_w) - // Channel B - console #1 - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_8MHz / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80sio", z80dart_device, rxtxcb_w)) // SIO Ch B - MCFG_Z80CTC_ZC1_CB(WRITELINE(altos5_state, ctc_z1_w)) // Z80DART Ch A, SIO Ch A - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w)) // Z80DART Ch B - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80sio", z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("z80sio", z80dart_device, dcdb_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("z80sio", z80dart_device, rib_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("z80sio", z80dart_device, ctsb_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", altos5_state, ctc_tick, attotime::from_hz(XTAL_8MHz / 4)) - MCFG_FD1797_ADD("fdc", XTAL_8MHz / 8) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(altos5_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("z80dma", z80dma_device, rdy_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", altos5_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", altos5_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "altos5") -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( altos5 ) // 00000-2FFFF = ram banks; 30000-30FFF wprt space; 31000-31FFF ROM - ROM_REGION( 0x32000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("2732.bin", 0x31000, 0x1000, CRC(15fdc7eb) SHA1(e15bdf5d5414ad56f8c4bb84edc6f967a5f01ba9)) // bios - - ROM_REGION( 0x200, "proms", 0 ) - ROM_LOAD("82s141.bin", 0x0000, 0x0200, CRC(35c8078c) SHA1(dce24374bfcc5d23959e2c03485d82a119c0c3c9)) // banking control -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP(1982, altos5, 0, 0, altos5, altos5, altos5_state, altos5, "Altos", "Altos 5-15", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/amico2k.c b/src/mess/drivers/amico2k.c deleted file mode 100644 index 4a1c9667c51..00000000000 --- a/src/mess/drivers/amico2k.c +++ /dev/null @@ -1,241 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Fabio Priuli, Curt Coder -/*************************************************************************** - - A.S.EL. Amico 2000 - - 07/2009 Skeleton driver. - - IC9 - Monitor PROM, handwritten from book listing by Davide - IC10 - Recorder PROM, yet to be found - IC6/IC7 - PROMs reconstructed by Luigi Serrantoni - - To Do: - * Basically everything, in particular implement PROM (described in details - at the link below) and i8255 - - http://www.computerhistory.it/index.php?option=com_content&task=view&id=85&Itemid=117 - - Pasting: - 0-F : as is - ^ (inc) : ^ - AD : - - DA : = - GO : X - - Test Paste: - =11^22^33^44^55^66^77^88^99^-0000 - Now press up-arrow to confirm the data has been entered. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/i8255.h" -#include "amico2k.lh" - - -class amico2k_state : public driver_device -{ -public: - amico2k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - void machine_start(); - - DECLARE_READ8_MEMBER( ppi_pa_r ); - DECLARE_WRITE8_MEMBER( ppi_pa_w ); - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_WRITE8_MEMBER( ppi_pb_w ); - - int m_ls145_p; - UINT8 m_segment; - - // timers - emu_timer *m_led_refresh_timer; - TIMER_CALLBACK_MEMBER(led_refresh); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START( amico2k_mem, AS_PROGRAM, 8, amico2k_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x03ff) AM_RAM -// AM_RANGE(0x0400, 0x07ff) AM_RAM // optional expansion RAM - AM_RANGE(0xfb00, 0xfcff) AM_ROM - AM_RANGE(0xfd00, 0xfd03) AM_DEVREADWRITE("i8255", i8255_device, read, write) - AM_RANGE(0xfe00, 0xffff) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( amico2k ) - PORT_START("Q0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Q1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Q2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_P) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -TIMER_CALLBACK_MEMBER(amico2k_state::led_refresh) -{ - if (m_ls145_p > 3) - { - output_set_digit_value(m_ls145_p - 4, m_segment); - } -} - -READ8_MEMBER( amico2k_state::ppi_pa_r ) -{ - /* - - bit description - - PA0 keyboard data 0 - PA1 keyboard data 1 - PA2 keyboard data 2 - PA3 keyboard data 3 - PA4 keyboard data 4 - PA5 keyboard data 5 - PA6 keyboard data 6 - PA7 reg out - - */ - - switch (m_ls145_p) - { - case 0: return ioport("Q0")->read(); - case 1: return ioport("Q1")->read(); - case 2: return ioport("Q2")->read(); - default: return 0xff; - } -} - -WRITE8_MEMBER( amico2k_state::ppi_pa_w ) -{ - /* - - bit description - - PA0 LED segment A - PA1 LED segment B - PA2 LED segment C - PA3 LED segment D - PA4 LED segment E - PA5 LED segment F - PA6 LED segment G - PA7 - - */ - - m_segment = data; - m_led_refresh_timer->adjust(attotime::from_usec(70)); -} - -READ8_MEMBER( amico2k_state::ppi_pb_r ) -{ - /* - - bit description - - PB0 reg out - PB1 - PB2 - PB3 - PB4 - PB5 - PB6 - PB7 - - */ - - return 0; -} - -WRITE8_MEMBER( amico2k_state::ppi_pb_w ) -{ - /* - - bit description - - PB0 - PB1 LS145 P0 - PB2 LS145 P1 - PB3 LS145 P2 - PB4 LS145 P3 - PB5 reg in - PB6 reg in - PB7 led output enable - - */ - - m_ls145_p = (data >> 1) & 0x0f; -} - -void amico2k_state::machine_start() -{ - m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amico2k_state::led_refresh),this)); - - // state saving - save_item(NAME(m_ls145_p)); - save_item(NAME(m_segment)); -} - -static MACHINE_CONFIG_START( amico2k, amico2k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 1000000) /* 1MHz */ - MCFG_CPU_PROGRAM_MAP(amico2k_mem) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_amico2k ) - - MCFG_DEVICE_ADD("i8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(amico2k_state, ppi_pa_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(amico2k_state, ppi_pa_w)) - MCFG_I8255_IN_PORTB_CB(READ8(amico2k_state, ppi_pb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(amico2k_state, ppi_pb_w)) -MACHINE_CONFIG_END - - -/* ROM definition */ -// not sure the ROMs are loaded correctly -ROM_START( amico2k ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "prom.ic10", 0xfb00, 0x200, NO_DUMP ) // cassette recorder ROM, not published anywhere. a board is needed! - ROM_LOAD( "prom.ic9", 0xfe00, 0x200, CRC(86449f7c) SHA1(fe7deca86e90ab89aae23f11e9dbaf343b4242dc) ) - - ROM_REGION( 0x200, "proms", ROMREGION_ERASEFF ) - ROM_LOAD( "prom.ic6", 0x000, 0x100, CRC(4005f760) SHA1(7edcd85feb5a576f6da1bbb723b3cf668cf3df45) ) - ROM_LOAD( "prom.ic7", 0x100, 0x100, CRC(8785d864) SHA1(d169c3b5f5690664083030948db9f33571b08656) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, amico2k, 0, 0, amico2k, amico2k, driver_device, 0, "A.S.E.L.", "Amico 2000", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/amiga.c b/src/mess/drivers/amiga.c deleted file mode 100644 index d464a27591e..00000000000 --- a/src/mess/drivers/amiga.c +++ /dev/null @@ -1,2144 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Commodore Amiga - -***************************************************************************/ - -#include "emu.h" -#include "includes/amiga.h" -#include "bus/amiga/zorro/zorro.h" -#include "cpu/m68000/m68000.h" -#include "cpu/m6502/m6502.h" -#include "machine/bankdev.h" -#include "machine/6525tpi.h" -#include "machine/mos6526.h" -#include "machine/gayle.h" -#include "machine/ataintf.h" -#include "machine/dmac.h" -#include "machine/nvram.h" -#include "machine/i2cmem.h" -#include "machine/amigafdc.h" -#include "machine/amigakbd.h" -#include "machine/cr511b.h" -#include "machine/rp5c01.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class a1000_state : public amiga_state -{ -public: - a1000_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_bootrom(*this, "bootrom"), - m_wom(*this, "wom") - { } - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - - DECLARE_WRITE16_MEMBER( write_protect_w ); - -protected: - virtual void machine_start(); - virtual void machine_reset(); - -private: - required_device m_bootrom; - required_memory_bank m_wom; - std::vector m_wom_ram; -}; - -class a2000_state : public amiga_state -{ -public: - a2000_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_rtc(*this, "u65"), - m_zorro(*this, ZORROBUS_TAG), - m_zorro2_int2(0), - m_zorro2_int6(0) - { } - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - - DECLARE_WRITE_LINE_MEMBER( zorro2_int2_w ); - DECLARE_WRITE_LINE_MEMBER( zorro2_int6_w ); - - DECLARE_READ16_MEMBER( clock_r ); - DECLARE_WRITE16_MEMBER( clock_w ); - -protected: - virtual void machine_reset(); - - // amiga_state overrides - virtual bool int2_pending(); - virtual bool int6_pending(); - -private: - // devices - required_device m_rtc; - required_device m_zorro; - - // internal state - int m_zorro2_int2; - int m_zorro2_int6; -}; - -class a500_state : public amiga_state -{ -public: - a500_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_side(*this, EXP_SLOT_TAG), - m_side_int2(0), - m_side_int6(0) - { } - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - -protected: - virtual void machine_reset(); - - // amiga_state overrides - virtual bool int2_pending(); - virtual bool int6_pending(); - -private: - // devices - required_device m_side; - - // internal state - int m_side_int2; - int m_side_int6; -}; - -class cdtv_state : public amiga_state -{ -public: - cdtv_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_rtc(*this, "u61"), - m_dmac(*this, "u36"), - m_tpi(*this, "u32"), - m_cdrom(*this, "cdrom"), - m_dmac_irq(0), - m_tpi_irq(0) - { } - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - - DECLARE_READ16_MEMBER( clock_r ); - DECLARE_WRITE16_MEMBER( clock_w ); - - DECLARE_READ8_MEMBER( dmac_scsi_data_read ); - DECLARE_WRITE8_MEMBER( dmac_scsi_data_write ); - DECLARE_READ8_MEMBER( dmac_io_read ); - DECLARE_WRITE8_MEMBER( dmac_io_write ); - DECLARE_WRITE_LINE_MEMBER( dmac_int_w ); - - DECLARE_WRITE8_MEMBER( tpi_port_b_write ); - DECLARE_WRITE_LINE_MEMBER( tpi_int_w ); - -protected: - // driver_device overrides - virtual void machine_start(); - - // amiga_state overrides - virtual bool int2_pending(); - virtual bool int6_pending(); - -private: - // devices - required_device m_rtc; - required_device m_dmac; - required_device m_tpi; - required_device m_cdrom; - - // internal state - int m_dmac_irq; - int m_tpi_irq; -}; - -class a3000_state : public amiga_state -{ -public: - a3000_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag) - { } - - DECLARE_READ32_MEMBER( scsi_r ); - DECLARE_WRITE32_MEMBER( scsi_w ); - DECLARE_READ32_MEMBER( motherboard_r ); - DECLARE_WRITE32_MEMBER( motherboard_w ); - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - -protected: - -private: -}; - -class a500p_state : public amiga_state -{ -public: - a500p_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_rtc(*this, "u9"), - m_side(*this, EXP_SLOT_TAG), - m_side_int2(0), - m_side_int6(0) - { } - - DECLARE_READ16_MEMBER( clock_r ); - DECLARE_WRITE16_MEMBER( clock_w ); - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - -protected: - virtual void machine_reset(); - - // amiga_state overrides - virtual bool int2_pending(); - virtual bool int6_pending(); - -private: - // devices - required_device m_rtc; - required_device m_side; - - // internal state - int m_side_int2; - int m_side_int6; -}; - -class a600_state : public amiga_state -{ -public: - a600_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_gayle_int2(0) - { } - - DECLARE_WRITE_LINE_MEMBER( gayle_int2_w ); - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - - static const UINT8 GAYLE_ID = 0xd0; - -protected: - virtual bool int2_pending(); - -private: - int m_gayle_int2; -}; - -class a1200_state : public amiga_state -{ -public: - a1200_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_gayle_int2(0) - { } - - DECLARE_WRITE_LINE_MEMBER( gayle_int2_w ); - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - - static const UINT8 GAYLE_ID = 0xd1; - -protected: - virtual bool int2_pending(); - -private: - int m_gayle_int2; -}; - -class a4000_state : public amiga_state -{ -public: - a4000_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_ata(*this, "ata"), - m_ramsey_config(0), - m_gary_coldboot(1), - m_gary_timeout(0), - m_gary_toenb(0), - m_ide_interrupt(0) - { } - - DECLARE_READ32_MEMBER( scsi_r ); - DECLARE_WRITE32_MEMBER( scsi_w ); - DECLARE_READ16_MEMBER( ide_r ); - DECLARE_WRITE16_MEMBER( ide_w ); - DECLARE_WRITE_LINE_MEMBER( ide_interrupt_w ); - DECLARE_READ32_MEMBER( motherboard_r ); - DECLARE_WRITE32_MEMBER( motherboard_w ); - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - -protected: - -private: - required_device m_ata; - - int m_ramsey_config; - int m_gary_coldboot; - int m_gary_timeout; - int m_gary_toenb; - int m_ide_interrupt; -}; - -class cd32_state : public amiga_state -{ -public: - cd32_state(const machine_config &mconfig, device_type type, const char *tag) : - amiga_state(mconfig, type, tag), - m_p1_port(*this, "p1_cd32_buttons"), - m_p2_port(*this, "p2_cd32_buttons"), - m_cdda(*this, "cdda") - { } - - DECLARE_WRITE8_MEMBER( akiko_cia_0_port_a_write ); - - DECLARE_CUSTOM_INPUT_MEMBER( cd32_input ); - DECLARE_CUSTOM_INPUT_MEMBER( cd32_sel_mirror_input ); - - DECLARE_DRIVER_INIT( pal ); - DECLARE_DRIVER_INIT( ntsc ); - - required_ioport m_p1_port; - required_ioport m_p2_port; - - int m_oldstate[2]; - int m_cd32_shifter[2]; - UINT16 m_potgo_value; - -protected: - // amiga_state overrides - virtual void potgo_w(UINT16 data); - -private: - required_device m_cdda; -}; - - -//************************************************************************** -// REAL TIME CLOCK -//************************************************************************** - -READ16_MEMBER( cdtv_state::clock_r ) -{ - return m_rtc->read(space, offset / 2); -} - -WRITE16_MEMBER( cdtv_state::clock_w ) -{ - m_rtc->write(space, offset / 2, data); -} - -READ16_MEMBER( a2000_state::clock_r ) -{ - return m_rtc->read(space, offset / 2); -} - -WRITE16_MEMBER( a2000_state::clock_w ) -{ - m_rtc->write(space, offset / 2, data); -} - -READ16_MEMBER( a500p_state::clock_r ) -{ - return m_rtc->read(space, offset / 2); -} - -WRITE16_MEMBER( a500p_state::clock_w ) -{ - m_rtc->write(space, offset / 2, data); -} - - -//************************************************************************** -// CD-ROM CONTROLLER -//************************************************************************** - -READ8_MEMBER( cdtv_state::dmac_scsi_data_read ) -{ - if (offset >= 0xb0 && offset <= 0xbf) - return m_tpi->read(space, offset); - - return 0xff; -} - -WRITE8_MEMBER( cdtv_state::dmac_scsi_data_write ) -{ - if (offset >= 0xb0 && offset <= 0xbf) - m_tpi->write(space, offset, data); -} - -READ8_MEMBER( cdtv_state::dmac_io_read ) -{ - return m_cdrom->read(space, 0); -} - -WRITE8_MEMBER( cdtv_state::dmac_io_write ) -{ - m_cdrom->write(space, 0, data); -} - -WRITE_LINE_MEMBER( cdtv_state::dmac_int_w ) -{ - m_dmac_irq = state; - update_int2(); -} - -WRITE8_MEMBER( cdtv_state::tpi_port_b_write ) -{ - m_cdrom->cmd_w(BIT(data, 0)); - m_cdrom->enable_w(BIT(data, 1)); -} - -WRITE_LINE_MEMBER( cdtv_state::tpi_int_w ) -{ - m_tpi_irq = state; - update_int2(); -} - - -//************************************************************************** -// DRIVER INIT -//************************************************************************** - -// ocs chipset (agnus with support for 512k or 1mb chip ram, denise) -DRIVER_INIT_MEMBER( a1000_state, pal ) -{ - m_agnus_id = AGNUS_PAL; // 8367 - m_denise_id = DENISE; // 8362 -} - -DRIVER_INIT_MEMBER( a1000_state, ntsc ) -{ - m_agnus_id = AGNUS_NTSC; // 8361 - m_denise_id = DENISE; // 8362 -} - -DRIVER_INIT_MEMBER( a2000_state, pal ) -{ - m_agnus_id = AGNUS_PAL; // 8371 (later versions 8372A) - m_denise_id = DENISE; // 8362 -} - -DRIVER_INIT_MEMBER( a2000_state, ntsc ) -{ - m_agnus_id = AGNUS_NTSC; // 8370 (later versions 8372A) - m_denise_id = DENISE; // 8362 -} - -DRIVER_INIT_MEMBER( a500_state, pal ) -{ - m_agnus_id = AGNUS_PAL; // 8371 (later versions 8372A) - m_denise_id = DENISE; // 8362 -} - -DRIVER_INIT_MEMBER( a500_state, ntsc ) -{ - m_agnus_id = AGNUS_NTSC; // 8370 (later versions 8372A) - m_denise_id = DENISE; // 8362 -} - -DRIVER_INIT_MEMBER( cdtv_state, pal ) -{ - m_agnus_id = AGNUS_HR_PAL; // 8372A - m_denise_id = DENISE; // 8362 -} - -DRIVER_INIT_MEMBER( cdtv_state, ntsc ) -{ - m_agnus_id = AGNUS_HR_NTSC; // 8372A - m_denise_id = DENISE; // 8362 -} - -// ecs chipset (agnus with support for 2mb chip ram, super denise) -DRIVER_INIT_MEMBER( a3000_state, pal ) -{ - m_agnus_id = AGNUS_HR_PAL_NEW; // 8372B (early versions: 8372AB) - m_denise_id = DENISE_HR; // 8373 -} - -DRIVER_INIT_MEMBER( a3000_state, ntsc ) -{ - m_agnus_id = AGNUS_HR_NTSC_NEW; // 8372B (early versions: 8372AB) - m_denise_id = DENISE_HR; // 8373 -} - -DRIVER_INIT_MEMBER( a500p_state, pal ) -{ - m_agnus_id = AGNUS_HR_PAL; // 8375 (390544-01) - m_denise_id = DENISE_HR; // 8373 -} - -DRIVER_INIT_MEMBER( a500p_state, ntsc ) -{ - m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02) - m_denise_id = DENISE_HR; // 8373 -} - -DRIVER_INIT_MEMBER( a600_state, pal ) -{ - m_agnus_id = AGNUS_HR_PAL; // 8375 (390544-01) - m_denise_id = DENISE_HR; // 8373 -} - -DRIVER_INIT_MEMBER( a600_state, ntsc ) -{ - m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02) - m_denise_id = DENISE_HR; // 8373 -} - -// aga chipset (alice and lisa) -DRIVER_INIT_MEMBER( a1200_state, pal ) -{ - m_agnus_id = ALICE_PAL_NEW; - m_denise_id = LISA; -} - -DRIVER_INIT_MEMBER( a1200_state, ntsc ) -{ - m_agnus_id = ALICE_NTSC_NEW; - m_denise_id = LISA; -} - -DRIVER_INIT_MEMBER( a4000_state, pal ) -{ - m_agnus_id = ALICE_PAL_NEW; - m_denise_id = LISA; -} - -DRIVER_INIT_MEMBER( a4000_state, ntsc ) -{ - m_agnus_id = ALICE_NTSC_NEW; - m_denise_id = LISA; -} - -DRIVER_INIT_MEMBER( cd32_state, pal ) -{ - m_agnus_id = ALICE_PAL_NEW; - m_denise_id = LISA; -} - -DRIVER_INIT_MEMBER( cd32_state, ntsc ) -{ - m_agnus_id = ALICE_NTSC_NEW; - m_denise_id = LISA; -} - - -//************************************************************************** -// MACHINE EMULATION -//************************************************************************** - -void a1000_state::machine_start() -{ - // start base machine - amiga_state::machine_start(); - - // allocate 256kb for wom - m_wom_ram.resize(256 * 1024 / 2); - m_wom->set_base(&m_wom_ram[0]); -} - -void a1000_state::machine_reset() -{ - // base reset - amiga_state::machine_reset(); - - // bootrom visible, wom writable - m_bootrom->set_bank(0); - m_maincpu->space(AS_PROGRAM).install_write_bank(0xfc0000, 0xffffff, "wom"); -} - -// any write to this area will write protect the wom and disable the bootrom -WRITE16_MEMBER( a1000_state::write_protect_w ) -{ - m_bootrom->set_bank(1); - m_maincpu->space(AS_PROGRAM).nop_write(0xfc0000, 0xffffff); -} - -void a2000_state::machine_reset() -{ - // base reset - amiga_state::machine_reset(); - - // reset zorro devices - m_zorro->reset(); -} - -WRITE_LINE_MEMBER( a2000_state::zorro2_int2_w ) -{ - m_zorro2_int2 = state; - update_int2(); -} - -WRITE_LINE_MEMBER( a2000_state::zorro2_int6_w ) -{ - m_zorro2_int6 = state; - update_int6(); -} - -bool a2000_state::int2_pending() -{ - return m_cia_0_irq || m_zorro2_int2; -} - -bool a2000_state::int6_pending() -{ - return m_cia_1_irq || m_zorro2_int6; -} - -void a500_state::machine_reset() -{ - // base reset - amiga_state::machine_reset(); - - // reset side expansion slot device - m_side->reset(); -} - -bool a500_state::int2_pending() -{ - return m_cia_0_irq || m_side_int2; -} - -bool a500_state::int6_pending() -{ - return m_cia_1_irq || m_side_int6; -} - -void cdtv_state::machine_start() -{ - // start base machine - amiga_state::machine_start(); - - // setup dmac - m_dmac->set_address_space(&m_maincpu->space(AS_PROGRAM)); - m_dmac->ramsz_w(0); -} - -bool cdtv_state::int2_pending() -{ - return m_cia_0_irq || m_dmac_irq || m_tpi_irq; -} - -bool cdtv_state::int6_pending() -{ - return m_cia_1_irq; -} - -READ32_MEMBER( a3000_state::scsi_r ) -{ - UINT32 data = 0xffffffff; - logerror("scsi_r(%06x): %08x & %08x\n", offset, data, mem_mask); - return data; -} - -WRITE32_MEMBER( a3000_state::scsi_w ) -{ - logerror("scsi_w(%06x): %08x & %08x\n", offset, data, mem_mask); -} - -READ32_MEMBER( a3000_state::motherboard_r ) -{ - UINT32 data = 0xffffffff; - logerror("motherboard_r(%06x): %08x & %08x\n", offset, data, mem_mask); - return data; -} - -WRITE32_MEMBER( a3000_state::motherboard_w ) -{ - logerror("motherboard_w(%06x): %08x & %08x\n", offset, data, mem_mask); -} - -void a500p_state::machine_reset() -{ - // base reset - amiga_state::machine_reset(); - - // reset side expansion slot device - m_side->reset(); -} - -bool a500p_state::int2_pending() -{ - return m_cia_0_irq || m_side_int2; -} - -bool a500p_state::int6_pending() -{ - return m_cia_1_irq || m_side_int6; -} - -bool a600_state::int2_pending() -{ - return m_cia_0_irq || m_gayle_int2; -} - -WRITE_LINE_MEMBER( a600_state::gayle_int2_w ) -{ - m_gayle_int2 = state; - update_int2(); -} - -bool a1200_state::int2_pending() -{ - return m_cia_0_irq || m_gayle_int2; -} - -WRITE_LINE_MEMBER( a1200_state::gayle_int2_w ) -{ - m_gayle_int2 = state; - update_int2(); -} - -READ32_MEMBER( a4000_state::scsi_r ) -{ - UINT16 data = 0xffff; - logerror("scsi_r(%06x): %08x & %08x\n", offset, data, mem_mask); - return data; -} - -WRITE32_MEMBER( a4000_state::scsi_w ) -{ - logerror("scsi_w(%06x): %08x & %08x\n", offset, data, mem_mask); -} - -READ16_MEMBER( a4000_state::ide_r ) -{ - UINT16 data = 0xffff; - - // ide interrupt register - if (offset == 0x1010) - return m_ide_interrupt << 15; - - // swap - mem_mask = (mem_mask << 8) | (mem_mask >> 8); - - // this very likely doesn't respond to all the addresses, figure out which ones - if (BIT(offset, 12)) - data = m_ata->read_cs1(space, (offset >> 1) & 0x07, mem_mask); - else - data = m_ata->read_cs0(space, (offset >> 1) & 0x07, mem_mask); - - // swap - data = (data << 8) | (data >> 8); - - return data; -} - -WRITE16_MEMBER( a4000_state::ide_w ) -{ - // ide interrupt register, read only - if (offset == 0x1010) - return; - - // swap - mem_mask = (mem_mask << 8) | (mem_mask >> 8); - data = (data << 8) | (data >> 8); - - // this very likely doesn't respond to all the addresses, figure out which ones - if (BIT(offset, 12)) - m_ata->write_cs1(space, (offset >> 1) & 0x07, data, mem_mask); - else - m_ata->write_cs0(space, (offset >> 1) & 0x07, data, mem_mask); -} - -WRITE_LINE_MEMBER( a4000_state::ide_interrupt_w ) -{ - m_ide_interrupt = state; -} - -READ32_MEMBER( a4000_state::motherboard_r ) -{ - UINT32 data = 0; - - if (offset == 0) - { - if (ACCESSING_BITS_0_7) - data |= m_ramsey_config & 0xff; - if (ACCESSING_BITS_8_15) - data |= (m_gary_coldboot << 7 | 0x7f) << 8; - if (ACCESSING_BITS_16_23) - data |= (m_gary_toenb << 7 | 0x7f) << 16; - if (ACCESSING_BITS_24_31) - data |= (m_gary_timeout << 7 | 0x7f) << 24; - } - else - data = 0xffffffff; - - logerror("motherboard_r(%06x): %08x & %08x\n", offset, data, mem_mask); - - return data; -} - -WRITE32_MEMBER( a4000_state::motherboard_w ) -{ - if (offset == 0) - { - if (ACCESSING_BITS_0_7) - m_ramsey_config = data & 0xff; - if (ACCESSING_BITS_8_15) - m_gary_coldboot = BIT(data, 7); - if (ACCESSING_BITS_16_23) - m_gary_toenb = BIT(data, 7); - if (ACCESSING_BITS_24_31) - m_gary_timeout = BIT(data, 7); - } - - logerror("motherboard_w(%06x): %08x & %08x\n", offset, data, mem_mask); -} - -void cd32_state::potgo_w(UINT16 data) -{ - int i; - - m_potgo_value = m_potgo_value & 0x5500; - m_potgo_value |= data & 0xaa00; - - for (i = 0; i < 8; i += 2) - { - UINT16 dir = 0x0200 << i; - if (data & dir) - { - UINT16 d = 0x0100 << i; - m_potgo_value &= ~d; - m_potgo_value |= data & d; - } - } - for (i = 0; i < 2; i++) - { - UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ - UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if ((m_potgo_value & p5dir) && (m_potgo_value & p5dat)) - m_cd32_shifter[i] = 8; - } -} - -static void handle_cd32_joystick_cia(running_machine &machine, UINT8 pra, UINT8 dra) -{ - cd32_state *state = machine.driver_data(); - int i; - - for (i = 0; i < 2; i++) - { - UINT8 but = 0x40 << i; - UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ - UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ - - if (!(state->m_potgo_value & p5dir) || !(state->m_potgo_value & p5dat)) - { - if ((dra & but) && (pra & but) != state->m_oldstate[i]) - { - if (!(pra & but)) - { - state->m_cd32_shifter[i]--; - if (state->m_cd32_shifter[i] < 0) - state->m_cd32_shifter[i] = 0; - } - } - } - state->m_oldstate[i] = pra & but; - } -} - -static UINT16 handle_joystick_potgor(running_machine &machine, UINT16 potgor) -{ - cd32_state *state = machine.driver_data(); - ioport_port * player_portname[] = { state->m_p1_port, state->m_p2_port }; - int i; - - for (i = 0; i < 2; i++) - { - UINT16 p9dir = 0x0800 << (i * 4); /* output enable P9 */ - UINT16 p9dat = 0x0400 << (i * 4); /* data P9 */ - UINT16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ - UINT16 p5dat = 0x0100 << (i * 4); /* data P5 */ - - /* p5 is floating in input-mode */ - potgor &= ~p5dat; - potgor |= state->m_potgo_value & p5dat; - if (!(state->m_potgo_value & p9dir)) - potgor |= p9dat; - /* P5 output and 1 -> shift register is kept reset (Blue button) */ - if ((state->m_potgo_value & p5dir) && (state->m_potgo_value & p5dat)) - state->m_cd32_shifter[i] = 8; - /* shift at 1 == return one, >1 = return button states */ - if (state->m_cd32_shifter[i] == 0) - potgor &= ~p9dat; /* shift at zero == return zero */ - if (state->m_cd32_shifter[i] >= 2 && ((player_portname[i])->read() & (1 << (state->m_cd32_shifter[i] - 2)))) - potgor &= ~p9dat; - } - return potgor; -} - -CUSTOM_INPUT_MEMBER( cd32_state::cd32_input ) -{ - return handle_joystick_potgor(machine(), m_potgo_value) >> 8; -} - -CUSTOM_INPUT_MEMBER( cd32_state::cd32_sel_mirror_input ) -{ - ioport_port* ports[2]= { m_p1_port, m_p2_port }; - UINT8 bits = ports[(int)(FPTR)param]->read(); - return (bits & 0x20)>>5; -} - -WRITE8_MEMBER( cd32_state::akiko_cia_0_port_a_write ) -{ - // bit 0, cd audio mute - m_cdda->set_output_gain(0, BIT(data, 0) ? 0.0 : 1.0); - - // bit 1, power led - set_led_status(machine(), 0, BIT(data, 1) ? 0 : 1); - - handle_cd32_joystick_cia(machine(), data, m_cia_0->read(space, 2)); -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -// The first Amiga systems used a PAL to decode chip selects, later systems -// switched to the "Gary" chip, the A3000 and A4000 used the "Super Gary" -// chip. The A600 and A1200 use the Gayle chip, while the CD32 uses its -// Akiko custom chip. - -#if 0 -static ADDRESS_MAP_START( a1000_overlay_map, AS_PROGRAM, 16, a1000_state ) - AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0x1c0000) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x200000, 0x201fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) - AM_RANGE(0x280000, 0x2bffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x300000, 0x33ffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x380000, 0x381fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) -ADDRESS_MAP_END -#endif - -static ADDRESS_MAP_START( a1000_overlay_map, AS_PROGRAM, 16, a1000_state ) - AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x200000, 0x201fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) - AM_RANGE(0x280000, 0x2fffff) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x300000, 0x37ffff) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x380000, 0x381fff) AM_MIRROR(0x03e000) AM_ROM AM_REGION("bootrom", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( a1000_bootrom_map, AS_PROGRAM, 16, a1000_state ) - AM_RANGE(0x000000, 0x001fff) AM_MIRROR(0x3e000) AM_ROM AM_REGION("bootrom", 0) AM_WRITE(write_protect_w) - AM_RANGE(0x040000, 0x07ffff) AM_ROMBANK("wom") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( a1000_mem, AS_PROGRAM, 16, a1000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) - AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) - AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) - AM_RANGE(0xf80000, 0xfbffff) AM_DEVICE("bootrom", address_map_bank_device, amap16) - AM_RANGE(0xfc0000, 0xffffff) AM_READWRITE_BANK("wom") -ADDRESS_MAP_END - -// Gary/Super Gary/Gayle with 512KB chip RAM -static ADDRESS_MAP_START( overlay_512kb_map, AS_PROGRAM, 16, amiga_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x07ffff) AM_MIRROR(0x180000) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// Gary/Super Gary/Gayle with 1MB chip RAM -static ADDRESS_MAP_START( overlay_1mb_map, AS_PROGRAM, 16, amiga_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_MIRROR(0x100000) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// Gary/Super Gary/Gayle with 1MB chip RAM (32 bit system) -static ADDRESS_MAP_START( overlay_1mb_map32, AS_PROGRAM, 32, amiga_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_MIRROR(0x100000) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// Gary/Super Gary/Gayle with 2MB chip RAM (32 bit system) -static ADDRESS_MAP_START( overlay_2mb_map16, AS_PROGRAM, 16, amiga_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// Gary/Super Gary/Gayle with 2MB chip RAM (32 bit system) -static ADDRESS_MAP_START( overlay_2mb_map32, AS_PROGRAM, 32, amiga_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("chip_ram") - AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// 512KB chip RAM, 512KB slow RAM, RTC -static ADDRESS_MAP_START( a2000_mem, AS_PROGRAM, 16, a2000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) - AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) - AM_RANGE(0xc00000, 0xc7ffff) AM_RAM - AM_RANGE(0xc80000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xd80000, 0xdbffff) AM_NOP - AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) - AM_RANGE(0xd80000, 0xddffff) AM_NOP - AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) - AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) - AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// 512KB chip RAM and no clock -static ADDRESS_MAP_START( a500_mem, AS_PROGRAM, 16, a500_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) - AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) - AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xd80000, 0xddffff) AM_NOP - AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) - AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) - AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// 1MB chip RAM, RTC and CDTV specific hardware -static ADDRESS_MAP_START( cdtv_mem, AS_PROGRAM, 16, cdtv_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) - AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) - AM_RANGE(0xc00000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xd80000, 0xdbffff) AM_NOP - AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) - AM_RANGE(0xdc8000, 0xdc87ff) AM_MIRROR(0x7800) AM_RAM AM_SHARE("sram") - AM_RANGE(0xdd0000, 0xddffff) AM_NOP - AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xe00000, 0xe3ffff) AM_MIRROR(0x40000) AM_RAM AM_SHARE("memcard") - AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) - AM_RANGE(0xf00000, 0xf3ffff) AM_MIRROR(0x40000) AM_ROM AM_REGION("cdrom", 0) - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cdtv_rc_mem, AS_PROGRAM, 8, cdtv_state ) - AM_RANGE(0x0800, 0x0fff) AM_ROM AM_REGION("rcmcu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( a3000_mem, AS_PROGRAM, 32, a3000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x001fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) - AM_RANGE(0x00b80000, 0x00bfffff) AM_READWRITE16(cia_r, cia_w, 0xffffffff) - AM_RANGE(0x00c00000, 0x00cfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) - AM_RANGE(0x00d00000, 0x00dbffff) AM_NOP - AM_RANGE(0x00dc0000, 0x00dcffff) AM_DEVREADWRITE8("rtc", rp5c01_device, read, write, 0x000000ff) - AM_RANGE(0x00dd0000, 0x00ddffff) AM_READWRITE(scsi_r, scsi_w) - AM_RANGE(0x00de0000, 0x00deffff) AM_READWRITE(motherboard_r, motherboard_w) - AM_RANGE(0x00df0000, 0x00dfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) - AM_RANGE(0x00e80000, 0x00efffff) AM_NOP // autoconfig space (installed by devices) - AM_RANGE(0x00f00000, 0x00f7ffff) AM_NOP // cartridge space - AM_RANGE(0x00f80000, 0x00ffffff) AM_ROM AM_REGION("kickstart", 0) - AM_RANGE(0x07f00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward -ADDRESS_MAP_END - -// 1MB chip RAM and RTC -static ADDRESS_MAP_START( a500p_mem, AS_PROGRAM, 16, a500p_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) - AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cia_r, cia_w) - AM_RANGE(0xc00000, 0xc7ffff) AM_RAM - AM_RANGE(0xc80000, 0xd7ffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xd80000, 0xdbffff) AM_NOP - AM_RANGE(0xdc0000, 0xdc7fff) AM_READWRITE(clock_r, clock_w) - AM_RANGE(0xd80000, 0xddffff) AM_NOP - AM_RANGE(0xde0000, 0xdeffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) - AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// 1MB chip RAM, IDE and PCMCIA -static ADDRESS_MAP_START( a600_mem, AS_PROGRAM, 16, a600_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap16) - AM_RANGE(0x200000, 0xa7ffff) AM_NOP - AM_RANGE(0xa80000, 0xafffff) AM_WRITENOP AM_READ(rom_mirror_r) - AM_RANGE(0xb00000, 0xb7ffff) AM_WRITENOP AM_READ(rom_mirror_r) - AM_RANGE(0xb80000, 0xbeffff) AM_NOP // reserved (cdtv) - AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE(cia_r, gayle_cia_w) - AM_RANGE(0xc00000, 0xd7ffff) AM_NOP // slow mem - AM_RANGE(0xd80000, 0xd8ffff) AM_NOP // spare chip select - AM_RANGE(0xd90000, 0xd9ffff) AM_NOP // arcnet chip select - AM_RANGE(0xda0000, 0xdaffff) AM_DEVREADWRITE("gayle", gayle_device, gayle_r, gayle_w) - AM_RANGE(0xdb0000, 0xdbffff) AM_NOP // reserved (external ide) - AM_RANGE(0xdc0000, 0xdcffff) AM_NOP // rtc - AM_RANGE(0xdd0000, 0xddffff) AM_NOP // reserved (dma controller) - AM_RANGE(0xde0000, 0xdeffff) AM_DEVREADWRITE("gayle", gayle_device, gayle_id_r, gayle_id_w) - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE(custom_chip_r, custom_chip_w) - AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror_r) - AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) - AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// 2MB chip RAM, IDE and PCMCIA -static ADDRESS_MAP_START( a1200_mem, AS_PROGRAM, 32, a1200_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) - AM_RANGE(0x200000, 0xa7ffff) AM_NOP - AM_RANGE(0xa80000, 0xafffff) AM_WRITENOP AM_READ(rom_mirror32_r) - AM_RANGE(0xb00000, 0xb7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) - AM_RANGE(0xb80000, 0xbeffff) AM_NOP // reserved (cdtv) - AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE16(cia_r, gayle_cia_w, 0xffffffff) - AM_RANGE(0xc00000, 0xd7ffff) AM_NOP // slow mem - AM_RANGE(0xd80000, 0xd8ffff) AM_NOP // spare chip select - AM_RANGE(0xd90000, 0xd9ffff) AM_NOP // arcnet chip select - AM_RANGE(0xda0000, 0xdaffff) AM_DEVREADWRITE16("gayle", gayle_device, gayle_r, gayle_w, 0xffffffff) - AM_RANGE(0xdb0000, 0xdbffff) AM_NOP // reserved (external ide) - AM_RANGE(0xdc0000, 0xdcffff) AM_NOP // rtc - AM_RANGE(0xdd0000, 0xddffff) AM_NOP // reserved (dma controller) - AM_RANGE(0xde0000, 0xdeffff) AM_DEVREADWRITE16("gayle", gayle_device, gayle_id_r, gayle_id_w, 0xffffffff) - AM_RANGE(0xdf0000, 0xdfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) - AM_RANGE(0xe00000, 0xe7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) - AM_RANGE(0xe80000, 0xefffff) AM_NOP // autoconfig space (installed by devices) - AM_RANGE(0xf00000, 0xf7ffff) AM_NOP // cartridge space - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// 2MB chip RAM, 4 MB fast RAM, RTC and IDE -static ADDRESS_MAP_START( a4000_mem, AS_PROGRAM, 32, a4000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x001fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) - AM_RANGE(0x00200000, 0x009fffff) AM_NOP // zorro2 expansion - AM_RANGE(0x00a00000, 0x00b7ffff) AM_NOP - AM_RANGE(0x00b80000, 0x00beffff) AM_NOP - AM_RANGE(0x00bf0000, 0x00bfffff) AM_READWRITE16(cia_r, cia_w, 0xffffffff) - AM_RANGE(0x00c00000, 0x00cfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) - AM_RANGE(0x00d00000, 0x00d9ffff) AM_NOP - AM_RANGE(0x00da0000, 0x00dbffff) AM_NOP - AM_RANGE(0x00dc0000, 0x00dcffff) AM_DEVREADWRITE8("rtc", rp5c01_device, read, write, 0x000000ff) - AM_RANGE(0x00dd0000, 0x00dd0fff) AM_NOP - AM_RANGE(0x00dd1000, 0x00dd3fff) AM_READWRITE16(ide_r, ide_w, 0xffffffff) - AM_RANGE(0x00dd4000, 0x00ddffff) AM_NOP - AM_RANGE(0x00de0000, 0x00deffff) AM_READWRITE(motherboard_r, motherboard_w) - AM_RANGE(0x00df0000, 0x00dfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) - AM_RANGE(0x00e00000, 0x00e7ffff) AM_WRITENOP AM_READ(rom_mirror32_r) - AM_RANGE(0x00e80000, 0x00efffff) AM_NOP // zorro2 autoconfig space (installed by devices) - AM_RANGE(0x00f00000, 0x00f7ffff) AM_NOP // cartridge space - AM_RANGE(0x00f80000, 0x00ffffff) AM_ROM AM_REGION("kickstart", 0) - AM_RANGE(0x01000000, 0x017fffff) AM_NOP // reserved (8 mb chip ram) - AM_RANGE(0x01800000, 0x06ffffff) AM_NOP // reserved (motherboard fast ram expansion) - AM_RANGE(0x07000000, 0x07bfffff) AM_NOP // motherboard ram - AM_RANGE(0x07c00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward -ADDRESS_MAP_END - -// 2MB chip RAM, 2 MB fast RAM, RTC and IDE -static ADDRESS_MAP_START( a400030_mem, AS_PROGRAM, 32, a4000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_IMPORT_FROM(a4000_mem) - AM_RANGE(0x07000000, 0x07dfffff) AM_NOP // motherboard ram - AM_RANGE(0x07e00000, 0x07ffffff) AM_RAM // motherboard ram (up to 16mb), grows downward -ADDRESS_MAP_END - -// 2MB chip RAM and CD-ROM -static ADDRESS_MAP_START( cd32_mem, AS_PROGRAM, 32, cd32_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1fffff) AM_DEVICE("overlay", address_map_bank_device, amap32) - AM_RANGE(0xb80000, 0xb8003f) AM_DEVREADWRITE("akiko", akiko_device, read, write) - AM_RANGE(0xbf0000, 0xbfffff) AM_READWRITE16(cia_r, gayle_cia_w, 0xffffffff) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(custom_chip_r, custom_chip_w, 0xffffffff) - AM_RANGE(0xe00000, 0xe7ffff) AM_ROM AM_REGION("kickstart", 0x80000) - AM_RANGE(0xa00000, 0xf7ffff) AM_NOP - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("kickstart", 0) -ADDRESS_MAP_END - -// 2 MB chip RAM, IDE, RTC and SCSI -static ADDRESS_MAP_START( a4000t_mem, AS_PROGRAM, 32, a4000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_IMPORT_FROM(a4000_mem) - AM_RANGE(0x00dd0000, 0x00dd0fff) AM_READWRITE(scsi_r, scsi_w) -ADDRESS_MAP_END - - -//************************************************************************** -// INPUTS -//************************************************************************** - -static INPUT_PORTS_START( amiga ) - PORT_START("input") - PORT_CONFNAME(0x10, 0x00, "Game Port 0 Device") - PORT_CONFSETTING(0x00, "Mouse") - PORT_CONFSETTING(0x10, DEF_STR(Joystick)) - PORT_CONFNAME(0x20, 0x20, "Game Port 1 Device") - PORT_CONFSETTING(0x00, "Mouse") - PORT_CONFSETTING(0x20, DEF_STR(Joystick) ) - - PORT_START("cia_0_port_a") - PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, floppy_drive_status, 0) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) - - PORT_START("joy_0_dat") - PORT_BIT(0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 0) - PORT_BIT(0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("joy_1_dat") - PORT_BIT(0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 1) - PORT_BIT(0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("potgo") - PORT_BIT(0x0100, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(1) - PORT_BIT(0x0400, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0x1000, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(2) - PORT_BIT(0x4000, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) - PORT_BIT(0xaaff, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("p1_joy") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) - - PORT_START("p2_joy") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - - PORT_START("p1_mouse_x") - PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) - - PORT_START("p1_mouse_y") - PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) - - PORT_START("p2_mouse_x") - PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(2) - - PORT_START("p2_mouse_y") - PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(2) -INPUT_PORTS_END - -INPUT_PORTS_START( cd32 ) - PORT_INCLUDE(amiga) - - PORT_MODIFY("cia_0_port_a") - PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) - // this is the regular port for reading a single button joystick on the Amiga, many CD32 games require this to mirror the pad start button! - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_sel_mirror_input, 0) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_sel_mirror_input, 1) - - PORT_MODIFY("joy_0_dat") - PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 0) - PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_MODIFY("joy_1_dat") - PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state, amiga_joystick_convert, 1) - PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_MODIFY("potgo") - PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state, cd32_input, 0) - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - // CD32 '11' button pad (4 dpad directions + 7 buttons), not read directly - PORT_START("p1_cd32_buttons") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Play/Pause") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Left Trigger/Rewind") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Right Trigger/Forward") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Green/Stop") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Yellow/Shuffle") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Red/Select") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Blue/Loop") - - // CD32 '11' button pad (4 dpad directions + 7 buttons), not read directly - PORT_START("p2_cd32_buttons") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Play/Pause") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Left Trigger/Rewind") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Right Trigger/Forward") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Green/Stop") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Yellow/Shuffle") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Red/Select") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Blue/Loop") -INPUT_PORTS_END - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static SLOT_INTERFACE_START( amiga_floppies ) - SLOT_INTERFACE("35dd", FLOPPY_35_DD) -SLOT_INTERFACE_END - -// basic elements common to all amigas -static MACHINE_CONFIG_START( amiga_base, amiga_state ) - // video - MCFG_FRAGMENT_ADD(pal_video) - - MCFG_PALETTE_ADD("palette", 4096) - MCFG_PALETTE_INIT_OWNER(amiga_state, amiga) - - MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga) - - // cia - MCFG_DEVICE_ADD("cia_0", MOS8520, amiga_state::CLK_E_PAL) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_0_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(IOPORT("cia_0_port_a")) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE("centronics", centronics_device, write_strobe)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE("kbd", amigakbd_device, kdat_w)) - - MCFG_DEVICE_ADD("cia_1", MOS8520, amiga_state::CLK_E_PAL) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(amiga_state, cia_1_port_a_read)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_1_port_a_write)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("fdc", amiga_fdc, ciaaprb_w)) - - // audio - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("amiga", AMIGA, amiga_state::CLK_C1_PAL) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) - MCFG_SOUND_ROUTE(3, "lspeaker", 0.50) - - // floppy drives - MCFG_DEVICE_ADD("fdc", AMIGA_FDC, amiga_state::CLK_7M_PAL) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", amiga_floppies, "35dd", amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", amiga_floppies, 0, amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", amiga_floppies, 0, amiga_fdc::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", amiga_floppies, 0, amiga_fdc::floppy_formats) - - // rs232 - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(WRITELINE(amiga_state, rs232_rx_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE(amiga_state, rs232_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE(amiga_state, rs232_dsr_w)) - MCFG_RS232_RI_HANDLER(WRITELINE(amiga_state, rs232_ri_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE(amiga_state, rs232_cts_w)) - - // centronics - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(amiga_state, centronics_ack_w)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amiga_state, centronics_busy_w)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(amiga_state, centronics_perror_w)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(amiga_state, centronics_select_w)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - // keyboard - MCFG_DEVICE_ADD("kbd", AMIGAKBD, 0) - MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(DEVWRITELINE("cia_0", mos8520_device, cnt_w)) - MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(DEVWRITELINE("cia_0", mos8520_device, sp_w)) - MCFG_AMIGA_KEYBOARD_KRST_CALLBACK(WRITELINE(amiga_state, kbreset_w)) - - // software - MCFG_SOFTWARE_LIST_ADD("wb_list", "amiga_workbench") - MCFG_SOFTWARE_LIST_ADD("hardware_list", "amiga_hardware") - MCFG_SOFTWARE_LIST_ADD("apps_list", "amiga_apps") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a1000, amiga_base, a1000_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) - MCFG_CPU_PROGRAM_MAP(a1000_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(a1000_overlay_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - MCFG_DEVICE_ADD("bootrom", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(a1000_bootrom_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(19) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x40000) - - MCFG_SOFTWARE_LIST_ADD("a1000_list", "amiga_a1000") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a1000n, a1000, a1000_state ) - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a2000, amiga_base, a2000_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) - MCFG_CPU_PROGRAM_MAP(a2000_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - // real-time clock - MCFG_DEVICE_ADD("u65", MSM6242, XTAL_32_768kHz) - - // cpu slot - MCFG_EXPANSION_SLOT_ADD("maincpu", a2000_expansion_cards, NULL) - - // zorro slots - MCFG_ZORRO2_ADD("maincpu") - MCFG_ZORRO2_INT2_HANDLER(WRITELINE(a2000_state, zorro2_int2_w)) - MCFG_ZORRO2_INT6_HANDLER(WRITELINE(a2000_state, zorro2_int6_w)) - MCFG_ZORRO2_SLOT_ADD("zorro1", zorro2_cards, NULL) - MCFG_ZORRO2_SLOT_ADD("zorro2", zorro2_cards, NULL) - MCFG_ZORRO2_SLOT_ADD("zorro3", zorro2_cards, NULL) - MCFG_ZORRO2_SLOT_ADD("zorro4", zorro2_cards, NULL) - MCFG_ZORRO2_SLOT_ADD("zorro5", zorro2_cards, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a2000n, a2000, a2000_state ) - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a500, amiga_base, a500_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) - MCFG_CPU_PROGRAM_MAP(a500_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - //MCFG_DEVICE_PROGRAM_MAP(overlay_512kb_map) - MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - // cpu slot - MCFG_EXPANSION_SLOT_ADD("maincpu", a500_expansion_cards, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a500n, a500, a500_state ) - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( cdtv, amiga_base, cdtv_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) - MCFG_CPU_PROGRAM_MAP(cdtv_mem) - - // remote control input converter - MCFG_CPU_ADD("u75", M6502, XTAL_3MHz) - MCFG_CPU_PROGRAM_MAP(cdtv_rc_mem) - MCFG_DEVICE_DISABLE() - - // lcd controller -#if 0 - MCFG_CPU_ADD("u62", LC6554, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(lcd_mem) -#endif - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - // standard sram - MCFG_NVRAM_ADD_0FILL("sram") - - // 256kb memory card - MCFG_NVRAM_ADD_0FILL("memcard") - - // real-time clock - MCFG_DEVICE_ADD("u61", MSM6242, XTAL_32_768kHz) - - // cd-rom controller - MCFG_DMAC_ADD("u36", amiga_state::CLK_7M_PAL) - MCFG_DMAC_SCSI_READ_HANDLER(READ8(cdtv_state, dmac_scsi_data_read)) - MCFG_DMAC_SCSI_WRITE_HANDLER(WRITE8(cdtv_state, dmac_scsi_data_write)) - MCFG_DMAC_IO_READ_HANDLER(READ8(cdtv_state, dmac_io_read)) - MCFG_DMAC_IO_WRITE_HANDLER(WRITE8(cdtv_state, dmac_io_write)) - MCFG_DMAC_INT_HANDLER(WRITELINE(cdtv_state, dmac_int_w)) - - MCFG_DEVICE_ADD("u32", TPI6525, 0) - MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(cdtv_state, tpi_int_w)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cdtv_state, tpi_port_b_write)) - - // cd-rom - MCFG_CR511B_ADD("cdrom") - MCFG_CR511B_SCOR_HANDLER(DEVWRITELINE("u32", tpi6525_device, i1_w)) MCFG_DEVCB_INVERT - MCFG_CR511B_STCH_HANDLER(DEVWRITELINE("u32", tpi6525_device, i2_w)) MCFG_DEVCB_INVERT - MCFG_CR511B_STEN_HANDLER(DEVWRITELINE("u32", tpi6525_device, i3_w)) - MCFG_CR511B_XAEN_HANDLER(DEVWRITELINE("u32", tpi6525_device, pb2_w)) - MCFG_CR511B_DRQ_HANDLER(DEVWRITELINE("u36", dmac_device, xdreq_w)) - MCFG_CR511B_DTEN_HANDLER(DEVWRITELINE("u36", dmac_device, xdreq_w)) - - MCFG_SOFTWARE_LIST_ADD("cd_list", "cdtv") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( cdtvn, cdtv, cdtv_state ) - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("u36") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a3000, amiga_base, a3000_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68030, XTAL_32MHz / 2) - MCFG_CPU_PROGRAM_MAP(a3000_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map32) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - // real-time clock - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) - - // todo: zorro3 slots, super dmac, scsi - - MCFG_SOFTWARE_LIST_ADD("a3000_list", "amiga_a3000") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a3000n, a3000, a3000_state ) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a500p, amiga_base, a500p_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) - MCFG_CPU_PROGRAM_MAP(a500p_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(overlay_1mb_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - // real-time clock - MCFG_DEVICE_ADD("u9", MSM6242, XTAL_32_768kHz) - - // cpu slot - MCFG_EXPANSION_SLOT_ADD("maincpu", a500_expansion_cards, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a500pn, a500p, a500p_state ) - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a600, amiga_base, a600_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68000, amiga_state::CLK_7M_PAL) - MCFG_CPU_PROGRAM_MAP(a600_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map16) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - MCFG_GAYLE_ADD("gayle", amiga_state::CLK_28M_PAL / 2, a600_state::GAYLE_ID) - MCFG_GAYLE_INT2_HANDLER(WRITELINE(a600_state, gayle_int2_w)) - MCFG_GAYLE_CS0_READ_HANDLER(DEVREAD16("ata", ata_interface_device, read_cs0)) - MCFG_GAYLE_CS0_WRITE_HANDLER(DEVWRITE16("ata", ata_interface_device, write_cs0)) - MCFG_GAYLE_CS1_READ_HANDLER(DEVREAD16("ata", ata_interface_device, read_cs1)) - MCFG_GAYLE_CS1_WRITE_HANDLER(DEVWRITE16("ata", ata_interface_device, write_cs1)) - - MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, false) - MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("gayle", gayle_device, ide_interrupt_w)) - - // todo: pcmcia -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a600n, a600, a600_state ) - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) - MCFG_DEVICE_MODIFY("gayle") - MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a1200, amiga_base, a1200_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68EC020, amiga_state::CLK_28M_PAL / 2) - MCFG_CPU_PROGRAM_MAP(a1200_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - - MCFG_DEVICE_REMOVE("palette") - - MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) - - MCFG_GAYLE_ADD("gayle", amiga_state::CLK_28M_PAL / 2, a1200_state::GAYLE_ID) - MCFG_GAYLE_INT2_HANDLER(WRITELINE(a1200_state, gayle_int2_w)) - MCFG_GAYLE_CS0_READ_HANDLER(DEVREAD16("ata", ata_interface_device, read_cs0)) - MCFG_GAYLE_CS0_WRITE_HANDLER(DEVWRITE16("ata", ata_interface_device, write_cs0)) - MCFG_GAYLE_CS1_READ_HANDLER(DEVREAD16("ata", ata_interface_device, read_cs1)) - MCFG_GAYLE_CS1_WRITE_HANDLER(DEVWRITE16("ata", ata_interface_device, write_cs1)) - - MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, false) - MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("gayle", gayle_device, ide_interrupt_w)) - - // todo: pcmcia -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a1200n, a1200, a1200_state ) - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) - MCFG_DEVICE_MODIFY("gayle") - MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a4000, amiga_base, a4000_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68040, XTAL_50MHz / 2) - MCFG_CPU_PROGRAM_MAP(a4000_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - - MCFG_DEVICE_REMOVE("palette") - - MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) - - // real-time clock - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) - - // ide - MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, false) - MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(a4000_state, ide_interrupt_w)) - - // todo: zorro3 -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a4000n, a4000, a4000_state ) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a400030, a4000, a4000_state ) - // main cpu - MCFG_DEVICE_REMOVE("maincpu") - MCFG_CPU_ADD("maincpu", M68EC030, XTAL_50MHz / 2) - MCFG_CPU_PROGRAM_MAP(a400030_mem) - - // todo: ide -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a400030n, a400030, a4000_state ) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( cd32, amiga_base, cd32_state ) - // main cpu - MCFG_CPU_ADD("maincpu", M68EC020, amiga_state::CLK_28M_PAL / 2) - MCFG_CPU_PROGRAM_MAP(cd32_mem) - - MCFG_DEVICE_ADD("overlay", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(overlay_2mb_map32) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(32) - MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(22) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200000) - - MCFG_I2CMEM_ADD("i2cmem") - MCFG_I2CMEM_PAGE_SIZE(16) - MCFG_I2CMEM_DATA_SIZE(1024) - - MCFG_AKIKO_ADD("akiko", "maincpu") - MCFG_AKIKO_SCL_HANDLER(DEVWRITELINE("i2cmem", i2cmem_device, write_scl)) - MCFG_AKIKO_SDA_READ_HANDLER(DEVREADLINE("i2cmem", i2cmem_device, read_sda)) - MCFG_AKIKO_SDA_WRITE_HANDLER(DEVWRITELINE("i2cmem", i2cmem_device, write_sda)) - - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - - MCFG_DEVICE_REMOVE("palette") - - MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga) - - MCFG_SOUND_ADD("cdda", CDDA, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - - MCFG_DEVICE_MODIFY("cia_0") - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cd32_state, akiko_cia_0_port_a_write)) - MCFG_MOS6526_SP_CALLBACK(NULL) - - MCFG_CDROM_ADD("cdrom") - MCFG_CDROM_INTERFACE("cd32_cdrom") - - MCFG_DEVICE_REMOVE("kbd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( cd32n, cd32, cd32_state ) - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_CLOCK(amiga_state::CLK_28M_NTSC / 2) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a4000t, a4000, a4000_state ) - // main cpu - MCFG_DEVICE_REMOVE("maincpu") - MCFG_CPU_ADD("maincpu", M68040, XTAL_50MHz / 2) - MCFG_CPU_PROGRAM_MAP(a4000t_mem) - - // todo: ide, zorro3, scsi, super dmac -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( a4000tn, a4000, a4000_state ) - MCFG_DEVICE_REMOVE("screen") - MCFG_FRAGMENT_ADD(ntsc_video) - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga_aga) - MCFG_DEVICE_MODIFY("amiga") - MCFG_DEVICE_CLOCK(amiga_state::CLK_C1_NTSC) - MCFG_DEVICE_MODIFY("cia_0") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("cia_1") - MCFG_DEVICE_CLOCK(amiga_state::CLK_E_NTSC) - MCFG_DEVICE_MODIFY("fdc") - MCFG_DEVICE_CLOCK(amiga_state::CLK_7M_NTSC) -MACHINE_CONFIG_END - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -// Amiga 1000 -// -// Shipped with a small bootrom to load kickstart from disk because the -// Kickstart wasn't finished in time. - -ROM_START( a1000 ) - ROM_REGION16_BE(0x2000, "bootrom", 0) - ROM_LOAD16_BYTE("252179-01.u5n", 0x0000, 0x1000, CRC(42553bc4) SHA1(8855a97f7a44e3f62d1c88d938fee1f4c606af5b)) - ROM_LOAD16_BYTE("252180-01.u5p", 0x0001, 0x1000, CRC(8e5b9a37) SHA1(d10f1564b99f5ffe108fa042362e877f569de2c3)) - - // PALs, all of type PAL16L8 - ROM_REGION(0x104, "dpalen", 0) - ROM_LOAD("252128-01.u4t", 0, 0x104, CRC(28209ff2) SHA1(20c03b6b8e7254231f4b3014dc2c4d9274d469d2)) - ROM_REGION(0x104, "dpalcas", 0) - ROM_LOAD("252128-02.u6p", 0, 0x104, CRC(b928efd2) SHA1(430794a544d9160e1b786e97e0dec5f25502a00a)) - ROM_REGION(0x104, "daugen", 0) - ROM_LOAD("252128-03.u4s", 0, 0x104, CRC(87747964) SHA1(00d72ec707c582363525fde56176973c7327b1d7)) - ROM_REGION(0x104, "daugcas", 0) - ROM_LOAD("252128-04.u6n", 0, 0x104, CRC(f903adb4) SHA1(4c8fb696fd1aaf9bb8c9efddeac24bb36f119c5f)) -ROM_END - -#define rom_a1000n rom_a1000 - -// Amiga 2000 and Amiga 500 -// -// Early models shipped with Kickstart 1.2, later versions with Kickstart 1.3. -// Kickstart 2.04 and 3.1 upgrade available. The Kickstart 2.04 upgrade was also -// available as a special version that included a jumper wire, which was needed -// for some early motherboard revisions (P/N: 363968-01). - -ROM_START( a2000 ) - ROM_REGION16_BE(0x80000, "kickstart", 0) - ROM_DEFAULT_BIOS("kick13") - ROM_SYSTEM_BIOS(0, "kick12", "Kickstart 1.2 (33.180)") - ROMX_LOAD("315093-01.u2", 0x00000, 0x40000, CRC(a6ce1636) SHA1(11f9e62cf299f72184835b7b2a70a16333fc0d88), ROM_GROUPWORD | ROM_BIOS(1)) - ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) - ROM_SYSTEM_BIOS(1, "kick13", "Kickstart 1.3 (34.5)") - ROMX_LOAD("315093-02.u2", 0x00000, 0x40000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD | ROM_BIOS(2)) - ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) - ROM_SYSTEM_BIOS(2, "kick204", "Kickstart 2.04 (37.175)") - ROMX_LOAD("390979-01.u2", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "kick31", "Kickstart 3.1 (40.63)") - ROMX_LOAD("kick40063.u2", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "logica2", "Logica Diagnostic 2.0") - ROMX_LOAD("logica2.u2", 0x00000, 0x80000, CRC(8484f426) SHA1(ba10d16166b2e2d6177c979c99edf8462b21651e), ROM_GROUPWORD | ROM_BIOS(5)) -ROM_END - -// Amiga 2000CR chip location: U500 -#define rom_a2000n rom_a2000 - -// Amiga 500 chip location: U6 -#define rom_a500 rom_a2000 -#define rom_a500n rom_a2000 - -// Amiga 500+ -// -// Shipped with Kickstart 2.04. Kickstart 3.1 upgrade available. - -ROM_START( a500p ) - ROM_REGION16_BE(0x80000, "kickstart", 0) - ROM_DEFAULT_BIOS("kick204") - ROM_SYSTEM_BIOS(0, "kick204", "Kickstart 2.04 (37.175)") - ROMX_LOAD("390979-01.u6", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "kick31", "Kickstart 3.1 (40.63)") - ROMX_LOAD("kick40063.u6", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "logica2", "Logica Diagnostic 2.0") - ROMX_LOAD("logica2.u6", 0x00000, 0x80000, CRC(8484f426) SHA1(ba10d16166b2e2d6177c979c99edf8462b21651e), ROM_GROUPWORD | ROM_BIOS(3)) -ROM_END - -#define rom_a500pn rom_a500p - -// Commodore CDTV -// -// Shipped with a standard Kickstart 1.3 and the needed additional drivers -// in two extra chips. - -ROM_START( cdtv ) - // cd-rom driver - ROM_REGION16_BE(0x40000, "cdrom", 0) - ROM_LOAD16_BYTE("391008-01.u34", 0x00000, 0x20000, CRC(791cb14b) SHA1(277a1778924496353ffe56be68063d2a334360e4)) - ROM_LOAD16_BYTE("391009-01.u35", 0x00001, 0x20000, CRC(accbbc2e) SHA1(41b06d1679c6e6933c3378b7626025f7641ebc5c)) - - // standard amiga kickstart 1.3 - ROM_REGION16_BE(0x80000, "kickstart", 0) - ROMX_LOAD("315093-02.u13", 0x00000, 0x40000, CRC(c4f0f55f) SHA1(891e9a547772fe0c6c19b610baf8bc4ea7fcb785), ROM_GROUPWORD) - ROM_COPY("kickstart", 0x00000, 0x40000, 0x40000) - - // remote control input converter, mos 6500/1 mcu - ROM_REGION(0x800, "rcmcu", 0) - ROM_LOAD("252609-02.u75", 0x000, 0x800, NO_DUMP) - - // lcd controller, sanyo lc6554h - ROM_REGION(0x1000, "lcd", 0) - ROM_LOAD("252608-01.u62", 0x0000, 0x1000, NO_DUMP) -ROM_END - -#define rom_cdtvn rom_cdtv - -// Amiga 3000 -// -// Early models have a special version of Kickstart 1.4/2.0 that boots -// Kickstart 1.3 or 2.0 from hard disk or floppy. Later versions have -// Kickstart 2.04 installed as ROM. Upgrade available for -// Kickstart 3.1. - -ROM_START( a3000 ) - ROM_REGION32_BE(0x80000, "kickstart", 0) - ROM_DEFAULT_BIOS("kick20") - ROM_SYSTEM_BIOS(0, "kick14", "Kickstart 1.4 (3312.20085?)") - ROMX_LOAD("390629-01.u182", 0x00000, 0x40000, NO_DUMP, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD("390630-01.u183", 0x00002, 0x40000, NO_DUMP, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "kick20", "Kickstart 2.0 (36.16)") - // COPYRIGHT 1990 CAI // ALL RIGHTS RESERVED // ALPHA 5 ROM 0 CS=9713 - ROMX_LOAD("390629-02.u182", 0x00000, 0x40000, CRC(58327536) SHA1(d1713d7f31474a5948e6d488e33686061cf3d1e2), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - // COPYRIGHT 1990 CAI // ALL RIGHTS RESERVED // ALPHA 5 ROM 1 CS=9B21 - ROMX_LOAD("390630-02.u183", 0x00002, 0x40000, CRC(fe2f7fb9) SHA1(c05c9c52d014c66f9019152b3f2a2adc2c678794), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "kick204", "Kickstart 2.04 (37.175)") - ROMX_LOAD("390629-03.u182", 0x00000, 0x40000, CRC(a245dbdf) SHA1(83bab8e95d378b55b0c6ae6561385a96f638598f), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - ROMX_LOAD("390630-03.u183", 0x00002, 0x40000, CRC(7db1332b) SHA1(48f14b31279da6757848df6feb5318818f8f576c), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "kick31", "Kickstart 3.1 (40.68)") - ROMX_LOAD("kick31.u182", 0x00000, 0x40000, CRC(286b9a0d) SHA1(6763a2258ec493f7408cf663110dae9a17803ad1), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(4)) - ROMX_LOAD("kick31.u183", 0x00002, 0x40000, CRC(0b8cde6a) SHA1(5f02e97b48ebbba87d516a56b0400c6fc3434d8d), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "logica2", "Logica Diagnostic 2.0") - ROMX_LOAD("logica2.u182", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(5)) - ROMX_LOAD("logica2.u183", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(5)) -ROM_END - -#define rom_a3000n rom_a3000 - - -// Amiga 600 -// -// According to Greg Donner's Workbench page, very early models shipped with -// Kickstart 2.04. -// -// Kickstart 2.05 differences: -// - 2.05 37.299: No HDD support -// - 2.05 37.300: HDD support -// - 2.05 37.350: HDD size limits removed -// -// Kickstart 3.1 upgrade available. -// -// The keyboard controller is included on the motherboard, still based on the -// 6500/1. - -ROM_START( a600 ) - ROM_REGION16_BE(0x80000, "kickstart", 0) - ROM_DEFAULT_BIOS("kick205-350") - ROM_SYSTEM_BIOS(0, "kick204", "Kickstart 2.04 (37.175)") - ROMX_LOAD("390979-01.u6", 0x00000, 0x80000, CRC(c3bdb240) SHA1(c5839f5cb98a7a8947065c3ed2f14f5f42e334a1), ROM_GROUPWORD | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "kick205-299", "Kickstart 2.05 (37.299)") - ROMX_LOAD("391388-01.u6", 0x00000, 0x80000, CRC(83028fb5) SHA1(87508de834dc7eb47359cede72d2e3c8a2e5d8db), ROM_GROUPWORD | ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "kick205-300", "Kickstart 2.05 (37.300)") - ROMX_LOAD("391304-01.u6", 0x00000, 0x80000, CRC(64466c2a) SHA1(f72d89148dac39c696e30b10859ebc859226637b), ROM_GROUPWORD | ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "kick205-350", "Kickstart 2.05 (37.300)") - ROMX_LOAD("391304-02.u6", 0x00000, 0x80000, CRC(43b0df7b) SHA1(02843c4253bbd29aba535b0aa3bd9a85034ecde4), ROM_GROUPWORD | ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "kick31", "Kickstart 3.1 (40.63)") - ROMX_LOAD("kick40063.u6", 0x00000, 0x80000, CRC(fc24ae0d) SHA1(3b7f1493b27e212830f989f26ca76c02049f09ca), ROM_GROUPWORD | ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "logica2", "Logica Diagnostic 2.0") - ROMX_LOAD("logica2.u6", 0x00000, 0x80000, CRC(8484f426) SHA1(ba10d16166b2e2d6177c979c99edf8462b21651e), ROM_GROUPWORD | ROM_BIOS(6)) - - ROM_REGION(0x800, "keyboard", 0) - ROM_LOAD("391079-01.u13", 0x000, 0x800, NO_DUMP) -ROM_END - -#define rom_a600n rom_a600 - -// Amiga 1200 -// -// Early models shipped with Kickstart 3.0, later versions with -// Kickstart 3.1. Keyboard controller is included on the motherboard, -// but was changed to a 68HC05 core. - -ROM_START( a1200 ) - ROM_REGION32_BE(0x80000, "kickstart", 0) - ROM_DEFAULT_BIOS("kick31") - ROM_SYSTEM_BIOS(0, "kick30", "Kickstart 3.0 (39.106)") - ROMX_LOAD("391523-01.u6a", 0x00000, 0x40000, CRC(c742a412) SHA1(999eb81c65dfd07a71ee19315d99c7eb858ab186), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD("391524-01.u6b", 0x00002, 0x40000, CRC(d55c6ec6) SHA1(3341108d3a402882b5ef9d3b242cbf3c8ab1a3e9), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "kick31", "Kickstart 3.1 (40.68)") - ROMX_LOAD("391773-01.u6a", 0x00000, 0x40000, CRC(08dbf275) SHA1(b8800f5f909298109ea69690b1b8523fa22ddb37), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - ROMX_LOAD("391774-01.u6b", 0x00002, 0x40000, CRC(16c07bf8) SHA1(90e331be1970b0e53f53a9b0390b51b59b3869c2), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "logica2", "Logica Diagnostic 2.0") - ROMX_LOAD("logica2.u6a", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - ROMX_LOAD("logica2.u6b", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - - ROM_REGION(0x4000, "keyboard", 0) - ROM_LOAD("391508-01.u13", 0x0000, 0x1040, NO_DUMP) // COMMODORE | 391508-01 REV0 | KEYBOARD MPU (MC68HC05C4AFN) - ROM_LOAD("391508-02.u13", 0x0000, 0x2f40, NO_DUMP) // Amiga Tech REV1 Keyboard MPU (MC68HC05C12FN) -ROM_END - -#define rom_a1200n rom_a1200 - -// Amiga 4000 -// -// Shipped with Kickstart 3.0, upgradable to Kickstart 3.1. - -ROM_START( a4000 ) - ROM_REGION32_BE(0x80000, "kickstart", 0) - ROM_DEFAULT_BIOS("kick30") - ROM_SYSTEM_BIOS(0, "kick30", "Kickstart 3.0 (39.106)") - ROMX_LOAD("391513-02.u175", 0x00000, 0x40000, CRC(36f64dd0) SHA1(196e9f3f9cad934e181c07da33083b1f0a3c702f), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD("391514-02.u176", 0x00002, 0x40000, CRC(17266a55) SHA1(42fbed3453d1f11ccbde89a9826f2d1175cca5cc), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "kick31-68", "Kickstart 3.1 (40.68)") - ROMX_LOAD("kick40068.u175", 0x00000, 0x40000, CRC(b2af34f8) SHA1(24e52b5efc02049517387ab7b1a1475fc540350e), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - ROMX_LOAD("kick40068.u176", 0x00002, 0x40000, CRC(e65636a3) SHA1(313c7cbda5779e56f19a41d34e760f517626d882), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "kick31-70", "Kickstart 3.1 (40.70)") - ROMX_LOAD("kick40070.u175", 0x00000, 0x40000, CRC(f9cbecc9) SHA1(138d8cb43b8312fe16d69070de607469b3d4078e), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - ROMX_LOAD("kick40070.u176", 0x00002, 0x40000, CRC(f8248355) SHA1(c23795479fae3910c185512ca268b82f1ae4fe05), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "logica2", "Logica Diagnostic 2.0") - ROMX_LOAD("logica2.u6a", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(4)) - ROMX_LOAD("logica2.u6b", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(4)) -ROM_END - -#define rom_a4000n rom_a4000 -#define rom_a400030 rom_a4000 -#define rom_a400030n rom_a4000 - -// Amiga 4000T -// -// Shipped with Kickstart 3.1 (40.70). - -ROM_START( a4000t ) - ROM_REGION32_BE(0x80000, "kickstart", 0) - ROM_DEFAULT_BIOS("kick31") - ROM_SYSTEM_BIOS(0, "kick31", "Kickstart 3.1 (40.70)") - ROMX_LOAD("391657-01.u175", 0x00000, 0x40000, CRC(0ca94f70) SHA1(b3806edacb3362fc16a154ce1eeec5bf5bc24789), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD("391658-01.u176", 0x00002, 0x40000, CRC(dfe03120) SHA1(cd7a706c431b04d87814d3a2d8b397100cf44c0c), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "logica2", "Logica Diagnostic 2.0") - ROMX_LOAD("logica2.u6a", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) - ROMX_LOAD("logica2.u6b", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(2)) -ROM_END - -#define rom_a4000tn rom_a4000t - -// Amiga CD32 -// -// Shipped with Kickstart 3.1 and additional software interleaved in a 1MB rom chip. - -ROM_START( cd32 ) - ROM_REGION32_BE(0x100000, "kickstart", 0) -// ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(a4fbc94a) SHA1(816ce6c5077875850c7d43452230a9ba3a2902db)) // todo: this is the real dump - ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(d3837ae4) SHA1(06807db3181637455f4d46582d9972afec8956d9)) -ROM_END - -#define rom_cd32n rom_cd32 - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// OCS Chipset -COMP( 1985, a1000, 0, 0, a1000, amiga, a1000_state, pal, "Commodore", "Amiga 1000 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1985, a1000n, a1000, 0, a1000n, amiga, a1000_state, ntsc, "Commodore", "Amiga 1000 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1987, a2000, 0, 0, a2000, amiga, a2000_state, pal, "Commodore", "Amiga 2000 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1987, a2000n, a2000, 0, a2000n, amiga, a2000_state, ntsc, "Commodore", "Amiga 2000 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1987, a500, 0, 0, a500, amiga, a500_state, pal, "Commodore", "Amiga 500 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1987, a500n, a500, 0, a500n, amiga, a500_state, ntsc, "Commodore", "Amiga 500 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1990, cdtv, 0, 0, cdtv, amiga, cdtv_state, pal, "Commodore", "CDTV (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1990, cdtvn, cdtv, 0, cdtvn, amiga, cdtv_state, ntsc, "Commodore", "CDTV (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) - -// ECS Chipset -COMP( 1990, a3000, 0, 0, a3000, amiga, a3000_state, pal, "Commodore", "Amiga 3000 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1990, a3000n, a3000, 0, a3000n, amiga, a3000_state, ntsc, "Commodore", "Amiga 3000 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1992, a500p, 0, 0, a500p, amiga, a500p_state, pal, "Commodore", "Amiga 500 Plus (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1992, a500pn, a500p, 0, a500pn, amiga, a500p_state, ntsc, "Commodore", "Amiga 500 Plus (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1992, a600, 0, 0, a600, amiga, a600_state, pal, "Commodore", "Amiga 600 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1992, a600n, a600, 0, a600n, amiga, a600_state, ntsc, "Commodore", "Amiga 600 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) - -// AGA Chipset -COMP( 1992, a1200, 0, 0, a1200, amiga, a1200_state, pal, "Commodore", "Amiga 1200 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1992, a1200n, a1200, 0, a1200n, amiga, a1200_state, ntsc, "Commodore", "Amiga 1200 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1992, a4000, 0, 0, a4000, amiga, a4000_state, pal, "Commodore", "Amiga 4000/040 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1992, a4000n, a4000, 0, a4000n, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000/040 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1993, a400030, a4000, 0, a400030, amiga, a4000_state, pal, "Commodore", "Amiga 4000/030 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1993, a400030n, a4000, 0, a400030n, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000/030 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1993, cd32, 0, 0, cd32, cd32, cd32_state, pal, "Commodore", "Amiga CD32 (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1993, cd32n, cd32, 0, cd32n, cd32, cd32_state, ntsc, "Commodore", "Amiga CD32 (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1994, a4000t, 0, 0, a4000t, amiga, a4000_state, pal, "Commodore", "Amiga 4000T (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1994, a4000tn, a4000t, 0, a4000tn, amiga, a4000_state, ntsc, "Commodore", "Amiga 4000T (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/ampro.c b/src/mess/drivers/ampro.c deleted file mode 100644 index 3cd31d47e29..00000000000 --- a/src/mess/drivers/ampro.c +++ /dev/null @@ -1,202 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Ampro Little Z80 Board - -2013-09-02 Skeleton driver. - -Chips: Z80A @4MHz, Z80CTC, Z80DART, WD1770/2, NCR5380. Crystal: 16 MHz - -This is a complete CP/M single-board computer that could be mounted -on top of a standard 13cm floppy drive. You needed to supply your own -power supply and serial terminal. - -The later versions included a SCSI chip (NCR5380) enabling the use -of a hard drive of up to 88MB. - -ToDo: -- (maybe) add scsi interface -- Add printer - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/wd_fdc.h" - - -class ampro_state : public driver_device -{ -public: - ampro_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_dart(*this, "z80dart") - , m_ctc (*this, "z80ctc") - , m_fdc (*this, "fdc") - , m_floppy0(*this, "fdc:0") - { } - - DECLARE_DRIVER_INIT(ampro); - DECLARE_MACHINE_RESET(ampro); - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); - DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE8_MEMBER(port00_w); - DECLARE_READ8_MEMBER(io_r); - DECLARE_WRITE8_MEMBER(io_w); -private: - required_device m_maincpu; - required_device m_dart; - required_device m_ctc; - required_device m_fdc; - required_device m_floppy0; -}; - -/* -d0..d3 Drive select 0-3 (we only emulate 1 drive) -d4 Side select 0=side0 -d5 /DDEN -d6 Banking 0=rom -d7 FDC master clock 0=8MHz 1=16MHz (for 20cm disks, not emulated) -*/ -WRITE8_MEMBER( ampro_state::port00_w ) -{ - membank("bankr0")->set_entry(BIT(data, 6)); - m_fdc->dden_w(BIT(data, 5)); - floppy_image_device *floppy = NULL; - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - m_fdc->set_floppy(floppy); - if (floppy) - floppy->ss_w(BIT(data, 4)); -} - -READ8_MEMBER( ampro_state::io_r ) -{ - if (offset < 0x40) - return m_ctc->read(space, offset>>4); - else - return m_dart->ba_cd_r(space, offset>>2); -} - -WRITE8_MEMBER( ampro_state::io_w ) -{ - if (offset < 0x40) - m_ctc->write(space, offset>>4, data); - else - m_dart->ba_cd_w(space, offset>>2, data); -} - -static ADDRESS_MAP_START(ampro_mem, AS_PROGRAM, 8, ampro_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x1000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ampro_io, AS_IO, 8, ampro_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(port00_w) // system - //AM_RANGE(0x01, 0x01) AM_WRITE(port01_w) // printer data - //AM_RANGE(0x02, 0x03) AM_WRITE(port02_w) // printer strobe - //AM_RANGE(0x20, 0x27) AM_READWRITE() // scsi chip - //AM_RANGE(0x28, 0x28) AM_WRITE(port28_w) // scsi control - //AM_RANGE(0x29, 0x29) AM_READ(port29_r) // ID port - AM_RANGE(0x40, 0x8f) AM_READWRITE(io_r,io_w) - AM_RANGE(0xc0, 0xc3) AM_DEVWRITE("fdc", wd1772_t, write) - AM_RANGE(0xc4, 0xc7) AM_DEVREAD("fdc", wd1772_t, read) -ADDRESS_MAP_END - -static const z80_daisy_config daisy_chain_intf[] = -{ - { "z80ctc" }, - { "z80dart" }, - { NULL } -}; - -// Baud rate generator. All inputs are 2MHz. -TIMER_DEVICE_CALLBACK_MEMBER( ampro_state::ctc_tick ) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); - m_ctc->trg1(1); - m_ctc->trg1(0); -} - -WRITE_LINE_MEMBER( ampro_state::ctc_z0_w ) -{ - m_dart->rxca_w(state); - m_dart->txca_w(state); -} - -static SLOT_INTERFACE_START( ampro_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -/* Input ports */ -static INPUT_PORTS_START( ampro ) -INPUT_PORTS_END - -MACHINE_RESET_MEMBER( ampro_state, ampro ) -{ - membank("bankr0")->set_entry(0); // point at rom - membank("bankw0")->set_entry(0); // always write to ram -} - -DRIVER_INIT_MEMBER( ampro_state, ampro ) -{ - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(1, &main[0x0000]); - membank("bankr0")->configure_entry(0, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); -} - -static MACHINE_CONFIG_START( ampro, ampro_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(ampro_mem) - MCFG_CPU_IO_MAP(ampro_io) - MCFG_CPU_CONFIG(daisy_chain_intf) - MCFG_MACHINE_RESET_OVERRIDE(ampro_state, ampro) - - /* Devices */ - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(ampro_state, ctc_z0_w)) // Z80DART Ch A, SIO Ch A - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w)) // SIO Ch B - - MCFG_Z80DART_ADD("z80dart", XTAL_16MHz / 4, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80dart", z80dart_device, rxa_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", ampro_state, ctc_tick, attotime::from_hz(XTAL_16MHz / 8)) - MCFG_WD1772_ADD("fdc", XTAL_16MHz / 2) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", ampro_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_SOFTWARE_LIST_ADD("flop_list", "ampro") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ampro ) - ROM_REGION( 0x11000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "mntr", "Monitor") - ROMX_LOAD( "mntr", 0x10000, 0x1000, CRC(d59d0909) SHA1(936410f414b1e71445253840eea0045545e4ff0b), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "boot", "Boot") - ROMX_LOAD( "boot", 0x10000, 0x1000, CRC(b3524046) SHA1(5466f7d28c1a04cfbf328095cb35ad1525e91f44), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "scsi", "SCSI Boot") - ROMX_LOAD( "scsi", 0x10000, 0x1000, CRC(8eb20e5d) SHA1(0ab1ff65cf6d3c1a713a8ac5c1ee4c662ac3da0c), ROM_BIOS(3)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, ampro, 0, 0, ampro, ampro, ampro_state, ampro, "Ampro", "Little Z80 Board", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/amstr_pc.c b/src/mess/drivers/amstr_pc.c deleted file mode 100644 index 8ba877cd182..00000000000 --- a/src/mess/drivers/amstr_pc.c +++ /dev/null @@ -1,659 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - drivers/amstr_pc.c - - Driver file for Amstrad PC1512 and related machines. - - PC-XT memory map - - 00000-9FFFF RAM - A0000-AFFFF NOP or videoram EGA/VGA - B0000-B7FFF videoram MDA, page #0 - B8000-BFFFF videoram CGA and/or MDA page #1, T1T mapped RAM - C0000-C7FFF NOP or ROM EGA/VGA - C8000-C9FFF ROM XT HDC #1 - CA000-CBFFF ROM XT HDC #2 - D0000-EFFFF NOP or 'adapter RAM' - F0000-FDFFF NOP or ROM Basic + other Extensions - FE000-FFFFF ROM - -Amstrad PC1640 -============== - -More information can be found at http://www.seasip.info/AmstradXT/1640tech/index.html - -***************************************************************************/ - -#include "emu.h" -#include "cpu/nec/nec.h" -#include "cpu/i86/i86.h" - -#include "machine/mc146818.h" -#include "includes/genpc.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" - -#include "machine/pckeybrd.h" -#include "machine/pc_lpt.h" - -class amstrad_pc_state : public driver_device -{ -public: - amstrad_pc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_mb(*this, "mb"), - m_keyboard(*this, "pc_keyboard"), - m_lpt1(*this, "lpt_1"), - m_lpt2(*this, "lpt_2") - { m_mouse.x =0; m_mouse.y=0;} - - required_device m_maincpu; - required_device m_mb; - required_device m_keyboard; - required_device m_lpt1; - required_device m_lpt2; - - DECLARE_READ8_MEMBER( pc1640_port60_r ); - DECLARE_WRITE8_MEMBER( pc1640_port60_w ); - - DECLARE_READ8_MEMBER( pc1640_mouse_x_r ); - DECLARE_READ8_MEMBER( pc1640_mouse_y_r ); - DECLARE_WRITE8_MEMBER( pc1640_mouse_x_w ); - DECLARE_WRITE8_MEMBER( pc1640_mouse_y_w ); - - DECLARE_READ8_MEMBER( pc200_port378_r ); - DECLARE_READ8_MEMBER( pc200_port278_r ); - DECLARE_READ8_MEMBER( pc1640_port378_r ); - DECLARE_READ8_MEMBER( pc1640_port3d0_r ); - DECLARE_READ8_MEMBER( pc1640_port4278_r ); - DECLARE_READ8_MEMBER( pc1640_port278_r ); - - DECLARE_DRIVER_INIT(pc1640); - - struct { - UINT8 x,y; //byte clipping needed - } m_mouse; - - // 64 system status register? - UINT8 m_port60; - UINT8 m_port61; - UINT8 m_port62; - UINT8 m_port65; - - int m_dipstate; -}; - -static ADDRESS_MAP_START( ppc512_map, AS_PROGRAM, 16, amstrad_pc_state ) - AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") - AM_RANGE(0x80000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ppc640_map, AS_PROGRAM, 16, amstrad_pc_state ) - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ppc512_io, AS_IO, 16, amstrad_pc_state ) - AM_RANGE(0x0060, 0x0065) AM_READWRITE8(pc1640_port60_r, pc1640_port60_w, 0xffff) - AM_RANGE(0x0070, 0x0071) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffff) - AM_RANGE(0x0078, 0x0079) AM_READWRITE8(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff) - AM_RANGE(0x007a, 0x007b) AM_READWRITE8(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff) - AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) - AM_RANGE(0x0278, 0x027b) AM_READ8(pc200_port278_r, 0xffff) AM_DEVWRITE8("lpt_2", pc_lpt_device, write, 0x00ff) - AM_RANGE(0x0378, 0x037b) AM_READ8(pc200_port378_r, 0xffff) AM_DEVWRITE8("lpt_1", pc_lpt_device, write, 0x00ff) - AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0x00ff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pc200_io, AS_IO, 16, amstrad_pc_state ) - AM_RANGE(0x0060, 0x0065) AM_READWRITE8(pc1640_port60_r, pc1640_port60_w, 0xffff) - AM_RANGE(0x0078, 0x0079) AM_READWRITE8(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff) - AM_RANGE(0x007a, 0x007b) AM_READWRITE8(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff) - AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) - AM_RANGE(0x0278, 0x027b) AM_READ8(pc200_port278_r, 0xffff) AM_DEVWRITE8("lpt_2", pc_lpt_device, write, 0x00ff) - AM_RANGE(0x0378, 0x037b) AM_READ8(pc200_port378_r, 0xffff) AM_DEVWRITE8("lpt_1", pc_lpt_device, write, 0x00ff) - AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0x00ff) -ADDRESS_MAP_END - - -/* pc20 (v2) - fc078 - fc102 color/mono selection - fc166 - fc1b4 - fd841 (output something) - ff17c (output something, read monitor type inputs) - fc212 - fc26c - fc2df - fc3fe - fc0f4 - fc432 - fc49f - fc514 - fc566 - fc5db - fc622 in 3de - -port 0379 read -port 03de write/read - */ - -/* pc1512 (v1) - fc1b5 - fc1f1 - fc264 - fc310 - fc319 - fc385 - fc436 - fc459 - fc4cb - fc557 - fc591 - fc624 - fc768 - fc818 - fc87d display amstrad .. - fca17 keyboard check - fca69 - fd680 - fd7f9 - fca7b !keyboard interrupt routine for this check - */ - - -/* pc1640 (v3) - bios power up self test - important addresses - - fc0c9 - fc0f2 - fc12e - fc193 - fc20e - fc2c1 - fc2d4 - - - fc375 - fc3ba - fc3e1 - fc412 - fc43c - fc47d - fc48f - fc51f - fc5a2 - fc5dd mouse - - fc1c0 - fc5fa - the following when language selection not 0 (test for presence of 0x80000..0x9ffff ram) - fc60e - fc667 - fc678 - fc6e5 - fc72e - fc78f - fc7cb ; coprocessor related - fc834 - feda6 no problem with disk inserted - - fca2a - - cmos ram 28 0 amstrad pc1512 integrated cga - cmos ram 23 dipswitches? -*/ - -/* test sequence in bios - write 00 to 65 - write 30 to 61 - read 62 and (0x10) - write 34 to 61 - read 62 and (0x0f) - return or of the 2 62 reads - - allows set of the original ibm pc "dipswitches"!!!! - - 66 write gives reset? -*/ - -/* mouse x counter at 0x78 (read- writable) - mouse y counter at 0x7a (read- writable) - - mouse button 1,2 keys - joystick (4 directions, 2 buttons) keys - these get value from cmos ram - 74 15 00 enter - 70 17 00 forward del - 77 1b 00 joystick button 1 - 78 19 00 joystick button 2 - - - 79 00 4d right - 7a 00 4b left - 7b 00 50 down - 7c 00 48 up - - 7e 00 01 mouse button left - 7d 01 01 mouse button right -*/ - -DRIVER_INIT_MEMBER(amstrad_pc_state,pc1640) -{ - address_space &io_space = m_maincpu->space( AS_IO ); - - io_space.install_read_handler(0x278, 0x27b, read8_delegate(FUNC(amstrad_pc_state::pc1640_port278_r),this), 0xffff); - io_space.install_read_handler(0x4278, 0x427b, read8_delegate(FUNC(amstrad_pc_state::pc1640_port4278_r),this), 0xffff); -} - -WRITE8_MEMBER( amstrad_pc_state::pc1640_port60_w ) -{ - switch (offset) { - case 1: - m_port61=data; - if (data==0x30) m_port62=(m_port65&0x10)>>4; - else if (data==0x34) m_port62=m_port65&0xf; - m_mb->m_pit8253->write_gate2(BIT(data, 0)); - m_mb->pc_speaker_set_spkrdata( data & 0x02 ); - m_keyboard->enable(data&0x40); - if(data & 0x80) - m_mb->m_pic8259->ir1_w(0); - - break; - case 4: - if (data&0x80) { - m_port60=data^0x8d; - } else { - m_port60=data; - } - break; - case 5: - // stores the configuration data for port 62 configuration dipswitch emulation - m_port65=data; - break; - } - - logerror("pc1640 write %.2x %.2x\n",offset,data); -} - - -READ8_MEMBER( amstrad_pc_state::pc1640_port60_r ) -{ - int data=0; - switch (offset) { - case 0: - if (m_port61&0x80) - data=m_port60; - else - data = m_keyboard->read(space, 0); - break; - - case 1: - data = m_port61; - break; - - case 2: - data = m_port62; - if (m_mb->m_pit_out2) - data |= 0x20; - break; - } - return data; -} - -READ8_MEMBER( amstrad_pc_state::pc200_port378_r ) -{ - UINT8 data = m_lpt1->read(space, offset); - - if (offset == 1) - data = (data & ~7) | (ioport("DSW0")->read() & 7); - if (offset == 2) - data = (data & ~0xe0) | (ioport("DSW0")->read() & 0xc0); - - return data; -} - -READ8_MEMBER( amstrad_pc_state::pc200_port278_r ) -{ - UINT8 data = m_lpt2->read(space, offset); - - if (offset == 1) - data = (data & ~7) | (ioport("DSW0")->read() & 7); - if (offset == 2) - data = (data & ~0xe0) | (ioport("DSW0")->read() & 0xc0); - - return data; -} - - -READ8_MEMBER( amstrad_pc_state::pc1640_port378_r ) -{ - UINT8 data = m_lpt1->read(space, offset); - - if (offset == 1) - data=(data & ~7) | (ioport("DSW0")->read() & 7); - if (offset == 2) - { - switch (m_dipstate) - { - case 0: - data = (data&~0xe0) | (ioport("DSW0")->read() & 0xe0); - break; - case 1: - data = (data&~0xe0) | ((ioport("DSW0")->read() & 0xe000)>>8); - break; - case 2: - data = (data&~0xe0) | ((ioport("DSW0")->read() & 0xe00)>>4); - break; - - } - } - return data; -} - -READ8_MEMBER( amstrad_pc_state::pc1640_port3d0_r ) -{ - if (offset==0xa) m_dipstate=0; - return space.read_byte(0x3d0+offset); -} - -READ8_MEMBER( amstrad_pc_state::pc1640_port4278_r ) -{ - if (offset==2) m_dipstate=1; - // read parallelport - return 0; -} - -READ8_MEMBER( amstrad_pc_state::pc1640_port278_r ) -{ - if ((offset==2)||(offset==0)) m_dipstate=2; - // read parallelport - return 0; -} - -READ8_MEMBER( amstrad_pc_state::pc1640_mouse_x_r ) -{ - return m_mouse.x - ioport("pc_mouse_x")->read(); -} - -READ8_MEMBER( amstrad_pc_state::pc1640_mouse_y_r ) -{ - return m_mouse.y - ioport("pc_mouse_y")->read(); -} - -WRITE8_MEMBER( amstrad_pc_state::pc1640_mouse_x_w ) -{ - m_mouse.x = data + ioport("pc_mouse_x")->read(); -} - -WRITE8_MEMBER( amstrad_pc_state::pc1640_mouse_y_w ) -{ - m_mouse.y = data + ioport("pc_mouse_y")->read(); -} - -static INPUT_PORTS_START( pc200 ) - PORT_START("DSW0") /* IN1 */ - PORT_DIPNAME( 0x07, 0x07, "Name/Language") - PORT_DIPSETTING( 0x00, "English/less checks" ) - PORT_DIPSETTING( 0x01, DEF_STR( Italian ) ) //prego attendere - PORT_DIPSETTING( 0x02, "V.g. v\xC3\xA4nta" ) - PORT_DIPSETTING( 0x03, "Vent et cjeblik" ) // seldom c - PORT_DIPSETTING( 0x04, DEF_STR( Spanish ) ) //Por favor - PORT_DIPSETTING( 0x05, DEF_STR( French ) ) //patientez - PORT_DIPSETTING( 0x06, DEF_STR( German ) ) // bitte warten - PORT_DIPSETTING( 0x07, DEF_STR( English ) ) // please wait - PORT_DIPNAME( 0x08, 0x00, "37a 0x40") - PORT_DIPSETTING( 0x00, "0x00" ) - PORT_DIPSETTING( 0x08, "0x08" ) -/* 2008-05 FP: This Dip Switch overlaps the next one. -Since pc200 is anyway NOT_WORKING, I comment out this one */ -/* PORT_DIPNAME( 0x10, 0x00, "37a 0x80") - PORT_DIPSETTING( 0x00, "0x00" ) - PORT_DIPSETTING( 0x10, "0x10" ) */ - PORT_DIPNAME( 0x30, 0x00, "Integrated Graphics Adapter") - PORT_DIPSETTING( 0x00, "CGA 1" ) - PORT_DIPSETTING( 0x10, "CGA 2" ) - PORT_DIPSETTING( 0x20, "external" ) - PORT_DIPSETTING( 0x30, "MDA" ) - PORT_DIPNAME( 0xc0, 0x80, "Startup Mode") - PORT_DIPSETTING( 0x00, "external Color 80 Columns" ) - PORT_DIPSETTING( 0x40, "Color 40 Columns" ) - PORT_DIPSETTING( 0x80, "Color 80 Columns" ) - PORT_DIPSETTING( 0xc0, DEF_STR( Mono ) ) - - PORT_START("DSW1") /* IN2 */ - PORT_BIT ( 0x80, 0x80, IPT_UNUSED ) // com 1 on motherboard - PORT_DIPNAME( 0x40, 0x40, "COM2: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x00, "COM3: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x10, 0x00, "COM4: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_BIT ( 0x04, 0x04, IPT_UNUSED ) // lpt 1 on motherboard - PORT_DIPNAME( 0x02, 0x00, "LPT3: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x01, 0x00, "Game port enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) - - PORT_START("DSW2") /* IN3 */ - PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) - PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ - PORT_BIT( 0x01, 0x01, IPT_UNUSED ) - - PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ -INPUT_PORTS_END - -// static const gfx_layout pc200_charlayout = -// { - // 8, 16, /* 8 x 16 characters */ - // 2048, /* 2048 characters */ - // 1, /* 1 bits per pixel */ - // { 0 }, /* no bitplanes */ - // /* x offsets */ - // { 0, 1, 2, 3, 4, 5, 6, 7 }, - // /* y offsets */ - // { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - // 8*16 /* every char takes 16 bytes */ -// }; - -// static GFXDECODE_START( pc200 ) - // GFXDECODE_ENTRY( "gfx1", 0x0000, pc200_charlayout, 3, 1 ) -// GFXDECODE_END - -// has it's own mouse -static MACHINE_CONFIG_FRAGMENT( cfg_com ) - MCFG_DEVICE_MODIFY("serport0") - MCFG_SLOT_DEFAULT_OPTION(NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pc200, amstrad_pc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 8000000) - MCFG_CPU_PROGRAM_MAP(ppc640_map) - MCFG_CPU_IO_MAP(pc200_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") - - MCFG_ISA8_SLOT_ADD("mb:isa", "aga", pc_isa8_cards, "aga_pc200", true) - MCFG_ISA8_SLOT_ADD("mb:isa", "fdc", pc_isa8_cards, "fdc_xt", true) - MCFG_ISA8_SLOT_ADD("mb:isa", "com", pc_isa8_cards, "com", true) - MCFG_SLOT_OPTION_MACHINE_CONFIG("com", cfg_com) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) - - /* printer */ - MCFG_DEVICE_ADD("lpt_0", PC_LPT, 0) - MCFG_PC_LPT_IRQ_HANDLER(DEVWRITELINE("mb:pic8259", pic8259_device, ir7_w)) - - MCFG_DEVICE_ADD("lpt_1", PC_LPT, 0) - MCFG_PC_LPT_IRQ_HANDLER(DEVWRITELINE("mb:pic8259", pic8259_device, ir7_w)) - - MCFG_DEVICE_ADD("lpt_2", PC_LPT, 0) - MCFG_PC_LPT_IRQ_HANDLER(DEVWRITELINE("mb:pic8259", pic8259_device, ir5_w)) - - MCFG_PC_JOY_ADD("pc_joy") - - MCFG_PC_KEYB_ADD("pc_keyboard", DEVWRITELINE("mb:pic8259", pic8259_device, ir1_w)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ppc512, pc200 ) - MCFG_DEVICE_REMOVE("maincpu") - - MCFG_CPU_ADD("maincpu", V30, 8000000) - MCFG_CPU_PROGRAM_MAP(ppc512_map) - MCFG_CPU_IO_MAP(ppc512_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_DEVICE_REMOVE("isa1") - MCFG_DEVICE_REMOVE("isa2") - - MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ppc640, ppc512 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(ppc640_map) -MACHINE_CONFIG_END - -/* -Sinclair PC200 ROMs (from a v1.2 PC200): - -40109.ic159 -- Character set, the same as in the 1.5 PC200. Label: - - AMSTRAD - 40109 - 8827 B - -40184.ic132 -- BIOS v1.2. -40185.ic129 Labels are: - - AMSTRAD AMSTRAD - 40184 40185 - V1.2:5EA8 V1.2:A058 -*/ -ROM_START( pc200 ) -// ROM_REGION(0x100000,"maincpu", 0) - ROM_REGION16_LE(0x100000,"maincpu", 0) - // special bios at 0xe0000 !? - ROM_SYSTEM_BIOS(0, "v15", "v1.5") - ROMX_LOAD("40185-2.ic129", 0xfc001, 0x2000, CRC(41302eb8) SHA1(8b4b2afea543b96b45d6a30365281decc15f2932), ROM_SKIP(1) | ROM_BIOS(1)) // v2 - ROMX_LOAD("40184-2.ic132", 0xfc000, 0x2000, CRC(71b84616) SHA1(4135102a491b25fc659d70b957e07649f3eacf24), ROM_SKIP(1) | ROM_BIOS(1)) // v2 - ROM_SYSTEM_BIOS(1, "v13", "v1.3") - ROMX_LOAD("40185v13.ic129", 0xfc001, 0x2000, CRC(f082f08e) SHA1(b332db419033588a7380bfecdf46104974347341), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("40184v13.ic132", 0xfc000, 0x2000, CRC(5daf6068) SHA1(93a2ccfb0e29c8f2c98f06c64bb0ea0b3acafb13), ROM_SKIP(1) | ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v12", "v1.2") - ROMX_LOAD("40185.ic129", 0xfc001, 0x2000, CRC(c2b4eeac) SHA1(f11015fadf0c16d86ce2c5047be3e6a4782044f7), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD("40184.ic132", 0xfc000, 0x2000, CRC(b22704a6) SHA1(dadd573db6cd34f339f2f0ae55b07537924c024a), ROM_SKIP(1) | ROM_BIOS(3)) - // also mapped to f0000, f4000, f8000 - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "40112.ic801", 0x000, 0x800, CRC(842a954c) SHA1(93ca6badf20e0215025fe109959eddead8c52f38) ) -ROM_END - - -ROM_START( pc20 ) -// ROM_REGION(0x100000,"maincpu", 0) - ROM_REGION16_LE(0x100000,"maincpu", 0) - - // special bios at 0xe0000 !? - // This is probably referring to a check for the Amstrad RP5-2 diagnostic - // card, which can be plugged into an Amstrad XT for troubleshooting purposes. - // - John Elliott - ROM_LOAD16_BYTE("pc20v2.0", 0xfc001, 0x2000, CRC(41302eb8) SHA1(8b4b2afea543b96b45d6a30365281decc15f2932)) // v2 - ROM_LOAD16_BYTE("pc20v2.1", 0xfc000, 0x2000, CRC(71b84616) SHA1(4135102a491b25fc659d70b957e07649f3eacf24)) // v2 - // also mapped to f0000, f4000, f8000 -ROM_END - - -ROM_START( ppc512 ) -// ROM_REGION(0x100000,"maincpu", 0) - ROM_REGION16_LE(0x100000,"maincpu", 0) - // special bios at 0xe0000 !? - ROM_LOAD16_BYTE("40107.v1", 0xfc000, 0x2000, CRC(4e37e769) SHA1(88be3d3375ec3b0a7041dbcea225b197e50d4bfe)) // v1.9 - ROM_LOAD16_BYTE("40108.v1", 0xfc001, 0x2000, CRC(4f0302d9) SHA1(e4d69ca98c3b98f3705a2902b16746360043f039)) // v1.9 - // also mapped to f0000, f4000, f8000 - ROM_REGION( 0x800, "keyboard", 0 ) // PPC512 / PPC640 / PC200 102-key keyboard - ROM_LOAD( "40112.ic801", 0x000, 0x800, CRC(842a954c) SHA1(93ca6badf20e0215025fe109959eddead8c52f38) ) -ROM_END - - -ROM_START( ppc640 ) -// ROM_REGION(0x100000,"maincpu", 0) - ROM_REGION16_LE(0x100000,"maincpu", 0) - // special bios at 0xe0000 !? - ROM_LOAD16_BYTE("40107.v2", 0xfc000, 0x2000, CRC(0785b63e) SHA1(4dbde6b9e9500298bb6241a8daefd85927f1ad28)) // v2.1 - ROM_LOAD16_BYTE("40108.v2", 0xfc001, 0x2000, CRC(5351cf8c) SHA1(b4dbf11b39378ab4afd2107d3fe54a99fffdedeb)) // v2.1 - // also mapped to f0000, f4000, f8000 - ROM_REGION(0x2000,"subcpu", 0) - ROM_LOAD("40135.ic192", 0x00000, 0x2000, CRC(75d99199) SHA1(a76d39fda3d5140e1fb9ce70fcddbdfb8f891dc6)) - - ROM_REGION( 0x800, "keyboard", 0 ) // PPC512 / PPC640 / PC200 102-key keyboard - ROM_LOAD( "40112.ic801", 0x000, 0x800, CRC(842a954c) SHA1(93ca6badf20e0215025fe109959eddead8c52f38) ) -ROM_END - - -ROM_START( pc2086 ) - ROM_REGION16_LE( 0x100000, "maincpu", 0 ) - ROM_LOAD( "40186.ic171", 0xc0000, 0x8000, CRC(959f00ba) SHA1(5df1efe4203cd076292a7713bd7ebd1196dca577) ) - ROM_LOAD16_BYTE( "40179.ic129", 0xfc000, 0x2000, CRC(003605e4) SHA1(b882e97ee81b9ba0e7d969c63da3f2052f23b4b9) ) - ROM_LOAD16_BYTE( "40180.ic132", 0xfc001, 0x2000, CRC(28ee5e58) SHA1(93e045609466fcec74e2bb72578bb7405281cf7b) ) - - ROM_REGION( 0x800, "keyboard", 0 ) // PC2086 / PC3086 102-key keyboard - ROM_LOAD( "40178.ic801", 0x000, 0x800, CRC(f72f1c2e) SHA1(34897e78b3d10f96b36d81778e97c4a9a1b8618b) ) -ROM_END - - -ROM_START( pc3086 ) - ROM_REGION16_LE( 0x100000, "maincpu", 0 ) - ROM_LOAD( "c000.bin", 0xc0000, 0x8000, CRC(5a6c38e9) SHA1(382d2028e0dc5515a68843829563ce29018edb08) ) - ROM_LOAD( "c800.bin", 0xc8000, 0x2000, CRC(3329c6d5) SHA1(982e852278185d69acde47a4f3942bc09ed76777) ) - ROM_LOAD( "fc00.bin", 0xfc000, 0x4000, CRC(b5630753) SHA1(98c344831cc4dc59ebb39bbb1961964a8d39fe20) ) - - ROM_REGION( 0x800, "keyboard", 0 ) // PC2086 / PC3086 102-key keyboard - ROM_LOAD( "40178.ic801", 0x000, 0x800, CRC(f72f1c2e) SHA1(34897e78b3d10f96b36d81778e97c4a9a1b8618b) ) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1987, ppc512, ibm5150, 0, ppc512, pc200, driver_device, 0, "Amstrad plc", "Amstrad PPC512", MACHINE_NOT_WORKING) -COMP( 1987, ppc640, ibm5150, 0, ppc640, pc200, driver_device, 0, "Amstrad plc", "Amstrad PPC640", MACHINE_NOT_WORKING) -COMP( 1988, pc20, ibm5150, 0, pc200, pc200, driver_device, 0, "Amstrad plc", "Amstrad PC20" , MACHINE_NOT_WORKING) -COMP( 1988, pc200, ibm5150, 0, pc200, pc200, driver_device, 0, "Sinclair Research Ltd", "PC200 Professional Series", MACHINE_NOT_WORKING) -COMP( 1988, pc2086, ibm5150, 0, pc200, pc200, driver_device, 0, "Amstrad plc", "Amstrad PC2086", MACHINE_NOT_WORKING ) -COMP( 1990, pc3086, ibm5150, 0, pc200, pc200, driver_device, 0, "Amstrad plc", "Amstrad PC3086", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/amstrad.c b/src/mess/drivers/amstrad.c deleted file mode 100644 index 8e88e135151..00000000000 --- a/src/mess/drivers/amstrad.c +++ /dev/null @@ -1,1287 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Barry Rodewald -/****************************************************************************** - - amstrad.c - system driver - - Amstrad Hardware: - - 8255 connected to AY-3-8912 sound generator, - keyboard, cassette, printer, crtc vsync output, - and some PCB links - - 6845 (either HD6845S, UM6845R or M6845) crtc graphics display - controller - - UPD765 floppy disc controller (CPC664,CPC6128) - - Z80 CPU running at 4 MHz (slowed by wait states on memory - access) - - custom ASIC "Gate Array" controlling rom paging, ram paging, - current display mode and colour palette - - Kevin Thacker [MESS driver] - - May-June 2004 - Yoann Courtois (aka Papagayo/ex GMC/ex PARADOX) - rewriting some code with hardware documentation from http://www.cepece.info/amstrad/ - - June 2006 - Very preliminary CPC+ support. CPR cart image handling, secondary ROM register, ASIC unlock detection - Supported: - 12-bit palette, - 12-bit hardware sprites (largely works from what I've seen, some games have display issues), - Programmable Raster Interrupt (seems to work), - Split screen registers, - Soft scroll registers (only byte-by-byre horizontally for now), - Analogue controls (may well be completely wrong, I have no idea on how these should work), - Vectored interrupts for Z80 interrupt mode 2 (used by Pang), - DMA sound channels (may still be some issues, noticeable in Navy Seals and Copter 271) - 04/07/06: Added interrupt vector support for IM 2. - Added soft scroll register implementation. Vertical adjustments are a bit shaky. - 05/07/06: Fixed hardware sprite offsets - 14/07/06: Added basic analogue control support. - 04/08/06: Fixed PRI and Split screen scanline offsets (based on code in Arnold ;)) - Implemented DMA sound channels - 06/08/06: Fixed CRTC palette if the ASIC was re-locked after already being unlocked and used. - This fixes Klax, which is now playable. - 08/08/06: Fixed up vertical soft scroll, now we just need to get a finer detail on horizontal soft scroll - (Only works on a byte level for now) - Fixed DMA pause function when the prescaler is set to 0. - - Tested with the Arnold 5 Diagnostic Cartridge. Mostly works fine, but the soft scroll test is - noticeably wrong. - - Known issues with some games (as at 12/01/08): - Robocop 2: playable, but sprites should be cut off outside the playing area (partial updates should be able to fix this). - Navy Seals: Playable, but sound effects cut out at times (probably DMA related). - Dick Tracy: Sprite visibility issues - Switchblade: has some slowdown when numerous enemies are on screen (normal?) - Epyx World of Sports: doesn't start at all. - Tennis Cup II: controls don't seem to work. - Fire and Forget II: playable, but the top half of the screen flickers - Crazy Cars II: playable, with slight shaking of horizon - No Exit: Display is wrong, but usable, uses demo-like techniques. - - - January 2008 - added preliminary Aleste 520EX support - The Aleste 520EX is a Russian clone of the CPC6128, that expands on existing video modes, and can run MSX-DOS. - It also adds an MC146818 RTC/NVRAM, an Intel 8253 timer, and the "Magic Sound" board, a 4-channel DMA-based - sample player. Also includes a software emulation of the MSX2 VDP, used in the ports of MSX games. - - Known issues: - - The RTC doesn't always update in setup. It expects bit 4 of register C (Update End Interrupt) to be high. - - Title screens appear then disappear quickly (probably because the 8253 hasn't been plugged in yet). - - Some video modes display wrong (still needs some work here). - - Vampire Killer crashes after collecting a certain key part way through stage 1. - - Magic Sound isn't emulated. - - - January 2009 - changed drivers to use the mc6845 device implementation - To get rid of duplicated code the drivers have been changed to use the new mc6845 device - implementation. As a result the (runtime) selection of CRTC type has been removed. - - July 2011 - added basic expansion port interface, with support for both the Amstrad SSA-1 and DK'Tronics - speech synthesisers. - - -Some bugs left : ----------------- - - CRTC all type support (0,1,2,3,4) ? - - Gate Array and CRTC aren't synchronised. (The Gate Array can change the color every microseconds?) So the multi-rasters in one line aren't supported (see yao demo p007's part)! - - Implement full Asic for CPC+ emulation. Soft scroll is rather dodgy. - - The KC Compact should not reuse the gate array functionality. Instead z8536 support should be added. (bug #42) - - ******************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "includes/amstrad.h" - -/* Components */ -#include "machine/i8255.h" /* for 8255 ppi */ -#include "cpu/z80/z80.h" /* for cycle tables */ -#include "video/mc6845.h" /* CRTC */ -#include "machine/upd765.h" /* for floppy disc controller */ -#include "sound/ay8910.h" -#include "sound/wave.h" -#include "machine/mc146818.h" /* Aleste RTC */ -#include "bus/centronics/ctronics.h" - -/* Devices */ -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "formats/tzx_cas.h" -#include "formats/msx_dsk.h" - -#include "machine/ram.h" - -#define MANUFACTURER_NAME 0x07 -#define TV_REFRESH_RATE 0x10 - -#define SYSTEM_CPC 0 -#define SYSTEM_PLUS 1 -#define SYSTEM_GX4000 2 - - -/* Memory is banked in 16k blocks. However, the multiface -pages the memory in 8k blocks! The ROM can -be paged into bank 0 and bank 3. */ -static ADDRESS_MAP_START(amstrad_mem, AS_PROGRAM, 8, amstrad_state ) - AM_RANGE(0x00000, 0x01fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank9") - AM_RANGE(0x02000, 0x03fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank10") - AM_RANGE(0x04000, 0x05fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank11") - AM_RANGE(0x06000, 0x07fff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank12") - AM_RANGE(0x08000, 0x09fff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank13") - AM_RANGE(0x0a000, 0x0bfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank14") - AM_RANGE(0x0c000, 0x0dfff) AM_READ_BANK("bank7") AM_WRITE_BANK("bank15") - AM_RANGE(0x0e000, 0x0ffff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank16") -ADDRESS_MAP_END - -/* I've handled the I/O ports in this way, because the ports -are not fully decoded by the CPC h/w. Doing it this way means -I can decode it myself and a lot of software should work */ -static ADDRESS_MAP_START(amstrad_io, AS_IO, 8, amstrad_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(amstrad_cpc_io_r, amstrad_cpc_io_w ) -ADDRESS_MAP_END - - -/************************************* - * - * Input ports - * - *************************************/ - -static INPUT_PORTS_START( amstrad_keyboard ) - PORT_START("kbrow.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - - PORT_START("kbrow.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - - PORT_START("kbrow.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('\\') PORT_CHAR('`') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("kbrow.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 \xC2\xA3") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR(0xa3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xC2\xA6") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('|') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("kbrow.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("kbrow.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - - PORT_START("kbrow.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("kbrow.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("kbrow.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_CHAR('~') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("kbrow.9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) -/* The bit for the third button is officially undocumented: Amstrad joysticks actually - use only two buttons. The only device that reads this bit is the AMX mouse, which uses - dedicated hardware to connect to the joystick port. -*/ -// PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(8) - -/* Second joystick port need to be defined: the second joystick is daisy-chained on the back of the first one - Joystick 2 is mapped to keyboard line 6. */ - -/* The CPC supports at least two different brands of lightpens, probably connected to the expansion port */ - -INPUT_PORTS_END - - -/* Steph 2000-10-27 I remapped the 'Machine Name' Dip Switches (easier to understand) */ -INPUT_CHANGED_MEMBER(amstrad_state::cpc_monitor_changed) -{ - if ( (m_io_green_display->read()) & 0x01 ) - { - PALETTE_INIT_NAME( amstrad_cpc_green )(m_palette); - } - else - { - PALETTE_INIT_NAME( amstrad_cpc )(m_palette); - } -} - - -static INPUT_PORTS_START( crtc_links ) - -/* the following are solder links on the circuit board. The links are open or closed when the - * PCB is made, and are set depending on which country the Amstrad system was to go to - * (reference: http://amstrad.cpc.free.fr/article.php?sid=26) - -lk1 lk2 lk3 Manufacturer Name (CPC and CPC+ only): - -0 0 0 Isp -0 0 1 Triumph (UK?) -0 1 0 Saisho (UK: Saisho is Dixons brand name for their electronic goods) -0 1 1 Solavox -1 0 0 Awa (Australia) -1 0 1 Schneider (Germany) -1 1 0 Orion (Japan?) -1 1 1 Amstrad (UK) - -lk4 Frequency -0 60 Hz -1 50 Hz -*/ - PORT_START("solder_links") - PORT_CONFNAME(0x07, 0x07, "Manufacturer Name") - PORT_CONFSETTING(0x00, "Isp") - PORT_CONFSETTING(0x01, "Triumph") - PORT_CONFSETTING(0x02, "Saisho") - PORT_CONFSETTING(0x03, "Solavox") - PORT_CONFSETTING(0x04, "Awa") - PORT_CONFSETTING(0x05, "Schneider") - PORT_CONFSETTING(0x06, "Orion") - PORT_CONFSETTING(0x07, "Amstrad") - PORT_CONFNAME(0x10, 0x10, "TV Refresh Rate") - PORT_CONFSETTING(0x00, "60 Hz") - PORT_CONFSETTING(0x10, "50 Hz") - -/* Part number Manufacturer Type number - UM6845 UMC 0 - HD6845S Hitachi 0 - UM6845R UMC 1 - MC6845 Motorola 2 - AMS40489 Amstrad 3 - Pre-ASIC??? Amstrad? 4 In the "cost-down" CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often referred to as the "Pre-ASIC" because it preceded the CPC+ ASIC -As far as I know, the KC compact used HD6845S only. -*/ -// PORT_START("crtc") -// PORT_CONFNAME( 0xFF, M6845_PERSONALITY_UM6845R, "CRTC Type") -// PORT_CONFSETTING(M6845_PERSONALITY_UM6845, "Type 0 - UM6845") -// PORT_CONFSETTING(M6845_PERSONALITY_HD6845S, "Type 0 - HD6845S") -// PORT_CONFSETTING(M6845_PERSONALITY_UM6845R, "Type 1 - UM6845R") -// PORT_CONFSETTING(M6845_PERSONALITY_GENUINE, "Type 2 - MC6845") -// PORT_CONFSETTING(M6845_PERSONALITY_AMS40489, "Type 3 - AMS40489") -// PORT_CONFSETTING(M6845_PERSONALITY_PREASIC, "Type 4 - Pre-ASIC") - - PORT_START("green_display") - PORT_CONFNAME( 0x01, 0x00, "Monitor" ) PORT_CHANGED_MEMBER(DEVICE_SELF, amstrad_state, cpc_monitor_changed, 0 ) - PORT_CONFSETTING(0x00, "CTM640 Colour Monitor" ) - PORT_CONFSETTING(0x01, "GT64 Green Monitor" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START( amx_mouse ) - PORT_START("mouse_input1") - PORT_BIT(0xff , 0, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) - - PORT_START("mouse_input2") - PORT_BIT(0xff , 0, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) - - PORT_START("mouse_input3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON5) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON6) PORT_NAME("Middle mouse button") PORT_CODE(MOUSECODE_BUTTON3) PORT_CONDITION("controller_type", 0x01, EQUALS, 0x01) - - PORT_START("controller_type") - PORT_CONFNAME( 0x03, 0x00, "Joystick port device" ) - PORT_CONFSETTING(0x00, "2-button Joystick" ) - PORT_CONFSETTING(0x01, "AMX mouse interface" ) - PORT_CONFSETTING(0x02, "Nothing" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START( cpc464 ) - PORT_INCLUDE(amstrad_keyboard) - PORT_INCLUDE(crtc_links) - PORT_INCLUDE(amx_mouse) -INPUT_PORTS_END - - -static INPUT_PORTS_START( cpc664 ) - PORT_INCLUDE(amstrad_keyboard) - - PORT_MODIFY("kbrow.0") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - - PORT_MODIFY("kbrow.1") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - - PORT_MODIFY("kbrow.2") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - - PORT_INCLUDE(crtc_links) - PORT_INCLUDE(amx_mouse) -INPUT_PORTS_END - - -static INPUT_PORTS_START( cpc6128 ) - PORT_INCLUDE(amstrad_keyboard) - - PORT_MODIFY("kbrow.0") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - - PORT_MODIFY("kbrow.1") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - - PORT_MODIFY("kbrow.2") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('\\') PORT_CHAR('`') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_INCLUDE(crtc_links) - PORT_INCLUDE(amx_mouse) -INPUT_PORTS_END - - -/* This CPC6128 sold in France has the AZERTY layout. Reference: http://amstrad.cpc.free.fr/amstrad/cpc6128.htm */ -static INPUT_PORTS_START( cpc6128f ) - PORT_INCLUDE(amstrad_keyboard) - - PORT_MODIFY("kbrow.0") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - - PORT_MODIFY("kbrow.1") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - - PORT_MODIFY("kbrow.2") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('$') PORT_CHAR('@') PORT_CHAR('\\') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_MODIFY("kbrow.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR('[') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ \xC2\xA6") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xB9 %") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xF9) PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') - - PORT_MODIFY("kbrow.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA0 0") PORT_CODE(KEYCODE_0) PORT_CHAR(0xE0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA7 9") PORT_CODE(KEYCODE_9) PORT_CHAR(0xE7) PORT_CHAR('9') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR(',') PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(';') PORT_CHAR('.') - - PORT_MODIFY("kbrow.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('!') PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA9 7") PORT_CODE(KEYCODE_7) PORT_CHAR(0xE8) PORT_CHAR('7') - - PORT_MODIFY("kbrow.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR(']') PORT_CHAR('6') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') - - PORT_MODIFY("kbrow.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('\"') PORT_CHAR('3') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_MODIFY("kbrow.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('&') PORT_CHAR('1') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA9 2 ~") PORT_CODE(KEYCODE_2) PORT_CHAR(0xE9) PORT_CHAR('2') PORT_CHAR('~') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('w') PORT_CHAR('W') - - PORT_INCLUDE(crtc_links) - PORT_INCLUDE(amx_mouse) -INPUT_PORTS_END - -static INPUT_PORTS_START( cpc6128s ) - PORT_INCLUDE(cpc6128) - - PORT_MODIFY("kbrow.2") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x9C") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00DC) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x89") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00E9) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('/') PORT_CHAR('?') - - PORT_MODIFY("kbrow.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x85") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00C5) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x84") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x96") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - - PORT_MODIFY("kbrow.4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') -INPUT_PORTS_END - -/* - * The BIOS of the KC Compact would be able to recognize the keypresses - * generated by F5-F9. Unfortunately these keys are not present on the - * keyboard! Reference: http://www.cepece.info/amstrad/docs/kcc/kcc01.jpg - * - */ -static INPUT_PORTS_START( kccomp ) - PORT_INCLUDE(amstrad_keyboard) - - PORT_MODIFY("kbrow.0") - PORT_BIT(0x08, 0x08, IPT_UNUSED) - PORT_BIT(0x10, 0x10, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - - PORT_MODIFY("kbrow.1") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x04, 0x04, IPT_UNUSED) - PORT_BIT(0x08, 0x08, IPT_UNUSED) - PORT_BIT(0x10, 0x10, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - - PORT_MODIFY("kbrow.2") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('\\') PORT_CHAR('`') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_INCLUDE(crtc_links) - PORT_INCLUDE(amx_mouse) -INPUT_PORTS_END - - -static INPUT_PORTS_START( plus ) - PORT_INCLUDE(cpc664) - - /* The CPC+ and GX4000 adds support for analogue controllers. - Up to two joysticks or four paddles can be used, although the ASIC supports twice that. - Read at &6808-&680f in ASIC RAM - I am unsure if these are even close to correct. - - UPDATE: the analog port supports (probably with an Y-cable) up to two analog joysticks - with two buttons each or four paddles with one button each. The CPC+/GX4000 have also an - AUX port which supports a lightgun/lightpen with two buttons. - Since all these devices have their dedicated connector, two digital joystick, two analog joysticks - and one lightgun can be connected at the same moment. - - The connectors' description for both CPCs and CPC+'s can be found at http://www.hardwarebook.info/Category:Computer */ - - PORT_START("analog.0") - PORT_BIT(0x3f , 0, IPT_AD_STICK_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(1) - - PORT_START("analog.1") - PORT_BIT(0x3f , 0, IPT_AD_STICK_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(1) - - PORT_START("analog.2") - PORT_BIT(0x3f , 0, IPT_AD_STICK_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(2) - - PORT_START("analog.3") - PORT_BIT(0x3f , 0, IPT_AD_STICK_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(2) - -// Not used, but are here for completeness - PORT_START("analog.4") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(3) - - PORT_START("analog.5") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(3) - - PORT_START("analog.6") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(4) - - PORT_START("analog.7") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(4) -INPUT_PORTS_END - - -static INPUT_PORTS_START( gx4000 ) - - // The GX4000 is a console, so no keyboard access other than the joysticks. - PORT_START("kbrow.0") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.1") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.2") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.3") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.4") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.5") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.6") // Joystick 2 - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.7") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.8") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("kbrow.9") // Joystick 1 - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE(crtc_links) // included to keep the driver happy - - PORT_START("analog.0") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(1) - - PORT_START("analog.1") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(1) - - PORT_START("analog.2") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(2) - - PORT_START("analog.3") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(2) - -// Not used, but are here for completeness - PORT_START("analog.4") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(3) - - PORT_START("analog.5") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(3) - - PORT_START("analog.6") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(4) - - PORT_START("analog.7") - PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_PLAYER(4) -INPUT_PORTS_END - - -static INPUT_PORTS_START( aleste ) - PORT_INCLUDE(amstrad_keyboard) - - PORT_MODIFY( "kbrow.9" ) - /* Documentation marks this input as "R/L", it's purpose is unknown - I can't even find it on the keyboard */ - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R L") PORT_CODE(KEYCODE_PGUP) - - PORT_START( "kbrow.10" ) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4 F9") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F10") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HELP") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Funny looking Russian symbol") PORT_CODE(KEYCODE_END) - - PORT_INCLUDE(crtc_links) - PORT_INCLUDE(amx_mouse) -INPUT_PORTS_END - - -#if 0 - -static const gfx_layout asic_sprite_layout = -{ - 16,16, - 16, - 4, - { 4,5,6,7 }, - { 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120 }, - { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 }, - 16*16*8 -}; - -static GFXDECODE_START( asic_sprite ) - GFXDECODE_ENTRY( "user1", 0, asic_sprite_layout, 32, 1 ) -GFXDECODE_END -#endif - - - -/************************************* - * - * Machine drivers - * - *************************************/ - -/* actual clock to CPU is 4 MHz, but it is slowed by memory -accessess. A HALT is used for every memory access by the CPU. -This stretches the timing for opcodes, and gives an effective -speed of 3.8 MHz */ - -/* Info about structures below: - - The Amstrad has a CPU running at 4 MHz, slowed with wait states. - I have measured 19968 NOP instructions per frame, which gives, - 50.08 fps as the tv refresh rate. - - There are 312 lines on a PAL screen, giving 64us per line. - - There is only 50us visible per line, and 35*8 lines visible on the screen. - - This is the reason why the displayed area is not the same as the visible area. - */ - - -static SLOT_INTERFACE_START( amstrad_floppies ) - SLOT_INTERFACE( "3ssdd", FLOPPY_3_SSDD ) - SLOT_INTERFACE( "35ssdd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START( aleste_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( amstrad_state::aleste_floppy_formats ) - FLOPPY_MSX_FORMAT -FLOPPY_FORMATS_END - -static MACHINE_CONFIG_FRAGMENT( cpcplus_cartslot ) - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "gx4000_cart") - MCFG_GENERIC_EXTENSIONS("bin,cpr") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(amstrad_state, amstrad_plus_cartridge) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "gx4000") -MACHINE_CONFIG_END - -SLOT_INTERFACE_START(cpc464_exp_cards) - SLOT_INTERFACE("ddi1", CPC_DDI1) - SLOT_INTERFACE("ssa1", CPC_SSA1) - SLOT_INTERFACE("dkspeech", CPC_DKSPEECH) - SLOT_INTERFACE("rom", CPC_ROM) - SLOT_INTERFACE("multiface2", CPC_MFACE2) - SLOT_INTERFACE("pds", CPC_PDS) - SLOT_INTERFACE("rs232", CPC_RS232) - SLOT_INTERFACE("amsrs232", CPC_RS232_AMS) - SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) - SLOT_INTERFACE("amdrum", CPC_AMDRUM) - SLOT_INTERFACE("playcity", CPC_PLAYCITY) - SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) - SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) - SLOT_INTERFACE("hd20", CPC_HD20) -SLOT_INTERFACE_END - -SLOT_INTERFACE_START(cpc_exp_cards) - SLOT_INTERFACE("ssa1", CPC_SSA1) - SLOT_INTERFACE("dkspeech", CPC_DKSPEECH) - SLOT_INTERFACE("rom", CPC_ROM) - SLOT_INTERFACE("multiface2", CPC_MFACE2) - SLOT_INTERFACE("pds", CPC_PDS) - SLOT_INTERFACE("rs232", CPC_RS232) - SLOT_INTERFACE("amsrs232", CPC_RS232_AMS) - SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) - SLOT_INTERFACE("amdrum", CPC_AMDRUM) - SLOT_INTERFACE("playcity", CPC_PLAYCITY) - SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) - SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) - SLOT_INTERFACE("hd20", CPC_HD20) -SLOT_INTERFACE_END - -SLOT_INTERFACE_START(cpcplus_exp_cards) - SLOT_INTERFACE("ssa1", CPC_SSA1) - SLOT_INTERFACE("dkspeech", CPC_DKSPEECH) - SLOT_INTERFACE("rom", CPC_ROM) - SLOT_INTERFACE("pds", CPC_PDS) - SLOT_INTERFACE("rs232", CPC_RS232) - SLOT_INTERFACE("amsrs232", CPC_RS232_AMS) - SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) - SLOT_INTERFACE("amdrum", CPC_AMDRUM) - SLOT_INTERFACE("playcity", CPC_PLAYCITY) - SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) - SLOT_INTERFACE("hd20", CPC_HD20) -SLOT_INTERFACE_END - -SLOT_INTERFACE_START(aleste_exp_cards) - SLOT_INTERFACE("ssa1", CPC_SSA1) - SLOT_INTERFACE("dkspeech", CPC_DKSPEECH) - SLOT_INTERFACE("rom", CPC_ROM) - SLOT_INTERFACE("multiface2", CPC_MFACE2) - SLOT_INTERFACE("pds", CPC_PDS) - SLOT_INTERFACE("rs232", CPC_RS232) - SLOT_INTERFACE("amsrs232", CPC_RS232_AMS) - SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) - SLOT_INTERFACE("amdrum", CPC_AMDRUM) - SLOT_INTERFACE("playcity", CPC_PLAYCITY) - SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) - SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) - SLOT_INTERFACE("hd20", CPC_HD20) - SLOT_INTERFACE("magicsound", AL_MAGICSOUND) -SLOT_INTERFACE_END - -SLOT_INTERFACE_START(amstrad_centronics_devices) - SLOT_INTERFACE("pl80", COMX_PL80) - SLOT_INTERFACE("ex800", EPSON_EX800) - SLOT_INTERFACE("lx800", EPSON_LX800) - SLOT_INTERFACE("lx810l", EPSON_LX810L) - SLOT_INTERFACE("ap2000", EPSON_AP2000) - SLOT_INTERFACE("printer", CENTRONICS_PRINTER) - SLOT_INTERFACE("digiblst", CENTRONICS_DIGIBLASTER) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( amstrad_base, amstrad_state ) - /* Machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(amstrad_mem) - MCFG_CPU_IO_MAP(amstrad_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(amstrad_state,amstrad_cpu_acknowledge_int) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(amstrad_state, amstrad ) - MCFG_MACHINE_RESET_OVERRIDE(amstrad_state, amstrad ) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(amstrad_state, amstrad_ppi_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(amstrad_state, amstrad_ppi_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(amstrad_state, amstrad_ppi_portb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(amstrad_state, amstrad_ppi_portc_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( XTAL_16MHz, 1024, 32, 32 + 640 + 64, 312, 56 + 15, 200 + 15 ) - MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad) - MCFG_SCREEN_VBLANK_DRIVER(amstrad_state, screen_eof_amstrad) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 32) - MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_cpc) - - MCFG_MC6845_ADD("mc6845", MC6845, NULL, XTAL_16MHz / 16) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(16) - MCFG_MC6845_OUT_DE_CB(WRITELINE(amstrad_state, amstrad_de_changed)) - MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(amstrad_state, amstrad_hsync_changed)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(amstrad_state, amstrad_vsync_changed)) - MCFG_MC6845_OUT_CUR_CB(DEVWRITELINE("exp", cpc_expansion_slot_device, cursor_w)) - - MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay", AY8912, XTAL_16MHz / 16) - MCFG_AY8910_PORT_A_READ_CB(READ8(amstrad_state, amstrad_psg_porta_read)) /* portA read */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", amstrad_centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amstrad_state, write_centronics_busy)) - - /* snapshot */ - MCFG_SNAPSHOT_ADD("snapshot", amstrad_state, amstrad, "sna", 0) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(cdt_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("cpc_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","cpc_cass") - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( cpc464, amstrad_base ) - MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(cpc464_exp_cards, NULL, false) - MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS - MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("128K,320K,576K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( cpc664, amstrad_base ) - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", amstrad_floppies, "3ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", amstrad_floppies, "35ssdd", floppy_image_device::default_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","cpc_flop") - - MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(cpc_exp_cards, NULL, false) - MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS - MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("128K,320K,576K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( cpc6128, amstrad_base ) - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", amstrad_floppies, "3ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", amstrad_floppies, "35ssdd", floppy_image_device::default_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","cpc_flop") - - MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(cpc_exp_cards, NULL, false) - MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS - MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("320K,576K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( kccomp, cpc6128 ) - MCFG_MACHINE_START_OVERRIDE(amstrad_state,kccomp) - MCFG_MACHINE_RESET_OVERRIDE(amstrad_state,kccomp) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(amstrad_state,kccomp) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( cpcplus, amstrad_state ) - /* Machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_40MHz / 10) - MCFG_CPU_PROGRAM_MAP(amstrad_mem) - MCFG_CPU_IO_MAP(amstrad_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(amstrad_state,amstrad_cpu_acknowledge_int) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(amstrad_state, plus ) - MCFG_MACHINE_RESET_OVERRIDE(amstrad_state, plus ) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(amstrad_state, amstrad_ppi_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(amstrad_state, amstrad_ppi_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(amstrad_state, amstrad_ppi_portb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(amstrad_state, amstrad_ppi_portc_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( ( XTAL_40MHz * 2 ) / 5, 1024, 32, 32 + 640 + 64, 312, 56 + 15, 200 + 15 ) - MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad) - MCFG_SCREEN_VBLANK_DRIVER(amstrad_state, screen_eof_amstrad) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 4096) - MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_plus) - - MCFG_MC6845_ADD("mc6845", MC6845, NULL, XTAL_40MHz / 40) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(16) - MCFG_MC6845_OUT_DE_CB(WRITELINE(amstrad_state, amstrad_plus_de_changed)) - MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(amstrad_state, amstrad_plus_hsync_changed)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(amstrad_state, amstrad_plus_vsync_changed)) - - MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay", AY8912, XTAL_40MHz / 40) - MCFG_AY8910_PORT_A_READ_CB(READ8(amstrad_state, amstrad_psg_porta_read)) /* portA read */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(amstrad_state, write_centronics_busy)) - - /* snapshot */ - MCFG_SNAPSHOT_ADD("snapshot", amstrad_state, amstrad, "sna", 0) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(cdt_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("cpc_cass") - - MCFG_UPD765A_ADD("upd765", true, true) - - MCFG_FRAGMENT_ADD(cpcplus_cartslot) - - MCFG_FLOPPY_DRIVE_ADD("upd765:0", amstrad_floppies, "3ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", amstrad_floppies, "35ssdd", floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(cpcplus_exp_cards, NULL, false) - MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS - MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("64K,320K,576K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( gx4000, amstrad_state ) - /* Machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_40MHz / 10) - MCFG_CPU_PROGRAM_MAP(amstrad_mem) - MCFG_CPU_IO_MAP(amstrad_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(amstrad_state,amstrad_cpu_acknowledge_int) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(amstrad_state, gx4000 ) - MCFG_MACHINE_RESET_OVERRIDE(amstrad_state, gx4000 ) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(amstrad_state, amstrad_ppi_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(amstrad_state, amstrad_ppi_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(amstrad_state, amstrad_ppi_portb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(amstrad_state, amstrad_ppi_portc_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( ( XTAL_40MHz * 2 ) / 5, 1024, 32, 32 + 640 + 64, 312, 56 + 15, 200 + 15 ) - MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad) - MCFG_SCREEN_VBLANK_DRIVER(amstrad_state, screen_eof_amstrad) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 4096) - MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_plus) - - MCFG_MC6845_ADD("mc6845", MC6845, NULL, XTAL_40MHz / 40) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(16) - MCFG_MC6845_OUT_DE_CB(WRITELINE(amstrad_state, amstrad_plus_de_changed)) - MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(amstrad_state, amstrad_plus_hsync_changed)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(amstrad_state, amstrad_plus_vsync_changed)) - - MCFG_VIDEO_START_OVERRIDE(amstrad_state,amstrad) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay", AY8912, XTAL_40MHz / 40) - MCFG_AY8910_PORT_A_READ_CB(READ8(amstrad_state, amstrad_psg_porta_read)) /* portA read */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_FRAGMENT_ADD(cpcplus_cartslot) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( aleste, cpc6128 ) - MCFG_MACHINE_START_OVERRIDE(amstrad_state,aleste) - MCFG_MACHINE_RESET_OVERRIDE(amstrad_state,aleste) - - MCFG_SOUND_REPLACE("ay", AY8912, XTAL_16MHz / 16) - MCFG_AY8910_PORT_A_READ_CB(READ8(amstrad_state, amstrad_psg_porta_read)) /* portA read */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(32+64) - MCFG_PALETTE_INIT_OWNER(amstrad_state,aleste) - MCFG_MC146818_ADD( "rtc", XTAL_4_194304Mhz ) - - MCFG_DEVICE_REMOVE("upd765") - MCFG_I8272A_ADD("upd765", true) - - MCFG_DEVICE_REMOVE("exp") - MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(aleste_exp_cards, NULL, false) - MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis)) // ROMDIS - MCFG_CPC_EXPANSION_SLOT_ROM_SELECT(WRITE8(amstrad_state,rom_select)) - - MCFG_FLOPPY_DRIVE_ADD("upd765:0", aleste_floppies, "35dd", amstrad_state::aleste_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", aleste_floppies, "35dd", amstrad_state::aleste_floppy_formats) - - MCFG_DEVICE_REMOVE("flop_list") - MCFG_SOFTWARE_LIST_ADD("flop_list", "aleste") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cpc_list", "cpc_flop") - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") -MACHINE_CONFIG_END - - - -/************************************* - * - * ROM definitions - * - *************************************/ - -/* cpc6128.rom contains OS in first 16k, BASIC in second 16k */ -/* cpcados.rom contains Amstrad DOS */ - -/* I am loading the roms outside of the Z80 memory area, because they -are banked. */ -ROM_START( cpc6128 ) - /* this defines the total memory size - 64k ram, 16k OS, 16k BASIC, 16k DOS */ - ROM_REGION(0x020000, "maincpu", 0) - /* load the os to offset 0x01000 from memory base */ - ROM_LOAD("cpc6128.rom", 0x10000, 0x8000, CRC(9e827fe1) SHA1(5977adbad3f7c1e0e082cd02fe76a700d9860c30)) - ROM_LOAD("cpcados.rom", 0x18000, 0x4000, CRC(1fe22ecd) SHA1(39102c8e9cb55fcc0b9b62098780ed4a3cb6a4bb)) -ROM_END - - -ROM_START( cpc6128f ) - /* this defines the total memory size (128kb))- 64k ram, 16k OS, 16k BASIC, 16k DOS +16k*/ - ROM_REGION(0x020000, "maincpu", 0) - - /* load the os to offset 0x01000 from memory base */ - ROM_LOAD("cpc6128f.rom", 0x10000, 0x8000, CRC(1574923b) SHA1(200d59076dfef36db061d6d7d21d80021cab1237)) - ROM_LOAD("cpcados.rom", 0x18000, 0x4000, CRC(1fe22ecd) SHA1(39102c8e9cb55fcc0b9b62098780ed4a3cb6a4bb)) -ROM_END - - -ROM_START( cpc6128s ) - /* this defines the total memory size (128kb))- 64k ram, 16k OS, 16k BASIC, 16k DOS +16k*/ - ROM_REGION(0x020000, "maincpu", 0) - - /* load the os to offset 0x01000 from memory base */ - ROM_LOAD("cpc6128s.rom", 0x10000, 0x8000, CRC(588b5540) SHA1(6765a91a42fed68a807325bf62a728e5ac5d622f)) - ROM_LOAD("cpcados.rom", 0x18000, 0x4000, CRC(1fe22ecd) SHA1(39102c8e9cb55fcc0b9b62098780ed4a3cb6a4bb)) -ROM_END - - -ROM_START( cpc464 ) - /* this defines the total memory size - 64k ram, 16k OS, 16k BASIC, 16k DOS */ - ROM_REGION(0x01c000, "maincpu", 0) - /* load the os to offset 0x01000 from memory base */ - ROM_LOAD("cpc464.rom", 0x10000, 0x8000, CRC(40852f25) SHA1(56d39c463da60968d93e58b4ba0e675829412a20)) -ROM_END - - -ROM_START( cpc664 ) - /* this defines the total memory size - 64k ram, 16k OS, 16k BASIC, 16k DOS */ - ROM_REGION(0x01c000, "maincpu", 0) - /* load the os to offset 0x01000 from memory base */ - ROM_LOAD("cpc664.rom", 0x10000, 0x8000, CRC(9ab5a036) SHA1(073a7665527b5bd8a148747a3947dbd3328682c8)) - ROM_LOAD("cpcados.rom", 0x18000, 0x4000, CRC(1fe22ecd) SHA1(39102c8e9cb55fcc0b9b62098780ed4a3cb6a4bb)) -ROM_END - - -ROM_START( kccomp ) - ROM_REGION(0x01c000, "maincpu", 0) - ROM_LOAD("kccos.rom", 0x10000, 0x4000, CRC(7f9ab3f7) SHA1(f828045e98e767f737fd93df0af03917f936ad08)) - ROM_LOAD("kccbas.rom", 0x14000, 0x4000, CRC(ca6af63d) SHA1(d7d03755099d0aff501fa5fffc9c0b14c0825448)) - ROM_RELOAD(0x18000, 0x4000) // has no AMSDOS ROM, so just reload BASIC in it's place (BASIC appears in any unused ROM slot) - - ROM_REGION(0x018000+0x0800, "proms", 0) - ROM_LOAD("farben.rom", 0x18000, 0x0800, CRC(a50fa3cf) SHA1(2f229ac9f62d56973139dad9992c208421bc0f51)) - - /* fake region - required by graphics decode structure */ - /*ROM_REGION(0x0c00, "gfx1") */ -ROM_END - - -/* this system must have a cartridge installed to run */ -ROM_START(cpc6128p) - ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x04000, "user1", ROMREGION_ERASEFF) -ROM_END - -#define rom_cpc464p rom_cpc6128p -#define rom_gx4000 rom_cpc6128p - - -ROM_START( al520ex ) - ROM_REGION(0x80000, "maincpu", 0) - ROM_LOAD("al512.bin", 0x10000, 0x10000, CRC(e8c2a9a1) SHA1(ad5827582cb19eaaae1b76e67df62d96da6ad96b)) - - ROM_REGION(0x20, "user2", 0) - ROM_LOAD("af.bin", 0x00, 0x20, CRC(c81fb524) SHA1(17738d0603915a67ec1fddc4cbf7d6b98cdeb8f6)) - - ROM_REGION(0x100, "user3", 0) // RAM bank mappings - ROM_LOAD("mapper.bin", 0x00, 0x100, CRC(0daebd80) SHA1(8633073cba752c38c5dc912ff9f6a3c89357539b)) - - ROM_REGION(0x800, "user4", 0) // Colour data - ROM_LOAD("rfcoldat.bin", 0x00, 0x800, CRC(c6ace0e6) SHA1(2f4c51fcfaacb8deed68f6ae9388b870bc962cef)) - - ROM_REGION(0x800, "user5", 0) // Keyboard / Video - ROM_LOAD("rfvdkey.bin", 0x00, 0x800, CRC(cf2aa4b0) SHA1(20f37da3bc3c377b1c47ae4d9ab8d150faae19a0)) - - ROM_REGION(0x100, "user6", 0) - ROM_LOAD("romram.bin", 0x00, 0x100, CRC(b3ea95d7) SHA1(1252390737a7ead4ecec988c873181798fbc291b)) -ROM_END - -/************************************* - * - * Driver definitions - * - *************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, cpc464, 0, 0, cpc464, cpc464, driver_device, 0, "Amstrad plc", "Amstrad CPC464", 0 ) -COMP( 1985, cpc664, cpc464, 0, cpc664, cpc664, driver_device, 0, "Amstrad plc", "Amstrad CPC664", 0 ) -COMP( 1985, cpc6128, cpc464, 0, cpc6128, cpc6128, driver_device, 0, "Amstrad plc", "Amstrad CPC6128", 0 ) -COMP( 1985, cpc6128f, cpc464, 0, cpc6128, cpc6128f, driver_device, 0, "Amstrad plc", "Amstrad CPC6128 (France, AZERTY Keyboard)", 0 ) -COMP( 1985, cpc6128s, cpc464, 0, cpc6128, cpc6128s, driver_device, 0, "Amstrad plc", "Amstrad CPC6128 (Sweden/Finland)", 0 ) -COMP( 1990, cpc464p, 0, 0, cpcplus, plus, driver_device, 0, "Amstrad plc", "Amstrad CPC464+", 0 ) -COMP( 1990, cpc6128p, 0, 0, cpcplus, plus, driver_device, 0, "Amstrad plc", "Amstrad CPC6128+", 0 ) -CONS( 1990, gx4000, 0, 0, gx4000, gx4000, driver_device, 0, "Amstrad plc", "Amstrad GX4000", 0 ) -COMP( 1989, kccomp, cpc464, 0, kccomp, kccomp, driver_device, 0, "VEB Mikroelektronik", "KC Compact", 0 ) -COMP( 1993, al520ex, cpc464, 0, aleste, aleste, driver_device, 0, "Patisonic", "Aleste 520EX", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mess/drivers/amust.c b/src/mess/drivers/amust.c deleted file mode 100644 index a49a0db462b..00000000000 --- a/src/mess/drivers/amust.c +++ /dev/null @@ -1,467 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Amust Compak - also known as Amust Executive 816. - -2014-03-21 Skeleton driver. [Robbbert] - -An unusual-looking CP/M computer. -There are no manuals or schematics known to exist. -The entire driver is guesswork. -The board has LH0080 (Z80A), 2x 8251, 2x 8255, 8253, uPD765A and a HD46505SP-2. -The videoram is a 6116 RAM. There is a piezo beeper. There are 3 crystals, -X1 = 4.9152 (serial chips?), X2 = 16 (CPU), X3 = 14.31818 MHz (Video?). -There are numerous jumpers, all of which perform unknown functions. - -The keyboard is a plug-in unit, same idea as Kaypro and Zorba. It has these -chips: INS8035N-6, F74145, 74LS373N, SN75451BP, 2716 rom with label KBD-3. -Crystal: 3.579545 MHz - -The main rom is identical between the 2 halves, except that the initial -crtc parameters are slightly different. I've chosen to ignore the first -half. (perhaps 50/60 Hz selectable by jumper?) - -Preliminary I/O ports ---------------------- -00-01 uart 1 -02-03 uart 2 -04-07 ppi 1 -08-0b ppi 2 -0d-0f crtc -10-11 fdc -14-17 pit - -PIT. -Having the PIT on ports 14-17 seems to make sense. It sets counters 1 and 2 -to mode 3, binary, initial count = 0x80. Counter 0 not used? - - -Floppy Parameters: ------------------- -Double Density -Two Side -80 track -1024 byte sectors -5 sectors/track -800k capacity -128 directory entries -2k block size -Skew 1,3,5,2,4 - - -Stuff that doesn't make sense: ------------------------------- -1. To access the screen, it waits for IRQ presumably from sync pulse. It sets INT -mode 0 which means a page-zero jump, but doesn't write anything to the zero-page ram. -That's why I added a RETI at 0008 and set the vector to there. A bit later it writes -a jump at 0000. Then it sets the interrupting device to the fdc (not sure how yet), -then proceeds to overwrite all of page-zero with the disk contents. This of course -kills the jump it just wrote, and my RETI. So it runs into the weeds at high speed. -What should happen is after loading the boot sector succesfully it will jump to 0000, -otherwise it will write BOOT NG to the screen and you're in the monitor. The bios -contains no RETI instructions. -2. At F824 it copies itself to the same address which is presumably shadow ram. But -it never switches to it. The ram is physically in the machine. - - -Monitor Commands: ------------------ -B = Boot from floppy -(YES! Most useless monitor ever) - - -ToDo: -- Everything -- Need software -- Keyboard controller needs to be emulated -- If booting straight to CP/M, the load message should be in the middle of the screen. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "machine/upd765.h" -#include "machine/keyboard.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "sound/beep.h" - - -class amust_state : public driver_device -{ -public: - enum - { - TIMER_BEEP_OFF - }; - - amust_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_beep(*this, "beeper") - , m_fdc (*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - { } - - DECLARE_DRIVER_INIT(amust); - DECLARE_MACHINE_RESET(amust); - DECLARE_READ8_MEMBER(port00_r); - DECLARE_READ8_MEMBER(port01_r); - DECLARE_READ8_MEMBER(port04_r); - DECLARE_WRITE8_MEMBER(port04_w); - DECLARE_READ8_MEMBER(port05_r); - DECLARE_READ8_MEMBER(port06_r); - DECLARE_WRITE8_MEMBER(port06_w); - DECLARE_READ8_MEMBER(port08_r); - DECLARE_WRITE8_MEMBER(port08_w); - DECLARE_READ8_MEMBER(port09_r); - DECLARE_READ8_MEMBER(port0a_r); - DECLARE_WRITE8_MEMBER(port0a_w); - DECLARE_WRITE8_MEMBER(port0d_w); - DECLARE_WRITE8_MEMBER(kbd_put); - INTERRUPT_GEN_MEMBER(irq_vs); - MC6845_UPDATE_ROW(crtc_update_row); - UINT8 *m_p_videoram; - const UINT8 *m_p_chargen; - required_device m_palette; -private: - UINT8 m_port04; - UINT8 m_port06; - UINT8 m_port08; - UINT8 m_port0a; - UINT8 m_term_data; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - required_device m_maincpu; - required_device m_beep; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; -}; - -void amust_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BEEP_OFF: - m_beep->set_state(0); - break; - default: - assert_always(FALSE, "Unknown id in amust_state::device_timer"); - } -} - -//WRITE8_MEMBER( amust_state::port00_w ) -//{ -// membank("bankr0")->set_entry(BIT(data, 6)); -// m_fdc->dden_w(BIT(data, 5)); -// floppy_image_device *floppy = NULL; -// if (BIT(data, 0)) floppy = m_floppy0->get_device(); -// m_fdc->set_floppy(floppy); -// if (floppy) -// floppy->ss_w(BIT(data, 4)); -//} - -static ADDRESS_MAP_START(amust_mem, AS_PROGRAM, 8, amust_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(amust_io, AS_IO, 8, amust_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - //AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) - //AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) - AM_RANGE(0x00, 0x00) AM_READ(port00_r) - AM_RANGE(0x01, 0x01) AM_READ(port01_r) - AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w) - AM_RANGE(0x03, 0x03) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi1", i8255_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi2", i8255_device, read, write) - AM_RANGE(0x0d, 0x0d) AM_READNOP AM_WRITE(port0d_w) - AM_RANGE(0x0e, 0x0e) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0x0f, 0x0f) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE(0x10, 0x11) AM_DEVICE("fdc", upd765a_device, map) - AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("pit", pit8253_device, read, write) -ADDRESS_MAP_END - -static SLOT_INTERFACE_START( amust_floppies ) - SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) - SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -/* Input ports */ -static INPUT_PORTS_START( amust ) -INPUT_PORTS_END - -READ8_MEMBER( amust_state::port00_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( amust_state::port01_r ) -{ - return 0xff; -} - -// bodgy -INTERRUPT_GEN_MEMBER( amust_state::irq_vs ) -{ - m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xcf); -} - -READ8_MEMBER( amust_state::port04_r ) -{ - return m_port04; -} - -WRITE8_MEMBER( amust_state::port04_w ) -{ - m_port04 = data; -} - -READ8_MEMBER( amust_state::port05_r ) -{ - return 0; -} - -READ8_MEMBER( amust_state::port06_r ) -{ - return m_port06; -} - -// BIT 5 low while writing to screen -WRITE8_MEMBER( amust_state::port06_w ) -{ - m_port06 = data; -} - -READ8_MEMBER( amust_state::port08_r ) -{ - return m_port08; -} - -// lower 8 bits of video address -WRITE8_MEMBER( amust_state::port08_w ) -{ - m_port08 = data; -} - -/* -d0 - something to do with type of disk -d1 - -d2 - -d3 - -d4 - H = go to monitor; L = boot from disk -d5 - status of disk-related; loops till NZ -d6 - -d7 - -*/ -READ8_MEMBER( amust_state::port09_r ) -{ - printf("%s\n",machine().describe_context()); - return 0xff; -} - -READ8_MEMBER( amust_state::port0a_r ) -{ - return m_port0a; -} - -/* Bits 7,6,5,3 something to do -with selecting which device causes interrupt? -50, 58 = video sync -70 disk -D0 ? -Bit 4 low = beeper. -Lower 3 bits = upper part of video address */ -WRITE8_MEMBER( amust_state::port0a_w ) -{ - m_port0a = data; - - if (!BIT(data, 4)) - { - m_beep->set_state(1); - timer_set(attotime::from_msec(150), TIMER_BEEP_OFF); - } -} - -WRITE8_MEMBER( amust_state::port0d_w ) -{ - UINT16 video_address = m_port08 | ((m_port0a & 7) << 8); - m_p_videoram[video_address] = data; -} - -WRITE8_MEMBER( amust_state::kbd_put ) -{ - m_term_data = data; -} - -/* F4 Character Displayer */ -static const gfx_layout amust_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( amust ) - GFXDECODE_ENTRY( "chargen", 0x0000, amust_charlayout, 0, 1 ) -GFXDECODE_END - -MC6845_UPDATE_ROW( amust_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,inv; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - if (ra < 8) - gfx = m_p_chargen[(chr<<3) | ra] ^ inv; - else - gfx = inv; - - /* Display a scanline of a character (8 pixels) */ - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} - -MACHINE_RESET_MEMBER( amust_state, amust ) -{ - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("videoram")->base(); - membank("bankr0")->set_entry(0); // point at rom - membank("bankw0")->set_entry(0); // always write to ram - m_beep->set_frequency(800); - address_space &space = m_maincpu->space(AS_PROGRAM); - space.write_byte(8, 0xed); - space.write_byte(9, 0x4d); - m_port04 = 0; - m_port06 = 0; - m_port08 = 0; - m_port0a = 0; - m_maincpu->set_state_int(Z80_PC, 0xf800); -} - -DRIVER_INIT_MEMBER( amust_state, amust ) -{ - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(1, &main[0xf800]); - membank("bankr0")->configure_entry(0, &main[0x10800]); - membank("bankw0")->configure_entry(0, &main[0xf800]); -} - -static MACHINE_CONFIG_START( amust, amust_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(amust_mem) - MCFG_CPU_IO_MAP(amust_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", amust_state, irq_vs) - MCFG_MACHINE_RESET_OVERRIDE(amust_state, amust) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", amust) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_14_31818MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(amust_state, crtc_update_row) - - MCFG_DEVICE_ADD("keybd", GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(amust_state, kbd_put)) - MCFG_UPD765A_ADD("fdc", false, true) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", amust_floppies, "drive0", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", amust_floppies, "drive1", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - - //MCFG_DEVICE_ADD("uart1", I8251, 0) - //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - //MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("uart2", I8251, 0) - //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - //MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - //MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - //MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_rxd)) - //MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_cts)) - //MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_dsr)) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - - MCFG_DEVICE_ADD("ppi1", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(amust_state, port04_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(amust_state, port04_w)) - MCFG_I8255_IN_PORTB_CB(READ8(amust_state, port05_r)) - MCFG_I8255_IN_PORTC_CB(READ8(amust_state, port06_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(amust_state, port06_w)) - - MCFG_DEVICE_ADD("ppi2", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(amust_state, port08_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(amust_state, port08_w)) - MCFG_I8255_IN_PORTB_CB(READ8(amust_state, port09_r)) - MCFG_I8255_IN_PORTC_CB(READ8(amust_state, port0a_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(amust_state, port0a_w)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( amust ) - ROM_REGION( 0x11000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mon_h.rom", 0x10000, 0x1000, CRC(10dceac6) SHA1(1ef80039063f7a6455563d59f1bcc23e09eca369) ) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "cg4.rom", 0x000, 0x800, CRC(52e7b9d8) SHA1(cc6d457634eb688ccef471f72bddf0424e64b045) ) - - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "kbd_3.rom", 0x000, 0x800, CRC(d9441b35) SHA1(ce250ab1e892a13fd75182703f259855388c6bf4) ) - - ROM_REGION( 0x800, "videoram", ROMREGION_ERASE00 ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, amust, 0, 0, amust, amust, amust_state, amust, "Amust", "Amust Executive 816", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/apc.c b/src/mess/drivers/apc.c deleted file mode 100644 index 78a08b343da..00000000000 --- a/src/mess/drivers/apc.c +++ /dev/null @@ -1,1000 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese -/*************************************************************************** - - Advanced Personal Computer (c) 1982 NEC - - preliminary driver by Angelo Salese - - TODO: - - video emulation (bitmap part) - - NMI seems valid, dumps a x86 stack to vram? - - What are exactly APU and MPU devices? They sounds scary ... - - DMA hook-ups - - serial ports - - parallel ports - - Extract info regarding Hard Disk functionality - - Various unknown ports - - What kind of external ROM actually maps at 0xa****? - - Jumper settings (comms settings and display select) - -============================================================================ - front ^ - | - card - ---- - 69PFCU 7220 PFCU1R 2764 - 69PTS 7220 - - - 69PFB2 8086/8087 DFBU2J PFBU2L 2732 - 69SNB RAM - ----------------------------------------------------------------------------- - i/o memory map (preliminary): - 0x00 - 0x1f DMA - 0x20 - 0x23 i8259 master - 0x28 - 0x2f i8259 slave (even), pit8253 (odd) - 0x30 - 0x37 serial i8251, even #1 / odd #2 - 0x38 - 0x3f DMA segments - 0x40 - 0x43 upd7220, even chr / odd bitmap - 0x48 - 0x4f keyboard - 0x50 - 0x53 upd765 - 0x58 rtc - 0x5a - 0x5e APU - 0x60 MPU (melody) - 0x61 - 0x67 (Mirror of pit8253?) - 0x68 - 0x6f parallel port - ----------------------------------------------------------------------------- -0xfe3c2: checks if the floppy has a valid string for booting (either "CP/M-86" - or "MS-DOS"), if not, branches with the successive jne. - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "audio/upd1771.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/am9517a.h" -#include "machine/upd765.h" -#include "machine/upd1990a.h" -#include "machine/nvram.h" -#include "video/upd7220.h" - -//#include "sound/ay8910.h" - -#define MAIN_CLOCK XTAL_5MHz - -class apc_state : public driver_device -{ -public: - apc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_hgdc1(*this, "upd7220_chr"), - m_hgdc2(*this, "upd7220_btm"), - m_rtc(*this, "upd1990a"), - m_i8259_m(*this, "pic8259_master"), - m_i8259_s(*this, "pic8259_slave"), - m_fdc(*this, "upd765"), - m_dmac(*this, "i8237"), - m_pit(*this, "pit8253"), - m_video_ram_1(*this, "video_ram_1"), - m_video_ram_2(*this, "video_ram_2"), - m_palette(*this, "palette") - { } - - // devices - required_device m_maincpu; - required_device m_hgdc1; - required_device m_hgdc2; - required_device m_rtc; - required_device m_i8259_m; - required_device m_i8259_s; - required_device m_fdc; - required_device m_dmac; - required_device m_pit; - UINT8 *m_char_rom; - UINT8 *m_aux_pcg; - - required_shared_ptr m_video_ram_1; - required_shared_ptr m_video_ram_2; - - required_device m_palette; - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - - DECLARE_READ8_MEMBER(apc_port_28_r); - DECLARE_WRITE8_MEMBER(apc_port_28_w); - DECLARE_READ8_MEMBER(apc_gdc_r); - DECLARE_WRITE8_MEMBER(apc_gdc_w); - DECLARE_READ8_MEMBER(apc_kbd_r); - DECLARE_WRITE8_MEMBER(apc_kbd_w); - DECLARE_WRITE8_MEMBER(apc_dma_segments_w); - DECLARE_READ8_MEMBER(apc_dma_r); - DECLARE_WRITE8_MEMBER(apc_dma_w); - DECLARE_WRITE8_MEMBER(apc_irq_ack_w); - DECLARE_READ8_MEMBER(apc_rtc_r); - DECLARE_WRITE8_MEMBER(apc_rtc_w); -// DECLARE_READ8_MEMBER(aux_pcg_r); -// DECLARE_WRITE8_MEMBER(aux_pcg_w); - - struct { - UINT8 status; //status - UINT8 data; //key data - UINT8 sig; //switch signal port - UINT8 sh; //shift switches - }m_keyb; - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); - - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE_LINE_MEMBER(apc_dma_hrq_changed); - DECLARE_WRITE_LINE_MEMBER(apc_tc_w); - DECLARE_WRITE_LINE_MEMBER(apc_dack0_w); - DECLARE_WRITE_LINE_MEMBER(apc_dack1_w); - DECLARE_WRITE_LINE_MEMBER(apc_dack2_w); - DECLARE_WRITE_LINE_MEMBER(apc_dack3_w); - DECLARE_READ8_MEMBER(fdc_r); - DECLARE_WRITE8_MEMBER(fdc_w); - DECLARE_READ8_MEMBER(apc_dma_read_byte); - DECLARE_WRITE8_MEMBER(apc_dma_write_byte); - - DECLARE_DRIVER_INIT(apc); - - int m_dack; - UINT8 m_dma_offset[4]; - - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); - UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - inline void set_dma_channel(int channel, int state); -}; - -void apc_state::video_start() -{ - m_char_rom = memregion("gfx")->base(); - m_aux_pcg = memregion("aux_pcg")->base(); -} - -UINT32 apc_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) -{ - bitmap.fill(m_palette->black_pen(), cliprect); - - /* graphics */ - m_hgdc2->screen_update(screen, bitmap, cliprect); - m_hgdc1->screen_update(screen, bitmap, cliprect); - - return 0; -} - - -UPD7220_DISPLAY_PIXELS_MEMBER( apc_state::hgdc_display_pixels ) -{ - // ... -} - -UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,yi,yi_trans; - int x; - UINT8 char_size; -// UINT8 interlace_on; - -// if(m_video_ff[DISPLAY_REG] == 0) //screen is off -// return; - -// interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */ - char_size = 19; - - for(x=0;x> 1] >> 8) & 0x00ff; - tile_sel = m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] & 0x00ff; - attr = (m_video_ram_1[((tile_addr*2 & 0x1fff) | 0x2000) >> 1] & 0x00ff); - - u_line = attr & 0x01; - o_line = attr & 0x02; - v_line = attr & 0x04; - blink = attr & 0x08; - reverse = attr & 0x10; -// secret= (attr & 1) ^ 1; - color = (attr & 0xe0) >> 5; - - for(yi=0;yivisible_area().contains(res_x, res_y)) - continue; - - /* - Addr bus: C BA98 7654 3210 - | |||| |\\\ \\\\- character number bits 0-6 - | |||| \--------- y' bit 0 - | |||\----------- y' bit 1 - | ||\------------ y' bit 2 - | |\------------- y' bit 3 - | \-------------- character number bit 7 - \---------------- y' bit 4 - - y to y' (assumed; this needs hardware tests since there could be one more 'blank' line between all char rows): - y = 0 1 2 3 ... 16 17 18 - y' = 18 0 1 2 ... 15 16 17 - - Data bus: 76543210 = pixels, in left->01234567->right order - */ - if(tile_sel == 0x89)// Aux character RAM select TODO: correct triggering? - { - if(yi & 0x10) - tile_data = 0; - else - tile_data = m_aux_pcg[(tile & 0xff)*0x20+yi*2]; - } - else - tile_data = m_char_rom[(tile & 0x7f)+((tile & 0x80)<<4)+((yi_trans & 0xf)*0x80)+((yi_trans & 0x10)<<8)]; - - if(reverse) { tile_data^=0xff; } - if(u_line && yi == lr-1) { tile_data = 0xff; } - if(o_line && yi == 0) { tile_data = 0xff; } - if(v_line) { tile_data|=1; } - if(blink && machine().first_screen()->frame_number() & 0x20) { tile_data = 0; } // TODO: rate & correct behaviour - - if(cursor_on && cursor_addr == tile_addr && machine().first_screen()->frame_number() & 0x10) - tile_data^=0xff; - - if(yi >= char_size) - pen = 0; - else - pen = (tile_data >> (xi) & 1) ? color : 0; - - if(pen) - bitmap.pix32(res_y, res_x) = palette[pen]; - } - } - } -} - -READ8_MEMBER(apc_state::apc_port_28_r) -{ - UINT8 res; - - if(offset & 1) - res = m_pit->read(space, (offset & 6) >> 1); - else - { - if(offset & 4) - { - printf("Read undefined port %02x\n",offset+0x28); - res = 0xff; - } - else - res = m_i8259_s->read(space, (offset & 2) >> 1); - } - - return res; -} - -WRITE8_MEMBER(apc_state::apc_port_28_w) -{ - if(offset & 1) - m_pit->write(space, (offset & 6) >> 1, data); - else - { - if(offset & 4) - printf("Write undefined port %02x\n",offset+0x28); - else - m_i8259_s->write(space, (offset & 2) >> 1, data); - } -} - - -READ8_MEMBER(apc_state::apc_gdc_r) -{ - UINT8 res; - - if(offset & 1) - res = m_hgdc2->read(space, (offset & 2) >> 1); // upd7220 bitmap port - else - res = m_hgdc1->read(space, (offset & 2) >> 1); // upd7220 character port - - return res; -} - -WRITE8_MEMBER(apc_state::apc_gdc_w) -{ - if(offset & 1) - m_hgdc2->write(space, (offset & 2) >> 1,data); // upd7220 bitmap port - else - m_hgdc1->write(space, (offset & 2) >> 1,data); // upd7220 character port -} - -READ8_MEMBER(apc_state::apc_kbd_r) -{ - UINT8 res = 0; - - switch(offset & 3) - { - case 0: res = m_keyb.data; machine().device("pic8259_master")->ir4_w(0); break; // according to the source, reading there acks the irq - case 1: res = m_keyb.status; break; - case 2: res = m_keyb.sig; break; // bit 0: CTRL bit 1: function key (or reversed) - case 3: res = ioport("KEY_MOD")->read() & 0xff; break; // sh - } - - return res; -} - -WRITE8_MEMBER(apc_state::apc_kbd_w) -{ - printf("KEYB %08x %02x\n",offset,data); -} - -WRITE8_MEMBER(apc_state::apc_dma_segments_w) -{ - m_dma_offset[offset & 3] = data & 0x0f; -} - -/* -NEC APC i8237 hook-up looks pretty weird ... - - NEC APC (shift 1) IBM PC -CH0_ADR == 0X01 0x00 0x00 ; CH-0 address (RW) -CH1_ADR == 0X03 0x01 0x02 ; CH-1 address (RW) -CH2_ADR == 0X05 0x02 0x04 ; CH-2 address (RW) -CH3_ADR == 0X07 0x03 0x06 ; CH-3 address (RW) -DMA_ST == 0X09 0x04 0x08 ; status register (R) -DMA_CMD == 0X09 0x04 0x08 ; command register (W) -DMA_WSM == 0X0B 0x05 0x0a ; write single mask (W) -DMA_CFF == 0X0D 0x06 0x0c ; clear flip flop (W) - -CH0_TC == 0X11 0x08 0x01 ; CH-0 terminal count (RW) -CH1_TC == 0X13 0x09 0x03 ; CH-1 terminal count (RW) -CH2_TC == 0X15 0x0a 0x05 ; CH-2 terminal count (RW) -CH3_TC == 0X17 0x0b 0x07 ; CH-3 terminal count (RW) -DMA_WRR == 0X19 0x0c 0x09 ; write request register (W) -DMA_MODE== 0X1B 0x0d 0x0b ; write mode (W) -DMA_RTR == 0X1D 0x0e 0x0d? ; read temp register (R) -DMA_MC == 0X1D 0x0e 0x0d ; master clear (W) -DMA_WAM == 0X1F 0x0f 0x0f? ; write all mask (W) -CH0_EXA == 0X38 ; CH-0 extended address (W) -CH1_EXA == 0X3A ; CH-1 extended address (W) -CH2_EXA == 0X3C ; CH-2 extended address (W) -CH3_EXA == 0X3E ; CH-3 extended address (W) - -... apparently, they rotated right the offset, compared to normal hook-up. -*/ - -READ8_MEMBER(apc_state::apc_dma_r) -{ - return m_dmac->read(space, BITSWAP8(offset,7,6,5,4,2,1,0,3), 0xff); -} - -WRITE8_MEMBER(apc_state::apc_dma_w) -{ - m_dmac->write(space, BITSWAP8(offset,7,6,5,4,2,1,0,3), data, 0xff); -} - -WRITE8_MEMBER(apc_state::apc_irq_ack_w) -{ - /* - x--- GDC - -x-- TM - --x- APU - ---x CRT - */ - if(data & 4) - machine().device("pic8259_master")->ir3_w(0); - - if(data & ~4) - logerror("IRQ ACK %02x\n",data); -} - -READ8_MEMBER(apc_state::apc_rtc_r) -{ - /* - bit 1 high: low battery. - */ - //fprintf(stderr, "RTC Read: %d\n", m_rtc->data_out_r()); - return m_rtc->data_out_r(); -} - -WRITE8_MEMBER(apc_state::apc_rtc_w) -{ -/* -RTC write: 0x01 0001 -RTC write: 0x03 0011 -RTC write: 0x0b 1011 <- cmd: read clock to shifter latch -RTC write: 0x03 0011 -RTC write: 0x01 0001 -RTC write: 0x09 1001 <- cmd: begin shifting latch data out -RTC write: 0x01 0001 -RTC write: 0x11 -RTC write: 0x01 -RTC write: 0x11 -RTC write: 0x01 -RTC write: 0x11 -... - -RTC write bits: 76543210 - |||||||\- c0 - ||||||\-- c1 - |||||\--- c2 - ||||\---- STB - |||\----- CLK - ||\------ DATA_IN - |\------- "don't care" - \-------- /// -*/ - if (data&0xc0) fprintf(stderr,"RTC write: 0x%02x\n", data); - m_rtc->c0_w(BIT(data, 0)); // correct assuming theres a delay for changing command lines before stb - m_rtc->c1_w(BIT(data, 1)); // " - m_rtc->c2_w(BIT(data, 2)); // " - m_rtc->stb_w(BIT(data, 3)); // seems correct assuming delay for changing command line - m_rtc->clk_w(BIT(data, 4)); // correct for sure - m_rtc->data_in_w(BIT(data, 5)); // ? no idea about this. - m_rtc->oe_w(1); -} - -static ADDRESS_MAP_START( apc_map, AS_PROGRAM, 16, apc_state ) - AM_RANGE(0x00000, 0x9ffff) AM_RAM - AM_RANGE(0xa0000, 0xa0fff) AM_RAM AM_SHARE("cmos") -// AM_RANGE(0xa1000, 0xbffff) mirror CMOS -// AM_RANGE(0xc0000, 0xcffff) standard character ROM - AM_RANGE(0xd8000, 0xd9fff) AM_RAM AM_REGION("aux_pcg", 0) // AUX character RAM -// AM_RANGE(0xe0000, 0xeffff) Special Character RAM - AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( apc_io, AS_IO, 16, apc_state ) -// ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x1f) AM_READWRITE8(apc_dma_r, apc_dma_w,0xff00) - AM_RANGE(0x20, 0x23) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff) // i8259 - AM_RANGE(0x28, 0x2f) AM_READWRITE8(apc_port_28_r, apc_port_28_w, 0xffff) // i8259 (even) / pit8253 (odd) -// 0x30, 0x37 serial port 0/1 (i8251) (even/odd) - AM_RANGE(0x38, 0x3f) AM_WRITE8(apc_dma_segments_w,0x00ff) - AM_RANGE(0x40, 0x43) AM_READWRITE8(apc_gdc_r, apc_gdc_w, 0xffff) - AM_RANGE(0x46, 0x47) AM_WRITE8(apc_irq_ack_w, 0x00ff) - AM_RANGE(0x48, 0x4f) AM_READWRITE8(apc_kbd_r, apc_kbd_w, 0x00ff) - AM_RANGE(0x50, 0x53) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff ) // upd765 - AM_RANGE(0x58, 0x59) AM_READWRITE8(apc_rtc_r, apc_rtc_w, 0x00ff) -// 0x59 CMOS enable -// 0x5a APU data (Arithmetic Processing Unit!) -// 0x5b, Power Off -// 0x5e APU status/command - AM_RANGE(0x60, 0x61) AM_DEVREADWRITE8("upd1771c", upd1771c_device, read, write, 0x00ff) -// AM_RANGE(0x68, 0x6f) i8255 , ODA printer port (A: status (R) B: data (W) C: command (W)) -// 0x70, 0x76 AM_DEVREADWRITE8("upd7220_btm", upd7220_device, read, write, 0x00ff) -// 0x71, 0x77 IDA Controller -// 0x80, 0x90 Communication Adapter -// 0xf0, 0xf6 ASOP Controller -ADDRESS_MAP_END - -/* TODO: key repeat, remove port impulse! */ -INPUT_CHANGED_MEMBER(apc_state::key_stroke) -{ - if(newval && !oldval) - { - m_keyb.data = (UINT8)(FPTR)(param) & 0xff; - //m_keyb.status &= ~1; - machine().device("pic8259_master")->ir4_w(1); - } - - if(oldval && !newval) - { - m_keyb.data = 0xff; - //m_keyb.status |= 1; - } -} - - -static INPUT_PORTS_START( apc ) - PORT_START("KEY0") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x30) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x31) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x32) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x33) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x34) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x35) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x36) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x37) - - PORT_START("KEY1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x38) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x39) - - PORT_START("KEY2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x41) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x42) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x43) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x44) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x45) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x46) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x47) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x48) - - PORT_START("KEY3") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x49) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4a) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4b) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4c) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4d) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4e) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x4f) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x50) - - PORT_START("KEY4") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x51) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x52) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x53) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x54) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x55) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x56) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x57) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x58) - - PORT_START("KEY5") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x59) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5a) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ / {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5b) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ / |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5c) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] / }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5d) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(up score) / ^") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5e) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- / _") PORT_CODE(KEYCODE_MINUS) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x5f) -// PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("unk6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x26) - - PORT_START("KEY6") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x20) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; / :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x3a) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= / +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2d) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("` / ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x40) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' / \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x3b) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", / <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2c) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". / >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ / ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x2f) - - -/* -; -; Special table for screwed-up keys. Scan codes are converted. -; -SPECTBL: - BYTE 0X2D,0X3D - BYTE 0X40,0X60 - BYTE 0X3A,0X3B - BYTE 0X3B,0X27 -SPECTLN == (.-SPECTBL)/2 ; length of table -; -; Shift case table -; -CASETBL: - BYTE "1!" - BYTE "2@" - BYTE "3#" - BYTE "4$" - BYTE "5%" - BYTE "6",0XD0 - BYTE "7&" - BYTE "8*" - BYTE "9(" - BYTE "0)" - BYTE "-_" - BYTE "=+" - BYTE "`~" - BYTE "[{" - BYTE "]}" - BYTE "\\|" - BYTE ",<" - BYTE ".>" - BYTE "/?" - BYTE ";:" - BYTE 0X27,0X22 - BYTE 0X18,"^" -*/ - -/* - BYTE 0X18 ; 5E - Control-X - BYTE "-" ; 5F -*/ - -/* - #REPEAT 0X96-0X80 ; 80 to 95 - function keys -*/ - PORT_START("KEY_PF1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x80) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x81) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x82) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x83) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x84) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x85) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x86) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x87) - - PORT_START("KEY_PF2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x88) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x89) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF11") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF12") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF13") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF14") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF15") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF16") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x8f) - - PORT_START("KEY_PF3") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF17") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x90) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF18") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x91) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF19") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x92) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF20") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x93) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF21") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x94) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF22") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x95) - -/* - BYTE "*" ; 6A - BYTE "+" ; 6B - BYTE 0XFF ; 6C - undefined code - BYTE "-" ; 6D - BYTE "." ; 6E - BYTE "/" ; 6F - BYTE "0" ; 70 - BYTE "1" ; 71 - BYTE "2" ; 72 - BYTE "3" ; 73 - BYTE "4" ; 74 - BYTE "5" ; 75 - BYTE "6" ; 76 - BYTE "7" ; 77 - BYTE "8" ; 78 - BYTE "9" ; 79 -*/ - - PORT_START("KEY_PAD1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6a) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6b) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) // 0x6c - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6d) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6e) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x6f) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x70) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x71) - - PORT_START("KEY_PAD2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x72) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x73) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x74) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x75) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x76) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x77) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x78) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x79) - - -/* BYTE 0X00 ; 96 - break stop - BYTE 0X0D ; 97 - return - BYTE 0X09 ; 98 - tab/back tab - BYTE 0XFF ; 99 - undefined code - BYTE 0X1E ; 9A - home/clear - BYTE 0XFF ; 9B - undefined code - BYTE 0X08 ; 9C - back space -*/ - PORT_START("KEY_S1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CHAR(0x00) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x96) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x97) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") /*PORT_CODE(KEYCODE_TAB)*/ PORT_CHAR(0x09) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x98) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_UNUSED) //0x99 - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHAR(0x1e) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x9a) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_UNUSED) //0x9b - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x9c) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(0x1b) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0x1b) - -/* - BYTE 0X0B ; F7 - up arrow - BYTE 0X0A ; F8 - down arrow - BYTE 0X0C ; F9 - right arrow - BYTE 0X08 ; FA - left arrow - BYTE 0XFF (?) ; FB - ins - BYTE 0X7F ; FC - del - BYTE 0X0D ; FD - enter -*/ - PORT_START("KEY_S2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(0x0b) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xf7) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(0x0a) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xf8) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(0x0c) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xf9) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(0x08) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfa) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CHAR(0xff) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfb) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CHAR(0x7f) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfc) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER (PAD)") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(0x0d) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, apc_state, key_stroke, 0xfd) - - PORT_START("KEY_MOD") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE -INPUT_PORTS_END - -void apc_state::machine_start() -{ - m_fdc->set_rate(500000); - - m_rtc->cs_w(1); -// m_rtc->oe_w(1); -} - -void apc_state::machine_reset() -{ - m_keyb.status = 0; - m_keyb.data = 0; - m_keyb.sig = 0; -} - -static const gfx_layout charset_8x16 = -{ - 8, 16, - 128, - 1, - { 0 }, - { 7, 6, 5, 4, 3, 2, 1, 0 }, - { 0*1024, 1*1024, 2*1024, 3*1024, 4*1024, 5*1024, 6*1024, 7*1024, 8*1024, 9*1024, 10*1024, 11*1024, 12*1024, 13*1024, 14*1024, 15*1024 }, - 8 -}; - -#if 0 -static const gfx_layout charset_pcg = -{ - 8, 16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 7, 6, 5, 4, 3, 2, 1, 0 }, - { STEP16(0,16) }, - 8*32 -}; -#endif - -static GFXDECODE_START( apc ) - GFXDECODE_ENTRY( "gfx", 0x0000, charset_8x16, 0, 128 ) - GFXDECODE_ENTRY( "gfx", 0x0800, charset_8x16, 0, 128 ) - GFXDECODE_ENTRY( "gfx", 0x1000, charset_8x16, 0, 128 ) - GFXDECODE_ENTRY( "gfx", 0x1800, charset_8x16, 0, 128 ) -// GFXDECODE_ENTRY( "aux_pcg", 0x0000, charset_pcg, 0, 128 ) -GFXDECODE_END - - - -static ADDRESS_MAP_START( upd7220_1_map, AS_0, 16, apc_state) - AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram_1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( upd7220_2_map, AS_0, 16, apc_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram_2") -ADDRESS_MAP_END - -/* -irq assignment: -(note: documentation shows ODA Printer at ir7 master, but clearly everything is shifted one place due of the - master-slave irq comms. This is trusted also because MS-DOS effectively wants FDC irq at ir4 slave) - -8259 master: -ir0 all stop (enabled at POST, unknown purpose) -ir1 Communication -ir2 Option -ir3 Timer -ir4 keyboard (almost trusted, check code at fe64a) -ir5 Option -ir6 Option -ir7 slave irq - -8259 slave: -ir0 ODA Printer -ir1 Option -ir2 Option -ir3 CRT -ir4 FDD -ir5 Option -ir6 Option -ir7 APU -*/ - -READ8_MEMBER(apc_state::get_slave_ack) -{ - if (offset==7) { // IRQ = 7 - return machine().device( "pic8259_slave" )->acknowledge(); - } - return 0x00; -} - -/**************************************** -* -* I8237 DMA interface -* -****************************************/ - -WRITE_LINE_MEMBER(apc_state::apc_dma_hrq_changed) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - m_dmac->hack_w(state); - -// printf("%02x HLDA\n",state); -} - -WRITE_LINE_MEMBER( apc_state::apc_tc_w ) -{ - /* floppy terminal count */ - m_fdc->tc_w(state); - -// printf("TC %02x\n",state); -} - -READ8_MEMBER(apc_state::apc_dma_read_byte) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - offs_t addr = (m_dma_offset[m_dack] << 16) | offset; - -// printf("%08x\n",addr); - - return program.read_byte(addr); -} - - -WRITE8_MEMBER(apc_state::apc_dma_write_byte) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - offs_t addr = (m_dma_offset[m_dack] << 16) | offset; - -// printf("%08x %02x\n",addr,data); - - program.write_byte(addr, data); -} - -inline void apc_state::set_dma_channel(int channel, int state) -{ - if (!state) m_dack = channel; -} - -WRITE_LINE_MEMBER(apc_state::apc_dack0_w){ /*printf("%02x 0\n",state);*/ set_dma_channel(0, state); } -WRITE_LINE_MEMBER(apc_state::apc_dack1_w){ /*printf("%02x 1\n",state);*/ set_dma_channel(1, state); } -WRITE_LINE_MEMBER(apc_state::apc_dack2_w){ /*printf("%02x 2\n",state);*/ set_dma_channel(2, state); } -WRITE_LINE_MEMBER(apc_state::apc_dack3_w){ /*printf("%02x 3\n",state);*/ set_dma_channel(3, state); } - -READ8_MEMBER(apc_state::fdc_r) -{ - return m_fdc->dma_r(); -} - -WRITE8_MEMBER(apc_state::fdc_w) -{ - m_fdc->dma_w(data); -} - -/* -CH0: CRT -CH1: FDC -CH2: ("reserved for future graphics expansion") -CH3: AUX -*/ - -static const floppy_format_type apc_floppy_formats[] = { - FLOPPY_D88_FORMAT, - FLOPPY_IMD_FORMAT, - FLOPPY_MFI_FORMAT, - NULL -}; - -static SLOT_INTERFACE_START( apc_floppies ) - SLOT_INTERFACE( "8", FLOPPY_8_DSDD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( apc, apc_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8086,MAIN_CLOCK) - MCFG_CPU_PROGRAM_MAP(apc_map) - MCFG_CPU_IO_MAP(apc_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(MAIN_CLOCK) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259_master", pic8259_device, ir3_w)) - MCFG_PIT8253_CLK1(MAIN_CLOCK) /* Memory Refresh */ - MCFG_PIT8253_CLK2(MAIN_CLOCK) /* RS-232c */ - - MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(apc_state,get_slave_ack) ) - MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL ) // TODO: check ir7_w - MCFG_DEVICE_ADD("i8237", AM9517A, MAIN_CLOCK) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(apc_state, apc_dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(apc_state, apc_tc_w)) - MCFG_I8237_IN_MEMR_CB(READ8(apc_state, apc_dma_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(apc_state, apc_dma_write_byte)) - MCFG_I8237_IN_IOR_1_CB(READ8(apc_state, fdc_r)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(apc_state, fdc_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(apc_state, apc_dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(apc_state, apc_dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(apc_state, apc_dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(apc_state, apc_dack3_w)) - - MCFG_NVRAM_ADD_1FILL("cmos") - MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL) - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("pic8259_slave", pic8259_device, ir4_w)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("i8237", am9517a_device, dreq1_w)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", apc_floppies, "8", apc_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", apc_floppies, "8", apc_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("disk_list","apc") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(apc_state, screen_update) - MCFG_SCREEN_SIZE(640, 494) - MCFG_SCREEN_VISIBLE_AREA(0*8, 640-1, 0*8, 494-1) - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", apc) - - MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 3579545) // unk clock - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map) - MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(apc_state, hgdc_draw_text) - - MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 3579545) // unk clock - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(apc_state, hgdc_display_pixels) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD( "upd1771c", UPD1771C, MAIN_CLOCK ) //uPD1771C-006 - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( apc ) - ROM_REGION( 0x2000, "ipl", ROMREGION_ERASE00 ) - ROM_LOAD16_BYTE( "pfbu2j.bin", 0x00000, 0x001000, CRC(86970df5) SHA1(be59c5dad3bd8afc21e9f2f1404553d4371978be) ) - ROM_LOAD16_BYTE( "pfbu2l.bin", 0x00001, 0x001000, CRC(38df2e70) SHA1(a37ccaea00c2b290610d354de08b489fa897ec48) ) - -// ROM_REGION( 0x10000, "file", ROMREGION_ERASE00 ) -// ROM_LOAD( "sioapc.o", 0, 0x10000, CRC(1) SHA1(1) ) - - ROM_REGION( 0x2000, "gfx", ROMREGION_ERASE00 ) - ROM_LOAD("pfcu1r.bin", 0x000000, 0x002000, CRC(683efa94) SHA1(43157984a1746b2e448f3236f571011af9a3aa73) ) - - ROM_REGION( 0x2000, "aux_pcg", ROMREGION_ERASE00 ) -ROM_END - -DRIVER_INIT_MEMBER(apc_state,apc) -{ - // ... -} - -COMP( 1982, apc, 0, 0, apc, apc, apc_state, apc, "NEC", "APC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/apexc.c b/src/mess/drivers/apexc.c deleted file mode 100644 index afeeae693bc..00000000000 --- a/src/mess/drivers/apexc.c +++ /dev/null @@ -1,911 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet, Robbbert -/* - drivers/apexc.c : APEXC driver - - By Raphael Nabet - - see cpu/apexc.c for background and tech info -*/ - -#include "emu.h" -#include "cpu/apexc/apexc.h" - - -class apexc_state : public driver_device -{ -public: - apexc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_screen(*this, "screen") { } - - UINT32 m_panel_data_reg; /* value of a data register on the control panel which can - be edited - the existence of this register is a personnal - guess */ - - bitmap_ind16 *m_bitmap; - - UINT32 m_old_edit_keys; - int m_old_control_keys; - - int m_letters; - int m_pos; - DECLARE_DRIVER_INIT(apexc); - virtual void machine_start(); - virtual void video_start(); - DECLARE_PALETTE_INIT(apexc); - UINT32 screen_update_apexc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(apexc_interrupt); - DECLARE_READ8_MEMBER(tape_read); - DECLARE_WRITE8_MEMBER(tape_write); - void apexc_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); - void apexc_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color); - void apexc_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color); - void apexc_teletyper_init(); - void apexc_teletyper_linefeed(); - void apexc_teletyper_putchar(int character); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_screen; -}; - -void apexc_state::machine_start() -{ - apexc_teletyper_init(); -} - - -/* - APEXC RAM loading/saving from cylinder image - - Note that, in an actual APEXC, the RAM contents are not read from the cylinder : - the cylinder IS the RAM. - - This feature is important : of course, the tape reader allows to enter programs, but you - still need an object code loader in memory. (Of course, the control panel enables - the user to enter such a loader manually, but it would take hours...) -*/ - -class apexc_cylinder_image_device : public device_t, public device_image_interface -{ -public: - // construction/destruction - apexc_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_CYLINDER; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 0; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 1; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "apc"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -private: - int m_writable; -}; - -const device_type APEXC_CYLINDER = &device_creator; - -apexc_cylinder_image_device::apexc_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, APEXC_CYLINDER, "APEXC Cylinder", tag, owner, clock, "apexc_cylinder_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -/* - Open cylinder image and read RAM -*/ -bool apexc_cylinder_image_device::call_load() -{ - /* load RAM contents */ - m_writable = !is_readonly(); - - fread( machine().root_device().memregion("maincpu")->base(), 0x1000); -#ifdef LSB_FIRST - { /* fix endianness */ - UINT32 *RAM = (UINT32 *)(machine().root_device().memregion("maincpu")->base()); - - for (int i=0; i < 0x0400; i++) - RAM[i] = BIG_ENDIANIZE_INT32(RAM[i]); - } -#endif - - return IMAGE_INIT_PASS; -} - -/* - Save RAM to cylinder image and close it -*/ -void apexc_cylinder_image_device::call_unload() -{ - if (m_writable) - { /* save RAM contents */ - /* rewind file */ - fseek(0, SEEK_SET); -#ifdef LSB_FIRST - { /* fix endianness */ - UINT32 *RAM = (UINT32 *)(machine().root_device().memregion("maincpu")->base()); - - for (int i=0; i < /*0x2000*/0x0400; i++) - RAM[i] = BIG_ENDIANIZE_INT32(RAM[i]); - } -#endif - /* write */ - fwrite(machine().root_device().memregion("maincpu")->base(), /*0x8000*/0x1000); - } -} - - -#define MCFG_APEXC_CYLINDER_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, APEXC_CYLINDER, 0) - - -/* - APEXC tape support - - APEXC does all I/O on paper tape. There are 5 punch rows on tape. - - Both a reader (read-only), and a puncher (write-only) are provided. - - Tape output can be fed into a teletyper, in order to have text output : - - code Symbol - (binary) Letters Figures - 00000 0 - 00001 T 1 - 00010 B 2 - 00011 O 3 - 00100 E 4 - 00101 H 5 - 00110 N 6 - 00111 M 7 - 01000 A 8 - 01001 L 9 - 01010 R + - 01011 G - - 01100 I z - 01101 P . - 01110 C d - 01111 V = - 10000 Space - 10001 Z y - 10010 D theta (greek letter) - 10011 Line Space (i.e. LF) - 10100 S , - 10101 Y Sigma (greek letter) - 10110 F x - 10111 X / - 11000 Carriage Return - 11001 W phi (greek letter) - 11010 J - (dash ?) - 11011 Figures - 11100 U pi (greek letter) - 11101 Q ) - 11110 K ( - 11111 Letters -*/ - -class apexc_tape_puncher_image_device : public device_t, public device_image_interface -{ -public: - // construction/destruction - apexc_tape_puncher_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } - - virtual bool is_readable() const { return 0; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "tap"; } - virtual const option_guide *create_option_guide() const { return NULL; } -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type APEXC_TAPE_PUNCHER = &device_creator; - -apexc_tape_puncher_image_device::apexc_tape_puncher_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, APEXC_TAPE_PUNCHER, "APEXC Tape Puncher", tag, owner, clock, "apexc_tape_puncher_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -#define MCFG_APEXC_TAPE_PUNCHER_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, APEXC_TAPE_PUNCHER, 0) - -class apexc_tape_reader_image_device : public device_t, public device_image_interface -{ -public: - // construction/destruction - apexc_tape_reader_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 0; } - virtual bool is_creatable() const { return 0; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "tap"; } - virtual const option_guide *create_option_guide() const { return NULL; } -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type APEXC_TAPE_READER = &device_creator; - -apexc_tape_reader_image_device::apexc_tape_reader_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, APEXC_TAPE_READER, "APEXC Tape Reader", tag, owner, clock, "apexc_tape_reader_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -#define MCFG_APEXC_TAPE_READER_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, APEXC_TAPE_READER, 0) - -/* - Open a tape image -*/ - -READ8_MEMBER(apexc_state::tape_read) -{ - device_t *device = machine().device("tape_reader"); - UINT8 reply; - device_image_interface *image = dynamic_cast(device); - - if (image->exists() && (image->fread(& reply, 1) == 1)) - return reply & 0x1f; - else - return 0; /* unit not ready - I don't know what we should do */ -} - -WRITE8_MEMBER(apexc_state::tape_write) -{ - device_t *device = machine().device("tape_puncher"); - UINT8 data5 = (data & 0x1f); - device_image_interface *image = dynamic_cast(device); - - if (image->exists()) - image->fwrite(& data5, 1); - - apexc_teletyper_putchar(data & 0x1f); /* display on screen */ -} - -/* - APEXC control panel - - I know really little about the details, although the big picture is obvious. - - Things I know : - * "As well as starting and stopping the machine, [it] enables information to be inserted - manually and provides for the inspection of the contents of the memory via various - storage registers." (Booth, p. 2) - * "Data can be inserted manually from the control panel [into the control register]". - (Booth, p. 3) - * The contents of the R register can be edited, too. A button allows to clear - a complete X (or Y ???) field. (forgot the reference, but must be somewhere in Booth) - * There is no trace mode (Booth, p. 213) - - Since the control panel is necessary for the operation of the APEXC, I tried to - implement a commonplace control panel. I cannot tell how close the feature set and - operation of this control panel is to the original APEXC control panel, but it - cannot be too different in the basic principles. -*/ - - -#if 0 -/* defines for input port numbers */ -enum -{ - panel_control = 0, - panel_edit1, - panel_edit2 -}; -#endif - - -/* defines for each bit and mask in input port panel_control */ -enum -{ - /* bit numbers */ - panel_run_bit = 0, - panel_CR_bit, - panel_A_bit, - panel_R_bit, - panel_HB_bit, - panel_ML_bit, - panel_mem_bit, - panel_write_bit, - - /* masks */ - panel_run = (1 << panel_run_bit), - panel_CR = (1 << panel_CR_bit), - panel_A = (1 << panel_A_bit), - panel_R = (1 << panel_R_bit), - panel_HB = (1 << panel_HB_bit), - panel_ML = (1 << panel_ML_bit), - panel_mem = (1 << panel_mem_bit), - panel_write = (1 << panel_write_bit) -}; - -/* fake input ports with keyboard keys */ -static INPUT_PORTS_START(apexc) - - PORT_START("panel") /* 0 : panel control */ - PORT_BIT(panel_run, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Run/Stop") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(panel_CR, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read CR") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(panel_A, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read A") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(panel_R, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read R") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(panel_HB, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read HB") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(panel_ML, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read ML") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(panel_mem, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read mem") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(panel_write, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Write instead of read") PORT_CODE(KEYCODE_LSHIFT) - - PORT_START("data") /* data edit */ - PORT_BIT(0x80000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x40000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x20000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x08000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x02000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x01000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #10") PORT_CODE(KEYCODE_0) - PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #11") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #12") PORT_CODE(KEYCODE_W) - PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #13") PORT_CODE(KEYCODE_E) - PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #14") PORT_CODE(KEYCODE_R) - PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #15") PORT_CODE(KEYCODE_T) - PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #16") PORT_CODE(KEYCODE_Y) - - PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #17") PORT_CODE(KEYCODE_U) - PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #18") PORT_CODE(KEYCODE_I) - PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #19") PORT_CODE(KEYCODE_O) - PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #20") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #21") PORT_CODE(KEYCODE_A) - PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #22") PORT_CODE(KEYCODE_S) - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #23") PORT_CODE(KEYCODE_D) - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #24") PORT_CODE(KEYCODE_F) - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #25") PORT_CODE(KEYCODE_G) - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #26") PORT_CODE(KEYCODE_H) - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #27") PORT_CODE(KEYCODE_J) - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #28") PORT_CODE(KEYCODE_K) - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #29") PORT_CODE(KEYCODE_L) - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #30") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #31") PORT_CODE(KEYCODE_X) - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #32") PORT_CODE(KEYCODE_C) -INPUT_PORTS_END - - -/* - Not a real interrupt - just handle keyboard input -*/ -INTERRUPT_GEN_MEMBER(apexc_state::apexc_interrupt) -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT32 edit_keys; - int control_keys; - - int control_transitions; - - - /* read new state of edit keys */ - edit_keys = ioport("data")->read(); - - /* toggle data reg according to transitions */ - m_panel_data_reg ^= edit_keys & (~m_old_edit_keys); - - /* remember new state of edit keys */ - m_old_edit_keys = edit_keys; - - - /* read new state of control keys */ - control_keys = ioport("panel")->read(); - - /* compute transitions */ - control_transitions = control_keys & (~m_old_control_keys); - - /* process commands */ - - if (control_transitions & panel_run) - { /* toggle run/stop state */ - device.state().set_state_int(APEXC_STATE, ! device.state().state_int(APEXC_STATE)); - } - - while (control_transitions & (panel_CR | panel_A | panel_R | panel_ML | panel_HB)) - { /* read/write a register */ - /* note that we must take into account the possibility of simulteanous keypresses - (which would be a goofy thing to do when reading, but a normal one when writing, - if the user wants to clear several registers at once) */ - int reg_id = -1; - - /* determinate value of reg_id */ - if (control_transitions & panel_CR) - { /* CR register selected ? */ - control_transitions &= ~panel_CR; /* clear so that it is ignored on next iteration */ - reg_id = APEXC_CR; /* matching register ID */ - } - else if (control_transitions & panel_A) - { - control_transitions &= ~panel_A; - reg_id = APEXC_A; - } - else if (control_transitions & panel_R) - { - control_transitions &= ~panel_R; - reg_id = APEXC_R; - } - else if (control_transitions & panel_HB) - { - control_transitions &= ~panel_HB; - reg_id = APEXC_WS; - } - else if (control_transitions & panel_ML) - { - control_transitions &= ~panel_ML; - reg_id = APEXC_ML; - } - - if (-1 != reg_id) - { - /* read/write register #reg_id */ - if (control_keys & panel_write) - /* write reg */ - device.state().set_state_int(reg_id, m_panel_data_reg); - else - /* read reg */ - m_panel_data_reg = device.state().state_int(reg_id); - } - } - - if (control_transitions & panel_mem) - { /* read/write memory */ - - if (control_keys & panel_write) { - /* write memory */ - space.write_dword(device.state().state_int(APEXC_ML_FULL)<<2, m_panel_data_reg); - } - else { - /* read memory */ - m_panel_data_reg = space.read_dword(device.state().state_int(APEXC_ML_FULL)<<2); - } - } - - /* remember new state of control keys */ - m_old_control_keys = control_keys; -} - -/* - apexc video emulation. - - Since the APEXC has no video display, we display the control panel. - - Additionnally, We display one page of teletyper output. -*/ - -static const rgb_t apexc_palette[] = -{ - rgb_t::white, - rgb_t::black, - rgb_t(255, 0, 0), - rgb_t(50, 0, 0) -}; - -#if 0 -static const unsigned short apexc_colortable[] = -{ - 0, 1 -}; -#endif - -#define APEXC_PALETTE_SIZE ARRAY_LENGTH(apexc_palette) -#define APEXC_COLORTABLE_SIZE sizeof(apexc_colortable)/2 - -enum -{ - /* size and position of panel window */ - panel_window_width = 256, - panel_window_height = 64, - panel_window_offset_x = 0, - panel_window_offset_y = 0, - /* size and position of teletyper window */ - teletyper_window_width = 256, - teletyper_window_height = 128, - teletyper_window_offset_x = 0, - teletyper_window_offset_y = panel_window_height -}; - -static const rectangle panel_window( - panel_window_offset_x, panel_window_offset_x+panel_window_width-1, /* min_x, max_x */ - panel_window_offset_y, panel_window_offset_y+panel_window_height-1/* min_y, max_y */ -); -static const rectangle teletyper_window( - teletyper_window_offset_x, teletyper_window_offset_x+teletyper_window_width-1, /* min_x, max_x */ - teletyper_window_offset_y, teletyper_window_offset_y+teletyper_window_height-1/* min_y, max_y */ -); -enum -{ - teletyper_scroll_step = 8 -}; -static const rectangle teletyper_scroll_clear_window( - teletyper_window_offset_x, teletyper_window_offset_x+teletyper_window_width-1, /* min_x, max_x */ - teletyper_window_offset_y+teletyper_window_height-teletyper_scroll_step, teletyper_window_offset_y+teletyper_window_height-1 /* min_y, max_y */ -); -//static const int var_teletyper_scroll_step = - teletyper_scroll_step; - -PALETTE_INIT_MEMBER(apexc_state, apexc) -{ - palette.set_pen_colors(0, apexc_palette, APEXC_PALETTE_SIZE); -} - -void apexc_state::video_start() -{ - int width = m_screen->width(); - int height = m_screen->height(); - - m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); - m_bitmap->fill(0, /*machine().visible_area*/teletyper_window); -} - -/* draw a small 8*8 LED (well, there were no LEDs at the time, so let's call this a lamp ;-) ) */ -void apexc_state::apexc_draw_led(bitmap_ind16 &bitmap, int x, int y, int state) -{ - int xx, yy; - - for (yy=1; yy<7; yy++) - for (xx=1; xx<7; xx++) - bitmap.pix16(y+yy, x+xx) = state ? 2 : 3; -} - -/* write a single char on screen */ -void apexc_state::apexc_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color) -{ - m_gfxdecode->gfx(0)->transpen(bitmap,bitmap.cliprect(), character-32, color, 0, 0, - x+1, y, 0); -} - -/* write a string on screen */ -void apexc_state::apexc_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) -{ - while (* buf) - { - apexc_draw_char(bitmap, *buf, x, y, color); - - x += 8; - buf++; - } -} - - -UINT32 apexc_state::screen_update_apexc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int i; - char the_char; - - bitmap.fill(0, /*machine().visible_area*/panel_window); - apexc_draw_string(bitmap, "power", 8, 0, 0); - apexc_draw_string(bitmap, "running", 8, 8, 0); - apexc_draw_string(bitmap, "data :", 0, 24, 0); - - copybitmap(bitmap, *m_bitmap, 0, 0, 0, 0, teletyper_window); - - - apexc_draw_led(bitmap, 0, 0, 1); - - apexc_draw_led(bitmap, 0, 8, m_maincpu->state_int(APEXC_STATE)); - - for (i=0; i<32; i++) - { - apexc_draw_led(bitmap, i*8, 32, (m_panel_data_reg << i) & 0x80000000UL); - the_char = '0' + ((i + 1) % 10); - apexc_draw_char(bitmap, the_char, i*8, 40, 0); - if (((i + 1) % 10) == 0) - { - the_char = '0' + ((i + 1) / 10); - apexc_draw_char(bitmap, the_char, i*8, 48, 0); - } - } - return 0; -} - -void apexc_state::apexc_teletyper_init() -{ - m_letters = FALSE; - m_pos = 0; -} - -void apexc_state::apexc_teletyper_linefeed() -{ - UINT8 buf[teletyper_window_width]; - int y; - - for (y=teletyper_window_offset_y; ypens()); - } - - m_bitmap->fill(0, teletyper_scroll_clear_window); -} - -void apexc_state::apexc_teletyper_putchar(int character) -{ - static const char ascii_table[2][32] = - { - { - '0', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', '+', '-', - 'z', '.', 'd', '=', - ' ', 'y', /*'@'*/'\200'/*theta*/,'\n'/*Line Space*/, - ',', /*'&'*/'\201'/*Sigma*/,'x', '/', - '\r'/*Carriage Return*/,/*'!'*/'\202'/*Phi*/,'_'/*???*/, '\0'/*Figures*/, - /*'#'*/'\203'/*pi*/,')', '(', '\0'/*Letters*/ - }, - { - ' '/*???*/, 'T', 'B', 'O', - 'E', 'H', 'N', 'M', - 'A', 'L', 'R', 'G', - 'I', 'P', 'C', 'V', - ' ', 'Z', 'D', '\n'/*Line Space*/, - 'S', 'Y', 'F', 'X', - '\r'/*Carriage Return*/,'W', 'J', '\0'/*Figures*/, - 'U', 'Q', 'K', '\0'/*Letters*/ - } - }; - - char buffer[2] = "x"; - - character &= 0x1f; - - switch (character) - { - case 19: - /* Line Space */ - apexc_teletyper_linefeed(); - break; - - case 24: - /* Carriage Return */ - m_pos = 0; - break; - - case 27: - /* Figures */ - m_letters = FALSE; - break; - - case 31: - /* Letters */ - m_letters = TRUE; - break; - - default: - /* Any printable character... */ - - if (m_pos >= 32) - { /* if past right border, wrap around */ - apexc_teletyper_linefeed(); /* next line */ - m_pos = 0; /* return to start of line */ - } - - /* print character */ - buffer[0] = ascii_table[m_letters][character]; /* lookup ASCII equivalent in table */ - buffer[1] = '\0'; /* terminate string */ - apexc_draw_string(*m_bitmap, buffer, 8*m_pos, 176, 0); /* print char */ - m_pos++; /* step carriage forward */ - - break; - } -} - -enum -{ - apexc_charnum = /*96+4*/128, /* ASCII set + 4 special characters */ - /* for whatever reason, 96+4 breaks greek characters */ - - apexcfontdata_size = 8 * apexc_charnum -}; - -/* apexc driver init : builds a font for use by the teletyper */ -DRIVER_INIT_MEMBER(apexc_state,apexc) -{ - UINT8 *dst; - - static const unsigned char fontdata6x8[apexcfontdata_size] = - { /* ASCII characters */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, - 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00, - 0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08, - 0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00, - 0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00, - 0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00, - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00, - 0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00, - 0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, - 0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00, - 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00, - 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60, - 0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, - 0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, - 0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, - 0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, - 0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, - 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00, - 0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, - 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, - 0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08, - 0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00, - 0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00, - 0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00, - 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00, - 0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc, - 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, - 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00, - 0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, - 0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, - 0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00, - 0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00, - 0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, - 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, - 0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, - 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00, - 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00, - 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, - 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, - 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00, - - /* theta */ - 0x70, - 0x88, - 0x88, - 0xF8, - 0x88, - 0x88, - 0x70, - 0x00, - - /* Sigma */ - 0xf8, - 0x40, - 0x20, - 0x10, - 0x20, - 0x40, - 0xf8, - 0x00, - - /* Phi */ - 0x20, - 0x70, - 0xA8, - 0xA8, - 0xA8, - 0xA8, - 0x70, - 0x20, - - /* pi */ - 0x00, - 0x00, - 0xF8, - 0x50, - 0x50, - 0x50, - 0x50, - 0x00 - }; - - dst = memregion("chargen")->base(); - - memcpy(dst, fontdata6x8, apexcfontdata_size); -} - -static const gfx_layout fontlayout = -{ - 6, 8, /* 6*8 characters */ - apexc_charnum, /* 96+4 characters */ - 1, /* 1 bit per pixel */ - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ -}; - -static GFXDECODE_START( apexc ) - GFXDECODE_ENTRY( "chargen", 0, fontlayout, 0, 2 ) -GFXDECODE_END - - -static ADDRESS_MAP_START(apexc_mem_map, AS_PROGRAM, 32, apexc_state ) -#if 0 - AM_RANGE(0x0000, 0x03ff) AM_RAM /* 1024 32-bit words (expandable to 8192) */ - AM_RANGE(0x0400, 0x1fff) AM_NOP -#else - AM_RANGE(0x0000, 0x0fff) AM_RAM AM_REGION("maincpu", 0x0000) - AM_RANGE(0x1000, 0x7fff) AM_NOP -#endif -ADDRESS_MAP_END - -static ADDRESS_MAP_START(apexc_io_map, AS_IO, 8, apexc_state ) - AM_RANGE(0x00, 0x00) AM_READ(tape_read) - AM_RANGE(0x00, 0x00) AM_WRITE(tape_write) -ADDRESS_MAP_END - - -static MACHINE_CONFIG_START( apexc, apexc_state ) - - /* basic machine hardware */ - /* APEXC CPU @ 2.0 kHz (memory word clock frequency) */ - MCFG_CPU_ADD("maincpu", APEXC, 2000) - /*MCFG_CPU_CONFIG(NULL)*/ - MCFG_CPU_PROGRAM_MAP(apexc_mem_map) - MCFG_CPU_IO_MAP(apexc_io_map) - /* dummy interrupt: handles the control panel */ - MCFG_CPU_VBLANK_INT_DRIVER("screen", apexc_state, apexc_interrupt) - - - /* video hardware does not exist, but we display a control panel and the typewriter output */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 192) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 192-1) - MCFG_SCREEN_UPDATE_DRIVER(apexc_state, screen_update_apexc) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", apexc) - MCFG_PALETTE_ADD("palette", APEXC_PALETTE_SIZE) - MCFG_PALETTE_INIT_OWNER(apexc_state, apexc) - - - MCFG_APEXC_CYLINDER_ADD("cylinder") - MCFG_APEXC_TAPE_PUNCHER_ADD("tape_puncher") - MCFG_APEXC_TAPE_READER_ADD("tape_reader") -MACHINE_CONFIG_END - -ROM_START(apexc) - /*CPU memory space*/ - ROM_REGION32_BE(0x10000, "maincpu", ROMREGION_ERASEFF) - /* Note this computer has no ROM... */ - - ROM_REGION(apexcfontdata_size, "chargen", ROMREGION_ERASEFF) - /* space filled with our font */ -ROM_END - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -//COMP( 1951, apexc53, 0, 0, apexc53, apexc, apexc_state, apexc, "Andrew Donald Booth", "All Purpose Electronic X-ray Computer (as described in 1953)" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1955, apexc, 0, 0, apexc, apexc, apexc_state, apexc, "Andrew Donald Booth", "All Purpose Electronic X-ray Computer (as described in 1957)" , MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/apf.c b/src/mess/drivers/apf.c deleted file mode 100644 index 8509777d21b..00000000000 --- a/src/mess/drivers/apf.c +++ /dev/null @@ -1,605 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/****************************************************************************** - -Driver completely rewritten by Robbbert in a process begun on 2014-01-22. - -Based on the previous work done by PeT around February 2008, and possible others prior. - added apfm1000 cartridge loading - fixed apfm1000 pads - added apf video mode - - -APF M1000/MP1000 and Imagination Machine ----------------------------------------- -- The M1000 contains the video RAM, ROM, CPU, PIA0, handsets, Video and cart slot, and thus was a TV Game computer. -- The MPA-10 was a base unit containing the main keyboard, custom cassette recorder, 8k RAM and PIA1. -- When the two were joined, they formed the Imagination Machine. -- Although the BASIC cart could be plugged into the M1000, it could not be used as it needs the main keyboard. -- BB-01 Building Block - provides 4 cart slots. Includes a RS-232 cart for a printer or modem. -- R8-K 8K RAM Expansion cart. -- FI-100 Minifloppy Disk Interface Cartridge - drives 1 or 2 D100-0 floppy drives on AS-400 bus. -- D100-0 Floppy drive 5 1/4" -- A cassette program must be loaded on the same memory size it was saved from. Since the standard machine - had 8K, almost all tapes require this exact amount of RAM to be present -- The cart-slot is physically the same as the Arcadia 2001. - - -RAM switch ----------- -- The M1000 only had available the 1K video ram (0000-03FF) -- Space Destroyer needs more, so it includes another 1K in the cart -- The MPA-10 base includes 8K of RAM (A000-BFFF) (-ram 8K) -- A very few games need 16K which requires hacking the pcb (-ram 16K) -- Basic will work with 8K or 16K. - - -Status of cart-based games --------------------------- -backgammon - works, needs offset of 0x120, bottom line is coming from 0x3E0, should be 0x380 -baseball - works, needs offset of 0x200, some bad colours -basic - works in apfimag only (as designed) -blackjack - works, some bad colours -bowling - works -boxing - works -brickdown - works -columns - runs but seems to be buggy -casino - appears to work (need instructions) -catena - works -hangman - works -pinball - works -movblock - works -rocket patrol - works, some bad colours -space destroyer - works -ufo - works - - -ToDo: ------ -- When pasting a large program, characters can be lost -- Some bad colours or graphics -- Tape loading is not very reliable -- Add back the disk support when we can get some info on it - (6600, 6500-6503 wd179x disc controller? 6400, 6401) -- Need to add back the disk format in the new wdc code - (40 tracks, 1 head, 8 sectors, 256 bytes sector length, first sector id 1) -- Need disk-based software - - -******************************************************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "video/mc6847.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "machine/6821pia.h" -#include "machine/wd_fdc.h" -#include "imagedev/cassette.h" -#include "formats/apf_apt.h" -#include "machine/ram.h" - -#include "bus/apf/slot.h" -#include "bus/apf/rom.h" - - -class apf_state : public driver_device -{ -public: - apf_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_has_cart_ram(false) - , m_maincpu(*this, "maincpu") - , m_ram(*this, RAM_TAG) - , m_crtc(*this, "mc6847") - , m_speaker(*this, "speaker") - , m_pia0(*this, "pia0") - , m_pia1(*this, "pia1") - , m_cass(*this, "cassette") - , m_cart(*this, "cartslot") - , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - , m_joy(*this, "joy") - , m_key(*this, "key") - , m_p_videoram(*this, "videoram") - { } - - DECLARE_READ8_MEMBER(videoram_r); - DECLARE_READ8_MEMBER(pia0_porta_r); - DECLARE_WRITE8_MEMBER(pia0_portb_w); - DECLARE_WRITE_LINE_MEMBER(pia0_ca2_w); - DECLARE_READ8_MEMBER(pia1_porta_r); - DECLARE_READ8_MEMBER(pia1_portb_r); - DECLARE_WRITE8_MEMBER(pia1_portb_w); - DECLARE_WRITE8_MEMBER(apf_dischw_w); - DECLARE_READ8_MEMBER(serial_r); - DECLARE_WRITE8_MEMBER(serial_w); - -private: - UINT8 m_latch; - UINT8 m_keyboard_data; - UINT8 m_pad_data; - UINT8 m_portb; - bool m_ca2; - bool m_has_cart_ram; - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - optional_device m_ram; - required_device m_crtc; - required_device m_speaker; - required_device m_pia0; - optional_device m_pia1; - optional_device m_cass; - required_device m_cart; - optional_device m_fdc; - optional_device m_floppy0; - optional_device m_floppy1; - required_ioport_array<4> m_joy; - optional_ioport_array<8> m_key; - required_shared_ptr m_p_videoram; -}; - - -READ8_MEMBER( apf_state::videoram_r ) -{ - if BIT(m_pad_data, 7) // AG line - { - // Need the cpu and crtc to be locked together for proper graphics - // This is a hack to fix Rocket Patrol and Blackjack - if (BIT(m_pad_data, 6) && !m_has_cart_ram) - offset -= 0x400; - - // This is a hack to fix Space Destroyer - if (BIT(m_pad_data, 6) && m_has_cart_ram) - offset -= 0x120; - - UINT16 part1 = offset & 0x1f; - UINT16 part2 = (offset & 0x1e0) >> 5; - UINT16 part3 = (offset & 0x1e00) >> 4; - if (m_ca2) m_latch = m_p_videoram[part3 | part1]; // get chr - m_crtc->css_w(BIT(m_latch, 6)); - UINT16 latch = (m_latch & 0x1f) << 4; - return m_p_videoram[latch | part2 | 0x200]; // get gfx - } - else - { - UINT8 data = m_p_videoram[(offset & 0x1ff) | 0x200]; - if (m_ca2) m_crtc->css_w(BIT(data, 6)); - m_crtc->inv_w(BIT(data, 6)); - m_crtc->as_w(BIT(data, 7)); - return data; - } -} - -READ8_MEMBER( apf_state::pia0_porta_r ) -{ - UINT8 data = 0xff; - - for (int i = 3; i >= 0; i--) - if (!BIT(m_pad_data, i)) - data &= m_joy[i]->read(); - - return data; -} - -WRITE8_MEMBER( apf_state::pia0_portb_w ) -{ - /* bit 7..6 video control */ - m_crtc->ag_w(BIT(data, 7)); - m_crtc->gm0_w(BIT(data, 6)); - - /* bit 3..0 keypad line select */ - m_pad_data = data; -} - -WRITE_LINE_MEMBER( apf_state::pia0_ca2_w ) -{ - m_ca2 = state; -} - -READ8_MEMBER( apf_state::pia1_porta_r ) -{ - return m_key[m_keyboard_data]->read(); -} - -READ8_MEMBER( apf_state::pia1_portb_r ) -{ - UINT8 data = m_portb; - - if (m_cass->input() > 0.0038) - data |= 0x80; - - return data; -} - - -WRITE8_MEMBER( apf_state::pia1_portb_w ) -{ - /* bits 2..0 = keyboard line */ - /* bit 3 = cass audio enable */ - /* bit 4 = cassette motor */ - /* bit 5 = /cass write enable */ - /* bit 6 = cass out */ - /* bit 7 = cass in */ - - m_portb = data & 0x7f; - m_keyboard_data = data & 7; - - m_cass->change_state(BIT(data, 4) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - if (!BIT(data, 5)) - m_cass->output(BIT(data, 6) ? -1.0 : 1.0); -} - - -void apf_state::machine_start() -{ - if (m_cart->exists()) - { - switch (m_cart->get_type()) - { - case APF_BASIC: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x6800, 0x7fff, read8_delegate(FUNC(apf_cart_slot_device::extra_rom),(apf_cart_slot_device*)m_cart)); - break; - case APF_SPACEDST: - m_maincpu->space(AS_PROGRAM).unmap_readwrite(0x9800, 0x9fff); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9800, 0x9bff, read8_delegate(FUNC(apf_cart_slot_device::read_ram),(apf_cart_slot_device*)m_cart), write8_delegate(FUNC(apf_cart_slot_device::write_ram),(apf_cart_slot_device*)m_cart)); - m_has_cart_ram = true; - break; - } - - m_cart->save_ram(); - } -} - - -void apf_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - m_portb = 0; - m_ca2 = 0; - - // apfimag only - if (m_ram) - { - /* if we specified 8K of RAM, delete the extended RAM */ - if (m_ram->size() < 16*1024) - space.unmap_readwrite(0xc000, 0xdfff); - // this is a hack to get 'columns' to work. It misbehaves if a000-a003 are all zero - else - space.write_byte(0xa002, 0xe5); - } -} - -WRITE8_MEMBER( apf_state::apf_dischw_w) -{ - /* bit 3 is index of drive to select */ - UINT8 drive = BIT(data, 3); - - floppy_image_device *floppy = NULL; - if (drive) - floppy = m_floppy1->get_device(); - else - floppy = m_floppy0->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - } - - logerror("disc w %04x %04x\n",offset,data); -} - -READ8_MEMBER( apf_state::serial_r) -{ - logerror("serial r %04x\n",offset); - return 0; -} - -WRITE8_MEMBER( apf_state::serial_w) -{ - logerror("serial w %04x %04x\n",offset,data); -} - -static ADDRESS_MAP_START( apfm1000_map, AS_PROGRAM, 8, apf_state ) - AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x2000, 0x3fff) AM_MIRROR(0x1ffc) AM_DEVREADWRITE("pia0", pia6821_device, read, write) - AM_RANGE(0x4000, 0x4fff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0x6800, 0x7fff) AM_NOP // BASIC accesses ROM here too, but this is installed at machine_start - AM_RANGE(0x8000, 0x9fff) AM_DEVREAD("cartslot", apf_cart_slot_device, read_rom) - AM_RANGE(0xe000, 0xefff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( apfimag_map, AS_PROGRAM, 8, apf_state ) - AM_IMPORT_FROM(apfm1000_map) - AM_RANGE(0x6000, 0x63ff) AM_MIRROR(0x03fc) AM_DEVREADWRITE("pia1", pia6821_device, read, write) - // These need to be confirmed, disk does not work - AM_RANGE(0x6400, 0x64ff) AM_READWRITE(serial_r, serial_w) - AM_RANGE(0x6500, 0x6503) AM_DEVREADWRITE("fdc", fd1771_t, read, write) - AM_RANGE(0x6600, 0x6600) AM_WRITE(apf_dischw_w) - AM_RANGE(0xa000, 0xbfff) AM_RAM // standard - AM_RANGE(0xc000, 0xdfff) AM_RAM // expansion -ADDRESS_MAP_END - - -/* Each controller has these features: - - 1 8-way joystick - 1 big red fire button on the upper side - 12-keys keypad with the following layout - - 7 8 9 0 - 4 5 6 Cl - 1 2 3 En - - On the control panel of the M-1000 there are two big buttons: a Reset key and the Power switch - - Reference: http://www.nausicaa.net/~lgreenf/apfpage2.htm -*/ - -static INPUT_PORTS_START( apfm1000 ) - -/* - This simple Basic program can be used to read the joysticks and the keyboard: - - 10 PRINT KEY$(n); - 20 GOTO 10 - - where n = 0, 1 or 2 - 0 = keyboard, 1,2 = joysticks #1 and #2 - - When reading the keyboard KEY$(0) returns the character associated to the key, with the - following exceptions: - - Ctrl = CHR$(1) - Rept = CHR$(2) - Here Is = CHR$(4) - Rubout = CHR$(8) - - When reading the joysticks, KEY$() = "N", "S", "E", "W" for the directions - "0" - "9" for the keypad digits - "?" for "Cl" - "!" for "En" - - - ? player right is player 1 -*/ - - PORT_START("joy.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 1") PORT_CODE(KEYCODE_1) PORT_PLAYER(2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 0") PORT_CODE(KEYCODE_0) PORT_PLAYER(2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 4") PORT_CODE(KEYCODE_4) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 7") PORT_CODE(KEYCODE_7) PORT_PLAYER(2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 1") PORT_CODE(KEYCODE_1_PAD) PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 0") PORT_CODE(KEYCODE_0_PAD) PORT_PLAYER(1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 4") PORT_CODE(KEYCODE_4_PAD) PORT_PLAYER(1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 7") PORT_CODE(KEYCODE_7_PAD) PORT_PLAYER(1) - - PORT_START("joy.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("PAD 1/RIGHT down") PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("PAD 1/RIGHT right") PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 1/RIGHT up") PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("PAD 1/RIGHT left") PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("PAD 2/LEFT down") PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("PAD 2/LEFT right") PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 2/LEFT up") PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("PAD 2/LEFT left") PORT_PLAYER(1) PORT_8WAY - - PORT_START("joy.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 3") PORT_CODE(KEYCODE_3) PORT_PLAYER(2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT clear") PORT_CODE(KEYCODE_DEL) PORT_PLAYER(2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 6") PORT_CODE(KEYCODE_6) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 9") PORT_CODE(KEYCODE_9) PORT_PLAYER(2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 3") PORT_CODE(KEYCODE_3_PAD) PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT clear") PORT_CODE(KEYCODE_DEL_PAD) PORT_PLAYER(1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 6") PORT_CODE(KEYCODE_6_PAD) PORT_PLAYER(1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 9") PORT_CODE(KEYCODE_9_PAD) PORT_PLAYER(1) - - PORT_START("joy.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 2") PORT_CODE(KEYCODE_2) PORT_PLAYER(2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT enter/fire") PORT_CODE(KEYCODE_ENTER) PORT_PLAYER(2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 5") PORT_CODE(KEYCODE_5) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 8") PORT_CODE(KEYCODE_8) PORT_PLAYER(2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 2") PORT_CODE(KEYCODE_2_PAD) PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT enter/fire") PORT_CODE(KEYCODE_ENTER_PAD) PORT_PLAYER(1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 5") PORT_CODE(KEYCODE_5_PAD) PORT_PLAYER(1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 8") PORT_CODE(KEYCODE_8_PAD) PORT_PLAYER(1) -INPUT_PORTS_END - - -static INPUT_PORTS_START( apfimag ) - - PORT_INCLUDE( apfm1000 ) - - /* Reference: http://www.nausicaa.net/~lgreenf/apfpage2.htm */ - - PORT_START("key.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q IF") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \" LET") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! GOSUB") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W STEP") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - - PORT_START("key.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R READ") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # DATA") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ INPUT") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E STOP") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("key.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N ^") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T NEXT") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 & FOR") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % DIM") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y PRINT") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - - PORT_START("key.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M ]") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR(']') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I LIST") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ' RETURN") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K [") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('[') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 ( THEN") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U END") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - - PORT_START("key.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O _ REM") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('_') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 GOTO") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L \\") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ) ON") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P @ USING") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('@') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - - PORT_START("key.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(13) - PORT_BIT(0x08, 0x08, IPT_UNUSED) - PORT_BIT(0x10, 0x10, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- = RESTORE") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(10) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rubout") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(8) - - PORT_START("key.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_TAB) PORT_CHAR(27) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rept") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Here Is") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x40, 0x40, IPT_UNUSED) // another X - PORT_BIT(0x80, 0x80, IPT_UNUSED) // another Z - - PORT_START("key.7") - PORT_BIT(0xff, 0xff, IPT_UNUSED) -INPUT_PORTS_END - - -static SLOT_INTERFACE_START( apf_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_SSDD ) -SLOT_INTERFACE_END - - -static SLOT_INTERFACE_START(apf_cart) - SLOT_INTERFACE_INTERNAL("std", APF_ROM_STD) - SLOT_INTERFACE_INTERNAL("basic", APF_ROM_BASIC) - SLOT_INTERFACE_INTERNAL("spacedst", APF_ROM_SPACEDST) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( apfm1000, apf_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6800, XTAL_3_579545MHz / 4 ) // divided by 4 in external clock circuit - MCFG_CPU_PROGRAM_MAP(apfm1000_map) - - /* video hardware */ - MCFG_SCREEN_MC6847_NTSC_ADD("screen", "mc6847") - - MCFG_DEVICE_ADD("mc6847", MC6847_NTSC, XTAL_3_579545MHz) - MCFG_MC6847_FSYNC_CALLBACK(DEVWRITELINE("pia0", pia6821_device, cb1_w)) - MCFG_MC6847_INPUT_CALLBACK(READ8(apf_state, videoram_r)) - MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM2 | MC6847_MODE_GM1) - // INTEXT = GND - // other lines not connected - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(apf_state, pia0_porta_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(apf_state, pia0_portb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(apf_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) - - MCFG_APF_CARTRIDGE_ADD("cartslot", apf_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "apfm1000") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apfimag, apfm1000 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( apfimag_map) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_RAM_EXTRA_OPTIONS("16K") - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(apf_state, pia1_porta_r)) - MCFG_PIA_READPB_HANDLER(READ8(apf_state, pia1_portb_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(apf_state, pia1_portb_w)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(apf_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) - - MCFG_FD1771_ADD("fdc", 1000000) // guess - MCFG_FLOPPY_DRIVE_ADD("fdc:0", apf_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", apf_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - - MCFG_SOFTWARE_LIST_ADD("cass_list", "apfimag_cass") -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(apfm1000) - ROM_REGION(0x1000,"roms", 0) - ROM_SYSTEM_BIOS( 0, "0", "Standard" ) - ROMX_LOAD("apf_4000.rom", 0x0000, 0x0800, CRC(cc6ac840) SHA1(1110a234bcad99bd0894ad44c591389d16376ca4), ROM_BIOS(1) ) - ROM_RELOAD(0x0800, 0x0800) - - ROM_SYSTEM_BIOS( 1, "trash", "Trash II" ) // In Rocket Patrol, the ships are replaced by garbage trucks - ROMX_LOAD("trash-ii.bin", 0x0000, 0x1000, CRC(3bd8640a) SHA1(da4cd8163990adbc5acd3eab604b41e1066bb832), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS( 2, "mod", "Mod Bios" ) // (c) 1982 W.Lunquist - In Basic, CALL 18450 to get a machine-language monitor - ROMX_LOAD("mod_bios.bin", 0x0000, 0x1000, CRC(f320aba6) SHA1(9442349fca8b001a5765e2fe8b84db4ece7886c1), ROM_BIOS(3) ) -ROM_END - -#define rom_apfimag rom_apfm1000 - -// old rom, has a bad byte at 0087. -//ROMX_LOAD("apf_4000.rom", 0x0000, 0x0800, CRC(2a331a33) SHA1(387b90882cd0b66c192d9cbaa3bec250f897e4f1), ROM_BIOS(1) ) - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1979, apfimag, apfm1000, 0, apfimag, apfimag, driver_device, 0, "APF Electronics Inc.", "APF Imagination Machine", 0 ) -CONS( 1978, apfm1000, 0, 0, apfm1000, apfm1000, driver_device, 0, "APF Electronics Inc.", "APF M-1000", 0 ) diff --git a/src/mess/drivers/apogee.c b/src/mess/drivers/apogee.c deleted file mode 100644 index c6e6b5897f4..00000000000 --- a/src/mess/drivers/apogee.c +++ /dev/null @@ -1,280 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Apogee BK-01 driver by Miodrag Milanovic - - 05/06/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/wave.h" -#include "sound/speaker.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "imagedev/cassette.h" -#include "formats/rk_cas.h" -#include "includes/radio86.h" - - -class apogee_state : public radio86_state -{ -public: - apogee_state(const machine_config &mconfig, device_type type, const char *tag) - : radio86_state(mconfig, type, tag), - m_speaker(*this, "speaker") { } - - UINT8 m_out0; - UINT8 m_out1; - UINT8 m_out2; - DECLARE_WRITE_LINE_MEMBER(pit8253_out0_changed); - DECLARE_WRITE_LINE_MEMBER(pit8253_out1_changed); - DECLARE_WRITE_LINE_MEMBER(pit8253_out2_changed); - I8275_DRAW_CHARACTER_MEMBER(display_pixels); - - required_device m_speaker; -}; - - -/* Address maps */ -static ADDRESS_MAP_START(apogee_mem, AS_PROGRAM, 8, apogee_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x1000, 0xebff ) AM_RAM // RAM - AM_RANGE( 0xec00, 0xec03 ) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) AM_MIRROR(0x00fc) - AM_RANGE( 0xed00, 0xed03 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x00fc) - //AM_RANGE( 0xee00, 0xee03 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x00fc) - AM_RANGE( 0xef00, 0xef01 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x00fe) // video - AM_RANGE( 0xf000, 0xf0ff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( apogee ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgDn") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('X') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) -INPUT_PORTS_END - -static const INT16 speaker_levels[] = {-32767, -10922, 10922, 32767}; - -WRITE_LINE_MEMBER(apogee_state::pit8253_out0_changed) -{ - m_out0 = state; - m_speaker->level_w(m_out0+m_out1+m_out2); -} - -WRITE_LINE_MEMBER(apogee_state::pit8253_out1_changed) -{ - m_out1 = state; - m_speaker->level_w(m_out0+m_out1+m_out2); -} - -WRITE_LINE_MEMBER(apogee_state::pit8253_out2_changed) -{ - m_out2 = state; - m_speaker->level_w(m_out0+m_out1+m_out2); -} - -I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels) -{ - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const UINT8 *charmap = m_charmap + (gpa & 1) * 0x400; - UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; - if(linecount == 8) - pixels = 0; - if (vsp) { - pixels = 0; - } - if (lten) { - pixels = 0xff; - } - if (rvv) { - pixels ^= 0xff; - } - for(i=0;i<6;i++) { - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; - } -} - -/* F4 Character Displayer */ -static const gfx_layout apogee_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( apogee ) - GFXDECODE_ENTRY( "gfx1", 0x0000, apogee_charlayout, 0, 1 ) -GFXDECODE_END - - -/* Machine driver */ -static MACHINE_CONFIG_START( apogee, apogee_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, XTAL_16MHz / 9) - MCFG_CPU_PROGRAM_MAP(apogee_mem) - MCFG_MACHINE_RESET_OVERRIDE(apogee_state, radio86 ) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_16MHz/9) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(apogee_state,pit8253_out0_changed)) - MCFG_PIT8253_CLK1(XTAL_16MHz/9) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(apogee_state,pit8253_out1_changed)) - MCFG_PIT8253_CLK2(XTAL_16MHz/9) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(apogee_state,pit8253_out2_changed)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) - - //MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - - MCFG_DEVICE_ADD("i8275", I8275, XTAL_16MHz / 12) - MCFG_I8275_CHARACTER_WIDTH(6) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(apogee_state, display_pixels) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma8257",i8257_device, dreq2_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(78*6, 30*10) - MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", apogee) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(apogee_state,radio86) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(4, speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(radio86_state, hrq_w)) - MCFG_I8257_IN_MEMR_CB(READ8(radio86_state, memory_read_byte)) - MCFG_I8257_OUT_MEMW_CB(WRITE8(radio86_state, memory_write_byte)) - MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("i8275", i8275_device, dack_w)) - MCFG_I8257_REVERSE_RW_MODE(1) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rka_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("apogee_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","apogee") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( apogee ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "apogee.rom", 0xf000, 0x1000, CRC(a47383a7) SHA1(6a868371c7980f92c2fc9ced921517209f197375)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("apogee.fnt", 0x0000, 0x0800, CRC(fe5867f0) SHA1(82c5aca63ada5e4533eb0516384aaa7b77a1f8e2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, apogee, radio86,0, apogee, apogee, radio86_state,radio86, "Zavod BRA", "Apogee BK-01", 0) diff --git a/src/mess/drivers/apollo.c b/src/mess/drivers/apollo.c deleted file mode 100644 index 1c41ed2c7d9..00000000000 --- a/src/mess/drivers/apollo.c +++ /dev/null @@ -1,1276 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Hans Ostermeyer, R. Belmont -/* - * apollo.c - APOLLO DN3500/DN3000 driver - * - * Created on: May 12, 2010 - * Author: Hans Ostermeyer - * - * Adapted February 19, 2012 for general MAME/MESS standards by R. Belmont - * - * TODO: use MESS ram device and MCFG_RAM_* to handle RAM sizing. - * Remove need for instruction hook. - * Convert to modern address map. - * - * see also: - * - Domain Series 3000/Series 4000 Hardware Architecture Handbook (Order No. 007861 Rev. 02) - * - Domain Personal Workstations and Servers Technical Reference (Apollo Order No. 008778-A01) - * - Servicing the Domain Personal Workstations and Servers (Apollo Order No. 007859-A01) - * - http://www.bitsavers.org/pdf/apollo/002398-04_Domain_Engineering_Handbook_Rev4_Jan87.pdf - * - http://www.bitsavers.org/pdf/apollo/008778-03_DOMAIN_Series_3000_4000_Technical_Reference_Aug87.pdf - * - http://www.bitsavers.org/pdf/apollo/AEGIS_Internals_and_Data_Structures_Jan86.pdf - * - http://www.bitsavers.org/pdf/apollo/019411-A00_Addendum_to_Domain_Personal_Workstations_and_Servers_Hardware_Architecture_Handbook_1991.pdf - * - data sheets from Intel and Motorola - */ - -#define VERBOSE 0 - -#include "includes/apollo.h" -#include "debugger.h" -#include "cpu/m68000/m68kcpu.h" -#include "sound/beep.h" -#include "apollo_dsp.lh" - -// we use set_verbose -#include "bus/isa/omti8621.h" -#include "bus/isa/3c505.h" - -#define TERMINAL_TAG "terminal" - -// we use this to prevent excessive logging (if emulation runs amok) -// error.log will be 10 MB for 100000 lines -#define APOLLO_MAX_NO_OF_LOG_LINES 1000000 - -// ISA/AT Bus notes -// I/O space: to get the Apollo address = take the PC I/O address, keep the low 3 bits how they are, and shift the rest left 7, inserting zeros. -// then add 0x40000 for the I/O base. -// -// example: 3c503 Ethernet is at I/O 300h on PC, which is (%1100000000 -> 1 1000 0000 0000 0000) + 0x40000 = 0x58000 -// -// Memory space: addresses from 0x80000 to 0xffffff are supported, including the possibility of stock PC MDA at a0000 - -#define ATBUS_IO_BASE 0x040000 -#define ATBUS_IO_END 0x05ffff -#define ATBUS_MEMORY_BASE 0x080000 -#define ATBUS_MEMORY_END 0xffffff - -#define DN3500_RAM_SIZE 16 // 8, 16 or 32 MB - -#if DN3500_RAM_SIZE == 8 -#define DN3500_RAM_BASE 0x1000000 -#define DN3500_RAM_END 0x17fffff -#define DN3500_RAM_CONFIG_BYTE 0x64 // 4-4-0-0 -#elif DN3500_RAM_SIZE == 16 -#define DN3500_RAM_BASE 0x1000000 -#define DN3500_RAM_END 0x1ffffff -#define DN3500_RAM_CONFIG_BYTE 0x60 // 4-4-4-4 -#else /* DN3500_RAM_SIZE == 32 */ -#define DN3500_RAM_BASE 0x1000000 -#define DN3500_RAM_END 0x3ffffff -#define DN3500_RAM_CONFIG_BYTE 0x20 // 8-8-8-8 -#endif - -#define DN3000_RAM_BASE 0x100000 -#define DN3000_RAM_END 0x8fffff -#define DN3000_RAM_CONFIG_8MB 0x20 // 2-2-2-2 - -#define DN5500_RAM_SIZE 32 // 16 or 32 MB - -#if DN5500_RAM_SIZE == 16 -#define DN5500_RAM_BASE 0x1000000 -#define DN5500_RAM_END 0x1ffffff -#define DN5500_RAM_CONFIG_BYTE 0x14 // 8-8-0-0 -#define DN5500_MEM_PRESENT_BYTE 0xAA // 8-8-0-0 -#else /* DN5500_RAM_SIZE == 32 */ -#define DN5500_RAM_BASE 0x1000000 -#define DN5500_RAM_END 0x2ffffff -#define DN5500_RAM_CONFIG_BYTE 0x20 // 8-8-8-8 -#define DN5500_MEM_PRESENT_BYTE 0x00 // 8-8-8-8 -#endif - -#define NODE_TYPE_DN3000 3000 -#define NODE_TYPE_DN3500 3500 -#define NODE_TYPE_DN5500 5500 -#define NODE_TYPE_DSP3000 -3000 -#define NODE_TYPE_DSP3500 -3500 -#define NODE_TYPE_DSP5500 -5500 - -#define DEFAULT_NODE_ID 0x12345 - -static UINT8 cache_control_register = 0x00; -static UINT8 cache_status_register = 0xff; -static UINT8 task_alias_register = 0x00; - -static offs_t parity_error_offset = 0; -static UINT16 parity_error_byte_mask = 0; -static int parity_error_handler_is_installed = 0; -static int parity_error_handler_install_counter = 0; - -static UINT16 latch_page_on_parity_error_register = 0x0000; -static UINT16 master_req_register = 0x0000; - -// DN3000: Node Id 1D117 at 0x9600 - 0x961f -// DN3500: Node Id 2616D at 0x11200 - 0x1121f - -static UINT32 node_id = DEFAULT_NODE_ID; - -static UINT32 ram_base_address; -static UINT32 ram_end_address; - -static int node_type; - -// FIXME: value of ram_config_byte must match with default/selected RAM size -static UINT8 ram_config_byte; - -static UINT32 log_line_counter = 0; - -/*************************************************************************** - cpu_context - return a string describing which CPU is currently executing and their PC - ***************************************************************************/ - -const char *apollo_cpu_context(device_t *cpu) { - static char statebuf[64]; /* string buffer containing state description */ - - /* if we have an executing CPU, output data */ - if (cpu != NULL) { - osd_ticks_t t = osd_ticks(); - int s = t / osd_ticks_per_second(); - int ms = (t % osd_ticks_per_second()) / 1000; - - sprintf(statebuf, "%d.%03d %s pc=%08x", s, ms, cpu->tag(), cpu->safe_pcbase()); - } else { - strcpy(statebuf, "(no context)"); - } - return statebuf; -} - -/*------------------------------------------------- - apollo_set_cpu_has_fpu - enable/disable the FPU - -------------------------------------------------*/ - -void apollo_set_cpu_has_fpu(m68000_base_device *device, int onoff) -{ - if (device == NULL || (device->type() != M68020PMMU && device->type() != M68030)) - { - DLOG1(("set_cpu_has_fpu: unexpected CPU device")); - } - else - { - device->has_fpu = onoff; - DLOG1(("apollo_set_cpu_has_fpu: FPU has been %s", onoff ? "enabled" : "disabled")); - } -} - -/*************************************************************************** - apollo_check_log - check for excessive logging - ***************************************************************************/ - -void apollo_check_log() { - if (++log_line_counter >= APOLLO_MAX_NO_OF_LOG_LINES) { - fatalerror("apollo_check_log: maximum number of log lines exceeded.\n"); - } -} - -/*************************************************************************** - apollo_is_dn3000 - return 1 if node is DN3000 or DSP3000, 0 otherwise - ***************************************************************************/ - -int apollo_is_dn3000(void) { - return node_type == NODE_TYPE_DN3000 || node_type == NODE_TYPE_DSP3000; -} - -/*************************************************************************** - apollo_is_dn5500 - return 1 if node is DN5500 or DSP5500, 0 otherwise - ***************************************************************************/ - -int apollo_is_dn5500(void) { - return node_type == NODE_TYPE_DN5500 || node_type == NODE_TYPE_DSP5500; -} - -/*************************************************************************** - apollo_is_dsp3x00 - return 1 if node is DSP3x00 or DSP5500, 0 otherwise - ***************************************************************************/ - -int apollo_is_dsp3x00(void) { - switch (node_type) - { - case NODE_TYPE_DSP3000: - case NODE_TYPE_DSP3500: - case NODE_TYPE_DSP5500: - return 1; - } - return 0; -} - -/*************************************************************************** - apollo_get_ram_config_byte - get the ram configuration byte - ***************************************************************************/ - -UINT8 apollo_get_ram_config_byte(void) { - return ram_config_byte; -} - -/*************************************************************************** - apollo_get_node_id - get the node id - ***************************************************************************/ - -UINT32 apollo_get_node_id(void) { - return node_id; -} - -/*************************************************************************** - apollo_instruction_hook - must be called by the CPU core before executing each instruction -***************************************************************************/ -READ32_MEMBER(apollo_state::apollo_instruction_hook) -{ - static UINT16 idle_counter = 0; - - // m_maincpu->ir still has previous instruction - UINT16 last_ir = m_maincpu->ir; - - // get next instruction (or 0 if unavailable) - UINT16 next_ir = (m_maincpu->pref_addr == REG_PC(m_maincpu)) ? m_maincpu->pref_data : 0; - - // check for NULLPROC: - // 027C F8FF AND.W #F8FF,SR - // 60FA BRA *-4 - - if ((next_ir == 0x60fa && last_ir == 0x027c) || (next_ir == 0x027c && last_ir == 0x60fa)) - { - // we are within the idle loop, slow down CPU to reduce power usage - m_maincpu->remaining_cycles -= 500; - - if (apollo_config(APOLLO_CONF_IDLE_SLEEP) && apollo_is_dsp3x00() && ++idle_counter >= 1000) - { - // slow down even more on DSP3x00 - idle_counter -= 100; - // sleep 1 ms - osd_sleep(osd_ticks_per_second() / 1000); - } - } - else - { - // we are outside of the idle loop - idle_counter = 0; - } - - if (!m_maincpu->has_fpu && !m_maincpu->pmmu_enabled && (m_maincpu->ir & 0xff00) == 0xf200) - { - // set APOLLO_CSR_SR_FP_TRAP in cpu status register for /sau7/self_test - apollo_csr_set_status_register(APOLLO_CSR_SR_FP_TRAP, APOLLO_CSR_SR_FP_TRAP); - } - - if (m_maincpu->t1_flag && !m_maincpu->s_flag) - { - // FIXME: trace emulation is disabled in m68kcpu.h; why??? - m68ki_exception_trace(m_maincpu); - } - - return apollo_debug_instruction_hook(m_maincpu, offset); -} - -/*************************************************************************** - apollo bus error - ***************************************************************************/ - -void apollo_state::apollo_bus_error() -{ - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - - apollo_csr_set_status_register(APOLLO_CSR_SR_CPU_TIMEOUT, APOLLO_CSR_SR_CPU_TIMEOUT); -} - -IRQ_CALLBACK_MEMBER(apollo_state::apollo_irq_acknowledge) -{ - int result = M68K_INT_ACK_AUTOVECTOR; - - m_maincpu->set_input_line(irqline, CLEAR_LINE); - - MLOG2(("apollo_irq_acknowledge: interrupt level=%d", irqline)); - - if (irqline == 6) { - result = apollo_pic_acknowledge(device, irqline); - } - return result; -} - -/*************************************************************************** - DN3500 Cache Control/Status Register at 0x10200 - ***************************************************************************/ - -WRITE8_MEMBER(apollo_state::cache_control_register_w){ - if (apollo_is_dn5500()) - { - SLOG1(("Error: writing DN5500 Cache Status Register at offset %02x = %02x", offset, data)); - } - else - { - cache_control_register = data; - cache_status_register = (cache_status_register & 0x7f) | (cache_control_register & 0x80); - SLOG2(("writing Cache Control Register at offset %02x = %02x", offset, data)); - } -} - -READ8_MEMBER(apollo_state::cache_status_register_r){ - UINT8 data = cache_status_register; - - if (apollo_is_dn5500()) { -#define DN5500_CSR_NOT_HSI_PRESENT 8 -#define DN5500_CSR_MEM_TIME 1 - data |= DN5500_CSR_NOT_HSI_PRESENT; - } - - SLOG2(("reading Cache Status Register at offset %02x = %02x", offset, data)); - return data; -} - -void apollo_set_cache_status_register(UINT8 mask, UINT8 data) { - UINT16 new_value = (cache_status_register & ~mask) | (data & mask); - if (new_value != cache_status_register) { - cache_status_register = new_value; - LOG2(("setting Cache Status Register with data=%02x and mask=%02x to %02x", - data, mask, cache_status_register)); - } -} - -/*************************************************************************** - DN3500 Task Alias Register at 0x10300 - ***************************************************************************/ - -WRITE8_MEMBER(apollo_state::task_alias_register_w){ - task_alias_register = data; - apollo_set_cache_status_register(0x07, data); - SLOG(("writing Task Alias Register at offset %02x = %02x",offset, data)); -} - -READ8_MEMBER(apollo_state::task_alias_register_r){ - UINT8 data = 0xff; - SLOG(("reading Task Alias Register at offset %02x = %02x", offset, data)); - return data; -} - -/*************************************************************************** - DN3000/DN3500 Node Id PROM at 0x9600/0x11200 - ***************************************************************************/ - -WRITE16_MEMBER(apollo_state::apollo_node_id_w){ - SLOG1(("Error: writing node id ROM at offset %02x = %04x & %04x", offset, data, mem_mask)); -} - -READ16_MEMBER(apollo_state::apollo_node_id_r){ - UINT16 data; - switch (offset & 0x0f) { - case 1: // msb - data = (node_id >> 16) & 0xff; - break; - case 2: - data = (node_id >> 8) & 0xff; - break; - case 3: // lsb - data = node_id & 0xff; - break; - case 15: // checksum - data = ((node_id >> 16) + (node_id >> 8) + node_id) & 0xff; - break; - default: - data = 0; - break; - } - data <<= 8; - SLOG2(("reading node id ROM at offset %02x = %04x & %04x", offset, data, mem_mask)); - return data; -} - -/*************************************************************************** - DN3000/DN3500 Latch Page on Parity Error Register at 0x9300/0x11300 - ***************************************************************************/ - -WRITE16_MEMBER(apollo_state::latch_page_on_parity_error_register_w){ - latch_page_on_parity_error_register = data; - SLOG1(("writing Latch Page on Error Parity Register at offset %02x = %04x", offset*2, data)); -} - -READ16_MEMBER(apollo_state::latch_page_on_parity_error_register_r){ - UINT16 data = latch_page_on_parity_error_register; - SLOG2(("reading Latch Page on Error Parity Register at offset %02x = %04x", offset*2, data)); - return data; -} - -/*************************************************************************** - DN3500 Master REQ Register at 0x11600 - ***************************************************************************/ - -WRITE8_MEMBER(apollo_state::master_req_register_w){ - master_req_register = data; - SLOG2(("writing Master REQ Register at offset %02x = %02x", offset, data)); -} - -READ8_MEMBER(apollo_state::master_req_register_r){ - UINT8 data = 0xff; - SLOG1(("reading Master REQ Register at offset %02x = %02x", offset, data)); - return data; -} - -/*************************************************************************** - DN3500 Selective Clear Locations at 0x11600 - ***************************************************************************/ - -WRITE16_MEMBER(apollo_state::selective_clear_locations_w){ - SLOG2(("writing Selective Clear Locations at offset %02x = %02x", offset*2, data)); - switch (offset * 2) { - case 0x00: // Clear All - apollo_csr_set_status_register(APOLLO_CSR_SR_CLEAR_ALL, 0); - break; - case 0x04: // clear floating-point trap - apollo_csr_set_status_register(APOLLO_CSR_SR_FP_TRAP, 0); - break; - case 0x06: // clear Parity error interrupt - apollo_csr_set_status_register(APOLLO_CSR_SR_PARITY_BYTE_MASK, 0); - break; - case 0x08: // clear Bus Error Status (CPU Timeout) - apollo_csr_set_status_register(APOLLO_CSR_SR_CPU_TIMEOUT, 0); - break; - case 0x0e: // Clear (Flush) Cache - break; - } -} - -READ16_MEMBER(apollo_state::selective_clear_locations_r){ - UINT16 data = 0xffff; - SLOG1(("reading Selective Clear Locations at offset %02x = %02x", offset*2, data)); - return data; -} - -/*************************************************************************** - DN3000/DN3500 RAM with parity (and null proc loop delay for DomainOS) - ***************************************************************************/ - -READ32_MEMBER(apollo_state::ram_with_parity_r){ - UINT32 data = m_messram_ptr[parity_error_offset+offset]; - - SLOG2(("memory dword read with parity error at %08x = %08x & %08x parity_byte=%04x", - ram_base_address + parity_error_offset*4 + offset*4,data, mem_mask, parity_error_byte_mask)); - - if (parity_error_byte_mask != 0) { - latch_page_on_parity_error_register = (ram_base_address + parity_error_offset * 4) >> 10; - - apollo_csr_set_status_register(APOLLO_CSR_CR_PARITY_BYTE_MASK, apollo_csr_get_status_register() |parity_error_byte_mask); - - if (apollo_csr_get_control_register() & APOLLO_CSR_CR_INTERRUPT_ENABLE) { - // force parity error (if NMI is enabled) -// cpu_set_input_line_and_vector(&space.device(), 7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - m_maincpu->set_input_line_and_vector(7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - - } - } - return data; -} - -WRITE32_MEMBER(apollo_state::ram_with_parity_w){ - COMBINE_DATA(m_messram_ptr+offset); - - if (apollo_csr_get_control_register() & APOLLO_CSR_CR_FORCE_BAD_PARITY) { - parity_error_byte_mask = (apollo_csr_get_control_register() - & APOLLO_CSR_CR_PARITY_BYTE_MASK); - - if (!apollo_is_dn3000()) { - parity_error_byte_mask ^= APOLLO_CSR_CR_PARITY_BYTE_MASK; - } - - parity_error_offset = offset; - -// SLOG1(("memory dword write with parity to %08x = %08x & %08x parity_byte=%04x", -// ram_base_address +offset * 4, data, mem_mask, parity_error_byte_mask)); - - if (parity_error_handler_is_installed == 0) { - // no more than 192 read/write handlers may be used - // see table_assign_handler in memory.c - if (parity_error_handler_install_counter < 40) { - //memory_install_read32_handler(space, ram_base_address+offset*4, ram_base_address+offset*4+3, 0xffffffff, 0, ram_with_parity_r); - space.install_read_handler(ram_base_address+offset*4, ram_base_address+offset*4+3, 0xffffffff,0,read32_delegate(FUNC(apollo_state::ram_with_parity_r),this)); - parity_error_handler_is_installed = 1; - parity_error_handler_install_counter++; - } - } - } else if (parity_error_handler_is_installed && offset == parity_error_offset) { - SLOG1(("memory dword write with parity to %08x = %08x & %08x reset %d", - ram_base_address +parity_error_offset*4, data, mem_mask, parity_error_handler_install_counter)); - - // uninstall not supported, reinstall previous read handler instead - - // memory_install_rom(space, ram_base_address, ram_end_address, 0xffffffff, 0, messram_ptr.v); - space.install_rom(ram_base_address,ram_end_address,0xffffffff,0,&m_messram_ptr[0]); - - parity_error_handler_is_installed = 0; - parity_error_byte_mask = 0; - } -} - -/*************************************************************************** - DN3000/DN3500 unmapped memory - ***************************************************************************/ - -READ32_MEMBER(apollo_state::apollo_unmapped_r) -{ - offs_t address = offset * 4; - - m68000_base_device *m68k = m_maincpu; - - if ((address & 0xfff00000) == 0xfa800000 && VERBOSE < 2) { - // ? - } else if ((address & 0xfff00ff7) == 0xfd800000 && VERBOSE < 2) { - // omit logging for memory sizing in FPA address space - // strange: MD seems to search for the 3C505 Boot ROM - // note (6.10.2010): might be color7 address space (!?!) - } else if ((address & 0xfc03ffff) == 0x00000000 && VERBOSE < 2) { - // omit logging for memory sizing in standalone utilities - } else if (address == 0xfff90000 && VERBOSE < 2) { - // omit logging for FPA trial access - } else if (address == 0x00030000 && VERBOSE < 2) { - // omit logging for Bus error test address in DN3500 boot prom and self_test - } else if (address == 0x0000ac00 && VERBOSE < 2) { - // omit logging for Bus error test address in DN3000 boot prom - } else { - SLOG1(("unmapped memory dword read from %08x with mask %08x (ir=%04x)", address , mem_mask, m68k->ir)); - } - - /* unmapped; access causes a bus error */ - apollo_bus_error(); - return 0xffffffff; -} - -WRITE32_MEMBER(apollo_state::apollo_unmapped_w) -{ - SLOG(("unmapped memory dword write to %08x = %08x & %08x", offset * 4, data, mem_mask)); - - /* unmapped; access causes a bus error */ - apollo_bus_error(); -} - -/*************************************************************************** - DN3000/DN3500 ROM write - ***************************************************************************/ - -WRITE32_MEMBER(apollo_state::apollo_rom_w) -{ - offs_t address = offset * 4; - offs_t pc = space.device().safe_pcbase(); - - if (pc == 0x00002c1c && address == 0x00000004 && VERBOSE < 2) { - // don't log invalid code in 3500_boot_12191_7.bin - } else { - SLOG1(("ROM dword write to %08x = %08x & %08x", offset * 4, data, mem_mask)); - } -} - -/*************************************************************************** - DN3000/DN3500 AT Bus I/O space - ***************************************************************************/ - -READ16_MEMBER(apollo_state::apollo_atbus_io_r) -{ - UINT32 isa_addr = (offset & 3) + ((offset & ~0x1ff) >> 7); - - // Motorola CPU is MSB first, ISA Bus is LSB first - UINT16 data = m_isa->io16_swap_r(space, isa_addr, mem_mask); - - SLOG2(("apollo_atbus_io_r at %08x -> %04x = %04x & %04x", offset*2, isa_addr*2, data, mem_mask)); - - return data; -} - -WRITE16_MEMBER(apollo_state::apollo_atbus_io_w) -{ - UINT32 isa_addr = (offset & 3) + ((offset & ~0x1ff) >> 7); - - SLOG2(("apollo_atbus_io_w at %08x -> %04x = %04x & %04x", offset*2, isa_addr*2, data, mem_mask)); - - // Motorola CPU is MSB first, ISA Bus is LSB first - m_isa->io16_swap_w(space, isa_addr, data, mem_mask); -} - -/*************************************************************************** - DN3000/DN3500 AT Bus memory space - ***************************************************************************/ - -READ16_MEMBER(apollo_state::apollo_atbus_memory_r) -{ - // Motorola CPU is MSB first, ISA Bus is LSB first - UINT16 data = m_isa->prog16_swap_r(space, offset, mem_mask); - - SLOG2(("apollo_atbus_memory_r at %08x = %04x & %04x", offset*2, data, mem_mask)); - - return data; -} - -WRITE16_MEMBER(apollo_state::apollo_atbus_memory_w) -{ - SLOG2(("apollo_atbus_memory_w at %08x = %04x & %04x", offset*2, data, mem_mask)); - - // Motorola CPU is MSB first, ISA Bus is LSB first - m_isa->prog16_swap_w(space, offset, data, mem_mask); -} - -/*************************************************************************** - DN5500 Memory Present Register at 0x11400-0x114ff - Strange: documented but not used - ***************************************************************************/ - -WRITE8_MEMBER(apollo_state::dn5500_memory_present_register_w){ - SLOG(("Error: writing DN5500 Memory Present Register at offset %02x = %02x", offset, data)); -} - -READ8_MEMBER(apollo_state::dn5500_memory_present_register_r){ - UINT8 data = DN5500_MEM_PRESENT_BYTE; - SLOG(("reading DN5500 Memory Present Register at offset %02x = %02x", offset, data)); - return data; -} - -/*************************************************************************** - DN5500 11500 Registers at 0x11500-0x115ff (undocumented, what does it do?) - ***************************************************************************/ - -WRITE8_MEMBER(apollo_state::dn5500_11500_w){ - SLOG1(("writing DN5500 11500 at offset %02x = %02x", offset, data)); -} - -READ8_MEMBER(apollo_state::dn5500_11500_r){ - UINT8 data = 0xff; - SLOG1(("reading DN5500 11500 at offset %02x = %02x", offset, data)); - return data; -} - -/*************************************************************************** - DN5500 I/O Protection Map at 0x7000000-0x700FFFF - ***************************************************************************/ - -WRITE8_MEMBER(apollo_state::dn5500_io_protection_map_w){ - // TODO - SLOG1(("writing DN5500 I/O Protection Map at offset %02x = %02x", offset, data)); -} - -READ8_MEMBER(apollo_state::dn5500_io_protection_map_r){ - UINT8 data = 0xff; - SLOG1(("reading DN5500 I/O Protection Map at offset %02x = %02x", offset, data)); - return data; -} - -#if 0 -/*************************************************************************** - DN3000/DN3500 at f8000000 - ffffffff (used by fpa and/or color7?) - ***************************************************************************/ - -READ32_MEMBER(apollo_state::apollo_f8_r){ - offs_t address = 0xf8000000 + offset * 4; - UINT32 data = 0xffffffff; - SLOG2(("unexpected memory dword read from %08x = %08x & %08x", - address, data, mem_mask)); - return data; -} - -WRITE32_MEMBER(apollo_state::apollo_f8_w){ - offs_t address = 0xf8000000 +offset * 4; - - SLOG2(("unexpected memory dword write to %08x = %08x & %08x", - address, data, mem_mask)); -} -#endif - -/*************************************************************************** - ADDRESS MAPS - ***************************************************************************/ - -static ADDRESS_MAP_START(dn3500_map, AS_PROGRAM, 32, apollo_state ) - AM_RANGE(0x000000, 0x00ffff) AM_ROM /* boot ROM */ - AM_RANGE(0x000000, 0x00ffff) AM_WRITE(apollo_rom_w) - AM_RANGE(0x010000, 0x0100ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) - AM_RANGE(0x010100, 0x0101ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) - AM_RANGE(0x010200, 0x0102ff) AM_READWRITE8(cache_status_register_r, cache_control_register_w, 0xffffffff ) - AM_RANGE(0x010300, 0x0103ff) AM_READWRITE8(task_alias_register_r , task_alias_register_w , 0xffffffff ) - AM_RANGE(0x010400, 0x0104ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) - AM_RANGE(0x010500, 0x0105ff) AM_DEVREADWRITE8(APOLLO_SIO2_TAG, mc68681_device, read, write, 0x00ff00ff ) - AM_RANGE(0x010800, 0x0108ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) - AM_RANGE(0x010900, 0x0109ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) - AM_RANGE(0x010c00, 0x010cff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) - AM_RANGE(0x010d00, 0x010dff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) - AM_RANGE(0x011000, 0x0110ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x011100, 0x0111ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x011200, 0x0112ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) - AM_RANGE(0x011300, 0x0113ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) - AM_RANGE(0x011600, 0x0116ff) AM_READWRITE8(master_req_register_r, master_req_register_w, 0xffffffff) - - AM_RANGE(0x016400, 0x0164ff) AM_READWRITE16(selective_clear_locations_r, selective_clear_locations_w, 0xffffffff ) - AM_RANGE(0x017000, 0x017fff) AM_READWRITE16(apollo_address_translation_map_r, apollo_address_translation_map_w, 0xffffffff ) - - AM_RANGE(0x05d800, 0x05dc07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mcr_r, apollo_mcr_w, 0xffffffff) - AM_RANGE(0xfa0000, 0xfdffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mgm_r, apollo_mgm_w, 0xffffffff) - - AM_RANGE(0x05e800, 0x05ec07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_ccr_r, apollo_ccr_w, 0xffffffff) - AM_RANGE(0x0a0000, 0x0bffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_cgm_r, apollo_cgm_w, 0xffffffff) - - AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) - - // FIXME: must match with RAM size in driver/apollo_sio.c - // AM_RANGE(DN3500_RAM_BASE, DN3500_RAM_END) AM_RAM /* 8MB RAM */ - AM_RANGE(DN3500_RAM_BASE, DN3500_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") - - AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) - -// AM_RANGE(0x03020000, 0x0303ffff) Cache Tag Store (DN4500 only) -// AM_RANGE(0x04000000, 0x0400ffff) Cache Tag Data (DN4500 only) -// AM_RANGE(0x0e000000, 0x0fffffff) FPA address space - -// AM_RANGE(0xf8000000, 0xffffffff) AM_READWRITE(apollo_f8_r, apollo_f8_w) - AM_RANGE(0x00000000, 0xffffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(dsp3500_map, AS_PROGRAM, 32, apollo_state ) - AM_RANGE(0x000000, 0x00ffff) AM_ROM /* boot ROM */ - AM_RANGE(0x000000, 0x00ffff) AM_WRITE(apollo_rom_w) - AM_RANGE(0x010000, 0x0100ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) - AM_RANGE(0x010100, 0x0101ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) - AM_RANGE(0x010200, 0x0102ff) AM_READWRITE8(cache_status_register_r, cache_control_register_w, 0xffffffff ) - AM_RANGE(0x010300, 0x0103ff) AM_READWRITE8(task_alias_register_r , task_alias_register_w , 0xffffffff ) - AM_RANGE(0x010400, 0x0104ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) - AM_RANGE(0x010500, 0x0105ff) AM_DEVREADWRITE8(APOLLO_SIO2_TAG, mc68681_device, read, write, 0x00ff00ff ) - AM_RANGE(0x010800, 0x0108ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) - AM_RANGE(0x010900, 0x0109ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) - AM_RANGE(0x010c00, 0x010cff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) - AM_RANGE(0x010d00, 0x010dff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) - AM_RANGE(0x011000, 0x0110ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x011100, 0x0111ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x011200, 0x0112ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) - AM_RANGE(0x011300, 0x0113ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) - AM_RANGE(0x011600, 0x0116ff) AM_READWRITE8(master_req_register_r, master_req_register_w, 0xffffffff) - - AM_RANGE(0x016400, 0x0164ff) AM_READWRITE16(selective_clear_locations_r, selective_clear_locations_w, 0xffffffff ) - AM_RANGE(0x017000, 0x017fff) AM_READWRITE16(apollo_address_translation_map_r, apollo_address_translation_map_w, 0xffffffff ) - - AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) - - AM_RANGE(DN3500_RAM_BASE, DN3500_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") - - AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) - -// AM_RANGE(0xf8000000, 0xffffffff) AM_READWRITE(apollo_f8_r, apollo_f8_w) - AM_RANGE(0x00000000, 0xffffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(dn3000_map, AS_PROGRAM, 32, apollo_state ) - AM_RANGE(0x000000, 0x007fff) AM_ROM /* boot ROM */ - AM_RANGE(0x000000, 0x007fff) AM_WRITE(apollo_rom_w) - AM_RANGE(0x008000, 0x0080ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) - AM_RANGE(0x008100, 0x0081ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) - AM_RANGE(0x008400, 0x0087ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) - AM_RANGE(0x008800, 0x0088ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) - AM_RANGE(0x008900, 0x0089ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) - AM_RANGE(0x009000, 0x0090ff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) - AM_RANGE(0x009100, 0x0091ff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) - AM_RANGE(0x009200, 0x0092ff) AM_READWRITE8(apollo_dma_page_register_r, apollo_dma_page_register_w, 0xffffffff ) - AM_RANGE(0x009300, 0x0093ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) - AM_RANGE(0x009400, 0x0094ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x009500, 0x0095ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x009600, 0x0096ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) - - AM_RANGE(0x05d800, 0x05dc07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mcr_r, apollo_mcr_w, 0xffffffff) - AM_RANGE(0xfa0000, 0xfdffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mgm_r, apollo_mgm_w, 0xffffffff) - - AM_RANGE(0x05e800, 0x05ec07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_ccr_r, apollo_ccr_w, 0xffffffff) - AM_RANGE(0x0a0000, 0x0bffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_cgm_r, apollo_cgm_w, 0xffffffff) - - AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) - - // FIXME: must match with RAM size in driver/apollo_sio.c - // AM_RANGE(DN3000_RAM_BASE, DN3000_RAM_END) AM_RAM /* 8MB RAM */ - AM_RANGE(DN3000_RAM_BASE, DN3000_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") - - AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) - - AM_RANGE(0x000000, 0xffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(dsp3000_map, AS_PROGRAM, 32, apollo_state ) - AM_RANGE(0x000000, 0x007fff) AM_ROM /* boot ROM */ - AM_RANGE(0x000000, 0x007fff) AM_WRITE(apollo_rom_w) - AM_RANGE(0x008000, 0x0080ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) - AM_RANGE(0x008100, 0x0081ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) - AM_RANGE(0x008400, 0x0087ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) - AM_RANGE(0x008800, 0x0088ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) - AM_RANGE(0x008900, 0x0089ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) - - AM_RANGE(0x009000, 0x0090ff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) - AM_RANGE(0x009100, 0x0091ff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) - AM_RANGE(0x009200, 0x0092ff) AM_READWRITE8(apollo_dma_page_register_r, apollo_dma_page_register_w, 0xffffffff ) - AM_RANGE(0x009300, 0x0093ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) - AM_RANGE(0x009400, 0x0094ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x009500, 0x0095ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x009600, 0x0096ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) - - AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) - - // FIXME: must match with RAM size in driver/apollo_sio.c - // AM_RANGE(DN3000_RAM_BASE, DN3000_RAM_END) AM_RAM /* 8MB RAM */ - AM_RANGE(DN3000_RAM_BASE, DN3000_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") - - AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) - - AM_RANGE(0x000000, 0xffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(dn5500_map, AS_PROGRAM, 32, apollo_state ) - AM_RANGE(0x000000, 0x00ffff) AM_ROM /* boot ROM */ - AM_RANGE(0x000000, 0x00ffff) AM_WRITE(apollo_rom_w) - AM_RANGE(0x010000, 0x0100ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) - AM_RANGE(0x010100, 0x0101ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) - AM_RANGE(0x010200, 0x0102ff) AM_READWRITE8(cache_status_register_r, cache_control_register_w, 0xffffffff ) - AM_RANGE(0x010300, 0x0103ff) AM_READWRITE8(task_alias_register_r , task_alias_register_w , 0xffffffff ) - AM_RANGE(0x010400, 0x0104ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) - AM_RANGE(0x010500, 0x0105ff) AM_DEVREADWRITE8(APOLLO_SIO2_TAG, mc68681_device, read, write, 0x00ff00ff ) - AM_RANGE(0x010800, 0x0108ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) - AM_RANGE(0x010900, 0x0109ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) - AM_RANGE(0x010c00, 0x010cff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) - AM_RANGE(0x010d00, 0x010dff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) - AM_RANGE(0x011000, 0x0110ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x011100, 0x0111ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x011200, 0x0112ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) - AM_RANGE(0x011300, 0x0113ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) - AM_RANGE(0x011400, 0x0114ff) AM_READWRITE8(dn5500_memory_present_register_r, dn5500_memory_present_register_w, 0xffffffff ) - AM_RANGE(0x011500, 0x0115ff) AM_READWRITE8(dn5500_11500_r, dn5500_11500_w, 0xffffffff ) - AM_RANGE(0x011600, 0x0116ff) AM_READWRITE8(master_req_register_r, master_req_register_w, 0xffffffff) - - AM_RANGE(0x016400, 0x0164ff) AM_READWRITE16(selective_clear_locations_r, selective_clear_locations_w, 0xffffffff ) - AM_RANGE(0x017000, 0x017fff) AM_READWRITE16(apollo_address_translation_map_r, apollo_address_translation_map_w, 0xffffffff ) - - AM_RANGE(0x05d800, 0x05dc07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mcr_r, apollo_mcr_w, 0xffffffff) - AM_RANGE(0xfa0000, 0xfdffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_mgm_r, apollo_mgm_w, 0xffffffff) - - AM_RANGE(0x05e800, 0x05ec07) AM_DEVREADWRITE8(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_ccr_r, apollo_ccr_w, 0xffffffff) - AM_RANGE(0x0a0000, 0x0bffff) AM_DEVREADWRITE16(APOLLO_SCREEN_TAG, apollo_graphics_15i, apollo_cgm_r, apollo_cgm_w, 0xffffffff) - - AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) - - // FIXME: must match with RAM size in driver/apollo_sio.c - // AM_RANGE(DN3500_RAM_BASE, DN3500_RAM_END) AM_RAM /* 8MB RAM */ - AM_RANGE(DN5500_RAM_BASE, DN5500_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") - - AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) - -// AM_RANGE(0x03020000, 0x0303ffff) Cache Tag Store (DN4500 only) -// AM_RANGE(0x04000000, 0x0400ffff) Cache Tag Data (DN4500 only) - AM_RANGE(0x07000000, 0x0700FFFF) AM_READWRITE8(dn5500_io_protection_map_r, dn5500_io_protection_map_w, 0xffffffff ) -// AM_RANGE(0x0e000000, 0x0fffffff) FPA address space - -// AM_RANGE(0xf8000000, 0xffffffff) AM_READWRITE(apollo_f8_r, apollo_f8_w) - AM_RANGE(0x00000000, 0xffffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(dsp5500_map, AS_PROGRAM, 32, apollo_state ) - AM_RANGE(0x000000, 0x00ffff) AM_ROM /* boot ROM */ - AM_RANGE(0x000000, 0x00ffff) AM_WRITE(apollo_rom_w) - AM_RANGE(0x010000, 0x0100ff) AM_READWRITE16(apollo_csr_status_register_r, apollo_csr_status_register_w, 0xffffffff) - AM_RANGE(0x010100, 0x0101ff) AM_READWRITE16(apollo_csr_control_register_r, apollo_csr_control_register_w, 0xffffffff) - AM_RANGE(0x010200, 0x0102ff) AM_READWRITE8(cache_status_register_r, cache_control_register_w, 0xffffffff ) - AM_RANGE(0x010300, 0x0103ff) AM_READWRITE8(task_alias_register_r , task_alias_register_w , 0xffffffff ) - AM_RANGE(0x010400, 0x0104ff) AM_DEVREADWRITE8(APOLLO_SIO_TAG, apollo_sio, read, write, 0xffffffff ) - AM_RANGE(0x010500, 0x0105ff) AM_DEVREADWRITE8(APOLLO_SIO2_TAG, mc68681_device, read, write, 0x00ff00ff ) - AM_RANGE(0x010800, 0x0108ff) AM_DEVREADWRITE8(APOLLO_PTM_TAG, ptm6840_device, read, write, 0x00ff00ff ) - AM_RANGE(0x010900, 0x0109ff) AM_READWRITE8(apollo_rtc_r, apollo_rtc_w, 0xffffffff ) - AM_RANGE(0x010c00, 0x010cff) AM_READWRITE8(/*"dma1",*/apollo_dma_1_r, apollo_dma_1_w, 0xffffffff ) - AM_RANGE(0x010d00, 0x010dff) AM_READWRITE8(/*"dma2",*/apollo_dma_2_r, apollo_dma_2_w, 0xffffffff ) - AM_RANGE(0x011000, 0x0110ff) AM_DEVREADWRITE8(APOLLO_PIC1_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x011100, 0x0111ff) AM_DEVREADWRITE8(APOLLO_PIC2_TAG, pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x011200, 0x0112ff) AM_READWRITE16(apollo_node_id_r, apollo_node_id_w, 0xffffffff) - AM_RANGE(0x011300, 0x0113ff) AM_READWRITE16(latch_page_on_parity_error_register_r, latch_page_on_parity_error_register_w, 0xffffffff ) - AM_RANGE(0x011400, 0x0114ff) AM_READWRITE8(dn5500_memory_present_register_r, dn5500_memory_present_register_w, 0xffffffff ) - AM_RANGE(0x011500, 0x0115ff) AM_READWRITE8(dn5500_11500_r, dn5500_11500_w, 0xffffffff ) - AM_RANGE(0x011600, 0x0116ff) AM_READWRITE8(master_req_register_r, master_req_register_w, 0xffffffff) - - AM_RANGE(0x016400, 0x0164ff) AM_READWRITE16(selective_clear_locations_r, selective_clear_locations_w, 0xffffffff ) - AM_RANGE(0x017000, 0x017fff) AM_READWRITE16(apollo_address_translation_map_r, apollo_address_translation_map_w, 0xffffffff ) - - AM_RANGE(ATBUS_IO_BASE, ATBUS_IO_END) AM_READWRITE16(apollo_atbus_io_r, apollo_atbus_io_w, 0xffffffff) - - // FIXME: must match with RAM size in driver/apollo_sio.c - AM_RANGE(DN5500_RAM_BASE, DN5500_RAM_END) AM_RAM_WRITE(ram_with_parity_w) AM_SHARE("messram") - - AM_RANGE(ATBUS_MEMORY_BASE, ATBUS_MEMORY_END) AM_READWRITE16(apollo_atbus_memory_r, apollo_atbus_memory_w, 0xffffffff) - - AM_RANGE(0x07000000, 0x0700FFFF) AM_READWRITE8(dn5500_io_protection_map_r, dn5500_io_protection_map_w, 0xffffffff ) -// AM_RANGE(0xf8000000, 0xffffffff) AM_READWRITE(apollo_f8_r, apollo_f8_w) - AM_RANGE(0x00000000, 0xffffffff) AM_READWRITE(apollo_unmapped_r, apollo_unmapped_w) -ADDRESS_MAP_END - -/*************************************************************************** - Machine Reset - ***************************************************************************/ - -void apollo_state::machine_reset() -{ - //MLOG1(("machine_reset_dn3500")); - - MACHINE_RESET_CALL_MEMBER(apollo); - - // we can't do this any more - #if 0 - // set configuration - omti8621_device::set_verbose(apollo_config(APOLLO_CONF_DISK_TRACE)); - threecom3c505_device::set_verbose(apollo_config(APOLLO_CONF_NET_TRACE)); - - if (apollo_config(APOLLO_CONF_NODE_ID)) - { - UINT8 db[0x50]; - UINT16 sector1 = apollo_is_dn5500() ? 4 : 1; - - // check label of physical volume and get sector data of logical volume 1 - // Note: sector data starts with 32 byte block header - if (omti8621_get_sector(machine().device(APOLLO_WDC_TAG), 0, db, sizeof(db), 0) == sizeof(db) && - memcmp (db+0x22, "APOLLO", 6) == 0 && - omti8621_get_sector(machine().device(APOLLO_WDC_TAG), sector1, db, sizeof(db), 0) == sizeof(db)) - { - // set node_id from UID of logical volume 1 of logical unit 0 - node_id = (((db[0x49] << 8) | db[0x4a]) << 8) | db[0x4b]; - - MLOG2(("machine_reset_dn3500: node ID is %06X (from disk)", node_id)); - } - } - #endif - - m_maincpu->set_instruction_hook(read32_delegate(FUNC(apollo_state::apollo_instruction_hook),this)); -} - -WRITE_LINE_MEMBER(apollo_state::apollo_reset_instr_callback) -{ - MLOG1(("apollo_reset_instr_callback")); - - // reset the CPU board devices - MACHINE_RESET_CALL_MEMBER(apollo); - - // reset the ISA bus devices - m_isa->reset(); - - if (!apollo_is_dsp3x00()) - { - machine().device(APOLLO_SCREEN_TAG)->reset(); - machine().device(APOLLO_KBD_TAG )->reset(); - } -} - -/*************************************************************************** - Machine Start - ***************************************************************************/ - -void apollo_state::machine_start(){ - memory_share *messram = memshare("messram"); - //MLOG1(("machine_start_dn3500: ram size is %d MB", (int)messram->bytes()/(1024*1024))); - - // clear ram - memset(messram->ptr(), 0x55, messram->bytes()); - - MACHINE_START_CALL_MEMBER(apollo); -} - -/*************************************************************************** - Driver Init - ***************************************************************************/ - -DRIVER_INIT_MEMBER(apollo_state,dn3500) -{ -// MLOG1(("driver_init_dn3500")); - - /* hook the RESET line, which resets a slew of other components */ - m_maincpu->set_reset_callback(write_line_delegate(FUNC(apollo_state::apollo_reset_instr_callback),this)); - - ram_base_address = DN3500_RAM_BASE; - ram_end_address = DN3500_RAM_END; - - node_type= NODE_TYPE_DN3500; - ram_config_byte= DN3500_RAM_CONFIG_BYTE; - - DRIVER_INIT_CALL(apollo); -} - -DRIVER_INIT_MEMBER(apollo_state,dsp3500) -{ - DRIVER_INIT_CALL( dn3500 ); -// MLOG1(("driver_init_dsp3500")); - node_type = NODE_TYPE_DSP3500; -} - -DRIVER_INIT_MEMBER(apollo_state,dn3000) -{ - DRIVER_INIT_CALL( dn3500 ); -// MLOG1(("driver_init_dn3000")); - - ram_base_address = DN3000_RAM_BASE; - ram_end_address = DN3000_RAM_END; - - node_type = NODE_TYPE_DN3000; - ram_config_byte= DN3000_RAM_CONFIG_8MB; -} - -DRIVER_INIT_MEMBER(apollo_state,dsp3000) -{ - DRIVER_INIT_CALL( dn3000 ); -// MLOG1(("driver_init_dsp3000")); - node_type = NODE_TYPE_DSP3000; -} - -DRIVER_INIT_MEMBER(apollo_state,dn5500) -{ - DRIVER_INIT_CALL( dn3500 ); -// MLOG1(("driver_init_dn5500")); - - ram_base_address = DN5500_RAM_BASE; - ram_end_address = DN5500_RAM_END; - - node_type = NODE_TYPE_DN5500; - ram_config_byte= DN5500_RAM_CONFIG_BYTE; -} - -DRIVER_INIT_MEMBER(apollo_state,dsp5500) -{ - DRIVER_INIT_CALL( dn5500 ); -// MLOG1(("driver_init_dsp5500")); - node_type = NODE_TYPE_DSP5500; -} - -/*************************************************************************** - Input Ports - ***************************************************************************/ - -static INPUT_PORTS_START( dn3500 ) - PORT_INCLUDE(apollo_config) - PORT_INCLUDE(apollo_kbd) -INPUT_PORTS_END - -static INPUT_PORTS_START( dsp3500 ) - PORT_INCLUDE(apollo_config) -INPUT_PORTS_END - -READ_LINE_MEMBER( apollo_state::apollo_kbd_is_german ) -{ - return (apollo_config(APOLLO_CONF_GERMAN_KBD) != 0) ? ASSERT_LINE : CLEAR_LINE; -} - -/*************************************************************************** - MACHINE DRIVERS - ***************************************************************************/ - -static MACHINE_CONFIG_START( dn3500, apollo_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU, M68030, 25000000) /* 25 MHz 68030 */ - MCFG_CPU_PROGRAM_MAP(dn3500_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_FRAGMENT_ADD( apollo ) - - /* keyboard beeper */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beep", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* internal ram */ - MCFG_RAM_ADD("messram") - MCFG_RAM_DEFAULT_SIZE("8M") - MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( dsp3500, apollo_state ) - MCFG_CPU_ADD(MAINCPU, M68030, 25000000) /* 25 MHz 68030 */ - MCFG_CPU_PROGRAM_MAP(dsp3500_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_FRAGMENT_ADD( apollo_terminal ) - - /* keyboard beeper */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beep", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* internal ram */ - MCFG_RAM_ADD("messram") - MCFG_RAM_DEFAULT_SIZE("8M") - MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M") - - /* terminal hardware */ - MCFG_DEFAULT_LAYOUT( layout_apollo_dsp ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dn3500_19i, dn3500 ) - /* video hardware 19" monochrome */ - MCFG_APOLLO_MONO19I_ADD(APOLLO_SCREEN_TAG) - MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) - MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) - MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dn3500_15i, dn3500 ) - /* video hardware is 15" monochrome or color */ - MCFG_APOLLO_GRAPHICS_ADD(APOLLO_SCREEN_TAG) - MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) - MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) - MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dn3000, dn3500 ) - MCFG_CPU_REPLACE(MAINCPU, M68020PMMU, 12000000) /* 12 MHz */ - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) - MCFG_CPU_PROGRAM_MAP(dn3000_map) - MCFG_DEVICE_REMOVE( APOLLO_SIO2_TAG ) - MCFG_RAM_MODIFY("messram") - MCFG_RAM_DEFAULT_SIZE("8M") - MCFG_RAM_EXTRA_OPTIONS("4M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( dsp3000, apollo_state ) - MCFG_CPU_ADD(MAINCPU, M68020PMMU, 12000000) /* 12 MHz */ - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) - MCFG_CPU_PROGRAM_MAP(dsp3000_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_FRAGMENT_ADD( apollo_terminal ) - - /* keyboard beeper */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beep", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* internal ram */ - MCFG_RAM_ADD("messram") - MCFG_RAM_DEFAULT_SIZE("8M") - MCFG_RAM_EXTRA_OPTIONS("4M") - - MCFG_DEVICE_REMOVE( APOLLO_SIO2_TAG ) - MCFG_RAM_MODIFY("messram") - - /* terminal hardware */ - MCFG_DEFAULT_LAYOUT( layout_apollo_dsp ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dn3000_19i, dn3000 ) - /* video hardware 19" monochrome */ - MCFG_APOLLO_MONO19I_ADD(APOLLO_SCREEN_TAG) - MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) - MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) - MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dn3000_15i, dn3000 ) - /* video hardware 15" monochrome */ - MCFG_APOLLO_GRAPHICS_ADD(APOLLO_SCREEN_TAG) - MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) - MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) - MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dn5500, dn3500 ) - MCFG_CPU_REPLACE(MAINCPU, M68040, 25000000) /* 25 MHz */ - MCFG_CPU_PROGRAM_MAP(dn5500_map) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( dsp5500, apollo_state ) - MCFG_CPU_ADD(MAINCPU, M68040, 25000000) /* 25 MHz */ - MCFG_CPU_PROGRAM_MAP(dsp5500_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(apollo_state,apollo_irq_acknowledge) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_FRAGMENT_ADD(apollo_terminal) - - /* keyboard beeper */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beep", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* terminal hardware */ - MCFG_DEFAULT_LAYOUT( layout_apollo_dsp ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dn5500_19i, dn5500 ) - /* video hardware 19" monochrome */ - MCFG_APOLLO_MONO19I_ADD(APOLLO_SCREEN_TAG) - MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) - MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) - MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dn5500_15i, dn5500 ) - /* video hardware 15" monochrome */ - MCFG_APOLLO_GRAPHICS_ADD(APOLLO_SCREEN_TAG) - MCFG_DEVICE_ADD(APOLLO_KBD_TAG, APOLLO_KBD, 0) - MCFG_APOLLO_KBD_TX_CALLBACK(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_a_w)) - MCFG_APOLLO_KBD_GERMAN_CALLBACK(READLINE(apollo_state, apollo_kbd_is_german)) -MACHINE_CONFIG_END - -/*************************************************************************** - ROM Definitions - ***************************************************************************/ - -ROM_START( dn3500 ) - // dn3500 boot ROM (Note: use sha1sum -b ) - ROM_REGION( 0x0100000, MAINCPU, 0 ) /* 68000 code */ - - // http://www.bitsavers.org/bits/Apollo/firmware/3500_BOOT_12191_7.bin - // Note: file name must be converted to lower case (i.e. 3500_boot_12191_7.bin) - // Note: this duplicates boot rom md7c-rev-8.00-1989-08-16-17-23-52.bin - ROM_SYSTEM_BIOS( 0, "md7c-rev-8.00", "MD7C REV 8.00, 1989/08/16.17:23:52" ) - ROMX_LOAD( "3500_boot_12191_7.bin", 0x00000, 0x10000, CRC(3132067d) SHA1(36f3c83d9f2df42f2537b09ca2f051a8c9dfbfc2) , ROM_BIOS(1) ) - - ROM_LOAD_OPTIONAL( "3000_3c505_010728-00.bin", 0x80000, 0x02000, CRC(69b77ec6) SHA1(7ac36cc6fc90b90ddfc56c45303b514cbe18ae58) ) -ROM_END - -ROM_START( dn5500 ) - // dn5500 boot ROM (Note: use sha1sum -b ) - ROM_REGION( 0x0100000, MAINCPU, 0 ) /* 68000 code */ - - ROM_SYSTEM_BIOS( 0, "md7c-rev-8.00", "MD7C REV 8.00, 1989/08/16.17:23:52" ) - ROMX_LOAD( "5500_boot_a1631-80046_1-30-92.bin", 0x00000, 0x10000, CRC(7b9ed610) SHA1(7315a884ec4551c44433c6079cc06509223cb02b) , ROM_BIOS(1) ) - - ROM_LOAD_OPTIONAL( "3000_3c505_010728-00.bin", 0x80000, 0x02000, CRC(69b77ec6) SHA1(7ac36cc6fc90b90ddfc56c45303b514cbe18ae58) ) -ROM_END - -ROM_START( dn3000) - ROM_REGION( 0x0090000, MAINCPU, 0 ) /* 68000 code */ - - ROM_SYSTEM_BIOS( 0, "md8-rev-7.0", "MD8 REV 7.0, 1988/08/16.15:14:39" ) - ROMX_LOAD( "3000_boot_8475_7.bin", 0x00000, 0x08000, CRC(0fe2d471) SHA1(6c383d2266719a3d069b7bf015f6945179395e7a), ROM_BIOS(1) ) - - ROM_LOAD_OPTIONAL( "3000_3c505_010728-00.bin", 0x80000, 0x02000, CRC(69b77ec6) SHA1(7ac36cc6fc90b90ddfc56c45303b514cbe18ae58) ) -ROM_END - -#define rom_dsp3500 rom_dn3500 -#define rom_dn3500_15i rom_dn3500 -#define rom_dn3500_19i rom_dn3500 - -#define rom_dsp3000 rom_dn3000 -#define rom_dn3000_19i rom_dn3000 - -#define rom_dsp5500 rom_dn5500 -#define rom_dn5500_15i rom_dn5500 -#define rom_dn5500_19i rom_dn5500 - -/*************************************************************************** - GAME DRIVERS - ***************************************************************************/ - -#define DN_FLAGS 0 -#define DSP_FLAGS 0 -//#define DSP_FLAGS MACHINE_NO_SOUND - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, dn3500, 0, 0, dn3500_15i, dn3500, apollo_state, dn3500, "Apollo", "Apollo DN3500", DN_FLAGS ) -COMP( 1989, dsp3500, dn3500, 0, dsp3500, dsp3500, apollo_state,dsp3500,"Apollo", "Apollo DSP3500", DSP_FLAGS ) -COMP( 1989, dn3500_19i, dn3500, 0, dn3500_19i, dn3500, apollo_state, dn3500, "Apollo", "Apollo DN3500 19\" Monochrome", DN_FLAGS ) - -COMP( 1988, dn3000, dn3500, 0, dn3000_15i, dn3500, apollo_state, dn3000, "Apollo", "Apollo DN3000", DN_FLAGS ) -COMP( 1988, dsp3000, dn3500, 0, dsp3000, dsp3500, apollo_state,dsp3000,"Apollo", "Apollo DSP3000", DSP_FLAGS ) -COMP( 1988, dn3000_19i, dn3500, 0, dn3000_19i, dn3500, apollo_state, dn3000, "Apollo", "Apollo DN3000 19\" Monochrome", DN_FLAGS ) - -COMP( 1991, dn5500, dn3500, 0, dn5500_15i, dn3500, apollo_state, dn5500, "Apollo", "Apollo DN5500", MACHINE_NOT_WORKING ) -COMP( 1991, dsp5500, dn3500, 0, dsp5500, dsp3500, apollo_state,dsp5500,"Apollo", "Apollo DSP5500", MACHINE_NOT_WORKING ) -COMP( 1991, dn5500_19i, dn3500, 0, dn5500_19i, dn3500, apollo_state, dn5500, "Apollo", "Apollo DN5500 19\" Monochrome", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/apple1.c b/src/mess/drivers/apple1.c deleted file mode 100644 index 7af5cf2d8ae..00000000000 --- a/src/mess/drivers/apple1.c +++ /dev/null @@ -1,331 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels, Colin Howell, R. Belmont -/********************************************************************** - -Apple I - -CPU: 6502 @ 1.023 MHz - (Effective speed with RAM refresh waits is 0.960 MHz.) - -RAM: 4-8 KB on main board (4 KB standard) - - Additional memory could be added via the expansion - connector, but the user was responsible for making sure - the extra memory was properly interfaced. - - Some users replaced the onboard 4-kilobit RAM chips with - 16-kilobit RAM chips, increasing on-board memory to 32 KB, - but this required modifying the RAM interface circuitry. - -ROM: 256 bytes for Monitor program - - Optional cassette interface included 256 bytes for - cassette routines. - -Interrupts: None. - (The system board had jumpers to allow interrupts, but - these were not connected in a standard system.) - -Video: Dumb terminal, based on 7 1K-bit shift registers - -Sound: None - -Hardware: Motorola 6820 PIA for keyboard and display interface - -Memory map: - -$0000-$1FFF: RAM address space - $0000-$00FF: 6502 zero page - $0024-$002B: Zero page locations used by the Monitor - $0100-$01FF: 6502 processor stack - $0200-$027F: Keyboard input buffer storage used by the Monitor - $0280-$0FFF: RAM space available for a program in a 4 KB system - $1000-$1FFF: Extra RAM space available for a program in an 8 KB system - not using cassette BASIC - -$2000-$BFFF: Unused address space, available for RAM in systems larger - than 8 KB. - -$C000-$CFFF: Address space for optional cassette interface - $C000-$C0FF: Cassette interface I/O range - $C100-$C1FF: Cassette interface ROM - -$D000-$DFFF: I/O address space - $D010-$D013: Motorola 6820 PIA registers. - $D010: Keyboard input port - $D011: Control register for keyboard input port, with - key-available flag. - $D012: Display output port (bit 7 is a status input) - $D013: Control register for display output port - (PIA registers also mirrored at $D014-$D017, $D018-$D01B, $D01C-$D01F, - $D030-$D03F, $D050-$D05F, ... , $DFD0-$DFDF, $DFF0-$DFFF.) - -$E000-$EFFF: Extra RAM space available for a program in an 8 KB system - modified to use cassette BASIC - (The system simulated here always includes this RAM.) - -If you wanted to load the BASIC as rom, here are the details: -ROM_LOAD("basic.bin", 0xE000, 0x1000, CRC(d5e86efc) SHA1(04269c1c66e7d5b4aa5035462c6e612bf2ae9b91) ) - - -$F000-$FFFF: ROM address space - $FF00-$FFFF: Apple Monitor ROM - - -How to use cassettes: -The system has no error checking or checksums, and the cassette -has no header. -Therefore, you must know the details, and pass these to the -interface yourself. -BASIC has no cassette handling. You must enter the monitor -with: CALL -151 -then when finished, re-enter BASIC with: E2B3R - - -Examples: - -A machine-language program will typically be like this: -C100R (enter the interface) -0300.0FFFR (enter the load and end addresses, then load the tape) -You start the tape. -When the prompt returns you stop the tape. -0300R (run your program) - - -To Load Tape Basic: -C100R -E000.EFFFR -You start the tape. -When the prompt returns you stop the tape. -E000R (It must say 4C - if not, your tape is no good). -The BASIC prompt will appear ->@ - - -A BASIC program is split into two areas, one for the scratch pad, -and one for the program proper. -In BASIC you may have to adjust the allowed memory area, such as -LOMEM = 768 -Then, go to the monitor: CALL -151 -C100R (enter the interface) -00A4.00FFR 0300.0FFFR (load the 2 parts) -You start the tape. -When the prompt returns you stop the tape. -E2B3R (back to BASIC) -You can LIST or RUN now. - - -Saving is almost the same, when you specify the address range, enter -W instead of R. The difficulty is finding out how long your program is. - -Insert a blank tape -C100R -0300.0FFFW -Quickly press Record. -When the prompt returns, press Stop. - -**********************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/6821pia.h" -#include "includes/apple1.h" -#include "imagedev/snapquik.h" -#include "machine/ram.h" - -#include "bus/a1bus/a1bus.h" -#include "bus/a1bus/a1cassette.h" -#include "bus/a1bus/a1cffa.h" - -/* port i/o functions */ - -/* memory w/r functions */ - -static ADDRESS_MAP_START( apple1_map, AS_PROGRAM, 8, apple1_state ) - /* In $D000-$DFFF, PIA is selected by address bit 4 being high, - and PIA registers are addressed with address bits 0-1. All - other address bits are ignored. Thus $D010-$D013 is mirrored - at all $Dxxx addresses with bit 4 high. */ - AM_RANGE(0xd010, 0xd013) AM_MIRROR(0x0fec) AM_DEVREADWRITE("pia",pia6821_device, read, write) - - /* We always include the remapped RAM for cassette BASIC, both for - simplicity and to allow the running of BASIC programs. */ - AM_RANGE(0xe000, 0xefff) AM_RAM - - AM_RANGE(0xf000, 0xfeff) AM_NOP - - /* Monitor ROM: */ - AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -/* graphics output */ - -const gfx_layout apple1_charlayout = -{ - 7, 8, /* character cell is 7 pixels wide by 8 pixels high */ - 64, /* 64 characters in 2513 character generator ROM */ - 1, /* 1 bitplane */ - { 0 }, - /* 5 visible pixels per row, starting at bit 3, with MSB being 0: */ - { 3, 4, 5, 6, 7 }, - /* pixel rows stored from top to bottom: */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 /* 8 8-bit pixel rows per character */ -}; - -static GFXDECODE_START( apple1 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, apple1_charlayout, 0, 1 ) -GFXDECODE_END - -/* keyboard input */ -/* - It's very likely that the keyboard assgnments are totally wrong: the code in machine/apple1.c - makes arbitrary assumptions about the mapping of the keys. The schematics that are available - on the web can help revealing the real layout. - The large picture of Woz's Apple I at http://home.earthlink.net/~judgementcall/apple1.jpg - show probably how the real keyboard was meant to be: note how the shifted symbols on the digits - and on some letters are different from the ones produced by current emulation and the presence - of the gray keys. -*/ - -static INPUT_PORTS_START( apple1 ) - PORT_START("KEY0") /* first sixteen keys */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - - PORT_START("KEY1") /* second sixteen keys */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - - PORT_START("KEY2") /* third sixteen keys */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backarrow") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') - - PORT_START("KEY3") /* fourth sixteen keys */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("KEY4") /* shift keys */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control (Left)") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control (Right)") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("KEY5") /* RESET and CLEAR SCREEN pushbutton switches */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) -INPUT_PORTS_END - -static SLOT_INTERFACE_START(apple1_cards) - SLOT_INTERFACE("cassette", A1BUS_CASSETTE) - SLOT_INTERFACE("cffa", A1BUS_CFFA) -SLOT_INTERFACE_END - -/* machine definition */ -static MACHINE_CONFIG_START( apple1, apple1_state ) - /* basic machine hardware */ - /* Actual CPU speed is 1.023 MHz, but RAM refresh effectively - slows it to 960 kHz. */ - MCFG_CPU_ADD("maincpu", M6502, 960000) /* 1.023 MHz */ - MCFG_CPU_PROGRAM_MAP(apple1_map) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - /* Video is blanked for 70 out of 262 scanlines per refresh cycle. - Each scanline is composed of 65 character times, 40 of which - are visible, and each character time is 7 dot times; a dot time - is 2 cycles of the fundamental 14.31818 MHz oscillator. The - total blanking time is about 4450 microseconds. */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((int) (70 * 65 * 7 * 2 / 14.31818))) - /* It would be nice if we could implement some sort of display - overscan here. */ - MCFG_SCREEN_SIZE(40 * 7, 24 * 8) - MCFG_SCREEN_VISIBLE_AREA(0, 40 * 7 - 1, 0, 24 * 8 - 1) - MCFG_SCREEN_UPDATE_DRIVER(apple1_state, screen_update_apple1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", apple1) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_DEVICE_ADD( "pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(apple1_state,apple1_pia0_kbdin)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(apple1_state,apple1_pia0_dspout)) - MCFG_PIA_CB2_HANDLER(WRITELINE(apple1_state,apple1_pia0_dsp_write_signal)) - - MCFG_DEVICE_ADD("a1bus", A1BUS, 0) - MCFG_A1BUS_CPU("maincpu") - MCFG_A1BUS_SLOT_ADD("a1bus", "exp", apple1_cards, "cassette") - - /* snapshot */ - MCFG_SNAPSHOT_ADD("snapshot", apple1_state, apple1, "snp", 0) - - MCFG_SOFTWARE_LIST_ADD("cass_list","apple1") - - /* Note that because we always include 4K of RAM at $E000-$EFFF, - the RAM amounts listed here will be 4K below the actual RAM - total. */ - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") - MCFG_RAM_EXTRA_OPTIONS("4K,8K,12K,16K,20K,24K,28K,32K,36K,40K,44K") - -MACHINE_CONFIG_END - -ROM_START(apple1) - ROM_REGION(0x100, "maincpu",0) - /* 256-byte main monitor ROM, in two 82s129 or mmi6301 256x4 proms at A1 and A2 called APPLE-A1(bits D3-D0) and APPLE-A2(bits D7-D4) */ - ROM_LOAD_NIB_HIGH( "apple-a2.a2", 0x0000, 0x0100, CRC(254bfb95) SHA1(b6468b72295b7d8ac288d104d252f24de1f1d611) ) - ROM_LOAD_NIB_LOW( "apple-a1.a1", 0x0000, 0x0100, CRC(434f8ce6) SHA1(9deee2d39903209b20c3fc6b58e16372f8efece1) ) - /* 512-byte Signetics 2513 character generator ROM at location D2-D3 */ - ROM_REGION(0x0200, "gfx1",0) - ROM_LOAD("s2513.d2", 0x0000, 0x0200, CRC(a7e567fc) SHA1(b18aae0a2d4f92f5a7e22640719bbc4652f3f4ee)) // apple1.vid -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1976, apple1, 0, 0, apple1, apple1, apple1_state, apple1, "Apple Computer", "Apple I" , MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c deleted file mode 100644 index 8cf74588ffc..00000000000 --- a/src/mess/drivers/apple2.c +++ /dev/null @@ -1,1614 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - apple2.c - Apple II/II Plus and clones - - Next generation driver written in September/October 2014 by R. Belmont. - Thanks to the original Apple II series driver's authors: Mike Balfour, Nathan Woods, and R. Belmont - Special thanks to the Apple II Documentation Project/Antoine Vignau and Peter Ferrie. - -II: original base model. RAM sizes of 4, 8, 12, 16, 20, 24, 32, 36, and 48 KB possible. - 8K of ROM at $E000-$FFFF, empty sockets for $D000-$D7FF and $D800-$DFFF. - Programmer's Aid #1 was sold by Apple for $D000-$D7FF, some third-party ROMs - were also available. - - Revision 0 (very rare) had only 4 hi-res colors (blue and orange were missing). - Revision 0 boards also did not include a color killer in text mode, making text - fringey on color TVs/monitors. - - ROM contains original non-autostart Monitor and Integer BASIC; apparently - Autostart + Integer is also possible. - -II Plus: RAM options reduced to 16/32/48 KB. - ROM expanded to 12KB from $D000-$FFFF containing Applesoft BASIC and - the Autostart Monitor. Applesoft is a licensed version of Microsoft's - 6502 BASIC as also found in Commodore and many other computers. - - - Users of both models often connected the SHIFT key to the paddle #2 button - (mapped to $C063) in order to inform properly written software that characters - were to be intended upper/lower case. - - Both models commonly included a RAM "language card" in slot 0 which added 16K - of RAM which could be banked into the $D000-$FFFF space to replace the ROMs. - This allowed running Applesoft on a II and Integer BASIC on a II Plus. - A II Plus with this card installed is often called a "64K Apple II"; this is - the base configuration required to run ProDOS and some larger games. - -************************************************************************/ - -#include "emu.h" -#include "machine/bankdev.h" -#include "machine/ram.h" -#include "machine/kb3600.h" -#include "sound/speaker.h" -#include "imagedev/flopdrv.h" -#include "imagedev/cassette.h" -#include "formats/ap2_dsk.h" -#include "cpu/m6502/m6502.h" -#include "video/apple2.h" - -#include "bus/a2bus/a2bus.h" -#include "bus/a2bus/a2diskii.h" -#include "bus/a2bus/a2diskiing.h" -#include "bus/a2bus/a2mockingboard.h" -#include "bus/a2bus/a2cffa.h" -#include "bus/a2bus/a2memexp.h" -#include "bus/a2bus/a2scsi.h" -#include "bus/a2bus/a2thunderclock.h" -#include "bus/a2bus/a2softcard.h" -#include "bus/a2bus/a2videoterm.h" -#include "bus/a2bus/a2ssc.h" -#include "bus/a2bus/a2swyft.h" -#include "bus/a2bus/a2themill.h" -#include "bus/a2bus/a2sam.h" -#include "bus/a2bus/a2alfam2.h" -#include "bus/a2bus/laser128.h" -#include "bus/a2bus/a2echoii.h" -#include "bus/a2bus/a2arcadebd.h" -#include "bus/a2bus/a2midi.h" -#include "bus/a2bus/a2zipdrive.h" -#include "bus/a2bus/a2applicard.h" -#include "bus/a2bus/a2ultraterm.h" -#include "bus/a2bus/a2pic.h" -#include "bus/a2bus/a2corvus.h" -#include "bus/a2bus/a2mcms.h" -#include "bus/a2bus/a2dx1.h" -#include "bus/a2bus/timemasterho.h" -#include "bus/a2bus/mouse.h" -#include "bus/a2bus/ramcard16k.h" -#include "bus/a2bus/ramcard128k.h" -#include "bus/a2bus/ezcgi.h" - -#define A2_CPU_TAG "maincpu" -#define A2_KBDC_TAG "ay3600" -#define A2_BUS_TAG "a2bus" -#define A2_SPEAKER_TAG "speaker" -#define A2_CASSETTE_TAG "tape" -#define A2_UPPERBANK_TAG "inhbank" -#define A2_VIDEO_TAG "a2video" - -class napple2_state : public driver_device -{ -public: - napple2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, A2_CPU_TAG), - m_ram(*this, RAM_TAG), - m_ay3600(*this, A2_KBDC_TAG), - m_video(*this, A2_VIDEO_TAG), - m_a2bus(*this, A2_BUS_TAG), - m_joy1x(*this, "joystick_1_x"), - m_joy1y(*this, "joystick_1_y"), - m_joy2x(*this, "joystick_2_x"), - m_joy2y(*this, "joystick_2_y"), - m_joybuttons(*this, "joystick_buttons"), - m_kbspecial(*this, "keyb_special"), - m_kbrepeat(*this, "keyb_repeat"), - m_resetdip(*this, "reset_dip"), - m_sysconfig(*this, "a2_config"), - m_speaker(*this, A2_SPEAKER_TAG), - m_cassette(*this, A2_CASSETTE_TAG), - m_upperbank(*this, A2_UPPERBANK_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_ay3600; - required_device m_video; - required_device m_a2bus; - required_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons; - required_ioport m_kbspecial; - required_ioport m_kbrepeat; - optional_ioport m_resetdip; - required_ioport m_sysconfig; - required_device m_speaker; - required_device m_cassette; - required_device m_upperbank; - - TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(ay3600_repeat); - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_PALETTE_INIT(apple2); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER(ram_r); - DECLARE_WRITE8_MEMBER(ram_w); - DECLARE_READ8_MEMBER(c000_r); - DECLARE_WRITE8_MEMBER(c000_w); - DECLARE_READ8_MEMBER(c080_r); - DECLARE_WRITE8_MEMBER(c080_w); - DECLARE_READ8_MEMBER(c100_r); - DECLARE_WRITE8_MEMBER(c100_w); - DECLARE_READ8_MEMBER(c800_r); - DECLARE_WRITE8_MEMBER(c800_w); - DECLARE_READ8_MEMBER(inh_r); - DECLARE_WRITE8_MEMBER(inh_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); - DECLARE_READ_LINE_MEMBER(ay3600_shift_r); - DECLARE_READ_LINE_MEMBER(ay3600_control_r); - DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); - DECLARE_WRITE_LINE_MEMBER(ay3600_ako_w); - -private: - int m_speaker_state; - int m_cassette_state; - - double m_joystick_x1_time; - double m_joystick_y1_time; - double m_joystick_x2_time; - double m_joystick_y2_time; - - UINT16 m_lastchar, m_strobe; - UINT8 m_transchar; - bool m_anykeydown; - - int m_inh_slot; - int m_cnxx_slot; - - bool m_page2; - bool m_an0, m_an1, m_an2, m_an3; - - UINT8 *m_ram_ptr; - int m_ram_size; - - int m_inh_bank; - - double m_x_calibration, m_y_calibration; - - device_a2bus_card_interface *m_slotdevice[8]; - - void do_io(address_space &space, int offset); - UINT8 read_floatingbus(); -}; - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -#define JOYSTICK_DELTA 80 -#define JOYSTICK_SENSITIVITY 50 -#define JOYSTICK_AUTOCENTER 80 - -WRITE_LINE_MEMBER(napple2_state::a2bus_irq_w) -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, state); -} - -WRITE_LINE_MEMBER(napple2_state::a2bus_nmi_w) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, state); -} - -// This code makes a ton of assumptions because we can guarantee a pre-IIe machine! -WRITE_LINE_MEMBER(napple2_state::a2bus_inh_w) -{ - if (state == ASSERT_LINE) - { - // assume no cards are pulling /INH - m_inh_slot = -1; - - // scan the slots to figure out which card(s) are INHibiting stuff - for (int i = 0; i <= 7; i++) - { - if (m_slotdevice[i]) - { - // this driver only can inhibit from 0xd000-0xffff - if ((m_slotdevice[i]->inh_start() == 0xd000) && - (m_slotdevice[i]->inh_end() == 0xffff)) - { - if ((m_slotdevice[i]->inh_type() & INH_READ) == INH_READ) - { - if (m_inh_bank != 1) - { - m_upperbank->set_bank(1); - m_inh_bank = 1; - } - } - else - { - if (m_inh_bank != 0) - { - m_upperbank->set_bank(0); - m_inh_bank = 0; - } - } - - m_inh_slot = i; - break; - } - } - } - - // if no slots are inhibiting, make sure ROM is fully switched in - if ((m_inh_slot == -1) && (m_inh_bank != 0)) - { - m_upperbank->set_bank(0); - m_inh_bank = 0; - } - } -} - -/*************************************************************************** - START/RESET -***************************************************************************/ - -void napple2_state::machine_start() -{ - m_ram_ptr = m_ram->pointer(); - m_ram_size = m_ram->size(); - m_speaker_state = 0; - m_speaker->level_w(m_speaker_state); - m_cassette_state = 0; - m_cassette->output(-1.0f); - m_upperbank->set_bank(0); - m_inh_bank = 0; - - // precalculate joystick time constants - m_x_calibration = attotime::from_usec(12).as_double(); - m_y_calibration = attotime::from_usec(13).as_double(); - - // cache slot devices - for (int i = 0; i <= 7; i++) - { - m_slotdevice[i] = m_a2bus->get_a2bus_card(i); - } - - // setup save states - save_item(NAME(m_speaker_state)); - save_item(NAME(m_cassette_state)); - save_item(NAME(m_joystick_x1_time)); - save_item(NAME(m_joystick_y1_time)); - save_item(NAME(m_joystick_x2_time)); - save_item(NAME(m_joystick_y2_time)); - save_item(NAME(m_lastchar)); - save_item(NAME(m_strobe)); - save_item(NAME(m_transchar)); - save_item(NAME(m_inh_slot)); - save_item(NAME(m_inh_bank)); - save_item(NAME(m_cnxx_slot)); - save_item(NAME(m_page2)); - save_item(NAME(m_an0)); - save_item(NAME(m_an1)); - save_item(NAME(m_an2)); - save_item(NAME(m_an3)); - save_item(NAME(m_anykeydown)); - - // setup video pointers - m_video->m_ram_ptr = m_ram_ptr; - m_video->m_aux_ptr = m_ram_ptr; - m_video->m_char_ptr = memregion("gfx1")->base(); - m_video->m_char_size = memregion("gfx1")->bytes(); -} - -void napple2_state::machine_reset() -{ - m_inh_slot = -1; - m_cnxx_slot = -1; - m_page2 = false; - m_an0 = m_an1 = m_an2 = m_an3 = false; - m_anykeydown = false; -} - -/*************************************************************************** - VIDEO -***************************************************************************/ - -TIMER_DEVICE_CALLBACK_MEMBER(napple2_state::apple2_interrupt) -{ - int scanline = param; - - if((scanline % 8) == 0) - machine().first_screen()->update_partial(machine().first_screen()->vpos()); - - // update the video system's shadow copy of the system config at the end of the frame - if (scanline == 192) - { - m_video->m_sysconfig = m_sysconfig->read(); - - // check reset - if (m_resetdip) // if reset DIP is present, use it - { - if (m_resetdip->read() & 1) - { // CTRL-RESET - if ((m_kbspecial->read() & 0x88) == 0x88) - { - m_maincpu->reset(); - } - } - else // plain RESET - { - if (m_kbspecial->read() & 0x80) - { - m_maincpu->reset(); - } - } - } - else // no DIP, so always plain RESET - { - if (m_kbspecial->read() & 0x80) - { - m_maincpu->reset(); - } - } - } -} - -PALETTE_INIT_MEMBER(napple2_state, apple2) -{ - m_video->palette_init_apple2(palette); -} - -UINT32 napple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // always update the flash timer here so it's smooth regardless of mode switches - m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; - - if (m_video->m_graphics) - { - if (m_video->m_hires) - { - if (m_video->m_mix) - { - m_video->hgr_update(screen, bitmap, cliprect, 0, 159); - if (!strcmp(machine().system().name, "ivelultr")) - { - m_video->text_update_ultr(screen, bitmap, cliprect, 160, 191); - } - else - { - m_video->text_update_orig(screen, bitmap, cliprect, 160, 191); - } - } - else - { - m_video->hgr_update(screen, bitmap, cliprect, 0, 191); - } - } - else // lo-res - { - if (m_video->m_mix) - { - m_video->lores_update(screen, bitmap, cliprect, 0, 159); - if (!strcmp(machine().system().name, "ivelultr")) - { - m_video->text_update_ultr(screen, bitmap, cliprect, 160, 191); - } - else - { - m_video->text_update_orig(screen, bitmap, cliprect, 160, 191); - } - } - else - { - m_video->lores_update(screen, bitmap, cliprect, 0, 191); - } - } - } - else - { - if (!strcmp(machine().system().name, "ivelultr")) - { - m_video->text_update_ultr(screen, bitmap, cliprect, 0, 191); - } - else - { - m_video->text_update_orig(screen, bitmap, cliprect, 0, 191); - } - } - - return 0; -} - -/*************************************************************************** - I/O -***************************************************************************/ -// most softswitches don't care about read vs write, so handle them here -void napple2_state::do_io(address_space &space, int offset) -{ - if(space.debugger_access()) - { - return; - } - - switch (offset) - { - case 0x20: - m_cassette_state ^= 1; - m_cassette->output(m_cassette_state ? 1.0f : -1.0f); - break; - - case 0x30: - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - break; - - case 0x50: // graphics mode - m_video->m_graphics = true; break; - - case 0x51: // text mode - m_video->m_graphics = false; break; - - case 0x52: // no mix - m_video->m_mix = false; break; - - case 0x53: // mixed mode - m_video->m_mix = true; break; - - case 0x54: // set page 1 - m_page2 = false; - m_video->m_page2 = false; - break; - - case 0x55: // set page 2 - m_page2 = true; - m_video->m_page2 = true; - break; - - case 0x56: // select lo-res - m_video->m_hires = false; break; - - case 0x57: // select hi-res - m_video->m_hires = true; break; - - case 0x58: // AN0 off - m_an0 = false; break; - - case 0x59: // AN0 on - m_an0 = true; break; - - case 0x5a: // AN1 off - m_an1 = false; break; - - case 0x5b: // AN1 on - m_an1 = true; break; - - case 0x5c: // AN2 off - m_an2 = false; break; - - case 0x5d: // AN2 on - m_an2 = true; break; - - case 0x5e: // AN3 off - m_an3 = false; break; - - case 0x5f: // AN3 on - m_an3 = true; break; - - case 0x68: // IIgs STATE register, which ProDOS touches - break; - - case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: - case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: - m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_joy1x->read(); - m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_joy1y->read(); - m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_joy2x->read(); - m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read(); - break; - } -} - -READ8_MEMBER(napple2_state::c000_r) -{ - switch (offset) - { - case 0x00: // keyboard latch - return m_transchar | m_strobe; - - case 0x10: // reads any key down, clears strobe - { - UINT8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); - m_strobe = 0; - return rv; - } - - case 0x60: // cassette in - case 0x68: - return m_cassette->input() > 0.0 ? 0x80 : 0; - - case 0x61: // button 0 - case 0x69: - return (m_joybuttons->read() & 0x10) ? 0x80 : 0; - - case 0x62: // button 1 - case 0x6a: - return (m_joybuttons->read() & 0x20) ? 0x80 : 0; - - case 0x63: // button 2 - case 0x6b: - // check if SHIFT key mod configured - if (m_sysconfig->read() & 0x04) - { - return ((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0; - } - return (m_joybuttons->read() & 0x40) ? 0x80 : 0; - - case 0x64: // joy 1 X axis - case 0x6c: - return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; - - case 0x65: // joy 1 Y axis - case 0x6d: - return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; - - case 0x66: // joy 2 X axis - case 0x6e: - return (space.machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0; - - case 0x67: // joy 2 Y axis - case 0x6f: - return (space.machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0; - - default: - do_io(space, offset); - break; - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(napple2_state::c000_w) -{ - switch (offset) - { - case 0x10: // clear keyboard latch - m_strobe = 0; - break; - - default: - do_io(space, offset); - break; - } -} - -READ8_MEMBER(napple2_state::c080_r) -{ - if(!space.debugger_access()) - { - int slot; - - offset &= 0x7F; - slot = offset / 0x10; - - if (m_slotdevice[slot] != NULL) - { - return m_slotdevice[slot]->read_c0nx(space, offset % 0x10); - } - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(napple2_state::c080_w) -{ - int slot; - - offset &= 0x7F; - slot = offset / 0x10; - - if (m_slotdevice[slot] != NULL) - { - m_slotdevice[slot]->write_c0nx(space, offset % 0x10, data); - } -} - -READ8_MEMBER(napple2_state::c100_r) -{ - int slotnum; - - slotnum = ((offset>>8) & 0xf) + 1; - - if (m_slotdevice[slotnum] != NULL) - { - if ((m_slotdevice[slotnum]->take_c800()) && (!space.debugger_access())) - { - m_cnxx_slot = slotnum; - } - - return m_slotdevice[slotnum]->read_cnxx(space, offset&0xff); - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(napple2_state::c100_w) -{ - int slotnum; - - slotnum = ((offset>>8) & 0xf) + 1; - - if (m_slotdevice[slotnum] != NULL) - { - if ((m_slotdevice[slotnum]->take_c800()) && (!space.debugger_access())) - { - m_cnxx_slot = slotnum; - } - - m_slotdevice[slotnum]->write_cnxx(space, offset&0xff, data); - } -} - -READ8_MEMBER(napple2_state::c800_r) -{ - if (offset == 0x7ff) - { - m_cnxx_slot = -1; - return 0xff; - } - - if ((m_cnxx_slot != -1) && (m_slotdevice[m_cnxx_slot] != NULL)) - { - return m_slotdevice[m_cnxx_slot]->read_c800(space, offset&0xfff); - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(napple2_state::c800_w) -{ - if (offset == 0x7ff) - { - m_cnxx_slot = -1; - return; - } - - if ((m_cnxx_slot != -1) && (m_slotdevice[m_cnxx_slot] != NULL)) - { - m_slotdevice[m_cnxx_slot]->write_c800(space, offset&0xfff, data); - } -} - -READ8_MEMBER(napple2_state::inh_r) -{ - if (m_inh_slot != -1) - { - return m_slotdevice[m_inh_slot]->read_inh_rom(space, offset + 0xd000); - } - - assert(0); // hitting inh_r with invalid m_inh_slot should not be possible - return read_floatingbus(); -} - -WRITE8_MEMBER(napple2_state::inh_w) -{ - if (m_inh_slot != -1) - { - m_slotdevice[m_inh_slot]->write_inh_rom(space, offset + 0xd000, data); - } -} - -// floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter -UINT8 napple2_state::read_floatingbus() -{ - enum - { - // scanner types - kScannerNone = 0, kScannerApple2, kScannerApple2e, - - // scanner constants - kHBurstClock = 53, // clock when Color Burst starts - kHBurstClocks = 4, // clocks per Color Burst duration - kHClock0State = 0x18, // H[543210] = 011000 - kHClocks = 65, // clocks per horizontal scan (including HBL) - kHPEClock = 40, // clock when HPE (horizontal preset enable) goes low - kHPresetClock = 41, // clock when H state presets - kHSyncClock = 49, // clock when HSync starts - kHSyncClocks = 4, // clocks per HSync duration - kNTSCScanLines = 262, // total scan lines including VBL (NTSC) - kNTSCVSyncLine = 224, // line when VSync starts (NTSC) - kPALScanLines = 312, // total scan lines including VBL (PAL) - kPALVSyncLine = 264, // line when VSync starts (PAL) - kVLine0State = 0x100, // V[543210CBA] = 100000000 - kVPresetLine = 256, // line when V state presets - kVSyncLines = 4, // lines per VSync duration - kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? - }; - - // vars - // - int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ - h_clock, h_state, h_0, h_1, h_2, h_3, h_4, h_5, - v_line, v_state, v_A, v_B, v_C, v_0, v_1, v_2, v_3, v_4, /* v_5, */ - _hires, addend0, addend1, addend2, sum, address; - - // video scanner data - // - i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync - - // machine state switches - // - Hires = (m_video->m_hires && m_video->m_graphics) ? 1 : 0; - Mixed = m_video->m_mix ? 1 : 0; - Page2 = m_page2 ? 1 : 0; - _80Store = 0; - - // calculate video parameters according to display standard - // - ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? - // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? - // ScanCycles = ScanLines * kHClocks; - - // calculate horizontal scanning state - // - h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock - h_state = kHClock0State + h_clock; // H state bits - if (h_clock >= kHPresetClock) // check for horizontal preset - { - h_state -= 1; // correct for state preset (two 0 states) - } - h_0 = (h_state >> 0) & 1; // get horizontal state bits - h_1 = (h_state >> 1) & 1; - h_2 = (h_state >> 2) & 1; - h_3 = (h_state >> 3) & 1; - h_4 = (h_state >> 4) & 1; - h_5 = (h_state >> 5) & 1; - - // calculate vertical scanning state - // - v_line = i / kHClocks; // which vertical scanning line - v_state = kVLine0State + v_line; // V state bits - if ((v_line >= kVPresetLine)) // check for previous vertical state preset - { - v_state -= ScanLines; // compensate for preset - } - v_A = (v_state >> 0) & 1; // get vertical state bits - v_B = (v_state >> 1) & 1; - v_C = (v_state >> 2) & 1; - v_0 = (v_state >> 3) & 1; - v_1 = (v_state >> 4) & 1; - v_2 = (v_state >> 5) & 1; - v_3 = (v_state >> 6) & 1; - v_4 = (v_state >> 7) & 1; - //v_5 = (v_state >> 8) & 1; - - // calculate scanning memory address - // - _hires = Hires; - if (Hires && Mixed && (v_4 & v_2)) - { - _hires = 0; // (address is in text memory) - } - - addend0 = 0x68; // 1 1 0 1 - addend1 = (h_5 << 5) | (h_4 << 4) | (h_3 << 3); - addend2 = (v_4 << 6) | (v_3 << 5) | (v_4 << 4) | (v_3 << 3); - sum = (addend0 + addend1 + addend2) & (0x0F << 3); - - address = 0; - address |= h_0 << 0; // a0 - address |= h_1 << 1; // a1 - address |= h_2 << 2; // a2 - address |= sum; // a3 - aa6 - address |= v_0 << 7; // a7 - address |= v_1 << 8; // a8 - address |= v_2 << 9; // a9 - address |= ((_hires) ? v_A : (1 ^ (Page2 & (1 ^ _80Store)))) << 10; // a10 - address |= ((_hires) ? v_B : (Page2 & (1 ^ _80Store))) << 11; // a11 - if (_hires) // hires? - { - // Y: insert hires only address bits - // - address |= v_C << 12; // a12 - address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 - address |= (Page2 & (1 ^ _80Store)) << 14; // a14 - } - else - { - // N: text, so no higher address bits unless Apple ][, not Apple //e - // - if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) - (kHPEClock <= h_clock) && // Y: HBL? - (h_clock <= (kHClocks - 1))) - { - address |= 1 << 12; // Y: a12 (add $1000 to address!) - } - } - - return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? -} - -/*************************************************************************** - ADDRESS MAP -***************************************************************************/ - -READ8_MEMBER(napple2_state::ram_r) -{ - if (offset < m_ram_size) - { - return m_ram_ptr[offset]; - } - - return 0xff; -} - -WRITE8_MEMBER(napple2_state::ram_w) -{ - if (offset < m_ram_size) - { - m_ram_ptr[offset] = data; - } -} - -static ADDRESS_MAP_START( apple2_map, AS_PROGRAM, 8, napple2_state ) - AM_RANGE(0x0000, 0xbfff) AM_READWRITE(ram_r, ram_w) - AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) - AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) - AM_RANGE(0xc100, 0xc7ff) AM_READWRITE(c100_r, c100_w) - AM_RANGE(0xc800, 0xcfff) AM_READWRITE(c800_r, c800_w) - AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( inhbank_map, AS_PROGRAM, 8, napple2_state ) - AM_RANGE(0x0000, 0x2fff) AM_ROM AM_REGION("maincpu", 0x1000) AM_WRITE(inh_w) - AM_RANGE(0x3000, 0x5fff) AM_READWRITE(inh_r, inh_w) -ADDRESS_MAP_END - -/*************************************************************************** - KEYBOARD -***************************************************************************/ - -READ_LINE_MEMBER(napple2_state::ay3600_shift_r) -{ - // either shift key - if (m_kbspecial->read() & 0x06) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -READ_LINE_MEMBER(napple2_state::ay3600_control_r) -{ - if (m_kbspecial->read() & 0x08) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -static const UINT8 a2_key_remap[0x32][4] = -{ -/* norm shft ctrl both */ - { 0x33,0x23,0x33,0x23 }, /* 3 # 00 */ - { 0x34,0x24,0x34,0x24 }, /* 4 $ 01 */ - { 0x35,0x25,0x35,0x25 }, /* 5 % 02 */ - { 0x36,'&', 0x35,'&' }, /* 6 & 03 */ - { 0x37,0x27,0x37,0x27 }, /* 7 ' 04 */ - { 0x38,0x28,0x38,0x28 }, /* 8 ( 05 */ - { 0x39,0x29,0x39,0x29 }, /* 9 ) 06 */ - { 0x30,0x30,0x30,0x30 }, /* 0 07 */ - { 0x3a,0x2a,0x3b,0x2a }, /* : * 08 */ - { 0x2d,0x3d,0x2d,0x3d }, /* - = 09 */ - { 0x51,0x51,0x11,0x11 }, /* q Q 0a */ - { 0x57,0x57,0x17,0x17 }, /* w W 0b */ - { 0x45,0x45,0x05,0x05 }, /* e E 0c */ - { 0x52,0x52,0x12,0x12 }, /* r R 0d */ - { 0x54,0x54,0x14,0x14 }, /* t T 0e */ - { 0x59,0x59,0x19,0x19 }, /* y Y 0f */ - { 0x55,0x55,0x15,0x15 }, /* u U 10 */ - { 0x49,0x49,0x09,0x09 }, /* i I 11 */ - { 0x4f,0x4f,0x0f,0x0f }, /* o O 12 */ - { 0x50,0x40,0x10,0x40 }, /* p P 13 */ - { 0x44,0x44,0x04,0x04 }, /* d D 14 */ - { 0x46,0x46,0x06,0x06 }, /* f F 15 */ - { 0x47,0x47,0x07,0x07 }, /* g G 16 */ - { 0x48,0x48,0x08,0x08 }, /* h H 17 */ - { 0x4a,0x4a,0x0a,0x0a }, /* j J 18 */ - { 0x4b,0x4b,0x0b,0x0b }, /* k K 19 */ - { 0x4c,0x4c,0x0c,0x0c }, /* l L 1a */ - { ';' ,0x2b,';' ,0x2b }, /* ; + 1b */ - { 0x08,0x08,0x08,0x08 }, /* Left 1c */ - { 0x15,0x15,0x15,0x15 }, /* Right 1d */ - { 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */ - { 0x58,0x58,0x18,0x18 }, /* x X 1f */ - { 0x43,0x43,0x03,0x03 }, /* c C 20 */ - { 0x56,0x56,0x16,0x16 }, /* v V 21 */ - { 0x42,0x42,0x02,0x02 }, /* b B 22 */ - { 0x4e,0x5e,0x0e,0x5e }, /* n N 23 */ - { 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */ - { 0x2c,0x3c,0x2c,0x3c }, /* , < 25 */ - { 0x2e,0x3e,0x2e,0x3e }, /* . > 26 */ - { 0x2f,0x3f,0x2f,0x3f }, /* / ? 27 */ - { 0x53,0x53,0x13,0x13 }, /* s S 28 */ - { 0x32,0x22,0x32,0x00 }, /* 2 " 29 */ - { 0x31,0x21,0x31,0x31 }, /* 1 ! 2a */ - { 0x1b,0x1b,0x1b,0x1b }, /* Escape 2b */ - { 0x41,0x41,0x01,0x01 }, /* a A 2c */ - { 0x20,0x20,0x20,0x20 }, /* Space 2d */ - { 0x00,0x00,0x00,0x00 }, /* 0x2e unused */ - { 0x00,0x00,0x00,0x00 }, /* 0x2f unused */ - { 0x00,0x00,0x00,0x00 }, /* 0x30 unused */ - { 0x0d,0x0d,0x0d,0x0d }, /* Enter 31 */ -}; - -WRITE_LINE_MEMBER(napple2_state::ay3600_data_ready_w) -{ - if (state == ASSERT_LINE) - { - int mod = 0; - m_lastchar = m_ay3600->b_r(); - - mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; - mod |= (m_kbspecial->read() & 0x08) ? 0x02 : 0x00; - - m_transchar = a2_key_remap[m_lastchar&0x3f][mod]; - - if (m_transchar != 0) - { - m_strobe = 0x80; -// printf("new char = %04x (%02x)\n", m_lastchar&0x3f, m_transchar); - } - } -} - -WRITE_LINE_MEMBER(napple2_state::ay3600_ako_w) -{ - m_anykeydown = (state == ASSERT_LINE) ? true : false; -} - -TIMER_DEVICE_CALLBACK_MEMBER(napple2_state::ay3600_repeat) -{ - // is the key still down? - if (m_anykeydown) - { - if (m_kbrepeat->read() & 1) - { - m_strobe = 0x80; - } - } -} - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( apple2_joystick ) - PORT_START("joystick_1_x") /* Joystick 1 X Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P1 Joystick X") - PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) - PORT_KEYDELTA(JOYSTICK_DELTA) - PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) - PORT_MINMAX(0,0xff) PORT_PLAYER(1) - PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) - PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) - - PORT_START("joystick_1_y") /* Joystick 1 Y Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P1 Joystick Y") - PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) - PORT_KEYDELTA(JOYSTICK_DELTA) - PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) - PORT_MINMAX(0,0xff) PORT_PLAYER(1) - PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) - PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) - - PORT_START("joystick_2_x") /* Joystick 2 X Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P2 Joystick X") - PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) - PORT_KEYDELTA(JOYSTICK_DELTA) - PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) - PORT_MINMAX(0,0xff) PORT_PLAYER(2) - PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) - - PORT_START("joystick_2_y") /* Joystick 2 Y Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P2 Joystick Y") - PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) - PORT_KEYDELTA(JOYSTICK_DELTA) - PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) - PORT_MINMAX(0,0xff) PORT_PLAYER(2) - PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) - - PORT_START("joystick_buttons") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CODE(JOYCODE_BUTTON1) -INPUT_PORTS_END - -INPUT_PORTS_START( apple2_gameport ) - PORT_INCLUDE( apple2_joystick ) -INPUT_PORTS_END - -INPUT_PORTS_START( apple2_sysconfig ) - PORT_START("a2_config") - PORT_CONFNAME(0x03, 0x00, "Composite monitor type") - PORT_CONFSETTING(0x00, "Color") - PORT_CONFSETTING(0x01, "B&W") - PORT_CONFSETTING(0x02, "Green") - PORT_CONFSETTING(0x03, "Amber") - - PORT_CONFNAME(0x04, 0x04, "Shift key mod") // default to installed - PORT_CONFSETTING(0x00, "Not present") - PORT_CONFSETTING(0x04, "Installed") -INPUT_PORTS_END - - /* - Apple II / II Plus key matrix (from "The Apple II Circuit Description") - - | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | - | | | | | | | | | | | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X0 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | :* | - | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X1 | Q | W | E | R | T | Y | U | I | O | P | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X2 | D | F | G | H | J | K | L | ;+ |LEFT |RIGHT| - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X3 | Z | X | C | V | B | N | M | ,< | .> | /? | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X4 | S | 2 | 1 | ESC | A |SPACE| | | |ENTER| - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - */ - -static INPUT_PORTS_START( apple2_common ) - PORT_START("X0") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - - PORT_START("X1") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('@') - - PORT_START("X2") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - - PORT_START("X3") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('^') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("X4") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("X5") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("X6") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("X7") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("X8") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyb_special") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) -INPUT_PORTS_END - -static INPUT_PORTS_START( apple2 ) - PORT_INCLUDE(apple2_common) - - PORT_START("keyb_repeat") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - - /* other devices */ - PORT_INCLUDE( apple2_gameport ) - - PORT_INCLUDE(apple2_sysconfig) -INPUT_PORTS_END - -static INPUT_PORTS_START( apple2p ) - PORT_INCLUDE( apple2 ) - - PORT_START("reset_dip") - PORT_DIPNAME( 0x01, 0x01, "Reset" ) - PORT_DIPSETTING( 0x01, "CTRL-RESET" ) - PORT_DIPSETTING( 0x00, "RESET" ) -INPUT_PORTS_END - -static SLOT_INTERFACE_START(apple2_slot0_cards) - SLOT_INTERFACE("lang", A2BUS_RAMCARD16K) /* Apple II RAM Language Card */ - SLOT_INTERFACE("ssram", A2BUS_RAMCARD128K) /* Saturn Systems 128K extended language card */ -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(apple2_cards) - SLOT_INTERFACE("diskii", A2BUS_DISKII) /* Disk II Controller Card */ - SLOT_INTERFACE("diskiing", A2BUS_DISKIING) /* Disk II Controller Card, cycle-accurate version */ - SLOT_INTERFACE("mockingboard", A2BUS_MOCKINGBOARD) /* Sweet Micro Systems Mockingboard */ - SLOT_INTERFACE("phasor", A2BUS_PHASOR) /* Applied Engineering Phasor */ - SLOT_INTERFACE("cffa2", A2BUS_CFFA2) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 65C02/65816 firmware */ - SLOT_INTERFACE("cffa202", A2BUS_CFFA2_6502) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */ - SLOT_INTERFACE("memexp", A2BUS_MEMEXP) /* Apple II Memory Expansion Card */ - SLOT_INTERFACE("ramfactor", A2BUS_RAMFACTOR) /* Applied Engineering RamFactor */ - SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK) /* ThunderWare ThunderClock Plus */ - SLOT_INTERFACE("softcard", A2BUS_SOFTCARD) /* Microsoft SoftCard */ - SLOT_INTERFACE("videoterm", A2BUS_VIDEOTERM) /* Videx VideoTerm */ - SLOT_INTERFACE("ssc", A2BUS_SSC) /* Apple Super Serial Card */ - SLOT_INTERFACE("swyft", A2BUS_SWYFT) /* IAI SwyftCard */ - SLOT_INTERFACE("themill", A2BUS_THEMILL) /* Stellation Two The Mill (6809 card) */ - SLOT_INTERFACE("sam", A2BUS_SAM) /* SAM Software Automated Mouth (8-bit DAC + speaker) */ - SLOT_INTERFACE("alfam2", A2BUS_ALFAM2) /* ALF Apple Music II */ - SLOT_INTERFACE("echoii", A2BUS_ECHOII) /* Street Electronics Echo II */ - SLOT_INTERFACE("ap16", A2BUS_IBSAP16) /* IBS AP16 (German VideoTerm clone) */ - SLOT_INTERFACE("ap16alt", A2BUS_IBSAP16ALT) /* IBS AP16 (German VideoTerm clone), alternate revision */ - SLOT_INTERFACE("vtc1", A2BUS_VTC1) /* Unknown VideoTerm clone #1 */ - SLOT_INTERFACE("vtc2", A2BUS_VTC2) /* Unknown VideoTerm clone #2 */ - SLOT_INTERFACE("arcbd", A2BUS_ARCADEBOARD) /* Third Millenium Engineering Arcade Board */ - SLOT_INTERFACE("midi", A2BUS_MIDI) /* Generic 6840+6850 MIDI board */ - SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE) /* ZIP Technologies IDE card */ - SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS) /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */ - SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */ - SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */ - SLOT_INTERFACE("aesms", A2BUS_AESMS) /* Applied Engineering Super Music Synthesizer */ - SLOT_INTERFACE("ultraterm", A2BUS_ULTRATERM) /* Videx UltraTerm (original) */ - SLOT_INTERFACE("ultratermenh", A2BUS_ULTRATERMENH) /* Videx UltraTerm (enhanced //e) */ - SLOT_INTERFACE("aevm80", A2BUS_VTC2) /* Applied Engineering ViewMaster 80 */ - SLOT_INTERFACE("parallel", A2BUS_PIC) /* Apple Parallel Interface Card */ - SLOT_INTERFACE("corvus", A2BUS_CORVUS) /* Corvus flat-cable HDD interface (see notes in a2corvus.c) */ - SLOT_INTERFACE("mcms1", A2BUS_MCMS1) /* Mountain Computer Music System, card 1 of 2 */ - SLOT_INTERFACE("mcms2", A2BUS_MCMS2) /* Mountain Computer Music System, card 2 of 2. must be in card 1's slot + 1! */ - SLOT_INTERFACE("dx1", A2BUS_DX1) /* Decillonix DX-1 sampler card */ - SLOT_INTERFACE("tm2ho", A2BUS_TIMEMASTERHO) /* Applied Engineering TimeMaster II H.O. */ - SLOT_INTERFACE("mouse", A2BUS_MOUSE) /* Apple II Mouse Card */ - SLOT_INTERFACE("ezcgi", A2BUS_EZCGI) /* E-Z Color Graphics Interface */ - SLOT_INTERFACE("ezcgi9938", A2BUS_EZCGI_9938) /* E-Z Color Graphics Interface (TMS9938) */ - SLOT_INTERFACE("ezcgi9958", A2BUS_EZCGI_9958) /* E-Z Color Graphics Interface (TMS9958) */ -// SLOT_INTERFACE("magicmusician", A2BUS_MAGICMUSICIAN) /* Magic Musician Card */ -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( apple2_common, napple2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(A2_CPU_TAG, M6502, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(apple2_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", napple2_state, apple2_interrupt, "screen", 0, 1) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD(A2_VIDEO_TAG, APPLE2_VIDEO, XTAL_14_31818MHz) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192) - MCFG_SCREEN_UPDATE_DRIVER(napple2_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(napple2_state, apple2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(A2_SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* /INH banking */ - MCFG_DEVICE_ADD(A2_UPPERBANK_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(inhbank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x3000) - - /* keyboard controller */ - MCFG_DEVICE_ADD(A2_KBDC_TAG, AY3600, 0) - MCFG_AY3600_MATRIX_X0(IOPORT("X0")) - MCFG_AY3600_MATRIX_X1(IOPORT("X1")) - MCFG_AY3600_MATRIX_X2(IOPORT("X2")) - MCFG_AY3600_MATRIX_X3(IOPORT("X3")) - MCFG_AY3600_MATRIX_X4(IOPORT("X4")) - MCFG_AY3600_MATRIX_X5(IOPORT("X5")) - MCFG_AY3600_MATRIX_X6(IOPORT("X6")) - MCFG_AY3600_MATRIX_X7(IOPORT("X7")) - MCFG_AY3600_MATRIX_X8(IOPORT("X8")) - MCFG_AY3600_SHIFT_CB(READLINE(napple2_state, ay3600_shift_r)) - MCFG_AY3600_CONTROL_CB(READLINE(napple2_state, ay3600_control_r)) - MCFG_AY3600_DATA_READY_CB(WRITELINE(napple2_state, ay3600_data_ready_w)) - MCFG_AY3600_AKO_CB(WRITELINE(napple2_state, ay3600_ako_w)) - - /* repeat timer. 15 Hz from page 90 of "The Apple II Circuit Description */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("repttmr", napple2_state, ay3600_repeat, attotime::from_hz(15)) - - /* slot devices */ - MCFG_DEVICE_ADD(A2_BUS_TAG, A2BUS, 0) - MCFG_A2BUS_CPU(A2_CPU_TAG) - MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(napple2_state, a2bus_irq_w)) - MCFG_A2BUS_OUT_NMI_CB(WRITELINE(napple2_state, a2bus_nmi_w)) - MCFG_A2BUS_OUT_INH_CB(WRITELINE(napple2_state, a2bus_inh_w)) - MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl0", apple2_slot0_cards, "lang") - MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl1", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl2", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl3", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl4", apple2_cards, "mockingboard") - MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl5", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl6", apple2_cards, "diskiing") - MCFG_A2BUS_SLOT_ADD(A2_BUS_TAG, "sl7", apple2_cards, NULL) - - MCFG_SOFTWARE_LIST_ADD("flop525_list","apple2") - - MCFG_CASSETTE_ADD(A2_CASSETTE_TAG) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apple2, apple2_common ) - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") - MCFG_RAM_EXTRA_OPTIONS("4K,8K,12K,16K,20K,24K,32K,36K,48K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apple2p, apple2_common ) - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") - MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( space84, apple2p ) -MACHINE_CONFIG_END - -#if 0 -static MACHINE_CONFIG_DERIVED( laba2p, apple2p ) - MCFG_MACHINE_START_OVERRIDE(napple2_state,laba2p) - - MCFG_A2BUS_SLOT_REMOVE("sl0") - MCFG_A2BUS_SLOT_REMOVE("sl3") - MCFG_A2BUS_SLOT_REMOVE("sl6") - -// MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl3", A2BUS_LAB_80COL, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_IWM_FDC, NULL) - -MACHINE_CONFIG_END -#endif - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(apple2) /* the classic, non-autoboot apple2 with integer basic in rom. optional card with autoboot and applesoft basic was possible but isn't yet supported */ - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "a2.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) /* current dump is 341-0036 which is the appleII+ character generator, not the original appleII one, whose rom number is not yet known! */ - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD_OPTIONAL ( "341-0016-00.d0", 0x1000, 0x0800, CRC(4234e88a) SHA1(c9a81d704dc2f0c3416c20f9c4ab71fedda937ed)) /* 341-0016: Programmer's Aid #1 D0 */ - - ROM_LOAD ( "341-0001-00.e0", 0x2000, 0x0800, CRC(c0a4ad3b) SHA1(bf32195efcb34b694c893c2d342321ec3a24b98f)) /* Needs verification. From eBay: Label: S7925E // C48077 // 3410001-00 // (C)APPLE78 E0 */ - ROM_LOAD ( "341-0002-00.e8", 0x2800, 0x0800, CRC(a99c2cf6) SHA1(9767d92d04fc65c626223f25564cca31f5248980)) /* Needs verification. From eBay: Label: S7916E // C48078 // 3410002-00 // (C)APPLE78 E8 */ - ROM_LOAD ( "341-0003-00.f0", 0x3000, 0x0800, CRC(62230d38) SHA1(f268022da555e4c809ca1ae9e5d2f00b388ff61c)) /* Needs verification. From eBay: Label: S7908E // C48709 // 3410003 // CAPPLE78 F0 */ - ROM_LOAD ( "341-0004-00.f8", 0x3800, 0x0800, CRC(020a86d0) SHA1(52a18bd578a4694420009cad7a7a5779a8c00226)) - ROM_END - -ROM_START(apple2p) /* the autoboot apple2+ with applesoft (microsoft-written) basic in rom; optional card with monitor and integer basic was possible but isn't yet supported */ - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "341-0036.chr", 0x0000, 0x0800, CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) - - ROM_REGION(0x4000, "maincpu", ROMREGION_LE) - ROM_LOAD ( "341-0011.d0", 0x1000, 0x0800, CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) - ROM_LOAD ( "341-0012.d8", 0x1800, 0x0800, CRC(1f08087c) SHA1(a75ce5aab6401355bf1ab01b04e4946a424879b5)) - ROM_LOAD ( "341-0013.e0", 0x2000, 0x0800, CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) - ROM_LOAD ( "341-0014.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) - ROM_LOAD ( "341-0015.f0", 0x3000, 0x0800, CRC(9a04eecf) SHA1(e6bf91ed28464f42b807f798fc6422e5948bf581)) - ROM_LOAD ( "341-0020-00.f8", 0x3800, 0x0800, CRC(079589c4) SHA1(a28852ff997b4790e53d8d0352112c4b1a395098)) /* 341-0020-00: Autostart Monitor/Applesoft Basic $f800; Was sometimes mounted on Language card; Label(from Apple Language Card - Front.jpg): S 8115 // C68018 // 341-0020-00 */ -ROM_END - -ROM_START(elppa) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "elppa.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) // Taken from 341-0036.chr used in apple2p - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "elppa.d0", 0x1000, 0x0800, CRC(ce5b0e7e) SHA1(2c1a0aa023ae6deb2bddb8937345ee354028aeef)) - ROM_LOAD ( "elppa.d8", 0x1800, 0x0800, CRC(bd409bad) SHA1(5145d238042938efbb9b71e0a4ef9a980b0e38de)) - ROM_LOAD ( "elppa.e0", 0x2000, 0x0800, CRC(4c997c88) SHA1(70b639d8cbafcd5367d2f9dfd6890e5d1c6890f0)) - ROM_LOAD ( "elppa.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) - ROM_LOAD ( "elppa.f0", 0x3000, 0x0800, CRC(9a04eecf) SHA1(e6bf91ed28464f42b807f798fc6422e5948bf581)) - ROM_LOAD ( "elppa.f8", 0x3800, 0x0800, CRC(62c0c761) SHA1(19f28544fd5021a2d72e6015b3183c462c0e86f8)) -ROM_END - -ROM_START(prav82) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "pravetz82.chr", 0x0000, 0x0800, BAD_DUMP CRC(8c55c984) SHA1(5a5a202000576b88b4ae2e180dd2d1b9b337b594)) // Taken from Agat computer - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "pravetz82.d0", 0x1000, 0x0800, CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) - ROM_LOAD ( "pravetz82.d8", 0x1800, 0x0800, CRC(1f08087c) SHA1(a75ce5aab6401355bf1ab01b04e4946a424879b5)) - ROM_LOAD ( "pravetz82.e0", 0x2000, 0x0800, CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) - ROM_LOAD ( "pravetz82.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) - ROM_LOAD ( "pravetz82.f0", 0x3000, 0x0800, CRC(e26d9d35) SHA1(ce6e42e6c9a6c98e92522af7a6090cd04c56c778)) - ROM_LOAD ( "pravetz82.f8", 0x3800, 0x0800, CRC(57547818) SHA1(db30bedec98305e31a14acb9e2a92be1c4853807)) -ROM_END - -ROM_START(prav8m) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "pravetz8m.chr", 0x0000, 0x0800, BAD_DUMP CRC(8c55c984) SHA1(5a5a202000576b88b4ae2e180dd2d1b9b337b594)) // Taken from Agat computer - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "pravetz8m.d0", 0x1000, 0x0800, CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) - ROM_LOAD ( "pravetz8m.d8", 0x1800, 0x0800, CRC(654b6f7b) SHA1(f7b1457b48fe6974c4de7e976df3a8fca6b7b661)) - ROM_LOAD ( "pravetz8m.e0", 0x2000, 0x0800, CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) - ROM_LOAD ( "pravetz8m.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) - ROM_LOAD ( "pravetz8m.f0", 0x3000, 0x0800, CRC(e26d9d35) SHA1(ce6e42e6c9a6c98e92522af7a6090cd04c56c778)) - ROM_LOAD ( "pravetz8m.f8", 0x3800, 0x0800, CRC(5bab0a46) SHA1(f6c0817ce37d2e2c43f482c339acaede0a73359b)) -ROM_END - -ROM_START(uniap2pt) - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "unitron.chr", 0x0000, 0x1000, CRC(7fdd1af6) SHA1(2f4f90d90f2f3a8c1fbea304e1072780fb22e698)) - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "unitron_pt.d0", 0x1000, 0x1000, CRC(311beae6) SHA1(f6379aba9ac982850edc314c93a393844a3349ef)) - ROM_LOAD ( "unitron.e0" , 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) - ROM_LOAD ( "unitron.f0" , 0x3000, 0x1000, CRC(8e047c4a) SHA1(78c57c0e00dfce7fdec9437fe2b4c25def447e5d)) -ROM_END - -ROM_START(uniap2en) - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "unitron.chr", 0x0000, 0x1000, CRC(7fdd1af6) SHA1(2f4f90d90f2f3a8c1fbea304e1072780fb22e698)) - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "unitron_en.d0", 0x1000, 0x1000, CRC(24d73c7b) SHA1(d17a15868dc875c67061c95ec53a6b2699d3a425)) - ROM_LOAD ( "unitron.e0" , 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) - ROM_LOAD ( "unitron.f0" , 0x3000, 0x1000, CRC(8e047c4a) SHA1(78c57c0e00dfce7fdec9437fe2b4c25def447e5d)) -ROM_END - -ROM_START(uniap2ti) /* "Teclado Inteligente" means "smart keyboard" in brazilian portuguese */ - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "unitron.chr", 0x0000, 0x1000, CRC(7fdd1af6) SHA1(2f4f90d90f2f3a8c1fbea304e1072780fb22e698)) - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "unitron_pt.d0", 0x1000, 0x1000, CRC(311beae6) SHA1(f6379aba9ac982850edc314c93a393844a3349ef)) - ROM_LOAD ( "unitron.e0" , 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) - ROM_LOAD ( "unitron.f0" , 0x3000, 0x1000, CRC(8e047c4a) SHA1(78c57c0e00dfce7fdec9437fe2b4c25def447e5d)) - - ROM_REGION(0x4000,"keyboard",0) - ROM_LOAD ( "unitron_apii+_keyboard.ic3", 0x0800, 0x0800, CRC(edc43205) SHA1(220cc21d86f1ab63a301ae7a9c5ff0f3f6cddb70)) -ROM_END - - -/* - J-Plus ROM numbers confirmed by: - http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/Apple%20II/Apple%20II%20j-plus/Photos/Apple%20II%20j-plus%20-%20Motherboard.jpg -*/ - -ROM_START(apple2jp) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "a2jp.chr", 0x0000, 0x0800, CRC(487104b5) SHA1(0a382be58db5215c4a3de53b19a72fab660d5da2)) - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "341-0011.d0", 0x1000, 0x0800, BAD_DUMP CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) - ROM_LOAD ( "341-0012.d8", 0x1800, 0x0800, BAD_DUMP CRC(1f08087c) SHA1(a75ce5aab6401355bf1ab01b04e4946a424879b5)) - ROM_LOAD ( "341-0013.e0", 0x2000, 0x0800, BAD_DUMP CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) - ROM_LOAD ( "341-0014.e8", 0x2800, 0x0800, BAD_DUMP CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) - ROM_LOAD ( "341-0015.f0", 0x3000, 0x0800, BAD_DUMP CRC(9a04eecf) SHA1(e6bf91ed28464f42b807f798fc6422e5948bf581)) - ROM_LOAD ( "341-0047.f8", 0x3800, 0x0800, CRC(6ea8379b) SHA1(00a75ae3b58e1917ad640249366f654608589cf4)) -ROM_END - -ROM_START(maxxi) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "maxxi.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) // Taken from 341-0036.chr used in apple2p - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "maxxi.d0", 0x1000, 0x1000, CRC(7831f025) SHA1(0eb4161e5223c0dde2d140fcbace80d292ff9dc6)) - ROM_LOAD ( "maxxi.e0", 0x2000, 0x1000, CRC(0d494efd) SHA1(a2fd1223a3ca0cfee24a6afe66ea3c4c144dd98e)) - ROM_LOAD ( "maxxi.f0", 0x3000, 0x1000, CRC(34e4d01b) SHA1(44853b2d59ddd234db76c1a0d529180fb1e008ef)) - - ROM_REGION(0x0800,"keyboard",0) - ROM_LOAD ( "maxxi_teclado.rom", 0x0000, 0x0800, CRC(10c2d5b6) SHA1(226036d2f6f8fa5675303640ee1e5f0bab1135c6)) -ROM_END - -ROM_START(ace100) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "ace100.chr", 0x0000, 0x0800, BAD_DUMP CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) // copy of a2.chr - real Ace chr is undumped - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "ace100.rom", 0x1000, 0x3000, CRC(9d5ec94f) SHA1(8f2b3f2561788bebc7a805f620ec9e7ade973460)) -ROM_END - -ROM_START(space84) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD( "space 84 mobo chargen.bin", 0x0000, 0x2000, CRC(ceb98990) SHA1(8b2758da611bcfdd3d144edabc63ef1df2ca787b) ) - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD ( "341-0011.d0", 0x1000, 0x0800, CRC(6f05f949) SHA1(0287ebcef2c1ce11dc71be15a99d2d7e0e128b1e)) - ROM_LOAD ( "341-0012.d8", 0x1800, 0x0800, CRC(1f08087c) SHA1(a75ce5aab6401355bf1ab01b04e4946a424879b5)) - ROM_LOAD ( "341-0013.e0", 0x2000, 0x0800, CRC(2b8d9a89) SHA1(8d82a1da63224859bd619005fab62c4714b25dd7)) - ROM_LOAD ( "341-0014.e8", 0x2800, 0x0800, CRC(5719871a) SHA1(37501be96d36d041667c15d63e0c1eff2f7dd4e9)) - ROM_LOAD( "space84_f.bin", 0x3000, 0x1000, CRC(4e741069) SHA1(ca1f16da9fb40e966ee4a899964cd6a7e140ab50)) -ROM_END - -ROM_START(am64) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD( "gm-2716.bin", 0x0000, 0x0800, CRC(863e657f) SHA1(cc954204c503bc545ec0d08862483aaad83805d5) ) - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD( "am64-27128.bin", 0x0000, 0x4000, CRC(f25cdc7b) SHA1(235e72b77695938a9df8781f5bea3cbbbe1f4c76) ) - - ROM_REGION(0x2000, "spares", 0) - // parallel card ROM - ROM_LOAD( "ap-2716.bin", 0x0000, 0x0800, CRC(c6990f08) SHA1(e7daf63639234e46738a4d78a49287d11ccaf537) ) - // i8048 keyboard MCU ROM - ROM_LOAD( "tk10.bin", 0x0800, 0x0800, CRC(a06c5b78) SHA1(27c5160b913e0f62120f384026d24b9f1acb6970) ) -ROM_END - -ROM_START( agat7 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) - ROMX_LOAD( "monitor7.rom", 0x3800, 0x0800, CRC(071fda0b) SHA1(6089d46b7addc4e2ae096b2cf81124681bd2b27a), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) - ROMX_LOAD( "agat_pzu.bin", 0x3800, 0x0800, CRC(c605163d) SHA1(b30fd1b264a347a9de69bb9e3105483254994d06), ROM_BIOS(2)) - // Floppy controllers - ROM_LOAD( "shugart7.rom", 0x4500, 0x0100, CRC(c6e4850c) SHA1(71626d3d2d4bbeeac2b77585b45a5566d20b8d34)) - ROM_LOAD( "teac.rom", 0x4500, 0x0100, CRC(94266928) SHA1(5d369bad6cdd6a70b0bb16480eba69640de87a2e)) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD( "agathe7.fnt", 0x0000, 0x0800, CRC(fcffb490) SHA1(0bda26ae7ad75f74da835c0cf6d9928f9508844c)) -ROM_END - -ROM_START( agat9 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) - ROMX_LOAD( "monitor9.rom", 0x3800, 0x0800, CRC(b90bb66a) SHA1(02217f0785913b41fc25eabcff70fa814799c69a), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) - ROMX_LOAD( "monitor91.rom", 0x3800, 0x0800, CRC(89b10fc1) SHA1(7fe1ede32b5525255f82597ca9c3c2034c5996fa), ROM_BIOS(2)) - // Floppy controllers - ROM_LOAD( "shugart9.rom", 0x4500, 0x0100, CRC(964a0ce2) SHA1(bf955189ebffe874c20ef649a3db8177dc16af61)) - ROM_LOAD( "teac.rom", 0x4500, 0x0100, CRC(94266928) SHA1(5d369bad6cdd6a70b0bb16480eba69640de87a2e)) - // Printer card - ROM_LOAD( "cm6337.rom", 0x8000, 0x0100, CRC(73be16ec) SHA1(ead1abbef5b86f1def0b956147d5b267f0d544b5)) - ROM_LOAD( "cm6337p.rom", 0x8100, 0x0800, CRC(9120f11f) SHA1(78107653491e88d5ea12e07367c4c028771a4aca)) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD( "agathe9.fnt", 0x0000, 0x0800, CRC(8c55c984) SHA1(5a5a202000576b88b4ae2e180dd2d1b9b337b594)) -ROM_END - -ROM_START(ivelultr) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD( "ultra.chr", 0x0000, 0x1000,CRC(fed62c85) SHA1(479fb3f38a3f7332cef2e8c4856871afe8dc6017)) - ROM_LOAD( "ultra.chr", 0x1000, 0x1000,CRC(fed62c85) SHA1(479fb3f38a3f7332cef2e8c4856871afe8dc6017)) - - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD( "ultra1.bin", 0x2000, 0x1000, CRC(8ab49c1c) SHA1(b41da28a40c3a22bc10a954a86716a1a2bae04a4)) - ROM_CONTINUE(0x1000, 0x1000) - ROM_LOAD( "ultra2.bin", 0x3000, 0x1000, CRC(1ac1e17e) SHA1(a5b8adec37da91970c303905b5e2c4d1b715ee4e)) - - ROM_REGION(0x800, "kbmcu", 0) // 6802 code for keyboard MCU (very unlike real Apples, will require some reverse-engineering) - ROM_LOAD( "ultra4.bin", 0x0000, 0x0800, CRC(3dce51ac) SHA1(676b6e775d5159049cae5b6143398ec7b2bf437a) ) -ROM_END - -#if 0 -ROM_START(laba2p) /* II Plus clone with on-board Disk II controller and Videx-compatible 80-column card, supposedly from lab equipment */ - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD( "char.u30", 0x0000, 0x1000, CRC(2dbaef88) SHA1(9834842796132a11facd57923326d6954bcb609f) ) - - ROM_REGION(0x4700,"maincpu",0) - ROM_LOAD( "maind0.u35", 0x1000, 0x1000, CRC(24d73c7b) SHA1(d17a15868dc875c67061c95ec53a6b2699d3a425) ) - ROM_LOAD( "maine0.u34", 0x2000, 0x2000, CRC(314462ca) SHA1(5a23616dca14e59b4aca8ff6cfa0d98592a78a79) ) - - ROM_REGION(0x1000, "fw80col", 0) - ROM_LOAD( "80cfw.u3", 0x0000, 0x1000, CRC(92d2b8b0) SHA1(5149483eb3e550ece1584e85fc821bb04d068dec) ) // firmware for on-board Videx - - ROM_REGION(0x1000, "cg80col", 0) - ROM_LOAD( "80ccgv80.u25", 0x0000, 0x1000, CRC(6d5e2707) SHA1(c56f76e8a366fee7374eb09f4866435c692490b2) ) // character generator for on-board Videx - - ROM_REGION(0x800, "diskii", 0) - ROM_LOAD( "diskfw.u7", 0x0000, 0x0800, CRC(9207ef4e) SHA1(5fcffa4c68b16a7ef2f62651d4c7470400e5bd35) ) // firmware for on-board Disk II - - ROM_REGION(0x800, "unknown", 0) - ROM_LOAD( "unk.u5", 0x0000, 0x0800, CRC(240a1774) SHA1(e6aeb0702dc99d76fd8c5a642fdfbe9ab896acd4) ) // unknown ROM -ROM_END -#endif - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1977, apple2, 0, 0, apple2, apple2, driver_device, 0, "Apple Computer", "Apple ][", MACHINE_SUPPORTS_SAVE ) -COMP( 1979, apple2p, apple2, 0, apple2p, apple2p, driver_device, 0, "Apple Computer", "Apple ][+", MACHINE_SUPPORTS_SAVE ) -COMP( 1980, apple2jp, apple2, 0, apple2p, apple2p, driver_device, 0, "Apple Computer", "Apple ][ J-Plus", MACHINE_SUPPORTS_SAVE ) -COMP( 198?, elppa, apple2, 0, apple2p, apple2p, driver_device, 0, "Victor do Brasil", "Elppa II+", MACHINE_SUPPORTS_SAVE ) -COMP( 1982, maxxi, apple2, 0, apple2p, apple2p, driver_device, 0, "Polymax", "Maxxi", MACHINE_SUPPORTS_SAVE ) -COMP( 1982, prav82, apple2, 0, apple2p, apple2p, driver_device, 0, "Pravetz", "Pravetz 82", MACHINE_SUPPORTS_SAVE ) -COMP( 1982, ace100, apple2, 0, apple2, apple2p, driver_device, 0, "Franklin Computer", "Franklin Ace 100", MACHINE_SUPPORTS_SAVE ) -COMP( 1982, uniap2en, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II (in English)", MACHINE_SUPPORTS_SAVE ) -COMP( 1982, uniap2pt, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II (in Brazilian Portuguese)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, uniap2ti, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II+ (Teclado Inteligente)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, agat7, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-7", MACHINE_NOT_WORKING) // disk controller ROM JSRs to $FCA8 which is a delay on apple II, illegal instruction crash here :( -// reverse font direction -\/ -COMP( 1984, ivelultr, apple2, 0, apple2p, apple2p, driver_device, 0, "Ivasim", "Ivel Ultra", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, agat9, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-9", MACHINE_NOT_WORKING) -COMP( 1985, prav8m, apple2, 0, apple2p, apple2p, driver_device, 0, "Pravetz", "Pravetz 8M", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, space84, apple2, 0, space84, apple2p, driver_device, 0, "ComputerTechnik/IBS", "Space 84", MACHINE_NOT_WORKING ) -COMP( 1985, am64, apple2, 0, space84, apple2p, driver_device, 0, "ASEM", "AM 64", MACHINE_SUPPORTS_SAVE ) -//COMP( 19??, laba2p, apple2, 0, laba2p, apple2p, driver_device, 0, "", "Lab equipment Apple II Plus clone", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/apple2e.c b/src/mess/drivers/apple2e.c deleted file mode 100644 index e5eb2193aa8..00000000000 --- a/src/mess/drivers/apple2e.c +++ /dev/null @@ -1,3582 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - apple2e.c - Apple IIe/IIc/IIc Plus and clones - - Next generation driver written in September/October 2014 by R. Belmont. - Thanks to the original Apple II series driver's authors: Mike Balfour, Nathan Woods, and R. Belmont - Special thanks to the Apple II Documentation Project/Antoine Vignau and Peter Ferrie. - - - IIe: base of this driver. 64K RAM, slot 0 language card emulation without the double-read requirement, - lowercase and SHIFT key on button 2, Open and Solid Apple buttons on joy buttons 0 and 1, - auxiliary slot, built-in 80 column support if extra RAM added. - - Physical slot 0 was eliminated thanks to the built-in language card. - - Most of the write-only softswitches gained readback locations, necessary to make interrupt-driven - software possible. - - Base 80-column card: 1K RAM, allows 80 columns and double-lo-res, - no double-hi-res. - - Extended 80-column card: 64K RAM (including a second language card), - allows 80 columns, double-lo-res, and double-hi-res. - - Revision A motherboards (very rare) don't support double-hi-res; it's unclear - if double-lo-res works or not. We emulate the much more common Rev B or later - board. - - IIe enhanced: 65C02 CPU with more instructions, MouseText in the character generator. - - IIe platinum: Like enhanced but with added numeric keypad and extended 80-column card - included in the box. Keypad CLEAR generates ESC by default, one hardware mod - made it generate CTRL-X instead. (new keyboard encoder ROM?) - - NOTE: On real IIe and IIe enhanced h/w, pressing SHIFT and paddle button 2 will - short out the power supply and cause a safety shutdown. (We don't emulate - this "feature", and it was relatively rare in real life as Apple joysticks only - had buttons 0 and 1 normally). - - IIc: IIe enhanced shrunken into a pizzabox with a Disk II compatible - half-height drive included in the case. - - No slots, but included functionality equivalent to the following slots - on the motherboard: - - 2 Super Serial Cards (modem and printer ports) - - extended 80 column card / 128K RAM - - Disk II IWM controller - - Apple II Mouse card (firmware entry points are compatible, - but the hardware implementation omits the 68705 and is quite different!) - - Has a 40/80 column switch and a QWERTY/DVORAK switch. - - IIc (UniDisk 3.5): IIc with ROM doubled to 32K and the ROMSWITCH register - added to page between the original 16K ROM and the new added 16K. The - extra firmware space was dedicated to implementing the Protocol Converter, - later renamed "SmartPort", which communicates with "smart" packet devices - over the IWM bus. - - Partial AppleTalk code also exists in this ROM but it doesn't work and - was not completed. - - IIc (Original Memory Expansion): - Removes AppleTalk and adds support for a memory expansion card with up - to 1 MB; this is identical both in hardware and firmware to the "Slinky" - memory expansion card for the Apple IIe (a2bus/a2memexp.c). - - IIc (Revised Memory Expansion, Rev. 3): - Fixes several nasty bugs in the Original Memory Expansion version. Not - currently dumped. - - IIc (Rev 4): - Fixes memory size detection for memory cards with less than 1MB. Fixes - several screen hole errors introduced in Rev 3, and fixes Terminal Mode - wherein the firmware can be put into a built-in terminal mode for simple - tests with a modem. - - IIc Plus: - Like IIc with memory expansion, but with licensed built-in Zip Chip which - runs the 65C02 at 4 MHz turbo speed with a small cache RAM. - - The machine has an internal "Apple 3.5" drive plus a custom gate array - which emulates the functionality of the UniDisk 3.5's on-board 65C02. - This gets around the fact that 1 MHz isn't sufficient to handle direct - Woz-style control of a double-density 3.5" drive. - - External drive port allows IIgs-style daisy-chaining. - ----------------------------------- - -TK3000 keyboard matrix - -Data bus D0-D7 is X0-X7 -Address bus A0-A11 is Y0-Y11 - -***************************************************************************/ - -#include "emu.h" -#include "machine/bankdev.h" -#include "machine/ram.h" -#include "machine/kb3600.h" -#include "sound/speaker.h" -#include "imagedev/flopdrv.h" -#include "imagedev/cassette.h" -#include "formats/ap2_dsk.h" -#include "cpu/m6502/m6502.h" -#include "cpu/m6502/m65c02.h" -#include "cpu/z80/z80.h" -#include "formats/ap_dsk35.h" -#include "machine/sonydriv.h" -#include "machine/appldriv.h" -#include "bus/rs232/rs232.h" -#include "machine/mos6551.h" -#include "video/apple2.h" - -#include "bus/a2bus/a2bus.h" -#include "bus/a2bus/a2lang.h" -#include "bus/a2bus/a2diskii.h" -#include "bus/a2bus/a2diskiing.h" -#include "bus/a2bus/a2mockingboard.h" -#include "bus/a2bus/a2cffa.h" -#include "bus/a2bus/a2memexp.h" -#include "bus/a2bus/a2scsi.h" -#include "bus/a2bus/a2thunderclock.h" -#include "bus/a2bus/a2softcard.h" -#include "bus/a2bus/a2videoterm.h" -#include "bus/a2bus/a2ssc.h" -#include "bus/a2bus/a2swyft.h" -#include "bus/a2bus/a2themill.h" -#include "bus/a2bus/a2sam.h" -#include "bus/a2bus/a2alfam2.h" -#include "bus/a2bus/laser128.h" -#include "bus/a2bus/a2echoii.h" -#include "bus/a2bus/a2arcadebd.h" -#include "bus/a2bus/a2midi.h" -#include "bus/a2bus/a2zipdrive.h" -#include "bus/a2bus/a2applicard.h" -#include "bus/a2bus/a2ultraterm.h" -#include "bus/a2bus/a2pic.h" -#include "bus/a2bus/a2corvus.h" -#include "bus/a2bus/a2mcms.h" -#include "bus/a2bus/a2dx1.h" -#include "bus/a2bus/timemasterho.h" -#include "bus/a2bus/mouse.h" -#include "bus/a2bus/ezcgi.h" -#include "bus/a2bus/a2eauxslot.h" -#include "bus/a2bus/a2estd80col.h" -#include "bus/a2bus/a2eext80col.h" -#include "bus/a2bus/a2eramworks3.h" - -#define A2_CPU_TAG "maincpu" -#define A2_KBDC_TAG "ay3600" -#define A2_BUS_TAG "a2bus" -#define A2_SPEAKER_TAG "speaker" -#define A2_CASSETTE_TAG "tape" -#define A2_UPPERBANK_TAG "inhbank" -#define IIC_ACIA1_TAG "acia1" -#define IIC_ACIA2_TAG "acia2" -#define IICP_IWM_TAG "iwm" -#define LASER128_UDC_TAG "l128udc" -#define PRINTER_PORT_TAG "printer" -#define MODEM_PORT_TAG "modem" -#define A2_AUXSLOT_TAG "auxbus" -#define A2_VIDEO_TAG "a2video" - -#define A2_0000_TAG "r00bank" -#define A2_0200_TAG "r02bank" -#define A2_0400_TAG "r04bank" -#define A2_0800_TAG "r08bank" -#define A2_2000_TAG "r20bank" -#define A2_4000_TAG "r40bank" -#define A2_C100_TAG "c1bank" -#define A2_C300_TAG "c3bank" -#define A2_C400_TAG "c4bank" -#define A2_C800_TAG "c8bank" -#define A2_LCBANK_TAG "lcbank" - -#define MOUSE_BUTTON_TAG "mse_button" -#define MOUSE_XAXIS_TAG "mse_x" -#define MOUSE_YAXIS_TAG "mse_y" - -#define CNXX_UNCLAIMED -1 -#define CNXX_INTROM -2 - -#define IRQ_SLOT 0 -#define IRQ_VBL 1 -#define IRQ_MOUSEXY 2 - -class apple2e_state : public driver_device -{ -public: - apple2e_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, A2_CPU_TAG), - m_ram(*this, RAM_TAG), - m_rom(*this, "maincpu"), - m_ay3600(*this, A2_KBDC_TAG), - m_video(*this, A2_VIDEO_TAG), - m_a2bus(*this, A2_BUS_TAG), - m_a2eauxslot(*this, A2_AUXSLOT_TAG), - m_joy1x(*this, "joystick_1_x"), - m_joy1y(*this, "joystick_1_y"), - m_joy2x(*this, "joystick_2_x"), - m_joy2y(*this, "joystick_2_y"), - m_joybuttons(*this, "joystick_buttons"), - m_mouseb(*this, MOUSE_BUTTON_TAG), - m_mousex(*this, MOUSE_XAXIS_TAG), - m_mousey(*this, MOUSE_YAXIS_TAG), - m_kbdrom(*this, "keyboard"), - m_kbspecial(*this, "keyb_special"), - m_sysconfig(*this, "a2_config"), - m_speaker(*this, A2_SPEAKER_TAG), - m_cassette(*this, A2_CASSETTE_TAG), - m_upperbank(*this, A2_UPPERBANK_TAG), - m_0000bank(*this, A2_0000_TAG), - m_0200bank(*this, A2_0200_TAG), - m_0400bank(*this, A2_0400_TAG), - m_0800bank(*this, A2_0800_TAG), - m_2000bank(*this, A2_2000_TAG), - m_4000bank(*this, A2_4000_TAG), - m_c100bank(*this, A2_C100_TAG), - m_c300bank(*this, A2_C300_TAG), - m_c400bank(*this, A2_C400_TAG), - m_c800bank(*this, A2_C800_TAG), - m_lcbank(*this, A2_LCBANK_TAG), - m_acia1(*this, IIC_ACIA1_TAG), - m_acia2(*this, IIC_ACIA2_TAG), - m_laserudc(*this, LASER128_UDC_TAG), - m_iicpiwm(*this, IICP_IWM_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - required_memory_region m_rom; - required_device m_ay3600; - required_device m_video; - required_device m_a2bus; - optional_device m_a2eauxslot; - required_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons; - optional_ioport m_mouseb, m_mousex, m_mousey; - optional_memory_region m_kbdrom; - required_ioport m_kbspecial; - required_ioport m_sysconfig; - required_device m_speaker; - optional_device m_cassette; - required_device m_upperbank; - required_device m_0000bank; - required_device m_0200bank; - required_device m_0400bank; - required_device m_0800bank; - required_device m_2000bank; - required_device m_4000bank; - required_device m_c100bank; - required_device m_c300bank; - required_device m_c400bank; - required_device m_c800bank; - required_device m_lcbank; - optional_device m_acia1, m_acia2; - optional_device m_laserudc; - optional_device m_iicpiwm; - - TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(ay3600_repeat); - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_PALETTE_INIT(apple2); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER(ram0000_r); - DECLARE_WRITE8_MEMBER(ram0000_w); - DECLARE_READ8_MEMBER(ram0200_r); - DECLARE_WRITE8_MEMBER(ram0200_w); - DECLARE_READ8_MEMBER(ram0400_r); - DECLARE_WRITE8_MEMBER(ram0400_w); - DECLARE_READ8_MEMBER(ram0800_r); - DECLARE_WRITE8_MEMBER(ram0800_w); - DECLARE_READ8_MEMBER(ram2000_r); - DECLARE_WRITE8_MEMBER(ram2000_w); - DECLARE_READ8_MEMBER(ram4000_r); - DECLARE_WRITE8_MEMBER(ram4000_w); - DECLARE_READ8_MEMBER(auxram0000_r); - DECLARE_WRITE8_MEMBER(auxram0000_w); - DECLARE_READ8_MEMBER(auxram0200_r); - DECLARE_WRITE8_MEMBER(auxram0200_w); - DECLARE_READ8_MEMBER(auxram0400_r); - DECLARE_WRITE8_MEMBER(auxram0400_w); - DECLARE_READ8_MEMBER(auxram0800_r); - DECLARE_WRITE8_MEMBER(auxram0800_w); - DECLARE_READ8_MEMBER(auxram2000_r); - DECLARE_WRITE8_MEMBER(auxram2000_w); - DECLARE_READ8_MEMBER(auxram4000_r); - DECLARE_WRITE8_MEMBER(auxram4000_w); - DECLARE_READ8_MEMBER(c000_r); - DECLARE_WRITE8_MEMBER(c000_w); - DECLARE_READ8_MEMBER(c000_iic_r); - DECLARE_WRITE8_MEMBER(c000_iic_w); - DECLARE_READ8_MEMBER(c080_r); - DECLARE_WRITE8_MEMBER(c080_w); - DECLARE_READ8_MEMBER(c100_r); - DECLARE_READ8_MEMBER(c100_int_r); - DECLARE_READ8_MEMBER(c100_int_bank_r); - DECLARE_WRITE8_MEMBER(c100_w); - DECLARE_READ8_MEMBER(c300_r); - DECLARE_READ8_MEMBER(c300_int_r); - DECLARE_READ8_MEMBER(c300_int_bank_r); - DECLARE_WRITE8_MEMBER(c300_w); - DECLARE_READ8_MEMBER(c400_r); - DECLARE_READ8_MEMBER(c400_int_r); - DECLARE_READ8_MEMBER(c400_int_bank_r); - DECLARE_WRITE8_MEMBER(c400_w); - DECLARE_READ8_MEMBER(c800_r); - DECLARE_WRITE8_MEMBER(c800_w); - DECLARE_READ8_MEMBER(inh_r); - DECLARE_WRITE8_MEMBER(inh_w); - DECLARE_READ8_MEMBER(lc_r); - DECLARE_WRITE8_MEMBER(lc_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); - DECLARE_READ_LINE_MEMBER(ay3600_shift_r); - DECLARE_READ_LINE_MEMBER(ay3600_control_r); - DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); - DECLARE_WRITE_LINE_MEMBER(ay3600_ako_w); - DECLARE_READ8_MEMBER(memexp_r); - DECLARE_WRITE8_MEMBER(memexp_w); - -private: - int m_speaker_state; - int m_cassette_state, m_cassette_out; - - double m_joystick_x1_time; - double m_joystick_y1_time; - double m_joystick_x2_time; - double m_joystick_y2_time; - - UINT16 m_lastchar, m_strobe; - UINT8 m_transchar; - bool m_anykeydown; - int m_repeatdelay; - - int m_inh_slot; - int m_cnxx_slot; - - bool m_page2; - bool m_an0, m_an1, m_an2, m_an3; - - bool m_vbl, m_vblmask; - - bool m_xy, m_x0edge, m_y0edge; - bool m_x0, m_x1, m_y0, m_y1; - bool m_xirq, m_yirq; - int last_mx, last_my, count_x, count_y; - - bool m_intcxrom; - bool m_80store; - bool m_slotc3rom; - bool m_altzp; - bool m_ramrd, m_ramwrt; - bool m_lcram, m_lcram2, m_lcwriteenable; - bool m_ioudis; - bool m_romswitch; - - bool m_isiic, m_isiicplus; - UINT8 m_iicplus_ce00[0x200]; - - UINT8 *m_ram_ptr, *m_rom_ptr; - int m_ram_size; - - UINT8 *m_aux_ptr, *m_aux_bank_ptr; - - int m_inh_bank; - - double m_x_calibration, m_y_calibration; - - device_a2bus_card_interface *m_slotdevice[8]; - device_a2eauxslot_card_interface *m_auxslotdevice; - - int m_irqmask; - - UINT8 m_exp_bankhior; - int m_exp_addrmask; - UINT8 m_exp_regs[0x10]; - UINT8 *m_exp_ram; - int m_exp_wptr, m_exp_liveptr; - - void do_io(address_space &space, int offset, bool is_iic); - UINT8 read_floatingbus(); - void update_slotrom_banks(); - void lc_update(int offset); - UINT8 read_slot_rom(address_space &space, int slotbias, int offset); - void write_slot_rom(address_space &space, int slotbias, int offset, UINT8 data); - UINT8 read_int_rom(address_space &space, int slotbias, int offset); - void auxbank_update(); - void raise_irq(int irq); - void lower_irq(int irq); - void update_iic_mouse(); -}; - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -#define JOYSTICK_DELTA 80 -#define JOYSTICK_SENSITIVITY 50 -#define JOYSTICK_AUTOCENTER 80 - -WRITE_LINE_MEMBER(apple2e_state::a2bus_irq_w) -{ - if (state == ASSERT_LINE) - { - raise_irq(IRQ_SLOT); - } - else - { - lower_irq(IRQ_SLOT); - } -} - -WRITE_LINE_MEMBER(apple2e_state::a2bus_nmi_w) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, state); -} - -// TODO: this assumes /INH only on ROM, needs expansion to support e.g. phantom-slotting cards and etc. -WRITE_LINE_MEMBER(apple2e_state::a2bus_inh_w) -{ - if (state == ASSERT_LINE) - { - // assume no cards are pulling /INH - m_inh_slot = -1; - - // scan the slots to figure out which card(s) are INHibiting stuff - for (int i = 0; i <= 7; i++) - { - if (m_slotdevice[i]) - { - // this driver only can inhibit from 0xd000-0xffff - if ((m_slotdevice[i]->inh_start() == 0xd000) && - (m_slotdevice[i]->inh_end() == 0xffff)) - { - if ((m_slotdevice[i]->inh_type() & INH_READ) == INH_READ) - { - if (m_inh_bank != 1) - { - m_upperbank->set_bank(1); - m_inh_bank = 1; - } - } - else - { - if (m_inh_bank != 0) - { - m_upperbank->set_bank(0); - m_inh_bank = 0; - } - } - - m_inh_slot = i; - break; - } - } - } - - // if no slots are inhibiting, make sure ROM is fully switched in - if ((m_inh_slot == -1) && (m_inh_bank != 0)) - { - m_upperbank->set_bank(0); - m_inh_bank = 0; - } - } -} - -READ8_MEMBER(apple2e_state::memexp_r) -{ - UINT8 retval = m_exp_regs[offset]; - - if (!m_exp_ram) - { - return 0xff; - } - - if (offset == 3) - { - if (m_exp_liveptr <= m_exp_addrmask) - { - retval = m_exp_ram[m_exp_liveptr]; - } - else - { - retval = 0xff; - } - m_exp_liveptr++; - m_exp_regs[0] = m_exp_liveptr & 0xff; - m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; - } - - return retval; -} - -WRITE8_MEMBER(apple2e_state::memexp_w) -{ - if (!m_exp_ram) - { - return; - } - - switch (offset & 0xf) - { - case 0: - m_exp_wptr &= ~0xff; - m_exp_wptr |= data; - m_exp_regs[0] = m_exp_wptr & 0xff; - m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; - m_exp_liveptr = m_exp_wptr; - break; - - case 1: - m_exp_wptr &= ~0xff00; - m_exp_wptr |= (data<<8); - m_exp_regs[0] = m_exp_wptr & 0xff; - m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; - m_exp_liveptr = m_exp_wptr; - break; - - case 2: - m_exp_wptr &= ~0xff0000; - m_exp_wptr |= (data<<16); - m_exp_regs[0] = m_exp_wptr & 0xff; - m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; - m_exp_liveptr = m_exp_wptr; - break; - - case 3: -// printf("Write %02x to RAM[%x]\n", data, m_liveptr); - if (m_exp_liveptr <= m_exp_addrmask) - { - m_exp_ram[m_exp_liveptr] = data; - } - m_exp_liveptr++; - m_exp_regs[0] = m_exp_liveptr & 0xff; - m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; - break; - - default: - m_exp_regs[offset] = data; - break; - } -} - -/*************************************************************************** - START/RESET -***************************************************************************/ - -void apple2e_state::machine_start() -{ - m_ram_ptr = m_ram->pointer(); - m_rom_ptr = m_rom->base(); - m_ram_size = m_ram->size(); - m_speaker_state = 0; - m_speaker->level_w(m_speaker_state); - m_cassette_state = 0; - m_cassette_out = 0; - if (m_cassette) - { - m_cassette->output(-1.0f); - } - m_upperbank->set_bank(0); - m_lcbank->set_bank(0); - m_0000bank->set_bank(0); - m_0200bank->set_bank(0); - m_0400bank->set_bank(0); - m_0800bank->set_bank(0); - m_2000bank->set_bank(0); - m_4000bank->set_bank(0); - m_inh_bank = 0; - - // expansion RAM size - if (m_ram_size > (128*1024)) - { - m_exp_addrmask = m_ram_size - (128*1024) - 1; - m_exp_ram = m_ram_ptr + (128*1024); - } - else // no expansion - { - m_exp_addrmask = 0; - m_exp_ram = NULL; - } - - // precalculate joystick time constants - m_x_calibration = attotime::from_usec(12).as_double(); - m_y_calibration = attotime::from_usec(13).as_double(); - - // cache slot devices - for (int i = 0; i <= 7; i++) - { - m_slotdevice[i] = m_a2bus->get_a2bus_card(i); - } - - // and aux slot device if any - m_aux_ptr = NULL; - m_aux_bank_ptr = NULL; - if (m_a2eauxslot) - { - m_auxslotdevice = m_a2eauxslot->get_a2eauxslot_card(); - if (m_auxslotdevice) - { - m_aux_ptr = m_auxslotdevice->get_vram_ptr(); - m_aux_bank_ptr = m_auxslotdevice->get_auxbank_ptr(); - } - } - else // IIc has 128K right on the motherboard - { - m_auxslotdevice = NULL; - - if (m_ram_size >= (128*1024)) - { - m_aux_ptr = &m_ram_ptr[0x10000]; - m_aux_bank_ptr = m_aux_ptr; - } - } - - // setup video pointers - m_video->m_ram_ptr = m_ram_ptr; - m_video->m_aux_ptr = m_aux_ptr; - m_video->m_char_ptr = memregion("gfx1")->base(); - m_video->m_char_size = memregion("gfx1")->bytes(); - - m_inh_slot = -1; - m_cnxx_slot = CNXX_UNCLAIMED; - - // setup save states - save_item(NAME(m_speaker_state)); - save_item(NAME(m_cassette_state)); - save_item(NAME(m_joystick_x1_time)); - save_item(NAME(m_joystick_y1_time)); - save_item(NAME(m_joystick_x2_time)); - save_item(NAME(m_joystick_y2_time)); - save_item(NAME(m_lastchar)); - save_item(NAME(m_strobe)); - save_item(NAME(m_transchar)); - save_item(NAME(m_inh_slot)); - save_item(NAME(m_inh_bank)); - save_item(NAME(m_cnxx_slot)); - save_item(NAME(m_page2)); - save_item(NAME(m_an0)); - save_item(NAME(m_an1)); - save_item(NAME(m_an2)); - save_item(NAME(m_an3)); - save_item(NAME(m_intcxrom)); - save_item(NAME(m_80store)); - save_item(NAME(m_slotc3rom)); - save_item(NAME(m_altzp)); - save_item(NAME(m_ramrd)); - save_item(NAME(m_ramwrt)); - save_item(NAME(m_ioudis)); - save_item(NAME(m_vbl)); - save_item(NAME(m_vblmask)); - save_item(NAME(m_romswitch)); - save_item(NAME(m_irqmask)); - save_item(NAME(m_anykeydown)); - save_item(NAME(m_repeatdelay)); - save_item(NAME(m_xy)); - save_item(NAME(m_x0edge)); - save_item(NAME(m_y0edge)); - save_item(NAME(last_mx)); - save_item(NAME(last_my)); - save_item(NAME(count_x)); - save_item(NAME(count_y)); - save_item(NAME(m_x0)); - save_item(NAME(m_x1)); - save_item(NAME(m_y0)); - save_item(NAME(m_y1)); - save_item(NAME(m_xirq)); - save_item(NAME(m_yirq)); - save_item(NAME(m_iicplus_ce00)); - save_item(NAME(m_exp_regs)); - save_item(NAME(m_exp_wptr)); - save_item(NAME(m_exp_liveptr)); - save_item(NAME(m_exp_bankhior)); - save_item(NAME(m_exp_addrmask)); - save_item(NAME(m_lcram)); - save_item(NAME(m_lcram2)); - save_item(NAME(m_lcwriteenable)); -} - -void apple2e_state::machine_reset() -{ - m_page2 = false; - m_video->m_page2 = false; - m_an0 = m_an1 = m_an2 = m_an3 = false; - m_vbl = m_vblmask = false; - m_slotc3rom = false; - m_romswitch = false; - m_irqmask = 0; - m_anykeydown = false; - m_repeatdelay = 10; - m_xy = false; - m_x0edge = false; - m_y0edge = false; - m_xirq = false; - m_yirq = false; - - // IIe prefers INTCXROM default to off, IIc has it always on - if (m_rom_ptr[0x3bc0] == 0x00) - { - m_intcxrom = true; - m_slotc3rom = false; - m_isiic = true; - - if (m_rom_ptr[0x3bbf] == 0x05) - { - m_isiicplus = true; - } - else - { - m_isiicplus = false; - } - } - else - { - m_intcxrom = false; - m_isiic = false; - m_isiicplus = false; - } - - m_80store = false; - m_altzp = false; - m_ramrd = false; - m_ramwrt = false; - m_ioudis = true; - - // LC default state: read ROM, write enabled, Dxxx bank 2 - m_lcram = false; - m_lcram2 = true; - m_lcwriteenable = true; - - m_exp_bankhior = 0xf0; - - // sync up the banking with the variables. - // RESEARCH: how does RESET affect LC state and aux banking states? - auxbank_update(); - update_slotrom_banks(); -} - -void apple2e_state::raise_irq(int irq) -{ - m_irqmask |= (1 << irq); - - if (m_irqmask) - { - m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - } -} - - -void apple2e_state::lower_irq(int irq) -{ - m_irqmask &= ~(1 << irq); - - if (!m_irqmask) - { - m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); - } -} - -/*************************************************************************** - VIDEO -***************************************************************************/ - -TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::apple2_interrupt) -{ - int scanline = param; - - if((scanline % 8) == 0) - { - machine().first_screen()->update_partial(machine().first_screen()->vpos()); - } - - if (m_isiic) - { - update_iic_mouse(); - } - - if (scanline == 192) - { - m_vbl = true; - - // update the video system's shadow copy of the system config - m_video->m_sysconfig = m_sysconfig->read(); - - if (m_vblmask) - { - raise_irq(IRQ_VBL); - } - - // check for ctrl-reset - if ((m_kbspecial->read() & 0x88) == 0x88) - { - m_maincpu->reset(); - } - } -} - -PALETTE_INIT_MEMBER(apple2e_state, apple2) -{ - m_video->palette_init_apple2(palette); -} - -UINT32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bool old_page2 = m_video->m_page2; - - // don't display page2 if 80store is set (we just saved the previous value, don't worry) - if (m_80store) - { - m_video->m_page2 = false; - } - - // always update the flash timer here so it's smooth regardless of mode switches - m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; - - if (m_video->m_graphics) - { - if (m_video->m_hires) - { - if (m_video->m_mix) - { - if ((m_video->m_dhires) && (m_video->m_80col)) - { - m_video->dhgr_update(screen, bitmap, cliprect, 0, 159); - } - else - { - m_video->hgr_update(screen, bitmap, cliprect, 0, 159); - } - m_video->text_update(screen, bitmap, cliprect, 160, 191); - } - else - { - if ((m_video->m_dhires) && (m_video->m_80col)) - { - m_video->dhgr_update(screen, bitmap, cliprect, 0, 191); - } - else - { - m_video->hgr_update(screen, bitmap, cliprect, 0, 191); - } - } - } - else // lo-res - { - if (m_video->m_mix) - { - if ((m_video->m_dhires) && (m_video->m_80col)) - { - m_video->dlores_update(screen, bitmap, cliprect, 0, 159); - } - else - { - m_video->lores_update(screen, bitmap, cliprect, 0, 159); - } - - m_video->text_update(screen, bitmap, cliprect, 160, 191); - } - else - { - if ((m_video->m_dhires) && (m_video->m_80col)) - { - m_video->dlores_update(screen, bitmap, cliprect, 0, 191); - } - else - { - m_video->lores_update(screen, bitmap, cliprect, 0, 191); - } - } - } - } - else - { - m_video->text_update(screen, bitmap, cliprect, 0, 191); - } - - m_video->m_page2 = old_page2; - - return 0; -} - -/*************************************************************************** - I/O -***************************************************************************/ -void apple2e_state::auxbank_update() -{ - int ramwr = (m_ramrd ? 1 : 0) | (m_ramwrt ? 2 : 0); - - m_0000bank->set_bank(m_altzp ? 1 : 0); - m_0200bank->set_bank(ramwr); - - if (m_80store) - { - if (m_page2) - { - m_0400bank->set_bank(3); - } - else - { - m_0400bank->set_bank(0); - } - } - else - { - m_0400bank->set_bank(ramwr); - } - - m_0800bank->set_bank(ramwr); - - if ((m_80store) && (m_video->m_hires)) - { - if (m_page2) - { - m_2000bank->set_bank(3); - } - else - { - m_2000bank->set_bank(0); - } - } - else - { - m_2000bank->set_bank(ramwr); - } - - m_4000bank->set_bank(ramwr); -} - -void apple2e_state::update_slotrom_banks() -{ - int cxswitch = 0; - - // IIc and IIc+ have working (readable) INTCXROM/SLOTC3ROM switches, but - // internal ROM is always present in the slots. - if ((m_intcxrom) || (m_isiic)) - { - if (m_romswitch) - { - cxswitch = 2; - } - else - { - cxswitch = 1; - } - } - - m_c100bank->set_bank(cxswitch); - m_c400bank->set_bank(cxswitch); - -// printf("intcxrom %d cnxx_slot %d isiic %d romswitch %d\n", m_intcxrom, m_cnxx_slot, m_isiic, m_romswitch); - if ((m_intcxrom) || (m_cnxx_slot < 0) || (m_isiic)) - { - if (m_romswitch) - { - m_c800bank->set_bank(2); - } - else - { - m_c800bank->set_bank(1); - } - } - else - { - m_c800bank->set_bank(0); - } - - if ((!m_slotc3rom) || (m_isiic)) - { - if (m_romswitch) - { - m_c300bank->set_bank(2); - } - else - { - m_c300bank->set_bank(1); - } - } - else - { - m_c300bank->set_bank(0); - } -} - -void apple2e_state::lc_update(int offset) -{ - bool m_last_lcram = m_lcram; - - m_lcram = false; - m_lcram2 = false; - m_lcwriteenable = false; - - if (offset & 1) - { - m_lcwriteenable = true; - } - - switch(offset & 0x03) - { - case 0x00: - case 0x03: - m_lcram = true; - break; - } - - if (!(offset & 8)) - { - m_lcram2 = true; - } - - if (m_lcram != m_last_lcram) - { - if (m_lcram) - { - m_lcbank->set_bank(1); - } - else - { - if (m_romswitch) - { - m_lcbank->set_bank(2); - } - else - { - m_lcbank->set_bank(0); - } - } - } - - #if 0 - printf("LC: new state %c%c dxxx=%04x altzp=%d\n", - m_lcram ? 'R' : 'x', - m_lcwriteenable ? 'W' : 'x', - m_lcram2 ? 0x1000 : 0x0000, - m_altzp); - #endif -} - -// most softswitches don't care about read vs write, so handle them here -void apple2e_state::do_io(address_space &space, int offset, bool is_iic) -{ - if(space.debugger_access()) return; - - // Handle C058-C05F according to IOUDIS - if ((offset & 0x58) == 0x58) - { - // IIc-specific switches - if (m_isiic) - { - switch (offset) - { - case 0x58: // DisXY - m_xy = false; break; - - case 0x59: // EnbXY - m_xy = true; break; - - case 0x5a: // DisVBL - m_vblmask = false; break; - - case 0x5b: // EnVBL - m_vblmask = true; break; - - case 0x5c: // RisX0Edge - m_x0edge = false; break; - - case 0x5d: // FalX0Edge - m_x0edge = true; break; - - case 0x5e: // RisY0Edge - if (!m_ioudis) - { - m_y0edge = false; - } - break; - - case 0x5f: // FalY0Edge - if (!m_ioudis) - { - m_y0edge = true; - } - break; - } - } - - if (m_ioudis) - { - switch (offset) - { - case 0x5e: // SETDHIRES - m_video->m_dhires = true; - break; - - case 0x5f: // CLRDHIRES - m_video->m_dhires = false; - break; - } - } - - return; - } - - switch (offset) - { - case 0x20: - if (m_cassette) - { - m_cassette_state ^= 1; - m_cassette->output(m_cassette_state ? 1.0f : -1.0f); - } - break; - - case 0x28: - if (is_iic) - { - m_romswitch = !m_romswitch; - update_slotrom_banks(); - - // if LC is not enabled - if (!m_lcram) - { - if (m_romswitch) - { - m_lcbank->set_bank(2); - } - else - { - m_lcbank->set_bank(0); - } - } - } - break; - - case 0x30: - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - break; - - case 0x48: // (IIc only) clear mouse X/Y interrupt flags - m_xirq = m_yirq = false; - lower_irq(IRQ_MOUSEXY); - break; - - case 0x50: // graphics mode - m_video->m_graphics = true; break; - - case 0x51: // text mode - m_video->m_graphics = false; break; - - case 0x52: // no mix - m_video->m_mix = false; break; - - case 0x53: // mixed mode - m_video->m_mix = true; break; - - case 0x54: // set page 1 - m_page2 = false; - m_video->m_page2 = false; - auxbank_update(); - break; - - case 0x55: // set page 2 - m_page2 = true; - m_video->m_page2 = true; - auxbank_update(); - break; - - case 0x56: // select lo-res - m_video->m_hires = false; - auxbank_update(); - break; - - case 0x57: // select hi-res - m_video->m_hires = true; - auxbank_update(); - break; - - case 0x58: // AN0 off - m_an0 = false; break; - - case 0x59: // AN0 on - m_an0 = true; break; - - case 0x5a: // AN1 off - m_an1 = false; break; - - case 0x5b: // AN1 on - m_an1 = true; break; - - case 0x5c: // AN2 off - m_an2 = false; break; - - case 0x5d: // AN2 on - m_an2 = true; break; - - case 0x5e: // AN3 off - m_an3 = false; break; - - case 0x5f: // AN3 on - m_an3 = true; break; - - case 0x68: // IIgs STATE register, which ProDOS touches - break; - - // trigger joypad read - case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: - case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: - if (is_iic) - { - m_vbl = false; - lower_irq(IRQ_VBL); - } - - m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_joy1x->read(); - m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_joy1y->read(); - m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_joy2x->read(); - m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read(); - break; - - default: - logerror("do_io: unknown switch $C0%02X\n", offset); - break; - } -} - -READ8_MEMBER(apple2e_state::c000_r) -{ - if(space.debugger_access()) return read_floatingbus(); - - switch (offset) - { - case 0x00: // keyboard latch - return m_transchar | m_strobe; - - case 0x02: // RAMRDOFF - m_ramrd = false; - auxbank_update(); - break; - - case 0x03: // RAMRDON - m_ramrd = true; - auxbank_update(); - break; - - case 0x04: // RAMWRTOFF - m_ramwrt = false; - auxbank_update(); - break; - - case 0x05: // RAMWRTON - m_ramwrt = true; - auxbank_update(); - break; - - case 0x10: // read any key down, reset keyboard strobe - { - UINT8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); - m_strobe = 0; - return rv; - } - - case 0x11: // read LCRAM2 (LC Dxxx bank) - return m_lcram2 ? 0x80 : 0x00; - - case 0x12: // read LCRAM (is LC readable?) - return m_lcram ? 0x80 : 0x00; - - case 0x13: // read RAMRD - return m_ramrd ? 0x80 : 0x00; - - case 0x14: // read RAMWRT - return m_ramwrt ? 0x80 : 0x00; - - case 0x15: // read INTCXROM - return m_intcxrom ? 0x80 : 0x00; - - case 0x16: // read ALTZP - return m_altzp ? 0x80 : 0x00; - - case 0x17: // read SLOTC3ROM - return m_slotc3rom ? 0x80 : 0x00; - - case 0x18: // read 80STORE - return m_80store ? 0x80 : 0x00; - - case 0x19: // read VBLBAR - return space.machine().first_screen()->vblank() ? 0x00 : 0x80; - - case 0x1a: // read TEXT - return m_video->m_graphics ? 0x00 : 0x80; - - case 0x1b: // read MIXED - return m_video->m_mix ? 0x80 : 0x00; - - case 0x1c: // read PAGE2 - return m_page2 ? 0x80 : 0x00; - - case 0x1d: // read HIRES - return m_video->m_hires ? 0x80 : 0x00; - - case 0x1e: // read ALTCHARSET - return m_video->m_altcharset ? 0x80 : 0x00; - - case 0x1f: // read 80COL - return m_video->m_80col ? 0x80 : 0x00; - - case 0x60: // cassette in - case 0x68: - if (m_cassette) - { - return m_cassette->input() > 0.0 ? 0x80 : 0; - } - return 0; - - case 0x61: // button 0 or Open Apple - case 0x69: - return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0; - - case 0x62: // button 1 or Solid Apple - case 0x6a: - return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0; - - case 0x63: // button 2 or SHIFT key - case 0x6b: - return ((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0; - - case 0x64: // joy 1 X axis - case 0x6c: - return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; - - case 0x65: // joy 1 Y axis - case 0x6d: - return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; - - case 0x66: // joy 2 X axis - case 0x6e: - return (space.machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0; - - case 0x67: // joy 2 Y axis - case 0x6f: - return (space.machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0; - - case 0x7e: // read IOUDIS - return m_ioudis ? 0x80 : 0x00; - - case 0x7f: // read DHIRES - return m_video->m_dhires ? 0x00 : 0x80; - - default: - do_io(space, offset, false); - break; - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(apple2e_state::c000_w) -{ - if(space.debugger_access()) return; - - switch (offset) - { - case 0x00: // 80STOREOFF - m_80store = false; - auxbank_update(); - break; - - case 0x01: // 80STOREON - m_80store = true; - auxbank_update(); - break; - - case 0x02: // RAMRDOFF - m_ramrd = false; - auxbank_update(); - break; - - case 0x03: // RAMRDON - m_ramrd = true; - auxbank_update(); - break; - - case 0x04: // RAMWRTOFF - m_ramwrt = false; - auxbank_update(); - break; - - case 0x05: // RAMWRTON - m_ramwrt = true; - auxbank_update(); - break; - - case 0x06: // INTCXROMOFF - m_intcxrom = false; - update_slotrom_banks(); - break; - - case 0x07: // INTCXROMON - m_intcxrom = true; - update_slotrom_banks(); - break; - - case 0x08: // ALTZPOFF - m_altzp = false; - auxbank_update(); - break; - - case 0x09: // ALTZPON - m_altzp = true; - auxbank_update(); - break; - - case 0x0a: // SETINTC3ROM - m_slotc3rom = false; - update_slotrom_banks(); - break; - - case 0x0b: // SETSLOTC3ROM - m_slotc3rom = true; - update_slotrom_banks(); - break; - - case 0x0c: // 80COLOFF - m_video->m_80col = false; - break; - - case 0x0d: // 80COLON - m_video->m_80col = true; - break; - - case 0x0e: // ALTCHARSETOFF - m_video->m_altcharset = false; - break; - - case 0x0f: // ALTCHARSETON - m_video->m_altcharset = true; - break; - - case 0x10: // clear keyboard latch - m_strobe = 0; - break; - - case 0x20: // cassette output - if (m_cassette) - { - m_cassette_out ^= 1; - m_cassette->output(m_cassette_out ? 1.0f : -1.0f); - } - break; - - case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: - case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: - if (m_auxslotdevice) - { - m_auxslotdevice->write_c07x(space, offset & 0xf, data); - - // card may have banked auxram; get a new bank pointer - m_aux_bank_ptr = m_auxslotdevice->get_auxbank_ptr(); - } - do_io(space, offset, false); // make sure it also side-effect resets the paddles as documented - break; - - case 0x7e: // SETIOUDIS - m_ioudis = true; break; - - case 0x7f: // CLRIOUDIS - m_ioudis = false; break; - - default: - do_io(space, offset, false); - break; - } -} - -READ8_MEMBER(apple2e_state::c000_iic_r) -{ - if(space.debugger_access()) return read_floatingbus(); - - switch (offset) - { - case 0x00: // keyboard latch - return m_transchar | m_strobe; - - case 0x02: // RAMRDOFF - m_ramrd = false; - auxbank_update(); - break; - - case 0x03: // RAMRDON - m_ramrd = true; - auxbank_update(); - break; - - case 0x04: // RAMWRTOFF - m_ramwrt = false; - auxbank_update(); - break; - - case 0x05: // RAMWRTON - m_ramwrt = true; - auxbank_update(); - break; - - case 0x10: // read any key down, reset keyboard strobe - { - UINT8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); - m_strobe = 0; - return rv; - } - - case 0x11: // read LCRAM2 (LC Dxxx bank) - return m_lcram2 ? 0x80 : 0x00; - break; - - case 0x12: // read LCRAM (is LC readable?) - return m_lcram ? 0x80 : 0x00; - break; - - case 0x13: // read RAMRD - return m_ramrd ? 0x80 : 0x00; - - case 0x14: // read RAMWRT - return m_ramwrt ? 0x80 : 0x00; - - case 0x15: // read & reset mouse X0 interrupt flag - lower_irq(IRQ_MOUSEXY); - return m_xirq ? 0x80 : 0x00; - - case 0x16: // read ALTZP - return m_altzp ? 0x80 : 0x00; - - case 0x17: // read & reset mouse Y0 interrupt flag - lower_irq(IRQ_MOUSEXY); - return m_yirq ? 0x80 : 0x00; - - case 0x18: // read 80STORE - return m_80store ? 0x80 : 0x00; - - case 0x19: // read VBL - return m_vbl ? 0x80 : 0x00; - - case 0x1a: // read TEXT - return m_video->m_graphics ? 0x00 : 0x80; - - case 0x1b: // read MIXED - return m_video->m_mix ? 0x80 : 0x00; - - case 0x1c: // read PAGE2 - return m_page2 ? 0x80 : 0x00; - - case 0x1d: // read HIRES - return m_video->m_hires ? 0x80 : 0x00; - - case 0x1e: // read ALTCHARSET - return m_video->m_altcharset ? 0x80 : 0x00; - - case 0x1f: // read 80COL - return m_video->m_80col ? 0x80 : 0x00; - - case 0x40: // read XYMask (IIc only) - return m_xy ? 0x80 : 0x00; - - case 0x41: // read VBL mask (IIc only) - return m_vblmask ? 0x80 : 0x00; - - case 0x42: // read X0Edge (IIc only) - return m_x0edge ? 0x80 : 0x00; - - case 0x43: // read Y0Edge (IIc only) - return m_y0edge ? 0x80 : 0x00; - - case 0x60: // 40/80 column switch (IIc only) - return (m_sysconfig->read() & 0x04) ? 0x80 : 0; - - case 0x61: // button 0 or Open Apple or mouse button 1 - case 0x69: - return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0; - - case 0x62: // button 1 or Solid Apple - case 0x6a: - return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0; - - case 0x63: // mouse button 2 (no other function on IIc) - case 0x6b: - return m_mouseb->read() ? 0 : 0x80; - - case 0x64: // joy 1 X axis - case 0x6c: - return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; - - case 0x65: // joy 1 Y axis - case 0x6d: - return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; - - case 0x66: // mouse X1 (IIc only) - case 0x6e: - return m_x1 ? 0x80 : 0; - - case 0x67: // mouse Y1 (IIc only) - case 0x6f: - return m_y1 ? 0x80 : 0; - - case 0x7e: // read IOUDIS - m_vbl = false; - lower_irq(IRQ_VBL); - return m_ioudis ? 0x80 : 0x00; - - case 0x7f: // read DHIRES - return m_video->m_dhires ? 0x00 : 0x80; - - default: - do_io(space, offset, true); - break; - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(apple2e_state::c000_iic_w) -{ - if(space.debugger_access()) return; - - switch (offset) - { - case 0x00: // 80STOREOFF - m_80store = false; - auxbank_update(); - break; - - case 0x01: // 80STOREON - m_80store = true; - auxbank_update(); - break; - - case 0x02: // RAMRDOFF - m_ramrd = false; - auxbank_update(); - break; - - case 0x03: // RAMRDON - m_ramrd = true; - auxbank_update(); - break; - - case 0x04: // RAMWRTOFF - m_ramwrt = false; - auxbank_update(); - break; - - case 0x05: // RAMWRTON - m_ramwrt = true; - auxbank_update(); - break; - - case 0x06: // INTCXROMOFF - m_intcxrom = false; - update_slotrom_banks(); - break; - - case 0x07: // INTCXROMON - m_intcxrom = true; - update_slotrom_banks(); - break; - - case 0x08: // ALTZPOFF - m_altzp = false; - auxbank_update(); - break; - - case 0x09: // ALTZPON - m_altzp = true; - auxbank_update(); - break; - - case 0x0a: // SETINTC3ROM - m_slotc3rom = false; - update_slotrom_banks(); - break; - - case 0x0b: // SETSLOTC3ROM - m_slotc3rom = true; - update_slotrom_banks(); - break; - - case 0x0c: // 80COLOFF - m_video->m_80col = false; - break; - - case 0x0d: // 80COLON - m_video->m_80col = true; - break; - - case 0x0e: // ALTCHARSETOFF - m_video->m_altcharset = false; - break; - - case 0x0f: // ALTCHARSETON - m_video->m_altcharset = true; - break; - - case 0x10: // clear keyboard latch - m_strobe = 0; - break; - - case 0x78: - case 0x79: - m_vbl = false; - lower_irq(IRQ_VBL); - break; - - case 0x7e: // SETIOUDIS - m_ioudis = true; - break; - - case 0x7f: // CLRIOUDIS - m_ioudis = false; - break; - - default: - do_io(space, offset, true); - break; - } -} - -void apple2e_state::update_iic_mouse() -{ - int new_mx, new_my; - - // read the axes - new_mx = m_mousex->read(); - new_my = m_mousey->read(); - - // did X change? - if (new_mx != last_mx) - { - int diff = new_mx - last_mx; - - /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; - - count_x += diff; - last_mx = new_mx; - } - - // did Y change? - if (new_my != last_my) - { - int diff = new_my - last_my; - - /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; - - count_y += diff; - last_my = new_my; - } - - if (count_x) - { - if (count_x < 0) - { - count_x++; - m_x1 = false; - } - else - { - count_x--; - m_x1 = true; - } - - // x0 is going to state-flip, generate an IRQ - if (((m_x0) && (m_x0edge)) || // falling? - (!(m_x0) && !(m_x0edge))) // rising? - { - if (m_xy) - { - m_xirq = true; - raise_irq(IRQ_MOUSEXY); - } - } - - m_x0 = !m_x0; - } - else if (count_y) - { - if (count_y < 0) - { - count_y++; - m_y1 = true; - } - else - { - count_y--; - m_y1 = false; - } - - // y0 is going to state-flip, generate an IRQ - if (((m_y0) && (m_y0edge)) || // falling? - (!(m_y0) && !(m_y0edge))) // rising? - { - if (m_xy) - { - m_yirq = true; - raise_irq(IRQ_MOUSEXY); - } - } - - m_y0 = !m_y0; - } -} - -READ8_MEMBER(apple2e_state::c080_r) -{ - if(!space.debugger_access()) - { - int slot; - - offset &= 0x7F; - slot = offset / 0x10; - - if (slot == 0) - { - lc_update(offset & 0xf); - } - else - { - if (m_slotdevice[slot] != NULL) - { - return m_slotdevice[slot]->read_c0nx(space, offset % 0x10); - } - } - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(apple2e_state::c080_w) -{ - int slot; - - offset &= 0x7F; - slot = offset / 0x10; - - if (slot == 0) - { - lc_update(offset & 0xf); - } - else - { - if (m_slotdevice[slot] != NULL) - { - m_slotdevice[slot]->write_c0nx(space, offset % 0x10, data); - } - } -} - -UINT8 apple2e_state::read_slot_rom(address_space &space, int slotbias, int offset) -{ - int slotnum = ((offset>>8) & 0xf) + slotbias; - - if (m_slotdevice[slotnum] != NULL) - { - if ((m_cnxx_slot == CNXX_UNCLAIMED) && (m_slotdevice[slotnum]->take_c800()) && (!space.debugger_access())) - { - m_cnxx_slot = slotnum; - update_slotrom_banks(); - } - - return m_slotdevice[slotnum]->read_cnxx(space, offset&0xff); - } - - return read_floatingbus(); -} - -void apple2e_state::write_slot_rom(address_space &space, int slotbias, int offset, UINT8 data) -{ - int slotnum = ((offset>>8) & 0xf) + slotbias; - - if (m_slotdevice[slotnum] != NULL) - { - if ((m_cnxx_slot == CNXX_UNCLAIMED) && (m_slotdevice[slotnum]->take_c800()) && (!space.debugger_access())) - { - m_cnxx_slot = slotnum; - update_slotrom_banks(); - } - - m_slotdevice[slotnum]->write_cnxx(space, offset&0xff, data); - } -} - -UINT8 apple2e_state::read_int_rom(address_space &space, int slotbias, int offset) -{ - if ((m_cnxx_slot == CNXX_UNCLAIMED) && (!space.debugger_access())) - { - m_cnxx_slot = CNXX_INTROM; - update_slotrom_banks(); - } - - return m_rom_ptr[slotbias + offset]; -} - -READ8_MEMBER(apple2e_state::c100_r) { return read_slot_rom(space, 1, offset); } -READ8_MEMBER(apple2e_state::c100_int_r) { return read_int_rom(space, 0x100, offset); } -READ8_MEMBER(apple2e_state::c100_int_bank_r) { return read_int_rom(space, 0x4100, offset); } -WRITE8_MEMBER(apple2e_state::c100_w) { write_slot_rom(space, 1, offset, data); } -READ8_MEMBER(apple2e_state::c300_r) { return read_slot_rom(space, 3, offset); } -READ8_MEMBER(apple2e_state::c300_int_r) { return read_int_rom(space, 0x300, offset); } -READ8_MEMBER(apple2e_state::c300_int_bank_r) { return read_int_rom(space, 0x4300, offset); } -WRITE8_MEMBER(apple2e_state::c300_w) { write_slot_rom(space, 3, offset, data); } -READ8_MEMBER(apple2e_state::c400_r) { return read_slot_rom(space, 4, offset); } -READ8_MEMBER(apple2e_state::c400_int_r) { return read_int_rom(space, 0x400, offset); } -READ8_MEMBER(apple2e_state::c400_int_bank_r) { return read_int_rom(space, 0x4400, offset); } -WRITE8_MEMBER(apple2e_state::c400_w) { write_slot_rom(space, 4, offset, data); } - -READ8_MEMBER(apple2e_state::c800_r) -{ - if ((m_isiicplus) && (offset >= 0x600)) - { - return m_iicplus_ce00[offset-0x600]; - } - - if (offset == 0x7ff) - { - m_cnxx_slot = CNXX_UNCLAIMED; - update_slotrom_banks(); - return 0xff; - } - - if ((m_cnxx_slot > 0) && (m_slotdevice[m_cnxx_slot] != NULL)) - { - return m_slotdevice[m_cnxx_slot]->read_c800(space, offset&0xfff); - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(apple2e_state::c800_w) -{ - if ((m_isiicplus) && (offset >= 0x600)) - { - m_iicplus_ce00[offset-0x600] = data; - return; - } - - if (offset == 0x7ff) - { - m_cnxx_slot = CNXX_UNCLAIMED; - update_slotrom_banks(); - return; - } - - if ((m_cnxx_slot > 0) && (m_slotdevice[m_cnxx_slot] != NULL)) - { - m_slotdevice[m_cnxx_slot]->write_c800(space, offset&0xfff, data); - } -} - -READ8_MEMBER(apple2e_state::inh_r) -{ - if (m_inh_slot != -1) - { - return m_slotdevice[m_inh_slot]->read_inh_rom(space, offset + 0xd000); - } - - assert(0); // hitting inh_r with invalid m_inh_slot should not be possible - return read_floatingbus(); -} - -WRITE8_MEMBER(apple2e_state::inh_w) -{ - if (m_inh_slot != -1) - { - m_slotdevice[m_inh_slot]->write_inh_rom(space, offset + 0xd000, data); - } -} - -READ8_MEMBER(apple2e_state::lc_r) -{ - if (m_altzp) - { - if (m_aux_bank_ptr) - { - if (offset < 0x1000) - { - if (m_lcram2) - { - return m_aux_bank_ptr[(offset & 0xfff) + 0xd000]; - } - else - { - return m_aux_bank_ptr[(offset & 0xfff) + 0xc000]; - } - } - - return m_aux_bank_ptr[(offset & 0x1fff) + 0xe000]; - } - else - { - return read_floatingbus(); - } - } - else - { - if (offset < 0x1000) - { - if (m_lcram2) - { - return m_ram_ptr[(offset & 0xfff) + 0xd000]; - } - else - { - return m_ram_ptr[(offset & 0xfff) + 0xc000]; - } - } - - return m_ram_ptr[(offset & 0x1fff) + 0xe000]; - } -} - -WRITE8_MEMBER(apple2e_state::lc_w) -{ - if (!m_lcwriteenable) - { - return; - } - - if (m_altzp) - { - if (m_aux_bank_ptr) - { - if (offset < 0x1000) - { - if (m_lcram2) - { - m_aux_bank_ptr[(offset & 0xfff) + 0xd000] = data; - } - else - { - m_aux_bank_ptr[(offset & 0xfff) + 0xc000] = data; - } - return; - } - - m_aux_bank_ptr[(offset & 0x1fff) + 0xe000] = data; - } - } - else - { - if (offset < 0x1000) - { - if (m_lcram2) - { - m_ram_ptr[(offset & 0xfff) + 0xd000] = data; - } - else - { - m_ram_ptr[(offset & 0xfff) + 0xc000] = data; - } - return; - } - - m_ram_ptr[(offset & 0x1fff) + 0xe000] = data; - } -} - -// floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter -UINT8 apple2e_state::read_floatingbus() -{ - enum - { - // scanner types - kScannerNone = 0, kScannerApple2, kScannerApple2e, - - // scanner constants - kHBurstClock = 53, // clock when Color Burst starts - kHBurstClocks = 4, // clocks per Color Burst duration - kHClock0State = 0x18, // H[543210] = 011000 - kHClocks = 65, // clocks per horizontal scan (including HBL) - kHPEClock = 40, // clock when HPE (horizontal preset enable) goes low - kHPresetClock = 41, // clock when H state presets - kHSyncClock = 49, // clock when HSync starts - kHSyncClocks = 4, // clocks per HSync duration - kNTSCScanLines = 262, // total scan lines including VBL (NTSC) - kNTSCVSyncLine = 224, // line when VSync starts (NTSC) - kPALScanLines = 312, // total scan lines including VBL (PAL) - kPALVSyncLine = 264, // line when VSync starts (PAL) - kVLine0State = 0x100, // V[543210CBA] = 100000000 - kVPresetLine = 256, // line when V state presets - kVSyncLines = 4, // lines per VSync duration - kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? - }; - - // vars - // - int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ - h_clock, h_state, h_0, h_1, h_2, h_3, h_4, h_5, - v_line, v_state, v_A, v_B, v_C, v_0, v_1, v_2, v_3, v_4, /* v_5, */ - _hires, addend0, addend1, addend2, sum, address; - - // video scanner data - // - i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync - - // machine state switches - // - Hires = (m_video->m_hires && m_video->m_graphics) ? 1 : 0; - Mixed = m_video->m_mix ? 1 : 0; - Page2 = m_page2 ? 1 : 0; - _80Store = m_80store ? 1 : 0; - - // calculate video parameters according to display standard - // - ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? - // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? - // ScanCycles = ScanLines * kHClocks; - - // calculate horizontal scanning state - // - h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock - h_state = kHClock0State + h_clock; // H state bits - if (h_clock >= kHPresetClock) // check for horizontal preset - { - h_state -= 1; // correct for state preset (two 0 states) - } - h_0 = (h_state >> 0) & 1; // get horizontal state bits - h_1 = (h_state >> 1) & 1; - h_2 = (h_state >> 2) & 1; - h_3 = (h_state >> 3) & 1; - h_4 = (h_state >> 4) & 1; - h_5 = (h_state >> 5) & 1; - - // calculate vertical scanning state - // - v_line = i / kHClocks; // which vertical scanning line - v_state = kVLine0State + v_line; // V state bits - if ((v_line >= kVPresetLine)) // check for previous vertical state preset - { - v_state -= ScanLines; // compensate for preset - } - v_A = (v_state >> 0) & 1; // get vertical state bits - v_B = (v_state >> 1) & 1; - v_C = (v_state >> 2) & 1; - v_0 = (v_state >> 3) & 1; - v_1 = (v_state >> 4) & 1; - v_2 = (v_state >> 5) & 1; - v_3 = (v_state >> 6) & 1; - v_4 = (v_state >> 7) & 1; - //v_5 = (v_state >> 8) & 1; - - // calculate scanning memory address - // - _hires = Hires; - if (Hires && Mixed && (v_4 & v_2)) - { - _hires = 0; // (address is in text memory) - } - - addend0 = 0x68; // 1 1 0 1 - addend1 = (h_5 << 5) | (h_4 << 4) | (h_3 << 3); - addend2 = (v_4 << 6) | (v_3 << 5) | (v_4 << 4) | (v_3 << 3); - sum = (addend0 + addend1 + addend2) & (0x0F << 3); - - address = 0; - address |= h_0 << 0; // a0 - address |= h_1 << 1; // a1 - address |= h_2 << 2; // a2 - address |= sum; // a3 - aa6 - address |= v_0 << 7; // a7 - address |= v_1 << 8; // a8 - address |= v_2 << 9; // a9 - address |= ((_hires) ? v_A : (1 ^ (Page2 & (1 ^ _80Store)))) << 10; // a10 - address |= ((_hires) ? v_B : (Page2 & (1 ^ _80Store))) << 11; // a11 - if (_hires) // hires? - { - // Y: insert hires only address bits - // - address |= v_C << 12; // a12 - address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 - address |= (Page2 & (1 ^ _80Store)) << 14; // a14 - } - else - { - // N: text, so no higher address bits unless Apple ][, not Apple //e - // - if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) - (kHPEClock <= h_clock) && // Y: HBL? - (h_clock <= (kHClocks - 1))) - { - address |= 1 << 12; // Y: a12 (add $1000 to address!) - } - } - - return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? -} - -/*************************************************************************** - ADDRESS MAP -***************************************************************************/ - -READ8_MEMBER(apple2e_state::ram0000_r) { return m_ram_ptr[offset]; } -WRITE8_MEMBER(apple2e_state::ram0000_w) { m_ram_ptr[offset] = data; } -READ8_MEMBER(apple2e_state::ram0200_r) { return m_ram_ptr[offset+0x200]; } -WRITE8_MEMBER(apple2e_state::ram0200_w) { m_ram_ptr[offset+0x200] = data; } -READ8_MEMBER(apple2e_state::ram0400_r) { return m_ram_ptr[offset+0x400]; } -WRITE8_MEMBER(apple2e_state::ram0400_w) { m_ram_ptr[offset+0x400] = data; } -READ8_MEMBER(apple2e_state::ram0800_r) { return m_ram_ptr[offset+0x800]; } -WRITE8_MEMBER(apple2e_state::ram0800_w) { m_ram_ptr[offset+0x800] = data; } -READ8_MEMBER(apple2e_state::ram2000_r) { return m_ram_ptr[offset+0x2000]; } -WRITE8_MEMBER(apple2e_state::ram2000_w) { m_ram_ptr[offset+0x2000] = data; } -READ8_MEMBER(apple2e_state::ram4000_r) { return m_ram_ptr[offset+0x4000]; } -WRITE8_MEMBER(apple2e_state::ram4000_w) { m_ram_ptr[offset+0x4000] = data; } - -READ8_MEMBER(apple2e_state::auxram0000_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset]; } else { return read_floatingbus(); } } -WRITE8_MEMBER(apple2e_state::auxram0000_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset] = data; } } -READ8_MEMBER(apple2e_state::auxram0200_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x200]; } else { return read_floatingbus(); } } -WRITE8_MEMBER(apple2e_state::auxram0200_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x200] = data; } } -READ8_MEMBER(apple2e_state::auxram0400_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x400]; } else { return read_floatingbus(); } } -WRITE8_MEMBER(apple2e_state::auxram0400_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x400] = data; } } -READ8_MEMBER(apple2e_state::auxram0800_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x800]; } else { return read_floatingbus(); } } -WRITE8_MEMBER(apple2e_state::auxram0800_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x800] = data; } } -READ8_MEMBER(apple2e_state::auxram2000_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x2000]; } else { return read_floatingbus(); } } -WRITE8_MEMBER(apple2e_state::auxram2000_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x2000] = data; } } -READ8_MEMBER(apple2e_state::auxram4000_r) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x4000]; } else { return read_floatingbus(); } } -WRITE8_MEMBER(apple2e_state::auxram4000_w) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x4000] = data; } } - -static ADDRESS_MAP_START( apple2e_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x01ff) AM_DEVICE(A2_0000_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0200, 0x03ff) AM_DEVICE(A2_0200_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0400, 0x07ff) AM_DEVICE(A2_0400_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0800, 0x1fff) AM_DEVICE(A2_0800_TAG, address_map_bank_device, amap8) - AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) - AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) - AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) - AM_RANGE(0xc100, 0xc2ff) AM_DEVICE(A2_C100_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc300, 0xc3ff) AM_DEVICE(A2_C300_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc400, 0xc7ff) AM_DEVICE(A2_C400_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc800, 0xcfff) AM_DEVICE(A2_C800_TAG, address_map_bank_device, amap8) - AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( apple2c_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x01ff) AM_DEVICE(A2_0000_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0200, 0x03ff) AM_DEVICE(A2_0200_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0400, 0x07ff) AM_DEVICE(A2_0400_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0800, 0x1fff) AM_DEVICE(A2_0800_TAG, address_map_bank_device, amap8) - AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) - AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_iic_r, c000_iic_w) - AM_RANGE(0xc098, 0xc09b) AM_DEVREADWRITE(IIC_ACIA1_TAG, mos6551_device, read, write) - AM_RANGE(0xc0a8, 0xc0ab) AM_DEVREADWRITE(IIC_ACIA2_TAG, mos6551_device, read, write) - AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) - AM_RANGE(0xc100, 0xc2ff) AM_DEVICE(A2_C100_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc300, 0xc3ff) AM_DEVICE(A2_C300_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc400, 0xc7ff) AM_DEVICE(A2_C400_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc800, 0xcfff) AM_DEVICE(A2_C800_TAG, address_map_bank_device, amap8) - AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( apple2c_memexp_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x01ff) AM_DEVICE(A2_0000_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0200, 0x03ff) AM_DEVICE(A2_0200_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0400, 0x07ff) AM_DEVICE(A2_0400_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0800, 0x1fff) AM_DEVICE(A2_0800_TAG, address_map_bank_device, amap8) - AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) - AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_iic_r, c000_iic_w) - AM_RANGE(0xc098, 0xc09b) AM_DEVREADWRITE(IIC_ACIA1_TAG, mos6551_device, read, write) - AM_RANGE(0xc0a8, 0xc0ab) AM_DEVREADWRITE(IIC_ACIA2_TAG, mos6551_device, read, write) - AM_RANGE(0xc0c0, 0xc0c3) AM_READWRITE(memexp_r, memexp_w) - AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) - AM_RANGE(0xc100, 0xc2ff) AM_DEVICE(A2_C100_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc300, 0xc3ff) AM_DEVICE(A2_C300_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc400, 0xc7ff) AM_DEVICE(A2_C400_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc800, 0xcfff) AM_DEVICE(A2_C800_TAG, address_map_bank_device, amap8) - AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( laser128_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x01ff) AM_DEVICE(A2_0000_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0200, 0x03ff) AM_DEVICE(A2_0200_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0400, 0x07ff) AM_DEVICE(A2_0400_TAG, address_map_bank_device, amap8) - AM_RANGE(0x0800, 0x1fff) AM_DEVICE(A2_0800_TAG, address_map_bank_device, amap8) - AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) - AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) -// AM_RANGE(0xc098, 0xc09b) AM_DEVREADWRITE(IIC_ACIA1_TAG, mos6551_device, read, write) -// AM_RANGE(0xc0a8, 0xc0ab) AM_DEVREADWRITE(IIC_ACIA2_TAG, mos6551_device, read, write) - AM_RANGE(0xc0d0, 0xc0d3) AM_READWRITE(memexp_r, memexp_w) - AM_RANGE(0xc0e0, 0xc0ef) AM_DEVREADWRITE(LASER128_UDC_TAG, applefdc_base_device, read, write) - AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) - AM_RANGE(0xc100, 0xc2ff) AM_DEVICE(A2_C100_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc300, 0xc3ff) AM_DEVICE(A2_C300_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc400, 0xc7ff) AM_DEVICE(A2_C400_TAG, address_map_bank_device, amap8) - AM_RANGE(0xc800, 0xcfff) AM_DEVICE(A2_C800_TAG, address_map_bank_device, amap8) - AM_RANGE(0xd000, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( r0000bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x01ff) AM_READWRITE(ram0000_r, ram0000_w) - AM_RANGE(0x0200, 0x03ff) AM_READWRITE(auxram0000_r, auxram0000_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( r0200bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x01ff) AM_READWRITE(ram0200_r, ram0200_w) // wr 0 rd 0 - AM_RANGE(0x0200, 0x03ff) AM_READWRITE(auxram0200_r, ram0200_w) // wr 0 rd 1 - AM_RANGE(0x0400, 0x05ff) AM_READWRITE(ram0200_r, auxram0200_w) // wr 1 rd 0 - AM_RANGE(0x0600, 0x07ff) AM_READWRITE(auxram0200_r, auxram0200_w) // wr 1 rd 1 -ADDRESS_MAP_END - -static ADDRESS_MAP_START( r0400bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x03ff) AM_READWRITE(ram0400_r, ram0400_w) // wr 0 rd 0 - AM_RANGE(0x0400, 0x07ff) AM_READWRITE(auxram0400_r, ram0400_w) // wr 0 rd 1 - AM_RANGE(0x0800, 0x0bff) AM_READWRITE(ram0400_r, auxram0400_w) // wr 1 rd 0 - AM_RANGE(0x0c00, 0x0fff) AM_READWRITE(auxram0400_r, auxram0400_w) // wr 1 rd 1 -ADDRESS_MAP_END - -static ADDRESS_MAP_START( r0800bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x17ff) AM_READWRITE(ram0800_r, ram0800_w) - AM_RANGE(0x2000, 0x37ff) AM_READWRITE(auxram0800_r, ram0800_w) - AM_RANGE(0x4000, 0x57ff) AM_READWRITE(ram0800_r, auxram0800_w) - AM_RANGE(0x6000, 0x77ff) AM_READWRITE(auxram0800_r, auxram0800_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( r2000bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x1fff) AM_READWRITE(ram2000_r, ram2000_w) - AM_RANGE(0x2000, 0x3fff) AM_READWRITE(auxram2000_r, ram2000_w) - AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ram2000_r, auxram2000_w) - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(auxram2000_r, auxram2000_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( r4000bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x00000, 0x07fff) AM_READWRITE(ram4000_r, ram4000_w) - AM_RANGE(0x08000, 0x0ffff) AM_READWRITE(auxram4000_r, ram4000_w) - AM_RANGE(0x10000, 0x17fff) AM_READWRITE(ram4000_r, auxram4000_w) - AM_RANGE(0x18000, 0x1ffff) AM_READWRITE(auxram4000_r, auxram4000_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c100bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x01ff) AM_READWRITE(c100_r, c100_w) - AM_RANGE(0x0200, 0x03ff) AM_READ(c100_int_r) AM_WRITENOP - AM_RANGE(0x0400, 0x05ff) AM_READ(c100_int_bank_r) AM_WRITENOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c300bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x00ff) AM_READWRITE(c300_r, c300_w) - AM_RANGE(0x0100, 0x01ff) AM_READ(c300_int_r) AM_WRITENOP - AM_RANGE(0x0200, 0x02ff) AM_READ(c300_int_bank_r) AM_WRITENOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c400bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x03ff) AM_READWRITE(c400_r, c400_w) - AM_RANGE(0x0400, 0x07ff) AM_READ(c400_int_r) AM_WRITENOP - AM_RANGE(0x0800, 0x0bff) AM_READ(c400_int_bank_r) AM_WRITENOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c800bank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x07ff) AM_READWRITE(c800_r, c800_w) - AM_RANGE(0x0800, 0x0fff) AM_ROM AM_REGION("maincpu", 0x800) - AM_RANGE(0x1000, 0x17ff) AM_ROM AM_REGION("maincpu", 0x4800) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( inhbank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x2fff) AM_DEVICE(A2_LCBANK_TAG, address_map_bank_device, amap8) - AM_RANGE(0x3000, 0x5fff) AM_READWRITE(inh_r, inh_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( lcbank_map, AS_PROGRAM, 8, apple2e_state ) - AM_RANGE(0x0000, 0x2fff) AM_ROM AM_REGION("maincpu", 0x1000) AM_WRITE(lc_w) - AM_RANGE(0x3000, 0x5fff) AM_READWRITE(lc_r, lc_w) - AM_RANGE(0x6000, 0x8fff) AM_ROM AM_REGION("maincpu", 0x5000) AM_WRITE(lc_w) -ADDRESS_MAP_END - -/*************************************************************************** - KEYBOARD -***************************************************************************/ - -READ_LINE_MEMBER(apple2e_state::ay3600_shift_r) -{ - // either shift key - if (m_kbspecial->read() & 0x06) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -READ_LINE_MEMBER(apple2e_state::ay3600_control_r) -{ - if (m_kbspecial->read() & 0x08) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -WRITE_LINE_MEMBER(apple2e_state::ay3600_data_ready_w) -{ - if (state == ASSERT_LINE) - { - UINT8 *decode = m_kbdrom->base(); - UINT16 trans; - - m_lastchar = m_ay3600->b_r(); - - trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff - trans |= (m_lastchar & 0x100)>>2; // bring the 0x100 bit down to the 0x40 place - trans <<= 2; // 4 entries per key - trans |= (m_kbspecial->read() & 0x06) ? 0x00 : 0x01; // shift is bit 1 (active low) - trans |= (m_kbspecial->read() & 0x08) ? 0x00 : 0x02; // control is bit 2 (active low) - trans |= (m_kbspecial->read() & 0x01) ? 0x0000 : 0x0200; // caps lock is bit 9 (active low) - - if (m_isiic) - { - if (m_sysconfig->read() & 0x08) - { - trans += 0x400; // go to DVORAK half of the ROM - } - } - - m_transchar = decode[trans]; - m_strobe = 0x80; - -// printf("new char = %04x (%02x)\n", m_lastchar, m_transchar); - } -} - -WRITE_LINE_MEMBER(apple2e_state::ay3600_ako_w) -{ - m_anykeydown = (state == ASSERT_LINE) ? true : false; - - if (m_anykeydown) - { - m_repeatdelay = 10; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::ay3600_repeat) -{ - // is the key still down? - if (m_anykeydown) - { - if (m_repeatdelay) - { - m_repeatdelay--; - } - else - { - m_strobe = 0x80; - } - } -} - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( apple2_joystick ) - PORT_START("joystick_1_x") /* Joystick 1 X Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P1 Joystick X") - PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) - PORT_KEYDELTA(JOYSTICK_DELTA) - PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) - PORT_MINMAX(0,0xff) PORT_PLAYER(1) - PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) - PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) - - PORT_START("joystick_1_y") /* Joystick 1 Y Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P1 Joystick Y") - PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) - PORT_KEYDELTA(JOYSTICK_DELTA) - PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) - PORT_MINMAX(0,0xff) PORT_PLAYER(1) - PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) - PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) - - PORT_START("joystick_2_x") /* Joystick 2 X Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P2 Joystick X") - PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) - PORT_KEYDELTA(JOYSTICK_DELTA) - PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) - PORT_MINMAX(0,0xff) PORT_PLAYER(2) - PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) - - PORT_START("joystick_2_y") /* Joystick 2 Y Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P2 Joystick Y") - PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) - PORT_KEYDELTA(JOYSTICK_DELTA) - PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) - PORT_MINMAX(0,0xff) PORT_PLAYER(2) - PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) - - PORT_START("joystick_buttons") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CODE(JOYCODE_BUTTON1) -INPUT_PORTS_END - -static INPUT_PORTS_START( apple2_gameport ) - PORT_INCLUDE( apple2_joystick ) -INPUT_PORTS_END - -static INPUT_PORTS_START( apple2_sysconfig ) - PORT_START("a2_config") - PORT_CONFNAME(0x03, 0x00, "Composite monitor type") - PORT_CONFSETTING(0x00, "Color") - PORT_CONFSETTING(0x01, "B&W") - PORT_CONFSETTING(0x02, "Green") - PORT_CONFSETTING(0x03, "Amber") -INPUT_PORTS_END - -static INPUT_PORTS_START( apple2c_sysconfig ) - PORT_START("a2_config") - PORT_CONFNAME(0x03, 0x00, "Composite monitor type") - PORT_CONFSETTING(0x00, "Color") - PORT_CONFSETTING(0x01, "B&W") - PORT_CONFSETTING(0x02, "Green") - PORT_CONFSETTING(0x03, "Amber") - PORT_CONFNAME(0x04, 0x04, "40/80 Columns") - PORT_CONFSETTING(0x00, "80 columns") - PORT_CONFSETTING(0x04, "40 columns") - PORT_CONFNAME(0x08, 0x00, "QWERTY/DVORAK") - PORT_CONFSETTING(0x00, "QWERTY") - PORT_CONFSETTING(0x08, "DVORAK") -INPUT_PORTS_END - - /* - Apple IIe & IIc key matrix (from "Sams ComputerFacts: Apple IIe" and "Sams ComputerFacts: Apple IIc") - - | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | - | | | | | | | | | | | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X0 | ESC | 1 | 2 | 3 | 4 | 6 | 5 | 7 | 8 | 9 | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X1 | TAB | Q | W | E | R | Y | T | U | I | O | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X2 | A | D | S | H | F | G | J | K | ;: | L | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X3 | Z | X | C | V | B | M | N | ,< | .> | /? | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X4 | | | | | | | \| | += | 0 | -_ | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X5 | | | | | | | `~ | P | [{ | ]} | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X6 | | | | | | |RETRN| UP | SPC | '" | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X7 | | | | | | | DEL |DOWN |LEFT |RIGHT| - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - */ - - /* - Apple IIe platinum key matrix - - | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | - | | | | | | | | | | | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X0 | ESC | 1 | 2 | 3 | 4 | 6 | 5 | 7 | 8 | 9 | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X1 | TAB | Q | W | E | R | Y | T | U | I | O | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X2 | A | D | S | H | F | G | J | K | ;: | L | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X3 | Z | X | C | V | B | M | N | ,< | .> | /? | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X4 | KP/ | | KP0 | KP1 | KP2 | KP3 | \| | += | 0 | -_ | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X5 | |KPEsc| KP4 | KP5 | KP6 | KP7 | `~ | P | [{ | ]} | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X6 | KP* | | KP8 | KP9 | KP. | KP+ |RETRN| UP | SPC | '" | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X7 | | | | KP- |KPENT| | DEL |DOWN |LEFT |RIGHT| - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - */ - -static INPUT_PORTS_START( apple2e_common ) - PORT_START("X0") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("X1") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("X2") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - - PORT_START("X3") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("X4") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - - PORT_START("X5") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("X6") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - - PORT_START("X7") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - - PORT_START("X8") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyb_special") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) -INPUT_PORTS_END - -static INPUT_PORTS_START( apple2e ) - PORT_INCLUDE( apple2e_common ) - PORT_INCLUDE( apple2_gameport ) - PORT_INCLUDE( apple2_sysconfig ) -INPUT_PORTS_END - -static INPUT_PORTS_START( apple2c ) - PORT_INCLUDE( apple2e_common ) - PORT_INCLUDE( apple2_gameport ) - PORT_INCLUDE( apple2c_sysconfig ) - - PORT_START(MOUSE_BUTTON_TAG) /* Mouse - button */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) - - PORT_START(MOUSE_XAXIS_TAG) /* Mouse - X AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(20) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START(MOUSE_YAXIS_TAG) /* Mouse - Y AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(20) PORT_KEYDELTA(0) PORT_PLAYER(1) -INPUT_PORTS_END - -static INPUT_PORTS_START( apple2euk ) - PORT_START("X0") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xa3) // a3 is Unicode for the pound sign - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("X1") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("X2") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - - PORT_START("X3") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("X4") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - - PORT_START("X5") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("X6") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - - PORT_START("X7") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - - PORT_START("X8") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyb_special") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) - - PORT_INCLUDE( apple2_gameport ) - PORT_INCLUDE(apple2_sysconfig) -INPUT_PORTS_END - -INPUT_PORTS_START( apple2ep ) - PORT_START("X0") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("X1") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("X2") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - - PORT_START("X3") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("X4") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - - PORT_START("X5") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad Esc") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("X6") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - - PORT_START("X7") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - - PORT_START("X8") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyb_special") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) - - PORT_INCLUDE( apple2_gameport ) - PORT_INCLUDE(apple2_sysconfig) -INPUT_PORTS_END - -static SLOT_INTERFACE_START(apple2_cards) - SLOT_INTERFACE("diskii", A2BUS_DISKII) /* Disk II Controller Card */ - SLOT_INTERFACE("diskiing", A2BUS_DISKIING) /* Disk II Controller Card, cycle-accurate version */ - SLOT_INTERFACE("mockingboard", A2BUS_MOCKINGBOARD) /* Sweet Micro Systems Mockingboard */ - SLOT_INTERFACE("phasor", A2BUS_PHASOR) /* Applied Engineering Phasor */ - SLOT_INTERFACE("cffa2", A2BUS_CFFA2) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 65C02/65816 firmware */ - SLOT_INTERFACE("cffa202", A2BUS_CFFA2_6502) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */ - SLOT_INTERFACE("memexp", A2BUS_MEMEXP) /* Apple II Memory Expansion Card */ - SLOT_INTERFACE("ramfactor", A2BUS_RAMFACTOR) /* Applied Engineering RamFactor */ - SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK) /* ThunderWare ThunderClock Plus */ - SLOT_INTERFACE("softcard", A2BUS_SOFTCARD) /* Microsoft SoftCard */ - SLOT_INTERFACE("videoterm", A2BUS_VIDEOTERM) /* Videx VideoTerm */ - SLOT_INTERFACE("ssc", A2BUS_SSC) /* Apple Super Serial Card */ - SLOT_INTERFACE("swyft", A2BUS_SWYFT) /* IAI SwyftCard */ - SLOT_INTERFACE("themill", A2BUS_THEMILL) /* Stellation Two The Mill (6809 card) */ - SLOT_INTERFACE("sam", A2BUS_SAM) /* SAM Software Automated Mouth (8-bit DAC + speaker) */ - SLOT_INTERFACE("alfam2", A2BUS_ALFAM2) /* ALF Apple Music II */ - SLOT_INTERFACE("echoii", A2BUS_ECHOII) /* Street Electronics Echo II */ - SLOT_INTERFACE("ap16", A2BUS_IBSAP16) /* IBS AP16 (German VideoTerm clone) */ - SLOT_INTERFACE("ap16alt", A2BUS_IBSAP16ALT) /* IBS AP16 (German VideoTerm clone), alternate revision */ - SLOT_INTERFACE("vtc1", A2BUS_VTC1) /* Unknown VideoTerm clone #1 */ - SLOT_INTERFACE("vtc2", A2BUS_VTC2) /* Unknown VideoTerm clone #2 */ - SLOT_INTERFACE("arcbd", A2BUS_ARCADEBOARD) /* Third Millenium Engineering Arcade Board */ - SLOT_INTERFACE("midi", A2BUS_MIDI) /* Generic 6840+6850 MIDI board */ - SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE) /* ZIP Technologies IDE card */ - SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS) /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */ - SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */ - SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */ - SLOT_INTERFACE("aesms", A2BUS_AESMS) /* Applied Engineering Super Music Synthesizer */ - SLOT_INTERFACE("ultraterm", A2BUS_ULTRATERM) /* Videx UltraTerm (original) */ - SLOT_INTERFACE("ultratermenh", A2BUS_ULTRATERMENH) /* Videx UltraTerm (enhanced //e) */ - SLOT_INTERFACE("aevm80", A2BUS_VTC2) /* Applied Engineering ViewMaster 80 */ - SLOT_INTERFACE("parallel", A2BUS_PIC) /* Apple Parallel Interface Card */ - SLOT_INTERFACE("corvus", A2BUS_CORVUS) /* Corvus flat-cable HDD interface (see notes in a2corvus.c) */ - SLOT_INTERFACE("mcms1", A2BUS_MCMS1) /* Mountain Computer Music System, card 1 of 2 */ - SLOT_INTERFACE("mcms2", A2BUS_MCMS2) /* Mountain Computer Music System, card 2 of 2. must be in card 1's slot + 1! */ - SLOT_INTERFACE("dx1", A2BUS_DX1) /* Decillonix DX-1 sampler card */ - SLOT_INTERFACE("tm2ho", A2BUS_TIMEMASTERHO) /* Applied Engineering TimeMaster II H.O. */ - SLOT_INTERFACE("mouse", A2BUS_MOUSE) /* Apple II Mouse Card */ - SLOT_INTERFACE("ezcgi", A2BUS_EZCGI) /* E-Z Color Graphics Interface */ - SLOT_INTERFACE("ezcgi9938", A2BUS_EZCGI_9938) /* E-Z Color Graphics Interface (TMS9938) */ - SLOT_INTERFACE("ezcgi9958", A2BUS_EZCGI_9958) /* E-Z Color Graphics Interface (TMS9958) */ -// SLOT_INTERFACE("magicmusician", A2BUS_MAGICMUSICIAN) /* Magic Musician Card */ -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(apple2eaux_cards) - SLOT_INTERFACE("std80", A2EAUX_STD80COL) /* Apple IIe Standard 80 Column Card */ - SLOT_INTERFACE("ext80", A2EAUX_EXT80COL) /* Apple IIe Extended 80 Column Card */ - SLOT_INTERFACE("rw3", A2EAUX_RAMWORKS3) /* Applied Engineering RamWorks III */ -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( apple2e, apple2e_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(apple2e_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2e_state, apple2_interrupt, "screen", 0, 1) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD(A2_VIDEO_TAG, APPLE2_VIDEO, XTAL_14_31818MHz) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192) - MCFG_SCREEN_UPDATE_DRIVER(apple2e_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(apple2e_state, apple2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(A2_SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* RAM */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_DEFAULT_VALUE(0x00) - - /* 0000 banking */ - MCFG_DEVICE_ADD(A2_0000_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(r0000bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200) - - /* 0200 banking */ - MCFG_DEVICE_ADD(A2_0200_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(r0200bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200) - - /* 0400 banking */ - MCFG_DEVICE_ADD(A2_0400_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(r0400bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) - - /* 0800 banking */ - MCFG_DEVICE_ADD(A2_0800_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(r0800bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000) - - /* 2000 banking */ - MCFG_DEVICE_ADD(A2_2000_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(r2000bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000) - - /* 4000 banking */ - MCFG_DEVICE_ADD(A2_4000_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(r4000bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x8000) - - /* C100 banking */ - MCFG_DEVICE_ADD(A2_C100_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(c100bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x200) - - /* C300 banking */ - MCFG_DEVICE_ADD(A2_C300_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(c300bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x100) - - /* C400 banking */ - MCFG_DEVICE_ADD(A2_C400_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(c400bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) - - /* C800 banking */ - MCFG_DEVICE_ADD(A2_C800_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(c800bank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x800) - - /* built-in language card emulation */ - MCFG_DEVICE_ADD(A2_LCBANK_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(lcbank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x3000) - - /* /INH banking */ - MCFG_DEVICE_ADD(A2_UPPERBANK_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(inhbank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x3000) - - /* keyboard controller */ - MCFG_DEVICE_ADD("ay3600", AY3600, 0) - MCFG_AY3600_MATRIX_X0(IOPORT("X0")) - MCFG_AY3600_MATRIX_X1(IOPORT("X1")) - MCFG_AY3600_MATRIX_X2(IOPORT("X2")) - MCFG_AY3600_MATRIX_X3(IOPORT("X3")) - MCFG_AY3600_MATRIX_X4(IOPORT("X4")) - MCFG_AY3600_MATRIX_X5(IOPORT("X5")) - MCFG_AY3600_MATRIX_X6(IOPORT("X6")) - MCFG_AY3600_MATRIX_X7(IOPORT("X7")) - MCFG_AY3600_MATRIX_X8(IOPORT("X8")) - MCFG_AY3600_SHIFT_CB(READLINE(apple2e_state, ay3600_shift_r)) - MCFG_AY3600_CONTROL_CB(READLINE(apple2e_state, ay3600_control_r)) - MCFG_AY3600_DATA_READY_CB(WRITELINE(apple2e_state, ay3600_data_ready_w)) - MCFG_AY3600_AKO_CB(WRITELINE(apple2e_state, ay3600_ako_w)) - - /* repeat timer. 15 Hz from page 7-15 of "Understanding the Apple IIe" */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("repttmr", apple2e_state, ay3600_repeat, attotime::from_hz(15)) - - /* slot devices */ - MCFG_DEVICE_ADD("a2bus", A2BUS, 0) - MCFG_A2BUS_CPU("maincpu") - MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(apple2e_state, a2bus_irq_w)) - MCFG_A2BUS_OUT_NMI_CB(WRITELINE(apple2e_state, a2bus_nmi_w)) - MCFG_A2BUS_OUT_INH_CB(WRITELINE(apple2e_state, a2bus_inh_w)) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl1", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl2", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl3", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl4", apple2_cards, "mockingboard") - MCFG_A2BUS_SLOT_ADD("a2bus", "sl5", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl6", apple2_cards, "diskiing") - MCFG_A2BUS_SLOT_ADD("a2bus", "sl7", apple2_cards, NULL) - - MCFG_DEVICE_ADD(A2_AUXSLOT_TAG, A2EAUXSLOT, 0) - MCFG_A2EAUXSLOT_CPU("maincpu") - MCFG_A2EAUXSLOT_OUT_IRQ_CB(WRITELINE(apple2e_state, a2bus_irq_w)) - MCFG_A2EAUXSLOT_OUT_NMI_CB(WRITELINE(apple2e_state, a2bus_nmi_w)) - MCFG_A2EAUXSLOT_SLOT_ADD(A2_AUXSLOT_TAG, "aux", apple2eaux_cards, "ext80") // default to an extended 80-column card - - MCFG_SOFTWARE_LIST_ADD("flop525_list","apple2") - - MCFG_CASSETTE_ADD(A2_CASSETTE_TAG) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mprof3, apple2e ) - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apple2ee, apple2e ) - MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(apple2e_map) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tk3000, apple2e ) - MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(apple2e_map) - -// MCFG_CPU_ADD("subcpu", Z80, 1021800) // schematics are illegible on where the clock comes from, but it *seems* to be the same as the 65C02 clock -// MCFG_CPU_PROGRAM_MAP(tk3000_kbd_map) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apple2ep, apple2e ) - MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(apple2e_map) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apple2c, apple2ee ) - MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(apple2c_map) - - // IIc and friends have no cassette port - MCFG_DEVICE_REMOVE(A2_CASSETTE_TAG) - - MCFG_A2BUS_SLOT_REMOVE("sl1") // IIc has no slots, of course :) - MCFG_A2BUS_SLOT_REMOVE("sl2") - MCFG_A2BUS_SLOT_REMOVE("sl3") - MCFG_A2BUS_SLOT_REMOVE("sl4") - MCFG_A2BUS_SLOT_REMOVE("sl5") - MCFG_A2BUS_SLOT_REMOVE("sl6") - MCFG_A2BUS_SLOT_REMOVE("sl7") - - MCFG_DEVICE_ADD(IIC_ACIA1_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_14_31818MHz / 8) // ~1.789 MHz - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(PRINTER_PORT_TAG, rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(IIC_ACIA2_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) // matches SSC so modem software is compatible - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("modem", rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD(PRINTER_PORT_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(IIC_ACIA1_TAG, mos6551_device, write_cts)) - - MCFG_RS232_PORT_ADD(MODEM_PORT_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(IIC_ACIA2_TAG, mos6551_device, write_cts)) - - // TODO: populate the IIc's other virtual slots with ONBOARD_ADD - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_DISKIING, NULL) - - MCFG_A2EAUXSLOT_SLOT_REMOVE("aux") - MCFG_DEVICE_REMOVE(A2_AUXSLOT_TAG) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("128K") -MACHINE_CONFIG_END - -const applefdc_interface a2cp_interface = -{ - sony_set_lines, /* set_lines */ - sony_set_enable_lines, /* set_enable_lines */ - - sony_read_data, /* read_data */ - sony_write_data, /* write_data */ - sony_read_status /* read_status */ -}; - -static const floppy_interface apple2cp_floppy35_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(apple35_iigs), - "floppy_3_5" -}; - -static MACHINE_CONFIG_DERIVED( apple2cp, apple2c ) - MCFG_A2BUS_SLOT_REMOVE("sl6") - MCFG_IWM_ADD(IICP_IWM_TAG, a2cp_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(apple2cp_floppy35_floppy_interface) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apple2c_iwm, apple2c ) - - MCFG_A2BUS_SLOT_REMOVE("sl6") - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_IWM_FDC, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apple2c_mem, apple2c ) - MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(apple2c_memexp_map) - - MCFG_A2BUS_SLOT_REMOVE("sl6") - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_IWM_FDC, NULL) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("128K, 384K, 640K, 896K, 1152K") -MACHINE_CONFIG_END - -const applefdc_interface fdc_interface = -{ - apple525_set_lines, /* set_lines */ - apple525_set_enable_lines, /* set_enable_lines */ - - apple525_read_data, /* read_data */ - apple525_write_data, /* write_data */ - apple525_read_status /* read_status */ -}; - -static const floppy_interface floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(apple2), - "floppy_5_25" -}; - -static MACHINE_CONFIG_DERIVED( laser128, apple2c ) - MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(laser128_map) - - MCFG_APPLEFDC_ADD(LASER128_UDC_TAG, fdc_interface) - MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(floppy_interface,15,16) - - MCFG_A2BUS_SLOT_REMOVE("sl6") - - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl1", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl2", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl3", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl4", A2BUS_LASER128, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl5", apple2_cards, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_LASER128, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl7", apple2_cards, NULL) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("128K, 384K, 640K, 896K, 1152K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( laser128ex2, apple2c ) - MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(laser128_map) - - MCFG_APPLEFDC_ADD(LASER128_UDC_TAG, fdc_interface) - MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(floppy_interface,15,16) - - MCFG_A2BUS_SLOT_REMOVE("sl6") - - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl1", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl2", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl3", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl4", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl5", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_LASER128, NULL) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl7", A2BUS_LASER128, NULL) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("128K, 384K, 640K, 896K, 1152K") -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(apple2e) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "342-0133-a.chr", 0x0000, 0x1000,CRC(b081df66) SHA1(7060de104046736529c1e8a687a0dd7b84f8c51b)) - ROM_LOAD ( "342-0133-a.chr", 0x1000, 0x1000,CRC(b081df66) SHA1(7060de104046736529c1e8a687a0dd7b84f8c51b)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD ( "342-0135-b.64", 0x0000, 0x2000, CRC(e248835e) SHA1(523838c19c79f481fa02df56856da1ec3816d16e)) - ROM_LOAD ( "342-0134-a.64", 0x2000, 0x2000, CRC(fc3d59d8) SHA1(8895a4b703f2184b673078f411f4089889b61c54)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak -ROM_END - -ROM_START(apple2euk) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD( "341-0160-a.chr", 0x0000, 0x2000, CRC(9be77112) SHA1(48aafa9a72002c495bc1f3d28150630ff89ca47e) ) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD ( "342-0135-b.64", 0x0000, 0x2000, CRC(e248835e) SHA1(523838c19c79f481fa02df56856da1ec3816d16e)) - ROM_LOAD ( "342-0134-a.64", 0x2000, 0x2000, CRC(fc3d59d8) SHA1(8895a4b703f2184b673078f411f4089889b61c54)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "341-0150-a.e12", 0x000, 0x800, CRC(66ffacd7) SHA1(47bb9608be38ff75429a989b930a93b47099648e) ) -ROM_END - -ROM_START(mprof3) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "mpf3.chr", 0x0000, 0x1000,CRC(2597bc19) SHA1(e114dcbb512ec24fb457248c1b53cbd78039ed20)) - ROM_LOAD ( "mpf3.chr", 0x1000, 0x1000,CRC(2597bc19) SHA1(e114dcbb512ec24fb457248c1b53cbd78039ed20)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD ( "mpf3-cd.rom", 0x0000, 0x2000, CRC(5b662e06) SHA1(aa0db775ca78986480829fcc10f00e57629e1a7c)) - ROM_LOAD ( "mpf3-ef.rom", 0x2000, 0x2000, CRC(2c5e8b92) SHA1(befeb03e04b7c3ef36ef5829948a53880df85e92)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // need to dump real mprof keyboard ROM -ROM_END - -ROM_START(apple2ee) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "342-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - ROM_LOAD ( "342-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD ( "342-0304-a.e10", 0x0000, 0x2000, CRC(443aa7c4) SHA1(3aecc56a26134df51e65e17f33ae80c1f1ac93e6)) /* PCB: "CD ROM // 342-0304", 2364 mask rom */ - ROM_LOAD ( "342-0303-a.e8", 0x2000, 0x2000, CRC(95e10034) SHA1(afb09bb96038232dc757d40c0605623cae38088e)) /* PCB: "EF ROM // 342-0303", 2364 mask rom */ - - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -ROM_START(apple2eeuk) - ROM_REGION(0x2000, "gfx1", 0) - ROM_LOAD( "342-0273-a.chr", 0x0000, 0x2000, CRC(9157085a) SHA1(85479a509d6c8176949a5b20720567b7022aa631) ) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD ( "342-0304-a.e10", 0x0000, 0x2000, CRC(443aa7c4) SHA1(3aecc56a26134df51e65e17f33ae80c1f1ac93e6)) /* PCB: "CD ROM // 342-0304", 2364 mask rom */ - ROM_LOAD ( "342-0303-a.e8", 0x2000, 0x2000, CRC(95e10034) SHA1(afb09bb96038232dc757d40c0605623cae38088e)) /* PCB: "EF ROM // 342-0303", 2364 mask rom */ - - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0150-a.e12", 0x000, 0x800, CRC(66ffacd7) SHA1(47bb9608be38ff75429a989b930a93b47099648e) ) -ROM_END - -ROM_START(apple2ep) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "342-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - ROM_LOAD ( "342-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD ("32-0349-b.128", 0x0000, 0x4000, CRC(1d70b193) SHA1(b8ea90abe135a0031065e01697c4a3a20d51198b)) /* should rom name be 342-0349-b? */ - - ROM_REGION( 0x800, "keyboard", 0 ) - // chip printed markings say 342-0132-d, but internally text says "341-0132-d". Go figure. - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -ROM_START(apple2c) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD ( "a2c.128", 0x0000, 0x4000, CRC(f0edaa1b) SHA1(1a9b8aca5e32bb702ddb7791daddd60a89655729)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak -ROM_END - -// unlike the very unique TK2000, the TK3000 is a mostly stock enhanced IIe clone -ROM_START(tk3000) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD( "tk3000.f7", 0x000000, 0x002000, CRC(70157693) SHA1(a7922e2137f95271011042441d80466fba7bb828) ) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD( "tk3000.f4f6", 0x000000, 0x004000, CRC(5b1e8ab2) SHA1(f163e5753c18ff0e812a448e8da406f102600edf) ) - - ROM_REGION(0x2000, "kbdcpu", 0) - ROM_LOAD( "tk3000.e13", 0x000000, 0x002000, CRC(f9b860d3) SHA1(6a127f1458f43a00199d3dde94569b8928f05a53) ) - - ROM_REGION(0x800, "keyboard", ROMREGION_ERASE00) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // probably not this machine's actual ROM -ROM_END - -ROM_START(prav8c) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "charrom.d20", 0x0000, 0x2000,CRC(935212cc) SHA1(934603a441c631bd841ea0d2ff39525474461e47)) - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD ( "prom_cd.d46", 0x0000, 0x2000, CRC(195d0b48) SHA1(f8c4f3722159081f6950207f03bc85da30980c08)) - ROM_LOAD ( "prom_ef.d41", 0x2000, 0x2000, CRC(ec6aa2f6) SHA1(64bce893ebf0e22cd8f22436b97ef1bfeddf692f)) - - // contains slot firmware for slots 1, 2, and 6 (6 is the usual Disk II f/w) - ROM_REGION(0x2000,"unknown",0) - ROM_LOAD ( "eprom.d38", 0x0000, 0x2000, CRC(c8d00b19) SHA1(13d156957ea68d0e7bc4be57cb1580c8b1399981)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // we don't know what this machine used -ROM_END - -ROM_START(apple2c0) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD("3420033a.256", 0x0000, 0x8000, CRC(c8b979b3) SHA1(10767e96cc17bad0970afda3a4146564e6272ba1)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak -ROM_END - -ROM_START(apple2c3) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD("342-0445-a.256", 0x0000, 0x8000, CRC(bc5a79ff) SHA1(5338d9baa7ae202457b6500fde5883dbdc86e5d3)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak -ROM_END - -ROM_START(apple2c4) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD("3410445b.256", 0x0000, 0x8000, CRC(06f53328) SHA1(015061597c4cda7755aeb88b735994ffd2f235ca)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // 1983 US-Dvorak -ROM_END - -ROM_START(laser128) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD("laser128.256", 0x0000, 0x8000, CRC(39e59ed3) SHA1(cbd2f45c923725bfd57f8548e65cc80b13bc18da)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // need to dump real laser rom -ROM_END - -ROM_START(las128ex) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD("las128ex.256", 0x0000, 0x8000, CRC(b67c8ba1) SHA1(8bd5f82a501b1cf9d988c7207da81e514ca254b0)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // need to dump real laser rom -ROM_END - -ROM_START(las128e2) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000, BAD_DUMP CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) // need to dump real laser rom - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD( "laser 128ex2 rom version 6.1.bin", 0x000000, 0x008000, CRC(7f911c90) SHA1(125754c1bd777d4c510f5239b96178c6f2e3236b) ) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "342-0132-c.e12", 0x000, 0x800, BAD_DUMP CRC(e47045f4) SHA1(12a2e718f5f4acd69b6c33a45a4a940b1440a481) ) // need to dump real laser rom -ROM_END - -ROM_START(apple2cp) - ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000,CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - - ROM_REGION(0x8000,"maincpu",0) - ROM_LOAD("341-0625-a.256", 0x0000, 0x8000, CRC(0b996420) SHA1(1a27ae26966bbafd825d08ad1a24742d3e33557c)) - - ROM_REGION( 0x800, "keyboard", ROMREGION_ERASE00 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1983, apple2e, 0, apple2, apple2e, apple2e, driver_device, 0, "Apple Computer", "Apple //e", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, apple2euk,apple2e, 0, apple2e, apple2euk,driver_device, 0, "Apple Computer", "Apple //e (UK)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, mprof3, apple2e, 0, mprof3, apple2e, driver_device, 0, "Multitech", "Microprofessor III", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1985, apple2ee, apple2e, 0, apple2ee, apple2e, driver_device, 0, "Apple Computer", "Apple //e (enhanced)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, apple2eeuk,apple2e, 0, apple2ee, apple2euk, driver_device,0, "Apple Computer", "Apple //e (enhanced, UK)", MACHINE_SUPPORTS_SAVE ) -COMP( 1987, apple2ep, apple2e, 0, apple2ep, apple2ep, driver_device, 0, "Apple Computer", "Apple //e (Platinum)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, apple2c, 0, apple2, apple2c, apple2c, driver_device, 0, "Apple Computer", "Apple //c" , MACHINE_SUPPORTS_SAVE ) -COMP( 1986, tk3000, apple2c, 0, tk3000, apple2e, driver_device, 0, "Microdigital", "TK3000//e" , MACHINE_SUPPORTS_SAVE ) -COMP( 1989, prav8c, apple2e, 0, apple2e, apple2e, driver_device, 0, "Pravetz", "Pravetz 8C", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1987, laser128, apple2c, 0, laser128, apple2e, driver_device, 0, "Video Technology", "Laser 128 (version 4.2)", MACHINE_SUPPORTS_SAVE ) -COMP( 1988, las128ex, apple2c, 0, laser128, apple2e, driver_device, 0, "Video Technology", "Laser 128ex (version 4.5)", MACHINE_SUPPORTS_SAVE ) -COMP( 1988, las128e2, apple2c, 0, laser128ex2, apple2e, driver_device, 0, "Video Technology", "Laser 128ex2 (version 6.1)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, apple2c0, apple2c, 0, apple2c_iwm, apple2c, driver_device, 0, "Apple Computer", "Apple //c (UniDisk 3.5)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, apple2c3, apple2c, 0, apple2c_mem, apple2c, driver_device, 0, "Apple Computer", "Apple //c (Original Memory Expansion)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, apple2c4, apple2c, 0, apple2c_mem, apple2c, driver_device, 0, "Apple Computer", "Apple //c (rev 4)", MACHINE_SUPPORTS_SAVE ) -COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2c, driver_device, 0, "Apple Computer", "Apple //c Plus", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/apple2gs.c b/src/mess/drivers/apple2gs.c deleted file mode 100644 index 54c4674f9df..00000000000 --- a/src/mess/drivers/apple2gs.c +++ /dev/null @@ -1,597 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,R. Belmont -/*************************************************************************** - - drivers/apple2gs.c - Apple IIgs - Driver by Nathan Woods and R. Belmont - - TODO: - - Fix spurious interrupt problem (caused by ADB HLE; switching to emulation of the M50740 + GLU should solve this) - - Fix 5.25" disks - - Optimize video code - - More RAM configurations - - NOTES: - - Video timing and the h/vcount registers: - VCounts - HCounts go like this: 0xfa (start of frame, still in vblank) - 0 0x40 0x41 0x58 (first visible pixel) 0x7f - ____________________________________ 0x100 (first visible scan line) - | | - | | - | | - | | - | | - HBL region | | - | | - | | - | | - | | - | | 0x1c0 (first line of Vblank, c019 and heartbeat trigger here, only true VBL if in A2 classic modes) - | | - ____________________________________ 0x1c8 (actual start of vblank in IIgs modes) - - 0x1ff (end of frame, in vblank) - - There are 64 HCounts total, and 704 pixels total, so HCounts do not map to the pixel clock. - VCounts do map directly to scanlines however, and count 262 of them. - -================================================================= - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/g65816/g65816.h" -#include "includes/apple2.h" -#include "imagedev/flopdrv.h" -#include "formats/ap2_dsk.h" -#include "formats/ap_dsk35.h" -#include "includes/apple2gs.h" -#include "machine/sonydriv.h" -#include "machine/appldriv.h" -#include "sound/es5503.h" -#include "machine/applefdc.h" -#include "machine/8530scc.h" -#include "sound/speaker.h" -#include "machine/ram.h" - -#include "bus/a2bus/a2bus.h" -#include "bus/a2bus/a2lang.h" -#include "bus/a2bus/a2diskii.h" -#include "bus/a2bus/a2mockingboard.h" -#include "bus/a2bus/a2cffa.h" -#include "bus/a2bus/a2memexp.h" -#include "bus/a2bus/a2scsi.h" -#include "bus/a2bus/a2thunderclock.h" -#include "bus/a2bus/a2ssc.h" -#include "bus/a2bus/a2softcard.h" -#include "bus/a2bus/a2sam.h" -#include "bus/a2bus/a2alfam2.h" -#include "bus/a2bus/a2echoii.h" -#include "bus/a2bus/a2arcadebd.h" -#include "bus/a2bus/a2midi.h" -#include "bus/a2bus/a2vulcan.h" -#include "bus/a2bus/a2zipdrive.h" -//#include "bus/a2bus/a2udrive.h" -#include "bus/a2bus/a2hsscsi.h" - -static const gfx_layout apple2gs_text_layout = -{ - 14,8, /* 14*8 characters */ - 512, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - { 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1 }, /* x offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout apple2gs_dbltext_layout = -{ - 7,8, /* 7*8 characters */ - 512, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - { 7, 6, 5, 4, 3, 2, 1 }, /* x offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( apple2gs ) - GFXDECODE_ENTRY( "gfx1", 0x0000, apple2gs_text_layout, 0, 2 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, apple2gs_dbltext_layout, 0, 2 ) -GFXDECODE_END - -static const unsigned char apple2gs_palette[] = -{ - 0x0, 0x0, 0x0, /* Black $0 $0000 */ - 0xD, 0x0, 0x3, /* Deep Red $1 $0D03 */ - 0x0, 0x0, 0x9, /* Dark Blue $2 $0009 */ - 0xD, 0x2, 0xD, /* Purple $3 $0D2D */ - 0x0, 0x7, 0x2, /* Dark Green $4 $0072 */ - 0x5, 0x5, 0x5, /* Dark Gray $5 $0555 */ - 0x2, 0x2, 0xF, /* Medium Blue $6 $022F */ - 0x6, 0xA, 0xF, /* Light Blue $7 $06AF */ - 0x8, 0x5, 0x0, /* Brown $8 $0850 */ - 0xF, 0x6, 0x0, /* Orange $9 $0F60 */ - 0xA, 0xA, 0xA, /* Light Gray $A $0AAA */ - 0xF, 0x9, 0x8, /* Pink $B $0F98 */ - 0x1, 0xD, 0x0, /* Light Green $C $01D0 */ - 0xF, 0xF, 0x0, /* Yellow $D $0FF0 */ - 0x4, 0xF, 0x9, /* Aquamarine $E $04F9 */ - 0xF, 0xF, 0xF /* White $F $0FFF */ -}; - -static INPUT_PORTS_START( apple2gs ) - PORT_INCLUDE( apple2ep ) - - PORT_START("adb_mouse_x") - PORT_BIT( 0x7f, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 1") - - PORT_START("adb_mouse_y") - PORT_BIT( 0x7f, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 0") - -INPUT_PORTS_END - - - -/* Initialize the palette */ -PALETTE_INIT_MEMBER(apple2gs_state,apple2gs) -{ - int i; - -// PALETTE_INIT_NAME(apple2)(palette); - - for (i = 0; i < 16; i++) - { - palette.set_pen_color(i, - apple2gs_palette[(3*i)]*17, - apple2gs_palette[(3*i)+1]*17, - apple2gs_palette[(3*i)+2]*17); - - m_a2_palette[i] = rgb_t(apple2gs_palette[(3*i)]*17, apple2gs_palette[(3*i)+1]*17, apple2gs_palette[(3*i)+2]*17); - } -} - -READ8_MEMBER(apple2gs_state::apple2gs_adc_read) -{ - return 0x80; -} - -static const floppy_interface apple2gs_floppy35_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(apple35_iigs), - "floppy_3_5" -}; - -static const floppy_interface apple2gs_floppy525_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(apple2), - "floppy_5_25" -}; - - -static ADDRESS_MAP_START( apple2gs_map, AS_PROGRAM, 8, apple2gs_state ) - /* nothing in the address map - everything is added dynamically */ -ADDRESS_MAP_END - -// ADB microcontroller emulation -// -// Huge thanks to Neil Parker's writeup on the ADB microcontroller! -// http://www.llx.com/~nparker/a2/adb.html - -#if RUN_ADB_MICRO -READ8_MEMBER(apple2gs_state::adbmicro_p0_in) -{ - return m_glu_bus; -} - -READ8_MEMBER(apple2gs_state::adbmicro_p1_in) -{ - if (m_is_rom3) - { - return 0x06; // indicate ROM 3 - } - - return 0xff; -} - -READ8_MEMBER(apple2gs_state::adbmicro_p2_in) -{ - UINT8 rv = 0; - - rv |= 0x40; // no reset - rv |= (m_adb_line) ? 0x00 : 0x80; - - return rv; -} - -READ8_MEMBER(apple2gs_state::adbmicro_p3_in) -{ - return 0x7; // don't press IIE capslock/ctrl/shift -} - -WRITE8_MEMBER(apple2gs_state::adbmicro_p0_out) -{ - m_glu_bus = data; -} - -WRITE8_MEMBER(apple2gs_state::adbmicro_p1_out) -{ -} - -WRITE8_MEMBER(apple2gs_state::adbmicro_p2_out) -{ - if (!(data & 0x10)) - { - if (m_adbmicro->are_port_bits_output(0, 0xff)) - { - keyglu_mcu_write(data & 7, m_glu_bus); - } - else // read GLU - { - m_glu_bus = keyglu_mcu_read(data & 7); - } - } -} - -WRITE8_MEMBER(apple2gs_state::adbmicro_p3_out) -{ - if (((data & 0x08) == 0x08) != m_adb_line) - { - m_adb_dtime = (int)(machine().time().as_ticks(XTAL_3_579545MHz*2) - m_last_adb_time); -// printf("ADB change to %d (dtime %d)\n", (data>>3) & 1, m_adb_dtime); - m_last_adb_time = machine().time().as_ticks(XTAL_3_579545MHz*2); - m_adb_line = (data & 0x8) ? true : false; - } -} -#endif - -WRITE_LINE_MEMBER(apple2gs_state::a2bus_irq_w) -{ - if (state) - { - apple2gs_add_irq(IRQ_SLOT); - } - else - { - apple2gs_remove_irq(IRQ_SLOT); - } -} - -WRITE_LINE_MEMBER(apple2gs_state::a2bus_nmi_w) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, state); -} - -WRITE_LINE_MEMBER(apple2gs_state::a2bus_inh_w) -{ - m_inh_slot = -1; - apple2_update_memory(); -} - -static SLOT_INTERFACE_START(apple2_cards) - SLOT_INTERFACE("diskii", A2BUS_DISKII) /* Disk II Controller Card */ - SLOT_INTERFACE("mockingboard", A2BUS_MOCKINGBOARD) /* Sweet Micro Systems Mockingboard */ - SLOT_INTERFACE("phasor", A2BUS_PHASOR) /* Applied Engineering Phasor */ - SLOT_INTERFACE("cffa2", A2BUS_CFFA2) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 65C02/65816 firmware */ - SLOT_INTERFACE("cffa202", A2BUS_CFFA2_6502) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */ - SLOT_INTERFACE("memexp", A2BUS_MEMEXP) /* Apple II Memory Expansion Card */ - SLOT_INTERFACE("ramfactor", A2BUS_RAMFACTOR) /* Applied Engineering RamFactor */ - SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK) /* ThunderWare ThunderClock Plus */ - SLOT_INTERFACE("ssc", A2BUS_SSC) /* Apple Super Serial Card */ - SLOT_INTERFACE("sam", A2BUS_SAM) /* SAM Software Automated Mouth (8-bit DAC + speaker) */ - SLOT_INTERFACE("alfam2", A2BUS_ALFAM2) /* ALF Apple Music II */ - SLOT_INTERFACE("echoii", A2BUS_ECHOII) /* Street Electronics Echo II */ - SLOT_INTERFACE("arcbd", A2BUS_ARCADEBOARD) /* Third Millenium Engineering Arcade Board */ - SLOT_INTERFACE("midi", A2BUS_MIDI) /* Generic 6840+6850 MIDI board */ - SLOT_INTERFACE("vulcan", A2BUS_VULCAN) /* AE Vulcan IDE card */ - SLOT_INTERFACE("vulcangold", A2BUS_VULCANGOLD) /* AE Vulcan Gold IDE card */ - SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE) /* ZIP Technologies IDE card */ - SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS) /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */ -// SLOT_INTERFACE("mdturbo", A2BUS_UDRIVE_TURBO) /* ///SHH Systeme MicroDrive Turbo IDE card */ - -// SLOT_INTERFACE("softcard", A2BUS_SOFTCARD) /* Microsoft SoftCard */ // appears not to be IIgs compatible? - SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */ - SLOT_INTERFACE("hsscsi", A2BUS_HSSCSI) /* Apple II High-Speed SCSI Card */ -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( apple2gs, apple2gs_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", G65816, APPLE2GS_14M/5) - MCFG_CPU_PROGRAM_MAP(apple2gs_map) - #if RUN_ADB_MICRO - MCFG_CPU_ADD(ADBMICRO_TAG, M50741, XTAL_3_579545MHz) - MCFG_M5074X_PORT0_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p0_in)) - MCFG_M5074X_PORT0_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p0_out)) - MCFG_M5074X_PORT1_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p1_in)) - MCFG_M5074X_PORT1_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p1_out)) - MCFG_M5074X_PORT2_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p2_in)) - MCFG_M5074X_PORT2_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p2_out)) - MCFG_M5074X_PORT3_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p3_in)) - MCFG_M5074X_PORT3_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p3_out)) - #endif - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2gs_state, apple2_interrupt, "screen", 0, 1) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(704, 262) // 640+32+32 for the borders - MCFG_SCREEN_VISIBLE_AREA(0,703,0,230) - MCFG_SCREEN_UPDATE_DRIVER(apple2gs_state, screen_update_apple2gs) - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(apple2gs_state, apple2gs) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", apple2gs ) - - MCFG_MACHINE_START_OVERRIDE(apple2gs_state, apple2gs ) - MCFG_MACHINE_RESET_OVERRIDE(apple2gs_state, apple2gs ) - - MCFG_VIDEO_START_OVERRIDE(apple2gs_state, apple2gs ) - - /* keyboard controller */ - MCFG_DEVICE_ADD("ay3600", AY3600, 0) - MCFG_AY3600_MATRIX_X0(IOPORT("X0")) - MCFG_AY3600_MATRIX_X1(IOPORT("X1")) - MCFG_AY3600_MATRIX_X2(IOPORT("X2")) - MCFG_AY3600_MATRIX_X3(IOPORT("X3")) - MCFG_AY3600_MATRIX_X4(IOPORT("X4")) - MCFG_AY3600_MATRIX_X5(IOPORT("X5")) - MCFG_AY3600_MATRIX_X6(IOPORT("X6")) - MCFG_AY3600_MATRIX_X7(IOPORT("X7")) - MCFG_AY3600_MATRIX_X8(IOPORT("X8")) - MCFG_AY3600_SHIFT_CB(READLINE(apple2_state, ay3600_shift_r)) - MCFG_AY3600_CONTROL_CB(READLINE(apple2_state, ay3600_control_r)) - MCFG_AY3600_DATA_READY_CB(WRITELINE(apple2_state, ay3600_iie_data_ready_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("a2speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_ES5503_ADD("es5503", APPLE2GS_7M) - MCFG_ES5503_OUTPUT_CHANNELS(2) - MCFG_ES5503_IRQ_FUNC(WRITELINE(apple2gs_state, apple2gs_doc_irq)) - MCFG_ES5503_ADC_FUNC(READ8(apple2gs_state, apple2gs_adc_read)) - - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* slot devices */ - MCFG_DEVICE_ADD("a2bus", A2BUS, 0) - MCFG_A2BUS_CPU("maincpu") - MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(apple2gs_state, a2bus_irq_w)) - MCFG_A2BUS_OUT_NMI_CB(WRITELINE(apple2gs_state, a2bus_nmi_w)) - MCFG_A2BUS_OUT_INH_CB(WRITELINE(apple2gs_state, a2bus_inh_w)) - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl0", A2BUS_LANG, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl1", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl2", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl3", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl4", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl5", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl6", apple2_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl7", apple2_cards, NULL) - - MCFG_IWM_ADD("fdc", apple2_fdc_interface) - - /* SCC */ - MCFG_DEVICE_ADD("scc", SCC8530, APPLE2GS_14M/2) - - MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(apple2gs_floppy525_floppy_interface,15,16) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(apple2gs_floppy35_floppy_interface) - - MCFG_NVRAM_ADD_0FILL("nvram") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") // 1M on board + 1M in the expansion slot was common for ROM 03 - MCFG_RAM_EXTRA_OPTIONS("1M,3M,4M,5M,6M,7M,8M") - MCFG_RAM_DEFAULT_VALUE(0x00) - - MCFG_SOFTWARE_LIST_ADD("flop35_list","apple2gs") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop525_list", "apple2") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apple2gsr1, apple2gs ) - MCFG_MACHINE_START_OVERRIDE(apple2gs_state, apple2gsr1 ) - - #if RUN_ADB_MICRO - MCFG_CPU_REPLACE(ADBMICRO_TAG, M50740, XTAL_3_579545MHz) - MCFG_M5074X_PORT0_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p0_in)) - MCFG_M5074X_PORT0_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p0_out)) - MCFG_M5074X_PORT1_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p1_in)) - MCFG_M5074X_PORT1_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p1_out)) - MCFG_M5074X_PORT2_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p2_in)) - MCFG_M5074X_PORT2_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p2_out)) - MCFG_M5074X_PORT3_READ_CALLBACK(READ8(apple2gs_state, adbmicro_p3_in)) - MCFG_M5074X_PORT3_WRITE_CALLBACK(WRITE8(apple2gs_state, adbmicro_p3_out)) - #endif - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1280K") // 256K on board + 1M in the expansion slot was common for ROM 01 - MCFG_RAM_EXTRA_OPTIONS("256K,512K,768K,1M,2M,3M,4M,5M,6M,7M,8M") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(apple2gs) - // M50740/50741 ADB MCU inside the IIgs system unit - ROM_REGION(0x1000,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) - ROM_LOAD( "341s0632-2.bin", 0x000000, 0x001000, CRC(e1c11fb0) SHA1(141d18c36a617ab9dce668445440d34354be0672) ) - - // i8048 microcontroller inside the IIgs ADB Standard Keyboard - ROM_REGION(0x400, "kmcu", 0) - // from early-production ROM 00 Woz Limited Edition IIgs. keyboard "Part Number 658-4081 825-1301-A" - // ROM is marked "NEC Japan 8626XD 341-0232A 543" so 26th week of 1986 - ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) - // from later non-Woz ROM 01. keyboard "Model A9M0330" - // ROM is marked "NEC Japan 8806HD 8048HC610 341-0124-A (c) APPLE 87" so 6th week of 1988 - ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) - - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) /* need label/part number */ - - ROM_REGION(0x40000,"maincpu",0) - ROM_LOAD("341-0737", 0x0000, 0x20000, CRC(8d410067) SHA1(c0f4704233ead14cb8e1e8a68fbd7063c56afd27)) /* Needs verification; 341-0737: IIgs ROM03 FC-FD */ - ROM_LOAD("341-0748", 0x20000, 0x20000, CRC(d4c50550) SHA1(2784cdd7ac7094b3e494409db3e72b4e6d2d9e81)) /* Needs verification; 341-0748: IIgs ROM03 FE-FF */ - - ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) - - // temporary: use IIe enhanced keyboard decode ROM - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -ROM_START(apple2gsr3p) - ROM_REGION(0x1000,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) - ROM_LOAD( "341s0632-2.bin", 0x000000, 0x001000, CRC(e1c11fb0) SHA1(141d18c36a617ab9dce668445440d34354be0672) ) - - ROM_REGION(0x400, "kmcu", 0) - ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) - ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) - - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) /* need label/part number */ - - ROM_REGION(0x40000,"maincpu",0) - ROM_LOAD("341-0728", 0x0000, 0x20000, NO_DUMP) /* 341-0728: IIgs ROM03 prototype FC-FD */ - ROM_LOAD("341-0729", 0x20000, 0x20000, NO_DUMP) /* 341-0729: IIgs ROM03 prototype FE-FF */ - - ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) - - // temporary: use IIe enhanced keyboard decode ROM - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -ROM_START(apple2gsr3lp) - ROM_REGION(0x1000,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) - ROM_LOAD( "341s0632-2.bin", 0x000000, 0x001000, CRC(e1c11fb0) SHA1(141d18c36a617ab9dce668445440d34354be0672) ) - - ROM_REGION(0x400, "kmcu", 0) - ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) - ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) - - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) /* need label/part number */ - - ROM_REGION(0x40000,"maincpu",0) - ROM_LOAD("341-0737", 0x0000, 0x20000, CRC(8d410067) SHA1(c0f4704233ead14cb8e1e8a68fbd7063c56afd27)) /* 341-0737: IIgs ROM03 FC-FD */ - ROM_LOAD("341-0749", 0x20000, 0x20000, NO_DUMP) /* 341-0749: unknown ?post? ROM03 IIgs prototype? FE-FF */ - - ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) - - // temporary: use IIe enhanced keyboard decode ROM - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -ROM_START(apple2gsr1) - ROM_REGION(0xc00,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) - ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) ) - - ROM_REGION(0x400, "kmcu", 0) - ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) - ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) - - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) /* need label/part number */ - - ROM_REGION(0x20000,"maincpu",0) - ROM_LOAD("342-0077-b", 0x0000, 0x20000, CRC(42f124b0) SHA1(e4fc7560b69d062cb2da5b1ffbe11cd1ca03cc37)) /* 342-0077-B: IIgs ROM01 */ - - ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) - - // temporary: use IIe enhanced keyboard decode ROM - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -ROM_START(apple2gsr0) - ROM_REGION(0xc00,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) - ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) ) - - ROM_REGION(0x400, "kmcu", 0) - ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) - ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) - - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) - - ROM_REGION(0x20000,"maincpu",0) - /* Should these roms really be split like this? according to the unofficial apple rom list, IIgs ROM00 was on one rom labeled 342-0077-A */ - ROM_LOAD("rom0a.bin", 0x0000, 0x8000, CRC(9cc78238) SHA1(0ea82e10720a01b68722ab7d9f66efec672a44d3)) - ROM_LOAD("rom0b.bin", 0x8000, 0x8000, CRC(8baf2a79) SHA1(91beeb11827932fe10475252d8036a63a2edbb1c)) - ROM_LOAD("rom0c.bin", 0x10000, 0x8000, CRC(94c32caa) SHA1(4806d50d676b06f5213b181693fc1585956b98bb)) - ROM_LOAD("rom0d.bin", 0x18000, 0x8000, CRC(200a15b8) SHA1(0c2890bb169ead63369738bbd5f33b869f24c42a)) - - ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) - - // temporary: use IIe enhanced keyboard decode ROM - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -ROM_START(apple2gsr0p) // 6/19/1986 Cortland prototype - ROM_REGION(0xc00,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) - ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) ) - - ROM_REGION(0x400, "kmcu", 0) - ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) - ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) - - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) - - ROM_REGION(0x20000,"maincpu",0) - ROM_LOAD( "rombf.bin", 0x000000, 0x020000, CRC(ab04fedf) SHA1(977589a17553956d583a21020080a39dd396df5c) ) - - ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) - - // temporary: use IIe enhanced keyboard decode ROM - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -ROM_START(apple2gsr0p2) // 3/10/1986 Cortland prototype, boots as "Apple //'ing - Alpha 2.0" - ROM_REGION(0xc00,M5074X_INTERNAL_ROM(ADBMICRO_TAG),0) - ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) ) - - ROM_REGION(0x400, "kmcu", 0) - ROM_LOAD( "341-0232a.bin", 0x000000, 0x000400, CRC(6a158b9f) SHA1(e8744180075182849d431fd8023a52a062a6da76) ) - ROM_LOAD( "341-0124a.bin", 0x000000, 0x000400, CRC(2a3576bf) SHA1(58fbf770d3801a02d0944039829f9241b5279013) ) - - ROM_REGION(0x1000,"gfx1",0) - ROM_LOAD ( "apple2gs.chr", 0x0000, 0x1000, CRC(91e53cd8) SHA1(34e2443e2ef960a36c047a09ed5a93f471797f89)) - - ROM_REGION(0x20000,"maincpu",0) - ROM_LOAD( "apple iigs alpha rom 2.0 19860310.bin", 0x000000, 0x020000, CRC(a47d275f) SHA1(c5836adcfc8be69c7351b84afa94c814e8d92b81) ) - - ROM_REGION(0x20000, "es5503", ROMREGION_ERASE00) - - // temporary: use IIe enhanced keyboard decode ROM - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "341-0132-d.e12", 0x000, 0x800, CRC(c506efb9) SHA1(8e14e85c645187504ec9d162b3ea614a0c421d32) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1989, apple2gs, 0, apple2, apple2gs, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03)", MACHINE_SUPPORTS_SAVE ) -COMP( 198?, apple2gsr3p, apple2gs, 0, apple2gs, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03 prototype)", MACHINE_NOT_WORKING ) -COMP( 1989, apple2gsr3lp, apple2gs, 0, apple2gs, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM03 late prototype?)", MACHINE_NOT_WORKING ) -COMP( 1987, apple2gsr1, apple2gs, 0, apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM01)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, apple2gsr0, apple2gs, 0, apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM00)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, apple2gsr0p,apple2gs, 0, apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM00 prototype 6/19/1986)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, apple2gsr0p2,apple2gs,0, apple2gsr1, apple2gs, driver_device, 0, "Apple Computer", "Apple IIgs (ROM00 prototype 3/10/1986)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/apple3.c b/src/mess/drivers/apple3.c deleted file mode 100644 index 22c27441640..00000000000 --- a/src/mess/drivers/apple3.c +++ /dev/null @@ -1,349 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,R. Belmont -/*************************************************************************** - - drivers/apple3.c - - Apple /// - - driver by Nathan Woods and R. Belmont - - Special thanks to Chris Smolinski (author of the Sara emulator) - for his input about this poorly known system. - - Also thanks to Washington Apple Pi for the "Apple III DVD" containing the - technical manual, schematics, and software. - -***************************************************************************/ - -#include "emu.h" -#include "bus/rs232/rs232.h" -#include "includes/apple3.h" -#include "includes/apple2.h" -#include "formats/ap2_dsk.h" - -#include "bus/a2bus/a2cffa.h" -#include "bus/a2bus/a2applicard.h" -#include "bus/a2bus/a2thunderclock.h" -#include "bus/a2bus/mouse.h" - -static ADDRESS_MAP_START( apple3_map, AS_PROGRAM, 8, apple3_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(apple3_memory_r, apple3_memory_w) -ADDRESS_MAP_END - -static SLOT_INTERFACE_START(apple3_cards) - SLOT_INTERFACE("cffa2", A2BUS_CFFA2_6502) /* CFFA2000 Compact Flash for Apple II (www.dreher.net), 6502 firmware */ - SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */ - SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK) /* ThunderWare ThunderClock Plus - driver assumes slot 2 by default */ - SLOT_INTERFACE("mouse", A2BUS_MOUSE) /* Apple II Mouse Card */ -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START( a3_floppies ) - SLOT_INTERFACE( "525", FLOPPY_525_SD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( apple3_state::floppy_formats ) - FLOPPY_A216S_FORMAT, FLOPPY_RWTS18_FORMAT, FLOPPY_EDD_FORMAT -FLOPPY_FORMATS_END - -static MACHINE_CONFIG_START( apple3, apple3_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 2000000) /* 2 MHz */ - MCFG_M6502_SYNC_CALLBACK(WRITELINE(apple3_state, apple3_sync_w)) - MCFG_CPU_PROGRAM_MAP(apple3_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_RESET_OVERRIDE(apple3_state, apple3 ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(280*2, 224) - MCFG_SCREEN_VISIBLE_AREA(0, (280*2)-1,0,192-1) - MCFG_SCREEN_UPDATE_DRIVER(apple3_state, screen_update_apple3) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 32) - MCFG_PALETTE_INIT_OWNER(apple3_state, apple3 ) - - MCFG_VIDEO_START_OVERRIDE(apple3_state, apple3 ) - - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple3_state, apple3_interrupt, "screen", 0, 1) - - /* keyboard controller */ - MCFG_DEVICE_ADD("ay3600", AY3600, 0) - MCFG_AY3600_MATRIX_X0(IOPORT("X0")) - MCFG_AY3600_MATRIX_X1(IOPORT("X1")) - MCFG_AY3600_MATRIX_X2(IOPORT("X2")) - MCFG_AY3600_MATRIX_X3(IOPORT("X3")) - MCFG_AY3600_MATRIX_X4(IOPORT("X4")) - MCFG_AY3600_MATRIX_X5(IOPORT("X5")) - MCFG_AY3600_MATRIX_X6(IOPORT("X6")) - MCFG_AY3600_MATRIX_X7(IOPORT("X7")) - MCFG_AY3600_MATRIX_X8(IOPORT("X8")) - MCFG_AY3600_SHIFT_CB(READLINE(apple3_state, ay3600_shift_r)) - MCFG_AY3600_CONTROL_CB(READLINE(apple3_state, ay3600_control_r)) - MCFG_AY3600_DATA_READY_CB(WRITELINE(apple3_state, ay3600_data_ready_w)) - - /* slot bus */ - MCFG_DEVICE_ADD("a2bus", A2BUS, 0) - MCFG_A2BUS_CPU("maincpu") - MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(apple3_state, a2bus_irq_w)) - MCFG_A2BUS_OUT_NMI_CB(WRITELINE(apple3_state, a2bus_nmi_w)) - //MCFG_A2BUS_OUT_INH_CB(WRITELINE(apple3_state, a2bus_inh_w)) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl1", apple3_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl2", apple3_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl3", apple3_cards, NULL) - MCFG_A2BUS_SLOT_ADD("a2bus", "sl4", apple3_cards, NULL) - - /* fdc */ - MCFG_DEVICE_ADD("fdc", APPLEIII_FDC, 1021800*2) - MCFG_FLOPPY_DRIVE_ADD("0", a3_floppies, "525", apple3_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("1", a3_floppies, "525", apple3_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("2", a3_floppies, "525", apple3_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("3", a3_floppies, "525", apple3_state::floppy_formats) - - /* softlist for fdc */ - MCFG_SOFTWARE_LIST_ADD("flop525_list","apple3") - - /* acia */ - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) // HACK: The schematic shows an external clock generator but using a XTAL is faster to emulate. - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(apple3_state, apple3_acia_irq_func)) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) - // TODO: remove cts kludge from machine/apple3.c and come up with a good way of coping with pull up resistors. - - /* paddle */ - MCFG_TIMER_DRIVER_ADD("pdltimer", apple3_state, paddle_timer); - - /* rtc */ - MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz) - - /* via */ - MCFG_DEVICE_ADD("via6522_0", VIA6522, 2000000) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(apple3_state, apple3_via_0_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(apple3_state, apple3_via_0_out_b)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(apple3_state, apple3_via_0_irq_func)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 2000000) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(apple3_state, apple3_via_1_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(apple3_state, apple3_via_1_out_b)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(apple3_state, apple3_via_1_irq_func)) - - /* sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_ADD(DAC_TAG, DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_TIMER_DRIVER_ADD_PERIODIC("c040", apple3_state, apple3_c040_tick, attotime::from_hz(2000)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_RAM_EXTRA_OPTIONS("128K, 512K") -MACHINE_CONFIG_END - - -static INPUT_PORTS_START( apple3 ) - /* - KB3600 Keyboard matrix (KB3600 has custom layout mask ROM, Apple p/n 341-0035) - - | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | - | | | | | | | | | | | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X0 | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X1 | TAB | Q | W | E | R | T | Y | U | I | O | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X2 | A | S | D | F | H | G | J | K | ;: | L | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X3 | Z | X | C | V | B | N | M | <, | >. | ?/ | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X4 | | KP9 | | KP8 | | KP7 | \| | += | 0 | -_ | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X5 | | KP6 | | KP5 | | KP4 | `~ | ]} | P | [{ | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X6 | | KP3 | KP. | KP2 | KP0 | KP1 |RETRN| UP |BACKS| '" | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X7 | | |KPENT|SPACE| | KP- |RIGHT|DOWN |LEFT | | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - */ - -/* - Esc - 0x00 - - ` 1 2 3 4 5 6 7 8 9 0 - = BACKSPACE - 0x38 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x30 0x31 0x2f 0x104 - - Tab Q W E R T Y U I O P [ ] \ - 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x3a 0x3b 0x39 0x2e - - A S D F G H J K L ; ' ENTER - 0x14 0x15 0x16 0x17 0x19 0x18 0x1a 0x1b 0x1d 0x1c 0x105 0x102 - - Z X C V B N M , . / - 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 - - SPACE UP LT DN RT KP- KP7 KP8 KP9 - 0x109 0x103 0x10e 0x10d 0x10c 0x10b 0x2d 0x2b 0x29 - - KP4 KP5 KP6 KP1 KP2 KP3 KPEN KP0 KP. - 0x37 0x35 0x33 0x101 0x3f 0x3d 0x108 0x100 0x3e -*/ - PORT_START("X0") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("X1") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("X2") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - - PORT_START("X3") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("X4") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - - PORT_START("X5") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - - PORT_START("X6") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - - PORT_START("X7") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("X8") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyb_special") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) - - PORT_START("joy_1_x") /* Joystick 1 X Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("P1 Joystick X") - PORT_MINMAX(0, 0xff) PORT_PLAYER(1) - - PORT_START("joy_1_y") /* Joystick 1 Y Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("P1 Joystick Y") - PORT_MINMAX(0,0xff) PORT_PLAYER(1) - - PORT_START("joy_2_x") /* Joystick 2 X Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("P2 Joystick X") - PORT_MINMAX(0,0xff) PORT_PLAYER(2) - - PORT_START("joy_2_y") /* Joystick 2 Y Axis */ - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_NAME("P2 Joystick Y") - PORT_MINMAX(0,0xff) PORT_PLAYER(2) - - PORT_START("joy_buttons") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_NAME("Joystick 1 Button 1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_NAME("Joystick 1 Button 2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_NAME("Joystick 2 Button 1") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) PORT_NAME("Joystick 2 Button 2") -INPUT_PORTS_END - -ROM_START(apple3) - ROM_REGION(0x1000,"maincpu",0) - ROM_LOAD( "apple3.rom", 0x0000, 0x1000, CRC(55e8eec9) SHA1(579ee4cd2b208d62915a0aa482ddc2744ff5e967)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1980, apple3, 0, 0, apple3, apple3, apple3_state, apple3, "Apple Computer", "Apple ///", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/applix.c b/src/mess/drivers/applix.c deleted file mode 100644 index 2b5097470ee..00000000000 --- a/src/mess/drivers/applix.c +++ /dev/null @@ -1,1104 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Applix 1616 computer - - See for docs: http;//www.microbee-mspp.org.au - - First revealed to the world in December 1986 issue of Electronics Today - International (ETI) an Australian electronics magazine which is now defunct. - - The main articles appeared in ETI February/March/April 1987, followed by - other articles in various issues after that. - - Current Status: - After 60 seconds, boots to the ramdisk. You can enter commands. - If you have a floppy mounted, it will boot from the disk. - - The system could support 1 or 2 5.25 or 3.5 floppy drives, although 3.5 - was the recommended hardware. Format is similar to the PC 720kb, except - it has 5 sectors of 1024 bytes, giving 800kb total. We only support the - 3.5-sized disks. - - TODO: - - Cassette interface (coded but not working) - - Use kbtro device (tried and failed) - - Optional serial device Z8530 Z80SCC - - Optional SCSI controller NCR5380 and hard drive (max 40mb) - - Joystick - - Audio: it could be better - - DAC output is used to compare against analog inputs; core doesn't permit - audio outputs to be used for non-speaker purposes. - - Bios 5 crashes mess after scrolling about half a screen - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "cpu/z80/z80.h" -#include "cpu/mcs51/mcs51.h" -#include "video/mc6845.h" -#include "machine/6522via.h" -#include "sound/dac.h" -#include "sound/wave.h" -#include "machine/wd_fdc.h" -#include "formats/applix_dsk.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" - - - -class applix_state : public driver_device -{ -public: - applix_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_base(*this, "base"), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "crtc"), - m_via(*this, "via6522"), - m_centronics(*this, "centronics"), - m_cent_data_out(*this, "cent_data_out"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_dacl(*this, "dacl"), - m_dacr(*this, "dacr"), - m_cass(*this, "cassette"), - m_io_dsw(*this, "DSW"), - m_io_fdc(*this, "FDC"), - m_io_k0f(*this, "K0f"), - m_io_k300(*this, "K30_0"), - m_io_k301(*this, "K30_1"), - m_io_k310(*this, "K31_0"), - m_io_k311(*this, "K31_1"), - m_io_k320(*this, "K32_0"), - m_io_k321(*this, "K32_1"), - m_io_k330(*this, "K33_0"), - m_io_k331(*this, "K33_1"), - m_io_k340(*this, "K34_0"), - m_io_k341(*this, "K34_1"), - m_io_k350(*this, "K35_0"), - m_io_k351(*this, "K35_1"), - m_io_k360(*this, "K36_0"), - m_io_k361(*this, "K36_1"), - m_io_k370(*this, "K37_0"), - m_io_k371(*this, "K37_1"), - m_io_k380(*this, "K38_0"), - m_io_k390(*this, "K39_0"), - m_io_k3a0(*this, "K3a_0"), - m_io_k3b0(*this, "K3b_0"), - m_io_k0b(*this, "K0b"), - m_expansion(*this, "expansion"), - m_palette(*this, "palette"){ } - - DECLARE_READ16_MEMBER(applix_inputs_r); - DECLARE_WRITE16_MEMBER(palette_w); - DECLARE_WRITE16_MEMBER(analog_latch_w); - DECLARE_WRITE16_MEMBER(dac_latch_w); - DECLARE_WRITE16_MEMBER(video_latch_w); - DECLARE_READ8_MEMBER(applix_pb_r); - DECLARE_WRITE8_MEMBER(applix_pa_w); - DECLARE_WRITE8_MEMBER(applix_pb_w); - DECLARE_WRITE_LINE_MEMBER(vsync_w); - DECLARE_READ8_MEMBER(port00_r); - DECLARE_READ8_MEMBER(port08_r); - DECLARE_READ8_MEMBER(port10_r); - DECLARE_READ8_MEMBER(port18_r); - DECLARE_READ8_MEMBER(port20_r); - DECLARE_READ8_MEMBER(port60_r); - DECLARE_WRITE8_MEMBER(port08_w); - DECLARE_WRITE8_MEMBER(port10_w); - DECLARE_WRITE8_MEMBER(port18_w); - DECLARE_WRITE8_MEMBER(port20_w); - DECLARE_WRITE8_MEMBER(port60_w); - DECLARE_READ16_MEMBER(fdc_data_r); - DECLARE_READ16_MEMBER(fdc_stat_r); - DECLARE_WRITE16_MEMBER(fdc_data_w); - DECLARE_WRITE16_MEMBER(fdc_cmd_w); - DECLARE_WRITE_LINE_MEMBER(kbd_clock_w); - DECLARE_WRITE_LINE_MEMBER(kbd_data_w); - DECLARE_FLOPPY_FORMATS(floppy_formats); - DECLARE_READ8_MEMBER( internal_data_read ); - DECLARE_WRITE8_MEMBER( internal_data_write ); - DECLARE_READ8_MEMBER( p1_read ); - DECLARE_WRITE8_MEMBER( p1_write ); - DECLARE_READ8_MEMBER( p2_read ); - DECLARE_WRITE8_MEMBER( p2_write ); - DECLARE_READ8_MEMBER( p3_read ); - DECLARE_WRITE8_MEMBER( p3_write ); - TIMER_DEVICE_CALLBACK_MEMBER(cass_timer); - DECLARE_DRIVER_INIT(applix); - MC6845_UPDATE_ROW(crtc_update_row); - UINT8 m_video_latch; - UINT8 m_pa; - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(applix); - UINT8 m_palette_latch[4]; - required_shared_ptr m_base; -private: - UINT8 m_pb; - UINT8 m_analog_latch; - UINT8 m_dac_latch; - UINT8 m_port08; - UINT8 m_data_to_fdc; - UINT8 m_data_from_fdc; - bool m_data; - bool m_data_or_cmd; - bool m_buffer_empty; - bool m_fdc_cmd; - UINT8 m_clock_count; - bool m_cp; - UINT8 m_p1; - UINT8 m_p1_data; - UINT8 m_p2; - UINT8 m_p3; - UINT16 m_last_write_addr; - UINT8 m_cass_data[4]; - int m_centronics_busy; - required_device m_maincpu; - required_device m_crtc; - required_device m_via; - required_device m_centronics; - required_device m_cent_data_out; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_dacl; - required_device m_dacr; - required_device m_cass; - required_ioport m_io_dsw; - required_ioport m_io_fdc; - required_ioport m_io_k0f; - required_ioport m_io_k300; - required_ioport m_io_k301; - required_ioport m_io_k310; - required_ioport m_io_k311; - required_ioport m_io_k320; - required_ioport m_io_k321; - required_ioport m_io_k330; - required_ioport m_io_k331; - required_ioport m_io_k340; - required_ioport m_io_k341; - required_ioport m_io_k350; - required_ioport m_io_k351; - required_ioport m_io_k360; - required_ioport m_io_k361; - required_ioport m_io_k370; - required_ioport m_io_k371; - required_ioport m_io_k380; - required_ioport m_io_k390; - required_ioport m_io_k3a0; - required_ioport m_io_k3b0; - required_ioport m_io_k0b; - required_shared_ptr m_expansion; -public: - required_device m_palette; -}; - -/* -d0,1,2 = joystick -d3 = cassette LED, low=on -d4,5,6 = audio select -d7 = cassette relay, low=on -*/ -WRITE16_MEMBER( applix_state::analog_latch_w ) -{ - data &= 0xff; - if (data != m_analog_latch) - { - m_cass->change_state( - (BIT(data,7)) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - - m_analog_latch = data; - } -} - -WRITE16_MEMBER( applix_state::dac_latch_w ) -{ - data &= 0xff; - m_dac_latch = data; - - if ((m_analog_latch & 0x70) == 0) // right - m_dacr->write_unsigned8(m_dac_latch); - else - if ((m_analog_latch & 0x70) == 0x10) // left - m_dacl->write_unsigned8(m_dac_latch); -} - -//cent = odd, video = even -WRITE16_MEMBER( applix_state::palette_w ) -{ - offset >>= 4; - if (ACCESSING_BITS_0_7) - { - m_cent_data_out->write(space, 0, data); - } - else - m_palette_latch[offset] = (data >> 8) & 15; -} - -WRITE16_MEMBER( applix_state::video_latch_w ) -{ - if (ACCESSING_BITS_0_7) - m_video_latch = data; -} - -/* -d0 = dac output + external signal = analog input -d1 = cassette in -d2,3 = joystick in -d4-7 = SW2 dipswitch block -*/ -READ16_MEMBER( applix_state::applix_inputs_r ) -{ - return m_io_dsw->read() | m_cass_data[2]; -} - -READ8_MEMBER( applix_state::applix_pb_r ) -{ - return m_pb; -} - -/* -d0 = /(in) printer busy signal -d1 = /(out) printer strobe -d2 = /(out) enable cassette write IRQ -d3 = (out) H = 640 video mode -d4 = /(out) enable cassette read IRQ -d5 = /(out) clear cass IRQ and output line -d6 = /(out) reset keyboard by pulling kbd clock low -d7 = /(out) reset keyboard flipflop -*/ -WRITE8_MEMBER( applix_state::applix_pa_w ) -{ - // Reset flipflop counter - if (!BIT(data, 7)) - m_clock_count = 0; - - // Reset keyboard - if (!BIT(data, 6)) - { - m_p3 = 0xff; - m_last_write_addr = 0; - } - m_cass->output(BIT(data, 5) ? -1.0 : +1.0); - - // high-to-low of PA5 when reading cassette - /PRE on IC32b - if (BIT(m_pa, 5) && !BIT(data, 5) && !BIT(data, 4)) - m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); - - // low-to-high of PA2 when writing cassette - /PRE on IC49 - if (!BIT(m_pa, 2) && BIT(data, 2)) - m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); - - m_centronics->write_strobe(BIT(data, 1)); - - m_pa = data; -} - -/* -d0-6 = user -d7 = square wave output for cassette IRQ -*/ -WRITE8_MEMBER( applix_state::applix_pb_w ) -{ - // low-to-high of PB7 when writing cassette - CLK on IC49 - if (!BIT(m_pb, 7) && BIT(data, 7)) - if (!BIT(m_pa, 2)) - m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); - - m_pb = data; -} - -/* -d0 = H if 68000 sent a command -d1 = H if 68000 sent a byte -d2 = H if 68000 has read last byte -d3 = test switch -*/ -READ8_MEMBER( applix_state::port00_r ) -{ - return (UINT8)m_data_or_cmd | ((UINT8)m_data << 1) | ((UINT8)m_buffer_empty << 2) | m_io_fdc->read(); -} - -/* -d0 = /RDY -d1 = /DISC CHANGE -d2 = DS0 -d3 = DS1 -d4 = MOTORON -d5 = SIDE -d6 = BANK -d7 = MAP -*/ -READ8_MEMBER( applix_state::port08_r ) -{ - return m_port08 | 3; -} - -/* -d0 = /INUSE -d1 = /EJECT -d2-7 same as for port08_r -*/ -WRITE8_MEMBER( applix_state::port08_w ) -{ - m_port08 = data; - membank("bank1")->set_entry(BIT(data, 6)); - - floppy_image_device *floppy = NULL; - if (BIT(data, 2)) floppy = m_floppy0->get_device(); - if (BIT(data, 3)) floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(BIT(data, 5)); - } -} - -READ8_MEMBER( applix_state::port10_r ) -{ - return 0; -} - -WRITE8_MEMBER( applix_state::port10_w ) -{ -} - -READ8_MEMBER( applix_state::port18_r ) -{ - m_data = 0; - return m_data_to_fdc; -} - -WRITE8_MEMBER( applix_state::port18_w ) -{ - m_data_from_fdc = data; - m_buffer_empty = 0; - m_fdc_cmd = BIT(offset, 2); -} - -READ8_MEMBER( applix_state::port20_r ) -{ - return 0; -} - -WRITE8_MEMBER( applix_state::port20_w ) -{ -} - -READ8_MEMBER( applix_state::port60_r ) -{ - return 0; -} - -WRITE8_MEMBER( applix_state::port60_w ) -{ -} - -READ16_MEMBER( applix_state::fdc_stat_r ) -{ - UINT8 data = 0; - switch (offset) - { - case 0: data = (UINT8)m_buffer_empty^1; break; - case 1: data = (UINT8)m_data^1; break; - default: data = (UINT8)m_fdc_cmd; // case 2 - } - return data << 7; -} - -READ16_MEMBER( applix_state::fdc_data_r ) -{ - m_buffer_empty = 1; - return m_data_from_fdc; -} - -WRITE16_MEMBER( applix_state::fdc_data_w ) -{ - m_data_to_fdc = data; - m_data = 1; - m_data_or_cmd = 0; -} - -WRITE16_MEMBER( applix_state::fdc_cmd_w ) -{ - m_data_to_fdc = data; - m_data = 1; - m_data_or_cmd = 1; -} - -static ADDRESS_MAP_START(applix_mem, AS_PROGRAM, 16, applix_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xffffff) - AM_RANGE(0x000000, 0x3fffff) AM_RAM AM_SHARE("expansion") // Expansion - AM_RANGE(0x400000, 0x47ffff) AM_RAM AM_MIRROR(0x80000) AM_SHARE("base") // Main ram - AM_RANGE(0x500000, 0x51ffff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x600000, 0x60007f) AM_WRITE(palette_w) - AM_RANGE(0x600080, 0x6000ff) AM_WRITE(dac_latch_w) - AM_RANGE(0x600100, 0x60017f) AM_WRITE(video_latch_w) //video latch (=border colour, high nybble; video base, low nybble) (odd) - AM_RANGE(0x600180, 0x6001ff) AM_WRITE(analog_latch_w) - //AM_RANGE(0x700000, 0x700007) z80-scc (ch b control, ch b data, ch a control, ch a data) on even addresses - AM_RANGE(0x700080, 0x7000ff) AM_READ(applix_inputs_r) - AM_RANGE(0x700100, 0x70011f) AM_MIRROR(0x60) AM_DEVREADWRITE8("via6522", via6522_device, read, write, 0xff00) - AM_RANGE(0x700180, 0x700181) AM_MIRROR(0x7c) AM_DEVREADWRITE8("crtc", mc6845_device, status_r, address_w, 0xff00) - AM_RANGE(0x700182, 0x700183) AM_MIRROR(0x7c) AM_DEVREADWRITE8("crtc", mc6845_device, register_r, register_w, 0xff00) - AM_RANGE(0xffffc0, 0xffffc1) AM_READWRITE(fdc_data_r,fdc_data_w) - //AM_RANGE(0xffffc2, 0xffffc3) AM_READWRITE(fdc_int_r,fdc_int_w) // optional - AM_RANGE(0xffffc8, 0xffffcd) AM_READ(fdc_stat_r) - AM_RANGE(0xffffd0, 0xffffd1) AM_WRITE(fdc_cmd_w) - //600000, 6FFFFF io ports and latches - //700000, 7FFFFF peripheral chips and devices - //800000, FFC000 optional roms - //FFFFC0, FFFFFF disk controller board -ADDRESS_MAP_END - -static ADDRESS_MAP_START( subcpu_mem, AS_PROGRAM, 8, applix_state ) - AM_RANGE(0x0000, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( subcpu_io, AS_IO, 8, applix_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x07) AM_READ(port00_r) //PORTR - AM_RANGE(0x08, 0x0f) AM_READWRITE(port08_r,port08_w) //Disk select - AM_RANGE(0x10, 0x17) AM_READWRITE(port10_r,port10_w) //IRQ - AM_RANGE(0x18, 0x1f) AM_READWRITE(port18_r,port18_w) //data&command - AM_RANGE(0x20, 0x27) AM_MIRROR(0x18) AM_READWRITE(port20_r,port20_w) //SCSI NCR5380 - AM_RANGE(0x40, 0x43) AM_MIRROR(0x1c) AM_DEVREADWRITE("fdc", wd1772_t, read, write) //FDC - AM_RANGE(0x60, 0x63) AM_MIRROR(0x1c) AM_READWRITE(port60_r,port60_w) //anotherZ80SCC -ADDRESS_MAP_END - -static ADDRESS_MAP_START( keytronic_pc3270_program, AS_PROGRAM, 8, applix_state ) - AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("kbdcpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( keytronic_pc3270_io, AS_IO, 8, applix_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(internal_data_read, internal_data_write) - AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(p1_read, p1_write) - AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_READWRITE(p2_read, p2_write) - AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_read, p3_write) -ADDRESS_MAP_END - -// io priorities: -// 4 cassette -// 3 scc -// 2 via - -/* Input ports */ -static INPUT_PORTS_START( applix ) - PORT_START( "K0f" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') /* 06 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') /* 05 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* 14 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* 13 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* 22 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* 21 */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 (IRMA)") /* 41 */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6a?") /* 6a */ - - PORT_START( "K30_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* 31 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* 32 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* 30 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* 2f */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* 2e */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') /* 33 */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K30_1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) /* 58 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) /* 59 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) /* 5a */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) /* 5b */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) /* 5c */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) /* 5d */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6b?") /* 6b */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 (IRMA)") /* 42 */ - - PORT_START( "K31_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') /* 07 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') /* 08 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* 15 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* 16 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* 23 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* 24 */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K31_1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) /* 37 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) /* 5f */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("LShift") /* 2a */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<") /* 70 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* 2c */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* 2d */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6c?") /* 6c */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 (IRMA)") /* 43 */ - - PORT_START( "K32_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') /* 0a */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') /* 09 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* 18 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* 17 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* 26 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* 25 */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K32_1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) /* 57 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) /* 1d */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) /* 71 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_NAME("LAlt") /* 38 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') /* 39 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_NAME("RAlt") /* 38 */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?69?") /* 69 */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 (IRMA)") /* 40 */ - - PORT_START( "K33_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("KP 2") /* 50 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) PORT_NAME("KP 1") /* 4f */ - PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Down") /* 55 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") /* 75 */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K33_1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') /* 02 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') /* 29 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* 10 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* 0f */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* 1e */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("Caps") /* 3a */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?68?") /* 68 */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 (IRMA)") /* 3f */ - - PORT_START( "K34_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') /* 35 */ - PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) /* 36 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") /* 56 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') /* 34 */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K34_1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') /* 02 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') /* 03 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* 11 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* 12 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* 1f */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* 20 */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?67?") /* 67 */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 (IRMA)") /* 3e */ - - PORT_START( "K35_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0b */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') /* 0c */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* 19 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') /* 1a */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') /* 27 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') /* 28 */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K35_1" ) - PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?66?") /* 66 */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 (IRMA)") /* 3d */ - - PORT_START( "K36_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* 0e */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') /* 0d */ - PORT_BIT( 0x14, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* 1c */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') /* 2b */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') /* 1b */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K36_1" ) - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 (IRMA)") /* 3c */ - - PORT_START( "K37_0" ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA1") /* 7b */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<--") /* 7e */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a\\") /* 7a */ - PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("KP +") /* 4e */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K37_1" ) - PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?64?") /* 64 */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 (IRMA)") /* 3b */ - - PORT_START( "K38_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SysReq") /* 54 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) /*PORT_CODE(KEYCODE_SCRLOCK)*/ PORT_NAME("ScrLock") /* 46 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-->|") /* 7c */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("KP 9") /* 49 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("KP -") /* 4a */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("KP 6") /* 4d */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "K39_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") /* 01 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_NAME("NumLock") /* 45 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) PORT_NAME("KP 7") /* 47 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_NAME("KP 8") /* 48 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("KP 4") /* 4b */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("KP 5") /* 4c */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?76?") /* 76 */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?63?") /* 63 */ - - PORT_START( "K3a_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PrtSc *") /* 6f */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA2") /* 7f */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right") /* 7d */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a") /* 79 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Center") /* 77 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6e?") /* 6e */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?62?") /* 62 */ - - PORT_START( "K3b_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("KP 3") /* 51 */ - PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("KP 0") /* 52 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("KP .") /* 53 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Up") /* 78 */ - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6d?") /* 6d */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 (IRMA)") /* 44 */ - - PORT_START( "K0b" ) - PORT_DIPNAME( 0x01, 0x01, "Protocol selection" ) - PORT_DIPSETTING( 0x00, "Enhanced XT, AT and PS/2 models" ) - PORT_DIPSETTING( 0x01, "Standard PC and XT" ) - PORT_DIPNAME( 0x02, 0x00, "IRMA/Native scan code set" ) - PORT_DIPSETTING( 0x00, "Native scan code set" ) - PORT_DIPSETTING( 0x02, "IRMA Emulation" ) - PORT_DIPNAME( 0x04, 0x04, "Enhanced 101/Native scan code set" ) - PORT_DIPSETTING( 0x00, "Native scan code set" ) - PORT_DIPSETTING( 0x04, "Enhanced 101 scan code set" ) - PORT_DIPNAME( 0x08, 0x08, "Enable E0" ) - PORT_DIPSETTING( 0x00, "Enable E0" ) - PORT_DIPSETTING( 0x08, "Disable E0" ) - PORT_DIPNAME( 0x10, 0x10, "Code tables" ) - PORT_DIPSETTING( 0x00, "U.S. code tables" ) - PORT_DIPSETTING( 0x10, "International code tables" ) - PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_DIPNAME( 0x80, 0x80, "Key click" ) - PORT_DIPSETTING( 0x00, "No key click" ) - PORT_DIPSETTING( 0x80, "Key click" ) - - PORT_START("DSW") - PORT_BIT( 0xf, 0, IPT_UNUSED ) - PORT_DIPNAME( 0x10, 0x00, "Switch 0") PORT_DIPLOCATION("SW2:1") - PORT_DIPSETTING( 0x10, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x20, 0x00, "Switch 1") PORT_DIPLOCATION("SW2:2") - PORT_DIPSETTING( 0x20, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x40, 0x00, "Switch 2") PORT_DIPLOCATION("SW2:3") - PORT_DIPSETTING( 0x40, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x80, 0x80, "Switch 3") PORT_DIPLOCATION("SW2:4") - PORT_DIPSETTING( 0x80, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - - PORT_START("FDC") - PORT_BIT( 0xf7, 0, IPT_UNUSED ) - PORT_DIPNAME( 0x08, 0x08, "FDC Test") PORT_DIPLOCATION("SW3:1") - PORT_DIPSETTING( 0x08, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) -INPUT_PORTS_END - - -void applix_state::machine_reset() -{ - UINT8* ROM = memregion("maincpu")->base(); - memcpy(m_expansion, ROM, 8); - membank("bank1")->set_entry(0); - m_p3 = 0xff; - m_last_write_addr = 0; - m_maincpu->reset(); -} - -FLOPPY_FORMATS_MEMBER( applix_state::floppy_formats ) - FLOPPY_APPLIX_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( applix_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - - -PALETTE_INIT_MEMBER(applix_state, applix) -{ // shades need to be verified - the names on the right are from the manual - const UINT8 colors[16*3] = { - 0x00, 0x00, 0x00, // 0 Black - 0x40, 0x40, 0x40, // 1 Dark Grey - 0x00, 0x00, 0x80, // 2 Dark Blue - 0x00, 0x00, 0xff, // 3 Mid Blue - 0x00, 0x80, 0x00, // 4 Dark Green - 0x00, 0xff, 0x00, // 5 Green - 0x00, 0xff, 0xff, // 6 Blue Grey - 0x00, 0x7f, 0x7f, // 7 Light Blue - 0x7f, 0x00, 0x00, // 8 Dark Red - 0xff, 0x00, 0x00, // 9 Red - 0x7f, 0x00, 0x7f, // 10 Dark Violet - 0xff, 0x00, 0xff, // 11 Violet - 0x7f, 0x7f, 0x00, // 12 Brown - 0xff, 0xff, 0x00, // 13 Yellow - 0xbf, 0xbf, 0xbf, // 14 Light Grey - 0xff, 0xff, 0xff }; // 15 White - - UINT8 r, b, g, i, color_count = 0; - - for (i = 0; i < 48; color_count++) - { - r = colors[i++]; g = colors[i++]; b = colors[i++]; - palette.set_pen_color(color_count, rgb_t(r, g, b)); - } -} - - -void applix_state::video_start() -{ -} - -MC6845_UPDATE_ROW( applix_state::crtc_update_row ) -{ -// The display is bitmapped. 2 modes are supported here, 320x200x16 and 640x200x4. -// Need to display a border colour. -// There is a monochrome mode, but no info found as yet. - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 i; - UINT16 chr,x; - UINT32 mem, vidbase = (m_video_latch & 15) << 14, *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - mem = vidbase + ma + x + (ra<<12); - chr = m_base[mem]; - - if (BIT(m_pa, 3)) - // 640 x 200 x 4of16 mode - { - for (i = 0; i < 8; i++) - { - *p++ = palette[m_palette_latch[chr>>14]]; - chr <<= 2; - } - } - else - // 320 x 200 x 16 mode - { - for (i = 0; i < 4; i++) - { - *p++ = palette[chr>>12]; - *p++ = palette[chr>>12]; - chr <<= 4; - } - } - } -} - -WRITE_LINE_MEMBER( applix_state::vsync_w ) -{ - m_via->write_ca2(state); -} - -TIMER_DEVICE_CALLBACK_MEMBER(applix_state::cass_timer) -{ - /* cassette - turn 2500/5000Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_cass_data[2] = ((m_cass_data[1] < 12) ? 2 : 0); - m_cass_data[1] = 0; - // low-to-high transition when reading cassette - CLK on IC32b - if ((cass_ws) && !BIT(m_pa, 4)) - m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); - } -} - -static MACHINE_CONFIG_START( applix, applix_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 7500000) - MCFG_CPU_PROGRAM_MAP(applix_mem) - MCFG_CPU_ADD("subcpu", Z80, XTAL_16MHz / 2) // Z80H - MCFG_CPU_PROGRAM_MAP(subcpu_mem) - MCFG_CPU_IO_MAP(subcpu_io) - MCFG_CPU_ADD("kbdcpu", I8051, 11060250) - MCFG_CPU_PROGRAM_MAP(keytronic_pc3270_program) - MCFG_CPU_IO_MAP(keytronic_pc3270_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(applix_state, applix) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("dacl", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 2.0 ) - MCFG_SOUND_ADD("dacr", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 2.0 ) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - - /* Devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", 1875000) // 6545 - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(applix_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(applix_state, vsync_w)) - - MCFG_DEVICE_ADD("via6522", VIA6522, 0) - MCFG_VIA6522_READPB_HANDLER(READ8(applix_state, applix_pb_r)) - // in CB1 kbd clk - // in CA2 vsync - // in CB2 kdb data - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(applix_state, applix_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(applix_state, applix_pb_w)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m68000_device, write_irq2)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522", via6522_device, write_ca1)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("via6522", via6522_device, write_pa0)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_WD1772_ADD("fdc", XTAL_16MHz / 2) //connected to Z80H clock pin - MCFG_FLOPPY_DRIVE_ADD("fdc:0", applix_floppies, "35dd", applix_state::floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", applix_floppies, "35dd", applix_state::floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_TIMER_DRIVER_ADD_PERIODIC("applix_c", applix_state, cass_timer, attotime::from_hz(100000)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( applix ) - ROM_REGION16_BE(0x20000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "v4.5a", "V4.5a") - ROMX_LOAD( "1616osl.45a", 0x00000, 0x10000, CRC(9dfb3224) SHA1(5223833a357f90b147f25826c01713269fc1945f), ROM_SKIP(1) | ROM_BIOS(1) ) - ROMX_LOAD( "1616osh.45a", 0x00001, 0x10000, CRC(951bd441) SHA1(e0a38c8d0d38d84955c1de3f6a7d56ce06b063f6), ROM_SKIP(1) | ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "v4.4a", "V4.4a") - ROMX_LOAD( "1616osl.44a", 0x00000, 0x10000, CRC(4a1a90d3) SHA1(4df504bbf6fc5dad76c29e9657bfa556500420a6), ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD( "1616osh.44a", 0x00001, 0x10000, CRC(ef619994) SHA1(ff16fe9e2c99a1ffc855baf89278a97a2a2e881a), ROM_SKIP(1) | ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "v4.3a", "V4.3a") - ROMX_LOAD( "1616osl.43a", 0x00000, 0x10000, CRC(c09b9ff8) SHA1(c46f2a98470d2d09cf9f9eec0f4096ab762407b5), ROM_SKIP(1) | ROM_BIOS(3) ) - ROMX_LOAD( "1616osh.43a", 0x00001, 0x10000, CRC(071a2505) SHA1(42c4cc6e3e78b6a5320f9d9c858fc9f4e6220857), ROM_SKIP(1) | ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "v4.0c", "V4.0c") - ROMX_LOAD( "1616osl.40c", 0x00000, 0x10000, CRC(6a517b5d) SHA1(e0f4eba0cb8d273ba681b9d2c6d4b1beff9ef325), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "1616osh.40c", 0x00001, 0x10000, CRC(7851651f) SHA1(d7d329aa7fe9f4418de0cdf813b61e70243e0e77), ROM_SKIP(1) | ROM_BIOS(4) ) - ROM_SYSTEM_BIOS(4, "v3.0b", "V3.0b") - ROMX_LOAD( "1616osl.30b", 0x00000, 0x10000, CRC(fb9198c3) SHA1(e0e7a1dd176c1cbed063df1c405821c261d48f3a), ROM_SKIP(1) | ROM_BIOS(5) ) - ROMX_LOAD( "1616osh.30b", 0x00001, 0x10000, CRC(a279e1d7) SHA1(3451b2cae87a9ccee5f579fd1d49cf52d9f97b83), ROM_SKIP(1) | ROM_BIOS(5) ) - ROM_SYSTEM_BIOS(5, "v2.4a", "V2.4a") - ROMX_LOAD( "1616osl.24a", 0x00000, 0x08000, CRC(b155830b) SHA1(b32db6a06c8a3c544210ba9faba7c49497c504fb), ROM_SKIP(1) | ROM_BIOS(6) ) - ROMX_LOAD( "1616osh.24a", 0x00001, 0x08000, CRC(6d9fc0e0) SHA1(07111f46386494ed3f426c1e50308f0209587f06), ROM_SKIP(1) | ROM_BIOS(6) ) - - ROM_REGION(0x18000, "subcpu", 0) - ROM_LOAD( "1616ssdv.022", 0x0000, 0x8000, CRC(6d8e413a) SHA1(fc27d92c34f231345a387b06670f36f8c1705856) ) - - ROM_REGION(0x20000, "user1", 0) - ROM_LOAD( "ssdcromv.22", 0x0000, 0x8000, CRC(c85c47fb) SHA1(6f0bb3753fc0d74ee5901d71d05a74ec6a4a1d05) ) - ROM_LOAD( "ssddromv.14a", 0x8000, 0x8000, CRC(8fe2db78) SHA1(487484003aba4d8960101ced6a689dc81676235d) ) - - ROM_REGION(0x2000, "kbdcpu", 0) - ROM_LOAD( "14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e) ) -ROM_END - - -DRIVER_INIT_MEMBER(applix_state, applix) -{ - UINT8 *RAM = memregion("subcpu")->base(); - membank("bank1")->configure_entries(0, 2, &RAM[0x8000], 0x8000); -} - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, applix, 0, 0, applix, applix, applix_state, applix, "Applix Pty Ltd", "Applix 1616", 0 ) - - - -/**************************************************** KEYBOARD MODULE *****************************************/ - -READ8_MEMBER( applix_state::internal_data_read ) -{ - m_via->write_cb2( BIT(offset, 8) ); // data - bool cp = !BIT(offset, 9); - if (cp != m_cp) - { - m_cp = cp; - if (cp) - m_clock_count++; - } - if (m_clock_count > 2) - m_via->write_cb1( cp ); - - return 0xff; -} - - -WRITE8_MEMBER( applix_state::internal_data_write ) -{ - /* Check for low->high transition on AD8 */ - if ( ! ( m_last_write_addr & 0x0100 ) && ( offset & 0x0100 ) ) - { - switch (m_p1) - { - case 0x0e: - break; - case 0x0f: - m_p1_data = m_io_k0f->read(); - break; - case 0x30: - m_p1_data = m_io_k300->read(); - break; - case 0x31: - m_p1_data = m_io_k310->read(); - break; - case 0x32: - m_p1_data = m_io_k320->read(); - break; - case 0x33: - m_p1_data = m_io_k330->read(); - break; - case 0x34: - m_p1_data = m_io_k340->read(); - break; - case 0x35: - m_p1_data = m_io_k350->read(); - break; - case 0x36: - m_p1_data = m_io_k360->read(); - break; - case 0x37: - m_p1_data = m_io_k370->read() | (m_io_k360->read() & 0x01); - break; - case 0x38: - m_p1_data = m_io_k380->read(); - break; - case 0x39: - m_p1_data = m_io_k390->read(); - break; - case 0x3a: - m_p1_data = m_io_k3a0->read(); - break; - case 0x3b: - m_p1_data = m_io_k3b0->read(); - break; - } - } - - /* Check for low->high transition on AD9 */ - if ( ! ( m_last_write_addr & 0x0200 ) && ( offset & 0x0200 ) ) - { - switch (m_p1) - { - case 0x0b: - m_p1_data = m_io_k0b->read(); - break; - case 0x30: - m_p1_data = m_io_k301->read(); - break; - case 0x31: - m_p1_data = m_io_k311->read(); - break; - case 0x32: - m_p1_data = m_io_k321->read(); - break; - case 0x33: - m_p1_data = m_io_k331->read(); - break; - case 0x34: - m_p1_data = m_io_k341->read(); - break; - case 0x35: - m_p1_data = m_io_k351->read(); - break; - case 0x36: - m_p1_data = m_io_k361->read(); - break; - case 0x37: - m_p1_data = m_io_k371->read(); - break; - case 0x38: - m_p1_data = 0xff; - break; - case 0x39: - m_p1_data = 0xff; - break; - case 0x3a: - m_p1_data = 0xff; - break; - } - } - - m_last_write_addr = offset; -} - - -READ8_MEMBER( applix_state::p1_read ) -{ - return m_p1 & m_p1_data; -} - - -WRITE8_MEMBER( applix_state::p1_write ) -{ - m_p1 = data; -} - - -READ8_MEMBER( applix_state::p2_read ) -{ - return m_p2; -} - - -WRITE8_MEMBER( applix_state::p2_write ) -{ - m_p2 = data; -} - - -READ8_MEMBER( applix_state::p3_read ) -{ - UINT8 data = m_p3; - - data &= ~0x14; - - /* -INT0 signal */ - data |= 4; - - /* T0 signal */ - data |= 0; - - return data; -} - - -WRITE8_MEMBER( applix_state::p3_write ) -{ - m_p3 = data; -} diff --git a/src/mess/drivers/apricot.c b/src/mess/drivers/apricot.c deleted file mode 100644 index 575c2672c02..00000000000 --- a/src/mess/drivers/apricot.c +++ /dev/null @@ -1,509 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - ACT Apricot PC/Xi - - - Error 29 (timer failed) - - Dump of the keyboard MCU ROM needed (can be dumped using test mode) - -***************************************************************************/ - -#include "cpu/i86/i86.h" -#include "cpu/i8089/i8089.h" -#include "machine/ram.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "machine/pic8259.h" -#include "machine/z80dart.h" -#include "machine/wd_fdc.h" -#include "video/mc6845.h" -#include "sound/sn76496.h" -#include "machine/apricotkb_hle.h" -#include "imagedev/flopdrv.h" -#include "formats/apridisk.h" -#include "bus/centronics/ctronics.h" -#include "bus/rs232/rs232.h" -#include "bus/apricot/expansion.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class apricot_state : public driver_device -{ -public: - apricot_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_cpu(*this, "ic91"), - m_iop(*this, "ic71"), - m_ram(*this, RAM_TAG), - m_crtc(*this, "ic30"), - m_ppi(*this, "ic17"), - m_pic(*this, "ic31"), - m_pit(*this, "ic16"), - m_sio(*this, "ic15"), - m_rs232(*this, "rs232"), - m_centronics(*this, "centronics"), - m_fdc(*this, "ic68"), - m_floppy0(*this, "ic68:0"), - m_floppy1(*this, "ic68:1"), - m_palette(*this, "palette"), - m_screen_buffer(*this, "screen_buffer"), - m_data_selector_dtr(1), - m_data_selector_rts(1), - m_video_mode(0), - m_display_on(1), - m_display_enabled(0), - m_centronics_fault(1), - m_centronics_perror(1), - m_bus_locked(0) - { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - DECLARE_WRITE_LINE_MEMBER(i8086_lock_w); - DECLARE_WRITE8_MEMBER(i8089_ca1_w); - DECLARE_WRITE8_MEMBER(i8089_ca2_w); - DECLARE_WRITE8_MEMBER(i8255_portb_w); - DECLARE_READ8_MEMBER(i8255_portc_r); - DECLARE_WRITE8_MEMBER(i8255_portc_w); - DECLARE_WRITE_LINE_MEMBER(timer_out1); - DECLARE_WRITE_LINE_MEMBER(timer_out2); - DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); - DECLARE_READ8_MEMBER(sio_da_r); - DECLARE_READ8_MEMBER(sio_ca_r); - DECLARE_READ8_MEMBER(sio_db_r); - DECLARE_READ8_MEMBER(sio_cb_r); - - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - - DECLARE_WRITE_LINE_MEMBER(apricot_mc6845_de) { m_display_enabled = state; }; - - DECLARE_WRITE_LINE_MEMBER(data_selector_dtr_w) { m_data_selector_dtr = state; }; - DECLARE_WRITE_LINE_MEMBER(data_selector_rts_w) { m_data_selector_rts = state; }; - - MC6845_UPDATE_ROW(crtc_update_row); - UINT32 screen_update_apricot(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -protected: - virtual void machine_start(); - -private: - required_device m_cpu; - required_device m_iop; - required_device m_ram; - required_device m_crtc; - required_device m_ppi; - required_device m_pic; - required_device m_pit; - required_device m_sio; - required_device m_rs232; - required_device m_centronics; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_palette; - required_shared_ptr m_screen_buffer; - - int m_data_selector_dtr; - int m_data_selector_rts; - - bool m_video_mode; - bool m_display_on; - - int m_display_enabled; - - int m_centronics_fault; - int m_centronics_perror; - - int m_bus_locked; -}; - - -//************************************************************************** -// I/O -//************************************************************************** - -WRITE8_MEMBER( apricot_state::i8089_ca1_w ) -{ - m_iop->sel_w(0); - m_iop->ca_w(1); - m_iop->ca_w(0); -} - -WRITE8_MEMBER( apricot_state::i8089_ca2_w ) -{ - m_iop->sel_w(1); - m_iop->ca_w(1); - m_iop->ca_w(0); -} - -WRITE_LINE_MEMBER( apricot_state::write_centronics_fault ) -{ - m_centronics_fault = state; - m_sio->syncb_w(state); - m_ppi->pc2_w(state); -} - -WRITE_LINE_MEMBER( apricot_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -READ8_MEMBER( apricot_state::i8255_portc_r ) -{ - UINT8 data = 0; - - data |= m_centronics_perror << 0; - // schematic page 294 says pc1 is centronics pin 34, which is n/c. - data |= m_centronics_fault << 2; - data |= m_display_enabled << 3; - - return data; -} - -WRITE8_MEMBER( apricot_state::i8255_portb_w ) -{ - // bit 0, crt reset - // bit 1, not connected - - m_display_on = BIT(data, 3); - m_video_mode = BIT(data, 4); - - floppy_image_device *floppy = NULL; - - // bit 5, enable disk select - // bit 6, disk select - if (!BIT(data, 5)) - floppy = BIT(data, 6) ? m_floppy1->get_device() : m_floppy0->get_device(); - - m_fdc->set_floppy(floppy); - - // bit 2, head load (motor on is wired to be active once a disk has been inserted) - // we just let the motor run all the time for now - if (floppy) - floppy->mon_w(0); - - // switch video modes - m_crtc->set_clock(m_video_mode ? XTAL_15MHz / 10 : XTAL_15MHz / 16); - m_crtc->set_hpixels_per_column(m_video_mode ? 10 : 16); - - // PB7 Centronics transceiver direction. 0 = output, 1 = input -} - -WRITE8_MEMBER( apricot_state::i8255_portc_w ) -{ -// schematic page 294 says pc4 outputs to centronics pin 13, which is the "select" output from the printer. - m_centronics->write_strobe(BIT(data, 5)); -// schematic page 294 says pc6 outputs to centronics pin 15, which is unused -} - -WRITE_LINE_MEMBER( apricot_state::timer_out1 ) -{ - // receive clock via timer 1 - if (m_data_selector_rts == 0 && m_data_selector_dtr == 0) - m_sio->rxca_w(state); -} - -WRITE_LINE_MEMBER( apricot_state::timer_out2 ) -{ - // transmit clock via timer 2 - if (m_data_selector_rts == 0 && m_data_selector_dtr == 0) - m_sio->txca_w(state); - - // transmit and receive clock via timer 2 - if (m_data_selector_rts == 1 && m_data_selector_dtr == 0) - { - m_sio->txca_w(state); - m_sio->rxca_w(state); - } -} - -READ8_MEMBER( apricot_state::sio_da_r ) -{ - if (m_bus_locked) - return m_sio->m1_r(); - - return m_sio->da_r(space, offset); -} - -READ8_MEMBER( apricot_state::sio_ca_r ) -{ - if (m_bus_locked) - return m_sio->m1_r(); - - return m_sio->ca_r(space, offset); -} - -READ8_MEMBER( apricot_state::sio_cb_r ) -{ - if (m_bus_locked) - return m_sio->m1_r(); - - return m_sio->cb_r(space, offset); -} - -READ8_MEMBER( apricot_state::sio_db_r ) -{ - if (m_bus_locked) - return m_sio->m1_r(); - - return m_sio->db_r(space, offset); -} - - -//************************************************************************** -// FLOPPY -//************************************************************************** - -WRITE_LINE_MEMBER( apricot_state::fdc_intrq_w ) -{ - m_pic->ir4_w(state); - m_iop->ext1_w(state); -} - -FLOPPY_FORMATS_MEMBER( apricot_state::floppy_formats ) - FLOPPY_APRIDISK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( apricot_floppies ) - SLOT_INTERFACE("d31v", SONY_OA_D31V) - SLOT_INTERFACE("d32w", SONY_OA_D32W) -SLOT_INTERFACE_END - - -//************************************************************************** -// VIDEO EMULATION -//************************************************************************** - -UINT32 apricot_state::screen_update_apricot(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - if (!m_display_on) - m_crtc->screen_update(screen, bitmap, cliprect); - else - bitmap.fill(rgb_t::black, cliprect); - - return 0; -} - -MC6845_UPDATE_ROW( apricot_state::crtc_update_row ) -{ - const pen_t *pen = m_palette->pens(); - - for (int i = 0; i < x_count; i++) - { - UINT16 code = m_screen_buffer[(ma + i) & 0x7ff]; - UINT16 offset = ((code & 0x7ff) << 5) | (ra << 1); - UINT16 data = m_cpu->space(AS_PROGRAM).read_word(offset); - - if (m_video_mode) - { - int fill = 0; - - if (i == cursor_x) fill = 1; // cursor? - if (BIT(code, 12) && BIT(data, 14)) fill = 1; // strike-through? - if (BIT(code, 13) && BIT(data, 15)) fill = 1; // underline? - - // draw 10 pixels of the character - for (int x = 0; x <= 10; x++) - { - int color = fill ? 1 : BIT(data, x); - if (BIT(code, 15)) color = !color; // reverse? - bitmap.pix32(y, x + i*10) = pen[color ? 1 + BIT(code, 14) : 0]; - } - } - else - { - // draw 16 pixels of the cell - for (int x = 0; x <= 16; x++) - bitmap.pix32(y, x + i*16) = pen[BIT(data, x)]; - } - } -} - -//************************************************************************** -// MACHINE EMULATION -//************************************************************************** - -void apricot_state::machine_start() -{ - membank("ram")->set_base(m_ram->pointer()); -} - -WRITE_LINE_MEMBER( apricot_state::i8086_lock_w ) -{ - m_bus_locked = state; -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -static ADDRESS_MAP_START( apricot_mem, AS_PROGRAM, 16, apricot_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAMBANK("ram") - AM_RANGE(0xf0000, 0xf0fff) AM_MIRROR(0x7000) AM_RAM AM_SHARE("screen_buffer") - AM_RANGE(0xfc000, 0xfffff) AM_MIRROR(0x4000) AM_ROM AM_REGION("bootstrap", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( apricot_io, AS_IO, 16, apricot_state ) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8("ic31", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x40, 0x47) AM_DEVREADWRITE8("ic68", wd2797_t, read, write, 0x00ff) - AM_RANGE(0x48, 0x4f) AM_DEVREADWRITE8("ic17", i8255_device, read, write, 0x00ff) - AM_RANGE(0x50, 0x51) AM_MIRROR(0x06) AM_DEVWRITE8("ic7", sn76489_device, write, 0x00ff) - AM_RANGE(0x58, 0x5f) AM_DEVREADWRITE8("ic16", pit8253_device, read, write, 0x00ff) - AM_RANGE(0x60, 0x61) AM_READ8(sio_da_r, 0x00ff) AM_DEVWRITE8("ic15", z80sio0_device, da_w, 0x00ff) - AM_RANGE(0x62, 0x63) AM_READ8(sio_ca_r, 0x00ff) AM_DEVWRITE8("ic15", z80sio0_device, ca_w, 0x00ff) - AM_RANGE(0x64, 0x65) AM_READ8(sio_db_r, 0x00ff) AM_DEVWRITE8("ic15", z80sio0_device, db_w, 0x00ff) - AM_RANGE(0x66, 0x67) AM_READ8(sio_cb_r, 0x00ff) AM_DEVWRITE8("ic15", z80sio0_device, cb_w, 0x00ff) - AM_RANGE(0x68, 0x69) AM_MIRROR(0x04) AM_DEVWRITE8("ic30", mc6845_device, address_w, 0x00ff) - AM_RANGE(0x6a, 0x6b) AM_MIRROR(0x04) AM_DEVREADWRITE8("ic30", mc6845_device, register_r, register_w, 0x00ff) - AM_RANGE(0x70, 0x71) AM_MIRROR(0x04) AM_WRITE8(i8089_ca1_w, 0x00ff) - AM_RANGE(0x72, 0x73) AM_MIRROR(0x04) AM_WRITE8(i8089_ca2_w, 0x00ff) - AM_RANGE(0x78, 0x7f) AM_NOP // unavailable -ADDRESS_MAP_END - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static MACHINE_CONFIG_START( apricot, apricot_state ) - // main cpu - MCFG_CPU_ADD("ic91", I8086, XTAL_15MHz / 3) - MCFG_CPU_PROGRAM_MAP(apricot_mem) - MCFG_CPU_IO_MAP(apricot_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("ic31", pic8259_device, inta_cb) - MCFG_I8086_LOCK_HANDLER(WRITELINE(apricot_state, i8086_lock_w)) - - // i/o cpu - MCFG_CPU_ADD("ic71", I8089, XTAL_15MHz / 3) - MCFG_CPU_PROGRAM_MAP(apricot_mem) - MCFG_CPU_IO_MAP(apricot_io) - MCFG_I8089_DATABUS_WIDTH(16) - MCFG_I8089_SINTR1(DEVWRITELINE("ic31", pic8259_device, ir0_w)) - MCFG_I8089_SINTR2(DEVWRITELINE("ic31", pic8259_device, ir1_w)) - - // ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256k") - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(800, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 800-1, 0, 400-1) - MCFG_SCREEN_REFRESH_RATE(72) - MCFG_SCREEN_UPDATE_DRIVER(apricot_state, screen_update_apricot) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - MCFG_MC6845_ADD("ic30", MC6845, "screen", XTAL_15MHz / 10) - MCFG_MC6845_INTERLACE_ADJUST(1) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(10) - MCFG_MC6845_UPDATE_ROW_CB(apricot_state, crtc_update_row) - MCFG_MC6845_OUT_DE_CB(WRITELINE(apricot_state, apricot_mc6845_de)) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ic7", SN76489, XTAL_4MHz / 2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - // devices - MCFG_DEVICE_ADD("ic17", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(apricot_state, i8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(apricot_state, i8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(apricot_state, i8255_portc_w)) - - MCFG_PIC8259_ADD("ic31", INPUTLINE("ic91", 0), VCC, NULL) - - MCFG_DEVICE_ADD("ic16", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_4MHz / 16) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("ic31", pic8259_device, ir6_w)) - MCFG_PIT8253_CLK1(XTAL_4MHz / 2) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(apricot_state, timer_out1)) - MCFG_PIT8253_CLK2(XTAL_4MHz / 2) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(apricot_state, timer_out2)) - - MCFG_Z80SIO0_ADD("ic15", XTAL_15MHz / 6, 0, 0, XTAL_4MHz / 16, XTAL_4MHz / 16) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_WRDYA_CB(DEVWRITELINE("ic71", i8089_device, drq2_w)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("keyboard", apricot_keyboard_hle_device, rxd_w)) - MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(apricot_state, data_selector_dtr_w)) - MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(apricot_state, data_selector_rts_w)) - MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE("ic31", pic8259_device, ir5_w)) - - // rs232 port - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) -// note: missing a receive clock callback to support external clock mode -// (m_data_selector_rts == 1 and m_data_selector_dtr == 0) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ic15", z80sio0_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ic15", z80sio0_device, dcda_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ic15", z80sio0_device, synca_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ic15", z80sio0_device, ctsa_w)) - - // keyboard (hle) - MCFG_APRICOT_KEYBOARD_ADD("keyboard") - MCFG_APRICOT_KEYBOARD_TXD_HANDLER(DEVWRITELINE("ic15", z80sio0_device, rxb_w)) - - // centronics printer - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("ic15", z80dart_device, ctsb_w)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("ic15", z80dart_device, dcdb_w)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(apricot_state, write_centronics_fault)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(apricot_state, write_centronics_perror)) - //MCFG_CENTRONICS_SELECT_HANDLER() // schematic page 294 says this is connected to pc4, but that is an output to the printer - - MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - // floppy - MCFG_WD2797_ADD("ic68", XTAL_4MHz / 2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(apricot_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("ic71", i8089_device, drq1_w)) - MCFG_FLOPPY_DRIVE_ADD("ic68:0", apricot_floppies, "d32w", apricot_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("ic68:1", apricot_floppies, "d32w", apricot_state::floppy_formats) - - // expansion bus - MCFG_EXPANSION_ADD("exp", "ic91") - MCFG_EXPANSION_IOP_ADD("ic71") - MCFG_EXPANSION_SLOT_ADD("exp:1", apricot_expansion_cards, NULL) - MCFG_EXPANSION_SLOT_ADD("exp:2", apricot_expansion_cards, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( apricotxi, apricot ) -MACHINE_CONFIG_END - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( apricot ) - ROM_REGION(0x4000, "bootstrap", 0) - ROM_LOAD16_BYTE("pc_bios_lo_001.bin", 0x0000, 0x2000, CRC(0c217cc2) SHA1(0d7a2b61e17966462b555115f962a175fadcf72a)) - ROM_LOAD16_BYTE("pc_bios_hi_001.bin", 0x0001, 0x2000, CRC(7c27f36c) SHA1(c801bbf904815f76ec6463e948f57e0118a26292)) -ROM_END - -ROM_START( apricotxi ) - ROM_REGION(0x4000, "bootstrap", 0) - ROM_LOAD16_BYTE("lo_ve007.u11", 0x0000, 0x2000, CRC(e74e14d1) SHA1(569133b0266ce3563b21ae36fa5727308797deee)) // LO Ve007 03.04.84 - ROM_LOAD16_BYTE("hi_ve007.u9", 0x0001, 0x2000, CRC(b04fb83e) SHA1(cc2b2392f1b4c04bb6ec8ee26f8122242c02e572)) // HI Ve007 03.04.84 -ROM_END - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1983, apricot, 0, 0, apricot, 0, driver_device, 0, "ACT", "Apricot PC", MACHINE_NOT_WORKING ) -COMP( 1984, apricotxi, apricot, 0, apricotxi, 0, driver_device, 0, "ACT", "Apricot Xi", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/apricotf.c b/src/mess/drivers/apricotf.c deleted file mode 100644 index 9ea574b7a1d..00000000000 --- a/src/mess/drivers/apricotf.c +++ /dev/null @@ -1,435 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Robbbert -/*************************************************************************** - - ACT Apricot F1 series - - preliminary driver by Angelo Salese - - -11/09/2011 - modernised. The portable doesn't seem to have - scroll registers, and it sets the palette to black. - I've added a temporary video output so that you can get - an idea of what the screen should look like. [Robbbert] - -****************************************************************************/ - -/* - - TODO: - - - CTC/SIO interrupt acknowledge - - CTC clocks - - sound - -*/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "cpu/z80/z80daisy.h" -#include "imagedev/flopdrv.h" -#include "machine/apricotkb.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "machine/wd_fdc.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "formats/apridisk.h" - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define SCREEN_TAG "screen" -#define I8086_TAG "10d" -#define Z80CTC_TAG "13d" -#define Z80SIO2_TAG "15d" -#define WD2797_TAG "5f" -#define CENTRONICS_TAG "centronics" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> f1_state - -class f1_state : public driver_device -{ -public: - f1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8086_TAG), - m_ctc(*this, Z80CTC_TAG), - m_sio(*this, Z80SIO2_TAG), - m_fdc(*this, WD2797_TAG), - m_floppy0(*this, WD2797_TAG ":0"), - m_floppy1(*this, WD2797_TAG ":1"), - m_centronics(*this, CENTRONICS_TAG), - m_cent_data_out(*this, "cent_data_out"), - m_ctc_int(CLEAR_LINE), - m_sio_int(CLEAR_LINE), - m_p_scrollram(*this, "p_scrollram"), - m_p_paletteram(*this, "p_paletteram"), - m_palette(*this, "palette") - { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - virtual void machine_start(); - - required_device m_maincpu; - required_device m_ctc; - required_device m_sio; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_centronics; - required_device m_cent_data_out; - int m_ctc_int; - int m_sio_int; - required_shared_ptr m_p_scrollram; - required_shared_ptr m_p_paletteram; - required_device m_palette; - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ16_MEMBER( palette_r ); - DECLARE_WRITE16_MEMBER( palette_w ); - DECLARE_WRITE8_MEMBER( system_w ); - DECLARE_WRITE_LINE_MEMBER( sio_int_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_int_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); - - int m_40_80; - int m_200_256; -}; - - -//************************************************************************** -// VIDEO -//************************************************************************** - -UINT32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - int lines = m_200_256 ? 200 : 256; - - for (int y = 0; y < lines; y++) - { - offs_t addr = m_p_scrollram[y] << 1; - - for (int sx = 0; sx < 80; sx++) - { - UINT16 data = program.read_word(addr); - - if (m_40_80) - { - for (int x = 0; x < 8; x++) - { - int color = (BIT(data, 15) << 1) | BIT(data, 7); - - bitmap.pix16(y, (sx * 8) + x) = color; - - data <<= 1; - } - } - else - { - for (int x = 0; x < 4; x++) - { - int color = (BIT(data, 15) << 3) | (BIT(data, 14) << 2) | (BIT(data, 7) << 1) | BIT(data, 6); - - bitmap.pix16(y, (sx * 8) + (x * 2)) = color; - bitmap.pix16(y, (sx * 8) + (x * 2) + 1) = color; - - data <<= 2; - } - } - - addr += 2; - } - } - - return 0; -} - -READ16_MEMBER( f1_state::palette_r ) -{ - return m_p_paletteram[offset]; -} - -WRITE16_MEMBER( f1_state::palette_w ) -{ - UINT8 i,r,g,b; - COMBINE_DATA(&m_p_paletteram[offset]); - - if(ACCESSING_BITS_0_7 && offset) //TODO: offset 0 looks bogus - { - i = m_p_paletteram[offset] & 1; - r = ((m_p_paletteram[offset] & 2)>>0) | i; - g = ((m_p_paletteram[offset] & 4)>>1) | i; - b = ((m_p_paletteram[offset] & 8)>>2) | i; - - m_palette->set_pen_color(offset, pal2bit(r), pal2bit(g), pal2bit(b)); - } -} - - -static const gfx_layout charset_8x8 = -{ - 8,8, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - - -static GFXDECODE_START( act_f1 ) - GFXDECODE_ENTRY( I8086_TAG, 0x0800, charset_8x8, 0, 1 ) -GFXDECODE_END - - -WRITE8_MEMBER( f1_state::system_w ) -{ - switch(offset) - { - case 0: // centronics data port - m_cent_data_out->write(space, 0, data); - break; - - case 1: // drive select - m_fdc->set_floppy(BIT(data, 0) ? m_floppy0->get_device() : m_floppy1->get_device()); - break; - - case 3: // drive head load - break; - - case 5: // drive motor on - m_floppy0->get_device()->mon_w(!BIT(data, 0)); - m_floppy1->get_device()->mon_w(!BIT(data, 0)); - break; - - case 7: // video lines (1=200, 0=256) - m_200_256 = BIT(data, 0); - break; - - case 9: // video columns (1=80, 0=40) - m_40_80 = BIT(data, 0); - break; - - case 0x0b: // LED 0 enable - break; - - case 0x0d: // LED 1 enable - break; - - case 0x0f: // centronics strobe output - m_centronics->write_strobe(!BIT(data, 0)); - break; - } -} - - -void f1_state::machine_start() -{ -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( act_f1_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( act_f1_mem, AS_PROGRAM, 16, f1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x01dff) AM_RAM - AM_RANGE(0x01e00, 0x01fff) AM_RAM AM_SHARE("p_scrollram") - AM_RANGE(0x02000, 0x3ffff) AM_RAM - AM_RANGE(0xe0000, 0xe001f) AM_READWRITE(palette_r, palette_w) AM_SHARE("p_paletteram") - AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( act_f1_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( act_f1_io, AS_IO, 16, f1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x000f) AM_WRITE8(system_w, 0xffff) - AM_RANGE(0x0010, 0x0017) AM_DEVREADWRITE8(Z80CTC_TAG, z80ctc_device, read, write, 0x00ff) - AM_RANGE(0x0020, 0x0027) AM_DEVREADWRITE8(Z80SIO2_TAG, z80sio2_device, ba_cd_r, ba_cd_w, 0x00ff) -// AM_RANGE(0x0030, 0x0031) AM_WRITE8(ctc_ack_w, 0x00ff) - AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8(WD2797_TAG, wd2797_t, read, write, 0x00ff) -// AM_RANGE(0x01e0, 0x01ff) winchester -ADDRESS_MAP_END - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( act ) -//------------------------------------------------- - -static INPUT_PORTS_START( act ) - // defined in machine/apricotkb.c -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// Z80SIO -//------------------------------------------------- - -WRITE_LINE_MEMBER( f1_state::sio_int_w ) -{ - m_sio_int = state; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_ctc_int || m_sio_int); -} - -//------------------------------------------------- -// Z80CTC -//------------------------------------------------- - -WRITE_LINE_MEMBER( f1_state::ctc_int_w ) -{ - m_ctc_int = state; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_ctc_int | m_sio_int); -} - -WRITE_LINE_MEMBER( f1_state::ctc_z1_w ) -{ - m_sio->rxcb_w(state); - m_sio->txcb_w(state); -} - -WRITE_LINE_MEMBER( f1_state::ctc_z2_w ) -{ - m_sio->txca_w(state); -} - -//------------------------------------------------- -// floppy -//------------------------------------------------- - -FLOPPY_FORMATS_MEMBER( f1_state::floppy_formats ) - FLOPPY_APRIDISK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( apricotf_floppies ) - SLOT_INTERFACE( "d31v", SONY_OA_D31V ) - SLOT_INTERFACE( "d32w", SONY_OA_D32W ) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( act_f1 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( act_f1, f1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I8086_TAG, I8086, XTAL_14MHz/4) - MCFG_CPU_PROGRAM_MAP(act_f1_mem) - MCFG_CPU_IO_MAP(act_f1_io) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(f1_state, screen_update) - MCFG_SCREEN_SIZE(640, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 256-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", act_f1) - - /* Devices */ - MCFG_DEVICE_ADD(APRICOT_KEYBOARD_TAG, APRICOT_KEYBOARD, 0) - - MCFG_Z80SIO2_ADD(Z80SIO2_TAG, 2500000, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(WRITELINE(f1_state, sio_int_w)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 2500000) - MCFG_Z80CTC_INTR_CB(WRITELINE(f1_state, ctc_int_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(f1_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(f1_state, ctc_z2_w)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(Z80SIO2_TAG, z80dart_device, ctsa_w)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - // floppy - MCFG_WD2797_ADD(WD2797_TAG, XTAL_4MHz / 2 /* ? */) - MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(I8086_TAG, INPUT_LINE_NMI)) - MCFG_WD_FDC_DRQ_CALLBACK(INPUTLINE(I8086_TAG, INPUT_LINE_TEST)) - - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", apricotf_floppies, "d32w", f1_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", apricotf_floppies, "d32w", f1_state::floppy_formats) -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( f1 ) -//------------------------------------------------- - -ROM_START( f1 ) - ROM_REGION( 0x8000, I8086_TAG, 0 ) - ROM_LOAD16_BYTE( "lo_f1_1.6.8f", 0x0000, 0x4000, CRC(be018be2) SHA1(80b97f5b2111daf112c69b3f58d1541a4ba69da0) ) // Labelled F1 - LO Vr. 1.6 - ROM_LOAD16_BYTE( "hi_f1_1.6.10f", 0x0001, 0x4000, CRC(bbba77e2) SHA1(e62bed409eb3198f4848f85fccd171cd0745c7c0) ) // Labelled F1 - HI Vr. 1.6 -ROM_END - -#define rom_f1e rom_f1 -#define rom_f2 rom_f1 - - -//------------------------------------------------- -// ROM( f10 ) -//------------------------------------------------- - -ROM_START( f10 ) - ROM_REGION( 0x8000, I8086_TAG, 0 ) - ROM_LOAD16_BYTE( "lo_f10_3.1.1.8f", 0x0000, 0x4000, CRC(bfd46ada) SHA1(0a36ef379fa9af7af9744b40c167ce6e12093485) ) // Labelled LO-FRange Vr3.1.1 - ROM_LOAD16_BYTE( "hi_f10_3.1.1.10f", 0x0001, 0x4000, CRC(67ad5b3a) SHA1(a5ececb87476a30167cf2a4eb35c03aeb6766601) ) // Labelled HI-FRange Vr3.1.1 -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1984, f1, 0, 0, act_f1, act, driver_device, 0, "ACT", "Apricot F1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1984, f1e, f1, 0, act_f1, act, driver_device, 0, "ACT", "Apricot F1e", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1984, f2, f1, 0, act_f1, act, driver_device, 0, "ACT", "Apricot F2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1985, f10, f1, 0, act_f1, act, driver_device, 0, "ACT", "Apricot F10", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/apricotp.c b/src/mess/drivers/apricotp.c deleted file mode 100644 index be9384b4c04..00000000000 --- a/src/mess/drivers/apricotp.c +++ /dev/null @@ -1,690 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese -/*************************************************************************** - - ACT Apricot FP - - preliminary driver by Angelo Salese - - -11/09/2011 - modernised. The portable doesn't seem to have - scroll registers, and it sets the palette to black. - I've added a temporary video output so that you can get - an idea of what the screen should look like. [Robbbert] - -****************************************************************************/ - -/* - - TODO: - - - devices - - LCD - - sound - -*/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "cpu/m6800/m6800.h" -#include "machine/am9517a.h" -#include "machine/apricotkb.h" -#include "bus/centronics/ctronics.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "machine/z80dart.h" -#include "sound/sn76496.h" -#include "video/mc6845.h" -#include "formats/apridisk.h" -#include "apricotp.lh" - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8086_TAG "ic7" -#define I8284_TAG "ic30" -#define I8237_TAG "ic17" -#define I8259A_TAG "ic51" -#define I8253A5_TAG "ic20" -#define TMS4500_TAG "ic42" -#define MC6845_TAG "ic69" -#define HD63B01V1_TAG "ic29" -#define AD7574_TAG "ic34" -#define AD1408_TAG "ic37" -#define Z80SIO0_TAG "ic6" -#define WD2797_TAG "ic5" -#define SN76489AN_TAG "ic13" -#define CENTRONICS_TAG "centronics" -#define SCREEN_LCD_TAG "screen0" -#define SCREEN_CRT_TAG "screen1" - -enum -{ - LED_STOP = 0, - LED_POWER, - LED_SHIFT_LOCK, - LED_DISK, - LED_VOICE, - LED_COLOUR_SELECT, - LED_CAPS_LOCK -}; - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> fp_state - -class fp_state : public driver_device -{ -public: - fp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8086_TAG), - m_soundcpu(*this, HD63B01V1_TAG), - m_dmac(*this, I8237_TAG), - m_pic(*this, I8259A_TAG), - m_pit(*this, I8253A5_TAG), - m_sio(*this, Z80SIO0_TAG), - m_fdc(*this, WD2797_TAG), - m_crtc(*this, MC6845_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, WD2797_TAG":0"), - m_floppy1(*this, WD2797_TAG":1"), - m_floppy(NULL), - m_centronics(*this, CENTRONICS_TAG), - m_work_ram(*this, "work_ram"), - m_video_ram(*this, "video_ram") - { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - required_device m_maincpu; - required_device m_soundcpu; - required_device m_dmac; - required_device m_pic; - required_device m_pit; - required_device m_sio; - required_device m_fdc; - required_device m_crtc; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - floppy_image_device *m_floppy; - required_device m_centronics; - - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - MC6845_UPDATE_ROW(update_row); - DECLARE_READ16_MEMBER( mem_r ); - DECLARE_WRITE16_MEMBER( mem_w ); - DECLARE_READ8_MEMBER( prtr_snd_r ); - DECLARE_WRITE8_MEMBER( pint_clr_w ); - DECLARE_WRITE8_MEMBER( ls_w ); - DECLARE_WRITE8_MEMBER( contrast_w ); - DECLARE_WRITE8_MEMBER( palette_w ); - DECLARE_WRITE16_MEMBER( video_w ); - DECLARE_WRITE8_MEMBER( lat_w ); - - void lat_ls259_w(offs_t offset, int state); - - optional_shared_ptr m_work_ram; - - // video state - optional_shared_ptr m_video_ram; - UINT8 m_video; - - int m_centronics_busy; - int m_centronics_select; - int m_centronics_fault; - int m_centronics_perror; - - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_fault ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_perror ); -}; - - -//************************************************************************** -// VIDEO -//************************************************************************** - -void fp_state::video_start() -{ - // allocate memory - m_video_ram.allocate(0x20000); -} - -MC6845_UPDATE_ROW( fp_state::update_row ) -{ -} - -UINT32 fp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - offs_t addr = (!BIT(m_video, 4) << 15) | (BIT(m_video, 1) << 14); - - for (int y = 0; y < 200; y++) - { - for (int sx = 0; sx < 40; sx++) - { - UINT16 data = m_video_ram[addr++]; - - for (int x = 0; x < 16; x++) - { - int color = BIT(data, 15); - - bitmap.pix16(y, (sx * 16) + x) = color; - - data <<= 1; - } - } - } - - return 0; -} - - -static const gfx_layout charset_8x8 = -{ - 8,8, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - - -static GFXDECODE_START( act_f1 ) - GFXDECODE_ENTRY( I8086_TAG, 0x0800, charset_8x8, 0, 1 ) -GFXDECODE_END - - -READ8_MEMBER( fp_state::prtr_snd_r ) -{ - /* - - bit description - - 0 BUSY - 1 SE - 2 _FAULT - 3 PE - 4 LP23 - 5 DCNG-L - 6 J9 1-2 - 7 J9 3-4 - - */ - - UINT8 data = 0; - - // centronics - data |= m_centronics_busy; - data |= m_centronics_select << 1; - data |= m_centronics_fault << 2; - data |= m_centronics_perror << 3; - - // floppy - data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 5; - - return data; -} - -WRITE8_MEMBER( fp_state::pint_clr_w ) -{ - m_pic->ir6_w(CLEAR_LINE); -} - - -WRITE8_MEMBER( fp_state::ls_w ) -{ - m_centronics->write_strobe(!BIT(data, 0)); -} - - -WRITE8_MEMBER( fp_state::contrast_w ) -{ -} - - -WRITE8_MEMBER( fp_state::palette_w ) -{ - /* - - bit description - - 0 B - 1 G - 2 R - 3 I - 4 index - 5 index - 6 index - 7 index - - */ -} - - -WRITE16_MEMBER( fp_state::video_w ) -{ - /* - - bit description - - 0 CRTRES-H - 1 SEL1 - 2 DON-H - 3 LCDON-H - 4 SEL2 - 5 L3 even access - 6 L2 odd access - 7 L1 video RAM enable - 8 - 9 STOP LED - 10 POWER LED - 11 SHIFT LOCK LED - 12 DISK LED - 13 VOICE LED - 14 COLOUR SELECT LED - 15 CAPS LOCK LED - - */ - - m_video = data & 0xff; -} - -void fp_state::lat_ls259_w(offs_t offset, int state) -{ - switch (offset) - { - case 0: - { - m_floppy = NULL; - - if (state) m_floppy = m_floppy0->get_device(); - else m_floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) - m_floppy->mon_w(0); - } - break; - } -} - -WRITE8_MEMBER( fp_state::lat_w ) -{ - lat_ls259_w((offset >> 1) & 0x07, BIT(data, 0)); -} - - -READ16_MEMBER( fp_state::mem_r ) -{ - UINT16 data = 0xffff; - - if (offset >= 0xd0000/2 && offset < 0xf0000/2) - { - if (BIT(m_video, 7)) - { - data = m_video_ram[offset - 0xd0000/2]; - } - else - { - if (offset < m_ram->size()/2) - { - data = m_work_ram[offset]; - } - } - } - else - { - if (offset < m_ram->size()/2) - { - data = m_work_ram[offset]; - } - } - - return data; -} - - -WRITE16_MEMBER( fp_state::mem_w ) -{ - if (offset >= 0xd0000/2 && offset < 0xe0000/2) - { - if (BIT(m_video, 7)) - { - m_video_ram[offset - 0xd0000/2] = data; - } - else - { - if (offset < m_ram->size()/2) - { - m_work_ram[offset] = data; - } - } - } - else if (offset >= 0xe0000/2 && offset < 0xf0000/2) - { - if (BIT(m_video, 7)) - { - if (BIT(m_video, 5)) - { - m_video_ram[offset - 0xd0000/2] = (data & 0xff00) | (m_video_ram[offset - 0xd0000/2] & 0x00ff); - } - - if (BIT(m_video, 6)) - { - m_video_ram[offset - 0xd0000/2] = (data & 0x00ff) | (m_video_ram[offset - 0xd0000/2] & 0xff00); - } - } - else - { - if (offset < m_ram->size()/2) - { - m_work_ram[offset] = data; - } - } - } - else - { - if (offset < m_ram->size()/2) - { - m_work_ram[offset] = data; - } - } -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( fp_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( fp_mem, AS_PROGRAM, 16, fp_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0xf7fff) AM_READWRITE(mem_r, mem_w) - AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( fp_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( fp_io, AS_IO, 16, fp_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000, 0x007) AM_DEVREADWRITE8(WD2797_TAG, wd2797_t, read, write, 0x00ff) - AM_RANGE(0x008, 0x00f) AM_DEVREADWRITE8(I8253A5_TAG, pit8253_device, read, write, 0x00ff) - AM_RANGE(0x018, 0x01f) AM_DEVREADWRITE8(Z80SIO0_TAG, z80sio0_device, ba_cd_r, ba_cd_w, 0x00ff) - AM_RANGE(0x020, 0x021) AM_DEVWRITE8("cent_data_out", output_latch_device, write, 0x00ff) - AM_RANGE(0x022, 0x023) AM_WRITE8(pint_clr_w, 0x00ff) - AM_RANGE(0x024, 0x025) AM_READ8(prtr_snd_r, 0x00ff) - AM_RANGE(0x026, 0x027) AM_DEVWRITE8(SN76489AN_TAG, sn76489a_device, write, 0x00ff) - AM_RANGE(0x028, 0x029) AM_WRITE8(contrast_w, 0x00ff) - AM_RANGE(0x02a, 0x02b) AM_WRITE8(palette_w, 0x00ff) - AM_RANGE(0x02e, 0x02f) AM_WRITE(video_w) - AM_RANGE(0x040, 0x05f) AM_DEVREADWRITE8(I8237_TAG, am9517a_device, read, write, 0x00ff) - AM_RANGE(0x068, 0x06b) AM_DEVREADWRITE8(I8259A_TAG, pic8259_device, read, write, 0x00ff) - AM_RANGE(0x06c, 0x06d) AM_DEVWRITE8(MC6845_TAG, mc6845_device, address_w, 0x00ff) - AM_RANGE(0x06e, 0x06f) AM_DEVREADWRITE8(MC6845_TAG, mc6845_device, register_r, register_w, 0x00ff) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( sound_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( sound_mem, AS_PROGRAM, 8, fp_state ) - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD63B01V1_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( sound_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( sound_io, AS_IO, 8, fp_state ) - AM_RANGE(M6801_PORT1, M6801_PORT1) - AM_RANGE(M6801_PORT2, M6801_PORT2) - AM_RANGE(M6801_PORT3, M6801_PORT3) - AM_RANGE(M6801_PORT4, M6801_PORT4) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( act ) -//------------------------------------------------- - -static INPUT_PORTS_START( fp ) - // defined in machine/apricotkb.c -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// pic8259_interface pic_intf -//------------------------------------------------- - -/* - - INT0 TIMER - INT1 FDC - INT2 6301 - INT3 COMS - INT4 USART - INT5 COMS - INT6 PRINT - INT7 EOP - -*/ - -WRITE_LINE_MEMBER( fp_state::write_centronics_busy ) -{ - m_centronics_busy = state; - if (!state) m_pic->ir6_w(ASSERT_LINE); -} - -WRITE_LINE_MEMBER( fp_state::write_centronics_select ) -{ - m_centronics_select = state; -} - -WRITE_LINE_MEMBER( fp_state::write_centronics_fault ) -{ - m_centronics_fault = state; -} - -WRITE_LINE_MEMBER( fp_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( fp ) -//------------------------------------------------- - -void fp_state::machine_start() -{ - // allocate memory - m_work_ram.allocate(m_ram->size() / 2); -} - - -void fp_state::machine_reset() -{ - m_video = 0; - - m_fdc->dden_w(0); - - for (offs_t offset = 0; offset < 7; offset++) - { - lat_ls259_w(offset, 0); - } -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -FLOPPY_FORMATS_MEMBER( fp_state::floppy_formats ) - FLOPPY_APRIDISK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( fp_floppies ) - SLOT_INTERFACE("d32w", SONY_OA_D32W) -SLOT_INTERFACE_END - - -//------------------------------------------------- -// MACHINE_CONFIG( fp ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( fp, fp_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I8086_TAG, I8086, XTAL_15MHz/3) - MCFG_CPU_PROGRAM_MAP(fp_mem) - MCFG_CPU_IO_MAP(fp_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A_TAG, pic8259_device, inta_cb) - - MCFG_CPU_ADD(HD63B01V1_TAG, HD6301, 2000000) - MCFG_CPU_PROGRAM_MAP(sound_mem) - MCFG_CPU_IO_MAP(sound_io) - MCFG_DEVICE_DISABLE() - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_apricotp ) - - MCFG_SCREEN_ADD(SCREEN_LCD_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(fp_state, screen_update) - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_SCREEN_ADD(SCREEN_CRT_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) - MCFG_SCREEN_SIZE(640, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 256-1) - - MCFG_PALETTE_ADD("palette", 16) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", act_f1) - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_CRT_TAG, 4000000) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(fp_state, update_row) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, 2000000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* Devices */ - MCFG_DEVICE_ADD(APRICOT_KEYBOARD_TAG, APRICOT_KEYBOARD, 0) - MCFG_DEVICE_ADD(I8237_TAG, AM9517A, 250000) - MCFG_I8237_OUT_EOP_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir7_w)) - MCFG_I8237_IN_IOR_1_CB(DEVREAD8(WD2797_TAG, wd_fdc_t, data_r)) - MCFG_I8237_OUT_IOW_1_CB(DEVWRITE8(WD2797_TAG, wd_fdc_t, data_w)) - MCFG_PIC8259_ADD(I8259A_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL) - - MCFG_DEVICE_ADD(I8253A5_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(2000000) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259A_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_CLK2(2000000) - - MCFG_Z80SIO0_ADD(Z80SIO0_TAG, 2500000, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir4_w)) - - MCFG_WD2797_ADD(WD2797_TAG, 2000000) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir1_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq1_w)) - - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", fp_floppies, "d32w", fp_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", fp_floppies, NULL, fp_state::floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fp_state, write_centronics_busy)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(fp_state, write_centronics_select)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fp_state, write_centronics_fault)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fp_state, write_centronics_perror)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_RAM_EXTRA_OPTIONS("512K,1M") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( fp ) -//------------------------------------------------- - -ROM_START( fp ) - ROM_REGION( 0x8000, I8086_TAG, 0 ) - ROM_LOAD16_BYTE( "lo_fp_3.1.ic20", 0x0000, 0x4000, CRC(0572add2) SHA1(c7ab0e5ced477802e37f9232b5673f276b8f5623) ) // Labelled 11212721 F97E PORT LO VR 3.1 - ROM_LOAD16_BYTE( "hi_fp_3.1.ic9", 0x0001, 0x4000, CRC(3903674b) SHA1(8418682dcc0c52416d7d851760fea44a3cf2f914) ) // Labelled 11212721 BD2D PORT HI VR 3.1 - - ROM_REGION( 0x1000, HD63B01V1_TAG, 0 ) - ROM_LOAD( "voice interface hd63b01v01.ic29", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x100, "proms", 0 ) - ROM_LOAD( "tbp24s10.ic73", 0x000, 0x100, NO_DUMP ) // address decoder 256x4 - - ROM_REGION( 0x100, "plds", 0 ) - ROM_LOAD( "pal1 pal12l6.ic2", 0x000, 0x100, NO_DUMP ) // ? - ROM_LOAD( "pal2 pal10l8.ic35", 0x000, 0x100, NO_DUMP ) // address decoder - ROM_LOAD( "pal3 pal12l6.ic77", 0x000, 0x100, NO_DUMP ) // ? -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1984, fp, 0, 0, fp, fp, driver_device, 0, "ACT", "Apricot Portable / FP", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/aquarius.c b/src/mess/drivers/aquarius.c deleted file mode 100644 index 84df8234eac..00000000000 --- a/src/mess/drivers/aquarius.c +++ /dev/null @@ -1,420 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - Mattel Aquarius - - - TODO: - - - slot interface for cartridges - - hand controllers - - scramble RAM also - - CAQ tape support - - memory mapper - - proper video timings - - PAL mode - - floppy support (I/O 0xe6-0xe7 = drive 1, 0xea-0xeb = drive 2) - - modem - - "old" version of BASIC ROM - - Aquarius II - -***************************************************************************/ - -#include "includes/aquarius.h" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define XTAL1 8866000 -#define XTAL2 XTAL_7_15909MHz - - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - - - -/*************************************************************************** - READ/WRITE HANDLERS -***************************************************************************/ - -/* - To read stored data from cassette the program should look at bit zero of - the cassette input port and measure the time difference between leading - edges or trailing edges. This is to prevent DC level shifting from altering - pulse width of data. The program should then look for sync bytes for data - synchronisation before data block transfer. If there is any task that must - be performed during cassette loading, the maximum allowable time to do the - job after one byte from cassette, must be less than 80% of the period of a - mark cycle. Control must be returned at that time to the cassette routine - in order to maintain data integrity. -*/ -READ8_MEMBER(aquarius_state::cassette_r) -{ - return ((m_cassette)->input() < +0.0) ? 0 : 1; -} - - -/* - Sound and cassette port use a common pin. Therefore the signal to cassette - will appear on audio output. Sound port is a simple one bit I/O and therefore - it must be toggled at a specific rate under software control. -*/ -WRITE8_MEMBER(aquarius_state::cassette_w) -{ - m_speaker->level_w(BIT(data, 0)); - m_cassette->output(BIT(data, 0) ? +1.0 : -1.0); -} - - -/* - The current state of the vertical sync will appear on bit 0 during a read of - this port. The waveform and timing spec is shown as follows: - - |<- Active scan period ->|V.sync |<- - | 12.8 ms |3.6 ms (PAL) - | |2.8 ms (NTSC) - +++++++++++++++++++++++++++++++ ++++++++++++ - + + + - + + + - +++++ +++++++++ -*/ -READ8_MEMBER(aquarius_state::vsync_r) -{ - return m_screen->vblank() ? 0 : 1; -} - - -/* - Bit D0 of this port controls the swapping of the lower 16K block in the memory - map with the upper 16K. A 1 in this bit indicates swapping. This bit is reset - after power up initialization. -*/ -WRITE8_MEMBER(aquarius_state::mapper_w) -{ -} - - -/* - Printer handshaking port (read) Port 0xFE when read, presents the clear - to send status from PRNHASK pin at bit D0. A 1 indicates printer is ready, - 0 means not ready. -*/ -READ8_MEMBER(aquarius_state::printer_r) -{ - return 1; /* ready */ -} - - -/* - This is a single bit I/O at D0, it will perform as a serial output - port under software control. Since timing is done by software the - baudrate is variable. In BASIC this is a 1200 baud printer port for - the 40 column thermal printer. -*/ -WRITE8_MEMBER(aquarius_state::printer_w) -{ -} - - -/* - This port is 6 bits wide, when read, it returns the row data from the - keyboard matrix. The keyboard is usually scanned in the following manner: - - The keyboard is a 6 row by 8 column matrix. The column is connected to - the higher order address bus A15-A8. When Z80 executes its input - instruction sets, either the current content of the accumulator (A) or - the content of register (B) will go to the higher order address bus. - Therefore the keyboard can be scanned by placing a specific scanning - pattern in (A) or (B) and reading the result returned on rows. -*/ -READ8_MEMBER(aquarius_state::keyboard_r) -{ - UINT8 result = 0xff; - - if (!BIT(offset, 8)) result &= m_y0->read(); - if (!BIT(offset, 9)) result &= m_y1->read(); - if (!BIT(offset, 10)) result &= m_y2->read(); - if (!BIT(offset, 11)) result &= m_y3->read(); - if (!BIT(offset, 12)) result &= m_y4->read(); - if (!BIT(offset, 13)) result &= m_y5->read(); - if (!BIT(offset, 14)) result &= m_y6->read(); - if (!BIT(offset, 15)) result &= m_y7->read(); - - return result; -} - - -/* - Software lock: Writing this port with an 8 bit value will set the software - scrambler pattern. The data that appears on the output side will be the - result of the input bus EX-ORed with this pattern, bit by bit. The software - lock is a scrambler built between the CPU and external interface. The - scrambling pattern is contained in port 0xFF and is not readable. CPU data - output to external bus will be XORed with this pattern in a bit by bit - fashion to generate the real data on external bus. By the same mechanism, - data from external bus is also XORed with this pattern and read by CPU. - - Therefore it the external device is RAM, the software lock simply has no - effect as long as the scrambling pattern remains unchanged. For I/O - operation the pattern is gated to 0 and thus scrambling action is nullified. - - In BASIC operation the scrambling pattern is generated by a random number - routine. For game cartridge the lock pattern is generated from data in the - game cartridge itself. -*/ -WRITE8_MEMBER(aquarius_state::scrambler_w) -{ - m_scrambler = data; -} - -READ8_MEMBER(aquarius_state::cartridge_r) -{ - UINT8 data = 0; - if (m_cart->exists()) - data = m_cart->read_rom(space, offset); - - return data ^ m_scrambler; -} - - -/*************************************************************************** - DRIVER INIT -***************************************************************************/ - -DRIVER_INIT_MEMBER(aquarius_state,aquarius) -{ - /* install expansion memory if available */ - if (m_ram->size() > 0x1000) - { - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.install_readwrite_bank(0x4000, 0x4000 + m_ram->size() - 0x1000 - 1, "bank1"); - membank("bank1")->set_base(m_ram->pointer()); - } -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( aquarius_mem, AS_PROGRAM, 8, aquarius_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x3000, 0x33ff) AM_RAM_WRITE(aquarius_videoram_w) AM_SHARE("videoram") - AM_RANGE(0x3400, 0x37ff) AM_RAM_WRITE(aquarius_colorram_w) AM_SHARE("colorram") - AM_RANGE(0x3800, 0x3fff) AM_RAM - AM_RANGE(0x4000, 0xbfff) AM_NOP /* expansion ram */ - AM_RANGE(0xc000, 0xffff) AM_READ(cartridge_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( aquarius_io, AS_IO, 8, aquarius_state ) -// AM_RANGE(0x7e, 0x7f) AM_MIRROR(0xff00) AM_READWRITE(modem_r, modem_w) - AM_RANGE(0xf6, 0xf6) AM_MIRROR(0xff00) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) - AM_RANGE(0xf7, 0xf7) AM_MIRROR(0xff00) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0xfc, 0xfc) AM_MIRROR(0xff00) AM_READWRITE(cassette_r, cassette_w) - AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_READWRITE(vsync_r, mapper_w) - AM_RANGE(0xfe, 0xfe) AM_MIRROR(0xff00) AM_READWRITE(printer_r, printer_w) - AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_READWRITE(keyboard_r, scrambler_w) -ADDRESS_MAP_END - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/* the 'reset' key is directly tied to the reset line of the cpu */ -INPUT_CHANGED_MEMBER(aquarius_state::aquarius_reset) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -static INPUT_PORTS_START( aquarius ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= +\tNEXT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90 \\") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR('\\') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": *\tPEEK") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RTN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; @\tPOKE") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". >\tVAL") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _\tFOR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ^") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('/') PORT_CHAR('^') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 ?") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('?') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(16) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L\tPOINT") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(12) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", <\tSTR$") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 )\tCOPY") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(15) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K\tPRESET") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(11) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(13) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N\tRIGHT$") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(14) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J\tPSET") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(10) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 (\tRETURN") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(9) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 '\tGOSUB") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(21) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(8) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B\tMID$") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(2) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 &\tON") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(25) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G\tBELL") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(7) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V\tLEFT$") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(22) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C\tSTOP") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(3) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F\tDATA") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(6) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 %\tGOTO") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T\tINPUT") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(20) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $\tTHEN") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R\tRETYP") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(18) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D\tREAD") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(4) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X\tDELINE") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(24) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 #\tIF") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E\tDIM") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(5) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S\tSTPLST") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(19) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z\tCLOAD") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(26) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE\tCHR$") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A\tCSAVE") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(1) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 \"\tLIST") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W\tREM") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(23) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 !\tRUN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(17) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("RESET") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_state, aquarius_reset, 0) - - PORT_START("LEFT") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("RIGHT") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) -INPUT_PORTS_END - - -/*************************************************************************** - CHARACTER LAYOUT -***************************************************************************/ - -static const gfx_layout aquarius_charlayout = -{ - 8, 8, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, }, - 8 * 8 -}; - -/* Graphics Decode Information */ - -static GFXDECODE_START( aquarius ) - GFXDECODE_ENTRY( "gfx1", 0x0000, aquarius_charlayout, 0, 256 ) -GFXDECODE_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static MACHINE_CONFIG_START( aquarius, aquarius_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz) // ??? - MCFG_CPU_PROGRAM_MAP(aquarius_mem) - MCFG_CPU_IO_MAP(aquarius_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", aquarius_state, irq0_line_hold) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2800)) - MCFG_SCREEN_SIZE(40 * 8, 25 * 8) - MCFG_SCREEN_VISIBLE_AREA(0, 40 * 8 - 1, 0 * 8, 25 * 8 - 1) - MCFG_SCREEN_UPDATE_DRIVER(aquarius_state, screen_update_aquarius) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", aquarius ) - MCFG_TEA1002_ADD("encoder", XTAL_8_867238MHz) - MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_INDIRECT_ENTRIES(16) - MCFG_PALETTE_INIT_OWNER(aquarius_state, aquarius) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_3_579545MHz/2) // ??? AY-3-8914 - MCFG_AY8910_PORT_A_READ_CB(IOPORT("RIGHT")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("LEFT")) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "aquarius_cart") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("8K,20K,36K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","aquarius") -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( aquarius ) - ROM_REGION(0x10000, "maincpu", 0) - - /* basic rom */ - ROM_DEFAULT_BIOS("rev2") - ROM_SYSTEM_BIOS(0, "rev1", "Revision 1") - ROMX_LOAD("aq1.u2", 0x0000, 0x2000, NO_DUMP, ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "rev2", "Revision 2") - ROMX_LOAD("aq2.u2", 0x0000, 0x2000, CRC(a2d15bcf) SHA1(ca6ef55e9ead41453efbf5062d6a60285e9661a6), ROM_BIOS(2)) - - /* charrom */ - ROM_REGION(0x800, "gfx1", 0) - ROM_LOAD("aq2.u5", 0x000, 0x800, CRC(e117f57c) SHA1(3588c0267c67dfbbda615bcf8dc3d3a5c5bd815a)) -ROM_END - - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, aquarius, 0, 0, aquarius, aquarius, aquarius_state, aquarius, "Mattel", "Aquarius (NTSC)", 0 ) -//COMP( 1984, aquariu2, aquarius, 0, aquarius, aquarius, driver_device, 0, "Mattel", "Aquarius II", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/arcadia.c b/src/mess/drivers/arcadia.c deleted file mode 100644 index c6eb8bd58d2..00000000000 --- a/src/mess/drivers/arcadia.c +++ /dev/null @@ -1,842 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** -Consolidation and enhancement of documentation by Manfred Schneider based on previous work from - PeT mess@utanet.at and Paul Robson (autismuk@aol.com) minor updates by incog - - Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/ - - TODO: implement the RESET key on the front panel - find a dump of the character ROM - convert the drawing code to tilemap - - - 1. General - SYSTEM -- Signetics 2650 CPU at 3.58/4 MHz(for NTSC) or at 4,433/5 (for PAL) -- 1k x 8 of RAM (physically present but only 512 byte available) -- 2 x 2 axis Analogue Joysticks -- 2 x 12 button Controllers -- 3 buttons on system unit and CPU Reset - VIDEO -- 128 x 208 pixel resolution (alternate 128 x 104 mode available) -- 16 x 26 (can be 16x13) background display (2 colour 8 x 8 pixel characters) -- 4 x 8 x 8 Sprites (2 colour 8 x 8 pixels) -- total of 8 user defined characters available - SOUND -- Single channel beeper - - -2. Memory map -The memory map of the 2001 is below. -0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) -1000 - 13FF mirror of $1800-$1BFF -1400 - 17FF mirror of $1800-$1BFF -1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) - 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits - 18D0 - 18EF Free for user programs. - 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 - 18F8 - 1908 registers of UVI - 1909 - 197F Unmapped - 1980 - 19BF User defined characters (8 possible, 8 bytes per character) - 19C0 - 19F7 Unmapped - 19F8 - 19FF registers of UVI - 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits - 1AD0 - 1AFF User memory - 1B00 - 1BFF mirror of 1900-19FF -1C00 - 1FFF mirror of 1800-1BFF -2000 - 2FFF 4k ROM Block 2 (for 8k carts such as Jungler) -3000 - 3FFF mirror of 1000-1FFF -4000 - 4FFF mirror of 0000-0FFF -5000 - 5FFF mirror of 1000-1FFF -6000 - 6FFF mirror of 0000-0FFF -7000 - 7FFF mirror of 1000-1FFF - -The Palladium VCG memory map is as follows. -0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) -1000 - 17FF could be ROM or RAM but no Cartridge uses this -1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) - 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits - 18D0 - 18EF Free for user programs. - 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 - 18F8 - 1908 registers of UVI - 1909 - 197F Unmapped - 1980 - 19BF User defined characters (8 possible, 8 bytes per character) - 19C0 - 19F7 Unmapped - 19F8 - 19FF registers of UVI - 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits - 1AD0 - 1AFF User memory - 1B00 - 1BFF mirror of 1900-19FF -1C00 - 1FFF could be ROM or RAM but no Cartridge uses this -2000 - 2FFF 4k ROM Block (for 8k carts such as Jungler) -3000 - 3FFF could be ROM or RAM but no Cartridge uses this -4000 - 4FFF 4k ROM Block (first 2K used by Golf) -5000 - 5FFF 4k ROM Block -6000 - 6FFF 4k ROM Block -7000 - 7FFF 4k ROM Block - - -3. ROM Images -ROM Images are loaded into 0000-0FFF. If the ROM is an 8k ROM the -second half of the Rom is located at 2000-2FFF. Except for the Golf cart -which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on -Palladium VCG. - - -4. Controls -All key controls are indicated by a bit going to '1'. Unused bits at -the memory location are set to zero. - -Keypads - -1900-1902 (Player 1) 1904-1906 (Player 2) -The keypads are arranged as follows :- - - 1 2 3 - 4 5 6 - 7 8 9 - Enter 0 Clear - -Row 1/4/7 is 1900/4, Row 2/5/8/0 is 1901/5 and Row 3/6/9 is 1902/6 -The topmost key is bit 3, the lowermost key is bit 0. - -Location $1908 contains bit 0 Start,bit 1 Option,bit 2 Difficulty. -These keys are "latched" i.e. a press causes a logic 1 to appear -on the current frame. - -The fire buttons are equivalent to Keypad #2 e.g. they are 1901 and -1905 bit 3. - -Palladium has 4 additional key per keypad which are mapped at -1903 palladium player 1 -1907 palladium player 2 - - -5. Other information -Interrupts are not supported -The Read/Write 2650 CPU Port-Commands do not appear to be connected to -anything in hardware. No cartridge has been found which uses them. - -******************************************************************************/ - -#include "includes/arcadia.h" - -static ADDRESS_MAP_START( arcadia_mem, AS_PROGRAM, 8, arcadia_state ) - AM_RANGE( 0x0000, 0x0fff) AM_DEVREAD("cartslot", arcadia_cart_slot_device, read_rom) - AM_RANGE( 0x1800, 0x1aff) AM_READWRITE(video_r, video_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( arcadia_io, AS_IO, 8, arcadia_state ) - AM_RANGE( S2650_SENSE_PORT,S2650_SENSE_PORT) AM_READ(vsync_r) -ADDRESS_MAP_END - -/* The Emerson Arcadia 2001 controllers have 2 fire buttons on the side, - but actually they are wired to keypad button #2. The following definitions - are meant to document this fact. The keypad has the following layout: - - 1 2 3 - 4 5 6 - 7 8 9 - Cl 0 En */ - -static INPUT_PORTS_START( arcadia ) - PORT_START("panel") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Option") PORT_CODE(KEYCODE_O) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Select") -// PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) Not implemented - - PORT_START("controller1_col1") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Clear") PORT_CODE(KEYCODE_MINUS_PAD) - - PORT_START("controller1_col2") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 0") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("controller1_col3") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Enter") PORT_CODE(KEYCODE_PLUS_PAD) - - PORT_START("controller1_extra") - PORT_BIT( 0xff, 0xf0, IPT_UNUSED) // used in palladium - - PORT_START("controller2_col1") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Clear") PORT_CODE(KEYCODE_V) - - PORT_START("controller2_col2") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 0") PORT_CODE(KEYCODE_F) - - PORT_START("controller2_col3") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Enter") PORT_CODE(KEYCODE_R) - - PORT_START("controller2_extra") - PORT_BIT( 0xff, 0xf0, IPT_UNUSED) // used in palladium - -/* FIXME: the joystick are analog - the actual definition is merely an hack */ - -#if 0 - // auto centering too slow, so only using 5 bits, and scaling at videoside - PORT_START("controller1_joy_x") - PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_X) - PORT_SENSITIVITY(1) - PORT_KEYDELTA(2000) - PORT_MINMAX(0,0x1f) - PORT_CODE_DEC(KEYCODE_LEFT) - PORT_CODE_INC(KEYCODE_RIGHT) - PORT_CODE_DEC(JOYCODE_1_LEFT) - PORT_CODE_INC(JOYCODE_1_RIGHT) - PORT_PLAYER(1) - PORT_RESET - - PORT_START("controller1_joy_y") - PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_Y) - PORT_SENSITIVITY(1) - PORT_KEYDELTA(2000) - PORT_MINMAX(0,0x1f) - PORT_CODE_DEC(KEYCODE_UP) - PORT_CODE_INC(KEYCODE_DOWN) - PORT_CODE_DEC(JOYCODE_1_UP) - PORT_CODE_INC(JOYCODE_1_DOWN) - PORT_PLAYER(1) - PORT_RESET - - PORT_START("controller2_joy_x") - PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_MINMAX(0,0x1f) - PORT_CODE_DEC(KEYCODE_DEL) - PORT_CODE_INC(KEYCODE_PGDN) - PORT_CODE_DEC(JOYCODE_2_LEFT) - PORT_CODE_INC(JOYCODE_2_RIGHT) - PORT_PLAYER(2) - PORT_RESET - - PORT_START("controller2_joy_y") - PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_MINMAX(0,0x1f) - PORT_CODE_DEC(KEYCODE_HOME) - PORT_CODE_INC(KEYCODE_END) - PORT_CODE_DEC(JOYCODE_2_UP) - PORT_CODE_INC(JOYCODE_2_DOWN) - PORT_PLAYER(2) - PORT_RESET -#else - PORT_START("joysticks") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY -#endif -INPUT_PORTS_END - -/* The Palladium Video-Computer-Game controllers have no fire buttons on their side - but have a 16 keys unlabeled keypad. The keys are fully independent and layed out - according to this weird scheme, which keeps backward compatibility to Arcadia 2001's - electrical wiring. - - 2 - 13 14 15 - 1 16 3 - 4 5 6 - 7 8 9 - 10 11 12 */ - -static INPUT_PORTS_START( plldium ) - PORT_START("panel") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Selector A") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Selector B") PORT_CODE(KEYCODE_O) -// PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) Not implemented - - PORT_START("controller1_col1") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) // some bits must be high - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 10") PORT_CODE(KEYCODE_MINUS_PAD) - - PORT_START("controller1_col2") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 11") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("controller1_col3") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 12") PORT_CODE(KEYCODE_PLUS_PAD) - - PORT_START("controller1_extra") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 13") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 14") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 15") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 16") PORT_CODE(KEYCODE_DEL_PAD) - - PORT_START("controller2_col1") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 10") PORT_CODE(KEYCODE_V) - - PORT_START("controller2_col2") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 11") PORT_CODE(KEYCODE_F) - - PORT_START("controller2_col3") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 12") PORT_CODE(KEYCODE_R) - - PORT_START("controller2_extra") - PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 13") PORT_CODE(KEYCODE_B) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 14") PORT_CODE(KEYCODE_G) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 15") PORT_CODE(KEYCODE_T) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 16") PORT_CODE(KEYCODE_H) - -/* FIXME: the joystick are analog - the actual definition is merely an hack */ - -#if 0 - // auto centering too slow, so only using 5 bits, and scaling at videoside - PORT_START("controller1_joy_x") - PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_X) - PORT_SENSITIVITY(1) - PORT_KEYDELTA(2000) - PORT_MINMAX(0,0x1f) - PORT_CODE_DEC(KEYCODE_LEFT) - PORT_CODE_INC(KEYCODE_RIGHT) - PORT_CODE_DEC(JOYCODE_1_LEFT) - PORT_CODE_INC(JOYCODE_1_RIGHT) - PORT_PLAYER(1) - PORT_RESET - - PORT_START("controller1_joy_y") - PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_Y) - PORT_SENSITIVITY(1) - PORT_KEYDELTA(2000) - PORT_MINMAX(0,0x1f) - PORT_CODE_DEC(KEYCODE_UP) - PORT_CODE_INC(KEYCODE_DOWN) - PORT_CODE_DEC(JOYCODE_1_UP) - PORT_CODE_INC(JOYCODE_1_DOWN) - PORT_PLAYER(1) - PORT_RESET - - PORT_START("controller2_joy_x") - PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_X) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_MINMAX(0,0x1f) - PORT_CODE_DEC(KEYCODE_DEL) - PORT_CODE_INC(KEYCODE_PGDN) - PORT_CODE_DEC(JOYCODE_2_LEFT) - PORT_CODE_INC(JOYCODE_2_RIGHT) - PORT_PLAYER(2) - PORT_RESET - - PORT_START("controller2_joy_y") - PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_Y) - PORT_SENSITIVITY(100) - PORT_KEYDELTA(10) - PORT_MINMAX(0,0x1f) - PORT_CODE_DEC(KEYCODE_HOME) - PORT_CODE_INC(KEYCODE_END) - PORT_CODE_DEC(JOYCODE_2_UP) - PORT_CODE_INC(JOYCODE_2_DOWN) - PORT_PLAYER(2) - PORT_RESET -#else - PORT_START("joysticks") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY -#endif -INPUT_PORTS_END - -static const gfx_layout arcadia_charlayout = -{ - 8, /*width*/ - 1, /*height*/ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, /* x offsets */ - { 0 }, /* y offsets */ - 1*8 -}; - -static GFXDECODE_START( arcadia ) - GFXDECODE_ENTRY( "gfx1", 0x0000, arcadia_charlayout, 0, 68 ) -GFXDECODE_END - -static const rgb_t arcadia_colors[] = -{ - rgb_t::white, /* white */ - rgb_t(0xff, 0xff, 0x00), /* yellow */ - rgb_t(0x00, 0xff, 0xff), /* cyan */ - rgb_t(0x00, 0xff, 0x00), /* green */ - rgb_t(0xff, 0x00, 0xff), /* magenta */ - rgb_t(0xff, 0x00, 0x00), /* red */ - rgb_t(0x00, 0x00, 0xff), /* blue */ - rgb_t::black /* black */ -}; - -static const unsigned short arcadia_palette[128+8] = /* bgnd, fgnd */ -{ - 0,1,2,3,4,5,6,7, - - 0,0, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, - 1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, - 2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7, - 3,0, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7, - 4,0, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7, - 5,0, 5,1, 5,2, 5,3, 5,4, 5,5, 5,6, 5,7, - 6,0, 6,1, 6,2, 6,3, 6,4, 6,5, 6,6, 6,7, - 7,0, 7,1, 7,2, 7,3, 7,4, 7,5, 7,6, 7,7 -}; - -PALETTE_INIT_MEMBER(arcadia_state, arcadia) -{ - for (int i = 0; i < 8; i++) - palette.set_indirect_color(i, arcadia_colors[i]); - - for (int i = 0; i < 128+8; i++) - palette.set_pen_indirect(i, arcadia_palette[i]); -} - -void arcadia_state::machine_start() -{ - if (m_cart->exists()) - { - switch (m_cart->get_type()) - { - case ARCADIA_STD: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0xffff, read8_delegate(FUNC(arcadia_cart_slot_device::extra_rom),(arcadia_cart_slot_device*)m_cart)); - break; - case ARCADIA_GOLF: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x4fff, read8_delegate(FUNC(arcadia_cart_slot_device::extra_rom),(arcadia_cart_slot_device*)m_cart)); - break; - } - } -} - -static SLOT_INTERFACE_START(arcadia_cart) - SLOT_INTERFACE_INTERNAL("std", ARCADIA_ROM_STD) - SLOT_INTERFACE_INTERNAL("golf", ARCADIA_ROM_GOLF) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( arcadia, arcadia_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", S2650, 3580000/4) /* 0.895 MHz */ - MCFG_CPU_PROGRAM_MAP(arcadia_mem) - MCFG_CPU_IO_MAP(arcadia_io) - MCFG_CPU_PERIODIC_INT_DRIVER(arcadia_state, video_line, 262*60) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(128+2*XPOS, 262) - MCFG_SCREEN_VISIBLE_AREA(0, 2*XPOS+128-1, 0, 262-1) - MCFG_SCREEN_UPDATE_DRIVER(arcadia_state, screen_update_arcadia) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", arcadia ) - MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(arcadia_palette)) - MCFG_PALETTE_INDIRECT_ENTRIES(8) - MCFG_PALETTE_INIT_OWNER(arcadia_state, arcadia) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_ARCADIA_SOUND_ADD("custom") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* cartridge */ - MCFG_ARCADIA_CARTRIDGE_ADD("cartslot", arcadia_cart, NULL) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","arcadia") -MACHINE_CONFIG_END - - -ROM_START(advsnha) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(bndarc) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(arcadia) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(tccosmos) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(dynavisn) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(ekusera) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(hanihac) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(hmg2650) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(intmpt03) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(ixl2000) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(intervsn) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(itmcmtp3) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(lvision) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(leonardo) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(mratlus) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(ormatu) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(plldium) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(polyvcg) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(poppympt) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(prestmpt) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(rowtrn2k) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(tvg2000) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(sheenhvc) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(soundic) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(telefevr) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(tempestm) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(tbbympt3) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(trakcvg) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(tunixha) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(tryomvgc) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(orbituvi) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - -ROM_START(vdmaster) - ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF) - ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) -ROM_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -DRIVER_INIT_MEMBER(arcadia_state,arcadia) -{ - int i; - UINT8 *gfx=memregion("gfx1")->base(); - for (i=0; i<256; i++) gfx[i]=i; -#if 0 - // this is here to allow developement of some simple testroutines - // for a real console - { - UINT8 *rom=memregion("maincpu")->base(); - /* this is a simple routine to display all rom characters - on the display for a snapshot */ - static const UINT8 prog[]={ // address 0 of course - 0x20, // eorz, 0 - 0x1b, 0x01, // bctr,a $0004 - 0x17, // retc a - 0x76, 0x20, // ppsu ii - - // fill screen - 0x04, 0x00, // lodi,0 0 - 0x04|1, 0x00, // lodi,1 0 - 0xcc|1, 0x78, 0x10, //a: stra,0 $1800,r1 - 0x75,9, //cpsl wc|c - 0x84,0x41, // addi,0 0x41 - 0x75,9, //cpsl wc|c - 0x84|1, 0x01, // addi,1 1 - 0xe4|1, 0x40, // comi,1 40 - 0x98, 0x80-15, // bcfr,0 a - - 0x04, 0xff, // lodi,0 7 - 0xcc, 0x18, 0xfc, // stra,0 $19f8 - 0x04, 0x00, // lodi,0 7 - 0xcc, 0x18, 0xfd, // stra,0 $18fd - 0x04, 0x07, // lodi,0 7 - 0xcc, 0x19, 0xf9, // stra,0 $19f9 - - 0x04, 0x00, // lodi,0 7 - 0xcc, 0x19, 0xbe, // stra,0 $19bf - 0x04, 0x00, // lodi,0 7 - 0xcc, 0x19, 0xbf, // stra,0 $19bf - - //loop: 0x0021 - // print keyboards - 0x04|1, 0x00, //y:lodi,1 0 - 0x0c|1, 0x79, 0x00, //x: ldra,0 1900,r1 - 0x44|0, 0x0f, //andi,0 0f - 0x64|0, 0x10, //ori,0 10 - 0xcc|1, 0x78, 0x01, //stra,0 1840,r1 - 0x75,9, //cpsl wc|c - 0x84|1, 0x01, //addi,1 1 - 0xe4|1, 0x09, //comi,1 9 - 0x98, 0x80-18, //bcfr,0 x - - // cycle colors - 0x0c|1, 0x19, 0x00, //ldra,1 1900 - 0x44|1, 0xf, //andi,0 0f - 0xe4|1, 1, //comi,1 1 - 0x98, +10, //bcfr,0 c - 0x0c, 0x19, 0xbf,//ldra,0 19f9,0 - 0x84, 1, //addi,0 1 - 0xcc, 0x19, 0xbf, //stra,0 19f9,0 - 0x18|3, 12, // bctr,a - 0xe4|1, 2, //c:comi,1 2 - 0x98, +10, //bcfr,0 d - 0x0c, 0x19, 0xbf, //ldra,0 19f9,0 - 0x84, 8, //addi,0 8 - 0xcc, 0x19, 0xbf, //stra,0 19f9,0 - 0x18|3, 12, // bctr,a - - // cycle colors - 0xe4|1, 4, //comi,1 4 - 0x98, +10, //bcfr,0 c - 0x0c, 0x19, 0xbe,//ldra,0 19f9,0 - 0x84, 1, //addi,0 1 - 0xcc, 0x19, 0xbe, //stra,0 19f9,0 - 0x18|3, 12, // bctr,a - 0xe4|1, 8, //c:comi,1 2 - 0x98, +8+9, //bcfr,0 d - 0x0c, 0x19, 0xbe, //ldra,0 19f9,0 - 0x84, 8, //addi,0 8 - 0xcc, 0x19, 0xbe, //stra,0 19f9,0 - - 0x0c, 0x19, 0x00, //b: ldra,0 1900 - 0x44|0, 0xf, //andi,0 0f - 0xe4, 0, //comi,0 0 - 0x98, 0x80-9, //bcfr,0 b - - 0x0c, 0x19, 0xbe, //ldra,0 19bf - 0xcc, 0x19, 0xf8, //stra,0 19f8 - 0x0c, 0x19, 0xbf, //ldra,0 19bf - 0xcc, 0x19, 0xf9, //stra,0 19f8 - - 0x0c, 0x19, 0xbe, //ldra,0 17ff - 0x44|0, 0xf, //andi,0 7 - 0x64|0, 0x10, //ori,0 10 - 0xcc, 0x18, 0x0d, //stra,0 180f - 0x0c, 0x19, 0xbe, //x: ldra,0 19bf - 0x50, 0x50, 0x50, 0x50, //shr,0 4 - 0x44|0, 0xf, //andi,0 7 - 0x64|0, 0x10, //ori,0 10 - 0xcc, 0x18, 0x0c, //stra,0 180e - - 0x0c, 0x19, 0xbf, //ldra,0 17ff - 0x44|0, 0xf, //andi,0 7 - 0x64|0, 0x10, //ori,0 10 - 0xcc, 0x18, 0x0f, //stra,0 180f - 0x0c, 0x19, 0xbf, //x: ldra,0 19bf - 0x50, 0x50, 0x50, 0x50, //shr,0 4 - 0x44|0, 0xf, //andi,0 7 - 0x64|0, 0x10, //ori,0 10 - 0xcc, 0x18, 0x0e, //stra,0 180e - - 0x0c, 0x18, 0x00, //ldra,0 1800 - 0x84, 1, //addi,0 1 - 0xcc, 0x18, 0x00, //stra,0 1800 - -// 0x1b, 0x80-20-29-26-9-8-2 // bctr,a y - 0x1c|3, 0, 0x32, // bcta,3 loop - - // calling too many subdirectories causes cpu to reset! - // bxa causes trap - }; -#if 1 - FILE *f; - f=fopen("chartest.bin","wb"); - fwrite(prog, ARRAY_LENGTH(prog), sizeof(prog[0]), f); - fclose(f); -#endif - for (i=0; i m_maincpu; - DECLARE_WRITE8_MEMBER(argo_videoram_w); - DECLARE_READ8_MEMBER(argo_io_r); - DECLARE_WRITE8_MEMBER(argo_io_w); - required_shared_ptr m_p_videoram; - const UINT8 *m_p_chargen; - UINT8 m_framecnt; - UINT8 m_cursor_pos[3]; - UINT8 m_p_cursor_pos; - bool m_ram_ctrl; - UINT8 m_scroll_ctrl; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DRIVER_INIT(argo); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -// write to videoram if following 'out b9,61' otherwise write to the unknown 'extra' ram -WRITE8_MEMBER(argo_state::argo_videoram_w) -{ - UINT8 *RAM; - if (m_ram_ctrl) - RAM = memregion("videoram")->base(); - else - RAM = memregion("extraram")->base(); - - RAM[offset] = data; -} - -READ8_MEMBER(argo_state::argo_io_r) -{ - UINT8 low_io = offset; - - switch (low_io) - { - case 0xA1: // keyboard - char kbdrow[6]; - sprintf(kbdrow,"X%X",offset>>8); - return ioport(kbdrow)->read(); - - case 0xE8: // wants bit 4 low then high - return m_framecnt << 4; - - default: - logerror("%s: In %X\n",machine().describe_context(),low_io); - return 0xff; - } -} - -WRITE8_MEMBER(argo_state::argo_io_w) -{ - UINT8 low_io = offset; - - switch (low_io) - { - case 0xA1: // prep scroll step 1 - m_scroll_ctrl = (data == 0x61); - break; - - case 0xA9: // prep scroll step 2 - if ((m_scroll_ctrl == 1) && (data == 0x61)) - m_scroll_ctrl++; - break; - - case 0xE8: // hardware scroll - we should use ports E0,E1,E2,E3 - if ((m_scroll_ctrl == 2) & (data == 0xe3)) - { - UINT8 *RAM = memregion("videoram")->base(); - m_scroll_ctrl = 0; - memcpy(RAM, RAM+80, 24*80); - } - break; - - case 0xC4: // prepare to receive cursor position - m_p_cursor_pos = (data == 0x80); - break; - - case 0xC0: // store cursor position if it followed 'out c4,80' - if (m_p_cursor_pos) - { - m_cursor_pos[m_p_cursor_pos]=data; - if (m_p_cursor_pos == 1) m_p_cursor_pos++; - } - break; - - case 0xB9: // switch between videoram and extraram - m_ram_ctrl = (data == 0x61); - break; - - default: - logerror("%s: Out %X,%X\n",machine().describe_context(),low_io,data); - } -} - - - -static ADDRESS_MAP_START(argo_mem, AS_PROGRAM, 8, argo_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") - AM_RANGE(0x0800, 0xf7af) AM_RAM - AM_RANGE(0xf7b0, 0xf7ff) AM_RAM AM_SHARE("p_videoram") - AM_RANGE(0xf800, 0xffff) AM_ROM AM_WRITE(argo_videoram_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(argo_io, AS_IO, 8, argo_state) - AM_RANGE(0x0000, 0xFFFF) AM_READWRITE(argo_io_r,argo_io_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( argo ) // Keyboard was worked out by trial & error;'F' keys produce symbols - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) // J - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // nothing - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // nothing - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RShift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) // A - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) // B - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('M') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) // K - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) // H - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) // I - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) // C - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) // G - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) // F - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) // D - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_START("X8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) // E - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_START("X9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_START("XA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') // if L is the first character, computer hangs - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_START("XB") - PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -void argo_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BOOT: - /* after the first 4 bytes have been read from ROM, switch the ram back in */ - membank("boot")->set_entry(0); - break; - default: - assert_always(FALSE, "Unknown id in argo_state::device_timer"); - } -} - -void argo_state::machine_reset() -{ - membank("boot")->set_entry(1); - timer_set(attotime::from_usec(5), TIMER_BOOT); -} - -DRIVER_INIT_MEMBER(argo_state,argo) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf800); -} - -void argo_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 argo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - UINT8 *p_vram = m_p_videoram; - - m_framecnt++; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 1; x < 81; x++) // align x to the cursor position numbers - { - gfx = 0; - - if (ra < 9) - { - chr = p_vram[x+ma-1]; - - /* Take care of flashing characters */ - //if ((chr & 0x80) && (m_framecnt & 0x08)) - // chr = 0x20; - - chr &= 0x7f; - - gfx = m_p_chargen[(chr<<4) | ra ]; - } - else - // display cursor if at cursor position and flash on - if ((x==m_cursor_pos[1]) && (y==m_cursor_pos[2]) && (m_framecnt & 0x08)) - gfx = 0xff; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - - if (y) - ma+=80; - else - { - ma=0; - p_vram = memregion("videoram")->base(); - } - } - return 0; -} - -static MACHINE_CONFIG_START( argo, argo_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 3500000) - MCFG_CPU_PROGRAM_MAP(argo_mem) - MCFG_CPU_IO_MAP(argo_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(argo_state, screen_update) - MCFG_SCREEN_SIZE(640, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( argo ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "argo.rom", 0xf800, 0x0800, CRC(4c4c045b) SHA1(be2b97728cc190d4a8bd27262ba9423f252d31a3) ) - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASEFF ) - ROM_REGION( 0x0800, "extraram", ROMREGION_ERASEFF ) // no idea what this is for - - /* character generator not dumped, using the one from 'c10' for now */ - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, argo, 0, 0, argo, argo, argo_state, argo, "", "Argo", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/asst128.c b/src/mess/drivers/asst128.c deleted file mode 100644 index 0aab5a981d7..00000000000 --- a/src/mess/drivers/asst128.c +++ /dev/null @@ -1,145 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -#include "emu.h" -#include "includes/genpc.h" -#include "machine/pc_fdc.h" -#include "cpu/i86/i86.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "formats/asst128_dsk.h" -#include "bus/pc_kbd/keyboards.h" - -class asst128_mb_device : public ibm5150_mb_device -{ -public: - // construction/destruction - asst128_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : ibm5150_mb_device(mconfig, tag, owner, clock) { } - -protected: - // device-level overrides - void device_start(); -}; - -void asst128_mb_device::device_start() -{ - install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) ); - install_device(0x0040, 0x0043, 0, 0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit8253), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit8253) ); - install_device(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255) ); - install_device(0x0080, 0x0087, 0, 0, read8_delegate(FUNC(ibm5160_mb_device::pc_page_r), this), write8_delegate(FUNC(ibm5160_mb_device::pc_page_w),this) ); - install_device(0x00a0, 0x00a1, 0, 0, read8_delegate(), write8_delegate(FUNC(ibm5160_mb_device::nmi_enable_w),this)); - /* MESS managed RAM */ - if ( m_ram->pointer() ) - membank( "bank10" )->set_base( m_ram->pointer() ); -} - -const device_type ASST128_MOTHERBOARD = &device_creator; - -class asst128_state : public driver_device -{ -public: - // construction/destruction - asst128_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_mb(*this, "mb") - , m_fdc(*this, "fdc") - { } - - required_device m_maincpu; - required_device m_mb; - required_device m_fdc; - - DECLARE_FLOPPY_FORMATS( asst128_formats ); - DECLARE_WRITE8_MEMBER(asst128_fdc_dor_w); - - void machine_start(); -}; - -void asst128_state::machine_start() -{ - memory_region* font = memregion(":board0:cga_mc1502:gfx1"); - memcpy(font->base(), memregion("maincpu")->base()+0xffa6e, 0x0400); - memcpy(font->base()+0x0400, memregion("maincpu")->base()+0xf4000, 0x0400); -} - -WRITE8_MEMBER(asst128_state::asst128_fdc_dor_w) -{ - m_fdc->tc_w((data & 0x80) == 0x80); - m_fdc->dor_w(space, offset, data, mem_mask); -} - -static ADDRESS_MAP_START( asst128_map, AS_PROGRAM, 16, asst128_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(asst128_io, AS_IO, 16, asst128_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) - AM_RANGE(0x03f2, 0x03f3) AM_WRITE8(asst128_fdc_dor_w, 0xffff) - AM_RANGE(0x03f4, 0x03f5) AM_DEVICE8("fdc:upd765", upd765a_device, map, 0xffff) -ADDRESS_MAP_END - -static SLOT_INTERFACE_START( asst128_floppies ) - SLOT_INTERFACE( "525ssqd", FLOPPY_525_SSQD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( asst128_state::asst128_formats ) - FLOPPY_ASST128_FORMAT -FLOPPY_FORMATS_END - -static DEVICE_INPUT_DEFAULTS_START( asst128 ) - DEVICE_INPUT_DEFAULTS("DSW0", 0x30, 0x20) -DEVICE_INPUT_DEFAULTS_END - -static MACHINE_CONFIG_START( asst128, asst128_state ) - MCFG_CPU_ADD("maincpu", I8086, 4772720) - MCFG_CPU_PROGRAM_MAP(asst128_map) - MCFG_CPU_IO_MAP(asst128_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_DEVICE_ADD("mb", ASST128_MOTHERBOARD, 0) - asst128_mb_device::static_set_cputag(*device, "maincpu"); - MCFG_DEVICE_INPUT_DEFAULTS(asst128) - -// MCFG_DEVICE_REMOVE("mb:dma8237") - - MCFG_DEVICE_REMOVE("mb:cassette") - MCFG_CASSETTE_ADD("mb:cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_ISA8_SLOT_ADD("mb:isa", "board0", pc_isa8_cards, "cga_mc1502", true) - MCFG_ISA8_SLOT_ADD("mb:isa", "board1", pc_isa8_cards, "lpt", true) - - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - - MCFG_PC_FDC_XT_ADD("fdc") - MCFG_PC_FDC_INTRQ_CALLBACK(DEVWRITELINE("mb:pic8259", pic8259_device, ir6_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", asst128_floppies, "525ssqd", asst128_state::asst128_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", asst128_floppies, "525ssqd", asst128_state::asst128_formats) - - MCFG_PC_JOY_ADD("pc_joy") - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - -ROM_START( asst128 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_LOAD( "extbios.bin", 0xf4000, 0x2000, CRC(e3bf22de) SHA1(d4319edc82c0015ca0adc6c8771e887659717e62)) - ROM_LOAD( "basic.bin", 0xf6000, 0x8000, CRC(a4ec66f6) SHA1(80e934986022681ccde180e92aa108e716c4f19b)) - ROM_LOAD( "mainbios.bin", 0xfe000, 0x2000, CRC(8426cbf5) SHA1(41d14137ffa651977041da22aa8071c0f7854158)) - - // XXX needs dumping - ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) - ROM_LOAD( "asst128cg.bin", 0, 0x2000, NO_DUMP ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 198?, asst128, ibm5150, 0, asst128, 0, driver_device, 0, "Schetmash", "Assistent 128", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/astrohome.c b/src/mess/drivers/astrohome.c deleted file mode 100644 index a3149dd048c..00000000000 --- a/src/mess/drivers/astrohome.c +++ /dev/null @@ -1,272 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Mike Coates, Frank Palazzolo, Aaron Giles, Dirk Best -/**************************************************************************** - - Bally Astrocade consumer hardware - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "includes/astrocde.h" -#include "machine/ram.h" -#include "sound/astrocde.h" -#include "bus/astrocde/slot.h" -#include "bus/astrocde/rom.h" -#include "bus/astrocde/exp.h" -#include "bus/astrocde/ram.h" - -class astrocde_mess_state : public astrocde_state -{ -public: - astrocde_mess_state(const machine_config &mconfig, device_type type, const char *tag) - : astrocde_state(mconfig, type, tag), - m_cart(*this, "cartslot"), - m_exp(*this, "exp") - { } - - required_device m_cart; - required_device m_exp; - DECLARE_MACHINE_START(astrocde); -}; - -/********************************************************************************* - * - * Memory maps - * - * $0000 to $1FFF: 8K on-board ROM (could be one of three available BIOS dumps) - * $2000 to $3FFF: 8K cartridge ROM - * $4000 to $4FFF: 4K screen RAM - * $5000 to $FFFF: 44K address space not available in standard machine. With a - * sufficiently large RAM expansion, all of this RAM can be added, and accessed - * by an extended BASIC program. Bally and Astrocade BASIC can access from - * $5000 to $7FFF if available. - * - *********************************************************************************/ - -static ADDRESS_MAP_START( astrocade_mem, AS_PROGRAM, 8, astrocde_mess_state ) - AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w) - AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */ - AM_RANGE(0x4000, 0x4fff) AM_RAM AM_SHARE("videoram") /* ASG */ - //AM_RANGE(0x5000, 0xffff) AM_DEVREADWRITE("exp", astrocade_exp_device, read, write) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( astrocade_io, AS_IO, 8, astrocde_mess_state ) - AM_RANGE(0x00, 0x1f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w) -ADDRESS_MAP_END - -/************************************* - * - * Input ports - * - * - * The Astrocade has ports for four hand controllers. Each controller has a - * knob on top that can be simultaneously pushed as an eight-way joystick and - * twisted as a paddle, in addition to a trigger button. The knob can twist - * through about 270 degrees, registering 256 unique positions. It does not - * autocenter. When selecting options on the menu, twisting the knob to the - * right gives lower numbers, and twisting to the left gives larger numbers. - * Paddle games like Clowns have more intuitive behavior -- twisting to the - * right moves the character right. - * - * There is a 24-key keypad on the system itself (6 rows, 4 columns). It is - * labeled for the built-in calculator, but overlays were released for other - * programs, the most popular being the BASIC cartridges, which allowed a - * large number of inputs by making the bottom row shift buttons. The labels - * below first list the calculator key, then the BASIC keys in the order of no - * shift, GREEN shift, RED shift, BLUE shift, WORDS shift. - * - *************************************/ - -static INPUT_PORTS_START( astrocde ) - PORT_START("P1HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("P2HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("P3HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(3) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(3) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(3) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("P4HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(4) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(4) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(4) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("KEYPAD0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("% \xC3\xB7 [ ] LIST") PORT_CODE(KEYCODE_O) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("/ x J K L NEXT") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("x - V W X IF") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("- + & @ * GOTO") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("+ = # % : PRINT") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("= WORDS Shift") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KEYPAD1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x93 HALT RUN") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CH 9 G H I STEP") PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9 6 S T U RND") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("6 3 \xE2\x86\x91 . \xE2\x86\x93 BOX") PORT_CODE(KEYCODE_6) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("3 ERASE ( ; )") PORT_CODE(KEYCODE_3) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(". BLUE Shift") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("KEYPAD2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x91 PAUSE / \\") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MS 8 D E F TO") PORT_CODE(KEYCODE_S) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("8 5 P Q R RETN") PORT_CODE(KEYCODE_8) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("5 2 \xE2\x86\x90 ' \xE2\x86\x92 LINE") PORT_CODE(KEYCODE_5) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2 0 < \" > INPUT") PORT_CODE(KEYCODE_2) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0 RED Shift") PORT_CODE(KEYCODE_0) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("KEYPAD3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C GO +10") PORT_CODE(KEYCODE_C) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MR 7 A B C FOR") PORT_CODE(KEYCODE_R) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("7 4 M N O GOSB") PORT_CODE(KEYCODE_7) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("4 1 Y Z ! CLEAR") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1 SPACE $ , ?") PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE GREEN Shift") PORT_CODE(KEYCODE_E) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("P1_KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1) - - PORT_START("P2_KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) - - PORT_START("P3_KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_PLAYER(3) - - PORT_START("P4_KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4) -INPUT_PORTS_END - - -/************************************* - * - * Machine drivers - * - *************************************/ - -static SLOT_INTERFACE_START(astrocade_cart) - SLOT_INTERFACE_INTERNAL("rom", ASTROCADE_ROM_STD) - SLOT_INTERFACE_INTERNAL("rom_256k", ASTROCADE_ROM_256K) - SLOT_INTERFACE_INTERNAL("rom_512k", ASTROCADE_ROM_512K) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(astrocade_exp) - SLOT_INTERFACE("blue_ram_4k", ASTROCADE_BLUERAM_4K) - SLOT_INTERFACE("blue_ram_16k", ASTROCADE_BLUERAM_16K) - SLOT_INTERFACE("blue_ram_32k", ASTROCADE_BLUERAM_32K) - SLOT_INTERFACE("viper_sys1", ASTROCADE_VIPER_SYS1) - SLOT_INTERFACE("lil_white_ram", ASTROCADE_WHITERAM) - SLOT_INTERFACE("rl64_ram", ASTROCADE_RL64RAM) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( astrocde, astrocde_mess_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4) /* 1.789 MHz */ - MCFG_CPU_PROGRAM_MAP(astrocade_mem) - MCFG_CPU_IO_MAP(astrocade_io) - - MCFG_MACHINE_START_OVERRIDE(astrocde_mess_state, astrocde) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(ASTROCADE_CLOCK, 455, 0, 352, 262, 0, 240) - MCFG_SCREEN_UPDATE_DRIVER(astrocde_state, screen_update_astrocde) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_INIT_OWNER(astrocde_state, astrocde) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* expansion port */ - MCFG_ASTROCADE_EXPANSION_SLOT_ADD("exp", astrocade_exp, NULL) - - /* cartridge */ - MCFG_ASTROCADE_CARTRIDGE_ADD("cartslot", astrocade_cart, NULL) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","astrocde") -MACHINE_CONFIG_END - - -/************************************* - * - * ROM definitions - * - *************************************/ - -ROM_START( astrocde ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "astro.bin", 0x0000, 0x2000, CRC(ebc77f3a) SHA1(b902c941997c9d150a560435bf517c6a28137ecc) ) -ROM_END - -ROM_START( astrocdl ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "ballyhlc.bin", 0x0000, 0x2000, CRC(d7c517ba) SHA1(6b2bef5d970e54ed204549f58ba6d197a8bfd3cc) ) -ROM_END - -ROM_START( astrocdw ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "bioswhit.bin", 0x0000, 0x2000, CRC(6eb53e79) SHA1(d84341feec1a0a0e8aa6151b649bc3cf6ef69fbf) ) -ROM_END - -/************************************* - * - * Driver initialization - * - *************************************/ - -DRIVER_INIT_MEMBER(astrocde_state,astrocde) -{ - m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS; -} - -MACHINE_START_MEMBER(astrocde_mess_state, astrocde) -{ - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x3fff, read8_delegate(FUNC(astrocade_cart_slot_device::read_rom),(astrocade_cart_slot_device*)m_cart)); - - // if no RAM is mounted and the handlers are installed, the system starts with garbage on screen and a RESET is necessary - // thus, install RAM only if an expansion is mounted - if (m_exp->get_card_mounted()) - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x5000, 0xffff, read8_delegate(FUNC(astrocade_exp_device::read),(astrocade_exp_device*)m_exp), write8_delegate(FUNC(astrocade_exp_device::write),(astrocade_exp_device*)m_exp)); -} - -/************************************* - * - * Driver definitions - * - *************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1978, astrocde, 0, 0, astrocde, astrocde, astrocde_state, astrocde, "Bally Manufacturing", "Bally Professional Arcade", MACHINE_SUPPORTS_SAVE ) -CONS( 1977, astrocdl, astrocde, 0, astrocde, astrocde, astrocde_state, astrocde, "Bally Manufacturing", "Bally Home Library Computer", MACHINE_SUPPORTS_SAVE ) -CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, astrocde_state, astrocde, "Bally Manufacturing", "Bally Computer System", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/at.c b/src/mess/drivers/at.c deleted file mode 100644 index e02423a3b32..00000000000 --- a/src/mess/drivers/at.c +++ /dev/null @@ -1,1708 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Miodrag Milanovic -/*************************************************************************** - - IBM AT Compatibles - -***************************************************************************/ - -/* mingw-gcc defines this */ -#ifdef i386 -#undef i386 -#endif /* i386 */ - - -#include "includes/at.h" -#include "bus/pc_kbd/keyboards.h" - -static ADDRESS_MAP_START( at16_map, AS_PROGRAM, 16, at_state ) - AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10") - AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM - AM_RANGE(0x0c8000, 0x0cffff) AM_ROM - AM_RANGE(0x0d0000, 0x0effff) AM_RAM - AM_RANGE(0x0f0000, 0x0fffff) AM_ROM - AM_RANGE(0xff0000, 0xffffff) AM_ROM AM_REGION("maincpu", 0x0f0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ps2m30286_map, AS_PROGRAM, 16, at_state) - AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10") - AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM - AM_RANGE(0x0c8000, 0x0cffff) AM_ROM - AM_RANGE(0x0d0000, 0x0dffff) AM_RAM - AM_RANGE(0x0e0000, 0x0fffff) AM_ROM - AM_RANGE(0xfe0000, 0xffffff) AM_ROM AM_REGION("maincpu", 0x0e0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ps1_286_map, AS_PROGRAM, 16, at_state ) - AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("bank10") - AM_RANGE(0x0a0000, 0x0bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffff) - AM_RANGE(0x0c0000, 0x0fffff) AM_ROM - AM_RANGE(0xff0000, 0xffffff) AM_ROM AM_REGION("maincpu", 0x0f0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( at386_map, AS_PROGRAM, 32, at_state ) - AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10") - AM_RANGE(0x000a0000, 0x000bffff) AM_NOP - AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM - AM_RANGE(0x000c8000, 0x000cffff) AM_ROM - AM_RANGE(0x000d0000, 0x000effff) AM_ROM - AM_RANGE(0x000f0000, 0x000fffff) AM_ROM - AM_RANGE(0x00800000, 0x00800bff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xffff0000, 0xffffffff) AM_ROM AM_REGION("maincpu", 0x0f0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( at586_map, AS_PROGRAM, 32, at586_state ) - AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10") - AM_RANGE(0x000a0000, 0x000bffff) AM_NOP - AM_RANGE(0x00800000, 0x00800bff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("isa", 0x20000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ficpio_map, AS_PROGRAM, 32, at_state ) - AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10") - AM_RANGE(0x000a0000, 0x000bffff) AM_NOP - AM_RANGE(0x000c0000, 0x000c7fff) AM_NOP - AM_RANGE(0x000c8000, 0x000cffff) AM_NOP - AM_RANGE(0x000d0000, 0x000effff) AM_RAM - AM_RANGE(0x000f0000, 0x000fffff) AM_RAM - AM_RANGE(0x00800000, 0x00800bff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("isa", 0x20000) -ADDRESS_MAP_END - - -READ8_MEMBER( at_state::at_dma8237_2_r ) -{ - return m_dma8237_2->read(space, offset / 2); -} - -WRITE8_MEMBER( at_state::at_dma8237_2_w ) -{ - m_dma8237_2->write(space, offset / 2, data); -} - -READ8_MEMBER( at_state::at_keybc_r ) -{ - switch (offset) - { - case 0: return m_keybc->data_r(space, 0); - case 1: return at_portb_r(space, 0); - } - - return 0xff; -} - -WRITE8_MEMBER( at_state::at_keybc_w ) -{ - switch (offset) - { - case 0: m_keybc->data_w(space, 0, data); break; - case 1: at_portb_w(space, 0, data); break; - } -} - - -WRITE8_MEMBER( at_state::write_rtc ) -{ - if (offset==0) { - m_nmi_enabled = BIT(data,7); - m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0)); - m_mc146818->write(space,0,data); - } - else { - m_mc146818->write(space,offset,data); - } -} - -static ADDRESS_MAP_START( at16_io, AS_IO, 16, at_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffff) - AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffff) - AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffff) - AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) - AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff) - AM_RANGE(0x0070, 0x007f) AM_DEVREAD8("rtc", mc146818_device, read, 0xffff) AM_WRITE8(write_rtc , 0xffff) - AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffff) - AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffff) - AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffff) -ADDRESS_MAP_END - -READ16_MEMBER( at_state::ps1_unk_r ) -{ - return m_ps1_reg[offset]; -} - -WRITE16_MEMBER( at_state::ps1_unk_w ) -{ - if((offset == 0) && (data == 0x60)) - data = 0x68; - - m_ps1_reg[offset] = (m_ps1_reg[offset] & ~mem_mask) | (data & mem_mask); -} - -READ8_MEMBER( at_state::ps1_kbdc_r ) -{ - UINT8 ret; - if(offset == 0) ret = at_keybc_r(space, offset, mem_mask); - else ret = ps2_portb_r(space,offset, mem_mask); - return ret; -} - -static ADDRESS_MAP_START(ps1_286_io, AS_IO, 16, at_state ) - AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffff) - AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffff) - AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffff) - AM_RANGE(0x0060, 0x0063) AM_READWRITE8(ps1_kbdc_r, at_keybc_w, 0xffff) - AM_RANGE(0x0102, 0x0105) AM_READWRITE(ps1_unk_r, ps1_unk_w) - AM_IMPORT_FROM( at16_io ) -ADDRESS_MAP_END - -READ16_MEMBER( at_state::neat_chipset_r ) -{ - if (ACCESSING_BITS_0_7) - return 0xff; - if (ACCESSING_BITS_8_15) - return m_cs8221->data_r(space, 0, 0) << 8; - return 0xffff; -} - -WRITE16_MEMBER( at_state::neat_chipset_w ) -{ - if (ACCESSING_BITS_0_7) - m_cs8221->address_w(space, 0, data, 0); - - if (ACCESSING_BITS_8_15) - m_cs8221->data_w(space, 0, data >> 8, 0); -} - -static ADDRESS_MAP_START( neat_io, AS_IO, 16, at_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffff) - AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffff) - AM_RANGE(0x0022, 0x0023) AM_READWRITE(neat_chipset_r, neat_chipset_w) - AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffff) - AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) - AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff) - AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffff) - AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffff) - AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffff) - AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( at386_io, AS_IO, 32, at_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffffffff) - AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff) - AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) - AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff) - AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffffffff) - AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff) - AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( at586_io, AS_IO, 32, at586_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ficpio_io, AS_IO, 32, at_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffffffff) - AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff) - AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) - AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff) - AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffffffff) - AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff) - AM_RANGE(0x00a0, 0x00a7) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x00a8, 0x00af) AM_DEVREADWRITE8("chipset", vt82c496_device, read, write, 0xffffffff) - AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff) - AM_RANGE(0x0170, 0x0177) AM_DEVREADWRITE("ide2", ide_controller_32_device, read_cs0, write_cs0) - AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE("ide", ide_controller_32_device, read_cs0, write_cs0) - AM_RANGE(0x0370, 0x0377) AM_DEVREADWRITE("ide2", ide_controller_32_device, read_cs1, write_cs1) - AM_RANGE(0x03f0, 0x03f7) AM_DEVREADWRITE("ide", ide_controller_32_device, read_cs1, write_cs1) - AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_device, read, write) -ADDRESS_MAP_END - -DRIVER_INIT_MEMBER(megapc_state, megapc) -{ - UINT8* ROM = memregion("bios")->base(); - ROM[0xf9145] = 0x45; // hack to fix keyboard. To be removed when the keyboard controller from the MegaPC is dumped - ROM[0xffea0] = 0x20; // to correct checksum -} - -DRIVER_INIT_MEMBER(megapc_state, megapcpl) -{ - UINT8* ROM = memregion("bios")->base(); - ROM[0xf87b1] = 0x55; // hack to fix keyboard. To be removed when the keyboard controller from the MegaPC is dumped - ROM[0xffea0] = 0x20; // to correct checksum -} - -DRIVER_INIT_MEMBER(at_state, megapcpla) -{ - UINT8* ROM = memregion("maincpu")->base(); - - init_at_common(0xa0000); - - ROM[0xf3c2a] = 0x45; // hack to fix keyboard. To be removed when the keyboard controller from the MegaPC is dumped - ROM[0xfaf37] = 0x45; - ROM[0xfcf1b] = 0x54; // this will allow the keyboard to work during the POST memory test - ROM[0xffffe] = 0x1c; - ROM[0xfffff] = 0x41; // to correct checksum -} - -READ16_MEMBER( megapc_state::wd7600_ior ) -{ - if (offset < 4) - return m_isabus->dack_r(offset); - else - return m_isabus->dack16_r(offset); -} - -WRITE16_MEMBER( megapc_state::wd7600_iow ) -{ - if (offset < 4) - m_isabus->dack_w(offset, data); - else - m_isabus->dack16_w(offset, data); -} - -WRITE_LINE_MEMBER( megapc_state::wd7600_hold ) -{ - // halt cpu - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - // and acknowledge hold - m_wd7600->hlda_w(state); -} - -static ADDRESS_MAP_START( megapc_map, AS_PROGRAM, 16, at_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( megapcpl_map, AS_PROGRAM, 32, at_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( megapc_io, AS_IO, 16, at_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -static ADDRESS_MAP_START( megapcpl_io, AS_IO, 32, at_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - - -static INPUT_PORTS_START( atcga ) -INPUT_PORTS_END - -static INPUT_PORTS_START( atvga ) - PORT_START("IN0") - PORT_DIPNAME( 0x08, 0x00, "VGA 1") - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, "VGA 2") - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "VGA 3") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x01, 0x01, "VGA 4") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -WRITE_LINE_MEMBER( at_state::at_mc146818_irq ) -{ - m_pic8259_slave->ir0_w((state) ? 0 : 1); -} - -UINT32 at_state::at_286_a20(bool state) -{ - return (state ? 0xffffff : 0xefffff); -} - -WRITE_LINE_MEMBER( at_state::at_shutdown ) -{ - if(state) - m_maincpu->reset(); -} - -static MACHINE_CONFIG_FRAGMENT( at_motherboard ) - MCFG_MACHINE_START_OVERRIDE(at_state, at ) - MCFG_MACHINE_RESET_OVERRIDE(at_state, at ) - - MCFG_DEVICE_ADD("pit8254", PIT8254, 0) - MCFG_PIT8253_CLK0(4772720/4) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(at_state, at_pit8254_out0_changed)) - MCFG_PIT8253_CLK1(4772720/4) /* dram refresh */ - MCFG_PIT8253_CLK2(4772720/4) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(at_state, at_pit8254_out2_changed)) - - MCFG_DEVICE_ADD( "dma8237_1", AM9517A, XTAL_14_31818MHz/3 ) - MCFG_I8237_OUT_HREQ_CB(DEVWRITELINE("dma8237_2", am9517a_device, dreq0_w)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(at_state, at_dma8237_out_eop)) - MCFG_I8237_IN_MEMR_CB(READ8(at_state, pc_dma_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(at_state, pc_dma_write_byte)) - MCFG_I8237_IN_IOR_0_CB(READ8(at_state, pc_dma8237_0_dack_r)) - MCFG_I8237_IN_IOR_1_CB(READ8(at_state, pc_dma8237_1_dack_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(at_state, pc_dma8237_2_dack_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(at_state, pc_dma8237_3_dack_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(at_state, pc_dma8237_0_dack_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(at_state, pc_dma8237_1_dack_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(at_state, pc_dma8237_2_dack_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(at_state, pc_dma8237_3_dack_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(at_state, pc_dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(at_state, pc_dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(at_state, pc_dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(at_state, pc_dack3_w)) - MCFG_DEVICE_ADD( "dma8237_2", AM9517A, XTAL_14_31818MHz/3 ) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(at_state, pc_dma_hrq_changed)) - MCFG_I8237_IN_MEMR_CB(READ8(at_state, pc_dma_read_word)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(at_state, pc_dma_write_word)) - MCFG_I8237_IN_IOR_1_CB(READ8(at_state, pc_dma8237_5_dack_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(at_state, pc_dma8237_6_dack_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(at_state, pc_dma8237_7_dack_r)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(at_state, pc_dma8237_5_dack_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(at_state, pc_dma8237_6_dack_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(at_state, pc_dma8237_7_dack_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(at_state, pc_dack4_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(at_state, pc_dack5_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(at_state, pc_dack6_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(at_state, pc_dack7_w)) - - MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(at_state, get_slave_ack) ) - MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir2_w), GND, NULL ) - - MCFG_DEVICE_ADD("isabus", ISA16, 0) - MCFG_ISA16_CPU(":maincpu") - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir2_w)) // in place of irq 2 on at irq 9 is used - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir7_w)) - MCFG_ISA_OUT_IRQ10_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ11_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ12_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ14_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ15_CB(DEVWRITELINE("pic8259_slave", pic8259_device, ir7_w)) - MCFG_ISA_OUT_DRQ0_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq0_w)) - MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq3_w)) - MCFG_ISA_OUT_DRQ5_CB(DEVWRITELINE("dma8237_2", am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ6_CB(DEVWRITELINE("dma8237_2", am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ7_CB(DEVWRITELINE("dma8237_2", am9517a_device, dreq3_w)) - - MCFG_DEVICE_ADD("keybc", AT_KEYBOARD_CONTROLLER, XTAL_12MHz) - MCFG_AT_KEYBOARD_CONTROLLER_SYSTEM_RESET_CB(INPUTLINE("maincpu", INPUT_LINE_RESET)) - MCFG_AT_KEYBOARD_CONTROLLER_GATE_A20_CB(INPUTLINE("maincpu", INPUT_LINE_A20)) - MCFG_AT_KEYBOARD_CONTROLLER_INPUT_BUFFER_FULL_CB(DEVWRITELINE("pic8259_master", pic8259_device, ir1_w)) - MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_CLOCK_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, clock_write_from_mb)) - MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_DATA_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, data_write_from_mb)) - MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0) - MCFG_PC_KBDC_OUT_CLOCK_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_clock_w)) - MCFG_PC_KBDC_OUT_DATA_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_data_w)) - - MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) - MCFG_MC146818_IRQ_HANDLER(WRITELINE(at_state, at_mc146818_irq)) - MCFG_MC146818_CENTURY_INDEX(0x32) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( at_softlists ) - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("pc_disk_list","ibm5150") - MCFG_SOFTWARE_LIST_ADD("xt_disk_list","ibm5160_flop") - MCFG_SOFTWARE_LIST_ADD("at_disk_list","ibm5170") - MCFG_SOFTWARE_LIST_ADD("at_cdrom_list","ibm5170_cdrom") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ibm5170, at_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80286, XTAL_12MHz/2 /*6000000*/) - MCFG_CPU_PROGRAM_MAP(at16_map) - MCFG_CPU_IO_MAP(at16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_80286_A20(at_state, at_286_a20) - MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_FRAGMENT_ADD( at_motherboard ) - - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "ega", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "fdc", false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "ide", false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_IBM_PC_AT_84) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ibm5170a, ibm5170 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(XTAL_16MHz/2) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ec1842, ibm5170 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(12000000) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ec1849, ibm5170 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(12000000) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ibmps1, at_state ) - MCFG_CPU_ADD("maincpu", I80286, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(ps1_286_map) - MCFG_CPU_IO_MAP(ps1_286_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_80286_A20(at_state, at_286_a20) - MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_FRAGMENT_ADD( pcvideo_vga ) - - MCFG_FRAGMENT_ADD( at_motherboard ) - - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdc", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "comat", false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "ide", false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ibm5162, at_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80286, 6000000 /*6000000*/) - MCFG_CPU_PROGRAM_MAP(at16_map) - MCFG_CPU_IO_MAP(at16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_80286_A20(at_state, at_286_a20) - MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_FRAGMENT_ADD( at_motherboard ) - - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdc", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "ide", false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "cga", false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_IBM_PC_AT_84) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( ps2m30286, at_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80286, 10000000) - MCFG_CPU_PROGRAM_MAP(ps2m30286_map) - MCFG_CPU_IO_MAP(ps1_286_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_80286_A20(at_state, at_286_a20) - MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_FRAGMENT_ADD( pcvideo_vga ) - - MCFG_FRAGMENT_ADD( at_motherboard ) - - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdc", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "ide", false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_IBM_PC_AT_84) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( neat, at_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80286, 12000000) - MCFG_CPU_PROGRAM_MAP(at16_map) - MCFG_CPU_IO_MAP(neat_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_80286_A20(at_state, at_286_a20) - MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) - - MCFG_FRAGMENT_ADD( at_motherboard ) - - MCFG_ISA16_SLOT_ADD("isabus", "isa1", pc_isa16_cards, "fdc", false) - MCFG_ISA16_SLOT_ADD("isabus", "isa2", pc_isa16_cards, "ide", false) - MCFG_ISA16_SLOT_ADD("isabus", "isa3", pc_isa16_cards, "comat", false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "svga_et4k", false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - MCFG_CS8221_ADD("cs8221", "maincpu", "isa", "bios") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( atvga, at_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80286, 12000000) - MCFG_CPU_PROGRAM_MAP(at16_map) - MCFG_CPU_IO_MAP(at16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_80286_A20(at_state, at_286_a20) - MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) - - MCFG_FRAGMENT_ADD( at_motherboard ) - - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdcsmc", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "ide", false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "ne2000", false) - MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, "svga_et4k", false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( xb42639, at_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80286, 12500000) - MCFG_CPU_PROGRAM_MAP(at16_map) - MCFG_CPU_IO_MAP(at16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_80286_A20(at_state, at_286_a20) - MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) - - MCFG_FRAGMENT_ADD( at_motherboard ) - - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "fdc", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "ide", false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, "svga_et4k", false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( at386, at_state ) - MCFG_CPU_ADD("maincpu", I386, 12000000) - MCFG_CPU_PROGRAM_MAP(at386_map) - MCFG_CPU_IO_MAP(at386_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_FRAGMENT_ADD( at_motherboard ) - MCFG_NVRAM_ADD_0FILL("nvram") - - // on board devices - MCFG_ISA16_SLOT_ADD("isabus","board1", pc_isa16_cards, "fdcsmc", true) - MCFG_ISA16_SLOT_ADD("isabus","board2", pc_isa16_cards, "comat", true) - MCFG_ISA16_SLOT_ADD("isabus","board3", pc_isa16_cards, "ide", true) - MCFG_ISA16_SLOT_ADD("isabus","board4", pc_isa16_cards, "lpt", true) - // ISA cards - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "svga_et4k", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, NULL, false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,15M,16M,32M,64M,128M,256M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( at486, at386 ) - MCFG_CPU_REPLACE("maincpu", I486, 25000000) - MCFG_CPU_PROGRAM_MAP(at386_map) - MCFG_CPU_IO_MAP(at386_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( k286i, at_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80286, XTAL_12MHz/2 /*6000000*/) - MCFG_CPU_PROGRAM_MAP(at16_map) - MCFG_CPU_IO_MAP(at16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_80286_A20(at_state, at_286_a20) - MCFG_80286_SHUTDOWN(WRITELINE(at_state, at_shutdown)) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_FRAGMENT_ADD( at_motherboard ) - - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "cga", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, "fdc", false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, "comat", false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa6", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa7", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa8", pc_isa16_cards, NULL, false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1M") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,16M") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_FRAGMENT( tx_config ) - MCFG_I82439TX_CPU( "maincpu" ) - MCFG_I82439TX_REGION( "isa" ) -MACHINE_CONFIG_END - -static SLOT_INTERFACE_START( pci_devices ) - SLOT_INTERFACE_INTERNAL("i82439tx", I82439TX) - SLOT_INTERFACE_INTERNAL("i82371ab", I82371AB) - SLOT_INTERFACE_INTERNAL("i82371sb", I82371SB) - SLOT_INTERFACE_INTERNAL("vt82c505", VT82C505) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( at586, at586_state ) - MCFG_CPU_ADD("maincpu", PENTIUM, 60000000) - MCFG_CPU_PROGRAM_MAP(at586_map) - MCFG_CPU_IO_MAP(at586_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pcibus:1:i82371ab:pic8259_master", pic8259_device, inta_cb) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,16M,32M,64M,128M,256M") - - MCFG_PCI_BUS_ADD("pcibus", 0) - MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "i82439tx", true) - MCFG_SLOT_OPTION_MACHINE_CONFIG("i82439tx", tx_config) - - MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "i82371ab", true) - - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa1", pc_isa16_cards, "svga_et4k", false) - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa2", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa3", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa4", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371ab:isabus","isa5", pc_isa16_cards, NULL, false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( at586x3, at586_state ) - MCFG_CPU_ADD("maincpu", PENTIUM, 60000000) - MCFG_CPU_PROGRAM_MAP(at586_map) - MCFG_CPU_IO_MAP(at586_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pcibus:1:i82371sb:pic8259_master", pic8259_device, inta_cb) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,16M,32M,64M") - - MCFG_PCI_BUS_ADD("pcibus", 0) - MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "i82439tx", true) - MCFG_SLOT_OPTION_MACHINE_CONFIG("i82439tx", tx_config) - - MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "i82371sb", true) - - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa1", pc_isa16_cards, "svga_et4k", false) - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa2", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa3", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa4", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(":pcibus:1:i82371sb:isabus","isa5", pc_isa16_cards, NULL, false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( at386sx, atvga ) - MCFG_CPU_REPLACE("maincpu", I386SX, 16000000) /* 386SX */ - MCFG_CPU_PROGRAM_MAP(at16_map) - MCFG_CPU_IO_MAP(at16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ct386sx, neat ) - MCFG_CPU_REPLACE("maincpu", I386SX, 16000000) - MCFG_CPU_PROGRAM_MAP(at16_map) - MCFG_CPU_IO_MAP(neat_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( megapc, megapc_state ) - MCFG_CPU_ADD("maincpu", I386SX, XTAL_50MHz / 2) - MCFG_CPU_PROGRAM_MAP(megapc_map) - MCFG_CPU_IO_MAP(megapc_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("wd7600", wd7600_device, intack_cb) - - MCFG_WD7600_ADD("wd7600",XTAL_50MHz / 2, ":maincpu", ":isa", ":bios", ":keybc") - MCFG_WD7600_HOLD(WRITELINE(megapc_state, wd7600_hold)); - MCFG_WD7600_NMI(INPUTLINE("maincpu", INPUT_LINE_NMI)); - MCFG_WD7600_INTR(INPUTLINE("maincpu", INPUT_LINE_IRQ0)); - MCFG_WD7600_CPURESET(INPUTLINE("maincpu", INPUT_LINE_RESET)); - MCFG_WD7600_A20M(INPUTLINE("maincpu", INPUT_LINE_A20)); - // isa dma - MCFG_WD7600_IOR(READ16(megapc_state, wd7600_ior)) - MCFG_WD7600_IOW(WRITE16(megapc_state, wd7600_iow)) - MCFG_WD7600_TC(WRITE8(megapc_state, wd7600_tc)) - // speaker - MCFG_WD7600_SPKR(WRITELINE(megapc_state, wd7600_spkr)) - - // on board devices - MCFG_DEVICE_ADD("isabus", ISA16, 0) - MCFG_ISA16_CPU(":maincpu") - MCFG_ISA_BUS_IOCHCK(DEVWRITELINE("wd7600", wd7600_device, iochck_w)) - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("wd7600", wd7600_device, irq09_w)) - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("wd7600", wd7600_device, irq03_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("wd7600", wd7600_device, irq04_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("wd7600", wd7600_device, irq05_w)) - MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("wd7600", wd7600_device, irq06_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("wd7600", wd7600_device, irq07_w)) - MCFG_ISA_OUT_IRQ10_CB(DEVWRITELINE("wd7600", wd7600_device, irq10_w)) - MCFG_ISA_OUT_IRQ11_CB(DEVWRITELINE("wd7600", wd7600_device, irq11_w)) - MCFG_ISA_OUT_IRQ12_CB(DEVWRITELINE("wd7600", wd7600_device, irq12_w)) - MCFG_ISA_OUT_IRQ14_CB(DEVWRITELINE("wd7600", wd7600_device, irq14_w)) - MCFG_ISA_OUT_IRQ15_CB(DEVWRITELINE("wd7600", wd7600_device, irq15_w)) - MCFG_ISA_OUT_DRQ0_CB(DEVWRITELINE("wd7600", wd7600_device, dreq0_w)) - MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("wd7600", wd7600_device, dreq1_w)) - MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("wd7600", wd7600_device, dreq2_w)) - MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("wd7600", wd7600_device, dreq3_w)) - MCFG_ISA_OUT_DRQ5_CB(DEVWRITELINE("wd7600", wd7600_device, dreq5_w)) - MCFG_ISA_OUT_DRQ6_CB(DEVWRITELINE("wd7600", wd7600_device, dreq6_w)) - MCFG_ISA_OUT_DRQ7_CB(DEVWRITELINE("wd7600", wd7600_device, dreq7_w)) - MCFG_ISA16_SLOT_ADD("isabus","board1", pc_isa16_cards, "fdcsmc", true) - MCFG_ISA16_SLOT_ADD("isabus","board2", pc_isa16_cards, "comat", true) - MCFG_ISA16_SLOT_ADD("isabus","board3", pc_isa16_cards, "ide", true) - MCFG_ISA16_SLOT_ADD("isabus","board4", pc_isa16_cards, "lpt", true) - MCFG_ISA16_SLOT_ADD("isabus","board5", pc_isa16_cards, "vga", true) - // ISA cards - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, NULL, false) - - MCFG_DEVICE_ADD("keybc", AT_KEYBOARD_CONTROLLER, XTAL_12MHz) - MCFG_AT_KEYBOARD_CONTROLLER_SYSTEM_RESET_CB(DEVWRITELINE("wd7600", wd7600_device, kbrst_w)) - MCFG_AT_KEYBOARD_CONTROLLER_GATE_A20_CB(DEVWRITELINE("wd7600", wd7600_device, gatea20_w)) - MCFG_AT_KEYBOARD_CONTROLLER_INPUT_BUFFER_FULL_CB(DEVWRITELINE("wd7600", wd7600_device, irq01_w)) - MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_CLOCK_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, clock_write_from_mb)) - MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_DATA_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, data_write_from_mb)) - MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0) - MCFG_PC_KBDC_OUT_CLOCK_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_clock_w)) - MCFG_PC_KBDC_OUT_DATA_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_data_w)) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,15M,16M") - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - // video hardware - MCFG_PALETTE_ADD("palette", 256) // todo: really needed? - - /* software lists */ - MCFG_FRAGMENT_ADD( at_softlists ) - MCFG_SOFTWARE_LIST_ADD("disk_list","megapc") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( megapcpl, megapc ) - MCFG_CPU_REPLACE("maincpu", I486, 66000000 / 2) - MCFG_CPU_PROGRAM_MAP(megapcpl_map) - MCFG_CPU_IO_MAP(megapcpl_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("wd7600", wd7600_device, intack_cb) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( megapcpla, at_state ) - MCFG_CPU_ADD("maincpu", I486, 66000000 / 2) // 486SLC - MCFG_CPU_PROGRAM_MAP(at386_map) - MCFG_CPU_IO_MAP(at386_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_FRAGMENT_ADD( at_motherboard ) - MCFG_NVRAM_ADD_0FILL("nvram") - - // on board devices - MCFG_ISA16_SLOT_ADD("isabus","board1", pc_isa16_cards, "fdcsmc", true) - MCFG_ISA16_SLOT_ADD("isabus","board2", pc_isa16_cards, "comat", true) - MCFG_ISA16_SLOT_ADD("isabus","board3", pc_isa16_cards, "ide", true) - MCFG_ISA16_SLOT_ADD("isabus","board4", pc_isa16_cards, "lpt", true) - // ISA cards - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "svga_dm", false) // closest to the CL-GD5420 - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, NULL, false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("2M,8M,15M,16M,32M,64M,128M,256M") - - /* software lists */ - MCFG_FRAGMENT_ADD( at_softlists ) - MCFG_SOFTWARE_LIST_ADD("disk_list","megapc") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ficpio2, at_state ) - MCFG_CPU_ADD("maincpu", I486, 25000000) - MCFG_CPU_PROGRAM_MAP(ficpio_map) - MCFG_CPU_IO_MAP(ficpio_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_FRAGMENT_ADD(at_motherboard) - - MCFG_DEVICE_REMOVE("rtc") - MCFG_DS12885_ADD("rtc") - MCFG_MC146818_IRQ_HANDLER(WRITELINE(at_state, at_mc146818_irq)) - MCFG_MC146818_CENTURY_INDEX(0x32) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,16M,32M,64M,128M") - - // on board devices - MCFG_ISA16_SLOT_ADD("isabus","board1", pc_isa16_cards, "fdcsmc", true) - MCFG_ISA16_SLOT_ADD("isabus","board2", pc_isa16_cards, "comat", true) - MCFG_ISA16_SLOT_ADD("isabus","board3", pc_isa16_cards, "lpt", true) - - MCFG_IDE_CONTROLLER_32_ADD("ide", ata_devices, "hdd", NULL, true) - MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir6_w)) - MCFG_IDE_CONTROLLER_32_ADD("ide2", ata_devices, "cdrom", NULL, true) - MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir7_w)) - - MCFG_PCI_BUS_ADD("pcibus", 0) - MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "vt82c505", true) - MCFG_ISA16_SLOT_ADD("isabus","isa1", pc_isa16_cards, "svga_et4k", false) - MCFG_ISA16_SLOT_ADD("isabus","isa2", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa3", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus","isa4", pc_isa16_cards, NULL, false) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - MCFG_VT82C496_ADD("chipset") - MCFG_VT82C496_CPU("maincpu") - MCFG_VT82C496_REGION("isa") - - MCFG_FRAGMENT_ADD( at_softlists ) -MACHINE_CONFIG_END - -#if 0 - // ibm at - // most likely 2 32 kbyte chips for 16 bit access - ROM_LOAD("atbios.bin", 0xf0000, 0x10000, CRC(674426be)) // BASIC C1.1, beeps - // split into 2 chips for 16 bit access - ROM_LOAD_EVEN("ibmat.0", 0xf0000, 0x8000, CRC(4995be7a)) - ROM_LOAD_ODD("ibmat.1", 0xf0000, 0x8000, CRC(c32713e4)) - - /* I know about a 1984 version in 2 32kb roms */ - - /* at, ami bios and diagnostics */ - ROM_LOAD_EVEN("rom01.bin", 0xf0000, 0x8000, CRC(679296a7)) - ROM_LOAD_ODD("rom02.bin", 0xf0000, 0x8000, CRC(65ae1f97)) - - /* */ - ROM_LOAD("neat286.bin", 0xf0000, 0x10000, CRC(07985d9b)) - // split into 2 chips for 16 bit access - ROM_LOAD_EVEN("neat.0", 0xf0000, 0x8000, CRC(4c36e61d)) - ROM_LOAD_ODD("neat.1", 0xf0000, 0x8000, CRC(4e90f294)) - - /* most likely 1 chip!, for lower costs */ - ROM_LOAD("at386.bin", 0xf0000, 0x10000, CRC(3df9732a)) - - /* at486 */ - ROM_LOAD("at486.bin", 0xf0000, 0x10000, CRC(31214616)) - - ROM_LOAD("", 0x??000, 0x2000, CRC()) -#endif - -ROM_START( ibm5170 ) - ROM_REGION(0x100000,"maincpu", 0) - - ROM_SYSTEM_BIOS( 0, "rev1", "IBM PC/AT 5170 01/10/84") - ROMX_LOAD("6181028.u27", 0xf0000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a), ROM_SKIP(1) | ROM_BIOS(1)) /* T 6181028 8506AAA // TMM23256P-5878 // (C)IBM CORP 1981,-1984 */ - ROMX_LOAD("6181029.u47", 0xf0001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be), ROM_SKIP(1) | ROM_BIOS(1)) /* T 6181029 8506AAA // TMM23256P-5879 // (C)IBM CORP 1981,-1984 */ - - ROM_SYSTEM_BIOS( 1, "rev2", "IBM PC/AT 5170 06/10/85") /* Another verifaction of these crcs would be nice */ - ROMX_LOAD("6480090.u27", 0xf0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("6480091.u47", 0xf0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(2)) - -// ROM_SYSTEM_BIOS( 2, "atdiag", "IBM PC/AT 5170 w/Super Diagnostics") -// ROMX_LOAD("atdiage.bin", 0xf8000, 0x4000, CRC(e8855d0c) SHA1(c9d53e61c08da0a64f43d691bf6cadae5393843a), ROM_SKIP(1) | ROM_BIOS(3)) -// ROMX_LOAD("atdiago.bin", 0xf8001, 0x4000, CRC(606fa71d) SHA1(165e45bae7ae2da274f1e645c763c5bfcbde027b), ROM_SKIP(1) | ROM_BIOS(3)) - - /* Mainboard PALS */ - ROM_REGION( 0x2000, "pals", 0 ) - ROM_LOAD("1501824_717750.mmipal14l4.u87.jed", 0x0000, 0x02E7, CRC(3c819a27) SHA1(d2f4889e628dbbef50b7f48cb1d1a313232bacc8)) /* MMI 1501824 717750 // (C)1983 IBM(M) */ - ROM_LOAD("1503135_705075.mmipal14l4.u130.jed", 0x02E7, 0x02E7, CRC(aac77198) SHA1(b318da3a1fbe5402836c1b548e231e0794d0c032)) /* MMI 1503135 705075 // (C) IBM CORP 83 */ - /* P/N 6320947 Serial/Parallel ISA expansion card PAL */ - ROM_LOAD("1503085.mmipal.u14.jed", 0x1000, 0x0800, NO_DUMP) /* MMI 1503085 8449 // (C) IBM CORP 83 */ /* Not sure of type */ - - /* Mainboard PROMS */ - ROM_REGION( 0x2000, "proms", 0 ) - ROM_LOAD("1501814.82s123an.u115", 0x0000, 0x0020, CRC(849c9217) SHA1(2955ae1705c3b59170f1373f99b3ea5c174c4544)) /* N82S123AN 8713 // SK-D 1501814 */ - ROM_LOAD("55x8041.82s147an.u72", 0x0020, 0x0200, CRC(f2cc4fe6) SHA1(e285468516bd05083155a8a272583deef655315a)) /* S N82S147AN 8709 // V-C55X8041 */ -ROM_END - -ROM_START( ec1842 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_LOAD16_BYTE( "4202004.bin", 0xfc001, 0x2000, CRC(33fb5382) SHA1(35eb62328324d93e7a06f2f9d1ad0002f83fc99b)) - ROM_LOAD16_BYTE( "4202005.bin", 0xfc000, 0x2000, CRC(8e05c119) SHA1(9d81613b4fc305c14ae9fda0b1dd97a290715530)) - ROM_LOAD16_BYTE( "4202006.bin", 0xf8001, 0x2000, CRC(6da537ef) SHA1(f79feb433dcf41f5cdef52b845e3550d5f0fb5c0)) - ROM_LOAD16_BYTE( "4202007.bin", 0xf8000, 0x2000, CRC(d6ee0e95) SHA1(6fd4c42190e879501198fede70ae43bc420681d0)) - // EGA ROM - ROM_LOAD16_BYTE( "4200009.bin", 0xc0000, 0x2000, CRC(9deeb39f) SHA1(255b859d3ea05891aa65a4a742ecaba744dfc923)) - ROM_LOAD16_BYTE( "4200010.bin", 0xc0001, 0x2000, CRC(f2c38d93) SHA1(dcb3741d06089bf1a80cb766a6b94029ad698d73)) -ROM_END - -ROM_START( ec1849 ) - ROM_REGION16_LE(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "cpu-card_27c256_015.rom", 0xf0000, 0x8000, CRC(68eadf0a) SHA1(903a7f1c3ebc6b27c31b512b2908c483608b5c13)) - ROM_LOAD16_BYTE( "cpu-card_27c256_016.rom", 0xf0001, 0x8000, CRC(bc3924d6) SHA1(596be415e6c2bc4ff30a187f146664531565712c)) - ROM_LOAD16_BYTE( "video-card_573rf6( 2764)_040.rom", 0xc0001, 0x2000, CRC(a3ece315) SHA1(e800e11c3b1b6fcaf41bfb7d4058a9d34fdd2b3f)) - ROM_LOAD16_BYTE( "video-card_573rf6( 2764)_041.rom", 0xc0000, 0x2000, CRC(b0a2ba7f) SHA1(c8160e8bc97cd391558f1dddd3fd3ec4a19d030c)) -ROM_END - -ROM_START( ibm5170a ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_SYSTEM_BIOS( 0, "rev3", "IBM PC/AT 5170 11/15/85") - ROMX_LOAD("61x9266.u27", 0xf0000, 0x8000, CRC(4995be7a) SHA1(8e8e5c863ae3b8c55fd394e345d8cca48b6e575c), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD("61x9265.u47", 0xf0001, 0x8000, CRC(c32713e4) SHA1(22ed4e2be9f948682891e2fd056a97dbea01203c), ROM_SKIP(1) | ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "3270at", "IBM 3270 PC/AT 5281 11/15/85") /* pretty much just a part string and checksum change from the 5170 rev3 */ - ROMX_LOAD("62x0820.u27", 0xf0000, 0x8000, CRC(e9cc3761) SHA1(ff9373c1a1f34a32fb6acdabc189c61b01acf9aa), ROM_SKIP(1) | ROM_BIOS(2)) /* T 62X0820-U27 8714HAK // TMM23256P-6746 // (C)IBM CORP 1981,-1985 */ - ROMX_LOAD("62x0821.u47", 0xf0001, 0x8000, CRC(b5978ccb) SHA1(2a1aeb9ae3cd7e60fc4c383ca026208b82156810), ROM_SKIP(1) | ROM_BIOS(2)) /* T 62X0821-U47 8715HAK // TMM23256P-6747 // (C)IBM CORP 1981,-1985 */ - - /* Mainboard PALS */ - ROM_REGION( 0x2000, "pals", 0 ) - ROM_LOAD("1501824_717750.mmipal14l4.u87.jed", 0x0000, 0x02E7, CRC(3c819a27) SHA1(d2f4889e628dbbef50b7f48cb1d1a313232bacc8)) /* MMI 1501824 717750 // (C)1983 IBM(M) */ - ROM_LOAD("1503135_705075.mmipal14l4.u130.jed", 0x02E7, 0x02E7, CRC(aac77198) SHA1(b318da3a1fbe5402836c1b548e231e0794d0c032)) /* MMI 1503135 705075 // (C) IBM CORP 83 */ /* P/N 6320947 Serial/Parallel ISA expansion card PAL */ - ROM_LOAD("1503085.mmipal.u14.jed", 0x1000, 0x0800, NO_DUMP) /* MMI 1503085 8449 // (C) IBM CORP 83 */ /* Not sure of type */ - - /* Mainboard PROMS */ - ROM_REGION( 0x2000, "proms", 0 ) - ROM_LOAD("1501814.82s123an.u115", 0x0000, 0x0020, CRC(849c9217) SHA1(2955ae1705c3b59170f1373f99b3ea5c174c4544)) /* N82S123AN 8713 // SK-D 1501814 */ - ROM_LOAD("55x8041.82s147an.u72", 0x0020, 0x0200, CRC(f2cc4fe6) SHA1(e285468516bd05083155a8a272583deef655315a)) /* S N82S147AN 8709 // V-C55X8041 */ -ROM_END - - -ROM_START( ibm5162 ) //MB p/n 62x1168 - ROM_REGION16_LE(0x1000000,"maincpu", 0) - - ROM_LOAD16_BYTE("78x7460.u34", 0xf0000, 0x8000, CRC(1db4bd8f) SHA1(7be669fbb998d8b4626fefa7cd1208d3b2a88c31)) /* 78X7460 U34 // (C) IBM CORP // 1981-1986 */ - ROM_LOAD16_BYTE("78x7461.u35", 0xf0001, 0x8000, CRC(be14b453) SHA1(ec7c10087dbd53f9c6d1174e8f14212e2aec1818)) /* 78X7461 U35 // (C) IBM CORP // 1981-1986 */ - - /* Mainboard PALS */ - ROM_REGION( 0x2000, "pals", 0 ) - ROM_LOAD("59x7599.mmipal20l8.u27.jed", 0x0000, 0x02E7, NO_DUMP) /* MMI PAL20L8ACN5 8631 // N59X7599 IBM (C)85 K3 */ - ROM_LOAD("1503135.mmipal14l4.u81.jed", 0x02E7, 0x02E7, CRC(aac77198) SHA1(b318da3a1fbe5402836c1b548e231e0794d0c032)) /* MMI 1503135 8625 // (C) IBM CORP 83 */ - /* P/N 6320947 Serial/Parallel ISA expansion card PAL */ - ROM_LOAD("1503085.mmipal.u14.jed", 0x1000, 0x0800, NO_DUMP) /* MMI 1503085 8449 // (C) IBM CORP 83 */ /* Not sure of type */ - - /* Mainboard PROMS */ - ROM_REGION( 0x2000, "proms", 0 ) - ROM_LOAD("1501814.82s123an.u72", 0x0000, 0x0020, CRC(849c9217) SHA1(2955ae1705c3b59170f1373f99b3ea5c174c4544)) /* N82S123AN 8623 // SK-U 1501814 */ - ROM_LOAD("59x7594.82s147an.u90", 0x0020, 0x0200, NO_DUMP) /* S N82S147AN 8629 // VCT 59X7594 */ -ROM_END - - -ROM_START( i8530286 ) - ROM_REGION(0x1000000,"maincpu", 0) - // saved from running machine - ROM_LOAD16_BYTE("ps2m30.0", 0xe0000, 0x10000, CRC(9965a634) SHA1(c237b1760f8a4561ec47dc70fe2e9df664e56596)) - ROM_RELOAD(0xfe0000,0x10000) - ROM_LOAD16_BYTE("ps2m30.1", 0xe0001, 0x10000, CRC(1448d3cb) SHA1(13fa26d895ce084278cd5ab1208fc16c80115ebe)) - ROM_RELOAD(0xfe0001,0x10000) -ROM_END - -/* - -8530-H31 (Model 30/286) -====================== - P/N Date -33F5381A EC C01446 1990 - -*/ -ROM_START( i8530h31 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD( "33f5381a.bin", 0xe0000, 0x20000, CRC(ff57057d) SHA1(d7f1777077a8df43c3c14d175b9709bd3969c4b1)) - ROM_RELOAD(0xfe0000,0x20000) -ROM_END - -/* -8535-043 (Model 35) -=================== - P/N Checksum Date -04G2021 C26C 1991 ODD -04G2022 9B94 1991 EVEN -*/ -ROM_START( i8535043 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "04g2021.bin", 0xe0001, 0x10000, CRC(4069b2eb) SHA1(9855c84c81d1f07e1da66b1ca45c1c10c0717a90)) - ROM_RELOAD(0xfe0001, 0x10000) - ROM_LOAD16_BYTE( "04g2022.bin", 0xe0000, 0x10000, CRC(35c1af65) SHA1(7d2445cc463969c808fdd78e0a27a03db5dfc698)) - ROM_RELOAD(0xfe0000, 0x10000) -ROM_END - -/* -8550-021 (Model 50) -=================== - Code Date Internal -90X7420 4/12/87 --> 90X6815 -90X7423 8/12/87 --> 90X6816 -90X7426 8/12/87 --> 90X6817 -90X7429 18/12/87 --> 90X6818 - -Same ROMs used by : (According to http://www.ibmmuseum.com/ohlandl/8565/8560.html) - -IBM Personal System/2 Model 60 (8560-041 and 8560-071) -IBM Personal System/2 Model 65 SX (8565-061 and 8565-121) - -*/ -ROM_START( i8550021 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "90x7423.zm14", 0xe0000, 0x8000, CRC(2c1633e0) SHA1(1af7faa526585a7cfb69e71d90a75e1f1c541586)) - ROM_RELOAD(0xfe0000, 0x8000) - ROM_LOAD16_BYTE( "90x7426.zm16", 0xe0001, 0x8000, CRC(e7c762ce) SHA1(228f67dc915d84519da7fc1a59b7f9254278f3a0)) - ROM_RELOAD(0xfe0001, 0x8000) - ROM_LOAD16_BYTE( "90x7420.zm13", 0xf0001, 0x8000, CRC(19a57cc1) SHA1(5b31ba66cd3690e651a450619a32b7210769945d)) - ROM_RELOAD(0xff0001, 0x8000) - ROM_LOAD16_BYTE( "90x7429.zm18", 0xf0000, 0x8000, CRC(6f0120f6) SHA1(e112c291ac3d9f6507c93ac49ad26f9fd2245fd2)) - ROM_RELOAD(0xff0000, 0x8000) - - ROM_REGION( 0x800, "keyboard", 0 ) - ROM_LOAD( "72x8455.zm82", 0x000, 0x800, CRC(7da223d3) SHA1(54c52ff6c6a2310f79b2c7e6d1259be9de868f0e) ) -ROM_END - -/* -8550-061 (Model 50Z) -=================== - P/N Date -AMI 8935MKN 15F8365 S63512 1988 -AMI 8948MML 15F8366 S63512 1988 - -http://ps-2.kev009.com:8081/ohlandl/8550/8550z_Planar.html - - -*/ -ROM_START( i8550061 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "15f8365.zm5", 0xe0001, 0x10000, CRC(35aa3ecf) SHA1(a122531092a9cb08600b276da9c9c3ce385aab7b)) - ROM_RELOAD(0xfe0001, 0x10000) - ROM_LOAD16_BYTE( "15f8366.zm6", 0xe0000, 0x10000, CRC(11bf564d) SHA1(0dda6a7ca9294cfaab5bdf4c05973be13b2766fc)) - ROM_RELOAD(0xfe0000, 0x10000) -ROM_END - -/* -8555-X61 (Model 55SX) -=================== - Code Date Internal -ODD 33F8145 13/03/90 --> 33F8153 -EVEN 33F8146 31/01/90 --> 33F8152 - -8555-081 (Model 55SX) -=================== - Code Date Internal -ODD AMI 9205MEN 92F0627 EC32680 88 --> 33F8153 -EVEN AMI 9203MGS 92F0626 EC32680 88 --> 33F8152 - -*/ -ROM_START( i8555081 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE("33f8145.zm40", 0xe0001, 0x10000, CRC(0895894c) SHA1(7cee77828867ad1bdbe0ac223bc25d23c65b28a0)) - ROM_RELOAD(0xfe0001, 0x10000) - ROM_LOAD16_BYTE("33f8146.zm41", 0xe0000, 0x10000, CRC(c6020680) SHA1(b25a64e4b2dca07c567648401100e04e89bbcddb)) - ROM_RELOAD(0xfe0000, 0x10000) -ROM_END - -/* -8580-071 (Model 80) -=================== - Code Date Internal -AMI 8924MBW 90X8548 1987 --> 72X7551 -AMI 8924MBL 90X8549 1987 --> 72X7554 -AMI 8924MBG 90X8550 1987 --> 72X7557 -AMI 8921MBK 90X8551 1987 --> 72X7560 -*/ -ROM_START( i8580071 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD( "90x8548.bin", 0xe0000, 0x8000, CRC(1f13eea5) SHA1(0bf53ad86f47db3825a713ea2e4ef23715cc4f79)) - ROM_LOAD( "90x8549.bin", 0xe0001, 0x8000, CRC(9e0f4a99) SHA1(b8600f04159ed281a57416274390ba9302be541b)) - ROM_LOAD( "90x8550.bin", 0xf0000, 0x8000, CRC(cb21df96) SHA1(0c2765f6becfa3f9171c4f13f7b74d19c4c9acc2)) - ROM_LOAD( "90x8551.bin", 0xf0001, 0x8000, CRC(3d7e9868) SHA1(2928fe0e48a573cc2c0c41bd7f7188a54a908229)) -ROM_END - -/* -8580-111 (Model 80) -=================== - Code Date Internal -AMI 8934MDL 15F6637 1987 --> 15F6597 -AMI 8944MDI 15F6639 1987 --> 15F6600 -*/ -ROM_START( i8580111 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "15f6637.bin", 0xe0000, 0x10000, CRC(76c36d1a) SHA1(c68d52a2e5fbd303225ebb006f91869b29ef700a)) - ROM_LOAD16_BYTE( "15f6639.bin", 0xe0001, 0x10000, CRC(82cf0f7d) SHA1(13bb39225757b89749af70e881af0228673dbe0c)) -ROM_END - -ROM_START( ibmps1es ) - ROM_REGION(0x1000000, "maincpu", 0) - ROM_LOAD16_BYTE( "ibm_1057757_24-05-90.bin", 0xc0000, 0x20000, CRC(c8f81ea4) SHA1(925ed0e98f9f2997cb86554ef384bcfaf2a4ecbe)) - ROM_LOAD16_BYTE( "ibm_1057757_29-15-90.bin", 0xc0001, 0x20000, CRC(c2dd6b5c) SHA1(f6b5785002dd628b6b1fb3bb101e076299eba3b6)) -ROM_END - -ROM_START( at ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "ami211", "AMI 21.1") /*(Motherboard Manufacturer: Dataexpert Corp. Motherboard) (Neat 286 Bios, 82c21x Chipset ) (BIOS release date:: 09-04-1990)*/ - ROMX_LOAD( "ami211.bin", 0xf0000, 0x10000,CRC(a0b5d269) SHA1(44db8227d35a09e39b93ed944f85dcddb0dd0d39), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "at", "PC 286") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 03-11-1987)*/ - ROMX_LOAD("at110387.1", 0xf0001, 0x8000, CRC(679296a7) SHA1(ae891314cac614dfece686d8e1d74f4763cf40e3),ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD("at110387.0", 0xf0000, 0x8000, CRC(65ae1f97) SHA1(91a29c7deecf7a9afbba330e64e0eee9aafee4d1),ROM_SKIP(1) | ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "ami206", "AMI C 206.1") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 15-10-1990)*/ - ROMX_LOAD( "amic206.bin", 0xf0000, 0x10000,CRC(25a67c34) SHA1(91e9d8cdc2f1b40a601a23ceaff2189fd1245f3b), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "amic21", "AMI C 21.1") /* bad dump, checksum off by 8 in the lsb*/ - ROMX_LOAD( "amic21-2.bin", 0xf0001, 0x8000, CRC(8ffe7752) SHA1(68215f07a170ee7bdcb3e52b370d470af1741f7e),ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "amic21-1.bin", 0xf0000, 0x8000, CRC(5644ed38) SHA1(963555ec77845defc3b42b433280908e1797076e),ROM_SKIP(1) | ROM_BIOS(4) ) - ROM_SYSTEM_BIOS(4, "ami101", "AMI HT 101.1") /* Quadtel Enhanced 286 Bios Version 3.04.02 */ - ROMX_LOAD( "amiht-h.bin", 0xf0001, 0x8000, CRC(8022545f) SHA1(42541d4392ad00b0e064b3a8ccf2786d875c7c19),ROM_SKIP(1) | ROM_BIOS(5) ) - ROMX_LOAD( "amiht-l.bin", 0xf0000, 0x8000, CRC(285f6b8f) SHA1(2fce4ec53b68c9a7580858e16c926dc907820872),ROM_SKIP(1) | ROM_BIOS(5) ) - ROM_SYSTEM_BIOS(5, "ami121", "AMI HT 12.1") - ROMX_LOAD( "ami2od86.bin", 0xf0001, 0x8000, CRC(04a2cec4) SHA1(564d37a8b2c0f4d0e23cd1e280a09d47c9945da8),ROM_SKIP(1) | ROM_BIOS(6) ) - ROMX_LOAD( "ami2ev86.bin", 0xf0000, 0x8000, CRC(55deb5c2) SHA1(19ce1a7cc985b5895c585e39211475de2e3b0dd1),ROM_SKIP(1) | ROM_BIOS(6) ) - ROM_SYSTEM_BIOS(6, "ami122", "AMI HT 12.2") - ROMX_LOAD( "ami2od89.bin", 0xf0001, 0x8000, CRC(7c81bbe8) SHA1(a2c7eca586f6e2e76b9101191e080a1f1cb8b833),ROM_SKIP(1) | ROM_BIOS(7) ) - ROMX_LOAD( "ami2ev89.bin", 0xf0000, 0x8000, CRC(705d36e0) SHA1(0c9cfb71ced4587f109b9b6dfc2a9c92302fdb99),ROM_SKIP(1) | ROM_BIOS(7) ) - ROM_SYSTEM_BIOS(7, "ami123", "AMI HT 12.3") /*(Motherboard Manufacturer: Aquarius Systems USA Inc.) (BIOS release date:: 13-06-1990)*/ - ROMX_LOAD( "ht12h.bin", 0xf0001, 0x8000, CRC(db8b471e) SHA1(7b5fa1c131061fa7719247db3e282f6d30226778),ROM_SKIP(1) | ROM_BIOS(8) ) - ROMX_LOAD( "ht12l.bin", 0xf0000, 0x8000, CRC(74fd178a) SHA1(97c8283e574abbed962b701f3e8091fb82823b80),ROM_SKIP(1) | ROM_BIOS(8) ) - ROM_SYSTEM_BIOS(8, "ami181", "AMI HT 18.1") /* not a bad dump, sets unknown probably chipset related registers at 0x1e8 before failing post */ - ROMX_LOAD( "ht18.bin", 0xf0000, 0x10000, CRC(f65a6f9a) SHA1(7dfdf7d243f9f645165dc009c5097dd515f86fbb), ROM_BIOS(9) ) - ROM_SYSTEM_BIOS(9, "amiht21", "AMI HT 21.1") /* as above */ - ROMX_LOAD( "ht21e.bin", 0xf0000, 0x10000, CRC(e80f7fed) SHA1(62d958d98c95e9e4d1b290a6c1054ae98770f276), ROM_BIOS(10) ) - ROM_SYSTEM_BIOS(10, "amip1", "AMI P.1") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 09-04-1990)*/ - ROMX_LOAD( "poisk-h.bin", 0xf0001, 0x8000, CRC(83fd3f8c) SHA1(ca94850bbd949b97b11710629886b0ee69489a81),ROM_SKIP(1) | ROM_BIOS(11) ) - ROMX_LOAD( "poisk-l.bin", 0xf0000, 0x8000, CRC(0b2ed291) SHA1(bb51a3f317cf4d429a6cfb44a46ca0ac39d9aaa7),ROM_SKIP(1) | ROM_BIOS(11) ) - ROM_SYSTEM_BIOS(11, "aw201", "Award 201") - ROMX_LOAD( "83201-5h.bin", 0xf0001, 0x8000, CRC(968d1fc0) SHA1(dc4122a6c696f0b43e7894dc1b669346eed755d5),ROM_SKIP(1) | ROM_BIOS(12) ) - ROMX_LOAD( "83201-5l.bin", 0xf0000, 0x8000, CRC(bf50a89a) SHA1(2349a1db6017a7fb0673e99d3680c8753407be8d),ROM_SKIP(1) | ROM_BIOS(12) ) - ROM_SYSTEM_BIOS(12, "aw303", "Award 303 NFS") - ROMX_LOAD( "aw303-hi.bin", 0xf8001, 0x4000, CRC(78f32d7e) SHA1(1c88398fb171b33b7e6191bad63704ae85bfed8b), ROM_SKIP(1) | ROM_BIOS(13) ) - ROMX_LOAD( "aw303-lo.bin", 0xf8000, 0x4000, CRC(3d2a70c0) SHA1(1329113bec514ed2a6d803067b1132744ef534dd), ROM_SKIP(1) | ROM_BIOS(13) ) - ROM_SYSTEM_BIOS(13, "aw303gs", "Award 303GS") - ROMX_LOAD( "aw303gs-hi.bin", 0xf8001, 0x4000, CRC(82392e18) SHA1(042453b7b29933a1b72301d21fcf8fa6b293c9c9), ROM_SKIP(1) | ROM_BIOS(14) ) - ROMX_LOAD( "aw303gs-lo.bin", 0xf8000, 0x4000, CRC(a4cf8ba1) SHA1(b73e34be3b2754aaed1ac06471f4441fea06c67c), ROM_SKIP(1) | ROM_BIOS(14) ) -ROM_END - -ROM_START( cmdpc30 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROMX_LOAD( "commodore pc 30 iii even.bin", 0xf8000, 0x4000, CRC(36307aa9) SHA1(50237ffea703b867de426ab9ebc2af46bac1d0e1),ROM_SKIP(1)) - ROMX_LOAD( "commodore pc 30 iii odd.bin", 0xf8001, 0x4000, CRC(41bae42d) SHA1(27d6ad9554be86359d44331f25591e3122a31519),ROM_SKIP(1)) -ROM_END - -ROM_START( atvga ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "vl82c", "VL82C311L-FC4")/*(Motherboard Manufacturer: Biostar Microtech Corp.) (BIOS release date: 05-05-1991)*/ - ROMX_LOAD( "2vlm001.bin", 0xf0000, 0x10000, CRC(f34d800a) SHA1(638aca592a0e525f957beb525e95ca666a994ee8), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "ami211", "AMI 21.1") /*(Motherboard Manufacturer: Dataexpert Corp. Motherboard) (Neat 286 Bios, 82c21x Chipset ) (BIOS release date:: 09-04-1990)*/ - ROMX_LOAD( "ami211.bin", 0xf0000, 0x10000,CRC(a0b5d269) SHA1(44db8227d35a09e39b93ed944f85dcddb0dd0d39), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "ami206", "AMI C 206.1") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 15-10-1990)*/ - ROMX_LOAD( "amic206.bin", 0xf0000, 0x10000,CRC(25a67c34) SHA1(91e9d8cdc2f1b40a601a23ceaff2189fd1245f3b), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "amic21", "AMI C 21.1") /* bad dump, checksum off by 8 in the lsb*/ - ROMX_LOAD( "amic21-2.bin", 0xf0001, 0x8000, CRC(8ffe7752) SHA1(68215f07a170ee7bdcb3e52b370d470af1741f7e),ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "amic21-1.bin", 0xf0000, 0x8000, CRC(5644ed38) SHA1(963555ec77845defc3b42b433280908e1797076e),ROM_SKIP(1) | ROM_BIOS(4) ) - ROM_SYSTEM_BIOS(4, "ami101", "AMI HT 101.1") /* Quadtel Enhanced 286 Bios Version 3.04.02 */ - ROMX_LOAD( "amiht-h.bin", 0xf0001, 0x8000, CRC(8022545f) SHA1(42541d4392ad00b0e064b3a8ccf2786d875c7c19),ROM_SKIP(1) | ROM_BIOS(5) ) - ROMX_LOAD( "amiht-l.bin", 0xf0000, 0x8000, CRC(285f6b8f) SHA1(2fce4ec53b68c9a7580858e16c926dc907820872),ROM_SKIP(1) | ROM_BIOS(5) ) - ROM_SYSTEM_BIOS(5, "ami121", "AMI HT 12.1") - ROMX_LOAD( "ami2od86.bin", 0xf0001, 0x8000, CRC(04a2cec4) SHA1(564d37a8b2c0f4d0e23cd1e280a09d47c9945da8),ROM_SKIP(1) | ROM_BIOS(6) ) - ROMX_LOAD( "ami2ev86.bin", 0xf0000, 0x8000, CRC(55deb5c2) SHA1(19ce1a7cc985b5895c585e39211475de2e3b0dd1),ROM_SKIP(1) | ROM_BIOS(6) ) - ROM_SYSTEM_BIOS(6, "ami122", "AMI HT 12.2") - ROMX_LOAD( "ami2od89.bin", 0xf0001, 0x8000, CRC(7c81bbe8) SHA1(a2c7eca586f6e2e76b9101191e080a1f1cb8b833),ROM_SKIP(1) | ROM_BIOS(7) ) - ROMX_LOAD( "ami2ev89.bin", 0xf0000, 0x8000, CRC(705d36e0) SHA1(0c9cfb71ced4587f109b9b6dfc2a9c92302fdb99),ROM_SKIP(1) | ROM_BIOS(7) ) - ROM_SYSTEM_BIOS(7, "ami123", "AMI HT 12.3") /*(Motherboard Manufacturer: Aquarius Systems USA Inc.) (BIOS release date:: 13-06-1990)*/ - ROMX_LOAD( "ht12h.bin", 0xf0001, 0x8000, CRC(db8b471e) SHA1(7b5fa1c131061fa7719247db3e282f6d30226778),ROM_SKIP(1) | ROM_BIOS(8) ) - ROMX_LOAD( "ht12l.bin", 0xf0000, 0x8000, CRC(74fd178a) SHA1(97c8283e574abbed962b701f3e8091fb82823b80),ROM_SKIP(1) | ROM_BIOS(8) ) - ROM_SYSTEM_BIOS(8, "ami181", "AMI HT 18.1") /* not a bad dump, sets unknown probably chipset related registers at 0x1e8 before failing post */ - ROMX_LOAD( "ht18.bin", 0xf0000, 0x10000, CRC(f65a6f9a) SHA1(7dfdf7d243f9f645165dc009c5097dd515f86fbb), ROM_BIOS(9) ) - ROM_SYSTEM_BIOS(9, "amiht21", "AMI HT 21.1") /* as above */ - ROMX_LOAD( "ht21e.bin", 0xf0000, 0x10000, CRC(e80f7fed) SHA1(62d958d98c95e9e4d1b290a6c1054ae98770f276), ROM_BIOS(10) ) - ROM_SYSTEM_BIOS(10, "amip1", "AMI P.1") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 09-04-1990)*/ - ROMX_LOAD( "poisk-h.bin", 0xf0001, 0x8000, CRC(83fd3f8c) SHA1(ca94850bbd949b97b11710629886b0ee69489a81),ROM_SKIP(1) | ROM_BIOS(11) ) - ROMX_LOAD( "poisk-l.bin", 0xf0000, 0x8000, CRC(0b2ed291) SHA1(bb51a3f317cf4d429a6cfb44a46ca0ac39d9aaa7),ROM_SKIP(1) | ROM_BIOS(11) ) - ROM_SYSTEM_BIOS(11, "ami1131", "AMI-1131") /*(Motherboard Manufacturer: Elitegroup Computer Co., Ltd.) (BIOS release date:: 09-04-1990)*/ - ROMX_LOAD( "2hlm003h.bin", 0xf0001, 0x8000, CRC(2babb42b) SHA1(3da6538f44b434cdec0cbdddd392ccfd34666f06),ROM_SKIP(1) | ROM_BIOS(12) ) - ROMX_LOAD( "2hlm003l.bin", 0xf0000, 0x8000, CRC(317cbcbf) SHA1(1adad6280d8b07c2921fc5fc13ecaa10e6bfebdc),ROM_SKIP(1) | ROM_BIOS(12) ) - ROM_SYSTEM_BIOS(12, "at", "PC 286") /*(Motherboard Manufacturer: Unknown.) (BIOS release date:: 03-11-1987)*/ - ROMX_LOAD("at110387.1", 0xf0001, 0x8000, CRC(679296a7) SHA1(ae891314cac614dfece686d8e1d74f4763cf40e3),ROM_SKIP(1) | ROM_BIOS(13) ) - ROMX_LOAD("at110387.0", 0xf0000, 0x8000, CRC(65ae1f97) SHA1(91a29c7deecf7a9afbba330e64e0eee9aafee4d1),ROM_SKIP(1) | ROM_BIOS(13) ) -ROM_END - -ROM_START( xb42639 ) - /* actual VGA BIOS not dumped*/ - ROM_REGION(0x1000000, "maincpu", 0) - // XEN-S (Venus I Motherboard) - ROM_LOAD16_BYTE("3-10-17i.lo", 0xf0000, 0x8000, CRC(3786ca1e) SHA1(c682d7c76f234559d03bcf21010c13c4dbeafb69)) - ROM_RELOAD(0xff0000,0x8000) - ROM_LOAD16_BYTE("3-10-17i.hi", 0xf0001, 0x8000, CRC(d66710eb) SHA1(e8c1cd5f9ecfbd8825655e416d7ddf2ae362e69b)) - ROM_RELOAD(0xff0001,0x8000) -ROM_END - -ROM_START( xb42639a ) - /* actual VGA BIOS not dumped*/ - ROM_REGION(0x1000000, "maincpu", 0) - // XEN-S (Venus II Motherboard) - ROM_LOAD16_BYTE("10217.lo", 0xf0000, 0x8000, CRC(ea53406f) SHA1(2958dfdbda14de4e6b9d6a8c3781131ab1e32bef)) - ROM_RELOAD(0xff0000,0x8000) - ROM_LOAD16_BYTE("10217.hi", 0xf0001, 0x8000, CRC(111725cf) SHA1(f6018a45bda4476d40c5881fb0a506ff75ec1688)) - ROM_RELOAD(0xff0001,0x8000) -ROM_END - -ROM_START( xb42664 ) - /* actual VGA BIOS not dumped */ - ROM_REGION(0x1000000, "maincpu", 0) - // XEN-S (Venus I Motherboard) - ROM_LOAD16_BYTE("3-10-17i.lo", 0xf0000, 0x8000, CRC(3786ca1e) SHA1(c682d7c76f234559d03bcf21010c13c4dbeafb69)) - ROM_RELOAD(0xff0000,0x8000) - ROM_LOAD16_BYTE("3-10-17i.hi", 0xf0001, 0x8000, CRC(d66710eb) SHA1(e8c1cd5f9ecfbd8825655e416d7ddf2ae362e69b)) - ROM_RELOAD(0xff0001,0x8000) -ROM_END - -ROM_START( xb42664a ) - /* actual VGA BIOS not dumped*/ - ROM_REGION(0x1000000, "maincpu", 0) - // XEN-S (Venus II Motherboard) - ROM_LOAD16_BYTE("10217.lo", 0xf0000, 0x8000, CRC(ea53406f) SHA1(2958dfdbda14de4e6b9d6a8c3781131ab1e32bef)) - ROM_RELOAD(0xff0000,0x8000) - ROM_LOAD16_BYTE("10217.hi", 0xf0001, 0x8000, CRC(111725cf) SHA1(f6018a45bda4476d40c5881fb0a506ff75ec1688)) - ROM_RELOAD(0xff0001,0x8000) -ROM_END - - -ROM_START( neat ) - ROM_REGION(0x1000000,"maincpu", 0) - //ROM_SYSTEM_BIOS(0, "neat286", "NEAT 286") - ROM_LOAD16_BYTE("at030389.0", 0xf0000, 0x8000, CRC(4c36e61d) SHA1(094e8d5e6819889163cb22a2cf559186de782582)) - //ROM_RELOAD(0xff0000,0x8000) - ROM_LOAD16_BYTE("at030389.1", 0xf0001, 0x8000, CRC(4e90f294) SHA1(18c21fd8d7e959e2292a9afbbaf78310f9cad12f)) - //ROM_RELOAD(0xff0001,0x8000) -ROM_END - -ROM_START( ct386sx ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "neatsx", "NEATsx 386sx") - ROMX_LOAD("012l-u25.bin", 0xf0000, 0x8000, CRC(4ab1862d) SHA1(d4e8d0ff43731270478ca7671a129080ff350a4f),ROM_SKIP(1) | ROM_BIOS(1) ) - ROMX_LOAD("012h-u24.bin", 0xf0001, 0x8000, CRC(17472521) SHA1(7588c148fe53d9dc4cb2d0ab6e0fd51a39bb5d1a),ROM_SKIP(1) | ROM_BIOS(1) ) - ROM_FILL(0xfe2c9, 1, 0) // skip incompatible keyboard controller test - ROM_FILL(0xfe2cb, 1, 0xbb) // fix checksum -ROM_END - -ROM_START( at386 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "ami386", "AMI 386") - ROMX_LOAD("ami386.bin", 0xf0000, 0x10000, CRC(3a807d7f) SHA1(8289ba36a3dfc3324333b1a834bc6b0402b546f0), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "at386", "unknown 386") // This dump possibly comes from a MITAC INC 386 board, given that the original driver had it as manufacturer - ROMX_LOAD("at386.bin", 0xf0000, 0x10000, CRC(3df9732a) SHA1(def71567dee373dc67063f204ef44ffab9453ead), ROM_BIOS(2)) - //ROM_RELOAD(0xff0000,0x10000) - - ROM_SYSTEM_BIOS(2, "amicg", "AMI CG") - ROMX_LOAD( "amicg.1", 0xf0000, 0x10000,CRC(8408965a) SHA1(9893d3ac851e01b06a68a67d3721df36ca2c96f5), ROM_BIOS(3) ) -ROM_END - - -ROM_START( at486 ) - ROM_REGION(0x1000000, "maincpu", 0) - - ROM_SYSTEM_BIOS(0, "at486", "PC/AT 486") - ROMX_LOAD("at486.bin", 0x0f0000, 0x10000, CRC(31214616) SHA1(51b41fa44d92151025fc9ad06e518e906935e689), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "mg48602", "UMC MG-48602") - ROMX_LOAD("mg48602.bin", 0x0f0000, 0x10000, CRC(45797823) SHA1(a5fab258aecabde615e1e97af5911d6cf9938c11), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "ft01232", "Free Tech 01-232") - ROMX_LOAD("ft01232.bin", 0x0f0000, 0x10000, CRC(30efaf92) SHA1(665c8ef05ca052dcc06bb473c9539546bfef1e86), ROM_BIOS(3)) - - /* 486 boards from FIC - - naming convention - xxxxx101 --> for EPROM - xxxxx701 --> for EEPROM using a Flash Utility v5.02 - xxxxBxxx --> NS 311/312 IO Core Logic - xxxxCxxx --> NS 332 IO Core Logic - xxxxGxxx --> Winbond W83787F IO Core Logic - xxxxJxxx --> Winbond W83877F IO Core Logic - - */ - - /* this is the year 2000 beta bios from FIC, supports GIO-VT, GAC-V, GAC-2, VIP-IO, VIO-VP and GVT-2 */ - ROM_SYSTEM_BIOS(3, "ficy2k", "FIC 486 3.276GN1") /* 1997-06-16, includes CL-GD5429 VGA BIOS 1.00a */ - ROMX_LOAD("3276gn1.bin", 0x0e0000, 0x20000, CRC(d4ff0cc4) SHA1(567b6bdbc9bff306c8c955f275e01ae4c45fd5f2), ROM_BIOS(4)) - - ROM_SYSTEM_BIOS(4, "ficgac2", "FIC 486-GAC-2") /* 1994-04-29, includes CL-GD542X VGA BIOS 1.50 */ - ROMX_LOAD("att409be.bin", 0x0e0000, 0x20000, CRC(c58e017b) SHA1(14c19e720ce62eb2afe28a70f4e4ebafab0f9e77), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "ficgacv", "FIC 486-GAC-V 3.27GN1") /* 1996-04-08, includes CL-GD542X VGA BIOS 1.41 */ - ROMX_LOAD("327gn1.awd", 0x0e0000, 0x20000, CRC(017614d4) SHA1(2228c28f21a7e78033d24319449297936465b164), ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "ficgiovp", "FIC 486-GIO-VP 3.15GN") /* 1994-05-06 */ - ROMX_LOAD("giovp315.rom", 0x0f0000, 0x10000, CRC(e102c3f5) SHA1(f15a7e9311cc17afe86da0b369607768b030ddec), ROM_BIOS(7)) - ROM_SYSTEM_BIOS(7, "ficgiovt", "FIC 486-GIO-VT 3.06G") /* 1994-11-20 */ - ROMX_LOAD("306gcd00.awd", 0x0f0000, 0x10000, CRC(75f3ded4) SHA1(999d4b58204e0b0f33262d0613c855b528bf9597), ROM_BIOS(8)) - - ROM_SYSTEM_BIOS(8, "ficgiovt2_326", "FIC 486-GIO-VT2 3.26G") /* 1994-07-06 */ - ROMX_LOAD("326g1c00.awd", 0x0f0000, 0x10000, CRC(2e729ab5) SHA1(b713f97fa0e0b62856dab917f417f5b21020b354), ROM_BIOS(9)) - ROM_SYSTEM_BIOS(9, "ficgiovt2_3276", "FIC 486-GIO-VT2 3.276") /* 1997-07-17 */ - ROMX_LOAD("32760000.bin", 0x0f0000, 0x10000, CRC(ad179128) SHA1(595f67ba4a1c8eb5e118d75bf657fff3803dcf4f), ROM_BIOS(10)) - - ROM_SYSTEM_BIOS(10, "ficgvt2", "FIC 486-GVT-2 3.07G") /* 1994-11-02 */ - ROMX_LOAD("3073.bin", 0x0f0000, 0x10000, CRC(a6723863) SHA1(ee93a2f1ec84a3d67e267d0a490029f9165f1533), ROM_BIOS(11)) - ROM_SYSTEM_BIOS(11, "ficgpak2", "FIC 486-PAK-2 5.15S") /* 1995-06-27, includes Phoenix S3 TRIO64 Enhanced VGA BIOS 1.4-01 */ - ROMX_LOAD("515sbd8a.awd", 0x0e0000, 0x20000, CRC(778247e1) SHA1(07d8f0f2464abf507be1e8dfa06cd88737782411), ROM_BIOS(12)) - - ROM_SYSTEM_BIOS(12, "ficpio3g7", "FIC 486-PIO-3 1.15G705") /* pnp */ - ROMX_LOAD("115g705.awd", 0x0e0000, 0x20000, CRC(ddb1544a) SHA1(d165c9ecdc9397789abddfe0fef69fdf954fa41b), ROM_BIOS(13)) - ROM_SYSTEM_BIOS(13, "ficpio3g1", "FIC 486-PIO-3 1.15G105") /* non-pnp */ - ROMX_LOAD("115g105.awd", 0x0e0000, 0x20000, CRC(b327eb83) SHA1(9e1ff53e07ca035d8d43951bac345fec7131678d), ROM_BIOS(14)) - - ROM_SYSTEM_BIOS(14, "ficpos", "FIC 486-POS") - ROMX_LOAD("116di6b7.bin", 0x0e0000, 0x20000, CRC(d1d84616) SHA1(2f2b27ce100cf784260d8e155b48db8cfbc63285), ROM_BIOS(15)) - ROM_SYSTEM_BIOS(15, "ficpvt", "FIC 486-PVT 5.15") /* 1995-06-27 */ - ROMX_LOAD("5150eef3.awd", 0x0e0000, 0x20000, CRC(eb35785d) SHA1(1e601bc8da73f22f11effe9cdf5a84d52576142b), ROM_BIOS(16)) - ROM_SYSTEM_BIOS(16, "ficpvtio", "FIC 486-PVT-IO 5.162W2") /* 1995-10-05 */ - ROMX_LOAD("5162cf37.awd", 0x0e0000, 0x20000, CRC(378d813d) SHA1(aa674eff5b972b31924941534c3c988f6f78dc93), ROM_BIOS(17)) - ROM_SYSTEM_BIOS(17, "ficvipio426", "FIC 486-VIP-IO 4.26GN2") /* 1994-12-07 */ - ROMX_LOAD("426gn2.awd", 0x0e0000, 0x20000, CRC(5f472aa9) SHA1(9160abefae32b450e973651c052657b4becc72ba), ROM_BIOS(18)) - ROM_SYSTEM_BIOS(18, "ficvipio427", "FIC 486-VIP-IO 4.27GN2A") /* 1996-02-14 */ - ROMX_LOAD("427gn2a.awd", 0x0e0000, 0x20000, CRC(035ad56d) SHA1(0086db3eff711fc710b30e7f422fc5b4ab8d47aa), ROM_BIOS(19)) - ROM_SYSTEM_BIOS(19, "ficvipio2", "FIC 486-VIP-IO2") - ROMX_LOAD("1164g701.awd", 0x0e0000, 0x20000, CRC(7b762683) SHA1(84debce7239c8b1978246688ae538f7c4f519d13), ROM_BIOS(20)) - - ROM_SYSTEM_BIOS(20, "qdi", "QDI PX486DX33/50P3") - ROMX_LOAD("qdi_px486.u23", 0x0f0000, 0x10000, CRC(c80ecfb6) SHA1(34cc9ef68ff719cd0771297bf184efa83a805f3e), ROM_BIOS(21)) -ROM_END - - -// FIC 486-PIO-2 (4 ISA, 4 PCI) -// VIA VT82C505 (ISA/VL to PCI bridge) + VT82C496G (system chipset) + VT82C406MV (keyboard controller, RTC, CMOS), NS311/312 or NS332 I/O -ROM_START( ficpio2 ) - ROM_REGION(0x40000, "isa", 0) - ROM_SYSTEM_BIOS(0, "ficpio2c7", "FIC 486-PIO-2 1.15C701") /* pnp, i/o core: NS 332, doesn't boot, requires cache emulation? */ - ROMX_LOAD("115c701.awd", 0x020000, 0x20000, CRC(b0dd7975) SHA1(bfde13b0fbd141bc945d37d92faca9f4f59b716d), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "ficpio2b7", "FIC 486-PIO-2 1.15B701") /* pnp, i/o core: NS 311/312, doesn't boot, requires cache emulation? */ - ROMX_LOAD("115b701.awd", 0x020000, 0x20000, CRC(ac24abad) SHA1(01174d84ed32fb1d95cd632d09f773acb8666c83), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "ficpio2c1", "FIC 486-PIO-2 1.15C101") /* non-pnp, i/o core: NS 332, working */ - ROMX_LOAD("115c101.awd", 0x020000, 0x20000, CRC(5fadde88) SHA1(eff79692c1ecf34b6ea3f02409d14ce1f5c51bf9), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "ficpio2b1", "FIC 486-PIO-2 1.15B101") /* non-pnp, i/o core: NS 311/312, working */ - ROMX_LOAD("115b101.awd", 0x020000, 0x20000, CRC(ff69617d) SHA1(ecbfc7315dcf6bd3e5b59e3ae9258759f64fe7a0), ROM_BIOS(4)) -ROM_END - - -ROM_START( at586 ) - ROM_REGION32_LE(0x40000, "isa", 0) - ROM_SYSTEM_BIOS(0, "sptx", "SP-586TX") - ROMX_LOAD("sp586tx.bin", 0x20000, 0x20000, CRC(1003d72c) SHA1(ec9224ff9b0fdfd6e462cb7bbf419875414739d6), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "unisys", "Unisys 586") // probably bad dump due to need of hack in i82439tx to work - ROMX_LOAD("at586.bin", 0x20000, 0x20000, CRC(717037f5) SHA1(1d49d1b7a4a40d07d1a897b7f8c827754d76f824), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS(2, "ga586t2", "Gigabyte GA-586T2") // ITE 8679 I/O - ROMX_LOAD("gb_ga586t2.bin", 0x20000, 0x20000, CRC(3a50a6e1) SHA1(dea859b4f1492d0d08aacd260ed1e83e00ebac08), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "5tx52", "Acorp 5TX52") // W83877TF I/O - ROMX_LOAD("acorp_5tx52.bin", 0x20000, 0x20000, CRC(04d69419) SHA1(983377674fef05e710c8665c14cc348c99166fb6), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "txp4", "ASUS TXP4") // W83977TF-A I/O - ROMX_LOAD("asus_txp4.bin", 0x20000, 0x20000, CRC(a1321bb1) SHA1(92e5f14d8505119f85b148a63510617ac12bcdf3), ROM_BIOS(5)) -ROM_END - -ROM_START( at586x3 ) - ROM_REGION32_LE(0x40000, "isa", 0) - ROM_LOAD("5hx29.bin", 0x20000, 0x20000, CRC(07719a55) SHA1(b63993fd5186cdb4f28c117428a507cd069e1f68)) -ROM_END - -ROM_START( c386sx16 ) - ROM_REGION(0x1000000,"maincpu", 0) - /* actual VGA BIOS not dumped - uses a WD Paradise according to http://www.cbmhardware.de/pc/pc.php */ - - /* Commodore 80386SX BIOS Rev. 1.03 */ - /* Copyright (C) 1985-1990 Commodore Electronics Ltd. */ - /* Copyright (C) 1985-1990 Phoenix Technologies Ltd. */ - ROM_LOAD16_BYTE( "390914-01.u39", 0xf0000, 0x8000, CRC(8f849198) SHA1(550b04bac0d0807d6e95ec25391a81272779b41b)) /* 390914-01 V1.03 CS-2100 U39 Copyright (C) 1990 CBM */ - ROM_LOAD16_BYTE( "390915-01.u38", 0xf0001, 0x8000, CRC(ee4bad92) SHA1(6e02ef97a7ce336485814c06a1693bc099ce5cfb)) /* 390915-01 V1.03 CS-2100 U38 Copyright (C) 1990 CBM */ -ROM_END - -ROM_START( xb42663 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "qi310223.lo", 0xe0000, 0x10000, CRC(53047f49) SHA1(7b38e533f7f27295269549c63e5477d950239167)) - ROM_LOAD16_BYTE( "qi310223.hi", 0xe0001, 0x10000, CRC(4852869f) SHA1(98599d4691d40b3fac2936034c70b386ce4caf77)) -ROM_END - -ROM_START( qi600 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "qi610223.lo", 0xe0000, 0x10000, CRC(563114a9) SHA1(62932b3bf0b5502ff708f604c21773f00afda58e)) - ROM_LOAD16_BYTE( "qi610223.hi", 0xe0001, 0x10000, CRC(0ae133f6) SHA1(6039c366f7fe0ebf60b34c1a7d6b2d781b664001)) -ROM_END - -ROM_START( qi900 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "qi910224.lo", 0xe0000, 0x10000, CRC(b012ad3c) SHA1(807e788a6bd03f5e983fe503af3d0b202c754b8a)) - ROM_LOAD16_BYTE( "qi910224.hi", 0xe0001, 0x10000, CRC(36e66d56) SHA1(0900c5272ec3ced550f18fb08db59ab7f67a621e)) -ROM_END - -ROM_START( ftsserv ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "fts10226.lo", 0xe0000, 0x10000, CRC(efbd738f) SHA1(d5258760bafdaf1bf13c4a49da76d4b5e7b4ccbd)) - ROM_LOAD16_BYTE( "fts10226.hi", 0xe0001, 0x10000, CRC(2460853f) SHA1(a6bba8d2f800140afd129c4d5278f7ae8fe7e63a)) - /* FT Server series Front Panel */ - ROM_REGION(0x10000,"front", 0) - ROM_LOAD( "fp10009.bin", 0x0000, 0x8000, CRC(8aa7f718) SHA1(9ee6c6a5bb92622ea8d3805196d42ff68887d820)) -ROM_END - -ROM_START( apxenls3 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "31020.lo", 0xf0000, 0x8000, CRC(a19678d2) SHA1(d13c12fa7e94333555eabf58b81bad421e21cd91)) - ROM_LOAD16_BYTE( "31020.hi", 0xf0001, 0x8000, CRC(4922e020) SHA1(64e6448323dad2209e004cd93fa181582e768ed5)) -ROM_END - -ROM_START( aplanst ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "31024", "Bios 3-10-24") - ROMX_LOAD("31024.lo", 0xf0000, 0x8000, CRC(e52b59e1) SHA1(cfcaa4d8d658df8df463108ef30695bd4ee7a617), ROM_SKIP(1) | ROM_BIOS(1) ) - ROMX_LOAD("31024.hi", 0xf0001, 0x8000, CRC(7286aefa) SHA1(dfc0e3f4936780fa62ae9ec392ce17aa65e717cd), ROM_SKIP(1) | ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "31025", "Bios 3-10-25") - ROMX_LOAD("31025.lo", 0xf0000, 0x8000, CRC(1aec09bc) SHA1(51d56c97c7c1674554aa89b68945329ea967a8bc), ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD("31025.hi", 0xf0001, 0x8000, CRC(0763caa5) SHA1(48510a933dcd6efea3b14d04444f584c3e6fefeb), ROM_SKIP(1) | ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "31026", "Bios 3-10-26i") - ROMX_LOAD("31026i.lo", 0xf0000, 0x8000, CRC(670b6ab4) SHA1(8d61a0edf187f99b67eb58f5e11276deee801d17), ROM_SKIP(1) | ROM_BIOS(3) ) - ROMX_LOAD("31026i.hi", 0xf0001, 0x8000, CRC(ef01c54f) SHA1(911f95d65ab96878e5e7ebccfc4b329db47a1351), ROM_SKIP(1) | ROM_BIOS(3) ) -ROM_END - -ROM_START( aplannb ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "lsl31025.lo", 0xe0000, 0x10000, CRC(8bb7229b) SHA1(31449d12884ec4e7752e6c1ce7ce9e0d044eadf2)) - ROM_LOAD16_BYTE( "lsh31025.hi", 0xe0001, 0x10000, CRC(09e5c1b9) SHA1(d42be83b4181d3733268c29df04a4d2918370f4e)) -ROM_END - -ROM_START( apvxft ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "ft10221.lo", 0xe0000, 0x10000, CRC(8f339de0) SHA1(a6542406746eaf1ff7f9e3678c5cbe5522fb314a)) - ROM_LOAD16_BYTE( "ft10221.hi", 0xe0001, 0x10000, CRC(3b16bc31) SHA1(0592d1d81e7fd4715b0612083482db122d78c7f2)) -ROM_END - -ROM_START( aplscar ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "car306", "Caracal 3.06") - ROMX_LOAD("car306.bin", 0xc0000, 0x40000, CRC(fc271dea) SHA1(6207cfd312c9957243b8157c90a952404e43b237), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "car307", "Caracal 3.07") - ROMX_LOAD("car307.bin", 0xc0000, 0x40000, CRC(66a01852) SHA1(b0a68c9d67921d27ba483a1c50463406c08d3085), ROM_BIOS(2)) -ROM_END - -ROM_START( apxena1 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD("a1-r26.bin", 0xe0000, 0x20000, CRC(d29e983e) SHA1(5977df7f8d7ac2a154aa043bb6f539d96d51fcad)) -ROM_END - -ROM_START( apxenp2 ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "p2r02g2", "p2r02g2") - ROMX_LOAD("p2r02g2.bin", 0xe0000, 0x20000, CRC(311bcc5a) SHA1(be6fa144322077dcf66b065e7f4e61aab8c278b4), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "lep121s", "SCSI-Enabling ROMs") - ROMX_LOAD("p2r01f0.bin", 0xe0000, 0x20000, CRC(bbc68f2e) SHA1(6954a52a7dda5521794151aff7a04225e9c7df77), ROM_BIOS(2)) -ROM_END - -ROM_START( apxeni ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "lep121", "Rom Bios 1.2.1") - ROMX_LOAD( "lep121.bin", 0xf8000, 0x8000, CRC(948c1927) SHA1(d06bdbd6292db73c815ad1060daf055293dfddf5), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "lep121s", "SCSI-Enabling ROMs") - ROMX_LOAD( "lep121s.bin", 0xf8000, 0x8000, CRC(296118e4) SHA1(d1feaa9704e6ce3bc10c900bdd310d9494b02304), ROM_BIOS(2)) -ROM_END - -ROM_START( aplsbon ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "bon106", "Boinsai 1-06") - ROMX_LOAD("bon106.bin", 0xe0000, 0x20000, CRC(98a4eb76) SHA1(e0587afa78aeb9a8803f9b9f9e457e9847b0a2b2), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "bon203", "Boinsai 2-03") - ROMX_LOAD("bon203.bin", 0xe0000, 0x20000, CRC(32a0e125) SHA1(a4fcbd76952599993fa8b76aa36a96386648abb2), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "bon10703", "Boinsai 1-07-03") - ROMX_LOAD("bon10703.bin", 0xe0000, 0x20000, CRC(0275b3c2) SHA1(55ef4cbb7f3166f678aaa478234a42049deaba5f), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "bon20402", "Boinsai 2.03") - ROMX_LOAD("bon20402.bin", 0xe0000, 0x20000, CRC(ac5803fb) SHA1(b8fe92711c6a38a5d9e6497e76a0929c1685c631), ROM_BIOS(4)) -ROM_END - -ROM_START( apxlsam ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "sam107", "ROM BIOS Version 1-07") - ROMX_LOAD("sam1-07.bin", 0xe0000, 0x20000, CRC(65e05a8e) SHA1(c3cd198a129122cb05a28798e54331b06cfdd310), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "sam206", "ROM BIOS Version 2-06") - ROMX_LOAD("sam2-06.bin", 0xe0000, 0x20000, CRC(9768bb0f) SHA1(8166b77b133072f72f23debf85984eb19578ffc1), ROM_BIOS(2)) -ROM_END - -/* FIC VT-503 (Intel TX chipset, ITE 8679 Super I/O) */ -ROM_START( ficvt503 ) - ROM_REGION32_LE(0x40000, "isa", 0) - ROM_SYSTEM_BIOS(0, "109gi13", "1.09GI13") /* 1997-10-02 */ - ROMX_LOAD("109gi13.bin", 0x20000, 0x20000, CRC(0c32af48) SHA1(2cce40a98598f1ed1f398975f7a90c8be4200667), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "109gi14", "1.09GI14") /* 1997-11-07 */ - ROMX_LOAD("109gi14.awd", 0x20000, 0x20000, CRC(588c5cc8) SHA1(710e5405850fd975b362a422bfe9bc6d6c9a36cd), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "109gi15", "1.09GI15") /* 1997-11-07 */ - ROMX_LOAD("109gi15.awd", 0x20000, 0x20000, CRC(649a3481) SHA1(e681c6ab55a67cec5978dfffa75fcddc2aa0de4d), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "109gi16", "1.09GI16") /* 2000-03-23 */ - ROMX_LOAD("109gi16.bin", 0x20000, 0x20000, CRC(a928f271) SHA1(127a83a60752cc33b3ca49774488e511ec7bac55), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "115gk140", "1.15GK140") /* 1999-03-03 */ - ROMX_LOAD("115gk140.awd", 0x20000, 0x20000, CRC(65e88956) SHA1(f94bb0732e00b5b0f18f4e349db24a289f8379c5), ROM_BIOS(5)) -ROM_END - -ROM_START( aprpand ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD( "pf10226.std", 0xe0000, 0x20000, CRC(7396fb87) SHA1(a109cbad2179eec55f86c0297a59bb015461da21)) -ROM_END - -ROM_START( aprfte ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD( "1-2r2-4.486", 0xe0000, 0x20000, CRC(bccc236d) SHA1(0765299363e68cf65710a688c360a087856ece8f)) -ROM_END - -ROM_START( megapc ) - ROM_REGION(0x40000, "isa", ROMREGION_ERASEFF) - ROM_REGION(0x100000, "bios", 0) - ROM_LOAD16_BYTE( "41651-bios lo.u18", 0xe0000, 0x10000, CRC(1e9bd3b7) SHA1(14fd39ec12df7fae99ccdb0484ee097d93bf8d95)) - ROM_LOAD16_BYTE( "211253-bios hi.u19", 0xe0001, 0x10000, CRC(6acb573f) SHA1(376d483db2bd1c775d46424e1176b24779591525)) -ROM_END - -ROM_START( megapcpl ) - ROM_REGION(0x40000, "isa", ROMREGION_ERASEFF) - ROM_REGION(0x100000, "bios", 0) - ROM_LOAD16_BYTE( "41652.u18", 0xe0000, 0x10000, CRC(6f5b9a1c) SHA1(cae981a35a01234fcec99a96cb38075d7bf23474)) - ROM_LOAD16_BYTE( "486slc.u19", 0xe0001, 0x10000, CRC(6fb7e3e9) SHA1(c439cb5a0d83176ceb2a3555e295dc1f84d85103)) -ROM_END - -ROM_START( megapcpla ) - ROM_REGION(0x40000, "isa", ROMREGION_ERASEFF) - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD( "megapc_bios.bin", 0xc0000, 0x10000, CRC(b84938a2) SHA1(cecab72a96993db4f7c648c229b4211a8c53a380)) - ROM_CONTINUE(0xf0000, 0x10000) -ROM_END - -ROM_START( t2000sx ) - ROM_REGION( 0x1000000, "maincpu", 0 ) - ROM_LOAD( "014d.ic9", 0xe0000, 0x20000, CRC(e9010b02) SHA1(75688fc8e222640fa22bcc90343c6966fe0da87f)) -ROM_END - -ROM_START( pc2386 ) - ROM_REGION( 0x1000000, "maincpu", 0 ) - ROM_LOAD( "c000.bin", 0xc0000, 0x4000, CRC(33145bbf) SHA1(c49eaec19f656482e12c8bf282cd4ee5986d227d) ) - ROM_LOAD( "f000.bin", 0xf0000, 0x10000, CRC(f54a063c) SHA1(ce70ec493053afab662f51199ef9c9304a209b8e) ) - - ROM_REGION( 0x2000, "gfx1", ROMREGION_ERASE00 ) - - ROM_REGION( 0x1000, "keyboard", 0 ) // PC2286 / PC2386 102-key keyboard - ROM_LOAD( "40211.ic801", 0x000, 0x1000, CRC(4440d981) SHA1(a76006a929f26c178e09908c66f28abc92e7744c) ) -ROM_END - -ROM_START( k286i ) - ROM_REGION(0x1000000,"maincpu", 0) - ROM_LOAD16_BYTE( "81_1598", 0xf8000, 0x4000, CRC(e25a1e43) SHA1(d00b976ac94323f3867b1c256e315839c906dd5a) ) - ROM_LOAD16_BYTE( "81_1599", 0xf8001, 0x4000, CRC(08e2a17b) SHA1(a86ef116e82eb9240e60b52f76e5e510cdd393fd) ) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1984, ibm5170, 0, ibm5150, ibm5170, atcga, at_state, atcga, "International Business Machines", "IBM PC/AT 5170", MACHINE_NOT_WORKING ) -COMP ( 1985, ibm5170a, ibm5170, 0, ibm5170a, atcga, at_state, atcga, "International Business Machines", "IBM PC/AT 5170 8MHz", MACHINE_NOT_WORKING ) -COMP ( 1985, ibm5162, ibm5170, 0, ibm5162, atcga, at_state, atcga, "International Business Machines", "IBM PC/XT-286 5162", MACHINE_NOT_WORKING ) -COMP ( 1990, i8530h31, ibm5170, 0, ps2m30286, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8530-H31 (Model 30/286)", MACHINE_NOT_WORKING ) -COMP ( 1988, i8530286, ibm5170, 0, ps2m30286, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 Model 30-286", MACHINE_NOT_WORKING ) -COMP ( 198?, i8535043, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8535-043 (Model 35)", MACHINE_NOT_WORKING ) -COMP ( 198?, i8550021, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8550-021 (Model 50)", MACHINE_NOT_WORKING ) -COMP ( 198?, i8550061, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8550-061 (Model 50Z)", MACHINE_NOT_WORKING ) -COMP ( 1989, i8555081, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8550-081 (Model 55SX)", MACHINE_NOT_WORKING ) -COMP ( 198?, i8580071, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8580-071 (Model 80)", MACHINE_NOT_WORKING ) -COMP ( 198?, i8580111, ibm5170, 0, at386, atvga, at_state, atvga, "International Business Machines", "IBM PS/2 8580-111 (Model 80)", MACHINE_NOT_WORKING ) -COMP ( 1989, ibmps1es, ibm5170, 0, ibmps1, atvga, at_state, atvga, "International Business Machines", "IBM PS/1 (Spanish)", MACHINE_NOT_WORKING ) -COMP ( 1987, at, ibm5170, 0, ibm5162, atcga, at_state, atcga, "", "PC/AT (CGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) -COMP ( 1987, atvga, ibm5170, 0, atvga, atvga, at_state, atvga, "", "PC/AT (VGA, MF2 Keyboard)" , MACHINE_NOT_WORKING ) -COMP ( 1988, at386, ibm5170, 0, at386, atvga, at_state, atvga, "", "PC/AT 386 (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) -COMP ( 1988, ct386sx, ibm5170, 0, ct386sx, atvga, at_state, atvga, "", "NEAT 386SX (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) -//COMP ( 1988, at386sx, ibm5170, 0, ct386sx, atvga, at_state, atvga, "", "PC/AT 386SX (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) -COMP ( 1990, at486, ibm5170, 0, at486, atvga, at_state, atvga, "", "PC/AT 486 (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) -COMP ( 1990, at586, ibm5170, 0, at586, atvga, at586_state, at586, "", "PC/AT 586 (PIIX4)", MACHINE_NOT_WORKING ) -COMP ( 1990, at586x3, ibm5170, 0, at586x3, atvga, at586_state, at586, "", "PC/AT 586 (PIIX3)", MACHINE_NOT_WORKING ) -COMP ( 1989, neat, ibm5170, 0, neat, atvga, at_state, atvga, "", "NEAT (VGA, MF2 Keyboard)", MACHINE_NOT_WORKING ) -COMP ( 1989, ec1842, ibm5150, 0, ec1842, atcga, at_state, atcga, "", "EC-1842", MACHINE_NOT_WORKING ) -COMP ( 1993, ec1849, ibm5170, 0, ec1849, atcga, at_state, atcga, "", "EC-1849", MACHINE_NOT_WORKING ) -COMP ( 1993, megapc, 0, 0, megapc, 0, megapc_state,megapc, "Amstrad plc", "MegaPC", MACHINE_NOT_WORKING ) -COMP ( 199?, megapcpl, megapc, 0, megapcpl, 0, megapc_state,megapcpl, "Amstrad plc", "MegaPC Plus", MACHINE_NOT_WORKING ) -COMP ( 199?, megapcpla, megapc, 0, megapcpla, 0, at_state, megapcpla,"Amstrad plc", "MegaPC Plus (WINBUS chipset)", MACHINE_NOT_WORKING ) -COMP ( 1989, pc2386, ibm5170, 0, at386, atvga, at_state, atvga, "Amstrad plc", "Amstrad PC2386", MACHINE_NOT_WORKING ) -COMP ( 1991, aprfte, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot FT//ex 486 (J3 Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1991, ftsserv, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot FTs (Scorpion)", MACHINE_NOT_WORKING ) -COMP ( 1992, aprpand, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot FTs (Panther Rev F 1.02.26)", MACHINE_NOT_WORKING ) -COMP ( 1990, aplanst, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot LANstation (Krypton Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1990, aplannb, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot LANstation (Novell Remote Boot)", MACHINE_NOT_WORKING ) -COMP ( 1992, aplscar, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot LS Pro (Caracal Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1992, aplsbon, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot LS Pro (Bonsai Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1988, xb42663, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot Qi 300 (Rev D,E & F Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1988, qi600, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot Qi 600 (Neptune Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1990, qi900, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot Qi 900 (Scorpion Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1989, apvxft, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot VX FT server", MACHINE_NOT_WORKING ) -COMP ( 1991, apxenls3, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot XEN-LS (Venus IV Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1993, apxlsam, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot XEN-LS II (Samurai Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1987, apxeni, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot XEN-i 386 (Leopard Motherboard)" , MACHINE_NOT_WORKING ) -COMP ( 1989, xb42639, ibm5170, 0, xb42639, atvga, at_state, atvga, "Apricot", "Apricot XEN-S (Venus I Motherboard 286)" , MACHINE_NOT_WORKING ) -COMP ( 1990, xb42639a, ibm5170, 0, xb42639, atvga, at_state, atvga, "Apricot", "Apricot XEN-S (Venus II Motherboard 286)" , MACHINE_NOT_WORKING ) -COMP ( 1989, xb42664, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot XEN-S (Venus I Motherboard 386)" , MACHINE_NOT_WORKING ) -COMP ( 1990, xb42664a, ibm5170, 0, at386, atvga, at_state, atvga, "Apricot", "Apricot XEN-S (Venus II Motherboard 386)" , MACHINE_NOT_WORKING ) -COMP ( 1993, apxena1, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot XEN PC (A1 Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1993, apxenp2, ibm5170, 0, at486, atvga, at_state, atvga, "Apricot", "Apricot XEN PC (P2 Motherboard)", MACHINE_NOT_WORKING ) -COMP ( 1990, c386sx16, ibm5170, 0, at386sx, atvga, at_state, atvga, "Commodore Business Machines", "Commodore 386SX-16", MACHINE_NOT_WORKING ) -COMP ( 1988, cmdpc30, ibm5170, 0, ibm5162, atcga, at_state, atcga, "Commodore Business Machines", "PC 30 III", MACHINE_NOT_WORKING ) -COMP ( 1995, ficpio2, ibm5170, 0, ficpio2, atvga, at_state, atpci, "FIC", "486-PIO-2", MACHINE_NOT_WORKING ) -COMP ( 1997, ficvt503, ibm5170, 0, at586, atvga, driver_device, 0, "FIC", "VT-503", MACHINE_NOT_WORKING ) -COMP ( 1985, k286i, ibm5170, 0, k286i, atcga, at_state, atcga, "Kaypro", "286i", MACHINE_NOT_WORKING ) -COMP ( 1991, t2000sx, ibm5170, 0, at386sx, atvga, at_state, atvga, "Toshiba", "T2000SX", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/atari400.c b/src/mess/drivers/atari400.c deleted file mode 100644 index 73844078019..00000000000 --- a/src/mess/drivers/atari400.c +++ /dev/null @@ -1,2480 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/****************************************************************************** - Atari 400/800 - - MESS Driver - - Juergen Buchmueller, June 1998 - - 2009-05 FP changes: - Factored out MESS specific code from MAME - Added skeleton support for other XL/XE machines (VERY preliminary): - - a600xl based on maxaflex emulation in MAME - - a1200xl sharing a800xl code without BASIC - - a65xe, a65xea, a130xe, a800xe, xegs sharing a800xl code (and this is wrong - at least for xegs) - Added proper dumps and labels, thanks to Freddy Offenga researches (a few - are still marked BAD_DUMP while waiting for crc confirmation, since they - have been obtained by splitting whole dumps) - - To Do: - - Find out why a600xl and a800xl don't work (xe machines should then follow) - - Investigate supported RAM sizes and OS versions in different models - - Implement differences between various models (currently most of the - XL/XE are exactly an a800xl, but this will change as soon as emulation - starts to work) - - Fix various keyboard differences - - Freddy emulation for 800XLF? - - Add support for proto boards and expansions (a1400xl, C/PM board, etc.) - - Clean up the whole driver + cart + floppy structure - - 2013-11-06 Robert Tuccitto: - Updated Palette per 'CGIA D020577' and 'GTIA C014805', including - normalized grayscale with proper color gradient. Added Phase Shift - values 24.7 thru 27.7 degrees in 0.5 degree increments. Enabled - Phase Shift 26.2 degrees as default. - - 2013-11-23 Robert Tuccitto: - Added palette notes - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/6821pia.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/pokey.h" -#include "includes/atari.h" -#include "machine/atarifdc.h" -#include "bus/a800/a800_slot.h" -#include "bus/a800/a800_carts.h" -#include "bus/a800/a8sio.h" - - -/****************************************************************************** - Atari 800 memory map (preliminary) - - ***************** read access ******************* - range short description - 0000-9FFF RAM main memory - A000-BFFF RAM/ROM RAM or (banked) ROM cartridges - C000-CFFF ROM unused or monitor ROM - - ********* GTIA ******************************** - - D000 m0pf missile 0 playfield collisions - D001 m1pf missile 1 playfield collisions - D002 m2pf missile 2 playfield collisions - D003 m3pf missile 3 playfield collisions - D004 p0pf player 0 playfield collisions - D005 p1pf player 1 playfield collisions - D006 p2pf player 2 playfield collisions - D007 p3pf player 3 playfield collisions - D008 m0pl missile 0 player collisions - D009 m1pl missile 1 player collisions - D00A m2pl missile 2 player collisions - D00B m3pl missile 3 player collisions - D00C p0pl player 0 player collisions - D00D p1pl player 1 player collisions - D00E p2pl player 2 player collisions - D00F p3pl player 3 player collisions - D010 but0 button stick 0 - D011 but1 button stick 1 - D012 but2 button stick 2 - D013 but3 button stick 3 - D014 xff unused - D015 xff unused - D016 xff unused - D017 xff unused - D018 xff unused - D019 xff unused - D01A xff unused - D01B xff unused - D01C xff unused - D01D xff unused - D01E xff unused - D01F cons console keys - D020-D0FF repeated 7 times - - D100-D1FF xff - - ********* POKEY ******************************** - D200 pot0 paddle 0 - D201 pot1 paddle 1 - D202 pot2 paddle 2 - D203 pot3 paddle 3 - D204 pot4 paddle 4 - D205 pot5 paddle 5 - D206 pot6 paddle 6 - D207 pot7 paddle 7 - D208 potb all paddles - D209 kbcode keyboard scan code - D20A random random number generator - D20B xff unused - D20C xff unused - D20D serin serial input - D20E irqst IRQ status - D20F skstat sk status - D210-D2FF repeated 15 times - - ********* PIO ******************************** - D300 porta read pio port A - D301 portb read pio port B - D302 pactl read pio port A control - D303 pbctl read pio port B control - D304-D3FF repeated 63 times - - ********* ANTIC ******************************** - D400 xff unused - D401 xff unused - D402 xff unused - D403 xff unused - D404 xff unused - D405 xff unused - D406 xff unused - D407 xff unused - D408 xff unused - D409 xff unused - D40A xff unused - D40B vcount vertical (scanline) counter - D40C penh light pen horizontal pos - D40D penv light pen vertical pos - D40E xff unused - D40F nmist NMI status - - D500-D7FF xff unused memory - - D800-DFFF ROM floating point ROM - E000-FFFF ROM bios ROM - - ***************** write access ******************* - range short description - 0000-9FFF RAM main memory - A000-BFFF RAM/ROM RAM or (banked) ROM - C000-CFFF ROM unused or monitor ROM - - ********* GTIA ******************************** - D000 hposp0 player 0 horz position - D001 hposp1 player 1 horz position - D002 hposp2 player 2 horz position - D003 hposp3 player 3 horz position - D004 hposm0 missile 0 horz position - D005 hposm1 missile 0 horz position - D006 hposm2 missile 0 horz position - D007 hposm3 missile 0 horz position - D008 sizep0 size player 0 - D009 sizep1 size player 0 - D00A sizep2 size player 0 - D00B sizep3 size player 0 - D00C sizem size missiles - D00D grafp0 graphics data for player 0 - D00E grafp1 graphics data for player 1 - D00F grafp2 graphics data for player 2 - D010 grafp3 graphics data for player 3 - D011 grafm graphics data for missiles - D012 colpm0 color for player/missile 0 - D013 colpm1 color for player/missile 1 - D014 colpm2 color for player/missile 2 - D015 colpm3 color for player/missile 3 - D016 colpf0 color 0 playfield - D017 colpf1 color 1 playfield - D018 colpf2 color 2 playfield - D019 colpf3 color 3 playfield - D01A colbk background playfield - D01B prior priority select - D01C vdelay delay until vertical retrace - D01D gractl graphics control - D01E hitclr clear collisions - D01F wcons write console (speaker) - D020-D0FF repeated 7 times - - D100-D1FF xff unused - - ********* POKEY ******************************** - D200 audf1 frequency audio chan #1 - D201 audc1 control audio chan #1 - D202 audf2 frequency audio chan #2 - D203 audc2 control audio chan #2 - D204 audf3 frequency audio chan #3 - D205 audc3 control audio chan #3 - D206 audf4 frequency audio chan #4 - D207 audc4 control audio chan #4 - D208 audctl audio control - D209 stimer start timer - D20A skres sk reset - D20B potgo start pot AD conversion - D20C xff unused - D20D serout serial output - D20E irqen IRQ enable - D20F skctl sk control - D210-D2FF repeated 15 times - - ********* PIO ******************************** - D300 porta write pio port A (output or mask) - D301 portb write pio port B (output or mask) - D302 pactl write pio port A control - D303 pbctl write pio port B control - D304-D3FF repeated - - ********* ANTIC ******************************** - D400 dmactl write DMA control - D401 chactl write character control - D402 dlistl write display list lo - D403 dlisth write display list hi - D404 hscrol write horz scroll - D405 vscrol write vert scroll - D406 xff unused - D407 pmbash player/missile base addr hi - D408 xff unused - D409 chbash character generator base addr hi - D40A wsync wait for hsync - D40B xff unused - D40C xff unused - D40D xff unused - D40E nmien NMI enable - D40F nmires NMI reset - - D500-D7FF xff unused memory - - D800-DFFF ROM floating point ROM - E000-FFFF ROM BIOS ROM -******************************************************************************/ - -class a400_state : public atari_common_state -{ -public: - a400_state(const machine_config &mconfig, device_type type, const char *tag) - : atari_common_state(mconfig, type, tag), - m_ram(*this, RAM_TAG), - m_pia(*this, "pia"), - m_dac(*this, "dac"), - m_region_maincpu(*this, "maincpu"), - m_0000(*this, "0000"), - m_8000(*this, "8000"), - m_a000(*this, "a000"), - m_cart(*this, "cartleft"), - m_cart2(*this, "cartright") { } - - DECLARE_MACHINE_START(a400); - DECLARE_MACHINE_START(a800); - DECLARE_MACHINE_START(a800xl); - DECLARE_MACHINE_START(a5200); - DECLARE_PALETTE_INIT(a400); - - DECLARE_MACHINE_RESET(a400); - - DECLARE_WRITE8_MEMBER(gtia_cb); - - DECLARE_WRITE8_MEMBER(a600xl_pia_pb_w); - DECLARE_WRITE8_MEMBER(a800xl_pia_pb_w); - - DECLARE_READ8_MEMBER(read_d5xx); // at least one cart type can enable/disable roms when reading - DECLARE_WRITE8_MEMBER(disable_cart); - - // these are needed to handle carts which can disable ROM without - // installing/disinstalling continuously RAM and ROM (with e.g. big - // preformance hit in Williams carts) - DECLARE_READ8_MEMBER(special_read_8000); - DECLARE_WRITE8_MEMBER(special_write_8000); - DECLARE_READ8_MEMBER(special_read_a000); - DECLARE_WRITE8_MEMBER(special_write_a000); - - DECLARE_READ8_MEMBER(a600xl_low_r); - DECLARE_READ8_MEMBER(a1200xl_low_r); - DECLARE_READ8_MEMBER(a800xl_low_r); - DECLARE_WRITE8_MEMBER(a800xl_low_w); - DECLARE_READ8_MEMBER(a800xl_high_r); - DECLARE_WRITE8_MEMBER(a800xl_high_w); - DECLARE_READ8_MEMBER(a130xe_low_r); - DECLARE_WRITE8_MEMBER(a130xe_low_w); - DECLARE_READ8_MEMBER(xegs_low_r); - DECLARE_WRITE8_MEMBER(xegs_low_w); - DECLARE_READ8_MEMBER(xegs_high_r); - DECLARE_WRITE8_MEMBER(xegs_high_w); - - TIMER_DEVICE_CALLBACK_MEMBER(a400_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(a800xl_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(a5200_interrupt); - -protected: - //required_device m_maincpu; // maincpu is already contained in atari_common_state - required_device m_ram; - required_device m_pia; - optional_device m_dac; - required_memory_region m_region_maincpu; - optional_memory_bank m_0000; - optional_memory_bank m_8000; - optional_memory_bank m_a000; - optional_device m_cart; - optional_device m_cart2; - - int m_cart_disabled, m_cart_helper; - int m_last_offs; - UINT8 m_mmu, m_ext_bank; - - void setup_ram(int bank,UINT32 size); - void setup_cart(a800_cart_slot_device *slot); -}; - - - -/************************************************************** - * - * Memory handlers - * - **************************************************************/ - -READ8_MEMBER(a400_state::a600xl_low_r) -{ - if (m_mmu & 0x80) - return 0xff; - else - return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; -} - - -READ8_MEMBER(a400_state::a1200xl_low_r) -{ - if (offset < 0x5000) // 0x0000-0x4fff - return m_ram->pointer()[offset]; - else if (offset < 0x5800) // 0x5000-0x57ff - { - if (m_mmu & 0x80) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; - } - else if (offset < 0xc000) // 0x5800-0xbfff - return m_ram->pointer()[offset]; - else // 0xc000-0xcfff - { - if (!(m_mmu & 0x01)) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[offset]; - } -} - -READ8_MEMBER(a400_state::a800xl_low_r) -{ - if (offset < 0x5000) // 0x0000-0x4fff - return m_ram->pointer()[offset]; - else if (offset < 0x5800) // 0x5000-0x57ff - { - if (m_mmu & 0x80) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; - } - else if (offset < 0xa000) // 0x5800-0x9fff - return m_ram->pointer()[offset]; - else if (offset < 0xc000) // 0xa000-0xbfff - { - if (m_mmu & 0x02) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[(offset & 0x1fff) + 0xa000]; - } - else // 0xc000-0xcfff - { - if (!(m_mmu & 0x01)) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[offset]; - } -} - -WRITE8_MEMBER(a400_state::a800xl_low_w) -{ - if (offset < 0x5000) // 0x0000-0x4fff - m_ram->pointer()[offset] = data; - else if (offset < 0x5800) // 0x5000-0x57ff - { - if (m_mmu & 0x80) - m_ram->pointer()[offset] = data; - } - else if (offset < 0xa000) // 0x5800-0x7fff - m_ram->pointer()[offset] = data; - else if (offset < 0xc000) // 0xa000-0xbfff - { - if (m_mmu & 0x02) - m_ram->pointer()[offset] = data; - } - else // 0xc000-0xcfff - { - if (!(m_mmu & 0x01)) - m_ram->pointer()[offset] = data; - } -} - -READ8_MEMBER(a400_state::a800xl_high_r) -{ - if (m_mmu & 0x01) - return m_region_maincpu->base()[0xd800 + offset]; - else - return m_ram->pointer()[0xd800 + offset]; -} - -WRITE8_MEMBER(a400_state::a800xl_high_w) -{ - if (!(m_mmu & 0x01)) - m_ram->pointer()[0xd800 + offset] = data; -} - -READ8_MEMBER(a400_state::a130xe_low_r) -{ - if (offset < 0x4000) // 0x0000-0x3fff - return m_ram->pointer()[offset]; - else if (offset < 0x8000) // 0x4000-0x7fff - { - // NOTE: ANTIC accesses to extra RAM are not supported yet! - if (!(m_mmu & 0x80) && offset >= 0x5000 && offset < 0x5800) - return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; - if (!(m_mmu & 0x10)) - return m_ram->pointer()[offset + 0x10000 + (m_ext_bank * 0x4000)]; - else - return m_ram->pointer()[offset]; - } - else if (offset < 0xa000) // 0x8000-0x9fff - return m_ram->pointer()[offset]; - else if (offset < 0xc000) // 0xa000-0xbfff - { - if (m_mmu & 0x02) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[(offset & 0x1fff) + 0xa000]; - } - else // 0xc000-0xcfff - { - if (!(m_mmu & 0x01)) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[offset]; - } -} - -WRITE8_MEMBER(a400_state::a130xe_low_w) -{ - if (offset < 0x4000) // 0x0000-0x3fff - m_ram->pointer()[offset] = data; - else if (offset < 0x8000) // 0x4000-0x7fff - { - // NOTE: ANTIC accesses to extra RAM are not supported yet! - if (!(m_mmu & 0x80) && offset >= 0x5000 && offset < 0x5800) - return; - if (!(m_mmu & 0x10)) - m_ram->pointer()[offset + 0x10000 + (m_ext_bank * 0x4000)] = data; - else - m_ram->pointer()[offset] = data; - } - else if (offset < 0xa000) // 0x5800-0x7fff - m_ram->pointer()[offset] = data; - else if (offset < 0xc000) // 0xa000-0xbfff - { - if (m_mmu & 0x02) - m_ram->pointer()[offset] = data; - } - else // 0xc000-0xcfff - { - if (!(m_mmu & 0x01)) - m_ram->pointer()[offset] = data; - } -} - -READ8_MEMBER(a400_state::xegs_low_r) -{ - if (offset < 0x5000) // 0x0000-0x4fff - return m_ram->pointer()[offset]; - else if (offset < 0x5800) // 0x5000-0x57ff - { - if (m_mmu & 0x80) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[0xd000 + (offset & 0x7ff)]; - } - else if (offset < 0x8000) // 0x5800-0x7fff - return m_ram->pointer()[offset]; - else if (offset < 0xa000) // 0x8000-0x9fff - return m_region_maincpu->base()[0x8000 + (offset & 0x1fff)]; - else if (offset < 0xc000) // 0xa000-0xbfff - return m_region_maincpu->base()[0x8000 + (offset & 0x1fff)]; - else // 0xc000-0xcfff - { - if (!(m_mmu & 0x01)) - return m_ram->pointer()[offset]; - else - return m_region_maincpu->base()[offset]; - } -} - -WRITE8_MEMBER(a400_state::xegs_low_w) -{ - if (offset < 0x5000) // 0x0000-0x4fff - m_ram->pointer()[offset] = data; - else if (offset < 0x5800) // 0x5000-0x57ff - { - if (m_mmu & 0x80) - m_ram->pointer()[offset] = data; - } - else if (offset < 0x8000) // 0x5800-0x7fff - m_ram->pointer()[offset] = data; - else if (offset < 0xc000) // 0xa000-0xbfff - return; - else // 0xc000-0xcfff - { - if (!(m_mmu & 0x01)) - m_ram->pointer()[offset] = data; - } -} - -/************************************************************** - * - * Memory maps - * - **************************************************************/ - - -static ADDRESS_MAP_START(a400_mem, AS_PROGRAM, 8, a400_state) - AM_RANGE(0x0000, 0xbfff) AM_NOP // RAM installed at runtime - AM_RANGE(0xc000, 0xcfff) AM_ROM - AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) - AM_RANGE(0xd100, 0xd1ff) AM_NOP - AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) - AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) - AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) - AM_RANGE(0xd500, 0xd7ff) AM_NOP - AM_RANGE(0xd800, 0xffff) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(a600xl_mem, AS_PROGRAM, 8, a400_state) - AM_RANGE(0x0000, 0x3fff) AM_RAM - AM_RANGE(0x5000, 0x57ff) AM_READ(a600xl_low_r) // self test or NOP - AM_RANGE(0xa000, 0xbfff) AM_ROM // BASIC - AM_RANGE(0xc000, 0xcfff) AM_ROM // OS - AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) - AM_RANGE(0xd100, 0xd1ff) AM_NOP - AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) - AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) - AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) - AM_RANGE(0xd500, 0xd7ff) AM_NOP - AM_RANGE(0xd800, 0xffff) AM_ROM // OS -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(a1200xl_mem, AS_PROGRAM, 8, a400_state) - AM_RANGE(0x0000, 0xcfff) AM_READWRITE(a1200xl_low_r, xegs_low_w) - AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) - AM_RANGE(0xd100, 0xd1ff) AM_NOP - AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) - AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) - AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) - AM_RANGE(0xd500, 0xd7ff) AM_NOP - AM_RANGE(0xd800, 0xffff) AM_READWRITE(a800xl_high_r, a800xl_high_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(a800xl_mem, AS_PROGRAM, 8, a400_state) - AM_RANGE(0x0000, 0xcfff) AM_READWRITE(a800xl_low_r, a800xl_low_w) - AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) - AM_RANGE(0xd100, 0xd1ff) AM_NOP - AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) - AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) - AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) - AM_RANGE(0xd500, 0xd7ff) AM_NOP - AM_RANGE(0xd800, 0xffff) AM_READWRITE(a800xl_high_r, a800xl_high_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(a130xe_mem, AS_PROGRAM, 8, a400_state) - AM_RANGE(0x0000, 0xcfff) AM_READWRITE(a130xe_low_r, a800xl_low_w) - AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) - AM_RANGE(0xd100, 0xd1ff) AM_NOP - AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) - AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) - AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) - AM_RANGE(0xd500, 0xd7ff) AM_NOP - AM_RANGE(0xd800, 0xffff) AM_READWRITE(a800xl_high_r, a800xl_high_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(xegs_mem, AS_PROGRAM, 8, a400_state) - AM_RANGE(0x0000, 0xcfff) AM_READWRITE(xegs_low_r, xegs_low_w) - AM_RANGE(0xd000, 0xd0ff) AM_DEVREADWRITE("gtia", gtia_device, read, write) - AM_RANGE(0xd100, 0xd1ff) AM_NOP - AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokey_device, read, write) - AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) - AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("antic", antic_device, read, write) - AM_RANGE(0xd500, 0xd7ff) AM_NOP - AM_RANGE(0xd800, 0xffff) AM_READWRITE(a800xl_high_r, a800xl_high_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(a5200_mem, AS_PROGRAM, 8, a400_state) - AM_RANGE(0x0000, 0x3fff) AM_RAM - AM_RANGE(0x4000, 0xbfff) AM_NOP // ROM installed at machine start - AM_RANGE(0xc000, 0xcfff) AM_DEVREADWRITE("gtia", gtia_device, read, write) - AM_RANGE(0xd400, 0xdfff) AM_DEVREADWRITE("antic", antic_device, read, write) - // 0xe000-0xe7ff - Expansion? - AM_RANGE(0xe800, 0xefff) AM_DEVREADWRITE("pokey", pokey_device, read, write) - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - - - -/************************************************************** - * - * Input ports - * - **************************************************************/ - - -#define JOYSTICK_DELTA 10 -#define JOYSTICK_SENSITIVITY 200 - -static INPUT_PORTS_START( atari_artifacting ) - PORT_START("artifacts") - PORT_CONFNAME(0x40, 0x00, "Television Artifacts" ) - PORT_CONFSETTING(0x00, DEF_STR( Off ) ) - PORT_CONFSETTING(0x40, DEF_STR( On ) ) -INPUT_PORTS_END - - - -static INPUT_PORTS_START( atari_console ) - PORT_START("console") - PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_NAME("CONS.2: Option") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("CONS.1: Select") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("CONS.0: Start") PORT_CODE(KEYCODE_F1) -INPUT_PORTS_END - - - -static INPUT_PORTS_START( atari_digital_joystick2 ) - PORT_START("djoy_0_1") - PORT_BIT(0x01, 0x01, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x02, 0x02, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x04, 0x04, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x08, 0x08, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x10, 0x10, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(2) - PORT_BIT(0x20, 0x20, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) - PORT_BIT(0x40, 0x40, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(2) - PORT_BIT(0x80, 0x80, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) - - PORT_START("djoy_2_3") - PORT_BIT(0x01, 0x01, IPT_UNUSED) - PORT_BIT(0x02, 0x02, IPT_UNUSED) - PORT_BIT(0x04, 0x04, IPT_UNUSED) - PORT_BIT(0x08, 0x08, IPT_UNUSED) - PORT_BIT(0x10, 0x10, IPT_UNUSED) - PORT_BIT(0x20, 0x20, IPT_UNUSED) - PORT_BIT(0x40, 0x40, IPT_UNUSED) - PORT_BIT(0x80, 0x80, IPT_UNUSED) - - PORT_START("djoy_b") - PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x04, 0x04, IPT_UNUSED) - PORT_BIT(0x08, 0x08, IPT_UNUSED) - PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2) - PORT_BIT(0x40, 0x40, IPT_UNUSED) - PORT_BIT(0x80, 0x80, IPT_UNUSED) -INPUT_PORTS_END - - - -static INPUT_PORTS_START( atari_digital_joystick4 ) - PORT_START("djoy_0_1") - PORT_BIT(0x01, 0x01, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x02, 0x02, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x04, 0x04, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x08, 0x08, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x10, 0x10, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(2) - PORT_BIT(0x20, 0x20, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) - PORT_BIT(0x40, 0x40, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(2) - PORT_BIT(0x80, 0x80, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) - - PORT_START("djoy_2_3") - PORT_BIT(0x01, 0x01, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(3) - PORT_BIT(0x02, 0x02, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(3) - PORT_BIT(0x04, 0x04, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(3) - PORT_BIT(0x08, 0x08, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(3) - PORT_BIT(0x10, 0x10, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(4) - PORT_BIT(0x20, 0x20, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(4) - PORT_BIT(0x40, 0x40, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(4) - PORT_BIT(0x80, 0x80, IPT_JOYSTICK_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(4) - - PORT_START("djoy_b") - PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x04, 0x04, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(3) - PORT_BIT(0x08, 0x08, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(4) - PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2) - PORT_BIT(0x40, 0x40, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(3) - PORT_BIT(0x80, 0x80, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(4) -INPUT_PORTS_END - - - -/* 2009-04 FP: -Small note about natural keyboard support: currently, -- "Break" is mapped to 'F1' -- "Clear" is mapped to 'F2' -- "Atari" is mapped to 'F3' */ - -static INPUT_PORTS_START( atari_keyboard ) - PORT_START("keyboard.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('\\') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('^') - - PORT_START("keyboard.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) // None! - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('=') PORT_CHAR('|') - - PORT_START("keyboard.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("keyboard.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("keyboard.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('[') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(']') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Atari") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("keyboard.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START("keyboard.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BackS Delete") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('@') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("< Clear") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('<') PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("> Insert") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('>') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("keyboard.7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START("fake") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) -INPUT_PORTS_END - - -static INPUT_PORTS_START( atari_analog_paddles ) - PORT_START("analog_0") - PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(1) PORT_REVERSE - - PORT_START("analog_1") - PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(2) PORT_REVERSE - - PORT_START("analog_2") - PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(3) PORT_REVERSE - - PORT_START("analog_3") - PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(4) PORT_REVERSE - - PORT_START("analog_4") - PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_REVERSE /* PORT_PLAYER(5) */ - - PORT_START("analog_5") - PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_REVERSE /* PORT_PLAYER(6) */ - - PORT_START("analog_6") - PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_REVERSE /* PORT_PLAYER(7) */ - - PORT_START("analog_7") - PORT_BIT(0xff, 0x74, IPT_PADDLE) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_REVERSE /* PORT_PLAYER(8) */ -INPUT_PORTS_END - - - -static INPUT_PORTS_START( a800 ) - PORT_INCLUDE( atari_artifacting ) - PORT_INCLUDE( atari_console ) - PORT_INCLUDE( atari_digital_joystick4 ) - PORT_INCLUDE( atari_keyboard ) - PORT_INCLUDE( atari_analog_paddles ) -INPUT_PORTS_END - - - -static INPUT_PORTS_START( a800xl ) - PORT_INCLUDE( atari_artifacting ) - PORT_INCLUDE( atari_console ) - PORT_INCLUDE( atari_digital_joystick2 ) - PORT_INCLUDE( atari_keyboard ) - PORT_INCLUDE( atari_analog_paddles ) -INPUT_PORTS_END - - - -static INPUT_PORTS_START( a5200 ) - PORT_INCLUDE( atari_artifacting ) - - PORT_START("djoy_b") /* lower/upper buttons */ - PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x04, 0x04, IPT_BUTTON1) PORT_PLAYER(3) - PORT_BIT(0x08, 0x08, IPT_BUTTON1) PORT_PLAYER(4) - PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_PLAYER(2) - PORT_BIT(0x40, 0x40, IPT_BUTTON2) PORT_PLAYER(3) - PORT_BIT(0x80, 0x80, IPT_BUTTON2) PORT_PLAYER(4) - - PORT_START("keypad.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("(Break)") PORT_CODE(KEYCODE_PAUSE) // is this correct? - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[#]") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[0]") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[*]") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keypad.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[9]") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[8]") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[7]") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keypad.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_F2) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[6]") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[5]") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[4]") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keypad.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START) PORT_NAME("Start") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[3]") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[2]") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("[1]") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("analog_0") - PORT_BIT(0xff, 0x72, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(1) - - PORT_START("analog_1") - PORT_BIT(0xff, 0x72, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(1) - - PORT_START("analog_2") - PORT_BIT(0xff, 0x72, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(2) - - PORT_START("analog_3") - PORT_BIT(0xff, 0x72, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(2) - - PORT_START("analog_4") - PORT_BIT(0xff, 0x72, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(3) - - PORT_START("analog_5") - PORT_BIT(0xff, 0x72, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(3) - - PORT_START("analog_6") - PORT_BIT(0xff, 0x72, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(4) - - PORT_START("analog_7") - PORT_BIT(0xff, 0x72, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xe4) PORT_PLAYER(4) - -INPUT_PORTS_END -/*************************************************************** -Atari 5200 Palette Notes: - -Palette on a modern flat panel display (LCD, LED, Plasma, etc.) -appears different from a traditional CRT. The most outstanding -difference is Hue 1x, the hue begin point. Hue 1x looks very -'green' (~-60 to -45 degrees - depending on how poor or well it -handles the signal conversion and its calibration) on a modern -flat panel display, as opposed to 'gold' (~-33 degrees) on a -CRT. The official technical document, "GTIA C014805 NTSC" -stipulates Hue 1x as gold. - -The "Atari 5200 Field Service Manual" provides two different -sets of instructions in harmony with utilizing the "PAM -Diagnostic SALT Cartridge v1.1". In one account it states the -color just below and above the reference bar to be within one -shade of each other. - -Under the same reference document, directions are given for it -to be the same color. Phase Shift 25.7 degrees matches Hue 1x, -15x and the color below the reference bar. - -However, if the system is adjusted within the first several -minutes of running, the warm up, consistent system run time, -causes Hue 15x (F$) to become stronger/darker gold (More brown -then ultimately red-brown); as well as leans Hue 14x (E$) more -brown than green. Once achieving a phase shift of 27.7, -Hue 14x (E$) and Hue 15x (F$) near-exact match Hue 1x and 2x -respectively. - -Accounting for system 'warm-up', phase shifting, as well as the -instructions for it to be within one shade of each other, would -make Phase Shift 26.2 degrees or 26.7 degrees a realistic -logical choice. - -It also collaborates with the official "GTIA C014805 NTSC" -document for color order: Hue 1x = Gold, Hue 2x = Orange, -Hue 15x (F$) = Light-Orange; Phase Shift 26.2 places -Hue 15x (F$) between Hue 1x, Gold and Hue 2x, Orange; -a Light Orange in color. Color descriptions are best measured -in the middle of the brightness scale. - -It should be mentioned that Green-Yellow is referenced at -Hue 13x (D$), nowhere near Hue 1x. A Green-Yellow Hue 1x is -how the palette is manipulated and modified (in part) under -a modern flat panel display. - -Note though, even a properly calibrated console, at power on, -the phase shift appears as low as ~23 degrees and after a -considerable consistent runtime, can be as high as ~28 degrees. -In general, the low end of ~23 degrees lasts for maybe several -seconds, whereas higher values such as ~25-27 degrees is the -most dominant during system run time. - -Additionally, the blue to red (And consequently blue to green) -ratio proportions may appear different on a modern flat panel -display than a CRT in some instances for the Atari 5200 system. -Furthermore, you may have some variation of proportions even -within the same display type. - -One side effect of this on the console's palette is that some -values of red may appear too pinkish - Too much blue to red. -This is not the same as a traditional tint-hue control -adjustment; rather, can be demonstrated by changing the blue -ratio values via MESS HLSL settings. - -Lastly, the Atari 2600 & 7800 NTSC color palettes hold the same -hue structure order and have similar appearance differences -dependent upon display type. -***************************************************************/ -/************************************************************** - * - * Palette - Phase Shift 26.2 - * - **************************************************************/ - -static const UINT8 atari_palette[256*3] = -{ - /* Grey */ - 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, - 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, - 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, - 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, - /* Gold */ - 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, - 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, - 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, - 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, - /* Orange */ - 0x31,0x00,0x00, 0x42,0x06,0x00, 0x53,0x17,0x00, 0x64,0x28,0x00, - 0x75,0x39,0x00, 0x86,0X4A,0x00, 0x97,0x5B,0x0B, 0xA8,0x6C,0x1C, - 0xB9,0x7D,0x2D, 0xCA,0x8E,0x3E, 0xDB,0x9F,0x4F, 0xEC,0xB0,0x60, - 0xFD,0xC1,0x71, 0xFF,0xD2,0x86, 0xFF,0xE3,0x9D, 0xFF,0xF4,0xB3, - /* Red-Orange */ - 0x3E,0x00,0x00, 0x4F,0x00,0x00, 0x60,0x08,0x00, 0x71,0x19,0x00, - 0x82,0x2A,0x0F, 0x93,0x3B,0x20, 0xA4,0x4C,0x31, 0xB5,0x5D,0x42, - 0xC6,0x6E,0x53, 0xD7,0x7F,0x64, 0xE8,0x90,0x75, 0xF9,0xA1,0x86, - 0xFF,0xB2,0x9A, 0xFF,0xC3,0xB0, 0xFF,0xD4,0xC6, 0xFF,0xE5,0xDC, - /* Pink */ - 0x3E,0x00,0x06, 0x4F,0x00,0x12, 0x60,0x00,0x1E, 0x71,0x0E,0x2E, - 0x82,0x1F,0x3F, 0x93,0x30,0x50, 0xA4,0x41,0x61, 0xB5,0x52,0x72, - 0xC6,0x63,0x83, 0xD7,0x74,0x94, 0xE8,0x85,0xA5, 0xF9,0x96,0xB6, - 0xFF,0xA7,0xCB, 0xFF,0xB8,0xE1, 0xFF,0xC9,0xEF, 0xFF,0xDA,0xF4, - /* Purple */ - 0x32,0x00,0x38, 0x43,0x00,0x44, 0x54,0x00,0x50, 0x65,0x0C,0x5F, - 0x76,0x1D,0x70, 0x87,0x2E,0x81, 0x98,0x3F,0x92, 0xA9,0x50,0xA3, - 0xBA,0x61,0xB4, 0xCB,0x72,0xC5, 0xDC,0x83,0xD6, 0xED,0x94,0xE4, - 0xFE,0xA5,0xE4, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, - /* Purple-Blue */ - 0x1B,0x00,0x5F, 0x2C,0x00,0x6B, 0x3D,0x00,0x77, 0x4E,0x11,0x88, - 0x5F,0x22,0x99, 0x70,0x33,0xAA, 0x81,0x44,0xBB, 0x92,0x55,0xCC, - 0xA3,0x66,0xDD, 0xB4,0x77,0xED, 0xC5,0x88,0xED, 0xD6,0x99,0xED, - 0xE7,0xAA,0xED, 0xF8,0xBB,0xED, 0xFF,0xCC,0xF0, 0xFF,0xDD,0xF5, - /* Blue 1 */ - 0x00,0x00,0x72, 0x10,0x00,0x7E, 0x21,0x0D,0x8E, 0x32,0x1E,0x9F, - 0x43,0x2F,0xB0, 0x54,0x40,0xC1, 0x65,0x51,0xD2, 0x76,0x62,0xE3, - 0x87,0x73,0xF4, 0x98,0x84,0xF9, 0xA9,0x95,0xF9, 0xBA,0xA6,0xF9, - 0xCB,0xB7,0xF9, 0xDC,0xC8,0xF9, 0xED,0xD9,0xF9, 0xFE,0xEA,0xF9, - /* Blue 2 */ - 0x00,0x00,0x65, 0x00,0x0C,0x7A, 0x05,0x1D,0x8E, 0x16,0x2E,0x9F, - 0x27,0x3F,0xB0, 0x38,0x50,0xC1, 0x49,0x61,0xD2, 0x5A,0x72,0xE3, - 0x6B,0x83,0xF4, 0x7C,0x94,0xFF, 0x8D,0xA5,0xFF, 0x9E,0xB6,0xFF, - 0xAF,0xC7,0xFF, 0xC0,0xD8,0xFF, 0xD1,0xE9,0xFF, 0xE2,0xFA,0xFF, - /* Light-Blue */ - 0x00,0x0D,0x48, 0x00,0x1E,0x5E, 0x00,0x2F,0x74, 0x00,0x40,0x8A, - 0x11,0x51,0x9B, 0x22,0x62,0xAC, 0x33,0x73,0xBD, 0x44,0x84,0xCE, - 0x55,0x95,0xDF, 0x66,0xA6,0xF0, 0x77,0xB7,0xFF, 0x88,0xC8,0xFF, - 0x99,0xD9,0xFF, 0xAA,0xEA,0xFF, 0xBB,0xFB,0xFF, 0xCC,0xFF,0xFF, - /* Turquoise */ - 0x00,0x1C,0x1C, 0x00,0x2D,0x32, 0x00,0x3E,0x49, 0x00,0x4F,0x5F, - 0x05,0x60,0x73, 0x16,0x71,0x84, 0x27,0x82,0x95, 0x38,0x93,0xA6, - 0x49,0xA4,0xB7, 0x5A,0xB5,0xC8, 0x6B,0xC6,0xD9, 0x7C,0xD7,0xEA, - 0x8D,0xE8,0xFB, 0x9E,0xF9,0xFF, 0xAF,0xFF,0xFF, 0xC0,0xFF,0xFF, - /* Green-Blue */ - 0x00,0x25,0x0B, 0x00,0x36,0x10, 0x00,0x47,0x18, 0x00,0x58,0x2E, - 0x07,0x69,0x42, 0x18,0x7A,0x53, 0x29,0x8B,0x64, 0x3A,0x9C,0x75, - 0x4B,0xAD,0x86, 0x5C,0xBE,0x97, 0x6D,0xCF,0xA8, 0x7E,0xE0,0xB9, - 0x8F,0xF1,0xCA, 0xA0,0xFF,0xDA, 0xB1,0xFF,0xE6, 0xC2,0xFF,0xF2, - /* Green */ - 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x04,0x5A,0x1A, - 0x15,0x6B,0x1A, 0x26,0x7C,0x22, 0x37,0x8D,0x33, 0x48,0x9E,0x44, - 0x59,0xAF,0x55, 0x6A,0xC0,0x66, 0x7B,0xD1,0x77, 0x8C,0xE2,0x88, - 0x9D,0xF3,0x99, 0xAE,0xFF,0xA8, 0xBF,0xFF,0xB4, 0xD0,0xFF,0xC0, - /* Yellow-Green */ - 0x00,0x21,0x0A, 0x00,0x32,0x0F, 0x0A,0x43,0x11, 0x1B,0x54,0x11, - 0x2C,0x65,0x11, 0x3D,0x76,0x11, 0x4E,0x87,0x11, 0x5F,0x98,0x1E, - 0x70,0xA9,0x2F, 0x81,0xBA,0x40, 0x92,0xCB,0x51, 0xA3,0xDC,0x62, - 0xB4,0xED,0x73, 0xC5,0xFE,0x84, 0xD6,0xFF,0x90, 0xE7,0xFF,0x9C, - /* Orange-Green */ - 0x05,0x13,0x04, 0x16,0x24,0x04, 0x27,0x35,0x04, 0x38,0x46,0x04, - 0x49,0x57,0x04, 0x5A,0x68,0x04, 0x6B,0x79,0x04, 0x7C,0x8A,0x09, - 0x8D,0x9B,0x1A, 0x9E,0xAC,0x2B, 0xAF,0xBD,0x3C, 0xC0,0xCE,0x4D, - 0xD1,0xDF,0x5E, 0xE2,0xF0,0x6F, 0xF3,0xFF,0x80, 0xFF,0xFF,0x8D, - /* Light-Orange */ - 0x21,0x02,0x00, 0x32,0x13,0x00, 0x43,0x24,0x00, 0x54,0x35,0x00, - 0x65,0x46,0x00, 0x76,0x57,0x00, 0x87,0x68,0x00, 0x98,0x79,0x0C, - 0xA9,0x8A,0x1D, 0xBA,0x9B,0x2E, 0xCB,0xAC,0x3F, 0xDC,0xBD,0x50, - 0xED,0xCE,0x61, 0xFE,0xDF,0x72, 0xFF,0xF0,0x87, 0xFF,0xFF,0x9D -}; - - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(a400_state, a400) -{ - for (int i = 0; i < sizeof(atari_palette) / 3; i++ ) - { - palette.set_pen_color(i, atari_palette[i*3], atari_palette[i*3+1], atari_palette[i*3+2]); - } -} -/****************************************************************** - PALETTE - PHASE 24.7 SHIFT - -GREY - 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, - 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, - 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, - 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, - -GOLD - 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, - 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, - 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, - 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, - -ORANGE - 0x30,0x00,0x00, 0x41,0x07,0x00, 0x52,0x18,0x00, 0x63,0x29,0x00, - 0x74,0x3A,0x00, 0x85,0x4B,0x00, 0x96,0x5C,0x0A, 0xA7,0x6D,0x1B, - 0xB8,0x7E,0x2C, 0xC9,0x8F,0x3D, 0xDA,0xA0,0x4E, 0xEB,0xB1,0x5F, - 0xFC,0xC2,0x70, 0xFF,0xD3,0x85, 0xFF,0xE4,0x9B, 0xFF,0xF5,0xB1, - -RED-ORANGE - 0x3D,0x00,0x00, 0x4E,0x00,0x00, 0x5F,0x09,0x00, 0x70,0x1A,0x00, - 0x81,0x2B,0x09, 0x92,0x3C,0x1A, 0xA3,0x4D,0x2B, 0xB4,0x5E,0x3C, - 0xC5,0x6F,0x4D, 0xD6,0x80,0x5E, 0xE7,0x91,0x6F, 0xF8,0xA2,0x80, - 0xFF,0xB3,0x94, 0xFF,0xC4,0xAA, 0xFF,0xD5,0xC0, 0xFF,0xE6,0xD6, - -PINK - 0x3F,0x00,0x00, 0x50,0x00,0x09, 0x61,0x00,0x15, 0x72,0x10,0x26, - 0x83,0x21,0x37, 0x94,0x32,0x48, 0xA5,0x43,0x59, 0xB6,0x54,0x6A, - 0xC7,0x65,0x7B, 0xD8,0x76,0x8C, 0xE9,0x87,0x9D, 0xFA,0x98,0xAE, - 0xFF,0xA9,0xC2, 0xFF,0xBA,0xD8, 0xFF,0xCB,0xEE, 0xFF,0xDC,0xF4, - -PURPLE - 0x36,0x00,0x2E, 0x47,0x00,0x3A, 0x58,0x00,0x46, 0x69,0x0C,0x55, - 0x7A,0x1D,0x66, 0x8B,0x2E,0x77, 0x9C,0x3F,0x88, 0xAD,0x50,0x99, - 0xBE,0x61,0xAA, 0xCF,0x72,0xBB, 0xE0,0x83,0xCC, 0xF1,0x94,0xDD, - 0xFF,0xA5,0xE4, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, - -PURPLE-BLUE - 0x23,0x00,0x55, 0x34,0x00,0x61, 0x45,0x00,0x6D, 0x56,0x0F,0x7E, - 0x67,0x20,0x8F, 0x78,0x31,0xA0, 0x89,0x42,0xB1, 0x9A,0x53,0xC2, - 0xAB,0x64,0xD3, 0xBC,0x75,0xE4, 0xCD,0x86,0xEA, 0xDE,0x97,0xEA, - 0xEF,0xA8,0xEA, 0xFF,0xB9,0xEA, 0xFF,0xCA,0xEF, 0xFF,0xDB,0xF4, - -BLUE1 - 0x09,0x00,0x6E, 0x1A,0x00,0x7A, 0x2B,0x08,0x88, 0x3C,0x19,0x99, - 0x4D,0x2A,0xAA, 0x5E,0x3B,0xBB, 0x6F,0x4C,0xCC, 0x80,0x5D,0xDD, - 0x91,0x6E,0xEE, 0xA2,0x7F,0xF4, 0xB3,0x90,0xF4, 0xC4,0xA1,0xF4, - 0xD5,0xB2,0xF4, 0xE6,0xC3,0xF4, 0xF7,0xD4,0xF4, 0xFF,0xE5,0xF7, - -BLUE2 - 0x00,0x00,0x6D, 0x00,0x05,0x80, 0x10,0x16,0x91, 0x21,0x27,0xA2, - 0x32,0x38,0xB3, 0x43,0x49,0xC4, 0x54,0x5A,0xD5, 0x65,0x6B,0xE6, - 0x76,0x7C,0xF7, 0x87,0x8D,0xFF, 0x98,0x9E,0xFF, 0xA9,0xAF,0xFF, - 0xBA,0xC0,0xFF, 0xCB,0xD1,0xFF, 0xDC,0xE2,0xFF, 0xED,0xF3,0xFF - -LIGHT-BLUE - 0x00,0x05,0x57, 0x00,0x16,0x6E, 0x00,0x27,0x84, 0x09,0x38,0x97, - 0x1A,0x49,0xA8, 0x2B,0x5A,0xB9, 0x3C,0x6B,0xCA, 0x4D,0x7C,0xDB, - 0x5E,0x8D,0xEC, 0x6F,0x9E,0xFD, 0x80,0xAF,0xFF, 0x91,0xC0,0xFF, - 0xA2,0xD1,0xFF, 0xB3,0xE2,0xFF, 0xC4,0xF3,0xFF, 0xD5,0xFF,0xFF, - -TURQUOISE - 0x00,0x15,0x34, 0x00,0x26,0x4A, 0x00,0x37,0x60, 0x00,0x48,0x77, - 0x0A,0x59,0x8A, 0x1B,0x6A,0x9B, 0x2C,0x7B,0xAC, 0x3D,0x8C,0xBD, - 0x4E,0x9D,0xCE, 0x5F,0xAE,0xDF, 0x70,0xBF,0xF0, 0x81,0xD0,0xFF, - 0x92,0xE1,0xFF, 0xA3,0xF2,0xFF, 0xB4,0xFF,0xFF, 0xC5,0xFF,0xFF - -GREEN-BLUE - 0x00,0x21,0x0A, 0x00,0x32,0x1F, 0x00,0x43,0x35, 0x00,0x54,0x4B, - 0x04,0x65,0x60, 0x15,0x76,0x71, 0x26,0x87,0x82, 0x37,0x98,0x93, - 0x48,0xA9,0xA4, 0x59,0xBA,0xB5, 0x6A,0xCB,0xC6, 0x7B,0xDC,0xD7, - 0x8C,0xED,0xE8, 0x9D,0xFE,0xF9, 0xAE,0xFF,0xFF, 0xBF,0xFF,0xFF, - -GREEN - 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1D, - 0x0A,0x6B,0x30, 0x1B,0x7C,0x41, 0x2C,0x8D,0x52, 0x3D,0x9E,0x63, - 0x4E,0xAF,0x74, 0x5F,0xC0,0x85, 0x70,0xD1,0x96, 0x81,0xE2,0xA7, - 0x92,0xF3,0xB8, 0xA3,0xFF,0xC8, 0xB4,0xFF,0xD3, 0xC5,0xFF,0xDF, - -YELLOW-GREEN - 0x00,0x26,0x0B, 0x00,0x37,0x10, 0x00,0x48,0x16, 0x0A,0x59,0x18, - 0x1B,0x6A,0x18, 0x2C,0x7B,0x18, 0x3D,0x8C,0x27, 0x4E,0x9D,0x38, - 0x5F,0xAE,0x49, 0x70,0xBF,0x5A, 0x81,0xD0,0x6B, 0x92,0xE1,0x7C, - 0xA3,0xF2,0x8D, 0xB4,0xFF,0x9C, 0xC5,0xFF,0xA8, 0xD6,0xFF,0xB4, - -ORANGE-GREEN - 0x00,0x1E,0x09, 0x00,0x2F,0x0E, 0x11,0x40,0x0E, 0x22,0x51,0x0E, - 0x33,0x62,0x0E, 0x44,0x73,0x0E, 0x55,0x84,0x0E, 0x66,0x95,0x17, - 0x77,0xA6,0x28, 0x88,0xB7,0x39, 0x99,0xC8,0x4A, 0xAA,0xD9,0x5B, - 0xBB,0xEA,0x6C, 0xCC,0xFB,0x7D, 0xDD,0xFF,0x8A, 0xEE,0xFF,0x96, - -LIGHT-ORANGE - 0x0A,0x11,0x02, 0x1B,0x22,0x02, 0x2C,0x33,0x02, 0x3D,0x44,0x02, - 0x4E,0x55,0x02, 0x5F,0x66,0x02, 0x70,0x77,0x02, 0x81,0x88,0x09, - 0x92,0x99,0x1A, 0xA3,0xAA,0x2B, 0xB4,0xBB,0x3C, 0xC5,0xCC,0x4D, - 0xD6,0xDD,0x5E, 0xE7,0xEE,0x6F, 0xF8,0xFF,0x80, 0xFF,0xFF,0x8F, -******************************************************************* - -******************************************************************* - PALETTE - PHASE 25.2 SHIFT - -GREY - 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, - 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, - 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, - 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, - -GOLD - 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, - 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, - 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, - 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, - -ORANGE - 0x30,0x00,0x00, 0x41,0x07,0x00, 0x52,0x18,0x00, 0x63,0x29,0x00, - 0x74,0x3A,0x00, 0x85,0x4B,0x00, 0x96,0x5C,0x0A, 0xA7,0x6D,0x1B, - 0xB8,0x7E,0x2C, 0xC9,0x8F,0x3D, 0xDA,0xA0,0x4E, 0xEB,0xB1,0x5F, - 0xFC,0xC2,0x70, 0xFF,0xD3,0x85, 0xFF,0xE4,0x9B, 0xFF,0xF5,0xB1, - -RED-ORANGE - 0x3E,0x00,0x00, 0x4F,0x00,0x00, 0x60,0x09,0x00, 0x71,0x1A,0x00, - 0x82,0x2B,0x0B, 0x93,0x3C,0x1C, 0xA4,0x4D,0x2D, 0xB5,0x5E,0x3E, - 0xC6,0x6F,0x4F, 0xD7,0x80,0x60, 0xE8,0x91,0x71, 0xF9,0xA2,0x82, - 0xFF,0xB3,0x96, 0xFF,0xC4,0xAC, 0xFF,0xD5,0xC2, 0xFF,0xE6,0xD8, - -PINK - 0x3F,0x00,0x00, 0x50,0x00,0x0C, 0x61,0x00,0x18, 0x72,0x0F,0x28, - 0x83,0x20,0x39, 0x94,0x31,0x4A, 0xA5,0x42,0x5B, 0xB6,0x53,0x6C, - 0xC7,0x64,0x7D, 0xD8,0x75,0x8E, 0xE9,0x86,0x9F, 0xFA,0x97,0xB0, - 0xFF,0xA8,0xC5, 0xFF,0xB9,0xDB, 0xFF,0xCA,0xEF, 0xFF,0xDB,0xF4, - -PURPLE - 0x35,0x00,0x31, 0x46,0x00,0x3D, 0x57,0x00,0x49, 0x68,0x0C,0x58, - 0x79,0x1D,0x69, 0x8A,0x2E,0x7A, 0x9B,0x3F,0x8B, 0xAC,0x50,0x9C, - 0xBD,0x61,0xAD, 0xCE,0x72,0xBE, 0xDF,0x83,0xCF, 0xF0,0x94,0xE0, - 0xFF,0xA5,0xE4, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, - -PURPLE-BLUE - 0x20,0x00,0x59, 0x31,0x00,0x65, 0x42,0x00,0x71, 0x53,0x10,0x82, - 0x64,0x21,0x93, 0x75,0x32,0xA4, 0x86,0x43,0xB5, 0x97,0x54,0xC6, - 0xA8,0x65,0xD7, 0xB9,0x76,0xE8, 0xCA,0x87,0xEB, 0xDB,0x98,0xEB, - 0xEC,0xA9,0xEB, 0xFD,0xBA,0xEB, 0xFF,0xCB,0xEF, 0xFF,0xDC,0xF4, - -BLUE1 - 0x05,0x00,0x70, 0x16,0x00,0x7C, 0x27,0x09,0x8B, 0x38,0x1A,0x9C, - 0x49,0x2B,0xAD, 0x5A,0x3C,0xBE, 0x6B,0x4D,0xCF, 0x7C,0x5E,0xE0, - 0X8D,0x6F,0xF1, 0x9E,0x80,0xF6, 0xAF,0x91,0xF6, 0xC0,0xA2,0xF6, - 0xD1,0xB3,0xF6, 0xE2,0xC4,0xF6, 0xF3,0xD5,0xF6, 0xFF,0xE6,0xF7, - -BLUE2 - 0x00,0x00,0x6B, 0x00,0x08,0x7E, 0x0C,0x19,0x91, 0x1D,0x2A,0xA2, - 0x2E,0x3B,0xB3, 0x3F,0x4C,0xC4, 0x50,0x5D,0xD5, 0x61,0x6E,0xE6, - 0x72,0x7F,0xF7, 0x83,0x90,0xFF, 0x94,0xA1,0xFF, 0xA5,0xB2,0xFF, - 0xB6,0xC3,0xFF, 0xC7,0xD4,0xFF, 0xD8,0xE5,0xFF, 0xE9,0xF6,0xFF, - -LIGHT-BLUE - 0x00,0x08,0x52, 0x00,0x19,0x68, 0x00,0x2A,0x7F, 0x05,0x3B,0x93, - 0x16,0x4C,0xA4, 0x27,0x5D,0xB5, 0x38,0x6E,0xC6, 0x49,0x7F,0xD7, - 0x5A,0x90,0xE8, 0x6B,0xA1,0xF9, 0x7C,0xB2,0xFF, 0x8D,0xC3,0xFF, - 0x9E,0xD4,0xFF, 0xAF,0xE5,0xFF, 0xC0,0xF6,0xFF, 0xD1,0xFF,0xFF, - -TURQUOISE - 0x00,0x17,0x2D, 0x00,0x28,0x43, 0x00,0x39,0x59, 0x00,0x4A,0x6F, - 0x08,0x5B,0x83, 0x19,0x6C,0x94, 0x2A,0x7D,0xA5, 0x3B,0x8E,0xB6, - 0x4C,0x9F,0xC7, 0x5D,0xB0,0xD8, 0x6E,0xC1,0xE9, 0x7F,0xD2,0xFA, - 0x90,0xE3,0xFF, 0xA1,0xF4,0xFF, 0xB2,0xFF,0xFF, 0xC3,0xFF,0xFF, - -GREEN-BLUE - 0x00,0x23,0x0A, 0x00,0x34,0x15, 0x00,0x45,0x2B, 0x00,0x56,0x41, - 0x04,0x67,0x56, 0x15,0x78,0x67, 0x26,0x89,0x78, 0x37,0x9A,0x89, - 0x48,0xAB,0x9A, 0x59,0xBC,0xAB, 0x6A,0xCD,0xBC, 0x7B,0xDE,0xCD, - 0x8C,0xEF,0xDE, 0x9D,0xFF,0xEE, 0xAE,0xFF,0xFA, 0xBF,0xFF,0xFF, - -GREEN - 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1B, - 0x0D,0x6B,0x25, 0x1E,0x7C,0x36, 0x2F,0x8D,0x47, 0x40,0x9E,0x58, - 0x51,0xAF,0x69, 0x62,0xC0,0x7A, 0x73,0xD1,0x8B, 0x84,0xE2,0x9C, - 0x95,0xF3,0xAD, 0xA6,0xFF,0xBD, 0xB7,0xFF,0xC9, 0xC8,0xFF,0xD4, - -YELLOW-GREEN - 0x00,0x24,0x0B, 0x00,0x35,0x10, 0x00,0x46,0x15, 0x10,0x57,0x15, - 0x21,0x68,0x15, 0x32,0x79,0x15, 0x43,0x8A,0x1C, 0x54,0x9B,0x2D, - 0x65,0xAC,0x3E, 0x76,0xBD,0x4F, 0x87,0xCE,0x60, 0x98,0xDF,0x71, - 0xA9,0xF0,0x82, 0xBA,0xFF,0x93, 0xCB,0xFF,0x9F, 0xDC,0xFF,0xAA, - -ORANGE-GREEN - 0x00,0x1B,0x08, 0x08,0x2C,0x0B, 0x19,0x3D,0x0B, 0x2A,0x4E,0x0B, - 0x3B,0x5F,0x0B, 0x4C,0x70,0x0B, 0x5D,0x81,0x0B, 0x6E,0x92,0x11, - 0x7F,0xA3,0x22, 0x90,0xB4,0x33, 0xA1,0xC5,0x44, 0xB2,0xD6,0x55, - 0xC3,0xE7,0x66, 0xD4,0xF8,0x77, 0xE5,0xFF,0x85, 0xF6,0xFF,0x91, - -LIGHT-ORANGE - 0x12,0x0C,0x00, 0x23,0x1D,0x00, 0x34,0x2E,0x00, 0x45,0x3F,0x00, - 0x56,0x50,0x00, 0x67,0x61,0x00, 0x78,0x72,0x00, 0x89,0x83,0x08, - 0x9A,0x94,0x19, 0xAB,0xA5,0x2A, 0xBC,0xB6,0x3B, 0xCD,0xC7,0x4C, - 0xDE,0xD8,0x5D, 0xEF,0xE9,0x6E, 0xFF,0xFA,0x80, 0xFF,0xFF,0x92, -******************************************************************* - -******************************************************************* - PALETTE - PHASE 25.7 SHIFT -GREY - 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, - 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, - 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, - 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, - -GOLD - 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, - 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, - 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, - 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, - -ORANGE - 0x31,0x00,0x00, 0x42,0x06,0x00, 0x53,0x17,0x00, 0x64,0x28,0x00, - 0x75,0x39,0x00, 0x86,0X4A,0x00, 0x97,0x5B,0x0A, 0xA8,0x6C,0x1B, - 0xB9,0x7D,0x2C, 0xCA,0x8E,0x3D, 0xDB,0x9F,0x4E, 0xEC,0xB0,0x5F, - 0xFD,0xC1,0x70, 0xFF,0xD2,0x85, 0xFF,0xE3,0x9C, 0xFF,0xF4,0xB2, - -RED-ORANGE - 0x3E,0x00,0x00, 0x4F,0x00,0x00, 0x60,0x08,0x00, 0x71,0x19,0x00, - 0x82,0x2A,0x0D, 0x93,0x3B,0x1E, 0xA4,0x4C,0x2F, 0xB5,0x5D,0x40, - 0xC6,0x6E,0x51, 0xD7,0x7F,0x62, 0xE8,0x90,0x73, 0xF9,0xA1,0x83, - 0xFF,0xB2,0x98, 0xFF,0xC3,0xAE, 0xFF,0xD4,0xC4, 0xFF,0xE5,0xDA, - -PINK - 0x3F,0x00,0x03, 0x50,0x00,0x0F, 0x61,0x00,0x1B, 0x72,0x0F,0x2B, - 0x83,0x20,0x3C, 0x94,0x31,0x4D, 0xA5,0x42,0x5E, 0xB6,0x53,0x6F, - 0xC7,0x64,0x80, 0xD8,0x75,0x91, 0xE9,0x86,0xA2, 0xFA,0x97,0xB3, - 0xFF,0xA8,0xC8, 0xFF,0xB9,0xDE, 0xFF,0xCA,0xEF, 0xFF,0xDB,0xF4, - -PURPLE - 0x33,0x00,0x35, 0x44,0x00,0x41, 0x55,0x00,0x4C, 0x66,0x0C,0x5C, - 0x77,0x1D,0x6D, 0x88,0x2E,0x7E, 0x99,0x3F,0x8F, 0xAA,0x50,0xA0, - 0xBB,0x61,0xB1, 0xCC,0x72,0xC2, 0xDD,0x83,0xD3, 0xEE,0x94,0xE4, - 0xFF,0xA5,0xE4, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, - -PURPLE-BLUE - 0x1D,0x00,0x5C, 0x2E,0x00,0x68, 0x40,0x00,0x74, 0x51,0x10,0x84, - 0x62,0x21,0x95, 0x73,0x32,0xA6, 0x84,0x43,0xB7, 0x95,0x54,0xC8, - 0xA6,0x65,0xD9, 0xB7,0x76,0xEA, 0xC8,0x87,0xEB, 0xD9,0x98,0xEB, - 0xE9,0xA9,0xEC, 0xFB,0xBA,0xEB, 0xFF,0xCB,0xEF, 0xFF,0xDC,0xF4, - -BLUE1 - 0x02,0x00,0x71, 0x13,0x00,0x7D, 0x24,0x0B,0x8C, 0x35,0x1C,0x9D, - 0x46,0x2D,0xAE, 0x57,0x3E,0xBF, 0x68,0x4F,0xD0, 0x79,0x60,0xE1, - 0x8A,0x71,0xF2, 0x9B,0x82,0xF7, 0xAC,0x93,0xF7, 0xBD,0xA4,0xF7, - 0xCE,0xB5,0xF7, 0xDF,0xC6,0xF7, 0xF0,0xD7,0xF7, 0xFF,0xE8,0xF8, - -BLUE2 - 0x00,0x00,0x68, 0x00,0x0A,0x7C, 0x08,0x1B,0x90, 0x19,0x2C,0xA1, - 0x2A,0x3D,0xB2, 0x3B,0x4E,0xC3, 0x4C,0x5F,0xD4, 0x5D,0x70,0xE5, - 0x6E,0x81,0xF6, 0x7F,0x92,0xFF, 0x90,0xA3,0xFF, 0xA1,0xB4,0xFF, - 0xB2,0xC5,0xFF, 0xC3,0xD6,0xFF, 0xD4,0xE7,0xFF, 0xE5,0xF8,0xFF, - -LIGHT-BLUE - 0x00,0x0A,0x4D, 0x00,0x1B,0x63, 0x00,0x2C,0x79, 0x02,0x3D,0x8F, - 0x13,0x4E,0xA0, 0x24,0x5F,0xB1, 0x35,0x70,0xC2, 0x46,0x81,0xD3, - 0x57,0x92,0xE4, 0x68,0xA3,0xF5, 0x79,0xB4,0xFF, 0x8A,0xC5,0xFF, - 0x9B,0xD6,0xFF, 0xAC,0xE7,0xFF, 0xBD,0xF8,0xFF, 0xCE,0xFF,0xFF, - -TURQUOISE - 0x00,0x1A,0x26, 0x00,0x2B,0x3C, 0x00,0x3C,0x52, 0x00,0x4D,0x68, - 0x06,0x5E,0x7C, 0x17,0x6F,0x8D, 0x28,0x80,0x9E, 0x39,0x91,0xAF, - 0x4A,0xA2,0xC0, 0x5B,0xB3,0xD1, 0x6C,0xC4,0xE2, 0x7D,0xD5,0xF3, - 0x8E,0xE6,0xFF, 0x9F,0xF7,0xFF, 0xB0,0xFF,0xFF, 0xC1,0xFF,0xFF, - -GREEN-BLUE - 0x00,0x24,0x0B, 0x00,0x35,0x10, 0x00,0x46,0x22, 0x00,0x57,0x38, - 0x05,0x68,0x4D, 0x16,0x79,0x5E, 0x27,0x8A,0x6F, 0x38,0x9B,0x80, - 0x49,0xAC,0x91, 0x5A,0xBD,0xA2, 0x6B,0xCE,0xB3, 0x7C,0xDF,0xC4, - 0x8D,0xF0,0xD5, 0x9E,0xFF,0xE5, 0xAF,0xFF,0xF1, 0xC0,0xFF,0xFD, - -GREEN - 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1B, - 0x10,0x6B,0x1B, 0x21,0x7C,0x2C, 0x32,0x8D,0x3D, 0x43,0x9E,0x4E, - 0x54,0xAF,0x5F, 0x65,0xC0,0x70, 0x76,0xD1,0x81, 0x87,0xE2,0x92, - 0x98,0xF3,0xA3, 0xA9,0xFF,0xB3, 0xBA,0xFF,0xBF, 0xCB,0xFF,0xCB, - -YELLOW-GREEN - 0x00,0x23,0x0A, 0x00,0x34,0x10, 0x04,0x45,0x13, 0x15,0x56,0x13, - 0x26,0x67,0x13, 0x37,0x78,0x13, 0x48,0x89,0x14, 0x59,0x9A,0x25, - 0x6A,0xAB,0x36, 0x7B,0xBC,0x47, 0x8C,0xCD,0x58, 0x9D,0xDE,0x69, - 0xAE,0xEF,0x7A, 0xBF,0xFF,0x8B, 0xD0,0xFF,0x97, 0xE1,0xFF,0xA3, - -ORANGE-GREEN - 0x00,0x17,0x07, 0x0E,0x28,0x08, 0x1F,0x39,0x08, 0x30,0x4A,0x08, - 0x41,0x5B,0x08, 0x52,0x6C,0x08, 0x63,0x7D,0x08, 0x74,0x8E,0x0D, - 0x85,0x9F,0x1E, 0x96,0xB0,0x2F, 0xA7,0xC1,0x40, 0xB8,0xD2,0x51, - 0xC9,0xE3,0x62, 0xDA,0xF4,0x73, 0xEB,0xFF,0x82, 0xFC,0xFF,0x8E, - -LIGHT-ORANGE - 0x19,0x07,0x00, 0x2A,0x18,0x00, 0x3B,0x29,0x00, 0x4C,0x3A,0x00, - 0x5D,0x4B,0x00, 0x6E,0x5C,0x00, 0x7F,0x6D,0x00, 0x90,0x7E,0x09, - 0xA1,0x8F,0x1A, 0xB2,0xA0,0x2B, 0xC3,0xB1,0x3C, 0xD4,0xC2,0x4D, - 0xE5,0xD3,0x5E, 0xF6,0xE4,0x6F, 0xFF,0xF5,0x82, 0xFF,0xFF,0x96, -******************************************************************* - -******************************************************************* - PALETTE - PHASE 26.7 SHIFT - -GREY - 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, - 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, - 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, - 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, - -GOLD - 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, - 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, - 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, - 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xFF,0x97, - -ORANGE - 0x32,0x00,0x00, 0x43,0x06,0x00, 0x54,0x17,0x00, 0x65,0x28,0x00, - 0x79,0x39,0x00, 0x87,0x4A,0x00, 0x98,0x5B,0x0C, 0xA9,0x6C,0x1D, - 0xBA,0x7D,0x2E, 0xCB,0x8E,0x3F, 0xDC,0x9F,0x50, 0xED,0xB0,0x61, - 0xFE,0xC1,0x72, 0xFF,0xD2,0x87, 0xFF,0xE3,0x9E, 0xFF,0xF4,0xB4, - -RED-ORANGE - 0x3E,0x00,0x00, 0x4F,0x00,0x00, 0x60,0x07,0x00, 0x71,0x18,0x00, - 0x82,0x29,0x10, 0x93,0x3A,0x21, 0xA4,0x4B,0x32, 0xB5,0x5C,0x43, - 0xC6,0x6D,0x54, 0xD7,0x7E,0x65, 0xE8,0x8F,0x76, 0xF9,0xA0,0x87, - 0xFF,0xB1,0x9C, 0xFF,0xC2,0xB2, 0xFF,0xD3,0xC8, 0xFF,0xE4,0xDE, - -PINK - 0x3E,0x00,0x09, 0x4F,0x00,0x15, 0x60,0x00,0x21, 0x71,0x0E,0x31, - 0x82,0x1F,0x42, 0x93,0x30,0x53, 0xA4,0x41,0x64, 0xB5,0x52,0x75, - 0xC6,0x63,0x86, 0xD7,0x74,0x97, 0xE8,0x85,0xA8, 0xF9,0x96,0xB9, - 0xFF,0xA7,0xCE, 0xFF,0xB8,0xE4, 0xFF,0xC9,0xEF, 0xFF,0xDA,0xF4, - -PURPLE - 0x30,0x00,0x3D, 0x41,0x00,0x48, 0x52,0x00,0x54, 0x63,0x0C,0x64, - 0x74,0x1D,0x75, 0x85,0x2E,0x86, 0x96,0x3F,0x97, 0xA7,0x50,0xA8, - 0xB8,0x61,0xB9, 0xC9,0x72,0xCA, 0xDA,0x83,0xDB, 0xEB,0x94,0xE5, - 0xFC,0xA5,0xE5, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, - -PURPLE-BLUE - 0x18,0x00,0x62, 0x29,0x00,0x6E, 0x3A,0x01,0x7A, 0x4B,0x12,0x8B, - 0x5C,0x23,0x9C, 0x6D,0x34,0xAD, 0x7E,0x45,0xBE, 0x8F,0x56,0xCF, - 0xA0,0x67,0xE0, 0xB1,0x78,0xEE, 0xC2,0x89,0xEE, 0xD3,0x9A,0xEE, - 0xE4,0xAB,0xEE, 0xF5,0xBC,0xEE, 0xFF,0xCD,0xE0, 0xFF,0xDE,0xF5, - -BLUE1 - 0x00,0x00,0x72, 0x0C,0x00,0x7F, 0x1D,0x0E,0x8F, 0x2E,0x1F,0xA0, - 0x3F,0x30,0xB1, 0x50,0x41,0xC2, 0x61,0x52,0xD3, 0x72,0x63,0xE4, - 0x83,0x74,0xF5, 0x94,0x85,0xFA, 0xA5,0x96,0xFA, 0xB6,0xA7,0xFA, - 0xC7,0xB8,0xFA, 0xD8,0xC9,0xFA, 0xE9,0xDA,0xFA, 0xFA,0xE8,0xFA, - -BLUE2 - 0x00,0x00,0x62, 0x00,0x0F,0x77, 0x01,0x20,0x8D, 0x12,0x31,0x9E, - 0x23,0x42,0xAF, 0x34,0x53,0xC0, 0x45,0x64,0xD1, 0x56,0x75,0xE2, - 0x67,0x86,0xF3, 0x78,0x97,0xFF, 0x89,0xA8,0xFF, 0x9A,0xB9,0xFF, - 0xAB,0xCA,0xFF, 0xBC,0xDB,0xFF, 0xCD,0xEC,0xFF, 0xDE,0xFD,0xFF, - -LIGHT-BLUE - 0x00,0x10,0x42, 0x00,0x21,0x58, 0x00,0x32,0x6E, 0x00,0x43,0x84, - 0x0E,0x54,0x96, 0x1F,0x65,0xA7, 0x30,0x76,0xB8, 0x41,0x87,0xC9, - 0x52,0x98,0xDA, 0x63,0xA9,0xEB, 0x74,0xBA,0xFC, 0x85,0xCB,0xFF, - 0x96,0xDC,0xFF, 0xA7,0xED,0xFF, 0xB8,0xFE,0xFF, 0xC9,0xFF,0xFF, - -TURQUOISE - 0x00,0x1E,0x14, 0x00,0x2F,0x2A, 0x00,0x40,0x40, 0x00,0x51,0x56, - 0x04,0x62,0x6B, 0x15,0x73,0x7C, 0x26,0x84,0x8D, 0x37,0x95,0x9E, - 0x48,0xA6,0xAF, 0x59,0xB7,0xC0, 0x6A,0xC8,0xD1, 0x7B,0xD9,0xE2, - 0x8C,0xEA,0xF3, 0x9D,0xFB,0xFF, 0xAE,0xFF,0xFF, 0xBF,0xFF,0xFF, - -GREEN-BLUE - 0x00,0x26,0x0B, 0x00,0x37,0x10, 0x00,0x48,0x16, 0x00,0x59,0x25, - 0x08,0x6A,0x38, 0x19,0x7B,0x49, 0x2A,0x8C,0x5A, 0x3B,0x9D,0x6B, - 0x4C,0xAE,0x7C, 0x5D,0xBF,0x8D, 0x6E,0xD0,0x9E, 0x7F,0xE1,0xAF, - 0x90,0xF2,0xC0, 0xA1,0xFF,0xD0, 0xB2,0xFF,0xDC, 0xC3,0xFF,0xE8, - -GREEN - 0x00,0x26,0x0B, 0x00,0x37,0x10, 0x00,0x48,0x16, 0x08,0x59,0x18, - 0x19,0x6A,0x18, 0x2A,0x7B,0x18, 0x3B,0x8C,0x29, 0x4C,0x9D,0x3A, - 0x5D,0xAE,0x4B, 0x6E,0xBF,0x5C, 0x7F,0xD0,0x6D, 0x90,0xE1,0x7E, - 0xA1,0xF2,0x8F, 0xB2,0xFF,0x9F, 0xC3,0xFF,0xAB, 0xD4,0xFF,0xB7, - -YELLOW-GREEN - 0x00,0x1E,0x09, 0x00,0x2F,0x0E, 0x11,0x40,0x0E, 0x22,0x51,0x0E, - 0x33,0x62,0x0E, 0x44,0x73,0x0E, 0x55,0x84,0x0E, 0x66,0x95,0x17, - 0x77,0xA6,0x28, 0x88,0xB7,0x39, 0x99,0xC8,0x4A, 0xAA,0xD9,0x5B, - 0xBB,0xEA,0x6C, 0xCC,0xFB,0x7D, 0xDD,0xFF,0x8A, 0xEE,0xFF,0x96, - -ORANGE-GREEN - 0x0D,0x0F,0x01, 0x1E,0x20,0x01, 0x2F,0x31,0x01, 0x40,0x42,0x01, - 0x51,0x53,0x01, 0x62,0x64,0x01, 0x73,0x75,0x01, 0x84,0x86,0x08, - 0x95,0x97,0x19, 0xA6,0xA8,0x2A, 0xB7,0xB9,0x3B, 0xC8,0xCA,0x4C, - 0xD9,0xDB,0x5D, 0xEA,0xEC,0x6E, 0xFB,0xFD,0x7F, 0xFF,0xFF,0x8F, - -LIGHT-ORANGE - 0x28,0x00,0x00, 0x39,0x0E,0x00, 0x4A,0x1F,0x00, 0x5B,0x30,0x00, - 0x6C,0x41,0x00, 0x7D,0x52,0x00, 0x8E,0x63,0x00, 0x9F,0x74,0x10, - 0xB0,0x85,0x21, 0xC1,0x96,0x32, 0xD2,0xA7,0x43, 0xE3,0xB8,0x54, - 0xF4,0xC9,0x65, 0xFF,0xDA,0x78, 0xFF,0xEB,0x8E, 0xFF,0xFC,0xA4, -******************************************************************* - -******************************************************************* - PALETTE - PHASE 27.2 SHIFT - - -GREY - 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, - 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, - 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, - 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, - -GOLD - 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, - 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, - 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, - 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xF7,0x97, - -ORANGE - 0x32,0x00,0x00, 0x43,0x05,0x00, 0x54,0x16,0x00, 0x65,0x27,0x00, - 0x76,0x38,0x00, 0x87,0X49,0x00, 0x98,0x5A,0x0C, 0xA9,0x6B,0x1D, - 0xBA,0x7C,0x2E, 0xCB,0x8D,0x3F, 0xDC,0x9E,0x50, 0xED,0xAF,0x61, - 0xFE,0xC0,0x72, 0xFF,0xD1,0x88, 0xFF,0xE2,0x9E, 0xFF,0xF3,0xB4, - -RED-ORANGE - 0x3F,0x00,0x00, 0x50,0x00,0x00, 0x61,0x07,0x00, 0x72,0x18,0x01, - 0x83,0x29,0x12, 0x94,0x3A,0x23, 0xA5,0x4B,0x34, 0xB6,0x5C,0x45, - 0xC7,0x6D,0x56, 0xD8,0x7E,0x67, 0xE9,0x8F,0x78, 0xFA,0xA0,0x89, - 0xFF,0xB1,0x9E, 0xFF,0xC2,0xB4, 0xFF,0xD3,0xCA, 0xFF,0xE4,0xE0, - -PINK - 0x3E,0x00,0x0C, 0x4F,0x00,0x18, 0x60,0x00,0x24, 0x71,0x0E,0x34, - 0x82,0x1F,0x45, 0x93,0x30,0x56, 0xA4,0x41,0x67, 0xB5,0x52,0x78, - 0xC6,0x63,0x89, 0xD7,0x74,0x9A, 0xE8,0x85,0xAB, 0xF9,0x96,0xB6, - 0xFF,0xA7,0xD1, 0xFF,0xB8,0xE7, 0xFF,0xC9,0xEF, 0xFF,0xDA,0xF4, - -PURPLE - 0x2F,0x00,0x3F, 0x40,0x00,0x4B, 0x51,0x00,0x57, 0x62,0x0C,0x66, - 0x73,0x1D,0x77, 0x84,0x2E,0x88, 0x95,0x3F,0x99, 0xA6,0x50,0xAA, - 0xB7,0x61,0xBB, 0xC8,0x72,0xCC, 0xD9,0x83,0xDD, 0xEA,0x94,0xE5, - 0xFB,0xA5,0xE5, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, - -PURPLE-BLUE - 0x16,0x00,0x64, 0x27,0x00,0x70, 0x38,0x02,0x7D, 0x49,0x13,0x8E, - 0x5A,0x24,0x9F, 0x6B,0x35,0xB0, 0x7C,0x46,0xC1, 0x8D,0x57,0xD2, - 0x9E,0x68,0xE3, 0xAF,0x79,0xEF, 0xC0,0x8A,0xEF, 0xD1,0x9D,0xEF, - 0xE2,0xAC,0xEF, 0xF3,0xBD,0xEF, 0xFF,0xCE,0xF0, 0xFF,0xDF,0xF5, - -BLUE1 - 0x00,0x00,0x71, 0x09,0x00,0x7F, 0x1A,0x10,0x90, 0x2B,0x21,0xA1, - 0x3C,0x32,0xB2, 0x4D,0x43,0xC3, 0x5E,0x54,0xD4, 0x6F,0x65,0xE5, - 0x80,0x76,0xF6, 0x91,0x87,0xFC, 0xA2,0x98,0xFC, 0xB3,0xA9,0xFC, - 0xC4,0xBA,0xFC, 0xD5,0xCB,0xFC, 0xE6,0xDC,0xFC, 0xF7,0xED,0xFC, - -BLUE2 - 0x00,0x00,0x5E, 0x00,0x11,0x74, 0x00,0x22,0x8A, 0x0F,0x33,0x9C, - 0x20,0x44,0xAD, 0x31,0x55,0xBE, 0x42,0x66,0xCF, 0x53,0x77,0xE0, - 0x64,0x88,0xF1, 0x75,0x99,0xFF, 0x86,0xAA,0xFF, 0x97,0xBB,0xFF, - 0xA8,0xCC,0xFF, 0xB9,0xDD,0xFF, 0xCA,0xEE,0xFF, 0xDB,0xFF,0xFF, - -LIGHT-BLUE - 0x00,0x12,0x3B, 0x00,0x23,0x51, 0x00,0x34,0x68, 0x00,0x45,0x7E, - 0x0C,0x56,0x90, 0x1D,0x67,0xA1, 0x2E,0x78,0xB2, 0x3F,0x89,0xC3, - 0x50,0x9A,0xD4, 0x61,0xAB,0xE5, 0x72,0xBC,0xF6, 0x83,0xCD,0xFF, - 0x94,0xDE,0xFF, 0xA5,0xEF,0xFF, 0xB6,0xFF,0xFF, 0xC7,0xFF,0xFF, - -TURQUOISE - 0x00,0x20,0x0C, 0x00,0x31,0x22, 0x00,0x42,0x38, 0x00,0x53,0x4E, - 0x04,0x64,0x63, 0x15,0x75,0x74, 0x26,0x86,0x85, 0x37,0x97,0x96, - 0x48,0xA8,0xA7, 0x59,0xB9,0xB8, 0x6A,0xCA,0xC9, 0x7B,0xDB,0xDA, - 0x8C,0xEC,0xEB, 0x9D,0xFD,0xFC, 0xAE,0xFF,0xFF, 0xBF,0xFF,0xFF, - -GREEN-BLUE - 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1C, - 0x0B,0x6B,0x2F, 0x1C,0x7C,0x40, 0x2D,0x8D,0x51, 0x3E,0x9E,0x62, - 0x4F,0xAF,0x73, 0x60,0xC0,0x84, 0x71,0xD1,0x95, 0x82,0xE2,0xA6, - 0x93,0xF3,0xB7, 0xA4,0xFF,0xC6, 0xB5,0xFF,0xD2, 0xC6,0xFF,0xDE, - -GREEN - 0x00,0x25,0x0B, 0x00,0x36,0x10, 0x00,0x47,0x15, 0x0D,0x58,0x16, - 0x1E,0x69,0x16, 0x2F,0x7A,0x16, 0x40,0x8B,0x21, 0x51,0x9C,0x32, - 0x62,0xAD,0x43, 0x73,0xBE,0x54, 0x84,0xCF,0x65, 0x95,0xE0,0x76, - 0xA6,0xF1,0x87, 0xB7,0xFF,0x98, 0xC8,0xFF,0xA3, 0xD9,0xFF,0xAF, - -YELLOW-GREEN - 0x00,0x1B,0x08, 0x06,0x2C,0x0B, 0x17,0x3D,0x0B, 0x28,0x4E,0x0B, - 0x39,0x5F,0x0B, 0x4A,0x70,0x0B, 0x5B,0x81,0x0B, 0x6C,0x92,0x12, - 0x7D,0xA3,0x23, 0x8E,0xB4,0x34, 0x9F,0xC5,0x45, 0xB0,0xD6,0x56, - 0xC1,0xE7,0x67, 0xD2,0xF8,0x78, 0xE3,0xFF,0x86, 0xF4,0xFF,0x92, - -ORANGE-GREEN - 0x13,0x0B,0x00, 0x24,0x1C,0x00, 0x35,0x2D,0x00, 0x46,0x3E,0x00, - 0x57,0x4F,0x00, 0x68,0x60,0x00, 0x79,0x71,0x00, 0x8A,0x82,0x08, - 0x9B,0x93,0x19, 0xAC,0xA4,0x2A, 0xBD,0xB5,0x3B, 0xCE,0xC6,0x4C, - 0xDF,0xD7,0x5D, 0xF0,0xE8,0x6E, 0xFF,0xF9,0x7F, 0xFF,0xFF,0x92, - -LIGHT-ORANGE - 0x2D,0x00,0x00, 0x3E,0x0A,0x00, 0x4F,0x1B,0x00, 0x60,0x2C,0x00, - 0x71,0x3D,0x00, 0x82,0x4E,0x00, 0x93,0x5F,0x05, 0xA4,0x70,0x16, - 0xB5,0x81,0x27, 0xC4,0x90,0x37, 0xD7,0xA3,0x49, 0xE8,0xB4,0x5A, - 0xF9,0xC5,0x6B, 0xFF,0xD6,0x80, 0xFF,0xE7,0x96, 0xFF,0xF8,0xAC, -******************************************************************* - -******************************************************************* - PALETTE - 27.7 PHASE SHIFT - -GREY - 0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33, - 0x44,0x44,0x44, 0x55,0x55,0x55, 0x66,0x66,0x66, 0x77,0x77,0x77, - 0x88,0x88,0x88, 0x99,0x99,0x99, 0xAA,0xAA,0xAA, 0xBB,0xBB,0xBB, - 0xCC,0xCC,0xCC, 0xDD,0xDD,0xDD, 0xEE,0xEE,0xEE, 0xFF,0xFF,0xFF, - -GOLD - 0x1A,0x07,0x00, 0x2B,0x18,0x00, 0x3C,0x29,0x00, 0x4D,0x3A,0x00, - 0x5E,0x4B,0x00, 0x6F,0x5C,0x00, 0x80,0x6D,0x00, 0x91,0x7E,0x09, - 0xA2,0x8F,0x1A, 0xB3,0xA0,0x2B, 0xC4,0xB1,0x3C, 0xD5,0xC2,0x4D, - 0xE6,0xD3,0x5E, 0xF7,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xFF,0x97, - -ORANGE - 0x32,0x00,0x00, 0x43,0x05,0x00, 0x54,0x16,0x00, 0x65,0x27,0x00, - 0x76,0x38,0x00, 0x87,0x49,0x00, 0x98,0x5A,0x0C, 0xA9,0x6B,0x1D, - 0xBA,0x7C,0x2E, 0xCB,0x8D,0x3F, 0xDC,0x9E,0x50, 0xED,0xAF,0x61, - 0xFE,0xC0,0x72, 0xFF,0xD1,0x88, 0xFF,0xE2,0x9E, 0xFF,0xF3,0xB4, - -RED-ORANGE - 0x3F,0x00,0x00, 0x50,0x00,0x00, 0x61,0x06,0x00, 0x72,0x17,0x03, - 0x83,0x28,0x14, 0x94,0x39,0x25, 0xA5,0x4A,0x36, 0xB6,0x5B,0x47, - 0xC7,0x6C,0x58, 0xD8,0x7D,0x69, 0xE9,0x8E,0x7A, 0xFA,0x9F,0x8B, - 0xFF,0xB0,0x9F, 0xFF,0xC1,0xB5, 0xFF,0xD2,0xCB, 0xFF,0xE3,0xE1, - -PINK - 0x3D,0x00,0x10, 0x4E,0x00,0x1C, 0x5F,0x00,0x27, 0x70,0x0D,0x37, - 0x81,0x1E,0x48, 0x92,0x2F,0x59, 0xA3,0x40,0x6A, 0xB4,0x51,0x7B, - 0xC5,0x62,0x8C, 0xD6,0x73,0x9D, 0xE7,0x84,0xAE, 0xF8,0x95,0xBF, - 0xFF,0xA6,0xD3, 0xFF,0xB7,0xE9, 0xFF,0xC8,0xEE, 0xFF,0xD9,0xF4, - -PURPLE - 0x2D,0x00,0x42, 0x3E,0x00,0x4E, 0x4F,0x00,0x5A, 0x60,0x0C,0x6A, - 0x71,0x1D,0x7B, 0x82,0x2E,0x8C, 0x93,0x3F,0x9D, 0xA4,0x50,0xAE, - 0xB5,0x61,0xBF, 0xC6,0x72,0xD0, 0xD7,0x83,0xE1, 0xE8,0x94,0xE6, - 0xF9,0xA5,0xE6, 0xFF,0xB6,0xE9, 0xFF,0xC7,0xEE, 0xFF,0xD8,0xF3, - -PURPLE-BLUE - 0x13,0x00,0x67, 0x24,0x00,0x73, 0x35,0x03,0x80, 0x46,0x14,0x91, - 0x57,0x25,0xA2, 0x68,0x36,0xB3, 0x79,0x47,0xC4, 0x8A,0x58,0xD5, - 0x9B,0x69,0xE6, 0xAC,0x7A,0xF0, 0xBD,0x8B,0xF0, 0xCE,0x9C,0xF0, - 0xDF,0xAD,0xF0, 0xF0,0xBE,0xF0, 0xFF,0xCF,0xF1, 0xFF,0xE0,0xF6, - -BLUE1 - 0x00,0x00,0x70, 0x05,0x01,0x80, 0x16,0x12,0x91, 0x27,0x23,0xA2, - 0x38,0x34,0xB3, 0x49,0x45,0xC4, 0x5A,0x56,0xD5, 0x6B,0x67,0xE6, - 0x7C,0x78,0xF7, 0x8D,0x89,0xFE, 0x9E,0x9A,0xFE, 0xAF,0xAB,0xFE, - 0xC0,0xBC,0xFE, 0xD1,0xCD,0xFE, 0xE2,0xDE,0xFE, 0xF3,0xEF,0xFE, - -BLUE2 - 0x00,0x03,0x5B, 0x00,0x14,0x71, 0x00,0x25,0x87, 0x0C,0x36,0x9A, - 0x1D,0x47,0xAB, 0x2E,0x58,0xBC, 0x3F,0x69,0xCD, 0x50,0x7A,0xDE, - 0x61,0x8B,0xEF, 0x72,0x9C,0xFF, 0x83,0xAD,0xFF, 0x94,0xBE,0xFF, - 0xA5,0xCF,0xFF, 0xB6,0xE0,0xFF, 0xC7,0xF1,0xFF, 0xD8,0xFF,0xFF, - -LIGHT-BLUE - 0x00,0x15,0x35, 0x00,0x26,0x4B, 0x00,0x37,0x61, 0x00,0x48,0x78, - 0x0A,0x59,0x8B, 0x1B,0x6A,0x9C, 0x2C,0x7B,0xAD, 0x3D,0x8C,0xBE, - 0x4E,0x9D,0xCF, 0x5F,0xAE,0xE0, 0x70,0xBF,0xF1, 0x81,0xD0,0xFF, - 0x92,0xE1,0xFF, 0xA3,0xF2,0xFF, 0xB4,0xFF,0xFF, 0xC5,0xFF,0xFF, - -TURQUOISE - 0x00,0x22,0x0A, 0x00,0x33,0x19, 0x00,0x44,0x2F, 0x00,0x55,0x45, - 0x04,0x66,0x5A, 0x15,0x77,0x6B, 0x26,0x88,0x7C, 0x37,0x99,0x8D, - 0x48,0xAA,0x9E, 0x59,0xBB,0xAF, 0x6A,0xCC,0xC0, 0x7B,0xDD,0xD1, - 0x8C,0xEE,0xE2, 0x9D,0xFF,0xF3, 0xAE,0xFF,0xFF, 0xBF,0xFF,0xFF, - -GREEN-BLUE - 0x00,0x27,0x0C, 0x00,0x38,0x11, 0x00,0x49,0x16, 0x00,0x5A,0x1B, - 0x0D,0x6B,0x25, 0x1E,0x7C,0x36, 0x2F,0x8D,0x47, 0x40,0x9E,0x58, - 0x51,0xAF,0x69, 0x62,0xC0,0x7A, 0x73,0xD1,0x8B, 0x84,0xE2,0x9C, - 0x95,0xF3,0xAD, 0xA6,0xFF,0xBD, 0xB7,0xFF,0xC9, 0xC8,0xFF,0xD4, - -GREEN - 0x00,0x24,0x0B, 0x00,0x35,0x10, 0x01,0x46,0x15, 0x12,0x57,0x15, - 0x23,0x68,0x15, 0x34,0x79,0x15, 0x45,0x8A,0x19, 0x56,0x9B,0x2A, - 0x67,0xAC,0x3B, 0x78,0xBD,0x4C, 0x89,0xCE,0x5D, 0x9A,0xDF,0x6E, - 0xAB,0xF0,0x7F, 0xBC,0xFF,0x8F, 0xCD,0xFF,0x9B, 0xDE,0xFF,0xA7, - -YELLOW-GREEN - 0x00,0x18,0x07, 0x00,0x29,0x0C, 0x1E,0x3A,0x08, 0x2F,0x4B,0x08, - 0x40,0x5C,0x08, 0x51,0x6D,0x08, 0x62,0x7E,0x08, 0x73,0x8F,0x0D, - 0x84,0xA0,0x1E, 0x95,0xB1,0x2F, 0xA6,0xC2,0x40, 0xB7,0xD3,0x51, - 0xC8,0xE4,0x62, 0xD9,0xF5,0x73, 0xEA,0xFF,0x82, 0xFB,0xFF,0x8E, - -ORANGE-GREEN - 0x1B,0x07,0x00, 0x2C,0x18,0x00, 0x3D,0x29,0x00, 0x4E,0x3A,0x00, - 0x5F,0x4B,0x00, 0x70,0x5C,0x00, 0x81,0x6D,0x00, 0x92,0x7E,0x09, - 0xA3,0x8F,0x1A, 0xB4,0xA0,0x2B, 0xC5,0xB1,0x3C, 0xD6,0xC2,0x4D, - 0xE7,0xD3,0x5E, 0xF8,0xE4,0x6F, 0xFF,0xF5,0x83, 0xFF,0xFF,0x97, - -LIGHT-ORANGE - 0x33,0x00,0x00, 0x44,0x05,0x00, 0x55,0x16,0x00, 0x66,0x27,0x00, - 0x77,0x38,0x00, 0x88,0x49,0x00, 0x99,0x5A,0x0D, 0xAA,0x6B,0x1E, - 0xBB,0x7C,0x2F, 0xCC,0x8D,0x40, 0xDD,0x9E,0x51, 0xEE,0xAF,0x62, - 0xFF,0xC0,0x73, 0xFF,0xD1,0x89, 0xFF,0xE2,0x9F, 0xFF,0xF3,0xB5 -*******************************************************************/ - -/************************************************************** - * - * Memory setup - * - **************************************************************/ - -void a400_state::setup_ram(int bank, UINT32 size) -{ - offs_t ram_top; - - switch (bank) - { - case 0: // 0x0000-0x7fff - ram_top = MIN(size, 0x8000) - 1; - m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, ram_top, "0000"); - if (m_0000 == NULL) - m_0000.findit(); - m_0000->set_base(m_ram->pointer()); - break; - case 1: // 0x8000-0x9fff - ram_top = MIN(size, 0xa000) - 1; - if (ram_top > 0x8000) - { - m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x8000, ram_top, "8000"); - if (m_8000 == NULL) - m_8000.findit(); - m_8000->set_base(m_ram->pointer() + 0x8000); - } - break; - case 2: // 0xa000-0xbfff - ram_top = MIN(size, 0xc000) - 1; - if (ram_top > 0xa000) - { - m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0xa000, ram_top, "a000"); - if (m_a000 == NULL) - m_a000.findit(); - m_a000->set_base(m_ram->pointer() + 0xa000); - } - break; - } -} - - -// these handle cart enable/disable without calling setup_ram thousands of times -READ8_MEMBER(a400_state::special_read_8000) -{ - if (!m_cart_disabled) - return m_cart->read_80xx(space, offset); - else - { - offset += 0x8000; - if (m_ram->size() < offset) - return 0; - else - return m_ram->pointer()[offset]; - } -} - -WRITE8_MEMBER(a400_state::special_write_8000) -{ - if (m_cart_disabled) - { - offset += 0x8000; - if (m_ram->size() >= offset) - m_ram->pointer()[offset] = data; - } -} - -READ8_MEMBER(a400_state::special_read_a000) -{ - if (!m_cart_disabled) - return m_cart->read_80xx(space, offset); - else - { - offset += 0xa000; - if (m_ram->size() < offset) - return 0; - else - return m_ram->pointer()[offset]; - } -} - -WRITE8_MEMBER(a400_state::special_write_a000) -{ - if (m_cart_disabled) - { - offset += 0xa000; - if (m_ram->size() >= offset) - m_ram->pointer()[offset] = data; - } -} - - -READ8_MEMBER(a400_state::read_d5xx) -{ - disable_cart(space, offset, 0); - return 0xff; -} - -WRITE8_MEMBER(a400_state::disable_cart) -{ - if (m_cart->exists()) - { - switch (m_cart->get_cart_type()) - { - case A800_PHOENIX: - case A800_BLIZZARD: - if (!m_cart_disabled) - m_cart_disabled = 1; - break; - case A800_OSS034M: - case A800_OSS043M: - case A800_EXPRESS: - case A800_DIAMOND: - case A800_WILLIAMS: - // use m_cart_disabled & m_last_offs to avoid continuous remapping of - // the memory space in some games (e.g. dropzone) - if (offset & 0x8 && !m_cart_disabled) - m_cart_disabled = 1; - else if (!(offset & 0x8)) - { - if (m_cart_disabled) - m_cart_disabled = 0; - - if ((offset & 0x7) != m_last_offs) - { - // we enter here only if we are writing to a different offset than last time - m_last_offs = offset & 0x7; - m_cart->write_d5xx(space, offset, data); - } - } - break; - case A800_TURBO64: - case A800_TURBO128: - if (offset & 0x10 && !m_cart_disabled) - m_cart_disabled = 1; - else if (!(offset & 0x10)) - { - if (m_cart_disabled) - m_cart_disabled = 0; - - if ((offset & 0x0f) != m_last_offs) - { - // we enter here only if we are writing to a different offset than last time - m_last_offs = offset & 0x0f; - m_cart->write_d5xx(space, offset & 0x0f, data); - } - } - break; - case A800_SPARTADOS: - // writes with offset & 8 are also used to enable/disable the subcart, so they go through! - m_cart->write_d5xx(space, offset, data); - break; - case A800_OSSM091: - case A800_OSS8K: - if ((offset & 0x9) == 0x08) - m_cart_disabled = 1; - else - { - m_cart_disabled = 0; - m_cart->write_d5xx(space, offset, data); - } - break; - case A800_MICROCALC: - m_cart_helper = (m_cart_helper + 1) % 5; - if (m_cart_helper == 4) - m_cart_disabled = 1; - else - { - m_cart_disabled = 0; - m_cart->write_d5xx(space, offset, m_cart_helper); - } - break; - default: - break; - } - } -} - -void a400_state::setup_cart(a800_cart_slot_device *slot) -{ - m_cart_disabled = 0; - m_last_offs = -1; - - if (slot->exists()) - { - switch (slot->get_cart_type()) - { - case A800_8K: - m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff); - break; - case A800_8K_RIGHT: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0x9fff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0x9fff); - break; - case A800_16K: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0xbfff); - break; - case A800_BBSB: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x8000, 0x9fff, write8_delegate(FUNC(a800_cart_slot_device::write_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff); - break; - case A800_OSS034M: - case A800_OSS043M: - case A800_OSSM091: - case A800_OSS8K: - case A800_TURBO64: - case A800_TURBO128: - case A800_PHOENIX: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::disable_cart), this)); - break; - case A800_EXPRESS: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd570, 0xd57f, write8_delegate(FUNC(a400_state::disable_cart), this)); - break; - case A800_DIAMOND: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd5d0, 0xd5df, write8_delegate(FUNC(a400_state::disable_cart), this)); - break; - case A800_WILLIAMS: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd50f, write8_delegate(FUNC(a400_state::disable_cart), this)); - break; - case A800_SPARTADOS: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd5e0, 0xd5ef, write8_delegate(FUNC(a400_state::disable_cart), this)); - break; - case A800_BLIZZARD: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x8000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_8000), this), write8_delegate(FUNC(a400_state::special_write_8000), this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::disable_cart), this)); - break; - case A800_MICROCALC: - // this can also disable ROM when reading in 0xd500-0xd5ff - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa000, 0xbfff, read8_delegate(FUNC(a400_state::special_read_a000), this), write8_delegate(FUNC(a400_state::special_write_a000), this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd500, 0xd5ff, read8_delegate(FUNC(a400_state::read_d5xx), this), write8_delegate(FUNC(a400_state::disable_cart), this)); - break; - case A800_TELELINK2: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x9000, 0x90ff, write8_delegate(FUNC(a800_cart_slot_device::write_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).unmap_write(0xa000, 0xbfff); - m_maincpu->space(AS_PROGRAM).install_read_handler(0xd501, 0xd501, read8_delegate(FUNC(a800_cart_slot_device::read_d5xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd502, 0xd502, write8_delegate(FUNC(a800_cart_slot_device::write_d5xx),(a800_cart_slot_device*)slot)); - break; - case A800_XEGS: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).unmap_write(0x8000, 0xbfff); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a800_cart_slot_device::write_d5xx),(a800_cart_slot_device*)slot)); - break; - case A5200_4K: - case A5200_8K: - case A5200_16K: - case A5200_32K: - case A5200_16K_2CHIPS: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).unmap_write(0x4000, 0xbfff); - break; - case A5200_BBSB: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(a800_cart_slot_device::read_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(a800_cart_slot_device::write_80xx),(a800_cart_slot_device*)slot)); - m_maincpu->space(AS_PROGRAM).unmap_write(0x6000, 0xbfff); - break; - } - } -} - - -TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a400_interrupt ) -{ - m_antic->generic_interrupt(4); -} - -TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a800xl_interrupt ) -{ - m_antic->generic_interrupt(2); -} - -TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a5200_interrupt ) -{ - m_antic->generic_interrupt(4); -} - -MACHINE_RESET_MEMBER( a400_state, a400 ) -{ - pokey_device *pokey = machine().device("pokey"); - pokey->write(15,0); -} - - -MACHINE_START_MEMBER( a400_state, a400 ) -{ - setup_ram(0, m_ram->size()); - setup_ram(1, m_ram->size()); - setup_ram(2, m_ram->size()); - setup_cart(m_cart); - - save_item(NAME(m_cart_disabled)); - save_item(NAME(m_cart_helper)); - save_item(NAME(m_last_offs)); -} - - -MACHINE_START_MEMBER( a400_state, a800 ) -{ - setup_ram(0, m_ram->size()); - setup_ram(1, m_ram->size()); - setup_ram(2, m_ram->size()); - setup_cart(m_cart); - setup_cart(m_cart2); - - save_item(NAME(m_cart_disabled)); - save_item(NAME(m_cart_helper)); - save_item(NAME(m_last_offs)); -} - -MACHINE_START_MEMBER( a400_state, a800xl ) -{ - m_mmu = 0xfd; - m_ext_bank = 0x03; // only used by a130xe - setup_cart(m_cart); - - save_item(NAME(m_cart_disabled)); - save_item(NAME(m_cart_helper)); - save_item(NAME(m_last_offs)); - save_item(NAME(m_mmu)); - save_item(NAME(m_ext_bank)); -} - - -MACHINE_START_MEMBER( a400_state, a5200 ) -{ - setup_cart(m_cart); - - save_item(NAME(m_cart_disabled)); - save_item(NAME(m_cart_helper)); - save_item(NAME(m_last_offs)); -} - - -/************************************************************** - * - * GTIA interface - * - **************************************************************/ - -WRITE8_MEMBER(a400_state::gtia_cb) -{ - if (data & 0x08) - m_dac->write_unsigned8((UINT8)-120); - else - m_dac->write_unsigned8(+120); -} - -/************************************************************** - * - * PIA interface - * - **************************************************************/ - -WRITE8_MEMBER(a400_state::a600xl_pia_pb_w) -{ - m_mmu = data; -} - -WRITE8_MEMBER(a400_state::a800xl_pia_pb_w) -{ - if (m_pia->port_b_z_mask() != 0xff) - { - m_mmu = data; - m_ext_bank = (m_mmu & 0x0c) >> 2; - } -} - -/************************************************************** - * - * Machine drivers - * - **************************************************************/ - - -static MACHINE_CONFIG_START( atari_common_nodac, a400_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT) - - MCFG_MACHINE_RESET_OVERRIDE( a400_state, a400 ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1)) - MCFG_SCREEN_VISIBLE_AREA(MIN_X, MAX_X, MIN_Y, MAX_Y) - MCFG_SCREEN_UPDATE_DEVICE("antic", antic_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", sizeof(atari_palette) / 3) - MCFG_PALETTE_INIT_OWNER(a400_state, a400) - - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(IOPORT("djoy_0_1")) - MCFG_PIA_READPB_HANDLER(IOPORT("djoy_2_3")) - MCFG_PIA_CA2_HANDLER(DEVWRITELINE("a8sio", a8sio_device, motor_w)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE("fdc", atari_fdc_device, pia_cb2_w)) - - MCFG_DEVICE_ADD("a8sio", A8SIO, 0) - MCFG_A8SIO_DATA_IN_CB(DEVWRITELINE("pokey", pokey_device, sid_w)) - MCFG_A8SIO_SLOT_ADD("a8sio", "sio", NULL) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT) - MCFG_POKEY_POT0_R_CB(IOPORT("analog_0")) - MCFG_POKEY_POT1_R_CB(IOPORT("analog_1")) - MCFG_POKEY_POT2_R_CB(IOPORT("analog_2")) - MCFG_POKEY_POT3_R_CB(IOPORT("analog_3")) - MCFG_POKEY_POT4_R_CB(IOPORT("analog_4")) - MCFG_POKEY_POT5_R_CB(IOPORT("analog_5")) - MCFG_POKEY_POT6_R_CB(IOPORT("analog_6")) - MCFG_POKEY_POT7_R_CB(IOPORT("analog_7")) - MCFG_POKEY_SERIN_R_CB(DEVREAD8("fdc", atari_fdc_device, serin_r)) - MCFG_POKEY_SEROUT_W_CB(DEVWRITE8("fdc", atari_fdc_device, serout_w)) - MCFG_POKEY_KEYBOARD_CB(atari_common_state, a800_keyboard) - MCFG_POKEY_INTERRUPT_CB(atari_common_state, interrupt_cb) - - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( atari_common, atari_common_nodac ) - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") - - MCFG_DEVICE_ADD("gtia", ATARI_GTIA, 0) - MCFG_GTIA_READ_CB(IOPORT("console")) - MCFG_GTIA_WRITE_CB(WRITE8(a400_state, gtia_cb)) - - MCFG_DEVICE_ADD("antic", ATARI_ANTIC, 0) - MCFG_ANTIC_GTIA("gtia") - - /* devices */ - MCFG_DEVICE_ADD("fdc", ATARI_FDC, 0) - - MCFG_A800_CARTRIDGE_ADD("cartleft", a800_left, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("flop_list","a800_flop") - MCFG_SOFTWARE_LIST_ADD("cart_list","a800") - MCFG_SOFTWARE_LIST_ADD("xegs_list","xegs") -MACHINE_CONFIG_END - - -// memory map A400 + NTSC screen -static MACHINE_CONFIG_DERIVED( a400, atari_common ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a400_mem) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1) - - MCFG_MACHINE_START_OVERRIDE( a400_state, a400 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) - MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) -MACHINE_CONFIG_END - - -// memory map A400 + PAL screen -static MACHINE_CONFIG_DERIVED( a400pal, atari_common ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a400_mem) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1) - - MCFG_MACHINE_START_OVERRIDE( a400_state, a400 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_50HZ) - MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_50HZ) -MACHINE_CONFIG_END - - -// memory map A800 + NTSC screen + Right cartslot -static MACHINE_CONFIG_DERIVED( a800, atari_common ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a400_mem) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1) - - MCFG_MACHINE_START_OVERRIDE( a400_state, a800 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) - MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) - - MCFG_A800_CARTRIDGE_ADD("cartright", a800_right, NULL) -MACHINE_CONFIG_END - - -// memory map A800 + PAL screen + Right cartslot -static MACHINE_CONFIG_DERIVED( a800pal, atari_common ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a400_mem) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1) - - MCFG_MACHINE_START_OVERRIDE( a400_state, a800 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_50HZ) - MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_50HZ) - - MCFG_A800_CARTRIDGE_ADD("cartright", a800_right, NULL) -MACHINE_CONFIG_END - - -// memory map A600XL (same as 800XL but less RAM) + NTSC screen + MMU via PIA portB -static MACHINE_CONFIG_DERIVED( a600xl, atari_common ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a600xl_mem) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a800xl_interrupt, "screen", 0, 1) - - MCFG_DEVICE_MODIFY("pia") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a600xl_pia_pb_w)) - - MCFG_MACHINE_START_OVERRIDE( a400_state, a800xl ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) - MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - - -// memory map A800XL + NTSC screen + MMU via PIA portB -static MACHINE_CONFIG_DERIVED( a800xl, atari_common ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a800xl_mem) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a800xl_interrupt, "screen", 0, 1) - - MCFG_DEVICE_MODIFY("pia") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a800xl_pia_pb_w)) - - MCFG_MACHINE_START_OVERRIDE( a400_state, a800xl ) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) - MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) -MACHINE_CONFIG_END - - -// memory map A800XL + PAL screen + MMU via PIA portB -static MACHINE_CONFIG_DERIVED( a800xlpal, a800xl ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_CLOCK( 1773000 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_50HZ) - MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_50HZ) - - MCFG_SOUND_MODIFY("pokey") - MCFG_SOUND_CLOCK(1773000) -MACHINE_CONFIG_END - - -// memory map A1200XL+ MMU via PIA portB -static MACHINE_CONFIG_DERIVED( a1200xl, a800xl ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a1200xl_mem) - - MCFG_DEVICE_MODIFY("pia") - MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a800xl_pia_pb_w)) -MACHINE_CONFIG_END - - -// memory map A130XE (extra RAM only partially emulated) -static MACHINE_CONFIG_DERIVED( a130xe, a800xl ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a130xe_mem) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - -// memory map XEGS, only XEGS bankswitch supported -static MACHINE_CONFIG_DERIVED( xegs, a800xl ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(xegs_mem) - - MCFG_DEVICE_REMOVE("cartleft") - MCFG_DEVICE_REMOVE("cart_list") - - MCFG_XEGS_CARTRIDGE_ADD("cartleft", xegs_carts, NULL) -MACHINE_CONFIG_END - - -// memory map A5200, different ports, less RAM -static MACHINE_CONFIG_DERIVED( a5200, atari_common_nodac ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(a5200_mem) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a5200_interrupt, "screen", 0, 1) - - // FIXME: should there be anything connected where other system have the fdc? - MCFG_SOUND_MODIFY("pokey") - MCFG_POKEY_SERIN_R_CB(NULL) - MCFG_POKEY_SEROUT_W_CB(NULL) - MCFG_POKEY_KEYBOARD_CB(atari_common_state, a5200_keypads) - MCFG_POKEY_INTERRUPT_CB(atari_common_state, interrupt_cb) - - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_DEVICE_ADD("gtia", ATARI_GTIA, 0) - - MCFG_DEVICE_ADD("antic", ATARI_ANTIC, 0) - MCFG_ANTIC_GTIA("gtia") - - MCFG_DEVICE_MODIFY("pia") - MCFG_PIA_READPA_HANDLER(NULL) // FIXME: is there anything connected here - MCFG_PIA_READPB_HANDLER(NULL) // FIXME: is there anything connected here - MCFG_PIA_CB2_HANDLER(NULL) // FIXME: is there anything connected here - - MCFG_MACHINE_START_OVERRIDE( a400_state, a5200 ) - - MCFG_SCREEN_MODIFY( "screen" ) - MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) - MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) - - MCFG_A5200_CARTRIDGE_ADD("cartleft", a5200_carts, NULL) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","a5200") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - - -/************************************************************** - * - * ROM loading - * - **************************************************************/ - -ROM_START(a400) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co12399b.rom", 0xd800, 0x0800, CRC(6a5d766e) SHA1(01a6044f7a81d409c938e7dfde0a1af5832229d2) ) - ROM_SYSTEM_BIOS(0, "default", "OS Rev. B") - ROMX_LOAD( "co12499b.rom", 0xe000, 0x1000, BAD_DUMP CRC(d818f3e8) SHA1(bcdec2188f6a6a5bfc1df4e383bd828d34b5c4ac), ROM_BIOS(1) ) // CRC and label waiting for confirmation - ROMX_LOAD( "co14599b.rom", 0xf000, 0x1000, BAD_DUMP CRC(c1690a9b) SHA1(c5248e8565574fd39ae1c3f4f356aa4cac07df95), ROM_BIOS(1) ) // CRC and label waiting for confirmation - ROM_SYSTEM_BIOS(1, "reva", "OS Rev. A") - ROMX_LOAD( "co12499a.rom", 0xe000, 0x1000, BAD_DUMP CRC(29f64e17) SHA1(abf7ec488c6b600f1b7f30bdc7f8a2bf6a727675), ROM_BIOS(2) ) // CRC and label waiting for confirmation - ROMX_LOAD( "co14599a.rom", 0xf000, 0x1000, BAD_DUMP CRC(bc533f0c) SHA1(e217148495fa747fe5488132d8d22533e68c7e58), ROM_BIOS(2) ) // CRC and label waiting for confirmation -ROM_END - -ROM_START(a400pal) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co12399b.rom", 0xd800, 0x0800, CRC(6a5d766e) SHA1(01a6044f7a81d409c938e7dfde0a1af5832229d2) ) - ROM_LOAD( "co15199.rom", 0xe000, 0x1000, BAD_DUMP CRC(8e547f56) SHA1(1bd746ea798b723bfb18495a7facca113183d713) ) // Rev. A - CRC and label waiting for confirmation - ROM_LOAD( "co15299.rom", 0xf000, 0x1000, BAD_DUMP CRC(be55b413) SHA1(d88afae49b08e75943d0258cb580e5d34756414a) ) // Rev. A - CRC and label waiting for confirmation -ROM_END - -ROM_START(a800) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co12399b.rom", 0xd800, 0x0800, CRC(6a5d766e) SHA1(01a6044f7a81d409c938e7dfde0a1af5832229d2) ) - ROM_SYSTEM_BIOS(0, "default", "OS Rev. B") - ROMX_LOAD( "co12499b.rom", 0xe000, 0x1000, BAD_DUMP CRC(d818f3e8) SHA1(bcdec2188f6a6a5bfc1df4e383bd828d34b5c4ac), ROM_BIOS(1) ) // CRC and label waiting for confirmation - ROMX_LOAD( "co14599b.rom", 0xf000, 0x1000, BAD_DUMP CRC(c1690a9b) SHA1(c5248e8565574fd39ae1c3f4f356aa4cac07df95), ROM_BIOS(1) ) // CRC and label waiting for confirmation - ROM_SYSTEM_BIOS(1, "reva", "OS Rev. A") - ROMX_LOAD( "co12499a.rom", 0xe000, 0x1000, BAD_DUMP CRC(29f64e17) SHA1(abf7ec488c6b600f1b7f30bdc7f8a2bf6a727675), ROM_BIOS(2) ) // CRC and label waiting for confirmation - ROMX_LOAD( "co14599a.rom", 0xf000, 0x1000, BAD_DUMP CRC(bc533f0c) SHA1(e217148495fa747fe5488132d8d22533e68c7e58), ROM_BIOS(2) ) // CRC and label waiting for confirmation -ROM_END - -ROM_START(a800pal) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co12399b.rom", 0xd800, 0x0800, CRC(6a5d766e) SHA1(01a6044f7a81d409c938e7dfde0a1af5832229d2) ) - ROM_LOAD( "co15199.rom", 0xe000, 0x1000, BAD_DUMP CRC(8e547f56) SHA1(1bd746ea798b723bfb18495a7facca113183d713) ) // Rev. A - CRC and label waiting for confirmation - ROM_LOAD( "co15299.rom", 0xf000, 0x1000, BAD_DUMP CRC(be55b413) SHA1(d88afae49b08e75943d0258cb580e5d34756414a) ) // Rev. A - CRC and label waiting for confirmation -ROM_END - -ROM_START(a1200xl) - ROM_REGION(0x10000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "default", "OS Rev. 11") - ROMX_LOAD( "co60616b.rom", 0xc000, 0x2000, BAD_DUMP CRC(6e29ec8d) SHA1(3f9c06d6b4d261f3d5bf4354e3cff0c17b9347b9), ROM_BIOS(1) ) // CRC and label waiting for confirmation - ROMX_LOAD( "co60617b.rom", 0xe000, 0x2000, BAD_DUMP CRC(d73ce29a) SHA1(64790242d902643fe0c40dd842749f1fe461831b), ROM_BIOS(1) ) // CRC and label waiting for confirmation - ROM_SYSTEM_BIOS(1, "rev10", "OS Rev. 10") - ROMX_LOAD( "co60616a.rom", 0xc000, 0x2000, BAD_DUMP CRC(0391386b) SHA1(7c176657c88b89b8a69bf021fa8e0939efc0dff2), ROM_BIOS(2) ) // CRC and label waiting for confirmation - ROMX_LOAD( "co60617a.rom", 0xe000, 0x2000, BAD_DUMP CRC(b502f1e7) SHA1(6688db57d97fa570aef5c15cef3e5fb2688879c2), ROM_BIOS(2) ) // CRC and label waiting for confirmation -ROM_END - -ROM_START(a600xl) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co60302a.rom", 0xa000, 0x2000, CRC(f0202fb3) SHA1(7ad88dd99ff4a6ee66f6d162074db6f8bef7a9b6) ) // Rev. B - ROM_LOAD( "co62024.rom", 0xc000, 0x4000, CRC(643bcc98) SHA1(881d030656b40bbe48f15a696b28f22c0b752ab0) ) // Rev. 1 -ROM_END - -ROM_START(a800xl) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co60302a.rom", 0xa000, 0x2000, CRC(f0202fb3) SHA1(7ad88dd99ff4a6ee66f6d162074db6f8bef7a9b6) ) // Rev. B - ROM_LOAD( "co61598b.rom", 0xc000, 0x4000, CRC(1f9cd270) SHA1(ae4f523ba08b6fd59f3cae515a2b2410bbd98f55) ) // Rev. 2 -ROM_END - -#define rom_a800xlp rom_a800xl - -ROM_START(a65xe) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co24947a.rom", 0xa000, 0x2000, CRC(7d684184) SHA1(3693c9cb9bf3b41bae1150f7a8264992468fc8c0) ) // Rev. C - ROM_LOAD( "co61598b.rom", 0xc000, 0x4000, CRC(1f9cd270) SHA1(ae4f523ba08b6fd59f3cae515a2b2410bbd98f55) ) // Rev. 2 -ROM_END - -ROM_START(a65xea) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "basic_ar.rom", 0xa000, 0x2000, CRC(c899f4d6) SHA1(043df191d1fe402e792266a108e147ffcda35130) ) // is this correct? or shall we use Rev. C? -// ROM_LOAD( "c101700.rom", 0xc000, 0x4000, CRC(7f9a76c8) SHA1(57eb6d87850a763f11767f53d4eaede186f831a2) ) // this was from Savetz and has wrong bits! - ROM_LOAD( "c101700.rom", 0xc000, 0x4000, CRC(45f47988) SHA1(a36b8b20f657580f172749bb0625c08706ed824c) ) // Rev. 3B ? -ROM_END - -ROM_START(a130xe) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co24947a.rom", 0xa000, 0x2000, CRC(7d684184) SHA1(3693c9cb9bf3b41bae1150f7a8264992468fc8c0) ) // Rev. C - ROM_LOAD( "co61598b.rom", 0xc000, 0x4000, CRC(1f9cd270) SHA1(ae4f523ba08b6fd59f3cae515a2b2410bbd98f55) ) // Rev. 2 -ROM_END - -ROM_START(a800xe) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "co24947a.rom", 0xa000, 0x2000, CRC(7d684184) SHA1(3693c9cb9bf3b41bae1150f7a8264992468fc8c0) ) // Rev. C - ROM_LOAD( "c300717.rom", 0xc000, 0x4000, CRC(29f133f7) SHA1(f03b9b93000ee84abb9cf8d6367241006f172182) ) // Rev. 3 -ROM_END - -ROM_START(xegs) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASE00) - ROM_LOAD( "c101687.rom", 0x8000, 0x8000, CRC(d50260d1) SHA1(0e0625ab2473f8431640df3ac8af61925760b9b9) ) // Rev. C + Rev. 4 + Missile Command -ROM_END - - -ROM_START(a5200) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "default", "a5200") - ROMX_LOAD( "5200.rom", 0xf800, 0x0800, CRC(4248d3e3) SHA1(6ad7a1e8c9fad486fbec9498cb48bf5bc3adc530), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "alt", "a5200 (alt)") - ROMX_LOAD( "5200a.rom", 0xf800, 0x0800, CRC(c2ba2613) SHA1(1d2a3f00109d75d2d79fecb565775eb95b7d04d5), ROM_BIOS(2) ) -ROM_END - - -/************************************************************** - * - * Game driver(s) - * - **************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1979, a400, 0, 0, a400, a800, driver_device, 0, "Atari", "Atari 400 (NTSC)", 0) -COMP ( 1979, a400pal, a400, 0, a400pal, a800, driver_device, 0, "Atari", "Atari 400 (PAL)", 0) -COMP ( 1979, a800, 0, 0, a800, a800, driver_device, 0, "Atari", "Atari 800 (NTSC)", 0) -COMP ( 1979, a800pal, a800, 0, a800pal, a800, driver_device, 0, "Atari", "Atari 800 (PAL)", 0) -COMP ( 1982, a1200xl, a800, 0, a1200xl, a800xl, driver_device, 0, "Atari", "Atari 1200XL", MACHINE_NOT_WORKING ) // 64k RAM -COMP ( 1983, a600xl, a800xl, 0, a600xl, a800xl, driver_device, 0, "Atari", "Atari 600XL", MACHINE_IMPERFECT_GRAPHICS ) // 16k RAM -COMP ( 1983, a800xl, 0, 0, a800xl, a800xl, driver_device, 0, "Atari", "Atari 800XL (NTSC)", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM -COMP ( 1983, a800xlp, a800xl, 0, a800xlpal, a800xl, driver_device, 0, "Atari", "Atari 800XL (PAL)", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM -COMP ( 1986, a65xe, a800xl, 0, a800xl, a800xl, driver_device, 0, "Atari", "Atari 65XE", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM -COMP ( 1986, a65xea, a800xl, 0, a800xl, a800xl, driver_device, 0, "Atari", "Atari 65XE (Arabic)", MACHINE_NOT_WORKING ) -COMP ( 1986, a130xe, a800xl, 0, a130xe, a800xl, driver_device, 0, "Atari", "Atari 130XE", MACHINE_NOT_WORKING ) // 128k RAM -COMP ( 1986, a800xe, a800xl, 0, a800xl, a800xl, driver_device, 0, "Atari", "Atari 800XE", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM -COMP ( 1987, xegs, 0, 0, xegs, a800xl, driver_device, 0, "Atari", "Atari XE Game System", MACHINE_IMPERFECT_GRAPHICS ) // 64k RAM - -CONS ( 1982, a5200, 0, 0, a5200, a5200, driver_device, 0, "Atari", "Atari 5200", 0) diff --git a/src/mess/drivers/atarist.c b/src/mess/drivers/atarist.c deleted file mode 100644 index 1bc2c0eb8cf..00000000000 --- a/src/mess/drivers/atarist.c +++ /dev/null @@ -1,3224 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Olivier Galibert -#include "includes/atarist.h" -#include "machine/clock.h" -#include "bus/midi/midi.h" -#include "video/atarist.h" - -/* - - TODO: - - - floppy write - - floppy DMA transfer timer - - mouse moves too fast? - - UK keyboard layout for the special keys - - accurate screen timing - - STe DMA sound and LMC1992 Microwire mixer - - Mega ST/STe MC68881 FPU - - Mega STe 16KB cache - - Mega STe LAN - - http://dev-docs.atariforge.org/ - http://info-coach.fr/atari/software/protection.php - -*/ - -#include "formats/st_dsk.h" -#include "formats/pasti_dsk.h" -#include "formats/mfi_dsk.h" -#include "formats/dfi_dsk.h" -#include "formats/ipf_dsk.h" - - -//************************************************************************** -// CONSTANTS / MACROS -//************************************************************************** - -#define LOG 0 - -static const int IKBD_MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } }; -static const int IKBD_MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } }; - -static const int DMASOUND_RATE[] = { (int)(Y2/640/8), (int)(Y2/640/4), (int)(Y2/640/2), (int)(Y2/640) }; - - -//************************************************************************** -// TIMERS -//************************************************************************** - -void st_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_MOUSE_TICK: - mouse_tick(); - break; - case TIMER_SHIFTER_TICK: - shifter_tick(); - break; - case TIMER_GLUE_TICK: - glue_tick(); - break; - case TIMER_BLITTER_TICK: - blitter_tick(); - break; - default: - assert_always(FALSE, "Unknown id in st_state::device_timer"); - } -} - - -//************************************************************************** -// FLOPPY -//************************************************************************** - -//------------------------------------------------- -// toggle_dma_fifo - -//------------------------------------------------- - -void st_state::toggle_dma_fifo() -{ - if (LOG) logerror("Toggling DMA FIFO\n"); - - m_fdc_fifo_sel = !m_fdc_fifo_sel; - m_fdc_fifo_index = 0; -} - - -//------------------------------------------------- -// flush_dma_fifo - -//------------------------------------------------- - -void st_state::flush_dma_fifo() -{ - if (m_fdc_fifo_empty[m_fdc_fifo_sel]) return; - - if (m_fdc_dmabytes) { - address_space &program = m_maincpu->space(AS_PROGRAM); - for (int i = 0; i < 8; i++) { - UINT16 data = m_fdc_fifo[m_fdc_fifo_sel][i]; - - if (LOG) logerror("Flushing DMA FIFO %u data %04x to address %06x\n", m_fdc_fifo_sel, data, m_dma_base); - - if(m_dma_base >= 8) - program.write_word(m_dma_base, data); - m_dma_base += 2; - } - m_fdc_dmabytes -= 16; - if (!m_fdc_dmabytes) { - m_fdc_sectors--; - - if (m_fdc_sectors) - m_fdc_dmabytes = DMA_SECTOR_SIZE; - } - } else - m_dma_error = 0; - - m_fdc_fifo_empty[m_fdc_fifo_sel] = 1; -} - - -//------------------------------------------------- -// fill_dma_fifo - -//------------------------------------------------- - -void st_state::fill_dma_fifo() -{ - if (m_fdc_dmabytes) { - address_space &program = m_maincpu->space(AS_PROGRAM); - for (int i = 0; i < 8; i++) { - UINT16 data = program.read_word(m_dma_base); - - if (LOG) logerror("Filling DMA FIFO %u with data %04x from memory address %06x\n", m_fdc_fifo_sel, data, m_dma_base); - - m_fdc_fifo[m_fdc_fifo_sel][i] = data; - m_dma_base += 2; - } - m_fdc_dmabytes -= 16; - if (!m_fdc_dmabytes) { - m_fdc_sectors--; - - if (m_fdc_sectors) - m_fdc_dmabytes = DMA_SECTOR_SIZE; - } - } else - m_dma_error = 0; - - m_fdc_fifo_empty[m_fdc_fifo_sel] = 0; -} - - -//------------------------------------------------- -// fdc_dma_transfer - -//------------------------------------------------- - -void st_state::fdc_dma_transfer() -{ - if (m_fdc_mode & DMA_MODE_READ_WRITE) - { - UINT16 data = m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index]; - - if (m_fdc_fifo_msb) - { - // write LSB to disk - m_fdc->data_w(data & 0xff); - - if (LOG) logerror("DMA Write to FDC %02x\n", data & 0xff); - - m_fdc_fifo_index++; - } - else - { - // write MSB to disk - m_fdc->data_w(data >> 8); - - if (LOG) logerror("DMA Write to FDC %02x\n", data >> 8); - } - - // toggle MSB/LSB - m_fdc_fifo_msb = !m_fdc_fifo_msb; - - if (m_fdc_fifo_index == 8) - { - m_fdc_fifo_index--; - m_fdc_fifo_empty[m_fdc_fifo_sel] = 1; - - toggle_dma_fifo(); - - if (m_fdc_fifo_empty[m_fdc_fifo_sel]) - { - fill_dma_fifo(); - } - } - } - else - { - // read from controller to FIFO - UINT8 data = m_fdc->data_r(); - - m_fdc_fifo_empty[m_fdc_fifo_sel] = 0; - - if (LOG) logerror("DMA Read from FDC %02x\n", data); - - if (m_fdc_fifo_msb) - { - // write MSB to FIFO - m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index] |= data; - m_fdc_fifo_index++; - } - else - { - // write LSB to FIFO - m_fdc_fifo[m_fdc_fifo_sel][m_fdc_fifo_index] = data << 8; - } - - // toggle MSB/LSB - m_fdc_fifo_msb = !m_fdc_fifo_msb; - - if (m_fdc_fifo_index == 8) - { - flush_dma_fifo(); - toggle_dma_fifo(); - } - } -} - - -//------------------------------------------------- -// fdc_data_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::fdc_data_r ) -{ - UINT8 data = 0; - - if (m_fdc_mode & DMA_MODE_SECTOR_COUNT) - { - if (LOG) logerror("Indeterminate DMA Sector Count Read!\n"); - - // sector count register is write only, reading it returns unpredictable values - data = machine().rand() & 0xff; - } - else - { - if (!(m_fdc_mode & DMA_MODE_FDC_HDC_CS)) - { - // floppy controller - int offset = (m_fdc_mode & DMA_MODE_ADDRESS_MASK) >> 1; - - data = m_fdc->gen_r(offset); - - if (LOG) logerror("FDC Register %u Read %02x\n", offset, data); - } - } - - return data; -} - - -//------------------------------------------------- -// fdc_data_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::fdc_data_w ) -{ - if (m_fdc_mode & DMA_MODE_SECTOR_COUNT) - { - if (LOG) logerror("DMA Sector Count %u\n", data); - - // sector count register - m_fdc_sectors = data; - - if (m_fdc_sectors) - { - m_fdc_dmabytes = DMA_SECTOR_SIZE; - } - - if (m_fdc_mode & DMA_MODE_READ_WRITE) - { - // fill both FIFOs with data - fill_dma_fifo(); - toggle_dma_fifo(); - fill_dma_fifo(); - toggle_dma_fifo(); - } - } - else - { - if (!(m_fdc_mode & DMA_MODE_FDC_HDC_CS)) - { - // floppy controller - int offset = (m_fdc_mode & DMA_MODE_ADDRESS_MASK) >> 1; - - if (LOG) logerror("FDC Register %u Write %02x\n", offset, data); - - m_fdc->gen_w(offset, data); - } - } -} - - -//------------------------------------------------- -// dma_status_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::dma_status_r ) -{ - UINT16 data = 0; - - // DMA error - data |= m_dma_error; - - // sector count null - data |= !(m_fdc_sectors == 0) << 1; - - // DRQ state - data |= m_fdc->drq_r() << 2; - - return data; -} - - -//------------------------------------------------- -// dma_mode_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::dma_mode_w ) -{ - if (LOG) logerror("DMA Mode %04x\n", data); - - if ((data & DMA_MODE_READ_WRITE) != (m_fdc_mode & DMA_MODE_READ_WRITE)) - { - if (LOG) logerror("DMA reset\n"); - - m_dma_error = 1; - m_fdc_sectors = 0; - m_fdc_fifo_sel = 0; - m_fdc_fifo_msb = 0; - m_fdc_fifo_index = 0; - } - - m_fdc_mode = data; -} - - -//------------------------------------------------- -// dma_counter_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::dma_counter_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0: - data = (m_dma_base >> 16) & 0xff; - break; - case 1: - data = (m_dma_base >> 8) & 0xff; - break; - case 2: - data = m_dma_base & 0xff; - break; - } - - return data; -} - - -//------------------------------------------------- -// dma_base_w - -//------------------------------------------------- - -WRITE8_MEMBER( st_state::dma_base_w ) -{ - switch (offset) - { - case 0: - m_dma_base = (m_dma_base & 0x00ffff) | (data << 16); - if (LOG) logerror("DMA Address High %02x (%06x)\n", data & 0xff, m_dma_base); - break; - - case 1: - m_dma_base = (m_dma_base & 0xff00ff) | (data << 8); - if (LOG) logerror("DMA Address Mid %02x (%06x)\n", data & 0xff, m_dma_base); - break; - - case 2: - m_dma_base = (m_dma_base & 0xffff00) | data; - if (LOG) logerror("DMA Address Low %02x (%06x)\n", data & 0xff, m_dma_base); - break; - } -} - - - -//************************************************************************** -// MMU -//************************************************************************** - -//------------------------------------------------- -// mmu_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::mmu_r ) -{ - return m_mmu; -} - - -//------------------------------------------------- -// mmu_w - -//------------------------------------------------- - -WRITE8_MEMBER( st_state::mmu_w ) -{ - if (LOG) logerror("Memory Configuration Register: %02x\n", data); - - m_mmu = data; -} - - -WRITE16_MEMBER( st_state::berr_w ) -{ - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); -} - -READ16_MEMBER( st_state::berr_r ) -{ - if(!space.debugger_access()) { - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - } - return 0xffff; -} - - -//************************************************************************** -// IKBD -//************************************************************************** - -//------------------------------------------------- -// mouse_tick - -//------------------------------------------------- - -void st_state::mouse_tick() -{ - /* - - Right Left Up Down - - XA 1100 0110 YA 1100 0110 - XB 0110 1100 YB 0110 1100 - - */ - - UINT8 x = m_mousex->read(); - UINT8 y = m_mousey->read(); - - if (m_ikbd_mouse_pc == 0) - { - if (x == m_ikbd_mouse_x) - { - m_ikbd_mouse_px = IKBD_MOUSE_PHASE_STATIC; - } - else if ((x > m_ikbd_mouse_x) || (x == 0 && m_ikbd_mouse_x == 0xff)) - { - m_ikbd_mouse_px = IKBD_MOUSE_PHASE_POSITIVE; - } - else if ((x < m_ikbd_mouse_x) || (x == 0xff && m_ikbd_mouse_x == 0)) - { - m_ikbd_mouse_px = IKBD_MOUSE_PHASE_NEGATIVE; - } - - if (y == m_ikbd_mouse_y) - { - m_ikbd_mouse_py = IKBD_MOUSE_PHASE_STATIC; - } - else if ((y > m_ikbd_mouse_y) || (y == 0 && m_ikbd_mouse_y == 0xff)) - { - m_ikbd_mouse_py = IKBD_MOUSE_PHASE_POSITIVE; - } - else if ((y < m_ikbd_mouse_y) || (y == 0xff && m_ikbd_mouse_y == 0)) - { - m_ikbd_mouse_py = IKBD_MOUSE_PHASE_NEGATIVE; - } - - m_ikbd_mouse_x = x; - m_ikbd_mouse_y = y; - } - - m_ikbd_mouse = 0; - - m_ikbd_mouse |= IKBD_MOUSE_XYB[m_ikbd_mouse_px][m_ikbd_mouse_pc]; // XB - m_ikbd_mouse |= IKBD_MOUSE_XYA[m_ikbd_mouse_px][m_ikbd_mouse_pc] << 1; // XA - m_ikbd_mouse |= IKBD_MOUSE_XYB[m_ikbd_mouse_py][m_ikbd_mouse_pc] << 2; // YA - m_ikbd_mouse |= IKBD_MOUSE_XYA[m_ikbd_mouse_py][m_ikbd_mouse_pc] << 3; // YB - - m_ikbd_mouse_pc++; - m_ikbd_mouse_pc &= 0x03; -} - - -//------------------------------------------------- -// ikbd_port1_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::ikbd_port1_r ) -{ - /* - - bit description - - 0 Keyboard column input - 1 Keyboard column input - 2 Keyboard column input - 3 Keyboard column input - 4 Keyboard column input - 5 Keyboard column input - 6 Keyboard column input - 7 Keyboard column input - - */ - - UINT8 data = 0xff; - - // keyboard data - if (!BIT(m_ikbd_keylatch, 1)) data &= m_p31->read(); - if (!BIT(m_ikbd_keylatch, 2)) data &= m_p32->read(); - if (!BIT(m_ikbd_keylatch, 3)) data &= m_p33->read(); - if (!BIT(m_ikbd_keylatch, 4)) data &= m_p34->read(); - if (!BIT(m_ikbd_keylatch, 5)) data &= m_p35->read(); - if (!BIT(m_ikbd_keylatch, 6)) data &= m_p36->read(); - if (!BIT(m_ikbd_keylatch, 7)) data &= m_p37->read(); - if (!BIT(m_ikbd_keylatch, 8)) data &= m_p40->read(); - if (!BIT(m_ikbd_keylatch, 9)) data &= m_p41->read(); - if (!BIT(m_ikbd_keylatch, 10)) data &= m_p42->read(); - if (!BIT(m_ikbd_keylatch, 11)) data &= m_p43->read(); - if (!BIT(m_ikbd_keylatch, 12)) data &= m_p44->read(); - if (!BIT(m_ikbd_keylatch, 13)) data &= m_p45->read(); - if (!BIT(m_ikbd_keylatch, 14)) data &= m_p46->read(); - if (!BIT(m_ikbd_keylatch, 15)) data &= m_p47->read(); - - return data; -} - - -//------------------------------------------------- -// ikbd_port2_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::ikbd_port2_r ) -{ - /* - - bit description - - 0 JOY 1-5 - 1 JOY 0-6 - 2 JOY 1-6 - 3 SD FROM CPU - 4 - - */ - - UINT8 data = m_joy1 ? m_joy1->read() & 0x06 : 0x06; - - // serial receive - data |= m_ikbd_tx << 3; - - return data; -} - - -//------------------------------------------------- -// ikbd_port2_w - -//------------------------------------------------- - -WRITE8_MEMBER( st_state::ikbd_port2_w ) -{ - /* - - bit description - - 0 joystick enable - 1 - 2 - 3 - 4 SD TO CPU - - */ - - // joystick enable - m_ikbd_joy = BIT(data, 0); - - // serial transmit - m_acia0->write_rxd(BIT(data, 4)); -} - - -//------------------------------------------------- -// ikbd_port3_w - -//------------------------------------------------- - -WRITE8_MEMBER( st_state::ikbd_port3_w ) -{ - /* - - bit description - - 0 CAPS LOCK LED - 1 Keyboard row select - 2 Keyboard row select - 3 Keyboard row select - 4 Keyboard row select - 5 Keyboard row select - 6 Keyboard row select - 7 Keyboard row select - - */ - - // caps lock led - set_led_status(machine(), 1, BIT(data, 0)); - - // keyboard row select - m_ikbd_keylatch = (m_ikbd_keylatch & 0xff00) | data; -} - - -//------------------------------------------------- -// ikbd_port4_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::ikbd_port4_r ) -{ - /* - - bit description - - 0 JOY 0-1 or mouse XB - 1 JOY 0-2 or mouse XA - 2 JOY 0-3 or mouse YA - 3 JOY 0-4 or mouse YB - 4 JOY 1-1 - 5 JOY 1-2 - 6 JOY 1-3 - 7 JOY 1-4 - - */ - - if (m_ikbd_joy) return 0xff; - - UINT8 data = m_joy0 ? m_joy0->read() : 0xff; - - if ((m_config->read() & 0x01) == 0) - { - data = (data & 0xf0) | m_ikbd_mouse; - } - - return data; -} - - -//------------------------------------------------- -// ikbd_port4_w - -//------------------------------------------------- - -WRITE8_MEMBER( st_state::ikbd_port4_w ) -{ - /* - - bit description - - 0 Keyboard row select - 1 Keyboard row select - 2 Keyboard row select - 3 Keyboard row select - 4 Keyboard row select - 5 Keyboard row select - 6 Keyboard row select - 7 Keyboard row select - - */ - - // keyboard row select - m_ikbd_keylatch = (data << 8) | (m_ikbd_keylatch & 0xff); -} - - - -//************************************************************************** -// FPU -//************************************************************************** - -//------------------------------------------------- -// fpu_r - -//------------------------------------------------- - -READ16_MEMBER( megast_state::fpu_r ) -{ - // HACK diagnostic cartridge wants to see this value - return 0x0802; -} - - -WRITE16_MEMBER( megast_state::fpu_w ) -{ -} - -WRITE_LINE_MEMBER( st_state::write_monochrome ) -{ - m_monochrome = state; - m_mfp->i7_w(m_monochrome); -} - - - -//************************************************************************** -// DMA SOUND -//************************************************************************** - -//------------------------------------------------- -// dmasound_set_state - -//------------------------------------------------- - -void ste_state::dmasound_set_state(int level) -{ - m_dmasnd_active = level; - m_mfp->tai_w(m_dmasnd_active); - m_mfp->i7_w(m_monochrome ^ m_dmasnd_active); - - if (level == 0) - { - m_dmasnd_baselatch = m_dmasnd_base; - m_dmasnd_endlatch = m_dmasnd_end; - } - else - { - m_dmasnd_cntr = m_dmasnd_baselatch; - } -} - - -WRITE_LINE_MEMBER( ste_state::write_monochrome ) -{ - m_monochrome = state; - m_mfp->i7_w(m_monochrome ^ m_dmasnd_active); -} - -//------------------------------------------------- -// dmasound_tick - -//------------------------------------------------- - -void ste_state::dmasound_tick() -{ - if (m_dmasnd_samples == 0) - { - UINT8 *RAM = m_ram->pointer(); - - for (int i = 0; i < 8; i++) - { - m_dmasnd_fifo[i] = RAM[m_dmasnd_cntr]; - m_dmasnd_cntr++; - m_dmasnd_samples++; - - if (m_dmasnd_cntr == m_dmasnd_endlatch) - { - dmasound_set_state(0); - break; - } - } - } - - if (m_dmasnd_ctrl & 0x80) - { - if (LOG) logerror("DMA sound left %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]); - m_dmasnd_samples--; - - if (LOG) logerror("DMA sound right %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]); - m_dmasnd_samples--; - } - else - { - if (LOG) logerror("DMA sound mono %i\n", m_dmasnd_fifo[7 - m_dmasnd_samples]); - m_dmasnd_samples--; - } - - if ((m_dmasnd_samples == 0) && (m_dmasnd_active == 0)) - { - if ((m_dmasnd_ctrl & 0x03) == 0x03) - { - dmasound_set_state(1); - } - else - { - m_dmasound_timer->enable(0); - } - } -} - - -void ste_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_DMASOUND_TICK: - dmasound_tick(); - break; - case TIMER_MICROWIRE_TICK: - microwire_tick(); - break; - default: - st_state::device_timer(timer, id, param, ptr); - } -} - - -//------------------------------------------------- -// sound_dma_control_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::sound_dma_control_r ) -{ - return m_dmasnd_ctrl; -} - - -//------------------------------------------------- -// sound_dma_base_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::sound_dma_base_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0x00: - data = (m_dmasnd_base >> 16) & 0x3f; - break; - - case 0x01: - data = (m_dmasnd_base >> 8) & 0xff; - break; - - case 0x02: - data = m_dmasnd_base & 0xff; - break; - } - - return data; -} - - -//------------------------------------------------- -// sound_dma_counter_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::sound_dma_counter_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0x00: - data = (m_dmasnd_cntr >> 16) & 0x3f; - break; - - case 0x01: - data = (m_dmasnd_cntr >> 8) & 0xff; - break; - - case 0x02: - data = m_dmasnd_cntr & 0xff; - break; - } - - return data; -} - - -//------------------------------------------------- -// sound_dma_end_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::sound_dma_end_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0x00: - data = (m_dmasnd_end >> 16) & 0x3f; - break; - - case 0x01: - data = (m_dmasnd_end >> 8) & 0xff; - break; - - case 0x02: - data = m_dmasnd_end & 0xff; - break; - } - - return data; -} - - -//------------------------------------------------- -// sound_mode_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::sound_mode_r ) -{ - return m_dmasnd_mode; -} - - -//------------------------------------------------- -// sound_dma_control_w - -//------------------------------------------------- - -WRITE8_MEMBER( ste_state::sound_dma_control_w ) -{ - m_dmasnd_ctrl = data & 0x03; - - if (m_dmasnd_ctrl & 0x01) - { - if (!m_dmasnd_active) - { - dmasound_set_state(1); - m_dmasound_timer->adjust(attotime::zero, 0, attotime::from_hz(DMASOUND_RATE[m_dmasnd_mode & 0x03])); - } - } - else - { - dmasound_set_state(0); - m_dmasound_timer->enable(0); - } -} - - -//------------------------------------------------- -// sound_dma_base_w - -//------------------------------------------------- - -WRITE8_MEMBER( ste_state::sound_dma_base_w ) -{ - switch (offset) - { - case 0x00: - m_dmasnd_base = (data << 16) & 0x3f0000; - break; - case 0x01: - m_dmasnd_base = (m_dmasnd_base & 0x3f00fe) | (data << 8); - break; - case 0x02: - m_dmasnd_base = (m_dmasnd_base & 0x3fff00) | (data & 0xfe); - break; - } - - if (!m_dmasnd_active) - { - m_dmasnd_baselatch = m_dmasnd_base; - } -} - - -//------------------------------------------------- -// sound_dma_end_w - -//------------------------------------------------- - -WRITE8_MEMBER( ste_state::sound_dma_end_w ) -{ - switch (offset) - { - case 0x00: - m_dmasnd_end = (data << 16) & 0x3f0000; - break; - case 0x01: - m_dmasnd_end = (m_dmasnd_end & 0x3f00fe) | (data & 0xff) << 8; - break; - case 0x02: - m_dmasnd_end = (m_dmasnd_end & 0x3fff00) | (data & 0xfe); - break; - } - - if (!m_dmasnd_active) - { - m_dmasnd_endlatch = m_dmasnd_end; - } -} - - -//------------------------------------------------- -// sound_mode_w - -//------------------------------------------------- - -WRITE8_MEMBER( ste_state::sound_mode_w ) -{ - m_dmasnd_mode = data & 0x83; -} - - - -//************************************************************************** -// MICROWIRE -//************************************************************************** - -//------------------------------------------------- -// microwire_shift - -//------------------------------------------------- - -void ste_state::microwire_shift() -{ - if (BIT(m_mw_mask, 15)) - { - m_lmc1992->data_w(BIT(m_mw_data, 15)); - m_lmc1992->clock_w(1); - m_lmc1992->clock_w(0); - } - - // rotate mask and data left - m_mw_mask = (m_mw_mask << 1) | BIT(m_mw_mask, 15); - m_mw_data = (m_mw_data << 1) | BIT(m_mw_data, 15); - m_mw_shift++; -} - - -//------------------------------------------------- -// microwire_tick - -//------------------------------------------------- - -void ste_state::microwire_tick() -{ - switch (m_mw_shift) - { - case 0: - m_lmc1992->enable_w(0); - microwire_shift(); - break; - - default: - microwire_shift(); - break; - - case 15: - microwire_shift(); - m_lmc1992->enable_w(1); - m_mw_shift = 0; - m_microwire_timer->enable(0); - break; - } -} - - -//------------------------------------------------- -// microwire_data_r - -//------------------------------------------------- - -READ16_MEMBER( ste_state::microwire_data_r ) -{ - return m_mw_data; -} - - -//------------------------------------------------- -// microwire_data_w - -//------------------------------------------------- - -WRITE16_MEMBER( ste_state::microwire_data_w ) -{ - if (!m_microwire_timer->enabled()) - { - m_mw_data = data; - m_microwire_timer->adjust(attotime::zero, 0, attotime::from_usec(2)); - } -} - - -//------------------------------------------------- -// microwire_mask_r - -//------------------------------------------------- - -READ16_MEMBER( ste_state::microwire_mask_r ) -{ - return m_mw_mask; -} - - -//------------------------------------------------- -// microwire_mask_w - -//------------------------------------------------- - -WRITE16_MEMBER( ste_state::microwire_mask_w ) -{ - if (!m_microwire_timer->enabled()) - { - m_mw_mask = data; - } -} - - - -//************************************************************************** -// CACHE -//************************************************************************** - -//------------------------------------------------- -// cache_r - -//------------------------------------------------- - -READ16_MEMBER( megaste_state::cache_r ) -{ - return m_cache; -} - - -//------------------------------------------------- -// cache_w - -//------------------------------------------------- - -WRITE16_MEMBER( megaste_state::cache_w ) -{ - m_cache = data; - - m_maincpu->set_unscaled_clock(BIT(data, 0) ? Y2/2 : Y2/4); -} - - - -//************************************************************************** -// STBOOK -//************************************************************************** - -//------------------------------------------------- -// config_r - -//------------------------------------------------- - -READ16_MEMBER( stbook_state::config_r ) -{ - /* - - bit description - - 0 _POWER_SWITCH - 1 _TOP_CLOSED - 2 _RTC_ALARM - 3 _SOURCE_DEAD - 4 _SOURCE_LOW - 5 _MODEM_WAKE - 6 (reserved) - 7 _EXPANSION_WAKE - 8 (reserved) - 9 (reserved) - 10 (reserved) - 11 (reserved) - 12 (reserved) - 13 SELF TEST - 14 LOW SPEED FLOPPY - 15 DMA AVAILABLE - - */ - - return (m_sw400->read() << 8) | 0xff; -} - - -//------------------------------------------------- -// lcd_control_w - -//------------------------------------------------- - -WRITE16_MEMBER( stbook_state::lcd_control_w ) -{ - /* - - bit description - - 0 Shadow Chip OFF - 1 _SHIFTER OFF - 2 POWEROFF - 3 _22ON - 4 RS-232_OFF - 5 (reserved) - 6 (reserved) - 7 MTR_PWR_ON - - */ -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( ikbd_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ikbd_map, AS_PROGRAM, 8, st_state ) - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_TAG, hd6301_cpu_device, m6801_io_r, m6801_io_w) - AM_RANGE(0x0080, 0x00ff) AM_RAM - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6301V1_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( ikbd_io_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ikbd_io_map, AS_IO, 8, st_state ) - AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READ(ikbd_port1_r) - AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(ikbd_port2_r, ikbd_port2_w) - AM_RANGE(M6801_PORT3, M6801_PORT3) AM_WRITE(ikbd_port3_w) - AM_RANGE(M6801_PORT4, M6801_PORT4) AM_READWRITE(ikbd_port4_r, ikbd_port4_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( st_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( st_map, AS_PROGRAM, 16, st_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0) AM_WRITE(berr_w) - AM_RANGE(0x000008, 0x1fffff) AM_RAM - AM_RANGE(0x200000, 0x3fffff) AM_RAM - AM_RANGE(0x400000, 0xf9ffff) AM_READWRITE(berr_r, berr_w) - //AM_RANGE(0xfa0000, 0xfbffff) // mapped by the cartslot - AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0) AM_WRITE(berr_w) - AM_RANGE(0xff8000, 0xff8001) AM_READWRITE8(mmu_r, mmu_w, 0x00ff) - AM_RANGE(0xff8200, 0xff8203) AM_READWRITE8(shifter_base_r, shifter_base_w, 0x00ff) - AM_RANGE(0xff8204, 0xff8209) AM_READ8(shifter_counter_r, 0x00ff) - AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(shifter_sync_r, shifter_sync_w, 0xff00) - AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(shifter_palette_r, shifter_palette_w) - AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(shifter_mode_r, shifter_mode_w, 0xff00) - AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(fdc_data_r, fdc_data_w) - AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(dma_status_r, dma_mode_w) - AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(dma_counter_r, dma_base_w, 0x00ff) - AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM2149_TAG, ay8910_device, data_r, address_w, 0xff00) AM_MIRROR(0xfc) - AM_RANGE(0xff8802, 0xff8803) AM_DEVREADWRITE8(YM2149_TAG, ay8910_device, data_r, data_w, 0xff00) AM_MIRROR(0xfc) -#if 0 - AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) - AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) - AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) - AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) - AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) - AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) - AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) - AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) - AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) - AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) - AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) - AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w) -#endif - AM_RANGE(0xfffa00, 0xfffa3f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff) - AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, status_r, control_w, 0xff00) - AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, data_r, data_w, 0xff00) - AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, status_r, control_w, 0xff00) - AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, data_r, data_w, 0xff00) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( megast_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( megast_map, AS_PROGRAM, 16, megast_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0) - AM_RANGE(0x000008, 0x1fffff) AM_RAM - AM_RANGE(0x200000, 0x3fffff) AM_RAM - //AM_RANGE(0xfa0000, 0xfbffff) // mapped by the cartslot - AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0) -// AM_RANGE(0xff7f30, 0xff7f31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) // for TOS 1.02 - AM_RANGE(0xff8000, 0xff8001) AM_READWRITE8(mmu_r, mmu_w, 0x00ff) - AM_RANGE(0xff8200, 0xff8203) AM_READWRITE8(shifter_base_r, shifter_base_w, 0x00ff) - AM_RANGE(0xff8204, 0xff8209) AM_READ8(shifter_counter_r, 0x00ff) - AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(shifter_sync_r, shifter_sync_w, 0xff00) - AM_RANGE(0xff8240, 0xff825f) AM_READWRITE(shifter_palette_r, shifter_palette_w) - AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(shifter_mode_r, shifter_mode_w, 0xff00) - AM_RANGE(0xff8604, 0xff8605) AM_READWRITE(fdc_data_r, fdc_data_w) - AM_RANGE(0xff8606, 0xff8607) AM_READWRITE(dma_status_r, dma_mode_w) - AM_RANGE(0xff8608, 0xff860d) AM_READWRITE8(dma_counter_r, dma_base_w, 0x00ff) - AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM2149_TAG, ay8910_device, data_r, address_w, 0xff00) - AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM2149_TAG, ay8910_device, data_w, 0xff00) - AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) - AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) - AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) - AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) - AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) - AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) - AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) - AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) - AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) - AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) - AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) - AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w) - AM_RANGE(0xfffa00, 0xfffa3f) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff) - AM_RANGE(0xfffa40, 0xfffa57) AM_READWRITE(fpu_r, fpu_w) - AM_RANGE(0xfffc00, 0xfffc01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, status_r, control_w, 0xff00) - AM_RANGE(0xfffc02, 0xfffc03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, data_r, data_w, 0xff00) - AM_RANGE(0xfffc04, 0xfffc05) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, status_r, control_w, 0xff00) - AM_RANGE(0xfffc06, 0xfffc07) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, data_r, data_w, 0xff00) - AM_RANGE(0xfffc20, 0xfffc3f) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( ste_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ste_map, AS_PROGRAM, 16, ste_state ) - AM_IMPORT_FROM(st_map) -/* AM_RANGE(0xe00000, 0xe3ffff) AM_ROM AM_REGION(M68000_TAG, 0) - AM_RANGE(0xff8204, 0xff8209) AM_READWRITE8(shifter_counter_r, shifter_counter_w, 0x00ff) - AM_RANGE(0xff820c, 0xff820d) AM_READWRITE8(shifter_base_low_r, shifter_base_low_w, 0x00ff) - AM_RANGE(0xff820e, 0xff820f) AM_READWRITE8(shifter_lineofs_r, shifter_lineofs_w, 0x00ff) - AM_RANGE(0xff8264, 0xff8265) AM_READWRITE8(shifter_pixelofs_r, shifter_pixelofs_w, 0xffff) - AM_RANGE(0xff8900, 0xff8901) AM_READWRITE8(sound_dma_control_r, sound_dma_control_w, 0x00ff) - AM_RANGE(0xff8902, 0xff8907) AM_READWRITE8(sound_dma_base_r, sound_dma_base_w, 0x00ff) - AM_RANGE(0xff8908, 0xff890d) AM_READ8(sound_dma_counter_r, 0x00ff) - AM_RANGE(0xff890e, 0xff8913) AM_READWRITE8(sound_dma_end_r, sound_dma_end_w, 0x00ff) - AM_RANGE(0xff8920, 0xff8921) AM_READWRITE8(sound_mode_r, sound_mode_w, 0x00ff) - AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w) - AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w) - AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) - AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) - AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) - AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) - AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) - AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) - AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) - AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) - AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) - AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) - AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) - AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w)*/ - AM_RANGE(0xff9200, 0xff9201) AM_READ_PORT("JOY0") - AM_RANGE(0xff9202, 0xff9203) AM_READ_PORT("JOY1") - AM_RANGE(0xff9210, 0xff9211) AM_READ_PORT("PADDLE0X") - AM_RANGE(0xff9212, 0xff9213) AM_READ_PORT("PADDLE0Y") - AM_RANGE(0xff9214, 0xff9215) AM_READ_PORT("PADDLE1X") - AM_RANGE(0xff9216, 0xff9217) AM_READ_PORT("PADDLE1Y") - AM_RANGE(0xff9220, 0xff9221) AM_READ_PORT("GUNX") - AM_RANGE(0xff9222, 0xff9223) AM_READ_PORT("GUNY") -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( megaste_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( megaste_map, AS_PROGRAM, 16, megaste_state ) - AM_IMPORT_FROM(st_map) -/* AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(shifter_counter_r, shifter_counter_w) - AM_RANGE(0xff820c, 0xff820d) AM_READWRITE(shifter_base_low_r, shifter_base_low_w) - AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(shifter_lineofs_r, shifter_lineofs_w) - AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(shifter_pixelofs_r, shifter_pixelofs_w) - AM_RANGE(0xff8900, 0xff8901) AM_READWRITE8(sound_dma_control_r, sound_dma_control_w, 0x00ff) - AM_RANGE(0xff8902, 0xff8907) AM_READWRITE8(sound_dma_base_r, sound_dma_base_w, 0x00ff) - AM_RANGE(0xff8908, 0xff890d) AM_READ8(sound_dma_counter_r, 0x00ff) - AM_RANGE(0xff890e, 0xff8913) AM_READWRITE8(sound_dma_end_r, sound_dma_end_w, 0x00ff) - AM_RANGE(0xff8920, 0xff8921) AM_READWRITE8(sound_mode_r, sound_mode_w, 0x00ff) - AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w) - AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w) - AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) - AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) - AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) - AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) - AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) - AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) - AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) - AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) - AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) - AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) - AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) - AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w) - AM_RANGE(0xff8e00, 0xff8e0f) AM_READWRITE(vme_r, vme_w) - AM_RANGE(0xff8e20, 0xff8e21) AM_READWRITE(cache_r, cache_w) -// AM_RANGE(0xfffa40, 0xfffa5f) AM_READWRITE(fpu_r, fpu_w)*/ - AM_RANGE(0xff8c80, 0xff8c87) AM_DEVREADWRITE8(Z8530_TAG, scc8530_t, reg_r, reg_w, 0x00ff) - AM_RANGE(0xfffc20, 0xfffc3f) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( stbook_map ) -//------------------------------------------------- -#if 0 -static ADDRESS_MAP_START( stbook_map, AS_PROGRAM, 16, stbook_state ) - AM_RANGE(0x000000, 0x1fffff) AM_RAM - AM_RANGE(0x200000, 0x3fffff) AM_RAM -// AM_RANGE(0xd40000, 0xd7ffff) AM_ROM - AM_RANGE(0xe00000, 0xe3ffff) AM_ROM AM_REGION(M68000_TAG, 0) -// AM_RANGE(0xe80000, 0xebffff) AM_ROM -// AM_RANGE(0xfa0000, 0xfbffff) AM_ROM // cartridge - AM_RANGE(0xfc0000, 0xfeffff) AM_ROM AM_REGION(M68000_TAG, 0) -/* AM_RANGE(0xf00000, 0xf1ffff) AM_READWRITE(stbook_ide_r, stbook_ide_w) - AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(stbook_mmu_r, stbook_mmu_w) - AM_RANGE(0xff8200, 0xff8203) AM_READWRITE(stbook_shifter_base_r, stbook_shifter_base_w) - AM_RANGE(0xff8204, 0xff8209) AM_READWRITE(stbook_shifter_counter_r, stbook_shifter_counter_w) - AM_RANGE(0xff820a, 0xff820b) AM_READWRITE8(stbook_shifter_sync_r, stbook_shifter_sync_w, 0xff00) - AM_RANGE(0xff820c, 0xff820d) AM_READWRITE(stbook_shifter_base_low_r, stbook_shifter_base_low_w) - AM_RANGE(0xff820e, 0xff820f) AM_READWRITE(stbook_shifter_lineofs_r, stbook_shifter_lineofs_w) - AM_RANGE(0xff8240, 0xff8241) AM_READWRITE(stbook_shifter_palette_r, stbook_shifter_palette_w) - AM_RANGE(0xff8260, 0xff8261) AM_READWRITE8(stbook_shifter_mode_r, stbook_shifter_mode_w, 0xff00) - AM_RANGE(0xff8264, 0xff8265) AM_READWRITE(stbook_shifter_pixelofs_r, stbook_shifter_pixelofs_w) - AM_RANGE(0xff827e, 0xff827f) AM_WRITE(lcd_control_w)*/ - AM_RANGE(0xff8800, 0xff8801) AM_DEVREADWRITE8(YM3439_TAG, ay8910_device, data_r, address_w, 0xff00) - AM_RANGE(0xff8802, 0xff8803) AM_DEVWRITE8(YM3439_TAG, ay8910_device, data_w, 0xff00) -/* AM_RANGE(0xff8900, 0xff8901) AM_READWRITE8(sound_dma_control_r, sound_dma_control_w, 0x00ff) - AM_RANGE(0xff8902, 0xff8907) AM_READWRITE8(sound_dma_base_r, sound_dma_base_w, 0x00ff) - AM_RANGE(0xff8908, 0xff890d) AM_READ8(sound_dma_counter_r, 0x00ff) - AM_RANGE(0xff890e, 0xff8913) AM_READWRITE8(sound_dma_end_r, sound_dma_end_w, 0x00ff) - AM_RANGE(0xff8920, 0xff8921) AM_READWRITE8(sound_mode_r, sound_mode_w, 0x00ff) - AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(microwire_data_r, microwire_data_w) - AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(microwire_mask_r, microwire_mask_w) - AM_RANGE(0xff8a00, 0xff8a1f) AM_READWRITE(blitter_halftone_r, blitter_halftone_w) - AM_RANGE(0xff8a20, 0xff8a21) AM_READWRITE(blitter_src_inc_x_r, blitter_src_inc_x_w) - AM_RANGE(0xff8a22, 0xff8a23) AM_READWRITE(blitter_src_inc_y_r, blitter_src_inc_y_w) - AM_RANGE(0xff8a24, 0xff8a27) AM_READWRITE(blitter_src_r, blitter_src_w) - AM_RANGE(0xff8a28, 0xff8a2d) AM_READWRITE(blitter_end_mask_r, blitter_end_mask_w) - AM_RANGE(0xff8a2e, 0xff8a2f) AM_READWRITE(blitter_dst_inc_x_r, blitter_dst_inc_x_w) - AM_RANGE(0xff8a30, 0xff8a31) AM_READWRITE(blitter_dst_inc_y_r, blitter_dst_inc_y_w) - AM_RANGE(0xff8a32, 0xff8a35) AM_READWRITE(blitter_dst_r, blitter_dst_w) - AM_RANGE(0xff8a36, 0xff8a37) AM_READWRITE(blitter_count_x_r, blitter_count_x_w) - AM_RANGE(0xff8a38, 0xff8a39) AM_READWRITE(blitter_count_y_r, blitter_count_y_w) - AM_RANGE(0xff8a3a, 0xff8a3b) AM_READWRITE(blitter_op_r, blitter_op_w) - AM_RANGE(0xff8a3c, 0xff8a3d) AM_READWRITE(blitter_ctrl_r, blitter_ctrl_w) - AM_RANGE(0xff9200, 0xff9201) AM_READ(config_r) - AM_RANGE(0xff9202, 0xff9203) AM_READWRITE(lcd_contrast_r, lcd_contrast_w) - AM_RANGE(0xff9210, 0xff9211) AM_READWRITE(power_r, power_w) - AM_RANGE(0xff9214, 0xff9215) AM_READWRITE(reference_r, reference_w)*/ -ADDRESS_MAP_END -#endif - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( ikbd ) -//------------------------------------------------- - -static INPUT_PORTS_START( ikbd ) - PORT_START("P31") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0xef, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("P32") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0xde, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("P33") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(DEF_STR( Alternate )) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0xbe, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("P34") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") - PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("P35") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - - PORT_START("P36") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("P37") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_NAME("F6") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - - PORT_START("P40") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_NAME("F7") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - - PORT_START("P41") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_NAME("F8") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - - PORT_START("P42") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_NAME("F9") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("P43") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_NAME("F10") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00B4) PORT_CHAR('`') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - - PORT_START("P44") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE(KEYCODE_F11) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') - - PORT_START("P45") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Undo") PORT_CODE(KEYCODE_F12) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("P46") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad (") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad )") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) - - PORT_START("P47") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad /") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( st ) -//------------------------------------------------- - -static INPUT_PORTS_START( st ) - PORT_START("config") - PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device") - PORT_CONFSETTING( 0x00, "Mouse" ) - PORT_CONFSETTING( 0x01, DEF_STR( Joystick ) ) - PORT_CONFNAME( 0x80, 0x80, "Monitor") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, st_state, write_monochrome) - PORT_CONFSETTING( 0x00, "Monochrome (Atari SM124)" ) - PORT_CONFSETTING( 0x80, "Color (Atari SC1224)" ) - - PORT_INCLUDE( ikbd ) - - PORT_START("IKBD_JOY0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("config", 0x01, EQUALS, 0x01) // XB - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("config", 0x01, EQUALS, 0x01) // XA - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("config", 0x01, EQUALS, 0x01) // YA - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("config", 0x01, EQUALS, 0x01) // YB - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - - PORT_START("IKBD_JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("config", 0x01, EQUALS, 0x01) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - - PORT_START("IKBD_MOUSEX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_CONDITION("config", 0x01, EQUALS, 0x00) - - PORT_START("IKBD_MOUSEY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_CONDITION("config", 0x01, EQUALS, 0x00) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( ste ) -//------------------------------------------------- - -static INPUT_PORTS_START( ste ) - PORT_START("config") - PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device") - PORT_CONFSETTING( 0x00, "Mouse" ) - PORT_CONFSETTING( 0x01, DEF_STR( Joystick ) ) - PORT_CONFNAME( 0x80, 0x80, "Monitor") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, ste_state, write_monochrome) - PORT_CONFSETTING( 0x00, "Monochrome (Atari SM124)" ) - PORT_CONFSETTING( 0x80, "Color (Atari SC1435)" ) - - PORT_INCLUDE( ikbd ) - - PORT_START("JOY0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("JOY1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_8WAY - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_8WAY - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_8WAY - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_8WAY - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_8WAY - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_8WAY - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_8WAY - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_8WAY - - PORT_START("PADDLE0X") - PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(1) - - PORT_START("PADDLE0Y") - PORT_BIT( 0xff, 0x00, IPT_PADDLE_V ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(1) - - PORT_START("PADDLE1X") - PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(2) - - PORT_START("PADDLE1Y") - PORT_BIT( 0xff, 0x00, IPT_PADDLE_V ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_PLAYER(2) - - PORT_START("GUNX") // should be 10-bit - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) - - PORT_START("GUNY") // should be 10-bit - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(1) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( stbook ) -//------------------------------------------------- - -#if 0 -static INPUT_PORTS_START( stbook ) - PORT_START("SW400") - PORT_DIPNAME( 0x80, 0x80, "DMA sound hardware") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x00, "WD1772 FDC") - PORT_DIPSETTING( 0x40, "Low Speed (8 MHz)" ) - PORT_DIPSETTING( 0x00, "High Speed (16 MHz)" ) - PORT_DIPNAME( 0x20, 0x00, "Bypass Self Test") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) - PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END -#endif - - -//------------------------------------------------- -// INPUT_PORTS( tt030 ) -//------------------------------------------------- - -static INPUT_PORTS_START( tt030 ) - PORT_INCLUDE(ste) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( falcon ) -//------------------------------------------------- - -static INPUT_PORTS_START( falcon ) - PORT_INCLUDE(ste) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// ay8910_interface psg_intf -//------------------------------------------------- - -WRITE8_MEMBER( st_state::psg_pa_w ) -{ - /* - - bit description - - 0 SIDE 0 - 1 DRIVE 0 - 2 DRIVE 1 - 3 RTS - 4 DTR - 5 STROBE - 6 GPO - 7 - - */ - - // drive select - floppy_image_device *floppy = 0; - if (!BIT(data, 1)) - floppy = floppy_devices[0]; - else if(!BIT(data, 2)) - floppy = floppy_devices[1]; - - // side select - if(floppy) - floppy->ss_w(BIT(data, 0) ? 0 : 1); - - m_fdc->set_floppy(floppy); - - // request to send - m_rs232->write_rts(BIT(data, 3)); - - // data terminal ready - m_rs232->write_dtr(BIT(data, 4)); - - // centronics strobe - m_centronics->write_strobe(BIT(data, 5)); -} - -//------------------------------------------------- -// ay8910_interface stbook_psg_intf -//------------------------------------------------- - -WRITE8_MEMBER( stbook_state::psg_pa_w ) -{ - /* - - bit description - - 0 SIDE 0 - 1 DRIVE 0 - 2 DRIVE 1 - 3 RTS - 4 DTR - 5 STROBE - 6 IDE RESET - 7 DDEN - - */ - - // drive select - floppy_image_device *floppy = 0; - if (!BIT(data, 1)) - floppy = floppy_devices[0]; - else if(!BIT(data, 2)) - floppy = floppy_devices[1]; - - // side select - if(floppy) - floppy->ss_w(BIT(data, 0) ? 0 : 1); - - m_fdc->set_floppy(floppy); - - // request to send - m_rs232->write_rts(BIT(data, 3)); - - // data terminal ready - m_rs232->write_dtr(BIT(data, 4)); - - // centronics strobe - m_centronics->write_strobe(BIT(data, 5)); - - // density select - m_fdc->dden_w(BIT(data, 7)); -} - -WRITE_LINE_MEMBER( st_state::ikbd_tx_w ) -{ - m_ikbd_tx = state; -} - -WRITE_LINE_MEMBER( st_state::acia_ikbd_irq_w ) -{ - m_acia_ikbd_irq = state; - - m_mfp->i4_w(!(m_acia_ikbd_irq || m_acia_midi_irq)); -} - - -WRITE_LINE_MEMBER( st_state::acia_midi_irq_w ) -{ - m_acia_midi_irq = state; - - m_mfp->i4_w(!(m_acia_ikbd_irq || m_acia_midi_irq)); -} - -WRITE_LINE_MEMBER(st_state::write_acia_clock) -{ - m_acia0->write_txc(state); - m_acia0->write_rxc(state); - m_acia1->write_txc(state); - m_acia1->write_rxc(state); -} - - -WRITE_LINE_MEMBER( st_state::mfp_tdo_w ) -{ - m_mfp->clock_w(state); -} - -WRITE_LINE_MEMBER( st_state::fdc_drq_w ) -{ - if (state && (!(m_fdc_mode & DMA_MODE_ENABLED)) && (m_fdc_mode & DMA_MODE_FDC_HDC_ACK)) - fdc_dma_transfer(); -} - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// IRQ_CALLBACK_MEMBER( atarist_int_ack ) -//------------------------------------------------- - -IRQ_CALLBACK_MEMBER(st_state::atarist_int_ack) -{ - if (irqline == M68K_IRQ_6) - { - return m_mfp->get_vector(); - } - - return M68K_INT_ACK_AUTOVECTOR; -} - - -//------------------------------------------------- -// configure_memory - -//------------------------------------------------- - -void st_state::configure_memory() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - switch (m_ram->size()) - { - case 256 * 1024: - program.unmap_readwrite(0x040000, 0x3fffff); - break; - - case 512 * 1024: - program.unmap_readwrite(0x080000, 0x3fffff); - break; - - case 1024 * 1024: - program.unmap_readwrite(0x100000, 0x3fffff); - break; - - case 2048 * 1024: - program.unmap_readwrite(0x200000, 0x3fffff); - break; - } -} - -//------------------------------------------------- -// state_save - -//------------------------------------------------- - -void st_state::state_save() -{ - m_dma_error = 1; - - save_item(NAME(m_mmu)); - save_item(NAME(m_dma_base)); - save_item(NAME(m_dma_error)); - save_item(NAME(m_fdc_mode)); - save_item(NAME(m_fdc_sectors)); - save_item(NAME(m_fdc_dmabytes)); - save_item(NAME(m_ikbd_keylatch)); - save_item(NAME(m_ikbd_mouse)); - save_item(NAME(m_ikbd_mouse_x)); - save_item(NAME(m_ikbd_mouse_y)); - save_item(NAME(m_ikbd_mouse_px)); - save_item(NAME(m_ikbd_mouse_py)); - save_item(NAME(m_ikbd_mouse_pc)); - save_item(NAME(m_ikbd_tx)); - save_item(NAME(m_ikbd_joy)); - save_item(NAME(m_midi_tx)); - save_item(NAME(m_acia_ikbd_irq)); - save_item(NAME(m_acia_midi_irq)); -} - -//------------------------------------------------- -// MACHINE_START( st ) -//------------------------------------------------- - -void st_state::machine_start() -{ - // configure RAM banking - configure_memory(); - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart)); - - // allocate timers - if(m_mousex) { - m_mouse_timer = timer_alloc(TIMER_MOUSE_TICK); - m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(500)); - } - - // register for state saving - state_save(); - - static const char *names[] = { WD1772_TAG ":0", WD1772_TAG ":1" }; - for(int i=0; i != 2; i++) { - floppy_connector *con = machine().device(names[i]); - if(con) - floppy_devices[i] = con->get_device(); - else - floppy_devices[i] = 0; - } - - /// TODO: get callbacks to trigger these. - m_mfp->i0_w(1); - m_mfp->i5_w(1); - m_mfp->i7_w(1); -} - - -//------------------------------------------------- -// state_save - -//------------------------------------------------- - -void ste_state::state_save() -{ - st_state::state_save(); - - save_item(NAME(m_dmasnd_base)); - save_item(NAME(m_dmasnd_end)); - save_item(NAME(m_dmasnd_cntr)); - save_item(NAME(m_dmasnd_baselatch)); - save_item(NAME(m_dmasnd_endlatch)); - save_item(NAME(m_dmasnd_ctrl)); - save_item(NAME(m_dmasnd_mode)); - save_item(NAME(m_dmasnd_fifo)); - save_item(NAME(m_dmasnd_samples)); - save_item(NAME(m_dmasnd_active)); - save_item(NAME(m_mw_data)); - save_item(NAME(m_mw_mask)); - save_item(NAME(m_mw_shift)); -} - - -//------------------------------------------------- -// MACHINE_START( ste ) -//------------------------------------------------- - -void ste_state::machine_start() -{ - /* configure RAM banking */ - configure_memory(); - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart)); - - /* allocate timers */ - m_dmasound_timer = timer_alloc(TIMER_DMASOUND_TICK); - m_microwire_timer = timer_alloc(TIMER_MICROWIRE_TICK); - - /* register for state saving */ - state_save(); - - /// TODO: get callbacks to trigger these. - m_mfp->i0_w(1); - m_mfp->i5_w(1); - m_mfp->i7_w(1); -} - - -//------------------------------------------------- -// MACHINE_START( megaste ) -//------------------------------------------------- - -void megaste_state::machine_start() -{ - ste_state::machine_start(); - - save_item(NAME(m_cache)); -} - - -//------------------------------------------------- -// MACHINE_START( stbook ) -//------------------------------------------------- - -void stbook_state::machine_start() -{ - /* configure RAM banking */ - address_space &program = m_maincpu->space(AS_PROGRAM); - - switch (m_ram->size()) - { - case 1024 * 1024: - program.unmap_readwrite(0x100000, 0x3fffff); - break; - } - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0xfa0000, 0xfbffff, read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart)); - - /* register for state saving */ - ste_state::state_save(); - - /// TODO: get callbacks to trigger these. - m_mfp->i0_w(1); - m_mfp->i5_w(1); -} - -FLOPPY_FORMATS_MEMBER( st_state::floppy_formats ) - FLOPPY_ST_FORMAT, FLOPPY_MSA_FORMAT, FLOPPY_PASTI_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( atari_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( st ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( st, st_state ) - // basic machine hardware - MCFG_CPU_ADD(M68000_TAG, M68000, Y2/4) - MCFG_CPU_PROGRAM_MAP(st_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(st_state,atarist_int_ack) - - MCFG_CPU_ADD(HD6301V1_TAG, HD6301, Y2/8) - MCFG_CPU_PROGRAM_MAP(ikbd_map) - MCFG_CPU_IO_MAP(ikbd_io_map) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(st_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(Y2/2, ATARIST_HTOT_PAL*2, ATARIST_HBEND_PAL*2, ATARIST_HBSTART_PAL*2, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL) - - MCFG_PALETTE_ADD("palette", 16) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(YM2149_TAG, YM2149, Y2/16) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_RES_LOADS(RES_K(1), 0, 0) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(st_state, psg_pa_w)) - MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - - MCFG_WD1772_ADD(WD1772_TAG, Y2/4) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, st_state::floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD(MC68901_TAG, MC68901, Y2/8) - MCFG_MC68901_TIMER_CLOCK(Y1) - MCFG_MC68901_RX_CLOCK(0) - MCFG_MC68901_TX_CLOCK(0) - MCFG_MC68901_OUT_IRQ_CB(INPUTLINE(M68000_TAG, M68K_IRQ_6)) - MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) - MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i1_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i2_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i6_w)) - - MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(st_state, ikbd_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_ikbd_irq_w)) - - MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_midi_irq_w)) - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_DEVICE_ADD("acia_clock", CLOCK, Y2/64) // 500kHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(st_state, write_acia_clock)) - - // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "st_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) - MCFG_SOFTWARE_LIST_ADD("cart_list", "st_cart") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1M") // 1040ST - MCFG_RAM_EXTRA_OPTIONS("512K,256K") // 520ST, 260ST - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "st_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( megast ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( megast, megast_state ) - // basic machine hardware - MCFG_CPU_ADD(M68000_TAG, M68000, Y2/4) - MCFG_CPU_PROGRAM_MAP(megast_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(st_state,atarist_int_ack) - - MCFG_CPU_ADD(HD6301V1_TAG, HD6301, Y2/8) - MCFG_CPU_PROGRAM_MAP(ikbd_map) - MCFG_CPU_IO_MAP(ikbd_io_map) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(megast_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL) - - MCFG_PALETTE_ADD("palette", 16) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(YM2149_TAG, YM2149, Y2/16) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_RES_LOADS(RES_K(1), 0, 0) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(st_state, psg_pa_w)) - MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) - - MCFG_WD1772_ADD(WD1772_TAG, Y2/4) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, st_state::floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD(MC68901_TAG, MC68901, Y2/8) - MCFG_MC68901_TIMER_CLOCK(Y1) - MCFG_MC68901_RX_CLOCK(0) - MCFG_MC68901_TX_CLOCK(0) - MCFG_MC68901_OUT_IRQ_CB(INPUTLINE(M68000_TAG, M68K_IRQ_6)) - MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) - MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i1_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i2_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i6_w)) - - MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(st_state, ikbd_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_ikbd_irq_w)) - - MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_midi_irq_w)) - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_DEVICE_ADD("acia_clock", CLOCK, Y2/64) // 500kHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(st_state, write_acia_clock)) - - // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "st_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) - MCFG_SOFTWARE_LIST_ADD("cart_list", "st_cart") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") // Mega ST 4 - MCFG_RAM_EXTRA_OPTIONS("2M,1M") // Mega ST 2 ,Mega ST 1 - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "st_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( ste ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ste, ste_state ) - // basic machine hardware - MCFG_CPU_ADD(M68000_TAG, M68000, Y2/4) - MCFG_CPU_PROGRAM_MAP(ste_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(st_state,atarist_int_ack) - - MCFG_CPU_ADD(HD6301V1_TAG, HD6301, Y2/8) - MCFG_CPU_PROGRAM_MAP(ikbd_map) - MCFG_CPU_IO_MAP(ikbd_io_map) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(ste_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL) - - MCFG_PALETTE_ADD("palette", 512) - - // sound hardware - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD(YM2149_TAG, YM2149, Y2/16) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_RES_LOADS(RES_K(1), 0, 0) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(st_state, psg_pa_w)) - MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(0, "rspeaker", 0.50) -/* - MCFG_SOUND_ADD("custom", CUSTOM, 0) // DAC - MCFG_SOUND_ROUTE(0, "rspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) -*/ - MCFG_LMC1992_ADD(LMC1992_TAG /* ,atariste_lmc1992_intf */) - - // devices - - MCFG_WD1772_ADD(WD1772_TAG, Y2/4) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, st_state::floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD(MC68901_TAG, MC68901, Y2/8) - MCFG_MC68901_TIMER_CLOCK(Y1) - MCFG_MC68901_RX_CLOCK(0) - MCFG_MC68901_TX_CLOCK(0) - MCFG_MC68901_OUT_IRQ_CB(INPUTLINE(M68000_TAG, M68K_IRQ_6)) - MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) - MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i1_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i2_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i6_w)) - - MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(st_state, ikbd_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_ikbd_irq_w)) - - MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_midi_irq_w)) - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_DEVICE_ADD("acia_clock", CLOCK, Y2/64) // 500kHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(st_state, write_acia_clock)) - - // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "st_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) -// MCFG_SOFTWARE_LIST_ADD("cart_list", "ste_cart") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1M") // 1040STe - MCFG_RAM_EXTRA_OPTIONS("512K") // 520STe - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "st_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( megaste ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( megaste, ste ) - MCFG_CPU_MODIFY(M68000_TAG) - MCFG_CPU_PROGRAM_MAP(megaste_map) - MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) - MCFG_DEVICE_ADD(Z8530_TAG, SCC8530, Y2/4) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") // Mega STe 4 - MCFG_RAM_EXTRA_OPTIONS("2M,1M") // Mega STe 2 ,Mega STe 1 -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( stbook ) -//------------------------------------------------- -#if 0 -static MACHINE_CONFIG_START( stbook, stbook_state ) - // basic machine hardware - MCFG_CPU_ADD(M68000_TAG, M68000, U517/2) - MCFG_CPU_PROGRAM_MAP(stbook_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(st_state,atarist_int_ack) - - //MCFG_CPU_ADD(COP888_TAG, COP888, Y700) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_UPDATE_DRIVER(stbook_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(YM3439_TAG, YM3439, U517/8) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_RES_LOADS(RES_K(1), 0, 0) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(stbook_state, psg_pa_w)) - MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_DEVICE_ADD(MC68901_TAG, MC68901, U517/8) - MCFG_MC68901_TIMER_CLOCK(Y1) - MCFG_MC68901_RX_CLOCK(0) - MCFG_MC68901_TX_CLOCK(0) - MCFG_MC68901_OUT_IRQ_CB(INPUTLINE(M68000_TAG, M68K_IRQ_6)) - MCFG_MC68901_OUT_TDO_CB(WRITELINE(st_state, mfp_tdo_w)) - MCFG_MC68901_OUT_SO_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - - MCFG_WD1772_ADD(WD1772_TAG, U517/2) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(st_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", 0, st_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, 0, st_state::floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_SERIAL_OUT_RX_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) - MCFG_RS232_OUT_DCD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i1_w)) - MCFG_RS232_OUT_CTS_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i2_w)) - MCFG_RS232_OUT_RI_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, i6_w)) - - // device hardware - MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(st_state, ikbd_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_ikbd_irq_w)) - - MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(st_state, acia_midi_irq_w)) - - MCFG_SERIAL_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) - - MCFG_SERIAL_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_DEVICE_ADD("acia_clock", CLOCK, U517/2/16) // 500kHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(st_state, write_acia_clock)) - - // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "st_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) - MCFG_SOFTWARE_LIST_ADD("cart_list", "st_cart") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("1M") -MACHINE_CONFIG_END -#endif - -//------------------------------------------------- -// MACHINE_CONFIG( tt030 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( tt030, ste ) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( falcon ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( falcon, ste ) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( falcon40 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( falcon40, ste ) -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( st ) -//------------------------------------------------- - -ROM_START( st ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos100") - ROM_SYSTEM_BIOS( 0, "tos099", "TOS 0.99 (Disk TOS)" ) - ROMX_LOAD( "tos099.bin", 0x00000, 0x04000, CRC(cee3c664) SHA1(80c10b31b63b906395151204ec0a4984c8cb98d6), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos100", "TOS 1.0 (ROM TOS)" ) - ROMX_LOAD( "tos100.bin", 0x00000, 0x30000, BAD_DUMP CRC(d331af30) SHA1(7bcc2311d122f451bd03c9763ade5a119b2f90da), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102.bin", 0x00000, 0x30000, BAD_DUMP CRC(d3c32283) SHA1(735793fdba07fe8d5295caa03484f6ef3de931f5), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(90f4fbff) SHA1(2487f330b0895e5d88d580d4ecb24061125e88ad), ROM_BIOS(4) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( st_uk ) -//------------------------------------------------- - -ROM_START( st_uk ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos100") - ROM_SYSTEM_BIOS( 0, "tos100", "TOS 1.0 (ROM TOS)" ) - ROMX_LOAD( "tos100uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(1a586c64) SHA1(9a6e4c88533a9eaa4d55cdc040e47443e0226eb2), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(3b5cd0c5) SHA1(87900a40a890fdf03bd08be6c60cc645855cbce5), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(3) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( st_de ) -//------------------------------------------------- - -ROM_START( st_de ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos100") - ROM_SYSTEM_BIOS( 0, "tos100", "TOS 1.0 (ROM TOS)" ) - ROMX_LOAD( "tos100de.bin", 0x00000, 0x30000, BAD_DUMP CRC(16e3e979) SHA1(663d9c87cfb44ae8ada855fe9ed3cccafaa7a4ce), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102de.bin", 0x00000, 0x30000, BAD_DUMP CRC(36a0058e) SHA1(cad5d2902e875d8bf0a14dc5b5b8080b30254148), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104de.bin", 0x00000, 0x30000, BAD_DUMP CRC(62b82b42) SHA1(5313733f91b083c6265d93674cb9d0b7efd02da8), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "tos10x", "TOS 1.0?" ) - ROMX_LOAD( "st 7c1 a4.u4", 0x00000, 0x08000, CRC(867fdd7e) SHA1(320d12acf510301e6e9ab2e3cf3ee60b0334baa0), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "st 7c1 a9.u7", 0x00001, 0x08000, CRC(30e8f982) SHA1(253f26ff64b202b2681ab68ffc9954125120baea), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "st 7c1 b0.u3", 0x10000, 0x08000, CRC(b91337ed) SHA1(21a338f9bbd87bce4a12d38048e03a361f58d33e), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "st 7a4 a6.u6", 0x10001, 0x08000, CRC(969d7bbe) SHA1(72b998c1f25211c2a96c81a038d71b6a390585c2), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "st 7c1 a2.u2", 0x20000, 0x08000, CRC(d0513329) SHA1(49855a3585e2f75b2af932dd4414ed64e6d9501f), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "st 7c1 b1.u5", 0x20001, 0x08000, CRC(c115cbc8) SHA1(2b52b81a1a4e0818d63f98ee4b25c30e2eba61cb), ROM_SKIP(1) | ROM_BIOS(4) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( st_fr ) -//------------------------------------------------- - -ROM_START( st_fr ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos100") - ROM_SYSTEM_BIOS( 0, "tos100", "TOS 1.0 (ROM TOS)" ) - ROMX_LOAD( "tos100fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(2b7f2117) SHA1(ecb00a2e351a6205089a281b4ce6e08959953704), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(8688fce6) SHA1(f5a79aac0a4e812ca77b6ac51d58d98726f331fe), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(a305a404) SHA1(20dba880344b810cf63cec5066797c5a971db870), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "tos10x", "TOS 1.0?" ) - ROMX_LOAD( "c101658-001.u63", 0x00000, 0x08000, CRC(9c937f6f) SHA1(d4a3ea47568ef6233f3f2056e384b09eedd84961), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "c101661-001.u67", 0x00001, 0x08000, CRC(997298f3) SHA1(9e06d42df88557252a36791b514afe455600f679), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "c101657-001.u59", 0x10000, 0x08000, CRC(b63be6a1) SHA1(434f443472fc649568e4f8be6880f39c2def7819), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "c101660-001.u62", 0x10001, 0x08000, CRC(a813892c) SHA1(d041c113050dfb00166c4a7a52766e1b7eac9cab), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "c101656-001.u48", 0x20000, 0x08000, CRC(dbd93fb8) SHA1(cf9ec11e4bc2465490e7e6c981d9f61eae6cb359), ROM_SKIP(1) | ROM_BIOS(4) ) - ROMX_LOAD( "c101659-001.u53", 0x20001, 0x08000, CRC(67c9785a) SHA1(917a17e9f83bee015c25b327780eebb11cb2c5a5), ROM_SKIP(1) | ROM_BIOS(4) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( st_es ) -//------------------------------------------------- - -ROM_START( st_es ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos100") - ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104es.bin", 0x00000, 0x30000, BAD_DUMP CRC(f4e8ecd2) SHA1(df63f8ac09125d0877b55d5ba1282779b7f99c16), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( st_nl ) -//------------------------------------------------- - -ROM_START( st_nl ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos100") - ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104nl.bin", 0x00000, 0x30000, BAD_DUMP CRC(bb4370d4) SHA1(6de7c96b2d2e5c68778f4bce3eaf85a4e121f166), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( st_se ) -//------------------------------------------------- - -ROM_START( st_se ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos102") - ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102se.bin", 0x00000, 0x30000, BAD_DUMP CRC(673fd0c2) SHA1(433de547e09576743ae9ffc43d43f2279782e127), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104se.bin", 0x00000, 0x30000, BAD_DUMP CRC(80ecfdce) SHA1(b7ad34d5cdfbe86ea74ae79eca11dce421a7bbfd), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( st_sg ) -//------------------------------------------------- - -ROM_START( st_sg ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos102") - ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(5fe16c66) SHA1(45acb2fc4b1b13bd806c751aebd66c8304fc79bc), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(e58f0bdf) SHA1(aa40bf7203f02b2251b9e4850a1a73ff1c7da106), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megast ) -//------------------------------------------------- - -ROM_START( megast ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos104") - ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102.bin", 0x00000, 0x30000, BAD_DUMP CRC(d3c32283) SHA1(735793fdba07fe8d5295caa03484f6ef3de931f5), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(90f4fbff) SHA1(2487f330b0895e5d88d580d4ecb24061125e88ad), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megast_uk ) -//------------------------------------------------- - -ROM_START( megast_uk ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos104") - ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(3b5cd0c5) SHA1(87900a40a890fdf03bd08be6c60cc645855cbce5), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104uk.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megast_de ) -//------------------------------------------------- - -ROM_START( megast_de ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos104") - ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102de.bin", 0x00000, 0x30000, BAD_DUMP CRC(36a0058e) SHA1(cad5d2902e875d8bf0a14dc5b5b8080b30254148), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104de.bin", 0x00000, 0x30000, BAD_DUMP CRC(62b82b42) SHA1(5313733f91b083c6265d93674cb9d0b7efd02da8), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megast_fr ) -//------------------------------------------------- - -ROM_START( megast_fr ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos104") - ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(8688fce6) SHA1(f5a79aac0a4e812ca77b6ac51d58d98726f331fe), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104fr.bin", 0x00000, 0x30000, BAD_DUMP CRC(a305a404) SHA1(20dba880344b810cf63cec5066797c5a971db870), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megast_se ) -//------------------------------------------------- - -ROM_START( megast_se ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos104") - ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102se.bin", 0x00000, 0x30000, BAD_DUMP CRC(673fd0c2) SHA1(433de547e09576743ae9ffc43d43f2279782e127), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104se.bin", 0x00000, 0x30000, BAD_DUMP CRC(80ecfdce) SHA1(b7ad34d5cdfbe86ea74ae79eca11dce421a7bbfd), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megast_sg ) -//------------------------------------------------- - -ROM_START( megast_sg ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos104") - ROM_SYSTEM_BIOS( 0, "tos102", "TOS 1.02 (MEGA TOS)" ) - ROMX_LOAD( "tos102sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(5fe16c66) SHA1(45acb2fc4b1b13bd806c751aebd66c8304fc79bc), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104sg.bin", 0x00000, 0x30000, BAD_DUMP CRC(e58f0bdf) SHA1(aa40bf7203f02b2251b9e4850a1a73ff1c7da106), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( stacy ) -//------------------------------------------------- - -#if 0 -ROM_START( stacy ) - ROM_REGION16_BE( 0x30000, M68000_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "tos104", "TOS 1.04 (Rainbow TOS)" ) - ROMX_LOAD( "tos104.bin", 0x00000, 0x30000, BAD_DUMP CRC(a50d1d43) SHA1(9526ef63b9cb1d2a7109e278547ae78a5c1db6c6), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END -#endif - - -//------------------------------------------------- -// ROM( ste ) -//------------------------------------------------- - -ROM_START( ste ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) - ROMX_LOAD( "tos106.bin", 0x00000, 0x40000, BAD_DUMP CRC(a2e25337) SHA1(6a850810a92fdb1e64d005a06ea4079f51c97145), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) - ROMX_LOAD( "tos162.bin", 0x00000, 0x40000, BAD_DUMP CRC(1c1a4eba) SHA1(42b875f542e5b728905d819c83c31a095a6a1904), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206.bin", 0x00000, 0x40000, BAD_DUMP CRC(3f2f840f) SHA1(ee58768bdfc602c9b14942ce5481e97dd24e7c83), ROM_BIOS(3) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( ste_uk ) -//------------------------------------------------- - -ROM_START( ste_uk ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) - ROMX_LOAD( "tos106uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(d72fea29) SHA1(06f9ea322e74b682df0396acfaee8cb4d9c90cad), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) - ROMX_LOAD( "tos162uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(d1c6f2fa) SHA1(70db24a7c252392755849f78940a41bfaebace71), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(3) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( ste_de ) -//------------------------------------------------- - -ROM_START( ste_de ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) - ROMX_LOAD( "tos106de.bin", 0x00000, 0x40000, BAD_DUMP CRC(7c67c5c9) SHA1(3b8cf5ffa41b252eb67f8824f94608fa4005d6dd), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) - ROMX_LOAD( "tos162de.bin", 0x00000, 0x40000, BAD_DUMP CRC(2cdeb5e5) SHA1(10d9f61705048ee3dcbec67df741bed49b922149), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206de.bin", 0x00000, 0x40000, BAD_DUMP CRC(143cd2ab) SHA1(d1da866560734289c4305f1028c36291d331d417), ROM_BIOS(3) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( ste_es ) -//------------------------------------------------- - -ROM_START( ste_es ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos106") - ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) - ROMX_LOAD( "tos106es.bin", 0x00000, 0x40000, BAD_DUMP CRC(5cd2a540) SHA1(3a18f342c8288c0bc1879b7a209c73d5d57f7e81), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( ste_fr ) -//------------------------------------------------- - -ROM_START( ste_fr ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) - ROMX_LOAD( "tos106fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(b6e58a46) SHA1(7d7e3cef435caa2fd7733a3fbc6930cb9ea7bcbc), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) - ROMX_LOAD( "tos162fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(0ab003be) SHA1(041e134da613f718fca8bd47cd7733076e8d7588), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(e3a99ca7) SHA1(387da431e6e3dd2e0c4643207e67d06cf33618c3), ROM_BIOS(3) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( ste_it ) -//------------------------------------------------- - -ROM_START( ste_it ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos106") - ROM_SYSTEM_BIOS( 0, "tos106", "TOS 1.06 (STE TOS, Revision 1)" ) - ROMX_LOAD( "tos106it.bin", 0x00000, 0x40000, BAD_DUMP CRC(d3a55216) SHA1(28dc74e5e0fa56b685bbe15f9837f52684fee9fd), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( ste_se ) -//------------------------------------------------- - -ROM_START( ste_se ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos162", "TOS 1.62 (STE TOS, Revision 2)" ) - ROMX_LOAD( "tos162se.bin", 0x00000, 0x40000, BAD_DUMP CRC(90f124b1) SHA1(6e5454e861dbf4c46ce5020fc566c31202087b88), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206se.bin", 0x00000, 0x40000, BAD_DUMP CRC(be61906d) SHA1(ebdf5a4cf08471cd315a91683fcb24e0f029d451), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( ste_sg ) -//------------------------------------------------- - -ROM_START( ste_sg ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206sg.bin", 0x00000, 0x40000, BAD_DUMP CRC(8c4fe57d) SHA1(c7a9ae3162f020dcac0c2a46cf0c033f91b98644), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megaste ) -//------------------------------------------------- - -ROM_START( megaste ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) - ROMX_LOAD( "tos205.bin", 0x00000, 0x40000, BAD_DUMP CRC(d8845f8d) SHA1(e069c14863819635bea33074b90c22e5bd99f1bd), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206.bin", 0x00000, 0x40000, BAD_DUMP CRC(3f2f840f) SHA1(ee58768bdfc602c9b14942ce5481e97dd24e7c83), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megaste_uk ) -//------------------------------------------------- - -ROM_START( megaste_uk ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") -#if 0 - ROM_SYSTEM_BIOS( 0, "tos202", "TOS 2.02 (Mega STE TOS)" ) - ROMX_LOAD( "tos202uk.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos205", "TOS 2.05 (Mega STE TOS)" ) - ROMX_LOAD( "tos205uk.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(3) ) -#else - ROM_SYSTEM_BIOS( 0, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206uk.bin", 0x00000, 0x40000, BAD_DUMP CRC(08538e39) SHA1(2400ea95f547d6ea754a99d05d8530c03f8b28e3), ROM_BIOS(1) ) -#endif - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megaste_fr ) -//------------------------------------------------- - -ROM_START( megaste_fr ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) - ROMX_LOAD( "tos205fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(27b83d2f) SHA1(83963b0feb0d119b2ca6f51e483e8c20e6ab79e1), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206fr.bin", 0x00000, 0x40000, BAD_DUMP CRC(e3a99ca7) SHA1(387da431e6e3dd2e0c4643207e67d06cf33618c3), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megaste_de ) -//------------------------------------------------- - -ROM_START( megaste_de ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) - ROMX_LOAD( "tos205de.bin", 0x00000, 0x40000, BAD_DUMP CRC(518b24e6) SHA1(084e083422f8fd9ac7a2490f19b81809c52b91b4), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206de.bin", 0x00000, 0x40000, BAD_DUMP CRC(143cd2ab) SHA1(d1da866560734289c4305f1028c36291d331d417), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megaste_es ) -//------------------------------------------------- - -ROM_START( megaste_es ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos205") - ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) - ROMX_LOAD( "tos205es.bin", 0x00000, 0x40000, BAD_DUMP CRC(2a426206) SHA1(317715ad8de718b5acc7e27ecf1eb833c2017c91), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megaste_it ) -//------------------------------------------------- - -ROM_START( megaste_it ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos205") - ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) - ROMX_LOAD( "tos205it.bin", 0x00000, 0x40000, BAD_DUMP CRC(b28bf5a1) SHA1(8e0581b442384af69345738849cf440d72f6e6ab), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( megaste_se ) -//------------------------------------------------- - -ROM_START( megaste_se ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos206") - ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05 (Mega STE TOS)" ) - ROMX_LOAD( "tos205se.bin", 0x00000, 0x40000, BAD_DUMP CRC(6d49ccbe) SHA1(c065b1a9a2e42e5e373333e99be829028902acaa), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos206", "TOS 2.06 (ST/STE TOS)" ) - ROMX_LOAD( "tos206se.bin", 0x00000, 0x40000, BAD_DUMP CRC(be61906d) SHA1(ebdf5a4cf08471cd315a91683fcb24e0f029d451), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( stbook ) -//------------------------------------------------- - -#if 0 -ROM_START( stbook ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "tos208", "TOS 2.08" ) - ROMX_LOAD( "tos208.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) ) - - ROM_REGION( 0x1000, COP888_TAG, 0 ) - ROM_LOAD( "cop888c0.u703", 0x0000, 0x1000, NO_DUMP ) -ROM_END -#endif - - -//------------------------------------------------- -// ROM( stpad ) -//------------------------------------------------- - -#if 0 -ROM_START( stpad ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "tos205", "TOS 2.05" ) - ROMX_LOAD( "tos205.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) ) -ROM_END -#endif - - -//------------------------------------------------- -// ROM( tt030 ) -//------------------------------------------------- - -ROM_START( tt030 ) - ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos306") - ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) - ROMX_LOAD( "tos306.bin", 0x00000, 0x80000, BAD_DUMP CRC(e65adbd7) SHA1(b15948786278e1f2abc4effbb6d40786620acbe8), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( tt030_uk ) -//------------------------------------------------- - -ROM_START( tt030_uk ) - ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos306") - ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) - ROMX_LOAD( "tos306uk.bin", 0x00000, 0x80000, BAD_DUMP CRC(75dda215) SHA1(6325bdfd83f1b4d3afddb2b470a19428ca79478b), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( tt030_de ) -//------------------------------------------------- - -ROM_START( tt030_de ) - ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos306") - ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) - ROMX_LOAD( "tos306de.bin", 0x00000, 0x80000, BAD_DUMP CRC(4fcbb59d) SHA1(80af04499d1c3b8551fc4d72142ff02c2182e64a), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( tt030_fr ) -//------------------------------------------------- - -ROM_START( tt030_fr ) - ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos306") - ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) - ROMX_LOAD( "tos306fr.bin", 0x00000, 0x80000, BAD_DUMP CRC(1945511c) SHA1(6bb19874e1e97dba17215d4f84b992c224a81b95), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( tt030_pl ) -//------------------------------------------------- - -ROM_START( tt030_pl ) - ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos306") - ROM_SYSTEM_BIOS( 0, "tos306", "TOS 3.06 (TT TOS)" ) - ROMX_LOAD( "tos306pl.bin", 0x00000, 0x80000, BAD_DUMP CRC(4f2404bc) SHA1(d122b8ceb202b52754ff0d442b1c81f8b4de3436), ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( fx1 ) -//------------------------------------------------- - -#if 0 -ROM_START( fx1 ) - ROM_REGION16_BE( 0x40000, M68000_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "tos207", "TOS 2.07" ) - ROMX_LOAD( "tos207.bin", 0x00000, 0x40000, NO_DUMP, ROM_BIOS(1) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END -#endif - - -//------------------------------------------------- -// ROM( falcon30 ) -//------------------------------------------------- - -ROM_START( falcon30 ) - ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) - ROM_DEFAULT_BIOS("tos404") -#if 0 - ROM_SYSTEM_BIOS( 0, "tos400", "TOS 4.00" ) - ROMX_LOAD( "tos400.bin", 0x00000, 0x7ffff, BAD_DUMP CRC(1fbc5396) SHA1(d74d09f11a0bf37a86ccb50c6e7f91aac4d4b11b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos401", "TOS 4.01" ) - ROMX_LOAD( "tos401.bin", 0x00000, 0x80000, NO_DUMP, ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos402", "TOS 4.02" ) - ROMX_LOAD( "tos402.bin", 0x00000, 0x80000, BAD_DUMP CRC(63f82f23) SHA1(75de588f6bbc630fa9c814f738195da23b972cc6), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "tos404", "TOS 4.04" ) - ROMX_LOAD( "tos404.bin", 0x00000, 0x80000, BAD_DUMP CRC(028b561d) SHA1(27dcdb31b0951af99023b2fb8c370d8447ba6ebc), ROM_BIOS(4) ) -#else - ROM_SYSTEM_BIOS( 0, "tos400", "TOS 4.00" ) - ROMX_LOAD( "tos400.bin", 0x00000, 0x7ffff, BAD_DUMP CRC(1fbc5396) SHA1(d74d09f11a0bf37a86ccb50c6e7f91aac4d4b11b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tos402", "TOS 4.02" ) - ROMX_LOAD( "tos402.bin", 0x00000, 0x80000, BAD_DUMP CRC(63f82f23) SHA1(75de588f6bbc630fa9c814f738195da23b972cc6), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tos404", "TOS 4.04" ) - ROMX_LOAD( "tos404.bin", 0x00000, 0x80000, BAD_DUMP CRC(028b561d) SHA1(27dcdb31b0951af99023b2fb8c370d8447ba6ebc), ROM_BIOS(3) ) -#endif - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - -//------------------------------------------------- -// ROM( falcon40 ) -//------------------------------------------------- - -ROM_START( falcon40 ) - ROM_REGION32_BE( 0x80000, M68000_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "tos492", "TOS 4.92" ) - ROMX_LOAD( "tos492.bin", 0x00000, 0x7d314, BAD_DUMP CRC(bc8e497f) SHA1(747a38042844a6b632dcd9a76d8525fccb5eb892), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_TAG, 0 ) - ROM_LOAD( "keyboard.u1", 0x0000, 0x1000, CRC(0296915d) SHA1(1102f20d38f333234041c13687d82528b7cde2e1) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1985, st, 0, 0, st, st, driver_device, 0, "Atari", "ST (USA)", MACHINE_NOT_WORKING ) -COMP( 1985, st_uk, st, 0, st, st, driver_device, 0, "Atari", "ST (UK)", MACHINE_NOT_WORKING ) -COMP( 1985, st_de, st, 0, st, st, driver_device, 0, "Atari", "ST (Germany)", MACHINE_NOT_WORKING ) -COMP( 1985, st_es, st, 0, st, st, driver_device, 0, "Atari", "ST (Spain)", MACHINE_NOT_WORKING ) -COMP( 1985, st_fr, st, 0, st, st, driver_device, 0, "Atari", "ST (France)", MACHINE_NOT_WORKING ) -COMP( 1985, st_nl, st, 0, st, st, driver_device, 0, "Atari", "ST (Netherlands)", MACHINE_NOT_WORKING ) -COMP( 1985, st_se, st, 0, st, st, driver_device, 0, "Atari", "ST (Sweden)", MACHINE_NOT_WORKING ) -COMP( 1985, st_sg, st, 0, st, st, driver_device, 0, "Atari", "ST (Switzerland)", MACHINE_NOT_WORKING ) -COMP( 1987, megast, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (USA)", MACHINE_NOT_WORKING ) -COMP( 1987, megast_uk, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (UK)", MACHINE_NOT_WORKING ) -COMP( 1987, megast_de, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (Germany)", MACHINE_NOT_WORKING ) -COMP( 1987, megast_fr, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (France)", MACHINE_NOT_WORKING ) -COMP( 1987, megast_se, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (Sweden)", MACHINE_NOT_WORKING ) -COMP( 1987, megast_sg, st, 0, megast, st, driver_device, 0, "Atari", "MEGA ST (Switzerland)",MACHINE_NOT_WORKING ) -COMP( 1989, ste, 0, 0, ste, ste, driver_device, 0, "Atari", "STE (USA)", MACHINE_NOT_WORKING ) -COMP( 1989, ste_uk, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (UK)", MACHINE_NOT_WORKING ) -COMP( 1989, ste_de, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Germany)", MACHINE_NOT_WORKING ) -COMP( 1989, ste_es, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Spain)", MACHINE_NOT_WORKING ) -COMP( 1989, ste_fr, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (France)", MACHINE_NOT_WORKING ) -COMP( 1989, ste_it, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Italy)", MACHINE_NOT_WORKING ) -COMP( 1989, ste_se, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Sweden)", MACHINE_NOT_WORKING ) -COMP( 1989, ste_sg, ste, 0, ste, ste, driver_device, 0, "Atari", "STE (Switzerland)", MACHINE_NOT_WORKING ) -//COMP( 1990, stbook, ste, 0, stbook, stbook, driver_device, 0, "Atari", "STBook", MACHINE_NOT_WORKING ) -COMP( 1990, tt030, 0, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (USA)", MACHINE_NOT_WORKING ) -COMP( 1990, tt030_uk, tt030, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (UK)", MACHINE_NOT_WORKING ) -COMP( 1990, tt030_de, tt030, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (Germany)", MACHINE_NOT_WORKING ) -COMP( 1990, tt030_fr, tt030, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (France)", MACHINE_NOT_WORKING ) -COMP( 1990, tt030_pl, tt030, 0, tt030, tt030, driver_device, 0, "Atari", "TT030 (Poland)", MACHINE_NOT_WORKING ) -COMP( 1991, megaste, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (USA)", MACHINE_NOT_WORKING ) -COMP( 1991, megaste_uk, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (UK)", MACHINE_NOT_WORKING ) -COMP( 1991, megaste_de, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (Germany)", MACHINE_NOT_WORKING ) -COMP( 1991, megaste_es, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (Spain)", MACHINE_NOT_WORKING ) -COMP( 1991, megaste_fr, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (France)", MACHINE_NOT_WORKING ) -COMP( 1991, megaste_it, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (Italy)", MACHINE_NOT_WORKING ) -COMP( 1991, megaste_se, ste, 0, megaste, st, driver_device, 0, "Atari", "MEGA STE (Sweden)", MACHINE_NOT_WORKING ) -COMP( 1992, falcon30, 0, 0, falcon, falcon, driver_device, 0, "Atari", "Falcon030", MACHINE_NOT_WORKING ) -COMP( 1992, falcon40, falcon30, 0, falcon40, falcon, driver_device, 0, "Atari", "Falcon040 (prototype)",MACHINE_NOT_WORKING ) -//COMP( 1989, stacy, st, 0, stacy, stacy, driver_device, 0, "Atari", "Stacy", MACHINE_NOT_WORKING ) -//COMP( 1991, stpad, ste, 0, stpad, stpad, driver_device, 0, "Atari", "STPad (prototype)", MACHINE_NOT_WORKING ) -//COMP( 1992, fx1, 0, 0, falcon, falcon, driver_device, 0, "Atari", "FX-1 (prototype)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/atm.c b/src/mess/drivers/atm.c deleted file mode 100644 index 300f503d90e..00000000000 --- a/src/mess/drivers/atm.c +++ /dev/null @@ -1,248 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/******************************************************************************************* - -MicroART ATM (clone of Spectrum) - -Not working because of banking issues. - -The direct_update_handler needs rewriting, because removing it allows the -computer to boot up (with keyboard problems). - -*******************************************************************************************/ - -#include "emu.h" -#include "includes/spectrum.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/ay8910.h" -#include "sound/speaker.h" -#include "machine/beta.h" -#include "machine/ram.h" - - -class atm_state : public spectrum_state -{ -public: - atm_state(const machine_config &mconfig, device_type type, const char *tag) - : spectrum_state(mconfig, type, tag) - , m_bank1(*this, "bank1") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - , m_bank4(*this, "bank4") - , m_beta(*this, BETA_DISK_TAG) - { } - - DECLARE_WRITE8_MEMBER(atm_port_7ffd_w); - DIRECT_UPDATE_MEMBER(atm_direct); - DECLARE_MACHINE_RESET(atm); - -protected: - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_device m_beta; - -private: - UINT8 *m_p_ram; - void atm_update_memory(); -}; - - -DIRECT_UPDATE_MEMBER(atm_state::atm_direct) -{ - UINT16 pc = m_maincpu->state_int(STATE_GENPCBASE); - - if (m_beta->started() && m_beta->is_active()) - { - if (pc >= 0x4000) - { - m_ROMSelection = BIT(m_port_7ffd_data, 4); - m_beta->disable(); - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); - } - } - else if (((pc & 0xff00) == 0x3d00) && (m_ROMSelection==1)) - { - m_ROMSelection = 3; - if (m_beta->started()) - m_beta->enable(); - - } - if(address<=0x3fff) - { - if (m_ROMSelection == 3) - { - direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x18000]); - m_bank1->set_base(&m_p_ram[0x18000]); - } - else - { - direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x10000 + (m_ROMSelection<<14)]); - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); - } - return ~0; - } - return address; -} - -void atm_state::atm_update_memory() -{ - UINT8 *messram = m_ram->pointer(); - - m_screen_location = messram + ((m_port_7ffd_data & 8) ? (7<<14) : (5<<14)); - - m_bank4->set_base(messram + ((m_port_7ffd_data & 0x07) * 0x4000)); - - if (m_beta->started() && m_beta->is_active() && !( m_port_7ffd_data & 0x10 ) ) - m_ROMSelection = 3; - else - /* ROM switching */ - m_ROMSelection = BIT(m_port_7ffd_data, 4) ; - - /* rom 0 is 128K rom, rom 1 is 48 BASIC */ - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); -} - -WRITE8_MEMBER(atm_state::atm_port_7ffd_w) -{ - /* disable paging */ - if (m_port_7ffd_data & 0x20) - return; - - /* store new state */ - m_port_7ffd_data = data; - - /* update memory */ - atm_update_memory(); -} - -static ADDRESS_MAP_START (atm_io, AS_IO, 8, atm_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, status_r, command_w) AM_MIRROR(0xff00) - AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, track_r, track_w) AM_MIRROR(0xff00) - AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, sector_r, sector_w) AM_MIRROR(0xff00) - AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, data_r, data_w) AM_MIRROR(0xff00) - AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) - AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, state_r, param_w) AM_MIRROR(0xff00) - AM_RANGE(0x4000, 0x4000) AM_WRITE(atm_port_7ffd_w) AM_MIRROR(0x3ffd) - AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3ffd) - AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd) -ADDRESS_MAP_END - -MACHINE_RESET_MEMBER(atm_state,atm) -{ - UINT8 *messram = m_ram->pointer(); - address_space &space = m_maincpu->space(AS_PROGRAM); - m_p_ram = memregion("maincpu")->base(); - - space.install_read_bank(0x0000, 0x3fff, "bank1"); - space.unmap_write(0x0000, 0x3fff); - - if (m_beta->started()) - { - m_beta->enable(); - } - space.set_direct_update_handler(direct_update_delegate(FUNC(atm_state::atm_direct), this)); - - memset(messram,0,128*1024); - - /* Bank 5 is always in 0x4000 - 0x7fff */ - m_bank2->set_base(messram + (5<<14)); - - /* Bank 2 is always in 0x8000 - 0xbfff */ - m_bank3->set_base(messram + (2<<14)); - - m_port_7ffd_data = 0; - m_port_1ffd_data = -1; - - atm_update_memory(); -} - -/* F4 Character Displayer */ -static const gfx_layout spectrum_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 96, /* 96 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( atm ) - GFXDECODE_ENTRY( "maincpu", 0x1fd00, spectrum_charlayout, 0, 8 ) -GFXDECODE_END - -static GFXDECODE_START( atmtb2 ) - GFXDECODE_ENTRY( "maincpu", 0x13d00, spectrum_charlayout, 0, 8 ) -GFXDECODE_END - - -static MACHINE_CONFIG_DERIVED_CLASS( atm, spectrum_128, atm_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(atm_io) - MCFG_MACHINE_RESET_OVERRIDE(atm_state, atm ) - - MCFG_BETA_DISK_ADD(BETA_DISK_TAG) - - MCFG_GFXDECODE_MODIFY("gfxdecode", atm) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( atmtb2, atm ) - MCFG_GFXDECODE_MODIFY("gfxdecode", atmtb2) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( atm ) - ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "v1", "v.1.03") - ROMX_LOAD( "atm103.rom", 0x010000, 0x10000, CRC(4912e249) SHA1(a4adff05bb215dd126c47201b36956115b8fed76), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "v.1.06 joined") - ROMX_LOAD( "atm106.rom", 0x010000, 0x10000, CRC(75350b37) SHA1(2afc9994f026645c74b6c4b35bcee2e0bc0d6edc), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v3", "v.1.06") - ROMX_LOAD( "atm106-1.rom", 0x010000, 0x4000, CRC(658c98f1) SHA1(1ec694795aa6cac10147e58f38a9db0bdf7ed89b), ROM_BIOS(3)) - ROMX_LOAD( "atm106-2.rom", 0x014000, 0x4000, CRC(8fe367f9) SHA1(56de8fd39061663b9c315b74fd3c31acddae279c), ROM_BIOS(3)) - ROMX_LOAD( "atm106-3.rom", 0x018000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(3)) - ROMX_LOAD( "atm106-4.rom", 0x01c000, 0x4000, CRC(f352f2ab) SHA1(6045500ab01be708cef62327e9821b4a358a4673), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v4", "v.1.03rs") - ROMX_LOAD( "atm103rs.rom", 0x010000, 0x10000, CRC(cdec1dfb) SHA1(08190807c6b110cb2e657d8e7d0ad18668915375), ROM_BIOS(4)) -ROM_END - -ROM_START( atmtb2 ) - ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "v1", "v.1.07.12 joined") - ROMX_LOAD( "atmtb2.rom", 0x010000, 0x10000,CRC(05218c26) SHA1(71ed9864e7aa85131de97cf1e53dc152e7c79488), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "v.1.07.12") - ROMX_LOAD( "atmtb2-1.rom", 0x010000, 0x4000, CRC(658c98f1) SHA1(1ec694795aa6cac10147e58f38a9db0bdf7ed89b), ROM_BIOS(2)) - ROMX_LOAD( "atmtb2-2.rom", 0x014000, 0x4000, CRC(bc3f6b2b) SHA1(afa9df63857141fef270e2c97e12d2edc60cf919), ROM_BIOS(2)) - ROMX_LOAD( "atmtb2-3.rom", 0x018000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(2)) - ROMX_LOAD( "atmtb2-4.rom", 0x01c000, 0x4000, CRC(5869d8c4) SHA1(c3e198138f528ac4a8dff3c76cd289fd4713abff), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v3", "v.1.07.13") - ROMX_LOAD( "atmtb213.rom", 0x010000, 0x10000, CRC(34a91d53) SHA1(8f0af0f3c0ff1644535f20545c73d01576d6e52f), ROM_BIOS(3)) - - ROM_REGION(0x01000, "keyboard", ROMREGION_ERASEFF) - // XT Keyboard - ROM_LOAD( "rf2ve3.rom", 0x0000, 0x0580, CRC(35e0f9ec) SHA1(adcf14758fab8472cfa0167af7e8326c66416416)) - // AT Keyboard - ROM_LOAD( "rfat710.rom", 0x0600, 0x0680, CRC(03734365) SHA1(6cb6311727fad9bc4ccb18919c3c39b37529b8e6)) - ROM_REGION(0x08000, "charrom", ROMREGION_ERASEFF) - // Char gen rom - ROM_LOAD( "sgen.rom", 0x0000, 0x0800, CRC(1f4387d6) SHA1(93b3774dc8a486643a1bdd48c606b0c84fa0e22b)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1991, atm, spec128, 0, atm, spec_plus, driver_device, 0, "MicroART", "ATM", MACHINE_NOT_WORKING) -//COMP( 1991, atmtb1, spec128, 0, atm, spec_plus, driver_device, 0, "MicroART", "ATM-turbo1", MACHINE_NOT_WORKING) -COMP( 1993, atmtb2, spec128, 0, atmtb2, spec_plus, driver_device, 0, "MicroART", "ATM-turbo2", MACHINE_NOT_WORKING) -//COMP( 1994, turbo2, spec128, 0, atm, spec_plus, driver_device, 0, "MicroART", "TURBO 2+", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/atom.c b/src/mess/drivers/atom.c deleted file mode 100644 index 9403c7c62e5..00000000000 --- a/src/mess/drivers/atom.c +++ /dev/null @@ -1,893 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** -Acorn Atom: - -Memory map. - -CPU: 65C02 - 0000-00ff Zero page - 0100-01ff Stack - 0200-1fff RAM (expansion) - 0a00-0a04 FDC 8271 - 2000-21ff RAM (dos catalogue buffer) - 2200-27ff RAM (dos seq file buffer) - 2800-28ff RAM (float buffer) - 2900-7fff RAM (text RAM) - 8000-97ff VDG 6847 - 9800-9fff RAM (expansion) - a000-afff ROM (extension) - b000-b003 PPIA 8255 - b003-b7ff NOP - b800-bbff VIA 6522 - bc00-bfdf NOP - bfe0-bfe2 MOUSE - extension?? - bfe3-bfff NOP - c000-cfff ROM (basic) - d000-dfff ROM (float) - e000-efff ROM (dos) - f000-ffff ROM (kernel) - -Video: MC6847 - -Sound: Buzzer -Floppy: FDC8271 - -Hardware: PPIA 8255 - - output b000 0 - 3 keyboard row, 4 - 7 graphics mode - b002 0 cas output, 1 enable 2.4kHz, 2 buzzer, 3 colour set - - input b001 0 - 5 keyboard column, 6 CTRL key, 7 SHIFT key - b002 4 2.4kHz input, 5 cas input, 6 REPT key, 7 60 Hz input - - VIA 6522 - - - DOS: - - The original location of the 8271 memory mapped registers is 0xa00-0x0a04. - (This is the memory range assigned by Acorn in their design.) - - This is in the middle of the area for expansion RAM. Many Atom owners - thought this was a bad design and have modified their Atom's and dos rom - to use a different memory area. - - The atom driver in MESS uses the original memory area. - - - http://www.xs4all.nl/~fjkraan/comp/atom/index.html - - --- - - The Econet card for the ATOM is decoded on the ATOM PCB at memory address B400 (hex). The Econet Eurocard has decoding circuits on it which select memory address 1940 (hex). - There are then five significant addresses above these bases which contain the following registers: - - - ATOM card Eurocard - 6854 register 1 B400 1940 - 6854 register 2 B401 1941 - 6854 register 3 B402 1942 - 6854 Tx/Rx Data reg. B403 1943 - Station identification B404 1944 - - Station identification - - The identity number of each station is set up in hardware by links to IC 8. IC 8 is an octal buffer which when enabled feeds the cards station ID to the computer bus. - Each link codes a bit in an eight bit binary number allowing any station ID in the range 0 to 255 to be set up. if a link is left open then the bit is a one, when a - link is made the bit is a zero. Hence all links open corresponds to station ID 255, and all links made to station ID 0. Each station must have a unique identity and - some indentities are associated with specific functions on the network. Station ID zero is reserved for broadcast signals and should not be used. Station ID 255 is - reserved at present for the file server, and 235 for the printer server. Wire links must be soldered to each network station card during installation, a sugested - scheme for number allocation is to number normal user stations from one upwards and to number special stations and servers from 255 downwards. - - 2011 June 04 - Phill Harvey-Smith - Fixed "ERROR" repeating infinite loop, caused by random values in machine_start() being poked into the wrong memory reigion causing the basic ROM to become - corrupted. Values are now correctly placed in bytes 0x0008 - 0x000B of RAM. - - -***************************************************************************/ - -/* - - TODO: - - - connect to softwarelist - - e000 EPROM switching - - display should be monochrome -- Should be optional, Acorn produced a Colour Card, and there is - at least one aftermarket Colour card. - - ram expansion - - tap files - - mouse - - color card - - CP/M card - - speech synthesis card (SPO256 connected to VIA) - - econet - - teletext card - - Busicomputers Prophet 2 - * The Shift and Return keys are orange and the Return key is large, - * There is a MODE switch to the top right of the keyboard, - * There is a VIDEO port in addition to the TV output, - * An Acorn AtomCalc ROM PCB is installed (is this standard on the Prophet2 or an upgrade?), - * An Acorn 32K dynamic RAM card is installed, - * A 5v DC input is added in addition to the standard power in (but this may be a later upgrade), - * The Utility ROM is labelled P2/FP is installed - -*/ - -#include "includes/atom.h" -#include "formats/imageutl.h" - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -#define LOG 1 - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -/*------------------------------------------------- - QUICKLOAD_LOAD_MEMBER( atom_state, atom_atm ) --------------------------------------------------*/ - -QUICKLOAD_LOAD_MEMBER( atom_state, atom_atm ) -{ - /* - - The format for the .ATM files is as follows: - - Offset Size Description - ------ -------- ----------------------------------------------------------- - 0000h 16 BYTEs ATOM filename (if less than 16 BYTEs, rest is 00h bytes) - 0010h WORD Start address for load - 0012h WORD Execution address - 0014h WORD Size of data in BYTEs - 0016h Size Data - - */ - - UINT8 header[0x16] = { 0 }; - void *ptr; - - image.fread(header, 0x16); - - UINT16 start_address = pick_integer_le(header, 0x10, 2); - UINT16 run_address = pick_integer_le(header, 0x12, 2); - UINT16 size = pick_integer_le(header, 0x14, 2); - - if (LOG) - { - header[16] = 0; - logerror("ATM filename: %s\n", header); - logerror("ATM start address: %04x\n", start_address); - logerror("ATM run address: %04x\n", run_address); - logerror("ATM size: %04x\n", size); - } - - ptr = m_maincpu->space(AS_PROGRAM).get_write_ptr(start_address); - image.fread(ptr, size); - - m_maincpu->set_pc(run_address); - - return IMAGE_INIT_PASS; -} - -/*************************************************************************** - READ/WRITE HANDLERS -***************************************************************************/ - -/*------------------------------------------------- - eprom_r - EPROM slot select read --------------------------------------------------*/ - -READ8_MEMBER( atomeb_state::eprom_r ) -{ - return m_eprom; -} - -/*------------------------------------------------- - eprom_w - EPROM slot select write --------------------------------------------------*/ - -WRITE8_MEMBER( atomeb_state::eprom_w ) -{ - /* - - bit description - - 0 block A bit 0 - 1 block A bit 1 - 2 block A bit 2 - 3 block A bit 3 - 4 - 5 - 6 - 7 block E - - */ - - /* block A and E */ - m_eprom = data; -} - -/*------------------------------------------------- - ext_r - read external roms at 0xa000 - -------------------------------------------------*/ - -READ8_MEMBER( atomeb_state::ext_r ) -{ - if (m_ext[m_eprom & 0x0f]->exists()) - return m_ext[m_eprom & 0x0f]->read_rom(space, offset); - else - return 0xff; -} - -/*------------------------------------------------- - dor_r - read DOS roms at 0xe000 - -------------------------------------------------*/ - -READ8_MEMBER( atomeb_state::dos_r ) -{ - if (m_e0->exists() && !BIT(m_eprom, 7)) - return m_e0->read_rom(space, offset); - else if (m_e1->exists() && BIT(m_eprom, 7)) - return m_e1->read_rom(space, offset); - else - return 0xff; -} - - -/*************************************************************************** - MEMORY MAPS -***************************************************************************/ - -/*------------------------------------------------- - ADDRESS_MAP( atom_mem ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( atom_mem, AS_PROGRAM, 8, atom_state ) - AM_RANGE(0x0000, 0x09ff) AM_RAM - AM_RANGE(0x0a00, 0x0a03) AM_MIRROR(0x1f8) AM_DEVICE(I8271_TAG, i8271_device, map) - AM_RANGE(0x0a04, 0x0a04) AM_MIRROR(0x1f8) AM_DEVREADWRITE(I8271_TAG, i8271_device, data_r, data_w) - AM_RANGE(0x0a05, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0x97ff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0x9800, 0x9fff) AM_RAM -// AM_RANGE(0xa000, 0xafff) // mapped by the cartslot - AM_RANGE(0xb000, 0xb003) AM_MIRROR(0x3fc) AM_DEVREADWRITE(INS8255_TAG, i8255_device, read, write) -// AM_RANGE(0xb400, 0xb403) AM_DEVREADWRITE(MC6854_TAG, mc6854_device, read, write) -// AM_RANGE(0xb404, 0xb404) AM_READ_PORT("ECONET") - AM_RANGE(0xb800, 0xb80f) AM_MIRROR(0x3f0) AM_DEVREADWRITE(R6522_TAG, via6522_device, read, write) - AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(SY6502_TAG, 0) -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( atomeb_mem ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( atomeb_mem, AS_PROGRAM, 8, atomeb_state ) - AM_IMPORT_FROM(atom_mem) - AM_RANGE(0xa000, 0xafff) AM_READ(ext_r) - AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(eprom_r, eprom_w) - AM_RANGE(0xe000, 0xefff) AM_READ(dos_r) -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( atombb_mem ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( atombb_mem, AS_PROGRAM, 8, atom_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAM - AM_RANGE(0x4000, 0x57ff) AM_RAM AM_SHARE("video_ram") - - AM_RANGE(0x7000, 0x7003) AM_MIRROR(0x3fc) AM_DEVREADWRITE(INS8255_TAG, i8255_device, read, write) - AM_RANGE(0x7800, 0x780f) AM_MIRROR(0x3f0) AM_DEVREADWRITE(R6522_TAG, via6522_device, read, write) - AM_RANGE(0x8000, 0xbfff) AM_ROM AM_REGION("basic", 0) - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(SY6502_TAG, 0) -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/*------------------------------------------------- - INPUT_CHANGED_MEMBER( trigger_reset ) --------------------------------------------------*/ - -INPUT_CHANGED_MEMBER( atom_state::trigger_reset ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -/*------------------------------------------------- - INPUT_PORTS( atom ) --------------------------------------------------*/ - -static INPUT_PORTS_START( atom ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\x95") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\x94") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('^') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COPY") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('[') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("RPT") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPT") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - - PORT_START("BRK") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHANGED_MEMBER(DEVICE_SELF, atom_state, trigger_reset, 0) - - PORT_START("ECONET") - // station ID (0-255) -INPUT_PORTS_END - -/*************************************************************************** - DEVICE CONFIGURATION -***************************************************************************/ - -/*------------------------------------------------- - I8255 interface --------------------------------------------------*/ - -WRITE8_MEMBER( atom_state::ppi_pa_w ) -{ - /* - - bit description - - 0 keyboard column 0 - 1 keyboard column 1 - 2 keyboard column 2 - 3 keyboard column 3 - 4 MC6847 A/G - 5 MC6847 GM0 - 6 MC6847 GM1 - 7 MC6847 GM2 - - */ - - /* keyboard column */ - m_keylatch = data & 0x0f; - - /* MC6847 */ - m_vdg->ag_w(BIT(data, 4)); - m_vdg->gm0_w(BIT(data, 5)); - m_vdg->gm1_w(BIT(data, 6)); - m_vdg->gm2_w(BIT(data, 7)); -} - -READ8_MEMBER( atom_state::ppi_pb_r ) -{ - /* - - bit description - - 0 keyboard row 0 - 1 keyboard row 1 - 2 keyboard row 2 - 3 keyboard row 3 - 4 keyboard row 4 - 5 keyboard row 5 - 6 keyboard CTRL - 7 keyboard SFT - - */ - - UINT8 data = 0xff; - - switch (m_keylatch) - { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; - } - - data &= m_y10->read(); - - return data; -} - -READ8_MEMBER( atom_state::ppi_pc_r ) -{ - /* - - bit description - - 0 O/P 1, cassette output 0 - 1 O/P 2, cassette output 1 - 2 O/P 3, speaker output - 3 O/P 4, MC6847 CSS - 4 2400 Hz input - 5 cassette input - 6 keyboard RPT - 7 MC6847 FS - - */ - - UINT8 data = 0; - - /* 2400 Hz input */ - data |= m_hz2400 << 4; - - /* cassette input */ - data |= (m_cassette->input() > 0.0) << 5; - - /* keyboard RPT */ - data |= BIT(m_rpt->read(), 0) << 6; - - /* MC6847 FS */ - data |= (m_vdg->fs_r() ? 1 : 0) << 7; - - return data; -} - -WRITE8_MEMBER( atom_state::ppi_pc_w ) -{ - /* - - bit description - - 0 O/P 1, cassette output 0 - 1 O/P 2, cassette output 1 - 2 O/P 3, speaker output - 3 O/P 4, MC6847 CSS - 4 2400 Hz input - 5 cassette input - 6 keyboard RPT - 7 MC6847 FS - - */ - - /* cassette output */ - m_pc0 = BIT(data, 0); - m_pc1 = BIT(data, 1); - - /* speaker output */ - m_speaker->level_w(BIT(data, 2)); - - /* MC6847 CSS */ - m_vdg->css_w(BIT(data, 3)); -} - -/*------------------------------------------------- - i8271 interface --------------------------------------------------*/ - -WRITE_LINE_MEMBER( atom_state::atom_8271_interrupt_callback ) -{ - /* I'm assuming that the nmi is edge triggered */ - /* a interrupt from the fdc will cause a change in line state, and - the nmi will be triggered, but when the state changes because the int - is cleared this will not cause another nmi */ - /* I'll emulate it like this to be sure */ - - if (state!=m_previous_i8271_int_state) - { - if (state) - { - /* I'll pulse it because if I used hold-line I'm not sure - it would clear - to be checked */ - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } - } - - m_previous_i8271_int_state = state; -} - -WRITE_LINE_MEMBER( atom_state::motor_w ) -{ - m_fdc->subdevice("0")->get_device()->mon_w(!state); - m_fdc->subdevice("1")->get_device()->mon_w(!state); -} - -TIMER_DEVICE_CALLBACK_MEMBER(atom_state::cassette_output_tick) -{ - int level = !(!(!m_hz2400 && m_pc1) && m_pc0); - - m_cassette->output(level ? -1.0 : +1.0); - - m_hz2400 = !m_hz2400; -} - -/*------------------------------------------------- - mc6847 interface --------------------------------------------------*/ - -READ8_MEMBER( atom_state::vdg_videoram_r ) -{ - if (offset == ~0) return 0xff; - - m_vdg->as_w(BIT(m_video_ram[offset], 6)); - m_vdg->intext_w(BIT(m_video_ram[offset], 6)); - m_vdg->inv_w(BIT(m_video_ram[offset], 7)); - - return m_video_ram[offset]; -} - -/*************************************************************************** - MACHINE INITIALIZATION -***************************************************************************/ - -/*------------------------------------------------- - MACHINE_START( atom ) --------------------------------------------------*/ - -void atom_state::machine_start() -{ - /* this is temporary */ - /* Kees van Oss mentions that address 8-b are used for the random number - generator. I don't know if this is hardware, or random data because the - ram chips are not cleared at start-up. So at this time, these numbers - are poked into the memory to simulate it. When I have more details I will fix it */ - UINT8 *m_baseram = (UINT8 *)m_maincpu->space(AS_PROGRAM).get_write_ptr(0x0000); - - m_baseram[0x08] = machine().rand() & 0x0ff; - m_baseram[0x09] = machine().rand() & 0x0ff; - m_baseram[0x0a] = machine().rand() & 0x0ff; - m_baseram[0x0b] = machine().rand() & 0x0ff; - - if (m_cart && m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0xa000, 0xafff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -/*------------------------------------------------- - MACHINE_START( atomeb ) --------------------------------------------------*/ - -void atomeb_state::machine_start() -{ - atom_state::machine_start(); -} - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -int atom_state::load_cart(device_image_interface &image, generic_slot_device *slot) -{ - UINT32 size = slot->common_get_size("rom"); - - if (size > 0x1000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - slot->common_load_rom(slot->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -static SLOT_INTERFACE_START(atom_floppies) - SLOT_INTERFACE("525sssd", FLOPPY_525_SSSD) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER(atom_state::floppy_formats) - FLOPPY_ATOM_FORMAT -FLOPPY_FORMATS_END - -/*------------------------------------------------- - MACHINE_DRIVER( atom ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( atom, atom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(SY6502_TAG, M6502, X2/4) - MCFG_CPU_PROGRAM_MAP(atom_mem) - - /* video hardware */ - MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, MC6847_TAG) - - MCFG_DEVICE_ADD(MC6847_TAG, MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_INPUT_CALLBACK(READ8(atom_state, vdg_videoram_r)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("hz2400", atom_state, cassette_output_tick, attotime::from_hz(4806)) - - MCFG_DEVICE_ADD(R6522_TAG, VIA6522, X2/4) - MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(SY6502_TAG, m6502_device, irq_line)) - - MCFG_DEVICE_ADD(INS8255_TAG, I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(atom_state, ppi_pa_w)) - MCFG_I8255_IN_PORTB_CB(READ8(atom_state, ppi_pb_r)) - MCFG_I8255_IN_PORTC_CB(READ8(atom_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(atom_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(I8271_TAG, I8271 , 0) - MCFG_I8271_IRQ_CALLBACK(WRITELINE(atom_state, atom_8271_interrupt_callback)) - MCFG_I8271_HDL_CALLBACK(WRITELINE(atom_state, motor_w)) - MCFG_FLOPPY_DRIVE_ADD(I8271_TAG ":0", atom_floppies, "525sssd", atom_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(I8271_TAG ":1", atom_floppies, "525sssd", atom_state::floppy_formats) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_ca1)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_pa7)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(atom_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_QUICKLOAD_ADD("quickload", atom_state, atom_atm, "atm", 0) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "atom_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(atom_state, cart_load) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2K") - MCFG_RAM_EXTRA_OPTIONS("4K,6K,8K,10K,12K,32K") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","atom") -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_DRIVER( atomeb ) --------------------------------------------------*/ - -#define MCFG_ATOM_ROM_ADD(_tag, _load) \ - MCFG_GENERIC_SOCKET_ADD(_tag, generic_linear_slot, "atom_cart") \ - MCFG_GENERIC_EXTENSIONS("bin,rom") \ - MCFG_GENERIC_LOAD(atomeb_state, _load) - -static MACHINE_CONFIG_DERIVED_CLASS( atomeb, atom, atomeb_state ) - MCFG_CPU_MODIFY(SY6502_TAG) - MCFG_CPU_PROGRAM_MAP(atomeb_mem) - - /* cartridges */ - MCFG_DEVICE_REMOVE("cartslot") - - MCFG_ATOM_ROM_ADD("rom_a0", a0_load) - MCFG_ATOM_ROM_ADD("rom_a1", a1_load) - MCFG_ATOM_ROM_ADD("rom_a2", a2_load) - MCFG_ATOM_ROM_ADD("rom_a3", a3_load) - MCFG_ATOM_ROM_ADD("rom_a4", a4_load) - MCFG_ATOM_ROM_ADD("rom_a5", a5_load) - MCFG_ATOM_ROM_ADD("rom_a6", a6_load) - MCFG_ATOM_ROM_ADD("rom_a7", a7_load) - MCFG_ATOM_ROM_ADD("rom_a8", a8_load) - MCFG_ATOM_ROM_ADD("rom_a9", a9_load) - MCFG_ATOM_ROM_ADD("rom_aa", aa_load) - MCFG_ATOM_ROM_ADD("rom_ab", ab_load) - MCFG_ATOM_ROM_ADD("rom_ac", ac_load) - MCFG_ATOM_ROM_ADD("rom_ad", ad_load) - MCFG_ATOM_ROM_ADD("rom_ae", ae_load) - MCFG_ATOM_ROM_ADD("rom_af", af_load) - - MCFG_ATOM_ROM_ADD("rom_e0", e0_load) - MCFG_ATOM_ROM_ADD("rom_e1", e1_load) -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_DRIVER( atombb ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( atombb, atom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(SY6502_TAG, M6502, X2/4) - MCFG_CPU_PROGRAM_MAP(atombb_mem) - - /* video hardware */ - MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, MC6847_TAG) - - MCFG_DEVICE_ADD(MC6847_TAG, MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_INPUT_CALLBACK(READ8(atom_state, vdg_videoram_r)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("hz2400", atom_state, cassette_output_tick, attotime::from_hz(4806)) - - MCFG_DEVICE_ADD(R6522_TAG, VIA6522, X2/4) - MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(SY6502_TAG, m6502_device, irq_line)) - - MCFG_DEVICE_ADD(INS8255_TAG, I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(atom_state, ppi_pa_w)) - MCFG_I8255_IN_PORTB_CB(READ8(atom_state, ppi_pb_r)) - MCFG_I8255_IN_PORTC_CB(READ8(atom_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(atom_state, ppi_pc_w)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_ca1)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_pa7)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(atom_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("8K,12K") - -MACHINE_CONFIG_END - -/*************************************************************************** - ROMS -***************************************************************************/ - -/*------------------------------------------------- - ROM( atom ) --------------------------------------------------*/ - -ROM_START( atom ) - ROM_REGION( 0x4000, SY6502_TAG, 0 ) - ROM_LOAD( "abasic.ic20", 0x0000, 0x1000, CRC(289b7791) SHA1(0072c83458a9690a3ea1f6094f0f38cf8e96a445) ) - ROM_CONTINUE( 0x3000, 0x1000 ) - ROM_LOAD( "afloat.ic21", 0x1000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802) ) - ROM_LOAD( "dosrom.u15", 0x2000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c) ) -ROM_END - -/*------------------------------------------------- - ROM( atomeb ) --------------------------------------------------*/ - -ROM_START( atomeb ) - ROM_REGION( 0x4000, SY6502_TAG, 0 ) - ROM_LOAD( "abasic.ic20", 0x0000, 0x1000, CRC(289b7791) SHA1(0072c83458a9690a3ea1f6094f0f38cf8e96a445) ) - ROM_CONTINUE( 0x3000, 0x1000 ) - ROM_LOAD( "afloat.ic21", 0x1000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802) ) - ROM_LOAD( "dosrom.u15", 0x2000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c) ) -ROM_END - -/*------------------------------------------------- - ROM( atombb ) --------------------------------------------------*/ - -ROM_START( atombb ) - ROM_REGION( 0x1000, SY6502_TAG, 0 ) - ROM_LOAD( "mos.rom",0x0000, 0x1000, CRC(20158bd8) SHA1(5ee4c0d2b65be72646e17d69b76fb00a0e5298df) ) - ROM_REGION( 0x4000, "basic", 0) - ROM_LOAD( "bbcbasic.rom", 0x0000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281) ) -ROM_END - - -DRIVER_INIT_MEMBER(atomeb_state, atomeb) -{ - // these have to be set here, so that we can pass m_ext[*] to device_image_load! - char str[8]; - for (int i = 0; i < 16; i++) - { - sprintf(str,"rom_a%x", i); - m_ext[i] = machine().device(str); - } -} - - -/*************************************************************************** - SYSTEM DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1979, atom, 0, 0, atom, atom, driver_device, 0, "Acorn", "Atom" , 0) -COMP( 1979, atomeb, atom, 0, atomeb, atom, atomeb_state, atomeb, "Acorn", "Atom with Eprom Box" , 0) -COMP( 1979, atombb, atom, 0, atombb, atom, driver_device, 0, "Acorn", "Atom with BBC Basic" , 0) -//COMP( 1983, prophet2, atom, 0, atom, atom, driver_device, 0, "Busicomputers", "Prophet 2" , 0) diff --git a/src/mess/drivers/attache.c b/src/mess/drivers/attache.c deleted file mode 100644 index 223a60d82f1..00000000000 --- a/src/mess/drivers/attache.c +++ /dev/null @@ -1,1010 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/* - * attache.c - * - * Created on: 17/05/2013 - * - * Driver by Barry Rodewald - * - * - * Otrona Attache - * - * CPU: Zilog Z80-A, 4MHz - * RAM: 64kB - * DMA: AMD 9517A (or compatible) - * RTC: Oki MSM5832, Z80-PIO - * Sound: GI AY-3-8912 - * FDC: NEC D765A, 5.25" floppies - * Video: CRT5027, 320x240 - * Serial: Z80-SIO - * - * Note: - * In terminal mode (when disk booting fails or no disk is inserted), press Ctrl+Linefeed (ctrl+pgdn by default) - * to enter monitor mode. From here you can run a bunch of diagnostic tests. - * - * G - Display Test Pattern - * H - Display RAM Test - * nnI - Input Test (nn = port number) - * J - Jump - * K - Keyboard Test - * L - Loop Tests - * M - Map Test - * nnmmO - Output Test (nn = port number, mm = data to send) - * P - Format Diskette (P to format disk in Drive A, 1P for Drive B) - * Q - CMOS RAM Test - * nR - Main RAM Test (n = 16kB bank to test [0-3]) - * bbpcS - Select Output Ports (first b = printer baud rate, second b = comm baud rate, p = printer port, c = comm port) - * T - Real Time Clock Test - * U - United Tests - * cchsV - Read a sector from disk (cc = cylinder, h = head [bit 0=drive, bit 2=side], s = sector) - * cchsW - Write a sector from disk - * nnnnmmmmX - I/O port transmit (nnnn = number of bytes to transmit, mmmm = start of data to transmit) - * nnnnY - I/O port receive (nnnn = address of data loaded) - * Z - Auto Disk Test (1Z for drive B) - * - * - * TODO: - * - Keyboard repeat - * - Get at least some of the system tests to pass - * - and probably lots more I've forgotten, too. - * - */ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "sound/ay8910.h" -#include "machine/msm5832.h" -#include "machine/z80dart.h" -#include "machine/z80pio.h" -#include "machine/z80ctc.h" -#include "machine/am9517a.h" -#include "machine/upd765.h" -#include "video/tms9927.h" -#include "machine/ram.h" -#include "machine/nvram.h" - -class attache_state : public driver_device -{ -public: - attache_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_rom(*this,"boot"), - m_ram(*this,RAM_TAG), - m_char_rom(*this,"video"), - m_rtc(*this,"rtc"), - m_psg(*this,"psg"), - m_fdc(*this,"fdc"), - m_sio(*this,"sio"), - m_pio(*this,"pio"), - m_ctc(*this,"ctc"), - m_crtc(*this,"crtc"), - m_dma(*this, "dma"), - m_palette(*this, "palette"), - m_floppy0(*this, "fdc:0:525dd"), - m_floppy1(*this, "fdc:1:525dd"), - m_kb_row0(*this, "row0"), - m_kb_row1(*this, "row1"), - m_kb_row2(*this, "row2"), - m_kb_row3(*this, "row3"), - m_kb_row4(*this, "row4"), - m_kb_row5(*this, "row5"), - m_kb_row6(*this, "row6"), - m_kb_row7(*this, "row7"), - m_kb_mod(*this, "modifiers"), - m_membank1(*this, "bank1"), - m_membank2(*this, "bank2"), - m_membank3(*this, "bank3"), - m_membank4(*this, "bank4"), - m_membank5(*this, "bank5"), - m_membank6(*this, "bank6"), - m_membank7(*this, "bank7"), - m_membank8(*this, "bank8"), - m_nvram(*this, "nvram"), - m_rom_active(true), - m_gfx_enabled(false), - m_kb_clock(true), - m_kb_empty(true) - { } - - // PIO port B operation select - enum - { - PIO_SEL_8910_ADDR = 0, - PIO_SEL_8910_DATA, - PIO_SEL_5832_READ, - PIO_SEL_5832_WRITE, - PIO_SEL_5101_WRITE, - PIO_SEL_5101_READ, - PIO_SEL_LATCH, - PIO_SEL_NOP - }; - - // Display controller operation select - enum - { - DISP_GFX_0 = 0, - DISP_GFX_1, - DISP_GFX_2, - DISP_GFX_3, - DISP_GFX_4, - DISP_CRTC, - DISP_ATTR, - DISP_CHAR - }; - - // overrides - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void vblank_int(screen_device &screen, bool state); - virtual void driver_start(); - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER(rom_r); - DECLARE_WRITE8_MEMBER(rom_w); - DECLARE_READ8_MEMBER(pio_portA_r); - DECLARE_READ8_MEMBER(pio_portB_r); - DECLARE_WRITE8_MEMBER(pio_portA_w); - DECLARE_WRITE8_MEMBER(pio_portB_w); - DECLARE_WRITE8_MEMBER(display_command_w); - DECLARE_READ8_MEMBER(display_data_r); - DECLARE_WRITE8_MEMBER(display_data_w); - DECLARE_READ8_MEMBER(dma_mask_r); - DECLARE_WRITE8_MEMBER(dma_mask_w); - DECLARE_READ8_MEMBER(fdc_dma_r); - DECLARE_WRITE8_MEMBER(fdc_dma_w); - DECLARE_READ8_MEMBER(memmap_r); - DECLARE_WRITE8_MEMBER(memmap_w); - DECLARE_READ8_MEMBER(dma_mem_r); - DECLARE_WRITE8_MEMBER(dma_mem_w); - DECLARE_WRITE_LINE_MEMBER(hreq_w); - DECLARE_WRITE_LINE_MEMBER(eop_w); - DECLARE_WRITE_LINE_MEMBER(fdc_dack_w); - void operation_strobe(address_space& space,UINT8 data); - void keyboard_clock_w(bool state); - UINT8 keyboard_data_r(); - UINT16 get_key(); -private: - required_device m_maincpu; - required_memory_region m_rom; - required_device m_ram; - required_memory_region m_char_rom; - required_device m_rtc; - required_device m_psg; - required_device m_fdc; - required_device m_sio; - required_device m_pio; - required_device m_ctc; - required_device m_crtc; - required_device m_dma; - required_device m_palette; - required_device m_floppy0; - required_device m_floppy1; - required_ioport m_kb_row0; - required_ioport m_kb_row1; - required_ioport m_kb_row2; - required_ioport m_kb_row3; - required_ioport m_kb_row4; - required_ioport m_kb_row5; - required_ioport m_kb_row6; - required_ioport m_kb_row7; - required_ioport m_kb_mod; - required_memory_bank m_membank1; - required_memory_bank m_membank2; - required_memory_bank m_membank3; - required_memory_bank m_membank4; - required_memory_bank m_membank5; - required_memory_bank m_membank6; - required_memory_bank m_membank7; - required_memory_bank m_membank8; - required_device m_nvram; - - bool m_rom_active; - bool m_gfx_enabled; - UINT8 m_pio_porta; - UINT8 m_pio_portb; - UINT8 m_pio_select; - UINT8 m_pio_latch; - UINT8 m_crtc_reg_select; - UINT8 m_current_cmd; - UINT8 m_char_ram[128*32]; - UINT8 m_attr_ram[128*32]; - UINT8 m_gfx_ram[128*32*5]; - UINT8 m_char_line; - UINT8 m_attr_line; - UINT8 m_gfx_line; - UINT8 m_cmos_ram[64]; - UINT8 m_cmos_select; - UINT16 m_kb_current_key; - bool m_kb_clock; - bool m_kb_empty; - UINT8 m_kb_bitpos; - UINT8 m_memmap; -}; - -// Attributes (based on schematics): -// bit 0 = ALT -// bit 1 = RW -// bit 2 = BKG (reverse?) -// bit 3 = brightness -// bit 4 = double-size (width) -// bit 5 = underline -// bit 6 = superscript -// bit 7 = subscript (superscript and subscript combined produces strikethrough) -UINT32 attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT8 x,y,bit,scan,data; - UINT8 dbl_mode = 0; // detemines which half of character to display when using double size attribute, - // as it can start on either odd or even character cells. - - // Graphics output (if enabled) - if(m_gfx_enabled) - { - const pen_t *pen = m_palette->pens(); - - for(y=0;y<(bitmap.height()-1)/10;y++) - { - for(x=0;x<(bitmap.width()-1)/8;x++) - { - // graphics pixels use half the clock of text, so 4 graphics pixels per character - for(scan=0;scan<10;scan+=2) - { - data = m_gfx_ram[(128*32*(scan/2))+(y*128+x)]; - bitmap.pix32(y*10+scan,x*8) = pen[BIT(data,7)]; - bitmap.pix32(y*10+scan,x*8+1) = pen[BIT(data,7)]; - bitmap.pix32(y*10+scan,x*8+2) = pen[BIT(data,6)]; - bitmap.pix32(y*10+scan,x*8+3) = pen[BIT(data,6)]; - bitmap.pix32(y*10+scan,x*8+4) = pen[BIT(data,5)]; - bitmap.pix32(y*10+scan,x*8+5) = pen[BIT(data,5)]; - bitmap.pix32(y*10+scan,x*8+6) = pen[BIT(data,4)]; - bitmap.pix32(y*10+scan,x*8+7) = pen[BIT(data,4)]; - bitmap.pix32(y*10+scan+1,x*8) = pen[BIT(data,3)]; - bitmap.pix32(y*10+scan+1,x*8+1) = pen[BIT(data,3)]; - bitmap.pix32(y*10+scan+1,x*8+2) = pen[BIT(data,2)]; - bitmap.pix32(y*10+scan+1,x*8+3) = pen[BIT(data,2)]; - bitmap.pix32(y*10+scan+1,x*8+4) = pen[BIT(data,1)]; - bitmap.pix32(y*10+scan+1,x*8+5) = pen[BIT(data,1)]; - bitmap.pix32(y*10+scan+1,x*8+6) = pen[BIT(data,0)]; - bitmap.pix32(y*10+scan+1,x*8+7) = pen[BIT(data,0)]; - } - } - } - } - else - bitmap.fill(0); - - // Text output - for(y=0;y<(bitmap.height()-1)/10;y++) // lines - { - for(x=0;x<(bitmap.width()-1)/8;x++) // columns - { - assert(((y*128)+x) >= 0 && ((y*128)+x) < ARRAY_LENGTH(m_char_ram)); - UINT8 ch = m_char_ram[(y*128)+x]; - pen_t fg = m_palette->pen(m_attr_ram[(y*128)+x] & 0x08 ? 2 : 1); // brightness - if(m_attr_ram[(y*128)+x] & 0x10) // double-size - dbl_mode++; - else - dbl_mode = 0; - - for(scan=0;scan<10;scan++) // 10 scanlines per line - { - data = m_char_rom->base()[ch*16+scan]; - if((m_attr_ram[(y*128)+x] & 0xc0) != 0xc0) // if not strikethrough - { - if(m_attr_ram[(y*128)+x] & 0x40) // superscript - { - if(scan >= 5) - data = 0; - else - data = m_char_rom->base()[ch*16+(scan*2)+1]; - } - if(m_attr_ram[(y*128)+x] & 0x80) // subscript - { - if(scan < 5) - data = 0; - else - data = m_char_rom->base()[ch*16+((scan-5)*2)+1]; - } - } - if((m_attr_ram[(y*128)+x] & 0x20) && scan == 9) // underline - data = 0xff; - if((m_attr_ram[(y*128)+x] & 0xc0) == 0xc0 && scan == 3) // strikethrough - data = 0xff; - if(m_attr_ram[(y*128)+x] & 0x04) // reverse - data = ~data; - if(m_attr_ram[(y*128)+x] & 0x10) // double-size - { - UINT8 newdata = 0; - if(dbl_mode & 1) - { - newdata = (data & 0x80) | ((data & 0x80) >> 1) - | ((data & 0x40) >> 1) | ((data & 0x40) >> 2) - | ((data & 0x20) >> 2) | ((data & 0x20) >> 3) - | ((data & 0x10) >> 3) | ((data & 0x10) >> 4); - } - else - { - newdata = ((data & 0x08) << 4) | ((data & 0x08) << 3) - | ((data & 0x04) << 3) | ((data & 0x04) << 2) - | ((data & 0x02) << 2) | ((data & 0x02) << 1) - | ((data & 0x01) << 1) | (data & 0x01); - } - data = newdata; - } - - for(bit=0;bit<8;bit++) // 8 pixels per character - { - UINT16 xpos = x*8+bit; - UINT16 ypos = y*10+scan; - - if(BIT(data,7-bit)) - bitmap.pix32(ypos,xpos) = fg; - } - } - } - } - return 0; -} - -void attache_state::vblank_int(screen_device &screen, bool state) -{ - m_ctc->trg2(state); -} - -READ8_MEMBER(attache_state::rom_r) -{ - if(m_rom_active) - return m_rom->base()[offset]; - else - return m_ram->pointer()[m_membank1->entry()*0x2000 + offset]; -} - -WRITE8_MEMBER(attache_state::rom_w) -{ - m_ram->pointer()[m_membank1->entry()*0x2000 + offset] = data; -} - -UINT16 attache_state::get_key() -{ - UINT8 row,bits,data; - ioport_port* keys[8] = { m_kb_row0, m_kb_row1, m_kb_row2, m_kb_row3, m_kb_row4, m_kb_row5, m_kb_row6, m_kb_row7 }; - UINT8 res = 0; - - // scan input ports - for(row=0;row<8;row++) - { - data = keys[row]->read(); - for(bits=0;bits<8;bits++) - { - if(BIT(data,bits)) - { - res = bits & 0x07; - res |= ((row & 0x07) << 3); - m_kb_empty = false; - data = m_kb_mod->read(); - if(~data & 0x01) - res |= 0x80; // shift - if(data & 0x02) - res |= 0x40; // ctrl - //logerror("KB: hit row %i, bit %i\n",row,bits); - return res; - } - } - } - // no key pressed - m_kb_empty = true; - return res; -} - -UINT8 attache_state::keyboard_data_r() -{ - UINT16 key; - if(m_kb_bitpos == 1) // start bit, if data is available - { - key = get_key(); - if(m_kb_current_key != key) - m_kb_current_key = key; - else - return 0x00; - //logerror("KB: bit position %i, key %02x, empty %i\n",m_kb_bitpos,m_kb_current_key,m_kb_empty); - if(m_kb_empty) - return 0x00; - else - return 0x40; - } - else - { - //logerror("KB: bit position %i, key %02x, empty %i\n",m_kb_bitpos,m_kb_current_key,m_kb_empty); - if(m_kb_current_key & (1<<(m_kb_bitpos-2))) - return 0x00; - else - return 0x40; - } -} - -void attache_state::keyboard_clock_w(bool state) -{ - if(!state && m_kb_clock) // high to low transition - advance bit position - { - m_kb_bitpos++; - if(m_kb_bitpos > 9) - m_kb_bitpos = 1; - } - m_kb_clock = state; -} - -// TODO: Figure out exactly how the HLD, RD, WR and CS lines on the RTC are hooked up -READ8_MEMBER(attache_state::pio_portA_r) -{ - UINT8 ret = 0xff; - UINT8 porta = m_pio_porta; - - switch(m_pio_select) - { - case PIO_SEL_8910_DATA: - ret = m_psg->data_r(space,0); - logerror("PSG: data read %02x\n",ret); - break; - case PIO_SEL_5832_WRITE: - m_rtc->cs_w(1); - m_rtc->write_w(0); - m_rtc->read_w(1); - m_rtc->address_w((porta & 0xf0) >> 4); - ret = m_rtc->data_r(space,0); - logerror("RTC: read %02x from %02x (write)\n",ret,(porta & 0xf0) >> 4); - break; - case PIO_SEL_5832_READ: - m_rtc->cs_w(1); - m_rtc->write_w(0); - m_rtc->read_w(1); - m_rtc->address_w((porta & 0xf0) >> 4); - ret = m_rtc->data_r(space,0); - logerror("RTC: read %02x from %02x\n",ret,(porta & 0xf0) >> 4); - break; - case PIO_SEL_5101_WRITE: - m_cmos_select = (m_cmos_select & 0xf0) | ((porta & 0xf0) >> 4); - ret = m_cmos_ram[m_cmos_select] & 0x0f; - logerror("CMOS: read %02x from byte %02x (write)\n",ret, m_cmos_select); - break; - case PIO_SEL_5101_READ: - m_cmos_select = (m_cmos_select & 0xf0) | ((porta & 0xf0) >> 4); - ret = m_cmos_ram[m_cmos_select] & 0x0f; - logerror("CMOS: read %02x from byte %02x\n",ret, m_cmos_select); - break; - case PIO_SEL_LATCH: - ret = 0x00; // Write-only? - break; - case PIO_SEL_NOP: - logerror("PIO: NOP read\n"); - break; - } - //logerror("PIO: Port A read operation %i returning %02x\n",m_pio_select,ret); - - return ret; -} - -READ8_MEMBER(attache_state::pio_portB_r) -{ - UINT8 ret = m_pio_portb & 0xbf; - ret |= keyboard_data_r(); - return ret; -} - -void attache_state::operation_strobe(address_space& space, UINT8 data) -{ - //logerror("PIO: Port A write operation %i, data %02x\n",m_pio_select,data); - switch(m_pio_select) - { - case PIO_SEL_8910_ADDR: - m_psg->address_w(space,0,data); - break; - case PIO_SEL_8910_DATA: - m_psg->data_w(space,0,data); - break; - case PIO_SEL_5832_WRITE: - m_rtc->cs_w(1); - m_rtc->write_w(1); - m_rtc->read_w(0); - m_rtc->address_w((data & 0xf0) >> 4); - m_rtc->data_w(space,0,data & 0x0f); - logerror("RTC: write %01x to %01x\n",data & 0x0f,(data & 0xf0) >> 4); - break; - case PIO_SEL_5832_READ: - m_rtc->cs_w(1); - m_rtc->write_w(0); - m_rtc->read_w(0); - m_rtc->address_w((data & 0xf0) >> 4); - logerror("RTC: write %01x to %01x (read)\n",data & 0x0f,(data & 0xf0) >> 4); - break; - case PIO_SEL_5101_WRITE: - m_cmos_select = (m_cmos_select & 0xf0) | ((data & 0xf0) >> 4); - m_cmos_ram[m_cmos_select] = data & 0x0f; - logerror("CMOS: write %01x to byte %02x\n",data & 0x0f, m_cmos_select); - break; - case PIO_SEL_5101_READ: - m_cmos_select = (m_cmos_select & 0xf0) | ((data & 0xf0) >> 4); - logerror("CMOS: write %01x to byte %02x (read)\n",data & 0x0f, m_cmos_select); - break; - case PIO_SEL_LATCH: - m_pio_latch = data; - m_rom_active = ~data & 0x04; - m_floppy0->mon_w((data & 0x01) ? 0 : 1); - m_floppy1->mon_w((data & 0x01) ? 0 : 1); - m_gfx_enabled = data & 0x02; - // TODO: display brightness - break; - case PIO_SEL_NOP: - logerror("PIO: NOP write\n"); - break; - default: - logerror("PIO: Invalid write operation %i, data %02x\n",m_pio_select,data); - } -} - -WRITE8_MEMBER(attache_state::pio_portA_w) -{ - // AO-7 = LATCH DATA OUT: - // LO = MOTOR ON - // L1 = GRAPHICS ENABLE - // L2 = /EPROM ENABLE - // L3-7 = DISPLAY BRIGHTNESS - // AO-7 = 8910 DATA I/O: - // AO-3 = 5832 DO-3 I/O - // A4-7 = 5832 AO-3 OUT - // AO-3 = 5101 DO-3 I/O - // A4-7 = 5101 AO-3 OUT - m_pio_porta = data; -} - -WRITE8_MEMBER(attache_state::pio_portB_w) -{ - // BO-1 = 5101 A4-5 - // B2-4 = OPERATION SELECT - // 0 = 8910 ADDR LOAD - // 1 = 8910 DATA LOAD - // 2 = 5832 WRITE -- the CP/M BIOS dumped from an actual disc seems to switch the RTC operations around - // 3 = 5832 READ this differs from the BIOS source listings available for both CP/M 2.2.3 and 2.2.5 - // 4 = 5101 WRITE - // 5 = 5101 READ - // 6 = LATCH LOAD - // 7 = NO-OP - //B5 = /'138 OPERATION STROBE - //B6 = /KEYBOARD DATA IN - //B7 = /KEYBOARD CLOCK OUT - m_cmos_select = ((data & 0x03) << 4) | (m_cmos_select & 0x0f); - if(!(data & 0x20) && (m_pio_portb & 0x20)) - { - m_pio_select = (data & 0x1c) >> 2; - operation_strobe(space,m_pio_porta); - } - m_pio_portb = data; - keyboard_clock_w(data & 0x80); -} - -// Display uses A8-A15 placed on the bus by the OUT instruction as an extra parameter -READ8_MEMBER(attache_state::display_data_r) -{ - UINT8 ret = 0xff; - UINT8 param = (offset & 0xff00) >> 8; - - switch(m_current_cmd) - { - case DISP_GFX_0: - ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)]; - break; - case DISP_GFX_1: - ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32)]; - break; - case DISP_GFX_2: - ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*2)]; - break; - case DISP_GFX_3: - ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*3)]; - break; - case DISP_GFX_4: - ret = m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*4)]; - break; - case DISP_CRTC: - ret = m_crtc->read(space, m_crtc_reg_select); - break; - case DISP_ATTR: - ret = m_attr_ram[(m_attr_line*128)+(param & 0x7f)]; - break; - case DISP_CHAR: - ret = m_char_ram[(m_char_line*128)+(param & 0x7f)]; - break; - default: - logerror("Unimplemented display operation %02x\n",m_current_cmd); - } - - return ret; -} - -WRITE8_MEMBER(attache_state::display_data_w) -{ - UINT8 param = (offset & 0xff00) >> 8; - switch(m_current_cmd) - { - case DISP_GFX_0: - m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)] = data; - break; - case DISP_GFX_1: - m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32)] = data; - break; - case DISP_GFX_2: - m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*2)] = data; - break; - case DISP_GFX_3: - m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*3)] = data; - break; - case DISP_GFX_4: - m_gfx_ram[(m_gfx_line*128)+(param & 0x7f)+(128*32*4)] = data; - break; - case DISP_CRTC: - m_crtc->write(space, m_crtc_reg_select, data); - break; - case DISP_ATTR: - m_attr_ram[(m_attr_line*128)+(param & 0x7f)] = data; - break; - case DISP_CHAR: - m_char_ram[(m_char_line*128)+(param & 0x7f)] = data; - break; -// default: -// logerror("Unimplemented display operation %02x data %02x param %02x\n",m_current_cmd,data,param); - } -} - -WRITE8_MEMBER(attache_state::display_command_w) -{ - UINT8 cmd = (data & 0xe0) >> 5; - - m_current_cmd = cmd; - - switch(cmd) - { - case DISP_GFX_0: - case DISP_GFX_1: - case DISP_GFX_2: - case DISP_GFX_3: - case DISP_GFX_4: - m_gfx_line = data & 0x1f; - break; - case DISP_CRTC: - // CRT5027/TMS9927 registers - m_crtc_reg_select = data & 0x0f; - break; - case DISP_ATTR: - // Attribute RAM - m_attr_line = data & 0x1f; - break; - case DISP_CHAR: - // Character RAM - m_char_line = data & 0x1f; - break; - } -} - -READ8_MEMBER(attache_state::memmap_r) -{ - return m_memmap; -} - -WRITE8_MEMBER(attache_state::memmap_w) -{ - // TODO: figure this out properly - // Tech manual says that RAM is split into 8kB chunks. - // Would seem that bit 4 is always 0 and bit 3 is always 1? - UINT8 bank = (data & 0xe0) >> 5; - UINT8 loc = data & 0x07; - memory_bank* banknum[8] = { m_membank1, m_membank2, m_membank3, m_membank4, m_membank5, m_membank6, m_membank7, m_membank8 }; - m_memmap = data; - - banknum[bank]->set_entry(loc); - - logerror("MEM: write %02x - bank %i, location %i\n",data, bank, loc); -} - -READ8_MEMBER(attache_state::dma_mask_r) -{ - return m_dma->read(space,0x0f); -} - -WRITE8_MEMBER(attache_state::dma_mask_w) -{ - m_dma->write(space,0x0f,data); -} - -READ8_MEMBER(attache_state::fdc_dma_r) -{ - UINT8 ret = m_fdc->dma_r(); - return ret; -} - -WRITE8_MEMBER(attache_state::fdc_dma_w) -{ - m_fdc->dma_w(data); -} - -READ8_MEMBER(attache_state::dma_mem_r) -{ - return m_maincpu->space(AS_PROGRAM).read_byte(offset); -} - -WRITE8_MEMBER(attache_state::dma_mem_w) -{ - m_maincpu->space(AS_PROGRAM).write_byte(offset,data); -} - -WRITE_LINE_MEMBER( attache_state::hreq_w ) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - m_dma->hack_w(state); -} - -WRITE_LINE_MEMBER(attache_state::eop_w) -{ - m_fdc->tc_w(state); -} - -WRITE_LINE_MEMBER( attache_state::fdc_dack_w ) -{ -} - -static ADDRESS_MAP_START( attache_map , AS_PROGRAM, 8, attache_state) - AM_RANGE(0x0000,0x1fff) AM_RAMBANK("bank1") - AM_RANGE(0x2000,0x3fff) AM_RAMBANK("bank2") - AM_RANGE(0x4000,0x5fff) AM_RAMBANK("bank3") - AM_RANGE(0x6000,0x7fff) AM_RAMBANK("bank4") - AM_RANGE(0x8000,0x9fff) AM_RAMBANK("bank5") - AM_RANGE(0xa000,0xbfff) AM_RAMBANK("bank6") - AM_RANGE(0xc000,0xdfff) AM_RAMBANK("bank7") - AM_RANGE(0xe000,0xffff) AM_RAMBANK("bank8") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( attache_io , AS_IO, 8, attache_state) - AM_RANGE(0xe0, 0xed) AM_DEVREADWRITE("dma",am9517a_device,read,write) AM_MIRROR(0xff00) - AM_RANGE(0xee, 0xee) AM_WRITE(display_command_w) AM_MIRROR(0xff00) - AM_RANGE(0xef, 0xef) AM_READWRITE(dma_mask_r, dma_mask_w) AM_MIRROR(0xff00) - AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("sio",z80sio0_device,ba_cd_r, ba_cd_w) AM_MIRROR(0xff00) - AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("ctc",z80ctc_device,read,write) AM_MIRROR(0xff00) - AM_RANGE(0xf8, 0xfb) AM_DEVREADWRITE("pio",z80pio_device,read_alt,write_alt) AM_MIRROR(0xff00) - AM_RANGE(0xfc, 0xfd) AM_DEVICE("fdc",upd765a_device,map) AM_MIRROR(0xff00) - AM_RANGE(0xfe, 0xfe) AM_READWRITE(display_data_r, display_data_w) AM_MIRROR(0xff00) AM_MASK(0xffff) - AM_RANGE(0xff, 0xff) AM_READWRITE(memmap_r, memmap_w) AM_MIRROR(0xff00) -ADDRESS_MAP_END - -static INPUT_PORTS_START(attache) - PORT_START("row0") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x18,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_PGUP) - - PORT_START("row1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x06,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - - PORT_START("row2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 *") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("row3") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - - PORT_START("row4") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("row5") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("row6") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("row7") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - - PORT_START("modifiers") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) - -INPUT_PORTS_END - -// IRQ daisy chain = CTC -> SIO -> Expansion -static const z80_daisy_config attache_daisy_chain[] = -{ - { "ctc" }, - { "sio" }, - // expansion - { NULL } -}; - -static SLOT_INTERFACE_START( attache_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -void attache_state::driver_start() -{ - UINT8 *RAM = m_ram->pointer(); - - m_membank1->configure_entries(0, 8, &RAM[0x0000], 0x2000); - m_membank2->configure_entries(0, 8, &RAM[0x0000], 0x2000); - m_membank3->configure_entries(0, 8, &RAM[0x0000], 0x2000); - m_membank4->configure_entries(0, 8, &RAM[0x0000], 0x2000); - m_membank5->configure_entries(0, 8, &RAM[0x0000], 0x2000); - m_membank6->configure_entries(0, 8, &RAM[0x0000], 0x2000); - m_membank7->configure_entries(0, 8, &RAM[0x0000], 0x2000); - m_membank8->configure_entries(0, 8, &RAM[0x0000], 0x2000); - - m_membank1->set_entry(0); - m_membank2->set_entry(1); - m_membank3->set_entry(2); - m_membank4->set_entry(3); - m_membank5->set_entry(4); - m_membank6->set_entry(5); - m_membank7->set_entry(6); - m_membank8->set_entry(7); - - memset(RAM,0,65536); - - m_nvram->set_base(m_cmos_ram,64); - - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0000,0x0fff,read8_delegate(FUNC(attache_state::rom_r),this),write8_delegate(FUNC(attache_state::rom_w),this)); - - save_pointer(m_char_ram,"Character RAM",128*32); - save_pointer(m_attr_ram,"Attribute RAM",128*32); - save_pointer(m_gfx_ram,"Graphics RAM",128*32*5); - save_pointer(m_cmos_ram,"CMOS RAM",64); -} - -void attache_state::machine_start() -{ - // initialise RAM - memset(m_cmos_ram,0,64); - memset(m_attr_ram,0,128*32); - memset(m_char_ram,0,128*32); - memset(m_gfx_ram,0,128*32*5); -} - -void attache_state::machine_reset() -{ - m_kb_bitpos = 0; -} - -static MACHINE_CONFIG_START( attache, attache_state ) - MCFG_CPU_ADD("maincpu",Z80,XTAL_8MHz / 2) - MCFG_CPU_PROGRAM_MAP(attache_map) - MCFG_CPU_IO_MAP(attache_io) - MCFG_CPU_CONFIG(attache_daisy_chain) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(64)) /* not accurate */ - MCFG_SCREEN_SIZE(640,240) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(attache_state, screen_update) - MCFG_SCREEN_VBLANK_DRIVER(attache_state, vblank_int) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("psg", AY8912, XTAL_8MHz / 4) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_MSM5832_ADD("rtc",XTAL_32_768kHz) - - MCFG_DEVICE_ADD("pio", Z80PIO, XTAL_8MHz/26) - MCFG_Z80PIO_IN_PA_CB(READ8(attache_state, pio_portA_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(attache_state, pio_portA_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(attache_state, pio_portB_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(attache_state, pio_portB_w)) - - MCFG_Z80SIO0_ADD("sio",XTAL_8MHz / 26, 0, 0, 0, 0) - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_8MHz / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("dma", AM9517A, XTAL_8MHz / 4) - MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(attache_state, hreq_w)) - MCFG_AM9517A_OUT_EOP_CB(WRITELINE(attache_state, eop_w)) - MCFG_AM9517A_IN_MEMR_CB(READ8(attache_state, dma_mem_r)) - MCFG_AM9517A_OUT_MEMW_CB(WRITE8(attache_state, dma_mem_w)) - MCFG_AM9517A_IN_IOR_0_CB(READ8(attache_state, fdc_dma_r)) - MCFG_AM9517A_OUT_IOW_0_CB(WRITE8(attache_state, fdc_dma_w)) - // MCFG_AM9517A_OUT_DACK_0_CB(WRITELINE(attache_state, fdc_dack_w)) - - MCFG_UPD765A_ADD("fdc", true, true) - MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("ctc", z80ctc_device, trg3)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma", am9517a_device, dreq0_w)) MCFG_DEVCB_INVERT - MCFG_FLOPPY_DRIVE_ADD("fdc:0", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD("crtc", TMS9927, 12324000) - MCFG_TMS9927_CHAR_WIDTH(8) - - MCFG_NVRAM_ADD_0FILL("nvram") - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64k") - - MCFG_SOFTWARE_LIST_ADD("disk_list","attache") -MACHINE_CONFIG_END - -ROM_START( attache ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_FILL(0x0000,0x10000,0x00) - - ROM_REGION(0x1000, "boot", 0) - ROM_SYSTEM_BIOS(0, "u252revg", "Boot Rev.G") - ROMX_LOAD("u252revg.bin", 0x0000, 0x1000, CRC(113136b7) SHA1(845afd9ed2fd2b28c39921d8f2ba99e5295e0330), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "u252revf", "Boot Rev.F") - ROMX_LOAD("u252revf.bin", 0x0000, 0x1000, CRC(b49eb3b2) SHA1(5b1b348301b2f76b1f250ba68bb8733fc15d18c2), ROM_BIOS(2)) - - ROM_REGION(0x1000, "video", 0) - ROM_LOAD("u416vid.bin", 0x0000, 0x1000, CRC(e376ec59) SHA1(7b9e9db575e77ce2f479eb9ae913528e4f0d125d) ) - - ROM_REGION(0x100, "attr", 0) - ROM_LOAD("u413.bin", 0x0000, 0x0100, CRC(5b60e622) SHA1(43450c747db1394466eabe5c26a61bf75a4f3b52) ) - - ROM_REGION(0x200, "iosel", 0) - ROM_LOAD("u110.bin", 0x0000, 0x0200, CRC(70dd255a) SHA1(36dcce07a2c14eefc069433459c422341bd47efb) ) - - ROM_REGION(0x100, "floppy", 0) - ROM_LOAD("u630.bin", 0x0000, 0x0100, CRC(f7a5c821) SHA1(fea07d9ac7e4e5f4f72aa7b2159deaedbd662ead) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT DEVICE INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, attache, 0, 0, attache, attache, driver_device, 0, "Otrona", "Attach\xC3\xA9", MACHINE_IMPERFECT_GRAPHICS|MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/aussiebyte.c b/src/mess/drivers/aussiebyte.c deleted file mode 100644 index 4980be8204d..00000000000 --- a/src/mess/drivers/aussiebyte.c +++ /dev/null @@ -1,574 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/************************************************************************************************* - - The Aussie Byte II Single-Board Computer, created by SME Systems, Melbourne, Australia. - Also known as the Knight 2000 Microcomputer. - - Status: - Boots up from floppy. - Output to serial terminal and to 6545 are working. Serial keyboard works. - - Developed in conjunction with members of the MSPP. Written in July, 2015. - - ToDo: - - CRT8002 attributes controller - - Graphics - - Hard drive controllers and drives - - Test Centronics printer - - PIO connections - - RTC not working - - Note of MAME restrictions: - - Votrax doesn't sound anything like the real thing - - WD1001/WD1002 device is not emulated - - CRT8002 device is not emulated - -**************************************************************************************************/ - -/*********************************************************** - - Includes - -************************************************************/ -#include "includes/aussiebyte.h" - - -/*********************************************************** - - Address Maps - -************************************************************/ - -static ADDRESS_MAP_START( aussiebyte_map, AS_PROGRAM, 8, aussiebyte_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank1") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank2") - AM_RANGE(0xc000, 0xffff) AM_RAM AM_REGION("mram", 0x0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( aussiebyte_io, AS_IO, 8, aussiebyte_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("sio1", z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("pio1", z80pio_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_NOP // winchester interface - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", wd2797_t, read, write) - AM_RANGE(0x14, 0x14) AM_DEVREADWRITE("dma", z80dma_device, read, write) - AM_RANGE(0x15, 0x15) AM_WRITE(port15_w) // boot rom disable - AM_RANGE(0x16, 0x16) AM_WRITE(port16_w) // fdd select - AM_RANGE(0x17, 0x17) AM_WRITE(port17_w) // DMA mux - AM_RANGE(0x18, 0x18) AM_WRITE(port18_w) // fdc select - AM_RANGE(0x19, 0x19) AM_READ(port19_r) // info port - AM_RANGE(0x1a, 0x1a) AM_WRITE(port1a_w) // membank - AM_RANGE(0x1b, 0x1b) AM_WRITE(port1b_w) // winchester control - AM_RANGE(0x1c, 0x1f) AM_WRITE(port1c_w) // gpebh select - AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("pio2", z80pio_device, read, write) - AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("sio2", z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x28, 0x28) AM_READ(port28_r) AM_DEVWRITE("votrax", votrax_sc01_device, write) - AM_RANGE(0x2c, 0x2c) AM_DEVWRITE("votrax", votrax_sc01_device, inflection_w) - AM_RANGE(0x30, 0x30) AM_WRITE(address_w) - AM_RANGE(0x31, 0x31) AM_DEVREAD("crtc", mc6845_device, status_r) - AM_RANGE(0x32, 0x32) AM_WRITE(register_w) - AM_RANGE(0x33, 0x33) AM_READ(port33_r) - AM_RANGE(0x34, 0x34) AM_WRITE(port34_w) // video control - AM_RANGE(0x35, 0x35) AM_WRITE(port35_w) // data to vram and aram - AM_RANGE(0x36, 0x36) AM_READ(port36_r) // data from vram and aram - AM_RANGE(0x37, 0x37) AM_READ(port37_r) // read dispen flag - AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("rtc", msm5832_device, data_r, data_w) -ADDRESS_MAP_END - -/*********************************************************** - - Keyboard - -************************************************************/ -static INPUT_PORTS_START( aussiebyte ) -INPUT_PORTS_END - -/*********************************************************** - - I/O Ports - -************************************************************/ -WRITE8_MEMBER( aussiebyte_state::port15_w ) -{ - membank("bankr0")->set_entry(m_port15); // point at ram - m_port15 = true; -} - -/* FDD select -0 Drive Select bit O -1 Drive Select bit 1 -2 Drive Select bit 2 -3 Drive Select bit 3 - - These bits connect to a 74LS145 binary to BCD converter. - - Drives 0 to 3 are 5.25 inch, 4 to 7 are 8 inch, 9 and 0 are not used. - - Currently we only support drive 0. -4 Side Select to Disk Drives. -5 Disable 5.25 inch floppy spindle motors. -6 Unused. -7 Enable write precompensation on WD2797 controller. */ -WRITE8_MEMBER( aussiebyte_state::port16_w ) -{ - floppy_image_device *m_floppy = NULL; - if ((data & 15) == 0) - m_floppy = m_floppy0->get_device(); - else - if ((data & 15) == 1) - m_floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) - { - m_floppy->mon_w(BIT(data, 5)); - m_floppy->ss_w(BIT(data, 4)); - } -} - -/* DMA select -0 - FDC -1 - SIO Ch A -2 - SIO Ch B -3 - Winchester bus -4 - SIO Ch C -5 - SIO Ch D -6 - Ext ready 1 -7 - Ext ready 2 */ -WRITE8_MEMBER( aussiebyte_state::port17_w ) -{ - m_port17 = data & 7; - m_dma->rdy_w(BIT(m_port17_rdy, data)); -} - -/* FDC params -2 EXC: WD2797 clock frequency. H = 5.25"; L = 8" -3 WIEN: WD2797 Double density select. */ -WRITE8_MEMBER( aussiebyte_state::port18_w ) -{ - m_fdc->set_unscaled_clock(BIT(data, 2) ? 1e6 : 2e6); - m_fdc->dden_w(BIT(data, 3)); -} - -READ8_MEMBER( aussiebyte_state::port19_r ) -{ - return m_port19; -} - -// Memory banking -WRITE8_MEMBER( aussiebyte_state::port1a_w ) -{ - data &= 7; - switch (data) - { - case 0: - case 1: - case 2: - case 3: - case 4: - m_port1a = data*3+1; - if (m_port15) - membank("bankr0")->set_entry(data*3+1); - membank("bankw0")->set_entry(data*3+1); - membank("bank1")->set_entry(data*3+2); - membank("bank2")->set_entry(data*3+3); - break; - case 5: - m_port1a = 1; - if (m_port15) - membank("bankr0")->set_entry(1); - membank("bankw0")->set_entry(1); - membank("bank1")->set_entry(2); - membank("bank2")->set_entry(13); - break; - case 6: - m_port1a = 14; - if (m_port15) - membank("bankr0")->set_entry(14); - membank("bankw0")->set_entry(14); - membank("bank1")->set_entry(15); - //membank("bank2")->set_entry(0); // open bus - break; - case 7: - m_port1a = 1; - if (m_port15) - membank("bankr0")->set_entry(1); - membank("bankw0")->set_entry(1); - membank("bank1")->set_entry(4); - membank("bank2")->set_entry(13); - break; - } -} - -// Winchester control -WRITE8_MEMBER( aussiebyte_state::port1b_w ) -{ -} - -// GPEHB control -WRITE8_MEMBER( aussiebyte_state::port1c_w ) -{ -} - -WRITE8_MEMBER( aussiebyte_state::port20_w ) -{ - m_speaker->level_w(BIT(data, 7)); -} - -READ8_MEMBER( aussiebyte_state::port28_r ) -{ - return m_port28; -} - -/*********************************************************** - - DMA - -************************************************************/ -READ8_MEMBER( aussiebyte_state::memory_read_byte ) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER( aussiebyte_state::memory_write_byte ) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - prog_space.write_byte(offset, data); -} - -READ8_MEMBER( aussiebyte_state::io_read_byte ) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER( aussiebyte_state::io_write_byte ) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - prog_space.write_byte(offset, data); -} - -WRITE_LINE_MEMBER( aussiebyte_state::busreq_w ) -{ -// since our Z80 has no support for BUSACK, we assume it is granted immediately - m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); - m_dma->bai_w(state); // tell dma that bus has been granted -} - -/*********************************************************** - - DMA selector - -************************************************************/ -WRITE_LINE_MEMBER( aussiebyte_state::sio1_rdya_w ) -{ - m_port17_rdy = (m_port17_rdy & 0xfd) | (UINT8)(state << 1); - if (m_port17 == 1) - m_dma->rdy_w(state); -} - -WRITE_LINE_MEMBER( aussiebyte_state::sio1_rdyb_w ) -{ - m_port17_rdy = (m_port17_rdy & 0xfb) | (UINT8)(state << 2); - if (m_port17 == 2) - m_dma->rdy_w(state); -} - -WRITE_LINE_MEMBER( aussiebyte_state::sio2_rdya_w ) -{ - m_port17_rdy = (m_port17_rdy & 0xef) | (UINT8)(state << 4); - if (m_port17 == 4) - m_dma->rdy_w(state); -} - -WRITE_LINE_MEMBER( aussiebyte_state::sio2_rdyb_w ) -{ - m_port17_rdy = (m_port17_rdy & 0xdf) | (UINT8)(state << 5); - if (m_port17 == 5) - m_dma->rdy_w(state); -} - - -/*********************************************************** - - Video - -************************************************************/ - -/* F4 Character Displayer */ -static const gfx_layout crt8002_charlayout = -{ - 8, 12, /* 7 x 11 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( crt8002 ) - GFXDECODE_ENTRY( "chargen", 0x0000, crt8002_charlayout, 0, 1 ) -GFXDECODE_END - -/*************************************************************** - - Daisy Chain - -****************************************************************/ - -static const z80_daisy_config daisy_chain_intf[] = -{ - { "dma" }, - { "pio2" }, - { "sio1" }, - { "sio2" }, - { "pio1" }, - { "ctc" }, - { NULL } -}; - - -/*********************************************************** - - CTC - -************************************************************/ - -// baud rate generator. All inputs are 1.2288MHz. -TIMER_DEVICE_CALLBACK_MEMBER( aussiebyte_state::ctc_tick ) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); - m_ctc->trg1(1); - m_ctc->trg1(0); - m_ctc->trg2(1); - m_ctc->trg2(0); -} - -WRITE_LINE_MEMBER( aussiebyte_state::ctc_z0_w ) -{ - m_sio1->rxca_w(state); - m_sio1->txca_w(state); -} - -WRITE_LINE_MEMBER( aussiebyte_state::ctc_z1_w ) -{ - m_sio1->rxtxcb_w(state); - m_sio2->rxca_w(state); - m_sio2->txca_w(state); -} - -WRITE_LINE_MEMBER( aussiebyte_state::ctc_z2_w ) -{ - m_sio2->rxtxcb_w(state); - m_ctc->trg3(1); - m_ctc->trg3(0); -} - -/*********************************************************** - - Centronics ack - -************************************************************/ -WRITE_LINE_MEMBER( aussiebyte_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -/*********************************************************** - - Speech ack - -************************************************************/ -WRITE_LINE_MEMBER( aussiebyte_state::votrax_w ) -{ - m_port28 = state; -} - - -/*********************************************************** - - Floppy Disk - -************************************************************/ - -WRITE_LINE_MEMBER( aussiebyte_state::fdc_intrq_w ) -{ - UINT8 data = (m_port19 & 0xbf) | (state ? 0x40 : 0); - m_port19 = data; -} - -WRITE_LINE_MEMBER( aussiebyte_state::fdc_drq_w ) -{ - UINT8 data = (m_port19 & 0x7f) | (state ? 0x80 : 0); - m_port19 = data; - state ^= 1; // inverter on pin38 of fdc - m_port17_rdy = (m_port17_rdy & 0xfe) | (UINT8)state; - if (m_port17 == 0) - m_dma->rdy_w(state); -} - -static SLOT_INTERFACE_START( aussiebyte_floppies ) - SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) - SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -/*********************************************************** - - Machine Driver - -************************************************************/ -MACHINE_RESET_MEMBER( aussiebyte_state, aussiebyte ) -{ - m_port15 = false; - m_port17 = 0; - m_port17_rdy = 0; - m_port1a = 1; - m_alpha_address = 0; - m_graph_address = 0; - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("vram")->base(); - m_p_attribram = memregion("aram")->base(); - membank("bankr0")->set_entry(16); // point at rom - membank("bankw0")->set_entry(1); // always write to ram - membank("bank1")->set_entry(2); - membank("bank2")->set_entry(3); - m_maincpu->reset(); -} - -static MACHINE_CONFIG_START( aussiebyte, aussiebyte_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(aussiebyte_map) - MCFG_CPU_IO_MAP(aussiebyte_io) - MCFG_CPU_CONFIG(daisy_chain_intf) - - MCFG_MACHINE_RESET_OVERRIDE(aussiebyte_state, aussiebyte ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", crt8002) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720kHz? needs verify */ - MCFG_VOTRAX_SC01_REQUEST_CB(WRITELINE(aussiebyte_state, votrax_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(aussiebyte_state, write_centronics_busy)) - MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_16MHz / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(aussiebyte_state, ctc_z0_w)) // SIO1 Ch A - MCFG_Z80CTC_ZC1_CB(WRITELINE(aussiebyte_state, ctc_z1_w)) // SIO1 Ch B, SIO2 Ch A - MCFG_Z80CTC_ZC2_CB(WRITELINE(aussiebyte_state, ctc_z2_w)) // SIO2 Ch B, CTC Ch 3 - - MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_16MHz / 4) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(aussiebyte_state, busreq_w)) - // BAO, not used - MCFG_Z80DMA_IN_MREQ_CB(READ8(aussiebyte_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(aussiebyte_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(aussiebyte_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(aussiebyte_state, io_write_byte)) - - MCFG_DEVICE_ADD("pio1", Z80PIO, XTAL_16MHz / 4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_IN_PB_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) - MCFG_Z80PIO_OUT_ARDY_CB(DEVWRITELINE("centronics", centronics_device, write_strobe)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("pio2", Z80PIO, XTAL_16MHz / 4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(aussiebyte_state, port20_w)) - - MCFG_Z80SIO0_ADD("sio1", XTAL_16MHz / 4, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(aussiebyte_state, sio1_rdya_w)) - MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(aussiebyte_state, sio1_rdyb_w)) - - MCFG_Z80SIO0_ADD("sio2", XTAL_16MHz / 4, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(aussiebyte_state, sio2_rdya_w)) - MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(aussiebyte_state, sio2_rdyb_w)) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "keyboard") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sio2", z80sio0_device, rxa_w)) - - MCFG_WD2797_ADD("fdc", XTAL_16MHz / 16) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(aussiebyte_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(aussiebyte_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", aussiebyte_floppies, "drive0", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", aussiebyte_floppies, "drive1", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - - /* devices */ - MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_16MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(aussiebyte_state, crtc_update_row) - MCFG_MC6845_ADDR_CHANGED_CB(aussiebyte_state, crtc_update_addr) - - MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", aussiebyte_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz / 4)) -MACHINE_CONFIG_END - - -DRIVER_INIT_MEMBER( aussiebyte_state, aussiebyte ) -{ - // Main ram is divided into 16k blocks (0-15). The boot rom is block number 16. - // For convenience, bank 0 is permanently assigned to C000-FFFF - UINT8 *main = memregion("roms")->base(); - UINT8 *ram = memregion("mram")->base(); - - membank("bankr0")->configure_entries(0, 16, &ram[0x0000], 0x4000); - membank("bankw0")->configure_entries(0, 16, &ram[0x0000], 0x4000); - membank("bank1")->configure_entries(0, 16, &ram[0x0000], 0x4000); - membank("bank2")->configure_entries(0, 16, &ram[0x0000], 0x4000); - membank("bankr0")->configure_entry(16, &main[0x0000]); -} - - -/*********************************************************** - - Game driver - -************************************************************/ - - -ROM_START(aussieby) - ROM_REGION(0x4000, "roms", 0) // Size of bank 16 - ROM_LOAD( "knight_boot_0000.u27", 0x0000, 0x1000, CRC(1f200437) SHA1(80d1d208088b325c16a6824e2da605fb2b00c2ce) ) - - ROM_REGION(0x800, "chargen", 0) - ROM_LOAD( "8002.bin", 0x0000, 0x0800, CRC(fdd6eb13) SHA1(a094d416e66bdab916e72238112a6265a75ca690) ) - - ROM_REGION(0x40000, "mram", ROMREGION_ERASE00) // main ram, 256k dynamic - ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) // video ram, 64k dynamic - ROM_REGION(0x00800, "aram", ROMREGION_ERASEFF) // attribute ram, 2k static -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, aussieby, 0, 0, aussiebyte, aussiebyte, aussiebyte_state, aussiebyte, "SME Systems", "Aussie Byte II" , MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/avigo.c b/src/mess/drivers/avigo.c deleted file mode 100644 index f9730f56c90..00000000000 --- a/src/mess/drivers/avigo.c +++ /dev/null @@ -1,1017 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/****************************************************************************** - - avigo.c - - TI "Avigo" PDA - - - system driver - - Documentation: - Hans B Pufal - Avigo simulator - - - MEMORY MAP: - 0x0000-0x03fff: flash 0 block 0 - 0x4000-0x07fff: bank 1 - 0x8000-0x0bfff: bank 2 - 0xc000-0x0ffff: ram block 0 - - Bankswitch: - Bank 1 is controlled by ports 5 and 6, port 5 is the bank select - and port 6 is the chip select, the known chip select are: - - 0: flash 0 - - 1: RAM - - 3: flash 1 - - 5: flash 2 (optional) - - 6: VideoRAM - - 7: flash 0 - - Bank 2 have the same behavior but is controlled by ports 7 and 8 - - Hardware: - - Z80 CPU - - 16c500c UART - - amd29f080 flash-file memory x 3 (3mb) - - 128k ram - - stylus pen - - touch-pad screen - - Flash: - The following flash ID are checked by Avigo OS, if the returned - ID is different the PDA doesn't boot. - - Maker ID Device ID Description - 0xb0 0x21 Sharp LH28F004 - 0x89 0xa6 Sharp LH28F008 - 0x89 0xaa Sharp LH28F016 - 0xb0 0x88 Sharp LH28F032 - 0x01 0xa4 AMD AM29F040 - 0x01 0xd5 AMD AM29F080 - 0x01 0xad AMD AM29F016 - - TODO: - - Found a better way to emulate the touchscreen panel out of the screen - area (the six buttons at the bottom) - - Alarm doesn't work - - Serial communications and IR port. - - I don't have any documentation on the hardware, so a lot of this - driver has been written using educated guesswork and a lot of help - from an existing emulation written by Hans Pufal. Hans's emulator - is also written from educated guesswork. - - MESS Driver by Kevin Thacker and Sandro Ronco - - ******************************************************************************/ - - -#include "includes/avigo.h" -#include "avigo.lh" - - -#define AVIGO_LOG 0 -#define LOG(x) do { if (AVIGO_LOG) logerror x; } while (0) - - -/* memory 0x0000-0x03fff */ -READ8_MEMBER(avigo_state::flash_0x0000_read_handler) -{ - return m_flashes[0]->read(offset); -} - -/* memory 0x0000-0x03fff */ -WRITE8_MEMBER(avigo_state::flash_0x0000_write_handler) -{ - m_flashes[0]->write(offset, data); -} - -/* memory 0x04000-0x07fff */ -READ8_MEMBER(avigo_state::flash_0x4000_read_handler) -{ - return m_flashes[m_flash_at_0x4000]->read((m_bank1_l<<14) | offset); -} - -/* memory 0x04000-0x07fff */ -WRITE8_MEMBER(avigo_state::flash_0x4000_write_handler) -{ - m_flashes[m_flash_at_0x4000]->write((m_bank1_l<<14) | offset, data); -} - -/* memory 0x08000-0x0bfff */ -READ8_MEMBER(avigo_state::flash_0x8000_read_handler) -{ - return m_flashes[m_flash_at_0x8000]->read((m_bank2_l<<14) | offset); -} - -/* memory 0x08000-0x0bfff */ -WRITE8_MEMBER(avigo_state::flash_0x8000_write_handler) -{ - m_flashes[m_flash_at_0x8000]->write((m_bank2_l<<14) | offset, data); -} - - -/* - IRQ bits (port 3) ordered by priority: - - bit 7: power down request high priority. When it occurs, clear this bit. - bit 5: real time clock - bit 3: uart int - bit 6: pen int An interrupt when pen is pressed against screen. - bit 4: 1 sec int used for auto power off - bit 2: synchronisation link interrupt???keyboard int ;; check bit 5 of port 1, - bit 1: ??? (cleared in nmi, and then set again) - bit 0: not checked, probably unused -*/ - -void avigo_state::refresh_ints() -{ - if (m_irq!=0) - m_maincpu->set_input_line(0, HOLD_LINE); - else - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -/* does not do anything yet */ -WRITE_LINE_MEMBER( avigo_state::tc8521_alarm_int ) -{ -//#if 0 - m_irq &=~(1<<5); - - if (state) - { - m_irq |= (1<<5); - } - - refresh_ints(); -//#endif -} - -void avigo_state::refresh_memory(UINT8 bank, UINT8 chip_select) -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - int &active_flash = (bank == 1 ? m_flash_at_0x4000 : m_flash_at_0x8000); - char bank_tag[6]; - - LOG(("Chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff)); - - switch (chip_select) - { - case 0x06: // videoram - space.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, read8_delegate(FUNC(avigo_state::vid_memory_r), this), write8_delegate(FUNC(avigo_state::vid_memory_w), this)); - active_flash = -1; - break; - - case 0x01: // banked RAM - sprintf(bank_tag,"bank%d", bank); - membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1_l : m_bank2_l) & 0x07)<<14)); - space.install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag); - active_flash = -1; - break; - - case 0x00: // flash 0 - case 0x03: // flash 1 - case 0x05: // flash 2 - case 0x07: // flash 0 - if (active_flash < 0) // to avoid useless calls to install_readwrite_handler that cause slowdowns - { - if (bank == 1) - space.install_readwrite_handler(0x4000, 0x7fff, read8_delegate(FUNC(avigo_state::flash_0x4000_read_handler), this), write8_delegate(FUNC(avigo_state::flash_0x4000_write_handler), this)); - else - space.install_readwrite_handler(0x8000, 0xbfff, read8_delegate(FUNC(avigo_state::flash_0x8000_read_handler), this), write8_delegate(FUNC(avigo_state::flash_0x8000_write_handler), this)); - } - - switch (chip_select) - { - case 0x00: - case 0x07: active_flash = 0; break; - case 0x03: active_flash = 1; break; - case 0x05: active_flash = 2; break; - } - break; - - default: - logerror("Unknown chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff); - space.unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff); - active_flash = -1; - break; - } -} - - -WRITE_LINE_MEMBER( avigo_state::com_interrupt ) -{ - LOG(("com int\r\n")); - - m_irq &= ~(1<<3); - - if (state) - { - m_irq |= (1<<3); - } - - refresh_ints(); -} - -void avigo_state::machine_reset() -{ - /* if is a cold start initialize flash contents */ - if (!m_warm_start) - { - memcpy(m_flashes[0]->space().get_read_ptr(0), memregion("bios")->base() + 0x000000, 0x100000); - memcpy(m_flashes[1]->space().get_read_ptr(0), memregion("bios")->base() + 0x100000, 0x100000); - } - - m_irq = 0; - m_bank1_l = 0; - m_bank1_h = 0; - m_bank2_l = 0; - m_bank2_h = 0; - m_flash_at_0x4000 = -1; - m_flash_at_0x8000 = -1; - - refresh_memory(1, m_bank1_h & 0x07); - refresh_memory(2, m_bank2_h & 0x07); -} - -void avigo_state::machine_start() -{ - m_ram_base = (UINT8*)m_ram->pointer(); - - // bank3 always first ram bank - membank("bank3")->set_base(m_ram_base); - - /* keep machine pointers to flash devices */ - m_flashes[0] = machine().device("flash0"); - m_flashes[1] = machine().device("flash1"); - m_flashes[2] = machine().device("flash2"); - - machine().device("nvram")->set_base(m_ram_base, m_ram->size()); - m_warm_start = 1; - - // register for state saving - save_item(NAME(m_key_line)); - save_item(NAME(m_irq)); - save_item(NAME(m_port2)); - save_item(NAME(m_bank2_l)); - save_item(NAME(m_bank2_h)); - save_item(NAME(m_bank1_l)); - save_item(NAME(m_bank1_h)); - save_item(NAME(m_ad_control_status)); - save_item(NAME(m_flash_at_0x4000)); - save_item(NAME(m_flash_at_0x8000)); - save_item(NAME(m_ad_value)); - save_item(NAME(m_screen_column)); - save_item(NAME(m_warm_start)); - - // save all flash contents - save_pointer(NAME((UINT8*)m_flashes[0]->space().get_read_ptr(0)), 0x100000); - save_pointer(NAME((UINT8*)m_flashes[1]->space().get_read_ptr(0)), 0x100000); - save_pointer(NAME((UINT8*)m_flashes[2]->space().get_read_ptr(0)), 0x100000); - - // register postload callback - machine().save().register_postload(save_prepost_delegate(FUNC(avigo_state::postload), this)); -} - -void avigo_state::postload() -{ - // refresh the bankswitch - refresh_memory(1, m_bank1_h & 0x07); - refresh_memory(2, m_bank2_h & 0x07); -} - -static ADDRESS_MAP_START( avigo_mem , AS_PROGRAM, 8, avigo_state) - AM_RANGE(0x0000, 0x3fff) AM_READWRITE(flash_0x0000_read_handler, flash_0x0000_write_handler) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank1") - AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank2") - AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("bank3") -ADDRESS_MAP_END - - -READ8_MEMBER(avigo_state::key_data_read_r) -{ - UINT8 data = 0x0f; - - if (!(m_key_line & 0x01)) - { - data &= ioport("LINE0")->read(); - } - - if (!(m_key_line & 0x02)) - { - data &= ioport("LINE1")->read(); - } - - if (!(m_key_line & 0x04)) - { - data &= ioport("LINE2")->read(); - } - - /* bit 3 is cold/warm start */ - data &= ((m_warm_start<<3) ^ 0xff); - - /* if bit 5 is clear shows synchronisation logo! */ - data |= (1<<5); - - return data; -} - - -/* set key line(s) to read */ -/* bit 0 set for line 0, bit 1 set for line 1, bit 2 set for line 2 */ -WRITE8_MEMBER(avigo_state::set_key_line_w) -{ - /* 5, 101, read back 3 */ - m_key_line = data; - - m_warm_start = BIT(data, 3); -} - -READ8_MEMBER(avigo_state::irq_r) -{ - return m_irq; -} - -WRITE8_MEMBER(avigo_state::irq_w) -{ - m_irq &= data; - - refresh_ints(); -} - -WRITE8_MEMBER(avigo_state::port2_w) -{ - /* - bit 4 LCD backlight on/off - bit 5-6 source select for a/d converter - */ - - if ((m_port2 ^ data) & 0x10) - popmessage("Backlight %s", data & 0x10 ? "on" : "off"); - - m_port2 = data; -} - -READ8_MEMBER(avigo_state::bank1_r) -{ - return offset ? m_bank1_h: m_bank1_l; -} - -READ8_MEMBER(avigo_state::bank2_r) -{ - return offset ? m_bank2_h: m_bank2_l; -} - -WRITE8_MEMBER(avigo_state::bank1_w) -{ - if (offset) - { - LOG(("bank1 h w: %04x\n", data)); - m_bank1_h = data; - } - else - { - LOG(("bank1 l w: %04x\n", data)); - m_bank1_l = data & 0x3f; - } - - refresh_memory(1, m_bank1_h & 0x07); -} - -WRITE8_MEMBER(avigo_state::bank2_w) -{ - if (offset) - { - LOG(("bank2 h w: %04x\n", data)); - m_bank2_h = data; - } - else - { - LOG(("bank2 l w: %04x\n", data)); - m_bank2_l = data & 0x3f; - } - - refresh_memory(2, m_bank2_h & 0x07); -} - -READ8_MEMBER(avigo_state::ad_control_status_r) -{ - LOG(("avigo ad control read %02x\n", (int) m_ad_control_status)); - return m_ad_control_status; -} - - -WRITE8_MEMBER(avigo_state::ad_control_status_w) -{ - LOG(("avigo ad control w %02x\n",data)); - - switch (m_port2 & 0x60) - { - case 0x20: - // read main battery status valid range 0x000-0x3ff - LOG(("a/d main battery status\n")); - - m_ad_value = 0x3ff; - break; - case 0x40: - // read backup battery status valid range 0x000-0x3ff - LOG(("a/d backup battery status\n")); - - m_ad_value = 0x3ff; - break; - case 0x60: - if ((data & 0x070)==0x070) - { - /* bit 3 appears to select between 1 = x coord, 0 = y coord */ - /* when 6,5,4 = 1 */ - if ((data & 0x08)!=0) - { - LOG(("a/d select x coordinate\n")); - LOG(("x coord: %d\n", ioport("POSX")->read())); - - /* on screen range 0x060->0x03a0 */ - if (ioport("LINE3")->read() & 0x01) - { - /* this might not be totally accurate because hitable screen - area may include the border around the screen! */ - m_ad_value = ioport("POSX")->read(); - } - else - { - m_ad_value = 0; - } - - LOG(("ad value: %d\n",m_ad_value)); - - } - else - { - /* in the avigo rom, the y coordinate is inverted! */ - /* therefore a low value would be near the bottom of the display, - and a high value at the top */ - - /* total valid range 0x044->0x03a6 */ - /* 0x0350 is also checked */ - - /* assumption 0x044->0x0350 is screen area and - 0x0350->0x03a6 is panel at bottom */ - - LOG(("a/d select y coordinate\n")); - LOG(("y coord: %d\n", ioport("POSY")->read())); - - if (ioport("LINE3")->read() & 0x01) - { - m_ad_value = ioport("POSY")->read(); - } - else - { - m_ad_value = 0; - } - - LOG(("ad value: %d\n",m_ad_value)); - } - } - } - - /* bit 0: 1 if a/d complete, 0 if a/d not complete */ - m_ad_control_status = data | 1; -} - -READ8_MEMBER(avigo_state::ad_data_r) -{ - UINT8 data = 0; - - /* original */ - - /* status AND 11110111 */ - /* status OR 01110000 -> C20F */ - - switch (m_ad_control_status & 0x078) - { - /* x1110xxx */ - /* read upper 4 bits of 10 bit A/D number */ - case 0x060: - case 0x070: - case 0x078: - { - /* upper 4 bits of 10 bit A/D number in bits 7-4 of data */ - /* bit 0 must be 0, bit 1 must be 0 */ - /* bit 3 must be 1. bit 2 can have any value */ - - LOG(("a/d read upper 4 bits\n")); - data = ((m_ad_value>>6) & 0x0f)<<4; - data |= 8; - } - break; - - /* x0111xxx */ - case 0x020: - case 0x038: - { - /* lower 6 bits of 10-bit A/D number in bits 7-2 of data */ - /* bit 0 must be 1, bit 1 must be 0 */ - - LOG(("a/d lower 6-bits\n")); - data = ((m_ad_value & 0x03f)<<2); - data |= 1; - } - break; - - default: - break; - } - - /* x coord? */ - /* wait for bit 0 of status to become 1 */ - /* read data -> d */ - - - /* C20f AND 10111111 */ - /* C20f OR 00001000 */ - /* x0111xxx */ - - /* bit 1 must be 0, bit 0 must be 1 */ - /* read data -> e */ - - /* upper 4 bits of d contain data */ - /* bits 0 and 1 do not contain data of e, but all other bits do */ - - /* get bit 5 and 6 of d */ - /* and put into bit 0 and 1 of e */ - - /* C20f OR 01000000 */ - /* x1111xxx */ - - /* y coord? */ - /* bit 0 must be 0, bit 1 must be 0 */ - /* bit 3 must be 1. bit 2 can have any value */ - /* read data -> d */ - - /* C20f AND 10111111 */ - /* x0111xxx */ - - /* bit 1 must be 0, bit 0 must be 1 */ - /* read data -> e */ - - - /* original and 1111100 */ - /* original or 1111000 */ - /* 1111x00 */ - - - - /* if fails! */ - /* original */ - /* AND 1001100 */ - /* OR 1001000 */ - /* 1001x00 */ - - - /* AND 1101100 */ - /* OR 1101000 */ - /* 1101x00 */ - - /* 1111x00 */ - - LOG(("avigo ad read %02x\n",data)); - - return data; -} - - -WRITE8_MEMBER(avigo_state::speaker_w) -{ - /* Speaker output state */ - m_speaker->level_w(BIT(data, 3)); -} - - -/* port 0x04: - - bit 7: ??? if set, does a write 0x00 to 0x02e */ - - /* port 0x029: - port 0x02e */ -READ8_MEMBER(avigo_state::port_04_r) -{ - /* must be both 0 for it to boot! */ - return 0x0ff^((1<<7) | (1<<5)); -} - - - -static ADDRESS_MAP_START( avigo_io, AS_IO, 8, avigo_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x001, 0x001) AM_READWRITE( key_data_read_r, set_key_line_w ) - AM_RANGE(0x002, 0x002) AM_WRITE( port2_w ) - AM_RANGE(0x003, 0x003) AM_READWRITE( irq_r, irq_w ) - AM_RANGE(0x004, 0x004) AM_READ( port_04_r ) - AM_RANGE(0x005, 0x006) AM_READWRITE( bank1_r, bank1_w ) - AM_RANGE(0x007, 0x008) AM_READWRITE( bank2_r, bank2_w ) - AM_RANGE(0x009, 0x009) AM_READWRITE( ad_control_status_r, ad_control_status_w ) - AM_RANGE(0x010, 0x01f) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) - AM_RANGE(0x028, 0x028) AM_WRITE( speaker_w ) - AM_RANGE(0x02d, 0x02d) AM_READ( ad_data_r ) - AM_RANGE(0x030, 0x037) AM_DEVREADWRITE("ns16550", ns16550_device, ins8250_r, ins8250_w ) -ADDRESS_MAP_END - - -INPUT_CHANGED_MEMBER( avigo_state::pen_irq ) -{ - LOG(("pen pressed interrupt\n")); - - // an irq is generated when the pen is pressed down on the screen - // or lifted up from the screen - m_irq |= (1<<6); - - refresh_ints(); -} - -INPUT_CHANGED_MEMBER( avigo_state::pen_move_irq ) -{ - // an irq is generated when the pen is down on the screen and is being moved - if (ioport("LINE3")->read() & 0x01) - { - LOG(("pen move interrupt\n")); - m_irq |= (1<<6); - - refresh_ints(); - } -} - -INPUT_CHANGED_MEMBER( avigo_state::kb_irq ) -{ - LOG(("key pressed interrupt\n")); - - if (!newval) - { - m_irq |= (1<<2); - - refresh_ints(); - } -} - -INPUT_CHANGED_MEMBER( avigo_state::power_down_irq ) -{ - if(newval) - { - m_irq |= (1<<7); - - refresh_ints(); - } -} - -static INPUT_PORTS_START(avigo) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PAGE UP") PORT_CODE(KEYCODE_PGUP) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PAGE DOWN") PORT_CODE(KEYCODE_PGDN) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("LIGHT") PORT_CODE(KEYCODE_L) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("TO DO") PORT_CODE(KEYCODE_T) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("ADDRESS") PORT_CODE(KEYCODE_A) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("SCHEDULE") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("MEMO") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, kb_irq, NULL ) - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pen/Stylus pressed") PORT_CODE(KEYCODE_ENTER) PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, pen_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("?? Causes a NMI") PORT_CODE(KEYCODE_W) PORT_CODE(JOYCODE_BUTTON2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Power Down") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, power_down_irq, NULL ) - - /* these two ports are used to emulate the position of the pen/stylus on the screen */ - PORT_START("POSX") /* Mouse - X AXIS */ - PORT_BIT(0x3ff, 0x060, IPT_LIGHTGUN_X) PORT_SENSITIVITY(100) PORT_CROSSHAIR(X, 1, 0, 0) PORT_MINMAX(0x060, 0x3a0) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, pen_move_irq, NULL ) - - PORT_START("POSY") /* Mouse - Y AXIS */ - PORT_BIT(0x3ff, 0x044, IPT_LIGHTGUN_Y) PORT_SENSITIVITY(100) PORT_CROSSHAIR(Y, 1, 0, 0) PORT_MINMAX(0x044, 0x3a6) PORT_INVERT PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_CHANGED_MEMBER( DEVICE_SELF, avigo_state, pen_move_irq, NULL ) -INPUT_PORTS_END - -/* F4 Character Displayer */ -static const gfx_layout avigo_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 96, /* 96 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static const gfx_layout avigo_8_by_14 = -{ - 8, 14, /* 8 x 16 characters */ - 1024, /* 1024 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*32 /* every char takes 32 bytes */ -}; - -static const gfx_layout avigo_16_by_15 = -{ - 16, 15, /* 8 x 16 characters */ - 1024, /* 1024 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - /* y offsets */ - { 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, - 16*16 /* every char takes 16 bytes */ -}; - -static const gfx_layout avigo_15_by_16 = -{ - 15, 16, /* 8 x 16 characters */ - 1024, /* 1024 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, - /* y offsets */ - { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, - 16*16 /* every char takes 16 bytes */ -}; - -static const gfx_layout avigo_8_by_8 = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 16*16 /* every char takes 16 bytes */ -}; - -static const gfx_layout avigo_6_by_8 = -{ - 6, 8, /* 6 x 8 characters */ - 255, /* 255 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - /* y offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - 16*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( avigo ) - GFXDECODE_ENTRY( "bios", 0x08992, avigo_charlayout, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x0c020, avigo_8_by_14, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x0c020, avigo_16_by_15, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x14020, avigo_15_by_16, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x1c020, avigo_8_by_8, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x1e020, avigo_6_by_8, 0, 1 ) -GFXDECODE_END - - -TIMER_DEVICE_CALLBACK_MEMBER(avigo_state::avigo_scan_timer) -{ - m_irq |= (1<<1); - - refresh_ints(); -} - -TIMER_DEVICE_CALLBACK_MEMBER(avigo_state::avigo_1hz_timer) -{ - m_irq |= (1<<4); - - refresh_ints(); -} - -QUICKLOAD_LOAD_MEMBER( avigo_state,avigo) -{ - address_space& flash1 = m_flashes[1]->space(0); - const char *systemname = machine().system().name; - UINT32 first_app_page = (0x50000>>14); - int app_page; - - // german and spanish language are 4 pages bigger than other - if ( strcmp( systemname, "avigo_de" ) == 0 || strcmp( systemname, "avigo_es" ) == 0 ) - first_app_page += 4; - - // search the first empty page - for (app_page = first_app_page + 1; app_page<0x40; app_page++) - { - bool empty_page = true; - - for (int offset=0; offset<0x4000; offset++) - { - if (flash1.read_byte((app_page<<14) + offset) != 0xff) - { - empty_page = false; - break; - } - } - - if (empty_page) - break; - } - - // if there is the required free space installs the application - if ((app_page + (image.length()>>14)) < 0x40) - { - logerror("Application loaded at 0x%05x-0x%05x\n", app_page<<14, (app_page<<14) + (UINT32)image.length()); - - // copy app file into flash memory - image.fread((UINT8*)m_flashes[1]->space().get_read_ptr(app_page<<14), image.length()); - - // update the application ID - flash1.write_byte((app_page<<14) + 0x1a5, 0x80 + (app_page - (first_app_page>>14))); - - // reset the CPU for allow at the Avigo OS to recognize the installed app - m_warm_start = 1; - m_maincpu->reset(); - - return IMAGE_INIT_PASS; - } - - return IMAGE_INIT_FAIL; -} - -void avigo_state::nvram_init(nvram_device &nvram, void *base, size_t size) -{ - m_warm_start = 0; - memset(base, 0x00, size); -} - -static MACHINE_CONFIG_START( avigo, avigo_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(avigo_mem) - MCFG_CPU_IO_MAP(avigo_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD( "ns16550", NS16550, XTAL_1_8432MHz ) - MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport", rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport", rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport", rs232_port_device, write_rts)) - MCFG_INS8250_OUT_INT_CB(WRITELINE(avigo_state, com_interrupt)) - - MCFG_RS232_PORT_ADD( "serport", default_rs232_devices, NULL ) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, dsr_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, ri_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ns16550", ins8250_uart_device, cts_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(avigo_state, screen_update) - MCFG_SCREEN_SIZE(AVIGO_SCREEN_WIDTH, AVIGO_SCREEN_HEIGHT + AVIGO_PANEL_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, AVIGO_SCREEN_WIDTH-1, 0, AVIGO_SCREEN_HEIGHT + AVIGO_PANEL_HEIGHT -1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_avigo) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", avigo) - MCFG_PALETTE_ADD("palette", AVIGO_NUM_COLOURS) - MCFG_PALETTE_INIT_OWNER(avigo_state, avigo) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* real time clock */ - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) - MCFG_RP5C01_OUT_ALARM_CB(WRITELINE(avigo_state, tc8521_alarm_int)) - - /* flash ROMs */ - MCFG_AMD_29F080_ADD("flash0") - MCFG_AMD_29F080_ADD("flash1") - MCFG_AMD_29F080_ADD("flash2") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", avigo_state, nvram_init) - - // IRQ 1 is used for scan the pen and for cursor blinking - MCFG_TIMER_DRIVER_ADD_PERIODIC("scan_timer", avigo_state, avigo_scan_timer, attotime::from_hz(50)) - - // IRQ 4 is generated every second, used for auto power off - MCFG_TIMER_DRIVER_ADD_PERIODIC("1hz_timer", avigo_state, avigo_1hz_timer, attotime::from_hz(1)) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", avigo_state, avigo, "app", 0) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ -ROM_START(avigo) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - - ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) - ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("english_1004.rom", 0x100000, 0x050000, CRC(c9c3a225) SHA1(7939993a5615ca59ff2047e69b6d85122d437dca), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) - ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("english_1002.rom", 0x100000, 0x050000, CRC(31cab0ac) SHA1(87d337830506a12514a4beb9a8502a0de94816f2), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) - ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("english_100.rom", 0x100000, 0x050000, CRC(e2824b44) SHA1(3252454b05c3d3a4d7df1cb48dc3441ae82f2b1c), ROM_BIOS(3)) - -ROM_END - -ROM_START(avigo_de) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - - ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) - ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("german_1004.rom", 0x100000, 0x060000, CRC(0fa437b3) SHA1(e9352aa8fee6d93b898412bd129452b82baa9a21), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) - ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("german_1002.rom", 0x100000, 0x060000, CRC(c6bf07ba) SHA1(d3185687aa510f6c3b3ab3baaabe7e8ce1a79e3b), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) - ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("german_100.rom", 0x100000, 0x060000, CRC(117d9189) SHA1(7e959ab1381ba831821fcf87973b25d87f12d34e), ROM_BIOS(3)) - -ROM_END - -ROM_START(avigo_fr) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - - ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) - ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("french_1004.rom", 0x100000, 0x050000, CRC(5e4d90f7) SHA1(07df3af8a431ba65e079d6c987fb5d544f6541d8), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) - ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("french_1002.rom", 0x100000, 0x050000,CRC(caa3eb91) SHA1(ab199986de301d933f069a5e1f5150967e1d7f59), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) - ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("french_100.rom", 0x100000, 0x050000, CRC(fffa2345) SHA1(399447cede3cdd0be768952cb24f7e4431147e3d), ROM_BIOS(3)) - -ROM_END - -ROM_START(avigo_es) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - - ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) - ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("spanish_1004.rom", 0x100000, 0x060000, CRC(235a7f8d) SHA1(94da4ecafb54dcd5d80bc5063cb4024e66e6a21f), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) - ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("spanish_1002.rom", 0x100000, 0x060000, CRC(a6e80cc4) SHA1(e741657558c11f7bce646ba3d7b5f845bfa275b7), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) - ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("spanish_100.rom", 0x100000, 0x060000, CRC(953a5276) SHA1(b9ba1dbdc2127b1ef419c911ef66313024a7351a), ROM_BIOS(3)) - -ROM_END - -ROM_START(avigo_it) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - - ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) - ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("italian_1004.rom", 0x100000, 0x050000, CRC(fb7941ec) SHA1(230e8346a3b0da1ee24568ec090ce6860ebfe995), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) - ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("italian_1002.rom", 0x100000, 0x050000, CRC(093bc032) SHA1(2c75d950d356a7fd1d058808e5f0be8e15b8ea2a), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) - ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("italian_100.rom", 0x100000, 0x050000, CRC(de359218) SHA1(6185727aba8ffc98723f2df74dda388fd0d70cc9), ROM_BIOS(3)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP(1997, avigo, 0, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA", MACHINE_SUPPORTS_SAVE) -COMP(1997, avigo_de, avigo, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA (German)", MACHINE_SUPPORTS_SAVE) -COMP(1997, avigo_fr, avigo, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA (French)", MACHINE_SUPPORTS_SAVE) -COMP(1997, avigo_es, avigo, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA (Spanish)", MACHINE_SUPPORTS_SAVE) -COMP(1997, avigo_it, avigo, 0, avigo, avigo, driver_device, 0, "Texas Instruments", "TI Avigo 10 PDA (Italian)", MACHINE_SUPPORTS_SAVE) diff --git a/src/mess/drivers/ax20.c b/src/mess/drivers/ax20.c deleted file mode 100644 index d5025a92952..00000000000 --- a/src/mess/drivers/ax20.c +++ /dev/null @@ -1,158 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Axel AX-20 - - 27/12/2011 Skeleton driver. - - Hardware description: - - CPU: I8088 - - FDC: I8272 - - PIT: I8253 - - PIC: I8259 - - Also marketed under the Matra brand as MAX-20 ("M" for Matra ?) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "bus/isa/fdc.h" - -class ax20_state : public driver_device -{ -public: - ax20_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_p_vram(*this, "p_vram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_fdc(*this, "fdc") { } - - required_device m_maincpu; - required_shared_ptr m_p_vram; - required_device m_gfxdecode; - required_device m_palette; - required_device m_fdc; - - virtual void machine_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER(unk_r); - DECLARE_WRITE8_MEMBER(tc_w); - DECLARE_WRITE8_MEMBER(ctl_w); -}; - -READ8_MEMBER(ax20_state::unk_r) -{ - return 0; -} - -WRITE8_MEMBER(ax20_state::tc_w) -{ - m_fdc->tc_w((data & 0xf0) == 0xf0); -} - -WRITE8_MEMBER(ax20_state::ctl_w) -{ - m_fdc->subdevice("0")->get_device()->mon_w(!(data & 1)); -} - -UINT32 ax20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for ( int y = 0; y < 24; y++ ) - { - for ( int x = 0; x < 80; x++ ) - { - UINT16 tile = m_p_vram[24 + y * 128 + x ] & 0x7f; - - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*12); - } - } - - return 0; -} - - -static ADDRESS_MAP_START(ax20_map, AS_PROGRAM, 8, ax20_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0x1ffff) AM_RAM - AM_RANGE(0x20000,0x3ffff) AM_RAM //optional RAM - AM_RANGE(0xf0400,0xf0fff) AM_RAM AM_SHARE("p_vram") - AM_RANGE(0xff800,0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ax20_io, AS_IO, 8, ax20_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xffc0, 0xffc0) AM_WRITE(tc_w) - AM_RANGE(0xffd0, 0xffd0) AM_WRITE(ctl_w) - AM_RANGE(0xffe0, 0xffe0) AM_READ(unk_r) - AM_RANGE(0xff80, 0xff81) AM_DEVICE("fdc", i8272a_device, map) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ax20 ) -INPUT_PORTS_END - - -void ax20_state::machine_start() -{ -} - -static const gfx_layout ax20_charlayout = -{ - 8, 12, - 128, - 1, - { 0 }, - { 4*8+7, 4*8+6, 4*8+5, 4*8+4, 4*8+3, 4*8+2, 4*8+1, 4*8+0 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11 }, - 8*16 -}; - -static GFXDECODE_START( ax20 ) - GFXDECODE_ENTRY( "chargen", 0x0000, ax20_charlayout, 0, 1 ) -GFXDECODE_END - -static SLOT_INTERFACE_START( ax20_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( ax20, ax20_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8088, XTAL_14_31818MHz/3) - MCFG_CPU_PROGRAM_MAP(ax20_map) - MCFG_CPU_IO_MAP(ax20_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(ax20_state, screen_update) - MCFG_SCREEN_SIZE(80*8, 24*12) - MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*12-1) - MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ax20) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_I8272A_ADD("fdc", true) - - /* Devices */ - MCFG_FLOPPY_DRIVE_ADD("fdc:0", ax20_floppies, "525dd", isa8_fdc_device::floppy_formats) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ax20 ) - ROM_REGION( 0x0800, "ipl", 0 ) - ROM_LOAD( "ax20-s.rom", 0x0000, 0x0800, CRC(f11f95b9) SHA1(59949332dd431fcf8211c2d556e1f49351e90750)) - - ROM_REGION( 0x4000, "chargen", 0 ) - ROM_LOAD( "ax20-g.rom", 0x0000, 0x0800, CRC(90bcef80) SHA1(922067fd7316de9e69b9600c793ada5c87197eeb)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, ax20, 0, 0, ax20, ax20, driver_device, 0, "Axel", "AX-20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/b16.c b/src/mess/drivers/b16.c deleted file mode 100644 index 64904bff3c6..00000000000 --- a/src/mess/drivers/b16.c +++ /dev/null @@ -1,312 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Hitachi B(asic Master?) 16 - - very preliminary driver by Angelo Salese - - TODO: - - Driver is all made up of educated guesses (no documentation available) - - 0xfcc67 after the ROM checksum to zero (bp 0xfc153 -> SI = 0) -> system boots - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "video/mc6845.h" -#include "machine/am9517a.h" - - - -class b16_state : public driver_device -{ -public: - b16_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_vram(*this, "vram"), - m_dma8237(*this, "8237dma"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - UINT8 *m_char_rom; - required_shared_ptr m_vram; - UINT8 m_crtc_vreg[0x100],m_crtc_index; - - DECLARE_READ16_MEMBER(vblank_r); - DECLARE_WRITE8_MEMBER(b16_pcg_w); - DECLARE_WRITE8_MEMBER(b16_6845_address_w); - DECLARE_WRITE8_MEMBER(b16_6845_data_w); - DECLARE_READ8_MEMBER(unk_dev_r); - DECLARE_WRITE8_MEMBER(unk_dev_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - mc6845_device *m_mc6845; - required_device m_dma8237; - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; -}; - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - - -void b16_state::video_start() -{ - // find memory regions - m_char_rom = memregion("pcg")->base(); -} - - -UINT32 b16_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - int xi,yi; - UINT8 *gfx_rom = memregion("pcg")->base(); - - for(y=0;y> 8; - int pen; - - for(yi=0;yi> (7-xi) & 1) ? color : 0; - - if(y*mc6845_tile_height < 400 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); - } - } - } - } - - return 0; -} - -WRITE8_MEMBER( b16_state::b16_pcg_w ) -{ - m_char_rom[offset] = data; - - m_gfxdecode->gfx(0)->mark_dirty(offset >> 4); -} - -static ADDRESS_MAP_START( b16_map, AS_PROGRAM, 16, b16_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00000, 0x9ffff ) AM_RAM // probably not all of it. - AM_RANGE( 0xa0000, 0xaffff ) AM_RAM // bitmap? - AM_RANGE( 0xb0000, 0xb7fff ) AM_RAM AM_SHARE("vram") // tvram - AM_RANGE( 0xb8000, 0xbbfff ) AM_WRITE8(b16_pcg_w,0x00ff) // pcg - AM_RANGE( 0xfc000, 0xfffff ) AM_ROM AM_REGION("ipl",0) -ADDRESS_MAP_END - -READ16_MEMBER( b16_state::vblank_r ) -{ - return ioport("SYSTEM")->read(); -} - -WRITE8_MEMBER( b16_state::b16_6845_address_w ) -{ - m_crtc_index = data; - m_mc6845->address_w(space,offset, data); -} - -WRITE8_MEMBER( b16_state::b16_6845_data_w ) -{ - m_crtc_vreg[m_crtc_index] = data; - m_mc6845->register_w(space, offset, data); -} - -/* -Pretty weird protocol, dunno what it is ... - -8a (06) W -(04) R -ff (04) W -(04) R -ff (04) W -36 (0e) W -ff (08) W -ff (08) W -06 (0e) W -(08) R -(08) R -36 (0e) W -40 (08) W -9c (08) W -76 (0e) W -ff (0a) W -ff (0a) W -46 (0e) W -(0a) R -(0a) R -76 (0e) W -1a (0a) W -00 (0a) W -b6 (0e) W -ff (0c) W -ff (0c) W -86 (0e) W -(0c) R -(0c) R -b6 (0e) W -34 (0c) W -00 (0c) W -36 (0e) W -b6 (0e) W -40 (08) W -9c (08) W -34 (0c) W -00 (0c) W -8a (06) W -06 (06) W -05 (06) W -*/ - -READ8_MEMBER( b16_state::unk_dev_r ) -{ - static int test; - - printf("(%02x) R\n",offset << 1); - - if(offset == 0x8/2 || offset == 0x0a/2 || offset == 0x0c/2) // quick hack - { - test^=1; - return test ? 0x9f : 0x92; - } - - return 0xff; -} - -WRITE8_MEMBER( b16_state::unk_dev_w ) -{ - printf("%02x (%02x) W\n",data,offset << 1); - -} - -static ADDRESS_MAP_START( b16_io, AS_IO, 16, b16_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x0f) AM_READWRITE8(unk_dev_r,unk_dev_w,0x00ff) // DMA device? - AM_RANGE(0x20, 0x21) AM_WRITE8(b16_6845_address_w,0x00ff) - AM_RANGE(0x22, 0x23) AM_WRITE8(b16_6845_data_w,0x00ff) - //0x79 bit 0 DSW? - AM_RANGE(0x80, 0x81) AM_READ(vblank_r) // TODO -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( b16 ) - PORT_START("SYSTEM") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") -INPUT_PORTS_END - - - - -static const gfx_layout b16_charlayout = -{ - 8, 16, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP8(0,1) }, - { STEP16(0,8) }, - 8*16 -}; - -static GFXDECODE_START( b16 ) - GFXDECODE_ENTRY( "pcg", 0x0000, b16_charlayout, 0, 1 ) -GFXDECODE_END - -void b16_state::machine_start() -{ - m_mc6845 = machine().device("crtc"); -} - -void b16_state::machine_reset() -{ -} - - -READ8_MEMBER(b16_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(b16_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.write_byte(offset, data); -} - - -static MACHINE_CONFIG_START( b16, b16_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8086, XTAL_14_31818MHz/2) //unknown xtal - MCFG_CPU_PROGRAM_MAP(b16_map) - MCFG_CPU_IO_MAP(b16_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(b16_state, screen_update) - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_14_31818MHz/5) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_DEVICE_ADD("8237dma", AM9517A, XTAL_14_31818MHz/2) - MCFG_I8237_IN_MEMR_CB(READ8(b16_state, memory_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(b16_state, memory_write_byte)) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", b16) - MCFG_PALETTE_ADD("palette", 8) -// MCFG_PALETTE_INIT_STANDARD(black_and_white) // TODO - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( b16 ) - ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x4000, CRC(7c1c93d5) SHA1(2a1e63a689c316ff836f21646166b38714a18e03) ) - - ROM_REGION( 0x4000/2, "pcg", ROMREGION_ERASE00 ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, b16, 0, 0, b16, b16, driver_device, 0, "Hitachi", "B16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/b2m.c b/src/mess/drivers/b2m.c deleted file mode 100644 index 99a3b03ccd6..00000000000 --- a/src/mess/drivers/b2m.c +++ /dev/null @@ -1,273 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Bashkiria-2M driver by Miodrag Milanovic - - 28/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "machine/i8255.h" -#include "machine/pic8259.h" -#include "machine/i8251.h" -#include "machine/wd_fdc.h" -#include "machine/ram.h" -#include "includes/b2m.h" -#include "formats/smx_dsk.h" - -/* Address maps */ -static ADDRESS_MAP_START(b2m_mem, AS_PROGRAM, 8, b2m_state ) - AM_RANGE (0x0000, 0x27ff) AM_RAMBANK("bank1") - AM_RANGE (0x2800, 0x2fff) AM_RAMBANK("bank2") - AM_RANGE (0x3000, 0x6fff) AM_RAMBANK("bank3") - AM_RANGE (0x7000, 0xdfff) AM_RAMBANK("bank4") - AM_RANGE (0xe000, 0xffff) AM_RAMBANK("bank5") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( b2m_io, AS_IO, 8, b2m_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1f) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w) - AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) - AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_device, read, write ) - AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("fd1793", fd1793_t, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( b2m_rom_io, AS_IO, 8, b2m_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1f) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_3", i8255_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w) - AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) - AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_device, read, write ) - AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( b2m ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('{') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('}') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('*') PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('&') PORT_CHAR('7') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('^') PORT_CHAR('6') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('%') PORT_CHAR('5') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('$') PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('#') PORT_CHAR('3') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('@') PORT_CHAR('2') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_CHAR('-') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('\'') PORT_CHAR(';') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('=') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('|') PORT_CHAR('\\') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(')') PORT_CHAR('0') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('(') PORT_CHAR('9') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rshift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LAlt") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LCtrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("???") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgdN") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("end") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('?') PORT_CHAR('/') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\"') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("LINE10") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("MONITOR") - PORT_CONFNAME(0x01, 0x01, "Monitor") - PORT_CONFSETTING( 0x01, "Color") - PORT_CONFSETTING( 0x00, "B/W") -INPUT_PORTS_END - -FLOPPY_FORMATS_MEMBER( b2m_state::b2m_floppy_formats ) - FLOPPY_SMX_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( b2m_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - - -/* Machine driver */ -static MACHINE_CONFIG_START( b2m, b2m_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(b2m_mem) - MCFG_CPU_IO_MAP(b2m_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", b2m_state, b2m_vblank_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(384, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(b2m_state, screen_update_b2m) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(b2m_state, b2m) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(b2m_state,bm2_pit_out1)) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pit8253", pit8253_device, write_clk0)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(b2m_state, b2m_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(b2m_state, b2m_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(b2m_state, b2m_8255_portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(b2m_state, b2m_8255_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_OUT_PORTC_CB(WRITE8(b2m_state, b2m_ext_8255_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_3", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(b2m_state, b2m_romdisk_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(b2m_state, b2m_romdisk_portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(b2m_state, b2m_romdisk_portc_w)) - - MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), VCC, NULL ) - - /* sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* uart */ - MCFG_DEVICE_ADD("uart", I8251, 0) - - MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(b2m_state, b2m_fdc_drq)) - - MCFG_FLOPPY_DRIVE_ADD("fd0", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd1", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","b2m") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( b2mrom, b2m ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(b2m_rom_io) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( b2m ) - ROM_REGION( 0x12000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "b2m.rom", 0x10000, 0x2000, CRC(3f3214d6) SHA1(dd93e7fbabf14d1aed6777fe1ccfe0a3ca8fcaf2) ) -ROM_END - -ROM_START( b2mrom ) - ROM_REGION( 0x22000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bios2.rom", 0x10000, 0x2000, CRC(c22a98b7) SHA1(7de91e653bf4b191ded62cf21532578268e4a2c1) ) - ROM_LOAD( "ramdos.sys", 0x12000, 0x60c0, CRC(91ed6df0) SHA1(4fd040f2647a6b7930c330c75560a035027d0606) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, b2m, 0, 0, b2m, b2m, b2m_state, b2m, "BNPO", "Bashkiria-2M", MACHINE_SUPPORTS_SAVE) -COMP( 1989, b2mrom, b2m, 0, b2mrom, b2m, b2m_state, b2m, "BNPO", "Bashkiria-2M ROM-disk", MACHINE_SUPPORTS_SAVE) diff --git a/src/mess/drivers/babbage.c b/src/mess/drivers/babbage.c deleted file mode 100644 index e89bd9b3e75..00000000000 --- a/src/mess/drivers/babbage.c +++ /dev/null @@ -1,278 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Babbage-2nd skeleton driver (19/OCT/2011) - - http://homepage3.nifty.com/takeda-toshiya/babbage/index.html - - Pasting: - 0-F : as is - INC : ^ - AD : - - DA : = - GO : X - - Here is a test program to turn on the LEDs. - Copy the text and Paste into the emulator. - =3E^=0F^=D3^=13^=3E^=07^=D3^=13^=3E^=00^=D3^=12^=76^-1000X - - ToDo: - - Blank the display if digits aren't being refreshed - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "cpu/z80/z80daisy.h" -#include "babbage.lh" - -#define MAIN_CLOCK 25e5 - -class babbage_state : public driver_device -{ -public: - babbage_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pio_1(*this, "z80pio_1"), - m_pio_2(*this, "z80pio_2"), - m_ctc(*this, "z80ctc") - { } - - required_device m_maincpu; - required_device m_pio_1; - required_device m_pio_2; - required_device m_ctc; - DECLARE_READ8_MEMBER(pio2_a_r); - DECLARE_WRITE8_MEMBER(pio1_b_w); - DECLARE_WRITE8_MEMBER(pio2_b_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); - UINT8 m_segment; - UINT8 m_key; - UINT8 m_prev_key; - bool m_step; - virtual void machine_reset(); - virtual void machine_start(); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); -}; - - - -/*************************************************************************** - - Machine - -***************************************************************************/ - -void babbage_state::machine_start() -{ -} - -void babbage_state::machine_reset() -{ -} - - - -/*************************************************************************** - - Address Map - -***************************************************************************/ - -static ADDRESS_MAP_START( babbage_map, AS_PROGRAM, 8, babbage_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3fff) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x1000, 0x17ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( babbage_io, AS_IO, 8, babbage_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) - AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80pio_2", z80pio_device, read_alt, write_alt) -ADDRESS_MAP_END - - - -/************************************************************************** - - Keyboard Layout - -***************************************************************************/ - -// no idea of the actual key matrix -static INPUT_PORTS_START( babbage ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INC") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') -INPUT_PORTS_END - -/* Z80-CTC Interface */ - -WRITE_LINE_MEMBER( babbage_state::ctc_z0_w ) -{ -} - -WRITE_LINE_MEMBER( babbage_state::ctc_z1_w ) -{ -} - -WRITE_LINE_MEMBER( babbage_state::ctc_z2_w ) -{ -} - -/* Z80-PIO Interface */ - -// The 8 LEDs -// bios never writes here - you need to set PIO for output yourself - see test program above -WRITE8_MEMBER( babbage_state::pio1_b_w ) -{ - char ledname[8]; - for (int i = 0; i < 8; i++) - { - sprintf(ledname,"led%d",i); - output_set_value(ledname, BIT(data, i)); - } -} - -READ8_MEMBER( babbage_state::pio2_a_r ) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); // release interrupt - return m_key; -} - -WRITE8_MEMBER( babbage_state::pio2_b_w ) -{ - if (BIT(data, 7)) - m_step = false; - else - if (!m_step) - { - m_segment = data; - m_step = true; - } - else - output_set_digit_value(data, m_segment); -} - -static const z80_daisy_config babbage_daisy_chain[] = -{// need to check the order - { "z80pio_1" }, - { "z80pio_2" }, - { "z80ctc" }, - { NULL } -}; - -TIMER_DEVICE_CALLBACK_MEMBER(babbage_state::keyboard_callback) -{ - UINT8 i, j, inp; - char kbdrow[6]; - UINT8 data = 0xff; - - for (i = 0; i < 4; i++) - { - sprintf(kbdrow,"X%X",i); - inp = ioport(kbdrow)->read(); - - for (j = 0; j < 5; j++) - if (BIT(inp, j)) - data = (j << 2) | i; - } - - /* make sure only one keystroke */ - if (data != m_prev_key) - m_prev_key = data; - else - data = 0xff; - - /* while key is down, activate strobe. When key released, deactivate strobe which causes an interrupt */ - if (data < 0xff) - { - m_key = data; - m_pio_2->strobe(0, 0); - } - else - m_pio_2->strobe(0, 1); -} - - -/*************************************************************************** - - Machine driver - -***************************************************************************/ - -static MACHINE_CONFIG_START( babbage, babbage_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, MAIN_CLOCK) //2.5MHz - MCFG_CPU_PROGRAM_MAP(babbage_map) - MCFG_CPU_IO_MAP(babbage_io) - MCFG_CPU_CONFIG(babbage_daisy_chain) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_babbage) - - /* Devices */ - MCFG_DEVICE_ADD("z80ctc", Z80CTC, MAIN_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(babbage_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(babbage_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(babbage_state, ctc_z2_w)) - - MCFG_DEVICE_ADD("z80pio_1", Z80PIO, MAIN_CLOCK) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(babbage_state, pio1_b_w)) - - MCFG_DEVICE_ADD("z80pio_2", Z80PIO, MAIN_CLOCK) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(babbage_state, pio2_a_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(babbage_state, pio2_b_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", babbage_state, keyboard_callback, attotime::from_hz(30)) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver - -***************************************************************************/ - -ROM_START(babbage) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD("mon.rom", 0x0000, 0x0200, CRC(469bd607) SHA1(8f3489a0f96de6a03b05c1ee01b89d9848f4b152) ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1986, babbage, 0, 0, babbage, babbage, driver_device, 0, "Mr Takafumi Aihara", "Babbage-2nd" , MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/banctec.c b/src/mess/drivers/banctec.c deleted file mode 100644 index 4a25e665b67..00000000000 --- a/src/mess/drivers/banctec.c +++ /dev/null @@ -1,133 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Felipe Sanches -/*************************************************************************** - This driver covers only the Operator Panel of the BancTec 91690 Document Processor equipment - - Author: Felipe Sanches - - Maintainence Manual: -*/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "cpu/m6805/m6805.h" -#include "includes/banctec.h" -#include "video/mc6845.h" - -static ADDRESS_MAP_START( banctec_mem , AS_PROGRAM, 8, banctec_state ) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0xffff) AM_RAM /* Probably wrong. Must be verified on pcb! */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( banctec_mcu_mem , AS_PROGRAM, 8, banctec_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x7fff) AM_RAM /* Probably wrong. Must be verified on pcb! */ - AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("videoram") /* Probably wrong. Must be verified on pcb! */ -ADDRESS_MAP_END - -void banctec_state::machine_reset() -{ -} - - -/**************************** -* Video/Character functions * -****************************/ - -TILE_GET_INFO_MEMBER(banctec_state::get_bg_tile_info) -{ - UINT8 *videoram = m_videoram; - int code = videoram[tile_index]; - int color = 1; - - SET_TILE_INFO_MEMBER(0, code, color, 0); -} - -void banctec_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(banctec_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 40, 25); -} - -UINT32 banctec_state::screen_update_banctec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - return 0; -} - -/* ROCKWELL 6545 - Transparent Memory Addressing */ - -MC6845_ON_UPDATE_ADDR_CHANGED(banctec_state::crtc_addr) -{ - /* What is this function meant to do ? */ -} - -/****************************** -* Graphics Decode Information * -******************************/ - -const gfx_layout banctec_gfx_layout = -{ - 8, 8, /* 8x8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {0, 1, 2, 3, 4, 5, 6, 7}, - {0 * 256*8, 1 * 256*8, 2 * 256*8, 3 * 256*8, 4 * 256*8, 5 * 256*8, 6 * 256*8, 7 * 256*8}, - 8 /* size of one char */ -}; - -static GFXDECODE_START( banctec ) - GFXDECODE_ENTRY( "gfx", 0x00000, banctec_gfx_layout, 0, 2 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( banctec, banctec_state ) - /* basic machine hardware */ - - MCFG_CPU_ADD("maincpu", I80C31, XTAL_11_0592MHz) - MCFG_CPU_PROGRAM_MAP(banctec_mem) - - MCFG_CPU_ADD("mcu", M6805, 4000000) /* Actual MCU is a Motorola 6803 and the clock frequency is still unknown */ - MCFG_CPU_PROGRAM_MAP(banctec_mcu_mem) - -// The video signal is generated by a R6545EAP character generator chip -// The U20 EPROM holds the image data for the character set. - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE((52+1)*8, (31+1)*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 25*8-1) - MCFG_SCREEN_UPDATE_DRIVER(banctec_state, screen_update_banctec) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", banctec) - MCFG_PALETTE_ADD("palette", 2) -// MCFG_PALETTE_INIT_OWNER(banctec_state, banctec) - - MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_20MHz) /* (?) */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_ADDR_CHANGED_CB(banctec_state, crtc_addr) - -MACHINE_CONFIG_END - -ROM_START(banctec) - ROM_REGION(0x800,"maincpu",0) - ROM_LOAD("banctec_eseries_panel_opnl.u20", 0x000, 0x800, CRC(c2ab9c06) SHA1(a296589034f656790ad5ffbce028dd846a40cf03)) - - ROM_REGION(0x2000,"mcu",0) - ROM_LOAD("banctec_eseries_panel.u8", 0x0000, 0x2000, CRC(f3335e0a) SHA1(5ca45fdcb7ef45a65c28c79abfa9ebb7a8a06619)) - - ROM_REGION(0x1000,"gfx",0) - ROM_LOAD("banctec_eseries_panel.u20", 0x0000, 0x1000, CRC(5b6ecec9) SHA1(35aff8f965bce77205e3a43d71e39097585091a7)) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT MONITOR COMPANY FULLNAME */ -CONS( 1989, banctec, 0, 0, banctec, 0, driver_device, 0, "DALE Electronics", "BancTec ESeries Panel", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/basic52.c b/src/mess/drivers/basic52.c deleted file mode 100644 index c8369c8b5c5..00000000000 --- a/src/mess/drivers/basic52.c +++ /dev/null @@ -1,158 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - MCS BASIC 52 and MCS BASIC 31 board - - 03/12/2009 Skeleton driver. - - 2012-08-08 Made to work [Robbbert] - -BASIC-52 is an official Intel release. - -BASIC-31 (and variants) as found on the below url, are homebrews. - -http://dsaprojects.110mb.com/electronics/8031-ah/8031-bas.html - - -The driver is working, however there are issues with the cpu serial code. -When started, you are supposed to press Space and the system works out -the baud rate and boots up. - -However, the way the cpu is written, it actually passes bytes around, so -the auto-speed detection doesn't work as intended. Also the cpu interface -is horribly outdated and needs to be brought up to date. - -So, as it stands, start the driver, then press d and g in turn until -something starts happening. Basic-52 usually starts at a very slow rate, -about 1 character per second, while Basic-31 is much faster. - -Once the system starts, all input must be in uppercase. Read the manual -to discover the special features of this Basic. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "machine/i8255.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class basic52_state : public driver_device -{ -public: - basic52_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(unk_r); - UINT8 m_term_data; - required_device m_maincpu; - required_device m_terminal; - virtual void machine_reset(); - DECLARE_WRITE8_MEMBER(to_term); - DECLARE_READ8_MEMBER(from_term); -}; - - -static ADDRESS_MAP_START(basic52_mem, AS_PROGRAM, 8, basic52_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x7fff) AM_RAM - //AM_RANGE(0x8000, 0x9fff) AM_ROM // EPROM - //AM_RANGE(0xc000, 0xdfff) // Expansion block - //AM_RANGE(0xe000, 0xffff) // Expansion block -ADDRESS_MAP_END - -static ADDRESS_MAP_START(basic52_io, AS_IO, 8, basic52_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0x9fff) AM_ROM // EPROM - AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // PPI-8255 - //AM_RANGE(0xc000, 0xdfff) // Expansion block - //AM_RANGE(0xe000, 0xffff) // Expansion block - AM_RANGE(0x20003, 0x20003) AM_READ(unk_r); -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( basic52 ) -INPUT_PORTS_END - -// won't compile unless these are static -WRITE8_MEMBER( basic52_state::to_term) -{ - m_terminal->write(space, 0, data); -} - -READ8_MEMBER(basic52_state::from_term) -{ - return m_term_data; -} - -READ8_MEMBER( basic52_state::unk_r) -{ - return m_term_data; // won't boot without this -} - -void basic52_state::machine_reset() -{ - m_maincpu->i8051_set_serial_tx_callback(write8_delegate(FUNC(basic52_state::to_term),this)); - m_maincpu->i8051_set_serial_rx_callback(read8_delegate(FUNC(basic52_state::from_term),this)); -} - -WRITE8_MEMBER( basic52_state::kbd_put ) -{ - m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); - m_maincpu->set_input_line(MCS51_RX_LINE, CLEAR_LINE); - m_term_data = data; -} - -static MACHINE_CONFIG_START( basic31, basic52_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8031, XTAL_11_0592MHz) - MCFG_CPU_PROGRAM_MAP(basic52_mem) - MCFG_CPU_IO_MAP(basic52_io) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(basic52_state, kbd_put)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( basic52, basic31 ) - /* basic machine hardware */ - MCFG_CPU_REPLACE("maincpu", I8052, XTAL_11_0592MHz) - MCFG_CPU_PROGRAM_MAP(basic52_mem) - MCFG_CPU_IO_MAP(basic52_io) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( basic52 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v11", "v 1.1") - ROMX_LOAD( "mcs-51-11.bin", 0x0000, 0x2000, CRC(4157b22b) SHA1(bd9e6869b400cc1c9b163243be7bdcf16ce72789), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v11b", "v 1.1b") - ROMX_LOAD( "mcs-51-11b.bin", 0x0000, 0x2000, CRC(a60383cc) SHA1(9515cc435e2ca3d3adb19631c03a62dfbeab0826), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v131", "v 1.3.1") - ROMX_LOAD( "mcs-51-131.bin", 0x0000, 0x2000, CRC(6a493162) SHA1(ed1079a6b4d4dbf448e15238c5a9e4dd004e401c), ROM_BIOS(3)) -ROM_END - -ROM_START( basic31 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v12", "v 1.2") - ROMX_LOAD( "mcs-51-12.bin", 0x0000, 0x2000, CRC(ee667c7c) SHA1(e69b32e69ecda2012c7113649634a3a64e984bed), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v12a", "v 1.2a") - ROMX_LOAD( "mcs-51-12a.bin", 0x0000, 0x2000, CRC(225bb2f0) SHA1(46e97643a7a5cb4c278f9e3c73d18cd93209f8bf), ROM_BIOS(2)) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, basic52, 0, 0, basic52, basic52, driver_device, 0, "Intel", "MCS BASIC 52", MACHINE_NO_SOUND_HW) -COMP( 1985, basic31, basic52, 0, basic31, basic52, driver_device, 0, "Intel", "MCS BASIC 31", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/bbc.c b/src/mess/drivers/bbc.c deleted file mode 100644 index d60964282ab..00000000000 --- a/src/mess/drivers/bbc.c +++ /dev/null @@ -1,1998 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Gordon Jefferyes, Nigel Barnes -/****************************************************************************** - BBC Model A,B - - ANA01 - Model A - ANA02 - Model A with Econet interface - - ANB01 - Model B - ANB02 - Model B with Econet interface - ANB03 - Model B with Disc interface - ANB04 - Model B with Disc and Econet interfaces - - GNB14 - Model B with Disc, Econet & Speech (German model) - UNB09 - Model B with Disc, Econet & Speech (US model) - - BBC Model B+ - - ANB51 - BBC Model B+ 64K - ANB52 - BBC Model B+ 64K with Econet - ANB53 - BBC Model B+ 64K with Disc interface - ANB54 - BBC Model B+ 64K with Disc and Econet interfaces - ANB55 - BBC Model B+ 128K with Disc interface - - BBC Master - - AMB15 - Master 128 - ADB12 - Master Econet Terminal - AVC12 - Master AIV - ARM1 - ARM Evaluation System - ADB20 - Master Compact - - - MESS Driver By: - - Gordon Jefferyes - mess_bbc@romvault.com - Nigel Barnes - ngbarnes@hotmail.com - -******************************************************************************/ - -/* Core includes */ -#include "emu.h" - -/* Components */ -#include "bus/rs232/rs232.h" -#include "cpu/m6502/m6502.h" -#include "cpu/m6502/m65sc02.h" -#include "machine/6522via.h" -#include "bus/centronics/ctronics.h" -#include "bus/econet/econet.h" -#include "sound/tms5220.h" /* Speech */ -#include "video/saa5050.h" /* Teletext */ -#include "bbc.lh" - -/* Devices */ -#include "imagedev/flopdrv.h" -#include "formats/bbc_dsk.h" -#include "imagedev/cassette.h" -#include "formats/uef_cas.h" -#include "formats/csw_cas.h" -#include "includes/bbc.h" - - -/****************************************************************************** -A = BBC Model A -B = BBC Model B -B+ = BBC Model B+ -M = BBC Master - - A B B+ M -+ &0000 + + + + -| | | | | -| &1000 | | | | -|1 | | |1 |1 -| &2000 |1 | | | -| | | | | -+ &3000 | | + + -|2 | | | | -+ &4000 + |1 | | -| | | | | -| &5000 | | | | -| | | |2 |2 -|3 &6000 |3 | | | -| | | | | -| &7000 | | | | -| | | | | -+ &8000 + + + + -|4 | | | |4 -+ &9000 | | | + -| | | |4 | -|5 &A000 |4 |4 | |5 -| | | | | -+ &B000 | | + | -|6 | | |6 | -+ &C000 + + + + -| | | | |7 -|7 &D000 | | | | -| | | | | -+ &E000 |7 |7 |7 + -| | | | | -|8 &F000 | | | |8 -| | | | | -+ &FC00 FRED + + + + - &FD00 JIM + + + + - &FE00 SHEILA + + + + -+ &FF00 + + + + -|9 |9 |9 |9 |9 -+ &FFFF + + + + - - - -&00-&07 6845 CRTC Video controller 8 ( 2 bytes x 4 ) 1MHz -&08-&0F 6850 ACIA Serial controller 8 ( 2 bytes x 4 ) 1MHz -&10-&17 Serial ULA Serial system chip 8 ( 1 byte x 8 ) 1MHz -&18-&1f INTOFF/STATID ECONET Interrupt Off / ID No. 8 ( 1 byte x 8 ) 1MHz -write: -&20-&2F Video ULA Video system chip 16 ( 2 bytes x 8 ) 2MHz -&30-&3F 74LS161 Paged ROM selector 16 ( 1 byte x 16 ) 2MHz -read: -&20-&2F INTON ECONET Interrupt On 16 ( 1 bytes x 16 ) 2MHz -&30-&3F Not Connected Not Connected 2MHz - -&40-&5F 6522 VIA SYSTEM VIA 32 (16 bytes x 2 ) 1MHz -&60-&7F 6522 VIA USER VIA 32 (16 bytes x 2 ) 1MHz -&80-&9F 8271 FDC FDC Floppy disc controller 32 ( 8 bytes x 4 ) 2MHz -&A0-&BF 68B54 ADLC ECONET controller 32 ( 4 bytes x 8 ) 2MHz -&C0-&DF uPD7002 Analogue to digital converter 32 ( 4 bytes x 8 ) 1MHz -&E0-&FF Tube ULA Tube system interface 32 (32 bytes x 1 ) 2MHz -******************************************************************************/ - -READ8_MEMBER(bbc_state::bbc_fe_r) -{ - return 0xfe; -} - -static ADDRESS_MAP_START( bbca_mem, AS_PROGRAM, 8, bbc_state ) - ADDRESS_MAP_UNMAP_HIGH /* Hardware marked with a # is not present in a Model A */ - - AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorya1_w) /* 0000-3fff Regular Ram */ - AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank3") AM_WRITE(bbc_memoryb3_w) /* 4000-7fff Repeat of the Regular Ram */ - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank4") AM_WRITE(bbc_memoryb4_w) /* 8000-bfff Paged ROM */ - AM_RANGE(0xc000, 0xfbff) AM_READ_BANK("bank7") /* c000-fbff OS ROM */ - AM_RANGE(0xfc00, 0xfdff) AM_NOP /* fc00-fdff FRED & JIM Pages */ - /* fe00-feff SHEILA Address Page */ - AM_RANGE(0xfe00, 0xfe00) AM_MIRROR(0x06) AM_DEVREADWRITE("mc6845", mc6845_device, status_r, address_w) /* fe00-fe07 6845 CRTC Video controller */ - AM_RANGE(0xfe01, 0xfe01) AM_MIRROR(0x06) AM_DEVREADWRITE("mc6845", mc6845_device, register_r, register_w) - AM_RANGE(0xfe08, 0xfe08) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_device, status_r, control_w) /* fe08-fe0F 6850 ACIA Serial controller */ - AM_RANGE(0xfe09, 0xfe09) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_device, data_r, data_w) - AM_RANGE(0xfe10, 0xfe17) AM_READWRITE(bbc_fe_r, bbc_SerialULA_w) /* fe10-fe17 Serial ULA Serial system chip */ - AM_RANGE(0xfe18, 0xfe1f) AM_NOP /* fe18-fe1f INTOFF/STATID # ECONET Interrupt Off / ID No. */ - AM_RANGE(0xfe20, 0xfe2f) AM_WRITE(bbc_videoULA_w) /* R: fe20-fe2f INTON # ECONET Interrupt On */ - /* W: fe20-fe2f Video ULA Video system chip */ - AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selecta_w) /* R: fe30-fe3f NC Not Connected */ - /* W: fe30-fe3f 84LS161 Paged ROM selector */ - AM_RANGE(0xfe40, 0xfe5f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) /* fe40-fe5f 6522 VIA SYSTEM VIA */ - AM_RANGE(0xfe60, 0xfe7f) AM_NOP /* fe60-fe7f 6522 VIA # USER VIA */ - AM_RANGE(0xfe80, 0xfe9f) AM_NOP /* fe80-fe9f 8271/1770 FDC # Floppy disc controller */ - AM_RANGE(0xfea0, 0xfebf) AM_READ(bbc_fe_r) /* fea0-febf 68B54 ADLC # ECONET controller */ - AM_RANGE(0xfec0, 0xfedf) AM_NOP /* fec0-fedf uPD7002 # Analogue to digital converter */ - AM_RANGE(0xfee0, 0xfeff) AM_READ(bbc_fe_r) /* fee0-feff Tube ULA # Tube system interface */ - AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("os", 0x3f00) /* ff00-ffff OS Rom (continued) */ -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( bbc_base, AS_PROGRAM, 8, bbc_state ) - ADDRESS_MAP_UNMAP_HIGH - - AM_RANGE(0xc000, 0xfbff) AM_READ_BANK("bank7") /* c000-fbff OS ROM */ - AM_RANGE(0xfc00, 0xfdff) AM_NOP /* fc00-fdff FRED & JIM Pages */ - /* fe00-feff SHEILA Address Page */ - AM_RANGE(0xfe00, 0xfe00) AM_MIRROR(0x06) AM_DEVREADWRITE("mc6845", mc6845_device, status_r, address_w) /* fe00-fe07 6845 CRTC Video controller */ - AM_RANGE(0xfe01, 0xfe01) AM_MIRROR(0x06) AM_DEVREADWRITE("mc6845", mc6845_device, register_r, register_w) - AM_RANGE(0xfe08, 0xfe08) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_device, status_r, control_w) /* fe08-fe0F 6850 ACIA Serial controller */ - AM_RANGE(0xfe09, 0xfe09) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_device, data_r, data_w) - AM_RANGE(0xfe10, 0xfe17) AM_READWRITE(bbc_fe_r, bbc_SerialULA_w) /* fe10-fe17 Serial ULA Serial system chip */ - AM_RANGE(0xfe18, 0xfe1f) AM_READ_PORT("S11") /* fe18-fe1f INTOFF/STATID ECONET Interrupt Off / ID No. */ - AM_RANGE(0xfe20, 0xfe2f) AM_WRITE(bbc_videoULA_w) /* R: fe20-fe2f INTON ECONET Interrupt On */ - /* W: fe20-fe2f Video ULA Video system chip */ - AM_RANGE(0xfe40, 0xfe5f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) /* fe40-fe5f 6522 VIA SYSTEM VIA */ - AM_RANGE(0xfe60, 0xfe7f) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) /* fe60-fe7f 6522 VIA USER VIA */ - /* fe80-fe9f FDC Floppy disc controller */ - AM_RANGE(0xfea0, 0xfebf) AM_READ(bbc_fe_r) /* fea0-febf 68B54 ADLC ECONET controller */ - AM_RANGE(0xfec0, 0xfedf) AM_DEVREADWRITE("upd7002", upd7002_device, read, write) /* fec0-fedf uPD7002 Analogue to digital converter */ - AM_RANGE(0xfee0, 0xfeff) AM_READ(bbc_fe_r) /* fee0-feff Tube ULA Tube system interface */ - AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("os", 0x3f00) /* ff00-ffff OS ROM (continued) */ -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( bbcb_mem, AS_PROGRAM, 8, bbc_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorya1_w) /* 0000-3fff Regular Ram */ - AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank3") AM_WRITE(bbc_memoryb3_w) /* 4000-7fff Regular Ram */ - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank4") AM_WRITE(bbc_memoryb4_w) /* 8000-bfff Paged ROM */ - AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectb_w) /* R: fe30-fe3f NC Not Connected */ - /* W: fe30-fe3f 84LS161 Paged ROM selector */ - AM_RANGE(0xfe80, 0xfe83) AM_DEVICE("i8271" , i8271_device, map) /* fe80-fe9f 8271 FDC Floppy disc controller */ - AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("i8271", i8271_device, data_r, data_w) /* fe80-fe9f 8271 FDC Floppy disc controller */ - AM_IMPORT_FROM(bbc_base) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(bbcb1770_mem, AS_PROGRAM, 8, bbc_state) - AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorya1_w) /* 0000-3fff Regular Ram */ - AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank3") AM_WRITE(bbc_memoryb3_w) /* 4000-7fff Regular Ram */ - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank4") AM_WRITE(bbc_memoryb4_w) /* 8000-bfff Paged ROM */ - AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectb_w) /* R: fe30-fe3f NC Not Connected */ - /* W: fe30-fe3f 84LS161 Paged ROM selector */ - AM_RANGE(0xfe80, 0xfe83) AM_WRITE(bbc_wd1770_status_w) /* fe80-fe83 1770 FDC Drive control register */ - AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("wd1770", wd1770_t, read, write) /* fe84-fe9f 1770 FDC Floppy disc controller */ - AM_IMPORT_FROM(bbc_base) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( bbcbp_mem, AS_PROGRAM, 8, bbc_state ) - AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorybp1_w) /* 0000-2fff Regular Ram */ - AM_RANGE(0x3000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE(bbc_memorybp2_w) /* 3000-7fff Video/Shadow Ram */ - AM_RANGE(0x8000, 0xafff) AM_READ_BANK("bank4") AM_WRITE(bbc_memorybp4_w) /* 8000-afff Paged ROM or 12K of SWRAM */ - AM_RANGE(0xb000, 0xbfff) AM_READ_BANK("bank6") /* b000-bfff Rest of paged ROM area */ - AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectbp_w) /* R: fe30-fe3f NC Not Connected */ - /* W: fe30-fe3f 84LS161 Paged ROM selector */ - AM_RANGE(0xfe80, 0xfe83) AM_WRITE(bbc_wd1770_status_w) /* fe80-fe83 1770 FDC Drive control register */ - AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("wd1770", wd1770_t, read, write) /* fe84-fe9f 1770 FDC Floppy disc controller */ - AM_IMPORT_FROM(bbc_base) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( bbcbp128_mem, AS_PROGRAM, 8, bbc_state ) - AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorybp1_w) /* 0000-2fff Regular Ram */ - AM_RANGE(0x3000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE(bbc_memorybp2_w) /* 3000-7fff Video/Shadow Ram */ - AM_RANGE(0x8000, 0xafff) AM_READ_BANK("bank4") AM_WRITE(bbc_memorybp4_128_w) /* 8000-afff Paged ROM or 12K of SWRAM */ - AM_RANGE(0xb000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE(bbc_memorybp6_128_w) /* b000-bfff Rest of paged ROM area */ - AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectbp_w) /* R: fe30-fe3f NC Not Connected */ - /* W: fe30-fe3f 84LS161 Paged ROM selector */ - AM_RANGE(0xfe80, 0xfe83) AM_WRITE(bbc_wd1770_status_w) /* fe80-fe83 1770 FDC Drive control register */ - AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("wd1770", wd1770_t, read, write) /* fe84-fe9f 1770 FDC Floppy disc controller */ - AM_IMPORT_FROM(bbc_base) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( reutapm_mem, AS_PROGRAM, 8, bbc_state ) - AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorybp1_w) /* 0000-2fff Regular Ram */ - AM_RANGE(0x3000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE(bbc_memorybp2_w) /* 3000-7fff Video/Shadow Ram */ - AM_RANGE(0x8000, 0xafff) AM_READ_BANK("bank4") AM_WRITE(bbc_memorybp4_w) /* 8000-afff Paged ROM or 12K of SWRAM */ - AM_RANGE(0xb000, 0xbfff) AM_READ_BANK("bank6") /* b000-bfff Rest of paged ROM area */ - AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectbp_w) /* R: fe30-fe3f NC Not Connected */ - /* W: fe30-fe3f 84LS161 Paged ROM selector */ - AM_RANGE(0xfe80, 0xfe83) AM_NOP /* fe80-fe83 1770 FDC Drive control register */ - AM_RANGE(0xfe84, 0xfe9f) AM_NOP /* fe84-fe9f 1770 FDC Floppy disc controller */ - AM_IMPORT_FROM(bbc_base) -ADDRESS_MAP_END - -/****************************************************************************** -&FC00-&FCFF FRED -&FD00-&FDFF JIM -&FE00-&FEFF SHEILA Read Write -&00-&07 6845 CRTC Video controller Video Controller 8 ( 2 bytes x 4 ) -&08-&0F 6850 ACIA Serial controller Serial Controller 8 ( 2 bytes x 4 ) -&10-&17 Serial ULA - Serial system chip 8 ( 1 byte x 8 ) -&18-&1F uPD7002 A to D converter A to D converter 8 ( 4 bytes x 2 ) - -&20-&23 Video ULA - Video system chip 4 ( 2 bytes x 2 ) -&24-&27 FDC Latch 1770 Control latch 1770 Control latch 4 ( 1 byte x 4 ) -&28-&2F 1770 registers 1770 Disc Controller 1770 Disc Controller 8 ( 4 bytes x 2 ) -&30-&33 ROMSEL - ROM Select 4 ( 1 byte x 4 ) -&34-&37 ACCCON ACCCON select reg. ACCCON select reg 4 ( 1 byte x 4 ) -&38-&3F NC - - -&40-&5F 6522 VIA SYSTEM VIA SYSTEM VIA 32 (16 bytes x 2 ) 1MHz -&60-&7F 6522 VIA USER VIA USER VIA 32 (16 bytes x 2 ) 1MHz -&80-&9F Int. Modem Int. Modem Int Modem -&A0-&BF 68B54 ADLC ECONET controller ECONET controller 32 ( 4 bytes x 8 ) 2MHz -&C0-&DF NC - - -&E0-&FF Tube ULA Tube system interface Tube system interface 32 (32 bytes x 1 ) 2MHz -******************************************************************************/ - - -static ADDRESS_MAP_START(bbcm_mem, AS_PROGRAM, 8, bbc_state ) - AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bank1") AM_WRITE(bbc_memorybm1_w) /* 0000-2fff Regular Ram */ - AM_RANGE(0x3000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE(bbc_memorybm2_w) /* 3000-7fff Video/Shadow Ram */ - AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bank4") AM_WRITE(bbc_memorybm4_w) /* 8000-8fff Paged ROM/RAM or 4K of RAM ANDY */ - AM_RANGE(0x9000, 0xbfff) AM_READ_BANK("bank5") AM_WRITE(bbc_memorybm5_w) /* 9000-bfff Rest of paged ROM/RAM area */ - AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank7") AM_WRITE(bbc_memorybm7_w) /* c000-dfff OS ROM or 8K of RAM HAZEL */ - AM_RANGE(0xe000, 0xfbff) AM_ROM AM_REGION("os", 0x2000) /* e000-fbff OS ROM */ - AM_RANGE(0xfc00, 0xfeff) AM_READ_BANK("bank8") AM_WRITE(bbcm_w) /* processed directly because it can be ROM or hardware */ - AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("os", 0x3f00) /* ff00-ffff OS ROM (continued) */ -ADDRESS_MAP_END - - -static const rgb_t bbc_palette[8]= -{ - rgb_t(0x0ff,0x0ff,0x0ff), - rgb_t(0x000,0x0ff,0x0ff), - rgb_t(0x0ff,0x000,0x0ff), - rgb_t(0x000,0x000,0x0ff), - rgb_t(0x0ff,0x0ff,0x000), - rgb_t(0x000,0x0ff,0x000), - rgb_t(0x0ff,0x000,0x000), - rgb_t(0x000,0x000,0x000) -}; - -PALETTE_INIT_MEMBER(bbc_state, bbc) -{ - palette.set_pen_colors(0, bbc_palette, ARRAY_LENGTH(bbc_palette)); -} - - -INPUT_CHANGED_MEMBER(bbc_state::trigger_reset) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - - -/* Port Key description Emulated key Natural key Shift 1 Shift 2 (Ctrl) */ - -static INPUT_PORTS_START(bbc_keyboard) - PORT_START("COL0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFTLOCK") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESCAPE") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("COL1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("COL2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("COL3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("COL4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \\") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("COL5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("COL6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("COL7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - - PORT_START("COL8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_ \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') PORT_CHAR('\xA3') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') - - PORT_START("COL9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("BRK") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_CHANGED_MEMBER(DEVICE_SELF, bbc_state, trigger_reset, 0) - - /* Keyboard columns 10 -> 12 are reserved for BBC Master */ - PORT_START("COL10") - PORT_START("COL11") - PORT_START("COL12") - - PORT_START("IN0") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) -INPUT_PORTS_END - - -static INPUT_PORTS_START(bbc_keypad) - PORT_MODIFY("COL10") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad /") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad #") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - - PORT_MODIFY("COL11") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad DELETE") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - - PORT_MODIFY("COL12") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad RETURN") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_STOP) PORT_CHAR(UCHAR_MAMEKEY(STOP)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(UCHAR_MAMEKEY(COMMA)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) -INPUT_PORTS_END - - -static INPUT_PORTS_START(bbc_dipswitch) - PORT_MODIFY("COL2") - PORT_DIPNAME(0x01, 0x01, "Default File System") PORT_DIPLOCATION("KBD:1") - PORT_DIPSETTING( 0x00, "NFS" ) - PORT_DIPSETTING( 0x01, "DFS" ) - - PORT_MODIFY("COL3") - PORT_DIPNAME(0x01, 0x01, "Not Used") PORT_DIPLOCATION("KBD:2") - PORT_DIPSETTING( 0x00, DEF_STR( Off )) - PORT_DIPSETTING( 0x01, DEF_STR( On )) - - PORT_MODIFY("COL4") - PORT_DIPNAME(0x01, 0x01, "Disc Timings") PORT_DIPLOCATION("KBD:3") - PORT_DIPSETTING( 0x00, DEF_STR( Off )) - PORT_DIPSETTING( 0x01, DEF_STR( On )) - - PORT_MODIFY("COL5") - PORT_DIPNAME(0x01, 0x01, "Disc Timings") PORT_DIPLOCATION("KBD:4") - PORT_DIPSETTING( 0x00, DEF_STR( Off )) - PORT_DIPSETTING( 0x01, DEF_STR( On )) - - PORT_MODIFY("COL6") - PORT_DIPNAME(0x01, 0x01, "Boot") PORT_DIPLOCATION("KBD:5") - PORT_DIPSETTING( 0x00, "SHIFT" ) - PORT_DIPSETTING( 0x01, "SHIFT-BREAK" ) - - PORT_MODIFY("COL7") - PORT_DIPNAME(0x01, 0x01, "Screen Mode") PORT_DIPLOCATION("KBD:6") - PORT_DIPSETTING( 0x00, "+0" ) - PORT_DIPSETTING( 0x01, "+4" ) - - PORT_MODIFY("COL8") - PORT_DIPNAME(0x01, 0x01, "Screen Mode") PORT_DIPLOCATION("KBD:7") - PORT_DIPSETTING( 0x00, "+0" ) - PORT_DIPSETTING( 0x01, "+2" ) - - PORT_MODIFY("COL9") - PORT_DIPNAME(0x01, 0x01, "Screen Mode") PORT_DIPLOCATION("KBD:8") - PORT_DIPSETTING( 0x00, "+0" ) - PORT_DIPSETTING( 0x01, "+1" ) -INPUT_PORTS_END - - -static INPUT_PORTS_START(bbc_links) - PORT_START("S11") - PORT_DIPNAME(0xff, 0xfe, "Econet ID") PORT_DIPLOCATION("S11:1,2,3,4,5,6,7,8") - PORT_DIPSETTING( 0x00, "0" ) PORT_DIPSETTING( 0x01, "1" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x03, "3" ) PORT_DIPSETTING( 0x04, "4" ) - PORT_DIPSETTING( 0x05, "5" ) PORT_DIPSETTING( 0x06, "6" ) PORT_DIPSETTING( 0x07, "7" ) PORT_DIPSETTING( 0x08, "8" ) PORT_DIPSETTING( 0x09, "9" ) - PORT_DIPSETTING( 0x0a, "10" ) PORT_DIPSETTING( 0x0b, "11" ) PORT_DIPSETTING( 0x0c, "12" ) PORT_DIPSETTING( 0x0d, "13" ) PORT_DIPSETTING( 0x0e, "14" ) - PORT_DIPSETTING( 0x0f, "15" ) PORT_DIPSETTING( 0x10, "16" ) PORT_DIPSETTING( 0x11, "17" ) PORT_DIPSETTING( 0x12, "18" ) PORT_DIPSETTING( 0x13, "19" ) - PORT_DIPSETTING( 0x14, "20" ) PORT_DIPSETTING( 0x15, "21" ) PORT_DIPSETTING( 0x16, "22" ) PORT_DIPSETTING( 0x17, "23" ) PORT_DIPSETTING( 0x18, "24" ) - PORT_DIPSETTING( 0x19, "25" ) PORT_DIPSETTING( 0x1a, "26" ) PORT_DIPSETTING( 0x1b, "27" ) PORT_DIPSETTING( 0x1c, "28" ) PORT_DIPSETTING( 0x1d, "29" ) - PORT_DIPSETTING( 0x1e, "30" ) PORT_DIPSETTING( 0x1f, "31" ) PORT_DIPSETTING( 0x20, "32" ) PORT_DIPSETTING( 0x21, "33" ) PORT_DIPSETTING( 0x22, "34" ) - PORT_DIPSETTING( 0x23, "35" ) PORT_DIPSETTING( 0x24, "36" ) PORT_DIPSETTING( 0x25, "37" ) PORT_DIPSETTING( 0x26, "38" ) PORT_DIPSETTING( 0x27, "39" ) - PORT_DIPSETTING( 0x28, "40" ) PORT_DIPSETTING( 0x29, "41" ) PORT_DIPSETTING( 0x2a, "42" ) PORT_DIPSETTING( 0x2b, "43" ) PORT_DIPSETTING( 0x2c, "44" ) - PORT_DIPSETTING( 0x2d, "45" ) PORT_DIPSETTING( 0x2e, "46" ) PORT_DIPSETTING( 0x2f, "47" ) PORT_DIPSETTING( 0x30, "48" ) PORT_DIPSETTING( 0x31, "49" ) - PORT_DIPSETTING( 0x32, "50" ) PORT_DIPSETTING( 0x33, "51" ) PORT_DIPSETTING( 0x34, "52" ) PORT_DIPSETTING( 0x35, "53" ) PORT_DIPSETTING( 0x36, "54" ) - PORT_DIPSETTING( 0x37, "15" ) PORT_DIPSETTING( 0x38, "56" ) PORT_DIPSETTING( 0x39, "57" ) PORT_DIPSETTING( 0x3a, "58" ) PORT_DIPSETTING( 0x3b, "59" ) - PORT_DIPSETTING( 0x3c, "60" ) PORT_DIPSETTING( 0x3d, "61" ) PORT_DIPSETTING( 0x3e, "62" ) PORT_DIPSETTING( 0x3f, "63" ) PORT_DIPSETTING( 0x40, "64" ) - PORT_DIPSETTING( 0x41, "65" ) PORT_DIPSETTING( 0x42, "66" ) PORT_DIPSETTING( 0x43, "67" ) PORT_DIPSETTING( 0x44, "68" ) PORT_DIPSETTING( 0x45, "69" ) - PORT_DIPSETTING( 0x46, "70" ) PORT_DIPSETTING( 0x47, "71" ) PORT_DIPSETTING( 0x48, "72" ) PORT_DIPSETTING( 0x49, "73" ) PORT_DIPSETTING( 0x4a, "74" ) - PORT_DIPSETTING( 0x4b, "75" ) PORT_DIPSETTING( 0x4c, "76" ) PORT_DIPSETTING( 0x4d, "77" ) PORT_DIPSETTING( 0x4e, "78" ) PORT_DIPSETTING( 0x4f, "79" ) - PORT_DIPSETTING( 0x50, "80" ) PORT_DIPSETTING( 0x51, "81" ) PORT_DIPSETTING( 0x52, "82" ) PORT_DIPSETTING( 0x53, "83" ) PORT_DIPSETTING( 0x54, "84" ) - PORT_DIPSETTING( 0x55, "85" ) PORT_DIPSETTING( 0x56, "86" ) PORT_DIPSETTING( 0x57, "87" ) PORT_DIPSETTING( 0x58, "88" ) PORT_DIPSETTING( 0x59, "89" ) - PORT_DIPSETTING( 0x5a, "90" ) PORT_DIPSETTING( 0x5b, "91" ) PORT_DIPSETTING( 0x5c, "92" ) PORT_DIPSETTING( 0x5d, "93" ) PORT_DIPSETTING( 0x5e, "94" ) - PORT_DIPSETTING( 0x5f, "95" ) PORT_DIPSETTING( 0x60, "96" ) PORT_DIPSETTING( 0x61, "97" ) PORT_DIPSETTING( 0x62, "98" ) PORT_DIPSETTING( 0x63, "99" ) - PORT_DIPSETTING( 0x64, "100" ) PORT_DIPSETTING( 0x65, "101" ) PORT_DIPSETTING( 0x66, "102" ) PORT_DIPSETTING( 0x67, "103" ) PORT_DIPSETTING( 0x68, "104" ) - PORT_DIPSETTING( 0x69, "105" ) PORT_DIPSETTING( 0x6a, "106" ) PORT_DIPSETTING( 0x6b, "107" ) PORT_DIPSETTING( 0x6c, "108" ) PORT_DIPSETTING( 0x6d, "109" ) - PORT_DIPSETTING( 0x6e, "110" ) PORT_DIPSETTING( 0x6f, "111" ) PORT_DIPSETTING( 0x70, "112" ) PORT_DIPSETTING( 0x71, "113" ) PORT_DIPSETTING( 0x72, "114" ) - PORT_DIPSETTING( 0x73, "115" ) PORT_DIPSETTING( 0x74, "116" ) PORT_DIPSETTING( 0x75, "117" ) PORT_DIPSETTING( 0x76, "118" ) PORT_DIPSETTING( 0x77, "119" ) - PORT_DIPSETTING( 0x78, "120" ) PORT_DIPSETTING( 0x79, "121" ) PORT_DIPSETTING( 0x7a, "122" ) PORT_DIPSETTING( 0x7b, "123" ) PORT_DIPSETTING( 0x7c, "124" ) - PORT_DIPSETTING( 0x7d, "125" ) PORT_DIPSETTING( 0x7e, "126" ) PORT_DIPSETTING( 0x7f, "127" ) PORT_DIPSETTING( 0x80, "128" ) PORT_DIPSETTING( 0x81, "129" ) - PORT_DIPSETTING( 0x82, "130" ) PORT_DIPSETTING( 0x83, "131" ) PORT_DIPSETTING( 0x84, "132" ) PORT_DIPSETTING( 0x85, "133" ) PORT_DIPSETTING( 0x86, "134" ) - PORT_DIPSETTING( 0x87, "135" ) PORT_DIPSETTING( 0x88, "136" ) PORT_DIPSETTING( 0x89, "137" ) PORT_DIPSETTING( 0x8a, "138" ) PORT_DIPSETTING( 0x8b, "139" ) - PORT_DIPSETTING( 0x8c, "140" ) PORT_DIPSETTING( 0x8d, "141" ) PORT_DIPSETTING( 0x8e, "142" ) PORT_DIPSETTING( 0x8f, "143" ) PORT_DIPSETTING( 0x90, "144" ) - PORT_DIPSETTING( 0x91, "145" ) PORT_DIPSETTING( 0x92, "146" ) PORT_DIPSETTING( 0x93, "147" ) PORT_DIPSETTING( 0x94, "148" ) PORT_DIPSETTING( 0x95, "149" ) - PORT_DIPSETTING( 0x96, "150" ) PORT_DIPSETTING( 0x97, "151" ) PORT_DIPSETTING( 0x98, "152" ) PORT_DIPSETTING( 0x99, "153" ) PORT_DIPSETTING( 0x9a, "154" ) - PORT_DIPSETTING( 0x9b, "155" ) PORT_DIPSETTING( 0x9c, "156" ) PORT_DIPSETTING( 0x9d, "157" ) PORT_DIPSETTING( 0x9e, "158" ) PORT_DIPSETTING( 0x9f, "159" ) - PORT_DIPSETTING( 0xa0, "160" ) PORT_DIPSETTING( 0xa1, "161" ) PORT_DIPSETTING( 0xa2, "162" ) PORT_DIPSETTING( 0xa3, "163" ) PORT_DIPSETTING( 0xa4, "164" ) - PORT_DIPSETTING( 0xa5, "165" ) PORT_DIPSETTING( 0xa6, "166" ) PORT_DIPSETTING( 0xa7, "167" ) PORT_DIPSETTING( 0xa8, "168" ) PORT_DIPSETTING( 0xa9, "169" ) - PORT_DIPSETTING( 0xaa, "170" ) PORT_DIPSETTING( 0xab, "171" ) PORT_DIPSETTING( 0xac, "172" ) PORT_DIPSETTING( 0xad, "173" ) PORT_DIPSETTING( 0xae, "174" ) - PORT_DIPSETTING( 0xaf, "175" ) PORT_DIPSETTING( 0xb0, "176" ) PORT_DIPSETTING( 0xb1, "177" ) PORT_DIPSETTING( 0xb2, "178" ) PORT_DIPSETTING( 0xb3, "179" ) - PORT_DIPSETTING( 0xb4, "180" ) PORT_DIPSETTING( 0xb5, "181" ) PORT_DIPSETTING( 0xb6, "182" ) PORT_DIPSETTING( 0xb7, "183" ) PORT_DIPSETTING( 0xb8, "184" ) - PORT_DIPSETTING( 0xb9, "185" ) PORT_DIPSETTING( 0xba, "186" ) PORT_DIPSETTING( 0xbb, "187" ) PORT_DIPSETTING( 0xbc, "188" ) PORT_DIPSETTING( 0xbd, "189" ) - PORT_DIPSETTING( 0xbe, "190" ) PORT_DIPSETTING( 0xbf, "191" ) PORT_DIPSETTING( 0xc0, "192" ) PORT_DIPSETTING( 0xc1, "193" ) PORT_DIPSETTING( 0xc2, "194" ) - PORT_DIPSETTING( 0xc3, "195" ) PORT_DIPSETTING( 0xc4, "196" ) PORT_DIPSETTING( 0xc5, "197" ) PORT_DIPSETTING( 0xc6, "198" ) PORT_DIPSETTING( 0xc7, "199" ) - PORT_DIPSETTING( 0xc8, "200" ) PORT_DIPSETTING( 0xc9, "201" ) PORT_DIPSETTING( 0xca, "202" ) PORT_DIPSETTING( 0xcb, "203" ) PORT_DIPSETTING( 0xcc, "204" ) - PORT_DIPSETTING( 0xcd, "205" ) PORT_DIPSETTING( 0xce, "206" ) PORT_DIPSETTING( 0xcf, "207" ) PORT_DIPSETTING( 0xd0, "208" ) PORT_DIPSETTING( 0xd1, "209" ) - PORT_DIPSETTING( 0xd2, "210" ) PORT_DIPSETTING( 0xd3, "211" ) PORT_DIPSETTING( 0xd4, "212" ) PORT_DIPSETTING( 0xd5, "213" ) PORT_DIPSETTING( 0xd6, "214" ) - PORT_DIPSETTING( 0xd7, "215" ) PORT_DIPSETTING( 0xd8, "216" ) PORT_DIPSETTING( 0xd9, "217" ) PORT_DIPSETTING( 0xda, "218" ) PORT_DIPSETTING( 0xdb, "219" ) - PORT_DIPSETTING( 0xdc, "220" ) PORT_DIPSETTING( 0xdd, "221" ) PORT_DIPSETTING( 0xde, "222" ) PORT_DIPSETTING( 0xdf, "223" ) PORT_DIPSETTING( 0xe0, "224" ) - PORT_DIPSETTING( 0xe1, "225" ) PORT_DIPSETTING( 0xe2, "226" ) PORT_DIPSETTING( 0xe3, "227" ) PORT_DIPSETTING( 0xe4, "228" ) PORT_DIPSETTING( 0xe5, "229" ) - PORT_DIPSETTING( 0xe6, "230" ) PORT_DIPSETTING( 0xe7, "231" ) PORT_DIPSETTING( 0xe8, "232" ) PORT_DIPSETTING( 0xe9, "233" ) PORT_DIPSETTING( 0xea, "234" ) - PORT_DIPSETTING( 0xeb, "235" ) PORT_DIPSETTING( 0xec, "236" ) PORT_DIPSETTING( 0xed, "237" ) PORT_DIPSETTING( 0xee, "238" ) PORT_DIPSETTING( 0xef, "239" ) - PORT_DIPSETTING( 0xf0, "240" ) PORT_DIPSETTING( 0xf1, "241" ) PORT_DIPSETTING( 0xf2, "242" ) PORT_DIPSETTING( 0xf3, "243" ) PORT_DIPSETTING( 0xf4, "244" ) - PORT_DIPSETTING( 0xf5, "245" ) PORT_DIPSETTING( 0xf6, "246" ) PORT_DIPSETTING( 0xf7, "247" ) PORT_DIPSETTING( 0xf8, "248" ) PORT_DIPSETTING( 0xf9, "249" ) - PORT_DIPSETTING( 0xfa, "250" ) PORT_DIPSETTING( 0xfb, "251" ) PORT_DIPSETTING( 0xfc, "252" ) PORT_DIPSETTING( 0xfd, "253" ) PORT_DIPSETTING( 0xfe, "254" ) - PORT_DIPSETTING( 0xff, "255" ) -INPUT_PORTS_END - - -static INPUT_PORTS_START(bbc_joy) - PORT_START("JOY0") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(1) - - PORT_START("JOY1") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(1) - - PORT_START("JOY2") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(2) - - PORT_START("JOY3") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(2) -INPUT_PORTS_END - - -static INPUT_PORTS_START(bbc_config) - PORT_START("BBCCONFIG") - - PORT_CONFNAME( 0x01, 0x00, "Speech Upgrade" ) - PORT_CONFSETTING( 0x00, DEF_STR( On ) ) - PORT_CONFSETTING( 0x01, DEF_STR( Off ) ) - - PORT_CONFNAME( 0x18, 0x00, "Sideways RAM Type" ) - PORT_CONFSETTING( 0x00, DEF_STR( None ) ) - PORT_CONFSETTING( 0x08, "Solidisk 128K (fe62)" ) - PORT_CONFSETTING( 0x10, "Acorn 64K (fe30)" ) - PORT_CONFSETTING( 0x18, "Acorn 128K (fe30)" ) -// PORT_CONFSETTING( 0x20, "ATPL Sidewise 16K" ) -INPUT_PORTS_END - -static INPUT_PORTS_START(bbca) - PORT_INCLUDE(bbc_keyboard) - PORT_INCLUDE(bbc_dipswitch) -INPUT_PORTS_END - -static INPUT_PORTS_START(bbcb) - PORT_INCLUDE(bbc_config) - PORT_INCLUDE(bbc_keyboard) - PORT_INCLUDE(bbc_dipswitch) - PORT_INCLUDE(bbc_links) - PORT_INCLUDE(bbc_joy) -INPUT_PORTS_END - -static INPUT_PORTS_START(abc) - PORT_INCLUDE(bbc_keyboard) - PORT_INCLUDE(bbc_keypad) - PORT_INCLUDE(bbc_dipswitch) - PORT_INCLUDE(bbc_links) - PORT_INCLUDE(bbc_joy) -INPUT_PORTS_END - -static INPUT_PORTS_START(bbcm) - PORT_INCLUDE(bbc_keyboard) - PORT_INCLUDE(bbc_keypad) - PORT_INCLUDE(bbc_joy) -INPUT_PORTS_END - - -INTERRUPT_GEN_MEMBER(bbc_state::bbcb_vsync) -{ - via6522_device *via_0 = machine().device("via6522_0"); - via_0->write_ca1(1); - via_0->write_ca1(0); -} - - -WRITE_LINE_MEMBER(bbc_state::bbcb_acia6850_irq_w) -{ - m_acia_irq = state; - - check_interrupts(); -} - - -FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_525sd ) - FLOPPY_BBC_SSD_525_FORMAT, - FLOPPY_BBC_DSD_525_FORMAT -FLOPPY_FORMATS_END - -FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_525dd ) - FLOPPY_BBC_SSD_525_FORMAT, - FLOPPY_BBC_DSD_525_FORMAT, - FLOPPY_BBC_ADF_525_FORMAT -FLOPPY_FORMATS_END - -FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_35dd ) - FLOPPY_BBC_ADF_35_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( bbc_floppies_525 ) - SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) - SLOT_INTERFACE("sd", FLOPPY_525_SD) - SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) - SLOT_INTERFACE("dd", FLOPPY_525_DD) - SLOT_INTERFACE("ssqd", FLOPPY_525_SSQD) - SLOT_INTERFACE("qd", FLOPPY_525_QD) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START( bbc_floppies_35 ) - SLOT_INTERFACE("qd", FLOPPY_35_DD) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER(bbc_state::econet_clk_w) -{ - m_adlc->rxc_w(state); - m_adlc->txc_w(state); -} - -// 4 x EPROM sockets (16K) in BBC-A, these should grow to 16 for BBC-B and later... -static MACHINE_CONFIG_FRAGMENT( bbc_eprom_sockets ) - MCFG_GENERIC_SOCKET_ADD("exp_rom1", generic_linear_slot, "bbc_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(bbc_state, exp1_load) - - MCFG_GENERIC_SOCKET_ADD("exp_rom2", generic_linear_slot, "bbc_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(bbc_state, exp2_load) - - MCFG_GENERIC_SOCKET_ADD("exp_rom3", generic_linear_slot, "bbc_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(bbc_state, exp3_load) - - MCFG_GENERIC_SOCKET_ADD("exp_rom4", generic_linear_slot, "bbc_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(bbc_state, exp4_load) -MACHINE_CONFIG_END - - -/*************************************************************************** - - BBC Micro - -****************************************************************************/ - - -static MACHINE_CONFIG_START( bbca, bbc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 2000000) /* 2.00 MHz */ - MCFG_CPU_PROGRAM_MAP(bbca_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", bbc_state, bbcb_vsync) /* screen refresh interrupts */ - MCFG_CPU_PERIODIC_INT_DRIVER(bbc_state, bbcb_keyscan, 1000) /* scan keyboard */ - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K") - MCFG_RAM_DEFAULT_VALUE(0x00) - - MCFG_MACHINE_START_OVERRIDE(bbc_state, bbca) - MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbca) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(640, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 256-1) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(128)) - MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update) - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(bbc_state,bbc) - - MCFG_DEVICE_ADD("saa5050", SAA5050, XTAL_12MHz/2) - MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) - - /* crtc */ - MCFG_MC6845_ADD("mc6845", MC6845, "screen", 2000000) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(bbc_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(bbc_state, bbc_vsync)) - - MCFG_VIDEO_START_OVERRIDE(bbc_state, bbca) - - MCFG_DEFAULT_LAYOUT(layout_bbc) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("sn76489", SN76489, 4000000) /* 4 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(bbc_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("bbc_cass") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_ls_a", "bbca_cass") - - /* acia */ - MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(bbc_state, bbc_txd_w)) - MCFG_ACIA6850_RTS_HANDLER(WRITELINE(bbc_state, bbc_rts_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_acia6850_irq_w)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(WRITELINE(bbc_state, write_rxd_serial)) - MCFG_RS232_DCD_HANDLER(WRITELINE(bbc_state, write_dcd_serial)) - MCFG_RS232_CTS_HANDLER(WRITELINE(bbc_state, write_cts_serial)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, XTAL_16MHz / 13) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bbc_state, write_acia_clock)) - - /* system via */ - MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) - MCFG_VIA6522_READPA_HANDLER(READ8(bbc_state, bbcb_via_system_read_porta)) - MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_system_read_portb)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(bbc_state, bbcb_via_system_write_porta)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_system_write_portb)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_system_irq_w)) - - /* EPROM sockets */ - MCFG_FRAGMENT_ADD(bbc_eprom_sockets) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcb, bbca ) - /* basic machine hardware */ - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(bbcb_mem) - - MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcb) - MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcb) - MCFG_VIDEO_START_OVERRIDE(bbc_state, bbcb) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_DEFAULT_VALUE(0x00) - - /* speech hardware */ - MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) - MCFG_SOUND_ADD("tms5220", TMS5220, 640000) - MCFG_TMS52XX_SPEECHROM("vsm") - - /* user via */ - MCFG_DEVICE_ADD("via6522_1", VIA6522, 1000000) - MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_user_read_portb)) - MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_user_write_portb)) - MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_user_irq_w)) - - /* adc */ - MCFG_DEVICE_ADD("upd7002", UPD7002, 0) - MCFG_UPD7002_GET_ANALOGUE_CB(bbc_state, BBC_get_analogue_input) - MCFG_UPD7002_EOC_CB(bbc_state, BBC_uPD7002_EOC) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522_1", via6522_device, write_ca1)) MCFG_DEVCB_INVERT /* ack seems to be inverted? */ - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* fdc */ - MCFG_DEVICE_ADD("i8271" , I8271 , 0) - MCFG_I8271_IRQ_CALLBACK(WRITELINE(bbc_state, bbc_i8271_interrupt)) - MCFG_I8271_HDL_CALLBACK(WRITELINE(bbc_state, motor_w)) - MCFG_FLOPPY_DRIVE_ADD("i8271:0", bbc_floppies_525, "qd", bbc_state::floppy_formats_525sd) - MCFG_FLOPPY_DRIVE_ADD("i8271:1", bbc_floppies_525, "qd", bbc_state::floppy_formats_525sd) - - /* software lists */ - MCFG_DEVICE_REMOVE("cass_ls_a") - MCFG_SOFTWARE_LIST_ADD("cass_ls_b", "bbcb_cass") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_a", "bbca_cass") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED(bbcb1770, bbcb) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(bbcb1770_mem) - - /* fdc */ - MCFG_DEVICE_REMOVE("i8271") - - MCFG_WD1770_ADD("wd1770", XTAL_16MHz / 2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("wd1770:0", bbc_floppies_525, "qd", bbc_state::floppy_formats_525dd) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("wd1770:1", bbc_floppies_525, "qd", bbc_state::floppy_formats_525dd) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcb_de, bbcb ) - /* software lists */ - MCFG_DEVICE_REMOVE("cass_ls_b") - MCFG_SOFTWARE_LIST_ADD("flop_ls_b_de", "bbcb_de_cass") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_b", "bbcb_cass") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcb_us, bbcb ) - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_REFRESH_RATE(60) - - /* software lists */ - MCFG_DEVICE_REMOVE("cass_ls_b") - MCFG_SOFTWARE_LIST_ADD("flop_ls_b_us", "bbcb_us_flop") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_b", "bbcb_cass") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcbp, bbcb1770 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY( "maincpu" ) /* M6512 */ - MCFG_CPU_PROGRAM_MAP(bbcbp_mem) - - MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcbp) - MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcbp) - MCFG_VIDEO_START_OVERRIDE(bbc_state, bbcbp) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcbp128, bbcb1770 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY( "maincpu" ) /* M6512 */ - MCFG_CPU_PROGRAM_MAP(bbcbp128_mem) - - MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcbp) - MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcbp) - MCFG_VIDEO_START_OVERRIDE(bbc_state, bbcbp) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Acorn Business Computers - -****************************************************************************/ - - -static MACHINE_CONFIG_DERIVED( abc110, bbcbp ) - /* fdc */ - MCFG_DEVICE_REMOVE("wd1770:1") - - /* Add Z80 co-processor */ - - /* Add ADAPTEC ACB-4000 Winchester Disc Controller */ - - /* Add 10MB ST-412 Winchester */ - -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( abc210, bbcbp ) - /* fdc */ - MCFG_DEVICE_REMOVE("wd1770:1") - - /* Add 32016 co-processor */ - - /* Add ADAPTEC ACB-4000 Winchester Disc Controller */ - - /* Add 10MB ST-412 Winchester ABC210 */ - - /* Add 20MB ST-412 Winchester Cambridge */ - -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( abc310, bbcbp ) - /* fdc */ - MCFG_DEVICE_REMOVE("wd1770:1") - - /* Add 80286 co-processor */ - - /* Add ADAPTEC ACB-4000 Winchester Disc Controller */ - - /* Add 10MB ST-412 Winchester */ - -MACHINE_CONFIG_END - - -/*************************************************************************** - - Reuters APM Board (Application Processor Module) - -****************************************************************************/ - - -static MACHINE_CONFIG_DERIVED( reutapm, bbcbp ) - /* basic machine hardware */ - MCFG_CPU_MODIFY( "maincpu" ) /* M6512 */ - MCFG_CPU_PROGRAM_MAP(reutapm_mem) - - /* sound hardware */ - MCFG_DEVICE_REMOVE("mono") - MCFG_DEVICE_REMOVE("sn76489") - MCFG_DEVICE_REMOVE("vsm") - MCFG_DEVICE_REMOVE("tms5220") - - /* cassette */ - MCFG_DEVICE_REMOVE( "cassette" ) - - /* fdc */ - MCFG_DEVICE_REMOVE("wd1770") - - /* software lists */ - MCFG_DEVICE_REMOVE("cass_ls_a") - MCFG_DEVICE_REMOVE("cass_ls_b") -MACHINE_CONFIG_END - - -/*************************************************************************** - - BBC Master Series - -****************************************************************************/ - - -static MACHINE_CONFIG_START( bbcm, bbc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M65SC02, 2000000) /* 2.00 MHz */ - MCFG_CPU_PROGRAM_MAP(bbcm_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", bbc_state, bbcb_vsync) /* screen refresh interrupts */ - MCFG_CPU_PERIODIC_INT_DRIVER(bbc_state, bbcb_keyscan, 1000) /* scan keyboard */ - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_DEFAULT_VALUE(0x00) - - MCFG_MACHINE_START_OVERRIDE(bbc_state, bbcm) - MCFG_MACHINE_RESET_OVERRIDE(bbc_state, bbcm) - - MCFG_DEFAULT_LAYOUT(layout_bbc) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(128)) - MCFG_SCREEN_SIZE(640, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(bbc_state,bbc) - - MCFG_DEVICE_ADD("saa5050", SAA5050, XTAL_12MHz/2) - MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) - - /* crtc */ - MCFG_MC6845_ADD("mc6845", MC6845, "screen", 2000000) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(bbc_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(bbc_state, bbc_vsync)) - - MCFG_VIDEO_START_OVERRIDE(bbc_state, bbcm) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("sn76489", SN76489, 4000000) /* 4 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* rtc and cmos */ - MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522_1", via6522_device, write_ca1)) MCFG_DEVCB_INVERT /* ack seems to be inverted? */ - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(bbc_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("bbc_cass") - - // 2 x EPROM sockets (32K) in BBC-Master - MCFG_GENERIC_SOCKET_ADD("exp_rom1", generic_plain_slot, "bbcm_cart") - MCFG_GENERIC_LOAD(bbc_state, bbcm_exp1_load) - - MCFG_GENERIC_SOCKET_ADD("exp_rom2", generic_plain_slot, "bbcm_cart") - MCFG_GENERIC_LOAD(bbc_state, bbcm_exp2_load) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_ls_m", "bbcm_cass") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_a", "bbca_cass") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_ls_b", "bbcb_cass") - MCFG_SOFTWARE_LIST_ADD("cart_ls_m", "bbcm_cart") - - /* acia */ - MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(bbc_state, bbc_txd_w)) - MCFG_ACIA6850_RTS_HANDLER(WRITELINE(bbc_state, bbc_rts_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_acia6850_irq_w)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(WRITELINE(bbc_state, write_rxd_serial)) - MCFG_RS232_DCD_HANDLER(WRITELINE(bbc_state, write_dcd_serial)) - MCFG_RS232_CTS_HANDLER(WRITELINE(bbc_state, write_cts_serial)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, XTAL_16MHz / 13) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bbc_state, write_acia_clock)) - - /* adc */ - MCFG_DEVICE_ADD("upd7002", UPD7002, 0) - MCFG_UPD7002_GET_ANALOGUE_CB(bbc_state, BBC_get_analogue_input) - MCFG_UPD7002_EOC_CB(bbc_state, BBC_uPD7002_EOC) - - /* system via */ - MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) - MCFG_VIA6522_READPA_HANDLER(READ8(bbc_state, bbcb_via_system_read_porta)) - MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_system_read_portb)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(bbc_state, bbcb_via_system_write_porta)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_system_write_portb)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_system_irq_w)) - - /* user via */ - MCFG_DEVICE_ADD("via6522_1", VIA6522, 1000000) - MCFG_VIA6522_READPB_HANDLER(READ8(bbc_state, bbcb_via_user_read_portb)) - MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(bbc_state, bbcb_via_user_write_portb)) - MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(bbc_state, bbcb_via_user_irq_w)) - - /* fdc */ - MCFG_WD1770_ADD("wd1770", XTAL_16MHz / 2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("wd1770:0", bbc_floppies_525, "qd", bbc_state::floppy_formats_525dd) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("wd1770:1", bbc_floppies_525, "qd", bbc_state::floppy_formats_525dd) - MCFG_FLOPPY_DRIVE_SOUND(true) - - /* econet */ - MCFG_DEVICE_ADD("mc6854", MC6854, 0) - MCFG_MC6854_OUT_TXD_CB(DEVWRITELINE(ECONET_TAG, econet_device, data_w)) - MCFG_ECONET_ADD() - MCFG_ECONET_CLK_CALLBACK(WRITELINE(bbc_state, econet_clk_w)) - MCFG_ECONET_DATA_CALLBACK(DEVWRITELINE("mc6854", mc6854_device, set_rx)) - MCFG_ECONET_SLOT_ADD("econet254", 254, econet_devices, NULL) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcmt, bbcm ) - - /* Add 65C102 co-processor */ - -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcmaiv, bbcm ) - - /* Add 65C102 co-processor */ - - /* Add Philips VP415 Laserdisc player */ - - /* Add Acorn Tracker Ball */ - -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcmet, bbcm ) - /* sound hardware */ - MCFG_DEVICE_REMOVE("mono") - MCFG_DEVICE_REMOVE("sn76489") - - /* printer */ - MCFG_DEVICE_REMOVE("centronics") - - /* cassette */ - MCFG_DEVICE_REMOVE("cassette") - - /* software lists */ - MCFG_SOFTWARE_LIST_REMOVE("cass_ls_m") - MCFG_SOFTWARE_LIST_REMOVE("cass_ls_a") - MCFG_SOFTWARE_LIST_REMOVE("cass_ls_b") - - /* acia */ - MCFG_DEVICE_REMOVE("acia6850") - MCFG_DEVICE_REMOVE(RS232_TAG) - MCFG_DEVICE_REMOVE("acia_clock") - - /* devices */ - MCFG_DEVICE_REMOVE("upd7002") - MCFG_DEVICE_REMOVE("via6522_1") - - /* fdc */ - MCFG_DEVICE_REMOVE("wd1770") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcm512, bbcm ) - - /* Add Intel 80186 co-processor */ - -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( bbcmarm, bbcm ) - - /* Add ARM co-processor */ - -MACHINE_CONFIG_END - - -/*************************************************************************** - - BBC Master Compact - -****************************************************************************/ - - -static MACHINE_CONFIG_DERIVED( bbcmc, bbcm ) - /* cassette */ - MCFG_DEVICE_REMOVE("cassette") - - /* fdc */ - MCFG_DEVICE_REMOVE("wd1770") - - MCFG_WD1772_ADD("wd1772", XTAL_16MHz / 2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("wd1772:0", bbc_floppies_35, "qd", bbc_state::floppy_formats_35dd) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("wd1772:1", bbc_floppies_35, NULL, bbc_state::floppy_formats_35dd) - MCFG_FLOPPY_DRIVE_SOUND(true) - - /* eeprom pcd8572 */ - //MCFG_DEVICE_REMOVE("rtc") - - /* software lists */ - MCFG_SOFTWARE_LIST_REMOVE("cass_ls_m") - MCFG_SOFTWARE_LIST_REMOVE("cass_ls_a") - MCFG_SOFTWARE_LIST_REMOVE("cass_ls_b") - MCFG_SOFTWARE_LIST_REMOVE("cart_ls_m") - MCFG_SOFTWARE_LIST_ADD("flop_ls_mc", "bbcmc_flop") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED(pro128s, bbcmc) - /* software lists */ - MCFG_SOFTWARE_LIST_REMOVE("flop_ls_mc") - MCFG_SOFTWARE_LIST_ADD("flop_ls_pro128s", "pro128s_flop") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop_ls_mc", "bbcmc_flop") -MACHINE_CONFIG_END - - -/* the BBC came with 4 rom sockets on the motherboard as shown in the model A driver */ -/* you could get a number of rom upgrade boards that took this up to 16 roms as in the */ -/* model B driver */ - -ROM_START(bbca) - ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ - - ROM_REGION(0x14000,"option",0) /* ROM */ - /* rom page 0 00000 SPARE SOCKET */ - /* rom page 1 04000 SPARE SOCKET */ - /* rom page 2 08000 SPARE SOCKET */ - /* rom page 3 0c000 BASIC */ - ROM_DEFAULT_BIOS("os12b2") - ROM_SYSTEM_BIOS( 0, "os12b2", "OS 1.20 / BASIC2" ) - ROMX_LOAD("os12.rom", 0x10000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(1)) /* os */ - ROMX_LOAD("basic2.rom", 0x0c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(1)) /* rom page 3 0c000 */ - ROM_SYSTEM_BIOS( 1, "os12b1", "OS 1.20 / BASIC1" ) - ROMX_LOAD("os12.rom", 0x10000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(2)) /* os */ - ROMX_LOAD("basic1.rom", 0x0c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(2)) /* rom page 3 0c000 */ - ROM_SYSTEM_BIOS( 2, "os10b2", "OS 1.00 / BASIC2" ) - ROMX_LOAD("os10.rom", 0x10000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(3)) /* os */ - ROMX_LOAD("basic2.rom", 0x0c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(3)) /* rom page 3 0c000 */ - ROM_SYSTEM_BIOS( 3, "os10b1", "OS 1.00 / BASIC1" ) - ROMX_LOAD("os10.rom", 0x10000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(4)) /* os */ - ROMX_LOAD("basic1.rom", 0x0c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(4)) /* rom page 3 0c000 */ - /* OS0.1 does not support rom paging, load BASIC into all pages */ - ROM_SYSTEM_BIOS( 4, "os01b2", "OS 0.10 / BASIC2" ) - ROMX_LOAD("os01.rom", 0x10000, 0x4000, CRC(45ee0980) SHA1(4b0ece6dc139d5d3f4fabd023716fb6f25149b80), ROM_BIOS(5)) /* os */ - ROMX_LOAD("basic2.rom", 0x00000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(5)) /* rom page 0 00000 */ - ROMX_LOAD("basic2.rom", 0x04000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(5)) /* rom page 1 04000 */ - ROMX_LOAD("basic2.rom", 0x08000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(5)) /* rom page 2 08000 */ - ROMX_LOAD("basic2.rom", 0x0c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(5)) /* rom page 3 0c000 */ - ROM_SYSTEM_BIOS( 5, "os01b1", "OS 0.10 / BASIC1" ) - ROMX_LOAD("os01.rom", 0x10000, 0x4000, CRC(45ee0980) SHA1(4b0ece6dc139d5d3f4fabd023716fb6f25149b80), ROM_BIOS(6)) /* os */ - ROMX_LOAD("basic1.rom", 0x00000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(6)) /* rom page 0 00000 */ - ROMX_LOAD("basic1.rom", 0x04000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(6)) /* rom page 1 04000 */ - ROMX_LOAD("basic1.rom", 0x08000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(6)) /* rom page 2 08000 */ - ROMX_LOAD("basic1.rom", 0x0c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(6)) /* rom page 3 0c000 */ - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x10000, 0, 0x4000) -ROM_END - - -/* 0000- 7fff ram */ -/* 8000- bfff this area is mapped over with one of the roms from "option" region 0x00000-0x40000 */ -/* c000- ffff OS rom and memory mapped hardware at fc00-feff, from "option" region 0x40000-0x44000 */ - - -ROM_START(bbcb) - ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 */ - /* rom page 3 0c000 */ - /* rom page 4 10000 */ - /* rom page 5 14000 */ - /* rom page 6 18000 */ - /* rom page 7 1c000 */ - /* rom page 8 20000 */ - /* rom page 9 24000 */ - /* rom page 10 28000 */ - /* rom page 11 2c000 */ - /* rom page 12 30000 SPARE SOCKET */ - /* rom page 13 34000 SPARE SOCKET */ - /* rom page 14 38000 DFS */ - /* rom page 15 3c000 BASIC */ - ROM_DEFAULT_BIOS("os12b2") - ROM_SYSTEM_BIOS( 0, "os12b2", "OS 1.20 / BASIC2" ) - ROMX_LOAD("os12.rom", 0x40000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(1)) /* os */ - ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(1)) /* rom page 15 3c000 */ - ROM_SYSTEM_BIOS( 1, "os12b1", "OS 1.20 / BASIC1" ) - ROMX_LOAD("os12.rom", 0x40000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(2)) /* os */ - ROMX_LOAD("basic1.rom", 0x3c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(2)) /* rom page 15 3c000 */ - ROM_SYSTEM_BIOS( 2, "os10b2", "OS 1.00 / BASIC2" ) - ROMX_LOAD("os10.rom", 0x40000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(3)) /* os */ - ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(3)) /* rom page 15 3c000 */ - ROM_SYSTEM_BIOS( 3, "os10b1", "OS 1.00 / BASIC1" ) - ROMX_LOAD("os10.rom", 0x40000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(4)) /* os */ - ROMX_LOAD("basic1.rom", 0x3c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(4)) /* rom page 15 3c000 */ - - ROM_LOAD("dnfs.rom", 0x38000, 0x4000, CRC(8ccd2157) SHA1(7e3c536baeae84d6498a14e8405319e01ee78232)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) -ROM_END - - -ROM_START(bbcb1770) - ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 */ - /* rom page 3 0c000 */ - /* rom page 4 10000 */ - /* rom page 5 14000 */ - /* rom page 6 18000 */ - /* rom page 7 1c000 */ - /* rom page 8 20000 */ - /* rom page 9 24000 */ - /* rom page 10 28000 */ - /* rom page 11 2c000 */ - /* rom page 12 30000 SPARE SOCKET */ - /* rom page 13 34000 SPARE SOCKET */ - /* rom page 14 38000 DDFS */ - /* rom page 15 3c000 BASIC */ - ROM_DEFAULT_BIOS("os12b2") - ROM_SYSTEM_BIOS( 0, "os12b2", "OS 1.20 / BASIC2" ) - ROMX_LOAD("os12.rom", 0x40000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(1)) /* os */ - ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(1)) /* rom page 15 3c000 */ - ROM_SYSTEM_BIOS( 1, "os12b1", "OS 1.20 / BASIC1" ) - ROMX_LOAD("os12.rom", 0x40000, 0x4000, CRC(3c14fc70) SHA1(0d9bcaf6a393c9ce2359ed700ddb53c232c2c45d), ROM_BIOS(2)) /* os */ - ROMX_LOAD("basic1.rom", 0x3c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(2)) /* rom page 15 3c000 */ - ROM_SYSTEM_BIOS( 2, "os10b2", "OS 1.00 / BASIC2" ) - ROMX_LOAD("os10.rom", 0x40000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(3)) /* os */ - ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(3)) /* rom page 15 3c000 */ - ROM_SYSTEM_BIOS( 3, "os10b1", "OS 1.00 / BASIC1" ) - ROMX_LOAD("os10.rom", 0x40000, 0x4000, CRC(9679b8f8) SHA1(d35f6723132aabe3c4d00fc16fd9ecc6768df753), ROM_BIOS(4)) /* os */ - ROMX_LOAD("basic1.rom", 0x3c000, 0x4000, CRC(b3364108) SHA1(890f6e3e7fab3340f75b85e93ff29332bc9ecb2e), ROM_BIOS(4)) /* rom page 15 3c000 */ - - ROM_LOAD("ddfs223.rom", 0x38000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) -ROM_END - - -ROM_START(bbcb_de) - ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 */ - /* rom page 3 0c000 */ - /* rom page 4 10000 */ - /* rom page 5 14000 */ - /* rom page 6 18000 */ - /* rom page 7 1c000 */ - /* rom page 8 20000 */ - /* rom page 9 24000 */ - /* rom page 10 28000 */ - /* rom page 11 2c000 */ - /* rom page 12 30000 SPARE SOCKET */ - /* rom page 13 34000 SPARE SOCKET */ - /* rom page 14 38000 DFS */ - /* rom page 15 3c000 BASIC */ - ROM_DEFAULT_BIOS("os12") - ROM_SYSTEM_BIOS( 0, "os12", "OS 1.20 / BASIC2" ) - ROMX_LOAD("os_de.rom", 0x40000, 0x4000, CRC(b7262caf) SHA1(aadf90338ee9d1c85dfa73beba50e930c2a38f10), ROM_BIOS(1)) - ROMX_LOAD("basic2.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281), ROM_BIOS(1)) /* rom page 15 3c000 */ - - ROM_LOAD("dfs10.rom", 0x38000, 0x4000, CRC(7e367e8c) SHA1(161f585dc45665ea77433c84afd2f95049f7f5a0)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) -ROM_END - - -ROM_START(bbcb_us) - ROM_REGION(0x08000,"maincpu",ROMREGION_ERASEFF) /* RAM */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 */ - /* rom page 3 0c000 */ - /* rom page 4 10000 */ - /* rom page 5 14000 */ - /* rom page 6 18000 */ - /* rom page 7 1c000 */ - /* rom page 8 20000 */ - /* rom page 9 24000 */ - /* rom page 10 28000 */ - /* rom page 11 2c000 */ - /* rom page 12 30000 SPARE SOCKET */ - /* rom page 13 34000 SPARE SOCKET */ - /* rom page 14 38000 DFS */ - /* rom page 15 3c000 BASIC */ - ROM_DEFAULT_BIOS("os10b3") - ROM_SYSTEM_BIOS( 0, "os10b3", "OS A1.0 / BASIC3" ) - ROMX_LOAD("os10_us.rom", 0x40000, 0x4000, CRC(c8e946a9) SHA1(83d91d089dca092d2c8b7c3650ff8143c9069b89), ROM_BIOS(1)) - ROMX_LOAD("basic3.rom", 0x3c000, 0x4000, CRC(161b9539) SHA1(b39014610a968789afd7695aa04d1277d874405c), ROM_BIOS(1)) /* rom page 15 3c000 */ - - ROM_LOAD("dfs10.rom", 0x38000, 0x4000, CRC(7e367e8c) SHA1(161f585dc45665ea77433c84afd2f95049f7f5a0)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phrom_us.bin", 0x0000, 0x4000, CRC(bf4b3b64) SHA1(66876702d1d95eecc034d20f25047f893a27cde5)) -ROM_END - - -ROM_START(bbcbp) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("os20") - ROM_SYSTEM_BIOS( 0, "os20", "OS 2.00" ) - ROMX_LOAD("bpos2.ic71", 0x3c000, 0x4000, CRC(9f356396) SHA1(ea7d3a7e3ee1ecfaa1483af994048057362b01f2), ROM_BIOS(1)) /* rom page 15 3C000 BASIC */ - ROM_CONTINUE( 0x40000, 0x4000) /* OS */ - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 32K IN PAGE 3 */ - /* rom page 3 0c000 SPARE SOCKET */ - /* rom page 4 10000 32K IN PAGE 5 */ - /* rom page 5 14000 ADFS */ - /* rom page 6 18000 32K IN PAGE 7 */ - /* rom page 7 1c000 DDFS */ - /* rom page 8 20000 32K IN PAGE 9 */ - /* rom page 9 24000 SPARE SOCKET */ - /* rom page 10 28000 32K IN PAGE 11 */ - /* rom page 11 2c000 SPARE SOCKET */ - /* rom page 12 30000 */ - /* rom page 13 34000 */ - /* rom page 14 38000 32K IN PAGE 15 */ - /* rom page 15 3C000 BASIC */ - ROM_LOAD("adfs130.rom", 0x14000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) - ROM_LOAD("ddfs223.rom", 0x1c000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) -ROM_END - - -ROM_START(bbcbp128) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("os20") - ROM_SYSTEM_BIOS( 0, "os20", "OS 2.00" ) - ROMX_LOAD("bpos2.ic71", 0x3c000, 0x4000, CRC(9f356396) SHA1(ea7d3a7e3ee1ecfaa1483af994048057362b01f2), ROM_BIOS(1)) /* rom page 15 3C000 BASIC */ - ROM_CONTINUE( 0x40000, 0x4000) /* OS */ - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 32K IN PAGE 3 */ - /* rom page 3 0c000 SPARE SOCKET */ - /* rom page 4 10000 32K IN PAGE 5 */ - /* rom page 5 14000 ADFS */ - /* rom page 6 18000 32K IN PAGE 7 */ - /* rom page 7 1c000 DDFS */ - /* rom page 8 20000 32K IN PAGE 9 */ - /* rom page 9 24000 SPARE SOCKET */ - /* rom page 10 28000 32K IN PAGE 11 */ - /* rom page 11 2c000 SPARE SOCKET */ - /* rom page 12 30000 */ - /* rom page 13 34000 */ - /* rom page 14 38000 32K IN PAGE 15 */ - /* rom page 15 3C000 BASIC */ - ROM_LOAD("adfs130.rom", 0x14000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) - ROM_LOAD("ddfs223.rom", 0x1c000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) -ROM_END - - -ROM_START(abc110) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos200") - ROM_SYSTEM_BIOS( 0, "mos200", "MOS2.00" ) - ROMX_LOAD("mos200.rom", 0x40000, 0x4000, CRC(5e88f994) SHA1(76235ff15d736f5def338f73ac7497c41b916505), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "mos123", "MOS1.23" ) - ROMX_LOAD("mos123.rom", 0x40000, 0x4000, CRC(90d31d08) SHA1(42a01892cf8bd2ada4db1c8b36aff80c85eb5dcb), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "mos120", "MOS1.20" ) - ROMX_LOAD("mos120.rom", 0x40000, 0x4000, CRC(0a1e83a0) SHA1(21dc3a94eef7c003b194686730fb461779f44925), ROM_BIOS(3)) - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 32K IN PAGE 3 */ - /* rom page 3 0c000 SPARE SOCKET */ - /* rom page 4 10000 32K IN PAGE 5 */ - /* rom page 5 14000 DDFS */ - /* rom page 6 18000 32K IN PAGE 7 */ - /* rom page 7 1c000 ADFS */ - /* rom page 8 20000 32K IN PAGE 9 */ - /* rom page 9 24000 SPARE SOCKET */ - /* rom page 10 28000 32K IN PAGE 11 */ - /* rom page 11 2c000 SPARE SOCKET */ - /* rom page 12 30000 */ - /* rom page 13 34000 */ - /* rom page 14 38000 32K IN PAGE 15 */ - /* rom page 15 3C000 BASIC */ - ROM_LOAD("ddfs223.rom", 0x14000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) - ROM_LOAD("adfs130.rom", 0x1c000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) - ROM_LOAD("basic200.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) -ROM_END - - -ROM_START(abc210) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos200") - ROM_SYSTEM_BIOS( 0, "mos200", "MOS2.00" ) - ROMX_LOAD("mos200.rom", 0x40000, 0x4000, CRC(5e88f994) SHA1(76235ff15d736f5def338f73ac7497c41b916505), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "mos123", "MOS1.23" ) - ROMX_LOAD("mos123.rom", 0x40000, 0x4000, CRC(90d31d08) SHA1(42a01892cf8bd2ada4db1c8b36aff80c85eb5dcb), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "mos120", "MOS1.20" ) - ROMX_LOAD("mos120.rom", 0x40000, 0x4000, CRC(0a1e83a0) SHA1(21dc3a94eef7c003b194686730fb461779f44925), ROM_BIOS(3)) - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 32K IN PAGE 3 */ - /* rom page 3 0c000 SPARE SOCKET */ - /* rom page 4 10000 32K IN PAGE 5 */ - /* rom page 5 14000 DDFS */ - /* rom page 6 18000 32K IN PAGE 7 */ - /* rom page 7 1c000 ADFS */ - /* rom page 8 20000 32K IN PAGE 9 */ - /* rom page 9 24000 SPARE SOCKET */ - /* rom page 10 28000 32K IN PAGE 11 */ - /* rom page 11 2c000 SPARE SOCKET */ - /* rom page 12 30000 */ - /* rom page 13 34000 */ - /* rom page 14 38000 32K IN PAGE 15 */ - /* rom page 15 3C000 BASIC */ - ROM_LOAD("ddfs223.rom", 0x14000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) - ROM_LOAD("adfs130.rom", 0x1c000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) - ROM_LOAD("basic200.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) -ROM_END - - -ROM_START(abc310) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos200") - ROM_SYSTEM_BIOS( 0, "mos200", "MOS2.00" ) - ROMX_LOAD("mos200.rom", 0x40000, 0x4000, CRC(5e88f994) SHA1(76235ff15d736f5def338f73ac7497c41b916505), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "mos123", "MOS1.23" ) - ROMX_LOAD("mos123.rom", 0x40000, 0x4000, CRC(90d31d08) SHA1(42a01892cf8bd2ada4db1c8b36aff80c85eb5dcb), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "mos120", "MOS1.20" ) - ROMX_LOAD("mos120.rom", 0x40000, 0x4000, CRC(0a1e83a0) SHA1(21dc3a94eef7c003b194686730fb461779f44925), ROM_BIOS(3)) - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 32K IN PAGE 3 */ - /* rom page 3 0c000 SPARE SOCKET */ - /* rom page 4 10000 32K IN PAGE 5 */ - /* rom page 5 14000 DDFS */ - /* rom page 6 18000 32K IN PAGE 7 */ - /* rom page 7 1c000 ADFS */ - /* rom page 8 20000 32K IN PAGE 9 */ - /* rom page 9 24000 SPARE SOCKET */ - /* rom page 10 28000 32K IN PAGE 11 */ - /* rom page 11 2c000 SPARE SOCKET */ - /* rom page 12 30000 */ - /* rom page 13 34000 */ - /* rom page 14 38000 32K IN PAGE 15 */ - /* rom page 15 3C000 BASIC */ - ROM_LOAD("ddfs223.rom", 0x14000, 0x4000, CRC(7891f9b7) SHA1(0d7ed0b0b3852cb61970ada1993244f2896896aa)) - ROM_LOAD("adfs130.rom", 0x1c000, 0x4000, CRC(d3855588) SHA1(301fd05c475a629c4bec70510d4507256a5b00d8)) - ROM_LOAD("basic200.rom", 0x3c000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281)) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ - ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) -ROM_END - - -ROM_START(reutapm) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - /* rom page 0 00000 */ - /* rom page 1 04000 */ - /* rom page 2 08000 32K IN PAGE 3 */ - /* rom page 3 0c000 SPARE SOCKET */ - /* rom page 4 10000 32K IN PAGE 5 */ - /* rom page 5 14000 SPARE SOCKET */ - /* rom page 6 18000 32K IN PAGE 7 */ - /* rom page 7 1c000 SPARE SOCKET */ - /* rom page 8 20000 32K IN PAGE 9 */ - /* rom page 9 24000 SPARE SOCKET */ - /* rom page 10 28000 32K IN PAGE 11 */ - /* rom page 11 2c000 SPARE SOCKET */ - /* rom page 12 30000 */ - /* rom page 13 34000 */ - /* rom page 14 38000 32K IN PAGE 15 */ - /* rom page 15 3C000 SPARE SOCKET */ - ROM_LOAD("reutera100.rom", 0x1c000, 0x4000, CRC(98ebabfb) SHA1(a7887e1e5c206203491e1e06682b9508b0fef49d)) - ROM_LOAD("reuterb.rom", 0x2c000, 0x4000, CRC(9e02f59b) SHA1(1e63aa3bf4b37bf9ba41e454f95db05c3d15bfbf)) - - ROM_REGION(0x4000, "os", 0) - ROM_LOAD("mos_r030.rom", 0x0000, 0x4000, CRC(8b652337) SHA1(6a5c7ace255c8ac96c983d5ba67084fbd71ff61e)) -ROM_END - - -ROM_START(bbcm) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos350") - ROM_SYSTEM_BIOS( 0, "mos350", "Enhanced MOS 3.50" ) - ROMX_LOAD("mos350.ic24", 0x20000, 0x20000, CRC(141027b9) SHA1(85211b5bc7c7a269952d2b063b7ec0e1f0196803), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "mos320", "Original MOS 3.20" ) - ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(2)) - ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x20000, 0x4000, 0xFFFF) - /* 00000 rom 0 Rear Cartridge bottom 16K */ - /* 04000 rom 1 Rear Cartridge top 16K */ - /* 08000 rom 2 Front Cartridge bottom 16K */ - /* 0c000 rom 3 Front Cartridge top 16K */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 SPARE SOCKET */ - /* 24000 rom 9 DFS + SRAM */ - /* 28000 rom 10 Viewsheet */ - /* 2c000 rom 11 Edit */ - /* 30000 rom 12 BASIC */ - /* 34000 rom 13 ADFS */ - /* 38000 rom 14 View + MOS code */ - /* 3c000 rom 15 Terminal + Tube host + CFS */ -// ROM_LOAD("anfs424.rom", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) // TODO where to load this? - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x40,"rtc",0) /* mc146818 */ - /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ - ROMX_LOAD("mos350.cmos", 0x00, 0x40, CRC(e84c1854) SHA1(f3cb7f12b7432caba28d067f01af575779220aac), ROM_BIOS(1)) - ROMX_LOAD("mos320.cmos", 0x00, 0x40, CRC(c7f9e85a) SHA1(f24cc9db0525910689219f7204bf8b864033ee94), ROM_BIOS(2)) -ROM_END - - -ROM_START(bbcmt) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos350") - ROM_SYSTEM_BIOS( 0, "mos350", "Enhanced MOS 3.50" ) - ROMX_LOAD("mos350.ic24", 0x20000, 0x20000, CRC(141027b9) SHA1(85211b5bc7c7a269952d2b063b7ec0e1f0196803), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "mos320", "Original MOS 3.20" ) - ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(2)) - ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x20000, 0x4000, 0xFFFF) - /* 00000 rom 0 Rear Cartridge bottom 16K */ - /* 04000 rom 1 Rear Cartridge top 16K */ - /* 08000 rom 2 Front Cartridge bottom 16K */ - /* 0c000 rom 3 Front Cartridge top 16K */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 SPARE SOCKET */ - /* 24000 rom 9 DFS + SRAM */ - /* 28000 rom 10 Viewsheet */ - /* 2c000 rom 11 Edit */ - /* 30000 rom 12 BASIC */ - /* 34000 rom 13 ADFS */ - /* 38000 rom 14 View + MOS code */ - /* 3c000 rom 15 Terminal + Tube host + CFS */ -// ROM_LOAD("anfs424.ic27", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) // TODO where to load this? - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x40,"rtc",0) /* mc146818 */ - /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ - ROMX_LOAD("mos350.cmos", 0x00, 0x40, CRC(e84c1854) SHA1(f3cb7f12b7432caba28d067f01af575779220aac), ROM_BIOS(1)) - ROMX_LOAD("mos320.cmos", 0x00, 0x40, CRC(c7f9e85a) SHA1(f24cc9db0525910689219f7204bf8b864033ee94), ROM_BIOS(2)) -ROM_END - - -ROM_START(bbcmaiv) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos320") - ROM_SYSTEM_BIOS( 0, "mos320", "MOS 3.20" ) - ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(1)) - ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x20000, 0x4000, 0xFFFF) - /* 00000 rom 0 Rear Cartridge bottom 16K */ - /* 04000 rom 1 Rear Cartridge top 16K */ - /* 08000 rom 2 Front Cartridge bottom 16K */ - /* 0c000 rom 3 Front Cartridge top 16K */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 VFS */ - /* 24000 rom 9 DFS + SRAM */ - /* 28000 rom 10 Viewsheet */ - /* 2c000 rom 11 Edit */ - /* 30000 rom 12 BASIC */ - /* 34000 rom 13 ADFS */ - /* 38000 rom 14 View + MOS code */ - /* 3c000 rom 15 Terminal + Tube host + CFS */ - ROM_LOAD("vfs170.rom", 0x20000, 0x4000, CRC(b124a0bb) SHA1(ba31c757815cf470402d7829a70a0e1d3fb1355b) ) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x40,"rtc",0) /* mc146818 */ - /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ - ROMX_LOAD("mos320aiv.cmos", 0x0E, 0x32, BAD_DUMP CRC(b9ae42a1) SHA1(abf3e94b013f24027ca36c96720963c3411e93f8), ROM_BIOS(1)) -ROM_END - - -ROM_START(bbcmet) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos400") - ROM_SYSTEM_BIOS( 0, "mos400", "Econet MOS 4.00" ) - ROMX_LOAD("mos400.ic24", 0x30000, 0x10000, BAD_DUMP CRC(81729034) SHA1(d4bc2c7f5e66b5298786138f395908e70c772971), ROM_BIOS(1)) /* Merged individual ROM bank dumps */ - ROM_COPY("option", 0x34000, 0x24000, 0xC000) /* Mirror */ - ROM_COPY("option", 0x30000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x30000, 0x4000, 0xFFFF) - /* 00000 rom 0 Rear Cartridge bottom 16K */ - /* 04000 rom 1 Rear Cartridge top 16K */ - /* 08000 rom 2 Front Cartridge bottom 16K */ - /* 0c000 rom 3 Front Cartridge top 16K */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 NO SOCKET */ - /* 24000 rom 9 BASIC */ - /* 28000 rom 10 ANFS */ - /* 2c000 rom 11 MOS code */ - /* 30000 rom 12 UNUSED */ - /* 34000 rom 13 BASIC */ - /* 38000 rom 14 ANFS */ - /* 3c000 rom 15 MOS code */ - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x40,"rtc",0) /* mc146818 */ - /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ - ROMX_LOAD("mos400.cmos", 0x0E, 0x32, BAD_DUMP CRC(fff41cc5) SHA1(3607568758f90b3bd6c7dc9533e2aa24f9806ff3), ROM_BIOS(1)) -ROM_END - - -ROM_START(bbcm512) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos350") - ROM_SYSTEM_BIOS( 0, "mos350", "Enhanced MOS 3.50" ) - ROMX_LOAD("mos350.ic24", 0x20000, 0x20000, CRC(141027b9) SHA1(85211b5bc7c7a269952d2b063b7ec0e1f0196803), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "mos320", "Original MOS 3.20" ) - ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(2)) - ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x20000, 0x4000, 0xFFFF) - /* 00000 rom 0 Rear Cartridge bottom 16K */ - /* 04000 rom 1 Rear Cartridge top 16K */ - /* 08000 rom 2 Front Cartridge bottom 16K */ - /* 0c000 rom 3 Front Cartridge top 16K */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 SPARE SOCKET */ - /* 24000 rom 9 DFS + SRAM */ - /* 28000 rom 10 Viewsheet */ - /* 2c000 rom 11 Edit */ - /* 30000 rom 12 BASIC */ - /* 34000 rom 13 ADFS */ - /* 38000 rom 14 View + MOS code */ - /* 3c000 rom 15 Terminal + Tube host + CFS */ -// ROM_LOAD("anfs424.ic27", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x40,"rtc",0) /* mc146818 */ - /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ - ROMX_LOAD("mos350.cmos", 0x00, 0x40, CRC(e84c1854) SHA1(f3cb7f12b7432caba28d067f01af575779220aac), ROM_BIOS(1)) - ROMX_LOAD("mos320.cmos", 0x00, 0x40, CRC(c7f9e85a) SHA1(f24cc9db0525910689219f7204bf8b864033ee94), ROM_BIOS(2)) -ROM_END - - -ROM_START(bbcmarm) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos320") - ROM_SYSTEM_BIOS( 0, "mos320", "Original MOS 3.20" ) - ROMX_LOAD("mos320.ic24", 0x20000, 0x20000, CRC(0cfad2ce) SHA1(0275719aa7746dd3b627f95ccc4362b564063a5e), ROM_BIOS(1)) - ROM_COPY("option", 0x20000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x20000, 0x4000, 0xFFFF) - /* 00000 rom 0 Rear Cartridge bottom 16K */ - /* 04000 rom 1 Rear Cartridge top 16K */ - /* 08000 rom 2 Front Cartridge bottom 16K */ - /* 0c000 rom 3 Front Cartridge top 16K */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 SPARE SOCKET */ - /* 24000 rom 9 DFS + SRAM */ - /* 28000 rom 10 Viewsheet */ - /* 2c000 rom 11 Edit */ - /* 30000 rom 12 BASIC */ - /* 34000 rom 13 ADFS */ - /* 38000 rom 14 View + MOS code */ - /* 3c000 rom 15 Terminal + Tube host + CFS */ -// ROM_LOAD("anfs424.ic27", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - ROM_REGION(0x40,"rtc",0) /* mc146818 */ - /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ - ROMX_LOAD("mos320arm.cmos", 0x00, 0x40, CRC(56117257) SHA1(ed98563bef18f9d2a0b2d941cd20823d760fb127), ROM_BIOS(1)) -ROM_END - - -ROM_START(bbcmc) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos510") - ROM_SYSTEM_BIOS( 0, "mos510", "Enhanced MOS 5.10" ) - ROMX_LOAD("mos510.ic49", 0x30000, 0x10000, BAD_DUMP CRC(9a2a6086) SHA1(094ab37b0b6437c4f1653eaa0602ef102737adb6), ROM_BIOS(1)) /* Merged individual ROM bank dumps */ - ROM_SYSTEM_BIOS( 1, "mos500", "Original MOS 5.00" ) - ROMX_LOAD("mos500.ic49", 0x30000, 0x10000, BAD_DUMP CRC(f6170023) SHA1(140d002d2d9cd34b47197a2ba823505af2a84633), ROM_BIOS(2)) /* Merged individual ROM bank dumps */ - ROM_COPY("option", 0x30000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x30000, 0x4000, 0xFFFF) - /* 00000 rom 0 EXTERNAL */ - /* 04000 rom 1 EXTERNAL */ - /* 08000 rom 2 SPARE SOCKET */ - /* 0c000 rom 3 SPARE SOCKET */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 SPARE SOCKET */ - /* 24000 rom 9 UNUSED */ - /* 28000 rom 10 UNUSED */ - /* 2c000 rom 11 UNUSED */ - /* 30000 rom 12 UNUSED */ - /* 34000 rom 13 ADFS */ - /* 38000 rom 14 BASIC */ - /* 3c000 rom 15 Utils */ - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - -// ROM_REGION(0x80,"mc146818",0) /* mc146818 */ - /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ -// ROM_LOAD("mos500.cmos", 0x00, 0x80, CRC(d8458039) SHA1(72c056d493e74ceca41f48936012b012b496a226)) -ROM_END - - -ROM_START(bbcmc_ar) - ROM_REGION(0x10000,"maincpu",ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000,"option",0) /* ROM */ - ROM_DEFAULT_BIOS("mos511i") - ROM_SYSTEM_BIOS( 0, "mos511i", "International MOS 5.11" ) - ROMX_LOAD("mos511.ic49", 0x30000, 0x10000, BAD_DUMP CRC(8708803c) SHA1(d2170c8b9b536f3ad84a4a603a7fe712500cc751), ROM_BIOS(1)) /* Merged individual ROM bank dumps */ - ROM_COPY("option", 0x30000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x30000, 0x4000, 0xFFFF) - /* 00000 rom 0 EXTERNAL */ - /* 04000 rom 1 EXTERNAL */ - /* 08000 rom 2 International */ - /* 0c000 rom 3 SPARE SOCKET */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 Arabian */ - /* 24000 rom 9 UNUSED */ - /* 28000 rom 10 UNUSED */ - /* 2c000 rom 11 UNUSED */ - /* 30000 rom 12 UNUSED */ - /* 34000 rom 13 ADFS */ - /* 38000 rom 14 BASIC */ - /* 3c000 rom 15 Utils */ - ROM_LOAD("international16.rom", 0x8000 , 0x4000, CRC(0ef527b1) SHA1(dc5149ccf588cd591a6ad47727474ef3313272ce) ) - ROM_LOAD("arabian-c22.rom" , 0x20000, 0x4000, CRC(4f3aadff) SHA1(2bbf61ba68264ce5845aab9c54e750b0efe219c8) ) - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - -// ROM_REGION(0x80,"mc146818",0) /* mc146818 */ - /* Factory defaulted CMOS RAM, sets default language ROM, etc. */ -// ROM_LOAD("mos500.cmos", 0x00, 0x80, CRC(d8458039) SHA1(72c056d493e74ceca41f48936012b012b496a226)) -ROM_END - - -ROM_START(pro128s) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) /* ROM MEMORY */ - - ROM_REGION(0x44000, "option", 0) /* ROM */ - ROM_DEFAULT_BIOS("mos510o") - ROM_SYSTEM_BIOS(0, "mos510o", "Olivetti MOS 5.10") - ROMX_LOAD("mos510o.ic49", 0x30000, 0x10000, CRC(c16858d3) SHA1(ad231ed21a55e493b553703285530d1cacd3de7a), ROM_BIOS(1)) - ROM_COPY("option", 0x30000, 0x40000, 0x4000) /* Move loaded roms into place */ - ROM_FILL(0x30000, 0x4000, 0xFFFF) - /* 00000 rom 0 EXTERNAL */ - /* 04000 rom 1 EXTERNAL */ - /* 08000 rom 2 SPARE SOCKET */ - /* 0c000 rom 3 SPARE SOCKET */ - /* 10000 rom 4 SWRAM */ - /* 14000 rom 5 SWRAM */ - /* 18000 rom 6 SWRAM */ - /* 1c000 rom 7 SWRAM */ - /* 20000 rom 8 SPARE SOCKET */ - /* 24000 rom 9 UNUSED */ - /* 28000 rom 10 UNUSED */ - /* 2c000 rom 11 UNUSED */ - /* 30000 rom 12 UNUSED */ - /* 34000 rom 13 ADFS */ - /* 38000 rom 14 BASIC */ - /* 3c000 rom 15 Utils */ - - ROM_REGION(0x4000, "os", 0) - ROM_COPY("option", 0x40000, 0, 0x4000) - - // ROM_REGION(0x80,"eeprom",0) /* pcd8572 */ - /* Factory defaulted EEPROM, sets default language ROM, etc. */ - // ROM_LOAD("mos510o.epr", 0x00, 0x80, CRC(d8458039) SHA1(72c056d493e74ceca41f48936012b012b496a226)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP ( 1981, bbcb, 0, bbca, bbcb, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B w/8271 FDC", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1981, bbca, bbcb, 0, bbca, bbca, bbc_state, bbc, "Acorn", "BBC Micro Model A", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1981, bbcb_de, bbcb, 0, bbcb_de, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B (German)", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1983, bbcb_us, bbcb, 0, bbcb_us, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B (US)", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1985, bbcb1770, bbcb, 0, bbcb1770, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B w/1770 FDC", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1985, bbcbp, 0, bbcb, bbcbp, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B+ 64K", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1985, bbcbp128, bbcbp, 0, bbcbp128, bbcb, bbc_state, bbc, "Acorn", "BBC Micro Model B+ 128K", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1985, abc110, abc210, 0, abc110, abc, bbc_state, bbc, "Acorn", "ABC 110", MACHINE_NOT_WORKING) -COMP ( 1985, abc210, 0, 0, abc210, abc, bbc_state, bbc, "Acorn", "ABC 210/Cambridge Workstation", MACHINE_NOT_WORKING) -COMP ( 1985, abc310, abc210, 0, abc310, abc, bbc_state, bbc, "Acorn", "ABC 310", MACHINE_NOT_WORKING) -COMP ( 1985, reutapm, 0, 0, reutapm, bbcb, bbc_state, bbc, "Acorn", "Reuters APM", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) -COMP ( 1986, bbcm, 0, bbcb, bbcm, bbcm, bbc_state, bbc, "Acorn", "BBC Master 128", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1986, bbcmt, bbcm, 0, bbcmt, bbcm, bbc_state, bbc, "Acorn", "BBC Master Turbo", MACHINE_NOT_WORKING) -COMP ( 1986, bbcmaiv, bbcm, 0, bbcmaiv, bbcm, bbc_state, bbc, "Acorn", "BBC Master AIV", MACHINE_NOT_WORKING) -COMP ( 1986, bbcmet, bbcm, 0, bbcmet, bbcm, bbc_state, bbc, "Acorn", "BBC Master ET", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1986, bbcm512, bbcm, 0, bbcm512, bbcm, bbc_state, bbc, "Acorn", "BBC Master 512", MACHINE_NOT_WORKING) -COMP ( 1986, bbcmarm, bbcm, 0, bbcmarm, bbcm, bbc_state, bbc, "Acorn", "ARM Evaluation System", MACHINE_NOT_WORKING) -COMP ( 1986, bbcmc, 0, bbcm, bbcmc, bbcm, bbc_state, bbc, "Acorn", "BBC Master Compact", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1986, bbcmc_ar, bbcmc, 0, bbcmc, bbcm, bbc_state, bbc, "Acorn", "BBC Master Compact (Arabic)", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1987, pro128s, bbcmc, 0, pro128s, bbcm, bbc_state, bbc, "Olivetti", "Prodest PC 128S", MACHINE_IMPERFECT_GRAPHICS) diff --git a/src/mess/drivers/bbcbc.c b/src/mess/drivers/bbcbc.c deleted file mode 100644 index 8a11968e0c4..00000000000 --- a/src/mess/drivers/bbcbc.c +++ /dev/null @@ -1,164 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Incog, Robbbert -/*************************************************************************** - - bbcbc.c - - BBC Bridge Companion - - Inputs hooked up - 2009-03-14 - Robbbert - Clock Freq added - 2009-05-18 - incog - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/tms9928a.h" -#include "machine/z80pio.h" -#include "cpu/z80/z80daisy.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class bbcbc_state : public driver_device -{ -public: - bbcbc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot") - { } - - required_device m_maincpu; - required_device m_cart; - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_WRITE_LINE_MEMBER(tms_interrupt); -}; - - -#define MAIN_CLOCK XTAL_4_433619MHz - - -static ADDRESS_MAP_START( bbcbc_prg, AS_PROGRAM, 8, bbcbc_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - //AM_RANGE(0x4000, 0xbfff) // mapped by the cartslot - AM_RANGE(0xe000, 0xe02f) AM_RAM - AM_RANGE(0xe030, 0xe030) AM_READ_PORT("LINE01") - AM_RANGE(0xe031, 0xe031) AM_READ_PORT("LINE02") - AM_RANGE(0xe032, 0xe032) AM_READ_PORT("LINE03") - AM_RANGE(0xe033, 0xe033) AM_READ_PORT("LINE04") - AM_RANGE(0xe034, 0xe034) AM_READ_PORT("LINE05") - AM_RANGE(0xe035, 0xe035) AM_READ_PORT("LINE06") - AM_RANGE(0xe036, 0xe036) AM_READ_PORT("LINE07") - AM_RANGE(0xe037, 0xe037) AM_READ_PORT("LINE08") - AM_RANGE(0xe038, 0xe038) AM_READ_PORT("LINE09") - AM_RANGE(0xe039, 0xe039) AM_READ_PORT("LINE10") - AM_RANGE(0xe03a, 0xe03a) AM_READ_PORT("LINE11") - AM_RANGE(0xe03b, 0xe03b) AM_READ_PORT("LINE12") - AM_RANGE(0xe03c, 0xe7ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( bbcbc_io, AS_IO, 8, bbcbc_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x43) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) - AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("tms9129", tms9129_device, vram_read, vram_write) - AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("tms9129", tms9129_device, register_read, register_write) -ADDRESS_MAP_END - -static INPUT_PORTS_START( bbcbc ) - PORT_START("LINE01") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Pass") PORT_CODE(KEYCODE_W) PORT_IMPULSE(1) - - PORT_START("LINE02") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clubs") PORT_CODE(KEYCODE_G) PORT_IMPULSE(1) - - PORT_START("LINE03") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Spades") PORT_CODE(KEYCODE_D) PORT_IMPULSE(1) - - PORT_START("LINE04") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rdbl") PORT_CODE(KEYCODE_T) PORT_IMPULSE(1) - - PORT_START("LINE05") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NT") PORT_CODE(KEYCODE_E) PORT_IMPULSE(1) - - PORT_START("LINE06") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Hearts, Up") PORT_CODE(KEYCODE_S) PORT_IMPULSE(1) - - PORT_START("LINE07") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Play, Yes") PORT_CODE(KEYCODE_X) PORT_IMPULSE(1) - - PORT_START("LINE08") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_A) PORT_IMPULSE(1) - - PORT_START("LINE09") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Dbl") PORT_CODE(KEYCODE_R) PORT_IMPULSE(1) - - PORT_START("LINE10") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Diamonds, Down") PORT_CODE(KEYCODE_F) PORT_IMPULSE(1) - - PORT_START("LINE11") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Start") PORT_CODE(KEYCODE_Q) PORT_IMPULSE(1) - - PORT_START("LINE12") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Play, No") PORT_CODE(KEYCODE_B) PORT_IMPULSE(1) -INPUT_PORTS_END - -WRITE_LINE_MEMBER(bbcbc_state::tms_interrupt) -{ - m_maincpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); -} - -static const z80_daisy_config bbcbc_daisy_chain[] = -{ - { "z80pio" }, - { NULL } -}; - - -void bbcbc_state::machine_start() -{ - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -void bbcbc_state::machine_reset() -{ -} - - -static MACHINE_CONFIG_START( bbcbc, bbcbc_state ) - MCFG_CPU_ADD( "maincpu", Z80, MAIN_CLOCK / 8 ) - MCFG_CPU_PROGRAM_MAP( bbcbc_prg) - MCFG_CPU_IO_MAP( bbcbc_io) - MCFG_CPU_CONFIG(bbcbc_daisy_chain) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, MAIN_CLOCK/8) - - MCFG_DEVICE_ADD( "tms9129", TMS9129, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(bbcbc_state, tms_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9129", tms9928a_device, screen_update ) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "bbcbc_cart") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","bbcbc") -MACHINE_CONFIG_END - - -ROM_START( bbcbc ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("br_4_1.ic3", 0x0000, 0x2000, CRC(7c880d75) SHA1(954db096bd9e8edfef72946637a12f1083841fb0)) - ROM_LOAD("br_4_2.ic4", 0x2000, 0x2000, CRC(16a33aef) SHA1(9529f9f792718a3715af2063b91a5fb18f741226)) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS(1985, bbcbc, 0, 0, bbcbc, bbcbc, driver_device, 0, "BBC", "Bridge Companion", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/bcs3.c b/src/mess/drivers/bcs3.c deleted file mode 100644 index 8292aedd270..00000000000 --- a/src/mess/drivers/bcs3.c +++ /dev/null @@ -1,492 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - BCS 3 - - 2009-05-12 Skeleton driver. - 2015-09-25 Improvements - - http://hc-ddr.hucki.net/wiki/doku.php/homecomputer:bcs3 - - East German home built computer. No sound facilities. - All documents are in German. - - Main CPU is a U880 (Z80 equivalent). Other ICs also have unusual names. - - The CTC sends an interrupt every so often. This uses a lookup table to - jump to an address in the range 38xx-39xx. This seems to work much the - same as reading video memory in the ZX80. This, I think, is to stop snow - appearing on the screen. It also slows everything down noticeably. - - It appears that a read of 1400 activates the Z80's /WAIT pin. This will - be released by a VS pulse. (Not emulated) - - Cassette is hooked up according to the documentation, but it doesn't work. - - Known Memory Map: - 0000 - 0FFF: Main ROM - 1000 - 13FF: Keyboard - 1400 - 17FF: /WAIT circuit - 1800 - 1BFF: Output one character's scanline to the monitor. ZX-video process. - 1C00 - 1FFF: Video RAM - 2000 - 3FFF: Mirror of 0000 - 1FFF. - 4000 - up : Extra RAM (required for hack versions) - - Hack versions: - - They are fitted with Basic 3.x, require more RAM, and use hardware scrolling. - - No schematic has been found, so the code is educated guesswork. - - The ZX process is still to be worked out. For now, we return 0xF7 to finish. - - There is a machine-language monitor fitted to some models. To access: - -- Y = USR(0F000H) - -- Commands are S (substitute), M (move), T (test), G (go), Q (quit) - - To Do: - - Need software - - Fix cassette - - Hack versions: fix the ZX process - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80ctc.h" -#include "imagedev/cassette.h" - - -class bcs3_state : public driver_device -{ -public: - bcs3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_ctc(*this, "ctc") - , m_p_chargen(*this, "chargen") - , m_p_videoram(*this, "videoram") - , m_cass(*this, "cassette") - , m_io_keyboard(*this, "KEY") - { } - - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_READ8_MEMBER(video_r); - DECLARE_READ8_MEMBER(zx_r); - DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); - DECLARE_DRIVER_INIT(bcs3a); - DECLARE_DRIVER_INIT(bcs3b); - DECLARE_DRIVER_INIT(bcs3c); - DECLARE_DRIVER_INIT(bcs3d); - UINT32 screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_bcs3a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -private: - bool m_cass_bit; - UINT8 s_curs; - UINT8 s_init; - UINT8 s_rows; - UINT8 s_cols; - - required_device m_maincpu; - required_device m_ctc; - required_memory_region m_p_chargen; - required_shared_ptr m_p_videoram; - required_device m_cass; - required_ioport_array<10> m_io_keyboard; -}; - -READ8_MEMBER( bcs3_state::keyboard_r ) -{ - UINT8 i, data = 0; - - if (offset == 0) - data = (m_cass->input() > +0.01) ? 0x80 : 0; - - offset ^= 0x3ff; - - for (i = 0; i < 10; i++) - if BIT(offset, i) - data |= m_io_keyboard[i]->read(); - - return data; -} - -// 00-7F = NUL, 0xE0 = end of line. -READ8_MEMBER( bcs3_state::video_r ) -{ - UINT8 data = m_p_videoram[offset]; - return BIT(data, 7) ? data : 0; -} - -// Unsure of how this works. -// 00-7F = NUL, 0xFF = end of line, 0xF7 = finish. -READ8_MEMBER( bcs3_state::zx_r ) -{ - return 0xf7; -} - -static ADDRESS_MAP_START(bcs3_mem, AS_PROGRAM, 8, bcs3_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_MIRROR(0x2000) AM_ROM AM_REGION("roms", 0) - AM_RANGE( 0x1000, 0x13ff ) AM_MIRROR(0x2000) AM_READ(keyboard_r) - AM_RANGE( 0x1400, 0x17ff ) AM_MIRROR(0x2000) AM_NOP // /WAIT circuit - AM_RANGE( 0x1800, 0x1bff ) AM_MIRROR(0x2000) AM_READ(video_r) - AM_RANGE( 0x1c00, 0x1fff ) AM_MIRROR(0x2000) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(bcs3a_mem, AS_PROGRAM, 8, bcs3_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_MIRROR(0x2000) AM_ROM AM_REGION("roms", 0) - AM_RANGE( 0x1000, 0x13ff ) AM_MIRROR(0x2000) AM_READ(keyboard_r) - AM_RANGE( 0x1400, 0x17ff ) AM_MIRROR(0x2000) AM_NOP // /WAIT circuit - AM_RANGE( 0x1800, 0x1bff ) AM_MIRROR(0x2000) AM_READ(zx_r) - AM_RANGE( 0x3c00, 0x7fff ) AM_RAM AM_SHARE("videoram") - AM_RANGE( 0xf000, 0xf3ff ) AM_ROM AM_REGION("roms", 0x1000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( bcs3_io, AS_IO, 8, bcs3_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(3) - // coded in the rom as F8 to FB - AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( bcs3 ) - PORT_START("KEY.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K :") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR(':') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A &") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_START("KEY.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L ;") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR(';') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B '") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("KEY.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M <") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C (") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(34) - - PORT_START("KEY.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N =") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D )") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START("KEY.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O >") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E *") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - - PORT_START("KEY.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F +") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G ,") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR(',') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - - PORT_START("KEY.7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H -") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) - - PORT_START("KEY.8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I .") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('.') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("KEY.9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J /") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('/') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') -INPUT_PORTS_END - -// Official version -UINT32 bcs3_state::screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,rat; - UINT16 sy=0,ma=0x50,x; - - for (y = 0; y < 12; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - rat = (ra + 1) & 7; - - for (x = ma; x < ma + 28; x++) - { - if (ra < 8) - { - chr = m_p_videoram[x] & 0x7f; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen->base()[(chr<<3) | rat ] ^ 0xff; - } - else - gfx = 0xff; - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=28; - } - return 0; -} - -/* Hacks: When it starts, it has 4 lines of data. Pressing enter causes it to allocate 100 lines. - I'm assuming that it only shows a portion of this, with the cursor always in sight. */ -UINT32 bcs3_state::screen_update_bcs3a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,rat; - UINT16 sy = 0, ma = s_init, x; - UINT16 cursor = (m_p_videoram[s_curs] | (m_p_videoram[s_curs+1] << 8)) - 0x3c00 - ma; // get cursor relative position - rat = cursor / (s_cols+1); - if (rat > (s_rows-1)) ma += (rat-(s_rows-1)) * (s_cols+1); - - for (y = 0; y < s_rows; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - rat = (ra + 1) & 7; - - for (x = ma; x < ma + s_cols; x++) - { - if (ra < 8) - { - chr = m_p_videoram[x] & 0x7f; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen->base()[(chr<<3) | rat ] ^ 0xff; - } - else - gfx = 0xff; - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=(s_cols+1); - } - return 0; -} - - -/* F4 Character Displayer */ -static const gfx_layout bcs3_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 0*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( bcs3 ) - GFXDECODE_ENTRY( "chargen", 0x0000, bcs3_charlayout, 0, 1 ) -GFXDECODE_END - -WRITE_LINE_MEMBER( bcs3_state::ctc_z0_w ) -{ - m_ctc->trg1(state); - if (state) - { - m_cass_bit ^= 1; - m_cass->output(m_cass_bit ? -1.0 : +1.0); - } -} - -WRITE_LINE_MEMBER( bcs3_state::ctc_z1_w ) -{ - m_ctc->trg2(state); -} - -static const z80_daisy_config daisy_chain_intf[] = -{ - { "ctc" }, - { NULL } -}; - -DRIVER_INIT_MEMBER( bcs3_state, bcs3a ) -{ - s_curs = 0x7a; - s_init = 0x80; - s_rows = 12; - s_cols = 29; -} - -DRIVER_INIT_MEMBER( bcs3_state, bcs3b ) -{ - s_curs = 0x7a; - s_init = 0x80; - s_rows = 24; - s_cols = 40; -} - -DRIVER_INIT_MEMBER( bcs3_state, bcs3c ) -{ - s_curs = 0x08; - s_init = 0xa0; - s_rows = 12; - s_cols = 29; -} - -DRIVER_INIT_MEMBER( bcs3_state, bcs3d ) -{ - s_curs = 0x08; - s_init = 0xb4; - s_rows = 12; - s_cols = 29; -} - -static MACHINE_CONFIG_START( bcs3, bcs3_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_5MHz /2) - MCFG_CPU_PROGRAM_MAP(bcs3_mem) - MCFG_CPU_IO_MAP(bcs3_io) - MCFG_CPU_CONFIG(daisy_chain_intf) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(28*8, 12*10) - MCFG_SCREEN_VISIBLE_AREA(0,28*8-1,0,12*10-1) - MCFG_SCREEN_UPDATE_DRIVER(bcs3_state, screen_update_bcs3) - MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", bcs3) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_5MHz / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(bcs3_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(bcs3_state, ctc_z1_w)) - - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( bcs3a, bcs3_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_7MHz /2) - MCFG_CPU_PROGRAM_MAP(bcs3a_mem) - MCFG_CPU_IO_MAP(bcs3_io) - MCFG_CPU_CONFIG(daisy_chain_intf) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(29*8, 12*10) - MCFG_SCREEN_VISIBLE_AREA(0,29*8-1,0,12*10-1) - MCFG_SCREEN_UPDATE_DRIVER(bcs3_state, screen_update_bcs3a) - MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", bcs3) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_7MHz / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(bcs3_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(bcs3_state, ctc_z1_w)) - - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( bcs3b, bcs3a ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(40*8, 24*10) - MCFG_SCREEN_VISIBLE_AREA(0,40*8-1,0,24*10-1) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( bcs3 ) - ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) - //ROM_LOAD( "se24.bin", 0x0000, 0x0800, CRC(268de5ee) SHA1(78784945956c1b0282a4e82ad55e7c3a77389e50)) - ROM_LOAD( "se24_000.d6", 0x0000, 0x0400, CRC(157a0d28) SHA1(0a6666c289b95d98128fd282478dff6319031b6e) ) - ROM_LOAD( "se24_400.d7", 0x0400, 0x0400, CRC(2159de0f) SHA1(09b567e750931019de914f25d5ab1e4910465de6) ) - - ROM_REGION( 0x0400, "chargen", 0 ) - ROM_LOAD( "bcs_zg_24.d21", 0x0000, 0x0400, CRC(eaed9d84) SHA1(7023a6187cd6bd0c6489d76ff662453f14e5b636)) -ROM_END - -ROM_START( bcs3a ) - ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) - //ROM_LOAD( "se31_29.bin", 0x0000, 0x1000, CRC(e9b55544) SHA1(82bae68c4bcaecf66632f5b43913b50a1acba316)) - ROM_LOAD( "se31_000.d6", 0x0000, 0x0400, CRC(0765bd83) SHA1(137ceffd50eeaf21caab286d3e01161ba3267ea4) ) - ROM_LOAD( "se31_400.d7", 0x0400, 0x0400, CRC(1a87a3ed) SHA1(c8121ff198f8cf0c7bc7bc7e258ecfa51d3bb02c) ) - ROM_LOAD( "se31_800.d8", 0x0800, 0x0400, CRC(05654a8f) SHA1(b42fa6cf5710dab23f062dbeea81e85b4c18e1b0) ) - ROM_LOAD( "se31_c00.d9", 0x0c00, 0x0400, CRC(858ca28b) SHA1(90f943b0c1d102dd058a859ba139057a0bd278a6) ) - ROM_LOAD( "se31mceditor.bin", 0x1000, 0x0400, CRC(8eac92ec) SHA1(8950a3ef05d02abf34269bfce002c46d273ce113)) - - ROM_REGION( 0x0400, "chargen", 0 ) - ROM_LOAD( "bcs_zg_31.d21", 0x0000, 0x0400, CRC(a20c93c9) SHA1(b2be1c0d98b7ac05713349b099b392975968be1d)) -ROM_END - -ROM_START( bcs3b ) - ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) - ROM_LOAD( "se31_40.bin", 0x0000, 0x1000, CRC(4e993152) SHA1(6bb01ff5779627fa2eb2df432fffcfccc1e33231)) - ROM_LOAD( "se31mceditor.bin", 0x1000, 0x0400, CRC(8eac92ec) SHA1(8950a3ef05d02abf34269bfce002c46d273ce113)) - - ROM_REGION( 0x0400, "chargen", 0 ) - ROM_LOAD( "bcs_zg_31.d21", 0x0000, 0x0400, CRC(a20c93c9) SHA1(b2be1c0d98b7ac05713349b099b392975968be1d)) -ROM_END - -ROM_START( bcs3c ) - ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) - ROM_LOAD( "bcs32.bin", 0x0000, 0x1000, CRC(1523b846) SHA1(ca5e3213707a604e02d9e7a7ebfc362ef294ddb8) ) - - ROM_REGION( 0x0400, "chargen", 0 ) - ROM_LOAD( "bcs_zg_32.d21", 0x0000, 0x0400, CRC(abe9e820) SHA1(03a8792d08774cd67b98efd3f83a78e897b4e001) ) -ROM_END - -ROM_START( bcs3d ) - ROM_REGION( 0x2000, "roms", ROMREGION_ERASEFF ) - ROM_LOAD( "sp33_29.bin", 0x0000, 0x1000, CRC(1c851eb2) SHA1(4f8bb5274ea1861a35a840e8f3482bdc693047c4)) - - ROM_REGION( 0x0400, "chargen", 0 ) - ROM_LOAD( "bcs_zg_33.d21", 0x0000, 0x0400, CRC(b27f1c07) SHA1(61c80c585f198370ba5e856839c12b15acdc58ee)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, bcs3, 0, 0, bcs3, bcs3, driver_device, 0, "Eckhard Schiller", "BCS 3 rev 2.4", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) -COMP( 1986, bcs3a, bcs3, 0, bcs3a, bcs3, bcs3_state, bcs3a, "Eckhard Schiller", "BCS 3 rev 3.1 29-column", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) -COMP( 1986, bcs3b, bcs3, 0, bcs3b, bcs3, bcs3_state, bcs3b, "Eckhard Schiller", "BCS 3 rev 3.1 40-column", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) -COMP( 1986, bcs3c, bcs3, 0, bcs3a, bcs3, bcs3_state, bcs3c, "Eckhard Schiller", "BCS 3 rev 3.2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) -COMP( 1986, bcs3d, bcs3, 0, bcs3a, bcs3, bcs3_state, bcs3d, "Eckhard Schiller", "BCS 3 rev 3.3", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/bebox.c b/src/mess/drivers/bebox.c deleted file mode 100644 index cd3aec4c163..00000000000 --- a/src/mess/drivers/bebox.c +++ /dev/null @@ -1,261 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, R. Belmont -/*************************************************************************** - - drivers/bebox.c - - BeBox - -***************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "includes/bebox.h" - -/* Components */ -#include "video/clgd542x.h" -#include "bus/lpci/cirrus.h" -#include "cpu/powerpc/ppc.h" -#include "sound/3812intf.h" -#include "machine/mc146818.h" -#include "machine/pckeybrd.h" -#include "bus/lpci/mpc105.h" -#include "bus/scsi/scsi.h" - -/* Devices */ -#include "bus/scsi/scsicd.h" -#include "bus/scsi/scsihd.h" -#include "formats/pc_dsk.h" -#include "machine/8042kbdc.h" - -READ8_MEMBER(bebox_state::at_dma8237_1_r) { return m_dma8237_2->read(space, offset / 2); } -WRITE8_MEMBER(bebox_state::at_dma8237_1_w) { m_dma8237_2->write(space, offset / 2, data); } - -static ADDRESS_MAP_START( bebox_mem, AS_PROGRAM, 64, bebox_state ) - AM_RANGE(0x7FFFF0F0, 0x7FFFF0F7) AM_READWRITE(bebox_cpu0_imask_r, bebox_cpu0_imask_w ) - AM_RANGE(0x7FFFF1F0, 0x7FFFF1F7) AM_READWRITE(bebox_cpu1_imask_r, bebox_cpu1_imask_w ) - AM_RANGE(0x7FFFF2F0, 0x7FFFF2F7) AM_READ(bebox_interrupt_sources_r ) - AM_RANGE(0x7FFFF3F0, 0x7FFFF3F7) AM_READWRITE(bebox_crossproc_interrupts_r, bebox_crossproc_interrupts_w ) - AM_RANGE(0x7FFFF4F0, 0x7FFFF4F7) AM_WRITE(bebox_processor_resets_w ) - - AM_RANGE(0x80000000, 0x8000001F) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000020, 0x8000003F) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000040, 0x8000005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000060, 0x8000006F) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000070, 0x8000007F) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , U64(0xffffffffffffffff) ) - AM_RANGE(0x80000080, 0x8000009F) AM_READWRITE8(bebox_page_r, bebox_page_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x800000A0, 0x800000BF) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, U64(0xffffffffffffffff) ) - AM_RANGE(0x800000C0, 0x800000DF) AM_READWRITE8(at_dma8237_1_r, at_dma8237_1_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800001F0, 0x800001F7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs0, write_cs0, U64(0xffffffffffffffff) ) - AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8( "ns16550_1", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000380, 0x80000387) AM_DEVREADWRITE8( "ns16550_2", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000388, 0x8000038F) AM_DEVREADWRITE8( "ns16550_3", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x800003b0, 0x800003bf) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03b0_r, port_03b0_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800003c0, 0x800003cf) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03c0_r, port_03c0_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800003d0, 0x800003df) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03d0_r, port_03d0_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800003F0, 0x800003F7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs1, write_cs1, U64(0xffffffffffffffff) ) - AM_RANGE(0x800003F0, 0x800003F7) AM_DEVICE8( "smc37c78", smc37c78_device, map, U64(0xffffffffffffffff) ) - AM_RANGE(0x800003F8, 0x800003FF) AM_DEVREADWRITE8( "ns16550_0",ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000480, 0x8000048F) AM_READWRITE8(bebox_80000480_r, bebox_80000480_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000CF8, 0x80000CFF) AM_DEVREADWRITE("pcibus", pci_bus_device, read_64be, write_64be ) - //AM_RANGE(0x800042E8, 0x800042EF) AM_DEVWRITE8("cirrus", cirrus_device, cirrus_42E8_w, U64(0xffffffffffffffff) ) - - AM_RANGE(0xBFFFFFF0, 0xBFFFFFFF) AM_READ(bebox_interrupt_ack_r ) - AM_RANGE(0xC00A0000, 0XC00BFFFF) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, mem_r, mem_w, U64(0xffffffffffffffff) ) - AM_RANGE(0xC1000000, 0XC11FFFFF) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, mem_linear_r, mem_linear_w, U64(0xffffffffffffffff) ) - AM_RANGE(0xFFF00000, 0xFFF03FFF) AM_ROMBANK("bank2") - AM_RANGE(0xFFF04000, 0xFFFFFFFF) AM_READWRITE8(bebox_flash_r, bebox_flash_w, U64(0xffffffffffffffff) ) -ADDRESS_MAP_END - -// The following is a gross hack to let the BeBox boot ROM identify the processors correctly. -// This needs to be done in a better way if someone comes up with one. - -READ64_MEMBER(bebox_state::bb_slave_64be_r) -{ - // 2e94 is the real address, 2e84 is where the PC appears to be under full DRC - if ((space.device().safe_pc() == 0xfff02e94) || (space.device().safe_pc() == 0xfff02e84)) - { - return 0x108000ff; // indicate slave CPU - } - - return m_pcibus->read_64be(space, offset, mem_mask); -} - -static ADDRESS_MAP_START( bebox_slave_mem, AS_PROGRAM, 64, bebox_state ) - AM_RANGE(0x80000cf8, 0x80000cff) AM_READ(bb_slave_64be_r) - AM_RANGE(0x80000cf8, 0x80000cff) AM_DEVWRITE("pcibus", pci_bus_device, write_64be ) - AM_IMPORT_FROM(bebox_mem) -ADDRESS_MAP_END - -#define BYTE_REVERSE32(x) (((x >> 24) & 0xff) | \ - ((x >> 8) & 0xff00) | \ - ((x << 8) & 0xff0000) | \ - ((x << 24) & 0xff000000)) - -LSI53C810_FETCH_CB(bebox_state::scsi_fetch) -{ - UINT32 result = m_ppc1->space(AS_PROGRAM).read_dword(dsp & 0x7FFFFFFF); - return BYTE_REVERSE32(result); -} - - -LSI53C810_IRQ_CB(bebox_state::scsi_irq_callback) -{ - bebox_set_irq_bit(21, state); -} - - -LSI53C810_DMA_CB(bebox_state::scsi_dma_callback) -{ -} - -FLOPPY_FORMATS_MEMBER( bebox_state::floppy_formats ) - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( bebox_floppies ) - SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_FRAGMENT( mpc105_config ) - MCFG_MPC105_CPU( "ppc1" ) - MCFG_MPC105_BANK_BASE_DEFAULT( 0 ) -MACHINE_CONFIG_END - - -/************************************* - * - * Keyboard - * - *************************************/ - -WRITE_LINE_MEMBER(bebox_state::bebox_keyboard_interrupt) -{ - bebox_set_irq_bit(16, state); - m_pic8259_1->ir1_w(state); -} - -static SLOT_INTERFACE_START( pci_devices ) - SLOT_INTERFACE_INTERNAL("mpc105", MPC105) - SLOT_INTERFACE("cirrus", CIRRUS) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( bebox, bebox_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("ppc1", PPC603, 66000000) /* 66 MHz */ - MCFG_CPU_PROGRAM_MAP(bebox_mem) - - MCFG_CPU_ADD("ppc2", PPC603, 66000000) /* 66 MHz */ - MCFG_CPU_PROGRAM_MAP(bebox_slave_mem) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("pit8254", PIT8254, 0) - MCFG_PIT8253_CLK0(4772720/4) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(bebox_state, bebox_timer0_w)) - MCFG_PIT8253_CLK1(4772720/4) /* dram refresh */ - MCFG_PIT8253_CLK2(4772720/4) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("kbdc", kbdc8042_device, write_out2)) - - MCFG_DEVICE_ADD( "dma8237_1", AM9517A, XTAL_14_31818MHz/3 ) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(bebox_state, bebox_dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(bebox_state, bebox_dma8237_out_eop)) - MCFG_I8237_IN_MEMR_CB(READ8(bebox_state, bebox_dma_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(bebox_state, bebox_dma_write_byte)) - MCFG_I8237_IN_IOR_2_CB(READ8(bebox_state, bebox_dma8237_fdc_dack_r)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(bebox_state, bebox_dma8237_fdc_dack_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(bebox_state, pc_dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(bebox_state, pc_dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(bebox_state, pc_dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(bebox_state, pc_dack3_w)) - - MCFG_DEVICE_ADD( "dma8237_2", AM9517A, XTAL_14_31818MHz/3 ) - - MCFG_PIC8259_ADD( "pic8259_1", WRITELINE(bebox_state,bebox_pic8259_master_set_int_line), VCC, READ8(bebox_state,get_slave_ack) ) - - MCFG_PIC8259_ADD( "pic8259_2", WRITELINE(bebox_state,bebox_pic8259_slave_set_int_line), GND, NULL ) - - MCFG_DEVICE_ADD( "ns16550_0", NS16550, 0 ) /* TODO: Verify model */ - MCFG_DEVICE_ADD( "ns16550_1", NS16550, 0 ) /* TODO: Verify model */ - MCFG_DEVICE_ADD( "ns16550_2", NS16550, 0 ) /* TODO: Verify model */ - MCFG_DEVICE_ADD( "ns16550_3", NS16550, 0 ) /* TODO: Verify model */ - - /* video hardware */ - MCFG_FRAGMENT_ADD( pcvideo_cirrus_gd5428 ) - - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ym3812", YM3812, 3579545) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_FUJITSU_29F016A_ADD("flash") - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "cdrom", SCSICD, SCSI_ID_3) - - MCFG_DEVICE_ADD("lsi53c810", LSI53C810, 0) - MCFG_LSI53C810_IRQ_CB(bebox_state, scsi_irq_callback) - MCFG_LSI53C810_DMA_CB(bebox_state, scsi_dma_callback) - MCFG_LSI53C810_FETCH_CB(bebox_state, scsi_fetch) - MCFG_LEGACY_SCSI_PORT("scsi") - - MCFG_IDE_CONTROLLER_ADD( "ide", ata_devices, "hdd", NULL, false ) /* FIXME */ - MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(bebox_state, bebox_ide_interrupt)) - - /* pci */ - MCFG_PCI_BUS_ADD("pcibus", 0) - MCFG_PCI_BUS_DEVICE("pcibus:0", pci_devices, "mpc105", true) - MCFG_SLOT_OPTION_MACHINE_CONFIG("mpc105", mpc105_config) - - MCFG_PCI_BUS_DEVICE("pcibus:1", pci_devices, "cirrus", true) - - /*MCFG_PCI_BUS_DEVICE(12, NULL, scsi53c810_pci_read, scsi53c810_pci_write)*/ - - MCFG_SMC37C78_ADD("smc37c78") - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(bebox_state, fdc_interrupt)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8237_1", am9517a_device, dreq2_w)) - MCFG_FLOPPY_DRIVE_ADD("smc37c78:0", bebox_floppies, "35hd", bebox_state::floppy_formats) - - MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) - - MCFG_DEVICE_ADD("kbdc", KBDC8042, 0) - MCFG_KBDC8042_KEYBOARD_TYPE(KBDC8042_STANDARD) - MCFG_KBDC8042_SYSTEM_RESET_CB(INPUTLINE("ppc1", INPUT_LINE_RESET)) - MCFG_KBDC8042_INPUT_BUFFER_FULL_CB(WRITELINE(bebox_state, bebox_keyboard_interrupt)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32M") - MCFG_RAM_EXTRA_OPTIONS("8M,16M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( bebox2, bebox ) - MCFG_CPU_REPLACE("ppc1", PPC603E, 133000000) /* 133 MHz */ - MCFG_CPU_PROGRAM_MAP(bebox_mem) - - MCFG_CPU_REPLACE("ppc2", PPC603E, 133000000) /* 133 MHz */ - MCFG_CPU_PROGRAM_MAP(bebox_slave_mem) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( bebox ) - PORT_INCLUDE( at_keyboard ) -INPUT_PORTS_END - -ROM_START(bebox) - ROM_REGION(0x00200000, "user1", ROMREGION_64BIT | ROMREGION_BE) - ROM_LOAD( "bootmain.rom", 0x000000, 0x20000, CRC(df2d19e0) SHA1(da86a7d23998dc953dd96a2ac5684faaa315c701) ) - ROM_REGION(0x4000, "user2", ROMREGION_64BIT | ROMREGION_BE) - ROM_LOAD( "bootnub.rom", 0x000000, 0x4000, CRC(5348d09a) SHA1(1b637a3d7a2b072aa128dd5c037bbb440d525c1a) ) -ROM_END - -ROM_START(bebox2) - ROM_REGION(0x00200000, "user1", ROMREGION_64BIT | ROMREGION_BE) - ROM_LOAD( "bootmain.rom", 0x000000, 0x20000, CRC(df2d19e0) SHA1(da86a7d23998dc953dd96a2ac5684faaa315c701) ) - ROM_REGION(0x4000, "user2", ROMREGION_64BIT | ROMREGION_BE) - ROM_LOAD( "bootnub.rom", 0x000000, 0x4000, CRC(5348d09a) SHA1(1b637a3d7a2b072aa128dd5c037bbb440d525c1a) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1995, bebox, 0, 0, bebox, bebox, bebox_state, bebox, "Be Inc", "BeBox Dual603-66", MACHINE_NOT_WORKING ) -COMP( 1996, bebox2, bebox, 0, bebox2, bebox, bebox_state, bebox, "Be Inc", "BeBox Dual603-133", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/beehive.c b/src/mess/drivers/beehive.c deleted file mode 100644 index a751969f919..00000000000 --- a/src/mess/drivers/beehive.c +++ /dev/null @@ -1,322 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - BEEHIVE DM3270 - - 25/05/2009 Skeleton driver [Robbbert] - - This is a conventional computer terminal using a serial link. - Could be a clone of the IBM3276-2. - - The character gen rom is not dumped. Using the one from 'c10' - for the moment. - - Screen goes crazy during the memory test, just ignore it. - System freezes if ^G pressed. - - 25/04/2011 Added partial keyboard. - 26/06/2011 Added modifier keys. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" - - -class beehive_state : public driver_device -{ -public: - beehive_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_p_videoram(*this, "videoram"){ } - - required_device m_maincpu; - DECLARE_READ8_MEMBER(beehive_60_r); - DECLARE_WRITE8_MEMBER(beehive_62_w); - const UINT8 *m_p_chargen; - required_shared_ptr m_p_videoram; - UINT8 m_keyline; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - -READ8_MEMBER(beehive_state::beehive_60_r) -{ - if (BIT(m_keyline, 4)) - { - char kbdrow[6]; - sprintf(kbdrow,"X%d", m_keyline&15); - return ioport(kbdrow)->read(); - } - else - return 0xff; -} - -WRITE8_MEMBER(beehive_state::beehive_62_w) -{ - m_keyline = data; -} - -static ADDRESS_MAP_START(beehive_mem, AS_PROGRAM, 8, beehive_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x17ff ) AM_ROM - AM_RANGE( 0x8000, 0x8fff ) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( beehive_io, AS_IO, 8, beehive_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x11, 0x11) AM_READ_PORT("DIPS") - AM_RANGE(0x60, 0x60) AM_READ(beehive_60_r) - AM_RANGE(0x61, 0x61) AM_READ_PORT("MODIFIERS") - AM_RANGE(0x62, 0x62) AM_WRITE(beehive_62_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( beehive ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("{") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('{') PORT_CHAR('}') - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_PGDN) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7pad") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8pad") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9pad") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED // Does a HOME - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4pad") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5pad") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6pad") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("X8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1pad") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2pad") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3pad") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0pad") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("X9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".pad") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-pad") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - - PORT_START("X10") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("XMIT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - // This row is scanned but nothing happens - PORT_START("X11") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - // These probably not exist - PORT_START("X12") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_START("X13") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_START("X14") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_START("X15") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("MODIFIERS") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Capslock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LCtrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RCtrl") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RShift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x83, IP_ACTIVE_LOW, IPT_UNUSED) - - // assumed to be dipswitches, purpose unknown, see code from 12D - PORT_START("DIPS") - PORT_DIPNAME( 0x01, 0x01, "Switch A") PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x01, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x02, 0x02, "Switch B") PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x02, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_BIT(0x3c, 0x2c, IPT_UNUSED) // this is required to sync keyboard and A-LOCK indicator - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) // unused - PORT_DIPNAME( 0x80, 0x80, "Switch C") PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x80, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) -INPUT_PORTS_END - - -void beehive_state::machine_reset() -{ -} - -void beehive_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -/* This system appears to have inline attribute bytes of unknown meaning. - Currently they are ignored. */ -UINT32 beehive_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 cursor_pos = (m_p_videoram[0xcaf] | (m_p_videoram[0xcb0] << 8)) & 0xfff; - UINT16 p_linelist; - UINT8 line_length; - UINT8 y,ra,chr,gfx,inv; - UINT16 sy=0,ma,x; - - for (y = 0; y < 25; y++) - { - p_linelist = 0x1af + y*3; - line_length = m_p_videoram[p_linelist]+1; - ma = (m_p_videoram[p_linelist+1] | (m_p_videoram[p_linelist+2] << 8)) & 0xfff; - - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - UINT8 chars = 0; - - for (x = ma; x < ma + line_length; x++) - { - inv = gfx = chr = 0; - if (y == 24) inv=0xff; // status line reverse video - if (ra < 9) - { - if (x == cursor_pos) inv=0xff; // show cursor - chr = m_p_videoram[x]; // get char in videoram - gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; // get dot pattern in chargen - } - - if ((chars < 80) && (!BIT(chr, 7))) // ignore attribute bytes - { - chars++; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - } - } - return 0; -} - -static MACHINE_CONFIG_START( beehive, beehive_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8085A, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(beehive_mem) - MCFG_CPU_IO_MAP(beehive_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(beehive_state, screen_update) - MCFG_SCREEN_SIZE(640, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( beehive ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "dm3270-1.rom", 0x0000, 0x0800, CRC(781bde32) SHA1(a3fe25baadd2bfc2b1791f509bb0f4960281ee32) ) - ROM_LOAD( "dm3270-2.rom", 0x0800, 0x0800, CRC(4d3476b7) SHA1(627ad42029ca6c8574cda8134d047d20515baf53) ) - ROM_LOAD( "dm3270-3.rom", 0x1000, 0x0800, CRC(dbf15833) SHA1(ae93117260a259236c50885c5cecead2aad9b3c4) ) - - /* character generator not dumped, using the one from 'c10' for now */ - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, beehive, 0, 0, beehive, beehive, driver_device, 0, "BeeHive", "DM3270", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/besta.c b/src/mess/drivers/besta.c deleted file mode 100644 index 32b19329c20..00000000000 --- a/src/mess/drivers/besta.c +++ /dev/null @@ -1,164 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - Besta-88 and Besta-90 engineering workstations. - - Derived (OEMd?) from Force Computers' SYS68K series. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/68230pit.h" -#include "machine/terminal.h" - -#define VERBOSE_DBG 1 /* general debug messages */ - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - -#define TERMINAL_TAG "terminal" - -class besta_state : public driver_device -{ -public: - besta_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pit1 (*this, "pit1"), - m_pit2 (*this, "pit2"), - m_terminal(*this, TERMINAL_TAG), - m_p_ram(*this, "p_ram") - { - } - - DECLARE_READ8_MEMBER( mpcc_reg_r ); - DECLARE_WRITE8_MEMBER( mpcc_reg_w ); - DECLARE_WRITE8_MEMBER( kbd_put ); - UINT8 m_term_data; - UINT8 m_mpcc_regs[32]; - - required_device m_maincpu; - required_device m_pit1; - required_device m_pit2; - virtual void machine_reset(); - - required_device m_terminal; - required_shared_ptr m_p_ram; -}; - -READ8_MEMBER( besta_state::mpcc_reg_r ) -{ - UINT8 ret; - - if (!(offset == 0 && !m_mpcc_regs[0])) { - DBG_LOG(1,"mpcc_reg_r",("(%d) = %02X at %s\n", offset, - (offset > 31 ? -1 : m_mpcc_regs[offset]), machine().describe_context())); - } - - switch (offset) { - case 0: /* r_stat aka ... */ - return (m_term_data) ? 0x80 : 0; - case 2: /* r_data aka ... */ - ret = m_term_data; - m_term_data = 0; - return ret; - default: - return m_mpcc_regs[offset]; - } -} - -WRITE8_MEMBER( besta_state::mpcc_reg_w ) -{ - device_t *devconf = machine().device(TERMINAL_TAG); - - DBG_LOG(1,"mpcc_reg_w",("(%d) <- %02X at %s\n", offset, data, machine().describe_context())); - - switch (offset) { - case 2: - m_term_data = data; - break; - case 10: - dynamic_cast(devconf)->write(*machine().memory().first_space(), 0, data); - default: - m_mpcc_regs[offset] = data; - break; - } -} - -WRITE8_MEMBER( besta_state::kbd_put ) -{ - mpcc_reg_w(space, (offs_t)2, data, mem_mask); -} - -static ADDRESS_MAP_START(besta_mem, AS_PROGRAM, 32, besta_state) - AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("p_ram") // local bus DRAM, 4MB -// AM_RANGE(0x08010000, 0x08011fff) AM_RAM // unknown -- accessed by cp31dssp -// AM_RANGE(0xfca03500, 0xfca0350f) AM_READWRITE8(iscsi_reg_r, iscsi_reg_w, 0xffffffff) - AM_RANGE(0xff000000, 0xff00ffff) AM_ROM AM_REGION("user1", 0) // actual mapping is up to 0xff03ffff - AM_RANGE(0xff040000, 0xff07ffff) AM_RAM // onboard SRAM -// AM_RANGE(0xff800000, 0xff80001f) AM_DEVREADWRITE8("mpcc", mpcc68561_t, reg_r, reg_w, 0xffffffff) - AM_RANGE(0xff800000, 0xff80001f) AM_READWRITE8(mpcc_reg_r, mpcc_reg_w, 0xffffffff) // console - AM_RANGE(0xff800200, 0xff800237) AM_DEVREADWRITE8 ("pit2", pit68230_device, read, write, 0xffffffff) -// AM_RANGE(0xff800400, 0xff800xxx) // ??? -- shows up in cp31dssp log -// AM_RANGE(0xff800800, 0xff800xxx) // 68153 BIM -// AM_RANGE(0xff800a00, 0xff800xxx) // 62421 RTC - AM_RANGE(0xff800c00, 0xff800c37) AM_DEVREADWRITE8 ("pit1", pit68230_device, read, write, 0xffffffff) -// AM_RANGE(0xff800e00, 0xff800xxx) // PIT3? -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( besta ) -INPUT_PORTS_END - - -void besta_state::machine_reset() -{ - UINT8* user1 = memregion("user1")->base(); - - memcpy((UINT8*)m_p_ram.target(),user1,0x10000); // not really what happens but... - memset(m_mpcc_regs, 0, sizeof(m_mpcc_regs)); // should initialize to defined values - m_mpcc_regs[8] = 0x80; // always ready to transmit - - m_maincpu->reset(); -} - -/* CP31 processor board */ -static MACHINE_CONFIG_START( besta, besta_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68030, 2*16670000) - MCFG_CPU_PROGRAM_MAP(besta_mem) - - MCFG_DEVICE_ADD ("pit1", PIT68230, 16670000 / 2) // XXX verify clock - - MCFG_DEVICE_ADD ("pit2", PIT68230, 16670000 / 2) // XXX verify clock - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(besta_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( besta88 ) - ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) - - ROM_SYSTEM_BIOS(0, "cp31dbg", "CP31 Debug") - ROMX_LOAD( "cp31dbgboot.27c512", 0x0000, 0x10000, CRC(9bf057de) SHA1(b13cb16042e4c6ca63ae26058a78259c0849d0b6), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "cp31dssp", "CP31 DSSP") - ROMX_LOAD( "cp31dsspboot.27c512", 0x0000, 0x10000, CRC(607a0a55) SHA1(c257a88672ab39d2f3fad681d22e062182b0236d), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "cp31os9", "CP31 OS9") - ROMX_LOAD( "cp31os9.27c512", 0x0000, 0x10000, CRC(607a0a55) SHA1(c257a88672ab39d2f3fad681d22e062182b0236d), ROM_BIOS(3)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, besta88, 0, 0, besta, besta, driver_device, 0, "Sapsan", "Besta-88", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/beta.c b/src/mess/drivers/beta.c deleted file mode 100644 index c545a4622a8..00000000000 --- a/src/mess/drivers/beta.c +++ /dev/null @@ -1,378 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Beta Computer - - http://retro.hansotten.nl/index.php?page=beta-computer - - When first started, press G to begin. - - Pasting: - 0-F : as is - M (inc) : ^ - AD : - - DA : = - GO : X - - Test Paste: - X-0011=11^22^33^44^55^66^77^88^99^-0011 - Now press M to confirm the data has been entered. - -****************************************************************************/ - -/* - - TODO: - - - verify whether feeding a 0xff-filled 2K binary file as cart allows - to write back correctly EPROM or not - -*/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/mos6530n.h" -#include "machine/ram.h" -#include "sound/speaker.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#include "beta.lh" - -#define SCREEN_TAG "screen" -#define M6502_TAG "m6502" -#define M6532_TAG "m6532" -#define EPROM_TAG "eprom" -//#define SPEAKER_TAG "b237" - -class beta_state : public driver_device -{ -public: - beta_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6502_TAG), - m_speaker(*this, "speaker"), - m_eprom(*this, EPROM_TAG), - m_q6(*this, "Q6"), - m_q7(*this, "Q7"), - m_q8(*this, "Q8"), - m_q9(*this, "Q9") - { } - - required_device m_maincpu; - required_device m_speaker; - required_device m_eprom; - required_ioport m_q6; - required_ioport m_q7; - required_ioport m_q8; - required_ioport m_q9; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( riot_pa_r ); - DECLARE_WRITE8_MEMBER( riot_pa_w ); - DECLARE_READ8_MEMBER( riot_pb_r ); - DECLARE_WRITE8_MEMBER( riot_pb_w ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( beta_eprom ); - DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( beta_eprom ); - - /* EPROM state */ - int m_eprom_oe; - int m_eprom_ce; - UINT16 m_eprom_addr; - UINT8 m_eprom_data; - UINT8 m_old_data; - dynamic_buffer m_eprom_rom; - - /* display state */ - UINT8 m_ls145_p; - UINT8 m_segment; - - emu_timer *m_led_refresh_timer; - TIMER_CALLBACK_MEMBER(led_refresh); -}; - - -/* Memory Maps */ - -static ADDRESS_MAP_START( beta_mem, AS_PROGRAM, 8, beta_state ) - AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x7f00) AM_DEVICE(M6532_TAG, mos6532_t, ram_map) - AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x7f00) AM_DEVICE(M6532_TAG, mos6532_t, io_map) - AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x7800) AM_ROM -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( beta_state::trigger_reset ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -static INPUT_PORTS_START( beta ) - PORT_START("Q6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Q7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Q8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Q9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, beta_state, trigger_reset, 0) -INPUT_PORTS_END - -/* M6532 Interface */ - -TIMER_CALLBACK_MEMBER(beta_state::led_refresh) -{ - if (m_ls145_p < 6) - { - output_set_digit_value(m_ls145_p, m_segment); - } -} - -READ8_MEMBER( beta_state::riot_pa_r ) -{ - /* - - bit description - - PA0 2716 D0, segment D, key bit 0 - PA1 2716 D1, segment E, key bit 1 - PA2 2716 D2, segment C, key bit 2 - PA3 2716 D3, segment G, key bit 3 - PA4 2716 D4, segment F, key bit 4 - PA5 2716 D5, segment B - PA6 2716 D6, segment A - PA7 2716 D7 - - */ - - UINT8 data = 0xff; - - switch (m_ls145_p) - { - case 6: data &= m_q6->read(); break; - case 7: data &= m_q7->read(); break; - case 8: data &= m_q8->read(); break; - case 9: data &= m_q9->read(); break; - default: - if (!m_eprom_oe && !m_eprom_ce) - { - data = m_eprom_rom[m_eprom_addr & 0x7ff]; - popmessage("EPROM read %04x = %02x\n", m_eprom_addr & 0x7ff, data); - } - } - - return data; -} - -WRITE8_MEMBER( beta_state::riot_pa_w ) -{ - /* - - bit description - - PA0 2716 D0, segment D, key bit 0 - PA1 2716 D1, segment E, key bit 1 - PA2 2716 D2, segment C, key bit 2 - PA3 2716 D3, segment G, key bit 3 - PA4 2716 D4, segment F, key bit 4 - PA5 2716 D5, segment B - PA6 2716 D6, segment A - PA7 2716 D7 - - */ - -// logerror("PA %02x\n", data); - - /* display */ - m_segment = BITSWAP8(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f; - m_led_refresh_timer->adjust(attotime::from_usec(70)); - - /* EPROM data */ - m_eprom_data = data; -} - -READ8_MEMBER( beta_state::riot_pb_r ) -{ - return 0; -} - -WRITE8_MEMBER( beta_state::riot_pb_w ) -{ - /* - - bit description - - PB0 74LS145 P0 - PB1 74LS145 P1 - PB2 74LS145 P2 - PB3 74LS145 P3, 74LS164 D - PB4 loudspeaker, data led - PB5 address led, 74LS164 CP - PB6 2716 _OE - PB7 2716 _CE - - */ - - //logerror("PB %02x %02x\n", data, olddata); - - /* display */ - m_ls145_p = data & 0x0f; - - /* speaker */ - m_speaker->level_w(!BIT(data, 4)); - - /* address led */ - output_set_led_value(0, BIT(data, 5)); - - /* data led */ - output_set_led_value(1, !BIT(data, 5)); - - /* EPROM address shift */ - if (!BIT(m_old_data, 5) && BIT(data, 5)) - { - m_eprom_addr <<= 1; - m_eprom_addr |= BIT(m_old_data, 3); - } - - /* EPROM output enable */ - m_eprom_oe = BIT(data, 6); - - /* EPROM chip enable */ - m_eprom_ce = BIT(data, 7); - - if (BIT(data, 6) && (!BIT(m_old_data, 7) && BIT(data, 7))) - { - popmessage("EPROM write %04x = %02x\n", m_eprom_addr & 0x7ff, m_eprom_data); - m_eprom_rom[m_eprom_addr & 0x7ff] &= m_eprom_data; - } - - m_old_data = data; -} - -/* EPROM socket */ - -DEVICE_IMAGE_LOAD_MEMBER( beta_state, beta_eprom ) -{ - UINT32 size = m_eprom->common_get_size("rom"); - - if (size != 0x800) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_eprom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_eprom->common_load_rom(m_eprom->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom ) -{ - if (image.software_entry() == NULL) - image.fwrite(&m_eprom_rom[0], 0x800); -} - -/* Machine Initialization */ - -void beta_state::machine_start() -{ - m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beta_state::led_refresh),this)); - - m_eprom_rom.resize(0x800); - - if (!m_eprom->exists()) - memset(&m_eprom_rom[0], 0xff, 0x800); - else - { - std::string region_tag; - memcpy(&m_eprom_rom[0], memregion(region_tag.assign(m_eprom->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(), 0x800); - } - - // state saving - save_item(NAME(m_eprom_oe)); - save_item(NAME(m_eprom_ce)); - save_item(NAME(m_eprom_addr)); - save_item(NAME(m_eprom_data)); - save_item(NAME(m_old_data)); - save_item(NAME(m_eprom_rom)); - save_item(NAME(m_ls145_p)); - save_item(NAME(m_segment)); -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( beta, beta_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_4MHz/4) - MCFG_CPU_PROGRAM_MAP(beta_mem) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_beta ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(M6532_TAG, MOS6532n, XTAL_4MHz/4) - MCFG_MOS6530n_IN_PA_CB(READ8(beta_state, riot_pa_r)) - MCFG_MOS6530n_OUT_PA_CB(WRITE8(beta_state, riot_pa_w)) - MCFG_MOS6530n_IN_PB_CB(READ8(beta_state, riot_pb_r)) - MCFG_MOS6530n_OUT_PB_CB(WRITE8(beta_state, riot_pb_w)) - MCFG_MOS6530n_IRQ_CB(INPUTLINE(M6502_TAG, M6502_IRQ_LINE)) - - /* EPROM socket */ - MCFG_GENERIC_CARTSLOT_ADD(EPROM_TAG, generic_plain_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(beta_state, beta_eprom) - MCFG_GENERIC_UNLOAD(beta_state, beta_eprom) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( beta ) - ROM_REGION( 0x10000, M6502_TAG, 0 ) - ROM_LOAD( "beta.rom", 0x8000, 0x0800, CRC(d42fdb17) SHA1(595225a0cd43dd76c46b2aff6c0f27d5991cc4f0)) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, beta, 0, 0, beta, beta, driver_device, 0, "Pitronics", "Beta", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/bigbord2.c b/src/mess/drivers/bigbord2.c deleted file mode 100644 index 7f8612a2806..00000000000 --- a/src/mess/drivers/bigbord2.c +++ /dev/null @@ -1,621 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Big Board 2 - - 12/05/2009 Skeleton driver. - - This is very much under construction. - - Despite the name, this is not like the xerox or bigboard at all. - - It is compatible only if the software uses the same published - calls to the bios. Everything else is different. - -80 = sio ce -84 = ctca ce -88 = ctcb ce -8c = dma ce -c0 = prog -c4 = status 7,6,5,4 = sw1-4; 3 = kbdstb; 2 = motor; 1 = rxdb; 0 = rxda -c8 = sys1 -cc = sys2 -d0 = kbd -d4 = 1793 ce -d8 = port7 -dc = 6845 ce - - -Difficulties encountered: - -CTCA controls a pair of vectored interrupts. -One is triggered by a keypress, the other by a vsync pulse.. -Once a key is pressed, CTCA continually issues a keyboard interrupt, -causing a complete freeze. Therefore CTCA has been isolated, and the -2 interrupts are triggered by a hack. It isn't a very good hack, -because the system crashes after a while. However it will allow -testing and development to continue. - -The FDC has a INTRQ pin, the diagram says it goes to page 6, but -it just vanishes instead. - -What works: - -Turn it on, wait for cursor to appear in the top corner. Press Enter. -Now you can enter commands. - -Memory banking: - -0000-7FFF are controlled by bit 0 of port C8, and select ROM&video, or RAM -8000-FFFF control if RAM is onboard, or on S100 bus (do not know what controls this) -We do not emulate the S100, so therefore banks 1&2 are the same as 3&4. -The switching from port C8 is emulated. - -ToDo: -- Finish floppy disk support (i have no boot disk) -- Finish the DMA switch in portcc_w. -- Fix the above problems with the CTC. -- Finish connecting up the SIO, when it becomes usable. -- Connect up the SASI, Centronics and other interfaces on ports D8-DB. -- Connect up the programming port C0-C3. -- Connect up the numerous board jumpers. -- Need software - -Monitor commands: -B - boot from disk -C - copy memory -D - dump memory -F - fill memory -G - go -I - in port -M - modify memory -O - out port -R - read a sector -T - test memory -V - compare blocks of memory -X - change banks - -****************************************************************************/ - - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/z80dma.h" -#include "video/mc6845.h" -#include "machine/keyboard.h" -#include "sound/beep.h" -#include "machine/wd_fdc.h" - -#define SCREEN_TAG "screen" -#define KEYBOARD_TAG "keyboard" -#define Z80_TAG "u39" -#define Z80SIO_TAG "u16" -#define Z80CTCA_TAG "u37" -#define Z80CTCB_TAG "u21" -#define Z80DMA_TAG "u62" - -class bigbord2_state : public driver_device -{ -public: - bigbord2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_6845(*this, "crtc"), - m_ctca(*this, Z80CTCA_TAG), - m_ctcb(*this, Z80CTCB_TAG), - m_dma(*this, Z80DMA_TAG), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_beeper(*this, "beeper"), - m_dsw(*this, "DSW"), - m_bankr(*this, "bankr"), - m_bankv(*this, "bankv"), - m_banka(*this, "banka"), - m_palette(*this, "palette") - { - } - - DECLARE_WRITE8_MEMBER(portc8_w ); - DECLARE_WRITE8_MEMBER(portcc_w ); - DECLARE_READ8_MEMBER(portc4_r); - DECLARE_READ8_MEMBER(portd0_r); - DECLARE_WRITE8_MEMBER(bigbord2_kbd_put); - DECLARE_WRITE_LINE_MEMBER(intrq_w); - DECLARE_WRITE_LINE_MEMBER(drq_w); - DECLARE_WRITE_LINE_MEMBER(frame); - DECLARE_DRIVER_INIT(bigbord2); - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - MC6845_UPDATE_ROW(crtc_update_row); - UINT8 *m_p_chargen; /* character ROM */ - UINT8 *m_p_videoram; /* Video RAM */ - UINT8 *m_p_attribram; /* Attribute RAM */ -private: - UINT8 m_term_data; - UINT8 m_term_status; - int m_c8[8]; - floppy_image_device *m_floppy; - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - void fdc_intrq_w(bool state); - void fdc_drq_w(bool state); - address_space *m_mem; - address_space *m_io; - required_device m_maincpu; - required_device m_6845; - required_device m_ctca; - required_device m_ctcb; - required_device m_dma; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_beeper; - required_ioport m_dsw; - required_memory_bank m_bankr; - required_memory_bank m_bankv; - required_memory_bank m_banka; -public: - required_device m_palette; -}; - -/* Status port - 0 = RXDA - 1 = RXDB - 2 = MOTOR - 3 = KBDSTB - 4 = DIPSW 1 - 5 = DIPSW 2 - 6 = DIPSW 3 - 7 = DIPSW 4 */ - -READ8_MEMBER( bigbord2_state::portc4_r ) -{ - UINT8 ret = m_term_status | 3 | (m_c8[6]<<2) | m_dsw->read(); - m_term_status = 0; - return ret; -} - -// KBD port - read ascii value of key pressed - -READ8_MEMBER( bigbord2_state::portd0_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( bigbord2_state::bigbord2_kbd_put ) -{ - if (data) - { - m_term_data = data; - m_term_status = 8; - m_ctca->trg0(0); - m_ctca->trg0(1); - if (m_mem->read_byte(0xf13d) == 0x4d) - { - // simulate interrupt by saving current pc on - // the stack and jumping to interrupt handler. - UINT16 spreg = m_maincpu->state_int(Z80_SP); - UINT16 pcreg = m_maincpu->state_int(Z80_PC); - spreg--; - m_mem->write_byte(spreg, pcreg >> 8); - spreg--; - m_mem->write_byte(spreg, pcreg); - m_maincpu->set_state_int(Z80_SP, spreg); - m_maincpu->set_state_int(Z80_PC, 0xF120); - } - } -} - -/* Z80 DMA */ - - -READ8_MEMBER(bigbord2_state::memory_read_byte) -{ - return m_mem->read_byte(offset); -} - -WRITE8_MEMBER(bigbord2_state::memory_write_byte) -{ - m_mem->write_byte(offset, data); -} - -READ8_MEMBER(bigbord2_state::io_read_byte) -{ - return m_io->read_byte(offset); -} - -WRITE8_MEMBER(bigbord2_state::io_write_byte) -{ - m_io->write_byte(offset, data); -} - - -/* Read/Write Handlers */ - - -WRITE8_MEMBER( bigbord2_state::portc8_w ) -{ - /* - - This port uses a 74LS259, which allows individual bits - to be switched on and off, while the other bits are - unaffected. - - bit signal description - - 0 D_S memory bank - 1 SIDSEL side select - 2 SMC1 u6 data separator pin 5 - 3 SMC2 u6 data separator pin 6 - 4 DDEN density - 5 HLD head load - 6 MOTOR disk motor - 7 BELL beeper pulse - - */ - - m_c8[data&7] = BIT(data, 3); - - switch (data&7) - { - case 0: - // memory bank - m_bankr->set_entry(m_c8[0]); - m_bankv->set_entry(m_c8[0]); - m_banka->set_entry(m_c8[0]); - break; - case 1: - // side select - if (m_floppy) - { - m_floppy->ss_w(m_c8[1]); - } - - break; - - case 2: - case 3: - // these connect to "U6 (FDC9216B)" which drives the fdc "rawread" and "rclk" pins - break; - case 4: - // density - m_fdc->dden_w(m_c8[4]); - break; - case 5: - // connects to HLD pin on floppy drive - break; - case 6: - // motor on - if (m_floppy) - { - m_floppy->mon_w(~m_c8[6]); - } - break; - case 7: - // beeper - m_beeper->set_state(m_c8[7]); - break; - } -} - -WRITE8_MEMBER( bigbord2_state::portcc_w ) -{ - /* - - bit signal description - - 0,1,2 operates a 74LS151 for 8 individual inputs to DMA RDY - 0 W/RDYA channel A of SIO - 1 W/RDYB channel B of SIO - 2 DRQ DRQ on fdc - 3 JB7 pin 1 - 4 JB7 pin 2 - 5 JB7 pin 3 - 6 JB7 pin 4 - 7 JB7 pin 5 - 3 /TEST test pin on FDC - 4 DS3 drive 3 select - 5 DS2 drive 2 select - 6 DS1 drive 1 select - 7 DS0 drive 0 select - - */ - - /* drive select */ - m_floppy = NULL; - if BIT(data, 7) m_floppy = m_floppy0->get_device(); - if BIT(data, 6) m_floppy = m_floppy1->get_device(); - //if BIT(data, 5) m_floppy = m_floppy2->get_device(); - //if BIT(data, 4) m_floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(m_floppy); - - bool dma_rdy = 0; - if ((data & 7) == 2) - dma_rdy = m_fdc->drq_r(); - - m_dma->rdy_w(dma_rdy); -} - - - -/* Memory Maps */ - -static ADDRESS_MAP_START( bigbord2_mem, AS_PROGRAM, 8, bigbord2_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bankr") - AM_RANGE(0x1000, 0x5fff) AM_RAM - AM_RANGE(0x6000, 0x6fff) AM_RAMBANK("bankv") - AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("banka") - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( bigbord2_io, AS_IO, 8, bigbord2_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) - //AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(Z80CTCA_TAG, z80ctc_device, read, write) //has issues - AM_RANGE(0x88, 0x8b) AM_DEVREADWRITE(Z80CTCB_TAG, z80ctc_device, read, write) - AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) - //AM_RANGE(0xC0, 0xC3) eprom programming port - AM_RANGE(0xC4, 0xC7) AM_READ(portc4_r) - AM_RANGE(0xC8, 0xCB) AM_WRITE(portc8_w) - AM_RANGE(0xCC, 0xCF) AM_WRITE(portcc_w) - AM_RANGE(0xD0, 0xD3) AM_READ(portd0_r) - AM_RANGE(0xD4, 0xD7) AM_DEVREADWRITE("fdc", mb8877_t, read, write) - //AM_RANGE(0xD8, 0xDB) AM_READWRITE(portd8_r, portd8_w) // various external data ports; DB = centronics printer - AM_RANGE(0xDC, 0xDC) AM_MIRROR(2) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0xDD, 0xDD) AM_MIRROR(2) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) -ADDRESS_MAP_END - - -/* Input Ports */ - -static INPUT_PORTS_START( bigbord2 ) - PORT_START("DSW") - PORT_BIT( 0xf, 0, IPT_UNUSED ) - PORT_DIPNAME( 0x10, 0x10, "Switch 4") PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x10, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x20, 0x00, "Switch 3") PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x20, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x40, 0x00, "Switch 2") PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x40, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x80, 0x00, "Switch 1") PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x80, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) -INPUT_PORTS_END - - -/* Z80 CTC */ - -TIMER_DEVICE_CALLBACK_MEMBER(bigbord2_state::ctc_tick) -{ - m_ctcb->trg0(1); - m_ctcb->trg1(1); - m_ctcb->trg0(0); - m_ctcb->trg1(0); -} - -WRITE_LINE_MEMBER( bigbord2_state::frame ) -{ - static UINT8 framecnt; - framecnt++; - - if ((m_mem->read_byte(0xf13d) == 0x4d) & (framecnt > 3)) - { - framecnt = 0; - // simulate interrupt by saving current pc on - // the stack and jumping to interrupt handler. - UINT16 spreg = m_maincpu->state_int(Z80_SP); - UINT16 pcreg = m_maincpu->state_int(Z80_PC); - spreg--; - m_mem->write_byte(spreg, pcreg >> 8); - spreg--; - m_mem->write_byte(spreg, pcreg); - m_maincpu->set_state_int(Z80_SP, spreg); - m_maincpu->set_state_int(Z80_PC, 0xF18E); - } -} - - -/* Z80 Daisy Chain */ - -static const z80_daisy_config bigbord2_daisy_chain[] = -{ - { Z80DMA_TAG }, - { Z80CTCA_TAG }, - { Z80CTCB_TAG }, - { Z80SIO_TAG }, - { NULL } -}; - -/* WD1793 Interface */ - -static SLOT_INTERFACE_START( bigbord2_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - - -/* Video */ - -void bigbord2_state::video_start() -{ - /* find memory regions */ - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion(Z80_TAG)->base()+0x6000; - m_p_attribram = memregion(Z80_TAG)->base()+0x7000; -} - - -/* Machine Initialization */ - -void bigbord2_state::machine_start() -{ - /* register for state saving */ - save_item(NAME(m_term_data)); -} - -void bigbord2_state::machine_reset() -{ - UINT8 i; - for (i = 0; i < 8; i++) - m_c8[i] = 0; - m_beeper->set_state(0); - m_beeper->set_frequency(950); // actual frequency is unknown - m_bankr->set_entry(0); - m_bankv->set_entry(0); - m_banka->set_entry(0); -} - -DRIVER_INIT_MEMBER(bigbord2_state,bigbord2) -{ - m_mem = &m_maincpu->space(AS_PROGRAM); - m_io = &m_maincpu->space(AS_IO); - UINT8 *RAM = memregion(Z80_TAG)->base(); - m_bankr->configure_entries(0, 2, &RAM[0x0000], 0x10000); - m_bankv->configure_entries(0, 2, &RAM[0x6000], 0x10000); - m_banka->configure_entries(0, 2, &RAM[0x7000], 0x10000); -} - - -/* Screen */ - -/* F4 Character Displayer */ -static const gfx_layout bigbord2_charlayout = -{ - 8, 16, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( bigbord2 ) - GFXDECODE_ENTRY( "chargen", 0x0000, bigbord2_charlayout, 0, 1 ) -GFXDECODE_END - -MC6845_UPDATE_ROW( bigbord2_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,inv; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - inv=0; - mem = (ma + x) & 0x7ff; - if (BIT(m_p_attribram[mem], 7)) inv^=0xff; - chr = m_p_videoram[mem]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; - - /* Display a scanline of a character */ - *p++ = palette[BIT( gfx, 7 )]; - *p++ = palette[BIT( gfx, 6 )]; - *p++ = palette[BIT( gfx, 5 )]; - *p++ = palette[BIT( gfx, 4 )]; - *p++ = palette[BIT( gfx, 3 )]; - *p++ = palette[BIT( gfx, 2 )]; - *p++ = palette[BIT( gfx, 1 )]; - *p++ = palette[BIT( gfx, 0 )]; - } -} - -/* Machine Drivers */ - -#define MAIN_CLOCK XTAL_8MHz / 2 - -static MACHINE_CONFIG_START( bigbord2, bigbord2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, MAIN_CLOCK) - MCFG_CPU_PROGRAM_MAP(bigbord2_mem) - MCFG_CPU_IO_MAP(bigbord2_io) - MCFG_CPU_CONFIG(bigbord2_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_10_69425MHz, 700, 0, 560, 260, 0, 240) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", bigbord2) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* keyboard */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bigbord2_state, ctc_tick, attotime::from_hz(MAIN_CLOCK)) - - /* devices */ - MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, MAIN_CLOCK) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(bigbord2_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(bigbord2_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(bigbord2_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(bigbord2_state, io_write_byte)) - - MCFG_Z80SIO0_ADD(Z80SIO_TAG, MAIN_CLOCK, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80CTCA_TAG, Z80CTC, MAIN_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - // other inputs of ctca: - // trg0 = KBDSTB; trg1 = index pulse from fdc; trg2 = synca output from sio - - MCFG_DEVICE_ADD(Z80CTCB_TAG, Z80CTC, MAIN_CLOCK / 6) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - // ZC0 = SIO channel B clock, ZC1 = SIO channel A clock - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTCB_TAG, z80ctc_device, trg3)) - - MCFG_MB8877_ADD("fdc", XTAL_16MHz / 16) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", bigbord2_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", bigbord2_floppies, "525dd", floppy_image_device::default_floppy_formats) - - MCFG_MC6845_ADD("crtc", MC6845, SCREEN_TAG, XTAL_16MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(bigbord2_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(bigbord2_state, frame)) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(bigbord2_state, bigbord2_kbd_put)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - -/* ROMs */ - - -ROM_START( bigbord2 ) - ROM_REGION( 0x18000, Z80_TAG, 0 ) - ROM_LOAD( "bigbrdii.bin", 0x0000, 0x1000, CRC(c588189e) SHA1(4133903171ee8b9fcf12cc72de843af782b4a645) ) - - // internal to 8002 chip (undumped) we will use one from 'vta2000' for now - ROM_REGION( 0x2000, "chargen", ROMREGION_INVERT ) - ROM_LOAD( "bdp-15_14.rom", 0x0000, 0x2000, BAD_DUMP CRC(a1dc4f8e) SHA1(873fd211f44713b713d73163de2d8b5db83d2143) ) -ROM_END -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, bigbord2, bigboard, 0, bigbord2, bigbord2, bigbord2_state, bigbord2, "Digital Research Computers", "Big Board II", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/binbug.c b/src/mess/drivers/binbug.c deleted file mode 100644 index 14c079e6156..00000000000 --- a/src/mess/drivers/binbug.c +++ /dev/null @@ -1,590 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - BINBUG and DG640 - - 2013-01-14 Driver created - - All input must be in uppercase. - - Commands: - A - See and alter memory - B - Set breakpoint (2 permitted) - C - Clear breakpoint - D - cassette save - G - Go to address, run - L - cassette load - S - See and alter registers - - BINBUG is an alternate bios to PIPBUG, however it uses its own - video output. Method of output is through a DG640 board (sold by - Applied Technology) which uses a MCM6574 as a character generator. - The DG640 also supports blinking, reverse-video, and LORES graphics. - It is a S100 card, also known as ETI-640. - - Keyboard input, like PIPBUG, is via a serial device. - The baud rate is 300, 8N1. - - The SENSE and FLAG lines are used for 300 baud cassette, in - conjunction with unknown hardware. - - There are 3 versions of BINBUG: - - - 3.6 300 baud tape routines, 300 baud keyboard, memory-mapped VDU - - - 4.4 300 baud keyboard, ACOS tape system, advanced video routines - - - 5.2 ACOS tape system, 1200 baud terminal - - - Status: - - DG640 is completely emulated, even though BINBUG doesn't use most - of its features. - - BINBUG works except that the cassette interface isn't the same as - real hardware. But you can save, and load it back. - - ToDo: - - Need dumps of 4.4 and 5.2. - - Fix cassette - -****************************************************************************/ - -#include "bus/rs232/keyboard.h" -#include "cpu/s2650/s2650.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "imagedev/snapquik.h" - -#define KEYBOARD_TAG "keyboard" - -class binbug_state : public driver_device -{ -public: - binbug_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_rs232(*this, KEYBOARD_TAG), - m_cass(*this, "cassette"), - m_p_videoram(*this, "videoram"), - m_p_attribram(*this, "attribram"), - m_maincpu(*this, "maincpu") - { - } - - DECLARE_WRITE8_MEMBER(binbug_ctrl_w); - DECLARE_READ8_MEMBER(binbug_serial_r); - DECLARE_WRITE_LINE_MEMBER(binbug_serial_w); - const UINT8 *m_p_chargen; - UINT8 m_framecnt; - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - optional_device m_rs232; - required_device m_cass; - required_shared_ptr m_p_videoram; - required_shared_ptr m_p_attribram; - required_device m_maincpu; - DECLARE_QUICKLOAD_LOAD_MEMBER( binbug ); -}; - -WRITE8_MEMBER( binbug_state::binbug_ctrl_w ) -{ -} - -READ8_MEMBER( binbug_state::binbug_serial_r ) -{ - return m_rs232->rxd_r() & (m_cass->input() < 0.03); -} - -WRITE_LINE_MEMBER( binbug_state::binbug_serial_w ) -{ - m_cass->output(state ? -1.0 : +1.0); -} - -static ADDRESS_MAP_START(binbug_mem, AS_PROGRAM, 8, binbug_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x03ff) AM_ROM - AM_RANGE( 0x0400, 0x77ff) AM_RAM - AM_RANGE( 0x7800, 0x7bff) AM_RAM AM_SHARE("videoram") - AM_RANGE( 0x7c00, 0x7fff) AM_RAM AM_SHARE("attribram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(binbug_io, AS_IO, 8, binbug_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_WRITE(binbug_ctrl_w) - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(binbug_serial_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( binbug ) -INPUT_PORTS_END - -void binbug_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 binbug_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -// attributes bit 0 = flash, bit 1 = lores. Also bit 7 of the character = reverse-video (text only). - UINT8 y,ra,chr,gfx,attr,inv,gfxbit; - UINT16 sy=0,ma=0,x; - bool flash; - m_framecnt++; - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 16; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x++) - { - attr = m_p_attribram[x]; - chr = m_p_videoram[x]; - flash = BIT(m_framecnt, 4) & BIT(attr, 0); - - if (BIT(attr, 1)) // lores gfx - can flash - { - if (flash) chr = 0; // blank part of flashing - - gfxbit = (ra & 0x0c)>>1; - /* Display one line of a lores character (8 pixels) */ - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - gfxbit++; - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - } - else - { - gfx = 0; - - if (!flash) - { - inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed - chr &= 0x7f; - gfx = inv; - - // if g,j,p,q,y; lower the descender - if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79)) - { - if (ra > 6) - gfx = m_p_chargen[(chr<<4) | (ra-7) ] ^ inv; - } - else - { - if ((ra > 3) & (ra < 13)) - gfx = m_p_chargen[(chr<<4) | (ra-4) ] ^ inv; - } - } - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - } - ma+=64; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout dg640_charlayout = -{ - 7, 9, /* 7 x 9 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( dg640 ) - GFXDECODE_ENTRY( "chargen", 0x0000, dg640_charlayout, 0, 1 ) -GFXDECODE_END - -QUICKLOAD_LOAD_MEMBER( binbug_state, binbug ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int i; - int quick_addr = 0x440; - int exec_addr; - int quick_length; - dynamic_buffer quick_data; - int read_; - int result = IMAGE_INIT_FAIL; - - quick_length = image.length(); - if (quick_length < 0x0444) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); - image.message(" File too short"); - } - else if (quick_length > 0x8000) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); - image.message(" File too long"); - } - else - { - quick_data.resize(quick_length); - read_ = image.fread( &quick_data[0], quick_length); - if (read_ != quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); - image.message(" Cannot read the file"); - } - else if (quick_data[0] != 0xc4) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); - image.message(" Invalid header"); - } - else - { - exec_addr = quick_data[1] * 256 + quick_data[2]; - - if (exec_addr >= quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); - image.message(" Exec address beyond end of file"); - } - else - { - for (i = quick_addr; i < read_; i++) - space.write_byte(i, quick_data[i]); - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); - - // Start the quickload - m_maincpu->set_state_int(S2650_PC, exec_addr); - - result = IMAGE_INIT_PASS; - } - } - } - - return result; -} - -static DEVICE_INPUT_DEFAULTS_START( keyboard ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_300 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -static MACHINE_CONFIG_START( binbug, binbug_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(binbug_mem) - MCFG_CPU_IO_MAP(binbug_io) - MCFG_S2650_FLAG_HANDLER(WRITELINE(binbug_state, binbug_serial_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(binbug_state, screen_update) - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", dg640) - MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") - - /* Keyboard */ - MCFG_RS232_PORT_ADD(KEYBOARD_TAG, default_rs232_devices, "keyboard") - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("keyboard", keyboard) - - /* Cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", binbug_state, binbug, "pgm", 1) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( binbug ) - ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "binbug.rom", 0x0000, 0x0400, CRC(2cb1ac6e) SHA1(a969883fc767484d6b0fa103cfa4b4129b90441b) ) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "6574.bin", 0x0000, 0x0800, CRC(fd75df4f) SHA1(4d09aae2f933478532b7d3d1a2dee7123d9828ca) ) - ROM_FILL(0, 16, 0) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, binbug, pipbug, 0, binbug, binbug, driver_device, 0, "MicroByte", "BINBUG 3.6", 0 ) - - - -/******************************************************************************************************************/ - -/* - -DG680 (ETI-680), using the DGOS-Z80 operating system. - -This is a S100 card. - -In some ways, this system is the ancestor of the original Microbee. - -ROM is typed in from a PDF, therefore marked a bad dump. - -No schematic available, most of this is guesswork. - -Port 0 is the input from an ascii keyboard. - -Port 2 is the cassette interface. - -Port 8 controls some kind of memory protection scheme. -The code indicates that B is the page to protect, and -A is the code (0x08 = inhibit; 0x0B = unprotect; -0x0C = enable; 0x0E = protect). There are 256 pages so -each page is 256 bytes. - -The clock is controlled by the byte in D80D. - -Monitor Commands: -C (compare)* -E (edit)* -F (fill)* -G - Go to address -I - Inhibit CTC -M (move)* -P (clear screen)* -R (read tape)* -S (search)* -T hhmm [ss] - Set the time -W (write tape)* -X - protection status -XC - clear ram -XD - same as X -XE - enable facilities -XF - disable facilities -XP - protect block -XU - unprotect block -Z - go to 0000. - -* These commands are identical to the Microbee ones. - -ToDo: -- dips -- leds -- need schematic to find out what else is missing -- cassette -- ctc / clock - -*/ - - -#include "cpu/z80/z80.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "cpu/z80/z80daisy.h" - - -class dg680_state : public binbug_state -{ -public: - dg680_state(const machine_config &mconfig, device_type type, const char *tag) - : binbug_state(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ctc(*this, "z80ctc"), - m_pio(*this, "z80pio") - { } - - DECLARE_READ8_MEMBER(porta_r); - DECLARE_READ8_MEMBER(portb_r); - DECLARE_WRITE8_MEMBER(portb_w); - DECLARE_READ8_MEMBER(port08_r); - DECLARE_WRITE8_MEMBER(port08_w); - DECLARE_WRITE8_MEMBER(kbd_put); - TIMER_DEVICE_CALLBACK_MEMBER(time_tick); - TIMER_DEVICE_CALLBACK_MEMBER(uart_tick); - UINT8 m_pio_b; - UINT8 m_term_data; - UINT8 m_protection[0x100]; - virtual void machine_reset(); - required_device m_maincpu; - required_device m_ctc; - required_device m_pio; -}; - -static ADDRESS_MAP_START(dg680_mem, AS_PROGRAM, 8, dg680_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xcfff) AM_RAM - AM_RANGE( 0xd000, 0xd7ff) AM_ROM - AM_RANGE( 0xd800, 0xefff) AM_RAM - AM_RANGE( 0xf000, 0xf3ff) AM_RAM AM_SHARE("videoram") - AM_RANGE( 0xf400, 0xf7ff) AM_RAM AM_SHARE("attribram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(dg680_io, AS_IO, 8, dg680_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00,0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x04,0x07) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0x08,0x08) AM_READWRITE(port08_r,port08_w) //SWP Control and Status - //AM_RANGE(0x09,0x09) parallel input port - // Optional AM9519 Programmable Interrupt Controller (port c = data, port d = control) - //AM_RANGE(0x0c,0x0d) AM_DEVREADWRITE("am9519", am9519_device, read, write) -ADDRESS_MAP_END - -void dg680_state::machine_reset() -{ - m_maincpu->set_pc(0xd000); -} - -// this is a guess there is no information available -static const z80_daisy_config dg680_daisy_chain[] = -{ - { "z80ctc" }, - { "z80pio" }, - { NULL } -}; - - -/* Input ports */ -static INPUT_PORTS_START( dg680 ) -INPUT_PORTS_END - -WRITE8_MEMBER( dg680_state::kbd_put ) -{ - m_term_data = data; - /* strobe in keyboard data */ - m_pio->strobe_a(0); - m_pio->strobe_a(1); -} - -READ8_MEMBER( dg680_state::porta_r ) -{ - UINT8 data = m_term_data; - m_term_data = 0; - return data; -} - -READ8_MEMBER( dg680_state::portb_r ) -{ - return m_pio_b | (m_cass->input() > 0.03); -} - -// bit 1 = cassout; bit 2 = motor on -WRITE8_MEMBER( dg680_state::portb_w ) -{ - m_pio_b = data & 0xfe; - m_cass->output(BIT(data, 1) ? -1.0 : +1.0); -} - -READ8_MEMBER( dg680_state::port08_r ) -{ - UINT8 breg = m_maincpu->state_int(Z80_B); - return m_protection[breg]; -} - -WRITE8_MEMBER( dg680_state::port08_w ) -{ - UINT8 breg = m_maincpu->state_int(Z80_B); - m_protection[breg] = data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(dg680_state::time_tick) -{ -// ch0 is for the clock - m_ctc->trg0(1); - m_ctc->trg0(0); -// no idea about ch2 - m_ctc->trg2(1); - m_ctc->trg2(0); -} - -TIMER_DEVICE_CALLBACK_MEMBER(dg680_state::uart_tick) -{ -// ch3 is for cassette - m_ctc->trg3(1); - m_ctc->trg3(0); -} - -static MACHINE_CONFIG_START( dg680, dg680_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz / 4) - MCFG_CPU_PROGRAM_MAP(dg680_mem) - MCFG_CPU_IO_MAP(dg680_io) - MCFG_CPU_CONFIG(dg680_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(binbug_state, screen_update) - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", dg640) - MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") - - /* Keyboard */ - MCFG_DEVICE_ADD("keyb", GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(dg680_state, kbd_put)) - - /* Cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_8MHz / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_8MHz / 4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(dg680_state, porta_r)) - // OUT_ARDY - this activates to ask for kbd data but not known if actually used - MCFG_Z80PIO_IN_PB_CB(READ8(dg680_state, portb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(dg680_state, portb_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc0", dg680_state, time_tick, attotime::from_hz(200)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc3", dg680_state, uart_tick, attotime::from_hz(4800)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( dg680 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "dg680.rom", 0xd000, 0x0800, BAD_DUMP CRC(c1aaef6a) SHA1(1508ca8315452edfb984718e795ccbe79a0c0b58) ) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "6574.bin", 0x0000, 0x0800, CRC(fd75df4f) SHA1(4d09aae2f933478532b7d3d1a2dee7123d9828ca) ) - - ROM_REGION( 0x0020, "proms", 0 ) - ROM_LOAD( "82s123.bin", 0x0000, 0x0020, NO_DUMP ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, dg680, 0, 0, dg680, dg680, driver_device, 0, "David Griffiths", "DG680 with DGOS-Z80 1.4", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/bitgraph.c b/src/mess/drivers/bitgraph.c deleted file mode 100644 index 8209fe9f20c..00000000000 --- a/src/mess/drivers/bitgraph.c +++ /dev/null @@ -1,622 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - BBN BitGraph -- monochrome, raster graphics (768x1024), serial terminal. - - Apparently had at least four hardware revisions, A-D, but which ROM - revisions support which hardware is unclear. A Versabus slot, and - various hardware and software options are mentioned in the docs. Best - guesses follow. - - Onboard hardware (common to all revisions) is - - 32K ROM - - 128K RAM (includes frame buffer) - - 3 serial ports, each driven by 6850 ACIA - - some kind of baud rate generator, possibly COM8016 - - sync serial port, driven by 6854 but apparently never supported by ROM - - 682x PIA - - AY-3-891x PSG - - ER2055 EAROM - - DEC VT100 keyboard interface - - Rev A has additional 4th serial port for mouse (not supported by ROM 1.25). - Rev A has 40 hz realtime clock, the rest use 1040 hz. - Rev A-C use AY-3-8912 (with one external PIO port, to connect the EAROM). - Rev D uses AY-3-8913 (no external ports; EAROM is wired to TBD). - Rev B-D have onboard 8035 to talk to parallel printer and mouse. - Rev B-D have more memory (at least up to 512K). - - ROM 1.25 doesn't support mouse, setup mode, pixel data upload and autowrap. - - Missing/incorrect emulation: - Bidirectional keyboard interface (to drive LEDs and speaker). - 8035. - EAROM. - 1.25 only -- clksync() is dummied out -- causes watchdog resets. - Selectable memory size. - Video enable/reverse video switch. - -****************************************************************************/ - -#include "emu.h" - -#include "bus/centronics/ctronics.h" -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/6821pia.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "machine/com8116.h" -#include "machine/er2055.h" -#include "machine/i8243.h" -#include "machine/mc6854.h" -#include "machine/ram.h" -#include "sound/ay8910.h" - -#include "bitgrpha.lh" -#include "bitgrphb.lh" - -#define M68K_TAG "maincpu" -#define PPU_TAG "ppu" - -#define ACIA0_TAG "acia0" -#define ACIA1_TAG "acia1" -#define ACIA2_TAG "acia2" -#define ACIA3_TAG "acia3" -#define RS232_H_TAG "rs232host" -#define RS232_K_TAG "rs232kbd" -#define RS232_D_TAG "rs232debug" -#define RS232_M_TAG "rs232mouse" -#define COM8116_A_TAG "com8116_a" -#define COM8116_B_TAG "com8116_b" -#define ADLC_TAG "adlc" -#define PIA_TAG "pia" -#define PSG_TAG "psg" -#define EAROM_TAG "earom" - -#define VERBOSE_DBG 1 /* general debug messages */ - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - -class bitgraph_state : public driver_device -{ -public: - bitgraph_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, M68K_TAG) - , m_ram(*this, RAM_TAG) - , m_acia0(*this, ACIA0_TAG) - , m_acia1(*this, ACIA1_TAG) - , m_acia2(*this, ACIA2_TAG) - , m_acia3(*this, ACIA3_TAG) - , m_adlc(*this, ADLC_TAG) - , m_dbrga(*this, COM8116_A_TAG) - , m_dbrgb(*this, COM8116_B_TAG) - , m_pia(*this, PIA_TAG) - , m_psg(*this, PSG_TAG) - , m_earom(*this, EAROM_TAG) - , m_centronics(*this, "centronics") - , m_screen(*this, "screen") - { } - - DECLARE_READ8_MEMBER( pia_r ); - DECLARE_WRITE8_MEMBER( pia_w ); - DECLARE_READ8_MEMBER( pia_pa_r ); - DECLARE_READ8_MEMBER( pia_pb_r ); - DECLARE_WRITE8_MEMBER( pia_pa_w ); - DECLARE_WRITE8_MEMBER( pia_pb_w ); - DECLARE_READ_LINE_MEMBER( pia_ca1_r ); - DECLARE_READ_LINE_MEMBER( pia_cb1_r ); - DECLARE_WRITE_LINE_MEMBER( pia_ca2_w ); - DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); - - DECLARE_WRITE16_MEMBER( baud_write ); - DECLARE_WRITE_LINE_MEMBER( com8116_a_fr_w ); - DECLARE_WRITE_LINE_MEMBER( com8116_a_ft_w ); - DECLARE_WRITE_LINE_MEMBER( com8116_b_fr_w ); - DECLARE_WRITE_LINE_MEMBER( com8116_b_ft_w ); - - DECLARE_READ8_MEMBER( adlc_r ); - DECLARE_WRITE8_MEMBER( adlc_w ); - - DECLARE_WRITE8_MEMBER( earom_write ); - DECLARE_WRITE8_MEMBER( misccr_write ); - DECLARE_WRITE_LINE_MEMBER( system_clock_write ); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( ppu_read ); - DECLARE_WRITE8_MEMBER( ppu_write ); - DECLARE_WRITE8_MEMBER( ppu_i8243_w ); - -private: - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_ram; - required_device m_acia0; - required_device m_acia1; - required_device m_acia2; - optional_device m_acia3; - optional_device m_adlc; - required_device m_dbrga; - required_device m_dbrgb; - required_device m_pia; - required_device m_psg; - required_device m_earom; - optional_device m_centronics; - required_device m_screen; - - UINT8 *m_videoram; - UINT8 m_misccr; - UINT8 m_pia_a; - UINT8 m_pia_b; - UINT8 m_ppu[4]; -}; - -static ADDRESS_MAP_START(bitgrapha_mem, AS_PROGRAM, 16, bitgraph_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x007fff) AM_ROM - AM_RANGE(0x010000, 0x010001) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, data_r, data_w, 0xff00) // HOST - AM_RANGE(0x010002, 0x010003) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, status_r, control_w, 0xff00) - AM_RANGE(0x010008, 0x010009) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, data_r, data_w, 0x00ff) // KEYBOARD - AM_RANGE(0x01000a, 0x01000b) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, status_r, control_w, 0x00ff) - AM_RANGE(0x010010, 0x010011) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, data_r, data_w, 0x00ff) // DEBUGGER - AM_RANGE(0x010012, 0x010013) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, status_r, control_w, 0x00ff) - AM_RANGE(0x010018, 0x010019) AM_DEVREADWRITE8(ACIA3_TAG, acia6850_device, data_r, data_w, 0x00ff) // POINTER - AM_RANGE(0x01001a, 0x01001b) AM_DEVREADWRITE8(ACIA3_TAG, acia6850_device, status_r, control_w, 0x00ff) - AM_RANGE(0x010020, 0x010027) AM_READWRITE8(adlc_r, adlc_w, 0xff00) - AM_RANGE(0x010028, 0x01002f) AM_READWRITE8(pia_r, pia_w, 0xff00) // EAROM, PSG - AM_RANGE(0x010030, 0x010031) AM_WRITE(baud_write) - AM_RANGE(0x3e0000, 0x3fffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(bitgraphb_mem, AS_PROGRAM, 16, bitgraph_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x007fff) AM_ROM - AM_RANGE(0x010000, 0x010001) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, data_r, data_w, 0xff00) // HOST - AM_RANGE(0x010002, 0x010003) AM_DEVREADWRITE8(ACIA0_TAG, acia6850_device, status_r, control_w, 0xff00) - AM_RANGE(0x010008, 0x010009) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, data_r, data_w, 0x00ff) // KEYBOARD - AM_RANGE(0x01000a, 0x01000b) AM_DEVREADWRITE8(ACIA1_TAG, acia6850_device, status_r, control_w, 0x00ff) - AM_RANGE(0x010010, 0x010011) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, data_r, data_w, 0x00ff) // DEBUGGER - AM_RANGE(0x010012, 0x010013) AM_DEVREADWRITE8(ACIA2_TAG, acia6850_device, status_r, control_w, 0x00ff) - AM_RANGE(0x01001a, 0x01001b) AM_WRITE8(misccr_write, 0x00ff) - AM_RANGE(0x010020, 0x010027) AM_READWRITE8(adlc_r, adlc_w, 0xff00) - AM_RANGE(0x010028, 0x01002f) AM_READWRITE8(pia_r, pia_w, 0xff00) // EAROM, PSG - AM_RANGE(0x010030, 0x010031) AM_WRITE(baud_write) -// AM_RANGE(0x010030, 0x010037) AM_READ8(ppu_read, 0x00ff) -// AM_RANGE(0x010038, 0x01003f) AM_WRITE8(ppu_write, 0x00ff) - AM_RANGE(0x380000, 0x3fffff) AM_RAM -ADDRESS_MAP_END - -static INPUT_PORTS_START(bitgraph) -INPUT_PORTS_END - -READ8_MEMBER(bitgraph_state::pia_r) -{ - DBG_LOG(3,"PIA", ("R %d\n", offset)); - return m_pia->read(space, 3-offset); -} - -WRITE8_MEMBER(bitgraph_state::pia_w) -{ - DBG_LOG(3,"PIA", ("W %d < %02X\n", offset, data)); - return m_pia->write(space, 3-offset, data); -} - -READ_LINE_MEMBER(bitgraph_state::pia_ca1_r) -{ - return m_screen->frame_number() & 1; -} - -WRITE_LINE_MEMBER(bitgraph_state::pia_cb2_w) -{ - // XXX shut up verbose log -} - -READ8_MEMBER(bitgraph_state::pia_pa_r) -{ - UINT8 data = BIT(m_pia_b, 3) ? m_earom->data() : m_pia_a; - DBG_LOG(2,"PIA", ("A == %02X (%s)\n", data, BIT(m_pia_b, 3) ? "earom" : "pia")); - return data; -} - -WRITE8_MEMBER(bitgraph_state::pia_pa_w) -{ - DBG_LOG(2,"PIA", ("A <- %02X\n", data)); - m_pia_a = data; -} - -/* - B0 O: BC1 to noisemaker. - B1 O: BDIR to noisemaker. - B2 O: Clock for EAROM. - B3 O: CS1 for EAROM. - B4 O: Enable HDLC Xmt interrupt. - B5 O: Enable HDLC Rcv interrupt. - B6 O: Clear Clock interrupt. Must write a 0 [clear interrupt], then a 1. - B7 I: EVEN field ?? -*/ -READ8_MEMBER(bitgraph_state::pia_pb_r) -{ - DBG_LOG(2,"PIA", ("B == %02X\n", m_pia_b)); - return m_pia_b; -} - -WRITE8_MEMBER(bitgraph_state::pia_pb_w) -{ - DBG_LOG(2,"PIA", ("B <- %02X\n", data)); - m_pia_b = data; - - switch (m_pia_b & 0x03) { - case 2: m_psg->data_w(space, 0, m_pia_a); break; - case 3: m_psg->address_w(space, 0, m_pia_a); break; - } - - if (BIT(m_pia_b, 3)) { - DBG_LOG(2,"EAROM", ("data <- %02X\n", m_pia_a)); - m_earom->set_data(m_pia_a); - } - // CS1, ~CS2, C1, C2, CK - m_earom->set_control(BIT(m_pia_b, 3), BIT(m_pia_b, 3), BIT(m_pia_a, 6), BIT(m_pia_a, 7), BIT(m_pia_b, 2)); - - if (!BIT(m_pia_b, 6)) { - m_maincpu->set_input_line(M68K_IRQ_6, CLEAR_LINE); - } -} - -WRITE8_MEMBER(bitgraph_state::earom_write) -{ - DBG_LOG(2,"EAROM", ("addr <- %02X (%02X)\n", data & 0x3f, data)); - m_earom->set_address(data & 0x3f); -} - -// written once and never changed -WRITE8_MEMBER(bitgraph_state::misccr_write) -{ - DBG_LOG(1,"MISCCR", ("<- %02X (DTR %d MAP %d)\n", data, BIT(data, 3), (data & 3))); - m_misccr = data; -} - -WRITE_LINE_MEMBER(bitgraph_state::system_clock_write) -{ - if (!BIT(m_pia_b, 6)) { - m_maincpu->set_input_line(M68K_IRQ_6, CLEAR_LINE); - return; - } - if (state) { - m_maincpu->set_input_line_and_vector(M68K_IRQ_6, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - } else { - m_maincpu->set_input_line(M68K_IRQ_6, CLEAR_LINE); - } -} - -WRITE16_MEMBER(bitgraph_state::baud_write) -{ - DBG_LOG(1,"Baud", ("%04X\n", data)); - m_dbrgb->str_w(data & 15); // 2 DBG - m_dbrga->stt_w((data >> 4) & 15); // 1 KBD - m_dbrgb->stt_w((data >> 8) & 15); // 3 PNT - m_dbrga->str_w((data >> 12) & 15); // 0 HOST -} - -WRITE_LINE_MEMBER(bitgraph_state::com8116_a_fr_w) -{ - m_acia0->write_txc(state); - m_acia0->write_rxc(state); -} - -WRITE_LINE_MEMBER(bitgraph_state::com8116_a_ft_w) -{ - m_acia1->write_txc(state); - m_acia1->write_rxc(state); -} - -WRITE_LINE_MEMBER(bitgraph_state::com8116_b_fr_w) -{ - m_acia2->write_txc(state); - m_acia2->write_rxc(state); -} - -WRITE_LINE_MEMBER(bitgraph_state::com8116_b_ft_w) -{ - if (m_acia3) { - m_acia3->write_txc(state); - m_acia3->write_rxc(state); - } -} - -READ8_MEMBER(bitgraph_state::adlc_r) -{ - DBG_LOG(1,"ADLC", ("R %d\n", offset)); - return m_adlc ? m_adlc->read(space, 3-offset) : 0xff; -} - -WRITE8_MEMBER(bitgraph_state::adlc_w) -{ - DBG_LOG(1,"ADLC", ("W %d < %02X\n", offset, data)); - if (m_adlc) return m_adlc->write(space, 3-offset, data); -} - -UINT32 bitgraph_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 gfx=0; - int x,y; - - for (y = 0; y < 768; y++) - { - UINT16 *p = &bitmap.pix16(y); - - for (x = 0; x < 1024/8; x+=2) - { - gfx = m_videoram[ (x+1) | (y<<7)]; - - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - - gfx = m_videoram[ x | (y<<7)]; - - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - return 0; -} - -READ8_MEMBER(bitgraph_state::ppu_read) -{ - UINT8 data = m_ppu[offset]; - DBG_LOG(1,"PPU", ("%d == %02X\n", offset, data)); - return data; -} - -WRITE8_MEMBER(bitgraph_state::ppu_write) -{ - DBG_LOG(1,"PPU", ("%d <- %02X\n", offset, data)); - m_ppu[offset] = data; -} - -#ifdef UNUSED_FUNCTION -static ADDRESS_MAP_START(ppu_io, AS_IO, 8, bitgraph_state) -// AM_RANGE(0x00, 0x00) AM_READ(ppu_irq) -// AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) -// AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(ppu_t0_r) - AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w) -ADDRESS_MAP_END -#endif - -/* - p4 O: Centronics data 3..0 - p5 O: Centronics data 7..4 - p6 O: Centronics control - p7 I: Centronics status -*/ -WRITE8_MEMBER(bitgraph_state::ppu_i8243_w) -{ - DBG_LOG(1,"PPU", ("8243 %d <- %02X\n", offset + 4, data)); - switch (offset) { - case 0: - m_centronics->write_data0(BIT(data, 0)); - m_centronics->write_data1(BIT(data, 1)); - m_centronics->write_data2(BIT(data, 2)); - m_centronics->write_data3(BIT(data, 3)); - break; - case 1: - m_centronics->write_data4(BIT(data, 0)); - m_centronics->write_data5(BIT(data, 1)); - m_centronics->write_data6(BIT(data, 2)); - m_centronics->write_data7(BIT(data, 3)); - break; - case 2: - m_centronics->write_strobe(BIT(data, 0)); - // 1: Paper instruction - m_centronics->write_init(BIT(data, 2)); - break; - case 3: - m_centronics->write_ack(BIT(data, 0)); - m_centronics->write_busy(BIT(data, 1)); - m_centronics->write_perror(BIT(data, 2)); - m_centronics->write_select(BIT(data, 3)); - break; - } -} - - -void bitgraph_state::machine_start() -{ - m_videoram = (UINT8 *)m_maincpu->space(AS_PROGRAM).get_write_ptr(0x3e0000); -} - -void bitgraph_state::machine_reset() -{ - m_maincpu->reset(); - m_misccr = 0; - m_pia_a = 0; - m_pia_b = 0; - memset(m_ppu, 0, sizeof(m_ppu)); -} - - -static MACHINE_CONFIG_FRAGMENT( bg_motherboard ) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(40) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1024, 768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - MCFG_SCREEN_UPDATE_DRIVER(bitgraph_state, screen_update) - - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_DEVICE_ADD(ACIA0_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_H_TAG, rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_H_TAG, rs232_port_device, write_rts)) - MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE(M68K_TAG, m68000_device, write_irq1)) - - MCFG_RS232_PORT_ADD(RS232_H_TAG, default_rs232_devices, "null_modem") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA0_TAG, acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA0_TAG, acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA0_TAG, acia6850_device, write_cts)) - - MCFG_DEVICE_ADD(ACIA1_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_K_TAG, rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_K_TAG, rs232_port_device, write_rts)) - MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE(M68K_TAG, m68000_device, write_irq1)) - - MCFG_RS232_PORT_ADD(RS232_K_TAG, default_rs232_devices, "keyboard") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA1_TAG, acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA1_TAG, acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA1_TAG, acia6850_device, write_cts)) - - MCFG_DEVICE_ADD(ACIA2_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_rts)) - MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE(M68K_TAG, m68000_device, write_irq1)) - - MCFG_RS232_PORT_ADD(RS232_D_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA2_TAG, acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA2_TAG, acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA2_TAG, acia6850_device, write_cts)) - - // XXX actual part may be something else - MCFG_DEVICE_ADD(COM8116_A_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(bitgraph_state, com8116_a_fr_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE(bitgraph_state, com8116_a_ft_w)) - - MCFG_DEVICE_ADD(COM8116_B_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(bitgraph_state, com8116_b_fr_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE(bitgraph_state, com8116_b_ft_w)) - - MCFG_DEVICE_ADD(PIA_TAG, PIA6821, 0) - MCFG_PIA_READCA1_HANDLER(READLINE(bitgraph_state, pia_ca1_r)) - MCFG_PIA_CB2_HANDLER(WRITELINE(bitgraph_state, pia_cb2_w)) - MCFG_PIA_READPA_HANDLER(READ8(bitgraph_state, pia_pa_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(bitgraph_state, pia_pa_w)) - MCFG_PIA_READPB_HANDLER(READ8(bitgraph_state, pia_pb_r)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(bitgraph_state, pia_pb_w)) - - MCFG_ER2055_ADD(EAROM_TAG) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(PSG_TAG, AY8912, XTAL_1_2944MHz) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bitgraph_state, earom_write)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - -#ifdef UNUSED_FUNCTION -static MACHINE_CONFIG_FRAGMENT( bg_ppu ) - MCFG_CPU_ADD(PPU_TAG, I8035, XTAL_6_9MHz) - MCFG_CPU_IO_MAP(ppu_io) - - MCFG_I8243_ADD("i8243", NOOP, WRITE8(bitgraph_state, ppu_i8243_w)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit6)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) - MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) - MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) - - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END -#endif - -static MACHINE_CONFIG_START( bitgrpha, bitgraph_state ) - MCFG_CPU_ADD(M68K_TAG, M68000, XTAL_6_9MHz) - MCFG_CPU_PROGRAM_MAP(bitgrapha_mem) - - MCFG_FRAGMENT_ADD(bg_motherboard) - - MCFG_DEVICE_ADD("system_clock", CLOCK, 40) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bitgraph_state, system_clock_write)) - - MCFG_DEVICE_ADD(ACIA3_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_M_TAG, rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_M_TAG, rs232_port_device, write_rts)) - MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE(M68K_TAG, m68000_device, write_irq1)) - - MCFG_RS232_PORT_ADD(RS232_M_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA3_TAG, acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA3_TAG, acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA3_TAG, acia6850_device, write_cts)) - - MCFG_DEFAULT_LAYOUT(layout_bitgrpha) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( bitgrphb, bitgraph_state ) - MCFG_CPU_ADD(M68K_TAG, M68000, XTAL_6_9MHz) - MCFG_CPU_PROGRAM_MAP(bitgraphb_mem) - - MCFG_FRAGMENT_ADD(bg_motherboard) -// MCFG_FRAGMENT_ADD(bg_ppu) - - MCFG_DEVICE_ADD("system_clock", CLOCK, 1040) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bitgraph_state, system_clock_write)) - - MCFG_DEFAULT_LAYOUT(layout_bitgrphb) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( bitgrpha ) - ROM_REGION16_BE( 0x8000, M68K_TAG, 0 ) - ROM_LOAD( "bg125.rom", 0x000000, 0x008000, CRC(b86c974e) SHA1(5367db80a856444c2a55de22b69a13f97a62f602)) - ROM_FILL( 0x38e4, 1, 0x4e ) // disable clksync() - ROM_FILL( 0x38e5, 1, 0x75 ) -ROM_END - -ROM_START( bitgrphb ) - ROM_REGION16_BE( 0x8000, M68K_TAG, 0 ) - ROM_DEFAULT_BIOS("2.33A") - - ROM_SYSTEM_BIOS(0, "2.33A", "rev 2.33 Alpha' ROM") - ROMX_LOAD( "bg2.32lo_u10.bin", 0x004001, 0x002000, CRC(6a702a96) SHA1(acdf1ba34038b4ccafb5b8069e70ae57a3b8a7e0), ROM_BIOS(1)|ROM_SKIP(1)) - ROMX_LOAD( "bg2.32hi_u12.bin", 0x004000, 0x002000, CRC(a282a2c8) SHA1(ea7e4d4e197201c8944acef54479d5c2b26d409f), ROM_BIOS(1)|ROM_SKIP(1)) - ROMX_LOAD( "bg2.32lo_u11.bin", 0x000001, 0x002000, CRC(46912afd) SHA1(c1f771adc1ef62b1fb1b904ed1d2a61009e24f55), ROM_BIOS(1)|ROM_SKIP(1)) - ROMX_LOAD( "bg2.32hi_u13.bin", 0x000000, 0x002000, CRC(731df44f) SHA1(8c238b5943b8864e539f92891a0ffa6ddd4fc779), ROM_BIOS(1)|ROM_SKIP(1)) - - ROM_SYSTEM_BIOS(1, "3.0P", "rev 3.0P ROM") - ROMX_LOAD( "bg5173_u10.bin", 0x004001, 0x002000, CRC(40014850) SHA1(ef0b7da58a5183391a3a03947882197f25694518), ROM_BIOS(2)|ROM_SKIP(1)) - ROMX_LOAD( "bg5175_u12.bin", 0x004000, 0x002000, CRC(c2c4cc6c) SHA1(dbbce7cb58b4cef1557a834cbb07b3ace298cb8b), ROM_BIOS(2)|ROM_SKIP(1)) - ROMX_LOAD( "bg5174_u11.bin", 0x000001, 0x002000, CRC(639768b9) SHA1(68f623bcf3bb75390ba2b17efc067cf25f915ec0), ROM_BIOS(2)|ROM_SKIP(1)) - ROMX_LOAD( "bg5176_u13.bin", 0x000000, 0x002000, CRC(984e7e8c) SHA1(dd13cbaff96a8b9936ae8cb07205c6abe8b27b6e), ROM_BIOS(2)|ROM_SKIP(1)) - - ROM_SYSTEM_BIOS(2, "ramtest", "RAM test") - ROMX_LOAD( "ramtest.rom", 0x000000, 0x004000, CRC(fabe3b34) SHA1(4d892a2ed2b7ea12d83843609981be9069611d43), ROM_BIOS(3)) - - ROM_REGION( 0x800, PPU_TAG, 0 ) - ROM_LOAD( "bg_mouse_u9.bin", 0x0000, 0x0800, CRC(fd827ff5) SHA1(6d4a8e9b18c7610c5cfde40464826d144d387601)) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, bitgrpha, 0, 0, bitgrpha, bitgraph, driver_device, 0, "BBN", "BitGraph rev A", MACHINE_IMPERFECT_KEYBOARD) -COMP( 1982, bitgrphb, 0, 0, bitgrphb, bitgraph, driver_device, 0, "BBN", "BitGraph rev B", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_KEYBOARD) diff --git a/src/mess/drivers/bk.c b/src/mess/drivers/bk.c deleted file mode 100644 index 555dddae766..00000000000 --- a/src/mess/drivers/bk.c +++ /dev/null @@ -1,235 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - BK driver by Miodrag Milanovic - - 10/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/t11/t11.h" -#include "sound/wave.h" -#include "includes/bk.h" -#include "imagedev/cassette.h" -#include "formats/rk_cas.h" - - /* Address maps */ -static ADDRESS_MAP_START(bk0010_mem, AS_PROGRAM, 16, bk_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x3fff ) AM_RAM // RAM - AM_RANGE( 0x4000, 0x7fff ) AM_RAM AM_SHARE("video_ram") // Video RAM - AM_RANGE( 0x8000, 0x9fff ) AM_ROM // ROM - AM_RANGE( 0xa000, 0xbfff ) AM_ROM // ROM - AM_RANGE( 0xc000, 0xdfff ) AM_ROM // ROM - AM_RANGE( 0xe000, 0xfeff ) AM_ROM // ROM - AM_RANGE( 0xffb0, 0xffb1 ) AM_READWRITE(bk_key_state_r,bk_key_state_w) - AM_RANGE( 0xffb2, 0xffb3 ) AM_READ(bk_key_code_r) - AM_RANGE( 0xffb4, 0xffb5 ) AM_READWRITE(bk_vid_scrool_r,bk_vid_scrool_w) - AM_RANGE( 0xffce, 0xffcf ) AM_READWRITE(bk_key_press_r,bk_key_press_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(bk0010fd_mem, AS_PROGRAM, 16, bk_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x3fff ) AM_RAM // RAM - AM_RANGE( 0x4000, 0x7fff ) AM_RAM AM_SHARE("video_ram") // Video RAM - AM_RANGE( 0x8000, 0x9fff ) AM_ROM // ROM - AM_RANGE( 0xa000, 0xdfff ) AM_RAM // RAM - AM_RANGE( 0xe000, 0xfdff ) AM_ROM // ROM - AM_RANGE( 0xfe58, 0xfe59 ) AM_READWRITE(bk_floppy_cmd_r,bk_floppy_cmd_w) - AM_RANGE( 0xfe5a, 0xfe5b ) AM_READWRITE(bk_floppy_data_r,bk_floppy_data_w) - AM_RANGE( 0xffb0, 0xffb1 ) AM_READWRITE(bk_key_state_r,bk_key_state_w) - AM_RANGE( 0xffb2, 0xffb3 ) AM_READ(bk_key_code_r) - AM_RANGE( 0xffb4, 0xffb5 ) AM_READWRITE(bk_vid_scrool_r,bk_vid_scrool_w) - AM_RANGE( 0xffce, 0xffcf ) AM_READWRITE(bk_key_press_r,bk_key_press_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( bk0010 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rus") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lat") PORT_CODE(KEYCODE_RALT) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab left") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab right") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0xFE, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE5") - PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_END) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("LINE10") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - - PORT_START("LINE11") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) // this alone gives nothing and gives ` with Shift! - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) // this alone acts like Enter and gives no result with Shift -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( bk0010, bk_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", T11, 3000000) - MCFG_T11_INITIAL_MODE(0x36ff) /* initial mode word has DAL15,14,11,8 pulled low */ - MCFG_CPU_PROGRAM_MAP(bk0010_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(bk_state,bk0010_irq_callback) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(bk_state, screen_update_bk0010) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("bk0010_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","bk0010") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( bk0010fd, bk0010 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(bk0010fd_mem) -MACHINE_CONFIG_END - - -/* ROM definition */ - -ROM_START( bk0010 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "monit10.rom", 0x8000, 0x2000, CRC(26c6e8a0) SHA1(4e83a94ae5155bbea14d7331a5a8db82457bd5ae) ) - ROM_LOAD( "focal.rom", 0xa000, 0x2000, CRC(717149b7) SHA1(75df26f81ebd281bcb5c55ba81a7d97f31e388b2) ) - ROM_LOAD( "tests.rom", 0xe000, 0x1f80, CRC(91aecb4d) SHA1(6b14d552045194a3004bb6b795a2538110921519) ) -ROM_END - -ROM_START( bk001001 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "monit10.rom", 0x8000, 0x2000, CRC(26c6e8a0) SHA1(4e83a94ae5155bbea14d7331a5a8db82457bd5ae) ) - ROM_LOAD( "basic10-1.rom", 0xa000, 0x2000, CRC(5e3ff5da) SHA1(5ea4db1eaac87bd0ac96e52a608bc783709f5042) ) - ROM_LOAD( "basic10-2.rom", 0xc000, 0x2000, CRC(ea63863c) SHA1(acf068925e4052989b05dd5cf736a1dab5438011) ) - ROM_LOAD( "basic10-3.rom", 0xe000, 0x1f80, CRC(63f3df2e) SHA1(b5463f08e7c5f9f5aa31a2e7b6c1ed94fe029d65) ) -ROM_END - -ROM_START( bk0010fd ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "monit10.rom", 0x8000, 0x2000, CRC(26c6e8a0) SHA1(4e83a94ae5155bbea14d7331a5a8db82457bd5ae) ) - ROM_LOAD( "disk_327.rom", 0xe000, 0x1000, CRC(ed8a43ae) SHA1(28eefbb63047b26e4aec104aeeca74e2f9d0276c) ) -ROM_END - -ROM_START( bk0011m ) - ROM_REGION( 0x1A000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bas11m_0.rom", 0x10000, 0x4000, CRC(e71f9339) SHA1(9d76f3eefd64e032c763fa1ebf9cd3d9bd22317a) ) - ROM_LOAD( "bas11m_1.rom", 0x14000, 0x2000, CRC(4c68ff59) SHA1(34fa37599f2f9eb607390ef2458a3c22d87f09a9) ) - ROM_LOAD( "b11m_ext.rom", 0x16000, 0x2000, CRC(b2e4c33c) SHA1(f087af69044432a1ef2431a72ac06946e32f2dd3) ) - ROM_LOAD( "b11m_bos.rom", 0x18000, 0x2000, CRC(8ffd5efa) SHA1(7e9a30e38d7b78981999821640a68a201bb6df01) ) - ROM_LOAD( "disk_327.rom", 0x19000, 0x1000, CRC(ed8a43ae) SHA1(28eefbb63047b26e4aec104aeeca74e2f9d0276c) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, bk0010, 0, 0, bk0010, bk0010, driver_device, 0, "Elektronika", "BK 0010", 0) -COMP( 1986, bk001001, bk0010, 0, bk0010, bk0010, driver_device, 0, "Elektronika", "BK 0010-01", 0) -COMP( 1986, bk0010fd, bk0010, 0, bk0010fd, bk0010, driver_device, 0, "Elektronika", "BK 0010 FDD", MACHINE_NOT_WORKING) -COMP( 1986, bk0011m, bk0010, 0, bk0010fd, bk0010, driver_device, 0, "Elektronika", "BK 0011M", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/bmjr.c b/src/mess/drivers/bmjr.c deleted file mode 100644 index 4ad812b6295..00000000000 --- a/src/mess/drivers/bmjr.c +++ /dev/null @@ -1,385 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Basic Master Jr (MB-6885) (c) 1982? Hitachi - - preliminary driver by Angelo Salese - - TODO: - - for whatever reason, BASIC won't work if you try to use it directly, - it does if you enter into MON first then exit (with E) - - tape hook-up doesn't work yet (shouldn't be hard to fix) - - Break key is unemulated (tied with the NMI) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "sound/beep.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" - - -class bmjr_state : public driver_device -{ -public: - bmjr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cass(*this, "cassette"), - m_beep(*this, "beeper") - , - m_p_wram(*this, "p_wram"){ } - - required_device m_maincpu; - required_device m_cass; - required_device m_beep; - DECLARE_READ8_MEMBER(key_r); - DECLARE_WRITE8_MEMBER(key_w); - DECLARE_READ8_MEMBER(ff_r); - DECLARE_READ8_MEMBER(unk_r); - DECLARE_READ8_MEMBER(tape_r); - DECLARE_WRITE8_MEMBER(tape_w); - DECLARE_READ8_MEMBER(tape_stop_r); - DECLARE_READ8_MEMBER(tape_start_r); - DECLARE_WRITE8_MEMBER(xor_display_w); - bool m_tape_switch; - required_shared_ptr m_p_wram; - UINT8 *m_p_chargen; - UINT8 m_xor_display; - UINT8 m_key_mux; - DECLARE_DRIVER_INIT(bmjr); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_bmjr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - - - -void bmjr_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 bmjr_state::screen_update_bmjr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,fg=4; - UINT16 sy=0,ma=0x100,x; - UINT8 inv = (m_xor_display) ? 0xff : 0; - - for(y = 0; y < 24; y++ ) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 32; x++) - { - chr = m_p_wram[x]; - gfx = m_p_chargen[(chr<<3) | ra] ^ inv; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7) ? fg : 0; - *p++ = BIT(gfx, 6) ? fg : 0; - *p++ = BIT(gfx, 5) ? fg : 0; - *p++ = BIT(gfx, 4) ? fg : 0; - *p++ = BIT(gfx, 3) ? fg : 0; - *p++ = BIT(gfx, 2) ? fg : 0; - *p++ = BIT(gfx, 1) ? fg : 0; - *p++ = BIT(gfx, 0) ? fg : 0; - } - } - ma+=32; - } - - return 0; -} - -READ8_MEMBER( bmjr_state::key_r ) -{ - char kbdrow[6]; - sprintf(kbdrow,"KEY%X", m_key_mux); - return (ioport(kbdrow)->read() & 15) | (ioport("KEYMOD")->read() << 4); -} - -WRITE8_MEMBER( bmjr_state::key_w ) -{ - m_key_mux = data & 0xf; - -// if(data & 0xf0) -// printf("%02x",data & 0xf0); -} - - -READ8_MEMBER( bmjr_state::ff_r ) -{ - return 0xff; -} - -READ8_MEMBER( bmjr_state::unk_r ) -{ - return 0x30; -} - -READ8_MEMBER( bmjr_state::tape_r ) -{ - //m_cass->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); - - return ((m_cass->input()) > 0.03) ? 0xff : 0x00; -} - -WRITE8_MEMBER( bmjr_state::tape_w ) -{ - if(!m_tape_switch) - { - m_beep->set_state(!BIT(data, 7)); - } - else - { - //m_cass->change_state(CASSETTE_RECORD,CASSETTE_MASK_UISTATE); - m_cass->output(BIT(data, 0) ? -1.0 : +1.0); - } -} - -READ8_MEMBER( bmjr_state::tape_stop_r ) -{ - m_tape_switch = 0; - //m_cass->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - return 0x01; -} - -READ8_MEMBER( bmjr_state::tape_start_r ) -{ - m_tape_switch = 1; - m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - return 0x01; -} - -WRITE8_MEMBER( bmjr_state::xor_display_w ) -{ - m_xor_display = data; -} - -static ADDRESS_MAP_START(bmjr_mem, AS_PROGRAM, 8, bmjr_state) - ADDRESS_MAP_UNMAP_HIGH - //0x0100, 0x03ff basic vram - //0x0900, 0x20ff vram, modes 0x40 / 0xc0 - //0x2100, 0x38ff vram, modes 0x44 / 0xcc - AM_RANGE(0x0000, 0xafff) AM_RAM AM_SHARE("p_wram") - AM_RANGE(0xb000, 0xdfff) AM_ROM - AM_RANGE(0xe000, 0xe7ff) AM_ROM -// AM_RANGE(0xe890, 0xe890) W MP-1710 tile color -// AM_RANGE(0xe891, 0xe891) W MP-1710 background color -// AM_RANGE(0xe892, 0xe892) W MP-1710 monochrome / color setting - AM_RANGE(0xee00, 0xee00) AM_READ(tape_stop_r) //R stop tape - AM_RANGE(0xee20, 0xee20) AM_READ(tape_start_r) //R start tape - AM_RANGE(0xee40, 0xee40) AM_WRITE(xor_display_w) //W Picture reverse - AM_RANGE(0xee80, 0xee80) AM_READWRITE(tape_r,tape_w)//RW tape input / output - AM_RANGE(0xeec0, 0xeec0) AM_READWRITE(key_r,key_w)//RW keyboard - AM_RANGE(0xef00, 0xef00) AM_READ(ff_r) //R timer - AM_RANGE(0xef40, 0xef40) AM_READ(ff_r) //R unknown - AM_RANGE(0xef80, 0xef80) AM_READ(unk_r) //R unknown -// AM_RANGE(0xefe0, 0xefe0) W screen mode - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( bmjr ) - PORT_START("KEY0") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY1") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY2") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY3") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY4") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY5") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY6") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY7") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY8") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEY9") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEYA") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_UNUSED ) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@ Up") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('@') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEYB") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[ Down") PORT_CODE(KEYCODE_OPENBRACE) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('[') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^ Right") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('^') - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEYC") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("\xC2\xA5 / Left") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("KEYD") - PORT_DIPNAME( 0x01, 0x01, "D" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEYE") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEYF") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEYMOD") /* Note: you should press Normal to return from a Kana state and vice-versa */ - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(DEF_STR( Normal )) PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Kana Shift") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Kana") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0xf0,IP_ACTIVE_LOW,IPT_UNUSED ) -INPUT_PORTS_END - -static const gfx_layout bmjr_charlayout = -{ - 8, 8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( bmjr ) - GFXDECODE_ENTRY( "chargen", 0x0000, bmjr_charlayout, 0, 4 ) -GFXDECODE_END - -void bmjr_state::machine_start() -{ - m_beep->set_frequency(1200); //guesswork - m_beep->set_state(0); -} - -void bmjr_state::machine_reset() -{ - m_tape_switch = 0; - m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); -} - -static MACHINE_CONFIG_START( bmjr, bmjr_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6800, XTAL_4MHz/4) //unknown clock / divider - MCFG_CPU_PROGRAM_MAP(bmjr_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", bmjr_state, irq0_line_hold) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 192) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 192-1) - MCFG_SCREEN_UPDATE_DRIVER(bmjr_state, screen_update_bmjr) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", bmjr) - - /* Audio */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( bmjr ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bas.rom", 0xb000, 0x3000, BAD_DUMP CRC(2318e04e) SHA1(cdb3535663090f5bcaba20b1dbf1f34724ef6a5f)) //12k ROMs doesn't exist ... - ROM_LOAD( "mon.rom", 0xf000, 0x1000, CRC(776cfa3a) SHA1(be747bc40fdca66b040e0f792b05fcd43a1565ce)) - ROM_LOAD( "prt.rom", 0xe000, 0x0800, CRC(b9aea867) SHA1(b8dd5348790d76961b6bdef41cfea371fdbcd93d)) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(258c6fd7) SHA1(d7c7dd57d6fc3b3d44f14c32182717a48e24587f)) //taken from a JP emulator -ROM_END - -/* Driver */ -DRIVER_INIT_MEMBER(bmjr_state,bmjr) -{ -} - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, bmjr, 0, 0, bmjr, bmjr, bmjr_state, bmjr, "Hitachi", "Basic Master Jr", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/bml3.c b/src/mess/drivers/bml3.c deleted file mode 100644 index 9b8b5eff66b..00000000000 --- a/src/mess/drivers/bml3.c +++ /dev/null @@ -1,1114 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Angelo Salese, Jonathan Edwards, Christopher Edwards,Robbbert -/************************************************************************************** - - Basic Master Level 3 (MB-689x) (c) 1980 Hitachi - - Driver by Angelo Salese, Jonathan Edwards and Christopher Edwards - - TODO: - - implement sound as a bml3bus slot device - - account for hardware differences between MB-6890, MB-6891 and MB-6892 - (e.g. custom font support on the MB-6892) - -**************************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "video/mc6845.h" -#include "machine/6821pia.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "sound/2203intf.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "bus/bml3/bml3bus.h" -#include "bus/bml3/bml3mp1802.h" -#include "bus/bml3/bml3mp1805.h" -#include "bus/bml3/bml3kanji.h" - -// System clock definitions, from the MB-6890 servce manual, p.48: - -#define MASTER_CLOCK ( 32256000 ) // Master clock crystal (X1) frequency, 32.256 MHz. "fx" in the manual. - -#define D80_CLOCK ( MASTER_CLOCK / 2 ) // Graphics dot clock in 80-column mode. ~16 MHz. -#define D40_CLOCK ( D80_CLOCK / 2 ) // Graphics dot clock in 40-column mode. ~8 MHz. - -#define CPU_EXT_CLOCK ( D40_CLOCK / 2 ) // IC37, 4.032 MHz signal to EXTAL on the 6809 MPU. -#define CPU_CLOCK ( CPU_EXT_CLOCK / 4 ) // Actual MPU clock frequency ("fE" in the manual). The division yielding CPU_CLOCK is done in the 6809 itself. Also used as the 40-column character clock. - -#define C80_CLOCK ( CPU_EXT_CLOCK / 2 ) // 80-column character mode. IC37, "80CHRCK"; ~2 MHz. -#define C40_CLOCK ( CPU_CLOCK ) // 40-column character mode; same as MPU clock. "40CHRCK"; ~1 MHz. - -// Video signal clocks from the HD4650SSP CRTC (IC36) -// In the real hardware, the 80-/40-column Mode switch changes the CRTC character clock input source. However, it just uses a different divider, so the end result is the same horizontal vsync frequency. -#define H_CLOCK ( C80_CLOCK / 128 ) // in 80-column mode -//#define H_CLOCK ( C40_CLOCK / 64 ) // in 40-column mode (either way the frequency is the same: 15.75 kHz) -#define V_CLOCK ( 2 * H_CLOCK / 525 ) // Vertical refresh rate comes out at exactly 60 Hz. - -// TODO: ACIA RS-232C and cassette interface clocks (service manual p.67); perhaps reverse the order and simply divide by 2 from each previous frequency. -// IC111 (74LS157P) takes 16.128 MHz and 1.008 MHz TTL clock inputs. The RS/C SW input line determines the mode (high -> RS-232C). - -// Frequencies for RS-232C mode: -// D80_CLOCK / 840.0 // 19200 Hz -// D80_CLOCK / 420 // 38400 Hz -// D80_CLOCK / 210 // 76800 Hz -// D80_CLOCK / 105.0 // 153600 Hz - -// Frequencies for cassette mode: -// / 13440 //1200 -// / 6720 // 2400 -// / 3360 // 4800 -// / 1680 // 9600 - - -class bml3_state : public driver_device -{ -public: - bml3_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_bml3bus(*this, "bml3bus"), - m_crtc(*this, "crtc"), - m_cass(*this, "cassette"), - m_speaker(*this, "speaker"), - m_ym2203(*this, "ym2203"), - m_acia6850(*this, "acia6850"), - m_palette(*this, "palette") - { - } - - DECLARE_READ8_MEMBER(bml3_6845_r); - DECLARE_WRITE8_MEMBER(bml3_6845_w); - DECLARE_READ8_MEMBER(bml3_keyboard_r); - DECLARE_WRITE8_MEMBER(bml3_keyboard_w); - DECLARE_WRITE8_MEMBER(bml3_hres_reg_w); - DECLARE_WRITE8_MEMBER(bml3_vres_reg_w); - DECLARE_READ8_MEMBER(bml3_vram_r); - DECLARE_WRITE8_MEMBER(bml3_vram_w); - DECLARE_READ8_MEMBER(bml3_psg_latch_r); - DECLARE_WRITE8_MEMBER(bml3_psg_latch_w); - DECLARE_READ8_MEMBER(bml3_vram_attr_r); - DECLARE_WRITE8_MEMBER(bml3_vram_attr_w); - DECLARE_READ8_MEMBER(bml3_beep_r); - DECLARE_WRITE8_MEMBER(bml3_beep_w); - DECLARE_WRITE8_MEMBER(bml3_piaA_w); - DECLARE_READ8_MEMBER(bml3_keyb_nmi_r); - DECLARE_WRITE8_MEMBER(bml3_firq_mask_w); - DECLARE_READ8_MEMBER(bml3_firq_status_r); - DECLARE_WRITE8_MEMBER(relay_w); - DECLARE_WRITE_LINE_MEMBER(bml3bus_nmi_w); - DECLARE_WRITE_LINE_MEMBER(bml3bus_irq_w); - DECLARE_WRITE_LINE_MEMBER(bml3bus_firq_w); - DECLARE_WRITE_LINE_MEMBER(bml3_acia_tx_w); - DECLARE_WRITE_LINE_MEMBER(bml3_acia_rts_w); - DECLARE_WRITE_LINE_MEMBER(bml3_acia_irq_w); - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - - DECLARE_READ8_MEMBER(bml3_a000_r); DECLARE_WRITE8_MEMBER(bml3_a000_w); - DECLARE_READ8_MEMBER(bml3_c000_r); DECLARE_WRITE8_MEMBER(bml3_c000_w); - DECLARE_READ8_MEMBER(bml3_e000_r); DECLARE_WRITE8_MEMBER(bml3_e000_w); - DECLARE_READ8_MEMBER(bml3_f000_r); DECLARE_WRITE8_MEMBER(bml3_f000_w); - DECLARE_READ8_MEMBER(bml3_fff0_r); DECLARE_WRITE8_MEMBER(bml3_fff0_w); - - MC6845_UPDATE_ROW(crtc_update_row); - - UINT8 *m_p_videoram; - UINT8 *m_p_chargen; - UINT8 m_hres_reg; - UINT8 m_crtc_vreg[0x100]; - // INTERRUPT_GEN_MEMBER(bml3_irq); - INTERRUPT_GEN_MEMBER(bml3_timer_firq); - TIMER_DEVICE_CALLBACK_MEMBER(bml3_c); - TIMER_DEVICE_CALLBACK_MEMBER(bml3_p); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); - DECLARE_READ8_MEMBER(bml3_ym2203_r); - DECLARE_WRITE8_MEMBER(bml3_ym2203_w); - -private: - UINT8 m_psg_latch; - UINT8 m_attr_latch; - UINT8 m_vres_reg; - bool m_keyb_interrupt_disabled; - bool m_keyb_nmi_disabled; // not used yet - bool m_keyb_counter_operation_disabled; - UINT8 m_keyb_empty_scan; - UINT8 m_keyb_scancode; - bool m_keyb_capslock_led_on; - bool m_keyb_hiragana_led_on; - bool m_keyb_katakana_led_on; - bool m_cassbit; - bool m_cassold; - UINT8 m_cass_data[4]; - virtual void machine_reset(); - virtual void machine_start(); - void m6845_change_clock(UINT8 setting); - UINT8 m_crtc_index; - UINT8 *m_extram; - UINT8 m_firq_mask; - UINT8 m_firq_status; - required_device m_maincpu; - required_device m_bml3bus; - required_device m_crtc; - required_device m_cass; - required_device m_speaker; - optional_device m_ym2203; - required_device m_acia6850; -public: - required_device m_palette; -}; - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - - - -READ8_MEMBER( bml3_state::bml3_6845_r ) -{ - if (offset) - return m_crtc->register_r(space, 0); - else - return m_crtc->status_r(space, 0); -} - -WRITE8_MEMBER( bml3_state::bml3_6845_w ) -{ - if(offset == 0) - { - m_crtc_index = data; - m_crtc->address_w(space, 0, data); - } - else - { - m_crtc_vreg[m_crtc_index] = data; - m_crtc->register_w(space, 0, data); - } -} - -READ8_MEMBER( bml3_state::bml3_keyboard_r ) -{ - UINT8 ret = m_keyb_scancode; - m_keyb_scancode &= 0x7f; - return ret; -} - -WRITE8_MEMBER( bml3_state::bml3_keyboard_w ) -{ - m_keyb_katakana_led_on = BIT(data, 0); - m_keyb_hiragana_led_on = BIT(data, 1); - m_keyb_capslock_led_on = BIT(data, 2); - m_keyb_counter_operation_disabled = BIT(data, 3); - m_keyb_interrupt_disabled = !BIT(data, 6); - m_keyb_nmi_disabled = !BIT(data, 7); -} - -void bml3_state::m6845_change_clock(UINT8 setting) -{ - int m6845_clock = CPU_CLOCK; // CRTC and MPU are synchronous by default - - switch(setting & 0x88) - { - case 0x00: m6845_clock = C40_CLOCK; break; //320 x 200 - case 0x08: m6845_clock = C40_CLOCK; break; //320 x 200, interlace - case 0x80: m6845_clock = C80_CLOCK; break; //640 x 200 - case 0x88: m6845_clock = C80_CLOCK; break; //640 x 200, interlace - } - - m_crtc->set_clock(m6845_clock); -} - -WRITE8_MEMBER( bml3_state::bml3_hres_reg_w ) -{ - // MODE SEL register (see service manual p.43). - /* - x--- ---- "W" bit: 0 = 40 columns, 1 = 80 columns - -x-- ---- "HR" bit: 0 = high resolution, 1 = normal - --x- ---- "C" bit - ACIA mode: 0 = cassette, 1 = RS-232C - ---- -RGB Background colour - */ - - m_hres_reg = data; - - m6845_change_clock((m_hres_reg & 0x80) | (m_vres_reg & 0x08)); -} - -WRITE8_MEMBER( bml3_state::bml3_vres_reg_w ) -{ - // The MB-6890 had an interlaced video mode which was used for displaying Japanese (Hiragana and Katakana) text (8x16 character glyph bitmaps). - /* - ---- x--- Interlace select: 0 = non-interlace, 1 = interlace - */ - m_vres_reg = data; - - m6845_change_clock((m_hres_reg & 0x80) | (m_vres_reg & 0x08)); -} - - -READ8_MEMBER( bml3_state::bml3_vram_r ) -{ - // Bit 7 masks reading back to the latch - if (!BIT(m_attr_latch, 7)) - { - m_attr_latch = m_p_videoram[offset+0x4000]; - } - - return m_p_videoram[offset]; -} - -WRITE8_MEMBER( bml3_state::bml3_vram_w ) -{ - m_p_videoram[offset] = data; - // color ram is 5-bit - m_p_videoram[offset+0x4000] = m_attr_latch & 0x1F; -} - -READ8_MEMBER( bml3_state::bml3_psg_latch_r) -{ - return 0x7f; -} - -WRITE8_MEMBER( bml3_state::bml3_psg_latch_w) -{ - m_psg_latch = data; -} - -READ8_MEMBER(bml3_state::bml3_ym2203_r) -{ - UINT8 dev_offs = ((m_psg_latch & 3) != 3); - - return m_ym2203->read(space, dev_offs); -} - -WRITE8_MEMBER(bml3_state::bml3_ym2203_w) -{ - UINT8 dev_offs = ((m_psg_latch & 3) != 3); - - m_ym2203->write(space, dev_offs, data); -} - -READ8_MEMBER( bml3_state::bml3_vram_attr_r) -{ - // C-REG-SELECT register - // Reads from a VRAM address copy the corresponding 'colour RAM' address to the low-order 5 bits of this register as a side-effect - // (unless MK bit indicates 'prohibit write') - return m_attr_latch; -} - -WRITE8_MEMBER( bml3_state::bml3_vram_attr_w) -{ - // C-REG-SELECT register - // Writes to a VRAM address copy the low-order 5 bits of this register to the corresponding 'colour RAM' address as a side-effect - /* - x--- ---- "MK" bit: 0 = enable write, 1 = prohibit write - ---x ---- "GC" bit: 0 = character, 1 = graphic - ---- x--- "RV" bit: 0 = normal, 1 - reverse - ---- -RGB Foreground colour - */ - m_attr_latch = data; -} - -READ8_MEMBER( bml3_state::bml3_beep_r) -{ - return -1; // BEEP status read? -} - -WRITE8_MEMBER( bml3_state::bml3_beep_w) -{ - m_speaker->level_w(BIT(data, 7)); -} - -WRITE8_MEMBER( bml3_state::relay_w ) -{ - m_cass->change_state( - BIT(data,7) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - -READ8_MEMBER( bml3_state::bml3_a000_r) { return m_extram[offset + 0xa000]; } -WRITE8_MEMBER( bml3_state::bml3_a000_w) { m_extram[offset + 0xa000] = data; } -READ8_MEMBER( bml3_state::bml3_c000_r) { return m_extram[offset + 0xc000]; } -WRITE8_MEMBER( bml3_state::bml3_c000_w) { m_extram[offset + 0xc000] = data; } -READ8_MEMBER( bml3_state::bml3_e000_r) { return m_extram[offset + 0xe000]; } -WRITE8_MEMBER( bml3_state::bml3_e000_w) { m_extram[offset + 0xe000] = data; } -READ8_MEMBER( bml3_state::bml3_f000_r) { return m_extram[offset + 0xf000]; } -WRITE8_MEMBER( bml3_state::bml3_f000_w) { m_extram[offset + 0xf000] = data; } -READ8_MEMBER( bml3_state::bml3_fff0_r) { return m_extram[offset + 0xfff0]; } -WRITE8_MEMBER( bml3_state::bml3_fff0_w) { m_extram[offset + 0xfff0] = data; } - -READ8_MEMBER( bml3_state::bml3_keyb_nmi_r) -{ - return 0; // bit 7 used to signal a BREAK key pressure -} - -WRITE8_MEMBER( bml3_state::bml3_firq_mask_w) -{ - m_firq_mask = data & 0x80; - if(m_firq_mask) - { - m_firq_status = 0; // clear pending firq - m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); - } -} - -READ8_MEMBER( bml3_state::bml3_firq_status_r ) -{ - UINT8 res = m_firq_status << 7; - m_firq_status = 0; - m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); - return res; -} - -WRITE_LINE_MEMBER(bml3_state::bml3bus_nmi_w) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, state); -} - -WRITE_LINE_MEMBER(bml3_state::bml3bus_irq_w) -{ - m_maincpu->set_input_line(M6809_IRQ_LINE, state); -} - -WRITE_LINE_MEMBER(bml3_state::bml3bus_firq_w) -{ - m_maincpu->set_input_line(M6809_FIRQ_LINE, state); -} - - -static ADDRESS_MAP_START(bml3_mem, AS_PROGRAM, 8, bml3_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x03ff) AM_RAM - AM_RANGE(0x0400, 0x43ff) AM_READWRITE(bml3_vram_r,bml3_vram_w) - AM_RANGE(0x4400, 0x9fff) AM_RAM - AM_RANGE(0xff40, 0xff46) AM_NOP // lots of unknown reads and writes - AM_RANGE(0xffc0, 0xffc3) AM_DEVREADWRITE("pia6821", pia6821_device, read, write) - AM_RANGE(0xffc4, 0xffc4) AM_DEVREADWRITE("acia6850", acia6850_device, status_r, control_w) - AM_RANGE(0xffc5, 0xffc5) AM_DEVREADWRITE("acia6850", acia6850_device, data_r, data_w) - AM_RANGE(0xffc6, 0xffc7) AM_READWRITE(bml3_6845_r,bml3_6845_w) - // KBNMI - Keyboard "Break" key non-maskable interrupt - AM_RANGE(0xffc8, 0xffc8) AM_READ(bml3_keyb_nmi_r) // keyboard nmi - // DIPSW - DIP switches on system mainboard - AM_RANGE(0xffc9, 0xffc9) AM_READ_PORT("DSW") - // TIMER - System timer enable - AM_RANGE(0xffca, 0xffca) AM_READ(bml3_firq_status_r) // timer irq - // LPFLG - Light pen interrupt -// AM_RANGE(0xffcb, 0xffcb) - // MODE_SEL - Graphics mode select - AM_RANGE(0xffd0, 0xffd0) AM_WRITE(bml3_hres_reg_w) - // TRACE - Trace counter -// AM_RANGE(0xffd1, 0xffd1) - // REMOTE - Remote relay control for cassette - bit 7 - AM_RANGE(0xffd2, 0xffd2) AM_WRITE(relay_w) - // MUSIC_SEL - Music select: toggle audio output level when rising - AM_RANGE(0xffd3, 0xffd3) AM_READWRITE(bml3_beep_r,bml3_beep_w) - // TIME_MASK - Prohibit timer IRQ - AM_RANGE(0xffd4, 0xffd4) AM_WRITE(bml3_firq_mask_w) - // LPENBL - Light pen operation enable - AM_RANGE(0xffd5, 0xffd5) AM_NOP - // INTERLACE_SEL - Interlaced video mode (manual has "INTERACE SEL"!) - AM_RANGE(0xffd6, 0xffd6) AM_WRITE(bml3_vres_reg_w) -// AM_RANGE(0xffd7, 0xffd7) baud select - // C_REG_SEL - Attribute register (character/video mode and colours) - AM_RANGE(0xffd8, 0xffd8) AM_READWRITE(bml3_vram_attr_r,bml3_vram_attr_w) - // KB - Keyboard mode register, interrupt control, keyboard LEDs - AM_RANGE(0xffe0, 0xffe0) AM_READWRITE(bml3_keyboard_r,bml3_keyboard_w) -// AM_RANGE(0xffe8, 0xffe8) bank register -// AM_RANGE(0xffe9, 0xffe9) IG mode register -// AM_RANGE(0xffea, 0xffea) IG enable register - AM_RANGE(0xa000, 0xfeff) AM_ROM AM_REGION("maincpu", 0xa000) - AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("maincpu", 0xfff0) - AM_RANGE(0xa000, 0xbfff) AM_WRITE(bml3_a000_w) - AM_RANGE(0xc000, 0xdfff) AM_WRITE(bml3_c000_w) - AM_RANGE(0xe000, 0xefff) AM_WRITE(bml3_e000_w) - AM_RANGE(0xf000, 0xfeff) AM_WRITE(bml3_f000_w) - AM_RANGE(0xfff0, 0xffff) AM_WRITE(bml3_fff0_w) - -#if 0 - AM_RANGE(0xff00, 0xff00) AM_READWRITE(bml3_ym2203_r,bml3_ym2203_w) - AM_RANGE(0xff02, 0xff02) AM_READWRITE(bml3_psg_latch_r,bml3_psg_latch_w) // PSG address/data select -#endif -ADDRESS_MAP_END - -static ADDRESS_MAP_START(bml3mk2_mem, AS_PROGRAM, 8, bml3_state) - AM_IMPORT_FROM(bml3_mem) - // TODO: anything to add here? - -ADDRESS_MAP_END - -static ADDRESS_MAP_START(bml3mk5_mem, AS_PROGRAM, 8, bml3_state) - AM_IMPORT_FROM(bml3_mem) - // TODO: anything to add here? - -ADDRESS_MAP_END - -/* Input ports */ - -static INPUT_PORTS_START( bml3 ) - - // DIP switches (service manual p.88) - // Note the NEWON command reboots with a soft override for the DIP switch - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x01, "BASIC/terminal mode") - PORT_DIPSETTING(0x00, "Terminal mode") - PORT_DIPSETTING(0x01, "BASIC mode") - PORT_DIPNAME( 0x02, 0x02, "Interlaced video") - PORT_DIPSETTING(0x00, DEF_STR( Off ) ) - PORT_DIPSETTING(0x02, DEF_STR( On )) - // This is overridden by the 'Mode' toggle button - PORT_DIPNAME( 0x04, 0x04, "40-/80-column") - PORT_DIPSETTING(0x00, "40 chars/line") - PORT_DIPSETTING(0x04, "80 chars/line") - PORT_DIPNAME( 0x08, 0x00, "Video resolution") - PORT_DIPSETTING(0x00, "High") - PORT_DIPSETTING(0x08, "Low") - PORT_DIPNAME( 0x10, 0x00, "Show PF key content") - PORT_DIPSETTING(0x00, DEF_STR ( Off ) ) - PORT_DIPSETTING(0x10, DEF_STR ( On )) - PORT_DIPNAME( 0x20, 0x00, "Terminal duplex") - PORT_DIPSETTING(0x00, "Full duplex") - PORT_DIPSETTING(0x20, "Half duplex") - PORT_DIPNAME( 0x40, 0x00, "Terminal bits") - PORT_DIPSETTING(0x00, "8 bits/char") - PORT_DIPSETTING(0x40, "7 bits/char") - PORT_DIPNAME( 0x80, 0x00, "Hiragana->Katakana") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - -// TODO: also model the CS jumper block? - - // RAM expansion configurations (see service manual p.76) -/* - PORT_START("RAM") - PORT_DIPNAME( 0x0003, 0x0002, "RAM size" ) - PORT_DIPSETTING( 0x0000, "32 kiB (standard)" ) - PORT_DIPSETTING( 0x0001, "40 kiB (32 kiB + 8 kiB)" ) - PORT_DIPSETTING( 0x0002, "60 kiB (32 kiB + 28 kiB)" ) -*/ - - PORT_START("key1") //0x00-0x1f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("? PAD") PORT_CHAR('?') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift")PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X2") // ??? - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana Lock") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana Shift") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 PAD") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 PAD") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 PAD") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Delete PAD") //backspace - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xC2\xA5") PORT_CODE(KEYCODE_TAB) // yen sign - - PORT_START("key2") //0x20-0x3f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 PAD") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) //or cls? - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 PAD") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 PAD") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 PAD") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- PAD") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') - - PORT_START("key3") //0x40-0x5f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ PAD") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 PAD") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 PAD") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 PAD") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0xffe00000,IP_ACTIVE_HIGH,IPT_UNKNOWN) -INPUT_PORTS_END - -MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - // The MB-6890 has a 5-bit colour RAM region. The meaning of the bits are: - // 0: blue - // 1: red - // 2: green - // 3: reverse/inverse video - // 4: graphic (not character) - - UINT8 x=0,hf=0,xi=0,interlace=0,bgcolor=0,rawbits=0,dots[2],color=0,pen=0; - bool reverse=0,graphic=0,lowres=0; - UINT16 mem=0; - - interlace = (m_crtc_vreg[8] & 3) ? 1 : 0; - lowres = BIT(m_hres_reg, 6); - bgcolor = m_hres_reg & 7; - - if (interlace) - { - ra >>= 1; - if (y > 0x176) return; - } - - // redundant initializers to keep compiler happy - dots[0] = dots[1] = 0; - - for(x=0; x> ra/2 & 0x11) * 0xf; - } - else - { - dots[0] = dots[1] = rawbits; - } - } - else - { - // character mode - int tile = rawbits & 0x7f; - int tile_bank = BIT(rawbits, 7); - if (interlace) - { - dots[0] = m_p_chargen[(tile_bank<<11)|(tile<<4)|(ra<<1)]; - dots[1] = m_p_chargen[(tile_bank<<11)|(tile<<4)|(ra<<1)|tile_bank]; - } - else - { - dots[0] = dots[1] = m_p_chargen[(tile<<4)|(ra<<1)|tile_bank]; - } - } - - for(hf=0;hf<=interlace;hf++) - { - for(xi=0;xi<8;xi++) - { - if(reverse) - pen = (dots[hf] >> (7-xi) & 1) ? bgcolor : color; - else - pen = (dots[hf] >> (7-xi) & 1) ? color : bgcolor; - - bitmap.pix32(y, x*8+xi) = palette[pen]; - // when the mc6845 device gains full interlace&video support, replace the line above with the line below - // bitmap.pix32(y*(interlace+1)+hf, x*8+xi) = palette[pen]; - } - } - } -} - - -TIMER_DEVICE_CALLBACK_MEMBER(bml3_state::keyboard_callback) -{ - static const char *const portnames[3] = { "key1","key2","key3" }; - int i,port_i,trigger = 0; - - if(!(m_keyb_scancode & 0x80)) - { - m_keyb_scancode = (m_keyb_scancode + 1) & 0x7F; - if (m_keyb_counter_operation_disabled) - { - m_keyb_scancode &= 0x7; - } - - if (m_keyb_scancode == 0x7F) - { - if (m_keyb_empty_scan == 1) - { - // full scan completed with no keypress - trigger = !0; - } - if (m_keyb_empty_scan > 0) - m_keyb_empty_scan--; - } - else if (m_keyb_scancode < 32*3) - { - port_i = m_keyb_scancode / 32; - i = m_keyb_scancode % 32; - if((ioport(portnames[port_i])->read()>>i) & 1) - { - m_keyb_empty_scan = 2; - trigger = !0; - } - } - if (trigger) - { - m_keyb_scancode |= 0x80; - if (!m_keyb_interrupt_disabled) - m_maincpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); - } - /* Don't need this apparently... - else - { - m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE); - } - */ - } -} - -TIMER_DEVICE_CALLBACK_MEMBER( bml3_state::bml3_p ) -{ - /* cassette - turn 1200/2400Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_acia6850->write_rxd((m_cass_data[1] < 12) ? 1 : 0); - m_cass_data[1] = 0; - } -} - -#if 0 -INTERRUPT_GEN_MEMBER(bml3_state::bml3_irq) -{ - m_maincpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE); -} -#endif - - -INTERRUPT_GEN_MEMBER(bml3_state::bml3_timer_firq) -{ - if(!m_firq_mask) - { - m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); - m_firq_status = 1; - } -} - -void bml3_state::machine_start() -{ - m_extram = auto_alloc_array(machine(),UINT8,0x10000); - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("vram")->base(); - m_psg_latch = 0; - m_attr_latch = 0; - m_vres_reg = 0; - m_keyb_interrupt_disabled = 0; - m_keyb_nmi_disabled = 0; - m_keyb_counter_operation_disabled = 0; - m_keyb_empty_scan = 0; - m_keyb_scancode = 0; - m_keyb_capslock_led_on = 0; - m_keyb_hiragana_led_on = 0; - m_keyb_katakana_led_on = 0; - m_crtc_index = 0; - m_firq_status = 0; - m_cassbit = 0; - m_cassold = 0; -} - -void bml3_state::machine_reset() -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - - /* defaults */ - mem.install_rom(0xa000, 0xfeff,memregion("maincpu")->base() + 0xa000); - mem.install_rom(0xfff0, 0xffff,memregion("maincpu")->base() + 0xfff0); - mem.install_write_handler(0xa000, 0xbfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_a000_w), this),0); - mem.install_write_handler(0xc000, 0xdfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_c000_w), this),0); - mem.install_write_handler(0xe000, 0xefff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_e000_w), this),0); - mem.install_write_handler(0xf000, 0xfeff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_f000_w), this),0); - mem.install_write_handler(0xfff0, 0xffff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_fff0_w), this),0); - - m_firq_mask = -1; // disable firq -} - -WRITE8_MEMBER(bml3_state::bml3_piaA_w) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - /* ROM banking: - -0-- --0- 0xa000 - 0xbfff ROM R RAM W - -1-- --0- 0xa000 - 0xbfff RAM R/W - -x-- --1- 0xa000 - 0xbfff no change - 0--- -0-- 0xc000 - 0xdfff ROM R RAM W - 1--- -0-- 0xc000 - 0xdfff RAM R/W - x--- -1-- 0xc000 - 0xdfff no change - 0--- 0--- 0xe000 - 0xefff ROM R RAM W - 1--- 0--- 0xe000 - 0xefff RAM R/W - x--- 1--- 0xe000 - 0xefff no change - ---- ---x 0xf000 - 0xfeff (0) ROM R RAM W (1) RAM R/W - ---- --x- 0xfff0 - 0xffff (0) ROM R RAM W (1) RAM R/W - */ - logerror("Check banking PIA A -> %02x\n",data); - - if(!(data & 0x2)) - { - if(data & 0x40) - { - mem.install_readwrite_handler(0xa000, 0xbfff, 0, 0, - read8_delegate(FUNC(bml3_state::bml3_a000_r), this), - write8_delegate(FUNC(bml3_state::bml3_a000_w), this), 0); - } - else - { - mem.install_rom(0xa000, 0xbfff, - memregion("maincpu")->base() + 0xa000); - mem.install_write_handler(0xa000, 0xbfff, 0, 0, - write8_delegate(FUNC(bml3_state::bml3_a000_w), this), - 0); - } - } - - if(!(data & 0x4)) - { - if(data & 0x40) - { - mem.install_readwrite_handler(0xc000, 0xdfff, 0, 0, - read8_delegate(FUNC(bml3_state::bml3_c000_r), this), - write8_delegate(FUNC(bml3_state::bml3_c000_w), this), 0); - } - else - { - mem.install_rom(0xc000, 0xdfff, - memregion("maincpu")->base() + 0xc000); - mem.install_write_handler(0xc000, 0xdfff, 0, 0, - write8_delegate(FUNC(bml3_state::bml3_c000_w), this), - 0); - } - } - - if(!(data & 0x8)) - { - if(data & 0x80) - { - mem.install_readwrite_handler(0xe000, 0xefff, 0, 0, - read8_delegate(FUNC(bml3_state::bml3_e000_r), this), - write8_delegate(FUNC(bml3_state::bml3_e000_w), this), 0); - } - else - { - mem.install_rom(0xe000, 0xefff, - memregion("maincpu")->base() + 0xe000); - mem.install_write_handler(0xe000, 0xefff, 0, 0, - write8_delegate(FUNC(bml3_state::bml3_e000_w), this), - 0); - } - } - - if(data & 1) - { - mem.install_readwrite_handler(0xf000, 0xfeff, 0, 0, - read8_delegate(FUNC(bml3_state::bml3_f000_r), this), - write8_delegate(FUNC(bml3_state::bml3_f000_w), this), 0); - } - else - { - mem.install_rom(0xf000, 0xfeff, - memregion("maincpu")->base() + 0xf000); - mem.install_write_handler(0xf000, 0xfeff, 0, 0, - write8_delegate(FUNC(bml3_state::bml3_f000_w), this), - 0); - } - - if(data & 2) - { - mem.install_readwrite_handler(0xfff0, 0xffff, 0, 0, - read8_delegate(FUNC(bml3_state::bml3_fff0_r), this), - write8_delegate(FUNC(bml3_state::bml3_fff0_w), this), 0); - } - else - { - mem.install_rom(0xfff0, 0xffff, - memregion("maincpu")->base() + 0xfff0); - mem.install_write_handler(0xfff0, 0xffff, 0, 0, - write8_delegate(FUNC(bml3_state::bml3_fff0_w), this), - 0); - } -} - -WRITE_LINE_MEMBER( bml3_state::bml3_acia_tx_w ) -{ - //logerror("%02x TAPE\n",state); - m_cassbit = state; -} - - -WRITE_LINE_MEMBER( bml3_state::bml3_acia_rts_w ) -{ - logerror("%02x TAPE RTS\n",state); -} - -WRITE_LINE_MEMBER( bml3_state::bml3_acia_irq_w ) -{ - logerror("%02x TAPE IRQ\n",state); -} - -WRITE_LINE_MEMBER( bml3_state::write_acia_clock ) -{ - m_acia6850->write_txc(state); - m_acia6850->write_rxc(state); -} - -TIMER_DEVICE_CALLBACK_MEMBER( bml3_state::bml3_c ) -{ - m_cass_data[3]++; - - if (m_cassbit != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = m_cassbit; - } - - if (m_cassbit) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -#if 0 -static const ay8910_interface ay8910_config = -{ - AY8910_LEGACY_OUTPUT, - AY8910_DEFAULT_LOADS, - DEVCB_NULL, // read A - DEVCB_NULL, // read B - DEVCB_NULL, // write A - DEVCB_NULL // write B -}; -#endif - -static SLOT_INTERFACE_START(bml3_cards) - SLOT_INTERFACE("bml3mp1802", BML3BUS_MP1802) /* MP-1802 Floppy Controller Card */ - SLOT_INTERFACE("bml3mp1805", BML3BUS_MP1805) /* MP-1805 Floppy Controller Card */ - SLOT_INTERFACE("bml3kanji", BML3BUS_KANJI) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( bml3_common, bml3_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6809, CPU_CLOCK) - MCFG_CPU_VBLANK_INT_DRIVER("screen", bml3_state, bml3_timer_firq) -// MCFG_CPU_PERIODIC_INT_DRIVER(bml3_state, bml3_firq, 45) - -// MCFG_MACHINE_RESET_OVERRIDE(bml3_state,bml3) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2400)) /* Service manual specifies "Raster return period" as 2.4 ms (p.64), although the total vertical non-displaying time seems to be 4 ms. */ - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - /* Devices */ - // CRTC clock should be synchronous with the CPU clock. - MCFG_MC6845_ADD("crtc", H46505, "screen", CPU_CLOCK) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(bml3_state, crtc_update_row) - - // fire once per scan of an individual key - // According to the service manual (p.65), the keyboard timer is driven by the horizontal video sync clock. - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", bml3_state, keyboard_callback, attotime::from_hz(H_CLOCK/2)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("bml3_c", bml3_state, bml3_c, attotime::from_hz(4800)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("bml3_p", bml3_state, bml3_p, attotime::from_hz(40000)) - - MCFG_DEVICE_ADD("pia6821", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(bml3_state, bml3_piaA_w)) - - MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(bml3_state, bml3_acia_tx_w)) - MCFG_ACIA6850_RTS_HANDLER(WRITELINE(bml3_state, bml3_acia_rts_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(bml3_state, bml3_acia_irq_w)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 9600) // 600 baud x 16(divider) = 9600 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bml3_state, write_acia_clock)) - - MCFG_CASSETTE_ADD( "cassette" ) - - /* Audio */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* slot devices */ - MCFG_DEVICE_ADD("bml3bus", BML3BUS, 0) - MCFG_BML3BUS_CPU("maincpu") - MCFG_BML3BUS_OUT_NMI_CB(WRITELINE(bml3_state, bml3bus_nmi_w)) - MCFG_BML3BUS_OUT_IRQ_CB(WRITELINE(bml3_state, bml3bus_irq_w)) - MCFG_BML3BUS_OUT_FIRQ_CB(WRITELINE(bml3_state, bml3bus_firq_w)) - /* Default to MP-1805 disk (3" or 5.25" SS/SD), as our MB-6892 ROM dump includes - the MP-1805 ROM. - User may want to switch this to MP-1802 (5.25" DS/DD). - Note it isn't feasible to use both, as they each place boot ROM at F800. - */ - MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl1", bml3_cards, "bml3mp1805") - MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl2", bml3_cards, NULL) - MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl3", bml3_cards, NULL) - MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl4", bml3_cards, NULL) - MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl5", bml3_cards, NULL) - MCFG_BML3BUS_SLOT_ADD("bml3bus", "sl6", bml3_cards, "bml3kanji") - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( bml3, bml3_common ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(bml3_mem) - -#if 0 - // TODO: slot device for sound card - // audio - MCFG_SOUND_ADD("ym2203", YM2203, 2000000) //unknown clock / divider - MCFG_YM2203_AY8910_INTF(&ay8910_config) - MCFG_SOUND_ROUTE(0, "mono", 0.25) - MCFG_SOUND_ROUTE(1, "mono", 0.25) - MCFG_SOUND_ROUTE(2, "mono", 0.50) - MCFG_SOUND_ROUTE(3, "mono", 0.50) -#endif -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( bml3mk2, bml3_common ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(bml3mk2_mem) - - // TODO: anything to add here? -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( bml3mk5, bml3_common ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(bml3mk5_mem) - - // TODO: anything to add here? -MACHINE_CONFIG_END - - - -/* ROM definition */ -ROM_START( bml3 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) -// ROM_LOAD( "l3bas.rom", 0xa000, 0x6000, BAD_DUMP CRC(d81baa07) SHA1(a8fd6b29d8c505b756dbf5354341c48f9ac1d24d)) //original, 24k isn't a proper rom size! - // TODO: replace with MB-6890 ROMs (these are from an MB-6892) - ROM_LOAD( "598 p16611.ic3", 0xa000, 0x2000, BAD_DUMP CRC(954b9bad) SHA1(047948fac6808717c60a1d0ac9205a5725362430)) - ROM_LOAD( "599 p16561.ic4", 0xc000, 0x2000, BAD_DUMP CRC(b27a48f5) SHA1(94cb616df4caa6415c5076f9acdf675acb7453e2)) - // TODO: Replace checksums with a ROM dump without a disk controller patch (checksums here are inclusive of the MP1805 patch) - ROM_LOAD( "600 p16681.ic5", 0xe000, 0x2000, BAD_DUMP CRC(fe3988a5) SHA1(edc732f1cd421e0cf45ffcfc71c5589958ceaae7)) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD("font.rom", 0x00000, 0x1000, BAD_DUMP CRC(0b6f2f10) SHA1(dc411b447ca414e94843636d8b5f910c954581fb) ) // handcrafted - - ROM_REGION( 0x8000, "vram", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( bml3mk2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) -// ROM_LOAD( "l3bas.rom", 0xa000, 0x6000, BAD_DUMP CRC(d81baa07) SHA1(a8fd6b29d8c505b756dbf5354341c48f9ac1d24d)) //original, 24k isn't a proper rom size! - // TODO: replace with MB-6891 ROMs (these are from an MB-6892) - ROM_LOAD( "598 p16611.ic3", 0xa000, 0x2000, BAD_DUMP CRC(954b9bad) SHA1(047948fac6808717c60a1d0ac9205a5725362430)) - ROM_LOAD( "599 p16561.ic4", 0xc000, 0x2000, BAD_DUMP CRC(b27a48f5) SHA1(94cb616df4caa6415c5076f9acdf675acb7453e2)) - ROM_LOAD( "600 p16681.ic5", 0xe000, 0x2000, BAD_DUMP CRC(fe3988a5) SHA1(edc732f1cd421e0cf45ffcfc71c5589958ceaae7)) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD("font.rom", 0x00000, 0x1000, BAD_DUMP CRC(0b6f2f10) SHA1(dc411b447ca414e94843636d8b5f910c954581fb) ) // handcrafted - - ROM_REGION( 0x8000, "vram", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( bml3mk5 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) -// ROM_LOAD( "l3bas.rom", 0xa000, 0x6000, BAD_DUMP CRC(d81baa07) SHA1(a8fd6b29d8c505b756dbf5354341c48f9ac1d24d)) //original, 24k isn't a proper rom size! - /* Handcrafted ROMs, rom labels and contents might not match */ - ROM_LOAD( "598 p16611.ic3", 0xa000, 0x2000, BAD_DUMP CRC(954b9bad) SHA1(047948fac6808717c60a1d0ac9205a5725362430)) - ROM_LOAD( "599 p16561.ic4", 0xc000, 0x2000, BAD_DUMP CRC(b27a48f5) SHA1(94cb616df4caa6415c5076f9acdf675acb7453e2)) - // TODO: Replace checksums with a ROM dump without a disk controller patch (checksums here are inclusive of the MP1805 patch) - ROM_LOAD( "600 p16681.ic5", 0xe000, 0x2000, BAD_DUMP CRC(fe3988a5) SHA1(edc732f1cd421e0cf45ffcfc71c5589958ceaae7)) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD("font.rom", 0x00000, 0x1000, BAD_DUMP CRC(0b6f2f10) SHA1(dc411b447ca414e94843636d8b5f910c954581fb) ) // handcrafted - - ROM_REGION( 0x8000, "vram", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, bml3, 0, 0, bml3, bml3, driver_device, 0, "Hitachi", "MB-6890 Basic Master Level 3", MACHINE_NOT_WORKING) -COMP( 1982, bml3mk2,bml3, 0, bml3mk2, bml3, driver_device, 0, "Hitachi", "MB-6891 Basic Master Level 3 Mark 2", MACHINE_NOT_WORKING) -COMP( 1983, bml3mk5,bml3, 0, bml3mk5, bml3, driver_device, 0, "Hitachi", "MB-6892 Basic Master Level 3 Mark 5", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/bob85.c b/src/mess/drivers/bob85.c deleted file mode 100644 index ce09e503fc3..00000000000 --- a/src/mess/drivers/bob85.c +++ /dev/null @@ -1,226 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - BOB85 driver by Miodrag Milanovic - - 2008-05-24 Preliminary driver. - 2009-05-12 Skeleton driver. - 2013-06-02 Working driver. - -Pasting: - 0-F : as is - NEXT : ^ - SMEM : - - GO : X - -Test Paste: - -0600^11^22^33^44^55^66^77^88^99^--0600^ - Now press up-arrow to confirm the data has been entered. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "bob85.lh" - - -class bob85_state : public driver_device -{ -public: - bob85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cass(*this, "cassette"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1"), - m_line2(*this, "LINE2") { } - - required_device m_maincpu; - required_device m_cass; - DECLARE_READ8_MEMBER(bob85_keyboard_r); - DECLARE_WRITE8_MEMBER(bob85_7seg_w); - DECLARE_WRITE_LINE_MEMBER(sod_w); - DECLARE_READ_LINE_MEMBER(sid_r); - UINT8 m_prev_key; - UINT8 m_count_key; - virtual void machine_reset(); - -protected: - required_ioport m_line0; - required_ioport m_line1; - required_ioport m_line2; -}; - - - -READ8_MEMBER(bob85_state::bob85_keyboard_r) -{ - UINT8 retVal = 0; - UINT8 line0 = m_line0->read(); - UINT8 line1 = m_line1->read(); - UINT8 line2 = m_line2->read(); - - if (line0) - { - switch(line0) - { - case 0x01 : retVal = 0x80; break; - case 0x02 : retVal = 0x81; break; - case 0x04 : retVal = 0x82; break; - case 0x08 : retVal = 0x83; break; - case 0x10 : retVal = 0x84; break; - case 0x20 : retVal = 0x85; break; - case 0x40 : retVal = 0x86; break; - case 0x80 : retVal = 0x87; break; - default : break; - } - } - - if (line1) - { - switch(line1) - { - case 0x01 : retVal = 0x88; break; - case 0x02 : retVal = 0x89; break; - case 0x04 : retVal = 0x8A; break; - case 0x08 : retVal = 0x8B; break; - case 0x10 : retVal = 0x8C; break; - case 0x20 : retVal = 0x8D; break; - case 0x40 : retVal = 0x8E; break; - case 0x80 : retVal = 0x8F; break; - default : break; - } - } - - if (line2) - { - switch(line2) - { - case 0x01 : retVal |= 0x90; break; - case 0x02 : retVal |= 0xA0; break; - case 0x04 : retVal |= 0xB0; break; - case 0x08 : retVal |= 0xC0; break; - case 0x10 : retVal |= 0xD0; break; - case 0x20 : retVal |= 0xE0; break; - default : break; - } - } - - if (retVal != m_prev_key) - { - m_prev_key = retVal; - m_count_key = 0; - return retVal; - } - else - { - if (m_count_key <1) - { - m_count_key++; - return retVal; - } - else - return 0; - } - - if (retVal == 0) - { - m_prev_key = 0; - m_count_key = 0; - } - - return retVal; -} - -WRITE8_MEMBER(bob85_state::bob85_7seg_w) -{ - output_set_digit_value(offset, BITSWAP8( data,3,2,1,0,7,6,5,4 )); -} - -static ADDRESS_MAP_START( bob85_mem, AS_PROGRAM, 8, bob85_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x02ff) AM_ROM - AM_RANGE(0x0600, 0x09ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( bob85_io, AS_IO, 8, bob85_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0a, 0x0a) AM_READ(bob85_keyboard_r) - AM_RANGE(0x0a, 0x0f) AM_WRITE(bob85_7seg_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( bob85 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SMEM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REC") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VEK1") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VEK2") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0xC0, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -void bob85_state::machine_reset() -{ -} - -WRITE_LINE_MEMBER( bob85_state::sod_w ) -{ - m_cass->output(state ? +1.0 : -1.0); -} - -READ_LINE_MEMBER( bob85_state::sid_r ) -{ - return m_cass->input() > 0.0; -} - -static MACHINE_CONFIG_START( bob85, bob85_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8085A, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(bob85_mem) - MCFG_CPU_IO_MAP(bob85_io) - MCFG_I8085A_SID(READLINE(bob85_state, sid_r)) - MCFG_I8085A_SOD(WRITELINE(bob85_state, sod_w)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_bob85) - - // devices - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( bob85 ) - ROM_REGION( 0x600, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bob85.rom", 0x0000, 0x0300, BAD_DUMP CRC(adde33a8) SHA1(00f26dd0c52005e7705e6cc9cb11a20e572682c6) ) // should be 6 separate 74S287's (256x4) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, bob85, 0, 0, bob85, bob85, driver_device, 0, "Josef Kratochvil", "BOB-85", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/br8641.c b/src/mess/drivers/br8641.c deleted file mode 100644 index 671aeab491d..00000000000 --- a/src/mess/drivers/br8641.c +++ /dev/null @@ -1,200 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Brandt 8641 - - Currency Counter - - 2012-12-24 Skeleton driver. [Micko] - 2015-09-27 Added devices & inputs based entirely on guesswork [Robbbert] - - There seems to be 15 buttons (according to images, I just have board) - also there are 8 dips currently set at 00011100 (1 is on) - - Looks like a LCD display? I think ports 8 & 9 write to it. Also looks - like the display should say 8641 when machine is turned on. - -ToDo: -- Need manuals, schematics, etc. -- Artwork -- Everything - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "sound/beep.h" - -class brandt8641_state : public driver_device -{ -public: - brandt8641_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_pio1(*this, "pio1") - , m_pio2(*this, "pio2") - , m_pio3(*this, "pio3") - , m_ctc(*this, "ctc") - , m_io_keyboard(*this, "KEY") - , m_beep(*this, "beeper") - { } - - DECLARE_READ8_MEMBER(port08_r); - DECLARE_WRITE8_MEMBER(port08_w); - DECLARE_WRITE8_MEMBER(port09_w); - DECLARE_MACHINE_RESET(br8641); - -private: - UINT8 m_port08; - UINT8 m_port09; - required_device m_maincpu; - required_device m_pio1; - required_device m_pio2; - required_device m_pio3; - required_device m_ctc; - required_ioport_array<8> m_io_keyboard; - required_device m_beep; -}; - -static ADDRESS_MAP_START(brandt8641_mem, AS_PROGRAM, 8, brandt8641_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_ROM // 27256 at U12 - AM_RANGE(0x8000, 0x9fff) AM_RAM // 8KB static ram 6264 at U12 -ADDRESS_MAP_END - -static ADDRESS_MAP_START(brandt8641_io, AS_IO, 8, brandt8641_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("pio1", z80pio_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("pio2", z80pio_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("pio3", z80pio_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) - AM_RANGE(0x1E, 0x1F) AM_WRITENOP // unknown device -ADDRESS_MAP_END - -/* Input ports */ -// No idea what each key does -static INPUT_PORTS_START( brandt8641 ) - PORT_START("KEY.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) - - PORT_START("KEY.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) - - PORT_START("KEY.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) - - PORT_START("KEY.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) - - PORT_START("KEY.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) - - PORT_START("KEY.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) - - PORT_START("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) - - PORT_START("KEY.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) -INPUT_PORTS_END - -READ8_MEMBER( brandt8641_state::port08_r ) -{ - UINT8 i, data = 7; - - for (i = 0; i < 8; i++) - if BIT(m_port09, i) - data &= m_io_keyboard[i]->read(); - - return data | m_port08; -} - -WRITE8_MEMBER( brandt8641_state::port08_w ) -{ - m_port08 = data & 0xf8; - m_beep->set_state(BIT(data, 4)); -} - -WRITE8_MEMBER( brandt8641_state::port09_w ) -{ - m_port09 = data ^ 0xff; -} - -MACHINE_RESET_MEMBER( brandt8641_state, br8641 ) -{ - m_beep->set_frequency(2000); -} - -static const z80_daisy_config daisy_chain_intf[] = -{ - { "pio1" }, - { "pio2" }, - { "pio3" }, - { "ctc" }, - { NULL } -}; - - - -static MACHINE_CONFIG_START( brandt8641, brandt8641_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) // U4 ,4MHz crystal on board - MCFG_CPU_PROGRAM_MAP(brandt8641_mem) - MCFG_CPU_IO_MAP(brandt8641_io) - MCFG_CPU_CONFIG(daisy_chain_intf) - - MCFG_MACHINE_RESET_OVERRIDE(brandt8641_state, br8641) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - // Z80APIO U9 - // Z80APIO U14 - // Z80PIO U7 - unknown which is which - MCFG_DEVICE_ADD("pio1", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("pio2", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(brandt8641_state, port08_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(brandt8641_state, port08_w)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(brandt8641_state, port09_w)) - - MCFG_DEVICE_ADD("pio3", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_4MHz) // Z80CTC U8 -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( br8641 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "v0911he.u11", 0x0000, 0x8000, CRC(59a16951) SHA1(893dba60ec8bfa391fb2d2a30db5d42d601f5eb9)) -ROM_END - -/* Driver */ -COMP( 1986, br8641, 0, 0, brandt8641, brandt8641, driver_device, 0, "Brandt", "Brandt 8641", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/bullet.c b/src/mess/drivers/bullet.c deleted file mode 100644 index 8cfdd256dc4..00000000000 --- a/src/mess/drivers/bullet.c +++ /dev/null @@ -1,1297 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Wave Mate Bullet - -PCB Layout ----------- - -|-------------------------------------------| -| CN7 CN6 | -| PIO | -| FDC | -| 4164 4164 CN5 | -| 4164 4164 SW1 CN2| -| 4164 4164 | -| 4164 4164 PROM | -| 4164 4164 4.9152MHz | -| 4164 4164 16MHz DMA CPU | -| 4164 4164 | -| 4164 4164 CN4 CN3 CN1| -| | -| DART CTC | -| CN8 | -|-------------------------------------------| - -Notes: - Relevant IC's shown. - - CPU - SGS Z80ACPUB1 Z80A CPU - DMA - Zilog Z8410APS Z80A DMA - PIO - SGS Z80APIOB1 Z80A PIO - DART - Zilog Z8470APS Z80A DART - CTC - Zilog Z8430APS Z80A CTC - FDC - Synertek SY1793-02 FDC - PROM - AMD AM27S190C 32x8 TTL PROM - 4164 - Fujitsu MB8264-15 64Kx1 RAM - CN1 - 2x25 PCB header, external DMA bus - CN2 - 2x17 PCB header, Winchester / 2x25 header, SCSI (in board revision E) - CN3 - 2x5 PCB header, RS-232 A (system console) - CN4 - 2x5 PCB header, RS-232 B - CN5 - 2x17 PCB header, Centronics - CN6 - 2x25 PCB header, 8" floppy drives - CN7 - 2x17 PCB header, 5.25" floppy drives - CN8 - 4-pin Molex - -*/ - -/* - - TODO: - - - memory banking is broken - - z80dart wait/ready - - IMI 7710 Winchester controller - chdman createhd -o imi7710.chd -chs 350,3,10 -ss 1024 - - revision E model - -*/ - -#include "includes/bullet.h" -#include "bus/rs232/rs232.h" -#include "bus/scsi/scsihd.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -// DMA ready sources -enum -{ - FDRDY = 0, - DARTARDY, - DARTBRDY, - WINRDY, - EXRDY1, - EXRDY2 -}; - -#define SEG0 \ - BIT(m_mbank, 0) - -#define SEG5 \ - BIT(m_mbank, 5) - -#define DMB4 \ - BIT(m_xdma0, 4) - -#define DMB6 \ - BIT(m_xdma0, 6) - - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// mreq_r - -//------------------------------------------------- - -READ8_MEMBER( bullet_state::mreq_r ) -{ - UINT8 data = 0; - - if (!m_brom && !BIT(offset, 5)) - { - data = m_rom->base()[offset & 0x1f]; - } - else - { - if (offset < 0xc000) - { - data = m_ram->pointer()[(m_segst << 16) | offset]; - } - else - { - data = m_ram->pointer()[offset]; - } - } - - return data; -} - - -//------------------------------------------------- -// mreq_w - -//------------------------------------------------- - -WRITE8_MEMBER( bullet_state::mreq_w ) -{ - if (offset < 0xc000) - { - m_ram->pointer()[(m_segst << 16) | offset] = data; - } - else - { - m_ram->pointer()[offset] = data; - } -} - - -//------------------------------------------------- -// win_r - -//------------------------------------------------- - -READ8_MEMBER( bullet_state::win_r ) -{ - return 0; -} - - -//------------------------------------------------- -// wstrobe_w - -//------------------------------------------------- - -WRITE8_MEMBER( bullet_state::wstrobe_w ) -{ -} - - -//------------------------------------------------- -// brom_r - -//------------------------------------------------- - -READ8_MEMBER( bullet_state::brom_r ) -{ - m_brom = 1; - - return 0; -} - - -//------------------------------------------------- -// brom_w - -//------------------------------------------------- - -WRITE8_MEMBER( bullet_state::brom_w ) -{ - m_brom = 1; -} - - -//------------------------------------------------- -// exdsk_w - -//------------------------------------------------- - -WRITE8_MEMBER( bullet_state::exdsk_w ) -{ - /* - - bit signal description - - 0 drive select 0 - 1 drive select 1 - 2 select 8" floppy - 3 MSE select software control of port - 4 SIDE select side 2 - 5 _MOTOR disable 5" floppy spindle motors - 6 - 7 WPRC enable write precompensation - - */ - - if (BIT(data, 3)) - { - m_exdsk_sw = true; - } - - if (m_exdsk_sw) - { - // drive select - m_floppy = NULL; - - switch (data & 0x07) - { - // 5.25" - case 0: m_floppy = m_floppy0->get_device(); break; - case 1: m_floppy = m_floppy1->get_device(); break; - case 2: m_floppy = m_floppy2->get_device(); break; - case 3: m_floppy = m_floppy3->get_device(); break; - // 8" - case 4: m_floppy = m_floppy4->get_device(); break; - case 5: m_floppy = m_floppy5->get_device(); break; - case 6: m_floppy = m_floppy6->get_device(); break; - case 7: m_floppy = m_floppy7->get_device(); break; - } - - m_fdc->set_floppy(m_floppy); - } - - if (m_floppy) - { - // side select - m_floppy->ss_w(BIT(data, 4)); - - // floppy motor - m_floppy->mon_w(BIT(data, 5)); - } -} - - -//------------------------------------------------- -// exdma_w - -//------------------------------------------------- - -WRITE8_MEMBER( bullet_state::exdma_w ) -{ - /* - - bit description - - 0 DMA ready source select 0 - 1 DMA ready source select 1 - 2 DMA ready source select 2 - 3 memory control 0 - 4 memory control 1 - 5 - 6 - 7 - - */ - - m_exdma = data; - - m_buf = BIT(data, 3); - - update_dma_rdy(); -} - - -//------------------------------------------------- -// hdcon_w - -//------------------------------------------------- - -WRITE8_MEMBER( bullet_state::hdcon_w ) -{ - /* - - bit signal description - - 0 PLO phase lock oscillator - 1 RCD read clock frequency - 2 EXC MB8877 clock frequency - 3 DEN MB8877 density select - 4 enable software control of mode - 5 - 6 - 7 - - */ - - if (BIT(data, 4)) - { - m_hdcon_sw = true; - } - - if (m_hdcon_sw) - { - // FDC clock - m_fdc->set_unscaled_clock(BIT(data, 2) ? XTAL_16MHz/16 : XTAL_16MHz/8); - - // density select - m_fdc->dden_w(BIT(data, 3)); - } -} - - -//------------------------------------------------- -// info_r - -//------------------------------------------------- - -READ8_MEMBER( bullet_state::info_r ) -{ - /* - - bit signal description - - 0 SW1 DIP switch 1 - 1 SW2 DIP switch 2 - 2 SW3 DIP switch 3 - 3 SW4 DIP switch 4 - 4 HLDST floppy disk head load status - 5 *XDCG floppy disk exchange (8" only) - 6 FDIRQ FDC interrupt request line - 7 FDDRQ FDC data request line - - */ - - UINT8 data = 0; - - // DIP switches - data |= m_sw1->read() & 0x0f; - - // floppy - data |= m_fdc->hld_r() << 4; - data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 5; - data |= m_fdc->intrq_r() << 6; - data |= m_fdc->drq_r() << 7; - - return data; -} - - -//------------------------------------------------- -// segst_w - -//------------------------------------------------- - -WRITE8_MEMBER( bullet_state::segst_w ) -{ - m_segst = BIT(data, 0); -} - - -//------------------------------------------------- -// mreq_r - -//------------------------------------------------- - -READ8_MEMBER( bulletf_state::mreq_r ) -{ - UINT8 data = 0; - - if (!m_rome && !BIT(offset, 5)) - { - data = m_rom->base()[offset & 0x1f]; - } - else - { - if (offset < 0xc000) - { - if (!SEG5) - { - data = m_ram->pointer()[(SEG0 << 16) | offset]; - } - else if (offset >= 0x8000) - { - data = m_ram->pointer()[0x1c000 + (offset - 0x8000)]; - } - } - else - { - data = m_ram->pointer()[offset]; - } - } - - return data; -} - - -//------------------------------------------------- -// mreq_w - -//------------------------------------------------- - -WRITE8_MEMBER( bulletf_state::mreq_w ) -{ - if (offset < 0xc000) - { - if (!SEG5) - { - m_ram->pointer()[(SEG0 << 16) | offset] = data; - } - else if (offset >= 0x8000) - { - m_ram->pointer()[0x1c000 + (offset - 0x8000)] = data; - } - } - else - { - m_ram->pointer()[offset] = data; - } -} - - -//------------------------------------------------- -// xdma0_w - -//------------------------------------------------- - -WRITE8_MEMBER( bulletf_state::xdma0_w ) -{ - /* - - bit signal - - 0 device select (0=FDC, 1=SCSI) - 1 - 2 - 3 - 4 DMB4 Source bank - 5 - 6 DMB6 Destination bank - 7 - - */ - - m_rome = 1; - - m_xdma0 = data; -} - - -//------------------------------------------------- -// xfdc_w - -//------------------------------------------------- - -WRITE8_MEMBER( bulletf_state::xfdc_w ) -{ - /* - - bit signal - - 0 Unit select number - 1 Unit select number - 2 Unit select number - 3 Unit select number - 4 Select side 2 - 5 Disable 3 & 5 inch spindle motors - 6 Set for 1 MHz controller operation, reset for 2 MHz controller operation - 7 Set to select single density - - */ - - // drive select - m_floppy = NULL; - - switch (data & 0x0f) - { - // 5.25" - case 0: m_floppy = m_floppy0->get_device(); break; - case 1: m_floppy = m_floppy1->get_device(); break; - case 2: m_floppy = m_floppy2->get_device(); break; - case 3: m_floppy = m_floppy3->get_device(); break; - // 8" - case 4: m_floppy = m_floppy4->get_device(); break; - case 5: m_floppy = m_floppy5->get_device(); break; - case 6: m_floppy = m_floppy6->get_device(); break; - case 7: m_floppy = m_floppy7->get_device(); break; - // 3.5" - case 8: m_floppy = m_floppy8->get_device(); break; - case 9: m_floppy = m_floppy9->get_device(); break; - } - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) - { - // side select - m_floppy->ss_w(BIT(data, 4)); - - // floppy motor - m_floppy->mon_w(BIT(data, 5)); - } - - // FDC clock - m_fdc->set_unscaled_clock(BIT(data, 6) ? XTAL_16MHz/16 : XTAL_16MHz/8); - - // density select - m_fdc->dden_w(BIT(data, 7)); -} - - -//------------------------------------------------- -// mbank_w - -//------------------------------------------------- - -WRITE8_MEMBER( bulletf_state::mbank_w ) -{ - /* - - bit signal - - 0 Select active bank (0=bank 0, 1=bank 1) - 1 - 2 - 3 - 4 Select system space overlay (0=no overlay, 1=overlay) - 5 - 6 - 7 - - */ - - m_mbank = data; -} - - -//------------------------------------------------- -// scsi_r - -//------------------------------------------------- - -READ8_MEMBER( bulletf_state::scsi_r ) -{ - UINT8 data = m_scsi_data_in->read(); - - m_scsibus->write_ack(1); - - m_wack = 0; - update_dma_rdy(); - - return data; -} - - -//------------------------------------------------- -// scsi_w - -//------------------------------------------------- - -WRITE8_MEMBER( bulletf_state::scsi_w ) -{ - m_scsi_data_out->write(data); - - m_scsibus->write_ack(1); - - m_wack = 0; - update_dma_rdy(); -} - -//------------------------------------------------- -// hwsts_r - -//------------------------------------------------- - -READ8_MEMBER( bulletf_state::hwsts_r ) -{ - /* - - bit signal - - 0 CBUSY Centronics busy - 1 SW2 DIP switch 2 - 2 SW3 DIP switch 3 - 3 FD2S *Floppy disk two sided - 4 HLDST Floppy disk head load status - 5 XDCG *Floppy disk exchange (8-inch only) - 6 FDIRQ FDC interrupt request line - 7 FDDRQ FDC data request line - - */ - - UINT8 data = 0; - - // centronics busy - data |= m_centronics_busy; - - // DIP switches - data |= m_sw1->read() & 0x06; - - // floppy - data |= (m_floppy ? m_floppy->twosid_r() : 1) << 3; - data |= m_fdc->hld_r() << 4; - data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 5; - data |= m_fdc->intrq_r() << 6; - data |= m_fdc->drq_r() << 7; - - return data; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( bullet_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( bullet_mem, AS_PROGRAM, 8, bullet_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(mreq_r, mreq_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( bullet_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( bullet_io, AS_IO, 8, bullet_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1f) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x03) AM_READWRITE(win_r, wstrobe_w) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(MB8877_TAG, mb8877_t, read, write) - AM_RANGE(0x14, 0x14) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) - AM_RANGE(0x15, 0x15) AM_READWRITE(brom_r, brom_w) - AM_RANGE(0x16, 0x16) AM_WRITE(exdsk_w) - AM_RANGE(0x17, 0x17) AM_WRITE(exdma_w) - AM_RANGE(0x18, 0x18) AM_WRITE(hdcon_w) - AM_RANGE(0x19, 0x19) AM_READ(info_r) - AM_RANGE(0x1a, 0x1a) AM_WRITE(segst_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( bulletf_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( bulletf_mem, AS_PROGRAM, 8, bulletf_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(mreq_r, mreq_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( bulletf_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( bulletf_io, AS_IO, 8, bulletf_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3f) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(MB8877_TAG, mb8877_t, read, write) - AM_RANGE(0x14, 0x14) AM_WRITE(xdma0_w) - AM_RANGE(0x16, 0x16) AM_WRITE(xfdc_w) - AM_RANGE(0x17, 0x17) AM_WRITE(mbank_w) - AM_RANGE(0x19, 0x19) AM_READWRITE(scsi_r, scsi_w) - AM_RANGE(0x1a, 0x1a) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) - AM_RANGE(0x1b, 0x1b) AM_READ(hwsts_r) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( bullet ) -//------------------------------------------------- - -INPUT_PORTS_START( bullet ) - PORT_START("SW1") - PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" ) - PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) - PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) - PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" ) - PORT_DIPNAME( 0xf0, 0x50, "Floppy Type" ) PORT_DIPLOCATION("SW1:5,6,7,8") - PORT_DIPSETTING( 0xf0, "5.25\" SD" ) - PORT_DIPSETTING( 0x50, "5.25\" DD" ) - PORT_DIPSETTING( 0x90, "8\" SD" ) - PORT_DIPSETTING( 0x00, "8\" DD" ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( bulletf ) -//------------------------------------------------- - -INPUT_PORTS_START( bulletf ) - PORT_START("SW1") - PORT_DIPNAME( 0x01, 0x01, "SCSI Bus Termination" ) PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) - PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) - PORT_DIPNAME( 0x08, 0x08, "Boot ROM Device" ) PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x00, "Onboard" ) - PORT_DIPSETTING( 0x08, "EPROM" ) - PORT_DIPNAME( 0xf0, 0xc0, "Floppy Type" ) PORT_DIPLOCATION("SW1:5,6,7,8") - PORT_DIPSETTING( 0x10, "3\" DD" ) - PORT_DIPSETTING( 0xc0, "5.25\" SD" ) - PORT_DIPSETTING( 0x40, "5.25\" DD" ) - PORT_DIPSETTING( 0xa0, "8\" SD" ) - PORT_DIPSETTING( 0x20, "8\" DD" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// Z80CTC -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(bullet_state::ctc_tick) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); - - m_ctc->trg1(1); - m_ctc->trg1(0); - - m_ctc->trg2(1); - m_ctc->trg2(0); -} - -WRITE_LINE_MEMBER( bullet_state::dart_rxtxca_w ) -{ - m_dart->txca_w(state); - m_dart->rxca_w(state); -} - -//------------------------------------------------- -// Z80DART -//------------------------------------------------- - -WRITE_LINE_MEMBER( bullet_state::dartardy_w ) -{ - m_dartardy = state; - update_dma_rdy(); -} - -WRITE_LINE_MEMBER( bullet_state::dartbrdy_w ) -{ - m_dartbrdy = state; - update_dma_rdy(); -} - -//------------------------------------------------- -// Z80DMA -//------------------------------------------------- - -void bullet_state::update_dma_rdy() -{ - int rdy = 1; - - switch (m_exdma & 0x07) - { - case FDRDY: - rdy = m_fdrdy; - break; - - case DARTARDY: - rdy = m_dartardy; - break; - - case DARTBRDY: - rdy = m_dartbrdy; - break; - - case WINRDY: - rdy = m_winrdy; - break; - - case EXRDY1: - rdy = m_exrdy1; - break; - - case EXRDY2: - rdy = m_exrdy2; - break; - } - - m_dmac->rdy_w(rdy); -} - -READ8_MEMBER( bullet_state::dma_mreq_r ) -{ - UINT8 data = m_ram->pointer()[(m_buf << 16) | offset]; - - if (BIT(m_exdma, 4)) - { - m_buf = !m_buf; - } - - return data; -} - -WRITE8_MEMBER( bullet_state::dma_mreq_w ) -{ - m_ram->pointer()[(m_buf << 16) | offset] = data; - - if (BIT(m_exdma, 4)) - { - m_buf = !m_buf; - } -} - -READ8_MEMBER(bullet_state::io_read_byte) -{ - return m_maincpu->space(AS_IO).read_byte(offset); -} - -WRITE8_MEMBER(bullet_state::io_write_byte) -{ - m_maincpu->space(AS_IO).write_byte(offset, data); -} - -//------------------------------------------------- -// Z80DMA for bulletf (not used currently) -//------------------------------------------------- - -void bulletf_state::update_dma_rdy() -{ - int rdy = 1; - - if (BIT(m_xdma0, 0)) - { - rdy = m_wack || m_wrdy; - } - else - { - rdy = m_fdrdy; - } - - m_dmac->rdy_w(rdy); -} - -READ8_MEMBER( bulletf_state::dma_mreq_r ) -{ - return m_ram->pointer()[(DMB4 << 16) | offset]; -} - -WRITE8_MEMBER( bulletf_state::dma_mreq_w ) -{ - m_ram->pointer()[(DMB6 << 16) | offset] = data; -} - -//------------------------------------------------- -// Z80PIO -//------------------------------------------------- - -DECLARE_WRITE_LINE_MEMBER( bullet_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -DECLARE_WRITE_LINE_MEMBER( bullet_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -DECLARE_WRITE_LINE_MEMBER( bullet_state::write_centronics_select ) -{ - m_centronics_select = state; -} - -DECLARE_WRITE_LINE_MEMBER( bullet_state::write_centronics_fault ) -{ - m_centronics_fault = state; -} - -READ8_MEMBER( bullet_state::pio_pb_r ) -{ - /* - - bit signal description - - 0 centronics busy - 1 centronics paper end - 2 centronics selected - 3 *FAULT centronics fault - 4 external vector - 5 WBUSDIR winchester bus direction - 6 WCOMPLETE winchester command complete - 7 *WINRDY winchester ready - - */ - - UINT8 data = 0; - - // centronics - data |= m_centronics_busy; - data |= m_centronics_perror << 1; - data |= m_centronics_select << 2; - data |= m_centronics_fault << 3; - - return data; -} - - -WRITE8_MEMBER( bulletf_state::pio_pa_w ) -{ - /* - - bit signal - - 0 ATN - 1 RST - 2 SEL - 3 BUSY - 4 MSG - 5 C/D - 6 REQ - 7 I/O - - */ - - m_scsibus->write_atn(BIT(data, 0)); - m_scsibus->write_rst(BIT(data, 1)); - m_scsibus->write_sel(BIT(data, 2)); -} - -WRITE_LINE_MEMBER( bulletf_state::cstrb_w ) -{ - m_centronics->write_strobe(!state); -} - -static SLOT_INTERFACE_START( bullet_525_floppies ) - SLOT_INTERFACE( "525sd", FLOPPY_525_SD ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START( bullet_8_floppies ) - SLOT_INTERFACE( "8dssd", FLOPPY_8_DSSD ) - SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START( bullet_35_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER( bullet_state::fdc_drq_w ) -{ - m_fdrdy = !state; - update_dma_rdy(); -} - -WRITE_LINE_MEMBER( bulletf_state::req_w ) -{ - if (!state) - { - m_scsibus->write_ack(0); - - m_wack = 1; - } - - m_wrdy = !state; - update_dma_rdy(); - - m_scsi_ctrl_in->write_bit6(state); -} - - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - - -//------------------------------------------------- -// z80_daisy_config daisy_chain -//------------------------------------------------- - -static const z80_daisy_config daisy_chain[] = -{ - { Z80DMA_TAG }, - { Z80DART_TAG }, - { Z80PIO_TAG }, - { Z80CTC_TAG }, - { NULL } -}; - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( bullet ) -//------------------------------------------------- - -void bullet_state::machine_start() -{ - // state saving - save_item(NAME(m_segst)); - save_item(NAME(m_brom)); - save_item(NAME(m_exdma)); - save_item(NAME(m_buf)); - save_item(NAME(m_fdrdy)); - save_item(NAME(m_dartardy)); - save_item(NAME(m_dartbrdy)); - save_item(NAME(m_winrdy)); - save_item(NAME(m_exrdy1)); - save_item(NAME(m_exrdy2)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_perror)); - save_item(NAME(m_centronics_select)); - save_item(NAME(m_centronics_fault)); -} - - -//------------------------------------------------- -// MACHINE_START( bulletf ) -//------------------------------------------------- - -void bulletf_state::machine_start() -{ - // state saving - save_item(NAME(m_fdrdy)); - save_item(NAME(m_rome)); - save_item(NAME(m_xdma0)); - save_item(NAME(m_mbank)); - save_item(NAME(m_wack)); - save_item(NAME(m_wrdy)); - save_item(NAME(m_centronics_busy)); -} - - -void bullet_state::machine_reset() -{ - // memory banking - m_brom = 0; - m_segst = 0; - - // DMA ready - m_exdma = 0; - m_buf = 0; - update_dma_rdy(); - - // disable software control - m_exdsk_sw = false; - m_hdcon_sw = false; - - UINT8 sw1 = m_sw1->read(); - int mini = BIT(sw1, 6); - m_fdc->set_unscaled_clock(mini ? XTAL_16MHz/16 : XTAL_16MHz/8); - m_fdc->dden_w(BIT(sw1, 7)); - - if (mini) - { - m_floppy = m_floppy0->get_device(); - } - else - { - m_floppy = m_floppy4->get_device(); - } - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) - { - m_floppy->ss_w(0); - m_floppy->mon_w(0); - } -} - - -void bulletf_state::machine_reset() -{ - // memory banking - m_rome = 0; - m_mbank = 0; - - // DMA ready - m_xdma0 = 0; - m_wack = 0; - m_wrdy = 0; - update_dma_rdy(); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( bullet ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( bullet, bullet_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) - MCFG_CPU_PROGRAM_MAP(bullet_mem) - MCFG_CPU_IO_MAP(bullet_io) - MCFG_CPU_CONFIG(daisy_chain) - - // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(bullet_state, dart_rxtxca_w)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bullet_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4)) - - MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_16MHz/4, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(bullet_state, dartardy_w)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(bullet_state, dartbrdy_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_16MHz/4) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(bullet_state, dma_mreq_r)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(bullet_state, dma_mreq_w)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(bullet_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(bullet_state, io_write_byte)) - - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_16MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_IN_PB_CB(READ8(bullet_state, pio_pb_r)) - - MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bullet_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", bullet_525_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":1", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":2", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":3", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":4", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":5", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":6", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":7", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(bullet_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(bullet_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(bullet_state, write_centronics_select)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(bullet_state, write_centronics_fault)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "wmbullet") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( bulletf ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( bulletf, bulletf_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) - MCFG_CPU_PROGRAM_MAP(bulletf_mem) - MCFG_CPU_IO_MAP(bulletf_io) - MCFG_CPU_CONFIG(daisy_chain) - - // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(bullet_state, dart_rxtxca_w)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bullet_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4)) - - MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_16MHz/4, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(bullet_state, dartardy_w)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(bullet_state, dartbrdy_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_16MHz/4) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(bullet_state, dma_mreq_r)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(bullet_state, dma_mreq_w)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(bullet_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(bullet_state, io_write_byte)) - - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_16MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(DEVREAD8("scsi_ctrl_in", input_buffer_device, read)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(bulletf_state, pio_pa_w)) - MCFG_Z80PIO_OUT_ARDY_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(bulletf_state, cstrb_w)) - - MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z80DART_TAG, z80dart_device, rib_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bullet_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", bullet_525_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":1", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":2", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":3", bullet_525_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":4", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":5", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":6", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":7", bullet_8_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":8", bullet_35_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":9", bullet_35_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(bullet_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) - - MCFG_DEVICE_ADD(SCSIBUS_TAG, SCSI_PORT, 0) - MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3)) - MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit4)) - MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit5)) - MCFG_SCSI_REQ_HANDLER(WRITELINE(bulletf_state, req_w)) - MCFG_SCSI_IO_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit7)) - MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") - - MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SCSIBUS_TAG) - MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0) - MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) - - MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "wmbullet") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( bullet ) -//------------------------------------------------- - -ROM_START( wmbullet ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "sr70x.u8", 0x00, 0x20, CRC(d54b8a30) SHA1(65ff8753dd63c9dd1899bc9364a016225585d050) ) -ROM_END - - -#define rom_wmbulletf rom_wmbullet - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -// the setname 'bullet' is used by Sega's Bullet in MAME. -COMP( 1982, wmbullet, 0, 0, bullet, bullet, driver_device, 0, "Wave Mate", "Bullet", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1984, wmbulletf, wmbullet, 0, bulletf, bulletf, driver_device, 0, "Wave Mate", "Bullet (Revision F)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/busicom.c b/src/mess/drivers/busicom.c deleted file mode 100644 index adcb77be331..00000000000 --- a/src/mess/drivers/busicom.c +++ /dev/null @@ -1,249 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Busicom 141-PF - - 04/08/2009 Initial driver by Miodrag Milanovic - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i4004/i4004.h" -#include "includes/busicom.h" - - -UINT8 busicom_state::get_bit_selected(UINT32 val,int num) -{ - int i; - for(i=0;iread(); -} - -READ8_MEMBER(busicom_state::printer_r) -{ - UINT8 retVal = 0; - if (m_drum_index==0) retVal |= 1; - retVal |= ioport("PAPERADV")->read() & 1 ? 8 : 0; - return retVal; -} - - -WRITE8_MEMBER(busicom_state::shifter_w) -{ - if (BIT(data,0)) { - m_keyboard_shifter <<= 1; - m_keyboard_shifter |= BIT(data,1); - } - if (BIT(data,2)) { - m_printer_shifter <<= 1; - m_printer_shifter |= BIT(data,1); - } -} - -WRITE8_MEMBER(busicom_state::printer_w) -{ - int i,j; - if (BIT(data,0)) { - logerror("color : %02x %02x %d\n",BIT(data,0),data,m_drum_index); - m_printer_line_color[10] = 1; - - } - if (BIT(data,1)) { - for(i=3;i<18;i++) { - if(BIT(m_printer_shifter,i)) { - m_printer_line[10][i-3] = m_drum_index + 1; - } - } - if(BIT(m_printer_shifter,0)) { - m_printer_line[10][15] = m_drum_index + 13 + 1; - } - if(BIT(m_printer_shifter,1)) { - m_printer_line[10][16] = m_drum_index + 26 + 1; - } - } - if (BIT(data,3)) { - for(j=0;j<10;j++) { - for(i=0;i<17;i++) { - m_printer_line[j][i] = m_printer_line[j+1][i]; - m_printer_line_color[j] = m_printer_line_color[j+1]; - } - } - for(i=0;i<17;i++) { - m_printer_line[10][i] = 0; - } - m_printer_line_color[10] = 0; - - } -} -WRITE8_MEMBER(busicom_state::status_w) -{ -#if 0 - UINT8 mem_lamp = BIT(data,0); - UINT8 over_lamp = BIT(data,1); - UINT8 minus_lamp = BIT(data,2); -#endif - //logerror("status %c %c %c\n",mem_lamp ? 'M':'x',over_lamp ? 'O':'x',minus_lamp ? '-':'x'); -} - -WRITE8_MEMBER(busicom_state::printer_ctrl_w) -{ -} - -static ADDRESS_MAP_START(busicom_rom, AS_PROGRAM, 8, busicom_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x04FF) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(busicom_mem, AS_DATA, 8, busicom_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07F) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( busicom_io , AS_IO, 8, busicom_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_WRITE(shifter_w) // ROM0 I/O - AM_RANGE(0x01, 0x01) AM_READWRITE(keyboard_r,printer_ctrl_w) // ROM1 I/O - AM_RANGE(0x02, 0x02) AM_READ(printer_r) // ROM2 I/O - AM_RANGE(0x10, 0x10) AM_WRITE(printer_w) // RAM0 output - AM_RANGE(0x11, 0x11) AM_WRITE(status_w) // RAM1 output -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( busicom ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CM") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RM") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M-") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M+") PORT_CODE(KEYCODE_4) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SQRT") PORT_CODE(KEYCODE_S) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("%") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M=-") PORT_CODE(KEYCODE_6) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M=+") PORT_CODE(KEYCODE_7) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("diamond") PORT_CODE(KEYCODE_D) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("diamond 2") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("000") PORT_CODE(KEYCODE_8) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("00") PORT_CODE(KEYCODE_9) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Sign") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EX") PORT_CODE(KEYCODE_X) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CE") PORT_CODE(KEYCODE_E) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_START("LINE8") - PORT_CONFNAME( 0x0f, 0x00, "Digital point") - PORT_CONFSETTING( 0x00, "0" ) - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFSETTING( 0x03, "3" ) - PORT_CONFSETTING( 0x04, "4" ) - PORT_CONFSETTING( 0x05, "5" ) - PORT_CONFSETTING( 0x06, "6" ) - PORT_CONFSETTING( 0x08, "8" ) - PORT_START("LINE9") - PORT_CONFNAME( 0x0f, 0x00, "Rounding") - PORT_CONFSETTING( 0x01, "/N" ) - PORT_CONFSETTING( 0x00, "FL" ) - PORT_CONFSETTING( 0x08, "5/4" ) - PORT_START("PAPERADV") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Paper adv.") PORT_CODE(KEYCODE_SPACE) - -INPUT_PORTS_END - - -TIMER_DEVICE_CALLBACK_MEMBER(busicom_state::timer_callback) -{ - m_timer ^=1; - if (m_timer==1) m_drum_index++; - if (m_drum_index==13) m_drum_index=0; - m_maincpu->set_test(m_timer); - -} - -void busicom_state::machine_start() -{ -} - -void busicom_state::machine_reset() -{ - int i,j; - m_drum_index =0; - m_keyboard_shifter = 0; - m_printer_shifter = 0; - - for(i=0;i<17;i++) { - for(j=0;j<11;j++) { - m_printer_line[j][i] = 0; - m_printer_line_color[j] = 0; - } - } - -} - -//static const char layout_busicom [] = "busicom"; - -static MACHINE_CONFIG_START( busicom, busicom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I4004, 750000) - MCFG_CPU_PROGRAM_MAP(busicom_rom) - MCFG_CPU_DATA_MAP(busicom_mem) - MCFG_CPU_IO_MAP(busicom_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(40*17, 44*11) - MCFG_SCREEN_VISIBLE_AREA(0, 40*17-1, 0, 44*11-1) - MCFG_SCREEN_UPDATE_DRIVER(busicom_state, screen_update_busicom) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(busicom_state, busicom) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("busicom_timer", busicom_state, timer_callback, attotime::from_msec(28*2)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( busicom ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "busicom.l01", 0x0000, 0x0100, CRC(51ae2513) SHA1(5cb4097a3945db35af4ed64b629b20b08fc9824f)) - ROM_LOAD( "busicom.l02", 0x0100, 0x0100, CRC(a05411ad) SHA1(81503a99a0d34fa29bf1245de0a44af2f174abdd)) - ROM_LOAD( "busicom.l05", 0x0200, 0x0100, CRC(6120addf) SHA1(4b7ec183613630120b3c313c782122713d4327c5)) - ROM_LOAD( "busicom.l07", 0x0300, 0x0100, CRC(84a90daa) SHA1(e2931753b0fd35144cb5a9d73fcae8e104e5e3ed)) - ROM_LOAD( "busicom.l11", 0x0400, 0x0100, CRC(4d2b2942) SHA1(9a59db76eff084369797735ec19da8cbc70d0d39)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1974, busicom, 0, 0, busicom, busicom, driver_device, 0, "Business Computer Corporation", "Busicom 141-PF", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/bw12.c b/src/mess/drivers/bw12.c deleted file mode 100644 index 6d880bcd38e..00000000000 --- a/src/mess/drivers/bw12.c +++ /dev/null @@ -1,670 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Bondwell 12/14 - - 12/05/2009 Skeleton driver. - - - Z80A CPU 4MHz - - 64KB RAM (BW 12), 128KB RAM (BW 14) - - 4KB ROM System - - UPD765A Floppy controller - - 2 x 5.25" Floppy drives 48 tpi SSDD (BW 12), DSDD (BW 14) - - MC6845 Video controller - - 2KB RAM Video buffer - - 4KB ROM Character set - - Z80SIO Serial interface - - MC6821 Parallel interface - - I8253 Counter-timer - - MC1408 8-bit DAC sound - - KB3600 PRO (AY-5-3600 PRO) Keyboard controller - - http://www.eld.leidenuniv.nl/~moene/Home/sitemap/ - http://www.baltissen.org/newhtm/schemas.htm - -****************************************************************************/ - -#include "includes/bw12.h" -#include "bus/rs232/rs232.h" - -/* - - TODO: - - - floppy motor off timer - -*/ - -void bw12_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - switch (m_bank) - { - case 0: /* ROM */ - program.install_read_bank(0x0000, 0x7fff, "bank1"); - program.unmap_write(0x0000, 0x7fff); - break; - - case 1: /* BK0 */ - program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); - break; - - case 2: /* BK1 */ - case 3: /* BK2 */ - if (m_ram->size() > 64*1024) - { - program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); - } - else - { - program.unmap_readwrite(0x0000, 0x7fff); - } - break; - } - - membank("bank1")->set_entry(m_bank); -} - -void bw12_state::floppy_motor_off() -{ - m_floppy0->mon_w(1); - m_floppy1->mon_w(1); - - m_motor_on = 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(bw12_state::floppy_motor_off_tick) -{ - floppy_motor_off(); -} - -void bw12_state::set_floppy_motor_off_timer() -{ - if (m_motor0 || m_motor1) - { - m_motor_on = 1; - m_floppy_timer->enable(false); - } - else - { - /* trigger floppy motor off NE556 timer */ - /* - - R18 = RES_K(100) - C11 = CAP_U(4.7) - - */ - - //m_floppy_timer->adjust(attotime::zero); - floppy_motor_off(); - } -} - -void bw12_state::ls259_w(int address, int data) -{ - switch (address) - { - case 0: /* LS138 A0 */ - m_bank = (m_bank & 0x02) | data; - bankswitch(); - break; - - case 1: /* LS138 A1 */ - m_bank = (data << 1) | (m_bank & 0x01); - bankswitch(); - break; - - case 2: /* not connected */ - break; - - case 3: /* _INIT */ - break; - - case 4: /* CAP LOCK */ - output_set_led_value(0, data); - break; - - case 5: /* MOTOR 0 */ - m_motor0 = data; - break; - - case 6: /* MOTOR 1 */ - m_motor1 = data; - break; - - case 7: /* FDC TC */ - m_fdc->tc_w(data); - break; - } - - m_motor_on = m_motor0 || m_motor1; - - m_floppy0->mon_w(!m_motor_on); - m_floppy1->mon_w(!m_motor_on); -} - -WRITE8_MEMBER( bw12_state::ls259_w ) -{ - int d = BIT(offset, 0); - int a = (offset >> 1) & 0x07; - - ls259_w(a, d); -} - -READ8_MEMBER( bw12_state::ls259_r ) -{ - ls259_w(space, offset, 0); - - return 0; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( bw12_mem, AS_PROGRAM, 8, bw12_state ) - AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank1") - AM_RANGE(0x8000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( bw12_io, AS_IO, 8, bw12_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x0f) AM_READWRITE(ls259_r, ls259_w) - AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) - AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r, register_w) - AM_RANGE(0x20, 0x21) AM_MIRROR(0x0e) AM_DEVICE(UPD765_TAG, upd765a_device, map) - AM_RANGE(0x30, 0x33) AM_MIRROR(0x0c) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write) - AM_RANGE(0x40, 0x43) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_DEVWRITE(MC1408_TAG, dac_device, write_unsigned8) - AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREADWRITE(PIT8253_TAG, pit8253_device, read, write) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( bw12 ) - /* - - KB3600 PRO2 Keyboard matrix - - | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | - | | | | | | | | | | | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X0 | 7 | 8 | 9 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X1 | U | I | O | P | Q | W | E | R | T | Y | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X2 | F15 | F16 | RET | N. | SP | LOCK| F11 | F12 | F13 | F14 | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X3 | F7 | F8 | F9 | F10 | F1 | F2 | F3 | F4 | F5 | F6 | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X4 | LEFT|RIGHT| N3 | BS | @ | | - | ] | UP | DOWN| - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X5 | N9 | CL | N2 | LF | DEL | HT |ARROW| [ | N7 | N8 | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X6 | M | , | . | / | Z | X | C | V | B | N | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X7 | J | K | L | ; | A | S | D | F | G | H | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - X8 | N6 | - | N1 | N0 | ESC | | : | NRET| N4 | N5 | - ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| - - */ - - PORT_START("X0") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('|') - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - - PORT_START("X1") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - - PORT_START("X2") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F15") - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F16") - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13") - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F14") - - PORT_START("X3") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("X4") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') PORT_CHAR('\\') - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("X5") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CL") - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LF") - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HT") - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) - - PORT_START("X6") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("X7") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - - PORT_START("X8") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad RET") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - - PORT_START("MODIFIERS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) -INPUT_PORTS_END - -/* Video */ - -MC6845_UPDATE_ROW( bw12_state::crtc_update_row ) -{ - const pen_t *pen = m_palette->pens(); - int column, bit; - - for (column = 0; column < x_count; column++) - { - UINT8 code = m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; - UINT16 addr = code << 4 | (ra & 0x0f); - UINT8 data = m_char_rom->base()[addr & BW12_CHARROM_MASK]; - - if (column == cursor_x) - { - data = 0xff; - } - - for (bit = 0; bit < 8; bit++) - { - int x = (column * 8) + bit; - int color = BIT(data, 7) && de; - - bitmap.pix32(vbp + y, hbp + x) = pen[color]; - - data <<= 1; - } - } -} - - -/* PIA6821 Interface */ - -WRITE_LINE_MEMBER( bw12_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( bw12_state::write_centronics_fault ) -{ - m_centronics_fault = state; -} - -WRITE_LINE_MEMBER( bw12_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -READ8_MEMBER( bw12_state::pia_pa_r ) -{ - /* - - bit description - - PA0 Input from Centronics BUSY status - PA1 Input from Centronics ERROR status - PA2 Input from Centronics PAPER OUT status - PA3 Input from FDC MOTOR - PA4 Input from PIT OUT2 - PA5 Input from keyboard strobe - PA6 Input from keyboard serial data - PA7 Input from FDC interrupt - - */ - - UINT8 data = 0; - - data |= m_centronics_busy; - data |= (m_centronics_fault << 1); - data |= (m_centronics_perror << 2); - data |= (m_motor_on << 3); - data |= (m_pit_out2 << 4); - data |= (m_key_stb << 5); - data |= (m_key_sin << 6); - data |= (m_fdc->get_irq() ? 1 : 0) << 7; - - return data; -} - -WRITE_LINE_MEMBER( bw12_state::pia_cb2_w ) -{ - if (state) - { - /* keyboard shift clock */ - m_key_shift++; - - if (m_key_shift < 10) - { - m_key_sin = m_key_data[m_key_shift]; - } - } -} - -/* PIT8253 Interface */ - -WRITE_LINE_MEMBER( bw12_state::pit_out0_w ) -{ - m_sio->txca_w(state); - m_sio->rxca_w(state); -} - -WRITE_LINE_MEMBER( bw12_state::pit_out2_w ) -{ - m_pit_out2 = state; -} - -/* AY-5-3600-PRO-002 Interface */ - -READ_LINE_MEMBER( bw12_state::ay3600_shift_r ) -{ - return BIT(m_modifiers->read(), 0); -} - -READ_LINE_MEMBER( bw12_state::ay3600_control_r ) -{ - return BIT(m_modifiers->read(), 1); -} - -WRITE_LINE_MEMBER( bw12_state::ay3600_data_ready_w ) -{ - m_key_stb = state; - - m_pia->cb1_w(state); - - if (state) - { - UINT16 data = m_kbc->b_r(); - - m_key_data[0] = BIT(data, 6); - m_key_data[1] = BIT(data, 3); - m_key_data[2] = BIT(data, 1); - m_key_data[3] = BIT(data, 0); - m_key_data[4] = BIT(data, 2); - m_key_data[5] = BIT(data, 4); - m_key_data[6] = BIT(data, 5); - m_key_data[7] = BIT(data, 7); - m_key_data[8] = BIT(data, 8); - - m_key_shift = 0; - m_key_sin = m_key_data[m_key_shift]; - } -} - -/* Machine Initialization */ - -void bw12_state::machine_start() -{ - /* setup memory banking */ - membank("bank1")->configure_entry(0, m_rom->base()); - membank("bank1")->configure_entry(1, m_ram->pointer()); - membank("bank1")->configure_entries(2, 2, m_ram->pointer() + 0x10000, 0x8000); - - /* register for state saving */ - save_item(NAME(m_bank)); - save_item(NAME(m_pit_out2)); - save_item(NAME(m_key_data)); - save_item(NAME(m_key_sin)); - save_item(NAME(m_key_stb)); - save_item(NAME(m_key_shift)); - save_item(NAME(m_motor_on)); - save_item(NAME(m_motor0)); - save_item(NAME(m_motor1)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_fault)); - save_item(NAME(m_centronics_perror)); - machine().save().register_postload(save_prepost_delegate(FUNC(bw12_state::bankswitch), this)); -} - -void bw12_state::machine_reset() -{ - for (int i = 0; i < 8; i++) - { - ls259_w(i, 0); - } -} - -static SLOT_INTERFACE_START( bw12_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_SSDD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( bw12_state::bw12_floppy_formats ) - FLOPPY_BW12_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( bw14_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( bw12_state::bw14_floppy_formats ) - FLOPPY_BW12_FORMAT -FLOPPY_FORMATS_END - - -/* F4 Character Displayer */ -static const gfx_layout bw12_charlayout = -{ - 8, 9, /* 8 x 9 characters */ - 256, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( bw12 ) - GFXDECODE_ENTRY( "chargen", 0x0000, bw12_charlayout, 0, 1 ) -GFXDECODE_END - - -/* Machine Driver */ -static MACHINE_CONFIG_START( common, bw12_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) - MCFG_CPU_PROGRAM_MAP(bw12_mem) - MCFG_CPU_IO_MAP(bw12_io) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", bw12) - MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/8) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(bw12_state, crtc_update_row) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD(MC1408_TAG, DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_TIMER_DRIVER_ADD(FLOPPY_TIMER_TAG, bw12_state, floppy_motor_off_tick) - MCFG_UPD765A_ADD(UPD765_TAG, false, true) - - MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(bw12_state, pia_pa_r)) - MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_PIA_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - MCFG_PIA_CB2_HANDLER(WRITELINE(bw12_state, pia_cb2_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE(Z80_TAG, z80_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE(Z80_TAG, z80_device, irq_line)) - - MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_16MHz/4, 0, 0, 0, 0) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(PIT8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_1_8432MHz) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(bw12_state, pit_out0_w)) - MCFG_PIT8253_CLK1(XTAL_1_8432MHz) - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) - MCFG_PIT8253_CLK2(XTAL_1_8432MHz) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(bw12_state, pit_out2_w)) - - MCFG_DEVICE_ADD(AY3600PRO002_TAG, AY3600, 0) - MCFG_AY3600_MATRIX_X0(IOPORT("X0")) - MCFG_AY3600_MATRIX_X1(IOPORT("X1")) - MCFG_AY3600_MATRIX_X2(IOPORT("X2")) - MCFG_AY3600_MATRIX_X3(IOPORT("X3")) - MCFG_AY3600_MATRIX_X4(IOPORT("X4")) - MCFG_AY3600_MATRIX_X5(IOPORT("X5")) - MCFG_AY3600_MATRIX_X6(IOPORT("X6")) - MCFG_AY3600_MATRIX_X7(IOPORT("X7")) - MCFG_AY3600_MATRIX_X8(IOPORT("X8")) - MCFG_AY3600_SHIFT_CB(READLINE(bw12_state, ay3600_shift_r)) - MCFG_AY3600_CONTROL_CB(READLINE(bw12_state, ay3600_control_r)) - MCFG_AY3600_DATA_READY_CB(WRITELINE(bw12_state, ay3600_data_ready_w)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcdb_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsb_w)) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(PIA6821_TAG, pia6821_device, ca1_w)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(bw12_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(bw12_state, write_centronics_fault)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(bw12_state, write_centronics_perror)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( bw12, common ) - /* floppy drives */ - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", bw12_floppies, "525dd", bw12_state::bw12_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", bw12_floppies, "525dd", bw12_state::bw12_floppy_formats) - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "bw12") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( bw14, common ) - /* floppy drives */ - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", bw14_floppies, "525dd", bw12_state::bw14_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", bw14_floppies, "525dd", bw12_state::bw14_floppy_formats) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( bw12 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "bw14boot.ic41", 0x0000, 0x1000, CRC(782fe341) SHA1(eefe5ad6b1ef77a1caf0af743b74de5fa1c4c19d) ) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "bw14char.ic1", 0x0000, 0x1000, CRC(f9dd68b5) SHA1(50132b759a6d84c22c387c39c0f57535cd380411) ) -ROM_END - -#define rom_bw14 rom_bw12 - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, bw12, 0, 0, bw12, bw12, driver_device, 0, "Bondwell Holding", "Bondwell 12", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, bw14, bw12, 0, bw14, bw12, driver_device, 0, "Bondwell Holding", "Bondwell 14", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/bw2.c b/src/mess/drivers/bw2.c deleted file mode 100644 index 546abec3575..00000000000 --- a/src/mess/drivers/bw2.c +++ /dev/null @@ -1,678 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - drivers/bw2.c - - Bondwell BW 2 - - - Z80L CPU 4MHz - - 64KB RAM, expandable to 224KB RAM. - - 4KB System ROM - - MSM6255 LCD controller, 640x200 pixels - - 16KB Video RAM - - TMS2797 FDC controller - - 8251 USART serial interface - - 8253 PIT timer - - 8255 PPI - - http://www.thebattles.net/bondwell/ - - http://www.vintage-computer.com/bondwell2.shtml - - http://www2.okisemi.com/site/productscatalog/displaydrivers/availabledocuments/Intro-7090.html - -***************************************************************************/ - -#include "includes/bw2.h" -#include "bus/rs232/rs232.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -enum -{ - RAM1 = 0, - VRAM, - RAM2, - RAM3, - RAM4, - RAM5, - RAM6, - ROM -}; - -#define HAS_KB_OF_RAM(_kb) \ - (m_ram->size() >= (_kb * 1024)) - - -//************************************************************************** -// ADDRESS DECODING -//************************************************************************** - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( bw2_state::read ) -{ - int rom = 1, vram = 1, ram1 = 1, ram2 = 1, ram3 = 1, ram4 = 1, ram5 = 1, ram6 = 1; - - UINT8 data = 0xff; - - switch (m_bank) - { - case RAM1: ram1 = 0; break; - case VRAM: vram = 0; break; - case RAM2: ram2 = 0; break; - case RAM3: ram3 = 0; break; - case RAM4: ram4 = 0; break; - case RAM5: ram5 = 0; break; - case RAM6: ram6 = 0; break; - case ROM: rom = 0; break; - } - - if (offset < 0x8000) - { - if (!rom) - { - data = m_rom->base()[offset & 0x3fff]; - } - - if (!vram) - { - data = m_video_ram[offset & 0x3fff]; - } - - if (!ram1) - { - data = m_ram->pointer()[offset]; - } - - if (!ram2 && HAS_KB_OF_RAM(96)) - { - data = m_ram->pointer()[0x10000 | offset]; - } - - if (!ram3 && HAS_KB_OF_RAM(128)) - { - data = m_ram->pointer()[0x18000 | offset]; - } - - if (!ram4 && HAS_KB_OF_RAM(160)) - { - data = m_ram->pointer()[0x20000 | offset]; - } - - if (!ram5 && HAS_KB_OF_RAM(192)) - { - data = m_ram->pointer()[0x28000 | offset]; - } - - if (!ram6 && HAS_KB_OF_RAM(224)) - { - data = m_ram->pointer()[0x30000 | offset]; - } - } - else - { - data = m_ram->pointer()[offset]; - } - - return m_exp->cd_r(space, offset, data, ram2, ram3, ram4, ram5, ram6); -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( bw2_state::write ) -{ - int vram = 1, ram1 = 1, ram2 = 1, ram3 = 1, ram4 = 1, ram5 = 1, ram6 = 1; - - switch (m_bank) - { - case RAM1: ram1 = 0; break; - case VRAM: vram = 0; break; - case RAM2: ram2 = 0; break; - case RAM3: ram3 = 0; break; - case RAM4: ram4 = 0; break; - case RAM5: ram5 = 0; break; - case RAM6: ram6 = 0; break; - } - - if (offset < 0x8000) - { - if (!vram) - { - m_video_ram[offset & 0x3fff] = data; - } - - if (!ram1) - { - m_ram->pointer()[offset] = data; - } - - if (!ram2 && HAS_KB_OF_RAM(96)) - { - m_ram->pointer()[0x10000 | offset] = data; - } - - if (!ram3 && HAS_KB_OF_RAM(128)) - { - m_ram->pointer()[0x18000 | offset] = data; - } - - if (!ram4 && HAS_KB_OF_RAM(160)) - { - m_ram->pointer()[0x20000 | offset] = data; - } - - if (!ram5 && HAS_KB_OF_RAM(192)) - { - m_ram->pointer()[0x28000 | offset] = data; - } - - if (!ram6 && HAS_KB_OF_RAM(224)) - { - m_ram->pointer()[0x30000 | offset] = data; - } - } - else - { - m_ram->pointer()[offset] = data; - } - - m_exp->cd_w(space, offset, data, ram2, ram3, ram4, ram5, ram6); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( bw2_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( bw2_mem, AS_PROGRAM, 8, bw2_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( bw2_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( bw2_io, AS_IO, 8, bw2_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(I8253_TAG, pit8253_device, read, write) - AM_RANGE(0x20, 0x21) AM_DEVICE(MSM6255_TAG, msm6255_device, map) - AM_RANGE(0x30, 0x3f) AM_DEVREADWRITE(BW2_EXPANSION_SLOT_TAG, bw2_expansion_slot_device, slot_r, slot_w) - AM_RANGE(0x40, 0x40) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x41, 0x41) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x50, 0x50) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x60, 0x63) AM_DEVREADWRITE(WD2797_TAG, wd2797_t, read, write) - AM_RANGE(0x70, 0x7f) AM_DEVREADWRITE(BW2_EXPANSION_SLOT_TAG, bw2_expansion_slot_device, modsel_r, modsel_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( lcdc_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( lcdc_map, AS_0, 8, bw2_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3fff) - AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( bw2 ) -//------------------------------------------------- - -/* - Keyboard matrix - X0 X1 X2 X3 X4 X5 X6 X7 - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y9 |CAPS | | | | | | | | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y8 |SHIFT| |SPACE| Z | A | Q | 2 " | F1 | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y7 |CTRL | - = | \ | | X | S | W | 3 # | F2 | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y6 | @ ` | P | UP | C | D | E | 4 $ | F3 | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y5 | 1 ! | | | V | F | R | 5 % | F4 | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y4 | ESC | | | B | G | T | 6 & | F5 | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y3 | TAB | : * |ENTER| N | H | Y | 7 ' | F6 | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y2 |DOWN | ^ ~ | [ { | M | J | U | 8 ( | F7 | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y1 |RIGHT| ; + | ] } | , < | K | I | 9 ) | F8 | - +-----+-----+-----+-----+-----+-----+-----+-----+ - Y0 |LEFT | BS | / ? | . > | L | O | 0 _ | DEL | - +-----+-----+-----+-----+-----+-----+-----+-----+ -*/ - -static INPUT_PORTS_START( bw2 ) - PORT_START("Y0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - - PORT_START("Y1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("Y2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("Y3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("Y4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("Y5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("Y6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("Y7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("Y8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("Y9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("BAUD") - PORT_CONFNAME( 0x05, 0x05, "Baud rate") - PORT_CONFSETTING( 0x00, "9600 baud" ) - PORT_CONFSETTING( 0x01, "4800 baud" ) - PORT_CONFSETTING( 0x02, "2400 baud" ) - PORT_CONFSETTING( 0x03, "1200 baud" ) - PORT_CONFSETTING( 0x04, "600 baud" ) - PORT_CONFSETTING( 0x05, "300 baud" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -WRITE_LINE_MEMBER( bw2_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -//------------------------------------------------- -// I8255A interface -//------------------------------------------------- - -WRITE8_MEMBER( bw2_state::ppi_pa_w ) -{ - /* - - PA0 KB0 Keyboard line select 0 - PA1 KB1 Keyboard line select 1 - PA2 KB2 Keyboard line select 2 - PA3 KB3 Keyboard line select 3 - PA4 /DS0 Drive select 0 - PA5 /DS1 Drive select 1 - PA6 Select RS232 connector - PA7 /STROBE to centronics printer - - */ - - // keyboard - m_kb = data & 0x0f; - - // drive select - m_floppy = NULL; - if (BIT(data, 4)) m_floppy = m_floppy0->get_device(); - if (BIT(data, 5)) m_floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(m_floppy); - if (m_floppy) m_floppy->mon_w(m_mtron); - - // centronics strobe - m_centronics->write_strobe(BIT(data, 7)); -} - -READ8_MEMBER( bw2_state::ppi_pb_r ) -{ - /* - - PB0 Keyboard column status of selected line - PB1 Keyboard column status of selected line - PB2 Keyboard column status of selected line - PB3 Keyboard column status of selected line - PB4 Keyboard column status of selected line - PB5 Keyboard column status of selected line - PB6 Keyboard column status of selected line - PB7 Keyboard column status of selected line - - */ - - UINT8 data = 0xff; - - switch (m_kb) - { - case 0: data = m_y0->read(); break; - case 1: data = m_y1->read(); break; - case 2: data = m_y2->read(); break; - case 3: data = m_y3->read(); break; - case 4: data = m_y4->read(); break; - case 5: data = m_y5->read(); break; - case 6: data = m_y6->read(); break; - case 7: data = m_y7->read(); break; - case 8: data = m_y8->read(); break; - case 9: data = m_y9->read(); break; - } - - return data; -} - -WRITE8_MEMBER( bw2_state::ppi_pc_w ) -{ - /* - - PC0 Memory bank select - PC1 Memory bank select - PC2 Memory bank select - PC3 Not connected - - */ - - m_bank = data & 0x07; -} - -READ8_MEMBER( bw2_state::ppi_pc_r ) -{ - /* - - PC4 BUSY from centronics printer - PC5 M/FDBK motor feedback - PC6 RLSD Carrier detect from RS232 - PC7 /PROT Write protected disk - - */ - - UINT8 data = 0; - - // centronics busy - data |= m_centronics_busy << 4; - - // floppy motor - data |= m_mfdbk << 5; - - // write protect - if (m_floppy) data |= m_floppy->wpt_r() << 7; - - return data; -} - -//------------------------------------------------- -// pit8253_config pit_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( bw2_state::pit_out0_w ) -{ - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - -WRITE_LINE_MEMBER( bw2_state::mtron_w ) -{ - m_mtron = state; - m_mfdbk = !state; - - if (m_floppy) m_floppy->mon_w(m_mtron); -} - -//------------------------------------------------- -// floppy_format_type floppy_formats -//------------------------------------------------- - -WRITE_LINE_MEMBER( bw2_state::fdc_drq_w ) -{ - if (state) - { - if (m_maincpu->state_int(Z80_HALT)) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, HOLD_LINE); - } - } - else - { - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - } -} - -FLOPPY_FORMATS_MEMBER( bw2_state::floppy_formats ) - FLOPPY_BW2_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( bw2_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) // Teac FD-35 -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - - -PALETTE_INIT_MEMBER(bw2_state, bw2) -{ - palette.set_pen_color(0, 0xa5, 0xad, 0xa5); - palette.set_pen_color(1, 0x31, 0x39, 0x10); -} - - -//------------------------------------------------- -// MACHINE_START( bw2 ) -//------------------------------------------------- - -void bw2_state::machine_start() -{ - // register for state saving - save_item(NAME(m_kb)); - save_item(NAME(m_bank)); - save_item(NAME(m_mtron)); - save_item(NAME(m_mfdbk)); - save_item(NAME(m_centronics_busy)); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( bw2 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( bw2, bw2_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) - MCFG_CPU_PROGRAM_MAP(bw2_mem) - MCFG_CPU_IO_MAP(bw2_io) - - // video hardware - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DEVICE( MSM6255_TAG, msm6255_device, screen_update ) - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(bw2_state, bw2) - - // devices - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_16MHz/4) // 8251 USART TXC, RXC - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(bw2_state, pit_out0_w)) - MCFG_PIT8253_CLK1(11000) // LCD controller - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE(I8253_TAG, pit8253_device, write_clk2)) - MCFG_PIT8253_CLK2(0) // Floppy /MTRON - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(bw2_state, mtron_w)) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(bw2_state, ppi_pa_w)) - MCFG_I8255_IN_PORTB_CB(READ8(bw2_state, ppi_pb_r)) - MCFG_I8255_IN_PORTC_CB(READ8(bw2_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(bw2_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(MSM6255_TAG, MSM6255, XTAL_16MHz) - MCFG_DEVICE_ADDRESS_MAP(AS_0, lcdc_map) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(bw2_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - - MCFG_WD2797_ADD(WD2797_TAG, XTAL_16MHz/16) - MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bw2_state, fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG":0", bw2_floppies, "35dd", bw2_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG":1", bw2_floppies, NULL, bw2_state::floppy_formats) - MCFG_BW2_EXPANSION_SLOT_ADD(BW2_EXPANSION_SLOT_TAG, XTAL_16MHz, bw2_expansion_cards, NULL) - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list","bw2") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("96K,128K,160K,192K,224K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( bw2 ) -//------------------------------------------------- - -ROM_START( bw2 ) - ROM_REGION( 0x1000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "v20" ) - ROM_SYSTEM_BIOS( 0, "v12", "BW 2 v1.2" ) - ROMX_LOAD( "bw2-12.ic8", 0x0000, 0x1000, CRC(0ab42d10) SHA1(430b232631eee9b715151b8d191b7eb9449ac513), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v20", "BW 2 v2.0" ) - ROMX_LOAD( "bw2-20.ic8", 0x0000, 0x1000, CRC(86f36471) SHA1(a3e2ba4edd50ff8424bb0675bdbb3b9f13c04c9d), ROM_BIOS(2) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1985, bw2, 0, 0, bw2, bw2, driver_device, 0, "Bondwell Holding", "Bondwell Model 2", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/c10.c b/src/mess/drivers/c10.c deleted file mode 100644 index e1b0bc221a4..00000000000 --- a/src/mess/drivers/c10.c +++ /dev/null @@ -1,191 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Cromemco C-10 Personal Computer - - 30/08/2010 Skeleton driver - - Driver currently gets to a loop where it waits for an interrupt. - The interrupt routine presumably writes to FE69 which the loop is - constantly looking at. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - - -class c10_state : public driver_device -{ -public: - enum - { - TIMER_RESET - }; - - c10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_p_videoram(*this, "p_videoram"){ } - - required_device m_maincpu; - const UINT8 *m_p_chargen; - required_shared_ptr m_p_videoram; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DRIVER_INIT(c10); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - - -static ADDRESS_MAP_START(c10_mem, AS_PROGRAM, 8, c10_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot") - AM_RANGE(0x1000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xf0a1) AM_RAM - AM_RANGE(0xf0a2, 0xffff) AM_RAM AM_SHARE("p_videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c10_io, AS_IO, 8, c10_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( c10 ) -INPUT_PORTS_END - -void c10_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_RESET: - /* after the first 4 bytes have been read from ROM, switch the ram back in */ - membank("boot")->set_entry(0); - break; - default: - assert_always(FALSE, "Unknown id in c10_state::device_timer"); - } -} - -void c10_state::machine_reset() -{ - membank("boot")->set_entry(1); - timer_set(attotime::from_usec(4), TIMER_RESET); -} - -void c10_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -/* This system appears to have inline attribute bytes of unknown meaning. - Currently they are ignored. The word at FAB5 looks like it might be cursor location. */ -UINT32 c10_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - //static UINT8 framecnt=0; - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x,xx; - - //framecnt++; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - xx = ma; - for (x = ma; x < ma + 80; x++) - { - gfx = 0; - if (ra < 9) - { - chr = m_p_videoram[xx++]; - - // /* Take care of flashing characters */ - // if ((chr < 0x80) && (framecnt & 0x08)) - // chr |= 0x80; - - if BIT(chr, 7) // ignore attribute bytes - x--; - else - gfx = m_p_chargen[(chr<<4) | ra ]; - } - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=96; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout c10_charlayout = -{ - 8, 9, /* 8 x 9 characters */ - 512, /* 512 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( c10 ) - GFXDECODE_ENTRY( "chargen", 0x0000, c10_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( c10, c10_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(c10_mem) - MCFG_CPU_IO_MAP(c10_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(c10_state, screen_update) - MCFG_SCREEN_SIZE(640, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) - MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", c10) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -DRIVER_INIT_MEMBER(c10_state,c10) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x8000); -} - -/* ROM definition */ -ROM_START( c10 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "c10_cros.bin", 0x8000, 0x4000, CRC(2ccf5983) SHA1(52f7c497f5284bf5df9eb0d6e9142bb1869d8c24)) - - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, c10, 0, 0, c10, c10, c10_state, c10, "Cromemco", "C-10", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/c128.c b/src/mess/drivers/c128.c deleted file mode 100644 index abe3f7bde8b..00000000000 --- a/src/mess/drivers/c128.c +++ /dev/null @@ -1,1977 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - TODO: - - - connect CAPS LOCK to charom A12 on international variants - -*/ - -#include "includes/c128.h" -#include "bus/cbmiec/c1571.h" -#include "bus/cbmiec/c1581.h" -#include "cpu/z80/z80.h" -#include "machine/cbm_snqk.h" -#include "sound/dac.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - -#define A15 BIT(offset, 15) -#define A14 BIT(offset, 14) -#define A13 BIT(offset, 13) -#define A12 BIT(offset, 12) -#define A11 BIT(offset, 11) -#define A10 BIT(offset, 10) -#define VMA5 BIT(vma, 13) -#define VMA4 BIT(vma, 12) - -enum -{ - PLA_OUT_SDEN = 0, - PLA_OUT_ROM4 = 1, - PLA_OUT_ROM2 = 2, - PLA_OUT_DIR = 3, - PLA_OUT_ROML = 4, - PLA_OUT_ROMH = 5, - PLA_OUT_CLRBANK = 6, - PLA_OUT_FROM1 = 7, - PLA_OUT_ROM3 = 8, - PLA_OUT_ROM1 = 9, - PLA_OUT_IOCS = 10, - PLA_OUT_DWE = 11, - PLA_OUT_CASENB = 12, - PLA_OUT_VIC = 13, - PLA_OUT_IOACC = 14, - PLA_OUT_GWE = 15, - PLA_OUT_COLORRAM = 16, - PLA_OUT_CHAROM = 17 -}; - - -QUICKLOAD_LOAD_MEMBER( c128_state, cbm_c64 ) -{ - return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress); -} - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// check_interrupts - -//------------------------------------------------- - -inline void c128_state::check_interrupts() -{ - int irq = m_cia1_irq || m_vic_irq || m_exp_irq; - int nmi = m_cia2_irq || !m_restore || m_exp_nmi; - //int aec = m_exp_dma && m_z80_busack; - //int rdy = m_vic_aec && m_z80en && m_vic_ba; - //int busreq = !m_z80en || !(m_z80_busack && !aec) - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, irq); - - m_subcpu->set_input_line(M8502_IRQ_LINE, irq); - m_subcpu->set_input_line(M8502_NMI_LINE, nmi); -} - - - -//************************************************************************** -// ADDRESS DECODING -//************************************************************************** - -//------------------------------------------------- -// read_pla - -//------------------------------------------------- - -int c128_state::read_pla(offs_t offset, offs_t ca, offs_t vma, int ba, int rw, int aec, int z80io, int ms3, int ms2, int ms1, int ms0) -{ - int _128_256 = 1; - int dmaack = 1; - int vicfix = 1; - int sphi2 = m_vic->phi0_r(); - - m_game = m_exp->game_r(ca, sphi2, ba, rw, m_hiram); - m_exrom = m_exp->exrom_r(ca, sphi2, ba, rw, m_hiram); - - UINT32 input = sphi2 << 26 | m_va14 << 25 | m_charen << 24 | - m_hiram << 23 | m_loram << 22 | ba << 21 | VMA5 << 20 | VMA4 << 19 | ms0 << 18 | ms1 << 17 | ms2 << 16 | - m_exrom << 15 | m_game << 14 | rw << 13 | aec << 12 | A10 << 11 | A11 << 10 | A12 << 9 | A13 << 8 | - A14 << 7 | A15 << 6 | z80io << 5 | m_z80en << 4 | ms3 << 3 | vicfix << 2 | dmaack << 1 | _128_256; - - return m_pla->read(input); -} - - -//------------------------------------------------- -// read_memory - -//------------------------------------------------- - -UINT8 c128_state::read_memory(address_space &space, offs_t offset, offs_t vma, int ba, int aec, int z80io) -{ - int rw = 1, ms0 = 1, ms1 = 1, ms2 = 1, ms3 = 1, cas0 = 1, cas1 = 1; - int io1 = 1, io2 = 1; - int sphi2 = m_vic->phi0_r(); - - UINT8 data = 0xff; - - offs_t ta = m_mmu->ta_r(offset, aec, &ms0, &ms1, &ms2, &ms3, &cas0, &cas1); - offs_t ma = 0; - offs_t sa = 0; - - if (aec) - { - data = m_vic->bus_r(); - ma = ta | (offset & 0xff); - sa = offset & 0xff; - } - else - { - ta &= ~0xf00; - ta |= (vma & 0xf00); - ma = (!m_va15 << 15) | (!m_va14 << 14) | vma; - sa = vma & 0xff; - } - - offs_t ca = ta | sa; - - int plaout = read_pla(offset, ca, vma, ba, rw, aec, z80io, ms3, ms2, ms1, ms0); - - m_clrbank = BIT(plaout, PLA_OUT_CLRBANK); - - if (!BIT(plaout, PLA_OUT_CASENB)) - { - if (!cas0) - { - data = m_ram->pointer()[ma]; - } - if (!cas1) - { - data = m_ram->pointer()[0x10000 | ma]; - } - } - if (!BIT(plaout, PLA_OUT_ROM1)) - { - // CR: data = m_rom1[(ms3 << 14) | ((BIT(ta, 14) && BIT(offset, 13)) << 13) | (ta & 0x1000) | (offset & 0xfff)]; - data = m_rom->base()[((BIT(ta, 14) && BIT(offset, 13)) << 13) | (ta & 0x1000) | (offset & 0xfff)]; - } - if (!BIT(plaout, PLA_OUT_ROM2)) - { - data = m_rom->base()[0x4000 | (offset & 0x3fff)]; - } - if (!BIT(plaout, PLA_OUT_ROM3)) - { - // CR: data = m_rom3[(BIT(offset, 15) << 14) | (offset & 0x3fff)]; - data = m_rom->base()[0x8000 | (offset & 0x3fff)]; - } - if (!BIT(plaout, PLA_OUT_ROM4)) - { - data = m_rom->base()[0xc000 | (ta & 0x1000) | (offset & 0x2fff)]; - } - if (!BIT(plaout, PLA_OUT_CHAROM)) - { - data = m_charom->base()[(ms3 << 12) | (ta & 0xf00) | sa]; - } - if (!BIT(plaout, PLA_OUT_COLORRAM) && aec) - { - data = m_color_ram[(m_clrbank << 10) | (ta & 0x300) | sa] & 0x0f; - } - if (!BIT(plaout, PLA_OUT_VIC)) - { - data = m_vic->read(space, offset & 0x3f); - } - if (!BIT(plaout, PLA_OUT_FROM1) && m_from->exists()) - { - data = m_from->read_rom(space, offset & 0x7fff); - } - if (!BIT(plaout, PLA_OUT_IOCS) && BIT(offset, 10)) - { - switch ((BIT(offset, 11) << 2) | ((offset >> 8) & 0x03)) - { - case 0: // SID - data = m_sid->read(space, offset & 0x1f); - break; - - case 2: // CS8563 - if BIT(offset, 0) - { - data = m_vdc->register_r(space, 0); - } - else - { - data = m_vdc->status_r(space, 0); - } - break; - - case 4: // CIA1 - data = m_cia1->read(space, offset & 0x0f); - break; - - case 5: // CIA2 - data = m_cia2->read(space, offset & 0x0f); - break; - - case 6: // I/O1 - io1 = 0; - break; - - case 7: // I/O2 - io2 = 0; - break; - } - } - - int roml = BIT(plaout, PLA_OUT_ROML); - int romh = BIT(plaout, PLA_OUT_ROMH); - - data = m_exp->cd_r(space, ca, data, sphi2, ba, roml, romh, io1, io2); - - return m_mmu->read(offset, data); -} - - -//------------------------------------------------- -// write_memory - -//------------------------------------------------- - -void c128_state::write_memory(address_space &space, offs_t offset, offs_t vma, UINT8 data, int ba, int aec, int z80io) -{ - int rw = 0, ms0 = 1, ms1 = 1, ms2 = 1, ms3 = 1, cas0 = 1, cas1 = 1; - int io1 = 1, io2 = 1; - int sphi2 = m_vic->phi0_r(); - - offs_t ta = m_mmu->ta_r(offset, aec, &ms0, &ms1, &ms2, &ms3, &cas0, &cas1); - offs_t ca = ta | (offset & 0xff); - offs_t ma = ta | (offset & 0xff); - offs_t sa = offset & 0xff; - - int plaout = read_pla(offset, ca, vma, ba, rw, aec, z80io, ms3, ms2, ms1, ms0); - - m_clrbank = BIT(plaout, PLA_OUT_CLRBANK); - - if (!BIT(plaout, PLA_OUT_CASENB) && !BIT(plaout, PLA_OUT_DWE)) - { - if (!cas0) - { - m_ram->pointer()[ma] = data; - } - if (!cas1) - { - m_ram->pointer()[0x10000 | ma] = data; - } - } - if (!BIT(plaout, PLA_OUT_COLORRAM) && !BIT(plaout, PLA_OUT_GWE)) - { - m_color_ram[(m_clrbank << 10) | (ta & 0x300) | sa] = data & 0x0f; - } - if (!BIT(plaout, PLA_OUT_VIC)) - { - m_vic->write(space, offset & 0x3f, data); - } - if (!BIT(plaout, PLA_OUT_IOCS) && BIT(offset, 10)) - { - switch ((BIT(offset, 11) << 2) | ((offset >> 8) & 0x03)) - { - case 0: // SID - m_sid->write(space, offset & 0x1f, data); - break; - - case 2: // CS8563 - if BIT(offset, 0) - { - m_vdc->register_w(space, 0, data); - } - else - { - m_vdc->address_w(space, 0, data); - } - break; - - case 4: // CIA1 - m_cia1->write(space, offset & 0x0f, data); - break; - - case 5: // CIA2 - m_cia2->write(space, offset & 0x0f, data); - break; - - case 6: // I/O1 - io1 = 0; - break; - - case 7: // I/O2 - io2 = 0; - break; - } - } - - int roml = BIT(plaout, PLA_OUT_ROML); - int romh = BIT(plaout, PLA_OUT_ROMH); - - m_exp->cd_w(space, ca, data, sphi2, ba, roml, romh, io1, io2); - - m_mmu->write(space, offset, data); -} - - -//------------------------------------------------- -// z80_r - -//------------------------------------------------- - -READ8_MEMBER( c128_state::z80_r ) -{ - int ba = 1, aec = 1, z80io = 1; - offs_t vma = 0; - - return read_memory(space, offset, vma, ba, aec, z80io); -} - - -//------------------------------------------------- -// z80_w - -//------------------------------------------------- - -WRITE8_MEMBER( c128_state::z80_w ) -{ - int ba = 1, aec = 1, z80io = 1; - offs_t vma = 0; - - write_memory(space, offset, vma, data, ba, aec, z80io); -} - - -//------------------------------------------------- -// z80_io_r - -//------------------------------------------------- - -READ8_MEMBER( c128_state::z80_io_r ) -{ - int ba = 1, aec = 1, z80io = 0; - offs_t vma = 0; - - return read_memory(space, offset, vma, ba, aec, z80io); -} - - -//------------------------------------------------- -// z80_io_w - -//------------------------------------------------- - -WRITE8_MEMBER( c128_state::z80_io_w ) -{ - int ba = 1, aec = 1, z80io = 0; - offs_t vma = 0; - - write_memory(space, offset, vma, data, ba, aec, z80io); -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( c128_state::read ) -{ - int ba = 1, aec = 1, z80io = 1; - offs_t vma = 0; - - return read_memory(space, offset, vma, ba, aec, z80io); -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( c128_state::write ) -{ - int ba = 1, aec = 1, z80io = 1; - offs_t vma = 0; - - write_memory(space, offset, vma, data, ba, aec, z80io); -} - - -//------------------------------------------------- -// vic_videoram_r - -//------------------------------------------------- - -READ8_MEMBER( c128_state::vic_videoram_r ) -{ - int ba = 0, aec = 0, z80io = 1; - - return read_memory(space, 0, offset, ba, aec, z80io); -} - - -//------------------------------------------------- -// vic_colorram_r - -//------------------------------------------------- - -READ8_MEMBER( c128_state::vic_colorram_r ) -{ - return m_color_ram[(m_clrbank << 10) | offset]; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( z80_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, c128_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(z80_r, z80_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( z80_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( z80_io, AS_IO, 8, c128_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(z80_io_r, z80_io_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( m8502_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( m8502_mem, AS_PROGRAM, 8, c128_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_videoram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, c128_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_colorram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, c128_state ) - AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vdc_videoram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vdc_videoram_map, AS_0, 8, c128_state ) - AM_RANGE(0x0000, 0xffff) AM_RAM -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( c128 ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c128_state::write_restore ) -{ - m_restore = state; - - check_interrupts(); -} - -INPUT_CHANGED_MEMBER( c128_state::caps_lock ) -{ - m_caps_lock = newval; -} - -static INPUT_PORTS_START( c128 ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START( "K0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_F6) PORT_CHAR('\t') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - - PORT_START( "K1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START( "K2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NO SCROLL") PORT_CODE(KEYCODE_F12) PORT_TOGGLE - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - - PORT_START( "RESTORE" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, c128_state, write_restore) - - PORT_START( "LOCK" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "CAPS" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_F8) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, c128_state, caps_lock, 0) - - PORT_START( "40_80" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("40/80 DISPLAY") PORT_CODE(KEYCODE_F11) PORT_TOGGLE -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( c128_de ) -//------------------------------------------------- - -static INPUT_PORTS_START( c128_de ) - PORT_INCLUDE( c128 ) - - PORT_MODIFY( "ROW1" ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z { Y }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # { 3 Paragraph }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_MODIFY( "ROW3" ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y { Z }") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 ' { 7 / }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_MODIFY( "ROW4" ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 { = }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_MODIFY( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", < { ; }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Paragraph \xE2\x86\x91 { \xc3\xbc }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00A7) PORT_CHAR(0x2191) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xa4 }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". > { : }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- { ' ` }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+ { \xc3\x9f ? }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - - PORT_MODIFY( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ? { - _ }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Sum Pi { ] \\ }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x03A3) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= { # ' }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; ] { \xc3\xb6 }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* ` { + * }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ { [ \xE2\x86\x91 }") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') - - PORT_MODIFY( "ROW7" ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') - - PORT_MODIFY( "CAPS" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ASCII/DIN") PORT_CODE(KEYCODE_F8) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, c128_state, caps_lock, 0) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( c128_fr ) -//------------------------------------------------- -#ifdef UNUSED_CODE -static INPUT_PORTS_START( c128_fr ) - PORT_INCLUDE( c128 ) - - PORT_MODIFY( "ROW1" ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z { W }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $ { ' 4 }") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A { Q }") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W { Z }") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # { \" 3 }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_MODIFY( "ROW2" ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 & { Paragraph 6 }") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 % { ( 5 }") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_MODIFY( "ROW3" ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 ( { ! 8 }") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 ' { \xc3\xa8 7 }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_MODIFY( "ROW4" ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K Large- { \\ }") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M Large-/ { , ? }") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 { \xc3\xa0 0 }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 ) { \xc3\xa7 9 }") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_MODIFY( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", < { ; . }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@ \xc3\xbb { ^ \xc2\xa8 }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR(0x00FB) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xb9 % }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". > { : / }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- \xc2\xb0 { - _ }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('\xB0') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+ \xc3\xab { ) \xc2\xb0 }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR(0x00EB) - - PORT_MODIFY( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ? { = + }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi { * ] }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= {\xE2\x86\x91 \\ }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; ] { M Large-/ }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* ` { $ [ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ { @ # }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - - PORT_MODIFY( "ROW7" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q { A }") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 \" { \xc3\xa9 2 }") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 ! { & 1 }") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_MODIFY( "CAPS" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK ASCII/CC") PORT_CODE(KEYCODE_F8) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, c128_state, caps_lock, 0) -INPUT_PORTS_END -#endif - -//------------------------------------------------- -// INPUT_PORTS( c128_it ) -//------------------------------------------------- -#ifdef UNUSED_CODE -static INPUT_PORTS_START( c128_it ) - PORT_INCLUDE( c128 ) - - PORT_MODIFY( "ROW1" ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z { W }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $ { ' 4 }") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W { Z }") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # { \" 3 }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_MODIFY( "ROW2" ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 & { _ 6 }") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 % { ( 5 }") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_MODIFY( "ROW3" ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 ( { & 8 }") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 ' { \xc3\xa8 7 }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_MODIFY( "ROW4" ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M Large-/ { , ? }") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 { \xc3\xa0 0 }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 ) { \xc3\xa7 9 }") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_MODIFY( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", < { ; . }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@ \xc3\xbb { \xc3\xac = }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR(0x00FB) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xb9 % }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". > { : / }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- \xc2\xb0 { - + }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('\xb0') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+ \xc3\xab { ) \xc2\xb0 }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR(0x00EB) - - PORT_MODIFY( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ? { \xc3\xb2 ! }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi { * ] }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= { \xE2\x86\x91 \\ }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; ] { M }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* ` { $ [ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ { @ # }") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') - - PORT_MODIFY( "ROW7" ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 \" { \xc3\xa9 2 }") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 ! { \xc2\xa3 1 }") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') -INPUT_PORTS_END -#endif - -//------------------------------------------------- -// INPUT_PORTS( c128_se ) -//------------------------------------------------- - -static INPUT_PORTS_START( c128_se ) - PORT_INCLUDE( c128 ) - - PORT_MODIFY( "ROW1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # { 3 Paragraph }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_MODIFY( "ROW3" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 ' { 7 / }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_MODIFY( "ROW5" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("] { \xc3\xa2 }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(']') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ { \xc3\xa4 }") PORT_CODE(KEYCODE_COLON) PORT_CHAR('[') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_MODIFY( "ROW6" ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xa3 { \xc3\xb6 }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\xA3') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('@') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') - - PORT_MODIFY( "ROW7" ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') - - PORT_MODIFY( "CAPS" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK ASCII/CC") PORT_CODE(KEYCODE_F8) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, c128_state, caps_lock, 0) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MOS8722_INTERFACE( mmu_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c128_state::mmu_z80en_w ) -{ - if (state) - { - m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_subcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - if (m_reset) - { - m_subcpu->reset(); - - m_reset = 0; - } - } - else - { - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_subcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - } - - m_z80en = state; -} - -WRITE_LINE_MEMBER( c128_state::mmu_fsdir_w ) -{ - update_iec(); -} - -READ_LINE_MEMBER( c128_state::mmu_game_r ) -{ - return m_game; -} - -READ_LINE_MEMBER( c128_state::mmu_exrom_r ) -{ - return m_exrom; -} - -READ_LINE_MEMBER( c128_state::mmu_sense40_r ) -{ - return BIT(m_40_80->read(), 0); -} - - -//------------------------------------------------- -// mc6845 -//------------------------------------------------- - -static GFXDECODE_START( c128 ) - GFXDECODE_ENTRY( "charom", 0x0000, gfx_8x8x1, 0, 1 ) -GFXDECODE_END - - -//------------------------------------------------- -// MOS8564_INTERFACE( vic_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c128_state::vic_irq_w ) -{ - m_vic_irq = state; - - check_interrupts(); -} - -WRITE8_MEMBER( c128_state::vic_k_w ) -{ - m_vic_k = data; -} - - -//------------------------------------------------- -// MOS6581_INTERFACE( sid_intf ) -//------------------------------------------------- - -READ8_MEMBER( c128_state::sid_potx_r ) -{ - UINT8 data = 0xff; - - switch (m_cia1->pa_r() >> 6) - { - case 1: data = m_joy1->pot_x_r(); break; - case 2: data = m_joy2->pot_x_r(); break; - case 3: - if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) - { - data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); - } - else if (m_joy1->has_pot_x()) - { - data = m_joy1->pot_x_r(); - } - else if (m_joy2->has_pot_x()) - { - data = m_joy2->pot_x_r(); - } - break; - } - - return data; -} - -READ8_MEMBER( c128_state::sid_poty_r ) -{ - UINT8 data = 0xff; - - switch (m_cia1->pa_r() >> 6) - { - case 1: data = m_joy1->pot_y_r(); break; - case 2: data = m_joy2->pot_y_r(); break; - case 3: - if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) - { - data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); - } - else if (m_joy1->has_pot_y()) - { - data = m_joy1->pot_y_r(); - } - else if (m_joy2->has_pot_y()) - { - data = m_joy2->pot_y_r(); - } - break; - } - - return data; -} - - -//------------------------------------------------- -// MOS6526_INTERFACE( cia1_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c128_state::cia1_irq_w ) -{ - m_cia1_irq = state; - - check_interrupts(); -} - -READ8_MEMBER( c128_state::cia1_pa_r ) -{ - /* - - bit description - - PA0 COL0, JOYB0 - PA1 COL1, JOYB1 - PA2 COL2, JOYB2 - PA3 COL3, JOYB3 - PA4 COL4, FBTNB - PA5 COL5 - PA6 COL6 - PA7 COL7 - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy_b = m_joy2->joy_r(); - - data &= (0xf0 | (joy_b & 0x0f)); - data &= ~(!BIT(joy_b, 5) << 4); - - // keyboard - UINT8 cia1_pb = m_cia1->pb_r(); - UINT8 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), - m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; - - for (int i = 0; i < 8; i++) - { - if (!BIT(cia1_pb, i)) - { - if (!BIT(row[7], i)) data &= ~0x80; - if (!BIT(row[6], i)) data &= ~0x40; - if (!BIT(row[5], i)) data &= ~0x20; - if (!BIT(row[4], i)) data &= ~0x10; - if (!BIT(row[3], i)) data &= ~0x08; - if (!BIT(row[2], i)) data &= ~0x04; - if (!BIT(row[1], i)) data &= ~0x02; - if (!BIT(row[0], i)) data &= ~0x01; - } - } - - return data; -} - -WRITE8_MEMBER( c128_state::cia1_pa_w ) -{ - /* - - bit description - - PA0 COL0, JOYB0 - PA1 COL1, JOYB1 - PA2 COL2, JOYB2 - PA3 COL3, JOYB3 - PA4 COL4, FBTNB - PA5 COL5 - PA6 COL6 - PA7 COL7 - - */ - - m_joy2->joy_w(data & 0x1f); -} - -READ8_MEMBER( c128_state::cia1_pb_r ) -{ - /* - - bit description - - PB0 ROW0, JOYA0 - PB1 ROW1, JOYA1 - PB2 ROW2, JOYA2 - PB3 ROW3, JOYA3 - PB4 ROW4, FBTNA, _LP - PB5 ROW5 - PB6 ROW6 - PB7 ROW7 - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy_a = m_joy1->joy_r(); - - data &= (0xf0 | (joy_a & 0x0f)); - data &= ~(!BIT(joy_a, 5) << 4); - - // keyboard - UINT8 cia1_pa = m_cia1->pa_r(); - - if (!BIT(cia1_pa, 7)) data &= m_row7->read(); - if (!BIT(cia1_pa, 6)) data &= m_row6->read(); - if (!BIT(cia1_pa, 5)) data &= m_row5->read(); - if (!BIT(cia1_pa, 4)) data &= m_row4->read(); - if (!BIT(cia1_pa, 3)) data &= m_row3->read(); - if (!BIT(cia1_pa, 2)) data &= m_row2->read(); - if (!BIT(cia1_pa, 1)) data &= m_row1->read() & m_lock->read(); - if (!BIT(cia1_pa, 0)) data &= m_row0->read(); - - if (!BIT(m_vic_k, 0)) data &= m_k0->read(); - if (!BIT(m_vic_k, 1)) data &= m_k1->read(); - if (!BIT(m_vic_k, 2)) data &= m_k2->read(); - - return data; -} - -WRITE8_MEMBER( c128_state::cia1_pb_w ) -{ - /* - - bit description - - PB0 ROW0, JOYA0 - PB1 ROW1, JOYA1 - PB2 ROW2, JOYA2 - PB3 ROW3, JOYA3 - PB4 ROW4, FBTNA, _LP - PB5 ROW5 - PB6 ROW6 - PB7 ROW7 - - */ - - m_joy1->joy_w(data & 0x1f); - - m_vic->lp_w(BIT(data, 4)); -} - -WRITE_LINE_MEMBER( c128_state::cia1_cnt_w ) -{ - m_cnt1 = state; - m_user->write_4(state); - - update_iec(); -} - -WRITE_LINE_MEMBER( c128_state::cia1_sp_w ) -{ - m_sp1 = state; - m_user->write_5(state); - - update_iec(); -} - - -//------------------------------------------------- -// MOS6526_INTERFACE( cia2_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c128_state::cia2_irq_w ) -{ - m_cia2_irq = state; - - check_interrupts(); -} - -READ8_MEMBER( c128_state::cia2_pa_r ) -{ - /* - - bit description - - PA0 - PA1 - PA2 USER PORT - PA3 - PA4 - PA5 - PA6 CLK - PA7 DATA - - */ - - UINT8 data = 0; - - // user port - data |= m_user_pa2 << 2; - - // IEC bus - data |= m_iec->clk_r() << 6; - data |= m_iec->data_r() << 7; - - return data; -} - -WRITE8_MEMBER( c128_state::cia2_pa_w ) -{ - /* - - bit description - - PA0 _VA14 - PA1 _VA15 - PA2 USER PORT - PA3 ATN OUT - PA4 CLK OUT - PA5 DATA OUT - PA6 - PA7 - - */ - - // VIC banking - m_va14 = BIT(data, 0); - m_va15 = BIT(data, 1); - - // user port - m_user->write_m(BIT(data, 2)); - - // IEC bus - m_iec->atn_w(!BIT(data, 3)); - m_iec->clk_w(!BIT(data, 4)); - m_iec_data_out = BIT(data, 5); - - update_iec(); -} - -READ8_MEMBER( c128_state::cia2_pb_r ) -{ - return m_user_pb; -} - -WRITE8_MEMBER( c128_state::cia2_pb_w ) -{ - m_user->write_c((data>>0)&1); - m_user->write_d((data>>1)&1); - m_user->write_e((data>>2)&1); - m_user->write_f((data>>3)&1); - m_user->write_h((data>>4)&1); - m_user->write_j((data>>5)&1); - m_user->write_k((data>>6)&1); - m_user->write_l((data>>7)&1); -} - -//------------------------------------------------- -// M6510_INTERFACE( cpu_intf ) -//------------------------------------------------- - -READ8_MEMBER( c128_state::cpu_r) -{ - /* - - bit description - - P0 1 - P1 1 - P2 1 - P3 - P4 CASS SENSE - P5 - P6 CAPS LOCK - - */ - - UINT8 data = 0x07; - - // cassette sense - data |= m_cassette->sense_r() << 4; - - // CAPS LOCK - data |= m_caps_lock << 6; - - return data; -} - -WRITE8_MEMBER( c128_state::cpu_w ) -{ - /* - - bit description - - P0 LORAM - P1 HIRAM - P2 CHAREN - P3 CASS WRT - P4 - P5 CASS MOTOR - P6 - - */ - - // memory banking - m_loram = BIT(data, 0); - m_hiram = BIT(data, 1); - m_charen = BIT(data, 2); - - // cassette write - m_cassette->write(BIT(data, 3)); - - // cassette motor - m_cassette->motor_w(BIT(data, 5)); -} - - -//------------------------------------------------- -// CBM_IEC_INTERFACE( cbm_iec_intf ) -//------------------------------------------------- - -inline void c128_state::update_iec() -{ - int fsdir = m_mmu->fsdir_r(); - - // fast serial data in - int data_in = m_iec->data_r(); - - m_cia1->sp_w(fsdir || data_in); - - // fast serial data out - int data_out = !m_iec_data_out; - - if (fsdir) data_out &= m_sp1; - - m_iec->data_w(data_out); - - // fast serial clock in - int srq_in = m_iec->srq_r(); - - m_cia1->cnt_w(fsdir || srq_in); - - // fast serial clock out - int srq_out = 1; - - if (fsdir) srq_out &= m_cnt1; - - m_iec->srq_w(srq_out); -} - -WRITE_LINE_MEMBER( c128_state::iec_srq_w ) -{ - update_iec(); -} - -WRITE_LINE_MEMBER( c128_state::iec_data_w ) -{ - update_iec(); -} - - -//------------------------------------------------- -// C64_EXPANSION_INTERFACE( expansion_intf ) -//------------------------------------------------- - -READ8_MEMBER( c128_state::exp_dma_cd_r ) -{ - int ba = 0, aec = 1, z80io = 1; - offs_t vma = 0; - - return read_memory(space, offset, vma, ba, aec, z80io); -} - -WRITE8_MEMBER( c128_state::exp_dma_cd_w ) -{ - int ba = 0, aec = 1, z80io = 1; - offs_t vma = 0; - - return write_memory(space, offset, data, vma, ba, aec, z80io); -} - -WRITE_LINE_MEMBER( c128_state::exp_irq_w ) -{ - m_exp_irq = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( c128_state::exp_nmi_w ) -{ - m_exp_nmi = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( c128_state::exp_dma_w ) -{ - m_exp_dma = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( c128_state::exp_reset_w ) -{ - if (!state) - { - machine_reset(); - } -} - - -//------------------------------------------------- -// SLOT_INTERFACE( c128dcr_iec_devices ) -//------------------------------------------------- - -SLOT_INTERFACE_START( c128dcr_iec_devices ) - SLOT_INTERFACE("c1571", C1571) - SLOT_INTERFACE("c1571cr", C1571CR) -SLOT_INTERFACE_END - - -//------------------------------------------------- -// SLOT_INTERFACE( c128d81_iec_devices ) -//------------------------------------------------- - -SLOT_INTERFACE_START( c128d81_iec_devices ) - SLOT_INTERFACE("c1563", C1563) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( c64 ) -//------------------------------------------------- - -void c128_state::machine_start() -{ - // allocate memory - m_color_ram.allocate(0x800); - - // initialize memory - UINT8 data = 0xff; - - for (offs_t offset = 0; offset < m_ram->size(); offset++) - { - m_ram->pointer()[offset] = data; - if (!(offset % 64)) data ^= 0xff; - } - - // state saving - save_item(NAME(m_z80en)); - save_item(NAME(m_loram)); - save_item(NAME(m_hiram)); - save_item(NAME(m_charen)); - save_item(NAME(m_game)); - save_item(NAME(m_exrom)); - save_item(NAME(m_reset)); - save_item(NAME(m_va14)); - save_item(NAME(m_va15)); - save_item(NAME(m_clrbank)); - save_item(NAME(m_cnt1)); - save_item(NAME(m_sp1)); - save_item(NAME(m_iec_data_out)); - save_item(NAME(m_cia1_irq)); - save_item(NAME(m_cia2_irq)); - save_item(NAME(m_vic_irq)); - save_item(NAME(m_exp_irq)); - save_item(NAME(m_exp_nmi)); - save_item(NAME(m_exp_dma)); - save_item(NAME(m_vic_k)); - save_item(NAME(m_caps_lock)); -} - - -void c128_state::machine_reset() -{ - m_maincpu->reset(); - m_reset = 1; - - m_mmu->reset(); - m_vic->reset(); - m_vdc->reset(); - m_sid->reset(); - m_cia1->reset(); - m_cia2->reset(); - - m_iec->reset(); - m_exp->reset(); - - m_user->write_3(0); - m_user->write_3(1); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( ntsc ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ntsc, c128_state ) - // basic hardware - MCFG_CPU_ADD(Z80A_TAG, Z80, XTAL_14_31818MHz*2/3.5/2) - MCFG_CPU_PROGRAM_MAP(z80_mem) - MCFG_CPU_IO_MAP(z80_io) - MCFG_QUANTUM_PERFECT_CPU(Z80A_TAG) - - MCFG_CPU_ADD(M8502_TAG, M8502, XTAL_14_31818MHz*2/3.5/8) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_M8502_PORT_CALLBACKS(READ8(c128_state, cpu_r), WRITE8(c128_state, cpu_w)) - MCFG_M8502_PORT_PULLS(0x07, 0x20) - MCFG_CPU_PROGRAM_MAP(m8502_mem) - MCFG_QUANTUM_PERFECT_CPU(M8502_TAG) - - // video hardware - MCFG_MOS8563_ADD(MOS8563_TAG, SCREEN_VDC_TAG, XTAL_16MHz, vdc_videoram_map) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_SCREEN_ADD(SCREEN_VDC_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DEVICE(MOS8563_TAG, mos8563_device, screen_update) - - MCFG_DEVICE_ADD(MOS8564_TAG, MOS8564, XTAL_14_31818MHz*2/3.5) - MCFG_MOS6566_CPU(M8502_TAG) - MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c128_state, vic_irq_w)) - MCFG_MOS8564_K_CALLBACK(WRITE8(c128_state, vic_k_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_VIC_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) - MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) - MCFG_SCREEN_ADD(SCREEN_VIC_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) - MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) - MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DEVICE(MOS8564_TAG, mos8564_device, screen_update) - - MCFG_GFXDECODE_ADD("gfxdecode", MOS8563_TAG":palette", c128) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_14_31818MHz*2/3.5/8) - MCFG_MOS6581_POTX_CALLBACK(READ8(c128_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c128_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_DEVICE_ADD(MOS8722_TAG, MOS8722, XTAL_14_31818MHz*2/3.5/8) - MCFG_MOS8722_Z80EN_CALLBACK(WRITELINE(c128_state, mmu_z80en_w)) - MCFG_MOS8722_FSDIR_CALLBACK(WRITELINE(c128_state, mmu_fsdir_w)) - MCFG_MOS8722_GAME_CALLBACK(READLINE(c128_state, mmu_game_r)) - MCFG_MOS8722_EXROM_CALLBACK(READLINE(c128_state, mmu_exrom_r)) - MCFG_MOS8722_SENSE40_CALLBACK(READLINE(c128_state, mmu_sense40_r)) - MCFG_MOS8721_ADD(MOS8721_TAG) - MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_14_31818MHz*2/3.5/8) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c128_state, cia1_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(WRITELINE(c128_state, cia1_cnt_w)) - MCFG_MOS6526_SP_CALLBACK(WRITELINE(c128_state, cia1_sp_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia1_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia1_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pb_w)) - MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_14_31818MHz*2/3.5/8) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c128_state, cia2_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia2_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia2_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia2_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia2_pb_w)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS8564_TAG, mos8564_device, lp_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") - MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_14_31818MHz*2/3.5/8, c64_expansion_cards, NULL) - MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c128_state, exp_irq_w)) - MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c128_state, exp_nmi_w)) - MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c128_state, exp_reset_w)) - MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c128_state, exp_dma_cd_r)) - MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c128_state, exp_dma_cd_w)) - MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c128_state, exp_dma_w)) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) - MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c128_state, exp_reset_w)) - MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) - MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c128_state, write_user_pb0)) - MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c128_state, write_user_pb1)) - MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c128_state, write_user_pb2)) - MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c128_state, write_user_pb3)) - MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c128_state, write_user_pb4)) - MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c128_state, write_user_pb5)) - MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c128_state, write_user_pb6)) - MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c128_state, write_user_pb7)) - MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c128_state, write_user_pa2)) - - MCFG_QUICKLOAD_ADD("quickload", c128_state, cbm_c64, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") - MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") - MCFG_SOFTWARE_LIST_ADD("cart_list", "c128_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list_c64", "c64_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list_c64", "c64_flop") - MCFG_SOFTWARE_LIST_ADD("flop_list", "c128_flop") - MCFG_SOFTWARE_LIST_ADD("from_list", "c128_rom") - MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("cass_list_c64", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("flop_list_c64", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("from_list", "NTSC") - - // function ROM - MCFG_GENERIC_SOCKET_ADD("from", generic_plain_slot, "c128_rom") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( c128 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( c128, ntsc ) - MCFG_CBM_IEC_ADD("c1571") - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) - MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( c128dcr ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( c128dcr, ntsc ) - MCFG_CBM_IEC_ADD("c1571") // TODO c1571cr - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) - MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( c128d81 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( c128d81, ntsc ) - MCFG_CBM_IEC_ADD(NULL) - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) - MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) - - MCFG_DEVICE_MODIFY("iec8") - MCFG_DEVICE_SLOT_INTERFACE(c128d81_iec_devices, "c1563", false) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pal ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pal, c128_state ) - // basic hardware - MCFG_CPU_ADD(Z80A_TAG, Z80, XTAL_17_734472MHz*2/4.5/2) - MCFG_CPU_PROGRAM_MAP(z80_mem) - MCFG_CPU_IO_MAP(z80_io) - MCFG_QUANTUM_PERFECT_CPU(Z80A_TAG) - - MCFG_CPU_ADD(M8502_TAG, M8502, XTAL_17_734472MHz*2/4.5/8) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_M8502_PORT_CALLBACKS(READ8(c128_state, cpu_r), WRITE8(c128_state, cpu_w)) - MCFG_M8502_PORT_PULLS(0x07, 0x20) - MCFG_CPU_PROGRAM_MAP(m8502_mem) - MCFG_QUANTUM_PERFECT_CPU(M8502_TAG) - - // video hardware - MCFG_MOS8563_ADD(MOS8563_TAG, SCREEN_VDC_TAG, XTAL_16MHz, vdc_videoram_map) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_SCREEN_ADD(SCREEN_VDC_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DEVICE(MOS8563_TAG, mos8563_device, screen_update) - - MCFG_DEVICE_ADD(MOS8566_TAG, MOS8566, XTAL_17_734472MHz*2/4.5) - MCFG_MOS6566_CPU(M8502_TAG) - MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c128_state, vic_irq_w)) - MCFG_MOS8564_K_CALLBACK(WRITE8(c128_state, vic_k_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_VIC_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) - MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) - MCFG_SCREEN_ADD(SCREEN_VIC_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) - MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) - MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DEVICE(MOS8566_TAG, mos8566_device, screen_update) - - MCFG_GFXDECODE_ADD("gfxdecode", MOS8563_TAG":palette", c128) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_17_734472MHz*2/4.5/8) - MCFG_MOS6581_POTX_CALLBACK(READ8(c128_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c128_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_DEVICE_ADD(MOS8722_TAG, MOS8722, XTAL_17_734472MHz*2/4.5/8) - MCFG_MOS8722_Z80EN_CALLBACK(WRITELINE(c128_state, mmu_z80en_w)) - MCFG_MOS8722_FSDIR_CALLBACK(WRITELINE(c128_state, mmu_fsdir_w)) - MCFG_MOS8722_GAME_CALLBACK(READLINE(c128_state, mmu_game_r)) - MCFG_MOS8722_EXROM_CALLBACK(READLINE(c128_state, mmu_exrom_r)) - MCFG_MOS8722_SENSE40_CALLBACK(READLINE(c128_state, mmu_sense40_r)) - MCFG_MOS8721_ADD(MOS8721_TAG) - MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_17_734472MHz*2/4.5/8) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c128_state, cia1_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(WRITELINE(c128_state, cia1_cnt_w)) - MCFG_MOS6526_SP_CALLBACK(WRITELINE(c128_state, cia1_sp_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia1_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia1_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pb_w)) - MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz*2/4.5/8) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c128_state, cia2_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia2_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia2_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia2_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia2_pb_w)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS8566_TAG, mos8566_device, lp_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") - MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_17_734472MHz*2/4.5/8, c64_expansion_cards, NULL) - MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c128_state, exp_irq_w)) - MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c128_state, exp_nmi_w)) - MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c128_state, exp_reset_w)) - MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c128_state, exp_dma_cd_r)) - MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c128_state, exp_dma_cd_w)) - MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c128_state, exp_dma_w)) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) - MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c128_state, exp_reset_w)) - MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) - MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c128_state, write_user_pb0)) - MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c128_state, write_user_pb1)) - MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c128_state, write_user_pb2)) - MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c128_state, write_user_pb3)) - MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c128_state, write_user_pb4)) - MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c128_state, write_user_pb5)) - MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c128_state, write_user_pb6)) - MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c128_state, write_user_pb7)) - MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c128_state, write_user_pa2)) - - MCFG_QUICKLOAD_ADD("quickload", c128_state, cbm_c64, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") - MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") - MCFG_SOFTWARE_LIST_ADD("cart_list", "c128_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list_c64", "c64_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list_c64", "c64_flop") - MCFG_SOFTWARE_LIST_ADD("flop_list", "c128_flop") - MCFG_SOFTWARE_LIST_ADD("from_list", "c128_rom") - MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "PAL") - MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "PAL") - MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") - MCFG_SOFTWARE_LIST_FILTER("cass_list_c64", "PAL") - MCFG_SOFTWARE_LIST_FILTER("flop_list_c64", "PAL") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") - MCFG_SOFTWARE_LIST_FILTER("from_list", "PAL") - - // function ROM - MCFG_GENERIC_SOCKET_ADD("from", generic_plain_slot, "c128_rom") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( c128pal ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( c128pal, pal ) - MCFG_CBM_IEC_ADD("c1571") - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) - MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( c128dcrp ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( c128dcrp, pal ) - MCFG_CBM_IEC_ADD("c1571") // TODO c1571cr - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(WRITELINE(c128_state, iec_srq_w)) - MCFG_CBM_IEC_BUS_DATA_CALLBACK(WRITELINE(c128_state, iec_data_w)) -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( c128 ) -//------------------------------------------------- - -ROM_START( c128 ) - ROM_REGION( 0x10000, M8502_TAG, 0 ) - ROM_DEFAULT_BIOS("r4") - ROM_LOAD( "251913-01.u32", 0x0000, 0x4000, CRC(0010ec31) SHA1(765372a0e16cbb0adf23a07b80f6b682b39fbf88) ) - ROM_SYSTEM_BIOS( 0, "r2", "Revision 2" ) - ROMX_LOAD( "318018-02.u33", 0x4000, 0x4000, CRC(2ee6e2fa) SHA1(60e1491e1d5782e3cf109f518eb73427609badc6), ROM_BIOS(1) ) - ROMX_LOAD( "318019-02.u34", 0x8000, 0x4000, CRC(d551fce0) SHA1(4d223883e866645328f86a904b221464682edc4f), ROM_BIOS(1) ) - ROMX_LOAD( "318020-03.u35", 0xc000, 0x4000, CRC(1e94bb02) SHA1(e80ffbafae068cc0e42698ec5c5c39af46ac612a), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) - ROMX_LOAD( "318018-04.u33", 0x4000, 0x4000, CRC(9f9c355b) SHA1(d53a7884404f7d18ebd60dd3080c8f8d71067441), ROM_BIOS(2) ) - ROMX_LOAD( "318019-04.u34", 0x8000, 0x4000, CRC(6e2c91a7) SHA1(c4fb4a714e48a7bf6c28659de0302183a0e0d6c0), ROM_BIOS(2) ) - ROMX_LOAD( "318020-05.u35", 0xc000, 0x4000, CRC(ba456b8e) SHA1(ceb6e1a1bf7e08eb9cbc651afa29e26adccf38ab), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "jiffydos", "JiffyDOS v6.01" ) - ROMX_LOAD( "318018-04.u33", 0x4000, 0x4000, CRC(9f9c355b) SHA1(d53a7884404f7d18ebd60dd3080c8f8d71067441), ROM_BIOS(3) ) - ROMX_LOAD( "318019-04.u34", 0x8000, 0x4000, CRC(6e2c91a7) SHA1(c4fb4a714e48a7bf6c28659de0302183a0e0d6c0), ROM_BIOS(3) ) - ROMX_LOAD( "jiffydos c128.u35", 0xc000, 0x4000, CRC(4b7964de) SHA1(7d1898f32beae4b2ae610d469ce578a588efaa7c), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "quikslvr", "QuickSilver 128" ) // requires add-on cartridge - ROMX_LOAD( "318018-04.u33", 0x4000, 0x4000, CRC(9f9c355b) SHA1(d53a7884404f7d18ebd60dd3080c8f8d71067441), ROM_BIOS(4) ) - ROMX_LOAD( "318019-04.u34", 0x8000, 0x4000, CRC(6e2c91a7) SHA1(c4fb4a714e48a7bf6c28659de0302183a0e0d6c0), ROM_BIOS(4) ) - ROMX_LOAD( "quicksilver128.u35", 0xc000, 0x4000, CRC(c2e74338) SHA1(916cdcc62eb631073aa7f096815dcf33b3229ca8), ROM_BIOS(4) ) - - ROM_REGION( 0x2000, "charom", 0 ) - ROM_LOAD( "390059-01.u18", 0x0000, 0x2000, CRC(6aaaafe6) SHA1(29ed066d513f2d5c09ff26d9166ba23c2afb2b3f) ) - - ROM_REGION( 0xc88, MOS8721_TAG, 0 ) - // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt - ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) -ROM_END - -#define rom_c128p rom_c128 -#define rom_c128d rom_c128 -#define rom_c128dp rom_c128 -#define rom_c128dpr rom_c128 -#define rom_c128d81 rom_c128 - - -//------------------------------------------------- -// ROM( c128_de ) -//------------------------------------------------- - -ROM_START( c128_de ) - ROM_REGION( 0x10000, M8502_TAG, 0 ) - ROM_DEFAULT_BIOS("r4") - ROM_LOAD( "251913-01.u32", 0x0000, 0x4000, CRC(0010ec31) SHA1(765372a0e16cbb0adf23a07b80f6b682b39fbf88) ) - ROM_SYSTEM_BIOS( 0, "r2", "Revision 2" ) - ROMX_LOAD( "318018-02.u33", 0x4000, 0x4000, CRC(2ee6e2fa) SHA1(60e1491e1d5782e3cf109f518eb73427609badc6), ROM_BIOS(1) ) - ROMX_LOAD( "318019-02.u34", 0x8000, 0x4000, CRC(d551fce0) SHA1(4d223883e866645328f86a904b221464682edc4f), ROM_BIOS(1) ) - ROMX_LOAD( "315078-01.u35", 0xc000, 0x4000, CRC(a51e2168) SHA1(bcf82a89a8fc5d086bec2ff3bcbdecc8af2be3af), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) - ROMX_LOAD( "318018-04.u33", 0x4000, 0x4000, CRC(9f9c355b) SHA1(d53a7884404f7d18ebd60dd3080c8f8d71067441), ROM_BIOS(2) ) - ROMX_LOAD( "318019-04.u34", 0x8000, 0x4000, CRC(6e2c91a7) SHA1(c4fb4a714e48a7bf6c28659de0302183a0e0d6c0), ROM_BIOS(2) ) - ROMX_LOAD( "315078-02.u35", 0xc000, 0x4000, CRC(b275bb2e) SHA1(78ac5dcdd840b092ba1ee6d19b33af079613291f), ROM_BIOS(2) ) - - ROM_REGION( 0x2000, "charom", 0 ) - ROM_LOAD( "315079-01.u18", 0x00000, 0x2000, CRC(fe5a2db1) SHA1(638f8aff51c2ac4f99a55b12c4f8c985ef4bebd3) ) - - ROM_REGION( 0xc88, MOS8721_TAG, 0 ) - // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt - ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) -ROM_END - - -//------------------------------------------------- -// ROM( c128_se ) -//------------------------------------------------- - -ROM_START( c128_se ) - ROM_REGION( 0x10000, M8502_TAG, 0 ) - ROM_LOAD( "325182-01.u32", 0x0000, 0x4000, CRC(2aff27d3) SHA1(267654823c4fdf2167050f41faa118218d2569ce) ) // "C128 64 Sw/Fi" - ROM_LOAD( "318018-02.u33", 0x4000, 0x4000, CRC(2ee6e2fa) SHA1(60e1491e1d5782e3cf109f518eb73427609badc6) ) - ROM_LOAD( "318019-02.u34", 0x8000, 0x4000, CRC(d551fce0) SHA1(4d223883e866645328f86a904b221464682edc4f) ) - ROM_LOAD( "325189-01.u35", 0xc000, 0x4000, CRC(9526fac4) SHA1(a01dd871241c801db51e8ebc30fedfafd8cc506b) ) // "C128 Ker Sw/Fi" - - ROM_REGION( 0x2000, "charom", 0 ) - ROM_LOAD( "325181-01.bin", 0x0000, 0x2000, CRC(7a70d9b8) SHA1(aca3f7321ee7e6152f1f0afad646ae41964de4fb) ) // "C128 Char Sw/Fi" - - ROM_REGION( 0xc88, MOS8721_TAG, 0 ) - // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt - ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) -ROM_END - - -//------------------------------------------------- -// ROM( c128cr ) -//------------------------------------------------- - -ROM_START( c128cr ) - /* C128CR prototype, owned by Bo Zimmers - PCB markings: "COMMODORE 128CR REV.3 // PCB NO.252270" and "PCB ASSY NO.250783" - Sticker on rom cart shield: "C128CR No.2 // ENG. SAMPLE // Jun/9/'86 KNT" - 3 ROMs (combined basic, combined c64/kernal, plain character rom) - 6526A-1 CIAs - ?prototype? 2568R1X VDC w/ 1186 datecode - */ - ROM_REGION( 0x10000, M8502_TAG, 0 ) - ROM_LOAD( "252343-03.u34", 0x4000, 0x8000, CRC(bc07ed87) SHA1(0eec437994a3f2212343a712847213a8a39f4a7b) ) // "252343-03 // U34" - ROM_LOAD( "252343-04.u32", 0x0000, 0x4000, CRC(cc6bdb69) SHA1(36286b2e8bea79f7767639fd85e12c5447c7041b) ) // "252343-04 // US // U32" - ROM_CONTINUE( 0xc000, 0x4000 ) - - ROM_REGION( 0x2000, "charom", 0 ) - ROM_LOAD( "390059-01.u18", 0x0000, 0x2000, CRC(6aaaafe6) SHA1(29ed066d513f2d5c09ff26d9166ba23c2afb2b3f) ) // "MOS // (C)1985 CBM // 390059-01 // M468613 8547H" - - ROM_REGION( 0xc88, MOS8721_TAG, 0 ) - // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt - ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) -ROM_END - - -//------------------------------------------------- -// ROM( c128dcr ) -//------------------------------------------------- - -ROM_START( c128dcr ) - ROM_REGION( 0x10000, M8502_TAG, 0 ) - ROM_LOAD( "318022-02.u34", 0x4000, 0x8000, CRC(af1ae1e8) SHA1(953dcdf5784a6b39ef84dd6fd968c7a03d8d6816) ) - ROM_LOAD( "318023-02.u32", 0x0000, 0x4000, CRC(eedc120a) SHA1(f98c5a986b532c78bb68df9ec6dbcf876913b99f) ) - ROM_CONTINUE( 0xc000, 0x4000 ) - - ROM_REGION( 0x2000, "charom", 0 ) - ROM_LOAD( "390059-01.u18", 0x0000, 0x2000, CRC(6aaaafe6) SHA1(29ed066d513f2d5c09ff26d9166ba23c2afb2b3f) ) - - ROM_REGION( 0xc88, MOS8721_TAG, 0 ) - // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt - ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) -ROM_END - -#define rom_c128dcrp rom_c128dcr - - -//------------------------------------------------- -// ROM( c128dcr_de ) -//------------------------------------------------- - -ROM_START( c128dcr_de ) - ROM_REGION( 0x10000, M8502_TAG, 0 ) - ROM_LOAD( "318022-02.u34", 0x4000, 0x8000, CRC(af1ae1e8) SHA1(953dcdf5784a6b39ef84dd6fd968c7a03d8d6816) ) - ROM_LOAD( "318077-01.u32", 0x0000, 0x4000, CRC(eb6e2c8f) SHA1(6b3d891fedabb5335f388a5d2a71378472ea60f4) ) - ROM_CONTINUE( 0xc000, 0x4000 ) - - ROM_REGION( 0x2000, "charom", 0 ) - ROM_LOAD( "315079-01.u18", 0x0000, 0x2000, CRC(fe5a2db1) SHA1(638f8aff51c2ac4f99a55b12c4f8c985ef4bebd3) ) - - ROM_REGION( 0xc88, MOS8721_TAG, 0 ) - // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt - ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) -ROM_END - - -//------------------------------------------------- -// ROM( c128dcr_se ) -//------------------------------------------------- - -ROM_START( c128dcr_se ) - ROM_REGION( 0x10000, M8502_TAG, 0 ) - ROM_LOAD( "318022-02.u34", 0x4000, 0x8000, CRC(af1ae1e8) SHA1(953dcdf5784a6b39ef84dd6fd968c7a03d8d6816) ) - ROM_LOAD( "318034-01.u32", 0x0000, 0x4000, CRC(cb4e1719) SHA1(9b0a0cef56d00035c611e07170f051ee5e63aa3a) ) - ROM_CONTINUE( 0xc000, 0x4000 ) - - ROM_REGION( 0x2000, "charom", 0 ) - ROM_LOAD( "325181-01.u18", 0x0000, 0x2000, CRC(7a70d9b8) SHA1(aca3f7321ee7e6152f1f0afad646ae41964de4fb) ) - - ROM_REGION( 0xc88, MOS8721_TAG, 0 ) - // converted from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c128/8721-reduced.zip/8721-reduced.txt - ROM_LOAD( "8721r3.u11", 0x000, 0xc88, BAD_DUMP CRC(154db186) SHA1(ccadcdb1db3b62c51dc4ce60fe6f96831586d297) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1985, c128, 0, 0, c128, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, c128p, 0, 0, c128pal, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128 (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, c128_de, c128, 0, c128pal, c128_de, driver_device, 0, "Commodore Business Machines", "Commodore 128 (Germany)", MACHINE_SUPPORTS_SAVE ) -//COMP( 1985, c128_fr, c128, 0, c128pal, c128_fr, driver_device, 0, "Commodore Business Machines", "Commodore 128 (France)", MACHINE_SUPPORTS_SAVE ) -//COMP( 1985, c128_no, c128, 0, c128pal, c128_it, driver_device, 0, "Commodore Business Machines", "Commodore 128 (Norway)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, c128_se, c128, 0, c128pal, c128_se, driver_device, 0, "Commodore Business Machines", "Commodore 128 (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, c128d, c128, 0, c128, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128D (NTSC, prototype)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, c128dp, c128, 0, c128pal, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128D (PAL)", MACHINE_SUPPORTS_SAVE ) - -COMP( 1986, c128cr, c128, 0, c128, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128CR (NTSC, prototype)", MACHINE_SUPPORTS_SAVE ) - -COMP( 1987, c128dcr, c128, 0, c128dcr, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128DCR (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1987, c128dcrp, c128, 0, c128dcrp, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128DCR (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1987, c128dcr_de, c128, 0, c128dcrp, c128_de, driver_device, 0, "Commodore Business Machines", "Commodore 128DCR (Germany)", MACHINE_SUPPORTS_SAVE ) -//COMP( 1986, c128dcr_it, c128, 0, c128dcrp, c128_it, driver_device, 0,"Commodore Business Machines", "Commodore 128DCR (Italy)", MACHINE_SUPPORTS_SAVE ) -COMP( 1987, c128dcr_se, c128, 0, c128dcrp, c128_se, driver_device, 0, "Commodore Business Machines", "Commodore 128DCR (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) - -COMP( 1986, c128d81, c128, 0, c128d81, c128, driver_device, 0, "Commodore Business Machines", "Commodore 128D/81 (NTSC, prototype)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/c64.c b/src/mess/drivers/c64.c deleted file mode 100644 index 56aaf5966da..00000000000 --- a/src/mess/drivers/c64.c +++ /dev/null @@ -1,1847 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - TODO: - - - floating bus writes to peripheral registers in m6502.c - - sort out kernals between PAL/NTSC - - tsuit215 test failures - - IRQ (WRONG $DC0D) - - NMI (WRONG $DD0D) - - some CIA tests - - PDC Clipper (C64 in a briefcase with 3" floppy, electroluminescent flat screen, thermal printer) - -*/ - -#include "includes/c64.h" -#include "bus/cbmiec/c1541.h" -#include "machine/cbm_snqk.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define A15 BIT(offset, 15) -#define A14 BIT(offset, 14) -#define A13 BIT(offset, 13) -#define A12 BIT(offset, 12) -#define VA13 BIT(va, 13) -#define VA12 BIT(va, 12) - -enum -{ - PLA_OUT_CASRAM = 0, - PLA_OUT_BASIC = 1, - PLA_OUT_KERNAL = 2, - PLA_OUT_CHAROM = 3, - PLA_OUT_GRW = 4, - PLA_OUT_IO = 5, - PLA_OUT_ROML = 6, - PLA_OUT_ROMH = 7 -}; - - -QUICKLOAD_LOAD_MEMBER( c64_state, cbm_c64 ) -{ - return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress); -} - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// check_interrupts - -//------------------------------------------------- - -void c64_state::check_interrupts() -{ - int irq = m_cia1_irq || m_vic_irq || m_exp_irq; - int nmi = m_cia2_irq || !m_restore || m_exp_nmi; - //int rdy = m_exp_dma && m_vic_ba; - - m_maincpu->set_input_line(M6510_IRQ_LINE, irq); - m_maincpu->set_input_line(M6510_NMI_LINE, nmi); -} - - - -//************************************************************************** -// ADDRESS DECODING -//************************************************************************** - -//------------------------------------------------- -// read_pla - -//------------------------------------------------- - -int c64_state::read_pla(offs_t offset, offs_t va, int rw, int aec, int ba) -{ - //int ba = m_vic->ba_r(); - //int aec = !m_vic->aec_r(); - int sphi2 = m_vic->phi0_r(); - int game = m_exp->game_r(offset, sphi2, ba, rw, m_hiram); - int exrom = m_exp->exrom_r(offset, sphi2, ba, rw, m_hiram); - int cas = 0; - - UINT32 input = VA12 << 15 | VA13 << 14 | game << 13 | exrom << 12 | rw << 11 | aec << 10 | ba << 9 | A12 << 8 | - A13 << 7 | A14 << 6 | A15 << 5 | m_va14 << 4 | m_charen << 3 | m_hiram << 2 | m_loram << 1 | cas; - - return m_pla->read(input); -} - - -//------------------------------------------------- -// read_memory - -//------------------------------------------------- - -UINT8 c64_state::read_memory(address_space &space, offs_t offset, offs_t va, int aec, int ba) -{ - int rw = 1; - int io1 = 1, io2 = 1; - int sphi2 = m_vic->phi0_r(); - - int plaout = read_pla(offset, va, rw, !aec, ba); - - UINT8 data = 0xff; - - if (!aec) - { - data = m_vic->bus_r(); - } - - if (!BIT(plaout, PLA_OUT_CASRAM)) - { - if (aec) - { - data = m_ram->pointer()[offset]; - } - else - { - data = m_ram->pointer()[(!m_va15 << 15) | (!m_va14 << 14) | va]; - } - } - if (!BIT(plaout, PLA_OUT_BASIC)) - { - data = m_basic[offset & 0x1fff]; - } - if (!BIT(plaout, PLA_OUT_KERNAL)) - { - data = m_kernal[offset & 0x1fff]; - } - if (!BIT(plaout, PLA_OUT_CHAROM)) - { - data = m_charom[offset & 0xfff]; - } - if (!BIT(plaout, PLA_OUT_IO)) - { - switch ((offset >> 8) & 0x0f) - { - case 0: - case 1: - case 2: - case 3: // VIC - data = m_vic->read(space, offset & 0x3f); - break; - - case 4: - case 5: - case 6: - case 7: // SID - data = m_sid->read(space, offset & 0x1f); - break; - - case 0x8: - case 0x9: - case 0xa: - case 0xb: // COLOR - data = m_color_ram[offset & 0x3ff] & 0x0f; - break; - - case 0xc: // CIA1 - data = m_cia1->read(space, offset & 0x0f); - break; - - case 0xd: // CIA2 - data = m_cia2->read(space, offset & 0x0f); - break; - - case 0xe: // I/O1 - io1 = 0; - break; - - case 0xf: // I/O2 - io2 = 0; - break; - } - } - - int roml = BIT(plaout, PLA_OUT_ROML); - int romh = BIT(plaout, PLA_OUT_ROMH); - return m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2); -} - - -//------------------------------------------------- -// write_memory - -//------------------------------------------------- - -void c64_state::write_memory(address_space &space, offs_t offset, UINT8 data, int aec, int ba) -{ - int rw = 0; - offs_t va = 0; - int io1 = 1, io2 = 1; - int sphi2 = m_vic->phi0_r(); - - int plaout = read_pla(offset, va, rw, !aec, ba); - - if (offset < 0x0002) - { - // write to internal CPU register - data = m_vic->bus_r(); - } - - if (!BIT(plaout, PLA_OUT_CASRAM)) - { - m_ram->pointer()[offset] = data; - } - if (!BIT(plaout, PLA_OUT_IO)) - { - switch ((offset >> 8) & 0x0f) - { - case 0: - case 1: - case 2: - case 3: // VIC - m_vic->write(space, offset & 0x3f, data); - break; - - case 4: - case 5: - case 6: - case 7: // SID - m_sid->write(space, offset & 0x1f, data); - break; - - case 0x8: - case 0x9: - case 0xa: - case 0xb: // COLOR - if (!BIT(plaout, PLA_OUT_GRW)) m_color_ram[offset & 0x3ff] = data & 0x0f; - break; - - case 0xc: // CIA1 - m_cia1->write(space, offset & 0x0f, data); - break; - - case 0xd: // CIA2 - m_cia2->write(space, offset & 0x0f, data); - break; - - case 0xe: // I/O1 - io1 = 0; - break; - - case 0xf: // I/O2 - io2 = 0; - break; - } - } - - int roml = BIT(plaout, PLA_OUT_ROML); - int romh = BIT(plaout, PLA_OUT_ROMH); - m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2); -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( c64_state::read ) -{ - int aec = 1, ba = 1; - - // VIC address bus is floating - offs_t va = 0x3fff; - - return read_memory(space, offset, va, aec, ba); -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( c64_state::write ) -{ - int aec = 1, ba = 1; - - write_memory(space, offset, data, aec, ba); -} - - -//------------------------------------------------- -// vic_videoram_r - -//------------------------------------------------- - -READ8_MEMBER( c64_state::vic_videoram_r ) -{ - int aec = m_vic->aec_r(), ba = m_vic->ba_r(); - offs_t va = offset; - - // A15/A14 are not connected to VIC so they are floating - //offset |= 0xc000; - - return read_memory(space, offset, va, aec, ba); -} - - -//------------------------------------------------- -// vic_colorram_r - -//------------------------------------------------- - -READ8_MEMBER( c64_state::vic_colorram_r ) -{ - UINT8 data; - - if (m_vic->aec_r()) - { - // TODO low nibble of last opcode - data = 0x0f; - } - else - { - data = m_color_ram[offset] & 0x0f; - } - - return data; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( c64_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( c64_mem, AS_PROGRAM, 8, c64_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_videoram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, c64_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_colorram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, c64_state ) - AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( c64 ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c64_state::write_restore ) -{ - m_restore = state; - - check_interrupts(); -} - -static INPUT_PORTS_START( c64 ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START( "RESTORE" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, c64_state, write_restore) - - PORT_START( "LOCK" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( c64sw ) -//------------------------------------------------- - -static INPUT_PORTS_START( c64sw ) - PORT_INCLUDE( c64 ) - - PORT_MODIFY( "ROW5" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_MODIFY( "ROW6" ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('@') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( c64gs ) -//------------------------------------------------- - -static INPUT_PORTS_START( c64gs ) - // no keyboard -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// vic2_interface vic_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( c64_state::vic_irq_w ) -{ - m_vic_irq = state; - - check_interrupts(); -} - - -//------------------------------------------------- -// MOS6581_INTERFACE( sid_intf ) -//------------------------------------------------- - -READ8_MEMBER( c64_state::sid_potx_r ) -{ - UINT8 data = 0xff; - - switch (m_cia1->pa_r() >> 6) - { - case 1: data = m_joy1->pot_x_r(); break; - case 2: data = m_joy2->pot_x_r(); break; - case 3: - if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) - { - data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); - } - else if (m_joy1->has_pot_x()) - { - data = m_joy1->pot_x_r(); - } - else if (m_joy2->has_pot_x()) - { - data = m_joy2->pot_x_r(); - } - break; - } - - return data; -} - -READ8_MEMBER( c64_state::sid_poty_r ) -{ - UINT8 data = 0xff; - - switch (m_cia1->pa_r() >> 6) - { - case 1: data = m_joy1->pot_y_r(); break; - case 2: data = m_joy2->pot_y_r(); break; - case 3: - if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) - { - data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); - } - else if (m_joy1->has_pot_y()) - { - data = m_joy1->pot_y_r(); - } - else if (m_joy2->has_pot_y()) - { - data = m_joy2->pot_y_r(); - } - break; - } - - return data; -} - - -//------------------------------------------------- -// MOS6526_INTERFACE( cia1_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c64_state::cia1_irq_w ) -{ - m_cia1_irq = state; - - check_interrupts(); -} - -READ8_MEMBER( c64_state::cia1_pa_r ) -{ - /* - - bit description - - PA0 COL0, JOY B0 - PA1 COL1, JOY B1 - PA2 COL2, JOY B2 - PA3 COL3, JOY B3 - PA4 COL4, BTNB - PA5 COL5 - PA6 COL6 - PA7 COL7 - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy_b = m_joy2->joy_r(); - - data &= (0xf0 | (joy_b & 0x0f)); - data &= ~(!BIT(joy_b, 5) << 4); - - // keyboard - UINT8 cia1_pb = m_cia1->pb_r(); - UINT8 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), - m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; - - for (int i = 0; i < 8; i++) - { - if (!BIT(cia1_pb, i)) - { - if (!BIT(row[7], i)) data &= ~0x80; - if (!BIT(row[6], i)) data &= ~0x40; - if (!BIT(row[5], i)) data &= ~0x20; - if (!BIT(row[4], i)) data &= ~0x10; - if (!BIT(row[3], i)) data &= ~0x08; - if (!BIT(row[2], i)) data &= ~0x04; - if (!BIT(row[1], i)) data &= ~0x02; - if (!BIT(row[0], i)) data &= ~0x01; - } - } - - return data; -} - -WRITE8_MEMBER( c64_state::cia1_pa_w ) -{ - /* - - bit description - - PA0 COL0, JOY B0 - PA1 COL1, JOY B1 - PA2 COL2, JOY B2 - PA3 COL3, JOY B3 - PA4 COL4, BTNB - PA5 COL5 - PA6 COL6 - PA7 COL7 - - */ - - m_joy2->joy_w(data & 0x1f); -} - -READ8_MEMBER( c64_state::cia1_pb_r ) -{ - /* - - bit description - - PB0 ROW0, JOY A0 - PB1 ROW1, JOY A1 - PB2 ROW2, JOY A2 - PB3 ROW3, JOY A3 - PB4 ROW4, BTNA, _LP - PB5 ROW5 - PB6 ROW6 - PB7 ROW7 - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy_a = m_joy1->joy_r(); - - data &= (0xf0 | (joy_a & 0x0f)); - data &= ~(!BIT(joy_a, 5) << 4); - - // keyboard - UINT8 cia1_pa = m_cia1->pa_r(); - - if (!BIT(cia1_pa, 7)) data &= m_row7->read(); - if (!BIT(cia1_pa, 6)) data &= m_row6->read(); - if (!BIT(cia1_pa, 5)) data &= m_row5->read(); - if (!BIT(cia1_pa, 4)) data &= m_row4->read(); - if (!BIT(cia1_pa, 3)) data &= m_row3->read(); - if (!BIT(cia1_pa, 2)) data &= m_row2->read(); - if (!BIT(cia1_pa, 1)) data &= m_row1->read() & m_lock->read(); - if (!BIT(cia1_pa, 0)) data &= m_row0->read(); - - return data; -} - -WRITE8_MEMBER( c64_state::cia1_pb_w ) -{ - /* - - bit description - - PB0 ROW0, JOY A0 - PB1 ROW1, JOY A1 - PB2 ROW2, JOY A2 - PB3 ROW3, JOY A3 - PB4 ROW4, BTNA, _LP - PB5 ROW5 - PB6 ROW6 - PB7 ROW7 - - */ - - m_joy1->joy_w(data & 0x1f); - - m_vic->lp_w(BIT(data, 4)); -} - -READ8_MEMBER( c64gs_state::cia1_pa_r ) -{ - /* - - bit description - - PA0 JOY B0 - PA1 JOY B1 - PA2 JOY B2 - PA3 JOY B3 - PA4 BTNB - PA5 - PA6 - PA7 - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy_b = m_joy2->joy_r(); - - data &= (0xf0 | (joy_b & 0x0f)); - data &= ~(!BIT(joy_b, 5) << 4); - - return data; -} - -READ8_MEMBER( c64gs_state::cia1_pb_r ) -{ - /* - - bit description - - PB0 JOY A0 - PB1 JOY A1 - PB2 JOY A2 - PB3 JOY A3 - PB4 BTNA/_LP - PB5 - PB6 - PB7 - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy_a = m_joy1->joy_r(); - - data &= (0xf0 | (joy_a & 0x0f)); - data &= ~(!BIT(joy_a, 5) << 4); - - return data; -} - - -//------------------------------------------------- -// MOS6526_INTERFACE( cia2_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c64_state::cia2_irq_w ) -{ - m_cia2_irq = state; - - check_interrupts(); -} - -READ8_MEMBER( c64_state::cia2_pa_r ) -{ - /* - - bit description - - PA0 - PA1 - PA2 USER PORT - PA3 - PA4 - PA5 - PA6 CLK - PA7 DATA - - */ - - UINT8 data = 0; - - // user port - data |= m_user_pa2 << 2; - - // IEC bus - data |= m_iec->clk_r() << 6; - data |= m_iec->data_r() << 7; - - return data; -} - -WRITE8_MEMBER( c64_state::cia2_pa_w ) -{ - /* - - bit description - - PA0 _VA14 - PA1 _VA15 - PA2 USER PORT - PA3 ATN OUT - PA4 CLK OUT - PA5 DATA OUT - PA6 - PA7 - - */ - - // VIC banking - m_va14 = BIT(data, 0); - m_va15 = BIT(data, 1); - - // user port - m_user->write_m(BIT(data, 2)); - - // IEC bus - m_iec->atn_w(!BIT(data, 3)); - m_iec->clk_w(!BIT(data, 4)); - m_iec->data_w(!BIT(data, 5)); -} - -READ8_MEMBER( c64_state::cia2_pb_r ) -{ - return m_user_pb; -} - -WRITE8_MEMBER( c64_state::cia2_pb_w ) -{ - m_user->write_c((data>>0)&1); - m_user->write_d((data>>1)&1); - m_user->write_e((data>>2)&1); - m_user->write_f((data>>3)&1); - m_user->write_h((data>>4)&1); - m_user->write_j((data>>5)&1); - m_user->write_k((data>>6)&1); - m_user->write_l((data>>7)&1); -} - -//------------------------------------------------- -// M6510_INTERFACE( cpu_intf ) -//------------------------------------------------- - -READ8_MEMBER( c64_state::cpu_r ) -{ - /* - - bit description - - P0 1 - P1 1 - P2 1 - P3 - P4 CASS SENS - P5 0 - - */ - - UINT8 data = 0x07; - - data |= m_cassette->sense_r() << 4; - - return data; -} - -WRITE8_MEMBER( c64_state::cpu_w ) -{ - /* - - bit description - - P0 LORAM - P1 HIRAM - P2 CHAREN - P3 CASS WRT - P4 - P5 CASS MOTOR - - */ - - // memory banking - m_loram = BIT(data, 0); - m_hiram = BIT(data, 1); - m_charen = BIT(data, 2); - - // cassette write - m_cassette->write(BIT(data, 3)); - - // cassette motor - m_cassette->motor_w(BIT(data, 5)); -} - - -//------------------------------------------------- -// M6510_INTERFACE( sx64_cpu_intf ) -//------------------------------------------------- - -READ8_MEMBER( sx64_state::cpu_r ) -{ - /* - - bit description - - P0 1 - P1 1 - P2 1 - P3 - P4 - P5 - - */ - - return 0x07; -} - -WRITE8_MEMBER( sx64_state::cpu_w ) -{ - /* - - bit description - - P0 LORAM - P1 HIRAM - P2 CHAREN - P3 - P4 - P5 - - */ - - // memory banking - m_loram = BIT(data, 0); - m_hiram = BIT(data, 1); - m_charen = BIT(data, 2); -} - - -//------------------------------------------------- -// M6510_INTERFACE( c64gs_cpu_intf ) -//------------------------------------------------- - -READ8_MEMBER( c64gs_state::cpu_r ) -{ - /* - - bit description - - P0 1 - P1 1 - P2 1 - P3 - P4 - P5 - - */ - - return 0x07; -} - -WRITE8_MEMBER( c64gs_state::cpu_w ) -{ - /* - - bit description - - P0 LORAM - P1 HIRAM - P2 CHAREN - P3 - P4 - P5 - - */ - - // memory banking - m_loram = BIT(data, 0); - m_hiram = BIT(data, 1); - m_charen = BIT(data, 2); -} - - -//------------------------------------------------- -// C64_EXPANSION_INTERFACE( expansion_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( c64_state::exp_irq_w ) -{ - m_exp_irq = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( c64_state::exp_nmi_w ) -{ - m_exp_nmi = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( c64_state::exp_dma_w ) -{ - if (m_exp_dma != state) - { - m_exp_dma = state; - - m_maincpu->set_input_line(INPUT_LINE_HALT, m_exp_dma); - } -} - -WRITE_LINE_MEMBER( c64_state::exp_reset_w ) -{ - if (!state) - { - machine_reset(); - } -} - - -//------------------------------------------------- -// SLOT_INTERFACE( sx1541_iec_devices ) -//------------------------------------------------- - -SLOT_INTERFACE_START( sx1541_iec_devices ) - SLOT_INTERFACE("sx1541", SX1541) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( c64 ) -//------------------------------------------------- - -void c64_state::machine_start() -{ - // get pointers to ROMs - if (memregion("basic") != NULL) - { - m_basic = memregion("basic")->base(); - m_kernal = memregion("kernal")->base(); - } - else - { - m_basic = memregion("kernal")->base(); - m_kernal = &m_basic[0x2000]; - } - m_charom = memregion("charom")->base(); - - // allocate memory - m_color_ram.allocate(0x400); - - // initialize memory - UINT8 data = 0xff; - - for (offs_t offset = 0; offset < m_ram->size(); offset++) - { - m_ram->pointer()[offset] = data; - if (!(offset % 64)) data ^= 0xff; - } - - // state saving - save_item(NAME(m_loram)); - save_item(NAME(m_hiram)); - save_item(NAME(m_charen)); - save_item(NAME(m_va14)); - save_item(NAME(m_va15)); - save_item(NAME(m_cia1_irq)); - save_item(NAME(m_cia2_irq)); - save_item(NAME(m_vic_irq)); - save_item(NAME(m_exp_irq)); - save_item(NAME(m_exp_nmi)); - save_item(NAME(m_exp_dma)); - save_item(NAME(m_user_pb)); - save_item(NAME(m_user_pa2)); -} - - -void c64_state::machine_reset() -{ - m_maincpu->reset(); - - m_vic->reset(); - m_sid->reset(); - m_cia1->reset(); - m_cia2->reset(); - - m_iec->reset(); - m_exp->reset(); - - m_user->write_3(0); - m_user->write_3(1); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( ntsc ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ntsc, c64_state ) - // basic hardware - MCFG_CPU_ADD(M6510_TAG, M6510, XTAL_14_31818MHz/14) - MCFG_CPU_PROGRAM_MAP(c64_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_M6510_PORT_CALLBACKS(READ8(c64_state, cpu_r), WRITE8(c64_state, cpu_w)) - MCFG_M6510_PORT_PULLS(0x17, 0xc8) - MCFG_QUANTUM_PERFECT_CPU(M6510_TAG) - - // video hardware - MCFG_DEVICE_ADD(MOS6567_TAG, MOS6567, XTAL_14_31818MHz/14) - MCFG_MOS6566_CPU(M6510_TAG) - MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c64_state, vic_irq_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) - MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) - MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) - MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DEVICE(MOS6567_TAG, mos6567_device, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_14_31818MHz/14) - MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_PLS100_ADD(PLA_TAG) - MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_14_31818MHz/14) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia1_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia1_pa_r)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia1_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pb_w)) - MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_14_31818MHz/14) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia2_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia2_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia2_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pb_w)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) - MCFG_CBM_IEC_ADD("c1541") - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) - MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_9)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6567_TAG, mos6567_device, lp_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") - MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/14, c64_expansion_cards, NULL) - MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c64_state, exp_irq_w)) - MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c64_state, exp_nmi_w)) - MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c64_state, exp_reset_w)) - MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c64_state, read)) - MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c64_state, write)) - MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c64_state, exp_dma_w)) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) - MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c64_state, exp_reset_w)) - MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) - MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c64_state, write_user_pb0)) - MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c64_state, write_user_pb1)) - MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c64_state, write_user_pb2)) - MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c64_state, write_user_pb3)) - MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c64_state, write_user_pb4)) - MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c64_state, write_user_pb5)) - MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c64_state, write_user_pb6)) - MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c64_state, write_user_pb7)) - MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c64_state, write_user_pa2)) - - MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") - MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "c64_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "c64_flop") - MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("cass_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet64 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet64, ntsc ) - // TODO monochrome green palette -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( ntsc_sx ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ntsc_sx, sx64_state ) - MCFG_FRAGMENT_ADD(ntsc) - - // basic hardware - MCFG_CPU_MODIFY(M6510_TAG) - MCFG_M6510_PORT_CALLBACKS(READ8(sx64_state, cpu_r), WRITE8(sx64_state, cpu_w)) - MCFG_M6510_PORT_PULLS(0x07, 0xc0) - - // devices - MCFG_DEVICE_MODIFY("iec8") - MCFG_DEVICE_SLOT_INTERFACE(sx1541_iec_devices, "sx1541", false) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( ntsc_dx ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ntsc_dx, sx64_state ) - MCFG_FRAGMENT_ADD(ntsc_sx) - - // devices - MCFG_DEVICE_MODIFY("iec9") - MCFG_DEVICE_SLOT_INTERFACE(sx1541_iec_devices, "sx1541", false) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( ntsc_c ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( ntsc_c, ntsc, c64c_state ) - MCFG_SOUND_REPLACE(MOS6581_TAG, MOS8580, XTAL_14_31818MHz/14) - MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pal ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pal, c64_state ) - // basic hardware - MCFG_CPU_ADD(M6510_TAG, M6510, XTAL_17_734472MHz/18) - MCFG_CPU_PROGRAM_MAP(c64_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_M6510_PORT_CALLBACKS(READ8(c64_state, cpu_r), WRITE8(c64_state, cpu_w)) - MCFG_M6510_PORT_PULLS(0x17, 0xc8) - MCFG_QUANTUM_PERFECT_CPU(M6510_TAG) - - // video hardware - MCFG_DEVICE_ADD(MOS6569_TAG, MOS6569, XTAL_17_734472MHz/18) - MCFG_MOS6566_CPU(M6510_TAG) - MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c64_state, vic_irq_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) - MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) - MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) - MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DEVICE(MOS6569_TAG, mos6569_device, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_17_734472MHz/18) - MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_PLS100_ADD(PLA_TAG) - MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_17_734472MHz/18) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia1_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia1_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia1_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pb_w)) - MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz/18) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia2_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia2_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia2_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pb_w)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) - MCFG_CBM_IEC_ADD("c1541") - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) - MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_9)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") - MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_17_734472MHz/18, c64_expansion_cards, NULL) - MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c64_state, exp_irq_w)) - MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c64_state, exp_nmi_w)) - MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c64_state, exp_reset_w)) - MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c64_state, read)) - MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c64_state, write)) - MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c64_state, exp_dma_w)) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) - MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c64_state, exp_reset_w)) - MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) - MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c64_state, write_user_pb0)) - MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c64_state, write_user_pb1)) - MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c64_state, write_user_pb2)) - MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c64_state, write_user_pb3)) - MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c64_state, write_user_pb4)) - MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c64_state, write_user_pb5)) - MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c64_state, write_user_pb6)) - MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c64_state, write_user_pb7)) - MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c64_state, write_user_pa2)) - - MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") - MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "c64_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "c64_flop") - MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "PAL") - MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "PAL") - MCFG_SOFTWARE_LIST_FILTER("cass_list", "PAL") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pal_sx ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pal_sx, sx64_state ) - MCFG_FRAGMENT_ADD(pal) - - // basic hardware - MCFG_CPU_MODIFY(M6510_TAG) - MCFG_M6510_PORT_CALLBACKS(READ8(sx64_state, cpu_r), WRITE8(sx64_state, cpu_w)) - MCFG_M6510_PORT_PULLS(0x07, 0xc0) - - // devices - MCFG_DEVICE_MODIFY("iec8") - MCFG_DEVICE_SLOT_INTERFACE(sx1541_iec_devices, "sx1541", false) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pal_c ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( pal_c, pal, c64c_state ) - MCFG_SOUND_REPLACE(MOS6581_TAG, MOS8580, XTAL_17_734472MHz/18) - MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pal_gs ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pal_gs, c64gs_state ) - // basic hardware - MCFG_CPU_ADD(M6510_TAG, M6510, XTAL_17_734472MHz/18) - MCFG_CPU_PROGRAM_MAP(c64_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_M6510_PORT_CALLBACKS(READ8(c64gs_state, cpu_r), WRITE8(c64gs_state, cpu_w)) - MCFG_M6510_PORT_PULLS(0x07, 0xc0) - MCFG_QUANTUM_PERFECT_CPU(M6510_TAG) - - // video hardware - MCFG_DEVICE_ADD(MOS6569_TAG, MOS8565, XTAL_17_734472MHz/18) - MCFG_MOS6566_CPU(M6510_TAG) - MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(c64_state, vic_irq_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) - MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) - MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) - MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DEVICE(MOS6569_TAG, mos8565_device, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS8580, XTAL_17_734472MHz/18) - MCFG_MOS6581_POTX_CALLBACK(READ8(c64_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c64_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_PLS100_ADD(PLA_TAG) - MCFG_DEVICE_ADD(MOS6526_1_TAG, MOS6526, XTAL_17_734472MHz/18) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia1_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64gs_state, cia1_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64gs_state, cia1_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pb_w)) - MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz/18) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c64_state, cia2_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia2_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia2_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia2_pb_w)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) - MCFG_CBM_IEC_ADD(NULL) - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, flag_w)) - MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_9)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") - MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, XTAL_17_734472MHz/18, c64_expansion_cards, NULL) - MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(c64_state, exp_irq_w)) - MCFG_C64_EXPANSION_SLOT_NMI_CALLBACK(WRITELINE(c64_state, exp_nmi_w)) - MCFG_C64_EXPANSION_SLOT_RESET_CALLBACK(WRITELINE(c64_state, exp_reset_w)) - MCFG_C64_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(c64_state, read)) - MCFG_C64_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(c64_state, write)) - MCFG_C64_EXPANSION_SLOT_DMA_CALLBACK(WRITELINE(c64_state, exp_dma_w)) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, c64_user_port_cards, NULL) - MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(c64_state, exp_reset_w)) - MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6526_1_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, cnt_w)) - MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, sp_w)) - MCFG_PET_USER_PORT_9_HANDLER(DEVWRITELINE(CBM_IEC_TAG, cbm_iec_device, atn_w)) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6526_2_TAG, mos6526_device, flag_w)) - MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(c64_state, write_user_pb0)) - MCFG_PET_USER_PORT_D_HANDLER(WRITELINE(c64_state, write_user_pb1)) - MCFG_PET_USER_PORT_E_HANDLER(WRITELINE(c64_state, write_user_pb2)) - MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(c64_state, write_user_pb3)) - MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(c64_state, write_user_pb4)) - MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(c64_state, write_user_pb5)) - MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(c64_state, write_user_pb6)) - MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(c64_state, write_user_pb7)) - MCFG_PET_USER_PORT_M_HANDLER(WRITELINE(c64_state, write_user_pa2)) - - MCFG_QUICKLOAD_ADD("quickload", c64_state, cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list_vic10", "vic10") - MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart") - MCFG_SOFTWARE_LIST_FILTER("cart_list_vic10", "PAL") - MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "PAL") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( c64 ) -//------------------------------------------------- - -ROM_START( c64 ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_DEFAULT_BIOS("r3") - ROM_SYSTEM_BIOS(0, "r1", "Kernal rev. 1" ) - ROMX_LOAD( "901227-01.u4", 0x0000, 0x2000, CRC(dce782fa) SHA1(87cc04d61fc748b82df09856847bb5c2754a2033), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "r2", "Kernal rev. 2" ) - ROMX_LOAD( "901227-02.u4", 0x0000, 0x2000, CRC(a5c687b3) SHA1(0e2e4ee3f2d41f00bed72f9ab588b83e306fdb13), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "r3", "Kernal rev. 3" ) - ROMX_LOAD( "901227-03.u4", 0x0000, 0x2000, CRC(dbe3e7c7) SHA1(1d503e56df85a62fee696e7618dc5b4e781df1bb), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "jiffydos", "JiffyDOS v6.01" ) - ROMX_LOAD( "jiffydos c64.u4", 0x0000, 0x2000, CRC(2f79984c) SHA1(31e73e66eccb28732daea8ec3ad1addd9b39a017), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS(4, "speeddos", "SpeedDOS" ) - ROMX_LOAD( "speed-dos.u4", 0x0000, 0x2000, CRC(5beb9ac8) SHA1(8896c8de9e26ef1396eb46020b2de346a3eeab7e), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS(5, "speeddos20", "SpeedDOS-Plus+ v2.0" ) - ROMX_LOAD( "speed-dosplus.u4", 0x0000, 0x2000, CRC(10aee0ae) SHA1(6cebd4dc0c5e8c0b073586a3f1c43cc3349b9736), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS(6, "speeddos27", "SpeedDOS-Plus+ v2.7" ) - ROMX_LOAD( "speed-dosplus27.u4", 0x0000, 0x2000, CRC(ff59995e) SHA1(c8d864e5fc7089af8afce97dc0a0224df11df1c3), ROM_BIOS(7) ) - ROM_SYSTEM_BIOS(7, "prodos", "Professional-DOS v1" ) - ROMX_LOAD( "prodos.u4", 0x0000, 0x2000, CRC(37ed83a2) SHA1(35f4f0fe03c0b7b3762b526ba855de41b496fb60), ROM_BIOS(8) ) - ROM_SYSTEM_BIOS(8, "prodos2", "Professional-DOS Release 2/4L2" ) - ROMX_LOAD( "prodos24l2.u4", 0x0000, 0x2000, CRC(41dad9fe) SHA1(fbf3dcc2ed40e58b07595740ea6fbff7ab19ebad), ROM_BIOS(9) ) - ROM_SYSTEM_BIOS(9, "prodos3", "Professional-DOS Release 3/5L2" ) - ROMX_LOAD( "prodos35l2.u4", 0x0000, 0x2000, CRC(2822eee7) SHA1(77356b84c1648018863d1c8dd5bc3a37485bc00e), ROM_BIOS(10) ) - ROM_SYSTEM_BIOS(10, "turborom", "Cockroach Turbo-ROM" ) - ROMX_LOAD( "turborom.u4", 0x0000, 0x2000, CRC(e6c763a2) SHA1(eff5a4b6bc65daa9421bd3856dd99a3195068e1c), ROM_BIOS(11) ) - ROM_SYSTEM_BIOS(11, "dosrom", "DOS-ROM v1.2" ) - ROMX_LOAD( "dosrom12.u4", 0x0000, 0x2000, CRC(ac030fc0) SHA1(0e4b38e81b49f55d52162154a44f0fffd2b0d04f), ROM_BIOS(12) ) - ROM_SYSTEM_BIOS(12, "turborom2", "Datel Turbo ROM II (PAL)" ) - ROMX_LOAD( "turborom2.u4", 0x0000, 0x2000, CRC(ea3ba683) SHA1(4bb23f764a3d255119fbae37202ca820caa04e1f), ROM_BIOS(13) ) - ROM_SYSTEM_BIOS(13, "mercury", "Mercury-ROM v3 (NTSC)" ) - ROMX_LOAD( "mercury3.u4", 0x0000, 0x2000, CRC(6eac46a2) SHA1(4e351aa5fcb97c4c21e565aa2c830cc09bd47533), ROM_BIOS(14) ) - ROM_SYSTEM_BIOS(14, "dolphin", "Dolphin-DOS 1.0" ) - ROMX_LOAD( "kernal-10-mager.u4", 0x0000, 0x2000, CRC(c9bb21bc) SHA1(e305216e50ff8a7acf102be6c6343e3d44a16233), ROM_BIOS(15) ) - ROM_SYSTEM_BIOS(15, "dolphin201au", "Dolphin-DOS 2.0 1 au" ) - ROMX_LOAD( "kernal-20-1_au.u4", 0x0000, 0x2000, CRC(7068bbcc) SHA1(325ce7e32609a8fc704aaa76f5eb4cd7d8099a92), ROM_BIOS(16) ) - ROM_SYSTEM_BIOS(16, "dolphin201", "Dolphin-DOS 2.0 1" ) - ROMX_LOAD( "kernal-20-1.u4", 0x0000, 0x2000, CRC(c9c4c44e) SHA1(7f5d8f08c5ed2182ffb415a3d777fdd922496d02), ROM_BIOS(17) ) - ROM_SYSTEM_BIOS(17, "dolphin202", "Dolphin-DOS 2.0 2" ) - ROMX_LOAD( "kernal-20-2.u4", 0x0000, 0x2000, CRC(ffaeb9bc) SHA1(5f6c1bad379da16f77bccb58e80910f307dfd5f8), ROM_BIOS(18) ) - ROM_SYSTEM_BIOS(18, "dolphin203", "Dolphin-DOS 2.0 3" ) - ROMX_LOAD( "kernal-20-3.u4", 0x0000, 0x2000, CRC(4fd511f2) SHA1(316fba280dcb29496d593c0c4e3ee9a19844054e), ROM_BIOS(19) ) - ROM_SYSTEM_BIOS(19, "dolphin30", "Dolphin-DOS 3.0" ) - ROMX_LOAD( "kernal-30.u4", 0x0000, 0x2000, CRC(5402d643) SHA1(733acb96fead2fb4df77840c5bb618f08439fc7e), ROM_BIOS(20) ) - ROM_SYSTEM_BIOS(20, "taccess", "TurboAccess v2.6" ) - ROMX_LOAD( "turboaccess26.u4", 0x0000, 0x2000, CRC(93de6cd9) SHA1(a74478f3b9153c13176eac80ebfacc512ae7cbf0), ROM_BIOS(21) ) - ROM_SYSTEM_BIOS(21, "ttrans301", "TurboTrans v3.0 1" ) - ROMX_LOAD( "turboaccess301.u4", 0x0000, 0x2000, CRC(b3304dcf) SHA1(4d47a265ef65e4823f862cfc3d514c2a71473580), ROM_BIOS(22) ) - ROM_SYSTEM_BIOS(22, "ttrans302", "TurboTrans v3.0 2" ) - ROMX_LOAD( "turboaccess302.u4", 0x0000, 0x2000, CRC(9e696a7b) SHA1(5afae75d66d539f4bb4af763f029f0ef6523a4eb), ROM_BIOS(23) ) - ROM_SYSTEM_BIOS(23, "tprocess", "Turbo-Process (PAL)" ) - ROMX_LOAD( "turboprocess.u4", 0x0000, 0x2000, CRC(e5610d76) SHA1(e3f35777cfd16cce4717858f77ff354763395ba9), ROM_BIOS(24) ) - ROM_SYSTEM_BIOS(24, "tprocessn", "Turbo-Process (NTSC)" ) - ROMX_LOAD( "turboprocessus.u4", 0x0000, 0x2000, CRC(7480b76a) SHA1(ef1664b5057ae3cc6d104fc2f5c1fb29ee5a1b2b), ROM_BIOS(25) ) - ROM_SYSTEM_BIOS(25, "exos3", "EXOS v3" ) - ROMX_LOAD( "exos3.u4", 0x0000, 0x2000, CRC(4e54d020) SHA1(f8931b7c0b26807f4de0cc241f0b1e2c8f5271e9), ROM_BIOS(26) ) - ROM_SYSTEM_BIOS(26, "exos4", "EXOS v4" ) - ROMX_LOAD( "exos4.u4", 0x0000, 0x2000, CRC(d5cf83a9) SHA1(d5f03a5c0e9d00032d4751ecc6bcd6385879c9c7), ROM_BIOS(27) ) - ROM_SYSTEM_BIOS(27, "digidos", "DigiDOS" ) - ROMX_LOAD( "digidos.u4", 0x0000, 0x2000, CRC(2b0c8e89) SHA1(542d6f61c318bced0642e7c2d4d3b34a0f13e634), ROM_BIOS(28) ) - ROM_SYSTEM_BIOS(28, "magnum", "Magnum Load" ) - ROMX_LOAD( "magnum.u4", 0x0000, 0x2000, CRC(b2cffcc6) SHA1(827c782c1723b5d0992c05c00738ae4b2133b641), ROM_BIOS(29) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "906114-01.u17", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( c64_jp ) -//------------------------------------------------- - -ROM_START( c64_jp ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "906145-02.u4", 0x0000, 0x2000, CRC(3a9ef6f1) SHA1(4ff0f11e80f4b57430d8f0c3799ed0f0e0f4565d) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "906143-02.u5", 0x0000, 0x1000, CRC(1604f6c1) SHA1(0fad19dbcdb12461c99657b2979dbb5c2e47b527) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "906114-01.u17", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( c64p ) -//------------------------------------------------- - -#define rom_c64p rom_c64 - - -//------------------------------------------------- -// ROM( c64_se ) -//------------------------------------------------- - -ROM_START( c64_se ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "kernel.u4", 0x0000, 0x2000, CRC(f10c2c25) SHA1(e4f52d9b36c030eb94524eb49f6f0774c1d02e5e) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_SYSTEM_BIOS( 0, "default", "Swedish Characters" ) - ROMX_LOAD( "charswe.u5", 0x0000, 0x1000, CRC(bee9b3fd) SHA1(446ae58f7110d74d434301491209299f66798d8a), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "alt", "Swedish Characters (Alt)" ) - ROMX_LOAD( "charswe2.u5", 0x0000, 0x1000, CRC(377a382b) SHA1(20df25e0ba1c88f31689c1521397c96968967fac), ROM_BIOS(2) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "906114-01.u17", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( pet64 ) -//------------------------------------------------- - -ROM_START( pet64 ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "901246-01.u4", 0x0000, 0x2000, CRC(789c8cc5) SHA1(6c4fa9465f6091b174df27dfe679499df447503c) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "906114-01.u17", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( edu64 ) -//------------------------------------------------- - -#define rom_edu64 rom_c64 - - -//------------------------------------------------- -// ROM( sx64 ) -//------------------------------------------------- - -ROM_START( sx64 ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901226-01.ud4", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_SYSTEM_BIOS(0, "cbm", "Original" ) - ROMX_LOAD( "251104-04.ud3", 0x0000, 0x2000, CRC(2c5965d4) SHA1(aa136e91ecf3c5ac64f696b3dbcbfc5ba0871c98), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "jiffydos", "JiffyDOS v6.01" ) - ROMX_LOAD( "jiffydos sx64.ud3", 0x0000, 0x2000, CRC(2b5a88f5) SHA1(942c2150123dc30f40b3df6086132ef0a3c43948), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "1541flash", "1541 FLASH!" ) - ROMX_LOAD( "1541 flash.ud3", 0x0000, 0x2000, CRC(0a1c9b85) SHA1(0bfcaab0ae453b663a6e01cd59a9764805419e00), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "turborom", "Cockroach Turbo-ROM" ) - ROMX_LOAD( "turboromsx.u4", 0x0000, 0x2000, CRC(48579c30) SHA1(6c907fdd07c14e162eb8c8fb750b1bbaf69dccb4), ROM_BIOS(4) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901225-01.ud1", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "906114-01.ue4", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( rom_sx64p ) -//------------------------------------------------- - -#define rom_sx64p rom_sx64 - - -//------------------------------------------------- -// ROM( vip64 ) -//------------------------------------------------- - -ROM_START( vip64 ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901226-01.ud4", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "kernelsx.ud3", 0x0000, 0x2000, CRC(7858d3d7) SHA1(097cda60469492a8916c2677b7cce4e12a944bc0) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "charswe.ud1", 0x0000, 0x1000, CRC(bee9b3fd) SHA1(446ae58f7110d74d434301491209299f66798d8a) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "906114-01.ue4", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( dx64 ) -//------------------------------------------------- - -// ROM_LOAD( "dx64kern.bin", 0x0000, 0x2000, CRC(58065128) ) TODO where is this illusive ROM? -#define rom_dx64 rom_sx64 - - -//------------------------------------------------- -// ROM( tesa6240 ) -//------------------------------------------------- - -ROM_START( tesa6240 ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "tesa-basic.ud4", 0x0000, 0x2000, CRC(f319d661) SHA1(0033afa7d2fbff314d80427324633c5444fbf1cd) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "tesa-kernal.ud3", 0x0000, 0x2000, CRC(af638f9c) SHA1(a2c9c83f598623c9940949979ac643f12397e907) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "tesa-char.ud1", 0x0000, 0x1000, CRC(10765a90) SHA1(1b824df5a295d0479e830e272758640b9fe99344) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "906114-01.ue4", 0x00, 0xf5, CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( c64c ) -//------------------------------------------------- - -ROM_START( c64c ) - ROM_REGION( 0x4000, "kernal", 0 ) - ROM_DEFAULT_BIOS("cbm") - ROM_SYSTEM_BIOS(0, "cbm", "Original" ) - ROMX_LOAD( "251913-01.u4", 0x0000, 0x4000, CRC(0010ec31) SHA1(765372a0e16cbb0adf23a07b80f6b682b39fbf88), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "pdc", "ProLogic-DOS Classic" ) - ROMX_LOAD( "pdc.u4", 0x0000, 0x4000, CRC(6b653b9c) SHA1(0f44a9c62619424a0cd48a90e1b377b987b494e0), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "252715-01.u8", 0x00, 0xf5, BAD_DUMP CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( c64cp ) -//------------------------------------------------- - -#define rom_c64cp rom_c64c - - -//------------------------------------------------- -// ROM( c64g ) -//------------------------------------------------- - -#define rom_c64g rom_c64c - - -//------------------------------------------------- -// ROM( c64c_es ) -//------------------------------------------------- - -ROM_START( c64c_es ) - ROM_REGION( 0x4000, "kernal", 0 ) - ROM_LOAD( "251913-01.u4", 0x0000, 0x4000, CRC(0010ec31) SHA1(765372a0e16cbb0adf23a07b80f6b682b39fbf88) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "325056-03.u5", 0x0000, 0x1000, CRC(c890c175) SHA1(4f57259fff9ef1963a4e87165a6f35ca23864c76) ) // aka 325245-01 - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "252715-01.u8", 0x00, 0xf5, BAD_DUMP CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( c64c_se ) -//------------------------------------------------- - -ROM_START( c64c_se ) - ROM_REGION( 0x4000, "kernal", 0 ) - ROM_LOAD( "325182-01.u4", 0x0000, 0x4000, CRC(2aff27d3) SHA1(267654823c4fdf2167050f41faa118218d2569ce) ) // 128/64 FI - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "cbm 64 skand.gen.u5", 0x0000, 0x1000, CRC(377a382b) SHA1(20df25e0ba1c88f31689c1521397c96968967fac) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "252715-01.u8", 0x00, 0xf5, BAD_DUMP CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - -//------------------------------------------------- -// ROM( c64gs ) -//------------------------------------------------- - -ROM_START( c64gs ) - ROM_REGION( 0x4000, "kernal", 0 ) - ROM_LOAD( "390852-01.u4", 0x0000, 0x4000, CRC(b0a9c2da) SHA1(21940ef5f1bfe67d7537164f7ca130a1095b067a) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "252535-01.u8", 0x00, 0xf5, BAD_DUMP CRC(54c89351) SHA1(efb315f560b6f72444b8f0b2ca4b0ccbcd144a1b) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1982, c64, 0, 0, ntsc, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1982, c64_jp, c64, 0, ntsc, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64 (Japan)", MACHINE_SUPPORTS_SAVE ) -COMP( 1982, c64p, c64, 0, pal, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64 (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1982, c64_se, c64, 0, pal, c64sw, driver_device, 0, "Commodore Business Machines", "Commodore 64 / VIC-64S (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, pet64, c64, 0, pet64, c64, driver_device, 0, "Commodore Business Machines", "PET 64 / CBM 4064 (NTSC)", MACHINE_SUPPORTS_SAVE | MACHINE_WRONG_COLORS ) -COMP( 1983, edu64, c64, 0, pet64, c64, driver_device, 0, "Commodore Business Machines", "Educator 64 (NTSC)", MACHINE_SUPPORTS_SAVE | MACHINE_WRONG_COLORS ) -COMP( 1984, sx64, c64, 0, ntsc_sx, c64, driver_device, 0, "Commodore Business Machines", "SX-64 / Executive 64 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, sx64p, c64, 0, pal_sx, c64, driver_device, 0, "Commodore Business Machines", "SX-64 / Executive 64 (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, vip64, c64, 0, pal_sx, c64sw, driver_device, 0, "Commodore Business Machines", "VIP-64 (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, dx64, c64, 0, ntsc_dx, c64, driver_device, 0, "Commodore Business Machines", "DX-64 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, tesa6240,c64, 0, pal_sx, c64, driver_device, 0, "Tesa Etikett", "Etikettendrucker 6240", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, c64c, c64, 0, ntsc_c, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64C (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, c64cp, c64, 0, pal_c, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64C (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1988, c64c_es, c64, 0, pal_c, c64sw, driver_device, 0, "Commodore Business Machines", "Commodore 64C (Spain)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, c64c_se, c64, 0, pal_c, c64sw, driver_device, 0, "Commodore Business Machines", "Commodore 64C (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, c64g, c64, 0, pal_c, c64, driver_device, 0, "Commodore Business Machines", "Commodore 64G (PAL)", MACHINE_SUPPORTS_SAVE ) -CONS( 1990, c64gs, c64, 0, pal_gs, c64gs, driver_device, 0, "Commodore Business Machines", "Commodore 64 Games System (PAL)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/c64dtv.c b/src/mess/drivers/c64dtv.c deleted file mode 100644 index 4b707dfa585..00000000000 --- a/src/mess/drivers/c64dtv.c +++ /dev/null @@ -1,68 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "emu.h" - - -//************************************************************************** -// DRIVER STATE -//************************************************************************** - -class c64dtv_state : public driver_device -{ -public: - // constructor - c64dtv_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) - { - bitmap.fill(rgb_t::black); - return 0; - } -}; - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -static INPUT_PORTS_START( c64dtv ) -INPUT_PORTS_END - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static MACHINE_CONFIG_START( c64dtv, c64dtv_state ) - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(c64dtv_state, screen_update) - MCFG_SCREEN_SIZE(640,480) - MCFG_SCREEN_VISIBLE_AREA(0,639, 0,479) - MCFG_SCREEN_REFRESH_RATE(30) -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -// BASIC sits at 0xa000-0xc000, chargen-like chunks sit at 0x1000-0x2000, 0x9000-0xa000 and 0xd000-0xe000 -// kernel sits at 0xe000 -// from 0x10000 on there are the games -ROM_START( c64dtv ) - ROM_REGION( 0x200000, "asic", 0 ) - ROM_LOAD( "flash.u2", 0x000000, 0x200000, CRC(b820375a) SHA1(b9f88919e2bed825eb2b2cb605977d55971b423b) ) -ROM_END - - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -CONS( 2005, c64dtv, 0, 0, c64dtv, c64dtv, driver_device, 0, "The Toy:Lobster Company", "Commodore 64 Direct-to-TV (Version 2 050711) (PAL)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/c65.c b/src/mess/drivers/c65.c deleted file mode 100644 index f2160b9e2cd..00000000000 --- a/src/mess/drivers/c65.c +++ /dev/null @@ -1,669 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders: Angelo Salese -/*************************************************************************** - -C=65 / C=64DX (c) 1991 Commodore - -Attempt at rewriting the driver ... - -TODO: -- I need to subtract border color to -1 in order to get blue color (-> register is 6 and blue color is 5 in palette array). - Also top-left logo seems to draw wrong palette for entries 4,5,6,7. CPU core bug? - -Note: -- VIC-4567 will be eventually be added via compile switch, once that I - get the hang of the system (and checking where the old code fails - eventually) - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/m6502/m4510.h" -#include "machine/mos6526.h" - -#define MAIN_CLOCK XTAL_3_5MHz - -class c65_state : public driver_device -{ -public: - c65_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cia0(*this, "cia_0"), - m_cia1(*this, "cia_1"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_workram(*this, "wram"), - m_palred(*this, "redpal"), - m_palgreen(*this, "greenpal"), - m_palblue(*this, "bluepal"), - m_dmalist(*this, "dmalist"), - m_cram(*this, "cram"), - m_gfxdecode(*this, "gfxdecode") - { } - - // devices - required_device m_maincpu; - required_device m_cia0; - required_device m_cia1; - required_device m_screen; - required_device m_palette; - required_shared_ptr m_workram; - required_shared_ptr m_palred; - required_shared_ptr m_palgreen; - required_shared_ptr m_palblue; - required_shared_ptr m_dmalist; - required_shared_ptr m_cram; - required_device m_gfxdecode; - - UINT8 *m_iplrom; - UINT8 m_keyb_input[10]; - UINT8 m_keyb_mux; - - DECLARE_READ8_MEMBER(vic4567_dummy_r); - DECLARE_WRITE8_MEMBER(vic4567_dummy_w); - DECLARE_WRITE8_MEMBER(PalRed_w); - DECLARE_WRITE8_MEMBER(PalGreen_w); - DECLARE_WRITE8_MEMBER(PalBlue_w); - DECLARE_WRITE8_MEMBER(DMAgic_w); - DECLARE_READ8_MEMBER(CIASelect_r); - DECLARE_WRITE8_MEMBER(CIASelect_w); - DECLARE_READ8_MEMBER(cia0_porta_r); - DECLARE_WRITE8_MEMBER(cia0_porta_w); - DECLARE_READ8_MEMBER(cia0_portb_r); - DECLARE_WRITE8_MEMBER(cia0_portb_w); - DECLARE_WRITE_LINE_MEMBER(cia0_irq); - - DECLARE_READ8_MEMBER(dummy_r); - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_PALETTE_INIT(c65); - DECLARE_DRIVER_INIT(c65); - DECLARE_DRIVER_INIT(c65pal); - - INTERRUPT_GEN_MEMBER(vic3_vblank_irq); -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); -private: - UINT8 m_VIC2_IRQPend, m_VIC2_IRQMask; - /* 0x20: border color (TODO: different thread?) */ - UINT8 m_VIC2_EXTColor; - /* 0x30: banking + PAL + EXT SYNC */ - UINT8 m_VIC3_ControlA; - /* 0x31: video modes */ - UINT8 m_VIC3_ControlB; - void PalEntryFlush(UINT8 offset); - void DMAgicExecute(address_space &space,UINT32 address); - void IRQCheck(UINT8 irq_cause); - int inner_x_char(int xoffs); - int inner_y_char(int yoffs); -}; - -void c65_state::video_start() -{ -} - -// TODO: inline? -int c65_state::inner_x_char(int xoffs) -{ - return xoffs>>3; -} - -int c65_state::inner_y_char(int yoffs) -{ - return yoffs>>3; -} - -UINT32 c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - int y,x; - int border_color = m_VIC2_EXTColor & 0xf; - - // TODO: border area - for(y=0;yheight();y++) - { - for(x=0;xwidth();x++) - { - //int, xi,yi,xm,ym,dot_x; - int xi = inner_x_char(x); - int yi = inner_y_char(y); - int xm = 7 - (x & 7); - int ym = (y & 7); - UINT8 tile = m_workram[xi+yi*80+0x800]; - UINT8 attr = m_cram[xi+yi*80]; - if(attr & 0xf0) - attr = machine().rand() & 0xf; - - int enable_dot = ((m_iplrom[(tile<<3)+ym+0xd000] >> xm) & 1); - - //if(cliprect.contains(x, y)) - bitmap.pix16(y, x) = m_palette->pen((enable_dot) ? attr & 0xf : border_color); - - - //gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); - } - } - - return 0; -} - -READ8_MEMBER(c65_state::vic4567_dummy_r) -{ - UINT8 res; - - res=0xff; - switch(offset) - { - case 0x11: - res = (m_screen->vpos() & 0x100) >> 1; - return res; - case 0x12: - res = (m_screen->vpos() & 0xff); - return res; - case 0x15: - return 0xff; // silence log for now - case 0x19: - return m_VIC2_IRQPend; - - case 0x1a: - return m_VIC2_IRQMask; - - case 0x20: - return m_VIC2_EXTColor; - - case 0x30: - return m_VIC3_ControlA; - case 0x31: - return m_VIC3_ControlB; - } - - if(!space.debugger_access()) - printf("%02x\n",offset); // TODO: PC - return res; -} - -WRITE8_MEMBER(c65_state::vic4567_dummy_w) -{ - switch(offset) - { - case 0x19: - m_VIC2_IRQPend &= ~data; - IRQCheck(0); - break; - case 0x1a: - m_VIC2_IRQMask = data & 0xf; - IRQCheck(0); - break; - case 0x20: - m_VIC2_EXTColor = data & 0xf; - break; - /* KEY register, handles vic-iii and vic-ii modes via two consecutive writes - 0xa5 -> 0x96 vic-iii mode - any other write vic-ii mode - */ - //case 0x2f: break; - case 0x30: - if((data & 0xfe) != 0x64) - printf("CONTROL A %02x\n",data); - m_VIC3_ControlA = data; - break; - case 0x31: - printf("CONTROL B %02x\n",data); - m_VIC3_ControlB = data; - break; - default: - if(!space.debugger_access()) - printf("%02x %02x\n",offset,data); - break; - } - -} - -void c65_state::PalEntryFlush(UINT8 offset) -{ - m_palette->set_pen_color(offset, pal4bit(m_palred[offset]), pal4bit(m_palgreen[offset]), pal4bit(m_palblue[offset])); -} - -WRITE8_MEMBER(c65_state::PalRed_w) -{ - m_palred[offset] = data; - PalEntryFlush(offset); -} - -WRITE8_MEMBER(c65_state::PalGreen_w) -{ - m_palgreen[offset] = data; - PalEntryFlush(offset); -} - -WRITE8_MEMBER(c65_state::PalBlue_w) -{ - m_palblue[offset] = data; - PalEntryFlush(offset); -} - -void c65_state::DMAgicExecute(address_space &space,UINT32 address) -{ - UINT8 cmd;// = space.read_byte(address++); - UINT16 length; //= space.read_byte(address++); - UINT32 src, dst; - static const char *const dma_cmd_string[] = - { - "COPY", // 0 - "MIX", - "SWAP", - "FILL" - }; - cmd = space.read_byte(address++); - length = space.read_byte(address++); - length|=(space.read_byte(address++)<<8); - src = space.read_byte(address++); - src|=(space.read_byte(address++)<<8); - src|=(space.read_byte(address++)<<16); - dst = space.read_byte(address++); - dst|=(space.read_byte(address++)<<8); - dst|=(space.read_byte(address++)<<16); - - if(cmd & 0xfc) - printf("%02x\n",cmd & 0xfc); - switch(cmd & 3) - { - case 0: // copy - TODO: untested - { - if(length != 1) - printf("DMAgic %s %02x -> %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src,dst,length,cmd & 4 ? "yes" : "no"); - UINT32 SourceIndex; - UINT32 DestIndex; - UINT16 SizeIndex; - SourceIndex = src & 0xfffff; - DestIndex = dst & 0xfffff; - SizeIndex = length; - do - { - space.write_byte(DestIndex++,space.read_byte(SourceIndex++)); - SizeIndex--; - }while(SizeIndex != 0); - - return; - } - case 3: // fill - { - /* TODO: upper bits of source */ - printf("DMAgic %s %02x -> %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src & 0xff,dst,length,cmd & 4 ? "yes" : "no"); - UINT8 FillValue; - UINT32 DestIndex; - UINT16 SizeIndex; - FillValue = src & 0xff; - DestIndex = dst & 0xfffff; - SizeIndex = length; - do - { - space.write_byte(DestIndex++,FillValue); - SizeIndex--; - }while(SizeIndex != 0); - } - return; - } - printf("DMAgic %s %08x %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src,dst,length,cmd & 4 ? "yes" : "no"); -} - - -WRITE8_MEMBER(c65_state::DMAgic_w) -{ - m_dmalist[offset] = data; - if(offset == 0) - DMAgicExecute(space,(m_dmalist[0])|(m_dmalist[1]<<8)|(m_dmalist[2]<<16)); -} - -READ8_MEMBER(c65_state::CIASelect_r) -{ - if(m_VIC3_ControlA & 1) - return m_cram[offset]; - else - { - // CIA at 0xdc00 - switch((offset & 0x700) | 0x800) - { - case 0xc00: - return m_cia0->read(space,offset); - case 0xd00: - return m_cia1->read(space,offset); - default: - printf("Unknown I/O access read to offset %04x\n",offset); - break; - } - - } - - return 0xff; -} - -WRITE8_MEMBER(c65_state::CIASelect_w) -{ - if(m_VIC3_ControlA & 1) - m_cram[offset] = data; - else - { - // CIA at 0xdc00 - switch((offset & 0x700) | 0x800) - { - case 0xc00: - m_cia0->write(space,offset,data); - break; - - case 0xd00: - m_cia1->write(space,offset,data); - break; - default: - printf("Unknown I/O access write to offset %04x data = %02x\n",offset,data); - break; - } - } - -} - -READ8_MEMBER(c65_state::cia0_porta_r) -{ - return 0xff; -} - -READ8_MEMBER(c65_state::cia0_portb_r) -{ - static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; - UINT8 res; - - res = 0xff; - for(int i=0;i<8;i++) - { - m_keyb_input[i] = machine().root_device().ioport(c64ports[i])->read(); - - if(m_keyb_mux & 1 << (i)) - res &= m_keyb_input[i]; - } - - return res; -} - -WRITE8_MEMBER(c65_state::cia0_porta_w) -{ - m_keyb_mux = ~data; - printf("%02x\n",m_keyb_mux); -} - -WRITE8_MEMBER(c65_state::cia0_portb_w) -{ -} - -READ8_MEMBER(c65_state::dummy_r) -{ - return 0; -} - -static ADDRESS_MAP_START( c65_map, AS_PROGRAM, 8, c65_state ) - AM_RANGE(0x00000, 0x07fff) AM_RAM AM_SHARE("wram") // TODO: bank - AM_RANGE(0x0c800, 0x0cfff) AM_ROM AM_REGION("maincpu", 0xc800) - AM_RANGE(0x0d000, 0x0d07f) AM_READWRITE(vic4567_dummy_r,vic4567_dummy_w) // 0x0d000, 0x0d07f VIC-4567 - AM_RANGE(0x0d080, 0x0d081) AM_READ(dummy_r) // 0x0d080, 0x0d09f FDC - // 0x0d0a0, 0x0d0ff Ram Expansion Control (REC) - AM_RANGE(0x0d100, 0x0d1ff) AM_RAM_WRITE(PalRed_w) AM_SHARE("redpal")// 0x0d100, 0x0d1ff Red Palette - AM_RANGE(0x0d200, 0x0d2ff) AM_RAM_WRITE(PalGreen_w) AM_SHARE("greenpal") // 0x0d200, 0x0d2ff Green Palette - AM_RANGE(0x0d300, 0x0d3ff) AM_RAM_WRITE(PalBlue_w) AM_SHARE("bluepal") // 0x0d300, 0x0d3ff Blue Palette - // 0x0d400, 0x0d4*f Right SID - // 0x0d440, 0x0d4*f Left SID - AM_RANGE(0x0d600, 0x0d6ff) AM_RAM // 0x0d600, 0x0d6** UART - AM_RANGE(0x0d700, 0x0d702) AM_WRITE(DMAgic_w) AM_SHARE("dmalist") // 0x0d700, 0x0d7** DMAgic - //AM_RANGE(0x0d703, 0x0d703) AM_READ(DMAgic_r) - // 0x0d800, 0x0d8** Color matrix - AM_RANGE(0x0d800, 0x0dfff) AM_READWRITE(CIASelect_r,CIASelect_w) AM_SHARE("cram") - // 0x0dc00, 0x0dc** CIA-1 - // 0x0dd00, 0x0dd** CIA-2 - // 0x0de00, 0x0de** Ext I/O Select 1 - // 0x0df00, 0x0df** Ext I/O Select 2 (RAM window?) - AM_RANGE(0x0e000, 0x0ffff) AM_ROM AM_REGION("maincpu",0x0e000) - AM_RANGE(0x10000, 0x1f7ff) AM_RAM - AM_RANGE(0x1f800, 0x1ffff) AM_RAM // VRAM attributes - AM_RANGE(0x20000, 0x3ffff) AM_ROM AM_REGION("maincpu",0) -ADDRESS_MAP_END - - - -static INPUT_PORTS_START( c65 ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - -INPUT_PORTS_END - - -void c65_state::machine_start() -{ - m_iplrom = memregion("maincpu")->base(); - - save_pointer(NAME(m_cram.target()), 0x800); -} - -void c65_state::machine_reset() -{ -} - - -PALETTE_INIT_MEMBER(c65_state, c65) -{ - // TODO: initial state? -} - -static const gfx_layout charlayout = -{ - 8,8, - 0x1000/8, - 1, - { RGN_FRAC(0,1) }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( c65 ) - GFXDECODE_ENTRY( "maincpu", 0xd000, charlayout, 0, 16 ) // another identical copy is at 0x9000 -GFXDECODE_END - -void c65_state::IRQCheck(UINT8 irq_cause) -{ - m_VIC2_IRQPend |= (irq_cause != 0) ? 0x80 : 0x00; - m_VIC2_IRQPend |= irq_cause; - - m_maincpu->set_input_line(M4510_IRQ_LINE,m_VIC2_IRQMask & m_VIC2_IRQPend ? ASSERT_LINE : CLEAR_LINE); -} - -INTERRUPT_GEN_MEMBER(c65_state::vic3_vblank_irq) -{ - IRQCheck(1); - //if(m_VIC2_IRQMask & 1) - // m_maincpu->set_input_line(M4510_IRQ_LINE,HOLD_LINE); -} - -WRITE_LINE_MEMBER(c65_state::cia0_irq) -{ - printf("%d IRQ\n",state); - -#if 0 - if(state) - { - static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; - for(int i=0;i<8;i++) - m_keyb_input[i] = machine().root_device().ioport(c64ports[i])->read(); - } -#endif -// m_cia0_irq = state; -// c65_irq(state || m_vicirq); -} - -static MACHINE_CONFIG_START( c65, c65_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M4510,MAIN_CLOCK) - MCFG_CPU_PROGRAM_MAP(c65_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen",c65_state,vic3_vblank_irq) - - MCFG_DEVICE_ADD("cia_0", MOS6526, MAIN_CLOCK) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, cia0_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, cia0_porta_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c65_state, cia0_porta_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c65_state, cia0_portb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c65_state, cia0_portb_w)) - - MCFG_DEVICE_ADD("cia_1", MOS6526, MAIN_CLOCK) - MCFG_MOS6526_TOD(60) -// MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, c65_cia1_interrupt)) -// MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, c65_cia1_port_a_r)) -// MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c65_state, c65_cia1_port_a_w)) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(60) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(c65_state, screen_update) -// MCFG_SCREEN_SIZE(32*8, 32*8) -// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK*4, 910, 0, 640, 262, 0, 200) // mods needed - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", c65) - - MCFG_PALETTE_ADD("palette", 0x100) - MCFG_PALETTE_INIT_OWNER(c65_state, c65) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "c65_flop") -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( c65 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "910111", "V0.9.910111" ) - ROMX_LOAD( "910111.bin", 0x0000, 0x20000, CRC(c5d8d32e) SHA1(71c05f098eff29d306b0170e2c1cdeadb1a5f206), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "910523", "V0.9.910523" ) - ROMX_LOAD( "910523.bin", 0x0000, 0x20000, CRC(e8235dd4) SHA1(e453a8e7e5b95de65a70952e9d48012191e1b3e7), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "910626", "V0.9.910626" ) - ROMX_LOAD( "910626.bin", 0x0000, 0x20000, CRC(12527742) SHA1(07c185b3bc58410183422f7ac13a37ddd330881b), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "910828", "V0.9.910828" ) - ROMX_LOAD( "910828.bin", 0x0000, 0x20000, CRC(3ee40b06) SHA1(b63d970727a2b8da72a0a8e234f3c30a20cbcb26), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "911001", "V0.9.911001" ) - ROMX_LOAD( "911001.bin", 0x0000, 0x20000, CRC(0888b50f) SHA1(129b9a2611edaebaa028ac3e3f444927c8b1fc5d), ROM_BIOS(5) ) -ROM_END - -ROM_START( c64dx ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "910429.bin", 0x0000, 0x20000, CRC(b025805c) SHA1(c3b05665684f74adbe33052a2d10170a1063ee7d) ) -ROM_END - -DRIVER_INIT_MEMBER(c65_state,c65) -{ -// m_dma.version = 2; -// c65_common_driver_init(); -} - -DRIVER_INIT_MEMBER(c65_state,c65pal) -{ -// m_dma.version = 1; -// c65_common_driver_init(); -// m_pal = 1; -} - -COMP( 1991, c65, 0, 0, c65, c65, c65_state, c65, "Commodore Business Machines", "Commodore 65 Development System (Prototype, NTSC)", MACHINE_NOT_WORKING ) -COMP( 1991, c64dx, c65, 0, c65, c65, c65_state, c65pal, "Commodore Business Machines", "Commodore 64DX Development System (Prototype, PAL, German)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/c65_old.c b/src/mess/drivers/c65_old.c deleted file mode 100644 index 97d934ff1db..00000000000 --- a/src/mess/drivers/c65_old.c +++ /dev/null @@ -1,648 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/*************************************************************************** - - Commodore C65 home computer - PeT mess@utanet.at - - documention - www.funet.fi - -***************************************************************************/ - -/* - -2008 - Driver Updates ---------------------- - -(most of the informations are taken from http://www.zimmers.net/cbmpics/ ) - - -[CBM systems which belong to this driver] - -* Commodore 65 (1989) - -Also known as C64 DX at early stages of the project. It was cancelled -around 1990-1991. Only few units survive (they were sold after Commodore -liquidation in 1994). - -CPU: CSG 4510 (3.54 MHz) -RAM: 128 kilobytes, expandable to 8 megabytes -ROM: 128 kilobytes -Video: CSG 4569 "VIC-III" (6 Video modes; Resolutions from 320x200 to - 1280x400; 80 columns text; Palette of 4096 colors) -Sound: CSG 8580 "SID" x2 (6 voice stereo synthesizer/digital sound - capabilities) -Ports: CSG 4510 (2 Joystick/Mouse ports; CBM Serial port; CBM 'USER' - port; CBM Monitor port; Power and reset switches; C65 bus drive - port; RGBI video port; 2 RCA audio ports; RAM expansion port; C65 - expansion port) -Keyboard: Full-sized 77 key QWERTY (12 programmable function keys; - 4 direction cursor-pad) -Additional Hardware: Built in 3.5" DD disk drive (1581 compatible) -Miscellaneous: Partially implemented Commodore 64 emulation - -[Notes] - -The datasette port was removed here. C65 supports an additional "dumb" -drive externally. It also features, in addition to the standard CBM -bus serial (available in all modes), a Fast and a Burst serial bus -(both available in C65 mode only) - -*/ - - -#include "emu.h" -#include "cpu/m6502/m4510.h" -#include "machine/mos6526.h" -#include "machine/cbm_snqk.h" -#include "includes/c65.h" -#include "bus/cbmiec/cbmiec.h" -#include "machine/ram.h" - -static void cbm_c65_quick_sethiaddress( address_space &space, UINT16 hiaddress ) -{ - space.write_byte(0x82, hiaddress & 0xff); - space.write_byte(0x83, hiaddress >> 8); -} - -QUICKLOAD_LOAD_MEMBER( c65_state, cbm_c65 ) -{ - return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_c65_quick_sethiaddress); -} - -/************************************* - * - * Main CPU memory handlers - * - *************************************/ - -static ADDRESS_MAP_START( c65_mem , AS_PROGRAM, 8, c65_state ) - AM_RANGE(0x00000, 0x07fff) AM_RAMBANK("bank11") - AM_RANGE(0x08000, 0x09fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank12") - AM_RANGE(0x0a000, 0x0bfff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank13") - AM_RANGE(0x0c000, 0x0cfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank14") - AM_RANGE(0x0d000, 0x0d7ff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank5") - AM_RANGE(0x0d800, 0x0dbff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") - AM_RANGE(0x0dc00, 0x0dfff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank9") - AM_RANGE(0x0e000, 0x0ffff) AM_READ_BANK("bank10") AM_WRITE_BANK("bank15") - AM_RANGE(0x10000, 0x1f7ff) AM_RAM - AM_RANGE(0x1f800, 0x1ffff) AM_RAM AM_SHARE("colorram") - - AM_RANGE(0x20000, 0x23fff) AM_ROM /* &c65_dos, maps to 0x8000 */ - AM_RANGE(0x24000, 0x28fff) AM_ROM /* reserved */ - AM_RANGE(0x29000, 0x29fff) AM_ROM AM_SHARE("c65_chargen") - AM_RANGE(0x2a000, 0x2bfff) AM_ROM AM_SHARE("basic") - AM_RANGE(0x2c000, 0x2cfff) AM_ROM AM_SHARE("interface") - AM_RANGE(0x2d000, 0x2dfff) AM_ROM AM_SHARE("chargen") - AM_RANGE(0x2e000, 0x2ffff) AM_ROM AM_SHARE("kernal") - - AM_RANGE(0x30000, 0x31fff) AM_ROM /*&c65_monitor, monitor maps to 0x6000 */ - AM_RANGE(0x32000, 0x37fff) AM_ROM /*&c65_basic, */ - AM_RANGE(0x38000, 0x3bfff) AM_ROM /*&c65_graphics, */ - AM_RANGE(0x3c000, 0x3dfff) AM_ROM /* reserved */ - AM_RANGE(0x3e000, 0x3ffff) AM_ROM /* &c65_kernal, */ - - AM_RANGE(0x40000, 0x7ffff) AM_NOP - /* 8 megabyte full address space! */ -ADDRESS_MAP_END - - -/************************************* - * - * Input Ports - * - *************************************/ - -static INPUT_PORTS_START( c65 ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_START("FUNCT") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13 F14") PORT_CODE(KEYCODE_F11) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11 F12") PORT_CODE(KEYCODE_F10) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9 F10") PORT_CODE(KEYCODE_F9) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F12) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_F2) /* non blocking */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NO SCRL") PORT_CODE(KEYCODE_F4) - - PORT_START( "SPECIAL" ) /* special keys */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_CONFNAME( 0x20, 0x00, "(C65) Caps Lock (switch)") PORT_CODE(KEYCODE_F3) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x20, DEF_STR( On ) ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("CTRLSEL") /* Controller selection */ - PORT_CONFNAME( 0x07, 0x00, "Gameport A" ) - PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) ) - PORT_CONFSETTING( 0x01, "Paddles 1 & 2" ) - PORT_CONFSETTING( 0x02, "Mouse 1351" ) - PORT_CONFSETTING( 0x03, "Mouse (Non Proportional) 1350" ) - PORT_CONFSETTING( 0x04, "Lightpen" ) -// PORT_CONFSETTING( 0x05, "Koala Pad" ) - PORT_CONFSETTING( 0x06, "Lightgun" ) - PORT_CONFSETTING( 0x07, "No Device Connected" ) - PORT_CONFNAME( 0x70, 0x00, "Gameport B" ) - PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) ) - PORT_CONFSETTING( 0x10, "Paddles 3 & 4" ) -// PORT_CONFSETTING( 0x20, "Mouse 1351" ) -// PORT_CONFSETTING( 0x30, "Mouse (Non Proportional) 1350" ) - PORT_CONFSETTING( 0x70, "No Device Connected" ) - PORT_CONFNAME( 0x80, 0x00, "Swap Gameport A and B") PORT_CODE(KEYCODE_F1) PORT_TOGGLE - PORT_CONFSETTING( 0x00, DEF_STR( No ) ) - PORT_CONFSETTING( 0x80, DEF_STR( Yes ) ) - - PORT_START("JOY1_1B") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("JOY2_1B") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) - - /* Mouse Commodore 1350 was basically working as a Joystick */ - PORT_START("JOY1_2B") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Up") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Down") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Left") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Right") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 1") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 2") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) - PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) - - /* Still to verify how many mice you were able to plug into a C64 */ - /* Only one, for now */ - PORT_START("JOY2_2B") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) -/* PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_PGUP) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) - PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) -*/ - PORT_START("PADDLE1") - PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - - PORT_START("PADDLE2") - PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_DOWN) PORT_CODE_INC(KEYCODE_UP) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - - PORT_START("PADDLE3") - PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_HOME) PORT_CODE_INC(KEYCODE_PGUP) PORT_PLAYER(3) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - - PORT_START("PADDLE4") - PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_END) PORT_CODE_INC(KEYCODE_PGDN) PORT_PLAYER(4) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - - PORT_START("TRACKX") - PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - - PORT_START("TRACKY") - PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - - PORT_START("LIGHTX") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_NAME("Lightpen X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) - - PORT_START("LIGHTY") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_NAME("Lightpen Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) - - PORT_START("OTHER") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle 1 Button") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Paddle 2 Button") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Paddle 3 Button") PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Paddle 4 Button") PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightpen Signal") PORT_CODE(KEYCODE_LCONTROL) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button Left") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Button Right") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02)INPUT_PORTS_END - - -static INPUT_PORTS_START( c65ger ) - PORT_INCLUDE( c65 ) - - PORT_MODIFY( "ROW1" ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z { Y }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 # { 3 Paragraph }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_MODIFY( "ROW3" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y { Z }") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 ' { 7 / }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_MODIFY( "ROW4" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 { = }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_MODIFY( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", < { ; }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Paragraph \xE2\x86\x91 { \xc3\xbc }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00A7) PORT_CHAR(0x2191) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xa4 }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". > { : }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- { ' ` }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+ { \xc3\x9f ? }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - - PORT_MODIFY( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ? { - _ }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Sum Pi { ] \\ }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x03A3) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= { # ' }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; ] { \xc3\xb6 }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* ` { + * }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ { [ \xE2\x86\x91 }") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xa3') - - PORT_MODIFY( "ROW7" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') - - PORT_MODIFY("SPECIAL") /* special keys */ - PORT_DIPNAME( 0x20, 0x00, "(C65) DIN ASC (switch)") PORT_CODE(KEYCODE_F3) - PORT_DIPSETTING( 0x00, "ASC" ) - PORT_DIPSETTING( 0x20, "DIN" ) -INPUT_PORTS_END - - - -/************************************* - * - * Sound definitions - * - *************************************/ - -int c65_state::c64_paddle_read( device_t *device, address_space &space, int which ) -{ - int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp; - UINT8 cia0porta = machine().device("cia_0")->pa_r(space, 0); - int controller1 = ioport("CTRLSEL")->read() & 0x07; - int controller2 = ioport("CTRLSEL")->read() & 0x70; - /* Notice that only a single input is defined for Mouse & Lightpen in both ports */ - switch (controller1) - { - case 0x01: - if (which) - pot2 = ioport("PADDLE2")->read(); - else - pot1 = ioport("PADDLE1")->read(); - break; - - case 0x02: - if (which) - pot2 = ioport("TRACKY")->read(); - else - pot1 = ioport("TRACKX")->read(); - break; - - case 0x03: - if (which && (ioport("JOY1_2B")->read() & 0x20)) /* Joy1 Button 2 */ - pot1 = 0x00; - break; - - case 0x04: - if (which) - pot2 = ioport("LIGHTY")->read(); - else - pot1 = ioport("LIGHTX")->read(); - break; - - case 0x06: - if (which && (ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */ - pot2 = 0x00; - break; - - case 0x00: - case 0x07: - break; - - default: - logerror("Invalid Controller Setting %d\n", controller1); - break; - } - - switch (controller2) - { - case 0x10: - if (which) - pot4 = ioport("PADDLE4")->read(); - else - pot3 = ioport("PADDLE3")->read(); - break; - - case 0x20: - if (which) - pot4 = ioport("TRACKY")->read(); - else - pot3 = ioport("TRACKX")->read(); - break; - - case 0x30: - if (which && (ioport("JOY2_2B")->read() & 0x20)) /* Joy2 Button 2 */ - pot4 = 0x00; - break; - - case 0x40: - if (which) - pot4 = ioport("LIGHTY")->read(); - else - pot3 = ioport("LIGHTX")->read(); - break; - - case 0x60: - if (which && (ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */ - pot4 = 0x00; - break; - - case 0x00: - case 0x70: - break; - - default: - logerror("Invalid Controller Setting %d\n", controller1); - break; - } - - if (ioport("CTRLSEL")->read() & 0x80) /* Swap */ - { - temp = pot1; pot1 = pot3; pot3 = temp; - temp = pot2; pot2 = pot4; pot4 = temp; - } - - switch (cia0porta & 0xc0) - { - case 0x40: - return which ? pot2 : pot1; - - case 0x80: - return which ? pot4 : pot3; - - case 0xc0: - return which ? pot2 : pot1; - - default: - return 0; - } -} - -READ8_MEMBER( c65_state::sid_potx_r ) -{ - return c64_paddle_read(m_sid_r, space, 0); -} - -READ8_MEMBER( c65_state::sid_poty_r ) -{ - return c64_paddle_read(m_sid_r, space, 1); -} - - -/************************************* - * - * VIC III interfaces - * - *************************************/ - -UINT32 c65_state::screen_update_c65(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_vic->video_update(bitmap, cliprect); - return 0; -} - -READ8_MEMBER(c65_state::c65_lightpen_x_cb) -{ - return ioport("LIGHTX")->read() & ~0x01; -} - -READ8_MEMBER(c65_state::c65_lightpen_y_cb) -{ - return ioport("LIGHTY")->read() & ~0x01; -} - -READ8_MEMBER(c65_state::c65_lightpen_button_cb) -{ - return ioport("OTHER")->read() & 0x04; -} - -READ8_MEMBER(c65_state::c65_c64_mem_r) -{ - return m_memory[offset]; -} - -INTERRUPT_GEN_MEMBER(c65_state::vic3_raster_irq) -{ - m_vic->raster_interrupt_gen(); -} - -/************************************* - * - * Machine driver - * - *************************************/ - -static MACHINE_CONFIG_START( c65, c65_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M4510, 3500000) /* or VIC6567_CLOCK, */ - MCFG_CPU_PROGRAM_MAP(c65_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", c65_state, c65_frame_interrupt) - MCFG_CPU_PERIODIC_INT_DRIVER(c65_state, vic3_raster_irq, VIC6567_HRETRACERATE) - - MCFG_MACHINE_START_OVERRIDE(c65_state, c65 ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(525 * 2, 520 * 2) - MCFG_SCREEN_VISIBLE_AREA(VIC6567_STARTVISIBLECOLUMNS ,(VIC6567_STARTVISIBLECOLUMNS + VIC6567_VISIBLECOLUMNS - 1) * 2, VIC6567_STARTVISIBLELINES, VIC6567_STARTVISIBLELINES + VIC6567_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DRIVER(c65_state, screen_update_c65) - MCFG_SCREEN_PALETTE("vic3:palette") - - MCFG_DEVICE_ADD("vic3", VIC3, 0) - MCFG_VIC3_CPU("maincpu") - MCFG_VIC3_TYPE(VIC4567_NTSC) - MCFG_VIC3_LIGHTPEN_X_CB(READ8(c65_state, c65_lightpen_x_cb)) - MCFG_VIC3_LIGHTPEN_Y_CB(READ8(c65_state, c65_lightpen_y_cb)) - MCFG_VIC3_LIGHTPEN_BUTTON_CB(READ8(c65_state, c65_lightpen_button_cb)) - MCFG_VIC3_DMA_READ_CB(READ8(c65_state, c65_dma_read)) - MCFG_VIC3_DMA_READ_COLOR_CB(READ8(c65_state, c65_dma_read_color)) - MCFG_VIC3_INTERRUPT_CB(WRITELINE(c65_state, c65_vic_interrupt)) - MCFG_VIC3_PORT_CHANGED_CB(WRITE8(c65_state, c65_bankswitch_interface)) - MCFG_VIC3_C64_MEM_R_CB(READ8(c65_state, c65_c64_mem_r)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("sid_r", MOS8580, 985248) - MCFG_MOS6581_POTX_CALLBACK(READ8(c65_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c65_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) - MCFG_SOUND_ADD("sid_l", MOS8580, 985248) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", c65_state, cbm_c65, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - /* cia */ - MCFG_DEVICE_ADD("cia_0", MOS6526, 3500000) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, c65_cia0_interrupt)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, c65_cia0_port_a_r)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c65_state, c65_cia0_port_b_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c65_state, c65_cia0_port_b_w)) - - MCFG_DEVICE_ADD("cia_1", MOS6526, 3500000) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, c65_cia1_interrupt)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, c65_cia1_port_a_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c65_state, c65_cia1_port_a_w)) - - /* floppy from serial bus */ - MCFG_CBM_IEC_ADD(NULL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("640K,4224K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( c65pal, c65 ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) - MCFG_SCREEN_SIZE(625 * 2, 520 * 2) - MCFG_SCREEN_VISIBLE_AREA(VIC6569_STARTVISIBLECOLUMNS, (VIC6569_STARTVISIBLECOLUMNS + VIC6569_VISIBLECOLUMNS - 1) * 2, VIC6569_STARTVISIBLELINES, VIC6569_STARTVISIBLELINES + VIC6569_VISIBLELINES - 1) - MCFG_SCREEN_PALETTE("vic3:palette") - - MCFG_DEVICE_MODIFY("vic3") - MCFG_VIC3_TYPE(VIC4567_PAL) - - /* sound hardware */ - MCFG_SOUND_REPLACE("sid_r", MOS8580, 1022727) - MCFG_MOS6581_POTX_CALLBACK(READ8(c65_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(c65_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) - MCFG_SOUND_REPLACE("sid_l", MOS8580, 1022727) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - - /* cia */ - MCFG_DEVICE_MODIFY("cia_0") - MCFG_MOS6526_TOD(50) - - MCFG_DEVICE_MODIFY("cia_1") - MCFG_MOS6526_TOD(50) -MACHINE_CONFIG_END - - -/************************************* - * - * ROM definition(s) - * - *************************************/ - - -ROM_START( c65 ) - ROM_REGION( 0x400000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "910111", "V0.9.910111" ) - ROMX_LOAD( "910111.bin", 0x20000, 0x20000, CRC(c5d8d32e) SHA1(71c05f098eff29d306b0170e2c1cdeadb1a5f206), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "910523", "V0.9.910523" ) - ROMX_LOAD( "910523.bin", 0x20000, 0x20000, CRC(e8235dd4) SHA1(e453a8e7e5b95de65a70952e9d48012191e1b3e7), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "910626", "V0.9.910626" ) - ROMX_LOAD( "910626.bin", 0x20000, 0x20000, CRC(12527742) SHA1(07c185b3bc58410183422f7ac13a37ddd330881b), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "910828", "V0.9.910828" ) - ROMX_LOAD( "910828.bin", 0x20000, 0x20000, CRC(3ee40b06) SHA1(b63d970727a2b8da72a0a8e234f3c30a20cbcb26), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "911001", "V0.9.911001" ) - ROMX_LOAD( "911001.bin", 0x20000, 0x20000, CRC(0888b50f) SHA1(129b9a2611edaebaa028ac3e3f444927c8b1fc5d), ROM_BIOS(5) ) -ROM_END - -ROM_START( c64dx ) - ROM_REGION( 0x400000, "maincpu", 0 ) - ROM_LOAD( "910429.bin", 0x20000, 0x20000, CRC(b025805c) SHA1(c3b05665684f74adbe33052a2d10170a1063ee7d) ) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ - -COMP( 1991, c65, 0, 0, c65, c65, c65_state, c65, "Commodore Business Machines", "Commodore 65 Development System (Prototype, NTSC)", MACHINE_NOT_WORKING ) -COMP( 1991, c64dx, c65, 0, c65pal, c65ger, c65_state, c65pal, "Commodore Business Machines", "Commodore 64DX Development System (Prototype, PAL, German)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/c80.c b/src/mess/drivers/c80.c deleted file mode 100644 index 4af7ab0c6db..00000000000 --- a/src/mess/drivers/c80.c +++ /dev/null @@ -1,293 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - -C-80 - -Pasting: - 0-F : as is - + (inc) : ^ - - (dec) : V - M : - - GO : X - -Test Paste: - -800^11^22^33^44^55^66^77^88^99^-800 - Now press up-arrow to confirm the data has been entered. - -Commands: - R : REGister - M : MEMory manipulation - G : GO - F10 : RESet - ESC : BRK - -Functions (press F1 then the indicated number): - 0 : FILL - 1 : SAVE - 2 : LOAD - 3 : LOADP - 4 : MOVE - 5 : IN - 6 : OUT - -When REG is chosen, use UP to scroll through the list of regs, -or press 0 thru C to choose one directly: - 0 : SP - 1 : PC - 2 : AF - 3 : BC - 4 : DE - 5 : HL - 6 : AF' - 7 : BC' - 8 : DE' - 9 : HL' - A : IFF - B : IX - C : IY - -When MEM is chosen, enter the address, press UP, enter data, press UP, enter -data of next byte, and so on. - -****************************************************************************/ - -#include "includes/c80.h" -#include "sound/wave.h" -#include "c80.lh" - -/* Memory Maps */ - -static ADDRESS_MAP_START( c80_mem, AS_PROGRAM, 8, c80_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0x0bff) AM_MIRROR(0x400) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c80_io, AS_IO, 8, c80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x7c, 0x7f) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_device, read, write) - AM_RANGE(0xbc, 0xbf) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_device, read, write) -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( c80_state::trigger_reset ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER( c80_state::trigger_nmi ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - -static INPUT_PORTS_START( c80 ) - PORT_START("ROW0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FCN") PORT_CODE(KEYCODE_F1) - - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_M) PORT_CHAR('-') - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RES") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, c80_state, trigger_reset, 0) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BRK") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, c80_state, trigger_nmi, 0) -INPUT_PORTS_END - -/* Z80-PIO Interface */ - -READ8_MEMBER( c80_state::pio1_pa_r ) -{ - /* - - bit description - - PA0 keyboard row 0 input - PA1 keyboard row 1 input - PA2 keyboard row 2 input - PA3 - PA4 _BSTB input - PA5 display enable output (0=enabled, 1=disabled) - PA6 tape output - PA7 tape input - - */ - - UINT8 data = !m_pio1_brdy << 4 | 0x07; - - int i; - - for (i = 0; i < 8; i++) - { - if (!BIT(m_keylatch, i)) - { - if (!BIT(m_row0->read(), i)) data &= ~0x01; - if (!BIT(m_row1->read(), i)) data &= ~0x02; - if (!BIT(m_row2->read(), i)) data &= ~0x04; - } - } - - data |= (m_cassette->input() < +0.0) << 7; - - return data; -} - -WRITE8_MEMBER( c80_state::pio1_pa_w ) -{ - /* - - bit description - - PA0 keyboard row 0 input - PA1 keyboard row 1 input - PA2 keyboard row 2 input - PA3 - PA4 _BSTB input - PA5 display enable output (0=enabled, 1=disabled) - PA6 tape output - PA7 tape input - - */ - - m_pio1_a5 = BIT(data, 5); - - if (!BIT(data, 5)) - { - m_digit = 0; - } - - m_cassette->output(BIT(data, 6) ? +1.0 : -1.0); -} - -WRITE8_MEMBER( c80_state::pio1_pb_w ) -{ - /* - - bit description - - PB0 VQD30 segment A - PB1 VQD30 segment B - PB2 VQD30 segment C - PB3 VQD30 segment D - PB4 VQD30 segment E - PB5 VQD30 segment F - PB6 VQD30 segment G - PB7 VQD30 segment P - - */ - - if (!m_pio1_a5) - { - output_set_digit_value(m_digit, data); - } - - m_keylatch = data; -} - -WRITE_LINE_MEMBER( c80_state::pio1_brdy_w ) -{ - m_pio1_brdy = state; - - if (state) - { - if (!m_pio1_a5) - { - m_digit++; - } - - m_pio1->strobe_b(1); - m_pio1->strobe_b(0); - } -} - -/* Z80 Daisy Chain */ - -static const z80_daisy_config c80_daisy_chain[] = -{ - { Z80PIO1_TAG }, - { Z80PIO2_TAG }, - { NULL } -}; - -/* Machine Initialization */ - -void c80_state::machine_start() -{ - /* register for state saving */ - save_item(NAME(m_keylatch)); - save_item(NAME(m_digit)); - save_item(NAME(m_pio1_a5)); - save_item(NAME(m_pio1_brdy)); -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( c80, c80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 2500000) /* U880D */ - MCFG_CPU_PROGRAM_MAP(c80_mem) - MCFG_CPU_IO_MAP(c80_io) - MCFG_CPU_CONFIG(c80_daisy_chain) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_c80 ) - - /* devices */ - MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, 2500000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(c80_state, pio1_pa_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(c80_state, pio1_pa_w)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(c80_state, pio1_pb_w)) - MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(c80_state, pio1_brdy_w)) - - MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, 2500000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED ) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( c80 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "c80.d3", 0x0000, 0x0400, CRC(ad2b3296) SHA1(14f72cb73a4068b7a5d763cc0e254639c251ce2e) ) -ROM_END - - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, c80, 0, 0, c80, c80, driver_device, 0, "Joachim Czepa", "C-80", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/c900.c b/src/mess/drivers/c900.c deleted file mode 100644 index 18e5238c3eb..00000000000 --- a/src/mess/drivers/c900.c +++ /dev/null @@ -1,135 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/****************************************************************************************** - - Commodore C900 - UNIX prototype - - http://www.zimmers.net/cbmpics/c900.html - http://www.zimmers.net/cbmpics/cbm/900/c900-chips.txt - - Chips: Z8001 CPU, Z8010 MMU, Z8030 SCC, Z8036 CIO. Crystal: 12MHz - - The Z8030 runs 2 serial ports. The Z8036 runs the IEEE interface and the speaker. - - The FDC is an intelligent device that communicates with the main board via the MMU. - It has a 6508 CPU. - - Disk drive is a Matsushita JA-560-012 - -*******************************************************************************************/ - - -#include "emu.h" -#include "cpu/z8000/z8000.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class c900_state : public driver_device -{ -public: - c900_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_READ16_MEMBER(port1e_r); - DECLARE_READ16_MEMBER(key_r); - DECLARE_READ16_MEMBER(stat_r); - DECLARE_WRITE8_MEMBER(kbd_put); -private: - UINT8 m_term_data; - required_device m_maincpu; - required_device m_terminal; -}; - -static ADDRESS_MAP_START(c900_mem, AS_PROGRAM, 16, c900_state) - AM_RANGE(0x00000, 0x07fff) AM_ROM AM_REGION("roms", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(c900_data, AS_DATA, 16, c900_state) - AM_RANGE(0x00000, 0x07fff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0x08000, 0x6ffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(c900_io, AS_IO, 16, c900_state) - AM_RANGE(0x0010, 0x0011) AM_READ(stat_r) - AM_RANGE(0x001A, 0x001B) AM_READ(key_r) - AM_RANGE(0x001E, 0x001F) AM_READ(port1e_r) - AM_RANGE(0x0100, 0x0101) AM_READ(stat_r) - AM_RANGE(0x0110, 0x0111) AM_READ(key_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0x00ff) -ADDRESS_MAP_END - -static INPUT_PORTS_START( c900 ) -INPUT_PORTS_END - -READ16_MEMBER( c900_state::port1e_r ) -{ - return 0; -} - -READ16_MEMBER( c900_state::key_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ16_MEMBER( c900_state::stat_r ) -{ - return (m_term_data) ? 6 : 4; -} - -WRITE8_MEMBER( c900_state::kbd_put ) -{ - m_term_data = data; -} - -/* F4 Character Displayer */ -static const gfx_layout c900_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( c900 ) - GFXDECODE_ENTRY( "chargen", 0x0000, c900_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( c900, c900_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z8001, XTAL_12MHz / 2) - MCFG_CPU_PROGRAM_MAP(c900_mem) - MCFG_CPU_DATA_MAP(c900_data) - MCFG_CPU_IO_MAP(c900_io) - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(c900_state, kbd_put)) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", c900) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -ROM_START( c900 ) - ROM_REGION16_LE( 0x8000, "roms", 0 ) - ROM_LOAD16_BYTE( "c 900 boot-h v 1.0.bin.u17", 0x0001, 0x4000, CRC(c3aa7fc1) SHA1(ff12dd100fa7b1e7e931e9a8ef4c4f5cc056e099) ) - ROM_LOAD16_BYTE( "c 900 boot-l v 1.0.bin.u18", 0x0000, 0x4000, CRC(0aa39272) SHA1(b2c5da4586d38fc66bb33aafeae4dbda36080f1e) ) - - ROM_REGION( 0x2000, "fdc", 0 ) - ROM_LOAD( "s41_6-20-85.bin", 0x0000, 0x2000, CRC(ec245721) SHA1(4cc19014b4887833a56b1236dc5fe39cc5d7b5c3) ) - - ROM_REGION( 0x1000, "chargen", 0 ) // this must be for the c900 terminal as the mainframe has no video output - ROM_LOAD( "380217-01.u2", 0x0000, 0x1000, CRC(64cb4171) SHA1(e60d796170addfd27e2c33090f9c512c7e3f99f5) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, c900, 0, 0, c900, c900, driver_device, 0, "Commodore", "Commodore 900", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/camplynx.c b/src/mess/drivers/camplynx.c deleted file mode 100644 index 1b977ffe513..00000000000 --- a/src/mess/drivers/camplynx.c +++ /dev/null @@ -1,633 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Camputers Lynx - - 05/2009 Skeleton driver. - - The Lynx was an 8-bit British home computer that was first released - in early 1983 as a 48 kB model. - The designer of the Lynx was John Shireff and several models were - available with 48 kB, 96 kB (from Sep 1983) or 128 kB RAM (from Dec - 1983). It was possible reach 192 kB with RAM expansions on-board. - - The machine was based around a Z80A CPU clocked at 4 MHz, and featured - a Motorola 6845 as video controller. It was possible to run CP/M with - the optional 5.25" floppy disk-drive on the 96 kB and 128 kB models. - Approximately 30,000 Lynx units were sold world-wide. - - Camputers ceased trading in June 1984. Anston Technology took over in - November the same year and a re-launch was planned but never happened. - - In June 1986, Anston sold everything - hardware, design rights and - thousands of cassettes - to the National Lynx User Group. The group - planned to produce a Super-Lynx but was too busy supplying spares and - technical information to owners of existing models, and the project never - came into being. - - Hardware info: - - CPU: Zilog Z80A 4 MHz - - CO-PROCESSOR: Motorola 6845 (CRT controller) - - RAM: 48 kb, 96 kb or 128 kb depending on models (max. 192 kb) - - ROM: 16 kb (48K version), 24 KB (96K and 128K versions) - - TEXT MODES: 40 x 24, 80 x 24 - - GRAPHIC MODES: 256 x 248, 512 x 480 - - SOUND: one voice beeper - - Lynx 128 Memory Map - - | 0000 2000 4000 6000 8000 a000 c000 e000 - | 1fff 3fff 5fff 7fff 9fff bfff dfff ffff - ------------------------------------------------------------------------- - | | | | - Bank 0 | BASIC ROM | Not Available | Ext | Ext - | | | ROM1 | ROM2 - ------------------------------------------------------------------------- - | | - Bank 1 | STORE | Workspace RAM - | | - ------------------------------------------------------------------------- - | | | | - Bank 2 | RED | BLUE | GREEN | Alt - | | | | Green - ------------------------------------------------------------------------- - | - Bank 3 | Available for Video Expansion - | - ------------------------------------------------------------------------- - | - Bank 4 | Available for User RAM Expansion - | - - - - 48k and 96k are basically the same machine. 128k is different. - - Notes: - - The screen doesn't scroll. This is normal. - - Variable names are case-sensitive. - - Break key is the Escape key. - - Typing a line number doesn't delete the line, you are in a calculator mode - (for example, typing 67-5 will print 62) - - DEL line-number deletes the line. - - To edit a line, press Ctrl-E, it asks for line number, type it in, - then arrows to move left-right, backspace to delete, press keys to insert them - - If you entered a line and got a syntax error, press Ctrl-Q to edit it. - - Cassette tapes made on 128k are a different speed to 48k tapes. To load a 128k - tape on a 48k system, enter TAPE 3 before loading. (2,3,4,5 all seem to work). - - When loading, there's no wildcard; you must specify the name. - - To Do: - - finish memory banking - - how is alt-green bank selected on 48k? - - port 80 on 48k - - disk - - printer - - joysticks - - find out the mc6845 clock frequency - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "sound/dac.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "formats/camplynx_cas.h" - -class camplynx_state : public driver_device -{ -public: - camplynx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_cass(*this, "cassette") - //, m_printer(*this, "centronics") - , m_crtc(*this, "crtc") - //, m_fdc(*this, "fdc") - , m_dac(*this, "dac") - { } - - // 48k - DECLARE_READ8_MEMBER(port80_r); // cassin for 48k - DECLARE_WRITE8_MEMBER(port80_w); // control port 48k - DECLARE_WRITE8_MEMBER(port84_w); // dac port 48k - DECLARE_WRITE8_MEMBER(lynx48k_bank_w); // banking 48k - DECLARE_DRIVER_INIT(lynx48k); - MC6845_UPDATE_ROW(lynx48k_update_row); - // 128k - DECLARE_WRITE8_MEMBER(lynx128k_port80_w); // control port 128k - DECLARE_READ8_MEMBER(lynx128k_port82_r); // cassin for 128k - DECLARE_WRITE8_MEMBER(lynx128k_port84_w); // dac port 128k - DECLARE_WRITE8_MEMBER(lynx128k_bank_w); // banking 128k - DECLARE_WRITE8_MEMBER(lynx128k_irq); - DECLARE_MACHINE_RESET(lynx128k); - MC6845_UPDATE_ROW(lynx128k_update_row); - // common - required_device m_palette; -private: - UINT8 m_port80; - required_device m_maincpu; - required_device m_cass; - //required_device<> m_printer; - required_device m_crtc; - //optional_device<> m_fdc; - required_device m_dac; -}; - -/* These bankswitch handlers are very incomplete, just enough to get the - computer working. Also, as it happens 6 times for every scanline - of every character, it causes a huge slowdown. */ - -WRITE8_MEMBER( camplynx_state::lynx48k_bank_w ) -{ - if (!data) - membank("bank1")->set_entry(0); - else - if (data & 2) - membank("bank1")->set_entry(1); - else - if (data & 4) - membank("bank1")->set_entry(2); - else - logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->pc(), data); -} - -WRITE8_MEMBER( camplynx_state::lynx128k_bank_w ) -{ - /* get address space */ - UINT8 *base = memregion("maincpu")->base(); - - /* Set read banks */ - UINT8 bank = data & 0x0f; - - if (!bank) - { - membank("bank1")->set_base(base + 0x00000); - membank("bank2")->set_base(base + 0x02000); - membank("bank3")->set_base(base + 0x04000); - membank("bank4")->set_base(base + 0x16000); - membank("bank5")->set_base(base + 0x18000); - membank("bank6")->set_base(base + 0x1a000); - membank("bank7")->set_base(base + 0x0c000); - membank("bank8")->set_base(base + 0x0e000); - } - else - if (bank == 0x0e) - { - membank("bank1")->set_base(base + 0x20000); - membank("bank2")->set_base(base + 0x22000); - membank("bank3")->set_base(base + 0x24000); - membank("bank4")->set_base(base + 0x26000); - membank("bank5")->set_base(base + 0x28000); - membank("bank6")->set_base(base + 0x2a000); - membank("bank7")->set_base(base + 0x2c000); - membank("bank8")->set_base(base + 0x2e000); - } - else - logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->pc(), data); - - /* Set write banks */ - bank = data & 0xd0; - - if (!bank) - { - membank("bank11")->set_base(base + 0x10000); - membank("bank12")->set_base(base + 0x12000); - membank("bank13")->set_base(base + 0x14000); - membank("bank14")->set_base(base + 0x16000); - membank("bank15")->set_base(base + 0x18000); - membank("bank16")->set_base(base + 0x1a000); - membank("bank17")->set_base(base + 0x1c000); - membank("bank18")->set_base(base + 0x1e000); - } - else - if (bank == 0xc0) - { - membank("bank11")->set_base(base + 0x20000); - membank("bank12")->set_base(base + 0x22000); - membank("bank13")->set_base(base + 0x24000); - membank("bank14")->set_base(base + 0x26000); - membank("bank15")->set_base(base + 0x28000); - membank("bank16")->set_base(base + 0x2a000); - membank("bank17")->set_base(base + 0x2c000); - membank("bank18")->set_base(base + 0x2e000); - } - else - logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->pc(), data); -} - -static ADDRESS_MAP_START( lynx48k_mem, AS_PROGRAM, 8, camplynx_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000,0x5fff) AM_ROM - AM_RANGE(0x6000,0x7fff) AM_RAM - AM_RANGE(0x8000,0xffff) AM_RAMBANK("bank1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( lynx128k_mem, AS_PROGRAM, 8, camplynx_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( lynx48k_io , AS_IO, 8, camplynx_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x007f,0x007f) AM_MIRROR(0xff00) AM_WRITE(lynx48k_bank_w) - AM_RANGE(0x0080,0x0080) AM_MIRROR(0xff00) AM_WRITE(port80_w) - AM_RANGE(0x0080,0x0080) AM_READ(port80_r) - AM_RANGE(0x0180,0x0180) AM_READ_PORT("LINE1") - AM_RANGE(0x0280,0x0280) AM_READ_PORT("LINE2") - AM_RANGE(0x0380,0x0380) AM_READ_PORT("LINE3") - AM_RANGE(0x0480,0x0480) AM_READ_PORT("LINE4") - AM_RANGE(0x0580,0x0580) AM_READ_PORT("LINE5") - AM_RANGE(0x0680,0x0680) AM_READ_PORT("LINE6") - AM_RANGE(0x0780,0x0780) AM_READ_PORT("LINE7") - AM_RANGE(0x0880,0x0880) AM_READ_PORT("LINE8") - AM_RANGE(0x0980,0x0980) AM_READ_PORT("LINE9") - AM_RANGE(0x0084,0x0084) AM_MIRROR(0xff00) AM_WRITE(port84_w) - AM_RANGE(0x0086,0x0086) AM_MIRROR(0xff00) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0x0087,0x0087) AM_MIRROR(0xff00) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( lynx128k_io , AS_IO, 8, camplynx_state ) - ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0x0050,0x0053) AM_MIRROR(0xff80) AM_READ(wd179x_r) // uses a 1793 -// AM_RANGE(0x0054,0x0057) AM_MIRROR(0xff80) AM_WRITE(wd179x_w) -// AM_RANGE(0x0058,0x0058) AM_MIRROR(0xff80) AM_WRITE(lynx128k_disk_w) -// AM_RANGE(0x007a,0x007b) AM_MIRROR(0xff80) AM_READ(lynx128k_joysticks_r) -// AM_RANGE(0x007c,0x007c) AM_MIRROR(0xff80) AM_READ(lynx128k_printer_r) -// AM_RANGE(0x007d,0x007d) AM_MIRROR(0xff80) AM_WRITE(lynx128k_printer_init_w) // this is rw -// AM_RANGE(0x007e,0x007e) AM_MIRROR(0xff80) AM_WRITE(lynx128k_printer_w) - AM_RANGE(0x0080,0x0080) AM_MIRROR(0xff00) AM_WRITE(lynx128k_port80_w) - AM_RANGE(0x0080,0x0080) AM_READ_PORT("LINE0") - AM_RANGE(0x0180,0x0180) AM_READ_PORT("LINE1") - AM_RANGE(0x0280,0x0280) AM_READ_PORT("LINE2") - AM_RANGE(0x0380,0x0380) AM_READ_PORT("LINE3") - AM_RANGE(0x0480,0x0480) AM_READ_PORT("LINE4") - AM_RANGE(0x0580,0x0580) AM_READ_PORT("LINE5") - AM_RANGE(0x0680,0x0680) AM_READ_PORT("LINE6") - AM_RANGE(0x0780,0x0780) AM_READ_PORT("LINE7") - AM_RANGE(0x0880,0x0880) AM_READ_PORT("LINE8") - AM_RANGE(0x0980,0x0980) AM_READ_PORT("LINE9") - AM_RANGE(0x0082,0x0082) AM_MIRROR(0xff00) AM_READWRITE(lynx128k_port82_r,lynx128k_bank_w) // read=serial buffer - AM_RANGE(0x0084,0x0084) AM_MIRROR(0xff00) AM_WRITE(lynx128k_port84_w) - AM_RANGE(0x0086,0x0086) AM_MIRROR(0xff00) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0x0087,0x0087) AM_MIRROR(0xff00) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( lynx48k ) - PORT_START("LINE0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x0e, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_START("LINE1") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C CONT") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DEL") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X WEND") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E DATA") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_START("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A AUTO") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S STOP") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z RESTORE") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W WHILE") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q REM") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(34) - PORT_START("LINE3") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F DEFPROC") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V VERIFY") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T TRACE") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R REPEAT") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_START("LINE4") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B BEEP") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H GOSUB") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y RUN") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_START("LINE5") - PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J LABEL") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M RETURN") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U UNTIL") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) - PORT_START("LINE6") - PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K MON") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O ENDPROC") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_START("LINE7") - PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L LIST") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P PROC") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 _") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_START("LINE8") - PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(0x5e) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \\") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('\\') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_START("LINE9") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR(0x7f) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) -INPUT_PORTS_END - -READ8_MEMBER( camplynx_state::port80_r ) -{ - UINT8 data = ioport("LINE0")->read(); - // when reading tape, bit 0 becomes cass-in signal - if BIT(m_port80, 1) - { - data &= 0xfe; - data |= (m_cass->input() > +0.02) ? 0 : 1; - } - return data; -} - -// during normal operation continually outputs E4,40,0 -// bit 1 is for the cassette motor. Other bits unknown. -WRITE8_MEMBER( camplynx_state::port80_w ) -{ - m_port80 = data; - m_cass->change_state( BIT(data, 1) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - -/* DAC port. If writing cassette, output goes to tape as a sine wave, otherwise it goes to speaker. - There is code below to write as a sine wave or a square wave, both work and can be loaded successfully. - However the PALE emulator cannot load either of them, although it loads its own output. - MESS can load PALE's wav files though. - Currently square wave output is selected. */ - -WRITE8_MEMBER( camplynx_state::port84_w ) -{ - if BIT(m_port80, 1) - { - // Sine wave output - //float t = (float)(unsigned)data - 32.0f; - //m_cass->output(t/31); - - // Square wave output - m_cass->output(BIT(data, 5) ? -1.0 : +1.0); - } - else // speaker output - m_dac->write_unsigned8(space, 0, data); -} - -/* -d7 = clock -d2 = cass-in -d1 = serial data in -d0 = serial h/s in */ -READ8_MEMBER( camplynx_state::lynx128k_port82_r ) -{ - UINT8 data = 0xfb; // guess - data |= (m_cass->input() > +0.02) ? 4 : 0; - return data; -} - -/* -d7 = serial data out -d6 = interline control -d5 = cpu access -d4 = alt green or normal green -d3 = cass motor on -d2 = cass enable -d1 = serial h/s out -d0 = speaker */ -WRITE8_MEMBER( camplynx_state::lynx128k_port80_w ) -{ - m_port80 = data; - m_cass->change_state( BIT(data, 3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - -// DAC port (6-bit) -WRITE8_MEMBER( camplynx_state::lynx128k_port84_w ) -{ - if BIT(m_port80, 3) // could be bit 2 - { - // Square wave output - m_cass->output(BIT(data, 5) ? -1.0 : +1.0); - } - else // speaker output - m_dac->write_unsigned8(space, 0, data); -} - -MACHINE_RESET_MEMBER(camplynx_state,lynx128k) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - mem.install_read_bank (0x0000, 0x1fff, "bank1"); - mem.install_read_bank (0x2000, 0x3fff, "bank2"); - mem.install_read_bank (0x4000, 0x5fff, "bank3"); - mem.install_read_bank (0x6000, 0x7fff, "bank4"); - mem.install_read_bank (0x8000, 0x9fff, "bank5"); - mem.install_read_bank (0xa000, 0xbfff, "bank6"); - mem.install_read_bank (0xc000, 0xdfff, "bank7"); - mem.install_read_bank (0xe000, 0xffff, "bank8"); - mem.install_write_bank (0x0000, 0x1fff, "bank11"); - mem.install_write_bank (0x2000, 0x3fff, "bank12"); - mem.install_write_bank (0x4000, 0x5fff, "bank13"); - mem.install_write_bank (0x6000, 0x7fff, "bank14"); - mem.install_write_bank (0x8000, 0x9fff, "bank15"); - mem.install_write_bank (0xa000, 0xbfff, "bank16"); - mem.install_write_bank (0xc000, 0xdfff, "bank17"); - mem.install_write_bank (0xe000, 0xffff, "bank18"); - - lynx128k_bank_w(mem, 0, 0); -} - -WRITE8_MEMBER( camplynx_state::lynx128k_irq ) -{ - m_maincpu->set_input_line(0, data); -} - -MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) -{ - UINT8 *RAM = machine().root_device().memregion("maincpu")->base(); - UINT8 r,g,b,x; - UINT32 *p = &bitmap.pix32(y); - UINT16 mem = ((ma << 2) + (ra << 5)) & 0x3fff; - - for (x = 0; x < x_count; x++) - { - r = RAM[0x14000+mem+x]; - g = RAM[0x1c000+mem+x]; - b = RAM[0x10000+mem+x]; - - *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); - *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); - *p++ = m_palette->pen_color((BIT(b, 5) << 2) | (BIT(g, 5) << 1) | (BIT(r, 5))); - *p++ = m_palette->pen_color((BIT(b, 4) << 2) | (BIT(g, 4) << 1) | (BIT(r, 4))); - *p++ = m_palette->pen_color((BIT(b, 3) << 2) | (BIT(g, 3) << 1) | (BIT(r, 3))); - *p++ = m_palette->pen_color((BIT(b, 2) << 2) | (BIT(g, 2) << 1) | (BIT(r, 2))); - *p++ = m_palette->pen_color((BIT(b, 1) << 2) | (BIT(g, 1) << 1) | (BIT(r, 1))); - *p++ = m_palette->pen_color((BIT(b, 0) << 2) | (BIT(g, 0) << 1) | (BIT(r, 0))); - } -} - -MC6845_UPDATE_ROW( camplynx_state::lynx128k_update_row ) -{ - UINT8 *RAM = machine().root_device().memregion("maincpu")->base(); - UINT8 r,g,b,x; - UINT32 green_bank, *p = &bitmap.pix32(y); - UINT16 mem = ((ma << 2) + (ra << 6)) & 0x3fff; - // determine green bank - if BIT(m_port80, 4) - green_bank = 0x2c000+mem; // alt green - else - green_bank = 0x28000+mem; // normal green - - for (x = 0; x < x_count; x++) - { - r = RAM[0x20000+mem+x]; - b = RAM[0x24000+mem+x]; - g = RAM[green_bank+x]; - - *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); - *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); - *p++ = m_palette->pen_color((BIT(b, 5) << 2) | (BIT(g, 5) << 1) | (BIT(r, 5))); - *p++ = m_palette->pen_color((BIT(b, 4) << 2) | (BIT(g, 4) << 1) | (BIT(r, 4))); - *p++ = m_palette->pen_color((BIT(b, 3) << 2) | (BIT(g, 3) << 1) | (BIT(r, 3))); - *p++ = m_palette->pen_color((BIT(b, 2) << 2) | (BIT(g, 2) << 1) | (BIT(r, 2))); - *p++ = m_palette->pen_color((BIT(b, 1) << 2) | (BIT(g, 1) << 1) | (BIT(r, 1))); - *p++ = m_palette->pen_color((BIT(b, 0) << 2) | (BIT(g, 0) << 1) | (BIT(r, 0))); - } -} - -static MACHINE_CONFIG_START( lynx48k, camplynx_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(lynx48k_mem) - MCFG_CPU_IO_MAP(lynx48k_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 479) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - - MCFG_PALETTE_ADD_3BIT_RGB("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.5) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12MHz / 8 /*? dot clock divided by dots per char */) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(camplynx_state, lynx48k_update_row) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(lynx48k_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) - //MCFG_CASSETTE_INTERFACE("camplynx_cass") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( lynx128k, camplynx_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_6MHz) - MCFG_CPU_PROGRAM_MAP(lynx128k_mem) - MCFG_CPU_IO_MAP(lynx128k_io) - - MCFG_MACHINE_RESET_OVERRIDE(camplynx_state,lynx128k) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 479) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - - MCFG_PALETTE_ADD_3BIT_RGB("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.5) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12MHz / 8 /*? dot clock divided by dots per char */) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(camplynx_state, lynx128k_update_row) - MCFG_MC6845_OUT_HSYNC_CB(WRITE8(camplynx_state, lynx128k_irq)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(lynx128k_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) - //MCFG_CASSETTE_INTERFACE("camplynx_cass") -MACHINE_CONFIG_END - -DRIVER_INIT_MEMBER(camplynx_state,lynx48k) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 3, &RAM[0x8000], 0x8000); -} - - -/* ROM definition */ -ROM_START( lynx48k ) - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "1", "Set1") - ROMX_LOAD( "lynx48-1.rom", 0x0000, 0x2000, CRC(56feec44) SHA1(7ded5184561168e159a30fa8e9d3fde5e52aa91a), ROM_BIOS(1) ) - ROMX_LOAD( "lynx48-2.rom", 0x2000, 0x2000, CRC(d894562e) SHA1(c08a78ecb4eb05baa4c52488fce3648cd2688744), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "2", "Set2") - ROMX_LOAD( "lynx4811.rom", 0x0000, 0x2000, CRC(a933e577) SHA1(c7b30a28d99b38dbe63a1314c78e3e614287143b), ROM_BIOS(2) ) - ROMX_LOAD( "lynx4812.rom", 0x2000, 0x2000, CRC(3d3fdd0e) SHA1(259d124f05367a96f891790f9418cc9c7798e2f8), ROM_BIOS(2) ) -ROM_END - -ROM_START( lynx96k ) - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "lynx9646.rom", 0x0000, 0x2000, CRC(f86c5514) SHA1(77a4af7557382003d697d08f364839e2dc28f063) ) - ROM_LOAD( "lynx9645.rom", 0x2000, 0x2000, CRC(f596b9a3) SHA1(3fca46bd68422d34c6cd801dd904507e52bd8846) ) - ROM_LOAD( "lynx9644.rom", 0x4000, 0x1000, CRC(4b96b0de) SHA1(c372a8d26399b9b45e615b674d61ccda76491b8b) ) - ROM_LOAD( "dosrom.rom", 0xe000, 0x2000, CRC(011e106a) SHA1(e77f0ca99790551a7122945f3194516b2390fb69) ) -ROM_END - -ROM_START( lynx128k ) - ROM_REGION( 0x50000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "lynx128-1.rom", 0x0000, 0x2000, CRC(65d292ce) SHA1(36567c2fbd9cf72f758e8cb80c21cb4d82040752) ) - ROM_LOAD( "lynx128-2.rom", 0x2000, 0x2000, CRC(23288773) SHA1(e12a7ebea3fae5eb375c03e848dbb81070d9d189) ) - ROM_LOAD( "lynx128-3.rom", 0x4000, 0x2000, CRC(9827b9e9) SHA1(1092367b2af51c72ce9be367179240d692aeb131) ) - ROM_LOAD( "dosrom.rom", 0xe000, 0x2000, CRC(011e106a) SHA1(e77f0ca99790551a7122945f3194516b2390fb69) ) -ROM_END - - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, lynx48k, 0, 0, lynx48k, lynx48k, camplynx_state, lynx48k, "Camputers", "Lynx 48k", MACHINE_NOT_WORKING) -COMP( 1983, lynx96k, lynx48k, 0, lynx48k, lynx48k, camplynx_state, lynx48k, "Camputers", "Lynx 96k", MACHINE_NOT_WORKING) -COMP( 1983, lynx128k, lynx48k, 0, lynx128k, lynx48k, driver_device, 0, "Camputers", "Lynx 128k", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/canon_s80.c b/src/mess/drivers/canon_s80.c deleted file mode 100644 index 2ee2325ce0e..00000000000 --- a/src/mess/drivers/canon_s80.c +++ /dev/null @@ -1,54 +0,0 @@ -// license:GPL2+ -// copyright-holders:FelipeSanches -/* - * canon_s80.c - * - * CANON S-80 electronic typewriter - * - * skeleton driver by: - * Felipe Correa da Silva Sanches - * - * known issues: - * - memory-map is uncertain - * - maincpu clock is guessed - * - still need to hookup the Hitachi HD44780 LCD Controller - * - still lacks description of the keyboard inputs - * - as well as a "paper" device to plot the output of the dot matrix print head - */ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -//#include "video/hd44780.h" - -class canons80_state : public driver_device -{ -public: - canons80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - { } - - DECLARE_DRIVER_INIT(canons80); -}; - - -static ADDRESS_MAP_START(canons80_map, AS_PROGRAM, 8, canons80_state ) - AM_RANGE(0x0000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( canons80, canons80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD6301, 5000000) /* hd63a01xop 5 MHz guessed: TODO: check on PCB */ - MCFG_CPU_PROGRAM_MAP(canons80_map) -MACHINE_CONFIG_END - -DRIVER_INIT_MEMBER(canons80_state, canons80) -{} - -ROM_START( canons80 ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* 6800 code */ - ROM_LOAD( "canon_8735kx_nh4-0029_064.ic6", 0x8000, 0x8000, CRC(b6cd2ff7) SHA1(e47a136300c826e480fac1be7fc090523078a2a6) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, canons80, 0, 0, canons80, 0, canons80_state, canons80, "Canon", "Canon S-80 electronic typewriter", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/casloopy.c b/src/mess/drivers/casloopy.c deleted file mode 100644 index ec768a54c01..00000000000 --- a/src/mess/drivers/casloopy.c +++ /dev/null @@ -1,566 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese -/***************************************************************************** - - Casio Loopy (c) 1995 Casio - - skeleton driver - - TODO: - - Identify what actually is the NEC CDT-109 CPU, it should contain a program - controller for the thermal printer device - - Note: - - just a placeholder for any HW discovery, until we decap/trojan the BIOS, - the idea is to understand the HW enough to extract the SH-1 internal BIOS - data via a trojan; - - ASM notes: - - first vector is almost certainly VBR value. - - [VBR + 0x2c] irq for i/o? - - [VBR + 0x140] points to an internal BIOS routine, at 0x6238 - (Nigaoe Artist has a direct 0x648c instead) - - 0x0604 is probably a BRA -2 / NOP (some games puts that as a null irq vector) - - Nigaoe Artist jumps to 0x668 at some point. - - -=============================================================================== - -Casio Loopy PCB Layout ----------------------- - -JCM631-MA1M C -|---------------------------------------------------------| -| CB CC CD CE CF CG | -|--| | - | BA10339F | -|--| 15218 |--| CXA1645M CH| -| | | A1603C | -| 15218 | | | -| | | | -|BIOS.LSI352| | | -| | | 21MHz | -| |--------|| | |------| SW1 | -| |NEC || | |SH7021| |----------| | -| |CDT109 ||CA| | | | | | -| | || | |------| |CASIO | | -| |--------|| | |RH-7500 | | -| | | |5C315 | |--| -| |-------| | | | | | -| |CASIO | | | |----------| |--| -| |RH-7501| | | HM514260 | -| |5C350 | | | HM62256 | -| |-------| | | | -| 6379 |--| SW301 HM62256 / -|--------| HM538123 / - | / - | / - |--------------------------------------------/ - -Notes: - Connectors - ---------- - CA - Cartridge connector - CB - Power Input connector - CC - Composite Video and Audio Out connector - CD - Printer Cassette Motor connector - CE - Printer Data connector - CF - Printer Head connector - CG - Paper Sensor connector - CH - Joystick connector - Connectors on the back of the main unit include RCA audio (left/right), RCA composite video, - 24V DC power input and contrast knob. - On top of the main unit, there is a reset button, on/off slide switch, a big eject button, a - button to cut off stickers after they're printed, a button to open the hatch where the sticker - cassette is located and a red LED for power. - - IC's - ---- - BIOS2.LSI352- Hitachi HN62434 512k x8 (4MBit) maskROM (SOP40) - CDT-109 - NEC CDT109 (QFP120). This is some kind of CPU, the package looks a bit - like a V60. The BIOS is tied directly to it. - RH-7500 - Casio RH-7500 5C315 (QFP208). This is the graphics generator chip. - RH-7501 - Casio RH-7501 5C350 (QFP64). This is probably the sound chip. - SH7021 - Hitachi HD6437021TE20 SuperH RISC Engine SH-2A CPU with 32k internal maskROM (TQFP100) - The internal ROM (BIOS1) is not dumped. A SH-2A software programming manual is available here... - http://documentation.renesas.com/eng/products/mpumcu/rej09b0051_sh2a.pdf - CXA1645M - Sony CXA1645M RGB Encoder (RGB -> Composite Video) (SOIC24) - A1603C - NEC uPA1603C Compound Field Effect Power Transistor Array (DIP16) - HM514260 - Hitachi HM514260 256k x 16 DRAM (SOJ40) - HM538123 - Hitachi HM538123 128k x8 multi-port Video DRAM with 256-word x8 serial access memory (SOJ40) - HM62256 - Hitachi HM62256 32k x8 SRAM (SOP28) - BA10339F - Rohm BA10339F Quad Comparitor (SOIC14) - 6379 - NEC uPD6379 2-channel 16-bit D/A convertor for digital audio signal demodulation (SOIC8) - 15218 - Rohm BA15218 Dual High Slew Rate, Low Noise Operational Amplifier (SOIC8) - - Other - ----- - SW1 - Reset Switch - SW301 - ON/OFF Slide Switch - - -Carts ------ -There are reports of 11 existing carts. -Only 6 are available so far. - -XK-401: Anime Land -XK-402: HARIHARI Seal Paradise -XK-403: Dream Change -XK-404: Nigaoe Artist -XK-501: Wanwan Aijou Monogatari -XK-502: PC Collection - -The rest are not dumped yet..... - - -Lupiton's Wonder Palette -Magical Shop -Chakra-kun no Omajinai Paradise -XK-503: Little Romance -XK-504: I want a room in Loopy Town - - - -Inside the carts ----------------- - -Carts 401 - 404: -PCB 'JCM632-AN1M C' -1x 16M maskROM (SOP44) -1x 8k x8 SRAM (SOP28) -1x 3V coin battery (CR2032) - -Cart 501: -PCB 'Z544-1 A240427-1' -1x 16M maskROM (SOP44) -1x 8k x8 SRAM (SOP28) -1x OKI MSM6653A Voice Synthesis IC with 544Kbits internal maskROM (SOP24) -1x Rohm BA15218 High Slew Rate, Low Noise, Dual Operational Amplifier (SOIC8) -1x 74HC273 logic chip -1x 3V coin battery (CR2032) - -Cart 502: -PCB 'Z545-1 A240570-1' -1x 16M maskROM (SOP44) -1x 32k x8 SRAM (SOP28) -1x 74HC00 logic chip -1x 3V coin battery (CR2032) - -******************************************************************************/ - -#include "emu.h" -#include "cpu/sh2/sh2.h" -//#include "cpu/v60/v60.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class casloopy_state : public driver_device -{ -public: - casloopy_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_bios_rom(*this, "bios_rom"), - m_vregs(*this, "vregs"), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - required_shared_ptr m_bios_rom; - required_shared_ptr m_vregs; - required_device m_maincpu; - required_device m_cart; - required_device m_gfxdecode; - required_device m_palette; - - UINT16 *m_paletteram; - UINT8 *m_vram; - UINT8 *m_bitmap_vram; - UINT16 sh7021_regs[0x100]; - int m_gfx_index; - DECLARE_DRIVER_INIT(casloopy); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_casloopy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ16_MEMBER(vregs_r); - DECLARE_WRITE16_MEMBER(vregs_w); - DECLARE_READ16_MEMBER(pal_r); - DECLARE_WRITE16_MEMBER(pal_w); - DECLARE_READ8_MEMBER(vram_r); - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_READ32_MEMBER(cart_r); - DECLARE_READ16_MEMBER(sh7021_r); - DECLARE_WRITE16_MEMBER(sh7021_w); - DECLARE_READ8_MEMBER(bitmap_r); - DECLARE_WRITE8_MEMBER(bitmap_w); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(loopy_cart); -}; - - -static const gfx_layout casloopy_4bpp_layout = -{ - 8,8, - 0x10000/32, - 4, - { STEP4(0, 1) }, - { STEP8(0, 4) }, - { STEP8(0, 4*8) }, - 4*8*8 -}; - -static const gfx_layout casloopy_8bpp_layout = -{ - 8,8, - 0x10000/64, - 8, - { STEP8(0, 1) }, - { STEP8(0, 8) }, - { STEP8(0, 8*8) }, - 8*8*8 -}; - -void casloopy_state::video_start() -{ - /* TODO: proper sizes */ - m_paletteram = auto_alloc_array_clear(machine(), UINT16, 0x1000); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_bitmap_vram = auto_alloc_array_clear(machine(), UINT8, 0x20000); - - for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++) - if (m_gfxdecode->gfx(m_gfx_index) == 0) - break; - - for(int i=0;i<0x10000;i++) - m_vram[i] = i & 0xff; - - m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, casloopy_4bpp_layout, m_vram, 0, 0x10, 0))); - m_gfxdecode->set_gfx(m_gfx_index+1, global_alloc(gfx_element(m_palette, casloopy_8bpp_layout, m_vram, 0, 1, 0))); -} - -UINT32 casloopy_state::screen_update_casloopy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - gfx_element *gfx = m_gfxdecode->gfx(m_gfx_index); - int x,y; - int count; - - static int test; - - if(machine().input().code_pressed(KEYCODE_Z)) - test+=0x100; - - if(machine().input().code_pressed(KEYCODE_X)) - test-=0x100; - - //popmessage("%08x",test); - - #if 0 - int r,g,b; - - r = pal5bit((m_vregs[0x4/4] >> 10) & 0x1f); - g = pal5bit((m_vregs[0x4/4] >> 5) & 0x1f); - b = pal5bit((m_vregs[0x4/4] >> 0) & 0x1f); - m_palette->set_pen_color(0x100,rgb_t(r^0xff,g^0xff,b^0xff)); - bitmap.fill( 0x100 ,cliprect); - #endif - - count = test; - for (y=0;y<32;y++) - { - for (x=0;x<32;x++) - { - UINT16 tile = (m_vram[count+1])|(m_vram[count]<<8); - - tile &= 0x7ff; //??? - - gfx->transpen(bitmap,cliprect,tile,7,0,0,x*8,y*8,0xffffffff); - - count+=2; - } - } - - count = test; - - for (y=cliprect.min_y;yvblank() << 8) | (machine().rand() & 0xff); // vblank + vpos? - } - - if(offset == 2/2) - return machine().rand();/*(machine().first_screen()->hblank() << 8) | (machine().first_screen()->hpos() & 0xff);*/ // hblank + hpos? - - if(offset == 0/2) - return machine().rand(); // pccllect - - printf("%08x\n",offset*2); - - return 0xffff; -} - -WRITE16_MEMBER(casloopy_state::vregs_w) -{ - if(offset != 6/2) - printf("%08x %08x\n",offset*2,data); -} - -READ16_MEMBER(casloopy_state::pal_r) -{ - return m_paletteram[offset]; -} - -WRITE16_MEMBER(casloopy_state::pal_w) -{ - int r,g,b; - COMBINE_DATA(&m_paletteram[offset]); - - b = ((m_paletteram[offset])&0x001f)>>0; - g = ((m_paletteram[offset])&0x03e0)>>5; - r = ((m_paletteram[offset])&0x7c00)>>10; - - m_palette->set_pen_color(offset, pal5bit(r), pal5bit(g), pal5bit(b)); -} - -READ8_MEMBER(casloopy_state::vram_r) -{ - return m_vram[offset]; -} - -WRITE8_MEMBER(casloopy_state::vram_w) -{ - m_vram[offset] = data; - - m_gfxdecode->gfx(m_gfx_index)->mark_dirty(offset/32); - m_gfxdecode->gfx(m_gfx_index+1)->mark_dirty(offset/64); -} - -/* TODO: all of this should be internal to the SH core, this is just to check what it enables. */ -READ16_MEMBER(casloopy_state::sh7021_r) -{ - return sh7021_regs[offset]; -} - -WRITE16_MEMBER(casloopy_state::sh7021_w) -{ - COMBINE_DATA(&sh7021_regs[offset]); - - if(offset == 0x4e/2) - { - UINT32 src,dst,size,type; - - src = (sh7021_regs[0x40/2]<<16)|(sh7021_regs[0x42/2]&0xffff); - dst = (sh7021_regs[0x44/2]<<16)|(sh7021_regs[0x46/2]&0xffff); - size = (sh7021_regs[0x4a/2]&0xffff); - type = (sh7021_regs[0x4e/2]&0xffff); - - printf("0 %08x %08x %04x %04x\n",src & 0x7ffffff,dst & 0x7ffffff,size,type); - - sh7021_regs[0x4e/2]&=0xfffe; - } - - if(offset == 0x7e/2) - { - UINT32 src,dst,size,type; - - src = (sh7021_regs[0x70/2]<<16)|(sh7021_regs[0x72/2]&0xffff); - dst = (sh7021_regs[0x74/2]<<16)|(sh7021_regs[0x76/2]&0xffff); - size = (sh7021_regs[0x7a/2]&0xffff); - type = (sh7021_regs[0x7e/2]&0xffff); - - printf("3 %08x %08x %04x %04x\n",src & 0x7ffffff,dst & 0x7ffffff,size,type); - - sh7021_regs[0x7e/2]&=0xfffe; - } - -// printf("%08x %04x\n",sh7021_regs[offset],0x05ffff00+offset*2); -} - -READ8_MEMBER(casloopy_state::bitmap_r) -{ - return m_bitmap_vram[offset]; -} - -WRITE8_MEMBER(casloopy_state::bitmap_w) -{ - m_bitmap_vram[offset] = data; -} - -READ32_MEMBER(casloopy_state::cart_r) -{ - return m_cart->read32_rom(space, offset, mem_mask); -} - - -static ADDRESS_MAP_START( casloopy_map, AS_PROGRAM, 32, casloopy_state ) - AM_RANGE(0x00000000, 0x00007fff) AM_RAM AM_SHARE("bios_rom") - AM_RANGE(0x01000000, 0x0107ffff) AM_RAM AM_SHARE("wram")// stack pointer points here - AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE8(bitmap_r, bitmap_w, 0xffffffff) - AM_RANGE(0x04040000, 0x0404ffff) AM_READWRITE8(vram_r, vram_w, 0xffffffff) // tilemap + PCG - AM_RANGE(0x04050000, 0x040503ff) AM_RAM // ??? - AM_RANGE(0x04051000, 0x040511ff) AM_READWRITE16(pal_r, pal_w, 0xffffffff) - AM_RANGE(0x04058000, 0x04058007) AM_READWRITE16(vregs_r, vregs_w, 0xffffffff) - AM_RANGE(0x0405b000, 0x0405b00f) AM_RAM AM_SHARE("vregs") // RGB555 brightness control plus scrolling -// AM_RANGE(0x05ffff00, 0x05ffffff) AM_READWRITE16(sh7021_r, sh7021_w, 0xffffffff) -// AM_RANGE(0x05ffff00, 0x05ffffff) - SH7021 internal i/o - AM_RANGE(0x06000000, 0x061fffff) AM_READ(cart_r) - AM_RANGE(0x07000000, 0x070003ff) AM_RAM AM_SHARE("oram")// on-chip RAM, actually at 0xf000000 (1 kb) - AM_RANGE(0x09000000, 0x0907ffff) AM_RAM AM_SHARE("wram") - AM_RANGE(0x0e000000, 0x0e1fffff) AM_READ(cart_r) - AM_RANGE(0x0f000000, 0x0f0003ff) AM_RAM AM_SHARE("oram") -ADDRESS_MAP_END - -#if 0 -static ADDRESS_MAP_START( casloopy_sub_map, AS_PROGRAM, 16, casloopy_state ) - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("subcpu",0) -ADDRESS_MAP_END -#endif - -static INPUT_PORTS_START( casloopy ) -INPUT_PORTS_END - -void casloopy_state::machine_start() -{ -} - -void casloopy_state::machine_reset() -{ - //m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); //halt the CPU until we find enough data to proceed - -} - -#if 0 -static const gfx_layout casloopy_4bpp_layoutROM = -{ - 8,8, - RGN_FRAC(1,1), - 4, - { STEP4(0, 1) }, - { STEP8(0, 4) }, - { STEP8(0, 4*8) }, - 4*8*8 -}; - - -static const gfx_layout casloopy_8bpp_layoutROM = -{ - 8,8, - RGN_FRAC(1,1), - 8, - { STEP8(0, 1) }, - { STEP8(0, 8) }, - { STEP8(0, 8*8) }, - 8*8*8 -}; -#endif - - -DEVICE_IMAGE_LOAD_MEMBER( casloopy_state, loopy_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - UINT8 *SRC, *DST; - dynamic_buffer temp; - temp.resize(0x200000); - - m_cart->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_LITTLE); - - SRC = &temp[0]; - DST = m_cart->get_rom_base(); - m_cart->common_load_rom(&temp[0], size, "rom"); - - // fix endianness - for (int i = 0; i < 0x200000; i += 4) - { - UINT8 tempa = SRC[i + 0]; - UINT8 tempb = SRC[i + 1]; - DST[i + 0] = SRC[i + 2]; - DST[i + 1] = SRC[i + 3]; - DST[i + 2] = tempa; - DST[i + 3] = tempb; - } - - return IMAGE_INIT_PASS; -} - -static MACHINE_CONFIG_START( casloopy, casloopy_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",SH2A,8000000) - MCFG_CPU_PROGRAM_MAP(casloopy_map) - -// MCFG_CPU_ADD("subcpu",V60,8000000) -// MCFG_CPU_PROGRAM_MAP(casloopy_sub_map) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(8000000, 444, 0, 256, 263, 0, 224) - -// MCFG_SCREEN_REFRESH_RATE(60) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) -// MCFG_SCREEN_SIZE(444, 263) -// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(casloopy_state, screen_update_casloopy) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 512) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "loopy_cart") - MCFG_GENERIC_EXTENSIONS("bin,ic1") - MCFG_GENERIC_WIDTH(GENERIC_ROM32_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_LITTLE) - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(casloopy_state, loopy_cart) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","casloopy") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( casloopy ) - ROM_REGION( 0x80000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bios1", 0x0000, 0x8000, NO_DUMP ) // SH7021 uses 32 KB - - ROM_REGION( 0x80000, "subcpu", 0) //NEC CDT-109 - ROM_LOAD( "bios2.lsi352", 0x0000, 0x80000, CRC(8f51fa17) SHA1(99f50be06b083fdb07e08f30b0b26d9037afc869) ) -ROM_END - -DRIVER_INIT_MEMBER(casloopy_state,casloopy) -{ - /* load hand made bios data*/ - m_bios_rom[0/4] = 0x6000480;//0x600af3c;//0x6000964; //SPC - m_bios_rom[4/4] = 0x0000000; //SSP - - for(int i=0x400/4;i<0x8000/4;i++) - m_bios_rom[i] = 0x000b0009; // RTS + NOP -} - -CONS( 1995, casloopy, 0, 0, casloopy, casloopy, casloopy_state, casloopy, "Casio", "Loopy", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/cat.c b/src/mess/drivers/cat.c deleted file mode 100644 index 161441bb667..00000000000 --- a/src/mess/drivers/cat.c +++ /dev/null @@ -1,1843 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu -/*************************************************************************** - - Canon Cat, Model V777 - IAI Swyft Model P0001 - Copyright (C) 2009-2013 Miodrag Milanovic and Jonathan Gevaryahu AKA Lord Nightmare - With information and help from John "Sandy" Bumgarner, Dwight Elvey, - Charles Springer, Terry Holmes, Jonathan Sand, Aza Raskin and others. - - - This driver is dedicated in memory of Jef Raskin and Dave Boulton - - 12/06/2009 Skeleton driver. - 15/06/2009 Working driver - -Pictures: http://www.regnirps.com/Apple6502stuff/apple_iie_cat.htm - -Canon cat blue "Use Front Labels": -` (really degree, +-, paragraph-mark and section-mark): LEFT MARGIN --_: INDENT -+=: RIGHT MARGIN -UNDO: SPELL CHECK LEAP (this is actually a red LEAP label) -PERM SPACE/TAB: SET/CLEAR TAB -Q: UNDER LINE -W: BOLD -E: CAPS -T: Paragraph STYLE -U: LINE SPACE -O: ADD SPELLING -[ (really 1/4, 1/2, double-underline and |): SETUP -Backspace (really ERASE): ANSWER -LOCK: DOCUMENT LOCK -A: COPY -D: SEND CONTROL -G: CALC -J: PRINT -L: DISK -Colon: FORMAT/WIPE DISK (only when wheel! mode is enabled, see below) -"': PHONE -Enter (really RETURN): SEND -X: LOCAL LEAP -V: LEARN -N: EXPLAIN -,: SORT -?/: KBI/II -Pgup (really DOCUMENT/PAGE): TITLES -Leap Left: LEAP AGAIN (left) -Leap Right: LEAP AGAIN (right) - - -How to enable the FORTH interpreter (http://canoncat.org/canoncat/enableforth.html) - -The definitive instructions of going Forth on a Cat, tested on a living Cat. -The Canon Cat is programmed with FORTH, a remarkably different programming language in itself. -On the Canon Cat, you can access the FORTH interpreter with a special sequence of key presses. -Here are exact working instructions thanks to Sandy Bumgarner: -- Type Enable Forth Language exactly like that, capitals and all. -- Highlight from the En to the ge, exactly [i.e. Leap back to Enable by keeping the left Leap - key down while typing E n a, release the leap key, then click both leap keys simultaneously], - and press USE FRONT with ERASE (the ANSWER command). -- The Cat should beep and flash the ruler. -- Then press USE FRONT and the SHIFT keys together and tap the space bar. Note that the cursor - stops blinking. Now a Pressing the RETURN key gets the Forth OK and you are 'in' as they say. - -In MESS, to activate it as above: -* when the Cat boots, type (without quotes) "Enable Forth Language" -* hold left-alt(leap left) and type E n a, release left-alt (the left cursor is now at the first character) -* simultaneously press both alt keys for a moment and release both (the whole "Enable Forth Language" line will be selected) -* press control(use front) and press backspace(ERASE) (The cat will beep here) -* press control(use front), shift, and space (the cursor should stop blinking) -* press enter and the forth "ok" prompt should appear. you can type 'page' and enter to clear the screen -Optional further steps: -* type without quotes "-1 wheel! savesetup re" at the forth prompt to permanently - enable shift + use front + space to dump to forth mode easily -* change the keyboard setting in the setup menu (use front + [ ) to ASCII so you can type < and > -* after doing the -1 wheel! thing, you can compile a selected forth program in the editor - by selecting it and hitting ANSWER (use front + ERASE) - -If ever in forth mode you can return to the editor with the forth word (without quotes) "re" - -Canon cat gate array ASIC markings: -GA1 (prototype): D65013CW276 [same as final] -GA1 (final): NH4-5001 276 [schematic: upD65013CW-276] -GA2 (prototype): D65013CW208 [DIFFERENT FROM FINAL! larger asic used here, shrank for final?] -GA2 (final): NH4-5002 191 [schematic: upD65012CW-191] -GA3 (prototype): D65013CW141 [same as final? typo 65013 vs 65012?] -GA3 (final): NH4-5003 141 [schematic: upD65012CW-141] - -Canon cat credits easter egg: -* hold either leap key, then simultaneously hold shift, then type Q W E R A S D F Z X C V and release all the keys -* hit EXPLAIN (use front + N) and the credits screen will be displayed - -Canon Cat credits details: (WIP) -Scott Kim - responsible for fonts on swyft and cat -Ralph Voorhees - Model construction and mockups (swyft 'flat cat') - -Cat HLSL stuff: -*scanlines: -the cat has somewhat visible and fairly close scanlines with very little fuzziness -try hlsl options: -hlsl_prescale_x 4 -hlsl_prescale_y 4 -scanline_alpha 0.3 -scanline_size 1.0 -scanline_height 0.7 -scanline_bright_scale 1.0 -scanline_bright_offset 0.6 -*phosphor persistence of the original cat CRT is VERY LONG and fades to a greenish-yellow color, though the main color itself is white -try hlsl option: -phosphor_life 0.93,0.95,0.87 -which is fairly close but may actually be too SHORT compared to the real thing. - - -Swyft versions: -There are at least 4 variants of machines called 'swyft': -* The earliest desktop units which use plexi or rubber-tooled case and an - angled monitor; about a dozen were made and at least two of clear plexi. - These are sometimes called "wrinkled" swyfts. 5.25" drive, they may be able - to read Apple2 Swyftware/Swyftdisk and Swyftcard-created disks. - It is possible no prototypes of this type got beyond the 'runs forth console only' stage. - http://archive.computerhistory.org/resources/access/physical-object/2011/09/102746929.01.01.lg.JPG - http://www.digibarn.com/collections/systems/swyft/Swyft-No2-05-1271.jpg - http://www.digibarn.com/friends/jef-raskin/slides/iai/A%20-687%20SWYFTPRO.JPG -* The early "flat cat" or "roadkill" portable LCD screen units with a white - case and just a keyboard. Model SP0001 - http://www.digibarn.com/collections/systems/swyft/Image82.jpg -* The later "ur-cat" desktop units which use a machine tooled case and look - more or less like the canon cat. Around 100-200 were made. 3.5" drive. - These have a fully functional EDDE editor as the cat does, and can even compile - forth programs. - (the 'swyft' driver is based on one of these) -* The very late portable LCD units with a dark grey case and a row of hotkey - buttons below the screen. Not dumped yet. At least one functional prototype exists. - At least one plastic mockup exists with no innards. - http://www.digibarn.com/collections/systems/swyft/swyft.jpg - -Canon Cat versions: -There is really only one version of the cat which saw wide release, the US version. -* It is possible a very small number of UK/European units were released as a test. - If so, these will have slightly different keyboard key caps and different - system and spellcheck roms. - -As for prototypes/dev cat machines, a few minor variants exist: -* Prototype cat motherboards used 16k*4bit drams instead of 64k*4bit as the - final system did and hence max out at 128k of dram instead of 512k. - One of the gate arrays is also different, and the motherboard is arranged - differently. The IC9 "buserr" PAL is not used, even on the prototype. - The final system included 256k of dram and can be upgraded to 512k. -* At least some developer units were modified to have an external BNC - connector, ostensibly to display the internal screen's video externally. - http://www.digibarn.com/collections/systems/canon-cat/Image55.jpg - - -Canon Cat: - -Crystals: -X1: 19.968Mhz, used by GA2 (plus a PLL to multiply by 2?), and divide by 4 for - cpuclk, divide by 8 for 2.5mhz and divide by 5.5 for 3.63mhz (is this - supposed to be divide by 6? there may not be a pll if it is...) -X2: 3.579545Mhz, used by the DTMF generator chip AMI S2579 at IC40 -X3: 2.4576Mhz, used by the modem chip AMI S35213 at IC37 - -IAI Swyft: -Board name: 950-0001C -"INFORMATION APPLIANCE INC. COPYRIGHT 1985" - _________________|||||||||___________________________________________________________________________________ -| J8 [=======J3=======] ____ Trans- | -== / \ (E2) former | -==Jx 74LS107 J5 |PB1 | uA339 MC3403 -----| -| 7407 \____/ J7 = -| Y1 "TIMING B" 74LS132 74LS175 -----| -| ____________ 4N37 Relay -----| -| TMS4256 74LS161 "DECODE E" "DISK 3.5C" | | J6 = -| | MC6850P | -----| -| TMS4256 74LS166 74HCT259 74LS299 '------------' MC3403 MC3403 _____| -| ___________________ ___________________ || | = -| TMS4256 74LS373 | | | | J2 | J1 = -| | MC68008P8 | | R6522P | || I P R | = -| TMS4256 74F153 '-------------------' '-------------------' MN4053 || MN4053 N R E | B = -| (E1) D O S | R = -| TMS4256 74F153 74HCT08 __________ ___________________ MC14412 DS1489 U E T I | E = -| | | | | || C S E S | A = -| TMS4256 74F153 74HC4040E | AM27256 | | R6522P | || T D C T | K = -| '----------' '-------------------' || INFORMATION O T O | O = -| TMS4256 74F153 "VIDEO 2B" .----------. J4 APPLIANCE INC. R I R | U = -| | AM27256 | 74HC02 74HC374 || Copyright 1985 S O S | T = -| TMS4256 74F153 74LS393 B1|__________| || UM95089 Y2 N | = -|_____________________________[________J9___]__________________________________________________D13______|_____= - -*Devices of interest: -J1: breakout of joystick, serial/rs232, hex-keypad, parallel port, and forth switch (and maybe cassette?) pins - DIL 60 pin 2-row right-angle rectangular connector with metal shield contact; - not all 60 pins are populated in the connector, only pins 1-6, 8, 13-15, 17-18, 23-30, 35-60 are present - (traced partly by dwight) -J2: unpopulated 8-pin sip header, serial/rs232-related? - (vcc ? ? ? ? ? ? gnd) (random guess: txd, rxd, rts, cts, dsr, dtr, and one pin could be cd/ri though the modem circuit may do that separately?) -J3: Floppy Connector - (standard DIL 34 pin 2-row rectangular connector for mini-shugart/pc floppy cable; pin 2 IS connected somewhere and ?probably? is used for /DISKCHANGE like on an Amiga, with pin 34 being /TRUEREADY?) - (as opposed to normal ibm pc 3.5" drives where pin 2 is unconnected or is /DENSITY *input to drive*, and pin 34 is /DISKCHANGE) -J4: 18-pin sip header for keyboard ribbon cable; bottom edge of board is pin 1 - Pins: - 1: GND through 220k resistor r78 - 2: ? phone hook related? anode of diode d7; one of the pins of relay k2; topmost (boardwise) pin of transistor Q10 - 3: 74HCT34 pin - -J5: locking-tab-type "CONN HEADER VERT 4POS .100 TIN" connector for supplying power - through a small cable with a berg connector at the other end, to the floppy drive - (5v gnd gnd 12v) -J6: Phone connector, rj11 jack -J7: Line connector, rj11 jack -J8: 9-pin Video out/power in connector "CONN RECEPT 6POS .156 R/A PCB" plus "CONN RECEPT 3POS .156 R/A PCB" acting as one 9-pin connector - (NC ? ? ? NC NC ? 12v 5v) (video, vsync, hsync and case/video-gnd are likely here) - (the video pinout of the cat is: (Video Vsync Hsync SyncGnd PwrGnd PwrGnd +5v(VCC) +12v(VDD) -12v(VEE)) which is not the same as the swyft. -J9: unpopulated DIL 40-pin straight connector for a ROM debug/expansion/RAM-shadow daughterboard - the pins after pin 12 connect to that of the ROM-LO 27256 pinout counting pins 1,28,2,27,3,26,etc - the ROM-HI rom has a different /HICE pin which is not connected to this connector - /LOCE is a15 - /HICE is !a15 - /ROM_OE comes from pin 14 of DECODE_E pal, and is shorted to /ROM_OE' by the cuttable jumper B1 which is not cut - /ROM_OE' goes to the two EPROMS - DECODE_18 is DECODE_E pal pin 18 - pin 1 (GND) is in the lower left and the pins count low-high then to the right - (gnd N/C E_CLK R/W /ROM_OE a17 vcc a14 a13 a8 a9 a11 /ROM_OE' a10 a15 d7 d6 d5 d4 d3 ) - (GND /IPL1 DECODE_18 /RESET gnd a16 vcc a12 a7 a6 a5 a4 a3 a2 a1 a0 d0 d1 d2 gnd) -Jx: 4 pin on top side, 6 pin on bottom side edge ?debug? connector (doesn't have a Jx number) - (trace me!) -B1: a cuttable trace on the pcb. Not cut, affects one of the pins on the unpopulated J9 connector only. -E1: jumper, unknown purpose, not set -E2: jumper, unknown purpose, not set -D13: LED -R6522P (upper): parallel port via -R6522P (lower): keyboard via -UM95089: DTMF Tone generator chip (if you read the datasheet this is technically ROM based!) -Y1: 15.8976Mhz, main clock? -Y2: 3.579545Mhz, used by the DTMF generator chip UM95089 (connects to pins 7 and 8 of it) -TMS4256-15NL - 262144 x 1 DRAM -PB1 - piezo speaker - -*Pals: -"TIMING B" - AMPAL16R4APC (marked on silkscreen "TIMING PAL") -"DECODE E" - AMPAL16L8PC (marked on silkscreen "DECODE PAL") -"VIDEO 2B" - AMPAL16R4PC (marked on silkscreen "VIDEO PAL") -"DISK 3.5C" - AMPAL16R4PC (marked on silkscreen "DISK PAL") - -*Deviations from silkscreen: -4N37 (marked on silkscreen "4N35") -74F153 (marked on silkscreen "74ALS153") -74HCT259 is socketed, possibly intended that the rom expansion daughterboard will have a ribbon cable fit in its socket? - - -ToDo: -* Canon Cat -- Find the mirrors for the write-only video control register and figure out - what the writes actually do; hook these up properly to screen timing etc -- Floppy drive (3.5", Single Sided Double Density MFM, ~400kb) - * Cat has very low level control of data being read or written, much like - the Amiga or AppleII does - * first sector is id ZERO which is unusual since most MFM formats are base-1 - for sector numbering - * sectors are 512 bytes, standard MFM with usual address and data marks and - ccitt crc16 - * track 0 contains sector zero repeated identically 10 times; the cat SEEMS - to use this as a disk/document ID - * tracks 1-79 each contain ten sectors, id 0x0 thru 0x9 - ('normal' mfm parlance: sectors -1, 0, 1, ... 7, 8) - * this means the whole disk effectively contains 512*10*80 = 409600 bytes of - data, though track 0 is just a disk "unique" identifier for the cat - meaning 404480 usable bytes - * (Once the floppy is working I'd declare the system working) -- Centronics port finishing touches: verify where the paper out, slct/err, and - IPP pins map in memory. The firmware doesn't actually use them, but they must - map somewhere as they connect to the ASIC. -- RS232C port and Modem "port" connected to the DUART's two ports - These are currently optionally debug-logged but don't connect anywhere -- DTMF generator chip (connected to DUART 'user output' pins OP4,5,6,7) -- WIP: Watchdog timer/powerfail at 0x85xxxx (watchdog NMI needs to actually - fire if wdt goes above a certain number, possibly 3, 7 or F?) -- Canon Cat released versions known: 1.74 US (dumped), 2.40 US (dumped both - original compile, and Dwight's recompile from the released source code), - 2.42 (NEED DUMP) - It is possible a few prototype UK 1.74 or 2.40 units were produced; the code - roms of these will differ (they contain different spellcheck "core" code) as - well as the spellcheck roms, the keyboard id and the keycaps. -- Known Spellcheck roms: NH7-0684 (US, dumped); NH7-0724 (UK, NEED DUMP); - NH7-0813/0814 (Quebec/France, NEED DUMP); NH7-1019/1020/1021 (Germany, NEED DUMP) - It is possible the non-US roms were never officially released. - Wordlist sources: American Heritage (US and UK), Librarie Larousse (FR), - Langenscheidt (DE) -- (would-be-really-nice-but-totally-unnecessary feature): due to open bus, the - svrom1 and svrom2 checksums in diagnostics read as 01A80000 and 01020000 - respectively on a real machine (and hence appear inverted/'fail'-state). - This requires sub-cycle accurate 68k open bus emulation to pull off, as well - as emulating the fact that UDS/LDS are ?not connected? (unclear because this - happens inside an asic) for the SVROMS (or the svram or the code roms, for - that matter!) -- Hook Battery Low input to a dipswitch. -- Hook pfail to a dipswitch. -- Hook the floppy control register readback up properly, things seem to get - confused. - - -* Swyft -- Figure out the keyboard (interrupts are involved? or maybe an NMI on a - timer/vblank? It is possible this uses a similar 'keyboard read int' - to what the cat does) -- get the keyboard scanning actually working; the VIAs are going nuts right now. -- Beeper (on one of the vias?) -- vblank/hblank stuff -- Get the 6850 ACIA working for communications -- Floppy (probably similar to the Cat) -- Centronics port (attached to one of the VIAs) -- Joystick port (also likely on a via) -- Keypad? (also likely on a via done as a grid scan?) -- Forth button (on the port on the back; keep in mind shift-usefront-space ALWAYS enables forth on a swyft) -- Multple undumped firmware revisions exist (330 and 331 are dumped) - -// 74ls107 @ u18 pin 1 is 68008 /BERR pin - -// mc6850 @ u33 pin 2 (RX_DATA) is -// mc6850 @ u33 pin 3 (RX_CLK) is 6522 @ u35 pin 17 (PB7) -// mc6850 @ u33 pin 4 (TX_CLK) is 6522 @ u35 pin 17 (PB7) -// mc6850 @ u33 pin 5 (/RTS) is -// mc6850 @ u33 pin 6 (TX_DATA) is -// mc6850 @ u33 pin 7 (/IRQ) is 68008 /IPL1 pin 41 -// mc6850 @ u33 pin 8 (CS0) is 68008 A12 pin 10 -// mc6850 @ u33 pin 9 (CS2) is DECODE E pin 18 -// mc6850 @ u33 pin 10 (CS1) is 68008 /BERR pin 40 -// mc6850 @ u33 pin 11 (RS) is 68008 A0 pin 46 -// mc6850 @ u33 pin 13 (R/W) is 68008 R/W pin 30 -// mc6850 @ u33 pin 14 (E) is 68008 E pin 38 -// mc6850 @ u33 pin 15-22 (D7-D0) are 68008 D7 to D0 pins 20-27 -// mc6850 @ u33 pin 23 (/DCD) is 74hc02 @ u35 pin 1 -// mc6850 @ u33 pin 24 (/CTS) is N/C? - -// 6522 @ u34: -// pin 2 (PA0) : -// pin 3 (PA1) : -// pin 4 (PA2) : -// pin 5 (PA3) : -// pin 6 (PA4) : -// pin 7 (PA5) : -// pin 8 (PA6) : -// pin 9 (PA7) : -// pin 10 (PB0) : -// pin 11 (PB1) : -// pin 12 (PB2) : -// pin 13 (PB3) : -// pin 14 (PB4) : -// pin 15 (PB5) : -// pin 16 (PB6) : -// pin 17 (PB7) : -// pin 18 (CB1) : ?from/to? Floppy connector j3 pin 8 -// pin 19 (CB2) : ?from/to? 6522 @ u35 pin 16 (PB6) -// pin 21 (/IRQ) : out to 68008 /IPL1 pin 41 -// pin 22 (R/W) : in from 68008 R/W pin 30 -// pin 23 (/CS2) : in from DECODE E pin 18 -// pin 24 (CS1) : in from 68008 A13 pin 11 -// pin 25 (Phi2) : in from 68008 E pin 38 -// pins 26-33 : in/out from/to 68008 D7 to D0 pins 20-27 -// pin 34 (/RES) : in from 68008 /RESET pin 37 AND 68008 /HALT pin 36 -// pins 35-38 (RS3-RS0) are 68008 A9-A6 pins 7-4 -// pin 39 (CA2) is through inductor L11 and resistor r128 to peripheral connector pin 35 -// pin 40 (CA1) is through inductor L30 and resistor r138 to peripheral connector pin 53 - -// 6522 @ u35 -// pin 2 (PA0) : -// pin 3 (PA1) : -// pin 4 (PA2) : -// pin 5 (PA3) : -// pin 6 (PA4) : -// pin 7 (PA5) : -// pin 8 (PA6) : -// pin 9 (PA7) : -// pin 10 (PB0) : -// pin 11 (PB1) : in from 74hc02 @ u36 pin 4 -// pin 12 (PB2) : -// pin 13 (PB3) : -// pin 14 (PB4) : -// pin 15 (PB5) : -// pin 16 (PB6) : 6522 @ u34 pin 19 (CB2) -// pin 17 (PB7) : mc6850 @ u33 pins 3 and 4 (RX_CLK, TX_CLK) -// pin 18 (CB1) : ds1489an @ u45 pin 11 -// pin 19 (CB2) : mn4053b @ u40 pin 11 and mc14412 @ u41 pin 10 -// pin 21 (/IRQ) : out to 68008 /IPL1 pin 41 -// pin 22 (R/W) : in from 68008 R/W pin 30 -// pin 23 (/CS2) : in from DECODE E pin 18 -// pin 24 (CS1) : in from 68008 A14 pin 12 -// pin 25 (Phi2) : in from 68008 E pin 38 -// pins 26-33 : in/out from/to 68008 D7 to D0 pins 20-27 -// pin 34 (/RES) : in from 68008 /RESET pin 37 AND 68008 /HALT pin 36 -// pins 35-38 (RS3-RS0) : in from 68008 A9-A6 pins 7-4 -// pin 39 (CA2) : out to 74HCT34 pin 11 (CLK) (keyboard column latch) -// pin 40 (CA1) : out? to? ds1489an @ u45 pin 8 - -// 74hc02 @ u36: -// pin 1 (Y1) : out to mc6850 @ u33 pin 23 /DCD -// pin 2 (A1) : in from (2 places: resistor R58 to ua339 @ u38 pin 4 (In1-)) -// pin 3 (B1) : in from mn4053b @ u40 pin 10 -// pin 4 (Y2) : out to 6522 @u35 pin 11 -// pin 5 (A2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) -// pin 6 (B2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) -// pin 8 (B3) : -// pin 9 (A3) : -// pin 10 (Y3) : -// pin 11 (B4) : in from 68008 A15 -// pin 12 (A4) : in from 68008 A15 -// pin 13 (Y4) : out to EPROM @ U31 /CE - -****************************************************************************/ - -// Defines - -#undef DEBUG_GA2OPR_W -#undef DEBUG_VIDEO_CONTROL_W - -#undef DEBUG_FLOPPY_CONTROL_W -#undef DEBUG_FLOPPY_CONTROL_R -#undef DEBUG_FLOPPY_DATA_W -#undef DEBUG_FLOPPY_DATA_R -#undef DEBUG_FLOPPY_STATUS_R - -#undef DEBUG_PRINTER_DATA_W -#undef DEBUG_PRINTER_CONTROL_W - -#undef DEBUG_MODEM_R -#undef DEBUG_MODEM_W - -#undef DEBUG_DUART_OUTPUT_LINES -// data sent to rs232 port -#undef DEBUG_DUART_TXA -// data sent to modem chip -#undef DEBUG_DUART_TXB -#undef DEBUG_DUART_IRQ_HANDLER -#undef DEBUG_PRN_FF - -#undef DEBUG_TEST_W - -#define DEBUG_SWYFT_VIA0 1 -#define DEBUG_SWYFT_VIA1 1 - - -// Includes -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/clock.h" -#include "machine/mc68681.h" -#include "machine/6850acia.h" -#include "machine/6522via.h" -#include "machine/nvram.h" -#include "sound/speaker.h" -#include "bus/centronics/ctronics.h" - -class cat_state : public driver_device -{ -public: - enum - { - TIMER_KEYBOARD, - TIMER_COUNTER_6MS - }; - - cat_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - //m_nvram(*this, "nvram"), // merge with svram? - m_duart(*this, "duartn68681"), - m_ctx(*this, "ctx"), - m_ctx_data_out(*this, "ctx_data_out"), - m_acia6850(*this, "acia6850"), - m_via0(*this, "via6522_0"), - m_via1(*this, "via6522_1"), - m_speaker(*this, "speaker"), - m_svram(*this, "svram"), // nvram - m_p_cat_videoram(*this, "p_cat_vram"), - m_p_swyft_videoram(*this, "p_swyft_vram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_dipsw(*this, "DIPSW1") - { } - - required_device m_maincpu; - //optional_device m_nvram; - optional_device m_duart; // only cat uses this - optional_device m_ctx; - optional_device m_ctx_data_out; - optional_device m_acia6850; // only swyft uses this - optional_device m_via0; // only swyft uses this - optional_device m_via1; // only swyft uses this - optional_device m_speaker; - optional_shared_ptr m_svram; - optional_shared_ptr m_p_cat_videoram; - optional_shared_ptr m_p_swyft_videoram; - optional_ioport m_y0; - optional_ioport m_y1; - optional_ioport m_y2; - optional_ioport m_y3; - optional_ioport m_y4; - optional_ioport m_y5; - optional_ioport m_y6; - optional_ioport m_y7; - optional_ioport m_dipsw; - emu_timer *m_keyboard_timer; - emu_timer *m_6ms_timer; - - DECLARE_MACHINE_START(cat); - DECLARE_MACHINE_RESET(cat); - DECLARE_VIDEO_START(cat); - DECLARE_DRIVER_INIT(cat); - DECLARE_MACHINE_START(swyft); - DECLARE_MACHINE_RESET(swyft); - DECLARE_VIDEO_START(swyft); - - UINT32 screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE_LINE_MEMBER(cat_duart_irq_handler); - DECLARE_WRITE_LINE_MEMBER(cat_duart_txa); - DECLARE_WRITE_LINE_MEMBER(cat_duart_txb); - DECLARE_WRITE8_MEMBER(cat_duart_output); - DECLARE_WRITE_LINE_MEMBER(prn_ack_ff); - - DECLARE_READ16_MEMBER(cat_floppy_control_r); - DECLARE_WRITE16_MEMBER(cat_floppy_control_w); - DECLARE_WRITE16_MEMBER(cat_printer_data_w); - DECLARE_READ16_MEMBER(cat_floppy_data_r); - DECLARE_WRITE16_MEMBER(cat_floppy_data_w); - DECLARE_READ16_MEMBER(cat_keyboard_r); - DECLARE_WRITE16_MEMBER(cat_keyboard_w); - DECLARE_WRITE16_MEMBER(cat_video_control_w); - DECLARE_READ16_MEMBER(cat_floppy_status_r); - DECLARE_READ16_MEMBER(cat_battery_r); - DECLARE_WRITE16_MEMBER(cat_printer_control_w); - DECLARE_READ16_MEMBER(cat_modem_r); - DECLARE_WRITE16_MEMBER(cat_modem_w); - DECLARE_READ16_MEMBER(cat_6ms_counter_r); - DECLARE_WRITE16_MEMBER(cat_opr_w); - DECLARE_READ16_MEMBER(cat_wdt_r); - DECLARE_WRITE16_MEMBER(cat_tcb_w); - DECLARE_READ16_MEMBER(cat_2e80_r); - DECLARE_READ16_MEMBER(cat_0080_r); - DECLARE_READ16_MEMBER(cat_0000_r); - - DECLARE_READ8_MEMBER(swyft_d0000); - - DECLARE_READ8_MEMBER(swyft_via0_r); - DECLARE_WRITE8_MEMBER(swyft_via0_w); - DECLARE_READ8_MEMBER(via0_pa_r); - DECLARE_WRITE8_MEMBER(via0_pa_w); - DECLARE_WRITE_LINE_MEMBER(via0_ca2_w); - DECLARE_READ8_MEMBER(via0_pb_r); - DECLARE_WRITE8_MEMBER(via0_pb_w); - DECLARE_WRITE_LINE_MEMBER(via0_cb1_w); - DECLARE_WRITE_LINE_MEMBER(via0_cb2_w); - DECLARE_WRITE_LINE_MEMBER(via0_int_w); - - DECLARE_READ8_MEMBER(swyft_via1_r); - DECLARE_WRITE8_MEMBER(swyft_via1_w); - DECLARE_READ8_MEMBER(via1_pa_r); - DECLARE_WRITE8_MEMBER(via1_pa_w); - DECLARE_WRITE_LINE_MEMBER(via1_ca2_w); - DECLARE_READ8_MEMBER(via1_pb_r); - DECLARE_WRITE8_MEMBER(via1_pb_w); - DECLARE_WRITE_LINE_MEMBER(via1_cb1_w); - DECLARE_WRITE_LINE_MEMBER(via1_cb2_w); - DECLARE_WRITE_LINE_MEMBER(via1_int_w); - - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - - /* gate array 2 has a 16-bit counter inside which counts at 10mhz and - rolls over at FFFF->0000; on roll-over (or likely at FFFF terminal count) - it triggers the KTOBF output. It does this every 6.5535ms, which causes - a 74LS74 d-latch at IC100 to invert the state of the DUART IP2 line; - this causes the DUART to fire an interrupt, which makes the 68000 read - the keyboard. - The watchdog counter and the 6ms counter are both incremented - every time the KTOBF pulses. - */ - UINT16 m_6ms_counter; - UINT8 m_wdt_counter; - UINT8 m_duart_ktobf_ff; - /* the /ACK line from the centronics printer port goes through a similar - flipflop to the ktobf line as well, so duart IP4 inverts on /ACK rising edge - */ - UINT8 m_duart_prn_ack_prev_state; - UINT8 m_duart_prn_ack_ff; - /* Gate array 2 is in charge of serializing the video for display to the screen; - Gate array 1 is in charge of vblank/hblank timing, and in charge of refreshing - dram and indicating to GA2, using the /LDPS signal, what times the address it is - writing to ram it is intending to be used by GA2 to read 16 bits of data to be - shifted out to the screen. (it is obviously not active during hblank and vblank) - GA2 then takes: ((output_bit XNOR video_invert) AND video enable), and serially - bangs the result to the analog display circuitry. - */ - UINT8 m_video_enable; - UINT8 m_video_invert; - UINT16 m_pr_cont; - UINT8 m_keyboard_line; - UINT8 m_floppy_control; - - //TIMER_CALLBACK_MEMBER(keyboard_callback); - TIMER_CALLBACK_MEMBER(counter_6ms_callback); - IRQ_CALLBACK_MEMBER(cat_int_ack); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -// TODO: this init doesn't actually work yet! please fix me! -/* -DRIVER_INIT_MEMBER( cat_state,cat ) -{ - UINT8 *svrom = memregion("svrom")->base(); - int i; - // fill svrom with the correct 2e80 pattern except where svrom1 sits - // first half - for (i = 0; i < 0x20000; i+=2) - svrom[i] = 0x2E; - // second half - for (i = 0x20000; i < 0x40000; i+=2) - { - svrom[i] = 0x2E; - svrom[i+1] = 0x80; - } -}*/ - -/* 0x600000-0x65ffff Write: Video Generator (AKA NH4-5001 AKA Gate Array #1 @ IC30) - writing to the video generator is done by putting the register number in the high 3 bits - and the data to write in the lower 12 (14?) bits. - The actual data-bus data written here is completely ignored, - in fact it isn't even connected to the gate array; The firmware writes 0x0000. - hence: - 0 = must be 0 - s = register select - d = data to write - ? = unknown - x = ignored - ? 1 1 ? ? s s s s ? ? ? ? ? ? d d d d d d d d . - 600xxx - VSE (End of Frame) - 608xxx - VST (End of VSync) - 610xxx - VSS (VSync Start) - 618xxx - VDE (Active Lines) = value written * 4 - 620xxx - unknown - 628xxx - unknown - 630xxx - unknown - 638xxx - unknown - 640xxx - HSE (End H Line) - 648xxx - HST (End HSync) - 650xxx - HSS (HSync Start) - 658xxx - VOC (Video Control) - */ -WRITE16_MEMBER( cat_state::cat_video_control_w ) -{ - /* - * 006500AE , ( HSS HSync Start 89 ) - * 006480C2 , ( HST End HSync 96 ) - * 006400CE , ( HSE End H Line 104 ) - * 006180B0 , ( VDE Active Lines 344 ) - * 006100D4 , ( VSS VSync Start 362 ) - * 006080F4 , ( VST End of VSync 378 ) - * 00600120 , ( VSE End of Frame 400 ) - * 006581C0 , ( VOC Video Control Normal Syncs ) - * based on diagrams from https://archive.org/details/DTCJefRaskinDoc062 - * we can determine what at least some of these values do: - * HORIZONTAL: - * 0 is the first pixel output to the screen at the end of the frontporch - * stuff is shifted to the screen here, and then zeroed for the backporch; manual claims backporch is 2 cycles, it is actually 7 - * HSS (89) is the horizontal count at which the HSYNC pin goes high - * sync is active here for 7 cycles; manual claims 10 but is wrong - * HST (96) is the horizontal count at which the HSYNC pin goes low - * sync is inactive here for 7 cycles, manual claims 8 but is wrong?, this is the frontporch - * HSE (104) is the horizontal count at which the horizontal counter is reset to 0 (so counts 0-103 then back to 0) - * - * VERTICAL: - * 0 is the first vertical line displayed to screen - * VDE (344) affects the number of lines that /LDPS is active for display of - * VSS (362) is the vertical line at which the VSYNC pin goes high - * VST (378) is the vertical line at which the VSYNC pin goes low - * VSE (400) is the vertical line at which the vertical line count is reset to 0 - * VOC (0x1c0) controls the polarity and enabling of the sync signals in some unknown way - * Suffice to say, whatever bit combination 0b00011100000x does, it enables both horiz and vert sync and both are positive - */ -#ifdef DEBUG_VIDEO_CONTROL_W - static const char *const regDest[16] = { "VSE (End of frame)", "VST (End of VSync)", "VSS (Start of VSync)", "VDE (Active Lines)", "unknown 620xxx", "unknown 628xxx", "unknown 630xxx", "unknown 638xxx", "HSE (end of horizontal line)", "HST (end of HSync)", "HSS (HSync Start)", "VOC (Video Control)", "unknown 660xxx", "unknown 668xxx", "unknown 670xxx", "unknown 678xxx" }; - fprintf(stderr,"Write to video chip address %06X; %02X -> register %s with data %04X\n", 0x600000+(offset<<1), offset&0xFF, regDest[(offset&0x3C000)>>14], data); -#endif -} - -// Floppy control register (called fd.cont in the cat source code) - /* FEDCBA98 (76543210 is open bus) - * |||||||\-- unknown[1] (may be some sort of 'reset' or debug bit? the cat code explicitly clears this bit but never sets it) - * ||||||\--- WRITE GATE: 0 = write head disabled, 1 = write head enabled (verified from cat source code) - * |||||\---- unknown[2] (leftover debug bit? unused by cat code) - * ||||\----- /DIRECTION: 1 = in, 0 = out (verified from forth cmd) - * |||\------ /SIDESEL: 1 = side1, 0 = side0 (verified from forth cmd) - * ||\------- STEP: 1 = STEP active, 0 = STEP inactive (verified from cat source code) - * |\-------- MOTOR ON: 1 = on, 0 = off (verified) - * \--------- /DRIVESELECT: 1 = drive 0, 0 = drive 1 (verified from forth cmd) - * all 8 bits 'stick' on write and are readable at this register as well - * [1] writing this bit as high seems to 'freeze' floppy acquisition so - * the value at the floppy_data_r register is held rather than updated - * with new data from the shifter/mfm clock/data separator - * [2] this bit's function is unknown. it could possibly be an FM vs MFM selector bit, where high = MFM, low = FM ? or MFM vs GCR? - */ -// 0x800000-0x800001 read -READ16_MEMBER( cat_state::cat_floppy_control_r ) -{ -#ifdef DEBUG_FLOPPY_CONTROL_R - fprintf(stderr,"Read from Floppy Status address %06X\n", 0x800000+(offset<<1)); -#endif - return (m_floppy_control << 8)|0x80; // LOW 8 BITS ARE OPEN BUS -} -// 0x800000-0x800001 write -WRITE16_MEMBER( cat_state::cat_floppy_control_w ) -{ -#ifdef DEBUG_FLOPPY_CONTROL_W - fprintf(stderr,"Write to Floppy Control address %06X, data %04X\n", 0x800000+(offset<<1), data); -#endif - m_floppy_control = (data >> 8)&0xFF; -} - -// 0x800002-0x800003 read = 0x0080, see open bus -// 0x800002-0x800003 write -WRITE16_MEMBER( cat_state::cat_keyboard_w ) -{ - m_keyboard_line = data >> 8; -} - -// 0x800004-0x800005 'pr.data' write -// /DSTB (centronics pin 1) is implied by the cat source code to be pulsed -// low (for some unknown period of time) upon any write to this port. -WRITE16_MEMBER( cat_state::cat_printer_data_w ) -{ -#ifdef DEBUG_PRINTER_DATA_W - fprintf(stderr,"Write to Printer Data address %06X, data %04X\n", 0x800004+(offset<<1), data); -#endif - m_ctx_data_out->write(data>>8); - m_ctx->write_strobe(1); - m_ctx->write_strobe(0); - m_ctx->write_strobe(1); -} -// 0x800006-0x800007: Floppy data register (called fd.dwr in the cat source code) -READ16_MEMBER( cat_state::cat_floppy_data_r ) -{ -#ifdef DEBUG_FLOPPY_DATA_R - fprintf(stderr,"Read from Floppy Data address %06X\n", 0x800006+(offset<<1)); -#endif - return 0x0080; -} -WRITE16_MEMBER( cat_state::cat_floppy_data_w ) -{ -#ifdef DEBUG_FLOPPY_DATA_W - fprintf(stderr,"Write to Floppy Data address %06X, data %04X\n", 0x800006+(offset<<1), data); -#endif -} - -// 0x800008-0x800009: Floppy status register (called fd.status in the cat source code) - /* FEDCBA98 (76543210 is open bus) - * |||||||\-- ? always low - * ||||||\--- ? always low - * |||||\---- READY: 1 = ready, 0 = not ready (verified from cat source code) - * ||||\----- /WRITE PROTECT: 1 = writable, 0 = protected (verified) - * |||\------ /TRACK0: 0 = on track 0, 1 = not on track 0 (verified) - * ||\------- /INDEX: 0 = index sensor active, 1 = index sensor inactive (verified) - * |\-------- ? this bit may indicate which drive is selected, i.e. same as floppy control bit 7; low on drive 1, high on drive 0? - * \--------- ? this bit may indicate 'data separator overflow'; it is usually low but becomes high if you manually select the floppy drive - ALL of these bits except bit F seem to be reset when the selected drive in floppy control is switched - */ -READ16_MEMBER( cat_state::cat_floppy_status_r ) -{ -#ifdef DEBUG_FLOPPY_STATUS_R - fprintf(stderr,"Read from Floppy Status address %06X\n", 0x800008+(offset<<1)); -#endif - return 0x2480; -} - -// 0x80000a-0x80000b -READ16_MEMBER( cat_state::cat_keyboard_r ) -{ - UINT16 retVal = 0; - // Read country code - if ((m_pr_cont&0xFF00) == 0x0900) - retVal = m_dipsw->read(); - - // Regular keyboard read - if ((m_pr_cont&0xFF00) == 0x0800 || (m_pr_cont&0xFF00) == 0x0a00) - { - retVal=0xff00; - switch(m_keyboard_line) - { - case 0x01: retVal = m_y0->read() << 8; break; - case 0x02: retVal = m_y1->read() << 8; break; - case 0x04: retVal = m_y2->read() << 8; break; - case 0x08: retVal = m_y3->read() << 8; break; - case 0x10: retVal = m_y4->read() << 8; break; - case 0x20: retVal = m_y5->read() << 8; break; - case 0x40: retVal = m_y6->read() << 8; break; - case 0x80: retVal = m_y7->read() << 8; break; - } - } -#if 0 - if (((m_pr_cont&0xFF00) != 0x0800) && ((m_pr_cont&0xFF00) != 0x0900) && ((m_pr_cont&0xFF00) != 0x0a00)) - { - fprintf(stderr,"Read from keyboard in %06X with unexpected pr_cont %04X\n", 0x80000a+(offset<<1), m_pr_cont); - } -#endif - return retVal; -} - -// 0x80000c-0x80000d (unused in cat source code; may have originally been a separate read only port where 800006 would have been write-only) - -// 0x80000e-0x80000f 'pr.cont' read -READ16_MEMBER( cat_state::cat_battery_r ) -{ - /* - * FEDCBA98 (76543210 is open bus) - * |||||||\-- ? possibly PE (pin 1) read ("PAPER OUT" pin 12 of centronics port) - * ||||||\--- ? possibly SLCT/ERR (pin 3) read ("not selected or error" NAND of pins 32 and 13 of centronics port) - * |||||\---- (always 0?) - * ||||\----- (always 0?) - * |||\------ (always 0?) - * ||\------- (always 0?) - * |\-------- (always 0?) - * \--------- Battery status (0 = good, 1 = bad) - */ - /* just return that battery is full, i.e. bit 15 is 0 */ - /* to make the cat think the battery is bad, return 0x8080 instead of 0x0080 */ - // TODO: hook this to a dipswitch - return 0x0080; -} -// 0x80000e-0x80000f 'pr.cont' write -WRITE16_MEMBER( cat_state::cat_printer_control_w ) -{ - /* - * FEDCBA98 (76543210 is ignored) - * |||||||\-- CC line enable (pin 34) (verified from cat source code) - * ||||||\--- LEDE line enable (pin 33) (verified from cat source code) - * |||||\---- ? - * ||||\----- ? may be IPP (pin 2) write (non-standard pin 34 of centronics port) or another watchdog reset bit; may also be /DSTB-enable-on-pr.data-write - * |||\------ ? - * ||\------- ? - * |\-------- ? - * \--------- ? - */ - // writes of 0x0A00 turn on the keyboard LED on the LOCK key - // writes of 0x0800 turn off the keyboard LED on the LOCK key -#ifdef DEBUG_PRINTER_CONTROL_W - fprintf(stderr,"Write to Printer Control address %06X, data %04X\n", (offset<<1)+0x80000e, data); -#endif - m_pr_cont = data; -} - -// 0x820000: AMI S35213 300/1200 Single Chip Modem (datasheet found at http://bitsavers.trailing-edge.com/pdf/ami/_dataBooks/1985_AMI_MOS_Products_Catalog.pdf on pdf page 243) -READ16_MEMBER( cat_state::cat_modem_r ) -{ -#ifdef DEBUG_MODEM_R - fprintf(stderr,"Read from s35213 modem address %06X\n", 0x820000+(offset<<1)); -#endif -// HACK: return default 'sane' modem state - return 0x00; -} - -WRITE16_MEMBER( cat_state::cat_modem_w ) -{ -#ifdef DEBUG_MODEM_W - fprintf(stderr,"Write to s35213 modem address %06X, data %04X\n", 0x820000+(offset<<1), data); -#endif -} - -// 0x830000: 6ms counter (counts KTOBF pulses and does not reset; 16 bits wide) -READ16_MEMBER( cat_state::cat_6ms_counter_r ) -{ - return m_6ms_counter; -} - -/* 0x840001: 'opr' or 'ga2opr' Output Port Register (within GA2) - * writing anything with bit 3 set here resets the watchdog - * if the watchdog expires /NMI (and maybe /RESET) are asserted to the cpu - * watchdog counter (counts KTOBF pulses and is reset on any ga2opr write with bit 3 set; <9 bits wide) - */ -WRITE16_MEMBER( cat_state::cat_opr_w ) -{ - /* - * 76543210 (FEDCBA98 are ignored) - * |||||||\-- OFFHOOK pin (pin 3) output control (1 = puts phone off hook by energizing relay K2) - * ||||||\--- PHONE pin (pin 4) output control (1 = connects phone and line together by energizing relay K1) - * |||||\---- Video enable (1 = video on, 0 = video off/screen black) - * ||||\----- Watchdog reset (the watchdog is reset whenever this bit is written with a 1) - * |||\------ Video invert (1 = black-on-white video; 0 = white-on-black) - * ||\------- (unused?) - * |\-------- (unused?) - * \--------- (unused?) - */ -#ifdef DEBUG_GA2OPR_W - if (data != 0x001C) - fprintf(stderr, "GA2 OPR (video ena/inv, watchdog, and phone relay) reg write: offset %06X, data %04X\n", 0x840000+(offset<<1), data); -#endif - if (data&0x08) m_wdt_counter = 0; - m_video_enable = BIT( data, 2 ); - m_video_invert = 1-BIT( data, 4 ); -} - -// 0x850000: 'wdt' "watchdog timer and power fail", read only? - /* NOTE: BELOW IS A GUESS based on seeing what the register reads as, - * the cat code barely touches this stuff at all, despite the fact - * that the service manual states that PFAIL is supposed to be checked - * before each write to SVRAM, the forth code does NOT actually do that! - * - * 76543210 - * ??????\\-- Watchdog count? (counts upward? if this reaches the watchdog fires? writing bit 3 set to opr above resets this) - * - * FEDCBA98 - * |||||||\-- PFAIL state (MB3771 comparator: 1: vcc = 5v; 0: vcc != 5v, hence do not write to svram!) - * ||||||\--- (always 0?) - * |||||\---- (always 0?) - * ||||\----- (always 0?) - * |||\------ (always 0?) - * ||\------- (always 0?) - * |\-------- (always 0?) - * \--------- (always 0?) - */ -READ16_MEMBER( cat_state::cat_wdt_r ) -{ - uint16 Retval = 0x0100; // set pfail to 1; should this be a dipswitch? - return Retval | m_wdt_counter; -} - -// 0x860000: 'tcb' "test control bits" test mode register; what the bits do is -// unknown. 0x0000 is written here to disable test mode, and that is the extent -// of the cat touching this register. -WRITE16_MEMBER( cat_state::cat_tcb_w ) -{ -#ifdef DEBUG_TEST_W - fprintf(stderr, "Test reg write: offset %06X, data %04X\n", 0x860000+(offset<<1), data); -#endif -} - -// open bus etc handlers -READ16_MEMBER( cat_state::cat_2e80_r ) -{ - return 0x2e80; -} - -READ16_MEMBER( cat_state::cat_0000_r ) -{ - return 0x0000; -} - -READ16_MEMBER( cat_state::cat_0080_r ) -{ - return 0x0080; -} - - -/* Canon cat memory map, based on testing and a 16MB dump of the entire address space of a running unit using forth "1000000 0 do i c@ semit loop" -68k address map: -a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 (a0 via UDS/LDS) -*i *i * x x * * * x x x x x x x x x x x x x x x x *GATE ARRAY 2 DECODES THESE LINES TO ENABLE THIS AREA* (a23 and a22 are indirectly decoded via the /RAMROMCS and /IOCS lines from gate array 1) -0 0 0 x x 0 a * * * * * * * * * * * * * * * * b R ROM (ab: 00=ic4 01=ic2 10=ic5 11=ic3) (EPROM 27C512 x 4) [controlled via GA2 /ROMCS] -0 0 0 x x 1 0 0 x x * * * * * * * * * * * * * 0 RW SVRAM ic11 d4364 (battery backed) [controlled via GA2 /RAMCS] -0 0 0 x x 1 x 1 x x x x x x x x x x x x x x x 0 O OPEN BUS (reads as 0x2e) [may be controlled via GA2 /RAMCS?] -0 0 0 x x 1 1 0 x x x x x x x x x x x x x x x 0 O OPEN BUS (reads as 0x2e) [may be controlled via GA2 /RAMCS?] -0 0 0 x x 1 x x x x x x x x x x x x x x x x x 1 O OPEN BUS (reads as 0x80) [may be controlled via GA2 /RAMCS?] -0 0 1 x x 0 * * * * * * * * * * * * * * * * * 0 R SVROM 2 ic7 (not present on cat as sold, open bus reads as 0x2e) [controlled via GA2 /SVCS0] -0 0 1 x x 0 * * * * * * * * * * * * * * * * * 1 R SVROM 0 ic6 (MASK ROM tc531000) [controlled via GA2 /SVCS0] -0 0 1 x x 1 * * * * * * * * * * * * * * * * * 0 O OPEN BUS (reads as 0x2e) [controlled via GA2 /SVCS1] *SEE BELOW* -0 0 1 x x 1 * * * * * * * * * * * * * * * * * 1 R SVROM 1 ic8 (not present on cat as sold, open bus reads as 0x80) [controlled via GA2 /SVCS1] *SEE BELOW* - *NOTE: on Dwight E's user-made developer unit, two 128K SRAMS are mapped in place of the two entries immediately above!* (this involves some creative wiring+sockets); the official IAI 'shadow ram board' maps the ram to the A00000-A3FFFF area instead) -0 1 * * * * * * * * * * * * * * * * * * * * * * *BOTH GATE ARRAYS 1 and 2 DECODE THIS AREA; 2 DEALS WITH ADDR AND 1 WITH DATA/CAS/RAS* -0 1 0 x x a b * * * * * * * * * * * * * * * * * RW VIDEO/SYSTEM DRAM (ab: 00=row 0, ic26-29; 01=row 1, ic22-25; 10=row 2; ic18-21; 11=row 3; ic14-17) - *NOTE: DRAM rows 2 and 3 above are only usually populated in cat developer units!* -0 1 1 ? ? * * * ? ? ? ? ? ? ? * * * * * * * * x W VIDEO CONTRL REGISTERS (reads as 0x2e80) -1 x x x x x x x x x x x x x x x x x x * * * * * *GATE ARRAY 3 DECODES THIS AREA, GA3 IS ENABLED BY /IOCS1 FROM GA2* -1 0 0 Y Y 0 0 0 x x x x x x x x x x x * * * * 0 {'ga3'} *IO AREA* Note byte reads in this area behave erratically if both Y bits are set while word reads work fine always - x x x x 1 O OPEN BUS (reads as 0x80) - 0 0 0 0 0 RW {'fd.cont'} Floppy control lines (drive select, motor on, direction, step, side select, ?write gate?) - 0 0 0 1 0 W {'kb.wr'} Keyboard Row Select (reads as 0x00) - 0 0 1 0 0 W {'pr.data'} Centronics Printer Data W (reads as 0x00) - 0 0 1 1 0 RW {'fd.dwr' and 'fd.drd'} Floppy data read/write register; maybe the write gate value in fd.cont chooses which? - 0 1 0 0 0 R {'fd.status'} Floppy status lines (write protect, ready, index, track0) - 0 1 0 1 0 R Keyboard Column Read - 0 1 1 0 0 W? Unknown (reads as 0x00) - 0 1 1 1 0 RW {'pr.cont'} Read: Battery status (MSB bit, 0 = ok, 1 = dead, other bits read as 0)/Write: Centronics Printer and Keyboard LED/Country Code Related - 1 x x x 0 W? Unknown (reads as 0x00) -1 0 0 x x 0 0 1 x x x x x x x x x x x * * * * 1 RW {'duart'} 68681 DUART at ic34 [controlled via GA2 /DUARTCS] -1 0 0 x x 0 1 0 x x x x x x x x x x * * * * * 0 RW {'modem'} Modem Chip AMI S35213 @ IC37 DATA BIT 7 ONLY [controlled via GA2 /SMCS] -1 0 0 x x 0 1 1 x x x x x x x x x x x x x x x * R {'timer'} Read: Fixed 16-bit counter from ga2. increments every 6.5535ms when another 16-bit counter clocked at 10mhz overflows -1 0 0 x x 1 0 0 x x x x x x x x x x x x x x x * W {'opr'} Output Port (Video/Sync enable and watchdog reset?) register (screen enable on bit 3?) (reads as 0x2e80) -1 0 0 x x 1 0 1 x x x x x x x x x x x x x x x * R {'wdt'} Watchdog timer reads as 0x0100 0x0101 or 0x0102, some sort of test register or video status register? -1 0 0 x x 1 1 0 x x x x x x x x x x x x x x x * R?W {'tcb'} test control bits (reads as 0x0000) -1 0 0 x x 1 1 1 x x x x x x x x x x x x x x x * ? Unknown (reads as 0x2e80) - -1 0 1 x x x x x x x x x x x x x x x x x x x x x O OPEN BUS (reads as 0x2e80) [68k DTACK is asserted by gate array 1 when accessing this area, for testing?] On real IAI shadow rom board, at least 0x40000 of ram lives here. -1 1 x x x x x x x x x x x x x x x x x x x x x x O OPEN BUS (reads as 0x2e80) [68k VPA is asserted by gate array 1 when accessing this area, for testing?] -*/ - - -static ADDRESS_MAP_START(cat_mem, AS_PROGRAM, 16, cat_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_MIRROR(0x180000) // 256 KB ROM - AM_RANGE(0x040000, 0x043fff) AM_RAM AM_SHARE("svram") AM_MIRROR(0x18C000)// SRAM powered by battery - AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("svrom",0x0000) AM_MIRROR(0x180000) // SV ROM - AM_RANGE(0x400000, 0x47ffff) AM_RAM AM_SHARE("p_cat_vram") AM_MIRROR(0x180000) // 512 KB RAM - AM_RANGE(0x600000, 0x67ffff) AM_READWRITE(cat_2e80_r,cat_video_control_w) AM_MIRROR(0x180000) // Gate Array #1: Video Addressing and Timing, dram refresh timing, dram /cs and /wr (ga2 does the actual video invert/display and access to the dram data bus) - AM_RANGE(0x800000, 0x800001) AM_READWRITE(cat_floppy_control_r, cat_floppy_control_w) AM_MIRROR(0x18FFE0) // floppy control lines and readback - AM_RANGE(0x800002, 0x800003) AM_READWRITE(cat_0080_r, cat_keyboard_w) AM_MIRROR(0x18FFE0) // keyboard col write - AM_RANGE(0x800004, 0x800005) AM_READWRITE(cat_0080_r, cat_printer_data_w) AM_MIRROR(0x18FFE0) // Centronics Printer Data - AM_RANGE(0x800006, 0x800007) AM_READWRITE(cat_floppy_data_r,cat_floppy_data_w) AM_MIRROR(0x18FFE0) // floppy data read/write - AM_RANGE(0x800008, 0x800009) AM_READ(cat_floppy_status_r) AM_MIRROR(0x18FFE0) // floppy status lines - AM_RANGE(0x80000a, 0x80000b) AM_READ(cat_keyboard_r) AM_MIRROR(0x18FFE0) // keyboard row read - AM_RANGE(0x80000c, 0x80000d) AM_READ(cat_0080_r) AM_MIRROR(0x18FFE0) // Open bus? - AM_RANGE(0x80000e, 0x80000f) AM_READWRITE(cat_battery_r,cat_printer_control_w) AM_MIRROR(0x18FFE0) // Centronics Printer Control, keyboard led and country code enable - AM_RANGE(0x800010, 0x80001f) AM_READ(cat_0080_r) AM_MIRROR(0x18FFE0) // Open bus? - AM_RANGE(0x810000, 0x81001f) AM_DEVREADWRITE8("duartn68681", mc68681_device, read, write, 0xff ) AM_MIRROR(0x18FFE0) - AM_RANGE(0x820000, 0x82003f) AM_READWRITE(cat_modem_r,cat_modem_w) AM_MIRROR(0x18FFC0) // AMI S35213 Modem Chip, all access is on bit 7 - AM_RANGE(0x830000, 0x830001) AM_READ(cat_6ms_counter_r) AM_MIRROR(0x18FFFE) // 16bit 6ms counter clocked by output of another 16bit counter clocked at 10mhz - AM_RANGE(0x840000, 0x840001) AM_READWRITE(cat_2e80_r,cat_opr_w) AM_MIRROR(0x18FFFE) // GA2 Output port register (video enable, invert, watchdog reset, phone relays) - AM_RANGE(0x850000, 0x850001) AM_READ(cat_wdt_r) AM_MIRROR(0x18FFFE) // watchdog and power fail state read - AM_RANGE(0x860000, 0x860001) AM_READWRITE(cat_0000_r, cat_tcb_w) AM_MIRROR(0x18FFFE) // Test mode - AM_RANGE(0x870000, 0x870001) AM_READ(cat_2e80_r) AM_MIRROR(0x18FFFE) // Open bus? - AM_RANGE(0xA00000, 0xA00001) AM_READ(cat_2e80_r) AM_MIRROR(0x1FFFFE) // Open bus/dtack? The 0xA00000-0xA3ffff area is ram used for shadow rom storage on cat developer machines, which is either banked over top of, or jumped to instead of the normal rom - AM_RANGE(0xC00000, 0xC00001) AM_READ(cat_2e80_r) AM_MIRROR(0x3FFFFE) // Open bus/vme? -ADDRESS_MAP_END - -/* Input ports */ - -/* 2009-07 FP - FIXME: Natural keyboard does not catch all the Shifted chars. No idea of the reason! */ -static INPUT_PORTS_START( cat ) - PORT_START("DIPSW1") - PORT_DIPNAME( 0x8000, 0x8000, "Mode" ) - PORT_DIPSETTING( 0x8000, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x0000, "Diagnostic" ) - PORT_DIPNAME( 0x7f00,0x7f00, "Country code" ) - PORT_DIPSETTING( 0x7f00, "United States" ) - PORT_DIPSETTING( 0x7e00, "Canada" ) - PORT_DIPSETTING( 0x7d00, "United Kingdom" ) - PORT_DIPSETTING( 0x7c00, "Norway" ) - PORT_DIPSETTING( 0x7b00, "France" ) - PORT_DIPSETTING( 0x7a00, "Denmark" ) - PORT_DIPSETTING( 0x7900, "Sweden" ) - PORT_DIPSETTING( 0x7800, DEF_STR(Japan) ) - PORT_DIPSETTING( 0x7700, "West Germany" ) - PORT_DIPSETTING( 0x7600, "Netherlands" ) - PORT_DIPSETTING( 0x7500, "Spain" ) - PORT_DIPSETTING( 0x7400, "Italy" ) - PORT_DIPSETTING( 0x7300, "Latin America" ) - PORT_DIPSETTING( 0x7200, "South Africa" ) - PORT_DIPSETTING( 0x7100, "Switzerland" ) - PORT_DIPSETTING( 0x7000, "ASCII" ) - - PORT_START("Y0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\xa2') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START("Y1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('n') PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - - PORT_START("Y2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // totally unused - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START("Y3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left USE FRONT") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // totally unused - - PORT_START("Y4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right USE FRONT") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_F2) // intl only: latin diaresis and latin !; norway, danish and finnish * and '; others - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - - PORT_START("Y5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\xbd') PORT_CHAR('\xbc') //PORT_CHAR('}') PORT_CHAR('{') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("Y6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_F1) // intl only: latin inv ? and inv !; norway and danish ! and |; finnish <>; others - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left LEAP") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('[') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // totally unused - - PORT_START("Y7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Leap") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Page") PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // totally unused - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UNDO") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\xb1') PORT_CHAR('\xb0') // PORT_CHAR('\\') PORT_CHAR('~') -INPUT_PORTS_END - -static INPUT_PORTS_START( swyft ) -// insert dwight and sandy's swyft keyboard map here once we figure out the byte line order -INPUT_PORTS_END - - -void cat_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_COUNTER_6MS: - counter_6ms_callback(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in cat_state::device_timer"); - } -} - -TIMER_CALLBACK_MEMBER(cat_state::counter_6ms_callback) -{ - // This is effectively also the KTOBF (guessed: acronym for "Keyboard Timer Out Bit Flip") - // line connected in such a way to invert the d-flipflop connected to the duart IP2 - m_duart_ktobf_ff ^= 1; - m_duart->ip2_w(m_duart_ktobf_ff); - m_wdt_counter++; - m_6ms_counter++; -} - -IRQ_CALLBACK_MEMBER(cat_state::cat_int_ack) -{ - m_maincpu->set_input_line(M68K_IRQ_1,CLEAR_LINE); - return M68K_INT_ACK_AUTOVECTOR; -} - -MACHINE_START_MEMBER(cat_state,cat) -{ - m_duart_ktobf_ff = 0; // reset doesn't touch this - m_duart_prn_ack_prev_state = 1; // technically uninitialized - m_duart_prn_ack_ff = 0; // reset doesn't touch this - m_6ms_counter = 0; - m_wdt_counter = 0; - m_video_enable = 1; - m_video_invert = 0; - m_6ms_timer = timer_alloc(TIMER_COUNTER_6MS); - machine().device("nvram")->set_base(m_svram, 0x4000); -} - -MACHINE_RESET_MEMBER(cat_state,cat) -{ - m_6ms_counter = 0; - m_wdt_counter = 0; - m_floppy_control = 0; - m_6ms_timer->adjust(attotime::zero, 0, attotime::from_hz((XTAL_19_968MHz/2)/65536)); -} - -VIDEO_START_MEMBER(cat_state,cat) -{ -} - -UINT32 cat_state::screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 code; - int y, x, b; - - int addr = 0; - if (m_video_enable == 1) - { - for (y = 0; y < 344; y++) - { - int horpos = 0; - for (x = 0; x < 42; x++) - { - code = m_p_cat_videoram[addr++]; - for (b = 15; b >= 0; b--) - { - bitmap.pix16(y, horpos++) = ((code >> b) & 0x01) ^ m_video_invert; - } - } - } - } else { - const rectangle black_area(0, 672 - 1, 0, 344 - 1); - bitmap.fill(0, black_area); - } - return 0; -} - -/* The duart is the only thing actually connected to the cpu IRQ pin - * The KTOBF output of the gate array 2 (itself the terminal count output - * of a 16-bit counter clocked at ~10mhz, hence 6.5536ms period) goes to a - * d-latch and inputs on ip2 of the duart, causing the duart to fire an irq; - * this is used by the cat to read the keyboard. - * The duart also will, if configured to do so, fire an int when the state - * changes of the centronics /ACK pin; this is used while printing. - */ -WRITE_LINE_MEMBER(cat_state::cat_duart_irq_handler) -{ - int irqvector = m_duart->get_irq_vector(); - -#ifdef DEBUG_DUART_IRQ_HANDLER - fprintf(stderr, "Duart IRQ handler called: state: %02X, vector: %06X\n", state, irqvector); -#endif - m_maincpu->set_input_line_and_vector(M68K_IRQ_1, state, irqvector); -} - -WRITE_LINE_MEMBER(cat_state::cat_duart_txa) // semit sends stuff here; connects to the serial port on the back -{ -#ifdef DEBUG_DUART_TXA - fprintf(stderr, "Duart TXA: data %02X\n", state); -#endif -} - -WRITE_LINE_MEMBER(cat_state::cat_duart_txb) // memit sends stuff here; connects to the modem chip -{ -#ifdef DEBUG_DUART_TXB - fprintf(stderr, "Duart TXB: data %02X\n", state); -#endif -} - -/* mc68681 DUART Input pins: - * IP0: CTS [using the DUART builtin hardware-CTS feature?] - * IP1: Centronics /ACK (pin 10) positive edge detect (IP1 changes state 0->1 or 1->0 on the rising edge of /ACK using a 74ls74a d-flipflop) - * IP2: KTOBF (IP2 changes state 0->1 or 1->0 on the rising edge of KTOBF using a 74ls74a d-flipflop; KTOBF is a 6.5536ms-period squarewave generated by one of the gate arrays, I need to check with a scope to see whether it is a single spike/pulse every 6.5536ms or if from the gate array it inverts every 6.5536ms, documentation isn't 100% clear but I suspect the former) [uses the Delta IP2 state change detection feature to generate an interrupt; I'm not sure if IP2 is used as a counter clock source but given the beep frequency of the real unit I very much doubt it, 6.5536ms is too slow] - * IP3: RG ("ring" input) - * IP4: Centronics BUSY (pin 11), inverted - * IP5: DSR - */ - -/* mc68681 DUART Output pins: - * OP0: RTS [using the DUART builtin hardware-RTS feature?] - * OP1: DTR - * OP2: /TDCS (select/enable the S2579 DTMF tone generator chip) - * OP3: speaker out [using the 'channel b 1X tx or rx clock output' or more likely the 'timer output' feature to generate a squarewave] - * OP4: TD03 (data bus for the S2579 DTMF tone generator chip) - * OP5: TD02 " - * OP6: TD01 " - * OP7: TD00 " - */ -WRITE8_MEMBER(cat_state::cat_duart_output) -{ -#ifdef DEBUG_DUART_OUTPUT_LINES - fprintf(stderr,"Duart output io lines changed to: %02X\n", data); -#endif - m_speaker->level_w((data >> 3) & 1); -} - -WRITE_LINE_MEMBER(cat_state::prn_ack_ff) // switch the flipflop state on the rising edge of /ACK -{ - if ((m_duart_prn_ack_prev_state == 0) && (state == 1)) - { - m_duart_prn_ack_ff ^= 1; - } - m_duart->ip1_w(m_duart_prn_ack_ff); - m_duart_prn_ack_prev_state = state; -#ifdef DEBUG_PRN_FF - fprintf(stderr, "Printer ACK: state %02X, flipflop is now %02x\n", state, m_duart_prn_ack_ff); -#endif -} - -static MACHINE_CONFIG_START( cat, cat_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M68000, XTAL_19_968MHz/4) - MCFG_CPU_PROGRAM_MAP(cat_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(cat_state,cat_int_ack) - - MCFG_MACHINE_START_OVERRIDE(cat_state,cat) - MCFG_MACHINE_RESET_OVERRIDE(cat_state,cat) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(672, 344) - MCFG_SCREEN_VISIBLE_AREA(0, 672-1, 0, 344-1) - MCFG_SCREEN_UPDATE_DRIVER(cat_state, screen_update_cat) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_VIDEO_START_OVERRIDE(cat_state,cat) - - MCFG_MC68681_ADD( "duartn68681", (XTAL_19_968MHz*2)/11 ) // duart is normally clocked by 3.6864mhz xtal, but cat seemingly uses a divider from the main xtal instead which probably yields 3.63054545Mhz. There is a trace to cut and a mounting area to allow using an actual 3.6864mhz xtal if you so desire - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(cat_state, cat_duart_irq_handler)) - MCFG_MC68681_A_TX_CALLBACK(WRITELINE(cat_state, cat_duart_txa)) - MCFG_MC68681_B_TX_CALLBACK(WRITELINE(cat_state, cat_duart_txb)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(cat_state, cat_duart_output)) - - MCFG_CENTRONICS_ADD("ctx", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(cat_state, prn_ack_ff)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("duartn68681", mc68681_device, ip4_w)) MCFG_DEVCB_XOR(1) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("ctx_data_out", "ctx") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - - -/* Swyft Memory map, based on watching the infoapp roms do their thing: -68k address map: -(a23,a22,a21,a20 lines don't exist on the 68008 so are considered unconnected) -a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 -x x x x 0 0 ? ? 0 * * * * * * * * * * * * * * * R ROM-LO (/LOCE is 0, /HICE is 1) -x x x x 0 0 ? ? 1 * * * * * * * * * * * * * * * R ROM-HI (/LOCE is 1, /HICE is 0) -x x x x 0 1 * * * * * * * * * * * * * * * * * a RW RAM -x x x x 1 1 ?0? ?1? ? ? ? ? ? ? ? ? ? ? ? ? * * * * R ? status of something? floppy? -x x x x 1 1 ?1? ?0? ? 0 0 1 x x x x x x x x x x x * RW 6850 acia @U33, gets 0x55 steadystate and 0x57 written to it to reset it -x x x x 1 1 ?1? ?0? ? 0 1 0 x x * * * * x x x x x x RW Parallel VIA 0 @ U34 -x x x x 1 1 ?1? ?0? ? 1 0 0 x x * * * * x x x x x x RW Keyboard VIA 1 @ U35 - ^ ^ ^ ^ ^ - -*/ - -/* Swyft rom and ram notes: -rom: -**Vectors: -0x0000-0x0003: SP boot vector -0x0004-0x0007: PC boot vector -**unknown: -0x0009-0x00BF: ? table -0x00C0-0x01DF: ? table -0x01E0-0x02DF: ? table (may be part of next table) -0x02E0-0x03DF: ? table -0x03E0-0x0B3F: int16-packed jump table (expanded to int32s at ram at 0x46000-0x46EC0 on boot) -0x0B40-0x0E83: ? function index tables? -0x0E84-0x1544: binary code (purpose?) -0x1545-0x24CF: ? -**Fonts: -0x24D0-0x254F: ? (likely font 1 width lookup table) -0x2550-0x2BCF: Font 1 data -0x2BD0-0x2C4F: ? (likely font 2 width lookup table) -0x2C50-0x32CF: Font 2 data -**unknown?: -0x32D0-0x360F: String data (and control codes?) -0x3610-0x364F: ? fill (0x03 0xe8) -0x3650-0x369F: ? fill (0x03 0x20) -0x36A0-0x384d: ? forth code? -0x384e-0x385d: Lookup table for phone keypad -0x385e-...: ? -...-0xC951: ? -0xC952: boot vector -0xC952-0xCAAE: binary code (purpose?) - 0xCD26-0xCD3B: ?init forth bytecode? -0xCD3C-0xCEBA: 0xFF fill (unused?) -0xCEEB-0xFFFE: Forth dictionaries for compiling, with then <3 bytes> afterward? (or before it? most likely afterward) - -ram: (system dram ranges from 0x40000-0x7FFFF) -0x40000-0x425CF - the screen display ram -(?0x425D0-0x44BA0 - ?unknown (maybe screen ram page 2?)) -0x44DC6 - SP vector -0x46000-0x46EC0 - jump tables to instructions for ? (each forth word?) - - -on boot: -copy/expand packed rom short words 0x3E0-0xB3F to long words at 0x46000-0x46EC0 -copy 0x24f longwords of zero beyond that up to 0x47800 -CD26->A5 -44DC6->A7 -44F2A->A6 -EA2->A4 -E94->A3 -EAE->A2 -41800->D7 -46e3c->D4 -CD22->D5 -write 0xFFFF to d0004.l -jump to A4(EA2) - -read first stream byte (which is 0x03) from address pointed to by A5 (which is CD26), inc A5, OR the opcode (0x03) to D7 - (Note: if the forth opcodes are in order in the dictionary, then 0x03 is "!char" which is used to read a char from an arbitrary address) -copy D7 to A0 -Add A0 low word to itself -Add A0 low word to itself again -move the long word from address pointed to by A0 (i.e. the specific opcode's area at the 46xxx part of ram) to A1 -Jump to A1(11A4) - -11A4: move 41b00 to D0 (select an opcode "page" 1bxx) -jump to 118E - -118E: read next stream byte (in this case, 0x8E) from address pointed to by A5 (which is CD27), inc A5, OR the opcode (0x8e) to D7 -add to 41b00 in d0, for 41b8E -Add A0 low word to itself -Add A0 low word to itself again -move the long word from address pointed to by A0 (i.e. the specific opcode's area at the 46xxx part of ram) to A1 -Jump to A1(CD06) - -CD06: jump to A3 (E94) - -E94: subtract D5 from A5 (cd28 - cd22 = 0x0006) -write 6 to address @A5(44f28) and decrement A5 -write D4(46e3c) to address @a6(44f26) and decrement a5 -lea ($2, A1), A5 - i.e. increment A1 by 2, and write that to A5, so write CD06+2=CD08 to A5 -A1->D5 -A0->D4 -read next stream byte (in this case, 0x03) from address pointed to by A5 (which is CD08), inc A5, OR the opcode (0x03) to D7 - -*/ - -static ADDRESS_MAP_START(swyft_mem, AS_PROGRAM, 8, cat_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_MIRROR(0xF00000) // 64 KB ROM - AM_RANGE(0x040000, 0x07ffff) AM_RAM AM_MIRROR(0xF00000) AM_SHARE("p_swyft_vram") // 256 KB RAM - AM_RANGE(0x0d0000, 0x0d000f) AM_READ(swyft_d0000) AM_MIRROR(0xF00000) // status of something? reads from d0000, d0004, d0008, d000a, d000e - AM_RANGE(0x0e1000, 0x0e1000) AM_DEVWRITE("acia6850", acia6850_device, control_w) AM_MIRROR(0xF00000) // 6850 ACIA lives here - AM_RANGE(0x0e2000, 0x0e2fff) AM_READWRITE(swyft_via0_r, swyft_via0_w) AM_MIRROR(0xF00000)// io area with selector on a9 a8 a7 a6? - AM_RANGE(0x0e4000, 0x0e4fff) AM_READWRITE(swyft_via1_r, swyft_via1_w) AM_MIRROR(0xF00000) -ADDRESS_MAP_END - -MACHINE_START_MEMBER(cat_state,swyft) -{ - m_via0->write_ca1(1); - m_via0->write_ca2(1); - m_via0->write_cb1(1); - m_via0->write_cb2(1); - - m_via1->write_ca1(1); - m_via1->write_ca2(1); - m_via1->write_cb1(1); - m_via1->write_cb2(1); -} - -MACHINE_RESET_MEMBER(cat_state,swyft) -{ -} - -VIDEO_START_MEMBER(cat_state,swyft) -{ -} - -UINT32 cat_state::screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 code; - int y, x, b; - - int addr = 0; - for (y = 0; y < 242; y++) - { - int horpos = 0; - for (x = 0; x < 40; x++) - { - code = m_p_swyft_videoram[addr++]; - for (b = 7; b >= 0; b--) - { - bitmap.pix16(y, horpos++) = (code >> b) & 0x01; - } - } - } - return 0; -} - -READ8_MEMBER( cat_state::swyft_d0000 ) -{ - // wtf is this supposed to be? - UINT8 byte = 0xFF; // ? - logerror("mystery device: read from 0x%5X, returning %02X\n", offset+0xD0000, byte); - return byte; -} - - -// if bit is 1 enable: (obviously don't set more than one bit or you get bus contention!) -// acia -// via0 -// via1 -// x x x x 1 1 ?1? ?0? ? ^ ^ ^ ? ? * * * * ?*? ? ? ? ? ? -// ^ ^ ^ ^ <- these four bits address the VIA registers? is this correct? -static const char *const swyft_via_regnames[] = { "0: ORB/IRB", "1: ORA/IRA", "2: DDRB", "3: DDRA", "4: T1C-L", "5: T1C-H", "6: T1L-L", "7: T1L-H", "8: T2C-L" "9: T2C-H", "A: SR", "B: ACR", "C: PCR", "D: IFR", "E: IER", "F: ORA/IRA*" }; - -READ8_MEMBER( cat_state::swyft_via0_r ) -{ - if (offset&0x000C3F) fprintf(stderr,"VIA0: read from invalid offset in 68k space: %06X!\n", offset); - UINT8 data = m_via0->read(space, (offset>>6)&0xF); -#ifdef DEBUG_SWYFT_VIA0 - logerror("VIA0 register %s read by cpu: returning %02x\n", swyft_via_regnames[(offset>>5)&0xF], data); -#endif - return data; -} - -WRITE8_MEMBER( cat_state::swyft_via0_w ) -{ -#ifdef DEBUG_SWYFT_VIA0 - logerror("VIA0 register %s written by cpu with data %02x\n", swyft_via_regnames[(offset>>5)&0xF], data); -#endif - if (offset&0x000C3F) fprintf(stderr,"VIA0: write to invalid offset in 68k space: %06X, data: %02X!\n", offset, data); - m_via1->write(space, (offset>>6)&0xF, data); -} - -READ8_MEMBER( cat_state::swyft_via1_r ) -{ - if (offset&0x000C3F) fprintf(stderr," VIA1: read from invalid offset in 68k space: %06X!\n", offset); - UINT8 data = m_via1->read(space, (offset>>6)&0xF); -#ifdef DEBUG_SWYFT_VIA1 - logerror(" VIA1 register %s read by cpu: returning %02x\n", swyft_via_regnames[(offset>>5)&0xF], data); -#endif - return data; -} - -WRITE8_MEMBER( cat_state::swyft_via1_w ) -{ -#ifdef DEBUG_SWYFT_VIA1 - logerror(" VIA1 register %s written by cpu with data %02x\n", swyft_via_regnames[(offset>>5)&0xF], data); -#endif - if (offset&0x000C3F) fprintf(stderr," VIA1: write to invalid offset in 68k space: %06X, data: %02X!\n", offset, data); - m_via0->write(space, (offset>>6)&0xF, data); -} - -// first via -READ8_MEMBER( cat_state::via0_pa_r ) -{ - logerror("VIA0: Port A read!\n"); - return 0xFF; -} - -WRITE8_MEMBER( cat_state::via0_pa_w ) -{ - logerror("VIA0: Port A written with data of 0x%02x!\n", data); -} - -WRITE_LINE_MEMBER ( cat_state::via0_ca2_w ) -{ - logerror("VIA0: CA2 written with %d!\n", state); -} - -READ8_MEMBER( cat_state::via0_pb_r ) -{ - logerror("VIA0: Port B read!\n"); - return 0xFF; -} - -WRITE8_MEMBER( cat_state::via0_pb_w ) -{ - logerror("VIA0: Port B written with data of 0x%02x!\n", data); -} - -WRITE_LINE_MEMBER ( cat_state::via0_cb1_w ) -{ - logerror("VIA0: CB1 written with %d!\n", state); -} - -WRITE_LINE_MEMBER ( cat_state::via0_cb2_w ) -{ - logerror("VIA0: CB2 written with %d!\n", state); -} - -WRITE_LINE_MEMBER ( cat_state::via0_int_w ) -{ - logerror("VIA0: INT output set to %d!\n", state); -} - -// second via -READ8_MEMBER( cat_state::via1_pa_r ) -{ - logerror(" VIA1: Port A read!\n"); - return 0xFF; -} - -WRITE8_MEMBER( cat_state::via1_pa_w ) -{ - logerror(" VIA1: Port A written with data of 0x%02x!\n", data); -} - -WRITE_LINE_MEMBER ( cat_state::via1_ca2_w ) -{ - logerror(" VIA1: CA2 written with %d!\n", state); -} - -READ8_MEMBER( cat_state::via1_pb_r ) -{ - logerror(" VIA1: Port B read!\n"); - return 0xFF; -} - -WRITE8_MEMBER( cat_state::via1_pb_w ) -{ - logerror(" VIA1: Port B written with data of 0x%02x!\n", data); -} - -WRITE_LINE_MEMBER ( cat_state::via1_cb1_w ) -{ - logerror(" VIA1: CB1 written with %d!\n", state); -} - -WRITE_LINE_MEMBER ( cat_state::via1_cb2_w ) -{ - logerror(" VIA1: CB2 written with %d!\n", state); -} - -WRITE_LINE_MEMBER ( cat_state::via1_int_w ) -{ - logerror(" VIA1: INT output set to %d!\n", state); -} - -WRITE_LINE_MEMBER( cat_state::write_acia_clock ) -{ - m_acia6850->write_txc(state); - m_acia6850->write_rxc(state); -} - -static MACHINE_CONFIG_START( swyft, cat_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M68008, XTAL_15_8976MHz/2) //MC68008P8, Y1=15.8976Mhz, clock GUESSED at Y1 / 2 - MCFG_CPU_PROGRAM_MAP(swyft_mem) - - MCFG_MACHINE_START_OVERRIDE(cat_state,swyft) - MCFG_MACHINE_RESET_OVERRIDE(cat_state,swyft) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(320, 242) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 242-1) - MCFG_SCREEN_UPDATE_DRIVER(cat_state, screen_update_swyft) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_VIDEO_START_OVERRIDE(cat_state,swyft) - - MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) - // acia rx and tx clocks come from one of the VIA pins and are tied together, fix this below? acia e clock comes from 68008 - MCFG_DEVICE_ADD("acia_clock", CLOCK, (XTAL_15_8976MHz/2)/5) // out e clock from 68008, ~ 10in clocks per out clock - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(cat_state, write_acia_clock)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, (XTAL_15_8976MHz/2)/5) // out e clock from 68008 - MCFG_VIA6522_READPA_HANDLER(READ8(cat_state, via0_pa_r)) - MCFG_VIA6522_READPB_HANDLER(READ8(cat_state, via0_pb_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(cat_state, via0_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(cat_state, via0_pb_w)) - MCFG_VIA6522_CB1_HANDLER(WRITELINE(cat_state, via0_cb1_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(cat_state, via0_ca2_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(cat_state, via0_cb2_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(cat_state, via0_int_w)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, (XTAL_15_8976MHz/2)/5) // out e clock from 68008 - MCFG_VIA6522_READPA_HANDLER(READ8(cat_state, via1_pa_r)) - MCFG_VIA6522_READPB_HANDLER(READ8(cat_state, via1_pb_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(cat_state, via1_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(cat_state, via1_pb_w)) - MCFG_VIA6522_CB1_HANDLER(WRITELINE(cat_state, via1_cb1_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(cat_state, via1_ca2_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(cat_state, via1_cb2_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(cat_state, via1_int_w)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( swyft ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v331", "IAI Swyft Version 331 Firmware") - ROMX_LOAD( "331-lo.u30", 0x0000, 0x8000, CRC(d6cc2e2f) SHA1(39ff26c18b1cf589fc48793263f280ef3780cc61), ROM_BIOS(1)) - ROMX_LOAD( "331-hi.u31", 0x8000, 0x8000, CRC(4677630a) SHA1(8845d702fa8b8e1a08352f4c59d3076cc2e1307e), ROM_BIOS(1)) - /* this version of the swyft code identifies itself at 0x3FCB as version 330 */ - ROM_SYSTEM_BIOS( 1, "v330", "IAI Swyft Version 330 Firmware") - ROMX_LOAD( "infoapp.lo.u30", 0x0000, 0x8000, CRC(52c1bd66) SHA1(b3266d72970f9d64d94d405965b694f5dcb23bca), ROM_BIOS(2)) - ROMX_LOAD( "infoapp.hi.u31", 0x8000, 0x8000, CRC(83505015) SHA1(693c914819dd171114a8c408f399b56b470f6be0), ROM_BIOS(2)) - ROM_REGION( 0x4000, "pals", ROMREGION_ERASEFF ) - /* Swyft PALs: - * The Swyft has four PALs, whose rough function can be derived from their names: - * TIMING - state machine for DRAM refresh/access; handles ras/cas and choosing whether the video out shifter or the 68k is accessing ram. also divides clock - * DECODE - address decoder for the 68008 - * VIDEO - state machine for the video shifter (and vblank/hblank?) - * DISK 3.5 - state machine for the floppy drive interface - */ - /* U9: Timing AMPAL16R4 - * - * pins: - * 111111111000000000 - * 987654321987654321 - * ??QQQQ??EIIIIIIIIC - * |||||||||||||||||\-< /CK input - 15.8976mhz crystal and transistor oscillator - * ||||||||||||||||\--< ? - * |||||||||||||||\---< ? - * ||||||||||||||\----< ? - * |||||||||||||\-----< ? - * ||||||||||||\------< ? - * |||||||||||\-------< ? - * ||||||||||\--------< ? - * |||||||||\---------< ? - * ||||||||\----------< /OE input - shorted to GND - * |||||||\-----------? ? - * ||||||\------------? ? - * |||||\------------Q> /ROM_OE (to both eproms through jumper b1 and optionally j9 connector) - * ||||\-------------Q? ? - * |||\--------------Q? ? - * ||\---------------Q> output to decode pal pin 2 - * |\----------------->? output? to ram multiplexer 'A' pins - * \------------------< ? - */ - ROM_LOAD( "timing_b.ampal16r4a.u9.jed", 0x0000, 0xb08, CRC(643e6e83) SHA1(7db167883f9d6cf385ce496d08976dc16fc3e2c3)) - /* U20: Decode AMPAL16L8 - * - * pins: - * 111111111000000000 - * 987654321987654321 - * O??????OIIIIIIIIII - * |||||||||||||||||\-< TIMING PAL pin 5 - * ||||||||||||||||\--< TIMING PAL pin 17 - * |||||||||||||||\---< 68008 R/W (pin 30) - * ||||||||||||||\----< 68008 /DS (pin 29) - * |||||||||||||\-----< 68008 E (pin 38) - * ||||||||||||\------< 68008 A19 - * |||||||||||\-------< 68008 A18 - * ||||||||||\--------< 68008 A17 - * |||||||||\---------< 68008 A16 - * ||||||||\----------< ? - * |||||||\-----------> ? - * ||||||\------------? 68008 /VPA (pin 39) - * |||||\-------------> /ROM_OE (to both eproms through jumper b1 and optionally j9 connector) - * ||||\--------------? ? - * |||\---------------? ? - * ||\----------------? ? - * |\-----------------? goes to j9 connector pin 5 - * \------------------< ? - */ - ROM_LOAD( "decode_e.ampal16l8.u20.jed", 0x1000, 0xb08, CRC(0b1dbd76) SHA1(08c144ad7a7bbdd53eefd271b2f6813f8b3b1594)) - ROM_LOAD( "video_2b.ampal16r4.u25.jed", 0x2000, 0xb08, CRC(caf91148) SHA1(3f8ddcb512a1c05395c74ad9a6ba7b87027ce4ec)) - ROM_LOAD( "disk_3.5c.ampal16r4.u28.jed", 0x3000, 0xb08, CRC(fd994d02) SHA1(f910ab16587dd248d63017da1e5b37855e4c1a0c)) -ROM_END - -ROM_START( cat ) - ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF ) - // SYS ROM - /* This 2.40 code came from two development cat machines owned or formerly - * owned by former IAI employees Sandy Bumgarner and Dave Boulton. - * Dave Boulton's machine is interesting in that it has a prototype cat - * motherboard in it, which it has less space for dram than a 'released' - * cat does: it uses 16k*4 dram chips instead of 64k*4 as in the final - * cat, and hence can only support 128k of ram with all 4 rows of drams - * populated, as opposed to 256k-standard (2 rows) and 512k-max with all - * 4 rows populated on a "released" cat. - */ - ROM_SYSTEM_BIOS( 0, "r240", "Canon Cat V2.40 US Firmware") - ROMX_LOAD( "boultl0.ic2", 0x00001, 0x10000, CRC(77b66208) SHA1(9d718c0a521fefe4f86ef328805b7921bade9d89), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "boulth0.ic4", 0x00000, 0x10000, CRC(f1e1361a) SHA1(0a85385527e2cc55790de9f9919eb44ac32d7f62), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "boultl1.ic3", 0x20001, 0x10000, CRC(c61dafb0) SHA1(93216c26c2d5fc71412acc548c96046a996ea668), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "boulth1.ic5", 0x20000, 0x10000, CRC(bed1f761) SHA1(d177e1d3a39b005dd94a6bda186221d597129af4), ROM_SKIP(1) | ROM_BIOS(1)) - /* This 2.40 code was compiled by Dwight Elvey based on the v2.40 source - * code disks recovered around 2004. It does NOT exactly match the above - * set exactly but has a few small differences. One of the printer drivers - * may have been replaced by Dwight with an HP PCL4 driver. - * It is as of yet unknown whether it is earlier or later code than the - * set above. - */ - ROM_SYSTEM_BIOS( 1, "r240r", "Canon Cat V2.40 US Firmware compiled from recovered source code") - ROMX_LOAD( "r240l0.ic2", 0x00001, 0x10000, CRC(1b89bdc4) SHA1(39c639587dc30f9d6636b46d0465f06272838432), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "r240h0.ic4", 0x00000, 0x10000, CRC(94f89b8c) SHA1(6c336bc30636a02c625d31f3057ec86bf4d155fc), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "r240l1.ic3", 0x20001, 0x10000, CRC(1a73be4f) SHA1(e2de2cb485f78963368fb8ceba8fb66ca56dba34), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "r240h1.ic5", 0x20000, 0x10000, CRC(898dd9f6) SHA1(93e791dd4ed7e4afa47a04df6fdde359e41c2075), ROM_SKIP(1) | ROM_BIOS(2)) - /* This v1.74 code comes from (probably) the 'main us release' of first-run - * Canon cats, and was dumped from machine serial number R12014979 - * Canon cat v1.74 roms are labeled as r74; they only added the major number - * to the rom label after v2.0? - */ - ROM_SYSTEM_BIOS( 2, "r174", "Canon Cat V1.74 US Firmware") - ROMX_LOAD( "r74__0l__c18c.blue.ic2", 0x00001, 0x10000, CRC(b19aa0c8) SHA1(85b3e549cfb91bd3dd32335e02eaaf9350e80900), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "r74__0h__75a6.yellow.ic4", 0x00000, 0x10000, CRC(75281f77) SHA1(ed8b5e37713892ee83413d23c839d09e2fd2c1a9), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "r74__1l__c8a3.green.ic3", 0x20001, 0x10000, CRC(93275558) SHA1(f690077a87076fd51ae385ac5a455804cbc43c8f), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "r74__1h__3c37.white.ic5", 0x20000, 0x10000, CRC(5d7c3962) SHA1(8335993583fdd30b894c01c1a7a6aca61cd81bb4), ROM_SKIP(1) | ROM_BIOS(3)) - // According to Sandy Bumgarner, there should be a 2.42 version which fixes some bugs in the calc command vs 2.40 - // According to the Cat Repair Manual page 4-20, there should be a version called B91U0x (maybe 1.91 or 0.91?) with sum16s of 9F1F, FF0A, 79BF and 03FF - - ROM_REGION( 0x80000, "svrom", ROMREGION_ERASE00 ) - // SPELLING VERIFICATION ROM (SVROM) - /* Romspace here is a little strange: there are 3 rom sockets on the board: - * svrom-0 maps to 200000-21ffff every ODD byte (d8-d0) - * svrom-1 maps to 200000-21ffff every EVEN byte (d15-d7) - * (since no rom is in the socket; it reads as open bus, sometimes 0x2E) - * svrom-2 maps to 240000-25ffff every ODD byte (d8-d0) - * (since no rom is in the socket; it reads as open bus, sometimes 0x80) - * there is no svrom-3 socket; 240000-25ffff EVEN always reads as 0x2E - * since ROM_FILL16BE(0x0, 0x80000, 0x2e80) doesn't exist, the - * even bytes and latter chunk of the svrom space need to be filled in - * DRIVER_INIT or some other means needs to be found to declare them as - * 'open bus' once the mame/mess core supports that. - * NOTE: there are at least 6 more SVROMS which existed (possibly in - * limited form), and are not dumped: - * UK (1 rom, NH7-0724) - * French/Quebec (2 roms, NH7-0813/0814) - * German (3 roms, NH7-1019/1020/1021) - * Each of these will also have its own code romset as well. - */ - // NH7-0684 (US, dumped): - ROMX_LOAD( "uv1__nh7-0684__hn62301apc11__7h1.ic6", 0x00000, 0x20000, CRC(229ca210) SHA1(564b57647a34acdd82159993a3990a412233da14), ROM_SKIP(1)) // this is a 28pin tc531000 mask rom, 128KB long; "US" SVROM - - /* There is an unpopulated PAL16L8 at IC9 whose original purpose (based - * on the schematics) was probably to cause a 68k bus error when - * memory in certain ranges when accessed (likely so 'forth gone insane' - * won't destroy the contents of ram and svram). - * Its connections are (where Ix = inp on pin x, Ox = out on pin x): - * I1 = A23, I2 = A22, I3 = A2, I4 = R/W, I5 = A5, I6 = FC2, I7 = gnd, - * I8 = A1, I9 = gnd, I11 = gnd, O16 = /BERR, - * I14 = REMAP (connects to emulator 'shadow rom' board or to gnd when unused) - * Based on the inputs and outputs of this pal, almost if not the entire - * open bus and mirrored areas of the cat address space could be made - * to cause bus errors. REMAP was probably used to 'open up' the A00000-A7ffff - * shadow rom/ram area and make it writeable without erroring. - */ -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT DEVICE INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, swyft,0, 0, swyft, swyft, driver_device, 0, "Information Applicance Inc", "Swyft", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1987, cat, swyft, 0, cat, cat, driver_device, 0, "Canon", "Cat", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/cbm2.c b/src/mess/drivers/cbm2.c deleted file mode 100644 index 9ff23fc32da..00000000000 --- a/src/mess/drivers/cbm2.c +++ /dev/null @@ -1,2767 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - TODO: - - - 8088 board - - CIA timers fail in burn-in test - - cbm620hu charom banking? - -*/ - -#include "includes/cbm2.h" -#include "bus/rs232/rs232.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define P3 BIT(offset, 19) -#define P2 BIT(offset, 18) -#define P1 BIT(offset, 17) -#define P0 BIT(offset, 16) -#define A15 BIT(offset, 15) -#define A14 BIT(offset, 14) -#define A13 BIT(offset, 13) -#define A12 BIT(offset, 12) -#define A11 BIT(offset, 11) -#define A10 BIT(offset, 10) -#define A0 BIT(offset, 0) -#define VA12 BIT(va, 12) - -static void cbmb_quick_sethiaddress(address_space &space, UINT16 hiaddress) -{ - space.write_byte(0xf0046, hiaddress & 0xff); - space.write_byte(0xf0047, hiaddress >> 8); -} - -QUICKLOAD_LOAD_MEMBER( cbm2_state, cbmb ) -{ - return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0x10000, cbmb_quick_sethiaddress); -} - -QUICKLOAD_LOAD_MEMBER( p500_state, p500 ) -{ - return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbmb_quick_sethiaddress); -} - -//************************************************************************** -// ADDRESS DECODING -//************************************************************************** - -//------------------------------------------------- -// read_pla - low profile PLA read -//------------------------------------------------- - -void cbm2_state::read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4) -{ - UINT32 input = P0 << 15 | P1 << 14 | P2 << 13 | P3 << 12 | m_busy2 << 11 | eras << 10 | ecas << 9 | refen << 8 | cas << 7 | ras << 6; - UINT32 data = m_pla1->read(input); - - *casseg1 = BIT(data, 0); - *rasseg1 = BIT(data, 1); - *rasseg2 = BIT(data, 2); - *casseg2 = BIT(data, 3); - *rasseg4 = BIT(data, 4); - *casseg4 = BIT(data, 5); - *casseg3 = BIT(data, 6); - *rasseg3 = BIT(data, 7); -} - - -//------------------------------------------------- -// read_pla - high profile PLA read -//------------------------------------------------- - -void cbm2hp_state::read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4) -{ - UINT32 input = ras << 13 | cas << 12 | refen << 11 | eras << 10 | ecas << 9 | m_busy2 << 8 | P3 << 3 | P2 << 2 | P1 << 1 | P0; - UINT32 data = m_pla1->read(input); - - *casseg1 = BIT(data, 0); - *casseg2 = BIT(data, 1); - *casseg3 = BIT(data, 2); - *casseg4 = BIT(data, 3); - *rasseg1 = BIT(data, 4); - *rasseg2 = BIT(data, 5); - *rasseg3 = BIT(data, 6); - *rasseg4 = BIT(data, 7); -} - - -//------------------------------------------------- -// bankswitch - -//------------------------------------------------- - -void cbm2_state::bankswitch(offs_t offset, int eras, int ecas, int refen, int cas, int ras, int *sysioen, int *dramen, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *buframcs, int *extbufcs, int *vidramcs, - int *diskromcs, int *csbank1, int *csbank2, int *csbank3, int *basiccs, int *knbcs, int *kernalcs, - int *crtccs, int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs) -{ - int rasseg1 = 1, rasseg2 = 1, rasseg3 = 1, rasseg4 = 1; - - this->read_pla(offset, ras, cas, refen, eras, ecas, casseg1, casseg2, casseg3, casseg4, &rasseg1, &rasseg2, &rasseg3, &rasseg4); - - int decoden = 0; - *sysioen = !(P0 && P1 && P2 && P3) && m_busen1; - *dramen = !((!(P0 && P1 && P2 && P3)) && m_busen1); - - if (!decoden && !*sysioen) - { - switch ((offset >> 13) & 0x07) - { - case 0: - switch ((offset >> 11) & 0x03) - { - case 0: *buframcs = 0; break; - case 1: *extbufcs = 0; break; - case 2: // fallthru - case 3: *diskromcs = 0; break; - } - break; - - case 1: *csbank1 = 0; break; - case 2: *csbank2 = 0; break; - case 3: *csbank3 = 0; break; - case 4: *basiccs = 0; break; - case 5: *knbcs = 0; break; - case 6: - switch ((offset >> 11) & 0x03) - { - case 2: *vidramcs = 0; break; - case 3: - switch ((offset >> 8) & 0x07) - { - case 0: *crtccs = 0; break; - case 1: *cs1 = 0; break; - case 2: *sidcs = 0; break; - case 3: *extprtcs = 0; break; - case 4: *ciacs = 0; break; - case 5: *aciacs = 0; break; - case 6: *tript1cs = 0; break; - case 7: *tript2cs = 0; break; - } - break; - } - break; - - case 7: *kernalcs = 0; break; - } - } -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( cbm2_state::read ) -{ - int eras = 1, ecas = 1, refen = 0, cas = 0, ras = 1, sysioen = 1, dramen = 1; - int casseg1 = 1, casseg2 = 1, casseg3 = 1, casseg4 = 1, buframcs = 1, extbufcs = 1, vidramcs = 1; - int diskromcs = 1, csbank1 = 1, csbank2 = 1, csbank3 = 1, basiccs = 1, knbcs = 1, kernalcs = 1; - int crtccs = 1, cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; - - bankswitch(offset, eras, ecas, refen, cas, ras, &sysioen, &dramen, - &casseg1, &casseg2, &casseg3, &casseg4, &buframcs, &extbufcs, &vidramcs, - &diskromcs, &csbank1, &csbank2, &csbank3, &basiccs, &knbcs, &kernalcs, - &crtccs, &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs); - - UINT8 data = 0xff; - - if (!dramen) - { - if (!casseg1) - { - data = m_ram->pointer()[offset & 0xffff]; - } - if (!casseg2) - { - data = m_ram->pointer()[0x10000 | (offset & 0xffff)]; - } - if (!casseg3 && (m_ram->size() > 0x20000)) - { - data = m_ram->pointer()[0x20000 | (offset & 0xffff)]; - } - if (!casseg4 && (m_ram->size() > 0x30000)) - { - data = m_ram->pointer()[0x30000 | (offset & 0xffff)]; - } - } - - if (!sysioen) - { - if (!buframcs) - { - data = m_buffer_ram[offset & 0x7ff]; - } - if (!extbufcs && m_extbuf_ram) - { - data = m_extbuf_ram[offset & 0x7ff]; - } - if (!vidramcs) - { - data = m_video_ram[offset & 0x7ff]; - } - if (!basiccs || !knbcs) - { - data = m_basic->base()[offset & 0x3fff]; - } - if (!kernalcs) - { - data = m_kernal->base()[offset & 0x1fff]; - } - if (!crtccs) - { - if (A0) - { - data = m_crtc->register_r(space, 0); - } - else - { - data = m_crtc->status_r(space, 0); - } - } - if (!sidcs) - { - data = m_sid->read(space, offset & 0x1f); - } - if (!extprtcs && m_ext_cia) - { - data = m_ext_cia->read(space, offset & 0x0f); - } - if (!ciacs) - { - data = m_cia->read(space, offset & 0x0f); - } - if (!aciacs) - { - data = m_acia->read(space, offset & 0x03); - } - if (!tript1cs) - { - data = m_tpi1->read(space, offset & 0x07); - } - if (!tript2cs) - { - data = m_tpi2->read(space, offset & 0x07); - } - - data = m_exp->read(space, offset & 0x1fff, data, csbank1, csbank2, csbank3); - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( cbm2_state::write ) -{ - int eras = 1, ecas = 1, refen = 0, cas = 0, ras = 1, sysioen = 1, dramen = 1; - int casseg1 = 1, casseg2 = 1, casseg3 = 1, casseg4 = 1, buframcs = 1, extbufcs = 1, vidramcs = 1; - int diskromcs = 1, csbank1 = 1, csbank2 = 1, csbank3 = 1, basiccs = 1, knbcs = 1, kernalcs = 1; - int crtccs = 1, cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; - - bankswitch(offset, eras, ecas, refen, cas, ras, &sysioen, &dramen, - &casseg1, &casseg2, &casseg3, &casseg4, &buframcs, &extbufcs, &vidramcs, - &diskromcs, &csbank1, &csbank2, &csbank3, &basiccs, &knbcs, &kernalcs, - &crtccs, &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs); - - if (!dramen) - { - if (!casseg1) - { - m_ram->pointer()[offset & 0xffff] = data; - } - if (!casseg2) - { - m_ram->pointer()[0x10000 | (offset & 0xffff)] = data; - } - if (!casseg3 && (m_ram->size() > 0x20000)) - { - m_ram->pointer()[0x20000 | (offset & 0xffff)] = data; - } - if (!casseg4 && (m_ram->size() > 0x30000)) - { - m_ram->pointer()[0x30000 | (offset & 0xffff)] = data; - } - } - - if (!sysioen) - { - if (!buframcs) - { - m_buffer_ram[offset & 0x7ff] = data; - } - if (!extbufcs && m_extbuf_ram) - { - m_extbuf_ram[offset & 0x7ff] = data; - } - if (!vidramcs) - { - m_video_ram[offset & 0x7ff] = data; - } - if (!crtccs) - { - if (A0) - { - m_crtc->register_w(space, 0, data); - } - else - { - m_crtc->address_w(space, 0, data); - } - } - if (!sidcs) - { - m_sid->write(space, offset & 0x1f, data); - } - if (!extprtcs && m_ext_cia) - { - m_ext_cia->write(space, offset & 0x0f, data); - } - if (!ciacs) - { - m_cia->write(space, offset & 0x0f, data); - } - if (!aciacs) - { - m_acia->write(space, offset & 0x03, data); - } - if (!tript1cs) - { - m_tpi1->write(space, offset & 0x07, data); - } - if (!tript2cs) - { - m_tpi2->write(space, offset & 0x07, data); - } - - m_exp->write(space, offset & 0x1fff, data, csbank1, csbank2, csbank3); - } -} - - -//------------------------------------------------- -// ext_read - -//------------------------------------------------- - -READ8_MEMBER( cbm2_state::ext_read ) -{ -#ifdef USE_PLA_DECODE - int ras = 1, cas = 1, refen = 0, eras = 1, ecas = 0; - int casseg1 = 1, casseg2 = 1, casseg3 = 1, casseg4 = 1, rasseg1 = 1, rasseg2 = 1, rasseg3 = 1, rasseg4 = 1; - - this->read_pla(offset, ras, cas, refen, eras, ecas, &casseg1, &casseg2, &casseg3, &casseg4, &rasseg1, &rasseg2, &rasseg3, &rasseg4); - UINT8 data = 0xff; - - if (!casseg1) - { - data = m_ram->pointer()[offset & 0xffff]; - } - if (!casseg2) - { - data = m_ram->pointer()[0x10000 | (offset & 0xffff)]; - } - if (!casseg3 && (m_ram->size() > 0x20000)) - { - data = m_ram->pointer()[0x20000 | (offset & 0xffff)]; - } - if (!casseg4 && (m_ram->size() > 0x30000)) - { - data = m_ram->pointer()[0x30000 | (offset & 0xffff)]; - } - - return data; -#endif - - UINT8 data = 0; - if (offset < 0x40000) data = m_ram->pointer()[offset]; - return data; -} - - -//------------------------------------------------- -// ext_write - -//------------------------------------------------- - -WRITE8_MEMBER( cbm2_state::ext_write ) -{ -#ifdef USE_PLA_DECODE - int ras = 1, cas = 1, refen = 0, eras = 1, ecas = 0; - int casseg1 = 1, casseg2 = 1, casseg3 = 1, casseg4 = 1, rasseg1 = 1, rasseg2 = 1, rasseg3 = 1, rasseg4 = 1; - - this->read_pla(offset, ras, cas, refen, eras, ecas, &casseg1, &casseg2, &casseg3, &casseg4, &rasseg1, &rasseg2, &rasseg3, &rasseg4); - - if (!casseg1) - { - m_ram->pointer()[offset & 0xffff] = data; - } - if (!casseg2) - { - m_ram->pointer()[0x10000 | (offset & 0xffff)] = data; - } - if (!casseg3 && (m_ram->size() > 0x20000)) - { - m_ram->pointer()[0x20000 | (offset & 0xffff)] = data; - } - if (!casseg4 && (m_ram->size() > 0x30000)) - { - m_ram->pointer()[0x30000 | (offset & 0xffff)] = data; - } -#endif - - if (offset < 0x40000) m_ram->pointer()[offset] = data; -} - - -//------------------------------------------------- -// read_pla1 - P500 PLA #1 read -//------------------------------------------------- - -void p500_state::read_pla1(offs_t offset, int busy2, int clrnibcsb, int procvid, int refen, int ba, int aec, int srw, - int *datxen, int *dramxen, int *clrniben, int *segf, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr) -{ - int sphi2 = m_vic->phi0_r(); - int bras = 1; - - UINT32 input = P0 << 15 | P2 << 14 | bras << 13 | P1 << 12 | P3 << 11 | busy2 << 10 | m_statvid << 9 | sphi2 << 8 | - clrnibcsb << 7 | m_dramon << 6 | procvid << 5 | refen << 4 | m_vicdotsel << 3 | ba << 2 | aec << 1 | srw; - - UINT32 data = m_pla1->read(input); - - *datxen = BIT(data, 0); - *dramxen = BIT(data, 1); - *clrniben = BIT(data, 2); - *segf = BIT(data, 3); - *_64kcasen = BIT(data, 4); - *casenb = BIT(data, 5); - *viddaten = BIT(data, 6); - *viddat_tr = BIT(data, 7); -} - - -//------------------------------------------------- -// read_pla2 - P500 PLA #2 read -//------------------------------------------------- - -void p500_state::read_pla2(offs_t offset, offs_t va, int ba, int vicen, int ae, int segf, int bank0, - int *clrnibcsb, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *procvid, int *viccs, int *vidmatcs) -{ - int sphi2 = m_vic->phi0_r(); - int bcas = 1; - - UINT32 input = VA12 << 15 | ba << 14 | A13 << 13 | A15 << 12 | A14 << 11 | A11 << 10 | A10 << 9 | A12 << 8 | - sphi2 << 7 | vicen << 6 | m_statvid << 5 | m_vicdotsel << 4 | ae << 3 | segf << 2 | bcas << 1 | bank0; - - UINT32 data = m_pla2->read(input); - - *clrnibcsb = BIT(data, 0); - *extbufcs = BIT(data, 1); - *discromcs = BIT(data, 2); - *buframcs = BIT(data, 3); - *charomcs = BIT(data, 4); - *procvid = BIT(data, 5); - *viccs = BIT(data, 6); - *vidmatcs = BIT(data, 7); -} - - -//------------------------------------------------- -// bankswitch - -//------------------------------------------------- - -void p500_state::bankswitch(offs_t offset, offs_t va, int srw, int ba, int ae, int busy2, int refen, - int *datxen, int *dramxen, int *clrniben, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr, - int *clrnibcs, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *viccs, int *vidmatcs, - int *csbank1, int *csbank2, int *csbank3, int *basiclocs, int *basichics, int *kernalcs, - int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs, int *aec, int *vsysaden) -{ - int sphi2 = m_vic->phi0_r(); - int sphi1 = !sphi2; - //int ba = !m_vic->ba_r(); - //int ae = m_vic->aec_r(); - int bcas = 0; - - *aec = !((m_statvid || ae) && sphi2); - *vsysaden = sphi1 || ba; - - int clrnibcsb = 1, procvid = 1, segf = 1; - - read_pla1(offset, busy2, clrnibcsb, procvid, refen, ba, *aec, srw, - datxen, dramxen, clrniben, &segf, _64kcasen, casenb, viddaten, viddat_tr); - - int bank0 = 1, vicen = 1; - - if (!*aec && !segf) - { - switch ((offset >> 13) & 0x07) - { - case 0: bank0 = 0; break; - case 1: *csbank1 = 0; break; - case 2: *csbank2 = 0; break; - case 3: *csbank3 = 0; break; - case 4: *basiclocs = 0; break; - case 5: *basichics = 0; break; - case 6: - if (A12 && A11) - { - switch ((offset >> 8) & 0x07) - { - case 0: vicen = 0; break; - case 1: *cs1 = 0; break; - case 2: *sidcs = 0; break; - case 3: *extprtcs = 0; break; - case 4: *ciacs = 0; break; - case 5: *aciacs = 0; break; - case 6: *tript1cs = 0; break; - case 7: *tript2cs = 0; break; - } - } - break; - - case 7: *kernalcs = 0; break; - } - } - - int vidmatcsb = 1; - - read_pla2(offset, va, ba, vicen, ae, segf, bank0, - &clrnibcsb, extbufcs, discromcs, buframcs, charomcs, &procvid, viccs, &vidmatcsb); - - *clrnibcs = clrnibcsb || bcas; - *vidmatcs = vidmatcsb || bcas; - - read_pla1(offset, busy2, clrnibcsb, procvid, refen, ba, *aec, srw, - datxen, dramxen, clrniben, &segf, _64kcasen, casenb, viddaten, viddat_tr); -} - - -//------------------------------------------------- -// read_memory - -//------------------------------------------------- - -UINT8 p500_state::read_memory(address_space &space, offs_t offset, offs_t va, int ba, int ae) -{ - int srw = 1, busy2 = 1, refen = 0; - - int datxen = 1, dramxen = 1, clrniben = 1, _64kcasen = 1, casenb = 1, viddaten = 1, viddat_tr = 1; - int clrnibcs = 1, extbufcs = 1, discromcs = 1, buframcs = 1, charomcs = 1, viccs = 1, vidmatcs = 1; - int csbank1 = 1, csbank2 = 1, csbank3 = 1, basiclocs = 1, basichics = 1, kernalcs = 1; - int cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; - int aec = 1, vsysaden = 1; - - bankswitch(offset, va, srw, ba, ae, busy2, refen, - &datxen, &dramxen, &clrniben, &_64kcasen, &casenb, &viddaten, &viddat_tr, - &clrnibcs, &extbufcs, &discromcs, &buframcs, &charomcs, &viccs, &vidmatcs, - &csbank1, &csbank2, &csbank3, &basiclocs, &basichics, &kernalcs, - &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs, &aec, &vsysaden); - - UINT8 data = 0xff; - - if (clrniben) - { - if (!clrnibcs && !vsysaden) - { - data = m_color_ram[offset & 0x3ff]; - } - } - - if (!dramxen) - { - if (casenb) - { - switch (offset >> 16) - { - case 1: data = m_ram->pointer()[0x10000 + (offset & 0xffff)]; break; - case 2: if (m_ram->size() > 0x20000) data = m_ram->pointer()[0x20000 + (offset & 0xffff)]; break; - case 3: if (m_ram->size() > 0x30000) data = m_ram->pointer()[0x30000 + (offset & 0xffff)]; break; - } - } - } - - if (!datxen) - { - if (!_64kcasen && !aec) - { - data = m_ram->pointer()[offset & 0xffff]; - } - if (!buframcs) - { - data = m_buffer_ram[offset & 0x7ff]; - } - if (!vidmatcs && !vsysaden && !viddaten && viddat_tr) - { - data = m_video_ram[offset & 0x3ff]; - } - if (!basiclocs || !basichics) - { - data = m_basic->base()[offset & 0x3fff]; - } - if (!kernalcs) - { - data = m_kernal->base()[offset & 0x1fff]; - } - if (!charomcs && !vsysaden && !viddaten && viddat_tr) - { - data = m_charom->base()[offset & 0xfff]; - } - if (!viccs && !viddaten && viddat_tr) - { - data = m_vic->read(space, offset & 0x3f); - } - if (!sidcs) - { - data = m_sid->read(space, offset & 0x1f); - } - if (!ciacs) - { - data = m_cia->read(space, offset & 0x0f); - } - if (!aciacs) - { - data = m_acia->read(space, offset & 0x03); - } - if (!tript1cs) - { - data = m_tpi1->read(space, offset & 0x07); - } - if (!tript2cs) - { - data = m_tpi2->read(space, offset & 0x07); - } - - data = m_exp->read(space, offset & 0x1fff, data, csbank1, csbank2, csbank3); - } - - return data; -} - - -//------------------------------------------------- -// write_memory - -//------------------------------------------------- - -void p500_state::write_memory(address_space &space, offs_t offset, UINT8 data, int ba, int ae) -{ - int srw = 0, busy2 = 1, refen = 0; - offs_t va = 0xffff; - - int datxen = 1, dramxen = 1, clrniben = 1, _64kcasen = 1, casenb = 1, viddaten = 1, viddat_tr = 1; - int clrnibcs = 1, extbufcs = 1, discromcs = 1, buframcs = 1, charomcs = 1, viccs = 1, vidmatcs = 1; - int csbank1 = 1, csbank2 = 1, csbank3 = 1, basiclocs = 1, basichics = 1, kernalcs = 1; - int cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; - int aec = 1, vsysaden = 1; - - bankswitch(offset, va, srw, ba, ae, busy2, refen, - &datxen, &dramxen, &clrniben, &_64kcasen, &casenb, &viddaten, &viddat_tr, - &clrnibcs, &extbufcs, &discromcs, &buframcs, &charomcs, &viccs, &vidmatcs, - &csbank1, &csbank2, &csbank3, &basiclocs, &basichics, &kernalcs, - &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs, &aec, &vsysaden); - - if (clrniben) - { - if (!clrnibcs && !vsysaden) - { - m_color_ram[offset & 0x3ff] = data & 0x0f; - } - } - - if (!dramxen) - { - if (casenb) - { - switch (offset >> 16) - { - case 1: m_ram->pointer()[0x10000 + (offset & 0xffff)] = data; break; - case 2: if (m_ram->size() > 0x20000) m_ram->pointer()[0x20000 + (offset & 0xffff)] = data; break; - case 3: if (m_ram->size() > 0x30000) m_ram->pointer()[0x30000 + (offset & 0xffff)] = data; break; - } - } - } - - if (!datxen) - { - if (!_64kcasen && !aec) - { - m_ram->pointer()[offset & 0xffff] = data; - } - if (!buframcs) - { - m_buffer_ram[offset & 0x7ff] = data; - } - if (!vidmatcs && !vsysaden && !viddaten && !viddat_tr) - { - m_video_ram[offset & 0x3ff] = data; - } - if (!viccs && !viddaten && !viddat_tr) - { - m_vic->write(space, offset & 0x3f, data); - } - if (!sidcs) - { - m_sid->write(space, offset & 0x1f, data); - } - if (!ciacs) - { - m_cia->write(space, offset & 0x0f, data); - } - if (!aciacs) - { - m_acia->write(space, offset & 0x03, data); - } - if (!tript1cs) - { - m_tpi1->write(space, offset & 0x07, data); - } - if (!tript2cs) - { - m_tpi2->write(space, offset & 0x07, data); - } - - m_exp->write(space, offset & 0x1fff, data, csbank1, csbank2, csbank3); - } -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( p500_state::read ) -{ - int ba = 0, ae = 1; - offs_t va = 0xffff; - - return read_memory(space, offset, va, ba, ae); -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( p500_state::write ) -{ - int ba = 0, ae = 1; - - write_memory(space, offset, data, ba, ae); -} - - -//------------------------------------------------- -// vic_videoram_r - -//------------------------------------------------- - -READ8_MEMBER( p500_state::vic_videoram_r ) -{ - int srw = 1, busy2 = 1, refen = 0; - int ba = !m_vic->ba_r(), ae = m_vic->aec_r(); - int datxen = 1, dramxen = 1, clrniben = 1, _64kcasen = 1, casenb = 1, viddaten = 1, viddat_tr = 1; - int clrnibcs = 1, extbufcs = 1, discromcs = 1, buframcs = 1, charomcs = 1, viccs = 1, vidmatcs = 1; - int csbank1 = 1, csbank2 = 1, csbank3 = 1, basiclocs = 1, basichics = 1, kernalcs = 1; - int cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; - int aec = 1, vsysaden = 1; - - bankswitch(0, offset, srw, ba, ae, busy2, refen, - &datxen, &dramxen, &clrniben, &_64kcasen, &casenb, &viddaten, &viddat_tr, - &clrnibcs, &extbufcs, &discromcs, &buframcs, &charomcs, &viccs, &vidmatcs, - &csbank1, &csbank2, &csbank3, &basiclocs, &basichics, &kernalcs, - &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs, &aec, &vsysaden); - - UINT8 data = 0xff; -// UINT8 clrnib = 0xf; - - if (vsysaden) - { - if (!_64kcasen && !aec && !viddaten && !viddat_tr) - { - data = m_ram->pointer()[(m_vicbnksel << 14) | offset]; - } -/* if (!clrnibcs) - { - clrnib = m_color_ram[offset & 0x3ff]; - }*/ - if (!vidmatcs) - { - data = m_video_ram[offset & 0x3ff]; - } - if (!charomcs) - { - data = m_charom->base()[offset & 0xfff]; - } - } - - return data; -} - - -//------------------------------------------------- -// vic_videoram_r - -//------------------------------------------------- - -READ8_MEMBER( p500_state::vic_colorram_r ) -{ - int srw = 1, busy2 = 1, refen = 0; - int ba = !m_vic->ba_r(), ae = m_vic->aec_r(); - int datxen = 1, dramxen = 1, clrniben = 1, _64kcasen = 1, casenb = 1, viddaten = 1, viddat_tr = 1; - int clrnibcs = 1, extbufcs = 1, discromcs = 1, buframcs = 1, charomcs = 1, viccs = 1, vidmatcs = 1; - int csbank1 = 1, csbank2 = 1, csbank3 = 1, basiclocs = 1, basichics = 1, kernalcs = 1; - int cs1 = 1, sidcs = 1, extprtcs = 1, ciacs = 1, aciacs = 1, tript1cs = 1, tript2cs = 1; - int aec = 1, vsysaden = 1; - - bankswitch(0, offset, srw, ba, ae, busy2, refen, - &datxen, &dramxen, &clrniben, &_64kcasen, &casenb, &viddaten, &viddat_tr, - &clrnibcs, &extbufcs, &discromcs, &buframcs, &charomcs, &viccs, &vidmatcs, - &csbank1, &csbank2, &csbank3, &basiclocs, &basichics, &kernalcs, - &cs1, &sidcs, &extprtcs, &ciacs, &aciacs, &tript1cs, &tript2cs, &aec, &vsysaden); - - UINT8 data = 0x0f; - - if (!clrnibcs) - { - data = m_color_ram[offset & 0x3ff]; - } - - return data; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( cbm2_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( cbm2_mem, AS_PROGRAM, 8, cbm2_state ) - AM_RANGE(0x00000, 0xfffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( ext_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ext_mem, AS_PROGRAM, 8, cbm2_state ) - AM_RANGE(0x00000, 0xeffff) AM_READWRITE(ext_read, ext_write) - AM_RANGE(0xf0000, 0xf0fff) AM_MIRROR(0xf000) AM_ROM AM_REGION(EXT_I8088_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( ext_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ext_io, AS_IO, 8, cbm2_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x0001) AM_MIRROR(0x1e) AM_DEVREADWRITE(EXT_I8259A_TAG, pic8259_device, read, write) - AM_RANGE(0x0020, 0x0027) AM_MIRROR(0x18) AM_DEVREADWRITE(EXT_MOS6525_TAG, tpi6525_device, read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( p500_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( p500_mem, AS_PROGRAM, 8, p500_state ) - AM_RANGE(0x00000, 0xfffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_videoram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, p500_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_colorram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, p500_state ) - AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( cbm2 ) -//------------------------------------------------- - -static INPUT_PORTS_START( cbm2 ) - PORT_START("PB0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(TILDE)) PORT_CHAR(0x00a3) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xCF\x80") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0x03c0) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS/DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C=") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR/HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ?") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("OFF/RVS") PORT_CODE(KEYCODE_END) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad CE") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NORM/GRAPH") PORT_CODE(KEYCODE_PGUP) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 00") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN/STOP") PORT_CODE(KEYCODE_PGDN) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad /") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("LOCK") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE - PORT_BIT( 0xef, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( cbm2_de ) -//------------------------------------------------- - -static INPUT_PORTS_START( cbm2_de ) - PORT_INCLUDE(cbm2) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( cbm2_hu ) -//------------------------------------------------- - -static INPUT_PORTS_START( cbm2_hu ) - PORT_INCLUDE(cbm2) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( cbm2_se ) -//------------------------------------------------ - -static INPUT_PORTS_START( cbm2_se ) - PORT_INCLUDE(cbm2) - - PORT_MODIFY("PA0") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) - - PORT_MODIFY("PA1") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) - - PORT_MODIFY("PA2") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" \xCF\x80") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(TILDE)) PORT_CHAR(0x03c0) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR(':') -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// mc6845 -//------------------------------------------------- - -MC6845_UPDATE_ROW( cbm2_state::crtc_update_row ) -{ - const pen_t *pen = m_palette->pens(); - - int x = 0; - - for (int column = 0; column < x_count; column++) - { - UINT8 code = m_video_ram[(ma + column) & 0x7ff]; - offs_t char_rom_addr = (ma & 0x1000) | (m_graphics << 11) | ((code & 0x7f) << 4) | (ra & 0x0f); - UINT8 data = m_charom->base()[char_rom_addr & 0xfff]; - - for (int bit = 0; bit < 9; bit++) - { - int color = BIT(data, 7) ^ BIT(code, 7) ^ BIT(ma, 13); - if (cursor_x == column) color ^= 1; - color &= de; - - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; - - if (bit < 8 || !m_graphics) data <<= 1; - } - } -} - -//------------------------------------------------- -// vic2_interface vic_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( p500_state::vic_irq_w ) -{ - m_vic_irq = state; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_vic_irq || m_tpi1_irq || m_user_irq); -} - - -//------------------------------------------------- -// MOS6581_INTERFACE( sid_intf ) -//------------------------------------------------- - -READ8_MEMBER( cbm2_state::sid_potx_r ) -{ - UINT8 data = 0xff; - - switch (m_cia_pa >> 6) - { - case 1: data = m_joy1->pot_x_r(); break; - case 2: data = m_joy2->pot_x_r(); break; - case 3: - if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) - { - data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); - } - else if (m_joy1->has_pot_x()) - { - data = m_joy1->pot_x_r(); - } - else if (m_joy2->has_pot_x()) - { - data = m_joy2->pot_x_r(); - } - break; - } - - return data; -} - -READ8_MEMBER( cbm2_state::sid_poty_r ) -{ - UINT8 data = 0xff; - - switch (m_cia_pa >> 6) - { - case 1: data = m_joy1->pot_y_r(); break; - case 2: data = m_joy2->pot_y_r(); break; - case 3: - if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) - { - data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); - } - else if (m_joy1->has_pot_y()) - { - data = m_joy1->pot_y_r(); - } - else if (m_joy2->has_pot_y()) - { - data = m_joy2->pot_y_r(); - } - break; - } - - return data; -} - - -//------------------------------------------------- -// tpi6525_interface tpi1_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( cbm2_state::tpi1_irq_w ) -{ - m_tpi1_irq = state; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_tpi1_irq || m_user_irq); -} - -WRITE_LINE_MEMBER( p500_state::tpi1_irq_w ) -{ - m_tpi1_irq = state; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_vic_irq || m_tpi1_irq || m_user_irq); -} - -READ8_MEMBER( cbm2_state::tpi1_pa_r ) -{ - /* - - bit description - - 0 0 - 1 0 - 2 REN - 3 ATN - 4 DAV - 5 EOI - 6 NDAC - 7 NRFD - - */ - - UINT8 data = 0; - - // IEEE-488 - data |= m_ieee2->ren_r() << 2; - data |= m_ieee2->atn_r() << 3; - data |= m_ieee2->dav_r() << 4; - data |= m_ieee2->eoi_r() << 5; - data |= m_ieee2->ndac_r() << 6; - data |= m_ieee2->nrfd_r() << 7; - - return data; -} - -WRITE8_MEMBER( cbm2_state::tpi1_pa_w ) -{ - /* - - bit description - - 0 75161A DC - 1 75161A TE - 2 REN - 3 ATN - 4 DAV - 5 EOI - 6 NDAC - 7 NRFD - - */ - - // IEEE-488 - m_ieee2->dc_w(BIT(data, 0)); - - m_ieee1->te_w(BIT(data, 1)); - m_ieee2->te_w(BIT(data, 1)); - - m_ieee2->ren_w(BIT(data, 2)); - m_ieee2->atn_w(BIT(data, 3)); - m_ieee2->dav_w(BIT(data, 4)); - m_ieee2->eoi_w(BIT(data, 5)); - m_ieee2->ndac_w(BIT(data, 6)); - m_ieee2->nrfd_w(BIT(data, 7)); -} - -READ8_MEMBER( cbm2_state::tpi1_pb_r ) -{ - /* - - bit description - - 0 IFC - 1 SRQ - 2 user port PB2 - 3 user port PB3 - 4 - 5 - 6 - 7 CASS SW - - */ - - UINT8 data = 0; - - // IEEE-488 - data |= m_ieee2->ifc_r(); - data |= m_ieee2->srq_r() << 1; - - // user port - data |= m_user->pb2_r() << 2; - data |= m_user->pb3_r() << 3; - - // cassette - data |= m_cassette->sense_r() << 7; - - return data; -} - -WRITE8_MEMBER( cbm2_state::tpi1_pb_w ) -{ - /* - - bit description - - 0 IFC - 1 SRQ - 2 user port PB2 - 3 user port PB3 - 4 DRAMON - 5 CASS WRT - 6 CASS MTR - 7 - - */ - - // IEEE-488 - m_ieee2->ifc_w(BIT(data, 0)); - m_ieee2->srq_w(BIT(data, 1)); - - // user port - m_user->pb2_w(BIT(data, 2)); - m_user->pb3_w(BIT(data, 3)); - - // memory - m_dramon = BIT(data, 4); - if (m_busy2) m_busen1 = m_dramon; - - // cassette - m_cassette->write(BIT(data, 5)); - m_cassette->motor_w(BIT(data, 6)); -} - -WRITE_LINE_MEMBER( cbm2_state::tpi1_ca_w ) -{ - m_graphics = state; -} - -WRITE_LINE_MEMBER( p500_state::tpi1_ca_w ) -{ - m_statvid = state; -} - -WRITE_LINE_MEMBER( p500_state::tpi1_cb_w ) -{ - m_vicdotsel = state; -} - -//------------------------------------------------- -// tpi6525_interface tpi2_intf -//------------------------------------------------- - -UINT8 cbm2_state::read_keyboard() -{ - UINT8 data = 0xff; - - if (!BIT(m_tpi2_pa, 0)) data &= m_pa0->read(); - if (!BIT(m_tpi2_pa, 1)) data &= m_pa1->read(); - if (!BIT(m_tpi2_pa, 2)) data &= m_pa2->read(); - if (!BIT(m_tpi2_pa, 3)) data &= m_pa3->read(); - if (!BIT(m_tpi2_pa, 4)) data &= m_pa4->read(); - if (!BIT(m_tpi2_pa, 5)) data &= m_pa5->read(); - if (!BIT(m_tpi2_pa, 6)) data &= m_pa6->read(); - if (!BIT(m_tpi2_pa, 7)) data &= m_pa7->read(); - if (!BIT(m_tpi2_pb, 0)) data &= m_pb0->read() & m_lock->read(); - if (!BIT(m_tpi2_pb, 1)) data &= m_pb1->read(); - if (!BIT(m_tpi2_pb, 2)) data &= m_pb2->read(); - if (!BIT(m_tpi2_pb, 3)) data &= m_pb3->read(); - if (!BIT(m_tpi2_pb, 4)) data &= m_pb4->read(); - if (!BIT(m_tpi2_pb, 5)) data &= m_pb5->read(); - if (!BIT(m_tpi2_pb, 6)) data &= m_pb6->read(); - if (!BIT(m_tpi2_pb, 7)) data &= m_pb7->read(); - - return data; -} - -WRITE8_MEMBER( cbm2_state::tpi2_pa_w ) -{ - m_tpi2_pa = data; -} - -WRITE8_MEMBER( cbm2_state::tpi2_pb_w ) -{ - m_tpi2_pb = data; -} - -READ8_MEMBER( cbm2_state::tpi2_pc_r ) -{ - /* - - bit description - - 0 COLUMN 0 - 1 COLUMN 1 - 2 COLUMN 2 - 3 COLUMN 3 - 4 COLUMN 4 - 5 COLUMN 5 - 6 0=PAL, 1=NTSC - 7 0 - - */ - - return (m_ntsc << 6) | (read_keyboard() & 0x3f); -} - -READ8_MEMBER( cbm2hp_state::tpi2_pc_r ) -{ - /* - - bit description - - 0 COLUMN 0 - 1 COLUMN 1 - 2 COLUMN 2 - 3 COLUMN 3 - 4 COLUMN 4 - 5 COLUMN 5 - 6 1 - 7 1 - - */ - - return read_keyboard(); -} - -READ8_MEMBER( p500_state::tpi2_pc_r ) -{ - /* - - bit description - - 0 COLUMN 0 - 1 COLUMN 1 - 2 COLUMN 2 - 3 COLUMN 3 - 4 COLUMN 4 - 5 COLUMN 5 - 6 0 - 7 0 - - */ - - return read_keyboard(); -} - -WRITE8_MEMBER( p500_state::tpi2_pc_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 VICBNKSEL0 - 7 VICBNKSEL1 - - */ - - m_vicbnksel = data >> 6; -} - -//------------------------------------------------- -// MOS6526_INTERFACE( cia_intf ) -//------------------------------------------------- - -READ8_MEMBER( cbm2_state::cia_pa_r ) -{ - /* - - bit description - - 0 IEEE-488 D0, user port 1D0 - 1 IEEE-488 D1, user port 1D1 - 2 IEEE-488 D2, user port 1D2 - 3 IEEE-488 D3, user port 1D3 - 4 IEEE-488 D4, user port 1D4 - 5 IEEE-488 D5, user port 1D5 - 6 IEEE-488 D6, user port 1D6, LTPN - 7 IEEE-488 D7, user port 1D7, GAME TRIGGER 24 - - */ - - UINT8 data = 0; - - // IEEE-488 - data |= m_ieee1->read(space, 0); - - // user port - data &= m_user->d1_r(space, 0); - - // joystick - data &= ~(!BIT(m_joy1->joy_r(), 5) << 6); - data &= ~(!BIT(m_joy2->joy_r(), 5) << 7); - - return data; -} - -WRITE8_MEMBER( cbm2_state::cia_pa_w ) -{ - /* - - bit description - - 0 IEEE-488 D0, user port 1D0 - 1 IEEE-488 D1, user port 1D1 - 2 IEEE-488 D2, user port 1D2 - 3 IEEE-488 D3, user port 1D3 - 4 IEEE-488 D4, user port 1D4 - 5 IEEE-488 D5, user port 1D5 - 6 IEEE-488 D6, user port 1D6 - 7 IEEE-488 D7, user port 1D7 - - */ - - // IEEE-488 - m_ieee1->write(space, 0, data); - - // user port - m_user->d1_w(space, 0, data); - - // joystick - m_cia_pa = data; -} - -READ8_MEMBER( cbm2_state::cia_pb_r ) -{ - /* - - bit description - - 0 user port 2D0, GAME10 - 1 user port 2D1, GAME11 - 2 user port 2D2, GAME12 - 3 user port 2D3, GAME13 - 4 user port 2D4, GAME20 - 5 user port 2D5, GAME21 - 6 user port 2D6, GAME22 - 7 user port 2D7, GAME23 - - */ - - UINT8 data = 0; - - // joystick - data |= m_joy1->joy_r() & 0x0f; - data |= (m_joy2->joy_r() & 0x0f) << 4; - - // user port - data &= m_user->d2_r(space, 0); - - return data; -} - - -//------------------------------------------------- -// tpi6525_interface ext_tpi_intf -//------------------------------------------------- - -void cbm2_state::set_busy2(int state) -{ - m_busy2 = state; - - if (m_busy2) - { - //m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - m_busen1 = m_dramon; - } - else - { - //m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - - m_busen1 = 0; - } -} - -READ8_MEMBER( cbm2_state::ext_tpi_pb_r ) -{ - /* - - bit description - - 0 _BUSY1 - 1 _BUSY2 - 2 _REQ - 3 _ACK - 4 DATA/_CMD - 5 DIR - 6 1 - 7 1 - - */ - - UINT8 data = 0xc0; - - // _BUSY1 - data |= !m_busen1; - - // _BUSY2 - data |= m_busy2 << 1; - - // CIA - data |= m_ext_tpi_pb & m_ext_cia_pb & 0x3c; - - return data; -} - -WRITE8_MEMBER( cbm2_state::ext_tpi_pb_w ) -{ - /* - - bit description - - 0 - 1 _BUSY2 - 2 - 3 - 4 - 5 - 6 CIA FLAG - 7 - - */ - - m_ext_tpi_pb = data; - - // _BUSY2 - if (!BIT(data, 1)) - { - set_busy2(0); - } - - // FLAG - m_ext_cia->flag_w(BIT(data, 6)); -} - -WRITE8_MEMBER( cbm2_state::ext_tpi_pc_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 BSYCLK - 6 - 7 - - */ - - // _BUSY2 - if (BIT(data, 5)) - { - set_busy2(1); - } -} - -//------------------------------------------------- -// MOS6526_INTERFACE( ext_cia_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( cbm2_state::ext_cia_irq_w ) -{ - m_tpi1->i3_w(!state); -} - -READ8_MEMBER( cbm2_state::ext_cia_pb_r ) -{ - /* - - bit description - - 0 _BUSY1 - 1 _BUSY2 - 2 _REQ - 3 _ACK - 4 DATA/_CMD - 5 DIR - 6 1 - 7 1 - - */ - - UINT8 data = 0xc0; - - // _BUSY1 - data |= !m_busen1; - - // _BUSY2 - data |= m_busy2 << 1; - - // TPI - data |= m_ext_tpi_pb & m_ext_cia_pb & 0x3c; - - return data; -} - -WRITE8_MEMBER( cbm2_state::ext_cia_pb_w ) -{ - /* - - bit description - - 0 - 1 _BUSY2 - 2 - 3 - 4 - 5 - 6 _INT1 - 7 _INT2 - - */ - - m_ext_cia_pb = data; - - // _BUSY2 - if (!BIT(data, 1)) - { - set_busy2(0); - } - - if (!BIT(data, 6)) - { - set_busy2(0); - } - - m_ext_pic->ir0_w(!BIT(data, 6)); - m_ext_pic->ir7_w(BIT(data, 7)); -} - - -//------------------------------------------------- -// CBM2_USER_PORT_INTERFACE( user_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( cbm2_state::user_irq_w ) -{ - m_user_irq = state; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_tpi1_irq || m_user_irq); -} - - -//------------------------------------------------- -// CBM2_USER_PORT_INTERFACE( p500_user_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( p500_state::user_irq_w ) -{ - m_user_irq = state; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_vic_irq || m_tpi1_irq || m_user_irq); -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void cbm2_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - m_tpi1->i0_w(m_todclk); - - if (m_ext_pic) m_ext_pic->ir2_w(m_todclk); - - m_todclk = !m_todclk; -} - - -//------------------------------------------------- -// MACHINE_START( cbm2 ) -//------------------------------------------------- - -MACHINE_START_MEMBER( cbm2_state, cbm2 ) -{ - // allocate memory - m_video_ram.allocate(m_video_ram_size); - m_buffer_ram.allocate(0x800); - - // allocate timer - int todclk = (m_ntsc ? 60 : 50) * 2; - - m_todclk_timer = timer_alloc(); - m_todclk_timer->adjust(attotime::from_hz(todclk), 0, attotime::from_hz(todclk)); - - // state saving - save_item(NAME(m_dramon)); - save_item(NAME(m_busen1)); - save_item(NAME(m_busy2)); - save_item(NAME(m_graphics)); - save_item(NAME(m_ntsc)); - save_item(NAME(m_todclk)); - save_item(NAME(m_tpi1_irq)); - save_item(NAME(m_tpi2_pa)); - save_item(NAME(m_tpi2_pb)); - save_item(NAME(m_cia_pa)); -} - - -//------------------------------------------------- -// MACHINE_START( cbm2_ntsc ) -//------------------------------------------------- - -MACHINE_START_MEMBER( cbm2_state, cbm2_ntsc ) -{ - m_ntsc = 1; - - MACHINE_START_CALL_MEMBER(cbm2); -} - - -//------------------------------------------------- -// MACHINE_START( cbm2_pal ) -//------------------------------------------------- - -MACHINE_START_MEMBER( cbm2_state, cbm2_pal ) -{ - m_ntsc = 0; - - MACHINE_START_CALL_MEMBER(cbm2); -} - - -//------------------------------------------------- -// MACHINE_START( cbm2x_ntsc ) -//------------------------------------------------- - -MACHINE_START_MEMBER( cbm2_state, cbm2x_ntsc ) -{ - // allocate memory - m_extbuf_ram.allocate(0x800); - - MACHINE_START_CALL_MEMBER(cbm2_ntsc); -} - - -//------------------------------------------------- -// MACHINE_START( cbm2x_pal ) -//------------------------------------------------- - -MACHINE_START_MEMBER( cbm2_state, cbm2x_pal ) -{ - // allocate memory - m_extbuf_ram.allocate(0x800); - - MACHINE_START_CALL_MEMBER(cbm2_pal); -} - - -//------------------------------------------------- -// MACHINE_START( p500 ) -//------------------------------------------------- - -MACHINE_START_MEMBER( p500_state, p500 ) -{ - m_video_ram_size = 0x400; - - MACHINE_START_CALL_MEMBER(cbm2); - - // allocate memory - m_color_ram.allocate(0x400); - - // state saving - save_item(NAME(m_statvid)); - save_item(NAME(m_vicdotsel)); - save_item(NAME(m_vicbnksel)); - save_item(NAME(m_vic_irq)); -} - - -//------------------------------------------------- -// MACHINE_START( p500_ntsc ) -//------------------------------------------------- - -MACHINE_START_MEMBER( p500_state, p500_ntsc ) -{ - m_ntsc = 1; - - MACHINE_START_CALL_MEMBER(p500); -} - - -//------------------------------------------------- -// MACHINE_START( p500_pal ) -//------------------------------------------------- - -MACHINE_START_MEMBER( p500_state, p500_pal ) -{ - m_ntsc = 0; - - MACHINE_START_CALL_MEMBER(p500); -} - - -MACHINE_RESET_MEMBER( cbm2_state, cbm2 ) -{ - m_dramon = 1; - m_busen1 = 1; - m_busy2 = 1; - m_graphics = 1; - m_tpi1_irq = CLEAR_LINE; - m_user_irq = CLEAR_LINE; - -m_ext_tpi_pb = 0xff; -m_ext_cia_pb = 0xff; - - m_maincpu->reset(); - - if (m_crtc) m_crtc->reset(); - m_sid->reset(); - m_tpi1->reset(); - m_tpi2->reset(); - m_acia->reset(); - m_cia->reset(); - - m_ieee->reset(); -} - - -MACHINE_RESET_MEMBER( p500_state, p500 ) -{ - MACHINE_RESET_CALL_MEMBER(cbm2); - - m_vic->reset(); - - m_statvid = 1; - m_vicdotsel = 1; - m_vicbnksel = 0x03; - m_vic_irq = CLEAR_LINE; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( 128k ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( 128k ) - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("256K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( 256k ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( 256k ) - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( p500_ntsc ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( p500_ntsc, p500_state ) - MCFG_MACHINE_START_OVERRIDE(p500_state, p500_ntsc) - MCFG_MACHINE_RESET_OVERRIDE(p500_state, p500) - - // basic hardware - MCFG_CPU_ADD(M6509_TAG, M6509, XTAL_14_31818MHz/14) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_CPU_PROGRAM_MAP(p500_mem) - MCFG_QUANTUM_PERFECT_CPU(M6509_TAG) - - // video hardware - MCFG_DEVICE_ADD(MOS6567_TAG, MOS6567, XTAL_14_31818MHz/14) - MCFG_MOS6566_CPU(M6509_TAG) - MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(p500_state, vic_irq_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) - MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) - MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) - MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DEVICE(MOS6567_TAG, mos6567_device, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_14_31818MHz/14) - MCFG_MOS6581_POTX_CALLBACK(READ8(p500_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(p500_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_PLS100_ADD(PLA1_TAG) - MCFG_PLS100_ADD(PLA2_TAG) - MCFG_DEVICE_ADD(MOS6525_1_TAG, TPI6525, 0) - MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(p500_state, tpi1_irq_w)) - MCFG_TPI6525_IN_PA_CB(READ8(cbm2_state, tpi1_pa_r)) - MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi1_pa_w)) - MCFG_TPI6525_IN_PB_CB(READ8(cbm2_state, tpi1_pb_r)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi1_pb_w)) - MCFG_TPI6525_OUT_CA_CB(WRITELINE(p500_state, tpi1_ca_w)) - MCFG_TPI6525_OUT_CB_CB(WRITELINE(p500_state, tpi1_cb_w)) - MCFG_DEVICE_ADD(MOS6525_2_TAG, TPI6525, 0) - MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi2_pa_w)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi2_pb_w)) - MCFG_TPI6525_IN_PC_CB(READ8(p500_state, tpi2_pc_r)) - MCFG_TPI6525_OUT_PC_CB(WRITE8(p500_state, tpi2_pc_w)) - MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, VIC6567_CLOCK) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_IRQ_HANDLER(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_MOS6551_RXC_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_etc)) - MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL_14_31818MHz/14) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(cbm2_state, cia_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cbm2_state, cia_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, cia_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w)) - MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) - MCFG_DEVICE_ADD(DS75161A_TAG, DS75161A, 0) - MCFG_DS75161A_IN_REN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ren_r)) - MCFG_DS75161A_IN_IFC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ifc_r)) - MCFG_DS75161A_IN_NDAC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ndac_r)) - MCFG_DS75161A_IN_NRFD_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, nrfd_r)) - MCFG_DS75161A_IN_DAV_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, dav_r)) - MCFG_DS75161A_IN_EOI_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, eoi_r)) - MCFG_DS75161A_IN_ATN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, atn_r)) - MCFG_DS75161A_IN_SRQ_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, srq_r)) - MCFG_DS75161A_OUT_REN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) - MCFG_DS75161A_OUT_IFC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) - MCFG_DS75161A_OUT_NDAC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) - MCFG_DS75161A_OUT_NRFD_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, nrfd_w)) - MCFG_DS75161A_OUT_DAV_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) - MCFG_DS75161A_OUT_EOI_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, eoi_w)) - MCFG_DS75161A_OUT_ATN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, atn_w)) - MCFG_DS75161A_OUT_SRQ_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, srq_w)) - MCFG_CBM_IEEE488_ADD("c8050") - MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL, DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6567_TAG, mos6567_device, lp_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) - MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/14, cbm2_expansion_cards, NULL) - MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, cbm2_user_port_cards, NULL) - MCFG_CBM2_USER_PORT_IRQ_CALLBACK(WRITELINE(p500_state, user_irq_w)) - MCFG_CBM2_USER_PORT_SP_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w)) - MCFG_CBM2_USER_PORT_CNT_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w)) - MCFG_CBM2_USER_PORT_FLAG_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) - - MCFG_QUICKLOAD_ADD("quickload", p500_state, p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - // internal ram - MCFG_FRAGMENT_ADD(128k) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list", "cbm2_cart") - MCFG_SOFTWARE_LIST_ADD("flop_list", "p500_flop") - MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( p500_pal ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( p500_pal, p500_state ) - MCFG_MACHINE_START_OVERRIDE(p500_state, p500_pal) - MCFG_MACHINE_RESET_OVERRIDE(p500_state, p500) - - // basic hardware - MCFG_CPU_ADD(M6509_TAG, M6509, XTAL_17_734472MHz/18) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_CPU_PROGRAM_MAP(p500_mem) - MCFG_QUANTUM_PERFECT_CPU(M6509_TAG) - - // video hardware - MCFG_DEVICE_ADD(MOS6569_TAG, MOS6569, XTAL_17_734472MHz/18) - MCFG_MOS6566_CPU(M6509_TAG) - MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(p500_state, vic_irq_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) - MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) - MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) - MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DEVICE(MOS6569_TAG, mos6569_device, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_17_734472MHz/18) - MCFG_MOS6581_POTX_CALLBACK(READ8(p500_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(p500_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_PLS100_ADD(PLA1_TAG) - MCFG_PLS100_ADD(PLA2_TAG) - MCFG_DEVICE_ADD(MOS6525_1_TAG, TPI6525, 0) - MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(p500_state, tpi1_irq_w)) - MCFG_TPI6525_IN_PA_CB(READ8(cbm2_state, tpi1_pa_r)) - MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi1_pa_w)) - MCFG_TPI6525_IN_PB_CB(READ8(cbm2_state, tpi1_pb_r)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi1_pb_w)) - MCFG_TPI6525_OUT_CA_CB(WRITELINE(p500_state, tpi1_ca_w)) - MCFG_TPI6525_OUT_CB_CB(WRITELINE(p500_state, tpi1_cb_w)) - MCFG_DEVICE_ADD(MOS6525_2_TAG, TPI6525, 0) - MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi2_pa_w)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi2_pb_w)) - MCFG_TPI6525_IN_PC_CB(READ8(p500_state, tpi2_pc_r)) - MCFG_TPI6525_OUT_PC_CB(WRITE8(p500_state, tpi2_pc_w)) - MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_IRQ_HANDLER(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL_17_734472MHz/18) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(cbm2_state, cia_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cbm2_state, cia_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, cia_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w)) - MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) - MCFG_DEVICE_ADD(DS75161A_TAG, DS75161A, 0) - MCFG_DS75161A_IN_REN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ren_r)) - MCFG_DS75161A_IN_IFC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ifc_r)) - MCFG_DS75161A_IN_NDAC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ndac_r)) - MCFG_DS75161A_IN_NRFD_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, nrfd_r)) - MCFG_DS75161A_IN_DAV_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, dav_r)) - MCFG_DS75161A_IN_EOI_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, eoi_r)) - MCFG_DS75161A_IN_ATN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, atn_r)) - MCFG_DS75161A_IN_SRQ_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, srq_r)) - MCFG_DS75161A_OUT_REN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) - MCFG_DS75161A_OUT_IFC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) - MCFG_DS75161A_OUT_NDAC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) - MCFG_DS75161A_OUT_NRFD_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, nrfd_w)) - MCFG_DS75161A_OUT_DAV_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) - MCFG_DS75161A_OUT_EOI_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, eoi_w)) - MCFG_DS75161A_OUT_ATN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, atn_w)) - MCFG_DS75161A_OUT_SRQ_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, srq_w)) - MCFG_CBM_IEEE488_ADD("c8050") - MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL, DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6569_TAG, mos6569_device, lp_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) - MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_17_734472MHz/18, cbm2_expansion_cards, NULL) - MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, cbm2_user_port_cards, NULL) - MCFG_CBM2_USER_PORT_IRQ_CALLBACK(WRITELINE(p500_state, user_irq_w)) - MCFG_CBM2_USER_PORT_SP_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w)) - MCFG_CBM2_USER_PORT_CNT_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w)) - MCFG_CBM2_USER_PORT_FLAG_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) - - MCFG_QUICKLOAD_ADD("quickload", p500_state, p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - // internal ram - MCFG_FRAGMENT_ADD(128k) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list", "cbm2_cart") - MCFG_SOFTWARE_LIST_ADD("flop_list", "p500_flop") - MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm2lp_ntsc ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( cbm2lp_ntsc, cbm2_state ) - MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2_ntsc) - MCFG_MACHINE_RESET_OVERRIDE(cbm2_state, cbm2) - - // basic hardware - MCFG_CPU_ADD(M6509_TAG, M6509, XTAL_18MHz/9) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_CPU_PROGRAM_MAP(cbm2_mem) - MCFG_QUANTUM_PERFECT_CPU(M6509_TAG) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DEVICE(MC68B45_TAG, mc6845_device, screen_update) - - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(768, 312) - MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 312-1) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_MC6845_ADD(MC68B45_TAG, MC6845, SCREEN_TAG, XTAL_18MHz/9) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(9) - MCFG_MC6845_UPDATE_ROW_CB(cbm2_state, crtc_update_row) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_18MHz/9) - MCFG_MOS6581_POTX_CALLBACK(READ8(cbm2_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(cbm2_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_PLS100_ADD(PLA1_TAG) - MCFG_DEVICE_ADD(MOS6525_1_TAG, TPI6525, 0) - MCFG_TPI6525_OUT_IRQ_CB(WRITELINE(cbm2_state, tpi1_irq_w)) - MCFG_TPI6525_IN_PA_CB(READ8(cbm2_state, tpi1_pa_r)) - MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi1_pa_w)) - MCFG_TPI6525_IN_PA_CB(READ8(cbm2_state, tpi1_pb_r)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi1_pb_w)) - MCFG_TPI6525_OUT_CA_CB(WRITELINE(cbm2_state, tpi1_ca_w)) - MCFG_DEVICE_ADD(MOS6525_2_TAG, TPI6525, 0) - MCFG_TPI6525_OUT_PA_CB(WRITE8(cbm2_state, tpi2_pa_w)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, tpi2_pb_w)) - MCFG_TPI6525_IN_PC_CB(READ8(cbm2_state, tpi2_pc_r)) - MCFG_DEVICE_ADD(MOS6551A_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_IRQ_HANDLER(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w)) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526A, XTAL_18MHz/9) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(cbm2_state, cia_pa_r)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(cbm2_state, cia_pa_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, cia_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8(CBM2_USER_PORT_TAG, cbm2_user_port_device, d2_w)) - MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, pc_w)) - MCFG_DS75160A_ADD(DS75160A_TAG, DEVREAD8(IEEE488_TAG, ieee488_device, dio_r), DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) - MCFG_DEVICE_ADD(DS75161A_TAG, DS75161A, 0) - MCFG_DS75161A_IN_REN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ren_r)) - MCFG_DS75161A_IN_IFC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ifc_r)) - MCFG_DS75161A_IN_NDAC_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, ndac_r)) - MCFG_DS75161A_IN_NRFD_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, nrfd_r)) - MCFG_DS75161A_IN_DAV_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, dav_r)) - MCFG_DS75161A_IN_EOI_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, eoi_r)) - MCFG_DS75161A_IN_ATN_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, atn_r)) - MCFG_DS75161A_IN_SRQ_CB(DEVREADLINE(IEEE488_TAG, ieee488_device, srq_r)) - MCFG_DS75161A_OUT_REN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) - MCFG_DS75161A_OUT_IFC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) - MCFG_DS75161A_OUT_NDAC_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) - MCFG_DS75161A_OUT_NRFD_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, nrfd_w)) - MCFG_DS75161A_OUT_DAV_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) - MCFG_DS75161A_OUT_EOI_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, eoi_w)) - MCFG_DS75161A_OUT_ATN_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, atn_w)) - MCFG_DS75161A_OUT_SRQ_CB(DEVWRITELINE(IEEE488_TAG, ieee488_device, srq_w)) - MCFG_CBM_IEEE488_ADD("c8050") - MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i1_w)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, NULL,DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL) - MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_18MHz/9, cbm2_expansion_cards, NULL) - MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, cbm2_user_port_cards, NULL) - MCFG_CBM2_USER_PORT_IRQ_CALLBACK(WRITELINE(cbm2_state, user_irq_w)) - MCFG_CBM2_USER_PORT_SP_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w)) - MCFG_CBM2_USER_PORT_CNT_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w)) - MCFG_CBM2_USER_PORT_FLAG_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MOS6551A_TAG, mos6551_device, write_cts)) - - MCFG_QUICKLOAD_ADD("quickload", cbm2_state, cbmb, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list", "cbm2_cart") - MCFG_SOFTWARE_LIST_ADD("flop_list", "cbm2_flop") - MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( b128 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( b128, cbm2lp_ntsc ) - MCFG_FRAGMENT_ADD(128k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( b256 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( b256, cbm2lp_ntsc ) - MCFG_FRAGMENT_ADD(256k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm2lp_pal ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm2lp_pal, cbm2lp_ntsc ) - MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2_pal) - - MCFG_DEVICE_MODIFY(MOS6526_TAG) - MCFG_MOS6526_TOD(50) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm610 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm610, cbm2lp_pal ) - MCFG_FRAGMENT_ADD(128k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm620 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm620, cbm2lp_pal ) - MCFG_FRAGMENT_ADD(256k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm2hp_ntsc ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( cbm2hp_ntsc, cbm2lp_ntsc, cbm2hp_state ) - MCFG_DEVICE_MODIFY(MOS6525_2_TAG) - MCFG_TPI6525_IN_PC_CB(READ8(cbm2hp_state, tpi2_pc_r)) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( b128hp ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( b128hp, cbm2hp_ntsc ) - MCFG_FRAGMENT_ADD(128k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( b256hp ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( b256hp, cbm2hp_ntsc ) - MCFG_FRAGMENT_ADD(256k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( bx256hp ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( bx256hp, b256hp ) - MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2x_ntsc) - - MCFG_CPU_ADD(EXT_I8088_TAG, I8088, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(ext_mem) - MCFG_CPU_IO_MAP(ext_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(EXT_I8259A_TAG, pic8259_device, inta_cb) - - MCFG_PIC8259_ADD(EXT_I8259A_TAG, INPUTLINE(EXT_I8088_TAG, INPUT_LINE_IRQ0), VCC, NULL) - MCFG_DEVICE_ADD(EXT_MOS6525_TAG, TPI6525, 0) - MCFG_TPI6525_IN_PA_CB(DEVREAD8(EXT_MOS6526_TAG, mos6526_device, pa_r)) - MCFG_TPI6525_IN_PB_CB(READ8(cbm2_state, ext_tpi_pb_r)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, ext_tpi_pb_w)) - MCFG_TPI6525_OUT_PC_CB(WRITE8(cbm2_state, ext_tpi_pc_w)) - MCFG_DEVICE_ADD(EXT_MOS6526_TAG, MOS6526, XTAL_18MHz/9) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(cbm2_state, ext_cia_irq_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(DEVREAD8(EXT_MOS6525_TAG, tpi6525_device, pa_r)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, ext_cia_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(cbm2_state, ext_cia_pb_w)) - - MCFG_SOFTWARE_LIST_ADD("flop_list2", "bx256hp_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm2hp_pal ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm2hp_pal, cbm2hp_ntsc ) - MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2_pal) - - // devices - MCFG_DEVICE_MODIFY(MOS6525_2_TAG) - MCFG_TPI6525_IN_PC_CB(READ8(cbm2hp_state, tpi2_pc_r)) - - MCFG_DEVICE_MODIFY(MOS6526_TAG) - MCFG_MOS6526_TOD(50) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm710 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm710, cbm2hp_pal ) - MCFG_FRAGMENT_ADD(128k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm720 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm720, cbm2hp_pal ) - MCFG_FRAGMENT_ADD(256k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm730 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm730, cbm720 ) - MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2x_pal) - - MCFG_CPU_ADD(EXT_I8088_TAG, I8088, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(ext_mem) - MCFG_CPU_IO_MAP(ext_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(EXT_I8259A_TAG, pic8259_device, inta_cb) - - MCFG_PIC8259_ADD(EXT_I8259A_TAG, INPUTLINE(EXT_I8088_TAG, INPUT_LINE_IRQ0), VCC, NULL) - MCFG_DEVICE_ADD(EXT_MOS6525_TAG, TPI6525, 0) - MCFG_TPI6525_IN_PA_CB(DEVREAD8(EXT_MOS6526_TAG, mos6526_device, pa_r)) - MCFG_TPI6525_IN_PB_CB(READ8(cbm2_state, ext_tpi_pb_r)) - MCFG_TPI6525_OUT_PB_CB(WRITE8(cbm2_state, ext_tpi_pb_w)) - MCFG_TPI6525_OUT_PC_CB(WRITE8(cbm2_state, ext_tpi_pc_w)) - MCFG_DEVICE_ADD(EXT_MOS6526_TAG, MOS6526, XTAL_18MHz/9) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(cbm2_state, ext_cia_irq_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(DEVREAD8(EXT_MOS6525_TAG, tpi6525_device, pa_r)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(cbm2_state, ext_cia_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(cbm2_state, ext_cia_pb_w)) - - MCFG_SOFTWARE_LIST_ADD("flop_list2", "bx256hp_flop") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( p500 ) -//------------------------------------------------- - -ROM_START( p500 ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_DEFAULT_BIOS("r2") - ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) - ROMX_LOAD( "901236-01.u84", 0x0000, 0x2000, CRC(33eb6aa2) SHA1(7e3497ae2edbb38c753bd31ed1bf3ae798c9a976), ROM_BIOS(1) ) - ROMX_LOAD( "901235-01.u83", 0x2000, 0x2000, CRC(18a27feb) SHA1(951b5370dd7db762b8504a141f9f26de345069bb), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) - ROMX_LOAD( "901236-02.u84", 0x0000, 0x2000, CRC(c62ab16f) SHA1(f50240407bade901144f7e9f489fa9c607834eca), ROM_BIOS(2) ) - ROMX_LOAD( "901235-02.u83", 0x2000, 0x2000, CRC(20b7df33) SHA1(1b9a55f12f8cf025754d8029cc5324b474c35841), ROM_BIOS(2) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROMX_LOAD( "901234-01.u82", 0x0000, 0x2000, CRC(67962025) SHA1(24b41b65c85bf30ab4e2911f677ce9843845b3b1), ROM_BIOS(1) ) - ROMX_LOAD( "901234-02.u82", 0x0000, 0x2000, CRC(f46bbd2b) SHA1(097197d4d08e0b82e0466a5f1fbd49a24f3d2523), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901225-01.u76", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-02.u78", 0x00, 0xf5, CRC(6436b20b) SHA1(57ebebe771791288051afd1abe9b7500bd2df847) ) - - ROM_REGION( 0xf5, PLA2_TAG, 0 ) - ROM_LOAD( "906114-03.u88", 0x00, 0xf5, CRC(668c073e) SHA1(1115858bb2dc91ea9e2016ba2e23ec94239358b4) ) -ROM_END - -#define rom_p500p rom_p500 - - -//------------------------------------------------- -// ROM( b500 ) -//------------------------------------------------- - -ROM_START( b500 ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "901243-01.u59", 0x0000, 0x2000, CRC(22822706) SHA1(901bbf59d8b8682b481be8b2de99b406fffa4bab) ) - ROM_LOAD( "901242-01a.u60", 0x2000, 0x2000, CRC(ef13d595) SHA1(2fb72985d7d4ab69c5780179178828c931a9f5b0) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "901244-01.u61", 0x0000, 0x2000, CRC(93414213) SHA1(a54a593dbb420ae1ac39b0acde9348160f7840ff) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901237-01.u25", 0x0000, 0x1000, CRC(1acf5098) SHA1(e63bf18da48e5a53c99ef127c1ae721333d1d102) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-04.u18", 0x00, 0xf5, CRC(ae3ec265) SHA1(334e0bc4b2c957ecb240c051d84372f7b47efba3) ) -ROM_END - - -//------------------------------------------------- -// ROM( b128 ) -//------------------------------------------------- - -ROM_START( b128 ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_DEFAULT_BIOS("r2") - ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) - ROMX_LOAD( "901243-02b.u59", 0x0000, 0x2000, CRC(9d0366f9) SHA1(625f7337ea972a8bce2bdf2daababc0ed0b3b69b), ROM_BIOS(1) ) - ROMX_LOAD( "901242-02b.u60", 0x2000, 0x2000, CRC(837978b5) SHA1(56e8d2f86bf73ba36b3d3cb84dd75806b66c530a), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) - ROMX_LOAD( "901243-04a.u59", 0x0000, 0x2000, CRC(b0dcb56d) SHA1(08d333208060ee2ce84d4532028d94f71c016b96), ROM_BIOS(2) ) - ROMX_LOAD( "901242-04a.u60", 0x2000, 0x2000, CRC(de04ea4f) SHA1(7c6de17d46a3343dc597d9b9519cf63037b31908), ROM_BIOS(2) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) - ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901237-01.u25", 0x0000, 0x1000, CRC(1acf5098) SHA1(e63bf18da48e5a53c99ef127c1ae721333d1d102) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-04.u18", 0x00, 0xf5, CRC(ae3ec265) SHA1(334e0bc4b2c957ecb240c051d84372f7b47efba3) ) -ROM_END - -#define rom_cbm610 rom_b128 -#define rom_cbm620 rom_b256 - - -//------------------------------------------------- -// ROM( b256 ) -//------------------------------------------------- - -ROM_START( b256 ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) - ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_DEFAULT_BIOS("r2") - ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) - ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) - ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901237-01.u25", 0x0000, 0x1000, CRC(1acf5098) SHA1(e63bf18da48e5a53c99ef127c1ae721333d1d102) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-04.u18", 0x00, 0xf5, CRC(ae3ec265) SHA1(334e0bc4b2c957ecb240c051d84372f7b47efba3) ) -ROM_END - - -//------------------------------------------------- -// ROM( cbm620_hu ) -//------------------------------------------------- - -ROM_START( cbm620_hu ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "610.u60", 0x0000, 0x4000, CRC(8eed0d7e) SHA1(9d06c5c3c012204eaaef8b24b1801759b62bf57e) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "kernhun.u61", 0x0000, 0x2000, CRC(0ea8ca4d) SHA1(9977c9f1136ee9c04963e0b50ae0c056efa5663f) ) - - ROM_REGION( 0x2000, "charom", 0 ) - ROM_LOAD( "charhun.u25", 0x0000, 0x2000, CRC(1fb5e596) SHA1(3254e069f8691b30679b19a9505b6afdfedce6ac) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-04.u18", 0x00, 0xf5, CRC(ae3ec265) SHA1(334e0bc4b2c957ecb240c051d84372f7b47efba3) ) -ROM_END - - -//------------------------------------------------- -// ROM( b128hp ) -//------------------------------------------------- - -ROM_START( b128hp ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_DEFAULT_BIOS("r2") - ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) - ROMX_LOAD( "901243-02b.u59", 0x0000, 0x2000, CRC(9d0366f9) SHA1(625f7337ea972a8bce2bdf2daababc0ed0b3b69b), ROM_BIOS(1) ) - ROMX_LOAD( "901242-02b.u60", 0x2000, 0x2000, CRC(837978b5) SHA1(56e8d2f86bf73ba36b3d3cb84dd75806b66c530a), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) - ROMX_LOAD( "901243-04a.u59", 0x0000, 0x2000, CRC(b0dcb56d) SHA1(08d333208060ee2ce84d4532028d94f71c016b96), ROM_BIOS(2) ) - ROMX_LOAD( "901242-04a.u60", 0x2000, 0x2000, CRC(de04ea4f) SHA1(7c6de17d46a3343dc597d9b9519cf63037b31908), ROM_BIOS(2) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) - ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901232-01.u25", 0x0000, 0x1000, CRC(3a350bc3) SHA1(e7f3cbc8e282f79a00c3e95d75c8d725ee3c6287) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) -ROM_END - -#define rom_cbm710 rom_b128hp - - -//------------------------------------------------- -// ROM( b256hp ) -//------------------------------------------------- - -ROM_START( b256hp ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) - ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_DEFAULT_BIOS("r2") - ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) - ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) - ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901232-01.u25", 0x0000, 0x1000, CRC(3a350bc3) SHA1(e7f3cbc8e282f79a00c3e95d75c8d725ee3c6287) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) -ROM_END - -#define rom_cbm720 rom_b256hp - - -//------------------------------------------------- -// ROM( bx256hp ) -//------------------------------------------------- - -ROM_START( bx256hp ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) - ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) - - ROM_REGION( 0x1000, EXT_I8088_TAG, 0) - ROM_LOAD( "8088.u14", 0x0000, 0x1000, CRC(195e0281) SHA1(ce8acd2a5fb6cbd70d837811d856d656544a1f97) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_DEFAULT_BIOS("r2") - ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) - ROMX_LOAD( "901244-03b.u61", 0x0000, 0x2000, CRC(4276dbba) SHA1(a624899c236bc4458570144d25aaf0b3be08b2cd), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) - ROMX_LOAD( "901244-04a.u61", 0x0000, 0x2000, CRC(09a5667e) SHA1(abb26418b9e1614a8f52bdeee0822d4a96071439), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901232-01.u25", 0x0000, 0x1000, CRC(3a350bc3) SHA1(e7f3cbc8e282f79a00c3e95d75c8d725ee3c6287) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) -ROM_END - -#define rom_cbm730 rom_bx256hp - - -//------------------------------------------------- -// ROM( cbm720_de ) -//------------------------------------------------- - -ROM_START( cbm720_de ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) - ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "324866-03a.u61", 0x0000, 0x2000, CRC(554b008d) SHA1(1483a46924308d86f4c7f9cb71c34851c510fcf4) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "324867-02.u25", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) -ROM_END - - -//------------------------------------------------- -// ROM( cbm720_se ) -//------------------------------------------------- - -ROM_START( cbm720_se ) - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "901241-03.u59", 0x0000, 0x2000, CRC(5c1f3347) SHA1(2d46be2cd89594b718cdd0a86d51b6f628343f42) ) - ROM_LOAD( "901240-03.u60", 0x2000, 0x2000, CRC(72aa44e1) SHA1(0d7f77746290afba8d0abeb87c9caab9a3ad89ce) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "swe-901244-03.u61", 0x0000, 0x2000, CRC(87bc142b) SHA1(fa711f6082741b05a9c80744f5aee68dc8c1dcf4) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901233-03.u25", 0x0000, 0x1000, CRC(09518b19) SHA1(2e28491e31e2c0a3b6db388055216140a637cd09) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "906114-05.u75", 0x00, 0xf5, CRC(ff6ba6b6) SHA1(45808c570eb2eda7091c51591b3dbd2db1ac646a) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, p500, 0, 0, p500_ntsc, cbm2, driver_device, 0, "Commodore Business Machines", "P500 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, p500p, p500, 0, p500_pal, cbm2, driver_device, 0, "Commodore Business Machines", "P500 (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, b500, 0, 0, b128, cbm2, driver_device, 0, "Commodore Business Machines", "B500", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, b128, b500, 0, b128, cbm2, driver_device, 0, "Commodore Business Machines", "B128", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, b256, b500, 0, b256, cbm2, driver_device, 0, "Commodore Business Machines", "B256", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, cbm610, b500, 0, cbm610, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 610", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, cbm620, b500, 0, cbm620, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 620", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, cbm620_hu, b500, 0, cbm620, cbm2_hu, driver_device, 0, "Commodore Business Machines", "CBM 620 (Hungary)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, b128hp, 0, 0, b128hp, cbm2, driver_device, 0, "Commodore Business Machines", "B128-80HP", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, b256hp, b128hp, 0, b256hp, cbm2, driver_device, 0, "Commodore Business Machines", "B256-80HP", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, bx256hp, b128hp, 0, bx256hp, cbm2, driver_device, 0, "Commodore Business Machines", "BX256-80HP", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // 8088 co-processor is missing -COMP( 1983, cbm710, b128hp, 0, cbm710, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 710", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, cbm720, b128hp, 0, cbm720, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 720", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, cbm720_de, b128hp, 0, cbm720, cbm2_de, driver_device, 0, "Commodore Business Machines", "CBM 720 (Germany)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1983, cbm720_se, b128hp, 0, cbm720, cbm2_se, driver_device, 0, "Commodore Business Machines", "CBM 720 (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, cbm730, b128hp, 0, cbm730, cbm2, driver_device, 0, "Commodore Business Machines", "CBM 730", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // 8088 co-processor is missing diff --git a/src/mess/drivers/cc40.c b/src/mess/drivers/cc40.c deleted file mode 100644 index ba5e937d423..00000000000 --- a/src/mess/drivers/cc40.c +++ /dev/null @@ -1,641 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/*************************************************************************** - - Texas Instruments Compact Computer 40 (aka CC-40) - hardware family: CC-40 -> CC-40+(unreleased) -> TI-74 BASICALC -> TI-95 PROCALC - - --------------------------------------------- - | --------------------------------------- | - | | | | - | | LCD screen | | - | | | --------------- - | --------------------------------------- | - | | - | | - | | - | *HD44100H | - | *HD44780A00 | - | | - | | - | | - ----|||||||||||-----------------------------|||||||||||---- - ||||||||||| ||||||||||| - ----|||||||||||-----------------------------|||||||||||---- - | | - | HM6116LP-4 HM6116LP-4 | - | | - | | - | HM6116LP-4 TMX70C20N2L | - | 5MHz | - | AMI 1041036-1 | - | HN61256PC09 | - | *Cartridge | - | --------------- - | | - | ------------------------------------- - |*HEXBUS| - --------- - - HM6116LP-4 - Hitachi 2KB SRAM (newer 18KB version has two HM6264 8KB chips) - HN61256PC09 - Hitachi DIP-28 32KB CMOS Mask PROM - TMX70C20N2L - Texas Instruments TMS70C20 CPU (128 bytes RAM, 2KB ROM) @ 2.5MHz, 40 pins - "X" implies prototype - AMI 1041036-1 - 68-pin QFP AMI Gate Array - HD44100H - 60-pin QFP Hitachi HD44100 LCD Driver - HD44780A00 - 80-pin TFP Hitachi HD44780 LCD Controller - - * - indicates that it's on the other side of the PCB - - - CC-40 is powered by 4 AA batteries. These will also save internal RAM, - provided that the machine is turned off properly. If a program is running, - you may have to press [BREAK] before turning the CC-40 off. If RAM contents - ends up dodgy somehow, just delete the nvram files. - - Officially, minimum total RAM size is 6KB. The system will still boot with less, - but don't expect all software to work properly. - - To run a cartridge, usually the command RUN "DIR" shows which program(s) - can be loaded. Load a program by pressing the [RUN] key while viewing the list, - or manually with the command RUN "" - - - TODO: - - external RAM cartridge (bus_control_w cartridge memory addressing) - - auto clock divider on slow memory access - - Hexbus interface and peripherals - * HX-1000: color plotter - * HX-1010: thermal printer - * HX-3000: RS-232 interface - * HX-3100: modem - * HX-3200: Centronics printer interface - -***************************************************************************/ - -#include "emu.h" -#include "cpu/tms7000/tms7000.h" -#include "video/hd44780.h" -#include "sound/dac.h" -#include "machine/nvram.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#include "cc40.lh" - - -class cc40_state : public driver_device -{ -public: - cc40_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac"), - m_cart(*this, "cartslot"), - m_key_matrix(*this, "IN"), - m_battery_inp(*this, "BATTERY") - { - m_sysram[0] = NULL; - m_sysram[1] = NULL; - } - - required_device m_maincpu; - required_device m_dac; - required_device m_cart; - required_ioport_array<8> m_key_matrix; - required_ioport m_battery_inp; - - nvram_device *m_nvram[2]; - - memory_region *m_cart_rom; - - UINT8 m_bus_control; - UINT8 m_power; - UINT8 m_banks; - UINT8 m_clock_control; - UINT8 m_clock_divider; - UINT8 m_key_select; - - UINT8 *m_sysram[2]; - UINT16 m_sysram_size[2]; - UINT16 m_sysram_end[2]; - UINT16 m_sysram_mask[2]; - - void postload(); - void init_sysram(int chip, UINT16 size); - void update_lcd_indicator(UINT8 y, UINT8 x, int state); - void update_clock_divider(); - - DECLARE_READ8_MEMBER(sysram_r); - DECLARE_WRITE8_MEMBER(sysram_w); - DECLARE_READ8_MEMBER(bus_control_r); - DECLARE_WRITE8_MEMBER(bus_control_w); - DECLARE_WRITE8_MEMBER(power_w); - DECLARE_WRITE8_MEMBER(sound_w); - DECLARE_READ8_MEMBER(battery_r); - DECLARE_READ8_MEMBER(bankswitch_r); - DECLARE_WRITE8_MEMBER(bankswitch_w); - DECLARE_READ8_MEMBER(clock_control_r); - DECLARE_WRITE8_MEMBER(clock_control_w); - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(keyboard_w); - - virtual void machine_reset(); - virtual void machine_start(); - DECLARE_PALETTE_INIT(cc40); - DECLARE_INPUT_CHANGED_MEMBER(sysram_size_changed); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cc40_cartridge); -}; - - - -/*************************************************************************** - - File Handling - -***************************************************************************/ - -DEVICE_IMAGE_LOAD_MEMBER(cc40_state, cc40_cartridge) -{ - UINT32 size = m_cart->common_get_size("rom"); - - // max size is 4*32KB - if (size > 0x20000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(0x20000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // allocate a larger ROM region to have 4x32K banks - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - - -/*************************************************************************** - - Video - -***************************************************************************/ - -PALETTE_INIT_MEMBER(cc40_state, cc40) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); // background - palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on - palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off -} - -void cc40_state::update_lcd_indicator(UINT8 y, UINT8 x, int state) -{ - // reference _________________... - // output# |10 11 12 13 14 0 1 2 3 4 - // above | < SHIFT CTL FN DEG RAD GRAD I/O UCL > - // ---- raw lcd screen here ---- - // under | ERROR v v v v v v _LOW - // output# | 60 61 62 63 50 51 52 53 - output_set_lamp_value(y * 10 + x, state); -} - -static HD44780_PIXEL_UPDATE(cc40_pixel_update) -{ - // char size is 5x7 + cursor - if (x > 4 || y > 7) - return; - - if (line == 1 && pos == 15) - { - // the last char is used to control the 18 lcd indicators - cc40_state *driver_state = device.machine().driver_data(); - driver_state->update_lcd_indicator(y, x, state); - } - else if (line < 2 && pos < 16) - { - // internal: 2*16, external: 1*31 - if (y == 7) y++; // the cursor is slightly below the character - bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; - } -} - - - -/*************************************************************************** - - I/O, Memory Maps - -***************************************************************************/ - -READ8_MEMBER(cc40_state::sysram_r) -{ - // read system ram, based on addressing configured in bus_control_w - if (offset < m_sysram_end[0] && m_sysram_size[0] != 0) - return m_sysram[0][offset & (m_sysram_size[0] - 1)]; - else if (offset < m_sysram_end[1] && m_sysram_size[1] != 0) - return m_sysram[1][(offset - m_sysram_end[0]) & (m_sysram_size[1] - 1)]; - else - return 0xff; -} - -WRITE8_MEMBER(cc40_state::sysram_w) -{ - // write system ram, based on addressing configured in bus_control_w - if (offset < m_sysram_end[0] && m_sysram_size[0] != 0) - m_sysram[0][offset & (m_sysram_size[0] - 1)] = data; - else if (offset < m_sysram_end[1] && m_sysram_size[1] != 0) - m_sysram[1][(offset - m_sysram_end[0]) & (m_sysram_size[1] - 1)] = data; -} - -READ8_MEMBER(cc40_state::bus_control_r) -{ - return m_bus_control; -} - -WRITE8_MEMBER(cc40_state::bus_control_w) -{ - // d0,d1: auto enable clock divider on cartridge memory access (d0: area 1, d1: area 2) - - // d2,d3: system ram addressing - // 00: 8K, 8K @ $1000-$2fff, $3000-$4fff - // 01: 8K, 2K @ $1000-$2fff, $3000-$37ff - // 10: 2K, 8K @ $1000-$17ff, $1800-$37ff - // 11: 2K, 2K @ $1000-$17ff, $1800-$1fff - int d2 = (data & 4) ? 0x0800 : 0x2000; - int d3 = (data & 8) ? 0x0800 : 0x2000; - m_sysram_end[0] = d3; - m_sysram_mask[0] = d3 - 1; - m_sysram_end[1] = d3 + d2; - m_sysram_mask[1] = d2 - 1; - - // d4,d5: cartridge memory addressing - // 00: 2K @ $5000-$57ff & $5800-$5fff - // 01: 8K @ $5000-$6fff & $7000-$8fff - // 10:16K @ $5000-$8fff & $9000-$cfff - // 11: 8K @ $1000-$2fff & $3000-$4fff - system ram is disabled - - // d6: auto enable clock divider on system rom access - - // d7: unused? - m_bus_control = data; -} - -WRITE8_MEMBER(cc40_state::power_w) -{ - // d0: power-on hold latch - m_power = data & 1; - - // stop running - if (!m_power) - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); -} - -WRITE8_MEMBER(cc40_state::sound_w) -{ - // d0: piezo control - m_dac->write_signed8((data & 1) ? 0x7f : 0); -} - -READ8_MEMBER(cc40_state::battery_r) -{ - // d0: low battery sense line (0 = low power) - return m_battery_inp->read(); -} - -READ8_MEMBER(cc40_state::bankswitch_r) -{ - return m_banks; -} - -WRITE8_MEMBER(cc40_state::bankswitch_w) -{ - // d0-d1: system rom bankswitch - membank("sysbank")->set_entry(data & 3); - - // d2-d3: cartridge 32KB page bankswitch - if (m_cart_rom) - membank("cartbank")->set_entry(data >> 2 & 3); - - m_banks = data & 0x0f; -} - -READ8_MEMBER(cc40_state::clock_control_r) -{ - return m_clock_control; -} - -void cc40_state::update_clock_divider() -{ - // 2.5MHz /3 to /17 in steps of 2 - m_clock_divider = (~m_clock_control & 7) * 2 + 1; - m_maincpu->set_clock_scale((m_clock_control & 8) ? (1.0 / (double)m_clock_divider) : 1); -} - -WRITE8_MEMBER(cc40_state::clock_control_w) -{ - // d0-d2: clock divider - // d3: enable clock divider always - // other bits: unused? - if (m_clock_control != (data & 0x0f)) - { - m_clock_control = data; - update_clock_divider(); - } -} - -READ8_MEMBER(cc40_state::keyboard_r) -{ - UINT8 ret = 0; - - // read selected keyboard rows - for (int i = 0; i < 8; i++) - { - if (m_key_select >> i & 1) - ret |= m_key_matrix[i]->read(); - } - - return ret; -} - -WRITE8_MEMBER(cc40_state::keyboard_w) -{ - // d(0-7): select keyboard column - m_key_select = data; -} - -static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, cc40_state ) - ADDRESS_MAP_UNMAP_HIGH - - AM_RANGE(0x0110, 0x0110) AM_READWRITE(bus_control_r, bus_control_w) - AM_RANGE(0x0111, 0x0111) AM_WRITE(power_w) - AM_RANGE(0x0112, 0x0112) AM_NOP // d0-d3: Hexbus data - AM_RANGE(0x0113, 0x0113) AM_NOP // d0: Hexbus available - AM_RANGE(0x0114, 0x0114) AM_NOP // d0,d1: Hexbus handshake - AM_RANGE(0x0115, 0x0115) AM_WRITE(sound_w) - AM_RANGE(0x0116, 0x0116) AM_READ(battery_r) - AM_RANGE(0x0119, 0x0119) AM_READWRITE(bankswitch_r, bankswitch_w) - AM_RANGE(0x011a, 0x011a) AM_READWRITE(clock_control_r, clock_control_w) - AM_RANGE(0x011e, 0x011f) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) - - AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE("sysram.0") - AM_RANGE(0x1000, 0x4fff) AM_READWRITE(sysram_r, sysram_w) - AM_RANGE(0x5000, 0xcfff) AM_ROMBANK("cartbank") - AM_RANGE(0xd000, 0xefff) AM_ROMBANK("sysbank") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( main_io_map, AS_IO, 8, cc40_state ) - AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(keyboard_r) - AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(keyboard_w) -ADDRESS_MAP_END - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -INPUT_CHANGED_MEMBER(cc40_state::sysram_size_changed) -{ - init_sysram((int)(FPTR)param, newval << 11); -} - -static INPUT_PORTS_START( cc40 ) - PORT_START("RAMSIZE") - PORT_CONFNAME( 0x07, 0x01, "RAM Chip 1") PORT_CHANGED_MEMBER(DEVICE_SELF, cc40_state, sysram_size_changed, (void *)0) - PORT_CONFSETTING( 0x00, "None" ) - PORT_CONFSETTING( 0x01, "2KB" ) - PORT_CONFSETTING( 0x04, "8KB" ) - PORT_CONFNAME( 0x70, 0x10, "RAM Chip 2") PORT_CHANGED_MEMBER(DEVICE_SELF, cc40_state, sysram_size_changed, (void *)1) - PORT_CONFSETTING( 0x00, "None" ) // note: invalid configuration, unless Chip 1 is also 0x00 - PORT_CONFSETTING( 0x10, "2KB" ) - PORT_CONFSETTING( 0x40, "8KB" ) - - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) - PORT_CONFSETTING( 0x00, "Low" ) - PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) - - // 8x8 keyboard matrix, RESET and ON buttons are not on it. Unused entries are not connected, but some might have a purpose for factory testing(?) - // The numpad number keys are shared with the ones on the main keyboard, also on the real machine. - // PORT_NAME lists functions under [SHIFT] as secondaries. - PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - - PORT_START("IN.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("IN.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("IN.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_NAME("SPACE") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("IN.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("CLR UCL") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("LEFT DEL") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("RIGHT INS") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_NAME("UP PB") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_NAME("/") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("DOWN") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("IN.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("+") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) PORT_NAME("ENTER") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME("*") - - PORT_START("IN.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("CTL") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("SHIFT") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("BREAK") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("RUN") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("FN") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_NAME("OFF") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -void cc40_state::machine_reset() -{ - m_power = 1; - - update_clock_divider(); - - address_space &space = m_maincpu->space(AS_PROGRAM); - bankswitch_w(space, 0, 0); -} - -void cc40_state::init_sysram(int chip, UINT16 size) -{ - if (m_sysram[chip] == NULL) - { - // init to largest possible - m_sysram[chip] = auto_alloc_array(machine(), UINT8, 0x2000); - save_pointer(NAME(m_sysram[chip]), 0x2000, chip); - - save_item(NAME(m_sysram_size[chip]), chip); - save_item(NAME(m_sysram_end[chip]), chip); - save_item(NAME(m_sysram_mask[chip]), chip); - } - - m_nvram[chip]->set_base(m_sysram[chip], size); - m_sysram_size[chip] = size; -} - -void cc40_state::postload() -{ - init_sysram(0, m_sysram_size[0]); - init_sysram(1, m_sysram_size[1]); - - update_clock_divider(); -} - -void cc40_state::machine_start() -{ - // init - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - membank("sysbank")->configure_entries(0, 4, memregion("system")->base(), 0x2000); - if (m_cart_rom) - membank("cartbank")->configure_entries(0, 4, m_cart_rom->base(), 0x8000); - else - membank("cartbank")->set_base(memregion("maincpu")->base() + 0x5000); - - m_nvram[0] = machine().device("sysram.1"); - m_nvram[1] = machine().device("sysram.2"); - init_sysram(0, 0x800); // default to 6KB - init_sysram(1, 0x800); // " - - address_space &space = m_maincpu->space(AS_PROGRAM); - bus_control_w(space, 0, 0); - bankswitch_w(space, 0, 0); - - // zerofill other - m_power = 0; - m_clock_control = 0; - m_key_select = 0; - - // register for savestates - save_item(NAME(m_bus_control)); - save_item(NAME(m_power)); - save_item(NAME(m_banks)); - save_item(NAME(m_clock_control)); - save_item(NAME(m_clock_divider)); - save_item(NAME(m_key_select)); - - machine().save().register_postload(save_prepost_delegate(FUNC(cc40_state::postload), this)); -} - -static MACHINE_CONFIG_START( cc40, cc40_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS70C20, XTAL_5MHz / 2) - MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_IO_MAP(main_io_map) - - MCFG_NVRAM_ADD_0FILL("sysram.0") - MCFG_NVRAM_ADD_0FILL("sysram.1") - MCFG_NVRAM_ADD_0FILL("sysram.2") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) // arbitrary - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(6*31+1, 9*1+1+1) - MCFG_SCREEN_VISIBLE_AREA(0, 6*31, 0, 9*1+1) - MCFG_DEFAULT_LAYOUT(layout_cc40) - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(cc40_state, cc40) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 16) // 2*16 internal - MCFG_HD44780_PIXEL_UPDATE_CB(cc40_pixel_update) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_DAC_ADD("dac") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "cc40_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom,256") - MCFG_GENERIC_LOAD(cc40_state, cc40_cartridge) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "cc40_cart") -MACHINE_CONFIG_END - - - -/*************************************************************************** - - ROM Definitions - -***************************************************************************/ - -ROM_START( cc40 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "tms70c20.bin", 0xf800, 0x0800, CRC(a21bf6ab) SHA1(3da8435ecbee143e7fa149ee8e1c92949bade1d8) ) // internal cpu rom - - ROM_REGION( 0x8000, "system", 0 ) - ROM_LOAD( "hn61256pc09.bin", 0x0000, 0x8000, CRC(f5322fab) SHA1(1b5c4052a53654363c458f75eac7a27f0752def6) ) // system rom, banked -ROM_END - - -COMP( 1983, cc40, 0, 0, cc40, cc40, driver_device, 0, "Texas Instruments", "Compact Computer 40", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/ccs2810.c b/src/mess/drivers/ccs2810.c deleted file mode 100644 index 5a38e72d9d6..00000000000 --- a/src/mess/drivers/ccs2810.c +++ /dev/null @@ -1,382 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -CCS Model 2810 - -2009-12-11 Skeleton driver. -2011-06-02 Connected to a terminal - -Chips: INS8250N-B, Z80A, uPD2716D, 82S129. Crystals: 16 MHz, 1.8432MHz - -SYSTEM OPERATION: -Press Enter to start the system. -All commands are in uppercase. - -A Assign logical device -Dn,n Dump memory -E Punch End-of-File to paper tape -F Fill -G Go -H Hex arithmetic -I In -L Punch Leader to paper tape -M Move -O Out -Q Query logical devices -R Read a file from paper tape -S Edit memory -T Test memory -V Verify (compare 2 blocks of memory) -W Write a file to paper tape -X Examine Registers -Y Set Baud rate of i8250 -Z Zleep (lock terminal). Press control+G twice to unlock. - -***************************************************************************** - -CCS Model 2422B - -Chips: UB1793/MB8877, 3 proms and one eprom. Crystal = 16MHz - -SYSTEM OPERATION: -Same as above, plus some extra commands - -B Boot from floppy -L removed -P Set disk parameters e.g. P0 10 0 = drive A, 10 sectors per track, 1 sided -Q Set disk position for raw read/write e.g. Q6 0 9 = track 6, side 0, sector 9 -Rs f Read absolute disk data (set by P and Q) to memory range s to f -Ws f Write absolute disk data (set by P and Q) from memory range s to f - -ToDo: -- fdc hld_r() has no code behind it, to be written -- not sure of the polarities of some of the floppy/fdc signals (not documented) -- no obvious option to change the fdc clock -- currently hard coded for a 20cm drive, not sure how to option select drive sizes -- a few jumpers to be added -- the one disk that exists fails the test: - Incorrect layout on track 0 head 0, expected_size=41666, current_size=68144 - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -//#include "machine/ins8250.h" -#include "machine/terminal.h" -#include "machine/wd_fdc.h" - -#define TERMINAL_TAG "terminal" - -class ccs_state : public driver_device -{ -public: - ccs_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_fdc (*this, "fdc"), - m_floppy0(*this, "fdc:0") - { - } - - DECLARE_DRIVER_INIT(ccs2810); - DECLARE_DRIVER_INIT(ccs2422); - DECLARE_MACHINE_RESET(ccs); - DECLARE_READ8_MEMBER(port04_r); - DECLARE_READ8_MEMBER(port20_r); - DECLARE_READ8_MEMBER(port25_r); - DECLARE_READ8_MEMBER(port26_r); - DECLARE_READ8_MEMBER(port34_r); - DECLARE_WRITE8_MEMBER(port04_w); - DECLARE_WRITE8_MEMBER(port20_w); - DECLARE_WRITE8_MEMBER(port34_w); - DECLARE_WRITE8_MEMBER(port40_w); - DECLARE_WRITE8_MEMBER(kbd_put); -private: - UINT8 m_term_data; - UINT8 m_26_count; - bool m_ss; - bool m_dden; - bool m_dsize; - UINT8 m_ds; - floppy_image_device *m_floppy; - void fdc_intrq_w(bool state); - void fdc_drq_w(bool state); - required_device m_maincpu; - required_device m_terminal; - optional_device m_fdc; - optional_device m_floppy0; -}; - -static ADDRESS_MAP_START(ccs2810_mem, AS_PROGRAM, 8, ccs_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xefff) AM_RAM - AM_RANGE(0xf000, 0xf7ff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0xf800, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ccs2810_io, AS_IO, 8, ccs_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x20, 0x20) AM_READWRITE(port20_r,port20_w) - AM_RANGE(0x25, 0x25) AM_READ(port25_r) - AM_RANGE(0x26, 0x26) AM_READ(port26_r) - //AM_RANGE(0x20, 0x27) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ccs2422_io, AS_IO, 8, ccs_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x04, 0x04) AM_READWRITE(port04_r,port04_w) - AM_RANGE(0x20, 0x20) AM_READWRITE(port20_r,port20_w) - AM_RANGE(0x25, 0x25) AM_READ(port25_r) - AM_RANGE(0x26, 0x26) AM_READ(port26_r) - AM_RANGE(0x30, 0x33) AM_DEVREADWRITE("fdc", mb8877_t, read, write) - AM_RANGE(0x34, 0x34) AM_READWRITE(port34_r,port34_w) - AM_RANGE(0x40, 0x40) AM_WRITE(port40_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ccs2810 ) -INPUT_PORTS_END - -//************************************* -// -// Keyboard -// -//************************************* -READ8_MEMBER( ccs_state::port20_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( ccs_state::port25_r ) -{ - return (m_term_data) ? 0x21 : 0x20; -} - -READ8_MEMBER( ccs_state::port26_r ) -{ - if (m_26_count) m_26_count--; - return m_26_count; -} - -WRITE8_MEMBER( ccs_state::port20_w ) -{ - m_terminal->write(space, 0, data & 0x7f); -} - -WRITE8_MEMBER( ccs_state::kbd_put ) -{ - m_term_data = data; -} - -#if 0 -static const ins8250_interface com_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; -#endif - -//************************************* -// -// Status / Control ports -// -//************************************* - -/* Status 1 -d0 : intrq -d1 : ds0 -d2 : ds1 -d3 : ds2 -d4 : ds3 -d5 : hld (1=head loaded) -d6 : autoboot (1=go to monitor) -d7 : drq -*/ - -READ8_MEMBER( ccs_state::port34_r ) -{ - //return (UINT8)m_drq | (m_ds << 1) | ((UINT8)fdc->hld_r() << 5) | 0x40 | ((UINT8)m_intrq << 7); - return (UINT8)m_fdc->drq_r() | (m_ds << 1) | 0x20 | 0x40 | ((UINT8)m_fdc->intrq_r() << 7); // hld_r doesn't do anything -} - -/* Status 2 -d0 : trk00 (1=trk00 on 20cm drive; 0=trk00 on 13cm drive) -d1 : drive size (0=20cm, 1=13cm) -d2 : wprt from drive (0=write protected) -d3 : /ss (1=side 0 is selected) -d4 : index hole = 0 -d5 : dden (1 = double density) -d6 : double (0 = a double-sided 20cm disk is in the drive) -d7 : drq -*/ - -READ8_MEMBER( ccs_state::port04_r ) -{ - bool trk00=1,wprt=0,dside=1; - int idx=1; - if (m_floppy) - { - trk00 = !m_floppy->trk00_r(); - wprt = !m_floppy->wpt_r(); - idx = m_floppy->idx_r()^1; - dside = m_floppy->twosid_r(); - } - return (UINT8)trk00 | 0 | ((UINT8)wprt << 2) | ((UINT8)m_ss << 3) | - idx << 4 | ((UINT8)m_dden << 5) | ((UINT8)dside << 6) | ((UINT8)m_fdc->drq_r() << 7); -} - -/* Control 1 -d0 : ds0 -d1 : ds1 -d2 : ds2 -d3 : ds3 -d4 : drive size (adjusts fdc clock) -d5 : mon (1=motor on) -d6 : dden -d7 : autowait (0=ignore drq) -*/ - -WRITE8_MEMBER( ccs_state::port34_w ) -{ - m_ds = data & 15; - m_dsize = BIT(data, 4); - m_dden = BIT(data, 6); - - m_floppy = NULL; - if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); - m_fdc->set_floppy(m_floppy); - m_fdc->dden_w(!m_dden); - - if (m_floppy) - { - m_floppy->mon_w(!BIT(data, 5)); - } -} - -/* Control 2 -d2 : remote eject for persci drive (1=eject) -d4 : fast seek mode (1=on) -d6 : /ss (0=side 1 selected) -d7 : rom enable (1=firmware enabled) -other bits not used -*/ - -WRITE8_MEMBER( ccs_state::port04_w ) -{ - m_ss = BIT(data, 6); - if (m_floppy) - m_floppy->ss_w(!m_ss); -} - - -//************************************* -// -// Machine -// -//************************************* -WRITE8_MEMBER( ccs_state::port40_w ) -{ - membank("bankr0")->set_entry( (data) ? 1 : 0); -} - -MACHINE_RESET_MEMBER( ccs_state, ccs ) -{ - membank("bankr0")->set_entry(0); // point at rom - membank("bankw0")->set_entry(0); // always write to ram - m_26_count = 0x41; - m_maincpu->set_state_int(Z80_PC, 0xf000); -} - -DRIVER_INIT_MEMBER( ccs_state, ccs2810 ) -{ - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(1, &main[0x0000]); - membank("bankr0")->configure_entry(0, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); -} - -DRIVER_INIT_MEMBER( ccs_state, ccs2422 ) -{ - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(1, &main[0x0000]); - membank("bankr0")->configure_entry(0, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); -} - -//************************************* -// -// Disk -// -//************************************* - -static SLOT_INTERFACE_START( ccs_floppies ) - SLOT_INTERFACE( "8sssd", FLOPPY_8_SSSD ) -SLOT_INTERFACE_END - - //SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) - -static MACHINE_CONFIG_START( ccs2810, ccs_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(ccs2810_mem) - MCFG_CPU_IO_MAP(ccs2810_io) - MCFG_MACHINE_RESET_OVERRIDE(ccs_state, ccs) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ccs_state, kbd_put)) - - /* Devices */ - //MCFG_INS8250_ADD( "ins8250", com_intf, XTAL_1_8432MHz ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ccs2422, ccs_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(ccs2810_mem) - MCFG_CPU_IO_MAP(ccs2422_io) - MCFG_MACHINE_RESET_OVERRIDE(ccs_state, ccs) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ccs_state, kbd_put)) - - /* Devices */ - MCFG_MB8877_ADD("fdc", XTAL_16MHz / 8) // UB1793 or MB8877 - MCFG_FLOPPY_DRIVE_ADD("fdc:0", ccs_floppies, "8sssd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ccs2810 ) - ROM_REGION( 0x10800, "maincpu", 0 ) - ROM_LOAD( "ccs2810.u8", 0x10000, 0x0800, CRC(0c3054ea) SHA1(c554b7c44a61af13decb2785f3c9b33c6fc2bfce)) -ROM_END - -ROM_START( ccs2422 ) - ROM_REGION( 0x10800, "maincpu", 0 ) - ROM_LOAD( "2422.u24", 0x10000, 0x0800, CRC(6b47586b) SHA1(73ba779a659da4a1f0e22a3fa351a2b36d8456a0)) - - ROM_REGION( 0x300, "proms", 0 ) - ROM_LOAD_OPTIONAL( "2422.u23", 0x0000, 0x0100, CRC(b279cada) SHA1(6cc6e00ec49ba2245c8836d6f09266b09d6e7648)) - ROM_LOAD_OPTIONAL( "2422.u22", 0x0100, 0x0100, CRC(e41858bb) SHA1(0be53725032ebea16e32cb720f099551a357e761)) - ROM_LOAD_OPTIONAL( "2422.u21", 0x0200, 0x0100, NO_DUMP ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, ccs2810, 0, 0, ccs2810, ccs2810, ccs_state, ccs2810, "California Computer Systems", "CCS Model 2810 CPU card", MACHINE_NO_SOUND_HW) -COMP( 1980, ccs2422, ccs2810, 0, ccs2422, ccs2810, ccs_state, ccs2422, "California Computer Systems", "CCS Model 2422B FDC card", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/ccs300.c b/src/mess/drivers/ccs300.c deleted file mode 100644 index a0842350bd2..00000000000 --- a/src/mess/drivers/ccs300.c +++ /dev/null @@ -1,142 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - CCS Model 300 - - 2009-12-11 Skeleton driver. - -It requires a floppy disk to boot from. - -There's no info available on this system, however the bankswitching -appears to be the same as their other systems. - -Early on, it does a read from port F2. If bit 3 is low, the system becomes -a Model 400. - -Since IM2 is used, it is assumed there are Z80 peripherals on board. -There's unknown usage of ports 11 thru 1B, 34, and F0 thru F2. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class ccs300_state : public driver_device -{ -public: - ccs300_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_DRIVER_INIT(ccs300); - DECLARE_MACHINE_RESET(ccs300); - DECLARE_READ8_MEMBER(port10_r); - DECLARE_READ8_MEMBER(port11_r); - DECLARE_WRITE8_MEMBER(port10_w); - DECLARE_WRITE8_MEMBER(port40_w); - DECLARE_WRITE8_MEMBER(kbd_put); -private: - UINT8 m_term_data; - required_device m_maincpu; - required_device m_terminal; -}; - -static ADDRESS_MAP_START(ccs300_mem, AS_PROGRAM, 8, ccs300_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x0800, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ccs300_io, AS_IO, 8, ccs300_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x10, 0x10) AM_READWRITE(port10_r,port10_w) - AM_RANGE(0x11, 0x11) AM_READ(port11_r) - AM_RANGE(0x40, 0x40) AM_WRITE(port40_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ccs300 ) -INPUT_PORTS_END - -//************************************* -// -// Keyboard -// -//************************************* -READ8_MEMBER( ccs300_state::port10_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( ccs300_state::port11_r ) -{ - return (m_term_data) ? 5 : 4; -} - -WRITE8_MEMBER( ccs300_state::port10_w ) -{ - m_terminal->write(space, 0, data & 0x7f); -} - -WRITE8_MEMBER( ccs300_state::kbd_put ) -{ - m_term_data = data; -} - -//************************************* -// -// Machine -// -//************************************* -WRITE8_MEMBER( ccs300_state::port40_w ) -{ - membank("bankr0")->set_entry( (data) ? 1 : 0); -} - -MACHINE_RESET_MEMBER( ccs300_state, ccs300 ) -{ - membank("bankr0")->set_entry(0); // point at rom - membank("bankw0")->set_entry(0); // always write to ram -} - -DRIVER_INIT_MEMBER( ccs300_state, ccs300 ) -{ - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(1, &main[0x0000]); - membank("bankr0")->configure_entry(0, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); -} - -static MACHINE_CONFIG_START( ccs300, ccs300_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(ccs300_mem) - MCFG_CPU_IO_MAP(ccs300_io) - MCFG_MACHINE_RESET_OVERRIDE(ccs300_state, ccs300) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ccs300_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ccs300 ) - ROM_REGION( 0x10800, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ccs300.rom", 0x10000, 0x0800, CRC(6cf22e31) SHA1(9aa3327cd8c23d0eab82cb6519891aff13ebe1d0)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, ccs300, ccs2810, 0, ccs300, ccs300, ccs300_state, ccs300, "California Computer Systems", "CCS Model 300", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/cd2650.c b/src/mess/drivers/cd2650.c deleted file mode 100644 index 2e2b8e0d895..00000000000 --- a/src/mess/drivers/cd2650.c +++ /dev/null @@ -1,323 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Central Data cd2650 - -2010-04-08 Skeleton driver. - -No info available on this computer apart from a few newsletters. -The system only uses 1000-14FF for videoram and 17F0-17FF for -scratch ram. All other ram is optional. - -Commands (must be in uppercase): -A Examine memory; press C to alter memory -B Set breakpoint? -C View breakpoint? -D Dump to tape -E Execute -I ? -L Load -R ? -V Verify? -Press Esc to exit most commands. - -TODO -- Lots, probably. The computer is a complete mystery. No manuals or schematics exist. -- Cassette doesn't work. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/s2650/s2650.h" -#include "machine/keyboard.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "sound/beep.h" - -#define KEYBOARD_TAG "keyboard" - -class cd2650_state : public driver_device -{ -public: - cd2650_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_beep(*this, "beeper"), - m_cass(*this, "cassette") - { - } - - DECLARE_READ8_MEMBER(keyin_r); - DECLARE_WRITE8_MEMBER(beep_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(cass_r); - DECLARE_WRITE_LINE_MEMBER(cass_w); - DECLARE_QUICKLOAD_LOAD_MEMBER(cd2650); - const UINT8 *m_p_chargen; - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; - -private: - UINT8 m_term_data; - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; - required_device m_beep; - required_device m_cass; -}; - - -WRITE8_MEMBER( cd2650_state::beep_w ) -{ - if (data & 7) - m_beep->set_state(BIT(data, 3)); -} - -WRITE_LINE_MEMBER( cd2650_state::cass_w ) -{ - m_cass->output(state ? -1.0 : +1.0); -} - -READ8_MEMBER( cd2650_state::cass_r ) -{ - return (m_cass->input() > 0.03) ? 1 : 0; -} - -READ8_MEMBER( cd2650_state::keyin_r ) -{ - UINT8 ret = m_term_data; - m_term_data = ret | 0x80; - return ret; -} - -static ADDRESS_MAP_START(cd2650_mem, AS_PROGRAM, 8, cd2650_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x03ff) AM_ROM AM_REGION("roms", 0) - AM_RANGE( 0x1000, 0x7fff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cd2650_io, AS_IO, 8, cd2650_state) - ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0x80, 0x84) disk i/o - AM_RANGE(S2650_DATA_PORT,S2650_DATA_PORT) AM_READWRITE(keyin_r, beep_w) - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( cd2650 ) -INPUT_PORTS_END - - -void cd2650_state::machine_reset() -{ - m_term_data = 0x80; - m_beep->set_frequency(950); /* guess */ - m_beep->set_state(0); -} - -void cd2650_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 cd2650_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -/* The video is unusual in that the characters in each line are spaced at 16 bytes in memory, - thus line 1 starts at 1000, line 2 at 1001, etc. There are 16 lines of 80 characters. - Further, the letters have bit 6 set low, thus the range is 01 to 1A. - When the bottom of the screen is reached, it does not scroll, it just wraps around. */ - - UINT16 offset = 0; - UINT8 y,ra,chr,gfx; - UINT16 sy=0,x,mem; - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 80; x++) - { - gfx = 0; - if ((ra) && (ra < 9)) - { - mem = offset + y + (x<<4); - - if (mem > 0x4ff) - mem -= 0x500; - - chr = m_p_videoram[mem] & 0x3f; - - gfx = m_p_chargen[(BITSWAP8(chr,7,6,2,1,0,3,4,5)<<3) | (ra-1) ]; - } - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout cd2650_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 192, /* 64 characters in char.rom + 128 characters in char2.rom */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( cd2650 ) - GFXDECODE_ENTRY( "chargen", 0x0000, cd2650_charlayout, 0, 1 ) -GFXDECODE_END - -WRITE8_MEMBER( cd2650_state::kbd_put ) -{ - if (data) - m_term_data = data; -} - -QUICKLOAD_LOAD_MEMBER( cd2650_state, cd2650 ) -{ - int i, result = IMAGE_INIT_FAIL; - - int quick_length = image.length(); - if (quick_length < 0x1500) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); - image.message(" File too short"); - } - else - if (quick_length > 0x8000) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); - image.message(" File too long"); - } - else - { - dynamic_buffer quick_data(quick_length); - int read_ = image.fread( &quick_data[0], quick_length); - if (read_ != quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); - image.message(" Cannot read the file"); - } - else - if (quick_data[0] != 0x40) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); - image.message(" Invalid header"); - } - else - { - int exec_addr = quick_data[1] * 256 + quick_data[2]; - - if (exec_addr >= quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); - image.message(" Exec address beyond end of file"); - } - else - { - // do not overwite system area (17E0-17FF) otherwise chess3 has problems - read_ = 0x17e0; - if (quick_length < 0x17e0) - read_ = quick_length; - - for (i = 0x1500; i < read_; i++) - m_p_videoram[i-0x1000] = quick_data[i]; - - if (quick_length > 0x17ff) - for (i = 0x1800; i < quick_length; i++) - m_p_videoram[i-0x1000] = quick_data[i]; - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); - - // Start the quickload - m_maincpu->set_state_int(S2650_PC, exec_addr); - - result = IMAGE_INIT_PASS; - } - } - } - - return result; -} - -static MACHINE_CONFIG_START( cd2650, cd2650_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(cd2650_mem) - MCFG_CPU_IO_MAP(cd2650_io) - MCFG_S2650_FLAG_HANDLER(WRITELINE(cd2650_state, cass_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(cd2650_state, screen_update) - MCFG_SCREEN_SIZE(640, 160) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 159) - MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", cd2650) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", cd2650_state, cd2650, "pgm", 1) - - /* Sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(cd2650_state, kbd_put)) - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( cd2650 ) - ROM_REGION( 0x0400, "roms", 0 ) - ROM_LOAD( "cd2650.rom", 0x0000, 0x0400, CRC(5397328e) SHA1(7106fdb60e1ad2bc5e8e45527f348c23296e8d6a)) - - ROM_REGION( 0x0600, "chargen", 0 ) - ROM_LOAD( "char.rom", 0x0000, 0x0200, CRC(9b75db2a) SHA1(4367c01afa503d7cba0c38078fde0b95392c6c2c)) - ROM_LOAD_OPTIONAL( "char2.rom", 0x0200, 0x0400, CRC(b450eea8) SHA1(c1bdba52c2dc5698cad03b6b884b942a083465ed)) // not used - - // various unused roms found on Amigan site - ROM_REGION( 0xc900, "user1", 0 ) - ROM_LOAD_OPTIONAL( "01a_cd_boots.bin", 0x0000, 0x0200, CRC(5336c62f) SHA1(e94cf7be01ea806ff7c7b90aee1a4e88f4f1ba9f)) - ROM_LOAD_OPTIONAL( "01a_cd_dos.bin", 0x0200, 0x2000, CRC(3f177cdd) SHA1(01afd77ad2f065158cbe032aa26682cb20afe7d8)) - ROM_LOAD_OPTIONAL( "01a_cd_pop.bin", 0x2200, 0x1000, CRC(d8f44f11) SHA1(605ab5a045290fa5b99ff4fc8fbfa2a3f202578f)) - ROM_LOAD_OPTIONAL( "01b_cd_alp.bin", 0x3200, 0x2a00, CRC(b05568bb) SHA1(29e74633c0cd731c0be25313288cfffdae374236)) - ROM_LOAD_OPTIONAL( "01b_cd_basic.bin", 0x5c00, 0x3b00, CRC(0cf1e3d8) SHA1(3421e679c238aeea49cd170b34a6f344da4770a6)) - ROM_LOAD_OPTIONAL( "01b_cd_mon_m.bin", 0x9700, 0x0400, CRC(f6f19c08) SHA1(1984d85d57fc2a6c5a3bd51fbc58540d7129a0ae)) - ROM_LOAD_OPTIONAL( "01b_cd_mon_o.bin", 0x9b00, 0x0400, CRC(9d40b4dc) SHA1(35cffcbd983b7b37c878a15af44100568d0659d1)) - ROM_LOAD_OPTIONAL( "02b_cd_alp.bin", 0x9f00, 0x2a00, CRC(a66b7f32) SHA1(2588f9244b0ec6b861dcebe666d37d3fa88dd043)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, cd2650, 0, 0, cd2650, cd2650, driver_device, 0, "Central Data", "CD 2650", 0 ) diff --git a/src/mess/drivers/cdc721.c b/src/mess/drivers/cdc721.c deleted file mode 100644 index 0f89b5f2944..00000000000 --- a/src/mess/drivers/cdc721.c +++ /dev/null @@ -1,144 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/************************************************************************************************************ - -Control Data Corporation CDC 721 Terminal (Viking) - -2013-08-13 Skeleton - - -*************************************************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" - -class cdc721_state : public driver_device -{ -public: - cdc721_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_p_videoram(*this, "videoram") - , m_maincpu(*this, "maincpu") - { } - -public: - virtual void machine_reset(); - DECLARE_PALETTE_INIT(cdc721); - const UINT8 *m_p_chargen; - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; -private: - required_device m_maincpu; - - -}; - -static ADDRESS_MAP_START( cdc721_mem, AS_PROGRAM, 8, cdc721_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x4000, 0xf097) AM_RAM - AM_RANGE(0xf098, 0xffff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cdc721_io, AS_IO, 8, cdc721_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -static INPUT_PORTS_START( cdc721 ) -INPUT_PORTS_END - -void cdc721_state::machine_reset() -{ - m_p_chargen = memregion("chargen")->base(); -} - -/* F4 Character Displayer */ -static const gfx_layout cdc721_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0*8, 0x100*8, 0x200*8, 0x300*8, 0x400*8, 0x500*8, 0x600*8, 0x700*8, - 0x800*8, 0x900*8, 0xa00*8, 0xb00*8, 0xc00*8, 0xd00*8, 0xe00*8, 0xf00*8 }, - 8 /* every char takes 16 x 1 bytes */ -}; - -static GFXDECODE_START( cdc721 ) - GFXDECODE_ENTRY( "chargen", 0x0000, cdc721_charlayout, 0, 1 ) -GFXDECODE_END - -PALETTE_INIT_MEMBER( cdc721_state, cdc721 ) -{ - palette.set_pen_color(0, 0, 0, 0 ); /* Black */ - palette.set_pen_color(1, 0, 255, 0 ); /* Full */ - palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */ -} - -UINT32 cdc721_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 24; y++) - { - for (ra = 3; ra < 13; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 160; x+=2) - { - chr = m_p_videoram[x+ma]; - - gfx = m_p_chargen[chr | (ra << 8) ]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 0); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 7); - } - } - ma+=160; - } - return 0; -} - -static MACHINE_CONFIG_START( cdc721, cdc721_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(cdc721_mem) - MCFG_CPU_IO_MAP(cdc721_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(cdc721_state, screen_update) - MCFG_SCREEN_SIZE(640, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239) - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(cdc721_state, cdc721) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", cdc721) -MACHINE_CONFIG_END - -ROM_START( cdc721 ) - ROM_REGION( 0x6000, "maincpu", 0 ) - ROM_LOAD( "66315359", 0x0000, 0x2000, CRC(20ff3eb4) SHA1(5f15cb14893d75a46dc66d3042356bb054d632c2) ) - ROM_LOAD( "66315361", 0x2000, 0x2000, CRC(21d59d09) SHA1(9c087537d68c600ddf1eb9b009cf458231c279f4) ) - ROM_LOAD( "66315360", 0x4000, 0x1000, CRC(feaa0fc5) SHA1(f06196553a1f10c07b2f7e495823daf7ea26edee) ) // rom @ 4000 - ROM_LOAD( "66307828", 0x5000, 0x1000, CRC(ac97136f) SHA1(0d280e1aa4b9502bd390d260f83af19bf24905cd) ) // keyboard - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "66315039", 0x0000, 0x1000, CRC(5c9aa968) SHA1(3ec7c5f25562579e6ed3fda7562428ff5e6b9550) ) // chargen -ROM_END - -COMP( 1981, cdc721, 0, 0, cdc721, cdc721, driver_device, 0, "Control Data Corporation", "CDC721 Terminal", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/cfx9850.c b/src/mess/drivers/cfx9850.c deleted file mode 100644 index 30ec1e78b4b..00000000000 --- a/src/mess/drivers/cfx9850.c +++ /dev/null @@ -1,293 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - Driver for Casio CFX-9850 - -To operate: -The unit is switched off by default, you have to switch it on by pressing 'Q'. - -Currently (year2011) it is on by default, the only key that works is '\' -which turns it off. After that nothing happens. - -Debugging information: -1. g 10b3 (Initialise system) -2. cs=23 -3. ip= one of these: ip=d1a4,d1af,d1ba,d1c5,d1d0,d1db,d1ea,d1f9,d208,d217, - d226,d235,d244 -4. g 23108c to get a test pattern on the screen. - -***************************************************************************/ - -#include "emu.h" -#include "cpu/hcd62121/hcd62121.h" -#include "rendlay.h" - -class cfx9850_state : public driver_device -{ -public: - cfx9850_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_video_ram(*this, "video_ram"), - m_display_ram(*this, "display_ram"), - m_ko1(*this, "KO1"), - m_ko2(*this, "KO2"), - m_ko3(*this, "KO3"), - m_ko4(*this, "KO4"), - m_ko5(*this, "KO5"), - m_ko6(*this, "KO6"), - m_ko7(*this, "KO7"), - m_ko8(*this, "KO8"), - m_ko9(*this, "KO9"), - m_ko10(*this, "KO10"), - m_ko11(*this, "KO11"), - m_ko12(*this, "KO12") , - m_maincpu(*this, "maincpu") { } - - DECLARE_WRITE8_MEMBER(cfx9850_kol_w); - DECLARE_WRITE8_MEMBER(cfx9850_koh_w); - DECLARE_READ8_MEMBER(cfx9850_ki_r); - DECLARE_READ8_MEMBER(cfx9850_battery_level_r); - required_shared_ptr m_video_ram; - required_shared_ptr m_display_ram; - UINT16 m_ko; /* KO lines KO1 - KO14 */ - DECLARE_PALETTE_INIT(cfx9850); - UINT32 screen_update_cfx9850(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - required_ioport m_ko1; - required_ioport m_ko2; - required_ioport m_ko3; - required_ioport m_ko4; - required_ioport m_ko5; - required_ioport m_ko6; - required_ioport m_ko7; - required_ioport m_ko8; - required_ioport m_ko9; - required_ioport m_ko10; - required_ioport m_ko11; - required_ioport m_ko12; - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START( cfx9850, AS_PROGRAM, 8, cfx9850_state ) - AM_RANGE( 0x000000, 0x007fff ) AM_ROM - AM_RANGE( 0x080000, 0x0807ff ) AM_RAM AM_SHARE("video_ram") -// AM_RANGE( 0x100000, 0x10ffff ) /* some memory mapped i/o? */ -// AM_RANGE( 0x110000, 0x11ffff ) /* some memory mapped i/o? */ - AM_RANGE( 0x200000, 0x27ffff ) AM_ROM AM_REGION( "bios", 0 ) - AM_RANGE( 0x400000, 0x40ffff ) AM_RAM - AM_RANGE( 0x600000, 0x601fff ) AM_MIRROR(0xf800) AM_RAM AM_SHARE("display_ram") -// AM_RANGE( 0xe10000, 0xe1ffff ) /* some memory mapped i/o? */ -ADDRESS_MAP_END - - -WRITE8_MEMBER( cfx9850_state::cfx9850_kol_w ) -{ - m_ko = ( m_ko & 0xff00 ) | data; -} - -WRITE8_MEMBER( cfx9850_state::cfx9850_koh_w ) -{ - m_ko = ( m_ko & 0x00ff ) | ( data << 8 ); -} - - -READ8_MEMBER( cfx9850_state::cfx9850_ki_r ) -{ - UINT8 data = 0; - - if ( m_ko & ( 1 << 0 ) ) data |= m_ko1->read(); - if ( m_ko & ( 1 << 1 ) ) data |= m_ko2->read(); - if ( m_ko & ( 1 << 2 ) ) data |= m_ko3->read(); - if ( m_ko & ( 1 << 3 ) ) data |= m_ko4->read(); - if ( m_ko & ( 1 << 4 ) ) data |= m_ko5->read(); - if ( m_ko & ( 1 << 5 ) ) data |= m_ko6->read(); - if ( m_ko & ( 1 << 6 ) ) data |= m_ko7->read(); - if ( m_ko & ( 1 << 7 ) ) data |= m_ko8->read(); - if ( m_ko & ( 1 << 8 ) ) data |= m_ko9->read(); - if ( m_ko & ( 1 << 9 ) ) data |= m_ko10->read(); - if ( m_ko & ( 1 << 10 ) ) data |= m_ko11->read(); - if ( m_ko & ( 1 << 11 ) ) data |= m_ko12->read(); - - return data; -} - - -READ8_MEMBER( cfx9850_state::cfx9850_battery_level_r ) -{ - return 0x30; -} - - -static ADDRESS_MAP_START( cfx9850_io, AS_IO, 8, cfx9850_state ) - AM_RANGE( HCD62121_KOL, HCD62121_KOL ) AM_WRITE( cfx9850_kol_w ) - AM_RANGE( HCD62121_KOH, HCD62121_KOH ) AM_WRITE( cfx9850_koh_w ) - AM_RANGE( HCD62121_KI, HCD62121_KI ) AM_READ( cfx9850_ki_r ) - AM_RANGE( HCD62121_IN0, HCD62121_IN0 ) AM_READ( cfx9850_battery_level_r ) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( cfx9850 ) - PORT_START( "KO1" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "AC On/Off" ) PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO2" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXE Enter" ) PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "(-) Ares" ) PORT_CODE(KEYCODE_MINUS) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXP Pi" ) PORT_CODE(KEYCODE_EQUALS) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ". SPACE" ) PORT_CODE(KEYCODE_SPACE) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "0 Z" ) PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO3" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "- ] Y" ) PORT_CODE(KEYCODE_Y) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "+ [ X" ) PORT_CODE(KEYCODE_X) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "3 W" ) PORT_CODE(KEYCODE_W) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "2 V" ) PORT_CODE(KEYCODE_V) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "1 U" ) PORT_CODE(KEYCODE_U) - PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO4" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "/ } T" ) PORT_CODE(KEYCODE_T) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "* { S" ) PORT_CODE(KEYCODE_S) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "6 R" ) PORT_CODE(KEYCODE_R) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "5 Q" ) PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "4 P" ) PORT_CODE(KEYCODE_P) - PORT_BIT( 0x83, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO5" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "DEL DG" ) PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "9 O" ) PORT_CODE(KEYCODE_O) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "8 N" ) PORT_CODE(KEYCODE_N) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "7 M" ) PORT_CODE(KEYCODE_M) - PORT_BIT( 0x87, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO6" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "TAB L" ) PORT_CODE(KEYCODE_L) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ", K" ) PORT_CODE(KEYCODE_K) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( ") x^-1 J" ) PORT_CODE(KEYCODE_J) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "( .. I" ) PORT_CODE(KEYCODE_I) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F<=>0 H" ) PORT_CODE(KEYCODE_H) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "a b/c G" ) PORT_CODE(KEYCODE_G) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO7" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "tan tan^-1 F" ) PORT_CODE(KEYCODE_F) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "cos cas^-1 E" ) PORT_CODE(KEYCODE_E) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "sin sin^-1 D" ) PORT_CODE(KEYCODE_D) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "ln e^x C" ) PORT_CODE(KEYCODE_C) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "log 10^x B" ) PORT_CODE(KEYCODE_B) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "x,d,t A" ) PORT_CODE(KEYCODE_A) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO8" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Right" ) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Down" ) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "EXIT QUIT" ) PORT_CODE(KEYCODE_STOP) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "/\\ .. .." ) PORT_CODE(KEYCODE_COMMA) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "x^2 sqrt .." ) PORT_CODE(KEYCODE_SLASH) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "ALPHA ..-LOCK" ) PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO9" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Up" ) PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "Left" ) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "MENU SET UP" ) PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "VARS PRGM" ) PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "OPTN" ) PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "SHIFT" ) PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO10" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F6 G<=>T" ) PORT_CODE(KEYCODE_F6) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F5 G-Solv" ) PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F4 Sketch" ) PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F3 V-Window" ) PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F2 Zoom" ) PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "F1 Trace" ) PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x81, IP_ACTIVE_HIGH, IPT_UNUSED ) - - /* KO11 is not connected */ - PORT_START( "KO11" ) - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "KO12" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME( "TEST" ) PORT_CODE(KEYCODE_TILDE) - PORT_BIT( 0xf7, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -PALETTE_INIT_MEMBER(cfx9850_state, cfx9850) -{ - palette.set_pen_color( 0, 0xff, 0xff, 0xff ); - palette.set_pen_color( 1, 0x00, 0x00, 0xff ); - palette.set_pen_color( 2, 0x00, 0xff, 0x00 ); - palette.set_pen_color( 3, 0xff, 0x00, 0x00 ); -} - - -UINT32 cfx9850_state::screen_update_cfx9850(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 offset = 0; - - for ( int i = 0; i < 16; i++ ) - { - int x = 120 - i * 8; - - for ( int j = 0; j < 64; j++ ) - { - UINT8 data1 = m_display_ram[ offset ]; - UINT8 data2 = m_display_ram[ offset + 0x400 ]; - - for ( int b = 0; b < 8; b++ ) - { - bitmap.pix16(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); - data1 <<= 1; - data2 <<= 1; - } - - offset++; - } - } - - return 0; -} - - -static MACHINE_CONFIG_START( cfx9850, cfx9850_state ) - MCFG_CPU_ADD( "maincpu", HCD62121, 4300000 ) /* 4.3 MHz */ - MCFG_CPU_PROGRAM_MAP( cfx9850 ) - MCFG_CPU_IO_MAP( cfx9850_io ) - - MCFG_SCREEN_ADD( "screen", LCD ) - MCFG_SCREEN_REFRESH_RATE( 60 ) - MCFG_SCREEN_SIZE( 128, 64 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 127, 0, 63 ) - MCFG_SCREEN_UPDATE_DRIVER(cfx9850_state, screen_update_cfx9850) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* TODO: It uses a color display, but I'm being lazy here. 3 colour lcd */ - MCFG_PALETTE_ADD( "palette", 4 ) - MCFG_PALETTE_INIT_OWNER(cfx9850_state, cfx9850) -MACHINE_CONFIG_END - - -ROM_START( cfx9850 ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "hcd62121.bin", 0x0000, 0x8000, CRC(e72075f8) SHA1(f50d176e1c225dab69abfc67702c9dfb296b6a78) ) - - ROM_REGION( 0x80000, "bios", 0 ) - /* No idea yet which rom is what version. */ - ROM_SYSTEM_BIOS( 0, "rom1", "rom1, version unknown" ) - ROMX_LOAD( "cfx9850.bin", 0x00000, 0x80000, CRC(6c9bd903) SHA1(d5b6677ab4e0d3f84e5769e89e8f3d101f98f848), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "rom2", "rom2, version unknown" ) - ROMX_LOAD( "cfx9850b.bin", 0x00000, 0x80000, CRC(cd3c497f) SHA1(1d1aa38205eec7aba3ed6bef7389767e38afe075), ROM_BIOS(2) ) -ROM_END - - -COMP( 1996, cfx9850, 0, 0, cfx9850, cfx9850, driver_device, 0, "Casio", "CFX-9850G", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/cgc7900.c b/src/mess/drivers/cgc7900.c deleted file mode 100644 index 55123f9be74..00000000000 --- a/src/mess/drivers/cgc7900.c +++ /dev/null @@ -1,448 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Chromatics CGC 7900 - - 05/04/2010 Skeleton driver. - -****************************************************************************/ - -/* - - TODO: - - - does not boot - - interrupts - - vsync interrupt - - map ROM to 000000-000007 at boot - - floppy - - bitmap display - - Z mode read/write - - color status write - - bitmap roll - - overlay roll - - keyboard - - joystick - - light pen - - memory parity - - sync - - disk DMA - - PIO DMA - - serial port controller - - HVG - - OMTI Series 10 SCSI controller (8" Winchester HD) - -*/ - -#include "includes/cgc7900.h" - - - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -#define INT_RTC 0x0001 -#define INT_RS449_TXRDY 0x0002 -#define INT_BINT2 0x0004 -#define INT_RS232_TXRDY 0x0008 -#define INT_DISK 0x0010 -#define INT_BINT3 0x0020 -#define INT_BEZEL 0x0040 -#define INT_KEYBOARD 0x0080 -#define INT_RS449_RXRDY 0x0100 -#define INT_LIGHT_PEN 0x0200 -#define INT_BINT4 0x0400 -#define INT_JOYSTICK 0x0800 -#define INT_VSYNC 0x1000 -#define INT_BINT5 0x2000 -#define INT_BINT1 0x4000 -#define INT_RS232_RXRDY 0x8000 - -//static const int INT_LEVEL[] = { 5, 4, 5, 4, 4, 5, 4, 5, 5, 4, 5, 4, 4, 5, 4, 5 }; - -/*************************************************************************** - READ/WRITE HANDLERS -***************************************************************************/ - -/*------------------------------------------------- - keyboard_r - keyboard data read --------------------------------------------------*/ - -READ16_MEMBER( cgc7900_state::keyboard_r ) -{ - /* - - bit description - - 0 key data bit 0 - 1 key data bit 1 - 2 key data bit 2 - 3 key data bit 3 - 4 key data bit 4 - 5 key data bit 5 - 6 key data bit 6 - 7 key data bit 7 - 8 SHIFT key - 9 CTRL key - 10 M1 key - 11 M2 key - 12 - 13 - 14 - 15 - - */ - - return 0; -} - -/*------------------------------------------------- - keyboard_w - keyboard data write --------------------------------------------------*/ - -WRITE16_MEMBER( cgc7900_state::keyboard_w ) -{ - /* - - bit description - - 0 LED select bit 0 - 1 LED select bit 1 - 2 LED select bit 2 - 3 LED select bit 3 - 4 LED select bit 4 - 5 - 6 - 7 LED switch (1=on, 0=off) - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - - */ -} - -/*------------------------------------------------- - interrupt_mask_w - interrupt mask write --------------------------------------------------*/ - -WRITE16_MEMBER( cgc7900_state::interrupt_mask_w ) -{ - /* - - bit description - - 0 real time clock - 1 RS-449 Tx ready - 2 BINT 2 - 3 RS-232 Tx ready - 4 disk - 5 BINT 3 - 6 bezel keys - 7 keyboard - 8 RS-449 Rx ready - 9 light pen - 10 BINT 4 - 11 joystick - 12 vertical retrace - 13 BINT 5 - 14 BINT 1 - 15 RS-232 Rx ready - - */ - - m_int_mask = data; -} - -/*------------------------------------------------- - disk_data_r - disk data read --------------------------------------------------*/ - -READ16_MEMBER( cgc7900_state::disk_data_r ) -{ - return 0; -} - -/*------------------------------------------------- - disk_data_w - disk data write --------------------------------------------------*/ - -WRITE16_MEMBER( cgc7900_state::disk_data_w ) -{ -} - -/*------------------------------------------------- - disk_status_r - disk status read --------------------------------------------------*/ - -READ16_MEMBER( cgc7900_state::disk_status_r ) -{ - /* - - bit signal description - - 0 _I/O input/output - 1 _REQ request - 2 _BSY busy - 3 C/_D control/data - 4 _MSG message - 5 _RDY ready - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - - */ - - return 0xffff - 0x04; -} - -/*------------------------------------------------- - disk_command_w - disk command write --------------------------------------------------*/ - -WRITE16_MEMBER( cgc7900_state::disk_command_w ) -{ -} - -/*************************************************************************** - MEMORY MAPS -***************************************************************************/ - -/*------------------------------------------------- - ADDRESS_MAP( cgc7900_mem ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( cgc7900_mem, AS_PROGRAM, 16, cgc7900_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION(M68000_TAG, 0) - AM_RANGE(0x000008, 0x1fffff) AM_RAM AM_SHARE("chrom_ram") - AM_RANGE(0x800000, 0x80ffff) AM_ROM AM_REGION(M68000_TAG, 0) - AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(z_mode_r, z_mode_w) - AM_RANGE(0xc00000, 0xdfffff) AM_RAM AM_SHARE("plane_ram") - AM_RANGE(0xe00000, 0xe1ffff) AM_WRITE(color_status_w) -// AM_RANGE(0xe20000, 0xe23fff) Raster Processor - AM_RANGE(0xe30000, 0xe303ff) AM_RAM AM_SHARE("clut_ram") - AM_RANGE(0xe38000, 0xe3bfff) AM_RAM AM_SHARE("overlay_ram") - AM_RANGE(0xe40000, 0xe40001) AM_RAM AM_SHARE("roll_bitmap") - AM_RANGE(0xe40002, 0xe40003) AM_RAM AM_SHARE("pan_x") - AM_RANGE(0xe40004, 0xe40005) AM_RAM AM_SHARE("pan_y") - AM_RANGE(0xe40006, 0xe40007) AM_RAM AM_SHARE("zoom") - AM_RANGE(0xe40008, 0xe40009) AM_RAM - AM_RANGE(0xe4000a, 0xe4000f) AM_RAM // Raster Processor - AM_RANGE(0xe40010, 0xe40011) AM_RAM AM_SHARE("blink_select") - AM_RANGE(0xe40012, 0xe40013) AM_RAM AM_SHARE("plane_select") - AM_RANGE(0xe40014, 0xe40015) AM_RAM AM_SHARE("plane_switch") - AM_RANGE(0xe40016, 0xe40017) AM_RAM AM_SHARE("color_status_fg") - AM_RANGE(0xe40018, 0xe40019) AM_RAM AM_SHARE("color_status_bg") - AM_RANGE(0xe4001a, 0xe4001b) AM_RAM AM_SHARE("roll_overlay") - AM_RANGE(0xe4001c, 0xe40fff) AM_RAM -// AM_RANGE(0xefc440, 0xefc441) HVG Load X -// AM_RANGE(0xefc442, 0xefc443) HVG Load Y -// AM_RANGE(0xefc444, 0xefc445) HVG Load dX -// AM_RANGE(0xefc446, 0xefc447) HVG Load dY -// AM_RANGE(0xefc448, 0xefc449) HVG Load Pixel Color -// AM_RANGE(0xefc44a, 0xefc44b) HVG Load Trip - AM_RANGE(0xff8000, 0xff8001) AM_DEVREADWRITE8(INS8251_0_TAG, i8251_device, data_r, data_w, 0xff00) - AM_RANGE(0xff8002, 0xff8003) AM_DEVREADWRITE8(INS8251_0_TAG, i8251_device, status_r, control_w, 0xff00) - AM_RANGE(0xff8040, 0xff8041) AM_DEVREADWRITE8(INS8251_1_TAG, i8251_device, data_r, data_w, 0xff00) - AM_RANGE(0xff8042, 0xff8043) AM_DEVREADWRITE8(INS8251_1_TAG, i8251_device, status_r, control_w, 0xff00) - AM_RANGE(0xff8080, 0xff8081) AM_READWRITE(keyboard_r, keyboard_w) -// AM_RANGE(0xff80c6, 0xff80c7) Joystick X axis -// AM_RANGE(0xff80ca, 0xff80cb) Joystick Y axis -// AM_RANGE(0xff80cc, 0xff80cd) Joystick Z axis - AM_RANGE(0xff8100, 0xff8101) AM_READWRITE(disk_data_r, disk_data_w) - AM_RANGE(0xff8120, 0xff8121) AM_READWRITE(disk_status_r, disk_command_w) - AM_RANGE(0xff8140, 0xff8141) AM_READ_PORT("BEZEL") -// AM_RANGE(0xff8180, 0xff8181) AM_DEVWRITE8(K1135A_TAG, k1135a_w, 0xff00) Baud rate generator -// AM_RANGE(0xff81c0, 0xff81ff) AM_DEVREADWRITE8(MM58167_TAG, mm58167_r, mm58167_w, 0xff00) - AM_RANGE(0xff8200, 0xff8201) AM_WRITE(interrupt_mask_w) -// AM_RANGE(0xff8240, 0xff8241) Light Pen enable -// AM_RANGE(0xff8242, 0xff8243) Light Pen X value -// AM_RANGE(0xff8244, 0xff8245) Light Pen Y value -// AM_RANGE(0xff8246, 0xff8247) Buffer memory parity check -// AM_RANGE(0xff8248, 0xff8249) Buffer memory parity set/reset - AM_RANGE(0xff824a, 0xff824b) AM_READ(sync_r) - AM_RANGE(0xff83c0, 0xff83c1) AM_DEVWRITE8(AY8910_TAG, ay8910_device, address_w, 0xff00) - AM_RANGE(0xff83c2, 0xff83c3) AM_DEVREAD8(AY8910_TAG, ay8910_device, data_r, 0xff00) - AM_RANGE(0xff83c4, 0xff83c5) AM_DEVWRITE8(AY8910_TAG, ay8910_device, data_w, 0xff00) -// AM_RANGE(0xff8500, 0xff8501) Disk DMA Command Register -// AM_RANGE(0xff8502, 0xff8503) Disk DMA Address Register -// AM_RANGE(0xff8507, 0xff8507) Disk DMA Control/Status Register -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( keyboard_mem ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( keyboard_mem, AS_PROGRAM, 8, cgc7900_state ) - AM_RANGE(0x000, 0x7ff) AM_ROM -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( keyboard_io ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( keyboard_io, AS_IO, 8, cgc7900_state ) -/* AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS)*/ -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/*------------------------------------------------- - INPUT_PORTS( cgc7900 ) --------------------------------------------------*/ - -static INPUT_PORTS_START( cgc7900 ) - PORT_START("BEZEL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 7") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 8") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 5") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 6") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 3") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 4") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 2") - - PORT_START("JOYSTICK_X") - PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_X ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) - - PORT_START("JOYSTICK_Y") - PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Y ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) - - PORT_START("JOYSTICK_Z") - PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Z ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) - - PORT_START("LIGHT_PEN_X") - PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0, 511) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) - - PORT_START("LIGHT_PEN_Y") - PORT_BIT( 0x1ff, 0x0c0, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 383) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) -INPUT_PORTS_END - - -/*************************************************************************** - MACHINE INITIALIZATION -***************************************************************************/ - -/*------------------------------------------------- - MACHINE_START( cgc7900 ) --------------------------------------------------*/ - -void cgc7900_state::machine_start() -{ - /* register for state saving */ - save_pointer(NAME(m_overlay_ram.target()), 0x4000); -} - -void cgc7900_state::machine_reset() -{ -} - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -/*------------------------------------------------- - MACHINE_DRIVER( cgc7900 ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( cgc7900, cgc7900_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M68000_TAG, M68000, XTAL_28_48MHz/4) - MCFG_CPU_PROGRAM_MAP(cgc7900_mem) - - MCFG_CPU_ADD(I8035_TAG, I8035, 1000000) - MCFG_CPU_PROGRAM_MAP(keyboard_mem) - MCFG_CPU_IO_MAP(keyboard_io) - MCFG_DEVICE_DISABLE() - -/* MCFG_CPU_ADD(AM2910_TAG, AM2910, XTAL_17_36MHz) - MCFG_CPU_PROGRAM_MAP(omti10_mem)*/ - - /* video hardware */ - MCFG_FRAGMENT_ADD(cgc7900_video) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_28_48MHz/16) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(INS8251_0_TAG, I8251, 0) - // rs232 - - MCFG_DEVICE_ADD(INS8251_1_TAG, I8251, 0) - // rs449 -MACHINE_CONFIG_END - -/*************************************************************************** - ROMS -***************************************************************************/ - -ROM_START( cgc7900 ) - ROM_REGION16_BE( 0x10000, M68000_TAG, 0 ) - ROM_LOAD16_BYTE( "210274 800k even a3ee term 1.4.ue24", 0x0000, 0x1000, CRC(5fa8f368) SHA1(120dbcfedce0badd38bf5b23e1fbc99667eb286c) ) - ROM_LOAD16_BYTE( "210275 800k odd bbb3 term 1.4.uf24", 0x0001, 0x1000, CRC(4d479457) SHA1(5fa96a1eadfd9ba493d28691286e2e001a489a19) ) - ROM_LOAD16_BYTE( "210276 802k even 0c22 term 1.4.ue22", 0x2000, 0x1000, CRC(c88c44ec) SHA1(f39d8a3cf7aaefd815b4426348965b076c1f2265) ) - ROM_LOAD16_BYTE( "210277 802k odd b58c term 1.4.uf22", 0x2001, 0x1000, CRC(52ffe01f) SHA1(683aa71c2eb17b7ad639b888487db73d7684901a) ) - ROM_LOAD16_BYTE( "210278 804k even eaf4 term 1.4.ue21", 0x4000, 0x1000, CRC(7fe326db) SHA1(d39d05e008160fb8afa62e0d4cfb1d813f2296d4) ) - ROM_LOAD16_BYTE( "210279 804k odd 3f6d term 1.4.uf21", 0x4001, 0x1000, CRC(6c12d81c) SHA1(efe7c20e567c02b9c5b66a2d18e035d5f5f56b28) ) - ROM_LOAD16_BYTE( "210280 806k even 679d term 1.4.ue20", 0x6000, 0x1000, CRC(70930d74) SHA1(a5ab1c0bd8bd829408961107e01598cd71a97fec) ) - ROM_LOAD16_BYTE( "210281 1.4 806k odd sum 611e.uf20", 0x6001, 0x1000, CRC(8080aa2a) SHA1(c018a23e6f2158e2d63723cade0a3ad737090921) ) - ROM_LOAD16_BYTE( "su7700 210282 808k even opmod term 1.4 sum 2550.ue18", 0x8000, 0x1000, CRC(8f5834cd) SHA1(3cd03c82aa85c30cbc8e954f5a9fc4e9034f913b) ) - ROM_LOAD16_BYTE( "su7700 210283 808k odd opmod term 1.4 sum faca.uf18", 0x8001, 0x1000, CRC(e593b133) SHA1(6c641df844706e0d990b5fd544e98594171080a1) ) - ROM_LOAD16_BYTE( "210258 80ak even b2f6 mon 1.3.ue15", 0xa000, 0x1000, CRC(ec5a1250) SHA1(ffef73d35f172ac610b35bdf729d51eb6f9346ba) ) - ROM_LOAD16_BYTE( "210259 80ak odd cd66 mon 1.3.uf15", 0xa001, 0x1000, CRC(61eb43c6) SHA1(baaae0b787798147da453aac1f815589ea4ed921) ) - ROM_LOAD16_BYTE( "210244 80c even ce40 dos 1.6b.ue13", 0xc000, 0x1000, CRC(3b64e4cb) SHA1(71b28d160b101ea6165e602ff1c54272b7b30ece) ) - ROM_LOAD16_BYTE( "210245 80c odd 1ac3 dos 1.6b.uf13", 0xc001, 0x1000, CRC(0b6539ca) SHA1(d49e6d3307e5d634a412fd80b59492f31e29f7e0) ) - ROM_LOAD16_BYTE( "210290 idris even rel3 sum 0cce.ue12", 0xe000, 0x1000, CRC(07065772) SHA1(620ea5d55021e5c38efc010722ddbd852cd49e39) ) - ROM_LOAD16_BYTE( "210291 idris odd rel3 sum 5d11.uf12", 0xe001, 0x1000, CRC(d81b30da) SHA1(228f9b4e39d430ce4aaa81ea63f4516a51e6d001) ) - - ROM_REGION( 0x800, "i8035", 0 ) - ROM_LOAD( "keyboard controller i8035", 0x0000, 0x0800, NO_DUMP ) - - ROM_REGION( 0x800, "gfx1", 0 ) - ROM_LOAD( "norm chrset 4b40.ua13", 0x0000, 0x0400, CRC(55eb7b87) SHA1(768cea80597e7396d9e26f8cd09e6b480a526fce) ) - ROM_LOAD( "alt 46a7.ua14", 0x0400, 0x0400, CRC(be22b7e4) SHA1(83ef252c7fab33b4d3821a3049b89d044df35de8) ) - - ROM_REGION( 0x20, "proms", 0 ) - ROM_LOAD( "rp0a.ub8", 0x0000, 0x0020, NO_DUMP ) - ROM_LOAD( "rp1a.ub7", 0x0000, 0x0020, NO_DUMP ) - ROM_LOAD( "rp2a.ub9", 0x0000, 0x0020, NO_DUMP ) - ROM_LOAD( "ha-5.ub1", 0x0000, 0x0020, NO_DUMP ) - ROM_LOAD( "03c0.ua16", 0x0000, 0x0020, NO_DUMP ) - ROM_LOAD( "03c0.ua11", 0x0000, 0x0020, NO_DUMP ) - - /* OMTI Series 10 SCSI controller */ - ROM_REGION( 0x1400, AM2910_TAG, 0 ) - ROM_LOAD( "35 1.7b", 0x0000, 0x0400, NO_DUMP ) /* 82S137N */ - ROM_LOAD( "35 2.7b", 0x0400, 0x0400, NO_DUMP ) /* 82S137N */ - ROM_LOAD( "35 3.7b", 0x0800, 0x0400, NO_DUMP ) /* 82S137N */ - ROM_LOAD( "35 4.7b", 0x0c00, 0x0400, NO_DUMP ) /* 82S137N */ - ROM_LOAD( "35 5.7b", 0x1000, 0x0400, NO_DUMP ) /* 82S137N */ -ROM_END - -/*************************************************************************** - SYSTEM DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, cgc7900, 0, 0, cgc7900, cgc7900, driver_device, 0, "Chromatics", "CGC 7900", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/cgenie.c b/src/mess/drivers/cgenie.c deleted file mode 100644 index 3a5776814da..00000000000 --- a/src/mess/drivers/cgenie.c +++ /dev/null @@ -1,522 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - EACA Colour Genie EG2000 - - TODO: - - System is too fast, there should be one wait cycle every five cycles? - - What's the exact MC6845 type? It can't be H46505 - - Adjust visible area so that the borders aren't that large (needs - MC6845 changes) - - Verify BASIC and character set versions - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "video/mc6845.h" -#include "sound/ay8910.h" -#include "imagedev/cassette.h" -#include "formats/cgen_cas.h" -#include "bus/rs232/rs232.h" -#include "bus/cgenie/expansion/expansion.h" -#include "bus/cgenie/parallel/parallel.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class cgenie_state : public driver_device -{ -public: - cgenie_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_crtc(*this, "crtc"), - m_rs232(*this, "rs232"), - m_exp(*this, "exp"), - m_char_rom(*this, "gfx1"), - m_color_ram(*this, "colorram"), - m_font_ram(*this, "fontram"), - m_keyboard(*this, "KEY"), - m_palette(NULL), - m_control(0xff), - m_rs232_rx(1), - m_rs232_dcd(1) - {} - - DECLARE_DRIVER_INIT(cgenie_eu); - DECLARE_DRIVER_INIT(cgenie_nz); - - MC6845_BEGIN_UPDATE(crtc_begin_update); - MC6845_UPDATE_ROW(crtc_update_row); - - // 4-bit color ram - DECLARE_READ8_MEMBER(colorram_r); - DECLARE_WRITE8_MEMBER(colorram_w); - - // control port - DECLARE_WRITE8_MEMBER(control_w); - DECLARE_READ8_MEMBER(control_r); - - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_INPUT_CHANGED_MEMBER(rst_callback); - - DECLARE_WRITE_LINE_MEMBER(rs232_rx_w); - DECLARE_WRITE_LINE_MEMBER(rs232_dcd_w); - -protected: - virtual void machine_start(); - -private: - required_device m_maincpu; - required_device m_cassette; - required_device m_ram; - required_device m_crtc; - required_device m_rs232; - required_device m_exp; - required_memory_region m_char_rom; - required_shared_ptr m_color_ram; - required_shared_ptr m_font_ram; - required_ioport_array<8> m_keyboard; - - static const rgb_t m_palette_bg[]; - static const rgb_t m_palette_eu[]; - static const rgb_t m_palette_nz[]; - - const rgb_t *m_palette; - rgb_t m_background_color; - - UINT8 m_control; - - int m_rs232_rx; - int m_rs232_dcd; -}; - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -static ADDRESS_MAP_START( cgenie_mem, AS_PROGRAM, 8, cgenie_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROM -// AM_RANGE(0x4000, 0xbfff) AM_RAM // set up in machine_start - AM_RANGE(0xc000, 0xefff) AM_NOP // cartridge space - AM_RANGE(0xf000, 0xf3ff) AM_READWRITE(colorram_r, colorram_w) AM_SHARE("colorram") - AM_RANGE(0xf400, 0xf7ff) AM_RAM AM_SHARE("fontram") - AM_RANGE(0xf800, 0xf8ff) AM_MIRROR(0x300) AM_READ(keyboard_r) - AM_RANGE(0xfc00, 0xffff) AM_NOP // cartridge space -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cgenie_io, AS_IO, 8, cgenie_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf8, 0xf8) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0xf9, 0xf9) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) - AM_RANGE(0xfa, 0xfa) AM_DEVWRITE("crtc", mc6845_1_device, address_w) - AM_RANGE(0xfb, 0xfb) AM_DEVREADWRITE("crtc", mc6845_1_device, register_r, register_w) - AM_RANGE(0xff, 0xff) AM_READWRITE(control_r, control_w) -ADDRESS_MAP_END - - -//************************************************************************** -// INPUTS -//************************************************************************** - -static INPUT_PORTS_START( cgenie ) - PORT_START("KEY.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("KEY.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("KEY.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START("KEY.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) // produces [ and { when pressed, not on keyboard - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("KEY.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("KEY.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("KEY.7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mod Sel") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rpt") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L.P.") // marked as "L.P." in the manual, lightpen? - - PORT_START("RST") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F5) PORT_NAME("Rst") PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, cgenie_state, rst_callback, NULL) -INPUT_PORTS_END - - -//************************************************************************** -// KEYBOARD -//************************************************************************** - -READ8_MEMBER( cgenie_state::keyboard_r ) -{ - UINT8 data = 0; - - for (int i = 0; i < 8; i++) - if (BIT(offset, i)) - data |= m_keyboard[i]->read(); - - return data; -} - -INPUT_CHANGED_MEMBER( cgenie_state::rst_callback ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval); -} - - -//************************************************************************** -// CONTROL PORT & RS232 -//************************************************************************** - -WRITE8_MEMBER( cgenie_state::control_w ) -{ - // cassette output - m_cassette->output(BIT(data, 0) ? -1.0 : 1.0); - - // serial output - m_rs232->write_txd(BIT(data, 1)); - - // background color selection - if (BIT(data, 2)) - m_background_color = m_palette_bg[4]; - else - m_background_color = m_palette_bg[data >> 6 & 0x03]; - - // graphics/text mode switch - m_crtc->set_hpixels_per_column(BIT(data, 5) ? 4 : 8); - - m_control = data; -} - -READ8_MEMBER( cgenie_state::control_r ) -{ - UINT8 data = 0; - - data |= m_cassette->input() > 0 ? 1 : 0; - data |= m_rs232_rx << 1; - data |= m_rs232_dcd << 2; - - return data; -} - -WRITE_LINE_MEMBER( cgenie_state::rs232_rx_w ) -{ - m_rs232_rx = state; -} - -WRITE_LINE_MEMBER( cgenie_state::rs232_dcd_w ) -{ - m_rs232_dcd = state; -} - - -//************************************************************************** -// DRIVER INIT -//************************************************************************** - -DRIVER_INIT_MEMBER( cgenie_state, cgenie_eu ) -{ - m_palette = &m_palette_eu[0]; -} - -DRIVER_INIT_MEMBER( cgenie_state, cgenie_nz ) -{ - m_palette = &m_palette_nz[0]; -} - -void cgenie_state::machine_start() -{ - // setup ram - m_maincpu->space(AS_PROGRAM).install_ram(0x4000, 0x4000 + m_ram->size() - 1, m_ram->pointer()); - - // setup expansion bus - m_exp->set_program_space(&m_maincpu->space(AS_PROGRAM)); - m_exp->set_io_space(&m_maincpu->space(AS_IO)); -} - - -//************************************************************************** -// VIDEO EMULATION -//************************************************************************** - -READ8_MEMBER( cgenie_state::colorram_r ) -{ - return m_color_ram[offset] | 0xf0; -} - -WRITE8_MEMBER( cgenie_state::colorram_w ) -{ - m_color_ram[offset] = data & 0x0f; -} - -MC6845_BEGIN_UPDATE( cgenie_state::crtc_begin_update ) -{ - bitmap.fill(m_background_color, cliprect); -} - -MC6845_UPDATE_ROW( cgenie_state::crtc_update_row ) -{ - // don't need to do anything in vblank - if (!de) - return; - - for (int column = 0; column < x_count; column++) - { - UINT8 code = m_ram->pointer()[ma + column]; - UINT8 color = m_color_ram[(ma & 0xbff) + column]; - - // gfx mode? - if (BIT(m_control, 5)) - { - const rgb_t map[] = { m_background_color, m_palette[8], m_palette[6], m_palette[5] }; - - bitmap.pix32(y + vbp, column * 4 + hbp + 0) = map[code >> 6 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 1) = map[code >> 4 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 2) = map[code >> 2 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 3) = map[code >> 0 & 0x03]; - } - else - { - UINT8 gfx = 0; - - // cursor visible? - if (cursor_x == column) - gfx = 0xff; - - // or use character rom? - else if ((code < 128) || (code < 192 && BIT(m_control, 4)) || (code > 192 && BIT(m_control, 3))) - gfx = m_char_rom->base()[(code << 3) | ra]; - - // or the programmable characters? - else - gfx = m_font_ram[((code << 3) | ra) & 0x3ff]; - - // 8 pixel chars - for (int p = 0; p < 8; p++) - bitmap.pix32(y + vbp, column * 8 + hbp + p) = BIT(gfx, 7 - p) ? m_palette[color] : m_background_color; - } - } -} - - -//************************************************************************** -// PALETTE -//************************************************************************** - -// how accurate are these colors? -const rgb_t cgenie_state::m_palette_bg[] = -{ - rgb_t::black, - rgb_t(0x70, 0x28, 0x20), // dark orange - rgb_t(0x28, 0x70, 0x20), // dark green - rgb_t(0x48, 0x48, 0x48), // dark gray - rgb_t(0x70, 0x00, 0x70) // dark purple -}; - -// european palette -const rgb_t cgenie_state::m_palette_eu[] = -{ - rgb_t(0x5e, 0x5e, 0x5e), // gray - rgb_t(0x11, 0xff, 0xea), // cyan - rgb_t(0xff, 0x00, 0x5e), // red - rgb_t(0xea, 0xea, 0xea), // white - rgb_t(0xff, 0xf9, 0x00), // yellow - rgb_t(0x6e, 0xff, 0x00), // green - rgb_t(0xff, 0x52, 0x00), // orange - rgb_t(0xea, 0xff, 0x00), // light yellow - rgb_t(0x02, 0x48, 0xff), // blue - rgb_t(0x8e, 0xd4, 0xff), // light blue - rgb_t(0xff, 0x12, 0xff), // pink - rgb_t(0x88, 0x43, 0xff), // purple - rgb_t(0x8c, 0x8c, 0x8c), // light gray - rgb_t(0x00, 0xfb, 0x8c), // turquoise - rgb_t(0xd2, 0x00, 0xff), // magenta - rgb_t::white // bright white -}; - -// new zealand palette -const rgb_t cgenie_state::m_palette_nz[] = -{ - rgb_t::white, - rgb_t(0x12, 0xff, 0xff), - rgb_t(0xff, 0x6f, 0xff), - rgb_t(0x31, 0x77, 0xff), - rgb_t(0xff, 0xcb, 0x00), - rgb_t(0x6e, 0xff, 0x00), - rgb_t(0xff, 0x52, 0x00), - rgb_t(0x5e, 0x5e, 0x5e), - rgb_t(0xea, 0xea, 0xea), - rgb_t(0x00, 0xff, 0xdd), - rgb_t(0xd2, 0x00, 0xff), - rgb_t(0x02, 0x48, 0xff), - rgb_t(0xff, 0xf9, 0x00), - rgb_t(0x00, 0xda, 0x00), - rgb_t(0xff, 0x22, 0x00), - rgb_t::black -}; - - -//************************************************************************** -// MACHINE DEFINTIONS -//************************************************************************** - -static MACHINE_CONFIG_START( cgenie, cgenie_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, XTAL_17_73447MHz / 8) // 2.2168 MHz - MCFG_CPU_PROGRAM_MAP(cgenie_mem) - MCFG_CPU_IO_MAP(cgenie_io) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_17_73447MHz / 2, 568, 32, 416, 312, 28, 284) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - - MCFG_MC6845_ADD("crtc", MC6845_1, "screen", XTAL_17_73447MHz / 16) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_BEGIN_UPDATE_CB(cgenie_state, crtc_begin_update) - MCFG_MC6845_UPDATE_ROW_CB(cgenie_state, crtc_update_row) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_17_73447MHz / 8) - MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("par", parallel_slot_device, pa_r)) - MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("par", parallel_slot_device, pa_w)) - MCFG_AY8910_PORT_B_READ_CB(DEVREAD8("par", parallel_slot_device, pb_r)) - MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("par", parallel_slot_device, pb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(cgenie_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) - MCFG_CASSETTE_INTERFACE("cgenie_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "cgenie_cass") - - // serial port - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(WRITELINE(cgenie_state, rs232_rx_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE(cgenie_state, rs232_dcd_w)) - - // cartridge expansion slot - MCFG_EXPANSION_SLOT_ADD("exp") - MCFG_EXPANSION_SLOT_INT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - // parallel slot - MCFG_PARALLEL_SLOT_ADD("par") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K") -MACHINE_CONFIG_END - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( cgenie ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_LOAD("cg_rom1.z1", 0x0000, 0x1000, CRC(d3369420) SHA1(fe7f06f8e2b648d695d4787d00a374d3e4ac5d39)) - ROM_LOAD("cg_rom2.z2", 0x1000, 0x1000, CRC(73d2c9ea) SHA1(343d595b4eeaea627f9c36d5cef3827c79593425)) - ROM_LOAD("cg_rom3.z3", 0x2000, 0x1000, CRC(3f358811) SHA1(6ba151759fd8fd367806cf2dd5f1dfc33ee9521f)) - ROM_LOAD("cg_rom4.z4", 0x3000, 0x1000, CRC(be235782) SHA1(d7d61208a9855ffd09ecb051618f5ed6a8816f3f)) - - ROM_REGION(0x0800, "gfx1", 0) - // this is a "german" character set with umlauts, is this official? - ROM_LOAD("cgenieg.fnt", 0x0000, 0x0800, CRC(c3e60d57) SHA1(fb96f608fdb47391145fdcd614a9c7a79756e6a4)) - // default character set - ROM_LOAD("cgenie1.fnt", 0x0000, 0x0800, CRC(4fed774a) SHA1(d53df8212b521892cc56be690db0bb474627d2ff)) -ROM_END - -ROM_START( cgenienz ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "old", "Old ROM") - ROMX_LOAD("cg-basic-rom-v1-pal-en.rom", 0x0000, 0x4000, CRC(844aaedd) SHA1(b7f984bc5cd979c7ad11ff909e8134f694aea7aa), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "new", "New ROM") - ROMX_LOAD("cgromv2.rom", 0x0000, 0x4000, CRC(cfb84e09) SHA1(e199e4429bab6f9fca2bb05e71324538928a693a), ROM_BIOS(2)) - - ROM_REGION(0x0800, "gfx1", 0) - ROM_LOAD("cgenie1.fnt", 0x0000, 0x0800, CRC(4fed774a) SHA1(d53df8212b521892cc56be690db0bb474627d2ff)) -ROM_END - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1982, cgenie, 0, 0, cgenie, cgenie, cgenie_state, cgenie_eu, "EACA", "Colour Genie EG2000", 0) -COMP( 1982, cgenienz, cgenie, 0, cgenie, cgenie, cgenie_state, cgenie_nz, "EACA", "Colour Genie EG2000 (New Zealand)", 0) diff --git a/src/mess/drivers/channelf.c b/src/mess/drivers/channelf.c deleted file mode 100644 index 65cff8a5a96..00000000000 --- a/src/mess/drivers/channelf.c +++ /dev/null @@ -1,349 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle -/****************************************************************** - * - * Fairchild Channel F driver - * - * Juergen Buchmueller - * Frank Palazzolo - * Sean Riddle - * - * Fredric "e5frog" Blaoholtz, added support large cartridges - * also spanning from $3000 to $FFFF. Added clones - * Fabio "etabeta" Priuli, moved carts to be slot devices - * - ******************************************************************/ - -#include "includes/channelf.h" - -#ifndef VERBOSE -#define VERBOSE 0 -#endif - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -#define MASTER_CLOCK_PAL 2000000 /* PAL unit has a separate crystal at 4.000 MHz */ -#define PAL_VBLANK_TIME 4623 - - -/* The F8 has latches on its port pins - * These mimic's their behavior - * [0]=port0, [1]=port1, [2]=port4, [3]=port5 - * - * Note: this should really be moved into f8.c, - * but it's complicated by possible peripheral usage. - * - * If the read/write operation is going external to the F3850 - * (or F3853, etc.), then the latching applies. However, relaying the - * port read/writes from the F3850 to a peripheral like the F3853 - * should not be latched in this way. (See mk1 driver) - * - * The f8 cannot determine how its ports are mapped at runtime, - * so it can't easily decide to latch or not. - * - * ...so it stays here for now. - */ - -UINT8 channelf_state::port_read_with_latch(UINT8 ext, UINT8 latch_state) -{ - return (~ext | latch_state); -} - -READ8_MEMBER( channelf_state::port_0_r ) -{ - return port_read_with_latch(ioport("PANEL")->read(), m_latch[0]); -} - -READ8_MEMBER( channelf_state::port_1_r ) -{ - UINT8 ext_value; - - if ((m_latch[0] & 0x40) == 0) - ext_value = ioport("RIGHT_C")->read(); - else - ext_value = 0xc0 | ioport("RIGHT_C")->read(); - - return port_read_with_latch(ext_value,m_latch[1]); -} - -READ8_MEMBER( channelf_state::port_4_r ) -{ - UINT8 ext_value; - - if ((m_latch[0] & 0x40) == 0) - ext_value = ioport("LEFT_C")->read(); - else - ext_value = 0xff; - - return port_read_with_latch(ext_value,m_latch[2]); -} - -READ8_MEMBER( channelf_state::port_5_r ) -{ - return port_read_with_latch(0xff, m_latch[3]); -} - -WRITE8_MEMBER( channelf_state::port_0_w ) -{ - int offs; - - m_latch[0] = data; - - if (data & 0x20) - { - offs = m_row_reg*128+m_col_reg; - m_p_videoram[offs] = m_val_reg; - } -} - -WRITE8_MEMBER( channelf_state::port_1_w ) -{ - m_latch[1] = data; - m_val_reg = ((data ^ 0xff) >> 6) & 0x03; -} - -WRITE8_MEMBER( channelf_state::port_4_w ) -{ - m_latch[2] = data; - m_col_reg = (data | 0x80) ^ 0xff; -} - -WRITE8_MEMBER( channelf_state::port_5_w ) -{ - m_latch[3] = data; - m_custom->sound_w((data>>6)&3); - m_row_reg = (data | 0xc0) ^ 0xff; -} - -static ADDRESS_MAP_START( channelf_map, AS_PROGRAM, 8, channelf_state ) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0xffff) AM_DEVREAD("cartslot", channelf_cart_slot_device, read_rom) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( channelf_io, AS_IO, 8, channelf_state ) - AM_RANGE(0x00, 0x00) AM_READWRITE(port_0_r, port_0_w) /* Front panel switches */ - AM_RANGE(0x01, 0x01) AM_READWRITE(port_1_r, port_1_w) /* Right controller */ - AM_RANGE(0x04, 0x04) AM_READWRITE(port_4_r, port_4_w) /* Left controller */ - AM_RANGE(0x05, 0x05) AM_READWRITE(port_5_r, port_5_w) -ADDRESS_MAP_END - - - -static INPUT_PORTS_START( channelf ) - PORT_START("PANEL") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("TIME (Button 1)") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("HOLD (Button 2)") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MODE (Button 3)") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("START (Button 4)") PORT_CODE(KEYCODE_4) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("RIGHT_C") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("P1 Twist Counterclockwise") PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("P1 Twist Clockwise")PORT_PLAYER(1) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("P1 Pull Up") PORT_PLAYER(1) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P1 Push Down") PORT_PLAYER(1) - - PORT_START("LEFT_C") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("P2 Twist Counterclockwise") PORT_PLAYER(2) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("P2 Twist Clockwise")PORT_PLAYER(2) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("P2 Pull Up") PORT_PLAYER(2) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P2 Push Down") PORT_PLAYER(2) -INPUT_PORTS_END - - -void channelf_state::machine_start() -{ - if (m_cart->exists()) - { - switch (m_cart->get_type()) - { - case CF_MAZE: - m_maincpu->space(AS_IO).install_readwrite_handler(0x24, 0x25, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); - break; - case CF_HANGMAN: - m_maincpu->space(AS_IO).install_readwrite_handler(0x20, 0x21, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); - break; - case CF_CHESS: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); - break; - case CF_MULTI: - case CF_MULTI_OLD: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x3000, 0x3fff, write8_delegate(FUNC(channelf_cart_slot_device::write_bank),(channelf_cart_slot_device*)m_cart)); - break; - } - - m_cart->save_ram(); - } -} - -static SLOT_INTERFACE_START(cf_cart) - SLOT_INTERFACE_INTERNAL("std", CHANF_ROM_STD) - SLOT_INTERFACE_INTERNAL("maze", CHANF_ROM_MAZE) - SLOT_INTERFACE_INTERNAL("hangman", CHANF_ROM_HANGMAN) - SLOT_INTERFACE_INTERNAL("chess", CHANF_ROM_CHESS) - SLOT_INTERFACE_INTERNAL("multi_old",CHANF_ROM_MULTI_OLD) - SLOT_INTERFACE_INTERNAL("multi", CHANF_ROM_MULTI_FINAL) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_FRAGMENT( channelf_cart ) - /* cartridge */ - MCFG_CHANNELF_CARTRIDGE_ADD("cartslot", cf_cart, NULL) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","channelf") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( channelf, channelf_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", F8, 3579545/2) /* Colorburst/2 */ - MCFG_CPU_PROGRAM_MAP(channelf_map) - MCFG_CPU_IO_MAP(channelf_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(128, 64) - MCFG_SCREEN_VISIBLE_AREA(4, 112 - 7, 4, 64 - 3) - MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(channelf_state, channelf) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", CHANNELF_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_FRAGMENT_ADD( channelf_cart ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( sabavdpl, channelf_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", F8, MASTER_CLOCK_PAL) /* PAL speed */ - MCFG_CPU_PROGRAM_MAP(channelf_map) - MCFG_CPU_IO_MAP(channelf_io) - MCFG_QUANTUM_TIME(attotime::from_hz(50)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(PAL_VBLANK_TIME)) /* approximate */ - MCFG_SCREEN_SIZE(128, 64) - MCFG_SCREEN_VISIBLE_AREA(4, 112 - 7, 4, 64 - 3) - MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(channelf_state, channelf) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", CHANNELF_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_FRAGMENT_ADD( channelf_cart ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( channlf2, channelf_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", F8, 3579545/2) /* Colorburst / 2 */ - MCFG_CPU_PROGRAM_MAP(channelf_map) - MCFG_CPU_IO_MAP(channelf_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(128, 64) - MCFG_SCREEN_VISIBLE_AREA(4, 112 - 7, 4, 64 - 3) - MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(channelf_state, channelf) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", CHANNELF_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_FRAGMENT_ADD( channelf_cart ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( sabavpl2, channelf_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", F8, MASTER_CLOCK_PAL) /* PAL speed */ - MCFG_CPU_PROGRAM_MAP(channelf_map) - MCFG_CPU_IO_MAP(channelf_io) - MCFG_QUANTUM_TIME(attotime::from_hz(50)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(PAL_VBLANK_TIME)) /* not accurate */ - MCFG_SCREEN_SIZE(128, 64) - MCFG_SCREEN_VISIBLE_AREA(4, 112 - 7, 4, 64 - 3) - MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(channelf_state, channelf) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", CHANNELF_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_FRAGMENT_ADD( channelf_cart ) -MACHINE_CONFIG_END - -ROM_START( channelf ) - ROM_REGION(0x10000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "sl90025", "Luxor Video Entertainment System" ) - ROMX_LOAD("sl90025.rom", 0x0000, 0x0400, CRC(015c1e38) SHA1(759e2ed31fbde4a2d8daf8b9f3e0dffebc90dae2), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "sl31253", "Channel F" ) - ROMX_LOAD("sl31253.rom", 0x0000, 0x0400, CRC(04694ed9) SHA1(81193965a374d77b99b4743d317824b53c3e3c78), ROM_BIOS(2)) - ROM_LOAD("sl31254.rom", 0x0400, 0x0400, CRC(9c047ba3) SHA1(8f70d1b74483ba3a37e86cf16c849d601a8c3d2c)) - ROM_REGION(0x2000, "vram", ROMREGION_ERASE00) -ROM_END - -#define rom_sabavdpl rom_channelf -#define rom_luxorves rom_channelf -#define rom_channlf2 rom_channelf -#define rom_sabavdpl rom_channelf -#define rom_sabavpl2 rom_channelf -#define rom_luxorvec rom_channelf -#define rom_itttelma rom_channelf -#define rom_ingtelma rom_channelf - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1976, channelf, 0, 0, channelf, channelf, driver_device, 0, "Fairchild", "Channel F", 0 ) -CONS( 1977, sabavdpl, channelf, 0, sabavdpl, channelf, driver_device, 0, "SABA", "SABA Videoplay", 0 ) -CONS( 197?, luxorves, channelf, 0, sabavdpl, channelf, driver_device, 0, "Luxor", "Luxor Video Entertainment System", 0 ) -CONS( 1978, channlf2, 0, channelf, channlf2, channelf, driver_device, 0, "Fairchild", "Channel F II", 0 ) -CONS( 1978, sabavpl2, channlf2, 0, sabavpl2, channelf, driver_device, 0, "SABA", "SABA Videoplay 2", 0 ) -CONS( 197?, luxorvec, channlf2, 0, sabavpl2, channelf, driver_device, 0, "Luxor", "Luxor Video Entertainment Computer", 0 ) -CONS( 197?, itttelma, channlf2, 0, sabavpl2, channelf, driver_device, 0, "ITT", "ITT Tele-Match Processor", 0 ) -CONS( 1978, ingtelma, channlf2, 0, sabavpl2, channelf, driver_device, 0, "Ingelen", "Ingelen Tele-Match Processor", 0 ) diff --git a/src/mess/drivers/chaos.c b/src/mess/drivers/chaos.c deleted file mode 100644 index 7c0c72ae3ac..00000000000 --- a/src/mess/drivers/chaos.c +++ /dev/null @@ -1,164 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Chaos2 - - 08/04/2010 Skeleton driver. - 19/05/2012 Connected to a terminal, system is usable [Robbbert] - - This is a homebrew system: http://koo.corpus.cam.ac.uk/chaos/ - - There are no schematics or manuals, so the results might not be - totally accurate. - - With the DOS config switch turned off, the only accepted input - is a line starting with '&'. The actual commands are unknown. - - With DOS enabled, a large number of commands become available. - These are: - access, ask, ascdis, bpclr, bpset, close, control, copy, devfive, dir, - end, exec, execute, fill, find, goto, if, input, let, list, load, lowercase, - memdis, memset, open, port, read, reboot, runhex, run, save, type, typesl, - verify. - An example is: memdis 0 f - Don't try 'fill' - it fills all memory with zeroes, crashing the system. - - ToDo: - - Connect up floppy disk (no info available on this) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/s2650/s2650.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class chaos_state : public driver_device -{ -public: - chaos_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_terminal(*this, TERMINAL_TAG), - m_p_ram(*this, "p_ram") , - m_maincpu(*this, "maincpu") - { - } - - DECLARE_READ8_MEMBER(port1e_r); - DECLARE_WRITE8_MEMBER(port1f_w); - DECLARE_READ8_MEMBER(port90_r); - DECLARE_READ8_MEMBER(port91_r); - DECLARE_WRITE8_MEMBER(port92_w); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_term_data; - virtual void machine_reset(); - required_device m_terminal; - required_shared_ptr m_p_ram; - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START( chaos_mem, AS_PROGRAM, 8, chaos_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_RAM AM_SHARE("p_ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( chaos_io, AS_IO, 8, chaos_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x1e, 0x1e) AM_READ(port1e_r) - AM_RANGE(0x1f, 0x1f) AM_READWRITE(port90_r, port1f_w) - AM_RANGE(0x90, 0x90) AM_READ(port90_r) - AM_RANGE(0x91, 0x91) AM_READ(port91_r) - AM_RANGE(0x92, 0x92) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x101, 0x103) AM_NOP // stops error log filling up while using debug -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( chaos ) - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x00, "Enable DOS") - PORT_CONFSETTING( 0x01, DEF_STR(No)) - PORT_CONFSETTING( 0x00, DEF_STR(Yes)) -INPUT_PORTS_END - - -// Port 1E - Bit 0 indicates key pressed, Bit 1 indicates ok to output - -READ8_MEMBER( chaos_state::port1e_r ) -{ - return (m_term_data) ? 1 : 0; -} - -WRITE8_MEMBER( chaos_state::port1f_w ) -{ - // make the output readable on our terminal - if (data == 0x09) - return; - else - if (!data) - data = 0x24; - - m_terminal->write(space, 0, data); - - if (data == 0x0d) - m_terminal->write(space, 0, 0x0a); -} - -READ8_MEMBER( chaos_state::port90_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -// Status port -// Bit 0 = L use ports 1E & 1F; H use ports 90 & 92 -// Bit 3 = key pressed -// Bit 7 = ok to output - -READ8_MEMBER( chaos_state::port91_r ) -{ - UINT8 ret = 0x80 | ioport("CONFIG")->read(); - ret |= (m_term_data) ? 8 : 0; - return ret; -} - -WRITE8_MEMBER( chaos_state::kbd_put ) -{ - m_term_data = data; -} - -void chaos_state::machine_reset() -{ - // copy the roms into ram - UINT8* ROM = memregion("maincpu")->base(); - memcpy(m_p_ram, ROM, 0x3000); - memcpy(m_p_ram+0x7000, ROM+0x7000, 0x1000); -} - -static MACHINE_CONFIG_START( chaos, chaos_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(chaos_mem) - MCFG_CPU_IO_MAP(chaos_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(chaos_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( chaos ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "chaos.001", 0x0000, 0x1000, CRC(3b433e72) SHA1(5b487337d71253d0e64e123f405da9eaf20e87ac)) - ROM_LOAD( "chaos.002", 0x1000, 0x1000, CRC(8b0b487f) SHA1(0d167cf3004a81c87446f2f1464e3debfa7284fe)) - ROM_LOAD( "chaos.003", 0x2000, 0x1000, CRC(5880db81) SHA1(29b8f1b03c83953f66464ad1fbbfe2e019637ce1)) - ROM_LOAD( "chaos.004", 0x7000, 0x1000, CRC(5d6839d6) SHA1(237f52f0780ac2e29d57bf06d0f7a982eb523084)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, chaos, 0, 0, chaos, chaos, driver_device, 0, "", "Chaos 2", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/chessmst.c b/src/mess/drivers/chessmst.c deleted file mode 100644 index 765fd3078bb..00000000000 --- a/src/mess/drivers/chessmst.c +++ /dev/null @@ -1,286 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Chess-Master - - TODO: - - add Reset and Halt buttons - - a better artwork - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80pio.h" -#include "sound/speaker.h" -#include "chessmst.lh" - - -class chessmst_state : public driver_device -{ -public: - chessmst_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker") - { } - - required_device m_maincpu; - required_device m_speaker; - - UINT16 m_matrix; - UINT16 m_led_sel; - UINT8 m_sensor[64]; - - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( pio1_port_a_w ); - DECLARE_WRITE8_MEMBER( pio1_port_b_w ); - DECLARE_READ8_MEMBER( pio2_port_a_r ); - DECLARE_WRITE8_MEMBER( pio2_port_b_w ); - DECLARE_INPUT_CHANGED_MEMBER(chessmst_sensor); -}; - - -static ADDRESS_MAP_START(chessmst_mem, AS_PROGRAM, 8, chessmst_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x7fff) // A15 not connected - AM_RANGE( 0x0000, 0x27ff ) AM_ROM - AM_RANGE( 0x3400, 0x3bff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( chessmst_io , AS_IO, 8, chessmst_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - //AM_RANGE(0x00, 0x03) AM_MIRROR(0xf0) read/write in both, not used by the software - AM_RANGE(0x04, 0x07) AM_MIRROR(0xf0) AM_DEVREADWRITE("z80pio1", z80pio_device, read, write) - AM_RANGE(0x08, 0x0b) AM_MIRROR(0xf0) AM_DEVREADWRITE("z80pio2", z80pio_device, read, write) -ADDRESS_MAP_END - -INPUT_CHANGED_MEMBER(chessmst_state::chessmst_sensor) -{ - UINT8 pos = (UINT8)(FPTR)param; - - if (newval) - { - m_sensor[pos] = !m_sensor[pos]; - } -} - -/* Input ports */ -static INPUT_PORTS_START( chessmst ) - PORT_START("COL_A") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 7) - PORT_START("COL_B") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 9) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 10) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 11) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 12) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 13) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 14) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 15) - PORT_START("COL_C") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 16) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 17) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 18) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 19) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 20) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 21) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 22) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 23) - PORT_START("COL_D") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 24) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 25) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 26) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 27) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 28) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 29) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 30) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 31) - PORT_START("COL_E") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 32) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 33) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 34) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 35) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 36) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 37) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 38) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 39) - PORT_START("COL_F") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 40) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 41) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 42) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 43) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 44) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 45) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 46) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 47) - PORT_START("COL_G") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 48) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 49) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 50) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 51) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 52) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 53) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 54) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 55) - PORT_START("COL_H") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 56) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 57) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 58) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 59) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 60) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 61) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 62) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED_MEMBER(DEVICE_SELF, chessmst_state, chessmst_sensor, 63) - - PORT_START("BUTTONS") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Hint [7]") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_H) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Random [6]") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_R) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Referee [5]") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_F) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Selfplay [4]") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Board [3]") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_B) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Color [2]") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_C) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Level [1]") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_L) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("New Game [0]") PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_ENTER) -INPUT_PORTS_END - -void chessmst_state::machine_reset() -{ - //reset all sensors - memset(m_sensor, 1, sizeof(m_sensor)); - - //positioning the pieces for start next game - for (int i=0; i<64; i+=8) - m_sensor[i+0] = m_sensor[i+1] = m_sensor[i+6] = m_sensor[i+7] = 0; -} - -WRITE8_MEMBER( chessmst_state::pio1_port_a_w ) -{ - for (int row=1; row<=8; row++) - { - if (m_led_sel & 0x01) - output_set_indexed_value("led_a", row, BIT(data, 8-row)); - if (m_led_sel & 0x02) - output_set_indexed_value("led_b", row, BIT(data, 8-row)); - if (m_led_sel & 0x04) - output_set_indexed_value("led_c", row, BIT(data, 8-row)); - if (m_led_sel & 0x08) - output_set_indexed_value("led_d", row, BIT(data, 8-row)); - if (m_led_sel & 0x10) - output_set_indexed_value("led_e", row, BIT(data, 8-row)); - if (m_led_sel & 0x20) - output_set_indexed_value("led_f", row, BIT(data, 8-row)); - if (m_led_sel & 0x40) - output_set_indexed_value("led_g", row, BIT(data, 8-row)); - if (m_led_sel & 0x80) - output_set_indexed_value("led_h", row, BIT(data, 8-row)); - if (m_led_sel & 0x100) - output_set_indexed_value("led_i", row, BIT(data, 8-row)); - if (m_led_sel & 0x200) - output_set_indexed_value("led_j", row, BIT(data, 8-row)); - } - - m_led_sel = 0; -} - -WRITE8_MEMBER( chessmst_state::pio1_port_b_w ) -{ - m_matrix = (m_matrix & 0xff) | ((data & 0x01)<<8); - m_led_sel = (m_led_sel & 0xff) | ((data & 0x03)<<8); - - m_speaker->level_w(BIT(data, 6)); -} - -READ8_MEMBER( chessmst_state::pio2_port_a_r ) -{ - UINT8 data = 0x00; - - // The pieces position on the chessboard is identified by 64 Hall - // sensors, which are in a 8x8 matrix with the corresponding LEDs. - for (int i=0; i<8; i++) - { - if (m_matrix & 0x01) - data |= (m_sensor[0+i] ? (1<read(); - - return data; -} - -WRITE8_MEMBER( chessmst_state::pio2_port_b_w ) -{ - m_matrix = (data & 0xff) | (m_matrix & 0x100); - m_led_sel = (data & 0xff) | (m_led_sel & 0x300); -} - -static MACHINE_CONFIG_START( chessmst, chessmst_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(chessmst_mem) - MCFG_CPU_IO_MAP(chessmst_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_chessmst) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_DEVICE_ADD("z80pio1", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(chessmst_state, pio1_port_a_w)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(chessmst_state, pio1_port_b_w)) - - MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_IN_PA_CB(READ8(chessmst_state, pio2_port_a_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(chessmst_state, pio2_port_b_w)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( chessmst ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "056.bin", 0x0000, 0x0400, CRC(2b90e5d3) SHA1(c47445964b2e6cb11bd1f27e395cf980c97af196)) - ROM_LOAD( "057.bin", 0x0400, 0x0400, CRC(e666fc56) SHA1(3fa75b82cead81973bea94191a5c35f0acaaa0e6)) - ROM_LOAD( "058.bin", 0x0800, 0x0400, CRC(6a17fbec) SHA1(019051e93a5114477c50eaa87e1ff01b02eb404d)) - ROM_LOAD( "059.bin", 0x0c00, 0x0400, CRC(e96e3d07) SHA1(20fab75f206f842231f0414ebc473ce2a7371e7f)) - ROM_LOAD( "060.bin", 0x1000, 0x0400, CRC(0e31f000) SHA1(daac924b79957a71a4b276bf2cef44badcbe37d3)) - ROM_LOAD( "061.bin", 0x1400, 0x0400, CRC(69ad896d) SHA1(25d999b59d4cc74bd339032c26889af00e64df60)) - ROM_LOAD( "062.bin", 0x1800, 0x0400, CRC(c42925fe) SHA1(c42d8d7c30a9b6d91ac994cec0cc2723f41324e9)) - ROM_LOAD( "063.bin", 0x1c00, 0x0400, CRC(86be4cdb) SHA1(741f984c15c6841e227a8722ba30cf9e6b86d878)) - ROM_LOAD( "064.bin", 0x2000, 0x0400, CRC(e82f5480) SHA1(38a939158052f5e6484ee3725b86e522541fe4aa)) - ROM_LOAD( "065.bin", 0x2400, 0x0400, CRC(4ec0e92c) SHA1(0b748231a50777391b04c1778750fbb46c21bee8)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, chessmst, 0, 0, chessmst, chessmst, driver_device, 0, "VEB Mikroelektronik Erfurt", "Chess-Master", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mess/drivers/chesstrv.c b/src/mess/drivers/chesstrv.c deleted file mode 100644 index bd79872d15a..00000000000 --- a/src/mess/drivers/chesstrv.c +++ /dev/null @@ -1,256 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/****************************************************************************** - - Acetronic Chess Traveller - - TODO: - - Add emulation of the 3870 MCU to the F8 core, including timer interrupt - that is used by the Boris Diplomat. - -******************************************************************************/ - -#include "emu.h" -#include "cpu/f8/f8.h" -#include "chesstrv.lh" -#include "borisdpl.lh" - -class chesstrv_state : public driver_device -{ -public: - chesstrv_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( ram_addr_r ); - DECLARE_WRITE8_MEMBER( ram_addr_w ); - DECLARE_READ8_MEMBER( ram_r ); - DECLARE_WRITE8_MEMBER( ram_w ); - DECLARE_WRITE8_MEMBER( display_w ); - DECLARE_WRITE8_MEMBER( matrix_w ); - DECLARE_READ8_MEMBER( keypad_r ); - DECLARE_WRITE8_MEMBER( diplomat_display_w ); - DECLARE_READ8_MEMBER( diplomat_keypad_r ); - - UINT8 m_ram_addr; - UINT8 *m_ram; - UINT8 m_matrix; - //TIMER_DEVICE_CALLBACK_MEMBER(borisdpl_timer_interrupt); - required_device m_maincpu; -}; - -WRITE8_MEMBER( chesstrv_state::ram_addr_w ) -{ - m_ram_addr = data; -} - -READ8_MEMBER( chesstrv_state::ram_addr_r ) -{ - return m_ram_addr; -} - -READ8_MEMBER( chesstrv_state::ram_r ) -{ - return m_ram[m_ram_addr]; -} - -WRITE8_MEMBER( chesstrv_state::ram_w ) -{ - m_ram[m_ram_addr] = data; -} - -WRITE8_MEMBER( chesstrv_state::display_w ) -{ - UINT8 seg_data = BITSWAP8(data,0,1,2,3,4,5,6,7); - - if(!(m_matrix & 0x01)) - output_set_digit_value( 3, seg_data ); - if(!(m_matrix & 0x02)) - output_set_digit_value( 2, seg_data ); - if(!(m_matrix & 0x04)) - output_set_digit_value( 1, seg_data ); - if(!(m_matrix & 0x08)) - output_set_digit_value( 0, seg_data ); -} - -WRITE8_MEMBER( chesstrv_state::matrix_w ) -{ - m_matrix = data; -} - -READ8_MEMBER( chesstrv_state::keypad_r ) -{ - UINT8 data = 0; - - data |= ioport("LINE1")->read(); - data |= ioport("LINE2")->read(); - data |= ioport("LINE3")->read(); - data |= ioport("LINE4")->read(); - data |= (ioport("LINE1")->read() ? 0x10 : 0); - data |= (ioport("LINE2")->read() ? 0x20 : 0); - data |= (ioport("LINE3")->read() ? 0x40 : 0); - data |= (ioport("LINE4")->read() ? 0x80 : 0); - - return data; -} - -WRITE8_MEMBER( chesstrv_state::diplomat_display_w ) -{ - output_set_digit_value( m_matrix & 7, data ^ 0xff ); -} - -READ8_MEMBER( chesstrv_state::diplomat_keypad_r ) -{ - UINT8 data = m_matrix & 0x07; - - switch (m_matrix & 7) - { - case 0: data |= ioport("LINE1")->read(); break; - case 1: data |= ioport("LINE2")->read(); break; - case 2: data |= ioport("LINE3")->read(); break; - case 3: data |= ioport("LINE4")->read(); break; - } - - return data; -} - - -static ADDRESS_MAP_START( chesstrv_mem, AS_PROGRAM, 8, chesstrv_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE( 0x0000, 0x07ff ) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( chesstrv_io, AS_IO, 8, chesstrv_state ) - AM_RANGE( 0x00, 0x00 ) AM_READWRITE( ram_addr_r, ram_addr_w ) - AM_RANGE( 0x01, 0x01 ) AM_WRITE( display_w ) - AM_RANGE( 0x04, 0x04 ) AM_READWRITE( ram_r, ram_w ) - AM_RANGE( 0x05, 0x05 ) AM_READWRITE( keypad_r, matrix_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( borisdpl_io, AS_IO, 8, chesstrv_state ) - AM_RANGE( 0x00, 0x00 ) AM_READWRITE( diplomat_keypad_r, matrix_w ) - AM_RANGE( 0x01, 0x01 ) AM_WRITE( diplomat_display_w ) - AM_RANGE( 0x04, 0x04 ) AM_READWRITE( ram_r, ram_w ) - AM_RANGE( 0x05, 0x05 ) AM_READWRITE( ram_addr_r, ram_addr_w ) -ADDRESS_MAP_END - -static INPUT_PORTS_START( chesstrv ) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("FP") PORT_CODE(KEYCODE_K) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("EP") PORT_CODE(KEYCODE_O) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CB") PORT_CODE(KEYCODE_Q) - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MM") PORT_CODE(KEYCODE_M) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( borisdpl ) - PORT_START("LINE1") - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B/W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - - PORT_START("LINE2") - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RANK") PORT_CODE(KEYCODE_R) - - PORT_START("LINE3") - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TIME") PORT_CODE(KEYCODE_T) - - PORT_START("LINE4") - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9/SET") PORT_CODE(KEYCODE_S) PORT_CODE(KEYCODE_9) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE") PORT_CODE(KEYCODE_DEL) - -INPUT_PORTS_END - -/* -TIMER_DEVICE_CALLBACK_MEMBER(chesstrv_state::borisdpl_timer_interrupt) -{ - m_maincpu->set_input_line_and_vector(F8_INPUT_LINE_INT_REQ, HOLD_LINE, 0x20); -} -*/ - -void chesstrv_state::machine_start() -{ - m_ram = memregion("ram")->base(); - - save_item(NAME(m_ram_addr)); - save_item(NAME(m_matrix)); -} - -static MACHINE_CONFIG_START( chesstrv, chesstrv_state ) - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", F8, 3000000 ) // Fairchild 3870 - MCFG_CPU_PROGRAM_MAP( chesstrv_mem ) - MCFG_CPU_IO_MAP( chesstrv_io ) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_chesstrv ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( borisdpl, chesstrv_state ) - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", F8, 30000000 ) // Motorola SC80265P - MCFG_CPU_PROGRAM_MAP( chesstrv_mem ) - MCFG_CPU_IO_MAP( borisdpl_io ) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_borisdpl ) - - //MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_interrupt", chesstrv_state, borisdpl_timer_interrupt, attotime::from_hz(40)) -MACHINE_CONFIG_END - - -ROM_START( chesstrv ) - ROM_REGION(0x0800, "maincpu", 0) - ROM_LOAD("3870-sl90387", 0x0000, 0x0800, CRC(b76214d8) SHA1(7760903a64d9c513eb54c4787f535dabec62eb64)) - - ROM_REGION(0x0100, "ram", ROMREGION_ERASE) -ROM_END - -ROM_START( borisdpl ) - ROM_REGION(0x0800, "maincpu", 0) - ROM_LOAD("007-7024-00_7847.u8", 0x0000, 0x0800, CRC(e20bac03) SHA1(9e17b9d90522371fbf7018926356150f70b9a3b6)) - - ROM_REGION(0x0100, "ram", ROMREGION_ERASE) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1980, chesstrv, 0, 0, chesstrv, chesstrv, driver_device, 0, "Acetronic", "Chess Traveller", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) -CONS( 1979, borisdpl, 0, 0, borisdpl, borisdpl, driver_device, 0, "Applied Concepts", "Boris Diplomat", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/clcd.c b/src/mess/drivers/clcd.c deleted file mode 100644 index ed56c2e82ea..00000000000 --- a/src/mess/drivers/clcd.c +++ /dev/null @@ -1,847 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder,smf -/*************************************************************************** - - Commodore LCD prototype - - GTE G65SC102PI-2 - GTE G65SC51P-1 - Rockwell R65C22P2 x 2 - AMI S3530X Bell 103/V.21 Single chip modem - -****************************************************************************/ - - -#include "bus/centronics/ctronics.h" -#include "bus/rs232/rs232.h" -#include "cpu/m6502/m65c02.h" -#include "machine/6522via.h" -#include "machine/bankdev.h" -#include "machine/mos6551.h" -#include "machine/msm58321.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "sound/speaker.h" -#include "rendlay.h" - -class clcd_state : public driver_device -{ -public: - clcd_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_acia(*this, "acia"), - m_via0(*this, "via0"), - m_rtc(*this, "rtc"), - m_centronics(*this, "centronics"), - m_ram(*this,"ram"), - m_nvram(*this, "nvram"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_lcd_char_rom(*this, "lcd_char_rom"), - m_lcd_scrollx(0), - m_lcd_scrolly(0), - m_lcd_mode(0), - m_lcd_size(0), - m_irq_via0(0), - m_irq_via1(0), - m_irq_acia(0), - m_mmu_mode(MMU_MODE_KERN), - m_mmu_saved_mode(MMU_MODE_KERN), - m_mmu_offset1(0), - m_mmu_offset2(0), - m_mmu_offset3(0), - m_mmu_offset4(0), - m_mmu_offset5(0), - m_key_clk(0), - m_key_poll(0), - m_key_column(0), - m_key_shift(0), - m_key_force_format(0), - m_col0(*this, "COL0"), - m_col1(*this, "COL1"), - m_col2(*this, "COL2"), - m_col3(*this, "COL3"), - m_col4(*this, "COL4"), - m_col5(*this, "COL5"), - m_col6(*this, "COL6"), - m_col7(*this, "COL7"), - m_special(*this, "SPECIAL") - { - } - - virtual void driver_start() - { - m_mmu_mode = MMU_MODE_TEST; - update_mmu_mode(MMU_MODE_KERN); - - update_irq(); - - save_item(NAME(m_lcd_scrollx)); - save_item(NAME(m_lcd_scrolly)); - save_item(NAME(m_lcd_mode)); - save_item(NAME(m_lcd_size)); - save_item(NAME(m_mmu_mode)); - save_item(NAME(m_mmu_saved_mode)); - save_item(NAME(m_mmu_offset1)); - save_item(NAME(m_mmu_offset2)); - save_item(NAME(m_mmu_offset3)); - save_item(NAME(m_mmu_offset4)); - save_item(NAME(m_mmu_offset5)); - save_item(NAME(m_key_clk)); - save_item(NAME(m_key_poll)); - save_item(NAME(m_key_column)); - save_item(NAME(m_key_shift)); - - m_rtc->cs1_w(1); - m_acia->write_cts(0); - m_nvram->set_base(ram()->pointer(), ram()->size()); - } - - DECLARE_PALETTE_INIT(clcd) - { - palette.set_pen_color(0, rgb_t(36,72,36)); - palette.set_pen_color(1, rgb_t(2,4,2)); - } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) - { - if (m_lcd_mode & LCD_MODE_GRAPH) - { - for (int y = 0; y < 128; y++) - { - int offset = (m_lcd_scrolly * 128) + (y * 64); - - for (int x = 0; x < 60; x++) - { - UINT8 bit = m_ram->pointer()[offset++]; - - bitmap.pix16(y, (x * 8) + 0) = (bit >> 7) & 1; - bitmap.pix16(y, (x * 8) + 1) = (bit >> 6) & 1; - bitmap.pix16(y, (x * 8) + 2) = (bit >> 5) & 1; - bitmap.pix16(y, (x * 8) + 3) = (bit >> 4) & 1; - bitmap.pix16(y, (x * 8) + 4) = (bit >> 3) & 1; - bitmap.pix16(y, (x * 8) + 5) = (bit >> 2) & 1; - bitmap.pix16(y, (x * 8) + 6) = (bit >> 1) & 1; - bitmap.pix16(y, (x * 8) + 7) = (bit >> 0) & 1; - } - } - } - else - { - UINT8 *font = m_lcd_char_rom->base(); - if (m_lcd_mode & LCD_MODE_ALT) - { - font += 1024; - } - - int chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; - - for (int y = 0; y < 16; y++) - { - int offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + (y * 128); - - for (int x = 0; x < 480; x++) - { - UINT8 ch = m_ram->pointer()[offset + (x / chrw)]; - UINT8 bit = font[((ch & 0x7f) * chrw) + (x % chrw)]; - if (ch & 0x80) - { - bit = ~bit; - } - - bitmap.pix16((y * 8) + 0, x) = (bit >> 0) & 1; - bitmap.pix16((y * 8) + 1, x) = (bit >> 1) & 1; - bitmap.pix16((y * 8) + 2, x) = (bit >> 2) & 1; - bitmap.pix16((y * 8) + 3, x) = (bit >> 3) & 1; - bitmap.pix16((y * 8) + 4, x) = (bit >> 4) & 1; - bitmap.pix16((y * 8) + 5, x) = (bit >> 5) & 1; - bitmap.pix16((y * 8) + 6, x) = (bit >> 6) & 1; - bitmap.pix16((y * 8) + 7, x) = (bit >> 7) & 1; - } - } - } - - return 0; - } - - READ8_MEMBER(ram_r) - { - if (offset < m_ram->size()) - { - return m_ram->pointer()[offset]; - } - - return 0xff; - } - - WRITE8_MEMBER(ram_w) - { - if (offset < m_ram->size()) - { - m_ram->pointer()[offset] = data; - } - } - - enum - { - MMU_MODE_KERN, - MMU_MODE_APPL, - MMU_MODE_RAM, - MMU_MODE_TEST - }; - - enum - { - LCD_MODE_ALT = 1, - LCD_MODE_GRAPH = 2 - }; - - enum - { - LCD_SIZE_CHRW = 4 - }; - - void update_irq() - { - m_maincpu->irq_line(m_irq_via0 | m_irq_via1 | m_irq_acia); - } - - WRITE_LINE_MEMBER(write_irq_via0) - { - m_irq_via0 = state; - update_irq(); - } - - WRITE_LINE_MEMBER(write_irq_via1) - { - m_irq_via1 = state; - update_irq(); - } - - WRITE_LINE_MEMBER(write_irq_acia) - { - m_irq_acia = state; - update_irq(); - } - - void update_mmu_mode(int new_mode) - { - if (m_mmu_mode != new_mode) - { - m_mmu_mode = new_mode; - - switch (m_mmu_mode) - { - case MMU_MODE_KERN: - m_bank1->set_bank(0x04 + 0x00); - update_mmu_offset5(); - m_bank3->set_bank(0x20 + 0xc0); - m_bank4->set_bank(0x30 + 0xc0); - break; - - case MMU_MODE_APPL: - update_mmu_offset1(); - update_mmu_offset2(); - update_mmu_offset3(); - update_mmu_offset4(); - break; - - case MMU_MODE_RAM: - m_bank1->set_bank(0x04); - m_bank2->set_bank(0x10); - m_bank3->set_bank(0x20); - m_bank4->set_bank(0x30); - break; - - case MMU_MODE_TEST: - m_bank1->set_bank(0x04 + 0x200); - m_bank2->set_bank(0x10 + 0x200); - m_bank3->set_bank(0x20 + 0x200); - m_bank4->set_bank(0x30 + 0x200); - break; - } - } - } - - void update_mmu_offset1() - { - if (m_mmu_mode == MMU_MODE_APPL) - { - m_bank1->set_bank(0x04 + m_mmu_offset1); - } - } - - void update_mmu_offset2() - { - if (m_mmu_mode == MMU_MODE_APPL) - { - m_bank2->set_bank((0x10 + m_mmu_offset2) & 0xff); - } - } - - void update_mmu_offset3() - { - if (m_mmu_mode == MMU_MODE_APPL) - { - m_bank3->set_bank((0x20 + m_mmu_offset3) & 0xff); - } - } - - void update_mmu_offset4() - { - if (m_mmu_mode == MMU_MODE_APPL) - { - m_bank4->set_bank((0x30 + m_mmu_offset4) & 0xff); - } - } - - void update_mmu_offset5() - { - if (m_mmu_mode == MMU_MODE_KERN) - { - m_bank2->set_bank((0x10 + m_mmu_offset5) & 0xff); - } - } - - WRITE8_MEMBER(mmu_mode_kern_w) - { - update_mmu_mode(MMU_MODE_KERN); - } - - WRITE8_MEMBER(mmu_mode_appl_w) - { - update_mmu_mode(MMU_MODE_APPL); - } - - WRITE8_MEMBER(mmu_mode_ram_w) - { - update_mmu_mode(MMU_MODE_RAM); - } - - WRITE8_MEMBER(mmu_mode_recall_w) - { - update_mmu_mode(m_mmu_saved_mode); - } - - WRITE8_MEMBER(mmu_mode_save_w) - { - m_mmu_saved_mode = m_mmu_mode; - } - - WRITE8_MEMBER(mmu_mode_test_w) - { - update_mmu_mode(MMU_MODE_TEST); - } - - WRITE8_MEMBER(mmu_offset1_w) - { - if (m_mmu_offset1 != data) - { - m_mmu_offset1 = data; - update_mmu_offset1(); - } - } - - WRITE8_MEMBER(mmu_offset2_w) - { - if (m_mmu_offset2 != data) - { - m_mmu_offset2 = data; - update_mmu_offset2(); - } - } - - WRITE8_MEMBER(mmu_offset3_w) - { - if (m_mmu_offset3 != data) - { - m_mmu_offset3 = data; - update_mmu_offset3(); - } - } - - WRITE8_MEMBER(mmu_offset4_w) - { - if (m_mmu_offset4 != data) - { - m_mmu_offset4 = data; - update_mmu_offset4(); - } - } - - WRITE8_MEMBER(mmu_offset5_w) - { - if (m_mmu_offset5 != data) - { - m_mmu_offset5 = data; - update_mmu_offset5(); - } - } - - READ8_MEMBER(mmu_offset1_r) - { - return m_mmu_offset1; - } - - READ8_MEMBER(mmu_offset2_r) - { - return m_mmu_offset2; - } - - READ8_MEMBER(mmu_offset3_r) - { - return m_mmu_offset3; - } - - READ8_MEMBER(mmu_offset4_r) - { - return m_mmu_offset4; - } - - READ8_MEMBER(mmu_offset5_r) - { - return m_mmu_offset5; - } - - WRITE8_MEMBER(lcd_scrollx_w) - { - m_lcd_scrollx = data; - } - - WRITE8_MEMBER(lcd_scrolly_w) - { - m_lcd_scrolly = data; - } - - WRITE8_MEMBER(lcd_mode_w) - { - m_lcd_mode = data; - } - - WRITE8_MEMBER(lcd_size_w) - { - m_lcd_size = data; - } - - WRITE8_MEMBER(via0_pa_w) - { - m_key_column = data; - } - - int read_column(int column) - { - switch (column) - { - case 0: - return m_col0->read(); - - case 1: - return m_col1->read(); - - case 2: - return m_col2->read(); - - case 3: - return m_col3->read(); - - case 4: - return m_col4->read(); - - case 5: - return m_col5->read(); - - case 6: - return m_col6->read(); - - case 7: - return m_col7->read(); - } - - return 0; - } - - WRITE8_MEMBER(via0_pb_w) - { - write_key_poll((data >> 0) & 1); - m_rtc->cs2_w((data >> 1) & 1); - } - - WRITE_LINE_MEMBER(write_key_poll) - { - if (m_key_poll != state) - { - m_key_poll = state; - - if (m_key_poll != 0) - { - m_key_shift = m_special->read(); - - for (int i = 0; i < 8; i++) - { - if ((m_key_column & (128 >> i)) == 0) - { - m_key_shift |= read_column(i) << 8; - } - } - - if (m_key_force_format) - { - m_key_shift = 0x15; // Simulate holding CBM+SHIFT+STOP if you have no NVRAM - - m_key_force_format--; - } - } - } - } - - WRITE_LINE_MEMBER(via0_cb1_w) - { - int newm_key_clk = state & 1; - if (m_key_clk != newm_key_clk) - { - m_key_clk = newm_key_clk; - - if (!m_key_clk) - { - m_via0->write_cb2((m_key_shift & 0x8000) != 0); - m_key_shift <<= 1; - } - } - } - - WRITE8_MEMBER(via1_pa_w) - { - m_rtc->d0_w(BIT(data, 0)); - m_centronics->write_data0(BIT(data, 0)); - - m_rtc->d1_w(BIT(data, 1)); - m_centronics->write_data1(BIT(data, 1)); - - m_rtc->d2_w(BIT(data, 2)); - m_centronics->write_data2(BIT(data, 2)); - - m_rtc->d3_w(BIT(data, 3)); - m_centronics->write_data3(BIT(data, 3)); - - m_rtc->read_w(BIT(data, 4)); - m_centronics->write_data4(BIT(data, 4)); - - m_rtc->write_w(BIT(data, 5)); - m_centronics->write_data5(BIT(data, 5)); - - m_rtc->address_write_w(BIT(data, 6)); - m_centronics->write_data6(BIT(data, 6)); - - m_centronics->write_data7(BIT(data, 7)); - } - - WRITE8_MEMBER(via1_pb_w) - { - //int centronics_unknown = !BIT(data,5); - } - - ram_device *ram() - { - return m_ram; - } - - void force_format() - { - m_key_force_format = 10; - } - - void nvram_init(nvram_device &nvram, void *data, size_t size); - -private: - required_device m_maincpu; - required_device m_acia; - required_device m_via0; - required_device m_rtc; - required_device m_centronics; - required_device m_ram; - required_device m_nvram; - required_device m_bank1; - required_device m_bank2; - required_device m_bank3; - required_device m_bank4; - required_memory_region m_lcd_char_rom; - int m_lcd_scrollx; - int m_lcd_scrolly; - int m_lcd_mode; - int m_lcd_size; - int m_irq_via0; - int m_irq_via1; - int m_irq_acia; - int m_mmu_mode; - int m_mmu_saved_mode; - UINT8 m_mmu_offset1; - UINT8 m_mmu_offset2; - UINT8 m_mmu_offset3; - UINT8 m_mmu_offset4; - UINT8 m_mmu_offset5; - int m_key_clk; - int m_key_poll; - int m_key_column; - UINT16 m_key_shift; - int m_key_force_format; - required_ioport m_col0; - required_ioport m_col1; - required_ioport m_col2; - required_ioport m_col3; - required_ioport m_col4; - required_ioport m_col5; - required_ioport m_col6; - required_ioport m_col7; - required_ioport m_special; -}; - -void clcd_state::nvram_init(nvram_device &nvram, void *data, size_t size) -{ - memset(data, 0x00, size); - force_format(); -} - - -static ADDRESS_MAP_START( clcd_banked_mem, AS_PROGRAM, 8, clcd_state ) - /* KERN/APPL/RAM */ - AM_RANGE(0x00000, 0x1ffff) AM_MIRROR(0x40000) AM_READWRITE(ram_r, ram_w) - AM_RANGE(0x20000, 0x3ffff) AM_MIRROR(0x40000) AM_ROM AM_REGION("maincpu",0) - - /* TEST */ - AM_RANGE(0x81000, 0x83fff) AM_READ(mmu_offset1_r) - AM_RANGE(0x84000, 0x87fff) AM_READ(mmu_offset2_r) - AM_RANGE(0x88000, 0x8bfff) AM_READ(mmu_offset3_r) - AM_RANGE(0x8c000, 0x8dfff) AM_READ(mmu_offset4_r) - AM_RANGE(0x8e000, 0x8f7ff) AM_READ(mmu_offset5_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( clcd_mem, AS_PROGRAM, 8, clcd_state ) - AM_RANGE(0x0000, 0x0fff) AM_READWRITE(ram_r, ram_w) - AM_RANGE(0x1000, 0x3fff) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) - AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("bank2", address_map_bank_device, read8, write8) - AM_RANGE(0x8000, 0xbfff) AM_DEVREADWRITE("bank3", address_map_bank_device, read8, write8) - AM_RANGE(0xc000, 0xf7ff) AM_DEVREADWRITE("bank4", address_map_bank_device, read8, write8) - AM_RANGE(0xf800, 0xf80f) AM_MIRROR(0x70) AM_DEVREADWRITE("via0", via6522_device, read, write) - AM_RANGE(0xf880, 0xf88f) AM_MIRROR(0x70) AM_DEVREADWRITE("via1", via6522_device, read, write) - AM_RANGE(0xf980, 0xf983) AM_MIRROR(0x7c) AM_DEVREADWRITE("acia", mos6551_device, read, write) - AM_RANGE(0xfa00, 0xffff) AM_ROM AM_REGION("maincpu", 0x1fa00) - AM_RANGE(0xfa00, 0xfa00) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_kern_w) - AM_RANGE(0xfa80, 0xfa80) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_appl_w) - AM_RANGE(0xfb00, 0xfb00) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_ram_w) - AM_RANGE(0xfb80, 0xfb80) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_recall_w) - AM_RANGE(0xfc00, 0xfc00) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_save_w) - AM_RANGE(0xfc80, 0xfc80) AM_MIRROR(0x7f) AM_WRITE(mmu_mode_test_w) - AM_RANGE(0xfd00, 0xfd00) AM_MIRROR(0x7f) AM_WRITE(mmu_offset1_w) - AM_RANGE(0xfd80, 0xfd80) AM_MIRROR(0x7f) AM_WRITE(mmu_offset2_w) - AM_RANGE(0xfe00, 0xfe00) AM_MIRROR(0x7f) AM_WRITE(mmu_offset3_w) - AM_RANGE(0xfe80, 0xfe80) AM_MIRROR(0x7f) AM_WRITE(mmu_offset4_w) - AM_RANGE(0xff00, 0xff00) AM_MIRROR(0x7f) AM_WRITE(mmu_offset5_w) - AM_RANGE(0xff80, 0xff80) AM_MIRROR(0x7c) AM_WRITE(lcd_scrollx_w) - AM_RANGE(0xff81, 0xff81) AM_MIRROR(0x7c) AM_WRITE(lcd_scrolly_w) - AM_RANGE(0xff82, 0xff82) AM_MIRROR(0x7c) AM_WRITE(lcd_mode_w) - AM_RANGE(0xff83, 0xff83) AM_MIRROR(0x7c) AM_WRITE(lcd_size_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( clcd ) - PORT_START( "COL0" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') - - PORT_START( "COL1" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START( "COL2" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": [") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START( "COL3" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START( "COL4" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START( "COL5" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - - PORT_START( "COL6" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("*") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - - PORT_START( "COL7" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL INST") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('\b') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START( "SPECIAL" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // clears screen and goes into infinite loop - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // clears screen and goes into infinite loop -INPUT_PORTS_END - -static MACHINE_CONFIG_START(clcd, clcd_state) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M65C02, 2000000) - MCFG_CPU_PROGRAM_MAP(clcd_mem) - - MCFG_DEVICE_ADD("via0", VIA6522, 2000000) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(clcd_state, via0_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(clcd_state, via0_pb_w)) - MCFG_VIA6522_CB1_HANDLER(WRITELINE(clcd_state, via0_cb1_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(clcd_state, write_irq_via0)) - - MCFG_DEVICE_ADD("via1", VIA6522, 2000000) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(clcd_state, via1_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(clcd_state, via1_pb_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(clcd_state, write_irq_via1)) - MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) MCFG_DEVCB_XOR(1) - MCFG_VIA6522_CB2_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) - - MCFG_DEVICE_ADD("acia", MOS6551, 2000000) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(clcd_state, write_irq_acia)) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("via1", via6522_device, write_pb4)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, NULL) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("via1", via6522_device, write_pb6)) MCFG_DEVCB_XOR(1) - - MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) - - MCFG_DEVICE_ADD("bank2", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) - - MCFG_DEVICE_ADD("bank3", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) - - MCFG_DEVICE_ADD("bank4", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) - - MCFG_DEVICE_ADD("rtc", MSM58321, XTAL_32_768kHz) - MCFG_MSM58321_D0_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa0)) - MCFG_MSM58321_D1_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa1)) - MCFG_MSM58321_D2_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa2)) - MCFG_MSM58321_D3_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa3)) - MCFG_MSM58321_BUSY_HANDLER(DEVWRITELINE("via1", via6522_device, write_pa7)) - MCFG_MSM58321_YEAR0(1984) - MCFG_MSM58321_DEFAULT_24H(true) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(80) - MCFG_SCREEN_UPDATE_DRIVER(clcd_state, screen_update) - MCFG_SCREEN_SIZE(480, 128) - MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 128-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(clcd_state, clcd) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_RAM_ADD("ram") - MCFG_RAM_DEFAULT_VALUE(0) - MCFG_RAM_EXTRA_OPTIONS("32k,64k") - MCFG_RAM_DEFAULT_SIZE("128k") - - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", clcd_state, nvram_init) -MACHINE_CONFIG_END - - -ROM_START( clcd ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "ss-calc-13apr.u105", 0x00000, 0x8000, CRC(88a587a7) SHA1(b08f3169b7cd696bb6a9b6e6e87a077345377ac4)) - ROM_LOAD( "sept-m-13apr.u104", 0x08000, 0x8000, CRC(41028c3c) SHA1(fcab6f0bbeef178eb8e5ecf82d9c348d8f318a8f)) - ROM_LOAD( "sizapr.u103", 0x10000, 0x8000, CRC(0aa91d9f) SHA1(f0842f370607f95d0a0ec6afafb81bc063c32745)) - ROM_LOAD( "kizapr.u102", 0x18000, 0x8000, CRC(59103d52) SHA1(e49c20b237a78b54c2cb26b133d5903bb60bd8ef)) - - ROM_REGION( 0x20000, "lcd_char_rom", 0 ) - ROM_LOAD( "lcd_char_rom", 0x000000, 0x000800, BAD_DUMP CRC(7db9d225) SHA1(0a8835fa182efa55d027828b42aa554608795274) ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, clcd, 0, 0, clcd, clcd, driver_device, 0, "Commodore Business Machines", "LCD (Prototype)", 0 ) diff --git a/src/mess/drivers/cm1800.c b/src/mess/drivers/cm1800.c deleted file mode 100644 index a02bd552daa..00000000000 --- a/src/mess/drivers/cm1800.c +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - CM-1800 - (note name is in cyrilic letters) - - more info at http://ru.wikipedia.org/wiki/%D0%A1%D0%9C_%D0%AD%D0%92%D0%9C - and http://sapr.lti-gti.ru/index.php?id=66 - - 26/04/2011 Skeleton driver. - -Commands: -C Compare -D Dump -F Fill -G -I -L -M Move -S Edit -T -X Registers - -For most commands, enter all 4 digits of each hex address, the system will -add the appropriate spacing as you type. No need to press Enter. - -The L command looks like it might be for loading a file, for example -L ABC will read/write to port 70,71,73 and eventually time out if you wait -a while. No idea if it wants to read a disk or a tape. There doesn't seem -to be a save command. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class cm1800_state : public driver_device -{ -public: - cm1800_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_terminal(*this, TERMINAL_TAG) , - m_maincpu(*this, "maincpu") - { - } - - DECLARE_READ8_MEMBER( term_status_r ); - DECLARE_READ8_MEMBER( term_r ); - DECLARE_WRITE8_MEMBER( kbd_put ); - UINT8 m_term_data; - - required_device m_terminal; - virtual void machine_reset(); - required_device m_maincpu; -}; - -READ8_MEMBER( cm1800_state::term_status_r ) -{ - return (m_term_data) ? 5 : 4; -} - -READ8_MEMBER( cm1800_state::term_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( cm1800_state::kbd_put ) -{ - m_term_data = data; -} - -static ADDRESS_MAP_START(cm1800_mem, AS_PROGRAM, 8, cm1800_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff ) AM_ROM - AM_RANGE( 0x0800, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cm1800_io , AS_IO, 8, cm1800_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_READ(term_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x01, 0x01) AM_READ(term_status_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( cm1800 ) -INPUT_PORTS_END - - -void cm1800_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( cm1800, cm1800_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(cm1800_mem) - MCFG_CPU_IO_MAP(cm1800_io) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(cm1800_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( cm1800 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "cm1800.rom", 0x0000, 0x0800, CRC(85d71d25) SHA1(42dc87d2eddc2906fa26d35db88a2e29d50fb481) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, cm1800, 0, 0, cm1800, cm1800, driver_device, 0, "", "CM-1800", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/coco12.c b/src/mess/drivers/coco12.c deleted file mode 100644 index 7ed66f1b9f2..00000000000 --- a/src/mess/drivers/coco12.c +++ /dev/null @@ -1,447 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco12.c - - TRS-80 Radio Shack Color Computer 1/2 - - Mathis Rosenhauer (original driver) - Nate Woods (current maintainer) - Tim Lindner (VHD and other work) - - Version information: - - Basic Extended Basic Disk Extended - coco 1.0 - - - cocoe 1.1 1.0 1.0 - coco2 1.2 1.1 1.1 - coco2b 1.3 1.1 1.1 - coco3 1.2 2.0 1.1 - coco3p 1.2 2.0 1.1 - coco3h 1.2 2.0 1.1 - -***************************************************************************/ - -#include "includes/coco12.h" -#include "imagedev/cassette.h" -#include "cpu/m6809/m6809.h" -#include "bus/coco/coco_232.h" -#include "bus/coco/coco_orch90.h" -#include "bus/coco/coco_pak.h" -#include "bus/coco/coco_fdc.h" -#include "bus/coco/coco_multi.h" -#include "bus/coco/coco_dwsock.h" -#include "formats/coco_cas.h" - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( coco_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( coco_mem, AS_PROGRAM, 8, coco_state ) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//-------------------------------------------------------------------------- -// INPUT_PORTS( coco_analog_control ) -// -// Other CoCo controllers were compatible with the Dragon, even if no -// software is known to make use of them We add them here, based on this -// compatibility, in case anyone wants to use them in homebrew software -//-------------------------------------------------------------------------- - -INPUT_PORTS_START( coco_analog_control ) - PORT_START(CTRL_SEL_TAG) /* Select Controller Type */ - PORT_CONFNAME( 0x0f, 0x01, "Right Controller Port (P1)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco_state, joystick_mode_changed, 0 ) - PORT_CONFSETTING( 0x00, "Unconnected" ) - PORT_CONFSETTING( 0x01, "Joystick" ) - PORT_CONFSETTING( 0x02, "The Rat Graphics Mouse" ) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, NOTEQUALS, 0x20) - PORT_CONFSETTING( 0x03, "Diecom Light Gun Adaptor" ) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, NOTEQUALS, 0x30) - PORT_CONFNAME( 0xf0, 0x10, "Left Controller Port (P2)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco_state, joystick_mode_changed, 0 ) - PORT_CONFSETTING( 0x00, "Unconnected" ) - PORT_CONFSETTING( 0x10, "Joystick" ) - PORT_CONFSETTING( 0x20, "The Rat Graphics Mouse" ) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, NOTEQUALS, 0x02) - PORT_CONFSETTING( 0x30, "Diecom Light Gun Adaptor" ) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, NOTEQUALS, 0x03) - - PORT_START(HIRES_INTF_TAG) - PORT_CONFNAME( 0x07, 0x00, "Hi-Res Joystick Interfaces" ) - PORT_CONFSETTING( 0x00, "None" ) - PORT_CONFSETTING( 0x01, "Hi-Res in Right Port" ) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_CONFSETTING( 0x02, "Hi-Res CoCoMax 3 Style in Right Port" ) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_CONFSETTING( 0x03, "Hi-Res in Left Port" ) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) - PORT_CONFSETTING( 0x04, "Hi-Res CoCoMax 3 Style in Left Port" ) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco_joystick ) -//------------------------------------------------- - -static INPUT_PORTS_START( coco_joystick ) - PORT_START(JOYSTICK_RX_TAG) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_START(JOYSTICK_RY_TAG) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_START(JOYSTICK_LX_TAG) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) - PORT_START(JOYSTICK_LY_TAG) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) - PORT_START(JOYSTICK_BUTTONS_TAG) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Right Button") PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left Button") PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco_cart_autostart ) -//------------------------------------------------- - -INPUT_PORTS_START( coco_cart_autostart ) - PORT_START(CART_AUTOSTART_TAG) - PORT_CONFNAME( 0x01, 0x01, "Cart Auto-Start" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off )) - PORT_CONFSETTING( 0x01, DEF_STR( On )) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco_beckerport ) -//------------------------------------------------- - -INPUT_PORTS_START( coco_beckerport ) - PORT_START(BECKERPORT_TAG) - PORT_CONFNAME( 0x01, 0x01, "Becker Port" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off )) - PORT_CONFSETTING( 0x01, DEF_STR( On )) -INPUT_PORTS_END - -//------------------------------------------------- -// INPUT_PORTS( coco_rtc ) -//------------------------------------------------- - -INPUT_PORTS_START( coco_rtc ) - PORT_START("real_time_clock") - PORT_CONFNAME( 0x03, 0x00, "Real Time Clock" ) - PORT_CONFSETTING( 0x00, "Disto" ) - PORT_CONFSETTING( 0x01, "Cloud-9" ) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco_keyboard ) -//------------------------------------------------- -// -// CoCo keyboard -// -// PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 -// PA6: Ent Clr Brk N/c N/c N/c N/c Shift -// PA5: 8 9 : ; , - . / -// PA4: 0 1 2 3 4 5 6 7 -// PA3: X Y Z Up Dwn Lft Rgt Space -// PA2: P Q R S T U V W -// PA1: H I J K L M N O -// PA0: @ A B C D E F G -//------------------------------------------------- - -static INPUT_PORTS_START( coco_keyboard ) - PORT_START("row0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("row1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("row2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("row3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("row4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("row5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("row6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x78, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco12_state, coco_state::keyboard_changed, NULL) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco ) -//------------------------------------------------- - -static INPUT_PORTS_START( coco ) - PORT_INCLUDE( coco_keyboard ) - PORT_INCLUDE( coco_joystick ) - PORT_INCLUDE( coco_analog_control ) - PORT_INCLUDE( coco_cart_autostart ) - PORT_INCLUDE( coco_rtc ) - PORT_INCLUDE( coco_beckerport ) -INPUT_PORTS_END - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// SLOT_INTERFACE_START(coco_cart) -//------------------------------------------------- - -SLOT_INTERFACE_START( coco_cart ) - SLOT_INTERFACE("fdc", COCO_FDC) - SLOT_INTERFACE("fdcv11", COCO_FDC_V11) - SLOT_INTERFACE("cc3hdb1", COCO3_HDB1) - SLOT_INTERFACE("cp400_fdc", CP400_FDC) - SLOT_INTERFACE("rs232", COCO_232) - SLOT_INTERFACE("orch90", COCO_ORCH90) - SLOT_INTERFACE("banked_16k", COCO_PAK_BANKED) - SLOT_INTERFACE("pak", COCO_PAK) - SLOT_INTERFACE("multi", COCO_MULTIPAK) -SLOT_INTERFACE_END - - - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( coco_sound ) -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( coco_sound ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(DAC_TAG, DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - -static DEVICE_INPUT_DEFAULTS_START( printer ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -//------------------------------------------------- -// MACHINE_CONFIG -//------------------------------------------------- - -static MACHINE_CONFIG_START( coco, coco12_state ) - // basic machine hardware - MCFG_CPU_ADD(MAINCPU_TAG, M6809E, XTAL_3_579545MHz) - MCFG_CPU_PROGRAM_MAP(coco_mem) - - // devices - MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia0_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia0_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia0_irq_b)) - - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(coco_state, pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(coco_state, pia1_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia1_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia1_firq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia1_firq_b)) - - MCFG_SAM6883_ADD(SAM_TAG, XTAL_3_579545MHz, MAINCPU_TAG, AS_PROGRAM) - MCFG_SAM6883_RES_CALLBACK(READ8(coco12_state, sam_read)) - - // Becker Port device - MCFG_DEVICE_ADD(DWSOCK_TAG, COCO_DWSOCK, 0) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(coco_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "printer") - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(PIA1_TAG, pia6821_device, ca1_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("printer", printer) - - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "pak") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) - - // video hardware - MCFG_SCREEN_MC6847_NTSC_ADD(SCREEN_TAG, VDG_TAG) - - MCFG_DEVICE_ADD(VDG_TAG, MC6847_NTSC, XTAL_3_579545MHz) - MCFG_MC6847_HSYNC_CALLBACK(WRITELINE(coco12_state, horizontal_sync)) - MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(coco12_state, field_sync)) - MCFG_MC6847_INPUT_CALLBACK(DEVREAD8(SAM_TAG, sam6883_device, display_read)) - - // sound hardware - MCFG_FRAGMENT_ADD( coco_sound ) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("4K,16K,32K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( cocoe, coco ) - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) - MCFG_COCO_VHD_ADD(VHD0_TAG) - MCFG_COCO_VHD_ADD(VHD1_TAG) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( coco2, coco ) - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdcv11") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) - MCFG_COCO_VHD_ADD(VHD0_TAG) - MCFG_COCO_VHD_ADD(VHD1_TAG) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( coco2b, coco2 ) - MCFG_DEVICE_REMOVE(VDG_TAG) - MCFG_DEVICE_ADD(VDG_TAG, MC6847T1_NTSC, XTAL_3_579545MHz) - MCFG_MC6847_HSYNC_CALLBACK(WRITELINE(coco12_state, horizontal_sync)) - MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(coco12_state, field_sync)) - MCFG_MC6847_INPUT_CALLBACK(DEVREAD8(SAM_TAG, sam6883_device, display_read)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( cp400, coco ) - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "cp400_fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) -MACHINE_CONFIG_END - - -//************************************************************************** -// ROMS -//************************************************************************** - -ROM_START(coco) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("bas10.rom", 0x2000, 0x2000, CRC(00b50aaa) SHA1(1f08455cd48ce6a06132aea15c4778f264e19539)) -ROM_END - -ROM_START(cocoe) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("bas11.rom", 0x2000, 0x2000, CRC(6270955a) SHA1(cecb7c24ff1e0ab5836e4a7a8eb1b8e01f1fded3)) - ROM_LOAD("extbas10.rom", 0x0000, 0x2000, CRC(6111a086) SHA1(8aa58f2eb3e8bcfd5470e3e35e2b359e9a72848e)) -ROM_END - -ROM_START(coco2) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("bas12.rom", 0x2000, 0x2000, CRC(54368805) SHA1(0f14dc46c647510eb0b7bd3f53e33da07907d04f)) - ROM_LOAD("extbas11.rom", 0x0000, 0x2000, CRC(a82a6254) SHA1(ad927fb4f30746d820cb8b860ebb585e7f095dea)) -ROM_END - -ROM_START(coco2b) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("bas13.rom", 0x2000, 0x2000, CRC(d8f4d15e) SHA1(28b92bebe35fa4f026a084416d6ea3b1552b63d3)) - ROM_LOAD("extbas11.rom", 0x0000, 0x2000, CRC(a82a6254) SHA1(ad927fb4f30746d820cb8b860ebb585e7f095dea)) -ROM_END - -ROM_START(cp400) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("cp400bas.rom", 0x0000, 0x4000, CRC(878396a5) SHA1(292c545da3c77978e043b00a3dbc317201d18c3b)) -ROM_END - -ROM_START(mx1600 ) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("mx1600bas.rom", 0x2000, 0x2000, CRC(d918156e) SHA1(70a464edf3a654ed4ffe687e6dee4f0d2acc758b)) - ROM_LOAD("mx1600extbas.rom", 0x0000, 0x2000, CRC(322a3d58) SHA1(9079a477c3f22e46cebb1e68b61df5bd607c71a4)) -ROM_END - -ROM_START(lzcolor64 ) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("color64bas.rom", 0x2000, 0x2000, CRC(b0717d71) SHA1(ad1beef9d6f095ada69f91d0b8ad75985172d86f)) - ROM_LOAD("color64extbas.rom", 0x0000, 0x2000, CRC(d1b1560d) SHA1(7252de9df405ade453282e992eb1f1910adc8e50)) -ROM_END - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1980, coco, 0, 0, coco, coco, driver_device, 0, "Tandy Radio Shack", "Color Computer", 0) -COMP( 1981, cocoe, coco, 0, cocoe, coco, driver_device, 0, "Tandy Radio Shack", "Color Computer (Extended BASIC 1.0)", 0) -COMP( 1983, coco2, coco, 0, coco2, coco, driver_device, 0, "Tandy Radio Shack", "Color Computer 2", 0) -COMP( 1985?, coco2b, coco, 0, coco2b, coco, driver_device, 0, "Tandy Radio Shack", "Color Computer 2B", 0) -COMP( 1984, cp400, coco, 0, cp400, coco, driver_device, 0, "Prologica", "CP400", 0) -COMP( 1984, lzcolor64, coco, 0, coco, coco, driver_device, 0, "Digiponto", "LZ Color64", 0) -COMP( 1984, mx1600, coco, 0, coco, coco, driver_device, 0, "Dynacom", "MX-1600", 0) diff --git a/src/mess/drivers/coco3.c b/src/mess/drivers/coco3.c deleted file mode 100644 index 8023151718f..00000000000 --- a/src/mess/drivers/coco3.c +++ /dev/null @@ -1,375 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco3.c - - TRS-80 Radio Shack Color Computer 3 - - Mathis Rosenhauer (original driver) - Nate Woods (current maintainer) - Tim Lindner (VHD and other work) - -***************************************************************************/ - -#include "includes/coco3.h" -#include "cpu/m6809/m6809.h" -#include "cpu/m6809/hd6309.h" -#include "formats/coco_cas.h" -#include "coco3.lh" - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( coco3_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( coco3_mem, AS_PROGRAM, 8, coco3_state ) - AM_RANGE(0x0000, 0x1FFF) AM_READ_BANK("rbank0") AM_WRITE_BANK("wbank0") - AM_RANGE(0x2000, 0x3FFF) AM_READ_BANK("rbank1") AM_WRITE_BANK("wbank1") - AM_RANGE(0x4000, 0x5FFF) AM_READ_BANK("rbank2") AM_WRITE_BANK("wbank2") - AM_RANGE(0x6000, 0x7FFF) AM_READ_BANK("rbank3") AM_WRITE_BANK("wbank3") - AM_RANGE(0x8000, 0x9FFF) AM_READ_BANK("rbank4") AM_WRITE_BANK("wbank4") - AM_RANGE(0xA000, 0xBFFF) AM_READ_BANK("rbank5") AM_WRITE_BANK("wbank5") - AM_RANGE(0xC000, 0xDFFF) AM_READ_BANK("rbank6") AM_WRITE_BANK("wbank6") - AM_RANGE(0xE000, 0xFDFF) AM_READ_BANK("rbank7") AM_WRITE_BANK("wbank7") - AM_RANGE(0xFE00, 0xFEFF) AM_READ_BANK("rbank8") AM_WRITE_BANK("wbank8") - AM_RANGE(0xFF00, 0xFF1F) AM_READWRITE(ff00_read, ff00_write) - AM_RANGE(0xFF20, 0xFF3F) AM_READWRITE(ff20_read, ff20_write) - AM_RANGE(0xFF40, 0xFF5F) AM_READWRITE(ff40_read, ff40_write) - AM_RANGE(0xFF60, 0xFF8F) AM_READWRITE(ff60_read, ff60_write) - AM_RANGE(0xFF90, 0xFFDF) AM_DEVREADWRITE(GIME_TAG, gime_base_device, read, write) - - // While Tepolt and other sources say that the interrupt vectors are mapped to - // the same memory accessed at $BFFx, William Astle offered evidence that this - // memory on a CoCo 3 is not the same. - // - // http://lost.l-w.ca/0x05/coco3-and-interrupt-vectors/ - AM_RANGE(0xFFE0, 0xFFFF) AM_ROM AM_REGION(MAINCPU_TAG, 0x7FE0) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( coco3_keyboard ) -//------------------------------------------------- -// -// CoCo 3 keyboard -// -// PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 -// PA6: Ent Clr Brk Alt Ctr F1 F2 Shift -// PA5: 8 9 : ; , - . / -// PA4: 0 1 2 3 4 5 6 7 -// PA3: X Y Z Up Dwn Lft Rgt Space -// PA2: P Q R S T U V W -// PA1: H I J K L M N O -// PA0: @ A B C D E F G -//------------------------------------------------- - -static INPUT_PORTS_START( coco3_keyboard ) - PORT_START("row0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("row1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("row2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("row3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("row4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("row5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("row6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco3_joystick ) -//------------------------------------------------- - -static INPUT_PORTS_START( coco3_joystick ) - PORT_START(JOYSTICK_RX_TAG) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_START(JOYSTICK_RY_TAG) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_START(JOYSTICK_LX_TAG) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_4_PAD) PORT_CODE_INC(KEYCODE_6_PAD) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) - PORT_START(JOYSTICK_LY_TAG) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0x00,0xFF) PORT_CODE_DEC(KEYCODE_8_PAD) PORT_CODE_INC(KEYCODE_2_PAD) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) - PORT_START(JOYSTICK_BUTTONS_TAG) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Right Button 1") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Right Button 1") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x01) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left Button 1") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Left Button 1") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x10) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco_rat_mouse ) -//------------------------------------------------- - -static INPUT_PORTS_START( coco_rat_mouse ) - PORT_START(RAT_MOUSE_RX_TAG) - PORT_BIT( 0x03, 0x00, IPT_MOUSE_X) PORT_NAME("Rat Mouse X (Right Port)") PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x02) - PORT_START(RAT_MOUSE_RY_TAG) - PORT_BIT( 0x03, 0x00, IPT_MOUSE_Y) PORT_NAME("Rat Mouse Y (Right Port)") PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x02) - PORT_START(RAT_MOUSE_LX_TAG) - PORT_BIT( 0x03, 0x00, IPT_MOUSE_X) PORT_NAME("Rat Mouse X (Left Port)") PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x20) - PORT_START(RAT_MOUSE_LY_TAG) - PORT_BIT( 0x03, 0x00, IPT_MOUSE_Y) PORT_NAME("Rat Mouse Y (Left Port)") PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x20) - PORT_START(RAT_MOUSE_BUTTONS_TAG) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Rat Mouse Button 1 (Right Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x02) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Rat Mouse Button 2 (Right Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x02) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Rat Mouse Button 1 (Left Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x20) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Rat Mouse Button 2 (Left Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x20) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco_lightgun ) -//------------------------------------------------- - -static INPUT_PORTS_START( coco_lightgun ) - PORT_START(DIECOM_LIGHTGUN_RX_TAG) - PORT_BIT( 0x1ff, 266, IPT_LIGHTGUN_X ) PORT_NAME("Lightgun X (Right Port)") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(116,416) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x03) - PORT_START(DIECOM_LIGHTGUN_RY_TAG) - PORT_BIT( 0xff, 121, IPT_LIGHTGUN_Y ) PORT_NAME("Lightgun Y (Right Port)") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0,242) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x03) - PORT_START(DIECOM_LIGHTGUN_LX_TAG) - PORT_BIT( 0x1ff, 266, IPT_LIGHTGUN_X ) PORT_NAME("Lightgun X (Left Port)") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(116,416) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x30) - PORT_START(DIECOM_LIGHTGUN_LY_TAG) - PORT_BIT( 0xff, 121, IPT_LIGHTGUN_Y ) PORT_NAME("Lightgun Y (Left Port)") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0,242) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x30) - PORT_START(DIECOM_LIGHTGUN_BUTTONS_TAG) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightgun Trigger (Right Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION(CTRL_SEL_TAG, 0x0f, EQUALS, 0x03) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightgun Trigger (Left Port)") PORT_CHANGED_MEMBER(DEVICE_SELF, coco3_state, coco_state::keyboard_changed, NULL) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION(CTRL_SEL_TAG, 0xf0, EQUALS, 0x30) -INPUT_PORTS_END - - - -//------------------------------------------------- -// INPUT_PORTS( coco3 ) -//------------------------------------------------- - -static INPUT_PORTS_START( coco3 ) - PORT_INCLUDE( coco3_keyboard ) - PORT_INCLUDE( coco3_joystick ) - PORT_INCLUDE( coco_analog_control ) - PORT_INCLUDE( coco_cart_autostart ) - PORT_INCLUDE( coco_rat_mouse ) - PORT_INCLUDE( coco_lightgun ) - PORT_INCLUDE( coco_rtc ) - PORT_INCLUDE( coco_beckerport ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START( printer ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -static MACHINE_CONFIG_START( coco3, coco3_state ) - // basic machine hardware - MCFG_CPU_ADD(MAINCPU_TAG, M6809E, XTAL_3_579545MHz) - MCFG_CPU_PROGRAM_MAP(coco3_mem) - - // devices - MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia0_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia0_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia0_irq_b)) - - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(coco_state, pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(coco_state, pia1_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia1_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia1_firq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia1_firq_b)) - - // Becker Port device - MCFG_DEVICE_ADD(DWSOCK_TAG, COCO_DWSOCK, 0) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(coco_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "printer") - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(PIA1_TAG, pia6821_device, ca1_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("printer", printer) - - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdcv11") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) - - MCFG_COCO_VHD_ADD(VHD0_TAG) - MCFG_COCO_VHD_ADD(VHD1_TAG) - - // video hardware - MCFG_DEFAULT_LAYOUT(layout_coco3) - - MCFG_DEVICE_ADD(GIME_TAG, GIME_NTSC, XTAL_3_579545MHz) - MCFG_GIME_MAINCPU(MAINCPU_TAG) - MCFG_GIME_RAM(RAM_TAG) - MCFG_GIME_EXT(CARTRIDGE_TAG) - MCFG_GIME_HSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, ca1_w)) - MCFG_GIME_FSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, cb1_w)) - MCFG_GIME_IRQ_CALLBACK(WRITELINE(coco3_state, gime_irq_w)) - MCFG_GIME_FIRQ_CALLBACK(WRITELINE(coco3_state, gime_firq_w)) - MCFG_GIME_FLOATING_BUS_CALLBACK(READ8(coco_state, floating_bus_read)) - - // composite monitor - MCFG_SCREEN_ADD(COMPOSITE_SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DRIVER(coco3_state, screen_update) - MCFG_SCREEN_SIZE(640, 243) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 1, 241-1) - MCFG_SCREEN_VBLANK_TIME(0) - - // RGB monitor - MCFG_SCREEN_ADD(RGB_SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DRIVER(coco3_state, screen_update) - MCFG_SCREEN_SIZE(640, 243) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 1, 241-1) - MCFG_SCREEN_VBLANK_TIME(0) - - // sound hardware - MCFG_FRAGMENT_ADD( coco_sound ) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_EXTRA_OPTIONS("128K,2M,8M") - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list","coco_cart") - - MCFG_SOFTWARE_LIST_ADD("flop_list","coco_flop") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( coco3p, coco3 ) - MCFG_DEVICE_REPLACE(GIME_TAG, GIME_PAL, XTAL_4_433619MHz) - MCFG_GIME_MAINCPU(MAINCPU_TAG) - MCFG_GIME_RAM(RAM_TAG) - MCFG_GIME_EXT(CARTRIDGE_TAG) - MCFG_GIME_HSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, ca1_w)) - MCFG_GIME_FSYNC_CALLBACK(DEVWRITELINE(PIA0_TAG, pia6821_device, cb1_w)) - MCFG_GIME_IRQ_CALLBACK(WRITELINE(coco3_state, gime_irq_w)) - MCFG_GIME_FIRQ_CALLBACK(WRITELINE(coco3_state, gime_firq_w)) - MCFG_GIME_FLOATING_BUS_CALLBACK(READ8(coco_state, floating_bus_read)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( coco3h, coco3 ) - MCFG_CPU_REPLACE(MAINCPU_TAG, HD6309, XTAL_3_579545MHz) - MCFG_CPU_PROGRAM_MAP(coco3_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( coco3dw1, coco3 ) - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "cc3hdb1") -MACHINE_CONFIG_END - -//************************************************************************** -// ROMS -//************************************************************************** - -ROM_START(coco3) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("coco3.rom", 0x0000, 0x8000, CRC(b4c88d6c) SHA1(e0d82953fb6fd03768604933df1ce8bc51fc427d)) -ROM_END - -ROM_START(coco3p) - ROM_REGION(0x8000,MAINCPU_TAG,0) - ROM_LOAD("coco3p.rom", 0x0000, 0x8000, CRC(ff050d80) SHA1(631e383068b1f52a8f419f4114b69501b21cf379)) -ROM_END - -#define rom_coco3h rom_coco3 -#define rom_coco3dw1 rom_coco3 - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -COMP( 1986, coco3, coco, 0, coco3, coco3, driver_device, 0, "Tandy Radio Shack", "Color Computer 3 (NTSC)", 0) -COMP( 1986, coco3p, coco, 0, coco3p, coco3, driver_device, 0, "Tandy Radio Shack", "Color Computer 3 (PAL)", 0) -COMP( 19??, coco3h, coco, 0, coco3h, coco3, driver_device, 0, "Tandy Radio Shack", "Color Computer 3 (NTSC; HD6309)", MACHINE_UNOFFICIAL) -COMP( 19??, coco3dw1, coco, 0, coco3dw1, coco3, driver_device, 0, "Tandy Radio Shack", "Color Computer 3 (NTSC; HDB-DOS)", MACHINE_UNOFFICIAL) diff --git a/src/mess/drivers/codata.c b/src/mess/drivers/codata.c deleted file mode 100644 index 91c7459f450..00000000000 --- a/src/mess/drivers/codata.c +++ /dev/null @@ -1,113 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Contel Codata Corporation Codata - - 2010-01-11 Skeleton driver. - 2013-08-26 Connected to a terminal. - - Chips: uPD7201C, AM9513, SCN68000. Crystal: 16 MHz - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class codata_state : public driver_device -{ -public: - codata_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_base(*this, "rambase"), - m_terminal(*this, TERMINAL_TAG), - m_maincpu(*this, "maincpu") - { - } - - DECLARE_READ16_MEMBER(keyin_r); - DECLARE_READ16_MEMBER(status_r); - DECLARE_WRITE8_MEMBER(kbd_put); -private: - UINT8 m_term_data; - virtual void machine_reset(); - required_shared_ptr m_p_base; - required_device m_terminal; - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(codata_mem, AS_PROGRAM, 16, codata_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("rambase") - AM_RANGE(0x200000, 0x203fff) AM_ROM AM_REGION("user1", 0); - AM_RANGE(0x400000, 0x403fff) AM_ROM AM_REGION("user1", 0x4000); - AM_RANGE(0x600000, 0x600001) AM_READ(keyin_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff00) - AM_RANGE(0x600002, 0x600003) AM_READ(status_r) - //AM_RANGE(0x600000, 0x600003) uPD7201 SIO - //AM_RANGE(0x800000, 0x800003) AM9513 5 channel timer - //AM_RANGE(0xa00000, 0xbfffff) page map (rw) - //AM_RANGE(0xc00000, 0xdfffff) segment map (rw), context register (r) - //AM_RANGE(0xe00000, 0xffffff) context register (w), 16-bit parallel input port (r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( codata ) -INPUT_PORTS_END - - -READ16_MEMBER( codata_state::keyin_r ) -{ - UINT16 ret = m_term_data; - m_term_data = 0; - return ret << 8; -} - -READ16_MEMBER( codata_state::status_r ) -{ - return (m_term_data) ? 0x500 : 0x400; -} - -WRITE8_MEMBER( codata_state::kbd_put ) -{ - m_term_data = data; -} - -void codata_state::machine_reset() -{ - UINT8* RAM = memregion("user1")->base(); - memcpy(m_p_base, RAM, 16); - m_term_data = 0; - m_maincpu->reset(); -} - -static MACHINE_CONFIG_START( codata, codata_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M68000, XTAL_16MHz / 2) - MCFG_CPU_PROGRAM_MAP(codata_mem) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(codata_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( codata ) - ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "27-0042-01a boot 00 u101 rev 3.6.2 9-28-83.u101", 0x0000, 0x2000, CRC(70014b16) SHA1(19a82000894d79817358d40ae520200e976be310)) - ROM_LOAD16_BYTE( "27-0043-01a boot 01 u102 rev 3.6.2 9-28-83.u102", 0x4000, 0x2000, CRC(fca9c314) SHA1(2f8970fad479000f28536003867066d6df9e33d9)) - ROM_LOAD16_BYTE( "27-0044-01a boot e0 u103 rev 3.6.2 9-28-83.u103", 0x0001, 0x2000, CRC(dc5d5cea) SHA1(b3e9248abf89d674c463d21d2f7be34508cf16c2)) - ROM_LOAD16_BYTE( "27-0045-01a boot e1 u104 rev 3.6.2 9-28-83.u104", 0x4001, 0x2000, CRC(a937e7b3) SHA1(d809bbd437fe7d925325958072b9e0dc33dd36a6)) - - ROM_REGION( 0x240, "proms", 0 ) - ROM_LOAD( "p0.u502", 0x0000, 0x0020, CRC(20eb1183) SHA1(9b268792b28d858d6b6a1b6c4148af88a8d6b735) ) - ROM_LOAD( "p1.u602", 0x0020, 0x0020, CRC(ee1e5a14) SHA1(0d3346cb3b647fa2475bd7b4fa36ea6ecfdaf805) ) - ROM_LOAD( "p2.u503", 0x0040, 0x0200, CRC(12d9a6be) SHA1(fca99f9c5afc630ac67cbd4e5ba4e5242b826848) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, codata, 0, 0, codata, codata, driver_device, 0, "Contel Codata Corporation", "Codata", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/coleco.c b/src/mess/drivers/coleco.c deleted file mode 100644 index 5f6c020e33c..00000000000 --- a/src/mess/drivers/coleco.c +++ /dev/null @@ -1,499 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mike Balfour, Ben Bruscella, Sean Young -/******************************************************************************************************* - - coleco.c - - Driver file to handle emulation of the ColecoVision. - - Marat Fayzullin (ColEm source) - Marcel de Kogel (AdamEm source) - Mike Balfour - Ben Bruscella - Sean Young - - NEWS: - - Modified memory map, now it has only 1k of RAM mapped on 8k Slot - - Modified I/O map, now it is handled as on a real ColecoVision: - The I/O map is broken into 4 write and 4 read ports: - 80-9F (W) = Set both controllers to keypad mode - 80-9F (R) = Not Connected - - A0-BF (W) = Video Chip (TMS9928A), A0=0 -> Write Register 0 , A0=1 -> Write Register 1 - A0-BF (R) = Video Chip (TMS9928A), A0=0 -> Read Register 0 , A0=1 -> Read Register 1 - - C0-DF (W) = Set both controllers to joystick mode - C0-DF (R) = Not Connected - - E0-FF (W) = Sound Chip (SN76489A) - E0-FF (R) = Read Controller data, A1=0 -> read controller 1, A1=1 -> read controller 2 - - - Modified paddle handler, now it is handled as on a real ColecoVision - - Added support for a Roller Controller (Trackball), enabled via category - - Added support for two Super Action Controller, enabled via category - - EXTRA CONTROLLERS INFO: - - -Driving Controller (Expansion Module #2). It consist of a steering wheel and a gas pedal. Only one - can be used on a real ColecoVision. The gas pedal is not analog, internally it is just a switch. - On a real ColecoVision, when the Driving Controller is enabled, the controller 1 do not work because - have been replaced by the Driving Controller, and controller 2 have to be used to start game, gear - shift, etc. - Driving Controller is just a spinner on controller 1 socket similar to the one on Roller Controller - and Super Action Controllers so you can use Roller Controller or Super Action Controllers to play - games requiring Driving Controller. - - -Roller Controller. Basically a trackball with four buttons (the two fire buttons from player 1 and - the two fire buttons from player 2). Only one Roller Controller can be used on a real ColecoVision. - Roller Controller is connected to both controller sockets and both controllers are conected to the Roller - Controller, it uses the spinner pins of both sockets to generate the X and Y signals (X from controller 1 - and the Y from controller 2) - - -Super Action Controllers. It is a hand controller with a keypad, four buttons (the two from - the player pad and two more), and a spinner. This was made primarily for two player sport games, but - will work for every other ColecoVision game. - -*******************************************************************************************************/ - -/* - - TODO: - - - Dina SG-1000 mode - -*/ - -#include "includes/coleco.h" - - -/* Read/Write Handlers */ - -READ8_MEMBER( coleco_state::paddle_1_r ) -{ - return m_joy_d7_state[0] | coleco_paddle_read(0, m_joy_mode, m_joy_analog_state[0]); -} - -READ8_MEMBER( coleco_state::paddle_2_r ) -{ - return m_joy_d7_state[1] | coleco_paddle_read(1, m_joy_mode, m_joy_analog_state[1]); -} - -WRITE8_MEMBER( coleco_state::paddle_off_w ) -{ - m_joy_mode = 0; -} - -WRITE8_MEMBER( coleco_state::paddle_on_w ) -{ - m_joy_mode = 1; -} - - -/* Memory Maps */ - -static ADDRESS_MAP_START( coleco_map, AS_PROGRAM, 8, coleco_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x6000, 0x63ff) AM_RAM AM_MIRROR(0x1c00) AM_SHARE("ram") - AM_RANGE(0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( coleco_io_map, AS_IO, 8, coleco_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(paddle_off_w) - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) - AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(paddle_on_w) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1f) AM_DEVWRITE("sn76489a", sn76489a_device, write) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1d) AM_READ(paddle_1_r) - AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x1d) AM_READ(paddle_2_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( czz50_map, AS_PROGRAM, 8, coleco_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x6000, 0x63ff) AM_RAM AM_MIRROR(0x1c00) AM_SHARE("ram") - AM_RANGE(0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - - -/* Input Ports */ - -static INPUT_PORTS_START( czz50 ) - PORT_START("STD_KEYPAD1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("#") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('#') - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("*") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('*') - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0xb000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("STD_JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("STD_KEYPAD2") - PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0f00, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0xb000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("STD_JOY2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) -INPUT_PORTS_END - - -/* Interrupts */ - -WRITE_LINE_MEMBER(coleco_state::coleco_vdp_interrupt) -{ - // NMI on rising edge - if (state && !m_last_nmi_state) - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - - m_last_nmi_state = state; -} - -TIMER_CALLBACK_MEMBER(coleco_state::paddle_d7reset_callback) -{ - m_joy_d7_state[param] = 0; - m_joy_analog_state[param] = 0; -} - -TIMER_CALLBACK_MEMBER(coleco_state::paddle_irqreset_callback) -{ - m_joy_irq_state[param] = 0; - - if (!m_joy_irq_state[param ^ 1]) - m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); -} - -TIMER_CALLBACK_MEMBER(coleco_state::paddle_pulse_callback) -{ - if (m_joy_analog_reload[param]) - { - m_joy_analog_state[param] = m_joy_analog_reload[param]; - - // on movement, controller port d7 is set for a short period and an irq is fired on d7 rising edge - m_joy_d7_state[param] = 0x80; - m_joy_d7_timer[param]->adjust(attotime::from_usec(500), param); // TODO: measure duration - - // irq on rising edge, PULSE_LINE is not supported in this case, so clear it manually - m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); - m_joy_irq_timer[param]->adjust(attotime::from_usec(11), param); // TODO: measure duration - m_joy_irq_state[param] = 1; - - // reload timer - m_joy_pulse_timer[param]->adjust(m_joy_pulse_reload[param], param); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(coleco_state::paddle_update_callback) -{ - // arbitrary timer for reading analog controls - coleco_scan_paddles(&m_joy_analog_reload[0], &m_joy_analog_reload[1]); - - for (int port = 0; port < 2; port++) - { - if (m_joy_analog_reload[port]) - { - const int sensitivity = 500; - int ipt = m_joy_analog_reload[port]; - if (ipt & 0x80) ipt = 0x100 - ipt; - attotime freq = attotime::from_msec(sensitivity / ipt); - - // change pulse intervals relative to spinner/trackball speed - m_joy_pulse_reload[port] = freq; - m_joy_pulse_timer[port]->adjust(min(freq, m_joy_pulse_timer[port]->remaining()), port); - } - } -} - -READ8_MEMBER( coleco_state::cart_r ) -{ - return m_cart->bd_r(space, offset & 0x7fff, 0, 0, 0, 0, 0); -} - -UINT8 coleco_state::coleco_scan_paddles(UINT8 *joy_status0, UINT8 *joy_status1) -{ - UINT8 ctrl_sel = (m_ctrlsel != NULL) ? m_ctrlsel->read() : 0; - - /* which controller shall we read? */ - if ((ctrl_sel & 0x07) == 0x02) // Super Action Controller P1 - *joy_status0 = (m_sac_slide1 != NULL) ? m_sac_slide1->read() : 0; - else if ((ctrl_sel & 0x07) == 0x03) // Driving Controller P1 - *joy_status0 = (m_driv_wheel1 != NULL) ? m_driv_wheel1->read() : 0; - - if ((ctrl_sel & 0x70) == 0x20) // Super Action Controller P2 - *joy_status1 = (m_sac_slide2 != NULL) ? m_sac_slide2->read() : 0; - else if ((ctrl_sel & 0x70) == 0x30) // Driving Controller P2 - *joy_status1 = (m_driv_wheel2 != NULL) ? m_driv_wheel2->read() : 0; - - /* In principle, even if not supported by any game, I guess we could have two Super - Action Controllers plugged into the Roller controller ports. Since I found no info - about the behavior of sliders in such a configuration, we overwrite SAC sliders with - the Roller trackball inputs and actually use the latter ones, when both are selected. */ - if (ctrl_sel & 0x80) // Roller controller - { - *joy_status0 = (m_roller_x != NULL) ? m_roller_x->read() : 0; - *joy_status1 = (m_roller_y != NULL) ? m_roller_y->read() : 0; - } - - return *joy_status0 | *joy_status1; -} - - -UINT8 coleco_state::coleco_paddle_read(int port, int joy_mode, UINT8 joy_status) -{ - UINT8 ctrl_sel = (m_ctrlsel != NULL ) ? m_ctrlsel->read() : 0; - UINT8 ctrl_extra = ctrl_sel & 0x80; - ctrl_sel = ctrl_sel >> (port*4) & 7; - - /* Keypad and fire 1 (SAC Yellow Button) */ - if (joy_mode == 0) - { - /* No key pressed by default */ - UINT8 data = 0x0f; - UINT16 ipt = 0xffff; - - if (ctrl_sel == 0) // ColecoVision Controller - ipt = port ? m_std_keypad2->read() : m_std_keypad1->read(); - else if (ctrl_sel == 2) // Super Action Controller - ipt = port ? m_sac_keypad2->read() : m_sac_keypad1->read(); - - /* Numeric pad buttons are not independent on a real ColecoVision, if you push more - than one, a real ColecoVision think that it is a third button, so we are going to emulate - the right behaviour */ - /* Super Action Controller additional buttons are read in the same way */ - if (!(ipt & 0x0001)) data &= 0x0a; /* 0 */ - if (!(ipt & 0x0002)) data &= 0x0d; /* 1 */ - if (!(ipt & 0x0004)) data &= 0x07; /* 2 */ - if (!(ipt & 0x0008)) data &= 0x0c; /* 3 */ - if (!(ipt & 0x0010)) data &= 0x02; /* 4 */ - if (!(ipt & 0x0020)) data &= 0x03; /* 5 */ - if (!(ipt & 0x0040)) data &= 0x0e; /* 6 */ - if (!(ipt & 0x0080)) data &= 0x05; /* 7 */ - if (!(ipt & 0x0100)) data &= 0x01; /* 8 */ - if (!(ipt & 0x0200)) data &= 0x0b; /* 9 */ - if (!(ipt & 0x0400)) data &= 0x06; /* # */ - if (!(ipt & 0x0800)) data &= 0x09; /* * */ - if (!(ipt & 0x1000)) data &= 0x04; /* Blue Action Button */ - if (!(ipt & 0x2000)) data &= 0x08; /* Purple Action Button */ - - return ((ipt & 0x4000) >> 8) | 0x30 | data; - } - /* Joystick and fire 2 (SAC Red Button) */ - else - { - UINT8 data = 0x7f; - - if (ctrl_sel == 0) // ColecoVision Controller - data = port ? m_std_joy2->read() : m_std_joy1->read(); - else if (ctrl_sel == 2) // Super Action Controller - data = port ? m_sac_joy2->read() : m_sac_joy1->read(); - else if (ctrl_sel == 3) // Driving Controller - data = port ? m_driv_pedal2->read() : m_driv_pedal1->read(); - - /* If any extra analog contoller enabled */ - if (ctrl_extra || ctrl_sel == 2 || ctrl_sel == 3) - { - if (joy_status & 0x80) data ^= 0x30; - else if (joy_status) data ^= 0x10; - } - - return data & 0x7f; - } -} - -void coleco_state::machine_start() -{ - memset(m_ram, 0xff, m_ram.bytes()); // initialize RAM - - // init paddles - for (int port = 0; port < 2; port++) - { - m_joy_pulse_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_pulse_callback),this)); - m_joy_d7_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_d7reset_callback),this)); - m_joy_irq_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_irqreset_callback),this)); - - m_joy_irq_state[port] = 0; - m_joy_d7_state[port] = 0; - m_joy_analog_state[port] = 0; - } - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(coleco_state::cart_r),this)); - - save_item(NAME(m_joy_mode)); - save_item(NAME(m_last_nmi_state)); - save_item(NAME(m_joy_irq_state)); - save_item(NAME(m_joy_d7_state)); - save_item(NAME(m_joy_analog_state)); - save_item(NAME(m_joy_analog_reload)); -} - -void coleco_state::machine_reset() -{ - m_last_nmi_state = 0; -} - -//static int coleco_cart_verify(const UINT8 *cartdata, size_t size) -//{ -// int retval = IMAGE_VERIFY_FAIL; -// -// /* Verify the file is in Colecovision format */ -// if ((cartdata[0] == 0xAA) && (cartdata[1] == 0x55)) /* Production Cartridge */ -// retval = IMAGE_VERIFY_PASS; -// if ((cartdata[0] == 0x55) && (cartdata[1] == 0xAA)) /* "Test" Cartridge. Some games use this method to skip ColecoVision title screen and delay */ -// retval = IMAGE_VERIFY_PASS; -// -// return retval; -//} - - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( coleco, coleco_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_7_15909MHz/2) // 3.579545 MHz - MCFG_CPU_PROGRAM_MAP(coleco_map) - MCFG_CPU_IO_MAP(coleco_io_map) - - /* video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(coleco_state, coleco_vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("sn76489a", SN76489A, XTAL_7_15909MHz/2) // 3.579545 MHz - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* cartridge */ - MCFG_COLECOVISION_CARTRIDGE_SLOT_ADD(COLECOVISION_CARTRIDGE_SLOT_TAG, colecovision_cartridges, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","coleco") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("paddle_timer", coleco_state, paddle_update_callback, attotime::from_msec(20)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( colecop, coleco ) - - /* video hardware */ - MCFG_DEVICE_REMOVE("tms9928a") - MCFG_DEVICE_REMOVE("screen") - - MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(coleco_state, coleco_vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( czz50, coleco ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") // note: cpu speed unverified, assume it's the same as ColecoVision - MCFG_CPU_PROGRAM_MAP(czz50_map) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dina, czz50 ) - - /* video hardware */ - MCFG_DEVICE_REMOVE("tms9928a") - MCFG_DEVICE_REMOVE("screen") - - MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(coleco_state, coleco_vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) -MACHINE_CONFIG_END - - -/* ROMs */ - -ROM_START (coleco) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "original", "Original" ) - ROMX_LOAD( "313 10031-4005 73108a.u2", 0x0000, 0x2000, CRC(3aa93ef3) SHA1(45bedc4cbdeac66c7df59e9e599195c778d86a92), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "thick", "Thick characters" ) - // differences to 0x3aa93ef3 modified characters, added a pad 2 related fix - ROMX_LOAD( "colecoa.rom", 0x0000, 0x2000, CRC(39bb16fc) SHA1(99ba9be24ada3e86e5c17aeecb7a2d68c5edfe59), ROM_BIOS(2) ) -ROM_END - -/* ONYX (Prototype) - Unreleased Brazilian Colecovision clone by Microdigital. - - It was never released and the only known prototypes were uncovered by an ex-employee of Microdigital - called Cl??udio Cassens who donated it to collectors (Eduardo Luccas) in June 2015. - -- Felipe Sanches -*/ -ROM_START (onyx) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "onyx.rom", 0x0000, 0x2000, CRC(011c32e7) SHA1(f44263221e330b2590dffc1a6f43ed2591fe19be) ) -ROM_END - -/* PAL Colecovision BIOS - -Country: Italy -Serial number: C0039036 -Model number: 240020 -Circuit board: (C) 1983 91162 rev D - -Information about the chip - -Motorola logo -(C)1983 COLECO -R72114A -8317 */ - -ROM_START (colecop) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "r72114a_8317.u2", 0x0000, 0x2000, CRC(d393c0cc) SHA1(160077afb139943725c634d6539898db59f33657) ) -ROM_END - -ROM_START (svi603) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "svi603.rom", 0x0000, 0x2000, CRC(19e91b82) SHA1(8a30abe5ffef810b0f99b86db38b1b3c9d259b78) ) -ROM_END - -ROM_START( czz50 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "czz50.rom", 0x0000, 0x2000, CRC(4999abc6) SHA1(96aecec3712c94517103d894405bc98a7dafa440) ) - ROM_CONTINUE( 0x8000, 0x2000 ) -ROM_END - -#define rom_dina rom_czz50 -#define rom_prsarcde rom_czz50 - - -/* System Drivers */ - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -CONS( 1982, coleco, 0, 0, coleco, coleco, driver_device, 0, "Coleco", "ColecoVision (NTSC)", 0 ) -CONS( 1982, onyx, coleco, 0, coleco, coleco, driver_device, 0, "Microdigital", "Onyx (Brazil/Prototype)", 0 ) -CONS( 1983, colecop, coleco, 0, colecop, coleco, driver_device, 0, "Coleco", "ColecoVision (PAL)", 0 ) -CONS( 1983, svi603, coleco, 0, coleco, coleco, driver_device, 0, "Spectravideo", "SVI-603 Coleco Game Adapter", 0 ) -CONS( 1986, czz50, 0, coleco, czz50, czz50, driver_device, 0, "Bit Corporation", "Chuang Zao Zhe 50", 0 ) -CONS( 1988, dina, czz50, 0, dina, czz50, driver_device, 0, "Telegames", "Dina", 0 ) -CONS( 1988, prsarcde, czz50, 0, czz50, czz50, driver_device, 0, "Telegames", "Personal Arcade", 0 ) diff --git a/src/mess/drivers/compis.c b/src/mess/drivers/compis.c deleted file mode 100644 index f2f2921436c..00000000000 --- a/src/mess/drivers/compis.c +++ /dev/null @@ -1,792 +0,0 @@ -// license:??? -// copyright-holders:Per Ola Ingvarsson, Tomas Karlsson -/****************************************************************************** - - drivers/compis.c - machine driver - - Per Ola Ingvarsson - Tomas Karlsson - - Hardware: - - Intel 80186 CPU 8MHz, integrated DMA(8237?), PIC(8259?), PIT(8253?) - - Intel 80130 OSP Operating system processor (PIC 8259, PIT 8254) - - Intel 8274 MPSC Multi-protocol serial communications controller (NEC 7201) - - Intel 8255 PPI Programmable peripheral interface - - Intel 8253 PIT Programmable interval timer - - Intel 8251 USART Universal synchronous asynchronous receiver transmitter - - National 58174 Real-time clock (compatible with 58274) - Peripheral: - - Intel 82720 GDC Graphic display processor (NEC uPD 7220) - - Intel 8272 FDC Floppy disk controller (Intel iSBX-218A) - - Western Digital WD1002-05 Winchester controller - - Memory map: - - 00000-3FFFF RAM LMCS (Low Memory Chip Select) - 40000-4FFFF RAM MMCS 0 (Midrange Memory Chip Select) - 50000-5FFFF RAM MMCS 1 (Midrange Memory Chip Select) - 60000-6FFFF RAM MMCS 2 (Midrange Memory Chip Select) - 70000-7FFFF RAM MMCS 3 (Midrange Memory Chip Select) - 80000-EFFFF NOP - F0000-FFFFF ROM UMCS (Upper Memory Chip Select) - -18/08/2011 -[Robbbert] -- Modernised -- Removed F4 display, as the gfx is in different places per bios. -- Changed to monochrome, it usually had a greenscreen monitor, although some - were amber. -- Still doesn't work. -- Added a nasty hack to get a display on compis2 (wait 20 seconds) - - - ******************************************************************************/ - -#include "includes/compis.h" -#include "bus/rs232/rs232.h" - - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// tape_mon_w - -//------------------------------------------------- - -WRITE8_MEMBER( compis_state::tape_mon_w ) -{ - cassette_state state = BIT(data, 0) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED; - - m_cassette->change_state(state, CASSETTE_MASK_MOTOR); -} - - -//------------------------------------------------- -// isbx -//------------------------------------------------- - -READ16_MEMBER( compis_state::isbx0_tdma_r ) -{ - if (ACCESSING_BITS_0_7) - { - return m_mpsc->cd_ba_r(space, offset & 0x03); - } - else - { - m_isbx0->tdma_w(0); - m_isbx0->tdma_w(1); - - return 0xff; - } -} - -WRITE16_MEMBER( compis_state::isbx0_tdma_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_mpsc->cd_ba_w(space, offset & 0x03, data); - } - else - { - m_isbx0->tdma_w(0); - m_isbx0->tdma_w(1); - } -} - -READ16_MEMBER( compis_state::isbx1_tdma_r ) -{ - if (ACCESSING_BITS_0_7) - { - if (offset < 2) - return m_crtc->read(space, offset & 0x01); - else - // monochrome only, hblank? vblank? - if(offset == 2) - { - switch(m_unk_video) - { - case 0x04: - m_unk_video = 0x44; - break; - case 0x44: - m_unk_video = 0x64; - break; - default: - m_unk_video = 0x04; - break; - } - return m_unk_video; - } - else - return 0; - } - else - { - m_isbx1->tdma_w(0); - m_isbx1->tdma_w(1); - - return 0xff; - } -} - -WRITE16_MEMBER( compis_state::isbx1_tdma_w ) -{ - if (ACCESSING_BITS_0_7) - { - // 0x336 is likely the color plane register - if (offset < 2) m_crtc->write(space, offset & 0x01, data); - - } - else - { - m_isbx1->tdma_w(0); - m_isbx1->tdma_w(1); - } -} - -READ16_MEMBER( compis_state::isbx0_cs_r ) -{ - if (ACCESSING_BITS_0_7) - { - return m_isbx0->mcs0_r(space, offset); - } - else - { - return m_isbx0->mcs1_r(space, offset) << 8; - } -} - -WRITE16_MEMBER( compis_state::isbx0_cs_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_isbx0->mcs0_w(space, offset, data); - } - else - { - m_isbx0->mcs1_w(space, offset, data >> 8); - } -} - -READ16_MEMBER( compis_state::isbx0_dack_r ) -{ - if (ACCESSING_BITS_0_7) - { - return m_isbx0->mcs1_r(space, offset); - } - else - { - return m_isbx0->mdack_r(space, offset) << 8; - } -} - -WRITE16_MEMBER( compis_state::isbx0_dack_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_isbx0->mcs1_w(space, offset, data); - } - else - { - m_isbx0->mdack_w(space, offset, data >> 8); - } -} - -READ16_MEMBER( compis_state::isbx1_cs_r ) -{ - if (ACCESSING_BITS_0_7) - { - return m_isbx1->mcs0_r(space, offset); - } - else - { - return m_isbx1->mcs1_r(space, offset) << 8; - } -} - -WRITE16_MEMBER( compis_state::isbx1_cs_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_isbx1->mcs0_w(space, offset, data); - } - else - { - m_isbx1->mcs1_w(space, offset, data >> 8); - } -} - -READ16_MEMBER( compis_state::isbx1_dack_r ) -{ - if (ACCESSING_BITS_0_7) - { - return m_isbx1->mcs1_r(space, offset); - } - else - { - return m_isbx1->mdack_r(space, offset) << 8; - } -} - -WRITE16_MEMBER( compis_state::isbx1_dack_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_isbx1->mcs1_w(space, offset, data); - } - else - { - m_isbx1->mdack_w(space, offset, data >> 8); - } -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( compis_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( compis_mem, AS_PROGRAM, 16, compis_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x1ffff) AM_RAM - AM_RANGE(0x60000, 0x63fff) AM_MIRROR(0x1c000) AM_DEVICE(I80130_TAG, i80130_device, rom_map) - AM_RANGE(0xe0000, 0xeffff) AM_MIRROR(0x10000) AM_ROM AM_REGION(I80186_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( compis2_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( compis2_mem, AS_PROGRAM, 16, compis_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0xbffff) AM_RAM - AM_RANGE(0xe0000, 0xeffff) AM_MIRROR(0x10000) AM_ROM AM_REGION(I80186_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( compis_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( compis_io, AS_IO, 16, compis_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0007) /* PCS0 */ AM_MIRROR(0x78) AM_DEVREADWRITE8(I8255_TAG, i8255_device, read, write, 0xff00) - AM_RANGE(0x0080, 0x0087) /* PCS1 */ AM_MIRROR(0x78) AM_DEVREADWRITE8(I8253_TAG, pit8253_device, read, write, 0x00ff) - AM_RANGE(0x0100, 0x011f) /* PCS2 */ AM_MIRROR(0x60) AM_DEVREADWRITE8(MM58174A_TAG, mm58274c_device, read, write, 0x00ff) - //AM_RANGE(0x0180, 0x0181) /* PCS3 */ AM_MIRROR(0x7e) - //AM_RANGE(0x0200, 0x0201) /* PCS4 */ AM_MIRROR(0x7e) - AM_RANGE(0x0280, 0x028f) /* PCS5 */ AM_MIRROR(0x70) AM_DEVICE(I80130_TAG, i80130_device, io_map) - AM_RANGE(0x0300, 0x0301) /* PCS6:0 */ AM_MIRROR(0xe) AM_WRITE8(tape_mon_w, 0x00ff) - AM_RANGE(0x0310, 0x0311) /* PCS6:3 */ AM_MIRROR(0xc) AM_DEVREADWRITE8(I8251A_TAG, i8251_device, data_r, data_w, 0xff00) - AM_RANGE(0x0312, 0x0313) /* PCS6:3 */ AM_MIRROR(0xc) AM_DEVREADWRITE8(I8251A_TAG, i8251_device, status_r, control_w, 0xff00) - AM_RANGE(0x0320, 0x032f) AM_READWRITE(isbx0_tdma_r, isbx0_tdma_w) - AM_RANGE(0x0330, 0x033f) AM_READWRITE(isbx1_tdma_r, isbx1_tdma_w) - AM_RANGE(0x0340, 0x034f) AM_READWRITE(isbx0_cs_r, isbx0_cs_w) - AM_RANGE(0x0350, 0x035f) AM_READWRITE(isbx0_dack_r, isbx0_dack_w) - AM_RANGE(0x0360, 0x036f) AM_READWRITE(isbx1_cs_r, isbx1_cs_w) - AM_RANGE(0x0370, 0x037f) AM_READWRITE(isbx1_dack_r, isbx1_dack_w) -#ifdef NOT_SUPPORTED_BY_MAME_CORE - AM_RANGE(0x0300, 0x0301) /* PCS6:1 */ AM_MIRROR(0xe) AM_DEVREADWRITE8("upd7220", upd7220_device, dack_r, dack_w, 0xff00) // DMA-ACK graphics - AM_RANGE(0x0310, 0x0311) /* PCS6:2 */ AM_MIRROR(0xe) AM_DEVREAD8(I8274_TAG, i8274_device, inta_r, 0x00ff) // 8274 INTERRUPT ACKNOWLEDGE - AM_RANGE(0x0320, 0x0323) /* PCS6:4 */ AM_MIRROR(0xc) AM_DEVREADWRITE8(I8274_TAG, i8274_device, cd_ba_r, cd_ba_w, 0x00ff) - AM_RANGE(0x0320, 0x0321) /* PCS6:5 */ AM_MIRROR(0xe) AM_READWRITE8(isbx0_tdma_r, isbx0_tdma_w, 0xff00) // DMA-TERMINATE J8 (iSBX0) - AM_RANGE(0x0330, 0x0333) /* PCS6:6 */ AM_DEVREADWRITE8("upd7220", upd7220_device, read, write, 0x00ff) - AM_RANGE(0x0330, 0x0331) /* PCS6:7 */ AM_MIRROR(0xe) AM_READWRITE8(isbx1_tdma_r, isbx1_tdma_w, 0xff00) // DMA-TERMINATE J9 (iSBX1) - AM_RANGE(0x0340, 0x034f) /* PCS6:8 */ AM_DEVREADWRITE8(ISBX_0_TAG, isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) // 8272 CS0 (8/16-bit) J8 (iSBX0) - AM_RANGE(0x0340, 0x034f) /* PCS6:9 */ AM_DEVREADWRITE8(ISBX_0_TAG, isbx_slot_device, mcs1_r, mcs1_w, 0xff00) // CS1 (16-bit) J8 (iSBX0) - AM_RANGE(0x0350, 0x035f) /* PCS6:10 */ AM_DEVREADWRITE8(ISBX_0_TAG, isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) // CS1 (8-bit) J8 (iSBX0) - AM_RANGE(0x0350, 0x035f) /* PCS6:11 */ AM_DEVREADWRITE8(ISBX_0_TAG, isbx_slot_device, mdack_r, mdack_w, 0xff00) // DMA-ACK J8 (iSBX0) - AM_RANGE(0x0360, 0x036f) /* PCS6:13 */ AM_DEVREADWRITE8(ISBX_1_TAG, isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) // CS0 (8/16-bit) J9 (iSBX1) - AM_RANGE(0x0360, 0x036f) /* PCS6:13 */ AM_DEVREADWRITE8(ISBX_1_TAG, isbx_slot_device, mcs1_r, mcs1_w, 0xff00) // CS1 (16-bit) J9 (iSBX1) - AM_RANGE(0x0370, 0x037f) /* PCS6:14 */ AM_DEVREADWRITE8(ISBX_1_TAG, isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) // CS1 (8-bit) J9 (iSBX1) - AM_RANGE(0x0370, 0x037f) /* PCS6:15 */ AM_DEVREADWRITE8(ISBX_1_TAG, isbx_slot_device, mdack_r, mdack_w, 0xff00) // DMA-ACK J9 (iSBX1) -#endif -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( upd7220_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( upd7220_map, AS_0, 16, compis_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7fff) - AM_RANGE(0x00000, 0x7fff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( compis ) -//------------------------------------------------- - -static INPUT_PORTS_START( compis ) - PORT_START("S1") - PORT_CONFNAME( 0x01, 0x00, "S1 ROM Type") - PORT_CONFSETTING( 0x00, "27128" ) - PORT_CONFSETTING( 0x01, "27256" ) - - PORT_START("S2") - PORT_CONFNAME( 0x01, 0x00, "S2 IC36/IC40") - PORT_CONFSETTING( 0x00, "ROM" ) - PORT_CONFSETTING( 0x01, "RAM" ) - - PORT_START("S3") - PORT_CONFNAME( 0x03, 0x00, "S3 J4 RxC") - PORT_CONFSETTING( 0x00, "DCE" ) - PORT_CONFSETTING( 0x01, "Tmr3" ) - PORT_CONFSETTING( 0x02, "Tmr4" ) - - PORT_START("S4") - PORT_CONFNAME( 0x01, 0x01, "S4 iSBX0 Bus Width") - PORT_CONFSETTING( 0x00, "8 Bit" ) - PORT_CONFSETTING( 0x01, "16 Bit" ) - - PORT_START("S5") - PORT_CONFNAME( 0x01, 0x01, "S5 iSBX1 Bus Width") - PORT_CONFSETTING( 0x00, "8 Bit" ) - PORT_CONFSETTING( 0x01, "16 Bit" ) - - PORT_START("S6") - PORT_CONFNAME( 0x001, 0x001, "S6 INT 8274") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x001, DEF_STR( On ) ) - PORT_CONFNAME( 0x002, 0x000, "S6 TxRDY 8251") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x002, DEF_STR( On ) ) - PORT_CONFNAME( 0x004, 0x000, "S6 INT KB") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x004, DEF_STR( On ) ) - PORT_CONFNAME( 0x008, 0x008, "S6 DELAY 80150") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x008, DEF_STR( On ) ) - PORT_CONFNAME( 0x010, 0x000, "S6 INT0 iSBX1 (J9)") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x010, DEF_STR( On ) ) - PORT_CONFNAME( 0x020, 0x000, "S6 INT1 iSBX1 (J9)") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x020, DEF_STR( On ) ) - PORT_CONFNAME( 0x040, 0x040, "S6 ACK J7") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x040, DEF_STR( On ) ) - PORT_CONFNAME( 0x080, 0x000, "S6 SYSTICK 80150") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x080, DEF_STR( On ) ) - PORT_CONFNAME( 0x100, 0x100, "S6 RxRDY 8251") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x100, DEF_STR( On ) ) - PORT_CONFNAME( 0x200, 0x000, "S6 INT0 iSBX0 (J8)") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x200, DEF_STR( On ) ) - PORT_CONFNAME( 0x400, 0x400, "S6 INT1 iSBX0 (J8)") - PORT_CONFSETTING( 0x000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x400, DEF_STR( On ) ) - - PORT_START("S7") - PORT_CONFNAME( 0x01, 0x00, "S7 ROM Type") - PORT_CONFSETTING( 0x00, "27128" ) - PORT_CONFSETTING( 0x01, "27256" ) - - PORT_START("S8") - PORT_CONFNAME( 0x18, 0x00, "S8 Test Mode") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x08, "Remote Test" ) - PORT_CONFSETTING( 0x10, "Standalone Test" ) - PORT_CONFSETTING( 0x18, "Reserved" ) - - PORT_START("S9") - PORT_CONFNAME( 0x03, 0x00, "S9 8274 TxCB") - PORT_CONFSETTING( 0x00, "DCE-Rxc (J4-11)" ) - PORT_CONFSETTING( 0x01, "DCE-Txc (J4-13)" ) - PORT_CONFSETTING( 0x02, "Tmr3" ) - - PORT_START("S10") - PORT_CONFNAME( 0x01, 0x01, "S10 8274 RxCA") - PORT_CONFSETTING( 0x00, "DCE (J2-11)" ) - PORT_CONFSETTING( 0x01, "Tmr5" ) - - PORT_START("S11") - PORT_CONFNAME( 0x03, 0x01, "S11 8274 TxCA") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, "DCE (J2-13)" ) - PORT_CONFSETTING( 0x02, "Tmr5" ) - - PORT_START("S12") - PORT_CONFNAME( 0x01, 0x01, "S12 8274 TxDA") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, "V24 (J2)" ) - - PORT_START("S13") - PORT_CONFNAME( 0x01, 0x01, "S13 8274 RxDA") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, "V24 (J2)" ) - - PORT_START("S14") - PORT_CONFNAME( 0x01, 0x01, "S14 8274 TxCA") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - - PORT_START("S15") - PORT_CONFNAME( 0x01, 0x00, "S15 Network") - PORT_CONFSETTING( 0x00, "Server" ) - PORT_CONFSETTING( 0x01, "Client" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// UPD7220_INTERFACE( hgdc_intf ) -//------------------------------------------------- - -UPD7220_DISPLAY_PIXELS_MEMBER( compis_state::hgdc_display_pixels ) -{ - UINT16 i,gfx = m_video_ram[(address & 0x7fff) >> 1]; - const pen_t *pen = m_palette->pens(); - - for(i=0; i<16; i++) - bitmap.pix32(y, x + i) = pen[BIT(gfx, i)]; -} - - -//------------------------------------------------- -// I80186_INTERFACE( cpu_intf ) -//------------------------------------------------- - -READ8_MEMBER( compis_state::compis_irq_callback ) -{ - return m_osp->inta_r(); -} - -WRITE_LINE_MEMBER( compis_state::tmr0_w ) -{ - m_tmr0 = state; - - m_cassette->output(m_tmr0 ? -1 : 1); - - m_maincpu->tmrin0_w(state); -} - -WRITE_LINE_MEMBER( compis_state::tmr1_w ) -{ - m_isbx0->mclk_w(state); - m_isbx1->mclk_w(state); - - m_maincpu->tmrin1_w(state); -} - - -//------------------------------------------------- -// I80130_INTERFACE( osp_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( compis_state::tmr2_w ) -{ - m_uart->write_rxc(state); - m_uart->write_txc(state); -} - - -WRITE_LINE_MEMBER( compis_state::tmr5_w ) -{ - m_mpsc->rxca_w(state); - m_mpsc->txca_w(state); -} - -//------------------------------------------------- -// I8255A interface -//------------------------------------------------- - -WRITE_LINE_MEMBER(compis_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER(compis_state::write_centronics_select) -{ - m_centronics_select = state; -} - -READ8_MEMBER( compis_state::ppi_pb_r ) -{ - /* - - bit description - - 0 J5-4 - 1 J5-5 - 2 J6-3 Cassette read - 3 J2-6 DSR / S8-4 Test - 4 J4-6 DSR / S8-3 Test - 5 J7-11 Centronics BUSY - 6 J7-13 Centronics SELECT - 7 Tmr0 - - */ - - UINT8 data = 0; - - /* DIP switch - Test mode */ - data = m_s8->read(); - - // cassette - data |= (m_cassette->input() > 0.0) << 2; - - /* Centronics busy */ - data |= m_centronics_busy << 5; - data |= m_centronics_select << 6; - - // TMR0 - data |= m_tmr0 << 7; - - return data; -} - -WRITE8_MEMBER( compis_state::ppi_pc_w ) -{ - /* - - bit description - - 0 J5-1 - 1 J5-2 - 2 Select: 1=time measure, DSR from J2/J4 pin 6. 0=read cassette - 3 Datex: Tristate datex output (low) - 4 V2-5 Floppy motor on/off - 5 J7-1 Centronics STROBE - 6 V2-4 Floppy Soft reset - 7 V2-3 Floppy Terminal count - - */ - - m_isbx0->opt1_w(BIT(data, 4)); - - m_centronics->write_strobe(BIT(data, 5)); - - if (BIT(data, 6)) - { - m_isbx0->reset(); - } - - m_isbx0->opt0_w(BIT(data, 7)); -} - -TIMER_DEVICE_CALLBACK_MEMBER( compis_state::tape_tick ) -{ - m_maincpu->tmrin0_w(m_cassette->input() > 0.0); -} - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// machine_start -//------------------------------------------------- - -void compis_state::machine_start() -{ - if (m_ram->size() == 256*1024) - { - m_maincpu->space(AS_PROGRAM).install_ram(0x20000, 0x3ffff, NULL); - } -} - - -//------------------------------------------------- -// machine_reset -//------------------------------------------------- - -void compis_state::machine_reset() -{ - m_uart->reset(); - m_mpsc->reset(); - m_ppi->reset(); - m_isbx0->reset(); - m_isbx1->reset(); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( compis ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( compis, compis_state ) - // basic machine hardware - MCFG_CPU_ADD(I80186_TAG, I80186, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(compis_mem) - MCFG_CPU_IO_MAP(compis_io) - MCFG_80186_IRQ_SLAVE_ACK(DEVREAD8(DEVICE_SELF, compis_state, compis_irq_callback)) - MCFG_80186_TMROUT0_HANDLER(DEVWRITELINE(DEVICE_SELF, compis_state, tmr0_w)) - MCFG_80186_TMROUT1_HANDLER(DEVWRITELINE(DEVICE_SELF, compis_state, tmr1_w)) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) - MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) - - MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4_433619MHz/2) // unknown clock - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(compis_state, hgdc_display_pixels) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - // devices - MCFG_DEVICE_ADD(I80130_TAG, I80130, XTAL_16MHz/2) - MCFG_I80130_IRQ_CALLBACK(DEVWRITELINE(I80186_TAG, i80186_cpu_device, int0_w)) - //MCFG_I80130_SYSTICK_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir3_w)) - MCFG_I80130_DELAY_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir7_w)) - MCFG_I80130_BAUD_CALLBACK(WRITELINE(compis_state, tmr2_w)) - - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_16MHz/8) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8274_TAG, i8274_device, rxtxcb_w)) - MCFG_PIT8253_CLK1(XTAL_16MHz/8) - MCFG_PIT8253_CLK2(XTAL_16MHz/8) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(compis_state, tmr5_w)) - - MCFG_DEVICE_ADD(I8255_TAG, I8255, 0) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_IN_PORTB_CB(READ8(compis_state, ppi_pb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(compis_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(COMPIS_KEYBOARD_TAG, compis_keyboard_device, si_w)) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(I80130_TAG, i80130_device, ir2_w)) - //MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I80186_TAG, i80186_cpu_device, int1_w)) - - MCFG_DEVICE_ADD(COMPIS_KEYBOARD_TAG, COMPIS_KEYBOARD, 0) - MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) - - MCFG_I8274_ADD(I8274_TAG, XTAL_16MHz/4, 0, 0, 0, 0) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE(I80186_TAG, i80186_cpu_device, int3_w)) - - MCFG_DEVICE_ADD(MM58174A_TAG, MM58274C, 0) - MCFG_MM58274C_MODE24(0) // 12 hour - MCFG_MM58274C_DAY1(1) // monday - - MCFG_CASSETTE_ADD(CASSETTE_TAG) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", compis_state, tape_tick, attotime::from_hz(44100)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, ctsa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, dcdb_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(I8274_TAG, z80dart_device, ctsb_w)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(compis_state, write_centronics_busy)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(compis_state, write_centronics_select)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_ISBX_SLOT_ADD(ISBX_0_TAG, 0, isbx_cards, "fdc") - MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir1_w)) - MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir0_w)) - MCFG_ISBX_SLOT_MDRQT_CALLBACK(DEVWRITELINE(I80186_TAG, i80186_cpu_device, drq0_w)) - MCFG_ISBX_SLOT_ADD(ISBX_1_TAG, 0, isbx_cards, NULL) - MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir6_w)) - MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir5_w)) - MCFG_ISBX_SLOT_MDRQT_CALLBACK(DEVWRITELINE(I80186_TAG, i80186_cpu_device, drq1_w)) - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "compis") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("256K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( compis2 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( compis2, compis ) - // basic machine hardware - MCFG_CPU_MODIFY(I80186_TAG) - MCFG_CPU_PROGRAM_MAP(compis2_mem) - // TODO 8087 - - // devices - // TODO 525hd drives - - // internal ram - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("768K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( compis ) -//------------------------------------------------- - -ROM_START( compis ) - ROM_REGION16_LE( 0x10000, I80186_TAG, 0 ) - ROM_DEFAULT_BIOS( "v303" ) - - ROM_SYSTEM_BIOS( 0, "v20", "Compis v2.0 (1985-05-15)" ) - ROMX_LOAD( "sa883003.u40", 0x0000, 0x4000, CRC(195ef6bf) SHA1(eaf8ae897e1a4b62d3038ff23777ce8741b766ef), ROM_BIOS(1) | ROM_SKIP(1) ) - ROMX_LOAD( "sa883003.u36", 0x0001, 0x4000, CRC(7c918f56) SHA1(8ba33d206351c52f44f1aa76cc4d7f292dcef761), ROM_BIOS(1) | ROM_SKIP(1) ) - ROMX_LOAD( "sa883003.u39", 0x8000, 0x4000, CRC(3cca66db) SHA1(cac36c9caa2f5bb42d7a6d5b84f419318628935f), ROM_BIOS(1) | ROM_SKIP(1) ) - ROMX_LOAD( "sa883003.u35", 0x8001, 0x4000, CRC(43c38e76) SHA1(f32e43604107def2c2259898926d090f2ed62104), ROM_BIOS(1) | ROM_SKIP(1) ) - - ROM_SYSTEM_BIOS( 1, "v302", "Compis II v3.02 (1986-09-09)" ) - ROMX_LOAD( "comp302.u39", 0x0000, 0x8000, CRC(16a7651e) SHA1(4cbd4ba6c6c915c04dfc913ec49f87c1dd7344e3), ROM_BIOS(2) | ROM_SKIP(1) ) - ROMX_LOAD( "comp302.u35", 0x0001, 0x8000, CRC(ae546bef) SHA1(572e45030de552bb1949a7facbc885b8bf033fc6), ROM_BIOS(2) | ROM_SKIP(1) ) - - ROM_SYSTEM_BIOS( 2, "v303", "Compis II v3.03 (1987-03-09)" ) - ROMX_LOAD( "rysa094.u39", 0x0000, 0x8000, CRC(e7302bff) SHA1(44ea20ef4008849af036c1a945bc4f27431048fb), ROM_BIOS(3) | ROM_SKIP(1) ) - ROMX_LOAD( "rysa094.u35", 0x0001, 0x8000, CRC(b0694026) SHA1(eb6b2e3cb0f42fd5ffdf44f70e652ecb9714ce30), ROM_BIOS(3) | ROM_SKIP(1) ) -ROM_END - -#define rom_compis2 rom_compis - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP(1985, compis, 0, 0, compis, compis, driver_device, 0, "Telenova", "Compis" , MACHINE_NOT_WORKING ) -COMP(1986, compis2, compis, 0, compis2, compis, driver_device, 0, "Telenova", "Compis II" , MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/compucolor.c b/src/mess/drivers/compucolor.c deleted file mode 100644 index 2286c43f10f..00000000000 --- a/src/mess/drivers/compucolor.c +++ /dev/null @@ -1,506 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Compucolor II - - http://www.compucolor.org/index.html - -*/ - -/* - - TODO: - - - floppy - - interlaced video - - add-on ROM - - add-on RAM - - add-on unit - -*/ - -#define I8080_TAG "ua2" -#define TMS5501_TAG "ud2" -#define CRT5027_TAG "uf9" -#define RS232_TAG "rs232" - -#include "bus/rs232/rs232.h" -#include "cpu/i8085/i8085.h" -#include "bus/compucolor/floppy.h" -#include "machine/ram.h" -#include "machine/tms5501.h" -#include "video/tms9927.h" - -class compucolor2_state : public driver_device -{ -public: - compucolor2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8080_TAG), - m_mioc(*this, TMS5501_TAG), - m_vtac(*this, CRT5027_TAG), - m_palette(*this, "palette"), - m_rs232(*this, RS232_TAG), - m_floppy0(*this, "cd0"), - m_floppy1(*this, "cd1"), - m_char_rom(*this, "chargen"), - m_video_ram(*this, "videoram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_y11(*this, "Y11"), - m_y12(*this, "Y12"), - m_y13(*this, "Y13"), - m_y14(*this, "Y14"), - m_y15(*this, "Y15"), - m_y128(*this, "Y128") - { } - - required_device m_maincpu; - required_device m_mioc; - required_device m_vtac; - required_device m_palette; - required_device m_rs232; - required_device m_floppy0; - required_device m_floppy1; - required_memory_region m_char_rom; - required_shared_ptr m_video_ram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_y11; - required_ioport m_y12; - required_ioport m_y13; - required_ioport m_y14; - required_ioport m_y15; - required_ioport m_y128; - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( xi_r ); - DECLARE_WRITE8_MEMBER( xo_w ); - DECLARE_WRITE_LINE_MEMBER( xmt_w ); - - IRQ_CALLBACK_MEMBER( int_ack ); - - UINT8 m_xo; -}; - -static ADDRESS_MAP_START( compucolor2_mem, AS_PROGRAM, 8, compucolor2_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION(I8080_TAG, 0) - AM_RANGE(0x6000, 0x6fff) AM_MIRROR(0x1000) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( compucolor2_io, AS_IO, 8, compucolor2_state ) - AM_RANGE(0x00, 0x0f) AM_MIRROR(0x10) AM_DEVICE(TMS5501_TAG, tms5501_device, io_map) - AM_RANGE(0x60, 0x6f) AM_MIRROR(0x10) AM_DEVREADWRITE(CRT5027_TAG, crt5027_device, read, write) - AM_RANGE(0x80, 0x9f) AM_MIRROR(0x60) AM_ROM AM_REGION("ua1", 0) -ADDRESS_MAP_END - -static INPUT_PORTS_START( compucolor2 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("_ CRT") PORT_CHAR('_') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F15 PLOT ESC") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BL/A7 OFF") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BLINK ON") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("^ USER") PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F14 CHAR RECT") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A7 ON") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BG ON") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("m M TERM MODE") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("] BLCK") PORT_CHAR(']') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F13 POINT X") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FG ON") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("l L LOCL") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ 45 UP") PORT_CHAR('\\') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F12 POINT Y") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE PAGE") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("k K ROLL") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ VIS") PORT_CHAR('[') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F11 POINT INC") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE LINE") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("z Z 45 DW") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 X BAR XO") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad X") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("y Y TEST") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 X BAR Y") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("h H HALF") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("x X XMIT") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 X BAR XM") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("g G BELL") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("w W BASIC") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 X BAR INC") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LIST") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("v V DEL LINE") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 Y BAR YO") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("POKE") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("e E BSC RST") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("u U INS LINE") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 Y BAR X") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AUTO") PORT_CODE(KEYCODE_PGDN) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y11") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("d D DISK FCS") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("t T TEXT EDIT") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 Y BAR YM") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE CHAR") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOAD") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y12") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("c C CURSOR X-Y") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("s S ASMB") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 Y BAR INC") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT LINE") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SAVE") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y13") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("b B PLOT") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("r R BAUD RATE") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 VECT X1") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE LINE") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PLOT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y14") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("a A PROT BLND") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("q Q INS CHAR") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 VECT Y1") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT CHAR") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PUT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y15") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@ NULL") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("p P CPU OP SYS") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F0 VECT INC") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK ATTN") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("OUT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y128") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CPU RESET") - PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPEAT") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) -INPUT_PORTS_END - -UINT32 compucolor2_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - for (int y = 0; y < 32*8; y++) - { - offs_t offset = (y / 8) * 128; - - for (int sx = 0; sx < 64; sx++) - { - UINT8 code = m_video_ram[offset++]; - UINT8 attr = m_video_ram[offset++]; - - offs_t char_offs = ((code & 0x7f) << 3) | (y & 0x07); - if (BIT(code, 7)) char_offs = ((code & 0x7f) << 3) | ((y >> 1) & 0x07); - - UINT8 data = m_char_rom->base()[char_offs]; - - rgb_t fg = m_palette->pen_color(attr & 0x07); - rgb_t bg = m_palette->pen_color((attr >> 3) & 0x07); - - for (int x = 0; x < 6; x++) - { - bitmap.pix32(y, (sx * 6) + x) = BIT(data, 7) ? fg : bg; - - data <<= 1; - } - } - } - - return 0; -} - -READ8_MEMBER( compucolor2_state::xi_r ) -{ - UINT8 data = 0xff; - - switch ((m_xo >> 4) & 0x03) - { - case 0: - switch (m_xo & 0x0f) - { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; - case 10: data &= m_y10->read(); break; - case 11: data &= m_y11->read(); break; - case 12: data &= m_y12->read(); break; - case 13: data &= m_y13->read(); break; - case 14: data &= m_y14->read(); break; - case 15: data &= m_y15->read(); break; - } - - if (BIT(m_xo, 7)) - { - data = (m_y128->read() & 0xf0) | (data & 0x0f); - } - break; - - default: - data = 0; - } - - return data; -} - -WRITE8_MEMBER( compucolor2_state::xo_w ) -{ - /* - - bit description - - 0 Keyboard A0, Stepper Phase 0 - 1 Keyboard A1, Stepper Phase 1 - 2 Keyboard A2, Stepper Phase 2 - 3 Keyboard A3, Disk _R/W - 4 00=Keyboard/Modem, 01=Internal Drive (CD0), 10=External Drive (CD1) - 5 ^ - 6 LED - 7 0=Normal Keyboard, 1=SHIFT/CONTROL/REPEAT/CAPS LOCK - - */ - - m_xo = data; - - switch ((m_xo >> 4) & 0x03) - { - case 1: - m_floppy0->select_w(0); - m_floppy0->rw_w(BIT(data, 3)); - m_floppy0->stepper_w(data & 0x07); - - m_floppy1->select_w(1); - break; - - case 2: - m_floppy1->select_w(0); - m_floppy1->rw_w(BIT(data, 3)); - m_floppy1->stepper_w(data & 0x07); - - m_floppy0->select_w(1); - break; - } -} - -WRITE_LINE_MEMBER( compucolor2_state::xmt_w ) -{ - switch ((m_xo >> 4) & 0x03) - { - case 0: - m_rs232->write_txd(state); - break; - - case 1: - m_floppy0->write_txd(state); - break; - - case 2: - m_floppy1->write_txd(state); - break; - } -} - -IRQ_CALLBACK_MEMBER( compucolor2_state::int_ack ) -{ - return m_mioc->get_vector(); -} - -void compucolor2_state::machine_start() -{ - // state saving - save_item(NAME(m_xo)); -} - -void compucolor2_state::machine_reset() -{ - m_rs232->write_rts(1); - m_rs232->write_dtr(1); -} - -static MACHINE_CONFIG_START( compucolor2, compucolor2_state ) - // basic machine hardware - MCFG_CPU_ADD(I8080_TAG, I8080, XTAL_17_9712MHz/9) - MCFG_CPU_PROGRAM_MAP(compucolor2_mem) - MCFG_CPU_IO_MAP(compucolor2_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(compucolor2_state,int_ack) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) - MCFG_SCREEN_UPDATE_DRIVER(compucolor2_state, screen_update) - MCFG_SCREEN_SIZE(64*6, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1) - - MCFG_PALETTE_ADD_3BIT_RGB("palette") - - MCFG_DEVICE_ADD(CRT5027_TAG, CRT5027, XTAL_17_9712MHz/2) - MCFG_TMS9927_CHAR_WIDTH(6) - MCFG_TMS9927_VSYN_CALLBACK(DEVWRITELINE(TMS5501_TAG, tms5501_device, sens_w)) - MCFG_VIDEO_SET_SCREEN("screen") - - // devices - MCFG_DEVICE_ADD(TMS5501_TAG, TMS5501, XTAL_17_9712MHz/9) - MCFG_TMS5501_IRQ_CALLBACK(INPUTLINE(I8080_TAG, I8085_INTR_LINE)) - MCFG_TMS5501_XMT_CALLBACK(WRITELINE(compucolor2_state, xmt_w)) - MCFG_TMS5501_XI_CALLBACK(READ8(compucolor2_state, xi_r)) - MCFG_TMS5501_XO_CALLBACK(WRITE8(compucolor2_state, xo_w)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w)) - - MCFG_COMPUCOLOR_FLOPPY_PORT_ADD("cd0", compucolor_floppy_port_devices, "floppy") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w)) - - MCFG_COMPUCOLOR_FLOPPY_PORT_ADD("cd1", compucolor_floppy_port_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(TMS5501_TAG, tms5501_device, rcv_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("8K,16K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "compclr2_flop") -MACHINE_CONFIG_END - -ROM_START( compclr2 ) - ROM_REGION( 0x4000, I8080_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "678", "v6.78" ) - ROMX_LOAD( "v678.rom", 0x0000, 0x4000, BAD_DUMP CRC(5e559469) SHA1(fe308774aae1294c852fe24017e58d892d880cd3), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "879", "v8.79" ) - ROMX_LOAD( "v879.rom", 0x0000, 0x4000, BAD_DUMP CRC(4de8e652) SHA1(e5c55da3ac893b8a5a99c8795af3ca72b1645f3f), ROM_BIOS(2) ) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "chargen.uf6", 0x000, 0x400, BAD_DUMP CRC(7eef135a) SHA1(be488ef32f54c6e5f551fb84ab12b881aef72dd9) ) - ROM_LOAD( "chargen.uf7", 0x400, 0x400, BAD_DUMP CRC(2bee7cf6) SHA1(808e0fc6f2332b4297de190eafcf84668703e2f4) ) - - ROM_REGION( 0x20, "ua1", 0 ) - ROM_LOAD( "82s123.ua1", 0x00, 0x20, BAD_DUMP CRC(27ae54bc) SHA1(ccb056fbc1ec2132f2602217af64d77237494afb) ) // I/O PROM - - ROM_REGION( 0x20, "proms", 0 ) - ROM_LOAD( "82s129.ue2", 0x00, 0x20, NO_DUMP ) // Address Decoder/Timer for RAM - ROM_LOAD( "82s129.uf3", 0x00, 0x20, NO_DUMP ) // System Decoder - ROM_LOAD( "82s123.ub3", 0x00, 0x20, NO_DUMP ) // ROM/PROM Decoder - ROM_LOAD( "82s129.uf8", 0x00, 0x20, NO_DUMP ) // CPU & Horizontal Decoder - ROM_LOAD( "82s129.ug9", 0x00, 0x20, NO_DUMP ) // Scan Decoder - ROM_LOAD( "82s129.ug5", 0x00, 0x20, NO_DUMP ) // Color PROM -ROM_END - -COMP( 1977, compclr2, 0, 0, compucolor2, compucolor2, driver_device, 0, "Intelligent Systems Corporation", "Compucolor II", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/comquest.c b/src/mess/drivers/comquest.c deleted file mode 100644 index 5329f09e1d4..00000000000 --- a/src/mess/drivers/comquest.c +++ /dev/null @@ -1,310 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - Peter.Trauner@jk.uni-linz.ac.at September 2000 - -******************************************************************************/ -/* -comquest plus -------------- -team concepts - -laptop for childs - -language german - -lcd black/white, about 128x64, manual contrast control -keyboard and 2 button joypad -speaker 2, manual volume control:2 levels -cartridge slot, serial port - -512 kbyte rom on print with little isolation/case -12 pin chip on print with little isolation/case (eeprom? at i2c bus) -cpu on print, soldered so nothing visible -32 kbyte sram - -compuest a4 power printer -------------------------- -line oriented ink printer (12 pixel head) -for comquest serial port - -3 buttons, 2 leds -bereit -druckqualitaet -zeilenvorschub/seitenvorschub - -only chip on board (40? dil) -lsc43331op -team concepts -icq3250a-d -1f71lctctab973 - - */ - -#include "emu.h" -#include "cpu/m6805/m6805.h" -#include "includes/comquest.h" - -#ifdef UNUSED_FUNCTION -READ8_MEMBER(comquest_state::comquest_read) -{ - UINT8 data=0; - logerror("comquest read %.4x %.2x\n",offset,data); - return data; -} - -WRITE8_MEMBER(comquest_state::comquest_write) -{ - logerror("comquest read %.4x %.2x\n",offset,data); -} -#endif - -static ADDRESS_MAP_START( comquest_mem , AS_PROGRAM, 8, comquest_state ) -// { 0x0000, 0x7fff, SMH_BANK(1) }, - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xffff) AM_READONLY AM_WRITENOP -// { 0x8000, 0xffff, SMH_RAM }, // batterie buffered -ADDRESS_MAP_END - -static INPUT_PORTS_START( comquest ) - PORT_START("in0") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EIN") - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_START("in1") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Druck") PORT_CODE(KEYCODE_PRTSCR) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AUS") - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 Paragraph") PORT_CODE(KEYCODE_3) - PORT_START("in2") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %%") PORT_CODE(KEYCODE_5) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 /") PORT_CODE(KEYCODE_7) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 =") PORT_CODE(KEYCODE_0) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sharp-s ?") PORT_CODE(KEYCODE_EQUALS) - PORT_START("in3") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("acute") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("delete") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T +") PORT_CODE(KEYCODE_T) - PORT_START("in4") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z -") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U 4") PORT_CODE(KEYCODE_U) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I 5") PORT_CODE(KEYCODE_I) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O 6") PORT_CODE(KEYCODE_O) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Diaresis-U") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ *") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("capslock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_START("in5") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G mul") PORT_CODE(KEYCODE_G) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H div") PORT_CODE(KEYCODE_H) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J 1") PORT_CODE(KEYCODE_J) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K 2") PORT_CODE(KEYCODE_K) - PORT_START("in6") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L 3") PORT_CODE(KEYCODE_L) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Diaresis-O") - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Diaresis-A") - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("left-shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_START("in7") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B root") PORT_CODE(KEYCODE_B) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N square") PORT_CODE(KEYCODE_N) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". :") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("right-shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_START("in8") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Entf") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Strg") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AC") - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Spieler left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stufe up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Antwort down") PORT_CODE(KEYCODE_DOWN) - PORT_START("in9") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" right") PORT_CODE(KEYCODE_RIGHT) -#if 0 -/* - left button, right button - joypad: - left button, right button - 4 or 8 directions -*/ - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_7) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_6) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_7) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_6) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_7) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_6) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_7) -#endif - -INPUT_PORTS_END - -static const gfx_layout comquest_charlayout = -{ - 8,8, - 256*8, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - /* x offsets */ - { - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - }, - /* y offsets */ - { - 0, - 8, - 16, - 24, - 32, - 40, - 48, - 56, - }, - 8*8 -}; - -static GFXDECODE_START( comquest ) - GFXDECODE_ENTRY( "gfx1", 0x0000, comquest_charlayout, 0, 2 ) -GFXDECODE_END - - -void comquest_state::machine_reset() -{ -// UINT8 *mem=memregion("user1")->base(); -// membank(1)->set_base(mem+0x00000); -} - -static const UINT32 amask= 0xffff; - - -static MACHINE_CONFIG_START( comquest, comquest_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6805, 4000000) /* 4000000? */ - /*MCFG_CPU_ADD("maincpu", HD63705, 4000000) instruction set looks like m6805/m6808 */ - /*MCFG_CPU_ADD("maincpu", M68705, 4000000) instruction set looks like m6805/m6808 */ - -/* - 8 bit bus, integrated io, serial io?, - - starts at address zero? - - not saturn, although very similar hardware compared to hp48g (build into big plastic case) - not sc61860, 62015? - not cdp1802 - not tms9900? - not z80 - not 6502, mitsubishi 740 - not i86 - not 6809 - not 68008? - not tms32010 - not t11 - not arm - not 8039 - not tms370 - not lh5801 - not fujitsu mb89150 - not epson e0c88 -*/ - - MCFG_CPU_PROGRAM_MAP(comquest_mem) - MCFG_CPU_CONFIG( amask ) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(LCD_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*4, 128) /* 160 x 102 */ - MCFG_SCREEN_VISIBLE_AREA(0, 64*4-1, 0, 128-1) - MCFG_SCREEN_UPDATE_DRIVER(comquest_state, screen_update_comquest) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", comquest ) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - /* sound hardware */ - /* unknown ? */ -MACHINE_CONFIG_END - -ROM_START(comquest) -// ROM_REGION(0x10000,"maincpu",0) -// ROM_REGION(0x80000,"user1",0) - ROM_REGION(0x100000,"maincpu",0) - ROM_LOAD("comquest.bin", 0x00000, 0x80000, CRC(2bf4b1a8) SHA1(8d1821cbde37cca2055b18df001438f7d138a8c1)) -/* -000 +16kbyte graphics data? (first bytes: 80 0d 04 00 00 08 04 00 0f 02 04 01 00 10 04 01) -040 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 4f c7 f1 1d 4f) -080 8kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 10 a9 4f c7 f1) -0a0 8kbyte code (first bytes: 00 00 00 00 9a a6 00 c7 f5 ca cd 7c 9b cd 7c 98) -0c0 16kbyte code (first bytes: 00 00 00 00 a6 0a cd 7c c8 cd 7c 9b cd 7c 98 a6) -100 8kbyte code (first bytes: 00 00 00 00 a6 0a cd 7c c8 cd 7c 9b cd 7c 98 a6) -120 8kbyte data -140 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 a6 0d c7 fd 0f) -180 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 a6 00 c7 f2 2c) -1c0 16kbyte code (first bytes: 00 00 00 00 9a a6 00 c7 f3 00 c7 f3 02 a6 ff c7) -200 16kbyte code (first bytes: 00 00 00 00 9a a6 0d c7 fd 0f cd 7c 92 cd 7c 9b) -240 8kbyte code (first bytes: 00 00 00 00 9d 9d 9d 9d 9d 9d 9d 9d cd 7c 9b cd) -260 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 a6 00 b7 75 b7) -2a0 8kbyte code (first bytes: 00 00 00 00 a6 0a cd 7c c8 cd 7c 9b cd 7c 98 a6) -2c0 8kbyte code (first bytes: 00 00 00 00 a6 03 c7 fd 0f cd 7c 92 cd 7c 9b cd) -2e0 8kbyte code? (first bytes: 00 00 00 00 a6 0d c7 fd 0f cd 7c 92 cc 80 f1 20) -300 luts?+text (first bytes: 60 02 fb 08 9a 11 a1 1f 75 26 dc 2f 6a 3b 26 46) -720 empty -740 empty -760 empty -780 16kbyte code (first bytes: 00 00 00 00 cd 7c 9b cd 7c 98 4f cd 7c ad a6 0a) -7c0 16kbyte code (first bytes: 00 00 00 00 9a cd 7c 9b cd 7c 98 4f c7 f1 6e c7) - */ - -// ROM_REGION(0x100,"gfx1",0) - ROM_REGION(0x80000,"gfx1",0) - ROM_LOAD("comquest.bin", 0x00000, 0x80000, CRC(2bf4b1a8) SHA1(8d1821cbde37cca2055b18df001438f7d138a8c1)) -ROM_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT MONITOR COMPANY FULLNAME */ -CONS( 1995, comquest, 0, 0, comquest, comquest, driver_device, 0, "Data Concepts", "ComQuest Plus (German)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/comx35.c b/src/mess/drivers/comx35.c deleted file mode 100644 index 04bc334ce40..00000000000 --- a/src/mess/drivers/comx35.c +++ /dev/null @@ -1,723 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - TODO: - - - tape input/output - - PL-80 plotter - - serial printer - - thermal printer - -*/ - -#include "includes/comx35.h" -#include "formats/imageutl.h" - - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -#define LOG 0 - -enum -{ - COMX_TYPE_BINARY = 1, - COMX_TYPE_BASIC, - COMX_TYPE_BASIC_FM, - COMX_TYPE_RESERVED, - COMX_TYPE_DATA -}; - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -/*------------------------------------------------- - image_fread_memory - read image to memory --------------------------------------------------*/ - -void comx35_state::image_fread_memory(device_image_interface &image, UINT16 addr, UINT32 count) -{ - UINT8 *ram = m_ram->pointer() + (addr - 0x4000); - - image.fread(ram, count); -} - -/*------------------------------------------------- - QUICKLOAD_LOAD_MEMBER( comx35_state, comx35_comx ) --------------------------------------------------*/ - -QUICKLOAD_LOAD_MEMBER( comx35_state, comx35_comx ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - UINT8 header[16] = {0}; - int size = image.length(); - - if (size > m_ram->size()) - { - return IMAGE_INIT_FAIL; - } - - image.fread( header, 5); - - if (header[1] != 'C' || header[2] != 'O' || header[3] != 'M' || header[4] != 'X' ) - { - return IMAGE_INIT_FAIL; - } - - switch (header[0]) - { - case COMX_TYPE_BINARY: - /* - - Type 1: pure machine code (i.e. no basic) - - Byte 0 to 4: 1 - 'COMX' - Byte 5 and 6: Start address (1802 way; see above) - Byte 6 and 7: End address - Byte 9 and 10: Execution address - - Byte 11 to Eof, should be stored in ram from start to end; execution address - 'xxxx' for the CALL (@xxxx) basic statement to actually run the code. - - */ - { - UINT16 start_address, end_address, run_address; - - image.fread(header, 6); - - start_address = pick_integer_be(header, 0, 2); - end_address = pick_integer_be(header, 2, 2); - run_address = pick_integer_be(header, 4, 2); - - image_fread_memory(image, start_address, end_address - start_address); - - popmessage("Type CALL (@%04x) to start program", run_address); - } - break; - - case COMX_TYPE_BASIC: - /* - - Type 2: Regular basic code or machine code followed by basic - - Byte 0 to 4: 2 - 'COMX' - Byte 5 and 6: DEFUS value, to be stored on 0x4281 and 0x4282 - Byte 7 and 8: EOP value, to be stored on 0x4283 and 0x4284 - Byte 9 and 10: End array, start string to be stored on 0x4292 and 0x4293 - Byte 11 and 12: start array to be stored on 0x4294 and 0x4295 - Byte 13 and 14: EOD and end string to be stored on 0x4299 and 0x429A - - Byte 15 to Eof to be stored on 0x4400 and onwards - - Byte 0x4281-0x429A (or at least the ones above) should be set otherwise - BASIC won't 'see' the code. - - */ - - image_fread_memory(image, 0x4281, 4); - image_fread_memory(image, 0x4292, 4); - image_fread_memory(image, 0x4299, 2); - image_fread_memory(image, 0x4400, size); - break; - - case COMX_TYPE_BASIC_FM: - /* - - Type 3: F&M basic load - - Not the most important! But we designed our own basic extension, you can - find it in the F&M basic folder as F&M Basic.comx. When you run this all - basic code should start at address 0x6700 instead of 0x4400 as from - 0x4400-0x6700 the F&M basic stuff is loaded. So format is identical to Type - 2 except Byte 15 to Eof should be stored on 0x6700 instead. .comx files of - this format can also be found in the same folder as the F&M basic.comx file. - - */ - - image_fread_memory(image, 0x4281, 4); - image_fread_memory(image, 0x4292, 4); - image_fread_memory(image, 0x4299, 2); - image_fread_memory(image, 0x6700, size); - break; - - case COMX_TYPE_RESERVED: - /* - - Type 4: Incorrect DATA format, I suggest to forget this one as it won't work - in most cases. Instead I left this one reserved and designed Type 5 instead. - - */ - break; - - case COMX_TYPE_DATA: - /* - - Type 5: Data load - - Byte 0 to 4: 5 - 'COMX' - Byte 5 and 6: Array length - Byte 7 to Eof: Basic 'data' - - To load this first get the 'start array' from the running COMX, i.e. address - 0x4295/0x4296. Calculate the EOD as 'start array' + length of the data (i.e. - file length - 7). Store the EOD back on 0x4299 and ox429A. Calculate the - 'Start String' as 'start array' + 'Array length' (Byte 5 and 6). Store the - 'Start String' on 0x4292/0x4293. Load byte 7 and onwards starting from the - 'start array' value fetched from 0x4295/0x4296. - - */ - { - UINT16 start_array, end_array, start_string, array_length; - - image.fread(header, 2); - - array_length = pick_integer_be(header, 0, 2); - start_array = (program.read_byte(0x4295) << 8) | program.read_byte(0x4296); - end_array = start_array + (size - 7); - - program.write_byte(0x4299, end_array >> 8); - program.write_byte(0x429a, end_array & 0xff); - - start_string = start_array + array_length; - - program.write_byte(0x4292, start_string >> 8); - program.write_byte(0x4293, start_string & 0xff); - - image_fread_memory(image, start_array, size); - } - break; - } - - return IMAGE_INIT_PASS; -} - -//************************************************************************** -// MEMORY ACCESS -//************************************************************************** - -//------------------------------------------------- -// mem_r - memory read -//------------------------------------------------- - -READ8_MEMBER( comx35_state::mem_r ) -{ - int extrom = 1; - - UINT8 data = m_exp->mrd_r(space, offset, &extrom); - - if (offset < 0x4000) - { - if (extrom) data = m_rom->base()[offset & 0x3fff]; - } - else if (offset >= 0x4000 && offset < 0xc000) - { - data = m_ram->pointer()[offset - 0x4000]; - } - else if (offset >= 0xf400 && offset < 0xf800) - { - data = m_vis->char_ram_r(space, offset & 0x3ff); - } - - return data; -} - - -//------------------------------------------------- -// mem_w - memory write -//------------------------------------------------- - -WRITE8_MEMBER( comx35_state::mem_w ) -{ - m_exp->mwr_w(space, offset, data); - - if (offset >= 0x4000 && offset < 0xc000) - { - m_ram->pointer()[offset - 0x4000] = data; - } - else if (offset >= 0xf400 && offset < 0xf800) - { - m_vis->char_ram_w(space, offset & 0x3ff, data); - } - else if (offset >= 0xf800) - { - m_vis->page_ram_w(space, offset & 0x3ff, data); - } -} - - -//------------------------------------------------- -// io_r - I/O read -//------------------------------------------------- - -READ8_MEMBER( comx35_state::io_r ) -{ - UINT8 data = m_exp->io_r(space, offset); - - if (offset == 3) - { - data = m_kbe->read(space, 0); - } - - return data; -} - - -//------------------------------------------------- -// io_w - I/O write -//------------------------------------------------- - -WRITE8_MEMBER( comx35_state::io_w ) -{ - m_exp->io_w(space, offset, data); - - if (offset >= 3) - { - cdp1869_w(space, offset, data); - } -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( comx35_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( comx35_mem, AS_PROGRAM, 8, comx35_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_READWRITE(mem_r, mem_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( comx35_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( comx35_io, AS_IO, 8, comx35_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x07) AM_READWRITE(io_r, io_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_CHANGED_MEMBER( comx35_reset ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( comx35_state::trigger_reset ) -{ - if (newval && BIT(m_d6->read(), 7)) - { - machine_reset(); - } -} - - -//------------------------------------------------- -// INPUT_PORTS( comx35 ) -//------------------------------------------------- - -static INPUT_PORTS_START( comx35 ) - PORT_START("D1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 \xE2\x96\xA0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('?') - - PORT_START("D2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('[') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(']') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('<') PORT_CHAR('(') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('=') PORT_CHAR('^') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('>') PORT_CHAR(')') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('_') - - PORT_START("D3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('?') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("D4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("D5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("D6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR('+') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('|') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('}') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('~') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(8) - - PORT_START("D7") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("D8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("D9") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("D10") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("D11") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("MODIFIERS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_WRITE_LINE_DEVICE_MEMBER(CDP1871_TAG, cdp1871_device, shift_w) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CNTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) PORT_WRITE_LINE_DEVICE_MEMBER(CDP1871_TAG, cdp1871_device, control_w) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("RESET") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RT") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CHANGED_MEMBER(DEVICE_SELF, comx35_state, trigger_reset, 0) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// COSMAC_INTERFACE( cosmac_intf ) -//------------------------------------------------- - -void comx35_state::check_interrupt() -{ - m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, m_cr1 || m_int); -} - -READ_LINE_MEMBER( comx35_state::clear_r ) -{ - return m_clear; -} - -READ_LINE_MEMBER( comx35_state::ef2_r ) -{ - if (m_iden) - { - // interrupts disabled: PAL/NTSC - return m_vis->pal_ntsc_r(); - } - else - { - // interrupts enabled: keyboard repeat - return m_kbe->rpt_r(); - } -} - -READ_LINE_MEMBER( comx35_state::ef4_r ) -{ - return m_exp->ef4_r(); // | (m_cassette->input() > 0.0f); -} - -WRITE_LINE_MEMBER( comx35_state::q_w ) -{ - m_q = state; - - if (m_iden && state) - { - // enable interrupts - m_iden = 0; - } - - // cassette output - m_cassette->output(state ? +1.0 : -1.0); - - // expansion bus - m_exp->q_w(state); -} - -WRITE8_MEMBER( comx35_state::sc_w ) -{ - switch (data) - { - case COSMAC_STATE_CODE_S0_FETCH: - // not connected - break; - - case COSMAC_STATE_CODE_S1_EXECUTE: - // every other S1 triggers a DMAOUT request - if (m_dma) - { - m_dma = 0; - - if (!m_iden) - { - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAOUT, ASSERT_LINE); - } - } - else - { - m_dma = 1; - } - break; - - case COSMAC_STATE_CODE_S2_DMA: - // DMA acknowledge clears the DMAOUT request - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAOUT, CLEAR_LINE); - break; - - case COSMAC_STATE_CODE_S3_INTERRUPT: - // interrupt acknowledge clears the INT request - m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, CLEAR_LINE); - break; - } -} - - -//------------------------------------------------- -// COMX_EXPANSION_INTERFACE( expansion_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( comx35_state::irq_w ) -{ - m_int = state; - check_interrupt(); -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void comx35_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_ID_RESET: - m_clear = 1; - break; - } -} - - -//------------------------------------------------- -// MACHINE_START( comx35 ) -//------------------------------------------------- - -void comx35_state::machine_start() -{ - // clear the RAM since DOS card will go crazy if RAM is not all zeroes - UINT8 *ram = m_ram->pointer(); - memset(ram, 0, m_ram->size()); - - // register for state saving - save_item(NAME(m_clear)); - save_item(NAME(m_q)); - save_item(NAME(m_iden)); - save_item(NAME(m_dma)); - save_item(NAME(m_int)); - save_item(NAME(m_prd)); - save_item(NAME(m_cr1)); -} - - -void comx35_state::machine_reset() -{ - m_exp->reset(); - - int t = RES_K(27) * CAP_U(1) * 1000; // t = R1 * C1 - - m_clear = 0; - m_iden = 1; - m_cr1 = 1; - m_int = CLEAR_LINE; - m_prd = CLEAR_LINE; - - timer_set(attotime::from_msec(t), TIMER_ID_RESET); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( pal ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pal, comx35_state ) - // basic system hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, CDP1869_CPU_CLK_PAL) - MCFG_CPU_PROGRAM_MAP(comx35_mem) - MCFG_CPU_IO_MAP(comx35_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(comx35_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(comx35_state, ef2_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(comx35_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(comx35_state, q_w)) - MCFG_COSMAC_SC_CALLBACK(WRITE8(comx35_state, sc_w)) - - // sound and video hardware - MCFG_FRAGMENT_ADD(comx35_pal_video) - - // peripheral hardware - MCFG_DEVICE_ADD(CDP1871_TAG, CDP1871, CDP1869_CPU_CLK_PAL/8) - MCFG_CDP1871_D1_CALLBACK(IOPORT("D1")) - MCFG_CDP1871_D2_CALLBACK(IOPORT("D2")) - MCFG_CDP1871_D3_CALLBACK(IOPORT("D3")) - MCFG_CDP1871_D4_CALLBACK(IOPORT("D4")) - MCFG_CDP1871_D5_CALLBACK(IOPORT("D5")) - MCFG_CDP1871_D6_CALLBACK(IOPORT("D6")) - MCFG_CDP1871_D7_CALLBACK(IOPORT("D7")) - MCFG_CDP1871_D8_CALLBACK(IOPORT("D8")) - MCFG_CDP1871_D9_CALLBACK(IOPORT("D9")) - MCFG_CDP1871_D10_CALLBACK(IOPORT("D10")) - MCFG_CDP1871_D11_CALLBACK(IOPORT("D11")) - MCFG_CDP1871_DA_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF3)) - MCFG_QUICKLOAD_ADD("quickload", comx35_state, comx35_comx, "comx", 0) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - // expansion bus - MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, comx_expansion_cards, "eb") - MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(comx35_state, irq_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( ntsc ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ntsc, comx35_state ) - // basic system hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, CDP1869_CPU_CLK_NTSC) - MCFG_CPU_PROGRAM_MAP(comx35_mem) - MCFG_CPU_IO_MAP(comx35_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(comx35_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(comx35_state, ef2_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(comx35_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(comx35_state, q_w)) - MCFG_COSMAC_SC_CALLBACK(WRITE8(comx35_state, sc_w)) - - // sound and video hardware - MCFG_FRAGMENT_ADD(comx35_ntsc_video) - - // peripheral hardware - MCFG_DEVICE_ADD(CDP1871_TAG, CDP1871, CDP1869_CPU_CLK_PAL/8) - MCFG_CDP1871_D1_CALLBACK(IOPORT("D1")) - MCFG_CDP1871_D2_CALLBACK(IOPORT("D2")) - MCFG_CDP1871_D3_CALLBACK(IOPORT("D3")) - MCFG_CDP1871_D4_CALLBACK(IOPORT("D4")) - MCFG_CDP1871_D5_CALLBACK(IOPORT("D5")) - MCFG_CDP1871_D6_CALLBACK(IOPORT("D6")) - MCFG_CDP1871_D7_CALLBACK(IOPORT("D7")) - MCFG_CDP1871_D8_CALLBACK(IOPORT("D8")) - MCFG_CDP1871_D9_CALLBACK(IOPORT("D9")) - MCFG_CDP1871_D10_CALLBACK(IOPORT("D10")) - MCFG_CDP1871_D11_CALLBACK(IOPORT("D11")) - MCFG_CDP1871_DA_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF3)) - MCFG_QUICKLOAD_ADD("quickload", comx35_state, comx35_comx, "comx", 0) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - // expansion bus - MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, comx_expansion_cards, "eb") - MCFG_COMX_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(comx35_state, irq_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( comx35p ) -//------------------------------------------------- - -ROM_START( comx35p ) - ROM_REGION( 0x4000, CDP1802_TAG, 0 ) - ROM_DEFAULT_BIOS( "basic100" ) - ROM_SYSTEM_BIOS( 0, "basic100", "COMX BASIC V1.00" ) - ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "basic101", "COMX BASIC V1.01" ) - ROMX_LOAD( "comx_11.u21", 0x0000, 0x4000, CRC(609d89cd) SHA1(799646810510d8236fbfafaff7a73d5170990f16), ROM_BIOS(2) ) -ROM_END - - -//------------------------------------------------- -// ROM( comx35n ) -//------------------------------------------------- - -#define rom_comx35n rom_comx35p - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, comx35p, 0, 0, pal, comx35, driver_device, 0, "Comx World Operations Ltd", "COMX 35 (PAL)", MACHINE_IMPERFECT_SOUND ) -COMP( 1983, comx35n, comx35p,0, ntsc, comx35, driver_device, 0, "Comx World Operations Ltd", "COMX 35 (NTSC)", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mess/drivers/concept.c b/src/mess/drivers/concept.c deleted file mode 100644 index 947d4bfcfa7..00000000000 --- a/src/mess/drivers/concept.c +++ /dev/null @@ -1,320 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet, Brett Wyer -/* - Corvus Concept driver - - Relatively simple 68k-based system - - * 256 or 512 kbytes of DRAM - * 4kbytes of SRAM - * 8kbyte boot ROM - * optional MacsBugs ROM - * two serial ports, keyboard, bitmapped display, simple sound, omninet - LAN port (seems more or less similar to AppleTalk) - * 4 expansion ports enable to add expansion cards, namely floppy disk - and hard disk controllers (the expansion ports are partially compatible - with Apple 2 expansion ports) - - Video: monochrome bitmapped display, 720*560 visible area (bitmaps are 768 - pixels wide in memory). One interesting feature is the fact that the - monitor can be rotated to give a 560*720 vertical display (you need to - throw a switch and reset the machine for the display rotation to be taken - into account, though). One oddity is that the video hardware scans the - display from the lower-left corner to the upper-left corner (or from the - upper-right corner to the lower-left if the screen is flipped). - Sound: simpler buzzer connected to the via shift register - Keyboard: intelligent controller, connected through an ACIA. See CCOS - manual pp. 76 through 78. and User Guide p. 2-1 through 2-9. - Clock: mm58174 RTC - - Raphael Nabet, Brett Wyer, 2003-2005 -*/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "includes/concept.h" -#include "bus/a2bus/a2corvus.h" -#include "bus/a2bus/corvfdc01.h" -#include "bus/a2bus/corvfdc02.h" -#include "bus/rs232/rs232.h" - -static ADDRESS_MAP_START(concept_memmap, AS_PROGRAM, 16, concept_state ) - AM_RANGE(0x000000, 0x000007) AM_ROM AM_REGION("maincpu", 0x010000) /* boot ROM mirror */ - AM_RANGE(0x000008, 0x000fff) AM_RAM /* static RAM */ - AM_RANGE(0x010000, 0x011fff) AM_ROM AM_REGION("maincpu", 0x010000) /* boot ROM */ - AM_RANGE(0x020000, 0x021fff) AM_ROM /* macsbugs ROM (optional) */ - AM_RANGE(0x030000, 0x03ffff) AM_READWRITE(concept_io_r,concept_io_w) /* I/O space */ - - AM_RANGE(0x080000, 0x0fffff) AM_RAM AM_SHARE("videoram")/* AM_RAMBANK(2) */ /* DRAM */ -ADDRESS_MAP_END - - -static INPUT_PORTS_START( concept ) - - PORT_START("KEY0") /* port 0: keys 0x00 through 0x0f */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(right)") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(left)") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(down)") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) - - PORT_START("KEY1") /* port 1: keys 0x10 through 0x1f */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) - - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) - - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_BACKSLASH2) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT (r)") PORT_CODE(KEYCODE_RSHIFT) - - PORT_START("KEY2") /* port 2: keys 0x20 through 0x2f */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - - PORT_START("KEY3") /* port 3: keys 0x30 through 0x3f */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT (l)") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - - PORT_START("KEY4") /* port 4: keys 0x40 through 0x4f */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FAST") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COMMAND") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(space)") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("00") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) - - PORT_START("KEY5") /* port 5: keys 0x50 through 0x5f */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(up)") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("???") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_PAUSE) - - PORT_START("DSW0") /* port 6: on-board DIP switches */ - PORT_DIPNAME(0x01, 0x00, "Omninet Address bit 0") - PORT_DIPSETTING(0x00, DEF_STR( Off )) - PORT_DIPSETTING(0x01, DEF_STR( On )) - PORT_DIPNAME(0x02, 0x02, "Omninet Address bit 1") - PORT_DIPSETTING(0x00, DEF_STR( Off )) - PORT_DIPSETTING(0x02, DEF_STR( On )) - PORT_DIPNAME(0x04, 0x00, "Omninet Address bit 2") - PORT_DIPSETTING(0x00, DEF_STR( Off )) - PORT_DIPSETTING(0x04, DEF_STR( On )) - PORT_DIPNAME(0x08, 0x00, "Omninet Address bit 3") - PORT_DIPSETTING(0x00, DEF_STR( Off )) - PORT_DIPSETTING(0x08, DEF_STR( On )) - PORT_DIPNAME(0x10, 0x00, "Omninet Address bit 4") - PORT_DIPSETTING(0x00, DEF_STR( Off )) - PORT_DIPSETTING(0x10, DEF_STR( On )) - PORT_DIPNAME(0x20, 0x00, "Omninet Address bit 5") - PORT_DIPSETTING(0x00, DEF_STR( Off )) - PORT_DIPSETTING(0x20, DEF_STR( On )) - PORT_DIPNAME(0xc0, 0x00, "Type of Boot") - PORT_DIPSETTING(0x00, "Prompt for type of Boot") // Documentation has 0x00 and 0xc0 reversed per boot PROM - PORT_DIPSETTING(0x40, "Boot from Omninet") - PORT_DIPSETTING(0x80, "Boot from Local Disk") - PORT_DIPSETTING(0xc0, "Boot from Diskette") - -#if 0 - PORT_START("DISPLAY") /* port 7: Display orientation */ - PORT_DIPNAME(0x01, 0x00, "Screen Orientation") - PORT_DIPSETTING(0x00, "Horizontal") - PORT_DIPSETTING(0x01, "Vertical") -#endif - -INPUT_PORTS_END - - - -/* init with simple, fixed, B/W palette */ -/* Is the palette black on white or white on black??? */ - -SLOT_INTERFACE_START( concept_a2_cards ) - SLOT_INTERFACE("fchdd", A2BUS_CORVUS) /* Corvus flat-cable HDD interface (see notes in a2corvus.c) */ - SLOT_INTERFACE("fdc01", A2BUS_CORVFDC01) /* Corvus WD1793 floppy controller */ - SLOT_INTERFACE("fdc02", A2BUS_CORVFDC02) /* Corvus NEC765 buffered floppy controller */ -SLOT_INTERFACE_END - - - -static MACHINE_CONFIG_START( concept, concept_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 8182000) /* 16.364 MHz / 2 */ - MCFG_CPU_PROGRAM_MAP(concept_memmap) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_REFRESH_RATE(60) /* 50 or 60, jumper-selectable */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(720, 560) - MCFG_SCREEN_VISIBLE_AREA(0, 720-1, 0, 560-1) - MCFG_SCREEN_UPDATE_DRIVER(concept_state, screen_update_concept) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* rtc */ - MCFG_DEVICE_ADD("mm58274c", MM58274C, 0) - MCFG_MM58274C_MODE24(0) // 12 hour - MCFG_MM58274C_DAY1(1) // monday - - /* via */ - MCFG_DEVICE_ADD("via6522_0", VIA6522, 1022750) - MCFG_VIA6522_READPA_HANDLER(READ8(concept_state, via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(concept_state, via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(concept_state, via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(concept_state, via_out_b)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(concept_state, via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(concept_state, via_irq_func)) - - /* ACIAs */ - MCFG_DEVICE_ADD(ACIA_0_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232a", rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(ACIA_1_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD(KBD_ACIA_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - - /* Apple II bus */ - MCFG_DEVICE_ADD(A2BUS_TAG, A2BUS, 0) - MCFG_A2BUS_CPU("maincpu") - MCFG_A2BUS_SLOT_ADD(A2BUS_TAG, "sl1", concept_a2_cards, NULL) - MCFG_A2BUS_SLOT_ADD(A2BUS_TAG, "sl2", concept_a2_cards, NULL) - MCFG_A2BUS_SLOT_ADD(A2BUS_TAG, "sl3", concept_a2_cards, NULL) - MCFG_A2BUS_SLOT_ADD(A2BUS_TAG, "sl4", concept_a2_cards, "fdc01") - - /* 2x RS232 ports */ - MCFG_RS232_PORT_ADD("rs232a", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA_0_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA_0_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(ACIA_0_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA_0_TAG, mos6551_device, write_cts)) - - MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(ACIA_1_TAG, mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(ACIA_1_TAG, mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(ACIA_1_TAG, mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ACIA_1_TAG, mos6551_device, write_cts)) -MACHINE_CONFIG_END - - -ROM_START( concept ) - ROM_REGION16_BE(0x100000,"maincpu",0) /* 68k rom and ram */ - - // concept boot ROM - ROM_SYSTEM_BIOS(0, "lvl8", "Level 8" ) // v0? - ROMX_LOAD("bootl08h", 0x010000, 0x1000, CRC(ee479f51) SHA1(b20ba18564672196076e46507020c6d69a640a2f), ROM_BIOS(1) | ROM_SKIP(1)) - ROMX_LOAD("bootl08l", 0x010001, 0x1000, CRC(acaefd07) SHA1(de0c7eaacaf4c0652aa45e523cebce2b2993c437), ROM_BIOS(1) | ROM_SKIP(1)) - - ROM_SYSTEM_BIOS(1, "lvl7", "Level 7" ) // v0? v1? - ROMX_LOAD("cc07h", 0x010000, 0x1000, CRC(455abac8) SHA1(b12e1580220242d34eafed1b486cebd89e823c8b), ROM_BIOS(2) | ROM_SKIP(1)) - ROMX_LOAD("cc07l", 0x010001, 0x1000, CRC(107a3830) SHA1(0ea12ef13b0d11fcd83b306b3a1bb8014ba910c0), ROM_BIOS(2) | ROM_SKIP(1)) - - ROM_SYSTEM_BIOS(2, "lvl6", "Level 6" ) // v0? - ROMX_LOAD("cc06h", 0x010000, 0x1000, CRC(66b6b259) SHA1(1199a38ef3e94f695e8da6a7c80c6432da3cb80c), ROM_BIOS(3) | ROM_SKIP(1)) - ROMX_LOAD("cc06l", 0x010001, 0x1000, CRC(600940d3) SHA1(c3278bf23b3b1c35ea1e3da48a05e877862a8345), ROM_BIOS(3) | ROM_SKIP(1)) - - ROM_REGION(0x400, "proms", 0) - ROM_LOAD("map04a.bin", 0x000, 0x400, CRC(1ae0db9b) SHA1(cdb6f63bb08072b454b4704e62de51c483ede734) ) - -#if 0 - // version 1 lvl 7 release - ROM_LOAD16_BYTE("bootl17h", 0x010000, 0x1000, CRC(6dd9718f)) // where does this come from? - ROM_LOAD16_BYTE("bootl17l", 0x010001, 0x1000, CRC(107a3830)) -#elif 0 - // version $F lvl 8 (development version found on a floppy disk along with - // the source code) - ROM_LOAD16_WORD("cc.prm", 0x010000, 0x2000, CRC(b5a87dab) SHA1(0da59af6cfeeb38672f71731527beac323d9c3d6)) -#endif - -#if 0 - // only known MACSbug release for the concept, with reset vector and - // entry point (the reset vector seems to be bogus: is the ROM dump bad, - // or were the ROMs originally loaded with buggy code?) - ROM_LOAD16_BYTE("macsbugh", 0x020000, 0x1000, CRC(aa357112)) - ROM_LOAD16_BYTE("macsbugl", 0x020001, 0x1000, CRC(b4b59de9)) -#endif - -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1982, concept, 0, 0, concept, concept, driver_device, 0, "Corvus Systems", "Concept" , 0 ) diff --git a/src/mess/drivers/cortex.c b/src/mess/drivers/cortex.c deleted file mode 100644 index e208d5c1899..00000000000 --- a/src/mess/drivers/cortex.c +++ /dev/null @@ -1,107 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Powertran Cortex - - 2012-04-20 Skeleton driver. - - ftp://ftp.whtech.com/Powertran Cortex/ - http://www.powertrancortex.com/index.html - - Uses Texas Instruments parts and similar to other TI computers. - It was designed by TI engineers, so it may perhaps be a clone - of another TI or the Geneve. - - Chips: - TMS9995 - CPU - TMS9929 - Video - TMS9911 - DMA to floppy - TMS9909 - Floppy Disk Controller - AY-5-2376 - Keyboard controller - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/tms9900/tms9995.h" -#include "video/tms9928a.h" - -class cortex_state : public driver_device -{ -public: - cortex_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_p_ram(*this, "ram") - { } - - virtual void machine_reset(); - required_device m_maincpu; - required_shared_ptr m_p_ram; -}; - -static ADDRESS_MAP_START( cortex_mem, AS_PROGRAM, 8, cortex_state ) - AM_RANGE(0x0000, 0xefff) AM_RAM AM_SHARE("ram") - AM_RANGE(0xf100, 0xf11f) AM_RAM // memory mapping unit - AM_RANGE(0xf120, 0xf120) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) - AM_RANGE(0xf121, 0xf121) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) - //AM_RANGE(0xf140, 0xf147) // fdc tms9909 -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cortex_io, AS_IO, 8, cortex_state ) - ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0x0000, 0x000f) AM_READWRITE(pio_r,pio_w) - //AM_RANGE(0x0010, 0x001f) AM_READ(keyboard_r) - //AM_RANGE(0x0080, 0x00bf) AM_READWRITE(rs232_r,rs232_w) - //AM_RANGE(0x0180, 0x01bf) AM_READWRITE(cass_r,cass_w) - //AM_RANGE(0x0800, 0x080f) AM_WRITE(cent_data_w) - //AM_RANGE(0x0810, 0x0811) AM_WRITE(cent_strobe_w) - //AM_RANGE(0x0812, 0x0813) AM_READ(cent_stat_r) - //AM_RANGE(0x1ee0, 0x1eef) AM_READWRITE(cpu_int_r,cpu_int_w) - //AM_RANGE(0x1fda, 0x1fdb) AM_READWRITE(cpu_int1_r,cpu_int1_w) - AM_RANGE(0x10000, 0x10000) AM_NOP -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( cortex ) -INPUT_PORTS_END - - -void cortex_state::machine_reset() -{ - UINT8* ROM = memregion("maincpu")->base(); - memcpy(m_p_ram, ROM, 0x6000); - m_maincpu->set_ready(ASSERT_LINE); -} - -static MACHINE_CONFIG_START( cortex, cortex_state ) - /* basic machine hardware */ - /* TMS9995 CPU @ 12.0 MHz */ - // Standard variant, no overflow int - // No lines connected yet - MCFG_TMS99xx_ADD("maincpu", TMS9995, 12000000, cortex_mem, cortex_io) - - /* video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( cortex ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "basic", "Cortex Bios") - ROMX_LOAD( "cortex_ic47.bin", 0x0000, 0x2000, CRC(bdb8c7bd) SHA1(340829dcb7a65f2e830fd5aff82a312e3ed7918f), ROM_BIOS(1)) - ROMX_LOAD( "cortex_ic46.bin", 0x2000, 0x2000, CRC(4de459ea) SHA1(00a42fe556d4ffe1f85b2ce369f544b07fbd06d9), ROM_BIOS(1)) - ROMX_LOAD( "cortex_ic45.bin", 0x4000, 0x2000, CRC(b0c9b6e8) SHA1(4e20c3f0b7546b803da4805cd3b8616f96c3d923), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "forth", "FIG-Forth") - ROMX_LOAD( "forth_ic47.bin", 0x0000, 0x2000, CRC(999034be) SHA1(0dcc7404c38aa0ae913101eb0aa98da82104b5d4), ROM_BIOS(2)) - ROMX_LOAD( "forth_ic46.bin", 0x2000, 0x2000, CRC(8eca54cc) SHA1(0f1680e941ef60bb9bde9a4b843b78f30dff3202), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, cortex, 0, 0, cortex, cortex, driver_device, 0, "Powertran Cybernetics", "Cortex", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/cosmicos.c b/src/mess/drivers/cosmicos.c deleted file mode 100644 index 8ec2903c821..00000000000 --- a/src/mess/drivers/cosmicos.c +++ /dev/null @@ -1,563 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - COSMICOS - - http://retro.hansotten.nl/index.php?page=1802-cosmicos - - - HEX-monitor - - 0 - start user program - 1 - inspect and/or change memory - 2 - write memory block to cassette - 3 - read memory block from cassette - 4 - move memory block - 5 - write memory block to EPROM - C - start user program from address 0000 - -*/ - -/* - - TODO: - - - display interface INH - - 2 segment display - - single step - - ascii monitor - - PPI 8255 - - Floppy WD1793 - - COM8017 UART to printer - -*/ - -#include "includes/cosmicos.h" -#include "cosmicos.lh" - -enum -{ - MODE_RUN, - MODE_LOAD, - MODE_PAUSE, - MODE_RESET -}; - -/* Read/Write Handlers */ - -READ8_MEMBER( cosmicos_state::read ) -{ - if (m_boot) offset |= 0xc0c0; - - UINT8 data = 0; - - if (offset < 0xc000) - { - // TODO - } - else if (offset < 0xd000) - { - data = m_rom->base()[offset & 0xfff]; - } - else if (!m_ram_disable && (offset >= 0xff00)) - { - data = m_ram->pointer()[offset & 0xff]; - } - - return data; -} - -WRITE8_MEMBER( cosmicos_state::write ) -{ - if (m_boot) offset |= 0xc0c0; - - if (offset < 0xc000) - { - // TODO - } - else if (!m_ram_disable && !m_ram_protect && (offset >= 0xff00)) - { - m_ram->pointer()[offset & 0xff] = data; - } -} - -READ8_MEMBER( cosmicos_state::video_off_r ) -{ - UINT8 data = 0; - - if (!m_q) - { - data = m_cti->dispoff_r(space, 0); - } - - return data; -} - -READ8_MEMBER( cosmicos_state::video_on_r ) -{ - UINT8 data = 0; - - if (!m_q) - { - data = m_cti->dispon_r(space, 0); - } - - return data; -} - -WRITE8_MEMBER( cosmicos_state::audio_latch_w ) -{ - if (m_q) - { - m_cti->tone_latch_w(space, 0, data); - } -} - -READ8_MEMBER( cosmicos_state::hex_keyboard_r ) -{ - UINT8 data = 0; - int i; - - for (i = 0; i < 4; i++) - { - if (BIT(m_keylatch, i)) - { - UINT8 keydata = m_key_row[i]->read(); - - if (BIT(keydata, 0)) data |= 0x01; - if (BIT(keydata, 1)) data |= 0x02; - if (BIT(keydata, 2)) data |= 0x04; - if (BIT(keydata, 3)) data |= 0x06; - } - } - - return data; -} - -WRITE8_MEMBER( cosmicos_state::hex_keylatch_w ) -{ - m_keylatch = data & 0x0f; -} - -READ8_MEMBER( cosmicos_state::reset_counter_r ) -{ - m_counter = 0; - - return 0; -} - -WRITE8_MEMBER( cosmicos_state::segment_w ) -{ - m_counter++; - - if (m_counter == 10) - { - m_counter = 0; - } - - if ((m_counter > 0) && (m_counter < 9)) - { - output_set_digit_value(10 - m_counter, data); - } -} - -READ8_MEMBER( cosmicos_state::data_r ) -{ - return m_data; -} - -WRITE8_MEMBER( cosmicos_state::display_w ) -{ - m_segment = data; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( cosmicos_mem, AS_PROGRAM, 8, cosmicos_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cosmicos_io, AS_IO, 8, cosmicos_state ) -// AM_RANGE(0x00, 0x00) - AM_RANGE(0x01, 0x01) AM_READ(video_on_r) - AM_RANGE(0x02, 0x02) AM_READWRITE(video_off_r, audio_latch_w) -// AM_RANGE(0x03, 0x03) -// AM_RANGE(0x04, 0x04) - AM_RANGE(0x05, 0x05) AM_READWRITE(hex_keyboard_r, hex_keylatch_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(reset_counter_r, segment_w) - AM_RANGE(0x07, 0x07) AM_READWRITE(data_r, display_w) -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( cosmicos_state::data ) -{ - UINT8 data = m_io_data->read(); - int i; - - for (i = 0; i < 8; i++) - { - if (!BIT(data, i)) - { - m_data |= (1 << i); - output_set_led_value(LED_D0 - i, 1); - } - } -} - -INPUT_CHANGED_MEMBER( cosmicos_state::enter ) -{ - if (!newval && !m_wait && !m_clear) - { - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, ASSERT_LINE); - } -} - -INPUT_CHANGED_MEMBER( cosmicos_state::single_step ) -{ - // if in PAUSE mode, set RUN mode until TPB=active -} - -void cosmicos_state::set_cdp1802_mode(int mode) -{ - output_set_led_value(LED_RUN, 0); - output_set_led_value(LED_LOAD, 0); - output_set_led_value(LED_PAUSE, 0); - output_set_led_value(LED_RESET, 0); - - switch (mode) - { - case MODE_RUN: - output_set_led_value(LED_RUN, 1); - - m_wait = 1; - m_clear = 1; - break; - - case MODE_LOAD: - output_set_led_value(LED_LOAD, 1); - - m_wait = 0; - m_clear = 0; - break; - - case MODE_PAUSE: - output_set_led_value(LED_PAUSE, 1); - - m_wait = 1; - m_clear = 0; - break; - - case MODE_RESET: - m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, CLEAR_LINE); - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, CLEAR_LINE); - - m_wait = 1; - m_clear = 0; - m_boot = 1; - - output_set_led_value(LED_RESET, 1); - break; - } -} - -INPUT_CHANGED_MEMBER( cosmicos_state::run ) { if (!newval) set_cdp1802_mode(MODE_RUN); } -INPUT_CHANGED_MEMBER( cosmicos_state::load ) { if (!newval) set_cdp1802_mode(MODE_LOAD); } -INPUT_CHANGED_MEMBER( cosmicos_state::cosmicos_pause ) { if (!newval) set_cdp1802_mode(MODE_PAUSE); } -INPUT_CHANGED_MEMBER( cosmicos_state::reset ) { if (!newval) set_cdp1802_mode(MODE_RESET); } - -void cosmicos_state::clear_input_data() -{ - int i; - - m_data = 0; - - for (i = 0; i < 8; i++) - { - output_set_led_value(LED_D0 - i, 0); - } -} - -INPUT_CHANGED_MEMBER( cosmicos_state::clear_data ) -{ - clear_input_data(); -} - -INPUT_CHANGED_MEMBER( cosmicos_state::memory_protect ) -{ - m_ram_protect = newval; -} - -INPUT_CHANGED_MEMBER( cosmicos_state::memory_disable ) -{ - m_ram_disable = newval; -} - -static INPUT_PORTS_START( cosmicos ) - PORT_START("DATA") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, data, 0) - - PORT_START("BUTTONS") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, enter, 0) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Single Step") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, single_step, 0) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("Run") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, run, 0) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("Load") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, load, 0) - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME(DEF_STR( Pause )) PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, cosmicos_pause, 0) - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, reset, 0) - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("Clear Data") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, clear_data, 0) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("Memory Protect") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, memory_protect, 0) PORT_TOGGLE - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("Memory Disable") PORT_CHANGED_MEMBER(DEVICE_SELF, cosmicos_state, memory_disable, 0) PORT_TOGGLE - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RET") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEC") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("REQ") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SEQ") PORT_CODE(KEYCODE_F4) -INPUT_PORTS_END - -/* Video */ - -TIMER_DEVICE_CALLBACK_MEMBER(cosmicos_state::digit_tick) -{ - m_digit = !m_digit; - - output_set_digit_value(m_digit, m_segment); -} - -TIMER_DEVICE_CALLBACK_MEMBER(cosmicos_state::int_tick) -{ - m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, ASSERT_LINE); -} - -WRITE_LINE_MEMBER( cosmicos_state::dmaout_w ) -{ - m_dmaout = state; -} - -WRITE_LINE_MEMBER( cosmicos_state::efx_w ) -{ - m_efx = state; -} - -/* CDP1802 Configuration */ - -READ_LINE_MEMBER( cosmicos_state::wait_r ) -{ - return m_wait; -} - -READ_LINE_MEMBER( cosmicos_state::clear_r ) -{ - return m_clear; -} - -READ_LINE_MEMBER( cosmicos_state::ef1_r ) -{ - UINT8 special = m_special->read(); - - return BIT(special, 0); -} - -READ_LINE_MEMBER( cosmicos_state::ef2_r ) -{ - UINT8 special = m_special->read(); - int casin = (m_cassette)->input() < 0.0; - - output_set_led_value(LED_CASSETTE, casin); - - return BIT(special, 1) | BIT(special, 3) | casin; -} - -READ_LINE_MEMBER( cosmicos_state::ef3_r ) -{ - UINT8 special = m_special->read(); - - return BIT(special, 2) | BIT(special, 3); -} - -READ_LINE_MEMBER( cosmicos_state::ef4_r ) -{ - return BIT(m_buttons->read(), 0); -} - -WRITE_LINE_MEMBER( cosmicos_state::q_w ) -{ - /* cassette */ - m_cassette->output(state ? +1.0 : -1.0); - - /* boot */ - if (state) m_boot = 0; - - /* CDP1864 audio enable */ - m_cti->aoe_w(state); - - m_q = state; -} - -READ8_MEMBER( cosmicos_state::dma_r ) -{ - return m_data; -} - -WRITE8_MEMBER( cosmicos_state::sc_w ) -{ - int sc1 = BIT(data, 1); - - if (m_sc1 && !sc1) - { - clear_input_data(); - } - - if (sc1) - { - m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, CLEAR_LINE); - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, CLEAR_LINE); - } - - m_sc1 = sc1; -} - -/* Machine Initialization */ - -void cosmicos_state::machine_start() -{ - /* initialize LED display */ - m_led->rbi_w(1); - - // find keyboard rows - m_key_row[0] = m_y1; - m_key_row[1] = m_y2; - m_key_row[2] = m_y3; - m_key_row[3] = m_y4; - - /* register for state saving */ - save_item(NAME(m_wait)); - save_item(NAME(m_clear)); - save_item(NAME(m_sc1)); - save_item(NAME(m_data)); - save_item(NAME(m_boot)); - save_item(NAME(m_ram_protect)); - save_item(NAME(m_ram_disable)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_segment)); - save_item(NAME(m_digit)); - save_item(NAME(m_counter)); - save_item(NAME(m_q)); - save_item(NAME(m_dmaout)); - save_item(NAME(m_efx)); - save_item(NAME(m_video_on)); -} - -void cosmicos_state::machine_reset() -{ - set_cdp1802_mode(MODE_RESET); -} - -/* Quickload */ - -QUICKLOAD_LOAD_MEMBER( cosmicos_state, cosmicos ) -{ - UINT8 *ptr = m_rom->base(); - int size = image.length(); - - /* load image to RAM */ - image.fread(ptr, size); - - return IMAGE_INIT_PASS; -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( cosmicos, cosmicos_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) - MCFG_CPU_PROGRAM_MAP(cosmicos_mem) - MCFG_CPU_IO_MAP(cosmicos_io) - MCFG_COSMAC_WAIT_CALLBACK(READLINE(cosmicos_state, wait_r)) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(cosmicos_state, clear_r)) - MCFG_COSMAC_EF1_CALLBACK(READLINE(cosmicos_state, ef1_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(cosmicos_state, ef2_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(cosmicos_state, ef3_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(cosmicos_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(cosmicos_state, q_w)) - MCFG_COSMAC_DMAR_CALLBACK(READ8(cosmicos_state, dma_r)) - MCFG_COSMAC_SC_CALLBACK(WRITE8(cosmicos_state, sc_w)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_cosmicos ) - MCFG_DEVICE_ADD(DM9368_TAG, DM9368, 0) - MCFG_TIMER_DRIVER_ADD_PERIODIC("digit", cosmicos_state, digit_tick, attotime::from_hz(100)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("interrupt", cosmicos_state, int_tick, attotime::from_hz(1000)) - - MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) - MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), WRITELINE(cosmicos_state, dmaout_w), WRITELINE(cosmicos_state, efx_w), NULL, VCC, VCC, VCC) - MCFG_CDP1864_CHROMINANCE(RES_K(2), 0, 0, 0) // R2 - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_QUICKLOAD_ADD("quickload", cosmicos_state, cosmicos, "bin", 0) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256") - MCFG_RAM_EXTRA_OPTIONS("4K,48K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( cosmicos ) - ROM_REGION( 0x1000, CDP1802_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "hex", "Hex Monitor" ) - ROMX_LOAD( "hex.ic6", 0x000, 0x400, BAD_DUMP CRC(d25124bf) SHA1(121215ba3a979e1962327ebe73cbadf784c568d9), ROM_BIOS(1) ) /* typed in from manual */ - ROMX_LOAD( "hex.ic7", 0x400, 0x400, BAD_DUMP CRC(364ac81b) SHA1(83936ee6a7ed44632eb290889b98fb9a500f15d4), ROM_BIOS(1) ) /* typed in from manual */ - ROM_SYSTEM_BIOS( 1, "ascii", "ASCII Monitor" ) - ROMX_LOAD( "ascii.ic6", 0x000, 0x400, NO_DUMP, ROM_BIOS(2) ) - ROMX_LOAD( "ascii.ic7", 0x400, 0x400, NO_DUMP, ROM_BIOS(2) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, cosmicos, 0, 0, cosmicos, cosmicos, driver_device, 0, "Radio Bulletin", "Cosmicos", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/cp1.c b/src/mess/drivers/cp1.c deleted file mode 100644 index 298e913ee3f..00000000000 --- a/src/mess/drivers/cp1.c +++ /dev/null @@ -1,334 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Kosmos CP-1 - - 06/03/2012 Skeleton driver. - - on board there is also 8155 - KEYBOARD Membrane keyboard, 57 keys - 6 * 7 seg led display - -****************************************************************************/ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/i8155.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "cp1.lh" - -class cp1_state : public driver_device -{ -public: - cp1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_i8155(*this, "i8155"), - m_i8155_cp3(*this, "i8155_cp3"), - m_cassette(*this, "cassette"), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_line4(*this, "LINE4"), - m_io_config(*this, "CONFIG") - { } - - required_device m_maincpu; - required_device m_i8155; - required_device m_i8155_cp3; - required_device m_cassette; - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - required_ioport m_io_line3; - required_ioport m_io_line4; - required_ioport m_io_config; - - virtual void machine_reset(); - DECLARE_READ8_MEMBER(port1_r); - DECLARE_READ8_MEMBER(port2_r); - DECLARE_READ8_MEMBER(getbus); - DECLARE_READ8_MEMBER(t0_r); - DECLARE_READ8_MEMBER(t1_r); - DECLARE_WRITE8_MEMBER(port1_w); - DECLARE_WRITE8_MEMBER(port2_w); - DECLARE_WRITE8_MEMBER(putbus); - DECLARE_QUICKLOAD_LOAD_MEMBER(quickload); - - DECLARE_READ8_MEMBER(i8155_read); - DECLARE_WRITE8_MEMBER(i8155_write); - DECLARE_WRITE8_MEMBER(i8155_porta_w); - DECLARE_READ8_MEMBER(i8155_portb_r); - DECLARE_WRITE8_MEMBER(i8155_portb_w); - DECLARE_WRITE8_MEMBER(i8155_portc_w); - -private: - UINT8 m_7seg; - UINT8 m_port2; - UINT8 m_matrix; -}; - -READ8_MEMBER(cp1_state::port1_r) -{ - logerror("Read from expansion port 1\n"); - - UINT8 data = 0; - - if (m_io_config->read() & 0x01) - data |= (m_cassette->input() > 0.03) ? 0x80 : 0x00; - - return data; -} - -WRITE8_MEMBER(cp1_state::port1_w) -{ - logerror("Write to expansion port 1 %x\n", data); - - if (m_io_config->read() & 0x01) - m_cassette->output(data & 0x80 ? +1.0 : -1.0); -} - -READ8_MEMBER(cp1_state::port2_r) -{ - // x--- ---- I8155 IO/M - // -x-- ---- I8155 RESET - // --x- ---- expansion port CE - // ---x ---- I8155 CE - // ---- xxxx keyboard input - - ioport_port* portnames[] = { m_io_line0, m_io_line1, m_io_line2, m_io_line3, m_io_line4 }; - UINT8 data = 0; - - for(int i=0; i<5; i++) - if (!(m_matrix & (1<read(); - - return (data & 0x0f) | (m_port2 & 0xf0); -} - -WRITE8_MEMBER(cp1_state::port2_w) -{ - if (data & 0x40) - { - m_i8155->reset(); - - if (m_io_config->read() & 0x02) - m_i8155_cp3->reset(); - } - - m_port2 = data; -} - -READ8_MEMBER(cp1_state::t0_r) -{ - logerror("t0_r\n"); - return 0; -} - -READ8_MEMBER(cp1_state::t1_r) -{ - logerror("t1_r\n"); - return 0; -} - -READ8_MEMBER(cp1_state::getbus) -{ - logerror("getbus\n"); - return 0; -} - -WRITE8_MEMBER(cp1_state::putbus) -{ - logerror("putbus\n"); -} - -READ8_MEMBER(cp1_state::i8155_read) -{ - UINT8 data = 0; - - if (!(m_port2 & 0x10)) - { - m_i8155->ale_w(space, BIT(m_port2, 7), offset); - data |= m_i8155->read(space, offset); - } - if ((m_io_config->read() & 0x02) && !(m_port2 & 0x20)) - { - // CP3 RAM expansion - m_i8155_cp3->ale_w(space, BIT(m_port2, 7), offset); - data |= m_i8155_cp3->read(space, offset); - } - - return data; -} - -WRITE8_MEMBER(cp1_state::i8155_write) -{ - if (!(m_port2 & 0x10)) - { - m_i8155->ale_w(space, BIT(m_port2, 7), offset); - m_i8155->write(space, offset, data); - } - if ((m_io_config->read() & 0x02) && !(m_port2 & 0x20)) - { - // CP3 RAM expansion - m_i8155_cp3->ale_w(space, BIT(m_port2, 7), offset); - m_i8155_cp3->write(space, offset, data); - } -} - -WRITE8_MEMBER(cp1_state::i8155_porta_w) -{ - data &= 0x7f; // PA7 is not connected - - if (m_7seg) - { - if (!(m_matrix & 0x01)) output_set_digit_value(5, data); - if (!(m_matrix & 0x02)) output_set_digit_value(4, data); - if (!(m_matrix & 0x04)) output_set_digit_value(3, data); - if (!(m_matrix & 0x08)) output_set_digit_value(2, data | 0x80); // this digit has always the dot active - if (!(m_matrix & 0x10)) output_set_digit_value(1, data); - if (!(m_matrix & 0x20)) output_set_digit_value(0, data); - } - - m_7seg ^= 0x01; -} - -READ8_MEMBER(cp1_state::i8155_portb_r) -{ - logerror("read from expansion port 2\n"); - return 0; -} - -WRITE8_MEMBER(cp1_state::i8155_portb_w) -{ - logerror("Write to expansion port 2 %x\n", data); -} - -WRITE8_MEMBER(cp1_state::i8155_portc_w) -{ - // --xx xxxx keyboard matrix - - m_matrix = data & 0x3f; -} - - -static ADDRESS_MAP_START( cp1_io , AS_IO, 8, cp1_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00, 0xff ) AM_READWRITE( i8155_read, i8155_write) - AM_RANGE( MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE( port1_r, port1_w ) - AM_RANGE( MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE( port2_r, port2_w ) - AM_RANGE( MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE( getbus, putbus ) - AM_RANGE( MCS48_PORT_T0, MCS48_PORT_T0) AM_READ( t0_r ) - AM_RANGE( MCS48_PORT_T1, MCS48_PORT_T1) AM_READ( t1_r ) -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( cp1 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_K) PORT_NAME("CAS [Cass. speichern]") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("CLR [Irrtum]") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("PC [Programmzahler]") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("ACC [Akku]") - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_L) PORT_NAME("CAL [Cass. lesen]") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("STEP [Schritt]") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("STP [Stopp]") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("RUN [Lauf]") - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("8") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_NAME("9") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_O) PORT_NAME("OUT [Auslesen]") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("INP [Eingeben]") - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("4") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("5") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("6") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("7") - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_NAME("0") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("1") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("2") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("3") - - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "CP2 Cassette Interface" ) - PORT_CONFSETTING( 0x00, DEF_STR( No ) ) - PORT_CONFSETTING( 0x01, DEF_STR( Yes ) ) - PORT_CONFNAME( 0x02, 0x00, "CP3 RAM Expansion" ) - PORT_CONFSETTING( 0x00, DEF_STR( No ) ) - PORT_CONFSETTING( 0x02, DEF_STR( Yes ) ) -INPUT_PORTS_END - -void cp1_state::machine_reset() -{ - m_port2 = 0; - m_matrix = 0; - m_7seg = 0; - m_cassette->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE); -} - -QUICKLOAD_LOAD_MEMBER( cp1_state, quickload ) -{ - UINT8 *dest = (UINT8*)m_i8155->space().get_read_ptr(0); - char line[0x10]; - int addr = 0; - while (image.fgets(line, 10) && addr < 0x100) - { - int op = 0, arg = 0; - if (sscanf(line, "%d.%d", &op, &arg) == 2) - { - dest[addr++] = op; - dest[addr++] = arg; - } - else - { - return IMAGE_INIT_FAIL; - } - } - - return IMAGE_INIT_PASS; -} - -static MACHINE_CONFIG_START( cp1, cp1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8049, XTAL_6MHz) - MCFG_CPU_IO_MAP(cp1_io) - - MCFG_DEVICE_ADD("i8155", I8155, 0) - MCFG_I8155_OUT_PORTA_CB(WRITE8(cp1_state, i8155_porta_w)) - MCFG_I8155_IN_PORTB_CB(READ8(cp1_state, i8155_portb_r)) - MCFG_I8155_OUT_PORTB_CB(WRITE8(cp1_state, i8155_portb_w)) - MCFG_I8155_OUT_PORTC_CB(WRITE8(cp1_state, i8155_portc_w)) - - MCFG_DEVICE_ADD("i8155_cp3", I8155, 0) - - MCFG_DEFAULT_LAYOUT(layout_cp1) - - MCFG_CASSETTE_ADD("cassette") - - MCFG_QUICKLOAD_ADD("quickload", cp1_state, quickload, "obj", 1) -MACHINE_CONFIG_END - -/* ROM definition */ -/* - KOSMOS B - M5L8049-136P-6 - JAPAN 83F301 -*/ - -ROM_START( cp1 ) - ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "b", "b" ) - ROMX_LOAD( "cp1-kosmos-b.rom", 0x0000, 0x0800, CRC(fea8a2b2) SHA1(c987b79a7b90fcbd58b66a69e95913f2655a1f0d), ROM_BIOS(1)) - // This is from 2716 eprom that was on board with I8039 instead of I8049 - ROM_SYSTEM_BIOS( 1, "2716", "2716" ) - ROMX_LOAD( "cp1-2716.bin", 0x0000, 0x0800, CRC(3a2caf0e) SHA1(ff4befcf82a664950186d3af1843fdef70d2209f), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, cp1, 0, 0, cp1, cp1, driver_device, 0, "Kosmos", "CP1 / Computer Praxis", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/craft.c b/src/mess/drivers/craft.c deleted file mode 100644 index 34411a3f335..00000000000 --- a/src/mess/drivers/craft.c +++ /dev/null @@ -1,269 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*\ -* * Linus Akesson's "Craft" -* * -* * Driver by MooglyGuy -\*/ - -#include "emu.h" -#include "cpu/avr8/avr8.h" -#include "sound/dac.h" - -#define VERBOSE_LEVEL (0) - -#define ENABLE_VERBOSE_LOG (0) - -#define MASTER_CLOCK 20000000 - -#define VISIBLE_CYCLES 480 -#define HSYNC_CYCLES 155 -#define LINE_CYCLES (VISIBLE_CYCLES + HSYNC_CYCLES) -#define VISIBLE_LINES 480 -#define VSYNC_LINES 45 -#define LINES_PER_FRAME (VISIBLE_LINES + VSYNC_LINES) -#define CYCLES_PER_FRAME (LINES_PER_FRAME * LINE_CYCLES) -#define PIXELS_PER_FRAME (CYCLES_PER_FRAME) - -/****************************************************\ -* I/O devices * -\****************************************************/ - -class craft_state : public driver_device -{ -public: - craft_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac") - { - } - - void video_update(); - - virtual void machine_start(); - - UINT32 m_last_cycles; - UINT64 m_frame_start_cycle; - - UINT8 m_port_b; - UINT8 m_port_c; - UINT8 m_port_d; - - UINT8 m_latched_color; - UINT8 m_pixels[PIXELS_PER_FRAME]; - - required_device m_maincpu; - - DECLARE_READ8_MEMBER(port_r); - DECLARE_WRITE8_MEMBER(port_w); - DECLARE_DRIVER_INIT(craft); - virtual void machine_reset(); - UINT32 screen_update_craft(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); - required_device m_dac; -}; - -inline void craft_state::verboselog(int n_level, const char *s_fmt, ...) -{ -#if ENABLE_VERBOSE_LOG - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%08x: %s", m_maincpu->safe_pc(), buf ); - } -#endif -} - -void craft_state::machine_start() -{ -} - -READ8_MEMBER(craft_state::port_r) -{ - switch( offset ) - { - case 0x00: // Port A - case 0x01: // Port B - case 0x02: // Port C - case 0x03: // Port D - // Unhandled - return 0x00; - } - - return 0; -} - -WRITE8_MEMBER(craft_state::port_w) -{ - switch( offset ) - { - case AVR8_IO_PORTA: // Port A - // Unhandled - break; - - case AVR8_IO_PORTB: // Port B - { - UINT8 old_port_b = m_port_b; - UINT8 pins = data; - UINT8 changed = pins ^ old_port_b; - if(pins & changed & 0x02) - { - m_frame_start_cycle = m_maincpu->get_elapsed_cycles(); - video_update(); - } - if(changed & 0x08) - { - video_update(); - m_latched_color = (pins & 0x08) ? (m_port_c & 0x3f) : 0x3f; - } - m_port_b = data; - break; - } - - case AVR8_IO_PORTC: // Port C - video_update(); - m_port_c = data; - m_latched_color = m_port_c; - break; - - case AVR8_IO_PORTD: // Port D - { - m_port_d = data; - UINT8 audio_sample = (data & 0x02) | ((data & 0xf4) >> 2); - m_dac->write_unsigned8(audio_sample << 1); - break; - } - } -} - -void craft_state::video_update() -{ - UINT64 cycles = m_maincpu->get_elapsed_cycles(); - UINT32 frame_cycles = (UINT32)(cycles - m_frame_start_cycle); - - if (m_last_cycles < frame_cycles) - { - for (UINT32 pixidx = m_last_cycles; pixidx < frame_cycles && pixidx < PIXELS_PER_FRAME; pixidx++) - { - m_pixels[pixidx] = m_latched_color; - } - } - else - { - UINT32 end_clear = sizeof(m_pixels) - m_last_cycles; - UINT32 start_clear = frame_cycles; - end_clear = (end_clear > PIXELS_PER_FRAME) ? (PIXELS_PER_FRAME - m_last_cycles) : end_clear; - start_clear = (start_clear > PIXELS_PER_FRAME) ? PIXELS_PER_FRAME : start_clear; - if (m_last_cycles < PIXELS_PER_FRAME) - { - memset(m_pixels + m_last_cycles, 0, end_clear); - } - if (start_clear < PIXELS_PER_FRAME) - { - memset(m_pixels, 0, start_clear); - } - } - - m_last_cycles = frame_cycles; -} - -/****************************************************\ -* Address maps * -\****************************************************/ - -static ADDRESS_MAP_START( craft_prg_map, AS_PROGRAM, 8, craft_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( craft_data_map, AS_DATA, 8, craft_state ) - AM_RANGE(0x0100, 0x04ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( craft_io_map, AS_IO, 8, craft_state ) - AM_RANGE(AVR8_IO_PORTA, AVR8_IO_PORTD) AM_READWRITE( port_r, port_w ) -ADDRESS_MAP_END - -/****************************************************\ -* Input ports * -\****************************************************/ - -static INPUT_PORTS_START( craft ) - PORT_START("MAIN") - PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -/****************************************************\ -* Video hardware * -\****************************************************/ - -UINT32 craft_state::screen_update_craft(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - for(int y = 0; y < LINES_PER_FRAME; y++) - { - UINT32 *line = &bitmap.pix32(y); - for(int x = 0; x < LINE_CYCLES; x++) - { - UINT8 pixel = m_pixels[y * LINE_CYCLES + x]; - UINT8 r = 0x55 * ((pixel & 0x30) >> 4); - UINT8 g = 0x55 * ((pixel & 0x0c) >> 2); - UINT8 b = 0x55 * (pixel & 0x03); - line[x] = 0xff000000 | (r << 16) | (g << 8) | b; - } - } - return 0; -} - -/****************************************************\ -* Machine definition * -\****************************************************/ - -DRIVER_INIT_MEMBER(craft_state,craft) -{ -} - -void craft_state::machine_reset() -{ - m_dac->write_unsigned8(0x00); - - m_frame_start_cycle = 0; - m_last_cycles = 0; -} - -static MACHINE_CONFIG_START( craft, craft_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", ATMEGA88, MASTER_CLOCK) - MCFG_CPU_PROGRAM_MAP(craft_prg_map) - MCFG_CPU_DATA_MAP(craft_data_map) - MCFG_CPU_IO_MAP(craft_io_map) - MCFG_CPU_AVR8_EEPROM("eeprom") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.99) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1429)) /* accurate */ - MCFG_SCREEN_SIZE(635, 525) - MCFG_SCREEN_VISIBLE_AREA(47, 526, 36, 515) - MCFG_SCREEN_UPDATE_DRIVER(craft_state, screen_update_craft) - MCFG_PALETTE_ADD("palette", 0x1000) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("avr8") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(0, "avr8", 1.00) -MACHINE_CONFIG_END - -ROM_START( craft ) - ROM_REGION( 0x2000, "maincpu", 0 ) /* Main program store */ - ROM_LOAD( "craft.bin", 0x0000, 0x2000, CRC(2e6f9ad2) SHA1(75e495bf18395d74289ca7ee2649622fc4010457) ) - ROM_REGION( 0x200, "eeprom", 0 ) /* on-die eeprom */ - ROM_LOAD( "eeprom.raw", 0x0000, 0x0200, CRC(e18a2af9) SHA1(81fc6f2d391edfd3244870214fac37929af0ac0c) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS(2008, craft, 0, 0, craft, craft, craft_state, craft, "Linus Akesson", "Craft", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/crvision.c b/src/mess/drivers/crvision.c deleted file mode 100644 index e6b26b8d287..00000000000 --- a/src/mess/drivers/crvision.c +++ /dev/null @@ -1,903 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Curt Coder -/* - This 1980s computer was manufactured by Vtech of Hong Kong. - known as: CreatiVision, Dick Smith Wizzard, Funvision, Rameses, VZ 2000 and possibly others. - - There is also a CreatiVision Mk 2, possibly also known as the Laser 500. This was a hardware variant, - sort of "evolved" hardware made compatible for the scheduled "ColecoVision expansion module", which - never actually shipped for CreatiVision, but for the Laser 2001 home computer (successor to - CreatiVision). - - TODO: - - CreatiVision - - - fix Diagnostic A (video) sprites generator test - - proper keyboard emulation, need keyboard schematics - - memory expansion 16K, can be chained - - centronics control/status port - - non-working cartridges: - * Diagnostic B (keyboard) - - homebrew roms with graphics issues: - * Christmas Demo 1.0 - * Titanic Frogger Demo 1.0 - * Titanic Frogger Demo 1.1 - - Salora Manager - - - keyboard Ctrl+I/J/N don't print out BASIC commands - - RAM mapping - - cassette (figure out correct input level) - - floppy (interface cartridge needed) - -*/ - -/* - -Salora Manager - -PCB Layout ----------- - -Main board - -35 0352 02 -700391F - -|-------------------------------------------------------------------------------| -| |-----CN1-----| |-----CN2-----| | -| 10.738MHz --| -| 4116 CN3 | -| ROM01 VDC | -| 4116 --| -| | -| ROM23 4116 - | -| | | -| 4116 | | -| LS04 CN6 --| -| 4116 | 6821 | -| LS32 | | -| 4116 - | -| LS139 PSG | -| 4116 | -| LS138 | -| 4116 CN4 | -| LS244 | -| | -| LS245 | -| | -| LS244 | -| 6502 --| -| LS244 | -| |-------------CN5-------------| | -|-------------------------------------------------------------------------------| - -Notes: -All IC's shown. Prototype-ish board, with many jumper wires and extra capacitors. - -ROM01 - Toshiba TMM2464P 8Kx8 one-time PROM, labeled "0.1" -ROM23 - Toshiba TMM2464P 8Kx8 one-time PROM, labeled "23" -6502 - Rockwell R6502AP 8-bit Microprocessor -6821 - Hitachi HD468B21P Peripheral Interface Adaptor -VDC - Texas Instruments TMS9929A Video Display Controller (covered w/heatsink) -PSG - Texas Instruments SN76489AN Programmable Sound Generator -4116 - Toshiba TMM416P-3 16Kx1 RAM (covered w/heatsink) -CN1 - sub board connector (17x2 pin header) -CN2 - RF board connector (17x1 pin header) -CN3 - printer connector (7x2 PCB edge male) -CN4 - expansion connector (30x2 PCB edge male) -CN5 - cartridge connector (18x2 PCB edge female) -CN6 - keyboard connector (16x1 pin header) - - -Sub board - -700472 -35 0473 03 - -|---------------------------------------| -| 17.73447MHz |-----CN1-----| | -| | -| 74S04 4116 | -| | -| LS90 4116 | -| | -| LS10 4116 | -| | -| LS367 4116 | -| | -| LS393 4116 | -| | -| LS244 4116 | -| | -| LS257 4116 | -| | -| LS257 4116 | -| | -| LS139 | -| | -|---------------------------------------| - -Notes: -All IC's shown. - -4116 - Toshiba TMM416P-3 16Kx1 RAM -CN1 - main board connector (17x2 pin header) - -*/ - -#include "includes/crvision.h" - -/*************************************************************************** - MEMORY MAPS -***************************************************************************/ - -/*------------------------------------------------- - ADDRESS_MAP( crvision_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( crvision_map, AS_PROGRAM, 8, crvision_state ) - AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM - AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write) - AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD(TMS9929_TAG, tms9928a_device, vram_read) - AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_DEVREAD(TMS9929_TAG, tms9928a_device, register_read) - AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffe) AM_DEVWRITE(TMS9929_TAG, tms9928a_device, vram_write) - AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_DEVWRITE(TMS9929_TAG, tms9928a_device, register_write) - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(BANK_ROM2) - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(BANK_ROM1) -// AM_RANGE(0xc000, 0xe7ff) AM_RAMBANK(3) - AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0xe801, 0xe801) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE(0xe801, 0xe801) AM_DEVWRITE("cent_ctrl_out", output_latch_device, write) -// AM_RANGE(0xe802, 0xf7ff) AM_RAMBANK(4) - AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0) -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( lasr2001_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( lasr2001_map, AS_PROGRAM, 8, laser2001_state ) - AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM - AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write) - AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD(TMS9929_TAG, tms9928a_device, vram_read) - AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_DEVREAD(TMS9929_TAG, tms9928a_device, register_read) - AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffe) AM_DEVWRITE(TMS9929_TAG, tms9928a_device, vram_write) - AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_DEVWRITE(TMS9929_TAG, tms9928a_device, register_write) - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK(BANK_ROM2) - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(BANK_ROM1) - AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0) -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/*------------------------------------------------- - INPUT_CHANGED_MEMBER( trigger_nmi ) --------------------------------------------------*/ - -INPUT_CHANGED_MEMBER( crvision_state::trigger_nmi ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - -/*------------------------------------------------- - INPUT_PORTS( crvision ) --------------------------------------------------*/ - -static INPUT_PORTS_START( crvision ) - // Player 1 Joystick - - PORT_START("PA0.0") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA0.1") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0xfd, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA0.2") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA0.3") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0xf7, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA0.4") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA0.5") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0xdf, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA0.6") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA0.7") - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button 2 / CNT'L") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - // Player 1 Keyboard - - PORT_START("PA1.0") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x81, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA1.1") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x83, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA1.2") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x87, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA1.3") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x8f, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA1.4") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x9f, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA1.5") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA1.6") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA1.7") - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button 1 / SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - - // Player 2 Joystick - - PORT_START("PA2.0") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA2.1") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0xfd, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA2.2") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA2.3") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0xf7, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA2.4") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA2.5") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0xdf, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA2.6") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA2.7") - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button 2 / \xE2\x86\x92") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) PORT_PLAYER(2) - - // Player 2 Keyboard - - PORT_START("PA3.0") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RET'N") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x81, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA3.1") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x83, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA3.2") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x87, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA3.3") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x8f, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA3.4") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x9f, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA3.5") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA3.6") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA3.7") - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button 1 / - =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_PLAYER(2) - - PORT_START("NMI") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, crvision_state, trigger_nmi, 0) -INPUT_PORTS_END - -/*------------------------------------------------- - INPUT_PORTS( manager ) --------------------------------------------------*/ - -static INPUT_PORTS_START( manager ) - PORT_START("Y.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('-') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - - PORT_START("Y.1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x84 \xC3\xA4") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) PORT_CHAR(0x00E4) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - - PORT_START("Y.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x85 \xC3\xA5") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00C5) PORT_CHAR(0x00E5) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("Y.3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x96 \xC3\xB6") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) PORT_CHAR(0x00F6) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - - PORT_START("Y.4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - - PORT_START("Y.5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - - PORT_START("Y.6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - - PORT_START("Y.7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - - PORT_START("JOY.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) - - PORT_START("JOY.1") - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) - - PORT_START("JOY.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - - PORT_START("JOY.3") - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) -INPUT_PORTS_END - -/*************************************************************************** - DEVICE CONFIGURATION -***************************************************************************/ - -WRITE8_MEMBER( crvision_state::pia_pa_w ) -{ - /* - Signal Description - - PA0 Keyboard raster player 1 output (joystick) - PA1 Keyboard raster player 1 output (hand keys) - PA2 Keyboard raster player 2 output (joystick) - PA3 Keyboard raster player 2 output (hand keys) - PA4 ? - PA5 ? - PA6 Cassette motor - PA7 Cassette data in/out - */ - - /* keyboard raster */ - m_keylatch = ~data & 0x0f; - - /* cassette motor */ - m_cassette->change_state(BIT(data,6) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - - /* cassette data output */ - m_cassette->output( BIT(data, 7) ? +1.0 : -1.0); -} - -UINT8 crvision_state::read_keyboard(int pa) -{ - UINT8 value = 0; - - for (int i = 0; i < 8; i++) - { - switch (pa & 3) - { - case 0: value = m_inp_pa0[i]->read(); break; - case 1: value = m_inp_pa1[i]->read(); break; - case 2: value = m_inp_pa2[i]->read(); break; - case 3: value = m_inp_pa3[i]->read(); break; - } - - if (value != 0xff) - { - if (value == 0xff - (1 << i)) - return value; - else - return value - (1 << i); - } - } - - return 0xff; -} - -READ8_MEMBER( crvision_state::pia_pa_r ) -{ - /* - PA0 Keyboard raster player 1 output (joystick) - PA1 Keyboard raster player 1 output (hand keys) - PA2 Keyboard raster player 2 output (joystick) - PA3 Keyboard raster player 2 output (hand keys) - PA4 ? - PA5 ? - PA6 Cassette motor - PA7 Cassette data in/out - */ - - UINT8 data = 0x7f; - - if ((m_cassette)->input() > -0.1469) data |= 0x80; - - return data; -} - -READ8_MEMBER( crvision_state::pia_pb_r ) -{ - /* - Signal Description - - PB0 Keyboard input - PB1 Keyboard input - PB2 Keyboard input - PB3 Keyboard input - PB4 Keyboard input - PB5 Keyboard input - PB6 Keyboard input - PB7 Keyboard input - */ - - UINT8 data = 0xff; - - for (int i = 0; i < 4; i++) - if (m_keylatch >> i & 1) - data &= read_keyboard(i); - - return data; -} - -READ8_MEMBER( laser2001_state::pia_pa_r ) -{ - /* - Signal Description - - PA0 Keyboard column 0 - PA1 Keyboard column 1 - PA2 Keyboard column 2 - PA3 Keyboard column 3 - PA4 Keyboard column 4 - PA5 Keyboard column 5 - PA6 Keyboard column 6 - PA7 Keyboard column 7 - */ - - UINT8 data = 0xff; - - for (int i = 0; i < 8; i++) - if (~m_keylatch >> i & 1) - data &= m_inp_y[i]->read(); - - return data; -} - -WRITE8_MEMBER( laser2001_state::pia_pa_w ) -{ - /* - PA0 Joystick player 1 output 0 - PA1 Joystick player 1 output 1 - PA2 Joystick player 2 output 0 - PA3 Joystick player 2 output 1 - PA4 ? - PA5 ? - PA6 ? - PA7 ? - */ - - m_joylatch = data; -} - -READ8_MEMBER( laser2001_state::pia_pb_r ) -{ - UINT8 data = 0xff; - - for (int i = 0; i < 4; i++) - if (~m_joylatch >> i & 1) - data &= m_inp_joy[i]->read(); - - return data; -} - -WRITE8_MEMBER( laser2001_state::pia_pb_w ) -{ - /* - Signal Description - - PB0 Keyboard row 0, PSG data 7, centronics data 0 - PB1 Keyboard row 1, PSG data 6, centronics data 1 - PB2 Keyboard row 2, PSG data 5, centronics data 2 - PB3 Keyboard row 3, PSG data 4, centronics data 3 - PB4 Keyboard row 4, PSG data 3, centronics data 4 - PB5 Keyboard row 5, PSG data 2, centronics data 5 - PB6 Keyboard row 6, PSG data 1, centronics data 6 - PB7 Keyboard row 7, PSG data 0, centronics data 7 - */ - - /* keyboard latch */ - m_keylatch = data; - - /* centronics data */ - m_cent_data_out->write(space, 0, data); -} - -READ_LINE_MEMBER( laser2001_state::pia_ca1_r ) -{ - return (m_cassette)->input() > -0.1469; -} - -WRITE_LINE_MEMBER( laser2001_state::pia_ca2_w ) -{ - m_cassette->output(state ? +1.0 : -1.0); -} - - -WRITE_LINE_MEMBER(laser2001_state::write_centronics_busy) -{ - m_centronics_busy = state; - m_pia->cb1_w(pia_cb1_r()); -} - -WRITE_LINE_MEMBER(laser2001_state::write_psg_ready) -{ - m_psg_ready = state; - m_pia->cb1_w(pia_cb1_r()); -} - -READ_LINE_MEMBER( laser2001_state::pia_cb1_r ) -{ - /* actually this is a diode-AND (READY & _BUSY), but ctronics.c returns busy status if no device is mounted -> Manager won't boot */ - return m_psg_ready && (!m_centronics_busy || m_pia->ca2_output_z()); -} - -WRITE_LINE_MEMBER( laser2001_state::pia_cb2_w ) -{ - if (m_pia->ca2_output_z()) - { - if (!state) m_psg->write(m_keylatch); - } - else - { - m_centronics->write_strobe(state); - } -} - -/*************************************************************************** - MACHINE INITIALIZATION -***************************************************************************/ - -void crvision_state::machine_start() -{ - // zerofill/state saving - m_keylatch = 0; - save_item(NAME(m_keylatch)); - - if (m_cart->exists()) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(crvision_cart_slot_device::read_rom40),(crvision_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xbfff, read8_delegate(FUNC(crvision_cart_slot_device::read_rom80),(crvision_cart_slot_device*)m_cart)); - } -} - -void laser2001_state::machine_start() -{ - crvision_state::machine_start(); - - // zerofill/state saving - m_joylatch = 0; - m_centronics_busy = 0; - m_psg_ready = 0; - - save_item(NAME(m_joylatch)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_psg_ready)); -} - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static SLOT_INTERFACE_START(crvision_cart) - SLOT_INTERFACE_INTERNAL("crv_rom4k", CRVISION_ROM_4K) - SLOT_INTERFACE_INTERNAL("crv_rom6k", CRVISION_ROM_6K) - SLOT_INTERFACE_INTERNAL("crv_rom8k", CRVISION_ROM_8K) - SLOT_INTERFACE_INTERNAL("crv_rom10k", CRVISION_ROM_10K) - SLOT_INTERFACE_INTERNAL("crv_rom12k", CRVISION_ROM_12K) - SLOT_INTERFACE_INTERNAL("crv_rom16k", CRVISION_ROM_16K) - SLOT_INTERFACE_INTERNAL("crv_rom18k", CRVISION_ROM_18K) -SLOT_INTERFACE_END - -/*------------------------------------------------- - MACHINE_CONFIG_START( creativision, crvision_state ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( creativision, crvision_state ) - // basic machine hardware - MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(crvision_map) - - // devices - MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(crvision_state, pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(crvision_state, pia_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(crvision_state, pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8(SN76489_TAG, sn76496_base_device, write)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) - - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) - MCFG_OUTPUT_LATCH_BIT4_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SN76489_TAG, SN76489A, XTAL_2MHz) - MCFG_SN76496_READY_HANDLER(DEVWRITELINE(PIA6821_TAG, pia6821_device, cb1_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(1, "mono", 0.25) - - // cartridge - MCFG_CRVISION_CARTRIDGE_ADD("cartslot", crvision_cart, NULL) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") // MAIN RAM - MCFG_RAM_EXTRA_OPTIONS("15K") // 16K expansion (lower 14K available only, upper 2K shared with BIOS ROM) - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list", "crvision") -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_CONFIG_DERIVED( ntsc, creativision ) --------------------------------------------------*/ - -static MACHINE_CONFIG_DERIVED( ntsc, creativision ) - // video hardware - MCFG_DEVICE_ADD( TMS9929_TAG, TMS9918, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TMS9929_TAG, tms9918_device, screen_update ) -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_CONFIG_DERIVED( pal, creativision ) --------------------------------------------------*/ - -static MACHINE_CONFIG_DERIVED_CLASS( pal, creativision, crvision_pal_state ) - // video hardware - MCFG_DEVICE_ADD( TMS9929_TAG, TMS9929, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0)) - MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TMS9929_TAG, tms9929_device, screen_update ) -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_CONFIG_START( lasr2001, laser2001_state ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( lasr2001, laser2001_state ) - // basic machine hardware - MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_17_73447MHz/9) - MCFG_CPU_PROGRAM_MAP(lasr2001_map) - - // devices - MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(laser2001_state, pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(laser2001_state, pia_pb_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(laser2001_state, pia_ca1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(laser2001_state, pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(laser2001_state, pia_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(laser2001_state, pia_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(laser2001_state, pia_cb2_w)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(laser2001_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - // video hardware - MCFG_DEVICE_ADD( TMS9929_TAG, TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(INPUTLINE(M6502_TAG, INPUT_LINE_IRQ0)) - MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TMS9929_TAG, tms9929a_device, screen_update ) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SN76489_TAG, SN76489A, XTAL_17_73447MHz/9) - MCFG_SN76496_READY_HANDLER(WRITELINE(laser2001_state, write_psg_ready)) - - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(1, "mono", 0.25) - - // cartridge - MCFG_CRVISION_CARTRIDGE_ADD("cartslot", crvision_cart, NULL) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K") - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list","crvision") -MACHINE_CONFIG_END - -/*************************************************************************** - ROMS -***************************************************************************/ - -ROM_START( crvision ) - ROM_REGION( 0x10000, M6502_TAG, 0 ) - ROM_LOAD( "crvision.u20", 0x0000, 0x0800, CRC(c3c590c6) SHA1(5ac620c529e4965efb5560fe824854a44c983757) ) -ROM_END - -ROM_START( fnvision ) - ROM_REGION( 0x10000, M6502_TAG, 0 ) - ROM_LOAD( "funboot.rom", 0x0000, 0x0800, CRC(05602697) SHA1(c280b20c8074ba9abb4be4338b538361dfae517f) ) -ROM_END - -#define rom_wizzard rom_crvision -#define rom_crvisioj rom_crvision -#define rom_crvisio2 rom_crvision -#define rom_rameses rom_fnvision -#define rom_vz2000 rom_fnvision - -ROM_START( manager ) - ROM_REGION( 0x10000, M6502_TAG, 0 ) - ROM_LOAD( "01", 0x0000, 0x2000, CRC(702f4cf5) SHA1(cd14ee74e787d24b76c166de484dae24206e219b) ) - ROM_LOAD( "23", 0x2000, 0x2000, CRC(46489d88) SHA1(467f5bcd62d0b4117c443e13373df8f3c45df7b2) ) - - ROM_REGION( 0x1000, "disk", 0 ) - ROM_LOAD( "floppy interface cartridge", 0x0000, 0x1000, NO_DUMP ) -ROM_END - -/*************************************************************************** - SYSTEM DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1982, crvision, 0, 0, pal, crvision, driver_device, 0, "Video Technology", "CreatiVision", 0 ) -CONS( 1982, fnvision, crvision, 0, pal, crvision, driver_device, 0, "Video Technology", "FunVision", 0 ) -CONS( 1982, crvisioj, crvision, 0, ntsc, crvision, driver_device, 0, "Cheryco", "CreatiVision (Japan)", 0 ) -CONS( 1982, wizzard, crvision, 0, pal, crvision, driver_device, 0, "Dick Smith Electronics", "Wizzard (Oceania)", 0 ) -CONS( 1982, rameses, crvision, 0, pal, crvision, driver_device, 0, "Hanimex", "Rameses (Oceania)", 0 ) -CONS( 1983, vz2000, crvision, 0, pal, crvision, driver_device, 0, "Dick Smith Electronics", "VZ 2000 (Oceania)", 0 ) -CONS( 1983, crvisio2, crvision, 0, pal, crvision, driver_device, 0, "Video Technology", "CreatiVision MK-II (Europe)", 0 ) -//COMP( 1983, lasr2001, 0, 0, lasr2001, lasr2001, driver_device, 0, "Video Technology", "Laser 2001", MACHINE_NOT_WORKING ) -//COMP( 1983, vz2001, lasr2001, 0, lasr2001, lasr2001, driver_device, 0, "Dick Smith Electronics", "VZ 2001 (Oceania)", MACHINE_NOT_WORKING ) -COMP( 1983, manager, 0, 0, lasr2001, manager, driver_device, 0, "Salora", "Manager (Finland)", 0 ) diff --git a/src/mess/drivers/csc.c b/src/mess/drivers/csc.c deleted file mode 100644 index dcf62474038..00000000000 --- a/src/mess/drivers/csc.c +++ /dev/null @@ -1,346 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco -/****************************************************************************** - - Fidelity Champion Chess Challenger (model CSC) - - See fidelz80.c for hardware description - - TODO: - - speech doesn't work - - make a better artwork - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/6821pia.h" -#include "sound/s14001a.h" - -#include "debugger.h" - -// same layout of Sensory Chess Challenger -extern const char layout_vsc[]; - -class csc_state : public driver_device -{ -public: - csc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_speech(*this, "speech") - , - m_maincpu(*this, "maincpu") { } - - required_device m_speech; - - virtual void machine_start(); - - UINT16 input_read(int index); - DECLARE_WRITE8_MEMBER( pia0_pa_w ); - DECLARE_WRITE8_MEMBER( pia0_pb_w ); - DECLARE_READ8_MEMBER( pia0_pb_r ); - DECLARE_WRITE_LINE_MEMBER( pia0_ca2_w ); - DECLARE_WRITE8_MEMBER( pia1_pa_w ); - DECLARE_WRITE8_MEMBER( pia1_pb_w ); - DECLARE_READ8_MEMBER( pia1_pa_r ); - DECLARE_WRITE_LINE_MEMBER( pia1_ca2_w ); - DECLARE_WRITE_LINE_MEMBER( pia1_cb2_w ); - DECLARE_READ_LINE_MEMBER( pia1_ca1_r ); - DECLARE_READ_LINE_MEMBER( pia1_cb1_r ); - - UINT8 m_selector; - TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); - required_device m_maincpu; -}; - - -UINT16 csc_state::input_read(int index) -{ - static const char *const col_tag[] = - { - "COL_A", "COL_B", "COL_C", "COL_D", "COL_E", - "COL_F", "COL_G", "COL_H", "COL_I" - }; - - return ioport(col_tag[index])->read(); -} - - -WRITE8_MEMBER( csc_state::pia0_pa_w ) -{ - UINT8 out_digit = BITSWAP8(data,0,1,5,6,7,2,3,4 ); - - switch (m_selector) - { - case 0: - output_set_digit_value(0, out_digit & 0x7f); - output_set_value("pm_led", BIT(out_digit, 7)); - break; - case 1: - output_set_digit_value(1, out_digit & 0x7f); - break; - case 2: - output_set_digit_value(2, out_digit & 0x7f); - output_set_value("up_dot", BIT(out_digit, 7)); - break; - case 3: - output_set_digit_value(3, out_digit & 0x7f); - output_set_value("low_dot", BIT(out_digit, 7)); - break; - } - -// m_speech->reg_w(data & 0x3f); - - // for avoid the digit flashing - m_selector |= 0x80; -} - -WRITE8_MEMBER( csc_state::pia0_pb_w ) -{ -// m_speech->set_volume(15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... -// m_speech->rst_w(BIT(data, 1)); -} - -READ8_MEMBER( csc_state::pia0_pb_r ) -{ - UINT8 data = 0x04; - - if(m_speech->bsy_r()) - data |= 0x08; - - if (m_selector<9) - if (input_read(m_selector) & 0x100) - data |= 0x20; - - return data; -} - -WRITE_LINE_MEMBER( csc_state::pia0_ca2_w ) -{ -} - -WRITE8_MEMBER( csc_state::pia1_pa_w ) -{ - m_selector = (m_selector & 0x0c) | ((data>>6) & 0x03); -} - -WRITE8_MEMBER( csc_state::pia1_pb_w ) -{ - static const char *const row_tag[] = - { - "led_a", "led_b", "led_c", "led_d", - "led_e", "led_f", "led_g", "led_h" - }; - - if (m_selector < 8) - for (int i=0; i<8; i++) - output_set_indexed_value(row_tag[m_selector], i+1, BIT(data, 7-i)); -} - -READ8_MEMBER( csc_state::pia1_pa_r ) -{ - UINT8 data = 0xff; - - if (m_selector<9) - data = input_read(m_selector); - - return data & 0x3f; -} - -WRITE_LINE_MEMBER( csc_state::pia1_ca2_w ) -{ - m_selector = (m_selector & 0x07) | (state ? 8 : 0); -} - -WRITE_LINE_MEMBER( csc_state::pia1_cb2_w ) -{ - m_selector = (m_selector & 0x0b) | (state ? 4 : 0); -} - -READ_LINE_MEMBER( csc_state::pia1_ca1_r ) -{ - int data = 0x01; - - if (m_selector<9) - data = BIT(input_read(m_selector), 6); - - return data; -} - -READ_LINE_MEMBER( csc_state::pia1_cb1_r ) -{ - int data = 0x01; - - if (m_selector<9) - data = BIT(input_read(m_selector),7); - - return data; -} - - -TIMER_DEVICE_CALLBACK_MEMBER(csc_state::irq_timer) -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); -} - -/* Address maps */ -static ADDRESS_MAP_START(csc_mem, AS_PROGRAM, 8, csc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff) AM_RAM AM_MIRROR(0x4000) //2K RAM - AM_RANGE( 0x0800, 0x0bff) AM_RAM AM_MIRROR(0x4400) //1K RAM - AM_RANGE( 0x1000, 0x1003) AM_DEVREADWRITE("pia0", pia6821_device, read, write) AM_MIRROR(0x47fc) - AM_RANGE( 0x1800, 0x1803) AM_DEVREADWRITE("pia1", pia6821_device, read, write) AM_MIRROR(0x47fc) - AM_RANGE( 0x2000, 0x3fff) AM_ROM AM_MIRROR(0x4000) - AM_RANGE( 0x8000, 0x9fff) AM_NOP - AM_RANGE( 0xa000, 0xffff) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( csc ) - PORT_START("COL_A") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) - PORT_START("COL_B") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) - PORT_START("COL_C") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) - PORT_START("COL_D") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) - PORT_START("COL_E") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) - PORT_START("COL_F") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) - PORT_START("COL_G") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_START("COL_H") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_START("COL_I") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) - PORT_BIT(0x100,IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED -INPUT_PORTS_END - - -void csc_state::machine_start() -{ - save_item(NAME(m_selector)); -} - -/* Machine driver */ -static MACHINE_CONFIG_START( csc, csc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 3900000/2) - MCFG_CPU_PROGRAM_MAP(csc_mem) - - MCFG_DEFAULT_LAYOUT(layout_vsc) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", csc_state, irq_timer, attotime::from_hz(38400/64)) - - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(csc_state, pia0_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(csc_state, pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(csc_state, pia0_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(csc_state, pia0_ca2_w)) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(csc_state, pia1_pa_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(csc_state, pia1_ca1_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(csc_state, pia1_cb1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(csc_state, pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(csc_state, pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(csc_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(csc_state, pia1_cb2_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speech", S14001A, 25000) // around 25khz - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START(csc) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341)) - ROM_LOAD("1025a03.bin", 0xa000, 0x2000, CRC(63982c07) SHA1(5ed4356323d5c80df216da55994abe94ba4aa94c)) - ROM_LOAD("1025a02.bin", 0xc000, 0x2000, CRC(9e6e7c69) SHA1(4f1ed9141b6596f4d2b1217d7a4ba48229f3f1b0)) - ROM_LOAD("1025a01.bin", 0xe000, 0x2000, CRC(57f068c3) SHA1(7d2ac4b9a2fba19556782863bdd89e2d2d94e97b)) - - ROM_LOAD("74s474.bin", 0xfe00, 0x0200, CRC(4511ba31) SHA1(e275b1739f8c3aa445cccb6a2b597475f507e456)) - - ROM_REGION(0x2000, "speech", 0) - ROM_LOAD("101-32107.bin", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, csc, 0, 0, csc, csc, driver_device, 0, "Fidelity Electronics", "Champion Chess Challenger (model CSC)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK) diff --git a/src/mess/drivers/ct486.c b/src/mess/drivers/ct486.c deleted file mode 100644 index 91cc9d85c3f..00000000000 --- a/src/mess/drivers/ct486.c +++ /dev/null @@ -1,198 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - PC/AT 486 with Chips & Technologies CS4031 chipset - -***************************************************************************/ - -#include "emu.h" -#include "cpu/i386/i386.h" -#include "machine/ram.h" -#include "machine/cs4031.h" -#include "machine/at_keybc.h" -#include "bus/pc_kbd/pc_kbdc.h" -#include "bus/pc_kbd/keyboards.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "sound/speaker.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class ct486_state : public driver_device -{ -public: - ct486_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cs4031(*this, "cs4031"), - m_isabus(*this, "isabus"), - m_speaker(*this, "speaker") - { } - - required_device m_maincpu; - required_device m_cs4031; - required_device m_isabus; - required_device m_speaker; - - virtual void machine_start(); - - DECLARE_READ16_MEMBER( cs4031_ior ); - DECLARE_WRITE16_MEMBER( cs4031_iow ); - DECLARE_WRITE_LINE_MEMBER( cs4031_hold ); - DECLARE_WRITE8_MEMBER( cs4031_tc ) { m_isabus->eop_w(offset, data); } - DECLARE_WRITE_LINE_MEMBER( cs4031_spkr ) { m_speaker->level_w(state); } -}; - - -//************************************************************************** -// MACHINE EMULATION -//************************************************************************** - -void ct486_state::machine_start() -{ -} - -READ16_MEMBER( ct486_state::cs4031_ior ) -{ - if (offset < 4) - return m_isabus->dack_r(offset); - else - return m_isabus->dack16_r(offset); -} - -WRITE16_MEMBER( ct486_state::cs4031_iow ) -{ - if (offset < 4) - m_isabus->dack_w(offset, data); - else - m_isabus->dack16_w(offset, data); -} - -WRITE_LINE_MEMBER( ct486_state::cs4031_hold ) -{ - // halt cpu - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - // and acknowledge hold - m_cs4031->hlda_w(state); -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -static ADDRESS_MAP_START( ct486_map, AS_PROGRAM, 32, ct486_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ct486_io, AS_IO, 32, ct486_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static MACHINE_CONFIG_START( ct486, ct486_state ) - MCFG_CPU_ADD("maincpu", I486, XTAL_25MHz) - MCFG_CPU_PROGRAM_MAP(ct486_map) - MCFG_CPU_IO_MAP(ct486_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("cs4031", cs4031_device, int_ack_r) - - MCFG_CS4031_ADD("cs4031", XTAL_25MHz, "maincpu", "isa", "bios", "keybc") - // cpu connections - MCFG_CS4031_HOLD(WRITELINE(ct486_state, cs4031_hold)); - MCFG_CS4031_NMI(INPUTLINE("maincpu", INPUT_LINE_NMI)); - MCFG_CS4031_INTR(INPUTLINE("maincpu", INPUT_LINE_IRQ0)); - MCFG_CS4031_CPURESET(INPUTLINE("maincpu", INPUT_LINE_RESET)); - MCFG_CS4031_A20M(INPUTLINE("maincpu", INPUT_LINE_A20)); - // isa dma - MCFG_CS4031_IOR(READ16(ct486_state, cs4031_ior)) - MCFG_CS4031_IOW(WRITE16(ct486_state, cs4031_iow)) - MCFG_CS4031_TC(WRITE8(ct486_state, cs4031_tc)) - // speaker - MCFG_CS4031_SPKR(WRITELINE(ct486_state, cs4031_spkr)) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("1M,2M,8M,16M,32M,64M") - - MCFG_DEVICE_ADD("keybc", AT_KEYBOARD_CONTROLLER, XTAL_12MHz) - MCFG_AT_KEYBOARD_CONTROLLER_SYSTEM_RESET_CB(DEVWRITELINE("cs4031", cs4031_device, kbrst_w)) - MCFG_AT_KEYBOARD_CONTROLLER_GATE_A20_CB(DEVWRITELINE("cs4031", cs4031_device, gatea20_w)) - MCFG_AT_KEYBOARD_CONTROLLER_INPUT_BUFFER_FULL_CB(DEVWRITELINE("cs4031", cs4031_device, irq01_w)) - MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_CLOCK_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, clock_write_from_mb)) - MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_DATA_CB(DEVWRITELINE("pc_kbdc", pc_kbdc_device, data_write_from_mb)) - MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0) - MCFG_PC_KBDC_OUT_CLOCK_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_clock_w)) - MCFG_PC_KBDC_OUT_DATA_CB(DEVWRITELINE("keybc", at_keyboard_controller_device, keyboard_data_w)) - MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL) - - MCFG_DEVICE_ADD("isabus", ISA16, 0) - MCFG_ISA16_CPU(":maincpu") - MCFG_ISA_BUS_IOCHCK(DEVWRITELINE("cs4031", cs4031_device, iochck_w)) - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("cs4031", cs4031_device, irq09_w)) - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("cs4031", cs4031_device, irq03_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("cs4031", cs4031_device, irq04_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("cs4031", cs4031_device, irq05_w)) - MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("cs4031", cs4031_device, irq06_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("cs4031", cs4031_device, irq07_w)) - MCFG_ISA_OUT_IRQ10_CB(DEVWRITELINE("cs4031", cs4031_device, irq10_w)) - MCFG_ISA_OUT_IRQ11_CB(DEVWRITELINE("cs4031", cs4031_device, irq11_w)) - MCFG_ISA_OUT_IRQ12_CB(DEVWRITELINE("cs4031", cs4031_device, irq12_w)) - MCFG_ISA_OUT_IRQ14_CB(DEVWRITELINE("cs4031", cs4031_device, irq14_w)) - MCFG_ISA_OUT_IRQ15_CB(DEVWRITELINE("cs4031", cs4031_device, irq15_w)) - MCFG_ISA_OUT_DRQ0_CB(DEVWRITELINE("cs4031", cs4031_device, dreq0_w)) - MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("cs4031", cs4031_device, dreq1_w)) - MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("cs4031", cs4031_device, dreq2_w)) - MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("cs4031", cs4031_device, dreq3_w)) - MCFG_ISA_OUT_DRQ5_CB(DEVWRITELINE("cs4031", cs4031_device, dreq5_w)) - MCFG_ISA_OUT_DRQ6_CB(DEVWRITELINE("cs4031", cs4031_device, dreq6_w)) - MCFG_ISA_OUT_DRQ7_CB(DEVWRITELINE("cs4031", cs4031_device, dreq7_w)) - MCFG_ISA16_SLOT_ADD("isabus", "board1", pc_isa16_cards, "fdcsmc", true) - MCFG_ISA16_SLOT_ADD("isabus", "board2", pc_isa16_cards, "comat", true) - MCFG_ISA16_SLOT_ADD("isabus", "board3", pc_isa16_cards, "ide", true) - MCFG_ISA16_SLOT_ADD("isabus", "board4", pc_isa16_cards, "lpt", true) - MCFG_ISA16_SLOT_ADD("isabus", "isa1", pc_isa16_cards, "svga_et4k", false) - MCFG_ISA16_SLOT_ADD("isabus", "isa2", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus", "isa3", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus", "isa4", pc_isa16_cards, NULL, false) - MCFG_ISA16_SLOT_ADD("isabus", "isa5", pc_isa16_cards, NULL, false) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - // video hardware - MCFG_PALETTE_ADD("palette", 256) // todo: really needed? - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("pc_disk_list","ibm5150") - MCFG_SOFTWARE_LIST_ADD("xt_disk_list","ibm5160_flop") - MCFG_SOFTWARE_LIST_ADD("at_disk_list","ibm5170") - MCFG_SOFTWARE_LIST_ADD("at_cdrom_list","ibm5170_cdrom") -MACHINE_CONFIG_END - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( ct486 ) - ROM_REGION(0x40000, "isa", ROMREGION_ERASEFF) - ROM_REGION(0x100000, "bios", 0) - ROM_LOAD("chips_1.ami", 0xf0000, 0x10000, CRC(a14a7511) SHA1(b88d09be66905ed2deddc26a6f8522e7d2d6f9a8)) -ROM_END - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -COMP( 1993, ct486, 0, 0, ct486, 0, driver_device, 0, "", "PC/AT 486 with CS4031 chipset", 0 ) diff --git a/src/mess/drivers/cvicny.c b/src/mess/drivers/cvicny.c deleted file mode 100644 index 416309d78d0..00000000000 --- a/src/mess/drivers/cvicny.c +++ /dev/null @@ -1,149 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - CVICNY8080 - Practice-z80 - a homebrew from Czechoslavakia. - - More data at : - http://www.nostalcomp.cz/cvicny8080.php - - 21/OCT/2011 New working driver. [Robbbert] - - Keys: - 0-9,A-F : hexadecimal numbers - ADR : enter an address to work with. After the 4 digits are entered, - the data at that address shows, and you can modify the data. - + (inc) : Enter the data into memory, and increment the address by 1. - GO : execute the program located at the current address. - - Pasting: - 0-F : as is - + (inc) : ^ - ADR : - - GO : X - - Test Paste: - 11^22^33^44^55^66^77^88^99^-0800 - Now press up-arrow to confirm the data has been entered. - - ToDo: - - When ADR is pressed, sometimes a segment stays alight. Bug? - - Blank the display if digits aren't being refreshed - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cvicny.lh" - -class cvicny_state : public driver_device -{ -public: - cvicny_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_digit_last(0) - { } - - required_device m_maincpu; - DECLARE_READ8_MEMBER(key_r); - DECLARE_WRITE8_MEMBER(digit_w); - DECLARE_WRITE8_MEMBER(segment_w ); - UINT8 m_digit; - UINT8 m_digit_last; -}; - -WRITE8_MEMBER( cvicny_state::segment_w ) // output segments on the selected digit -{ - if (m_digit != m_digit_last) - output_set_digit_value(m_digit, data); - - m_digit_last = m_digit; -} - -WRITE8_MEMBER( cvicny_state::digit_w ) // set keyboard scanning row; set digit to display -{ - m_digit = data & 7; -} - -READ8_MEMBER( cvicny_state::key_r ) -{ - UINT8 data; - char kbdrow[6]; - sprintf(kbdrow,"X%d",m_digit); - data = ioport(kbdrow)->read(); - return ((data << 4) ^ 0xf0) | data; -} - -static ADDRESS_MAP_START( cvicny_mem, AS_PROGRAM, 8, cvicny_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM // 1 x 2716 - AM_RANGE(0x0800, 0x0bff) AM_RAM AM_MIRROR(0x400) // 2x 2114 static ram - AM_RANGE(0x1000, 0x17ff) AM_READ(key_r) - AM_RANGE(0x1800, 0x1fff) AM_WRITE(digit_w) - AM_RANGE(0x2000, 0x27ff) AM_WRITE(segment_w) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( cvicny ) - PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - - PORT_START("X4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ADR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X5") - PORT_BIT( 0x0F, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X6") - PORT_BIT( 0x0F, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X7") - PORT_BIT( 0x0F, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( cvicny, cvicny_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(cvicny_mem) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_cvicny) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( cvicny ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("cvicny8080.bin", 0x0000, 0x05ea, CRC(e6119052) SHA1(d03c2cbfd047f0d090a787fbbde6353593cc2dd8) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, cvicny, 0, 0, cvicny, cvicny, driver_device, 0, "", "Practice-z80", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/cxhumax.c b/src/mess/drivers/cxhumax.c deleted file mode 100644 index 4fc5ab65151..00000000000 --- a/src/mess/drivers/cxhumax.c +++ /dev/null @@ -1,1085 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Lukasz Markowski -/*************************************************************************** - HUMAX HDCI-2000 ( Conexant CX2417x ) - - http://www.humaxdigital.com/global/products/product_stb_satellite_hdci2000.asp - - Running on Nucleus PLUS - ARM7TDMI ADS v. 1.14 - some Conexant/Nucleus goodies may be found at http://code.google.com/p/cherices/ - - runs up to frame 280 or so... - -****************************************************************************/ - -#include "emu.h" -#include "includes/cxhumax.h" - -#define VERBOSE_LEVEL ( 0 ) - -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...) -{ - if (VERBOSE_LEVEL >= n_level) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt); - vsprintf( buf, s_fmt, v); - va_end( v); - logerror( "%s: %s", machine.describe_context( ), buf); - } -} - -READ32_MEMBER ( cxhumax_state::cx_gxa_r ) -{ - UINT32 res = m_gxa_cmd_regs[offset]; - verboselog( machine(), 9, "(GXA) %08X -> %08X\n", 0xE0600000 + (offset << 2), res); -/* UINT8 gxa_command_number = (offset >> 9) & 0x7F; - verboselog( machine(), 9, " Command: %08X\n", gxa_command_number); - switch (gxa_command_number) { - case GXA_CMD_RW_REGISTER: - switch(offset) { - case GXA_CFG2_REG: - break; - default: - verboselog( machine(), 9, " Unimplemented register - TODO?\n"); - break; - } - break; - default: - // do we need it? - verboselog( machine(), 9, " Unimplemented read command - TODO?\n"); - break; - }*/ - return res; -} - -WRITE32_MEMBER( cxhumax_state::cx_gxa_w ) -{ - verboselog( machine(), 9, "(GXA) %08X <- %08X\n", 0xE0600000 + (offset << 2), data); - UINT8 gxa_command_number = (offset >> 9) & 0x7F; - verboselog( machine(), 9, " Command: %08X\n", gxa_command_number); - - /* Clear non persistent data */ - m_gxa_cmd_regs[GXA_CMD_REG] &= 0xfffc0000; - - if (gxa_command_number == GXA_CMD_RW_REGISTER) { - verboselog( machine(), 9, " Register Number: %08X\n", offset & 0xff); - } else { - m_gxa_cmd_regs[GXA_CMD_REG] |= (offset << 2) & 0x3ffff; - verboselog( machine(), 9, " Source Bitmap Selector: %08X\n", (offset >> 6) & 0x7); - verboselog( machine(), 9, " Destination Bitmap Selector: %08X\n", (offset >> 3) & 0x7); - verboselog( machine(), 9, " Parameter Count: %08X\n", offset & 0x7); - } - switch (gxa_command_number) { - case GXA_CMD_RW_REGISTER: - switch(offset) { - case GXA_CFG2_REG: - // clear IRQ_STAT bits if requested - m_gxa_cmd_regs[GXA_CFG2_REG] = (m_gxa_cmd_regs[GXA_CFG2_REG]&(0xfff00000 & ~(data&0x00300000))) | (data & 0x000fffff); - break; - default: - verboselog( machine(), 9, " Unimplemented register - TODO?\n"); - COMBINE_DATA(&m_gxa_cmd_regs[offset]); - break; - } - break; - case GXA_CMD_QMARK: - verboselog( machine(), 9, " QMARK - TODO?\n"); - - /* Set value and copy of WAIT4_VERTICAL bit written by QMARK */ - m_gxa_cmd_regs[GXA_CMD_REG] = (m_gxa_cmd_regs[GXA_CMD_REG] & 0x3ffff) | (data<<24) | ((data&0x10)?1<<23:0); - - /* QMARK command has completed */ - m_gxa_cmd_regs[GXA_CFG2_REG] |= (1<set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - - break; - default: - verboselog( machine(), 9, " Unimplemented command - TODO?\n"); - break; - } -} - -WRITE32_MEMBER ( cxhumax_state::flash_w ) -{ - offset *= 2; - if(ACCESSING_BITS_0_15) - m_flash->write(offset, data); - if(ACCESSING_BITS_16_31) - m_flash->write(offset+1, data >> 16); - verboselog( machine(), 9, "(FLASH) %08X <- %08X\n", 0xF0000000 + (offset << 2), data); -} - -READ32_MEMBER ( cxhumax_state::flash_r ) -{ - UINT32 res = 0; - offset *= 2; - if(ACCESSING_BITS_0_15) - res |= m_flash->read(offset); - if(ACCESSING_BITS_16_31) - res |= m_flash->read(offset+1) << 16; - //if(m_flash->m_flash_mode!=FM_NORMAL) verboselog( machine(), 9, "(FLASH) %08X -> %08X\n", 0xF0000000 + (offset << 2), res); - return res; -} - -READ32_MEMBER ( cxhumax_state::dummy_flash_r ) -{ - return 0xFFFFFFFF; -} - -WRITE32_MEMBER ( cxhumax_state::cx_remap_w ) -{ - if(!(data&1)) { - verboselog( machine(), 9, "(REMAP) %08X -> %08X\n", 0xE0400014 + (offset << 2), data); - memset(m_ram, 0, 0x400000); // workaround :P - } -} - -READ32_MEMBER( cxhumax_state::cx_scratch_r ) -{ - UINT32 data = m_scratch_reg; - verboselog( machine(), 9, "(SCRATCH) %08X -> %08X\n", 0xE0400024 + (offset << 2), data); - - if((m_maincpu->pc()==0xF0003BB8) || (m_maincpu->pc()==0x01003724) || (m_maincpu->pc()==0x00005d8c)) { // HDCI-2000 - //we're in disabled debug_printf - unsigned char* buf = (unsigned char *)alloca(200); - unsigned char temp; - address_space &program = m_maincpu->space(AS_PROGRAM); - - memset(buf,0,200); - - int i = 0; - while ((temp=program.read_byte(m_maincpu->state_int(ARM7_R0)+i))) { - buf[i++]=temp; - //m_terminal->write(space, 0, temp); - } - osd_printf_debug("%s", buf); - verboselog( machine(), 9, "(DEBUG) %s", buf); - } - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_scratch_w ) -{ - verboselog( machine(), 9, "(SCRATCH) %08X <- %08X\n", 0xE0400024 + (offset << 2), data); - COMBINE_DATA(&m_scratch_reg); -} - -READ32_MEMBER( cxhumax_state::cx_hsx_r ) -{ - UINT32 data = 0; // dummy - verboselog( machine(), 9, "(HSX) %08X -> %08X\n", 0xE0000000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_hsx_w ) -{ - verboselog( machine(), 9, "(HSX) %08X <- %08X\n", 0xE0000000 + (offset << 2), data); -} - -READ32_MEMBER( cxhumax_state::cx_romdescr_r ) -{ - UINT32 data = m_romdescr_reg; - verboselog( machine(), 9, "(ROMDESC0) %08X -> %08X\n", 0xE0010000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_romdescr_w ) -{ - verboselog( machine(), 9, "(ROMDESC0) %08X <- %08X\n", 0xE0010000 + (offset << 2), data); - COMBINE_DATA(&m_romdescr_reg); -} - -READ32_MEMBER( cxhumax_state::cx_isaromdescr_r ) -{ - UINT32 data = m_isaromdescr_regs[offset]; - verboselog( machine(), 9, "(ISAROMDESC%d) %08X -> %08X\n", offset+1, 0xE0010004 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_isaromdescr_w ) -{ - verboselog( machine(), 9, "(ISAROMDESC%d) %08X <- %08X\n", offset+1, 0xE0010004 + (offset << 2), data); - COMBINE_DATA(&m_isaromdescr_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_isadescr_r ) -{ - UINT32 data = m_isaromdescr_regs[offset]; - verboselog( machine(), 9, "(ISA_DESC%d) %08X -> %08X\n", offset+4, 0xE0010010 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_isadescr_w ) -{ - verboselog( machine(), 9, "(ISA_DESC%d) %08X <- %08X\n", offset+4, 0xE0010010 + (offset << 2), data); - COMBINE_DATA(&m_isaromdescr_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_rommap_r ) -{ - UINT32 data = 0; - verboselog( machine(), 9, "(ROM%d_MAP) %08X -> %08X\n", offset, 0xE0010020 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_rommap_w ) -{ - verboselog( machine(), 9, "(ROM%d_MAP) %08X <- %08X\n", offset, 0xE0010020 + (offset << 2), data); -} - -READ32_MEMBER( cxhumax_state::cx_rommode_r ) -{ - UINT32 data = m_rommode_reg; - verboselog( machine(), 9, "(ROMMODE) %08X -> %08X\n", 0xE0010034 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_rommode_w ) -{ - verboselog( machine(), 9, "(ROMMODE) %08X <- %08X\n", 0xE0010034 + (offset << 2), data); - COMBINE_DATA(&m_rommode_reg); -} - -READ32_MEMBER( cxhumax_state::cx_xoemask_r ) -{ - UINT32 data = m_xoemask_reg; - verboselog( machine(), 9, "(XOEMASK) %08X -> %08X\n", 0xE0010034 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_xoemask_w ) -{ - verboselog( machine(), 9, "(XOEMASK) %08X <- %08X\n", 0xE0010034 + (offset << 2), data); - COMBINE_DATA(&m_xoemask_reg); -} - -READ32_MEMBER( cxhumax_state::cx_pci_r ) -{ - UINT32 data = 0; - switch (offset) { - case PCI_CFG_ADDR_REG: - data = m_pci_regs[offset]; break; - case PCI_CFG_DATA_REG: - { - switch (m_pci_regs[PCI_CFG_ADDR_REG]) { - case 0: data = (0x4170<<16) /*Device ID*/ | 0x14f1 /* Vendor ID */; break; - case 8: data = (0x060000 << 8) /* Class Code */ | 0x1f /* Revision ID */; break; - } - } break; - } - verboselog( machine(), 9, "(PCI) %08X -> %08X\n", 0xE0010040 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_pci_w ) -{ - verboselog( machine(), 9, "(PCI) %08X <- %08X\n", 0xE0010040 + (offset << 2), data); - COMBINE_DATA(&m_pci_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_extdesc_r ) -{ - UINT32 data = m_extdesc_regs[offset]; - verboselog( machine(), 9, "(EXTDESC) %08X -> %08X\n", 0xE0010080 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_extdesc_w ) -{ - verboselog( machine(), 9, "(EXTDESC) %08X <- %08X\n", 0xE0010080 + (offset << 2), data); - COMBINE_DATA(&m_extdesc_regs[offset]); -} - -TIMER_CALLBACK_MEMBER(cxhumax_state::timer_tick) -{ - m_timer_regs.timer[param].value++; - if(m_timer_regs.timer[param].value==m_timer_regs.timer[param].limit) { - /* Reset counter when reaching limit and RESET_CNTR bit is cleared */ - if(!(m_timer_regs.timer[param].mode & 2)) - m_timer_regs.timer[param].value=0; - - /* Indicate interrupt request if EN_INT bit is set */ - if (m_timer_regs.timer[param].mode & 8) { - //printf( "IRQ on Timer %d\n", param ); - verboselog( machine(), 9, "(TIMER%d) Interrupt\n", param); - m_intctrl_regs[INTREG(INTGROUP2, INTIRQ)] |= INT_TIMER_BIT; /* Timer interrupt */ - m_intctrl_regs[INTREG(INTGROUP2, INTSTATCLR)] |= INT_TIMER_BIT; /* Timer interrupt */ - m_intctrl_regs[INTREG(INTGROUP2, INTSTATSET)] |= INT_TIMER_BIT; /* Timer interrupt */ - - m_timer_regs.timer_irq |= 1<set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - } - } - attotime period = attotime::from_hz(XTAL_54MHz)*m_timer_regs.timer[param].timebase; - m_timer_regs.timer[param].timer->adjust(period,param); -} - -READ32_MEMBER( cxhumax_state::cx_timers_r ) -{ - UINT32 data = 0; - UINT8 index = offset>>2; - if(index==16) { - data = m_timer_regs.timer_irq; - //m_timer_regs.timer_irq=0; - verboselog( machine(), 9, "(TIMERIRQ) %08X -> %08X\n", 0xE0430000 + (offset << 2), data); - } - else { - switch (offset&3) { - case TIMER_VALUE: - data = m_timer_regs.timer[index].value; break; - case TIMER_LIMIT: - data = m_timer_regs.timer[index].limit; break; - case TIMER_MODE: - data = m_timer_regs.timer[index].mode; break; - case TIMER_TIMEBASE: - data = m_timer_regs.timer[index].timebase; break; - } - verboselog( machine(), 9, "(TIMER%d) %08X -> %08X\n", offset>>2, 0xE0430000 + (offset << 2), data); - } - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_timers_w ) -{ - UINT8 index = offset>>2; - if(index==16) { - verboselog( machine(), 9, "(TIMERIRQ) %08X <- %08X\n", 0xE0430000 + (offset << 2), data); - COMBINE_DATA(&m_timer_regs.timer_irq); - } - else { - verboselog( machine(), 9, "(TIMER%d) %08X <- %08X\n", index, 0xE0430000 + (offset << 2), data); - switch(offset&3) { - case TIMER_VALUE: - COMBINE_DATA(&m_timer_regs.timer[index].value); break; - case TIMER_LIMIT: - COMBINE_DATA(&m_timer_regs.timer[index].limit); break; - case TIMER_MODE: - COMBINE_DATA(&m_timer_regs.timer[index].mode); - if(data&1) { - attotime period = attotime::from_hz(XTAL_54MHz)*m_timer_regs.timer[index].timebase; - m_timer_regs.timer[index].timer->adjust(period,index); - } else { - m_timer_regs.timer[index].timer->adjust(attotime::never,index); - } break; - case TIMER_TIMEBASE: - COMBINE_DATA(&m_timer_regs.timer[index].timebase); break; - } - /* A timer will hold an interrupt active until any one of that timer?s registers is written. */ - if(m_timer_regs.timer_irq & (1< %08X\n", 0xE0411000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_uart2_w ) -{ - verboselog( machine(), 9, "(UART2) %08X <- %08X\n", 0xE0411000 + (offset << 2), data); - switch (offset) { - case UART_FIFO_REG: - if(!(m_uart2_regs[UART_FRMC_REG]&UART_FRMC_BDS_BIT)) { - /* Sending byte... add logging */ - m_terminal->write(space, 0, data); - - /* Transmitter Idle Interrupt Enable */ - if(m_uart2_regs[UART_IRQE_REG]&UART_IRQE_TIDE_BIT) { - /* Signal pending INT */ - m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] |= INT_UART2_BIT; - m_intctrl_regs[INTREG(INTGROUP1, INTSTATCLR)] |= INT_UART2_BIT; - m_intctrl_regs[INTREG(INTGROUP1, INTSTATSET)] |= INT_UART2_BIT; - - /* If INT is enabled at INT Ctrl raise it */ - if(m_intctrl_regs[INTREG(INTGROUP1, INTENABLE)]&INT_UART2_BIT) { - m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - } - } - } - default: - COMBINE_DATA(&m_uart2_regs[offset]); break; - } -} - -READ32_MEMBER( cxhumax_state::cx_pll_r ) -{ - UINT32 data = m_pll_regs[offset]; - verboselog( machine(), 9, "(PLL) %08X -> %08X\n", 0xE0440000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_pll_w ) -{ - verboselog( machine(), 9, "(PLL) %08X <- %08X\n", 0xE0440000 + (offset << 2), data); - COMBINE_DATA(&m_pll_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_pllprescale_r ) -{ - UINT32 data = m_pllprescale_reg; - verboselog( machine(), 9, "(PLLPRESCALE) %08X -> %08X\n", 0xE0440094 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_pllprescale_w ) -{ - verboselog( machine(), 9, "(PLLPRESCALE) %08X <- %08X\n", 0xE0440094 + (offset << 2), data); - COMBINE_DATA(&m_pllprescale_reg); -} - -READ32_MEMBER( cxhumax_state::cx_clkdiv_r ) -{ - UINT32 data = m_clkdiv_regs[offset]; - verboselog( machine(), 9, "(CLKDIV) %08X -> %08X\n", 0xE0440020 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_clkdiv_w ) -{ - verboselog( machine(), 9, "(CLKDIV) %08X <- %08X\n", 0xE0440020 + (offset << 2), data); - COMBINE_DATA(&m_clkdiv_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_chipcontrol_r ) -{ - UINT32 data = m_chipcontrol_regs[offset]; - verboselog( machine(), 9, "(CHIPCONTROL) %08X -> %08X\n", 0xE0440100 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_chipcontrol_w ) -{ - verboselog( machine(), 9, "(CHIPCONTROL) %08X <- %08X\n", 0xE0440100 + (offset << 2), data); - COMBINE_DATA(&m_chipcontrol_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_intctrl_r ) -{ - UINT32 data = m_intctrl_regs[offset]; - verboselog( machine(), 9, "(INTCTRL) %08X -> %08X\n", 0xE0450000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_intctrl_w ) -{ - verboselog( machine(), 9, "(INTCTRL) %08X <- %08X\n", 0xE0450000 + (offset << 2), data); - switch (offset >> 3) { // Decode the group - case 0: // Group 1 - switch(offset & 7) { - case INTSTATCLR: // ITC_INTSTATCLR_REG Group 1 - /* - Bits 15 (PWM), 14 (PIO103) of Group 1 are the logical OR of their lower level interrupt - status bits down within the interrupting module and are not registered. - - The source registers must be cleared to clear these interrupt bits. - */ - data &= ~(INT_PWM_BIT|INT_PIO103_BIT); - - m_intctrl_regs[INTREG(INTGROUP1, INTSTATCLR)] &= ~data; - m_intctrl_regs[INTREG(INTGROUP1, INTSTATSET)] &= ~data; - m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] &= ~data; - break; - default: - COMBINE_DATA(&m_intctrl_regs[offset]); - break; - } - break; - case 1: // Group 2 - switch(offset & 7) { - case INTSTATCLR: // ITC_INTSTATCLR_REG Group 2 - /* - The timer interrupt service routine must write to one of the timer - registers before clearing the corresponding Interrupt Controller ISR timer - interrupt bit. - - Bit 7 (Timers) of Group 2 is the logical OR of its lower level interrupt - status bits down within the interrupting module and are not registered. - - The source registers must be cleared to clear these interrupt bits. - */ - if(m_timer_regs.timer_irq) data &= ~INT_TIMER_BIT; - - m_intctrl_regs[INTREG(INTGROUP2, INTSTATCLR)] &= ~data; - m_intctrl_regs[INTREG(INTGROUP2, INTSTATSET)] &= ~data; - m_intctrl_regs[INTREG(INTGROUP2, INTIRQ)] &= ~data; - break; - default: - COMBINE_DATA(&m_intctrl_regs[offset]); - break; - } - break; - default: - break; - } - - if(m_i2c1_regs[I2C_STAT_REG]&I2C_INT_BIT) - { - m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] |= 1<<7; - m_intctrl_regs[INTREG(INTGROUP1, INTSTATCLR)] |= 1<<7; - m_intctrl_regs[INTREG(INTGROUP1, INTSTATSET)] |= 1<<7; - } - - /* check if */ - if((m_intctrl_regs[INTREG(INTGROUP2, INTIRQ)] & m_intctrl_regs[INTREG(INTGROUP2, INTENABLE)]) - || (m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] & m_intctrl_regs[INTREG(INTGROUP1, INTENABLE)])) - m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - else - m_maincpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); - -} - -READ32_MEMBER( cxhumax_state::cx_ss_r ) -{ - UINT32 data = 0; - switch(offset) { - case SS_FIFC_REG: - data = m_ss_regs[offset] & 0xFFF0; - break; - default: - data = m_ss_regs[offset]; - break; - } - verboselog( machine(), 9, "(SS) %08X -> %08X\n", 0xE0490000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_ss_w ) -{ - verboselog( machine(), 9, "(SS) %08X <- %08X\n", 0xE0490000 + (offset << 2), data); - switch(offset) { - case SS_CNTL_REG: - if (data&1) { - // "Send" pending data - UINT8 tfd = (m_ss_regs[SS_STAT_REG]>>4) & 0xF; - if ((tfd>1) && (m_ss_tx_fifo[0] == 0) && (m_ss_tx_fifo[1] != 0xFF)) { - // ASCII - printf("%s\n", &m_ss_tx_fifo[1]); - } else { - // UNKNOWN - for (int i=0; i>4) & 0xF; - if (tfd<8) { - m_ss_tx_fifo[tfd++] = data; - m_ss_regs[SS_STAT_REG] = (m_ss_regs[SS_STAT_REG] & 0xFF0F) | (tfd<<4); - } - } - break; - case SS_STAT_REG: - // read-only - break; - default: - COMBINE_DATA(&m_ss_regs[offset]); - break; - }; -} - -READ32_MEMBER( cxhumax_state::cx_i2c0_r ) -{ - UINT32 data = m_i2c0_regs[offset]; - verboselog( machine(), 9, "(I2C0) %08X -> %08X\n", 0xE04E0000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_i2c0_w ) -{ - verboselog( machine(), 9, "(I2C0) %08X <- %08X\n", 0xE04E0000 + (offset << 2), data); - COMBINE_DATA(&m_i2c0_regs[offset]); -} - -UINT8 cxhumax_state::i2cmem_read_byte(int last) -{ - UINT8 data = 0; - int i; - m_i2cmem->write_sda(1); - for (i = 0; i < 8; i++) - { - m_i2cmem->write_scl(1); - data = (data << 1) + (m_i2cmem->read_sda() ? 1 : 0); - m_i2cmem->write_scl(0); - } - m_i2cmem->write_sda(last); - m_i2cmem->write_scl(1); - m_i2cmem->write_scl(0); - return data; -} - -void cxhumax_state::i2cmem_write_byte(UINT8 data) -{ - int i; - for (i = 0; i < 8; i++) - { - m_i2cmem->write_sda((data & 0x80) ? 1 : 0); - data = data << 1; - m_i2cmem->write_scl(1); - m_i2cmem->write_scl(0); - } - m_i2cmem->write_sda(1); // ack bit - m_i2cmem->write_scl(1); - m_i2cmem->write_scl(0); -} - -void cxhumax_state::i2cmem_start() -{ - m_i2cmem->write_sda(1); - m_i2cmem->write_scl(1); - m_i2cmem->write_sda(0); - m_i2cmem->write_scl(0); -} - -void cxhumax_state::i2cmem_stop() -{ - m_i2cmem->write_sda(0); - m_i2cmem->write_scl(1); - m_i2cmem->write_sda(1); - m_i2cmem->write_scl(0); -} - -READ32_MEMBER( cxhumax_state::cx_i2c1_r ) -{ - UINT32 data=0; - switch(offset) { - case I2C_STAT_REG: - data |= m_i2cmem->read_sda()<<3; - // fall - default: - data |= m_i2c1_regs[offset]; break; - } - verboselog( machine(), 9, "(I2C1) %08X -> %08X\n", 0xE04E1000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_i2c1_w ) -{ - verboselog( machine(), 9, "(I2C1) %08X <- %08X\n", 0xE04E1000 + (offset << 2), data); - switch(offset) { - case I2C_CTRL_REG: - if(data&0x10) {// START - i2cmem_start(); - } - if((data&0x4) || ((data&3)==3)) // I2C READ - { - m_i2c1_regs[I2C_RDATA_REG] = 0; - if(data&0x10) i2cmem_write_byte((data>>24)&0xFF); - if(m_i2c1_regs[I2C_MODE_REG]&(1<<5)) // BYTE_ORDER - { - for(int i=0; i<(data&3); i++) { - m_i2c1_regs[I2C_RDATA_REG] |= i2cmem_read_byte(0) << (i*8); - } - m_i2c1_regs[I2C_RDATA_REG] |= i2cmem_read_byte((data&0x20)?1:0) << ((data&3)*8); - } - else - { - for(int i=0; i<(data&3); i++) { - m_i2c1_regs[I2C_RDATA_REG] |= i2cmem_read_byte(0); - m_i2c1_regs[I2C_RDATA_REG] <<= 8; - } - m_i2c1_regs[I2C_RDATA_REG] |= i2cmem_read_byte((data&0x20)?1:0); - } - } - else - { - for(int i=0; i<=(data&3); i++) { - i2cmem_write_byte((data>>(24-(i*8))&0xFF)); - } - } - if(data&0x20) {// STOP - i2cmem_stop(); - } - - /* The interrupt status bit is set at the end of an I2C read or write operation. */ - m_i2c1_regs[I2C_STAT_REG] |= I2C_INT_BIT; - m_i2c1_regs[I2C_STAT_REG] |= I2C_WACK_BIT; - - m_intctrl_regs[INTREG(INTGROUP1, INTIRQ)] |= 1<<7; - m_intctrl_regs[INTREG(INTGROUP1, INTSTATCLR)] |= 1<<7; - m_intctrl_regs[INTREG(INTGROUP1, INTSTATSET)] |= 1<<7; - if (m_intctrl_regs[INTREG(INTGROUP1, INTENABLE)] & (1<<7)) { - verboselog( machine(), 9, "(I2C1) Int\n" ); - m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - } - break; - case I2C_STAT_REG: - /* The interrupt status bit may be cleared by writing (anything) to the status register, which also clears the acknowledge status. */ - data&=~(I2C_WACK_BIT|I2C_INT_BIT); - // fall - default: - COMBINE_DATA(&m_i2c1_regs[offset]); - } -} - -READ32_MEMBER( cxhumax_state::cx_i2c2_r ) -{ - UINT32 data = m_i2c2_regs[offset]; - verboselog( machine(), 9, "(I2C2) %08X -> %08X\n", 0xE04E2000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_i2c2_w ) -{ - verboselog( machine(), 9, "(I2C2) %08X <- %08X\n", 0xE04E2000 + (offset << 2), data); - COMBINE_DATA(&m_i2c2_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_mc_cfg_r ) -{ - UINT32 data = m_mccfg_regs[offset]; - verboselog( machine(), 9, "(MC_CFG) %08X -> %08X\n", 0xE0500300 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_mc_cfg_w ) -{ - verboselog( machine(), 9, "(MC_CFG) %08X <- %08X\n", 0xE0500300 + (offset << 2), data); - COMBINE_DATA(&m_mccfg_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_drm0_r ) -{ - UINT32 data = m_drm0_regs[offset]; - verboselog( machine(), 9, "(DRM0) %08X -> %08X\n", 0xE0560000 + (offset << 2), data); - switch(offset) { - case 0x14/4: // DRM_STATUS_REG - data |= 1<<21; - data |= 1<<20; - } - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_drm0_w ) -{ - verboselog( machine(), 9, "(DRM0) %08X <- %08X\n", 0xE0560000 + (offset << 2), data); - COMBINE_DATA(&m_drm0_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_drm1_r ) -{ - UINT32 data = m_drm1_regs[offset]; - verboselog( machine(), 9, "(DRM1) %08X -> %08X\n", 0xE0570000 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_drm1_w ) -{ - verboselog( machine(), 9, "(DRM1) %08X <- %08X\n", 0xE0570000 + (offset << 2), data); - COMBINE_DATA(&m_drm1_regs[offset]); -} - -READ32_MEMBER( cxhumax_state::cx_hdmi_r ) -{ - UINT32 data = m_hdmi_regs[offset]; - verboselog( machine(), 9, "(HDMI) %08X -> %08X\n", 0xE05D0800 + (offset << 2), data); - return data; -} - -WRITE32_MEMBER( cxhumax_state::cx_hdmi_w ) -{ - verboselog( machine(), 9, "(HDMI) %08X <- %08X\n", 0xE05D0800 + (offset << 2), data); - switch(offset) { - case 0x40/4: // HDMI_CONFIG_REG - if(data&8) m_hdmi_regs[0xc0/4] |= 0x80; - } - COMBINE_DATA(&m_hdmi_regs[offset]); -} - -void cxhumax_state::video_start() -{ -} - -/* copy from emu/rendersw.inc */ -/*------------------------------------------------------------------------ - ycc_to_rgb - convert YCC to RGB; the YCC pixel - contains Y in the LSB, Cb << 8, and Cr << 16 - This actually a YCbCr conversion, - details my be found in chapter 6.4 ff of - http://softwarecommunity.intel.com/isn/downloads/softwareproducts/pdfs/346495.pdf - The document also contains the constants below as floats. ---------------------------------------------------------------------------*/ - -INLINE UINT8 clamp16_shift8(UINT32 x) -{ - return (((INT32) x < 0) ? 0 : (x > 65535 ? 255: x >> 8)); -} - -INLINE UINT32 ycc_to_rgb(UINT32 ycc) -{ - /* original equations: - - C = Y - 16 - D = Cb - 128 - E = Cr - 128 - - R = clip(( 298 * C + 409 * E + 128) >> 8) - G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8) - B = clip(( 298 * C + 516 * D + 128) >> 8) - - R = clip(( 298 * (Y - 16) + 409 * (Cr - 128) + 128) >> 8) - G = clip(( 298 * (Y - 16) - 100 * (Cb - 128) - 208 * (Cr - 128) + 128) >> 8) - B = clip(( 298 * (Y - 16) + 516 * (Cb - 128) + 128) >> 8) - - R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8) - G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8) - B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8) - - R = clip(( 298 * Y - 298 * 16 + 409 * Cr - 409 * 128 + 128) >> 8) - G = clip(( 298 * Y - 298 * 16 - 100 * Cb + 100 * 128 - 208 * Cr + 208 * 128 + 128) >> 8) - B = clip(( 298 * Y - 298 * 16 + 516 * Cb - 516 * 128 + 128) >> 8) - - Now combine constants: - - R = clip(( 298 * Y + 409 * Cr - 56992) >> 8) - G = clip(( 298 * Y - 100 * Cb - 208 * Cr + 34784) >> 8) - B = clip(( 298 * Y + 516 * Cb - 70688) >> 8) - - Define common = 298 * y - 56992. This will save one addition - - R = clip(( common + 409 * Cr - 0) >> 8) - G = clip(( common - 100 * Cb - 208 * Cr + 91776) >> 8) - B = clip(( common + 516 * Cb - 13696) >> 8) - - */ - UINT8 y = ycc; - UINT8 cb = ycc >> 8; - UINT8 cr = ycc >> 16; - UINT32 r, g, b, common; - - common = 298 * y - 56992; - r = (common + 409 * cr); - g = (common - 100 * cb - 208 * cr + 91776); - b = (common + 516 * cb - 13696); - - /* Now clamp and shift back */ - return rgb_t(clamp16_shift8(r), clamp16_shift8(g), clamp16_shift8(b)); -} - -UINT32 cxhumax_state::screen_update_cxhumax(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int i, j; - - - UINT32 osd_pointer = m_drm1_regs[DRM_OSD_PTR_REG]; - - if(osd_pointer) - { - UINT32 *ram = m_ram; - UINT32 *osd_header = &ram[osd_pointer/4]; - UINT8 *vbuf = (UINT8*)(&ram[osd_header[3]/4]); - UINT32 *palette = &ram[osd_header[7]/4]; - - UINT32 x_disp_start_and_width = osd_header[1]; - UINT32 xdisp_width = (x_disp_start_and_width >> 16) & 0x1fff; - UINT32 xdisp_start = x_disp_start_and_width & 0xfff; - - UINT32 image_height_and_width = osd_header[2]; - UINT32 yimg_height = (image_height_and_width >> 16) & 0x7ff; - UINT32 ximg_width = image_height_and_width & 0x7ff; - - UINT32 y_position_and_region_alpha = osd_header[5]; - UINT32 ydisp_last = (y_position_and_region_alpha >> 12) & 0x7ff; - UINT32 ydisp_start = y_position_and_region_alpha & 0x7ff; - - /* UINT32 first_x = m_drm0_regs[DRM_ACTIVE_X_REG] & 0xffff; - UINT32 last_x = (m_drm0_regs[DRM_ACTIVE_X_REG] >> 16) & 0xffff; - - UINT32 first_y = m_drm0_regs[DRM_ACTIVE_Y_REG] & 0xfff; - UINT32 last_y = (m_drm0_regs[DRM_ACTIVE_Y_REG] >> 16) & 0xfff;*/ - - for (j=ydisp_start; j <= ydisp_last; j++) - { - UINT32 *bmp = &bitmap.pix32(j); - - for (i=xdisp_start; i <= (xdisp_start + xdisp_width); i++) - { - if ((i <= (xdisp_start + ximg_width)) && (j <= (ydisp_start + yimg_height))) { - bmp[i] = palette[vbuf[i+((j-ydisp_start)*ximg_width)]]; - } else { - bmp[i] = ycc_to_rgb(m_drm1_regs[DRM_BCKGND_REG]); - } - } - } - } - return 0; -} - -static ADDRESS_MAP_START(cxhumax_map, AS_PROGRAM, 32, cxhumax_state) - AM_RANGE(0x00000000, 0x03ffffff) AM_RAM AM_SHARE("ram") AM_MIRROR(0x40000000) // 64?MB RAM - AM_RANGE(0xe0000000, 0xe000ffff) AM_READWRITE(cx_hsx_r, cx_hsx_w) // HSX - AM_RANGE(0xe0010000, 0xe0010003) AM_READWRITE(cx_romdescr_r, cx_romdescr_w) // ROM Descriptor - AM_RANGE(0xe0010004, 0xe001000f) AM_READWRITE(cx_isaromdescr_r, cx_isaromdescr_w) // ISA/ROM Descriptors - AM_RANGE(0xe0010010, 0xe001001f) AM_READWRITE(cx_isadescr_r, cx_isadescr_w) // ISA Descriptors - AM_RANGE(0xe0010020, 0xe001002f) AM_READWRITE(cx_rommap_r, cx_rommap_w) // ROM Mapping - AM_RANGE(0xe0010030, 0xe0010033) AM_READWRITE(cx_rommode_r, cx_rommode_w) // ISA Mode - AM_RANGE(0xe0010034, 0xe0010037) AM_READWRITE(cx_xoemask_r, cx_xoemask_w) // XOE Mask - AM_RANGE(0xe0010040, 0xe0010047) AM_READWRITE(cx_pci_r, cx_pci_w) // PCI - AM_RANGE(0xe0010080, 0xe00100ff) AM_READWRITE(cx_extdesc_r, cx_extdesc_w) // Extended Control - AM_RANGE(0xe0400014, 0xe0400017) AM_WRITE(cx_remap_w) // RST_REMAP_REG - AM_RANGE(0xe0400024, 0xe0400027) AM_READWRITE(cx_scratch_r, cx_scratch_w) // RST_SCRATCH_REG - System Scratch Register - AM_RANGE(0xe0430000, 0xe0430103) AM_READWRITE(cx_timers_r, cx_timers_w) // Timers - AM_RANGE(0xe0411000, 0xe0411033) AM_READWRITE(cx_uart2_r, cx_uart2_w) // UART2 - AM_RANGE(0xe0440000, 0xe0440013) AM_READWRITE(cx_pll_r, cx_pll_w) // PLL Registers - AM_RANGE(0xe0440020, 0xe0440037) AM_READWRITE(cx_clkdiv_r, cx_clkdiv_w) // Clock Divider Registers - AM_RANGE(0xe0440094, 0xe0440097) AM_READWRITE(cx_pllprescale_r, cx_pllprescale_w) // PLL Prescale - AM_RANGE(0xe0440100, 0xe0440173) AM_READWRITE(cx_chipcontrol_r, cx_chipcontrol_w) // Chip Control Registers - AM_RANGE(0xe0450000, 0xe0450037) AM_READWRITE(cx_intctrl_r, cx_intctrl_w) // Interrupt Controller Registers - AM_RANGE(0xe0490000, 0xe0490017) AM_READWRITE(cx_ss_r, cx_ss_w) // Synchronous Serial Port - AM_RANGE(0xe04e0000, 0xe04e001f) AM_READWRITE(cx_i2c0_r, cx_i2c0_w) // I2C0 - AM_RANGE(0xe04e1000, 0xe04e101f) AM_READWRITE(cx_i2c1_r, cx_i2c1_w) // I2C1 - AM_RANGE(0xe04e2000, 0xe04e201f) AM_READWRITE(cx_i2c2_r, cx_i2c2_w) // I2C2 - AM_RANGE(0xe0500300, 0xe050030b) AM_READWRITE(cx_mc_cfg_r, cx_mc_cfg_w) // Memory Controller configuration - AM_RANGE(0xe0560000, 0xe05600fb) AM_READWRITE(cx_drm0_r, cx_drm0_w) // DRM0 - AM_RANGE(0xe0570000, 0xe05700fb) AM_READWRITE(cx_drm1_r, cx_drm1_w) // DRM1 - AM_RANGE(0xe05d0800, 0xe05d0bff) AM_READWRITE(cx_hdmi_r, cx_hdmi_w) // HDMI - AM_RANGE(0xe0600000, 0xe063ffff) AM_READWRITE(cx_gxa_r, cx_gxa_w) // GXA - AM_RANGE(0xe4017000, 0xe40173ff) AM_RAM // HSX - BSP - 1K Video Shared Dual Port RAM (shared with MVP) - AM_RANGE(0xe4080000, 0xe4083fff) AM_RAM // HSX - TSP 0 - 16K Private Instructions/Data and Host-Shared Data - AM_RANGE(0xf0000000, 0xf03fffff) AM_READWRITE(flash_r, flash_w) AM_MIRROR(0xf8000000) // 4MB FLASH (INTEL 28F320J3D) - AM_RANGE(0xf4000000, 0xf43fffff) AM_READ(dummy_flash_r) // do we need it? -ADDRESS_MAP_END - -static INPUT_PORTS_START( cxhumax ) -INPUT_PORTS_END - -void cxhumax_state::machine_start() -{ - int index = 0; - for(index = 0; index < MAX_CX_TIMERS; index++) - { - m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cxhumax_state::timer_tick),this)); - m_timer_regs.timer[index].timer->adjust(attotime::never, index); - } -} - -void cxhumax_state::machine_reset() -{ - m_i2c0_regs[0x08/4] = 0x08; // SDA high - m_i2c2_regs[0x08/4] = 0x08; // SDA high - - UINT8* FLASH = memregion("flash")->base(); - memcpy(m_ram,FLASH,0x400000); - - m_chipcontrol_regs[PIN_CONFIG_0_REG] = - 1 << 0 | /* Short Reset: 0=200ms delay ; 1=1ms delay */ - 1 << 1 | /* Software config bit. OK */ - 1 << 4 | /* SDRAM memory controller data width. 0=16bit 1=32bit */ - 1 << 11 | /* I/O Addr bus width 11=23 bit 10=22bit 01=21bit 00=20bit / PCImode: 0=held in reset 1=normal reset OK? */ - 0 << 16 | /* 0=PCI mode 1=Standard I/O mode */ - 1 << 23 | /* 0=PCI device 1=PCI host bridge OK */ - 1 << 26 | /* 0=SC1 used for NDS 1=SC1 not used for NDS */ - 1 << 27 | /* 0=8bit ROM 1=16bit ROM */ - 1 << 28 | /* 0=SC0 used for NDS 1=SC0 not used for NDS */ - 0 << 29 | /* 0=using SC2 1=not using SC2 */ - 0 << 30 | /* 0=using SC1 (TDA8004) 1=not using SC1 */ - 1 << 31; /* 0=Ext clk for boot 1=Int PLL for boot OK */ - m_chipcontrol_regs[SREG_MODE_REG] = 0x0000020F; - - memset(m_isaromdescr_regs,0,sizeof(m_isaromdescr_regs)); - memset(m_isadescr_regs,0,sizeof(m_isadescr_regs)); - m_rommode_reg=0; - m_xoemask_reg=0; - memset(m_extdesc_regs,0,sizeof(m_extdesc_regs)); - - m_pll_regs[SREG_MPG_0_INTFRAC_REG] = (0x1A << 25) /* integer */ | 0x5D1764 /* fraction */; - m_pll_regs[SREG_MPG_1_INTFRAC_REG] = (0x1A << 25) /* integer */ | 0x5D1764 /* fraction */; - m_pll_regs[SREG_ARM_INTFRAC_REG] = (0x28 << 25) /* integer */ | 0xCEDE62 /* fraction */; - m_pll_regs[SREG_MEM_INTFRAC_REG] = (0x13 << 25) /* integer */ | 0xC9B26D /* fraction */; - m_pll_regs[SREG_USB_INTFRAC_REG] = (0x08 << 25) /* integer */ | 0x52BF5B /* fraction */; - - m_clkdiv_regs[SREG_DIV_0_REG] = (2<<0)|(1<<6)|(2<<8)|(2<<14)|(10<<16)|(1<<22)|(10<<24)|(1<<30); - m_clkdiv_regs[SREG_DIV_1_REG] = (5<<0)|(0<<6)|(12<<8)|(0<<14)|(4<<16)|(1<<22)|(5<<24)|(1<<30); - m_clkdiv_regs[SREG_DIV_2_REG] = (22<<0)|(0<<6)|(12<<8)|(1<<14)|(4<<16)|(3<<22); //|(5<<24)|(1<<30);??? - m_clkdiv_regs[SREG_DIV_3_REG] = (5<<0)|(0<<6)|(5<<8)|(0<<14)|(5<<16)|(0<<22)|(5<<24)|(0<<30); - m_clkdiv_regs[SREG_DIV_4_REG] = (8<<0)|(0<<6)|(5<<8)|(0<<14)|(5<<16)|(0<<22)|(5<<24)|(0<<30); - m_clkdiv_regs[SREG_DIV_5_REG] = (8<<0)|(0<<6)|(5<<8)|(0<<14)|(5<<16)|(0<<22); - - m_pllprescale_reg=0xFFF; - - m_mccfg_regs[MC_CFG0] = ((m_chipcontrol_regs[PIN_CONFIG_0_REG]>>4)&1)<<16; - m_mccfg_regs[MC_CFG1] = 0; - m_mccfg_regs[MC_CFG2] = (7<<8)|(7<<0); - - // UART2 - m_uart2_regs[UART_FIFC_REG] = 0x30; - - // Clear SS TX FIFO - memset(m_ss_tx_fifo,0,sizeof(m_ss_tx_fifo)); - m_ss_regs[SS_BAUD_REG] = 1; // Default SS clock = 13,5MHz - - memset(m_intctrl_regs,0,sizeof(m_intctrl_regs)); - - memset(m_hdmi_regs,0,sizeof(m_hdmi_regs)); - - memset(m_gxa_cmd_regs,0,sizeof(m_gxa_cmd_regs)); -} - -static MACHINE_CONFIG_START( cxhumax, cxhumax_state ) - MCFG_CPU_ADD("maincpu", ARM920T, 180000000) // CX24175 (RevC up?) - MCFG_CPU_PROGRAM_MAP(cxhumax_map) - - - MCFG_INTEL_28F320J3D_ADD("flash") - MCFG_I2CMEM_ADD("eeprom") - MCFG_I2CMEM_DATA_SIZE(0x2000) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1920, 1080) - MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 1080-1) - MCFG_SCREEN_UPDATE_DRIVER(cxhumax_state, screen_update_cxhumax) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) -MACHINE_CONFIG_END - -ROM_START( hxhdci2k ) - ROM_REGION( 0x400000, "flash", 0 ) - ROM_SYSTEM_BIOS( 0, "FW10005", "HDCI REV 1.0 RHDXSCI 1.00.05" ) /* 19 AUG 2008 */ - ROM_LOAD16_WORD_SWAP( "28f320j3d.bin", 0x000000, 0x400000, BAD_DUMP CRC(63d98942) SHA1(c5b8d701677a3edc25f203854f44953b19c9158d) ) - - ROM_REGION16_BE( 0x2000, "eeprom", 0 ) - ROM_LOAD( "24lc64.bin", 0x0000, 0x2000, NO_DUMP) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -SYST( 2008, hxhdci2k, 0, 0, cxhumax, cxhumax, driver_device, 0, "HUMAX", "HUMAX HDCI-2000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/cybiko.c b/src/mess/drivers/cybiko.c deleted file mode 100644 index a3a4bd2864e..00000000000 --- a/src/mess/drivers/cybiko.c +++ /dev/null @@ -1,461 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/************************************************************************************* - - Cybiko Wireless Inter-tainment System - - (c) 2001-2007 Tim Schuerewegen - - Cybiko Classic (V1) - Cybiko Classic (V2) - Cybiko Xtreme - -ToDo: -- Remove the memory leak in the nvram handler. -- Provide facility to load games via a "cart". -- Need instructions! The black screen doesn't fill me with confidence..unable to test. - -**************************************************************************************/ - - -#include "includes/cybiko.h" -#include "rendlay.h" - -// +------------------------------------------------------+ -// | Cybiko Classic (CY6411) | V2 | -// +------------------------------------------------------+ -// | - CYBIKO | CY-OS 1.1.7 | 6432241M04FA | 0028R JAPAN | -// | - SST 39VF020 | 90-4C-WH | 0012175-D | -// | - ATMEL 0027 | AT90S2313-4SC | -// | - ATMEL | AT45DB041A | TC | 0027 | -// | - RF2915 | RFMD0028 | 0F540BT | -// | - EliteMT | LP62S2048X-70LLT | 0026B H4A27HA | -// | - MP02AB | LMX2315 | TMD | -// +------------------------------------------------------+ - -// +------------------------------------------------------+ -// | Cybiko Xtreme (CY44802) | -// +------------------------------------------------------+ -// | - CYBIKO | CYBOOT 1.5A | HD6432323G03F | 0131 JAPAN | -// | - SST 39VF400A | 70-4C-EK | -// | - ATMEL 0033 | AT90S2313-4SC | -// | - SAMSUNG 129 | K4F171612D-TL60 | -// | - 2E16AB | USBN9604-28M | NSC00A1 | -// +------------------------------------------------------+ - -// +------------------------------------------------------+ -// | Cybiko MP3 Player (CY65P10) | -// +------------------------------------------------------+ -// | - H8S/2246 | 0G1 | HD6472246FA20 | JAPAN | -// | - MICRONAS | DAC3550A C2 | 0394 22 HM U | 089472.000 | -// | - 2E08AJ | USBN9603-28M | NSC99A1 | -// +------------------------------------------------------+ - -/////////////////////////// -// ADDRESS MAP - PROGRAM // -/////////////////////////// - -// 512 kbyte ram + no memory mapped flash -static ADDRESS_MAP_START( cybikov1_mem, AS_PROGRAM, 16, cybiko_state ) - AM_RANGE( 0x000000, 0x007fff ) AM_ROM - AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( cybiko_lcd_r, cybiko_lcd_w ) - AM_RANGE( 0xe00000, 0xe07fff ) AM_READ( cybikov1_key_r ) -ADDRESS_MAP_END - -// +-------------------------------------+ -// | Cybiko Classic (V2) - Memory Map | -// +-------------------------------------+ -// | 000000 - 007FFF | rom | -// | 008000 - 00FFFF | 17 51 17 51 .. | -// | 010000 - 0FFFFF | flash mirror | -// | 100000 - 13FFFF | flash | -// | 140000 - 1FFFFF | flash mirror | -// | 200000 - 23FFFF | ram | -// | 240000 - 3FFFFF | ram mirror | -// | 400000 - 5FFFFF | FF FF FF FF .. | -// | 600000 - 600001 | lcd | -// | 600002 - DFFFFF | FF FF FF FF .. | -// | E00000 - FFDBFF | keyboard | -// | FFDC00 - FFFFFF | onchip ram & regs | -// +-------------------------------------+ - -// 256 kbyte ram + 256 kbyte memory mapped flash -static ADDRESS_MAP_START( cybikov2_mem, AS_PROGRAM, 16, cybiko_state ) - AM_RANGE( 0x000000, 0x007fff ) AM_ROM - AM_RANGE( 0x100000, 0x13ffff ) AM_DEVREAD8("flash2", sst_39vf020_device, read, 0xffff) AM_MIRROR( 0x0c0000 ) - AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( cybiko_lcd_r, cybiko_lcd_w ) AM_MIRROR( 0x1ffffe ) - AM_RANGE( 0xe00000, 0xffdbff ) AM_READ( cybikov2_key_r ) -ADDRESS_MAP_END - -// 2048 kbyte ram + 512 kbyte memory mapped flash -static ADDRESS_MAP_START( cybikoxt_mem, AS_PROGRAM, 16, cybiko_state ) - AM_RANGE( 0x000000, 0x007fff ) AM_ROM AM_MIRROR( 0x038000 ) - AM_RANGE( 0x100000, 0x100001 ) AM_READWRITE( cybiko_lcd_r, cybiko_lcd_w ) - AM_RANGE( 0x200000, 0x200003 ) AM_WRITE( cybiko_usb_w ) - AM_RANGE( 0x600000, 0x67ffff ) AM_DEVREAD("flashxt", sst_39vf400a_device, read) AM_MIRROR( 0x180000 ) - AM_RANGE( 0xe00000, 0xefffff ) AM_READ( cybikoxt_key_r ) -ADDRESS_MAP_END - -WRITE16_MEMBER(cybiko_state::serflash_w) -{ - m_flash1->cs_w ((data & 0x10) ? 0 : 1); -} - -READ16_MEMBER(cybiko_state::clock_r) -{ - if (m_rtc->sda_r()) - { - return (0x01|0x04); - } - - return 0x04; -} - -WRITE16_MEMBER(cybiko_state::clock_w) -{ - m_rtc->scl_w((data & 0x02) ? 1 : 0); - m_rtc->sda_w((data & 0x01) ? 0 : 1); -} - -READ16_MEMBER(cybiko_state::xtclock_r) -{ - if (m_rtc->sda_r()) - { - return 0x40; - } - - return 0; -} - -WRITE16_MEMBER(cybiko_state::xtclock_w) -{ - m_rtc->scl_w((data & 0x02) ? 1 : 0); - m_rtc->sda_w((data & 0x40) ? 0 : 1); -} - -READ16_MEMBER(cybiko_state::xtpower_r) -{ - // bit 7 = on/off button - // bit 6 = battery charged if "1" - return 0xc0c0; -} - -////////////////////// -// ADDRESS MAP - IO // -////////////////////// - -static ADDRESS_MAP_START( cybikov1_io, AS_IO, 16, cybiko_state ) - AM_RANGE(h8_device::PORT_3, h8_device::PORT_3) AM_WRITE(serflash_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cybikov2_io, AS_IO, 16, cybiko_state ) - AM_RANGE(h8_device::PORT_3, h8_device::PORT_3) AM_WRITE(serflash_w) - AM_RANGE(h8_device::PORT_F, h8_device::PORT_F) AM_READWRITE(clock_r, clock_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( cybikoxt_io, AS_IO, 16, cybiko_state ) - AM_RANGE(h8_device::PORT_A, h8_device::PORT_A) AM_READ(xtpower_r) - AM_RANGE(h8_device::PORT_F, h8_device::PORT_F) AM_READWRITE(xtclock_r, xtclock_w) -ADDRESS_MAP_END - -///////////////// -// INPUT PORTS // -///////////////// - - -static INPUT_PORTS_START( cybiko ) - PORT_START("A.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('`') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("A.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("As") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Fn") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("A.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - - PORT_START("A.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - - PORT_START("A.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Select") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("A.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR( 13 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - - PORT_START("A.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BkSp") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - - PORT_START("A.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - - PORT_START("A.8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - -INPUT_PORTS_END - -static INPUT_PORTS_START( cybikoxt ) - PORT_START("A.0") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - - PORT_START("A.1") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - - PORT_START("A.2") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - - PORT_START("A.3") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("A.4") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR( 13 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Select") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("A.5") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("As") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("A.6") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("A.7") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Fn") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("A.8") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("A.13") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - - PORT_START("A.14") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("On/Off") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - -INPUT_PORTS_END - -//////////////////// -// MACHINE DRIVER // -//////////////////// - -static MACHINE_CONFIG_START( cybikov1, cybiko_state ) - // cpu - MCFG_CPU_ADD( "maincpu", H8S2241, XTAL_11_0592MHz ) - MCFG_CPU_PROGRAM_MAP( cybikov1_mem ) - MCFG_CPU_IO_MAP( cybikov1_io ) - - MCFG_DEVICE_MODIFY("maincpu:sci1") - MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE("^flash1", at45db041_device, si_w)) - MCFG_H8_SCI_CLK_CALLBACK(DEVWRITELINE("^flash1", at45db041_device, sck_w)) - - // screen - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE( 60 ) - MCFG_SCREEN_SIZE( HD66421_WIDTH, HD66421_HEIGHT ) - MCFG_SCREEN_VISIBLE_AREA( 0, HD66421_WIDTH - 1, 0, HD66421_HEIGHT - 1 ) - MCFG_SCREEN_UPDATE_DEVICE("hd66421", hd66421_device, update_screen) - MCFG_SCREEN_PALETTE("hd66421:palette") - // video - MCFG_HD66421_ADD("hd66421") - MCFG_DEFAULT_LAYOUT(layout_lcd) - // sound - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - // machine - /* rtc */ - MCFG_PCF8593_ADD("rtc") - MCFG_AT45DB041_ADD("flash1") - MCFG_AT45DBXXX_SO_CALLBACK(DEVWRITELINE("maincpu:sci1", h8_sci_device, rx_w)) - - MCFG_NVRAM_ADD_0FILL("nvram") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_EXTRA_OPTIONS("1M") - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", cybiko_state, cybiko, "bin,nv", 0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( cybikov2, cybikov1) - // cpu - MCFG_CPU_REPLACE("maincpu", H8S2246, XTAL_11_0592MHz) - MCFG_CPU_PROGRAM_MAP(cybikov2_mem) - MCFG_CPU_IO_MAP(cybikov2_io) - - MCFG_DEVICE_MODIFY("maincpu:sci1") - MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE("^flash1", at45db041_device, si_w)) - MCFG_H8_SCI_CLK_CALLBACK(DEVWRITELINE("^flash1", at45db041_device, sck_w)) - - // machine - MCFG_SST_39VF020_ADD("flash2") - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_RAM_EXTRA_OPTIONS("512K,1M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( cybikoxt, cybikov1) - // cpu - MCFG_CPU_REPLACE("maincpu", H8S2323, XTAL_18_432MHz) - MCFG_CPU_PROGRAM_MAP(cybikoxt_mem ) - MCFG_CPU_IO_MAP(cybikoxt_io ) - - // machine - MCFG_DEVICE_REMOVE("flash1") - MCFG_SST_39VF400A_ADD("flashxt") - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - - /* quickload */ - MCFG_DEVICE_REMOVE("quickload") - MCFG_QUICKLOAD_ADD("quickload", cybiko_state, cybikoxt, "bin,nv", 0) -MACHINE_CONFIG_END - -///////// -// ROM // -///////// - -ROM_START( cybikov1 ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "cyrom112.bin", 0, 0x8000, CRC(9e1f1a0f) SHA1(6fc08de6b2c67d884ec78f748e4a4bad27ee8045) ) - - ROM_REGION( 0x84000, "flash1", 0 ) - ROM_LOAD( "flash1.bin", 0, 0x84000, NO_DUMP ) -ROM_END - -ROM_START( cybikov2 ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "cyrom117.bin", 0, 0x8000, CRC(268da7bf) SHA1(135eaf9e3905e69582aabd9b06bc4de0a66780d5) ) - - ROM_SYSTEM_BIOS( 0, "v1358", "v1.3.58" ) - ROM_SYSTEM_BIOS( 1, "v1357", "v1.3.57" ) - ROM_SYSTEM_BIOS( 2, "v1355", "v1.3.55" ) - - ROM_REGION( 0x84000, "flash1", 0 ) - ROMX_LOAD( "flash_v1358.bin", 0, 0x84000, CRC(e485880f) SHA1(e414d6d2f876c7c811946bcdfcb6212999412381), ROM_BIOS(1) ) - ROMX_LOAD( "flash_v1357.bin", 0, 0x84000, CRC(9fd3c058) SHA1(dad0c3db0f11c91747db6ccc1900004432afb881), ROM_BIOS(2) ) - ROMX_LOAD( "flash_v1355.bin", 0, 0x84000, CRC(497a5bbe) SHA1(0af611424cbf287b26c668a3109fb0861a27f603), ROM_BIOS(3) ) - - ROM_REGION( 0x40000, "flash2", 0 ) - ROMX_LOAD( "cyos_v1358.bin", 0, 0x40000, CRC(05ca4ece) SHA1(eee329e8541e1e36c22acb1317378ce23ccd1e12), ROM_BIOS(1) ) - ROMX_LOAD( "cyos_v1357.bin", 0, 0x40000, CRC(54ba7d43) SHA1(c6e0f7982e0f7a5fa65f2cecc8b27cb21909a407), ROM_BIOS(2) ) - ROMX_LOAD( "cyos_v1355.bin", 0, 0x40000, CRC(02d3dba5) SHA1(4ed728940bbcb3d2464fc7fba14d17924ece94aa), ROM_BIOS(3) ) -ROM_END - -ROM_START( cybikoxt ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "cyrom150.bin", 0, 0x8000, CRC(18b9b21f) SHA1(28868d6174eb198a6cec6c3c70b6e494517229b9) ) - - ROM_SYSTEM_BIOS( 0, "v1508", "v1.5.08" ) - - ROM_REGION( 0x80000, "flashxt", 0 ) - ROMX_LOAD( "cyos_v1508.bin", 0, 0x80000, CRC(f79400ba) SHA1(537a88e238746b3944b0cdfd4b0a9396460b2977), ROM_BIOS(1) ) -ROM_END - -////////////// -// DRIVERS // -////////////// - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 2000, cybikov1, 0, 0, cybikov1, cybiko, cybiko_state, cybiko , "Cybiko Inc", "Cybiko Classic (V1)", MACHINE_IMPERFECT_SOUND ) -COMP( 2000, cybikov2, cybikov1, 0, cybikov2, cybiko, cybiko_state, cybiko , "Cybiko Inc", "Cybiko Classic (V2)", MACHINE_IMPERFECT_SOUND ) -COMP( 2001, cybikoxt, cybikov1, 0, cybikoxt, cybikoxt, cybiko_state, cybikoxt, "Cybiko Inc", "Cybiko Xtreme", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mess/drivers/czk80.c b/src/mess/drivers/czk80.c deleted file mode 100644 index 913d07d693f..00000000000 --- a/src/mess/drivers/czk80.c +++ /dev/null @@ -1,230 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -CZK-80 - -2010-08-30 Skeleton driver -2010-11-27 Connected to a terminal -2014-01-08 Added devices - -Only known info: http://forum.z80.de/showtopic.php?threadid=280 - -On main board there are Z80A CPU, Z80A PIO, Z80A DART and Z80A CTC - there is 8K ROM and XTAL 16MHz - Two undumped proms, AM27S20DC and D3631-1. -FDC board contains Z80A DMA and NEC 765A (XTAL on it is 8MHZ) -Mega board contains 74LS612 and memory chips (32x 41256) - -Status: - It prints 2 lines of text, then: - - If fdc is enabled in address map, it hangs waiting for a fdc response. - - Otherwise, it displays an error, and you can press a key to try again. - -ToDo: -- Everything... no diagram or manuals, so EVERYTHING below is guesswork. -- Need software - -I/O ports: These ranges are what is guessed - 40 : rom switching - 4c-4F : PIO - 50-53 : DART - 54-57 : CTC - 80-81 : Parallel port (no programming bytes are sent, so it isn't a device) - C0-C1 : FDC - It is not known what address is used by: - - the DMA - - the Motor-on signal(s) - as there are no unknown writes. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/upd765.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "machine/z80ctc.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class czk80_state : public driver_device -{ -public: - czk80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_fdc(*this, "fdc") - { - } - - DECLARE_DRIVER_INIT(czk80); - DECLARE_MACHINE_RESET(czk80); - TIMER_CALLBACK_MEMBER(czk80_reset); - DECLARE_READ8_MEMBER(port80_r); - DECLARE_READ8_MEMBER(port81_r); - DECLARE_READ8_MEMBER(portc0_r); - DECLARE_WRITE8_MEMBER(port40_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); -private: - UINT8 m_term_data; - required_device m_maincpu; - required_device m_terminal; - required_device m_fdc; -}; - - -WRITE8_MEMBER( czk80_state::port40_w ) -{ - membank("bankr1")->set_entry(BIT(data, 1)); -} - -READ8_MEMBER( czk80_state::port80_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( czk80_state::portc0_r ) -{ - return 0x80; -} - -READ8_MEMBER( czk80_state::port81_r ) -{ - return (m_term_data) ? 3 : 1; -} - -static ADDRESS_MAP_START(czk80_mem, AS_PROGRAM, 8, czk80_state) - AM_RANGE(0x0000, 0x1fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x2000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(czk80_io, AS_IO, 8, czk80_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x40) AM_WRITE(port40_w) - AM_RANGE(0x4c, 0x4f) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) - AM_RANGE(0x50, 0x53) AM_DEVREADWRITE("z80dart", z80dart_device, cd_ba_r, cd_ba_w) - AM_RANGE(0x54, 0x57) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0x80, 0x80) AM_READ(port80_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x81, 0x81) AM_READ(port81_r) - /* Select one of the below */ - //AM_RANGE(0xc0, 0xc0) AM_READ(portc0_r) - AM_RANGE(0xc0, 0xc1) AM_DEVICE("fdc", upd765a_device, map) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( czk80 ) -INPUT_PORTS_END - -/* Z80 Daisy Chain */ - -static const z80_daisy_config daisy_chain[] = -{ - { "z80pio" }, - { "z80dart" }, - { "z80ctc" }, - { NULL } -}; - -/* Z80-CTC Interface */ - -WRITE_LINE_MEMBER( czk80_state::ctc_z0_w ) -{ -// guess this generates clock for z80dart -} - -WRITE_LINE_MEMBER( czk80_state::ctc_z1_w ) -{ -} - -WRITE_LINE_MEMBER( czk80_state::ctc_z2_w ) -{ -} - -/* after the first 4 bytes have been read from ROM, switch the ram back in */ -TIMER_CALLBACK_MEMBER( czk80_state::czk80_reset) -{ - membank("bankr0")->set_entry(1); -} - -MACHINE_RESET_MEMBER( czk80_state, czk80 ) -{ - machine().scheduler().timer_set(attotime::from_usec(3), timer_expired_delegate(FUNC(czk80_state::czk80_reset),this)); - membank("bankr0")->set_entry(0); // point at rom - membank("bankw0")->set_entry(0); // always write to ram - membank("bankr1")->set_entry(0); // point at rom - membank("bankw1")->set_entry(0); // always write to ram -} - -DRIVER_INIT_MEMBER( czk80_state, czk80 ) -{ - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(1, &main[0x0000]); - membank("bankr0")->configure_entry(0, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); - - membank("bankr1")->configure_entry(1, &main[0xe000]); - membank("bankr1")->configure_entry(0, &main[0x10000]); - membank("bankw1")->configure_entry(0, &main[0xe000]); -} - -static SLOT_INTERFACE_START( czk80_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -WRITE8_MEMBER( czk80_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( czk80, czk80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(czk80_mem) - MCFG_CPU_IO_MAP(czk80_io) - MCFG_CPU_CONFIG(daisy_chain) - MCFG_MACHINE_RESET_OVERRIDE(czk80_state, czk80) - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(czk80_state, kbd_put)) - MCFG_UPD765A_ADD("fdc", false, true) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", czk80_floppies, "525dd", floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(czk80_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(czk80_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(czk80_state, ctc_z2_w)) - - MCFG_Z80DART_ADD("z80dart", XTAL_16MHz / 4, 0, 0, 0, 0 ) - //MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - //MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - //MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_16MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( czk80 ) - ROM_REGION( 0x12000, "maincpu", 0 ) - ROM_LOAD( "czk80.rom", 0x10000, 0x2000, CRC(7081b7c6) SHA1(13f75b14ea73b252bdfa2384e6eead6e720e49e3)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, czk80, 0, 0, czk80, czk80, czk80_state, czk80, "", "CZK-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/d6800.c b/src/mess/drivers/d6800.c deleted file mode 100644 index 29f9a074051..00000000000 --- a/src/mess/drivers/d6800.c +++ /dev/null @@ -1,435 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/******************************************************************************** - - The Dream 6800 is a CHIP-8 computer roughly modelled on the Cosmac VIP. - It was described in Electronics Australia magazine in 4 articles starting - in May 1979. It has 1k of ROM and 1k of RAM. The video consists of 64x32 - pixels. The keyboard is a hexcode 4x4 matrix, plus a Function key. - - Designed by Michael Bauer, of the Division of Computing and Mathematics - at Deakin University, Australia. - - NOTE that the display only updates after each 4 digits is entered, and - you can't see what you type as you change bytes. This is by design. - - The cassette has no checksum, header or blocks. It is simply a stream - of pulses. The successful loading of a tape is therefore a matter of luck. - - Function keys: - FN 0 - Modify memory - firstly enter a 4-digit address, then 2-digit data - the address will increment by itself, enter the next byte. - FN by itself will step to the next address. - - FN 1 - Tape load. You must have entered the start address at 0002, and - the end address+1 at 0004 (big-endian). - - FN 2 - Tape save. You must have entered the start address at 0002, and - the end address+1 at 0004 (big-endian). - - FN 3 - Run. You must have entered the 4-digit go address first. - - All CHIP-8 programs load at 0x200 (max size 4k), and exec address - is C000. - - Information and programs can be found at http://chip8.com/?page=78 - - -**********************************************************************************/ - - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "sound/beep.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "sound/wave.h" -#include "machine/6821pia.h" - - -class d6800_state : public driver_device -{ -public: - d6800_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cass(*this, "cassette"), - m_pia(*this, "pia"), - m_beeper(*this, "beeper"), - m_videoram(*this, "videoram"), - m_io_x0(*this, "X0"), - m_io_x1(*this, "X1"), - m_io_x2(*this, "X2"), - m_io_x3(*this, "X3"), - m_io_y0(*this, "Y0"), - m_io_y1(*this, "Y1"), - m_io_y2(*this, "Y2"), - m_io_y3(*this, "Y3"), - m_io_shift(*this, "SHIFT") { } - - DECLARE_READ8_MEMBER( d6800_cassette_r ); - DECLARE_WRITE8_MEMBER( d6800_cassette_w ); - DECLARE_READ8_MEMBER( d6800_keyboard_r ); - DECLARE_WRITE8_MEMBER( d6800_keyboard_w ); - DECLARE_WRITE_LINE_MEMBER( d6800_screen_w ); - UINT32 screen_update_d6800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(d6800_c); - TIMER_DEVICE_CALLBACK_MEMBER(d6800_p); - DECLARE_QUICKLOAD_LOAD_MEMBER( d6800 ); -protected: - required_device m_maincpu; - required_device m_cass; - required_device m_pia; - required_device m_beeper; - required_shared_ptr m_videoram; - required_ioport m_io_x0; - required_ioport m_io_x1; - required_ioport m_io_x2; - required_ioport m_io_x3; - required_ioport m_io_y0; - required_ioport m_io_y1; - required_ioport m_io_y2; - required_ioport m_io_y3; - required_ioport m_io_shift; -private: - UINT8 m_rtc; - bool m_cb2; - bool m_cassold; - UINT8 m_cass_data[4]; - UINT8 m_portb; - virtual void machine_start(); - virtual void machine_reset(); -}; - - -/* Memory Maps */ - -static ADDRESS_MAP_START( d6800_map, AS_PROGRAM, 8, d6800_state ) - AM_RANGE(0x0000, 0x00ff) AM_RAM - AM_RANGE(0x0100, 0x01ff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x0200, 0x0fff) AM_RAM - AM_RANGE(0x8010, 0x8013) AM_DEVREADWRITE("pia", pia6821_device, read, write) - AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3800) AM_ROM -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( d6800 ) - PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y0") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - - PORT_START("Y1") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("Y2") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("Y3") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("SHIFT") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FN") PORT_CODE(KEYCODE_LSHIFT) - - PORT_START("VS") - /* vblank */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") -INPUT_PORTS_END - -/* Video */ - -UINT32 d6800_state::screen_update_d6800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 x,y,gfx=0; - - for (y = 0; y < 32; y++) - { - UINT16 *p = &bitmap.pix16(y); - - for (x = 0; x < 8; x++) - { - if (m_cb2) - gfx = m_videoram[ x | (y<<3)]; - - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - return 0; -} - -/* NE556 */ - -TIMER_DEVICE_CALLBACK_MEMBER(d6800_state::d6800_c) -{ - m_cass_data[3]++; - - if (BIT(m_portb, 0) != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = BIT(m_portb, 0); - } - - if (BIT(m_portb, 0)) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -/* PIA6821 Interface */ - -TIMER_DEVICE_CALLBACK_MEMBER(d6800_state::d6800_p) -{ - m_rtc++; - if (m_rtc > 159) - m_rtc = 0; - - UINT8 data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read(); - int ca1 = (data == 255) ? 0 : 1; - int ca2 = m_io_shift->read(); - int cb1 = (m_rtc) ? 1 : 0; - - m_pia->ca1_w(ca1); - m_pia->ca2_w(ca2); - m_pia->cb1_w(cb1); - - /* cassette - turn 1200/2400Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_cass_data[2] = ((m_cass_data[1] < 12) ? 128 : 0); - m_cass_data[1] = 0; - } -} - - -WRITE_LINE_MEMBER( d6800_state::d6800_screen_w ) -{ - m_cb2 = state; -} - -READ8_MEMBER( d6800_state::d6800_cassette_r ) -{ - /* - Cassette circuit consists of a 741 op-amp, a 74121 oneshot, and a 74LS74. - When a pulse arrives, the oneshot is set. After a preset time, it triggers - and the 74LS74 compares this pulse to the output of the 741. Therefore it - knows if the tone is 1200 or 2400 Hz. Input to PIA is bit 7. - */ - - return m_cass_data[2] | m_portb; -} - -WRITE8_MEMBER( d6800_state::d6800_cassette_w ) -{ - /* - A NE556 runs at either 1200 or 2400 Hz, depending on the state of bit 0. - This output drives the speaker and the output signal to the cassette player. - Bit 6 enables the speaker. Also the speaker is silenced when cassette operations - are in progress (DMA/CB2 line low). - */ - - m_beeper->set_frequency(BIT(data, 0) ? 2400 : 1200); - m_beeper->set_state(BIT(data, 6) & m_cb2); - - m_portb = data & 0x7f; -} - -READ8_MEMBER( d6800_state::d6800_keyboard_r ) -{ - /* - This system reads the key matrix one way, then swaps the input and output - lines around and reads it another way. This isolates the key that was pressed. - */ - - UINT8 data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read() - & m_io_y0->read() & m_io_y1->read() & m_io_y2->read() & m_io_y3->read(); - - return data; -} - -WRITE8_MEMBER( d6800_state::d6800_keyboard_w ) -{ - /* - - bit description - - PA0 keyboard column 0 - PA1 keyboard column 1 - PA2 keyboard column 2 - PA3 keyboard column 3 - PA4 keyboard row 0 - PA5 keyboard row 1 - PA6 keyboard row 2 - PA7 keyboard row 3 - - */ - -} - -/* Machine Initialization */ - -void d6800_state::machine_start() -{ -} - -void d6800_state::machine_reset() -{ - m_beeper->set_state(0); - m_rtc = 0; - m_cass_data[0] = 0; - m_cass_data[1] = 0; - m_cass_data[2] = 128; - m_cass_data[3] = 0; -} - -/* Machine Drivers */ - -QUICKLOAD_LOAD_MEMBER( d6800_state, d6800 ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int i; - int quick_addr = 0x200; - int exec_addr = 0xc000; - int quick_length; - dynamic_buffer quick_data; - int read_; - int result = IMAGE_INIT_FAIL; - - quick_length = image.length(); - quick_data.resize(quick_length); - read_ = image.fread( &quick_data[0], quick_length); - if (read_ != quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); - image.message(" Cannot read the file"); - } - else - { - for (i = 0; i < quick_length; i++) - if ((quick_addr + i) < 0x1000) - space.write_byte(i + quick_addr, quick_data[i]); - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length,quick_addr,quick_addr+quick_length,exec_addr); - - // Start the quickload - if (strcmp(image.filetype(), "bin") == 0) - m_maincpu->set_pc(quick_addr); - else - m_maincpu->set_pc(exec_addr); - - result = IMAGE_INIT_PASS; - } - - return result; -} - -static MACHINE_CONFIG_START( d6800, d6800_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6800, XTAL_4MHz/4) - MCFG_CPU_PROGRAM_MAP(d6800_map) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(64, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 63, 0, 31) - MCFG_SCREEN_UPDATE_DRIVER(d6800_state, screen_update_d6800) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(25)) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(d6800_state, d6800_keyboard_r)) - MCFG_PIA_READPB_HANDLER(READ8(d6800_state, d6800_cassette_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(d6800_state, d6800_keyboard_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(d6800_state, d6800_cassette_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(d6800_state, d6800_screen_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("d6800_c", d6800_state, d6800_c, attotime::from_hz(4800)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("d6800_p", d6800_state, d6800_p, attotime::from_hz(40000)) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", d6800_state, d6800, "bin,c8,ch8", 1) -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( d6800 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS(0, "0", "Original") - ROMX_LOAD( "d6800.bin", 0xc000, 0x0400, CRC(3f97ca2e) SHA1(60f26e57a058262b30befceceab4363a5d65d877), ROM_BIOS(1) ) - ROMX_LOAD( "d6800.bin", 0xc400, 0x0400, CRC(3f97ca2e) SHA1(60f26e57a058262b30befceceab4363a5d65d877), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "1", "Dreamsoft") - ROMX_LOAD( "d6800d.bin", 0xc000, 0x0800, CRC(ded5712f) SHA1(f594f313a74d7135c9fdd0bcb0093fc5771a9b7d), ROM_BIOS(2) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS, INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, d6800, 0, 0, d6800, d6800, driver_device, 0, "Michael Bauer", "Dream 6800", 0 ) diff --git a/src/mess/drivers/d6809.c b/src/mess/drivers/d6809.c deleted file mode 100644 index a806be0d820..00000000000 --- a/src/mess/drivers/d6809.c +++ /dev/null @@ -1,167 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/******************************************************************************* - - 6809 Portable - - 12/05/2009 Skeleton driver. - 21/09/2011 connected to terminal, notes added [Robbbert] - -Chips used: -- 6809E CPU -- 6845 CRTC -- 6840 CTC -- 6551 UART Console -- 6551 UART Aux -- 6850 UART Unknown purpose -- uPD765 FDC -- 2764 8K ROM for CPU -- 2732 4K ROM for Chargen (not dumped) -- 6x 6264 RAM -- 3x 5516 RAM -- XTAL: 16MHz - -So much for the official documentation. - -In practice, it reads/writes to a terminal, and doesn't use most of the other -devices. - -'maincpu' (F9DD): unmapped program memory write to 00F0 = 05 & FF -'maincpu' (F9E3): unmapped program memory read from 0001 & FF <----- these 2 are CLR 0001 -'maincpu' (F9E3): unmapped program memory write to 0001 = 00 & FF -'maincpu' (F9E6): unmapped program memory read from 0005 & FF <----- these 2 are CLR 0005 -'maincpu' (F9E6): unmapped program memory write to 0005 = 00 & FF -'maincpu' (F9E9): unmapped program memory write to 0002 = 0B & FF <-- these 2 are STD 0002 -'maincpu' (F9E9): unmapped program memory write to 0003 = 1E & FF -'maincpu' (F9EC): unmapped program memory write to 0006 = 0B & FF <-- these 2 are STD 0006 -'maincpu' (F9EC): unmapped program memory write to 0007 = 1E & FF -'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF <-- the remainder seems to be disk related -'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF -'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF -'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF -'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF -'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF -'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF -'maincpu' (FA6E): unmapped program memory read from 00F0 & FF -'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF -'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF -'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF -'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF -'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF -'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF -'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF -'maincpu' (FA6E): unmapped program memory read from 00F0 & FF -'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF -'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF -'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF -'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF -'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF -'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF -'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF -'maincpu' (FA6E): unmapped program memory read from 00F0 & FF -'maincpu' (FA41): unmapped program memory write to 00F2 = 00 & FF -'maincpu' (FA46): unmapped program memory write to 00F0 = 04 & FF -'maincpu' (FA82): unmapped program memory read from 00F0 & FF -'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF -'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF -'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF -'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF -'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF -'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF -'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF -'maincpu' (FA6E): unmapped program memory read from 00F0 & FF -'maincpu' (FA4D): unmapped program memory write to 00F2 = 00 & FF -'maincpu' (FA52): unmapped program memory write to 00F3 = 00 & FF -'maincpu' (FA57): unmapped program memory write to 00F4 = 00 & FF -'maincpu' (FA5C): unmapped program memory write to 00F5 = 00 & FF -'maincpu' (FA61): unmapped program memory write to 00F6 = 02 & FF -'maincpu' (FA66): unmapped program memory write to 00F7 = 09 & FF -'maincpu' (FA6B): unmapped program memory write to 00F0 = 01 & FF -'maincpu' (FA6E): unmapped program memory read from 00F0 & FF <-- now it gives up & prints an error - - -**********************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class d6809_state : public driver_device -{ -public: - d6809_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_WRITE8_MEMBER( kbd_put ); - DECLARE_READ8_MEMBER( term_r ); - DECLARE_WRITE8_MEMBER( term_w ); - UINT8 m_term_data; - virtual void machine_reset(); -}; - -READ8_MEMBER( d6809_state::term_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( d6809_state::term_w ) -{ - if ((data > 0) && (data < 0x80)) - m_terminal->write(space, 0, data); -} - -static ADDRESS_MAP_START( d6809_mem, AS_PROGRAM, 8, d6809_state ) - ADDRESS_MAP_UNMAP_HIGH - // 00-FF is for various devices. - AM_RANGE(0x00ff, 0x00ff) AM_READWRITE(term_r,term_w) - AM_RANGE(0x1000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xffff) AM_ROM -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( d6809 ) -INPUT_PORTS_END - - -WRITE8_MEMBER( d6809_state::kbd_put ) -{ - m_term_data = data; -} - -void d6809_state::machine_reset() -{ -} - - -static MACHINE_CONFIG_START( d6809, d6809_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6809E, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(d6809_mem) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(d6809_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( d6809 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "d6809.rom", 0xe000, 0x2000, CRC(2ceb40b8) SHA1(780111541234b4f0f781a118d955df61daa56e7e)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, d6809, 0, 0, d6809, d6809, driver_device, 0, "Dunfield", "6809 Portable", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/dai.c b/src/mess/drivers/dai.c deleted file mode 100644 index 8f2a4b408c2..00000000000 --- a/src/mess/drivers/dai.c +++ /dev/null @@ -1,259 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha, Nathan Woods -/******************************************************************************* - -DAI driver by Krzysztof Strzecha and Nathan Woods - -What's new: ------------ -21.05.2004 TMS5501 fixes. Debug code cleanups. -06.03.2004 Stack overflow interrupt added. -05.09.2003 Random number generator added. Few video hardware bugs fixed. - Fixed few I8080 instructions, making much more BASIC games playable. - -Notes on emulation status and to do list: ------------------------------------------ -1. A lot to do. Too much to list. - -DAI technical information -========================== - -CPU: ----- - I8080 2MHz - - -Memory map: ------------ - 0000-bfff RAM - c000-dfff ROM (non-switchable) - e000-efff ROM (4 switchable banks) - f000-f7ff ROM extension (optional) - f800-f8ff SRAM (stack) - f900-ffff I/O - f900-faff spare - fb00-fbff AMD9511 math chip (optional) - fc00-fcff 8253 programmable interval timer - fd00-fdff discrete devices - fe00-feff 8255 PIO (DCE bus) - ff00-ffff timer + 5501 interrupt controller - -Interrupts: ------------ - - -Keyboard: ---------- - - -Video: ------ - - -Sound: ------- - - -Timings: --------- - - -*******************************************************************************/ - -#include "emu.h" -#include "includes/dai.h" - -/* I/O ports */ -static ADDRESS_MAP_START( dai_io , AS_IO, 8, dai_state ) -ADDRESS_MAP_END - -/* memory w/r functions */ -static ADDRESS_MAP_START( dai_mem , AS_PROGRAM, 8, dai_state ) - AM_RANGE( 0x0000, 0xbfff) AM_RAMBANK("bank1") - AM_RANGE( 0xc000, 0xdfff) AM_ROM - AM_RANGE( 0xe000, 0xefff) AM_ROMBANK("bank2") - AM_RANGE( 0xf000, 0xf7ff) AM_WRITE(dai_stack_interrupt_circuit_w ) - AM_RANGE( 0xf800, 0xf8ff) AM_RAM - AM_RANGE( 0xfb00, 0xfbff) AM_READWRITE(dai_amd9511_r, dai_amd9511_w ) - AM_RANGE( 0xfc00, 0xfcff) AM_READWRITE(dai_pit_r, dai_pit_w) // AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE( 0xfd00, 0xfdff) AM_READWRITE(dai_io_discrete_devices_r, dai_io_discrete_devices_w ) - AM_RANGE( 0xfe00, 0xfeff) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) - AM_RANGE( 0xff00, 0xff0f) AM_MIRROR(0xf0) AM_DEVICE("tms5501", tms5501_device, io_map) -ADDRESS_MAP_END - - -/* keyboard input */ -static INPUT_PORTS_START (dai) - PORT_START("IN0") /* [0] - port ff07 bit 0 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("IN1") /* [1] - port ff07 bit 1 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("IN2") /* [2] - port ff07 bit 2 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("IN3") /* [3] - port ff07 bit 3 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("IN4") /* [4] - port ff07 bit 4 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("IN5") /* [5] - port ff07 bit 5 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("IN6") /* [6] - port ff07 bit 6 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rept") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("IN7") /* [7] - port ff07 bit 7 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Char del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("IN8") /* [8] */ - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0xcb, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -/* F4 Character Displayer */ -static const gfx_layout dai_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( dai ) - GFXDECODE_ENTRY( "gfx1", 0x0000, dai_charlayout, 0, 8 ) -GFXDECODE_END - -/* machine definition */ -static MACHINE_CONFIG_START( dai, dai_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(dai_mem) - MCFG_CPU_IO_MAP(dai_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(dai_state,int_ack) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(2000000) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("custom", dai_sound_device, set_input_ch0)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("custom", dai_sound_device, set_input_ch1)) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("custom", dai_sound_device, set_input_ch2)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1056, 542) - MCFG_SCREEN_VISIBLE_AREA(0, 1056-1, 0, 302-1) - MCFG_SCREEN_UPDATE_DRIVER(dai_state, screen_update_dai) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", dai) - MCFG_PALETTE_ADD("palette", sizeof (dai_palette) / 3) - MCFG_PALETTE_INIT_OWNER(dai_state, dai) - - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", DAI_SOUND, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("dai_cass") - - /* tms5501 */ - MCFG_DEVICE_ADD("tms5501", TMS5501, 2000000) - MCFG_TMS5501_IRQ_CALLBACK(INPUTLINE("maincpu", I8085_INTR_LINE)) - MCFG_TMS5501_XI_CALLBACK(READ8(dai_state, dai_keyboard_r)) - MCFG_TMS5501_XO_CALLBACK(WRITE8(dai_state, dai_keyboard_w)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list", "dai_cass") -MACHINE_CONFIG_END - -#define io_dai io_NULL - -ROM_START(dai) - ROM_REGION(0x14000,"maincpu",0) - ROM_LOAD("dai.bin", 0xc000, 0x2000, CRC(ca71a7d5) SHA1(6bbe2336c717354beab2ae201debeb4fd055bdcb)) - ROM_LOAD("dai00.bin", 0x10000, 0x1000, CRC(fa7d39ac) SHA1(3d1824a1f273882f934249ef3cb1b38ef99de7b9)) - ROM_LOAD("dai01.bin", 0x11000, 0x1000, CRC(cb5809f2) SHA1(523656f0a9d98888cd3e2bd66886c589e9ae75b4)) - ROM_LOAD("dai02.bin", 0x12000, 0x1000, CRC(03f72d4a) SHA1(573d65dc82321970dcaf81d7638a02252ea18a7a)) - ROM_LOAD("dai03.bin", 0x13000, 0x1000, CRC(c475c96f) SHA1(96fc3cc4b8a2873f0d044bd8033d1e7b7197dd97)) - ROM_REGION(0x2000, "gfx1",0) - ROM_LOAD ("nch.bin", 0x0000, 0x1000, CRC(a9f5b30b) SHA1(24119b2984ab4e50dc0dabae1065ff6d6c1f237d)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1978, dai, 0, 0, dai, dai, driver_device, 0, "Data Applications International", "DAI Personal Computer", 0) diff --git a/src/mess/drivers/daruma.c b/src/mess/drivers/daruma.c deleted file mode 100644 index 33f3226230c..00000000000 --- a/src/mess/drivers/daruma.c +++ /dev/null @@ -1,169 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders: Felipe Sanches -/*************************************************************************** - - Sigtron Daruma DS348 dot-matrix printer - https://www.hardstand.com.br/daruma/ds348 - - Driver by Felipe Correa da Silva Sanches - - Model: Print Plus - DS348 - Manufacturer: Sigtron Daruma - Firmware version 1.1 - Release Date: May 8th/1998 - PCB: SIGTRON DS348 REV.B - -***************************************************************************/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "sound/speaker.h" -//TODO: #include "ds348.lh" - -class daruma_state : public driver_device -{ -public: - daruma_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker") { } - - DECLARE_WRITE8_MEMBER(port_w); - DECLARE_READ8_MEMBER(port_r); - - DECLARE_READ8_MEMBER(dev0_r); - DECLARE_WRITE8_MEMBER(dev1_w); - DECLARE_WRITE8_MEMBER(dev2_w); - DECLARE_READ8_MEMBER(dev4_r); - required_device m_maincpu; - required_device m_speaker; - char port0, port1, port2, port3; -}; - -WRITE8_MEMBER(daruma_state::port_w) -{ -// printf("port_w: write %02X to PORT (offset=%02X)\n", data, offset); - switch(offset) - { - case MCS51_PORT_P0: port0=data; - case MCS51_PORT_P1: port1=data; - case MCS51_PORT_P2: port2=data; - case MCS51_PORT_P3: port3=data; - } -} - -READ8_MEMBER(daruma_state::port_r) -{ - switch(offset) - { - case MCS51_PORT_P0: printf("port_r: read %02X from PORT0\n", port0); return port0; - case MCS51_PORT_P1: printf("port_r: read %02X from PORT1\n", port1); return port1; - case MCS51_PORT_P2: printf("port_r: read %02X from PORT2\n", port2); return port2; - case MCS51_PORT_P3: printf("port_r: read %02X from PORT3\n", port3); return port3; - } - return 0; -} - -READ8_MEMBER(daruma_state::dev0_r) -{ - return 0xFF; -} - -READ8_MEMBER(daruma_state::dev4_r) -{ - return ioport("switches")->read(); -} - -WRITE8_MEMBER(daruma_state::dev1_w) -{ - //while attempting to identify which bit is used for - //controlling the buzzer, here's what I heard from each of - //the signals on this address: - - //0x80 serial comm.? (noise) - //0x20 LED? (3 clicks) - //0x10 LED? (1 click) - //0x08 serial comm.? click & noise - //0x04 LED? (2 clicks) - //0x02 motor control or printer heads? (I hear a series of rhythmic pulses) - //0x01 LED? (2 clicks) - m_speaker->level_w(data & 0x02); -} - -WRITE8_MEMBER(daruma_state::dev2_w) -{ - //while attempting to identify which bit is used for - //controlling the buzzer, here's what I heard from each of - //the signals on this address: - - //0x80: LED? (3 clicks) - //0x40: unused? - //0x20: unused? - //0x10: low freq brief beep followed by a click - //0x08: low freq brief noise followed by a click - //0x04: low freq brief beep followed by a click - //0x02: low freq brief beep followed by a click - //0x01: low freq brief noise - //m_speaker->level_w(data & 0x01); -} - -static ADDRESS_MAP_START( mem_prg, AS_PROGRAM, 8, daruma_state ) - AM_RANGE(0x0000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mem_io, AS_IO, 8, daruma_state ) - AM_RANGE(0x0000, 0x0000) AM_READ(dev0_r) - AM_RANGE(0x1000, 0x1000) AM_WRITE(dev1_w) -// AM_RANGE(0x2000, 0x2000) AM_WRITE(dev2_w) -// AM_RANGE(0x3000, 0x3000) AM_WRITE(dev3_w) - AM_RANGE(0x4000, 0x4000) AM_READ(dev4_r) - AM_RANGE(0x8000, 0xffff) AM_RAM /* 32K CMOS SRAM (HYUNDAY hy62256a) */ - AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(port_r, port_w) -ADDRESS_MAP_END - -//TODO: These buttons and switches are all guesses. We'll need to further investigate this. -static INPUT_PORTS_START( daruma ) - PORT_START("buttons") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Paper A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Paper B") PORT_CODE(KEYCODE_B) - - PORT_START("switches") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Limit Switch") PORT_CODE(KEYCODE_S) - -INPUT_PORTS_END - -static MACHINE_CONFIG_START( daruma, daruma_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80C32,11059200) //verified on pcb - MCFG_CPU_PROGRAM_MAP(mem_prg) - MCFG_CPU_IO_MAP(mem_io) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(0, "mono", 1.00) - -/* TODO: - MCFG_DEFAULT_LAYOUT(layout_daruma) - - Motors: MTA011 - http://pdf.datasheetcatalog.com/datasheet/Shindengen/mXstzvq.pdf - - The motor controller suposedly is used to cut the paper strip out after finishing printing something. -*/ -MACHINE_CONFIG_END - -ROM_START( ds348 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "daruma_ds348_v1_1.rom", 0x0000, 0x10000, CRC(10bf9036) SHA1(d654a13bc582f5384e759ec6fe5309a642bd8e18) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1998, ds348, 0, 0, daruma, daruma, driver_device, 0, "Sigtron Daruma", "Print Plus DS348 - Dot matrix printer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/dccons.c b/src/mess/drivers/dccons.c deleted file mode 100644 index fbb92009889..00000000000 --- a/src/mess/drivers/dccons.c +++ /dev/null @@ -1,760 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese, R. Belmont -/* - - dc.c - Sega Dreamcast driver - by R. Belmont & Angelo Salese - - SH-4 @ 200 MHz - ARM7DI @ 2.8223 MHz (no T or M extensions) - PowerVR 3D video - AICA audio - GD-ROM drive (modified ATAPI interface) - - NTSC/N NTSC/I PAL/N PAL/I VGA - (x/240) (x/480) (x/240) (x/480) (640x480) - VTOTAL 262 524 312 624 524 - HTOTAL 857 857 863 863 857 - - PCLKs = 26917135 (NTSC 480 @ 59.94), 26944080 (VGA 480 @ 60.0), 13458568 (NTSC 240 @ 59.94), - 25925600 (PAL 480 @ 50.00), 13462800 (PAL 240 @ 50.00) - - TODO: - - RTC error always pops up at start-up, no flash plus bug with ticks (needs rewrite) - - Inputs doesn't work most of the time; - - Candy Stripe: fills the log with "ATAPI_FEATURES_FLAG_OVL not supported", black screen - - Carrier: Jaleco logo uses YUV, but y size is halved? - - Close To: Hangs at FMV - - F355 Challenge: black screen after Sega logo; - - Gundam - Side Story 0079: currently hangs at Bandai logo (regression) - - Idol Janshi wo Tsukucchaou: pixel aspect is way wrong (stretched and offsetted horizontally) - - Power Stone: hangs at Capcom logo; - - Sega GT: no cursor on main menu; - - Tetris 4D: hangs at BPS FMV (bp 0C0B0C4E) - - Notes: - - DC US and DC PAL flash ROMs are definitely hacked, they are set to have Chinese instead of Japanese. - - 0x1a002 of flash ROM returns the region type (0x30=Japan, 0x31=USA, 0x32=Europe). Amusingly, if the value - on a non-jp console is different than these ones, the system shows a black swirl (and nothing boots). - - gdi file for DCLP (a Dreamcast tester) doesn't have first two tracks info, they are: - 1 0 4 2048 FILE0001.DUP 0 - 2 1798 0 2352 FILE0002.DUP 0 - serial i/o also fails on that, work ram addresses that needs to be patched with 0x0009 (nop) are: - 0xc0196da - 0xc0196ec - SH4 TEST: - UBC test (0101): - ok - FPU test (0201): - NG - 0xc03fe24 work ram flag check (1=error, 0=ok) - Cache test (03xx): - Cache Read/Write test (0301) - NG - Cache RAM mode Check (0305) - NG - MMU test (04xx): - asserts - TMU test (0501): - *_reg check -> ok - TCNT* reload -> NG - TCNT* underflow irq -> NG - MULT test (0601) - ok - DIVU test (0701) - ok - Store Queue test (0801): - ok - SCIF test (0901) - NG - Private Instruction test (0a01) - NG - Critical test (0dxx) - Critical (Store Queue) test (0d01): - ok - Critical (Write back) test (0d02): - ok - Critical (ADD,CMP/EQ) test (0d03): - ok - Critical (OC_OIX) test (0d04): - NG - Critical (MAX current) test (0d05): - ok (very slow!) - Critical (IC Cross Talk) test (0d06): - NG - Critical (Cache D-array) test (0d07): - NG - SH-4 BUG (0exx) - SH4_BUG 64bit FMOV - ok - SH4 BUG FIX (64bitFMOV) - ok - MEM TEST: - AICA (0102) - ok - Work RAM (0204): - ok - PV64 area (0303): - ok - PV32 area (0403): - ok - CLX TEST: - CLX internal RAM (0101): - ok - check (0401): - (sets up RGB888 mode 2, assuming it's critically failed) - TA TEST: - TA_YUVINT (0101): - ok -> IST_EOXFER_YUV - TA_OENDINT (0102): - ok -> IST_EOXFER_OPLST - TA_OMENDINT (0103): - ok -> IST_EOXFER_OPMV - TA_TENDINT (0104): - ok -> IST_EOXFER_TRLST - TA_TMENDINT (0105): - ok -> IST_EOXFER_TRMV - TA_PTENDINT (0106): - ok -> IST_EOXFER_PTLST - TA_ISPINT (0107): - NG -> ISP/TSP Parameter Overflow (error) - TA_OBJINT (0108): - NG -> OBJect list pointer Overflow (error) - TA_IPINT (0109): - NG -> TA: Illegal parameter (error) - YUV Converter (0201): - ok - DDT i/f TEST: - Sort, Normal DMA (1) (0101) - hangs (wants Sort DMA irq, of course) - Sort, Normal DMA (2) - ... - Through - NG, hangs again - DC_DEINT (0201) - ok - DC_SDTEINT (0202) - ok - DC_SDTERINT (0203) - ok (but returns error count ++, think it's a bug in the SW) - G2 TEST - DMA (0101): - G2 EXT AREA DETECT: - "!!!! ch00 ERROR DETECT !!!!" - Interrupt (0301): - G2 EXT AREA DETECT - DMA END INT - hangs - Ext Interrupt (06xx) - AICA INT (0601) - error detect - Modem INT (0602) - error detect - AICA TEST - Sound RAM (01xx) - Pattern R/W check (0101) - ok - Register (02xx) - CH Data (0201) - ok - EXT Input (0202) - ok - DSP Data (0203) - ok - S_Clock (03xx) - 50MSEC (0301) - NG -> ~0xa58 in 0x702814, must be > 0x889 and < 0x8b0 - 25MSEC (0302) - NG -> ~0x372 in 0x702814, must be > 0x443 and < 0x45a - Timer (04xx) - Timer A (0401) - NG - Timer B (0402) - NG - Timer C (0403) - NG - DMA (05xx) - SRAM -> CH Reg (0501) - ok - SRAM -> Comm Reg (0502) - ok - SRAM -> DSP Reg (0503) - ok - CH Reg -> SRAM (0504) - ok - Comm Reg -> SRAM (0505) - ok - DSP Reg -> SRAM (0506) - ok - Clear SRAM (0507) - ok - Clear CH Reg (0508) - ok - Clear Comm Reg (0509) - ok - Clear DSP Reg (050a) - ok - Interrupt (06xx) - Sampling clock (0601) - NG (irq 0x400) - Timer A (0602) - randomly NG/ok - Timer B (0603) - ok - Timer C (0604) - ok - DMA End (0605) - ok - Midi Out (0606) - NG - Main CPU (0607) - ok - RTC (07xx) - Write Protect (0701) - ok - RW Comp (0702) - ok - Clock (0703) - NG - ARM7 (08xx) - Load & Start (0801) - NG - Timer & Intr (0802) - NG - DMA (0803) - NG - Ch-Reg R/W (0804) - ok - SRAM incr (0805) - NG - SRAM pattern (0806) - ok - EG (09xx) - LSA-Reg Left (0901) - ok/NG - LSA-Reg Right (0902) - ok/NG - LSA-Reg Left & Right (0903) - ok/NG - MIDI (0axx) - OEMP bit (0a01) - NG - OFLL bit (0a02) - NG - PVRi/f test - DMA (01xx) - CPU trig (0101) - ok - INT trig - ok - Interrupt (02xx) - PVR DMA end Int (0201) - ok - PVR DMA IA Int (0202) - NG - PVR DMA end (0203) - NG - Flash test: - (SH-4 jumps to la la land as soon as this is started) - - -*/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "cpu/sh4/sh4.h" -#include "cpu/arm7/arm7core.h" -#include "sound/aica.h" -#include "machine/aicartc.h" -#include "includes/dc.h" -#include "includes/dccons.h" -#include "imagedev/chd_cd.h" -#include "machine/dc-ctrl.h" -#include "machine/gdrom.h" - -#define CPU_CLOCK (200000000) - -READ64_MEMBER(dc_cons_state::dcus_idle_skip_r ) -{ - //if (space.device().safe_pc()==0xc0ba52a) - // space.device().execute().spin_until_time(attotime::from_usec(2500)); - // device_spinuntil_int(&space.device()); - - return dc_ram[0x2303b0/8]; -} - -READ64_MEMBER(dc_cons_state::dcjp_idle_skip_r ) -{ - //if (space.device().safe_pc()==0xc0bac62) - // space.device().execute().spin_until_time(attotime::from_usec(2500)); - // device_spinuntil_int(&space.device()); - - return dc_ram[0x2302f8/8]; -} - -DRIVER_INIT_MEMBER(dc_cons_state,dc) -{ - dreamcast_atapi_init(); -} - -DRIVER_INIT_MEMBER(dc_cons_state,dcus) -{ - m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2303b0, 0xc2303b7, read64_delegate(FUNC(dc_cons_state::dcus_idle_skip_r),this)); - - DRIVER_INIT_CALL(dc); -} - -DRIVER_INIT_MEMBER(dc_cons_state,dcjp) -{ - m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2302f8, 0xc2302ff, read64_delegate(FUNC(dc_cons_state::dcjp_idle_skip_r),this)); - - DRIVER_INIT_CALL(dc); -} - -READ64_MEMBER(dc_cons_state::dc_pdtra_r ) -{ - UINT64 out = PCTRA<<32; - - out |= PDTRA & ~0x0303; - - // if both bits are inputs - if (!(PCTRA & 0x5)) - { - out |= 0x03; - } - - // one's input one's output, always pull up both bits - if (((PCTRA & 5) == 1) || ((PCTRA & 5) == 4)) - { - if (PDTRA & 3) - { - out |= 0x03; - } - } - - /* - cable setting, (0) VGA, (2) TV RGB (3) TV VBS/Y + S/C. - Note: several games doesn't like VGA setting (i.e. Idol Janshi wo Tsukucchaou, Airforce Delta), default to composite. - */ - out |= ioport("SCREEN_TYPE")->read() << 8; - - return out; -} - -WRITE64_MEMBER(dc_cons_state::dc_pdtra_w ) -{ - PCTRA = (data>>16) & 0xffff; - PDTRA = (data & 0xffff); -} - -READ64_MEMBER(dc_cons_state::dc_arm_r ) -{ - return *((UINT64 *)dc_sound_ram.target()+offset); -} - -WRITE64_MEMBER(dc_cons_state::dc_arm_w ) -{ - COMBINE_DATA((UINT64 *)dc_sound_ram.target() + offset); -} - -#if 0 -READ8_MEMBER(dc_cons_state::dc_flash_r) -{ - return m_dcflash->read(offset); -} - -WRITE8_MEMBER(dc_cons_state::dc_flash_w) -{ - m_dcflash->write(offset,data); -} -#endif - -static ADDRESS_MAP_START( dc_map, AS_PROGRAM, 64, dc_cons_state ) - AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_WRITENOP // BIOS - AM_RANGE(0x00200000, 0x0021ffff) AM_ROM AM_REGION("dcflash",0)//AM_READWRITE8(dc_flash_r,dc_flash_w, U64(0xffffffffffffffff)) - AM_RANGE(0x005f6800, 0x005f69ff) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) - AM_RANGE(0x005f6c00, 0x005f6cff) AM_DEVICE32( "maple_dc", maple_dc_device, amap, U64(0xffffffffffffffff) ) - AM_RANGE(0x005f7000, 0x005f701f) AM_DEVREADWRITE16("ata", ata_interface_device, read_cs1, write_cs1, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7080, 0x005f709f) AM_DEVREADWRITE16("ata", ata_interface_device, read_cs0, write_cs0, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7400, 0x005f74ff) AM_READWRITE32(dc_mess_g1_ctrl_r, dc_mess_g1_ctrl_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x005f7800, 0x005f78ff) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) - AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, U64(0xffffffffffffffff)) - AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) - AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE(dc_modem_r, dc_modem_w ) - AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, U64(0xffffffffffffffff)) - AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x00800000, 0x009fffff) AM_READWRITE(dc_arm_r, dc_arm_w ) -// AM_RANGE(0x01000000, 0x01ffffff) G2 Ext Device #1 -// AM_RANGE(0x02700000, 0x02707fff) AICA reg mirror -// AM_RANGE(0x02800000, 0x02ffffff) AICA wave mem mirror - -// AM_RANGE(0x03000000, 0x03ffffff) G2 Ext Device #2 - - /* Area 1 */ - AM_RANGE(0x04000000, 0x04ffffff) AM_RAM AM_SHARE("dc_texture_ram") // texture memory 64 bit access - AM_RANGE(0x05000000, 0x05ffffff) AM_RAM AM_SHARE("frameram") // apparently this actually accesses the same memory as the 64-bit texture memory access, but in a different format, keep it apart for now - - /* Area 3 */ - AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM AM_SHARE("dc_ram") - AM_RANGE(0x0d000000, 0x0dffffff) AM_RAM AM_SHARE("dc_ram")// extra ram on Naomi (mirror on DC) - AM_RANGE(0x0e000000, 0x0effffff) AM_RAM AM_SHARE("dc_ram")// mirror - AM_RANGE(0x0f000000, 0x0fffffff) AM_RAM AM_SHARE("dc_ram")// mirror - - /* Area 4 */ - AM_RANGE(0x10000000, 0x107fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) - AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) - AM_RANGE(0x11000000, 0x117fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath0_w) AM_MIRROR(0x00800000) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue - - AM_RANGE(0x12000000, 0x127fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) - AM_RANGE(0x12800000, 0x12ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) - AM_RANGE(0x13000000, 0x137fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath1_w) AM_MIRROR(0x00800000) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue - -// AM_RANGE(0x14000000, 0x17ffffff) G2 Ext Device #3 - - AM_RANGE(0x8c000000, 0x8cffffff) AM_RAM AM_SHARE("dc_ram") // another RAM mirror - - AM_RANGE(0xa0000000, 0xa01fffff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dc_port, AS_IO, 64, dc_cons_state ) - AM_RANGE(0x00000000, 0x00000007) AM_READWRITE(dc_pdtra_r, dc_pdtra_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dc_audio_map, AS_PROGRAM, 32, dc_cons_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("dc_sound_ram") /* shared with SH-4 */ - AM_RANGE(0x00800000, 0x00807fff) AM_READWRITE(dc_arm_aica_r, dc_arm_aica_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( dc ) - PORT_START("P1:0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 RIGHT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 LEFT") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 DOWN") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 UP") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("P1 START") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 C") - - PORT_START("P1:1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 2nd directional pad - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 D") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 X") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Y") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 Z") - - PORT_START("P1:A0") - PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P1 R") PORT_PLAYER(1) - - PORT_START("P1:A1") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P1 L") PORT_PLAYER(1) - - PORT_START("P1:A2") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(1) - - PORT_START("P1:A3") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(1) - - //A4 - A5, second analog stick, unused on DC - - PORT_START("P2:0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 RIGHT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 LEFT") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 DOWN") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 UP") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 START") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P2 C") - - PORT_START("P2:1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 2nd directional pad - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 D") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 X") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Y") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P1 Z") - - PORT_START("P2:A0") - PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P2 R") PORT_PLAYER(2) - - PORT_START("P2:A1") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P2 L") PORT_PLAYER(2) - - PORT_START("P2:A2") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(2) - - PORT_START("P2:A3") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(2) - - //A4 - A5, second analog stick, unused on DC - - PORT_START("P3:0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_NAME("P3 RIGHT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) PORT_NAME("P3 LEFT") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_NAME("P3 DOWN") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_NAME("P3 UP") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 ) PORT_NAME("P3 START") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 A") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 B") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 C") - - PORT_START("P3:1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 2nd directional pad - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 D") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 X") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) PORT_NAME("P3 Y") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 Z") - - PORT_START("P3:A0") - PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P3 R") PORT_PLAYER(3) - - PORT_START("P3:A1") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P3 L") PORT_PLAYER(3) - - PORT_START("P3:A2") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(3) - - PORT_START("P3:A3") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(3) - - //A4 - A5, second analog stick, unused on DC - - PORT_START("P4:0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) PORT_NAME("P4 RIGHT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) PORT_NAME("P4 LEFT") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) PORT_NAME("P4 DOWN") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) PORT_NAME("P4 UP") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 ) PORT_NAME("P4 START") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 A") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 B") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P4 C") - - PORT_START("P4:1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 2nd directional pad - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 D") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 X") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4) PORT_NAME("P4 Y") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("P3 Z") - - PORT_START("P4:A0") - PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P4 R") PORT_PLAYER(4) - - PORT_START("P4:A1") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_NAME("P4 L") PORT_PLAYER(4) - - PORT_START("P4:A2") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(4) - - PORT_START("P4:A3") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CENTERDELTA(10) PORT_PLAYER(4) - - //A4 - A5, second analog stick, unused on DC - - PORT_START("MAMEDEBUG") - PORT_DIPNAME( 0x01, 0x00, "Bilinear Filtering" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - - PORT_START("SCREEN_TYPE") - PORT_CONFNAME( 0x03, 0x03, "Screen Connection Type" ) - PORT_CONFSETTING( 0x00, "VGA" ) - PORT_CONFSETTING( 0x02, "Composite" ) - PORT_CONFSETTING( 0x03, "S-Video" ) -INPUT_PORTS_END - -MACHINE_RESET_MEMBER(dc_cons_state,dc_console) -{ - dc_state::machine_reset(); - m_aica->set_ram_base(dc_sound_ram, 2*1024*1024); -} - -WRITE_LINE_MEMBER(dc_cons_state::aica_irq) -{ - m_soundcpu->set_input_line(ARM7_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER(dc_cons_state::sh4_aica_irq) -{ - if(state) - dc_sysctrl_regs[SB_ISTEXT] |= IST_EXT_AICA; - else - dc_sysctrl_regs[SB_ISTEXT] &= ~IST_EXT_AICA; - - dc_update_interrupt_status(); -} - -static MACHINE_CONFIG_FRAGMENT( gdrom_config ) - MCFG_DEVICE_MODIFY("cdda") - MCFG_SOUND_ROUTE(0, "^^^^lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "^^^^rspeaker", 1.0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( dc, dc_cons_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SH4LE, CPU_CLOCK) - MCFG_SH4_MD0(1) - MCFG_SH4_MD1(0) - MCFG_SH4_MD2(1) - MCFG_SH4_MD3(0) - MCFG_SH4_MD4(0) - MCFG_SH4_MD5(1) - MCFG_SH4_MD6(0) - MCFG_SH4_MD7(1) - MCFG_SH4_MD8(0) - MCFG_SH4_CLOCK(CPU_CLOCK) - MCFG_CPU_PROGRAM_MAP(dc_map) - MCFG_CPU_IO_MAP(dc_port) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dc_state, dc_scanline, "screen", 0, 1) - - MCFG_CPU_ADD("soundcpu", ARM7, ((XTAL_33_8688MHz*2)/3)/8) // AICA bus clock is 2/3rds * 33.8688. ARM7 gets 1 bus cycle out of each 8. - MCFG_CPU_PROGRAM_MAP(dc_audio_map) - - MCFG_MACHINE_RESET_OVERRIDE(dc_cons_state,dc_console ) - -// MCFG_MACRONIX_29LV160TMC_ADD("dcflash") - - MCFG_MAPLE_DC_ADD( "maple_dc", "maincpu", dc_maple_irq ) - MCFG_DC_CONTROLLER_ADD("dcctrl0", "maple_dc", 0, ":P1:0", ":P1:1", ":P1:A0", ":P1:A1", ":P1:A2", ":P1:A3", ":P1:A4", ":P1:A5") - MCFG_DC_CONTROLLER_ADD("dcctrl1", "maple_dc", 1, ":P2:0", ":P2:1", ":P2:A0", ":P2:A1", ":P2:A2", ":P2:A3", ":P2:A4", ":P2:A5") - MCFG_DC_CONTROLLER_ADD("dcctrl2", "maple_dc", 2, ":P3:0", ":P3:1", ":P3:A0", ":P3:A1", ":P3:A2", ":P3:A3", ":P3:A4", ":P3:A5") - MCFG_DC_CONTROLLER_ADD("dcctrl3", "maple_dc", 3, ":P4:0", ":P4:1", ":P4:A0", ":P4:A1", ":P4:A2", ":P4:A3", ":P4:A4", ":P4:A5") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(13458568*2, 857, 0, 640, 524, 0, 480) /* TODO: where pclk actually comes? */ - MCFG_SCREEN_UPDATE_DEVICE("powervr2", powervr2_device, screen_update) - MCFG_PALETTE_ADD("palette", 0x1000) - MCFG_POWERVR2_ADD("powervr2", WRITE8(dc_state, pvr_irq)) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("aica", AICA, 0) - MCFG_AICA_MASTER - MCFG_AICA_IRQ_CB(WRITELINE(dc_cons_state, aica_irq)) - MCFG_AICA_MAIN_IRQ_CB(WRITELINE(dc_cons_state, sh4_aica_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(0, "rspeaker", 1.0) - - MCFG_AICARTC_ADD("aicartc", XTAL_32_768kHz) - - MCFG_DEVICE_ADD("ata", ATA_INTERFACE, 0) - MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(dc_cons_state, ata_interrupt)) - - MCFG_DEVICE_MODIFY("ata:0") - MCFG_SLOT_OPTION_ADD("gdrom", GDROM) - MCFG_SLOT_OPTION_MACHINE_CONFIG("gdrom", gdrom_config) - MCFG_SLOT_DEFAULT_OPTION("gdrom") -MACHINE_CONFIG_END - -/* -PsyMan notes: - -Here's a basic report on the Dreamcast boot files used in MAME (BIOS+Flash pairs): - ------ - -"dc101d_us.bin", 0x000000, 0x200000, CRC(89f2b1a1) SHA1(8951d1bb219ab2ff8583033d2119c899cc81f18c) ) // BIOS -This is a proper European and USA BIOS. It's even possible that it was used at a later point for Japanese systems. -It only has minor differences compared to BIOS 1.01c. - - -"dcus_ntsc.bin", 0x000000, 0x020000, BAD_DUMP CRC(c611b498) SHA1(94d44d7f9529ec1642ba3771ed3c5f756d5bc872) ) // Flash -Checking at 0x0001A000 and the mirrored data at 0x0001A0A0 gives away that this is hacked from a PAL/European flash file. -The broadcast (0x0001A004) is also set at 50Hz which is a PAL standard. - - -"dc101d_eu.bin", 0x000000, 0x200000, CRC(a2564fad) SHA1(edc5d3d70a93c935703d26119b37731fd317d2bf),ROM_BIOS(1)) // BIOS -This BIOS has Chinese language added. So either this is a bad BIOS or Dreamcast was actually officially released there. - - -"dc101c_eu.bin", 0x000000, 0x200000, CRC(2f551bc5) SHA1(1ede8d5be49116a4c6f3fe0961175469537a0434),ROM_BIOS(2)) // BIOS -This seems to be a proper European and USA BIOS. It's even possible that it was used at a later point for Japanese systems. -It only has minor differences compared to BIOS 1.01d. - - - -"dceu_pal.bin", 0x000000, 0x020000, BAD_DUMP CRC(b7e5aeeb) SHA1(11e02433e13b793ec7ffe0ae2356750bb8a575b4) ) // Flash -This appears to be a valid PAL/European flash. It's unknown if the data at 0x0001A0A0 (from 0x0001A000) should be mirrored there. -Maybe a game does this mirroring or maybe it's there by default. It's certain that some games wrote to this flash though. - - -"dc1004jp.bin", 0x000000, 0x200000, CRC(5454841f) SHA1(1ea132c0fbbf07ef76789eadc07908045c089bd6) ) // BIOS -This seems to be a proper Japanese BIOS. This BIOS was used at least by early Japanese Dreamcast models. -Code-wise, it has major differences compared to later BIOS versions. - - -"dcjp_ntsc.bin", 0x000000, 0x020000, CRC(5f92bf76) SHA1(be78b834f512ab2cf3d67b96e377c9f3093ff82a) ) // Flash -Checking at 0x0001A000 and the mirrored data at 0x0001A0A0 gives away that this is hacked from a PAL/European flash file. -The broadcast (0x0001A004) is also set at 50Hz which is a PAL standard. - ------ - - -From all the aforementioned files the only personally verified one is "dc101d_us.bin", CRC(89f2b1a1). -The resulting file was dumped twice, once from an NTSC/USA system and once from a PAL/EUR system. Both files had a side by side byte match. -*/ - -ROM_START(dc) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "dc101d_us.bin", 0x000000, 0x200000, CRC(89f2b1a1) SHA1(8951d1bb219ab2ff8583033d2119c899cc81f18c) ) // BIOS - - ROM_REGION(0x020000, "dcflash", 0) - ROM_LOAD( "dcus_ntsc.bin", 0x000000, 0x020000, BAD_DUMP CRC(c611b498) SHA1(94d44d7f9529ec1642ba3771ed3c5f756d5bc872) ) // Flash - ROM_FILL( 0x1a004, 1, 0x30 ) // patch broadcast back to NTSC -ROM_END - -ROM_START( dceu ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "101d", "v1.01d") - ROMX_LOAD( "dc101d_eu.bin", 0x000000, 0x200000, CRC(a2564fad) SHA1(edc5d3d70a93c935703d26119b37731fd317d2bf),ROM_BIOS(1)) // BIOS - ROM_SYSTEM_BIOS(1, "101c", "v1.01c") - ROMX_LOAD( "dc101c_eu.bin", 0x000000, 0x200000, CRC(2f551bc5) SHA1(1ede8d5be49116a4c6f3fe0961175469537a0434),ROM_BIOS(2)) // BIOS - - ROM_REGION(0x020000, "dcflash", 0) - ROM_LOAD( "dceu_pal.bin", 0x000000, 0x020000, BAD_DUMP CRC(b7e5aeeb) SHA1(11e02433e13b793ec7ffe0ae2356750bb8a575b4) ) // Flash -ROM_END - -ROM_START( dcjp ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "dc1004jp.bin", 0x000000, 0x200000, CRC(5454841f) SHA1(1ea132c0fbbf07ef76789eadc07908045c089bd6) ) // BIOS - - ROM_REGION(0x020000, "dcflash", 0) - /* ROM_LOAD( "dcjp_ntsc.bad", 0x000000, 0x020000, BAD_DUMP CRC(307a7035) SHA1(1411423a9d071340ea52c56e19c1aafc4e1309ee) ) // Hacked Flash */ - ROM_LOAD( "dcjp_ntsc.bin", 0x000000, 0x020000, BAD_DUMP CRC(5f92bf76) SHA1(be78b834f512ab2cf3d67b96e377c9f3093ff82a) ) // Flash - ROM_FILL( 0x1a004, 1, 0x30 ) // patch broadcast back to NTSC -ROM_END - -ROM_START( dcdev ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "hkt-0120.bin", 0x000000, 0x200000, CRC(2186e0e5) SHA1(6bd18fb83f8fdb56f1941e079580e5dd672a6dad) ) // BIOS - - ROM_REGION(0x020000, "dcflash", 0) - ROM_LOAD( "hkt-0120-flash.bin", 0x000000, 0x020000, CRC(7784c304) SHA1(31ef57f550d8cd13e40263cbc657253089e53034) ) // Flash -ROM_END - -ROM_START( dcprt ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "katana-set5-v0.41-98-08-27.bin", 0x000000, 0x200000, CRC(485877bd) SHA1(dc1af1f1248ffa87d57bc5ef2ea41aac95ecfc5e) ) // BIOS - - ROM_REGION(0x020000, "dcflash", 0) - ROM_LOAD( "dcjp_ntsc.bin", 0x000000, 0x020000, CRC(5f92bf76) SHA1(be78b834f512ab2cf3d67b96e377c9f3093ff82a) ) // Flash -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1999, dc, dcjp, 0, dc, dc, dc_cons_state, dcus, "Sega", "Dreamcast (USA, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1998, dcjp, 0, 0, dc, dc, dc_cons_state, dcjp, "Sega", "Dreamcast (Japan, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1999, dceu, dcjp, 0, dc, dc, dc_cons_state, dcus, "Sega", "Dreamcast (Europe, PAL)", MACHINE_NOT_WORKING ) -CONS( 1998, dcdev, dcjp, 0, dc, dc, dc_cons_state, dc, "Sega", "HKT-0120 Sega Dreamcast Development Box", MACHINE_NOT_WORKING ) -CONS( 1998, dcprt, dcjp, 0, dc, dc, dc_cons_state, dcjp, "Sega", "Katana Set 5 Prototype", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/dct11em.c b/src/mess/drivers/dct11em.c deleted file mode 100644 index 50cfe44458e..00000000000 --- a/src/mess/drivers/dct11em.c +++ /dev/null @@ -1,83 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - DEC DCT11-EM - - 03/12/2010 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/t11/t11.h" - -class dct11em_state : public driver_device -{ -public: - dct11em_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_dct11em(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START( dct11em_mem, AS_PROGRAM, 16, dct11em_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_RAM // RAM - AM_RANGE( 0x2000, 0x2fff ) AM_RAM // Optional RAM - AM_RANGE( 0xa000, 0xdfff ) AM_ROM // RAM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( dct11em ) -INPUT_PORTS_END - - -void dct11em_state::machine_reset() -{ -} - -void dct11em_state::video_start() -{ -} - -UINT32 dct11em_state::screen_update_dct11em(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - -static MACHINE_CONFIG_START( dct11em, dct11em_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",T11, 7500000) // 7.5MHz XTAL - MCFG_T11_INITIAL_MODE(0x1403) /* according to specs */ - MCFG_CPU_PROGRAM_MAP(dct11em_mem) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(dct11em_state, screen_update_dct11em) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( dct11em ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // Highest address line inverted - ROM_LOAD16_BYTE( "23-213e4.bin", 0x8000, 0x2000, CRC(bdd82f39) SHA1(347deeff77596b67eee27a39a9c40075fcf5c10d)) - ROM_LOAD16_BYTE( "23-214e4.bin", 0x8001, 0x2000, CRC(b523dae8) SHA1(cd1a64a2bce9730f7a9177d391663919c7f56073)) - ROM_COPY("maincpu", 0x8000, 0xc000, 0x2000) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, dct11em, 0, 0, dct11em, dct11em, driver_device, 0, "Digital Equipment Corporation", "DCT11-EM", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/dectalk.c b/src/mess/drivers/dectalk.c deleted file mode 100644 index 506895e05ed..00000000000 --- a/src/mess/drivers/dectalk.c +++ /dev/null @@ -1,1010 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/****************************************************************************** -* -* DECtalk DTC-01 Driver -* Copyright (C) 2009-2013 Jonathan Gevaryahu AKA Lord Nightmare -* with major help (dumping, tech questions answered, etc) -* from Kevin 'kevtris' Horton, without whom this driver would -* have been impossible. -* Special thanks to Al Kossow for archiving the DTC-01 schematic at bitsavers, -* http://bitsavers.org/pdf/dec/dectalk/MP-01820_DTC01_EngrDrws_Nov83.pdf -* which has been invaluable for work on this driver. -* Special thanks to leeeeee for helping figure out what the led selftest codes actually mean -* -* -* This driver dedicated in memory of Dennis Klatt and Jonathan Allen, without whose -* original work MITalk and hence KlattTalk and DECtalk would never have existed, -* in memory of Martin Minow, who wrote much of the DECtalk DTC-01 code, and -* in memory of Tony Vitale, who was one of the architects of the DECtalk project. -* -* Staff behind DECtalk itself: (mostly from http://amhistory.si.edu/archives/speechsynthesis/ss_dec.htm ): -* John C. Broihier -* Edward A. Bruckert (who followed the DECtalk IP from DEC->Compaq->HP->Force Computers->Fonix inc from where he retired in 2014) -* Dave Conroy (dtc-03 letter to sound rules; logic design, worked on dtc-01 and dtc-03, see correspondence below) -* Michael J. Crowley -* Dennis H. Klatt [1938 - Dec 30, 1988] (worked on klsyn and other parts of MITalk, wrote KLATTtalk which was exclusively licensed to DEC in 1982, worked on dtc-01 and dtc-03) -* Martin A. Minow [Nov 6, 1940 - Dec 21, 2000] (dtc-01 conversion of hunnicutt's letter to sound rules, phonetics and general programming) -* Walter Tetschner (DECtalk project director; as of 2013 publishes ASRnews: http://www.asrnews.com/) -* Anthony J. Vitale [Apr 30, 1945 - Aug 5, 2002] (DECtalk project architect; dtc-03 letter to sound rules; worked on dtc-01 and dtc-03) -* -* Staff behind MITalk: (also see http://amhistory.si.edu/archives/speechsynthesis/ss_mit.htm ) -* Dennis H. Klatt (see above) -* Jonathan Allen [Jun 4, 1934 - Apr 24, 2000] (speech synthesis theory and development) -* M. Sharon 'Sheri' Hunnicutt (worked on letter to phoneme rules, which were licensed non-exclusively to DEC in 1982; still works as a docent at KTH in Sweden as of 2013) -* -* TODO: -* * DUART: -* * The duart self tests are EXTENSIVE and make an excellent check of many of the duart internal bits. -* To enable the self tests rather than bypassing them, under dipswitches, set 'Skip Self Test(IP4)' to 'Open (VCC)' -* and under system configuration set 'Hack to prevent hang when skip self test is shorted' to 'Off' -* * DUART needs to be reset on reset line activation. as is it works ok, but it should be done anyway. -* * DUART needs its i/o pins connected as well: -* * pins IP0, IP2, and IP3 are connected to the primary serial port: -* * IP0 is CTS -* * IP2 is DSR -* * IP3 is RLS (received line signal, this pin is rarely used on rs232) -* * pins IP4, IP5 and IP6 are on jumpers on the DUART, tied high normally but jumperable low, should be handled as dipswitches: -* * IP4 low: skip hardware self tests -* * IP5 low: unknown -* * IP6 low: unknown -* * pins OP0 and OP2 are connected to the primary serial port: -* * OP0 is RTS -* * OP2 is DTR -* * Figure out why the v1.8 dectalk firmware clips/screeches like hell (it requires the older dsp code to work properly) -* * Figure out why the older -165/-166 and newer -409/-410 tms32010 dsp firmwares don't produce any sound, while the middle -204/-205 one does (fifo implementations were busted) -* * Actually store the X2212 nvram's eeprom data to disk rather than throwing it out on exit -* * Get setup mode with the serial BREAK int working enough to actually properly save the default nvram back to the chip in emulation, and get rid of the (currently unused) nvram default image in the rom definitions -* * emulate/simulate the MT8860 DTMF decoder and MT8865 DTMF filter as a 16-key input device? or hook it to some simple fft code? Francois Jalbert's fftmorse code ran full speed on a 12mhz 80286, maybe use that? -* Sarayan suggested this can be done in one of two ways: -* 1. Standalone 'canned' DTMF detector and discriminator code (francois' and peter jennings' 286 code, or modern fft code) -* 2. Emulate the MT8865 as a set of two 7th order bandpass filters with 2 -* outputs for the low and high band (as in real life as documented on the -* datasheet) and emulate the MT8860 exactly as in real life as well, as a -* dual-input pulse-width measurement device to distinguish the 4 low and -* high band DTMF tones as well as their combined presence. -* The latter is clearly more accurate but likely slower. -* * figure out how to plumb diserial/rs232 to have an external application send data to the two serial ports to be spoken; this shouldn't be too hard at this point. -* -* LED error code list (found by experimentation and help from leeeeee): -* Startup Self tests: -* FF 00 - M68k address register check fail or data register check fail (test code at $21E) -* (for some data register failures the processor just spins forever and no led code is generated) -* FF 01 - ROM check fail @ 0x00000, rom at E8 or E22 (test code at $278) -* FF 02 - ROM check fail @ 0x08000, rom at E7 or E21 " -* FF 03 - ROM check fail @ 0x10000, rom at E6 or E20 " -* FF 04 - ROM check fail @ 0x18000, rom at E5 or E19 " -* FF 05 - ROM check fail @ 0x20000, rom at E4 or E18 " -* FF 06 - ROM check fail @ 0x28000, rom at E3 or E17 " -* FF 07 - ROM check fail @ 0x30000, rom at E2 or E16 " -* FF 08 - ROM check fail @ 0x38000, rom at E1 or E15 " -* FF 0F - ROM check fail at multiple addresses -* FE 01 - RAM check fail @ 0x80000-0x83fff, ram at E36 or E49 (test code at $338) -* FE 02 - RAM check fail @ 0x84000-0x87fff, ram at E35 or E48 " -* FE 03 - RAM check fail @ 0x88000-0x8bfff, ram at E34 or E47 " -* FE 04 - RAM check fail @ 0x8c000-0x8ffff, ram at E33 or E46 " -* FE 05 - RAM check fail @ 0x90000-0x93fff, ram at E32 or E44 " -* FE 0F - RAM check fail at multiple addresses -* FD 00 - DUART test & DUART interrupt test (test code at $046C) -* FC 00 - This test doesn't exist. Some vestiges of it may remain in code for the FD and FB tests. -* FB 00 - TMS32010 extensive tests (test code at $051E): test spc interrupt [works] and make dtmf tone to test tlc interrupt [fails in mess, requires dtmf detection on output; this test is actually patented! US 4,552,992] -* Jump to $102C to skip the self tests -* During normal operation: -(table taken from http://www3.sympatico.ca/n.rieck/docs/DECtalk_notes.html ) -DTC-01 LEDs - - 76543210 LEDs - |||||||| - |||||||+-------- set if host asserting CTS - ||||||+--------- set if DECtalk asserting RTS - |||||+---------- set if host asserting DSR - ||||+----------- set if host asserting DCD - |||+------------ set if DECtalk asserting DTR - +++------------- 3 bit state code - - 000 in state 5, first 500 ms; waiting for CD & CTS in first 500 ms when DECtalk is on-line - 001 timing 2 second CD=0 while in state 6 (moving data) - 010 waiting for DSR=0 while disconnecting (part of state 7) - 011 waiting for DSR=1 while connecting (state 3) - 100 delaying for UK modems during disconnect (part of state 7) - 101 waiting for CD and CTS (main part of state 5) - 110 moving data (state 6) - 111 disconnecting (start of state 7) -* DECtalk dtc-01 hardware and rom version history, from DTC-01 schematic at bitsavers and with additional info from - http://americanhistory.si.edu/archives/speechsynthesis/ss_dec1.htm -* August 1983: Hardware version A done -* unknown date: Version 1.0 roms finalized -* unknown date: Version 1.1 roms released to fix a bug with insufficient stack space, see ss_dec1 above -* October 11 1983: Second half of Version 1.8 rom finalized -* December 05 1983: First half of Version 1.8 rom finalized -* March 1984: Hardware version B done - (integrates the output fifo sync error check onto the pcb; - Version A units are retrofitted when sent in for firmware upgrades) - (most of the schematics come from this time, and have the version 1.8 roms listed on them) -* July 02 1984: Second half of Version 2.0 rom finalized -* July 23 1984: First half of Version 2.0 rom finalized -* October 1984 (the rest of the schematics come from this time) -* sometime after 6th week of 1985: dsp roms updated to the -409/-410 set -* -* NVRAM related stuff found by leeeeee (in v2.0): -* $10402 - nvram recall/reset based on byte on stack (0 = recall, 1 = write default to nvram) -* $10f2E - nvram recall -* $10f52 - entry point for nvram check routine -* $11004(entry point)-$11030, $11032-$111B4 - nvram store routine: -* pass with a blank word on stack and be sure the test and branch at 11016 & 1101a passes (jumps to 1106a) -* It will then write currently loaded settings to nvram and execute a store, so do it after the defaults are loaded -* $1a7ae - default nvram image, without checksum (0x80 bytes) -*******************************************************************************/ -/*the 68k memory map is such: -0x000000-0x007fff: E22 low, E8 high -0x008000-0x00ffff: E21 low, E7 high -0x010000-0x017fff: E20 low, E6 high -0x018000-0x01ffff: E19 low, E5 high -0x020000-0x027fff: E18 low, E4 high -0x028000-0x02ffff: E17 low, E3 high -0x030000-0x037fff: E16 low, E2 high -0x038000-0x03ffff: E15 low, E1 high -mirrrored at 0x040000-0x07ffff -ram/nvram/speech mapping: -0x080000-0x083fff: e36 low, e49 high -0x084000-0x087fff: e35 low, e48 high -0x088000-0x08bfff: e34 low, e47 high -0x08c000-0x08ffff: e33 low, e46 high -0x090000-0x093fff: e32 low, e45 high -0x094000-0x097fff: LED/SW/NVR -0x098000-0x09bfff: 2681 DUART -0x09c000-0x09ffff: DTMF and TMS32010 (TLC, SPC) -mirrored at 0x0a0000-0x0fffff x3 -entire space mirrored at 0x100000-0x7fffff -0x800000-0xffffff is open bus? - -interrupts: -68k has an interrupt priority decoder attached to it: -TLC is INT level 4 -SPC is INT level 5 -DUART is INT level 6 -*/ -/* dtc-03 post by dave conroy from usenet comp.sys.dec on 12/29/2011: -> Wow. were they better than the DTC01? (OK, I guess they had to be.) - -I worked on both of these at DEC (in fact, I think if you look in the -options and modules -list, you will see my initials in the "responsible engineer" column -for the DTC03). - -The goals of the DTC03 were lower cost, better letter to sound rules, -and better packaging for large systems (it was pretty inconvenient to -set up 30-40 of -the big DTC01 boxes). - -The hardware was quite different. The DTC01 used a Motorola 68000 and -a TI DSP, connected -together by a big bank of (expensive) fifo chips. The DTC03 used then -(then new) Intel 80186 and the same -TI DSP, connected together by DMA (the DTC03 design was done in a way -that used *all* of the -capabilities of the 80186 to reduce the cost). The DTC01 used the -packaging of the VT240, and the DTC03 -used the packaging of a family of rack-mounted modems whose part -number escapes me. The -same guy (Rich Ellison) designed both of them. The DTC03 also had an -"option module" system which -was intended to allow non-US systems to be built without needing to -change the common -parts (because it was on an independent module, and could override all -of the telephone control ESC -sequences, it could be taken through the approval process in -isolation), although it was used -to build some semi-custom systems as well. - -The code in the DSP and the code that transformed a stream of phonemes -into a stream -of control commands for the DSP was pretty much the same in DTC01/ -DTC03, and was based on the work of -Dennis Klatt of MIT (Dennis actually wrote a lot of this code). The -letter to sound system -in DTC01 was the final step in the evolution of a set of letter-to- -sound rules that had been floating around DEC -for a long time; the bulk of the work getting them to work in the -DTC01 was done by -Martin Minow. The letter to sound system in DTC03 was a new design by -myself and Tony Vitale, -an ex-professor of linguistics from Cornell. Most people thought it -worked much -better; in reality, it's big advantage was it made far fewer stupid -stress-placement mistakes because -it did a much better job of understanding prefixes and suffixes. - -Dave Conroy -*/ -/* -There are 3 things on the pins. Serial I/O. The telephone line. Power. - -I believe the power is +5 and +12/-12. The +5 is for the logic, -and the +12/-12 is for the RS232 buffers and all of the analog stuff -in the anti-aliasing -filter, which is built from a pile of op-amps and stuff. - -The serial I/O pins go straight to the RS232 buffers and -onward to the UART (an SCN2661, if my memory is correct). - -The telephone pins go to the option connectors and the on-board -telephone line interface for the USA/Canada. Audio is available -somewhere on the -option connectors, but a really easy way to get at it is to take the -phone off-hook (send a "dial" command with an empty phone number -string) -and use the telephone pins as a transformer-coupled audio output. This -is what we -used to do in the lab all the time. - -dgc (dg(no!spam)cx@mac.com) -*/ - -// USE_LOOSE_TIMING makes the cpu interleave much lower and boosts it on fifo and flag writes by the 68k and semaphore sets by the dsp -#define USE_LOOSE_TIMING 1 -// makes use_loose_timing boost interleave when the outfifo is about to run out. slightly slows things down but may prevent some glitching -#undef USE_LOOSE_TIMING_OUTPUT -// generic logs like led state, and common writes for dsp and spc such as the speech int -#undef VERBOSE -// logs reads and writes to nvram, and nvram store/recall flag messages -#undef NVRAM_LOG -// logs reads and writes to TLC regs -#undef TLC_LOG -// logs reads and writes to SPC regs, 68k side only -#undef SPC_LOG_68K -// logs reads and writes to SPC regs, dsp side only -#undef SPC_LOG_DSP -// logs txa, txb and related serial lines to stderr -#undef SERIAL_TO_STDERR - -/* Core includes */ -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "cpu/tms32010/tms32010.h" -#include "machine/mc68681.h" -#include "machine/x2212.h" -#include "sound/dac.h" - - -class dectalk_state : public driver_device -{ -public: - enum - { - TIMER_OUTFIFO_READ - }; - - dectalk_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dsp(*this, "dsp"), - m_duart(*this, "duartn68681"), - m_nvram(*this, "x2212"), - m_dac(*this, "dac") - { - } - - // input fifo, between m68k and tms32010 - UINT16 m_infifo[32]; // technically eight 74LS224 4bit*16stage FIFO chips, arranged as a 32 stage, 16-bit wide fifo - UINT8 m_infifo_count; - UINT8 m_infifo_tail_ptr; - UINT8 m_infifo_head_ptr; - // output fifo, between tms32010 and 10khz sample latch for dac - UINT16 m_outfifo[16]; // technically three 74LS224 4bit*16stage FIFO chips, arranged as a 16 stage, 12-bit wide fifo - UINT8 m_outfifo_count; - UINT8 m_outfifo_tail_ptr; - UINT8 m_outfifo_head_ptr; - UINT8 m_infifo_semaphore; // latch for status of output fifo, d-latch 74ls74 @ E64 'lower half' - UINT8 m_spc_error_latch; // latch for error status of speech dsp, d-latch 74ls74 @ E64 'upper half' - UINT8 m_m68k_spcflags_latch; // latch for initializing the speech dsp, d-latch 74ls74 @ E29 'lower half', AND latch for spc irq enable, d-latch 74ls74 @ E29 'upper half'; these are stored in bits 0 and 6 respectively, the rest of the bits stored here MUST be zeroed! - UINT8 m_m68k_tlcflags_latch; // latch for telephone interface stuff, d-latches 74ls74 @ E93 'upper half' and @ 103 'upper and lower halves' - UINT8 m_simulate_outfifo_error; // simulate an error on the outfifo, which does something unusual to the dsp latches - UINT8 m_tlc_tonedetect; - UINT8 m_tlc_ringdetect; - UINT8 m_tlc_dtmf; // dtmf holding reg - UINT8 m_duart_inport; // low 4 bits of duart input - UINT8 m_duart_outport; // most recent duart output - UINT8 m_hack_self_test; // temp variable for hack below - - required_device m_maincpu; - required_device m_dsp; - required_device m_duart; - required_device m_nvram; - required_device m_dac; - DECLARE_WRITE_LINE_MEMBER(dectalk_duart_irq_handler); - DECLARE_WRITE_LINE_MEMBER(dectalk_duart_txa); - DECLARE_READ8_MEMBER(dectalk_duart_input); - DECLARE_WRITE8_MEMBER(dectalk_duart_output); - DECLARE_READ8_MEMBER(nvram_recall); - DECLARE_WRITE8_MEMBER(led_write); - DECLARE_WRITE8_MEMBER(nvram_store); - DECLARE_WRITE16_MEMBER(m68k_infifo_w); - DECLARE_READ16_MEMBER(m68k_spcflags_r); - DECLARE_WRITE16_MEMBER(m68k_spcflags_w); - DECLARE_READ16_MEMBER(m68k_tlcflags_r); - DECLARE_WRITE16_MEMBER(m68k_tlcflags_w); - DECLARE_READ16_MEMBER(m68k_tlc_dtmf_r); - DECLARE_WRITE16_MEMBER(spc_latch_outfifo_error_stats); - DECLARE_READ16_MEMBER(spc_infifo_data_r); - DECLARE_WRITE16_MEMBER(spc_outfifo_data_w); - DECLARE_READ16_MEMBER(spc_semaphore_r); - DECLARE_DRIVER_INIT(dectalk); - virtual void machine_reset(); - TIMER_CALLBACK_MEMBER(outfifo_read_cb); - void dectalk_outfifo_check (); - void dectalk_clear_all_fifos( ); - void dectalk_semaphore_w ( UINT16 data ); - UINT16 dectalk_outfifo_r ( ); - DECLARE_WRITE_LINE_MEMBER(dectalk_reset); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -/* 2681 DUART */ -WRITE_LINE_MEMBER(dectalk_state::dectalk_duart_irq_handler) -{ - m_maincpu->set_input_line_and_vector(M68K_IRQ_6, state, M68K_INT_ACK_AUTOVECTOR); - //drvstate->m_maincpu->set_input_line_and_vector(M68K_IRQ_6, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); - //drvstate->m_maincpu->set_input_line_and_vector(M68K_IRQ_6, HOLD_LINE, vector); -} - -READ8_MEMBER(dectalk_state::dectalk_duart_input) -{ - UINT8 data = 0; - data |= m_duart_inport&0xF; - data |= (ioport("duart_in")->read()&0xF0); - if ((m_hack_self_test == 1) && (ioport("hacks")->read()&0x01)) data |= 0x10; // hack to prevent hang if selftest disable bit is kept low past the first read; i suppose the proper use of this bit was an incremental switch, or perhaps its expecting an interrupt later from serial in or tone in? added a dipswitch to disable the hack for testing - m_hack_self_test = 1; - return data; -} - -WRITE8_MEMBER(dectalk_state::dectalk_duart_output) -{ - m_duart_outport = data; -#ifdef SERIAL_TO_STDERR - fprintf(stderr, "RTS: %01X, DTR: %01X\n", data&1, (data&4)>>2); -#endif -} - -WRITE_LINE_MEMBER(dectalk_state::dectalk_duart_txa) -{ - //TODO: this needs to be plumbed so it shows up optionally on a second terminal somehow, or connects to diserial - // it is the second 'alternate' serial connection on the DTC-01, used for a serial passthru and other stuff. -#ifdef SERIAL_TO_STDERR - fprintf(stderr, "TXA:%02X ",data); -#endif -} - -/* FIFO and TMS32010 stuff */ -#define SPC_INITIALIZE state->m_m68k_spcflags_latch&0x1 // speech initialize flag -#define SPC_IRQ_ENABLED ((state->m_m68k_spcflags_latch&0x40)>>6) // irq enable flag - -void dectalk_state::dectalk_outfifo_check () -{ - // check if output fifo is full; if it isn't, set the int on the dsp - if (m_outfifo_count < 16) - m_dsp->set_input_line(0, ASSERT_LINE); // TMS32010 INT - else - m_dsp->set_input_line(0, CLEAR_LINE); // TMS32010 INT -} - -void dectalk_state::dectalk_clear_all_fifos( ) -{ - // clear fifos (TODO: memset would work better here...) - int i; - for (i=0; i<16; i++) m_outfifo[i] = 0; - m_outfifo_count = 0; - m_outfifo_tail_ptr = m_outfifo_head_ptr = 0; - for (i=0; i<32; i++) m_infifo[i] = 0; - m_infifo_count = 0; - m_infifo_tail_ptr = m_infifo_head_ptr = 0; - dectalk_outfifo_check(); -} - -// helper for dsp infifo_semaphore flag to make dealing with interrupts easier -void dectalk_state::dectalk_semaphore_w ( UINT16 data ) -{ - m_infifo_semaphore = data&1; - if ((m_infifo_semaphore == 1) && (m_m68k_spcflags_latch&0x40)) - { -#ifdef VERBOSE - logerror("speech int fired!\n"); -#endif - m_maincpu->set_input_line_and_vector(M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - } - else - m_maincpu->set_input_line_and_vector(M68K_IRQ_5, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); -} - -// read the output fifo and set the interrupt line active on the dsp -UINT16 dectalk_state::dectalk_outfifo_r ( ) -{ - UINT16 data = 0xFFFF; -#ifdef USE_LOOSE_TIMING_OUTPUT - // if outfifo count is less than two, boost the interleave to prevent running the fifo out - if (m_outfifo_count < 2) - machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(25)); -#endif -#ifdef VERBOSE - if (m_outfifo_count == 0) logerror("output fifo is EMPTY! repeating previous sample!\n"); -#endif - data = m_outfifo[m_outfifo_tail_ptr]; - // if fifo is empty (tail ptr == head ptr), do not increment the tail ptr, otherwise do. - if (m_outfifo_count > 0) - { - m_outfifo_tail_ptr++; - m_outfifo_count--; - } - m_outfifo_tail_ptr&=0xF; - dectalk_outfifo_check(); - return ((data&0xfff0)^0x8000); // yes this is right, top bit is inverted and bottom 4 are ignored - //return data; // not right but want to get it working first -} - -/* Machine reset and friends: stuff that needs setting up which IS directly affected by reset */ -WRITE_LINE_MEMBER(dectalk_state::dectalk_reset) -{ - m_hack_self_test = 0; // hack - // stuff that is DIRECTLY affected by the RESET line - machine().device("x2212")->recall(0); - machine().device("x2212")->recall(1); - machine().device("x2212")->recall(0); // nvram recall - m_m68k_spcflags_latch = 1; // initial status is speech reset(d0) active and spc int(d6) disabled - m_m68k_tlcflags_latch = 0; // initial status is tone detect int(d6) off, answer phone(d8) off, ring detect int(d14) off - machine().device("duartn68681")->reset(); // reset the DUART - // stuff that is INDIRECTLY affected by the RESET line - dectalk_clear_all_fifos(); // speech reset clears the fifos, though we have to do it explicitly here since we're not actually in the m68k_spcflags_w function. - dectalk_semaphore_w(0); // on the original DECtalk DTC-01 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. - m_spc_error_latch = 0; // spc error latch is cleared on /reset - m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // speech reset forces the CLR line active on the tms32010 - m_tlc_tonedetect = 0; // TODO, needed for selftest pass - m_tlc_ringdetect = 0; // TODO - m_tlc_dtmf = 0; // TODO - m_duart_inport = 0xF; - m_duart_outport = 0; -} - -void dectalk_state::machine_reset() -{ - /* hook the RESET line, which resets a slew of other components */ - m_maincpu->set_reset_callback(write_line_delegate(FUNC(dectalk_state::dectalk_reset),this)); -} - -/* Begin 68k i/o handlers */ - -READ8_MEMBER(dectalk_state::nvram_recall)// recall from x2212 nvram chip -{ -#ifdef NVRAM_LOG - fprintf(stderr,"NVRAM RECALL executed: offset %03x\n", offset); -#endif - m_nvram->recall(0); - m_nvram->recall(1); - m_nvram->recall(0); - return 0xFF; -} - -WRITE8_MEMBER(dectalk_state::led_write) -{ - popmessage("LED status: %02X\n", data&0xFF); -#ifdef VERBOSE - logerror("m68k: LED status: %02X\n", data&0xFF); -#endif - //popmessage("LED status: %x %x %x %x %x %x %x %x\n", data&0x80, data&0x40, data&0x20, data&0x10, data&0x8, data&0x4, data&0x2, data&0x1); -} - -WRITE8_MEMBER(dectalk_state::nvram_store) // store to X2212 NVRAM chip -{ -#ifdef NVRAM_LOG - fprintf(stderr,"NVRAM STORE executed: offset %03x, data written (and ignored) is %02x\n", offset, data); -#endif - m_nvram->store(0); - m_nvram->store(1); - m_nvram->store(0); -} - -WRITE16_MEMBER(dectalk_state::m68k_infifo_w)// 68k write to the speech input fifo -{ -#ifdef USE_LOOSE_TIMING - machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(25)); -#endif -#ifdef SPC_LOG_68K - logerror("m68k: SPC infifo written with data = %04X, fifo head was: %02X; fifo tail: %02X\n",data, m_infifo_head_ptr, m_infifo_tail_ptr); -#endif - // if fifo is full (head ptr = tail ptr-1), do not increment the head ptr and do not store the data - if (m_infifo_count == 32) - { -#ifdef SPC_LOG_68K - logerror("infifo was full, write ignored!\n"); -#endif - return; - } - m_infifo[m_infifo_head_ptr] = data; - m_infifo_head_ptr++; - m_infifo_count++; - m_infifo_head_ptr&=0x1F; -} - -READ16_MEMBER(dectalk_state::m68k_spcflags_r)// 68k read from the speech flags -{ - UINT8 data = 0; - data |= m_m68k_spcflags_latch; // bits 0 and 6 - data |= m_spc_error_latch<<5; // bit 5 - data |= m_infifo_semaphore<<7; // bit 7 -#ifdef SPC_LOG_68K - logerror("m68k: SPC flags read, returning data = %04X\n",data); -#endif - return data; -} - -WRITE16_MEMBER(dectalk_state::m68k_spcflags_w)// 68k write to the speech flags (only 3 bits do anything) -{ -#ifdef USE_LOOSE_TIMING - machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(25)); -#endif -#ifdef SPC_LOG_68K - logerror("m68k: SPC flags written with %04X, only storing %04X\n",data, data&0x41); -#endif - m_m68k_spcflags_latch = data&0x41; // ONLY store bits 6 and 0! - // d0: initialize speech flag (reset tms32010 and clear infifo and outfifo if high) - if ((data&0x1) == 0x1) // bit 0 - { -#ifdef SPC_LOG_68K - logerror(" | 0x01: initialize speech: fifos reset, clear error+semaphore latches and dsp reset\n"); -#endif - dectalk_clear_all_fifos(); - m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // speech reset forces the CLR line active on the tms32010 - // clear the two speech side latches - m_spc_error_latch = 0; - dectalk_semaphore_w(0); - } - else // (data&0x1) == 0 - { -#ifdef SPC_LOG_68K - logerror(" | 0x01 = 0: initialize speech off, dsp running\n"); -#endif - m_dsp->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); // speech reset deassert clears the CLR line on the tms32010 - } - if ((data&0x2) == 0x2) // bit 1 - clear error and semaphore latches - { -#ifdef SPC_LOG_68K - logerror(" | 0x02: clear error+semaphore latches\n"); -#endif - // clear the two speech side latches - m_spc_error_latch = 0; - dectalk_semaphore_w(0); - } - if ((data&0x40) == 0x40) // bit 6 - spc irq enable - { -#ifdef SPC_LOG_68K - logerror(" | 0x40: speech int enabled\n"); -#endif - if (m_infifo_semaphore == 1) - { -#ifdef SPC_LOG_68K - logerror(" speech int fired!\n"); -#endif - m_maincpu->set_input_line_and_vector(M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because semaphore was set - } - } - else // data&0x40 == 0 - { -#ifdef SPC_LOG_68K - logerror(" | 0x40 = 0: speech int disabled\n"); -#endif - m_maincpu->set_input_line_and_vector(M68K_IRQ_5, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); // clear int because int is now disabled - } -} - -READ16_MEMBER(dectalk_state::m68k_tlcflags_r)// dtmf flags read -{ - UINT16 data = 0; - data |= m_m68k_tlcflags_latch; // bits 6, 8, 14; - data |= m_tlc_tonedetect<<7; // bit 7 is tone detect - data |= m_tlc_ringdetect<<14; // bit 15 is ring detect -#ifdef TLC_LOG - logerror("m68k: TLC flags read, returning data = %04X\n",data); -#endif - return data; -} - -WRITE16_MEMBER(dectalk_state::m68k_tlcflags_w)// dtmf flags write -{ -#ifdef TLC_LOG - logerror("m68k: TLC flags written with %04X, only storing %04X\n",data, data&0x4140); -#endif - m_m68k_tlcflags_latch = data&0x4140; // ONLY store bits 6 8 and 14! - if ((data&0x40) == 0x40) // bit 6: tone detect interrupt enable - { -#ifdef TLC_LOG - logerror(" | 0x40: tone detect int enabled\n"); -#endif - if (m_tlc_tonedetect == 1) - { -#ifdef TLC_LOG - logerror(" TLC int fired!\n"); -#endif - m_maincpu->set_input_line_and_vector(M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because tone detect was set - } - } - else // data&0x40 == 0 - { -#ifdef TLC_LOG - logerror(" | 0x40 = 0: tone detect int disabled\n"); -#endif - if (((data&0x4000)!=0x4000) || (m_tlc_ringdetect == 0)) // check to be sure we don't disable int if both ints fired at once - m_maincpu->set_input_line_and_vector(M68K_IRQ_4, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); // clear int because int is now disabled - } - if ((data&0x100) == 0x100) // bit 8: answer phone relay enable - { -#ifdef TLC_LOG - logerror(" | 0x100: answer phone relay enabled\n"); -#endif - } - else // data&0x100 == 0 - { -#ifdef TLC_LOG - logerror(" | 0x100 = 0: answer phone relay disabled\n"); -#endif - } - if ((data&0x4000) == 0x4000) // bit 14: ring int enable - { -#ifdef TLC_LOG - logerror(" | 0x4000: ring detect int enabled\n"); -#endif - if (m_tlc_ringdetect == 1) - { -#ifdef TLC_LOG - logerror(" TLC int fired!\n"); -#endif - m_maincpu->set_input_line_and_vector(M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); // set int because tone detect was set - } - } - else // data&0x4000 == 0 - { -#ifdef TLC_LOG - logerror(" | 0x4000 = 0: ring detect int disabled\n"); -#endif - if (((data&0x40)!=0x40) || (m_tlc_tonedetect == 0)) // check to be sure we don't disable int if both ints fired at once - m_maincpu->set_input_line_and_vector(M68K_IRQ_4, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); // clear int because int is now disabled - } -} - -READ16_MEMBER(dectalk_state::m68k_tlc_dtmf_r)// dtmf chip read -{ -#ifdef TLC_LOG - UINT16 data = 0xFFFF; - data = m_tlc_dtmf&0xF; - logerror("m68k: TLC dtmf detector read, returning data = %02X", data); -#endif - return 0; -} -/* End 68k i/o handlers */ - -/* Begin tms32010 i/o handlers */ -WRITE16_MEMBER(dectalk_state::spc_latch_outfifo_error_stats)// latch 74ls74 @ E64 upper and lower halves with d0 and 1 respectively -{ -#ifdef USE_LOOSE_TIMING - machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(25)); -#endif -#ifdef SPC_LOG_DSP - logerror("dsp: set fifo semaphore and set error status = %01X\n",data&1); -#endif - dectalk_semaphore_w((~m_simulate_outfifo_error)&1); // always set to 1 here, unless outfifo desync-between-the-three-parallel-fifo-chips error occurs. - m_spc_error_latch = (data&1); // latch the dsp 'soft error' state aka "ERROR DETECTED D5 H" on schematics (different from the outfifo error state above!) -} - -READ16_MEMBER(dectalk_state::spc_infifo_data_r) -{ - UINT16 data = 0xFFFF; - data = m_infifo[m_infifo_tail_ptr]; -#ifdef SPC_LOG_DSP - logerror("dsp: SPC infifo read with data = %04X, fifo head: %02X; fifo tail was: %02X\n",data, m_infifo_head_ptr, m_infifo_tail_ptr); -#endif - // if fifo is empty (tail ptr == head ptr), do not increment the tail ptr, otherwise do. - if (m_infifo_count > 0) - { - m_infifo_tail_ptr++; - m_infifo_count--; - } - m_infifo_tail_ptr&=0x1F; - return data; -} - -WRITE16_MEMBER(dectalk_state::spc_outfifo_data_w) -{ - // the low 4 data bits are thrown out on the real unit due to use of a 12 bit dac (and to save use of another 16x4 fifo chip), though technically they're probably valid, and with suitable hacking a dtc-01 could probably output full 16 bit samples at 10khz. -#ifdef SPC_LOG_DSP - logerror("dsp: SPC outfifo write, data = %04X, fifo head was: %02X; fifo tail: %02X\n", data, m_outfifo_head_ptr, m_outfifo_tail_ptr); -#endif - m_dsp->set_input_line(0, CLEAR_LINE); //TMS32010 INT (cleared because LDCK inverts the IR line, clearing int on any outfifo write... for a moment at least.) - // if fifo is full (head ptr = tail ptr-1), do not increment the head ptr and do not store the data - if (m_outfifo_count == 16) - { -#ifdef SPC_LOG_DSP - logerror("outfifo was full, write ignored!\n"); -#endif - return; - } - m_outfifo[m_outfifo_head_ptr] = data; - m_outfifo_head_ptr++; - m_outfifo_count++; - m_outfifo_head_ptr&=0xF; - //dectalk_outfifo_check(); // outfifo check should only be done in the audio 10khz polling function -} - -READ16_MEMBER(dectalk_state::spc_semaphore_r)// Return state of d-latch 74ls74 @ E64 'lower half' in d0 which indicates whether infifo is readable -{ -#ifdef SPC_LOG_DSP - //logerror("dsp: read infifo semaphore, returned %d\n", m_infifo_semaphore); // commented due to extreme annoyance factor - if (!m_infifo_semaphore) logerror("dsp: read infifo semaphore, returned %d\n", m_infifo_semaphore); -#endif - return m_infifo_semaphore; -} -/* end tms32010 i/o handlers */ - - -/****************************************************************************** - Address Maps -******************************************************************************/ -/* -Address maps (x = ignored; * = selects address within this range) -68k address map: -a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 (a0 via UDS/LDS) -0 x x x 0 x * * * * * * * * * * * * * * * * * * R ROM -0 x x x 1 x x 0 * * * * * * * * * * * * * * * * RW RAM (first 4 chip pairs) -0 x x x 1 x x 1 0 0 * * * * * * * * * * * * * * RW RAM (last chip pair) -0 x x x 1 x x 1 0 1 x x x x x x x x x x x x x 0 W Status LED -0 x x x 1 x x 1 0 1 x x x x 0 * * * * * * * * 1 RW NVRAM (read/write volatile ram, does not store to eeprom) -0 x x x 1 x x 1 0 1 x x x x 1 * * * * * * * * 1 RW NVRAM (all reads do /recall from eeprom, all writes do /store to eeprom) -0 x x x 1 x x 1 1 0 x x x x x x x x x * * * * x RW DUART (keep in mind that a0 is not connected) -0 x x x 1 x x 1 1 1 x x x x x x x x x x x 0 0 * RW SPC flags: fifo writable (readonly, d7), spc irq suppress (readwrite, d6), fifo error status (readonly, d5), 'fifo release'/clear-tms-fifo-error-status-bits (writeonly, d1), speech initialize/clear (readwrite, d0) [see schematic sheet 4] -0 x x x 1 x x 1 1 1 x x x x x x x x x x x 0 1 0? W SPC fifo write (clocks fifo) -0 x x x 1 x x 1 1 1 x x x x x x x x x x x 1 0 * RW TLC flags: ring detect (readonly, d15), ring detected irq enable (readwrite, d14), answer phone (readwrite, d8), tone detected (readonly, d7), tone detected irq enable (readwrite, d6) [see schematic sheet 6] -0 x x x 1 x x 1 1 1 x x x x x x x x x x x 1 1 * R TLC tone chip read, reads on bits d0-d7 only, d4-d7 are tied low; d15-d8 are probably open bus - | | | | | -*/ - -static ADDRESS_MAP_START(m68k_mem, AS_PROGRAM, 16, dectalk_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_MIRROR(0x740000) /* ROM */ - AM_RANGE(0x080000, 0x093fff) AM_RAM AM_MIRROR(0x760000) /* RAM */ - AM_RANGE(0x094000, 0x0943ff) AM_WRITE8(led_write, 0x00FF) AM_MIRROR(0x763C00) /* LED array */ - AM_RANGE(0x094000, 0x0941ff) AM_DEVREADWRITE8("x2212", x2212_device, read, write, 0xFF00) AM_MIRROR(0x763C00) /* Xicor X2212 NVRAM */ - AM_RANGE(0x094200, 0x0943ff) AM_READWRITE8(nvram_recall, nvram_store, 0xFF00) AM_MIRROR(0x763C00) /* Xicor X2212 NVRAM */ - AM_RANGE(0x098000, 0x09801f) AM_DEVREADWRITE8("duartn68681", mc68681_device, read, write, 0xff ) AM_MIRROR(0x763FE0) /* DUART */ - AM_RANGE(0x09C000, 0x09C001) AM_READWRITE(m68k_spcflags_r, m68k_spcflags_w) AM_MIRROR(0x763FF8) /* SPC flags reg */ - AM_RANGE(0x09C002, 0x09C003) AM_WRITE(m68k_infifo_w) AM_MIRROR(0x763FF8) /* SPC fifo reg */ - AM_RANGE(0x09C004, 0x09C005) AM_READWRITE(m68k_tlcflags_r, m68k_tlcflags_w) AM_MIRROR(0x763FF8) /* telephone status flags */ - AM_RANGE(0x09C006, 0x09C007) AM_READ(m68k_tlc_dtmf_r) AM_MIRROR(0x763FF8) /* telephone dtmf read */ -ADDRESS_MAP_END - -// do we even need this below? -static ADDRESS_MAP_START(m68k_io, AS_IO, 16, dectalk_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tms32010_mem, AS_PROGRAM, 16, dectalk_state ) - AM_RANGE(0x000, 0x7ff) AM_ROM /* ROM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tms32010_io, AS_IO, 16, dectalk_state ) - AM_RANGE(0, 0) AM_WRITE(spc_latch_outfifo_error_stats) // *set* the outfifo_status_r semaphore, and also latch the error bit at D0. - AM_RANGE(1, 1) AM_READWRITE(spc_infifo_data_r, spc_outfifo_data_w) //read from input fifo, write to sound fifo - AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ(spc_semaphore_r) //read infifo-has-data-in-it fifo readable status - //AM_RANGE(8, 8) //the newer firmware seems to want something mapped here? -ADDRESS_MAP_END - -/****************************************************************************** - Input Ports -******************************************************************************/ -static INPUT_PORTS_START( dectalk ) -PORT_START("duart_in") // IP4, IP5, IP6 bits on duart are dipswitches (really unsoldered holes in the pcb where jumper wires can be soldered or shorted over) - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // these bits are dealt with elsewhere - PORT_DIPNAME( 0x10, 0x00, "Skip Self Test (IP4)" ) - PORT_DIPSETTING( 0x10, "Open (VCC)" ) - PORT_DIPSETTING( 0x00, "Short to GND" ) - PORT_DIPNAME( 0x20, 0x20, "Unknown (IP5)" ) - PORT_DIPSETTING( 0x20, "Open (VCC)" ) - PORT_DIPSETTING( 0x00, "Short to GND" ) - PORT_DIPNAME( 0x40, 0x40, "Unknown (IP6)" ) - PORT_DIPSETTING( 0x40, "Open (VCC)" ) - PORT_DIPSETTING( 0x00, "Short to GND" ) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // this pin (IP7) doesn't actually exist as a pin at all, reads as 1 - -PORT_START("hacks") - PORT_CONFNAME( 0x01, 0x01, "Hack to prevent hang when skip self test is shorted" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - -INPUT_PORTS_END - -/****************************************************************************** - Machine Drivers -******************************************************************************/ -void dectalk_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_OUTFIFO_READ: - outfifo_read_cb(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in dectalk_state::device_timer"); - } -} - -TIMER_CALLBACK_MEMBER(dectalk_state::outfifo_read_cb) -{ - UINT16 data; - data = dectalk_outfifo_r(); -#ifdef VERBOSE - if (data!= 0x8000) logerror("sample output: %04X\n", data); -#endif - timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ); - m_dac->write_signed16(data); - // hack for break key, requires hacked up duart core so disabled for now - // also it doesn't work well, the setup menu is badly corrupt - /*device_t *duart = machine().device("duartn68681"); - if (machine.input().code_pressed(KEYCODE_F1)) - duart68681_rx_break(duart, 1, 1); - else - duart68681_rx_break(duart, 1, 0);*/ -} - -/* Driver init: stuff that needs setting up which isn't directly affected by reset */ -DRIVER_INIT_MEMBER(dectalk_state,dectalk) -{ - dectalk_clear_all_fifos(); - m_simulate_outfifo_error = 0; - timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ); -} - -static MACHINE_CONFIG_START( dectalk, dectalk_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* E74 20MHz OSC (/2) */ - MCFG_CPU_PROGRAM_MAP(m68k_mem) - MCFG_CPU_IO_MAP(m68k_io) - MCFG_MC68681_ADD( "duartn68681", XTAL_3_6864MHz ) /* 2681 duart (not 68681!); Y3 3.6864MHz Xtal */ - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_irq_handler)) - MCFG_MC68681_A_TX_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_txa)) - MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MC68681_INPORT_CALLBACK(READ8(dectalk_state, dectalk_duart_input)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(dectalk_state, dectalk_duart_output)) - - MCFG_CPU_ADD("dsp", TMS32010, XTAL_20MHz) /* Y1 20MHz xtal */ - MCFG_CPU_PROGRAM_MAP(tms32010_mem) - MCFG_CPU_IO_MAP(tms32010_io) -#ifdef USE_LOOSE_TIMING - MCFG_QUANTUM_TIME(attotime::from_hz(100)) -#else - MCFG_QUANTUM_PERFECT_CPU("dsp") -#endif - - MCFG_X2212_ADD("x2212") - - /* video hardware */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) /* E88 10KHz OSC, handled by timer */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.9) - - /* Y2 is a 3.579545 MHz xtal for the dtmf decoder chip */ - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duartn68681", mc68681_device, rx_b_w)) -MACHINE_CONFIG_END - - - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -ROM_START( dectalk ) - ROM_REGION16_BE(0x40000,"maincpu", 0) - // DECtalk DTC-01 firmware v2.0 (first half: 23Jul84 tag; second half: 02Jul84 tag), all roms are 27128 eproms - // technically the correct rom names are 23-123e5.e8, etc, but the chips they were dumped from were NOT labeled that way - // labels were SP8510123E5 etc, which means the chips were burned at dec in week 10, 1985 - /* the labels dec uses for most non-factory-programmed eproms, proms and pals is something like SPddddnnnto or WBddddnnto - * where: - * SP or WB = ? - * dddd is a 4 digit datecode with yyww (i.e. 8510 = week 10, 1985) - * nnn = the dec internal rom number for that type - * t = programmable chip type (e = eprom, otprom or mask rom; a,b,f = proms of various sorts; there are others for plas and pals) - * o = size of rom - * for eproms/otproms or mask roms it is: e1 = 0x400, e2 = 0x800, e3 = 0x1000, e4 = 0x2000, e5 = 0x4000, e6 = 0x8000, etc) - * for proms it is: a1 = 82s123(0x20, 8b TS); a2 = 82s129(0x100 4b TS); a9 = 82s131(0x200 4b TS); b1 = 82s135(0x100 8b TS); f1 = 82s137(0x400 4b TS); f4 = 82s191(0x800 8b TS); s0 = MC68HC05; m2 = i8051 or other MCS-51; (there are more) - */ - ROM_SYSTEM_BIOS( 0, "v20", "DTC-01 Version 2.0") - ROMX_LOAD("23-123e5.e8", 0x00000, 0x4000, CRC(03e1eefa) SHA1(e586de03e113683c2534fca1f3f40ba391193044), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510123E5" @ E8 - ROMX_LOAD("23-119e5.e22", 0x00001, 0x4000, CRC(af20411f) SHA1(7954bb56b7591f8954403a22d34de31c7d5441ac), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510119E5" @ E22 - ROMX_LOAD("23-124e5.e7", 0x08000, 0x4000, CRC(9edeafcb) SHA1(7724babf4ae5d77c0b4200f608d599058d04b25c), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510124E5" @ E7 - ROMX_LOAD("23-120e5.e21", 0x08001, 0x4000, CRC(f2a346a6) SHA1(af5e4ea0b3631f7d6f16c22e86a33fa2cb520ee0), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510120E5" @ E21 - ROMX_LOAD("23-125e5.e6", 0x10000, 0x4000, CRC(1c0100d1) SHA1(1b60cd71dfa83408b17e13f683b6bf3198c905cc), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510125E5" @ E6 - ROMX_LOAD("23-121e5.e20", 0x10001, 0x4000, CRC(4cb081bd) SHA1(4ad0b00628a90085cd7c78a354256c39fd14db6c), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510121E5" @ E20 - ROMX_LOAD("23-126e5.e5", 0x18000, 0x4000, CRC(7823dedb) SHA1(e2b2415eec838ddd46094f2fea93fd289dd0caa2), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510126E5" @ E5 - ROMX_LOAD("23-122e5.e19", 0x18001, 0x4000, CRC(b86370e6) SHA1(92ab22a24484ad0d0f5c8a07347105509999f3ee), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510122E5" @ E19 - ROMX_LOAD("23-103e5.e4", 0x20000, 0x4000, CRC(35aac6b9) SHA1(b5aec0bf37a176ff4d66d6a10357715957662ebd), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510103E5" @ E4 - ROMX_LOAD("23-095e5.e18", 0x20001, 0x4000, CRC(2296fe39) SHA1(891f3a3b4ce75ef14001257bc8f1f60463a9a7cb), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510095E5" @ E18 - ROMX_LOAD("23-104e5.e3", 0x28000, 0x4000, CRC(9658b43c) SHA1(4d6808f67cbdd316df23adc8ddf701df57aa854a), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510104E5" @ E3 - ROMX_LOAD("23-096e5.e17", 0x28001, 0x4000, CRC(cf236077) SHA1(496c69e52cfa013173f7b9c500ce544a03ad01f7), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510096E5" @ E17 - ROMX_LOAD("23-105e5.e2", 0x30000, 0x4000, CRC(09cddd28) SHA1(de0c25687bab3ff0c88c98622092e0b58331aa16), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510105E5" @ E2 - ROMX_LOAD("23-097e5.e16", 0x30001, 0x4000, CRC(49434da1) SHA1(c450abae0ccf372d7eb87370b8a8c97a45e164d3), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510097E5" @ E16 - ROMX_LOAD("23-106e5.e1", 0x38000, 0x4000, CRC(a389ab31) SHA1(355348bfc96a04193136cdde3418366e6476c3ca), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510106E5" @ E1 - ROMX_LOAD("23-098e5.e15", 0x38001, 0x4000, CRC(3d8910e7) SHA1(01921e77b46c2d4845023605239c45ffa4a35872), ROM_SKIP(1) | ROM_BIOS(1)) // Label: "SP8510098E5" @ E15 - - /* the undumped 2.0 (beta?) version likely has roms: - 23-091e5.e22, 23-092e5.e21, 23-093e5.e20, 23-094e5.e19, - 23-099e5.e8, 23-100e5.e7, 23-101e5.e6, 23-102e5.e5 - and shares the 23-103e5 thru 106e5, and 095e5 thru 098e5 roms with - the 2.0 version above - */ - - // DECtalk DTC-01 firmware v1.8 (first half: 05Dec83 tag; second half: 11Oct83 tag), all roms are 27128 eproms - ROM_SYSTEM_BIOS( 1, "v18", "DTC-01 Version 1.8") - ROMX_LOAD("23-063e5.e8", 0x00000, 0x4000, CRC(9f5ca045) SHA1(1b1b9c1e092c44329b385fb04001e13422eb8d39), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-059e5.e22", 0x00001, 0x4000, CRC(b299cf64) SHA1(84bbe9ff303ea6ce7b1c0b1ad05421edd18fae49), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-064e5.e7", 0x08000, 0x4000, CRC(e4ff20f4) SHA1(fdd91e4d2ef92608a08b2e78b6108e31ff53a1f9), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-060e5.e21", 0x08001, 0x4000, CRC(213c65ba) SHA1(c95662d0d40499af01cdc23f05936762ab54081a), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-065e5.e6", 0x10000, 0x4000, CRC(38ea0c75) SHA1(232b622cef6d69a493db1ed02e5236235c68daba), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-061e5.e20", 0x10001, 0x4000, CRC(44f6fe5c) SHA1(81daa4abae273c7f0aead902b5c3c842f7e7f116), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-066e5.e5", 0x18000, 0x4000, CRC(957aa8cf) SHA1(5f9f916b99867d1adbafd58d411feb630f6e4b6d), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-062e5.e19", 0x18001, 0x4000, CRC(10ab969c) SHA1(46ee22a295b8709b6f829751aca5f92e4f459a9f), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-032e5.e4", 0x20000, 0x4000, CRC(0f805e3a) SHA1(1d8008e30a448358224364fd8237dbb08907b219), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-031e5.e18", 0x20001, 0x4000, CRC(846b5b68) SHA1(55c759b3fb927d2dfc9d77e8e080748866bea854), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-034e5.e3", 0x28000, 0x4000, CRC(90700738) SHA1(738337c5b6acd3f30c3c4be2457370d2ce9313f9), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-033e5.e17", 0x28001, 0x4000, CRC(48756a4d) SHA1(5946ccd367d88a484bb1549d0cc990b9b7d88f0c), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-036e5.e2", 0x30000, 0x4000, CRC(5c2d4f73) SHA1(30f95e5383c4f71bc700346e2d49e8ad70b94c8c), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-035e5.e16", 0x30001, 0x4000, CRC(80116443) SHA1(7b3b68e61b421dedaad88b5600c739943a316c9e), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-038e5.e1", 0x38000, 0x4000, CRC(c840493f) SHA1(abd6af442690e981a9089f19febffc8f3fb52717), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("23-037e5.e15", 0x38001, 0x4000, CRC(d62ab309) SHA1(a743a23625feadf6e46ef889e2bb04af88589992), ROM_SKIP(1) | ROM_BIOS(2)) - - ROM_REGION(0x2000,"dsp", 0) - // NEWER/final? firmware 'later 2.0'; this firmware DOES WORK. - // this firmware seems to have some leftover test garbage mapped into its space, which is not present on the dtc-01 board - // it writes 0x0000 to 0x90 on start - // it writes a sequence of values to 0xFF down to 0xE9 - // it wants something readable mapped at 0x08 or else it waits for an interrupt - // Is this the same firmware as on the tms320P15 on the dtc-07 or a backported variant of such? - ROM_LOAD16_BYTE("23-410f4.e70", 0x000, 0x800, CRC(121e2ec3) SHA1(3fabe018d0e0b478093951cb20501853358faa18)) - ROM_LOAD16_BYTE("23-409f4.e69", 0x001, 0x800, CRC(61f67c79) SHA1(9a13426c92f879f2953f180f805990a91c37ac43)) - // DECtalk DTC-01 'klsyn' tms32010 firmware 'earlier 2.0', both proms are 82s191 equivalent; this firmware DOES WORK. - ROM_LOAD16_BYTE("23-205f4.e70", 0x000, 0x800, CRC(ed76a3ad) SHA1(3136bae243ef48721e21c66fde70dab5fc3c21d0)) // Label: "LM8506205F4 // M1-76161-5" @ E70 - ROM_LOAD16_BYTE("23-204f4.e69", 0x001, 0x800, CRC(79bb54ff) SHA1(9409f90f7a397b041e4440341f2d7934cb479285)) // Label: "LM8504204F4 // 78S191" @ E69 - // older dsp firmware from dectalk firmware 1.8; this firmware DOES WORK, and even works with 2.0 dectalk firmware! its a bit quieter than the others, though. - ROM_LOAD16_BYTE("23-166f4.e70", 0x000, 0x800, CRC(2d036ffc) SHA1(e8c25ca092dde2dc0aec73921af806026bdfbbc3)) // HM1-76161-5 - ROM_LOAD16_BYTE("23-165f4.e69", 0x001, 0x800, CRC(a3019ca4) SHA1(249f269c38f7f44edb6d025bcc867c8ca0de3e9c)) // HM1-76161-5 - - // TODO: load this as default if the nvram file is missing, OR get the setup page working enough that it can be saved properly to the chip from an NVR FAULT state! - // NOTE: this nvram image is ONLY VALID for v2.0; v1.8 expects a different image. - ROM_REGION(0x100,"nvram", 0) // default nvram image is at 0x1A7AE in main rom, read lsn first so 0x0005 in rom becomes 05 00 00 00 etc for all words of main rom - ROM_FILL(0x00, 0xff, 0x00) // blank it first; - ROM_FILL(0x00, 0x01, 0x05) - ROM_FILL(0x04, 0x01, 0x00) - ROM_FILL(0x08, 0x01, 0x06) - ROM_FILL(0x0C, 0x01, 0x01) - ROM_FILL(0x10, 0x01, 0x06) - ROM_FILL(0x14, 0x01, 0x0B) - ROM_FILL(0x18, 0x01, 0x02) - ROM_FILL(0x1C, 0x01, 0x02) - ROM_FILL(0x20, 0x01, 0x01) - ROM_FILL(0x24, 0x01, 0x01) - ROM_FILL(0x28, 0x01, 0x00) - ROM_FILL(0x2C, 0x01, 0x01) - ROM_FILL(0xFC, 0x01, 0x0D) // checksum, calculated some weird way which I haven't figured out yet - ROM_FILL(0xFD, 0x01, 0x02) // " - ROM_FILL(0xFE, 0x01, 0x05) // " - ROM_FILL(0xFF, 0x01, 0x0B) // " - -ROM_END - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, dectalk, 0, 0, dectalk, dectalk, dectalk_state, dectalk, "Digital Equipment Corporation", "DECtalk DTC-01", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/decwritr.c b/src/mess/drivers/decwritr.c deleted file mode 100644 index 35d54c74e8e..00000000000 --- a/src/mess/drivers/decwritr.c +++ /dev/null @@ -1,386 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/************************************************************************* - - decwritr.c - Digital Equipment Corporation - DECwriter III (LA120) Teletype/Teleprinter, 1978 - -**************************************************************************/ - -#include "emu.h" -#include "render.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8251.h" -#include "sound/beep.h" - -#define KBD_VERBOSE 1 -#define LED_VERBOSE 1 - -//************************************************************************** -// DRIVER STATE -//************************************************************************** - -class decwriter_state : public driver_device -{ -public: - // constructor - decwriter_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "beeper"), - m_uart(*this, "i8251") - { - } - required_device m_maincpu; - required_device m_speaker; - required_device m_uart; - //required_device m_terminal; - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) - { - bitmap.fill(rgb_t::black); - return 0; - } - DECLARE_READ8_MEMBER(la120_KBD_r); - DECLARE_WRITE8_MEMBER(la120_LED_w); - DECLARE_READ8_MEMBER(la120_NVR_r); - DECLARE_WRITE8_MEMBER(la120_NVR_w); - DECLARE_READ8_MEMBER(la120_DC305_r); - DECLARE_WRITE8_MEMBER(la120_DC305_w); -private: - virtual void machine_start(); - //virtual void machine_reset(); - ioport_port* m_col_array[16]; - UINT8 m_led_array; - UINT8 m_led_7seg_counter; - UINT8 m_led_7seg[4]; -}; - -READ8_MEMBER( decwriter_state::la120_KBD_r ) -{ - /* for reading the keyboard array, addr bits 5-11 are ignored. - * a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 - * 0 0 1 1 x x x x x x x * * * * * - * | | \---\---\--- column select - * | \--------------- kbd_banksel0 - * \------------------- kbd_banksel1 - * if both banks are selected, the resulting row read is a binary OR of both (LA120-TM1, page 4-5) - * - * d7 d6 d5 d4 d3 d2 d1 d0 - * \--\--\--\--\--\--\--\-- read from rows - */ - UINT8 code = 0; - if (offset&0x8) code |= m_col_array[offset&0x7]->read(); - if (offset&0x10) code |= m_col_array[(offset&0x7)+8]->read(); -#ifdef KBD_VERBOSE - logerror("Keyboard column %X read, returning %02X\n", offset&0xF, code); -#endif - return code; -} - -WRITE8_MEMBER( decwriter_state::la120_LED_w ) -{ - /* for writing the keyboard array, addr bits 5-11 are ignored. - * a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 - * 0 0 1 1 x x x x x x x 0 * * * 0 turn OFF LED # and clear 7seg counter - * 0 0 1 1 x x x x x x x 0 * * * 1 turn ON LED # and clear 7seg counter - * 0 0 1 1 x x x x x x x 1 * * * * display a digit in the digit pointed to by 7seg counter and increment counter - * data bus is UNUSED. - */ - if (!(offset&0x10)) // we're updating an led state - { -#ifdef LED_VERBOSE - logerror("Updated LED status array: LED #%d is now %d\n", ((offset&0xe)>>1), (offset&1)); -#endif - m_led_array &= ((1<<((offset&0xe)>>1))^0xFF); // mask out the old bit - m_led_array |= ((offset&1)<<((offset&0xe)>>1)); // OR in the new bit - m_led_7seg_counter = 0; - } - else // we're updating the 7segment display - { - m_led_7seg_counter++; - m_led_7seg_counter &= 0xF; -#ifdef LED_VERBOSE - logerror("Updated 7seg display: displaying a digit of %d in position %d\n", (offset&0xF)^0xF, m_led_7seg_counter-1); -#endif - if ((m_led_7seg_counter >= 1) && (m_led_7seg_counter <= 4)) - { - m_led_7seg[m_led_7seg_counter-1] = (offset&0xF)^0xF; - } - } -#ifdef LED_VERBOSE - logerror("LEDs: %c %c %c %c : %s %s %s %s %s %s %s %s\n", - m_led_7seg[3]+0x30, m_led_7seg[2]+0x30, m_led_7seg[1]+0x30, m_led_7seg[0]+0x30, - (m_led_array&0x80)?"ON LINE":"-------", - (m_led_array&0x40)?"LOCAL":"-----", - (m_led_array&0x20)?"ALT CHR SET":"-----------", - (m_led_array&0x10)?"":"-----", - (m_led_array&0x8)?"CTS":"---", - (m_led_array&0x4)?"DSR":"---", - (m_led_array&0x2)?"SET-UP":"------", - (m_led_array&0x1)?"PAPER OUT":"---------" ); -#endif -} - -READ8_MEMBER( decwriter_state::la120_NVR_r ) -{ - return 0xFF; -} - -WRITE8_MEMBER( decwriter_state::la120_NVR_w ) -{ -} -READ8_MEMBER( decwriter_state::la120_DC305_r ) -{ - return 0xFF; -} -WRITE8_MEMBER( decwriter_state::la120_DC305_w ) -{ -} - -static ADDRESS_MAP_START(la120_mem, AS_PROGRAM, 8, decwriter_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x2fff ) AM_ROM - AM_RANGE( 0x3000, 0x3fff ) AM_READWRITE(la120_KBD_r, la120_LED_w) // keyboard read, write to status and 7seg LEDS - AM_RANGE( 0x4000, 0x43ff ) AM_MIRROR(0x0c00) AM_RAM // 1k 'low ram' - AM_RANGE( 0x5000, 0x53ff ) AM_MIRROR(0x0c00) AM_RAM // 1k 'high ram' - AM_RANGE( 0x6000, 0x6fff ) AM_MIRROR(0x08fe) AM_READWRITE(la120_NVR_r, la120_NVR_w) // ER1400 EAROM - AM_RANGE( 0x7000, 0x7003 ) AM_MIRROR(0x0ffc) AM_READWRITE(la120_DC305_r, la120_DC305_w) // DC305 printer controller ASIC stuff - // 8000-ffff is reserved for expansion (i.e. unused, open bus); since this can generate interrupts this needs to be split to its own device. -ADDRESS_MAP_END - -/* - * 8080 IO address map (x = ignored; * = selects address within this range) - * (a15 to a8 are latched the same value as a7-a0 on the 8080 and 8085) - a7 a6 a5 a4 a3 a2 a1 a0 - 0 x x x x x 0 0 RW 8251 Data - 0 x x x x x 0 1 RW 8251 Status/Control - 0 x x x x x 1 x RW Flags Read/Write - 1 x x x x x x x RW Expansion (Open bus) - */ -static ADDRESS_MAP_START(la120_io, AS_IO, 8, decwriter_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_MIRROR(0x7C) AM_DEVREADWRITE("i8251", i8251_device, data_r, data_w) // 8251 Data - AM_RANGE(0x01, 0x01) AM_MIRROR(0x7C) AM_DEVREADWRITE("i8251", i8251_device, status_r, control_w) // 8251 Status/Control - //AM_RANGE(0x02, 0x02) AM_MIRROR(0x7D) // other io ports - // 0x80-0xff are reserved for expansion (i.e. unused, open bus) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( la120 ) - PORT_START("COL0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Local LF") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_START("COL1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Local FF") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(127) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // this is actually the cover open interlock sensor - PORT_START("COL2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HERE IS") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(alternate) Opt LF") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // this is actually the paper out interlock sensor - PORT_START("COL3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_LALT) PORT_CHAR(10) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LINE LOCAL") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("COL4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_TOGGLE PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK) // TODO: does the physical switch toggle? - PORT_START("COL5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_START("COL6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("COL7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x60, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Set Up") PORT_CODE(KEYCODE_F5) - PORT_START("COL8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLB") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLC") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLD") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLF") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) // this is actually the RO flag - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("View") PORT_CODE(KEYCODE_LWIN) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -void decwriter_state::machine_start() -{ - m_speaker->set_frequency(786); // TODO: LA120 speaker is controlled by asic; VT100 has: 7.945us per serial clock = ~125865.324hz, / 160 clocks per char = ~ 786 hz -#if 0 - output_set_value("online_led",1); - output_set_value("local_led", 0); - output_set_value("noscroll_led",1); - output_set_value("basic_led", 1); - output_set_value("hardcopy_led", 1); - output_set_value("l1_led", 1); - output_set_value("l2_led", 1); -#endif - char kbdcol[8]; - // look up all 16 tags 'the slow way' but only once on reset - for (int i = 0; i < 16; i++) - { - sprintf(kbdcol,"COL%X", i); - m_col_array[i] = ioport(kbdcol); - } - m_led_array = 0; - m_led_7seg_counter = 0; - m_led_7seg[0] = m_led_7seg[1] = m_led_7seg[2] = m_led_7seg[3] = 0xF; -} - -/* -void decwriter_state::machine_reset() -{ -} -*/ - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static MACHINE_CONFIG_START( la120, decwriter_state ) - - MCFG_CPU_ADD("maincpu",I8080, XTAL_18MHz / 9) // 18Mhz xtal on schematics, using an i8224 clock divider/reset sanitizer IC - MCFG_CPU_PROGRAM_MAP(la120_mem) - MCFG_CPU_IO_MAP(la120_io) - - /* video hardware */ - //TODO: no actual screen! has 8 leds above the keyboard (similar to vt100/vk100) and has 4 7segment leds for showing an error code. - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(decwriter_state, screen_update) - MCFG_SCREEN_SIZE(640,480) - MCFG_SCREEN_VISIBLE_AREA(0,639, 0,479) - MCFG_SCREEN_REFRESH_RATE(30) - - //MCFG_DEFAULT_LAYOUT( layout_la120 ) - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* i8251 */ - MCFG_DEVICE_ADD("i8251", I8251, 0) - /* - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_dsr)) - - MCFG_DEVICE_ADD(COM5016T_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(DEVWRITELINE("i8251", i8251_device, write_txc)) - */ -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( la120 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // later romset, with 23-003e2.e6, 23-004e2.e8, 23-005e2.e12, 23-006e2.e17 replaced by one rom, 23-038e4.e6 which may be a concatenation of the old roms, unclear. - ROM_LOAD( "23-038e4-00.e6", 0x0000, 0x2000, CRC(cad4eb09) SHA1(d5db117da363d36817476F906251ea4ee1cb14b8)) - ROM_LOAD( "23-007e2-00.e4", 0x2000, 0x0800, CRC(41eaebf1) SHA1(c7d05417b24b853280d1636776d399a0aea34720)) // used by both earlier and later romset - // there is an optional 3 roms, european and APL (and BOTH) rom which goes from 2000-2fff in e4, all undumped. - // there is another romset used on the Bell Teleprinter 1000 (Model LAS12) which I believe is 23-004e4.e6 and 23-086e2.e4 -ROM_END - - -//************************************************************************** -// DRIVERS -//************************************************************************** -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, la120, 0, 0, la120, la120, driver_device, 0, "Digital Equipment Corporation", "DECwriter III (LA120)", MACHINE_NO_SOUND | MACHINE_IS_SKELETON | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/dgn_beta.c b/src/mess/drivers/dgn_beta.c deleted file mode 100644 index a06be61dd1e..00000000000 --- a/src/mess/drivers/dgn_beta.c +++ /dev/null @@ -1,413 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - drivers/dgn_beta.c - - Dragon Beta prototype, based on two 68B09E processors, WD2797, 6845. - -Project Beta was the second machine that Dragon Data had in development at -the time they ceased trading, the first being Project Alpha (also know as the -Dragon Professional). - -The machine uses dual 68B09 CPUs which both sit on the same bus and access -the same memory and IO chips ! The first is the main processor, used to run -user code, the second is uses as a DMA controller to amongst other things -disk data transfers. The first processor controlled the second by having the -halt and nmi lines from the second CPU connected to PIA output lines so -that the could be changed under OS control. The first CPU just passed -instructions for the block to be transferred in 5 low ram addresses and -generated an NMI on the second CPU. - -Project Beta like the other Dragons used a WD2797 floppy disk controller -which is memory mapped, and controlled by the second CPU. - -Unlike the other Dragon machines, project Beta used a 68b45 to generate video, -and totally did away with the SAM. - -The machine has a 6551 ACIA chip, but I have not yet found where this is -memory mapped. - -Project Beta, had a custom MMU built from a combination of LSTTL logic, and -PAL programmable logic. This MMU could address 256 blocks of 4K, giving a -total addressable range of 1 megabyte, of this the first 768KB could be RAM, -however the machine by default, came with 256K or ram, and a 16K boot ROM, -which contained an OS-9 Level 2 bootstrap. - -A lot of the information required to start work on this driver has been -inferred from disassembly of the boot ROM, and from what little hardware -documentation still exists. - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/6821pia.h" -#include "includes/dgn_beta.h" -#include "machine/mos6551.h" -#include "formats/vdk_dsk.h" -#include "formats/dmk_dsk.h" -#include "imagedev/flopdrv.h" -#include "machine/ram.h" -#include "video/mc6845.h" - - -/* - Colour codes are as below acording to os-9 headers, however the presise values - may not be quite correct, also this will need changing as the pallate seems to - be controled by a 4x4bit register file in the video hardware - The text video ram seems to be aranged of words of character, attribute - The colour codes are stored in the attribute byte along with : - Underline bit $40 - Flash bit $80 - -These are yet to be implemented. - -*/ - -static const unsigned char dgnbeta_palette[] = -{ - /*normal brightness */ - 0x00,0x00,0x00, /* black */ - 0x80,0x00,0x00, /* red */ - 0x00,0x80,0x00, /* green */ - 0x80,0x80,0x00, /* yellow */ - 0x00,0x00,0x80, /* blue */ - 0x80,0x00,0x80, /* magenta */ - 0x00,0x80,0x80, /* cyan */ - 0x80,0x80,0x80, /* white */ - - /*enhanced brightness*/ - 0x00,0x00,0x00, /* black */ - 0xFF,0x00,0x00, /* red */ - 0x00,0xFF,0x00, /* green */ - 0xFF,0xFF,0x00, /* yellow */ - 0x00,0x00,0xFF, /* blue */ - 0xFF,0x00,0xFF, /* magenta */ - 0x00,0xFF,0xFF, /* cyan */ - 0xFF,0xFF,0xFF /* white */ -}; - -/* - 2005-05-10 - - I *THINK* I know how the memory paging works, the 64K memory map is devided - into 16x 4K pages, what is mapped into each page is controled by the IO at - FE00-FE0F like so :- - - Location Memory page Initialised to - $FE00 $0000-$0FFF $00 - $FE01 $1000-$1FFF $00 (used as ram test page, when sizing memory) - $FE02 $2000-$2FFF $00 - $FE03 $3000-$3FFF $00 - $FE04 $4000-$4FFF $00 - $FE05 $5000-$5FFF $00 - $FE06 $6000-$6FFF $1F ($1F000) - $FE07 $7000-$7FFF $00 - $FE08 $8000-$8FFF $00 - $FE09 $9000-$9FFF $00 - $FE0A $A000-$AFFF $00 - $FE0B $B000-$BFFF $00 - $FE0C $C000-$CFFF $00 - $FE0D $D000-$DFFF $00 - $FE0E $E000-$EFFF $FE - $FE0F $F000-$FFFF $FF - - The value stored at each location maps it's page to a 4K page within a 1M address - space. Acording to the Beta product descriptions released by Dragon Data, the - machine could have up to 768K of RAM, if this where true then pages $00-$BF could - potentially be RAM, and pages $C0-$FF would be ROM. The initialisation code maps in - the memory as described above. - - At reset time the Paging would of course be disabled, as the boot rom needs to be - mapped in at $C000, the initalisation code would set up the mappings above and then - enable the paging hardware. - - It appears to be more complicated than this, whilst the above is true, there appear to - be 16 sets of banking registers, the active set is controled by the bottom 4 bits of - FCC0, bit 6 has something to do with enabling and disabling banking. - - 2005-11-28 - - The value $C0 is guaranteed not to have any memory in it acording to the os9 headers, - quite how the MMU deals with this is still unknown to me. - - Bit 7 of $FCC0, sets maps in the system task which has fixed values for some pages, - the presise nature of this is yet to be descovered. - -*/ - -static ADDRESS_MAP_START( dgnbeta_map, AS_PROGRAM, 8, dgn_beta_state ) - AM_RANGE(0x0000, 0x0FFF) AM_RAMBANK("bank1") - AM_RANGE(0x1000, 0x1FFF) AM_RAMBANK("bank2") - AM_RANGE(0x2000, 0x2FFF) AM_RAMBANK("bank3") - AM_RANGE(0x3000, 0x3FFF) AM_RAMBANK("bank4") - AM_RANGE(0x4000, 0x4FFF) AM_RAMBANK("bank5") - AM_RANGE(0x5000, 0x5FFF) AM_RAMBANK("bank6") - AM_RANGE(0x6000, 0x6FFF) AM_RAMBANK("bank7") AM_SHARE("videoram") - AM_RANGE(0x7000, 0x7FFF) AM_RAMBANK("bank8") - AM_RANGE(0x8000, 0x8FFF) AM_RAMBANK("bank9") - AM_RANGE(0x9000, 0x9FFF) AM_RAMBANK("bank10") - AM_RANGE(0xA000, 0xAFFF) AM_RAMBANK("bank11") - AM_RANGE(0xB000, 0xBFFF) AM_RAMBANK("bank12") - AM_RANGE(0xC000, 0xCFFF) AM_RAMBANK("bank13") - AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK("bank14") - AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK("bank15") - AM_RANGE(0xF000, 0xFBFF) AM_RAMBANK("bank16") - AM_RANGE(0xfC00, 0xfC1F) AM_NOP - AM_RANGE(0xFC20, 0xFC23) AM_DEVREADWRITE(PIA_0_TAG, pia6821_device, read, write) - AM_RANGE(0xFC24, 0xFC27) AM_DEVREADWRITE(PIA_1_TAG, pia6821_device, read, write) - AM_RANGE(0xFC28, 0xfC7F) AM_NOP - AM_RANGE(0xfc80, 0xfc80) AM_DEVWRITE("crtc", mc6845_device, address_w) - AM_RANGE(0xfc81, 0xfc81) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE(0xfc82, 0xfC9F) AM_NOP - AM_RANGE(0xFCA0, 0xFCA3) AM_READNOP AM_WRITE(dgnbeta_colour_ram_w) /* 4x4bit colour ram for graphics modes */ - AM_RANGE(0xFCC0, 0xFCC3) AM_DEVREADWRITE(PIA_2_TAG, pia6821_device, read, write) - AM_RANGE(0xfcC4, 0xfcdf) AM_NOP - AM_RANGE(0xfce0, 0xfce3) AM_READWRITE(dgnbeta_wd2797_r ,dgnbeta_wd2797_w) /* Onboard disk interface */ - AM_RANGE(0xfce4, 0xfdff) AM_NOP - AM_RANGE(0xFE00, 0xFE0F) AM_READWRITE(dgn_beta_page_r ,dgn_beta_page_w) - AM_RANGE(0xfe10, 0xfEff) AM_NOP - AM_RANGE(0xFF00, 0xFFFF) AM_RAMBANK("bank17") - -ADDRESS_MAP_END - - - -static INPUT_PORTS_START( dgnbeta ) - PORT_START("KEY0") /* Key ROw 0 */ - /* Return shift if either shift key pressed */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - /* Return FuNction key, if either ALT key pressed */ - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - - - /* Set control on either CTRL key */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CapsLock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) - -/* PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) -*/ - - PORT_START("KEY1") /* Key row 2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) PORT_CHAR('b') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) PORT_CHAR('j') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) PORT_CHAR('i') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) PORT_CHAR('u') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) PORT_CHAR('h') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("KEY2") /* Key row 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) PORT_CHAR('n') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) PORT_CHAR('k') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) PORT_CHAR('o') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) PORT_CHAR('g') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - - PORT_START("KEY3") /* Key row 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) PORT_CHAR('m') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) PORT_CHAR('l') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) PORT_CHAR('p') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) PORT_CHAR('t') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) PORT_CHAR('f') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - - PORT_START("KEY4") /* Key row 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) PORT_CHAR('v') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) PORT_CHAR('d') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - - PORT_START("KEY5") /* Key row 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) PORT_CHAR('r') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) PORT_CHAR('s') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - - PORT_START("KEY6") /* Key row 7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) PORT_CHAR('c') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) PORT_CHAR('x') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("KEY7") /* Key row 8 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ASTERISK") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) PORT_CHAR('e') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - - PORT_START("KEY8") /* Key row 9 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) PORT_CHAR('w') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) PORT_CHAR('a') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - - PORT_START("KEY9") /* Key row 10 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_HASH") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('#') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOT_PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') - -INPUT_PORTS_END - - -PALETTE_INIT_MEMBER(dgn_beta_state, dgn) -{ - int i; - - for ( i = 0; i < sizeof(dgnbeta_palette) / 3; i++ ) { - palette.set_pen_color(i, dgnbeta_palette[i*3], dgnbeta_palette[i*3+1], dgnbeta_palette[i*3+2]); - } -} - -/* F4 Character Displayer */ -static const gfx_layout dgnbeta_charlayout = -{ - 8, 10, /* 8 x 10 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( dgnbeta ) - GFXDECODE_ENTRY( "gfx1", 0x0000, dgnbeta_charlayout, 0, 8 ) -GFXDECODE_END - -FLOPPY_FORMATS_MEMBER( dgn_beta_state::floppy_formats ) - FLOPPY_VDK_FORMAT, - FLOPPY_DMK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( dgn_beta_floppies ) - SLOT_INTERFACE("qd", FLOPPY_525_QD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( dgnbeta, dgn_beta_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M6809E, DGNBETA_CPU_SPEED_HZ) /* 2 MHz */ - MCFG_CPU_PROGRAM_MAP(dgnbeta_map) - - /* both cpus in the beta share the same address/data busses */ - MCFG_CPU_ADD(DMACPU_TAG, M6809E, DGNBETA_CPU_SPEED_HZ) /* 2 MHz */ - MCFG_CPU_PROGRAM_MAP(dgnbeta_map) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(DGNBETA_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(100)) - MCFG_SCREEN_SIZE(700,550) - MCFG_SCREEN_VISIBLE_AREA(0, 699, 0, 549) - MCFG_SCREEN_UPDATE_DEVICE( "crtc", hd6845_device, screen_update ) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", dgnbeta) - MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(dgnbeta_palette) / 3) - MCFG_PALETTE_INIT_OWNER(dgn_beta_state, dgn) - - /* PIA 0 at $FC20-$FC23 I46 */ - MCFG_DEVICE_ADD(PIA_0_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(dgn_beta_state,d_pia0_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(dgn_beta_state,d_pia0_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(dgn_beta_state,d_pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(dgn_beta_state,d_pia0_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(dgn_beta_state,d_pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(dgn_beta_state,d_pia0_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(dgn_beta_state,d_pia0_irq_b)) - - /* PIA 1 at $FC24-$FC27 I63 */ - MCFG_DEVICE_ADD(PIA_1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(dgn_beta_state,d_pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(dgn_beta_state,d_pia1_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(dgn_beta_state,d_pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(dgn_beta_state,d_pia1_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(dgn_beta_state,d_pia1_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(dgn_beta_state,d_pia1_irq_b)) - - /* PIA 2 at FCC0-FCC3 I28 */ - /* This seems to control the RAM paging system, and have the DRQ */ - /* from the WD2797 */ - MCFG_DEVICE_ADD(PIA_2_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(dgn_beta_state,d_pia2_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(dgn_beta_state,d_pia2_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(dgn_beta_state,d_pia2_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(dgn_beta_state,d_pia2_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(dgn_beta_state,d_pia2_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(dgn_beta_state,d_pia2_irq_b)) - - MCFG_WD2797_ADD(FDC_TAG, XTAL_1MHz) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(dgn_beta_state, dgnbeta_fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dgn_beta_state, dgnbeta_fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", dgn_beta_floppies, "qd", dgn_beta_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", dgn_beta_floppies, "qd", dgn_beta_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":2", dgn_beta_floppies, "qd", dgn_beta_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":3", dgn_beta_floppies, "qd", dgn_beta_state::floppy_formats) - - MCFG_MC6845_ADD("crtc", HD6845, "screen", XTAL_12_288MHz / 16) //XTAL is guessed - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(16) /*?*/ - MCFG_MC6845_UPDATE_ROW_CB(dgn_beta_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(dgn_beta_state, dgnbeta_vsync_changed)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_RAM_EXTRA_OPTIONS("128K,384K,512K,640K,768K") - /* Ram size can now be configured, since the machine was known as either the Dragon Beta or */ - /* the Dragon 128, I have added a config for 128K, however, the only working machine known */ - /* to exist was fitted with 256K, so I have made this the default. Also available */ - /* documentation seems to sugest a maximum of 768K, so I have included configs increasing */ - /* in blocks of 128K up to this maximum. */ -MACHINE_CONFIG_END - -ROM_START(dgnbeta) - ROM_REGION(0x4000,MAINCPU_TAG,0) - ROM_SYSTEM_BIOS( 0, "bootrom", "Dragon beta OS9 boot rom (1984)" ) - ROMX_LOAD("beta_bt.rom" ,0x0000 ,0x4000 ,CRC(4c54c1de) SHA1(141d9fcd2d187c305dff83fce2902a30072aed76), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "testrom", "Dragon beta test rom (1984?)" ) - ROMX_LOAD("beta_tst.rom" ,0x2000 ,0x2000 ,CRC(01d79d00) SHA1(343e08cf7656b5e8970514868df37ea0af1e2362), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "cfiles", "cfiles rom" ) - ROMX_LOAD("beta_cfi.rom" ,0x2000 ,0x2000 ,CRC(d312e4c0) SHA1(5c00daac488eaf8d36d66de6ec6c746ab7b78ecf), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "dfiles", "dfiles rom" ) - ROMX_LOAD("beta_dfi.rom" ,0x2000 ,0x2000 ,CRC(c4ad7f64) SHA1(50aa92a1c383321485d5a1aa41dfe4f90b3beaed), ROM_BIOS(4)) - - ROM_REGION (0x2000, "gfx1", 0) - ROM_LOAD("betachar.rom" ,0x0000 ,0x2000 ,CRC(ca79d66c) SHA1(8e2090d471dd97a53785a7f44a49d3c8c85b41f2)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, dgnbeta, 0, 0, dgnbeta, dgnbeta, driver_device, 0, "Dragon Data Ltd", "Dragon Beta Prototype", MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/digel804.c b/src/mess/drivers/digel804.c deleted file mode 100644 index f8e9ecf13a2..00000000000 --- a/src/mess/drivers/digel804.c +++ /dev/null @@ -1,726 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:balrog,Jonathan Gevaryahu,Sandro Ronco -/****************************************************************************** -* -* Wavetek/Digelec model 804/EP804 (eprom programmer) driver -* By balrog and Jonathan Gevaryahu AKA Lord Nightmare -* Code adapted from zexall.c -* -* DONE: -* figure out z80 address space and hook up roms and rams (done) -* figure out where 10937 vfd controller lives (port 0x44 bits 7 and 0, POR has not been found yet) -* figure out how keypresses are detected (/INT?, port 0x43, and port 0x46) -* figure out how the banked ram works (writes to port 0x43 select a ram bank, fw2.2 supports 64k and fw4.1 supports 256k) -* tentatively figure out how flow control from ACIA works (/NMI)? -* hook up the speaker/beeper (port 0x45) -* hook up vfd controller (done to stderr, no artwork) -* hook up leds on front panel (done to stderr for now) -* hook up r6551 serial and attach terminal for sending to ep804 -* /nmi is emulated correctly (i.e. its tied to +5v. that was easy!) -* hook up keypad via 74C923 and mode buttons via logic gate mess -* -* TODO: -* remove ACIA hack in digel804_state::acia_command_w -* minor finishing touches to i/o map -* EPROM socket stuff (ports 0x40, 0x41, 0x42 and 0x47) -* artwork -* -******************************************************************************/ - -// port 40 read reads eprom socket pins 11-13, 15-19 (i.e. eprom pin D0 to pin D7) - -// port 40 write writes eprom socket pins 11-13, 15-19 (i.e. eprom pin D0 to pin D7) - -// port 41 write controls eprom socket pins 10 to 3 (d0 to d8 to eprom pins A0 to A7) and SIM pins 7, 20/11, 8/12, 27, 23, and 21 (d0 to d5, corresponding to SIM pins for A9, A10, A11, A12, A13, and A14+A15) -// Note: the v2.0 hardware has bit d6 controlling one of the pins going to the expansion ram socket -// The 2.0 hardware may also have separate SIM controls for A14 and A15, possibly using bit d7 to control sim A15 somehow - -// port 42 write controls eprom socket pins 25(d0), 2(d4), 27(d6) - -// port 43 read is status/mode -#undef PORT43_R_VERBOSE -// port 43 write is ram banking and ctl1-7; it also clears overload state -#define PORT43_W_VERBOSE 1 -// port 44 write is vfd serial/reset, as well as power and z80 control and various enables; it also clears powerfail state -#define PORT44_W_VERBOSE 1 -// port 45 write is speaker control -#undef PORT45_W_VERBOSE -// port 46 read is keypad - -// port 46 write is LED control -#undef PORT46_W_VERBOSE - -// port 47 write is tim0-tim7 - - -/* Core includes */ -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "machine/roc10937.h" -#include "machine/mos6551.h" -#include "machine/mm74c922.h" -#include "machine/ram.h" -#include "bus/rs232/rs232.h" -#include "digel804.lh" - - -class digel804_state : public driver_device -{ -public: - digel804_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_acia(*this, "acia"), - m_vfd(*this, "vfd"), - m_kb(*this, "74c923"), - m_ram(*this, RAM_TAG), - m_rambank(*this, "bankedram") - { - } - - required_device m_maincpu; - required_device m_speaker; - required_device m_acia; - required_device m_vfd; - required_device m_kb; - required_device m_ram; - required_memory_bank m_rambank; - - virtual void machine_reset(); - DECLARE_DRIVER_INIT(digel804); - DECLARE_WRITE8_MEMBER( op00 ); - DECLARE_READ8_MEMBER( ip40 ); - DECLARE_WRITE8_MEMBER( op40 ); - DECLARE_WRITE8_MEMBER( op41 ); - DECLARE_WRITE8_MEMBER( op42 ); - DECLARE_READ8_MEMBER( ip43 ); - DECLARE_WRITE8_MEMBER( op43 ); - DECLARE_WRITE8_MEMBER( op43_1_4 ); - DECLARE_WRITE8_MEMBER( op44 ); - DECLARE_WRITE8_MEMBER( op45 ); - DECLARE_READ8_MEMBER( ip46 ); - DECLARE_WRITE8_MEMBER( op46 ); - DECLARE_WRITE8_MEMBER( op47 ); - DECLARE_READ8_MEMBER( acia_rxd_r ); - DECLARE_WRITE8_MEMBER( acia_txd_w ); - DECLARE_READ8_MEMBER( acia_status_r ); - DECLARE_WRITE8_MEMBER( acia_reset_w ); - DECLARE_READ8_MEMBER( acia_command_r ); - DECLARE_WRITE8_MEMBER( acia_command_w ); - DECLARE_READ8_MEMBER( acia_control_r ); - DECLARE_WRITE8_MEMBER( acia_control_w ); - DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); - DECLARE_WRITE_LINE_MEMBER( ep804_acia_irq_w ); - DECLARE_WRITE_LINE_MEMBER( da_w ); - DECLARE_INPUT_CHANGED_MEMBER(mode_change); - // current speaker state for port 45 - UINT8 m_speaker_state; - // ram stuff for banking - UINT8 m_ram_bank; - // states - UINT8 m_acia_intq; - UINT8 m_overload_state; - UINT8 m_key_intq; - UINT8 m_remote_mode; - UINT8 m_key_mode; - UINT8 m_sim_mode; - UINT8 m_powerfail_state; - UINT8 m_chipinsert_state; - UINT8 m_keyen_state; - UINT8 m_op41; -}; - - -enum { MODE_OFF, MODE_KEY, MODE_REM, MODE_SIM }; - - -DRIVER_INIT_MEMBER(digel804_state,digel804) -{ - m_speaker_state = 0; - //port43_rtn = 0xEE;//0xB6; - m_acia_intq = 1; // /INT source 1 - m_overload_state = 0; // OVLD - m_key_intq = 1; // /INT source 2 - m_remote_mode = 1; // /REM - m_key_mode = 0; // /KEY - m_sim_mode = 1; // /SIM - m_powerfail_state = 1; // "O11" - m_chipinsert_state = 0; // PIN - m_ram_bank = 0; - m_op41 = 0; - m_keyen_state = 1; // /KEYEN - - m_rambank->set_base(m_ram->pointer()); -} - -void digel804_state::machine_reset() -{ - m_vfd->reset(); -} - -READ8_MEMBER( digel804_state::ip40 ) // eprom data bus read -{ - // TODO: would be nice to have a 'fake eprom' here - return 0xFF; -} - -WRITE8_MEMBER( digel804_state::op40 ) // eprom data bus write -{ - // TODO: would be nice to have a 'fake eprom' here - logerror("Digel804: port 40, eprom databus had %02X written to it!\n", data); -} - -WRITE8_MEMBER( digel804_state::op41 ) // eprom address low write AND SIM write, d6 also controls memory map somehow -{ - // TODO: would be nice to have a 'fake eprom' here - logerror("Digel804: port 41, eprom address low/sim/memorybank had %02X written to it!\n", data); - //fprintf(stderr,"op41 write of %02X, ram mapper bit is %d\n", data, (data&0x40)?1:0); - m_op41 = data; -} - -WRITE8_MEMBER( digel804_state::op42 ) // eprom address hi and control write -{ - // TODO: would be nice to have a 'fake eprom' here - logerror("Digel804: port 42, eprom address hi/control had %02X written to it!\n", data); -} - -READ8_MEMBER( digel804_state::ip43 ) -{ - /* Register 0x43: status/mode register read - bits 76543210 - |||||||\- overload state (0 = not overloaded; 1 = overload detected, led on and power disconnected to ic, writing to R43 sets this to ok) - ||||||\-- debug jumper X5 on the board; reads as 1 unless jumper is present - |||||\--- /INT status (any key pressed on keypad (0 = one or more pressed, 1 = none pressed) OR ACIA has thrown an int) - ||||\---- remote mode selected (0 = selected, 1 = not) \ - |||\----- key mode selected (0 = selected, 1 = not) > if all 3 of these are 1, unit is going to standby - ||\------ sim mode selected (0 = selected, 1 = not) / - |\------- power failure status (1 = power has failed, 0 = ok; writes to R44 set this to ok) - \-------- chip insert detect state 'PIN' (1 = no chip or cmos chip which ammeter cannot detect; 0 = nmos or detectable chip inserted) - after power failure (in key mode): - 0xEE 11101110 when no keypad key pressed - 0xEA 11101010 when keypad key pressed - in key mode: - 0xAE 10101110 when no keypad key pressed - 0xAA 10101010 when keypad key pressed - in remote mode: - 0xB6 10110110 when no keypad key pressed - 0xB2 10110010 when keypad key pressed - in sim mode: - 0x9E 10011110 when no keypad key pressed - 0x9A 10011010 when keypad key pressed - in off mode (before z80 is powered down): - 0xFE 11111110 - - */ - -#ifdef PORT43_R_VERBOSE - logerror("Digel804: returning %02X for port 43 status read\n", port43_rtn); -#endif - return ((m_overload_state<<0) - |((ioport("DEBUG")->read()&1)<<1) - |((m_key_intq&m_acia_intq)<<2) - |(m_remote_mode<<3) - |(m_key_mode<<4) - |(m_sim_mode<<5) - |(m_powerfail_state<<6) - |(m_chipinsert_state<<7)); - -} - -WRITE8_MEMBER( digel804_state::op00 ) -{ - m_ram_bank = data; - m_rambank->set_base(m_ram->pointer() + ((m_ram_bank * 0x8000) & m_ram->mask())); -} - -WRITE8_MEMBER( digel804_state::op43 ) -{ - /* writes to 0x43 control the ram banking on firmware which supports it - * bits:76543210 - * |||||\\\- select ram bank for 4000-bfff area based on these bits (2.0 hardware) - * \\\\\\\-- CTL lines - - * all writes to port 43 will reset the overload state unless the ammeter detects the overload is ongoing - */ - m_overload_state = 0; // writes to port 43 clear overload state -#ifdef PORT43_W_VERBOSE - logerror("Digel804: port 0x43 ram bank had %02x written to it!\n", data); - logerror(" op41 bit 6 is %d\n", (m_op41 & 0x40)?1:0); -#endif - m_ram_bank = data&7; - if ((data&0xF8)!=0) - logerror("Digel804: port 0x43 ram bank had unexpected data %02x written to it!\n", data); - - m_rambank->set_base(m_ram->pointer() + ((m_ram_bank * 0x8000) & m_ram->mask())); -} - -WRITE8_MEMBER( digel804_state::op43_1_4 ) -{ - m_overload_state = 0; // writes to port 43 clear overload state -} - -WRITE8_MEMBER( digel804_state::op44 ) // state write -{ - /* writes to 0x44 control the 10937 vfd chip, z80 power/busrq, eprom driving and some eprom power ctl lines - * bits:76543210 - * |||||||\- 10937 VFDC '/SCK' serial clock '/CDIS' - * ||||||\-- controls '/KEYEN' (which enables the four mode buttons when active) - * |||||\--- z80 and system power control (0 = power on, 1 = power off/standby), also controls '/MEMEN' which secondarily controls POR(power on/reset) for the VFDC chip - * ||||\---- controls the z80 /BUSRQ line (0 = idle/high, 1 = asserted/low) '/BRQ' - * |||\----- when 1, enables the output drivers of op40 to the rom data pins - * ||\------ controls 'CTL8' - * |\------- controls 'CTL9' - * \-------- 10937 VFDC 'DATA' serial data '/DDIS' - - * all writes to port 44 will reset the powerfail state - */ - m_powerfail_state = 0; // writes to port 44 clear powerfail state - m_keyen_state = BIT(data, 1); -#ifdef PORT44_W_VERBOSE - logerror("Digel804: port 0x44 vfd/state control had %02x written to it!\n", data); -#endif - m_vfd->por(!(data&0x04)); - m_vfd->data(data&0x80); - m_vfd->sclk(data&1); -} - -WRITE8_MEMBER( digel804_state::op45 ) // speaker write -{ - // all writes to here invert the speaker state, verified from schematics -#ifdef PORT45_W_VERBOSE - logerror("Digel804: port 0x45 speaker had %02x written to it!\n", data); -#endif - m_speaker_state ^= 0xFF; - m_speaker->level_w(m_speaker_state); -} - -READ8_MEMBER( digel804_state::ip46 ) // keypad read -{ - /* reads E* for a keypad number 0-F - * reads F0 for enter - * reads F4 for next - * reads F8 for rept - * reads FC for clear - * F* takes precedence over E* - * higher numbers take precedence over lower ones - * this value auto-latches on a key press and remains through multiple reads - * this is done by a 74C923 integrated circuit - */ - UINT8 kbd = m_kb->read(); -#ifdef PORT46_R_VERBOSE - logerror("Digel804: returning %02X for port 46 keypad read\n", kbd); -#endif - - return BITSWAP8(kbd,7,6,5,4,1,0,3,2); // verified from schematics -} - -WRITE8_MEMBER( digel804_state::op46 ) -{ - /* writes to 0x46 control the LEDS on the front panel - * bits:76543210 - * ||||\\\\- these four bits choose which of the 16 function leds is lit; the number is INVERTED first - * |||\----- if this bit is 1, the function leds are disabled - * ||\------ this bit controls the 'error' led; 1 = on - * |\------- this bit controls the 'busy' led; 1 = on - * \-------- this bit controls the 'input' led; 1 = on - */ -#ifdef PORT46_W_VERBOSE - logerror("Digel804: port 0x46 LED control had %02x written to it!\n", data); -#endif - //popmessage("LEDS: %s %s %s Func: %s%d\n", (data&0x80)?"INPUT":"-----", (data&0x40)?"BUSY":"----", (data&0x20)?"ERROR":"-----", (data&0x10)?"None":"", (data&0x10)?-1:(~data&0xF)); - //fprintf("LEDS: %s %s %s Func: %s%d\n", (data&0x80)?"INPUT":"-----", (data&0x40)?"BUSY":"----", (data&0x20)?"ERROR":"-----", (data&0x10)?"None":"", (data&0x10)?-1:(~data&0xF)); - - output_set_value("input_led", BIT(data,7)); - output_set_value("busy_led", BIT(data,6)); - output_set_value("error_led", BIT(data,5)); - - for(int i=0; i<16; i++) - output_set_indexed_value("func_led", i, (!(data & 0x10) && ((~data & 0x0f) == i)) ? 1 : 0); -} - -WRITE8_MEMBER( digel804_state::op47 ) // eprom timing/power and control write -{ - // TODO: would be nice to have a 'fake eprom' here - logerror("Digel804: port 47, eprom timing/power and control had %02X written to it!\n", data); -} - -INPUT_CHANGED_MEMBER( digel804_state::mode_change ) -{ - if (!newval && !m_keyen_state) - { - switch ((int)(FPTR)param) - { - case MODE_OFF: - m_key_mode = m_remote_mode = m_sim_mode = 1; - break; - case MODE_KEY: - m_remote_mode = m_sim_mode = 1; - m_key_mode = 0; - break; - case MODE_REM: - m_key_mode = m_sim_mode = 1; - m_remote_mode = 0; - break; - case MODE_SIM: - m_remote_mode = m_key_mode = 1; - m_sim_mode = 0; - break; - } - - m_acia->reset(); - } - - // press one of those keys reset the Z80 - m_maincpu->set_input_line(INPUT_LINE_RESET, (!newval && !m_keyen_state) ? ASSERT_LINE : CLEAR_LINE); -} - -/* ACIA Trampolines */ -READ8_MEMBER( digel804_state::acia_rxd_r ) -{ - return m_acia->read(space, 0); -} - -WRITE8_MEMBER( digel804_state::acia_txd_w ) -{ - m_acia->write(space, 0, data); -} - -READ8_MEMBER( digel804_state::acia_status_r ) -{ - return m_acia->read(space, 1); -} - -WRITE8_MEMBER( digel804_state::acia_reset_w ) -{ - m_acia->write(space, 1, data); -} - -READ8_MEMBER( digel804_state::acia_command_r ) -{ - return m_acia->read(space, 2); -} - -WRITE8_MEMBER( digel804_state::acia_command_w ) -{ - data |= 0x08; // HACK for ep804 remote mode - - m_acia->write(space, 2, data); -} - -READ8_MEMBER( digel804_state::acia_control_r ) -{ - return m_acia->read(space, 3); -} - -WRITE8_MEMBER( digel804_state::acia_control_w ) -{ - m_acia->write(space, 3, data); -} - - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(z80_mem_804_1_4, AS_PROGRAM, 8, digel804_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROM // 3f in mapper = rom J3 - //AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("main_ram") // 6f in mapper = RAM D43 (6164) - //AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("main_ram") // 77 in mapper = RAM D44 (6164) - //AM_RANGE(0x8000, 0x9fff) AM_RAM AM_SHARE("main_ram") // 7b in mapper = RAM D45 (6164) - //AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("main_ram") // 7d in mapper = RAM D46 (6164) - AM_RANGE(0x4000,0xbfff) AM_RAMBANK("bankedram") - // c000-cfff is open bus in mapper, 7f - AM_RANGE(0xd000, 0xd7ff) AM_RAM // 7e in mapper = RAM P3 (6116) - AM_RANGE(0xd800, 0xf7ff) AM_ROM // 5f in mapper = rom K3 - // f800-ffff is open bus in mapper, 7f -ADDRESS_MAP_END - -static ADDRESS_MAP_START(z80_mem_804_1_2, AS_PROGRAM, 8, digel804_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM // 3f in mapper = rom D41 - AM_RANGE(0x2000, 0x3fff) AM_ROM // 5f in mapper = rom D42 - //AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("main_ram") // 6f in mapper = RAM D43 (6164) - //AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("main_ram") // 77 in mapper = RAM D44 (6164) - //AM_RANGE(0x8000, 0x9fff) AM_RAM AM_SHARE("main_ram") // 7b in mapper = RAM D45 (6164) - //AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("main_ram") // 7d in mapper = RAM D46 (6164) - AM_RANGE(0x4000,0xbfff) AM_RAMBANK("bankedram") - // c000-cfff is open bus in mapper, 7f - //AM_RANGE(0xc000, 0xc7ff) AM_RAM // hack for now to test, since sometimes it writes to c3ff - AM_RANGE(0xd000, 0xd7ff) AM_RAM // 7e in mapper = RAM D47 (6116) - // d800-ffff is open bus in mapper, 7f -ADDRESS_MAP_END - -static ADDRESS_MAP_START(z80_io_1_4, AS_IO, 8, digel804_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // io bits: x 1 x x x * * * - // writes to 47, 4e, 57, 5e, 67, 6e, 77, 7e, c7, ce, d7, de, e7, ee, f7, fe all go to 47, same with reads - AM_RANGE(0x00, 0x00) AM_MIRROR(0x38) AM_WRITE(op00) // W, banked ram - AM_RANGE(0x40, 0x40) AM_MIRROR(0xB8) AM_READWRITE(ip40, op40) // RW, eprom socket data bus input/output value - AM_RANGE(0x41, 0x41) AM_MIRROR(0xB8) AM_WRITE(op41) // W, eprom socket address low out - AM_RANGE(0x42, 0x42) AM_MIRROR(0xB8) AM_WRITE(op42) // W, eprom socket address hi/control out - AM_RANGE(0x43, 0x43) AM_MIRROR(0xB8) AM_READWRITE(ip43, op43_1_4) // RW, mode and status register, also checks if keypad is pressed; write is unknown - AM_RANGE(0x44, 0x44) AM_MIRROR(0xB8) AM_WRITE(op44) // W, 10937 vfd controller, z80 power and state control reg - AM_RANGE(0x45, 0x45) AM_MIRROR(0xB8) AM_WRITE(op45) // W, speaker bit; every write inverts state - AM_RANGE(0x46, 0x46) AM_MIRROR(0xB8) AM_READWRITE(ip46, op46) // RW, reads keypad, writes controls the front panel leds. - AM_RANGE(0x47, 0x47) AM_MIRROR(0xB8) AM_WRITE(op47) // W eprom socket power and timing control - // io bits: 1 0 x x x * * * - // writes to 80, 88, 90, 98, a0, a8, b0, b8 all go to 80, same with reads - AM_RANGE(0x80, 0x80) AM_MIRROR(0x38) AM_WRITE(acia_txd_w) // (ACIA xmit reg) - AM_RANGE(0x81, 0x81) AM_MIRROR(0x38) AM_READ(acia_rxd_r) // (ACIA rcv reg) - AM_RANGE(0x82, 0x82) AM_MIRROR(0x38) AM_WRITE(acia_reset_w) // (ACIA reset reg) - AM_RANGE(0x83, 0x83) AM_MIRROR(0x38) AM_READ(acia_status_r) // (ACIA status reg) - AM_RANGE(0x84, 0x84) AM_MIRROR(0x38) AM_WRITE(acia_command_w) // (ACIA command reg) - AM_RANGE(0x85, 0x85) AM_MIRROR(0x38) AM_READ(acia_command_r) // (ACIA command reg) - AM_RANGE(0x86, 0x86) AM_MIRROR(0x38) AM_WRITE(acia_control_w) // (ACIA control reg) - AM_RANGE(0x87, 0x87) AM_MIRROR(0x38) AM_READ(acia_control_r) // (ACIA control reg) - //AM_RANGE(0x80,0x87) AM_MIRROR(0x38) AM_SHIFT(-1) AM_DEVREADWRITE("acia", mos6551_device, read, write) // this doesn't work since we lack an AM_SHIFT command - -ADDRESS_MAP_END - -static ADDRESS_MAP_START(z80_io_1_2, AS_IO, 8, digel804_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // io bits: x 1 x x x * * * - // writes to 47, 4e, 57, 5e, 67, 6e, 77, 7e, c7, ce, d7, de, e7, ee, f7, fe all go to 47, same with reads - AM_RANGE(0x40, 0x40) AM_MIRROR(0xB8) AM_READWRITE(ip40, op40) // RW, eprom socket data bus input/output value - AM_RANGE(0x41, 0x41) AM_MIRROR(0xB8) AM_WRITE(op41) // W, eprom socket address low out - AM_RANGE(0x42, 0x42) AM_MIRROR(0xB8) AM_WRITE(op42) // W, eprom socket address hi/control out - AM_RANGE(0x43, 0x43) AM_MIRROR(0xB8) AM_READWRITE(ip43, op43) // RW, mode and status register, also checks if keypad is pressed; write is unknown - AM_RANGE(0x44, 0x44) AM_MIRROR(0xB8) AM_WRITE(op44) // W, 10937 vfd controller, z80 power and state control reg - AM_RANGE(0x45, 0x45) AM_MIRROR(0xB8) AM_WRITE(op45) // W, speaker bit; every write inverts state - AM_RANGE(0x46, 0x46) AM_MIRROR(0xB8) AM_READWRITE(ip46, op46) // RW, reads keypad, writes controls the front panel leds. - AM_RANGE(0x47, 0x47) AM_MIRROR(0xB8) AM_WRITE(op47) // W eprom socket power and timing control - // io bits: 1 0 x x x * * * - // writes to 80, 88, 90, 98, a0, a8, b0, b8 all go to 80, same with reads - AM_RANGE(0x80, 0x80) AM_MIRROR(0x38) AM_WRITE(acia_txd_w) // (ACIA xmit reg) - AM_RANGE(0x81, 0x81) AM_MIRROR(0x38) AM_READ(acia_rxd_r) // (ACIA rcv reg) - AM_RANGE(0x82, 0x82) AM_MIRROR(0x38) AM_WRITE(acia_reset_w) // (ACIA reset reg) - AM_RANGE(0x83, 0x83) AM_MIRROR(0x38) AM_READ(acia_status_r) // (ACIA status reg) - AM_RANGE(0x84, 0x84) AM_MIRROR(0x38) AM_WRITE(acia_command_w) // (ACIA command reg) - AM_RANGE(0x85, 0x85) AM_MIRROR(0x38) AM_READ(acia_command_r) // (ACIA command reg) - AM_RANGE(0x86, 0x86) AM_MIRROR(0x38) AM_WRITE(acia_control_w) // (ACIA control reg) - AM_RANGE(0x87, 0x87) AM_MIRROR(0x38) AM_READ(acia_control_r) // (ACIA control reg) - //AM_RANGE(0x80,0x87) AM_MIRROR(0x38) AM_SHIFT(-1) AM_DEVREADWRITE("acia", mos6551_device, read, write) // this doesn't work since we lack an AM_SHIFT command - -ADDRESS_MAP_END - - -/****************************************************************************** - Input Ports -******************************************************************************/ -static INPUT_PORTS_START( digel804 ) - PORT_START("LINE0") /* KEY ROW 0, 'X1' */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTR/INCR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('^') - - PORT_START("LINE1") /* KEY ROW 1, 'X2' */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT/DECR") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - - PORT_START("LINE2") /* KEY ROW 2, 'X3' */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("LINE3") /* KEY ROW 3, 'X4' */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_START("MODE") // TODO, connects entirely separately from the keypad through some complicated latching logic - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KEY") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER( DEVICE_SELF, digel804_state, mode_change, MODE_KEY ) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REM") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER( DEVICE_SELF, digel804_state, mode_change, MODE_REM ) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SIM") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER( DEVICE_SELF, digel804_state, mode_change, MODE_SIM ) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_O) PORT_CHANGED_MEMBER( DEVICE_SELF, digel804_state, mode_change, MODE_OFF ) - - PORT_START("DEBUG") // debug jumper on the board - PORT_DIPNAME( 0x01, 0x01, "Debug Mode" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START( digel804_rs232_defaults ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_ODD ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -/****************************************************************************** - Machine Drivers -******************************************************************************/ - -WRITE_LINE_MEMBER( digel804_state::da_w ) -{ - m_key_intq = state ? 0 : 1; - m_maincpu->set_input_line(0, (m_key_intq & m_acia_intq) ? CLEAR_LINE : ASSERT_LINE); -} - -WRITE_LINE_MEMBER( digel804_state::acia_irq_w ) -{ - m_acia_intq = state ? 0 : 1; - m_maincpu->set_input_line(0, (m_key_intq & m_acia_intq) ? CLEAR_LINE : ASSERT_LINE); -} - -WRITE_LINE_MEMBER( digel804_state::ep804_acia_irq_w ) -{ -} - -static MACHINE_CONFIG_START( digel804, digel804_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_3_6864MHz/2) /* Z80A, X1(aka E0 on schematics): 3.6864Mhz */ - MCFG_CPU_PROGRAM_MAP(z80_mem_804_1_4) - MCFG_CPU_IO_MAP(z80_io_1_4) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_ROC10937_ADD("vfd",0) // RIGHT_TO_LEFT - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_digel804) - - MCFG_DEVICE_ADD("74c923", MM74C923, 0) - MCFG_MM74C922_DA_CALLBACK(WRITELINE(digel804_state, da_w)) - MCFG_MM74C922_X1_CALLBACK(IOPORT("LINE0")) - MCFG_MM74C922_X2_CALLBACK(IOPORT("LINE1")) - MCFG_MM74C922_X3_CALLBACK(IOPORT("LINE2")) - MCFG_MM74C922_X4_CALLBACK(IOPORT("LINE3")) - - /* acia */ - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_3_6864MHz/2) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(digel804_state, acia_irq_w)) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", mos6551_device, write_cts)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("null_modem", digel804_rs232_defaults) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", digel804_rs232_defaults) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_RAM_EXTRA_OPTIONS("32K,64K,128K") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ep804, digel804 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") /* Z80, X1(aka E0 on schematics): 3.6864Mhz */ - MCFG_CPU_PROGRAM_MAP(z80_mem_804_1_2) - MCFG_CPU_IO_MAP(z80_io_1_2) - - MCFG_DEVICE_MODIFY("acia") - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(digel804_state, ep804_acia_irq_w)) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("64K") -MACHINE_CONFIG_END - - - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -/* -For the 82S23A/MMI6330-equivalent mapper PROM at D30: - -z80 a11 -> prom a0 -z80 a12 -> prom a1 -z80 a13 -> prom a2 -z80 a14 -> prom a3 -z80 a15 -> prom a4 - -prom d0 -> ram 6116 /CE (pin 18?) at d47 -prom d1 -> ram 6116/64 /CE (pin 20) at d46 -prom d2 -> ram 6116/64 /CE (pin 20) at d45 -prom d3 -> ram 6116/64 /CE (pin 20) at d44 -prom d4 -> ram 6116/64 /CE (pin 20) at d43 -prom d5 -> rom /CE at d42 -prom d6 -> rom /CE at d41 -prom d7 -> N/C (unused) - - -On the v2.0 804-0197B mainboard, the added connector X9 (for the ram expansion daughterboard) -near to the mapper prom at D30 has the pinout: - ___ -|1 10 -|2 9| -|3 8| -|4 7| -|5_6| - -1 -> pin 15 of CD74HC374E at D23 & eprom socket pin A6 (i.e. op41 bit 6) -2 -> N/C -3 -> ram 6116/64 /CE (pin 20) of D45 & mapper prom D2 (pin 3) -4 -> ram 6116/64 /CE (pin 20) of D43 & mapper prom D4 (pin 5) -5 -> CE2 (pin 26) of all four ram chips (D43 D44 D45 D46) -6 -> +5v -7 -> ram 6116/64 /CE (pin 20) of D44 & mapper prom D3 (pin 4) -8 -> ram 6116/64 /CE (pin 20) of D46 & mapper prom D1 (pin 2) -9 -> N/C -10 -> mapper prom /CE (pin 15) - -If the ram expansion is not installed (i.e. only 32k of base ram on the mainboard), there is a jumper present between pins 5 and 6 -*/ - -ROM_START(digel804) // address mapper 804-1-4 - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("1-04__76f1.27128.d41", 0x0000, 0x4000, CRC(61b50b61) SHA1(ad717fcbf3387b0a8fb0546025d3c527792eb3f0)) - // the second rom here is loaded bizarrely: the first 3/4 appears at e000-f7ff and the last 1/4 appears at d800-dfff - ROM_LOAD("2-04__d6cc.2764a.d42", 0xe000, 0x1800, CRC(098cb008) SHA1(9f04e12489ab5f714d2fd4af8158969421557e75)) - ROM_CONTINUE(0xd800, 0x800) - ROM_REGION(0x20, "proms", 0) - ROM_LOAD("804-1-4.82s23a.d30", 0x0000, 0x0020, CRC(f961beb1) SHA1(f2ec89375e656eeabc30246d42741cf718fb0f91)) // Address mapper prom, 82s23/mmi6330/tbp18sa030 equivalent 32x8 open collector -ROM_END - -ROM_START(ep804) // address mapper 804-1-2 - ROM_REGION(0x10000, "maincpu", 0) - ROM_DEFAULT_BIOS("ep804_v1.6") - ROM_SYSTEM_BIOS( 0, "ep804_v1.6", "Wavetek/Digelec EP804 FWv1.6") // hardware 1.1 - ROMX_LOAD("804-2__rev_1.6__07f7.hn482764g-4.d41", 0x0000, 0x2000, CRC(2d4c334c) SHA1(1be70ed5f4f315a8d2e38a17327a049e00fa174e), ROM_BIOS(1)) - ROMX_LOAD("804-3__rev_1.6__265c.hn482764g-4.d42", 0x2000, 0x2000, CRC(9c14906b) SHA1(41996039e604011c7c0f757397f82b6479ee3f62), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "ep804_v1.4", "Wavetek/Digelec EP804 FWv1.4") // hardware 1.1 - ROMX_LOAD("804-2_rev_1.4__7a7e.hn482764g-4.d41", 0x0000, 0x2000, CRC(fdc0d2e3) SHA1(da1bc1e8c4cb2a2d8cd2273f3e1a9f318ae8cb87), ROM_BIOS(2)) - ROMX_LOAD("804-3_rev_1.4__f240.2732.d42", 0x2000, 0x1000, CRC(29827e29) SHA1(4c7fadf81bcf32349a564d946f5d215de50315c5), ROM_BIOS(2)) - ROMX_LOAD("804-3_rev_1.4__f240.2732.d42", 0x3000, 0x1000, CRC(29827e29) SHA1(4c7fadf81bcf32349a564d946f5d215de50315c5), ROM_BIOS(2)) // load this twice - ROM_SYSTEM_BIOS( 2, "ep804_v2.21", "Wavetek/Digelec EP804 FWv2.21") // hardware 1.5 NOTE: this may use the address mapper 804-1-3 which is not dumped! - ROMX_LOAD("804-2_rev2.21__cs_ab50.hn482764g.d41", 0x0000, 0x2000, CRC(ffbc95f6) SHA1(b12aa97e23d546064f1d17aa9b90772017fec5ec), ROM_BIOS(3)) - ROMX_LOAD("804-3_rev2.21__cs_6b98.hn482764g.d42", 0x2000, 0x2000, CRC(a4acb9fe) SHA1(bbc7e3e2e6b3b1abe747380909dcddc985ef8d0d), ROM_BIOS(3)) - ROM_REGION(0x20, "proms", 0) - ROM_LOAD("804-1-2.mmi_6330-in.d30", 0x0000, 0x0020, CRC(30dd4721) SHA1(e4b2f5756118be4c8ab56c708dc4f42469c7e51b)) // Address mapper prom, 82s23/mmi6330/tbp18sa030 equivalent 32x8 open collector -ROM_END - - - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, digel804, 0, 0, digel804, digel804, digel804_state, digel804, "Digelec, Inc", "Digelec 804 EPROM Programmer", MACHINE_NOT_WORKING ) -COMP( 1982, ep804, digel804, 0, ep804, digel804, digel804_state, digel804, "Wavetek/Digelec, Inc", "EP804 EPROM Programmer", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/dim68k.c b/src/mess/drivers/dim68k.c deleted file mode 100644 index 7dce08a1a89..00000000000 --- a/src/mess/drivers/dim68k.c +++ /dev/null @@ -1,398 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Micro Craft Dimension 68000 - - 28/12/2011 Skeleton driver. - - This computer had the facility for plug-in cards to emulate popular - computers of the time such as apple, trs80, kaypro, etc. The floppy - disk parameters could be set to be able to read the disks of the - various systems, or you create any other format you wished. - - There is no schematic available, so not fully able to emulate at - this time. - - ToDo: - - - Floppy controller - - Floppy formats (not sure if MESS supports user-defined formats) - - Banking - - Graphics display (including colour and video_control options) - - DUART - - RTC - - RS232 interface - - Keyboard - - Centronics printer - - Video-high - - Video-reset - - Game switches, paddles and timers - - The plug-in boards - - Emulator trap function - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "sound/speaker.h" -#include "video/mc6845.h" -#include "machine/keyboard.h" -#include "machine/upd765.h" - - -class dim68k_state : public driver_device -{ -public: - dim68k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "crtc"), - m_speaker(*this, "speaker"), - m_ram(*this, "ram"), - m_palette(*this, "palette") { } - - DECLARE_READ16_MEMBER( dim68k_duart_r ); - DECLARE_READ16_MEMBER( dim68k_fdc_r ); - DECLARE_READ16_MEMBER( dim68k_game_switches_r ); - DECLARE_READ16_MEMBER( dim68k_speaker_r ); - DECLARE_WRITE16_MEMBER( dim68k_banksw_w ); - DECLARE_WRITE16_MEMBER( dim68k_duart_w ); - DECLARE_WRITE16_MEMBER( dim68k_fdc_w ); - DECLARE_WRITE16_MEMBER( dim68k_printer_strobe_w ); - DECLARE_WRITE16_MEMBER( dim68k_reset_timers_w ); - DECLARE_WRITE16_MEMBER( dim68k_speaker_w ); - DECLARE_WRITE16_MEMBER( dim68k_video_control_w ); - DECLARE_WRITE16_MEMBER( dim68k_video_high_w ); - DECLARE_WRITE16_MEMBER( dim68k_video_reset_w ); - DECLARE_WRITE8_MEMBER(kbd_put); - MC6845_UPDATE_ROW(crtc_update_row); - const UINT8 *m_p_chargen; - bool m_speaker_bit; - UINT8 m_video_control; - UINT8 m_term_data; - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; - required_device m_crtc; - required_device m_speaker; - required_shared_ptr m_ram; - required_device m_palette; -}; - -READ16_MEMBER( dim68k_state::dim68k_duart_r ) -// Port A is for the keyboard : 300 baud, no parity, 8 bits, 1 stop bit. Port B is for RS232. -// The device also controls the parallel printer (except the strobe) and the RTC. -// Device = SCN2681, not emulated. The keyboard is standard ASCII, so we can use the terminal -// keyboard for now. -{ - if (offset==3) - return m_term_data; - else - return 0; -} - -READ16_MEMBER( dim68k_state::dim68k_fdc_r ) -{ - return 0; -} - -READ16_MEMBER( dim68k_state::dim68k_game_switches_r ) -// Reading the game port switches -// FFCC11 = switch 0; FFCC13 = switch 1, etc to switch 3 -// FFCC19 = paddle 0; FFCC1B = paddle 1, etc to paddle 3 -{ - return 0xffff; -} - -READ16_MEMBER( dim68k_state::dim68k_speaker_r ) -// Any read or write of this address will toggle the position of the speaker cone -{ - m_speaker_bit ^= 1; - m_speaker->level_w(m_speaker_bit); - return 0; -} - -WRITE16_MEMBER( dim68k_state::dim68k_speaker_w ) -{ - m_speaker_bit ^= 1; - m_speaker->level_w(m_speaker_bit); -} - -WRITE16_MEMBER( dim68k_state::dim68k_fdc_w ) -{ -} - -WRITE16_MEMBER( dim68k_state::dim68k_video_high_w ) -// "write high byte of address in memory of start of display buffer" -{ -} - -WRITE16_MEMBER( dim68k_state::dim68k_video_control_w ) -{ -/* D7 0 = Hires/Graphics; 1= Lores/Text [not emulated yet] - D6 0 = 8 dots per character; 1 = 7 dots [emulated] - D5 0 = CRTC and CPU run Asynchronously; 1 = Synchronously [won't be emulated] - D4,D3 Dot clock: 00=14MHz; 01=3.58MHz; 10=7MHz; 11=1.79MHz [emulated] - D2 0 = Screen On; 1 = Off [emulated] - D1 0 = Standard Chars & LoRes; 1 = Alternate Chars & HiRes [not emulated yet] - D0 0 = Non-Mixed (all text or all Graphics); 1 = Mixed (Colour Graphics and Monochrome Text) [not emulated yet] - */ - m_crtc->set_hpixels_per_column((data & 0x40) ? 7 : 8); - m_video_control = data; - - switch (data & 0x18) - { - case 0x00: m_crtc->set_clock(XTAL_14MHz); - break; - case 0x08: m_crtc->set_clock(XTAL_3_579545MHz); - break; - case 0x10: m_crtc->set_clock(XTAL_14MHz / 2); - break; - case 0x18: m_crtc->set_clock(XTAL_3_579545MHz / 2); - break; - } -} - -WRITE16_MEMBER( dim68k_state::dim68k_video_reset_w ) -{ -} - -WRITE16_MEMBER( dim68k_state::dim68k_duart_w ) -{ -} - -WRITE16_MEMBER( dim68k_state::dim68k_reset_timers_w ) -// reset game port timer before reading paddles -{ -} - -WRITE16_MEMBER( dim68k_state::dim68k_printer_strobe_w ) -// anything sent here will trigger a one-shot for a strobe pulse -{ -} - -WRITE16_MEMBER( dim68k_state::dim68k_banksw_w ) -// At boot time, the rom and IO occupy 0-FFFF, this moves it to the proper place -{ -} - -static ADDRESS_MAP_START(dim68k_mem, AS_PROGRAM, 16, dim68k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x00feffff) AM_RAM AM_SHARE("ram") // 16MB RAM / ROM at boot - AM_RANGE(0x00ff0000, 0x00ff1fff) AM_ROM AM_REGION("bootrom", 0) - AM_RANGE(0x00ff2000, 0x00ff7fff) AM_RAM // Graphics Video RAM - AM_RANGE(0x00ff8000, 0x00ff8001) AM_DEVREADWRITE8("crtc", mc6845_device, status_r, address_w, 0xff) - AM_RANGE(0x00ff8002, 0x00ff8003) AM_DEVREADWRITE8("crtc", mc6845_device, register_r, register_w, 0xff) - AM_RANGE(0x00ff8004, 0x00ff8005) AM_WRITE(dim68k_video_high_w) - AM_RANGE(0x00ff8008, 0x00ff8009) AM_WRITE(dim68k_video_control_w) - AM_RANGE(0x00ff800a, 0x00ff800b) AM_WRITE(dim68k_video_reset_w) - AM_RANGE(0x00ff8800, 0x00ff8fff) AM_ROM AM_REGION("cop6512",0) // slot 1 controller rom - AM_RANGE(0x00ff9000, 0x00ff97ff) AM_ROM AM_REGION("copz80",0) // slot 2 controller rom - AM_RANGE(0x00ff9800, 0x00ff9fff) AM_ROM AM_REGION("cop8086",0) // slot 3 controller rom -#if 0 - AM_RANGE(0x00ffa000, 0x00ffa7ff) AM_ROM // slot 4 controller rom - AM_RANGE(0x00ffa800, 0x00ffafff) AM_ROM // slot 5 controller rom - AM_RANGE(0x00ffb000, 0x00ffb7ff) AM_ROM // slot 6 controller rom -#endif - AM_RANGE(0x00ffc400, 0x00ffc41f) AM_READWRITE(dim68k_duart_r,dim68k_duart_w) // Signetics SCN2681AC1N40 Dual UART - AM_RANGE(0x00ffc800, 0x00ffc801) AM_READWRITE(dim68k_speaker_r,dim68k_speaker_w) - AM_RANGE(0x00ffcc00, 0x00ffcc1f) AM_READWRITE(dim68k_game_switches_r,dim68k_reset_timers_w) - AM_RANGE(0x00ffd000, 0x00ffd003) AM_DEVICE8("fdc",upd765a_device,map,0x00ff) // NEC uPD765A - AM_RANGE(0x00ffd004, 0x00ffd005) AM_READWRITE(dim68k_fdc_r,dim68k_fdc_w) - //AM_RANGE(0x00ffd400, 0x00ffd403) emulation trap control - AM_RANGE(0x00ffd800, 0x00ffd801) AM_WRITE(dim68k_printer_strobe_w) - AM_RANGE(0x00ffdc00, 0x00ffdc01) AM_WRITE(dim68k_banksw_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( dim68k ) -INPUT_PORTS_END - - -void dim68k_state::machine_reset() -{ - UINT8* ROM = memregion("bootrom")->base(); - - memcpy((UINT8*)m_ram.target(), ROM, 0x2000); - - m_maincpu->reset(); -} - -void dim68k_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -// Text-only; graphics isn't emulated yet. Need to find out if hardware cursor is used. -MC6845_UPDATE_ROW( dim68k_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,x,xx,inv; - UINT16 chr16=0x2020; // set to spaces if screen is off - UINT32 *p = &bitmap.pix32(y); - UINT8 screen_on = ~m_video_control & 4; - UINT8 dot8 = ~m_video_control & 40; - - // need to divide everything in half to cater for 16-bit reads - x_count /= 2; - ma /= 2; - xx = 0; - - for (x = 0; x < x_count; x++) - { - if (screen_on) - chr16 = m_ram[ma+x]; // reads 2 characters - - inv=0; - if (xx == cursor_x && screen_on) inv=0xff; - xx++; - - chr = chr16>>8; - gfx = m_p_chargen[(chr<<4) | ra] ^ inv ^ ((chr & 0x80) ? 0xff : 0); - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - if (dot8) *p++ = palette[BIT(gfx, 1)]; - - inv = 0; - if (xx == cursor_x) inv=0xff; - xx++; - - chr = chr16; - gfx = m_p_chargen[(chr<<4) | ra] ^ inv ^ ((chr & 0x80) ? 0xff : 0); - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - if (dot8) *p++ = palette[BIT(gfx, 1)]; - } -} - -/* F4 Character Displayer */ -static const gfx_layout dim68k_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( dim68k ) - GFXDECODE_ENTRY( "chargen", 0x0000, dim68k_charlayout, 0, 1 ) -GFXDECODE_END - -static SLOT_INTERFACE_START( dim68k_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -WRITE8_MEMBER( dim68k_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( dim68k, dim68k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(dim68k_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 250-1) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", dim68k) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_UPD765A_ADD("fdc", true, true) // these options unknown - MCFG_FLOPPY_DRIVE_ADD("fdc:0", dim68k_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", dim68k_floppies, "525hd", floppy_image_device::default_floppy_formats) - - MCFG_MC6845_ADD("crtc", MC6845, "screen", 1790000) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(dim68k_state, crtc_update_row) - - MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(dim68k_state, kbd_put)) -MACHINE_CONFIG_END - -/* -68000 - -MC101A 82S100 -MC102B 82S100 -MC103E 2732A -MC104 2732A label "4050" underneath -MC105 2732A char gen - -6512 - -MC106 82LS135 U24 -MC107 82LS135 U20 -MC108 82S137 U23 -MC109 82S131 U16 -MC110 82LS135 U35 - -Z80 - -MC111 82S123 U11 - -8086 - -MC112 82LS135 U18 -MC113 82S153 U16 -*/ -/* ROM definition */ -ROM_START( dim68k ) - ROM_REGION( 0x2000, "bootrom", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "mc103e.bin", 0x0000, 0x1000, CRC(4730c902) SHA1(5c4bb79ad22def721a22eb63dd05e0391c8082be)) - ROM_LOAD16_BYTE( "mc104.bin", 0x0001, 0x1000, CRC(14b04575) SHA1(43e15d9ebe1c9c1bf1bcfc1be3899a49e6748200)) - - ROM_REGION( 0x1000, "chargen", ROMREGION_ERASEFF ) - ROM_LOAD( "mc105e.bin", 0x0000, 0x1000, CRC(7a09daa8) SHA1(844bfa579293d7c3442fcbfa21bda75fff930394)) - - // The remaining roms may not be in the correct positions or being loaded correctly - ROM_REGION( 0x1000, "cop6512", ROMREGION_ERASEFF ) - ROM_LOAD16_WORD_SWAP( "mc106.bin", 0x0000, 0x0100, CRC(11530d8a) SHA1(e3eae266535383bcaee2d84d7bed6052d40e4e4a)) - ROM_LOAD16_WORD_SWAP( "mc107.bin", 0x0100, 0x0100, CRC(966db11b) SHA1(3c3105ac842602d8e01b0f924152fd672a85f00c)) - ROM_LOAD16_WORD_SWAP( "mc108.bin", 0x0200, 0x0400, CRC(687f9b0a) SHA1(ed9f1265b25f89f6d3cf8cd0a7b0fb73cb129f9f)) - ROM_LOAD16_WORD_SWAP( "mc109.bin", 0x0600, 0x0200, CRC(4a857f98) SHA1(9f2bbc2171fc49f65aa798c9cd7799a26afd2ddf)) - ROM_LOAD16_WORD_SWAP( "mc110.bin", 0x0800, 0x0100, CRC(e207b457) SHA1(a8987ba3d1bbdb3d8b3b11cec90c532ff09e762e)) - - ROM_REGION( 0x1000, "copz80", ROMREGION_ERASEFF ) - ROM_LOAD16_WORD_SWAP( "mc111.bin", 0x0000, 0x0020, CRC(6a380057) SHA1(6522a7b3e0af9db14a6ed04d4eec3ee6e44c2dab)) - - ROM_REGION( 0x1000, "cop8086", ROMREGION_ERASEFF ) - ROM_LOAD16_WORD_SWAP( "mc112.bin", 0x0000, 0x0100, CRC(dfd4cdbb) SHA1(a7831d415943fa86c417066807038bccbabb2573)) - ROM_LOAD( "mc113.bin", 0x0100, 0x00ef, CRC(594bdf05) SHA1(36db911a27d930e023fa12683e86e9eecfffdba6)) - - ROM_REGION( 0x1000, "mb", ROMREGION_ERASEFF ) // mainboard unknown - ROM_LOAD( "mc102.bin", 0x0000, 0x00fa, CRC(38e2abac) SHA1(0d7e730b46fc162764c69c51dea3bbe8337b1a7d)) - ROM_LOAD( "mc101.bin", 0x0100, 0x00fa, CRC(caffb3a0) SHA1(36f5140b306565794c4d856e0c20589b8f2a37f4)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, dim68k, 0, 0, dim68k, dim68k, driver_device, 0, "Micro Craft", "Dimension 68000", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/dm7000.c b/src/mess/drivers/dm7000.c deleted file mode 100644 index cb808fb98fa..00000000000 --- a/src/mess/drivers/dm7000.c +++ /dev/null @@ -1,352 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Lukasz Markowski -/*************************************************************************** - - Dream Multimedia Dreambox 7000/5620/500 - - 20/03/2010 Skeleton driver. - - - DM7000 - CPU STB04500 at 252 MHz - RAM 64MB - Flash 8MB - 1 x DVB-S - 1 x IDE interface - 1 x Common Interface (CI) - 1 x Compact flash - 2 x Smart card reader - 1 x USB - 1 x RS232 - 1 x LAN 100Mbit/s - 1 x LCD display - - DM56x0 - CPU STB04500 at 252 MHz - RAM 64MB - Flash 8MB - 1 x DVB-S - 2 x Common Interface (CI) - 1 x Smart card reader - 1 x LAN 100Mbit/s (just on 5620) - 1 x LCD display - - DM500 - CPU STBx25xx at 252 MHz - RAM 96MB - Flash 32MB - 1 x DVB-S - 1 x Smart card reader - 1 x LAN 100Mbit/s - -****************************************************************************/ - -#include "emu.h" -#include "includes/dm7000.h" - -#define VERBOSE_LEVEL ( 9 ) - -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...) -{ - if (VERBOSE_LEVEL >= n_level) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt); - vsprintf( buf, s_fmt, v); - va_end( v); - logerror( "%s: %s", machine.describe_context( ), buf); - } -} - -READ8_MEMBER( dm7000_state::dm7000_iic0_r ) -{ - UINT8 data = 0; // dummy - verboselog( machine(), 9, "(IIC0) %08X -> %08X\n", 0x40030000 + offset, data); - return data; -} - -WRITE8_MEMBER( dm7000_state::dm7000_iic0_w ) -{ - verboselog( machine(), 9, "(IIC0) %08X <- %08X\n", 0x40030000 + offset, data); -} - -READ8_MEMBER( dm7000_state::dm7000_iic1_r ) -{ - UINT8 data = 0; // dummy - verboselog( machine(), 9, "(IIC1) %08X -> %08X\n", 0x400b0000 + offset, data); - return data; -} - -WRITE8_MEMBER( dm7000_state::dm7000_iic1_w ) -{ - verboselog( machine(), 9, "(IIC1) %08X <- %08X\n", 0x400b0000 + offset, data); -} - -READ8_MEMBER( dm7000_state::dm7000_scc0_r ) -{ - UINT8 data = 0; - switch(offset) { - case UART_THR: - data = m_term_data; - if(m_term_data == 0xd) { - m_term_data = 0xa; - } else { - m_term_data = 0; - m_scc0_lsr = 0; - } - break; - case UART_LSR: - data = UART_LSR_THRE | UART_LSR_TEMT | m_scc0_lsr; - break; - } - verboselog( machine(), 9, "(SCC0) %08X -> %08X\n", 0x40040000 + offset, data); - return data; -} - -WRITE8_MEMBER( dm7000_state::dm7000_scc0_w ) -{ - switch(offset) { - case UART_THR: - if(!(m_scc0_lcr & UART_LCR_DLAB)) { - m_terminal->write(space, 0, data); - m_scc0_lsr = 1; - } - break; - case UART_LCR: - m_scc0_lcr = data; - break; - } - verboselog( machine(), 9, "(SCC0) %08X <- %08X\n", 0x40040000 + offset, data); -} - -READ8_MEMBER( dm7000_state::dm7000_gpio0_r ) -{ - UINT8 data = 0; // dummy - verboselog( machine(), 9, "(GPIO0) %08X -> %08X\n", 0x40060000 + offset, data); - return data; -} - -WRITE8_MEMBER( dm7000_state::dm7000_gpio0_w ) -{ - verboselog( machine(), 9, "(GPIO0) %08X <- %08X\n", 0x40060000 + offset, data); -} - -READ8_MEMBER( dm7000_state::dm7000_scp0_r ) -{ - UINT8 data = 0; // dummy - switch(offset) { - case SCP_STATUS: - data = SCP_STATUS_RXRDY; - break; - } - verboselog( machine(), 9, "(SCP0) %08X -> %08X\n", 0x400c0000 + offset, data); - return data; -} - -WRITE8_MEMBER( dm7000_state::dm7000_scp0_w ) -{ - verboselog( machine(), 9, "(SCP0) %08X <- %08X\n", 0x400c0000 + offset, data); - switch(offset) { - case SCP_TXDATA: - //printf("%02X ", data); - break; - } -} - -READ16_MEMBER( dm7000_state::dm7000_enet_r ) -{ - UINT16 data; - switch (offset) { - case 0x01: - data = 0x1801; - break; - case 0x05: - data = 0x3330; - break; - case 0x07: - data = 0x3300; - break; - default: - data = m_enet_regs[offset]; - break; - } - verboselog( machine(), 9, "(ENET) %08X -> %08X\n", 0x72000600 + (offset), data); - return data; -} - -WRITE16_MEMBER( dm7000_state::dm7000_enet_w ) -{ - verboselog( machine(), 9, "(ENET) %08X <- %08X\n", 0x72000600 + (offset), data); - COMBINE_DATA(&m_enet_regs[offset]); -} - -/* - Memory map for the IBM "Redwood-4" STB03xxx evaluation board. - - The STB03xxx internal i/o addresses don't work for us 1:1, - so we need to map them at a well know virtual address. - - 4000 000x uart1 - 4001 00xx ppu - 4002 00xx smart card - 4003 000x iic - 4004 000x uart0 - 4005 0xxx timer - 4006 00xx gpio - 4007 00xx smart card - 400b 000x iic - 400c 000x scp - 400d 000x modem - - STBx25xx - - 4000 000x Serial1 Controller - 4001 000x Serial2 Controller - 4002 00xx Smart Card Interface 0 - 4003 000x IIC Interface 0 - 4004 000x Serial0 Controller - 4005 0xxx General Purpose Timers - 4006 00xx General Purpose Input / Output - 4007 00xx Smart Card Interface 1 - 400c 000x Serial Controller Port - 400d 00xx Synchronous Serial Port - - STB04xxx - - 4000 00xx Serial1/Infrared Controller - 4001 00xx Universal Serial Bus - 4002 00xx Smart Card Interface 0 - 4003 000x IIC Interface 0 - 4004 000x Serial0/Uart750 Controller - 4005 0xxx General Purpose Timers - 4006 00xx General Purpose Input / Output - 4007 00xx Smart Card Interface 1 - 400b 000x IIC Interface 1 - 400c 000x Serial Controller Port - 400d 00xx Synchronous Serial Port - 400e 000x Serial2/UART750 Controller - 400f 0xxx IDE Controller - -*/ -static ADDRESS_MAP_START( dm7000_mem, AS_PROGRAM, 32, dm7000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x01ffffff) AM_RAM // RAM page 0 - 32MB - AM_RANGE(0x20000000, 0x21ffffff) AM_RAM // RAM page 1 - 32MB - - AM_RANGE(0x40030000, 0x4003000f) AM_READWRITE8(dm7000_iic0_r, dm7000_iic0_w, 0xffffffff) - AM_RANGE(0x40040000, 0x40040007) AM_READWRITE8(dm7000_scc0_r, dm7000_scc0_w, 0xffffffff) - AM_RANGE(0x40060000, 0x40060047) AM_READWRITE8(dm7000_gpio0_r, dm7000_gpio0_w, 0xffffffff) - AM_RANGE(0x400b0000, 0x400b000f) AM_READWRITE8(dm7000_iic1_r, dm7000_iic1_w, 0xffffffff) - AM_RANGE(0x400c0000, 0x400c0007) AM_READWRITE8(dm7000_scp0_r, dm7000_scp0_w, 0xffffffff) - - /* ENET - ASIX AX88796 */ - AM_RANGE(0x72000300, 0x720003ff) AM_READWRITE16(dm7000_enet_r, dm7000_enet_w, 0xffffffff) - - AM_RANGE(0x7f800000, 0x7ffdffff) AM_ROM AM_REGION("user2",0) - AM_RANGE(0x7ffe0000, 0x7fffffff) AM_ROM AM_REGION("user1",0) - //AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( dm7000 ) -INPUT_PORTS_END - - -void dm7000_state::machine_reset() -{ - dcr[DCRSTB045_CICVCR] = 0x00000001; - dcr[DCRSTB045_SCCR] = 0x00420080 /* default for serial divs */ | 0x3f /* undocumented?? used to print clocks */; - dcr[DCRSTB045_VIDEO_CNTL] = 0x00009000; - dcr[DCRSTB045_DISP_MODE] = 0x00880000; - dcr[DCRSTB045_FRAME_BUFR_BASE] = 0x0f000000; - m_scc0_lsr = UART_LSR_THRE | UART_LSR_TEMT; - - m_maincpu->ppc4xx_set_dcr_read_handler(read32_delegate(FUNC(dm7000_state::dcr_r),this)); - m_maincpu->ppc4xx_set_dcr_write_handler(write32_delegate(FUNC(dm7000_state::dcr_w),this)); -} - -void dm7000_state::video_start() -{ -} - -UINT32 dm7000_state::screen_update_dm7000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -READ32_MEMBER( dm7000_state::dcr_r ) -{ - osd_printf_debug("DCR %03X read\n", offset); - if(offset>=1024) {printf("get %04X\n", offset); return 0;} else - switch(offset) { - case DCRSTB045_CMD_STAT: - return 0; // assume that video dev is always ready - default: - return dcr[offset]; - } - -} - -WRITE32_MEMBER( dm7000_state::dcr_w ) -{ - osd_printf_debug("DCR %03X write = %08X\n", offset, data); - if(offset>=1024) {printf("get %04X\n", offset); } else - dcr[offset] = data; -} - -WRITE8_MEMBER( dm7000_state::kbd_put ) -{ - //printf("%02X\n", data); - m_term_data = data; - m_scc0_lsr = 1; -} - -static MACHINE_CONFIG_START( dm7000, dm7000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",PPC405GP, 252000000 / 10) // Should be PPC405D4? - // Slowed down 10 times in order to get normal response for now - MCFG_PPC_BUS_FREQUENCY(252000000) - MCFG_CPU_PROGRAM_MAP(dm7000_mem) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(dm7000_state, screen_update_dm7000) - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dm7000_state, kbd_put)) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( dm7000 ) - ROM_REGION( 0x20000, "user1", ROMREGION_32BIT | ROMREGION_BE ) - ROMX_LOAD( "dm7000.bin", 0x0000, 0x20000, CRC(8a410f67) SHA1(9d6c9e4f5b05b28453d3558e69a207f05c766f54), ROM_GROUPWORD ) - ROM_REGION( 0x800000, "user2", ROMREGION_32BIT | ROMREGION_BE | ROMREGION_ERASEFF ) - ROM_LOAD( "rel108_dm7000.img", 0x0000, 0x5e0000, CRC(e78b6407) SHA1(aaa786d341c629eec92fcf04bfafc1de43f6dabf)) -ROM_END - -ROM_START( dm5620 ) - ROM_REGION( 0x20000, "user1", ROMREGION_32BIT | ROMREGION_BE ) - ROMX_LOAD( "dm5620.bin", 0x0000, 0x20000, CRC(ccddb822) SHA1(3ecf553ced0671599438368f59d8d30df4d13ade), ROM_GROUPWORD ) - ROM_REGION( 0x800000, "user2", ROMREGION_32BIT | ROMREGION_BE | ROMREGION_ERASEFF ) - ROM_LOAD( "rel106_dm5620.img", 0x0000, 0x57b000, CRC(2313d71d) SHA1(0d3d99ab3b3266624f237b7b67e045d7910c44a5)) -ROM_END - -ROM_START( dm500 ) - ROM_REGION( 0x20000, "user1", ROMREGION_32BIT | ROMREGION_BE ) - ROM_SYSTEM_BIOS( 0, "alps", "Alps" ) - ROMX_LOAD( "dm500-alps-boot.bin", 0x0000, 0x20000, CRC(daf2da34) SHA1(68f3734b4589fcb3e73372e258040bc8b83fd739), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "phil", "Philips" ) - ROMX_LOAD( "dm500-philps-boot.bin", 0x0000, 0x20000, CRC(af3477c7) SHA1(9ac918f6984e6927f55bea68d6daaf008787136e), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(2)) - ROM_REGION( 0x800000, "user2", ROMREGION_32BIT | ROMREGION_BE | ROMREGION_ERASEFF ) - ROM_LOAD( "rel108_dm500.img", 0x0000, 0x5aa000, CRC(44be2376) SHA1(1f360572998b1bc4dc10c5210a2aed573a75e2fa)) -ROM_END -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -SYST( 2003, dm7000, 0, 0, dm7000, dm7000, driver_device, 0, "Dream Multimedia", "Dreambox 7000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -SYST( 2004, dm5620, dm7000, 0, dm7000, dm7000, driver_device, 0, "Dream Multimedia", "Dreambox 5620", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -SYST( 2006, dm500, dm7000, 0, dm7000, dm7000, driver_device, 0, "Dream Multimedia", "Dreambox 500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/dms5000.c b/src/mess/drivers/dms5000.c deleted file mode 100644 index cb10bffa23d..00000000000 --- a/src/mess/drivers/dms5000.c +++ /dev/null @@ -1,86 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Digital Microsystems DMS-5000 - - 11/01/2010 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" - - -class dms5000_state : public driver_device -{ -public: - dms5000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_dms5000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START( dms5000_mem, AS_PROGRAM, 16, dms5000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x1ffff) AM_RAM - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dms5000_io, AS_IO, 16, dms5000_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( dms5000 ) -INPUT_PORTS_END - - -void dms5000_state::machine_reset() -{ -} - -void dms5000_state::video_start() -{ -} - -UINT32 dms5000_state::screen_update_dms5000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( dms5000, dms5000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8086, XTAL_9_8304MHz) - MCFG_CPU_PROGRAM_MAP(dms5000_mem) - MCFG_CPU_IO_MAP(dms5000_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(dms5000_state, screen_update_dms5000) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( dms5000 ) - ROM_REGION( 0x4000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "dms-5000_54-8673o.bin", 0x0001, 0x2000, CRC(dce9823e) SHA1(d36ab87d2e6f5e9f02d59a6a7724ad3ce2428a2f)) - ROM_LOAD16_BYTE( "dms-5000_54-8672e.bin", 0x0000, 0x2000, CRC(94d64c06) SHA1(be5a53da7bb29a5fa9ac31efe550d5d6ff8b77cd)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, dms5000, 0, 0, dms5000, dms5000, driver_device, 0, "Digital Microsystems", "DMS-5000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/dms86.c b/src/mess/drivers/dms86.c deleted file mode 100644 index c1927ec631f..00000000000 --- a/src/mess/drivers/dms86.c +++ /dev/null @@ -1,131 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Digital Microsystems DMS-86 - - 11/01/2010 Skeleton driver. - -Monitor commands: -A -B boot to HiNet -D dump memory to screen -I in port -L memory test -O out port (e.g. O 84 77) -P -S write a byte to memory -T -X display registers - - -Note that bit 3 of port 82 is tested at boot. If low, the computer bypasses -the monitor and goes straight to "Joining HiNet". - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class dms86_state : public driver_device -{ -public: - dms86_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ16_MEMBER( dms86_82_r ); - DECLARE_READ16_MEMBER( dms86_84_r ); - DECLARE_READ16_MEMBER( dms86_86_r ); - DECLARE_READ16_MEMBER( dms86_9a_r ); - DECLARE_WRITE8_MEMBER( kbd_put ); - UINT8 *m_ram; - UINT8 m_term_data; - virtual void machine_reset(); -}; - -READ16_MEMBER( dms86_state::dms86_82_r ) -{ -// HiNet / Monitor switch - - return 0xff; -} - -READ16_MEMBER( dms86_state::dms86_84_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ16_MEMBER( dms86_state::dms86_86_r ) -{ - return 4 | (m_term_data ? 1 : 0); -} - -READ16_MEMBER( dms86_state::dms86_9a_r ) -{ - return 0; -} - - -static ADDRESS_MAP_START(dms86_mem, AS_PROGRAM, 16, dms86_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x1ffff) AM_RAM - AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(dms86_io, AS_IO, 16, dms86_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x82, 0x83) AM_READ(dms86_82_r) - AM_RANGE(0x84, 0x85) AM_READ(dms86_84_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff) - AM_RANGE(0x86, 0x87) AM_READ(dms86_86_r) - AM_RANGE(0x9A, 0x9B) AM_READ(dms86_9a_r) - AM_RANGE(0x9c, 0x9d) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( dms86 ) -INPUT_PORTS_END - - -void dms86_state::machine_reset() -{ -} - -WRITE8_MEMBER( dms86_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( dms86, dms86_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8086, XTAL_9_8304MHz) - MCFG_CPU_PROGRAM_MAP(dms86_mem) - MCFG_CPU_IO_MAP(dms86_io) - - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dms86_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( dms86 ) - ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "hns-86_54-8678.bin", 0x0000, 0x1000, CRC(95f58e1c) SHA1(6fc8f087f0c887d8b429612cd035c6c1faab570c)) - ROM_LOAD16_BYTE( "hns-86_54-8677.bin", 0x0001, 0x1000, CRC(78fad756) SHA1(ddcbff1569ec6975b8489935cdcfa80eba413502)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, dms86, 0, 0, dms86, dms86, driver_device, 0, "Digital Microsystems", "DMS-86", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/dmv.c b/src/mess/drivers/dmv.c deleted file mode 100644 index 6db67eb8e9e..00000000000 --- a/src/mess/drivers/dmv.c +++ /dev/null @@ -1,850 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - NCR Decision Mate V - - 04/01/2012 Skeleton driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/upd765.h" -#include "machine/am9517a.h" -#include "machine/pit8253.h" -#include "machine/dmv_keyb.h" -#include "sound/speaker.h" -#include "video/upd7220.h" -#include "formats/dmv_dsk.h" - -// expansion slots -#include "bus/dmv/dmvbus.h" -#include "bus/dmv/k210.h" -#include "bus/dmv/k220.h" -#include "bus/dmv/k230.h" -#include "bus/dmv/k233.h" -#include "bus/dmv/k801.h" -#include "bus/dmv/k803.h" -#include "bus/dmv/k806.h" -#include "bus/dmv/ram.h" - - -#include "dmv.lh" - -class dmv_state : public driver_device -{ -public: - dmv_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_hgdc(*this, "upd7220"), - m_dmac(*this, "dma8237"), - m_pit(*this, "pit8253"), - m_fdc(*this, "i8272"), - m_floppy0(*this, "i8272:0"), - m_floppy1(*this, "i8272:1"), - m_keyboard(*this, "keyboard"), - m_speaker(*this, "speaker"), - m_video_ram(*this, "video_ram"), - m_palette(*this, "palette"), - m_ram(*this, "ram"), - m_bootrom(*this, "boot"), - m_chargen(*this, "chargen"), - m_slot1(*this, "slot1"), - m_slot2(*this, "slot2"), - m_slot2a(*this, "slot2a"), - m_slot3(*this, "slot3"), - m_slot4(*this, "slot4"), - m_slot5(*this, "slot5"), - m_slot6(*this, "slot6"), - m_slot7(*this, "slot7"), - m_slot7a(*this, "slot7a") - { } - - required_device m_maincpu; - required_device m_hgdc; - required_device m_dmac; - required_device m_pit; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_keyboard; - required_device m_speaker; - required_shared_ptr m_video_ram; - required_device m_palette; - required_memory_region m_ram; - required_memory_region m_bootrom; - required_memory_region m_chargen; - - required_device m_slot1; - required_device m_slot2; - required_device m_slot2a; - required_device m_slot3; - required_device m_slot4; - required_device m_slot5; - required_device m_slot6; - required_device m_slot7; - required_device m_slot7a; - - virtual void machine_start(); - virtual void machine_reset(); - void update_halt_line(); - - DECLARE_WRITE8_MEMBER(leds_w); - DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); - DECLARE_WRITE_LINE_MEMBER(dmac_eop); - DECLARE_WRITE_LINE_MEMBER(dmac_dack3); - DECLARE_WRITE_LINE_MEMBER(fdc_irq); - DECLARE_WRITE_LINE_MEMBER(pit_out0); - DECLARE_WRITE_LINE_MEMBER(timint_w); - DECLARE_WRITE8_MEMBER(fdd_motor_w); - DECLARE_READ8_MEMBER(sys_status_r); - DECLARE_WRITE8_MEMBER(tc_set_w); - DECLARE_WRITE8_MEMBER(switch16_w); - DECLARE_READ8_MEMBER(ramsel_r); - DECLARE_READ8_MEMBER(romsel_r); - DECLARE_WRITE8_MEMBER(ramsel_w); - DECLARE_WRITE8_MEMBER(romsel_w); - DECLARE_READ8_MEMBER(kb_mcu_port1_r); - DECLARE_WRITE8_MEMBER(kb_mcu_port1_w); - DECLARE_WRITE8_MEMBER(kb_mcu_port2_w); - DECLARE_WRITE8_MEMBER(rambank_w); - DECLARE_READ8_MEMBER(program_r); - DECLARE_WRITE8_MEMBER(program_w); - DECLARE_READ8_MEMBER(exp_program_r); - DECLARE_WRITE8_MEMBER(exp_program_w); - DECLARE_WRITE_LINE_MEMBER(thold7_w); - - void update_busint(int slot, int state); - DECLARE_WRITE_LINE_MEMBER(busint2_w) { update_busint(0, state); } - DECLARE_WRITE_LINE_MEMBER(busint2a_w) { update_busint(1, state); } - DECLARE_WRITE_LINE_MEMBER(busint3_w) { update_busint(2, state); } - DECLARE_WRITE_LINE_MEMBER(busint4_w) { update_busint(3, state); } - DECLARE_WRITE_LINE_MEMBER(busint5_w) { update_busint(4, state); } - DECLARE_WRITE_LINE_MEMBER(busint6_w) { update_busint(5, state); } - DECLARE_WRITE_LINE_MEMBER(busint7_w) { update_busint(6, state); } - DECLARE_WRITE_LINE_MEMBER(busint7a_w) { update_busint(7, state); } - - void update_irqs(int slot, int state); - DECLARE_WRITE_LINE_MEMBER(irq2_w) { update_irqs(0, state); } - DECLARE_WRITE_LINE_MEMBER(irq2a_w) { update_irqs(1, state); } - DECLARE_WRITE_LINE_MEMBER(irq3_w) { update_irqs(2, state); } - DECLARE_WRITE_LINE_MEMBER(irq4_w) { update_irqs(3, state); } - DECLARE_WRITE_LINE_MEMBER(irq5_w) { update_irqs(4, state); } - DECLARE_WRITE_LINE_MEMBER(irq6_w) { update_irqs(5, state); } - DECLARE_WRITE_LINE_MEMBER(irq7_w) { update_irqs(6, state); } - DECLARE_WRITE_LINE_MEMBER(irq7a_w) { update_irqs(7, state); } - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - UINT8 program_read(address_space &space, int cas, offs_t offset); - void program_write(address_space &space, int cas, offs_t offset, UINT8 data); - - void ifsel_r(address_space &space, int ifsel, offs_t offset, UINT8 &data); - void ifsel_w(address_space &space, int ifsel, offs_t offset, UINT8 data); - DECLARE_READ8_MEMBER(ifsel0_r) { UINT8 data = 0xff; ifsel_r(space, 0, offset, data); return data; } - DECLARE_READ8_MEMBER(ifsel1_r) { UINT8 data = 0xff; ifsel_r(space, 1, offset, data); return data; } - DECLARE_READ8_MEMBER(ifsel2_r) { UINT8 data = 0xff; ifsel_r(space, 2, offset, data); return data; } - DECLARE_READ8_MEMBER(ifsel3_r) { UINT8 data = 0xff; ifsel_r(space, 3, offset, data); return data; } - DECLARE_READ8_MEMBER(ifsel4_r) { UINT8 data = 0xff; ifsel_r(space, 4, offset, data); return data; } - DECLARE_WRITE8_MEMBER(ifsel0_w) { ifsel_w(space, 0, offset, data); } - DECLARE_WRITE8_MEMBER(ifsel1_w) { ifsel_w(space, 1, offset, data); } - DECLARE_WRITE8_MEMBER(ifsel2_w) { ifsel_w(space, 2, offset, data); } - DECLARE_WRITE8_MEMBER(ifsel3_w) { ifsel_w(space, 3, offset, data); } - DECLARE_WRITE8_MEMBER(ifsel4_w) { ifsel_w(space, 4, offset, data); } - - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); - UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); - - bool m_ramoutdis; - int m_switch16; - int m_thold7; - int m_dma_hrq; - int m_ram_bank; - bool m_color_mode; - int m_eop_line; - int m_dack3_line; - int m_sd_poll_state; - int m_floppy_motor; - int m_busint[8]; - int m_irqs[8]; -}; - -WRITE8_MEMBER(dmv_state::tc_set_w) -{ - m_fdc->tc_w(true); -} - -WRITE8_MEMBER(dmv_state::switch16_w) -{ - m_switch16 = !m_switch16; - update_halt_line(); -} - -WRITE8_MEMBER(dmv_state::leds_w) -{ - /* - LEDs Value Significance - --------------------------------------- - None 0xFF Check complete - 1+8 0x7E Sumcheck error - 2+8 0xBE GDC error - 3+8 0xDE Disk drive error - 4+8 0xEE 16-bit processor error - 5+8 0xF6 Keyboard error - 6+8 0xFA DMA error - 7+8 0xFC Memory error - All 0x00 Processor error - */ - - for(int i=0; i<8; i++) - output_set_led_value(8-i, BIT(data, i)); -} - -READ8_MEMBER(dmv_state::ramsel_r) -{ - m_ramoutdis = false; - return 0; -} - -READ8_MEMBER(dmv_state::romsel_r) -{ - m_ramoutdis = true; - return 0; -} - -WRITE8_MEMBER(dmv_state::ramsel_w) -{ - m_ramoutdis = false; -} - -WRITE8_MEMBER(dmv_state::romsel_w) -{ - m_ramoutdis = true; -} - -WRITE8_MEMBER(dmv_state::rambank_w) -{ - m_ram_bank = offset; -} - -WRITE8_MEMBER(dmv_state::fdd_motor_w) -{ - m_pit->write_gate0(1); - m_pit->write_gate0(0); - - m_floppy_motor = 0; - m_floppy0->get_device()->mon_w(m_floppy_motor); - m_floppy1->get_device()->mon_w(m_floppy_motor); -} - -READ8_MEMBER(dmv_state::sys_status_r) -{ - /* - Main system status - x--- ---- FDD index - -x--- --- IRQ 2 - --x--- -- IRQ 3 - ---x--- - IRQ 4 - ---- x--- FDC interrupt - ---- -x-- FDD ready - ---- --x- 16-bit CPU available (active low) - ---- ---x FDD motor (active low) - */ - UINT8 data = 0x00; - - if (m_floppy_motor) - data |= 0x01; - - // 16-bit CPU - if (!(m_slot7->av16bit() || m_slot7a->av16bit())) - data |= 0x02; - - if (!m_floppy0->get_device()->ready_r()) - data |= 0x04; - - if (m_fdc->get_irq()) - data |= 0x08; - - if (m_irqs[3]) - data |= 0x10; // IRQ 4 - - if (m_irqs[2]) - data |= 0x20; // IRQ 3 - - if (m_irqs[0]) - data |= 0x40; // IRQ 2 - - return data; -} - -UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels ) -{ - if (m_color_mode) - { - // 96KB videoram (32KB green + 32KB red + 32KB blue) - UINT16 green = m_video_ram[(0x00000 + (address & 0x7fff)) >> 1]; - UINT16 red = m_video_ram[(0x08000 + (address & 0x7fff)) >> 1]; - UINT16 blue = m_video_ram[(0x10000 + (address & 0x7fff)) >> 1]; - - for(int xi=0; xi<16; xi++) - { - int r = ((red >> xi) & 1) ? 255 : 0; - int g = ((green >> xi) & 1) ? 255 : 0; - int b = ((blue >> xi) & 1) ? 255 : 0; - - if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = rgb_t(r, g, b); - } - } - else - { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - // 32KB videoram - UINT16 gfx = m_video_ram[(address & 0xffff) >> 1]; - - for(int xi=0;xi<16;xi++) - { - if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = ((gfx >> xi) & 1) ? palette[1] : palette[0]; - } - } -} - -UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text ) -{ - for( int x = 0; x < pitch; x++ ) - { - UINT8 tile = m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] & 0xff; - UINT8 attr = m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] >> 8; - - rgb_t bg, fg; - if (m_color_mode) - { - bg = rgb_t(attr & 0x20 ? 0 : 255, attr & 0x40 ? 0 : 255, attr & 0x80 ? 0 : 255); - fg = rgb_t(attr & 0x04 ? 255 : 0, attr & 0x08 ? 255 : 0, attr & 0x10 ? 255 : 0); - } - else - { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - bg = palette[(attr & 1) ? 1 : 0]; - fg = palette[(attr & 1) ? 0 : 1]; - } - - for( int yi = 0; yi < lr; yi++) - { - UINT8 tile_data = m_chargen->base()[(tile*16+yi) & 0x7ff]; - - if(cursor_on && cursor_addr == addr+x) //TODO - tile_data^=0xff; - - for( int xi = 0; xi < 8; xi++) - { - int res_x,res_y; - int pen = (tile_data >> xi) & 1 ? 1 : 0; - - res_x = x * 8 + xi; - res_y = y + yi; - - if(!machine().first_screen()->visible_area().contains(res_x, res_y)) - continue; - - if(yi >= 16) { pen = 0; } - - bitmap.pix32(res_y, res_x) = pen ? fg : bg; - } - } - } -} - -static SLOT_INTERFACE_START( dmv_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - - -void dmv_state::ifsel_r(address_space &space, int ifsel, offs_t offset, UINT8 &data) -{ - dmvcart_slot_device *slots[] = { m_slot2, m_slot2a, m_slot3, m_slot4, m_slot5, m_slot6, m_slot7, m_slot7a }; - for(int i=0; i<8; i++) - slots[i]->io_read(space, ifsel, offset, data); -} - -void dmv_state::ifsel_w(address_space &space, int ifsel, offs_t offset, UINT8 data) -{ - dmvcart_slot_device *slots[] = { m_slot2, m_slot2a, m_slot3, m_slot4, m_slot5, m_slot6, m_slot7, m_slot7a }; - for(int i=0; i<8; i++) - slots[i]->io_write(space, ifsel, offset, data); -} - -WRITE8_MEMBER(dmv_state::exp_program_w) -{ - program_write(space, (offset >> 16) & 0x07, offset, data); -} - -READ8_MEMBER(dmv_state::exp_program_r) -{ - return program_read(space, (offset >> 16) & 0x07, offset); -} - -WRITE8_MEMBER(dmv_state::program_w) -{ - program_write(space, m_ram_bank, offset, data); -} - -READ8_MEMBER(dmv_state::program_r) -{ - return program_read(space, m_ram_bank, offset); -} - -WRITE_LINE_MEMBER( dmv_state::thold7_w ) -{ - if (m_thold7 != state) - { - m_thold7 = state; - update_halt_line(); - } -} - -void dmv_state::update_busint(int slot, int state) -{ - m_busint[slot] = state; - - int new_state = CLEAR_LINE; - for (int i=0; i<8; i++) - if (m_busint[i] != CLEAR_LINE) - { - new_state = ASSERT_LINE; - break; - } - - m_slot7a->busint_w(new_state); - m_slot7->busint_w(new_state); - m_maincpu->set_input_line(0, new_state); -} - -void dmv_state::update_irqs(int slot, int state) -{ - m_irqs[slot] = state; - - switch(slot) - { - case 0: // slot 2 - m_slot7->irq2_w(state); - m_slot7a->irq2_w(state); - break; - case 1: // slot 2a - m_slot7->irq2a_w(state); - m_slot7a->irq2a_w(state); - break; - case 2: // slot 3 - m_slot7->irq3_w(state); - m_slot7a->irq3_w(state); - break; - case 3: // slot 4 - m_slot7->irq4_w(state); - m_slot7a->irq4_w(state); - break; - case 4: // slot 5 - m_slot7->irq5_w(state); - m_slot7a->irq5_w(state); - break; - case 5: // slot 6 - m_slot7->irq6_w(state); - m_slot7a->irq6_w(state); - break; - } -} - -void dmv_state::program_write(address_space &space, int cas, offs_t offset, UINT8 data) -{ - bool tramd = false; - dmvcart_slot_device *slots[] = { m_slot2, m_slot2a, m_slot3, m_slot4, m_slot5, m_slot6, m_slot7, m_slot7a }; - for(int i=0; i<8 && !tramd; i++) - tramd = slots[i]->write(offset, data); - - if (!tramd) - { - if (cas == 0) - m_ram->base()[offset & 0xffff] = data; - else - m_slot1->ram_write(cas, offset & 0xffff, data); - } -} - -UINT8 dmv_state::program_read(address_space &space, int cas, offs_t offset) -{ - UINT8 data = 0xff; - if (m_ramoutdis && offset < 0x2000) - { - data = m_bootrom->base()[offset]; - } - else - { - bool tramd = false; - dmvcart_slot_device *slots[] = { m_slot2, m_slot2a, m_slot3, m_slot4, m_slot5, m_slot6, m_slot7, m_slot7a }; - for(int i=0; i<8 && !tramd; i++) - tramd = slots[i]->read(offset, data); - - if (!tramd) - { - if (cas == 0) - data = m_ram->base()[offset & 0xffff]; - else - m_slot1->ram_read(cas, offset & 0xffff, data); - } - } - - return data; -} - -static ADDRESS_MAP_START(dmv_mem, AS_PROGRAM, 8, dmv_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xffff ) AM_READWRITE(program_r, program_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dmv_io , AS_IO, 8, dmv_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(leds_w) - AM_RANGE(0x10, 0x10) AM_READWRITE(ramsel_r, ramsel_w) - AM_RANGE(0x11, 0x11) AM_READWRITE(romsel_r, romsel_w) - AM_RANGE(0x12, 0x12) AM_WRITE(tc_set_w) - AM_RANGE(0x13, 0x13) AM_READ(sys_status_r) - AM_RANGE(0x14, 0x14) AM_WRITE(fdd_motor_w) - AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("dma8237", am9517a_device, read, write) - AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("kb_ctrl_mcu", upi41_cpu_device, upi41_master_r, upi41_master_w) - AM_RANGE(0x50, 0x51) AM_DEVICE("i8272", i8272a_device, map) - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE(0xa0, 0xa1) AM_DEVREADWRITE("upd7220", upd7220_device, read, write) - AM_RANGE(0xd0, 0xd7) AM_WRITE(switch16_w) - AM_RANGE(0xe0, 0xe7) AM_WRITE(rambank_w) - - AM_RANGE(0x60, 0x6f) AM_READWRITE(ifsel0_r, ifsel0_w) - AM_RANGE(0x70, 0x7f) AM_READWRITE(ifsel1_r, ifsel1_w) - AM_RANGE(0x30, 0x3f) AM_READWRITE(ifsel2_r, ifsel2_w) - AM_RANGE(0xb0, 0xbf) AM_READWRITE(ifsel3_r, ifsel3_w) - AM_RANGE(0xc0, 0xcf) AM_READWRITE(ifsel4_r, ifsel4_w) -ADDRESS_MAP_END - -READ8_MEMBER(dmv_state::kb_mcu_port1_r) -{ - return !(m_keyboard->sd_poll_r() & !m_sd_poll_state); -} - -WRITE8_MEMBER(dmv_state::kb_mcu_port1_w) -{ - m_sd_poll_state = BIT(data, 1); - m_keyboard->sd_poll_w(!m_sd_poll_state); -} - -WRITE8_MEMBER(dmv_state::kb_mcu_port2_w) -{ - m_speaker->level_w(BIT(data, 0)); - m_slot7a->keyint_w(BIT(data, 4)); - m_slot7->keyint_w(BIT(data, 4)); -} - -static ADDRESS_MAP_START( dmv_kb_ctrl_io, AS_IO, 8, dmv_state ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_mcu_port1_r, kb_mcu_port1_w) // bit 0 data from kb, bit 1 data to kb - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_mcu_port2_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( upd7220_map, AS_0, 16, dmv_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1ffff) - AM_RANGE(0x00000, 0x1ffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( dmv ) - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x00, "Video Board" ) - PORT_CONFSETTING( 0x00, "Monochrome" ) - PORT_CONFSETTING( 0x01, "Color" ) -INPUT_PORTS_END - -void dmv_state::machine_start() -{ -} - -void dmv_state::machine_reset() -{ - m_color_mode = ioport("CONFIG")->read() & 0x01; - - m_ramoutdis = true; - m_ram_bank = 0; - m_eop_line = 0; - m_dack3_line = 0; - m_sd_poll_state = 0; - m_floppy_motor = 1; - m_switch16 = 0; - m_thold7 = 0; - m_dma_hrq = 0; - memset(m_busint, 0, sizeof(m_busint)); - memset(m_irqs, 0, sizeof(m_irqs)); - - update_halt_line(); -} - -void dmv_state::update_halt_line() -{ - m_slot7->hold_w(m_dma_hrq); - m_slot7->switch16_w(m_switch16); - m_slot7a->hold_w(m_dma_hrq); - m_slot7a->switch16_w(m_switch16); - - m_maincpu->set_input_line(INPUT_LINE_HALT, (m_thold7 || m_switch16 || m_dma_hrq) ? ASSERT_LINE : CLEAR_LINE); -} - -/* F4 Character Displayer */ -static const gfx_layout dmv_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { STEP16(0,8) }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( dmv ) - GFXDECODE_ENTRY("chargen", 0x0000, dmv_charlayout, 0, 1) -GFXDECODE_END - - -//------------------------------------------------------------------------------------ -// I8237 -//------------------------------------------------------------------------------------ - -WRITE_LINE_MEMBER( dmv_state::dma_hrq_changed ) -{ - m_dma_hrq = state; - update_halt_line(); - - // Assert HLDA - m_dmac->hack_w(state); -} - -WRITE_LINE_MEMBER( dmv_state::dmac_eop ) -{ - if (!(m_dack3_line || m_eop_line) && (m_dack3_line || state)) - m_fdc->tc_w(true); - - m_eop_line = state; -} - -WRITE_LINE_MEMBER( dmv_state::dmac_dack3 ) -{ - if (!(m_dack3_line || m_eop_line) && (state || m_eop_line)) - m_fdc->tc_w(true); - - m_dack3_line = state; -} - -WRITE_LINE_MEMBER( dmv_state::pit_out0 ) -{ - if (!state) - { - m_floppy_motor = 1; - m_floppy0->get_device()->mon_w(m_floppy_motor); - m_floppy1->get_device()->mon_w(m_floppy_motor); - } -} - -WRITE_LINE_MEMBER( dmv_state::timint_w ) -{ - m_slot7a->timint_w(state); - m_slot7->timint_w(state); -} - -WRITE_LINE_MEMBER( dmv_state::fdc_irq ) -{ - m_slot7a->flexint_w(state); - m_slot7->flexint_w(state); - - if (state) - m_fdc->tc_w(false); -} - - -FLOPPY_FORMATS_MEMBER( dmv_state::floppy_formats ) - FLOPPY_DMV_FORMAT -FLOPPY_FORMATS_END - - -static SLOT_INTERFACE_START(dmv_slot1) - SLOT_INTERFACE("k200", DMV_K200) // K200 64K RAM expansion - SLOT_INTERFACE("k202", DMV_K202) // K202 192K RAM expansion - SLOT_INTERFACE("k208", DMV_K208) // K208 448K RAM expansion -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(dmv_slot2_6) - SLOT_INTERFACE("k210", DMV_K210) // K210 Centronics - SLOT_INTERFACE("k211", DMV_K211) // K211 RS-232 Communications Interface - SLOT_INTERFACE("k212", DMV_K212) // K212 RS-232 Printer Interface - SLOT_INTERFACE("k213", DMV_K213) // K213 RS-232 Plotter Interface - SLOT_INTERFACE("k233", DMV_K233) // K233 16K Shared RAM - SLOT_INTERFACE("k801", DMV_K801) // K801 RS-232 Switchable Interface - SLOT_INTERFACE("k803", DMV_K803) // K803 RTC module - SLOT_INTERFACE("k806", DMV_K806) // K806 Mouse module -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(dmv_slot7) - SLOT_INTERFACE("k220", DMV_K220) // K220 Diagnostic Module - SLOT_INTERFACE("k231", DMV_K231) // K231 External 8088 module without interrupt controller - SLOT_INTERFACE("k234", DMV_K234) // K234 External 68008 module -SLOT_INTERFACE_END - - -static SLOT_INTERFACE_START(dmv_slot2a) - -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(dmv_slot7a) - SLOT_INTERFACE("k230", DMV_K230) // K230 Internal 8088 module without interrupt controller - SLOT_INTERFACE("k235", DMV_K235) // K235 Internal 8088 module with interrupt controller -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( dmv, dmv_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_24MHz / 6) - MCFG_CPU_PROGRAM_MAP(dmv_mem) - MCFG_CPU_IO_MAP(dmv_io) - - MCFG_CPU_ADD("kb_ctrl_mcu", I8741, XTAL_6MHz) - MCFG_CPU_IO_MAP(dmv_kb_ctrl_io) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_DMV_KEYBOARD_ADD("keyboard") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", dmv) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - MCFG_DEFAULT_LAYOUT(layout_dmv) - - // devices - MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_5MHz/2) // unk clock - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(dmv_state, hgdc_display_pixels) - MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(dmv_state, hgdc_draw_text) - - MCFG_DEVICE_ADD( "dma8237", AM9517A, XTAL_4MHz ) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(dmv_state, dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(dmv_state, dmac_eop)) - MCFG_I8237_IN_MEMR_CB(READ8(dmv_state, program_r)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(dmv_state, program_w)) - MCFG_I8237_IN_IOR_0_CB(LOGGER("DMA CH1", 0)) - MCFG_I8237_OUT_IOW_0_CB(LOGGER("DMA CH1", 0)) - MCFG_I8237_IN_IOR_1_CB(LOGGER("DMA CH2", 0)) - MCFG_I8237_OUT_IOW_1_CB(LOGGER("DMA CH2", 0)) - MCFG_I8237_IN_IOR_2_CB(DEVREAD8("upd7220", upd7220_device, dack_r)) - MCFG_I8237_OUT_IOW_2_CB(DEVWRITE8("upd7220", upd7220_device, dack_w)) - MCFG_I8237_IN_IOR_3_CB(DEVREAD8("i8272", i8272a_device, mdma_r)) - MCFG_I8237_OUT_IOW_3_CB(DEVWRITE8("i8272", i8272a_device, mdma_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(dmv_state, dmac_dack3)) - - MCFG_I8272A_ADD( "i8272", true ) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(dmv_state, fdc_irq)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8237", am9517a_device, dreq3_w)) - MCFG_FLOPPY_DRIVE_ADD("i8272:0", dmv_floppies, "525dd", dmv_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("i8272:1", dmv_floppies, "525dd", dmv_state::floppy_formats) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(50) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(dmv_state, pit_out0)) - MCFG_PIT8253_CLK2(XTAL_24MHz / 3 / 16) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(dmv_state, timint_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_DEVICE_ADD("slot1", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot1, NULL, false) - MCFG_DEVICE_ADD("slot2", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) - MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq2_w)) - MCFG_DEVICE_ADD("slot2a", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2a, NULL, false) - MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2a_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq2a_w)) - MCFG_DEVICE_ADD("slot3", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) - MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint3_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq3_w)) - MCFG_DEVICE_ADD("slot4", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) - MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint4_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq4_w)) - MCFG_DEVICE_ADD("slot5", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) - MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint5_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq5_w)) - MCFG_DEVICE_ADD("slot6", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) - MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint6_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq6_w)) - - MCFG_DEVICE_ADD("slot7", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7, NULL, false) - MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w)) - MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w)) - MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq7_w)) - MCFG_DEVICE_ADD("slot7a", DMVCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7a, "k230", false) - MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w)) - MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w)) - MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7a_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq7a_w)) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "dmv") - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( dmv ) - ROM_REGION( 0x2000, "boot", 0 ) - ROM_SYSTEM_BIOS(0, "c07", "C.07.00") // ROM bears the handwritten note "Color 7.0", this is from the machine that originally had Color, 68K and internal 8088 - ROM_SYSTEM_BIOS(1, "m07", "M.07.00") // Mono machine with internal 8088 and internal HD - ROM_SYSTEM_BIOS(2, "m06", "M.06.00") // Mono machine - ROM_SYSTEM_BIOS(3, "m05", "M.05.00") // Mono machine, marked "updated" - - ROMX_LOAD( "dmv_mb_rom_33610.bin", 0x00000, 0x02000, CRC(bf25f3f0) SHA1(0c7dd37704db4799e340cc836f887cd543e5c964), ROM_BIOS(1) ) - ROMX_LOAD( "dmv_mb_rom_33609.bin", 0x00000, 0x02000, CRC(120951b6) SHA1(57bef9cc6379dea5730bc1477e8896508e00a349), ROM_BIOS(2) ) - ROMX_LOAD( "dmv_mb_rom_32676.bin", 0x00000, 0x02000, CRC(7796519e) SHA1(8d5dd9c1e66c96fcca271b6f673d6a0e784acb33), ROM_BIOS(3) ) - ROMX_LOAD( "dmv_mb_rom_32664.bin", 0x00000, 0x02000, CRC(6624610e) SHA1(e9226be897d2c5f875784ab77dad8807f14c7714), ROM_BIOS(4) ) - - ROM_REGION(0x400, "kb_ctrl_mcu", 0) - ROMX_LOAD( "dmv_mb_8741_32678.bin", 0x00000, 0x00400, CRC(50d1dc4c) SHA1(2c8251d6c8df9f507e11bf920869657f4d074db1), ROM_BIOS(1) ) - ROMX_LOAD( "dmv_mb_8741_32678.bin", 0x00000, 0x00400, CRC(50d1dc4c) SHA1(2c8251d6c8df9f507e11bf920869657f4d074db1), ROM_BIOS(2) ) - ROMX_LOAD( "dmv_mb_8741_32678.bin", 0x00000, 0x00400, CRC(50d1dc4c) SHA1(2c8251d6c8df9f507e11bf920869657f4d074db1), ROM_BIOS(3) ) - ROMX_LOAD( "dmv_mb_8741_32121.bin", 0x00000, 0x00400, CRC(a03af298) SHA1(144cba41294c46f5ca79b7ad8ced0e4408168775), ROM_BIOS(4) ) - - ROM_REGION(0x800, "chargen", 0) - ROM_LOAD( "76161.bin", 0x00000, 0x00800, CRC(6e4df4f9) SHA1(20ff4fc48e55eaf5131f6573fff93e7f97d2f45d)) // same for both color and monochrome board - - ROM_REGION(0x10000, "ram", ROMREGION_ERASE) // 64K RAM on mainboard -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, dmv, 0, 0, dmv, dmv, driver_device, 0, "NCR", "Decision Mate V", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/dolphunk.c b/src/mess/drivers/dolphunk.c deleted file mode 100644 index 8ee69d20042..00000000000 --- a/src/mess/drivers/dolphunk.c +++ /dev/null @@ -1,266 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Dolphin / Dauphin - - 2010-04-08 Skeleton driver. - 2012-05-20 Fixed keyboard, added notes & speaker [Robbbert] - 2013-11-03 Added cassette [Robbbert] - - Minimal Setup: - 0000-00FF ROM "MO" (74S471) - 0100-01FF ROM "MONI" (74S471) - 0200-02FF RAM (2x 2112) - 18 pushbuttons for programming (0-F, ADR, NXT). - 4-digit LED display. - - Other options: - 0400-07FF Expansion RAM (8x 2112) - 0800-08FF Pulse for operation of an optional EPROM programmer - 0C00-0FFF ROM "MONA" (2708) - LEDs connected to all Address and Data Lines - LEDs connected to WAIT and FLAG lines. - Speaker with a LED wired across it. - PAUSE switch. - RUN/STOP switch. - STEP switch. - CLOCK switch. - - Cassette player connected to SENSE and FLAG lines. - - Keyboard encoder: AY-5-2376 (57 keys) - - CRT interface: (512 characters on a separate bus) - 2114 video ram (one half holds the lower 4 data bits, other half the upper bits) - 74LS175 holds the upper bits for the 74LS472 - 74LS472 Character Generator - - NOTE: a rom is missing, when the ADR button (- key) is pressed, - it causes a freeze in nodebug mode, and a crash in debug mode. - To see it, start in debug mode. g 6c. In the emulation, press the - minus key. The debugger will stop and you can see an instruction - referencing location 0100, which is in the missing rom. - - Keys: - 0-9,A-F hexadecimal numbers - UP - (NXT) to enter data and advance to the next address - MINUS - (ADR) to change the address to what is shown in the data side - Special keys: - Hold UP, hold 0, release UP, release 0 - execute program at the current address (i.e. 2xx) - Hold UP, hold 1, release UP, release 1 - execute program at address 0C00 (rom MONA) - Hold UP, hold 2, release UP, release 2 - play a tune with the keys - Hold UP, hold 3, release UP, release 3 - decrement the address by 2 - Hold MINUS, hold any hex key, release MINUS, release other key - execute program - at the current address-0x100 (i.e. 1xx). - - If you want to scan through other areas of memory (e.g. the roms), alter the - data at address 2F9 (high byte) and 2FA (low byte). - - How to Use: - The red digits are the address, and the orange digits are the data. - The address range is 200-2FF (the 2 isn't displayed). To select an address, - either press the UP key until you get there, or type the address and press - minus. The orange digits show the current data at that address. To alter - data, just type it in and press UP. - - To play the reflexes game, hold UP, press 1, release UP, release 1. - The display will show A--0 (or some random number in the last position). - Press any odd-numbered key (B is convenient), and read off the reaction time. - After a short delay it will show '--' again, this is the signal to react. - It doesn't seem to reset the counters each time around. - - TODO: - - Find missing roms - - Add optional hardware listed above - - Cassette is added, but no idea how to operate it. - - Thanks to Amigan site for various documents. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/s2650/s2650.h" -#include "sound/speaker.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "dolphunk.lh" - - -class dauphin_state : public driver_device -{ -public: - dauphin_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_speaker(*this, "speaker") - , m_cass(*this, "cassette") - { } - - DECLARE_READ8_MEMBER(cass_r); - DECLARE_WRITE_LINE_MEMBER(cass_w); - DECLARE_READ8_MEMBER(port07_r); - DECLARE_WRITE8_MEMBER(port00_w); - DECLARE_WRITE8_MEMBER(port06_w); - TIMER_DEVICE_CALLBACK_MEMBER(dauphin_c); -private: - UINT8 m_cass_data; - UINT8 m_last_key; - bool m_cass_state; - bool m_cassold; - bool m_speaker_state; - required_device m_maincpu; - required_device m_speaker; - required_device m_cass; -}; - -READ8_MEMBER( dauphin_state::cass_r ) -{ - return (m_cass->input() > 0.03) ? 1 : 0; -} - -WRITE_LINE_MEMBER( dauphin_state::cass_w ) -{ - m_cass_state = state; // get flag bit -} - -WRITE8_MEMBER( dauphin_state::port00_w ) -{ - output_set_digit_value(offset, data); -} - -WRITE8_MEMBER( dauphin_state::port06_w ) -{ - m_speaker_state ^=1; - m_speaker->level_w(m_speaker_state); -} - -READ8_MEMBER( dauphin_state::port07_r ) -{ - UINT8 keyin, i, data = 0x40; - - keyin = ioport("X0")->read(); - if (keyin != 0xff) - for (i = 0; i < 8; i++) - if BIT(~keyin, i) - data = i | 0xc0; - - keyin = ioport("X1")->read(); - if (keyin != 0xff) - for (i = 0; i < 8; i++) - if BIT(~keyin, i) - data = i | 0xc8; - - if (data == m_last_key) - data &= 0x7f; - else - m_last_key = data; - - data |= ioport("X2")->read(); - - return data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(dauphin_state::dauphin_c) -{ - m_cass_data++; - - if (m_cass_state != m_cassold) - { - m_cass_data = 0; - m_cassold = m_cass_state; - } - - if (m_cass_state) - m_cass->output(BIT(m_cass_data, 1) ? -1.0 : +1.0); // 1000Hz - else - m_cass->output(BIT(m_cass_data, 0) ? -1.0 : +1.0); // 2000Hz -} - -static ADDRESS_MAP_START( dauphin_mem, AS_PROGRAM, 8, dauphin_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x01ff) AM_ROM - AM_RANGE( 0x0200, 0x02ff) AM_RAM - AM_RANGE( 0x0c00, 0x0fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dauphin_io, AS_IO, 8, dauphin_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_WRITE(port00_w) // 4-led display - AM_RANGE(0x06, 0x06) AM_WRITE(port06_w) // speaker (NOT a keyclick) - AM_RANGE(0x07, 0x07) AM_READ(port07_r) // pushbuttons - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) - AM_RANGE(0x102, 0x103) AM_NOP // stops error log filling up while using debug -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( dauphin ) - PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("X2") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ADR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( dauphin, dauphin_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(dauphin_mem) - MCFG_CPU_IO_MAP(dauphin_io) - MCFG_S2650_FLAG_HANDLER(WRITELINE(dauphin_state, cass_w)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_dolphunk) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_TIMER_DRIVER_ADD_PERIODIC("dauphin_c", dauphin_state, dauphin_c, attotime::from_hz(4000)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( dauphin ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "dolphin_mo.rom", 0x0000, 0x0100, CRC(a8811f48) SHA1(233c629dc20fac286c8c1559e461bb0b742a675e) ) - // This one is used in winarcadia but it is a bad dump, we use the corrected one above - //ROM_LOAD( "dolphin_mo.rom", 0x0000, 0x0100, BAD_DUMP CRC(1ac4ac18) SHA1(62a63de6fcd6cd5fcee930d31c73fe603647f06c) ) - - ROM_LOAD( "dolphin_moni.rom", 0x0100, 0x0100, NO_DUMP ) - - //ROM_LOAD_OPTIONAL( "dolphin_mona.rom", 0x0c00, 0x0400, NO_DUMP ) - // This rom is a bugfixed and relocated version of the game found on the Amigan site - ROM_LOAD_OPTIONAL( "reflexes.bin", 0x0c00, 0x0400, CRC(14a1557d) SHA1(789d10551f1bb3472057901fa3cee0c6bfe220ac) ) - // This the original - //ROM_LOAD( "reflexes.bin", 0x0c00, 0x0072, CRC(c4bed94b) SHA1(cf525755a1dbce6a4681353be692ddf0346f323b) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, dauphin, 0, 0, dauphin, dauphin, driver_device, 0, "LCD EPFL Stoppani", "Dauphin", 0 ) diff --git a/src/mess/drivers/dps1.c b/src/mess/drivers/dps1.c deleted file mode 100644 index bb3a5b21746..00000000000 --- a/src/mess/drivers/dps1.c +++ /dev/null @@ -1,41 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert - -#include "emu.h" -#include "cpu/z80/z80.h" - -class dps1_state : public driver_device -{ -public: - dps1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - { } -}; - -static ADDRESS_MAP_START( dps1_mem, AS_PROGRAM, 8, dps1_state ) - AM_RANGE(0x0000, 0x03ff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x2000, 0x2fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dps1_io, AS_IO, 8, dps1_state ) -ADDRESS_MAP_END - -static INPUT_PORTS_START( dps1 ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( dps1, dps1_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(dps1_mem) - MCFG_CPU_IO_MAP(dps1_io) - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "dps1") -MACHINE_CONFIG_END - -ROM_START( dps1 ) - ROM_REGION( 0x400, "maincpu", 0 ) - ROM_LOAD( "boot 1280", 0x000, 0x400, CRC(9c2e98fa) SHA1(78e6c9d00aa6e8f6c4d3c65984cfdf4e99434c66) ) // actually on the FDC-2 board -ROM_END - -COMP( 1979, dps1, 0, 0, dps1, dps1, driver_device, 0, "Ithaca InterSystems", "DPS-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/dragon.c b/src/mess/drivers/dragon.c deleted file mode 100644 index 61375867d28..00000000000 --- a/src/mess/drivers/dragon.c +++ /dev/null @@ -1,334 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - dragon.c - - Dragon - -***************************************************************************/ - -#include "includes/dragon.h" -#include "includes/dgnalpha.h" -#include "imagedev/cassette.h" -#include "formats/coco_cas.h" -#include "cpu/m6809/m6809.h" -#include "bus/coco/coco_232.h" -#include "bus/coco/coco_orch90.h" -#include "bus/coco/coco_pak.h" -#include "bus/coco/coco_fdc.h" -#include "bus/coco/coco_multi.h" -#include "formats/vdk_dsk.h" -#include "formats/dmk_dsk.h" -#include "imagedev/flopdrv.h" - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( dragon_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( dragon_mem, AS_PROGRAM, 8, dragon_state ) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -/* Dragon keyboard - - PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 - PA6: Ent Clr Brk N/c N/c N/c N/c Shift - PA5: X Y Z Up Dwn Lft Rgt Space - PA4: P Q R S T U V W - PA3: H I J K L M N O - PA2: @ A B C D E F G - PA1: 8 9 : ; , - . / - PA0: 0 1 2 3 4 5 6 7 - */ -static INPUT_PORTS_START( dragon32 ) - PORT_START("row0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("row1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("row2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("row3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("row4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("row5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("row6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x78, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, NULL) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - -static SLOT_INTERFACE_START(dragon_cart) - SLOT_INTERFACE("dragon_fdc", DRAGON_FDC) - SLOT_INTERFACE("sdtandy_fdc", SDTANDY_FDC) - SLOT_INTERFACE("pak", COCO_PAK) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( dragon_alpha_state::dragon_formats ) - FLOPPY_VDK_FORMAT, - FLOPPY_DMK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( dragon_floppies ) - SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) - SLOT_INTERFACE("sd", FLOPPY_525_SD) - SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) - SLOT_INTERFACE("dd", FLOPPY_525_DD) - SLOT_INTERFACE("ssqd", FLOPPY_525_SSQD) - SLOT_INTERFACE("qd", FLOPPY_525_QD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( dragon_base, dragon_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", M6809E, XTAL_4_433619MHz) - MCFG_CPU_PROGRAM_MAP(dragon_mem) - - // devices - MCFG_DEVICE_ADD(PIA0_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia0_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia0_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia0_irq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia0_irq_b)) - - MCFG_DEVICE_ADD(PIA1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(coco_state, pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(coco_state, pia1_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(coco_state, pia1_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(coco_state, pia1_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(coco_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(coco_state, pia1_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(coco_state, pia1_firq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia1_firq_b)) - - MCFG_SAM6883_ADD(SAM_TAG, XTAL_4_433619MHz, MAINCPU_TAG, AS_PROGRAM) - MCFG_SAM6883_RES_CALLBACK(READ8(dragon_state, sam_read)) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(coco_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_DEVICE_ADD(PRINTER_TAG, PRINTER, 0) - - // video hardware - MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, VDG_TAG) - - MCFG_DEVICE_ADD(VDG_TAG, MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_HSYNC_CALLBACK(WRITELINE(dragon_state, horizontal_sync)) - MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(dragon_state, field_sync)) - MCFG_MC6847_INPUT_CALLBACK(DEVREAD8(SAM_TAG, sam6883_device, display_read)) - - // sound hardware - MCFG_FRAGMENT_ADD( coco_sound ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dragon32, dragon_base ) - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("64K") - - // cartridge - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, "dragon_fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( dragon64, dragon_base, dragon64_state ) - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // cartridge - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, "dragon_fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) - - // acia - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( d64plus, dragon_base, dragon64_state ) - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - - // cartridge - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, "dragon_fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) - - // acia - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( dgnalpha, dragon_base, dragon_alpha_state ) - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // cartridge - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, NULL) - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) - - // acia - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - - // floppy - MCFG_WD2797_ADD(WD2797_TAG, XTAL_1MHz) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(dragon_alpha_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dragon_alpha_state, fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", dragon_floppies, "qd", dragon_alpha_state::dragon_formats) - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", dragon_floppies, "qd", dragon_alpha_state::dragon_formats) - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":2", dragon_floppies, "qd", dragon_alpha_state::dragon_formats) - MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":3", dragon_floppies, "qd", dragon_alpha_state::dragon_formats) - - // sound hardware - MCFG_SOUND_ADD(AY8912_TAG, AY8912, 1000000) - MCFG_AY8910_PORT_A_READ_CB(READ8(dragon_alpha_state, psg_porta_read)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(dragon_alpha_state, psg_porta_write)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - // pia 2 - MCFG_DEVICE_ADD( PIA2_TAG, PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(dragon_alpha_state, pia2_pa_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(dragon_alpha_state, pia2_firq_a)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(dragon_alpha_state, pia2_firq_b)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tanodr64, dragon64 ) - // cartridge - MCFG_DEVICE_MODIFY(CARTRIDGE_TAG) - MCFG_DEVICE_SLOT_INTERFACE(dragon_cart, "sdtandy_fdc", false) -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(dragon32) - ROM_REGION(0xC000, "maincpu",0) - ROM_LOAD("d32.rom", 0x0000, 0x4000, CRC(e3879310) SHA1(f2dab125673e653995a83bf6b793e3390ec7f65a)) -ROM_END - -ROM_START(dragon64) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("d64_1.rom", 0x0000, 0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042)) - ROM_LOAD("d64_2.rom", 0x8000, 0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e)) -ROM_END - -ROM_START(dragon200) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ic18.rom", 0x0000, 0x4000, CRC(84f68bf9) SHA1(1983b4fb398e3dd9668d424c666c5a0b3f1e2b69)) - ROM_LOAD( "ic17.rom", 0x8000, 0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e)) -ROM_END - -ROM_START(dragon200e) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ic18_v1.4e.ic34", 0x0000, 0x4000, CRC(95af0a0a) SHA1(628543ee8b47a56df2b2175cfb763c0051517b90)) - ROM_LOAD( "ic17_v1.4e.ic37", 0x8000, 0x4000, CRC(48b985df) SHA1(c25632f3c2cfd1af3ee26b2f233a1ce1eccc365d)) - ROM_REGION( 0x1000, "gfx", ROMREGION_ERASEFF ) - ROM_LOAD( "rom26.ic1", 0x0000, 0x1000, CRC(565724bc) SHA1(da5b756ba2a9c9ecebaa7daa8ba8bfd984d56a6f)) -ROM_END - -ROM_START(d64plus) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("d64_1.rom", 0x0000, 0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042)) - ROM_LOAD("d64_2.rom", 0x8000, 0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e)) -ROM_END - -ROM_START(tanodr64) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("d64_1.rom", 0x0000, 0x4000, CRC(60a4634c) SHA1(f119506eaa3b4b70b9aa0dd83761e8cbe043d042)) - ROM_LOAD("d64_2.rom", 0x8000, 0x4000, CRC(17893a42) SHA1(e3c8986bb1d44269c4587b04f1ca27a70b0aaa2e)) -ROM_END - -ROM_START(dgnalpha) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("alpha_bt.rom", 0x2000, 0x2000, CRC(c3dab585) SHA1(4a5851aa66eb426e9bb0bba196f1e02d48156068)) - ROM_LOAD("alpha_ba.rom", 0x8000, 0x4000, CRC(84f68bf9) SHA1(1983b4fb398e3dd9668d424c666c5a0b3f1e2b69)) -ROM_END - - -COMP( 1982, dragon32, coco, 0, dragon32, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 32", 0) -COMP( 1983, dragon64, coco, 0, dragon64, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 64", 0) -COMP( 1983, dragon200, coco, 0, dragon64, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 200", 0) -COMP( 1983, dragon200e, coco, 0, dragon64, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 200-E", 0) -COMP( 1983, d64plus, coco, 0, d64plus, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon 64 Plus", 0) -COMP( 1983, tanodr64, coco, 0, tanodr64, dragon32, driver_device, 0, "Dragon Data Ltd / Tano Ltd", "Tano Dragon 64 (NTSC)", 0) -COMP( 1984, dgnalpha, coco, 0, dgnalpha, dragon32, driver_device, 0, "Dragon Data Ltd", "Dragon Alpha Prototype", 0) diff --git a/src/mess/drivers/dsb46.c b/src/mess/drivers/dsb46.c deleted file mode 100644 index a0066e94d80..00000000000 --- a/src/mess/drivers/dsb46.c +++ /dev/null @@ -1,122 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Robbbert -/******************************************************************************************************************** - -2013-07-31 Skeleton Driver [Curt Coder] -2013-07-31 Connected to terminal [Robbbert] - - -The photos show 3 boards: -- A scsi board (all 74-series TTL) -- CPU board (64k dynamic RAM, Z80A CPU, 2x Z80CTC, 2x Z80SIO/0, MB8877A, Z80DMA, 4x MC1488, - 4x MC1489, XTALS 1.8432MHz and 24MHz) -- ADES board (Adaptec Inc AIC-100, AIC-250, AIC-300, Intel D8086AH, unknown crystal) - -Both roms contain Z80 code. - - -********************************************************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class dsb46_state : public driver_device -{ -public: - dsb46_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_READ8_MEMBER(port00_r); - DECLARE_READ8_MEMBER(port01_r); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE8_MEMBER(port1a_w); - DECLARE_DRIVER_INIT(dsb46); - DECLARE_MACHINE_RESET(dsb46); -private: - UINT8 m_term_data; - required_device m_maincpu; - required_device m_terminal; -}; - -static ADDRESS_MAP_START( dsb46_mem, AS_PROGRAM, 8, dsb46_state ) - AM_RANGE(0x0000, 0x07ff) AM_READ_BANK("read") AM_WRITE_BANK("write") - AM_RANGE(0x0800, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( dsb46_io, AS_IO, 8, dsb46_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(port00_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x01, 0x01) AM_READ(port01_r) - AM_RANGE(0x1a, 0x1a) AM_WRITE(port1a_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( dsb46 ) -INPUT_PORTS_END - -DRIVER_INIT_MEMBER(dsb46_state, dsb46) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("read")->configure_entry(0, &RAM[0x10000]); - membank("read")->configure_entry(1, &RAM[0x00000]); - membank("write")->configure_entry(0, &RAM[0x00000]); -} - -MACHINE_RESET_MEMBER( dsb46_state,dsb46 ) -{ - membank("read")->set_entry(0); - membank("write")->set_entry(0); - m_term_data = 0; - m_maincpu->reset(); -} - -WRITE8_MEMBER( dsb46_state::port1a_w ) -{ - membank("read")->set_entry(data & 1); -} - -READ8_MEMBER( dsb46_state::port01_r ) -{ - return (m_term_data) ? 5 : 4; -} - -READ8_MEMBER( dsb46_state::port00_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( dsb46_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( dsb46, dsb46_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(dsb46_mem) - MCFG_CPU_IO_MAP(dsb46_io) - MCFG_MACHINE_RESET_OVERRIDE(dsb46_state, dsb46) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dsb46_state, kbd_put)) -MACHINE_CONFIG_END - -ROM_START( dsb46 ) - ROM_REGION( 0x10800, "maincpu", 0 ) - ROM_LOAD( "1538a.bin", 0x10000, 0x800, CRC(65b3e26e) SHA1(afe1f03f266b7d13fdb1f1bc6762df5e0aa5c764) ) - - ROM_REGION( 0x4000, "ades", 0 ) - ROM_LOAD( "ades.bin", 0x0000, 0x4000, CRC(d374abf0) SHA1(331f51a2bb81375aeffbe63c1ebc1d7cd779b9c3) ) -ROM_END - -COMP( 198?, dsb46, 0, 0, dsb46, dsb46, dsb46_state, dsb46, "Davidge", "DSB-4/6", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/dual68.c b/src/mess/drivers/dual68.c deleted file mode 100644 index d778d0c4f6a..00000000000 --- a/src/mess/drivers/dual68.c +++ /dev/null @@ -1,115 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Dual Systems 68000 - - 09/12/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "cpu/i8085/i8085.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class dual68_state : public driver_device -{ -public: - dual68_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_p_ram(*this, "p_ram") - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_WRITE8_MEMBER( kbd_put ); - DECLARE_WRITE16_MEMBER( dual68_terminal_w ); - //UINT8 m_term_data; - required_shared_ptr m_p_ram; - virtual void machine_reset(); -}; - - - -WRITE16_MEMBER( dual68_state::dual68_terminal_w ) -{ - m_terminal->write(space, 0, data >> 8); -} - -static ADDRESS_MAP_START(dual68_mem, AS_PROGRAM, 16, dual68_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x0000ffff) AM_RAM AM_SHARE("p_ram") - AM_RANGE(0x00080000, 0x00081fff) AM_ROM AM_REGION("user1",0) - AM_RANGE(0x007f0000, 0x007f0001) AM_WRITE(dual68_terminal_w) - AM_RANGE(0x00800000, 0x00801fff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sio4_mem, AS_PROGRAM, 8, dual68_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sio4_io, AS_IO, 8, dual68_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( dual68 ) -INPUT_PORTS_END - - -void dual68_state::machine_reset() -{ - UINT8* user1 = memregion("user1")->base(); - - memcpy((UINT8*)m_p_ram.target(),user1,0x2000); - - m_maincpu->reset(); -} - -WRITE8_MEMBER( dual68_state::kbd_put ) -{ - //m_term_data = data; -} - -static MACHINE_CONFIG_START( dual68, dual68_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz / 2) - MCFG_CPU_PROGRAM_MAP(dual68_mem) - - MCFG_CPU_ADD("siocpu", I8085A, XTAL_16MHz / 8) - MCFG_CPU_PROGRAM_MAP(sio4_mem) - MCFG_CPU_IO_MAP(sio4_io) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dual68_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( dual68 ) - ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v1", "2 * 4KB" ) - ROMX_LOAD( "dual_cpu68000_1.bin", 0x0001, 0x1000, CRC(d1785c08) SHA1(73c1f68875f1d8eb5e92f4347f509c61103da90f),ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "dual_cpu68000_2.bin", 0x0000, 0x1000, CRC(b9f1ba3c) SHA1(8fd02936ad06d5a22d435d96f06e2442fc7d00ec),ROM_SKIP(1) | ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "v2", "2 * 2KB" ) - ROMX_LOAD( "dual.u2.bin", 0x0001, 0x0800, CRC(e9c44fcd) SHA1(d5cc609d6f5e6745d5f0af1aa6dc66012333ed60),ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "dual.u3.bin", 0x0000, 0x0800, CRC(827b049f) SHA1(8209f8ab3d1068e5bab51e7eb12be46d4ea28354),ROM_SKIP(1) | ROM_BIOS(2)) - - ROM_REGION( 0x10000, "siocpu", ROMREGION_ERASEFF ) - ROM_LOAD( "dual_sio4.bin", 0x0000, 0x0800, CRC(6b0a1965) SHA1(5d2dc6c6a315293ded4b9fc95c8ac1599bf31dd3)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, dual68, 0, 0, dual68, dual68, driver_device, 0, "Dual Systems Corporation", "Dual Systems 68000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/dvk_kcgd.c b/src/mess/drivers/dvk_kcgd.c deleted file mode 100644 index 2903a402680..00000000000 --- a/src/mess/drivers/dvk_kcgd.c +++ /dev/null @@ -1,384 +0,0 @@ -/*************************************************************************** - - KCGD (Kontroller Cvetnogo Graficheskogo Displeya = Colour Graphics - Display Controller), a replacement for KSM (dvk_ksm.c) in later - models of DVK desktops. - - MPI (Q-Bus clone) board. Interfaces with MS7004 (DEC LK201 workalike) - keyboard, mouse, and monochrome or color CRT. - - To do: - - K1801VM2 CPU core (interrupts and EVNT pin, full EIS set, other insns) - - Everything else :-) - -****************************************************************************/ - -#include "emu.h" - -#include "bus/rs232/rs232.h" -#include "cpu/t11/t11.h" -#include "machine/clock.h" -#include "machine/ms7004.h" - -#define KCGD_TOTAL_HORZ 1000 // XXX verify -#define KCGD_DISP_HORZ 800 -#define KCGD_HORZ_START 200 // XXX verify - -#define KCGD_TOTAL_VERT 600 // XXX verify -#define KCGD_DISP_VERT 480 -#define KCGD_VERT_START 100 // XXX verify - -#define KCGD_STATUS_PAGE 0 -#define KCGD_STATUS_INTERLACE 1 -#define KCGD_STATUS_TIMER_INT 5 -#define KCGD_STATUS_MODE_INT 6 -#define KCGD_STATUS_MODE_LAST 7 -#define KCGD_STATUS_TIMER_VAL 15 - -#define KCGD_PAGE_0 015574 -#define KCGD_PAGE_1 005574 - -#define VERBOSE_DBG 1 /* general debug messages */ - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - - -class kcgd_state : public driver_device -{ -public: - kcgd_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), -// m_ms7004(*this, "ms7004"), - m_palette(*this, "palette"), - m_screen(*this, "screen") - { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback); - DECLARE_PALETTE_INIT(kcgd); - - enum - { - TIMER_ID_VSYNC_ON, - TIMER_ID_VSYNC_OFF, - TIMER_ID_500HZ - }; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); - DECLARE_WRITE_LINE_MEMBER(write_line_clock); - - DECLARE_READ16_MEMBER(vram_addr_r); - DECLARE_READ16_MEMBER(vram_data_r); - DECLARE_READ16_MEMBER(vram_mmap_r); - DECLARE_WRITE16_MEMBER(vram_addr_w); - DECLARE_WRITE16_MEMBER(vram_data_w); - DECLARE_WRITE16_MEMBER(vram_mmap_w); - DECLARE_READ16_MEMBER(status_r); - DECLARE_WRITE16_MEMBER(status_w); - DECLARE_READ8_MEMBER(palette_index_r); - DECLARE_READ8_MEMBER(palette_data_r); - DECLARE_WRITE8_MEMBER(palette_index_w); - DECLARE_WRITE8_MEMBER(palette_data_w); - - emu_timer *m_vsync_on_timer; - emu_timer *m_vsync_off_timer; - emu_timer *m_500hz_timer; - -private: - void draw_scanline(UINT16 *p, UINT16 offset); - rectangle m_tmpclip; - bitmap_ind16 m_tmpbmp; - - struct { - UINT16 status; // 167770 - UINT8 control; // 167772 - int palette_index, vram_addr; - UINT8 palette[16]; - } m_video; - UINT32 *m_videoram; - -protected: - required_device m_maincpu; -// required_device m_ms7004; - required_device m_palette; - required_device m_screen; -}; - -static ADDRESS_MAP_START( kcgd_mem, AS_PROGRAM, 16, kcgd_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE (0000000, 0077777) AM_READWRITE(vram_mmap_r, vram_mmap_w) - AM_RANGE (0100000, 0157777) AM_ROM - AM_RANGE (0160000, 0160001) AM_MIRROR(03774) AM_READWRITE(vram_addr_r, vram_addr_w) - AM_RANGE (0160002, 0160003) AM_MIRROR(03774) AM_READWRITE(vram_data_r, vram_data_w) - AM_RANGE (0167770, 0167771) AM_READWRITE(status_r, status_w) - AM_RANGE (0167772, 0167773) AM_READWRITE8(palette_index_r, palette_index_w, 0x00ff) // reads always return 0 - AM_RANGE (0167772, 0167773) AM_READWRITE8(palette_data_r, palette_data_w, 0xff00) -// AM_RANGE (0176560, 0176567) AM_RAM // USART2 -- host -// AM_RANGE (0177560, 0177567) AM_RAM // USART3 -- keyboard -ADDRESS_MAP_END - -void kcgd_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { -/* - case TIMER_ID_VSYNC_ON: - m_maincpu->set_input_line(INPUT_LINE_EVNT, ASSERT_LINE); - break; - - case TIMER_ID_VSYNC_OFF: - m_maincpu->set_input_line(INPUT_LINE_EVNT, CLEAR_LINE); - break; -*/ - case TIMER_ID_500HZ: - m_video.status ^= (1 << KCGD_STATUS_TIMER_VAL); - break; - } -} - -void kcgd_state::machine_reset() -{ - memset(&m_video, 0, sizeof(m_video)); -} - -void kcgd_state::video_start() -{ -// screen_device *screen = machine().device("screen"); - - // 64 kwords, word size is 17 bits - m_videoram = auto_alloc_array(machine(), UINT32, 65536); - - m_tmpclip = rectangle(0, KCGD_DISP_HORZ-1, 0, KCGD_DISP_VERT-1); - m_tmpbmp.allocate(KCGD_DISP_HORZ, KCGD_DISP_VERT); -/* - m_vsync_on_timer = timer_alloc(TIMER_ID_VSYNC_ON); - m_vsync_on_timer->adjust(screen->time_until_pos(0, 0), 0, screen->frame_period()); - - m_vsync_off_timer = timer_alloc(TIMER_ID_VSYNC_OFF); - m_vsync_off_timer->adjust(screen->time_until_pos(16, 0), 0, screen->frame_period()); -*/ - m_500hz_timer = timer_alloc(TIMER_ID_500HZ); - m_500hz_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500)); -} - -PALETTE_INIT_MEMBER(kcgd_state, kcgd) -{ - for (int i = 0; i < 16; i++) - { - palette.set_pen_color(i, i?i:255, i?i:255, i?i:255); - } -} - -/* - VRAM is 128K and is word-addressable, so address fits into 16 bits. - Low 32K of VRAM are not used to store pixel data -- XXX. -*/ -WRITE16_MEMBER(kcgd_state::vram_addr_w) -{ - DBG_LOG(3,"VRAM WA", ("%06o\n", data)); - m_video.vram_addr = data; -} - -READ16_MEMBER(kcgd_state::vram_addr_r) -{ - DBG_LOG(3,"VRAM RA", ("\n")); - return m_video.vram_addr; -} - -WRITE16_MEMBER(kcgd_state::vram_data_w) -{ - DBG_LOG(1,"VRAM W2", ("%06o <- %04XH\n", m_video.vram_addr, data)); - m_videoram[m_video.vram_addr] = data | (BIT(m_video.control, 7) << 16); -} - -READ16_MEMBER(kcgd_state::vram_data_r) -{ - DBG_LOG(2,"VRAM R2", ("%06o\n", m_video.vram_addr)); - m_video.status = (m_video.status & 0xff7f) | (BIT(m_videoram[m_video.vram_addr], 16) << 7); - return (UINT16) (m_videoram[m_video.vram_addr] & 0xffff); -} - -WRITE16_MEMBER(kcgd_state::vram_mmap_w) -{ - DBG_LOG(3,"VRAM W1", ("%06o <- %04XH\n", offset, data)); - m_videoram[offset] = data | (BIT(m_video.control, 7) << 16); -} - -READ16_MEMBER(kcgd_state::vram_mmap_r) -{ - DBG_LOG(3,"VRAM R1", ("%06o\n", offset)); - return (UINT16) (m_videoram[offset] & 0xffff); -} - -WRITE16_MEMBER(kcgd_state::status_w) -{ - DBG_LOG(1,"Status W", ("data %04XH (useful %02XH)\n", data, data & 0x63)); - // bits 7 and 15 are read-only - m_video.status = (m_video.status & 0x8080) | (data & 0x7f7f); -} - -READ16_MEMBER(kcgd_state::status_r) -{ - UINT16 data = m_video.status ^ (BIT(m_video.control, 6) << 7); - DBG_LOG(1,"Status R", ("data %04X index %d\n", data, m_video.palette_index)); - return data; -} - -WRITE8_MEMBER(kcgd_state::palette_index_w) -{ - m_video.control = data; - m_video.palette_index = ((data >> 2) & 15); - DBG_LOG(1,"Palette index, Control W", ("data %02XH index %d\n", data, m_video.palette_index)); -} - -WRITE8_MEMBER(kcgd_state::palette_data_w) -{ - DBG_LOG(1,"Palette data W", ("data %02XH index %d\n", data, m_video.palette_index)); - m_video.palette[m_video.palette_index] = data; - m_palette->set_pen_color(m_video.palette_index, - 85*(data & 3), 85*((data >> 2) & 3), 85*((data >> 4) & 3)); -} - -READ8_MEMBER(kcgd_state::palette_index_r) -{ - return 0; -} - -READ8_MEMBER(kcgd_state::palette_data_r) -{ - DBG_LOG(1,"Palette data R", ("index %d\n", m_video.palette_index)); - return m_video.palette[m_video.palette_index]; -} - -/* - Raster sizes are: - - 800(400)x480 in hires(lores) 60 Hz interlaced mode - - 800(400)x240 in hires(lores) 30 Hz progressive mode - - Video memory is 17 bits wide (bit 16 indicates hi/lo res mode for each word, - host writes it separately (via bit 7 in 167772). -*/ - -void kcgd_state::draw_scanline(UINT16 *p, UINT16 offset) -{ - int i; - - for ( i = 0; i < 100; i++ ) - { - UINT32 data = m_videoram[ offset++ ]; - if (BIT(data, 16)) { - *p = ( data >> 12) & 0x0F; p++; - *p = ( data >> 12) & 0x0F; p++; - *p = ( data >> 8 ) & 0x0F; p++; - *p = ( data >> 8 ) & 0x0F; p++; - *p = ( data >> 4 ) & 0x0F; p++; - *p = ( data >> 4 ) & 0x0F; p++; - *p = data & 0x0F; p++; - *p = data & 0x0F; p++; - } else { - *p = 5*(( data >> 14) & 0x03); p++; - *p = 5*(( data >> 12) & 0x03); p++; - *p = 5*(( data >> 10) & 0x03); p++; - *p = 5*(( data >> 8 ) & 0x03); p++; - *p = 5*(( data >> 6 ) & 0x03); p++; - *p = 5*(( data >> 4 ) & 0x03); p++; - *p = 5*(( data >> 2 ) & 0x03); p++; - *p = 5*( data & 0x03); p++; - } - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(kcgd_state::scanline_callback) -{ - UINT16 y = m_screen->vpos(), offset; - - if (y < KCGD_VERT_START) return; - y -= KCGD_VERT_START; - if (y >= KCGD_DISP_VERT) return; - - offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1); - - DBG_LOG(2,"scanline_cb", ("frame %" I64FMT "d y %.3d page %d offset %04X *offset %04X\n", - m_screen->frame_number(), BIT(m_video.status, KCGD_STATUS_PAGE), - y, offset + y, m_videoram[offset + y])); - - draw_scanline(&m_tmpbmp.pix16(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]); -} - -UINT32 kcgd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_tmpbmp, 0, 0, KCGD_HORZ_START, KCGD_VERT_START, cliprect); - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout kcgd_charlayout = -{ - 8, 10, /* 8x10 pixels */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 8*10 /* every char takes 10 bytes */ -}; - -static GFXDECODE_START( kcgd ) - GFXDECODE_ENTRY("maincpu", 0112236, kcgd_charlayout, 0, 1) -GFXDECODE_END - -static MACHINE_CONFIG_START( kcgd, kcgd_state ) - MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_30_8MHz/4) - MCFG_CPU_PROGRAM_MAP(kcgd_mem) - MCFG_T11_INITIAL_MODE(0100000) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", kcgd_state, scanline_callback, attotime::from_hz(50*28*11)) // XXX verify - MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_30_8MHz/KCGD_HORZ_START)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(kcgd_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_30_8MHz, KCGD_TOTAL_HORZ, KCGD_HORZ_START, - KCGD_HORZ_START+KCGD_DISP_HORZ, KCGD_TOTAL_VERT, KCGD_VERT_START, - KCGD_VERT_START+KCGD_DISP_VERT); - - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(kcgd_state, kcgd) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", kcgd) -#if 0 - MCFG_DEVICE_ADD("ms7004", MS7004, 0) - MCFG_MS7004_TX_HANDLER(DEVWRITELINE("i8251kbd", i8251_device, write_rxd)) - - MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4800*16) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(kcgd_state, write_keyboard_clock)) -#endif -MACHINE_CONFIG_END - -ROM_START( dvk_kcgd ) - ROM_REGION16_BE(0x100000,"maincpu", ROMREGION_ERASE00) - ROM_DEFAULT_BIOS("181") - ROM_SYSTEM_BIOS(0, "181", "mask 181") - ROMX_LOAD("kr1801re2-181.bin", 0100000, 020000, CRC(acac124f) SHA1(412c3eb71bece6f791fc5a9d707cf4692fd0b45b), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "182", "mask 182") - ROMX_LOAD("kr1801re2-182.bin", 0100000, 020000, CRC(3ca2921a) SHA1(389b30c40ed7e41dae71d58c7bff630359a48153), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, dvk_kcgd, 0, 0, kcgd, 0, driver_device, 0, "USSR", "DVK KCGD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/dvk_ksm.c b/src/mess/drivers/dvk_ksm.c deleted file mode 100644 index 36eaaa241fc..00000000000 --- a/src/mess/drivers/dvk_ksm.c +++ /dev/null @@ -1,418 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - KSM (Kontroller Simvolnogo Monitora = Character Display Controller), - a single-board replacement for standalone 15IE-00-013 terminal (ie15.c) - in later-model DVK desktops. - - MPI (Q-Bus clone) board, consumes only power from the bus. - Interfaces with MS7004 (DEC LK201 workalike) keyboard and monochrome CRT. - - Hardware revisions (XXX verify everything): - - 7.102.076 -- has DIP switches, SRAM at 0x2000, model name "KSM" - - 7.102.228 -- no DIP switches, SRAM at 0x2100, model name "KSM-01" - - Emulates a VT52 without copier (ESC Z response is ESC / M), with - Hold Screen mode and Graphics character set (but it is unique and - mapped to a different range -- 100..137). - - F4 + 0..9 on numeric keypad = setup mode. 0 changes serial port speed, - 1..9 toggle one of mode bits: - - 1 XON/XOFF 0: Off 1: On - 2 Character set 0: N0/N1 2: N2 - 3 Auto LF 0: Off 1: On - 4 Auto repeat 0: On 1: Off - 5 Auto wraparound 0: On 1: Off - 6 Interpret controls 0: Interpret 1: Display - 7 Parity check 0: Off 1: On - 8 Parity bits 0: None 1: Even - 9 Stop bits - - N0/N1 charset has regular ASCII in C0 page and Cyrillic in C1 page, - switching between them via SI/SO. N2 charset has uppercase Cyrillic - chars in place of lowercase Latin ones. - - F1 toggles Hold Screen mode. - F9 resets terminal (clears memory). - F20 toggles on/off-line mode. - - Terminfo description would be something like - -ksm|DVK KSM, - am, bw, dch1=\EP, ich1=\EQ, - acsc=hRiTjXkClJmFnNqUtEuPv\174wKxW.M\054Q\055S\053\136~_{@}Z0\177, - use=vt52, - - To do: - - make Caps Lock work - - verify if pixel stretching is done by hw - - verify details of hw revisions - - baud rate selection (missing feature in bitbanger) - -****************************************************************************/ - -#include "emu.h" - -#include "bus/rs232/rs232.h" -#include "cpu/i8085/i8085.h" -#include "machine/clock.h" -#include "machine/i8251.h" -#include "machine/i8255.h" -#include "machine/ms7004.h" -#include "machine/pic8259.h" - -#define SCREEN_PAGE (80*48) - -#define KSM_TOTAL_HORZ 1000 -#define KSM_DISP_HORZ 800 -#define KSM_HORZ_START 200 - -#define KSM_TOTAL_VERT 28*11 -#define KSM_DISP_VERT 25*11 -#define KSM_VERT_START 2*11 - -#define KSM_STATUSLINE_TOTAL 11 -#define KSM_STATUSLINE_VRAM 0xF8B0 - -#define VERBOSE_DBG 0 /* general debug messages */ - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - - -class ksm_state : public driver_device -{ -public: - ksm_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_pic8259(*this, "pic8259"), - m_i8251line(*this, "i8251line"), - m_rs232(*this, "rs232"), - m_i8251kbd(*this, "i8251kbd"), - m_ms7004(*this, "ms7004"), - m_screen(*this, "screen") - { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER( scanline_callback ); - - DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); - DECLARE_WRITE_LINE_MEMBER(write_line_clock); - - DECLARE_WRITE8_MEMBER(ksm_ppi_porta_w); - DECLARE_WRITE8_MEMBER(ksm_ppi_portc_w); - -private: - UINT32 draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline); - rectangle m_tmpclip; - bitmap_ind16 m_tmpbmp; - - const UINT8 *m_p_chargen; - struct { - UINT8 line; - UINT16 ptr; - } m_video; - -protected: - required_shared_ptr m_p_videoram; - required_device m_maincpu; - required_device m_pic8259; - required_device m_i8251line; - required_device m_rs232; - required_device m_i8251kbd; - required_device m_ms7004; - required_device m_screen; -}; - -static ADDRESS_MAP_START( ksm_mem, AS_PROGRAM, 8, ksm_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE (0x0000, 0x0fff) AM_ROM - AM_RANGE (0x2000, 0x21ff) AM_RAM - AM_RANGE (0xc000, 0xffff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ksm_io, AS_IO, 8, ksm_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE (0x5e, 0x5f) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) - AM_RANGE (0x6e, 0x6e) AM_DEVREADWRITE("i8251kbd", i8251_device, data_r, data_w) - AM_RANGE (0x6f, 0x6f) AM_DEVREADWRITE("i8251kbd", i8251_device, status_r, control_w) - AM_RANGE (0x76, 0x76) AM_DEVREADWRITE("i8251line", i8251_device, data_r, data_w) - AM_RANGE (0x77, 0x77) AM_DEVREADWRITE("i8251line", i8251_device, status_r, control_w) - AM_RANGE (0x78, 0x7b) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ksm ) - PORT_START("SA1") - PORT_DIPNAME(0x01, 0x01, "Stop bits") - PORT_DIPSETTING(0x00, "2 bits") - PORT_DIPSETTING(0x01, "1 bit") - PORT_DIPNAME(0x02, 0x00, "Parity bits") - PORT_DIPSETTING(0x00, "0 bits") - PORT_DIPSETTING(0x02, "1 bit") - PORT_DIPNAME(0x04, 0x00, "Parity check") - PORT_DIPSETTING(0x00, "Off") - PORT_DIPSETTING(0x04, "On") - PORT_DIPNAME(0x08, 0x00, "Interpret controls") - PORT_DIPSETTING(0x00, "Interpret") - PORT_DIPSETTING(0x08, "Display") - PORT_DIPNAME(0x10, 0x00, "Auto wraparound") - PORT_DIPSETTING(0x00, "On") - PORT_DIPSETTING(0x10, "Off") - PORT_DIPNAME(0x20, 0x00, "Auto repeat") - PORT_DIPSETTING(0x00, "On") - PORT_DIPSETTING(0x20, "Off") - PORT_DIPNAME(0x40, 0x00, "Auto CR/LF") - PORT_DIPSETTING(0x00, "Off") - PORT_DIPSETTING(0x40, "On") - PORT_DIPNAME(0x80, 0x00, "Character set") - PORT_DIPSETTING(0x00, "KOI-8 N0/N1") - PORT_DIPSETTING(0x80, "KOI-8 N2") - PORT_START("SA2") - PORT_DIPNAME(0x01, 0x00, "XON/XOFF") - PORT_DIPSETTING(0x00, "Off") - PORT_DIPSETTING(0x01, "On") - PORT_DIPNAME(0x0E, 0x00, "Baud rate") - PORT_DIPSETTING(0x00, "9600") - PORT_DIPSETTING(0x02, "4800") - PORT_DIPSETTING(0x04, "2400") - PORT_DIPSETTING(0x06, "1200") - PORT_DIPSETTING(0x08, "600") - PORT_DIPSETTING(0x0A, "300") - PORT_DIPSETTING(0x0C, "150") - PORT_DIPSETTING(0x0E, "75") -INPUT_PORTS_END - -void ksm_state::machine_reset() -{ - memset(&m_video, 0, sizeof(m_video)); -} - -void ksm_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); - - m_tmpclip = rectangle(0, KSM_DISP_HORZ-1, 0, KSM_DISP_VERT-1); - m_tmpbmp.allocate(KSM_DISP_HORZ, KSM_DISP_VERT); -} - -WRITE8_MEMBER(ksm_state::ksm_ppi_porta_w) -{ - DBG_LOG(1,"PPI port A", ("line %d\n", data)); - m_video.line = data; -} - -WRITE8_MEMBER(ksm_state::ksm_ppi_portc_w) -{ - DBG_LOG(1,"PPI port C", ("blink %d speed %d\n", BIT(data, 7), ((data >> 4) & 7) )); -} - -WRITE_LINE_MEMBER(ksm_state::write_keyboard_clock) -{ -// KSM never sends data to keyboard -// m_i8251kbd->write_txc(state); - m_i8251kbd->write_rxc(state); -} - -WRITE_LINE_MEMBER(ksm_state::write_line_clock) -{ - m_i8251line->write_txc(state); - m_i8251line->write_rxc(state); -} - -/* - Raster size is 28x11 scan lines. - XXX VBlank is active for 2 topmost on-screen rows and 1 at the bottom. - - Usable raster is 800 x 275 pixels (80 x 25 characters). 24 lines are - available to the user and 25th (topmost) line is the status line. - Status line displays current serial port speed and 9 setup bits. - - No character attributes are available, but in 'display controls' mode - control characters stored in memory are shown as blinking chars. - - Character cell is 10 x 11; character generator provides 7 x 8 of that. - 3 extra horizontal pixels are always XXX blank. Blinking XXX cursor may be - displayed on 3 extra scan lines. -*/ - -UINT32 ksm_state::draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline) -{ - UINT8 gfx, fg, bg, ra, blink; - UINT16 x, chr; - - bg = 0; fg = 1; ra = scanline % 8; - blink = (m_screen->frame_number() % 10) > 4; - if (scanline > 7) { - offset -= 0x2000; - } - - for (x = offset; x < offset + 80; x++) - { - chr = m_p_videoram[x] << 3; - gfx = m_p_chargen[chr | ra]; - - if ((scanline > 7 && blink) || ((chr < (0x20<<3)) && !blink)) - gfx = 0; - - *p++ = BIT(gfx, 6) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 0) ? fg : bg; - *p++ = bg; - *p++ = bg; - *p++ = bg; - } - return 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) -{ - UINT16 y = m_screen->vpos(); - UINT16 offset; - - DBG_LOG(2,"scanline_cb", - ("addr %02x frame %d x %.4d y %.3d row %.2d\n", - m_video.line, (int)m_screen->frame_number(), m_screen->hpos(), y, y%11)); - - if (y < KSM_VERT_START) return; - y -= KSM_VERT_START; - if (y >= KSM_DISP_VERT) return; - - if (y < KSM_STATUSLINE_TOTAL) { - offset = KSM_STATUSLINE_VRAM - 0xC000; - } else { - offset = 0x2000 + 0x30 + (((m_video.line + y/11 - 1) % 48) << 7); - } - - draw_scanline(&m_tmpbmp.pix16(y), offset, y%11); -} - -UINT32 ksm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_tmpbmp, 0, 0, KSM_HORZ_START, KSM_VERT_START, cliprect); - return 0; -} - - -/* F4 Character Displayer */ -static const gfx_layout ksm_charlayout = -{ - 7, 8, /* 7x8 pixels in 10x11 cell */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( ksm ) - GFXDECODE_ENTRY("chargen", 0x0000, ksm_charlayout, 0, 1) -GFXDECODE_END - -static MACHINE_CONFIG_START( ksm, ksm_state ) - MCFG_CPU_ADD("maincpu", I8080, XTAL_15_4MHz/10) - MCFG_CPU_PROGRAM_MAP(ksm_mem) - MCFG_CPU_IO_MAP(ksm_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", ksm_state, scanline_callback, attotime::from_hz(50*28*11)) - MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_15_4MHz/KSM_HORZ_START)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(ksm_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_15_4MHz, KSM_TOTAL_HORZ, KSM_HORZ_START, - KSM_HORZ_START+KSM_DISP_HORZ, KSM_TOTAL_VERT, KSM_VERT_START, - KSM_VERT_START+KSM_DISP_VERT); - - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ksm) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), VCC, NULL ) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(ksm_state, ksm_ppi_porta_w)) - MCFG_I8255_IN_PORTB_CB(IOPORT("SA1")) - MCFG_I8255_IN_PORTC_CB(IOPORT("SA2")) - MCFG_I8255_OUT_PORTC_CB(WRITE8(ksm_state, ksm_ppi_portc_w)) - - // serial connection to host - MCFG_DEVICE_ADD( "i8251line", I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251line", i8251_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("i8251line", i8251_device, write_cts)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251line", i8251_device, write_dsr)) - - MCFG_DEVICE_ADD("line_clock", CLOCK, 9600*16) // 8251 is set to /16 on the clock input - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ksm_state, write_line_clock)) - - // serial connection to MS7004 keyboard - MCFG_DEVICE_ADD( "i8251kbd", I8251, 0) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) - - MCFG_DEVICE_ADD("ms7004", MS7004, 0) - MCFG_MS7004_TX_HANDLER(DEVWRITELINE("i8251kbd", i8251_device, write_rxd)) - - // baud rate is supposed to be 4800 but keyboard is slightly faster - MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4960*16) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ksm_state, write_keyboard_clock)) -MACHINE_CONFIG_END - - -/* - Assumes that SRAM is at 0x2000, which is where technical manual puts it. - Chargen has 1 missing pixel in 'G' character. -*/ -ROM_START( dvk_ksm ) - ROM_REGION(0x1000, "maincpu", ROMREGION_ERASE00) - ROM_LOAD( "ksm_04_rom0_d32.bin", 0x0000, 0x0800, CRC(6ad62715) SHA1(20f8f95119bc7fc6e0f16c67864e339a86edb44d)) - ROM_LOAD( "ksm_05_rom1_d33.bin", 0x0800, 0x0800, CRC(5b29bcd2) SHA1(1f4f82c2f88f1e8615ec02076559dc606497e654)) - - ROM_REGION(0x0800, "chargen", ROMREGION_ERASE00) - ROM_LOAD("ksm_03_cg_d31.bin", 0x0000, 0x0800, CRC(98853aa7) SHA1(09b8e1b5b10a00c0b0ae7e36ad1328113d31230a)) -ROM_END - -/* - Assumes that SRAM is at 0x2100, otherwise identical. - Chargen has no missing pixels in 'G' character. -*/ -ROM_START( dvk_ksm01 ) - ROM_REGION(0x1000, "maincpu", ROMREGION_ERASE00) - ROM_LOAD( "ksm_04_rom0_d32.bin", 0x0000, 0x0800, CRC(5276dc9a) SHA1(dd41dfb4cb3f1cf22d96d95f1ff6a27fe4eb9a38)) - ROM_LOAD( "ksm_05_rom1_d33.bin", 0x0800, 0x0800, CRC(5b29bcd2) SHA1(1f4f82c2f88f1e8615ec02076559dc606497e654)) - - ROM_REGION(0x0800, "chargen", ROMREGION_ERASE00) - ROM_LOAD("ksm_03_cg_d31.bin", 0x0000, 0x0800, CRC(98853aa7) SHA1(09b8e1b5b10a00c0b0ae7e36ad1328113d31230a)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, dvk_ksm, 0, 0, ksm, ksm, driver_device, 0, "USSR", "DVK KSM", 0) -COMP( 198?, dvk_ksm01,dvk_ksm,0, ksm, ksm, driver_device, 0, "USSR", "DVK KSM-01", 0) diff --git a/src/mess/drivers/eacc.c b/src/mess/drivers/eacc.c deleted file mode 100644 index 1dbb2228a82..00000000000 --- a/src/mess/drivers/eacc.c +++ /dev/null @@ -1,280 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/****************************************************************************** -* -* EA Car Computer -* by Robbbert, March 2011. -* -* Described in Electronics Australia magazine during 1982. -* Construction and usage: http://messui.the-chronicles.org/comp/eacc.pdf -* -* The only RAM is the 128 bytes that comes inside the CPU. -* -* This computer is mounted in a car, and various sensors (fuel flow, etc) -* are connected up. By pressing the appropriate buttons various statistics -* may be obtained. -* -* Memory Map -* 0000-007F internal ram -* 4000-7FFF ROM -* 8000-BFFF 6821 -* C000-FFFF ROM (mirror) -* -* The ROM was typed in twice from the dump in the magazine article, and the -* results compared. Only one byte was different, so I can be confident that -* it has been typed in properly. -* -* Setting up: You need to enter the number of expected pulses from the fuel -* and distance sensors. Paste this: 5 6M123N 7M400N (start, set litres cal to -* 123 pulses. set km cal to 400 pulses). Then paste this: 1950M0N 1845M0N (set -* petrol tank capacity to 50 litres, set current amount of petrol to 45). -* Now enter: 28M100N (the journey is 100km). Press 5 to start the journey. -* All settings are saved in nvram. -* -* Stats you can see while travelling: -* 0 - time elapsed -* 08 - time remaining -* 1 - fuel used -* 18 - fuel left -* 2 - km travelled -* 28 - km remaining -* 29 - km that could be travelled with the fuel you have left -* 3 - speed now -* 39 - average speed -* 4 - fuel consumption now (litres per 100km) -* 49 - fuel average consumption -* -******************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "eacc.lh" -#include "machine/6821pia.h" -#include "machine/nvram.h" - - -class eacc_state : public driver_device -{ -public: - eacc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pia(*this, "pia"), - m_p_nvram(*this, "nvram") - { } - - DECLARE_READ_LINE_MEMBER( eacc_cb1_r ); - DECLARE_READ_LINE_MEMBER( eacc_distance_r ); - DECLARE_READ_LINE_MEMBER( eacc_fuel_sensor_r ); - DECLARE_READ8_MEMBER( eacc_keyboard_r ); - DECLARE_WRITE_LINE_MEMBER( eacc_cb2_w ); - DECLARE_WRITE8_MEMBER( eacc_digit_w ); - DECLARE_WRITE8_MEMBER( eacc_segment_w ); - bool m_cb1; - bool m_cb2; - bool m_nmi; - required_device m_maincpu; - required_device m_pia; - required_shared_ptr m_p_nvram; - virtual void machine_reset(); - TIMER_DEVICE_CALLBACK_MEMBER(eacc_cb1); - TIMER_DEVICE_CALLBACK_MEMBER(eacc_nmi); -private: - UINT8 m_digit; -}; - - - - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(eacc_mem, AS_PROGRAM, 8, eacc_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xc7ff) // A11,A12,A13 not connected - AM_RANGE(0x0000, 0x001f) AM_RAM AM_SHARE("nvram") // inside cpu, battery-backed - AM_RANGE(0x0020, 0x007f) AM_RAM // inside cpu - AM_RANGE(0x6000, 0x67ff) AM_ROM AM_MIRROR(0x8000) - AM_RANGE(0x8004, 0x8007) AM_MIRROR(0x7fc) AM_DEVREADWRITE("pia", pia6821_device, read, write) -ADDRESS_MAP_END - - -/****************************************************************************** - Input Ports -******************************************************************************/ - -static INPUT_PORTS_START(eacc) - PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 Litres Cal") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('M') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 km") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT( 0xf8, 0, IPT_UNUSED ) - - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 START") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("END") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('N') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 km/h") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT( 0xf8, 0, IPT_UNUSED ) - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 Km Cal") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 hour.min") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 l/100km") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT( 0xf8, 0, IPT_UNUSED ) - - PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 REM") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 litres") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 AV") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT( 0xf8, 0, IPT_UNUSED ) -INPUT_PORTS_END - -void eacc_state::machine_reset() -{ - m_cb2 = 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(eacc_state::eacc_cb1) -{ - m_cb1 ^= 1; // 15hz - if (m_cb2) - m_maincpu->set_input_line(M6800_IRQ_LINE, ASSERT_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(eacc_state::eacc_nmi) -{ - if (m_cb2) - { - m_nmi = true; - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - } -} - -READ_LINE_MEMBER( eacc_state::eacc_cb1_r ) -{ - return (m_cb2) ? m_cb1 : 1; -} - -READ_LINE_MEMBER( eacc_state::eacc_distance_r ) -{ - return machine().rand() & 1; // needs random pulses to simulate movement -} - -READ_LINE_MEMBER( eacc_state::eacc_fuel_sensor_r ) -{ - return machine().rand() & 1; // needs random pulses to simulate fuel usage -} - -WRITE_LINE_MEMBER( eacc_state::eacc_cb2_w ) -{ - m_cb2 = state; -} - -READ8_MEMBER( eacc_state::eacc_keyboard_r ) -{ - UINT8 data = m_digit; - - if (BIT(m_digit, 3)) - data |= ioport("X0")->read(); - if (BIT(m_digit, 4)) - data |= ioport("X1")->read(); - if (BIT(m_digit, 5)) - data |= ioport("X2")->read(); - if (BIT(m_digit, 6)) - data |= ioport("X3")->read(); - - return data; -} - -WRITE8_MEMBER( eacc_state::eacc_segment_w ) -{ - //d7 segment dot - //d6 segment c - //d5 segment d - //d4 segment e - //d3 segment a - //d2 segment b - //d1 segment f - //d0 segment g - - if (!m_nmi) - { - UINT8 i; - if (BIT(m_digit, 7)) - { - char lednum[6]; - data ^= 0xff; - - for (i = 0; i < 8; i++) - { - sprintf(lednum,"led%d",i); - output_set_value(lednum, BIT(data, i)); - } - } - else - { - for (i = 3; i < 7; i++) - if (BIT(m_digit, i)) - output_set_digit_value(i, BITSWAP8(data, 7, 0, 1, 4, 5, 6, 2, 3)); - } - } -} - -WRITE8_MEMBER( eacc_state::eacc_digit_w ) -{ - if (m_nmi) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - m_nmi = false; - } - m_digit = data & 0xf8; -} - - -/****************************************************************************** - Machine Drivers -******************************************************************************/ - -static MACHINE_CONFIG_START( eacc, eacc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6802, XTAL_3_579545MHz) /* Divided by 4 inside the m6802*/ - MCFG_CPU_PROGRAM_MAP(eacc_mem) - - MCFG_DEFAULT_LAYOUT(layout_eacc) - - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(eacc_state, eacc_keyboard_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(eacc_state, eacc_distance_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(eacc_state, eacc_cb1_r)) - MCFG_PIA_READCA2_HANDLER(READLINE(eacc_state, eacc_fuel_sensor_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(eacc_state, eacc_segment_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(eacc_state, eacc_digit_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(eacc_state, eacc_cb2_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6802_cpu_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6802_cpu_device, irq_line)) - - MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_TIMER_DRIVER_ADD_PERIODIC("eacc_nmi", eacc_state, eacc_nmi, attotime::from_hz(600)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("eacc_cb1", eacc_state, eacc_cb1, attotime::from_hz(30)) -MACHINE_CONFIG_END - - - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -ROM_START(eacc) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("eacc.bin", 0x4000, 0x0800, CRC(287a63c0) SHA1(f61b397d33ea40e5742e34d5f5468572125e8b39) ) -ROM_END - - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, eacc, 0, 0, eacc, eacc, driver_device, 0, "Electronics Australia", "EA Car Computer", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/ec184x.c b/src/mess/drivers/ec184x.c deleted file mode 100644 index e6552e7ac0c..00000000000 --- a/src/mess/drivers/ec184x.c +++ /dev/null @@ -1,387 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - drivers/ec184x.c - - Driver file for EC-184x series - - TODO (ec1840) - - memory bank size is smaller (128K) - - TODO (ec1841) - - hard disk is connected but requires changes to isa_hdc.c - -***************************************************************************/ - - -#include "emu.h" - -#include "includes/genpc.h" - -#include "bus/isa/xsu_cards.h" -#include "bus/pc_kbd/keyboards.h" -#include "cpu/i86/i86.h" -#include "machine/ram.h" - -#define VERBOSE_DBG 1 /* general debug messages */ - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - - - -class ec184x_state : public driver_device -{ -public: - ec184x_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - required_device m_maincpu; - - DECLARE_MACHINE_RESET(ec184x); - DECLARE_DRIVER_INIT(ec184x); - - struct { - UINT8 enable[4]; - int boards; - int board_size; - } m_memory; - - DECLARE_READ8_MEMBER(memboard_r); - DECLARE_WRITE8_MEMBER(memboard_w); -}; - -/* - * EC-1841 memory controller. The machine can hold four memory boards; - * each board has a control register, its address is set by a DIP switch - * on the board itself. - * - * Only one board should be enabled for read, and one for write. - * Normally, this is the same board. - * - * Each board is divided into 4 banks, internally numbererd 0..3. - * POST tests each board on startup, and an error (indicated by - * I/O CH CK bus signal) causes it to disable failing bank(s) by writing - * 'reconfiguration code' (inverted number of failing memory bank) to - * the register. - - * bit 1-0 'reconfiguration code' - * bit 2 enable read access - * bit 3 enable write access - */ - -READ8_MEMBER(ec184x_state::memboard_r) -{ - UINT8 data; - - data = offset % 4; - if (data > m_memory.boards) - data = 0xff; - else - data = m_memory.enable[data]; - DBG_LOG(1,"ec1841_memboard",("R (%d of %d) == %02X\n", offset, m_memory.boards, data )); - - return data; -} - -WRITE8_MEMBER(ec184x_state::memboard_w) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - ram_device *m_ram = machine().device(RAM_TAG); - UINT8 current; - - current = m_memory.enable[offset]; - - DBG_LOG(1,"ec1841_memboard",("W (%d of %d) <- %02X (%02X)\n", offset, m_memory.boards, data, current)); - - if (offset > m_memory.boards) { - return; - } - - if (BIT(current, 2) && !BIT(data, 2)) { - // disable read access - program.unmap_read(0, m_memory.board_size-1); - DBG_LOG(1,"ec1841_memboard_w",("unmap_read(%d)\n", offset)); - } - - if (BIT(current, 3) && !BIT(data, 3)) { - // disable write access - program.unmap_write(0, 0x7ffff); - DBG_LOG(1,"ec1841_memboard_w",("unmap_write(%d)\n", offset)); - } - - if (!BIT(current, 2) && BIT(data, 2)) { - for(int i=0; i<4; i++) - m_memory.enable[i] &= 0xfb; - // enable read access - membank("bank10")->set_base(m_ram->pointer() + offset*0x80000); - program.install_read_bank(0, m_memory.board_size-1, "bank10"); - DBG_LOG(1,"ec1841_memboard_w",("map_read(%d)\n", offset)); - } - - if (!BIT(current, 3) && BIT(data, 3)) { - for(int i=0; i<4; i++) - m_memory.enable[i] &= 0xf7; - // enable write access - membank("bank20")->set_base(m_ram->pointer() + offset*0x80000); - program.install_write_bank(0, m_memory.board_size-1, "bank20"); - DBG_LOG(1,"ec1841_memboard_w",("map_write(%d)\n", offset)); - } - - m_memory.enable[offset] = data; -} - -DRIVER_INIT_MEMBER( ec184x_state, ec184x ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - ram_device *m_ram = machine().device(RAM_TAG); - - m_memory.board_size = 512 * 1024; // XXX - m_memory.boards = m_ram->size()/m_memory.board_size - 1; - if (m_memory.boards > 3) - m_memory.boards = 3; - - program.install_read_bank(0, m_memory.board_size-1, "bank10"); - program.install_write_bank(0, m_memory.board_size-1, "bank20"); - membank( "bank10" )->set_base( m_ram->pointer() ); - membank( "bank20" )->set_base( m_ram->pointer() ); -} - -MACHINE_RESET_MEMBER( ec184x_state, ec184x ) -{ - memset(m_memory.enable, 0, sizeof(m_memory.enable)); - // mark 1st board enabled - m_memory.enable[0] = 0xc; -} - - -static ADDRESS_MAP_START( ec1840_map, AS_PROGRAM, 8, ec184x_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x7ffff) AM_RAM - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xdc000, 0xdffff) AM_RAM - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ec1841_map, AS_PROGRAM, 16, ec184x_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x7ffff) AM_RAM - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ec1847_map, AS_PROGRAM, 8, ec184x_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xdc000, 0xdffff) AM_RAM - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ec1840_io, AS_IO, 8, ec184x_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ec1841_io, AS_IO, 16, ec184x_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x02b0, 0x02b3) AM_READWRITE8(memboard_r, memboard_w, 0xffff); -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ec1847_io, AS_IO, 8, ec184x_state ) - ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0x0210, 0x021f) AM_RAM // internal (non-standard?) bus extender -ADDRESS_MAP_END - - -static INPUT_PORTS_START( ec1841 ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START( ec1840 ) - DEVICE_INPUT_DEFAULTS("DSW0", 0x31, 0x21) -DEVICE_INPUT_DEFAULTS_END - -static DEVICE_INPUT_DEFAULTS_START( ec1841 ) - DEVICE_INPUT_DEFAULTS("DSW0", 0x31, 0x21) -DEVICE_INPUT_DEFAULTS_END - -static DEVICE_INPUT_DEFAULTS_START( ec1847 ) - DEVICE_INPUT_DEFAULTS("DSW0", 0x31, 0x31) -DEVICE_INPUT_DEFAULTS_END - -// XXX verify everything -static MACHINE_CONFIG_START( ec1840, ec184x_state ) - MCFG_CPU_ADD("maincpu", I8088, 4096000) - MCFG_CPU_PROGRAM_MAP(ec1840_map) - MCFG_CPU_IO_MAP(ec1840_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5150_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(ec1840) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", ec184x_isa8_cards, "ec1840.0002", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", ec184x_isa8_cards, "ec1841.0003", false) // actually ec1840.0003 -- w/o mouse port - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", ec184x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", ec184x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", ec184x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", ec184x_isa8_cards, NULL, false) - - MCFG_SOFTWARE_LIST_ADD("flop_list","ec1841") - - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ec1841, ec184x_state ) - MCFG_CPU_ADD("maincpu", I8086, 4096000) - MCFG_CPU_PROGRAM_MAP(ec1841_map) - MCFG_CPU_IO_MAP(ec1841_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_MACHINE_RESET_OVERRIDE(ec184x_state, ec184x) - - MCFG_EC1841_MOTHERBOARD_ADD("mb", "maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(ec1841) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", ec184x_isa8_cards, "ec1841.0002", false) // cga - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", ec184x_isa8_cards, "ec1841.0003", false) // fdc + mouse port - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", ec184x_isa8_cards, "hdc", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", ec184x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", ec184x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", ec184x_isa8_cards, NULL, false) - - MCFG_SOFTWARE_LIST_ADD("flop_list","ec1841") - - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_EXTRA_OPTIONS("1024K,1576K,2048K") // 640K variant not emulated -MACHINE_CONFIG_END - -// XXX verify everything -static MACHINE_CONFIG_START( ec1847, ec184x_state ) - MCFG_CPU_ADD("maincpu", I8088, 4772720) - MCFG_CPU_PROGRAM_MAP(ec1847_map) - MCFG_CPU_IO_MAP(ec1847_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(ec1847) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "hercules", false) // cga, ega and vga(?) are options too - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) // native variant (wd1010 + z80) not emulated - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, NULL, false) // native serial (2x8251) not emulated - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) - - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - -ROM_START( ec1840 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_DEFAULT_BIOS("v4") - // supports MDA only - ROM_SYSTEM_BIOS(0, "v1", "EC-1840.01") - ROMX_LOAD( "000-01.bin", 0xfe000, 0x0800, CRC(c3ab1fad) SHA1(8168bdee30698f4f9aa7bbb6dfabe62dd723cec5), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "001-01.bin", 0xff000, 0x0800, CRC(601d1155) SHA1(9684d33b92743749704587a48e679ef7a3b20f9c), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "002-01.bin", 0xfe001, 0x0800, CRC(ce4dddb7) SHA1(f9b1da60c848e68ff1c154d695a36a0833de4804), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "003-01.bin", 0xff001, 0x0800, CRC(14b40431) SHA1(ce7fffa41897405ee64fd4e86015e774f8bd108a), ROM_SKIP(1) | ROM_BIOS(1)) - - ROM_SYSTEM_BIOS(1, "v4", "EC-1840.04") - ROMX_LOAD( "000-04-971b.bin", 0xfe000, 0x0800, CRC(06aeaee8) SHA1(9f954e4c48156d573a8e0109e7ca652be9e6036a), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "001-04-92b7.bin", 0xff000, 0x0800, CRC(3fae650a) SHA1(c98b777fdeceadd72d6eb9465b3501b9ead55a08), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "002-04-9e17.bin", 0xfe001, 0x0800, CRC(d59712df) SHA1(02ea1b3ae9662f5c64c58920a32ca9db0f6fbd12), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "003-04-3ccb.bin", 0xff001, 0x0800, CRC(7fc362c7) SHA1(538e13639ad2b4c30bd72582e323181e63513306), ROM_SKIP(1) | ROM_BIOS(2)) - - ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) -ROM_END - -ROM_START( ec1841 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_DEFAULT_BIOS("v2") - ROM_SYSTEM_BIOS(0, "v1", "EC-1841.01") - ROMX_LOAD( "012-01-3107.bin", 0xfc000, 0x0800, CRC(77957396) SHA1(785f1dceb6e2b4618f5c5f0af15eb74a8c951448), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "013-01-203f.bin", 0xfc001, 0x0800, CRC(768bd3d5) SHA1(2e948f2ad262de306d889b7964c3f1aad45ff5bc), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "014-01-fa40.bin", 0xfd000, 0x0800, CRC(47722b58) SHA1(a6339ee8af516f834826b7828a5cf79cb650480c), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "015-01-bf1d.bin", 0xfd001, 0x0800, CRC(b585b5ea) SHA1(d0ebed586eb13031477c2e071c50416682f80489), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "016-01-65f7.bin", 0xfe000, 0x0800, CRC(28a07db4) SHA1(17fbcd60dacd1d3f8d8355db429f97e4d1d1ac88), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "017-01-5be1.bin", 0xfe001, 0x0800, CRC(928bda26) SHA1(ee889184067e2680b29a8ef1c3a76cf5afd4c78d), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "018-01-7090.bin", 0xff000, 0x0800, CRC(75ca7d7e) SHA1(6356426820c5326a7893a437d54b02f250ef8609), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "019-01-0492.bin", 0xff001, 0x0800, CRC(8a9d593e) SHA1(f3936d2cb4e6d130dd732973f126c3aa20612463), ROM_SKIP(1) | ROM_BIOS(1)) - - ROM_SYSTEM_BIOS(1, "v2", "EC-1841.02") - ROMX_LOAD( "012-02-37f6.bin", 0xfc000, 0x0800, CRC(8f5c6a20) SHA1(874b62f9cee8d3b974f33732f94eff10fc002c44), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "013-02-2552.bin", 0xfc001, 0x0800, CRC(e3c10128) SHA1(d6ed743ebe9c130925c9f17aad1a45db9194c967), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "014-02-0fbe.bin", 0xfd000, 0x0800, CRC(f8517e5e) SHA1(8034cd6ff5778365dc9daa494524f1753a74f1ed), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "015-02-d736.bin", 0xfd001, 0x0800, CRC(8538c52a) SHA1(ee981ce90870b6546a18f2a2e64d71b0038ce0dd), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "016-02-5b2c.bin", 0xfe000, 0x0800, CRC(3d1d1e67) SHA1(c527e29796537787c0f6c329f3c203f6131ca77f), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "017-02-4b9d.bin", 0xfe001, 0x0800, CRC(1b985264) SHA1(5ddcb9c13564be208c5068c105444a87159c67ee), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "018-02-7090.bin", 0xff000, 0x0800, CRC(75ca7d7e) SHA1(6356426820c5326a7893a437d54b02f250ef8609), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "019-02-0493.bin", 0xff001, 0x0800, CRC(61aae23d) SHA1(7b3aa24a63ee31b194297eb1e61c3827edfcb95a), ROM_SKIP(1) | ROM_BIOS(2)) - - ROM_SYSTEM_BIOS(2, "v3", "EC-1841.03") - ROMX_LOAD( "012-03-37e7.bin", 0xfc000, 0x0800, CRC(49992bd5) SHA1(119121e1b4af1c44b9b8c2edabe7dc1d3019c4a6), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "013-03-2554.bin", 0xfc001, 0x0800, CRC(834bd7d7) SHA1(e37514fc4cb8a5cbe68e7564e0e07d5116c4021a), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "014-03-0fbe.bin", 0xfd000, 0x0800, CRC(f8517e5e) SHA1(8034cd6ff5778365dc9daa494524f1753a74f1ed), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "015-03-d736.bin", 0xfd001, 0x0800, CRC(8538c52a) SHA1(ee981ce90870b6546a18f2a2e64d71b0038ce0dd), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "016-03-5b2c.bin", 0xfe000, 0x0800, CRC(3d1d1e67) SHA1(c527e29796537787c0f6c329f3c203f6131ca77f), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "017-03-4b9d.bin", 0xfe001, 0x0800, CRC(1b985264) SHA1(5ddcb9c13564be208c5068c105444a87159c67ee), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "018-03-7090.bin", 0xff000, 0x0800, CRC(75ca7d7e) SHA1(6356426820c5326a7893a437d54b02f250ef8609), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "019-03-0493.bin", 0xff001, 0x0800, CRC(61aae23d) SHA1(7b3aa24a63ee31b194297eb1e61c3827edfcb95a), ROM_SKIP(1) | ROM_BIOS(3)) -ROM_END - -ROM_START( ec1845 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROMX_LOAD( "184500.bin", 0xfc000, 0x0800, CRC(7c472ef7) SHA1(3af53f27b49bbc731bf51f9300fbada23a1bfcfc), ROM_SKIP(1)) - ROMX_LOAD( "184501.bin", 0xfc001, 0x0800, CRC(db240dc6) SHA1(d7bb022213d09bbf2a8107fe4f1cd27b23939e18), ROM_SKIP(1)) - ROMX_LOAD( "184502.bin", 0xfd000, 0x0800, CRC(149e7e29) SHA1(7f2a297588fef1bc750c57e6ae0d5acf3d27c486), ROM_SKIP(1)) - ROMX_LOAD( "184503.bin", 0xfd001, 0x0800, CRC(e28cbd74) SHA1(cf1fba4e67c8e1dd8cdda547118e84b704029b03), ROM_SKIP(1)) - ROMX_LOAD( "184504.bin", 0xfe000, 0x0800, CRC(55fa7a1d) SHA1(58f7abab08b9d2f0a1c1636e11bb72af2694c95f), ROM_SKIP(1)) - ROMX_LOAD( "184505.bin", 0xfe001, 0x0800, CRC(c807e3f5) SHA1(08117e449f0d04f96041cff8d34893f500f3760d), ROM_SKIP(1)) - ROMX_LOAD( "184506.bin", 0xff000, 0x0800, CRC(24f5c27c) SHA1(7822dd7f715ef00ccf6d8408be8bbfe01c2eba20), ROM_SKIP(1)) - ROMX_LOAD( "184507.bin", 0xff001, 0x0800, CRC(75122203) SHA1(7b0fbdf1315230633e39574ac7360163bc7361e1), ROM_SKIP(1)) -ROM_END - -ROM_START( ec1847 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "vXXX", "EC-1847.0x") - ROMX_LOAD( "308_d47_2764.bin", 0xc8000, 0x2000, CRC(f06924f2) SHA1(83a5dedf1c06f875c598f087bbc087524bc9bfa3), ROM_BIOS(1)) - ROMX_LOAD( "188m_d47_2764.bin", 0xf4000, 0x2000, CRC(bc8742c7) SHA1(3af09d14e891e976b7a9a2a6e1af63f0eabe5426), ROM_BIOS(1)) - ROMX_LOAD( "188m_d48_2764.bin", 0xfe000, 0x2000, CRC(7d290e95) SHA1(e73e6c8e19477fce5de3f95b89693dc6ad6781ab), ROM_BIOS(1)) - - ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) - ROM_LOAD( "317_d28_2732.bin", 0x00000, 0x1000, CRC(8939599b) SHA1(53d02460cf93596882a96758ef4bac5fa1ce55b2)) // monochrome font -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR ROM NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1987, ec1840, ibm5150, 0, ec1840, ec1841, ec184x_state, ec184x, "", "EC-1840", MACHINE_NOT_WORKING) -COMP ( 1987, ec1841, ibm5150, 0, ec1841, ec1841, ec184x_state, ec184x, "", "EC-1841", 0) -COMP ( 1989, ec1845, ibm5150, 0, ec1841, ec1841, ec184x_state, ec184x, "", "EC-1845", MACHINE_NOT_WORKING) -COMP ( 1990, ec1847, ibm5150, 0, ec1847, ec1841, driver_device, 0, "", "EC-1847", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/ec65.c b/src/mess/drivers/ec65.c deleted file mode 100644 index 4f0fc30580e..00000000000 --- a/src/mess/drivers/ec65.c +++ /dev/null @@ -1,250 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - EC-65 - - 16/07/2009 Initial driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "cpu/g65816/g65816.h" -#include "video/mc6845.h" -#include "machine/6821pia.h" -#include "machine/6522via.h" -#include "machine/mos6551.h" -#include "machine/6850acia.h" -#include "machine/keyboard.h" - -#define PIA6821_TAG "pia6821" -#define ACIA6850_TAG "acia6850" -#define ACIA6551_TAG "acia6551" -#define VIA6522_0_TAG "via6522_0" -#define VIA6522_1_TAG "via6522_1" -#define MC6845_TAG "mc6845" -#define KEYBOARD_TAG "keyboard" - -class ec65_state : public driver_device -{ -public: - ec65_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_via_0(*this, VIA6522_0_TAG), - m_via_1(*this, VIA6522_1_TAG), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - MC6845_UPDATE_ROW(crtc_update_row); - UINT8 *m_p_chargen; - required_device m_via_0; - required_device m_via_1; - required_shared_ptr m_p_videoram; - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; - required_device m_palette; -}; - -class ec65k_state : public driver_device -{ -public: - ec65k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - { - } -}; - -static ADDRESS_MAP_START(ec65_mem, AS_PROGRAM, 8, ec65_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write) - AM_RANGE(0xe010, 0xe010) AM_DEVREADWRITE(ACIA6850_TAG, acia6850_device, status_r, control_w) - AM_RANGE(0xe011, 0xe011) AM_DEVREADWRITE(ACIA6850_TAG, acia6850_device, data_r, data_w) - AM_RANGE(0xe100, 0xe10f) AM_DEVREADWRITE(VIA6522_0_TAG, via6522_device, read, write) - AM_RANGE(0xe110, 0xe11f) AM_DEVREADWRITE(VIA6522_1_TAG, via6522_device, read, write) - AM_RANGE(0xe130, 0xe133) AM_DEVREADWRITE(ACIA6551_TAG, mos6551_device, read, write) - AM_RANGE(0xe140, 0xe140) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) - AM_RANGE(0xe141, 0xe141) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r , register_w) - AM_RANGE(0xe400, 0xe7ff) AM_RAM // 1KB on-board RAM - AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ec65k_mem, AS_PROGRAM, 8, ec65_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xe7ff) AM_RAM - AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ec65 ) -INPUT_PORTS_END - -WRITE8_MEMBER( ec65_state::kbd_put ) -{ - if (data) - { - m_via_0->write_pa0((data>>0)&1); - m_via_0->write_pa1((data>>1)&1); - m_via_0->write_pa2((data>>2)&1); - m_via_0->write_pa3((data>>3)&1); - m_via_0->write_pa4((data>>4)&1); - m_via_0->write_pa5((data>>5)&1); - m_via_0->write_pa6((data>>6)&1); - m_via_0->write_pa7((data>>7)&1); - m_via_0->write_ca1(1); - m_via_0->write_ca1(0); - } -} - -void ec65_state::machine_reset() -{ - m_via_1->write_pb0(1); - m_via_1->write_pb1(1); - m_via_1->write_pb2(1); - m_via_1->write_pb3(1); - m_via_1->write_pb4(1); - m_via_1->write_pb5(1); - m_via_1->write_pb6(1); - m_via_1->write_pb7(1); -} - -void ec65_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -MC6845_UPDATE_ROW( ec65_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,inv; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; - - /* Display a scanline of a character */ - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} - -/* F4 Character Displayer */ -static const gfx_layout ec65_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( ec65 ) - GFXDECODE_ENTRY( "chargen", 0x0000, ec65_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( ec65, ec65_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6502, XTAL_4MHz / 4) - MCFG_CPU_PROGRAM_MAP(ec65_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) - MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ec65) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, "screen", XTAL_16MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) /*?*/ - MCFG_MC6845_UPDATE_ROW_CB(ec65_state, crtc_update_row) - - /* devices */ - MCFG_DEVICE_ADD(PIA6821_TAG, PIA6821, 0) - - MCFG_DEVICE_ADD(ACIA6850_TAG, ACIA6850, 0) - - MCFG_DEVICE_ADD(VIA6522_0_TAG, VIA6522, XTAL_4MHz / 4) - - MCFG_DEVICE_ADD(VIA6522_1_TAG, VIA6522, XTAL_4MHz / 4) - - MCFG_DEVICE_ADD(ACIA6551_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(ec65_state, kbd_put)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ec65k, ec65k_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",G65816, XTAL_4MHz) // can use 4,2 or 1 MHz - MCFG_CPU_PROGRAM_MAP(ec65k_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) - MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ec65) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, "screen", XTAL_16MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) /*?*/ -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ec65 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ec65.ic6", 0xf000, 0x1000, CRC(acd928ed) SHA1(e02a688a057ff77294717cf7b887425fed0b1153)) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "chargen.ic19", 0x0000, 0x1000, CRC(9b56a28d) SHA1(41c04fd9fb542c50287bc0e366358a61fc4b0cd4)) // Located on VDU card -ROM_END - -ROM_START( ec65k ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ec65k.ic19", 0xf000, 0x1000, CRC(5e5a890a) SHA1(daa006f2179fd156833e11c73b37881cafe5dede)) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "chargen.ic19", 0x0000, 0x1000, CRC(9b56a28d) SHA1(41c04fd9fb542c50287bc0e366358a61fc4b0cd4)) // Located on VDU card -ROM_END -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, ec65, 0, 0, ec65, ec65, driver_device, 0, "Elektor Electronics", "EC-65", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1985, ec65k, ec65, 0, ec65k, ec65, driver_device, 0, "Elektor Electronics", "EC-65K", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/einstein.c b/src/mess/drivers/einstein.c deleted file mode 100644 index c0c6190c76c..00000000000 --- a/src/mess/drivers/einstein.c +++ /dev/null @@ -1,833 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Dirk Best, Phill Harvey-Smith -/****************************************************************************** - - Tatung Einstein - - TMS9129 VDP Graphics - 16k ram - - Z80 CPU (4 MHz) - - Z80 CTC (4 MHz) - channel 0 is serial transmit clock - channel 1 is serial receive clock - trigger for channel 0,1 and 2 is a 2 MHz clock - trigger for channel 3 is the terminal count of channel 2 - - Intel 8251 Serial (2 MHz clock?) - - WD1770 Floppy Disc controller - density is fixed, 4 drives and double sided supported - - AY-3-8910 PSG (2 MHz) - port A and port B are connected to the keyboard. Port A is keyboard - line select, Port B is data. - - printer connected to port A of PIO. /ACK from printer is connected to /ASTB. - D7-D0 of PIO port A is printer data lines. - ARDY of PIO is connected to /STROBE on printer. - - user port is port B of PIO - keyboard connected to port A and port B of PSG - - TODO: - - The ADC is not emulated! - - printer emulation needs checking! - - Many thanks to Chris Coxall for the schematics of the TC-01, the dump of the - system rom and a dump of a Xtal boot disc. - - Many thanks to Andrew Dunipace for his help with the 80-column card - and Speculator hardware (Spectrum emulator). - - Kevin Thacker [MESS driver] - - - 2011-Mar-14, Phill Harvey-Smith. - Having traced out the circuit of the TK02 80 coumn card, I have changed the - emulation to match what the hardware does, the emulation was mostly correct, - just some minor issues with the addressing of the VRAM, and bit 0 of the - status register is the latched output of the 6845 DE, and not vblank. - - Also added defines to stop the log being flooded with keyboard messages :) - - ******************************************************************************/ - -#include "emu.h" -#include "machine/z80pio.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "sound/ay8910.h" -#include "rendlay.h" -#include "includes/einstein.h" - -#define VERBOSE_KEYBOARD 0 -#define VERBOSE_DISK 0 - -/*************************************************************************** - 80 COLUMN DEVICE -***************************************************************************/ - -/* lower 3 bits of address define a 256-byte "row". - * upper 8 bits define the offset in the row, - * data bits define data to write - */ -WRITE8_MEMBER(einstein_state::einstein_80col_ram_w) -{ - m_crtc_ram[((offset & 0x07) << 8) | ((offset >> 8) & 0xff)] = data; -} - -READ8_MEMBER(einstein_state::einstein_80col_ram_r) -{ - return m_crtc_ram[((offset & 0x07) << 8) | ((offset >> 8) & 0xff)]; -} - -/* TODO: Verify implementation */ -/* From traces of the TK02 board character ROM is addressed by the 6845 as follows - bit 0..2 ra0..ra2 - bit 3..10 data 0..7 from VRAM - bit 11 ra3 - bit 12 jumper M004, this could be used to select two different character - sets. -*/ -MC6845_UPDATE_ROW( einstein_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 *data = m_region_gfx1->base(); - UINT8 char_code, data_byte; - int i, x; - - for (i = 0, x = 0; i < x_count; i++, x += 8) - { - char_code = m_crtc_ram[(ma + i) & 0x07ff]; - data_byte = data[(char_code << 3) + (ra & 0x07) + ((ra & 0x08) << 8)]; - - bitmap.pix32(y, x + 0) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 7)]; - bitmap.pix32(y, x + 1) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 6)]; - bitmap.pix32(y, x + 2) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 5)]; - bitmap.pix32(y, x + 3) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 4)]; - bitmap.pix32(y, x + 4) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 3)]; - bitmap.pix32(y, x + 5) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 2)]; - bitmap.pix32(y, x + 6) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 1)]; - bitmap.pix32(y, x + 7) = palette[TMS9928A_PALETTE_SIZE + BIT(data_byte, 0)]; - } -} - -WRITE_LINE_MEMBER(einstein_state::einstein_6845_de_changed) -{ - m_de=state; -} - -/* bit 0 - latched display enabled (DE) from 6845 - * bit 1 - Jumper M003 0 = 40 column mode (color monitor), 1 = 80 column mode (b/w monitor) - * bit 2 - Jumper M002 0 = 50Hz, 1 = 60Hz - * bit 3 - Jumper M001 0 = ???, 1=??? perminently wired high on both the boards I have seen - PHS. - */ -READ8_MEMBER(einstein_state::einstein_80col_state_r) -{ - UINT8 result = 0; - - result |= m_de; - result |= m_80column_dips->read() & 0x06; - - return result; -} - -/* int priority */ -/* keyboard int->ctc/adc->pio */ -static const z80_daisy_config einstein_daisy_chain[] = -{ - { "keyboard_daisy" }, - { IC_I058 }, - { "adc_daisy" }, - { IC_I063 }, - { "fire_daisy" }, - { NULL } -}; - - -/*************************************************************************** - KEYBOARD -***************************************************************************/ - -/* refresh keyboard data. It is refreshed when the keyboard line is written */ -void einstein_state::einstein_scan_keyboard() -{ - UINT8 data = 0xff; - - if (!BIT(m_keyboard_line, 0)) data &= m_line0->read(); - if (!BIT(m_keyboard_line, 1)) data &= m_line1->read(); - if (!BIT(m_keyboard_line, 2)) data &= m_line2->read(); - if (!BIT(m_keyboard_line, 3)) data &= m_line3->read(); - if (!BIT(m_keyboard_line, 4)) data &= m_line4->read(); - if (!BIT(m_keyboard_line, 5)) data &= m_line5->read(); - if (!BIT(m_keyboard_line, 6)) data &= m_line6->read(); - if (!BIT(m_keyboard_line, 7)) data &= m_line7->read(); - - m_keyboard_data = data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(einstein_state::einstein_keyboard_timer_callback) -{ - /* re-scan keyboard */ - einstein_scan_keyboard(); - - /* if /fire1 or /fire2 is 0, signal a fire interrupt */ - if ((m_buttons->read() & 0x03) != 0) - { - m_interrupt |= EINSTEIN_FIRE_INT; - } - - /* keyboard data changed? */ - if (m_keyboard_data != 0xff) - { - /* generate interrupt */ - m_interrupt |= EINSTEIN_KEY_INT; - } -} - -WRITE8_MEMBER(einstein_state::einstein_keyboard_line_write) -{ - if (VERBOSE_KEYBOARD) - logerror("einstein_keyboard_line_write: %02x\n", data); - - m_keyboard_line = data; - - /* re-scan the keyboard */ - einstein_scan_keyboard(); -} - -READ8_MEMBER(einstein_state::einstein_keyboard_data_read) -{ - /* re-scan the keyboard */ - einstein_scan_keyboard(); - - if (VERBOSE_KEYBOARD) - logerror("einstein_keyboard_data_read: %02x\n", m_keyboard_data); - - return m_keyboard_data; -} - - -/*************************************************************************** - FLOPPY DRIVES -***************************************************************************/ - -WRITE8_MEMBER(einstein_state::einstein_drsel_w) -{ - if(VERBOSE_DISK) - logerror("%s: einstein_drsel_w %02x\n", machine().describe_context(), data); - - /* bit 0 to 3 select the drive */ - static const char *names[] = { IC_I042 ":0", IC_I042 ":1", IC_I042 ":2", IC_I042 ":3" }; - floppy_image_device *floppy = 0; - for(int i=0; i<4; i++) { - if(BIT(data, i)) { - floppy_connector *con = machine().device(names[i]); - if(con) - floppy = con->get_device(); - } - } - - /* double sided drive connected? */ - if (m_config->read() & data) - { - /* bit 4 selects the side then */ - //floppy->ss_w(BIT(data, 4)); - } - if (floppy) floppy->ss_w(0); - m_fdc->set_floppy(floppy); -} - - -/*************************************************************************** - CTC -***************************************************************************/ - -/* channel 0 and 1 have a 2 MHz input clock for triggering */ -TIMER_DEVICE_CALLBACK_MEMBER(einstein_state::einstein_ctc_trigger_callback) -{ - /* toggle line status */ - m_ctc_trigger ^= 1; - - m_ctc->trg0(m_ctc_trigger); - m_ctc->trg1(m_ctc_trigger); -} - - -/*************************************************************************** - UART -***************************************************************************/ - -WRITE_LINE_MEMBER(einstein_state::einstein_serial_transmit_clock) -{ - m_uart->write_txc(state); -} - -WRITE_LINE_MEMBER(einstein_state::einstein_serial_receive_clock) -{ - m_uart->write_rxc(state); -} - - -/*************************************************************************** - MEMORY BANKING -***************************************************************************/ - -void einstein_state::einstein_page_rom() -{ - m_bank1->set_base(m_rom_enabled ? m_region_bios->base() : m_ram->pointer()); -} - -/* writing to this port is a simple trigger, and switches between RAM and ROM */ -WRITE8_MEMBER(einstein_state::einstein_rom_w) -{ - m_rom_enabled ^= 1; - einstein_page_rom(); -} - - -/*************************************************************************** - INTERRUPTS -***************************************************************************/ - -WRITE_LINE_MEMBER(einstein_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER(einstein_state::write_centronics_perror) -{ - m_centronics_perror = state; -} - -WRITE_LINE_MEMBER(einstein_state::write_centronics_fault) -{ - m_centronics_fault = state; -} - -READ8_MEMBER(einstein_state::einstein_kybintmsk_r) -{ - UINT8 data = 0; - - /* clear key int. a read of this I/O port will do this or a reset */ - m_interrupt &= ~EINSTEIN_KEY_INT; - - /* bit 0 and 1: fire buttons on the joysticks */ - data |= m_buttons->read(); - - /* bit 2 to 4: printer status */ - data |= m_centronics_busy << 2; - data |= m_centronics_perror << 3; - data |= m_centronics_fault << 4; - - /* bit 5 to 7: graph, control and shift key */ - data |= m_extra->read(); - - if(VERBOSE_KEYBOARD) - logerror("%s: einstein_kybintmsk_r %02x\n", machine().describe_context(), data); - - return data; -} - -WRITE8_MEMBER(einstein_state::einstein_kybintmsk_w) -{ - logerror("%s: einstein_kybintmsk_w %02x\n", machine().describe_context(), data); - - /* set mask from bit 0 */ - if (data & 0x01) - { - logerror("key int is disabled\n"); - m_interrupt_mask &= ~EINSTEIN_KEY_INT; - } - else - { - logerror("key int is enabled\n"); - m_interrupt_mask |= EINSTEIN_KEY_INT; - } -} - -/* writing to this I/O port sets the state of the mask; D0 is used */ -/* writing 0 enables the /ADC interrupt */ -WRITE8_MEMBER(einstein_state::einstein_adcintmsk_w) -{ - logerror("%s: einstein_adcintmsk_w %02x\n", machine().describe_context(), data); - - if (data & 0x01) - { - logerror("adc int is disabled\n"); - m_interrupt_mask &= ~EINSTEIN_ADC_INT; - } - else - { - logerror("adc int is enabled\n"); - m_interrupt_mask |= EINSTEIN_ADC_INT; - } -} - -/* writing to this I/O port sets the state of the mask; D0 is used */ -/* writing 0 enables the /FIRE interrupt */ -WRITE8_MEMBER(einstein_state::einstein_fire_int_w) -{ - logerror("%s: einstein_fire_int_w %02x\n", machine().describe_context(), data); - - if (data & 0x01) - { - logerror("fire int is disabled\n"); - m_interrupt_mask &= ~EINSTEIN_FIRE_INT; - } - else - { - logerror("fire int is enabled\n"); - m_interrupt_mask |= EINSTEIN_FIRE_INT; - } -} - - -/*************************************************************************** - MACHINE EMULATION -***************************************************************************/ - -void einstein_state::machine_start() -{ -} - -void einstein_state::machine_reset() -{ - //device_t *floppy; - //UINT8 config = m_config->read(); - - /* initialize memory mapping */ - m_bank2->set_base(m_ram->pointer()); - m_bank3->set_base(m_ram->pointer() + 0x8000); - m_rom_enabled = 1; - einstein_page_rom(); - - /* a reset causes the fire int, adc int, keyboard int mask - to be set to 1, which causes all these to be DISABLED */ - m_interrupt = 0; - m_interrupt_mask = 0; - - m_ctc_trigger = 0; - - /* configure floppy drives */ -/* floppy_type_t type_80 = FLOPPY_STANDARD_5_25_DSHD; - floppy_type_t type_40 = FLOPPY_STANDARD_5_25_SSDD_40; - floppy = machine().device("floppy0"); - floppy_drive_set_geometry(floppy, config & 0x01 ? type_80 : type_40); - floppy = machine().device("floppy1"); - floppy_drive_set_geometry(floppy, config & 0x02 ? type_80 : type_40); - floppy = machine().device("floppy2"); - floppy_drive_set_geometry(floppy, config & 0x04 ? type_80 : type_40); - floppy = machine().device("floppy3"); - floppy_drive_set_geometry(floppy, config & 0x08 ? type_80 : type_40);*/ -} - -MACHINE_RESET_MEMBER(einstein_state,einstein2) -{ - /* call standard initialization first */ - einstein_state::machine_reset(); - - /* 80 column card palette */ - m_palette->set_pen_color(TMS9928A_PALETTE_SIZE, rgb_t::black); - m_palette->set_pen_color(TMS9928A_PALETTE_SIZE + 1, rgb_t(0, 224, 0)); -} - -MACHINE_START_MEMBER(einstein_state,einstein2) -{ - m_crtc_ram = auto_alloc_array(machine(), UINT8, 2048); - memset(m_crtc_ram, 0, sizeof(UINT8) * 2048); - einstein_state::machine_start(); -} - - -/*************************************************************************** - VIDEO EMULATION -***************************************************************************/ - -UINT32 einstein_state::screen_update_einstein2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - if (&screen == m_color_screen) - { - bitmap_rgb32 &src = m_tms9929a->get_bitmap(); - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = src.pix32(y, x); - } - else if (&screen == m_crtc_screen) - m_mc6845->screen_update( screen, bitmap, cliprect); - else - fatalerror("Unknown screen '%s'\n", screen.tag()); - - return 0; -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( einstein_mem, AS_PROGRAM, 8, einstein_state ) - AM_RANGE(0x0000, 0x07fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") - AM_RANGE(0x8000, 0x0ffff) AM_RAMBANK("bank3") -ADDRESS_MAP_END - -/* The I/O ports are decoded into 8 blocks using address lines A3 to A7 */ -static ADDRESS_MAP_START( einstein_io, AS_IO, 8, einstein_state ) - /* block 0, ay8910 psg */ - AM_RANGE(0x02, 0x02) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I030, ay8910_device, data_r, address_w) - AM_RANGE(0x03, 0x03) AM_MIRROR(0xff04) AM_DEVWRITE(IC_I030, ay8910_device, data_w) - /* block 1, tms9928a vdp */ - AM_RANGE(0x08, 0x08) AM_MIRROR(0xff06) AM_DEVREADWRITE("tms9929a", tms9929a_device, vram_read, vram_write) - AM_RANGE(0x09, 0x09) AM_MIRROR(0xff06) AM_DEVREADWRITE("tms9929a", tms9929a_device, register_read, register_write) - /* block 2, i8251 uart */ - AM_RANGE(0x10, 0x10) AM_MIRROR(0xff06) AM_DEVREADWRITE(IC_I060, i8251_device, data_r, data_w) - AM_RANGE(0x11, 0x11) AM_MIRROR(0xff06) AM_DEVREADWRITE(IC_I060, i8251_device, status_r, control_w) - /* block 3, wd1770 floppy controller */ - AM_RANGE(0x18, 0x1b) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I042, wd1770_t, read, write) - /* block 4, internal controls */ - AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_READWRITE(einstein_kybintmsk_r, einstein_kybintmsk_w) - AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_WRITE(einstein_adcintmsk_w) - AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_WRITE(einstein_drsel_w) - AM_RANGE(0x24, 0x24) AM_MIRROR(0xff00) AM_WRITE(einstein_rom_w) - AM_RANGE(0x25, 0x25) AM_MIRROR(0xff00) AM_WRITE(einstein_fire_int_w) - /* block 5, z80ctc */ - AM_RANGE(0x28, 0x2b) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I058, z80ctc_device, read, write) - /* block 6, z80pio */ - AM_RANGE(0x30, 0x33) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I063, z80pio_device, read, write) -#if 0 - /* block 7, adc */ - AM_RANGE(0x38, 0x38) AM_MIRROR(0xff07) AM_DEVREADWRITE_LEGACY(IC_I050, adc0844_r, adc0844_w) -#endif -ADDRESS_MAP_END - -static ADDRESS_MAP_START( einstein2_io, AS_IO, 8, einstein_state ) - AM_IMPORT_FROM(einstein_io) - AM_RANGE(0x40, 0x47) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(einstein_80col_ram_r, einstein_80col_ram_w) - AM_RANGE(0x48, 0x48) AM_MIRROR(0xff00) AM_DEVWRITE("crtc", mc6845_device, address_w) - AM_RANGE(0x49, 0x49) AM_MIRROR(0xff00) AM_DEVWRITE("crtc", mc6845_device, register_w) - AM_RANGE(0x4c, 0x4c) AM_MIRROR(0xff00) AM_READ(einstein_80col_state_r) -ADDRESS_MAP_END - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( einstein ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('\xA3') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xBA') PORT_CHAR('\xBD') // is \xBA correct for double vertical bar || ? - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('-') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("EXTRA") - PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - /* fire buttons for analogue joysticks */ - PORT_START("BUTTONS") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1") PORT_PLAYER(1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 2 Button 1") PORT_PLAYER(2) - PORT_BIT(0xfc, IP_ACTIVE_HIGH, IPT_UNUSED) - - /* analog joystick 1 x axis */ - PORT_START("JOY1_X") - PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_REVERSE - - /* analog joystick 1 y axis */ - PORT_START("JOY1_Y") - PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_REVERSE - - /* analog joystick 2 x axis */ - PORT_START("JOY2_X") - PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_REVERSE - - /* analog joystick 2 Y axis */ - PORT_START("JOY2_Y") - PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE - - PORT_START("config") - PORT_CONFNAME(0x01, 0x00, "Floppy drive #1") - PORT_CONFSETTING(0x00, "Single sided") - PORT_CONFSETTING(0x01, "Double sided") - PORT_CONFNAME(0x02, 0x00, "Floppy drive #2") - PORT_CONFSETTING(0x00, "Single sided") - PORT_CONFSETTING(0x02, "Double sided") - PORT_CONFNAME(0x04, 0x00, "Floppy drive #3") - PORT_CONFSETTING(0x00, "Single sided") - PORT_CONFSETTING(0x04, "Double sided") - PORT_CONFNAME(0x08, 0x00, "Floppy drive #4") - PORT_CONFSETTING(0x00, "Single sided") - PORT_CONFSETTING(0x08, "Double sided") -INPUT_PORTS_END - -static INPUT_PORTS_START( einstein_80col ) - PORT_INCLUDE(einstein) - - /* dip switches on the 80 column card */ - PORT_START("80column_dips") - PORT_DIPNAME(0x02, 0x00, "Startup mode") - PORT_DIPSETTING(0x00, "40 column") - PORT_DIPSETTING(0x02, "80 column") - PORT_DIPNAME(0x04, 0x00, "50/60Hz") - PORT_DIPSETTING(0x00, "50Hz") - PORT_DIPSETTING(0x04, "60Hz") -INPUT_PORTS_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -/* F4 Character Displayer */ -static const gfx_layout einstei2_charlayout = -{ - 8, 10, /* 8 x 10 characters */ - 256, /* 256*2 characters */ - 1, /* 1 bits per pixel */ - { 0 }, - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 0x800*8, 0x801*8 }, - 8*8 -}; - -static GFXDECODE_START( einstei2 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, einstei2_charlayout, 16, 1 ) - GFXDECODE_ENTRY( "gfx1", 0x1000, einstei2_charlayout, 16, 1 ) -GFXDECODE_END - -static SLOT_INTERFACE_START( einstein_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( einstein, einstein_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(IC_I001, Z80, XTAL_X002 / 2) - MCFG_CPU_PROGRAM_MAP(einstein_mem) - MCFG_CPU_IO_MAP(einstein_io) - MCFG_CPU_CONFIG(einstein_daisy_chain) - - /* this is actually clocked at the system clock 4 MHz, but this would be too fast for our - driver. So we update at 50Hz and hope this is good enough. */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", einstein_state, einstein_keyboard_timer_callback, attotime::from_hz(50)) - - MCFG_DEVICE_ADD(IC_I063, Z80PIO, XTAL_X002 / 2) - MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_OUT_PB_CB(DEVWRITELINE("centronics", centronics_device, write_strobe)) - - MCFG_DEVICE_ADD(IC_I058, Z80CTC, XTAL_X002 / 2) - MCFG_Z80CTC_ZC0_CB(WRITELINE(einstein_state, einstein_serial_transmit_clock)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(einstein_state, einstein_serial_receive_clock)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(IC_I058, z80ctc_device, trg3)) - - /* the input to channel 0 and 1 of the ctc is a 2 MHz clock */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", einstein_state, einstein_ctc_trigger_callback, attotime::from_hz(XTAL_X002 /4)) - - /* Einstein daisy chain support for non-Z80 devices */ - MCFG_DEVICE_ADD("keyboard_daisy", EINSTEIN_KEYBOARD_DAISY, 0) - MCFG_DEVICE_ADD("adc_daisy", EINSTEIN_ADC_DAISY, 0) - MCFG_DEVICE_ADD("fire_daisy", EINSTEIN_FIRE_DAISY, 0) - - /* video hardware */ - MCFG_DEVICE_ADD( "tms9929a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) /* 16k RAM, provided by IC i040 and i041 */ - MCFG_TMS9928A_SET_SCREEN( "screen" ) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9929a", tms9929a_device, screen_update ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(IC_I030, AY8910, XTAL_X002 / 4) - MCFG_AY8910_PORT_B_READ_CB(READ8(einstein_state, einstein_keyboard_data_read)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(einstein_state, einstein_keyboard_line_write)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(IC_I063, z80pio_device, strobe_a)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(einstein_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(einstein_state, write_centronics_perror)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(einstein_state, write_centronics_fault)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* uart */ - MCFG_DEVICE_ADD(IC_I060, I8251, 0) - - MCFG_WD1770_ADD(IC_I042, XTAL_X002) - - MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":0", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":1", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":2", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(IC_I042 ":3", einstein_floppies, "525dd", floppy_image_device::default_floppy_formats) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","einstein") - - /* RAM is provided by 8k DRAM ICs i009, i010, i011, i012, i013, i014, i015 and i016 */ - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( einstei2, einstein ) - - MCFG_CPU_MODIFY(IC_I001) - MCFG_CPU_IO_MAP(einstein2_io) - - MCFG_MACHINE_START_OVERRIDE(einstein_state,einstein2) - MCFG_MACHINE_RESET_OVERRIDE(einstein_state,einstein2) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_dualhsxs) - - MCFG_SCREEN_ADD("80column", RASTER) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DRIVER(einstein_state, screen_update_einstein2) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", einstei2) - - /* 2 additional colors for the 80 column screen */ - MCFG_PALETTE_ADD("palette", TMS9928A_PALETTE_SIZE + 2) - - MCFG_MC6845_ADD("crtc", MC6845, "80column", XTAL_X002 / 4) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(einstein_state, crtc_update_row) - MCFG_MC6845_OUT_DE_CB(WRITELINE(einstein_state, einstein_6845_de_changed)) -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -/* There are two sockets, i023 and i024, each either a 2764 or 27128 - * only i023 is used by default and fitted with the 8k bios (called MOS). - * - * We are missing dumps of version MOS 1.1, possibly of 1.0 if it exists. - */ -ROM_START( einstein ) - ROM_REGION(0x8000, "bios", 0) - /* i023 */ - ROM_SYSTEM_BIOS(0, "mos12", "MOS 1.2") - ROMX_LOAD("mos12.i023", 0, 0x2000, CRC(ec134953) SHA1(a02125d8ebcda48aa784adbb42a8b2d7ef3a4b77), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "mos121", "MOS 1.21") - ROMX_LOAD("mos121.i023", 0, 0x2000, CRC(a746eeb6) SHA1(f75aaaa777d0fd92225acba291f6bf428b341d3e), ROM_BIOS(2)) - ROM_RELOAD(0x2000, 0x2000) - /* i024 */ - ROM_FILL(0x4000, 0x4000, 0xff) -ROM_END - -ROM_START( einstei2 ) - ROM_REGION(0x8000, "bios", 0) - /* i023 */ - ROM_SYSTEM_BIOS(0, "mos12", "MOS 1.2") - ROMX_LOAD("mos12.i023", 0, 0x2000, CRC(ec134953) SHA1(a02125d8ebcda48aa784adbb42a8b2d7ef3a4b77), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "mos121", "MOS 1.21") - ROMX_LOAD("mos121.i023", 0, 0x2000, CRC(a746eeb6) SHA1(f75aaaa777d0fd92225acba291f6bf428b341d3e), ROM_BIOS(2)) - ROM_RELOAD(0x2000, 0x2000) - /* i024 */ - ROM_FILL(0x4000, 0x4000, 0xff) - - /* character rom from 80 column card */ - ROM_REGION(0x2000, "gfx1", 0) - ROM_LOAD("tk02-v1.00.rom", 0, 0x2000, CRC(ad3c4346) SHA1(cd57e630371b4d0314e3f15693753fb195c7257d)) -ROM_END - -ROM_START( einst256 ) - ROM_REGION(0x8000, "bios", 0) - ROM_LOAD("tc256.rom", 0x0000, 0x4000, CRC(ef8dad88) SHA1(eb2102d3bef572db7161c26a7c68a5fcf457b4d0) ) -ROM_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, einstein, 0, 0, einstein, einstein, driver_device, 0, "Tatung", "Einstein TC-01", 0 ) -COMP( 1984, einstei2, einstein, 0, einstei2, einstein_80col, driver_device, 0, "Tatung", "Einstein TC-01 + 80 column device", 0 ) -COMP( 1984, einst256, 0, 0, einstein, einstein, driver_device, 0, "Tatung", "Einstein 256", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/elecbowl.c b/src/mess/drivers/elecbowl.c deleted file mode 100644 index 934bdd1f719..00000000000 --- a/src/mess/drivers/elecbowl.c +++ /dev/null @@ -1,222 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Kevin Horton -/*************************************************************************** - - ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** - - Marx Series 300 Electronic Bowling Game - Main board: - * TMS1100NLL MP3403 DBS 7836 SINGAPORE - * 4*SN75492 quad segment driver, 2*SN74259 8-line demultiplexer, - 2*CD4043 quad r/s input latch - * 5 7seg LEDs, 15 lamps(10 lamps projected to bowling pins reflection), - 1bit-sound with crude volume control - * edge connector to sensors(switches trigger when ball rolls over) - and other inputs - - lamp translation table: SN74259.u5(mux 1) goes to MAME output lamp5x, - SN74259.u6(mux 2) goes to MAME output lamp6x. u1-u3 are SN75492 ICs, - where other: u1 A2 is N/C, u3 A1 is from O2 and goes to digits seg C. - - u5 Q0 -> u1 A4 -> L2 (pin #2) u6 Q0 -> u3 A4 -> L1 (pin #1) - u5 Q1 -> u1 A5 -> L4 (pin #4) u6 Q1 -> u3 A5 -> L5 (pin #5) - u5 Q2 -> u1 A6 -> L7 (pin #7) u6 Q2 -> u2 A3 -> L11 (player 1) - u5 Q3 -> u1 A1 -> L8 (pin #8) u6 Q3 -> u2 A2 -> L12 (player 2) - u5 Q4 -> u3 A2 -> L3 (pin #3) u6 Q4 -> u2 A1 -> L15 (?) - u5 Q5 -> u2 A6 -> L6 (pin #6) u6 Q5 -> u3 A6 -> L14 (?) - u5 Q6 -> u2 A5 -> L10 (pin #10) u6 Q6 -> u1 A3 -> L13 (spare) - u5 Q7 -> u2 A4 -> L9 (pin #9) u6 Q7 -> u3 A3 -> digit 4 B+C - -***************************************************************************/ - -#include "includes/hh_tms1k.h" -#include "elecbowl.lh" - - -class elecbowl_state : public hh_tms1k_state -{ -public: - elecbowl_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - - -/*************************************************************************** - - Display - -***************************************************************************/ - -void elecbowl_state::prepare_display() -{ - // standard 7segs - for (int y = 0; y < 4; y++) - { - m_display_segmask[y] = 0x7f; - m_display_state[y] = (m_r >> (y + 4) & 1) ? m_o : 0; - } - - // lamp muxes - UINT8 mask = 1 << (m_o & 7); - UINT8 d = (m_r & 2) ? mask : 0; - if (~m_r & 1) - m_display_state[5] = (m_display_state[5] & ~mask) | d; - if (~m_r & 4) - m_display_state[6] = (m_display_state[6] & ~mask) | d; - - // digit 4 is from mux2 Q7 - m_display_segmask[4] = 6; - m_display_state[4] = (m_display_state[6] & 0x80) ? 6 : 0; - - set_display_size(8, 7); - display_update(); -} - - - -/*************************************************************************** - - I/O - -***************************************************************************/ - -WRITE16_MEMBER(elecbowl_state::write_r) -{ - // R5-R7,R10: input mux - m_inp_mux = (data >> 5 & 7) | (data >> 7 & 8); - - // R9: speaker out - // R3,R8: speaker volume.. - m_speaker->level_w(data >> 9 & 1); - - // R4-R7: select digit - // R0,R2: lamp mux1,2 _enable - // R1: lamp muxes state - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(elecbowl_state::write_o) -{ - //if (data & 0x80) printf("%X ",data&0x7f); - - // O0-O2: lamp muxes select - // O0-O6: digit segments A-G - // O7: N/C - m_o = data & 0x7f; - prepare_display(); -} - -READ8_MEMBER(elecbowl_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(4); -} - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -static INPUT_PORTS_START( elecbowl ) - PORT_START("IN.0") // R5 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) - - PORT_START("IN.1") // R6 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) // reset/test? - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) // reset/test? - - PORT_START("IN.2") // R7 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) - - PORT_START("IN.3") // R10 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) // 2 players sw? -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -// output PLA is not dumped -static const UINT16 elecbowl_output_pla[0x20] = -{ - lA+lB+lC+lD+lE+lF, // 0 - lB+lC, // 1 - lA+lB+lG+lE+lD, // 2 - lA+lB+lG+lC+lD, // 3 - lF+lB+lG+lC, // 4 - lA+lF+lG+lC+lD, // 5 - lA+lF+lG+lC+lD+lE, // 6 - lA+lB+lC, // 7 - lA+lB+lC+lD+lE+lF+lG, // 8 - lA+lB+lG+lF+lC+lD, // 9 - - 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0,1,2,3,4,5,6,7, // lamp muxes select - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f -}; - -static MACHINE_CONFIG_START( elecbowl, elecbowl_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K, C=100pf -> ~350kHz - MCFG_TMS1XXX_OUTPUT_PLA(elecbowl_output_pla) - MCFG_TMS1XXX_READ_K_CB(READ8(elecbowl_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecbowl_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(elecbowl_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_elecbowl) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( elecbowl ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp3403.u9", 0x0000, 0x0800, CRC(9eabaa7d) SHA1(b1f54587ed7f2bbf3a5d49075c807296384c2b06) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_elecbowl_output.pla", 0, 365, NO_DUMP ) -ROM_END - - -CONS( 1978, elecbowl, 0, 0, elecbowl, elecbowl, driver_device, 0, "Marx", "Electronic Bowling (Marx)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_MECHANICAL | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/electron.c b/src/mess/drivers/electron.c deleted file mode 100644 index 0b4152026cf..00000000000 --- a/src/mess/drivers/electron.c +++ /dev/null @@ -1,208 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/****************************************************************************** - Acorn Electron driver - - MESS Driver By: - - Wilbert Pol - -I don't have a real system to verify the behaviour of the emulation. The things -that can be done through BASIC programs seem to behave properly (most of the time :). - -Incomplete: - - Sound (sound is too high?) - - Graphics (seems to be wrong for several games) - - 1 MHz bus is not emulated - - Bus claiming by ULA is not implemented - - Currently the cartridge support always loads the upper rom in page 12 - and the lower rom in page 0. This might need further documentation in - the software list and loading code. - -Missing: - - Support for floppy disks - - Other peripherals - - Keyboard is missing the 'Break' key - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "includes/electron.h" -#include "imagedev/cassette.h" -#include "formats/uef_cas.h" -#include "sound/beep.h" - -static const rgb_t electron_palette[8]= -{ - rgb_t(0x0ff,0x0ff,0x0ff), - rgb_t(0x000,0x0ff,0x0ff), - rgb_t(0x0ff,0x000,0x0ff), - rgb_t(0x000,0x000,0x0ff), - rgb_t(0x0ff,0x0ff,0x000), - rgb_t(0x000,0x0ff,0x000), - rgb_t(0x0ff,0x000,0x000), - rgb_t(0x000,0x000,0x000) -}; - -PALETTE_INIT_MEMBER(electron_state, electron) -{ - palette.set_pen_colors(0, electron_palette, ARRAY_LENGTH(electron_palette)); -} - -static ADDRESS_MAP_START(electron_mem, AS_PROGRAM, 8, electron_state ) - AM_RANGE(0x0000, 0x7fff) AM_RAM AM_REGION("maincpu", 0x00000) /* 32KB of RAM */ - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") /* Banked ROM pages */ - AM_RANGE(0xc000, 0xfbff) AM_ROM AM_REGION("user1", 0x40000) /* OS ROM */ - AM_RANGE(0xfc00, 0xfcff) AM_READWRITE(electron_jim_r, electron_jim_w ) /* JIM pages */ - AM_RANGE(0xfd00, 0xfdff) AM_READWRITE(electron_1mhz_r, electron_1mhz_w ) /* 1 MHz bus */ - AM_RANGE(0xfe00, 0xfeff) AM_READWRITE(electron_ula_r, electron_ula_w ) /* Electron ULA */ - AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("user1", 0x43f00) /* OS ROM continued */ -ADDRESS_MAP_END - -static INPUT_PORTS_START( electron ) - - PORT_START("LINE.0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92 | \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('|') PORT_CHAR('\\') // on the real keyboard, this would be on the 1st row, the 3rd key after 0 - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR('[') PORT_CHAR(']') - /* PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_) */ - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE.1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90 ^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93 _ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('_') PORT_CHAR('}') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_START("LINE.2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 \xC2\xA3 {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('\xA3') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - /* PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("") PORT_CODE(KEYCODE_) */ - - PORT_START("LINE.3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE.4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("LINE.5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("LINE.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("LINE.7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("LINE.8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - - PORT_START("LINE.9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("LINE.10") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - - PORT_START("LINE.11") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("LINE.12") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("LINE.13") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESCAPE") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FUNC") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - -INPUT_PORTS_END - -static MACHINE_CONFIG_START( electron, electron_state ) - MCFG_CPU_ADD( "maincpu", M6502, 2000000 ) - MCFG_CPU_PROGRAM_MAP( electron_mem) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE( 50.08 ) - MCFG_SCREEN_SIZE( 640, 312 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 640-1, 0, 256-1 ) - MCFG_SCREEN_UPDATE_DRIVER(electron_state, screen_update_electron) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD( "palette", 16 ) - MCFG_PALETTE_INIT_OWNER(electron_state, electron) - - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(uef_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "electron_cart") - MCFG_GENERIC_LOAD(electron_state, electron_cart) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","electron_cart") -MACHINE_CONFIG_END - - -/* Electron Rom Load */ -ROM_START(electron) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x44000, "user1", 0 ) /* OS Rom */ - ROM_LOAD( "os.rom", 0x40000, 0x4000, CRC(bf63fb1f) SHA1(a48b8fa0cfb09140e808ac8a187316c605a0b32e) ) /* Os rom */ - /* 00000 0 available for cartridges */ - /* 04000 1 available for cartridges */ - /* 08000 2 available for cartridges */ - /* 0c000 3 available for cartridges */ - /* 10000 4 available for cartridges */ - /* 14000 5 available for cartridges */ - /* 18000 6 available for cartridges */ - /* 1c000 7 available for cartridges */ - /* 20000 8 keyboard */ - /* 24000 9 keyboard mirror */ - /* 28000 10 Basic rom */ - ROM_LOAD( "basic.rom", 0x28000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281) ) - /* 2c000 11 Basic rom mirror */ - ROM_COPY( "user1", 0x28000, 0x2c000, 0x4000 ) - /* 30000 12 available for cartridges with a language ROM */ - /* 34000 13 available for cartridges with a language ROM */ - /* 38000 14 available for cartridges with a language ROM */ - /* 3c000 15 available for cartridges with a language ROM */ -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1983, electron, 0, 0, electron, electron, driver_device, 0, "Acorn", "Acorn Electron", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/elekscmp.c b/src/mess/drivers/elekscmp.c deleted file mode 100644 index 7783184917c..00000000000 --- a/src/mess/drivers/elekscmp.c +++ /dev/null @@ -1,165 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Elektor SC/MP - - 22/11/2009 Skeleton driver. - - 10/MAY/2012 Added keyboard [Robbbert] - -To Use: -- Press MINUS to enter data input mode -- Press UP or DOWN to cycle through addresses - -At the moment Paste cannot be tested, but if it worked, you could -paste this in: -0F0011^22^33^44^55^66^77^88^99^ - -It seems the only way to exit each mode is to do a Soft Reset. - -ToDo: -- Add Cassette -- Verify that ROMS are good (they seem to be) - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/scmp/scmp.h" -#include "elekscmp.lh" - - -class elekscmp_state : public driver_device -{ -public: - elekscmp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_x0(*this, "X0"), - m_x1(*this, "X1"), - m_x2(*this, "X2"), - m_x3(*this, "X3") { } - - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(hex_display_w); - UINT8 convert_key(UINT8 data); - -protected: - required_device m_maincpu; - required_ioport m_x0; - required_ioport m_x1; - required_ioport m_x2; - required_ioport m_x3; -}; - - -WRITE8_MEMBER(elekscmp_state::hex_display_w) -{ - output_set_digit_value(offset, data); -} - -UINT8 elekscmp_state::convert_key(UINT8 data) -{ - UINT8 i; - for (i = 0; i < 8; i++) - if (BIT(data, i)) - return i; - - return 0xff; -} - -READ8_MEMBER(elekscmp_state::keyboard_r) -{ - UINT8 data; - - data = m_x0->read(); - - if (data) - return 0x80 | convert_key(data); - - data = m_x1->read(); - - if (data) - return 0x88 | convert_key(data); - - data = m_x2->read(); - - if (data) - return 0x80 | (convert_key(data) << 4); - - data = m_x3->read(); - - if (data) - m_maincpu->reset(); - - return 0; -} - -static ADDRESS_MAP_START(elekscmp_mem, AS_PROGRAM, 8, elekscmp_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x0fff) - AM_RANGE(0x000, 0x5ff) AM_ROM // ROM - AM_RANGE(0x700, 0x707) AM_WRITE(hex_display_w) - AM_RANGE(0x708, 0x70f) AM_READ(keyboard_r) - AM_RANGE(0x800, 0xfff) AM_RAM // RAM - up to 2K of RAM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( elekscmp ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CPU Reg") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Block Transfer") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cassette") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Subtract") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Modify") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Run") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('X') - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0xfe, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( elekscmp, elekscmp_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",INS8060, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(elekscmp_mem) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_elekscmp) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( elekscmp ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // Too many possible errors, few found and fixed, but not sure if there are more - ROM_LOAD( "elbug.001", 0x0000, 0x0200, BAD_DUMP CRC(f733da28) SHA1(b65d98be03eab80478167964beec26bb327bfdf3)) - ROM_LOAD( "elbug.002", 0x0200, 0x0200, BAD_DUMP CRC(529c0b88) SHA1(bd72dd890cd974e1744ca70aa3457657374cbf76)) - ROM_LOAD( "elbug.003", 0x0400, 0x0200, BAD_DUMP CRC(13585ad1) SHA1(93f722b3e84095a1b701b04bf9018c891933b9ff)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, elekscmp, 0, 0, elekscmp, elekscmp, driver_device, 0, "Elektor Electronics", "Elektor SC/MP", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/elf.c b/src/mess/drivers/elf.c deleted file mode 100644 index 5fdfc47035b..00000000000 --- a/src/mess/drivers/elf.c +++ /dev/null @@ -1,288 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Netronics Elf II - -****************************************************************************/ - -/* - - TODO: - - - proper layout - -*/ - -#include "includes/elf.h" -#include "elf2.lh" - -#define RUN \ - BIT(m_special->read(), 0) - -#define LOAD \ - BIT(m_special->read(), 1) - -#define MEMORY_PROTECT \ - BIT(m_special->read(), 2) - -#define INPUT \ - BIT(m_special->read(), 3) - -/* Read/Write Handlers */ - -READ8_MEMBER( elf2_state::dispon_r ) -{ - m_vdc->disp_on_w(1); - m_vdc->disp_on_w(0); - - return 0xff; -} - -READ8_MEMBER( elf2_state::data_r ) -{ - return m_data; -} - -WRITE8_MEMBER( elf2_state::data_w ) -{ - m_led_l->a_w(data & 0x0f); - m_led_h->a_w(data >> 4); -} - -WRITE8_MEMBER( elf2_state::memory_w ) -{ - if (LOAD) - { - if (MEMORY_PROTECT) - { - /* latch data from memory */ - data = m_ram->pointer()[offset]; - } - else - { - /* write latched data to memory */ - m_ram->pointer()[offset] = data; - } - - /* write data to 7 segment displays */ - m_led_l->a_w(data & 0x0f); - m_led_h->a_w(data >> 4); - } -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( elf2_mem, AS_PROGRAM, 8, elf2_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x00ff) AM_RAMBANK("bank1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( elf2_io, AS_IO, 8, elf2_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x01, 0x01) AM_READ(dispon_r) - AM_RANGE(0x04, 0x04) AM_READWRITE(data_r, data_w) -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( elf2_state::input_w ) -{ - if (newval) - { - /* assert DMAIN */ - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, ASSERT_LINE); - } -} - -static INPUT_PORTS_START( elf2 ) - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_R) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOAD") PORT_CODE(KEYCODE_L) PORT_TOGGLE - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M/P") PORT_CODE(KEYCODE_M) PORT_TOGGLE - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INPUT") PORT_CODE(KEYCODE_ENTER) PORT_CHANGED_MEMBER(DEVICE_SELF, elf2_state, input_w, 0) -INPUT_PORTS_END - -/* CDP1802 Configuration */ - -READ_LINE_MEMBER( elf2_state::wait_r ) -{ - return LOAD; -} - -READ_LINE_MEMBER( elf2_state::clear_r ) -{ - return RUN; -} - -READ_LINE_MEMBER( elf2_state::ef4_r ) -{ - return INPUT; -} - -WRITE_LINE_MEMBER( elf2_state::q_w ) -{ - output_set_led_value(0, state); -} - -READ8_MEMBER( elf2_state::dma_r ) -{ - return m_data; -} - -WRITE8_MEMBER( elf2_state::sc_w ) -{ - switch (data) - { - case COSMAC_STATE_CODE_S2_DMA: - case COSMAC_STATE_CODE_S3_INTERRUPT: - /* clear DMAIN */ - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, CLEAR_LINE); - break; - - default: - break; - } -} - -/* MM74C923 Interface */ - -WRITE_LINE_MEMBER( elf2_state::da_w ) -{ - if (state) - { - /* shift keyboard data to latch */ - m_data <<= 4; - m_data |= m_kb->read() & 0x0f; - - if (LOAD) - { - /* write data to 7 segment displays */ - m_led_l->a_w(m_data & 0x0f); - m_led_h->a_w(m_data >> 4); - } - } -} - -/* Machine Initialization */ - -void elf2_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* initialize LED displays */ - m_led_l->rbi_w(1); - m_led_h->rbi_w(1); - - /* setup memory banking */ - program.install_read_bank(0x0000, 0x00ff, "bank1"); - program.install_write_handler(0x0000, 0x00ff, write8_delegate(FUNC(elf2_state::memory_w), this)); - membank("bank1")->configure_entry(0, m_ram->pointer()); - membank("bank1")->set_entry(0); - - /* register for state saving */ - save_item(NAME(m_data)); -} - -/* Machine Driver */ - -QUICKLOAD_LOAD_MEMBER( elf2_state, elf ) -{ - int size = image.length(); - - if (size > m_ram->size()) - { - return IMAGE_INIT_FAIL; - } - - image.fread(m_ram->pointer(), size); - - return IMAGE_INIT_PASS; -} - -static MACHINE_CONFIG_START( elf2, elf2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_3_579545MHz/2) - MCFG_CPU_PROGRAM_MAP(elf2_mem) - MCFG_CPU_IO_MAP(elf2_io) - MCFG_COSMAC_WAIT_CALLBACK(READLINE(elf2_state, wait_r)) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(elf2_state, clear_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(elf2_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(elf2_state, q_w)) - MCFG_COSMAC_DMAR_CALLBACK(READ8(elf2_state, dma_r)) - MCFG_COSMAC_DMAW_CALLBACK(DEVWRITE8(CDP1861_TAG, cdp1861_device, dma_w)) - MCFG_COSMAC_SC_CALLBACK(WRITE8(elf2_state, sc_w)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_elf2) - - MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, XTAL_3_579545MHz/2) - MCFG_CDP1861_IRQ_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) - MCFG_CDP1861_DMA_OUT_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT)) - MCFG_CDP1861_EFX_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) - MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2) - - /* devices */ - MCFG_DEVICE_ADD(MM74C923_TAG, MM74C923, 0) - MCFG_MM74C922_OSC(CAP_U(0.15)) - MCFG_MM74C922_DEBOUNCE(CAP_U(1)) - MCFG_MM74C922_DA_CALLBACK(WRITELINE(elf2_state, da_w)) - MCFG_MM74C922_X1_CALLBACK(IOPORT("X1")) - MCFG_MM74C922_X2_CALLBACK(IOPORT("X2")) - MCFG_MM74C922_X3_CALLBACK(IOPORT("X3")) - MCFG_MM74C922_X4_CALLBACK(IOPORT("X4")) - - MCFG_DEVICE_ADD(DM9368_H_TAG, DM9368, 0) - MCFG_OUTPUT_NAME("digit0") - MCFG_DEVICE_ADD(DM9368_L_TAG, DM9368, 0) - MCFG_OUTPUT_NAME("digit1") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_QUICKLOAD_ADD("quickload", elf2_state, elf, "bin", 0) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( elf2 ) - ROM_REGION( 0x10000, CDP1802_TAG, ROMREGION_ERASE00 ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, elf2, 0, 0, elf2, elf2, driver_device, 0, "Netronics", "Elf II", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/elwro800.c b/src/mess/drivers/elwro800.c deleted file mode 100644 index fa377badef9..00000000000 --- a/src/mess/drivers/elwro800.c +++ /dev/null @@ -1,626 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mariusz Wojcieszek -/*************************************************************************** - - Elwro 800 Junior - - Driver by Mariusz Wojcieszek - - ToDo: - - 8251 DTR and DTS signals are connected (with some additional logic) to NMI of Z80, this - is not emulated - - 8251 is used for JUNET network (a network of Elwro 800 Junior computers, allows sharing - floppy disc drives and printers) - network is not emulated - -****************************************************************************/ - -#include "emu.h" -#include "includes/spectrum.h" - -/* Components */ -#include "cpu/z80/z80.h" -#include "machine/upd765.h" /* for floppy disc controller */ -#include "machine/i8255.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8251.h" - -/* Devices */ -#include "imagedev/cassette.h" -#include "formats/tzx_cas.h" -#include "machine/ram.h" - - -class elwro800_state : public spectrum_state -{ -public: - elwro800_state(const machine_config &mconfig, device_type type, const char *tag) - : spectrum_state(mconfig, type, tag), - m_i8251(*this, "i8251"), - m_i8255(*this, "ppi8255"), - m_centronics(*this, "centronics"), - m_io_line8(*this, "LINE8"), - m_io_line9(*this, "LINE9"), - m_io_network_id(*this, "NETWORK ID") - { - } - - /* for elwro800 */ - /* RAM mapped at 0 */ - UINT8 m_ram_at_0000; - - /* NR signal */ - UINT8 m_NR; - UINT8 m_df_on_databus; - - DECLARE_DIRECT_UPDATE_MEMBER(elwro800_direct_handler); - DECLARE_WRITE8_MEMBER(elwro800jr_fdc_control_w); - DECLARE_READ8_MEMBER(elwro800jr_io_r); - DECLARE_WRITE8_MEMBER(elwro800jr_io_w); - DECLARE_MACHINE_RESET(elwro800); - INTERRUPT_GEN_MEMBER(elwro800jr_interrupt); - DECLARE_READ8_MEMBER(i8255_port_c_r); - DECLARE_WRITE8_MEMBER(i8255_port_c_w); - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - -protected: - required_device m_i8251; - required_device m_i8255; - required_device m_centronics; - required_ioport m_io_line8; - required_ioport m_io_line9; - required_ioport m_io_network_id; - - void elwro800jr_mmu_w(UINT8 data); - - int m_centronics_ack; -}; - - -/************************************* - * - * When RAM is mapped at 0x0000 - 0x1fff (in CP/J mode), reading a location 66 with /M1=0 - * (effectively reading NMI vector) is hardwired to return 0xDF (RST #18) - * (note that in CP/J mode address 66 is used for FCB) - * - *************************************/ -DIRECT_UPDATE_MEMBER(elwro800_state::elwro800_direct_handler) -{ - if (m_ram_at_0000 && address == 0x66) - { - direct.explicit_configure(0x66, 0x66, 0, &m_df_on_databus); - return ~0; - } - return address; -} - -/************************************* - * - * UPD765/Floppy drive - * - *************************************/ - -WRITE8_MEMBER(elwro800_state::elwro800jr_fdc_control_w) -{ - m_upd765_0->get_device()->mon_w(!BIT(data, 0)); - m_upd765_1->get_device()->mon_w(!BIT(data, 1)); - - m_upd765->tc_w(data & 0x04); - - if(!(data & 8)) - m_upd765->reset(); -} - -/************************************* - * - * I/O port F7: memory mapping - * - *************************************/ - -void elwro800_state::elwro800jr_mmu_w(UINT8 data) -{ - UINT8 *prom = memregion("proms")->base() + 0x200; - UINT8 *messram = m_ram->pointer(); - UINT8 cs; - UINT8 ls175; - - ls175 = BITSWAP8(data, 7, 6, 5, 4, 4, 5, 7, 6) & 0x0f; - - cs = prom[((0x0000 >> 10) | (ls175 << 6)) & 0x1ff]; - if (!BIT(cs,0)) - { - // rom BAS0 - membank("bank1")->set_base(memregion("maincpu")->base() + 0x0000); /* BAS0 ROM */ - m_maincpu->space(AS_PROGRAM).nop_write(0x0000, 0x1fff); - m_ram_at_0000 = 0; - } - else if (!BIT(cs,4)) - { - // rom BOOT - membank("bank1")->set_base(memregion("maincpu")->base() + 0x4000); /* BOOT ROM */ - m_maincpu->space(AS_PROGRAM).nop_write(0x0000, 0x1fff); - m_ram_at_0000 = 0; - } - else - { - // RAM - membank("bank1")->set_base(messram); - m_maincpu->space(AS_PROGRAM).install_write_bank(0x0000, 0x1fff, "bank1"); - m_ram_at_0000 = 1; - } - - cs = prom[((0x2000 >> 10) | (ls175 << 6)) & 0x1ff]; - if (!BIT(cs,1)) - { - membank("bank2")->set_base(memregion("maincpu")->base() + 0x2000); /* BAS1 ROM */ - m_maincpu->space(AS_PROGRAM).nop_write(0x2000, 0x3fff); - } - else - { - membank("bank2")->set_base(messram + 0x2000); /* RAM */ - m_maincpu->space(AS_PROGRAM).install_write_bank(0x2000, 0x3fff, "bank2"); - } - - if (BIT(ls175,2)) - { - // relok - m_screen_location = messram + 0xe000; - } - else - { - m_screen_location = messram + 0x4000; - } - - m_NR = BIT(ls175,3); - if (BIT(ls175,3)) - { - logerror("Reading network number\n"); - } -} - -/************************************* - * - * 8255: joystick and Centronics printer connections - * - *************************************/ - -WRITE_LINE_MEMBER(elwro800_state::write_centronics_ack) -{ - m_centronics_ack = state; - m_i8255->pc2_w(state); -} - -READ8_MEMBER(elwro800_state::i8255_port_c_r) -{ - return m_centronics_ack << 2; -} - -WRITE8_MEMBER(elwro800_state::i8255_port_c_w) -{ - m_centronics->write_strobe((data >> 7) & 0x01); -} - -/************************************* - * - * I/O reads and writes - * - * I/O accesses are decoded by prom which uses 8 low address lines (A0-A8) as input - * and outputs chip select signals for system components. Standard addresses are: - * - * 0x1F: 8255 port A (joystick) - * 0xBE: 8251 data (Junet network) - * 0xBF: 8251 control/status (Junet network) - * 0xDC: 8255 control - * 0xDD: 8255 port C (centronics 7-strobe, 2-ack) - * 0xDE: 8255 port B (centronics data) - * 0xDF: 8255 port A (joystick) - * 0xEE: FDC 765A status - * 0xEF: FDC 765A command and data - * 0xF1: FDC control (motor on/off) - * 0xF7: memory banking - * 0xFE (write): border color, speaker and tape (as in Spectrum) - * 0x??FE, 0x??7F, 0x??7B (read): keyboard reading - *************************************/ - -READ8_MEMBER(elwro800_state::elwro800jr_io_r) -{ - UINT8 *prom = memregion("proms")->base(); - UINT8 cs = prom[offset & 0x1ff]; - - if (!BIT(cs,0)) - { - // CFE - int mask = 0x8000; - int data = 0xff; - int i; - ioport_port *io_ports[9] = { m_io_line7, m_io_line6, m_io_line5, m_io_line4, m_io_line3, m_io_line2, m_io_line1, m_io_line0, m_io_line8 }; - - if ( !m_NR ) - { - for (i = 0; i < 9; mask >>= 1, i++) - { - if (!(offset & mask)) - { - data &= io_ports[i]->read(); - } - } - - if ((offset & 0xff) == 0xfb) - { - data &= m_io_line9->read(); - } - - /* cassette input from wav */ - if (m_cassette->input() > 0.0038 ) - { - data &= ~0x40; - } - } - else - { - data = m_io_network_id->read(); - } - - return data; - } - else if (!BIT(cs,1)) - { - // CF7 - } - else if (!BIT(cs,2)) - { - // CS55 - return m_i8255->read(space, (offset & 0x03) ^ 0x03); - } - else if (!BIT(cs,3)) - { - // CSFDC - if (offset & 1) - { - return m_upd765->fifo_r(space, 0, 0xff); - } - else - { - return m_upd765->msr_r(space, 0, 0xff); - } - } - else if (!BIT(cs,4)) - { - // CS51 - if (offset & 1) - { - return m_i8251->status_r(space, 0); - } - else - { - return m_i8251->data_r(space, 0); - } - } - else if (!BIT(cs,5)) - { - // CF1 - } - else - { - logerror("Unmapped I/O read: %04x\n", offset); - } - return 0x00; -} - -WRITE8_MEMBER(elwro800_state::elwro800jr_io_w) -{ - UINT8 *prom = memregion("proms")->base(); - UINT8 cs = prom[offset & 0x1ff]; - - if (!BIT(cs,0)) - { - // CFE - spectrum_port_fe_w(space, 0, data); - } - else if (!BIT(cs,1)) - { - // CF7 - elwro800jr_mmu_w(data); - } - else if (!BIT(cs,2)) - { - // CS55 - m_i8255->write(space, (offset & 0x03) ^ 0x03, data); - } - else if (!BIT(cs,3)) - { - // CSFDC - if (offset & 1) - { - m_upd765->fifo_w(space, 0, data, 0xff); - } - } - else if (!BIT(cs,4)) - { - // CS51 - if (offset & 1) - { - m_i8251->control_w(space, 0, data); - } - else - { - m_i8251->data_w(space, 0, data); - } - } - else if (!BIT(cs,5)) - { - // CF1 - elwro800jr_fdc_control_w(space, 0, data); - } - else - { - logerror("Unmapped I/O write: %04x %02x\n", offset, data); - } -} - -/************************************* - * - * Memory maps - * - *************************************/ - -static ADDRESS_MAP_START(elwro800_mem, AS_PROGRAM, 8, elwro800_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") - AM_RANGE(0x2000, 0x3fff) AM_RAMBANK("bank2") - AM_RANGE(0x4000, 0xffff) AM_RAMBANK("bank3") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(elwro800_io, AS_IO, 8, elwro800_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(elwro800jr_io_r, elwro800jr_io_w) -ADDRESS_MAP_END - -/************************************* - * - * Input ports - * - *************************************/ - -static INPUT_PORTS_START( elwro800 ) - PORT_START("LINE0") /* 0xFEFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(':') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - - PORT_START("LINE1") /* 0xFDFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - - PORT_START("LINE2") /* 0xFBFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - - PORT_START("LINE3") /* 0xF7FE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') - - PORT_START("LINE4") /* 0xEFFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 _") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - - PORT_START("LINE5") /* 0xDFFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - - PORT_START("LINE6") /* 0xBFFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - - PORT_START("LINE7") /* 0x7FFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SYMBOL SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ -") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('-') - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC4\x98") PORT_CODE(KEYCODE_0_PAD) // LATIN CAPITAL LETTER E WITH OGONEK - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x93") PORT_CODE(KEYCODE_1_PAD) // LATIN CAPITAL LETTER O WITH ACUTE - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\x9A") PORT_CODE(KEYCODE_2_PAD) // LATIN CAPITAL LETTER S WITH ACUTE - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\x81") PORT_CODE(KEYCODE_3_PAD) // LATIN CAPITAL LETTER L WITH STROKE - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\xB9") PORT_CODE(KEYCODE_4_PAD) // LATIN CAPITAL LETTER Z WITH ACUTE - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\x83") PORT_CODE(KEYCODE_5_PAD) // LATIN CAPITAL LETTER N WITH ACUTE - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC4\x84") PORT_CODE(KEYCODE_6_PAD) // LATIN CAPITAL LETTER A WITH OGONEK - - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DIR") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC4\x86") PORT_CODE(KEYCODE_7_PAD) // LATIN CAPITAL LETTER C WITH ACUTE - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC5\xBB") PORT_CODE(KEYCODE_8_PAD) // LATIN CAPITAL LETTER Z WITH DOT ABOVE - - PORT_START("JOY") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left") PORT_CODE(JOYCODE_X_LEFT_SWITCH) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up") PORT_CODE(JOYCODE_Y_UP_SWITCH) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire") PORT_CODE(JOYCODE_BUTTON1) - - PORT_START("NETWORK ID") - PORT_DIPNAME( 0x3f, 0x01, "Computer network ID" ) - PORT_DIPSETTING( 0x01, "1" ) - PORT_DIPSETTING( 0x10, "16" ) - PORT_DIPSETTING( 0x11, "17" ) - -INPUT_PORTS_END - -/************************************* - * - * Machine - * - *************************************/ - -MACHINE_RESET_MEMBER(elwro800_state,elwro800) -{ - UINT8 *messram = m_ram->pointer(); - - m_df_on_databus = 0xdf; - memset(messram, 0, 64*1024); - - membank("bank3")->set_base(messram + 0x4000); - - m_port_7ffd_data = 0; - m_port_1ffd_data = -1; - - // this is a reset of ls175 in mmu - elwro800jr_mmu_w(0); - - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(elwro800_state::elwro800_direct_handler), this)); -} - -INTERRUPT_GEN_MEMBER(elwro800_state::elwro800jr_interrupt) -{ - device.execute().set_input_line(0, HOLD_LINE); -} - -static SLOT_INTERFACE_START( elwro800jr_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -/* F4 Character Displayer */ -static const gfx_layout elwro800_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( elwro800 ) - GFXDECODE_ENTRY( "maincpu", 0x3c00, elwro800_charlayout, 0, 8 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( elwro800, elwro800_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, 3500000) /* 3.5 MHz */ - MCFG_CPU_PROGRAM_MAP(elwro800_mem) - MCFG_CPU_IO_MAP(elwro800_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", elwro800_state, elwro800jr_interrupt) - - MCFG_MACHINE_RESET_OVERRIDE(elwro800_state,elwro800) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50.08) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(SPEC_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, SPEC_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1) - MCFG_SCREEN_UPDATE_DRIVER(elwro800_state, screen_update_spectrum ) - MCFG_SCREEN_VBLANK_DRIVER(elwro800_state, screen_eof_spectrum) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(elwro800_state, spectrum ) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", elwro800) - - MCFG_VIDEO_START_OVERRIDE(elwro800_state, spectrum ) - - MCFG_UPD765A_ADD("upd765", true, true) - - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(IOPORT("JOY")) - MCFG_I8255_IN_PORTB_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) - MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_IN_PORTC_CB(READ8(elwro800_state, i8255_port_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(elwro800_state, i8255_port_c_w)) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(elwro800_state, write_centronics_ack)) - - MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD("i8251", I8251, 0) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(tzx_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - - MCFG_FLOPPY_DRIVE_ADD("upd765:0", elwro800jr_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", elwro800jr_floppies, "525hd", floppy_image_device::default_floppy_formats) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -/************************************* - * - * ROM definition - * - *************************************/ - -ROM_START( elwro800 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bas04.epr", 0x0000, 0x2000, CRC(6ab16f36) SHA1(49a19b279f311279c7fed3d2b3f207732d674c26) ) - ROM_LOAD( "bas14.epr", 0x2000, 0x2000, CRC(a743eb80) SHA1(3a300550838535b4adfe6d05c05fe0b39c47df16) ) - ROM_LOAD( "bootv.epr", 0x4000, 0x2000, CRC(de5fa37d) SHA1(4f203efe53524d84f69459c54b1a0296faa83fd9) ) - - ROM_REGION(0x0400, "proms", 0 ) - ROM_LOAD( "junior_io_prom.bin", 0x0000, 0x0200, CRC(c6a777c4) SHA1(41debc1b4c3bd4eef7e0e572327c759e0399a49c)) - ROM_LOAD( "junior_mem_prom.bin", 0x0200, 0x0200, CRC(0f745f42) SHA1(360ec23887fb6d7e19ee85d2bb30d9fa57f4936e)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, elwro800, 0, 0, elwro800, elwro800, driver_device, 0, "Elwro", "800 Junior", 0) diff --git a/src/mess/drivers/enmirage.c b/src/mess/drivers/enmirage.c deleted file mode 100644 index 1080a269dc9..00000000000 --- a/src/mess/drivers/enmirage.c +++ /dev/null @@ -1,286 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - drivers/mirage.c - - Ensoniq Mirage Sampler - Preliminary driver by R. Belmont - - Map for Mirage: - 0000-7fff: 32k window on 128k of sample RAM - 8000-bfff: main RAM - c000-dfff: optional expansion RAM - e100-e101: 6850 UART (for MIDI) - e200-e2ff: 6522 VIA - e408-e40f: filter cut-off frequency - e410-e417: filter resonance - e418-e41f: multiplexer address pre-set - e800-e803: WD1770 FDC - ec00-ecef: ES5503 "DOC" sound chip - f000-ffff: boot ROM - - NMI: IRQ from WD1772 - IRQ: DRQ from WD1772 wire-ORed with IRQ from ES5503 wire-ORed with IRQ from VIA6522 - FIRQ: IRQ from 6850 UART - - LED / switch matrix: - - A B C D E F G DP - ROW 0: LOAD UPPER LOAD LOWER SAMPLE UPPER PLAY SEQ LOAD SEQ SAVE SEQ REC SEQ SAMPLE LOWER - ROW 1: 3 6 9 5 8 0 2 Enter - ROW 2: 1 4 7 up arrow PARAM dn arrow VALUE CANCEL - L. AN: SEG A SEG B SEG C SEG D SEG E SEG F SEG G SEG DP (decimal point) - R. AN: SEG A SEG B SEG C SEG D SEG E SEG F SEG G SEG DP - - Column number in VIA port A bits 0-2 is converted to discrete lines by a 74LS145. - Port A bit 3 is right anode, bit 4 is left anode - ROW 0 is read on VIA port A bit 5, ROW 1 in port A bit 6, and ROW 2 in port A bit 7. - - Keyboard models talk to the R6500 through the VIA shifter: CA2 is handshake, CB1 is shift clock, CB2 is shift data. - This is unconnected on the rackmount version. - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/6850acia.h" -#include "machine/6522via.h" -#include "machine/wd_fdc.h" -#include "formats/esq8_dsk.h" -#include "sound/es5503.h" - -#include "mirage.lh" - -class mirage_state : public driver_device -{ -public: - mirage_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_fdc(*this, "wd1772"), - m_via(*this, "via6522") - { - } - - required_device m_maincpu; - required_device m_fdc; - required_device m_via; - - virtual void machine_reset(); - - int last_sndram_bank; - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - DECLARE_DRIVER_INIT(mirage); - virtual void video_start(); - UINT32 screen_update_mirage(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_WRITE8_MEMBER(mirage_via_write_porta); - DECLARE_WRITE8_MEMBER(mirage_via_write_portb); - DECLARE_WRITE_LINE_MEMBER(mirage_doc_irq); - DECLARE_READ8_MEMBER(mirage_adc_read); - - UINT8 m_l_segs, m_r_segs; - int m_l_hi, m_r_hi; -}; - -FLOPPY_FORMATS_MEMBER( mirage_state::floppy_formats ) - FLOPPY_ESQ8IMG_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( ensoniq_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER(mirage_state::mirage_doc_irq) -{ -// m_maincpu->set_input_line(M6809_IRQ_LINE, state); -} - -READ8_MEMBER(mirage_state::mirage_adc_read) -{ - return 0x00; -} - -void mirage_state::video_start() -{ -} - -UINT32 mirage_state::screen_update_mirage(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -void mirage_state::machine_reset() -{ - last_sndram_bank = 0; - membank("sndbank")->set_base(memregion("es5503")->base() ); -} - -static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 8, mirage_state ) - AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("sndbank") // 32k window on 128k of wave RAM - AM_RANGE(0x8000, 0xbfff) AM_RAM // main RAM - AM_RANGE(0xc000, 0xdfff) AM_RAM // expansion RAM - AM_RANGE(0xe100, 0xe100) AM_DEVREADWRITE("acia6850", acia6850_device, status_r, control_w) - AM_RANGE(0xe101, 0xe101) AM_DEVREADWRITE("acia6850", acia6850_device, data_r, data_w) - AM_RANGE(0xe200, 0xe2ff) AM_DEVREADWRITE("via6522", via6522_device, read, write) - AM_RANGE(0xe400, 0xe4ff) AM_NOP - AM_RANGE(0xe800, 0xe803) AM_DEVREADWRITE("wd1772", wd1772_t, read, write) - AM_RANGE(0xec00, 0xecef) AM_DEVREADWRITE("es5503", es5503_device, read, write) - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("osrom", 0) -ADDRESS_MAP_END - -// port A: front panel -// bits 0-2: column select from 0-7 -// bits 3/4 = right and left LED enable -// bits 5/6/7 keypad rows 0/1/2 return -WRITE8_MEMBER(mirage_state::mirage_via_write_porta) -{ - UINT8 seg = data & 7; - static const int segconv[8] = - { - 16, 8, 32, 2, 1, 64, 128, 4 - }; - -// printf("PA: %02x (PC=%x)\n", data, m_maincpu->pc()); - - // left LED selected? - if ((data & 0x10) == 0x10) - { - // if the segment number is lower than last time, we've - // started a new refresh cycle - if ((seg < m_l_hi) || (seg == 0)) - { - m_l_segs = segconv[seg]; - } - else - { - m_l_segs |= segconv[seg]; - } - - m_l_hi = seg; - output_set_digit_value(0, m_l_segs); -// printf("L LED: seg %d (hi %d conv %02x, %02x)\n", seg, m_l_hi, segconv[seg], m_l_segs); - } - // right LED selected? - if ((data & 0x08) == 0x08) - { - // if the segment number is lower than last time, we've - // started a new refresh cycle - if ((seg < m_r_hi) || (seg == 0)) - { - m_r_segs = segconv[seg]; - } - else - { - m_r_segs |= segconv[seg]; - } - - m_r_hi = seg; - output_set_digit_value(1, m_r_segs); -// printf("R LED: seg %d (hi %d conv %02x, %02x)\n", seg, m_r_hi, segconv[seg], m_r_segs); - } -} - -// port B: -// bit 7: OUT UART clock -// bit 4: OUT disk enable (motor on?) -// bit 3: OUT sample/play -// bit 2: OUT mic line/in -// bit 1: OUT upper/lower bank (64k halves) -// bit 0: OUT bank 0/bank 1 (32k halves) - -WRITE8_MEMBER(mirage_state::mirage_via_write_portb) -{ - int bank = 0; - - // handle sound RAM bank switching - bank = (data & 2) ? (64*1024) : 0; - bank += (data & 1) ? (32*1024) : 0; - if (bank != last_sndram_bank) - { - last_sndram_bank = bank; - membank("sndbank")->set_base(memregion("es5503")->base() + bank); - } -} - -static MACHINE_CONFIG_START( mirage, mirage_state ) - MCFG_CPU_ADD("maincpu", M6809E, 4000000) - MCFG_CPU_PROGRAM_MAP(mirage_map) - - MCFG_DEFAULT_LAYOUT( layout_mirage ) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_ES5503_ADD("es5503", 7000000) - MCFG_ES5503_OUTPUT_CHANNELS(2) - MCFG_ES5503_IRQ_FUNC(WRITELINE(mirage_state, mirage_doc_irq)) - MCFG_ES5503_ADC_FUNC(READ8(mirage_state, mirage_adc_read)) - - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_DEVICE_ADD("via6522", VIA6522, 1000000) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mirage_state, mirage_via_write_porta)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mirage_state, mirage_via_write_portb)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - - MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) - MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809e_device, firq_line)) - - MCFG_WD1772_ADD("wd1772", 8000000) - MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_WD_FDC_DRQ_CALLBACK(INPUTLINE("maincpu", M6809_IRQ_LINE)) - - MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", mirage_state::floppy_formats) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( mirage ) -INPUT_PORTS_END - -ROM_START( enmirage ) - ROM_REGION(0x1000, "osrom", 0) - ROM_LOAD( "mirage.bin", 0x0000, 0x1000, CRC(9fc7553c) SHA1(ec6ea5613eeafd21d8f3a7431a35a6ff16eed56d) ) - - ROM_REGION(0x20000, "es5503", ROMREGION_ERASE) -ROM_END - -DRIVER_INIT_MEMBER(mirage_state,mirage) -{ - floppy_connector *con = machine().device("wd1772:0"); - floppy_image_device *floppy = con ? con->get_device() : 0; - if (floppy) - { - m_fdc->set_floppy(floppy); - - floppy->ss_w(0); - } - - m_l_hi = m_r_hi = 9; - m_l_segs = m_r_segs = 0; - - // port A: front panel - m_via->write_pa0(0); - m_via->write_pa1(0); - m_via->write_pa2(0); - m_via->write_pa3(0); - m_via->write_pa4(0); - m_via->write_pa5(0); - m_via->write_pa6(0); - m_via->write_pa7(0); - - // port B: - // bit 6: IN FDC disk ready - // bit 5: IN 5503 sync (?) - m_via->write_pb0(0); - m_via->write_pb1(0); - m_via->write_pb2(0); - m_via->write_pb3(0); - m_via->write_pb4(0); - m_via->write_pb5(1); - m_via->write_pb6(1); - m_via->write_pb7(0); -} - -CONS( 1984, enmirage, 0, 0, mirage, mirage, mirage_state, mirage, "Ensoniq", "Ensoniq Mirage", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/ep64.c b/src/mess/drivers/ep64.c deleted file mode 100644 index 4b384701d63..00000000000 --- a/src/mess/drivers/ep64.c +++ /dev/null @@ -1,600 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Enterprise Sixty Four / One Two Eight emulation - -**********************************************************************/ - -/* - -Enterprise Sixty Four / Enterprise One Two Eight -Enterprise Computers Ltd. 1985 - -MAIN PCB Layout ---------------- - DUAL -|-----------| 9V TAPE_IN/OUT RES -|HEATSINK | DC_IN MON1 AND REMOTE SR1 PR1 CN2A CN1A |-| -| |--||---|--||--|--| |--| |-||-||-||-||-| |----| |-----| |--| |--| |-|-|------| -|-----------|7805 | MOD | |-| |-| |-| |-| |-| |-| |-| EXP2 --|EXTERNAL - |---+7805 | | 74LS06 74LS273 74LS86 74LS32 --|EXPANSION - | | |------| 74LS244 --|CONNECTOR - | |78L12 POT1 LM386 |-----| |-----| EXP1 --| - CART | | LM1889 LM1886 74LS04|NICK | |DAVE | --| - CONN | | KEYB_8 POT2 KEYB_10 | | | | --| - | | 4.433619MHz 74LS145 POT3 LED |-----| |-----| --| - |---+ --| - | 74LS74 74LS244 74LS244 74LS245 |---------| - | | - | 74LS373 4164 4164 74F157 | - | | - | 16-2-103 LM339 LM324 4164 4164 74F157 EXOS.IC2 | - | 8MHz | - | 74LS373 4164 4164 | - | 74LS04 Z80A | - | 74LS273 4164 4164 | - |------------------------------------------------------------------| -Notes: (all IC's shown) - Z80A - Z80A CPU, clock input 4MHz [8/2] - EXOS.IC2 - 32k x8-bit mask ROM usually 23256 manufactured by GI (DIP24). Contains EXOS operating - system and built-in word processor software. A few official revisions were made and - there were a few unofficial revision made with additional capabilities and bug-fixes - ROM labelling of some official versions found.... - 9256DS-0019 (C)1984 INTELLIGENT SOFTWARE LTD ENTER 08-45-A GI - 9256DS-0036 (C)1984 INTELLIGENT SOFTWARE LTD ENTER 05-23-A GI - 4164 - 64k x1-bit Dynamic RAM with Page Mode (DIP16) - NICK - Custom graphics chip (QFP72) - DAVE - Custom sound chip (QFP72) - LM386 - National Semiconductor LM386 Low Voltage Audio Power Amplifier (DIP8) - LM1889 - National Semiconductor LM1889 TV Video Modulator (DIP18) - LM1886 - National Semiconductor LM1886 TV Video Matrix DAC (DIP20) - LM339 - SGS LM339 Low Power Low Offset Voltage Quad Comparator (DIP8) - LM324 - SGS LM324 Quad Operational Amplifier (DIP8) - 74LS04 - Hex Inverter (DIP14) - 74LS06 - Hex Inverter/Buffer with Open-Collector Outputs (DIP14) - 74LS32 - Quad 2-Input Positive OR Gate (DIP14) - 74LS74 - Dual Positive-Edge-Triggered D Flip-Flops with Preset, Clear and Complementary Outputs (DIP14) - 74LS86 - Quad 2-Input Exclusive OR Gate (DIP14) - 74LS145 - BCD to Deccimal Decoder/Driver (DIP16) - 74F157 - Quad 2-Line to 1-Line Data Selector/Multiplexer (DIP16). Early rev mainboards use 74LS158 instead - 74LS244 - Octal 3-State Noninverting Buffer/Line Driver/Line Receiver (DIP20) - 74LS245 - Octal Bus Tranceiver with Tri-State Outputs (DIP20) - 74LS273 - Octal D-Type Flip-Flop With Clear (DIP20) - 74LS373 - Octal D-Type Transparent Latches and Edge-Triggered Flip-Flops (DIP20) - 7805 - Voltage regulator. +9V DC input from DC power pack, +5V DC output - 78L12 - Voltage regulator. Voltage input via small transformer on PCB. +12V DC output - POT1 - Potentiometer located near modulator and video output circuitry - POT2 - Potentiometer located near video output circuitry. Probably used to fine-tune the video clock - POT3 - Potentiometer. Possibly for video/NICK-related adjustments - LED - LED to show +5V is present - 16-2-103 - Resistor Array (DIP16) - KEYB_8 - 8 pin keyboard connector - KEYB_10 - 10 pin keyboard connector - EXP1 - 28 pin internal expansion connector (solder holes only) used for internal 64k memory expansion card - EXP2 - 10 pin internal expansion connector (solder holes only) used for internal 64k memory expansion card - MOD - Astec UM1233 TV modulator - RES - Reset push button switch - MON1 - Monitor output connector. Pinout is.... - - Green A1 B1 NC - Ground A2 B2 Ground - Mono Comp. Video A3 B3 Blue - HSync A4 B4 Red - VSync A5 B5 Composite Sync - NC A6 B6 Mode Switch - Left Audio A7 B7 Right Audio - - SR1 - Serial/Network connector. Pinout is.... - - Reference A1 B1 Ground - - A2 B2 - - RTS A3 B3 Data Out - CTS A4 B4 Data In - - PR1 - Printer connector. Pinout is.... - - Ground A1 B1 Ground - Strobe A2 B2 Ready - Data 3 A3 B3 Data 4 - - A4 B4 - - Data 2 A5 B5 Data 5 - Data 1 A6 B6 Data 6 - Data 0 A7 B7 Data 7 - - CN2A - Joystick 2 connector - CN1A - Joystick 1 connector - Pinout is.... - - Keyboard J A1 B1 Ground - Keyboard L A2 B2 Keyboard K - - A3 B3 - - Right A4 B4 +5V - Down A5 B5 Left - Fire A6 B6 Up - - -Internal Memory Expansion PCB Layout ------------------------------------- - -|---------------------| -| 4164 74LS00 PL3 PL2| -|4164 74LS30 74F157 | -|4164 4164 | -|4164 4164 74F157 | -|4164 4164 74LS32 PL1| -|---------------------| -Notes: (All IC's shown) - PL1 - 28-pin connector (solder pads only) hard-wired to solder pads EXP1 on mainboard - PL2/PL3 - 5-pin connectors (solder pads only) hard-wired to solder pads EXP2 on mainboard - 4164 - 64k x1-bit Dynamic RAM with Page Mode (DIP16) - 74LS00 - Quad 2-Input NAND Gate (DIP14) - 74LS30 - 8-input NAND Gate (DIP14) - 74LS32 - Quad 2-Input Positive OR Gate (DIP14) - 74F157 - Quad 2-Line to 1-Line Data Selector/Multiplexer (DIP16). Early rev memory boards use 74LS158 instead - -*/ - -/* - - TODO: - - - POST RAM errors - - rewrite DAVE to output to discrete DAC - - rewrite NICK - - cassette - - external joysticks - - http://ep.homeserver.hu/Dokumentacio/Konyvek/ - -*/ - -#include "includes/ep64.h" - - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// rd0_r - -//------------------------------------------------- - -READ8_MEMBER( ep64_state::rd0_r ) -{ - UINT8 data = 0xff; - - switch (m_key) - { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; - } - - return data; -} - - -//------------------------------------------------- -// rd0_r - -//------------------------------------------------- - -WRITE8_MEMBER( ep64_state::wr0_w ) -{ - /* - - bit description - - 0 KEY A - 1 KEY B - 2 KEY C - 3 KEY D - 4 PRINTER _STB - 5 CASSETTE OUT - 6 REMOTE 1 - 7 REMOTE 2 - - */ - - // keyboard - m_key = data & 0x0f; - - // printer - m_centronics->write_strobe(!BIT(data, 4)); - - // cassette - m_cassette1->output(BIT(data, 5) ? -1.0 : +1.0); - m_cassette2->output(BIT(data, 5) ? -1.0 : +1.0); - - // cassette - m_cassette1->change_state(BIT(data, 6) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_cassette2->change_state(BIT(data, 7) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - -WRITE_LINE_MEMBER( ep64_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -//------------------------------------------------- -// rd1_r - -//------------------------------------------------- - -READ8_MEMBER( ep64_state::rd1_r ) -{ - /* - - bit description - - 0 KBJ - 1 KBK - 2 KBL - 3 PRINTER _RDY - 4 SERIAL/NET DATA IN - 5 SERIAL/NET STATUS IN - 6 CASSETTE IN - 7 ? - - */ - - UINT8 data = 0; - - // printer - data |= m_centronics_busy << 3; - - // serial - data |= m_rs232->rxd_r() << 4; - data |= m_rs232->cts_r() << 5; - - // cassette - data |= ((m_cassette1->input() < 0) || (m_cassette2->input() < 0)) << 6; - - return data; -} - - -//------------------------------------------------- -// wr2_w - -//------------------------------------------------- - -WRITE8_MEMBER( ep64_state::wr2_w ) -{ - /* - - bit description - - 0 SERIAL/NET DATA OUT - 1 SERIAL/NET STATUS OUT - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - // serial - m_rs232->write_txd(!BIT(data, 0)); - m_rs232->write_rts(!BIT(data, 1)); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( ep64_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ep64_mem, AS_PROGRAM, 8, ep64_state ) - AM_RANGE(0x0000, 0xffff) AM_DEVICE(DAVE_TAG, dave_device, z80_program_map) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( ep64_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ep64_io, AS_IO, 8, ep64_state ) - AM_RANGE(0x0000, 0xffff) AM_DEVICE(DAVE_TAG, dave_device, z80_io_map) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( dave_64k_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( dave_64k_mem, AS_PROGRAM, 8, ep64_state ) - AM_RANGE(0x000000, 0x007fff) AM_ROM AM_REGION(Z80_TAG, 0) - //AM_RANGE(0x010000, 0x01ffff) // mapped by the cartslot - AM_RANGE(0x3f0000, 0x3fffff) AM_DEVICE(NICK_TAG, nick_device, vram_map) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( dave_128k_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( dave_128k_mem, AS_PROGRAM, 8, ep64_state ) - AM_IMPORT_FROM(dave_64k_mem) - AM_RANGE(0x3e0000, 0x3effff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( dave_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( dave_io, AS_IO, 8, ep64_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x8f) AM_DEVICE(NICK_TAG, nick_device, vio_map) - AM_RANGE(0xb5, 0xb5) AM_READWRITE(rd0_r, wr0_w) - AM_RANGE(0xb6, 0xb6) AM_READ(rd1_r) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0xb7, 0xb7) AM_WRITE(wr2_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( ep64 ) -//------------------------------------------------- - -static INPUT_PORTS_START( ep64 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 \xC2\xA3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a3) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNCTION 1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOLD") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( ep64 ) -//------------------------------------------------- - -void ep64_state::machine_start() -{ - if (m_cart->exists()) - m_dave->space(AS_PROGRAM).install_read_handler(0x010000, 0x01ffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - // state saving - save_item(NAME(m_key)); - save_item(NAME(m_centronics_busy)); -} - - -void ep64_state::machine_reset() -{ - m_dave->reset(); - m_nick->reset(); - - address_space &program = m_maincpu->space(AS_PROGRAM); - wr0_w(program, 0, 0); - machine().device("cent_data_out")->write(program, 0, 0); - wr2_w(program, 0, 0); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( ep64 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ep64, ep64_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) - MCFG_CPU_PROGRAM_MAP(ep64_mem) - MCFG_CPU_IO_MAP(ep64_io) - - // video hardware - MCFG_NICK_ADD(NICK_TAG, SCREEN_TAG, XTAL_8MHz) - MCFG_NICK_VIRQ_CALLBACK(DEVWRITELINE(DAVE_TAG, dave_device, int1_w)) - - // sound hardware - MCFG_DAVE_ADD(DAVE_TAG, XTAL_8MHz, dave_64k_mem, dave_io) - MCFG_DAVE_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - // devices - MCFG_EP64_EXPANSION_BUS_SLOT_ADD(EP64_EXPANSION_BUS_TAG, NULL) - MCFG_EP64_EXPANSION_BUS_SLOT_DAVE(DAVE_TAG) - MCFG_EP64_EXPANSION_BUS_SLOT_IRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_EP64_EXPANSION_BUS_SLOT_NMI_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_NMI)) - MCFG_EP64_EXPANSION_BUS_SLOT_WAIT_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(ep64_state, write_centronics_busy)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(DAVE_TAG, dave_device, int2_w)) - - MCFG_CASSETTE_ADD(CASSETTE1_TAG) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - MCFG_CASSETTE_INTERFACE("ep64_cass") - - MCFG_CASSETTE_ADD(CASSETTE2_TAG) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - MCFG_CASSETTE_INTERFACE("ep64_cass") - - // internal RAM - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "ep64_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list", "ep64_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "ep64_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "ep64_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( ep128 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( ep128, ep64 ) - MCFG_DEVICE_MODIFY(DAVE_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, dave_128k_mem) - - // internal RAM - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( ep64 ) -//------------------------------------------------- - -ROM_START( ep64 ) - ROM_REGION( 0x8000, Z80_TAG, 0 ) - ROM_LOAD( "9256ds-0038_enter05-23-a.u2", 0x0000, 0x8000, CRC(d421795f) SHA1(6033a0535136c40c47137e4d1cd9273c06d5fdff) ) -ROM_END - -#define rom_phc64 rom_ep64 - - -//------------------------------------------------- -// ROM( ep128 ) -//------------------------------------------------- - -ROM_START( ep128 ) - ROM_REGION( 0x8000, Z80_TAG, 0 ) - ROM_LOAD( "9256ds-0019_enter08-45-a.u2", 0x0000, 0x8000, CRC(982a3b44) SHA1(55315b20fecb4441a07ee4bc5dc7153f396e0a2e) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1985, ep64, 0, 0, ep64, ep64, driver_device, 0, "Enterprise Computers", "Enterprise Sixty Four", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -COMP( 1985, phc64, ep64, 0, ep64, ep64, driver_device, 0, "Hegener & Glaser", "Mephisto PHC 64 (Germany)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -COMP( 1986, ep128, ep64, 0, ep128, ep64, driver_device, 0, "Enterprise Computers", "Enterprise One Two Eight", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mess/drivers/esq1.c b/src/mess/drivers/esq1.c deleted file mode 100644 index b37f26185aa..00000000000 --- a/src/mess/drivers/esq1.c +++ /dev/null @@ -1,698 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont, Olivier Galibert -/*************************************************************************** - - drivers/esq1.c - - Ensoniq ESQ-1 Digital Wave Synthesizer - Ensoniq ESQ-M (rack-mount ESQ-1) - Ensoniq SQ-80 Cross Wave Synthesizer - Driver by R. Belmont and O. Galibert - - Map for ESQ-1 and ESQ-m: - 0000-1fff: OS RAM - 2000-3fff: Cartridge - 4000-5fff: SEQRAM - 6000-63ff: ES5503 DOC - 6400-67ff: MC2681 DUART - 6800-6fff: AD7524 (CV_MUX) - 7000-7fff: OS ROM low (banked) - 8000-ffff: OS ROM high (fixed) - - Map for SQ-80: - 0000-1fff: OS RAM - 2000-3fff: Cartridge - 4000-5fff: DOSRAM or SEQRAM (banked) - 6000-63ff: ES5503 DOC - 6400-67ff: MC2681 DUART - 6800-6bff: AD7524 (CV_MUX) - 6c00-6dff: Mapper (bit 0 only - determines DOSRAM or SEQRAM at 4000) - 6e00-6fff: WD1772 FDC (not present on ESQ1) - 7000-7fff: OS ROM low (banked) - 8000-ffff: OS ROM high (fixed) - - CV_MUX area: - write to output goes to - $68f8 $00 D/A converter - $68f0 -$08 Filter Frequency (FF) - $68e8 -$10 Filter Resonance (Q) - $68d8 -$20 Final DCA (ENV4) - $68b8 -$40 Panning (PAN) - $6878 -$80 Floppy (Motor/LED on - SQ-80 only) - -ESQ1: 8x CEM3379 VC Signal Processor Filter/Mix/VCA, 1x CEM3360 Dual VCA, 4x SSM2300 -SQ-80: 8x CEM3379 VC Signal Processor - Filter/Mix/VCA, 1x CEM3360 Dual VCA, 4x SSM2300 - - -If SEQRAM is mapped at 4000, DUART port 2 determines the 32KB "master bank" and ports 0 and 1 -determine which of the 4 8KB "sub banks" is visible. - -Output ports 3 to 1 determine the 4kB page which should be shown at $7000 to $7fff. - -IRQ sources are the DUART and the DRQ line from the FDC (SQ-80 only). -NMI is from the IRQ line on the FDC (again, SQ-80 only). - -TODO: - - VFD display - - Keyboard - - Analog filters and VCA on the back end of the 5503 - - SQ-80 support (additional banking, FDC) - -NOTES: - Commands from KPC are all 2 bytes - - first byte: command code, bit 7 is 1 = press, 0 = release - second byte is source: 00 = panel 01 = internal keyboard - - 04 SEQ - 05 CART A - 06 CART B - 07 INT - 08 1 / SEQ 1 - 09 2 / SEQ 2 - 0A 3 / SEQ 3 - 0B 4 / SONG - 0C COMPARE - 0D DATA UP - 0E DATA DOWN - 0F WRITE - 10 = UPPER 1 (buttons above display) - 11 = UPPER 2 - 12 = UPPER 3 - 13 = UPPER 4 - 14 = UPPER 5 - 15 = LOWER 1 (buttons below display) - 16 = LOWER 2 - 17 = LOWER 3 - 18 = LOWER 4 - 19 = LOWER 5 - 1a = LFO 1 - 1b = ENV 2 - 1c = MASTER - 1d = CREATE / ERASE - 1e = SELECT - 1f = RECORD - 20 = STORAGE - 21 = EDIT - 22 = MIX - 23 = STOP / CONT - 24 = MIDI - 25 = CONTROL - 26 = LOCATE - 27 = PLAY - 28 = OSC 1 - 29 = OSC 2 - 2A = OSC 3 - 2B = ENV 1 - 2C = DCA 1 - 2D = DCA 2 - 2E = DCA 3 - 2F = LFO 2 - 30 = LFO 3 - 31 = FILTER - 32 = ENV 4 - 33 = ENV 3 - 34 = DCA 4 - 35 = MODES - 36 = SPLIT / LAYER - - - Analog filters (CEM3379): - - The analog part is relatively simple. The digital part outputs 8 - voices, which are filtered, amplified, panned then summed - together. - - The filtering stage is a 4-level lowpass filter with a loopback: - - - +-[+]-<-[*-1]--------------------------+ - | | | - ^ [*r] | - | | | - | v ^ - input ---+-[+]--[LPF]---[LPF]---[LPF]---[LPF]---+--- output - - All 4 LPFs are identical, with a transconductance G: - - output = 1/(1+s/G)^4 * ( (1+r)*input - r*output) - - or - - output = input * (1+r)/((1+s/G)^4+r) - - to which the usual z-transform can be applied (see votrax.c) - - G is voltage controlled through the Vfreq input, with the formula (Vfreq in mV): - - G = 6060*exp(Vfreq/28.5) - - That gives a cutoff frequency (f=G/(2pi)) of 5Hz at 5mV, 964Hz at - 28.5mV and 22686Hz at 90mV. The resistor ladder between the DAC - and the input seem to map 0..255 into a range of -150.4mV to - +83.6mV. - - The resonance is controlled through the Vq input pin, and is not - well defined. Reading between the lines the control seems linear - and tops when then circuit is self-oscillation, at r=4. - - The amplification is exponential for a control voltage between 0 - to 0.2V from -100dB to -20dB, and then linear up to 5V at 0dB. Or - in other words: - amp(Vca) = Vca < 0.2 ? 10**(-5+20*Vca) : Vca*0.1875 + 0.0625 - - - Finally the panning is not very described. What is clear is that - the control voltage at 2.5V gives a gain of -6dB, the max - attenuation at 0/5V is -100dB. The doc also says the gain is - linear between 1V and 3.5V, which makes no sense since it's not - symmetrical, and logarithmic afterwards, probably meaning - exponential, otherwise the change between 0 and 1V would be - minimal. So we're going to do some assumptions: - - 0-1V exponential from -100Db to -30dB - - 1V-2.5V linear from -30dB to -6dB - - 2.5V-5V is 1-amp at 2.5V-v - - Note that this may be incorrect, maybe to sum of squares should be - constant, the half-point should be at -3dB and the linearity in dB - space. - - -***************************************************************************/ - -#include "bus/midi/midi.h" -#include "cpu/m6809/m6809.h" -#include "sound/es5503.h" -#include "machine/mc68681.h" -#include "machine/wd_fdc.h" -#include "machine/esqpanel.h" - -#define WD1772_TAG "wd1772" - -class esq1_filters : public device_t, - public device_sound_interface -{ -public: - // construction/destruction - esq1_filters(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - void set_vca(int channel, UINT8 value); - void set_vpan(int channel, UINT8 value); - void set_vq(int channel, UINT8 value); - void set_vfc(int channel, UINT8 value); - -protected: - // device-level overrides - virtual void device_start(); - - // device_sound_interface overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -private: - struct filter { - UINT8 vca, vpan, vq, vfc; - double amp, lamp, ramp; - double a[5], b[5]; - double x[4], y[4]; - }; - - filter filters[8]; - - sound_stream *stream; - - void recalc_filter(filter &f); -}; - -static const device_type ESQ1_FILTERS = &device_creator; - -esq1_filters::esq1_filters(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ESQ1_FILTERS, "ESQ1 Filters stage", tag, owner, clock, "esq1-filters", __FILE__), - device_sound_interface(mconfig, *this) -{ -} - -void esq1_filters::set_vca(int channel, UINT8 value) -{ - if(filters[channel].vca != value) { - stream->update(); - filters[channel].vca = value; - recalc_filter(filters[channel]); - } -} - -void esq1_filters::set_vpan(int channel, UINT8 value) -{ - if(filters[channel].vpan != value) { - stream->update(); - filters[channel].vpan = value; - recalc_filter(filters[channel]); - } -} - -void esq1_filters::set_vq(int channel, UINT8 value) -{ - if(filters[channel].vq != value) { - stream->update(); - filters[channel].vq = value; - recalc_filter(filters[channel]); - } -} - -void esq1_filters::set_vfc(int channel, UINT8 value) -{ - if(filters[channel].vfc != value) { - stream->update(); - filters[channel].vfc = value; - recalc_filter(filters[channel]); - } -} - -void esq1_filters::recalc_filter(filter &f) -{ - // Filtering stage - // First let's establish the control values - // Some tuning may be required - - double vfc = -150.4 + (83.6+150.4)*f.vfc/255; - double r = 4.0*f.vq/255; - - - double g = 6060*exp(vfc/28.5); - double zc = g/tan(g/2/44100); - -/* if(f.vfc) { - double ff = g/(2*M_PI); - double fzc = 2*M_PI*ff/tan(M_PI*ff/44100); - fprintf(stderr, "%02x f=%f zc=%f zc1=%f\n", f.vfc, g/(2*M_PI), zc, fzc); - }*/ - - double gzc = zc/g; - double gzc2 = gzc*gzc; - double gzc3 = gzc2*gzc; - double gzc4 = gzc3*gzc; - double r1 = 1+r; - - f.a[0] = r1; - f.a[1] = 4*r1; - f.a[2] = 6*r1; - f.a[3] = 4*r1; - f.a[4] = r1; - - f.b[0] = r1 + 4*gzc + 6*gzc2 + 4*gzc3 + gzc4; - f.b[1] = 4*(r1 + 2*gzc - 2*gzc3 - gzc4); - f.b[2] = 6*(r1 - 2*gzc2 + gzc4); - f.b[3] = 4*(r1 - 2*gzc + 2*gzc3 - gzc4); - f.b[4] = r1 - 4*gzc + 6*gzc2 - 4*gzc3 + gzc4; - -/* if(f.vfc != 0) - for(int i=0; i<5; i++) - printf("a%d=%f\nb%d=%f\n", - i, f.a[i], i, f.b[i]);*/ - - // Amplification stage - double vca = f.vca*(5.0/255.0); - f.amp = vca < 0.2 ? pow(10, -5+20*vca) : vca*0.1875 + 0.0625; - - // Panning stage - // Very approximative at best - // Left/right unverified - double vpan = f.vpan*(5.0/255.0); - double vref = vpan > 2.5 ? 2.5 - vpan : vpan; - double pan_amp = vref < 1 ? pow(10, -5+3.5*vref) : vref*0.312 - 0.280; - if(vref < 2.5) { - f.lamp = pan_amp; - f.ramp = 1-pan_amp; - } else { - f.lamp = 1-pan_amp; - f.ramp = pan_amp; - } -} - -void esq1_filters::device_start() -{ - stream = stream_alloc(8, 2, 44100); - memset(filters, 0, sizeof(filters)); - for(int i=0; i<8; i++) - recalc_filter(filters[i]); -} - -void esq1_filters::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ -/* if(0) { - for(int i=0; i<8; i++) - fprintf(stderr, " [%02x %02x %02x %02x]", - filters[i].vca, - filters[i].vpan, - filters[i].vq, - filters[i].vfc); - fprintf(stderr, "\n"); - }*/ - - for(int i=0; i maxl) { - maxl = l; -// fprintf(stderr, "%f\n", maxl); - } - -// l *= 6553; -// r *= 6553; - l *= 2; - r *= 2; - outputs[0][i] = l < -32768 ? -32768 : l > 32767 ? 32767 : int(l); - outputs[1][i] = r < -32768 ? -32768 : r > 32767 ? 32767 : int(r); - } -} - -class esq1_state : public driver_device -{ -public: - esq1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_duart(*this, "duart"), - m_filters(*this, "filters"), - m_fdc(*this, WD1772_TAG), - m_panel(*this, "panel"), - m_mdout(*this, "mdout") - { } - - required_device m_maincpu; - required_device m_duart; - required_device m_filters; - optional_device m_fdc; - optional_device m_panel; - optional_device m_mdout; - - DECLARE_READ8_MEMBER(wd1772_r); - DECLARE_WRITE8_MEMBER(wd1772_w); - DECLARE_READ8_MEMBER(seqdosram_r); - DECLARE_WRITE8_MEMBER(seqdosram_w); - DECLARE_WRITE8_MEMBER(mapper_w); - DECLARE_WRITE8_MEMBER(analog_w); - - DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); - DECLARE_WRITE_LINE_MEMBER(duart_tx_a); - DECLARE_WRITE_LINE_MEMBER(duart_tx_b); - DECLARE_WRITE8_MEMBER(duart_output); - - DECLARE_WRITE_LINE_MEMBER(esq1_doc_irq); - DECLARE_READ8_MEMBER(esq1_adc_read); - - int m_mapper_state; - int m_seq_bank; - UINT8 m_seqram[0x10000]; - UINT8 m_dosram[0x2000]; - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); - - void send_through_panel(UINT8 data); -}; - - -WRITE_LINE_MEMBER(esq1_state::esq1_doc_irq) -{ -} - -READ8_MEMBER(esq1_state::esq1_adc_read) -{ - return 0x00; -} - -void esq1_state::machine_reset() -{ - // set default OSROM banking - membank("osbank")->set_base(memregion("osrom")->base() ); - - m_mapper_state = 0; - m_seq_bank = 0; -} - -READ8_MEMBER(esq1_state::wd1772_r) -{ - return m_fdc->read(space, offset&3); -} - -WRITE8_MEMBER(esq1_state::wd1772_w) -{ - m_fdc->write(space, offset&3, data); -} - -WRITE8_MEMBER(esq1_state::mapper_w) -{ - m_mapper_state = (data & 1) ^ 1; - -// printf("mapper_state = %d\n", data ^ 1); -} - -WRITE8_MEMBER(esq1_state::analog_w) -{ - if(!(offset & 8)) - m_filters->set_vfc(offset & 7, data); - if(!(offset & 16)) - m_filters->set_vq(offset & 7, data); - if(!(offset & 32)) - m_filters->set_vpan(offset & 7, data); - if(!(offset & 64)) - m_filters->set_vca(offset & 7, data); -} - -READ8_MEMBER(esq1_state::seqdosram_r) -{ - if (m_mapper_state) - { - return m_dosram[offset]; - } - else - { - return m_seqram[offset + m_seq_bank]; - } -} - -WRITE8_MEMBER(esq1_state::seqdosram_w) -{ - if (m_mapper_state) - { - m_dosram[offset] = data; - } - else - { - m_seqram[offset + m_seq_bank] = data; - } -} - -static ADDRESS_MAP_START( esq1_map, AS_PROGRAM, 8, esq1_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAM // OSRAM - AM_RANGE(0x4000, 0x5fff) AM_RAM // SEQRAM - AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("es5503", es5503_device, read, write) - AM_RANGE(0x6400, 0x640f) AM_DEVREADWRITE("duart", mc68681_device, read, write) - AM_RANGE(0x6800, 0x68ff) AM_WRITE(analog_w) - AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("osbank") - AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("osrom", 0x8000) // OS "high" ROM is always mapped here -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sq80_map, AS_PROGRAM, 8, esq1_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAM // OSRAM - AM_RANGE(0x4000, 0x5fff) AM_RAM // SEQRAM -// AM_RANGE(0x4000, 0x5fff) AM_READWRITE(seqdosram_r, seqdosram_w) - AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("es5503", es5503_device, read, write) - AM_RANGE(0x6400, 0x640f) AM_DEVREADWRITE("duart", mc68681_device, read, write) - AM_RANGE(0x6800, 0x68ff) AM_WRITE(analog_w) - AM_RANGE(0x6c00, 0x6dff) AM_WRITE(mapper_w) - AM_RANGE(0x6e00, 0x6fff) AM_READWRITE(wd1772_r, wd1772_w) - AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("osbank") - AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("osrom", 0x8000) // OS "high" ROM is always mapped here -ADDRESS_MAP_END - -// from the schematics: -// -// DUART channel A is MIDI -// channel B is to the keyboard/display -// IP0 = tape in -// IP1 = sequencer expansion cartridge inserted -// IP2 = patch cartridge inserted -// IP3 & 4 are 0.5 MHz, IP 5 & 6 are 1 MHz (note 0.5 MHz / 16 = MIDI baud rate) -// -// OP0 = to display processor -// OP1/2/3 = bank select 0, 1, and 2 -// OP4 = metronome low -// OP5 = metronome hi -// OP6/7 = tape out - -WRITE_LINE_MEMBER(esq1_state::duart_irq_handler) -{ - m_maincpu->set_input_line(M6809_IRQ_LINE, state); -} - -WRITE8_MEMBER(esq1_state::duart_output) -{ - int bank = ((data >> 1) & 0x7); -// printf("DP [%02x]: %d mlo %d mhi %d tape %d\n", data, data&1, (data>>4)&1, (data>>5)&1, (data>>6)&3); -// printf("[%02x] bank %d => offset %x (PC=%x)\n", data, bank, bank * 0x1000, m_maincpu->safe_pc()); - membank("osbank")->set_base(memregion("osrom")->base() + (bank * 0x1000) ); - - m_seq_bank = (data & 0x8) ? 0x8000 : 0x0000; - m_seq_bank += ((data>>1) & 3) * 0x2000; -// printf("seqram_bank = %x\n", state->m_seq_bank); -} - -// MIDI send -WRITE_LINE_MEMBER(esq1_state::duart_tx_a) -{ - m_mdout->write_txd(state); -} - -WRITE_LINE_MEMBER(esq1_state::duart_tx_b) -{ - m_panel->rx_w(state); -} - -void esq1_state::send_through_panel(UINT8 data) -{ - m_panel->xmit_char(data); -} - -INPUT_CHANGED_MEMBER(esq1_state::key_stroke) -{ - if (oldval == 0 && newval == 1) - { - send_through_panel((UINT8)(FPTR)param); - send_through_panel((UINT8)(FPTR)0x00); - } - else if (oldval == 1 && newval == 0) - { - send_through_panel((UINT8)(FPTR)param&0x7f); - send_through_panel((UINT8)(FPTR)0x00); - } -} - -static MACHINE_CONFIG_START( esq1, esq1_state ) - MCFG_CPU_ADD("maincpu", M6809E, 4000000) // how fast is it? - MCFG_CPU_PROGRAM_MAP(esq1_map) - - MCFG_MC68681_ADD("duart", 4000000) - MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(esq1_state, duart_irq_handler)) - MCFG_MC68681_A_TX_CALLBACK(WRITELINE(esq1_state, duart_tx_a)) - MCFG_MC68681_B_TX_CALLBACK(WRITELINE(esq1_state, duart_tx_b)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(esq1_state, duart_output)) - - MCFG_ESQPANEL2x40_ADD("panel") - MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) // route MIDI Tx send directly to 68681 channel A Rx - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD("filters", ESQ1_FILTERS, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_ES5503_ADD("es5503", 7000000) - MCFG_ES5503_OUTPUT_CHANNELS(8) - MCFG_ES5503_IRQ_FUNC(WRITELINE(esq1_state, esq1_doc_irq)) - MCFG_ES5503_ADC_FUNC(READ8(esq1_state, esq1_adc_read)) - - MCFG_SOUND_ROUTE_EX(0, "filters", 1.0, 0) - MCFG_SOUND_ROUTE_EX(1, "filters", 1.0, 1) - MCFG_SOUND_ROUTE_EX(2, "filters", 1.0, 2) - MCFG_SOUND_ROUTE_EX(3, "filters", 1.0, 3) - MCFG_SOUND_ROUTE_EX(4, "filters", 1.0, 4) - MCFG_SOUND_ROUTE_EX(5, "filters", 1.0, 5) - MCFG_SOUND_ROUTE_EX(6, "filters", 1.0, 6) - MCFG_SOUND_ROUTE_EX(7, "filters", 1.0, 7) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED(sq80, esq1) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sq80_map) - - MCFG_WD1772_ADD(WD1772_TAG, 4000000) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( esq1 ) - PORT_START("KEY0") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x84) PORT_NAME("SEQ") - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x85) PORT_NAME("CART A") - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x86) PORT_NAME("CART B") - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x87) PORT_NAME("INT") - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x88) PORT_NAME("1 / SEQ 1") - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x89) PORT_NAME("2 / SEQ 2") - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8a) PORT_NAME("3 / SEQ 3") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8b) PORT_NAME("4 / SONG") - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8c) PORT_NAME("COMPARE") - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8e) PORT_NAME("DATA DOWN") - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8d) PORT_NAME("DATA UP") - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x8f) PORT_NAME("WRITE") - - PORT_START("KEY1") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x90) PORT_NAME("UPPER 1") - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x91) PORT_NAME("UPPER 2") - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x92) PORT_NAME("UPPER 3") - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x93) PORT_NAME("UPPER 4") - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x99) PORT_NAME("UPPER 5") - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x94) PORT_NAME("LOWER 1") - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x95) PORT_NAME("LOWER 2") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x96) PORT_NAME("LOWER 3") - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x97) PORT_NAME("LOWER 4") - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, esq1_state, key_stroke, 0x98) PORT_NAME("LOWER 5") - - -INPUT_PORTS_END - -ROM_START( esq1 ) - ROM_REGION(0x10000, "osrom", 0) - ROM_LOAD( "3p5lo.bin", 0x0000, 0x8000, CRC(ed001ad8) SHA1(14d1150bccdbc15d90567cf1812aacdb3b6ee882) ) - ROM_LOAD( "3p5hi.bin", 0x8000, 0x8000, CRC(332c572f) SHA1(ddb4f62807eb2ab29e5ac6b5d209d2ecc74cf806) ) - - ROM_REGION(0x20000, "es5503", 0) - ROM_LOAD( "esq1wavlo.bin", 0x0000, 0x8000, CRC(4d04ac87) SHA1(867b51229b0a82c886bf3b216aa8893748236d8b) ) - ROM_LOAD( "esq1wavhi.bin", 0x8000, 0x8000, CRC(94c554a3) SHA1(ed0318e5253637585559e8cf24c06d6115bd18f6) ) -ROM_END - -ROM_START( sq80 ) - ROM_REGION(0x10000, "osrom", 0) - ROM_LOAD( "sq80rom.low", 0x0000, 0x008000, CRC(97ecd9a0) SHA1(cadff16ebbc15b52cf1d3335d22dc930d430a058) ) - ROM_LOAD( "sq80rom.hig", 0x8000, 0x008000, CRC(f83962b1) SHA1(e3e5cf41f15a37f8bf29b88fb1c85c0fca9ea912) ) - - ROM_REGION(0x40000, "es5503", 0) - ROM_LOAD( "2202.bin", 0x0000, 0x010000, CRC(dffd538c) SHA1(e90f6ff3a7804b54c8a3b1b574ec9c223a6c2bf9) ) - ROM_LOAD( "2203.bin", 0x0000, 0x010000, CRC(9be8cceb) SHA1(1ee4d7e6d2171b44e88e464071bdc4b800b69c4a) ) - ROM_LOAD( "2204.bin", 0x0000, 0x010000, CRC(4937c6f7) SHA1(4505efb9b28fe6d4bcc1f79e81a70bb215c399cb) ) - ROM_LOAD( "2205.bin", 0x0000, 0x010000, CRC(0f917d40) SHA1(1cfae9c80088f4c90b3c9e0b284c3b91f7ff61b9) ) - - ROM_REGION(0x8000, "kpc", 0) // 68HC11 keyboard/front panel processor - ROM_LOAD( "sq80_kpc_150.bin", 0x000000, 0x008000, CRC(8170b728) SHA1(3ad68bb03948e51b20d2e54309baa5c02a468f7c) ) -ROM_END - -ROM_START( esqm ) - ROM_REGION(0x10000, "osrom", 0) - ROM_LOAD( "1355500157_d640_esq-m_oshi.u14", 0x8000, 0x008000, CRC(ea6a7bae) SHA1(2830f8c52dc443b4ca469dc190b33e2ff15b78e1) ) - - ROM_REGION(0x20000, "es5503", 0) - ROM_LOAD( "esq1wavlo.bin", 0x0000, 0x8000, CRC(4d04ac87) SHA1(867b51229b0a82c886bf3b216aa8893748236d8b) ) - ROM_LOAD( "esq1wavhi.bin", 0x8000, 0x8000, CRC(94c554a3) SHA1(ed0318e5253637585559e8cf24c06d6115bd18f6) ) -ROM_END - - -CONS( 1986, esq1, 0 , 0, esq1, esq1, driver_device, 0, "Ensoniq", "ESQ-1", MACHINE_NOT_WORKING ) -CONS( 1986, esqm, esq1, 0, esq1, esq1, driver_device, 0, "Ensoniq", "ESQ-M", MACHINE_NOT_WORKING ) -CONS( 1988, sq80, 0, 0, sq80, esq1, driver_device, 0, "Ensoniq", "SQ-80", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/esq5505.c b/src/mess/drivers/esq5505.c deleted file mode 100644 index aaca4b127da..00000000000 --- a/src/mess/drivers/esq5505.c +++ /dev/null @@ -1,955 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - esq5505.c - Ensoniq ES5505 + ES5510 based synthesizers and samplers - - Ensoniq VFX, VFX-SD, EPS, EPS-16 Plus, SD-1, SD-1 32, SQ-1 and SQ-R (SQ-1 Plus, - SQ-2, and KS-32 are known to also be this architecture). - - The Taito sound system in taito_en.c is directly derived from the 32-voice version - of the SD-1. - - Driver by R. Belmont with thanks to Parduz, Christian Brunschen, and Phil Bennett - - Memory map: - - 0x000000-0x007fff work RAM low (64k for SQ-1 and later) - 0x200000-0x20001f OTIS (5505) regs - 0x240000-0x2400ff DMAC (68450) regs (EPS/EPS-16) - 0x260000-0x2601ff ESP (5510) regs - 0x280000-0x28001f DUART (68681) regs - 0x2C0000-0x2C0003 Floppy (WD1772) regs (VFX-SD, SD-1, and EPS/EPS-16) - 0x2e0000-0x2fffff Expansion cartridge (VFX, VFX-SD, SD-1, SD-1 32 voice) - 0x300000-0x300003 EPS/EPS-16 SCSI (WD33C93, register at 300001, data at 300003) - 0x330000-0x37ffff VFX-SD / SD-1 sequencer RAM - 0x340000-0x3bffff EPS/EPS-16 sample RAM - 0xc00000-0xc3ffff OS ROM - 0xff8000-0xffffff work RAM hi (64k for SQ-1 and later) - - Note from es5700.pdf PLA equations: - RAM if (A23/22/21 = 000 and FC is not 6) or (A23/22/21 = 111 and FC is not 7) - ROM if (A23/22/21 = 110) or (A23/22/21 = 000 & FC is 6) - - Interrupts: - 5505 interrupts are on normal autovector IRQ 1 - DMAC interrupts (EPS only) are on autovector IRQ 2 - 68681 uses custom vector 0x40 (address 0x100) level 3 - - VFX / VFX-SD / SD-1 / SD-1 32 panel button codes: - 2 = PROGRAM CONTROL - 3 = WRITE - 4 = WAVE - 5 = SELECT VOICE - 6 = MIXER/SHAPER - 7 = EFFECT - 8 = COMPARE - 9 = COPY EFFECTS PARAMETERS - 10 = LFO - 11 = PITCH - 12 = ENV1 - 13 = PITCH MOD - 14 = ENV2 - 15 = FILTER - 16 = ENV3 - 17 = OUTPUT - 18 = ERROR 20 (VFX) / SEQ. CONTROL - 19 = RECORD - 20 = MASTER - 21 = STORAGE - 22 = STOP/CONT - 23 = PLAY - 24 = MIDI - 25 = BUTTON 9 - 26 = PSEL - 27 = STAT - 28 = EFFECT - 29 = SEQ? (toggles INT0 / TRAX display) - 30 = TRACKS 1-6 - 31 = TRACKS 7-12 - 32 = ERROR 20 (VFX) / CLICK-REC - 33 = ERROR 20 (VFX) / LOCATE - 34 = BUTTON 8 - 35 = BUTTON 7 - 36 = VOLUME - 37 = PAN - 38 = TIMBRE - 39 = KEY ZONE - 40 = TRANSPOSE - 41 = RELEASE - 42 = SOFT TOP CENTER - 43 = SOFT TOP RIGHT - 44 = SOFT BOTTOM CENTER - 45 = SOFT BOTTOM RIGHT - 46 = BUTTON 3 - 47 = BUTTON 4 - 48 = BUTTON 5 - 49 = BUTTON 6 - 50 = SOFT BOTTOM LEFT - 51 = ERROR 202 (VFX) / SEQ. - 52 = CART - 53 = SOUNDS - 54 = PRESETS - 55 = BUTTON 0 - 56 = BUTTON 1 - 57 = BUTTON 2 - 58 = SOFT TOP LEFT - 59 = ERROR 20 (VFX) / EDIT SEQUENCE - 60 = ERROR 20 (VFX) / EDIT SONG - 61 = ERROR 20 (VFX) / EDIT TRACK - 62 = DATA INCREMENT - 63 = DATA DECREMENT - - VFX / VFX-SD / SD-1 analog values: - 0 = Pitch Bend - 1 = Patch Select - 2 = Mod Wheel - 3 = Value, aka Data Entry Slider - 4 = Pedal / CV - 5 = Volume Slider - 6 = Battery - 7 = Voltage Reference - - SQ-1: - 4 = second digit of patch # becomes 2 - 5 = first digit of patch # becomes 2 - 6 = second digit of patch # becomes 4 - 7 = first digit of patch # becomes 4 - 8 = trk07 4volume=99 - 12 = patch -1 - 13 = patch +1 - 14 = second digit of patch # becomes 5 - 15 = first digit of patch # becomes 5 - 20 = select sound? - 22 = second digit of patch # becomes 6 - 23 = first digit of patch # becomes 6 - -***************************************************************************/ - -#include - -#include "bus/midi/midi.h" -#include "cpu/m68000/m68000.h" -#include "sound/es5506.h" -#include "sound/esqpump.h" -#include "machine/mc68681.h" -#include "cpu/es5510/es5510.h" -#include "machine/wd_fdc.h" -#include "machine/hd63450.h" // compatible with MC68450, which is what these really have -#include "formats/esq16_dsk.h" -#include "machine/esqvfd.h" -#include "machine/esqpanel.h" - -#define GENERIC (0) -#define EPS (1) -#define SQ1 (2) - -#define KEYBOARD_HACK (1) // turn on to play the SQ-1, SD-1, and SD-1 32-voice: Z and X are program up/down, A/S/D/F/G/H/J/K/L and Q/W/E/R/T/Y/U play notes - -#if KEYBOARD_HACK -static int shift = 32; -#endif - -#if 0 -static void ATTR_PRINTF(1,2) print_to_stderr(const char *format, ...) -{ - va_list arg; - va_start(arg, format); - vfprintf(stderr, format, arg); - va_end(arg); -} -#endif - -class esq5505_state : public driver_device -{ -public: - esq5505_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_duart(*this, "duart"), - m_otis(*this, "otis"), - m_esp(*this, "esp"), - m_pump(*this, "pump"), - m_fdc(*this, "wd1772"), - m_panel(*this, "panel"), - m_dmac(*this, "mc68450"), - m_mdout(*this, "mdout") - { } - - required_device m_maincpu; - required_device m_duart; - required_device m_otis; - required_device m_esp; - required_device m_pump; - optional_device m_fdc; - required_device m_panel; - optional_device m_dmac; - required_device m_mdout; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ16_MEMBER(lower_r); - DECLARE_WRITE16_MEMBER(lower_w); - - DECLARE_READ16_MEMBER(analog_r); - DECLARE_WRITE16_MEMBER(analog_w); - - DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); - DECLARE_WRITE_LINE_MEMBER(duart_tx_a); - DECLARE_WRITE_LINE_MEMBER(duart_tx_b); - DECLARE_WRITE8_MEMBER(duart_output); - - int m_system_type; - UINT8 m_duart_io; - UINT8 otis_irq_state; - UINT8 dmac_irq_state; - int dmac_irq_vector; - UINT8 duart_irq_state; - int duart_irq_vector; - - void update_irq_to_maincpu(); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - -private: - UINT16 *m_rom, *m_ram; - UINT16 m_analog_values[8]; - -public: - DECLARE_DRIVER_INIT(eps); - DECLARE_DRIVER_INIT(common); - DECLARE_DRIVER_INIT(sq1); - DECLARE_DRIVER_INIT(denib); - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); - IRQ_CALLBACK_MEMBER(maincpu_irq_acknowledge_callback); - DECLARE_WRITE_LINE_MEMBER(esq5505_otis_irq); - - //dmac - DECLARE_WRITE8_MEMBER(dma_end); - DECLARE_WRITE8_MEMBER(dma_error); - DECLARE_READ8_MEMBER(fdc_read_byte); - DECLARE_WRITE8_MEMBER(fdc_write_byte); -}; - -FLOPPY_FORMATS_MEMBER( esq5505_state::floppy_formats ) - FLOPPY_ESQIMG_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( ensoniq_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -IRQ_CALLBACK_MEMBER(esq5505_state::maincpu_irq_acknowledge_callback) -{ - // We immediately update the interrupt presented to the CPU, so that it doesn't - // end up retrying the same interrupt over and over. We then return the appropriate vector. - int vector = 0; - switch(irqline) { - case 1: - otis_irq_state = 0; - vector = M68K_INT_ACK_AUTOVECTOR; - break; - case 2: - dmac_irq_state = 0; - vector = dmac_irq_vector; - break; - case 3: - duart_irq_state = 0; - vector = duart_irq_vector; - break; - default: - printf("\nUnexpected IRQ ACK Callback: IRQ %d\n", irqline); - return 0; - } - update_irq_to_maincpu(); - return vector; -} - -void esq5505_state::machine_start() -{ - driver_device::machine_start(); - // tell the pump about the OTIS & ESP chips - m_pump->set_otis(m_otis); - m_pump->set_esp(m_esp); -} - -void esq5505_state::machine_reset() -{ - floppy_connector *con = machine().device("wd1772:0"); - floppy_image_device *floppy = con ? con->get_device() : 0; - - m_rom = (UINT16 *)(void *)memregion("osrom")->base(); - m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); - - // Default analog values: - m_analog_values[0] = 0x7fff; // pitch mod: start in the center - m_analog_values[1] = 0x0000; // patch select: nothing pressed. - m_analog_values[2] = 0x0000; // mod wheel: at the bottom, no modulation - m_analog_values[3] = 0xcccc; // data entry: somewhere in the middle - m_analog_values[4] = 0xffff; // control voltage / pedal: full on. - m_analog_values[5] = 0xffff; // Volume control: full on. - m_analog_values[6] = 0x7fc0; // Battery voltage: something reasonable. - m_analog_values[7] = 0x5540; // vRef to check battery. - - // on VFX, bit 0 is 1 for 'cartridge present'. - // on VFX-SD and later, bit 0 is 1 for floppy present, bit 1 is 1 for cartridge present - if (core_stricmp(machine().system().name, "vfx") == 0) - { - // todo: handle VFX cart-in when we support cartridges - m_duart->ip0_w(ASSERT_LINE); - } - else - { - m_duart->ip1_w(CLEAR_LINE); - - if (floppy) - { - m_duart->ip0_w(ASSERT_LINE); - } - else - { - m_duart->ip0_w(CLEAR_LINE); - } - } -} - -void esq5505_state::update_irq_to_maincpu() { - //printf("\nupdating IRQ state: have OTIS=%d, DMAC=%d, DUART=%d\n", otis_irq_state, dmac_irq_state, duart_irq_state); - if (duart_irq_state) { - m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); - m_maincpu->set_input_line_and_vector(M68K_IRQ_3, ASSERT_LINE, duart_irq_vector); - } else if (dmac_irq_state) { - m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); - m_maincpu->set_input_line_and_vector(M68K_IRQ_2, ASSERT_LINE, dmac_irq_vector); - } else if (otis_irq_state) { - m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); - } else { - m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); - } -} - -READ16_MEMBER(esq5505_state::lower_r) -{ - offset &= 0x7fff; - - // get pointers when 68k resets - if (!m_rom) - { - m_rom = (UINT16 *)(void *)memregion("osrom")->base(); - m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); - } - - if (m_maincpu->get_fc() == 0x6) // supervisor mode = ROM - { - return m_rom[offset]; - } - else - { - return m_ram[offset]; - } -} - -WRITE16_MEMBER(esq5505_state::lower_w) -{ - offset &= 0x7fff; - - if (offset < 0x4000) - { - if (m_maincpu->get_fc() != 0x6) // if not supervisor mode, RAM - { - COMBINE_DATA(&m_ram[offset]); - } - else - { - logerror("Write to ROM: %x @ %x (fc=%x)\n", data, offset, m_maincpu->get_fc()); - } - } - else - { - COMBINE_DATA(&m_ram[offset]); - } -} - -static ADDRESS_MAP_START( vfx_map, AS_PROGRAM, 16, esq5505_state ) - AM_RANGE(0x000000, 0x007fff) AM_READWRITE(lower_r, lower_w) - AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("otis", es5505_device, read, write) - AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0x00ff) - AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x00ff) - AM_RANGE(0xc00000, 0xc1ffff) AM_ROM AM_REGION("osrom", 0) - AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( vfxsd_map, AS_PROGRAM, 16, esq5505_state ) - AM_RANGE(0x000000, 0x00ffff) AM_READWRITE(lower_r, lower_w) - AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("otis", es5505_device, read, write) - AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0x00ff) - AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x00ff) - AM_RANGE(0x2c0000, 0x2c0007) AM_DEVREADWRITE8("wd1772", wd1772_t, read, write, 0x00ff) - AM_RANGE(0x330000, 0x3bffff) AM_RAM // sequencer memory? - AM_RANGE(0xc00000, 0xc3ffff) AM_ROM AM_REGION("osrom", 0) - AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( eps_map, AS_PROGRAM, 16, esq5505_state ) - AM_RANGE(0x000000, 0x007fff) AM_READWRITE(lower_r, lower_w) - AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("otis", es5505_device, read, write) - AM_RANGE(0x240000, 0x2400ff) AM_DEVREADWRITE("mc68450", hd63450_device, read, write) - AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0x00ff) - AM_RANGE(0x2c0000, 0x2c0007) AM_DEVREADWRITE8("wd1772", wd1772_t, read, write, 0x00ff) - AM_RANGE(0x580000, 0x7fffff) AM_RAM // sample RAM? - AM_RANGE(0xc00000, 0xc1ffff) AM_ROM AM_REGION("osrom", 0) - AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sq1_map, AS_PROGRAM, 16, esq5505_state ) - AM_RANGE(0x000000, 0x03ffff) AM_READWRITE(lower_r, lower_w) - AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("otis", es5505_device, read, write) - AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x0ff) - AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0x00ff) - AM_RANGE(0x330000, 0x3bffff) AM_RAM // sequencer memory? - AM_RANGE(0xc00000, 0xc3ffff) AM_ROM AM_REGION("osrom", 0) - AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") -ADDRESS_MAP_END - -WRITE_LINE_MEMBER(esq5505_state::esq5505_otis_irq) -{ - otis_irq_state = (state != 0); - update_irq_to_maincpu(); -} - -WRITE16_MEMBER(esq5505_state::analog_w) -{ - offset &= 0x7; - m_analog_values[offset] = data; -} - -READ16_MEMBER(esq5505_state::analog_r) -{ - return m_analog_values[m_duart_io & 7]; -} - -WRITE_LINE_MEMBER(esq5505_state::duart_irq_handler) -{ -// printf("\nDUART IRQ: state %d vector %d\n", state, vector); - if (state == ASSERT_LINE) - { - duart_irq_vector = m_duart->get_irq_vector(); - duart_irq_state = 1; - } - else - { - duart_irq_state = 0; - } - update_irq_to_maincpu(); -} - -WRITE8_MEMBER(esq5505_state::duart_output) -{ - floppy_connector *con = machine().device("wd1772:0"); - floppy_image_device *floppy = con ? con->get_device() : 0; - - m_duart_io = data; - - /* - EPS: - bit 2 = SSEL - - VFX: - bits 0/1/2 = analog sel - bit 6 = ESPHALT - bit 7 = SACK (?) - - VFX-SD & SD-1 (32): - bits 0/1/2 = analog sel - bit 3 = SSEL (disk side) - bit 4 = DSEL (drive select?) - bit 6 = ESPHALT - bit 7 = SACK (?) - */ - - if (data & 0x40) { - if (!m_pump->get_esp_halted()) { - logerror("ESQ5505: Asserting ESPHALT\n"); - m_pump->set_esp_halted(true); - } - } else { - if (m_pump->get_esp_halted()) { - logerror("ESQ5505: Clearing ESPHALT\n"); - m_pump->set_esp_halted(false); - } - } - - if (floppy) - { - if (m_system_type == EPS) - { - floppy->ss_w((data & 2)>>1); - } - else - { - floppy->ss_w(((data & 8)>>3)^1); - } - } - -// printf("DUART output: %02x (PC=%x)\n", data, m_maincpu->pc()); -} - -// MIDI send -WRITE_LINE_MEMBER(esq5505_state::duart_tx_a) -{ - m_mdout->write_txd(state); -} - -WRITE_LINE_MEMBER(esq5505_state::duart_tx_b) -{ - m_panel->rx_w(state); -} - -WRITE8_MEMBER(esq5505_state::dma_end) -{ - if (data != 0) - { - printf("DMAC IRQ, vector = %x\n", m_dmac->get_vector(offset)); - dmac_irq_state = 1; - dmac_irq_vector = m_dmac->get_vector(offset); - } - else - { - dmac_irq_state = 0; - } - - update_irq_to_maincpu(); -} - -WRITE8_MEMBER(esq5505_state::dma_error) -{ - if(data != 0) - { - printf("DMAC error, vector = %x\n", m_dmac->get_error_vector(offset)); - dmac_irq_state = 1; - dmac_irq_vector = m_dmac->get_vector(offset); - } - else - { - dmac_irq_state = 0; - } - - update_irq_to_maincpu(); -} - -READ8_MEMBER(esq5505_state::fdc_read_byte) -{ - return m_fdc->data_r(); -} - -WRITE8_MEMBER(esq5505_state::fdc_write_byte) -{ - m_fdc->data_w(data & 0xff); -} - -#if KEYBOARD_HACK -INPUT_CHANGED_MEMBER(esq5505_state::key_stroke) -{ - int val = (UINT8)(FPTR)param; - - if (val < 0x60) - { - if (oldval == 0 && newval == 1) - { - if (val == 0 && shift > 0) - { - shift -= 32; - printf("New shift %d\n", shift); - } - else if (val == 1 && shift < 32) - { - shift += 32; - printf("New shift %d\n", shift); - } - else if (val == 0x02) - { - printf("Analog tests!\n"); - m_panel->xmit_char(54 | 0x80); m_panel->xmit_char(0); // Preset down - m_panel->xmit_char(8 | 0x80); m_panel->xmit_char(0); // Compare down - m_panel->xmit_char(8); m_panel->xmit_char(0); // Compare up - m_panel->xmit_char(54); m_panel->xmit_char(0); // Preset up - } - } - } - else - { - val += shift; - if (oldval == 0 && newval == 1) - { - printf("key pressed %d\n", val&0x7f); - m_panel->xmit_char(val); - m_panel->xmit_char(0x00); - } - else if (oldval == 1 && newval == 0) - { - // printf("key off %x\n", (UINT8)(FPTR)param); - m_panel->xmit_char(val&0x7f); - m_panel->xmit_char(0x00); - } - } -} -#endif - -static MACHINE_CONFIG_START( vfx, esq5505_state ) - MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(vfx_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(esq5505_state,maincpu_irq_acknowledge_callback) - - MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) - MCFG_DEVICE_DISABLE() - - MCFG_ESQPANEL2x40_ADD("panel") - MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) - MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) - - MCFG_MC68681_ADD("duart", 4000000) - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(esq5505_state, duart_irq_handler)) - MCFG_MC68681_A_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_a)) - MCFG_MC68681_B_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_b)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(esq5505_state, duart_output)) - MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) // route MIDI Tx send directly to 68681 channel A Rx - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD("pump", ESQ_5505_5510_PUMP, XTAL_10MHz / (16 * 21)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_SOUND_ADD("otis", ES5505, XTAL_10MHz) - MCFG_ES5505_REGION0("waverom") /* Bank 0 */ - MCFG_ES5505_REGION1("waverom2") /* Bank 1 */ - MCFG_ES5505_CHANNELS(4) /* channels */ - MCFG_ES5505_IRQ_CB(WRITELINE(esq5505_state, esq5505_otis_irq)) /* irq */ - MCFG_ES5505_READ_PORT_CB(READ16(esq5505_state, analog_r)) /* ADC */ - MCFG_SOUND_ROUTE_EX(0, "pump", 1.0, 0) - MCFG_SOUND_ROUTE_EX(1, "pump", 1.0, 1) - MCFG_SOUND_ROUTE_EX(2, "pump", 1.0, 2) - MCFG_SOUND_ROUTE_EX(3, "pump", 1.0, 3) - MCFG_SOUND_ROUTE_EX(4, "pump", 1.0, 4) - MCFG_SOUND_ROUTE_EX(5, "pump", 1.0, 5) - MCFG_SOUND_ROUTE_EX(6, "pump", 1.0, 6) - MCFG_SOUND_ROUTE_EX(7, "pump", 1.0, 7) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED(eps, vfx) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(eps_map) - - MCFG_ESQPANEL_2x40_REMOVE("panel") - MCFG_ESQPANEL1x22_ADD("panel") - MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) - MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) - - MCFG_WD1772_ADD("wd1772", 8000000) - MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) - - MCFG_DEVICE_ADD("mc68450", HD63450, 0) // MC68450 compatible - MCFG_HD63450_CPU("maincpu") // CPU - 68000 - MCFG_HD63450_CLOCKS(attotime::from_usec(32), attotime::from_nsec(450), attotime::from_usec(4), attotime::from_hz(15625/2)) - MCFG_HD63450_BURST_CLOCKS(attotime::from_usec(32), attotime::from_nsec(450), attotime::from_nsec(50), attotime::from_nsec(50)) - MCFG_HD63450_DMA_END_CB(WRITE8(esq5505_state, dma_end)) - MCFG_HD63450_DMA_ERROR_CB(WRITE8(esq5505_state, dma_error)) - MCFG_HD63450_DMA_READ_0_CB(READ8(esq5505_state, fdc_read_byte)) // ch 0 = fdc, ch 1 = 340001 (ADC?) - MCFG_HD63450_DMA_WRITE_0_CB(WRITE8(esq5505_state, fdc_write_byte)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED(vfxsd, vfx) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(vfxsd_map) - - MCFG_WD1772_ADD("wd1772", 8000000) - MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) -MACHINE_CONFIG_END - -// 32-voice machines with the VFX-SD type config -static MACHINE_CONFIG_START(vfx32, esq5505_state) - MCFG_CPU_ADD("maincpu", M68000, XTAL_30_4761MHz / 2) - MCFG_CPU_PROGRAM_MAP(vfxsd_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(esq5505_state,maincpu_irq_acknowledge_callback) - - MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) - MCFG_DEVICE_DISABLE() - - MCFG_ESQPANEL2x40_ADD("panel") - MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) - MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) - - MCFG_MC68681_ADD("duart", 4000000) - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(esq5505_state, duart_irq_handler)) - MCFG_MC68681_A_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_a)) - MCFG_MC68681_B_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_b)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(esq5505_state, duart_output)) - MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) // route MIDI Tx send directly to 68681 channel A Rx - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD("pump", ESQ_5505_5510_PUMP, XTAL_30_4761MHz / (2 * 16 * 32)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_SOUND_ADD("otis", ES5505, XTAL_30_4761MHz / 2) - MCFG_ES5505_REGION0("waverom") /* Bank 0 */ - MCFG_ES5505_REGION1("waverom2") /* Bank 1 */ - MCFG_ES5505_CHANNELS(4) /* channels */ - MCFG_ES5505_IRQ_CB(WRITELINE(esq5505_state, esq5505_otis_irq)) /* irq */ - MCFG_ES5505_READ_PORT_CB(READ16(esq5505_state, analog_r)) /* ADC */ - MCFG_SOUND_ROUTE_EX(0, "pump", 1.0, 0) - MCFG_SOUND_ROUTE_EX(1, "pump", 1.0, 1) - MCFG_SOUND_ROUTE_EX(2, "pump", 1.0, 2) - MCFG_SOUND_ROUTE_EX(3, "pump", 1.0, 3) - MCFG_SOUND_ROUTE_EX(4, "pump", 1.0, 4) - MCFG_SOUND_ROUTE_EX(5, "pump", 1.0, 5) - MCFG_SOUND_ROUTE_EX(6, "pump", 1.0, 6) - MCFG_SOUND_ROUTE_EX(7, "pump", 1.0, 7) - - MCFG_WD1772_ADD("wd1772", 8000000) - MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED(sq1, vfx) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(sq1_map) - - MCFG_ESQPANEL_2x40_REMOVE("panel") - MCFG_ESQPANEL2x40_SQ1_ADD("panel") - MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) - MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( vfx ) -#if KEYBOARD_HACK - PORT_START("KEY0") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x80) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x81) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x82) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x83) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x84) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x85) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x86) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x87) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x88) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x89) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8a) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8b) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8c) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8d) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8e) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x8f) - - PORT_START("KEY1") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x90) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x91) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x92) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x93) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x94) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x95) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x96) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x97) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x98) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x99) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9a) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9b) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9c) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9d) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9e) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0x9f) - - PORT_START("KEY2") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 0) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 1) - - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 2) -#endif -INPUT_PORTS_END - -#define ROM_LOAD16_BYTE_BIOS(bios,name,offset,length,hash) \ - ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1) | ROM_BIOS(bios+1)) /* Note '+1' */ - -ROM_START( vfx ) - ROM_REGION(0x40000, "osrom", 0) - ROM_LOAD16_BYTE( "vfx210b-low.bin", 0x000000, 0x010000, CRC(c51b19cd) SHA1(2a125b92ffa02ae9d7fb88118d525491d785e87e) ) - ROM_LOAD16_BYTE( "vfx210b-high.bin", 0x000001, 0x010000, CRC(59853be8) SHA1(8e07f69d53f80885d15f624e0b912aeaf3212ee4) ) - - ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) - ROM_LOAD16_BYTE( "u14.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) ) - ROM_LOAD16_BYTE( "u15.bin", 0x100001, 0x080000, CRC(c0055975) SHA1(5a22f1d5e437c6277eb0cfb1ff1b3f8dcdea1cc6) ) - - ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00) - ROM_LOAD( "u16.bin", 0x000000, 0x080000, CRC(c3ddaf95) SHA1(44a7bd89cd7e82952cc5100479e110c385246559) ) -ROM_END - -ROM_START( vfxsd ) - ROM_REGION(0x40000, "osrom", 0) - ROM_LOAD16_BYTE( "vfxsd_200_lower.bin", 0x000000, 0x010000, CRC(7bd31aea) SHA1(812bf73c4861a5d963f128def14a4a98171c93ad) ) - ROM_LOAD16_BYTE( "vfxsd_200_upper.bin", 0x000001, 0x010000, CRC(9a40efa2) SHA1(e38a2a4514519c1573361cb1526139bfcf94e45a) ) - - ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) - ROM_LOAD16_BYTE( "u57.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) ) - ROM_LOAD16_BYTE( "u58.bin", 0x100001, 0x080000, CRC(c0055975) SHA1(5a22f1d5e437c6277eb0cfb1ff1b3f8dcdea1cc6) ) - - ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) - - ROM_REGION(0x80000, "nibbles", 0) - ROM_LOAD( "u60.bin", 0x000000, 0x080000, CRC(c3ddaf95) SHA1(44a7bd89cd7e82952cc5100479e110c385246559) ) -ROM_END - -ROM_START( sd1 ) - ROM_REGION(0x40000, "osrom", 0) - ROM_LOAD16_BYTE( "sd1_21_300b_lower.bin", 0x000000, 0x020000, CRC(a1358a0c) SHA1(64ac5358aa46da37ca4195002cf358554e00878a) ) - ROM_LOAD16_BYTE( "sd1_21_300b_upper.bin", 0x000001, 0x010000, CRC(465ba463) SHA1(899b0e83d0788c8d49c7b09ccf0b4a92b528c6e9) ) - - ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // BS=0 region (12-bit) - ROM_LOAD16_BYTE( "u34.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) ) - ROM_LOAD16_BYTE( "u35.bin", 0x100001, 0x080000, CRC(c0055975) SHA1(5a22f1d5e437c6277eb0cfb1ff1b3f8dcdea1cc6) ) - - ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) // BS=1 region (16-bit) - ROM_LOAD16_WORD_SWAP( "u38.bin", 0x000000, 0x100000, CRC(a904190e) SHA1(e4fd4e1130906086fb4182dcb8b51269969e2836) ) - ROM_LOAD16_WORD_SWAP( "u37.bin", 0x100000, 0x100000, CRC(d706cef3) SHA1(24ba35248509e9ca45110e2402b8085006ea0cfc) ) - - ROM_REGION(0x80000, "nibbles", 0) - ROM_LOAD( "u36.bin", 0x000000, 0x080000, CRC(c3ddaf95) SHA1(44a7bd89cd7e82952cc5100479e110c385246559) ) -ROM_END - -// note: all known 4.xx BIOSes are for the 32-voice SD-1 and play out of tune on 21-voice h/w -ROM_START( sd132 ) - ROM_REGION(0x40000, "osrom", 0) - ROM_SYSTEM_BIOS(0, "410", "SD-1 v4.10") - ROM_LOAD16_BYTE_BIOS(0, "sd1_410_lo.bin", 0x000000, 0x020000, CRC(faa613a6) SHA1(60066765cddfa9d3b5d09057d8f83fb120f4e65e) ) - ROM_LOAD16_BYTE_BIOS(0, "sd1_410_hi.bin", 0x000001, 0x010000, CRC(618c0aa8) SHA1(74acf458aa1d04a0a7a0cd5855c49e6855dbd301) ) - ROM_SYSTEM_BIOS(1, "402", "SD-1 v4.02") - ROM_LOAD16_BYTE_BIOS(1, "sd1_32_402_lo.bin", 0x000000, 0x020000, CRC(5da2572b) SHA1(cb6ddd637ed13bfeb40a99df56000479e63fc8ec) ) - ROM_LOAD16_BYTE_BIOS(1, "sd1_32_402_hi.bin", 0x000001, 0x010000, CRC(fc45c210) SHA1(23b81ebd9176112e6eae0c7c75b39fcb1656c953) ) - - ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // BS=0 region (12-bit) - ROM_LOAD16_BYTE( "u34.bin", 0x000001, 0x080000, CRC(85592299) SHA1(1aa7cf612f91972baeba15991d9686ccde01599c) ) - ROM_LOAD16_BYTE( "u35.bin", 0x100001, 0x080000, CRC(c0055975) SHA1(5a22f1d5e437c6277eb0cfb1ff1b3f8dcdea1cc6) ) - - ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) // BS=1 region (16-bit) - ROM_LOAD16_WORD_SWAP( "u38.bin", 0x000000, 0x100000, CRC(a904190e) SHA1(e4fd4e1130906086fb4182dcb8b51269969e2836) ) - ROM_LOAD16_WORD_SWAP( "u37.bin", 0x100000, 0x100000, CRC(d706cef3) SHA1(24ba35248509e9ca45110e2402b8085006ea0cfc) ) - - ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00) - ROM_LOAD( "u36.bin", 0x000000, 0x080000, CRC(c3ddaf95) SHA1(44a7bd89cd7e82952cc5100479e110c385246559) ) -ROM_END - - -ROM_START( sq1 ) - ROM_REGION(0x40000, "osrom", 0) - ROM_LOAD16_BYTE( "sq1lo.bin", 0x000000, 0x010000, CRC(b004cf05) SHA1(567b0dae2e35b06e39da108f9c041fd9bc38fa35) ) - ROM_LOAD16_BYTE( "sq1up.bin", 0x000001, 0x010000, CRC(2e927873) SHA1(06a948cb71fa254b23f4b9236f29035d10778da1) ) - - ROM_REGION(0x200000, "waverom", 0) - ROM_LOAD16_BYTE( "sq1-u25.bin", 0x000001, 0x080000, CRC(26312451) SHA1(9f947a11592fd8420fc581914bf16e7ade75390c) ) - ROM_LOAD16_BYTE( "sq1-u26.bin", 0x100001, 0x080000, CRC(2edaa9dc) SHA1(72fead505c4f44e5736ff7d545d72dfa37d613e2) ) - - ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00) -ROM_END - -ROM_START( sqrack ) - ROM_REGION(0x40000, "osrom", 0) - ROM_LOAD16_BYTE( "sqr-102-lower.bin", 0x000000, 0x010000, CRC(186c85ad) SHA1(801c5cf82823ce31a88688fbee4c11ea5ffdbc10) ) - ROM_LOAD16_BYTE( "sqr-102-upper.bin", 0x000001, 0x010000, CRC(088c9d31) SHA1(30627f21d893888b6159c481bea08e3eedd21902) ) - - ROM_REGION(0x200000, "waverom", 0) - ROM_LOAD16_BYTE( "sq1-u25.bin", 0x000001, 0x080000, CRC(26312451) SHA1(9f947a11592fd8420fc581914bf16e7ade75390c) ) - ROM_LOAD16_BYTE( "sq1-u26.bin", 0x100001, 0x080000, CRC(2edaa9dc) SHA1(72fead505c4f44e5736ff7d545d72dfa37d613e2) ) - - ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00) -ROM_END - -ROM_START( eps ) - ROM_REGION(0x20000, "osrom", 0) - ROM_LOAD16_BYTE( "eps-l.bin", 0x000000, 0x008000, CRC(382beac1) SHA1(110e31edb03fcf7bbde3e17423b21929e5b32db2) ) - ROM_LOAD16_BYTE( "eps-h.bin", 0x000001, 0x008000, CRC(d8747420) SHA1(460597751386eb5f08465699b61381c4acd78065) ) - - ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // EPS-16 has no ROM sounds - - ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) -ROM_END - -ROM_START( eps16p ) - ROM_REGION(0x20000, "osrom", 0) - ROM_LOAD16_BYTE( "eps16plus-100f-lower.u27", 0x000000, 0x010000, CRC(78568d3f) SHA1(ac737e093f422e109e8f06d44548629a12d6418c) ) - ROM_LOAD16_BYTE( "eps16plus-100f-upper.u28", 0x000001, 0x010000, CRC(1264465f) SHA1(71604da091bd90a32f0d93698d70b9e114ec1697) ) - - ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) // EPS-16 Plus has no ROM sounds - - ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) -ROM_END - -DRIVER_INIT_MEMBER(esq5505_state,common) -{ - m_system_type = GENERIC; - m_duart_io = 0; - - floppy_connector *con = machine().device("wd1772:0"); - floppy_image_device *floppy = con ? con->get_device() : 0; - if (floppy) - { - m_fdc->set_floppy(floppy); - floppy->ss_w(0); - } -} - -DRIVER_INIT_MEMBER(esq5505_state,eps) -{ - DRIVER_INIT_CALL(common); - m_system_type = EPS; -} - -DRIVER_INIT_MEMBER(esq5505_state,sq1) -{ - DRIVER_INIT_CALL(common); - m_system_type = SQ1; -} - -DRIVER_INIT_MEMBER(esq5505_state,denib) -{ - UINT8 *pNibbles = (UINT8 *)memregion("nibbles")->base(); - UINT8 *pBS0L = (UINT8 *)memregion("waverom")->base(); - UINT8 *pBS0H = pBS0L + 0x100000; - - DRIVER_INIT_CALL(common); - - // create the 12 bit samples by patching in the nibbles from the nibble ROM - // low nibbles go with the lower ROM, high nibbles with the upper ROM - for (int i = 0; i < 0x80000; i++) - { - *pBS0L = (*pNibbles & 0x0f) << 4; - *pBS0H = (*pNibbles & 0xf0); - pBS0L += 2; - pBS0H += 2; - pNibbles++; - } -} - -CONS( 1988, eps, 0, 0, eps, vfx, esq5505_state, eps, "Ensoniq", "EPS", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs) -CONS( 1989, vfx, 0, 0, vfx, vfx, esq5505_state, denib, "Ensoniq", "VFX", MACHINE_NOT_WORKING ) // 2x40 VFD -CONS( 1989, vfxsd, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "VFX-SD", MACHINE_NOT_WORKING ) // 2x40 VFD -CONS( 1990, eps16p,eps, 0, eps, vfx, esq5505_state, eps, "Ensoniq", "EPS-16 Plus", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs) -CONS( 1990, sd1, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (21 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD -CONS( 1990, sq1, 0, 0, sq1, vfx, esq5505_state, sq1, "Ensoniq", "SQ-1", MACHINE_NOT_WORKING ) // 2x16 LCD -CONS( 1990, sqrack,sq1, 0, sq1, vfx, esq5505_state, sq1, "Ensoniq", "SQ-Rack", MACHINE_NOT_WORKING ) // 2x16 LCD -CONS( 1991, sd132, sd1,0, vfx32, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (32 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD diff --git a/src/mess/drivers/esqasr.c b/src/mess/drivers/esqasr.c deleted file mode 100644 index 6ae09247b70..00000000000 --- a/src/mess/drivers/esqasr.c +++ /dev/null @@ -1,167 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - esqasr.c - Ensoniq ASR-10 and ASR-X - - Skeleton driver by R. Belmont - - ASR-10 hardware: - CPU: 68302 MCU - Sound: ES5506 - Effects: ES5510 - FDC: NEC uPD72069 - DUART: 2681 - - Memory map: - 0x000000-0x03ffff OS ROM - 0xfb0000-0xfcffff OS RAM - - - ASR-X hardware: - CPU: 68340 MCU - Sound: ES5506 - Effects: ES5511 - FDC: NEC uPD72069 - - http://www.gweep.net/~shifty/music/asrxhack/ - - Memory map: - 0x00000000-0x000fffff OS ROM - 0x00800000-0x008000ff ESP2 5511? - 0x00f00000-0x00f007ff Unknown - 0x08000000-0x08200000 RAM - 0x0be00000-0x0befffff RAM (size unknown) - - These may want to be separated when they run more. - -***************************************************************************/ - -#include "emu.h" -#include "machine/68340.h" -#include "sound/es5506.h" -#include "cpu/es5510/es5510.h" -#include "machine/upd765.h" - -#include "machine/esqvfd.h" - -class esqasr_state : public driver_device -{ -public: - esqasr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_esp(*this, "esp"), - m_sq1vfd(*this, "sq1vfd") - { } - - required_device m_maincpu; - required_device m_esp; - required_device m_sq1vfd; - - virtual void machine_reset(); - - DECLARE_DRIVER_INIT(asr); - DECLARE_WRITE_LINE_MEMBER(esq5506_otto_irq); - DECLARE_READ16_MEMBER(esq5506_read_adc); -}; - -void esqasr_state::machine_reset() -{ -} - -static ADDRESS_MAP_START( asr_map, AS_PROGRAM, 16, esqasr_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0xf00000, 0xffffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( asrx_map, AS_PROGRAM, 32, esqasr_state ) - AM_RANGE(0x00000000, 0x000fffff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x08000000, 0x081fffff) AM_RAM - AM_RANGE(0x0be00000, 0x0befffff) AM_RAM -ADDRESS_MAP_END - -WRITE_LINE_MEMBER(esqasr_state::esq5506_otto_irq) -{ -} - -READ16_MEMBER(esqasr_state::esq5506_read_adc) -{ - return 0; -} - -static MACHINE_CONFIG_START( asr, esqasr_state ) - MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) // actually MC68302 - MCFG_CPU_PROGRAM_MAP(asr_map) - - MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) - MCFG_DEVICE_DISABLE() - - MCFG_ESQ2x40_SQ1_ADD("sq1vfd") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("ensoniq", ES5506, XTAL_16MHz) - MCFG_ES5506_REGION0("waverom") /* Bank 0 */ - MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ - MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ - MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ - MCFG_ES5506_CHANNELS(1) /* channels */ - MCFG_ES5506_IRQ_CB(WRITELINE(esqasr_state, esq5506_otto_irq)) /* irq */ - MCFG_ES5506_READ_PORT_CB(READ16(esqasr_state, esq5506_read_adc)) - MCFG_SOUND_ROUTE(0, "lspeaker", 2.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 2.0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( asrx, esqasr_state ) - MCFG_CPU_ADD("maincpu", M68020, XTAL_16MHz) // unknown, possibly 68340? - MCFG_CPU_PROGRAM_MAP(asrx_map) - - MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) - MCFG_DEVICE_DISABLE() - - MCFG_ESQ2x40_SQ1_ADD("sq1vfd") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("ensoniq", ES5506, XTAL_16MHz) - MCFG_ES5506_REGION0("waverom") /* Bank 0 */ - MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ - MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ - MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ - MCFG_ES5506_CHANNELS(1) /* channels */ - MCFG_ES5506_IRQ_CB(WRITELINE(esqasr_state, esq5506_otto_irq)) /* irq */ - MCFG_ES5506_READ_PORT_CB(READ16(esqasr_state, esq5506_read_adc)) - MCFG_SOUND_ROUTE(0, "lspeaker", 2.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 2.0) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( asr ) -INPUT_PORTS_END - -ROM_START( asr10 ) - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD16_BYTE( "asr-648c-lo-1.5b.bin", 0x000001, 0x020000, CRC(8e437843) SHA1(418f042acbc5323f5b59cbbd71fdc8b2d851f7d0) ) - ROM_LOAD16_BYTE( "asr-65e0-hi-1.5b.bin", 0x000000, 0x020000, CRC(b37cd3b6) SHA1(c4371848428a628b5e5a50e99be602d7abfc7904) ) - - ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) - ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) - ROM_REGION(0x200000, "waverom3", ROMREGION_ERASE00) - ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) -ROM_END - -ROM_START( asrx ) - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD16_BYTE( "asr267lo.bin", 0x000001, 0x080000, CRC(7408d441) SHA1(0113f84b6d224bf1423ad62c173f32a0c95ca715) ) - ROM_LOAD16_BYTE( "asr267hi.bin", 0x000000, 0x080000, CRC(7df14ea7) SHA1(895b99013c0f924edb52612eb93c3e6babb9f053) ) - - ROM_REGION(0x200000, "waverom", ROMREGION_ERASE00) - ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) - ROM_REGION(0x200000, "waverom3", ROMREGION_ERASE00) - ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) -ROM_END - -DRIVER_INIT_MEMBER(esqasr_state, asr) -{ -} - -CONS( 1992, asr10, 0, 0, asr, asr, esqasr_state, asr, "Ensoniq", "ASR-10", MACHINE_NOT_WORKING ) -CONS( 1997, asrx, 0, 0, asrx,asr, esqasr_state, asr, "Ensoniq", "ASR-X", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/esqkt.c b/src/mess/drivers/esqkt.c deleted file mode 100644 index 293844aa880..00000000000 --- a/src/mess/drivers/esqkt.c +++ /dev/null @@ -1,272 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - esqkt.c - Ensoniq KT-76, KT-88, and E-Prime - - Driver by R. Belmont - - Hardware: - CPU: 68EC020-16 CPU - Serial/timers: SCN2681 (MC68681 clone) - Sound: 2xES5506 - Effects: ES5510 - - Memory map: - - 0x000000-0x07FFFF OS ROM - 0x200000-0x20003F Master ES5506 - 0x240000-0x24003F Slave ES5506 - 0x280000-0x2801FF ES5510 - 0x300000-0x30000F 68681 DUART - 0xFF0000-0xFFFFFF OS RAM - - Ensoniq KT-76 - Ensoniq 1994 - - This is a wavetable-based synth keyboard made by Ensoniq in 1994 - - PCB Layout - ---------- - - KT-76 - |---------------------------------------------| - |J12 J3 J11 J10 | - | LM393 LM358| - | 74HC4051| - |ADM691 | - | 62256 | - | | - |3V_BATTERY KT76_0590_LO.U5 ROM0 | - | | - | 68EC020 62256 OTTOR2 ROM1 | - | | - | KT76_690B_HI.U6 ROM2 | - | PAL1 | - | HP_6N138 | - | PAL2 OTTOR2 J6| - | 7407 | - | | - | D41464 D41464 | - | | - | SCN2681 D41464 D41464 | - | 137000402 | - | | - | 18.432MHz | - | ESPR6 16MHz | - | POT | - | R1136-11 | - | | - | LM339 LM339 | - | J13 J5 J1 J2 J4 | - |---------------------------------------------| - Notes: - J1 - connector for digital jacks - J2 - connector for keyboard - J3 - connector for LCD display - J4 - connector for keyboard - J5 - connector for power input - J6 - connector for wave expansion - J10 - connector for wheels/pressure - J11 - connector for memory card - J12 - connector for headphones - J13 - connector for analog jacks - 68EC020 - Motorola MC68EC020FG16 CPU. Clock input 16MHz - 1370000402 - Unknown PLCC44 IC stamped with the Ensoniq logo. Likely CPLD or gate array. - ESPR6 - Ensoniq ESPR6 (ES5510) sound chip - OTTOR2 - Ensoniq OTTOR2 (ES5506) sound chip - POT - ESP adjustment pot - KT76* - 27C2048/27C210 EPROM - ROM* - 2M x8-bit SOP44 mask ROM - R1136-11 - DIP40 IC manufactured by Rockwell - believed to be some type of MCU. - D41464 - NEC D41464 64k x4-bit DRAM - 62256 - 32k x8-bit SRAM - SCN2681 - Philips SCN2681 Dual Universal Asynchronous Receiver/Transmitter (DUART) - HP_6N138 - HP/Agilent HP 6N138 Low Input Current High Gain Optocoupler - PAL1 - MMI PAL20L8ACN stamped 'KT-76 MMU 6A0A'. Printing is faint so 0 could be a B or a D. - PAL2 - MMI PAL20L8ACN stamped 'KT-76 BCU 73D6' - -***************************************************************************/ - -#include "bus/midi/midi.h" -#include "cpu/m68000/m68000.h" -#include "cpu/es5510/es5510.h" -#include "sound/es5506.h" -#include "machine/mc68681.h" -#include "machine/esqpanel.h" - -class esqkt_state : public driver_device -{ -public: - esqkt_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_esp(*this, "esp"), - m_duart(*this, "duart"), - m_sq1panel(*this, "sq1panel"), - m_mdout(*this, "mdout") - { } - - required_device m_maincpu; - required_device m_esp; - required_device m_duart; - required_device m_sq1panel; - required_device m_mdout; - - virtual void machine_reset(); - - DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); - DECLARE_WRITE_LINE_MEMBER(duart_tx_a); - DECLARE_WRITE_LINE_MEMBER(duart_tx_b); - DECLARE_WRITE8_MEMBER(duart_output); - - UINT8 m_duart_io; - bool m_bCalibSecondByte; - -private: - UINT32 *m_rom, *m_ram; - -public: - DECLARE_DRIVER_INIT(kt); - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); - DECLARE_WRITE_LINE_MEMBER(esq5506_otto_irq); - DECLARE_READ16_MEMBER(esq5506_read_adc); -}; - -void esqkt_state::machine_reset() -{ - m_bCalibSecondByte = false; -} - -static ADDRESS_MAP_START( kt_map, AS_PROGRAM, 32, esqkt_state ) - AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_REGION("osrom", 0) - AM_RANGE(0x200000, 0x20003f) AM_DEVREADWRITE8("ensoniq", es5506_device, read, write, 0xffffffff) - AM_RANGE(0x240000, 0x24003f) AM_DEVREADWRITE8("ensoniq2", es5506_device, read, write, 0xffffffff) - AM_RANGE(0x280000, 0x2801ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0xffffffff) - AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0xffffffff) - AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") -ADDRESS_MAP_END - -WRITE_LINE_MEMBER(esqkt_state::esq5506_otto_irq) -{ - #if 0 // 5505/06 IRQ generation needs (more) work - m_maincpu->set_input_line(1, state); - #endif -} - -READ16_MEMBER(esqkt_state::esq5506_read_adc) -{ - switch ((m_duart_io & 7) ^ 7) - { - case 0: // vRef to check battery - return 0x5b00; - - case 2: // battery voltage - return 0x7f00; - - default: // pedal - return 0; - } - - if (m_duart_io & 1) - { - return 0x5b00; // vRef - } - else - { - return 0x7f00; // vBattery - } -} - -WRITE_LINE_MEMBER(esqkt_state::duart_irq_handler) -{ - m_maincpu->set_input_line(M68K_IRQ_3, state); -} - -WRITE8_MEMBER(esqkt_state::duart_output) -{ - m_duart_io = data; - -// printf("DUART output: %02x (PC=%x)\n", data, m_maincpu->pc()); -} - -WRITE_LINE_MEMBER(esqkt_state::duart_tx_a) -{ - m_mdout->write_txd(state); -} - -WRITE_LINE_MEMBER(esqkt_state::duart_tx_b) -{ - m_sq1panel->rx_w(state); -} - -static MACHINE_CONFIG_START( kt, esqkt_state ) - MCFG_CPU_ADD("maincpu", M68EC020, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(kt_map) - - MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) - MCFG_DEVICE_DISABLE() - - MCFG_ESQPANEL2x40_SQ1_ADD("sq1panel") - MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) - - MCFG_MC68681_ADD("duart", 4000000) - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(esqkt_state, duart_irq_handler)) - MCFG_MC68681_A_TX_CALLBACK(WRITELINE(esqkt_state, duart_tx_a)) - MCFG_MC68681_B_TX_CALLBACK(WRITELINE(esqkt_state, duart_tx_b)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(esqkt_state, duart_output)) - MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) - MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) // route MIDI Tx send directly to 68681 channel A Rx - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("ensoniq", ES5506, XTAL_16MHz) - MCFG_ES5506_REGION0("waverom") /* Bank 0 */ - MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ - MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ - MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ - MCFG_ES5506_CHANNELS(1) /* channels */ - MCFG_ES5506_IRQ_CB(WRITELINE(esqkt_state, esq5506_otto_irq)) /* irq */ - MCFG_ES5506_READ_PORT_CB(READ16(esqkt_state, esq5506_read_adc)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) - MCFG_SOUND_ADD("ensoniq2", ES5506, XTAL_16MHz) - MCFG_ES5506_REGION0("waverom") /* Bank 0 */ - MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ - MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ - MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ - MCFG_ES5506_CHANNELS(1) /* channels */ - MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( kt ) -INPUT_PORTS_END - -ROM_START( kt76 ) - ROM_REGION(0x80000, "osrom", 0) - ROM_LOAD32_WORD( "kt76_162_lo.bin", 0x000000, 0x020000, CRC(1a1ab910) SHA1(dcc80db2297fd25993e090c2e5bb7f947319a8bf) ) - ROM_LOAD32_WORD( "kt76_162_hi.bin", 0x000002, 0x040000, CRC(de16d236) SHA1(c55fca86453e90e8c34a048bed45817063237370) ) - - ROM_REGION(0x400000, "waverom", ROMREGION_ERASE00) - ROM_LOAD16_BYTE( "1351000401_rom0.u103", 0x000001, 0x200000, CRC(425047af) SHA1(9680d1fc222b29ba24f0fbf6136982bee87a60ef) ) - - ROM_REGION(0x400000, "waverom2", ROMREGION_ERASE00) - ROM_LOAD16_BYTE( "1351000402_rom1.u102", 0x000001, 0x200000, CRC(64459185) SHA1(0fa20b16847fc02a384057fc3d385226eb3e7527) ) - - ROM_REGION(0x400000, "waverom3", ROMREGION_ERASE00) - ROM_LOAD16_BYTE( "1351000403_rom2.u104", 0x000001, 0x200000, CRC(c2aacc5d) SHA1(7fab518ba92ddb23cdc4dcb04751b26d25c298c0) ) - - ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) -ROM_END - -DRIVER_INIT_MEMBER(esqkt_state, kt) -{ - m_duart_io = 0; -} - -CONS( 1996, kt76, 0, 0, kt, kt, esqkt_state, kt, "Ensoniq", "KT-76", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mess/drivers/esqmr.c b/src/mess/drivers/esqmr.c deleted file mode 100644 index 058bd186251..00000000000 --- a/src/mess/drivers/esqmr.c +++ /dev/null @@ -1,319 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - esqmr.c - Ensoniq MR-61, MR-76, and MR-Rack - - Skeleton driver by R. Belmont - - Hardware: - CPU: 68340 MCU - Sound: 2xES5506 - Effects: ES5511 - - Memory map: - - 0x000000-0x0FFFFF OS ROM - - MR Rack - Ensoniq, 1995 - - This is a 64-voice expandable synth module made by Ensoniq in 1995. - It is shipped with 12MB of 16-bit 44.1kHz wave data and can be expanded - with up to 3 ENSONIQ EXP Series Wave Expansion Boards containing up to a - maximum of 84MB of additional wave data. - - - PCB Layout - ---------- - - PN: 4001028501 REV C - |--------------------------------------------------------| - | J6 J7 J12 J13 J21 J23 J22| - | J5| - | 4565 4565 HP_6N138 | - | | - | BATTERY 7407 | - | 4565 | - | | - | OTTOR2 OTTOR2 | - |AD1861 | - |AD1861 | - |AD1861 | - |AD1861 |--J3-----| | - | HC04 |EXPANSION| | - | |BOARD #3 | | - | | | | - | 1370001501 | | | - | | | | - | |--J8-----| | - | ESP2 ROM2 | - | |--J2-----| | - | |EXPANSION| | - | ROM0 |BOARD #2 | | - | | | | - | D43256 IDT7130 | | | - | D43256 35MHz 16MHz ROM1 | | | - | D43256 J14 |--J9-----| | - | D43256 22.5792MHz ADM691| - | D43256 MC68340 |--J1-----| | - | D43256 |EXPANSION| | - | 6MHz |BOARD #1 | | - | EPROM_UP | | | - | MC68HC705C4A KM681000 | | - |J4 EPROM_LO KM681000 |J11| - | J19 J18 |--J10----| | - |--------------------------------------------------------| - Notes: - J4/J18/J19 - Connectors to front panel buttons, LCD etc - J1/J10 - Connectors for expansion board #1 - J2/J9 - Connectors for expansion board #2 - J3/J8 - Connectors for expansion board #3 - J11 - Memory card connector - J14 - JTAG connector - J6 - Main left/mono jack - J7 - Main right jack - J12 - Aux left/mono jack - J13 - Aux right jack - J21 - MIDI in connector - J23 - MIDI out connector - J22 - MIDI thru connector - J5 - Power input connector - 1370001501 - Unknown TQFP144 IC stamped with the Ensoniq logo. Possibly CPLD? - ESP2 - Ensoniq ESP2 sound chip - OTTOR2 - Ensoniq OTTOR2 sound chip - ROM* - 4M x8-bit SOP44 mask ROM - D43256 - NEC D43256 32k x8-bit Static RAM - HP_6N138 - HP/Agilent HP 6N138 Low Input Current High Gain Optocoupler - 4565 - JRC4565 Dual Operational Amplifier - AD1861 - Analog Devices AD1861 16-bit/18-bit PCM Audio DAC - MC68HC705C4A - Motorola MC68HC705C4A Microcontroller. Clock input is tied to the TQFP CPLD - MC68340 - Motorola MC68340PV16E 68000-compatible 32-bit processor with on-board peripherals. Clock input 6.000MHz - EPROM* - 27C4001 EPROM - IDT7130 - IDT7130 High Speed 1k x8-bit Dual Port Static RAM - KM681000 - Samsung KM681000 128k x8-bit Static RAM - ADM691 - Analog Devices ADM691 Microprocessor Supervisory Circuit with Automatic Battery Backup Switching - - - Additional notes from the manual: - --------------------------------- - - The MR-Rack can play special demonstration songs to give you an idea of how terrific it sounds. - - To Play the MR-Rack Main Demo - 1. Press the Audition button, and hold it down. - 2. While still holding Audition, press the Save button. - 3. Let go of both buttons. - - In an unexpanded MR-Rack, the display shows: - - Hit ENTER to Play: - MAINDEMO:MR Internal - - If you've installed any Expansion boards or a ROM card containing MAINDEMO-type - demonstration songs, your display will differ. Turn the Value knob counter-clockwise - until the display looks as it does above. - - Note: When MR-Rack demos are being viewed or playing, MIDI In is disabled. - - 4. Press Enter to play the demo. - 5. Press Enter again to stop the demo. - 6. When you're done listening to the demo song, press Exit to return to normal MR-Rack - - - The Version Number of Your MR-Rack Operating System: - You can easily find out what operating system (or O.S.) your MR-Rack is currently using. - To Find the Operating System: - 1. Press the Save button and hold it down. - 2. While still holding the Save button, press the System button. - The display briefly shows your current Operating System: - - ENSONIQ MR-RACK - O.S. Version: #.## - - - - ENSONIQ EXP Series Wave Expansion Boards - ---------------------------------------- - - These are small plug-in boards containing a 256k x8-bit EPROM (27C020) and from 1 to 6 - SOP44 mask ROMs. These add additional digital sound waves. These can be used with the MR - Rack, the full-size MR Keyboards and a few other models. - - PCB Layout - ---------- - - PN: 4001033401 REV B - |------------------| - | | - | U6 U7 | - |- | - || | - || U1 | - || U2 -| - || || - || || - || U3 || - || || - || U8 || - || U4 || - || || - || || - || U5 || - |- -| - |------------------| - Notes: - U1 - AC138 logic chip - U2 to U7 - 4M x 8-bit or 2M x 8-bit SOP44 mask ROM - U8 - 27C020 EPROM - - The EXP boards dumped so far are.... - - MROM # of - Name Version Size MROMs - ----------------------------------- - Piano V1.00 4M 4 (multisampled pianos, aka "The Perfect Piano") - The Real World V1.01 4M 6 (non-Western percusson and other "world music" sounds) - Drum V1.00 2M 1 (additional drum kits that are built in to the MR keyboards) - - - Additional notes from the manual: - --------------------------------- - - The MR-Rack provides three displays which can identify any EXP Wave Expansion boards - you have installed. - - To Identify an Installed Expansion Board - 1. Press the System button. - 2. Turn the Parameter knob until the display shows: - - System parameters: - WaveEXP1:xxxxxxxxxxx - - When an Expansion Board is installed, this read-only display will show the name of the - Expansion Board located in the first slot. - - 3. Turning the Parameter knob two more times will reveal two more displays which show - the names of the Expansion Boards in Wave EXP Slots 2 and 3 (if they're installed). - If there are no Expansion Boards installed, the display will show "WaveEXP1= **EMPTY**." - -***************************************************************************/ - -#include "emu.h" -#include "machine/68340.h" -#include "sound/es5506.h" - -#include "machine/esqvfd.h" - -class esqmr_state : public driver_device -{ -public: - esqmr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_sq1vfd(*this, "sq1vfd") - { } - - required_device m_maincpu; - required_device m_sq1vfd; - - virtual void machine_reset(); - -public: - DECLARE_DRIVER_INIT(mr); - DECLARE_WRITE_LINE_MEMBER(esq5506_otto_irq); - DECLARE_READ16_MEMBER(esq5506_read_adc); -}; - -void esqmr_state::machine_reset() -{ -} - -static ADDRESS_MAP_START( mr_map, AS_PROGRAM, 32, esqmr_state ) - AM_RANGE(0x00000000, 0x000fffff) AM_ROM AM_REGION("maincpu", 0) -// AM_RANGE(0x200000, 0x20003f) AM_DEVREADWRITE8("ensoniq", es5506_device, read, write, 0xffffffff) -// AM_RANGE(0x240000, 0x24003f) AM_DEVREADWRITE8("ensoniq2", es5506_device, read, write, 0xffffffff) -// AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("osram") -ADDRESS_MAP_END - -WRITE_LINE_MEMBER(esqmr_state::esq5506_otto_irq) -{ -} - -READ16_MEMBER(esqmr_state::esq5506_read_adc) -{ - return 0; -} - -static MACHINE_CONFIG_START( mr, esqmr_state ) - MCFG_CPU_ADD("maincpu", M68340, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(mr_map) - - MCFG_ESQ2x40_SQ1_ADD("sq1vfd") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("ensoniq", ES5506, XTAL_16MHz) - MCFG_ES5506_REGION0("waverom") /* Bank 0 */ - MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ - MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ - MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ - MCFG_ES5506_CHANNELS(1) /* channels */ - MCFG_ES5506_IRQ_CB(WRITELINE(esqmr_state, esq5506_otto_irq)) /* irq */ - MCFG_ES5506_READ_PORT_CB(READ16(esqmr_state, esq5506_read_adc)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) - MCFG_SOUND_ADD("ensoniq2", ES5506, XTAL_16MHz) - MCFG_ES5506_REGION0("waverom") /* Bank 0 */ - MCFG_ES5506_REGION1("waverom2") /* Bank 1 */ - MCFG_ES5506_REGION2("waverom3") /* Bank 0 */ - MCFG_ES5506_REGION3("waverom4") /* Bank 1 */ - MCFG_ES5506_CHANNELS(1) /* channels */ - MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.5) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( mr ) -INPUT_PORTS_END - -ROM_START( mr61 ) - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD16_WORD_SWAP( "mrw-osf-11af-2.10.bin", 0x000000, 0x080000, CRC(5854314e) SHA1(8fb2e2ee2f5fb12eae8ea33cb18f757efaec6780) ) - ROM_LOAD16_WORD_SWAP( "mrw-romc-32ef-1.20.bin", 0x080000, 0x080000, CRC(68321347) SHA1(56cb96943ba42c35ba2787a49b5f4adf7c8dffb8) ) - - ROM_REGION(0x400000, "waverom", ROMREGION_ERASE00) - - ROM_REGION(0x400000, "waverom2", ROMREGION_ERASE00) - - ROM_REGION(0x400000, "waverom3", ROMREGION_ERASE00) - - ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) -ROM_END - -ROM_START( mrrack ) - // 68340 main MCU - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD16_BYTE( "mr_r_ec51_lo_1.50.u36", 0x000001, 0x080000, CRC(b29988a1) SHA1(986c2def11de27fa2b9be55ac32f7fec0c414bca) ) - ROM_LOAD16_BYTE( "mr_r_9dac_up_1.50.u35", 0x000000, 0x080000, CRC(71511692) SHA1(54744f16f1db1ac5abb2f70b6e04aebf1e0e029d) ) - - // 68705 display/front panel MCU - ROM_REGION(0x2000, "mcu", 0) - ROM_LOAD( "68hc705.u40", 0x000000, 0x002000, CRC(7b0291a7) SHA1(c92c19ce9289b7b21dbc915475cdff8930e3c677) ) - - ROM_REGION(0x400000, "waverom", ROMREGION_ERASE00) - ROM_LOAD( "1351000901_h-rom0.u5", 0x000000, 0x400000, CRC(89654b42) SHA1(4bdffd8060eb20cdb01f6178222aeb32fdbfd703) ) - - ROM_REGION(0x400000, "waverom2", ROMREGION_ERASE00) - ROM_LOAD( "1351000902_h-rom1.u23", 0x000000, 0x400000, CRC(4a19e517) SHA1(e819f1e0b50c4911c4855ad95ed505998a2bbe86) ) - - ROM_REGION(0x400000, "waverom3", ROMREGION_ERASE00) - ROM_LOAD( "1351000903_h-rom2.u24", 0x000000, 0x400000, CRC(c9ab1214) SHA1(92f48b068bbe49eacbffd03e428599e3ab21b8ec) ) - - ROM_REGION(0x200000, "waverom4", ROMREGION_ERASE00) -ROM_END - -DRIVER_INIT_MEMBER(esqmr_state, mr) -{ -} - -CONS( 1996, mr61, 0, 0, mr, mr, esqmr_state, mr, "Ensoniq", "MR-61 Workstation", MACHINE_NOT_WORKING ) -CONS( 1996, mrrack, 0, 0, mr, mr, esqmr_state, mr, "Ensoniq", "MR-Rack", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/et3400.c b/src/mess/drivers/et3400.c deleted file mode 100644 index bf9806787c0..00000000000 --- a/src/mess/drivers/et3400.c +++ /dev/null @@ -1,123 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - ET-3400 - - 12/05/2009 Skeleton driver. - - - TODO: - - Proper artwork - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "et3400.lh" - - -class et3400_state : public driver_device -{ -public: - et3400_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - required_device m_maincpu; - DECLARE_READ8_MEMBER( et3400_keypad_r ); - DECLARE_WRITE8_MEMBER( et3400_display_w ); -}; - - - -READ8_MEMBER( et3400_state::et3400_keypad_r ) -{ - UINT8 data = 0xff; - - if (~offset & 4) - data &= ioport("X2")->read(); - if (~offset & 2) - data &= ioport("X1")->read(); - if (~offset & 1) - data &= ioport("X0")->read(); - - return data; -} - -WRITE8_MEMBER( et3400_state::et3400_display_w ) -{ -/* This computer sets each segment, one at a time. */ - - static const UINT8 segments[8]={0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x80}; - UINT8 digit = (offset >> 4) & 7; - UINT8 segment = segments[offset & 7]; - UINT8 segdata = output_get_digit_value(digit); - - if (data & 1) - segdata |= segment; - else - segdata &= ~segment; - - output_set_digit_value(digit, segdata); -} - - -static ADDRESS_MAP_START(et3400_mem, AS_PROGRAM, 8, et3400_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x01ff ) AM_RAM - AM_RANGE( 0xc000, 0xc0ff ) AM_READ(et3400_keypad_r) - AM_RANGE( 0xc100, 0xc1ff ) AM_WRITE(et3400_display_w) - AM_RANGE( 0xfc00, 0xffff ) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( et3400 ) - PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D DO") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A AUTO") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 RTI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 INDEX") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 ACCA") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0xc0, 0xc0, IPT_UNUSED ) - - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E EXAM") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B BACK") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 SS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 CC") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 ACCB") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT( 0xc0, 0xc0, IPT_UNUSED ) - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F FWD") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C CHAN") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 BR") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 SP") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 PC") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0xe0, 0xe0, IPT_UNUSED ) -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( et3400, et3400_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6800, XTAL_4MHz / 8 ) - MCFG_CPU_PROGRAM_MAP(et3400_mem) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_et3400) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( et3400 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "et3400.bin", 0xfc00, 0x0400, CRC(2eff1f58) SHA1(38b655de7393d7a92b08276f7c14a99eaa2a4a9f)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1976, et3400, 0, 0, et3400, et3400, driver_device, 0, "Heath Inc", "Heathkit ET-3400", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/eti660.c b/src/mess/drivers/eti660.c deleted file mode 100644 index 80b490eff0f..00000000000 --- a/src/mess/drivers/eti660.c +++ /dev/null @@ -1,244 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - TODO: - - - does not boot! - - reset key - - allocate color ram - - quickload - - color on - - - keyboard not working - - foreground is black, according to the construction article it should be white. - - it is supposed to reset itself at boot, but that isn't working. You must press R. - - Pressing F3 causes it to jump into the weeds. - -*/ - -#include "includes/eti660.h" - -/* Read/Write Handlers */ - -READ8_MEMBER( eti660_state::pia_r ) -{ - int pia_offset = m_maincpu->get_memory_address() & 0x03; - - return m_pia->read(space, pia_offset); -} - -WRITE8_MEMBER( eti660_state::pia_w ) -{ - int pia_offset = m_maincpu->get_memory_address() & 0x03; - - m_pia->write(space, pia_offset, data); -} - -WRITE8_MEMBER( eti660_state::colorram_w ) -{ - int colorram_offset = m_maincpu->get_memory_address() & 0xff; - - colorram_offset = ((colorram_offset & 0xf8) >> 1) || (colorram_offset & 0x03); - - m_color_ram[colorram_offset] = data; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( eti660_map, AS_PROGRAM, 8, eti660_state ) - ADDRESS_MAP_GLOBAL_MASK(0xfff) - AM_RANGE(0x0000, 0x03ff) AM_ROM - AM_RANGE(0x0400, 0x0fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( eti660_io_map, AS_IO, 8, eti660_state ) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispon_r, step_bgcolor_w) - AM_RANGE(0x02, 0x02) AM_READWRITE(pia_r, pia_w) - AM_RANGE(0x03, 0x03) AM_WRITE(colorram_w) - AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispoff_r, tone_latch_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( eti660 ) - PORT_START("PA0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("PA1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - - PORT_START("PA2") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - - PORT_START("PA3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_R) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("STEP") PORT_CODE(KEYCODE_S) -INPUT_PORTS_END - -/* Video */ - -READ_LINE_MEMBER( eti660_state::rdata_r ) -{ - return BIT(m_color, 0); -} - -READ_LINE_MEMBER( eti660_state::bdata_r ) -{ - return BIT(m_color, 1); -} - -READ_LINE_MEMBER( eti660_state::gdata_r ) -{ - return BIT(m_color, 2); -} - -/* CDP1802 Interface */ - -READ_LINE_MEMBER( eti660_state::clear_r ) -{ - return BIT(m_special->read(), 0); -} - -READ_LINE_MEMBER( eti660_state::ef2_r ) -{ - return m_cassette->input() < 0; -} - -READ_LINE_MEMBER( eti660_state::ef4_r ) -{ - return BIT(m_special->read(), 1); -} - -WRITE_LINE_MEMBER( eti660_state::q_w ) -{ - /* CDP1864 audio output enable */ - m_cti->aoe_w(state); - - /* PULSE led */ - set_led_status(machine(), LED_PULSE, state); - - /* tape output */ - m_cassette->output(state ? 1.0 : -1.0); -} - -WRITE8_MEMBER( eti660_state::dma_w ) -{ - UINT8 colorram_offset = ((offset & 0xf8) >> 1) | (offset & 0x03); - - m_color = m_color_ram[colorram_offset]; - - m_cti->con_w(0); // HACK - m_cti->dma_w(space, offset, data); -} - -/* PIA6821 Interface */ - -READ8_MEMBER( eti660_state::pia_pa_r ) -{ - /* - - bit description - - PA0 keyboard row 0 - PA1 keyboard row 1 - PA2 keyboard row 2 - PA3 keyboard row 3 - PA4 keyboard column 0 - PA5 keyboard column 1 - PA6 keyboard column 2 - PA7 keyboard column 3 - - */ - - UINT8 data = 0xf0; - - if (!BIT(m_keylatch, 0)) data &= m_pa0->read(); - if (!BIT(m_keylatch, 1)) data &= m_pa1->read(); - if (!BIT(m_keylatch, 2)) data &= m_pa2->read(); - if (!BIT(m_keylatch, 3)) data &= m_pa3->read(); - - return data | m_keylatch; -} - -WRITE8_MEMBER( eti660_state::pia_pa_w ) -{ - /* - - bit description - - PA0 keyboard row 0 - PA1 keyboard row 1 - PA2 keyboard row 2 - PA3 keyboard row 3 - PA4 keyboard column 0 - PA5 keyboard column 1 - PA6 keyboard column 2 - PA7 keyboard column 3 - - */ - - m_keylatch = data & 0x0f; -} - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( eti660, eti660_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_8_867238MHz/5) - MCFG_CPU_PROGRAM_MAP(eti660_map) - MCFG_CPU_IO_MAP(eti660_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(eti660_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(eti660_state, ef2_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(eti660_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(eti660_state, q_w)) - MCFG_COSMAC_DMAW_CALLBACK(WRITE8(eti660_state, dma_w)) - - /* video hardware */ - MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_8_867238MHz/5) - MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_8_867238MHz/5, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(eti660_state, rdata_r), READLINE(eti660_state, bdata_r), READLINE(eti660_state, gdata_r)) - MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(4.7), RES_K(4.7)) // R7, R5, R6, R4 - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(MC6821_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(eti660_state, pia_pa_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(eti660_state, pia_pa_w)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("3K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( eti660 ) - ROM_REGION( 0x10000, CDP1802_TAG, 0 ) - ROM_LOAD( "eti660.bin", 0x0000, 0x0400, CRC(811dfa62) SHA1(c0c4951e02f873f15560bdc3f35cdf3f99653922) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, eti660, 0, 0, eti660, eti660, driver_device, 0, "Electronics Today International", "ETI-660", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/europc.c b/src/mess/drivers/europc.c deleted file mode 100644 index a034b1213b1..00000000000 --- a/src/mess/drivers/europc.c +++ /dev/null @@ -1,508 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#include "emu.h" -#include "coreutil.h" -#include "includes/genpc.h" -#include "machine/nvram.h" -#include "machine/pckeybrd.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" - -class europc_pc_state : public driver_device -{ -public: - europc_pc_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_mb(*this, "mb"), - m_keyboard(*this, "pc_keyboard"), - m_jim_state(0), - m_port61(0) - { } - - required_device m_maincpu; - required_device m_mb; - required_device m_keyboard; - isa8_aga_device *m_aga; - - DECLARE_WRITE8_MEMBER( europc_pio_w ); - DECLARE_READ8_MEMBER( europc_pio_r ); - - DECLARE_WRITE8_MEMBER ( europc_jim_w ); - DECLARE_READ8_MEMBER ( europc_jim_r ); - DECLARE_READ8_MEMBER ( europc_jim2_r ); - - DECLARE_READ8_MEMBER( europc_rtc_r ); - DECLARE_WRITE8_MEMBER( europc_rtc_w ); - - DECLARE_DRIVER_INIT(europc); - - void europc_rtc_set_time(); - - UINT8 m_jim_data[16]; - UINT8 m_jim_state; - AGA_MODE m_jim_mode; - int m_port61; // bit 0,1 must be 0 for startup; reset? - UINT8 m_rtc_data[0x10]; - int m_rtc_reg; - int m_rtc_state; - - void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - emu_timer* m_rtc_timer; - - enum - { - TIMER_RTC - }; -}; - -/* - europc - fe107 bios checksum test - memory test - fe145 - irq vector init - fe156 - fe169 fd774 // test of special europc registers 254 354 - fe16c fe817 - fe16f - fec08 // test of special europc registers 800a rtc time or date error, rtc corrected - fef66 0xf - fdb3e 0x8..0xc - fd7f8 - fdb5f - fe172 - fecc5 // 801a video setup error - fd6c9 - copyright output - fe1b7 - fe1be di bits set mean output text!!!, - (801a) - 0x8000 output - 1 rtc error - 2 rtc time or date error - 4 checksum error in setup - 8 rtc status corrected - 10 video setup error - 20 video ram bad - 40 monitor type not recogniced - 80 mouse port enabled - 100 joystick port enabled - - fe1e2 fdc0c cpu speed is 4.77 MHz - fe1e5 ff9c0 keyboard processor error - fe1eb fc617 external lpt1 at 0x3bc - fe1ee fe8ee external coms at - - routines: - fc92d output text at bp - fdb3e rtc read reg cl - fe8ee piep - fe95e rtc write reg cl - polls until jim 0xa is zero, - output cl at jim 0xa - write ah hinibble as lownibble into jim 0xa - write ah lownibble into jim 0xa - fef66 rtc read reg cl - polls until jim 0xa is zero, - output cl at jim 0xa - read low 4 nibble at jim 0xa - read low 4 nibble at jim 0xa - return first nibble<<4|second nibble in ah - ff046 seldom compares ret - ffe87 0 -> ds - - 469: - bit 0: b0000 memory available - bit 1: b8000 memory available - 46a: 00 jim 250 01 jim 350 - */ - - -/* - 250..253 write only 00 be 00 10 - - 252 write 0 b0000 memory activ - 252 write 0x10 b8000 memory activ - - jim 04: 0:4.77 0x40:7.16 - pio 63: 11,19 4.77 51,59 7.16 - - 63 bit 6,7 clock select - 254 bit 6,7 clock select - 250 bit 0: mouse on - bit 1: joystick on - 254..257 r/w memory ? JIM asic? ram behaviour - -*/ - -WRITE8_MEMBER( europc_pc_state::europc_jim_w ) -{ - switch (offset) - { - case 2: - if (!(data & 0x80)) - { - switch (data) - { - case 0x1f: - case 0x0b: m_jim_mode = AGA_MONO; break; - case 0xe: //80 columns? - case 0xd: //40 columns? - case 0x18: - case 0x1a: m_jim_mode = AGA_COLOR; break; - default: m_jim_mode = AGA_OFF; break; - } - } -// mode= data&0x10?AGA_COLOR:AGA_MONO; -// mode= data&0x10?AGA_COLOR:AGA_OFF; - if (data & 0x80) m_jim_state = 0; - break; - case 4: - switch(data & 0xc0) - { - case 0x00: m_maincpu->set_clock_scale(1.0 / 2); break; - case 0x40: m_maincpu->set_clock_scale(3.0 / 4); break; - default: m_maincpu->set_clock_scale(1); break; - } - break; - case 0xa: - europc_rtc_w(space, 0, data); - return; - } - logerror("jim write %.2x %.2x\n", offset, data); - m_jim_data[offset] = data; -} - -READ8_MEMBER( europc_pc_state::europc_jim_r ) -{ - int data = 0; - switch(offset) - { - case 4: case 5: case 6: case 7: data = m_jim_data[offset]; break; - case 0: case 1: case 2: case 3: data = 0; break; - case 0xa: return europc_rtc_r(space, 0); - } - return data; -} - -READ8_MEMBER( europc_pc_state::europc_jim2_r ) -{ - switch (m_jim_state) - { - case 0: m_jim_state++; return 0; - case 1: m_jim_state++; return 0x80; - case 2: - m_jim_state = 0; - switch (m_jim_mode) - { - case AGA_COLOR: return 0x87; // for color; - case AGA_MONO: return 0x90; //for mono - case AGA_OFF: return 0x80; // for vram -// return 0x97; //for error - } - } - return 0; -} - -/* realtime clock and nvram EM M3002 - - reg 0: seconds - reg 1: minutes - reg 2: hours - reg 3: day 1 based - reg 4: month 1 based - reg 5: year bcd (no century, values bigger 88? are handled as 1900, else 2000) - reg 6: - reg 7: - reg 8: - reg 9: - reg a: - reg b: 0x10 written - bit 0,1: 0 video startup mode: 0=specialadapter, 1=color40, 2=color80, 3=monochrom - bit 2: internal video on - bit 4: color - bit 6,7: clock - reg c: - bit 0,1: language/country - reg d: xor checksum - reg e: - reg 0f: 01 status ok, when not 01 written -*/ - -void europc_pc_state::europc_rtc_set_time() -{ - system_time systime; - - /* get the current date/time from the core */ - machine().current_datetime(systime); - - m_rtc_data[0] = dec_2_bcd(systime.utc_time.second); - m_rtc_data[1] = dec_2_bcd(systime.utc_time.minute); - m_rtc_data[2] = dec_2_bcd(systime.utc_time.hour); - - m_rtc_data[3] = dec_2_bcd(systime.utc_time.mday); - m_rtc_data[4] = dec_2_bcd(systime.utc_time.month + 1); - m_rtc_data[5] = dec_2_bcd(systime.utc_time.year % 100); -} - -void europc_pc_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - int month, year; - - switch(id) - { - case TIMER_RTC: - m_rtc_data[0]=bcd_adjust(m_rtc_data[0]+1); - if (m_rtc_data[0]>=0x60) - { - m_rtc_data[0]=0; - m_rtc_data[1]=bcd_adjust(m_rtc_data[1]+1); - if (m_rtc_data[1]>=0x60) - { - m_rtc_data[1]=0; - m_rtc_data[2]=bcd_adjust(m_rtc_data[2]+1); - if (m_rtc_data[2]>=0x24) - { - m_rtc_data[2]=0; - m_rtc_data[3]=bcd_adjust(m_rtc_data[3]+1); - month=bcd_2_dec(m_rtc_data[4]); - year=bcd_2_dec(m_rtc_data[5])+2000; // save for julian_days_in_month_calculation - if (m_rtc_data[3]> gregorian_days_in_month(month, year)) - { - m_rtc_data[3]=1; - m_rtc_data[4]=bcd_adjust(m_rtc_data[4]+1); - if (m_rtc_data[4]>0x12) - { - m_rtc_data[4]=1; - m_rtc_data[5]=bcd_adjust(m_rtc_data[5]+1)&0xff; - } - } - } - } - } - break; - } -} - -READ8_MEMBER( europc_pc_state::europc_rtc_r ) -{ - int data=0; - switch (m_rtc_state) - { - case 1: - data=(m_rtc_data[m_rtc_reg]&0xf0)>>4; - m_rtc_state++; - break; - case 2: - data=m_rtc_data[m_rtc_reg]&0xf; - m_rtc_state=0; -// logerror("rtc read %x %.2x\n",m_rtc_reg, m_rtc_data[m_rtc_reg]); - break; - } - return data; -} - -WRITE8_MEMBER( europc_pc_state::europc_rtc_w ) -{ - switch (m_rtc_state) - { - case 0: - m_rtc_reg=data; - m_rtc_state=1; - break; - case 1: - m_rtc_data[m_rtc_reg]=(m_rtc_data[m_rtc_reg]&~0xf0)|((data&0xf)<<4); - m_rtc_state++; - break; - case 2: - m_rtc_data[m_rtc_reg]=(m_rtc_data[m_rtc_reg]&~0xf)|(data&0xf); - m_rtc_state=0; -// logerror("rtc written %x %.2x\n",m_rtc_reg, m_rtc_data[m_rtc_reg]); - break; - } -} - -DRIVER_INIT_MEMBER(europc_pc_state,europc) -{ - UINT8 *rom = &memregion("maincpu")->base()[0]; - - int i; - /* - fix century rom bios bug ! - if year <79 month (and not CENTURY) is loaded with 0x20 - */ - if (rom[0xff93e]==0xb6){ // mov dh, - UINT8 a; - rom[0xff93e]=0xb5; // mov ch, - for (i=0xf8000, a=0; i<0xfffff; i++ ) a+=rom[i]; - rom[0xfffff]=256-a; - } - - memset(&m_rtc_data,0,sizeof(m_rtc_data)); - m_rtc_reg = 0; - m_rtc_state = 0; - m_rtc_data[0xf]=1; - - m_rtc_timer = timer_alloc(); - m_rtc_timer->adjust(attotime::zero, 0, attotime(1,0)); - // europc_rtc_set_time(); - - machine().device("nvram")->set_base(m_rtc_data, sizeof(m_rtc_data)); - m_aga = machine().device("aga:aga"); - -} - -WRITE8_MEMBER( europc_pc_state::europc_pio_w ) -{ - switch (offset) - { - case 1: - m_port61=data; - m_mb->m_pit8253->write_gate2(BIT(data, 0)); - m_mb->pc_speaker_set_spkrdata(BIT(data, 1)); - m_keyboard->enable(BIT(data, 6)); - if(data & 0x80) - m_mb->m_pic8259->ir1_w(0); - break; - } - - logerror("europc pio write %.2x %.2x\n", offset, data); -} - - -READ8_MEMBER( europc_pc_state::europc_pio_r ) -{ - int data = 0; - switch (offset) - { - case 0: - data = m_keyboard->read(space, 0); - break; - case 1: - data = m_port61; - break; - case 2: - if (m_mb->m_pit_out2) - data |= 0x20; - break; - } - return data; -} - -/* -layout of an uk europc - -ESC, [SPACE], F1,F2,F3,F4,[SPACE],F5,F6,F7,F8,[SPACE],F9,F0,F11,F12 -[SPACE] -\|, 1,2,3,4,5,6,7,8,9,0 -,+, BACKSPACE,[SPACE], NUM LOCK, SCROLL LOCK, PRINT SCREEN, KEYPAD - -TAB,Q,W,E,R,T,Y,U,I,O,P,[,], RETURN, [SPACE], KEYPAD 7, KEYPAD 8, KEYPAD 9, KEYPAD + -CTRL, A,S,D,F,G,H,J,K,L,;,@,~, RETURN, [SPACE],KEYPAD 4,KEYPAD 5,KEYPAD 6, KEYPAD + -LEFT SHIFT, Z,X,C,V,B,N,M,<,>,?,RIGHT SHIFT,[SPACE],KEYPAD 1, KEYPAD 2, KEYPAD 3, KEYPAD ENTER -ALT,[SPACE], SPACE BAR,[SPACE],CAPS LOCK,[SPACE], KEYPAD 0, KEYPAD ., KEYPAD ENTER - -\ and ~ had to be swapped -i am not sure if keypad enter delivers the mf2 keycode - */ - -static INPUT_PORTS_START( europc ) - PORT_START("DSW0") /* IN1 */ - - PORT_START("DSW1") /* IN2 */ - PORT_DIPNAME( 0x80, 0x80, "COM1: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x40, "COM2: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x00, "COM3: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x10, 0x00, "COM4: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x04, 0x00, "LPT2: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x02, 0x00, "LPT3: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x01, 0x00, "Game port enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) - - PORT_START("DSW2") /* IN3 */ - PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) - PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ - PORT_BIT( 0x01, 0x01, IPT_UNUSED ) - - PORT_INCLUDE(pc_keyboard) - PORT_MODIFY("pc_keyboard_2") /* IN6 */ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_BACKSLASH) /* ` 29 A9 */ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_TILDE) /* \ 2B AB */ - - PORT_MODIFY("pc_keyboard_5") /* IN9 */ - PORT_BIT ( 0x0070, 0x0000, IPT_UNUSED ) - /* 0x40 non us backslash 2 not available */ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) /* F11 57 D7 */ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) /* F12 58 D8 */ - - PORT_START("pc_keyboard_6") /* IN10 */\ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* PAD Enter 60 e0 */ - PORT_BIT(0xfffe, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static ADDRESS_MAP_START( europc_map, AS_PROGRAM, 8, europc_pc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xaffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_NOP - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(europc_io, AS_IO, 8, europc_pc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0060, 0x0063) AM_READWRITE(europc_pio_r, europc_pio_w) - AM_RANGE(0x0250, 0x025f) AM_READWRITE(europc_jim_r, europc_jim_w) - AM_RANGE(0x02e0, 0x02e0) AM_READ(europc_jim2_r) -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( europc, europc_pc_state ) - MCFG_CPU_ADD("maincpu", I8088, 4772720*2) - MCFG_CPU_PROGRAM_MAP(europc_map) - MCFG_CPU_IO_MAP(europc_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "aga", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "lpt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "com", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "fdc_xt", false) - - MCFG_PC_KEYB_ADD("pc_keyboard", DEVWRITELINE("mb:pic8259", pic8259_device, ir1_w)) - - MCFG_NVRAM_ADD_0FILL("nvram"); - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - -ROM_START( europc ) - ROM_REGION(0x100000,"maincpu", 0) - // hdd bios integrated! - ROM_LOAD("50145", 0xf8000, 0x8000, CRC(1775a11d) SHA1(54430d4d0462860860397487c9c109e6f70db8e3)) // V2.07 -ROM_END - -COMP( 1988, europc, ibm5150, 0, europc, europc, europc_pc_state, europc, "Schneider Rdf. AG", "EURO PC", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/evmbug.c b/src/mess/drivers/evmbug.c deleted file mode 100644 index 355eaca0769..00000000000 --- a/src/mess/drivers/evmbug.c +++ /dev/null @@ -1,117 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Stuart's Breadboard Project. TMS9995 evaluation kit TMAM6095. - - 2013-06-02 Skeleton driver. - - http://www.avjd51.dsl.pipex.com/tms9995_eval_module/tms9995_eval_module.htm - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/tms9900/tms9995.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class evmbug_state : public driver_device -{ -public: - evmbug_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_READ8_MEMBER(rs232_r); - DECLARE_WRITE8_MEMBER(rs232_w); - DECLARE_WRITE8_MEMBER(kbd_put); - virtual void machine_reset(); - UINT8 m_term_data; - UINT8 m_term_out; - required_device m_maincpu; - required_device m_terminal; -}; - -static ADDRESS_MAP_START( evmbug_mem, AS_PROGRAM, 8, evmbug_state ) - AM_RANGE(0x0000, 0x17ff) AM_ROM - AM_RANGE(0xec00, 0xefff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( evmbug_io, AS_IO, 8, evmbug_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0007) AM_WRITE(rs232_w) - AM_RANGE(0x0000, 0x0002) AM_READ(rs232_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( evmbug ) -INPUT_PORTS_END - -READ8_MEMBER( evmbug_state::rs232_r ) -{ - static UINT8 temp = 0; - temp^=0xff; - if (offset == 1) - return temp; - - if (offset == 2) - { - return 0xff;//(m_term_data) ? 0 : 0xff; - } - - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( evmbug_state::rs232_w ) -{ - if (offset == 0) - m_term_out = 0; - - m_term_out |= (data << offset); - - if (offset == 7) - m_terminal->write(space, 0, m_term_out & 0x7f); -} - -WRITE8_MEMBER( evmbug_state::kbd_put ) -{ - m_term_data = data; -} - -void evmbug_state::machine_reset() -{ - m_term_data = 0; - // Disable auto wait state generation by raising the READY line on reset - static_cast(machine().device("maincpu"))->set_ready(ASSERT_LINE); -} - -static MACHINE_CONFIG_START( evmbug, evmbug_state ) - // basic machine hardware - // TMS9995 CPU @ 12.0 MHz - // We have no lines connected yet - MCFG_TMS99xx_ADD("maincpu", TMS9995, 12000000, evmbug_mem, evmbug_io ) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(evmbug_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( evmbug ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) -// ROM_LOAD( "u8.bin", 0x0000, 0x1000, CRC(bdb8c7bd) SHA1(340829dcb7a65f2e830fd5aff82a312e3ed7918f) ) -// ROM_LOAD( "u9.bin", 0x1000, 0x0800, CRC(4de459ea) SHA1(00a42fe556d4ffe1f85b2ce369f544b07fbd06d9) ) - ROM_LOAD( "evmbug.bin", 0x0000, 0x8000, CRC(a239ec56) SHA1(65b500d7d0f897ce0c320cf3ec32ff4042774599) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, evmbug, 0, 0, evmbug, evmbug, driver_device, 0, "Texas Instruments", "TMAM6095", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/excali64.c b/src/mess/drivers/excali64.c deleted file mode 100644 index 3e4664ca913..00000000000 --- a/src/mess/drivers/excali64.c +++ /dev/null @@ -1,647 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Excalibur 64 kit computer, designed and sold in Australia by BGR Computers. -The official schematics have a LOT of errors and omissions. - -Skeleton driver created on 2014-12-09. - -Chips: Z80A, 8251, 8253, 8255, 6845 -We have Basic 1.1. Other known versions are 1.01, 2.1 -There are 2 versions of the colour prom, which have different palettes. -We have the later version. - -Notes: -- Control W then Enter will switch between 40 and 80 characters per line. -- Control V turns cursor on -- Graphics commands such as LINE, CIRCLE, HGRCLS, HGRSET etc only work with disk basic - -ToDo: -- Colours are approximate. -- Hardware supports 20cm and 13cm floppies, but we only support 13cm as this - is the only software that exists. -- The schematic shows the audio counter connected to 2MHz, but this produces - sounds that are too high. Connected to 1MHz for now. -- Serial -- Pasting can sometimes drop a character. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "machine/i8251.h" -#include "bus/rs232/rs232.h" -//#include "machine/clock.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "sound/speaker.h" -#include "machine/z80dma.h" -#include "machine/rescap.h" -#include "machine/74123.h" -#include "machine/wd_fdc.h" -#include "formats/excali64_dsk.h" - -class excali64_state : public driver_device -{ -public: - excali64_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_cass(*this, "cassette") - , m_crtc(*this, "crtc") - , m_io_keyboard(*this, "KEY") - , m_dma(*this, "dma") - , m_u12(*this, "u12") - , m_centronics(*this, "centronics") - , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - { } - - DECLARE_PALETTE_INIT(excali64); - DECLARE_WRITE8_MEMBER(ppib_w); - DECLARE_READ8_MEMBER(ppic_r); - DECLARE_WRITE8_MEMBER(ppic_w); - DECLARE_READ8_MEMBER(port00_r); - DECLARE_READ8_MEMBER(port50_r); - DECLARE_WRITE8_MEMBER(port70_w); - DECLARE_WRITE8_MEMBER(porte4_w); - DECLARE_READ8_MEMBER(porte8_r); - DECLARE_WRITE8_MEMBER(portec_w); - DECLARE_FLOPPY_FORMATS(floppy_formats); - DECLARE_WRITE_LINE_MEMBER(cent_busy_w); - DECLARE_WRITE_LINE_MEMBER(busreq_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - MC6845_UPDATE_ROW(update_row); - DECLARE_WRITE_LINE_MEMBER(crtc_hs); - DECLARE_WRITE_LINE_MEMBER(crtc_vs); - DECLARE_WRITE8_MEMBER(motor_w); - DECLARE_MACHINE_RESET(excali64); - required_device m_palette; - -private: - const UINT8 *m_p_chargen; - UINT8 *m_p_videoram; - UINT8 *m_p_hiresram; - UINT8 m_sys_status; - UINT8 m_kbdrow; - bool m_crtc_vs; - bool m_crtc_hs; - bool m_motor; - bool m_centronics_busy; - required_device m_maincpu; - required_device m_cass; - required_device m_crtc; - required_ioport_array<8> m_io_keyboard; - required_device m_dma; - required_device m_u12; - required_device m_centronics; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; -}; - -static ADDRESS_MAP_START(excali64_mem, AS_PROGRAM, 8, excali64_state) - AM_RANGE(0x0000, 0x1FFF) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") - AM_RANGE(0x2000, 0x2FFF) AM_READ_BANK("bankr2") AM_WRITE_BANK("bankw2") - AM_RANGE(0x3000, 0x3FFF) AM_READ_BANK("bankr3") AM_WRITE_BANK("bankw3") - AM_RANGE(0x4000, 0xBFFF) AM_READ_BANK("bankr4") AM_WRITE_BANK("bankw4") - AM_RANGE(0xC000, 0xFFFF) AM_RAM AM_REGION("rambank", 0xC000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(excali64_io, AS_IO, 8, excali64_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x0f) AM_READ(port00_r) - AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) - AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x20, 0x23) AM_MIRROR(0x0c) AM_DEVREADWRITE("pit", pit8253_device, read, write) - AM_RANGE(0x30, 0x30) AM_MIRROR(0x0e) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0x31, 0x31) AM_MIRROR(0x0e) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE(0x50, 0x5f) AM_READ(port50_r) - AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREADWRITE("ppi", i8255_device, read, write) - AM_RANGE(0x70, 0x7f) AM_WRITE(port70_w) - AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("dma", z80dma_device, read, write) - AM_RANGE(0xe4, 0xe7) AM_WRITE(porte4_w) - AM_RANGE(0xe8, 0xeb) AM_READ(porte8_r) - AM_RANGE(0xec, 0xef) AM_WRITE(portec_w) - AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("fdc", wd2793_t, read, write) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( excali64 ) - PORT_START("KEY.0") /* line 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) - - PORT_START("KEY.1") /* line 1 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // space - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // F1 - - PORT_START("KEY.2") /* line 2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) //B - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) //N - - PORT_START("KEY.3") /* line 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x27) PORT_CHAR(0x22) PORT_CHAR(0x27) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) - - PORT_START("KEY.4") /* line 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x7f) PORT_CHAR(0x1f) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - - PORT_START("KEY.5") /* line 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) - - PORT_START("KEY.6") /* line 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) //Z - - PORT_START("KEY.7") /* line 7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('=') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') -INPUT_PORTS_END - -WRITE_LINE_MEMBER( excali64_state::cent_busy_w ) -{ - m_centronics_busy = state; -} - -FLOPPY_FORMATS_MEMBER( excali64_state::floppy_formats ) - FLOPPY_EXCALI64_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( excali64_floppies ) - SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) - SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -// pulses from port E4 bit 5 restart the 74123. After 3.6 secs without a pulse, the motor gets turned off. -WRITE8_MEMBER( excali64_state::motor_w ) -{ - m_motor = BIT(data, 0); - m_floppy1->get_device()->mon_w(!m_motor); - m_floppy0->get_device()->mon_w(!m_motor); -} - -READ8_MEMBER( excali64_state::porte8_r ) -{ - return 0xfc | (UINT8)m_motor; -} - -WRITE8_MEMBER( excali64_state::porte4_w ) -{ - floppy_image_device *floppy = NULL; - if (BIT(data, 0)) - floppy = m_floppy0->get_device(); - - if (BIT(data, 1)) - floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - if (floppy) - floppy->ss_w(BIT(data, 4)); - - m_u12->b_w(space,offset, BIT(data, 5)); // motor pulse -} - -/* -d0 = precomp (selectable by jumper) -d1 = size select (we only support 13cm) -d2 = density select (0 = double) -*/ -WRITE8_MEMBER( excali64_state::portec_w ) -{ - m_fdc->dden_w(BIT(data, 2)); -} - -WRITE_LINE_MEMBER( excali64_state::busreq_w ) -{ -// since our Z80 has no support for BUSACK, we assume it is granted immediately - m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); - m_dma->bai_w(state); // tell dma that bus has been granted -} - -READ8_MEMBER( excali64_state::memory_read_byte ) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER( excali64_state::memory_write_byte ) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - prog_space.write_byte(offset, data); -} - -READ8_MEMBER( excali64_state::io_read_byte ) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER( excali64_state::io_write_byte ) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - prog_space.write_byte(offset, data); -} - -WRITE8_MEMBER( excali64_state::ppib_w ) -{ - m_kbdrow = data; -} - -READ8_MEMBER( excali64_state::ppic_r ) -{ - UINT8 data = 0xf4; // READY line must be low to print - data |= (UINT8)m_centronics_busy; - data |= (m_cass->input() > 0.1) << 3; - return data; -} - -WRITE8_MEMBER( excali64_state::ppic_w ) -{ - m_cass->output(BIT(data, 7) ? -1.0 : +1.0); - m_centronics->write_strobe(BIT(data, 4)); -} - -READ8_MEMBER( excali64_state::port00_r ) -{ - UINT8 data = 0xff; - - for (int i = 0; i < 8; i++) - { - if (!BIT(m_kbdrow, i)) - data &= m_io_keyboard[i]->read(); - } - - return data; -} - -/* -d0 : /rom ; screen -d1 : ram on -d2 : /low ; high res -d3 : 2nd colour set (previously, dispen, which is a mistake in hardware and schematic) -d4 : vsync -d5 : rombank -*/ -READ8_MEMBER( excali64_state::port50_r ) -{ - UINT8 data = m_sys_status & 0x2f; - bool csync = m_crtc_hs | m_crtc_vs; - data |= (UINT8)csync << 4; - return data; -} - -/* -d0,1,2,3,5 : same as port50 -(schematic wrongly says d7 used for 2nd colour set) -*/ -WRITE8_MEMBER( excali64_state::port70_w ) -{ - m_sys_status = data; - m_crtc->set_unscaled_clock(BIT(data, 2) ? 2e6 : 1e6); - if BIT(data, 1) - { - // select 64k ram - membank("bankr1")->set_entry(0); - membank("bankr2")->set_entry(0); - membank("bankr3")->set_entry(0); - membank("bankr4")->set_entry(0); - membank("bankw2")->set_entry(0); - membank("bankw3")->set_entry(0); - membank("bankw4")->set_entry(0); - } - else - if BIT(data, 0) - { - // select videoram and hiresram - membank("bankr1")->set_entry(1); - membank("bankr2")->set_entry(2); - membank("bankr3")->set_entry(2); - membank("bankw2")->set_entry(2); - membank("bankw3")->set_entry(2); - membank("bankr4")->set_entry(2); - membank("bankw4")->set_entry(2); - } - else - { - // select rom, videoram, and main ram - membank("bankr1")->set_entry(1); - membank("bankr2")->set_entry(1); - membank("bankr3")->set_entry(1); - membank("bankw2")->set_entry(2); - membank("bankw3")->set_entry(2); - membank("bankr4")->set_entry(0); - membank("bankw4")->set_entry(0); - } - - // other half of ROM_1 - if ((data & 0x22) == 0x20) - membank("bankr1")->set_entry(2); -} - -MACHINE_RESET_MEMBER( excali64_state, excali64 ) -{ - membank("bankr1")->set_entry(1); // read from ROM - membank("bankr2")->set_entry(1); // read from ROM - membank("bankr3")->set_entry(1); // read from ROM - membank("bankr4")->set_entry(0); // read from RAM - membank("bankw1")->set_entry(0); // write to RAM - membank("bankw2")->set_entry(2); // write to videoram - membank("bankw3")->set_entry(2); // write to videoram hires pointers - membank("bankw4")->set_entry(0); // write to RAM - m_maincpu->reset(); -} - -WRITE_LINE_MEMBER( excali64_state::crtc_hs ) -{ - m_crtc_hs = state; -} - -WRITE_LINE_MEMBER( excali64_state::crtc_vs ) -{ - m_crtc_vs = state; -} - -/* F4 Character Displayer */ -static const gfx_layout excali64_charlayout = -{ - 8, 12, /* 8 x 12 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( excali64 ) - GFXDECODE_ENTRY( "chargen", 0x0000, excali64_charlayout, 0, 1 ) -GFXDECODE_END - -// The prom, the schematic, and the manual all contradict each other, -// so the colours can only be described as wild guesses. Further, the 38 -// colour-load resistors are missing labels and values. -PALETTE_INIT_MEMBER( excali64_state, excali64 ) -{ - // do this here because driver_init hasn't run yet - m_p_videoram = memregion("videoram")->base(); - m_p_chargen = memregion("chargen")->base(); - m_p_hiresram = m_p_videoram + 0x2000; - UINT8 *main = memregion("roms")->base(); - UINT8 *ram = memregion("rambank")->base(); - - // main ram (cp/m mode) - membank("bankr1")->configure_entry(0, &ram[0x0000]); - membank("bankr2")->configure_entry(0, &ram[0x2000]); - membank("bankr3")->configure_entry(0, &ram[0x3000]); - membank("bankr4")->configure_entry(0, &ram[0x4000]);//boot - membank("bankw1")->configure_entry(0, &ram[0x0000]);//boot - membank("bankw2")->configure_entry(0, &ram[0x2000]); - membank("bankw3")->configure_entry(0, &ram[0x3000]); - membank("bankw4")->configure_entry(0, &ram[0x4000]);//boot - // rom_1 - membank("bankr1")->configure_entry(1, &main[0x0000]);//boot - membank("bankr1")->configure_entry(2, &main[0x2000]); - // rom_2 - membank("bankr2")->configure_entry(1, &main[0x4000]);//boot - membank("bankr3")->configure_entry(1, &main[0x5000]);//boot - // videoram - membank("bankr2")->configure_entry(2, &m_p_videoram[0x0000]); - membank("bankw2")->configure_entry(2, &m_p_videoram[0x0000]);//boot - // hiresram - membank("bankr3")->configure_entry(2, &m_p_videoram[0x1000]); - membank("bankw3")->configure_entry(2, &m_p_videoram[0x1000]);//boot - membank("bankr4")->configure_entry(2, &m_p_hiresram[0x0000]); - membank("bankw4")->configure_entry(2, &m_p_hiresram[0x0000]); - - // Set up foreground colours - UINT8 r,g,b,i,code; - for (i = 0; i < 32; i++) - { - code = m_p_chargen[0x1000+i]; - r = (BIT(code, 0) ? 38 : 0) + (BIT(code, 1) ? 73 : 0) + (BIT(code, 2) ? 144 : 0); - b = (BIT(code, 3) ? 38 : 0) + (BIT(code, 4) ? 73 : 0) + (BIT(code, 5) ? 144 : 0); - g = (BIT(code, 6) ? 85 : 0) + (BIT(code, 7) ? 170 : 0); - palette.set_pen_color(i, r, g, b); - } - - // Background - palette.set_pen_color(32, 0x00, 0x00, 0x00); // 0 Black - palette.set_pen_color(33, 0xff, 0x00, 0x00); // 1 Red - palette.set_pen_color(34, 0x00, 0x00, 0xff); // 2 Blue - palette.set_pen_color(35, 0xff, 0x00, 0xff); // 3 Magenta - palette.set_pen_color(36, 0x00, 0xff, 0x00); // 4 Green - palette.set_pen_color(37, 0xff, 0xff, 0x00); // 5 Yellow - palette.set_pen_color(38, 0x00, 0xff, 0xff); // 6 Cyan - palette.set_pen_color(39, 0xff, 0xff, 0xff); // 7 White -} - -MC6845_UPDATE_ROW( excali64_state::update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,col,bg,fg; - UINT16 mem,x; - UINT8 col_base = BIT(m_sys_status, 3) ? 16 : 0; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - col = m_p_videoram[mem+0x800]; - fg = col_base + (col >> 4); - bg = 32 + ((col >> 1) & 7); - - if BIT(col, 0) - { - UINT8 h = m_p_videoram[mem+0x1000] - 4; - if (h > 5) - h = 0; // keep us in bounds - // hires definition - pixels are opposite order to characters - gfx = BITSWAP8(m_p_hiresram[(h << 12) | (chr<<4) | ra], 0, 1, 2, 3, 4, 5, 6, 7); - } - else - gfx = m_p_chargen[(chr<<4) | ra]; // normal character - - gfx ^= (x == cursor_x) ? 0xff : 0; - - /* Display a scanline of a character */ - *p++ = palette[BIT(gfx, 0) ? fg : bg]; - *p++ = palette[BIT(gfx, 1) ? fg : bg]; - *p++ = palette[BIT(gfx, 2) ? fg : bg]; - *p++ = palette[BIT(gfx, 3) ? fg : bg]; - *p++ = palette[BIT(gfx, 4) ? fg : bg]; - *p++ = palette[BIT(gfx, 5) ? fg : bg]; - *p++ = palette[BIT(gfx, 6) ? fg : bg]; - *p++ = palette[BIT(gfx, 7) ? fg : bg]; - } -} - -static MACHINE_CONFIG_START( excali64, excali64_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(excali64_mem) - MCFG_CPU_IO_MAP(excali64_io) - - MCFG_MACHINE_RESET_OVERRIDE(excali64_state, excali64) - - MCFG_DEVICE_ADD("uart", I8251, 0) - //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_16MHz / 16) /* Timer 0: tone gen for speaker */ - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) - //MCFG_PIT8253_CLK1(XTAL_16MHz / 16) /* Timer 1: baud rate gen for 8251 */ - //MCFG_PIT8253_OUT1_HANDLER(WRITELINE(excali64_state, write_uart_clock)) - //MCFG_PIT8253_CLK2(XTAL_16MHz / 16) /* Timer 2: not used */ - - MCFG_DEVICE_ADD("ppi", I8255A, 0 ) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) // parallel port - MCFG_I8255_OUT_PORTB_CB(WRITE8(excali64_state, ppib_w)) - MCFG_I8255_IN_PORTC_CB(READ8(excali64_state, ppic_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(excali64_state, ppic_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(80*8, 24*12) - MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*12-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_PALETTE_ADD("palette", 40) - MCFG_PALETTE_INIT_OWNER(excali64_state, excali64) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", excali64) - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_16MHz / 16) // 1MHz for lowres; 2MHz for highres - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(excali64_state, update_row) - MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(excali64_state, crtc_hs)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(excali64_state, crtc_vs)) - - /* Devices */ - MCFG_CASSETTE_ADD( "cassette" ) - - MCFG_WD2793_ADD("fdc", XTAL_16MHz / 16) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "drive0", excali64_state::floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "drive1", excali64_state::floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - - MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_16MHz/4) - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(excali64_state, busreq_w)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(excali64_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(excali64_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(excali64_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(excali64_state, io_write_byte)) - - MCFG_DEVICE_ADD("u12", TTL74123, 0) - MCFG_TTL74123_CONNECTION_TYPE(TTL74123_GROUNDED) /* Hook up type (no idea what this means) */ - MCFG_TTL74123_RESISTOR_VALUE(RES_K(100)) /* resistor connected between RCext & 5v */ - MCFG_TTL74123_CAPACITOR_VALUE(CAP_U(100)) /* capacitor connected between Cext and RCext */ - MCFG_TTL74123_A_PIN_VALUE(0) /* A pin - grounded */ - MCFG_TTL74123_B_PIN_VALUE(1) /* B pin - driven by port e4 bit 5 */ - MCFG_TTL74123_CLEAR_PIN_VALUE(1) /* Clear pin - pulled high */ - MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITE8(excali64_state, motor_w)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(excali64_state, cent_busy_w)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( excali64 ) - ROM_REGION(0x6000, "roms", 0) - ROM_LOAD( "rom_1.ic17", 0x0000, 0x4000, CRC(e129a305) SHA1(e43ec7d040c2b2e548d22fd6bbc7df8b45a26e5a) ) - ROM_LOAD( "rom_2.ic24", 0x4000, 0x2000, CRC(916d9f5a) SHA1(91c527cce963481b7bebf077e955ca89578bb553) ) - // fix a bug that causes screen to be filled with 'p' - ROM_FILL(0x4ee, 1, 0) - ROM_FILL(0x4ef, 1, 8) - ROM_FILL(0x4f6, 1, 0) - ROM_FILL(0x4f7, 1, 8) - // patch out the protection - ROM_FILL(0x3ce7, 1, 0) - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASE00) - ROM_REGION(0xA000, "videoram", ROMREGION_ERASE00) - - ROM_REGION(0x1020, "chargen", 0) - ROM_LOAD( "genex_3.ic43", 0x0000, 0x1000, CRC(b91619a9) SHA1(2ced636cb7b94ba9d329868d7ecf79963cefe9d9) ) - ROM_LOAD( "hm7603.ic55", 0x1000, 0x0020, CRC(c74f47dc) SHA1(331ff3c913846191ddd97cacb80bd19438c1ff71) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, excali64, 0, 0, excali64, excali64, driver_device, 0, "BGR Computers", "Excalibur 64", 0 ) diff --git a/src/mess/drivers/exelv.c b/src/mess/drivers/exelv.c deleted file mode 100644 index fc1ad3d0c0e..00000000000 --- a/src/mess/drivers/exelv.c +++ /dev/null @@ -1,606 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - Experimental exelvision driver - - Raphael Nabet, 2004 - - Exelvision was a French company that designed and sold two computers: - * EXL 100 (1984) - * EXELTEL (1986), which is mostly compatible with EXL 100, but has an - integrated V23b modem and 5 built-in programs. Two custom variants of - the EXELTEL were designed for chemist's shops and car dealers: they were - bundled with application-specific business software, bar code reader, - etc. - These computer were mostly sold in France and in Europe (Spain); there was - an Arabic version, too. - - Exelvision was founded by former TI employees, which is why their designs - use TI components and have architectural reminiscences of the primitive - TI-99/4 design (both computers are built around a microcontroller, have - little CPU RAM and must therefore store program data in VRAM, and feature - I/R keyboard and joysticks) - -Specs: - * main CPU is a variant of tms7020 (exl100) or tms7040 (exeltel). AFAIK, - the only difference compared to a stock tms7020/7040 is the SWAP register - instruction is replaced by a custom microcoded LVDP instruction that - reads a byte from the VDP VRAM read port; it seems that the first 6 bytes - of internal ROM (0xF000-0xF005 on an exeltel) are missing, too. - * in addition to the internal 128-byte RAM and 2kb (exl100) or 4kb - (exeltel) ROM, there are 2kb of CPU RAM and 64(?)kb (exeltel only?) of - CPU ROM. - * I/O is controlled by a tms7041 (exl100) or tms7042 (exeltel) or a variant - thereof. Communication with the main CPU is done through some custom - interface (I think), details are still to be worked out. - * video: tms3556 VDP with 32kb of VRAM (expandable to 64kb), attached to - the main CPU. - * sound: tms5220 speech synthesizer with speech ROM, attached to the I/O - CPU - * keyboard and joystick: an I/R interface controlled by the I/O CPU enables - to use a keyboard and two joysticks - * mass storage: tape interface controlled by the main CPU - -STATUS: - * EXL 100 cannot be emulated because the ROMs are not dumped - * EXELTEL stops early in the boot process and displays a red error screen, - presumably because the I/O processor is not emulated - -TODO: - * dump exeltel tms7042 I/O CPU ROM - * everything -*/ - - -#include "emu.h" -#include "cpu/tms7000/tms7000.h" -#include "video/tms3556.h" -#include "sound/tms5220.h" -#include "machine/spchrom.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -//#include "imagedev/cassette.h" - - -class exelv_state : public driver_device -{ -public: - exelv_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_tms3556(*this, "tms3556"), - m_tms5220c(*this, "tms5220c"), - m_cart(*this, "cartslot") - { } - - required_device m_maincpu; - required_device m_tms3556; - required_device m_tms5220c; - optional_device m_cart; - - DECLARE_READ8_MEMBER( mailbox_wx319_r ); - DECLARE_WRITE8_MEMBER( mailbox_wx318_w ); - DECLARE_READ8_MEMBER( tms7020_porta_r ); - DECLARE_WRITE8_MEMBER( tms7020_portb_w ); - DECLARE_READ8_MEMBER( tms7041_porta_r ); - DECLARE_WRITE8_MEMBER( tms7041_portb_w ); - DECLARE_READ8_MEMBER( tms7041_portc_r ); - DECLARE_WRITE8_MEMBER( tms7041_portc_w ); - DECLARE_READ8_MEMBER( tms7041_portd_r ); - DECLARE_WRITE8_MEMBER( tms7041_portd_w ); - DECLARE_READ8_MEMBER( rom_r ); - - DECLARE_MACHINE_START(exl100); - DECLARE_MACHINE_START(exeltel); - - /* tms7020 i/o ports */ - UINT8 m_tms7020_portb; - - /* tms7041 i/o ports */ - UINT8 m_tms7041_portb; - UINT8 m_tms7041_portc; - UINT8 m_tms7041_portd; - - /* mailbox data */ - UINT8 m_wx318; /* data of 74ls374 labeled wx318 */ - UINT8 m_wx319; /* data of 74sl374 labeled wx319 */ - - TIMER_DEVICE_CALLBACK_MEMBER(exelv_hblank_interrupt); - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( exelvision_cartridge ); -}; - - -TIMER_DEVICE_CALLBACK_MEMBER(exelv_state::exelv_hblank_interrupt) -{ - m_tms3556->interrupt(machine()); -} - - -/* - I/O CPU protocol (WIP): - - I do not have a dump of the I/O CPU ROMs. The I/O CPU CRC command should - enable to dump them, but don't take my word for it. - - * port B bit >01 is asserted on reset and after a byte is sent to the I/O - CPU. - * port B bit >02 is asserted after a byte is read from the I/O CPU. When - the I/O CPU sees this line asserted, it asserts port A bit >01. - * port A bit >01 is asserted after a byte is sent to CPU (condition - cleared when port B bit >01 is cleared after being asserted) and when - port B bit >02 is asserted. - * I/O CPU pulses the main CPU INT1 line when ready to send data; data can - be read by the main CPU on the mailbox port (P48). The data is a - function code optionally followed by several bytes of data. Function - codes are: - >00: unused - >01: joystick 0 receive - >02: joystick 1 receive - >03: speech buffer start - >04: speech buffer end - >05: serial - >06: unused - >07: introduction screen (logo) (EXL 100 only?) or character - definitions - data byte #1: data length - 1 MSB - data byte #2: data length - 1 LSB - data bytes #3 through (data length + 3): graphic data - >08: I/O cpu initialized - >09: I/O cpu serial interface ready - >0a: I/O cpu serial interface not ready - >0b: screen switched off - >0c: speech buffer start (EXELTEL only?) - >0d: speech ROM or I/O cpu CRC check (EXELTEL only?) - data byte #1: expected CRC MSB - data byte #2: expected CRC LSB - data byte #3: data length - 1 MSB - data byte #4: data length - 1 LSB - data bytes #5 through (data length + 5): data on which effective - CRC is computed - >0e: mailbox test, country code read (EXELTEL only?) - >0f: speech ROM read (data repeat) (EXELTEL only?) - * The main CPU sends data to the I/O CPU through the mailbox port (P48). - The data byte is a function code; some function codes ask for extra data - bytes, which are sent through the mailbox port as well. Function codes - are: - >00: I/O CPU reset - >01: NOP (EXELTEL only?) - >02: read joystick 0 current value - >03: read joystick 1 current value - >04: test serial interface availability - >05: transmit a byte to serial interface - >06: initialization of serial interface - >07: read contents of speech ROM (EXELTEL only?) - >08: reset speech synthesizer - >09: start speech synthesizer - >0a: synthesizer data - >0b: standard generator request - >0c: I/O CPU CRC (EXELTEL only?) - >0d: send exelvision logo (EXL 100 only), start speech ROM sound (EXELTEL only?) - >0e: data for speech on ROM (EXELTEL only?) - >0f: do not decode joystick 0 keys (EXELTEL only?) - >10: do not decode joystick 1 keys (EXELTEL only?) - >11: decode joystick 0 keys (EXELTEL only?) - >12: decode joystick 1 keys (EXELTEL only?) - >13: mailbox test: echo sent data (EXELTEL only?) - >14: enter sleep mode (EXELTEL only?) - >15: read country code in speech ROM (EXELTEL only?) - >16: position I/O CPU DSR without initialization (EXELTEL only?) - >17: handle speech ROM sound with address (EXELTEL only?) - other values: I/O CPU reset? -*/ - - -READ8_MEMBER(exelv_state::mailbox_wx319_r) -{ - logerror("[TMS7220] reading mailbox %d\n", m_wx319); - return m_wx319; -} - - -WRITE8_MEMBER(exelv_state::mailbox_wx318_w) -{ - logerror("wx318 write 0x%02x\n", data); - m_wx318 = data; -} - - -/* - TMS7020 PORT A - A0 - R - TMS7041 port B bit 7 (REV3) - A1 - - A2 - - A3 - - A4 - - A5 - - A6 - - A7 - -*/ -READ8_MEMBER(exelv_state::tms7020_porta_r) -{ - logerror("tms7020_porta_r\n"); - return ( m_tms7041_portb & 0x80 ) ? 0x01 : 0x00; -} - - -/* - TMS7020 PORT B - B0 - W - TMS7041 port A bit 2 (REV2) - B1 - W - TMS7041 port A bit 4 (REV4) - B2 - - B3 - - B4 - - B5 - - B6 - - B7 - -*/ -WRITE8_MEMBER(exelv_state::tms7020_portb_w) -{ - logerror("tms7020_portb_w: data = 0x%02x\n", data); - m_tms7020_portb = data; -} - - -/* - TMS7041 PORT A - A0 - X1 NDSR A8 - A1 - X1 MDTR A9 - A2 - R - TMS7020 port B bit 0 (REV2) - A3 - TMS5220 IRQ - A4 - R - TMS7020 port B bit 1 (REV4) - A5 - X1 RXD A4 (version b) / WX301-14 (version a) - A6 - X1 SCLK A9 - A7 - TMS5220 RDY -*/ -READ8_MEMBER(exelv_state::tms7041_porta_r) -{ - UINT8 data = 0x00; - static UINT8 data_last=0; - - // TMS5220 OK - data |= m_tms5220c->intq_r() ? 0x08 : 0x00; // A3 - data |= m_tms5220c->readyq_r() ? 0x80 : 0x00; // A7 - - // TMS7220 - data |= (m_tms7020_portb & 0x01 ) ? 0x04 : 0x00; // A2 - data |= (m_tms7020_portb & 0x02) ? 0x10 : 0x00; // A4 - - // SERIAL PORT - - if (data!=data_last) { - logerror("tms7041_porta_r %x\n",data); - } - data_last=data; - - return data; -} - - -/* - TMS7041 PORT B - B0 - W - TMS5220 W - B1 - W - TMS5220 R - B2 - W - TMS7020 pin 13 / IRQ1 - B3 - X1 TXD A5 (version b) / WX301-8 (version a) - B4 - TP3 - B5 - REV5 WX318-1 - B6 - W - REV6 WX319-11 - B7 - W - TMS7020 port A bit 0 (REV3) -*/ -WRITE8_MEMBER(exelv_state::tms7041_portb_w) -{ - logerror("tms7041_portb_w: data = 0x%02x\n", data); - - m_tms5220c->wsq_w((data & 0x01) ? 1 : 0); - m_tms5220c->rsq_w((data & 0x02) ? 1 : 0); - - logerror("TMS7020 %s int1\n",((data & 0x04) ? "clear" : "assert")); - m_maincpu->set_input_line(TMS7000_INT1_LINE, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE); - - /* Check for low->high transition on B6 */ - if (!(m_tms7041_portb & 0x40) && (data & 0x40)) - { - logerror("wx319 write 0x%02x\n", m_tms7041_portc); - m_wx319 = m_tms7041_portc; - } - - m_tms7041_portb = data; -} - - -/* - TMS7041 PORT C - connected to mailbox WX318 and WX319 data bits -*/ -READ8_MEMBER(exelv_state::tms7041_portc_r) -{ - UINT8 data = 0xff; - logerror("tms7041_portc_r\n"); - - /* Check if wx318 output is enabled */ - if (!(m_tms7041_portb & 0x20)) - data = m_wx318; - - return data; -} - - -WRITE8_MEMBER(exelv_state::tms7041_portc_w) -{ - logerror("tms7041_portc_w: data = 0x%02x\n", data); - m_tms7041_portc = data; -} - - -/* - TMS7041 PORT D - D0 - TMS5220 D7 - D1 - TMS5220 D6 - D2 - TMS5220 D5 - D3 - TMS5220 D4 - D4 - TMS5220 D3 - D5 - TMS5220 D2 - D6 - TMS5220 D1 - D7 - TMS5220 D0 -*/ -READ8_MEMBER(exelv_state::tms7041_portd_r) -{ - UINT8 data = 0xff; - data=m_tms5220c->status_r(space, 0, data); - logerror("tms7041_portd_r\n"); - return data; -} - - -WRITE8_MEMBER(exelv_state::tms7041_portd_w) -{ - logerror("tms7041_portd_w: data = 0x%02x\n", data); - - m_tms5220c->data_w(space, 0, data); - m_tms7041_portd = data; -} - - -/* - CARTRIDGE ACCESS -*/ -READ8_MEMBER(exelv_state::rom_r) -{ - if (m_cart && m_cart->exists()) - return m_cart->read_rom(space, offset + 0x200); - - return 0; -} - - -/* - Main CPU memory map summary: - - @>0000-@>007f: tms7020/tms7040 internal RAM - @>0080-@>00ff: reserved - @>0100-@>010b: tms7020/tms7040 internal I/O ports - @>104 (P4): port A - @>106 (P6): port B - bit >04: page select bit 0 (LSBit) - @>010c-@>01ff: external I/O ports? - @>012d (P45): tms3556 control write port??? - @>012e (P46): tms3556 VRAM write port??? - @>0130 (P48): I/O CPU communication port R/W ("mailbox") - @>0138 (P56): read sets page select bit 1, write clears it??? - @>0139 (P57): read sets page select bit 2 (MSBit), write clears it??? - @>0140 (P64) - bit >40: enable page select bit 1 and 2 (MSBits) - @>0200-@>7fff: system ROM? (two pages?) + cartridge ROMs? (one or two pages?) - @>8000-@>bfff: free for expansion? - @>c000-@>c7ff: CPU RAM? - @>c800-@>efff: free for expansion? - @>f000-@>f7ff: tms7040 internal ROM - @>f800-@>ffff: tms7020/tms7040 internal ROM -*/ - -static ADDRESS_MAP_START(tms7020_mem, AS_PROGRAM, 8, exelv_state) - AM_RANGE(0x0080, 0x00ff) AM_NOP - AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r) - AM_RANGE(0x0125, 0x0125) AM_DEVREAD("tms3556", tms3556_device, reg_r) - AM_RANGE(0x0128, 0x0128) AM_DEVREAD("tms3556", tms3556_device, initptr_r) - AM_RANGE(0x012d, 0x012d) AM_DEVWRITE("tms3556", tms3556_device, reg_w) - AM_RANGE(0x012e, 0x012e) AM_DEVWRITE("tms3556", tms3556_device, vram_w) - - AM_RANGE(0x0130, 0x0130) AM_READWRITE(mailbox_wx319_r, mailbox_wx318_w) - AM_RANGE(0x0200, 0x7fff) AM_READ(rom_r) - AM_RANGE(0x8000, 0xbfff) AM_NOP - AM_RANGE(0xc000, 0xc7ff) AM_RAM /* CPU RAM */ - AM_RANGE(0xc800, 0xf7ff) AM_NOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tms7020_port, AS_IO, 8, exelv_state) - AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(tms7020_porta_r) - AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(tms7020_portb_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tms7041_port, AS_IO, 8, exelv_state) - AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(tms7041_porta_r) - AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(tms7041_portb_w) - AM_RANGE(TMS7000_PORTC, TMS7000_PORTC) AM_READWRITE(tms7041_portc_r, tms7041_portc_w) - AM_RANGE(TMS7000_PORTD, TMS7000_PORTD) AM_READWRITE(tms7041_portd_r, tms7041_portd_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(tms7040_mem, AS_PROGRAM, 8, exelv_state) - AM_RANGE(0x0080, 0x00ff) AM_NOP - AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r) - AM_RANGE(0x0125, 0x0125) AM_DEVREAD("tms3556", tms3556_device, reg_r) - AM_RANGE(0x0128, 0x0128) AM_DEVREAD("tms3556", tms3556_device, initptr_r) - AM_RANGE(0x012d, 0x012d) AM_DEVWRITE("tms3556", tms3556_device, reg_w) - AM_RANGE(0x012e, 0x012e) AM_DEVWRITE("tms3556", tms3556_device, vram_w) - AM_RANGE(0x0130, 0x0130) AM_READWRITE(mailbox_wx319_r, mailbox_wx318_w) - AM_RANGE(0x0200, 0x7fff) AM_ROMBANK("bank1") /* system ROM */ - AM_RANGE(0x8000, 0xbfff) AM_NOP - AM_RANGE(0xc000, 0xc7ff) AM_RAM /* CPU RAM */ - AM_RANGE(0xc800, 0xefff) AM_NOP -ADDRESS_MAP_END - - -/* keyboard: ??? */ -static INPUT_PORTS_START(exelv) - - PORT_START("exelv") - -INPUT_PORTS_END - - -/* Machine Initialization */ - -MACHINE_START_MEMBER( exelv_state, exl100) -{ - /* register for state saving */ - save_item(NAME(m_tms7020_portb)); - save_item(NAME(m_tms7041_portb)); - save_item(NAME(m_tms7041_portc)); - save_item(NAME(m_tms7041_portd)); - save_item(NAME(m_wx318)); - save_item(NAME(m_wx319)); -} - -MACHINE_START_MEMBER( exelv_state, exeltel) -{ - UINT8 *rom = memregion("user1")->base() + 0x0200; - membank("bank1")->configure_entry(0, rom); - membank("bank1")->set_entry(0); - - /* register for state saving */ - save_item(NAME(m_tms7020_portb)); - save_item(NAME(m_tms7041_portb)); - save_item(NAME(m_tms7041_portc)); - save_item(NAME(m_tms7041_portd)); - save_item(NAME(m_wx318)); - save_item(NAME(m_wx319)); -} - - -static MACHINE_CONFIG_START( exl100, exelv_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS7020_EXL, XTAL_4_9152MHz) - MCFG_CPU_PROGRAM_MAP(tms7020_mem) - MCFG_CPU_IO_MAP(tms7020_port) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1) - MCFG_MACHINE_START_OVERRIDE(exelv_state, exl100) - - MCFG_CPU_ADD("tms7041", TMS7041, XTAL_4_9152MHz) - MCFG_CPU_IO_MAP(tms7041_port) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_TMS3556_ADD("tms3556") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_UPDATE_DEVICE("tms3556", tms3556_device, screen_update) -#if TMS3556_DOUBLE_WIDTH - MCFG_SCREEN_SIZE(TMS3556_TOTAL_WIDTH*2, TMS3556_TOTAL_HEIGHT*2) - MCFG_SCREEN_VISIBLE_AREA(0, TMS3556_TOTAL_WIDTH*2-1, 0, TMS3556_TOTAL_HEIGHT*2-1) -#else - MCFG_SCREEN_SIZE(TMS3556_TOTAL_WIDTH, TMS3556_TOTAL_HEIGHT*2) - MCFG_SCREEN_VISIBLE_AREA(0, TMS3556_TOTAL_WIDTH-1, 0, TMS3556_TOTAL_HEIGHT-1) -#endif - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_3BIT_RGB("palette") - - // MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) - - /* sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("tms5220c", TMS5220C, 640000) - // MCFG_TMS52XX_SPEECHROM("vsm") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "exelvision_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_SOFTWARE_LIST_ADD("cart_list", "exl100_cart") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( exeltel, exelv_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS7040, XTAL_4_9152MHz) - MCFG_CPU_PROGRAM_MAP(tms7040_mem) - MCFG_CPU_IO_MAP(tms7020_port) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1) - MCFG_MACHINE_START_OVERRIDE(exelv_state, exeltel) - - MCFG_CPU_ADD("tms7042", TMS7042, XTAL_4_9152MHz) - MCFG_CPU_IO_MAP(tms7041_port) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_TMS3556_ADD("tms3556") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_UPDATE_DEVICE("tms3556", tms3556_device, screen_update) -#if TMS3556_DOUBLE_WIDTH - MCFG_SCREEN_SIZE(TMS3556_TOTAL_WIDTH*2, TMS3556_TOTAL_HEIGHT*2) - MCFG_SCREEN_VISIBLE_AREA(0, TMS3556_TOTAL_WIDTH*2-1, 0, TMS3556_TOTAL_HEIGHT*2-1) -#else - MCFG_SCREEN_SIZE(TMS3556_TOTAL_WIDTH, TMS3556_TOTAL_HEIGHT*2) - MCFG_SCREEN_VISIBLE_AREA(0, TMS3556_TOTAL_WIDTH-1, 0, TMS3556_TOTAL_HEIGHT-1) -#endif - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_3BIT_RGB("palette") - - MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) - - /* sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("tms5220c", TMS5220C, 640000) - MCFG_TMS52XX_SPEECHROM("vsm") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - -/* - ROM loading -*/ -ROM_START(exl100) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("exl100in.bin", 0xf800, 0x0800, CRC(049109a3) SHA1(98a07297dcdacef41c793c197b6496dac1e8e744)) /* TMS7020 ROM, correct */ - - ROM_REGION(0x10000, "tms7041", 0) - ROM_LOAD("exl100_7041.bin", 0xf000, 0x1000, CRC(38f6fc7a) SHA1(b71d545664a974d8ad39bdf600c5b9884c3efab6)) /* TMS7041 internal ROM, correct */ -// ROM_REGION(0x8000, "vsm", 0) -ROM_END - - -ROM_START(exeltel) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("exeltel_7040.bin", 0xf000, 0x1000, CRC(2792f02f) SHA1(442a852eb68ef78974733d169084752a131de23d)) /* TMS7040 internal ROM */ - - ROM_REGION(0x10000, "tms7042", 0) - ROM_LOAD("exeltel_7042.bin", 0xf000, 0x1000, BAD_DUMP CRC(a0163507) SHA1(8452849df7eac8a89cf03ee98e2306047c1c4c38)) /* TMS7042 internal ROM, needs redump */ - - ROM_REGION(0x10000,"user1",0) - ROM_SYSTEM_BIOS( 0, "french", "French v1.4" ) - ROMX_LOAD("exeltel14.bin", 0x0000, 0x10000, CRC(52a80dd4) SHA1(2cb4c784fba3aec52770999bb99a9a303269bf89), ROM_BIOS(1)) /* French system ROM v1.4 */ - ROM_SYSTEM_BIOS( 1, "spanish", "Spanish" ) - ROMX_LOAD("amper.bin", 0x0000, 0x10000, CRC(45af256c) SHA1(3bff16542f8ac55b9841084ea38034132459facb), ROM_BIOS(2)) /* Spanish system rom */ - - ROM_REGION(0x8000, "vsm", 0) - ROM_LOAD("cm62312.bin", 0x0000, 0x4000, CRC(93b817de) SHA1(03863087a071b8f22d36a52d18243f1c33e17ff7)) /* system speech ROM */ -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP(1984, exl100, 0, 0, exl100, exelv, driver_device, 0, "Exelvision", "EXL 100", MACHINE_NOT_WORKING) -COMP(1986, exeltel, exl100, 0, exeltel, exelv, driver_device, 0, "Exelvision", "Exeltel", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/exp85.c b/src/mess/drivers/exp85.c deleted file mode 100644 index 82d2c679f98..00000000000 --- a/src/mess/drivers/exp85.c +++ /dev/null @@ -1,234 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Explorer 85 - - 12/05/2009 Skeleton driver. - - Setting Up - ========== - The terminal must be set for - - Baud: 9600 - - Format: 7E1 - If it isn't, adjust the settings, then restart the system. - - Once started, press Space. The system will start up. - All input must be in upper case. - -****************************************************************************/ - -/* - - TODO: - - - dump of the hexadecimal keyboard monitor ROM - - disable ROM mirror after boot - - RAM expansions - -*/ - - -#include "includes/exp85.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8155.h" -#include "machine/i8355.h" -#include "machine/ram.h" - -/* Memory Maps */ - -static ADDRESS_MAP_START( exp85_mem, AS_PROGRAM, 8, exp85_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROMBANK("bank1") - AM_RANGE(0xc000, 0xdfff) AM_ROM - AM_RANGE(0xf000, 0xf7ff) AM_ROM - AM_RANGE(0xf800, 0xf8ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( exp85_io, AS_IO, 8, exp85_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE(I8355_TAG, i8355_device, io_r, io_w) - AM_RANGE(0xf8, 0xfd) AM_DEVREADWRITE(I8155_TAG, i8155_device, io_r, io_w) -// AM_RANGE(0xfe, 0xff) AM_DEVREADWRITE(I8279_TAG, i8279_r, i8279_w) -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( exp85_state::trigger_reset ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER( exp85_state::trigger_rst75 ) -{ - m_maincpu->set_input_line(I8085_RST75_LINE, newval ? CLEAR_LINE : ASSERT_LINE); -} - -static INPUT_PORTS_START( exp85 ) - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, exp85_state, trigger_reset, 0) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF, exp85_state, trigger_rst75, 0) -INPUT_PORTS_END - -/* 8355 Interface */ - -READ8_MEMBER( exp85_state::i8355_a_r ) -{ - /* - - bit description - - PA0 tape control - PA1 jumper S17 (open=+5V closed=GND) - PA2 J5:13 - PA3 - PA4 J2:22 - PA5 - PA6 - PA7 speaker output - - */ - - return 0x02; -} - -WRITE8_MEMBER( exp85_state::i8355_a_w ) -{ - /* - - bit description - - PA0 tape control - PA1 jumper S17 (open=+5V closed=GND) - PA2 J5:13 - PA3 - PA4 J2:22 - PA5 - PA6 - PA7 speaker output - - */ - - /* tape control */ - m_tape_control = BIT(data, 0); - - /* speaker output */ - m_speaker->level_w(!BIT(data, 7)); -} - -/* I8085A Interface */ - -READ_LINE_MEMBER( exp85_state::sid_r ) -{ - int data = 1; - - if (m_tape_control) - { - data = (m_cassette->input() > +0.0); - } - else - { - data = m_rs232->rxd_r(); - } - - return data; -} - -WRITE_LINE_MEMBER( exp85_state::sod_w ) -{ - if (m_tape_control) - { - m_cassette->output(state ? -1.0 : +1.0); - } - else - { - m_rs232->write_txd(state); - } -} - -/* Terminal Interface */ - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -/* Machine Initialization */ - -void exp85_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* setup memory banking */ - program.install_read_bank(0x0000, 0x07ff, "bank1"); - program.unmap_write(0x0000, 0x07ff); - membank("bank1")->configure_entry(0, m_rom->base() + 0xf000); - membank("bank1")->configure_entry(1, m_rom->base()); - membank("bank1")->set_entry(0); -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( exp85, exp85_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I8085A_TAG, I8085A, XTAL_6_144MHz) - MCFG_CPU_PROGRAM_MAP(exp85_mem) - MCFG_CPU_IO_MAP(exp85_io) - MCFG_I8085A_SID(READLINE(exp85_state, sid_r)) - MCFG_I8085A_SOD(WRITELINE(exp85_state, sod_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_6_144MHz/2) - - MCFG_DEVICE_ADD(I8355_TAG, I8355, XTAL_6_144MHz/2) - MCFG_I8355_IN_PA_CB(READ8(exp85_state, i8355_a_r)) - MCFG_I8355_OUT_PA_CB(WRITE8(exp85_state, i8355_a_w)) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256") - MCFG_RAM_EXTRA_OPTIONS("4K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( exp85 ) - ROM_REGION( 0x10000, I8085A_TAG, 0 ) - ROM_DEFAULT_BIOS("eia") - ROM_LOAD( "c000.bin", 0xc000, 0x0800, CRC(73ce4aad) SHA1(2c69cd0b6c4bdc92f4640bce18467e4e99255bab) ) - ROM_LOAD( "c800.bin", 0xc800, 0x0800, CRC(eb3fdedc) SHA1(af92d07f7cb7533841b16e1176401363176857e1) ) - ROM_LOAD( "d000.bin", 0xd000, 0x0800, CRC(c10c4a22) SHA1(30588ba0b27a775d85f8c581ad54400c8521225d) ) - ROM_LOAD( "d800.bin", 0xd800, 0x0800, CRC(dfa43ef4) SHA1(56a7e7a64928bdd1d5f0519023d1594cacef49b3) ) - ROM_SYSTEM_BIOS( 0, "eia", "EIA Terminal" ) - ROMX_LOAD( "ex 85.u105", 0xf000, 0x0800, CRC(1a99d0d9) SHA1(57b6d48e71257bc4ef2d3dddc9b30edf6c1db766), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "hex", "Hex Keyboard" ) - ROMX_LOAD( "1kbd.u105", 0xf000, 0x0800, NO_DUMP, ROM_BIOS(2) ) - - ROM_REGION( 0x800, I8355_TAG, ROMREGION_ERASE00 ) - -/* ROM_DEFAULT_BIOS("terminal") - ROM_SYSTEM_BIOS( 0, "terminal", "Terminal" ) - ROMX_LOAD( "eia.u105", 0xf000, 0x0800, CRC(1a99d0d9) SHA1(57b6d48e71257bc4ef2d3dddc9b30edf6c1db766), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "hexkbd", "Hex Keyboard" ) - ROMX_LOAD( "hex.u105", 0xf000, 0x0800, NO_DUMP, ROM_BIOS(2) )*/ -ROM_END - -/* System Drivers */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, exp85, 0, 0, exp85, exp85, driver_device, 0, "Netronics", "Explorer/85", 0 ) diff --git a/src/mess/drivers/fanucs15.c b/src/mess/drivers/fanucs15.c deleted file mode 100644 index ce3f9a79bac..00000000000 --- a/src/mess/drivers/fanucs15.c +++ /dev/null @@ -1,423 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - Fanuc System 15 - - 2014-01-04 Skeleton driver. - - This is a circa-1990 CNC machine with a very custom GUI, made of a - bunch of boards plugged into a passive backplane. - - Possible boards include: - A16B-2200-0020/04B : Base 2 Board (contains 12 MHz 68020 "CNC CPU" and 1 or 2 MB of DRAM) - A16B-2200-0090/07A : Digital Servo 4-Axis Controller Board (no ROMs on this board) - A16B-2200-0121/06C : Base 0 Board (1 ROM location but position is empty. -0120 has 6081 001A) - - A16B-2200-0131/11B : Base 1 Board (15 ROMs on this board, 4040, 9030, AB02) - See detailed layout and description below. - - A16B-2200-0150/03A : Conversational Board (4 ROMs on this board, 5A00, probably for Mill) - or - A16B-2200-0150/03A : Conversational Board (4 ROMs on this board, 5C30. 5C for 2 axis Lathe) - or - A16B-2200-0150/03A : Conversational Board (4 ROMs on this board, 5D30. 5D for 4 axis (twin Turret) lathe) - Fanuc FBI-A MB605111 (QFP100) - MB1422A (DIP42 - DRAM Controller) - 51256-10 (x18) - MB89259A (SOP28) - Intel 80286-8 - Intel 80287-8 - MBL82288-8 (DIP10) - uPB8284 (DIP18) - 24MHz & 32MHz OSC's - 4 EPROMs - - A16B-2200-0160/07B : Graphic Board (3 ROMs on this board, 6082 001A, 600B 001D, 600B 002D. 600B is for Mill) - or - A16B-2200-0160/07B : Graphic Board (3 ROMs on this board, 6082 001A, 600A 001C, 600A 001D. 600A is for Lathe) - Fanuc FBI-A MB605111 (QFP100) - HD68HC000P10 (68000 @10MHz, PLCC68) - HM62256-10 (x2) - HM53461-12 (x3) - HD63484 (PLCC68) - HD6445 (PLCC44) - Fanuc GBC MB652147 (PGA135) - MB81464-12 (x12) - 20MHz OSC - 3 EPROMs. 6082 is common to both mills and lathes. - 600A is a known EPROM version required for lathes with FAPT conversational graphics. - 600B is unknown. Possibly for mills with FAPT. - - A20B-1003-0230/09C : Motherboard (dumb backplane, contains only slots) - A20B-1003-0500/01A : Additional Graphic Board for 15TTF only (for TT, connects to A16B-2200-0160 Board. No info on this PCB) - A20B-1003-0240/07B : Connector Assembly Unit / IO Board - A20B-1003-0580/01A : PMC Cassette C (16000 Step + Pascal 128KB, small PCB in a yellow plastic box, contains just 2 EPROMs) - - - Fanuc System 15A Base 1 Board A16B-2200-013 - - PCB Layout - ---------- - - A16B-2200-0131/03B (note 1 and 03B have been added/printed later) - |--------------| |---| - |------| CA34 |-----|CA4|-------------------------------------| - | |--------------|75463|---| LL LL MB81C79A| - | (x6) LL LL |--------| | - | HM53461(x5)|MB605117| | - | FA8191 | | | - |4040002E.M27 4040001E.M23 FA8191 | | | - | |--------| | - | | - | MC-122-41256A9A-12 |--------| | - |AB02142A.K27 AB02141A.K23 MC-122-41256A9A-12 |MB661128| | - | 9030001E.J18 | | | - | | | | - | |--------| | - |AB02102A.H27 AB02101A.H23 | - | | - | | - | | - |AB020C2A.F27 AB020C1A.F23 24MHz | - | | - | | - | |--------| | - |AB02082A.E27 AB02081A.E23 |------| |MB605111| | - | |68000 | | | | - | | | | | | - | |---------| | | |--------| | - | |---------| |------| | - | CNM1 |-----------------------| | - |------------------------------------------| CNA |--| - |-----------------------| - Notes: - MC-122-41256- NEC MC-122-41256A9A-12 256k RAM SIP module (with parity) containing NEC D41256L-12 32k x8 SRAM - 2 SIP modules populated, 9 chips per module, 18 total RAMs, total 512k - 68000 - Hitachi HD68HC000-12 68000 CPU. Clock 24/2 (PLCC68) - MB661128 - Fujitsu Fanuc SLC01 MB661128 (Serial Data Link Controller, PLCC68) - MB605117 - Fujitsu Fanuc BOC MB605117U (DRAM/SRAM Interface Controller, QFP100) - MB605111 - Fujitsu Fanuc FBI-A MB605111 (Global/Local Interface Controller, QFP100) - HM53461 - Hitachi HM53461-12 64k x4-bit multiport CMOS video RAM (x5, SOJ24) - MB81C79A - Fujitsu MB81C79A-35 8k x 9-bit (72k) CMOS Static RAM (SOP28) - FA8191 - Fanuc FA8191 RV07 custom ceramic module (contains resistors and transistors, SIL16) - 75463 - Texas Instruments SN75463 Dual High-Voltage, High-Current Peripheral Driver (DIP8) - L - LED - CA34 - Connector for PMC Cassette C A02B-0094-C103 (holds 2 EPROMs containing the PMC Ladder) - The Ladder is specific and unique to each CNC machine, depending on capability and options. - CA4 - Connector for cable joined to Servo Control Board A16B-2200-0090 or 16B-2200-0091 - CNA - Connector plugs into motherboard slot CNA2 (BASE 1) - CNM1 - 40 pin flat cable joined to optional board A16B-1600-0280/02A - - Note about EPROMs: - Software Series is denoted by the first 4 digits - ROM # (possibly relating to the memory location in hex) is the next 3 digits - Software Revision is the last letter - Both IC locations and ROM # are printed on this board - - ROM IC Memory EPROM Used - Label Location Location Type For... - ----------------------------------------------------------------------------------------- - 9030001E J18 381 27256 Digital Servo Control Program Version 9030 Revision E - - 4040001E M23 001 27C1001 PMC Control Program Version 4040 Revision E - 4040002E M27 002 27C1001 - - AB02081A E23 081 27C1001 Boot Software Version AB02 Revision A - AB02082A E27 082 27C1001 - AB020C1A F23 0C1 27C1001 - AB020C2A F27 0C2 27C1001 - AB02101A H23 101 27C1001 - AB02102A H27 102 27C1001 - AB02141A K23 141 27C1001 - AB02142A K27 142 27C1001 - - - Another identical board from a different machine contains the following EPROMs.... - 9030001F (known revisions exist up to at least rev M) - 4040001D, 4040002D (known revisions exist up to at least rev I) - A202081G, A202082G - A2020C1G, A2020C2G - A202101G, A202102G - - The complete boot software series is listed below: - - 15TA SOFTWARE SERIES (Single Turret 2 Axis Lathe) - |------+----+---------+---+---+---+---| - |S/W |STEP| CRT |I/O|SER|SER|DNC| - |SERIES| | | | | | | - | |1 2| 9M 14 9C|LNK|SPN|FB |1 2| - +------+----+---------+---+---+---+---+ - |A201 |X | X | | | | | - |A202 |X | X | | | | | - |A211 | X| X | X | X | |X | - |A212 | X| X | X | X | |X | - |A219 | X| X | X | X | X | | - |A220 | X| X | X | X | X | | - |A215 | X| X | X | X | | X| - |A216 | X| X | X | X | | X| - |A217 | X| X | X | X | X | X| - |A218 | X| X | X | X | X | X| - |A221 | X| X | X | X | ? | ?| - |------+----+---------+---+---+---+---| - Notes: - 9M - 9" Monochrome - 9C - 9" Color - 14 - 14" Color - SER SPN - Serial Spindle - SER FB - Serial FB ? - DNC 1/2 - DNC (Direct NC) type 1 or type 2 for Direct PC to CNC program transfer operation - - - 15TTA SOFTWARE SERIES (Twin Turret 4 Axis Lathe) - |------+----+---------+---+---+---+---| - |S/W |STEP| CRT |I/O|SER|SER|DNC| - |SERIES| | | | | | | - | |1 2| 9M 14 9C|LNK|SPN|FB |1 2| - +------+----+---------+---+---+---+---+ - |A401 |X | X | | | | | - |A402 |X | X | | | | | - |A411 | X| X | X | X | |X | - |A412 | X| X | X | X | |X | - |A419 | X| X | X | X | X | | - |A420 | X| X | X | X | X | | - |------+----+---------+---+---+---+---| - - - 15TTF SOFTWARE SERIES (Twin Turret 4 Axis Lathe with FAPT) - |------+----+---------+---+---+---+---| - |S/W |STEP| CRT |I/O|SER|SER|DNC| - |SERIES| | | | | | | - | |1 2| 9M 14 9C|LNK|SPN|FB |1 2| - +------+----+---------+---+---+---+---+ - |A502 |X | X | | | | | - |A512 | X| X | X | X | |X | - |A520 | X| X | X | X | X | | - |------+----+---------+---+---+---+---| - - - 15MA SOFTWARE SERIES (Mill With 3 Axes minimum XYZ) - |------+----+---------+---+---+---+---|---| - |S/W |STEP| CRT |I/O|SER|SER|DNC|SUB| - |SERIES| | | | | | | | - | |1 2| 9M 14 9C|LNK|SPN|FB |1 2|CPU| - +------+----+---------+---+---+---+---+---| - |A001 |X | X | | | | | | - |A002 |X | X | | | | | | - |A00A |X | X | | | | | | - |A00B |X | X | | | | | | - |AA01 |X | X | | | | | X | - |AA02 |X | X | | | | | X | - |A011 | X| X | X | X | |X | | - |A012 | X| X | X | X | |X | | - |AA11 | X| X | X | X | |X | X | - |AA12 | X| X | X | X | |X | X | - |A017 | X| X | X | X | X | X| | - |A018 | X| X | X | X | X | X| | - |A019 | X| X | X | X | X | | | - |A01A | X| X | X | X | |X | | - |A01B | X| X | X | X | |X | | - |A020 | X| X | X | X | X | | | - |A021 | X| X| X | X | X | ?| | - |A027 (NEW STANDARD) | | | | | | - |A028 (NEW STANDARD) | | | | | | - |A041 (FOR OSI ONLY) | | | | | | - |A042 (FOR OSI ONLY) | | | | | | - |AA19 | X| X | X | X | X | | X | - |AA20 | X| X | X | X | X | | X | - |AA13 | X| X | X | X | X | X| X | - |AA14 | X| X | X | X | X | X| X | - |AA23 | X| X | X | X | X | | X | - |AA24 | X| X | X | X | X | | X | - |AA26 | X| X | X | X | X | ?| X | - |AA27 (NEW STD) | | | | | | - |AA28 (NEW STD) | | | | | | - |AA41 (FOR OSI ONLY) | | | | | | - |AA42 (FOR OSI ONLY) | | | | | | - |---------------------+---+---+---+---+---| - - - Optional PCB A16B-1600-0280/02A - ------------------------------- - - |---------------------------| - | 181 182 | - | | - | | - | | - | 1C1 1C2 | - | | - | | - | | - | 201 202 | - | | - | | - | | - | 241 242 | - | | - | | - | | - | 281 282 | - | | - | | - | | - | 2C1 2C2 | - | | - | | - | |---------| | - | |---------| | - | CNM1 | - |---------------------------| - Notes: - The A16B-1600-0280/02A board contains only 12 DIP32 sockets and some logic and - bolts to the back of the BASE 1 board. The board extends the boot software memory - storage space if additional EPROMS are required. Not all sockets are populated. - Connector CNM1 joins with a 40 pin flat cable to the BASE 1 board connector CNM1 - IC locations are not printed on this board. Only the ROM # is printed at each - socket location. - - ROM IC Memory EPROM Used For - Label Location Location Type - --------------------------------------------------------------------------------- - AB02281A N/A 281 27C1001 Boot Software Version AB02 Revision A - AB02282A N/A 282 27C1001 - AB022C1A N/A 2C1 27C1001 - AB022C2A N/A 2C2 27C1001 - - - 15A EPROM population and option type - ----------------+---------+------------------------------------------- - PCB NAME |ROM # | Option Type (Basic, Option A1/A2/A3 etc) - ----------------|---------+------------------------------------------- - BASE 1 main |081, 082 | B - BASE 1 main |0C1, 0C2 | B - BASE 1 main |101, 102 | A1 if step1 software, B if step2 software - BASE 1 main |141, 142 | A2 (only used for foreign language option) - BASE 1 daughter |181, 182 | A3 (if used) - BASE 1 daughter |1C1, 1C2 | not used - BASE 1 daughter |201, 202 | not used - BASE 1 daughter |241, 242 | A6 (if used) - BASE 1 daughter |281, 282 | B when subcpu used - BASE 1 daughter |2C1, 2C2 | B when subcpu used - --------------------------+------------------------------------------- - Note: 2 MEG DRAM is required on BASE2 PCB when A3 or A6 is used - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "cpu/i86/i286.h" - -class fanucs15_state : public driver_device -{ -public: - fanucs15_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") // main 68020 - , m_pmccpu(*this, "pmccpu") // sub 68000-12 - , m_gfxcpu(*this, "gfxcpu") // gfx 68000-10 - , m_convcpu(*this, "convcpu") // conversational 80286-8 - { } - - required_device m_maincpu; - required_device m_pmccpu; - required_device m_gfxcpu; - required_device m_convcpu; - -private: - virtual void machine_reset(); -}; - -static ADDRESS_MAP_START(maincpu_mem, AS_PROGRAM, 32, fanucs15_state) - AM_RANGE(0x00000000, 0x0017ffff) AM_ROM AM_REGION("base1b", 0) - AM_RANGE(0x000f8000, 0x000fffff) AM_RAM // filled with 0x96 on boot - AM_RANGE(0xffff0000, 0xffffffff) AM_RAM // initial stack -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pmccpu_mem, AS_PROGRAM, 16, fanucs15_state) - AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_REGION("base1a", 0) - AM_RANGE(0xfde000, 0xffffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(gfxcpu_mem, AS_PROGRAM, 16, fanucs15_state) - AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("gfxboard", 0) - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(convcpu_mem, AS_PROGRAM, 16, fanucs15_state) - AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_REGION("conversational", 0x40000) - AM_RANGE(0x040000, 0x07ffff) AM_ROM AM_REGION("conversational", 0) - AM_RANGE(0x800000, 0x87ffff) AM_RAM - AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("conversational", 0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( fanucs15 ) -INPUT_PORTS_END - -void fanucs15_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( fanucs15, fanucs15_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68020, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(maincpu_mem) - MCFG_DEVICE_DISABLE() - - MCFG_CPU_ADD("pmccpu", M68000, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(pmccpu_mem) - MCFG_DEVICE_DISABLE() - - MCFG_CPU_ADD("gfxcpu", M68000, XTAL_10MHz) // wants bit 15 of 70500 to be set - MCFG_CPU_PROGRAM_MAP(gfxcpu_mem) - MCFG_DEVICE_DISABLE() - - MCFG_CPU_ADD("convcpu", I80286, XTAL_8MHz) // wants 70500 to return 0x8000 (same as what gfxcpu looks for, basically) - MCFG_CPU_PROGRAM_MAP(convcpu_mem) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( fanucs15 ) - ROM_REGION16_BE( 0x50000, "base1a", 0 ) // 68000 sub CPU code and data on base 1 board (verified) - ROM_LOAD16_BYTE( "4040_001e_001.23m", 0x000001, 0x020000, CRC(2e12109f) SHA1(83ed846d3d59ab0d81b2e2e2231d1a444e462590) ) - ROM_LOAD16_BYTE( "4040_002e_002.27m", 0x000000, 0x020000, CRC(a5469692) SHA1(31c44edb36fb69d3d418a97e32e4a2769d1ec9e7) ) - ROM_LOAD16_BYTE( "9030_001e_381.18j", 0x040001, 0x008000, CRC(9f10a022) SHA1(dc4a242f7611143cc2d9564993fd5fa52f0ac13a) ) - - ROM_REGION32_BE( 0x180000, "base1b", 0 ) // 68020 main CPU code and data on base 1 board (verified) - ROM_LOAD16_BYTE( "ab02_081a_081.23e", 0x000001, 0x020000, CRC(5328b023) SHA1(661f2908f3287f7cd2b215cd29962f2789f7d99a) ) - ROM_LOAD16_BYTE( "ab02_082a_082.27e", 0x000000, 0x020000, CRC(ad37740f) SHA1(e65cc0a8b4e515fcf5fcefde99e95d100d310018) ) - ROM_LOAD16_BYTE( "ab02_0c1a_0c1.23f", 0x040001, 0x020000, CRC(62566569) SHA1(dd85b6e7875d996759b833552b00e1b3a0e3696b) ) - ROM_LOAD16_BYTE( "ab02_0c2a_0c2.27f", 0x040000, 0x020000, CRC(a4ade1fe) SHA1(44ef5358b34d3538fb061f235b8a14bac6b5faa8) ) - ROM_LOAD16_BYTE( "ab02_101a_101.23h", 0x080001, 0x020000, CRC(96f5d00e) SHA1(f5de3621df536435d27a0aac1c9d25e69601bd40) ) - ROM_LOAD16_BYTE( "ab02_102a_102.27h", 0x080000, 0x020000, CRC(e23a5414) SHA1(f6aff51dfd6d976b7cd33399c7aa3d06c7c06919) ) - ROM_LOAD16_BYTE( "ab02_141a_141.23k", 0x0c0001, 0x020000, CRC(3ceb6809) SHA1(7e37b18847b35f81c08b7b2ab62e99fa3a737c32) ) - ROM_LOAD16_BYTE( "ab02_142a_142.27k", 0x0c0000, 0x020000, CRC(1d8a4d7d) SHA1(580322e2927742bbcbf0bb2757730e2817b320e1) ) - // this appears to be a different version of the 081a/0c1a ROM program. it's definitely for a 68020 (32-bit pointers everywhere) - ROM_LOAD16_BYTE( "ab02_281a_281.8a", 0x100001, 0x020000, CRC(cec79742) SHA1(1233ff920d607206a80c8d187745e3d657a8635d) ) - ROM_LOAD16_BYTE( "ab02_282a_282.8d", 0x100000, 0x020000, CRC(63eacc0e) SHA1(1f25b99280112c720d778219b4610f556f33a7f1) ) - ROM_LOAD16_BYTE( "ab02_2c1a_2c1.10a", 0x140001, 0x020000, CRC(66eb74dd) SHA1(f256763cb15b4524c09bd09b88df46a1498846ef) ) - ROM_LOAD16_BYTE( "ab02_2c2a_2c2.10d", 0x140000, 0x020000, CRC(6edf4ff3) SHA1(9cbf7c6555cc27def3b580f5a7b0ff580984206d) ) - - ROM_REGION16_LE( 0x80000, "conversational", 0 ) // 80286 ROMs, 5a00 for Mill - ROM_LOAD16_BYTE( "5a00_041b.041", 0x000000, 0x020000, CRC(bf22c0a3) SHA1(56ab70bfd5794cb4db1d87c8becf7af522687564) ) - ROM_LOAD16_BYTE( "5a00_042b.042", 0x000001, 0x020000, CRC(7abc9d6b) SHA1(5cb6ad08ce93aa99391d1ce46ac8db8ba2e0f94a) ) - ROM_LOAD16_BYTE( "5a00_001b.001", 0x040000, 0x020000, CRC(cd2a2839) SHA1(bc20fd9ae9d071e1df835244aea85648d1bd1dbc) ) - ROM_LOAD16_BYTE( "5a00_002b.002", 0x040001, 0x020000, CRC(d9ebbb4a) SHA1(9c3d96e9b88848472210beacdf9d300ddd42d16e) ) - - ROM_REGION16_BE( 0x50000, "gfxboard", 0 ) // graphics board 68000 code/data. 600a for lathe, 600b for mill, 6082 common to both - ROM_LOAD16_BYTE( "600b_001d_low.3l", 0x000001, 0x010000, CRC(50566c5c) SHA1(966c8d90d09a9c50c5dedebe9c67f1755846b234) ) - ROM_LOAD16_BYTE( "600b_002d_high.3j", 0x000000, 0x010000, CRC(304e1ecb) SHA1(1e4b149b306550750fc03bd80bd399f239f68657) ) - ROM_LOAD16_BYTE( "600a_001c.bin", 0x020001, 0x010000, CRC(63d9fc2f) SHA1(280e825ba7b79e7c38282a4f4b762d2219fd873b) ) - ROM_LOAD16_BYTE( "600a_002c.bin", 0x020000, 0x010000, CRC(4d78e702) SHA1(a89bd07dc1ae030bdee5a541777825eaadbc2307) ) - // font or tilemap data? - ROM_LOAD( "6082_001a_cg.12b", 0x040000, 0x010000, CRC(f3d10cf9) SHA1(bc5bc88dcb5f347e1442aa4a0897747958a53413) ) - - ROM_REGION16_BE( 0x40000, "cassette", 0 ) // "PMC Cassette C", ROM cartridge that plugs into the Base 1 board - ROM_LOAD16_BYTE( "pmc_high.a2", 0x000000, 0x020000, CRC(7b8f9a96) SHA1(08d828b612c45bb3f2f7a56df418cd8e34731bf4) ) - ROM_LOAD16_BYTE( "pmc_low.a1", 0x000001, 0x020000, CRC(3ab261f8) SHA1(20b7eef96deb91a3a867f9ac4165b0c188fbcff3) ) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1990, fanucs15, 0, 0, fanucs15, fanucs15, driver_device, 0, "Fanuc", "System 15", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/fanucspmg.c b/src/mess/drivers/fanucspmg.c deleted file mode 100644 index 9b40227094b..00000000000 --- a/src/mess/drivers/fanucspmg.c +++ /dev/null @@ -1,1011 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - -Fanuc System P-Model G -Fanuc 1983 - -2014-03-22 Skeleton driver. -This is a machine from 1983 in a single case -with a lot of ports and a unique keyboard. - -Also known as Fanuc P-G System, this is a dedicated 8085+8086+8087-based computer -system running software for CNC Programming. -The system boots up from on-board EPROM and shows a big ASCII-art boot screen -FANUC SYSTEM P and the ROM software version in the lower right corner. -To initiate booting from the floppy drive hold down the LOAD key for 3-5 seconds. -The system checks for a long LOAD key press so that it doesn't load software -if the LOAD key is accidentally pressed quickly while using the system, which would -erase everything in memory and all data up to that point and re-load the software from -scratch. When loading is activated application software is read from floppies. - -The softwares are not point and click auto-generation type conversational CAD/CAM -applications. The earlier 'non-Symbolic' software requires knowledge of programming in APT -and other languages of the era. The 'Symbolic' software has menus and asks questions and -the blanks must be filled in correctly. The graphics are mostly made of lines but are -sufficient to complete the task easily. Efficient and effective use of this system -requires deep knowledge of CNC Machining techniques (Turning/Milling etc) and a -good understanding of machining processes and procedures. With correct usage this system -can be used to create CNC G-Code programs for any part that can be manufactured on a -CNC Machine. Because the system is made in Japan in the early 80's and the manuals are -very technical it also requires some skill in deciphering Japanese-English translated -technical texts to understand how to use it properly. - -The box housing everything is 20" wide by 20" deep by 12" high and weighs -approximately 40 pounds. Power input is 85VAC to 110VAC. For the non-US and -non-Japanese markets a separate dedicated power supply is provided and is 12" -wide by 8" deep by 10" high and weighs approximately 20 pounds. - -A number of optional peripherals can connect to it including a Fanuc Printer, -Fanuc PPR Unit (Paper tape Puncher/Reader with built-in printer), Fanuc Program -File (containing a 20MB HDD, two 8" floppy drives and two RS232 ports), Fanuc Cassette -Adapter, XY Plotter (A3 or A1), Fanuc Digitizing Tablet (A3 or A0) and Fanuc I/O Selector Box. - -The P-G System has an internal 12" monitor and dual 5 1/4" floppy drives. -The first model had a 12" monochrome green monitor. In 1985 a color version was released. -In 1986 another model was released called the Mark II using dual 3 1/2" floppy drives. - -The screen resolution is 512 x 384 pixels. It can display 64 characters x 24 lines. - -The floppy format is custom. Floppies are double sided double density and -regular PC DSDD 360k floppies can be used after they are formatted using the -P-G System. -The floppy geometry is 40 tracks, 16 sectors per track, 256 bytes per sector -and 2 sides for a total storage capacity of 327680 bytes. -The floppy drives are typical PC-type 5 1/4" 360k drives and were manufactured -by Y-E DATA, model YD-580. - -The 5 1/4" floppy disks can be backed-up and imaged using a DOS program called ImageDisk -which is available here..... -http://www.classiccmp.org/dunfield/img/index.htm -With a 5 1/4" HD floppy drive, in the GUI in settings change the number of -cylinders to 40, translate speed 300 -> 250 (to read a DD disk on a HD drive). -On the main menu press R to Read, type a file-name and press enter, press enter -again to skip the comment. Press enter again and it will read the disk and save -it to the HDD. - -The following is a complete list of software titles available. -The info is taken from a glossy sales brochure printed in July 1985. -Other versions probably exist so this list is not final. -* denotes it is dumped. All other titles are not dumped and are needed. - -Language Input - - - Title Part Number - -------------------------------- - FAPT TURN A08B-0033-J600#E - FAPT CUT A08B-0033-J620#E - FAPT MILL A08B-0033-J640#E - FAPT DIE-II A08B-0033-J660#E - FAPT PUNCH-I A08B-0033-J520#E - FAPT PUNCH-II A08B-0033-J700#E - FAPT HELICAL A08B-0033-J642#E - FAPT POST A08B-0033-H642#E - *FAPT POST A08B-0031-H630 Edition C 85/1/31 - - -Graphic Input - - - Title Part Number - -------------------------------------- - *Symbolic FAPT TURN A08B-0033-J800#E Edition B V02 L03 841116 - Symbolic FAPT MILL A08B-0033-J840#E - Symbolic FAPT DRILL A08B-0033-J860#E - Symbolic FAPT CUT A08B-0033-J820#E - FAPT DIGITIZER A08B-0033-J510#E - -+ Symbolic FAPT TURN was available in English, German, French, Dutch, Finnish, -and Swedish versions. Currently only the English version is archived. - - -Support System - - - Title Part Number - ------------------------------- - *FAPT TRACER A08B-0033-H620#E Edition B V02 L02 841108 - *FAPT TEACHER A08B-0033-J610#E Edition B L02 V01 841101 - *FAPT DOCTOR A08B-0033-J600#E Edition B V01 L03 841108 - - -The software listed above with (*) have been tested on both mono and color versions and works fine. -Note: To initiate booting from the floppy drive hold down the LOAD key for 3-5 seconds. - -The software for the Fanuc System P-Model G is extremely rare now and very difficult to find. -If you do have any of these wanted software titles or any manuals listed below and want to help -please contact me (Guru) via http://mamedev.org/contact.html - -The following is a complete list of manuals available for the first edition of the -Fanuc System P-Model G released in 1983. The info is taken from a glossy sales brochure -printed in July 1985. There were other manuals released later for the Mark II and -updated manuals (each with a different part number). -The manuals were available in Japanese and English. The part numbers listed here -are English versions, denoted by the E at the end of the part number. -* denotes these manuals are secured and available in PDF format. - -Description - - - Title Part Number - --------------------------------------- - FAPT TURN/MILL Description B-54102E - FAPT CUT Description B-54103E - FAPT PUNCH-I Description B-54104E - FAPT TRACER Description B-54106E - FAPT DIGITIZER Description B-54107E - FAPT DIE-II Description B-54121E - Symbolic FAPT Description B-54131E - - -Operator's Manual - - - Title Part Number - ---------------------------------------------------------- - *System P-Model G Operator's Manual B-54111E/03 - System P-Model G Mark II Operator's Manual B-66014E - *System P-Model G Operator's Manual Supplement B-54112E/03-1 - FAPT TURN/MILL Operator's Manual B-54112E - FAPT CUT Operator's Manual B-54113E - FAPT PUNCH-I Operator's Manual B-54114E - FAPT PUNCH-II Operator's Manual B-54115E - *FAPT TRACER Operator's Manual B-54116E/03 - FAPT DIGITIZER Operator's Manual B-54117E - *FAPT Universal POST Operator's Manual B-54118E/02 - FAPT DIE-II Operator's Manual (Volume 1) B-54122E - FAPT DIE-II Operator's Manual (Volume 2) B-54122E-1 - *FAPT TEACHER Operator's Manual B-54126E/01 - 220S FAPT MILL Operator's Manual B-54127E - *Symbolic FAPT TURN Operator's Manual B-54132E/01 - Symbolic FAPT MILL Operator's Manual B-54134E - Symbolic FAPT CUT Operator's Manual B-54136E - Symbolic FAPT DRILL Operator's Manual B-54138E - *Symbolic FAPT TURN Operator's Manual B-66025E/01 (for System P Mark II) - - -Others - - - Title Part Number - ----------------------------------------------------- - *Symbolic FAPT TURN Operator's Handbook B-53034E (for System P Model D) - FANUC CASSETTE Operator's Manual B-53484E - FAPT DIE-II Part program examples B-54123E - FAPT TURN/MILL/CUT Part program examples B-54128E - Symbolic FAPT TURN Operator's Handbook B-54133E - System P-Model G Operator's Handbook B-54158E - *System P-Model G Maintenance Manual B-54159E/01 - *FANUC PPR Operator's Manual B-54584E/01 - -Note the handbooks are pocket-sized 8" long by 3 1/2" wide and approximately 50 pages. - - -The unit has it's own dedicated keyboard with many special keys. -The keyboard clips to the main box and is the top cover when the main box is transported. -The keyboard layout is shown below. - -|------------------------------------------------------------------------------| -| | -| LOAD F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 R0 R1 R2 R3 | -| | -| | -| ! " # $ % & ' ( ) = | -| K0 1 2 3 4 5 6 7 8 9 0 - ^ Y DEL 7 8 9 + | (Y is Japanese Yen sign) -| | -| | -| K1 CAN Q W E R T Y U I O P @ [ NL BS 4 5 6 - | (NL means NEXT LINE, BS is backspace) -| | (NL is equivalent to return or enter and) -| + * | (forces the cursor to move to the next data entry point) -| K2 UC A S D F G H J K L ; : ] UC 1 2 3 x | (UC is uppercase) -| | -| < > ? | -| K3 LC Z X C V B N M , . / - LC 0 , . / | (LC is lowercase) -| | -| | -| _S__P__A__C__E__B__A__R_ _N__L_ | -| | -|------------------------------------------------------------------------------| - -On the numeric keypad there are directional arrows on numbers 1 2 3 4 6 7 8 9 -1 3 7 9 have arrows pointing South West, South East, North West, North East. -2 4 6 8 have arrows pointing down, left, right and up. -5 is the center and has no additional markings on it. -Number 0 has an anti-clockwise 180 degrees arc with an arrow at the end and . has -a clockwise 180 degrees arc with an arrow at the end. -These keys are the 'Symbolic' keys. - -The F-keys and R-keys are programmed by the software that is running on the system. -The F-keys act like SPDT switches and can be toggled either off or on. -When they are on, a LED in the center of the key lights. -For Symbolic FAPT TURN these keys are pre-programmed as follows..... - -F0 - ON: Sets the backwards direction when using the R1 key. - OFF: Sets the forwards direction when using the R1 key. Default is OFF. -F1 - ON: Makes the whole screen the graphic area. - OFF: Auto-calc the graphic area so the graphic does not overlap the text. Default is OFF. -F2 - ON: Shows the parts figure (graphics). Default is ON. - OFF: Does not show the parts figure. -F3 - ON: Display the NC G-Code data on screen. Default is ON. - OFF: Does not display the NC G-Code data on screen. -F4 - ON: Printer ON. - OFF: Printer OFF. The printer can be switched on or off any time. When enabled - everything displayed on the screen will also print on the printer. Default is OFF. -F5 - ON: Stops execution of the NC G-Code data before each process begins. Keyboard input additions - can also be done at this time. To continue press NL. - OFF: Program execution continues to the end. Default is OFF. -F6 - ON: Outputs the NC G-Code data to a separately selected medium (floppy/cassette or paper tape) - OFF: No output to additional medium. Default is OFF. -F7 - ON: Stops each time a line of NC G-Code data is output. This is equivalent to Single Block on a CNC Machine. - To continue press NL. - OFF: Program execution continues to the end. Default is OFF. -F8 - -F9 - -F10- ON: Sends the part figure graphic and NC G-Code data to the XY plotter - OFF: No output to XY plotter -F11- -F12- -F13- -F14- -F15- - -The function of the R-keys changes depending on the application and the menu shown on the screen. -The R-keys are used for tasks within the current screen so the function of the R-keys is always -displayed on screen at all times. -The initial Symbolic FAPT TURN settings for the R-keys are.... -R0 - FAPT Execution -R1 - Family Program -R2 - Setting -R3 - Auxiliary Work - - -Box Layout (top view) ----------- - -A08B-0033-B001 (Color Version from 1985) -A08B-0031-B001 (Mono Version from 1983) -A08B-0031-B002 (Mono Version from 1984) -|--------------------------------------------| -| ------------MAIN PCB---------------------- | -| -----------SUB-PCB----------- | | -| | | -| |-----------------------| | | -| | | | | -| | FANUC 12" COLOR | P | -| | CRT UNIT | O | -| | A61L-0001-0078 | W | -| | | E | -| | | |---------| R | -| | | |FANUC | | | -| | OR | |FDD UNIT | P | -| | | |A87l-0001| C | -| | | |-0026 | B | -| | FANUC 12" MONO | | | | | -| | CRT UNIT | |5 1/4" | | | -| | A61L-0001-0073 | |FLOPPY | | -| | | |DRIVES | | -| | | |x2 | | -| |-----------------------| |---------| | -|--------------------------------------------| -Notes: - The CRT tube in the color version is a Matsushita 320DHB22. Input voltage is 110V AC - The CRT tube in the mono version is a Hitachi 310KEB31. Input voltage is 24V DC and B+ is 11.0V - The mono version does not have a SUB PCB - The power PCB is identical for both color and mono versions - - -Main PCB Layout (for color version) ---------------- - -A20B-1000-0710/03B -|-------------------------------------------| -| CNF CNE CND CNC CNB CNA | -| VR1 ^ | -| JUMPERS XXXXXXXXX| -| % MB15541 XXXXXXXXXXXXXXXXXX| -| XXXXXXXXXXXXXXXXXX| -| 8087-3 D8253 XXXXXXXXXXXXXXXXXX| -| 8086-2 D765 D8253 XXXXXXXXX| -| D8257 | -|15MHz D8259 D8259 D8251 D8251 | -|D8284 040_001A.13A D8251 D8251 | -| 040_002A.15A VR2 CN2 CN1 | -| CN7 CN6 CN5 CN4 CN3 | -|-------------------------------------------| -Notes: - D8086 - Intel 8086-2 CPU. Clock input 5.000MHz [15/3] - D8087 - Intel 8087-3 x87 Floating-Point Co-Processor. Clock input 5.000MHz [15/3] - XXXXXXX - Fujitsu MB8265-15 65536 x1-bit DRAM (72 chips total) - MB15541 - Fujitsu MB15541 Custom Chip - D765 - NEC D765 Single/Double Density Floppy-Disk Controller. Clock input 4.000MHz [16/4] - D8251 - Intel D8251 Programmable Communications Interface (USART) - D8253 - NEC D8253 Programmable Interval Timer. Clock input 1.25MHz [15/12] - D8257 - NEC D8257 Programmable DMA Controller. Clock input 3.000MHz [15/5] - D8259 - NEC D8259 Programmable Interrupt Controller - D8284 - Intel D8284 Clock Generator and Driver for 8086/8088 Processors - A40_00* - Fujitsu MBM2764 8k x8-bit EPROM - VR1 - Potentiometer to adjust pulse width of floppy disk control unit - VR2 - Potentiometer to adjust screen brightness - ^ - 3 chips marked Y-E Data Fujitsu - MB4393 - MB14324 - MB14323 - % - Unknown 20-pin Ceramic DIP chip with heat-sink (likely to be Intel 8288 Bus Controller) - CNA - 50-pin flat cable joining to Sub PCB - CNB - 50-pin flat cable joining to Sub PCB - CNC - 6-pin power cable joining to Sub PCB - CND - 34-pin flat cable joining to FDD Unit - CNE - Fanuc Honda MR-50 50-pin female connector for factory testing (not used) - CNF - Power input connector - CN1 - 25-pin Female D-type connector. (for RS232 external peripherals \ CNC Machine, - CN2 - 25-pin Female D-type connector. (for RS232 external peripherals | PPR Unit, X-Y Plotter, - CN3 - 25-pin Female D-type connector. (for RS232 external peripherals | Tablet, - CN4 - 25-pin Female D-type connector. (for RS232 external peripherals / Cassette Adapter etc (connections in any order) - CN5 - Fanuc Honda MR-50 50-pin female connector (probably for external connection of the Fanuc Program File Unit) - CN6 - Fanuc Honda MR-20 20-pin female connector for the keyboard - CN7 - Fanuc Honda MR-20 20-pin male connector. Specification says 'not used'. Video signals are present on - the connector so it is probably used for an external monitor - JUMPERS - 15 2-pin jumpers labelled S1 to S15. S2, S3 & S4 are open and the others are shorted - - -Sub PCB Layout (for color version) --------------- - -A20B-1000-0720/02B -|--------------------------------| -| CNA CNB CNC CND | -| | -| MB15542 CNE| -| | -| HD6845S D8085| -| 16MHz | -| | -| X | -| XXXXXXXX | -| XXXXXXXX | -| XXXXXXXX 6264 A41_010B.28B| -| 6264 A41_020A.30B| -|--------------------------------| -Notes: - D8085 - NEC D8085A-2 CPU. Clock input 8.000MHz [16/2] - Note 8085 has internal /2 divider so actual clock speed is 4.000MHz - HD6845S - Hitachi HD6845S / HD46505S CRT Controller. Clock input 2.000MHz [16/8] - 6264 - Hitachi HM6264P-15 8k x 8-bit SRAM - XXXXXXX - Fujitsu MB8265-15 65536 x1-bit DRAM (25 chips total) - MB15542 - Fujitsu MB15542 Custom Chip - A41_010B- Intel D27128 16k x8-bit EPROM - A42_020A- Hitachi 27256G 32k x8-bit EPROM - CNA - 50-pin flat cable joining to Main PCB - CNB - 50-pin flat cable joining to Main PCB - CNC - 6-pin power cable joining to Main PCB - CND - 20-pin flat cable joining to CRT Unit (video output) - CNE - Fanuc Honda MR-50 50-pin male connector for factory testing (not used) - HSync - 22.7273kHz - VSync - 54.6330Hz - - -Main PCB Layout (for mono version) ---------------- - -A20B-1000-0140/09F -|-------------------------------------------| -| CN10 CN9 VR1 CN8 | -| 6116 S3 ^ | -| A22_020B.5G % D765 XXXXXXXXX| -| 16MHz MB15542 MB15541 D8257 XXXXXXXXX| -| S4 15MHz D8284 XXXXXXXXX| -| 8085-2 HD6845S 8087 D8259 XXXXXXXXX| -| CN12 A21_010F.17D 8086 D8253 A25_001A.33E| -| CN11 S2 A25_002A.35E | -| S1 D8251 D8251 D39 | -| D8251 D8251 S5 S6 S7| -| YYYYYYYYY VR2 D8253 CN2 CN1 | -| CN7 CN6 CN5 CN4 CN3 | -|-------------------------------------------| -Notes: - D8086 - Intel 8086-2 CPU. Clock input 5.000MHz [15/3] - D8087 - Intel 8087-3 x87 Floating-Point Co-Processor. Clock input 5.000MHz [15/3] - D8085 - NEC D8085A-2 CPU. Clock input 8.000MHz [16/2] - Note 8085 has internal /2 divider so actual clock speed is 4.000MHz - HD6845S - Hitachi HD6845S / HD46505S CRT Controller. Clock input 2.000MHz [16/8] - XXXXXXX - Fujitsu MB8265-15 65536 x1-bit DRAM (36 chips total) - YYYYYYY - Fujitsu MB8265-15 65536 x1-bit DRAM (9 chips total) - 6116 - Hitachi HM6116P-3 2k x 8-bit SRAM - MB15541 - Fujitsu MB15541 Custom Chip - MB15542 - Fujitsu MB15542 Custom Chip - D765 - NEC D765 Single/Double Density Floppy-Disk Controller. Clock input 4.000MHz [16/4] - D8251 - Intel D8251 Programmable Communications Interface (USART) - D8253 - NEC D8253 Programmable Interval Timer. Clock input 1.25MHz [15/12] - D8257 - NEC D8257 Programmable DMA Controller. Clock input 3.000MHz [15/5] - D8259 - NEC D8259 Programmable Interrupt Controller - D8284 - Intel D8284 Clock Generator and Driver for 8086/8088 Processors - A2* - Hitachi HN482764G 8k x8-bit EPROM - VR1 - Potentiometer to adjust pulse width of floppy disk control unit - VR2 - Potentiometer to adjust screen brightness - ^ - 3 chips marked Y-E Data Fujitsu - MB4393 - MB14324 - MB14323 - % - Unknown 20-pin Ceramic DIP chip with heat-sink (likely to be Intel 8288 Bus Controller) - CN1 - 25-pin Female D-type connector. (for RS232 external peripherals \ CNC Machine, - CN2 - 25-pin Female D-type connector. (for RS232 external peripherals | PPR Unit, X-Y Plotter, - CN3 - 25-pin Female D-type connector. (for RS232 external peripherals | Tablet, - CN4 - 25-pin Female D-type connector. (for RS232 external peripherals / Cassette Adapter etc (connections in any order) - CN5 - Fanuc Honda MR-50 50-pin female connector (probably for external connection of the Fanuc Program File Unit) - CN6 - Fanuc Honda MR-20 20-pin female connector for the keyboard - CN7 - Fanuc Honda MR-20 20-pin male. Specification says 'not used' and no signals are present on the connector - CN8 - 20-pin flat cable joining to CRT Unit (video output) - CN9 - 34-pin flat cable joining to FDD Unit - CN10 - Power input connector - CN11/12 - Fanuc Honda MR-50 50-pin female connector for factory testing (not used) - Sx - 7 2-pin jumpers (S1 to S7). S2, S3 & S4 are open and the others are shorted - D39 - Bank of 8 2-pin jumpers vertically orientated. 2 and 7 are shorted and the others are open - - -Block Diagram -------------- -Below is the block diagram shown in the System P-Model G Maintenance Manual, relating to the mono version. -The arrows denote direction of data flow. - - |-------| |--------| |----------------| - |Sub CPU| |Main CPU|<---->|Math Coprocessor| - |-------| |--------| |----------------| - /\ /\ /\ - | | | - | \/ \/ - |-----| | |------------------| - |EPROM|<--->| /\ - |-----| | |---------------| | |----------------| - | | Common memory |<---------------------------------->|<--->|RS232C interface|---CN1 - |<-------->|===============| | |----------------| - | /-->| Graphic memory|------| | - | | |---------------| | | |----------------| - | | | |--------| |<--->|RS232C interface|---CN2 - | | | | BOOT |<-------->| |----------------| - | | | | EPROM | | - | | |----------------| | |--------| | |----------------| - |<-----|-->|Character memory|--| | |<--->|RS232C interface|---CN3 - | |-->|----------------| | | |--------| | |----------------| - | | | | |Main RAM|<-------->| - | | | | |--------| | |----------------| - | | | | |<--->|RS232C interface|---CN4 - | | | | | |----------------| -|---------| | | \/ \/ | -|Keyboard | \/ \---|---------------------------| | |-----------------| CN9 |--------| -|interface|<->|<-------->| CRT control circuit | |<--->|Floppy controller|---O---|FDD UNIT| -|----|----| |-------------|-------------| | |-----------------| |--------| - | | | - | | \/ - O CN6 O CN8 O CN5 - | | - | | - |---|----| |----|----| - |Keyboard| | Screen | - |--------| |---------| - - TODO: - - Is the VRAM hookup anything like correct? - - Hookup enough keyboard to get it to boot a floppy, the FAPT DOCTOR - program will be invaluable to answering many questions. - - Shared RAM is 8k, but there are 2 6264s on the sub board. Is shared RAM - banked? - - To boot a floppy put "bp fc5fa,1,{ip=c682;g}" and "bp fc6d7,1,{ip=c755;g}" - into the debugger. - - At NMI: f8008 must have bit 7 clear and bit 6 set (e008 on 8085) - f8009 must not equal 0x01 (e009 on 8085) - - 8085 sets f8008 to keyboard row 0 AND 0xf3 - " " f8009 to keyboard row 1 - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "cpu/i8085/i8085.h" -#include "machine/ram.h" -#include "machine/i8251.h" -#include "machine/i8257.h" -#include "machine/upd765.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/upd765.h" -#include "video/mc6845.h" -#include "formats/imd_dsk.h" - -#define MAINCPU_TAG "maincpu" -#define SUBCPU_TAG "subcpu" -#define USART0_TAG "usart0" -#define USART1_TAG "usart1" -#define USART2_TAG "usart2" -#define USART3_TAG "usart3" -#define PIT0_TAG "pit0" -#define PIT1_TAG "pit1" -#define PIC0_TAG "pic0" -#define PIC1_TAG "pic1" -#define DMAC_TAG "dmac" -#define CRTC_TAG "crtc" -#define FDC_TAG "fdc" -#define SCREEN_TAG "screen" -#define SHARED_TAG "shared" -#define CHARGEN_TAG "chargen" - -class fanucspmg_state : public driver_device -{ -public: - fanucspmg_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, MAINCPU_TAG) - , m_subcpu(*this, SUBCPU_TAG) - , m_usart0(*this, USART0_TAG) - , m_usart1(*this, USART1_TAG) - , m_usart2(*this, USART2_TAG) - , m_usart3(*this, USART3_TAG) - , m_pit0(*this, PIT0_TAG) - , m_pit1(*this, PIT1_TAG) - , m_pic0(*this, PIC0_TAG) - , m_pic1(*this, PIC1_TAG) - , m_dmac(*this, DMAC_TAG) - , m_crtc(*this, CRTC_TAG) - , m_fdc(*this, FDC_TAG) - , m_shared(*this, SHARED_TAG) - , m_chargen(*this, CHARGEN_TAG) - { } - - required_device m_maincpu; - required_device m_subcpu; - required_device m_usart0; - required_device m_usart1; - required_device m_usart2; - required_device m_usart3; - required_device m_pit0; - required_device m_pit1; - required_device m_pic0; - required_device m_pic1; - required_device m_dmac; - required_device m_crtc; - required_device m_fdc; - required_shared_ptr m_shared; - required_memory_region m_chargen; - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(shared_r); - DECLARE_WRITE8_MEMBER(shared_w); - DECLARE_READ8_MEMBER(vram1_r); - DECLARE_WRITE8_MEMBER(vram1_w); - DECLARE_READ8_MEMBER(vram2_r); - DECLARE_WRITE8_MEMBER(vram2_w); - DECLARE_WRITE8_MEMBER(vram_bank_w); - DECLARE_READ8_MEMBER(vblank_ack_r); - DECLARE_WRITE8_MEMBER(vbl_ctrl_w); - DECLARE_WRITE8_MEMBER(keyboard_row_w); - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(video_ctrl_w); - DECLARE_READ8_MEMBER(fdcdma_r); - DECLARE_WRITE8_MEMBER(fdcdma_w); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE8_MEMBER(dma_page_w); - - DECLARE_READ16_MEMBER(magic_r); - - DECLARE_WRITE_LINE_MEMBER(vsync_w); - DECLARE_WRITE_LINE_MEMBER(tc_w); - DECLARE_WRITE_LINE_MEMBER(hrq_w); - - MC6845_UPDATE_ROW(crtc_update_row); - MC6845_UPDATE_ROW(crtc_update_row_mono); - - DECLARE_DRIVER_INIT(fanucspmg); - - UINT8 m_vram[24576]; - UINT8 m_video_ctrl; - -private: - virtual void machine_reset(); - INT32 m_vram_bank; - UINT8 m_vbl_ctrl; - UINT8 m_keyboard_row; - UINT8 m_vbl_stat; - UINT8 m_dma_page; -}; - -DRIVER_INIT_MEMBER(fanucspmg_state, fanucspmg) -{ - memset(m_vram, 0, sizeof(m_vram)); - - save_item(NAME(m_vram)); - save_item(NAME(m_vram_bank)); - save_item(NAME(m_vbl_ctrl)); - save_item(NAME(m_keyboard_row)); - save_item(NAME(m_video_ctrl)); -} - -READ8_MEMBER(fanucspmg_state::shared_r) -{ - return m_shared[offset]; -} - -WRITE8_MEMBER(fanucspmg_state::shared_w) -{ - m_shared[offset] = data; -} - -READ8_MEMBER(fanucspmg_state::get_slave_ack) -{ - if(offset == 7) - return m_pic1->acknowledge(); - - return 0x00; -} - -WRITE_LINE_MEMBER(fanucspmg_state::tc_w) -{ - m_fdc->tc_w(state); -} - -WRITE_LINE_MEMBER(fanucspmg_state::hrq_w) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state); - m_dmac->hlda_w(state); -} - -READ8_MEMBER(fanucspmg_state::fdcdma_r) -{ - return m_fdc->dma_r(); -} - -WRITE8_MEMBER(fanucspmg_state::fdcdma_w) -{ - m_fdc->dma_w(data); -} - -WRITE8_MEMBER(fanucspmg_state::dma_page_w) -{ - floppy_image_device *floppy0 = m_fdc->subdevice("0")->get_device(); - floppy_image_device *floppy1 = m_fdc->subdevice("1")->get_device(); - // verify - floppy0->mon_w(!(data & 2)); - floppy1->mon_w(!(data & 2)); - - m_dma_page = (data >> 2) & 0xf; -} - -READ16_MEMBER(fanucspmg_state::magic_r) -{ - return 0x0041; // 31 = memory error -} - -static ADDRESS_MAP_START(maincpu_mem, AS_PROGRAM, 16, fanucspmg_state) - AM_RANGE(0x00000, 0x7ffff) AM_RAM // main RAM - - AM_RANGE(0x80000, 0x81fff) AM_RAM // believed to be shared RAM with a CPU inside the Program File - AM_RANGE(0x88000, 0x88001) AM_NOP // Program File "ready" bit - - AM_RANGE(0xf0000, 0xf0003) AM_DEVREADWRITE8(PIC0_TAG, pic8259_device, read, write, 0x00ff) - AM_RANGE(0xf0004, 0xf0007) AM_DEVICE8(FDC_TAG, upd765a_device, map, 0x00ff) - AM_RANGE(0xf0008, 0xf000f) AM_DEVREADWRITE8(PIT0_TAG, pit8253_device, read, write, 0x00ff) - AM_RANGE(0xf0010, 0xf0011) AM_DEVREADWRITE8(USART0_TAG, i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0xf0012, 0xf0013) AM_DEVREADWRITE8(USART0_TAG, i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0xf0014, 0xf0015) AM_DEVREADWRITE8(USART1_TAG, i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0xf0016, 0xf0017) AM_DEVREADWRITE8(USART1_TAG, i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0xf0018, 0xf0019) AM_DEVREADWRITE8(USART2_TAG, i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0xf001a, 0xf001b) AM_DEVREADWRITE8(USART2_TAG, i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0xf001c, 0xf001d) AM_DEVREADWRITE8(USART3_TAG, i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0xf001e, 0xf001f) AM_DEVREADWRITE8(USART3_TAG, i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0xf0020, 0xf0029) AM_DEVREADWRITE8(DMAC_TAG, i8257_device, read, write, 0xffff) - AM_RANGE(0xf0042, 0xf0043) AM_READ(magic_r) - AM_RANGE(0xf0046, 0xf0047) AM_WRITE8(dma_page_w, 0x00ff) - AM_RANGE(0xf0048, 0xf004f) AM_DEVREADWRITE8(PIT1_TAG, pit8253_device, read, write, 0x00ff) - AM_RANGE(0xf2000, 0xf2003) AM_DEVREADWRITE8(PIC1_TAG, pic8259_device, read, write, 0x00ff) - - AM_RANGE(0xf8000, 0xf9fff) AM_READWRITE8(shared_r, shared_w, 0xffff) - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION(MAINCPU_TAG, 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(maincpu_io, AS_IO, 16, fanucspmg_state) -ADDRESS_MAP_END - -WRITE_LINE_MEMBER(fanucspmg_state::vsync_w) -{ - if ((m_vbl_ctrl & 0x08) == 0x08) - { - if (state == ASSERT_LINE) - { - m_subcpu->set_input_line(I8085_RST75_LINE, ASSERT_LINE); - } - } - - m_vbl_stat = (state == ASSERT_LINE) ? 1 : 0; -} - -READ8_MEMBER(fanucspmg_state::vram1_r) -{ - return m_vram[m_vram_bank + offset]; -} - -WRITE8_MEMBER(fanucspmg_state::vram1_w) -{ - m_vram[m_vram_bank + offset] = data; -} - -READ8_MEMBER(fanucspmg_state::vram2_r) -{ - return m_vram[m_vram_bank + offset + 0x600]; -} - -WRITE8_MEMBER(fanucspmg_state::vram2_w) -{ - m_vram[m_vram_bank + offset + 0x600] = data; -} - -WRITE8_MEMBER(fanucspmg_state::vram_bank_w) -{ - m_vram_bank = (data & 7) * 0xc00; -} - -READ8_MEMBER(fanucspmg_state::vblank_ack_r) -{ - m_subcpu->set_input_line(I8085_RST75_LINE, CLEAR_LINE); - - return 0xff; -} - -// bit 1 is unknown -// bit 3 appears to enable vblank IRQs -WRITE8_MEMBER(fanucspmg_state::vbl_ctrl_w) -{ - m_vbl_ctrl = data; -} - -// row 2: raising a bit toggles the corresponding bit at 500a -// row 3: raising a bit toggles the corresponding bit at 500b -WRITE8_MEMBER(fanucspmg_state::keyboard_row_w) -{ - m_keyboard_row = data; -} - -READ8_MEMBER(fanucspmg_state::keyboard_r) -{ - return 0; -} - -// bit 0 is set when clearing VRAM -// bit 1 is display enable -WRITE8_MEMBER(fanucspmg_state::video_ctrl_w) -{ - m_video_ctrl = data; -} - -static ADDRESS_MAP_START(subcpu_mem, AS_PROGRAM, 8, fanucspmg_state) - AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION(SUBCPU_TAG, 0) - - AM_RANGE(0x4000, 0x45ff) AM_READWRITE(vram1_r, vram1_w) - AM_RANGE(0x4800, 0x4dff) AM_READWRITE(vram2_r, vram2_w) - - AM_RANGE(0x5000, 0x5000) AM_DEVREADWRITE(CRTC_TAG, mc6845_device, status_r, address_w) - AM_RANGE(0x5001, 0x5001) AM_DEVREADWRITE(CRTC_TAG, mc6845_device, register_r, register_w) - AM_RANGE(0x5008, 0x5008) AM_WRITE(keyboard_row_w) - AM_RANGE(0x5009, 0x5009) AM_READ(keyboard_r) - AM_RANGE(0x500a, 0x500b) AM_WRITENOP // keyboard rows 2 and 3 control what's written here. dip switches? - AM_RANGE(0x500c, 0x500c) AM_WRITE(vbl_ctrl_w) - AM_RANGE(0x500d, 0x500d) AM_WRITE(vram_bank_w) - AM_RANGE(0x500e, 0x500e) AM_READ(vblank_ack_r) - AM_RANGE(0x5018, 0x5018) AM_WRITE(video_ctrl_w) - - AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE(SHARED_TAG) // shared RAM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( fanucspmg ) -INPUT_PORTS_END - -void fanucspmg_state::machine_reset() -{ - m_vbl_ctrl = 0; - m_vram_bank = 0; - m_video_ctrl = 0; - m_dma_page = 0; -} - -READ8_MEMBER(fanucspmg_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset | (m_dma_page << 16)); -} - -WRITE8_MEMBER(fanucspmg_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.write_byte(offset | (m_dma_page << 16), data); -} - -MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) -{ - UINT32 *p = &bitmap.pix32(y); - int i; - UINT8 *chargen = m_chargen->base(); - - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ma + i ); - - if (m_video_ctrl & 0x02) - { - if (offset <= 0x5ff) - { - UINT8 chr = m_vram[offset + 0x600]; - UINT8 attr = m_vram[offset]; - UINT8 data = chargen[ chr + (ra * 256) ]; - UINT32 fg = 0; - UINT32 bg = 0; - - if (attr & 0x20) fg |= 0xff0000; - if (attr & 0x40) fg |= 0x00ff00; - if (attr & 0x80) fg |= 0x0000ff; - - *p++ = ( data & 0x01 ) ? fg : bg; - *p++ = ( data & 0x02 ) ? fg : bg; - *p++ = ( data & 0x04 ) ? fg : bg; - *p++ = ( data & 0x08 ) ? fg : bg; - *p++ = ( data & 0x10 ) ? fg : bg; - *p++ = ( data & 0x20 ) ? fg : bg; - *p++ = ( data & 0x40 ) ? fg : bg; - *p++ = ( data & 0x80 ) ? fg : bg; - } - } - else - { - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - } - } -} - -MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row_mono ) -{ - UINT32 *p = &bitmap.pix32(y); - int i; - UINT8 *chargen = m_chargen->base(); - - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ma + i ); - - if (m_video_ctrl & 0x02) - { - if (offset <= 0x5ff) - { - UINT8 chr = m_vram[offset + 0x600]; -// UINT8 attr = m_vram[offset]; - UINT8 data = chargen[ chr + (ra * 256) ]; - UINT32 fg = 0xff00; - UINT32 bg = 0; - - *p++ = ( data & 0x01 ) ? fg : bg; - *p++ = ( data & 0x02 ) ? fg : bg; - *p++ = ( data & 0x04 ) ? fg : bg; - *p++ = ( data & 0x08 ) ? fg : bg; - *p++ = ( data & 0x10 ) ? fg : bg; - *p++ = ( data & 0x20 ) ? fg : bg; - *p++ = ( data & 0x40 ) ? fg : bg; - *p++ = ( data & 0x80 ) ? fg : bg; - } - } - else - { - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; - } - } -} - -static SLOT_INTERFACE_START( fanuc_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( fanucspmg_state::floppy_formats ) - FLOPPY_IMD_FORMAT -FLOPPY_FORMATS_END - -static MACHINE_CONFIG_START( fanucspmg, fanucspmg_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, I8086, XTAL_15MHz/3) - MCFG_CPU_PROGRAM_MAP(maincpu_mem) - MCFG_CPU_IO_MAP(maincpu_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(PIC0_TAG, pic8259_device, inta_cb) - - MCFG_CPU_ADD(SUBCPU_TAG, I8085A, XTAL_16MHz/2/2) - MCFG_CPU_PROGRAM_MAP(subcpu_mem) - - MCFG_DEVICE_ADD(USART0_TAG, I8251, 0) - MCFG_DEVICE_ADD(USART1_TAG, I8251, 0) - MCFG_DEVICE_ADD(USART2_TAG, I8251, 0) - MCFG_DEVICE_ADD(USART3_TAG, I8251, 0) - - MCFG_DEVICE_ADD(PIT0_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_15MHz/12) - MCFG_PIT8253_CLK1(XTAL_15MHz/12) - MCFG_PIT8253_CLK2(XTAL_15MHz/12) - MCFG_DEVICE_ADD(PIT1_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_15MHz/12) - MCFG_PIT8253_CLK1(XTAL_15MHz/12) - MCFG_PIT8253_CLK2(XTAL_15MHz/12) - - MCFG_DEVICE_ADD(DMAC_TAG, I8257, XTAL_15MHz / 5) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(fanucspmg_state, hrq_w)) - MCFG_I8257_OUT_TC_CB(WRITELINE(fanucspmg_state, tc_w)) - MCFG_I8257_IN_MEMR_CB(READ8(fanucspmg_state, memory_read_byte)) - MCFG_I8257_OUT_MEMW_CB(WRITE8(fanucspmg_state, memory_write_byte)) - MCFG_I8257_IN_IOR_0_CB(READ8(fanucspmg_state, fdcdma_r)) - MCFG_I8257_OUT_IOW_0_CB(WRITE8(fanucspmg_state, fdcdma_w)) - - MCFG_PIC8259_ADD(PIC0_TAG, INPUTLINE("maincpu", 0), VCC, READ8(fanucspmg_state, get_slave_ack)) - MCFG_PIC8259_ADD(PIC1_TAG, DEVWRITELINE(PIC0_TAG, pic8259_device, ir7_w), GND, NULL) - - MCFG_UPD765A_ADD(FDC_TAG, true, true) - MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE(PIC0_TAG, pic8259_device, ir3_w)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE(DMAC_TAG, i8257_device, dreq0_w)) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":0", fanuc_floppies, "525dd", fanucspmg_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":1", fanuc_floppies, "525dd", fanucspmg_state::floppy_formats) - - MCFG_SCREEN_ADD( SCREEN_TAG, RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_15MHz, 640, 0, 512, 390, 0, 384 ) - MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, mc6845_device, screen_update ) - - MCFG_MC6845_ADD( CRTC_TAG, HD6845, SCREEN_TAG, XTAL_8MHz/2) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(fanucspmg_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(fanucspmg_state, vsync_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( fanucspmgm, fanucspmg ) - MCFG_DEVICE_REMOVE( CRTC_TAG ) - - MCFG_MC6845_ADD( CRTC_TAG, HD6845, SCREEN_TAG, XTAL_8MHz/2) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(fanucspmg_state, crtc_update_row_mono) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(fanucspmg_state, vsync_w)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( fanucspg ) - ROM_REGION(0x4000, MAINCPU_TAG, 0) - ROM_LOAD16_BYTE( "a40_001a.13a", 0x000000, 0x002000, CRC(1b8ac8ef) SHA1(309c081d25270e082ebf846b4f73cef76b52d991) ) - ROM_LOAD16_BYTE( "a40_002a.15a", 0x000001, 0x002000, CRC(587ae652) SHA1(ebc5a4c3d64ab9d6dd4d5355f85bc894e7294e17) ) - - ROM_REGION(0x4000, SUBCPU_TAG, 0) - ROM_LOAD( "a41_010b.28b", 0x000000, 0x004000, CRC(35a9714f) SHA1(5697b6c4db5adb5702dc1290ecc98758d5fab221) ) - - ROM_REGION(0x8000, CHARGEN_TAG, 0) - ROM_LOAD( "a42_020a.30b", 0x000000, 0x008000, CRC(33eb5962) SHA1(1157a72089ff77e8db9a9a8fcd0f6c32a1374f56) ) -ROM_END - -ROM_START( fanucspgm ) - ROM_REGION(0x4000, MAINCPU_TAG, 0) - ROM_LOAD16_BYTE( "a25_001a.33e", 0x000000, 0x002000, CRC(81159267) SHA1(f5d53cc6e929f57e8c3747f80fc74d4b1643222d) ) - ROM_LOAD16_BYTE( "a25_002a.35e", 0x000001, 0x002000, CRC(4fb82c4d) SHA1(eb75e9a2d3c8e4ad56a74624ee8c52c785bd0da6) ) - - ROM_REGION(0x4000, SUBCPU_TAG, 0) - ROM_LOAD( "a21_010f.17d", 0x000000, 0x002000, CRC(ef192717) SHA1(7fb3f7ca290d2437ae5956700f88c801018ce1cc) ) - - ROM_REGION(0x8000, CHARGEN_TAG, 0) - ROM_LOAD( "a22_020b.5g", 0x000000, 0x002000, CRC(7b5f8e20) SHA1(9de607e541d8aad2d1ea56321270bb8466b16e3d) ) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, fanucspg, 0, 0, fanucspmg, fanucspmg, fanucspmg_state, fanucspmg, "Fanuc", "System P Model G", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1983, fanucspgm, fanucspg, 0, fanucspmgm, fanucspmg, fanucspmg_state, fanucspmg, "Fanuc", "System P Model G (monochrome)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/fb01.c b/src/mess/drivers/fb01.c deleted file mode 100644 index 88353f634f5..00000000000 --- a/src/mess/drivers/fb01.c +++ /dev/null @@ -1,228 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - Yamaha FB-01 - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/2151intf.h" -#include "machine/nvram.h" -#include "video/hd44780.h" -#include "machine/i8251.h" -#include "machine/clock.h" -#include "bus/midi/midi.h" -#include "fb01.lh" - - -class fb01_state : public driver_device -{ -public: - fb01_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_upd71051(*this, "upd71051") - , m_midi_thru(*this, "mdthru") - , m_ym2164_irq(CLEAR_LINE) - , m_upd71051_txrdy(CLEAR_LINE) - , m_upd71051_rxrdy(CLEAR_LINE) - { - } - - DECLARE_WRITE_LINE_MEMBER(write_usart_clock); - DECLARE_WRITE_LINE_MEMBER(midi_in); - DECLARE_WRITE_LINE_MEMBER(ym2164_irq_w); - DECLARE_WRITE_LINE_MEMBER(upd71051_txrdy_w); - DECLARE_WRITE_LINE_MEMBER(upd71051_rxrdy_w); - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_PALETTE_INIT(fb01); - -private: - required_device m_maincpu; - required_device m_upd71051; - required_device m_midi_thru; - int m_ym2164_irq; - int m_upd71051_txrdy; - int m_upd71051_rxrdy; - - void update_int(); -}; - - -static ADDRESS_MAP_START(fb01_mem, AS_PROGRAM, 8, fb01_state) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_RAM AM_SHARE("nvram") // 2 * 8KB S-RAM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(fb01_io, AS_IO, 8, fb01_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // 00-01 YM2164 - AM_RANGE(0x00, 0x00) AM_DEVWRITE("ym2164", ym2151_device, register_w) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("ym2164", ym2151_device, status_r, data_w) - - // 10-11 USART uPD71051C 4MHz & 4MHz / 8 - AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("upd71051", i8251_device, data_r, data_w) - AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("upd71051", i8251_device, status_r, control_w) - - // 20 PANEL SWITCH - AM_RANGE(0x20, 0x20) AM_READ_PORT("PANEL") - - // 30-31 HD44780A - AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("hd44780", hd44780_device, control_read, control_write) - AM_RANGE(0x31, 0x31) AM_DEVREADWRITE("hd44780", hd44780_device, data_read, data_write) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( fb01 ) - PORT_START("PANEL") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("System Set Up") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inst Select") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inst Assign") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inst Function") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Voice Function") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Voice Select") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("-1/No") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("+1/Yes") -INPUT_PORTS_END - - -void fb01_state::machine_start() -{ - save_item(NAME(m_ym2164_irq)); - save_item(NAME(m_upd71051_txrdy)); - save_item(NAME(m_upd71051_rxrdy)); -} - - -void fb01_state::machine_reset() -{ - m_upd71051->write_cts(0); - m_upd71051->write_rxd(ASSERT_LINE); -} - - -WRITE_LINE_MEMBER(fb01_state::write_usart_clock) -{ - m_upd71051->write_txc(state); - m_upd71051->write_rxc(state); -} - - -WRITE_LINE_MEMBER(fb01_state::midi_in) -{ - m_midi_thru->write_txd(state); - m_upd71051->write_rxd(state); -} - - -WRITE_LINE_MEMBER(fb01_state::ym2164_irq_w) -{ - m_ym2164_irq = state; - update_int(); -} - - -WRITE_LINE_MEMBER(fb01_state::upd71051_txrdy_w) -{ - m_upd71051_txrdy = state; - update_int(); -} - - -WRITE_LINE_MEMBER(fb01_state::upd71051_rxrdy_w) -{ - m_upd71051_rxrdy = state; - update_int(); -} - - -void fb01_state::update_int() -{ - m_maincpu->set_input_line(0, (m_ym2164_irq || m_upd71051_txrdy || m_upd71051_rxrdy) ? ASSERT_LINE : CLEAR_LINE); -} - - -static HD44780_PIXEL_UPDATE(fb01_pixel_update) -{ - if ( pos < 8 && line < 2 ) - { - bitmap.pix16(y, line*6*8 + pos*6 + x) = state; - } -} - - -PALETTE_INIT_MEMBER(fb01_state, fb01) -{ - palette.set_pen_color(0, rgb_t(30, 0, 0)); - palette.set_pen_color(1, rgb_t(150, 0, 0)); -} - - -static MACHINE_CONFIG_START( fb01, fb01_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) - MCFG_CPU_PROGRAM_MAP(fb01_mem) - MCFG_CPU_IO_MAP(fb01_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(6*16, 9) - MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9-1) - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT( layout_fb01 ) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(fb01_state, fb01) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 8) // 2x8 displayed as 1x16 - MCFG_HD44780_PIXEL_UPDATE_CB(fb01_pixel_update) - - MCFG_DEVICE_ADD("upd71051", I8251, XTAL_4MHz) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(fb01_state, upd71051_rxrdy_w)) - MCFG_I8251_TXRDY_HANDLER(WRITELINE(fb01_state, upd71051_txrdy_w)) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) - - MCFG_DEVICE_ADD("usart_clock", CLOCK, XTAL_4MHz / 8) // 500KHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(fb01_state, write_usart_clock)) - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(WRITELINE(fb01_state, midi_in)) - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - - MCFG_MIDI_PORT_ADD("mdthru", midiout_slot, "midiout") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_YM2151_ADD("ym2164", XTAL_4MHz) - MCFG_YM2151_IRQ_HANDLER(WRITELINE(fb01_state, ym2164_irq_w)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) - - MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( fb01 ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD("fb01.ic11", 0, 0x8000, CRC(7357e9a4) SHA1(049c482d6c91b7e2846757dd0f5138e0d8b687f0)) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1986, fb01, 0, 0, fb01, fb01, driver_device, 0, "Yamaha", "FB-01", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/fc100.c b/src/mess/drivers/fc100.c deleted file mode 100644 index 65d7c801bee..00000000000 --- a/src/mess/drivers/fc100.c +++ /dev/null @@ -1,578 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Goldstar FC-100 (FC stands for Famicom) - -2014/04/20 Skeleton driver. - -Known chips: M5C6847P, AY-3-8910, 8251. XTALS 7.15909, 4.9152 - -No manuals or schematics available. -Shift-Run to BREAK out of CLOAD. -Cassette uses the uart. -There is an inbuilt Monitor. MON to enter. Commands are D,G,M,R,S,X. - - -Test of semigraphic 6 -10 SCREEN 2:CLS -20 FOR I=0 TO 360 -30 PSET(128+SIN(I)*90,91-COS(I)*90), 1 -40 NEXT -RUN - -TODO: -- Cassette can be 600 or 1200 baud, how is 600 baud selected? -- Hookup Graphics modes and colours -- Unknown i/o ports -- Need cart software (current code is just a guess) - - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6847.h" -#include "machine/i8251.h" -#include "machine/clock.h" -#include "sound/ay8910.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "formats/fc100_cas.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class fc100_state : public driver_device -{ -public: - fc100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_vdg(*this, "vdg") - , m_p_videoram(*this, "videoram") - , m_cass(*this, "cassette") - , m_cart(*this, "cartslot") - , m_uart(*this, "uart") - , m_centronics(*this, "centronics") - , m_keyboard(*this, "KEY") - { } - - DECLARE_READ8_MEMBER(mc6847_videoram_r); - DECLARE_READ8_MEMBER(port00_r); - DECLARE_WRITE8_MEMBER(port31_w); - DECLARE_WRITE8_MEMBER(port33_w); - DECLARE_WRITE8_MEMBER(port43_w); - DECLARE_WRITE8_MEMBER(port60_w); - DECLARE_WRITE8_MEMBER(port70_w); - DECLARE_WRITE_LINE_MEMBER(txdata_callback); - DECLARE_WRITE_LINE_MEMBER(uart_clock_w); - DECLARE_DRIVER_INIT(fc100); - TIMER_DEVICE_CALLBACK_MEMBER(timer_c); - TIMER_DEVICE_CALLBACK_MEMBER(timer_p); - TIMER_DEVICE_CALLBACK_MEMBER(timer_k); - - UINT8 *m_p_chargen; - - MC6847_GET_CHARROM_MEMBER(get_char_rom) - { - return m_p_chargen[ch * 16 + line]; - } -private: - virtual void machine_start(); - virtual void machine_reset(); - - // graphics signals - UINT8 m_ag; - UINT8 m_gm2; - UINT8 m_gm1; - UINT8 m_gm0; - UINT8 m_as; - UINT8 m_css; - UINT8 m_intext; - UINT8 m_inv; - UINT8 m_cass_data[4]; - bool m_cass_state; - bool m_cassold; - UINT8 m_key_pressed; - bool m_banksw_unlocked; - - required_device m_maincpu; - required_device m_vdg; - required_shared_ptr m_p_videoram; - required_device m_cass; - required_device m_cart; - required_device m_uart; - required_device m_centronics; - required_ioport_array<16> m_keyboard; -}; - - -static ADDRESS_MAP_START( fc100_mem, AS_PROGRAM, 8, fc100_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x5fff ) AM_ROM AM_REGION("roms", 0) - //AM_RANGE(0x6000, 0x6fff) // mapped by the cartslot - AM_RANGE( 0x7800, 0x7fff ) AM_READ_BANK("bankr") AM_WRITE_BANK("bankw") // Banked RAM/ROM - AM_RANGE( 0x8000, 0xbfff ) AM_RAM // expansion ram pack - if omitted you get a 'Pages?' prompt at boot - AM_RANGE( 0xc000, 0xffff ) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fc100_io, AS_IO, 8, fc100_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x0F) AM_READ(port00_r) - // AM_RANGE(0x10, 0x10) AM_WRITE(port10_w) // vdg, unknown effects - AM_RANGE(0x21, 0x21) AM_DEVWRITE("psg", ay8910_device, data_w) - AM_RANGE(0x22, 0x22) AM_DEVREAD("psg", ay8910_device, data_r) - AM_RANGE(0x23, 0x23) AM_DEVWRITE("psg", ay8910_device, address_w) - AM_RANGE(0x31, 0x31) AM_WRITE(port31_w) - AM_RANGE(0x33, 0x33) AM_WRITE(port33_w) - AM_RANGE(0x40, 0x40) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x42, 0x42) AM_WRITENOP // bit 0 could be printer select - AM_RANGE(0x43, 0x43) AM_WRITE(port43_w) - AM_RANGE(0x44, 0x44) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE(0x60, 0x61) AM_WRITE(port60_w) - AM_RANGE(0x70, 0x71) AM_WRITE(port70_w) - AM_RANGE(0xb0, 0xb0) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0xb8, 0xb8) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( fc100 ) - PORT_START("KEY.0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_NAME("Graph") // does nothing - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Shift") PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("Ctrl") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_NAME("Caps") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("[") PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("]") PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("KEY.1") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("\\") PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Backspace") PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("=") PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Enter") PORT_CHAR(13) - - PORT_START("KEY.2") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") - - PORT_START("KEY.3") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_NAME("'") PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_NAME("Tab") PORT_CHAR(9) - - PORT_START("KEY.4") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHAR('5') PORT_CHAR('^') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHAR('7') PORT_CHAR('%') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHAR('8') PORT_CHAR('*') - - PORT_START("KEY.5") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHAR('4') PORT_CHAR('$') - - PORT_START("KEY.6") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Space") PORT_CHAR(32) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Run") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHAR('0') PORT_CHAR(')') - - PORT_START("KEY.7") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") - - PORT_START("KEY.8") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("KEY.9") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Home") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("Ins") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Del") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") PORT_CHAR(27) - - PORT_START("KEY.10") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('L') PORT_CHAR('l') - - PORT_START("KEY.11") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('V') PORT_CHAR('v') - - PORT_START("KEY.12") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('K') PORT_CHAR('k') - - PORT_START("KEY.13") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('F') PORT_CHAR('f') - - PORT_START("KEY.14") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('I') PORT_CHAR('i') - - PORT_START("KEY.15") - PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('R') PORT_CHAR('r') - - PORT_START("JOY0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -READ8_MEMBER( fc100_state::port00_r ) -{ - return m_keyboard[offset]->read(); -} - -// The timer frequency controls the auto-repeat delay and speed -// m_key_pressed: -// 0 = no key pressed, nothing to do -// 1 = key pressed, generate IRQ. -// 2 = key released, generate IRQ. -TIMER_DEVICE_CALLBACK_MEMBER( fc100_state::timer_k) -{ - /* scan the keyboard */ - UINT8 i; - - for (i = 0; i < 16; i++) - { - if (m_keyboard[i]->read() < 255) - { - // IRQ if key pressed - m_key_pressed = 1; - m_maincpu->set_input_line(0, HOLD_LINE); - return; - } - } - - if (m_key_pressed == 1) // IRQ for key released - { - m_key_pressed = 2; - m_maincpu->set_input_line(0, HOLD_LINE); - return; - } - else - if (m_key_pressed == 2) // release IRQ - { - m_key_pressed = 0; - m_maincpu->set_input_line(0, CLEAR_LINE); - } -} - - -//********************* AUDIO ********************************** -#if 0 -WRITE8_MEMBER( fc100_state::ay_port_a_w ) -{ - m_ag = BIT(data, 4); - m_gm2 = BIT(data, 6); - m_gm1 = BIT(data, 3); - m_gm0 = BIT(data, 3); - m_css = m_ag; - - m_vdg->ag_w( m_ag ? ASSERT_LINE : CLEAR_LINE ); - m_vdg->gm2_w( m_gm2 ? ASSERT_LINE : CLEAR_LINE ); - m_vdg->gm1_w( m_gm1 ? ASSERT_LINE : CLEAR_LINE ); - m_vdg->gm0_w( m_gm0 ? ASSERT_LINE : CLEAR_LINE ); - m_vdg->css_w( m_css ? ASSERT_LINE : CLEAR_LINE ); - m_vdg->hack_black_becomes_blue( BIT(data, 1) ); -} -#endif - -//******************** VIDEO ********************************** - -READ8_MEMBER( fc100_state::mc6847_videoram_r ) -{ - if (offset == ~0) return 0xff; - - if ( m_ag ) - { - if ( m_gm2 ) - { - // 256 x 192 / 6KB - offset = ( ( offset & 0x1fc0 ) >> 1 ) | ( offset & 0x1f ); - return m_p_videoram[offset % 0xc00]; - } - else - { - // 256 x 96 / 3KB - return m_p_videoram[offset % 0xc00]; - } - } - - // Standard text - UINT8 data = m_p_videoram[offset]; - UINT8 attr = m_p_videoram[offset+0x200]; - - // unknown bits 1,2,4,7 - m_vdg->inv_w( BIT( attr, 0 )); - m_vdg->css_w( BIT( attr, 1)); // guess - m_vdg->as_w( BIT( attr, 6 )); - - return data; -} - -/* F4 Character Displayer */ -static const gfx_layout u53_charlayout = -{ - 7, 15, /* 7 x 15 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( fc100 ) - GFXDECODE_ENTRY( "chargen", 0x0000, u53_charlayout, 0, 1 ) -GFXDECODE_END - -//********************** CENTRONICS PRINTER *********************************** - -WRITE8_MEMBER( fc100_state::port43_w ) -{ - m_centronics->write_strobe(BIT(data, 2)); - m_centronics->write_init(BIT(data, 3)); -} - -//********************** UART/CASSETTE *********************************** - -WRITE8_MEMBER( fc100_state::port31_w ) -{ - if (data == 8) - m_cass->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); -} - -WRITE8_MEMBER( fc100_state::port33_w ) -{ - if (data == 0) - m_cass->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - -WRITE_LINE_MEMBER( fc100_state::txdata_callback ) -{ - m_cass_state = state; -} - -WRITE_LINE_MEMBER( fc100_state::uart_clock_w ) -{ - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - -TIMER_DEVICE_CALLBACK_MEMBER( fc100_state::timer_c ) -{ - m_cass_data[3]++; - - if (m_cass_state != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = m_cass_state; - } - - if (m_cass_state) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -TIMER_DEVICE_CALLBACK_MEMBER( fc100_state::timer_p) -{ - /* cassette - turn 1200/2400Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_uart->write_rxd((m_cass_data[1] < 12) ? 1 : 0); - m_cass_data[1] = 0; - } -} - -//******************** MACHINE ****************************** - -void fc100_state::machine_start() -{ - m_ag = 0; - m_gm2 = 0; - m_gm1 = 0; - m_gm0 = 0; - m_as = 0; - m_css = 0; - m_intext = 0; - m_inv = 0; - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - save_item(NAME(m_ag)); - save_item(NAME(m_gm2)); - save_item(NAME(m_gm1)); - save_item(NAME(m_gm0)); - save_item(NAME(m_as)); - save_item(NAME(m_css)); - save_item(NAME(m_intext)); - save_item(NAME(m_inv)); -} - -void fc100_state::machine_reset() -{ - m_p_chargen = memregion("chargen")->base(); - m_cass_data[0] = m_cass_data[1] = m_cass_data[2] = m_cass_data[3] = 0; - m_cass_state = 0; - m_cassold = 0; - m_key_pressed = 0; - membank("bankr")->set_entry(0); - membank("bankw")->set_entry(0); -} - -WRITE8_MEMBER( fc100_state::port60_w ) -{ - if (m_banksw_unlocked) - membank("bankr")->set_entry(offset); -} - -WRITE8_MEMBER( fc100_state::port70_w ) -{ - m_banksw_unlocked = (bool)offset; -} - -DRIVER_INIT_MEMBER( fc100_state, fc100 ) -{ - UINT8 *ram = memregion("ram")->base(); - UINT8 *cgen = memregion("chargen")->base()+0x800; - - membank("bankr")->configure_entry(0, &cgen[0]); - membank("bankw")->configure_entry(0, &ram[0]); - membank("bankr")->configure_entry(1, &ram[0]); -} - -static MACHINE_CONFIG_START( fc100, fc100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_7_15909MHz/2) - MCFG_CPU_PROGRAM_MAP(fc100_mem) - MCFG_CPU_IO_MAP(fc100_io) - - /* video hardware */ - MCFG_DEVICE_ADD("vdg", M5C6847P1, XTAL_7_15909MHz/3) // Clock not verified - MCFG_MC6847_INPUT_CALLBACK(READ8(fc100_state, mc6847_videoram_r)) - MCFG_MC6847_CHARROM_CALLBACK(fc100_state, get_char_rom) - MCFG_MC6847_FIXED_MODE(MC6847_MODE_INTEXT) - // other lines not connected - - MCFG_SCREEN_MC6847_NTSC_ADD("screen", "vdg") - MCFG_GFXDECODE_ADD("gfxdecode", "f4palette", fc100) - MCFG_PALETTE_ADD_MONOCHROME_AMBER("f4palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("psg", AY8910, XTAL_7_15909MHz/3/2) /* AY-3-8910 - clock not verified */ - MCFG_AY8910_PORT_A_READ_CB(IOPORT("JOY0")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("JOY1")) - //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(fc100_state, ay_port_a_w)) - //MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(fc100_state, ay_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50) - - /* Devices */ - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(fc100_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(fc100_state, txdata_callback)) - MCFG_DEVICE_ADD("uart_clock", CLOCK, XTAL_4_9152MHz/16/16) // gives 19200 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(fc100_state, uart_clock_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_c", fc100_state, timer_c, attotime::from_hz(4800)) // cass write - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", fc100_state, timer_p, attotime::from_hz(40000)) // cass read - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", fc100_state, timer_k, attotime::from_hz(300)) // keyb scan - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "fc100_cart") - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( fc100 ) - ROM_REGION( 0x6000, "roms", 0 ) - ROM_LOAD( "08-01.u48", 0x0000, 0x2000, CRC(24e78e75) SHA1(13121706544256a702635448ed2950a75c13f491) ) - ROM_LOAD( "08-02.u49", 0x2000, 0x2000, CRC(e14fc7e9) SHA1(9c5821e65c1efe698e25668d24c36929ea4c3ad7) ) - ROM_LOAD( "06-03.u50", 0x4000, 0x2000, CRC(d783c84e) SHA1(6d1bf53995e08724d5ecc24198cdda4442eb2eb9) ) - - ROM_REGION( 0x800, "ram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "cg-04-01.u53", 0x0000, 0x1000, CRC(2de75b7f) SHA1(464369d98cbae92ffa322ebaa4404cf5b26825f1) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -CONS( 1982, fc100, 0, 0, fc100, fc100, fc100_state, fc100, "Goldstar", "FC-100", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/fidelz80.c b/src/mess/drivers/fidelz80.c deleted file mode 100644 index 1d545c8405f..00000000000 --- a/src/mess/drivers/fidelz80.c +++ /dev/null @@ -1,1426 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco -/****************************************************************************** -* -* Fidelity Electronics Z80 based board driver -* By Kevin 'kevtris' Horton, Jonathan Gevaryahu AKA Lord Nightmare and Sandro Ronco -* -* All detailed RE work done by Kevin 'kevtris' Horton -* -* TODO: -* * Figure out why it says the first speech line twice; it shouldn't. (It sometimes does this on the sensory chess challenger real hardware) -* * Get rom locations from pcb (done for UVC, VCC is probably similar) -* * correctly hook up 7002/VBRC and 7014/bridgec3 speech so that the z80 is halted while words are being spoken -* -*********************************************************************** - -Talking Chess Challenger (VCC) -Advanced Talking Chess Challenger (UVC) -(which both share the same hardware) ----------------------- - -The CPU is a Z80 running at 4MHz. The TSI chip runs at around 25KHz, using a -470K / 100pf RC network. This system is very very basic, and is composed of just -the Z80, 4 ROMs, the TSI chip, and an 8255. - - -The Z80's interrupt inputs are all pulled to VCC, so no interrupts are used. - -Reset is connected to a power-on reset circuit and a button on the keypad (marked RE). - -The TSI chip connects to a 4K ROM. All of the 'Voiced' Chess Challengers -use this same ROM (three or four). The later chess boards use a slightly different part -number, but the contents are identical. - -Memory map (VCC): ------------ -0000-0FFF: 4K 2332 ROM 101-32103 -1000-1FFF: 4K 2332 ROM VCC2 -2000-2FFF: 4K 2332 ROM VCC3 -4000-5FFF: 1K RAM (2114 SRAM x2) -6000-FFFF: empty - -Memory map (UVC): ------------ -0000-1FFF: 8K 2364 ROM 101-64017 -2000-2FFF: 4K 2332 ROM 101-32010 -4000-5FFF: 1K RAM (2114 SRAM x2) -6000-FFFF: empty - -I/O map: --------- -00-FF: 8255 port chip [LN edit: 00-03, mirrored over the 00-FF range; program accesses F4-F7] - - -8255 connections: ------------------ - -PA.0 - segment G, TSI A0 (W) -PA.1 - segment F, TSI A1 (W) -PA.2 - segment E, TSI A2 (W) -PA.3 - segment D, TSI A3 (W) -PA.4 - segment C, TSI A4 (W) -PA.5 - segment B, TSI A5 (W) -PA.6 - segment A, language latch Data (W) -PA.7 - TSI START line, language latch clock (W, see below) - -PB.0 - dot commons (W) -PB.1 - NC -PB.2 - digit 0, bottom dot (W) -PB.3 - digit 1, top dot (W) -PB.4 - digit 2 (W) -PB.5 - digit 3 (W) -PB.6 - enable language switches (W, see below) -PB.7 - TSI DONE line (R) - -(button rows pulled up to 5V through 2.2K resistors) -PC.0 - button row 0, German language jumper (R) -PC.1 - button row 1, French language jumper (R) -PC.2 - button row 2, Spanish language jumper (R) -PC.3 - button row 3, special language jumper (R) -PC.4 - button column A (W) -PC.5 - button column B (W) -PC.6 - button column C (W) -PC.7 - button column D (W) - - -language switches: ------------------- - -When PB.6 is pulled low, the language switches can be read. There are four. -They connect to the button rows. When enabled, the row(s) will read low if -the jumper is present. English only VCC's do not have the 367 or any pads stuffed. -The jumpers are labelled: French, German, Spanish, and special. - - -language latch: ---------------- - -There's an unstuffed 7474 on the board that connects to PA.6 and PA.7. It allows -one to latch the state of A12 to the speech ROM. The English version has the chip -missing, and a jumper pulling "A12" to ground. This line is really a negative -enable. - -To make the VCC multi-language, one would install the 74367 (note: it must be a 74367 -or possibly a 74LS367. A 74HC367 would not work since they rely on the input current -to keep the inputs pulled up), solder a piggybacked ROM to the existing English -speech ROM, and finally install a 7474 dual flipflop. - -This way, the game can then detect which secondary language is present, and then it can -automatically select the correct ROM(s). I have to test whether it will do automatic -determination and give you a language option on power up or something. - -*********************************************************************** - -Chess Challenger 3/10 ----------------------- - -This is an earlier hardware upon which the VCC and UVC above were based on; -The hardware is nearly the same; in fact the only significant differences are -the RAM being located in a different place, the lack of a speech chip, and -the connections to ports A and B on the PPI: - -8255 connections: ------------------ - -PA.0 - segment G (W) -PA.1 - segment F (W) -PA.2 - segment E (W) -PA.3 - segment D (W) -PA.4 - segment C (W) -PA.5 - segment B (W) -PA.6 - segment A (W) -PA.7 - 'beeper' direct speaker output (W) - -PB.0 - dot commons (W) -PB.1 - NC -PB.2 - digit 0, bottom dot (W) -PB.3 - digit 1, top dot (W) -PB.4 - digit 2 (W) -PB.5 - digit 3 (W) -PB.6 - NC -PB.7 - Mode select (cc3 vs cc10, R) - -(button rows pulled up to 5V through 2.2K resistors) -PC.0 - button row 0 (R) -PC.1 - button row 1 (R) -PC.2 - button row 2 (R) -PC.3 - button row 3 (R) -PC.4 - button column A (W) -PC.5 - button column B (W) -PC.6 - button column C (W) -PC.7 - button column D (W) - -****************************************************************************** -Voice Bridge Challenger (Model VBRC, later reissued as Model 7002) -and Bridge Challenger 3 (Model 7014) -(which both share the same* hardware) --------------------------------- -* The Bridge Challenger 3 does not actually have the 8 LEDs nor the -latches which operate them populated and the plastic indicator cap locations -are instead are covered by a piece of plastic, but they do work if manually -added. - -This unit is similar in construction kinda to the chess challengers, however it -has an 8041 which does ALL of the system I/O. The Z80 has NO IO AT ALL other than -what is performed through the 8041! - -The main CPU is a Z80 running at 2.5MHz - -INT connects to VCC (not used) -NMI connects to VCC (not used) -RST connects to power on reset, and reset button - -The 8041 runs at 5MHz. - -Memory Map: ------------ - -0000-1FFF: 8K 101-64108 ROM -2000-3FFF: 8K 101-64109 ROM -4000-5FFF: 8K 101-64110 ROM -6000-7FFF: 1K of RAM (2114 * 2) -8000-DFFF: unused -E000-FFFF: write to TSI chip - -NOTE: when the TSI chip is written to, the CPU IS STOPPED. The CPU will run again -when the word is done being spoken. This is because D0-D5 run to the TSI chip directly. - -The TSI chip's ROM is 4K, and is marked 101-32118. The clock is the same as the Chess -Challengers- 470K/100pf which gives a frequency around 25KHz or so. - -I/O Map: --------- - -00-FF: 8041 I/O ports (A0 selects between the two) - - - -8041 pinout: ------------- - -(note: columns are pulled up with 10K resistors) - -P10 - column H, RD LED, VFD grid 0 -P11 - column G, DB LED, VFD grid 1 -P12 - column F, <>V LED, VFD grid 2 -P13 - column E, ^V LED, VFD grid 3 -P14 - column D, W LED, VFD grid 4 -P15 - column C, S LED, VFD grid 5 -P16 - column B, E LED, VFD grid 6 -P17 - column A, N LED, VFD grid 7 - -P20 - I/O expander -P21 - I/O expander -P22 - I/O expander -P23 - I/O expander -P24 - row 0 through inverter -P25 - row 1 through inverter -P26 - row 2 through inverter -P27 - row 3 through inverter - -PROG - I/O expander - -T0 - optical card sensor (high = bright/reflective, low = dark/non reflective) -T1 - connects to inverter, then nothing - -D8243C I/O expander: --------------------- - -P4.0 - segment M -P4.1 - segment L -P4.2 - segment N -P4.3 - segment E - -P5.0 - segment D -P5.1 - segment I -P5.2 - segment K -P5.3 - segment J - -P6.0 - segment A -P6.1 - segment B -P6.2 - segment F -P6.3 - segment G - -P7.0 - LED enable (high = LEDs can be lit. low = LEDs will not light) -P7.1 - goes through inverter, to pads that are not used -P7.2 - segment C -P7.3 - segment H - - -button matrix: --------------- - -the matrix is composed of 8 columns by 4 rows. - - A B C D E F G H - ------------------------- -0- RE xx CL EN J Q K A -1- BR PB DB SC 7 8 9 10 -2- DL CV VL PL 3 4 5 6 -3- cl di he sp NT P 1 2 - -xx - speaker symbol -cl - clubs symbol -di - diamonds symbol -he - hearts symbol -sp - spades symbol - -NOTE: RE is not wired into the matrix, and is run separately out. - -There are 8 LEDs, and an 8 digit 14 segment VFD with commas and periods. -This display is the same one as can be found on the speak and spell. - - A * comma - *********** * - * *I *J K* * -F* * * * *B - * * * * * - G**** *****H - * * * * * -E* * * * *C - * *N *M L* * - *********** *decimal point - D - -The digits of the display are numbered left to right, 0 through 7 and are controlled -by the grids. hi = grid on, hi = segment on. - -A detailed description of the hardware can be found also in the patent 4,373,719. - -****************************************************************************** - -Sensory Chess Challenger champion (6502 based, needs its own driver .c file) ---------------------------------- - -Memory map: ------------ -0000-07FF: 2K of RAM -0800-0FFF: 1K of RAM (note: mirrored twice) -1000-17FF: PIA 0 (display, TSI speech chip) -1800-1FFF: PIA 1 (keypad, LEDs) -2000-3FFF: 101-64019 ROM (also used on the regular sensory chess challenger) -4000-7FFF: mirror of 0000-3FFF -8000-9FFF: not used -A000-BFFF: 101-1025A03 ROM -C000-DFFF: 101-1025A02 ROM -E000-FDFF: 101-1025A01 ROM -FE00-FFFF: 512 byte 74S474 PROM - - -CPU is a 6502 running at 1.95MHz (3.9MHz resonator, divided by 2) - -NMI is not used. -IRQ is connected to a 600Hz oscillator (38.4KHz divided by 64). -Reset is connected to a power-on reset circuit. - - -PIA port lines: ---------------- - - -PIA 0: ------- - -PA0 - 7seg segments H, TSI A0 -PA1 - 7seg segments G, TSI A1 -PA2 - 7seg segments C, TSI A2 -PA3 - 7seg segments B, TSI A3 -PA4 - 7seg segments A, TSI A4 -PA5 - 7seg segments F, TSI A5 -PA6 - 7seg segments E -PA7 - 7seg segments D - -PB0 - A12 on speech ROM (if used... not used on this model, ROM is 4K) -PB1 - START line on S14001A -PB2 - white wire -PB3 - DONE line from S14001A -PB4 - Tone line (toggle to make a tone in the speaker) -PB5 - button column I -PB6 - selection jumper (resistor to 5V) -PB7 - selection jumper (resistor to ground) - -CA1 - NC -CA2 - violet wire - -CB1 - NC -CB2 - NC (connects to pin 14 of soldered connector) - -PIA 1: ------- - -PA0 - button row 1 -PA1 - button row 2 -PA2 - button row 3 -PA3 - button row 4 -PA4 - button row 5 -PA5 - button row 6 -PA6 - 7442 selector bit 0 -PA7 - 7442 selector bit 1 - -PB0 - LED row 1 -PB1 - LED row 2 -PB2 - LED row 3 -PB3 - LED row 4 -PB4 - LED row 5 -PB5 - LED row 6 -PB6 - LED row 7 -PB7 - LED row 8 - -CA1 - button row 7 -CA2 - selector bit 3 - -CB1 - button row 8 -CB2 - selector bit 2 - -Selector: (attached to PIA 1, outputs 1 of 10 pins low. 7442) ---------- - -output # (selected turns this column on, and all others off) -0 - LED column A, button column A, 7seg digit 1 -1 - LED column B, button column B, 7seg digit 2 -2 - LED column C, button column C, 7seg digit 3 -3 - LED column D, button column D, 7seg digit 4 -4 - LED column E, button column E -5 - LED column F, button column F -6 - LED column G, button column G -7 - LED column H, button column H -8 - button column I -9 - - -The rows/columns are indicated on the game board: - - - ABCDEFGH I --------------- -| | 8 -| | 7 -| | 6 -| | 5 -| | 4 -| | 3 -| | 2 -| | 1 --------------- - -The "lone LED" is above the control column. -column I is the "control column" on the right for starting a new game, etc. - -The upper 6 buttons are connected as such: - -column A - speak -column B - RV -column C - TM -column D - LV -column E - DM -column F - ST - -these 6 buttons use row 9 (connects to PIA 0) - -LED display: ------------- - -43 21 (digit number) ------ -88:88 - -The LED display is four 7 segment digits. normal ABCDEFG lettering is used for segments. - -The upper dot is connected to digit 3 common -The lower dot is connected to digit 4 common -The lone LED is connected to digit 1 common - -All three of the above are called "segment H". - - -*********************************************************************** -Sensory Chess Challenger ------------------------- - -The display/button/LED/speech technology is identical to the above product. -Only the CPU board was changed. As such, it works the same but is interfaced -to different port chips this time. - -Hardware: ---------- - -On the board are 13 chips. - -The CPU is a Z80A running at 3.9MHz, with 20K of ROM and 1K of RAM mapped. -I/O is composed of an 8255 triple port adaptor, and a Z80A PIO parallel I/O -interface. - -There's the usual TSI S14001A speech synth with its requisite 4K ROM which is the -same as on the other talking chess boards. The TSI chip is running at 26.37KHz. -It uses a 470K resistor and a 100pf capacitor. - -The "perfect" clock would be 1/RC most likely (actually this will be skewed a tad by -duty cycle of the oscillator) which with those parts values gives 21.27KHz. The -formula is probably more likely to be 1/1.2RC or so. - -Rounding out the hardware are three driver chips for the LEDs, a 7404 inverter to -run the crystal osc, a 555 timer to generate a clock, and a 74138 selector. - -NMI runs to a 555 oscillator that generates a 600Hz clock (measured: 598.9Hz. It has a multiturn pot to adjust). -INT is pulled to 5V -RST connects to a power-on reset circuit - - -Memory map: ------------ - -0000-1FFF: 8K ROM 101-64018 -2000-3FFF: 8K ROM 101-64019 (also used on the sensory champ. chess challenger) -4000-5FFF: 4K ROM 101-32024 -6000-7FFF: 1K of RAM (2114 * 2) -8000-FFFF: not used, maps to open bus - -I/O map: --------- - -There's only two chips in the I/O map, an 8255 triple port chip, and a Z80A PIO -parallel input/output device. - -Decoding isn't performed using a selector, but instead address lines are used. - -A2 connects to /CE on the 8255 -A3 connects to /CE on the Z80A PIO - -A1 connects to control/data select on PIO & A0 of 8255 -A0 connects to port A/B select on PIO & A1 of 8255 - -So to enable only the 8255, you'd write/read to 08-0Bh for example -To enable only the PIO, you'd write/read to 04-07h for example. - -writing to 00-03h will enable and write to BOTH chips, and reading 00-03h -will return data from BOTH chips (and cause a bus conflict). The code probably -never does either of these things. - -Likewise, writing/reading to 0Ch-0Fh will result in open bus, because neither chip's -enable line will be low. - -This sequence repeats every 16 addresses. So to recap: - -00-03: both chips enabled (probably not used) -04-07: PIO enabled -08-0B: 8255 enabled -0C-0F: neither enabled - -10-FF: mirrors of 00-0F. - - -Refer to the Sensory Champ. Chess Chall. above for explanations of the below -I/O names and labels. It's the same. - -8255: ------ - -PA.0 - segment D, TSI A0 -PA.1 - segment E, TSI A1 -PA.2 - segment F, TSI A2 -PA.3 - segment A, TSI A3 -PA.4 - segment B, TSI A4 -PA.5 - segment C, TSI A5 -PA.6 - segment G -PA.7 - segment H - -PB.0 - LED row 1 -PB.1 - LED row 2 -PB.2 - LED row 3 -PB.3 - LED row 4 -PB.4 - LED row 5 -PB.5 - LED row 6 -PB.6 - LED row 7 -PB.7 - LED row 8 - -PC.0 - LED column A, button column A, 7seg digit 1 -PC.1 - LED column B, button column B, 7seg digit 2 -PC.2 - LED column C, button column C, 7seg digit 3 -PC.3 - LED column D, button column D, 7seg digit 4 -PC.4 - LED column E, button column E -PC.5 - LED column F, button column F -PC.6 - LED column G, button column G -PC.7 - LED column H, button column H - - -Z80A PIO: ---------- - -PA.0 - button row 1 -PA.1 - button row 2 -PA.2 - button row 3 -PA.3 - button row 4 -PA.4 - button row 5 -PA.5 - button row 6 -PA.6 - button row 7 -PA.7 - button row 8 - -PB.0 - button column I -PB.1 - button row 9 -PB.2 - Tone line (toggle to make tone in the speaker) -PB.3 - violet wire -PB.4 - white wire (and TSI done line) -PB.5 - selection jumper input (see below) -PB.6 - TSI start line -PB.7 - TSI ROM D0 line - -selection jumpers: ------------------- - -These act like another row of buttons. It is composed of two diode locations, -so there's up to 4 possible configurations. My board does not have either diode -stuffed, so this most likely is "English". I suspect it selects which language to use -for the speech synth. Of course you need the other speech ROMs for this to function -properly. - -Anyways, the two jumpers are connected to button columns A and B and the common -connects to Z80A PIO PB.5, which basically makes a 10th button row. I would -expect that the software reads these once on startup only. - -******************************************************************************/ - - -/* Core includes */ -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/i8255.h" -#include "machine/i8243.h" -#include "machine/z80pio.h" -#include "sound/beep.h" -#include "sound/s14001a.h" -#include "includes/fidelz80.h" -#include "fidelz80.lh" -#include "vsc.lh" -#include "bridgec3.lh" - -//#include "debugger.h" - -/* Devices */ - -/****************************************************************************** - I8255 Device, for VCC/UVC -******************************************************************************/ - -void fidelz80_state::update_display() -{ - // data for the 4x 7seg leds, bits are 0bxABCDEFG - UINT8 out_digit = BITSWAP8( m_digit_data,7,0,1,2,3,4,5,6 ) & 0x7f; - - if (m_led_selected&0x04) - { - output_set_digit_value(0, out_digit); - - output_set_led_value(1, m_led_data & 0x01); - } - if (m_led_selected&0x08) - { - output_set_digit_value(1, out_digit); - - output_set_led_value(0, m_led_data & 0x01); - } - if (m_led_selected&0x10) - { - output_set_digit_value(2, out_digit); - } - if (m_led_selected&0x20) - { - output_set_digit_value(3, out_digit); - } -} - -READ8_MEMBER( fidelz80_state::fidelz80_portc_r ) -{ - UINT8 data = 0xff; - - if (!(m_kp_matrix&0x10)) - { - data &= ioport("LINE1")->read(); - } - if (!(m_kp_matrix&0x20)) - { - data &= ioport("LINE2")->read(); - } - if (!(m_kp_matrix&0x40)) - { - data &= ioport("LINE3")->read(); - } - if (!(m_kp_matrix&0x80)) - { - data &= ioport("LINE4")->read(); - } - - return data; -} - -WRITE8_MEMBER( fidelz80_state::fidelz80_portb_w ) -{ - if (!(data & 0x80)) - { - m_led_data = (data&0x01); // common for two leds - - m_led_selected = data; - - update_display(); - } - - // ignoring the language switch enable for now, is bit 0x40 -} - -WRITE8_MEMBER( fidelz80_state::fidelz80_portc_w ) -{ - m_kp_matrix = data; -} - -WRITE8_MEMBER( fidelz80_state::cc10_porta_w ) -{ - m_beep->set_state((data & 0x80) ? 0 : 1); - - m_digit_data = data; - - update_display(); -} - -READ8_MEMBER( fidelz80_state::vcc_portb_r ) -{ - return (m_speech->bsy_r() != 0) ? 0x80 : 0x00; -} - -WRITE8_MEMBER( fidelz80_state::vcc_porta_w ) -{ - m_speech->set_volume(15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... - m_speech->reg_w(data & 0x3f); - m_speech->rst_w(BIT(data, 7)); - - m_digit_data = data; - - update_display(); -} - -/****************************************************************************** - I8255 Device, for VSC -******************************************************************************/ - -WRITE8_MEMBER( fidelz80_state::vsc_porta_w ) -{ - UINT8 out_digit = BITSWAP8( data,7,6,2,1,0,5,4,3 ); - - if (m_kp_matrix & 0x01) - { - output_set_digit_value(0, out_digit & 0x7f); - output_set_value("pm_led", BIT(out_digit, 7)); - } - if (m_kp_matrix & 0x02) - { - output_set_digit_value(1, out_digit & 0x7f); - } - if (m_kp_matrix & 0x04) - { - output_set_digit_value(2, out_digit & 0x7f); - output_set_value("up_dot", BIT(out_digit, 7)); - } - if (m_kp_matrix & 0x08) - { - output_set_digit_value(3, out_digit & 0x7f); - output_set_value("low_dot", BIT(out_digit, 7)); - } - - m_speech->reg_w(data & 0x3f); -} - -WRITE8_MEMBER( fidelz80_state::vsc_portb_w ) -{ - for (int row=1; row<=8; row++) - { - if (m_kp_matrix & 0x01) - output_set_indexed_value("led_a", row, BIT(data, 8-row)); - if (m_kp_matrix & 0x02) - output_set_indexed_value("led_b", row, BIT(data, 8-row)); - if (m_kp_matrix & 0x04) - output_set_indexed_value("led_c", row, BIT(data, 8-row)); - if (m_kp_matrix & 0x08) - output_set_indexed_value("led_d", row, BIT(data, 8-row)); - if (m_kp_matrix & 0x10) - output_set_indexed_value("led_e", row, BIT(data, 8-row)); - if (m_kp_matrix & 0x20) - output_set_indexed_value("led_f", row, BIT(data, 8-row)); - if (m_kp_matrix & 0x40) - output_set_indexed_value("led_g", row, BIT(data, 8-row)); - if (m_kp_matrix & 0x80) - output_set_indexed_value("led_h", row, BIT(data, 8-row)); - } -} - -WRITE8_MEMBER( fidelz80_state::vsc_portc_w ) -{ - m_kp_matrix = (m_kp_matrix & 0x300) | data; -} - -/****************************************************************************** - PIO Device, for VSC -******************************************************************************/ - -READ8_MEMBER( fidelz80_state::vsc_pio_porta_r ) -{ - UINT8 data = 0; - - if (m_kp_matrix & 0x01) - data |= (ioport("COL_A")->read()); - if (m_kp_matrix & 0x02) - data |= (ioport("COL_B")->read()); - if (m_kp_matrix & 0x04) - data |= (ioport("COL_C")->read()); - if (m_kp_matrix & 0x08) - data |= (ioport("COL_D")->read()); - if (m_kp_matrix & 0x10) - data |= (ioport("COL_E")->read()); - if (m_kp_matrix & 0x20) - data |= (ioport("COL_F")->read()); - if (m_kp_matrix & 0x40) - data |= (ioport("COL_G")->read()); - if (m_kp_matrix & 0x80) - data |= (ioport("COL_H")->read()); - if (m_kp_matrix & 0x100) - data |= (ioport("COL_I")->read()); - if (m_kp_matrix & 0x200) - data |= (ioport("COL_L")->read()); - - return data & 0xff; -} - -READ8_MEMBER( fidelz80_state::vsc_pio_portb_r ) -{ - UINT8 data = 0x00; - - if (m_speech->bsy_r() == 0) - data |= 0x10; - - return data; -} - -WRITE8_MEMBER( fidelz80_state::vsc_pio_portb_w ) -{ - m_kp_matrix = (m_kp_matrix & 0xff) | ((data & 0x03)<<8); - - m_speech->set_volume(15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... - m_speech->rst_w(BIT(data, 6)); -} - -/****************************************************************************** - I8041 MCU, for VBRC/7002 and bridgec3/7014 -******************************************************************************/ - -WRITE8_MEMBER(fidelz80_state::kp_matrix_w) -{ - UINT16 out_data = BITSWAP16(m_digit_data,12,13,1,6,5,2,0,7,15,11,10,14,4,3,9,8); - UINT16 out_digit = out_data & 0x3fff; - UINT8 out_led = BIT(out_data, 15) ? 0 : 1; - - // output the digit before update the matrix - if (m_kp_matrix & 0x01) - { - output_set_digit_value(1, out_digit); - output_set_led_value(8, out_led); - } - if (m_kp_matrix & 0x02) - { - output_set_digit_value(2, out_digit); - output_set_led_value(7, out_led); - } - if (m_kp_matrix & 0x04) - { - output_set_digit_value(3, out_digit); - output_set_led_value(6, out_led); - } - if (m_kp_matrix & 0x08) - { - output_set_digit_value(4, out_digit); - output_set_led_value(5, out_led); - } - if (m_kp_matrix & 0x10) - { - output_set_digit_value(5, out_digit); - output_set_led_value(4, out_led); - } - if (m_kp_matrix & 0x20) - { - output_set_digit_value(6, out_digit); - output_set_led_value(3, out_led); - } - if (m_kp_matrix & 0x40) - { - output_set_digit_value(7, out_digit); - output_set_led_value(2, out_led); - } - if (m_kp_matrix & 0x80) - { - output_set_digit_value(8, out_digit); - output_set_led_value(1, out_led); - } - - memset(m_digit_line_status, 0, sizeof(m_digit_line_status)); - - m_kp_matrix = data; -} - -READ8_MEMBER(fidelz80_state::exp_i8243_p2_r) -{ - UINT8 data = 0xff; - - if (m_kp_matrix & 0x01) - data &= ioport("LINE1")->read(); - if (m_kp_matrix & 0x02) - data &= ioport("LINE2")->read(); - if (m_kp_matrix & 0x04) - data &= ioport("LINE3")->read(); - if (m_kp_matrix & 0x08) - data &= ioport("LINE4")->read(); - if (m_kp_matrix & 0x10) - data &= ioport("LINE5")->read(); - if (m_kp_matrix & 0x20) - data &= ioport("LINE6")->read(); - if (m_kp_matrix & 0x40) - data &= ioport("LINE7")->read(); - if (m_kp_matrix & 0x80) - data &= ioport("LINE8")->read(); - - return (m_i8243->i8243_p2_r(space, offset)&0x0f) | (data&0xf0); -} - -WRITE8_MEMBER(fidelz80_state::exp_i8243_p2_w) -{ - m_i8243->i8243_p2_w(space, offset, data&0x0f); -} - -// probably related to the card scanner -READ8_MEMBER(fidelz80_state::unknown_r) -{ - return 0; -} - -READ8_MEMBER(fidelz80_state::unknown2_r) -{ - return machine().rand(); -} - -/****************************************************************************** - I8243 expander -******************************************************************************/ - -WRITE8_MEMBER(fidelz80_state::digit_w) -{ - if (m_digit_line_status[offset]) - return; - - m_digit_line_status[offset&3] = 1; - - switch (offset) - { - case 0: - m_digit_data = (m_digit_data&(~0x000f)) | ((data<<0)&0x000f); - break; - case 1: - m_digit_data = (m_digit_data&(~0x00f0)) | ((data<<4)&0x00f0); - break; - case 2: - m_digit_data = (m_digit_data&(~0x0f00)) | ((data<<8)&0x0f00); - break; - case 3: - m_digit_data = (m_digit_data&(~0xf000)) | ((data<<12)&0xf000); - break; - } -} - -/****************************************************************************** - basic machine -******************************************************************************/ - -WRITE8_MEMBER(fidelz80_state::mcu_data_w) -{ - m_i8041->upi41_master_w(space, 0, data); -} - -WRITE8_MEMBER(fidelz80_state::mcu_command_w) -{ - m_i8041->upi41_master_w(space, 1, data); -} - -READ8_MEMBER(fidelz80_state::mcu_data_r) -{ - return m_i8041->upi41_master_r(space, 0); -} - -READ8_MEMBER(fidelz80_state::mcu_status_r) -{ - return m_i8041->upi41_master_r(space, 1); -} - -WRITE8_MEMBER( fidelz80_state::bridgec_speech_w ) -{ - // todo: HALT THE z80 here, and set up a callback to poll the s14001a DONE line to resume z80 - m_speech->set_volume(15); // hack, s14001a core should assume a volume of 15 unless otherwise stated... - m_speech->reg_w(data & 0x3f); - m_speech->rst_w(BIT(data, 7)); -} - -void fidelz80_state::machine_reset() -{ - m_led_selected = 0; - m_kp_matrix = 0; - m_digit_data = 0; - m_led_data = 0; - memset(m_digit_line_status, 0, sizeof(m_digit_line_status)); -} - -TIMER_DEVICE_CALLBACK_MEMBER(fidelz80_state::nmi_timer) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(cc10_z80_mem, AS_PROGRAM, 8, fidelz80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x3000, 0x31ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vcc_z80_mem, AS_PROGRAM, 8, fidelz80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM // 4k rom - AM_RANGE(0x1000, 0x1fff) AM_ROM // 4k rom - AM_RANGE(0x2000, 0x2fff) AM_ROM // 4k rom - AM_RANGE(0x4000, 0x43ff) AM_RAM AM_MIRROR(0x1c00) // 1k ram (2114*2) mirrored 8 times -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vsc_mem, AS_PROGRAM, 8, fidelz80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM // 8k rom - AM_RANGE(0x2000, 0x3fff) AM_ROM // 8k rom - AM_RANGE(0x4000, 0x5fff) AM_ROM // 4k rom - AM_RANGE(0x6000, 0x7fff) AM_RAM AM_MIRROR(0x1c00) // 1k ram (2114*2) mirrored 8 times -ADDRESS_MAP_END - -static ADDRESS_MAP_START(bridgec_z80_mem, AS_PROGRAM, 8, fidelz80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM // 8k rom - AM_RANGE(0x2000, 0x3fff) AM_ROM // 8k rom - AM_RANGE(0x4000, 0x5fff) AM_ROM // 8k rom - AM_RANGE(0x6000, 0x63ff) AM_RAM AM_MIRROR(0x1c00) // 1k ram (2114*2) mirrored 8 times - AM_RANGE(0xE000, 0xE000) AM_WRITE(bridgec_speech_w) AM_MIRROR(0x1FFF) // write to speech chip, halts cpu -ADDRESS_MAP_END - -static ADDRESS_MAP_START(fidel_z80_io, AS_IO, 8, fidelz80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_MIRROR(0xFC) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // 8255 i/o chip -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vsc_io, AS_IO, 8, fidelz80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x04, 0x07) AM_MIRROR(0xf0) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) - AM_RANGE(0x08, 0x0b) AM_MIRROR(0xf0) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(bridgec_z80_io, AS_IO, 8, fidelz80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READWRITE(mcu_data_r, mcu_data_w) - AM_RANGE(0x01, 0x01) AM_READWRITE(mcu_status_r, mcu_command_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(bridgec_mcu_io, AS_IO, 8, fidelz80_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kp_matrix_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(exp_i8243_p2_r, exp_i8243_p2_w) - AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w) - - // related to the card scanner, probably clock and data optical - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(unknown_r) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(unknown2_r) -ADDRESS_MAP_END - -/****************************************************************************** - Input Ports -******************************************************************************/ - -INPUT_CHANGED_MEMBER(fidelz80_state::fidelz80_trigger_reset) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER(fidelz80_state::bridgec_trigger_reset) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); - m_i8041->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -static INPUT_PORTS_START( fidelz80 ) - PORT_START("LEVEL") // cc10 only - PORT_CONFNAME( 0x80, 0x00, "Number of levels" ) - PORT_CONFSETTING( 0x00, "10" ) - PORT_CONFSETTING( 0x80, "3" ) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, fidelz80_state, fidelz80_trigger_reset, 0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_V) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CB") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PB") PORT_CODE(KEYCODE_P) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("EN") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PV") PORT_CODE(KEYCODE_O) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) -INPUT_PORTS_END - -static INPUT_PORTS_START( vsc ) - //chessboard buttons - PORT_START("COL_A") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_START("COL_B") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_START("COL_C") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_START("COL_D") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_START("COL_E") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_START("COL_F") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_START("COL_G") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_START("COL_H") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) - - //buttons on the right - PORT_START("COL_I") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Pawn") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Rook") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Knight") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bishop") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Queen") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("King") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) - - //buttons beside the display - PORT_START("COL_L") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("TM") PORT_CODE(KEYCODE_T) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("RV") PORT_CODE(KEYCODE_V) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Speak") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LV") PORT_CODE(KEYCODE_L) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DM") PORT_CODE(KEYCODE_M) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ST") PORT_CODE(KEYCODE_S) -INPUT_PORTS_END - -static INPUT_PORTS_START( bridgec ) - PORT_START("LINE1") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("10") PORT_CODE(KEYCODE_0) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - - PORT_START("LINE2") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - - PORT_START("LINE3") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_Z) - - PORT_START("LINE4") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("NT") PORT_CODE(KEYCODE_N) - - PORT_START("LINE5") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("EN") PORT_CODE(KEYCODE_E) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("SC") PORT_CODE(KEYCODE_S) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PL") PORT_CODE(KEYCODE_X) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Spades") PORT_CODE(KEYCODE_1_PAD) - - PORT_START("LINE6") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CL") PORT_CODE(KEYCODE_C) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("DB") PORT_CODE(KEYCODE_D) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("VL") PORT_CODE(KEYCODE_V) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Hearts") PORT_CODE(KEYCODE_2_PAD) - - PORT_START("LINE7") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Beep on/off") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("PB") PORT_CODE(KEYCODE_B) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CV") PORT_CODE(KEYCODE_G) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Diamonds") PORT_CODE(KEYCODE_3_PAD) - - PORT_START("LINE8") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, fidelz80_state, bridgec_trigger_reset, 0) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("BR") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("DL") PORT_CODE(KEYCODE_L) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Clubs") PORT_CODE(KEYCODE_4_PAD) -INPUT_PORTS_END - -/****************************************************************************** - Machine Drivers -******************************************************************************/ - -static MACHINE_CONFIG_START( cc10, fidelz80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(cc10_z80_mem) - MCFG_CPU_IO_MAP(fidel_z80_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_fidelz80) - - /* other hardware */ - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(fidelz80_state, cc10_porta_w)) - MCFG_I8255_IN_PORTB_CB(IOPORT("LEVEL")) - MCFG_I8255_OUT_PORTB_CB(WRITE8(fidelz80_state, fidelz80_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(fidelz80_state, fidelz80_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(fidelz80_state, fidelz80_portc_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( vcc, fidelz80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(vcc_z80_mem) - MCFG_CPU_IO_MAP(fidel_z80_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_fidelz80) - - /* other hardware */ - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - // Port A Read - NULL : only bit 6 is readable (and only sometimes) and I'm not emulating the language latch unless needed - MCFG_I8255_OUT_PORTA_CB(WRITE8(fidelz80_state, vcc_porta_w)) // display segments and s14001a lines - MCFG_I8255_IN_PORTB_CB(READ8(fidelz80_state, vcc_portb_r)) // bit 7 is readable and is the done line from the s14001a - MCFG_I8255_OUT_PORTB_CB(WRITE8(fidelz80_state, fidelz80_portb_w)) // display digits and led dots - MCFG_I8255_IN_PORTC_CB(READ8(fidelz80_state, fidelz80_portc_r)) // bits 0,1,2,3 are readable, have to do with input - MCFG_I8255_OUT_PORTC_CB(WRITE8(fidelz80_state, fidelz80_portc_w)) // bits 4,5,6,7 are writable, have to do with input - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speech", S14001A, 25000) // around 25khz - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( vsc, fidelz80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(vsc_mem) - MCFG_CPU_IO_MAP(vsc_io) - - MCFG_DEFAULT_LAYOUT(layout_vsc) - - /* other hardware */ - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(fidelz80_state, vsc_porta_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(fidelz80_state, vsc_portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(fidelz80_state, vsc_portb_w)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_IN_PA_CB(READ8(fidelz80_state, vsc_pio_porta_r)) - MCFG_Z80PIO_IN_PB_CB(READ8(fidelz80_state, vsc_pio_portb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(fidelz80_state, vsc_pio_portb_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", fidelz80_state, nmi_timer, attotime::from_hz(600)) - MCFG_TIMER_START_DELAY(attotime::from_hz(600)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speech", S14001A, 25000) // around 25khz - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( bridgec, fidelz80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_5MHz/2) // 2.5MHz - MCFG_CPU_PROGRAM_MAP(bridgec_z80_mem) - MCFG_CPU_IO_MAP(bridgec_z80_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_bridgec3) - - /* other hardware */ - MCFG_CPU_ADD("mcu", I8041, XTAL_5MHz) // 5MHz - MCFG_CPU_IO_MAP(bridgec_mcu_io) - - MCFG_I8243_ADD("i8243", NOOP, WRITE8(fidelz80_state,digit_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD("speech", S14001A, 25000) // around 25khz - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) -MACHINE_CONFIG_END - - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -ROM_START( cc10 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "cc10.bin", 0x0000, 0x1000, CRC(bb9e6055) SHA1(18276e57cf56465a6352239781a828c5f3d5ba63)) -ROM_END - -ROM_START(vcc) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("101-32103.bin", 0x0000, 0x1000, CRC(257bb5ab) SHA1(f7589225bb8e5f3eac55f23e2bd526be780b38b5)) // 32014.VCC??? at location b3? - ROM_LOAD("vcc2.bin", 0x1000, 0x1000, CRC(f33095e7) SHA1(692fcab1b88c910b74d04fe4d0660367aee3f4f0)) // at location a2? - ROM_LOAD("vcc3.bin", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6)) // at location a1? - - ROM_REGION(0x2000, "speech", 0) - ROM_LOAD("vcc-engl.bin", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d)) // at location c4? -ROM_END - -ROM_START(uvc) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("101-64017.b3", 0x0000, 0x2000, CRC(f1133abf) SHA1(09dd85051c4e7d364d43507c1cfea5c2d08d37f4)) // "MOS // 101-64017 // 3880" - ROM_LOAD("101-32010.a1", 0x2000, 0x1000, CRC(624f0cd5) SHA1(7c1a4f4497fe5882904de1d6fecf510c07ee6fc6)) // "NEC P9Z021 // D2332C 228 // 101-32010", == vcc3.bin on vcc - - ROM_REGION(0x2000, "speech", 0) - ROM_LOAD("101-32107.c4", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d)) // "NEC P9Y019 // D2332C 229 // 101-32107", == vcc-engl.bin on vcc -ROM_END - -ROM_START(vsc) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("101-64108.bin", 0x0000, 0x2000, CRC(c9c98490) SHA1(e6db883df088d60463e75db51433a4b01a3e7626)) - ROM_LOAD("101-64109.bin", 0x2000, 0x2000, CRC(08a3577c) SHA1(69fe379d21a9d4b57c84c3832d7b3e7431eec341)) - ROM_LOAD("101-32024.bin", 0x4000, 0x1000, CRC(2a078676) SHA1(db2f0aba7e8ac0f84a17bae7155210cdf0813afb)) - - ROM_REGION(0x2000, "speech", 0) - ROM_LOAD("101-32107.bin", 0x0000, 0x1000, CRC(f35784f9) SHA1(348e54a7fa1e8091f89ac656b4da22f28ca2e44d)) -ROM_END - -ROM_START(vbrc) // AKA model 7002 - ROM_REGION(0x10000, "maincpu", 0) - // nec 2364 mask roms; pin 27 (PGM, probably NC here due to mask roms) goes to the pcb - ROM_LOAD("101-64108.g3", 0x0000, 0x2000, CRC(08472223) SHA1(859865b13c908dbb474333263dc60f6a32461141)) - ROM_LOAD("101-64109.f3", 0x2000, 0x2000, CRC(320afa0f) SHA1(90edfe0ac19b108d232cda376b03a3a24befad4c)) - ROM_LOAD("101-64110.e3", 0x4000, 0x2000, CRC(3040d0bd) SHA1(caa55fc8d9196e408fb41e7171a68e5099519813)) - - ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD("100-1009.a3", 0x0000, 0x0400, CRC(60eb343f) SHA1(8a63e95ebd62e123bdecc330c0484a47c354bd1a)) - - ROM_REGION(0x2000, "speech", 0) - ROM_LOAD("101-32118.i2", 0x0000, 0x1000, CRC(a0b8bb8f) SHA1(f56852108928d5c6caccfc8166fa347d6760a740)) -ROM_END - -ROM_START(bridgec3) // 510-1016 Rev.1 PCB has neither locations nor ic labels, so I declare the big heatsink is at C1, numbers count on the shorter length of pcb - ROM_REGION(0x10000, "maincpu", 0) - // TMM2764AD-20 EPROMS with tiny hole-punch sized colored stickers (mostly) covering the quartz windows. pin 27 (PGM) is tied to vcc with small rework wires and does not connect to pcb. - ROM_LOAD("7014_white.g3", 0x0000, 0x2000, CRC(eb1620ef) SHA1(987a9abc8c685f1a68678ea4ee65ec4a99419179)) // white sticker - ROM_LOAD("7014_red.f3", 0x2000, 0x2000, CRC(74af0019) SHA1(8dc05950c254ca050b95b93e5d0cf48f913a6d49)) // red sticker - ROM_LOAD("7014_blue.e3", 0x4000, 0x2000, CRC(341d9ca6) SHA1(370876573bb9408e75f4fc797304b6c64af0590a)) // blue sticker - - ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD("100-1009.a3", 0x0000, 0x0400, CRC(60eb343f) SHA1(8a63e95ebd62e123bdecc330c0484a47c354bd1a)) // "NEC P07021-027 || D8041C 563 100-1009" - - ROM_REGION(0x2000, "speech", 0) - ROM_LOAD("101-32118.i2", 0x0000, 0x1000, CRC(a0b8bb8f) SHA1(f56852108928d5c6caccfc8166fa347d6760a740)) // "ea 101-32118 || (C) 1980 || EA 8332A247-4 || 8034" -ROM_END - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, cc10, 0, 0, cc10, fidelz80, driver_device, 0, "Fidelity Electronics", "Chess Challenger 10 (Model CC10/BCC)", MACHINE_NOT_WORKING ) -COMP( 1979, vcc, 0, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Talking Chess Challenger (model VCC)", MACHINE_NOT_WORKING ) -COMP( 1979, vbrc, 0, 0, bridgec, bridgec, driver_device, 0, "Fidelity Electronics", "Bridge Challenger (model VBRC/7002)", MACHINE_NOT_WORKING ) -COMP( 1980, uvc, vcc, 0, vcc, fidelz80, driver_device, 0, "Fidelity Electronics", "Advanced Talking Chess Challenger (model UVC)", MACHINE_NOT_WORKING ) -COMP( 1980, bridgec3, vbrc, 0, bridgec, bridgec, driver_device, 0, "Fidelity Electronics", "Bridge Challenger 3 (model 7014)", MACHINE_NOT_WORKING ) -COMP( 1980, vsc, 0, 0, vsc, vsc, driver_device, 0, "Fidelity Electronics", "Voice Sensory Chess Challenger (model VSC)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mess/drivers/fk1.c b/src/mess/drivers/fk1.c deleted file mode 100644 index c821864f844..00000000000 --- a/src/mess/drivers/fk1.c +++ /dev/null @@ -1,477 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - FK-1 - - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/i8251.h" -#include "machine/ram.h" - - -class fk1_state : public driver_device -{ -public: - fk1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - - DECLARE_WRITE8_MEMBER(fk1_ppi_1_a_w); - DECLARE_WRITE8_MEMBER(fk1_ppi_1_b_w); - DECLARE_WRITE8_MEMBER(fk1_ppi_1_c_w); - DECLARE_READ8_MEMBER(fk1_ppi_1_a_r); - DECLARE_READ8_MEMBER(fk1_ppi_1_b_r); - DECLARE_READ8_MEMBER(fk1_ppi_1_c_r); - DECLARE_WRITE8_MEMBER(fk1_ppi_2_a_w); - DECLARE_WRITE8_MEMBER(fk1_ppi_2_c_w); - DECLARE_READ8_MEMBER(fk1_ppi_2_b_r); - DECLARE_READ8_MEMBER(fk1_ppi_2_c_r); - DECLARE_WRITE8_MEMBER(fk1_ppi_3_a_w); - DECLARE_WRITE8_MEMBER(fk1_ppi_3_b_w); - DECLARE_WRITE8_MEMBER(fk1_ppi_3_c_w); - DECLARE_READ8_MEMBER(fk1_ppi_3_a_r); - DECLARE_READ8_MEMBER(fk1_ppi_3_b_r); - DECLARE_READ8_MEMBER(fk1_ppi_3_c_r); - DECLARE_WRITE_LINE_MEMBER(fk1_pit_out0); - DECLARE_WRITE_LINE_MEMBER(fk1_pit_out1); - DECLARE_WRITE_LINE_MEMBER(fk1_pit_out2); - DECLARE_WRITE8_MEMBER(fk1_intr_w); - DECLARE_READ8_MEMBER(fk1_bank_ram_r); - DECLARE_READ8_MEMBER(fk1_bank_rom_r); - DECLARE_WRITE8_MEMBER(fk1_disk_w); - DECLARE_READ8_MEMBER(fk1_mouse_r); - DECLARE_WRITE8_MEMBER(fk1_reset_int_w); - UINT8 m_video_rol; - UINT8 m_int_vector; - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); - TIMER_DEVICE_CALLBACK_MEMBER(vsync_callback); - IRQ_CALLBACK_MEMBER(fk1_irq_callback); -}; - - -/* -Port A: - Printer -Port B: - Keyboard -Port C: - READING : - 7 - / OBF(buffer overflow for the printer) - 6 - INTE printer - 5 - ERROR printer - 4 - /PEND, lack of paper - 3 - INTR printer - 2 - INTE keyboard - 1 - IBF (data from the keyboard) - 0 - INTR keyboard - WRITING : - 6 - INTE printer - 2 - INTE keyboard - */ - -WRITE8_MEMBER( fk1_state::fk1_ppi_1_a_w ) -{ -// logerror("fk1_ppi_1_a_w %02x\n",data); -} - -WRITE8_MEMBER( fk1_state::fk1_ppi_1_b_w ) -{ -// logerror("fk1_ppi_1_b_w %02x\n",data); -} - -WRITE8_MEMBER( fk1_state::fk1_ppi_1_c_w ) -{ - //logerror("fk1_ppi_1_c_w %02x\n",data); -} - -READ8_MEMBER( fk1_state::fk1_ppi_1_a_r ) -{ - //logerror("fk1_ppi_1_a_r\n"); - return 0xff; -} - -READ8_MEMBER( fk1_state::fk1_ppi_1_b_r ) -{ -// logerror("fk1_ppi_1_b_r\n"); - return 0; -} - -READ8_MEMBER( fk1_state::fk1_ppi_1_c_r ) -{ -// logerror("fk1_ppi_1_c_r\n"); - return 0; -} - -/* -Port A: - Writing data to disk -Port B: - Reading data from disk -Port C: - READING: - 7 - / OF A data write to disk, - 6 - INTE A, - 5 - Select the drive A, B, - 4 - Not connected - 3 - INTR A - 2 - INTE B read data, - 1 - IBF B read data, - 0 - INTR B - - WRITING: - 6 - INTE A - reading data - 2 - INTE B - writing data -*/ - -WRITE8_MEMBER( fk1_state::fk1_ppi_2_a_w ) -{ -// logerror("write to disk %02x\n",data); -} - -WRITE8_MEMBER( fk1_state::fk1_ppi_2_c_w ) -{ -// logerror("fk1_ppi_2_c_w %02x\n",data); -} - -READ8_MEMBER( fk1_state::fk1_ppi_2_b_r ) -{ -// logerror("read from disk\n"); - return 0; -} - -READ8_MEMBER( fk1_state::fk1_ppi_2_c_r ) -{ -// logerror("fk1_ppi_2_c_r\n"); - return 0; -} - - -/* - -Port A: - 6 - / disk, authorization disk operations, - 3 - INTE MOUSE, permit suspension from mouse, - 2 - INTE RTC from the system clock of 50 Hz, - 1 and 0 - to set the type for hours write to the disk (01 index, 11 address mark, mark the date, 00 other). - -Port B: - Video ROL register -Port C - - READING: - 7 - INDEX ( index mark on the disk) - 6 - I do not know, - 5 - WRITE_PROTECT the protected disk, - 4 - TRAC_00 as a sign of trace - - WRITING: - 3 - HEAD LOAD - 2 - TRACK_43 - 1 - DIRC - direction to set the direction of stepping disk - 0 - STEP, move disk (0 1 .. 0.). - -*/ -WRITE8_MEMBER( fk1_state::fk1_ppi_3_a_w ) -{ -// logerror("fk1_ppi_3_a_w %02x\n",data); -} - -WRITE8_MEMBER( fk1_state::fk1_ppi_3_b_w ) -{ - m_video_rol = data; -} - -WRITE8_MEMBER( fk1_state::fk1_ppi_3_c_w ) -{ -// logerror("fk1_ppi_3_c_w %02x\n",data); -} - -READ8_MEMBER( fk1_state::fk1_ppi_3_a_r ) -{ -// logerror("fk1_ppi_3_a_r\n"); - return 0; -} - -READ8_MEMBER( fk1_state::fk1_ppi_3_b_r ) -{ - return m_video_rol; -} - -READ8_MEMBER( fk1_state::fk1_ppi_3_c_r ) -{ -// logerror("fk1_ppi_3_c_r\n"); - return 0; -} - -WRITE_LINE_MEMBER( fk1_state::fk1_pit_out0 ) -{ - // System time - logerror("WRITE_LINE_MEMBER(fk1_pit_out0)\n"); -} - -WRITE_LINE_MEMBER( fk1_state::fk1_pit_out1 ) -{ - // Timeout for disk operation - logerror("WRITE_LINE_MEMBER(fk1_pit_out1)\n"); -} - -WRITE_LINE_MEMBER( fk1_state::fk1_pit_out2 ) -{ - // Overflow for disk operations - logerror("WRITE_LINE_MEMBER(fk1_pit_out2)\n"); -} - -/* - 0 no interrupt allowed, - 1 allowed INTR-7, - 2 allowed INTR-7 and INTR-6, - 8 any interruption allowed. -*/ - -WRITE8_MEMBER( fk1_state::fk1_intr_w ) -{ - logerror("fk1_intr_w %02x\n",data); -} - -READ8_MEMBER( fk1_state::fk1_bank_ram_r ) -{ - address_space &space_mem = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - space_mem.install_write_bank(0x0000, 0x3fff, "bank1"); - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram + 0x4000); - return 0; -} - -READ8_MEMBER( fk1_state::fk1_bank_rom_r ) -{ - address_space &space_mem = m_maincpu->space(AS_PROGRAM); - space_mem.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(memregion("maincpu")->base()); - membank("bank2")->set_base(m_ram->pointer() + 0x10000); - return 0; -} - -/* - 4 - FORMAT authorization - 3 - READ_ADDRESS_MARK - 2 - READ_DATA_MARK - 1 - WRITE - 0 - READ - Functions are allowed in one. -*/ - -WRITE8_MEMBER( fk1_state::fk1_disk_w ) -{ -// logerror("fk1_disk_w %02x\n",data); -} - -/* -7 and 6 - 1 to connected mouse and 0 if not connected, -5 - / T2, right-click -4 - / T1, left-click -3 - / BY, Y-axis -2 - / AY, Y-axis -1 - / BX, X-axis -0 - / AX, X-axis -*/ - -READ8_MEMBER( fk1_state::fk1_mouse_r ) -{ -// logerror("fk1_mouse_r\n"); - return 0; -} - -/*Write to port 70 resets the interrupt from the system clock of 50 Hz. */ - -WRITE8_MEMBER( fk1_state::fk1_reset_int_w ) -{ - logerror("fk1_reset_int_w\n"); -} - -static ADDRESS_MAP_START(fk1_mem, AS_PROGRAM, 8, fk1_state) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(fk1_io, AS_IO, 8, fk1_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE( 0x10, 0x13 ) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE( 0x20, 0x23 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) - AM_RANGE( 0x30, 0x30 ) AM_READWRITE(fk1_bank_ram_r,fk1_intr_w) - AM_RANGE( 0x40, 0x40 ) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE( 0x41, 0x41 ) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE( 0x50, 0x50 ) AM_READWRITE(fk1_bank_rom_r,fk1_disk_w) - AM_RANGE( 0x60, 0x63 ) AM_DEVREADWRITE("ppi8255_3", i8255_device, read, write) - AM_RANGE( 0x70, 0x70 ) AM_READWRITE(fk1_mouse_r,fk1_reset_int_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( fk1 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') -INPUT_PORTS_END - -TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::keyboard_callback) -{ - if (ioport("LINE0")->read()) - { - m_int_vector = 6; - m_maincpu->set_input_line(0, HOLD_LINE); - } -} - -/* -7 ? DATA_READY -6 ? TIMEOUT -5 ? OVERFLOW -4 ? RTC_50HZ -3 ? MOUSE -2 ? SIO -1 ? KEYBOARD -0 ? PRINTER -*/ - -IRQ_CALLBACK_MEMBER(fk1_state::fk1_irq_callback) -{ - logerror("IRQ %02x\n", m_int_vector*2); - return m_int_vector * 2; -} - -TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::vsync_callback) -{ - m_int_vector = 3; - m_maincpu->set_input_line(0, HOLD_LINE); -} - - -void fk1_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - space.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(memregion("maincpu")->base()); // ROM - membank("bank2")->set_base(ram + 0x10000); // VRAM - membank("bank3")->set_base(ram + 0x8000); - membank("bank4")->set_base(ram + 0xc000); -} - -UINT32 fk1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code; - int y, x, b; - UINT8 *ram = m_ram->pointer(); - - for (x = 0; x < 64; x++) - { - for (y = 0; y < 256; y++) - { - code = ram[x * 0x100 + ((y + m_video_rol) & 0xff) + 0x10000]; - for (b = 0; b < 8; b++) - { - bitmap.pix16(y, x*8+b) = ((code << b) & 0x80) ? 1 : 0; - } - } - } - return 0; -} - -static MACHINE_CONFIG_START( fk1, fk1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz / 2) - MCFG_CPU_PROGRAM_MAP(fk1_mem) - MCFG_CPU_IO_MAP(fk1_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fk1_state,fk1_irq_callback) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(fk1_state, screen_update) - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(50) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(fk1_state, fk1_pit_out0)) - MCFG_PIT8253_CLK1(1000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(fk1_state, fk1_pit_out1)) - MCFG_PIT8253_CLK2(0) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(fk1_state, fk1_pit_out2)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(fk1_state, fk1_ppi_1_a_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(fk1_state, fk1_ppi_1_a_w)) - MCFG_I8255_IN_PORTB_CB(READ8(fk1_state, fk1_ppi_1_b_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(fk1_state, fk1_ppi_1_b_w)) - MCFG_I8255_IN_PORTC_CB(READ8(fk1_state, fk1_ppi_1_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(fk1_state, fk1_ppi_1_c_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(fk1_state, fk1_ppi_2_a_w)) - MCFG_I8255_IN_PORTB_CB(READ8(fk1_state, fk1_ppi_2_b_r)) - MCFG_I8255_IN_PORTC_CB(READ8(fk1_state, fk1_ppi_2_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(fk1_state, fk1_ppi_2_c_w)) - - MCFG_DEVICE_ADD("ppi8255_3", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(fk1_state, fk1_ppi_3_a_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(fk1_state, fk1_ppi_3_a_w)) - MCFG_I8255_IN_PORTB_CB(READ8(fk1_state, fk1_ppi_3_b_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(fk1_state, fk1_ppi_3_b_w)) - MCFG_I8255_IN_PORTC_CB(READ8(fk1_state, fk1_ppi_3_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(fk1_state, fk1_ppi_3_c_w)) - - /* uart */ - MCFG_DEVICE_ADD("uart", I8251, 0) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("80K") // 64 + 16 - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", fk1_state, keyboard_callback, attotime::from_hz(24000)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("vsync_timer", fk1_state, vsync_callback, attotime::from_hz(50)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( fk1 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "orig", "Original BIOS" ) - ROMX_LOAD( "fk1.u65", 0x0000, 0x0800, CRC(145561f8) SHA1(a4eb17d773e51b34620c508b6cebcb4531ae99c2), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "diag", "Diag BIOS" ) - ROMX_LOAD( "fk1-diag.u65", 0x0000, 0x0800, CRC(e0660ae1) SHA1(6ad609049b28f27126af0a8a6224362351073dee), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, fk1, 0, 0, fk1, fk1, driver_device, 0, "Statni statek Klicany", "FK-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/fm7.c b/src/mess/drivers/fm7.c deleted file mode 100644 index 787e38d4f9b..00000000000 --- a/src/mess/drivers/fm7.c +++ /dev/null @@ -1,2539 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/*********************************************************************************************** - - Fujitsu Micro 7 (FM-7) - - 12/05/2009 Skeleton driver. - - Computers in this series: - - | Release | Main CPU | Sub CPU | RAM | - ===================================================================================== - FM-8 | 1981-05 | M68A09 @ 1MHz | M6809 | 64K (main) + 48K (VRAM) | - FM-7 | 1982-11 | M68B09 @ 2MHz | M68B09 | 64K (main) + 48K (VRAM) | - FM-NEW7 | 1984-05 | M68B09 @ 2MHz | M68B09 | 64K (main) + 48K (VRAM) | - FM-77 | 1984-05 | M68B09 @ 2MHz | M68B09E | 64/256K (main) + 48K (VRAM) | - FM-77AV | 1985-10 | M68B09E @ 2MHz | M68B09 | 128/192K (main) + 96K (VRAM) | - FM-77AV20 | 1986-10 | M68B09E @ 2MHz | M68B09 | 128/192K (main) + 96K (VRAM) | - FM-77AV40 | 1986-10 | M68B09E @ 2MHz | M68B09 | 192/448K (main) + 144K (VRAM) | - FM-77AV20EX | 1987-11 | M68B09E @ 2MHz | M68B09 | 128/192K (main) + 96K (VRAM) | - FM-77AV40EX | 1987-11 | M68B09E @ 2MHz | M68B09 | 192/448K (main) + 144K (VRAM) | - FM-77AV40SX | 1988-11 | M68B09E @ 2MHz | M68B09 | 192/448K (main) + 144K (VRAM) | - - Note: FM-77AV dumps probably come from a FM-77AV40SX. Shall we confirm that both computers - used the same BIOS components? - - memory map info from http://www.nausicaa.net/~lgreenf/fm7page.htm - see also http://retropc.net/ryu/xm7/xm7.shtml - - - Known issues: - - Beeper is not implemented - - Keyboard repeat is not implemented - - Optional Kanji ROM use is not implemented - - Other optional hardware is not implemented (RS232, Z80 card...) - - FM-77AV20 and later aren't working (extra features not yet implemented) - -************************************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "cpu/i86/i86.h" -#include "cpu/z80/z80.h" -#include "sound/ay8910.h" -#include "sound/2203intf.h" -#include "sound/wave.h" -#include "sound/beep.h" - -#include "imagedev/cassette.h" -#include "formats/fm7_cas.h" -#include "imagedev/flopdrv.h" -#include "bus/centronics/dsjoy.h" -#include "includes/fm7.h" - -/* key scancode conversion table - * The FM-7 expects different scancodes when shift,ctrl or graph is held, or - * when kana is active. - */ - // TODO: fill in shift,ctrl,graph and kana code -static const UINT16 fm7_key_list[0x60][7] = -{ // norm shift ctrl graph kana sh.kana scan - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x01}, // ESC - {0x31, 0x21, 0xf9, 0xf9, 0xc7, 0x00, 0x02}, // 1 - {0x32, 0x22, 0xfa, 0xfa, 0xcc, 0x00, 0x03}, // 2 - {0x33, 0x23, 0xfb, 0xfb, 0xb1, 0xa7, 0x04}, - {0x34, 0x24, 0xfc, 0xfc, 0xb3, 0xa9, 0x05}, - {0x35, 0x25, 0xf2, 0xf2, 0xb4, 0xaa, 0x06}, - {0x36, 0x26, 0xf3, 0xf3, 0xb5, 0xab, 0x07}, - {0x37, 0x27, 0xf4, 0xf4, 0xd4, 0xac, 0x08}, - {0x38, 0x28, 0xf5, 0xf5, 0xd5, 0xad, 0x09}, - {0x39, 0x29, 0xf6, 0xf6, 0xd6, 0xae, 0x0a}, // 9 - {0x30, 0x00, 0xf7, 0xf7, 0xdc, 0xa6, 0x0b}, // 0 - {0x2d, 0x3d, 0x1e, 0x8c, 0xce, 0x00, 0x0c}, // - - {0x5e, 0x7e, 0x1c, 0x8b, 0xcd, 0x00, 0x0d}, // ^ - {0x5c, 0x7c, 0xf1, 0xf1, 0xb0, 0x00, 0x0e}, // Yen - {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f}, // Backspace - {0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x10}, // Tab - {0x71, 0x51, 0x11, 0xfd, 0xc0, 0x00, 0x11}, // Q - {0x77, 0x57, 0x17, 0xf8, 0xc3, 0x00, 0x12}, // W - {0x65, 0x45, 0x05, 0xe4, 0xb2, 0xa8, 0x13}, // E - {0x72, 0x52, 0x12, 0xe5, 0xbd, 0x00, 0x14}, - {0x74, 0x54, 0x14, 0x9c, 0xb6, 0x00, 0x15}, - {0x79, 0x59, 0x19, 0x9d, 0xdd, 0x00, 0x16}, - {0x75, 0x55, 0x15, 0xf0, 0xc5, 0x00, 0x17}, - {0x69, 0x49, 0x09, 0xe8, 0xc6, 0x00, 0x18}, - {0x6f, 0x4f, 0x0f, 0xe9, 0xd7, 0x00, 0x19}, - {0x70, 0x50, 0x10, 0x8d, 0xbe, 0x00, 0x1a}, // P - {0x40, 0x60, 0x00, 0x8a, 0xde, 0x00, 0x1b}, // @ - {0x5b, 0x7b, 0x1b, 0xed, 0xdf, 0xa2, 0x1c}, // [ - {0x0d, 0x0d, 0x00, 0x0d, 0x0d, 0x0d, 0x1d}, // Return - {0x61, 0x41, 0x01, 0x95, 0xc1, 0x00, 0x1e}, // A - {0x73, 0x53, 0x13, 0x96, 0xc4, 0x00, 0x1f}, // S - - {0x64, 0x44, 0x04, 0xe6, 0xbc, 0x00, 0x20}, // D - {0x66, 0x46, 0x06, 0xe7, 0xca, 0x00, 0x21}, - {0x67, 0x47, 0x07, 0x9e, 0xb7, 0x00, 0x22}, - {0x68, 0x48, 0x08, 0x9f, 0xb8, 0x00, 0x23}, - {0x6a, 0x4a, 0x0a, 0xea, 0xcf, 0x00, 0x24}, - {0x6b, 0x4b, 0x0b, 0xeb, 0xc9, 0x00, 0x25}, - {0x6c, 0x4c, 0x0c, 0x8e, 0xd8, 0x00, 0x26}, // L - {0x3b, 0x2b, 0x00, 0x99, 0xda, 0x00, 0x27}, // ; - {0x3a, 0x2a, 0x00, 0x94, 0xb9, 0x00, 0x28}, // : - {0x5d, 0x7d, 0x1d, 0xec, 0xd1, 0xa3, 0x29}, // ] - {0x7a, 0x5a, 0x1a, 0x80, 0xc2, 0xaf, 0x2a}, // Z - {0x78, 0x58, 0x18, 0x81, 0xbb, 0x00, 0x2b}, // X - {0x63, 0x43, 0x03, 0x82, 0xbf, 0x00, 0x2c}, // C - {0x76, 0x56, 0x16, 0x83, 0xcb, 0x00, 0x2d}, - {0x62, 0x42, 0x02, 0x84, 0xba, 0x00, 0x2e}, - {0x6e, 0x4e, 0x0e, 0x85, 0xd0, 0x00, 0x2f}, - {0x6d, 0x4d, 0x0d, 0x86, 0xd3, 0x00, 0x30}, // M - {0x2c, 0x3c, 0x00, 0x87, 0xc8, 0xa4, 0x31}, // < - {0x2e, 0x3e, 0x00, 0x88, 0xd9, 0xa1, 0x32}, // > - {0x2f, 0x3f, 0x00, 0x97, 0xd2, 0xa5, 0x33}, // / - {0x22, 0x5f, 0x1f, 0xe0, 0xdb, 0x00, 0x34}, // " - {0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x35}, // Space - {0x2a, 0x2a, 0x00, 0x98, 0x2a, 0x2a, 0x36}, // Tenkey - {0x2f, 0x2f, 0x00, 0x91, 0x2f, 0x2f, 0x37}, - {0x2b, 0x2b, 0x00, 0x99, 0x2b, 0x2b, 0x38}, - {0x2d, 0x2d, 0x00, 0xee, 0x2d, 0x2d, 0x39}, - {0x37, 0x37, 0x00, 0xe1, 0x37, 0x37, 0x3a}, - {0x38, 0x38, 0x00, 0xe2, 0x38, 0x38, 0x3b}, - {0x39, 0x39, 0x00, 0xe3, 0x39, 0x39, 0x3c}, - {0x3d, 0x3d, 0x00, 0xef, 0x3d, 0x3d, 0x3d}, // Tenkey = - {0x34, 0x34, 0x00, 0x93, 0x34, 0x34, 0x3e}, - {0x35, 0x35, 0x00, 0x8f, 0x35, 0x35, 0x3f}, - - {0x36, 0x36, 0x00, 0x92, 0x36, 0x36, 0x40}, - {0x2c, 0x2c, 0x00, 0x00, 0x2c, 0x2c, 0x41}, - {0x31, 0x31, 0x00, 0x9a, 0x31, 0x31, 0x42}, - {0x32, 0x32, 0x00, 0x90, 0x32, 0x32, 0x43}, - {0x33, 0x33, 0x00, 0x9b, 0x33, 0x33, 0x44}, - {0x0d, 0x0d, 0x00, 0x0d, 0x0d, 0x0d, 0x45}, - {0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x46}, - {0x2e, 0x2e, 0x00, 0x2e, 0x2e, 0x2e, 0x47}, - {0x12, 0x12, 0x00, 0x12, 0x12, 0x12, 0x48}, // INS - {0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x49}, // EL - {0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x4a}, // CLS - {0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x7f, 0x4b}, // DEL - {0x11, 0x11, 0x00, 0x11, 0x11, 0x11, 0x4c}, // DUP - {0x1e, 0x19, 0x00, 0x1e, 0x1e, 0x19, 0x4d}, // Cursor Up - {0x0b, 0x0b, 0x00, 0x0b, 0x0b, 0x0b, 0x4e}, // HOME - {0x1d, 0x02, 0x00, 0x1d, 0x1d, 0x02, 0x4f}, // Cursor Left - {0x1f, 0x1a, 0x00, 0x1f, 0x1f, 0x1a, 0x50}, // Cursor Down - {0x1c, 0x06, 0x00, 0x1c, 0x1c, 0x16, 0x51}, // Cursor Right - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c}, // BREAK - {0x101, 0x00, 0x101, 0x101, 0x101, 0x00, 0x5d}, // PF1 - {0x102, 0x00, 0x102, 0x102, 0x102, 0x00, 0x5e}, - {0x103, 0x00, 0x103, 0x103, 0x103, 0x00, 0x5f}, - {0x104, 0x00, 0x104, 0x104, 0x104, 0x00, 0x60}, - {0x105, 0x00, 0x105, 0x105, 0x105, 0x00, 0x61}, - {0x106, 0x00, 0x106, 0x106, 0x106, 0x00, 0x62}, - {0x107, 0x00, 0x107, 0x107, 0x107, 0x00, 0x63}, - {0x108, 0x00, 0x108, 0x108, 0x108, 0x00, 0x64}, - {0x109, 0x00, 0x109, 0x109, 0x109, 0x00, 0x65}, - {0x10a, 0x00, 0x10a, 0x10a, 0x10a, 0x00, 0x66}, // PF10 - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} -}; - - -void fm7_state::main_irq_set_flag(UINT8 flag) -{ - m_irq_flags |= flag; - - if(m_irq_flags != 0) - m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE); -} - -void fm7_state::main_irq_clear_flag(UINT8 flag) -{ - m_irq_flags &= ~flag; - - if(m_irq_flags == 0) - m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE); -} - - -void fm7_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_FM7_BEEPER_OFF: - fm7_beeper_off(ptr, param); - break; - case TIMER_FM77AV_ENCODER_ACK: - fm77av_encoder_ack(ptr, param); - break; - case TIMER_FM7_IRQ: - fm7_timer_irq(ptr, param); - break; - case TIMER_FM7_SUBTIMER_IRQ: - fm7_subtimer_irq(ptr, param); - break; - case TIMER_FM7_KEYBOARD_POLL: - fm7_keyboard_poll(ptr, param); - break; - case TIMER_FM77AV_ALU_TASK_END: - fm77av_alu_task_end(ptr, param); - break; - case TIMER_FM77AV_VSYNC: - fm77av_vsync(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in fm7_state::device_timer"); - } -} - - -/* - * Main CPU: I/O port 0xfd02 - * - * On read: returns cassette data (bit 7) and printer status (bits 0-5) - * On write: sets IRQ masks - * bit 0 - keypress - * bit 1 - printer - * bit 2 - timer - * bit 3 - not used - * bit 4 - MFD - * bit 5 - TXRDY - * bit 6 - RXRDY - * bit 7 - SYNDET - * - */ -WRITE8_MEMBER(fm7_state::fm7_irq_mask_w) -{ - m_irq_mask = data; - logerror("IRQ mask set: 0x%02x\n",m_irq_mask); -} - -/* - * Main CPU: I/O port 0xfd03 - * - * On read: returns which IRQ is currently active (typically read by IRQ handler) - * bit 0 - keypress - * bit 1 - printer - * bit 2 - timer - * bit 3 - ??? - * On write: Buzzer/Speaker On/Off - * bit 0 - speaker on/off - * bit 6 - buzzer on for 205ms - * bit 7 - buzzer on/off - */ -READ8_MEMBER(fm7_state::fm7_irq_cause_r) -{ - UINT8 ret = ~m_irq_flags; - - // Timer and Printer IRQ flags are cleared when this port is read - // Keyboard IRQ flag is cleared when the scancode is read from - // either keyboard data port (main CPU 0xfd01 or sub CPU 0xd401) - if(m_irq_flags & 0x04) - main_irq_clear_flag(IRQ_FLAG_TIMER); - if(m_irq_flags & 0x02) - main_irq_clear_flag(IRQ_FLAG_PRINTER); - - logerror("IRQ flags read: 0x%02x\n",ret); - return ret; -} - -TIMER_CALLBACK_MEMBER(fm7_state::fm7_beeper_off) -{ - m_beeper->set_state(0); - logerror("timed beeper off\n"); -} - -WRITE8_MEMBER(fm7_state::fm7_beeper_w) -{ - m_speaker_active = data & 0x01; - - if(!m_speaker_active) // speaker not active, disable all beeper sound - { - m_beeper->set_state(0); - return; - } - - if(data & 0x80) - { - if(m_speaker_active) - m_beeper->set_state(1); - } - else - m_beeper->set_state(0); - - if(data & 0x40) - { - if(m_speaker_active) - { - m_beeper->set_state(1); - logerror("timed beeper on\n"); - timer_set(attotime::from_msec(205), TIMER_FM7_BEEPER_OFF); - } - } - logerror("beeper state: %02x\n",data); -} - - -/* - * Sub CPU: port 0xd403 (read-only) - * On read: timed buzzer sound - */ -READ8_MEMBER(fm7_state::fm7_sub_beeper_r) -{ - if(m_speaker_active) - { - m_beeper->set_state(1); - logerror("timed beeper on\n"); - timer_set(attotime::from_msec(205), TIMER_FM7_BEEPER_OFF); - } - return 0xff; -} - -READ8_MEMBER(fm7_state::vector_r) -{ - UINT8* RAM = memregion("maincpu")->base(); - UINT8* ROM = memregion("init")->base(); - UINT32 init_size = memregion("init")->bytes(); - - if(m_init_rom_en) - return ROM[(init_size-0x10)+offset]; - else - { - if(m_type == SYS_FM7) - return RAM[0xfff0+offset]; - else - return RAM[0x3fff0+offset]; - } -} - -WRITE8_MEMBER(fm7_state::vector_w) -{ - UINT8* RAM = memregion("maincpu")->base(); - - if(m_type == SYS_FM7) - RAM[0xfff0+offset] = data; - else - RAM[0x3fff0+offset] = data; -} - -/* - * Main CPU: I/O port 0xfd04 - * - * bit 0 - attention IRQ active, clears flag when read. - * bit 1 - break key active - */ -READ8_MEMBER(fm7_state::fm7_fd04_r) -{ - UINT8 ret = 0xff; - - if(m_video.attn_irq != 0) - { - ret &= ~0x01; - m_video.attn_irq = 0; - } - if(m_break_flag != 0) - { - ret &= ~0x02; - } - return ret; -} - -/* - * Main CPU: I/O port 0xfd0f - * - * On read, enables BASIC ROM at 0x8000 (default) - * On write, disables BASIC ROM, enables RAM (if more than 32kB) - */ -READ8_MEMBER(fm7_state::fm7_rom_en_r) -{ - if(!space.debugger_access()) - { - UINT8* RAM = memregion("maincpu")->base(); - - m_basic_rom_en = 1; - if(m_type == SYS_FM7) - { - membank("bank1")->set_base(RAM+0x38000); - } - else - fm7_mmr_refresh(space); - logerror("BASIC ROM enabled\n"); - } - return 0x00; -} - -WRITE8_MEMBER(fm7_state::fm7_rom_en_w) -{ - UINT8* RAM = memregion("maincpu")->base(); - - m_basic_rom_en = 0; - if(m_type == SYS_FM7) - { - membank("bank1")->set_base(RAM+0x8000); - } - else - fm7_mmr_refresh(space); - logerror("BASIC ROM disabled\n"); -} - -/* - * Main CPU: port 0xfd10 - * Initiate ROM enable. (FM-77AV and later only) - * Port is write-only. Initiate ROM is on by default. - * - */ -WRITE8_MEMBER(fm7_state::fm7_init_en_w) -{ - if(data & 0x02) - { - m_init_rom_en = 0; - fm7_mmr_refresh(space); - } - else - { - m_init_rom_en = 1; - fm7_mmr_refresh(space); - } -} - -/* - * Main CPU: I/O ports 0xfd18 - 0xfd1f - * Floppy Disk Controller (MB8877A) - */ -WRITE_LINE_MEMBER(fm7_state::fm7_fdc_intrq_w) -{ - m_fdc_irq_flag = state; -} - -WRITE_LINE_MEMBER(fm7_state::fm7_fdc_drq_w) -{ - m_fdc_drq_flag = state; -} - -READ8_MEMBER(fm7_state::fm7_fdc_r) -{ - UINT8 ret = 0; - - switch(offset) - { - case 0: - return m_fdc->status_r(space, offset); - case 1: - return m_fdc->track_r(space, offset); - case 2: - return m_fdc->sector_r(space, offset); - case 3: - return m_fdc->data_r(space, offset); - case 4: - return m_fdc_side | 0xfe; - case 5: - return m_fdc_drive; - case 6: - // FM-7 always returns 0xff for this register - return 0xff; - case 7: - if(m_fdc_irq_flag != 0) - ret |= 0x40; - if(m_fdc_drq_flag != 0) - ret |= 0x80; - return ret; - } - logerror("FDC: read from 0x%04x\n",offset+0xfd18); - - return 0x00; -} - -WRITE8_MEMBER(fm7_state::fm7_fdc_w) -{ - switch(offset) - { - case 0: - m_fdc->cmd_w(space, offset,data); - break; - case 1: - m_fdc->track_w(space, offset,data); - break; - case 2: - m_fdc->sector_w(space, offset,data); - break; - case 3: - m_fdc->data_w(space, offset,data); - break; - case 4: - m_fdc_side = data & 0x01; - if (m_floppy) - m_floppy->ss_w(data & 0x01); - logerror("FDC: wrote %02x to 0x%04x (side)\n",data,offset+0xfd18); - break; - case 5: - m_fdc_drive = data; - if((data & 0x03) > 0x01) - { - m_fdc_drive = 0; - } - else - { - switch (data & 0x01) - { - case 0: m_floppy = m_floppy0->get_device(); break; - case 1: m_floppy = m_floppy1->get_device(); break; - } - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) - m_floppy->mon_w(!BIT(data, 7)); - - logerror("FDC: wrote %02x to 0x%04x (drive)\n",data,offset+0xfd18); - } - break; - case 6: - // FM77AV and later only. FM-7 returns 0xff; - // bit 6 = 320k(1)/640k(0) FDD - // bits 2,3 = logical drive - logerror("FDC: mode write - %02x\n",data); - break; - default: - logerror("FDC: wrote %02x to 0x%04x\n",data,offset+0xfd18); - } -} - -/* - * Main CPU: I/O ports 0xfd00-0xfd01 - * Sub CPU: I/O ports 0xd400-0xd401 - * - * The scancode of the last key pressed is stored in fd/d401, with the 9th - * bit (MSB) in bit 7 of fd/d400. 0xfd00 also holds a flag for the main - * CPU clock speed in bit 0 (0 = 1.2MHz, 1 = 2MHz) - * Clears keyboard IRQ flag - */ -READ8_MEMBER(fm7_state::fm7_keyboard_r) -{ - UINT8 ret; - switch(offset) - { - case 0: - ret = (m_current_scancode >> 1) & 0x80; - ret |= 0x01; // 1 = 2MHz, 0 = 1.2MHz - return ret; - case 1: - main_irq_clear_flag(IRQ_FLAG_KEY); - return m_current_scancode & 0xff; - default: - return 0x00; - } -} - -READ8_MEMBER(fm7_state::fm7_sub_keyboard_r) -{ - UINT8 ret; - switch(offset) - { - case 0: - ret = (m_current_scancode >> 1) & 0x80; - return ret; - case 1: - main_irq_clear_flag(IRQ_FLAG_KEY); - return m_current_scancode & 0xff; - default: - return 0x00; - } -} - -/* - * Sub CPU: port 0xd431, 0xd432 - * Keyboard encoder - * - * d431 (R/W): Data register (8 bit) - * d432 (R/O): Status register - * bit 0 - ACK - * bit 7 - LATCH (0 if ready to receive) - * - * Encoder commands: - * 00 xx : Set scancode format (FM-7, FM16B(?), Scan(Make/Break)) - * 01 : Get scancode format - * 02 xx : Set LED status - * 03 : Get LED status - * 04 xx : Enable/Disable key repeat - * 05 xx xx : Set repeat rate and time - * 80 00 : Get RTC - * 80 01 xx xx xx xx xx xx xx : Set RTC - * 81 xx : Video digitise - * 82 xx : Set video mode(?) - * 83 : Get video mode(?) - * 84 xx : Video brightness (monitor?) - * - * ACK is received after 5us. - */ -READ8_MEMBER(fm7_state::fm77av_key_encoder_r) -{ - UINT8 ret = 0xff; - switch(offset) - { - case 0x00: // data register - if(m_encoder.rx_count > 0) - { - ret = m_encoder.buffer[m_encoder.position]; - m_encoder.position++; - m_encoder.rx_count--; - m_encoder.latch = 0; - } - if(m_encoder.rx_count > 0) - m_encoder.latch = 1; // more data to receive - break; - case 0x01: // status register - if(m_encoder.latch != 0) - ret &= ~0x80; - if(m_encoder.ack == 0) - ret &= ~0x01; - break; - } - - return ret; -} - -void fm7_state::fm77av_encoder_setup_command() -{ - switch(m_encoder.buffer[0]) - { - case 0: // set scancode format - m_encoder.tx_count = 2; - break; - case 1: // get scancode format - m_encoder.tx_count = 1; - break; - case 2: // set LED - m_encoder.tx_count = 2; - break; - case 3: // get LED - m_encoder.tx_count = 1; - break; - case 4: // enable repeat - m_encoder.tx_count = 2; - break; - case 5: // set repeat rate - m_encoder.tx_count = 3; - break; - case 0x80: // get/set RTC (at least two bytes, 9 if byte two = 0x01) - m_encoder.tx_count = 2; - break; - case 0x81: // digitise - m_encoder.tx_count = 2; - break; - case 0x82: // set screen mode - m_encoder.tx_count = 2; - break; - case 0x83: // get screen mode - m_encoder.tx_count = 1; - break; - case 0x84: // set monitor brightness - m_encoder.tx_count = 2; - break; - default: - m_encoder.tx_count = 0; - m_encoder.rx_count = 0; - m_encoder.position = 0; - logerror("ENC: Unknown command 0x%02x sent, ignoring\n",m_encoder.buffer[0]); - } -} - -TIMER_CALLBACK_MEMBER(fm7_state::fm77av_encoder_ack) -{ - m_encoder.ack = 1; -} - -void fm7_state::fm77av_encoder_handle_command() -{ - switch(m_encoder.buffer[0]) - { - case 0: // set keyboard scancode mode - m_key_scan_mode = m_encoder.buffer[1]; - m_encoder.rx_count = 0; - logerror("ENC: Keyboard set to mode %i\n",m_encoder.buffer[1]); - break; - case 1: // get keyboard scancode mode - m_encoder.buffer[0] = m_key_scan_mode; - m_encoder.rx_count = 1; - logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); - break; - case 2: // set LEDs - m_encoder.rx_count = 0; - logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); - break; - case 3: // get LEDs - m_encoder.rx_count = 1; - logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); - break; - case 4: // enable key repeat - m_encoder.rx_count = 0; - logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); - break; - case 5: // set key repeat rate - m_key_repeat = m_encoder.buffer[2] * 10; - m_key_delay = m_encoder.buffer[1] * 10; - m_encoder.rx_count = 0; - logerror("ENC: Keyboard repeat rate set to %i/%i\n",m_encoder.buffer[1],m_encoder.buffer[2]); - break; - case 0x80: // get/set RTC - if(m_encoder.buffer[1] == 0x01) - m_encoder.rx_count = 0; - else - m_encoder.rx_count = 7; - logerror("ENC: Command %02x %02x received\n",m_encoder.buffer[0],m_encoder.buffer[1]); - break; - case 0x81: // digitise - m_encoder.rx_count = 0; - logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); - break; - case 0x82: // set screen mode - m_encoder.rx_count = 0; - logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); - break; - case 0x83: // get screen mode - m_encoder.rx_count = 1; - logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); - break; - case 0x84: // set monitor brightness - m_encoder.rx_count = 0; - logerror("ENC: Command %02x received\n",m_encoder.buffer[0]); - break; - } - m_encoder.position = 0; -} - -WRITE8_MEMBER(fm7_state::fm77av_key_encoder_w) -{ - m_encoder.ack = 0; - if(offset == 0) // data register - { - if(m_encoder.position == 0) // first byte - { - fm77av_encoder_setup_command(); - } - if(m_encoder.position == 1) // second byte - { - if(m_encoder.buffer[0] == 0x80 || m_encoder.buffer[1] == 0x01) - { - m_encoder.tx_count = 8; // 80 01 command is 9 bytes - } - } - m_encoder.buffer[m_encoder.position] = data; - m_encoder.position++; - m_encoder.tx_count--; - if(m_encoder.tx_count == 0) // last byte - fm77av_encoder_handle_command(); - - // wait 5us to set ACK flag - timer_set(attotime::from_usec(5), TIMER_FM77AV_ENCODER_ACK); - - //logerror("ENC: write 0x%02x to data register, moved to pos %i\n",data,m_encoder.position); - } -} - -WRITE_LINE_MEMBER(fm7_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER(fm7_state::write_centronics_fault) -{ - m_centronics_fault = state; -} - -WRITE_LINE_MEMBER(fm7_state::write_centronics_ack) -{ - m_centronics_ack = state; -} - -WRITE_LINE_MEMBER(fm7_state::write_centronics_perror) -{ - m_centronics_perror = state; -} - -READ8_MEMBER(fm7_state::fm7_cassette_printer_r) -{ - // bit 7: cassette input - // bit 5: printer DET2 - // bit 4: printer DTT1 - // bit 3: printer PE - // bit 2: printer acknowledge - // bit 1: printer error - // bit 0: printer busy - UINT8 ret = 0; - - if(m_cassette->input() > 0.03) - ret |= 0x80; - - if(m_cassette->get_state() & CASSETTE_MOTOR_DISABLED) - ret |= 0x80; // cassette input is high when not in use. - - ret |= 0x70; - ret |= m_centronics_perror << 3; - ret |= m_centronics_ack << 2; - ret |= m_centronics_fault << 1; - ret |= m_centronics_busy; - - return ret; -} - -WRITE8_MEMBER(fm7_state::fm7_cassette_printer_w) -{ - switch(offset) - { - case 0: - // bit 7: SLCTIN (select?) - // bit 6: printer strobe - // bit 1: cassette motor - // bit 0: cassette output - if((data & 0x01) != (m_cp_prev & 0x01)) - m_cassette->output((data & 0x01) ? +1.0 : -1.0); - if((data & 0x02) != (m_cp_prev & 0x02)) - m_cassette->change_state((data & 0x02) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - - m_centronics->write_strobe(!BIT(data,6)); - m_centronics->write_select_in(!BIT(data,7)); - m_cp_prev = data; - break; - case 1: - // Printer data - m_cent_data_out->write(space, 0, data); - break; - } -} - -/* - * Main CPU: 0xfd0b - * - bit 0: Boot mode: 0=BASIC, 1=DOS - */ -READ8_MEMBER(fm7_state::fm77av_boot_mode_r) -{ - UINT8 ret = 0xff; - - if(m_dsw->read() & 0x02) - ret &= ~0x01; - - return ret; -} - -/* - * Main CPU: I/O ports 0xfd0d-0xfd0e - * PSG AY-3-891x (FM-7), YM2203 - (FM-77AV and later) - * 0xfd0d - function select (bit 1 = BDIR, bit 0 = BC1) - * 0xfd0e - data register - * AY I/O ports are not connected to anything. - */ -void fm7_state::fm7_update_psg() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - if(m_type == SYS_FM7) - { - switch(m_psg_regsel) - { - case 0x00: - // High impedance - break; - case 0x01: - // Data read - m_psg_data = m_psg->data_r(space, 0); - break; - case 0x02: - // Data write - m_psg->data_w(space, 0,m_psg_data); - break; - case 0x03: - // Address latch - m_psg->address_w(space, 0,m_psg_data); - break; - } - } - else - { // FM-77AV and later use a YM2203 - switch(m_psg_regsel) - { - case 0x00: - // High impedance - break; - case 0x01: - // Data read - m_psg_data = m_ym->read(space, 1); - break; - case 0x02: - // Data write - m_ym->write(space, 1,m_psg_data); - logerror("YM: data write 0x%02x\n",m_psg_data); - break; - case 0x03: - // Address latch - m_ym->write(space, 0,m_psg_data); - logerror("YM: address latch 0x%02x\n",m_psg_data); - break; - case 0x04: - // Status register - m_psg_data = m_ym->read(space, 0); - break; - case 0x09: - // Joystick port read - m_psg_data = m_joy1->read(); - break; - } - } -} - -READ8_MEMBER(fm7_state::fm7_psg_select_r) -{ - return 0xff; -} - -WRITE8_MEMBER(fm7_state::fm7_psg_select_w) -{ - m_psg_regsel = data & 0x03; - fm7_update_psg(); -} - -WRITE8_MEMBER(fm7_state::fm77av_ym_select_w) -{ - m_psg_regsel = data & 0x0f; - fm7_update_psg(); -} - -READ8_MEMBER(fm7_state::fm7_psg_data_r) -{ -// fm7_update_psg(); - return m_psg_data; -} - -WRITE8_MEMBER(fm7_state::fm7_psg_data_w) -{ - m_psg_data = data; -// fm7_update_psg(); -} - -WRITE8_MEMBER(fm7_state::fm77av_bootram_w) -{ - if(!(m_mmr.mode & 0x01)) - return; - m_boot_ram[offset] = data; -} - -// Shared RAM is only usable on the main CPU if the sub CPU is halted -READ8_MEMBER(fm7_state::fm7_main_shared_r) -{ - if(m_video.sub_halt != 0) - return m_shared_ram[offset]; - else - return 0xff; -} - -WRITE8_MEMBER(fm7_state::fm7_main_shared_w) -{ - if(m_video.sub_halt != 0) - m_shared_ram[offset] = data; -} - -READ8_MEMBER(fm7_state::fm7_fmirq_r) -{ - UINT8 ret = 0xff; - - if(m_fm77av_ym_irq != 0) - ret &= ~0x08; - - return ret; -} - -READ8_MEMBER(fm7_state::fm77av_joy_1_r) -{ - return m_joy1->read(); -} - -READ8_MEMBER(fm7_state::fm77av_joy_2_r) -{ - return m_joy2->read(); -} - -READ8_MEMBER(fm7_state::fm7_unknown_r) -{ - // Port 0xFDFC is read by Dig Dug. Controller port, perhaps? - // Must return 0xff for it to read the keyboard. - // Mappy uses ports FD15 and FD16. On the FM77AV, this is the YM2203, - // but on the FM-7, this is nothing, so we return 0xff for it to - // read the keyboard correctly. - return 0xff; -} - -/* - * Memory Management Register - * Main CPU: 0xfd80 - 0xfd93 (FM-77L4, FM-77AV and later only) - * - * fd80-fd8f (R/W): RAM bank select for current segment (A19-A12) - * fd90 (W/O): segment select register (3-bit, default = 0) - * fd92 (W/O): window offset register (OA15-OA8) - * fd93 (R/W): mode select register - * - bit 7: MMR enable/disable - * - bit 6: window enable/disable - * - bit 0: boot RAM read-write/read-only - * - */ -READ8_MEMBER(fm7_state::fm7_mmr_r) -{ - if(offset < 0x10) - { - return m_mmr.bank_addr[m_mmr.segment][offset]; - } - if(offset == 0x13) - return m_mmr.mode; - return 0xff; -} - -void fm7_state::fm7_update_bank(address_space & space, int bank, UINT8 physical) -{ - address_map_bank_device* avbank[16] = { m_avbank1, m_avbank2, m_avbank3, m_avbank4, m_avbank5, m_avbank6, m_avbank7 - , m_avbank8, m_avbank9, m_avbank10, m_avbank11, m_avbank12, m_avbank13, m_avbank14, m_avbank15, m_avbank16 }; - - avbank[bank]->set_bank(physical); -/* UINT8* RAM = memregion("maincpu")->base(); - UINT16 size = 0xfff; - char bank_name[10]; - - if(bank == 15) - size = 0xbff; - - sprintf(bank_name,"bank%d",bank+1); - - if(physical >= 0x10 && physical <= 0x1b) - { - switch(physical) - { - case 0x10: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram0_r),this),write8_delegate(FUNC(fm7_state::fm7_vram0_w),this)); - break; - case 0x11: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram1_r),this),write8_delegate(FUNC(fm7_state::fm7_vram1_w),this)); - break; - case 0x12: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram2_r),this),write8_delegate(FUNC(fm7_state::fm7_vram2_w),this)); - break; - case 0x13: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram3_r),this),write8_delegate(FUNC(fm7_state::fm7_vram3_w),this)); - break; - case 0x14: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram4_r),this),write8_delegate(FUNC(fm7_state::fm7_vram4_w),this)); - break; - case 0x15: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram5_r),this),write8_delegate(FUNC(fm7_state::fm7_vram5_w),this)); - break; - case 0x16: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram6_r),this),write8_delegate(FUNC(fm7_state::fm7_vram6_w),this)); - break; - case 0x17: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram7_r),this),write8_delegate(FUNC(fm7_state::fm7_vram7_w),this)); - break; - case 0x18: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram8_r),this),write8_delegate(FUNC(fm7_state::fm7_vram8_w),this)); - break; - case 0x19: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vram9_r),this),write8_delegate(FUNC(fm7_state::fm7_vram9_w),this)); - break; - case 0x1a: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vramA_r),this),write8_delegate(FUNC(fm7_state::fm7_vramA_w),this)); - break; - case 0x1b: - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vramB_r),this),write8_delegate(FUNC(fm7_state::fm7_vramB_w),this)); - break; - } -// membank(bank+1)->set_base(RAM+(physical<<12)-0x10000); - return; - } - if(physical == 0x1c) - { - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_console_ram_banked_r),this),write8_delegate(FUNC(fm7_state::fm7_console_ram_banked_w),this)); - return; - } - if(physical == 0x1d) - { - space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_sub_ram_ports_banked_r),this),write8_delegate(FUNC(fm7_state::fm7_sub_ram_ports_banked_w),this)); - return; - } - if(physical == 0x35) - { - if(m_init_rom_en && (m_type == SYS_FM11 || m_type == SYS_FM16)) - { - RAM = memregion("init")->base(); - space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); - space.nop_write(bank*0x1000,(bank*0x1000)+size); - membank(bank_name)->set_base(RAM+(physical<<12)-0x35000); - return; - } - } - if(physical == 0x36 || physical == 0x37) - { - if(m_init_rom_en && (m_type != SYS_FM11 && m_type != SYS_FM16)) - { - RAM = memregion("init")->base(); - space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); - space.nop_write(bank*0x1000,(bank*0x1000)+size); - membank(bank_name)->set_base(RAM+(physical<<12)-0x36000); - return; - } - } - if(physical > 0x37 && physical <= 0x3f) - { - if(m_basic_rom_en && (m_type != SYS_FM11 && m_type != SYS_FM16)) - { - RAM = memregion("fbasic")->base(); - space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); - space.nop_write(bank*0x1000,(bank*0x1000)+size); - membank(bank_name)->set_base(RAM+(physical<<12)-0x38000); - return; - } - } - space.install_readwrite_bank(bank*0x1000,(bank*0x1000)+size,bank_name); - membank(bank_name)->set_base(RAM+(physical<<12)); - */ -} - -void fm7_state::fm7_mmr_refresh(address_space& space) -{ - int x; - UINT16 window_addr; - UINT8* RAM = memregion("maincpu")->base(); - - if(m_mmr.enabled) - { - for(x=0;x<16;x++) - fm7_update_bank(space,x,m_mmr.bank_addr[m_mmr.segment][x]); - } - else - { - // when MMR is disabled, 0x30000-0x3ffff is banked in - for(x=0;x<16;x++) - fm7_update_bank(space,x,0x30+x); - } - - if(m_mmr.mode & 0x40) - { - // Handle window offset - 0x7c00-0x7fff will show the area of extended - // memory (0x00000-0x0ffff) defined by the window address register - // 0x00 = 0x07c00, 0x04 = 0x08000 ... 0xff = 0x07400. - window_addr = ((m_mmr.window_offset << 8) + 0x7c00) & 0xffff; -// if(window_addr < 0xfc00) - { - space.install_readwrite_bank(0x7c00,0x7fff,"bank24"); - membank("bank24")->set_base(RAM+window_addr); - } - } - else - { - space.install_readwrite_handler(0x7000,0x7fff,read8_delegate(FUNC(address_map_bank_device::read8),(address_map_bank_device*)m_avbank8),write8_delegate(FUNC(address_map_bank_device::write8),(address_map_bank_device*)m_avbank8)); - } - if(m_init_rom_en) - { - UINT8* ROM = memregion("init")->base(); - membank("init_bank_r")->set_base(ROM); - } - else - { - membank("init_bank_r")->set_base(RAM+0x36000); - } - if(m_basic_rom_en) - { - UINT8* ROM = memregion("fbasic")->base(); - if(ROM != NULL) - membank("fbasic_bank_r")->set_base(ROM); - } - else - { - membank("fbasic_bank_r")->set_base(RAM+0x38000); - } -} - -WRITE8_MEMBER(fm7_state::fm7_mmr_w) -{ - if(offset < 0x10) - { - m_mmr.bank_addr[m_mmr.segment][offset] = data; - if(m_mmr.enabled) - fm7_update_bank(space,offset,data); - logerror("MMR: Segment %i, bank %i, set to 0x%02x\n",m_mmr.segment,offset,data); - return; - } - switch(offset) - { - case 0x10: - m_mmr.segment = data & 0x07; - fm7_mmr_refresh(space); - logerror("MMR: Active segment set to %i\n",m_mmr.segment); - break; - case 0x12: - m_mmr.window_offset = data; - fm7_mmr_refresh(space); - logerror("MMR: Window offset set to %02x\n",data); - break; - case 0x13: - m_mmr.mode = data; - m_mmr.enabled = data & 0x80; - fm7_mmr_refresh(space); - logerror("MMR: Mode register set to %02x\n",data); - break; - } -} - -/* - * Main CPU: ports 0xfd20-0xfd23 - * Kanji ROM read ports - * FD20 (W/O): ROM address high - * FD21 (W/O): ROM address low - * FD22 (R/O): Kanji data high - * FD23 (R/O): Kanji data low - * - * Kanji ROM is visible at 0x20000 (first half only?) - */ -READ8_MEMBER(fm7_state::fm7_kanji_r) -{ - UINT8* KROM = m_kanji->base(); - UINT32 addr = m_kanji_address << 1; - - switch(offset) - { - case 0: - case 1: - logerror("KANJI: read from invalid register %i\n",offset); - return 0xff; // write-only - case 2: - return KROM[addr]; - case 3: - return KROM[addr+1]; - default: - logerror("KANJI: read from invalid register %i\n",offset); - return 0xff; - } -} - -WRITE8_MEMBER(fm7_state::fm7_kanji_w) -{ - UINT16 addr; - - switch(offset) - { - case 0: - addr = ((data & 0xff) << 8) | (m_kanji_address & 0x00ff); - m_kanji_address = addr; - break; - case 1: - addr = (data & 0xff) | (m_kanji_address & 0xff00); - m_kanji_address = addr; - break; - case 2: - case 3: - default: - logerror("KANJI: write to invalid register %i\n",offset); - } -} - -TIMER_CALLBACK_MEMBER(fm7_state::fm7_timer_irq) -{ - if(m_irq_mask & IRQ_FLAG_TIMER) - { - main_irq_set_flag(IRQ_FLAG_TIMER); - } -} - -TIMER_CALLBACK_MEMBER(fm7_state::fm7_subtimer_irq) -{ - if(m_video.nmi_mask == 0 && m_video.sub_halt == 0) - m_sub->set_input_line(INPUT_LINE_NMI,PULSE_LINE); -} - -// When a key is pressed or released (in scan mode only), an IRQ is generated on the main CPU, -// or an FIRQ on the sub CPU, if masked. Both CPUs have ports to read keyboard data. -// Scancodes are 9 bits in FM-7 mode, 8 bits in scan mode. -void fm7_state::key_press(UINT16 scancode) -{ - m_current_scancode = scancode; - - if(scancode == 0) - return; - - if(m_irq_mask & IRQ_FLAG_KEY) - { - main_irq_set_flag(IRQ_FLAG_KEY); - } - else - { - m_sub->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); - } - logerror("KEY: sent scancode 0x%03x\n",scancode); -} - -void fm7_state::fm7_keyboard_poll_scan() -{ - ioport_port* portnames[3] = { m_key1, m_key2, m_key3 }; - int bit = 0; - int x,y; - UINT32 keys; - UINT32 modifiers = m_keymod->read(); - static const UINT16 modscancodes[6] = { 0x52, 0x53, 0x54, 0x55, 0x56, 0x5a }; - - for(x=0;x<3;x++) - { - keys = portnames[x]->read(); - - for(y=0;y<32;y++) // loop through each bit in the port - { - if((keys & (1<read(); - - if(m_key3->read() & 0x40000) - { - m_break_flag = 1; - m_maincpu->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); - } - else - m_break_flag = 0; - - if(m_key_scan_mode == KEY_MODE_SCAN) - { - // handle scancode mode - fm7_keyboard_poll_scan(); - return; - } - - // check key modifiers (Shift, Ctrl, Kana, etc...) - if(modifiers & 0x02 || modifiers & 0x04) - mod = 1; // shift - if(modifiers & 0x10) - mod = 3; // Graph (shift has no effect with graph) - if(modifiers & 0x01) - mod = 2; // ctrl (overrides shift, if also pressed) - if(modifiers & 0x20) - mod = 4; // kana (overrides all) - if((modifiers & 0x22) == 0x22 || (modifiers & 0x24) == 0x24) - mod = 5; // shifted kana - - for(x=0;x<3;x++) - { - keys = portnames[x]->read(); - - for(y=0;y<32;y++) // loop through each bit in the port - { - if((keys & (1<set_input_line(irqline,CLEAR_LINE); - return -1; -} - -IRQ_CALLBACK_MEMBER(fm7_state::fm7_sub_irq_ack) -{ - m_sub->set_input_line(irqline,CLEAR_LINE); - return -1; -} - -WRITE_LINE_MEMBER(fm7_state::fm77av_fmirq) -{ - if(state == 1) - { - // cannot be masked - main_irq_set_flag(IRQ_FLAG_OTHER); - m_fm77av_ym_irq = 1; - logerror("YM: IRQ on\n"); - } - else - { - main_irq_clear_flag(IRQ_FLAG_OTHER); - m_fm77av_ym_irq = 0; - logerror("YM: IRQ off\n"); - } -} - -/* - 0000 - 7FFF: (RAM) BASIC working area, user's area - 8000 - FBFF: (ROM) F-BASIC ROM, extra user RAM - FC00 - FC7F: more RAM, if 64kB is installed - FC80 - FCFF: Shared RAM between main and sub CPU, available only when sub CPU is halted - FD00 - FDFF: I/O space (6809 uses memory-mapped I/O) - FE00 - FFEF: Boot rom - FFF0 - FFFF: Interrupt vector table -*/ -// The FM-7 has only 64kB RAM, so we'll worry about banking when we do the later models -static ADDRESS_MAP_START( fm7_mem, AS_PROGRAM, 8, fm7_state ) - AM_RANGE(0x0000,0x7fff) AM_RAM - AM_RANGE(0x8000,0xfbff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") // also F-BASIC ROM, when enabled - AM_RANGE(0xfc00,0xfc7f) AM_RAM - AM_RANGE(0xfc80,0xfcff) AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) - // I/O space (FD00-FDFF) - AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) - AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask - AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags - AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) - AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) - AM_RANGE(0xfd06,0xfd0c) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd0d,0xfd0d) AM_READWRITE(fm7_psg_select_r,fm7_psg_select_w) - AM_RANGE(0xfd0e,0xfd0e) AM_READWRITE(fm7_psg_data_r, fm7_psg_data_w) - AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) - AM_RANGE(0xfd10,0xfd17) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) - AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) - AM_RANGE(0xfd24,0xfd36) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) - AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) - AM_RANGE(0xfd40,0xfdff) AM_READ(fm7_unknown_r) - // Boot ROM - AM_RANGE(0xfe00,0xffdf) AM_ROMBANK("bank17") - AM_RANGE(0xffe0,0xffef) AM_RAM - AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm8_mem, AS_PROGRAM, 8, fm7_state ) - AM_RANGE(0x0000,0x7fff) AM_RAM - AM_RANGE(0x8000,0xfbff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") // also F-BASIC ROM, when enabled - AM_RANGE(0xfc00,0xfc7f) AM_RAM - AM_RANGE(0xfc80,0xfcff) AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) - // I/O space (FD00-FDFF) - AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) - AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask - AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags - AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) - AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) - AM_RANGE(0xfd06,0xfd0c) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) - AM_RANGE(0xfd10,0xfd17) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) - AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) - AM_RANGE(0xfd24,0xfd36) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) - AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) - AM_RANGE(0xfd40,0xfdff) AM_READ(fm7_unknown_r) - // Boot ROM - AM_RANGE(0xfe00,0xffdf) AM_ROMBANK("bank17") - AM_RANGE(0xffe0,0xffef) AM_RAM - AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) -ADDRESS_MAP_END - -/* - 0000 - 3FFF: Video RAM bank 0 (Blue plane) - 4000 - 7FFF: Video RAM bank 1 (Red plane) - 8000 - BFFF: Video RAM bank 2 (Green plane) - D000 - D37F: (RAM) working area - D380 - D3FF: Shared RAM between main and sub CPU - D400 - D4FF: I/O ports - D800 - FFDF: (ROM) Graphics command code - FFF0 - FFFF: Interrupt vector table -*/ - -static ADDRESS_MAP_START( fm7_sub_mem, AS_PROGRAM, 8, fm7_state ) - AM_RANGE(0x0000,0xbfff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM - AM_RANGE(0xc000,0xcfff) AM_RAM // Console RAM - AM_RANGE(0xd000,0xd37f) AM_RAM // Work RAM - AM_RANGE(0xd380,0xd3ff) AM_RAM AM_SHARE("shared_ram") - // I/O space (D400-D4FF) - AM_RANGE(0xd400,0xd401) AM_READ(fm7_sub_keyboard_r) - AM_RANGE(0xd402,0xd402) AM_READ(fm7_cancel_ack) - AM_RANGE(0xd403,0xd403) AM_READ(fm7_sub_beeper_r) - AM_RANGE(0xd404,0xd404) AM_READ(fm7_attn_irq_r) - AM_RANGE(0xd408,0xd408) AM_READWRITE(fm7_crt_r,fm7_crt_w) - AM_RANGE(0xd409,0xd409) AM_READWRITE(fm7_vram_access_r,fm7_vram_access_w) - AM_RANGE(0xd40a,0xd40a) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) - AM_RANGE(0xd40e,0xd40f) AM_WRITE(fm7_vram_offset_w) - AM_RANGE(0xd800,0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm11_mem, AS_PROGRAM, 8, fm7_state ) - AM_RANGE(0x0000,0x0fff) AM_DEVREADWRITE("av_bank1", address_map_bank_device, read8, write8) - AM_RANGE(0x1000,0x1fff) AM_DEVREADWRITE("av_bank2", address_map_bank_device, read8, write8) - AM_RANGE(0x2000,0x2fff) AM_DEVREADWRITE("av_bank3", address_map_bank_device, read8, write8) - AM_RANGE(0x3000,0x3fff) AM_DEVREADWRITE("av_bank4", address_map_bank_device, read8, write8) - AM_RANGE(0x4000,0x4fff) AM_DEVREADWRITE("av_bank5", address_map_bank_device, read8, write8) - AM_RANGE(0x5000,0x5fff) AM_DEVREADWRITE("av_bank6", address_map_bank_device, read8, write8) - AM_RANGE(0x6000,0x6fff) AM_DEVREADWRITE("av_bank7", address_map_bank_device, read8, write8) - AM_RANGE(0x7000,0x7fff) AM_DEVREADWRITE("av_bank8", address_map_bank_device, read8, write8) - AM_RANGE(0x8000,0x8fff) AM_DEVREADWRITE("av_bank9", address_map_bank_device, read8, write8) - AM_RANGE(0x9000,0x9fff) AM_DEVREADWRITE("av_bank10", address_map_bank_device, read8, write8) - AM_RANGE(0xa000,0xafff) AM_DEVREADWRITE("av_bank11", address_map_bank_device, read8, write8) - AM_RANGE(0xb000,0xbfff) AM_DEVREADWRITE("av_bank12", address_map_bank_device, read8, write8) - AM_RANGE(0xc000,0xcfff) AM_DEVREADWRITE("av_bank13", address_map_bank_device, read8, write8) - AM_RANGE(0xd000,0xdfff) AM_DEVREADWRITE("av_bank14", address_map_bank_device, read8, write8) - AM_RANGE(0xe000,0xefff) AM_DEVREADWRITE("av_bank15", address_map_bank_device, read8, write8) - AM_RANGE(0xf000,0xfbff) AM_DEVREADWRITE("av_bank16", address_map_bank_device, read8, write8) - AM_RANGE(0xfc00,0xfc7f) AM_RAM - AM_RANGE(0xfc80,0xfcff) AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) - // I/O space (FD00-FDFF) - AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) - AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask - AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags - AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) - AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) - AM_RANGE(0xfd06,0xfd0a) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd0b,0xfd0b) AM_READ(fm77av_boot_mode_r) - AM_RANGE(0xfd0c,0xfd0c) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) - AM_RANGE(0xfd10,0xfd10) AM_WRITE(fm7_init_en_w) - AM_RANGE(0xfd11,0xfd11) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd12,0xfd12) AM_READWRITE(fm77av_sub_modestatus_r,fm77av_sub_modestatus_w) - AM_RANGE(0xfd13,0xfd13) AM_WRITE(fm77av_sub_bank_w) - AM_RANGE(0xfd14,0xfd14) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd17,0xfd17) AM_READ(fm7_fmirq_r) - AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) - AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) - AM_RANGE(0xfd24,0xfd2b) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd30,0xfd34) AM_WRITE(fm77av_analog_palette_w) - AM_RANGE(0xfd35,0xfd36) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) - AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) - AM_RANGE(0xfd40,0xfd7f) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd80,0xfd93) AM_READWRITE(fm7_mmr_r,fm7_mmr_w) - AM_RANGE(0xfd94,0xfdff) AM_READ(fm7_unknown_r) - AM_RANGE(0xfe00,0xffdf) AM_RAM_WRITE(fm77av_bootram_w) AM_SHARE("boot_ram") - AM_RANGE(0xffe0,0xffef) AM_RAM - AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) -ADDRESS_MAP_END - -// Much of this is guesswork at the moment -static ADDRESS_MAP_START( fm11_sub_mem, AS_PROGRAM, 8, fm7_state ) - AM_RANGE(0x0000,0x7fff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM - AM_RANGE(0x8000,0x8fff) AM_RAM // Console RAM(?) - AM_RANGE(0x9000,0x9f7f) AM_RAM // Work RAM(?) - AM_RANGE(0x9f80,0x9fff) AM_RAM AM_SHARE("shared_ram") - AM_RANGE(0xafe0,0xafe3) AM_RAM -// AM_RANGE(0xafe4,0xafe4) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) - AM_RANGE(0xafe6,0xafe6) AM_READWRITE(fm77av_video_flags_r,fm77av_video_flags_w) - AM_RANGE(0xaff0,0xaff0) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) - AM_RANGE(0xc000,0xffff) AM_ROM // sybsystem ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm11_x86_mem, AS_PROGRAM, 8, fm7_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0xfefff) AM_RAM - AM_RANGE(0xff000,0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm11_x86_io, AS_IO, 8, fm7_state ) - AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) - AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask - AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags - AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) - AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) - AM_RANGE(0xfd06,0xfd0c) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) - AM_RANGE(0xfd10,0xfd17) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) - AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) - AM_RANGE(0xfd24,0xfd36) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) - AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) - AM_RANGE(0xfd40,0xfdff) AM_READ(fm7_unknown_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm16_mem, AS_PROGRAM, 16, fm7_state ) - AM_RANGE(0x00000,0xfbfff) AM_RAM - AM_RANGE(0xfc000,0xfffff) AM_ROM // IPL -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm16_io, AS_IO, 16, fm7_state ) - AM_RANGE(0xfd00,0xfd01) AM_READWRITE8(fm7_keyboard_r,fm7_cassette_printer_w,0xffff) - AM_RANGE(0xfd02,0xfd03) AM_READWRITE8(fm7_cassette_printer_r,fm7_irq_mask_w,0x00ff) // IRQ mask - AM_RANGE(0xfd02,0xfd03) AM_READWRITE8(fm7_irq_cause_r,fm7_beeper_w,0xff00) // IRQ flags - AM_RANGE(0xfd04,0xfd05) AM_READ8(fm7_fd04_r,0x00ff) - AM_RANGE(0xfd04,0xfd05) AM_READWRITE8(fm7_subintf_r,fm7_subintf_w,0xff00) -// AM_RANGE(0xfd06,0xfd0c) AM_READ8(fm7_unknown_r,0xffff) - AM_RANGE(0xfd0e,0xfd0f) AM_READWRITE8(fm7_rom_en_r,fm7_rom_en_w,0xff00) -// AM_RANGE(0xfd10,0xfd17) AM_READ8(fm7_unknown_r,0xffff) - AM_RANGE(0xfd18,0xfd1f) AM_READWRITE8(fm7_fdc_r,fm7_fdc_w,0xffff) - AM_RANGE(0xfd20,0xfd23) AM_READWRITE8(fm7_kanji_r,fm7_kanji_w,0xffff) -// AM_RANGE(0xfd24,0xfd36) AM_READ8(fm7_unknown_r,0xffff) - AM_RANGE(0xfd36,0xfd37) AM_WRITE8(fm7_multipage_w,0xff00) - AM_RANGE(0xfd38,0xfd3f) AM_READWRITE8(fm7_palette_r,fm7_palette_w,0xffff) -// AM_RANGE(0xfd40,0xfdff) AM_READ8(fm7_unknown_r,0xffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm16_sub_mem, AS_PROGRAM, 8, fm7_state ) - AM_RANGE(0x0000,0xafff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM - AM_RANGE(0xb000,0xffff) AM_ROM // subsystem ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm77av_mem, AS_PROGRAM, 8, fm7_state ) - AM_RANGE(0x0000,0x0fff) AM_DEVREADWRITE("av_bank1", address_map_bank_device, read8, write8) - AM_RANGE(0x1000,0x1fff) AM_DEVREADWRITE("av_bank2", address_map_bank_device, read8, write8) - AM_RANGE(0x2000,0x2fff) AM_DEVREADWRITE("av_bank3", address_map_bank_device, read8, write8) - AM_RANGE(0x3000,0x3fff) AM_DEVREADWRITE("av_bank4", address_map_bank_device, read8, write8) - AM_RANGE(0x4000,0x4fff) AM_DEVREADWRITE("av_bank5", address_map_bank_device, read8, write8) - AM_RANGE(0x5000,0x5fff) AM_DEVREADWRITE("av_bank6", address_map_bank_device, read8, write8) - AM_RANGE(0x6000,0x6fff) AM_DEVREADWRITE("av_bank7", address_map_bank_device, read8, write8) - AM_RANGE(0x7000,0x7fff) AM_DEVREADWRITE("av_bank8", address_map_bank_device, read8, write8) - AM_RANGE(0x8000,0x8fff) AM_DEVREADWRITE("av_bank9", address_map_bank_device, read8, write8) - AM_RANGE(0x9000,0x9fff) AM_DEVREADWRITE("av_bank10", address_map_bank_device, read8, write8) - AM_RANGE(0xa000,0xafff) AM_DEVREADWRITE("av_bank11", address_map_bank_device, read8, write8) - AM_RANGE(0xb000,0xbfff) AM_DEVREADWRITE("av_bank12", address_map_bank_device, read8, write8) - AM_RANGE(0xc000,0xcfff) AM_DEVREADWRITE("av_bank13", address_map_bank_device, read8, write8) - AM_RANGE(0xd000,0xdfff) AM_DEVREADWRITE("av_bank14", address_map_bank_device, read8, write8) - AM_RANGE(0xe000,0xefff) AM_DEVREADWRITE("av_bank15", address_map_bank_device, read8, write8) - AM_RANGE(0xf000,0xfbff) AM_DEVREADWRITE("av_bank16", address_map_bank_device, read8, write8) - AM_RANGE(0xfc00,0xfc7f) AM_RAM - AM_RANGE(0xfc80,0xfcff) AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) - // I/O space (FD00-FDFF) - AM_RANGE(0xfd00,0xfd01) AM_READWRITE(fm7_keyboard_r,fm7_cassette_printer_w) - AM_RANGE(0xfd02,0xfd02) AM_READWRITE(fm7_cassette_printer_r,fm7_irq_mask_w) // IRQ mask - AM_RANGE(0xfd03,0xfd03) AM_READWRITE(fm7_irq_cause_r,fm7_beeper_w) // IRQ flags - AM_RANGE(0xfd04,0xfd04) AM_READ(fm7_fd04_r) - AM_RANGE(0xfd05,0xfd05) AM_READWRITE(fm7_subintf_r,fm7_subintf_w) - AM_RANGE(0xfd06,0xfd0a) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd0b,0xfd0b) AM_READ(fm77av_boot_mode_r) - AM_RANGE(0xfd0c,0xfd0c) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd0d,0xfd0d) AM_READWRITE(fm7_psg_select_r,fm7_psg_select_w) - AM_RANGE(0xfd0e,0xfd0e) AM_READWRITE(fm7_psg_data_r, fm7_psg_data_w) - AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w) - AM_RANGE(0xfd10,0xfd10) AM_WRITE(fm7_init_en_w) - AM_RANGE(0xfd11,0xfd11) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd12,0xfd12) AM_READWRITE(fm77av_sub_modestatus_r,fm77av_sub_modestatus_w) - AM_RANGE(0xfd13,0xfd13) AM_WRITE(fm77av_sub_bank_w) - AM_RANGE(0xfd14,0xfd14) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd15,0xfd15) AM_READWRITE(fm7_psg_select_r,fm77av_ym_select_w) - AM_RANGE(0xfd16,0xfd16) AM_READWRITE(fm7_psg_data_r,fm7_psg_data_w) - AM_RANGE(0xfd17,0xfd17) AM_READ(fm7_fmirq_r) - AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w) - AM_RANGE(0xfd20,0xfd23) AM_READWRITE(fm7_kanji_r,fm7_kanji_w) - AM_RANGE(0xfd24,0xfd2b) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd30,0xfd34) AM_WRITE(fm77av_analog_palette_w) - AM_RANGE(0xfd35,0xfd36) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd37,0xfd37) AM_WRITE(fm7_multipage_w) - AM_RANGE(0xfd38,0xfd3f) AM_READWRITE(fm7_palette_r,fm7_palette_w) - AM_RANGE(0xfd40,0xfd7f) AM_READ(fm7_unknown_r) - AM_RANGE(0xfd80,0xfd93) AM_READWRITE(fm7_mmr_r,fm7_mmr_w) - AM_RANGE(0xfd94,0xfdff) AM_READ(fm7_unknown_r) - // Boot ROM (RAM on FM77AV and later) - AM_RANGE(0xfe00,0xffdf) AM_RAM_WRITE(fm77av_bootram_w) AM_SHARE("boot_ram") - AM_RANGE(0xffe0,0xffef) AM_RAM - AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm77av_sub_mem, AS_PROGRAM, 8, fm7_state ) - AM_RANGE(0x0000,0xbfff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM - AM_RANGE(0xc000,0xcfff) AM_RAM AM_REGION("maincpu",0x1c000) // Console RAM - AM_RANGE(0xd000,0xd37f) AM_RAM AM_REGION("maincpu",0x1d000) // Work RAM - AM_RANGE(0xd380,0xd3ff) AM_RAM AM_SHARE("shared_ram") - // I/O space (D400-D4FF) - AM_RANGE(0xd400,0xd401) AM_READ(fm7_sub_keyboard_r) - AM_RANGE(0xd402,0xd402) AM_READ(fm7_cancel_ack) - AM_RANGE(0xd403,0xd403) AM_READ(fm7_sub_beeper_r) - AM_RANGE(0xd404,0xd404) AM_READ(fm7_attn_irq_r) - AM_RANGE(0xd408,0xd408) AM_READWRITE(fm7_crt_r,fm7_crt_w) - AM_RANGE(0xd409,0xd409) AM_READWRITE(fm7_vram_access_r,fm7_vram_access_w) - AM_RANGE(0xd40a,0xd40a) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) - AM_RANGE(0xd40e,0xd40f) AM_WRITE(fm7_vram_offset_w) - AM_RANGE(0xd410,0xd42b) AM_READWRITE(fm77av_alu_r, fm77av_alu_w) - AM_RANGE(0xd430,0xd430) AM_READWRITE(fm77av_video_flags_r,fm77av_video_flags_w) - AM_RANGE(0xd431,0xd432) AM_READWRITE(fm77av_key_encoder_r,fm77av_key_encoder_w) - AM_RANGE(0xd500,0xd7ff) AM_RAM AM_REGION("maincpu",0x1d500) // Work RAM - AM_RANGE(0xd800,0xdfff) AM_ROMBANK("bank20") - AM_RANGE(0xe000,0xffff) AM_ROMBANK("bank21") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fm7_banked_mem, AS_PROGRAM, 8, fm7_state) - // Extended RAM - AM_RANGE(0x00000,0x0ffff) AM_RAM AM_REGION("maincpu",0x00000) - - // Sub CPU space - AM_RANGE(0x10000,0x1bfff) AM_READWRITE(fm7_vram_r,fm7_vram_w) // VRAM - AM_RANGE(0x1c000,0x1cfff) AM_RAM AM_REGION("maincpu",0x1c000) // Console RAM - AM_RANGE(0x1d000,0x1d37f) AM_RAM AM_REGION("maincpu",0x1d000) // Work RAM - AM_RANGE(0x1d380,0x1d3ff) AM_RAM AM_SHARE("shared_ram") - // I/O space (D400-D4FF) - AM_RANGE(0x1d400,0x1d401) AM_READ(fm7_sub_keyboard_r) - AM_RANGE(0x1d402,0x1d402) AM_READ(fm7_cancel_ack) - AM_RANGE(0x1d403,0x1d403) AM_READ(fm7_sub_beeper_r) - AM_RANGE(0x1d404,0x1d404) AM_READ(fm7_attn_irq_r) - AM_RANGE(0x1d408,0x1d408) AM_READWRITE(fm7_crt_r,fm7_crt_w) - AM_RANGE(0x1d409,0x1d409) AM_READWRITE(fm7_vram_access_r,fm7_vram_access_w) - AM_RANGE(0x1d40a,0x1d40a) AM_READWRITE(fm7_sub_busyflag_r,fm7_sub_busyflag_w) - AM_RANGE(0x1d40e,0x1d40f) AM_WRITE(fm7_vram_offset_w) - AM_RANGE(0x1d410,0x1d42b) AM_READWRITE(fm77av_alu_r, fm77av_alu_w) - AM_RANGE(0x1d430,0x1d430) AM_READWRITE(fm77av_video_flags_r,fm77av_video_flags_w) - AM_RANGE(0x1d431,0x1d432) AM_READWRITE(fm77av_key_encoder_r,fm77av_key_encoder_w) - AM_RANGE(0x1d500,0x1d7ff) AM_RAM AM_REGION("maincpu",0x1d500) // Work RAM - AM_RANGE(0x1d800,0x1dfff) AM_ROMBANK("bank20") - AM_RANGE(0x1e000,0x1ffff) AM_ROMBANK("bank21") - - // more RAM? - AM_RANGE(0x20000,0x2ffff) AM_RAM AM_REGION("maincpu",0x20000) - - // Main CPU space - AM_RANGE(0x30000,0x35fff) AM_RAM AM_REGION("maincpu",0x30000) - AM_RANGE(0x36000,0x37fff) AM_READ_BANK("init_bank_r") AM_WRITE_BANK("init_bank_w") - AM_RANGE(0x38000,0x3fbff) AM_READ_BANK("fbasic_bank_r") AM_WRITE_BANK("fbasic_bank_w") - AM_RANGE(0x3fc00,0x3ffff) AM_RAM AM_REGION("maincpu",0x3fc00) - -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( fm7_keyboard ) - PORT_START("key1") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - - PORT_START("key2") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CHAR('_') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) - - PORT_START("key3") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey ,") - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("EL") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DUP") PORT_CODE(KEYCODE_END) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) - - PORT_START("key_modifiers") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAP") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE - - PORT_START("joy1") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_JOYSTICK_UP) PORT_NAME("1P Joystick Up") PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_JOYSTICK_DOWN) PORT_NAME("1P Joystick Down") PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_JOYSTICK_LEFT) PORT_NAME("1P Joystick Left") PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_JOYSTICK_RIGHT) PORT_NAME("1P Joystick Right") PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_BUTTON2) PORT_NAME("1P Joystick Button 2") PORT_PLAYER(1) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_BUTTON1) PORT_NAME("1P Joystick Button 1") PORT_PLAYER(1) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("joy2") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_JOYSTICK_UP) PORT_NAME("2P Joystick Up") PORT_8WAY PORT_PLAYER(2) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_JOYSTICK_DOWN) PORT_NAME("2P Joystick Down") PORT_8WAY PORT_PLAYER(2) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_JOYSTICK_LEFT) PORT_NAME("2P Joystick Left") PORT_8WAY PORT_PLAYER(2) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_JOYSTICK_RIGHT) PORT_NAME("2P Joystick Right") PORT_8WAY PORT_PLAYER(2) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_BUTTON2) PORT_NAME("2P Joystick Button 2") PORT_PLAYER(2) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_BUTTON1) PORT_NAME("2P Joystick Button 1") PORT_PLAYER(2) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( fm7 ) - PORT_INCLUDE( fm7_keyboard ) - - PORT_START("DSW") - PORT_DIPNAME(0x01,0x01,"Switch A") PORT_DIPLOCATION("SWA:1") - PORT_DIPSETTING(0x00,DEF_STR( Off )) - PORT_DIPSETTING(0x01,DEF_STR( On )) - PORT_DIPNAME(0x02,0x02,"Boot mode") PORT_DIPLOCATION("SWA:2") - PORT_DIPSETTING(0x00,"DOS") - PORT_DIPSETTING(0x02,"BASIC") - PORT_DIPNAME(0x04,0x00,"Switch C") PORT_DIPLOCATION("SWA:3") - PORT_DIPSETTING(0x00,DEF_STR( Off )) - PORT_DIPSETTING(0x04,DEF_STR( On )) - PORT_DIPNAME(0x08,0x00,"FM-8 Compatibility mode") PORT_DIPLOCATION("SWA:4") - PORT_DIPSETTING(0x00,DEF_STR( Off )) - PORT_DIPSETTING(0x08,DEF_STR( On )) -INPUT_PORTS_END - -static INPUT_PORTS_START( fm8 ) - PORT_INCLUDE( fm7_keyboard ) - - PORT_START("DSW") - PORT_DIPNAME(0x02,0x02,"Boot mode") PORT_DIPLOCATION("SWA:2") - PORT_DIPSETTING(0x00,"DOS") - PORT_DIPSETTING(0x02,"BASIC") -INPUT_PORTS_END - -DRIVER_INIT_MEMBER(fm7_state,fm7) -{ -// m_shared_ram = auto_alloc_array(machine(),UINT8,0x80); - m_video_ram = auto_alloc_array(machine(),UINT8,0x18000); // 2 pages on some systems - m_timer = timer_alloc(TIMER_FM7_IRQ); - m_subtimer = timer_alloc(TIMER_FM7_SUBTIMER_IRQ); - m_keyboard_timer = timer_alloc(TIMER_FM7_KEYBOARD_POLL); - m_fm77av_vsync_timer = timer_alloc(TIMER_FM77AV_VSYNC); -} - -MACHINE_START_MEMBER(fm7_state,fm7) -{ - // The FM-7 has no initialisation ROM, and no other obvious - // way to set the reset vector, so for now this will have to do. - UINT8* RAM = memregion("maincpu")->base(); - - RAM[0xfffe] = 0xfe; - RAM[0xffff] = 0x00; - - memset(m_shared_ram,0xff,0x80); - m_type = SYS_FM7; - - m_beeper->set_frequency(1200); - m_beeper->set_state(0); -} - -MACHINE_START_MEMBER(fm7_state,fm77av) -{ - UINT8* RAM = memregion("maincpu")->base(); - UINT8* ROM = memregion("init")->base(); - - memset(m_shared_ram,0xff,0x80); - - // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) - memcpy(RAM+0x3fff0,ROM+0x1ff0,16); - - m_video.subrom = 0; // default sub CPU ROM is type C. - RAM = memregion("subsyscg")->base(); - membank("bank20")->set_base(RAM); - RAM = memregion("subsys_c")->base(); - membank("bank21")->set_base(RAM+0x800); - - m_type = SYS_FM77AV; - m_beeper->set_frequency(1200); - m_beeper->set_state(0); -} - -MACHINE_START_MEMBER(fm7_state,fm11) -{ - UINT8* RAM = memregion("maincpu")->base(); - UINT8* ROM = memregion("init")->base(); - - memset(m_shared_ram,0xff,0x80); - m_type = SYS_FM11; - m_beeper->set_frequency(1200); - m_beeper->set_state(0); - // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) - memcpy(RAM+0x3fff0,ROM+0x0ff0,16); -} - -MACHINE_START_MEMBER(fm7_state,fm16) -{ - m_type = SYS_FM16; - m_beeper->set_frequency(1200); - m_beeper->set_state(0); -} - -void fm7_state::machine_reset() -{ - UINT8* RAM = memregion("maincpu")->base(); - UINT8* ROM = memregion("init")->base(); - - m_timer->adjust(attotime::from_nsec(2034500),0,attotime::from_nsec(2034500)); - m_subtimer->adjust(attotime::from_msec(20),0,attotime::from_msec(20)); - m_keyboard_timer->adjust(attotime::zero,0,attotime::from_msec(10)); - if(m_type == SYS_FM77AV || m_type == SYS_FM77AV40EX || m_type == SYS_FM11) - m_fm77av_vsync_timer->adjust(machine().first_screen()->time_until_vblank_end()); - - m_irq_mask = 0x00; - m_irq_flags = 0x00; - m_video.attn_irq = 0; - m_video.sub_busy = 0x80; // busy at reset - m_basic_rom_en = 1; // enabled at reset, if in BASIC mode - if(m_type == SYS_FM11 || m_type == SYS_FM16) - m_basic_rom_en = 0; // all FM11/16 systems have no BASIC ROM except for the FM-11 ST - if(m_type == SYS_FM77AV || m_type == SYS_FM77AV40EX) - { - m_init_rom_en = 1; - // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) - memcpy(RAM+0x3fff0,ROM+0x1ff0,16); - } - else if (m_type == SYS_FM11) - { - m_init_rom_en = 1; - // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) - memcpy(RAM+0x3fff0,ROM+0x0ff0,16); - } - else - m_init_rom_en = 0; - if(m_type == SYS_FM7) - { - if(!(m_dsw->read() & 0x02)) - { - m_basic_rom_en = 0; // disabled for DOS mode - membank("bank1")->set_base(RAM+0x08000); - } - else - membank("bank1")->set_base(RAM+0x38000); - membank("bank2")->set_base(RAM+0x08000); - } - m_key_delay = 700; // 700ms on FM-7 - m_key_repeat = 70; // 70ms on FM-7 - m_break_flag = 0; - m_key_scan_mode = KEY_MODE_FM7; - m_psg_regsel = 0; - m_psg_data = 0; - m_fdc_side = 0; - m_fdc_drive = 0; - m_mmr.mode = 0; - m_mmr.segment = 0; - m_mmr.enabled = 0; - m_fm77av_ym_irq = 0; - m_encoder.latch = 1; - m_encoder.ack = 1; - // set boot mode (FM-7 only, AV and later has boot RAM instead) - if(m_type == SYS_FM7) - { - if(!(m_dsw->read() & 0x02)) - { // DOS mode - membank("bank17")->set_base(memregion("dos")->base()); - } - else - { // BASIC mode - membank("bank17")->set_base(memregion("basic")->base()); - } - } - if(m_type == SYS_FM77AV || m_type == SYS_FM77AV40EX || m_type == SYS_FM11) - { - fm7_mmr_refresh(m_maincpu->space(AS_PROGRAM)); - membank("fbasic_bank_w")->set_base(RAM+0x38000); - membank("init_bank_w")->set_base(RAM+0x36000); - } - if(m_type == SYS_FM11) - { - // Probably best to halt the 8088, I'm pretty sure it and the main 6809 should not be running at the same time - m_x86->set_input_line(INPUT_LINE_HALT,ASSERT_LINE); - } - - memset(m_video_ram, 0, sizeof(UINT8) * 0x18000); -} - - -static SLOT_INTERFACE_START( fm7_floppies ) - SLOT_INTERFACE("qd", FLOPPY_525_QD) -SLOT_INTERFACE_END - - -#define MCFG_ADDRESS_BANK(tag) \ -MCFG_DEVICE_ADD(tag, ADDRESS_MAP_BANK, 0) \ -MCFG_DEVICE_PROGRAM_MAP(fm7_banked_mem) \ -MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) \ -MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) \ -MCFG_ADDRESS_MAP_BANK_STRIDE(0x1000) - - -static MACHINE_CONFIG_START( fm7, fm7_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(fm7_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_irq_ack) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_CPU_ADD("sub", M6809, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(fm7_sub_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) - MCFG_QUANTUM_PERFECT_CPU("sub") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("psg", AY8910, XTAL_4_9152MHz / 4) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 1.00) - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.25) - - MCFG_MACHINE_START_OVERRIDE(fm7_state,fm7) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(fm7_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("fm7_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","fm7_cass") - - MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list","fm7_disk") - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_SLOT_OPTION_ADD( "dsjoy", DEMPA_SHINBUNSHA_JOYSTICK ) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( fm8, fm7_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 1200000) // 1.2MHz 68A09 - MCFG_CPU_PROGRAM_MAP(fm8_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_irq_ack) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_CPU_ADD("sub", M6809, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(fm7_sub_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) - MCFG_QUANTUM_PERFECT_CPU("sub") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.25) - - MCFG_MACHINE_START_OVERRIDE(fm7_state,fm7) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(fm7_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("fm7_cass") - - MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( fm77av, fm7_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, XTAL_2MHz) // actually MB68B09E, but the 6809E core runs too slowly - MCFG_CPU_PROGRAM_MAP(fm77av_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_irq_ack) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_CPU_ADD("sub", M6809, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(fm77av_sub_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) - MCFG_QUANTUM_PERFECT_CPU("sub") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ym", YM2203, XTAL_4_9152MHz / 4) - MCFG_YM2203_IRQ_HANDLER(WRITELINE(fm7_state, fm77av_fmirq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(fm7_state, fm77av_joy_1_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(fm7_state, fm77av_joy_2_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",1.0) - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.25) - - MCFG_MACHINE_START_OVERRIDE(fm7_state,fm77av) - - MCFG_ADDRESS_BANK("av_bank1") - MCFG_ADDRESS_BANK("av_bank2") - MCFG_ADDRESS_BANK("av_bank3") - MCFG_ADDRESS_BANK("av_bank4") - MCFG_ADDRESS_BANK("av_bank5") - MCFG_ADDRESS_BANK("av_bank6") - MCFG_ADDRESS_BANK("av_bank7") - MCFG_ADDRESS_BANK("av_bank8") - MCFG_ADDRESS_BANK("av_bank9") - MCFG_ADDRESS_BANK("av_bank10") - MCFG_ADDRESS_BANK("av_bank11") - MCFG_ADDRESS_BANK("av_bank12") - MCFG_ADDRESS_BANK("av_bank13") - MCFG_ADDRESS_BANK("av_bank14") - MCFG_ADDRESS_BANK("av_bank15") - MCFG_ADDRESS_BANK("av_bank16") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - MCFG_PALETTE_ADD("av_palette", 4096) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(fm7_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("fm7_cass") - - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("cass_list", "fm7_cass") - - MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("av_flop_list", "fm77av") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop_list", "fm7_disk") - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( fm11, fm7_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, XTAL_2MHz) // 2MHz 68B09E - MCFG_CPU_PROGRAM_MAP(fm11_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_irq_ack) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_CPU_ADD("sub", M6809, XTAL_2MHz) // 2MHz 68B09 - MCFG_CPU_PROGRAM_MAP(fm11_sub_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) - MCFG_QUANTUM_PERFECT_CPU("sub") - - MCFG_CPU_ADD("x86", I8088, XTAL_8MHz) // 8MHz i8088 - MCFG_CPU_PROGRAM_MAP(fm11_x86_mem) - MCFG_CPU_IO_MAP(fm11_x86_io) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.25) - - MCFG_MACHINE_START_OVERRIDE(fm7_state,fm11) - - MCFG_ADDRESS_BANK("av_bank1") - MCFG_ADDRESS_BANK("av_bank2") - MCFG_ADDRESS_BANK("av_bank3") - MCFG_ADDRESS_BANK("av_bank4") - MCFG_ADDRESS_BANK("av_bank5") - MCFG_ADDRESS_BANK("av_bank6") - MCFG_ADDRESS_BANK("av_bank7") - MCFG_ADDRESS_BANK("av_bank8") - MCFG_ADDRESS_BANK("av_bank9") - MCFG_ADDRESS_BANK("av_bank10") - MCFG_ADDRESS_BANK("av_bank11") - MCFG_ADDRESS_BANK("av_bank12") - MCFG_ADDRESS_BANK("av_bank13") - MCFG_ADDRESS_BANK("av_bank14") - MCFG_ADDRESS_BANK("av_bank15") - MCFG_ADDRESS_BANK("av_bank16") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(fm7_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("fm7_cass") - - MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( fm16beta, fm7_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, XTAL_8MHz) // 8MHz i8086 - MCFG_CPU_PROGRAM_MAP(fm16_mem) - MCFG_CPU_IO_MAP(fm16_io) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_CPU_ADD("sub", M6809, XTAL_2MHz) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(fm7_state,fm7_sub_irq_ack) - MCFG_CPU_PROGRAM_MAP(fm16_sub_mem) - MCFG_QUANTUM_PERFECT_CPU("sub") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.25) - - MCFG_MACHINE_START_OVERRIDE(fm7_state,fm16) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7) - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(fm7_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("fm7_cass") - - MCFG_MB8877_ADD("fdc", XTAL_8MHz / 8) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(fm7_state, fm7_fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fm7_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(fm7_state, write_centronics_fault)) - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(fm7_state, write_centronics_ack)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(fm7_state, write_centronics_perror)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( fm8 ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "fbasic10.rom", 0x38000, 0x7c00, CRC(e80ed96c) SHA1(f3fa8a6adb07224ad2a1def77d5dae9662de0867) ) - - ROM_REGION( 0x20000, "sub", 0 ) - ROM_LOAD( "subsys_8.rom", 0xd800, 0x2800, CRC(979f9046) SHA1(9c52052087bf3a41b83d437a51d89b9fcfec2515) ) - - // either one of these boot ROMs are selectable via DIP switch - ROM_REGION( 0x200, "basic", 0 ) - ROM_LOAD( "bootbas8.rom", 0x0000, 0x0200, CRC(8260267a) SHA1(fee6fb9c52d22dd7108c68d08c74e2f3ebcb9e4d) ) - - ROM_REGION( 0x200, "dos", 0 ) - ROM_LOAD( "bootdos8.rom", 0x0000, 0x0200, CRC(1ed5a506) SHA1(966538fa92c32fc15034576dc480cfa4a339384d) ) - - // optional Kanji ROM (same as for the FM-7?) - ROM_REGION( 0x20000, "kanji1", 0 ) - ROM_LOAD_OPTIONAL( "kanji.rom", 0x0000, 0x20000, NO_DUMP ) - -ROM_END - - -ROM_START( fmnew7 ) - ROM_REGION( 0x40000, "maincpu", 0 ) // at 0x7ba5 there is the ID string 0302840301, meaning it's v3.02 from 1984/03/01 - ROM_LOAD( "fbasic302.rom", 0x38000, 0x7c00, CRC(a96d19b6) SHA1(8d5f0cfe7e0d39bf2ab7e4c798a13004769c28b2) ) - - ROM_REGION( 0x20000, "sub", 0 ) - ROM_LOAD( "subsys_c.rom", 0xd800, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) - - // either one of these boot ROMs are selectable via DIP switch - ROM_REGION( 0x200, "basic", 0 ) - ROM_LOAD( "boot_bas.rom", 0x0000, 0x0200, CRC(c70f0c74) SHA1(53b63a301cba7e3030e79c59a4d4291eab6e64b0) ) - - ROM_REGION( 0x200, "dos", 0 ) - ROM_LOAD( "boot_dos.rom", 0x0000, 0x0200, CRC(198614ff) SHA1(037e5881bd3fed472a210ee894a6446965a8d2ef) ) - - // optional Kanji ROM - ROM_REGION( 0x20000, "kanji1", 0 ) - ROM_LOAD_OPTIONAL( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) - -ROM_END - -ROM_START( fm7 ) - ROM_REGION( 0x40000, "maincpu", 0 ) // at 0x7ba5 there is the ID string 0300820920, meaning it's v3.00 from 1982/09/20 - ROM_LOAD( "fbasic300.rom", 0x38000, 0x7c00, CRC(87c98494) SHA1(d7e3603b0a2442c7632dad45f9704d9ad71968f5) ) - - ROM_REGION( 0x20000, "sub", 0 ) - ROM_LOAD( "subsys_c.rom", 0xd800, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) - - // either one of these boot ROMs are selectable via DIP switch - ROM_REGION( 0x200, "basic", 0 ) - ROM_LOAD( "boot_bas.rom", 0x0000, 0x0200, CRC(c70f0c74) SHA1(53b63a301cba7e3030e79c59a4d4291eab6e64b0) ) - - ROM_REGION( 0x200, "dos", 0 ) - ROM_LOAD( "boot_dos_a.rom", 0x0000, 0x0200, CRC(bf441864) SHA1(616c17155f84fb0e3731a31ef0eb0cbb664a5600) ) - - // optional Kanji ROM - ROM_REGION( 0x20000, "kanji1", 0 ) - ROM_LOAD_OPTIONAL( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) - -ROM_END - -ROM_START( fm77av ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_FILL(0x0000,0x40000,0xff) - - ROM_REGION( 0x2000, "init", 0 ) - ROM_LOAD( "initiate.rom", 0x0000, 0x2000, CRC(785cb06c) SHA1(b65987e98a9564a82c85eadb86f0204eee5a5c93) ) - - ROM_REGION( 0x7c00, "fbasic", 0 ) - ROM_LOAD( "fbasic30.rom", 0x0000, 0x7c00, CRC(a96d19b6) SHA1(8d5f0cfe7e0d39bf2ab7e4c798a13004769c28b2) ) - - ROM_REGION( 0x10000, "sub", 0 ) - ROM_FILL(0x0000,0x10000,0xff) - - // sub CPU ROMs - ROM_REGION( 0x2800, "subsys_c", 0 ) - ROM_LOAD( "subsys_c.rom", 0x0000, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) - ROM_REGION( 0x2000, "subsys_a", 0 ) - ROM_LOAD( "subsys_a.rom", 0x0000, 0x2000, CRC(e8014fbb) SHA1(038cb0b42aee9e933b20fccd6f19942e2f476c83) ) - ROM_REGION( 0x2000, "subsys_b", 0 ) - ROM_LOAD( "subsys_b.rom", 0x0000, 0x2000, CRC(9be69fac) SHA1(0305bdd44e7d9b7b6a17675aff0a3330a08d21a8) ) - ROM_REGION( 0x2000, "subsyscg", 0 ) - ROM_LOAD( "subsyscg.rom", 0x0000, 0x2000, CRC(e9f16c42) SHA1(8ab466b1546d023ba54987790a79e9815d2b7bb2) ) - - ROM_REGION( 0x20000, "kanji1", 0 ) - ROM_LOAD( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) - - // optional dict rom? -ROM_END - -ROM_START( fm7740sx ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_FILL(0x0000,0x40000,0xff) - - ROM_REGION( 0x2000, "init", 0 ) - ROM_LOAD( "initiate.rom", 0x0000, 0x2000, CRC(785cb06c) SHA1(b65987e98a9564a82c85eadb86f0204eee5a5c93) ) - - ROM_REGION( 0x7c00, "fbasic", 0 ) - ROM_LOAD( "fbasic30.rom", 0x0000, 0x7c00, CRC(a96d19b6) SHA1(8d5f0cfe7e0d39bf2ab7e4c798a13004769c28b2) ) - - ROM_REGION( 0x10000, "sub", 0 ) - ROM_FILL(0x0000,0x10000,0xff) - - // sub CPU ROMs - ROM_REGION( 0x2800, "subsys_c", 0 ) - ROM_LOAD( "subsys_c.rom", 0x0000, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) - ROM_REGION( 0x2000, "subsys_a", 0 ) - ROM_LOAD( "subsys_a.rom", 0x0000, 0x2000, CRC(e8014fbb) SHA1(038cb0b42aee9e933b20fccd6f19942e2f476c83) ) - ROM_REGION( 0x2000, "subsys_b", 0 ) - ROM_LOAD( "subsys_b.rom", 0x0000, 0x2000, CRC(9be69fac) SHA1(0305bdd44e7d9b7b6a17675aff0a3330a08d21a8) ) - ROM_REGION( 0x2000, "subsyscg", 0 ) - ROM_LOAD( "subsyscg.rom", 0x0000, 0x2000, CRC(e9f16c42) SHA1(8ab466b1546d023ba54987790a79e9815d2b7bb2) ) - - ROM_REGION( 0x20000, "kanji1", 0 ) - ROM_LOAD( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) - ROM_LOAD( "kanji2.rom", 0x0000, 0x20000, CRC(38644251) SHA1(ebfdc43c38e1380709ed08575c346b2467ad1592) ) - - /* These should be loaded at 2e000-2ffff of maincpu, but I'm not sure if it is correct */ - ROM_REGION( 0x4c000, "additional", 0 ) - ROM_LOAD( "dicrom.rom", 0x00000, 0x40000, CRC(b142acbc) SHA1(fe9f92a8a2750bcba0a1d2895e75e83858e4f97f) ) - ROM_LOAD( "extsub.rom", 0x40000, 0x0c000, CRC(0f7fcce3) SHA1(a1304457eeb400b4edd3c20af948d66a04df255e) ) - -ROM_END - -ROM_START( fm11 ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_FILL(0x0000,0x40000,0xff) - - ROM_REGION( 0x1000, "init", 0 ) - ROM_LOAD( "boot6809.rom", 0x0000, 0x1000, CRC(447caa6f) SHA1(4aa30314994c256d37ee01d11ec2bf4df3bc8cde) ) - - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "subsys.rom", 0xc000, 0x4000, CRC(436c0618) SHA1(cd508e3e8f79737afb4384ea4b278eddf0ce935d) ) - - ROM_REGION( 0x100000, "x86", 0 ) - ROM_LOAD( "boot8088.rom", 0xff000, 0x1000, CRC(d13096a6) SHA1(f9bd95b3b8184d0e04fba9b50f273dbb8823be77) ) - - ROM_REGION( 0x10000, "subsys_e", 0 ) - ROM_LOAD( "subsys_e.rom", 0x00000, 0x1000, CRC(31d838aa) SHA1(86a275c27bc99985bef7a51bdab2e47d68e31c6c) ) - - // optional Kanji ROM - ROM_REGION( 0x20000, "kanji1", 0 ) - ROM_LOAD_OPTIONAL( "kanji.rom", 0x0000, 0x20000, CRC(62402ac9) SHA1(bf52d22b119d54410dad4949b0687bb0edf3e143) ) - -ROM_END - -ROM_START( fm16beta ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "ipl.rom", 0xfc000, 0x4000, CRC(25f618ea) SHA1(9c27d6ad283260e071d64a1bfca16f7d3ad61f96) ) - -// ROM_REGION( 0x10000, "subsys", 0 ) - - ROM_REGION( 0x10000, "sub", 0 ) - ROM_LOAD( "sub_cg.rom", 0xa000, 0x0f80, CRC(e7928bed) SHA1(68cf604aa7a5c2ec7bd0d612cf099302c7f8c442) ) - ROM_CONTINUE(0xff80,0x0080) - ROM_LOAD( "subsys.rom", 0xb000, 0x4f80, CRC(1d878514) SHA1(4673879a81e39880655b380250c6b81137028727) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, fm8, 0, 0, fm8, fm8, fm7_state, fm7, "Fujitsu", "FM-8", 0) -COMP( 1982, fm7, 0, 0, fm7, fm7, fm7_state, fm7, "Fujitsu", "FM-7", 0) -COMP( 1984, fmnew7, fm7, 0, fm7, fm7, fm7_state, fm7, "Fujitsu", "FM-NEW7", 0) -COMP( 1985, fm77av, fm7, 0, fm77av, fm7, fm7_state, fm7, "Fujitsu", "FM-77AV", MACHINE_IMPERFECT_GRAPHICS) -COMP( 1985, fm7740sx, fm7, 0, fm77av, fm7, fm7_state, fm7, "Fujitsu", "FM-77AV40SX", MACHINE_NOT_WORKING) - -// These may be separated into a separate driver, depending on how different they are to the FM-8/FM-7 -COMP( 1982, fm11, 0, 0, fm11, fm7, fm7_state, fm7, "Fujitsu", "FM-11 EX", MACHINE_NOT_WORKING) -COMP( 1982, fm16beta, 0, 0, fm16beta, fm7, fm7_state, fm7, "Fujitsu", "FM-16\xCE\xB2", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/fmtowns.c b/src/mess/drivers/fmtowns.c deleted file mode 100644 index 362fed1c7a0..00000000000 --- a/src/mess/drivers/fmtowns.c +++ /dev/null @@ -1,2982 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/* - - Fujitsu FM-Towns - driver by Barry Rodewald - - Japanese computer system released in 1989. - - CPU: various AMD x86 CPUs, originally 80386DX (80387 available as an add-on). - later models use 80386SX, 80486 and Pentium CPUs - Sound: Yamaha YM3438 - Ricoh RF5c68 - CD-DA - Video: Custom - 16 or 256 colours from a 24-bit palette, or 15-bit high-colour - 1024 sprites (16x16), rendered direct to VRAM - 16 colour text mode, rendered direct to VRAM - - Later models add an unknown single channel 16-bit PCM/ADPCM (FreshTV, SJ, MX), and CL-GD543x Windows accelerator chipsets (SJ) - - - Fujitsu FM-Towns Marty - - Japanese console, based on the FM-Towns computer, using an AMD 80386SX CPU, - released in 1993 - - - Issues: Video emulation is far from complete. - -*/ - -/* I/O port map (incomplete, could well be incorrect too) - * - * 0x0000 : Master 8259 PIC - * 0x0002 : Master 8259 PIC - * 0x0010 : Slave 8259 PIC - * 0x0012 : Slave 8259 PIC - * 0x0020 RW: bit 0 = soft reset (read/write), bit 6 = power off (write), bit 7 = NMI vector protect - * 0x0022 W: bit 7 = power off (write) - * 0x0025 R : returns 0x00? (read) - * 0x0026 R : timer? - * 0x0028 RW: bit 0 = NMI mask (read/write) - * 0x0030 R : Machine ID (low) - * 0x0031 R : Machine ID (high) - * 0x0032 RW: bit 7 = RESET, bit 6 = CLK, bit 0 = data (serial ROM) - * 0x0040 : 8253 PIT counter 0 - * 0x0042 : 8253 PIT counter 1 - * 0x0044 : 8253 PIT counter 2 - * 0x0046 : 8253 PIT mode port - * 0x0060 : 8253 PIT timer control - * 0x006c RW: returns 0x00? (read) timer? (write) - * 0x00a0-af: DMA controller 1 (uPD71071) - * 0x00b0-bf: DMA controller 2 (uPD71071) - * 0x0200-0f: Floppy controller (MB8877A) - * 0x0400 : Video / CRTC (unknown) - * 0x0404 : Disable VRAM, CMOS, memory-mapped I/O (everything in low memory except the BIOS) - * 0x0440-5f: Video / CRTC - * 0x0480 RW: bit 1 = disable BIOS ROM - * 0x048a RW: JEIDA v3/v4(?) IC Memory card status - * 0x0490 RW: JEIDA v4 IC Memory card page select - * 0x0491 RW: JEIDA v4 IC Memory card - * 0x04c0-cf: CD-ROM controller - * 0x04d5 : Sound mute - * 0x04d8 : YM3438 control port A / status - * 0x04da : YM3438 data port A / status - * 0x04dc : YM3438 control port B / status - * 0x04de : YM3438 data port B / status - * 0x04e0-e3: volume ports - * 0x04e9-ec: IRQ masks - * 0x04f0-f8: RF5c68 registers - * 0x05e8 R : RAM size in MB - * 0x05ec RW: bit 0 = compatibility mode? - * 0x0600 RW: Keyboard data port (8042) - * 0x0602 : Keyboard control port (8042) - * 0x0604 : (8042) - * 0x3000 - 0x3fff : CMOS RAM - * 0xfd90-a0: CRTC / Video - * 0xff81: CRTC / Video - returns value in RAM location 0xcff81? - * - * IRQ list - * - * IRQ0 - PIT Timer IRQ - * IRQ1 - Keyboard - * IRQ2 - Serial Port - * IRQ6 - Floppy Disc Drive - * IRQ7 - PIC Cascade IRQ - * IRQ8 - SCSI controller - * IRQ9 - Built-in CD-ROM controller - * IRQ11 - VSync interrupt - * IRQ12 - Printer port - * IRQ13 - Sound (YM3438/RF5c68), Mouse - * IRQ15 - 16-bit PCM (expansion?) - * - * Machine ID list (I/O port 0x31) - * - 1(01h) FM-TOWNS 1/2 - 2(02h) FM-TOWNS 1F/2F/1H/2H - 3(03h) FM-TOWNS 10F/20F/40H/80H - 4(04h) FM-TOWNSII UX - 5(05h) FM-TOWNSII CX - 6(06h) FM-TOWNSII UG - 7(07h) FM-TOWNSII HR - 8(08h) FM-TOWNSII HG - 9(09h) FM-TOWNSII UR - 11(0Bh) FM-TOWNSII MA - 12(0Ch) FM-TOWNSII MX - 13(0Dh) FM-TOWNSII ME - 14(0Eh) TOWNS Application Card (PS/V Vision) - 15(0Fh) FM-TOWNSII MF/Fresh/Fresh???TV - 16(10h) FM-TOWNSII SN - 17(11h) FM-TOWNSII HA/HB/HC - 19(13h) FM-TOWNSII EA/Fresh???T/Fresh???ET/Fresh???FT - 20(14h) FM-TOWNSII Fresh???E/Fresh???ES/Fresh???FS - 22(16h) FMV-TOWNS H/Fresh???GS/Fresh???GT/H2 - 23(17h) FMV-TOWNS H20 - 74(4Ah) FM-TOWNS MARTY - */ - -/* - -Fujitsu FM Towns Marty - -PCB Layout ----------- - -CA20142-B21X - - CN10 CN1 - |-| |-| |-| |----------------------| -|--| |-| |-| |----|-|-------------|----------------------|------------| -|14577 CN11 SW2 |--------| MROM.M37|--------| | -|14576 TMS48C121DZ-80 |FUJITSU | |FUJITSU | | -| TMS48C121DZ-80 |CG24243 | |CS10501 | | -|MB40968 TMS48C121DZ-80 |(QFP208)| MROM.M36|(QFP160)| | -||--------| TMS48C121DZ-80 |--------| |--------| 62256 | -||FUJITSU | HM511664JP8 CN12 FUJITSU | -||CE31755 | 8451 (DIP8) | -||(QFP160)| | -||--------| 4.9152MHz | -|CN13 |--------| 28.63636MHz |-| -| |FUJITSU | |----------------------| -| RTC58323 |CG31553 | | | -|BATTERY |(QFP208)| 32MHz 74LS00 | | -| |--------| |------| | CN2 | -| LC7881 MB84256 |I386SX| | PCMCIA SLOT | -| TL084 CN4 | -16 | | | -||--------| |------| | | -||FUJITSU | MB814400A-70PZ | | -||CS09501 | MB814400A-70PZ |----------------------| -||(QFP120)| MB814400A-70PZ |--------|74LS14 74HC08 |-| -||--------| MB814400A-70PZ | RICOH | 3771 | -| YM3438 |RU6101MF| | -|4560 MB81C78 |(QFP44) | | -| MB88505 |------| |--------| | -| CN3 |YM6063| LED2 LED1 LED3 | -|CN9 CN8 VOL |(QFP80| CN5 CN6 SW1 CN7| -|---------------------|------|----------------------------------------| -Notes: - All IC's shown. - Main CPU Intel 80386SX-16 running at 16.000MHz - CN1 - Multi-pin connector possibly for cartridge or external peripheral connector? - CN2 - PCMCIA slot - CN3 - 24 pin connector for ? - CN4 - CDROM connector? (multi-pin connector with internal slot for a thin cable) - CN5/6 - DB9 connectors (joystick ports?) - CN7 - Power input socket - CN8/9 - Headphone out jacks? - CN10 - Header with left/right RCA audio jacks and composite video output - CN11 - S-VIDEO output - CN12 - 8 pin connector (possibly power related for the CDROM?) - CN13 - 2 pin connector (fan power?) - SW1 - Reset Switch? - SW2 - 2 position slide switch - MROM* - Hitachi HN624116 16MBit SOP44 maskROM - -*/ - -#include "includes/fmtowns.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsihd.h" - -// CD controller IRQ types -#define TOWNS_CD_IRQ_MPU 1 -#define TOWNS_CD_IRQ_DMA 2 - -enum -{ - MOUSE_START, - MOUSE_SYNC, - MOUSE_X_HIGH, - MOUSE_X_LOW, - MOUSE_Y_HIGH, - MOUSE_Y_LOW -}; - - - - -inline UINT8 towns_state::byte_to_bcd(UINT8 val) -{ - return ((val / 10) << 4) | (val % 10); -} - -inline UINT8 towns_state::bcd_to_byte(UINT8 val) -{ - return (((val & 0xf0) >> 4) * 10) + (val & 0x0f); -} - -inline UINT32 towns_state::msf_to_lbafm(UINT32 val) // because the CDROM core doesn't provide this -{ - UINT8 m,s,f; - f = bcd_to_byte(val & 0x0000ff); - s = (bcd_to_byte((val & 0x00ff00) >> 8)); - m = (bcd_to_byte((val & 0xff0000) >> 16)); - return ((m * (60 * 75)) + (s * 75) + f); -} - -void towns_state::init_serial_rom() -{ - // TODO: init serial ROM contents - int x; - static const UINT8 code[8] = { 0x04,0x65,0x54,0xA4,0x95,0x45,0x35,0x5F }; - UINT8* srom = NULL; - - if(m_serial) - srom = m_serial->base(); - memset(m_towns_serial_rom,0,256/8); - - if(srom) - { - memcpy(m_towns_serial_rom,srom,32); - m_towns_machine_id = (m_towns_serial_rom[0x18] << 8) | m_towns_serial_rom[0x17]; - logerror("Machine ID in serial ROM: %04x\n",m_towns_machine_id); - return; - } - - for(x=8;x<=21;x++) - m_towns_serial_rom[x] = 0xff; - - for(x=0;x<=7;x++) - { - m_towns_serial_rom[x] = code[x]; - } - - // add Machine ID - m_towns_machine_id = 0x0101; - m_towns_serial_rom[0x17] = 0x01; - m_towns_serial_rom[0x18] = 0x01; - - // serial number? - m_towns_serial_rom[29] = 0x10; - m_towns_serial_rom[28] = 0x6e; - m_towns_serial_rom[27] = 0x54; - m_towns_serial_rom[26] = 0x32; - m_towns_serial_rom[25] = 0x10; -} - -void towns_state::init_rtc() -{ - system_time systm; - - machine().base_datetime(systm); - - // seconds - m_towns_rtc_reg[0] = systm.local_time.second % 10; - m_towns_rtc_reg[1] = systm.local_time.second / 10; - // minutes - m_towns_rtc_reg[2] = systm.local_time.minute % 10; - m_towns_rtc_reg[3] = systm.local_time.minute / 10; - // hours - m_towns_rtc_reg[4] = systm.local_time.hour % 10; - m_towns_rtc_reg[5] = systm.local_time.hour / 10; - // weekday - m_towns_rtc_reg[6] = systm.local_time.weekday; - // day - m_towns_rtc_reg[7] = systm.local_time.mday % 10; - m_towns_rtc_reg[8] = systm.local_time.mday / 10; - // month - m_towns_rtc_reg[9] = systm.local_time.month % 10; - m_towns_rtc_reg[10] = systm.local_time.month / 10; - // year - m_towns_rtc_reg[11] = (systm.local_time.year - 2000) % 10; - m_towns_rtc_reg[12] = (systm.local_time.year - 2000) / 10; -} - -READ8_MEMBER(towns_state::towns_system_r) -{ - UINT8 ret = 0; - - switch(offset) - { - case 0x00: - logerror("SYS: port 0x20 read\n"); - return 0x00; - case 0x05: - logerror("SYS: port 0x25 read\n"); - return 0x00; -/* case 0x06: - count = (m_towns_freerun_counter->time_elapsed() * ATTOSECONDS_TO_HZ(ATTOSECONDS_IN_USEC(1))).as_double(); - return count & 0xff; - case 0x07: - count = (m_towns_freerun_counter->time_elapsed() * ATTOSECONDS_TO_HZ(ATTOSECONDS_IN_USEC(1))).as_double(); - return (count >> 8) & 0xff; -*/ case 0x06: - //logerror("SYS: (0x26) timer read\n"); - return m_freerun_timer; - case 0x07: - return m_freerun_timer >> 8; - case 0x08: - //logerror("SYS: (0x28) NMI mask read\n"); - return m_nmi_mask & 0x01; - case 0x10: - logerror("SYS: (0x30) Machine ID read\n"); - return (m_towns_machine_id >> 8) & 0xff; - case 0x11: - logerror("SYS: (0x31) Machine ID read\n"); - return m_towns_machine_id & 0xff; - case 0x12: - /* Bit 0 = data, bit 6 = CLK, bit 7 = RESET, bit 5 is always 1? */ - ret = (m_towns_serial_rom[m_towns_srom_position/8] & (1 << (m_towns_srom_position%8))) ? 1 : 0; - ret |= m_towns_srom_clk; - ret |= m_towns_srom_reset; - //logerror("SYS: (0x32) Serial ROM read [0x%02x, pos=%i]\n",ret,towns_srom_position); - return ret; - default: - //logerror("SYS: Unknown system port read (0x%02x)\n",offset+0x20); - return 0x00; - } -} - -WRITE8_MEMBER(towns_state::towns_system_w) -{ - switch(offset) - { - case 0x00: // bit 7 = NMI vector protect, bit 6 = power off, bit 0 = software reset, bit 3 = A20 line? -// space.m_maincpu->set_input_line(INPUT_LINE_A20,(data & 0x08) ? CLEAR_LINE : ASSERT_LINE); - logerror("SYS: port 0x20 write %02x\n",data); - break; - case 0x02: - logerror("SYS: (0x22) power port write %02x\n",data); - break; - case 0x08: - //logerror("SYS: (0x28) NMI mask write %02x\n",data); - m_nmi_mask = data & 0x01; - break; - case 0x12: - //logerror("SYS: (0x32) Serial ROM write %02x\n",data); - // clocks on low-to-high transition - if((data & 0x40) && m_towns_srom_clk == 0) // CLK - { // advance to next bit - m_towns_srom_position++; - } - if((data & 0x80) && m_towns_srom_reset == 0) // reset - { // reset to beginning - m_towns_srom_position = 0; - } - m_towns_srom_clk = data & 0x40; - m_towns_srom_reset = data & 0x80; - break; - default: - logerror("SYS: Unknown system port write 0x%02x (0x%02x)\n",data,offset); - } -} - -WRITE8_MEMBER(towns_state::towns_intervaltimer2_w) -{ - switch(offset) - { - case 0x00: - m_intervaltimer2_irqmask = data & 0x80; - break; - case 0x02: - m_intervaltimer2_period = (m_intervaltimer2_period & 0xff00) | data; - popmessage("Interval Timer 2 period changed to %04x",m_intervaltimer2_period); - break; - case 0x03: - m_intervaltimer2_period = (data << 8) | (m_intervaltimer2_period & 0x00ff); - popmessage("Interval Timer 2 period changed to %04x",m_intervaltimer2_period); - break; - } -} - -READ8_MEMBER(towns_state::towns_intervaltimer2_r) -{ - UINT8 ret = 0; - - switch(offset) - { - case 0x00: - if(m_intervaltimer2_timeout_flag != 0) - ret |= 0x40; - if(m_intervaltimer2_irqmask != 0) - ret |= 0x80; - m_intervaltimer2_timeout_flag = 0; // flag reset on read - return ret; - case 0x02: - return m_intervaltimer2_period & 0x00ff; - case 0x03: - return m_intervaltimer2_period >> 8; - } - return 0xff; -} - -void towns_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_RTC: - rtc_second(); - break; - case TIMER_FREERUN: - freerun_inc(); - break; - case TIMER_INTERVAL2: - intervaltimer2_timeout(); - break; - case TIMER_KEYBOARD: - poll_keyboard(); - break; - case TIMER_MOUSE: - mouse_timeout(); - break; - case TIMER_WAIT: - wait_end(); - break; - case TIMER_CDSTATUS: - towns_cd_status_ready(); - break; - case TIMER_CDDA: - towns_delay_cdda((cdrom_image_device*)ptr); - break; - } -} -void towns_state::freerun_inc() -{ - m_freerun_timer++; -} - -void towns_state::intervaltimer2_timeout() -{ - m_intervaltimer2_timeout_flag = 1; -} - -void towns_state::wait_end() -{ - m_maincpu->set_input_line(INPUT_LINE_HALT,CLEAR_LINE); -} - -READ8_MEMBER(towns_state::towns_sys6c_r) -{ - logerror("SYS: (0x6c) Timer? read\n"); - return 0x00; -} - -WRITE8_MEMBER(towns_state::towns_sys6c_w) -{ - // halts the CPU for 1 microsecond - m_maincpu->set_input_line(INPUT_LINE_HALT,ASSERT_LINE); - m_towns_wait_timer->adjust(attotime::from_usec(1),0,attotime::never); -} - -READ8_MEMBER(towns_state::towns_dma1_r) -{ -// logerror("DMA#1: read register %i\n",offset); - return m_dma_1->read(space, offset); -} - -WRITE8_MEMBER(towns_state::towns_dma1_w) -{ -// logerror("DMA#1: wrote 0x%02x to register %i\n",data,offset); - m_dma_1->write(space, offset, data); -} - -READ8_MEMBER(towns_state::towns_dma2_r) -{ - logerror("DMA#2: read register %i\n",offset); - return m_dma_2->read(space, offset); -} - -WRITE8_MEMBER(towns_state::towns_dma2_w) -{ - logerror("DMA#2: wrote 0x%02x to register %i\n",data,offset); - m_dma_2->write(space, offset, data); -} - -/* - * Floppy Disc Controller (MB8877A) - */ - -WRITE_LINE_MEMBER( towns_state::mb8877a_irq_w ) -{ - if(m_towns_fdc_irq6mask == 0) - state = 0; - m_pic_master->ir6_w(state); // IRQ6 = FDC - if(IRQ_LOG) logerror("PIC: IRQ6 (FDC) set to %i\n",state); -} - -WRITE_LINE_MEMBER( towns_state::mb8877a_drq_w ) -{ - m_dma_1->dmarq(state, 0); -} - -READ8_MEMBER(towns_state::towns_floppy_r) -{ - UINT8 ret; - - switch(offset) - { - case 0x00: - return m_fdc->status_r(space, 0); - case 0x02: - return m_fdc->track_r(space, 0); - case 0x04: - return m_fdc->sector_r(space, 0); - case 0x06: - return m_fdc->data_r(space, 0); - case 0x08: // selected drive status? - //logerror("FDC: read from offset 0x08\n"); - ret = 0x80; // always set - switch(m_towns_selected_drive) - { - case 1: - ret |= 0x0c; - if(m_flop0->get_device()->exists()) - ret |= 0x03; - break; - case 2: - ret |= 0x0c; - if(m_flop1->get_device()->exists()) - ret |= 0x03; - break; - case 3: - case 4: - case 0: - default: - break; - } - return ret; - case 0x0e: // DRVCHG - logerror("FDC: read from offset 0x0e\n"); - if(m_towns_selected_drive == 1) - return m_flop0->get_device()->dskchg_r(); - if(m_towns_selected_drive == 2) - return m_flop1->get_device()->dskchg_r(); - return 0x00; - default: - logerror("FDC: read from invalid or unimplemented register %02x\n",offset); - } - return 0xff; -} - -WRITE8_MEMBER(towns_state::towns_floppy_w) -{ - floppy_image_device* sel[4] = { m_flop0->get_device(), m_flop1->get_device(), NULL, NULL }; - - switch(offset) - { - case 0x00: - // Commands 0xd0 and 0xfe (Write Track) are apparently ignored? - if(data == 0xd0) - return; - if(data == 0xfe) - return; - m_fdc->cmd_w(space, 0,data); - logerror("FDC: Command %02x\n",data); - break; - case 0x02: - m_fdc->track_w(space, 0,data); - logerror("FDC: Track %02x\n",data); - break; - case 0x04: - m_fdc->sector_w(space, 0,data); - logerror("FDC: Sector %02x\n",data); - break; - case 0x06: - m_fdc->data_w(space, 0,data); - logerror("FDC: Data %02x\n",data); - break; - case 0x08: - // bit 5 - CLKSEL - if(m_towns_selected_drive != 0) - { - if(sel[m_towns_selected_drive-1] != NULL) - { - sel[m_towns_selected_drive-1]->mon_w((~data & 0x10)>>4); - sel[m_towns_selected_drive-1]->ss_w((data & 0x04)>>2); - } - } - m_fdc->dden_w(BIT(~data, 1)); - - m_towns_fdc_irq6mask = data & 0x01; - //logerror("FDC: Config drive%i %02x\n",m_towns_selected_drive-1,data); - - break; - case 0x0c: // drive select - switch(data & 0x0f) - { - case 0x00: - m_towns_selected_drive = 0; // No drive selected - break; - case 0x01: - m_towns_selected_drive = 1; - if(sel[0] != NULL) - m_fdc->set_floppy(sel[0]); - break; - case 0x02: - m_towns_selected_drive = 2; - if(sel[1] != NULL) - m_fdc->set_floppy(sel[1]); - break; - case 0x04: - m_towns_selected_drive = 3; - if(sel[2] != NULL) - m_fdc->set_floppy(sel[2]); - break; - case 0x08: - m_towns_selected_drive = 4; - if(sel[3] != NULL) - m_fdc->set_floppy(sel[3]); - break; - } - //logerror("FDC: drive select %02x\n",data); - break; - default: - logerror("FDC: write %02x to invalid or unimplemented register %02x\n",data,offset); - } -} - -READ16_MEMBER(towns_state::towns_fdc_dma_r) -{ UINT16 data = m_fdc->data_r(generic_space(), 0); - return data; -} - -WRITE16_MEMBER(towns_state::towns_fdc_dma_w) -{ - m_fdc->data_w(generic_space(), 0,data); -} - -/* - * Port 0x600-0x607 - Keyboard controller (8042 MCU) - * - * Sends two-byte code on each key press and release. - * First byte has the MSB set, and contains shift/ctrl/alt/kana flags - * Known bits: - * bit 7 = always 1 - * bit 4 = key release - * bit 3 = ctrl - * bit 2 = shift - * - * Second byte has the MSB reset, and contains the scancode of the key - * pressed or released. - * bit 7 = always 0 - * bits 6-0 = key scancode - */ -void towns_state::kb_sendcode(UINT8 scancode, int release) -{ - switch(release) - { - case 0: // key press - m_towns_kb_output = 0x80; - m_towns_kb_extend = scancode & 0x7f; - if(m_key3->read() & 0x00080000) - m_towns_kb_output |= 0x04; - if(m_key3->read() & 0x00040000) - m_towns_kb_output |= 0x08; - if(m_key3->read() & 0x06400000) - m_towns_kb_output |= 0x20; - break; - case 1: // key release - m_towns_kb_output = 0x90; - m_towns_kb_extend = scancode & 0x7f; - if(m_key3->read() & 0x00080000) - m_towns_kb_output |= 0x04; - if(m_key3->read() & 0x00040000) - m_towns_kb_output |= 0x08; - if(m_key3->read() & 0x06400000) - m_towns_kb_output |= 0x20; - break; - case 2: // extended byte - m_towns_kb_output = scancode; - m_towns_kb_extend = 0xff; - break; - } - m_towns_kb_status |= 0x01; - if(m_towns_kb_irq1_enable) - { - m_pic_master->ir1_w(1); - if(IRQ_LOG) logerror("PIC: IRQ1 (keyboard) set high\n"); - } - //logerror("KB: sending scancode 0x%02x\n",scancode); -} - -void towns_state::poll_keyboard() -{ - ioport_port* kb_ports[4] = { m_key1, m_key2, m_key3, m_key4 }; - int port,bit; - UINT8 scan; - UINT32 portval; - - scan = 0; - for(port=0;port<4;port++) - { - portval = kb_ports[port]->read(); - for(bit=0;bit<32;bit++) - { - if(((portval & (1<ir1_w(0); - if(IRQ_LOG) logerror("PIC: IRQ1 (keyboard) set low\n"); - if(m_towns_kb_extend != 0xff) - { - kb_sendcode(m_towns_kb_extend,2); - } - else - m_towns_kb_status &= ~0x01; - return ret; - case 1: // status - //logerror("KB: read status port, returning %02x\n",m_towns_kb_status); - return m_towns_kb_status; - default: - logerror("KB: read offset %02x\n",offset); - } - return 0x00; -} - -WRITE8_MEMBER(towns_state::towns_keyboard_w) -{ - switch(offset) - { - case 0: // command input - m_towns_kb_status &= ~0x08; - m_towns_kb_status |= 0x01; - break; - case 1: // control - m_towns_kb_status |= 0x08; - break; - case 2: // IRQ1 enable - m_towns_kb_irq1_enable = data & 0x01; - break; - default: - logerror("KB: wrote 0x%02x to offset %02x\n",data,offset); - } -} - -/* - * Port 0x60 - PIT Timer control - * On read: bit 0: Timer 0 output level - * bit 1: Timer 1 output level - * bits 4-2: Timer masks (timer 2 = beeper) - * On write: bits 2-0: Timer mask set - * bit 7: Timer 0 output reset - */ -UINT8 towns_state::speaker_get_spk() -{ - return m_towns_spkrdata & m_pit_out2; -} - - -void towns_state::speaker_set_spkrdata(UINT8 data) -{ - m_towns_spkrdata = data ? 1 : 0; - m_speaker->level_w(speaker_get_spk()); -} - - -READ8_MEMBER(towns_state::towns_port60_r) -{ - UINT8 val = 0x00; - - if (m_pit_out0) - val |= 0x01; - if (m_pit_out1) - val |= 0x02; - - val |= (m_towns_timer_mask & 0x07) << 2; - - //logerror("PIT: port 0x60 read, returning 0x%02x\n",val); - return val; -} - -WRITE8_MEMBER(towns_state::towns_port60_w) -{ - //device_t* dev = m_pic_master; - - if(data & 0x80) - { - //towns_pic_irq(dev,0); - m_timer0 = 0; - m_pic_master->ir0_w(m_timer0 || m_timer1); - } - m_towns_timer_mask = data & 0x07; - - speaker_set_spkrdata(data & 0x04); - - //logerror("PIT: wrote 0x%02x to port 0x60\n",data); -} - -READ8_MEMBER(towns_state::towns_sys5e8_r) -{ - switch(offset) - { - case 0x00: - logerror("SYS: read RAM size port (%i)\n",m_ram->size()); - return m_ram->size()/1048576; - case 0x02: - logerror("SYS: read port 5ec\n"); - return m_compat_mode & 0x01; - } - return 0x00; -} - -WRITE8_MEMBER(towns_state::towns_sys5e8_w) -{ - switch(offset) - { - case 0x00: - logerror("SYS: wrote 0x%02x to port 5e8\n",data); - break; - case 0x02: - logerror("SYS: wrote 0x%02x to port 5ec\n",data); - m_compat_mode = data & 0x01; - break; - } -} - -// Sound/LED control (I/O port 0x4e8-0x4ef) -// R/O -- (0x4e9) FM IRQ flag (bit 0), PCM IRQ flag (bit 3) -// (0x4ea) PCM IRQ mask -// R/W -- (0x4eb) PCM IRQ flag -// W/O -- (0x4ec) LED control -READ8_MEMBER(towns_state::towns_sound_ctrl_r) -{ - UINT8 ret = 0; - - switch(offset) - { - case 0x01: - if(m_towns_fm_irq_flag) - ret |= 0x01; - if(m_towns_pcm_irq_flag) - ret |= 0x08; - break; - case 0x03: - ret = m_towns_pcm_channel_flag; - m_towns_pcm_channel_flag = 0; - m_towns_pcm_irq_flag = 0; - if(m_towns_fm_irq_flag == 0) - { - m_pic_slave->ir5_w(0); - if(IRQ_LOG) logerror("PIC: IRQ13 (PCM) set low\n"); - } - break; -// default: - //logerror("FM: unimplemented port 0x%04x read\n",offset + 0x4e8); - } - return ret; -} - -WRITE8_MEMBER(towns_state::towns_sound_ctrl_w) -{ - switch(offset) - { - case 0x02: // PCM channel interrupt mask - m_towns_pcm_channel_mask = data; - break; - default: - logerror("FM: unimplemented port 0x%04x write %02x\n",offset + 0x4e8,data); - } -} - -// Controller ports -// Joysticks are multiplexed, with fire buttons available when bits 0 and 1 of port 0x4d6 are high. (bits 2 and 3 for second port?) -void towns_state::mouse_timeout() -{ - m_towns_mouse_output = MOUSE_START; // reset mouse data -} - -READ8_MEMBER(towns_state::towns_padport_r) -{ - UINT8 ret = 0x00; - UINT32 porttype = m_ctrltype->read(); - UINT8 extra1; - UINT8 extra2; - UINT32 state; - - if(offset == 0) - { - if((porttype & 0x0f) == 0x01) - { - extra1 = m_joy1_ex->read(); - - if(m_towns_pad_mask & 0x10) - ret |= (m_joy1->read() & 0x3f) | 0x40; - else - ret |= (m_joy1->read() & 0x0f) | 0x30; - - if(extra1 & 0x01) // Run button = left+right - ret &= ~0x0c; - if(extra1 & 0x02) // Select button = up+down - ret &= ~0x03; - - if((extra1 & 0x10) && (m_towns_pad_mask & 0x01)) - ret &= ~0x10; - if((extra1 & 0x20) && (m_towns_pad_mask & 0x02)) - ret &= ~0x20; - } - if((porttype & 0x0f) == 0x04) // 6-button joystick - { - extra1 = m_6b_joy1_ex->read(); - - if(m_towns_pad_mask & 0x10) - ret |= 0x7f; - else - ret |= (m_6b_joy1->read() & 0x0f) | 0x70; - - if(!(m_towns_pad_mask & 0x10)) - { - if(extra1 & 0x01) // Run button = left+right - ret &= ~0x0c; - if(extra1 & 0x02) // Select button = up+down - ret &= ~0x03; - if((extra1 & 0x04) && (m_towns_pad_mask & 0x01)) - ret &= ~0x10; - if((extra1 & 0x08) && (m_towns_pad_mask & 0x02)) - ret &= ~0x20; - } - if(m_towns_pad_mask & 0x10) - { - if(extra1 & 0x10) - ret &= ~0x08; - if(extra1 & 0x20) - ret &= ~0x04; - if(extra1 & 0x40) - ret &= ~0x02; - if(extra1 & 0x80) - ret &= ~0x01; - } - } - if((porttype & 0x0f) == 0x02) // mouse - { - switch(m_towns_mouse_output) - { - case MOUSE_X_HIGH: - ret |= ((m_towns_mouse_x & 0xf0) >> 4); - break; - case MOUSE_X_LOW: - ret |= (m_towns_mouse_x & 0x0f); - break; - case MOUSE_Y_HIGH: - ret |= ((m_towns_mouse_y & 0xf0) >> 4); - break; - case MOUSE_Y_LOW: - ret |= (m_towns_mouse_y & 0x0f); - break; - case MOUSE_START: - case MOUSE_SYNC: - default: - if(m_towns_mouse_output < MOUSE_Y_LOW) - ret |= 0x0f; - } - - // button states are always visible - state = m_mouse1->read(); - if(!(state & 0x01)) - ret |= 0x10; - if(!(state & 0x02)) - ret |= 0x20; - if(m_towns_pad_mask & 0x10) - ret |= 0x40; - } - - } - if(offset == 1) // second joystick port - { - if((porttype & 0xf0) == 0x10) - { - extra2 = m_joy2_ex->read(); - - if(m_towns_pad_mask & 0x20) - ret |= ((m_joy2->read() & 0x3f)) | 0x40; - else - ret |= ((m_joy2->read() & 0x0f)) | 0x30; - - if(extra2 & 0x01) - ret &= ~0x0c; - if(extra2 & 0x02) - ret &= ~0x03; - - if((extra2 & 0x10) && (m_towns_pad_mask & 0x04)) - ret &= ~0x10; - if((extra2 & 0x20) && (m_towns_pad_mask & 0x08)) - ret &= ~0x20; - } - if((porttype & 0xf0) == 0x40) // 6-button joystick - { - extra2 = m_6b_joy2_ex->read(); - - if(m_towns_pad_mask & 0x20) - ret |= 0x7f; - else - ret |= ((m_6b_joy2->read() & 0x0f)) | 0x70; - - if(!(m_towns_pad_mask & 0x10)) - { - if(extra2 & 0x01) - ret &= ~0x0c; - if(extra2 & 0x02) - ret &= ~0x03; - if((extra2 & 0x10) && (m_towns_pad_mask & 0x04)) - ret &= ~0x10; - if((extra2 & 0x20) && (m_towns_pad_mask & 0x08)) - ret &= ~0x20; - } - if(m_towns_pad_mask & 0x20) - { - if(extra2 & 0x10) - ret &= ~0x08; - if(extra2 & 0x20) - ret &= ~0x04; - if(extra2 & 0x40) - ret &= ~0x02; - if(extra2 & 0x80) - ret &= ~0x01; - } - } - if((porttype & 0xf0) == 0x20) // mouse - { - switch(m_towns_mouse_output) - { - case MOUSE_X_HIGH: - ret |= ((m_towns_mouse_x & 0xf0) >> 4); - break; - case MOUSE_X_LOW: - ret |= (m_towns_mouse_x & 0x0f); - break; - case MOUSE_Y_HIGH: - ret |= ((m_towns_mouse_y & 0xf0) >> 4); - break; - case MOUSE_Y_LOW: - ret |= (m_towns_mouse_y & 0x0f); - break; - case MOUSE_START: - case MOUSE_SYNC: - default: - if(m_towns_mouse_output < MOUSE_Y_LOW) - ret |= 0x0f; - } - - // button states are always visible - state = m_mouse1->read(); - if(!(state & 0x01)) - ret |= 0x10; - if(!(state & 0x02)) - ret |= 0x20; - if(m_towns_pad_mask & 0x20) - ret |= 0x40; - } - } - - return ret; -} - -WRITE8_MEMBER(towns_state::towns_pad_mask_w) -{ - UINT8 current_x,current_y; - UINT32 type = m_ctrltype->read(); - - m_towns_pad_mask = (data & 0xff); - if((type & 0x0f) == 0x02) // mouse - { - if((m_towns_pad_mask & 0x10) != 0 && (m_prev_pad_mask & 0x10) == 0) - { - if(m_towns_mouse_output == MOUSE_START) - { - m_towns_mouse_output = MOUSE_X_HIGH; - current_x = m_mouse2->read(); - current_y = m_mouse3->read(); - m_towns_mouse_x = m_prev_x - current_x; - m_towns_mouse_y = m_prev_y - current_y; - m_prev_x = current_x; - m_prev_y = current_y; - } - else - m_towns_mouse_output++; - m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); - } - if((m_towns_pad_mask & 0x10) == 0 && (m_prev_pad_mask & 0x10) != 0) - { - if(m_towns_mouse_output == MOUSE_START) - { - m_towns_mouse_output = MOUSE_SYNC; - current_x = m_mouse2->read(); - current_y = m_mouse3->read(); - m_towns_mouse_x = m_prev_x - current_x; - m_towns_mouse_y = m_prev_y - current_y; - m_prev_x = current_x; - m_prev_y = current_y; - } - else - m_towns_mouse_output++; - m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); - } - m_prev_pad_mask = m_towns_pad_mask; - } - if((type & 0xf0) == 0x20) // mouse - { - if((m_towns_pad_mask & 0x20) != 0 && (m_prev_pad_mask & 0x20) == 0) - { - if(m_towns_mouse_output == MOUSE_START) - { - m_towns_mouse_output = MOUSE_X_HIGH; - current_x = m_mouse2->read(); - current_y = m_mouse3->read(); - m_towns_mouse_x = m_prev_x - current_x; - m_towns_mouse_y = m_prev_y - current_y; - m_prev_x = current_x; - m_prev_y = current_y; - } - else - m_towns_mouse_output++; - m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); - } - if((m_towns_pad_mask & 0x20) == 0 && (m_prev_pad_mask & 0x20) != 0) - { - if(m_towns_mouse_output == MOUSE_START) - { - m_towns_mouse_output = MOUSE_SYNC; - current_x = m_mouse2->read(); - current_y = m_mouse3->read(); - m_towns_mouse_x = m_prev_x - current_x; - m_towns_mouse_y = m_prev_y - current_y; - m_prev_x = current_x; - m_prev_y = current_y; - } - else - m_towns_mouse_output++; - m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); - } - m_prev_pad_mask = m_towns_pad_mask; - } -} - -READ8_MEMBER( towns_state::towns_cmos_low_r ) -{ - if(m_towns_mainmem_enable != 0) - return m_messram->pointer()[offset + 0xd8000]; - - if(m_nvram) - return m_nvram[offset]; - else - return m_nvram16[offset]; -} - -WRITE8_MEMBER( towns_state::towns_cmos_low_w ) -{ - if(m_towns_mainmem_enable != 0) - m_messram->pointer()[offset+0xd8000] = data; - else - if(m_nvram) - m_nvram[offset] = data; - else - m_nvram16[offset] = data; -} - -READ8_MEMBER( towns_state::towns_cmos_r ) -{ - if(m_nvram) - return m_nvram[offset]; - else - return m_nvram16[offset]; -} - -WRITE8_MEMBER( towns_state::towns_cmos_w ) -{ - if(m_nvram) - m_nvram[offset] = data; - else - m_nvram16[offset] = data; -} - -void towns_state::towns_update_video_banks(address_space& space) -{ - UINT8* ROM; - - if(m_towns_mainmem_enable != 0) // first MB is RAM - { - ROM = m_user->base(); - -// membank(1)->set_base(m_messram->pointer()+0xc0000); -// membank(2)->set_base(m_messram->pointer()+0xc8000); -// membank(3)->set_base(m_messram->pointer()+0xc9000); -// membank(4)->set_base(m_messram->pointer()+0xca000); -// membank(5)->set_base(m_messram->pointer()+0xca000); -// membank(10)->set_base(m_messram->pointer()+0xca800); - membank("bank6")->set_base(m_messram->pointer()+0xcb000); - membank("bank7")->set_base(m_messram->pointer()+0xcb000); - if(m_towns_system_port & 0x02) - membank("bank11")->set_base(m_messram->pointer()+0xf8000); - else - membank("bank11")->set_base(ROM+0x238000); - membank("bank12")->set_base(m_messram->pointer()+0xf8000); - return; - } - else // enable I/O ports and VRAM - { - ROM = m_user->base(); - -// membank(1)->set_base(towns_gfxvram+(towns_vram_rplane*0x8000)); -// membank(2)->set_base(towns_txtvram); -// membank(3)->set_base(m_messram->pointer()+0xc9000); -// if(towns_ankcg_enable != 0) -// membank(4)->set_base(ROM+0x180000+0x3d000); // ANK CG 8x8 -// else -// membank(4)->set_base(towns_txtvram+0x2000); -// membank(5)->set_base(towns_txtvram+0x2000); -// membank(10)->set_base(m_messram->pointer()+0xca800); - if(m_towns_ankcg_enable != 0) - membank("bank6")->set_base(ROM+0x180000+0x3d800); // ANK CG 8x16 - else - membank("bank6")->set_base(m_messram->pointer()+0xcb000); - membank("bank7")->set_base(m_messram->pointer()+0xcb000); - if(m_towns_system_port & 0x02) - membank("bank11")->set_base(m_messram->pointer()+0xf8000); - else - membank("bank11")->set_base(ROM+0x238000); - membank("bank12")->set_base(m_messram->pointer()+0xf8000); - return; - } -} - -READ8_MEMBER( towns_state::towns_sys480_r ) -{ - if(m_towns_system_port & 0x02) - return 0x02; - else - return 0x00; -} - -WRITE8_MEMBER( towns_state::towns_sys480_w ) -{ - m_towns_system_port = data; - m_towns_ram_enable = data & 0x02; - towns_update_video_banks(space); -} - -WRITE8_MEMBER( towns_state::towns_video_404_w ) -{ - m_towns_mainmem_enable = data & 0x80; - towns_update_video_banks(space); -} - -READ8_MEMBER( towns_state::towns_video_404_r ) -{ - if(m_towns_mainmem_enable != 0) - return 0x80; - else - return 0x00; -} - -/* - * I/O ports 0x4c0-0x4cf - * CD-ROM driver (custom?) - * - * 0x4c0 - Status port (R/W) - * bit 7 - IRQ from sub MPU (reset when read) - * bit 6 - IRQ from DMA end (reset when read) - * bit 5 - Software transfer - * bit 4 - DMA transfer - * bit 1 - status read request - * bit 0 - ready - * Note: IRQ bits are only set high if the IRQ bit in the command byte is NOT set. - * - * 0x4c2 - Command port (R/W) - * On read, returns status byte (4 in total?) - * On write, performs specified command: - * bit 7 - command type - * bit 6 - IRQ - * bit 5 - status - * bits 4-0 - command - * Type=1: - * 0 = set state - * 1 = set state (CDDASET) - * Type=0: - * 0 = Seek - * 2 = Read (MODE1) - * 5 = TOC Read - * - * 0x4c4 - Parameter port (R/W) - * Inserts a byte into an array of 8 bytes used for command parameters - * Writing to this port puts the byte at the front of the array, and - * pushes the other parameters back. - * - * 0x4c6 (W/O) - * bit 3 - software transfer mode - * bit 4 - DMA transfer mode - * - */ -void towns_state::towns_cdrom_set_irq(int line,int state) -{ - switch(line) - { - case TOWNS_CD_IRQ_MPU: - if(state != 0) - { - if(m_towns_cd.command & 0x40) - { -// if(m_towns_cd.mpu_irq_enable) - { - m_towns_cd.status |= 0x80; - m_pic_slave->ir1_w(1); - if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM) set high\n"); - } - } - else - m_towns_cd.status |= 0x80; - } - else - { - m_towns_cd.status &= ~0x80; - m_pic_slave->ir1_w(0); - if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM) set low\n"); - } - break; - case TOWNS_CD_IRQ_DMA: - if(state != 0) - { - if(m_towns_cd.command & 0x40) - { -// if(m_towns_cd.dma_irq_enable) - { - m_towns_cd.status |= 0x40; - m_pic_slave->ir1_w(1); - if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM DMA) set high\n"); - } - } - else - m_towns_cd.status |= 0x40; - } - else - { - m_towns_cd.status &= ~0x40; - m_pic_slave->ir1_w(0); - if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM DMA) set low\n"); - } - break; - } -} - -void towns_state::towns_cd_status_ready() -{ - m_towns_cd.status |= 0x02; // status read request - m_towns_cd.status |= 0x01; // ready - m_towns_cd.cmd_status_ptr = 0; - towns_cdrom_set_irq(TOWNS_CD_IRQ_MPU,1); -} - -void towns_state::towns_cd_set_status(UINT8 st0, UINT8 st1, UINT8 st2, UINT8 st3) -{ - m_towns_cd.cmd_status[0] = st0; - m_towns_cd.cmd_status[1] = st1; - m_towns_cd.cmd_status[2] = st2; - m_towns_cd.cmd_status[3] = st3; - // wait a bit - m_towns_status_timer->adjust(attotime::from_msec(1),0,attotime::never); -} - -UINT8 towns_state::towns_cd_get_track() -{ - cdrom_image_device* cdrom = m_cdrom; - UINT32 lba = m_cdda->get_audio_lba(); - UINT8 track; - - for(track=1;track<99;track++) - { - if(cdrom_get_track_start(cdrom->get_cdrom_file(),track) > lba) - break; - } - return track; -} - -TIMER_CALLBACK_MEMBER(towns_state::towns_cdrom_read_byte) -{ - upd71071_device* device = (upd71071_device* )ptr; - int masked; - // TODO: support software transfers, for now DMA is assumed. - - if(m_towns_cd.buffer_ptr < 0) // transfer has ended - return; - - masked = device->dmarq(param, 3); // CD-ROM controller uses DMA1 channel 3 -// logerror("DMARQ: param=%i ret=%i bufferptr=%i\n",param,masked,m_towns_cd.buffer_ptr); - if(param != 0) - { - m_towns_cd.read_timer->adjust(attotime::from_hz(300000)); - } - else - { - if(masked != 0) // check if the DMA channel is masked - { - m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); - return; - } - if(m_towns_cd.buffer_ptr < 2048) - m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); - else - { // end of transfer - m_towns_cd.status &= ~0x10; // no longer transferring by DMA - m_towns_cd.status &= ~0x20; // no longer transferring by software - logerror("DMA1: end of transfer (LBA=%08x)\n",m_towns_cd.lba_current); - if(m_towns_cd.lba_current >= m_towns_cd.lba_last) - { - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x06,0x00,0x00,0x00); - towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); - m_towns_cd.buffer_ptr = -1; - m_towns_cd.status |= 0x01; // ready - } - else - { - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x22,0x00,0x00,0x00); - towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); - cdrom_read_data(m_cdrom->get_cdrom_file(),++m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); - m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); - m_towns_cd.buffer_ptr = -1; - } - } - } -} - -UINT8 towns_state::towns_cdrom_read_byte_software() -{ - UINT8 ret; - if(m_towns_cd.buffer_ptr < 0) // transfer has ended - return 0x00; - - ret = m_towns_cd.buffer[m_towns_cd.buffer_ptr++]; - - if(m_towns_cd.buffer_ptr >= 2048) - { // end of transfer - m_towns_cd.status &= ~0x10; // no longer transferring by DMA - m_towns_cd.status &= ~0x20; // no longer transferring by software - logerror("CD: end of software transfer (LBA=%08x)\n",m_towns_cd.lba_current); - if(m_towns_cd.lba_current >= m_towns_cd.lba_last) - { - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x06,0x00,0x00,0x00); - towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); - m_towns_cd.buffer_ptr = -1; - m_towns_cd.status |= 0x01; // ready - } - else - { - cdrom_read_data(m_cdrom->get_cdrom_file(),++m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x21,0x00,0x00,0x00); - towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); - m_towns_cd.status &= ~0x10; - m_towns_cd.status |= 0x20; - m_towns_cd.buffer_ptr = -1; - } - } - return ret; -} - -void towns_state::towns_cdrom_read(cdrom_image_device* device) -{ - // MODE 1 read - // load data into buffer to be sent via DMA1 channel 3 - // A set of status bytes is sent after each sector, and DMA is paused - // so that the DMA controller than be set up again. - // parameters: - // 3 bytes: MSF of first sector to read - // 3 bytes: MSF of last sector to read - UINT32 lba1,lba2,track; - - lba1 = m_towns_cd.parameter[7] << 16; - lba1 += m_towns_cd.parameter[6] << 8; - lba1 += m_towns_cd.parameter[5]; - lba2 = m_towns_cd.parameter[4] << 16; - lba2 += m_towns_cd.parameter[3] << 8; - lba2 += m_towns_cd.parameter[2]; - m_towns_cd.lba_current = msf_to_lbafm(lba1); - m_towns_cd.lba_last = msf_to_lbafm(lba2); - - // first track starts at 00:02:00 - this is hardcoded in the boot procedure - track = cdrom_get_track(device->get_cdrom_file(),m_towns_cd.lba_current); - if(track < 2) - { // recalculate LBA - m_towns_cd.lba_current -= 150; - m_towns_cd.lba_last -= 150; - } - - // parameter 7 = sector count? - if(m_towns_cd.parameter[1] != 0) - m_towns_cd.lba_last += m_towns_cd.parameter[1]; - - logerror("CD: Mode 1 read from LBA next:%i last:%i track:%i\n",m_towns_cd.lba_current,m_towns_cd.lba_last,track); - - if(m_towns_cd.lba_current > m_towns_cd.lba_last) - { - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x01,0x00,0x00,0x00); - } - else - { - cdrom_read_data(device->get_cdrom_file(),m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); - if(m_towns_cd.software_tx) - { - m_towns_cd.status &= ~0x10; // not a DMA transfer - m_towns_cd.status |= 0x20; // software transfer - } - else - { - m_towns_cd.status |= 0x10; // DMA transfer begin - m_towns_cd.status &= ~0x20; // not a software transfer - } -// m_towns_cd.buffer_ptr = 0; -// m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 2; - towns_cd_set_status(0x00,0x00,0x00,0x00); - } - else - { - m_towns_cd.extra_status = 0; - if(m_towns_cd.software_tx) - towns_cd_set_status(0x21,0x00,0x00,0x00); - else - towns_cd_set_status(0x22,0x00,0x00,0x00); - } - } -} - -void towns_state::towns_cdrom_play_cdda(cdrom_image_device* device) -{ - // PLAY AUDIO - // Plays CD-DA audio from the specified MSF - // Parameters: - // 3 bytes: starting MSF of audio to play - // 3 bytes: ending MSF of audio to play (can span multiple tracks) - UINT32 lba1,lba2; - - lba1 = m_towns_cd.parameter[7] << 16; - lba1 += m_towns_cd.parameter[6] << 8; - lba1 += m_towns_cd.parameter[5]; - lba2 = m_towns_cd.parameter[4] << 16; - lba2 += m_towns_cd.parameter[3] << 8; - lba2 += m_towns_cd.parameter[2]; - m_towns_cd.cdda_current = msf_to_lbafm(lba1); - m_towns_cd.cdda_length = msf_to_lbafm(lba2) - m_towns_cd.cdda_current; - - m_cdda->set_cdrom(device->get_cdrom_file()); - m_cdda->start_audio(m_towns_cd.cdda_current,m_towns_cd.cdda_length); - logerror("CD: CD-DA start from LBA:%i length:%i\n",m_towns_cd.cdda_current,m_towns_cd.cdda_length); - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 1; - towns_cd_set_status(0x00,0x03,0x00,0x00); - } -} - -void towns_state::towns_delay_cdda(cdrom_image_device* dev) -{ - towns_cdrom_play_cdda(dev); -} - -void towns_state::towns_cdrom_execute_command(cdrom_image_device* device) -{ - if(device->get_cdrom_file() == NULL) - { // No CD in drive - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x10,0x00,0x00,0x00); - } - } - else - { - m_towns_cd.status &= ~0x02; - switch(m_towns_cd.command & 0x9f) - { - case 0x00: // Seek - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 1; - towns_cd_set_status(0x00,0x00,0x00,0x00); - } - logerror("CD: Command 0x00: SEEK\n"); - break; - case 0x01: // unknown - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x00,0xff,0xff,0xff); - } - logerror("CD: Command 0x01: unknown\n"); - break; - case 0x02: // Read (MODE1) - logerror("CD: Command 0x02: READ MODE1\n"); - towns_cdrom_read(device); - break; - case 0x04: // Play Audio Track - logerror("CD: Command 0x04: PLAY CD-DA\n"); - m_towns_cdda_timer->set_ptr(device); - m_towns_cdda_timer->adjust(attotime::from_msec(1),0,attotime::never); - break; - case 0x05: // Read TOC - logerror("CD: Command 0x05: READ TOC\n"); - m_towns_cd.extra_status = 1; - towns_cd_set_status(0x00,0x00,0x00,0x00); - break; - case 0x06: // Read CD-DA state? - logerror("CD: Command 0x06: READ CD-DA STATE\n"); - m_towns_cd.extra_status = 1; - towns_cd_set_status(0x00,0x00,0x00,0x00); - break; - case 0x80: // set state - logerror("CD: Command 0x80: set state\n"); - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 0; - if(m_cdda->audio_active() && !m_cdda->audio_paused()) - towns_cd_set_status(0x00,0x03,0x00,0x00); - else - towns_cd_set_status(0x00,0x01,0x00,0x00); - - } - break; - case 0x81: // set state (CDDASET) - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x00,0x00,0x00,0x00); - } - logerror("CD: Command 0x81: set state (CDDASET)\n"); - break; - case 0x84: // Stop CD audio track -- generates no status output? - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 1; - towns_cd_set_status(0x00,0x00,0x00,0x00); - } - m_cdda->pause_audio(1); - logerror("CD: Command 0x84: STOP CD-DA\n"); - break; - case 0x85: // Stop CD audio track (difference from 0x84?) - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 1; - towns_cd_set_status(0x00,0x00,0x00,0x00); - } - m_cdda->pause_audio(1); - logerror("CD: Command 0x85: STOP CD-DA\n"); - break; - case 0x87: // Resume CD-DA playback - if(m_towns_cd.command & 0x20) - { - m_towns_cd.extra_status = 1; - towns_cd_set_status(0x00,0x03,0x00,0x00); - } - m_cdda->pause_audio(0); - logerror("CD: Command 0x87: RESUME CD-DA\n"); - break; - default: - m_towns_cd.extra_status = 0; - towns_cd_set_status(0x10,0x00,0x00,0x00); - logerror("CD: Unknown or unimplemented command %02x\n",m_towns_cd.command); - } - } -} - -READ16_MEMBER(towns_state::towns_cdrom_dma_r) -{ - if(m_towns_cd.buffer_ptr >= 2048) - return 0x00; - return m_towns_cd.buffer[m_towns_cd.buffer_ptr++]; -} - -READ8_MEMBER(towns_state::towns_cdrom_r) -{ - UINT32 addr = 0; - UINT8 ret = 0; - - ret = m_towns_cd.cmd_status[m_towns_cd.cmd_status_ptr]; - - switch(offset) - { - case 0x00: // status - //logerror("CD: status read, returning %02x\n",towns_cd.status); - return m_towns_cd.status; - case 0x01: // command status - if(m_towns_cd.cmd_status_ptr >= 3) - { - m_towns_cd.status &= ~0x02; - // check for more status bytes - if(m_towns_cd.extra_status != 0) - { - switch(m_towns_cd.command & 0x9f) - { - case 0x00: // seek - towns_cd_set_status(0x04,0x00,0x00,0x00); - m_towns_cd.extra_status = 0; - break; - case 0x02: // read - if(m_towns_cd.extra_status == 2) - towns_cd_set_status(0x22,0x00,0x00,0x00); - m_towns_cd.extra_status = 0; - break; - case 0x04: // play cdda - towns_cd_set_status(0x07,0x00,0x00,0x00); - m_towns_cd.extra_status = 0; - break; - case 0x05: // read toc - switch(m_towns_cd.extra_status) - { - case 1: - case 3: - towns_cd_set_status(0x16,0x00,0x00,0x00); - m_towns_cd.extra_status++; - break; - case 2: // st1 = first track number (BCD) - towns_cd_set_status(0x17,0x01,0x00,0x00); - m_towns_cd.extra_status++; - break; - case 4: // st1 = last track number (BCD) - towns_cd_set_status(0x17, - byte_to_bcd(cdrom_get_last_track(m_cdrom->get_cdrom_file())), - 0x00,0x00); - m_towns_cd.extra_status++; - break; - case 5: // st1 = control/adr of track 0xaa? - towns_cd_set_status(0x16, - cdrom_get_adr_control(m_cdrom->get_cdrom_file(),0xaa), - 0xaa,0x00); - m_towns_cd.extra_status++; - break; - case 6: // st1/2/3 = address of track 0xaa? (BCD) - addr = cdrom_get_track_start(m_cdrom->get_cdrom_file(),0xaa); - addr = lba_to_msf(addr); - towns_cd_set_status(0x17, - (addr & 0xff0000) >> 16,(addr & 0x00ff00) >> 8,addr & 0x0000ff); - m_towns_cd.extra_status++; - break; - default: // same as case 5 and 6, but for each individual track - if(m_towns_cd.extra_status & 0x01) - { - towns_cd_set_status(0x16, - ((cdrom_get_adr_control(m_cdrom->get_cdrom_file(),(m_towns_cd.extra_status/2)-3) & 0x0f) << 4) - | ((cdrom_get_adr_control(m_cdrom->get_cdrom_file(),(m_towns_cd.extra_status/2)-3) & 0xf0) >> 4), - (m_towns_cd.extra_status/2)-3,0x00); - m_towns_cd.extra_status++; - } - else - { - addr = cdrom_get_track_start(m_cdrom->get_cdrom_file(),(m_towns_cd.extra_status/2)-4); - addr = lba_to_msf(addr); - towns_cd_set_status(0x17, - (addr & 0xff0000) >> 16,(addr & 0x00ff00) >> 8,addr & 0x0000ff); - if(((m_towns_cd.extra_status/2)-3) >= cdrom_get_last_track(m_cdrom->get_cdrom_file())) - { - m_towns_cd.extra_status = 0; - } - else - m_towns_cd.extra_status++; - } - break; - } - break; - case 0x06: // read CD-DA state - switch(m_towns_cd.extra_status) - { - case 1: // st2 = track number - towns_cd_set_status(0x18, - 0x00,towns_cd_get_track(),0x00); - m_towns_cd.extra_status++; - break; - case 2: // st0/1/2 = MSF from beginning of current track - addr = m_cdda->get_audio_lba(); - addr = lba_to_msf(addr - m_towns_cd.cdda_current); - towns_cd_set_status(0x19, - (addr & 0xff0000) >> 16,(addr & 0x00ff00) >> 8,addr & 0x0000ff); - m_towns_cd.extra_status++; - break; - case 3: // st1/2 = current MSF - addr = m_cdda->get_audio_lba(); - addr = lba_to_msf(addr); // this data is incorrect, but will do until exact meaning is found - towns_cd_set_status(0x19, - 0x00,(addr & 0xff0000) >> 16,(addr & 0x00ff00) >> 8); - m_towns_cd.extra_status++; - break; - case 4: - addr = m_cdda->get_audio_lba(); - addr = lba_to_msf(addr); // this data is incorrect, but will do until exact meaning is found - towns_cd_set_status(0x20, - addr & 0x0000ff,0x00,0x00); - m_towns_cd.extra_status = 0; - break; - } - break; - case 0x84: - towns_cd_set_status(0x11,0x00,0x00,0x00); - m_towns_cd.extra_status = 0; - break; - case 0x85: - towns_cd_set_status(0x12,0x00,0x00,0x00); - m_towns_cd.extra_status = 0; - break; - } - } - } - logerror("CD: reading command status port (%i), returning %02x\n",m_towns_cd.cmd_status_ptr,ret); - m_towns_cd.cmd_status_ptr++; - if(m_towns_cd.cmd_status_ptr > 3) - { - m_towns_cd.cmd_status_ptr = 0; -/* if(m_towns_cd.extra_status != 0) - { - towns_cdrom_set_irq(space.machine(),TOWNS_CD_IRQ_MPU,1); - m_towns_cd.status |= 0x02; - }*/ - } - return ret; - case 0x02: // data transfer (used in software transfers) - if(m_towns_cd.software_tx) - { - return towns_cdrom_read_byte_software(); - } - default: - return 0x00; - } -} - -WRITE8_MEMBER(towns_state::towns_cdrom_w) -{ - int x; - switch(offset) - { - case 0x00: // status - if(data & 0x80) - towns_cdrom_set_irq(TOWNS_CD_IRQ_MPU,0); - if(data & 0x40) - towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,0); - if(data & 0x04) - logerror("CD: sub MPU reset\n"); - m_towns_cd.mpu_irq_enable = data & 0x02; - m_towns_cd.dma_irq_enable = data & 0x01; - logerror("CD: status write %02x\n",data); - break; - case 0x01: // command - m_towns_cd.command = data; - towns_cdrom_execute_command(m_cdrom); - logerror("CD: command %02x sent\n",data); - logerror("CD: parameters: %02x %02x %02x %02x %02x %02x %02x %02x\n", - m_towns_cd.parameter[7],m_towns_cd.parameter[6],m_towns_cd.parameter[5], - m_towns_cd.parameter[4],m_towns_cd.parameter[3],m_towns_cd.parameter[2], - m_towns_cd.parameter[1],m_towns_cd.parameter[0]); - break; - case 0x02: // parameter - for(x=7;x>0;x--) - m_towns_cd.parameter[x] = m_towns_cd.parameter[x-1]; - m_towns_cd.parameter[0] = data; - logerror("CD: parameter %02x added\n",data); - break; - case 0x03: - if(data & 0x08) // software transfer - { - m_towns_cd.status &= ~0x10; // no DMA transfer - m_towns_cd.status |= 0x20; - m_towns_cd.software_tx = true; - m_towns_cd.buffer_ptr = 0; - } - if(data & 0x10) - { - m_towns_cd.status |= 0x10; // DMA transfer begin - m_towns_cd.status &= ~0x20; // not a software transfer - m_towns_cd.software_tx = false; - if(m_towns_cd.buffer_ptr < 0) - { - m_towns_cd.buffer_ptr = 0; - m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); - } - } - logerror("CD: transfer mode write %02x\n",data); - break; - default: - logerror("CD: write %02x to port %02x\n",data,offset*2); - } -} - - -/* CMOS RTC - * 0x70: Data port - * 0x80: Register select - */ -READ8_MEMBER(towns_state::towns_rtc_r) -{ - return 0x80 | m_towns_rtc_reg[m_towns_rtc_select]; -} - -WRITE8_MEMBER(towns_state::towns_rtc_w) -{ - m_towns_rtc_data = data; -} - -WRITE8_MEMBER(towns_state::towns_rtc_select_w) -{ - if(data & 0x80) - { - if(data & 0x01) - m_towns_rtc_select = m_towns_rtc_data & 0x0f; - } -} - -void towns_state::rtc_hour() -{ - m_towns_rtc_reg[4]++; - if(m_towns_rtc_reg[4] > 4 && m_towns_rtc_reg[5] == 2) - { - m_towns_rtc_reg[4] = 0; - m_towns_rtc_reg[5] = 0; - } - else if(m_towns_rtc_reg[4] > 9) - { - m_towns_rtc_reg[4] = 0; - m_towns_rtc_reg[5]++; - } -} - -void towns_state::rtc_minute() -{ - m_towns_rtc_reg[2]++; - if(m_towns_rtc_reg[2] > 9) - { - m_towns_rtc_reg[2] = 0; - m_towns_rtc_reg[3]++; - if(m_towns_rtc_reg[3] > 5) - { - m_towns_rtc_reg[3] = 0; - rtc_hour(); - } - } -} - -void towns_state::rtc_second() -{ - // increase RTC time by one second - m_towns_rtc_reg[0]++; - if(m_towns_rtc_reg[0] > 9) - { - m_towns_rtc_reg[0] = 0; - m_towns_rtc_reg[1]++; - if(m_towns_rtc_reg[1] > 5) - { - m_towns_rtc_reg[1] = 0; - rtc_minute(); - } - } -} - -// SCSI controller - I/O ports 0xc30 and 0xc32 -READ16_MEMBER(towns_state::towns_scsi_dma_r) -{ - return m_scsi->fmscsi_data_r(); -} - -WRITE16_MEMBER(towns_state::towns_scsi_dma_w) -{ - m_scsi->fmscsi_data_w(data & 0xff); -} - -WRITE_LINE_MEMBER(towns_state::towns_scsi_irq) -{ - m_pic_slave->ir0_w(state); - if(IRQ_LOG) - logerror("PIC: IRQ8 (SCSI) set to %i\n",state); -} - -WRITE_LINE_MEMBER(towns_state::towns_scsi_drq) -{ - m_dma_1->dmarq(state, 1); // SCSI HDs use channel 1 -} - - -// Volume ports - I/O ports 0x4e0-0x4e3 -// 0x4e0 = input volume level -// 0x4e1 = input channel select -// 4 = Line in, left channel -// 5 = Line in, right channel -// 0x4e2 = output volume level -// 0x4e3 = output channel select -// 2 = MIC -// 3 = MODEM -// 4 = CD-DA left channel -// 5 = CD-DA right channel -READ8_MEMBER(towns_state::towns_volume_r) -{ - switch(offset) - { - case 2: - return(m_towns_volume[m_towns_volume_select]); - case 3: - return m_towns_volume_select; - default: - return 0; - } -} - -WRITE8_MEMBER(towns_state::towns_volume_w) -{ - switch(offset) - { - case 2: - m_towns_volume[m_towns_volume_select] = data; - if(m_towns_volume_select == 4) - m_cdda->set_channel_volume(0,100.0f * (data / 64.0f)); - if(m_towns_volume_select == 5) - m_cdda->set_channel_volume(1,100.0f * (data / 64.0f)); - break; - case 3: // select channel - if(data < 8) - m_towns_volume_select = data; - break; - default: - logerror("SND: Volume port %i set to %02x\n",offset,data); - } -} - -// some unknown ports... -READ8_MEMBER(towns_state::towns_41ff_r) -{ - logerror("I/O port 0x41ff read\n"); - return 0x01; -} - -// YM3438 interrupt (IRQ 13) -WRITE_LINE_MEMBER(towns_state::towns_fm_irq) -{ - if(state) - { - m_towns_fm_irq_flag = 1; - m_pic_slave->ir5_w(1); - if(IRQ_LOG) logerror("PIC: IRQ13 (FM) set high\n"); - } - else - { - m_towns_fm_irq_flag = 0; - if(m_towns_pcm_irq_flag == 0) - { - m_pic_slave->ir5_w(0); - if(IRQ_LOG) logerror("PIC: IRQ13 (FM) set low\n"); - } - } -} - -// PCM interrupt (IRQ 13) -RF5C68_SAMPLE_END_CB_MEMBER(towns_state::towns_pcm_irq) -{ - if (m_towns_pcm_channel_mask & (1 << channel)) - { - m_towns_pcm_irq_flag = 1; - m_towns_pcm_channel_flag |= (1 << channel); - m_pic_slave->ir5_w(1); - if(IRQ_LOG) logerror("PIC: IRQ13 (PCM) set high (channel %i)\n",channel); - } -} - -WRITE_LINE_MEMBER(towns_state::towns_pit_out0_changed) -{ - m_pit_out0 = state; - - if(m_towns_timer_mask & 0x01) - { - m_timer0 = state; - if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer ch0) set to %i\n",state); - } - else - m_timer0 = 0; - - m_pic_master->ir0_w(m_timer0 || m_timer1); -} - -WRITE_LINE_MEMBER(towns_state::towns_pit_out1_changed) -{ - m_pit_out1 = state; - - if(m_towns_timer_mask & 0x02) - { - m_timer1 = state; - if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer ch1) set to %i\n",state); - } - else - m_timer1 = 0; - - m_pic_master->ir0_w(m_timer0 || m_timer1); -} - -WRITE_LINE_MEMBER( towns_state::pit_out2_changed ) -{ - m_pit_out2 = state ? 1 : 0; - m_speaker->level_w(speaker_get_spk()); -} - -static ADDRESS_MAP_START(towns_mem, AS_PROGRAM, 32, towns_state) - // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns) - // may not be (and probably is not) correct - AM_RANGE(0x00000000, 0x000bffff) AM_RAM - AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffffffff) - AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffffffff) - AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") - AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM - AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffffffff) - AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM - AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffffffff) AM_SHARE("nvram") // CMOS? RAM - AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) - AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) - AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") -// AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM - AM_RANGE(0x81000000, 0x8101ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM - // 0xc0000000 - 0xc0ffffff // IC Memory Card (static, first 16MB only) - // 0xc1000000 - 0xc1ffffff // IC Memory Card (banked, can show any of 4 banks), JEIDA v4 only (UX and later) - AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000) // OS ROM - AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM - AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000) // FONT ROM - AM_RANGE(0xc2140000, 0xc2141fff) AM_READWRITE8(towns_cmos_r,towns_cmos_w,0xffffffff) // CMOS (mirror?) - AM_RANGE(0xc2180000, 0xc21fffff) AM_ROM AM_REGION("user",0x080000) // F20 ROM - AM_RANGE(0xc2200000, 0xc220ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffffffff) // WAVE RAM - AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(marty_mem, AS_PROGRAM, 16, towns_state) - AM_RANGE(0x00000000, 0x000bffff) AM_RAM - AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffff) - AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffff) - AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") - AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM - AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffff) - AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM - AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffff) AM_SHARE("nvram16") // CMOS? RAM - AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) - AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) - AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") -// AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - the Marty has 6MB RAM (not upgradable) - AM_RANGE(0x00600000, 0x0067ffff) AM_ROM AM_REGION("user",0x000000) // OS - AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000) // EX ROM - AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffff) AM_MIRROR(0x180000) // VRAM - AM_RANGE(0x00b00000, 0x00b7ffff) AM_ROM AM_REGION("user",0x180000) // FONT - AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffff) // Sprite RAM - AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card (is this usable on the Marty?) - AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM - AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000) // FONT - AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffff) // WAVE RAM - AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM - AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ux_mem, AS_PROGRAM, 16, towns_state) - AM_RANGE(0x00000000, 0x000bffff) AM_RAM - AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffff) - AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffff) - AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") - AM_RANGE(0x000cc000, 0x000cff7f) AM_RAM - AM_RANGE(0x000cff80, 0x000cffff) AM_READWRITE8(towns_video_cff80_mem_r,towns_video_cff80_mem_w,0xffff) - AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM - AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE8(towns_cmos_low_r,towns_cmos_low_w,0xffff) AM_SHARE("nvram16") // CMOS? RAM - AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) - AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) - AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") -// AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000) // EX ROM - AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffff) AM_MIRROR(0x180000) // VRAM - AM_RANGE(0x00b00000, 0x00b7ffff) AM_ROM AM_REGION("user",0x180000) // FONT - AM_RANGE(0x00c00000, 0x00c1ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffff) // Sprite RAM - AM_RANGE(0x00d00000, 0x00dfffff) AM_RAM // IC Memory Card - AM_RANGE(0x00e00000, 0x00e7ffff) AM_ROM AM_REGION("user",0x000000) // OS - AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM - AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000) // FONT - AM_RANGE(0x00f80000, 0x00f8ffff) AM_DEVREADWRITE8("pcm", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w, 0xffff) // WAVE RAM - AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM - AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( towns_io , AS_IO, 32, towns_state) - // I/O ports derived from FM Towns/Bochs, these are specific to the FM Towns - // System ports - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff00ff) - AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff00ff) - AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffffffff) - AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8("pit", pit8253_device, read, write, 0x00ff00ff) - AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8("pit2", pit8253_device, read, write, 0x00ff00ff) - AM_RANGE(0x0060,0x0063) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x000000ff) - AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffffffff) - AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff) - // 0x0070/0x0080 - CMOS RTC - AM_RANGE(0x0070,0x0073) AM_READWRITE8(towns_rtc_r,towns_rtc_w,0x000000ff) - AM_RANGE(0x0080,0x0083) AM_WRITE8(towns_rtc_select_w,0x000000ff) - // DMA controllers (uPD71071) - AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff) - AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffffffff) - // Floppy controller - AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffffffff) - // CRTC / Video - AM_RANGE(0x0400,0x0403) AM_READ8(towns_video_unknown_r, 0x000000ff) // R/O (0x400) - AM_RANGE(0x0404,0x0407) AM_READWRITE8(towns_video_404_r, towns_video_404_w, 0x000000ff) // R/W (0x404) - AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffffffff) - // System port - AM_RANGE(0x0480,0x0483) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x000000ff) // R/W (0x480) - // CD-ROM - AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff00ff) - // Joystick / Mouse ports - AM_RANGE(0x04d0,0x04d3) AM_READ8(towns_padport_r, 0x00ff00ff) - AM_RANGE(0x04d4,0x04d7) AM_WRITE8(towns_pad_mask_w, 0x00ff0000) - // Sound (YM3438 [FM], RF5c68 [PCM]) - AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm", ym3438_device, read, write, 0x00ff00ff) - AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffffffff) // R/W -- volume ports - AM_RANGE(0x04e8,0x04ef) AM_READWRITE8(towns_sound_ctrl_r,towns_sound_ctrl_w,0xffffffff) - AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm", rf5c68_device, rf5c68_w, 0xffffffff) - // CRTC / Video - AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffffffff) - // System ports - AM_RANGE(0x05e8,0x05ef) AM_READWRITE8(towns_sys5e8_r, towns_sys5e8_w, 0x00ff00ff) - // Keyboard (8042 MCU) - AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff) - // SCSI controller - AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("fmscsi",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff00ff) - // CMOS - AM_RANGE(0x3000,0x4fff) AM_READWRITE8(towns_cmos_r, towns_cmos_w,0x00ff00ff) - // Something (MS-DOS wants this 0x41ff to be 1) - //AM_RANGE(0x41fc,0x41ff) AM_READ8(towns_41ff_r,0xff000000) - // CRTC / Video (again) - AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff) - AM_RANGE(0xff80,0xffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffffffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( towns16_io , AS_IO, 16, towns_state) // for the 386SX based systems - // System ports - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffff) - AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8("pit", pit8253_device, read, write, 0x00ff) - AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8("pit2", pit8253_device, read, write, 0x00ff) - AM_RANGE(0x0060,0x0061) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x00ff) - AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffff) - AM_RANGE(0x006c,0x006d) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x00ff) - // 0x0070/0x0080 - CMOS RTC - AM_RANGE(0x0070,0x0071) AM_READWRITE8(towns_rtc_r,towns_rtc_w,0x00ff) - AM_RANGE(0x0080,0x0081) AM_WRITE8(towns_rtc_select_w,0x00ff) - // DMA controllers (uPD71071) - AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffff) - AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffff) - // Floppy controller - AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffff) - // CRTC / Video - AM_RANGE(0x0400,0x0401) AM_READ8(towns_video_unknown_r, 0x00ff) // R/O (0x400) - AM_RANGE(0x0404,0x0407) AM_READWRITE8(towns_video_404_r, towns_video_404_w, 0xffff) // R/W (0x404) - AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffff) - // System port - AM_RANGE(0x0480,0x0481) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x00ff) // R/W (0x480) - // CD-ROM - AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff) - // Joystick / Mouse ports - AM_RANGE(0x04d0,0x04d3) AM_READ8(towns_padport_r, 0x00ff) - AM_RANGE(0x04d6,0x04d7) AM_WRITE8(towns_pad_mask_w, 0x00ff) - // Sound (YM3438 [FM], RF5c68 [PCM]) - AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm", ym3438_device, read, write, 0x00ff) - AM_RANGE(0x04e0,0x04e3) AM_READWRITE8(towns_volume_r,towns_volume_w,0xffff) // R/W -- volume ports - AM_RANGE(0x04e8,0x04ef) AM_READWRITE8(towns_sound_ctrl_r,towns_sound_ctrl_w,0xffff) - AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm", rf5c68_device, rf5c68_w, 0xffff) - // CRTC / Video - AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffff) - // System ports - AM_RANGE(0x05e8,0x05ef) AM_READWRITE8(towns_sys5e8_r, towns_sys5e8_w, 0x00ff) - // Keyboard (8042 MCU) - AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff) - // SCSI controller - AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8("fmscsi",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff) - // CMOS - AM_RANGE(0x3000,0x4fff) AM_READWRITE8(towns_cmos_r, towns_cmos_w,0x00ff) - // Something (MS-DOS wants this 0x41ff to be 1) - //AM_RANGE(0x41fc,0x41ff) AM_READ8(towns_41ff_r,0xff000000) - // CRTC / Video (again) - AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffff) - AM_RANGE(0xff80,0xffff) AM_READWRITE8(towns_video_cff80_r,towns_video_cff80_w,0xffff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( towns ) - PORT_START("ctrltype") - PORT_CONFNAME(0x0f, 0x01, "Joystick port 1") - PORT_CONFSETTING(0x00, "Nothing") - PORT_CONFSETTING(0x01, "Standard 2-button joystick") - PORT_CONFSETTING(0x02, "Mouse") - PORT_CONFSETTING(0x04, "6-button joystick") - PORT_CONFNAME(0xf0, 0x20, "Joystick port 2") - PORT_CONFSETTING(0x00, "Nothing") - PORT_CONFSETTING(0x10, "Standard 2-button joystick") - PORT_CONFSETTING(0x20, "Mouse") - PORT_CONFSETTING(0x40, "6-button joystick") - -// Keyboard - PORT_START( "key1" ) // scancodes 0x00-0x1f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - - PORT_START( "key2" ) // scancodes 0x20-0x3f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("` _") - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) - - PORT_START("key3") // scancodes 0x40-0x5f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS(?)") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 000") - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL(?)/EL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAP") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE3\x81\xB2\xE3\x82\x89\xE3\x81\x8C\xE3\x81\xAA (Hiragana)") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x57") - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x58") - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana???") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE3\x82\xAB\xE3\x82\xBF\xE3\x82\xAB\xE3\x83\x8A (Katakana)") PORT_CODE(KEYCODE_RWIN) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF12") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) - - PORT_START("key4") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF11") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x6b") - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x6c") - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x6d") - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x6e") - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x70") - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x71") - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x72") - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Key 0x73") - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF13") - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF14") - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF15") - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF16") - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF17") - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF18") - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF19") - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF20") - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("COPY") - - PORT_START("joy1") - PORT_BIT(0x00000001,IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000002,IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000010,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000020,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - - PORT_START("joy1_ex") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH, IPT_START) PORT_NAME("1P Run") PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("1P Select") PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - - PORT_START("joy2") - PORT_BIT(0x00000001,IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000002,IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000010,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000020,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - - PORT_START("joy2_ex") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH, IPT_START) PORT_NAME("2P Run") PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("2P Select") PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - - PORT_START("6b_joy1") - PORT_BIT(0x00000001,IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000002,IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000010,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000020,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - - PORT_START("6b_joy1_ex") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH, IPT_START) PORT_NAME("1P Run") PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("1P Select") PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x04) - - PORT_START("6b_joy2") - PORT_BIT(0x00000001,IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000002,IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000004,IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000008,IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000010,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000020,IP_ACTIVE_LOW, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - - PORT_START("6b_joy2_ex") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH, IPT_START) PORT_NAME("2P Run") PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("2P Select") PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x40) - - PORT_START("mouse1") // buttons - PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) - PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) - - PORT_START("mouse2") // X-axis - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START("mouse3") // Y-axis - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - -INPUT_PORTS_END - -static INPUT_PORTS_START( marty ) - PORT_INCLUDE(towns) - // Consoles don't have keyboards... - PORT_MODIFY("key1") - PORT_BIT(0xffffffff,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_MODIFY("key2") - PORT_BIT(0xffffffff,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_MODIFY("key3") - PORT_BIT(0xffffffff,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_MODIFY("key4") - PORT_BIT(0xffffffff,IP_ACTIVE_LOW,IPT_UNUSED) -INPUT_PORTS_END - -void towns_state::driver_start() -{ - m_towns_vram = auto_alloc_array(machine(),UINT32,0x20000); - m_towns_gfxvram = auto_alloc_array(machine(),UINT8,0x80000); - m_towns_txtvram = auto_alloc_array(machine(),UINT8,0x20000); - memset(m_towns_txtvram, 0, sizeof(UINT8)*0x20000); - //towns_sprram = auto_alloc_array(machine(),UINT8,0x20000); - m_towns_serial_rom = auto_alloc_array(machine(),UINT8,256/8); - init_serial_rom(); - init_rtc(); - m_towns_rtc_timer = timer_alloc(TIMER_RTC); - m_towns_kb_timer = timer_alloc(TIMER_KEYBOARD); - m_towns_mouse_timer = timer_alloc(TIMER_MOUSE); - m_towns_wait_timer = timer_alloc(TIMER_WAIT); - m_towns_freerun_counter = timer_alloc(TIMER_FREERUN); - m_towns_intervaltimer2 = timer_alloc(TIMER_INTERVAL2); - m_towns_status_timer = timer_alloc(TIMER_CDSTATUS); - m_towns_cdda_timer = timer_alloc(TIMER_CDDA); - - // CD-ROM init - m_towns_cd.read_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(towns_state::towns_cdrom_read_byte),this), (void*)machine().device("dma_1")); - - m_maincpu->space(AS_PROGRAM).install_ram(0x100000,m_ram->size()-1,0xffffffff,0,NULL); -} - -void marty_state::driver_start() -{ - towns_state::driver_start(); - if(m_towns_machine_id == 0x0101) // default if no serial ROM present - m_towns_machine_id = 0x034a; -} - -void towns_state::machine_start() -{ - m_flop0->get_device()->set_rpm(360); - m_flop1->get_device()->set_rpm(360); -} - -void towns_state::machine_reset() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - m_messram = m_ram; - m_cdrom = machine().device("cdrom"); - m_cdda = machine().device("cdda"); - m_scsi = machine().device("fmscsi"); - m_ftimer = 0x00; - m_freerun_timer = 0x00; - m_nmi_mask = 0x00; - m_compat_mode = 0x00; - m_towns_ankcg_enable = 0x00; - m_towns_mainmem_enable = 0x00; - m_towns_system_port = 0x00; - m_towns_ram_enable = 0x00; - towns_update_video_banks(program); - m_towns_kb_status = 0x18; - m_towns_kb_irq1_enable = 0; - m_towns_pad_mask = 0x7f; - m_towns_mouse_output = MOUSE_START; - m_towns_cd.status = 0x01; // CDROM controller ready - m_towns_cd.buffer_ptr = -1; - m_towns_volume_select = 0; - m_intervaltimer2_period = 0; - m_intervaltimer2_timeout_flag = 0; - m_intervaltimer2_timeout_flag2 = 0; - m_intervaltimer2_irqmask = 1; // masked - m_towns_rtc_timer->adjust(attotime::zero,0,attotime::from_hz(1)); - m_towns_kb_timer->adjust(attotime::zero,0,attotime::from_msec(10)); - m_towns_freerun_counter->adjust(attotime::zero,0,attotime::from_usec(1)); -} - -READ8_MEMBER(towns_state::get_slave_ack) -{ - if (offset==7) { // IRQ = 7 - return m_pic_slave->acknowledge(); - } - return 0x00; -} - -FLOPPY_FORMATS_MEMBER( towns_state::floppy_formats ) - FLOPPY_FMTOWNS_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( towns_floppies ) - SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) -SLOT_INTERFACE_END - -static const gfx_layout fnt_chars_16x16 = -{ - 16,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15 }, - { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, - 16*16 -}; - -static const gfx_layout text_chars = -{ - 8,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7, }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 ,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 -}; - -static GFXDECODE_START( towns ) - GFXDECODE_ENTRY( "user", 0x180000 + 0x3d800, text_chars, 0, 16 ) - GFXDECODE_ENTRY( "user", 0x180000, fnt_chars_16x16, 0, 16 ) -GFXDECODE_END - -static MACHINE_CONFIG_FRAGMENT( towns_base ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I386, 16000000) - MCFG_CPU_PROGRAM_MAP(towns_mem) - MCFG_CPU_IO_MAP(towns_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - //MCFG_MACHINE_RESET_OVERRIDE(towns_state,towns) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(768,512) - MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 512-1) - MCFG_SCREEN_UPDATE_DRIVER(towns_state, screen_update) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", towns) - MCFG_PALETTE_ADD("palette", 256) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("fm", YM3438, 16000000 / 2) // actual clock speed unknown - MCFG_YM2612_IRQ_HANDLER(WRITELINE(towns_state, towns_fm_irq)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_RF5C68_ADD("pcm", 16000000 / 2) // actual clock speed unknown - MCFG_RF5C68_SAMPLE_END_CB(towns_state, towns_pcm_irq) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50) - MCFG_SOUND_ADD("cdda",CDDA,0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND,0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(307200) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(towns_state, towns_pit_out0_changed)) - MCFG_PIT8253_CLK1(307200) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(towns_state, towns_pit_out1_changed)) - MCFG_PIT8253_CLK2(307200) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(towns_state, pit_out2_changed)) - - MCFG_DEVICE_ADD("pit2", PIT8253, 0) - MCFG_PIT8253_CLK0(307200) // reserved - MCFG_PIT8253_CLK1(307200) // RS-232 - MCFG_PIT8253_CLK2(307200) // reserved - - MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(towns_state,get_slave_ack)) - - MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL) - - MCFG_MB8877_ADD("fdc",XTAL_8MHz/4) // clock unknown - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(towns_state,mb8877a_irq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(towns_state,mb8877a_drq_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", towns_floppies, "35hd", towns_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", towns_floppies, "35hd", towns_state::floppy_formats) - - MCFG_CDROM_ADD("cdrom") - MCFG_CDROM_INTERFACE("fmt_cdrom") - MCFG_SOFTWARE_LIST_ADD("cd_list","fmtowns_cd") - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4) - - MCFG_FMSCSI_ADD("fmscsi") - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_FMSCSI_IRQ_HANDLER(WRITELINE(towns_state, towns_scsi_irq)) - MCFG_FMSCSI_DRQ_HANDLER(WRITELINE(towns_state, towns_scsi_drq)) - - MCFG_DEVICE_ADD("dma_1", UPD71071, 0) - MCFG_UPD71071_CPU("maincpu") - MCFG_UPD71071_CLOCK(4000000) - MCFG_UPD71071_DMA_READ_0_CB(READ16(towns_state, towns_fdc_dma_r)) - MCFG_UPD71071_DMA_READ_1_CB(READ16(towns_state, towns_scsi_dma_r)) - MCFG_UPD71071_DMA_READ_3_CB(READ16(towns_state, towns_cdrom_dma_r)) - MCFG_UPD71071_DMA_WRITE_0_CB(WRITE16(towns_state, towns_fdc_dma_w)) - MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w)) - MCFG_DEVICE_ADD("dma_2", UPD71071, 0) - MCFG_UPD71071_CPU("maincpu") - MCFG_UPD71071_CLOCK(4000000) - MCFG_UPD71071_DMA_READ_0_CB(READ16(towns_state, towns_fdc_dma_r)) - MCFG_UPD71071_DMA_READ_1_CB(READ16(towns_state, towns_scsi_dma_r)) - MCFG_UPD71071_DMA_READ_3_CB(READ16(towns_state, towns_cdrom_dma_r)) - MCFG_UPD71071_DMA_WRITE_0_CB(WRITE16(towns_state, towns_fdc_dma_w)) - MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w)) - - //MCFG_VIDEO_START_OVERRIDE(towns_state,towns) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("6M") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,16M,32M,64M,96M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( towns, towns_state ) - MCFG_FRAGMENT_ADD(towns_base) - MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( townsux, towns16_state ) - MCFG_FRAGMENT_ADD(towns_base) - - MCFG_CPU_REPLACE("maincpu",I386SX, 16000000) - MCFG_CPU_PROGRAM_MAP(ux_mem) - MCFG_CPU_IO_MAP(towns16_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("10M") - - MCFG_NVRAM_ADD_0FILL("nvram16") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( townssj, towns ) - - MCFG_CPU_REPLACE("maincpu",PENTIUM, 66000000) - MCFG_CPU_PROGRAM_MAP(towns_mem) - MCFG_CPU_IO_MAP(towns_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8M") - MCFG_RAM_EXTRA_OPTIONS("40M,72M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( townshr, towns ) - MCFG_CPU_REPLACE("maincpu",I486, 20000000) - MCFG_CPU_PROGRAM_MAP(towns_mem) - MCFG_CPU_IO_MAP(towns_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("12M,20M,28M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( townsftv, towns ) - MCFG_CPU_REPLACE("maincpu",I486, 33000000) - MCFG_CPU_PROGRAM_MAP(towns_mem) - MCFG_CPU_IO_MAP(towns_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("6M") - MCFG_RAM_EXTRA_OPTIONS("32M,68M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( marty, marty_state ) - MCFG_FRAGMENT_ADD(towns_base) - - MCFG_CPU_REPLACE("maincpu",I386SX, 16000000) - MCFG_CPU_PROGRAM_MAP(marty_mem) - MCFG_CPU_IO_MAP(towns16_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", towns_state, towns_vsync_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("6M") - - MCFG_NVRAM_ADD_0FILL("nvram16") -MACHINE_CONFIG_END - -/* ROM definitions */ -/* It is unknown exactly what model these ROM were dumped from, but it is certainly a newer model, as it won't - * boot without the freerun timer, which was added in the FM-Towns II HG, HR, UG and later. */ -ROM_START( fmtowns ) - ROM_REGION32_LE( 0x280000, "user", 0) - ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) ) - ROM_LOAD("fmt_f20.rom", 0x080000, 0x080000, CRC(9f55a20c) SHA1(1920711cb66340bb741a760de187de2f76040b8c) ) - ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) - ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) - ROM_LOAD("fmt_sys.rom", 0x200000, 0x040000, CRC(afe4ebcf) SHA1(4cd51de4fca9bd7a3d91d09ad636fa6b47a41df5) ) -ROM_END - -/* likely an older set, as it runs without needing the freerun timer. Font ROM appears to be corrupt, though. */ -ROM_START( fmtownsa ) - ROM_REGION32_LE( 0x280000, "user", 0) - ROM_LOAD("fmt_dos_a.rom", 0x000000, 0x080000, CRC(22270e9f) SHA1(a7e97b25ff72b14121146137db8b45d6c66af2ae) ) - ROM_LOAD("fmt_f20_a.rom", 0x080000, 0x080000, CRC(75660aac) SHA1(6a521e1d2a632c26e53b83d2cc4b0edecfc1e68c) ) - ROM_LOAD("fmt_dic_a.rom", 0x100000, 0x080000, CRC(74b1d152) SHA1(f63602a1bd67c2ad63122bfb4ffdaf483510f6a8) ) - ROM_LOAD("fmt_fnt_a.rom", 0x180000, 0x040000, CRC(0108a090) SHA1(1b5dd9d342a96b8e64070a22c3a158ca419894e1) ) - ROM_LOAD("fmt_sys_a.rom", 0x200000, 0x040000, CRC(92f3fa67) SHA1(be21404098b23465d24c4201a81c96ac01aff7ab) ) -ROM_END - -/* 16MHz 80386SX, 2MB RAM expandable up to 10MB (due to the limited 24-bit address space of the CPU), dumped from a UX10 */ -ROM_START( fmtownsux ) - ROM_REGION32_LE( 0x480000, "user", 0) - ROM_LOAD("fmt_dos_a.rom", 0x000000, 0x080000, CRC(22270e9f) SHA1(a7e97b25ff72b14121146137db8b45d6c66af2ae) ) - // no F20 ROM - ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) - ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) - ROM_LOAD("fmt_sys_a.rom", 0x200000, 0x040000, CRC(92f3fa67) SHA1(be21404098b23465d24c4201a81c96ac01aff7ab) ) - ROM_REGION( 0x20, "serial", 0) - ROM_LOAD("mytownsux.rom", 0x00, 0x20, CRC(5cc7e6bc) SHA1(e245f8086df57ce6e48853f0e13525f738e5c4d8) ) -ROM_END - -/* 20MHz 80486SX, 4MB RAM expandable up to 28MB, dumped from an HR20 */ -ROM_START( fmtownshr ) - ROM_REGION32_LE( 0x280000, "user", 0) - ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) ) - // F20 ROM space appears to be all 0xFF on an HR, so it is assumed to be not present -// ROM_LOAD("fmt_f20.rom", 0x080000, 0x080000, CRC(9f55a20c) SHA1(1920711cb66340bb741a760de187de2f76040b8c) ) - ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) - ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) - ROM_LOAD("fmthr_sys.rom",0x200000, 0x040000, CRC(8aeff982) SHA1(a4ebf2e247a8e15a5f1ff003b657bbe3a67203d8) ) - ROM_REGION( 0x20, "serial", 0) - ROM_LOAD("mytownshr.rom", 0x00, 0x20, CRC(c52f0e89) SHA1(634d3965606b18a99507f0a520553005661c41ff) ) -ROM_END - -/* 66MHz 80486DX2, 8MB RAM expandable up to 72MB, dumped from an SJ26 */ -ROM_START( fmtownssj ) - ROM_REGION32_LE( 0x280000, "user", 0) - // Assumed for now, only the serial ROM has been dumped successfully so far - ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) BAD_DUMP ) - ROM_LOAD("fmt_f20.rom", 0x080000, 0x080000, CRC(9f55a20c) SHA1(1920711cb66340bb741a760de187de2f76040b8c) BAD_DUMP ) - ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) BAD_DUMP ) - ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) BAD_DUMP ) - ROM_LOAD("fmt_sys.rom", 0x200000, 0x040000, CRC(afe4ebcf) SHA1(4cd51de4fca9bd7a3d91d09ad636fa6b47a41df5) BAD_DUMP ) - ROM_REGION( 0x20, "serial", 0) - ROM_LOAD("mytownssj.rom", 0x00, 0x20, CRC(d0ed8936) SHA1(bf9eeef25e9a1dc4a9ce1c70f4155ac973cae3f9) ) -ROM_END - -/* 66MHz 80486DX2, dumped from an FM-Towns II MX */ -ROM_START( fmtownsmx ) - ROM_REGION32_LE( 0x280000, "user", 0) - ROM_LOAD("fmtownsiimxbios.m79", 0x000000, 0x080000, CRC(f3fc636e) SHA1(a35a11ab56b1f11e3f69d70b61648ab83699a2df) ) - ROM_CONTINUE(0x180000,0x40000) - ROM_CONTINUE(0x200000,0x40000) - ROM_CONTINUE(0x080000,0x80000) - ROM_CONTINUE(0x100000,0x80000) - ROM_REGION( 0x20, "serial", 0) - ROM_LOAD("mytownsmx.rom", 0x00, 0x20, CRC(16e78766) SHA1(38e8810bee9ee6b54c3999d27f499b89e4a4c33f) ) -ROM_END - -/* 33MHz 80486SX, 6MB RAM expandable up to 68MB, dumped from an FM Towns II Fresh TV */ -ROM_START( fmtownsftv ) - ROM_REGION32_LE( 0x280000, "user", 0) - ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(112872ee) SHA1(57fd146478226f7f215caf63154c763a6d52165e) ) - ROM_LOAD("fmt_f20.rom", 0x080000, 0x080000, CRC(9f55a20c) SHA1(1920711cb66340bb741a760de187de2f76040b8c) ) - ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) - ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) - ROM_LOAD("fmt_sys.rom", 0x200000, 0x040000, CRC(afe4ebcf) SHA1(4cd51de4fca9bd7a3d91d09ad636fa6b47a41df5) ) - ROM_REGION( 0x20, "serial", 0) - ROM_LOAD("mytownsftv.rom", 0x00, 0x20, CRC(a961aae7) SHA1(bba02edafdfaa6fb1b8122f623259a87a555c307) ) -ROM_END - -ROM_START( fmtmarty ) - ROM_REGION32_LE( 0x480000, "user", 0) - ROM_LOAD("mrom.m36", 0x000000, 0x080000, CRC(9c0c060c) SHA1(5721c5f9657c570638352fa9acac57fa8d0b94bd) ) - ROM_CONTINUE(0x280000,0x180000) - ROM_LOAD("mrom.m37", 0x400000, 0x080000, CRC(fb66bb56) SHA1(e273b5fa618373bdf7536495cd53c8aac1cce9a5) ) - ROM_CONTINUE(0x80000,0x100000) - ROM_CONTINUE(0x180000,0x40000) - ROM_CONTINUE(0x200000,0x40000) -ROM_END - -ROM_START( fmtmarty2 ) - ROM_REGION32_LE( 0x480000, "user", 0) - ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(2bc2af96) SHA1(99cd51c5677288ad8ef711b4ac25d981fd586884) ) - ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) - ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) - ROM_LOAD("fmt_sys.rom", 0x200000, 0x040000, CRC(937311f6) SHA1(7b1c97fa778986134104a6964c8fe13e3654f52e) ) - ROM_LOAD("mar_ex0.rom", 0x280000, 0x080000, CRC(f67540f6) SHA1(1611fc4683dab72e56a5d0ee0f757e5878900b31) ) - ROM_LOAD("mar_ex1.rom", 0x300000, 0x080000, CRC(99938a4b) SHA1(167d8ae47312cdaa30b8597144f60f54ce9f74d3) ) - ROM_LOAD("mar_ex2.rom", 0x380000, 0x080000, CRC(c6783422) SHA1(b2ed2ba42b8132d139480484fe116ba7774e1604) ) - ROM_LOAD("mar_ex3.rom", 0x400000, 0x080000, CRC(4aa43e16) SHA1(19b669aa6488bdaf8569e89b1b1067e51246a768) ) - ROM_REGION( 0x20, "serial", 0) - ROM_LOAD("mytownsm2.rom", 0x00, 0x20, CRC(44f2f076) SHA1(e4d3be54e66931c947993ded9ddbae716ad51ca5) ) -ROM_END - -ROM_START( carmarty ) - ROM_REGION32_LE( 0x480000, "user", 0) - ROM_LOAD("fmt_dos.rom", 0x000000, 0x080000, CRC(2bc2af96) SHA1(99cd51c5677288ad8ef711b4ac25d981fd586884) ) - ROM_LOAD("fmt_dic.rom", 0x100000, 0x080000, CRC(82d1daa2) SHA1(7564020dba71deee27184824b84dbbbb7c72aa4e) ) - ROM_LOAD("fmt_fnt.rom", 0x180000, 0x040000, CRC(dd6fd544) SHA1(a216482ea3162f348fcf77fea78e0b2e4288091a) ) - ROM_LOAD("cmar_sys.rom", 0x200000, 0x040000, CRC(e1ff7ce1) SHA1(e6c359177e4e9fb5bbb7989c6bbf6e95c091fd88) ) - ROM_LOAD("cmar_ex0.rom", 0x280000, 0x080000, CRC(e248bfbd) SHA1(0ce89952a7901dd4d256939a6bc8597f87e51ae7) ) - ROM_LOAD("cmar_ex1.rom", 0x300000, 0x080000, CRC(ab2e94f0) SHA1(4b3378c772302622f8e1139ed0caa7da1ab3c780) ) - ROM_LOAD("cmar_ex2.rom", 0x380000, 0x080000, CRC(ce150ec7) SHA1(1cd8c39f3b940e03f9fe999ebcf7fd693f843d04) ) - ROM_LOAD("cmar_ex3.rom", 0x400000, 0x080000, CRC(582fc7fc) SHA1(a77d8014e41e9ff0f321e156c0fe1a45a0c5e58e) ) - ROM_REGION( 0x20, "serial", 0) - ROM_LOAD("mytownscm.rom", 0x00, 0x20, CRC(bc58eba6) SHA1(483087d823c3952cc29bd827e5ef36d12c57ad49) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, fmtowns, 0, 0, towns, towns, driver_device, 0, "Fujitsu", "FM-Towns", MACHINE_NOT_WORKING) -COMP( 1989, fmtownsa, fmtowns, 0, towns, towns, driver_device, 0, "Fujitsu", "FM-Towns (alternate)", MACHINE_NOT_WORKING) -COMP( 1991, fmtownsux,fmtowns, 0, townsux, towns, driver_device, 0, "Fujitsu", "FM-Towns II UX", MACHINE_NOT_WORKING) -COMP( 1992, fmtownshr,fmtowns, 0, townshr, towns, driver_device, 0, "Fujitsu", "FM-Towns II HR", MACHINE_NOT_WORKING) -COMP( 1993, fmtownsmx,fmtowns, 0, townshr, towns, driver_device, 0, "Fujitsu", "FM-Towns II MX", MACHINE_NOT_WORKING) -COMP( 1994, fmtownsftv,fmtowns, 0, townsftv, towns, driver_device, 0, "Fujitsu", "FM-Towns II FreshTV", MACHINE_NOT_WORKING) -COMP( 19??, fmtownssj,fmtowns, 0, townssj, towns, driver_device, 0, "Fujitsu", "FM-Towns II SJ", MACHINE_NOT_WORKING) -CONS( 1993, fmtmarty, 0, 0, marty, marty, driver_device, 0, "Fujitsu", "FM-Towns Marty", MACHINE_NOT_WORKING) -CONS( 1993, fmtmarty2,fmtmarty, 0, marty, marty, driver_device, 0, "Fujitsu", "FM-Towns Marty 2", MACHINE_NOT_WORKING) -CONS( 1994, carmarty, fmtmarty, 0, marty, marty, driver_device, 0, "Fujitsu", "FM-Towns Car Marty", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/force68k.c b/src/mess/drivers/force68k.c deleted file mode 100644 index d1cf7a46833..00000000000 --- a/src/mess/drivers/force68k.c +++ /dev/null @@ -1,606 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Joakim Larsson Edstrom -/*************************************************************************** - * - * Force SYS68K CPU-1/CPU-6 VME SBC drivers, initially based on the 68ksbc.c - * - * 13/06/2015 - * - * The info found on the links below is for a later revisions of the board I have - * but it is somewhat compatible so I got the system ROM up and running in terminal. - * My CPU-1 board has proms from 1983 and the PCB has no rev markings so probably - * the original or a very early design. The board real estate differs from the later - * CPU-1:s I found pictures of but has the same main chips and functions. - * - * http://bitsavers.trailing-edge.com/pdf/forceComputers/1988_Force_VMEbus_Products.pdf - * http://www.artisantg.com/info/P_wUovN.pdf - * - * Some info from those documents: - * - * Address Map - * ---------------------------------------------------------- - * Address Range Description - * ---------------------------------------------------------- - * 000 000 - 000 007 Initialisation vectors from system EPROM - * 000 008 - 01F FFF Dynamic RAM on CPU-1 B - * 000 008 - 07F FFF Dynamic RAM on CPU-1 D - * 080 008 - 09F FFF SYSTEM EPROM Area - * OAO 000 - OBF FFF USER EPROMArea - * 0C0 041 - 0C0 043 ACIA (P3) Host - * 0C0 080 - 0C0 082 ACIA (P4) Terminal - * 0C0 101 - 0C0 103 ACIA (P5) Remote device (eg serial printer) - * 0C0 401 - 0C0 42F RTC - * OEO 001 - 0E0 035 PI/T (eg centronics printer) - * OEO 200 - 0E0 2FF FPU - * OEO 300 - 0E0 300 Reset Off - * OEO 380 - 0E0 380 Reset On - * 100 000 - FEF FFF VMEbus addresses (A24) - * FFO 000 - FFF FFF VMEbus Short I/O (A16) - * ---------------------------------------------------------- - * - * Interrupt sources - * ---------------------------------------------------------- - * Description Device Lvl IRQ VME board - * /Board Vector Address - * ---------------------------------------------------------- - * On board Sources - * ABORT Switch 7 31 - * Real Time Clock (RTC) 58167A 6 30 - * Parallel/Timer (PI/T) 68230 5 29 - * Terminal ACIA 6850 4 28 - * Remote ACIA 6850 3 27 - * Host ACIA 6850 2 26 - * ACFAIL, SYSFAIL VME 5 29 - * Off board Sources (other VME boards) - * 6 Port Serial I/O board SIO 4 64-75 0xb00000 - * 8 Port Serial I/O board ISIO 4 76-83 0x960000 - * Disk Controller WFC 3 119 0xb01000 - * SCSI Controller ISCSI 4 119 0xa00000 - * Slot 1 Controller Board ASCU 7 31 0xb02000 - * ---------------------------------------------------------- - * - * TODO: - * - Finish 3 x ACIA6850, host and remote interface left, terminal works - * - Finish 1 x 68230 Motorola, Parallel Interface / Timer as required by ROM - * - Configure PIT to the Centronics device printer interface as - * supported by ROM (DONE) - * - Add 1 x Abort Switch - * - Add 1 x Reset Switch - * - Add 1 x Halt LED - * - Add a jumper field device as supported by PCB - * - Add configurable serial connector between ACIA:s and - * - Real terminal emulator, ie rs232 "socket" - * - Debug console - * - Add VME bus driver - * - ****************************************************************************/ - -#include "emu.h" -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "machine/mm58167.h" -#include "machine/68230pit.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "bus/centronics/ctronics.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define LOG(x) x - -#define BAUDGEN_CLOCK XTAL_1_8432MHz -/* - * The baudrate on the Force68k CPU-1 to CPU-6 is generated by a - * Motorola 14411 bitrate generator, the CPU-6 documents matches the circuits - * that I could find on the CPU-1 board. Here how I calculated the clock for - * the factory settings. No need to add selectors until terminal.c supports - * configurable baudrates. Fortunality CPU-1 was shipped with 9600N8! - * - * From the documents: - * - * 3 RS232C interfaces, strap selectable baud rate from 110-9600 or 600-19200 baud - * - * Default Jumper Settings of B7: - * -------------------------------- - * GND 10 - 11 RSA input on 14411 - * F1 on 14411 1 - 20 Baud selector of the terminal port - * F1 on 14411 3 - 18 Baud selector of the host port - * F1 on 14411 5 - 16 Baud selector of the remote port - * - * The RSB input on the 14411 is kept high always so RSA=0, RSB=1 and a 1.8432MHz crystal - * generates 153600 on the F1 output pin which by default strapping is connected to all - * three 6850 acias on the board. These can be strapped separatelly to speedup downloads. - * - * The selectable outputs from 14411, F1-F16: - * X16 RSA=0,RSB=1: 153600, 115200, 76800, 57600, 38400, 28800, 19200, 9600, 4800, 3200, 2153.3, 1758.8, 1200, 921600, 1843000 - * X64 RSA=1,RSB=1: 614400, 460800, 307200, 230400, 153600, 115200, 76800, 57600, 38400, 28800, 19200, 9600, 4800, 921600, 1843000 - * - * However, the datasheet says baudrate is strapable for 110-9600 but the output is 153600 - * so the system rom MUST setup the acia to divide by 16 to generate the correct baudrate. - * - */ -#define ACIA_CLOCK (BAUDGEN_CLOCK / 12) - -class force68k_state : public driver_device -{ -public: -force68k_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device (mconfig, type, tag), - m_maincpu (*this, "maincpu"), - m_rtc (*this, "rtc"), - m_pit (*this, "pit"), - m_aciahost (*this, "aciahost"), - m_aciaterm (*this, "aciaterm"), - m_aciaremt (*this, "aciaremt"), - m_centronics (*this, "centronics") - , m_centronics_ack (0) - , m_centronics_busy (0) - , m_centronics_perror (0) - , m_centronics_select (0) - ,m_cart(*this, "exp_rom1") -{ -} - -DECLARE_READ16_MEMBER (bootvect_r); -DECLARE_READ16_MEMBER (vme_a24_r); -DECLARE_WRITE16_MEMBER (vme_a24_w); -DECLARE_READ16_MEMBER (vme_a16_r); -DECLARE_WRITE16_MEMBER (vme_a16_w); -virtual void machine_start (); -// clocks -DECLARE_WRITE_LINE_MEMBER (write_aciahost_clock); -DECLARE_WRITE_LINE_MEMBER (write_aciaterm_clock); -DECLARE_WRITE_LINE_MEMBER (write_aciaremt_clock); -// centronics printer interface -DECLARE_WRITE_LINE_MEMBER (centronics_ack_w); -DECLARE_WRITE_LINE_MEMBER (centronics_busy_w); -DECLARE_WRITE_LINE_MEMBER (centronics_perror_w); -DECLARE_WRITE_LINE_MEMBER (centronics_select_w); -// User EPROM/SRAM slot(s) -int force68k_load_cart(device_image_interface &image, generic_slot_device *slot); -DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return force68k_load_cart(image, m_cart); } -DECLARE_READ16_MEMBER (read16_rom); - -protected: - -private: -required_device m_maincpu; -required_device m_rtc; -required_device m_pit; -required_device m_aciahost; -required_device m_aciaterm; -required_device m_aciaremt; -optional_device m_centronics; - -INT32 m_centronics_ack; -INT32 m_centronics_busy; -INT32 m_centronics_perror; -INT32 m_centronics_select; - -// Pointer to System ROMs needed by bootvect_r -UINT16 *m_sysrom; -UINT16 *m_usrrom; - -required_device m_cart; - -}; - -static ADDRESS_MAP_START (force68k_mem, AS_PROGRAM, 16, force68k_state) -ADDRESS_MAP_UNMAP_HIGH -AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r) /* Vectors mapped from System EPROM */ -AM_RANGE (0x000008, 0x01ffff) AM_RAM /* DRAM CPU-1B */ -//AM_RANGE (0x020000, 0x07ffff) AM_RAM /* Additional DRAM CPU-1D */ -AM_RANGE (0x080000, 0x083fff) AM_ROM /* System EPROM Area 16Kb DEBUGGER supplied as default on CPU-1B/D */ -AM_RANGE (0x084000, 0x09ffff) AM_ROM /* System EPROM Area 112Kb additional space for System ROM */ -//AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, max 128Kb mapped by a cartslot */ -AM_RANGE (0x0c0040, 0x0c0041) AM_DEVREADWRITE8 ("aciahost", acia6850_device, status_r, control_w, 0x00ff) -AM_RANGE (0x0c0042, 0x0c0043) AM_DEVREADWRITE8 ("aciahost", acia6850_device, data_r, data_w, 0x00ff) -AM_RANGE (0x0c0080, 0x0c0081) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, status_r, control_w, 0xff00) -AM_RANGE (0x0c0082, 0x0c0083) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, data_r, data_w, 0xff00) -AM_RANGE (0x0c0100, 0x0c0101) AM_DEVREADWRITE8 ("aciaremt", acia6850_device, status_r, control_w, 0x00ff) -AM_RANGE (0x0c0102, 0x0c0103) AM_DEVREADWRITE8 ("aciaremt", acia6850_device, data_r, data_w, 0x00ff) -AM_RANGE (0x0c0400, 0x0c042f) AM_DEVREADWRITE8 ("rtc", mm58167_device, read, write, 0x00ff) -AM_RANGE (0x0e0000, 0x0e0035) AM_DEVREADWRITE8 ("pit", pit68230_device, read, write, 0x00ff) -// AM_RANGE(0x0e0200, 0x0e0380) AM_READWRITE(fpu_r, fpu_w) /* optional FPCP 68881 FPU interface */ -AM_RANGE(0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) */ -AM_RANGE(0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) */ -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START (force68k) -INPUT_PORTS_END - -/* - * Centronics support - * - * The system ROMs has support for a parallel printer interface but the signals are just routed to row A - * of the VME P2 connector so no on board Centronics connector is available but assumed to be added on a - * separate I/O board. After some detective work I found that the ROM works as follows: - * - * The 'PA' (Printer Attach) command issues a on Port A and sends a strobe on H2 it then loops over - * the select signal, bit 0 on Port B, and the ack signal on HS1, both to be non zero. The support is really - * flawed as the strobe signal goes high instead of low ( this might assume an inverting driver on the - * P2 board ) and the busy signal is not checked at all. Or I might have assumed it all wrong, but it now - * works with the generic centronics printer driver. Need the printer board documentation to improve further. - * - * When the 'PA' command is successful everything printed to screen is mirrored on the printer. Use the - * 'NOPA' command to stop mirroring. I had no printer ROMs so could not test it with a "real" printer. - * - * Force CPU-1 init sequence for MC68230 PIT - * ----------------------------------------- - * 0801E6 0E0000 W 00 -> PGCR Mode 0 (uni8), H34 dis, H12 dis, H1234 HZ - * 0801E6 0E0002 W 00 -> PSRR PC4, PC5, H1S>H2S>H3S>H4S - * 0801E6 0E0004 W FF -> PADDR Port A all Outputs - * 0801E6 0E0006 W 00 -> PBDDR Port B all Inputs - * 0801EA 0E000C W 60 -> PACR Port A Mode 01, pin def, dbfr H1 data rec, H2 status/int, H2 output neg, H2S clrd - * 0801F0 0E000E W A0 -> PBCR Port B mode 1x, H4 output neg, H4S clrd, H3 int dis, H3 edg input, H3S set by assrt edg - * 0801F6 0E0000 W 30 -> PGCR H34 enable, H12enable - * 0801FC 0E000E W A8 -> PBCR +H4 asserted - * 08020A 0E000E W A0 -> PBCR +H4 negated - * - * Upon PA (Printer Attach) command enabling the Centronics printer mode - * --------------------------------------------------------------------- - * 081DB4 0E0011 W D0 -> PADR Data to Port A - * 081DB8 0E000D W 68 -> PACR H2 output asserted Centronics Strobe - * 081DC0 0E000D W 60 -> PACR H2 output negated - * 081DD0 0E0013 R 00 <- PBDR Port B polled for 01 (data) & 03 (mask) - * - */ - -/* Centronics ACK handler - * The centronics ack signal is expected by the ROM to arrive at H1 input line - */ -WRITE_LINE_MEMBER (force68k_state::centronics_ack_w) -{ -// LOG (logerror ("centronics_ack_w(%d) %lld\n", state, m_maincpu->total_cycles ())); - m_centronics_ack = state; - m_pit->h1_set (state); -} - -/* Centronics BUSY handler - * The centronics busy signal is not used by the ROM driver afaik - */ -WRITE_LINE_MEMBER (force68k_state::centronics_busy_w){ -// LOG (logerror ("centronics_busy_w(%d) %lld\n", state, m_maincpu->total_cycles ())); - m_centronics_busy = state; -} - -/* Centronics PERROR handler - * The centronics perror signal is not used by the ROM driver afaik - */ -WRITE_LINE_MEMBER (force68k_state::centronics_perror_w){ -// LOG (logerror ("centronics_perror_w(%d) %lld\n", state, m_maincpu->total_cycles ())); - m_centronics_perror = state; -} - -/* Centronics SELECT handler - * The centronics select signal is expected by the ROM on Port B bit 0 - */ -WRITE_LINE_MEMBER (force68k_state::centronics_select_w){ -// LOG (logerror ("centronics_select_w(%d) %lld\n", state, m_maincpu->total_cycles ())); - m_centronics_select = state; - m_pit->portb_setbit (0, state); -} - -/* Start it up */ -void force68k_state::machine_start () -{ - LOG (logerror ("machine_start\n")); - - save_item (NAME (m_centronics_busy)); - save_item (NAME (m_centronics_ack)); - save_item (NAME (m_centronics_select)); - save_item (NAME (m_centronics_perror)); - - /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ - m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x080000); - - /* Map user ROM/RAM socket(s) */ - if (m_cart->exists()) - { - m_usrrom = (UINT16*)m_cart->get_rom_base(); -#if 0 // This should be the correct way but produces odd and even bytes swapped - m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(generic_slot_device::read16_rom), (generic_slot_device*)m_cart)); -#else // So we installs a custom very ineffecient handler for now until we understand hwp to solve the problem better - m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(force68k_state::read16_rom), this)); -#endif - } -} - -/* A very ineffecient User cart emulation of two 8 bit sockets (odd and even) */ -READ16_MEMBER (force68k_state::read16_rom){ - offset = offset % m_cart->common_get_size("rom"); // Don't read outside buffer... - return ((m_usrrom [offset] << 8) & 0xff00) | ((m_usrrom [offset] >> 8) & 0x00ff); -} - -/* Boot vector handler, the PCB hardwires the first 8 bytes from 0x80000 to 0x0 */ -READ16_MEMBER (force68k_state::bootvect_r){ - return m_sysrom [offset]; -} - -/* 10. The VMEbus (text from board documentation) - * --------------- - * The implemented VMEbus Interface includes 24 address, 16 data, - * 6 address modifier and the asynchronous control signals. - * A single level bus arbiter is provided to build multi master - * systems. In addition to the bus arbiter, a separate slave bus - * arbitration allows selection of the arbitration level (0-3). - * - * The address modifier range .,Short 110 Access can be selected - * via a jumper for variable system generation. The 7 interrupt - * request levels of the VMEbus are fully supported from the - * SYS68K1CPU-1 B/D. For multi-processing, each IRQ signal can be - * enabled/disabled via a jumper field. - * - * Additionally, the SYS68K1CPU-1 B/D supports the ACFAIL, SYSRESET, - * SYSFAIL and SYSCLK signal (16 MHz). - */ - -/* Dummy VME access methods until the VME bus device is ready for use */ -READ16_MEMBER (force68k_state::vme_a24_r){ - LOG (logerror ("vme_a24_r\n")); - return (UINT16) 0; -} - -WRITE16_MEMBER (force68k_state::vme_a24_w){ - LOG (logerror ("vme_a24_w\n")); -} - -READ16_MEMBER (force68k_state::vme_a16_r){ - LOG (logerror ("vme_16_r\n")); - return (UINT16) 0; -} - -WRITE16_MEMBER (force68k_state::vme_a16_w){ - LOG (logerror ("vme_a16_w\n")); -} - -/* - * Serial port clock sources can all be driven by different outputs of the 14411 - */ -WRITE_LINE_MEMBER (force68k_state::write_aciahost_clock){ - m_aciahost->write_txc (state); - m_aciahost->write_rxc (state); -} - -WRITE_LINE_MEMBER (force68k_state::write_aciaterm_clock){ - m_aciaterm->write_txc (state); - m_aciaterm->write_rxc (state); -} - -WRITE_LINE_MEMBER (force68k_state::write_aciaremt_clock){ - m_aciaremt->write_txc (state); - m_aciaremt->write_rxc (state); -} - -/* - * 4. The USER Area (Text from the board manual) - The USER area contains two 28 pin sockets with JEDEC compatible pin out. - To allow the usage of static RAM's, the access to the USER area is byte - oriented. Table 3. lists the usable device types. - - Bits Bytes EPROM SRAM - -------------------------- - 2Kx16 4 Kbyte 2716 6116 - 4Kx16 8 Kbyte 2732 - 8Kx16 16 Kbyte 2764 6264 - 16Kx16 32 Kbyte 27128 - 32Kx16 64 Kbyte 27256 - -------------------------- -*/ -// Implementation of static 2 x 64K EPROM in sockets J10/J11 as 16 bit wide cartridge for easier -// software handling. TODO: make configurable according to table above. -static MACHINE_CONFIG_FRAGMENT( fccpu1_eprom_sockets ) - MCFG_GENERIC_CARTSLOT_ADD("exp_rom1", generic_plain_slot, "fccpu1_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) - MCFG_GENERIC_LOAD(force68k_state, exp1_load) -// MCFG_SOFTWARE_LIST_ADD("cart_list", "fccpu1_cart") -MACHINE_CONFIG_END - -/*************************** - Rom loading functions -****************************/ -int force68k_state::force68k_load_cart(device_image_interface &image, generic_slot_device *slot) -{ - UINT32 size = slot->common_get_size("rom"); - - if (size > 0x20000) // Max 128Kb - { - LOG( printf("Cartridge size exceeding max size (128Kb): %d\n", size) ); - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (128Kb)"); - return IMAGE_INIT_FAIL; - } - - slot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG); - slot->common_load_rom(slot->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -/* - * Machine configuration - */ -static MACHINE_CONFIG_START (fccpu1, force68k_state) -/* basic machine hardware */ -MCFG_CPU_ADD ("maincpu", M68000, XTAL_16MHz / 2) -MCFG_CPU_PROGRAM_MAP (force68k_mem) - -/* P3/Host Port config - * LO command causes ROM monitor to expect S-records on HOST port by default - * Implementation through nullmodem currently does not support handshakes so - * the ROM momitor is over-run while checking for checksums etc if used with - * UI mount feature. - */ -MCFG_DEVICE_ADD ("aciahost", ACIA6850, 0) - -MCFG_ACIA6850_TXD_HANDLER (DEVWRITELINE ("rs232host", rs232_port_device, write_txd)) -MCFG_ACIA6850_RTS_HANDLER (DEVWRITELINE ("rs232host", rs232_port_device, write_rts)) - -MCFG_RS232_PORT_ADD ("rs232host", default_rs232_devices, "null_modem") -MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("aciahost", acia6850_device, write_rxd)) -MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("aciahost", acia6850_device, write_cts)) - -MCFG_DEVICE_ADD ("aciahost_clock", CLOCK, ACIA_CLOCK) -MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciahost_clock)) - -/* P4/Terminal Port config */ -MCFG_DEVICE_ADD ("aciaterm", ACIA6850, 0) - -MCFG_ACIA6850_TXD_HANDLER (DEVWRITELINE ("rs232trm", rs232_port_device, write_txd)) -MCFG_ACIA6850_RTS_HANDLER (DEVWRITELINE ("rs232trm", rs232_port_device, write_rts)) - -MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal") -MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("aciaterm", acia6850_device, write_rxd)) -MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("aciaterm", acia6850_device, write_cts)) - -MCFG_DEVICE_ADD ("aciaterm_clock", CLOCK, ACIA_CLOCK) -MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciaterm_clock)) - -/* P5/Remote Port config */ -MCFG_DEVICE_ADD ("aciaremt", ACIA6850, 0) - -MCFG_DEVICE_ADD ("aciaremt_clock", CLOCK, ACIA_CLOCK) -MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciaterm_clock)) - -/* RTC Real Time Clock device */ -MCFG_DEVICE_ADD ("rtc", MM58167, XTAL_32_768kHz) - -/* PIT Parallel Interface and Timer device, assuming strapped for on board clock */ -MCFG_DEVICE_ADD ("pit", PIT68230, XTAL_16MHz / 2) -MCFG_PIT68230_PA_OUTPUT_CALLBACK (DEVWRITE8 ("cent_data_out", output_latch_device, write)) -MCFG_PIT68230_H2_CALLBACK (DEVWRITELINE ("centronics", centronics_device, write_strobe)) - -// centronics -MCFG_CENTRONICS_ADD ("centronics", centronics_devices, "printer") -MCFG_CENTRONICS_ACK_HANDLER (WRITELINE (force68k_state, centronics_ack_w)) -MCFG_CENTRONICS_BUSY_HANDLER (WRITELINE (force68k_state, centronics_busy_w)) -MCFG_CENTRONICS_PERROR_HANDLER (WRITELINE (force68k_state, centronics_perror_w)) -MCFG_CENTRONICS_SELECT_HANDLER (WRITELINE (force68k_state, centronics_select_w)) -MCFG_CENTRONICS_OUTPUT_LATCH_ADD ("cent_data_out", "centronics") - -// EPROM sockets -MCFG_FRAGMENT_ADD(fccpu1_eprom_sockets) -MACHINE_CONFIG_END - -#if 0 /* - * CPU-6 family is device and adressmap compatible with CPU-1 but with additions - * such as an optional 68881 FPU - */ -static MACHINE_CONFIG_START (fccpu6, force68k_state) -MCFG_CPU_ADD ("maincpu", M68000, XTAL_8MHz) /* Jumper B10 Mode B */ -MCFG_CPU_PROGRAM_MAP (force68k_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START (fccpu6a, force68k_state) -MCFG_CPU_ADD ("maincpu", M68000, XTAL_12_5MHz) /* Jumper B10 Mode A */ -MCFG_CPU_PROGRAM_MAP (force68k_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START (fccpu6v, force68k_state) -MCFG_CPU_ADD ("maincpu", M68010, XTAL_8MHz) /* Jumper B10 Mode B */ -MCFG_CPU_PROGRAM_MAP (force68k_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START (fccpu6va, force68k_state) -MCFG_CPU_ADD ("maincpu", M68010, XTAL_12_5MHz) /* Jumper B10 Mode A */ -MCFG_CPU_PROGRAM_MAP (force68k_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START (fccpu6vb, force68k_state) -MCFG_CPU_ADD ("maincpu", M68010, XTAL_12_5MHz) /* Jumper B10 Mode A */ -MCFG_CPU_PROGRAM_MAP (force68k_mem) -MACHINE_CONFIG_END -#endif - -/* ROM definitions */ -ROM_START (fccpu1) -ROM_REGION (0x1000000, "maincpu", 0) - -ROM_LOAD16_BYTE ("fccpu1V1.0L.j8.bin", 0x080001, 0x2000, CRC (3ac6f08f) SHA1 (502f6547b508d8732bd68bbbb2402d8c30fefc3b)) -ROM_LOAD16_BYTE ("fccpu1V1.0L.j9.bin", 0x080000, 0x2000, CRC (035315fb) SHA1 (90dc44d9c25d28428233e6846da6edce2d69e440)) - -/* - * System ROM terminal commands - * - * COMMAND SUMMARY DESCRIPTION (From CPU-1B datasheet, ROMs were dumped - * from a CPU-1 board so some features might be missing or different) - * --------------------------------------------------------------------------- - * BF Block Fill memory - from addr1 through addr2 with data - * BM
Block Move - move from addr1 through addr2to addr3 - * BR [
[; ] ... ] Set/display Breakpoint - * BS Block Search - search addr1 through addr2 for data - * BT Block Test of memory - * DC Data Conversion - * DF Display Formatted registers - * DU [n] [] Dump memory to object file - * GO or G [ Execute program. - * GD [ Go Direct - * GT
Exec prog: temporary breakpoint - * HE Help; display monitor commands - * LO [n] [; Load Object file - * MD
[] Memory Display - * MM or M
[] Memory Modify - * MS
< ... Memory Set - starting at addr with data 1. data 2 ... - * NOBR [
... ] Remove Breakpoint - * NOPA Printer Detach (Centronics on PIT/P2) - * OF Offset - * PA Printer Attach (Centronics on PIT/P2) - * PF[n] Set/display Port Format - * RM Register Modify - * TM [] Transparent Mode - * TR OR T [ Trace - * TT
Trace: temporary breakpoint - * VE [n] [ Verify memory/object file - * ---------------------------------------------------------------------------- - * .AO - .A7 [ Display/set address register - * .00 - .07 [ Display/set data register - * .RO - .R6 [ Display/set offset register - * .PC [ Display/set program counter - * .SR [ Display/set status register - * .SS [ Display/set supervisor stack - * .US [ Display/set user stack - * ---------------------------------------------------------------------------- - * MD
[]; DI Disassemble memory location - * MM
; DI Disassemble/Assemble memory location - * ---------------------------------------------------------------------------- - * Undocumented commands found in ROM table at address 0x80308 - * .* No WHAT message displayed, no action seen. - */ -ROM_END - -/* - * CPU-6 ROMs were generally based om VMEPROM which contained the PDOS RTOS from Eyring Research. - * I don't have these but if anyone can dump them and send to me I can verify that they work as expected. - */ -#if 0 -ROM_START (fccpu6) -ROM_REGION (0x1000000, "maincpu", 0) -ROM_END - -ROM_START (fccpu6a) -ROM_REGION (0x1000000, "maincpu", 0) -ROM_END - -ROM_START (fccpu6v) -ROM_REGION (0x1000000, "maincpu", 0) -ROM_END - -ROM_START (fccpu6va) -ROM_REGION (0x1000000, "maincpu", 0) -ROM_END - -ROM_START (fccpu6vb) -ROM_REGION (0x1000000, "maincpu", 0) -ROM_END -#endif - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, fccpu1, 0, 0, fccpu1, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-1", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) -//COMP( 1989, fccpu6, 0, 0, fccpu6, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6", MACHINE_IS_SKELETON ) -//COMP( 1989, fccpu6a, 0, 0, fccpu6a, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6a", MACHINE_IS_SKELETON ) -//COMP( 1989, fccpu6v, 0, 0, fccpu6v, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6v", MACHINE_IS_SKELETON ) -//COMP( 1989, fccpu6va, 0, 0, fccpu6va, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6va", MACHINE_IS_SKELETON ) -//COMP( 1989, fccpu6vb, 0, 0, fccpu6vb, force68k, driver_device, 0, "Force Computers Gmbh", "SYS68K/CPU-6vb", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/fp1100.c b/src/mess/drivers/fp1100.c deleted file mode 100644 index 6352049278c..00000000000 --- a/src/mess/drivers/fp1100.c +++ /dev/null @@ -1,705 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Casio FP-1100 - - Info found at various sites: - - Casio FP1000 and FP1100 are "pre-PC" personal computers, with Cassette, - Floppy Disk, Printer and 2 cart/expansion slots. They had 32K ROM, 64K - main RAM, 80x25 text display, 320x200, 640x200, 640x400 graphics display. - Floppy disk is 2x 5 1/4. - - The FP1000 had 16K videoram and monochrome only. The monitor had a switch - to invert the display (swap foreground and background colours). - - The FP1100 had 48K videoram and 8 colours. - - Processors: Z80 @ 4MHz, uPD7801G @ 2MHz - - Came with Basic built in, and you could run CP/M 2.2 from the floppy disk. - - The keyboard is a separate unit. It contains a beeper. - - TODO: - - irq sources and communications; - - unimplemented instruction PER triggered (can be ignored) - - Most of this code is guesswork, because although schematics exist, - they are too blurry to read. - - Display can be interlaced or non-interlaced. Interlaced not emulated. - - Cassette Load is quite complex, using 6 pins of the sub-cpu. Not done. - - subcpu is supposed to be in WAIT except in horizontal blanking period. - WAIT is not emulated in our cpu. - - Keyboard not working. - - FDC not done. - - - To get it to boot while in debugger: - - focus 1 - - g - - after a second it will get stuck in a loop at fc2-fc4 - - press enter until it is at fc4 - - pc++ - - g - Now it will start. You will most likely get an error message, although - sometimes you'll get the Casio Basic title. Cursor will be flashing. - - The message will most likely be blue, but it should be white. - - Sometimes it will be in inverse video, and sometimes not. - - Sometimes it will beep, and sometimes not. - - The interrupt timing is quite critical. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/upd7810/upd7810.h" -#include "video/mc6845.h" -#include "sound/beep.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/cassette.h" - -#define MAIN_CLOCK 15974400 -#define LOG 0 - -class fp1100_state : public driver_device -{ -public: - fp1100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_subcpu(*this, "sub") - , m_crtc(*this, "crtc") - , m_p_videoram(*this, "videoram") - , m_keyboard(*this, "KEY") - , m_beep(*this, "beeper") - , m_centronics(*this, "centronics") - , m_cass(*this, "cassette") - { } - - DECLARE_WRITE8_MEMBER(main_bank_w); - DECLARE_WRITE8_MEMBER(irq_mask_w); - DECLARE_WRITE8_MEMBER(main_to_sub_w); - DECLARE_READ8_MEMBER(sub_to_main_r); - DECLARE_WRITE8_MEMBER(slot_bank_w); - DECLARE_READ8_MEMBER(slot_id_r); - DECLARE_READ8_MEMBER(main_to_sub_r); - DECLARE_WRITE8_MEMBER(sub_to_main_w); - DECLARE_WRITE8_MEMBER(colour_control_w); - DECLARE_WRITE8_MEMBER(kbd_row_w); - DECLARE_WRITE8_MEMBER(porta_w); - DECLARE_READ8_MEMBER(portb_r); - DECLARE_READ8_MEMBER(portc_r); - DECLARE_WRITE8_MEMBER(portc_w); - DECLARE_WRITE_LINE_MEMBER(centronics_busy_w); - DECLARE_WRITE_LINE_MEMBER(cass_w); - INTERRUPT_GEN_MEMBER(fp1100_vblank_irq); - DECLARE_DRIVER_INIT(fp1100); - DECLARE_MACHINE_RESET(fp1100); - MC6845_UPDATE_ROW(fp1100_update_row); - TIMER_DEVICE_CALLBACK_MEMBER(timer_c); - required_device m_palette; -private: - UINT8 m_irq_mask; - UINT8 m_main_latch; - UINT8 m_sub_latch; - UINT8 m_slot_num; - UINT8 m_kbd_row; - UINT8 m_col_border; - UINT8 m_col_cursor; - UINT8 m_col_display; - UINT8 m_centronics_busy; - UINT8 m_cass_data[4]; - bool m_cass_state; - bool m_cassold; - - struct { - UINT8 id; - }m_slot[8]; - - struct { - UINT8 porta; - UINT8 portb; - UINT8 portc; - }m_upd7801; - required_device m_maincpu; - required_device m_subcpu; - required_device m_crtc; - required_shared_ptr m_p_videoram; - required_ioport_array<16> m_keyboard; - required_device m_beep; - required_device m_centronics; - required_device m_cass; -}; - -MC6845_UPDATE_ROW( fp1100_state::fp1100_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 r,g,b,col,i; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - if BIT(m_upd7801.porta, 4) - { // green screen - for (x = 0; x < x_count; x++) - { - mem = (((ma+x)<<3) + ra) & 0x3fff; - g = m_p_videoram[mem]; - for (i = 0; i < 8; i++) - { - col = BIT(g, i); - if (x == cursor_x) col ^= 1; - *p++ = palette[col<<1]; - } - } - } - else - { // RGB screen - for (x = 0; x < x_count; x++) - { - mem = (((ma+x)<<3) + ra) & 0x3fff; - b = m_p_videoram[mem]; - r = m_p_videoram[mem+0x4000]; - g = m_p_videoram[mem+0x8000]; - for (i = 0; i < 8; i++) - { - col = BIT(r, i) + (BIT(g, i) << 1) + (BIT(b, i) << 2); - if (x == cursor_x) col = m_col_cursor; - *p++ = palette[col]; - } - } - } -} - -/* -d0 - Package select -d1 - Bank select (at boot time) -other bits not used -*/ -WRITE8_MEMBER( fp1100_state::main_bank_w ) -{ - membank("bankr0")->set_entry( BIT(data,1)); //(1) RAM (0) ROM - m_slot_num = (m_slot_num & 3) | ((data & 1) << 2); //?? -} - -WRITE8_MEMBER( fp1100_state::irq_mask_w ) -{ - machine().scheduler().synchronize(); // force resync - m_irq_mask = data; - m_subcpu->set_input_line(UPD7810_INTF2, BIT(data, 7) ? HOLD_LINE : CLEAR_LINE); - if (LOG) printf("%s: IRQmask=%X\n",machine().describe_context(),data); -} - -WRITE8_MEMBER( fp1100_state::main_to_sub_w ) -{ -// machine().scheduler().synchronize(); // force resync -// m_subcpu->set_input_line(UPD7810_INTF2, ASSERT_LINE); - m_sub_latch = data; - if (LOG) printf("%s: From main:%X\n",machine().describe_context(),data); -} - -READ8_MEMBER( fp1100_state::sub_to_main_r ) -{ -// machine().scheduler().synchronize(); // force resync -// m_maincpu->set_input_line(0, CLEAR_LINE); - if (LOG) printf("%s: To main:%X\n",machine().describe_context(),m_main_latch); - return m_main_latch; -} - -WRITE8_MEMBER( fp1100_state::slot_bank_w ) -{ - m_slot_num = (data & 3) | (m_slot_num & 4); -} - -READ8_MEMBER( fp1100_state::slot_id_r ) -{ - //return 0xff; - return m_slot[m_slot_num & 7].id; -} - -static ADDRESS_MAP_START(fp1100_map, AS_PROGRAM, 8, fp1100_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x9000, 0xffff) AM_RAM AM_REGION("wram", 0x9000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(fp1100_io, AS_IO, 8, fp1100_state ) - ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0x0000, 0xfeff) slot memory area - AM_RANGE(0xff00, 0xff7f) AM_READWRITE(slot_id_r,slot_bank_w) - AM_RANGE(0xff80, 0xffff) AM_READ(sub_to_main_r) - AM_RANGE(0xff80, 0xff9f) AM_WRITE(irq_mask_w) - AM_RANGE(0xffa0, 0xffbf) AM_WRITE(main_bank_w) - AM_RANGE(0xffc0, 0xffff) AM_WRITE(main_to_sub_w) -ADDRESS_MAP_END - -READ8_MEMBER( fp1100_state::main_to_sub_r ) -{ -// machine().scheduler().synchronize(); // force resync -// m_subcpu->set_input_line(UPD7810_INTF2, CLEAR_LINE); - if (LOG) printf("%s: To sub:%X\n",machine().describe_context(),m_sub_latch); - return m_sub_latch; -} - -WRITE8_MEMBER( fp1100_state::sub_to_main_w ) -{ -// machine().scheduler().synchronize(); // force resync -// m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xf0); - m_main_latch = data; - if (LOG) printf("%s: From sub:%X\n",machine().describe_context(),data); -} - -/* -d0,1,2 - border colour (B,R,G) -d3 - not used -d4,5,6 - colour of cursor; or display area (B,R,G) (see d7) -d7 - 1=display area; 0=cursor -*/ -WRITE8_MEMBER( fp1100_state::colour_control_w ) -{ - data = BITSWAP8(data, 7, 4, 6, 5, 3, 0, 2, 1); // change BRG to RGB - - m_col_border = data & 7; - - if BIT(data, 7) - m_col_display = (data >> 4) & 7; - else - m_col_cursor = data >> 4; -} - -/* -d0,1,2,3 - keyboard scan row - - if 13, turn on shift-lock LED - - if 14, turn on caps-lock LED - - if 15, turn off both LEDs -d4 - Beeper -d5 - "3state buffer of key data line (1=open, 0=closed)" -d6,7 - not used -*/ -WRITE8_MEMBER( fp1100_state::kbd_row_w ) -{ - m_kbd_row = data & 15; - m_beep->set_state(BIT(data, 4)); -} - -static ADDRESS_MAP_START(fp1100_slave_map, AS_PROGRAM, 8, fp1100_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("sub_ipl",0x0000) - AM_RANGE(0x2000, 0xdfff) AM_RAM AM_SHARE("videoram") //vram B/R/G - AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x3fe) AM_DEVREADWRITE("crtc", mc6845_device, status_r,address_w) - AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x3fe) AM_DEVREADWRITE("crtc", mc6845_device, register_r,register_w) - AM_RANGE(0xe400, 0xe7ff) AM_READ_PORT("DSW") AM_WRITE(kbd_row_w) - AM_RANGE(0xe800, 0xebff) AM_READWRITE(main_to_sub_r,sub_to_main_w) - //AM_RANGE(0xec00, 0xefff) "Acknowledge of INT0" doesn't seem to be used - AM_RANGE(0xf000, 0xf3ff) AM_WRITE(colour_control_w) - AM_RANGE(0xf400, 0xff7f) AM_ROM AM_REGION("sub_ipl",0x2400) - AM_RANGE(0xff80, 0xffff) AM_RAM /* upd7801 internal RAM */ -ADDRESS_MAP_END - -/* -d0,1,2 - enable RGB guns (G,R,B) -d3 - CRTC clock (80 or 40 cols) -d4 - RGB (0) or Green (1) -d5 - clear videoram -d6 - CMT baud rate (1=300; 0=1200) -d7 - CMT load clock -The SO pin is Serial Output to CMT (1=2400Hz; 0=1200Hz) -*/ -WRITE8_MEMBER( fp1100_state::porta_w ) -{ - m_upd7801.porta = data; - - if BIT(data, 5) - memset(m_p_videoram, 0, 0xc000); -} - -READ8_MEMBER( fp1100_state::portb_r ) -{ - UINT8 data = m_keyboard[m_kbd_row]->read() ^ 0xff; - //m_subcpu->set_input_line(UPD7810_INTF0, BIT(data, 7) ? HOLD_LINE : CLEAR_LINE); - return data; -} - -/* -d0 - Centronics busy -d1 - Centronics error -d2 - CMT load input clock -d7 - CMT load serial data -*/ -READ8_MEMBER( fp1100_state::portc_r ) -{ - return (m_upd7801.portc & 0x78) | m_centronics_busy; -} - -/* -d3 - cause INT on main cpu -d4 - Centronics port is used for input or output -d5 - CMT relay -d6 - Centronics strobe -*/ -WRITE8_MEMBER( fp1100_state::portc_w ) -{ - if BIT(m_irq_mask, 4) - m_maincpu->set_input_line_and_vector(0, BIT(data, 3) ? CLEAR_LINE : HOLD_LINE, 0xf0); - if (LOG) printf("%s: PortC:%X\n",machine().describe_context(),data); - m_upd7801.portc = data; - m_cass->change_state(BIT(data, 5) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_centronics->write_strobe(BIT(data, 6)); -} - -static ADDRESS_MAP_START(fp1100_slave_io, AS_IO, 8, fp1100_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_WRITE(porta_w) - AM_RANGE(0x01, 0x01) AM_READ(portb_r) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x02, 0x02) AM_READWRITE(portc_r,portc_w) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( fp1100 ) - PORT_START("KEY.0") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") - PORT_BIT(0x70, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_NAME("Caps") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_NAME("Graph") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("Ctrl") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Shift") PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("KEY.2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("PF0") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("*") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP-") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") PORT_CHAR(27) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('A') PORT_CHAR('a') - - PORT_START("KEY.3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("PF1") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME(",") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("/") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('S') PORT_CHAR('s') - - PORT_START("KEY.4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("PF2") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME(".") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("Del") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('D') PORT_CHAR('d') - - PORT_START("KEY.5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("PF3") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("000") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('F') PORT_CHAR('f') - - PORT_START("KEY.6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("PF4") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Space") PORT_CHAR(32) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Ins") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('G') PORT_CHAR('g') - - PORT_START("KEY.7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("PF5") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHAR('5') PORT_CHAR('^') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('H') PORT_CHAR('h') - - PORT_START("KEY.8") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("PF6") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('J') PORT_CHAR('j') - - PORT_START("KEY.9") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("PF7") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Home") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHAR('7') PORT_CHAR('%') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('K') PORT_CHAR('k') - - PORT_START("KEY.10") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("PF8") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("]") PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('L') PORT_CHAR('l') - - PORT_START("KEY.11") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("PF9") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("[") PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Rubout") PORT_CHAR(8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Return") PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHAR(';') PORT_CHAR('+') - - PORT_START("KEY.12") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop/Cont") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("Yen") PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(c)") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("|") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("^") PORT_CHAR('^') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_NAME(":") PORT_CHAR(':') PORT_CHAR('*') - - PORT_START("KEY.13") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.14") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.15") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x01, "Text width" ) PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x00, "40 chars/line" ) - PORT_DIPSETTING( 0x01, "80 chars/line" ) - PORT_DIPNAME( 0x02, 0x02, "Screen Mode" ) PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x00, "Screen 0" ) - PORT_DIPSETTING( 0x02, "Screen 1" ) - PORT_DIPNAME( 0x04, 0x04, "FP Mode" ) PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x00, "FP-1000" ) // Green screen - PORT_DIPSETTING( 0x04, "FP-1100" ) // RGB - PORT_DIPNAME( 0x08, 0x08, "CMT Baud Rate" ) PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x00, "1200 Baud" ) - PORT_DIPSETTING( 0x08, "300 Baud" ) - PORT_DIPNAME( 0x10, 0x10, "Printer Type" ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x00, "" ) - PORT_DIPSETTING( 0x10, "FP-1012PR" ) - PORT_DIPNAME( 0x20, 0x20, "Keyboard Type" ) PORT_DIPLOCATION("SW1:6") - PORT_DIPSETTING( 0x00, "" ) - PORT_DIPSETTING( 0x20, "Normal" ) - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SLOTS") - PORT_CONFNAME( 0x0003, 0x0002, "Slot #0" ) - PORT_CONFSETTING( 0x0000, "(null)" ) - PORT_CONFSETTING( 0x0001, "ROM" ) - PORT_CONFSETTING( 0x0002, "RAM" ) - PORT_CONFSETTING( 0x0003, "FDC" ) - PORT_CONFNAME( 0x000c, 0x0008, "Slot #1" ) - PORT_CONFSETTING( 0x0000, "(null)" ) - PORT_CONFSETTING( 0x0004, "ROM" ) - PORT_CONFSETTING( 0x0008, "RAM" ) - PORT_CONFSETTING( 0x000c, "FDC" ) - PORT_CONFNAME( 0x0030, 0x0020, "Slot #2" ) - PORT_CONFSETTING( 0x0000, "(null)" ) - PORT_CONFSETTING( 0x0010, "ROM" ) - PORT_CONFSETTING( 0x0020, "RAM" ) - PORT_CONFSETTING( 0x0030, "FDC" ) - PORT_CONFNAME( 0x00c0, 0x0080, "Slot #3" ) - PORT_CONFSETTING( 0x0000, "(null)" ) - PORT_CONFSETTING( 0x0040, "ROM" ) - PORT_CONFSETTING( 0x0080, "RAM" ) - PORT_CONFSETTING( 0x00c0, "FDC" ) - PORT_CONFNAME( 0x0300, 0x0200, "Slot #4" ) - PORT_CONFSETTING( 0x0000, "(null)" ) - PORT_CONFSETTING( 0x0100, "ROM" ) - PORT_CONFSETTING( 0x0200, "RAM" ) - PORT_CONFSETTING( 0x0300, "FDC" ) - PORT_CONFNAME( 0x0c00, 0x0800, "Slot #5" ) - PORT_CONFSETTING( 0x0000, "(null)" ) - PORT_CONFSETTING( 0x0400, "ROM" ) - PORT_CONFSETTING( 0x0800, "RAM" ) - PORT_CONFSETTING( 0x0c00, "FDC" ) - PORT_CONFNAME( 0x3000, 0x2000, "Slot #6" ) - PORT_CONFSETTING( 0x0000, "(null)" ) - PORT_CONFSETTING( 0x1000, "ROM" ) - PORT_CONFSETTING( 0x2000, "RAM" ) - PORT_CONFSETTING( 0x3000, "FDC" ) - PORT_CONFNAME( 0xc000, 0x8000, "Slot #7" ) - PORT_CONFSETTING( 0x0000, "(null)" ) - PORT_CONFSETTING( 0x4000, "ROM" ) - PORT_CONFSETTING( 0x8000, "RAM" ) - PORT_CONFSETTING( 0xc000, "FDC" ) -INPUT_PORTS_END - - -static const gfx_layout fp1100_chars_8x8 = -{ - 8,8, - 256, - 1, - { 0 }, - { 7, 6, 5, 4, 3, 2, 1, 0 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( fp1100 ) - GFXDECODE_ENTRY( "sub_ipl", 0x2400, fp1100_chars_8x8, 0, 1 ) -GFXDECODE_END - -WRITE_LINE_MEMBER( fp1100_state::centronics_busy_w ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( fp1100_state::cass_w ) -{ - m_cass_state = state; -} - -TIMER_DEVICE_CALLBACK_MEMBER( fp1100_state::timer_c ) -{ - m_cass_data[3]++; - - if (m_cass_state != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = m_cass_state; - } - - if (m_cass_state) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -INTERRUPT_GEN_MEMBER(fp1100_state::fp1100_vblank_irq) -{ -// if BIT(m_irq_mask, 4) -// m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xf8); -} - -MACHINE_RESET_MEMBER( fp1100_state, fp1100 ) -{ - int i; - UINT8 slot_type; - const UINT8 id_type[4] = { 0xff, 0x00, 0x01, 0x04}; - for(i=0;i<8;i++) - { - slot_type = (ioport("SLOTS")->read() >> i*2) & 3; - m_slot[i].id = id_type[slot_type]; - } - - m_beep->set_frequency(950); /* guess */ - m_beep->set_state(0); - - membank("bankr0")->set_entry(0); // point at rom - membank("bankw0")->set_entry(0); // always write to ram - - m_irq_mask = 0; - m_main_latch = 0; - m_sub_latch = 0; - m_slot_num = 0; - m_kbd_row = 0; - m_col_border = 0; - m_col_cursor = 0; - m_col_display = 0; - m_upd7801.porta = 0; - m_upd7801.portb = 0; - m_upd7801.portc = 0; -} - -DRIVER_INIT_MEMBER( fp1100_state, fp1100 ) -{ - UINT8 *main = memregion("ipl")->base(); - UINT8 *wram = memregion("wram")->base(); - - membank("bankr0")->configure_entry(1, &wram[0x0000]); - membank("bankr0")->configure_entry(0, &main[0x0000]); - membank("bankw0")->configure_entry(0, &wram[0x0000]); -} - -static MACHINE_CONFIG_START( fp1100, fp1100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, MAIN_CLOCK/4) - MCFG_CPU_PROGRAM_MAP(fp1100_map) - MCFG_CPU_IO_MAP(fp1100_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", fp1100_state, fp1100_vblank_irq) - - MCFG_CPU_ADD( "sub", UPD7801, MAIN_CLOCK/4 ) - MCFG_CPU_PROGRAM_MAP( fp1100_slave_map ) - MCFG_CPU_IO_MAP( fp1100_slave_io ) - MCFG_UPD7810_TXD(WRITELINE(fp1100_state, cass_w)) - - MCFG_MACHINE_RESET_OVERRIDE(fp1100_state, fp1100) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", h46505_device, screen_update) - MCFG_PALETTE_ADD("palette", 8) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", fp1100) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) // inside the keyboard - - /* CRTC */ - MCFG_MC6845_ADD("crtc", H46505, "screen", MAIN_CLOCK/8) /* hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(fp1100_state, fp1100_update_row) - - /* Printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(fp1100_state, centronics_busy_w)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* Cassette */ - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_c", fp1100_state, timer_c, attotime::from_hz(4800)) // cass write -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( fp1100 ) - ROM_REGION( 0x9000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "basic.rom", 0x0000, 0x9000, BAD_DUMP CRC(7c7dd17c) SHA1(985757b9c62abd17b0bd77db751d7782f2710ec3)) - - ROM_REGION( 0x3000, "sub_ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "sub1.rom", 0x0000, 0x1000, CRC(8feda489) SHA1(917d5b398b9e7b9a6bfa5e2f88c5b99923c3c2a3)) - ROM_LOAD( "sub2.rom", 0x1000, 0x1000, CRC(359f007e) SHA1(0188d5a7b859075cb156ee55318611bd004128d7)) - ROM_LOAD( "sub3.rom", 0x2000, 0xf80, BAD_DUMP CRC(fb2b577a) SHA1(a9ae6b03e06ea2f5db30dfd51ebf5aede01d9672)) - - ROM_REGION( 0x10000, "wram", ROMREGION_ERASE00 ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, fp1100, 0, 0, fp1100, fp1100, fp1100_state, fp1100, "Casio", "FP-1100", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/fp200.c b/src/mess/drivers/fp200.c deleted file mode 100644 index 9e9cc9c47db..00000000000 --- a/src/mess/drivers/fp200.c +++ /dev/null @@ -1,626 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - FP-200 (c) 1982 Casio - - preliminary driver by Angelo Salese - - TODO: - - What's the LCDC type? Custom? - - Unless I've missed something in the schems, this one shouldn't have any - sound capability. - - backup RAM. - - Rewrite video emulation from scratch. - - Notes: - - on start-up there's a "memory illegal" warning. Enter "RESET" command - to initialize it (thanks to Takeda Toshiya for pointing this out). - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" - -#define MAIN_CLOCK XTAL_6_144MHz - -class fp200_state : public driver_device -{ -public: - fp200_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - // devices - required_device m_maincpu; - UINT8 m_io_type; - UINT8 *m_chargen; - UINT8 m_keyb_mux; - - struct{ - UINT8 x; - UINT8 y; - UINT8 status; - UINT8 *vram; - UINT8 *attr; - }m_lcd; - UINT8 read_lcd_attr(UINT16 X, UINT16 Y); - UINT8 read_lcd_vram(UINT16 X, UINT16 Y); - void write_lcd_attr(UINT16 X, UINT16 Y,UINT8 data); - void write_lcd_vram(UINT16 X, UINT16 Y,UINT8 data); - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER(fp200_io_r); - DECLARE_WRITE8_MEMBER(fp200_io_w); - DECLARE_READ8_MEMBER(fp200_lcd_r); - DECLARE_WRITE8_MEMBER(fp200_lcd_w); - DECLARE_READ8_MEMBER(fp200_keyb_r); - DECLARE_WRITE8_MEMBER(fp200_keyb_w); - DECLARE_INPUT_CHANGED_MEMBER(keyb_irq); - - DECLARE_WRITE_LINE_MEMBER(sod_w); - DECLARE_READ_LINE_MEMBER(sid_r); - - DECLARE_PALETTE_INIT(fp200); -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); -}; - -void fp200_state::video_start() -{ - m_lcd.vram = auto_alloc_array_clear(machine(), UINT8, 20*64); - m_lcd.attr = auto_alloc_array_clear(machine(), UINT8, 20*64); -} - -/* TODO: Very preliminary, I actually believe that the LCDC writes in a blitter fashion ... */ -UINT32 fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - UINT16 l_offs, r_offs; - - bitmap.fill(0, cliprect); - - l_offs = 0; - r_offs = 0; - for(int y=cliprect.min_y;y= 64) - yoffs -= 64; - - if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) - { - UINT8 vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; - bitmap.pix16(y,x) = pix; - } - /* - else if(m_lcd.attr[x/8+yoffs*20] == 0x40) - { - UINT8 vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = (vram) >> (7-(yoffs & 7)) & 1; - bitmap.pix16(y,x) = pix; - }*/ - } - } - - for(int y=cliprect.min_y;y= 64) - yoffs -= 64; - - if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) - { - UINT8 vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; - bitmap.pix16(y,x) = pix; - } - /*else if(m_lcd.attr[x/8+yoffs*20] == 0x40) - { - UINT8 vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = (vram) >> (7-(yoffs & 7)) & 1; - bitmap.pix16(y,x) = pix; - }*/ - } - } - - return 0; -} - - -/* -[1] DDDD DDDD vram data/attr (left half) -[2] DDDD DDDD vram data/attr (right half) -[8] SSSS --YY Status code (1=vram type/0xb=attr type) / upper part of Y address -[9] YYYY XXXX lower part of Y address / X address -*/ -UINT8 fp200_state::read_lcd_attr(UINT16 X, UINT16 Y) -{ - UINT16 base_offs; - UINT8 res = 0; - - for(int yi=0;yi<8;yi++) - { - base_offs = X+(Y+yi)*20; - - if(base_offs >= 20*64) - return 0xff; - - res = m_lcd.attr[base_offs]; - } - - return res; -} - -UINT8 fp200_state::read_lcd_vram(UINT16 X, UINT16 Y) -{ - UINT16 base_offs; - UINT8 res = 0; - - for(int yi=0;yi<8;yi++) - { - base_offs = X+(Y+yi)*20; - - if(base_offs >= 20*64) - return 0xff; - - res = m_lcd.vram[base_offs]; - } - - return res; -} - -READ8_MEMBER(fp200_state::fp200_lcd_r) -{ - UINT8 res; - - res = 0; - - switch(offset) - { - case 1: - //printf("%d %d -> (L) %02x\n",m_lcd.x,m_lcd.y,m_lcd.status); - if(m_lcd.status == 0xb) - res = read_lcd_attr(m_lcd.x,m_lcd.y); - else if(m_lcd.status == 1) - res = read_lcd_vram(m_lcd.x,m_lcd.y); - break; - case 2: - //printf("%d %d -> (R) %02x\n",m_lcd.x,m_lcd.y,m_lcd.status); - if(m_lcd.status == 0xb) - res = read_lcd_attr(m_lcd.x + 10,m_lcd.y); - else if(m_lcd.status == 1) - res = read_lcd_vram(m_lcd.x + 10,m_lcd.y); - break; - case 8: - res = (m_lcd.status & 0xf) << 4; - res |= (m_lcd.y & 0x30) >> 4; - break; - case 9: - res = (m_lcd.y & 0xf) << 4; - res |= (m_lcd.x & 0xf); - break; - } - - - return res; -} - -void fp200_state::write_lcd_attr(UINT16 X, UINT16 Y,UINT8 data) -{ - UINT16 base_offs; - - for(int yi=0;yi<8;yi++) - { - base_offs = X+(Y+yi)*20; - - if(base_offs >= 20*64) - return; - - //if(data != 0x60) - // printf("%d %d %02x\n",X,Y,data); - - m_lcd.attr[base_offs] = data; - } -} - -void fp200_state::write_lcd_vram(UINT16 X, UINT16 Y,UINT8 data) -{ - UINT16 base_offs; - - for(int yi=0;yi<8;yi++) - { - base_offs = X+(Y+yi)*20; - - if(base_offs >= 20*64) - return; - - m_lcd.vram[base_offs] = data; - } -} - -WRITE8_MEMBER(fp200_state::fp200_lcd_w) -{ - switch(offset) - { - case 1: - //printf("%d %d -> %02x (%c) (L %02x)\n",m_lcd.x,m_lcd.y,data,data,m_lcd.status); - if(m_lcd.status == 0xb) - write_lcd_attr(m_lcd.x,m_lcd.y,data); - else if(m_lcd.status == 1) - write_lcd_vram(m_lcd.x,m_lcd.y,data); - break; - case 2: - //printf("%d %d -> %02x (%c) (R %02x)\n",m_lcd.x + 10,m_lcd.y,data,data,m_lcd.status); - if(m_lcd.status == 0xb) - write_lcd_attr(m_lcd.x + 10,m_lcd.y,data); - else if(m_lcd.status == 1) - write_lcd_vram(m_lcd.x + 10,m_lcd.y,data); - break; - case 8: - m_lcd.status = (data & 0xf0) >> 4; - if(m_lcd.status == 0x0b) - m_lcd.y = (m_lcd.y & 0xf) | ((data & 3) << 4); - break; - case 9: - m_lcd.y = (m_lcd.y & 0x30) | ((data & 0xf0) >> 4); - m_lcd.x = data & 0xf; - break; - } -} - -READ8_MEMBER(fp200_state::fp200_keyb_r) -{ - const char *const keynames[16] = { "KEY0", "KEY1", "KEY2", "KEY3", - "KEY4", "KEY5", "KEY6", "KEY7", - "KEY8", "KEY9", "UNUSED", "UNUSED", - "UNUSED", "UNUSED", "UNUSED", "UNUSED"}; - UINT8 res; - - if(offset == 0) - res = ioport(keynames[m_keyb_mux])->read(); - else - { - printf("Unknown keyboard offset read access %02x\n",offset + 0x20); - res = 0; - } - - return res; -} - -WRITE8_MEMBER(fp200_state::fp200_keyb_w) -{ - if(offset == 1) - m_keyb_mux = data & 0xf; - else if(offset == 0) - { - // ... ? - } - else - printf("Unknown keyboard offset write access %02x %02x\n",offset + 0x20,data); -} - -/* -Annoyingly the i/o map uses the SOD to access different devices, so we need trampolines. -SOD = 0 -0x10 - 0x1f Timer control (RPC05 RTC) -0x20 - 0x2f AUTO-POWER OFF -0x40 - 0x4f FDC Device ID Code (5 for "FP-1021FD") -0x80 - 0xff FDD (unknown type) -SOD = 1 -0x00 - 0x0f LCD control. -0x10 - 0x1f I/O control -0x20 - 0x2f Keyboard -0x40 - 0x4f MT.RS-232C control -0x80 - 0x8f Printer (Centronics) -*/ -READ8_MEMBER(fp200_state::fp200_io_r) -{ - UINT8 res; - - if(m_io_type == 0) - { - res = 0; - logerror("Unemulated I/O read %02x (%02x)\n",offset,m_io_type); - } - else - { - switch(offset & 0xf0) - { - //case 0x00: return; - case 0x00: res = fp200_lcd_r(space, offset & 0xf); break; - case 0x20: res = fp200_keyb_r(space, offset & 0xf); break; - default: res = 0; logerror("Unemulated I/O read %02x (%02x)\n",offset,m_io_type); break; - } - } - - return res; -} - -WRITE8_MEMBER(fp200_state::fp200_io_w) -{ - if(m_io_type == 0) - { - switch(offset & 0xf0) - { - default:logerror("Unemulated I/O write %02x (%02x) <- %02x\n",offset,m_io_type,data); break; - } - } - else - { - switch(offset & 0xf0) - { - case 0x00: fp200_lcd_w(space, offset & 0xf,data); break; - case 0x20: fp200_keyb_w(space, offset & 0xf,data); break; - default:logerror("Unemulated I/O write %02x (%02x) <- %02x\n",offset,m_io_type,data); break; - } - } -} - -static ADDRESS_MAP_START( fp200_map, AS_PROGRAM, 8, fp200_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x9fff) AM_RAM -// 0xa000, 0xffff exp RAM - AM_RANGE(0xa000, 0xbfff) AM_RAM - AM_RANGE(0xc000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( fp200_io, AS_IO, 8, fp200_state ) - AM_RANGE(0x00, 0xff) AM_READWRITE(fp200_io_r,fp200_io_w) -ADDRESS_MAP_END - -INPUT_CHANGED_MEMBER(fp200_state::keyb_irq) -{ - /* a keyboard stroke causes a rst7.5 */ - m_maincpu->set_input_line(I8085_RST75_LINE, (newval) ? ASSERT_LINE : CLEAR_LINE); - -} - -/* TODO: remote SW? */ -static INPUT_PORTS_START( fp200 ) - PORT_START("KEY0") - PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 / '") PORT_CODE(KEYCODE_7) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY1") - PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 / (") PORT_CODE(KEYCODE_8) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY2") - PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 / )") PORT_CODE(KEYCODE_9) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". / >") PORT_CODE(KEYCODE_STOP) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY3") - PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", / <") PORT_CODE(KEYCODE_COMMA) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; / +") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY4") -// PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) //PORT_TOGGLE PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INS / DEL") PORT_CODE(KEYCODE_INSERT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HOME / CLS") PORT_CODE(KEYCODE_HOME) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF0 / PF5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 / !") PORT_CODE(KEYCODE_1) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("STOP / CONT") PORT_CODE(KEYCODE_RIGHT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ / |") PORT_CODE(KEYCODE_RIGHT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF1 / PF6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 / \"") PORT_CODE(KEYCODE_2) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("^ / ~") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF2 / PF7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 / #") PORT_CODE(KEYCODE_3) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ / '") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- / =") PORT_CODE(KEYCODE_MINUS) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF3 / PF8") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 / $") PORT_CODE(KEYCODE_4) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": / *") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF4 / PF9") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 / %") PORT_CODE(KEYCODE_5) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEY9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] / }") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 / &") PORT_CODE(KEYCODE_6) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, fp200_state,keyb_irq, 0) - - PORT_START("KEYMOD") - PORT_BIT( 0x01f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CETL") PORT_TOGGLE - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - - PORT_START("UNUSED") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -static const gfx_layout charlayout = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { RGN_FRAC(0,1) }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - 8*8 -}; - -static GFXDECODE_START( fp200 ) - GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 1 ) -GFXDECODE_END - - -void fp200_state::machine_start() -{ - UINT8 *raw_gfx = memregion("raw_gfx")->base(); - m_chargen = memregion("chargen")->base(); - - for(int i=0;i<0x800;i++) - { - m_chargen[i] = raw_gfx[BITSWAP16(i,15,14,13,12,11,6,5,4,3,10,9,8,7,2,1,0)]; - } -} - -void fp200_state::machine_reset() -{ -} - - -PALETTE_INIT_MEMBER(fp200_state, fp200) -{ - palette.set_pen_color(0, 0xa0, 0xa8, 0xa0); - palette.set_pen_color(1, 0x30, 0x38, 0x10); -} - -WRITE_LINE_MEMBER( fp200_state::sod_w ) -{ - m_io_type = state; -} - -READ_LINE_MEMBER( fp200_state::sid_r ) -{ - return (ioport("KEYMOD")->read() >> m_keyb_mux) & 1; -} - -static MACHINE_CONFIG_START( fp200, fp200_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8085A,MAIN_CLOCK) - MCFG_CPU_PROGRAM_MAP(fp200_map) - MCFG_CPU_IO_MAP(fp200_io) - MCFG_I8085A_SID(READLINE(fp200_state, sid_r)) - MCFG_I8085A_SOD(WRITELINE(fp200_state, sod_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(fp200_state, screen_update) - MCFG_SCREEN_SIZE(20*8, 8*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 8*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", fp200) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(fp200_state, fp200) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( fp200 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "fp200rom.bin", 0x0000, 0x8000, CRC(dba6e41b) SHA1(c694fa19172eb56585a9503997655bcf9d369c34) ) - - ROM_REGION( 0x800, "raw_gfx", ROMREGION_ERASE00 ) - ROM_LOAD( "chr.bin", 0x0000, 0x800, CRC(2e6501a5) SHA1(6186e25feabe6db851ee7d61dad11e182a6d3a4a) ) - - ROM_REGION( 0x800, "chargen", ROMREGION_ERASE00 ) -ROM_END - -COMP( 1982, fp200, 0, 0, fp200, fp200, driver_device, 0, "Casio", "FP-200 (Japan)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/fp6000.c b/src/mess/drivers/fp6000.c deleted file mode 100644 index 9a7866c339e..00000000000 --- a/src/mess/drivers/fp6000.c +++ /dev/null @@ -1,330 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Casio FP-6000 - - preliminary driver by Angelo Salese - - TODO: - - keyboard; - - fdc / cmt; - - gvram color pen is a rather crude guess (the layer is monochrome on - BASIC?); - - everything else - - Debug trick for the keyboard: - - bp 0xfc93e, ip+=2 then define al = ASCII code - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "video/mc6845.h" - - -class fp6000_state : public driver_device -{ -public: - fp6000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_gvram(*this, "gvram"), - m_vram(*this, "vram"), - m_maincpu(*this, "maincpu") - , m_crtc(*this, "crtc"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - UINT8 *m_char_rom; - required_shared_ptr m_gvram; - required_shared_ptr m_vram; - UINT8 m_crtc_vreg[0x100],m_crtc_index; - - struct { - UINT16 cmd; - }m_key; - DECLARE_READ8_MEMBER(fp6000_pcg_r); - DECLARE_WRITE8_MEMBER(fp6000_pcg_w); - DECLARE_WRITE8_MEMBER(fp6000_6845_address_w); - DECLARE_WRITE8_MEMBER(fp6000_6845_data_w); - DECLARE_READ8_MEMBER(fp6000_key_r); - DECLARE_WRITE8_MEMBER(fp6000_key_w); - DECLARE_READ16_MEMBER(unk_r); - DECLARE_READ16_MEMBER(ex_board_r); - DECLARE_READ16_MEMBER(pit_r); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_fp6000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_devicem_crtc; - required_device m_gfxdecode; - required_device m_palette; -}; - -void fp6000_state::video_start() -{ -} - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - - -UINT32 fp6000_state::screen_update_fp6000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - int xi,yi; - UINT8 *gfx_rom = memregion("pcg")->base(); - UINT32 count; - - count = 0; - - for(y=0;y<400;y++) - { - for(x=0;x<640/4;x++) - { - for(xi=0;xi<4;xi++) - { - int dot = (m_gvram[count] >> (12-xi*4)) & 0xf; - - if(y < 400 && x*4+xi < 640) /* TODO: safety check */ - bitmap.pix16(y, x*4+xi) = m_palette->pen(dot); - } - - count++; - } - } - - for(y=0;y> 8; - int pen; - - for(yi=0;yi> (7-xi) & 1) ? color : -1; - - if(pen != -1) - if(y*mc6845_tile_height < 400 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); - } - } - } - } - - /* quick and dirty way to do the cursor */ - for(yi=0;yipen(7); - } - } - } - - return 0; -} - -READ8_MEMBER(fp6000_state::fp6000_pcg_r) -{ - return m_char_rom[offset]; -} - -WRITE8_MEMBER(fp6000_state::fp6000_pcg_w) -{ - m_char_rom[offset] = data; - m_gfxdecode->gfx(0)->mark_dirty(offset >> 4); -} - -WRITE8_MEMBER(fp6000_state::fp6000_6845_address_w) -{ - m_crtc_index = data; - m_crtc->address_w(space, offset, data); -} - -WRITE8_MEMBER(fp6000_state::fp6000_6845_data_w) -{ - m_crtc_vreg[m_crtc_index] = data; - m_crtc->register_w(space, offset, data); -} - -static ADDRESS_MAP_START(fp6000_map, AS_PROGRAM, 16, fp6000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0xbffff) AM_RAM - AM_RANGE(0xc0000,0xdffff) AM_RAM AM_SHARE("gvram")//gvram - AM_RANGE(0xe0000,0xe0fff) AM_RAM AM_SHARE("vram") - AM_RANGE(0xe7000,0xe7fff) AM_READWRITE8(fp6000_pcg_r,fp6000_pcg_w,0xffff) - AM_RANGE(0xf0000,0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -/* Hack until I understand what UART is this one ... */ -READ8_MEMBER(fp6000_state::fp6000_key_r) -{ - if(offset) - { - switch(m_key.cmd) - { - case 0x7e15: return 3; - case 0x1b15: return 1; - case 0x2415: return 0; - default: printf("%04x\n",m_key.cmd); - } - return 0; - } - - return 0x40; -} - -WRITE8_MEMBER(fp6000_state::fp6000_key_w) -{ - if(offset) - m_key.cmd = (data & 0xff) | (m_key.cmd << 8); - else - m_key.cmd = (data << 8) | (m_key.cmd & 0xff); -} - -READ16_MEMBER(fp6000_state::unk_r) -{ - return 0x40; -} - -READ16_MEMBER(fp6000_state::ex_board_r) -{ - return 0xffff; -} - -READ16_MEMBER(fp6000_state::pit_r) -{ - return machine().rand(); -} - -static ADDRESS_MAP_START(fp6000_io, AS_IO, 16, fp6000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x08, 0x09) AM_READ(ex_board_r) // BIOS of some sort ... - AM_RANGE(0x0a, 0x0b) AM_READ_PORT("DSW") // installed RAM id? - AM_RANGE(0x10, 0x11) AM_READNOP - AM_RANGE(0x20, 0x23) AM_READWRITE8(fp6000_key_r,fp6000_key_w,0x00ff) - AM_RANGE(0x38, 0x39) AM_READ(pit_r) // pit? - AM_RANGE(0x70, 0x71) AM_WRITE8(fp6000_6845_address_w,0x00ff) - AM_RANGE(0x72, 0x73) AM_WRITE8(fp6000_6845_data_w,0x00ff) - AM_RANGE(0x74, 0x75) AM_READ(unk_r) //bit 6 busy flag -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( fp6000 ) - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x00, "DSW" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0xe0, 0x40, "Installed RAM banks" ) - PORT_DIPSETTING( 0xe0, "0" ) - PORT_DIPSETTING( 0xc0, "1" ) - PORT_DIPSETTING( 0xa0, "2" ) - PORT_DIPSETTING( 0x80, "3" ) - PORT_DIPSETTING( 0x60, "4" ) - PORT_DIPSETTING( 0x40, "5" ) - PORT_DIPSETTING( 0x20, "6 (INVALID)" ) //exceeds 768KB limit (writes to gvram et al) - PORT_DIPSETTING( 0x00, "7 (INVALID)" ) -INPUT_PORTS_END - -static const gfx_layout fp6000_charlayout = -{ - 8, 16, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP8(0,1) }, - { STEP16(0,8) }, - 8*16 -}; - -static GFXDECODE_START( fp6000 ) - GFXDECODE_ENTRY( "pcg", 0x0000, fp6000_charlayout, 0, 1 ) -GFXDECODE_END - - -void fp6000_state::machine_start() -{ - m_char_rom = memregion("pcg")->base(); -} - -void fp6000_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( fp6000, fp6000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 16000000/2) - MCFG_CPU_PROGRAM_MAP(fp6000_map) - MCFG_CPU_IO_MAP(fp6000_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(fp6000_state, screen_update_fp6000) - MCFG_SCREEN_PALETTE("palette") - - MCFG_MC6845_ADD("crtc", H46505, "screen", 16000000/5) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_PALETTE_ADD("palette", 8) -// MCFG_PALETTE_INIT(black_and_white) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", fp6000) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( fp6000 ) - ROM_REGION( 0x10000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x10000, CRC(c72fe40a) SHA1(0e4c60dc27f6c7f461c4bc382b81602b3327a7a4)) - - ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) - ROM_LOAD( "mcu", 0x0000, 0x1000, NO_DUMP ) //unknown MCU type - - ROM_REGION( 0x10000, "pcg", ROMREGION_ERASE00 ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, fp6000, 0, 0, fp6000, fp6000, driver_device, 0, "Casio", "FP-6000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/ft68m.c b/src/mess/drivers/ft68m.c deleted file mode 100644 index a4d5b4da4a6..00000000000 --- a/src/mess/drivers/ft68m.c +++ /dev/null @@ -1,128 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Forward Technology FT-68M Multibus card. - -2013-09-26 Skeleton driver - -Chips: HD68000-10, uPD7201C, AM9513APC. Crystal: 19.6608 MHz - -Interrupts: INT6 is output of Timer 2, INT7 is output of Timer 3 (refresh), - INT5 comes from SIO. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class ft68m_state : public driver_device -{ -public: - ft68m_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_base(*this, "rambase"), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ16_MEMBER(keyin_r); - DECLARE_READ16_MEMBER(status_r); - DECLARE_READ16_MEMBER(switches_r); -private: - UINT8 m_term_data; - virtual void machine_reset(); - required_shared_ptr m_p_base; - required_device m_maincpu; - required_device m_terminal; -}; - -READ16_MEMBER( ft68m_state::keyin_r ) -{ - UINT16 ret = m_term_data; - m_term_data = 0; - return ret << 8; -} - -READ16_MEMBER( ft68m_state::status_r ) -{ - return (m_term_data) ? 0x500 : 0x400; -} - -READ16_MEMBER( ft68m_state::switches_r ) -{ - return 0x7c00; // bypass self test -} - - -static ADDRESS_MAP_START(ft68m_mem, AS_PROGRAM, 16, ft68m_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xffffff) - AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("rambase") - AM_RANGE(0x200000, 0x201fff) AM_ROM AM_REGION("roms", 0x0000) - AM_RANGE(0x400000, 0x401fff) AM_ROM AM_REGION("roms", 0x2000) - AM_RANGE(0x600000, 0x600001) AM_READ(keyin_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff00) - AM_RANGE(0x600002, 0x600003) AM_READ(status_r) - //AM_RANGE(0x600000, 0x600003) AM_MIRROR(0x1ffffc) uPD7201 SIO - //AM_RANGE(0x800000, 0x800003) AM_MIRROR(0x1ffffc) AM9513 Timer - AM_RANGE(0xa00000, 0xbfffff) AM_RAM //Page Map - AM_RANGE(0xc00000, 0xdfffff) AM_RAM //Segment Map - AM_RANGE(0xe00000, 0xffffff) AM_READ(switches_r) //Context Register -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( ft68m ) -INPUT_PORTS_END - - -void ft68m_state::machine_reset() -{ - UINT8* ROM = memregion("roms")->base(); - memcpy(m_p_base, ROM, 8); - m_maincpu->reset(); -} - -WRITE8_MEMBER( ft68m_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( ft68m, ft68m_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_19_6608MHz / 2) - MCFG_CPU_PROGRAM_MAP(ft68m_mem) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ft68m_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ft68m ) - ROM_REGION16_BE(0x4000, "roms", 0) - ROM_LOAD16_BYTE("23-0009-01c.a4", 0x0000, 0x1000, CRC(0d45fc8d) SHA1(59587cb1c151bfd0d69e708716ed3b0a78aa85ea) ) - ROM_LOAD16_BYTE("23-0008-01c.a1", 0x0001, 0x1000, CRC(d1aa1164) SHA1(05e10f1c594e2acd369949b873a524a9cc37829f) ) - ROM_LOAD16_BYTE( "33-01.a6", 0x2000, 0x1000, CRC(53fe3c73) SHA1(ad15c74cd8edef9d9716ad0d16f7a95ff2af901f) ) - ROM_LOAD16_BYTE( "33-00.a3", 0x2001, 0x1000, CRC(06b1cc77) SHA1(12e3314e92f800b3c4ebdf55dcd5351230224788) ) - - ROM_REGION(0x700, "proms", 0) - ROM_LOAD("23-0010-00.a15", 0x000, 0x020, CRC(20eb1183) SHA1(9b268792b28d858d6b6a1b6c4148af88a8d6b735) ) - ROM_LOAD("23-0011-00.a14", 0x100, 0x200, CRC(12d9a6be) SHA1(fca99f9c5afc630ac67cbd4e5ba4e5242b826848) ) - ROM_LOAD("23-0012-00.a16", 0x300, 0x020, CRC(ee1e5a14) SHA1(0d3346cb3b647fa2475bd7b4fa36ea6ecfdaf805) ) - ROM_LOAD("23-0034-00.e4", 0x400, 0x100, CRC(1a573887) SHA1(459bd2d8dc8c4b1c0a529984ae8e38d0c81a084c) ) - ROM_LOAD("23-0037-00.e7", 0x500, 0x100, CRC(9ed4b7f6) SHA1(136a74567094d8462c3a4de1b7e6eb8f30fe71ca) ) - ROM_LOAD("23-0038-00.f1", 0x600, 0x100, CRC(3e56cce5) SHA1(f30a8d5d744bfc25493cd1e92961bbb75f9e0d05) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, ft68m, 0, 0, ft68m, ft68m, driver_device, 0, "Forward Technology", "FT-68M", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/galaxy.c b/src/mess/drivers/galaxy.c deleted file mode 100644 index a8be2d524e0..00000000000 --- a/src/mess/drivers/galaxy.c +++ /dev/null @@ -1,274 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha, Miodrag Milanovic -/*************************************************************************** -Galaksija driver by Krzysztof Strzecha and Miodrag Milanovic - -22/05/2008 Tape support added (Miodrag Milanovic) -21/05/2008 Galaksija plus initial support (Miodrag Milanovic) -20/05/2008 Added real video implementation (Miodrag Milanovic) -18/04/2005 Possibilty to disable ROM 2. 2k, 22k, 38k and 54k memory - configurations added. -13/03/2005 Memory mapping improved. Palette corrected. Supprort for newer - version of snapshots added. Lot of cleanups. Keyboard mapping - corrected. -19/09/2002 malloc() replaced by image_malloc(). -15/09/2002 Snapshot loading fixed. Code cleanup. -31/01/2001 Snapshot loading corrected. -09/01/2001 Fast mode implemented (many thanks to Kevin Thacker). -07/01/2001 Keyboard corrected (still some keys unknown). - Horizontal screen positioning in video subsystem added. -05/01/2001 Keyboard implemented (some keys unknown). -03/01/2001 Snapshot loading added. -01/01/2001 Preliminary driver. - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/wave.h" -#include "includes/galaxy.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/ay8910.h" -#include "formats/gtp_cas.h" -#include "machine/ram.h" - -static ADDRESS_MAP_START (galaxyp_io, AS_IO, 8, galaxy_state ) - ADDRESS_MAP_GLOBAL_MASK(0x01) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xbe, 0xbe) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0xbf, 0xbf) AM_DEVWRITE("ay8910", ay8910_device, data_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START (galaxy_mem, AS_PROGRAM, 8, galaxy_state ) - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ(galaxy_keyboard_r ) - AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE(galaxy_latch_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START (galaxyp_mem, AS_PROGRAM, 8, galaxy_state ) - AM_RANGE(0x0000, 0x0fff) AM_ROM // ROM A - AM_RANGE(0x1000, 0x1fff) AM_ROM // ROM B - AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ(galaxy_keyboard_r ) - AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE(galaxy_latch_w ) - AM_RANGE(0xe000, 0xefff) AM_ROM // ROM C - AM_RANGE(0xf000, 0xffff) AM_ROM // ROM D -ADDRESS_MAP_END - -/* 2008-05 FP: -Small note about natural keyboard support. Currently: -- "List" is mapped to 'ESC' -- "Break" is mapped to 'F1' -- "Repeat" is mapped to 'F2' */ - -static INPUT_PORTS_START (galaxy_common) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('-') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_PAUSE) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("List") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( galaxy ) - PORT_INCLUDE( galaxy_common ) - PORT_START("ROM2") - PORT_CONFNAME(0x01, 0x01, "ROM 2") - PORT_CONFSETTING(0x01, "Installed") - PORT_CONFSETTING(0x00, "Not installed") -INPUT_PORTS_END - -static INPUT_PORTS_START( galaxyp ) - PORT_INCLUDE( galaxy_common ) -INPUT_PORTS_END - -#define XTAL 6144000 - -/* F4 Character Displayer */ -static const gfx_layout galaxy_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8, 8*128*8, 9*128*8, 10*128*8, 11*128*8, 12*128*8, 13*128*8, 14*128*8, 15*128*8 }, - 8 /* every char takes 1 x 16 bytes */ -}; - -static GFXDECODE_START( galaxy ) - GFXDECODE_ENTRY( "gfx1", 0x0000, galaxy_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( galaxy, galaxy_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL / 2) - MCFG_CPU_PROGRAM_MAP(galaxy_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", galaxy_state, galaxy_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(galaxy_state,galaxy_irq_callback) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_PALETTE("palette") - - MCFG_MACHINE_RESET_OVERRIDE(galaxy_state, galaxy ) - - /* video hardware */ - MCFG_SCREEN_SIZE(384, 212) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 208-1) - MCFG_SCREEN_UPDATE_DRIVER(galaxy_state, screen_update_galaxy) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", galaxy) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - /* snapshot */ - MCFG_SNAPSHOT_ADD("snapshot", galaxy_state, galaxy, "gal", 0) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(gtp_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("galaxy_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","galaxy") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("6K") - MCFG_RAM_EXTRA_OPTIONS("2K,22K,38K,54K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( galaxyp, galaxy_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL / 2) - MCFG_CPU_PROGRAM_MAP(galaxyp_mem) - MCFG_CPU_IO_MAP(galaxyp_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", galaxy_state, galaxy_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(galaxy_state,galaxy_irq_callback) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_PALETTE("palette") - - MCFG_MACHINE_RESET_OVERRIDE(galaxy_state, galaxyp ) - - /* video hardware */ - MCFG_SCREEN_SIZE(384, 208) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 208-1) - MCFG_SCREEN_UPDATE_DRIVER(galaxy_state, screen_update_galaxy) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - /* snapshot */ - MCFG_SNAPSHOT_ADD("snapshot", galaxy_state, galaxy, "gal", 0) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8910", AY8910, XTAL/4) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(gtp_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("galaxy_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","galaxy") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("38K") -MACHINE_CONFIG_END - -ROM_START (galaxy) - ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(365f3e24) SHA1(ffc6bf2ec09eabdad76604a63f5dd697c30c4358)) - ROM_LOAD_OPTIONAL ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88)) -ROM_END - -ROM_START (galaxyp) - ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(365f3e24) SHA1(ffc6bf2ec09eabdad76604a63f5dd697c30c4358)) - ROM_LOAD ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1)) - ROM_LOAD ("galplus.bin", 0xe000, 0x1000, CRC(d4cfab14) SHA1(b507b9026844eeb757547679907394aa42055eee)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP(1983, galaxy, 0, 0, galaxy, galaxy, galaxy_state, galaxy, "Elektronika inzenjering", "Galaksija", 0) -COMP(1985, galaxyp, galaxy, 0, galaxyp,galaxyp, galaxy_state,galaxyp,"Elektronika inzenjering", "Galaksija plus", 0) diff --git a/src/mess/drivers/galeb.c b/src/mess/drivers/galeb.c deleted file mode 100644 index 64d24d912e0..00000000000 --- a/src/mess/drivers/galeb.c +++ /dev/null @@ -1,171 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Galeb driver by Miodrag Milanovic - - 01/03/2008 Updated to work with latest SVN code - 23/02/2008 Sound support added. - 22/02/2008 Preliminary driver. - - Driver is based on work of Josip Perusanec - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "sound/dac.h" -#include "includes/galeb.h" - -static GFXDECODE_START( galeb ) - GFXDECODE_ENTRY( "gfx1", 0x0000, galeb_charlayout, 0, 1 ) -GFXDECODE_END - -READ8_MEMBER(galeb_state::galeb_keyboard_r) -{ - static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; - - return ioport(keynames[offset])->read(); -} - -/* Address maps */ -static ADDRESS_MAP_START(galeb_mem, AS_PROGRAM, 8, galeb_state ) - AM_RANGE( 0x0000, 0x1fff ) AM_RAM // RAM - AM_RANGE( 0xbfe0, 0xbfe7 ) AM_READ(galeb_keyboard_r ) - AM_RANGE( 0xbfe0, 0xbfe0 ) AM_DEVWRITE("dac", dac_device, write_unsigned8) - AM_RANGE( 0xb000, 0xb3ff ) AM_RAM AM_SHARE("video_ram") // video ram - AM_RANGE( 0xc000, 0xc7ff ) AM_ROM // BASIC 01 ROM - AM_RANGE( 0xc800, 0xcfff ) AM_ROM // BASIC 02 ROM - AM_RANGE( 0xd000, 0xd7ff ) AM_ROM // BASIC 03 ROM - AM_RANGE( 0xd800, 0xdfff ) AM_ROM // BASIC 04 ROM - AM_RANGE( 0xf000, 0xf7ff ) AM_ROM // Monitor ROM - AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( galeb ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GR") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down - Up") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dj") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left - Right") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sh") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cj") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Zh") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ch") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/* Machine driver */ -static MACHINE_CONFIG_START( galeb, galeb_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 1000000) - MCFG_CPU_PROGRAM_MAP(galeb_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(48*8, 16*8) - MCFG_SCREEN_VISIBLE_AREA(0, 48*8-1, 0, 16*8-1) - MCFG_SCREEN_UPDATE_DRIVER(galeb_state, screen_update_galeb) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", galeb ) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 8.00) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( galeb ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bas01.rom", 0xc000, 0x0800, CRC(9b19ed58) SHA1(ebfc27af8dbabfb233f9888e6a0a0dfc87ae1691) ) - ROM_LOAD( "bas02.rom", 0xc800, 0x0800, CRC(3f320a84) SHA1(4ea082b4269dca6152426b1f720c7508122d3cb7) ) - ROM_LOAD( "bas03.rom", 0xd000, 0x0800, CRC(f122ad10) SHA1(3c7c1dd67268230d179a00b0f8b35be80c2b7035) ) - ROM_LOAD( "bas04.rom", 0xd800, 0x0800, CRC(b5372a83) SHA1(f93b73d98b943c6791f46617418fb5e4238d75bd) ) - ROM_LOAD( "exmd.rom", 0xf000, 0x0800, CRC(1bcb1375) SHA1(fda3361d238720a3d309644093da9832d5aff661) ) - ROM_LOAD( "makbug.rom",0xf800, 0x0800, CRC(91e38e79) SHA1(2b6439a09a470cda9c81b9d453c6380b99716989) ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("chrgen.bin", 0x0000, 0x0800, CRC(409a800e) SHA1(0efe429dd6c0568032636e691d9865a623afeb55)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, galeb, 0, 0, galeb, galeb, driver_device, 0, "PEL Varazdin", "Galeb", 0) diff --git a/src/mess/drivers/gamate.c b/src/mess/drivers/gamate.c deleted file mode 100644 index ad1e129e60c..00000000000 --- a/src/mess/drivers/gamate.c +++ /dev/null @@ -1,408 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - PeT mess@utanet.at 2007, 2014 - Peter Wilhelmsen peter.wilhelmsen@gmail.com - Morten Shearman Kirkegaard morten+gamate@afdelingp.dk - Juan F??lix Mateos vectrex@hackermesh.org - - nmi unknown - bomb blast top status line missing - ******************************************************************************/ - -#include "emu.h" -#include "includes/gamate.h" -#include "ui/ui.h" - -class gamate_state : public driver_device -{ -public: - gamate_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_sound(*this, "custom") - , m_cart(*this, "cartslot") - , m_io_joy(*this, "JOY") - , m_palette(*this, "palette") - , m_bios(*this, "bios") - , m_bank(*this, "bank") - , m_bankmulti(*this, "bankmulti") - { } - - DECLARE_PALETTE_INIT(gamate); - DECLARE_READ8_MEMBER(protection_r); - DECLARE_READ8_MEMBER(newer_protection_set); - DECLARE_WRITE8_MEMBER(protection_reset); - DECLARE_READ8_MEMBER(gamate_cart_protection_r); - DECLARE_WRITE8_MEMBER(gamate_cart_protection_w); - DECLARE_WRITE8_MEMBER(cart_bankswitchmulti_w); - DECLARE_WRITE8_MEMBER(cart_bankswitch_w); - DECLARE_READ8_MEMBER(gamate_video_r); - DECLARE_READ8_MEMBER(gamate_nmi_r); - DECLARE_WRITE8_MEMBER(gamate_video_w); - DECLARE_WRITE8_MEMBER(gamate_bios_w); - DECLARE_DRIVER_INIT(gamate); - UINT32 screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(gamate_interrupt); - TIMER_CALLBACK_MEMBER(gamate_timer); - TIMER_CALLBACK_MEMBER(gamate_timer2); - -private: - virtual void machine_start(); - - struct - { - UINT8 reg[8]; - struct - { - bool page2; // else page1 - UINT8 ypos, xpos/*tennis*/; - UINT8 data[2][0x100][0x20]; - } bitmap; - UINT8 x, y; - bool y_increment; - } video; - - struct - { - bool set; - int bit_shifter; - UINT8 cartridge_byte; - UINT16 address; // in reality something more like short local cartridge address offset - bool unprotected; - bool failed; - } card_protection; - - required_device m_maincpu; - required_device m_sound; - required_device m_cart; - required_ioport m_io_joy; - required_device m_palette; - required_shared_ptr m_bios; - required_memory_bank m_bank; - required_memory_bank m_bankmulti; - emu_timer *timer1; - emu_timer *timer2; - UINT8 bank_multi; - UINT8 *m_cart_ptr; -}; - -WRITE8_MEMBER( gamate_state::gamate_cart_protection_w ) -{ - logerror("%.6f protection write %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, data, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter); - - switch (offset) - { - case 0: - card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0); - card_protection.bit_shifter++; - if (card_protection.bit_shifter>=8) - { - card_protection.cartridge_byte=m_cart_ptr[card_protection.address++]; - card_protection.bit_shifter=0; - } - break; - } -} - -READ8_MEMBER( gamate_state::gamate_cart_protection_r ) -{ - UINT8 ret=1; - if (card_protection.bit_shifter==7 && card_protection.unprotected) - { - ret=m_cart_ptr[bank_multi*0x4000]; - } - else - { - card_protection.bit_shifter++; - if (card_protection.bit_shifter==8) - { - card_protection.bit_shifter=0; - card_protection.cartridge_byte='G'; - card_protection.unprotected=true; - } - ret=(card_protection.cartridge_byte&0x80) ? 2 : 0; - if (card_protection.bit_shifter==7 && !card_protection.failed) - { // now protection chip on cartridge activates cartridge chip select on cpu accesses -// m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); // next time I will try to get this working - } - card_protection.cartridge_byte<<=1; - } - logerror("%.6f protection read %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, ret, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter); - return ret; -} - -READ8_MEMBER( gamate_state::protection_r ) -{ - return card_protection.set? 3: 1; -} // bits 0 and 1 checked - -WRITE8_MEMBER( gamate_state::protection_reset ) -{ -// writes 0x20 - card_protection.address=0x6005-0x6001; - card_protection.bit_shifter=0; - card_protection.cartridge_byte=m_cart_ptr[card_protection.address++]; //m_cart_rom[card_protection.address++]; - card_protection.failed=false; - card_protection.unprotected=false; -} - -READ8_MEMBER( gamate_state::newer_protection_set ) -{ - card_protection.set=true; - return 0; -} - -WRITE8_MEMBER( gamate_state::gamate_video_w ) -{ - video.reg[offset]=data; - switch (offset) - { - case 1: - if (data&0xf) - printf("lcd mode %x\n", data); - video.y_increment=data&0x40; - break; - case 2: - video.bitmap.xpos=data; - break; - case 3: - if (data>=200) - printf("lcd ypos: %x\n", data); - video.bitmap.ypos=data; - break; - case 4: - video.bitmap.page2=data&0x80; - video.x=data&0x1f; - break; - case 5: - video.y=data; - break; - case 7: - video.bitmap.data[video.bitmap.page2][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data; - if (video.y_increment) - video.y++; - else - video.x++; // overruns - } -} - -WRITE8_MEMBER( gamate_state::cart_bankswitchmulti_w ) -{ - bank_multi=data; - m_bankmulti->set_base(m_cart_ptr+0x4000*data+1); -} - -WRITE8_MEMBER( gamate_state::cart_bankswitch_w ) -{ - m_bank->set_base(m_cart_ptr+0x4000*data); -} - -READ8_MEMBER( gamate_state::gamate_video_r ) -{ - if (offset!=6) - return 0; - UINT8 data = video.bitmap.data[video.bitmap.page2][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]; -// if (m_maincpu->pc()<0xf000) -// machine().ui().popup_time(2, "lcd read x:%x y:%x mode:%x data:%x\n", video.x, video.y, video.reg[1], data); - if (video.y_increment) - video.y++; - else - video.x++; // overruns? - - return data; -} - -READ8_MEMBER( gamate_state::gamate_nmi_r ) -{ - UINT8 data=0; - machine().ui().popup_time(2, "nmi/4800 read\n"); - return data; -} - -static ADDRESS_MAP_START( gamate_mem, AS_PROGRAM, 8, gamate_state ) - AM_RANGE(0x0000, 0x03ff) AM_RAM - AM_RANGE(0x4000, 0x400d) AM_DEVREADWRITE("custom", gamate_sound_device, device_r, device_w) - AM_RANGE(0x4400, 0x4400) AM_READ_PORT("JOY") - AM_RANGE(0x4800, 0x4800) AM_READ(gamate_nmi_r) - AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w) - AM_RANGE(0x5800, 0x5800) AM_READ(newer_protection_set) - AM_RANGE(0x5900, 0x5900) AM_WRITE(protection_reset) - AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r) - AM_RANGE(0x6001, 0x9fff) AM_READ_BANK("bankmulti") - AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank") - AM_RANGE(0x6000, 0x6000) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w) - AM_RANGE(0x8000, 0x8000) AM_WRITE(cart_bankswitchmulti_w) - AM_RANGE(0xc000, 0xc000) AM_WRITE(cart_bankswitch_w) - AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios") -ADDRESS_MAP_END - - -static INPUT_PORTS_START( gamate ) - PORT_START("JOY") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("A") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("B") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") -INPUT_PORTS_END - -/* palette in red, green, blue tribles */ -static const unsigned char gamate_colors[4][3] = -{ - { 255,255,255 }, - { 0xa0, 0xa0, 0xa0 }, - { 0x60, 0x60, 0x60 }, - { 0, 0, 0 } -}; - -PALETTE_INIT_MEMBER(gamate_state, gamate) -{ - int i; - - for (i = 0; i < 4; i++) - { - palette.set_pen_color(i, gamate_colors[i][0], gamate_colors[i][1], gamate_colors[i][2]); - } -} - -static void BlitPlane(UINT16* line, UINT8 plane1, UINT8 plane2) -{ - line[3]=(plane1&1)|((plane2<<1)&2); - line[2]=((plane1>>1)&1)|((plane2<<0)&2); - line[1]=((plane1>>2)&1)|((plane2>>1)&2); - line[0]=((plane1>>3)&1)|((plane2>>2)&2); -} - -UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, j; - for (y=0;y<152;y++) - { - for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) - { - UINT8 d1, d2; - if (video.bitmap.ypos<200) - { - d1=video.bitmap.data[0][(y+video.bitmap.ypos)%200][(j+video.bitmap.xpos/8)&0x1f]; - d2=video.bitmap.data[1][(y+video.bitmap.ypos)%200][(j+video.bitmap.xpos/8)&0x1f]; - } - else - if ((video.bitmap.ypos&0xf)<8) - { // lcdtest, of course still some registers not known, my gamate doesn't display bottom lines; most likely problematic 200 warp around hardware! no real usage - int yi=(y+(video.bitmap.ypos&0xf)-8); - if (yi<0) - yi=video.bitmap.ypos+y; // in this case only 2nd plane used!?, source of first plane? - d1=video.bitmap.data[0][yi][(j+video.bitmap.xpos/8)&0x1f]; // value of lines bevor 0 chaos - d2=video.bitmap.data[1][yi][(j+video.bitmap.xpos/8)&0x1f]; - } - else - { - d1=video.bitmap.data[0][y][(j+video.bitmap.xpos/8)&0x1f]; - d2=video.bitmap.data[1][y][(j+video.bitmap.xpos/8)&0x1f]; - } - BlitPlane(&bitmap.pix16(y, x+4), d1, d2); - BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4); - } - } - return 0; -} - -DRIVER_INIT_MEMBER(gamate_state,gamate) -{ - memset(&video, 0, sizeof(video));/* memset(m_ram, 0, sizeof(m_ram));*/ - timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer),this)); - timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer2),this)); -} - - -void gamate_state::machine_start() -{ - m_cart_ptr = memregion("maincpu")->base() + 0x6000; - if (m_cart->exists()) - { -// m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); - m_cart_ptr = m_cart->get_rom_base(); - m_bankmulti->set_base(m_cart->get_rom_base()+1); - m_bank->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset - } -// m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback - card_protection.set=false; - bank_multi=0; - card_protection.unprotected=false; - timer2->enable(TRUE); - timer2->reset(m_maincpu->cycles_to_attotime(1000)); -#if 0 - save_item(NAME(m_video.data)); - save_item(NAME(m_video.index)); - save_item(NAME(m_video.x)); - save_item(NAME(m_video.y)); - save_item(NAME(m_video.mode)); - save_item(NAME(m_video.delayed)); - save_item(NAME(m_video.pixels)); - save_item(NAME(m_ports)); - save_item(NAME(m_ram)); -#endif -} - -TIMER_CALLBACK_MEMBER(gamate_state::gamate_timer) -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); - timer1->enable(FALSE); -} - -TIMER_CALLBACK_MEMBER(gamate_state::gamate_timer2) -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - timer1->enable(TRUE); - timer1->reset(m_maincpu->cycles_to_attotime(10/* cycles short enought to clear irq line early enough*/)); - timer2->enable(TRUE); - timer2->reset(m_maincpu->cycles_to_attotime(32768/2)); -} - - -INTERRUPT_GEN_MEMBER(gamate_state::gamate_interrupt) -{ -} - -static MACHINE_CONFIG_START( gamate, gamate_state ) - MCFG_CPU_ADD("maincpu", M6502, 4433000/2) - MCFG_CPU_PROGRAM_MAP(gamate_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", gamate_state, gamate_interrupt) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(160, 152) - MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 152-1) - MCFG_SCREEN_UPDATE_DRIVER(gamate_state, screen_update_gamate) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors)) - MCFG_PALETTE_INIT_OWNER(gamate_state, gamate) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", GAMATE_SND, 4433000/2) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "gamate_cart") - MCFG_SOFTWARE_LIST_ADD("cart_list","gamate") -MACHINE_CONFIG_END - - -ROM_START(gamate) - ROM_REGION(0x10000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "default", "DEFAULT") - ROMX_LOAD("gamate_bios_umc.bin", 0xf000, 0x1000, CRC(07090415) SHA1(ea449dc607601f9a68d855ad6ab53800d2e99297), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "newer", "NEWER") - ROMX_LOAD("gamate_bios_9130__unknown__bit_icasc00001_9130-bs_r32261.bin", 0xf000, 0x1000, CRC(03a5f3a7) SHA1(4e9dfbfe916ca485530ef4221593ab68738e2217), ROM_BIOS(2) ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -CONS( 19??, gamate, 0, 0, gamate, gamate, gamate_state, gamate, "Bit Corp", "Gamate", 0) diff --git a/src/mess/drivers/gamecom.c b/src/mess/drivers/gamecom.c deleted file mode 100644 index 8b843aa55c8..00000000000 --- a/src/mess/drivers/gamecom.c +++ /dev/null @@ -1,299 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Robbbert -/*************************************************************************** - -Driver file to handle emulation of the Tiger Game.com by - Wilbert Pol - -Todo: -- Fix cpu and system problems that prevent the games from working. - -Game Status: -- The DAC sound partially works, sound from ports 1,2,3 not done -- Inbuilt ROM and PDA functions all work -- On the screen where the cart goes into the slot there is video flicker -- Due to an irritating message, the NVRAM is commented out in the machine config -- Most of the cart games have severe video issues such as flickering and nonsense gfx -- Lights Out works -- Centipede works -- Wheel of Fortune 1 & 2 are working. -- Frogger works, but it is difficult to capture the female frog or the insect. -- Quiz Wiz works, but the end-of-round score doesn't show -- Jeopardy, playable with bad gfx -- Tiger Web Link & Internet, they look ok, obviously aren't going to connect to anything -- Williams Arcade Classics, Robotron works, the rest are no use. -- Monopoly is starting to show promise. It's playable but the video is terrible. -- The remaining carts are not functional to any useful degree. - -***************************************************************************/ - -#include "includes/gamecom.h" -#include "gamecom.lh" - -static ADDRESS_MAP_START(gamecom_mem_map, AS_PROGRAM, 8, gamecom_state) - AM_RANGE( 0x0000, 0x0013 ) AM_RAM AM_REGION("maincpu", 0x00) - AM_RANGE( 0x0014, 0x0017 ) AM_READWRITE( gamecom_pio_r, gamecom_pio_w ) // buttons - AM_RANGE( 0x0018, 0x001F ) AM_RAM AM_REGION("maincpu", 0x18) - AM_RANGE( 0x0020, 0x007F ) AM_READWRITE( gamecom_internal_r, gamecom_internal_w )/* CPU internal register file */ - AM_RANGE( 0x0080, 0x03FF ) AM_RAM AM_REGION("maincpu", 0x80) /* RAM */ - AM_RANGE( 0x0400, 0x0FFF ) AM_NOP /* Nothing */ - AM_RANGE( 0x1000, 0x1FFF ) AM_ROM /* Internal ROM (initially), or External ROM/Flash. Controlled by MMU0 (never swapped out in game.com) */ - AM_RANGE( 0x2000, 0x3FFF ) AM_ROMBANK("bank1") /* External ROM/Flash. Controlled by MMU1 */ - AM_RANGE( 0x4000, 0x5FFF ) AM_ROMBANK("bank2") /* External ROM/Flash. Controlled by MMU2 */ - AM_RANGE( 0x6000, 0x7FFF ) AM_ROMBANK("bank3") /* External ROM/Flash. Controlled by MMU3 */ - AM_RANGE( 0x8000, 0x9FFF ) AM_ROMBANK("bank4") /* External ROM/Flash. Controlled by MMU4 */ - AM_RANGE( 0xA000, 0xDFFF ) AM_RAM AM_SHARE("videoram") /* VRAM */ - AM_RANGE( 0xE000, 0xFFFF ) AM_RAM AM_SHARE("nvram") /* Extended I/O, Extended RAM */ -ADDRESS_MAP_END - -static INPUT_PORTS_START( gamecom ) - PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME( "Up" ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME( "Down" ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME( "Left" ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME( "Right" ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Menu" ) PORT_CODE( KEYCODE_M ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( DEF_STR(Pause) ) PORT_CODE( KEYCODE_V ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Sound" ) PORT_CODE( KEYCODE_S ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Button A" ) PORT_CODE( KEYCODE_A ) PORT_CODE( KEYCODE_LCONTROL ) - - PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Button B" ) PORT_CODE( KEYCODE_B ) PORT_CODE( KEYCODE_LALT ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME( "Button C" ) PORT_CODE( KEYCODE_C ) PORT_CODE( KEYCODE_SPACE ) - - PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Reset" ) PORT_CODE( KEYCODE_N ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME( "Button D" ) PORT_CODE( KEYCODE_D ) PORT_CODE( KEYCODE_LSHIFT ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Stylus press" ) PORT_CODE( KEYCODE_Z ) PORT_CODE( MOUSECODE_BUTTON1 ) - - PORT_START("GRID.0") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.1") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.2") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.3") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.4") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.5") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.6") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.7") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.8") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.9") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.10") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.11") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - - PORT_START("GRID.12") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_OTHER) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER) - INPUT_PORTS_END - -PALETTE_INIT_MEMBER(gamecom_state, gamecom) -{ - palette.set_pen_color(0, 0x00, 0x00, 0x00 ); // Black - palette.set_pen_color(1, 0x0F, 0x4F, 0x2F ); // Gray 1 - palette.set_pen_color(2, 0x6F, 0x8F, 0x4F ); // Gray 2 - palette.set_pen_color(3, 0x8F, 0xCF, 0x8F ); // Grey 3 - palette.set_pen_color(4, 0xDF, 0xFF, 0x8F ); // White -} - -UINT32 gamecom_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - -INTERRUPT_GEN_MEMBER(gamecom_state::gamecom_interrupt) -{ - m_maincpu->set_input_line(sm8500_cpu_device::LCDC_INT, ASSERT_LINE ); -} - -static MACHINE_CONFIG_START( gamecom, gamecom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", SM8500, XTAL_11_0592MHz/2 ) /* actually it's an sm8521 microcontroller containing an sm8500 cpu */ - MCFG_CPU_PROGRAM_MAP( gamecom_mem_map) - MCFG_SM8500_DMA_CB( WRITE8( gamecom_state, gamecom_handle_dma ) ) - MCFG_SM8500_TIMER_CB( WRITE8( gamecom_state, gamecom_update_timers ) ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", gamecom_state, gamecom_interrupt) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - //MCFG_NVRAM_ADD_0FILL("nvram") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE( 59.732155 ) - MCFG_SCREEN_VBLANK_TIME(500) - MCFG_SCREEN_UPDATE_DRIVER(gamecom_state, screen_update) - MCFG_SCREEN_SIZE( 208, 160 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 207, 0, 159 ) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_gamecom) - MCFG_PALETTE_ADD("palette", 5) - MCFG_PALETTE_INIT_OWNER(gamecom_state, gamecom) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO( "lspeaker", "rspeaker" ) - /* TODO: much more complex than this */ - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.00) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.00) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_linear_slot, "gamecom_cart") - MCFG_GENERIC_EXTENSIONS("bin,tgc") - MCFG_GENERIC_LOAD(gamecom_state, gamecom_cart1) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_linear_slot, "gamecom_cart") - MCFG_GENERIC_EXTENSIONS("bin,tgc") - MCFG_GENERIC_LOAD(gamecom_state, gamecom_cart2) - - MCFG_SOFTWARE_LIST_ADD("cart_list","gamecom") -MACHINE_CONFIG_END - -ROM_START( gamecom ) - ROM_REGION( 0x2000, "maincpu", 0 ) - ROM_LOAD( "internal.bin", 0x1000, 0x1000, CRC(a0cec361) SHA1(03368237e8fed4a8724f3b4a1596cf4b17c96d33) ) - - ROM_REGION( 0x40000, "kernel", 0 ) - ROM_LOAD( "external.bin", 0x00000, 0x40000, CRC(e235a589) SHA1(97f782e72d738f4d7b861363266bf46b438d9b50) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -CONS( 1997, gamecom, 0, 0, gamecom, gamecom, gamecom_state, gamecom, "Tiger", "Game.com", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/gameking.c b/src/mess/drivers/gameking.c deleted file mode 100644 index a05b407f3f1..00000000000 --- a/src/mess/drivers/gameking.c +++ /dev/null @@ -1,195 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/* TimeTop - GameKing */ - -// these are meant to have a 3-in-1 internal ROM, not dumped - -/* -The carridge dumps have something what looks like vectors/pointers to interesting pieces -of code at offsets like $004c, $0050, $0054, $0060, $0064, $0068, and $0070 (some carts). - -At offset $004c there is usually $00 $40, $00, $01; this seems to point to bank #1/offset $4000, -which should get banked in at address $4000. There is valid at offset $4000 in the cartridge -dumps. - -There seem to be some RAM that starts at $1000 in the memomry map. - -A routine at $0f80 seems to be called a lot. It's probably some kind of entry into the -bios to perform several functions. The function to perform seems to be passed through -the A register with pointer to parameters stored at $0080-$0081 (multiple parameters/ -blocks?). - -The reset and irq vectors seem to be the same in most, if not all, cartridge dumps. It -is very likely that they point to code in the internal bios. - -*/ - -#include "emu.h" -#include "cpu/m6502/m65ce02.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class gameking_state : public driver_device -{ -public: - gameking_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_palette(*this, "palette") - { } - - - DECLARE_DRIVER_INIT(gameking); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(gameking); - - UINT32 screen_update_gameking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(gameking_cart); - -protected: - required_device m_maincpu; - required_device m_cart; - required_device m_palette; - - memory_region *m_cart_rom; - memory_bank *m_bank4000; - memory_bank *m_bank8000; - memory_bank *m_bankc000; -}; - -static ADDRESS_MAP_START( gameking_mem , AS_PROGRAM, 8, gameking_state ) - AM_RANGE(0x0000, 0x01ff) AM_RAM - - AM_RANGE(0x0f00, 0x0fff) AM_ROM - - AM_RANGE(0x1000, 0x1fff) AM_RAM // sthero writes to $19xx - - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank4000") - AM_RANGE(0x8000, 0xcfff) AM_ROMBANK("bank8000") - AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bankc000") -ADDRESS_MAP_END - - -static INPUT_PORTS_START( gameking ) -INPUT_PORTS_END - -static const unsigned char gameking_palette[] = -{ - 0, 0, 0, - 63, 63, 63, - 127, 127, 127, - 255, 255, 255 -}; - -PALETTE_INIT_MEMBER(gameking_state, gameking) -{ - for (int i = 0; i < sizeof(gameking_palette) / 3; i++) - palette.set_pen_color(i, gameking_palette[i*3], gameking_palette[i*3+1], gameking_palette[i*3+2]); -} - - -UINT32 gameking_state::screen_update_gameking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - -DRIVER_INIT_MEMBER(gameking_state, gameking) -{ -} - - -DEVICE_IMAGE_LOAD_MEMBER( gameking_state, gameking_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size > 0x80000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -void gameking_state::machine_start() -{ - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - if (!m_cart_rom) - { - printf("No Rom\n"); - return; - } - - m_bank4000 = membank("bank4000"); - m_bank8000 = membank("bank8000"); - m_bankc000 = membank("bankc000"); - - // Minor hacking to get things going (should be removed when we have bios dump) - m_cart_rom->base()[0x3ffc] = 0x00; - m_cart_rom->base()[0x3ffd] = 0x40; - - // Some fake code to get bios function calls logged - memory_region *maincpu_rom = memregion("maincpu"); - maincpu_rom->base()[0x0f80] = 0x9d; // STA $0e00,X - maincpu_rom->base()[0x0f81] = 0x00; - maincpu_rom->base()[0x0f82] = 0x0e; - maincpu_rom->base()[0x0f83] = 0x60; // RTS - - m_bank8000->set_base(m_cart_rom->base()); - m_bankc000->set_base(m_cart_rom->base()); - m_bank4000->set_base(m_cart_rom->base() + 0x4000); -} - -void gameking_state::machine_reset() -{ -} - - - -static MACHINE_CONFIG_START( gameking, gameking_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M65CE02, 6000000) - MCFG_CPU_PROGRAM_MAP(gameking_mem) - //MCFG_CPU_VBLANK_INT_DRIVER("screen", gameking_state, gameking_frame_int) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(48, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 48-1, 0, 32-1) - MCFG_SCREEN_UPDATE_DRIVER(gameking_state, screen_update_gameking) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gameking_palette) * 3) - MCFG_PALETTE_INIT_OWNER(gameking_state, gameking ) - - - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "gameking_cart") - MCFG_GENERIC_EXTENSIONS("bin") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(gameking_state, gameking_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "gameking") - MCFG_SOFTWARE_LIST_ADD("cart_list_3", "gameking3") // maybe not compatible with this system (different internal bios?) -MACHINE_CONFIG_END - -ROM_START(gameking) - ROM_REGION(0x8000, "maincpu", ROMREGION_ERASE00) -ROM_END - - - -CONS(2003, gameking, 0, 0, gameking, gameking, gameking_state, gameking, "TimeTop", "GameKing GM-218", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -// the GameKing 2 (GM-219) is probably identical HW diff --git a/src/mess/drivers/gamepock.c b/src/mess/drivers/gamepock.c deleted file mode 100644 index dbf76dc1bf5..00000000000 --- a/src/mess/drivers/gamepock.c +++ /dev/null @@ -1,83 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol - - -#include "emu.h" -#include "cpu/upd7810/upd7810.h" -#include "sound/speaker.h" -#include "bus/generic/carts.h" -#include "includes/gamepock.h" -#include "rendlay.h" - - -static ADDRESS_MAP_START(gamepock_mem, AS_PROGRAM, 8, gamepock_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000,0x0fff) AM_ROM - AM_RANGE(0x1000,0x3fff) AM_NOP - //AM_RANGE(0x4000,0xbfff) AM_ROM // mapped by the cartslot - AM_RANGE(0xc000,0xc7ff) AM_MIRROR(0x0800) AM_RAM - AM_RANGE(0xff80,0xffff) AM_RAM /* 128 bytes microcontroller RAM */ -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(gamepock_io, AS_IO, 8, gamepock_state ) - AM_RANGE( 0x00, 0x00 ) AM_WRITE( port_a_w ) - AM_RANGE( 0x01, 0x01 ) AM_READWRITE( port_b_r, port_b_w ) - AM_RANGE( 0x02, 0x02 ) AM_READ( port_c_r ) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( gamepock ) - PORT_START("IN0") - PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) - PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) - - PORT_START("IN1") - PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_START ) - PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( gamepock, gamepock_state ) - MCFG_CPU_ADD("maincpu", UPD78C06, XTAL_6MHz) /* uPD78C06AG */ - MCFG_CPU_PROGRAM_MAP( gamepock_mem) - MCFG_CPU_IO_MAP( gamepock_io) - MCFG_UPD7810_TO(WRITELINE(gamepock_state,gamepock_to_w)) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE( 60 ) - MCFG_SCREEN_SIZE( 75, 64 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 74, 0, 63 ) - MCFG_SCREEN_UPDATE_DRIVER(gamepock_state, screen_update_gamepock) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "gamepock_cart") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","gamepock") -MACHINE_CONFIG_END - - -ROM_START( gamepock ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "egpcboot.bin", 0x0000, 0x1000, CRC(ee1ea65d) SHA1(9c7731b5ead721d2cc7f7e2655c5fed9e56db8b0) ) -ROM_END - - -CONS( 1984, gamepock, 0, 0, gamepock, gamepock, driver_device, 0, "Epoch", "Game Pocket Computer", 0 ) diff --git a/src/mess/drivers/gb.c b/src/mess/drivers/gb.c deleted file mode 100644 index 85311e19598..00000000000 --- a/src/mess/drivers/gb.c +++ /dev/null @@ -1,984 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Anthony Kruize,Wilbert Pol -/*************************************************************************** - - gb.c - - Driver file to handle emulation of the Nintendo Game Boy. - By: - - Hans de Goede 1998 - Anthony Kruize 2002 - Wilbert Pol 2004 (Megaduck/Cougar Boy) - - TODO list: - - Do correct lcd stat timing - - Add Game Boy Light (Japan, 1997) - does it differ from gbpocket? - - SGB should be moved to SNES driver - - Emulate OAM corruption bug on 16bit inc/dec in $fe** region - - -Timers -====== - -There seems to be some kind of selectable internal clock divider which is used to drive -the timer increments. This causes the first timer cycle to now always be a full cycle. -For instance in 1024 clock cycle mode, the first timer cycle could easily only take 400 -clock cycles. The next timer cycle will take the full 1024 clock cycles though. - -Writes to the DIV register seem to cause this internal clock divider/register to be -reset in such a way that the next stimulus cause a timer increment (in any mode). - - -Interrupts -========== - -Taking an interrupt seems to take around 20 clock cycles. - - -Stat timing -=========== - -This timing table is accurate within 4 cycles: - | stat = 2 | stat = 3 | stat = 0 | -No sprites | 80 | 172 | 204 | -1 sprite | 80 | 182 | 194 | -2 sprites | 80 | 192 | 184 | -3 sprites | 80 | 202 | 174 | -4 sprites | 80 | 212 | 164 | -5 sprites | 80 | 222 | 154 | -6 sprites | 80 | 232 | 144 | -7 sprites | 80 | 242 | 134 | -8 sprites | 80 | 252 | 124 | -9 sprites | 80 | 262 | 114 | -10 sprites | 80 | 272 | 104 | - -In other words, each sprite on a line makes stat 3 last 10 cycles longer. - - -For lines 1 - 143 when stat changes to 2 the line counter is incremented. - -Line 153 is little odd timing wise. The line counter stays 153 for ~4 clock cycles -and is then rolls over to 0. - -When the line counter is changed it gets checked against the lyc register. - -Here is a detailed run of the STAT and LY register together with LYC set to 3 on a -dmg and mgb. The time between each sample is 4 clock cycles: -STAT: -22222222 22233333 33333333 33333333 33333333 33333333 33333300 00000000 00000000 00000000 -00000000 00000000 00000000 06666666 66666666 66666777 77777777 77777777 77777777 77777777 -77777777 44444444 44444444 44444444 44444444 44444444 44444444 44022222 22222222 - - LY: -33333333 33333333 33333333 33333333 33333333 33333333 33333333 33333333 33333333 33333333 -33333333 33333333 33333333 44444444 44444444 44444444 44444444 44444444 44444444 44444444 -44444444 44444444 44444444 44444444 44444444 44444444 44444444 44555555 55555555 - ^ ^ - -As you can see, it seems as though the LY register is incremented slightly before the STAT -register is changed, resulting in a short period where STAT goes 0 before going to 2. This -bug/feature has been fixed in the CGB and AGB. - - - -Around lines 152-153-0 the picture becomes as follows: -STAT: -11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 -11111111 11111111 11111111 15555555 55555555 55555555 55555555 55555555 55555555 55555555 -55555555 55555555 55555555 55555555 55555555 55555555 55555555 55111111 11111111 11111111 -11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 -11111111 11110222 22222222 22222222 23333333 33333333 33333333 33333333 33333333 - - LY: -77777777 77777777 77777777 77777777 77777777 77777777 77777777 77777777 77777777 77777777 -77777777 77777777 77777777 88888888 88888888 88888888 88888888 88888888 88888888 88888888 -88888888 88888888 88888888 88888888 88888888 88888888 88888888 88900000 00000000 00000000 -00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 -00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 - - - -The full STAT/LY value state machine. -===================================== - -The timing information below is with sprites disabled. - -For STAT we only show the lower 3 bits and for LY only the lower 5 bits of the full -register. Each digit stands for 4 clock cycles (the smallest measurable unit on a -dmg or mgb). When the video hardware is switched on the LY register is set 0 and -the STAT mode is 0. The values for STAT and LY will change as follows: - -STAT 000000000000000000003333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 - LY 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 line #0 - ^LY=LYC bit can get set here LY=LYC bit is reset here^ - -STAT 222222222222222222223333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 - LY 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112 line #1 - - : - : - -STAT 222222222222222222223333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 - LY FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0 line #143 - -STAT 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 - LY 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 line #144 - - : - : - -STAT 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 - LY 888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889 line #152 - -STAT 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110 - LY 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 line #153 - ^ - LY=LYC interrupt for 153 can get triggered here - -STAT 222222222222222222223333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 - LY 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 line #0 - -STAT 222222222222222222223333333333333333333333333333333333333333333000000000000000000000000000000000000000000000000000 - LY 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112 line #1 - - : - etc - - -Mappers used in the Game Boy -=========================== - -MBC1 Mapper -=========== - -The MBC1 mapper has two modes: 2MB ROM/8KB RAM or 512KB ROM/32KB RAM. -This mode is selected by writing into the 6000-7FFF memory area: -0bXXXXXXXB - B=0 - 2MB ROM/8KB RAM mode - B=1 - 512KB ROM/32KB RAM mode -The default behaviour is to be in 2MB ROM/8KB RAM mode. - -Writing a value ( 0bXXXBBBBB ) into the 2000-3FFF memory area selects the -lower 5 bits of the ROM bank to select for the 4000-7FFF memory area. If a -value of 0bXXX00000 is written then this will autmatically be changed to -0bXXX00001 by the mbc chip. - -Writing a value (0bXXXXXXBB ) into the 4000-5FFF memory area either selects -the RAM bank to use or bits 6 and 7 for the ROM bank to use for the 4000-7FFF -memory area. This behaviour depends on the memory moddel chosen. - -The RAM sections are enabled by writing the value 0bXXX1010 into the 0000-1FFF -memory area. Writing any other value disables the RAM section. - -Some unanswered cases: -#1 - Set mode 0 - - Set lower bank bits to 1F - - Set high bank bits to 01 => bank #3F - - Set mode 1 - - What ROM bank is now at 4000-7FFF, bank #1F or bank #3F? - -#2 - Set mode 1 - - Set ram area #1 - - Set mode 0 - - What ram area is now at A000-BFFF, ram bank 00 or ram bank 01? - - -MBC2 Mapper -=========== - -The MBC2 mapper includes 512x4bits of builtin RAM. - -0000-1FFF - Writing to this area enables (value 0bXXXX1010) or disables (any - other value than 0bXXXX1010) the RAM. In order to perform this - function bit 12 of the address must be reset, so usable areas are - 0000-00FF, 0200-02FF, 0400-04FF, 0600-06FF, ..., 1E00-1EFF. -2000-3FFF - Writing to this area selects the rom bank to appear at 4000-7FFF. - Only bits 3-0 are used to select the bank number. If a value of - 0bXXXX0000 is written then this is automatically changed into - 0bXXXX0001 by the mapper. - In order to perform the rom banking bit 12 of the address must be - set, so usable areas are 2100-21FF, 2300-23FF, 2500-25FF, 2700- - 27FF, ..., 3F00-3FFF. - -Some unanswered cases: -#1 - Set rom bank to 8 for a 4 bank rom image. - - What rom bank appears at 4000-7FFF, bank #0 or bank #1 ? - - -MBC3 Mapper -=========== - -The MBC3 mapper cartridges can include a RTC chip. - -0000-1FFF - Writing to this area enables (value 0x0A) or disables (0x00) the - RAM and RTC registers. -2000-3FFF - Writing to this area selects the rom bank to appear at 4000-7FFF. - Bits 6-0 are used to select the bank number. If a value of - 0bX0000000 is written then this is autmatically changed into - 0bX0000001 by the mapper. -4000-5FFF - Writing to this area selects the RAM bank or the RTC register to - read. - XXXX00bb - Select RAM bank bb. - XXXX1rrr - Select RTC register rrr. Accepted values for rrr are: - 000 - Seconds (0x00-0x3B) - 001 - Minutes (0x00-0x3B) - 010 - Hours (0x00-0x17) - 011 - Bits 7-0 of the day counter - 100 - bit 0 - Bit 8 of the day counter - bit 6 - Halt RTC timer ( 0 = timer active, 1 = halted) - bit 7 - Day counter overflow flag -6000-7FFF - Writing 0x00 followed by 0x01 latches the RTC data. This latching - method is used for reading the RTC registers. - -Some unanswered cases: -#1 - Set rom bank to 8(/16/32/64) for a 4(/8/16/32) bank image. - - What rom bank appears at 4000-7FFF, bank #0 or bank #1 ? - - -MBC4 Mapper -=========== - -Stauts: not supported yet. - - -MBC5 Mapper -=========== - -0000-1FFF - Writing to this area enables (0x0A) or disables (0x00) the RAM area. -2000-2FFF - Writing to this area updates bits 7-0 of the rom bank number to - appear at 4000-7FFF. -3000-3FFF - Writing to this area updates bit 8 of the rom bank number to appear - at 4000-7FFF. -4000-5FFF - Writing to this area select the RAM bank number to use. If the - cartridge includes a Rumble Pack then bit 3 is used to control - rumble motor (0 - disable motor, 1 - enable motor). - - -MBC7 Mapper (Used by Kirby's Tilt n' Tumble, Command Master) -=========== - -Status: Partial support (only ROM banking supported at the moment) - -The MBC7 mapper has 0x0200(?) bytes of RAM built in. - -0000-1FFF - Probably enable/disable RAM - In order to use this area bit 12 of the address be set. - Values written: 00, 0A -2000-2FFF - Writing to this area selects the ROM bank to appear at - 4000-7FFF. - In order to use this area bit 12 of the address be set. - Values written: 01, 07, 01, 1C -3000-3FFF - Unknown - In order to use this area bit 12 of the address be set. - Values written: 00 -4000-4FFF - Unknown - In order to use this area bit 12 of the address be set. - Values written: 00, 40, 3F - - -TAMA5 Mapper (Used by Tamagotchi 3) -============ - -Status: partially supported. - -The TAMA5 mapper includes a special RTC chip which communicates through the -RAM area (0xA000-0xBFFF); most notably addresses 0xA000 and 0xA001 seem to -be used. In this setup 0xA001 acts like a control register and 0xA000 like -a data register. - -Accepted values by the TAMA5 control register: -0x00 - Writing to 0xA000 will set bits 3-0 for rom bank selection. -0x01 - Writing to 0xA000 will set bits (7-?)4 for rom bank selection. - -0x04 - Bits 3-0 of the value to write -0x05 - Bits 4-7 of the value to write -0x06 - Address control hi - bit 0 - Bit 4 for the address - bit 3-1 - 000 - Write a byte to the 32 byte memory. The data to be - written must be set in registers 0x04 (lo nibble) and - 0x05 (hi nibble). - - 001 - Read a byte from the 32 byte memory. The data read - will be available in registers 0x0C (lo nibble) and - 0x0D (hi nibble). - - 010 - Unknown (occurs just after having started a game and - entered a date) (execution at address 1A19) - - 011 - Unknown (not encountered yet) - - 100 - Unknown (occurs during booting a game; appears to be - some kind of read command as it is followed by a read - of the 0x0C register) (execution at address 1B5B) - - 101 - Unknown (not encountered yet) - - 110 - Unknown (not encountered yet) - - 111 - Unknown (not encountered yet) -0x07 - Address control lo - bit 3-0 - bits 3-0 for the address - -0x0A - After writing this the lowest 2 bits of A000 determine whether the - TAMA5 chip is ready to accept the next command. If the lowest 2 bits - hold the value 01 then the TAMA5 chip is ready for the next command. - -0x0C - Reading from A000 will return bits 3-0 of the data -0x0D - Reading from A000 will return bits 7-4 of the data - -0x04 - RTC controls? -> RTC/memory? -0x05 - Write time/memomry? -0x06 - RTC controls? -0x07 - RTC controls? - -Unknown sequences: -During booting a game (1B5B: -04 <- 00, 06 <- 08, 07 <- 01, followed by read 0C -when value read from 0C equals 00 followed by the sequence: -04 <- 01, 06 <- 08, 07 <- 01, followed by read 0C -the value read from 0C is checked for non-zero, don't know the consequences for either -yet. - -Initialization after starting a game: -At address 1A19: -06 <- 05, 07 <- 02, followed by read 0C, if != 0F => OK, otherwise do something. - - -MMM01 mapper -============ - -Used by: Momotarou Collection 2, Taito Pack - -Status: not supported yet. - -Momotarou Collection 2: - -MOMOTARODENGEKI2, 0x00000, blocks 0x00 - 0x1F -0x147: 01 04 00 00 33 00 -MOMOTAROU GAIDEN, 0x80000, blocks 0x20 - 0x3F -0x147: 06 03 00 00 18 00 - -When picking top option: -3FFF <- 20 -5FFF <- 40 -7FFF <- 21 -1FFF <- 3A -1FFF <- 7A - -When picking bottom option: -3FFF <- 00 -5FFF <- 01 -7FFF <- 01 -1FFF <- 3A -1FFF <- 7A - -Taito Pack (MMM01+RAM, 512KB, 64KB RAM): -1st option (BUBBLE BOBBLE, blocks 0x10 - 0x17, MBC1+RAM, 128KB, 8KB RAM): - 2000 <- 70 01110000 => starting block, 10000 - 6000 <- 30 00110000 => 8 blocks - 4000 <- 70 01110000 => ??? - 0000 <- 40 01000000 => upper 3 bits determine lower 3 bits of starting block? - -2nd option (ELEVATOR ACTION, blocks 0x18 - 0x1B, MBC1, 64KB, 2KB RAM): - 2000 <- 78 01111000 => starting block, 11000 - 6000 <- 38 00111000 => 4 blocks - 4000 <- 70 01110000 => ??? - 0000 <- 40 01000000 => upper 3 bits determine lower 3 bits of starting block? - -3rd option (CHASE HQ, blocks 0x08 - 0x0F, MBC1+RAM, 128KB, 8KB RAM): - 2000 <- 68 01101000 => starting block, 01000 - 6000 <- 30 00110000 => 8 blocks - 4000 <- 70 01110000 => ??? - 0000 <- 40 01000000 => upper 3 bits determine lower 3 bits of starting block? - -4th option (SAGAIA, blocks 0x00 - 0x07, MBC1+RAM, 128KB, 8KB RAM): - 2000 <- 60 01100000 => starting block, 00000 - 6000 <- 30 00110000 => 8 blocks - 4000 <- 70 01110000 => ??? - 0000 <- 40 01000000 => upper 3 bits determine lower 3 bits of starting block? - -Known: -The last 2 banks in a MMM01 dump are actually the starting banks for a MMM01 image. - -0000-1FFF => bit6 set => perform mapping - -Possible mapping registers: -1FFF - Enable RAM ??? -3FFF - xxxbbbbb - Bit0-5 of the rom bank to select at 0x4000-0x7FFF ? - - -HuC1 mapper -=========== - -Status: not supported yet. - - -HuC3 mapper -=========== - -Status: not supported yet. - - -Wisdom Tree mapper -================== - -The Wisdom Tree mapper is triggered by writes in the 0x0000-0x3FFF area. The -address written to determines the bank to switch in in the 0x000-0x7FFF address -space. This mapper uses 32KB sized banks. - - -***************************************************************************/ - -#include "emu.h" -#include "rendlay.h" -#include "includes/gb.h" -#include "bus/gameboy/rom.h" -#include "bus/gameboy/mbc.h" - - -READ8_MEMBER(gb_state::gb_cart_r) -{ - if (m_bios_disable && m_cartslot) - return m_cartslot->read_rom(space, offset); - else - { - if (offset < 0x100) - { - UINT8 *ROM = m_region_maincpu->base(); - if (m_bios_hack->read()) - { - // patch out logo and checksum checks - // (useful to run some pirate carts until we implement - // their complete functionalities + to test homebrew) - if (offset == 0xe9 || offset == 0xea) - return 0x00; - if (offset == 0xfa || offset == 0xfb) - return 0x00; - } - return ROM[offset]; - } - else if (m_cartslot) - { - return m_cartslot->read_rom(space, offset); - } - else - return 0xff; - } -} - -READ8_MEMBER(gb_state::gbc_cart_r) -{ - if (m_bios_disable && m_cartslot) - return m_cartslot->read_rom(space, offset); - else - { - if (offset < 0x100) - { - UINT8 *ROM = m_region_maincpu->base(); - if (m_bios_hack->read()) - { - // patch out logo and checksum checks - // (useful to run some pirate carts until we implement - // their complete functionalities + to test homebrew) - if (offset == 0xdb || offset == 0xdc) - return 0x00; - if (offset == 0xed || offset == 0xee) - return 0x00; - } - return ROM[offset]; - } - else if (offset >= 0x200 && offset < 0x900) - { - UINT8 *ROM = m_region_maincpu->base(); - return ROM[offset - 0x100]; - } - else if (m_cartslot) - { - return m_cartslot->read_rom(space, offset); - } - else - return 0xff; - } -} - -WRITE8_MEMBER(gb_state::gb_bank_w) -{ - if (m_cartslot) - m_cartslot->write_bank(space, offset, data); -} - -READ8_MEMBER(gb_state::gb_ram_r) -{ - if (m_cartslot) - return m_cartslot->read_ram(space, offset); - else - return 0xff; -} - -WRITE8_MEMBER(gb_state::gb_ram_w) -{ - if (m_cartslot) - m_cartslot->write_ram(space, offset, data); -} - -READ8_MEMBER(gb_state::gb_echo_r) -{ - return space.read_byte(0xc000 + offset); -} - -WRITE8_MEMBER(gb_state::gb_echo_w) -{ - return space.write_byte(0xc000 + offset, data); -} - -READ8_MEMBER(megaduck_state::cart_r) -{ - if (m_cartslot) - return m_cartslot->read_rom(space, offset); - else - return 0xff; -} - -WRITE8_MEMBER(megaduck_state::bank1_w) -{ - if (m_cartslot) - m_cartslot->write_bank(space, offset, data); -} - -WRITE8_MEMBER(megaduck_state::bank2_w) -{ - if (m_cartslot) - m_cartslot->write_ram(space, offset, data); /* used for bankswitch, but we re-use GB name */ -} - - -static ADDRESS_MAP_START(gameboy_map, AS_PROGRAM, 8, gb_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(gb_cart_r, gb_bank_w) - AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("lcd", gb_lcd_device, vram_r, vram_w) /* 8k VRAM */ - AM_RANGE(0xa000, 0xbfff) AM_READWRITE(gb_ram_r, gb_ram_w) /* 8k switched RAM bank (cartridge) */ - AM_RANGE(0xc000, 0xdfff) AM_RAM /* 8k low RAM */ - AM_RANGE(0xe000, 0xfdff) AM_READWRITE(gb_echo_r, gb_echo_w) /* echo RAM */ - AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("lcd", gb_lcd_device, oam_r, oam_w) /* OAM RAM */ - AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, gb_io_w) /* I/O */ - AM_RANGE(0xff10, 0xff26) AM_DEVREADWRITE("custom", gameboy_sound_device, sound_r, sound_w) /* sound registers */ - AM_RANGE(0xff27, 0xff2f) AM_NOP /* unused */ - AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("custom", gameboy_sound_device, wave_r, wave_w) /* Wave ram */ - AM_RANGE(0xff40, 0xff7f) AM_DEVREAD("lcd", gb_lcd_device, video_r) AM_WRITE(gb_io2_w) /* Video controller & BIOS flip-flop */ - AM_RANGE(0xff80, 0xfffe) AM_RAM /* High RAM */ - AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w) /* Interrupt enable register */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sgb_map, AS_PROGRAM, 8, gb_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(gb_cart_r, gb_bank_w) - AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("lcd", sgb_lcd_device, vram_r, vram_w) /* 8k VRAM */ - AM_RANGE(0xa000, 0xbfff) AM_READWRITE(gb_ram_r, gb_ram_w) /* 8k switched RAM bank (cartridge) */ - AM_RANGE(0xc000, 0xdfff) AM_RAM /* 8k low RAM */ - AM_RANGE(0xe000, 0xfdff) AM_READWRITE(gb_echo_r, gb_echo_w) /* echo RAM */ - AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("lcd", sgb_lcd_device, oam_r, oam_w) /* OAM RAM */ - AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, sgb_io_w) /* I/O */ - AM_RANGE(0xff10, 0xff26) AM_DEVREADWRITE("custom", gameboy_sound_device, sound_r, sound_w) /* sound registers */ - AM_RANGE(0xff27, 0xff2f) AM_NOP /* unused */ - AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("custom", gameboy_sound_device, wave_r, wave_w) /* Wave RAM */ - AM_RANGE(0xff40, 0xff7f) AM_DEVREAD("lcd", sgb_lcd_device, video_r) AM_WRITE(gb_io2_w) /* Video controller & BIOS flip-flop */ - AM_RANGE(0xff80, 0xfffe) AM_RAM /* High RAM */ - AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w) /* Interrupt enable register */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(gbc_map, AS_PROGRAM, 8, gb_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(gbc_cart_r, gb_bank_w) - AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("lcd", cgb_lcd_device, vram_r, vram_w) /* 8k VRAM */ - AM_RANGE(0xa000, 0xbfff) AM_READWRITE(gb_ram_r, gb_ram_w) /* 8k switched RAM bank (cartridge) */ - AM_RANGE(0xc000, 0xcfff) AM_RAM /* 4k fixed RAM bank */ - AM_RANGE(0xd000, 0xdfff) AM_RAMBANK("cgb_ram") /* 4k switched RAM bank */ - AM_RANGE(0xe000, 0xfdff) AM_READWRITE(gb_echo_r, gb_echo_w) /* echo RAM */ - AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("lcd", cgb_lcd_device, oam_r, oam_w) /* OAM RAM */ - AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, gb_io_w) /* I/O */ - AM_RANGE(0xff10, 0xff26) AM_DEVREADWRITE("custom", gameboy_sound_device, sound_r, sound_w) /* sound controller */ - AM_RANGE(0xff27, 0xff2f) AM_NOP /* unused */ - AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("custom", gameboy_sound_device, wave_r, wave_w) /* Wave RAM */ - AM_RANGE(0xff40, 0xff7f) AM_READWRITE(gbc_io2_r, gbc_io2_w) /* Other I/O and video controller */ - AM_RANGE(0xff80, 0xfffe) AM_RAM /* high RAM */ - AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w) /* Interrupt enable register */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(megaduck_map, AS_PROGRAM, 8, megaduck_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(cart_r, bank1_w) - AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("lcd", gb_lcd_device, vram_r, vram_w) /* 8k VRAM */ - AM_RANGE(0xa000, 0xafff) AM_NOP /* unused? */ - AM_RANGE(0xb000, 0xb000) AM_WRITE(bank2_w) - AM_RANGE(0xb001, 0xbfff) AM_NOP /* unused? */ - AM_RANGE(0xc000, 0xfe9f) AM_RAM /* 8k low RAM, echo RAM */ - AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("lcd", gb_lcd_device, oam_r, oam_w) /* OAM RAM */ - AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, gb_io_w) /* I/O */ - AM_RANGE(0xff10, 0xff1f) AM_READWRITE(megaduck_video_r, megaduck_video_w) /* video controller */ - AM_RANGE(0xff20, 0xff2f) AM_READWRITE(megaduck_sound_r1, megaduck_sound_w1) /* sound controller pt1 */ - AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("custom", gameboy_sound_device, wave_r, wave_w) /* wave ram */ - AM_RANGE(0xff40, 0xff46) AM_READWRITE(megaduck_sound_r2, megaduck_sound_w2) /* sound controller pt2 */ - AM_RANGE(0xff47, 0xff7f) AM_NOP /* unused */ - AM_RANGE(0xff80, 0xfffe) AM_RAM /* high RAM */ - AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w) /* interrupt enable register */ -ADDRESS_MAP_END - -static GFXDECODE_START( gb ) -GFXDECODE_END - -static INPUT_PORTS_START( gameboy ) - PORT_START("INPUTS") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button A") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button B") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") - - PORT_START("SKIP_CHECK") - PORT_CONFNAME( 0x01, 0x00, "[HACK] Skip BIOS Logo check" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - -INPUT_PORTS_END - -static SLOT_INTERFACE_START(gb_cart) - SLOT_INTERFACE_INTERNAL("rom", GB_STD_ROM) - SLOT_INTERFACE_INTERNAL("rom_mbc1", GB_ROM_MBC1) - SLOT_INTERFACE_INTERNAL("rom_mbc1col", GB_ROM_MBC1) - SLOT_INTERFACE_INTERNAL("rom_mbc2", GB_ROM_MBC2) - SLOT_INTERFACE_INTERNAL("rom_mbc3", GB_ROM_MBC3) - SLOT_INTERFACE_INTERNAL("rom_huc1", GB_ROM_MBC3) - SLOT_INTERFACE_INTERNAL("rom_huc3", GB_ROM_MBC3) - SLOT_INTERFACE_INTERNAL("rom_mbc5", GB_ROM_MBC5) - SLOT_INTERFACE_INTERNAL("rom_mbc6", GB_ROM_MBC6) - SLOT_INTERFACE_INTERNAL("rom_mbc7", GB_ROM_MBC7) - SLOT_INTERFACE_INTERNAL("rom_tama5", GB_ROM_TAMA5) - SLOT_INTERFACE_INTERNAL("rom_mmm01", GB_ROM_MMM01) - SLOT_INTERFACE_INTERNAL("rom_m161_m12",GB_ROM_M161_M12) - SLOT_INTERFACE_INTERNAL("rom_sachen1", GB_ROM_SACHEN1) - SLOT_INTERFACE_INTERNAL("rom_sachen2", GB_ROM_SACHEN2) - SLOT_INTERFACE_INTERNAL("rom_wisdom", GB_ROM_WISDOM) - SLOT_INTERFACE_INTERNAL("rom_yong", GB_ROM_YONG) - SLOT_INTERFACE_INTERNAL("rom_lasama", GB_ROM_LASAMA) - SLOT_INTERFACE_INTERNAL("rom_atvrac", GB_ROM_ATVRAC) - SLOT_INTERFACE_INTERNAL("rom_camera", GB_STD_ROM) - SLOT_INTERFACE_INTERNAL("rom_188in1", GB_ROM_188IN1) - SLOT_INTERFACE_INTERNAL("rom_sintax", GB_ROM_SINTAX) - SLOT_INTERFACE_INTERNAL("rom_chong", GB_ROM_CHONGWU) - SLOT_INTERFACE_INTERNAL("rom_licheng", GB_ROM_LICHENG) - SLOT_INTERFACE_INTERNAL("rom_digimon", GB_ROM_DIGIMON) - SLOT_INTERFACE_INTERNAL("rom_rock8", GB_ROM_ROCKMAN8) - SLOT_INTERFACE_INTERNAL("rom_sm3sp", GB_ROM_SM3SP) -// SLOT_INTERFACE_INTERNAL("rom_dkong5", GB_ROM_DKONG5) -// SLOT_INTERFACE_INTERNAL("rom_unk01", GB_ROM_UNK01) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(megaduck_cart) - SLOT_INTERFACE_INTERNAL("rom", MEGADUCK_ROM) -SLOT_INTERFACE_END - - - -static const unsigned char palette_gb[] = -{ - /* Simple black and white palette */ - /* 0xFF,0xFF,0xFF, - 0xB0,0xB0,0xB0, - 0x60,0x60,0x60, - 0x00,0x00,0x00 */ - - /* Possibly needs a little more green in it */ - 0xFF,0xFB,0x87, /* Background */ - 0xB1,0xAE,0x4E, /* Light */ - 0x84,0x80,0x4E, /* Medium */ - 0x4E,0x4E,0x4E, /* Dark */ - - /* Palette for Game Boy Pocket/Light */ - 0xC4,0xCF,0xA1, /* Background */ - 0x8B,0x95,0x6D, /* Light */ - 0x6B,0x73,0x53, /* Medium */ - 0x41,0x41,0x41, /* Dark */ -}; - -static const unsigned char palette_megaduck[] = { - 0x6B, 0xA6, 0x4A, 0x43, 0x7A, 0x63, 0x25, 0x59, 0x55, 0x12, 0x42, 0x4C -}; - -/* Initialise the palettes */ -PALETTE_INIT_MEMBER(gb_state, gb) -{ - for (int i = 0; i < 4; i++) - palette.set_pen_color(i, palette_gb[i * 3 + 0], palette_gb[i * 3 + 1], palette_gb[i * 3 + 2]); -} - -PALETTE_INIT_MEMBER(gb_state, gbp) -{ - for (int i = 0; i < 4; i++) - palette.set_pen_color(i, palette_gb[(i + 4) * 3 + 0], palette_gb[(i + 4) * 3 + 1], palette_gb[(i + 4) * 3 + 2]); -} - -PALETTE_INIT_MEMBER(gb_state, sgb) -{ - int r, g, b; - - for (int i = 0; i < 32768; i++) - { - r = (i & 0x1F) << 3; - g = ((i >> 5) & 0x1F) << 3; - b = ((i >> 10) & 0x1F) << 3; - palette.set_pen_color(i, r, g, b); - } -} - -PALETTE_INIT_MEMBER(gb_state, gbc) -{ - int r, g, b; - - for (int i = 0; i < 32768; i++) - { - r = (i & 0x1F) << 3; - g = ((i >> 5) & 0x1F) << 3; - b = ((i >> 10) & 0x1F) << 3; - palette.set_pen_color(i, r, g, b); - } -} - -PALETTE_INIT_MEMBER(megaduck_state, megaduck) -{ - for (int i = 0; i < 4; i++) - palette.set_pen_color(i, palette_megaduck[i * 3 + 0], palette_megaduck[i * 3 + 1], palette_megaduck[i * 3 + 2]); -} - - -static MACHINE_CONFIG_START( gameboy, gb_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", LR35902, XTAL_4_194304Mhz) - MCFG_CPU_PROGRAM_MAP(gameboy_map) - MCFG_LR35902_TIMER_CB( WRITE8( gb_state, gb_timer_callback ) ) - MCFG_LR35902_HALT_BUG - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_UPDATE_DEVICE("lcd", gb_lcd_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) -// MCFG_SCREEN_SIZE(20*8, 18*8) - MCFG_SCREEN_SIZE( 458, 154 ) - MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", gb) - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(gb_state,gb) - - MCFG_GB_LCD_DMG_ADD("lcd") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", GAMEBOY, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - - /* cartslot */ - MCFG_GB_CARTRIDGE_ADD("gbslot", gb_cart, NULL) - - MCFG_SOFTWARE_LIST_ADD("cart_list","gameboy") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gbc_list","gbcolor") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( supergb, gameboy ) - - /* basic machine hardware */ - MCFG_CPU_REPLACE("maincpu", LR35902, 4295454) /* 4.295454 MHz, derived from SNES xtal */ - MCFG_CPU_PROGRAM_MAP(sgb_map) - - MCFG_CPU_MODIFY("maincpu") - MCFG_LR35902_TIMER_CB( WRITE8(gb_state, gb_timer_callback ) ) - MCFG_LR35902_HALT_BUG - - MCFG_MACHINE_START_OVERRIDE(gb_state, sgb) - MCFG_MACHINE_RESET_OVERRIDE(gb_state, sgb) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_horizont) /* runs on a TV, not an LCD */ - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(32*8, 28*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(32768) - MCFG_PALETTE_INIT_OWNER(gb_state,sgb) - - MCFG_DEVICE_REMOVE("lcd") - MCFG_GB_LCD_SGB_ADD("lcd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( supergb2, gameboy ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sgb_map) - - MCFG_CPU_MODIFY("maincpu") - MCFG_LR35902_TIMER_CB( WRITE8(gb_state, gb_timer_callback ) ) - MCFG_LR35902_HALT_BUG - - MCFG_MACHINE_START_OVERRIDE(gb_state, sgb) - MCFG_MACHINE_RESET_OVERRIDE(gb_state, sgb) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_horizont) /* runs on a TV, not an LCD */ - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(32*8, 28*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(32768) - MCFG_PALETTE_INIT_OWNER(gb_state,sgb) - - MCFG_DEVICE_REMOVE("lcd") - MCFG_GB_LCD_SGB_ADD("lcd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( gbpocket, gameboy ) - - /* video hardware */ - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(gb_state,gbp) - - MCFG_DEVICE_REMOVE("lcd") - MCFG_GB_LCD_MGB_ADD("lcd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( gbcolor, gb_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", LR35902, XTAL_4_194304Mhz) // todo XTAL_8_388MHz - MCFG_CPU_PROGRAM_MAP(gbc_map) - MCFG_LR35902_TIMER_CB( WRITE8(gb_state, gb_timer_callback ) ) - - MCFG_MACHINE_START_OVERRIDE(gb_state,gbc) - MCFG_MACHINE_RESET_OVERRIDE(gb_state,gbc) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_UPDATE_DEVICE("lcd", gb_lcd_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) -// MCFG_SCREEN_SIZE(20*8, 18*8) - MCFG_SCREEN_SIZE( 458, 154 ) - MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", gb) - - MCFG_PALETTE_ADD("palette", 32768) - MCFG_PALETTE_INIT_OWNER(gb_state,gbc) - - MCFG_GB_LCD_CGB_ADD("lcd") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", GAMEBOY, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") /* 2 pages of 8KB VRAM, 8 pages of 4KB RAM */ - - /* cartslot */ - MCFG_GB_CARTRIDGE_ADD("gbslot", gb_cart, NULL) - - MCFG_SOFTWARE_LIST_ADD("cart_list","gbcolor") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gb_list","gameboy") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( megaduck, megaduck_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", LR35902, 4194304) /* 4.194304 MHz */ - MCFG_CPU_PROGRAM_MAP(megaduck_map) - MCFG_LR35902_TIMER_CB( WRITE8(gb_state, gb_timer_callback ) ) - MCFG_LR35902_HALT_BUG - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_PALETTE("palette") - - MCFG_MACHINE_START_OVERRIDE(megaduck_state, megaduck) - MCFG_MACHINE_RESET_OVERRIDE(megaduck_state, megaduck) - - MCFG_SCREEN_UPDATE_DEVICE("lcd", gb_lcd_device, screen_update) - MCFG_SCREEN_SIZE(20*8, 18*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", gb) - - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(megaduck_state,megaduck) - - MCFG_GB_LCD_DMG_ADD("lcd") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", GAMEBOY, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - - /* cartslot */ - MCFG_MEGADUCK_CARTRIDGE_ADD("duckslot", megaduck_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list", "megaduck") -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( gameboy ) - ROM_REGION( 0x0100, "maincpu", 0 ) - ROM_LOAD( "dmg_boot.bin", 0x0000, 0x0100, CRC(59c8598e) SHA1(4ed31ec6b0b175bb109c0eb5fd3d193da823339f) ) -ROM_END - -ROM_START( supergb ) - ROM_REGION( 0x0100, "maincpu", 0 ) - ROM_LOAD( "sgb_boot.bin", 0x0000, 0x0100, CRC(ec8a83b9) SHA1(aa2f50a77dfb4823da96ba99309085a3c6278515) ) -ROM_END - -ROM_START( supergb2 ) - ROM_REGION( 0x0100, "maincpu", 0 ) - ROM_LOAD( "sgb2_boot.bin", 0x0000, 0x0100, CRC(53d0dd63) SHA1(93407ea10d2f30ab96a314d8eca44fe160aea734) ) -ROM_END - -ROM_START( gbpocket ) - ROM_REGION( 0x0100, "maincpu", 0 ) - ROM_LOAD( "mgb_boot.bin", 0x0000, 0x0100, CRC(e6920754) SHA1(4e68f9da03c310e84c523654b9026e51f26ce7f0) ) -ROM_END - -ROM_START( gbcolor ) - ROM_REGION( 0x800, "maincpu", 0 ) - ROM_LOAD( "gbc_boot.1", 0x0000, 0x0100, CRC(779ea374) SHA1(e4b40c9fd593a97a1618cfb2696f290cf9596a62) ) /* Bootstrap code part 1 */ - ROM_LOAD( "gbc_boot.2", 0x0100, 0x0700, CRC(f741807d) SHA1(f943b1e0b640cf1d371e1d8f0ada69af03ebb396) ) /* Bootstrap code part 2 */ -ROM_END - - -ROM_START( megaduck ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1990, gameboy, 0, 0, gameboy, gameboy, driver_device, 0, "Nintendo", "Game Boy", MACHINE_SUPPORTS_SAVE ) -CONS( 1994, supergb, gameboy, 0, supergb, gameboy, driver_device, 0, "Nintendo", "Super Game Boy", MACHINE_SUPPORTS_SAVE ) -CONS( 1998, supergb2, gameboy, 0, supergb2, gameboy, driver_device, 0, "Nintendo", "Super Game Boy 2", MACHINE_SUPPORTS_SAVE ) -CONS( 1996, gbpocket, gameboy, 0, gbpocket, gameboy, driver_device, 0, "Nintendo", "Game Boy Pocket", MACHINE_SUPPORTS_SAVE ) -CONS( 1998, gbcolor, 0, 0, gbcolor, gameboy, driver_device, 0, "Nintendo", "Game Boy Color", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) - -// Sound is not 100% yet, it generates some sounds which could be ok. Since we're lacking a real system there's no way to verify. -CONS( 1993, megaduck, 0, 0, megaduck, gameboy, driver_device, 0, "Welback Holdings (Timlex International) / Creatronic / Videojet / Cougar USA", "Mega Duck / Cougar Boy", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/gba.c b/src/mess/drivers/gba.c deleted file mode 100644 index 08fc5a6e04f..00000000000 --- a/src/mess/drivers/gba.c +++ /dev/null @@ -1,2318 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont,Ryan Holtz -/*************************************************************************** - - gba.c - - Driver file to handle emulation of the Nintendo Game Boy Advance. - - By R. Belmont & Harmony - -***************************************************************************/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "cpu/arm7/arm7core.h" -#include "sound/dac.h" -#include "audio/gb.h" -#include "includes/gba.h" -#include "bus/gba/rom.h" -#include "rendlay.h" - -#define VERBOSE_LEVEL (0) - -INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ...) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%08x: %s", machine.driver_data()->m_maincpu->pc(), buf ); - } -} - -#define GBA_ATTOTIME_NORMALIZE(a) a.normalize() - -static const UINT32 timer_clks[4] = { 16777216, 16777216/64, 16777216/256, 16777216/1024 }; - - -PALETTE_INIT_MEMBER(gba_state, gba) -{ - UINT8 r, g, b; - for( b = 0; b < 32; b++ ) - { - for( g = 0; g < 32; g++ ) - { - for( r = 0; r < 32; r++ ) - { - palette.set_pen_color( ( b << 10 ) | ( g << 5 ) | r, pal5bit(r), pal5bit(g), pal5bit(b) ); - } - } - } -} - -void gba_state::request_irq(UINT32 int_type) -{ - // set flag for later recovery - m_IF |= int_type; - - // is this specific interrupt enabled? - int_type &= m_IE; - if (int_type != 0) - { - // master enable? - if (m_IME & 1) - { - m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - m_maincpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); - } - } -} - -TIMER_CALLBACK_MEMBER(gba_state::dma_complete) -{ - int ctrl; - FPTR ch; - static const UINT32 ch_int[4] = { INT_DMA0, INT_DMA1, INT_DMA2, INT_DMA3 }; - - ch = param; - -// printf("dma complete: ch %d\n", ch); - - m_dma_timer[ch]->adjust(attotime::never); - - ctrl = m_dma_regs[(ch*3)+2] >> 16; - - // IRQ - if (ctrl & 0x4000) - { - request_irq(ch_int[ch]); - } - - // if we're supposed to repeat, don't clear "active" and then the next vbl/hbl will retrigger us - // always clear active for immediate DMAs though - if (!((ctrl>>9) & 1) || ((ctrl & 0x3000) == 0)) - { -// printf("clear active for ch %d\n", ch); - m_dma_regs[(ch*3)+2] &= ~0x80000000; // clear "active" bit - } - else - { - // if repeat, reload the count - if ((ctrl>>9) & 1) - { - m_dma_cnt[ch] = m_dma_regs[(ch*3)+2]&0xffff; - - // if increment & reload mode, reload the destination - if (((ctrl>>5)&3) == 3) - { - m_dma_dst[ch] = m_dma_regs[(ch*3)+1]; - } - } - } -} - -void gba_state::dma_exec(FPTR ch) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT32 src = m_dma_src[ch]; - UINT32 dst = m_dma_dst[ch]; - int ctrl = m_dma_regs[(ch*3)+2] >> 16; - int srcadd = m_dma_srcadd[ch]; - int dstadd = m_dma_dstadd[ch]; - - int cnt = m_dma_cnt[ch]; - if (!cnt) - { - if (ch == 3) - { - cnt = 0x10000; - } - else - { - cnt = 0x4000; - } - } - - // override special parameters - if ((ctrl & 0x3000) == 0x3000) // special xfer mode - { - switch (ch) - { - case 1: // Ch 1&2 are for audio DMA - case 2: - dstadd = 2; // don't increment destination - cnt = 4; // always transfer 4 32-bit words - ctrl |= 0x400; // always 32-bit - break; - - case 3: - printf("Unsupported DMA 3 special mode\n"); - break; - } - } - else - { -// if (dst >= 0x6000000 && dst <= 0x6017fff) -// printf("DMA exec: ch %d from %08x to %08x, mode %04x, count %04x (%s)\n", (int)ch, src, dst, ctrl, cnt, ((ctrl>>10) & 1) ? "32" : "16"); - } - - for (int i = 0; i < cnt; i++) - { - if ((ctrl>>10) & 1) - { - src &= 0xfffffffc; - dst &= 0xfffffffc; - - // 32-bit - space.write_dword(dst, space.read_dword(src)); - switch (dstadd) - { - case 0: // increment - dst += 4; - break; - case 1: // decrement - dst -= 4; - break; - case 2: // don't move - break; - case 3: // increment and reload - dst += 4; - break; - } - switch (srcadd) - { - case 0: // increment - src += 4; - break; - case 1: // decrement - src -= 4; - break; - case 2: // don't move - break; - case 3: // not used ("Metal Max 2 Kai" expects no increment/decrement) - break; - } - } - else - { - src &= 0xfffffffe; - dst &= 0xfffffffe; - - // 16-bit - space.write_word(dst, space.read_word(src)); - switch (dstadd) - { - case 0: // increment - dst += 2; - break; - case 1: // decrement - dst -= 2; - break; - case 2: // don't move - break; - case 3: // increment and reload - dst += 2; - break; - } - switch (srcadd) - { - case 0: // increment - src += 2; - break; - case 1: // decrement - src -= 2; - break; - case 2: // don't move - break; - case 3: // not used (see note in 32-bit version above) - break; - } - } - } - - m_dma_src[ch] = src; - m_dma_dst[ch] = dst; - -// printf("settng DMA timer %d for %d cycs (tmr %x)\n", ch, cnt, (UINT32)m_dma_timer[ch]); -// m_dma_timer[ch]->adjust(ATTOTIME_IN_CYCLES(0, cnt), ch); - dma_complete(NULL, ch); -} - -void gba_state::audio_tick(int ref) -{ - if (!(m_SOUNDCNT_X & 0x80)) - { - return; - } - - if (!ref) - { - if (m_fifo_a_ptr != m_fifo_a_in) - { - if (m_fifo_a_ptr == 17) - { - m_fifo_a_ptr = 0; - } - - if (m_SOUNDCNT_H & 0x200) - { - m_ladac->write_signed8(m_fifo_a[m_fifo_a_ptr]^0x80); - } - if (m_SOUNDCNT_H & 0x100) - { - m_radac->write_signed8(m_fifo_a[m_fifo_a_ptr]^0x80); - } - m_fifo_a_ptr++; - } - - // fifo empty? - if (m_fifo_a_ptr == m_fifo_a_in) - { - // is a DMA set up to feed us? - if ((m_dma_regs[(1*3)+1] == 0x40000a0) && ((m_dma_regs[(1*3)+2] & 0x30000000) == 0x30000000)) - { - // channel 1 it is - dma_exec(1); - } - if ((m_dma_regs[(2*3)+1] == 0x40000a0) && ((m_dma_regs[(2*3)+2] & 0x30000000) == 0x30000000)) - { - // channel 2 it is - dma_exec(2); - } - } - } - else - { - if (m_fifo_b_ptr != m_fifo_b_in) - { - if (m_fifo_b_ptr == 17) - { - m_fifo_b_ptr = 0; - } - - if (m_SOUNDCNT_H & 0x2000) - { - m_lbdac->write_signed8(m_fifo_b[m_fifo_b_ptr]^0x80); - } - if (m_SOUNDCNT_H & 0x1000) - { - m_rbdac->write_signed8(m_fifo_b[m_fifo_b_ptr]^0x80); - } - m_fifo_b_ptr++; - } - - if (m_fifo_b_ptr == m_fifo_b_in) - { - // is a DMA set up to feed us? - if ((m_dma_regs[(1*3)+1] == 0x40000a4) && ((m_dma_regs[(1*3)+2] & 0x30000000) == 0x30000000)) - { - // channel 1 it is - dma_exec(1); - } - if ((m_dma_regs[(2*3)+1] == 0x40000a4) && ((m_dma_regs[(2*3)+2] & 0x30000000) == 0x30000000)) - { - // channel 2 it is - dma_exec(2); - } - } - } -} - -TIMER_CALLBACK_MEMBER(gba_state::timer_expire) -{ - static const UINT32 tmr_ints[4] = { INT_TM0_OVERFLOW, INT_TM1_OVERFLOW, INT_TM2_OVERFLOW, INT_TM3_OVERFLOW }; - FPTR tmr = (FPTR) param; - -// printf("Timer %d expired, SOUNDCNT_H %04x\n", tmr, m_SOUNDCNT_H); - - // "The reload value is copied into the counter only upon following two situations: Automatically upon timer overflows," - // "or when the timer start bit becomes changed from 0 to 1." - if (m_timer_recalc[tmr] != 0) - { - double rate, clocksel, final; - attotime time; - m_timer_recalc[tmr] = 0; - m_timer_regs[tmr] = (m_timer_regs[tmr] & 0xFFFF0000) | (m_timer_reload[tmr] & 0x0000FFFF); - rate = 0x10000 - (m_timer_regs[tmr] & 0xffff); - clocksel = timer_clks[(m_timer_regs[tmr] >> 16) & 3]; - final = clocksel / rate; - m_timer_hz[tmr] = final; - time = attotime::from_hz(final); - GBA_ATTOTIME_NORMALIZE(time); - m_tmr_timer[tmr]->adjust(time, tmr, time); - } - - // check if timers 0 or 1 are feeding directsound - if (tmr == 0) - { - if ((m_SOUNDCNT_H & 0x400) == 0) - { - audio_tick(0); - } - - if ((m_SOUNDCNT_H & 0x4000) == 0) - { - audio_tick(1); - } - } - - if (tmr == 1) - { - if ((m_SOUNDCNT_H & 0x400) == 0x400) - { - audio_tick(0); - } - - if ((m_SOUNDCNT_H & 0x4000) == 0x4000) - { - audio_tick(1); - } - } - - // Handle count-up timing - switch (tmr) - { - case 0: - if (m_timer_regs[1] & 0x40000) - { - m_timer_regs[1] = (( ( m_timer_regs[1] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[1] & 0xffff0000); - if( ( m_timer_regs[1] & 0x0000ffff ) == 0 ) - { - m_timer_regs[1] |= m_timer_reload[1]; - if( ( m_timer_regs[1] & 0x400000 ) && ( m_IME != 0 ) ) - { - request_irq(tmr_ints[1]); - } - if( ( m_timer_regs[2] & 0x40000 ) ) - { - m_timer_regs[2] = (( ( m_timer_regs[2] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[2] & 0xffff0000); - if( ( m_timer_regs[2] & 0x0000ffff ) == 0 ) - { - m_timer_regs[2] |= m_timer_reload[2]; - if( ( m_timer_regs[2] & 0x400000 ) && ( m_IME != 0 ) ) - { - request_irq(tmr_ints[2]); - } - if( ( m_timer_regs[3] & 0x40000 ) ) - { - m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); - if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) - { - m_timer_regs[3] |= m_timer_reload[3]; - if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) - { - request_irq(tmr_ints[3]); - } - } - } - } - } - } - } - break; - case 1: - if (m_timer_regs[2] & 0x40000) - { - m_timer_regs[2] = (( ( m_timer_regs[2] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[2] & 0xffff0000); - if( ( m_timer_regs[2] & 0x0000ffff ) == 0 ) - { - m_timer_regs[2] |= m_timer_reload[2]; - if( ( m_timer_regs[2] & 0x400000 ) && ( m_IME != 0 ) ) - { - request_irq(tmr_ints[2]); - } - if( ( m_timer_regs[3] & 0x40000 ) ) - { - m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); - if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) - { - m_timer_regs[3] |= m_timer_reload[3]; - if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) - { - request_irq(tmr_ints[3]); - } - } - } - } - } - break; - case 2: - if (m_timer_regs[3] & 0x40000) - { - m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); - if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) - { - m_timer_regs[3] |= m_timer_reload[3]; - if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) - { - request_irq(tmr_ints[3]); - } - } - } - break; - } - - // are we supposed to IRQ? - if ((m_timer_regs[tmr] & 0x400000) && (m_IME != 0)) - { - request_irq(tmr_ints[tmr]); - } -} - -TIMER_CALLBACK_MEMBER(gba_state::handle_irq) -{ - request_irq(m_IF); - - m_irq_timer->adjust(attotime::never); -} - -READ32_MEMBER(gba_state::gba_io_r) -{ - UINT32 retval = 0; - - switch( offset ) - { - case 0x0000/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: DISPCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_DISPCNT ); - retval |= m_DISPCNT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: Green Swap (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_GRNSWAP ); - retval |= m_GRNSWAP << 16; - } - break; - case 0x0004/4: - retval = (m_DISPSTAT & 0xffff) | (machine().first_screen()->vpos()<<16); - break; - case 0x0008/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG0CNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_BG0CNT ); - retval |= m_BG0CNT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG1CNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_BG1CNT ); - retval |= m_BG1CNT << 16; - } - break; - case 0x000c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2CNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_BG2CNT ); - retval |= m_BG2CNT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3CNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_BG3CNT ); - retval |= m_BG3CNT << 16; - } - break; - case 0x0010/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG0HOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG0VOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0014/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG1HOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG1VOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0018/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2HOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2VOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x001c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3HOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3VOFS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0020/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2PA (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2PB (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0024/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2PC (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2PD (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0028/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2X_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2X_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x002c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2Y_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG2Y_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0030/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3PA (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3PB (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0034/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3PC (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3PD (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0038/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3X_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3X_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x003c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3Y_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BG3Y_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0040/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: WIN0H (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: WIN1H (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0044/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: WIN0V (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: WIN1V (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0048/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: WININ (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_WININ ); - retval |= m_WININ; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: WINOUT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_WINOUT ); - retval |= m_WINOUT << 16; - } - break; - case 0x004c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: MOSAIC (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0050/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BLDCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_BLDCNT ); - retval |= m_BLDCNT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: BLDALPHA (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_BLDALPHA ); - retval |= m_BLDALPHA << 16; - } - break; - case 0x0054/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: BLDY (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0058/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x005c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), 0 ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0060/4: - retval = m_gbsound->sound_r(space, 0) | m_gbsound->sound_r(space, 1)<<16 | m_gbsound->sound_r(space, 2)<<24; - break; - case 0x0064/4: - retval = m_gbsound->sound_r(space, 3) | m_gbsound->sound_r(space, 4)<<8; - break; - case 0x0068/4: - retval = m_gbsound->sound_r(space, 6) | m_gbsound->sound_r(space, 7)<<8; - break; - case 0x006c/4: - retval = m_gbsound->sound_r(space, 8) | m_gbsound->sound_r(space, 9)<<8; - break; - case 0x0070/4: - retval = m_gbsound->sound_r(space, 0xa) | m_gbsound->sound_r(space, 0xb)<<16 | m_gbsound->sound_r(space, 0xc)<<24; - break; - case 0x0074/4: - retval = m_gbsound->sound_r(space, 0xd) | m_gbsound->sound_r(space, 0xe)<<8; - break; - case 0x0078/4: - retval = m_gbsound->sound_r(space, 0x10) | m_gbsound->sound_r(space, 0x11)<<8; - break; - case 0x007c/4: - retval = m_gbsound->sound_r(space, 0x12) | m_gbsound->sound_r(space, 0x13)<<8; - break; - case 0x0080/4: - retval = m_gbsound->sound_r(space, 0x14) | m_gbsound->sound_r(space, 0x15)<<8; - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: SOUNDCNT_H (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_SOUNDCNT_H ); - retval |= m_SOUNDCNT_H << 16; - } - break; - case 0x0084/4: - retval = m_gbsound->sound_r(space, 0x16); - break; - case 0x0088/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: SOUNDBIAS (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_SOUNDBIAS ); - retval |= m_SOUNDBIAS; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0090/4: - retval = m_gbsound->wave_r(space, 0) | m_gbsound->wave_r(space, 1)<<8 | m_gbsound->wave_r(space, 2)<<16 | m_gbsound->wave_r(space, 3)<<24; - break; - case 0x0094/4: - retval = m_gbsound->wave_r(space, 4) | m_gbsound->wave_r(space, 5)<<8 | m_gbsound->wave_r(space, 6)<<16 | m_gbsound->wave_r(space, 7)<<24; - break; - case 0x0098/4: - retval = m_gbsound->wave_r(space, 8) | m_gbsound->wave_r(space, 9)<<8 | m_gbsound->wave_r(space, 10)<<16 | m_gbsound->wave_r(space, 11)<<24; - break; - case 0x009c/4: - retval = m_gbsound->wave_r(space, 12) | m_gbsound->wave_r(space, 13)<<8 | m_gbsound->wave_r(space, 14)<<16 | m_gbsound->wave_r(space, 15)<<24; - break; - case 0x00a0/4: - case 0x00a4/4: - retval = 0; // (does this actually do anything on real h/w?) - break; - case 0x00b0/4: - case 0x00b4/4: - case 0x00b8/4: - case 0x00bc/4: - case 0x00c0/4: - case 0x00c4/4: - case 0x00c8/4: - case 0x00cc/4: - case 0x00d0/4: - case 0x00d4/4: - case 0x00d8/4: - case 0x00dc/4: - { - // no idea why here, but it matches VBA better - // note: this suspicious piece of code crashes "Buffy The Vampire Slayer" (08008DB4) and "The Ant Bully", so disable it for now - #if 0 - if (((offset-0xb0/4) % 3) == 2) - { - retval = m_dma_regs[offset-(0xb0/4)] & 0xff000000; - } - else - #endif - - retval = m_dma_regs[offset-(0xb0/4)]; - } - break; - case 0x0100/4: - case 0x0104/4: - case 0x0108/4: - case 0x010c/4: - { - UINT32 elapsed; - double time, ticks; - int timer = offset-(0x100/4); - -// printf("Read timer reg %x (PC=%x)\n", timer, space.device().safe_pc()); - - // update times for - if (m_timer_regs[timer] & 0x800000) - { - if (m_timer_regs[timer] & 0x00040000) - { - elapsed = m_timer_regs[timer] & 0xffff; - } - else - { - time = m_tmr_timer[timer]->elapsed().as_double(); - - ticks = (double)(0x10000 - (m_timer_regs[timer] & 0xffff)); - -// printf("time %f ticks %f 1/hz %f\n", time, ticks, 1.0 / m_timer_hz[timer]); - - time *= ticks; - time /= (1.0 / m_timer_hz[timer]); - - elapsed = (UINT32)time; - - } - -// printf("elapsed = %x\n", elapsed); - } - else - { -// printf("Reading inactive timer!\n"); - elapsed = 0; - } - - retval = (m_timer_regs[timer] & 0xffff0000) | (elapsed & 0xffff); - } - break; - case 0x0120/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: SIOMULTI0 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_SIOMULTI0 ); - retval |= m_SIOMULTI0; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: SIOMULTI1 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_SIOMULTI1 ); - retval |= m_SIOMULTI1 << 16; - } - break; - case 0x0124/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: SIOMULTI2 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_SIOMULTI2 ); - retval |= m_SIOMULTI2; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: SIOMULTI3 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_SIOMULTI3 ); - retval |= m_SIOMULTI3 << 16; - } - break; - case 0x0128/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: SIOCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_SIOCNT ); - retval |= m_SIOCNT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: SIODATA8 (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_SIODATA8 ); - retval |= m_SIODATA8 << 16; - } - break; - case 0x0130/4: - if( (mem_mask) & 0x0000ffff ) // KEYINPUT - { - retval = m_io_inputs->read(); - } - else if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: KEYCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_KEYCNT ); - retval |= m_KEYCNT << 16; - } - break; - case 0x0134/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: RCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_RCNT ); - retval |= m_RCNT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: IR (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0140/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: JOYCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_JOYCNT ); - retval |= m_JOYCNT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0150/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: JOY_RECV_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_JOY_RECV & 0x0000ffff ); - retval |= m_JOY_RECV & 0x0000ffff; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: JOY_RECV_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, ( m_JOY_RECV & 0xffff0000 ) >> 16 ); - retval |= m_JOY_RECV & 0xffff0000; - } - break; - case 0x0154/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: JOY_TRANS_LSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_JOY_TRANS & 0x0000ffff ); - retval |= m_JOY_TRANS & 0x0000ffff; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: JOY_TRANS_MSW (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, ( m_JOY_TRANS & 0xffff0000 ) >> 16 ); - retval |= m_JOY_TRANS & 0xffff0000; - } - break; - case 0x0158/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: JOYSTAT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_JOYSTAT ); - retval |= m_JOYSTAT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0200/4: - if( (mem_mask) & 0x0000ffff ) - { -// printf("Read: IE (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_IE ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: IF (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, m_IF ); - } - - retval = m_IE | (m_IF<<16); - break; - case 0x0204/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: WAITCNT (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_WAITCNT ); - retval |= m_WAITCNT; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0208/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Read: IME (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), m_IME ); - retval |= m_IME; - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Read: UNKNOWN (%08x) = %04x\n", 0x04000000 + ( offset << 2 ) + 2, 0 ); - } - break; - case 0x0300/4: - retval = m_HALTCNT << 8; - break; - default: -// verboselog(machine(), 0, "Unknown GBA I/O register Read: %08x (%08x)\n", 0x04000000 + ( offset << 2 ), ~mem_mask ); - break; - } - return retval; -} - -WRITE32_MEMBER(gba_state::gba_io_w) -{ - switch( offset ) - { - case 0x0000/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: DISPCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_DISPCNT = ( m_DISPCNT & ~mem_mask ) | ( data & mem_mask ); - if(m_DISPCNT & (DISPCNT_WIN0_EN | DISPCNT_WIN1_EN)) - { - m_windowOn = 1; - } - else - { - m_windowOn = 0; - } - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: Green Swap (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_GRNSWAP = ( m_GRNSWAP & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0004/4: - COMBINE_DATA(&m_DISPSTAT); - break; - case 0x0008/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG0CNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG0CNT = ( m_BG0CNT & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG1CNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG1CNT = ( m_BG1CNT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x000c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2CNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG2CNT = ( m_BG2CNT & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3CNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG3CNT = ( m_BG3CNT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0010/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG0HOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG0HOFS = ( m_BG0HOFS & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG0VOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG0VOFS = ( m_BG0VOFS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0014/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG1HOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG1HOFS = ( m_BG1HOFS & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG1VOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG1VOFS = ( m_BG1VOFS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0018/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2HOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG2HOFS = ( m_BG2HOFS & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2VOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG2VOFS = ( m_BG2VOFS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x001c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3HOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG3HOFS = ( m_BG3HOFS & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3VOFS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG3VOFS = ( m_BG3VOFS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0020/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2PA (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG2PA = ( m_BG2PA & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2PB (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG2PB = ( m_BG2PB & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0024/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2PC (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG2PC = ( m_BG2PC & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2PD (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG2PD = ( m_BG2PD & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0028/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2X_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2X_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - COMBINE_DATA(&m_BG2X); - m_gfxBG2Changed |= 1; - break; - case 0x002c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2Y_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG2Y_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - COMBINE_DATA(&m_BG2Y); - m_gfxBG2Changed |= 2; - break; - case 0x0030/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3PA (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG3PA = ( m_BG3PA & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3PB (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG3PB = ( m_BG3PB & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0034/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3PC (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BG3PC = ( m_BG3PC & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3PD (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BG3PD = ( m_BG3PD & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0038/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3X_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3X_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - COMBINE_DATA(&m_BG3X); - m_gfxBG3Changed |= 1; - break; - case 0x003c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3Y_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BG3Y_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - COMBINE_DATA(&m_BG3Y); - m_gfxBG3Changed |= 2; - break; - case 0x0040/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: WIN0H (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_WIN0H = ( m_WIN0H & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: WIN1H (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_WIN1H = ( m_WIN1H & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0044/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: WIN0V (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_WIN0V = ( m_WIN0V & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: WIN1V (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_WIN1V = ( m_WIN1V & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0048/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: WININ (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_WININ = ( m_WININ & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: WINOUT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_WINOUT = ( m_WINOUT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x004c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: MOSAIC (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_MOSAIC = ( m_MOSAIC & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - break; - case 0x0050/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BLDCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BLDCNT = ( m_BLDCNT & ~mem_mask ) | ( data & mem_mask ); - if(m_BLDCNT & BLDCNT_SFX) - { - m_fxOn = 1; - } - else - { - m_fxOn = 0; - } - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: BLDALPHA (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - m_BLDALPHA = ( m_BLDALPHA & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0054/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: BLDY (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_BLDY = ( m_BLDY & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - break; - case 0x0058/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - break; - case 0x005c/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - break; - case 0x0060/4: - if( (mem_mask) & 0x000000ff ) // SOUNDCNTL - { - m_gbsound->sound_w(space, 0, data); - } - if( (mem_mask) & 0x00ff0000 ) - { - m_gbsound->sound_w(space, 1, data>>16); // SOUND1CNT_H - } - if( (mem_mask) & 0xff000000 ) - { - m_gbsound->sound_w(space, 2, data>>24); - } - break; - case 0x0064/4: - if( (mem_mask) & 0x000000ff ) // SOUNDCNTL - { - m_gbsound->sound_w(space, 3, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->sound_w(space, 4, data>>8); // SOUND1CNT_H - } - break; - case 0x0068/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->sound_w(space, 6, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->sound_w(space, 7, data>>8); - } - break; - case 0x006c/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->sound_w(space, 8, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->sound_w(space, 9, data>>8); - } - break; - case 0x0070/4: //SND3CNTL and H - if( (mem_mask) & 0x000000ff ) // SOUNDCNTL - { - m_gbsound->sound_w(space, 0xa, data); - } - if( (mem_mask) & 0x00ff0000 ) - { - m_gbsound->sound_w(space, 0xb, data>>16); // SOUND1CNT_H - } - if( (mem_mask) & 0xff000000 ) - { - m_gbsound->sound_w(space, 0xc, data>>24); - } - break; - case 0x0074/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->sound_w(space, 0xd, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->sound_w(space, 0xe, data>>8); - } - break; - case 0x0078/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->sound_w(space, 0x10, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->sound_w(space, 0x11, data>>8); - } - break; - case 0x007c/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->sound_w(space, 0x12, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->sound_w(space, 0x13, data>>8); - } - break; - case 0x0080/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->sound_w(space, 0x14, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->sound_w(space, 0x15, data>>8); - } - - if ((mem_mask) & 0xffff0000) - { - data >>= 16; - m_SOUNDCNT_H = data; - - // DAC A reset? - if (data & 0x0800) - { - m_fifo_a_ptr = 17; - m_fifo_a_in = 17; - m_ladac->write_signed8(0x80); - m_radac->write_signed8(0x80); - } - - // DAC B reset? - if (data & 0x8000) - { - m_fifo_b_ptr = 17; - m_fifo_b_in = 17; - m_lbdac->write_signed8(0x80); - m_rbdac->write_signed8(0x80); - } - } - break; - case 0x0084/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->sound_w(space, 0x16, data); - if ((data & 0x80) && !(m_SOUNDCNT_X & 0x80)) - { - m_fifo_a_ptr = m_fifo_a_in = 17; - m_fifo_b_ptr = m_fifo_b_in = 17; - m_ladac->write_signed8(0x80); - m_radac->write_signed8(0x80); - m_lbdac->write_signed8(0x80); - m_rbdac->write_signed8(0x80); - } - m_SOUNDCNT_X = data; - } - break; - case 0x0088/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: SOUNDBIAS (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x0000ffff, ~mem_mask ); - m_SOUNDBIAS = ( m_SOUNDBIAS & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - break; - case 0x0090/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->wave_w(space, 0, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->wave_w(space, 1, data>>8); - } - if( (mem_mask) & 0x00ff0000 ) - { - m_gbsound->wave_w(space, 2, data>>16); - } - if( (mem_mask) & 0xff000000 ) - { - m_gbsound->wave_w(space, 3, data>>24); - } - break; - case 0x0094/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->wave_w(space, 4, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->wave_w(space, 5, data>>8); - } - if( (mem_mask) & 0x00ff0000 ) - { - m_gbsound->wave_w(space, 6, data>>16); - } - if( (mem_mask) & 0xff000000 ) - { - m_gbsound->wave_w(space, 7, data>>24); - } - break; - case 0x0098/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->wave_w(space, 8, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->wave_w(space, 9, data>>8); - } - if( (mem_mask) & 0x00ff0000 ) - { - m_gbsound->wave_w(space, 0xa, data>>16); - } - if( (mem_mask) & 0xff000000 ) - { - m_gbsound->wave_w(space, 0xb, data>>24); - } - break; - case 0x009c/4: - if( (mem_mask) & 0x000000ff ) - { - m_gbsound->wave_w(space, 0xc, data); - } - if( (mem_mask) & 0x0000ff00 ) - { - m_gbsound->wave_w(space, 0xd, data>>8); - } - if( (mem_mask) & 0x00ff0000 ) - { - m_gbsound->wave_w(space, 0xe, data>>16); - } - if( (mem_mask) & 0xff000000 ) - { - m_gbsound->wave_w(space, 0xf, data>>24); - } - break; - case 0x00a0/4: - m_fifo_a_in %= 17; - m_fifo_a[m_fifo_a_in++] = (data)&0xff; - m_fifo_a_in %= 17; - m_fifo_a[m_fifo_a_in++] = (data>>8)&0xff; - m_fifo_a_in %= 17; - m_fifo_a[m_fifo_a_in++] = (data>>16)&0xff; - m_fifo_a_in %= 17; - m_fifo_a[m_fifo_a_in++] = (data>>24)&0xff; - break; - case 0x00a4/4: - m_fifo_b_in %= 17; - m_fifo_b[m_fifo_b_in++] = (data)&0xff; - m_fifo_b_in %= 17; - m_fifo_b[m_fifo_b_in++] = (data>>8)&0xff; - m_fifo_b_in %= 17; - m_fifo_b[m_fifo_b_in++] = (data>>16)&0xff; - m_fifo_b_in %= 17; - m_fifo_b[m_fifo_b_in++] = (data>>24)&0xff; - break; - case 0x00b0/4: - case 0x00b4/4: - case 0x00b8/4: - - case 0x00bc/4: - case 0x00c0/4: - case 0x00c4/4: - - case 0x00c8/4: - case 0x00cc/4: - case 0x00d0/4: - - case 0x00d4/4: - case 0x00d8/4: - case 0x00dc/4: - { - int ch; - - offset -= (0xb0/4); - - ch = offset / 3; - -// printf("%08x: DMA(%d): %x to reg %d (mask %08x)\n", space.device().safe_pc(), ch, data, offset%3, ~mem_mask); - - if (((offset % 3) == 2) && ((~mem_mask & 0xffff0000) == 0)) - { - int ctrl = data>>16; - - // Note: Metroid Fusion fails if we enforce the "rising edge" requirement... (who wrote this note?) - - // Note: Caesar's Palace Advance fails if we DO NOT enforce the "rising edge" requirement - // (value @ 0x3003F9C is accidentally incremented because DMA completion interrupt is accidentally triggered @ 08002F2A) - - // retrigger/restart on a rising edge. - // also reload internal regs - if ((ctrl & 0x8000) && !(m_dma_regs[offset] & 0x80000000)) - { - m_dma_src[ch] = m_dma_regs[(ch*3)+0]; - m_dma_dst[ch] = m_dma_regs[(ch*3)+1]; - m_dma_srcadd[ch] = (ctrl>>7)&3; - m_dma_dstadd[ch] = (ctrl>>5)&3; - - COMBINE_DATA(&m_dma_regs[offset]); - m_dma_cnt[ch] = m_dma_regs[(ch*3)+2]&0xffff; - - // immediate start - if ((ctrl & 0x3000) == 0) - { - dma_exec(ch); - return; - } - } - } - - COMBINE_DATA(&m_dma_regs[offset]); - } - break; - case 0x0100/4: - case 0x0104/4: - case 0x0108/4: - case 0x010c/4: - { - double rate, clocksel; - UINT32 old_timer_regs; - - offset -= (0x100/4); - - old_timer_regs = m_timer_regs[offset]; - - m_timer_regs[offset] = (m_timer_regs[offset] & ~(mem_mask & 0xFFFF0000)) | (data & (mem_mask & 0xFFFF0000)); - -// printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, space.device().safe_pc()); - - if (ACCESSING_BITS_0_15) - { - m_timer_reload[offset] = ((m_timer_reload[offset] & ~mem_mask) | (data & mem_mask)) & 0x0000FFFF; - m_timer_recalc[offset] = 1; - } - - // enabling this timer? - if ((ACCESSING_BITS_16_31) && (data & 0x800000)) - { - double final; - - if ((old_timer_regs & 0x00800000) == 0) // start bit 0 -> 1 - { - m_timer_regs[offset] = (m_timer_regs[offset] & 0xFFFF0000) | (m_timer_reload[offset] & 0x0000FFFF); - } - - rate = 0x10000 - (m_timer_regs[offset] & 0xffff); - - clocksel = timer_clks[(m_timer_regs[offset] >> 16) & 3]; - - final = clocksel / rate; - - m_timer_hz[offset] = final; - - m_timer_recalc[offset] = 0; - -// printf("Enabling timer %d @ %f Hz\n", offset, final); - - // enable the timer - if( !(data & 0x40000) ) // if we're not in Count-Up mode - { - attotime time = attotime::from_hz(final); - GBA_ATTOTIME_NORMALIZE(time); - m_tmr_timer[offset]->adjust(time, offset, time); - } - } - } - break; - case 0x0120/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: SIOMULTI0 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_SIOMULTI0 = ( m_SIOMULTI0 & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: SIOMULTI1 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - m_SIOMULTI1 = ( m_SIOMULTI1 & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0124/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: SIOMULTI2 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_SIOMULTI2 = ( m_SIOMULTI2 & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: SIOMULTI3 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - m_SIOMULTI3 = ( m_SIOMULTI3 & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0128/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: SIOCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - // normal mode ? - if (((m_RCNT & 0x8000) == 0) && ((data & 0x2000) == 0)) - { - // start ? - if (((m_SIOCNT & 0x0080) == 0) && ((data & 0x0080) != 0)) - { - data &= ~0x0080; - // request interrupt ? - if (data & 0x4000) - { - request_irq(INT_SIO); - } - } - } - m_SIOCNT = ( m_SIOCNT & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: SIODATA8 (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - m_SIODATA8 = ( m_SIODATA8 & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0130/4: - if( (mem_mask) & 0xffff0000 ) - { -// printf("KEYCNT = %04x\n", data>>16); - verboselog(machine(), 2, "GBA IO Register Write: KEYCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - m_KEYCNT = ( m_KEYCNT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0134/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: RCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_RCNT = ( m_RCNT & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: IR (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - m_IR = ( m_IR & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0140/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: JOYCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_JOYCNT = ( m_JOYCNT & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - } - break; - case 0x0150/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: JOY_RECV_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_JOY_RECV = ( m_JOY_RECV & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: JOY_RECV_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - m_JOY_RECV = ( m_JOY_RECV & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0154/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: JOY_TRANS_LSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_JOY_TRANS = ( m_JOY_TRANS & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: JOY_TRANS_MSW (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - m_JOY_TRANS = ( m_JOY_TRANS & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); - } - break; - case 0x0158/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: JOYSTAT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_JOYSTAT = ( m_JOYSTAT & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - } - break; - case 0x0200/4: - if( (mem_mask) & 0x0000ffff ) - { -// printf("IE (%08x) = %04x raw %x (%08x) (scan %d PC %x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, data, ~mem_mask, machine.first_screen()->vpos(), space.device().safe_pc()); - m_IE = ( m_IE & ~mem_mask ) | ( data & mem_mask ); -#if 0 - if (m_IE & m_IF) - { - request_irq(m_IF); - } -#endif - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: IF (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ) + 2, ( data & mem_mask ) >> 16, ~mem_mask ); - m_IF &= ~( ( data & mem_mask ) >> 16 ); - - // if we still have interrupts, yank the IRQ line again - if (m_IF) - { - m_irq_timer->adjust(m_maincpu->clocks_to_attotime(120)); - } - } - break; - case 0x0204/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 2, "GBA IO Register Write: WAITCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_WAITCNT = ( m_WAITCNT & ~mem_mask ) | ( data & mem_mask ); - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - } - break; - case 0x0208/4: - if( (mem_mask) & 0x0000ffff ) - { - verboselog(machine(), 3, "GBA IO Register Write: IME (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, ~mem_mask ); - m_IME = ( m_IME & ~mem_mask ) | ( data & mem_mask ); - if (m_IF) - { - m_irq_timer->adjust(attotime::zero); - } - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 3, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); - } - break; - case 0x0300/4: - if( (mem_mask) & 0x0000ffff ) - { - if( (mem_mask) & 0x000000ff ) - { - verboselog(machine(), 2, "GBA IO Register Write: POSTFLG (%08x) = %02x (%08x)\n", 0x04000000 + ( offset << 2 ), data & 0x000000ff, ~mem_mask ); - m_POSTFLG = data & 0x000000ff; - } - else - { - m_HALTCNT = data & 0x000000ff; - - // either way, wait for an IRQ - m_maincpu->spin_until_interrupt(); - } - } - if( (mem_mask) & 0xffff0000 ) - { - verboselog(machine(), 2, "GBA IO Register Write: UNKNOWN (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & 0xffff0000 ) >> 16, ~mem_mask ); - } - break; - default: -// verboselog(machine, 0, "Unknown GBA I/O register write: %08x = %08x (%08x)\n", 0x04000000 + ( offset << 2 ), data, ~mem_mask ); - break; - } -} - -INLINE UINT32 COMBINE_DATA32_16(UINT32 prev, UINT32 data, UINT32 mem_mask) -{ - COMBINE_DATA(&prev); - switch(mem_mask) - { - case 0x000000ff: - prev &= 0xffff00ff; - prev |= data << 8; - break; - case 0x0000ff00: - prev &= 0xffffff00; - prev |= data >> 8; - break; - case 0x00ff0000: - prev &= 0x00ffffff; - prev |= data << 8; - break; - case 0xff000000: - prev &= 0xff00ffff; - prev |= data >> 8; - break; - default: - break; - } - return prev; -} - -WRITE32_MEMBER(gba_state::gba_pram_w) -{ - m_gba_pram[offset] = COMBINE_DATA32_16(m_gba_pram[offset], data, mem_mask); -} - -WRITE32_MEMBER(gba_state::gba_vram_w) -{ - m_gba_vram[offset] = COMBINE_DATA32_16(m_gba_vram[offset], data, mem_mask); -} - -WRITE32_MEMBER(gba_state::gba_oam_w) -{ - m_gba_oam[offset] = COMBINE_DATA32_16(m_gba_oam[offset], data, mem_mask); -} - -READ32_MEMBER(gba_state::gba_bios_r) -{ - UINT32 *rom = m_region_maincpu; - if (m_bios_hack->read()) - { - // partially patch out logo and checksum checks - // (useful to run some protos + to test homebrew) - if (ACCESSING_BITS_0_15 && (offset == 0x6fc/4)) - return 0; - } - - if (m_bios_protected != 0) - offset = (m_bios_last_address + 8) / 4; - - return rom[offset & 0x3fff]; -} - -READ32_MEMBER(gba_state::gba_10000000_r) -{ - UINT32 data; - UINT32 pc = m_maincpu->state_int(ARM7_PC); - UINT32 cpsr = m_maincpu->state_int(ARM7_CPSR); - if (T_IS_SET( cpsr)) - { - data = space.read_dword(pc + 8); - } - else - { - UINT16 insn = space.read_word(pc + 4); - data = (insn << 16) | (insn << 0); - } - logerror("%s: unmapped program memory read from %08X = %08X & %08X\n", machine().describe_context( ), 0x10000000 + (offset << 2), data, mem_mask); - return data; -} - -static ADDRESS_MAP_START( gba_map, AS_PROGRAM, 32, gba_state ) - ADDRESS_MAP_UNMAP_HIGH // for "Fruit Mura no Doubutsu Tachi" and "Classic NES Series" - AM_RANGE(0x00000000, 0x00003fff) AM_ROM AM_READ(gba_bios_r) - AM_RANGE(0x02000000, 0x0203ffff) AM_RAM AM_MIRROR(0xfc0000) - AM_RANGE(0x03000000, 0x03007fff) AM_RAM AM_MIRROR(0xff8000) - AM_RANGE(0x04000000, 0x040003ff) AM_READWRITE(gba_io_r, gba_io_w) - AM_RANGE(0x05000000, 0x050003ff) AM_RAM_WRITE(gba_pram_w) AM_SHARE("gba_pram") // Palette RAM - AM_RANGE(0x06000000, 0x06017fff) AM_RAM_WRITE(gba_vram_w) AM_SHARE("gba_vram") // VRAM - AM_RANGE(0x07000000, 0x070003ff) AM_RAM_WRITE(gba_oam_w) AM_SHARE("gba_oam") // OAM - //AM_RANGE(0x08000000, 0x0cffffff) // cart ROM + mirrors, mapped here at machine_start if a cart is present - AM_RANGE(0x10000000, 0xffffffff) AM_READ(gba_10000000_r) // for "Justice League Chronicles" (game bug) -ADDRESS_MAP_END - -static INPUT_PORTS_START( gbadv ) - PORT_START("INPUTS") - PORT_BIT( 0xfc00, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_UNUSED - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 L") PORT_PLAYER(1) // L - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 R") PORT_PLAYER(1) // R - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) // START - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_PLAYER(1) // SELECT - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("B") PORT_PLAYER(1) // B - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("A") PORT_PLAYER(1) // A - - PORT_START("SKIP_CHECK") - PORT_CONFNAME( 0x01, 0x00, "[HACK] Skip BIOS Logo check" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) -INPUT_PORTS_END - - -TIMER_CALLBACK_MEMBER(gba_state::perform_hbl) -{ - int ch, ctrl; - int scanline = machine().first_screen()->vpos(); - - // draw only visible scanlines - if (scanline < 160) - { - draw_scanline(scanline); - - for (ch = 0; ch < 4; ch++) - { - ctrl = m_dma_regs[(ch*3)+2]>>16; - - // HBL-triggered DMA? - if ((ctrl & 0x8000) && ((ctrl & 0x3000) == 0x2000)) - { - dma_exec(ch); - } - } - } - - if ((m_DISPSTAT & DISPSTAT_HBL_IRQ_EN ) != 0) - { - request_irq(INT_HBL); - } - - m_DISPSTAT |= DISPSTAT_HBL; - - m_hbl_timer->adjust(attotime::never); -} - -TIMER_CALLBACK_MEMBER(gba_state::perform_scan) -{ - int scanline; - - // clear hblank and raster IRQ flags - m_DISPSTAT &= ~(DISPSTAT_HBL|DISPSTAT_VCNT); - - scanline = machine().first_screen()->vpos(); - - // VBL is set for scanlines 160 through 226 (but not 227, which is the last line) - if (scanline >= 160 && scanline < 227) - { - m_DISPSTAT |= DISPSTAT_VBL; - - // VBL IRQ and DMA on line 160 - if (scanline == 160) - { - int ch, ctrl; - - if (m_DISPSTAT & DISPSTAT_VBL_IRQ_EN) - { - request_irq(INT_VBL); - } - - for (ch = 0; ch < 4; ch++) - { - ctrl = m_dma_regs[(ch*3)+2]>>16; - - // VBL-triggered DMA? - if ((ctrl & 0x8000) && ((ctrl & 0x3000) == 0x1000)) - { - dma_exec(ch); - } - } - } - } - else - { - m_DISPSTAT &= ~DISPSTAT_VBL; - } - - // handle VCNT match interrupt/flag - if (scanline == ((m_DISPSTAT >> 8) & 0xff)) - { - m_DISPSTAT |= DISPSTAT_VCNT; - if (m_DISPSTAT & DISPSTAT_VCNT_IRQ_EN) - { - request_irq(INT_VCNT); - } - } - - m_hbl_timer->adjust(machine().first_screen()->time_until_pos(scanline, 240)); - m_scan_timer->adjust(machine().first_screen()->time_until_pos(( scanline + 1 ) % 228, 0)); -} - -void gba_state::machine_reset() -{ - //memset(this, 0, sizeof(this)); - m_SOUNDBIAS = 0x0200; - m_SIOMULTI0 = 0xffff; - m_SIOMULTI1 = 0xffff; - m_SIOMULTI2 = 0xffff; - m_SIOMULTI3 = 0xffff; - m_KEYCNT = 0x03ff; - m_RCNT = 0x8000; - m_JOYSTAT = 0x0002; - m_gfxBG2Changed = 0; - m_gfxBG3Changed = 0; - m_gfxBG2X = 0; - m_gfxBG2Y = 0; - m_gfxBG3X = 0; - m_gfxBG3Y = 0; - - m_windowOn = 0; - m_fxOn = 0; - - m_bios_protected = 0; - - m_scan_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); - m_hbl_timer->adjust(attotime::never); - m_dma_timer[0]->adjust(attotime::never); - m_dma_timer[1]->adjust(attotime::never, 1); - m_dma_timer[2]->adjust(attotime::never, 2); - m_dma_timer[3]->adjust(attotime::never, 3); - - m_fifo_a_ptr = m_fifo_b_ptr = 17; // indicate empty - m_fifo_a_in = m_fifo_b_in = 17; - - // and clear the DACs - m_ladac->write_signed8(0x80); - m_radac->write_signed8(0x80); - m_lbdac->write_signed8(0x80); - m_rbdac->write_signed8(0x80); -} - -void gba_state::machine_start() -{ - /* create a timer to fire scanline functions */ - m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_scan),this)); - m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_hbl),this)); - m_scan_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); - - /* and one for each DMA channel */ - m_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); - m_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); - m_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); - m_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); - m_dma_timer[0]->adjust(attotime::never); - m_dma_timer[1]->adjust(attotime::never, 1); - m_dma_timer[2]->adjust(attotime::never, 2); - m_dma_timer[3]->adjust(attotime::never, 3); - - /* also one for each timer (heh) */ - m_tmr_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); - m_tmr_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); - m_tmr_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); - m_tmr_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); - m_tmr_timer[0]->adjust(attotime::never); - m_tmr_timer[1]->adjust(attotime::never, 1); - m_tmr_timer[2]->adjust(attotime::never, 2); - m_tmr_timer[3]->adjust(attotime::never, 3); - - /* and an IRQ handling timer */ - m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::handle_irq),this)); - m_irq_timer->adjust(attotime::never); - - // install the cart ROM & SRAM into the address map, if present - if (m_cart->exists()) - { - m_maincpu->space(AS_PROGRAM).install_read_bank(0x08000000, 0x09ffffff, 0, 0, "rom1"); - m_maincpu->space(AS_PROGRAM).install_read_bank(0x0a000000, 0x0bffffff, 0, 0, "rom2"); - m_maincpu->space(AS_PROGRAM).install_read_bank(0x0c000000, 0x0cffffff, 0, 0, "rom3"); - - std::string region_tag; - memory_region *cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GBASLOT_ROM_REGION_TAG).c_str()); - - // install ROM accesses - membank("rom1")->set_base(cart_rom->base()); - membank("rom2")->set_base(cart_rom->base()); - membank("rom3")->set_base(cart_rom->base()); - - // add nvram to save state - m_cart->save_nvram(); - - // install the cart NVRAM handlers if necessary - if (m_cart->get_type() == GBA_SRAM) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0xe000000, 0xe00ffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000000, 0xe00ffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); - } - if (m_cart->get_type() == GBA_EEPROM || m_cart->get_type() == GBA_EEPROM4 || m_cart->get_type() == GBA_EEPROM64) - { - // for games larger than 16MB the actual range is smaller but read_ram/write_ram handles that! - m_maincpu->space(AS_PROGRAM).install_read_handler(0xd000000, 0xdffffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd000000, 0xdffffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); - } - // merge the two flash and mask accesses in read_ram?!? - if (m_cart->get_type() == GBA_FLASH || m_cart->get_type() == GBA_FLASH512) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0xe000000, 0xe00ffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000000, 0xe00ffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); - } - if (m_cart->get_type() == GBA_FLASH1M) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0xe000000, 0xe01ffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000000, 0xe01ffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); - } - } - - save_item(NAME(m_DISPSTAT)); - save_item(NAME(m_BG2X)); - save_item(NAME(m_BG2Y)); - save_item(NAME(m_BG3X)); - save_item(NAME(m_BG3Y)); - save_item(NAME(m_DISPCNT)); - save_item(NAME(m_GRNSWAP)); - save_item(NAME(m_BG0CNT)); - save_item(NAME(m_BG1CNT)); - save_item(NAME(m_BG2CNT)); - save_item(NAME(m_BG3CNT)); - save_item(NAME(m_BG0HOFS)); - save_item(NAME(m_BG0VOFS)); - save_item(NAME(m_BG1HOFS)); - save_item(NAME(m_BG1VOFS)); - save_item(NAME(m_BG2HOFS)); - save_item(NAME(m_BG2VOFS)); - save_item(NAME(m_BG3HOFS)); - save_item(NAME(m_BG3VOFS)); - save_item(NAME(m_BG2PA)); - save_item(NAME(m_BG2PB)); - save_item(NAME(m_BG2PC)); - save_item(NAME(m_BG2PD)); - save_item(NAME(m_BG3PA)); - save_item(NAME(m_BG3PB)); - save_item(NAME(m_BG3PC)); - save_item(NAME(m_BG3PD)); - save_item(NAME(m_WIN0H)); - save_item(NAME(m_WIN1H)); - save_item(NAME(m_WIN0V)); - save_item(NAME(m_WIN1V)); - save_item(NAME(m_WININ)); - save_item(NAME(m_WINOUT)); - save_item(NAME(m_MOSAIC)); - save_item(NAME(m_BLDCNT)); - save_item(NAME(m_BLDALPHA)); - save_item(NAME(m_BLDY)); - save_item(NAME(m_SOUNDCNT_X)); - save_item(NAME(m_SOUNDCNT_H)); - save_item(NAME(m_SOUNDBIAS)); - save_item(NAME(m_SIOMULTI0)); - save_item(NAME(m_SIOMULTI1)); - save_item(NAME(m_SIOMULTI2)); - save_item(NAME(m_SIOMULTI3)); - save_item(NAME(m_SIOCNT)); - save_item(NAME(m_SIODATA8)); - save_item(NAME(m_KEYCNT)); - save_item(NAME(m_RCNT)); - save_item(NAME(m_JOYCNT)); - save_item(NAME(m_JOY_RECV)); - save_item(NAME(m_JOY_TRANS)); - save_item(NAME(m_JOYSTAT)); - save_item(NAME(m_IR)); - save_item(NAME(m_IE)); - save_item(NAME(m_IF)); - save_item(NAME(m_IME)); - save_item(NAME(m_WAITCNT)); - save_item(NAME(m_POSTFLG)); - save_item(NAME(m_HALTCNT)); - save_item(NAME(m_windowOn)); - save_item(NAME(m_fxOn)); - save_item(NAME(m_gfxBG2Changed)); - save_item(NAME(m_gfxBG3Changed)); - save_item(NAME(m_gfxBG2X)); - save_item(NAME(m_gfxBG2Y)); - save_item(NAME(m_gfxBG3X)); - save_item(NAME(m_gfxBG3Y)); - save_item(NAME(m_dma_regs)); - save_item(NAME(m_dma_src)); - save_item(NAME(m_dma_dst)); - save_item(NAME(m_dma_cnt)); - save_item(NAME(m_dma_srcadd)); - save_item(NAME(m_dma_dstadd)); - save_item(NAME(m_timer_regs)); - save_item(NAME(m_timer_reload)); - save_item(NAME(m_timer_recalc)); - save_item(NAME(m_timer_hz)); - save_item(NAME(m_fifo_a_ptr)); - save_item(NAME(m_fifo_b_ptr)); - save_item(NAME(m_fifo_a_in)); - save_item(NAME(m_fifo_b_in)); - save_item(NAME(m_fifo_a)); - save_item(NAME(m_fifo_b)); - save_item(NAME(m_xferscan)); - save_item(NAME(m_bios_last_address)); - save_item(NAME(m_bios_protected)); -} - - - -static SLOT_INTERFACE_START(gba_cart) - SLOT_INTERFACE_INTERNAL("gba_rom", GBA_ROM_STD) - SLOT_INTERFACE_INTERNAL("gba_sram", GBA_ROM_SRAM) - SLOT_INTERFACE_INTERNAL("gba_eeprom", GBA_ROM_EEPROM) - SLOT_INTERFACE_INTERNAL("gba_eeprom_4k", GBA_ROM_EEPROM) - SLOT_INTERFACE_INTERNAL("gba_eeprom_64k", GBA_ROM_EEPROM64) - SLOT_INTERFACE_INTERNAL("gba_flash", GBA_ROM_FLASH) // Panasonic - SLOT_INTERFACE_INTERNAL("gba_flash_512", GBA_ROM_FLASH) // Panasonic - SLOT_INTERFACE_INTERNAL("gba_flash_1m", GBA_ROM_FLASH1M) // Sanyo -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( gbadv, gba_state ) - - MCFG_CPU_ADD("maincpu", ARM7, 16777216) - MCFG_CPU_PROGRAM_MAP(gba_map) - - MCFG_SCREEN_ADD("gbalcd", RASTER) // htot hst vwid vtot vst vis - MCFG_SCREEN_RAW_PARAMS(16777216/4, 308, 0, 240, 228, 0, 160) - MCFG_SCREEN_UPDATE_DRIVER(gba_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 32768) - MCFG_PALETTE_INIT_OWNER(gba_state, gba) - - MCFG_SPEAKER_STANDARD_STEREO("spkleft", "spkright") - MCFG_SOUND_ADD("custom", GAMEBOY, 0) - MCFG_SOUND_ROUTE(0, "spkleft", 0.50) - MCFG_SOUND_ROUTE(1, "spkright", 0.50) - MCFG_SOUND_ADD("direct_a_left", DAC, 0) // GBA direct sound A left - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "spkleft", 0.50) - MCFG_SOUND_ADD("direct_a_right", DAC, 0) // GBA direct sound A right - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "spkright", 0.50) - MCFG_SOUND_ADD("direct_b_left", DAC, 0) // GBA direct sound B left - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "spkleft", 0.50) - MCFG_SOUND_ADD("direct_b_right", DAC, 0) // GBA direct sound B right - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "spkright", 0.50) - - MCFG_GBA_CARTRIDGE_ADD("cartslot", gba_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","gba") -MACHINE_CONFIG_END - - - -ROM_START( gba ) - ROM_REGION( 0x4000, "maincpu", 0 ) - ROM_LOAD( "gba.bin", 0x000000, 0x004000, CRC(81977335) SHA1(300c20df6731a33952ded8c436f7f186d25d3492) ) -ROM_END - - - -// this emulates the GBA's hardware protection: the BIOS returns only zeros when the PC is not in it, -// and some games verify that as a protection check (notably Metroid Fusion) -DIRECT_UPDATE_MEMBER(gba_state::gba_direct) -{ - if (address > 0x4000) - { - m_bios_protected = 1; - } - else - { - m_bios_protected = 0; - m_bios_last_address = address; - } - return address; -} - - -DRIVER_INIT_MEMBER(gba_state,gbadv) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(gba_state::gba_direct), this)); -} - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS(2001, gba, 0, 0, gbadv, gbadv, gba_state, gbadv, "Nintendo", "Game Boy Advance", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/geneve.c b/src/mess/drivers/geneve.c deleted file mode 100644 index c366b70b2e7..00000000000 --- a/src/mess/drivers/geneve.c +++ /dev/null @@ -1,766 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Michael Zapf -/****************************************************************************** - MESS Driver for the Myarc Geneve 9640. - - The Geneve has two operation modes. One is compatible with the TI-99/4a, - the other is not. - - - General architecture: - - TMS9995@12MHz (including 256 bytes of on-chip 16-bit RAM and a timer), - V9938, SN76496 (compatible with TMS9919), TMS9901, MM58274 RTC, 512 kbytes - of 1-wait-state CPU RAM (expandable to almost 2 Mbytes), 32 kbytes of - 0-wait-state CPU RAM (expandable to 64 kbytes), 128 kbytes of VRAM - (expandable to 192 kbytes). - - - Memory map: - - 64-kbyte CPU address space is mapped to a 2-Mbyte virtual address space. - 8 8-kbyte pages are available simultaneously, out of a total of 256. - - Page map (regular console): - >00->3f: 512kbytes of CPU RAM (pages >36 and >37 are used to emulate - cartridge CPU ROMs in ti99 mode, and pages >38 through >3f are used to - emulate console and cartridge GROMs in ti99 mode) - >40->7f: optional Memex RAM (except >7a and >7c that are mirrors of >ba and - >bc?) - >80->b7: PE-bus space using spare address lines (AMA-AMC)? Used by RAM - extension (Memex or PE-Bus 512k card). - >b8->bf: PE-bus space (most useful pages are >ba: DSR space and >bc: speech - synthesizer page; other pages are used by RAM extension) - >c0->e7: optional Memex RAM - >e8->ef: 64kbytes of 0-wait-state RAM (with 32kbytes of SRAM installed, - only even pages (>e8, >ea, >ec and >ee) are available) - >f0->f1: boot ROM - >f2->fe: optional Memex RAM? (except >fa and >fc that are mirrors of >ba - and >bc?) - >ff: always empty? - - Page map (genmod console): - >00->39, >40->b9, >bb, >bd->ef, f2->fe: Memex RAM (except >3a, >3c, >7a, - >7c, >fa and >fc that are mirrors of >ba and >bc?) (I don't know if - >e8->ef is on the Memex board or the Geneve motherboard) - >ba: DSR space - >bc: speech synthesizer space - >f0->f1: boot ROM - >ff: always empty? - - >00->3f: switch-selectable(?): 512kbytes of onboard RAM (1-wait-state DRAM) - or first 512kbytes of the Memex Memory board (0-wait-state SRAM). The - latter setting is incompatible with TI mode. - - Note that >bc is actually equivalent to >8000->9fff on the /4a bus, - therefore the speech synthesizer is only available at offsets >1800->1bff - (read port) and >1c00->1fff (write port). OTOH, if you installed a FORTI - sound card, it will be available in the same page at offsets >0400->7ff. - - - Unpaged locations (ti99 mode): - >8000->8007: memory page registers (>8000 for page 0, >8001 for page 1, - etc. register >8003 is ignored (this page is hard-wired to >36->37). - >8008: key buffer - >8009->800f: ??? - >8010->801f: clock chip - >8400->9fff: sound, VDP, speech, and GROM registers (according to one - source, the GROM and sound registers are only available if page >3 - is mapped in at location >c000 (register 6). I am not sure the Speech - registers are implemented, though I guess they are.) - Note that >8020->83ff is mapped to regular CPU RAM according to map - register 4. - - Unpaged locations (native mode): - >f100: VDP data port (read/write) - >f102: VDP address/status port (read/write) - >f104: VDP port 2 - >f106: VDP port 3 - >f108->f10f: VDP mirror (used by Barry Boone's converted Tomy cartridges) - >f110->f117: memory page registers (>f110 for page 0, >f111 for page 1, - etc.) - >f118: key buffer - >f119->f11f: ??? - >f120: sound chip - >f121->f12f: ??? - >f130->f13f: clock chip - - Unpaged locations (tms9995 locations): - >f000->f0fb and >fffc->ffff: tms9995 RAM - >fffa->fffb: tms9995 timer register - Note: accessing tms9995 locations will also read/write corresponding paged - locations. - - - GROM emulator: - - The GPL interface is accessible only in TI99 mode. GPL data is fetched - from pages >38->3f. It uses a straight 16-bit address pointer. The - address pointer is incremented when the read data and write data ports - are accessed, and when the second byte of the GPL address is written. A - weird consequence of this is the fact that GPL data is always off by one - byte, i.e. GPL bytes 0, 1, 2... are stored in bytes 1, 2, 3... of pages - >38->3f (byte 0 of page >38 corresponds to GPL address >ffff). - - I think that I have once read that the geneve GROM emulator does not - emulate wrap-around within a GROM, i.e. address >1fff is followed by >2000 - (instead of >0000 with a real GROM). - - There are two ways to implement GPL address load and store. - One is maintaining 2 flags (one for address read and one for address write) - that tell if you are accessing address LSB: these flags must be cleared - whenever data is read, and the read flag must be cleared when the write - address port is written to. - The other is to shift the register and always read/write the MSByte of the - address pointer. The LSByte is copied to the MSbyte when the address is - read, whereas the former MSByte is copied to the LSByte when the address is - written. The address pointer must be incremented after the address is - written to. It will not harm if it is incremented after the address is - read, provided the LSByte has been cleared. - - - Cartridge emulator: - - The cartridge interface is in the >6000->7fff area. - - If CRU bit @>F7C is set, the cartridge area is always mapped to virtual - page >36. Writes in the >6000->6fff area are ignored if the CRU bit @>F7D - is 0, whereas writes in the >7000->7fff area are ignored if the CRU bit - @>F7E is 0. - - If CRU bit @>F7C is clear, the cartridge area is mapped either to virtual - page >36 or to page >37 according to which page is currently selected. - Writing data to address >6000->7fff will select page >36 if A14 is 0, - >37 if A14 is 1. - - - CRU map: - - Base >0000: tms9901 - tms9901 pin assignment: - int1: external interrupt (INTA on PE-bus) (connected to tms9995 (int4/EC)* - pin as well) - int2: VDP interrupt - int3-int7: joystick port inputs (fire, left, right, down, up) - int8: keyboard interrupt (asserted when key buffer full) - int9/p13: unused - int10/p12: third mouse button - int11/p11: clock interrupt? - int12/p10: INTB from PE-bus - int13/p9: (used as output) - int14/p8: unused - int15/p7: (used as output) - p0: PE-bus reset line - p1: VDP reset line - p2: joystick select (0 for joystick 1, 1 for joystick 2) - p3-p5: unused - p6: keyboard reset line - p7/int15: external mem cycles 0=long, 1=short - p9/int13: vdp wait cycles 1=add 15 cycles, 0=add none - - Base >1EE0 (>0F70): tms9995 flags and geneve mode register - bits 0-1: tms9995 flags - Bits 2-4: tms9995 interrupt state register - Bits 5-15: tms9995 user flags - overlaps geneve mode, but hopefully the - geneve registers are write-only, so no real conflict happens - TMS9995 user flags: - Bit 5: 0 if NTSC, 1 if PAL video - Bit 6: unused??? - Bit 7: some keyboard flag, set to 1 if caps is on - Geneve gate array + TMS9995 user flags: - Bit 8: 1 = allow keyboard clock - Bit 9: 0 = clear keyboard input buffer, 1 = allow keyboard buffer to be - loaded - Bit 10: 1 = geneve mode, 0 = ti99 mode - Bit 11: 1 = ROM mode, 0 = map mode - Bit 12: 0 = Enable cartridge paging - Bit 13: 0 = protect cartridge range >6000->6fff - Bit 14: 0 = protect cartridge range >7000->7fff - bit 15: 1 = add 1 extra wait state when accessing 0-wait-state SRAM??? - - - Keyboard interface: - - The XT keyboard interface is described in various places on the internet, - like (http://www-2.cs.cmu.edu/afs/cs/usr/jmcm/www/info/key2.txt). It is a - synchronous unidirectional serial interface: the data line is driven by the - keyboard to send data to the CPU; the CTS/clock line has a pull up resistor - and can be driven low by both keyboard and CPU. To send data to the CPU, - the keyboard pulses the clock line low 9 times, and the Geneve samples all - 8 bits of data (plus one start bit) on each falling edge of the clock. - When the key code buffer is full, the Geneve gate array asserts the kbdint* - line (connected to 9901 INT8*). The Geneve gate array will hold the - CTS/clock line low as long as the keyboard buffer is full or CRU bit @>F78 - is 0. Writing a 0 to >F79 will clear the Geneve keyboard buffer, and - writing a 1 will resume normal operation: you need to write a 0 to >F78 - before clearing >F79, or the keyboard will be enabled to send data the gate - array when >F79 is is set to 0, and any such incoming data from the - keyboard will be cleared as soon as it is buffered by the gate array. - - Original version 2003 by Raphael Nabet - - Rewritten 2012 by Michael Zapf -******************************************************************************/ - - -#include "emu.h" -#include "cpu/tms9900/tms9995.h" -#include "machine/tms9901.h" -#include "machine/mm58274c.h" -#include "sound/sn76496.h" - -#include "bus/ti99x/genboard.h" -#include "bus/ti99x/videowrp.h" -#include "bus/ti99x/joyport.h" - -#include "bus/ti99_peb/peribox.h" - -#define TRACE_READY 0 -#define TRACE_LINES 0 -#define TRACE_CRU 0 - -#define SRAM_SIZE 384*1024 // maximum SRAM expansion on-board -#define DRAM_SIZE 512*1024 - -class geneve_state : public driver_device -{ -public: - geneve_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cpu(*this, "maincpu"), - m_tms9901(*this, TMS9901_TAG), - m_keyboard(*this, GKEYBOARD_TAG), - m_mapper(*this, GMAPPER_TAG), - m_peribox(*this, PERIBOX_TAG), - m_mouse(*this, GMOUSE_TAG), - m_joyport(*this,JOYPORT_TAG) { } - - // CRU (Communication Register Unit) handling - DECLARE_READ8_MEMBER(cruread); - DECLARE_WRITE8_MEMBER(cruwrite); - - // Connections with the system interface TMS9901 - DECLARE_READ8_MEMBER(read_by_9901); - DECLARE_WRITE_LINE_MEMBER(peripheral_bus_reset); - DECLARE_WRITE_LINE_MEMBER(VDP_reset); - DECLARE_WRITE_LINE_MEMBER(joystick_select); - DECLARE_WRITE_LINE_MEMBER(extbus_wait_states); - DECLARE_WRITE_LINE_MEMBER(video_wait_states); - - DECLARE_WRITE_LINE_MEMBER(clock_out); - DECLARE_WRITE_LINE_MEMBER(dbin_line); - - DECLARE_WRITE8_MEMBER(external_operation); - - DECLARE_WRITE8_MEMBER(tms9901_interrupt); - - DECLARE_WRITE_LINE_MEMBER( keyboard_interrupt ); - - required_device m_cpu; - required_device m_tms9901; - required_device m_keyboard; - required_device m_mapper; - required_device m_peribox; - required_device m_mouse; - required_device m_joyport; - - DECLARE_WRITE_LINE_MEMBER( inta ); - DECLARE_WRITE_LINE_MEMBER( intb ); - DECLARE_WRITE_LINE_MEMBER( ext_ready ); - DECLARE_WRITE_LINE_MEMBER( mapper_ready ); - - DECLARE_DRIVER_INIT(geneve); - virtual void machine_start(); - virtual void machine_reset(); - TIMER_DEVICE_CALLBACK_MEMBER(geneve_hblank_interrupt); - - DECLARE_WRITE_LINE_MEMBER(set_tms9901_INT2_from_v9938); - - line_state m_inta; - line_state m_intb; - line_state m_int2; - line_state m_keyint; - line_state m_video_wait; // reflects the line to the mapper for CRU query - - int m_ready_line, m_ready_line1; -}; - -/* - Memory map -*/ - -static ADDRESS_MAP_START(memmap, AS_PROGRAM, 8, geneve_state) - AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(GMAPPER_TAG, geneve_mapper_device, readm, writem) AM_DEVSETOFFSET(GMAPPER_TAG, geneve_mapper_device, setoffset) -ADDRESS_MAP_END - -/* - CRU map - The TMS9901 is fully decoded, no mirroring, so we have 32 bits for it, - and the rest goes to the board (and from there to the PEB) - TMS9995 has a full 15-bit CRU bit address space (attached to A0-A14) - TODO: Check whether A0-A2 are available for CRU addressing since those - bits are usually routed through the mapper first. -*/ -static ADDRESS_MAP_START(crumap, AS_IO, 8, geneve_state) - AM_RANGE(0x0000, 0x0003) AM_DEVREAD(TMS9901_TAG, tms9901_device, read) - AM_RANGE(0x0000, 0x0fff) AM_READ( cruread ) - - AM_RANGE(0x0000, 0x001f) AM_DEVWRITE(TMS9901_TAG, tms9901_device, write) - AM_RANGE(0x0000, 0x7fff) AM_WRITE( cruwrite ) -ADDRESS_MAP_END - -/* TI joysticks. The keyboard is implemented in genboard.c. */ -static INPUT_PORTS_START(geneve) - - PORT_START( "MODE" ) - PORT_CONFNAME( 0x01, 0x00, "Operating mode" ) PORT_CHANGED_MEMBER(PERIBOX_TAG, peribox_device, genmod_changed, 0) - PORT_CONFSETTING( 0x00, "Standard" ) - PORT_CONFSETTING( GENMOD, "GenMod" ) - - PORT_START( "BOOTROM" ) - PORT_CONFNAME( 0x03, GENEVE_098, "Boot ROM" ) PORT_CHANGED_MEMBER(GMAPPER_TAG, geneve_mapper_device, settings_changed, 3) - PORT_CONFSETTING( GENEVE_098, "Version 0.98" ) - PORT_CONFSETTING( GENEVE_100, "Version 1.00" ) - PORT_CONFSETTING( GENEVE_PFM512, "PFM 512" ) - PORT_CONFSETTING( GENEVE_PFM512A, "PFM 512A" ) - - PORT_START( "SRAM" ) - PORT_CONFNAME( 0x03, 0x01, "Onboard SRAM" ) PORT_CONDITION( "MODE", 0x01, EQUALS, 0x00 ) - PORT_CONFSETTING( 0x00, "32 KiB" ) - PORT_CONFSETTING( 0x01, "64 KiB" ) - PORT_CONFSETTING( 0x02, "384 KiB" ) - - PORT_START( "GENMODDIPS" ) - PORT_DIPNAME( GM_TURBO, 0x00, "Genmod Turbo mode") PORT_CONDITION( "MODE", 0x01, EQUALS, GENMOD ) PORT_CHANGED_MEMBER(GMAPPER_TAG, geneve_mapper_device, settings_changed, 1) - PORT_CONFSETTING( 0x00, DEF_STR( Off )) - PORT_CONFSETTING( GM_TURBO, DEF_STR( On )) - PORT_DIPNAME( GM_TIM, GM_TIM, "Genmod TI mode") PORT_CONDITION( "MODE", 0x01, EQUALS, GENMOD ) PORT_CHANGED_MEMBER(GMAPPER_TAG, geneve_mapper_device, settings_changed, 2) - PORT_CONFSETTING( 0x00, DEF_STR( Off )) - PORT_CONFSETTING( GM_TIM, DEF_STR( On )) - -INPUT_PORTS_END - -/**************************************************************************** - CRU handling -*****************************************************************************/ - -#define CRU_CONTROL_BASE 0x1ee0 -#define CRU_SSTEP_BASE 0x13c0 - -WRITE8_MEMBER ( geneve_state::cruwrite ) -{ - int addroff = offset << 1; - - // Single step - // 13c0 - 13fe: 0001 0011 11xx xxx0 - if ((addroff & 0xffc0) == CRU_SSTEP_BASE) - { - int bit = (addroff & 0x003e)>>1; - logerror("geneve: Single step not implemented; bit %d set to %d\n", bit, data); - return; - } - - if ((addroff & 0xffe0) == CRU_CONTROL_BASE) - { - int bit = (addroff & 0x001e)>>1; - switch (bit) - { - case 5: - // No one really cares... - if (TRACE_CRU) logerror("geneve: Set PAL flag = %02x\n", data); - // m_palvideo = (data!=0); - break; - case 7: - // m_capslock = (data!=0); - if (TRACE_CRU) logerror("geneve: Set capslock flag = %02x\n", data); - break; - case 8: - if (TRACE_CRU) logerror("geneve: Set keyboard clock flag = %02x\n", data); - m_keyboard->clock_control((data!=0)? ASSERT_LINE : CLEAR_LINE); - break; - case 9: - if (TRACE_CRU) logerror("geneve: Set keyboard scan flag = %02x\n", data); - m_keyboard->send_scancodes((data!=0)? ASSERT_LINE : CLEAR_LINE); - break; - case 10: - if (TRACE_CRU) logerror("geneve: Geneve mode = %02x\n", data); - m_mapper->set_geneve_mode(data!=0); - break; - case 11: - if (TRACE_CRU) logerror("geneve: Direct mode = %02x\n", data); - m_mapper->set_direct_mode(data!=0); - break; - case 12: - if (TRACE_CRU) logerror("geneve: Cartridge size 8K = %02x\n", data); - m_mapper->set_cartridge_size((data!=0)? 0x2000 : 0x4000); - break; - case 13: - if (TRACE_CRU) logerror("geneve: Cartridge writable 6000 = %02x\n", data); - m_mapper->set_cartridge_writable(0x6000, (data!=0)); - break; - case 14: - if (TRACE_CRU) logerror("geneve: Cartridge writable 7000 = %02x\n", data); - m_mapper->set_cartridge_writable(0x7000, (data!=0)); - break; - case 15: - if (TRACE_CRU) logerror("geneve: Extra wait states = %02x\n", data==0); - m_mapper->set_extra_waitstates(data==0); // let's use the inverse semantics - break; - default: - logerror("geneve: set CRU address %04x=%02x ignored\n", addroff, data); - break; - } - } - else - { - m_peribox->cruwrite(space, addroff, data); - } -} - -READ8_MEMBER( geneve_state::cruread ) -{ - UINT8 value = 0; - int addroff = offset << 4; - - // Single step - // 13c0 - 13fe: 0001 0011 11xx xxx0 - if ((addroff & 0xffc0) == CRU_SSTEP_BASE) - { - int bit = (addroff & 0x003e)>>1; - logerror("geneve: Single step not implemented; attempting to read bit %d\n", bit); - return value; - } - - // TMS9995-internal CRU locations (1ee0-1efe) are handled within the processor - // so we just don't arrive here - - // Propagate the CRU access to external devices - m_peribox->crureadz(space, addroff, &value); - return value; -} - -/*********************************************************************** - CRU callbacks -***********************************************************************/ - -READ8_MEMBER( geneve_state::read_by_9901 ) -{ - int answer = 0; - - switch (offset & 0x03) - { - case TMS9901_CB_INT7: - // - // Read pins INT3*-INT7* of Geneve's 9901. - // bit 1: INTA status - // bit 2: INT2 status - // bit 3-7: joystick status - // - // |K|K|K|K|K|I2|I1|C| - // negative logic - if (m_inta==CLEAR_LINE) answer |= 0x02; - if (m_int2==CLEAR_LINE) answer |= 0x04; - answer |= m_joyport->read_port()<<3; - break; - - case TMS9901_INT8_INT15: - // Read pins INT8*-INT15* of Geneve 9901. - // - // bit 0: keyboard interrupt - // bit 1: unused - // bit 2: mouse left button - // (bit 3: clock interrupt) - // bit 4: INTB from PE-bus - // bit 5 & 7: used as output - // bit 6: unused - if (m_keyint==CLEAR_LINE) answer |= 0x01; - if (m_mouse->left_button()==CLEAR_LINE) answer |= 0x04; - // TODO: add clock interrupt - if (m_intb==CLEAR_LINE) answer |= 0x10; - if (m_video_wait==ASSERT_LINE) answer |= 0x20; - // TODO: PAL pin 5 - if (TRACE_LINES) logerror("geneve: INT15-8 = %02x\n", answer); - break; - - case TMS9901_P0_P7: - // Read pins P0-P7 of TMS9901. All pins are configured as outputs, so nothing here. - break; - - case TMS9901_P8_P15: - // Read pins P8-P15 of TMS 9901. - // bit 4: mouse left button - // video wait is an output; no input possible here - if (m_intb==CLEAR_LINE) answer |= 0x04; // mirror from above - // TODO: 0x08 = real-time clock int - if (m_mouse->left_button()==CLEAR_LINE) answer |= 0x10; // mirror from above - if (m_keyint==CLEAR_LINE) answer |= 0x40; - - // Joystick up (mirror of bit 7) - if ((m_joyport->read_port() & 0x10)==0) answer |= 0x80; - break; - } - return answer; -} - -/* - Write PE bus reset line -*/ -WRITE_LINE_MEMBER( geneve_state::peripheral_bus_reset ) -{ - logerror("geneve: Peripheral bus reset request; not implemented yet.\n"); -} - -/* - Write VDP reset line -*/ -WRITE_LINE_MEMBER( geneve_state::VDP_reset ) -{ - logerror("geneve: Video reset request; not implemented yet.\n"); -} - -/* - Write joystick select line. 1 selects joystick 1 (pin 7), 0 selects joystick 2 (pin 2) -*/ -WRITE_LINE_MEMBER( geneve_state::joystick_select ) -{ - m_joyport->write_port((state==ASSERT_LINE)? 1:2); -} - -/* - Write external mem cycles (0=long, 1=short) -*/ -WRITE_LINE_MEMBER( geneve_state::extbus_wait_states ) -{ - logerror("geneve: External bus wait states set to %d, not implemented yet.\n", state); -} - -/* - Write vdp wait cycles (1=add 14 cycles, 0=add none) - see above for waitstate handling -*/ -WRITE_LINE_MEMBER( geneve_state::video_wait_states ) -{ - if (TRACE_LINES) logerror("geneve: Video wait states set to %d\n", state); - m_mapper->set_video_waitstates(state==ASSERT_LINE); - m_video_wait = (state!=0)? ASSERT_LINE : CLEAR_LINE; -} - -/* - Called by the 9901 core whenever the state of INTREQ and IC0-3 changes. - As with the TI-99/4A, the interrupt level is delivered as the offset, - but again it is ignored. Anyway, the TMS9995 has only two external inputs - (INT1 and INT4). -*/ -WRITE8_MEMBER( geneve_state::tms9901_interrupt ) -{ - /* INTREQ is connected to INT1. */ - m_cpu->set_input_line(INT_9995_INT1, data); -} - -/******************************************************************* - Signal lines -*******************************************************************/ - -/* - inta is connected to both tms9901 IRQ1 line and to tms9995 INT4/EC line. -*/ -WRITE_LINE_MEMBER( geneve_state::inta ) -{ - m_inta = (state!=0)? ASSERT_LINE : CLEAR_LINE; - m_tms9901->set_single_int(1, state); - m_cpu->set_input_line(INT_9995_INT4, state); -} - -/* - intb is connected to tms9901 IRQ12 line. -*/ -WRITE_LINE_MEMBER( geneve_state::intb ) -{ - m_intb = (state!=0)? ASSERT_LINE : CLEAR_LINE; - m_tms9901->set_single_int(12, state); -} - -WRITE_LINE_MEMBER( geneve_state::ext_ready ) -{ - if (TRACE_READY) logerror("geneve: READY level (ext) = %02x\n", state); - m_ready_line = state; - m_cpu->set_ready((m_ready_line == ASSERT_LINE && m_ready_line1 == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER( geneve_state::mapper_ready ) -{ - if (TRACE_READY) logerror("geneve: READY level (mapper) = %02x\n", state); - m_ready_line1 = state; - m_cpu->set_ready((m_ready_line == ASSERT_LINE && m_ready_line1 == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE); -} - -/* - set the state of int2 (called by the v9938 core) -*/ -WRITE_LINE_MEMBER(geneve_state::set_tms9901_INT2_from_v9938) -{ - m_int2 = (state!=0)? ASSERT_LINE : CLEAR_LINE; - m_tms9901->set_single_int(2, state); -} - -/* - Interrupt from the keyboard. -*/ -WRITE_LINE_MEMBER( geneve_state::keyboard_interrupt ) -{ - m_keyint = (state!=0)? ASSERT_LINE : CLEAR_LINE; - m_tms9901->set_single_int(8, state); -} - -/* - scanline interrupt -*/ -TIMER_DEVICE_CALLBACK_MEMBER(geneve_state::geneve_hblank_interrupt) -{ - int scanline = param; - - if (scanline == 0) // was 262 - { - // TODO - // The technical docs do not say anything about the way the mouse - // is queried. It sounds plausible that the mouse is sampled once - // per vertical interrupt; however, the mouse sometimes shows jerky - // behaviour. Maybe we should use an autonomous timer with a higher - // rate? -> to be checked - m_mouse->poll(); - } -} - -WRITE8_MEMBER( geneve_state::external_operation ) -{ - static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; - if (offset != IDLE_OP) logerror("geneve: External operation %s not implemented on Geneve board\n", extop[offset]); -} - -/* - Clock line from the CPU. Used to control wait state generation. -*/ -WRITE_LINE_MEMBER( geneve_state::clock_out ) -{ - m_mapper->clock_in(state); -} - -/* - DBIN line from the CPU. Used to control wait state generation. -*/ -WRITE_LINE_MEMBER( geneve_state::dbin_line ) -{ - m_mapper->dbin_in(state); -} - -DRIVER_INIT_MEMBER(geneve_state,geneve) -{ -} - -void geneve_state::machine_start() -{ -} - -/* - Reset the machine. -*/ -void geneve_state::machine_reset() -{ - m_inta = CLEAR_LINE; // flag reflecting the INTA line - m_intb = CLEAR_LINE; // flag reflecting the INTB line - m_int2 = CLEAR_LINE; // flag reflecting the INT2 line - m_keyint = CLEAR_LINE; - - // No automatic wait state (auto wait state is enabled with READY=CLEAR at RESET) - m_cpu->set_ready(ASSERT_LINE); - m_cpu->set_hold(CLEAR_LINE); - - m_ready_line = m_ready_line1 = ASSERT_LINE; - - m_peribox->set_genmod(ioport("MODE")->read()==GENMOD); - - m_joyport->write_port(0x01); // select Joystick 1 -} - -static MACHINE_CONFIG_START( geneve_60hz, geneve_state ) - // basic machine hardware - // TMS9995 CPU @ 12.0 MHz - MCFG_TMS99xx_ADD("maincpu", TMS9995, 12000000, memmap, crumap) - MCFG_TMS9995_EXTOP_HANDLER( WRITE8(geneve_state, external_operation) ) - MCFG_TMS9995_CLKOUT_HANDLER( WRITELINE(geneve_state, clock_out) ) - MCFG_TMS9995_DBIN_HANDLER( WRITELINE(geneve_state, dbin_line) ) - - // video hardware - // Although we should have a 60 Hz screen rate, we have to set it to 30 here. - // The reason is that that the number of screen lines is counted twice for the - // interlace mode, but in non-interlace modes only half of the lines are - // painted. Accordingly, the full set of lines is refreshed at 30 Hz, - // not 60 Hz. This should be fixed in the v9938 emulation. - MCFG_TI_V9938_ADD(VIDEO_SYSTEM_TAG, 30, SCREEN_TAG, 2500, 512+32, (212+28)*2, geneve_state, set_tms9901_INT2_from_v9938) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", geneve_state, geneve_hblank_interrupt, SCREEN_TAG, 0, 1) /* 262.5 in 60Hz, 312.5 in 50Hz */ - - // Main board components - MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) - MCFG_TMS9901_READBLOCK_HANDLER( READ8(geneve_state, read_by_9901) ) - MCFG_TMS9901_P0_HANDLER( WRITELINE( geneve_state, peripheral_bus_reset) ) - MCFG_TMS9901_P1_HANDLER( WRITELINE( geneve_state, VDP_reset) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( geneve_state, joystick_select) ) - MCFG_TMS9901_P4_HANDLER( DEVWRITELINE( GMAPPER_TAG, geneve_mapper_device, pfm_select_lsb) ) // new for PFM - MCFG_TMS9901_P5_HANDLER( DEVWRITELINE( GMAPPER_TAG, geneve_mapper_device, pfm_output_enable) ) // new for PFM - MCFG_TMS9901_P6_HANDLER( DEVWRITELINE( GKEYBOARD_TAG, geneve_keyboard_device, reset_line) ) - MCFG_TMS9901_P7_HANDLER( WRITELINE( geneve_state, extbus_wait_states) ) - MCFG_TMS9901_P9_HANDLER( WRITELINE( geneve_state, video_wait_states) ) - MCFG_TMS9901_P13_HANDLER( DEVWRITELINE( GMAPPER_TAG, geneve_mapper_device, pfm_select_msb) ) // new for PFM - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( geneve_state, tms9901_interrupt) ) - - // Mapper - MCFG_DEVICE_ADD(GMAPPER_TAG, GENEVE_MAPPER, 0) - MCFG_GENEVE_READY_HANDLER( WRITELINE(geneve_state, mapper_ready) ) - - // Clock - MCFG_DEVICE_ADD(GCLOCK_TAG, MM58274C, 0) - MCFG_MM58274C_MODE24(1) // 24 hour - MCFG_MM58274C_DAY1(0) // sunday - - // Peripheral expansion box (Geneve composition) - MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_GEN, 0) - MCFG_PERIBOX_INTA_HANDLER( WRITELINE(geneve_state, inta) ) - MCFG_PERIBOX_INTB_HANDLER( WRITELINE(geneve_state, intb) ) - MCFG_PERIBOX_READY_HANDLER( WRITELINE(geneve_state, ext_ready) ) - - // sound hardware - MCFG_TI_SOUND_76496_ADD( TISOUND_TAG ) - MCFG_TI_SOUND_READY_HANDLER( WRITELINE(geneve_state, ext_ready) ) - - // User interface devices - MCFG_DEVICE_ADD( GKEYBOARD_TAG, GENEVE_KEYBOARD, 0 ) - MCFG_GENEVE_KBINT_HANDLER( WRITELINE(geneve_state, keyboard_interrupt) ) - MCFG_GENEVE_MOUSE_ADD( GMOUSE_TAG ) - MCFG_GENEVE_JOYPORT_ADD( JOYPORT_TAG ) - - // PFM expansion - MCFG_AT29C040_ADD( PFM512_TAG ) - MCFG_AT29C040A_ADD( PFM512A_TAG ) - -MACHINE_CONFIG_END - -/* - ROM loading -*/ - -ROM_START(geneve) - /*CPU memory space*/ - ROM_REGION(0xc000, "maincpu", 0) - ROM_LOAD("genbt100.bin", 0x0000, 0x4000, CRC(8001e386) SHA1(b44618b54dabac3882543e18555d482b299e0109)) /* CPU ROMs v1.0 */ - ROM_LOAD_OPTIONAL("genbt098.bin", 0x4000, 0x4000, CRC(b2e20df9) SHA1(2d5d09177afe97d63ceb3ad59b498b1c9e2153f7)) /* CPU ROMs v0.98 */ - ROM_LOAD_OPTIONAL("gnmbt100.bin", 0x8000, 0x4000, CRC(19b89479) SHA1(6ef297eda78dc705946f6494e9d7e95e5216ec47)) /* CPU ROMs GenMod */ - - ROM_REGION(SRAM_SIZE, SRAM_TAG, 0) - ROM_FILL(0x0000, SRAM_SIZE, 0) - - ROM_REGION(DRAM_SIZE, DRAM_TAG, 0) - ROM_FILL(0x0000, DRAM_SIZE, 0) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1987,geneve, 0, 0, geneve_60hz, geneve, geneve_state, geneve, "Myarc", "Geneve 9640" , 0) diff --git a/src/mess/drivers/geniusiq.c b/src/mess/drivers/geniusiq.c deleted file mode 100644 index 1ca2024e693..00000000000 --- a/src/mess/drivers/geniusiq.c +++ /dev/null @@ -1,900 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** -Video Technology Genius computers: - VTech Genius PC (France) - VTech Genius IQ 512 (Germany) - The French packaging mentions distributions in Switzerland, the Netherlands, - USA, Canada, and UK as well. Looking for more information and ROM dumps. - -System driver: - - Adrien Destugues , May 2012 - - First attempt - -Memory map: - 00000000 System ROM (2MB) - 00200000 RAM (256K) - 00400000 Flash memory (128K) - 00600000 Some memory mapped hardware - 00a00000 Cartridge port - -TODO: - - Sound - - Flash cartridge - - Dump the MCU and rewrites everything using low-level emulation - - Check with different countries ROMs - -Not very much is known about this computer released in 1997. - - - -PCB - German Version: - +----------------------------------+ +-------------------+ - +-----------------+ | | | +-------+ +--------------+ - | +---+ +---+ +---+ | - | | - | | - | | - | | - | | - | | - | | - | ########################### +---------+ +-------+ - | # # | XTAL | +-------+ -------| - | +-------+ # +-------------------+ # |26.601712| | VTECH | -------| - | |LMT324D| # | PALCE20V8H-25PC | # |KDS17H | |LH537- | -------| - | +-------+ # | | # +---------+ | -NWL| -------| - | # +-------------------+ ######## +--------+ | | -------| - | # # | | |1997 | -------| - | # +-------------+ +-------+ # | | |27-5947| -------| - | # |MC74HC4060AN | |MEC/ZTB| # |AM29F010| |-00 | -------| - | # | | | 307D | # |-120PC | | | -------| - | # +-------------+ | | # | | |9741 D | -------| - | #010 +-------+ # | | +-------+ +-------+ - | ################################## |9731MBM | | - | | | | A| | - | | VTECH | | | | - | | 27-05793-0-0 | | | | - | | ZKAL9736 | | | | - | | | | | | - | | | | | | - | | | | | | - | +--------+ | | |1991 AMD| | - | |BH7236AF| | | +--------+ | - | +--------+ +------------------+ | - | +-----+ | - | |XTAL | | - | | | | - | |32.00| | - | |0 | | - | +-----+ 9740 | - | +---------+ GER | - | +----------+ |MC68EC000| 016 | - | |HY534256AL| |FU16 | | - | |J-60 | | | | - | +----------+ | 0G74K| | - | | HHIG9728| | - | +----------+ +---------+ | - | +------+ |HY534256AL| | - | |9727H | |J-60 | | - | |C807U-| +----------+ | - | |1225 | | - | +------+ | - | 35-13300-28 | - | | - | 35-13300-28 702748-E CS | - | +----+ +----+ E403 +----+ | - +------+ +--------------------------------------+ +-----------------------------------+ +----------+ - - - - IQ TV 512 PCB (German version) - +----------------------------------+ +-------------------+ - +-----------------+ | | | +-------+ +--------------+ - | +---+ +---+ +---+ | - | | - | | - | | - | | - | | - | | - | | - | ########################### +---------+ +-------+ - | # # | XTAL | +-------+ -------| - | +-------+ # +-------------------+ # |26.601712| | VTECH | -------| - | |LM324D | # | PALCE20V8H-25PC | # |KDS17H | |LH537- | -------| - | +-------+ # | | # +---------+ | -NUA| -------| - | # +-------------------+ ######## +--------+ | | -------| - | # # | | |1998 | -------| - | # +-------------+ +-------+ # | | |27-0617| -------| - | # |MC74HC4060AN | |MEC/ZTB| # |AM29F040| |1-000 | -------| - | # | | | 307D | # |B-120PC | | | -------| - | # +-------------+ | | # | | |9824 D | -------| - | #010 +-------+ # | | +-------+ +-------+ - | ################################## |9808MBM | | - | | | | A| | - | | VTECH | | | | - | | 27-05793-0-0 | | | | - | | ZKAH9805 | | | | - | | | | | | - | | | | | | - | | | | | | - | +--------+ | | |1993 AMD| | - | |BH7236AF| | | +--------+ | - | +--------+ +------------------+ | - | +-----+ | - | |XTAL | | - | | | | - | |32.00| | - | |0 | | - | +-----+ 9749 | - | +---------+ GER | - | +----------+ |MC68EC000| 023 | - | |HY534256AL| |FU16 | | - | |J-60 | | | | - | +----------+ | 0G74K| | - | | HHIG9728| | - | +----------+ +---------+ | - | +------+ |HY534256AL| | - | |9805HB| |J-60 | | - | |C807U-| +----------+ | - | |1225 | | - | +------+ | - | 35-13300-28 | - | | - | 35-13300-28 702749-E CS | - | +----+ +----+ E493 +----+ | - +------+ +--------------------------------------+ +-----------------------------------+ +----------+ - - -IQ Unlimited - GERMAN: - +------------------------------------------------------------------------------+ - | | -+-----+ | -| | -| | -| | -| +----+ +---+ | -| | A2 | +----+ | | | -| | | | A4 | |A1 | +-+ | -| +----+ +----+ | | | | | -| | | +-+ | -| | | | -| +---+ +--+ -| | -| +-------+ | -+--+ |65C5L5K| +----+ - | | HC374 | | -+--+ +----------+ +-------+ +--+ -| |DragonBall| | -| C +----+ |EZ | +-------+ C | -| A | A3 | | | |65C5L5K| A | -| R +----+ |LSC414328P| | HC374 | R | -| T |U16 IJ75C| +-------+ T | -| R | HHAV984S | R | -| I +----------+ I | -| D CARD 1 +------------+ CARD 0 D | -| G | AM29F0400 | G | -| E | | +------+ +--------+ E | -| +------------+ | LGS | |LHMN5KR7| | -| S | | | | S | -| L |GM71C1| | 1998 | L | -| O GER |8163CJ| | | O | -| T 038 |6 | |27-06126| T | -| | | |-007 | | -+--+ | | | | +--+ - | | | | VTECH | | - | +------+ +--------+ | - | 35-19600-200 703139-G| - +-------------------------------------------------------------------------+ - -A1 = 98AHCLT / 27-05992-0-0 / VTech -A2 = 9932 HBL / C807U-1442 / 35016B / Japan -A3 = ACT139 -A4 = MAX232 - - -Leader 8008 CX (German version) - -+---+-----------+-----+-----------------------+-----+-----+-----+ -| |SERIAL PORT| |PARALLEL PORT (PRINTER)| |MOUSE| | -| +-----------+ +-----------------------+ +-----+ | -| | -| | -| | -| | -| +----+ | -| | A0 | | -| +----+ | -| | -| | -| +--------+ | -| | | | -| CPU | VTECH | +------+ | -| |LHMV5GNS| | | | -| | | |GM76U8| | -| |1999 | |128CLF| | -| |27-6393-| |W85 | | -| +-----------+ |11 | | | | -| |27-6296-0-0| | | | | | -| |47C241M NH7| | | +------+ | -| +-----------+ +--------+ | -| | -| | -| | -| | -+---------------------------------------------------------------+ - -CPU = epoxy blob -GM76U8128CLFW85 = LGS / Hynix 131,072 WORDS x 8 BIT CMOS SRAM -TMP47C241MG = TCLS-47 series 4-bit CPU with 2048x8 internal ROM - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/intelfsh.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define KEYBOARD_QUEUE_SIZE 0x80 - -class geniusiq_state : public driver_device -{ -public: - enum - { - IQ128_ROM_CART = 0x00, - IQ128_ROMLESS1_CART = 0x01, - IQ128_ROMLESS2_CART = 0x02, - IQ128_NO_CART = 0x03 - }; - - geniusiq_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_rom(*this, "maincpu"), - m_vram(*this, "vram"), - m_mouse_gfx(*this, "mouse_gfx"), - m_cart_state(IQ128_NO_CART) - { } - - required_device m_maincpu; - required_device m_cart; - required_region_ptr m_rom; - required_shared_ptr m_vram; - required_shared_ptr m_mouse_gfx; - - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(geniusiq); - virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ16_MEMBER(input_r); - DECLARE_WRITE16_MEMBER(mouse_pos_w); - DECLARE_INPUT_CHANGED_MEMBER(send_input); - DECLARE_INPUT_CHANGED_MEMBER(send_mouse_input); - DECLARE_WRITE16_MEMBER(gfx_base_w); - DECLARE_WRITE16_MEMBER(gfx_dest_w); - DECLARE_WRITE16_MEMBER(gfx_color_w); - DECLARE_WRITE16_MEMBER(gfx_idx_w); - void queue_input(UINT16 data); - DECLARE_READ16_MEMBER(cart_state_r); - - DECLARE_READ16_MEMBER(unk0_r) { return 0; } - DECLARE_READ16_MEMBER(unk_r) { return machine().rand(); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( iq128_cart ); - DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( iq128_cart ); - -private: - UINT16 m_gfx_y; - UINT16 m_gfx_x; - UINT32 m_gfx_base; - UINT8 m_gfx_color[2]; - UINT8 m_mouse_posx; - UINT8 m_mouse_posy; - UINT16 m_mouse_gfx_posx; - UINT16 m_mouse_gfx_posy; - UINT8 m_cart_state; - struct - { - UINT16 buffer[KEYBOARD_QUEUE_SIZE]; - int head; - int tail; - } m_keyboard; -}; - -class gl8008cx_state : public driver_device -{ -public: - gl8008cx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - required_device m_maincpu; - - virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); -}; - -PALETTE_INIT_MEMBER(geniusiq_state, geniusiq) -{ - // shades need to be verified - const UINT8 palette_val[] = - { - 0x00, 0x00, 0x00, // Black?? (used in the cursor for transparency) - 0xff, 0xff, 0xff, // White - 0xa0, 0xa0, 0xa0, // Light grey - 0x7f, 0x7f, 0x7f, // Dark grey - 0x00, 0x00, 0x00, // Black - 0x00, 0x60, 0xff, // Sky blue - 0x00, 0x00, 0xff, // Blue - 0xff, 0x00, 0x00, // Red - 0x00, 0xff, 0x00, // Green - 0x00, 0x7f, 0x00, // Dark green - 0xff, 0xff, 0x00, // Yellow - 0xff, 0x7f, 0x00, // Orange - 0x7f, 0x40, 0x00, // Brown - 0x60, 0x40, 0x00, // Dark brown - 0x60, 0x00, 0xff, // Mauve - 0xff, 0x00, 0xff // Pink - }; - - for (int i=0; i>1]; - - for(int b=0; b<4; b++) - { - bitmap.pix16(y, x*2 + b) = (data>>12) & 0x0f; - data <<= 4; - } - } - - // mouse cursor - for (int y=0; y<16; y++) - for (int x=0; x<6; x+=2) - { - UINT16 data = m_mouse_gfx[(y*6 + x)>>1]; - - for(int b=0; b<8; b++) - { - UINT8 pen = (data>>14) & 0x03; - - // I assume color 0 is transparent - if(pen != 0 && screen.visible_area().contains(m_mouse_gfx_posx + x*4 + b, m_mouse_gfx_posy + y)) - bitmap.pix16(m_mouse_gfx_posy + y, m_mouse_gfx_posx + x*4 + b) = pen; - data <<= 2; - } - } - - return 0; -} - -READ16_MEMBER( geniusiq_state::cart_state_r ) -{ - return m_cart_state; -} - -WRITE16_MEMBER( geniusiq_state::mouse_pos_w ) -{ - if (offset) - m_mouse_gfx_posy = data; - else - m_mouse_gfx_posx = data; -} - -WRITE16_MEMBER(geniusiq_state::gfx_color_w) -{ - m_gfx_color[offset & 1] = data & 0x0f; -} - -WRITE16_MEMBER(geniusiq_state::gfx_dest_w) -{ - if (offset) - m_gfx_y = data; - else - m_gfx_x = data; -} - -WRITE16_MEMBER(geniusiq_state::gfx_base_w) -{ - if (offset) - m_gfx_base = (m_gfx_base & 0xffff0000) | (data<<0); - else - m_gfx_base = (m_gfx_base & 0x0000ffff) | (data<<16); -} - -WRITE16_MEMBER(geniusiq_state::gfx_idx_w) -{ - UINT16 *gfx = m_rom + ((m_gfx_base + (data & 0xff)*32)>>1); - - // first 16 bits are used to define the character size - UINT8 gfx_heigh = (gfx[0]>>0) & 0xff; - UINT8 gfx_width = (gfx[0]>>8) & 0xff; - - for(int y=0; y>2] = (m_vram[dst>>2] & ~(0x0f << bit_pos)) | (pen << bit_pos); - } -} - -READ16_MEMBER( geniusiq_state::input_r ) -{ - /* - this is guesswork and may not be correct - - xxxx xxx- ---- ---- unknown - ---- ---x ---- ---- used for indicate if the data read is valid (if not set the other bits are discarded) - ---- ---- x--- ---- if set indicates a KeyUp otherwise a KeyDown - ---- ---- -xxx xxxx this is the scan code - */ - - UINT16 data = 0; - - if(m_keyboard.head != m_keyboard.tail) - { - data = m_keyboard.buffer[m_keyboard.head]; - - m_keyboard.head = (m_keyboard.head+1) % KEYBOARD_QUEUE_SIZE; - - data |= (1<<8); - } - - if(m_keyboard.head == m_keyboard.tail) - m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); - - return data; -} - -void geniusiq_state::queue_input(UINT16 data) -{ - m_keyboard.buffer[m_keyboard.tail] = data; - - m_keyboard.tail = (m_keyboard.tail+1) % KEYBOARD_QUEUE_SIZE; - - // new data in queue - m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER( geniusiq_state::send_mouse_input ) -{ - UINT8 new_mouse_x = ioport("MOUSEX")->read(); - UINT8 new_mouse_y = ioport("MOUSEY")->read(); - UINT8 mouse_buttons = ioport("MOUSE")->read(); - - UINT8 delta_x = (UINT8)(new_mouse_x - m_mouse_posx); - UINT8 delta_y = (UINT8)(new_mouse_y - m_mouse_posy); - m_mouse_posx = new_mouse_x; - m_mouse_posy = new_mouse_y; - - queue_input(0x1000 | 0x40 | mouse_buttons | ((delta_y>>4) & 0x0c) | ((delta_x>>6) & 0x03)); - queue_input(0x1000 | (delta_x & 0x3f)); - queue_input(0x1000 | (delta_y & 0x3f)); -} - -INPUT_CHANGED_MEMBER( geniusiq_state::send_input ) -{ - UINT16 data = (UINT16)(FPTR)param; - - // set bit 7 if the key is released - if (!newval) - data |= 0x80; - - queue_input(data); -} - -static ADDRESS_MAP_START(gl8008cx_mem, AS_PROGRAM, 16, gl8008cx_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1FFFFF) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(geniusiq_mem, AS_PROGRAM, 16, geniusiq_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x1FFFFF) AM_ROM - AM_RANGE(0x200000, 0x23FFFF) AM_RAM - AM_RANGE(0x300000, 0x30FFFF) AM_RAM AM_SHARE("vram") - AM_RANGE(0x310000, 0x31FFFF) AM_RAM - AM_RANGE(0x400000, 0x41ffff) AM_MIRROR(0x0e0000) AM_DEVREADWRITE8("flash", intelfsh8_device, read, write, 0x00ff) - AM_RANGE(0x600300, 0x600301) AM_READ(input_r) - //AM_RANGE(0x600500, 0x60050f) // read during IRQ 5 - //AM_RANGE(0x600600, 0x600605) // sound ?? - AM_RANGE(0x600606, 0x600609) AM_WRITE(gfx_base_w) - AM_RANGE(0x60060a, 0x60060b) AM_WRITE(gfx_idx_w) - AM_RANGE(0x600802, 0x600803) AM_READ(cart_state_r) // cartridge state - AM_RANGE(0x600108, 0x600109) AM_READ(unk0_r) // read before run a BASIC program - AM_RANGE(0x600918, 0x600919) AM_READ(unk0_r) // loop at start if bit 0 is set - AM_RANGE(0x601008, 0x601009) AM_READ(unk_r) // unknown, read at start and expect that bit 2 changes several times before continue - AM_RANGE(0x601010, 0x601011) AM_READ(unk0_r) // loop at start if bit 1 is set - AM_RANGE(0x601018, 0x60101b) AM_WRITE(gfx_dest_w) - AM_RANGE(0x60101c, 0x60101f) AM_WRITE(gfx_color_w) - AM_RANGE(0x601060, 0x601063) AM_WRITE(mouse_pos_w) - AM_RANGE(0x601100, 0x6011ff) AM_RAM AM_SHARE("mouse_gfx") // mouse cursor gfx (24x16) - AM_RANGE(0xa00000, 0xafffff) AM_DEVREAD("cartslot", generic_slot_device, read16_rom) - // 0x600000 : some memory mapped hardware -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( geniusiq ) - PORT_START( "IN0" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x00 ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x01 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x02 ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x03 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x04 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LALT ) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x05 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x06 ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x07 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x08 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x09 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0d ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0e ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x0f ) - - PORT_START( "IN1" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x10 ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x11 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x12 ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x13 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x14 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x15 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x16 ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHAR('\'') PORT_CHAR('~') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x17 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH ) PORT_CHAR('$') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x18 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_EQUALS ) PORT_CHAR('=') PORT_CHAR('+') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x19 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CLOSEBRACE ) PORT_CHAR(')') PORT_CHAR(0x00b0) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_OPENBRACE ) PORT_CHAR(0x00f9) PORT_CHAR('%') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH ) PORT_CHAR('^') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1d ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_P ) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1e ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_TILDE ) PORT_CHAR('!') PORT_CHAR('*') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1f ) - - PORT_START( "IN2" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHAR(0x00e0) PORT_CHAR('0') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x20 ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE( KEYCODE_ENTER ) PORT_CHAR(13) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x21 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE( KEYCODE_BACKSPACE ) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x22 ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_L ) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x23 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_O ) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x24 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHAR(0x00e7) PORT_CHAR('9') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x25 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x26 ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Button 2 (keyboard)") PORT_CODE( KEYCODE_F3 ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x27 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x28 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PGDN ) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x29 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PGUP ) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_STOP ) PORT_CHAR(':') PORT_CHAR('/') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COLON ) PORT_CHAR(';') PORT_CHAR('.') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_K ) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2d ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_I ) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2e ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Button 1 (keyboard)") PORT_CODE( KEYCODE_F2 ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2f ) - - PORT_START( "IN3" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHAR('_') PORT_CHAR('8') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x30 ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ESC ) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x31 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHAR(',') PORT_CHAR('?') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x32 ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_J ) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x33 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_U ) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x34 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHAR(0x00e8) PORT_CHAR('7') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x35 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x36 ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x37 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x38 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PRTSCR ) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x39 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS ) PORT_CHAR('-') PORT_CHAR(0x00a3) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_DEL ) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_N ) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_H ) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3d ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3e ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_NUMLOCK ) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3f ) - - PORT_START( "IN4" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHAR('-') PORT_CHAR('6') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x40 ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_TAB ) PORT_CHAR('\t') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x41 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_B ) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x42 ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_G ) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x43 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_T ) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x44 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5 ) PORT_CHAR('(') PORT_CHAR('5') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x45 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x46 ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x47 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x48 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x49 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH2 ) /*PORT_CHAR('')*/ PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SPACE ) PORT_CHAR(' ') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_V ) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F ) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4d ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_R ) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4e ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Up Button") PORT_CODE( KEYCODE_UP ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4f ) - - PORT_START( "IN5" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4 ) PORT_CHAR('\'') PORT_CHAR('4') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x50 ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_C ) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x51 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_D ) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x52 ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_E ) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x53 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3 ) PORT_CHAR('"') PORT_CHAR('3') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x54 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x55 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x56 ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Down Button") PORT_CODE( KEYCODE_DOWN ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x57 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x58 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_X ) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x59 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_S ) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHAR(0x00e9) PORT_CHAR('2') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5d ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5e ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Left Button") PORT_CODE( KEYCODE_LEFT ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5f ) - - PORT_START( "IN6" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE( KEYCODE_F1 ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x60 ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x61 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_END ) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x62 ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x63 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x64 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x65 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHAR('&') PORT_CHAR('1') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x66 ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mouse Right Button") PORT_CODE( KEYCODE_RIGHT ) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x67 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x68 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F4 ) PORT_CHAR(0x00a4) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x69 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_DEL_PAD ) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH_PAD ) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ASTERISK ) PORT_CHAR('*') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS_PAD ) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6d ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PLUS_PAD ) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6e ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ENTER_PAD ) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x6f ) - - PORT_START( "IN7" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0_PAD ) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x70 ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1_PAD ) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x71 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2_PAD ) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x72 ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3_PAD ) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x73 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4_PAD ) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x74 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5_PAD ) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x75 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6_PAD ) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x76 ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7_PAD ) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x77 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8_PAD ) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x78 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9_PAD ) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x79 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7d ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7e ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x7f ) - - PORT_START("MOUSEX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_mouse_input, 0 ) - - PORT_START("MOUSEY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_mouse_input, 0 ) - - PORT_START("MOUSE") - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_mouse_input, 0 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_mouse_input, 0 ) -INPUT_PORTS_END - - -static INPUT_PORTS_START( geniusiq_de ) - PORT_INCLUDE(geniusiq) - - PORT_MODIFY( "IN1" ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHAR('^') PORT_CHAR(0x00b0) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x17 ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH ) PORT_CHAR('+') PORT_CHAR('*') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x18 ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_EQUALS ) PORT_CHAR('{') PORT_CHAR('}') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x19 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CLOSEBRACE ) PORT_CHAR(0x00b0) PORT_CHAR('?') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1a ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_OPENBRACE ) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH ) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1c ) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COLON ) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1d ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_TILDE ) PORT_CHAR('-') PORT_CHAR('_') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x1f ) - - PORT_MODIFY( "IN2" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHAR('0') PORT_CHAR('=') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x20 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHAR('9') PORT_CHAR(')') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x25 ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_STOP ) PORT_CHAR('.') PORT_CHAR(':') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHAR(',') PORT_CHAR(';') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x2c ) - - PORT_MODIFY( "IN3" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHAR('8') PORT_CHAR('(') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x30 ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x32 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHAR('7') PORT_CHAR('/') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x35 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS ) PORT_CHAR('#') PORT_CHAR('\'') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3a ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x3e ) - - PORT_MODIFY( "IN4" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHAR('6') PORT_CHAR('&') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x40 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5 ) PORT_CHAR('5') PORT_CHAR('/') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x45 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH2 ) PORT_CHAR('<') PORT_CHAR('>') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x4a ) - - PORT_MODIFY( "IN5" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4 ) PORT_CHAR('4') PORT_CHAR('$') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x50 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3 ) PORT_CHAR('3') PORT_CHAR(0x00a7) PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x54 ) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5b ) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHAR('2') PORT_CHAR('"') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x5c ) - - PORT_MODIFY( "IN6" ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x63 ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x64 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x65 ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHAR('1') PORT_CHAR('!') PORT_CHANGED_MEMBER( DEVICE_SELF, geniusiq_state, send_input, 0x66 ) -INPUT_PORTS_END - -static INPUT_PORTS_START( gl8008cx ) -INPUT_PORTS_END - -void geniusiq_state::machine_start() -{ -} - -void geniusiq_state::machine_reset() -{ - m_keyboard.head = m_keyboard.tail = 0; - - m_gfx_y = 0; - m_gfx_x = 0; - m_gfx_base = 0; - m_gfx_color[0] = m_gfx_color[1] = 0; - m_mouse_posx = 0; - m_mouse_posy = 0; - m_mouse_gfx_posx = 0; - m_mouse_gfx_posy = 0; -} - -DEVICE_IMAGE_LOAD_MEMBER(geniusiq_state,iq128_cart) -{ - UINT32 size = m_cart->common_get_size("rom"); - - // we always a 0x100000 region, for easier mapping in the memory map - m_cart->rom_alloc(0x100000, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - m_cart_state = IQ128_ROM_CART; - - if (image.software_entry() != NULL) - { - const char *pcb_type = image.get_feature("pcb_type"); - if (pcb_type) - { - if (!core_stricmp(pcb_type, "romless1")) - m_cart_state = IQ128_ROMLESS1_CART; - if (!core_stricmp(pcb_type, "romless2")) - m_cart_state = IQ128_ROMLESS2_CART; - } - } - - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_UNLOAD_MEMBER(geniusiq_state,iq128_cart) -{ - m_cart_state = IQ128_NO_CART; -} - - -static MACHINE_CONFIG_START( iq128, geniusiq_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) // The main crystal is at 32MHz, not sure whats the CPU freq - MCFG_CPU_PROGRAM_MAP(geniusiq_mem) - MCFG_CPU_PERIODIC_INT_DRIVER(geniusiq_state, irq6_line_hold, 125) // the internal clock is increased by 1 sec every 125 interrupts - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER( geniusiq_state, screen_update ) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(geniusiq_state, geniusiq) - - /* internal flash */ - MCFG_AMD_29F010_ADD("flash") - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "iq128_cart") - MCFG_GENERIC_LOAD(geniusiq_state, iq128_cart) - MCFG_GENERIC_UNLOAD(geniusiq_state, iq128_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "iq128") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( iqtv512, iq128 ) - /* internal flash */ - MCFG_DEVICE_REMOVE("flash") - MCFG_AMD_29F040_ADD("flash") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( gl8008cx, gl8008cx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) // TODO wrong CPU and frequency - MCFG_CPU_PROGRAM_MAP(gl8008cx_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER( gl8008cx_state, screen_update ) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( iq128 ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "27-5947-00.bin", 0x0000, 0x200000, CRC(a98fc3ff) SHA1(de76a5898182bd0180bd2b3e34c4502f0918a3fa) ) -ROM_END - -ROM_START( iq128_fr ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "geniusiq.bin", 0x0000, 0x200000, CRC(9b06cbf1) SHA1(b9438494a9575f78117c0033761f899e3c14e292) ) -ROM_END - -ROM_START( iqtv512 ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "27-06171-000.bin", 0x0000, 0x200000, CRC(2597af70) SHA1(9db8151a84517407d380424410b6fa0003ceb1eb) ) -ROM_END - -ROM_START( gl8008cx ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "27-6393-11.u1", 0x0000, 0x200000, CRC(fd49db46) SHA1(fc55bb31f42068f9d6cc8e2c2f419c3c4edb4fe6) ) - - ROM_REGION(0x800, "subcpu", 0) - ROM_LOAD( "27-6296-0-0.u3", 0x000, 0x800, NO_DUMP ) -ROM_END - -ROM_START( bs9009cx ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "27-6603-01.u1", 0x0000, 0x200000, CRC(2c299f65) SHA1(44b37007a7c4087d7c2bd8c24907402bfe445ba4) ) - - ROM_REGION(0x800, "subcpu", 0) - ROM_LOAD( "mcu.u5", 0x000, 0x800, NO_DUMP ) -ROM_END - -ROM_START( itunlim ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "27-06124-002.u3", 0x000000, 0x200000, CRC(0c0753ce) SHA1(d22504d583ca8d6a9d2f56fbaa3e1d52c442a1e9) ) -ROM_END - -ROM_START( iqunlim ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD16_WORD_SWAP( "27-06126-007.bin", 0x000000, 0x200000, CRC(af38c743) SHA1(5b91748536905812e6de7145638699acb375865a) ) -ROM_END - -ROM_START( glmmc ) - ROM_REGION(0x200000, "maincpu", 0) - ROM_LOAD( "27-5889-00.bin", 0x000000, 0x080000, CRC(5e2c6359) SHA1(cc01c7bd5c87224b63dd1044db5a36a5cb7824f1) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1997, iq128, 0, 0, iq128, geniusiq_de, driver_device, 0, "Video Technology", "Genius IQ 128 (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1997, iq128_fr, iq128, 0, iq128, geniusiq, driver_device, 0, "Video Technology", "Genius IQ 128 (France)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1998, iqtv512, 0, 0, iqtv512, geniusiq_de, driver_device, 0, "Video Technology", "Genius IQ TV 512 (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1999, gl8008cx, 0, 0, gl8008cx, gl8008cx, driver_device, 0, "Video Technology", "Genius Leader 8008 CX (Germany)", MACHINE_IS_SKELETON) -COMP( 1999, bs9009cx, 0, 0, gl8008cx, gl8008cx, driver_device, 0, "Video Technology", "BrainStation 9009 CXL (Germany)", MACHINE_IS_SKELETON) -COMP( 1998, itunlim, 0, 0, iq128, geniusiq_de, driver_device, 0, "Video Technology", "Vtech IT Unlimited (UK)", MACHINE_NO_SOUND) -COMP( 19??, iqunlim, 0, 0, iq128, geniusiq_de, driver_device, 0, "Video Technology", "Vtech IQ Unlimited (Germany)", MACHINE_IS_SKELETON) -COMP( 19??, glmmc, 0, 0, iq128, geniusiq_de, driver_device, 0, "Video Technology", "Genius Leader Master Mega Color (Germany)", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/genpc.c b/src/mess/drivers/genpc.c deleted file mode 100644 index a17a2dd9d29..00000000000 --- a/src/mess/drivers/genpc.c +++ /dev/null @@ -1,280 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Miodrag Milanovic -/*************************************************************************** - - drivers/genpc.c - - Driver file for generic PC machines - -***************************************************************************/ - - -#include "emu.h" - -#include "includes/genpc.h" - -#include "cpu/nec/nec.h" -#include "cpu/i86/i86.h" -#include "machine/pc_lpt.h" -#include "bus/pc_kbd/keyboards.h" - -class genpc_state : public driver_device -{ -public: - genpc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - required_device m_maincpu; -}; - -static ADDRESS_MAP_START( pc8_map, AS_PROGRAM, 8, genpc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc16_map, AS_PROGRAM, 16, genpc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(pc8_io, AS_IO, 8, genpc_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pc16_io, AS_IO, 16, genpc_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - - -static INPUT_PORTS_START( pcgen ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START(cga) - DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x20) -DEVICE_INPUT_DEFAULTS_END - -static DEVICE_INPUT_DEFAULTS_START(vga) - DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x00) -DEVICE_INPUT_DEFAULTS_END - - -static MACHINE_CONFIG_START( pcmda, genpc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", V20, 4772720) - MCFG_CPU_PROGRAM_MAP(pc8_map) - MCFG_CPU_IO_MAP(pc8_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "mda", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, "adlib", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( pcherc, genpc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", V20, 4772720) - MCFG_CPU_PROGRAM_MAP(pc8_map) - MCFG_CPU_IO_MAP(pc8_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "hercules", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, "adlib", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( pccga, genpc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 4772720) - MCFG_CPU_PROGRAM_MAP(pc16_map) - MCFG_CPU_IO_MAP(pc16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(cga) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, "sblaster1_0", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( pcega, genpc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 4772720) - MCFG_CPU_PROGRAM_MAP(pc16_map) - MCFG_CPU_IO_MAP(pc16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(vga) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "com", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "hdc", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "sblaster1_0", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, "ega", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( xtvga, genpc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 4772720) - MCFG_CPU_PROGRAM_MAP(pc16_map) - MCFG_CPU_IO_MAP(pc16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(vga) - - MCFG_ISA8_SLOT_ADD("mb:isa","isa1", pc_isa8_cards, "com", false) - MCFG_ISA8_SLOT_ADD("mb:isa","isa2", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa","isa3", pc_isa8_cards, "hdc", false) - MCFG_ISA8_SLOT_ADD("mb:isa","isa4", pc_isa8_cards, "sblaster1_0", false) - MCFG_ISA8_SLOT_ADD("mb:isa","isa5", pc_isa8_cards, "svga_et4k", false) - MCFG_ISA8_SLOT_ADD("mb:isa","isa6", pc_isa8_cards, NULL, false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - - -ROM_START( pcmda ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "anon", "XT Anonymous Generic Turbo BIOS") - ROMX_LOAD("pcxt.rom", 0xfe000, 0x02000, CRC(031aafad) SHA1(a641b505bbac97b8775f91fe9b83d9afdf4d038f),ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "anon2007", "XT Anonymous Generic Turbo BIOS 2007") - ROMX_LOAD( "pcxt2007.bin", 0xfe000, 0x2000, CRC(1d7bd86c) SHA1(33a500f599b4dad2fe6d7a5c3e89b13bd5dd2987),ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "ami", "XT AMI") - ROMX_LOAD( "ami.bin", 0xfe000, 0x2000, CRC(b381eb22) SHA1(9735193de119270c946a17ed58c3ab9554e0852e),ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "award", "XT Award 2.05") - ROMX_LOAD( "award2.05.bin", 0xfe000, 0x2000, CRC(5b3953e5) SHA1(4a36171aa8d993008187f39f732b9296401b7b6c),ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "dtk", "XT DTK Erso bios 2.42") - ROMX_LOAD( "dtk2.42.bin", 0xfe000, 0x2000, CRC(3f2d2a76) SHA1(02fa057f2c22ab199a8d9795ab1ae570f2b13a36),ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "peter", "XT Peter Kohlman 3.75") // V20 Rom only - ROMX_LOAD( "peterv203.75.bin", 0xfe000, 0x2000, CRC(b053a6a4) SHA1(f53218ad3d725f12d9149b22d8afcf6a8869a3bd),ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "pho227", "XT Phoenix Bios 2.27") - ROMX_LOAD( "phoenix2.27.bin", 0xfe000, 0x2000, CRC(168ffef0) SHA1(69465db2f9246a614044d1f433d374506a13a07f),ROM_BIOS(7)) - ROM_SYSTEM_BIOS(7, "pho251", "XT Phoenix Bios 2.51") - ROMX_LOAD( "phoenix2.51.bin", 0xfe000, 0x2000, CRC(9b7e9c40) SHA1(c948a8d3d715e469105c6e2acd8b46ec274b25a8),ROM_BIOS(8)) - ROM_SYSTEM_BIOS(8, "turbo", "XT Turbo Bios 3.10") - ROMX_LOAD( "turbo3.10.bin", 0xfe000, 0x2000, CRC(8aaca1e3) SHA1(9c03da16713e08c0112a04c8bdfa394e7341c1fc),ROM_BIOS(9)) -ROM_END - -#define rom_pcherc rom_pcmda - -#define rom_pcega rom_pcmda - -ROM_START( pc ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "anon", "XT Anonymous Generic Turbo BIOS") - ROMX_LOAD("pcxt.rom", 0xfe000, 0x02000, CRC(031aafad) SHA1(a641b505bbac97b8775f91fe9b83d9afdf4d038f),ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "anon2007", "XT Anonymous Generic Turbo BIOS 2007") - ROMX_LOAD( "pcxt2007.bin", 0xfe000, 0x2000, CRC(1d7bd86c) SHA1(33a500f599b4dad2fe6d7a5c3e89b13bd5dd2987),ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "ami", "XT AMI") - ROMX_LOAD( "ami.bin", 0xfe000, 0x2000, CRC(b381eb22) SHA1(9735193de119270c946a17ed58c3ab9554e0852e),ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "award", "XT Award 2.05") - ROMX_LOAD( "award2.05.bin", 0xfe000, 0x2000, CRC(5b3953e5) SHA1(4a36171aa8d993008187f39f732b9296401b7b6c),ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "dtk", "XT DTK Erso bios 2.42") - ROMX_LOAD( "dtk2.42.bin", 0xfe000, 0x2000, CRC(3f2d2a76) SHA1(02fa057f2c22ab199a8d9795ab1ae570f2b13a36),ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "peter", "XT Peter Kohlman 3.75") - ROMX_LOAD( "peterv203.75.bin", 0xfe000, 0x2000, CRC(b053a6a4) SHA1(f53218ad3d725f12d9149b22d8afcf6a8869a3bd),ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "pho227", "XT Phoenix Bios 2.27") - ROMX_LOAD( "phoenix2.27.bin", 0xfe000, 0x2000, CRC(168ffef0) SHA1(69465db2f9246a614044d1f433d374506a13a07f),ROM_BIOS(7)) - ROM_SYSTEM_BIOS(7, "pho251", "XT Phoenix Bios 2.51") - ROMX_LOAD( "phoenix2.51.bin", 0xfe000, 0x2000, CRC(9b7e9c40) SHA1(c948a8d3d715e469105c6e2acd8b46ec274b25a8),ROM_BIOS(8)) - ROM_SYSTEM_BIOS(8, "turbo", "XT Turbo Bios 3.10") - ROMX_LOAD( "turbo3.10.bin", 0xfe000, 0x2000, CRC(8aaca1e3) SHA1(9c03da16713e08c0112a04c8bdfa394e7341c1fc),ROM_BIOS(9)) - /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ - ROM_REGION(0x2000,"gfx1", 0) - ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ -ROM_END - -#define rom_xtvga rom_pcmda - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1987, pc, ibm5150, 0, pccga, pcgen, driver_device, 0, "", "PC (CGA)" , 0) -COMP( 1987, pcega, ibm5150, 0, pcega, pcgen, driver_device, 0, "", "PC (EGA)" , 0) -COMP ( 1987, pcmda, ibm5150, 0, pcmda, pcgen, driver_device, 0, "", "PC (MDA)" , 0) -COMP ( 1987, pcherc, ibm5150, 0, pcherc, pcgen, driver_device, 0, "", "PC (Hercules)" , 0) -COMP ( 1987, xtvga, ibm5150, 0, xtvga, pcgen, driver_device, 0, "", "PC (VGA)" , MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/gimix.c b/src/mess/drivers/gimix.c deleted file mode 100644 index 2f04b6688d2..00000000000 --- a/src/mess/drivers/gimix.c +++ /dev/null @@ -1,686 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald, Robbbert -/* - Gimix 6809-Based Computers - - Representative group of GIMIX users included: Government Research and Scientific Organizations, Universities, Industrial, Computer Mainframe and - Peripheral Manufacturers and Software Houses. - - This system is most notable for being the development base of the "Vid Kidz", a pair of programmers (Eugene Jarvis and Larry DeMar) who formerly - worked for Williams Electronics on the game, Defender. They left Willams and continued work on other games eventually making a deal with Williams - to continue to design games producing the titles: Stargate, Robotron: 2084 and Blaster. - - Information Link: http://www.backglass.org/duncan/gimix/ - - TODO: Everything - - Usage: - System boots into GMXBUG-09 - To boot Flex, insert the Flex system disk (3.3 or later, must support the DMA disk controller), type U and press enter. - To boot OS-9, insert the OS-9 system disk, type O, and press Enter. - Note that booting OS-9 doesn't currently work without a timer hack. -*/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/mm58167.h" -#include "machine/6840ptm.h" -#include "machine/6821pia.h" -#include "machine/6850acia.h" -#include "bus/rs232/rs232.h" -#include "machine/clock.h" -#include "machine/wd_fdc.h" -#include "machine/terminal.h" -#include "machine/bankdev.h" -#include "machine/ram.h" -#include "formats/flex_dsk.h" - -#define DMA_DRQ (m_dma_status & 0x80) -#define DMA_INTRQ (m_dma_status & 0x40) -#define DMA_MOTOR_DELAY (m_dma_status & 0x20) -#define DMA_ENABLED (m_dma_status & 0x10) -#define DMA_FAULT (m_dma_status & 0x08) -#define DMA_DRIVE_SIZE (m_dma_status & 0x04) -#define DMA_DIP_SENSE (m_dma_status & 0x01) - -#define DMA_CONNECT_SEL (m_dma_drive_select & 0x40) -#define DMA_DENSITY (m_dma_drive_select & 0x20) -#define DMA_WR_PROTECT (m_dma_drive_select & 0x10) -#define DMA_SEL_DRV3 (m_dma_drive_select & 0x08) -#define DMA_SEL_DRV2 (m_dma_drive_select & 0x04) -#define DMA_SEL_DRV1 (m_dma_drive_select & 0x02) -#define DMA_SEL_DRV0 (m_dma_drive_select & 0x01) - -#define DMA_IRQ_ENABLE (m_dma_ctrl & 0x80) -#define DMA_SIDE_SEL (m_dma_ctrl & 0x40) -#define DMA_DIRECTION (m_dma_ctrl & 0x20) -#define DMA_ENABLE (m_dma_ctrl & 0x10) -#define DMA_BANK (m_dma_ctrl & 0x0f) - -#define DMA_START_ADDR (((m_dma_ctrl & 0x0f) << 16) | m_dma_start_addr) - -class gimix_state : public driver_device -{ -public: - gimix_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - , m_ram(*this, RAM_TAG) - , m_rom(*this, "roms") - , m_acia1(*this, "acia1") - , m_acia2(*this, "acia2") - , m_acia3(*this, "acia3") - , m_acia4(*this, "acia4") - , m_bank1(*this, "bank1") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - , m_bank4(*this, "bank4") - , m_bank5(*this, "bank5") - , m_bank6(*this, "bank6") - , m_bank7(*this, "bank7") - , m_bank8(*this, "bank8") - , m_bank9(*this, "bank9") - , m_bank10(*this, "bank10") - , m_bank11(*this, "bank11") - , m_bank12(*this, "bank12") - , m_bank13(*this, "bank13") - , m_bank14(*this, "bank14") - , m_bank15(*this, "bank15") - , m_bank16(*this, "bank16") - , m_rombank1(*this, "rombank1") - , m_rombank2(*this, "rombank2") - , m_fixedrombank(*this, "fixedrombank") - , m_dma_dip(*this, "dma_s2") - {} - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(keyin_r); - DECLARE_READ8_MEMBER(status_r); - DECLARE_WRITE8_MEMBER(system_w); - DECLARE_WRITE_LINE_MEMBER(irq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - DECLARE_READ8_MEMBER(dma_r); - DECLARE_WRITE8_MEMBER(dma_w); - DECLARE_READ8_MEMBER(fdc_r); - DECLARE_WRITE8_MEMBER(fdc_w); - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - DECLARE_READ8_MEMBER(pia_pa_r); - DECLARE_WRITE8_MEMBER(pia_pa_w); - DECLARE_READ8_MEMBER(pia_pb_r); - DECLARE_WRITE8_MEMBER(pia_pb_w); - TIMER_DEVICE_CALLBACK_MEMBER(test_timer_w); - DECLARE_INPUT_CHANGED_MEMBER(drive_size_cb); - - DECLARE_FLOPPY_FORMATS(floppy_formats); - -private: - UINT8 m_term_data; - UINT8 m_dma_status; - UINT8 m_dma_ctrl; - UINT8 m_dma_drive_select; - UINT16 m_dma_start_addr; - UINT32 m_dma_current_addr; - UINT8 m_task; - UINT8 m_task_banks[16][16]; - UINT8 m_selected_drive; - bool m_floppy0_ready; - bool m_floppy1_ready; - - UINT8 m_pia1_pa; - UINT8 m_pia1_pb; - - virtual void machine_reset(); - virtual void machine_start(); - virtual void driver_start(); - - void refresh_memory(); - - required_device m_maincpu; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_ram; - required_memory_region m_rom; - required_device m_acia1; - required_device m_acia2; - required_device m_acia3; - required_device m_acia4; - - required_device m_bank1; - required_device m_bank2; - required_device m_bank3; - required_device m_bank4; - required_device m_bank5; - required_device m_bank6; - required_device m_bank7; - required_device m_bank8; - required_device m_bank9; - required_device m_bank10; - required_device m_bank11; - required_device m_bank12; - required_device m_bank13; - required_device m_bank14; - required_device m_bank15; - required_device m_bank16; - required_memory_bank m_rombank1; - required_memory_bank m_rombank2; - required_memory_bank m_fixedrombank; - - required_ioport m_dma_dip; -}; - -static ADDRESS_MAP_START( gimix_banked_mem, AS_PROGRAM, 8, gimix_state) - AM_RANGE(0x00000, 0x0dfff) AM_RAMBANK("lower_ram") - AM_RANGE(0x0e000, 0x0e000) AM_DEVREADWRITE("acia1",acia6850_device,status_r,control_w) - AM_RANGE(0x0e001, 0x0e001) AM_DEVREADWRITE("acia1",acia6850_device,data_r,data_w) - AM_RANGE(0x0e004, 0x0e004) AM_DEVREADWRITE("acia2",acia6850_device,status_r,control_w) - AM_RANGE(0x0e005, 0x0e005) AM_DEVREADWRITE("acia2",acia6850_device,data_r,data_w) - //AM_RANGE(0x0e018, 0x0e01b) AM_READWRITE(fdc_r, fdc_w) // FD1797 FDC (PIO) - AM_RANGE(0x0e100, 0x0e1ff) AM_RAM - //AM_RANGE(0x0e200, 0x0e20f) // 9511A / 9512 Arithmetic Processor - AM_RANGE(0x0e210, 0x0e21f) AM_DEVREADWRITE("timer",ptm6840_device,read,write) - AM_RANGE(0x0e220, 0x0e23f) AM_DEVREADWRITE("rtc",mm58167_device,read,write) - AM_RANGE(0x0e240, 0x0e3af) AM_RAM - AM_RANGE(0x0e3b0, 0x0e3b3) AM_READWRITE(dma_r, dma_w) // DMA controller (custom?) - AM_RANGE(0x0e3b4, 0x0e3b7) AM_READWRITE(fdc_r, fdc_w) // FD1797 FDC - AM_RANGE(0x0e400, 0x0e7ff) AM_RAM // scratchpad RAM - AM_RANGE(0x0e800, 0x0efff) AM_RAM - AM_RANGE(0x0f000, 0x0f7ff) AM_ROMBANK("rombank2") - AM_RANGE(0x0f800, 0x0ffff) AM_ROMBANK("rombank1") - //AM_RANGE(0x10000, 0x1ffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( gimix_mem, AS_PROGRAM, 8, gimix_state ) - AM_RANGE(0x0000, 0x0fff) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) - AM_RANGE(0x1000, 0x1fff) AM_DEVREADWRITE("bank2", address_map_bank_device, read8, write8) - AM_RANGE(0x2000, 0x2fff) AM_DEVREADWRITE("bank3", address_map_bank_device, read8, write8) - AM_RANGE(0x3000, 0x3fff) AM_DEVREADWRITE("bank4", address_map_bank_device, read8, write8) - AM_RANGE(0x4000, 0x4fff) AM_DEVREADWRITE("bank5", address_map_bank_device, read8, write8) - AM_RANGE(0x5000, 0x5fff) AM_DEVREADWRITE("bank6", address_map_bank_device, read8, write8) - AM_RANGE(0x6000, 0x6fff) AM_DEVREADWRITE("bank7", address_map_bank_device, read8, write8) - AM_RANGE(0x7000, 0x7fff) AM_DEVREADWRITE("bank8", address_map_bank_device, read8, write8) - AM_RANGE(0x8000, 0x8fff) AM_DEVREADWRITE("bank9", address_map_bank_device, read8, write8) - AM_RANGE(0x9000, 0x9fff) AM_DEVREADWRITE("bank10", address_map_bank_device, read8, write8) - AM_RANGE(0xa000, 0xafff) AM_DEVREADWRITE("bank11", address_map_bank_device, read8, write8) - AM_RANGE(0xb000, 0xbfff) AM_DEVREADWRITE("bank12", address_map_bank_device, read8, write8) - AM_RANGE(0xc000, 0xcfff) AM_DEVREADWRITE("bank13", address_map_bank_device, read8, write8) - AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE("bank14", address_map_bank_device, read8, write8) - AM_RANGE(0xe000, 0xefff) AM_DEVREADWRITE("bank15", address_map_bank_device, read8, write8) - AM_RANGE(0xf000, 0xfeff) AM_DEVREADWRITE("bank16", address_map_bank_device, read8, write8) - AM_RANGE(0xff00, 0xffff) AM_ROMBANK("fixedrombank") AM_WRITE(system_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( gimix_io, AS_IO, 8, gimix_state ) -ADDRESS_MAP_END - -static INPUT_PORTS_START( gimix ) - PORT_START("dma_s2") - PORT_DIPNAME(0x00000100,0x00000000,"5.25\" / 8\" floppy drive 0") PORT_DIPLOCATION("S2:9") PORT_CHANGED_MEMBER(DEVICE_SELF,gimix_state,drive_size_cb,NULL) - PORT_DIPSETTING(0x00000000,"5.25\"") - PORT_DIPSETTING(0x00000100,"8\"") - -INPUT_PORTS_END - -READ8_MEMBER( gimix_state::keyin_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( gimix_state::status_r ) -{ - return (m_term_data) ? 3 : 2; -} - -WRITE8_MEMBER( gimix_state::kbd_put ) -{ - m_term_data = data; -} - -void gimix_state::refresh_memory() -{ - int x; - address_map_bank_device* banknum[16] = { m_bank1, m_bank2, m_bank3, m_bank4, m_bank5, m_bank6, m_bank7, m_bank8, - m_bank9, m_bank10, m_bank11, m_bank12, m_bank13, m_bank14, m_bank15, m_bank16}; - - for(x=0;x<16;x++) // for each bank - { - banknum[x]->set_bank(m_task_banks[m_task][x]); - } -} - -WRITE8_MEMBER( gimix_state::system_w ) -{ - if(offset == 0x7f) // task register - { - if(data & 0x20) // FPLA software latch - { - m_rombank1->set_entry(2); - m_rombank2->set_entry(3); - m_fixedrombank->set_entry(2); - logerror("SYS: FPLA software latch set\n"); - } - else - { - m_rombank1->set_entry(0); - m_rombank2->set_entry(1); - m_fixedrombank->set_entry(0); - logerror("SYS: FPLA software latch reset\n"); - } - m_task = data & 0x0f; - refresh_memory(); - logerror("SYS: Task set to %02x\n",data & 0x0f); - } - if(offset >= 0xf0) // Dynamic Address Translation RAM (write only) - { - address_map_bank_device* banknum[16] = { m_bank1, m_bank2, m_bank3, m_bank4, m_bank5, m_bank6, m_bank7, m_bank8, - m_bank9, m_bank10, m_bank11, m_bank12, m_bank13, m_bank14, m_bank15, m_bank16}; - - banknum[offset-0xf0]->set_bank(data & 0x0f); - m_task_banks[m_task][offset-0xf0] = data & 0x0f; - logerror("SYS: Bank %i set to physical bank %02x\n",offset-0xf0,data); - } -} - -READ8_MEMBER(gimix_state::dma_r) -{ - switch(offset) - { - case 0: - if(m_dma_dip->read() & 0x00000100) - m_dma_status |= 0x01; // 8" - else - m_dma_status &= ~0x01; // 5.25" - return m_dma_status; - case 1: - return m_dma_ctrl; - case 2: - return (m_dma_start_addr & 0xff00) >> 8; - case 3: - return (m_dma_start_addr & 0x00ff); - default: - logerror("DMA: Unknown or invalid DMA register %02x read\n",offset); - } - return 0xff; -} - -WRITE8_MEMBER(gimix_state::dma_w) -{ - switch(offset) - { - case 0: - logerror("DMA: Drive select %02x\n",data); - m_dma_drive_select = data; - m_fdc->dden_w(DMA_DENSITY ? 1 : 0); - if(data & 0x40) // 8" / 5.25" connector select - m_dma_status |= 0x04; - else - m_dma_status &= ~0x04; - if(data & 0x01) - { - m_fdc->set_floppy(m_floppy0->get_device()); - m_selected_drive = 1; - m_floppy1->get_device()->mon_w(1); // switch off the motor of other drives... - m_floppy1_ready = false; - logerror("FDC: Floppy drive 1 motor off\n"); - } - if(data & 0x02) - { - m_fdc->set_floppy(m_floppy1->get_device()); - m_selected_drive = 2; - m_floppy0->get_device()->mon_w(1); // switch off the motor of other drives... - m_floppy0_ready = false; - logerror("FDC: Floppy drive 0 motor off\n"); - } - break; - case 1: - logerror("DMA: DMA control %02x\n",data); - m_dma_ctrl = data; - if(data & 0x10) - m_dma_status |= 0x12; - else - m_dma_status &= ~0x12; - if(data & 0x40) - { - if(m_selected_drive == 1) - m_floppy0->get_device()->ss_w(1); - if(m_selected_drive == 2) - m_floppy1->get_device()->ss_w(1); - } - else - { - if(m_selected_drive == 1) - m_floppy0->get_device()->ss_w(0); - if(m_selected_drive == 2) - m_floppy1->get_device()->ss_w(0); - } - break; - case 2: - logerror("DMA: DMA start address MSB %02x\n",data); - m_dma_start_addr = (m_dma_start_addr & 0x00ff) | (data << 8); - m_dma_current_addr = DMA_START_ADDR; - break; - case 3: - logerror("DMA: DMA start address LSB %02x\n",data); - m_dma_start_addr = (m_dma_start_addr & 0xff00) | data; - m_dma_current_addr = DMA_START_ADDR; - break; - default: - logerror("DMA: Unknown or invalid DMA register %02x write %02x\n",offset,data); - } -} - -READ8_MEMBER(gimix_state::fdc_r) -{ - // motors are switched on on FDC access - if(m_selected_drive == 1 && m_floppy0_ready == false) - { - m_floppy0->get_device()->mon_w(0); - m_floppy0_ready = true; - logerror("FDC: Floppy drive 0 motor on\n"); - } - if(m_selected_drive == 2 && m_floppy1_ready == false) - { - m_floppy1->get_device()->mon_w(0); - m_floppy1_ready = true; - logerror("FDC: Floppy drive 1 motor on\n"); - } - return m_fdc->read(space,offset); -} - -WRITE8_MEMBER(gimix_state::fdc_w) -{ - // motors are switched on on FDC access - if(m_selected_drive == 1) - m_floppy0->get_device()->mon_w(0); - if(m_selected_drive == 2) - m_floppy1->get_device()->mon_w(0); - m_fdc->write(space,offset,data); -} - -READ8_MEMBER(gimix_state::pia_pa_r) -{ - return m_pia1_pa; -} - -WRITE8_MEMBER(gimix_state::pia_pa_w) -{ - m_pia1_pa = data; - logerror("PIA: Port A write %02x\n",data); -} - -READ8_MEMBER(gimix_state::pia_pb_r) -{ - return m_pia1_pb; -} - -WRITE8_MEMBER(gimix_state::pia_pb_w) -{ - m_pia1_pb = data; - logerror("PIA: Port B write %02x\n",data); -} - - -WRITE_LINE_MEMBER(gimix_state::irq_w) -{ - m_maincpu->set_input_line(M6809_IRQ_LINE,state ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER(gimix_state::fdc_irq_w) -{ - if(state) - m_dma_status |= 0x40; - else - m_dma_status &= ~0x40; -} - -WRITE_LINE_MEMBER(gimix_state::fdc_drq_w) -{ - if(state && DMA_ENABLED) - { - m_dma_status |= 0x80; - // do a DMA transfer - if(DMA_DIRECTION) - { - // write to disk - m_fdc->data_w(m_ram->read(m_dma_current_addr)); -// logerror("DMA: read from RAM %05x\n",m_dma_current_addr); - } - else - { - // read from disk - m_ram->write(m_dma_current_addr,m_fdc->data_r()); -// logerror("DMA: write to RAM %05x\n",m_dma_current_addr); - } - m_dma_current_addr++; - } - else - m_dma_status &= ~0x80; -} - -INPUT_CHANGED_MEMBER(gimix_state::drive_size_cb) -{ - // set FDC clock based on DIP Switch S2-9 (5.25"/8" drive select) - if(m_dma_dip->read() & 0x00000100) - m_fdc->set_unscaled_clock(XTAL_8MHz / 4); // 8 inch (2MHz) - else - m_fdc->set_unscaled_clock(XTAL_8MHz / 8); // 5.25 inch (1MHz) -} - -void gimix_state::machine_reset() -{ - m_term_data = 0; - m_rombank1->set_entry(0); // RAM banks are undefined on startup - m_rombank2->set_entry(1); - m_fixedrombank->set_entry(0); - m_dma_status = 0x00; - m_dma_ctrl = 0x00; - m_task = 0x00; - m_selected_drive = 0; - m_floppy0_ready = false; - m_floppy1_ready = false; - membank("lower_ram")->set_base(m_ram->pointer()); - if(m_ram->size() > 65536) - membank("upper_ram")->set_base(m_ram->pointer()+0x10000); - - // initialise FDC clock based on DIP Switch S2-9 (5.25"/8" drive select) - if(m_dma_dip->read() & 0x00000100) - m_fdc->set_unscaled_clock(XTAL_8MHz / 4); // 8 inch (2MHz) - else - m_fdc->set_unscaled_clock(XTAL_8MHz / 8); // 5.25 inch (1MHz) -} - -void gimix_state::machine_start() -{ - UINT8* ROM = m_rom->base(); - m_rombank1->configure_entries(0,4,ROM,0x800); - m_rombank2->configure_entries(0,4,ROM,0x800); - m_fixedrombank->configure_entries(0,4,ROM+0x700,0x800); - m_rombank1->set_entry(0); // RAM banks are undefined on startup - m_rombank2->set_entry(1); - m_fixedrombank->set_entry(0); - // install any extra RAM - if(m_ram->size() > 65536) - { - m_bank1->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank2->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank3->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank4->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank5->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank6->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank7->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank8->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank9->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank10->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank11->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank12->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank13->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank14->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank15->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - m_bank16->space(AS_PROGRAM).install_readwrite_bank(0x10000,m_ram->size()-1,0xffff,0,"upper_ram"); - } - m_floppy0->get_device()->set_rpm(300); - m_floppy1->get_device()->set_rpm(300); -} - -void gimix_state::driver_start() -{ -} - -WRITE_LINE_MEMBER(gimix_state::write_acia_clock) -{ - m_acia1->write_txc(state); - m_acia1->write_rxc(state); - m_acia2->write_txc(state); - m_acia2->write_rxc(state); -} - -TIMER_DEVICE_CALLBACK_MEMBER(gimix_state::test_timer_w) -{ - static bool prev; - if(!prev) - { - m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE); - prev = true; - } - else - { - m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE); - prev = false; - } -} - -FLOPPY_FORMATS_MEMBER( gimix_state::floppy_formats ) - FLOPPY_FLEX_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( gimix_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) - SLOT_INTERFACE( "8dd", FLOPPY_8_DSDD ) -SLOT_INTERFACE_END - -#define MCFG_ADDRESS_BANK(tag) \ -MCFG_DEVICE_ADD(tag, ADDRESS_MAP_BANK, 0) \ -MCFG_DEVICE_PROGRAM_MAP(gimix_banked_mem) \ -MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) \ -MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) \ -MCFG_ADDRESS_MAP_BANK_STRIDE(0x1000) - -static MACHINE_CONFIG_START( gimix, gimix_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", M6809E, XTAL_8MHz) - MCFG_CPU_PROGRAM_MAP(gimix_mem) - MCFG_CPU_IO_MAP(gimix_io) - - /* rtc */ - MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz) - MCFG_MM58167_IRQ_CALLBACK(WRITELINE(gimix_state,irq_w)) - - /* timer */ - MCFG_DEVICE_ADD("timer", PTM6840, XTAL_2MHz) // clock is a guess - MCFG_PTM6840_IRQ_CB(WRITELINE(gimix_state,irq_w)) // PCB pictures show both the RTC and timer set to generate IRQs (are jumper configurable) - - /* floppy disks */ - MCFG_FD1797_ADD("fdc",XTAL_8MHz / 4) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(gimix_state,fdc_irq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(gimix_state,fdc_drq_w)) - MCFG_WD_FDC_FORCE_READY - MCFG_FLOPPY_DRIVE_ADD("fdc:0", gimix_floppies, "525hd", gimix_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", gimix_floppies, "525hd", gimix_state::floppy_formats) - - /* parallel ports */ - MCFG_DEVICE_ADD("pia1",PIA6821,XTAL_2MHz) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(gimix_state,pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(gimix_state,pia_pb_w)) - MCFG_PIA_READPA_HANDLER(READ8(gimix_state,pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(gimix_state,pia_pb_r)) - MCFG_DEVICE_ADD("pia2",PIA6821,XTAL_2MHz) - - /* serial ports */ - MCFG_DEVICE_ADD("acia1",ACIA6850,XTAL_2MHz) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("serial1",rs232_port_device,write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("serial1",rs232_port_device,write_rts)) - - MCFG_DEVICE_ADD("acia2",ACIA6850,XTAL_2MHz) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("serial2",rs232_port_device,write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("serial2",rs232_port_device,write_rts)) - - MCFG_DEVICE_ADD("acia3",ACIA6850,XTAL_2MHz) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("serial3",rs232_port_device,write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("serial3",rs232_port_device,write_rts)) - - MCFG_DEVICE_ADD("acia4",ACIA6850,XTAL_2MHz) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("serial4",rs232_port_device,write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("serial4",rs232_port_device,write_rts)) - - MCFG_RS232_PORT_ADD("serial1",default_rs232_devices,NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia1",acia6850_device,write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia1",acia6850_device,write_cts)) - - MCFG_RS232_PORT_ADD("serial2",default_rs232_devices,"terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia2",acia6850_device,write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia2",acia6850_device,write_cts)) - - MCFG_RS232_PORT_ADD("serial3",default_rs232_devices,NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia3",acia6850_device,write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia3",acia6850_device,write_cts)) - - MCFG_RS232_PORT_ADD("serial4",default_rs232_devices,NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia4",acia6850_device,write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia4",acia6850_device,write_cts)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(gimix_state, write_acia_clock)) - - /* banking */ - MCFG_ADDRESS_BANK("bank1") - MCFG_ADDRESS_BANK("bank2") - MCFG_ADDRESS_BANK("bank3") - MCFG_ADDRESS_BANK("bank4") - MCFG_ADDRESS_BANK("bank5") - MCFG_ADDRESS_BANK("bank6") - MCFG_ADDRESS_BANK("bank7") - MCFG_ADDRESS_BANK("bank8") - MCFG_ADDRESS_BANK("bank9") - MCFG_ADDRESS_BANK("bank10") - MCFG_ADDRESS_BANK("bank11") - MCFG_ADDRESS_BANK("bank12") - MCFG_ADDRESS_BANK("bank13") - MCFG_ADDRESS_BANK("bank14") - MCFG_ADDRESS_BANK("bank15") - MCFG_ADDRESS_BANK("bank16") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("56K,256K,512K") - - MCFG_SOFTWARE_LIST_ADD("flop_list","gimix") - - // uncomment this timer to use a hack that generates a regular IRQ, this will get OS-9 to boot - // for some unknown reason, OS-9 does not touch the 6840, and only clears/disables IRQs on the RTC - //MCFG_TIMER_DRIVER_ADD_PERIODIC("test_timer",gimix_state,test_timer_w,attotime::from_msec(100)) -MACHINE_CONFIG_END - -ROM_START( gimix ) - ROM_REGION( 0x10000, "roms", 0) -/* CPU board U4: gimixf8.bin - checksum 68DB - 2716 - GMXBUG09 V2.1 | (c)1981 GIMIX | $F800 I2716 */ - ROM_LOAD( "gimixf8.u4", 0x000000, 0x000800, CRC(7d60f838) SHA1(eb7546e8bbf50d33e181f3e86c3e4c5c9032cab2) ) -/* CPU board U5: gimixv14.bin - checksum 97E2 - 2716 - GIMIX 6809 | AUTOBOOT | V1.4 I2716 */ - ROM_LOAD( "gimixv14.u5", 0x000800, 0x000800, CRC(f795b8b9) SHA1(eda2de51cc298d94b36605437d900ce971b3b276) ) -/* CPU board U6: os9l1v11.bin - checksum 2C84 - 2716 - OS-9tmL1 V1 | GIMIX P1 " (c)1982 MSC - CPU board U7: os9l1v12.bin - checksum 7694 - 2716 - OS-9tmL1 V1 | GIMIX P2-68 | (c)1982 MSC */ - ROM_LOAD( "os9l1v11.u6", 0x001000, 0x000800, CRC(0d6527a0) SHA1(1435a22581c6e9e0ae338071a72eed646f429530) ) - ROM_LOAD( "os9l1v12.u7", 0x001800, 0x000800, CRC(b3c65feb) SHA1(19d1ea1e84473b25c95cbb8449e6b9828567e998) ) - -/* Hard drive controller board 2 (XEBEC board) 11H: gimixhd.bin - checksum 2436 - 2732 - 104521D */ - ROM_REGION( 0x10000, "xebec", 0) - ROM_LOAD( "gimixhd.h11", 0x000000, 0x001000, CRC(35c12201) SHA1(51ac9052f9757d79c7f5bd3aa5d8421e98cfcc37) ) -ROM_END - -COMP( 1980, gimix, 0, 0, gimix, gimix, driver_device, 0, "Gimix", "Gimix 6809 System", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/gizmondo.c b/src/mess/drivers/gizmondo.c deleted file mode 100644 index c048a9ce672..00000000000 --- a/src/mess/drivers/gizmondo.c +++ /dev/null @@ -1,249 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/******************************************************************************* - - Tiger Telematics Gizmondo - - (c) 2010 Tim Schuerewegen - -*******************************************************************************/ - -/* - -== DiskOnChip G3 - Layout == - -00000020 00000020 00000000 00000000 00000000 00000006 00000025 00000006 12A00000 000000FF 00000000 00000000 00000000 00000000 (BOOT & FTST) -00000140 00000140 00000000 00000000 00000000 00000026 00000165 00000026 12100000 000000FF 00000000 00000000 00000000 00000000 (KRNL) -00000001 00000001 00000000 00000000 00000000 00000166 00000166 00000166 12100000 000000FF 00000000 00000000 00000000 00000000 -00000299 00000264 0000002F 00000003 00000003 0000016A 000003FF 00000167 1C100000 000000FF 00000000 - -== Windows CE - Interrupts == - -SYSINTR_KEYBOARD = INT_EINT1, INT_EINT4_7 (EINT4/EINT5/EINT6/EINT7, INT_EINT8_23 (EINT23) -SYSINTR_SERIAL_1 = INT_UART0 (SUBINT_ERR0, SUBINT_TXD0, SUBINT_RXD0), INT_EINT4_7 (EINT13) -SYSINTR_SERIAL_2 = INT_UART2 (SUBINT_ERR2, SUBINT_TXD2, SUBINT_RXD2) -SYSINTR_SERIAL_3 = INT_EINT8_23 (EINT17), ? -SYSINTR_POWER = INT_EINT8_23 (EINT12) -SYSINTR_SYNTH = INT_EINT8_23 (EINT16) -SYSINTR_GPS = INT_EINT3, INT_EINT8_23 (EINT18) - -*/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "machine/docg3.h" -#include "machine/s3c2440.h" -#include "video/gf4500.h" -#include "rendlay.h" - -#define VERBOSE_LEVEL ( 0 ) - - -#define BIT(x,n) (((x)>>(n))&1) -#define BITS(x,m,n) (((x)>>(n))&(((UINT32)1<<((m)-(n)+1))-1)) - -class gizmondo_state : public driver_device -{ -public: - gizmondo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_s3c2440(*this, "s3c2440"), - m_maincpu(*this, "maincpu"), - m_gf4500(*this, "gf4500") - { } - - UINT32 m_port[9]; - required_device m_s3c2440; - DECLARE_DRIVER_INIT(gizmondo); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(port_changed); - inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); - required_device m_maincpu; - required_device m_gf4500; - DECLARE_READ32_MEMBER(s3c2440_gpio_port_r); - DECLARE_WRITE32_MEMBER(s3c2440_gpio_port_w); - - bitmap_rgb32 m_bitmap; -}; - - -inline void gizmondo_state::verboselog( int n_level, const char *s_fmt, ...) -{ - if (VERBOSE_LEVEL >= n_level) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt); - vsprintf( buf, s_fmt, v); - va_end( v); - logerror( "%s: %s", machine().describe_context( ), buf); - } -} -/******************************************************************************* - ... -*******************************************************************************/ - -// I/O PORT - -READ32_MEMBER(gizmondo_state::s3c2440_gpio_port_r) -{ - UINT32 data = m_port[offset]; - switch (offset) - { - case S3C2440_GPIO_PORT_D : - { - data = data & ~0x00000010; - data |= (1 << 4); // 1 = "BOOT", 0 = "FTST" - } - break; - case S3C2440_GPIO_PORT_F : - { - UINT32 port_c = m_port[S3C2440_GPIO_PORT_C]; - data = data & ~0x000000F2; - // keys - data |= 0x00F2; - if ((port_c & 0x01) == 0) data &= ~ioport("PORTF-01")->read(); - if ((port_c & 0x02) == 0) data &= ~ioport("PORTF-02")->read(); - if ((port_c & 0x04) == 0) data &= ~ioport("PORTF-04")->read(); - if ((port_c & 0x08) == 0) data &= ~ioport("PORTF-08")->read(); - if ((port_c & 0x10) == 0) data &= ~ioport("PORTF-10")->read(); - data &= ~ioport( "PORTF")->read(); - } - break; - case S3C2440_GPIO_PORT_G : - { - data = data & ~0x00008001; - // keys - data = data | 0x8000; - data &= ~ioport( "PORTG")->read(); - // no sd card inserted - data = data | 0x0001; - } - break; - } - return data; -} - -WRITE32_MEMBER(gizmondo_state::s3c2440_gpio_port_w) -{ - m_port[offset] = data; -} - -INPUT_CHANGED_MEMBER(gizmondo_state::port_changed) -{ - m_s3c2440->s3c2440_request_eint( 4); - //m_s3c2440->s3c2440_request_irq( S3C2440_INT_EINT1); -} - -#if 0 -QUICKLOAD_LOAD_MEMBER( gizmondo_state, gizmondo ) -{ - return gizmondo_quickload( image, file_type, quickload_size, 0x3000E000); // eboot - //return gizmondo_quickload( image, file_type, quickload_size, 0x30400000); // wince -} -#endif - -/******************************************************************************* - MACHINE HARDWARE -*******************************************************************************/ - -void gizmondo_state::machine_start() -{ - m_port[S3C2440_GPIO_PORT_B] = 0x055E; - m_port[S3C2440_GPIO_PORT_C] = 0x5F20; - m_port[S3C2440_GPIO_PORT_D] = 0x4F60; -} - -void gizmondo_state::machine_reset() -{ - m_maincpu->reset(); -} - -/******************************************************************************* - ADDRESS MAPS -*******************************************************************************/ - -static ADDRESS_MAP_START( gizmondo_map, AS_PROGRAM, 32, gizmondo_state ) - AM_RANGE(0x00000000, 0x000007ff) AM_ROM - AM_RANGE(0x00000800, 0x00000fff) AM_DEVREADWRITE16("diskonchip", diskonchip_g3_device, sec_1_r, sec_1_w, 0xffffffff) - AM_RANGE(0x00001000, 0x000017ff) AM_DEVREADWRITE16("diskonchip", diskonchip_g3_device, sec_2_r, sec_2_w, 0xffffffff) - AM_RANGE(0x00001800, 0x00001fff) AM_DEVREADWRITE16("diskonchip", diskonchip_g3_device, sec_3_r, sec_3_w, 0xffffffff) - AM_RANGE(0x30000000, 0x33ffffff) AM_RAM - AM_RANGE(0x34000000, 0x3413ffff) AM_DEVREADWRITE("gf4500", gf4500_device, read, write) -ADDRESS_MAP_END - -/******************************************************************************* - MACHINE DRIVERS -*******************************************************************************/ - -DRIVER_INIT_MEMBER(gizmondo_state,gizmondo) -{ - // do nothing -} - -static MACHINE_CONFIG_START( gizmondo, gizmondo_state ) - MCFG_CPU_ADD("maincpu", ARM9, 40000000) - MCFG_CPU_PROGRAM_MAP(gizmondo_map) - - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 240 - 1) - MCFG_SCREEN_UPDATE_DEVICE("gf4500", gf4500_device, screen_update) - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_GF4500_ADD("gf4500") - - MCFG_DEVICE_ADD("s3c2440", S3C2440, 12000000) - MCFG_S3C2440_PALETTE("palette") - MCFG_S3C2440_GPIO_PORT_R_CB(READ32(gizmondo_state, s3c2440_gpio_port_r)) - MCFG_S3C2440_GPIO_PORT_W_CB(WRITE32(gizmondo_state, s3c2440_gpio_port_w)) - - MCFG_DISKONCHIP_G3_ADD("diskonchip", 64) - -#if 0 - MCFG_QUICKLOAD_ADD("quickload", gizmondo_state, wince, "bin", 0) -#endif -MACHINE_CONFIG_END - -static INPUT_PORTS_START( gizmondo ) - PORT_START( "PORTF-01" ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("STOP") PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_PLAYER(1) - PORT_START( "PORTF-02" ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F2") PORT_PLAYER(1) PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("FORWARD") PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_PLAYER(1) - PORT_START( "PORTF-04" ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F3") PORT_PLAYER(1) PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("PLAY") PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_PLAYER(1) - PORT_START( "PORTF-08" ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F4") PORT_PLAYER(1) PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("REWIND") PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_PLAYER(1) - PORT_START( "PORTF-10" ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("L") PORT_PLAYER(1) PORT_CODE(KEYCODE_L) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("R") PORT_PLAYER(1) PORT_CODE(KEYCODE_R) - PORT_START( "PORTF" ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON11 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F5") PORT_PLAYER(1) PORT_CODE(KEYCODE_F5) - PORT_START( "PORTG" ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_CHANGED_MEMBER(DEVICE_SELF, gizmondo_state, port_changed, NULL) PORT_NAME("F1") PORT_PLAYER(1) PORT_CODE(KEYCODE_F1) -INPUT_PORTS_END - -/******************************************************************************* - GAME DRIVERS -*******************************************************************************/ - -ROM_START( gizmondo ) - ROM_REGION( 0x800, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "fboot", "fboot" ) - ROMX_LOAD( "fboot.bin", 0, 0x800, CRC(28887c29) SHA1(e625caaa63b9db74cb6d7499dce12ac758c5fe76), ROM_BIOS(1) ) -ROM_END - -CONS(2005, gizmondo, 0, 0, gizmondo, gizmondo, gizmondo_state, gizmondo, "Tiger Telematics", "Gizmondo", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/glasgow.c b/src/mess/drivers/glasgow.c deleted file mode 100644 index 803fd591005..00000000000 --- a/src/mess/drivers/glasgow.c +++ /dev/null @@ -1,509 +0,0 @@ -// license:??? -// copyright-holders:Dirk Verwiebe, Robbbert, Ralf Schaefer, Cowering -/*************************************************************************** -Mephisto Glasgow 3 S chess computer -Dirk V. -sp_rinter@gmx.de - -68000 CPU -64 KB ROM -16 KB RAM -4 Digit LC Display - -3* 74LS138 Decoder/Multiplexer -1*74LS74 Dual positive edge triggered D Flip Flop -1*74LS139 1of4 Demultiplexer -1*74LS05 HexInverter -1*NE555 R=100K C=10uF -2*74LS04 Hex Inverter -1*74LS164 8 Bit Shift register -1*74121 Monostable Multivibrator with Schmitt Trigger Inputs -1*74LS20 Dual 4 Input NAND GAte -1*74LS367 3 State Hex Buffers - - -Made playable by Robbbert in Nov 2009. - -How to play (quick guide) -1. You are the white player. -2. Click on the piece to move (LED starts flashing), then click where it goes -3. Computer plays black, it will work out its move and beep. -4. Read the move in the display, or look for the flashing LEDs. -5. Move the computer's piece in the same way you moved yours. -6. If a piece is being taken, firstly click on the piece then click the board - edge. This causes the piece to disappear. After that, move the piece that - took the other piece. -7. You'll need to read the official user manual for advanced features, or if - you get messages such as "Err1". - -Note about clickable artwork: You need to be running in windowed mode; - and you need to use newui. - -R.Schaefer Oct 2010 - -1. everything concerning chessboard moved to machine mboard -2. Border pieces added. This allow setting up and repair chess positons -3. chessboard added for Amsterdam, Dallas 16 Bit, Dallas 32 Bit, Roma 32 Bit -4. Save states added. - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "glasgow.lh" -#include "sound/beep.h" -#include "includes/mboard.h" - - -class glasgow_state : public mboard_state -{ -public: - glasgow_state(const machine_config &mconfig, device_type type, const char *tag) - : mboard_state(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_beep(*this, "beeper"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1") - { } - - required_device m_maincpu; - required_device m_beep; - DECLARE_WRITE16_MEMBER(glasgow_lcd_w); - DECLARE_WRITE16_MEMBER(glasgow_lcd_flag_w); - DECLARE_READ16_MEMBER(glasgow_keys_r); - DECLARE_WRITE16_MEMBER(glasgow_keys_w); - DECLARE_WRITE16_MEMBER(write_lcd); - DECLARE_WRITE16_MEMBER(write_lcd_flag); - DECLARE_WRITE16_MEMBER(write_irq_flag); - DECLARE_READ16_MEMBER(read_newkeys16); - DECLARE_WRITE32_MEMBER(write_lcd32); - DECLARE_WRITE32_MEMBER(write_lcd_flag32); - DECLARE_READ32_MEMBER(read_newkeys32); - DECLARE_WRITE32_MEMBER(write_beeper32); - UINT8 m_lcd_shift_counter; - UINT8 m_led7; - UINT8 m_irq_flag; - UINT16 m_beeper; - DECLARE_READ16_MEMBER(read_test); - DECLARE_READ16_MEMBER(read_board_amsterd); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_MACHINE_START(dallas32); - TIMER_DEVICE_CALLBACK_MEMBER(update_nmi); - TIMER_DEVICE_CALLBACK_MEMBER(update_nmi32); - required_ioport m_line0; - required_ioport m_line1; -}; - - - -WRITE16_MEMBER( glasgow_state::glasgow_lcd_w ) -{ - UINT8 lcd_data = data >> 8; - - if (m_led7 == 0) - output_set_digit_value(m_lcd_shift_counter, lcd_data); - - m_lcd_shift_counter--; - m_lcd_shift_counter &= 3; -} - -WRITE16_MEMBER( glasgow_state::glasgow_lcd_flag_w ) -{ - UINT16 lcd_flag = data & 0x8100; - - m_beep->set_state(BIT(lcd_flag, 8)); - - if (lcd_flag) - m_led7 = 255; - else - { - m_led7 = 0; - mboard_key_selector = 1; - } -} - -READ16_MEMBER( glasgow_state::glasgow_keys_r ) -{ - UINT8 data = 0xff; - - /* See if any keys pressed */ - data = 3; - - if (mboard_key_select == m_line0->read()) - data &= 1; - - if (mboard_key_select == m_line1->read()) - data &= 2; - - return data << 8; -} - -WRITE16_MEMBER( glasgow_state::glasgow_keys_w ) -{ - mboard_key_select = data >> 8; -} - -WRITE16_MEMBER( glasgow_state::write_lcd ) -{ - UINT8 lcd_data = data >> 8; - - output_set_digit_value(m_lcd_shift_counter, mboard_lcd_invert & 1 ? lcd_data^0xff : lcd_data); - m_lcd_shift_counter--; - m_lcd_shift_counter &= 3; - logerror("LCD Offset = %d Data low = %x \n", offset, lcd_data); -} - -WRITE16_MEMBER( glasgow_state::write_lcd_flag ) -{ -// UINT8 lcd_flag; - mboard_lcd_invert = 0; -// lcd_flag=data >> 8; - //m_beep->set_state((data >> 8) & 1 ? 1 : 0); - if ((data >> 8) == 0) - { - mboard_key_selector = 1; - m_led7 = 0; - } - else - m_led7 = 0xff; - - -// The key function in the rom expects after writing to -// the a value from the second key row; -// if (lcd_flag != 0) -// m_led7 = 255; -// else -// m_led7 = 0; -// - logerror("LCD Flag 16 = %x \n", data); -} - -WRITE16_MEMBER( glasgow_state::write_irq_flag ) -{ - m_beep->set_state(data & 0x100); - logerror("Write 0x800004 = %x \n", data); - m_irq_flag = 1; - m_beeper = data; -} - -READ16_MEMBER( glasgow_state::read_newkeys16 ) //Amsterdam, Roma -{ - UINT16 data; - - if (mboard_key_selector == 0) - data = m_line0->read(); - else - data = m_line1->read(); - - logerror("read Keyboard Offset = %x Data = %x Select = %x \n", offset, data, mboard_key_selector); - data <<= 8; - return data ; -} - - -#ifdef UNUSED_FUNCTION -READ16_MEMBER(glasgow_state::read_test) -{ - logerror("read test Offset = %x Data = %x\n ",offset,data); - return 0xffff; // Mephisto need it for working -} -#endif - -/* - - ***** 32 Bit Read and write Handler *********** - -*/ - -WRITE32_MEMBER( glasgow_state::write_lcd32 ) -{ - UINT8 lcd_data = data >> 8; - - output_set_digit_value(m_lcd_shift_counter, mboard_lcd_invert & 1 ? lcd_data^0xff : lcd_data); - m_lcd_shift_counter--; - m_lcd_shift_counter &= 3; - //logerror("LCD Offset = %d Data = %x \n ", offset, lcd_data); -} - -WRITE32_MEMBER( glasgow_state::write_lcd_flag32 ) -{ -// UINT8 lcd_flag = data >> 24; - - mboard_lcd_invert = 0; - - if ((data >> 24) == 0) - { - mboard_key_selector = 1; - m_led7 = 0; - } - else - m_led7 = 0xff; - - - //logerror("LCD Flag 32 = %x \n", data >> 24); - //m_beep->set_state((data >> 24) & 1 ? 1 : 0); - -// if (lcd_flag != 0) -// m_led7 = 255; -// else -// m_led7 = 0; -} - -READ32_MEMBER( glasgow_state::read_newkeys32 ) // Dallas 32, Roma 32 -{ - UINT32 data; - - if (mboard_key_selector == 0) - data = m_line0->read(); - else - data = m_line1->read(); - //if (mboard_key_selector == 1) data = m_line0->read(); else data = 0; - if(data) - logerror("read Keyboard Offset = %x Data = %x\n", offset, data); - data <<= 24; - return data ; -} - -#ifdef UNUSED_FUNCTION -READ16_MEMBER(glasgow_state::read_board_amsterd) -{ - logerror("read board amsterdam Offset = %x \n ", offset); - return 0xffff; -} -#endif - -WRITE32_MEMBER( glasgow_state::write_beeper32 ) -{ - m_beep->set_state(data & 0x01000000); - logerror("Write 0x8000004 = %x \n", data); - m_irq_flag = 1; - m_beeper = data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(glasgow_state::update_nmi) -{ - m_maincpu->set_input_line(7, HOLD_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(glasgow_state::update_nmi32) -{ - m_maincpu->set_input_line(6, HOLD_LINE); -} - -void glasgow_state::machine_start() -{ - mboard_key_selector = 0; - m_irq_flag = 0; - m_lcd_shift_counter = 3; - m_beep->set_frequency(44); - - mboard_savestate_register(); -} - - -MACHINE_START_MEMBER(glasgow_state,dallas32) -{ - m_lcd_shift_counter = 3; - m_beep->set_frequency(44); - - mboard_savestate_register(); -} - - -void glasgow_state::machine_reset() -{ - m_lcd_shift_counter = 3; - - mboard_set_border_pieces(); - mboard_set_board(); -} - -static ADDRESS_MAP_START(glasgow_mem, AS_PROGRAM, 16, glasgow_state) - ADDRESS_MAP_GLOBAL_MASK(0x1FFFF) - AM_RANGE(0x00000000, 0x0000ffff) AM_ROM - AM_RANGE(0x00010000, 0x00010001) AM_WRITE(glasgow_lcd_w) - AM_RANGE(0x00010002, 0x00010003) AM_READWRITE(glasgow_keys_r,glasgow_keys_w) - AM_RANGE(0x00010004, 0x00010005) AM_WRITE(glasgow_lcd_flag_w) - AM_RANGE(0x00010006, 0x00010007) AM_READWRITE(mboard_read_board_16,mboard_write_LED_16) - AM_RANGE(0x00010008, 0x00010009) AM_WRITE(mboard_write_board_16) - AM_RANGE(0x0001c000, 0x0001ffff) AM_RAM // 16KB -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(amsterd_mem, AS_PROGRAM, 16, glasgow_state) - // ADDRESS_MAP_GLOBAL_MASK(0x7FFFF) - AM_RANGE(0x00000000, 0x0000ffff) AM_ROM - AM_RANGE(0x00800002, 0x00800003) AM_WRITE(write_lcd) - AM_RANGE(0x00800008, 0x00800009) AM_WRITE(write_lcd_flag) - AM_RANGE(0x00800004, 0x00800005) AM_WRITE(write_irq_flag) - AM_RANGE(0x00800010, 0x00800011) AM_WRITE(mboard_write_board_16) - AM_RANGE(0x00800020, 0x00800021) AM_READ(mboard_read_board_16) - AM_RANGE(0x00800040, 0x00800041) AM_READ(read_newkeys16) - AM_RANGE(0x00800088, 0x00800089) AM_WRITE(mboard_write_LED_16) - AM_RANGE(0x00ffc000, 0x00ffffff) AM_RAM // 16KB -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(dallas32_mem, AS_PROGRAM, 32, glasgow_state) - // ADDRESS_MAP_GLOBAL_MASK(0x1FFFF) - AM_RANGE(0x00000000, 0x0000ffff) AM_ROM - AM_RANGE(0x00010000, 0x0001ffff) AM_RAM // 64KB - AM_RANGE(0x00800000, 0x00800003) AM_WRITE(write_lcd32) - AM_RANGE(0x00800004, 0x00800007) AM_WRITE(write_beeper32) - AM_RANGE(0x00800008, 0x0080000B) AM_WRITE(write_lcd_flag32) - AM_RANGE(0x00800010, 0x00800013) AM_WRITE(mboard_write_board_32) - AM_RANGE(0x00800020, 0x00800023) AM_READ(mboard_read_board_32) - AM_RANGE(0x00800040, 0x00800043) AM_READ(read_newkeys32) - AM_RANGE(0x00800088, 0x0080008b) AM_WRITE(mboard_write_LED_32) -ADDRESS_MAP_END - -static INPUT_PORTS_START( new_keyboard ) //Amsterdam, Dallas 32, Roma, Roma 32 - PORT_START("LINE0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A 1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B 2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C 3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D 4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E 5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F 6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_9) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_0) - - PORT_START("LINE1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INF") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLR") PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G 7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H 8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) -INPUT_PORTS_END - -static INPUT_PORTS_START( old_keyboard ) //Glasgow,Dallas - PORT_START("LINE0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C 3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D 4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A 1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F 6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B 2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2) - - PORT_START("LINE1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E 5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INF") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H 8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G 7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4) -INPUT_PORTS_END - - -INPUT_PORTS_EXTERN( chessboard); - -static INPUT_PORTS_START( oldkeys ) - PORT_INCLUDE( old_keyboard ) - PORT_INCLUDE( chessboard ) -INPUT_PORTS_END - -static INPUT_PORTS_START( newkeys ) - PORT_INCLUDE( new_keyboard ) - PORT_INCLUDE( chessboard ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( glasgow, glasgow_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 12000000) - MCFG_CPU_PROGRAM_MAP(glasgow_mem) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", glasgow_state, update_nmi, attotime::from_hz(50)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", glasgow_state, mboard_update_artwork, attotime::from_hz(100)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( amsterd, glasgow ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(amsterd_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dallas32, glasgow ) - /* basic machine hardware */ - MCFG_CPU_REPLACE("maincpu", M68020, 14000000) - MCFG_CPU_PROGRAM_MAP(dallas32_mem) - MCFG_MACHINE_START_OVERRIDE(glasgow_state, dallas32 ) - - MCFG_DEVICE_REMOVE("nmi_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", glasgow_state, update_nmi32, attotime::from_hz(50)) - -MACHINE_CONFIG_END - -/*************************************************************************** - ROM definitions -***************************************************************************/ - -ROM_START( glasgow ) - ROM_REGION( 0x10000, "maincpu", 0 ) - //ROM_LOAD("glasgow.rom", 0x000000, 0x10000, CRC(3e73eff3) ) - ROM_LOAD16_BYTE("me3_3_1u.410",0x00000, 0x04000,CRC(bc8053ba) SHA1(57ea2d5652bfdd77b17d52ab1914de974bd6be12)) - ROM_LOAD16_BYTE("me3_1_1l.410",0x00001, 0x04000,CRC(d5263c39) SHA1(1bef1cf3fd96221eb19faecb6ec921e26ac10ac4)) - ROM_LOAD16_BYTE("me3_4_2u.410",0x08000, 0x04000,CRC(8dba504a) SHA1(6bfab03af835cdb6c98773164d32c76520937efe)) - ROM_LOAD16_BYTE("me3_2_2l.410",0x08001, 0x04000,CRC(b3f27827) SHA1(864ba897d24024592d08c4ae090aa70a2cc5f213)) -ROM_END - -ROM_START( amsterd ) - ROM_REGION16_BE( 0x1000000, "maincpu", 0 ) - //ROM_LOAD16_BYTE("output.bin", 0x000000, 0x10000, CRC(3e73eff3) ) - ROM_LOAD16_BYTE("amsterda-u.bin",0x00000, 0x05a00,CRC(16cefe29) SHA1(9f8c2896e92fbfd47159a59cb5e87706092c86f4)) - ROM_LOAD16_BYTE("amsterda-l.bin",0x00001, 0x05a00,CRC(c859dfde) SHA1(b0bca6a8e698c322a8c597608db6735129d6cdf0)) -ROM_END - - -ROM_START( dallas ) - ROM_REGION16_BE( 0x1000000, "maincpu", 0 ) - ROM_LOAD16_BYTE("dal_g_pr.dat",0x00000, 0x04000,CRC(66deade9) SHA1(07ec6b923f2f053172737f1fc94aec84f3ea8da1)) - ROM_LOAD16_BYTE("dal_g_pl.dat",0x00001, 0x04000,CRC(c5b6171c) SHA1(663167a3839ed7508ecb44fd5a1b2d3d8e466763)) - ROM_LOAD16_BYTE("dal_g_br.dat",0x08000, 0x04000,CRC(e24d7ec7) SHA1(a936f6fcbe9bfa49bf455f2d8a8243d1395768c1)) - ROM_LOAD16_BYTE("dal_g_bl.dat",0x08001, 0x04000,CRC(144a15e2) SHA1(c4fcc23d55fa5262f5e01dbd000644a7feb78f32)) -ROM_END - -ROM_START( dallas16 ) - ROM_REGION16_BE( 0x1000000, "maincpu", 0 ) - ROM_LOAD16_BYTE("dallas-u.bin",0x00000, 0x06f00,CRC(8c1462b4) SHA1(8b5f5a774a835446d08dceacac42357b9e74cfe8)) - ROM_LOAD16_BYTE("dallas-l.bin",0x00001, 0x06f00,CRC(f0d5bc03) SHA1(4b1b9a71663d5321820b4cf7da205e5fe5d3d001)) -ROM_END - -ROM_START( roma ) - ROM_REGION16_BE( 0x1000000, "maincpu", 0 ) - ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd)) -ROM_END - -ROM_START( dallas32 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("dallas32.epr", 0x000000, 0x10000, CRC(83b9ff3f) SHA1(97bf4cb3c61f8ec328735b3c98281bba44b30a28) ) -ROM_END - -ROM_START( roma32 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd) ) -ROM_END - - -/*************************************************************************** - Game drivers -***************************************************************************/ - -/* YEAR, NAME, PARENT, COMPAT, MACHINE, INPUT, INIT, COMPANY, FULLNAME, FLAGS */ -CONS( 1984, glasgow, 0, 0, glasgow, oldkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto III S Glasgow", MACHINE_SUPPORTS_SAVE) -CONS( 1984, amsterd, 0, 0, amsterd, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Amsterdam", MACHINE_SUPPORTS_SAVE) -CONS( 1984, dallas, glasgow, 0, glasgow, oldkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas", MACHINE_SUPPORTS_SAVE) -CONS( 1984, roma, amsterd, 0, glasgow, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Roma", MACHINE_NOT_WORKING) -CONS( 1984, dallas32, amsterd, 0, dallas32, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas 32 Bit", MACHINE_SUPPORTS_SAVE) -CONS( 1984, roma32, amsterd, 0, dallas32, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Roma 32 Bit", MACHINE_SUPPORTS_SAVE) -CONS( 1984, dallas16, amsterd, 0, amsterd, newkeys, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas 16 Bit", MACHINE_SUPPORTS_SAVE) diff --git a/src/mess/drivers/gmaster.c b/src/mess/drivers/gmaster.c deleted file mode 100644 index aba49b950b3..00000000000 --- a/src/mess/drivers/gmaster.c +++ /dev/null @@ -1,315 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - PeT mess@utanet.at march 2002 -******************************************************************************/ - -#include "emu.h" -#include "cpu/upd7810/upd7810.h" -#include "sound/speaker.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "rendlay.h" - - -class gmaster_state : public driver_device -{ -public: - gmaster_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_speaker(*this, "speaker") - , m_cart(*this, "cartslot") - , m_io_joy(*this, "JOY") - { } - - DECLARE_PALETTE_INIT(gmaster); - DECLARE_READ8_MEMBER(gmaster_io_r); - DECLARE_WRITE8_MEMBER(gmaster_io_w); - DECLARE_READ8_MEMBER(gmaster_port_r); - DECLARE_WRITE8_MEMBER(gmaster_port_w); - DECLARE_DRIVER_INIT(gmaster) { memset(&m_video, 0, sizeof(m_video)); memset(m_ram, 0, sizeof(m_ram)); } - UINT32 screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -private: - virtual void machine_start(); - - struct - { - UINT8 data[8]; - int index; - int x, y; - bool mode; // true read does not increase address - bool delayed; - UINT8 pixels[8][64]; - } m_video; - - UINT8 m_ports[5]; - UINT8 m_ram[0x4000]; - required_device m_maincpu; - required_device m_speaker; - required_device m_cart; - required_ioport m_io_joy; -}; - - -READ8_MEMBER(gmaster_state::gmaster_io_r) -{ - UINT8 data = 0; - - if (m_ports[2] & 1) - { - data = m_ram[offset]; - logerror("%.4x external memory %.4x read %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); - } - else - { - switch (offset) - { - case 1: - data = m_video.pixels[m_video.y][m_video.x]; - logerror("%.4x lcd x:%.2x y:%.2x %.4x read %.2x\n", m_maincpu->pc(), m_video.x, m_video.y, 0x4000 + offset, data); - if (!(m_video.mode) && m_video.delayed) - { - m_video.x++; - } - m_video.delayed = true; - break; - default: - logerror("%.4x memory %.4x read %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); - break; - } - } - return data; -} - -#define BLITTER_Y ((m_ports[2]&4)|(m_video.data[0]&3)) - - -WRITE8_MEMBER(gmaster_state::gmaster_io_w) -{ - if (m_ports[2] & 1) - { - m_ram[offset] = data; - logerror("%.4x external memory %.4x written %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); - } - else - { - switch (offset) - { - case 0: - m_video.delayed = false; - logerror("%.4x lcd %.4x written %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); - // e2 af a4 a0 a9 falling block init for both halves - if ((data & 0xfc) == 0xb8) - { - m_video.index = 0; - m_video.data[m_video.index] = data; - m_video.y = BLITTER_Y; - } - else if ((data & 0xc0) == 0) - { - m_video.x = data; - } - else if ((data & 0xf0) == 0xe0) - { - m_video.mode = (data & 0xe) ? false : true; - } - m_video.data[m_video.index] = data; - m_video.index = (m_video.index + 1) & 7; - break; - case 1: - m_video.delayed = false; - if (m_video.x < ARRAY_LENGTH(m_video.pixels[0])) // continental galaxy flutlicht - { - m_video.pixels[m_video.y][m_video.x] = data; - } - logerror("%.4x lcd x:%.2x y:%.2x %.4x written %.2x\n", m_maincpu->pc(), m_video.x, m_video.y, 0x4000 + offset, data); - m_video.x++; -/* 02 b8 1a - 02 bb 1a - 02 bb 22 - 04 b8 12 - 04 b8 1a - 04 b8 22 - 04 b9 12 - 04 b9 1a - 04 b9 22 - 02 bb 12 - 4000 e0 - rr w rr w rr w rr w rr w rr w rr w rr w - 4000 ee -*/ - break; - default: - logerror("%.4x memory %.4x written %.2x\n", m_maincpu->pc(), 0x4000 + offset, data); - break; - } - } -} - - -READ8_MEMBER(gmaster_state::gmaster_port_r) -{ -// UINT8 data = m_ports[offset]; - UINT8 data = 0xff; - switch (offset) - { - case UPD7810_PORTA: - data = m_io_joy->read(); - break; - default: - logerror("%.4x port %d read %.2x\n", m_maincpu->pc(), offset, data); - break; - } - return data; -} - - -WRITE8_MEMBER(gmaster_state::gmaster_port_w) -{ - m_ports[offset] = data; - logerror("%.4x port %d written %.2x\n", m_maincpu->pc(), offset, data); - switch (offset) - { - case UPD7810_PORTC: - m_video.y = BLITTER_Y; - m_speaker->level_w(BIT(data, 4)); - break; - } -} - - -static ADDRESS_MAP_START( gmaster_mem, AS_PROGRAM, 8, gmaster_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(gmaster_io_r, gmaster_io_w) - //AM_RANGE(0x8000, 0xfeff) // mapped by the cartslot - AM_RANGE(0xff00, 0xffff) AM_RAM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(gmaster_io, AS_IO, 8, gmaster_state ) - AM_RANGE(UPD7810_PORTA, UPD7810_PORTF) AM_READWRITE(gmaster_port_r, gmaster_port_w ) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( gmaster ) - PORT_START("JOY") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start") -INPUT_PORTS_END - - -/* palette in red, green, blue tribles */ -static const unsigned char gmaster_palette[2][3] = -{ -#if 1 - { 130, 159, 166 }, - { 45,45,43 } -#else - { 255,255,255 }, - { 0, 0, 0 } -#endif -}; - - -PALETTE_INIT_MEMBER(gmaster_state, gmaster) -{ - int i; - - for (i = 0; i < 2; i++) - { - palette.set_pen_color(i, gmaster_palette[i][0], gmaster_palette[i][1], gmaster_palette[i][2]); - } -} - - -UINT32 gmaster_state::screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - for (y = 0; y < ARRAY_LENGTH(m_video.pixels); y++) - { - for (x = 0; x < ARRAY_LENGTH(m_video.pixels[0]); x++) - { - UINT8 d = m_video.pixels[y][x]; - UINT16 *line; - - line = &bitmap.pix16((y * 8), x); - line[0] = BIT(d, 0); - line = &bitmap.pix16((y * 8 + 1), x); - line[0] = BIT(d, 1); - line = &bitmap.pix16((y * 8 + 2), x); - line[0] = BIT(d, 2); - line = &bitmap.pix16((y * 8 + 3), x); - line[0] = BIT(d, 3); - line = &bitmap.pix16((y * 8 + 4), x); - line[0] = BIT(d, 4); - line = &bitmap.pix16((y * 8 + 5), x); - line[0] = BIT(d, 5); - line = &bitmap.pix16((y * 8 + 6), x); - line[0] = BIT(d, 6); - line = &bitmap.pix16((y * 8 + 7), x); - line[0] = BIT(d, 7); - } - } - return 0; -} - - -void gmaster_state::machine_start() -{ - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xfeff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - save_item(NAME(m_video.data)); - save_item(NAME(m_video.index)); - save_item(NAME(m_video.x)); - save_item(NAME(m_video.y)); - save_item(NAME(m_video.mode)); - save_item(NAME(m_video.delayed)); - save_item(NAME(m_video.pixels)); - save_item(NAME(m_ports)); - save_item(NAME(m_ram)); -} - - -static MACHINE_CONFIG_START( gmaster, gmaster_state ) - MCFG_CPU_ADD("maincpu", UPD7810, XTAL_12MHz/2/*?*/) // upd78c11 in the unit - MCFG_CPU_PROGRAM_MAP(gmaster_mem) - MCFG_CPU_IO_MAP( gmaster_io) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(64, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 64-1-3, 0, 64-1) - MCFG_SCREEN_UPDATE_DRIVER(gmaster_state, screen_update_gmaster) - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gmaster_palette)) - MCFG_PALETTE_INIT_OWNER(gmaster_state, gmaster) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(0, "mono", 0.50) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "gmaster_cart") - MCFG_GENERIC_MANDATORY - - MCFG_SOFTWARE_LIST_ADD("cart_list","gmaster") -MACHINE_CONFIG_END - - -ROM_START(gmaster) - ROM_REGION(0x10000,"maincpu", 0) - ROM_LOAD("d78c11agf_e19.u1", 0x0000, 0x1000, CRC(05cc45e5) SHA1(05d73638dea9657ccc2791c0202d9074a4782c1e) ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -CONS( 1990, gmaster, 0, 0, gmaster, gmaster, gmaster_state, gmaster, "Hartung", "Game Master", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/gp2x.c b/src/mess/drivers/gp2x.c deleted file mode 100644 index 0865638044e..00000000000 --- a/src/mess/drivers/gp2x.c +++ /dev/null @@ -1,393 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/************************************************************************** - * - * gp2x.c - Game Park Holdings GP2X - * Skeleton by R. Belmont - * - * CPU: MagicEyes MP2520F SoC - * MP2520F consists of: - * ARM920T CPU core + MMU - * ARM940T slave CPU w/o MMU - * LCD controller - * DMA controller - * Interrupt controller - * NAND flash interface - * MMC/SD Card interface - * USB controller - * and more. - * - **************************************************************************/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" - - -class gp2x_state : public driver_device -{ -public: - gp2x_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_maincpu_region(*this, "maincpu"), - m_ram(*this, "ram"){ } - - required_device m_maincpu; - required_region_ptr m_maincpu_region; - DECLARE_READ32_MEMBER(gp2x_lcdc_r); - DECLARE_WRITE32_MEMBER(gp2x_lcdc_w); - DECLARE_READ32_MEMBER(nand_r); - DECLARE_WRITE32_MEMBER(nand_w); - DECLARE_READ32_MEMBER(tx_status_r); - DECLARE_WRITE32_MEMBER(tx_xmit_w); - DECLARE_READ32_MEMBER(timer_r); - DECLARE_READ32_MEMBER(nand_ctrl_r); - DECLARE_WRITE32_MEMBER(nand_ctrl_w); - DECLARE_READ32_MEMBER(sdcard_r); - required_shared_ptr m_ram; - UINT16 m_vidregs[0x200/2]; - UINT32 m_nand_ptr; - UINT32 m_nand_cmd; - UINT32 m_nand_subword_stage; - UINT32 m_nand_stage; - UINT32 m_nand_ptr_temp; - UINT32 m_timer; - UINT32 screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); -}; - - - -#if 0 -static const char *const gp2x_regnames[0x200] = -{ - "DPC Control", - "PAD Control", - "PAD Polarity Control 1", - "PAD Polarity Control 2", - "PAD Polarity Control 3", - "PAD Enable Control 1", - "PAD Enable Control 2", - "PAD Enable Control 3", - "", - "", - "", - "Active width", - "Active height", - "HSYNC width", - "HSYNC start", - "HSYNC end", - "VSYNC control", // 20 - "VSYNC end", - "", - "DE Control", - "S Control", - "FG Control", - "LP Control", - "CLKV Control", - "CLKV Control 2", // 30 - "POL Control", - "CIS Sync Control", - "", - "", - "Luma blank level", - "Chroma blank level", - "Luma pos sync", - "Luma neg sync", // 40 - "Chroma pos sync", - "Chroma neg sync", - "Interrupt control", - "Clock control", - "", - "", - "", - "", // 50 - "", - "", - "", - "", - "", - "", - "", - "", // 60 - "", - "", - "", - "", - "", - "", - "", - "", // 70 - "", - "", - "", - "", - "", - "", - "", - "Overlay control", // 80 - "Image effect", - "Image control", - "Scale factor A top", - "Scale factor A bottom", - "Scale factor A top 2 H", - "Scale factor A top 2 L", - "Scale factor A bottom 2 H", - "Scale factor A bottom 2 L", // 90 - "Width region A top", - "Width region A bottom", - "H Offset region A", - "H Offset region A 2", - "V Start region A", - "V End region A top", - "V End region A bottom", - "YUV Source region A L", // a0 - "YUV Source region A H", -}; -#endif -UINT32 gp2x_state::screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - // display enabled? - if (m_vidregs[0] & 1) - { - // only support RGB still image layer for now - if (m_vidregs[0x80/2] & 4) - { - int x, y; - UINT16 *vram = (UINT16 *)&m_ram[0x2100000/4]; - -/* printf("RGB still image 1 enabled, bpp %d, size is %d %d %d %d\n", - (m_vidregs[(0xda/2)]>>9)&3, - m_vidregs[(0xe2/2)], - m_vidregs[(0xe4/2)], - m_vidregs[(0xe6/2)], - m_vidregs[(0xe8/2)]);*/ - - - for (y = 0; y < 240; y++) - { - UINT32 *scanline = &bitmap.pix32(y); - - for (x = 0; x < 320; x++) - { - UINT16 pixel = vram[(320*y)+x]; - - *scanline++ = rgb_t(0xff, (pixel>>11)<<3, ((pixel>>5)&0x3f)<<2, (pixel&0x1f)<<3); - } - } - } - } - - return 0; -} - -READ32_MEMBER( gp2x_state::gp2x_lcdc_r ) -{ - return m_vidregs[offset*2] | m_vidregs[(offset*2)+1]<<16; -} - -WRITE32_MEMBER( gp2x_state::gp2x_lcdc_w ) -{ - if (mem_mask == 0xffff) - { - m_vidregs[offset*2] = data; -// printf("%x to video reg %x (%s)\n", data, offset*2, gp2x_regnames[offset*2]); - } - else if (mem_mask == 0xffff0000) - { - m_vidregs[(offset*2)+1] = data>>16; -// printf("%x to video reg %x (%s)\n", data>>16, (offset*2)+1, gp2x_regnames[(offset*2)+1]); - } - else - { - logerror("GP2X LCDC: ERROR: write %x to vid reg @ %x mask %08x\n", data, offset, mem_mask); - } -} - -READ32_MEMBER( gp2x_state::nand_r ) -{ - UINT32 *ROM = m_maincpu_region; - UINT32 ret; - - if (offset == 0) - { - switch (m_nand_cmd) - { - case 0: - if (mem_mask == 0xffffffff) - { - return ROM[m_nand_ptr++]; - } - else if (mem_mask == 0x000000ff) // byte-wide reads? - { - switch (m_nand_subword_stage++) - { - case 0: - return ROM[m_nand_ptr]; - case 1: - return ROM[m_nand_ptr]>>8; - case 2: - return ROM[m_nand_ptr]>>16; - case 3: - ret = ROM[m_nand_ptr]>>24; - m_nand_subword_stage = 0; - m_nand_ptr++; - return ret; - default: - logerror("Bad nand_subword_stage = %d\n", m_nand_subword_stage); - break; - } - } - break; - - case 0x50: // read out-of-band data - return 0xff; - - case 0x90: // read ID - switch (m_nand_stage++) - { - case 0: - return 0xec; // Samsung - case 1: - return 0x76; // 64MB - } - break; - - default: - logerror("NAND: read unk command %x (PC %x)\n", m_nand_cmd, m_maincpu->pc()); - break; - } - } - -// printf("Read unknown nand offset %x\n", offset); - - return 0; -} - -WRITE32_MEMBER( gp2x_state::nand_w ) -{ - switch (offset) - { - case 4: // command - m_nand_cmd = data; -// printf("NAND: command %x (PC %x0)\n", data, m_maincpu->pc()); - m_nand_stage = 0; - m_nand_subword_stage = 0; - break; - - case 6: // address - if (m_nand_cmd == 0) - { - switch (m_nand_stage) - { - case 0: - m_nand_ptr_temp &= ~0xff; - m_nand_ptr_temp |= data; - break; - case 1: - m_nand_ptr_temp &= ~0xff00; - m_nand_ptr_temp |= data<<8; - break; - case 2: - m_nand_ptr_temp &= ~0xff0000; - m_nand_ptr_temp |= data<<16; - break; - case 3: - m_nand_ptr_temp &= ~0xff000000; - m_nand_ptr_temp |= data<<24; - -// printf("NAND: ptr now %x, /2 %x, replacing %x\n", m_nand_ptr_temp, m_nand_ptr_temp/2, m_nand_ptr); - m_nand_ptr = m_nand_ptr_temp/2; - break; - } - m_nand_stage++; - } - break; - - default: - logerror("nand_w: %x to unknown offset %x\n", data, offset); - break; - } -} - -READ32_MEMBER( gp2x_state::tx_status_r ) -{ - return 0x6; // tx ready, tx empty -} - -WRITE32_MEMBER( gp2x_state::tx_xmit_w ) -{ - printf("%c", data&0xff); -} - -READ32_MEMBER( gp2x_state::timer_r ) -{ - return m_timer++; -} - -READ32_MEMBER( gp2x_state::nand_ctrl_r ) -{ - return 0x8000<<16; // timed out -} - -WRITE32_MEMBER( gp2x_state::nand_ctrl_w ) -{ -// printf("%08x to nand_ctrl_w\n", data); -} - -READ32_MEMBER( gp2x_state::sdcard_r ) -{ - return 0xffff<<16; // at 3e146b0 - indicate timeout & CRC error -} - -static ADDRESS_MAP_START( gp2x_map, AS_PROGRAM, 32, gp2x_state ) - AM_RANGE(0x00000000, 0x00007fff) AM_ROM - AM_RANGE(0x01000000, 0x04ffffff) AM_RAM AM_SHARE("ram") // 64 MB of RAM - AM_RANGE(0x9c000000, 0x9c00001f) AM_READWRITE(nand_r, nand_w) - AM_RANGE(0xc0000a00, 0xc0000a03) AM_READ(timer_r) - AM_RANGE(0xc0001208, 0xc000120b) AM_READ(tx_status_r) - AM_RANGE(0xc0001210, 0xc0001213) AM_WRITE(tx_xmit_w) - AM_RANGE(0xc0001508, 0xc000150b) AM_READ(sdcard_r) - AM_RANGE(0xc0002800, 0xc00029ff) AM_READWRITE(gp2x_lcdc_r, gp2x_lcdc_w) - AM_RANGE(0xc0003a38, 0xc0003a3b) AM_READWRITE(nand_ctrl_r, nand_ctrl_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( gp2x ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( gp2x, gp2x_state ) - MCFG_CPU_ADD("maincpu", ARM9, 80000000) - MCFG_CPU_PROGRAM_MAP(gp2x_map) - - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(gp2x_state, screen_update_gp2x) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") -MACHINE_CONFIG_END - -ROM_START(gp2x) - ROM_REGION( 0x600000, "maincpu", 0 ) // contents of NAND flash - ROM_SYSTEM_BIOS(0, "v2", "version 2.0") - ROMX_LOAD( "gp2xboot.img", 0x000000, 0x05b264, CRC(9d82937e) SHA1(9655f04c11f78526b3b8a4613897070df3119ead), ROM_BIOS(1)) - ROMX_LOAD( "gp2xkernel.img", 0x080000, 0x09a899, CRC(e272eac9) SHA1(9d814ad6c27d22812ba3f101a7358698d1b035eb), ROM_BIOS(1)) - ROMX_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS(1, "v3", "version 3.0") - ROMX_LOAD( "gp2xboot.v3", 0x000000, 0x05b264, CRC(ab1fc556) SHA1(2ce66fec325b6e8e29f540322aefb435d8e3baf0), ROM_BIOS(2)) - ROMX_LOAD( "gp2xkernel.v3", 0x080000, 0x09f047, CRC(6f8922ae) SHA1(0f44204757f9251c7d68560ff31a1ce72f16698e), ROM_BIOS(2)) - ROMX_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7), ROM_BIOS(2)) - ROMX_LOAD( "gp2xyaffs.v3", 0x300000, 0x2ec4d0, CRC(f81a4a57) SHA1(73bb84798ad3a4e281612a47abb2da4772cbe6cd), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS(2, "v4", "version 4.0") - ROMX_LOAD( "gp2xboot.v4", 0x000000, 0x05b264, CRC(160af379) SHA1(0940fc975960fa52f32a9258a9480cc5cb1140e2), ROM_BIOS(3)) - ROMX_LOAD( "gp2xkernel.v4", 0x080000, 0x0a43a8, CRC(77b1cf9c) SHA1(7e759e4581399bfbee982e1b6c3b54a10b0e9c3d), ROM_BIOS(3)) - ROMX_LOAD( "gp2xsound.wav", 0x1a0000, 0x03a42c, CRC(b6ac0ade) SHA1(32362ebbcd09a3b15e164ec3fbd2a8f11159bcd7), ROM_BIOS(3)) - ROMX_LOAD( "gp2xyaffs.v4", 0x300000, 0x2dfed0, CRC(e77efc53) SHA1(21477ff77aacb84005bc465a03066d71031a6098), ROM_BIOS(3)) -ROM_END - -CONS(2005, gp2x, 0, 0, gp2x, gp2x, driver_device, 0, "Game Park Holdings", "GP2X", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mess/drivers/gp32.c b/src/mess/drivers/gp32.c deleted file mode 100644 index 26dc298a2ff..00000000000 --- a/src/mess/drivers/gp32.c +++ /dev/null @@ -1,1726 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/************************************************************************** - * - * gp32.c - Game Park GP32 - * Driver by Tim Schuerewegen - * - * CPU: Samsung S3C2400X01 SoC - * S3C2400X01 consists of: - * ARM920T CPU core + MMU - * LCD controller - * DMA controller - * Interrupt controller - * USB controller - * and more. - * - **************************************************************************/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "cpu/arm7/arm7core.h" -#include "includes/gp32.h" -#include "rendlay.h" - -#define VERBOSE_LEVEL ( 0 ) - -INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ...) -{ - if (VERBOSE_LEVEL >= n_level) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt); - vsprintf( buf, s_fmt, v); - va_end( v); - logerror( "%s: %s", machine.describe_context( ), buf); - } -} - -#define CLOCK_MULTIPLIER 1 - -#define MPLLCON 1 -#define UPLLCON 2 - -#define BIT(x,n) (((x)>>(n))&1) -#define BITS(x,m,n) (((x)>>(n))&((1<<((m)-(n)+1))-1)) - - -// LCD CONTROLLER - - -#define BPPMODE_TFT_01 0x08 -#define BPPMODE_TFT_02 0x09 -#define BPPMODE_TFT_04 0x0A -#define BPPMODE_TFT_08 0x0B -#define BPPMODE_TFT_16 0x0C - -inline rgb_t gp32_state::s3c240x_get_color_5551( UINT16 data) -{ - UINT8 r, g, b, i; - r = BITS( data, 15, 11) << 3; - g = BITS( data, 10, 6) << 3; - b = BITS( data, 5, 1) << 3; - i = BIT( data, 1) << 2; - return rgb_t( r | i, g | i, b | i); -} - -void gp32_state::s3c240x_lcd_dma_reload() -{ - m_s3c240x_lcd.vramaddr_cur = m_s3c240x_lcd_regs[5] << 1; - m_s3c240x_lcd.vramaddr_max = ((m_s3c240x_lcd_regs[5] & 0xFFE00000) | m_s3c240x_lcd_regs[6]) << 1; - m_s3c240x_lcd.offsize = BITS( m_s3c240x_lcd_regs[7], 21, 11); - m_s3c240x_lcd.pagewidth_cur = 0; - m_s3c240x_lcd.pagewidth_max = BITS( m_s3c240x_lcd_regs[7], 10, 0); - verboselog( machine(), 3, "LCD - vramaddr %08X %08X offsize %08X pagewidth %08X\n", m_s3c240x_lcd.vramaddr_cur, m_s3c240x_lcd.vramaddr_max, m_s3c240x_lcd.offsize, m_s3c240x_lcd.pagewidth_max); -} - -void gp32_state::s3c240x_lcd_dma_init() -{ - s3c240x_lcd_dma_reload(); - m_s3c240x_lcd.bppmode = BITS( m_s3c240x_lcd_regs[0], 4, 1); - m_s3c240x_lcd.bswp = BIT( m_s3c240x_lcd_regs[4], 1); - m_s3c240x_lcd.hwswp = BIT( m_s3c240x_lcd_regs[4], 0); - m_s3c240x_lcd.lineval = BITS( m_s3c240x_lcd_regs[1], 23, 14); - m_s3c240x_lcd.hozval = BITS( m_s3c240x_lcd_regs[2], 18, 8); -} - -UINT32 gp32_state::s3c240x_lcd_dma_read( ) -{ - UINT8 *vram, data[4]; - int i; - for (i = 0; i < 2; i++) - { - vram = (UINT8 *)m_s3c240x_ram.target() + m_s3c240x_lcd.vramaddr_cur - 0x0C000000; - data[i*2+0] = vram[0]; - data[i*2+1] = vram[1]; - m_s3c240x_lcd.vramaddr_cur += 2; - m_s3c240x_lcd.pagewidth_cur++; - if (m_s3c240x_lcd.pagewidth_cur >= m_s3c240x_lcd.pagewidth_max) - { - m_s3c240x_lcd.vramaddr_cur += m_s3c240x_lcd.offsize << 1; - m_s3c240x_lcd.pagewidth_cur = 0; - } - } - if (m_s3c240x_lcd.hwswp == 0) - { - if (m_s3c240x_lcd.bswp == 0) - { - return (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | (data[0] << 0); - } - else - { - return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3] << 0); - } - } - else - { - if (m_s3c240x_lcd.bswp == 0) - { - return (data[1] << 24) | (data[0] << 16) | (data[3] << 8) | (data[2] << 0); - } - else - { - return (data[2] << 24) | (data[3] << 16) | (data[0] << 8) | (data[1] << 0); - } - } -} - -void gp32_state::s3c240x_lcd_render_01( ) -{ - bitmap_rgb32 &bitmap = m_bitmap; - UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) - { - UINT32 data = s3c240x_lcd_dma_read(); - for (j = 0; j < 32; j++) - { - *scanline++ = m_palette->pen_color((data >> 31) & 0x01); - data = data << 1; - m_s3c240x_lcd.hpos++; - if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 4)) - { - m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); - m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - } - } - } -} - -void gp32_state::s3c240x_lcd_render_02( ) -{ - bitmap_rgb32 &bitmap = m_bitmap; - UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) - { - UINT32 data = s3c240x_lcd_dma_read(); - for (j = 0; j < 16; j++) - { - *scanline++ = m_palette->pen_color((data >> 30) & 0x03); - data = data << 2; - m_s3c240x_lcd.hpos++; - if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 3)) - { - m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); - m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - } - } - } -} - -void gp32_state::s3c240x_lcd_render_04( ) -{ - bitmap_rgb32 &bitmap = m_bitmap; - UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) - { - UINT32 data = s3c240x_lcd_dma_read( ); - for (j = 0; j < 8; j++) - { - *scanline++ = m_palette->pen_color((data >> 28) & 0x0F); - data = data << 4; - m_s3c240x_lcd.hpos++; - if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 2)) - { - m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); - m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - } - } - } -} - -void gp32_state::s3c240x_lcd_render_08( ) -{ - bitmap_rgb32 &bitmap = m_bitmap; - UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) - { - UINT32 data = s3c240x_lcd_dma_read(); - for (j = 0; j < 4; j++) - { - *scanline++ = m_palette->pen_color((data >> 24) & 0xFF); - data = data << 8; - m_s3c240x_lcd.hpos++; - if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 1)) - { - m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); - m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - } - } - } -} - -void gp32_state::s3c240x_lcd_render_16( ) -{ - bitmap_rgb32 &bitmap = m_bitmap; - UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) - { - UINT32 data = s3c240x_lcd_dma_read(); - for (j = 0; j < 2; j++) - { - *scanline++ = s3c240x_get_color_5551( (data >> 16) & 0xFFFF); - data = data << 16; - m_s3c240x_lcd.hpos++; - if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 0)) - { - m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); - m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - } - } - } -} - -TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_lcd_timer_exp) -{ - screen_device *screen = machine().first_screen(); - verboselog( machine(), 2, "LCD timer callback\n"); - m_s3c240x_lcd.vpos = screen->vpos(); - m_s3c240x_lcd.hpos = screen->hpos(); - verboselog( machine(), 3, "LCD - vpos %d hpos %d\n", m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - if (m_s3c240x_lcd.vramaddr_cur >= m_s3c240x_lcd.vramaddr_max) - { - s3c240x_lcd_dma_reload(); - } - verboselog( machine(), 3, "LCD - vramaddr %08X\n", m_s3c240x_lcd.vramaddr_cur); - while (m_s3c240x_lcd.vramaddr_cur < m_s3c240x_lcd.vramaddr_max) - { - switch (m_s3c240x_lcd.bppmode) - { - case BPPMODE_TFT_01 : s3c240x_lcd_render_01(); break; - case BPPMODE_TFT_02 : s3c240x_lcd_render_02(); break; - case BPPMODE_TFT_04 : s3c240x_lcd_render_04(); break; - case BPPMODE_TFT_08 : s3c240x_lcd_render_08(); break; - case BPPMODE_TFT_16 : s3c240x_lcd_render_16(); break; - default : verboselog( machine(), 0, "s3c240x_lcd_timer_exp: bppmode %d not supported\n", m_s3c240x_lcd.bppmode); break; - } - if ((m_s3c240x_lcd.vpos == 0) && (m_s3c240x_lcd.hpos == 0)) break; - } - m_s3c240x_lcd_timer->adjust( screen->time_until_pos(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos)); -} - -void gp32_state::video_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); -} - -UINT32 gp32_state::screen_update_gp32(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - s3c240x_lcd_dma_init(); - return 0; -} - -READ32_MEMBER(gp32_state::s3c240x_lcd_r) -{ - UINT32 data = m_s3c240x_lcd_regs[offset]; - switch (offset) - { - // LCDCON1 - case 0x00 / 4 : - { - // make sure line counter is going - UINT32 lineval = BITS( m_s3c240x_lcd_regs[1], 23, 14); - data = (data & ~0xFFFC0000) | ((lineval - machine().first_screen()->vpos()) << 18); - } - break; - } - verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -void gp32_state::s3c240x_lcd_configure() -{ - screen_device *screen = machine().first_screen(); - UINT32 vspw, vbpd, lineval, vfpd, hspw, hbpd, hfpd, hozval, clkval, hclk; - double framerate, vclk; - rectangle visarea; - vspw = BITS( m_s3c240x_lcd_regs[1], 5, 0); - vbpd = BITS( m_s3c240x_lcd_regs[1], 31, 24); - lineval = BITS( m_s3c240x_lcd_regs[1], 23, 14); - vfpd = BITS( m_s3c240x_lcd_regs[1], 13, 6); - hspw = BITS( m_s3c240x_lcd_regs[3], 7, 0); - hbpd = BITS( m_s3c240x_lcd_regs[2], 25, 19); - hfpd = BITS( m_s3c240x_lcd_regs[2], 7, 0); - hozval = BITS( m_s3c240x_lcd_regs[2], 18, 8); - clkval = BITS( m_s3c240x_lcd_regs[0], 17, 8); - hclk = s3c240x_get_hclk(MPLLCON); - verboselog( machine(), 3, "LCD - vspw %d vbpd %d lineval %d vfpd %d hspw %d hbpd %d hfpd %d hozval %d clkval %d hclk %d\n", vspw, vbpd, lineval, vfpd, hspw, hbpd, hfpd, hozval, clkval, hclk); - vclk = (double)(hclk / ((clkval + 1) * 2)); - verboselog( machine(), 3, "LCD - vclk %f\n", vclk); - framerate = vclk / (((vspw + 1) + (vbpd + 1) + (lineval + 1) + (vfpd + 1)) * ((hspw + 1) + (hbpd + 1) + (hfpd + 1) + (hozval + 1))); - verboselog( machine(), 3, "LCD - framerate %f\n", framerate); - visarea.set(0, hozval, 0, lineval); - verboselog( machine(), 3, "LCD - visarea min_x %d min_y %d max_x %d max_y %d\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); - screen->configure(hozval + 1, lineval + 1, visarea, HZ_TO_ATTOSECONDS( framerate)); -} - -void gp32_state::s3c240x_lcd_start() -{ - screen_device *screen = machine().first_screen(); - verboselog( machine(), 1, "LCD start\n"); - s3c240x_lcd_configure(); - s3c240x_lcd_dma_init(); - m_s3c240x_lcd_timer->adjust( screen->time_until_pos(0, 0)); -} - -void gp32_state::s3c240x_lcd_stop() -{ - verboselog( machine(), 1, "LCD stop\n"); - m_s3c240x_lcd_timer->adjust( attotime::never); -} - -void gp32_state::s3c240x_lcd_recalc() -{ - if (m_s3c240x_lcd_regs[0] & 1) - { - s3c240x_lcd_start(); - } - else - { - s3c240x_lcd_stop(); - } -} - -WRITE32_MEMBER(gp32_state::s3c240x_lcd_w) -{ - UINT32 old_value = m_s3c240x_lcd_regs[offset]; - verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_lcd_regs[offset]); - switch (offset) - { - // LCDCON1 - case 0x00 / 4 : - { - if ((old_value & 1) != (data & 1)) - { - s3c240x_lcd_recalc(); - } - } - break; - } -} - -// LCD PALETTE - - -READ32_MEMBER(gp32_state::s3c240x_lcd_palette_r) -{ - UINT32 data = m_s3c240x_lcd_palette[offset]; - verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_lcd_palette_w) -{ - verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_lcd_palette[offset]); - if (mem_mask != 0xffffffff) - { - verboselog( machine(), 0, "s3c240x_lcd_palette_w: unknown mask %08x\n", mem_mask); - } - m_palette->set_pen_color( offset, s3c240x_get_color_5551( data & 0xFFFF)); -} - -// CLOCK & POWER MANAGEMENT - - -UINT32 gp32_state::s3c240x_get_fclk(int reg) -{ - UINT32 data, mdiv, pdiv, sdiv; - data = m_s3c240x_clkpow_regs[reg]; // MPLLCON or UPLLCON - mdiv = BITS( data, 19, 12); - pdiv = BITS( data, 9, 4); - sdiv = BITS( data, 1, 0); - return (UINT32)((double)((mdiv + 8) * 12000000) / (double)((pdiv + 2) * (1 << sdiv))); -} - -UINT32 gp32_state::s3c240x_get_hclk(int reg) -{ - switch (m_s3c240x_clkpow_regs[5] & 0x3) // CLKDIVN - { - case 0 : return s3c240x_get_fclk(reg) / 1; - case 1 : return s3c240x_get_fclk(reg) / 1; - case 2 : return s3c240x_get_fclk(reg) / 2; - case 3 : return s3c240x_get_fclk(reg) / 2; - } - return 0; -} - -UINT32 gp32_state::s3c240x_get_pclk(int reg) -{ - switch (m_s3c240x_clkpow_regs[5] & 0x3) // CLKDIVN - { - case 0 : return s3c240x_get_fclk(reg) / 1; - case 1 : return s3c240x_get_fclk(reg) / 2; - case 2 : return s3c240x_get_fclk(reg) / 2; - case 3 : return s3c240x_get_fclk(reg) / 4; - } - return 0; -} - -READ32_MEMBER(gp32_state::s3c240x_clkpow_r) -{ - UINT32 data = m_s3c240x_clkpow_regs[offset]; - verboselog( machine(), 9, "(CLKPOW) %08X -> %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_clkpow_w) -{ - verboselog( machine(), 9, "(CLKPOW) %08X <- %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_clkpow_regs[offset]); - switch (offset) - { - // MPLLCON - case 0x04 / 4 : - { - m_maincpu->set_unscaled_clock(s3c240x_get_fclk(MPLLCON) * CLOCK_MULTIPLIER); - } - break; - } -} - -// INTERRUPT CONTROLLER - - -void gp32_state::s3c240x_check_pending_irq() -{ - if (m_s3c240x_irq_regs[0] != 0) - { - UINT32 int_type = 0, temp; - temp = m_s3c240x_irq_regs[0]; - while (!(temp & 1)) - { - int_type++; - temp = temp >> 1; - } - m_s3c240x_irq_regs[4] |= (1 << int_type); // INTPND - m_s3c240x_irq_regs[5] = int_type; // INTOFFSET - m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - } - else - { - m_maincpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); - } -} - -void gp32_state::s3c240x_request_irq(UINT32 int_type) -{ - verboselog( machine(), 5, "request irq %d\n", int_type); - if (m_s3c240x_irq_regs[0] == 0) - { - m_s3c240x_irq_regs[0] |= (1 << int_type); // SRCPND - m_s3c240x_irq_regs[4] |= (1 << int_type); // INTPND - m_s3c240x_irq_regs[5] = int_type; // INTOFFSET - m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - } - else - { - m_s3c240x_irq_regs[0] |= (1 << int_type); // SRCPND - s3c240x_check_pending_irq(); - } -} - - -READ32_MEMBER(gp32_state::s3c240x_irq_r) -{ - UINT32 data = m_s3c240x_irq_regs[offset]; - verboselog( machine(), 9, "(IRQ) %08X -> %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_irq_w) -{ - UINT32 old_value = m_s3c240x_irq_regs[offset]; - verboselog( machine(), 9, "(IRQ) %08X <- %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_irq_regs[offset]); - switch (offset) - { - // SRCPND - case 0x00 / 4 : - { - m_s3c240x_irq_regs[0] = (old_value & ~data); // clear only the bit positions of SRCPND corresponding to those set to one in the data - s3c240x_check_pending_irq(); - } - break; - // INTPND - case 0x10 / 4 : - { - m_s3c240x_irq_regs[4] = (old_value & ~data); // clear only the bit positions of INTPND corresponding to those set to one in the data - } - break; - } -} - -// PWM TIMER - -#if 0 -static const char *const timer_reg_names[] = -{ - "Timer config 0", - "Timer config 1", - "Timer control", - "Timer count buffer 0", - "Timer compare buffer 0", - "Timer count observation 0", - "Timer count buffer 1", - "Timer compare buffer 1", - "Timer count observation 1", - "Timer count buffer 2", - "Timer compare buffer 2", - "Timer count observation 2", - "Timer count buffer 3", - "Timer compare buffer 3", - "Timer count observation 3", - "Timer count buffer 4", - "Timer compare buffer 4", - "Timer count observation 4", -}; -#endif - - -READ32_MEMBER(gp32_state::s3c240x_pwm_r) -{ - UINT32 data = m_s3c240x_pwm_regs[offset]; - verboselog( machine(), 9, "(PWM) %08X -> %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -void gp32_state::s3c240x_pwm_start(int timer) -{ - static const int mux_table[] = { 2, 4, 8, 16 }; - static const int prescaler_shift[] = { 0, 0, 8, 8, 8 }; - static const int mux_shift[] = { 0, 4, 8, 12, 16 }; - static const int tcon_shift[] = { 0, 8, 12, 16, 20 }; - const UINT32 *regs = &m_s3c240x_pwm_regs[3+timer*3]; - UINT32 prescaler, mux, cnt, cmp, auto_reload; - double freq, hz; - verboselog( machine(), 1, "PWM %d start\n", timer); - prescaler = (m_s3c240x_pwm_regs[0] >> prescaler_shift[timer]) & 0xFF; - mux = (m_s3c240x_pwm_regs[1] >> mux_shift[timer]) & 0x0F; - freq = s3c240x_get_pclk(MPLLCON) / (prescaler + 1) / mux_table[mux]; - cnt = BITS( regs[0], 15, 0); - if (timer != 4) - { - cmp = BITS( regs[1], 15, 0); - auto_reload = BIT( m_s3c240x_pwm_regs[2], tcon_shift[timer] + 3); - } - else - { - cmp = 0; - auto_reload = BIT( m_s3c240x_pwm_regs[2], tcon_shift[timer] + 2); - } - hz = freq / (cnt - cmp + 1); - verboselog( machine(), 5, "PWM %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%f cnt=%d cmp=%d auto_reload=%d hz=%f\n", timer, s3c240x_get_fclk(MPLLCON), s3c240x_get_hclk(MPLLCON), s3c240x_get_pclk(MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, auto_reload, hz); - if (auto_reload) - { - m_s3c240x_pwm_timer[timer]->adjust( attotime::from_hz( hz), timer, attotime::from_hz( hz)); - } - else - { - m_s3c240x_pwm_timer[timer]->adjust( attotime::from_hz( hz), timer); - } -} - -void gp32_state::s3c240x_pwm_stop(int timer) -{ - verboselog( machine(), 1, "PWM %d stop\n", timer); - m_s3c240x_pwm_timer[timer]->adjust( attotime::never); -} - -void gp32_state::s3c240x_pwm_recalc(int timer) -{ - static const int tcon_shift[] = { 0, 8, 12, 16, 20 }; - if (m_s3c240x_pwm_regs[2] & (1 << tcon_shift[timer])) - { - s3c240x_pwm_start(timer); - } - else - { - s3c240x_pwm_stop(timer); - } -} - -WRITE32_MEMBER(gp32_state::s3c240x_pwm_w) -{ - UINT32 old_value = m_s3c240x_pwm_regs[offset]; - verboselog( machine(), 9, "(PWM) %08X <- %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_pwm_regs[offset]); - switch (offset) - { - // TCON - case 0x08 / 4 : - { - if ((data & 1) != (old_value & 1)) - { - s3c240x_pwm_recalc(0); - } - if ((data & 0x100) != (old_value & 0x100)) - { - s3c240x_pwm_recalc(1); - } - if ((data & 0x1000) != (old_value & 0x1000)) - { - s3c240x_pwm_recalc(2); - } - if ((data & 0x10000) != (old_value & 0x10000)) - { - s3c240x_pwm_recalc(3); - } - if ((data & 0x100000) != (old_value & 0x100000)) - { - s3c240x_pwm_recalc(4); - } - } - } -} - -TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_pwm_timer_exp) -{ - int ch = param; - static const int ch_int[] = { INT_TIMER0, INT_TIMER1, INT_TIMER2, INT_TIMER3, INT_TIMER4 }; - verboselog( machine(), 2, "PWM %d timer callback\n", ch); - if (BITS( m_s3c240x_pwm_regs[1], 23, 20) == (ch + 1)) - { - s3c240x_dma_request_pwm(); - } - else - { - s3c240x_request_irq(ch_int[ch]); - } -} - -// DMA - - -void gp32_state::s3c240x_dma_reload(int dma) -{ - UINT32 *regs = &m_s3c240x_dma_regs[dma<<3]; - regs[3] = (regs[3] & ~0x000FFFFF) | BITS( regs[2], 19, 0); - regs[4] = (regs[4] & ~0x1FFFFFFF) | BITS( regs[0], 28, 0); - regs[5] = (regs[5] & ~0x1FFFFFFF) | BITS( regs[1], 28, 0); -} - -void gp32_state::s3c240x_dma_trigger(int dma) -{ - UINT32 *regs = &m_s3c240x_dma_regs[dma<<3]; - UINT32 curr_tc, curr_src, curr_dst; - address_space &space = m_maincpu->space( AS_PROGRAM); - int dsz, inc_src, inc_dst, servmode; - static const UINT32 ch_int[] = { INT_DMA0, INT_DMA1, INT_DMA2, INT_DMA3 }; - verboselog( machine(), 5, "DMA %d trigger\n", dma); - curr_tc = BITS( regs[3], 19, 0); - curr_src = BITS( regs[4], 28, 0); - curr_dst = BITS( regs[5], 28, 0); - dsz = BITS( regs[2], 21, 20); - servmode = BIT( regs[2], 26); - inc_src = BIT( regs[0], 29); - inc_dst = BIT( regs[1], 29); - verboselog( machine(), 5, "DMA %d - curr_src %08X curr_dst %08X curr_tc %d dsz %d\n", dma, curr_src, curr_dst, curr_tc, dsz); - while (curr_tc > 0) - { - curr_tc--; - switch (dsz) - { - case 0 : space.write_byte( curr_dst, space.read_byte( curr_src)); break; - case 1 : space.write_word( curr_dst, space.read_word( curr_src)); break; - case 2 : space.write_dword( curr_dst, space.read_dword( curr_src)); break; - } - if (inc_src == 0) curr_src += (1 << dsz); - if (inc_dst == 0) curr_dst += (1 << dsz); - if (servmode == 0) break; - } - // update curr_src - regs[4] = (regs[4] & ~0x1FFFFFFF) | curr_src; - // update curr_dst - regs[5] = (regs[5] & ~0x1FFFFFFF) | curr_dst; - // update curr_tc - regs[3] = (regs[3] & ~0x000FFFFF) | curr_tc; - // ... - if (curr_tc == 0) - { - int _int, reload; - reload = BIT( regs[2], 22); - if (!reload) - { - s3c240x_dma_reload(dma); - } - else - { - regs[6] &= ~(1 << 1); // clear on/off - } - _int = BIT( regs[2], 28); - if (_int) - { - s3c240x_request_irq(ch_int[dma]); - } - } -} - -void gp32_state::s3c240x_dma_request_iis() -{ - UINT32 *regs = &m_s3c240x_dma_regs[2<<3]; - verboselog( machine(), 5, "s3c240x_dma_request_iis\n"); - if ((BIT( regs[6], 1) != 0) && (BIT( regs[2], 23) != 0) && (BITS( regs[2], 25, 24) == 0)) - { - s3c240x_dma_trigger(2); - } -} - -void gp32_state::s3c240x_dma_request_pwm() -{ - int i; - verboselog( machine(), 5, "s3c240x_dma_request_pwm\n"); - for (i = 0; i < 4; i++) - { - if (i != 1) - { - UINT32 *regs = &m_s3c240x_dma_regs[i<<3]; - if ((BIT( regs[6], 1) != 0) && (BIT( regs[2], 23) != 0) && (BITS( regs[2], 25, 24) == 3)) - { - s3c240x_dma_trigger(i); - } - } - } -} - -void gp32_state::s3c240x_dma_start(int dma) -{ - UINT32 addr_src, addr_dst, tc; - UINT32 *regs = &m_s3c240x_dma_regs[dma<<3]; - UINT32 dsz, tsz, reload; - int inc_src, inc_dst, _int, servmode, swhwsel, hwsrcsel; - verboselog( machine(), 1, "DMA %d start\n", dma); - addr_src = BITS( regs[0], 28, 0); - addr_dst = BITS( regs[1], 28, 0); - tc = BITS( regs[2], 19, 0); - inc_src = BIT( regs[0], 29); - inc_dst = BIT( regs[1], 29); - tsz = BIT( regs[2], 27); - _int = BIT( regs[2], 28); - servmode = BIT( regs[2], 26); - hwsrcsel = BITS( regs[2], 25, 24); - swhwsel = BIT( regs[2], 23); - reload = BIT( regs[2], 22); - dsz = BITS( regs[2], 21, 20); - verboselog( machine(), 5, "DMA %d - addr_src %08X inc_src %d addr_dst %08X inc_dst %d int %d tsz %d servmode %d hwsrcsel %d swhwsel %d reload %d dsz %d tc %d\n", dma, addr_src, inc_src, addr_dst, inc_dst, _int, tsz, servmode, hwsrcsel, swhwsel, reload, dsz, tc); - verboselog( machine(), 5, "DMA %d - copy %08X bytes from %08X (%s) to %08X (%s)\n", dma, tc << dsz, addr_src, inc_src ? "fix" : "inc", addr_dst, inc_dst ? "fix" : "inc"); - s3c240x_dma_reload(dma); - if (swhwsel == 0) - { - s3c240x_dma_trigger(dma); - } -} - -void gp32_state::s3c240x_dma_stop(int dma) -{ - verboselog( machine(), 1, "DMA %d stop\n", dma); -} - -void gp32_state::s3c240x_dma_recalc(int dma) -{ - if (m_s3c240x_dma_regs[(dma<<3)+6] & 2) - { - s3c240x_dma_start(dma); - } - else - { - s3c240x_dma_stop(dma); - } -} - -READ32_MEMBER(gp32_state::s3c240x_dma_r) -{ - UINT32 data = m_s3c240x_dma_regs[offset]; - verboselog( machine(), 9, "(DMA) %08X -> %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_dma_w) -{ - UINT32 old_value = m_s3c240x_dma_regs[offset]; - verboselog( machine(), 9, "(DMA) %08X <- %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_dma_regs[offset]); - switch (offset) - { - // DCON0 - case 0x08 / 4 : - { - if (((data >> 22) & 1) != 0) // reload - { - m_s3c240x_dma_regs[0x18/4] &= ~(1 << 1); // clear on/off - } - } - break; - // DMASKTRIG0 - case 0x18 / 4 : - { - if ((old_value & 2) != (data & 2)) s3c240x_dma_recalc(0); - } - break; - // DCON1 - case 0x28 / 4 : - { - if (((data >> 22) & 1) != 0) // reload - { - m_s3c240x_dma_regs[0x38/4] &= ~(1 << 1); // clear on/off - } - } - break; - // DMASKTRIG1 - case 0x38 / 4 : - { - if ((old_value & 2) != (data & 2)) s3c240x_dma_recalc(1); - } - break; - // DCON2 - case 0x48 / 4 : - { - if (((data >> 22) & 1) != 0) // reload - { - m_s3c240x_dma_regs[0x58/4] &= ~(1 << 1); // clear on/off - } - } - break; - // DMASKTRIG2 - case 0x58 / 4 : - { - if ((old_value & 2) != (data & 2)) s3c240x_dma_recalc(2); - } - break; - // DCON3 - case 0x68 / 4 : - { - if (((data >> 22) & 1) != 0) // reload - { - m_s3c240x_dma_regs[0x78/4] &= ~(1 << 1); // clear on/off - } - } - break; - // DMASKTRIG3 - case 0x78 / 4 : - { - if ((old_value & 2) != (data & 2)) s3c240x_dma_recalc(3); - } - break; - } -} - -TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_dma_timer_exp) -{ - int ch = param; - verboselog( machine(), 2, "DMA %d timer callback\n", ch); -} - -// SMARTMEDIA - -void gp32_state::smc_reset() -{ - verboselog( machine(), 5, "smc_reset\n"); - m_smc.add_latch = 0; - m_smc.chip = 0; - m_smc.cmd_latch = 0; - m_smc.do_read = 0; - m_smc.do_write = 0; - m_smc.read = 0; - m_smc.wp = 0; - m_smc.busy = 0; -} - -void gp32_state::smc_init() -{ - verboselog( machine(), 5, "smc_init\n"); - smc_reset(); -} - -UINT8 gp32_state::smc_read() -{ - UINT8 data; - data = m_smartmedia->data_r(); - verboselog( machine(), 5, "smc_read %08X\n", data); - return data; -} - -void gp32_state::smc_write(UINT8 data) -{ - verboselog( machine(), 5, "smc_write %08X\n", data); - if ((m_smc.chip) && (!m_smc.read)) - { - if (m_smc.cmd_latch) - { - verboselog( machine(), 5, "smartmedia_command_w %08X\n", data); - m_smartmedia->command_w(data); - } - else if (m_smc.add_latch) - { - verboselog( machine(), 5, "smartmedia_address_w %08X\n", data); - m_smartmedia->address_w(data); - } - else - { - verboselog( machine(), 5, "smartmedia_data_w %08X\n", data); - m_smartmedia->data_w(data); - } - } -} - -void gp32_state::smc_update() -{ - if (!m_smc.chip) - { - smc_reset(); - } - else - { - if ((m_smc.do_write) && (!m_smc.read)) - { - smc_write(m_smc.datatx); - } - else if ((!m_smc.do_write) && (m_smc.do_read) && (m_smc.read) && (!m_smc.cmd_latch) && (!m_smc.add_latch)) - { - m_smc.datarx = smc_read(); - } - } -} - -// I2S - -#define I2S_L3C ( 1 ) -#define I2S_L3M ( 2 ) -#define I2S_L3D ( 3 ) - -void gp32_state::i2s_reset() -{ - verboselog( machine(), 5, "i2s_reset\n"); - m_i2s.l3d = 0; - m_i2s.l3m = 0; - m_i2s.l3c = 0; -} - -void gp32_state::i2s_init() -{ - verboselog( machine(), 5, "i2s_init\n"); - i2s_reset(); -} - -void gp32_state::i2s_write(int line, int data) -{ - switch (line) - { - case I2S_L3C : - { - if (data != m_i2s.l3c) - { - verboselog( machine(), 5, "I2S L3C %d\n", data); - m_i2s.l3c = data; - } - } - break; - case I2S_L3M : - { - if (data != m_i2s.l3m) - { - verboselog( machine(), 5, "I2S L3M %d\n", data); - m_i2s.l3m = data; - } - } - break; - case I2S_L3D : - { - if (data != m_i2s.l3d) - { - verboselog( machine(), 5, "I2S L3D %d\n", data); - m_i2s.l3d = data; - } - } - break; - } -} - -// I/O PORT - - -READ32_MEMBER(gp32_state::s3c240x_gpio_r) -{ - UINT32 data = m_s3c240x_gpio[offset]; - switch (offset) - { - // PBCON - case 0x08 / 4 : - { - // smartmedia - data = (data & ~0x00000001); - if (!m_smc.read) data = data | 0x00000001; - } - break; - // PBDAT - case 0x0C / 4 : - { - // smartmedia - data = (data & ~0x000000FF) | (m_smc.datarx & 0xFF); - // buttons - data = (data & ~0x0000FF00) | (m_io_in0->read() & 0x0000FF00); - } - break; - // PDDAT - case 0x24 / 4 : - { - // smartmedia - data = (data & ~0x000003C0); - if (!m_smc.busy) data = data | 0x00000200; - if (!m_smc.do_read) data = data | 0x00000100; - if (!m_smc.chip) data = data | 0x00000080; - if (!m_smartmedia->is_protected()) data = data | 0x00000040; - } - break; - // PEDAT - case 0x30 / 4 : - { - // smartmedia - data = (data & ~0x0000003C); - if (m_smc.cmd_latch) data = data | 0x00000020; - if (m_smc.add_latch) data = data | 0x00000010; - if (!m_smc.do_write) data = data | 0x00000008; - if (!m_smartmedia->is_present()) data = data | 0x00000004; - // buttons - data = (data & ~0x000000C0) | (m_io_in1->read() & 0x000000C0); - } - break; - } - verboselog( machine(), 9, "(GPIO) %08X -> %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_gpio_w) -{ - COMBINE_DATA(&m_s3c240x_gpio[offset]); - verboselog( machine(), 9, "(GPIO) %08X <- %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, space.device().safe_pc( )); - switch (offset) - { - // PBCON - case 0x08 / 4 : - { - // smartmedia - m_smc.read = ((data & 0x00000001) == 0); - smc_update(); - } - break; - // PBDAT - case 0x0C / 4 : - { - // smartmedia - m_smc.datatx = data & 0xFF; - } - break; - // PDDAT - case 0x24 / 4 : - { - // smartmedia - m_smc.do_read = ((data & 0x00000100) == 0); - m_smc.chip = ((data & 0x00000080) == 0); - m_smc.wp = ((data & 0x00000040) == 0); - smc_update(); - } - break; - // PEDAT - case 0x30 / 4 : - { - // smartmedia - m_smc.cmd_latch = ((data & 0x00000020) != 0); - m_smc.add_latch = ((data & 0x00000010) != 0); - m_smc.do_write = ((data & 0x00000008) == 0); - smc_update(); - // sound - i2s_write(I2S_L3D, (data & 0x00000800) ? 1 : 0); - i2s_write(I2S_L3M, (data & 0x00000400) ? 1 : 0); - i2s_write(I2S_L3C, (data & 0x00000200) ? 1 : 0); - } - break; -#if 0 - // PGDAT - case 0x48 / 4 : - { - int i2ssdo; - i2ssdo = BIT( data, 3); - } - break; -#endif - } -} - -// MEMORY CONTROLLER - - -READ32_MEMBER(gp32_state::s3c240x_memcon_r) -{ - UINT32 data = m_s3c240x_memcon_regs[offset]; - verboselog( machine(), 9, "(MEMCON) %08X -> %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_memcon_w) -{ - verboselog( machine(), 9, "(MEMCON) %08X <- %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_memcon_regs[offset]); -} - -// USB HOST CONTROLLER - - -READ32_MEMBER(gp32_state::s3c240x_usb_host_r) -{ - UINT32 data = m_s3c240x_usb_host_regs[offset]; - verboselog( machine(), 9, "(USB H) %08X -> %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_usb_host_w) -{ - verboselog( machine(), 9, "(USB H) %08X <- %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_usb_host_regs[offset]); -} - -// UART 0 - - -READ32_MEMBER(gp32_state::s3c240x_uart_0_r) -{ - UINT32 data = m_s3c240x_uart_0_regs[offset]; - switch (offset) - { - // UTRSTAT0 - case 0x10 / 4 : - { - data = (data & ~0x00000006) | 0x00000004 | 0x00000002; // [bit 2] Transmitter empty / [bit 1] Transmit buffer empty - } - break; - } - verboselog( machine(), 9, "(UART 0) %08X -> %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_uart_0_w) -{ - verboselog( machine(), 9, "(UART 0) %08X <- %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_uart_0_regs[offset]); -} - -// UART 1 - - -READ32_MEMBER(gp32_state::s3c240x_uart_1_r) -{ - UINT32 data = m_s3c240x_uart_1_regs[offset]; - switch (offset) - { - // UTRSTAT1 - case 0x10 / 4 : - { - data = (data & ~0x00000006) | 0x00000004 | 0x00000002; // [bit 2] Transmitter empty / [bit 1] Transmit buffer empty - } - break; - } - verboselog( machine(), 9, "(UART 1) %08X -> %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_uart_1_w) -{ - verboselog( machine(), 9, "(UART 1) %08X <- %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_uart_1_regs[offset]); -} - -// USB DEVICE - - -READ32_MEMBER(gp32_state::s3c240x_usb_device_r) -{ - UINT32 data = m_s3c240x_usb_device_regs[offset]; - verboselog( machine(), 9, "(USB D) %08X -> %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_usb_device_w) -{ - verboselog( machine(), 9, "(USB D) %08X <- %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_usb_device_regs[offset]); -} - -// WATCHDOG TIMER - - -READ32_MEMBER(gp32_state::s3c240x_watchdog_r) -{ - UINT32 data = m_s3c240x_watchdog_regs[offset]; - verboselog( machine(), 9, "(WDOG) %08X -> %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_watchdog_w) -{ - verboselog( machine(), 9, "(WDOG) %08X <- %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_watchdog_regs[offset]); -} - -// EEPROM - -UINT8 gp32_state::eeprom_read(UINT16 address) -{ - UINT8 data; - data = m_eeprom_data[address]; - verboselog( machine(), 5, "EEPROM %04X -> %02X\n", address, data); - return data; -} - -void gp32_state::eeprom_write(UINT16 address, UINT8 data) -{ - verboselog( machine(), 5, "EEPROM %04X <- %02X\n", address, data); - m_eeprom_data[address] = data; -} - -// IIC - -#if 0 -UINT8 gp32_state::i2cmem_read_byte( int last) -{ - UINT8 data = 0; - int i; - i2cmem_write( machine, 0, I2CMEM_SDA, 1); - for (i = 0; i < 8; i++) - { - i2cmem_write( machine, 0, I2CMEM_SCL, 1); - data = (data << 1) + (i2cmem_read( machine, 0, I2CMEM_SDA) ? 1 : 0); - i2cmem_write( machine, 0, I2CMEM_SCL, 0); - } - i2cmem_write( machine, 0, I2CMEM_SDA, last); - i2cmem_write( machine, 0, I2CMEM_SCL, 1); - i2cmem_write( machine, 0, I2CMEM_SCL, 0); - return data; -} -#endif - -#if 0 -void gp32_state::i2cmem_write_byte( UINT8 data) -{ - int i; - for (i = 0; i < 8; i++) - { - i2cmem_write( machine, 0, I2CMEM_SDA, (data & 0x80) ? 1 : 0); - data = data << 1; - i2cmem_write( machine, 0, I2CMEM_SCL, 1); - i2cmem_write( machine, 0, I2CMEM_SCL, 0); - } - i2cmem_write( machine, 0, I2CMEM_SDA, 1); // ack bit - i2cmem_write( machine, 0, I2CMEM_SCL, 1); - i2cmem_write( machine, 0, I2CMEM_SCL, 0); -} -#endif - -#if 0 -void gp32_state::i2cmem_start( ) -{ - i2cmem_write( machine, 0, I2CMEM_SDA, 1); - i2cmem_write( machine, 0, I2CMEM_SCL, 1); - i2cmem_write( machine, 0, I2CMEM_SDA, 0); - i2cmem_write( machine, 0, I2CMEM_SCL, 0); -} -#endif - -#if 0 -void gp32_state::i2cmem_stop( ) -{ - i2cmem_write( machine, 0, I2CMEM_SDA, 0); - i2cmem_write( machine, 0, I2CMEM_SCL, 1); - i2cmem_write( machine, 0, I2CMEM_SDA, 1); - i2cmem_write( machine, 0, I2CMEM_SCL, 0); -} -#endif - -void gp32_state::iic_start() -{ - verboselog( machine(), 1, "IIC start\n"); - m_s3c240x_iic.data_index = 0; - m_s3c240x_iic_timer->adjust( attotime::from_msec( 1)); -} - -void gp32_state::iic_stop() -{ - verboselog( machine(), 1, "IIC stop\n"); - m_s3c240x_iic_timer->adjust( attotime::never); -} - -void gp32_state::iic_resume() -{ - verboselog( machine(), 1, "IIC resume\n"); - m_s3c240x_iic_timer->adjust( attotime::from_msec( 1)); -} - -READ32_MEMBER(gp32_state::s3c240x_iic_r) -{ - UINT32 data = m_s3c240x_iic_regs[offset]; - switch (offset) - { - // IICSTAT - case 0x04 / 4 : - { - data = data & ~0x0000000F; - } - break; - } - verboselog( machine(), 9, "(IIC) %08X -> %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_iic_w) -{ - verboselog( machine(), 9, "(IIC) %08X <- %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_iic_regs[offset]); - switch (offset) - { - // ADDR_IICCON - case 0x00 / 4 : - { - int interrupt_pending_flag; -#if 0 - static const int div_table[] = { 16, 512 }; - int enable_interrupt, transmit_clock_value, tx_clock_source_selection - double clock; - transmit_clock_value = (data >> 0) & 0xF; - tx_clock_source_selection = (data >> 6) & 1; - enable_interrupt = (data >> 5) & 1; - clock = (double)(s3c240x_get_pclk(MPLLCON) / div_table[tx_clock_source_selection] / (transmit_clock_value + 1)); -#endif - interrupt_pending_flag = BIT( data, 4); - if (interrupt_pending_flag == 0) - { - int start_stop_condition; - start_stop_condition = BIT( m_s3c240x_iic_regs[1], 5); - if (start_stop_condition != 0) - { - iic_resume(); - } - } - } - break; - // IICSTAT - case 0x04 / 4 : - { - int start_stop_condition; - start_stop_condition = BIT( data, 5); - if (start_stop_condition != 0) - { - iic_start(); - } - else - { - iic_stop(); - } - } - break; - } -} - -TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_iic_timer_exp) -{ - int enable_interrupt, mode_selection; - verboselog( machine(), 2, "IIC timer callback\n"); - mode_selection = BITS( m_s3c240x_iic_regs[1], 7, 6); - switch (mode_selection) - { - // master receive mode - case 2 : - { - if (m_s3c240x_iic.data_index == 0) - { - UINT8 data_shift = m_s3c240x_iic_regs[3] & 0xFF; - verboselog( machine(), 5, "IIC write %02X\n", data_shift); - } - else - { - UINT8 data_shift = eeprom_read(m_s3c240x_iic.address); - verboselog( machine(), 5, "IIC read %02X\n", data_shift); - m_s3c240x_iic_regs[3] = (m_s3c240x_iic_regs[3] & ~0xFF) | data_shift; - } - m_s3c240x_iic.data_index++; - } - break; - // master transmit mode - case 3 : - { - UINT8 data_shift = m_s3c240x_iic_regs[3] & 0xFF; - verboselog( machine(), 5, "IIC write %02X\n", data_shift); - m_s3c240x_iic.data[m_s3c240x_iic.data_index++] = data_shift; - if (m_s3c240x_iic.data_index == 3) - { - m_s3c240x_iic.address = (m_s3c240x_iic.data[1] << 8) | m_s3c240x_iic.data[2]; - } - if ((m_s3c240x_iic.data_index == 4) && (m_s3c240x_iic.data[0] == 0xA0)) - { - eeprom_write(m_s3c240x_iic.address, data_shift); - } - } - break; - } - enable_interrupt = BIT( m_s3c240x_iic_regs[0], 5); - if (enable_interrupt) - { - s3c240x_request_irq(INT_IIC); - } -} - -// IIS - -void gp32_state::s3c240x_iis_start() -{ - static const UINT32 codeclk_table[] = { 256, 384 }; - double freq; - int prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk; - verboselog( machine(), 1, "IIS start\n"); - prescaler_enable = BIT( m_s3c240x_iis_regs[0], 1); - prescaler_control_a = BITS( m_s3c240x_iis_regs[2], 9, 5); - prescaler_control_b = BITS( m_s3c240x_iis_regs[2], 4, 0); - codeclk = BIT( m_s3c240x_iis_regs[1], 2); - freq = (double)(s3c240x_get_pclk(MPLLCON) / (prescaler_control_a + 1) / codeclk_table[codeclk]) * 2; // why do I have to multiply by two? - verboselog( machine(), 5, "IIS - pclk %d psc_enable %d psc_a %d psc_b %d codeclk %d freq %f\n", s3c240x_get_pclk(MPLLCON), prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk_table[codeclk], freq); - m_s3c240x_iis_timer->adjust( attotime::from_hz( freq), 0, attotime::from_hz( freq)); -} - -void gp32_state::s3c240x_iis_stop() -{ - verboselog( machine(), 1, "IIS stop\n"); - m_s3c240x_iis_timer->adjust( attotime::never); -} - -void gp32_state::s3c240x_iis_recalc() -{ - if (m_s3c240x_iis_regs[0] & 1) - { - s3c240x_iis_start(); - } - else - { - s3c240x_iis_stop(); - } -} - -READ32_MEMBER(gp32_state::s3c240x_iis_r) -{ - UINT32 data = m_s3c240x_iis_regs[offset]; -#if 0 - switch (offset) - { - // IISCON - case 0x00 / 4 : - { - data = data & ~1; // for mp3 player - } - break; - } -#endif - verboselog( machine(), 9, "(IIS) %08X -> %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_iis_w) -{ - UINT32 old_value = m_s3c240x_iis_regs[offset]; - verboselog( machine(), 9, "(IIS) %08X <- %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_iis_regs[offset]); - switch (offset) - { - // IISCON - case 0x00 / 4 : - { - if ((old_value & 1) != (data & 1)) s3c240x_iis_recalc(); - } - break; - // IISFIF - case 0x10 / 4 : - { - if (ACCESSING_BITS_16_31) - { - m_s3c240x_iis.fifo[m_s3c240x_iis.fifo_index++] = BITS( data, 31, 16); - } - if (ACCESSING_BITS_0_15) - { - m_s3c240x_iis.fifo[m_s3c240x_iis.fifo_index++] = BITS( data, 15, 0); - } - if (m_s3c240x_iis.fifo_index == 2) - { - m_s3c240x_iis.fifo_index = 0; - m_dac1->write_signed16(m_s3c240x_iis.fifo[0] + 0x8000); - m_dac2->write_signed16(m_s3c240x_iis.fifo[1] + 0x8000); - } - } - break; - } -} - -TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_iis_timer_exp) -{ - verboselog( machine(), 2, "IIS timer callback\n"); - s3c240x_dma_request_iis(); -} - -// RTC - - -READ32_MEMBER(gp32_state::s3c240x_rtc_r) -{ - UINT32 data = m_s3c240x_rtc_regs[offset]; - verboselog( machine(), 9, "(RTC) %08X -> %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_rtc_w) -{ - verboselog( machine(), 9, "(RTC) %08X <- %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_rtc_regs[offset]); -} - -// A/D CONVERTER - - -READ32_MEMBER(gp32_state::s3c240x_adc_r) -{ - UINT32 data = m_s3c240x_adc_regs[offset]; - verboselog( machine(), 9, "(ADC) %08X -> %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_adc_w) -{ - verboselog( machine(), 9, "(ADC) %08X <- %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_adc_regs[offset]); -} - -// SPI - - -READ32_MEMBER(gp32_state::s3c240x_spi_r) -{ - UINT32 data = m_s3c240x_spi_regs[offset]; - verboselog( machine(), 9, "(SPI) %08X -> %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_spi_w) -{ - verboselog( machine(), 9, "(SPI) %08X <- %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_spi_regs[offset]); -} - -// MMC INTERFACE - - -READ32_MEMBER(gp32_state::s3c240x_mmc_r) -{ - UINT32 data = m_s3c240x_mmc_regs[offset]; - verboselog( machine(), 9, "(MMC) %08X -> %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, space.device().safe_pc( )); - return data; -} - -WRITE32_MEMBER(gp32_state::s3c240x_mmc_w) -{ - verboselog( machine(), 9, "(MMC) %08X <- %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, space.device().safe_pc( )); - COMBINE_DATA(&m_s3c240x_mmc_regs[offset]); -} - -// ... - -void gp32_state::s3c240x_machine_start() -{ - m_s3c240x_pwm_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)0); - m_s3c240x_pwm_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)1); - m_s3c240x_pwm_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)2); - m_s3c240x_pwm_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)3); - m_s3c240x_pwm_timer[4] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)4); - m_s3c240x_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)0); - m_s3c240x_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)1); - m_s3c240x_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)2); - m_s3c240x_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)3); - m_s3c240x_iic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iic_timer_exp),this), (void *)(FPTR)0); - m_s3c240x_iis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iis_timer_exp),this), (void *)(FPTR)0); - m_s3c240x_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_lcd_timer_exp),this), (void *)(FPTR)0); - m_eeprom_data = auto_alloc_array( machine(), UINT8, 0x2000); - m_nvram->set_base(m_eeprom_data, 0x2000); - smc_init(); - i2s_init(); -} - -void gp32_state::s3c240x_machine_reset() -{ - smc_reset(); - i2s_reset(); - m_s3c240x_iis.fifo_index = 0; - m_s3c240x_iic.data_index = 0; -} - -static ADDRESS_MAP_START( gp32_map, AS_PROGRAM, 32, gp32_state ) - AM_RANGE(0x00000000, 0x0007ffff) AM_ROM - AM_RANGE(0x0c000000, 0x0c7fffff) AM_RAM AM_SHARE("s3c240x_ram") - AM_RANGE(0x14000000, 0x1400003b) AM_READWRITE(s3c240x_memcon_r, s3c240x_memcon_w) - AM_RANGE(0x14200000, 0x1420005b) AM_READWRITE(s3c240x_usb_host_r, s3c240x_usb_host_w) - AM_RANGE(0x14400000, 0x14400017) AM_READWRITE(s3c240x_irq_r, s3c240x_irq_w) - AM_RANGE(0x14600000, 0x1460007b) AM_READWRITE(s3c240x_dma_r, s3c240x_dma_w) - AM_RANGE(0x14800000, 0x14800017) AM_READWRITE(s3c240x_clkpow_r, s3c240x_clkpow_w) - AM_RANGE(0x14a00000, 0x14a003ff) AM_READWRITE(s3c240x_lcd_r, s3c240x_lcd_w) - AM_RANGE(0x14a00400, 0x14a007ff) AM_READWRITE(s3c240x_lcd_palette_r, s3c240x_lcd_palette_w) - AM_RANGE(0x15000000, 0x1500002b) AM_READWRITE(s3c240x_uart_0_r, s3c240x_uart_0_w) - AM_RANGE(0x15004000, 0x1500402b) AM_READWRITE(s3c240x_uart_1_r, s3c240x_uart_1_w) - AM_RANGE(0x15100000, 0x15100043) AM_READWRITE(s3c240x_pwm_r, s3c240x_pwm_w) - AM_RANGE(0x15200140, 0x152001fb) AM_READWRITE(s3c240x_usb_device_r, s3c240x_usb_device_w) - AM_RANGE(0x15300000, 0x1530000b) AM_READWRITE(s3c240x_watchdog_r, s3c240x_watchdog_w) - AM_RANGE(0x15400000, 0x1540000f) AM_READWRITE(s3c240x_iic_r, s3c240x_iic_w) - AM_RANGE(0x15508000, 0x15508013) AM_READWRITE(s3c240x_iis_r, s3c240x_iis_w) - AM_RANGE(0x15600000, 0x1560005b) AM_READWRITE(s3c240x_gpio_r, s3c240x_gpio_w) - AM_RANGE(0x15700040, 0x1570008b) AM_READWRITE(s3c240x_rtc_r, s3c240x_rtc_w) - AM_RANGE(0x15800000, 0x15800007) AM_READWRITE(s3c240x_adc_r, s3c240x_adc_w) - AM_RANGE(0x15900000, 0x15900017) AM_READWRITE(s3c240x_spi_r, s3c240x_spi_w) - AM_RANGE(0x15a00000, 0x15a0003f) AM_READWRITE(s3c240x_mmc_r, s3c240x_mmc_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( gp32 ) - PORT_START("IN0") - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("R") PORT_PLAYER(1) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("L") PORT_PLAYER(1) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") PORT_PLAYER(1) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") PORT_PLAYER(1) - PORT_START("IN1") - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("SELECT") PORT_PLAYER(1) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("START") PORT_PLAYER(1) -INPUT_PORTS_END - -void gp32_state::machine_start() -{ - s3c240x_machine_start(); -} - -void gp32_state::machine_reset() -{ - s3c240x_machine_reset(); -} - -static MACHINE_CONFIG_START( gp32, gp32_state ) - MCFG_CPU_ADD("maincpu", ARM9, 40000000) - MCFG_CPU_PROGRAM_MAP(gp32_map) - - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(240, 320) - MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 319) - MCFG_SCREEN_UPDATE_DRIVER(gp32_state, screen_update_gp32) - - /* 320x240 is 4:3 but ROT270 causes an aspect ratio of 3:4 by default */ - MCFG_DEFAULT_LAYOUT(layout_lcd_rot) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("dac1", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ADD("dac2", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) - - MCFG_NVRAM_ADD_1FILL("nvram") - - MCFG_DEVICE_ADD("smartmedia", SMARTMEDIA, 0) - - MCFG_SOFTWARE_LIST_ADD("memc_list","gp32") -MACHINE_CONFIG_END - -ROM_START( gp32 ) - ROM_REGION( 0x80000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "157e", "Firmware 1.5.7 (English)" ) - ROMX_LOAD( "gp32157e.bin", 0x000000, 0x080000, CRC(b1e35643) SHA1(1566bc2a27980602e9eb501cf8b2d62939bfd1e5), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "100k", "Firmware 1.0.0 (Korean)" ) - ROMX_LOAD( "gp32100k.bin", 0x000000, 0x080000, CRC(d9925ac9) SHA1(3604d0d7210ed72eddd3e3e0c108f1102508423c), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "156k", "Firmware 1.5.6 (Korean)" ) - ROMX_LOAD( "gp32156k.bin", 0x000000, 0x080000, CRC(667fb1c8) SHA1(d179ab8e96411272b6a1d683e59da752067f9da8), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "166m", "Firmware 1.6.6 (European)" ) - ROMX_LOAD( "gp32166m.bin", 0x000000, 0x080000, CRC(4548a840) SHA1(1ad0cab0af28fb45c182e5e8c87ead2aaa4fffe1), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "mfv2", "Mr. Spiv Multi Firmware V2" ) - ROMX_LOAD( "gp32mfv2.bin", 0x000000, 0x080000, CRC(7ddaaaeb) SHA1(5a85278f721beb3b00125db5c912d1dc552c5897), ROM_BIOS(5) ) -#if 0 - ROM_SYSTEM_BIOS( 5, "test", "test" ) - ROMX_LOAD( "test.bin", 0x000000, 0x080000, CRC(00000000) SHA1(0000000000000000000000000000000000000000), ROM_BIOS(6) ) -#endif -ROM_END - -CONS(2001, gp32, 0, 0, gp32, gp32, driver_device, 0, "Game Park Holdings", "GP32", ROT270|MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mess/drivers/grfd2301.c b/src/mess/drivers/grfd2301.c deleted file mode 100644 index e03f9312c2d..00000000000 --- a/src/mess/drivers/grfd2301.c +++ /dev/null @@ -1,139 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/************************************************************************************************************ - -Genrad Futuredata 2301 Network Control Processor - -2013-08-11 Skeleton - -Has a number of plug-in daughter boards, some of which are: -- CPU board: Mostek Z80 CPU, 24MHz crystal, 2 eproms (U2.PB72.2300.4039 1.0 ; U23.N.C.P.2300.4023 3.0) -- IO board: 5.0688MHz crystal, D8253C, 2x S2651 -- Memory board: 16k static ram consisting of 32x TMS2147H-7 chips, 1 prom? with sticker U36.2300.4035 1.0 -- 2301 board: 2x D8253C, 4x S2651 - -Back panel has a number of DB25 sockets, labelled thus: -- Station 1-4 -- Station 5-8 -- EIA 1 -- EIA 2 -- Printer -- 3 unlabelled ones - -A sticker on the back panel says: GenRad, Culver City CA, Model 2301-9001 - - -- No schematic or documents are available. Everything in this driver is a guess. -- Only one rom has been dumped. The best guess would be U23, as this is adjacent to the Z80. -- Although there's no display device, it has display ram. This has been hooked up with a chargen rom - from another system. - -*************************************************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" - -class grfd2301_state : public driver_device -{ -public: - grfd2301_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_p_videoram(*this, "videoram") - , m_maincpu(*this, "maincpu") - { } - -public: - virtual void machine_reset(); - const UINT8 *m_p_chargen; - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; -private: - required_device m_maincpu; - - -}; - -static ADDRESS_MAP_START( grfd2301_mem, AS_PROGRAM, 8, grfd2301_state ) - AM_RANGE(0xe000, 0xefff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( grfd2301_io, AS_IO, 8, grfd2301_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -static INPUT_PORTS_START( grfd2301 ) -INPUT_PORTS_END - -void grfd2301_state::machine_reset() -{ - m_p_chargen = memregion("chargen")->base(); - m_maincpu->set_pc(0xe000); -} - -UINT32 grfd2301_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 24; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 80; x++) - { - gfx = 0; - if (ra < 9) - { - chr = m_p_videoram[x+ma]; - - gfx = m_p_chargen[(chr<<4) | ra ]; - } - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=80; - } - return 0; -} - -static MACHINE_CONFIG_START( grfd2301, grfd2301_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(grfd2301_mem) - MCFG_CPU_IO_MAP(grfd2301_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(grfd2301_state, screen_update) - MCFG_SCREEN_SIZE(640, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -ROM_START( grfd2301 ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "boot2301", 0x000, 0x1000, CRC(feec0cbd) SHA1(ec8138aca7ed489d86aaf2e07225c8d715440db7) ) - - // Using the chargen from 'c10' for now. - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - -COMP( 198?, grfd2301, 0, 0, grfd2301, grfd2301, driver_device, 0, "Genrad", "Futuredata 2301 Network Processor", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/h19.c b/src/mess/drivers/h19.c deleted file mode 100644 index 4e44801c862..00000000000 --- a/src/mess/drivers/h19.c +++ /dev/null @@ -1,452 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Heathkit H19 - - 12/05/2009 Skeleton driver. - - The keyboard consists of a 9x10 matrix connected to a MM5740N - mask-programmed keyboard controller. The output of this passes - through a rom. The MM5740N may be custom-made, in which case it - will need to be procured and tested. There is a "default" array; - perhaps this is used. The presence of the rom would seem to - indicate that the default is being used. We won't know, of - course, until the device is emulated. - - Keyboard input can also come from the serial port (a 8250). - Either device will signal an interrupt to the CPU when a key - is pressed/sent. - - For the moment, the "ascii keyboard" device is used for the keyboard. - - TODO: - - Create device or HLE of MM5740N keyboard controller - - Make sure correct mask programming is used for it - - Use keyboard rom - - Finish connecting up the 8250 - - Verify beep lengths - - Verify ram size - - When the internal keyboard works, get rid of the "ascii_keyboard". - - Bios 1 (super19) has the videoram at D800. This is not emulated. - However, a keyclick can be heard, to assure you it does in fact work. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "sound/beep.h" -#include "machine/ins8250.h" -#include "machine/keyboard.h" - -#define KEYBOARD_TAG "keyboard" - -#define H19_CLOCK (XTAL_12_288MHz / 6) -#define H19_BEEP_FRQ (H19_CLOCK / 1024) - - -class h19_state : public driver_device -{ -public: - enum - { - TIMER_BEEP_OFF - }; - - h19_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "crtc"), - m_ace(*this, "ins8250"), - m_beep(*this, "beeper"), - m_p_videoram(*this, "videoram"), - m_palette(*this, "palette") - { - } - - required_device m_maincpu; - required_device m_crtc; - required_device m_ace; - required_device m_beep; - DECLARE_READ8_MEMBER(h19_80_r); - DECLARE_READ8_MEMBER(h19_a0_r); - DECLARE_WRITE8_MEMBER(h19_c0_w); - DECLARE_WRITE8_MEMBER(h19_kbd_put); - MC6845_UPDATE_ROW(crtc_update_row); - required_shared_ptr m_p_videoram; - required_device m_palette; - UINT8 *m_p_chargen; - UINT8 m_term_data; - virtual void machine_reset(); - virtual void video_start(); - DECLARE_WRITE_LINE_MEMBER(h19_ace_irq); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -void h19_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BEEP_OFF: - m_beep->set_state(0); - break; - default: - assert_always(FALSE, "Unknown id in h19_state::device_timer"); - } -} - -READ8_MEMBER( h19_state::h19_80_r ) -{ -// keyboard data - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( h19_state::h19_a0_r ) -{ -// keyboard status - m_maincpu->set_input_line(0, CLEAR_LINE); - return 0x7f; // says that a key is ready and no modifier keys are pressed -} - -WRITE8_MEMBER( h19_state::h19_c0_w ) -{ -/* Beeper control - a 96L02 contains 2 oneshots, one for bell and one for keyclick. -- lengths need verifying - offset 00-1F = keyclick - offset 20-3F = terminal bell */ - - UINT8 length = (offset & 0x20) ? 200 : 4; - m_beep->set_state(1); - timer_set(attotime::from_msec(length), TIMER_BEEP_OFF); -} - -static ADDRESS_MAP_START(h19_mem, AS_PROGRAM, 8, h19_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( h19_io, AS_IO, 8, h19_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x1F) AM_READ_PORT("S401") - AM_RANGE(0x20, 0x3F) AM_READ_PORT("S402") - AM_RANGE(0x40, 0x47) AM_MIRROR(0x18) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w ) - AM_RANGE(0x60, 0x60) AM_DEVWRITE("crtc", mc6845_device, address_w) - AM_RANGE(0x61, 0x61) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE(0x80, 0x9F) AM_READ(h19_80_r) - AM_RANGE(0xA0, 0xBF) AM_READ(h19_a0_r) - AM_RANGE(0xC0, 0xFF) AM_WRITE(h19_c0_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( h19 ) -// Port codes are omitted to prevent collision with terminal keys - - PORT_START("MODIFIERS") - // bit 0 connects to B8 of MM5740 - purpose unknown - // bit 7 is low if a key is pressed - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CapsLock") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OffLine") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LeftShift") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Reset") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RightShift") - - PORT_START("X1") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X2") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0-pad") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dot-pad") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter-pad") - - PORT_START("X2") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\'") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("{") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1-pad") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2-pad") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3-pad") - - PORT_START("X3") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LF") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4-pad") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5-pad") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6-pad") - - PORT_START("X4") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("AccentAcute") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X1") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7-pad") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8-pad") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9-pad") - - PORT_START("X5") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Blue") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Red") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gray") - - PORT_START("X6") - PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") - - PORT_START("X7") - PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Scroll") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") - - PORT_START("X8") - PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") - - PORT_START("X9") - PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") - PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") - PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") - PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") - - PORT_START("S401") - PORT_DIPNAME( 0x0f, 0x03, "Baud Rate") - PORT_DIPSETTING( 0x01, "110") - PORT_DIPSETTING( 0x02, "150") - PORT_DIPSETTING( 0x03, "300") - PORT_DIPSETTING( 0x04, "600") - PORT_DIPSETTING( 0x05, "1200") - PORT_DIPSETTING( 0x06, "1800") - PORT_DIPSETTING( 0x07, "2000") - PORT_DIPSETTING( 0x08, "2400") - PORT_DIPSETTING( 0x09, "3600") - PORT_DIPSETTING( 0x0a, "4800") - PORT_DIPSETTING( 0x0b, "7200") - PORT_DIPSETTING( 0x0c, "9600") - PORT_DIPSETTING( 0x0d, "19200") - PORT_DIPNAME( 0x30, 0x00, "Parity") - PORT_DIPSETTING( 0x00, DEF_STR(None)) - PORT_DIPSETTING( 0x10, "Odd") - PORT_DIPSETTING( 0x30, "Even") - PORT_DIPNAME( 0x40, 0x00, "Parity Type") - PORT_DIPSETTING( 0x00, DEF_STR(Normal)) - PORT_DIPSETTING( 0x40, "Stick") - PORT_DIPNAME( 0x80, 0x00, "Duplex") - PORT_DIPSETTING( 0x00, "Half") - PORT_DIPSETTING( 0x80, "Full") - - PORT_START("S402") // stored at 40C8 - PORT_DIPNAME( 0x01, 0x00, "Cursor") - PORT_DIPSETTING( 0x00, "Underline") - PORT_DIPSETTING( 0x01, "Block") - PORT_DIPNAME( 0x02, 0x00, "Keyclick") - PORT_DIPSETTING( 0x02, DEF_STR(No)) - PORT_DIPSETTING( 0x00, DEF_STR(Yes)) - PORT_DIPNAME( 0x04, 0x04, "Wrap at EOL") - PORT_DIPSETTING( 0x00, DEF_STR(No)) - PORT_DIPSETTING( 0x04, DEF_STR(Yes)) - PORT_DIPNAME( 0x08, 0x08, "Auto LF on CR") - PORT_DIPSETTING( 0x00, DEF_STR(No)) - PORT_DIPSETTING( 0x08, DEF_STR(Yes)) - PORT_DIPNAME( 0x10, 0x00, "Auto CR on LF") - PORT_DIPSETTING( 0x00, DEF_STR(No)) - PORT_DIPSETTING( 0x10, DEF_STR(Yes)) - PORT_DIPNAME( 0x20, 0x00, "Mode") - PORT_DIPSETTING( 0x00, "VT52") - PORT_DIPSETTING( 0x20, "ANSI") - PORT_DIPNAME( 0x40, 0x00, "Keypad Shifted") - PORT_DIPSETTING( 0x00, DEF_STR(No)) - PORT_DIPSETTING( 0x40, DEF_STR(Yes)) - PORT_DIPNAME( 0x80, 0x00, "Refresh") - PORT_DIPSETTING( 0x00, "50Hz") - PORT_DIPSETTING( 0x80, "60Hz") -INPUT_PORTS_END - - -void h19_state::machine_reset() -{ - m_beep->set_frequency(H19_BEEP_FRQ); -} - -void h19_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -MC6845_UPDATE_ROW( h19_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - UINT8 inv=0; - if (x == cursor_x) inv=0xff; - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - - if (chr & 0x80) - { - inv ^= 0xff; - chr &= 0x7f; - } - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; - - /* Display a scanline of a character (8 pixels) */ - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} - -WRITE_LINE_MEMBER(h19_state::h19_ace_irq) -{ - m_maincpu->set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE)); -} - -/* F4 Character Displayer */ -static const gfx_layout h19_charlayout = -{ - 8, 10, /* 8 x 10 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( h19 ) - GFXDECODE_ENTRY( "chargen", 0x0000, h19_charlayout, 0, 1 ) -GFXDECODE_END - -WRITE8_MEMBER( h19_state::h19_kbd_put ) -{ - m_term_data = data; - m_maincpu->set_input_line(0, HOLD_LINE); -} - -static MACHINE_CONFIG_START( h19, h19_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, H19_CLOCK) // From schematics - MCFG_CPU_PROGRAM_MAP(h19_mem) - MCFG_CPU_IO_MAP(h19_io) - //MCFG_DEVICE_PERIODIC_INT_DRIVER(h19_state, irq0_line_hold, 50) // for testing, causes a keyboard scan - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", h19) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12_288MHz / 8) // clk taken from schematics - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) /*?*/ - MCFG_MC6845_UPDATE_ROW_CB(h19_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) // frame pulse - - MCFG_DEVICE_ADD("ins8250", INS8250, XTAL_12_288MHz / 4) // 3.072mhz clock which gets divided down for the various baud rates - MCFG_INS8250_OUT_INT_CB(WRITELINE(h19_state, h19_ace_irq)) // interrupt - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(h19_state, h19_kbd_put)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( h19 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // Original - ROM_SYSTEM_BIOS(0, "orig", "Original") - ROMX_LOAD( "2732_444-46_h19code.bin", 0x0000, 0x1000, CRC(f4447da0) SHA1(fb4093d5b763be21a9580a0defebed664b1f7a7b), ROM_BIOS(1)) - // Super H19 ROM ( - ROM_SYSTEM_BIOS(1, "super", "Super 19") - ROMX_LOAD( "2732_super19_h447.bin", 0x0000, 0x1000, CRC(6c51aaa6) SHA1(5e368b39fe2f1af44a905dc474663198ab630117), ROM_BIOS(2)) - // Watzman ROM - ROM_SYSTEM_BIOS(2, "watzman", "Watzman") - ROMX_LOAD( "watzman.bin", 0x0000, 0x1000, CRC(8168b6dc) SHA1(bfaebb9d766edbe545d24bc2b6630be4f3aa0ce9), ROM_BIOS(3)) - - ROM_REGION( 0x0800, "chargen", 0 ) - // Original font dump - ROM_LOAD( "2716_444-29_h19font.bin", 0x0000, 0x0800, CRC(d595ac1d) SHA1(130fb4ea8754106340c318592eec2d8a0deaf3d0)) - - ROM_REGION( 0x1000, "keyboard", 0 ) - // Original dump - ROM_LOAD( "2716_444-37_h19keyb.bin", 0x0000, 0x0800, CRC(5c3e6972) SHA1(df49ce64ae48652346a91648c58178a34fb37d3c)) - // Watzman keyboard - ROM_LOAD( "keybd.bin", 0x0800, 0x0800, CRC(58dc8217) SHA1(1b23705290bdf9fc6342065c6a528c04bff67b13)) -ROM_END - -/* Driver (year is either 1978 or 1979) */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, h19, 0, 0, h19, h19, driver_device, 0, "Heath Inc", "Heathkit H-19", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/h8.c b/src/mess/drivers/h8.c deleted file mode 100644 index 9838ad98100..00000000000 --- a/src/mess/drivers/h8.c +++ /dev/null @@ -1,368 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Heathkit H8 - - 2009-05-12 Skeleton driver. - - This system uses Octal rather than the usual hexadecimal. - -STATUS: - It runs, keyboard works, you can enter data. - -Meaning of LEDs: - PWR = power is turned on - MON = controls should work - RUN = CPU is running (not halted) - ION = Interrupts are enabled - -Pasting: - 0-F : as is - + : ^ - - : V - MEM : - - ALTER : = - - Addresses must have all 6 digits entered. - Data must have all 3 digits entered. - System has a short beep for each key, and a slightly longer beep - for each group of 3 digits. The largest number allowed is 377 (=0xFF). - -Test Paste: - -041000=123 245 333 144 255 366 077=-041000 - Now press up-arrow to confirm the data has been entered. - -Official test program from pages 4 to 8 of the operator's manual: - -040100=076 002 062 010 040 006 004 041 170 040 021 013 040 016 011 176 - 022 043 023 015 302 117 040 016 003 076 377 315 053 000 015 302 - 131 040 005 302 112 040 076 062 315 140 002 076 062 315 053 000 - 076 062 315 140 002 303 105 040 377 262 270 272 275 377 222 200 - 377 237 244 377 272 230 377 220 326 302 377 275 272 271 271 373 - 271 240 377 236 376 362 236 376 362 236 376 362 R6=040100=4 - -TODO: - - Cassette (coded but not working) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8251.h" -#include "machine/clock.h" -#include "imagedev/cassette.h" -#include "sound/beep.h" -#include "sound/wave.h" -#include "h8.lh" - - -class h8_state : public driver_device -{ -public: - h8_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_uart(*this, "uart"), - m_cass(*this, "cassette"), - m_beep(*this, "beeper") - { } - - DECLARE_READ8_MEMBER(portf0_r); - DECLARE_WRITE8_MEMBER(portf0_w); - DECLARE_WRITE8_MEMBER(portf1_w); - DECLARE_WRITE8_MEMBER(h8_status_callback); - DECLARE_WRITE_LINE_MEMBER(h8_inte_callback); - DECLARE_WRITE_LINE_MEMBER(txdata_callback); - DECLARE_WRITE_LINE_MEMBER(write_cassette_clock); - TIMER_DEVICE_CALLBACK_MEMBER(h8_irq_pulse); - TIMER_DEVICE_CALLBACK_MEMBER(h8_c); - TIMER_DEVICE_CALLBACK_MEMBER(h8_p); -private: - UINT8 m_digit; - UINT8 m_segment; - UINT8 m_irq_ctl; - bool m_ff_b; - UINT8 m_cass_data[4]; - bool m_cass_state; - bool m_cassold; - virtual void machine_reset(); - required_device m_maincpu; - required_device m_uart; - required_device m_cass; - required_device m_beep; -}; - - -#define H8_CLOCK (XTAL_12_288MHz / 6) -#define H8_BEEP_FRQ (H8_CLOCK / 1024) -#define H8_IRQ_PULSE (H8_BEEP_FRQ / 2) - - -TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_irq_pulse) -{ - if (m_irq_ctl & 1) - m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xcf); -} - -READ8_MEMBER( h8_state::portf0_r ) -{ - // reads the keyboard - - // The following not emulated, can occur any time even if keyboard not being scanned - // - if 0 and RTM pressed, causes int10 - // - if 0 and RST pressed, resets cpu - - UINT8 i,keyin,data = 0xff; - - keyin = ioport("X0")->read(); - if (keyin != 0xff) - { - for (i = 1; i < 8; i++) - if (!BIT(keyin,i)) - data &= ~(i<<1); - data &= 0xfe; - } - - keyin = ioport("X1")->read(); - if (keyin != 0xff) - { - for (i = 1; i < 8; i++) - if (!BIT(keyin,i)) - data &= ~(i<<5); - data &= 0xef; - } - return data; -} - -WRITE8_MEMBER( h8_state::portf0_w ) -{ - // this will always turn off int10 that was set by the timer - // d0-d3 = digit select - // d4 = int20 is allowed - // d5 = mon led - // d6 = int10 is allowed - // d7 = beeper enable - - m_digit = data & 15; - if (m_digit) output_set_digit_value(m_digit, m_segment); - - output_set_value("mon_led", !BIT(data, 5)); - m_beep->set_state(!BIT(data, 7)); - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); - m_irq_ctl &= 0xf0; - if (BIT(data, 6)) m_irq_ctl |= 1; - if (!BIT(data, 4)) m_irq_ctl |= 2; -} - -WRITE8_MEMBER( h8_state::portf1_w ) -{ - //d7 segment dot - //d6 segment f - //d5 segment e - //d4 segment d - //d3 segment c - //d2 segment b - //d1 segment a - //d0 segment g - - m_segment = 0xff ^ BITSWAP8(data, 7, 0, 6, 5, 4, 3, 2, 1); - if (m_digit) output_set_digit_value(m_digit, m_segment); -} - -static ADDRESS_MAP_START(h8_mem, AS_PROGRAM, 8, h8_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM // main rom - AM_RANGE(0x1400, 0x17ff) AM_RAM // fdc ram - AM_RANGE(0x1800, 0x1fff) AM_ROM // fdc rom - AM_RANGE(0x2000, 0x9fff) AM_RAM // main ram -ADDRESS_MAP_END - -static ADDRESS_MAP_START( h8_io, AS_IO, 8, h8_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf0, 0xf0) AM_READWRITE(portf0_r,portf0_w) - AM_RANGE(0xf1, 0xf1) AM_WRITE(portf1_w) - AM_RANGE(0xf8, 0xf8) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0xf9, 0xf9) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - // optional connection to a serial terminal @ 600 baud - //AM_RANGE(0xfa, 0xfa) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) - //AM_RANGE(0xfb, 0xfb) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( h8 ) - PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 SP") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 AF") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 BC") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 DE GO") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 HL IN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 PC OUT") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 SI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 LOAD") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 DUMP") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CANCEL") PORT_CODE(KEYCODE_ESC) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALTER") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') -INPUT_PORTS_END - -void h8_state::machine_reset() -{ - m_beep->set_frequency(H8_BEEP_FRQ); - output_set_value("pwr_led", 0); - m_irq_ctl = 1; - m_cass_state = 1; - m_cass_data[0] = 0; - m_cass_data[1] = 0; - m_uart->write_rxd(0); - m_cass_data[3] = 0; - m_ff_b = 1; -} - -WRITE_LINE_MEMBER( h8_state::h8_inte_callback ) -{ - // operate the ION LED - output_set_value("ion_led", !state); - m_irq_ctl &= 0x7f | ((state) ? 0 : 0x80); -} - -WRITE8_MEMBER( h8_state::h8_status_callback ) -{ -/* This is rather messy, but basically there are 2 D flipflops, one drives the other, -the data is /INTE while the clock is /M1. If the system is in Single Instruction mode, -a int20 (output of 2nd flipflop) will occur after 4 M1 steps, to pause the running program. -But, all of this can only occur if bit 5 of port F0 is low. */ - - bool state = (data & I8085_STATUS_M1) ? 0 : 1; - bool c,a = (m_irq_ctl & 0x80) ? 1 : 0; - - if (m_irq_ctl & 2) - { - if (!state) // rising pulse to push data through flipflops - { - c = !m_ff_b; // from /Q of 2nd flipflop - m_ff_b = a; // from Q of 1st flipflop - if (c) - m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xd7); - } - } - else - { // flipflops are 'set' - c = 0; - m_ff_b = 1; - } - - - // operate the RUN LED - output_set_value("run_led", state); -} - -WRITE_LINE_MEMBER( h8_state::txdata_callback ) -{ - m_cass_state = state; -} - -WRITE_LINE_MEMBER( h8_state::write_cassette_clock ) -{ - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - -TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_c) -{ - m_cass_data[3]++; - - if (m_cass_state != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = m_cass_state; - } - - if (m_cass_state) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_p) -{ - /* cassette - turn 1200/2400Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_uart->write_rxd((m_cass_data[1] < 12) ? 1 : 0); - m_cass_data[1] = 0; - } -} - -static MACHINE_CONFIG_START( h8, h8_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, H8_CLOCK) - MCFG_CPU_PROGRAM_MAP(h8_mem) - MCFG_CPU_IO_MAP(h8_io) - MCFG_I8085A_STATUS(WRITE8(h8_state, h8_status_callback)) - MCFG_I8085A_INTE(WRITELINE(h8_state, h8_inte_callback)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_h8) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(h8_state, txdata_callback)) - - MCFG_DEVICE_ADD("cassette_clock", CLOCK, 4800) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(h8_state, write_cassette_clock)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("h8_cass") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_c", h8_state, h8_c, attotime::from_hz(4800)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_p", h8_state, h8_p, attotime::from_hz(40000)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_timer", h8_state, h8_irq_pulse, attotime::from_hz(H8_IRQ_PULSE)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( h8 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // H17 fdc bios - needed by bios2&3 - ROM_LOAD( "2716_444-19_h17.rom", 0x1800, 0x0800, CRC(26e80ae3) SHA1(0c0ee95d7cb1a760f924769e10c0db1678f2435c)) - - ROM_SYSTEM_BIOS(0, "bios0", "Standard") - ROMX_LOAD( "2708_444-13_pam8.rom", 0x0000, 0x0400, CRC(e0745513) SHA1(0e170077b6086be4e5cd10c17e012c0647688c39), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS(1, "bios1", "Alternate") - ROMX_LOAD( "2708_444-13_pam8go.rom", 0x0000, 0x0400, CRC(9dbad129) SHA1(72421102b881706877f50537625fc2ab0b507752), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS(2, "bios2", "Disk OS") - ROMX_LOAD( "2716_444-13_pam8at.rom", 0x0000, 0x0800, CRC(fd95ddc1) SHA1(eb1f272439877239f745521139402f654e5403af), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS(3, "bios3", "Disk OS Alt") - ROMX_LOAD( "2732_444-70_xcon8.rom", 0x0000, 0x1000, CRC(b04368f4) SHA1(965244277a3a8039a987e4c3593b52196e39b7e7), ROM_BIOS(4) ) - - // this one runs off into the weeds - ROM_SYSTEM_BIOS(4, "bios4", "not working") - ROMX_LOAD( "2732_444-140_pam37.rom", 0x0000, 0x1000, CRC(53a540db) SHA1(90082d02ffb1d27e8172b11fff465bd24343486e), ROM_BIOS(5) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS, INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, h8, 0, 0, h8, h8, driver_device, 0, "Heath, Inc.", "Heathkit H8", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/h89.c b/src/mess/drivers/h89.c deleted file mode 100644 index 8ad90cede45..00000000000 --- a/src/mess/drivers/h89.c +++ /dev/null @@ -1,151 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Heathkit H89 - - 12/05/2009 Skeleton driver. - - Monitor Commands: - B Boot - C Convert (number) - G Go (address) - I In (address) - O Out (address,data) - R Radix (H/O) - S Substitute (address) - T Test Memory - V View - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "machine/ins8250.h" - -#define RS232_TAG "rs232" - -class h89_state : public driver_device -{ -public: - h89_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { - } - - required_device m_maincpu; - - DECLARE_WRITE8_MEMBER( port_f2_w ); - - UINT8 m_port_f2; - virtual void machine_reset(); - TIMER_DEVICE_CALLBACK_MEMBER(h89_irq_timer); -}; - - -static ADDRESS_MAP_START(h89_mem, AS_PROGRAM, 8, h89_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( h89_io, AS_IO, 8, h89_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -// AM_RANGE(0x78, 0x7b) expansion 1 -// AM_RANGE(0x7c, 0x7f) expansion 2 -// AM_RANGE(0xd0, 0xd7) 8250 UART DCE -// AM_RANGE(0xd8, 0xdf) 8250 UART DTE -// AM_RANGE(0xe0, 0xe7) 8250 UART LP - AM_RANGE(0xe8, 0xef) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w) // 8250 UART console -// AM_RANGE(0xf0, 0xf1) front panel - AM_RANGE(0xf2, 0xf2) AM_WRITE(port_f2_w) AM_READ_PORT("SW501") -// AM_RANGE(0xf8, 0xf9) cassette -// AM_RANGE(0xfa, 0xff) serial I/O -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( h89 ) - PORT_START("SW501") - PORT_DIPNAME( 0x03, 0x00, "Expansion 1" ) PORT_DIPLOCATION("S1:1,S1:2") - PORT_DIPSETTING( 0x00, "H-88-1" ) - PORT_DIPSETTING( 0x01, "H/Z-47" ) - PORT_DIPSETTING( 0x02, "Z-67" ) - PORT_DIPSETTING( 0x03, "Undefined" ) - PORT_DIPNAME( 0x0c, 0x00, "Expansion 2" ) PORT_DIPLOCATION("S1:3,S1:4") - PORT_DIPSETTING( 0x00, "H-89-37" ) - PORT_DIPSETTING( 0x04, "H/Z-47" ) - PORT_DIPSETTING( 0x08, "Z-67" ) - PORT_DIPSETTING( 0x0c, "Undefined" ) - PORT_DIPNAME( 0x10, 0x00, "Boot from" ) PORT_DIPLOCATION("S1:5") - PORT_DIPSETTING( 0x00, "Expansion 1" ) - PORT_DIPSETTING( 0x10, "Expansion 2" ) - PORT_DIPNAME( 0x20, 0x20, "Perform memory test at start" ) PORT_DIPLOCATION("S1:6") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, "Console Baud rate" ) PORT_DIPLOCATION("S1:7") - PORT_DIPSETTING( 0x00, "9600" ) - PORT_DIPSETTING( 0x40, "19200" ) - PORT_DIPNAME( 0x80, 0x00, "Boot mode" ) PORT_DIPLOCATION("S1:8") - PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x80, "Auto" ) -INPUT_PORTS_END - - -void h89_state::machine_reset() -{ -} - -TIMER_DEVICE_CALLBACK_MEMBER(h89_state::h89_irq_timer) -{ - if (m_port_f2 & 0x02) - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); -} - -WRITE8_MEMBER( h89_state::port_f2_w ) -{ - m_port_f2 = data; -} - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - - -static MACHINE_CONFIG_START( h89, h89_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_12_288MHz / 6) - MCFG_CPU_PROGRAM_MAP(h89_mem) - MCFG_CPU_IO_MAP(h89_io) - - MCFG_DEVICE_ADD( "ins8250", INS8250, XTAL_1_8432MHz ) - MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, rx_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", h89_state, h89_irq_timer, attotime::from_hz(100)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( h89 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "2732_444-142_mtr90.rom", 0x0000, 0x1000, CRC(c4ff47c5) SHA1(d6f3d71ff270a663003ec18a3ed1fa49f627123a)) - ROM_LOAD( "2716_444-19_h17.rom", 0x1800, 0x0800, CRC(26e80ae3) SHA1(0c0ee95d7cb1a760f924769e10c0db1678f2435c)) - - ROM_REGION( 0x10000, "otherroms", ROMREGION_ERASEFF ) - ROM_LOAD( "2732_444-84_mtr84.rom", 0x0000, 0x1000, CRC(c98e5f4c) SHA1(03347206dca145ff69ca08435db822b70ce106af)) - ROM_LOAD( "2732_mms84a_magnoliamms.bin", 0x0000, 0x1000, CRC(5563f42a) SHA1(1b74cafca8213d5c083f16d8a848933ab56eb43b)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, h89, 0, 0, h89, h89, driver_device, 0, "Heath Inc", "Heathkit H89", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/harriet.c b/src/mess/drivers/harriet.c deleted file mode 100644 index b359c19daec..00000000000 --- a/src/mess/drivers/harriet.c +++ /dev/null @@ -1,225 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese -/*************************************************************************** - - Harriet (c) 1990 Quantel - - TODO: - - PCB pics would be very useful - - "Failed to read NVR" message. - - hook-up keyboard/terminal, shouldn't be too hard by studying the code. - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class harriet_state : public driver_device -{ -public: - harriet_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - // devices - required_device m_maincpu; - required_device m_terminal; - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - UINT8 m_teletype_data; - UINT8 m_teletype_status; - - DECLARE_READ8_MEMBER(unk_r); - DECLARE_WRITE8_MEMBER(unk_w); - DECLARE_WRITE8_MEMBER(serial_w); - DECLARE_READ8_MEMBER(unk2_r); - DECLARE_READ8_MEMBER(unk3_r); - DECLARE_READ8_MEMBER(keyboard_status_r); - DECLARE_WRITE8_MEMBER( kbd_put ); -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); -}; - -void harriet_state::video_start() -{ -} - -UINT32 harriet_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - return 0; -} - -/* tested at POST (PC=0x612), halts the CPU if cmp.b $f1000f.l, d0 for 0x4000 DBRAs */ -READ8_MEMBER(harriet_state::unk_r) -{ - return machine().rand(); -} - -WRITE8_MEMBER(harriet_state::unk_w) -{ -/* if(offset) - printf("%02x\n",data); - else if(data != 0xcf) - printf("$f1001d Control (offset 0) write %02x\n",data);*/ -} - -/* PC=0x676/0x694 */ -READ8_MEMBER(harriet_state::unk2_r) -{ - return machine().rand(); -} - - -WRITE8_MEMBER(harriet_state::serial_w) -{ - m_terminal->write(space, 0, data); -} - -/* tested before putting data to serial port at PC=0x4c78 */ -READ8_MEMBER(harriet_state::unk3_r) -{ - return 0xff;//machine().rand(); -} - -/* 0x314c bit 7: keyboard status */ -READ8_MEMBER(harriet_state::keyboard_status_r) -{ - UINT8 res; - - res = m_teletype_status | m_teletype_data; - m_teletype_status &= ~0x80; - - return res; -} - -static ADDRESS_MAP_START( harriet_map, AS_PROGRAM, 16, harriet_state ) - AM_RANGE(0x000000, 0x007fff) AM_ROM - AM_RANGE(0x040000, 0x040fff) AM_RAM // NVRAM - AM_RANGE(0x7f0000, 0x7fffff) AM_RAM // todo: boundaries, 0x7fe000 - 0x7fffff tested on boot - AM_RANGE(0xf1000e, 0xf1000f) AM_READ8(unk_r,0x00ff) - AM_RANGE(0xf1001c, 0xf1001f) AM_WRITE8(unk_w,0x00ff) - AM_RANGE(0xf20022, 0xf20023) AM_READ8(unk2_r,0x00ff) - AM_RANGE(0xf20024, 0xf20025) AM_READ8(unk2_r,0x00ff) - AM_RANGE(0xf2002c, 0xf2002d) AM_READ8(unk3_r,0x00ff) - AM_RANGE(0xf2002e, 0xf2002f) AM_WRITE8(serial_w,0x00ff) -// AM_RANGE(0xf4001e, 0xf4001f) AM_READ8(keyboard_status_r,0x00ff) -// AM_RANGE(0xf4002e, 0xf4002f) AM_READ8(keyboard_status_r,0x00ff) - AM_RANGE(0xf4003e, 0xf4003f) AM_READ8(keyboard_status_r,0x00ff) -ADDRESS_MAP_END - -static INPUT_PORTS_START( harriet ) - /* dummy active high structure */ - PORT_START("SYSA") - PORT_DIPNAME( 0x01, 0x00, "SYSA" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - - /* dummy active low structure */ - PORT_START("DSWA") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -WRITE8_MEMBER( harriet_state::kbd_put ) -{ - m_teletype_data = data; - m_teletype_status |= 0x80; -} - -void harriet_state::machine_start() -{ -} - -void harriet_state::machine_reset() -{ -} - - -static MACHINE_CONFIG_START( harriet, harriet_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M68010,XTAL_8MHz) // TODO: clock - MCFG_CPU_PROGRAM_MAP(harriet_map) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(harriet_state, kbd_put)) - - MCFG_PALETTE_ADD("palette", 8) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( harriet ) - ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD16_BYTE( "harriet 36-74c.tfb v5.01 lobyte 533f.bin", 0x0001, 0x4000, CRC(f07fff76) SHA1(8288f7eaa8f4155e0e4746635f63ca2cc3da25d1) ) - ROM_LOAD16_BYTE( "harriet 36-74c.tdb v5.01 hibyte 2a0c.bin", 0x0000, 0x4000, CRC(a61f441d) SHA1(76af6eddd5c042f1b2eef590eb822379944b9b28) ) -ROM_END - -COMP( 1990, harriet, 0, 0, harriet, harriet, driver_device, 0, "Quantel", "Harriet", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/hec2hrp.c b/src/mess/drivers/hec2hrp.c deleted file mode 100644 index ef9e3cac314..00000000000 --- a/src/mess/drivers/hec2hrp.c +++ /dev/null @@ -1,731 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:JJ Stacino -/*************************************************************************** - - Hector 2HR+ - Victor - Hector 2HR - Hector HRX - Hector MX40c - Hector MX80c - Hector 1 - Interact - - These machines can load and run cassettes for the interact / hector1. - hec2hr - press 2 then 1 - hec2hrp - press 2 then 1 - hec2hrx - press 5 then 1 - hec2mx40 - press 5 then 1 - hec2mx80 - not compatible - victor - press R then L - - 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com - 31/06/2009 Video - Robbbert - - 29/10/2009 Update skeleton to functional machine - by yo_fr (jj.stac @ aliceadsl.fr) - - => add Keyboard, - => add color, - => add cassette, - => add sn76477 sound and 1bit sound, - => add joysticks (stick, pot, fire) - => add BR/HR switching - => add bank switch for HRX - => add device MX80c and bank switching for the ROM - Importante note : the keyboard function add been piked from - DChector project : http://dchector.free.fr/ made by DanielCoulom - (thank's Daniel) - 03/01/2010 Update and clean prog by yo_fr (jj.stac@aliceadsl.fr) - => add the port mapping for keyboard - 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M runnig! JJStacino - 11/11/2011 : add the minidisque support -3 pouces 1/2 driver- JJStacino - - don't forget to keep some information about these machine see DChector project : http://dchector.free.fr/ made by DanielCoulom - (and thanks to Daniel!) and Yves site : http://hectorvictor.free.fr/ (thank's too Yves!) - - TODO : Add the cartridge function, - Add diskette support, (done !) - Adjust the one shot and A/D timing (sn76477) -****************************************************************************/ -/* Joystick 1 : - clavier numerique : - (UP)5 - (left)1 (right)3 - (down)2 - - Fire <+> - Pot => home/end */ - - /* Joystick 0 : - arrows - (UP)^ - (left)<- (right)-> - (down)v - - Fire near <1> - Pot => INS /SUPPR - - Cassette : wav file (1 way, 16 bits, 44100hz) - K7 file (For data and games) - FOR file (for forth screen data) -*/ - -#include "emu.h" - -#include "imagedev/cassette.h" -#include "formats/hect_tap.h" -#include "imagedev/printer.h" -#include "sound/wave.h" /* for K7 sound*/ -#include "sound/discrete.h" /* for 1 Bit sound*/ -#include "machine/upd765.h" /* for floppy disc controller */ -#include "cpu/z80/z80.h" -#include "formats/hect_dsk.h" -#include "formats/hector_minidisc.h" -#include "includes/hec2hrp.h" - -/*****************************************************************************/ -static ADDRESS_MAP_START(hecdisc2_mem, AS_PROGRAM, 8, hec2hrp_state ) -/*****************************************************************************/ - ADDRESS_MAP_UNMAP_HIGH - - /* Hardward address mapping*/ - AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank3") /*zone with ROM at start up, RAM later*/ - - AM_RANGE( 0x4000, 0xffff ) AM_RAM - -ADDRESS_MAP_END - -static ADDRESS_MAP_START( hecdisc2_io , AS_IO, 8, hec2hrp_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // ROM Page managing - AM_RANGE(0x000,0x00f) AM_READWRITE(hector_disc2_io00_port_r, hector_disc2_io00_port_w ) - // RS232 - 8251 managing - AM_RANGE(0x020,0x02f) AM_READWRITE(hector_disc2_io20_port_r, hector_disc2_io20_port_w ) - // Hector communication managing - AM_RANGE(0x030,0x03f) AM_READWRITE(hector_disc2_io30_port_r, hector_disc2_io30_port_w ) - AM_RANGE(0x040,0x04f) AM_READWRITE(hector_disc2_io40_port_r, hector_disc2_io40_port_w ) - AM_RANGE(0x050,0x05f) AM_READWRITE(hector_disc2_io50_port_r, hector_disc2_io50_port_w ) - // uPD765 link: - AM_RANGE(0x060,0x061) AM_DEVICE("upd765", upd765a_device, map) - AM_RANGE(0x070,0x07f) AM_DEVREADWRITE("upd765", upd765a_device, mdma_r, mdma_w) -ADDRESS_MAP_END - -/*****************************************************************************/ -static ADDRESS_MAP_START(hec2hrp_mem, AS_PROGRAM, 8, hec2hrp_state ) -/*****************************************************************************/ - ADDRESS_MAP_UNMAP_HIGH - /* Hardware address mapping*/ - AM_RANGE(0x0800,0x0808) AM_WRITE(hector_switch_bank_w)/* Bank management*/ - AM_RANGE(0x1000,0x1000) AM_WRITE(hector_color_a_w) /* Color c0/c1*/ - AM_RANGE(0x1800,0x1800) AM_WRITE(hector_color_b_w) /* Color c2/c3*/ - AM_RANGE(0x2000,0x2003) AM_WRITE(hector_sn_2000_w) /* Sound*/ - AM_RANGE(0x2800,0x2803) AM_WRITE(hector_sn_2800_w) /* Sound*/ - AM_RANGE(0x3000,0x3000) AM_READWRITE(hector_cassette_r, hector_sn_3000_w)/* Write necessary*/ - AM_RANGE(0x3800,0x3807) AM_READWRITE(hector_keyboard_r, hector_keyboard_w) /* Keyboard*/ - - /* Main ROM page*/ - AM_RANGE(0x0000,0x3fff) AM_ROM - - /* Video br mapping*/ - AM_RANGE(0x4000,0x49ff) AM_RAM AM_SHARE("videoram") - /* continous RAM*/ - AM_RANGE(0x4A00,0xbfff) AM_RAM - /* from 0xC000 to 0xFFFF => Bank Ram for video and data !*/ - AM_RANGE(0xc000,0xffff) AM_RAM AM_SHARE("hector_videoram") -ADDRESS_MAP_END - -/*****************************************************************************/ -static ADDRESS_MAP_START(hec2hrx_mem, AS_PROGRAM, 8, hec2hrp_state ) -/*****************************************************************************/ - ADDRESS_MAP_UNMAP_HIGH - /* Hardware address mapping*/ - AM_RANGE(0x0800,0x0808) AM_WRITE(hector_switch_bank_w)/* Bank management*/ - AM_RANGE(0x1000,0x1000) AM_WRITE(hector_color_a_w) /* Color c0/c1*/ - AM_RANGE(0x1800,0x1800) AM_WRITE(hector_color_b_w) /* Color c2/c3*/ - AM_RANGE(0x2000,0x2003) AM_WRITE(hector_sn_2000_w) /* Sound*/ - AM_RANGE(0x2800,0x2803) AM_WRITE(hector_sn_2800_w) /* Sound*/ - AM_RANGE(0x3000,0x3000) AM_READWRITE(hector_cassette_r, hector_sn_3000_w)/* Write necessary*/ - AM_RANGE(0x3800,0x3807) AM_READWRITE(hector_keyboard_r, hector_keyboard_w) /* Keyboard*/ - - /* Main ROM page*/ - AM_RANGE(0x0000,0x3fff) AM_ROMBANK("bank2") - - /* Video br mapping*/ - AM_RANGE(0x4000,0x49ff) AM_RAM AM_SHARE("videoram") - /* continous RAM*/ - AM_RANGE(0x4A00,0xbfff) AM_RAM - /* from 0xC000 to 0xFFFF => Bank Ram for video and data !*/ - AM_RANGE(0xc000,0xffff) AM_RAMBANK("bank1") AM_SHARE("hector_videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( hec2hrp_io , AS_IO, 8, hec2hrp_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x000,0x0ff) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( hec2hrx_io , AS_IO, 8, hec2hrp_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0f0,0x0ff) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( hec2mdhrx_io , AS_IO, 8, hec2hrp_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - - // Minidisc commands and changing the rom page !*/ - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("wd179x", fd1793_t, read, write) - AM_RANGE(0x08, 0x08) AM_WRITE(minidisc_control_w) - AM_RANGE(0x0f0,0x0ff) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( hec2mx40_io , AS_IO, 8, hec2hrp_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x000,0x0ef) AM_WRITE(hector_mx40_io_port_w ) - AM_RANGE(0x0f0,0x0f3) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( hec2mx80_io , AS_IO, 8, hec2hrp_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x000,0x0ef) AM_WRITE(hector_mx80_io_port_w ) - AM_RANGE(0x0f0,0x0f3) AM_READWRITE(hector_io_8255_r, hector_io_8255_w ) - - -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( hec2hrp ) - /* keyboard input */ - PORT_START("KEY.0") /* [0] - port 3000 @ 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("KEY.1") /* [1] - port 3000 @ 1 */ /* touches => 2 1 0 / . - , + */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - - PORT_START("KEY.2") /* [1] - port 3000 @ 2 */ /* touches => .. 9 8 7 6 5 4 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 :") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 !") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_START("KEY.3") /* [1] - port 3000 @ 3 */ /* touches => B A .. ? .. = .. ; */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_START("KEY.4") /* [1] - port 3000 @ 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("KEY.5") /* [1] - port 3000 @ 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - - PORT_START("KEY.6") /* [1] - port 3000 @ 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - - PORT_START("KEY.7") /* [1] - port 3000 @ 7 JOYSTICK */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) LEFT") PORT_CODE(KEYCODE_1_PAD) // Joy(1) on numpad - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) RIGHT") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) UP") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) DOWN") PORT_CODE(KEYCODE_2_PAD) - - PORT_START("KEY.8") /* [1] - port 3000 @ 8 not for the real machine, but to emulate the analog signal of the joystick */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) FIRE") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) FIRE") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)+") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)-") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)+") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)-") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/*****************************************************************************/ -MACHINE_START_MEMBER(hec2hrp_state,hec2hrp) -/*****************************************************************************/ -{ - hector_init(); -} - -MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrp) -{ - // Machines init - hector_reset(1, 0); -} -/*****************************************************************************/ -MACHINE_START_MEMBER(hec2hrp_state,hec2hrx) -/*****************************************************************************/ -{ - UINT8 *RAM = memregion("maincpu" )->base(); // pointer to mess ram - //Patch rom possible ! - //RAMD2[0xff6b] = 0x0ff; // force verbose mode hector ! - - // Memory install for bank switching - membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000] ); // Mess ram - membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, m_hector_videoram_hrx); // Video ram - - // Set bank HECTOR_BANK_PROG as basic bank - membank("bank1")->set_entry(HECTOR_BANK_PROG); - -/******************************************************SPECIFIQUE MX ***************************/ - membank("bank2")->configure_entry(HECTORMX_BANK_PAGE0 , &RAM[0x0000] ); // Mess ram - membank("bank2")->configure_entry(HECTORMX_BANK_PAGE1 , memregion("page1")->base() ); // Rom page 1 - membank("bank2")->configure_entry(HECTORMX_BANK_PAGE2 , memregion("page2")->base() ); // Rom page 2 - membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); -/******************************************************SPECIFIQUE MX ***************************/ - -/*************************************************SPECIFIQUE DISK II ***************************/ - membank("bank3")->configure_entry(DISCII_BANK_ROM , memregion("rom_disc2")->base() ); // ROM - membank("bank3")->configure_entry(DISCII_BANK_RAM , memregion("disc2mem" )->base() ); // RAM - membank("bank3")->set_entry(DISCII_BANK_ROM); -/*************************************************SPECIFIQUE DISK II ***************************/ - - // As video HR ram is in bank, use extern memory - m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); - - hector_init(); -} -/*****************************************************************************/ -MACHINE_START_MEMBER(hec2hrp_state,hec2mdhrx) -/*****************************************************************************/ -//minidisc -{ - UINT8 *RAM = memregion("maincpu" )->base(); // pointer to mess ram - - // Memory install for bank switching - membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000] ); // Mess ram - membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, m_hector_videoram_hrx); // Video ram - - // Set bank HECTOR_BANK_PROG as basic bank - membank("bank1")->set_entry(HECTOR_BANK_PROG); - //Here the bank 5 is not used for the language switch but for the floppy ROM..... - /******************************************************SPECIFIQUE Mini disque ***************************/ - membank("bank2")->configure_entry(HECTOR_BANK_BASE , &RAM[0x0000] ); // Rom base page - membank("bank2")->configure_entry(HECTOR_BANK_DISC , memregion("page2")->base() ); // Rom page mini disc - membank("bank2")->set_entry(HECTOR_BANK_BASE); - /******************************************************SPECIFIQUE Mini disque ***************************/ - - // As video HR ram is in bank, use extern memory - m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); - - hector_init(); -} -MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrx) -{ - //Hector Memory - membank("bank1")->set_entry(HECTOR_BANK_PROG); - membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); - //DISK II Memory - membank("bank3")->set_entry(DISCII_BANK_ROM); - - // Machines init - hector_reset(1, 1); - hector_disc2_reset(); -} -//minidisc -MACHINE_RESET_MEMBER(hec2hrp_state,hec2mdhrx) -{ - //Hector Memory - membank("bank1")->set_entry(HECTOR_BANK_PROG); - membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); - - // Machines init - hector_reset(1, 0); -} - -/***********************************************************/ -/********* mini disque interface ***************************/ -/***********************************************************/ - -FLOPPY_FORMATS_MEMBER( hec2hrp_state::minidisc_formats ) - FLOPPY_HMD_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( minidisc_floppies ) - SLOT_INTERFACE("dd", FLOPPY_35_DD) -SLOT_INTERFACE_END - - -/******************************************************************************/ -static MACHINE_CONFIG_START( hec2hr, hec2hrp_state ) -/******************************************************************************/ - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(hec2hrp_mem) - MCFG_CPU_IO_MAP(hec2hrp_io) - MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) /* put on the Z80 irq in Hz*/ - MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrp) - MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrp) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ - MCFG_SCREEN_SIZE(512, 230) - MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) - MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) - - MCFG_FRAGMENT_ADD(hector_audio) - - /* Gestion cassette*/ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(hector_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - -MACHINE_CONFIG_END - -/*****************************************************************************/ -static MACHINE_CONFIG_START( hec2hrp, hec2hrp_state ) -/*****************************************************************************/ - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(hec2hrp_mem) - MCFG_CPU_IO_MAP(hec2hrp_io) - MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) /* put on the Z80 irq in Hz*/ - MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrp) - MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrp) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ - MCFG_SCREEN_SIZE(512, 230) - MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) - MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) - - MCFG_FRAGMENT_ADD(hector_audio) - - /* Gestion cassette*/ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(hector_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - -MACHINE_CONFIG_END - -static SLOT_INTERFACE_START( hector_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -/*****************************************************************************/ -static MACHINE_CONFIG_START( hec2mx40, hec2hrp_state ) -/*****************************************************************************/ - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(hec2hrx_mem) - MCFG_CPU_IO_MAP(hec2mx40_io) - MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz - - /* Disc II unit */ - MCFG_CPU_ADD("disc2cpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(hecdisc2_mem) - MCFG_CPU_IO_MAP(hecdisc2_io) - MCFG_UPD765A_ADD("upd765", false, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_interrupt)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_dma_irq)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) - MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ - MCFG_SCREEN_SIZE(512, 230) - MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) - MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) - - MCFG_FRAGMENT_ADD(hector_audio) - - /* Gestion cassette*/ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(hector_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - -MACHINE_CONFIG_END -/*****************************************************************************/ -static MACHINE_CONFIG_START( hec2hrx, hec2hrp_state ) -/*****************************************************************************/ -/* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(hec2hrx_mem) - MCFG_CPU_IO_MAP(hec2hrx_io) - MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz - MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) - MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) - - /* Disc II unit */ - MCFG_CPU_ADD("disc2cpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(hecdisc2_mem) - MCFG_CPU_IO_MAP(hecdisc2_io) - MCFG_UPD765A_ADD("upd765", false, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_interrupt)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_dma_irq)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ - MCFG_SCREEN_SIZE(512, 230) - MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) - MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) - - MCFG_FRAGMENT_ADD(hector_audio) - - // Gestion cassette - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(hector_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - -MACHINE_CONFIG_END -/*****************************************************************************/ -static MACHINE_CONFIG_START( hec2mdhrx, hec2hrp_state ) -/*****************************************************************************/ -// minidisc -/* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(hec2hrx_mem) - MCFG_CPU_IO_MAP(hec2mdhrx_io) - MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz - MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2mdhrx) - MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2mdhrx) - - /* Mini Disc */ - MCFG_FD1793_ADD("wd179x", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("wd179x:0", minidisc_floppies, "dd", hec2hrp_state::minidisc_formats) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ - MCFG_SCREEN_SIZE(512, 230) - MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) - MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) - MCFG_SCREEN_PALETTE("palette") - - MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) - MCFG_PALETTE_ADD("palette", 16) - MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) - - MCFG_FRAGMENT_ADD(hector_audio) - - // Gestion cassette - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(hector_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - -MACHINE_CONFIG_END - -/*****************************************************************************/ -static MACHINE_CONFIG_START( hec2mx80, hec2hrp_state ) -/*****************************************************************************/ - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(hec2hrx_mem) - MCFG_CPU_IO_MAP(hec2mx80_io) - MCFG_CPU_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz - MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) - MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) - - /* Disc II unit */ - MCFG_CPU_ADD("disc2cpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(hecdisc2_mem) - MCFG_CPU_IO_MAP(hecdisc2_io) - MCFG_UPD765A_ADD("upd765", false, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_interrupt)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE(hec2hrp_state, disc2_fdc_dma_irq)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ - MCFG_SCREEN_SIZE(512, 230) - MCFG_SCREEN_VISIBLE_AREA(0, 243, 0, 227) - MCFG_SCREEN_UPDATE_DRIVER(hec2hrp_state, screen_update_hec2hrp) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_VIDEO_START_OVERRIDE(hec2hrp_state,hec2hrp) - - MCFG_FRAGMENT_ADD(hector_audio) - - /* Gestion cassette*/ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(hector_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - - MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( hec2hr ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "2hr.bin", 0x0000, 0x1000, CRC(84b9e672) SHA1(8c8b089166122eee565addaed10f84c5ce6d849b)) - ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) - ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( victor ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "victor.rom", 0x0000, 0x1000, CRC(d1e9508f) SHA1(d0f1bdcd39917fafc8859223ab38eee2a7dc85ff)) - ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) - ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( hec2hrp ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hector2hrp.rom", 0x0000, 0x4000, CRC(983f52e4) SHA1(71695941d689827356042ee52ffe55ce7e6b8ecd)) - ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) - ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) - ROM_REGION( 0x10000, "disc2cpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x04000, "rom_disc2", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( hec2hrx ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hector2hrx.rom", 0x0000, 0x4000, CRC(f047c521) SHA1(744336b2acc76acd7c245b562bdc96dca155b066)) - ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) - ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) - ROM_REGION( 0x10000, "disc2cpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x04000, "rom_disc2", ROMREGION_ERASEFF ) - ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) - ROM_REGION( 0x10000, "disc2mem", ROMREGION_ERASE00 ) -ROM_END -// minidisc -ROM_START( hec2mdhrx ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mdic1.bin" , 0x0000,0x2000, CRC(ddda1065) SHA1(e7bba14a72605238d2f8299da029b8320a563254)) - ROM_LOAD( "mdicmb.bin" , 0x2000,0x2000, CRC(d8090747) SHA1(f2925b68002307562e2ea5e36b740e5458f0f0eb)) - - ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) // Page 1 = unused page - ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) // Page 2 = minidisc page - ROM_LOAD( "mdic3.bin" , 0x0000,0x2000, CRC(87801816) SHA1(ddf441f40df014b237cdf17430d1989f3a452d04)) - ROM_LOAD( "mdicmb.bin" , 0x2000,0x2000, CRC(d8090747) SHA1(f2925b68002307562e2ea5e36b740e5458f0f0eb)) -ROM_END - -ROM_START( hec2mx80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mx80c_page0.rom" , 0x0000,0x4000, CRC(a75945cf) SHA1(542391e482271be0997b069cf13c8b5dae28feec)) - ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) - ROM_LOAD( "mx80c_page1.rom", 0x0000, 0x4000, CRC(4615f57c) SHA1(5de291bf3ae0320915133b99f1a088cb56c41658)) - ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) - ROM_LOAD( "mx80c_page2.rom" , 0x0000,0x4000, CRC(2d5d975e) SHA1(48307132e0f3fad0262859bb8142d108f694a436)) - - ROM_REGION( 0x04000, "rom_disc2", ROMREGION_ERASEFF ) - ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) - ROM_REGION( 0x10000, "disc2mem", ROMREGION_ERASE00 ) -ROM_END - -ROM_START( hec2mx40 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mx40c_page0.rom" , 0x0000,0x4000, CRC(9bb5566d) SHA1(0c8c2e396ec8eb995d2b621abe06b6968ca5d0aa)) - ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) - ROM_LOAD( "mx40c_page1.rom", 0x0000, 0x4000, CRC(192a76fa) SHA1(062aa6df0b554b85774d4b5edeea8496a4baca35)) - ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) - ROM_LOAD( "mx40c_page2.rom" , 0x0000,0x4000, CRC(ef1b2654) SHA1(66624ea040cb7ede4720ad2eca0738d0d3bad89a)) - - ROM_REGION( 0x04000, "rom_disc2", ROMREGION_ERASEFF ) -// ROM_LOAD( "d360k.bin" , 0x0000,0x4000, CRC(2454eacb) SHA1(dc0d5a7d5891a7e422d9d142a2419527bb15dfd5)) - ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) -// ROM_LOAD( "d200k.bin" , 0x0000,0x4000, CRC(e2801377) SHA1(0926df5b417ecd8013e35c71b76780c5a25c1cbf)) - ROM_REGION( 0x10000, "disc2mem", ROMREGION_ERASE00 ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP(1983, hec2hrp, 0, interact, hec2hrp, hec2hrp, driver_device,0, "Micronique", "Hector 2HR+", MACHINE_IMPERFECT_SOUND) -COMP(1980, victor, hec2hrp, 0, hec2hrp, hec2hrp, driver_device,0, "Micronique", "Victor", MACHINE_IMPERFECT_SOUND) -COMP(1983, hec2hr, hec2hrp, 0, hec2hr, hec2hrp, driver_device,0, "Micronique", "Hector 2HR", MACHINE_IMPERFECT_SOUND) -COMP(1984, hec2hrx, hec2hrp, 0, hec2hrx, hec2hrp, driver_device,0, "Micronique", "Hector HRX + Disc2", MACHINE_IMPERFECT_SOUND) -COMP(1985, hec2mdhrx, hec2hrp, 0, hec2mdhrx, hec2hrp, driver_device,0, "Micronique", "Hector HRX + mini Disc" , MACHINE_IMPERFECT_SOUND) -COMP(1985, hec2mx80, hec2hrp, 0, hec2mx80, hec2hrp, driver_device,0, "Micronique", "Hector MX 80c + Disc2" , MACHINE_IMPERFECT_SOUND) -COMP(1985, hec2mx40, hec2hrp, 0, hec2mx40, hec2hrp, driver_device,0, "Micronique", "Hector MX 40c + Disc2" , MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/hh_cop400.c b/src/mess/drivers/hh_cop400.c deleted file mode 100644 index 3400b2d9ab5..00000000000 --- a/src/mess/drivers/hh_cop400.c +++ /dev/null @@ -1,841 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Sean Riddle -/*************************************************************************** - - National Semiconductor COP400 MCU handhelds or other simple devices, - mostly LED electronic games/toys. - - TODO: - - non-working games are due to MCU emulation bugs? - - better not start on visually dumped games before other games are working - (due to possible dump errors, hard to distinguish between that or MCU bug) - -***************************************************************************/ - -#include "emu.h" -#include "cpu/cop400/cop400.h" -#include "sound/speaker.h" - -// internal artwork -#include "einvaderc.lh" // test-layout(but still playable) -#include "funjacks.lh" -#include "funrlgl.lh" -#include "lightfgt.lh" // clickable - -//#include "hh_cop400_test.lh" // common test-layout - use external artwork - - -class hh_cop400_state : public driver_device -{ -public: - hh_cop400_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_inp_matrix(*this, "IN"), - m_speaker(*this, "speaker"), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) - { } - - // devices - required_device m_maincpu; - optional_ioport_array<5> m_inp_matrix; // max 5 - optional_device m_speaker; - - // misc common - UINT8 m_l; // MCU port L write data - UINT8 m_g; // MCU port G write data - UINT8 m_d; // MCU port D write data - int m_so; // MCU SO line state - int m_sk; // MCU SK line state - UINT16 m_inp_mux; // multiplexed inputs mask - - UINT8 read_inputs(int columns); - - // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) - - UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - UINT32 m_display_cache[0x20]; // (internal use) - UINT8 m_display_decay[0x20][0x20]; // (internal use) - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - -protected: - virtual void machine_start(); - virtual void machine_reset(); -}; - - -// machine start/reset - -void hh_cop400_state::machine_start() -{ - // zerofill - memset(m_display_state, 0, sizeof(m_display_state)); - memset(m_display_cache, ~0, sizeof(m_display_cache)); - memset(m_display_decay, 0, sizeof(m_display_decay)); - memset(m_display_segmask, 0, sizeof(m_display_segmask)); - - m_l = 0; - m_g = 0; - m_d = 0; - m_so = 0; - m_sk = 0; - m_inp_mux = 0; - - // register for savestates - save_item(NAME(m_display_maxy)); - save_item(NAME(m_display_maxx)); - save_item(NAME(m_display_wait)); - - save_item(NAME(m_display_state)); - /* save_item(NAME(m_display_cache)); */ // don't save! - save_item(NAME(m_display_decay)); - save_item(NAME(m_display_segmask)); - - save_item(NAME(m_l)); - save_item(NAME(m_g)); - save_item(NAME(m_d)); - save_item(NAME(m_so)); - save_item(NAME(m_sk)); - save_item(NAME(m_inp_mux)); -} - -void hh_cop400_state::machine_reset() -{ -} - - - -/*************************************************************************** - - Helper Functions - -***************************************************************************/ - -// The device may strobe the outputs very fast, it is unnoticeable to the user. -// To prevent flickering here, we need to simulate a decay. - -void hh_cop400_state::display_update() -{ - UINT32 active_state[0x20]; - - for (int y = 0; y < m_display_maxy; y++) - { - active_state[y] = 0; - - for (int x = 0; x <= m_display_maxx; x++) - { - // turn on powered segments - if (m_display_state[y] >> x & 1) - m_display_decay[y][x] = m_display_wait; - - // determine active state - UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; - active_state[y] |= (ds << x); - } - } - - // on difference, send to output - for (int y = 0; y < m_display_maxy; y++) - if (m_display_cache[y] != active_state[y]) - { - if (m_display_segmask[y] != 0) - output_set_digit_value(y, active_state[y] & m_display_segmask[y]); - - const int mul = (m_display_maxx <= 10) ? 10 : 100; - for (int x = 0; x <= m_display_maxx; x++) - { - int state = active_state[y] >> x & 1; - char buf1[0x10]; // lampyx - char buf2[0x10]; // y.x - - if (x == m_display_maxx) - { - // always-on if selected - sprintf(buf1, "lamp%da", y); - sprintf(buf2, "%d.a", y); - } - else - { - sprintf(buf1, "lamp%d", y * mul + x); - sprintf(buf2, "%d.%d", y, x); - } - output_set_value(buf1, state); - output_set_value(buf2, state); - } - } - - memcpy(m_display_cache, active_state, sizeof(m_display_cache)); -} - -TIMER_DEVICE_CALLBACK_MEMBER(hh_cop400_state::display_decay_tick) -{ - // slowly turn off unpowered segments - for (int y = 0; y < m_display_maxy; y++) - for (int x = 0; x <= m_display_maxx; x++) - if (m_display_decay[y][x] != 0) - m_display_decay[y][x]--; - - display_update(); -} - -void hh_cop400_state::set_display_size(int maxx, int maxy) -{ - m_display_maxx = maxx; - m_display_maxy = maxy; -} - -void hh_cop400_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) -{ - set_display_size(maxx, maxy); - - // update current state - UINT32 mask = (1 << maxx) - 1; - for (int y = 0; y < maxy; y++) - m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; - - display_update(); -} - - -UINT8 hh_cop400_state::read_inputs(int columns) -{ - // active low - UINT8 ret = 0xff; - - // read selected input rows - for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) - ret &= m_inp_matrix[i]->read(); - - return ret; -} - - - -/*************************************************************************** - - Minidrivers (subclass, I/O, Inputs, Machine Config) - -***************************************************************************/ - -/*************************************************************************** - - Castle Toy Einstein - * COP421 MCU labeled ~/927 COP421-NEZ/N - * 4 lamps, 1bit sound - -***************************************************************************/ - -class ctstein_state : public hh_cop400_state -{ -public: - ctstein_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag) - { } -}; - -// handlers - -//.. - - -// config - -static INPUT_PORTS_START( ctstein ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ctstein, ctstein_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP421, 1000000) // approximation - RC osc. R=12K to +6V, C=100pf to GND - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) -// MCFG_DEFAULT_LAYOUT(layout_ctstein) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex Space Invader - * COP444L MCU labeled /B138 COPL444-HRZ/N INV II (die labeled HRZ COP 444L/A) - * 3 7seg LEDs, LED matrix and overlay mask, 1bit sound - - The first version was on TMS1100 (see hh_tms1k.c), this is the reprogrammed - second release with a gray case instead of black. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class einvaderc_state : public hh_cop400_state -{ -public: - einvaderc_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(write_d); - DECLARE_WRITE8_MEMBER(write_g); - DECLARE_WRITE_LINE_MEMBER(write_sk); - DECLARE_WRITE_LINE_MEMBER(write_so); - DECLARE_WRITE8_MEMBER(write_l); -}; - -// handlers - -void einvaderc_state::prepare_display() -{ - // D0-D2 are 7segs - for (int y = 0; y < 3; y++) - m_display_segmask[y] = 0x7f; - - // update display - UINT8 l = BITSWAP8(m_l,7,6,0,1,2,3,4,5); - UINT16 grid = (m_d | m_g << 4 | m_sk << 8 | m_so << 9) ^ 0x0ff; - display_matrix(8, 10, l, grid); -} - -WRITE8_MEMBER(einvaderc_state::write_d) -{ - // D: led grid 0-3 - m_d = data; - prepare_display(); -} - -WRITE8_MEMBER(einvaderc_state::write_g) -{ - // G: led grid 4-7 - m_g = data; - prepare_display(); -} - -WRITE_LINE_MEMBER(einvaderc_state::write_sk) -{ - // SK: speaker out + led grid 8 - m_speaker->level_w(state); - m_sk = state; - prepare_display(); -} - -WRITE_LINE_MEMBER(einvaderc_state::write_so) -{ - // SO: led grid 9 - m_so = state; - prepare_display(); -} - -WRITE8_MEMBER(einvaderc_state::write_l) -{ - // L: led state/segment - m_l = data; - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( einvaderc ) - PORT_START("IN.0") // port IN - PORT_CONFNAME( 0x01, 0x01, DEF_STR( Difficulty ) ) - PORT_CONFSETTING( 0x01, "Amateur" ) - PORT_CONFSETTING( 0x00, "Professional" ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( einvaderc, einvaderc_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP444, 1000000) // approximation - RC osc. R=47K to +9V, C=100pf to GND(-9V) - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed - MCFG_COP400_READ_IN_CB(IOPORT("IN.0")) - MCFG_COP400_WRITE_D_CB(WRITE8(einvaderc_state, write_d)) - MCFG_COP400_WRITE_G_CB(WRITE8(einvaderc_state, write_g)) - MCFG_COP400_WRITE_SK_CB(WRITELINE(einvaderc_state, write_sk)) - MCFG_COP400_WRITE_SO_CB(WRITELINE(einvaderc_state, write_so)) - MCFG_COP400_WRITE_L_CB(WRITE8(einvaderc_state, write_l)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_einvaderc) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Mattel Funtronics Jacks - * COP410L MCU bonded directly to PCB (die labeled COP410L/B NGS) - * 8 LEDs, 1bit sound - -***************************************************************************/ - -class funjacks_state : public hh_cop400_state -{ -public: - funjacks_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(write_d); - DECLARE_WRITE8_MEMBER(write_l); - DECLARE_WRITE8_MEMBER(write_g); - DECLARE_READ8_MEMBER(read_l); - DECLARE_READ8_MEMBER(read_g); -}; - -// handlers - -WRITE8_MEMBER(funjacks_state::write_d) -{ - // D: led grid + input mux - m_d = m_inp_mux = data ^ 0xf; - display_matrix(2, 4, m_l, m_d); -} - -WRITE8_MEMBER(funjacks_state::write_l) -{ - // L0,L1: led state - m_l = data & 3; - display_matrix(2, 4, m_l, m_d); -} - -WRITE8_MEMBER(funjacks_state::write_g) -{ - // G1: speaker out - m_speaker->level_w(data >> 1 & 1); - m_g = data; -} - -READ8_MEMBER(funjacks_state::read_l) -{ - // L4,L5: multiplexed inputs - return read_inputs(3) & 0x30; -} - -READ8_MEMBER(funjacks_state::read_g) -{ - // G1: speaker out state - // G2,G3: inputs - return m_inp_matrix[3]->read() | (m_g & 2); -} - - -// config - -static INPUT_PORTS_START( funjacks ) - PORT_START("IN.0") // D0 port G - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) - - PORT_START("IN.1") // D1 port G - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) - - PORT_START("IN.2") // D2 port G - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) // positioned at 1 o'clock on panel, increment clockwise - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) - - PORT_START("IN.3") // port G - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) // speaker - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START ) - PORT_CONFNAME( 0x08, 0x00, "Players" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x08, "2" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( funjacks, funjacks_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP410, 2000000) // approximation - RC osc. R=47K, C=56pf - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED) // guessed - MCFG_COP400_WRITE_D_CB(WRITE8(funjacks_state, write_d)) - MCFG_COP400_WRITE_L_CB(WRITE8(funjacks_state, write_l)) - MCFG_COP400_WRITE_G_CB(WRITE8(funjacks_state, write_g)) - MCFG_COP400_READ_L_CB(READ8(funjacks_state, read_l)) - MCFG_COP400_READ_G_CB(READ8(funjacks_state, read_g)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_funjacks) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Mattel Funtronics Red Light Green Light - * COP410L MCU bonded directly to PCB (die labeled COP410L/B NHZ) - * 14 LEDs, 1bit sound - - known releases: - - USA: Funtronics Red Light Green Light - - USA(rerelease): Funtronics Hot Wheels Drag Race - -***************************************************************************/ - -class funrlgl_state : public hh_cop400_state -{ -public: - funrlgl_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(write_d); - DECLARE_WRITE8_MEMBER(write_l); - DECLARE_WRITE8_MEMBER(write_g); - DECLARE_READ8_MEMBER(read_g); - - DECLARE_INPUT_CHANGED_MEMBER(reset_button); -}; - -// handlers - -WRITE8_MEMBER(funrlgl_state::write_d) -{ - // D: led grid - m_d = data ^ 0xf; - display_matrix(4, 4, m_l, m_d); -} - -WRITE8_MEMBER(funrlgl_state::write_l) -{ - // L0-L3: led state - // L4-L7: N/C - m_l = data & 0xf; - display_matrix(4, 4, m_l, m_d); -} - -WRITE8_MEMBER(funrlgl_state::write_g) -{ - // G3: speaker out - m_speaker->level_w(data >> 3 & 1); -} - - -// config - -static INPUT_PORTS_START( funrlgl ) - PORT_START("IN.0") // port G - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_CONFNAME( 0x04, 0x04, DEF_STR( Difficulty ) ) - PORT_CONFSETTING( 0x04, "1" ) - PORT_CONFSETTING( 0x00, "2" ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("IN.1") // fake - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, funrlgl_state, reset_button, NULL) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(funrlgl_state::reset_button) -{ - // middle button is directly tied to MCU reset pin - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); -} - - -static MACHINE_CONFIG_START( funrlgl, funrlgl_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP410, 2000000) // approximation - RC osc. R=51K, C=91pf - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED) // guessed - MCFG_COP400_WRITE_D_CB(WRITE8(funrlgl_state, write_d)) - MCFG_COP400_WRITE_L_CB(WRITE8(funrlgl_state, write_l)) - MCFG_COP400_WRITE_G_CB(WRITE8(funrlgl_state, write_g)) - MCFG_COP400_READ_G_CB(IOPORT("IN.0")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_funrlgl) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Milton Bradley Plus One - * COP410L MCU in 8-pin DIP, labeled ~/029 MM 57405 (die labeled COP410L/B NNE) - * 4 sensors(1 on each die side), 1bit sound - -***************************************************************************/ - -class plus1_state : public hh_cop400_state -{ -public: - plus1_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag) - { } -}; - -// handlers - -//.. - - -// config - -static INPUT_PORTS_START( plus1 ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( plus1, plus1_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP410, 1000000) // approximation - RC osc. R=51K to +5V, C=100pf to GND - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED) // guessed - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) -// MCFG_DEFAULT_LAYOUT(layout_plus1) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Milton Bradley (Electronic) Lightfight - * COP421L MCU labeled /B119 COP421L-HLA/N - * LED matrix, 1bit sound - - Xbox-shaped electronic game for 2 or more players, with long diagonal buttons - next to each outer LED. The main object of the game is to pinpoint a light - by pressing 2 buttons. To start, press a skill-level button(P2 button 7/8/9) - after selecting a game mode(P1 button 6-10). - - The game variations are: - 1: LightFight - 2: NightFight - 3: RiteSite - 4: QuiteBrite - 5: RightLight - -***************************************************************************/ - -class lightfgt_state : public hh_cop400_state -{ -public: - lightfgt_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_cop400_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE_LINE_MEMBER(write_so); - DECLARE_WRITE8_MEMBER(write_d); - DECLARE_WRITE8_MEMBER(write_l); - DECLARE_WRITE_LINE_MEMBER(write_sk); - DECLARE_READ8_MEMBER(read_g); -}; - -// handlers - -void lightfgt_state::prepare_display() -{ - UINT8 grid = (m_so | m_d << 1) ^ 0x1f; - display_matrix(5, 5, m_l, grid); -} - -WRITE_LINE_MEMBER(lightfgt_state::write_so) -{ - // SO: led grid 0 (and input mux) - m_so = state; - prepare_display(); -} - -WRITE8_MEMBER(lightfgt_state::write_d) -{ - // D: led grid 1-4 (and input mux) - m_d = data; - prepare_display(); -} - -WRITE8_MEMBER(lightfgt_state::write_l) -{ - // L0-L4: led state - // L5-L7: N/C - m_l = data & 0x1f; - prepare_display(); -} - -WRITE_LINE_MEMBER(lightfgt_state::write_sk) -{ - // SK: speaker out - m_speaker->level_w(state); -} - -READ8_MEMBER(lightfgt_state::read_g) -{ - // G: multiplexed inputs - m_inp_mux = (m_so | m_d << 1) ^ 0x1f; - return read_inputs(5); -} - - -// config - -static INPUT_PORTS_START( lightfgt ) - PORT_START("IN.0") // SO port G - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) // note: button 1 is on the left side from player perspective - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_COCKTAIL - - PORT_START("IN.1") // D0 port G - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_COCKTAIL - - PORT_START("IN.2") // D1 port G - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_COCKTAIL - - PORT_START("IN.3") // D2 port G - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON9 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_COCKTAIL - - PORT_START("IN.4") // D3 port G - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON10 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_COCKTAIL -INPUT_PORTS_END - -static MACHINE_CONFIG_START( lightfgt, lightfgt_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", COP421, 950000) // approximation - RC osc. R=82K to +6V, C=56pf to GND(-6V) - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed - MCFG_COP400_WRITE_SO_CB(WRITELINE(lightfgt_state, write_so)) - MCFG_COP400_WRITE_D_CB(WRITE8(lightfgt_state, write_d)) - MCFG_COP400_WRITE_L_CB(WRITE8(lightfgt_state, write_l)) - MCFG_COP400_WRITE_SK_CB(WRITELINE(lightfgt_state, write_sk)) - MCFG_COP400_READ_G_CB(READ8(lightfgt_state, read_g)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_cop400_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_lightfgt) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( ctstein ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "cop421-nez_n", 0x0000, 0x0400, CRC(16148e03) SHA1(b2b74891d36813d9a1eefd56a925054997c4b7f7) ) // 2nd half empty -ROM_END - - -ROM_START( einvaderc ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "copl444-hrz_n_inv_ii", 0x0000, 0x0800, CRC(76400f38) SHA1(0e92ab0517f7b7687293b189d30d57110df20fe0) ) -ROM_END - - -ROM_START( funjacks ) - ROM_REGION( 0x0200, "maincpu", 0 ) - ROM_LOAD( "cop410l_b_ngs", 0x0000, 0x0200, CRC(863368ea) SHA1(f116cc27ae721b3a3e178fa13765808bdc275663) ) -ROM_END - - -ROM_START( funrlgl ) - ROM_REGION( 0x0200, "maincpu", 0 ) - ROM_LOAD( "cop410l_b_nhz", 0x0000, 0x0200, CRC(4065c3ce) SHA1(f0bc8125d922949e0d7ab1ba89c805a836d20e09) ) -ROM_END - - -ROM_START( plus1 ) - ROM_REGION( 0x0200, "maincpu", 0 ) - ROM_LOAD( "cop410l_b_nne", 0x0000, 0x0200, BAD_DUMP CRC(8626fdb8) SHA1(fd241b6dde0e4e86b439cb2c5bb3a82fb257d7e1) ) // still need to verify -ROM_END - - -ROM_START( lightfgt ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "cop421l-hla_n", 0x0000, 0x0400, CRC(aceb2d65) SHA1(2328cbb195faf93c575f3afa3a1fe0079180edd7) ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -CONS( 1979, ctstein, 0, 0, ctstein, ctstein, driver_device, 0, "Castle Toy", "Einstein (Castle Toy)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) - -CONS( 1981, einvaderc, einvader, 0, einvaderc, einvaderc, driver_device, 0, "Entex", "Space Invader (Entex, COP444)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) - -CONS( 1979, funjacks, 0, 0, funjacks, funjacks, driver_device, 0, "Mattel", "Funtronics Jacks", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -CONS( 1979, funrlgl, 0, 0, funrlgl, funrlgl, driver_device, 0, "Mattel", "Funtronics Red Light Green Light", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) - -CONS( 1980, plus1, 0, 0, plus1, plus1, driver_device, 0, "Milton Bradley", "Plus One", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -CONS( 1981, lightfgt, 0, 0, lightfgt, lightfgt, driver_device, 0, "Milton Bradley", "Lightfight", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/hh_hmcs40.c b/src/mess/drivers/hh_hmcs40.c deleted file mode 100644 index 765c453ce13..00000000000 --- a/src/mess/drivers/hh_hmcs40.c +++ /dev/null @@ -1,4178 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Kevin Horton -/*************************************************************************** - - Hitachi HMCS40 MCU tabletops/handhelds or other simple devices, - most of them are VFD electronic games/toys. - - known chips: - - serial device etc. ----------------------------------------------------------------- - @07 HD38750A 1979, Bambino Knock-Em Out Boxing (ET-06B) - @08 HD38750A 1979, Bambino Dribble Away Basketball (ET-05) - @45 HD38750A 1981, VTech Invaders - *56 HD38750A 1981, Actronics(Hanzawa) Twinvader (small brown version) - *58 HD38750A 1981, Actronics(Hanzawa) Challenge Racer/Ludotronic(Hanzawa) Grand Prix Turbo - *62 HD38750A 1982, Actronics(Hanzawa) Pack'n Maze - - @04 HD38800A 1980, Gakken Heiankyo Alien - @25 HD38800A 1981, Coleco Alien Attack - @27 HD38800A 1981, Bandai Packri Monster - *31 HD38800A 1981, Entex Select-a-Game cartridge: Space Invader 2 (have dump) - *37 HD38800A 1981, Entex Select-a-Game cartridge: Baseball 4 (have dump) - *38 HD38800A 1981, Entex Select-a-Game cartridge: Pinball (have dump) - *41 HD38800A 1982, Gakken Puck Monster - *51 HD38800A 1981, Actronics(Hanzawa) Twinvader (larger white version) - @70 HD38800A 1982, Coleco Galaxian - @73 HD38800A 1982, Bandai(Mattel) Star Hawk (PT-317B) - @77 HD38800A 1982, Bandai Frisky Tom (PT-327A) - @88 HD38800A 1984, Tomy Tron (THN-02) - - @01 HD38800B 1982, Gakken Crazy Kong - @19 HD38800B 1982, Bandai Zaxxon - @23 HD38800B 1982, Tomy Kingman (THF-01II) - *24 HD38800B 1982, Actronics(Hanzawa) Wanted G-Man - *29 HD38800B 1984, Tomy Portable 6000 Bombman - *35 HD38800B 1983, Bandai Gundam vs Gelgoog Zaku - @43 HD38800B 1983, Bandai Dokodemo Dorayaki Doraemon (PT-412) - @52 HD38800B 1983, Bandai Ultra Man (PT-424) - - @09 HD38820A 1980, Mattel World Championship Baseball - @13 HD38820A 1981, Entex Galaxian 2 - @23 HD38820A 1981, Entex Pac Man 2 - @28 HD38820A 1981, Coleco Pac-Man (ver 1) - @29 HD38820A 1981, Coleco Pac-Man (ver 2) - *32 HD38820A 198?, Gakken Super Cobra - *38 HD38820A 1982, Entex Crazy Climber - @42 HD38820A 1982, Entex Stargate - @43 HD38820A 1982, Entex Turtles - @45 HD38820A 1982, Coleco Donkey Kong - @49 HD38820A 1983, Bandai Zackman - @61 HD38820A 1983, Coleco Ms. Pac-Man - @63 HD38820A 1983, Bandai Pengo - @65 HD38820A 1983, Bandai Burger Time (PT-389) - @69 HD38820A 1983, Gakken Dig Dug - @70 HD38820A 1983, Parker Brothers Q*Bert - @85 HD38820A 1984, Bandai Machine Man (PT-438) - @88 HD38820A 1984, Bandai Pair Match (PT-460) (1/2) - @89 HD38820A 1984, Bandai Pair Match (PT-460) (2/2) - - *75 HD44801A 1982, Alpha 8201 protection MCU (have dump) - - *35 HD44801B 1983, Alpha 8302 protection MCU (have dump) - *42 HD44801B 1984, Alpha 8303 protection MCU (have dump) - - (* denotes not yet emulated by MAME, @ denotes it's in this driver) - - - TODO: - - cdkong discrete sound (simple volume decay, simulated for now) - - cgalaxn discrete sound (alien attacking sound effect) - - gckong random lockups (tap the jump button repeatedly): mcu stack overflow, - works ok if stack levels is increased, 38800 B rev. has more stack levels? - Or it could be a race condition: irq happening too late/early. - - epacman booting the game in demo mode, pacman should go straight to the - upper-left power pill: mcu cycle/interrupt timing related - - Though very uncommon when compared to games with LED/lamp display, - some games may manipulate VFD plate brightness by strobing it longer, - eg. cgalaxn when the player ship explodes. - -***************************************************************************/ - -#include "emu.h" -#include "cpu/hmcs40/hmcs40.h" -#include "cpu/cop400/cop400.h" -#include "sound/speaker.h" - -// internal artwork -#include "pairmtch.lh" - -#include "hh_hmcs40_test.lh" // common test-layout - use external artwork - - -class hh_hmcs40_state : public driver_device -{ -public: - hh_hmcs40_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_inp_matrix(*this, "IN"), - m_speaker(*this, "speaker"), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) - { } - - // devices - required_device m_maincpu; - optional_device m_audiocpu; - optional_ioport_array<7> m_inp_matrix; // max 7 - optional_device m_speaker; - - // misc common - UINT8 m_r[8]; // MCU R ports write data (optional) - UINT16 m_d; // MCU D port write data (optional) - UINT8 m_int[2]; // MCU INT0/1 pins state - UINT16 m_inp_mux; // multiplexed inputs mask - - UINT16 read_inputs(int columns); - void refresh_interrupts(void); - void set_interrupt(int line, int state); - DECLARE_INPUT_CHANGED_MEMBER(single_interrupt_line); - - // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 47 for now) - - UINT32 m_grid; // VFD current row data - UINT64 m_plate; // VFD current column data - - UINT64 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - UINT64 m_display_cache[0x20]; // (internal use) - UINT8 m_display_decay[0x20][0x40]; // (internal use) - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety); - -protected: - virtual void machine_start(); - virtual void machine_reset(); -}; - - -// machine start/reset - -void hh_hmcs40_state::machine_start() -{ - // zerofill - memset(m_display_state, 0, sizeof(m_display_state)); - memset(m_display_cache, ~0, sizeof(m_display_cache)); - memset(m_display_decay, 0, sizeof(m_display_decay)); - memset(m_display_segmask, 0, sizeof(m_display_segmask)); - - memset(m_r, 0, sizeof(m_r)); - memset(m_int, 0, sizeof(m_int)); - m_d = 0; - m_inp_mux = 0; - m_grid = 0; - m_plate = 0; - - // register for savestates - save_item(NAME(m_display_maxy)); - save_item(NAME(m_display_maxx)); - save_item(NAME(m_display_wait)); - - save_item(NAME(m_display_state)); - /* save_item(NAME(m_display_cache)); */ // don't save! - save_item(NAME(m_display_decay)); - save_item(NAME(m_display_segmask)); - - save_item(NAME(m_r)); - save_item(NAME(m_int)); - save_item(NAME(m_d)); - save_item(NAME(m_inp_mux)); - save_item(NAME(m_grid)); - save_item(NAME(m_plate)); -} - -void hh_hmcs40_state::machine_reset() -{ - refresh_interrupts(); -} - - - -/*************************************************************************** - - Helper Functions - -***************************************************************************/ - -// The device may strobe the outputs very fast, it is unnoticeable to the user. -// To prevent flickering here, we need to simulate a decay. - -void hh_hmcs40_state::display_update() -{ - UINT64 active_state[0x20]; - - for (int y = 0; y < m_display_maxy; y++) - { - active_state[y] = 0; - - for (int x = 0; x <= m_display_maxx; x++) - { - // turn on powered segments - if (m_display_state[y] >> x & 1) - m_display_decay[y][x] = m_display_wait; - - // determine active state - UINT64 ds = (m_display_decay[y][x] != 0) ? 1 : 0; - active_state[y] |= (ds << x); - } - } - - // on difference, send to output - for (int y = 0; y < m_display_maxy; y++) - if (m_display_cache[y] != active_state[y]) - { - if (m_display_segmask[y] != 0) - output_set_digit_value(y, active_state[y] & m_display_segmask[y]); - - const int mul = (m_display_maxx <= 10) ? 10 : 100; - for (int x = 0; x <= m_display_maxx; x++) - { - int state = active_state[y] >> x & 1; - char buf1[0x10]; // lampyx - char buf2[0x10]; // y.x - - if (x == m_display_maxx) - { - // always-on if selected - sprintf(buf1, "lamp%da", y); - sprintf(buf2, "%d.a", y); - } - else - { - sprintf(buf1, "lamp%d", y * mul + x); - sprintf(buf2, "%d.%d", y, x); - } - output_set_value(buf1, state); - output_set_value(buf2, state); - } - } - - memcpy(m_display_cache, active_state, sizeof(m_display_cache)); -} - -TIMER_DEVICE_CALLBACK_MEMBER(hh_hmcs40_state::display_decay_tick) -{ - // slowly turn off unpowered segments - for (int y = 0; y < m_display_maxy; y++) - for (int x = 0; x <= m_display_maxx; x++) - if (m_display_decay[y][x] != 0) - m_display_decay[y][x]--; - - display_update(); -} - -void hh_hmcs40_state::set_display_size(int maxx, int maxy) -{ - m_display_maxx = maxx; - m_display_maxy = maxy; -} - -void hh_hmcs40_state::display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety) -{ - set_display_size(maxx, maxy); - - // update current state - UINT64 mask = (U64(1) << maxx) - 1; - for (int y = 0; y < maxy; y++) - m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (U64(1) << maxx)) : 0; - - display_update(); -} - - -UINT16 hh_hmcs40_state::read_inputs(int columns) -{ - UINT16 ret = 0; - - // read selected input rows - for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) - ret |= m_inp_matrix[i]->read(); - - return ret; -} - - -// interrupt handling - -void hh_hmcs40_state::refresh_interrupts() -{ - for (int i = 0; i < 2; i++) - m_maincpu->set_input_line(i, m_int[i] ? ASSERT_LINE : CLEAR_LINE); -} - -void hh_hmcs40_state::set_interrupt(int line, int state) -{ - line = line ? 1 : 0; - state = state ? 1 : 0; - - if (state != m_int[line]) - { - if (machine().phase() >= MACHINE_PHASE_RESET) - m_maincpu->set_input_line(line, state ? ASSERT_LINE : CLEAR_LINE); - m_int[line] = state; - } -} - -INPUT_CHANGED_MEMBER(hh_hmcs40_state::single_interrupt_line) -{ - set_interrupt((int)(FPTR)param, newval); -} - - - -/*************************************************************************** - - Minidrivers (subclass, I/O, Inputs, Machine Config) - -***************************************************************************/ - -/*************************************************************************** - - Bambino Dribble Away Basketball (manufactured in Japan) - * PCBs are labeled Emix Corp. ET-05 - * Hitachi HD38750A08 MCU - * green VFD display Emix-106, with bezel overlay - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bambball_state : public hh_hmcs40_state -{ -public: - bambball_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ8_MEMBER(input_r); -}; - -// handlers - -WRITE8_MEMBER(bambball_state::plate_w) -{ - // R1x-R3x(,D0-D3): vfd matrix plate - int shift = (offset - HMCS40_PORT_R1X) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT16 plate = BITSWAP16(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2); - display_matrix(16, 9, plate, m_grid); -} - -WRITE16_MEMBER(bambball_state::grid_w) -{ - // D4: speaker out - m_speaker->level_w(data >> 4 & 1); - - // D7-D10: input mux - m_inp_mux = data >> 7 & 0xf; - - // D7-D15: vfd matrix grid - m_grid = data >> 7 & 0x1ff; - - // D0-D3: more plates (update display there) - plate_w(space, 3 + HMCS40_PORT_R1X, data & 0xf); -} - -READ8_MEMBER(bambball_state::input_r) -{ - // R0x: multiplexed inputs - return read_inputs(4); -} - - -// config - -static INPUT_PORTS_START( bambball ) - PORT_START("IN.0") // D7 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Dribble Low") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Dribble Medium") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Dribble High") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Shoot") - - PORT_START("IN.1") // D8 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // D9 port R0x - PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Display") - - PORT_START("IN.3") // D10 port R0x - PORT_CONFNAME( 0x07, 0x01, "Skill Level") - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFSETTING( 0x04, "3" ) - PORT_CONFNAME( 0x08, 0x08, "Players" ) - PORT_CONFSETTING( 0x08, "1" ) - PORT_CONFSETTING( 0x00, "2" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( bambball, bambball_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38750, 400000) // approximation - MCFG_HMCS40_READ_R_CB(0, READ8(bambball_state, input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bambball_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bambball_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bambball_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(bambball_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bambino Knock-Em Out Boxing - * PCBs are labeled Emix Corp. ET-06B - * Hitachi HD38750A07 MCU - * cyan VFD display Emix-103, with blue or green color overlay - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bmboxing_state : public hh_hmcs40_state -{ -public: - bmboxing_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ8_MEMBER(input_r); -}; - -// handlers - -void bmboxing_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); - UINT32 plate = BITSWAP16(m_plate,15,14,13,12,1,2,0,3,11,4,10,7,5,6,9,8); - display_matrix(12, 9, plate, grid); -} - -WRITE8_MEMBER(bmboxing_state::plate_w) -{ - // R1x-R3x: vfd matrix plate - int shift = (offset - HMCS40_PORT_R1X) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(bmboxing_state::grid_w) -{ - // D13: speaker out - m_speaker->level_w(data >> 13 & 1); - - // D9-D12: input mux - m_inp_mux = data >> 9 & 0xf; - - // D4-D12: vfd matrix grid - m_grid = data >> 4 & 0x1ff; - prepare_display(); -} - -READ8_MEMBER(bmboxing_state::input_r) -{ - // R0x: multiplexed inputs - return read_inputs(4); -} - - -// config - -/* physical button layout and labels is like this: - - * left = P2 side * * right = P1 side * - - [ BACK ] [ HIGH ] (players sw) [ HIGH ] [ BACK ] - 1<--->2 [START/ - [NORMAL] [MEDIUM] RESET] [MEDIUM] [NORMAL] - 1<---OFF--->2 - [ DUCK ] [ LOW ] (skill lvl sw) [ LOW ] [ DUCK ] -*/ - -static INPUT_PORTS_START( bmboxing ) - PORT_START("IN.0") // D9 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("P1 Punch High") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P1 Punch Medium") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("P1 Punch Low") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // D10 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("P1 Position Normal") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("P1 Position Back") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("P1 Position Ducking") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // D11 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("P2 Punch High") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 Punch Medium") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("P2 Punch Low") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // D12 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 Position Normal") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("P2 Position Back") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("P2 Position Ducking") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // port D - PORT_CONFNAME( 0x0001, 0x0000, "Players" ) - PORT_CONFSETTING( 0x0000, "1" ) - PORT_CONFSETTING( 0x0001, "2" ) - PORT_CONFNAME( 0x0002, 0x0000, "Skill Level" ) - PORT_CONFSETTING( 0x0000, "1" ) - PORT_CONFSETTING( 0x0002, "2" ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0xfff8, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( bmboxing, bmboxing_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38750, 400000) // approximation - MCFG_HMCS40_READ_R_CB(0, READ8(bmboxing_state, input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bmboxing_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bmboxing_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bmboxing_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(bmboxing_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.4")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Frisky Tom (manufactured in Japan) - * PCBs are labeled Kaken Corp., PT-327A - * Hitachi HD38800A77 MCU - * cyan/red/green VFD display Futaba DM-43ZK 2E - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bfriskyt_state : public hh_hmcs40_state -{ -public: - bfriskyt_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int1(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -void bfriskyt_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7); - UINT32 plate = BITSWAP24(m_plate,23,22,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21); - display_matrix(22, 8, plate, grid); -} - -WRITE8_MEMBER(bfriskyt_state::plate_w) -{ - // R0x-R3x: vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(bfriskyt_state::grid_w) -{ - // D6: speaker out - m_speaker->level_w(data >> 6 & 1); - - // D11-D15: input mux - UINT8 inp_mux = data >> 11 & 0x1f; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int1(); - } - - // D8-D15: vfd matrix grid - m_grid = data >> 8 & 0xff; - - // D0-D5: more plates - m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x3f0000); - prepare_display(); -} - -void bfriskyt_state::update_int1() -{ - // INT1 on multiplexed inputs - set_interrupt(1, read_inputs(5)); -} - - -// config - -static INPUT_PORTS_START( bfriskyt ) - PORT_START("IN.0") // D11 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) - - PORT_START("IN.1") // D12 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) - - PORT_START("IN.2") // D13 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) - - PORT_START("IN.3") // D14 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) - - PORT_START("IN.4") // D15 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bfriskyt_state, input_changed, NULL) - - PORT_START("IN.5") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(bfriskyt_state::input_changed) -{ - update_int1(); -} - - -static MACHINE_CONFIG_START( bfriskyt, bfriskyt_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bfriskyt_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bfriskyt_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bfriskyt_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bfriskyt_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(bfriskyt_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Packri Monster (manufactured in Japan) - * PCB label DM-21ZA2 - * Hitachi HD38800A27 MCU - * cyan/red/green VFD display Futaba DM-21ZK 2B, with bezel overlay - - known releases: - - Japan: FL Packri Monster - - USA(World?): Packri Monster - - USA/Canada: Hungry Monster, published by Tandy - - other: Gobble Man/Ogre Monster, published by Tandy - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class packmon_state : public hh_hmcs40_state -{ -public: - packmon_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ16_MEMBER(input_r); -}; - -// handlers - -WRITE8_MEMBER(packmon_state::plate_w) -{ - // R0x-R3x(,D0-D3): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,0,1,2,3,4,5,6,19,18,17,16,15,14,13,12,11,10,9,8,7); - display_matrix(20, 10, plate, grid); -} - -WRITE16_MEMBER(packmon_state::grid_w) -{ - // D4: speaker out - m_speaker->level_w(data >> 4 & 1); - - // D11-D15: input mux - m_inp_mux = data >> 11 & 0x1f; - - // D6-D15: vfd matrix grid - m_grid = data >> 6 & 0x3ff; - - // D0-D3: plate 9-12 (update display there) - plate_w(space, 4, data & 0xf); -} - -READ16_MEMBER(packmon_state::input_r) -{ - // D5: multiplexed inputs - return read_inputs(5) & 0x20; -} - - -// config - -static INPUT_PORTS_START( packmon ) - PORT_START("IN.0") // D11 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START ) - - PORT_START("IN.1") // D12 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - - PORT_START("IN.2") // D13 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - - PORT_START("IN.3") // D14 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - - PORT_START("IN.4") // D15 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( packmon, packmon_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(packmon_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(packmon_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(packmon_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(packmon_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(packmon_state, grid_w)) - MCFG_HMCS40_READ_D_CB(READ16(packmon_state, input_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai/Mattel Star Hawk (manufactured in Japan) - * PCBs are labeled Kaken, PT-317B - * Hitachi HD38800A73 MCU - * cyan/red VFD display Futaba DM-41ZK, with partial color overlay + bezel - - Kaken was a subsidiary of Bandai. The original Japanese release is unknown, - was it canceled and only released in the USA? - - known releases: - - Japan: ? - - USA: Star Hawk, published by Mattel - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class msthawk_state : public hh_hmcs40_state -{ -public: - msthawk_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int0(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -void msthawk_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - UINT32 plate = BITSWAP24(m_plate,23,22,21,19,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); - display_matrix(21, 10, plate, grid); -} - -WRITE8_MEMBER(msthawk_state::plate_w) -{ - // R0x-R3x: vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(msthawk_state::grid_w) -{ - // D5: speaker out - m_speaker->level_w(data >> 5 & 1); - - // D10-D15: input mux - UINT8 inp_mux = data >> 10 & 0x3f; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int0(); - } - - // D6-D15: vfd matrix grid - m_grid = data >> 6 & 0x3ff; - - // D0-D4: more plates - m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x1f0000); - prepare_display(); -} - -void msthawk_state::update_int0() -{ - // INT0 on multiplexed inputs - set_interrupt(0, read_inputs(6)); -} - - -// config - -static INPUT_PORTS_START( msthawk ) - PORT_START("IN.0") // D10 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) PORT_NAME("Score") - - PORT_START("IN.1") // D11 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) PORT_NAME("Land") - - PORT_START("IN.2") // D12 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) - - PORT_START("IN.3") // D13 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) - - PORT_START("IN.4") // D14 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) - - PORT_START("IN.5") // D15 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, msthawk_state, input_changed, NULL) - - PORT_START("IN.6") // INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) PORT_NAME("Fire") -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(msthawk_state::input_changed) -{ - update_int0(); -} - - -static MACHINE_CONFIG_START( msthawk, msthawk_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(msthawk_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(msthawk_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(msthawk_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(msthawk_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(msthawk_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Zaxxon (manufactured in Japan, licensed from Sega) - * PCB label FL Zaxxon - * Hitachi HD38800B19 MCU - * cyan/red/blue VFD display NEC FIP11BM24T no. 4-8, half of it reflected - with a one-way mirror to give the illusion of a 3D display - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bzaxxon_state : public hh_hmcs40_state -{ -public: - bzaxxon_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int1(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -WRITE8_MEMBER(bzaxxon_state::plate_w) -{ - // R0x-R3x(,D0-D2): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,6,7,8,9,10,5,4,3,2,1,0); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,5,7,0,1,2,3,4,6,19,16,17,18,15,14,13,12,10,8,9,11) | 0x800; - display_matrix(20, 11, plate, grid); -} - -WRITE16_MEMBER(bzaxxon_state::grid_w) -{ - // D4: speaker out - m_speaker->level_w(data >> 4 & 1); - - // D7-D10: input mux - UINT8 inp_mux = data >> 7 & 0xf; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int1(); - } - - // D5-D15: vfd matrix grid - m_grid = data >> 5 & 0x7ff; - - // D0-D2: plate 7-9 (update display there) - plate_w(space, 4, data & 7); -} - -void bzaxxon_state::update_int1() -{ - // INT1 on multiplexed inputs - set_interrupt(1, read_inputs(4)); -} - - -// config - -static INPUT_PORTS_START( bzaxxon ) - PORT_START("IN.0") // D7 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bzaxxon_state, input_changed, NULL) - - PORT_START("IN.1") // D8 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, bzaxxon_state, input_changed, NULL) - - PORT_START("IN.2") // D9 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bzaxxon_state, input_changed, NULL) - - PORT_START("IN.3") // D10 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, bzaxxon_state, input_changed, NULL) - - PORT_START("IN.4") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) - - PORT_START("IN.5") // port D - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SELECT ) - PORT_BIT( 0xfff7, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(bzaxxon_state::input_changed) -{ - update_int1(); -} - - -static MACHINE_CONFIG_START( bzaxxon, bzaxxon_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bzaxxon_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bzaxxon_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bzaxxon_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bzaxxon_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(bzaxxon_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.5")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Zackman "The Pit, FL Exploration of Space" (manufactured in Japan) - * Hitachi QFP HD38820A49 MCU - * cyan/red/yellow VFD display Futaba DM-53Z 3E, with color overlay - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class zackman_state : public hh_hmcs40_state -{ -public: - zackman_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int0(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -WRITE8_MEMBER(zackman_state::plate_w) -{ - // R0x-R6x(,D0,D1): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - UINT32 plate = BITSWAP32(m_plate,31,30,27,0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12); - display_matrix(29, 8, plate, grid); -} - -WRITE16_MEMBER(zackman_state::grid_w) -{ - // D2: speaker out - m_speaker->level_w(data >> 2 & 1); - - // D11-D14: input mux - UINT8 inp_mux = data >> 11 & 0xf; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int0(); - } - - // D8-D15: vfd matrix grid - m_grid = data >> 8 & 0xff; - - // D0,D1: plate 12,13 (update display there) - plate_w(space, 7, data & 3); -} - -void zackman_state::update_int0() -{ - // INT0 on multiplexed inputs - set_interrupt(0, read_inputs(4)); -} - - -// config - -static INPUT_PORTS_START( zackman ) - PORT_START("IN.0") // D11 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) - - PORT_START("IN.1") // D12 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) - - PORT_START("IN.2") // D13 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) - - PORT_START("IN.3") // D14 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) - - PORT_START("IN.4") // INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(zackman_state::input_changed) -{ - update_int0(); -} - - -static MACHINE_CONFIG_START( zackman, zackman_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(zackman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(zackman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(zackman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(zackman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(zackman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(zackman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(zackman_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(zackman_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Pengo (manufactured in Japan, licensed from Sega) - * PCB label FL Pengo(in katakana) - * Hitachi QFP HD38820A63 MCU - * cyan/red/blue VFD display Futaba DM-68ZK 3D DM-63 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bpengo_state : public hh_hmcs40_state -{ -public: - bpengo_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int0(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -void bpengo_state::prepare_display() -{ - UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - UINT32 plate = BITSWAP32(m_plate,31,30,29,28,23,22,21,16,17,18,19,20,27,26,25,24,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); - display_matrix(25, 8, plate, grid); -} - -WRITE8_MEMBER(bpengo_state::plate_w) -{ - // R0x-R6x: vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(bpengo_state::grid_w) -{ - // D10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // D12-D15: input mux - UINT8 inp_mux = data >> 12 & 0xf; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int0(); - } - - // D0-D7: vfd matrix grid - m_grid = data & 0xff; - prepare_display(); -} - -void bpengo_state::update_int0() -{ - // INT0 on multiplexed inputs - set_interrupt(0, read_inputs(4)); -} - - -// config - -static INPUT_PORTS_START( bpengo ) - PORT_START("IN.0") // D12 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, bpengo_state, input_changed, NULL) - - PORT_START("IN.1") // D13 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, bpengo_state, input_changed, NULL) - - PORT_START("IN.2") // D14 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bpengo_state, input_changed, NULL) - - PORT_START("IN.3") // D15 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bpengo_state, input_changed, NULL) - - PORT_START("IN.4") // INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) - - PORT_START("IN.5") // port D - PORT_CONFNAME( 0x0800, 0x0000, "Factory Test" ) - PORT_CONFSETTING( 0x0000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x0800, DEF_STR( On ) ) - PORT_BIT( 0xf7ff, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(bpengo_state::input_changed) -{ - update_int0(); -} - - -static MACHINE_CONFIG_START( bpengo, bpengo_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bpengo_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bpengo_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bpengo_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bpengo_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(bpengo_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(bpengo_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(bpengo_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(bpengo_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.5")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Burger Time (manufactured in Japan, licensed from Data East) - * PCB label Kaken Corp. PT-389 Burger Time - * Hitachi QFP HD38820A65 MCU - * cyan/red/green VFD display NEC FIP6AM25T no. 21-21 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bbtime_state : public hh_hmcs40_state -{ -public: - bbtime_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int0(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -void bbtime_state::prepare_display() -{ - UINT8 grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5); - UINT32 plate = BITSWAP32(m_plate,31,30,29,28,25,24,26,27,22,23,15,14,12,11,10,8,7,6,4,1,5,9,13,3,2,16,17,18,19,20,0,21) | 0x1; - display_matrix(28, 6, plate, grid); -} - -WRITE8_MEMBER(bbtime_state::plate_w) -{ - // R0x-R6x: vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(bbtime_state::grid_w) -{ - // D3: speaker out - m_speaker->level_w(data >> 3 & 1); - - // D10-D14: input mux - UINT8 inp_mux = data >> 10 & 0x1f; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int0(); - } - - // D4-D9: vfd matrix grid - m_grid = data >> 4 & 0x3f; - prepare_display(); -} - -void bbtime_state::update_int0() -{ - // INT0 on multiplexed inputs - set_interrupt(0, read_inputs(5)); -} - - -// config - -static INPUT_PORTS_START( bbtime ) - PORT_START("IN.0") // D10 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) - - PORT_START("IN.1") // D11 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) - - PORT_START("IN.2") // D12 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) - - PORT_START("IN.3") // D13 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) - - PORT_START("IN.4") // D14 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, bbtime_state, input_changed, NULL) - - PORT_START("IN.5") // INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(bbtime_state::input_changed) -{ - update_int0(); -} - - -static MACHINE_CONFIG_START( bbtime, bbtime_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bbtime_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bbtime_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bbtime_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bbtime_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(bbtime_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(bbtime_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(bbtime_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(bbtime_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Dokodemo Dorayaki Doraemon (FL LSI Game Push Up) (manufactured in Japan) - * PCB label Kaken Corp PT-412 FL-Doreamon(in katakana) - * Hitachi HD38800B43 MCU - * cyan/red/blue VFD display Futaba DM-71 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bdoramon_state : public hh_hmcs40_state -{ -public: - bdoramon_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); -}; - -// handlers - -WRITE8_MEMBER(bdoramon_state::plate_w) -{ - // R0x-R3x(,D0-D3): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,7,6); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,11,19,18,17,16,15,14,13,12,10,9,8,7,6,5,4,3,2,1,0); - display_matrix(19, 8, plate, grid); -} - -WRITE16_MEMBER(bdoramon_state::grid_w) -{ - // D7: speaker out - m_speaker->level_w(data >> 7 & 1); - - // D8-D15: vfd matrix grid - m_grid = data >> 8 & 0xff; - - // D0-D3: plate 15-18 (update display there) - plate_w(space, 4, data & 0xf); -} - - -// config - -static INPUT_PORTS_START( bdoramon ) - PORT_START("IN.0") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) - - PORT_START("IN.1") // INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) - - PORT_START("IN.2") // port D - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0xff8f, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // port R2x - PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_CONFNAME( 0x08, 0x00, "Factory Test" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x08, DEF_STR( On ) ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( bdoramon, bdoramon_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bdoramon_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bdoramon_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bdoramon_state, plate_w)) - MCFG_HMCS40_READ_R_CB(2, IOPORT("IN.3")) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bdoramon_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(bdoramon_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.2")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Ultra Man (FL LSI Game Push Up) (manufactured in Japan) - * PCB label Kaken Corp. PT-424 FL Ultra Man - * Hitachi HD38800B52 MCU - * cyan/red/blue VFD display NEC FIP8BM25T no. 21-8 2 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bultrman_state : public hh_hmcs40_state -{ -public: - bultrman_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); -}; - -// handlers - -WRITE8_MEMBER(bultrman_state::plate_w) -{ - // R0x-R3x(,D0-D2): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,16,15,14,13,12,11,2,10,9,8,7,6,5,4,3,0,1); - display_matrix(18, 8, plate, grid); -} - -WRITE16_MEMBER(bultrman_state::grid_w) -{ - // D7: speaker out - m_speaker->level_w(data >> 7 & 1); - - // D8-D15: vfd matrix grid - m_grid = data >> 8 & 0xff; - - // D0-D2: plate 15-17 (update display there) - plate_w(space, 4, data & 7); -} - - -// config - -static INPUT_PORTS_START( bultrman ) - PORT_START("IN.0") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) - - PORT_START("IN.1") // port D - PORT_CONFNAME( 0x0010, 0x0000, "Factory Test" ) - PORT_CONFSETTING( 0x0000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x0010, DEF_STR( On ) ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0xff8f, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( bultrman, bultrman_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bultrman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bultrman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bultrman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bultrman_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(bultrman_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.1")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Machine Man (FL Flat Type) (manufactured in Japan) - * PCB label Kaken PT-438 - * Hitachi QFP HD38820A85 MCU - * cyan/red/green VFD display NEC FIP5CM33T no. 4 21 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class machiman_state : public hh_hmcs40_state -{ -public: - machiman_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); -}; - -// handlers - -void machiman_state::prepare_display() -{ - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); - display_matrix(19, 5, plate, m_grid); -} - -WRITE8_MEMBER(machiman_state::plate_w) -{ - // R0x-R3x,R6012: vfd matrix plate - int shift = (offset == HMCS40_PORT_R6X) ? 16 : offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(machiman_state::grid_w) -{ - // D13: speaker out - m_speaker->level_w(data >> 13 & 1); - - // D0-D4: vfd matrix grid - m_grid = data & 0x1f; - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( machiman ) - PORT_START("IN.0") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) - - PORT_START("IN.1") // port D - PORT_BIT( 0x3fff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY -INPUT_PORTS_END - -static MACHINE_CONFIG_START( machiman, machiman_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(machiman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(machiman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(machiman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(machiman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(machiman_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(machiman_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.1")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Pair Match (manufactured in Japan) - * PCB label Kaken Corp. PT-460 - * Hitachi QFP HD38820A88 MCU(main), HD38820A89(audio) - * cyan/red VFD display - - This is a memory game, the difference is instead of pictures, the player - needs to match sound effects. It has an extra MCU for sound. The case is - shaped like a glossy black pyramid. Star Trek fans will recognize it as - a prop used in TNG Ten Forward. - - note: MAME external artwork is not needed for this game - -***************************************************************************/ - -class pairmtch_state : public hh_hmcs40_state -{ -public: - pairmtch_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ8_MEMBER(input_r); - - DECLARE_WRITE8_MEMBER(sound_w); - DECLARE_WRITE8_MEMBER(sound2_w); - DECLARE_WRITE16_MEMBER(speaker_w); -}; - -// handlers: maincpu side - -WRITE8_MEMBER(pairmtch_state::plate_w) -{ - // R2x,R3x,R6x: vfd matrix plate - int shift = (offset == HMCS40_PORT_R6X) ? 8 : (offset-2) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - display_matrix(12, 6, m_plate, m_grid); -} - -WRITE16_MEMBER(pairmtch_state::grid_w) -{ - // D7: sound reset (to audiocpu reset line) - m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x80) ? ASSERT_LINE : CLEAR_LINE); - - // D9: sound start (to audiocpu INT0) - m_audiocpu->set_input_line(0, (data & 0x200) ? ASSERT_LINE : CLEAR_LINE); - - // D10,D15: input mux - m_inp_mux = (data >> 10 & 1) | (data >> 14 & 2); - - // D0-D5: vfd matrix grid - m_grid = data & 0x3f; - display_matrix(12, 6, m_plate, m_grid); -} - -READ8_MEMBER(pairmtch_state::input_r) -{ - // R4x: multiplexed inputs - return read_inputs(2); -} - -WRITE8_MEMBER(pairmtch_state::sound_w) -{ - // R5x: soundlatch (to audiocpu R2x) - soundlatch_byte_w(space, 0, BITSWAP8(data,7,6,5,4,0,1,2,3)); -} - - -// handlers: audiocpu side - -WRITE8_MEMBER(pairmtch_state::sound2_w) -{ - // R2x: soundlatch (to maincpu R5x) - soundlatch2_byte_w(space, 0, BITSWAP8(data,7,6,5,4,0,1,2,3)); -} - -WRITE16_MEMBER(pairmtch_state::speaker_w) -{ - // D0: speaker out - m_speaker->level_w(data & 1); - - // D1: sound ack (to maincpu INT0) - m_maincpu->set_input_line(0, (data & 2) ? ASSERT_LINE : CLEAR_LINE); -} - - -// config - -static INPUT_PORTS_START( pairmtch ) - PORT_START("IN.0") // D10 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY - - PORT_START("IN.1") // D15 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - - PORT_START("IN.2") // port D - PORT_CONFNAME( 0x0040, 0x0000, "Factory Test" ) - PORT_CONFSETTING( 0x0000, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x0040, DEF_STR( On ) ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_CONFNAME( 0x0800, 0x0800, "Players" ) - PORT_CONFSETTING( 0x0800, "1" ) - PORT_CONFSETTING( 0x0000, "2" ) - PORT_CONFNAME( 0x3000, 0x2000, "Skill Level" ) - PORT_CONFSETTING( 0x2000, "1" ) - PORT_CONFSETTING( 0x1000, "2" ) - PORT_CONFSETTING( 0x0000, "3" ) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x86bf, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( pairmtch, pairmtch_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(pairmtch_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(pairmtch_state, plate_w)) - MCFG_HMCS40_READ_R_CB(4, READ8(pairmtch_state, input_r)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(pairmtch_state, sound_w)) - MCFG_HMCS40_READ_R_CB(5, READ8(driver_device, soundlatch2_byte_r)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(pairmtch_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(pairmtch_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.2")) - - MCFG_CPU_ADD("audiocpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(pairmtch_state, sound2_w)) - MCFG_HMCS40_READ_R_CB(2, READ8(driver_device, soundlatch_byte_r)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(pairmtch_state, speaker_w)) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_pairmtch) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Alien Attack (manufactured in Taiwan) - * Hitachi HD38800A25 MCU - * cyan/red VFD display Futaba DM-19Z 1J - - It looks like Coleco took Gakken's Heiankyo Alien and turned it into a more - action-oriented game. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class alnattck_state : public hh_hmcs40_state -{ -public: - alnattck_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ16_MEMBER(input_r); -}; - -// handlers - -WRITE8_MEMBER(alnattck_state::plate_w) -{ - // R0x-R3x(,D0-D3): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,16,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15); - display_matrix(20, 10, plate, m_grid); -} - -WRITE16_MEMBER(alnattck_state::grid_w) -{ - // D4: speaker out - m_speaker->level_w(data >> 4 & 1); - - // D7-D13: input mux - m_inp_mux = data >> 7 & 0x7f; - - // D6-D15: vfd matrix grid - m_grid = data >> 6 & 0x3ff; - - // D0-D3: plate 16-19 (update display there) - plate_w(space, 4, data & 0xf); -} - -READ16_MEMBER(alnattck_state::input_r) -{ - // D5: multiplexed inputs - return read_inputs(7) & 0x20; -} - - -// config - -static INPUT_PORTS_START( alnattck ) - PORT_START("IN.0") // D7 line D5 - PORT_CONFNAME( 0x20, 0x00, "Skill Level" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x20, "2" ) - - PORT_START("IN.1") // D8 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - - PORT_START("IN.2") // D9 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - - PORT_START("IN.3") // D10 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - - PORT_START("IN.4") // D11 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - - PORT_START("IN.5") // D12 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Move") - - PORT_START("IN.6") // D13 line D5 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Fire") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( alnattck, alnattck_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(alnattck_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(alnattck_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(alnattck_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(alnattck_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(alnattck_state, grid_w)) - MCFG_HMCS40_READ_D_CB(READ16(alnattck_state, input_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Donkey Kong (manufactured in Taiwan, licensed from Nintendo) - * PCB label Coleco Rev C 75790 DK - * Hitachi QFP HD38820A45 MCU - * cyan/red VFD display Futaba DM-47ZK 2K, with color overlay - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class cdkong_state : public hh_hmcs40_state -{ -public: - cdkong_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - int m_speaker_volume; - TIMER_DEVICE_CALLBACK_MEMBER(speaker_decay_sim); - -protected: - virtual void machine_start(); -}; - -// handlers - -// Sound is controlled by two pins: D3 for pitch, and R13 for on/off. When turned -// off, it does not mute instantly, but volume slowly decays. Until we emulate it -// with discrete audio, this crude simulation will do. - -#define CDKONG_SPEAKER_MAX 0x10000 -#define CDKONG_SPEAKER_DECAY 50 - -TIMER_DEVICE_CALLBACK_MEMBER(cdkong_state::speaker_decay_sim) -{ - m_speaker->set_output_gain(0, m_speaker_volume / (double)CDKONG_SPEAKER_MAX); - m_speaker_volume /= 2; -} - - -void cdkong_state::prepare_display() -{ - UINT32 plate = BITSWAP32(m_plate,31,30,29,24,0,16,8,1,23,17,9,2,18,10,25,27,26,3,15,27,11,11,14,22,6,13,21,5,19,12,20,4) | 0x800800; - display_matrix(29, 11, plate, m_grid); -} - -WRITE8_MEMBER(cdkong_state::plate_w) -{ - // R13: speaker on - if (offset == HMCS40_PORT_R1X && data & 8) - m_speaker_volume = CDKONG_SPEAKER_MAX; - - // R0x-R6x: vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(cdkong_state::grid_w) -{ - // D3: speaker out - m_speaker->level_w(data >> 3 & 1); - - // D4-D14: vfd matrix grid - m_grid = data >> 4 & 0x7ff; - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( cdkong ) - PORT_START("IN.0") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) - - PORT_START("IN.1") // port D - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x7ff8, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -void cdkong_state::machine_start() -{ - hh_hmcs40_state::machine_start(); - - // zerofill/init - m_speaker_volume = 0; - save_item(NAME(m_speaker_volume)); -} - -static MACHINE_CONFIG_START( cdkong, cdkong_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(cdkong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cdkong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cdkong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cdkong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cdkong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cdkong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cdkong_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(cdkong_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.1")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("speaker_decay", cdkong_state, speaker_decay_sim, attotime::from_msec(CDKONG_SPEAKER_DECAY)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Galaxian (manufactured in Taiwan) - * PCB label Coleco Rev A 75718 - * Hitachi HD38800A70 MCU - * cyan/red VFD display Futaba DM-36Z 2H, with color overlay - - Select game mode on start: - - P1 Left: Galaxian (default game) - - P1 Right: Midway's Attackers - - P2 Left: Head-to-Head Galaxian (2-player mode, short) - - P2 Right: Head-to-Head Galaxian (2-player mode, long) - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class cgalaxn_state : public hh_hmcs40_state -{ -public: - cgalaxn_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE16_MEMBER(plate_w); - DECLARE_READ8_MEMBER(input_r); - - DECLARE_INPUT_CHANGED_MEMBER(player_switch); -}; - -// handlers - -void cgalaxn_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,1,2,0,11,10,9,8,7,6,5,4,3); - UINT16 plate = BITSWAP16(m_plate,15,14,6,5,4,3,2,1,7,8,9,10,11,0,12,13); - display_matrix(15, 12, plate, grid); -} - -WRITE8_MEMBER(cgalaxn_state::grid_w) -{ - // R10,R11: input mux - if (offset == HMCS40_PORT_R1X) - m_inp_mux = data & 3; - - // R1x-R3x: vfd matrix grid - int shift = (offset - HMCS40_PORT_R1X) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(cgalaxn_state::plate_w) -{ - // D0: speaker out - m_speaker->level_w(data & 1); - - // D1: start alien attack whine sound effect (edge triggered) - - // D2-D15: vfd matrix plate - m_plate = (m_plate & 0x4000) | (data >> 2 & 0x3fff); - prepare_display(); -} - -READ8_MEMBER(cgalaxn_state::input_r) -{ - // R0x: multiplexed inputs - return read_inputs(2); -} - - -// config - -static INPUT_PORTS_START( cgalaxn ) - PORT_START("IN.0") // R10 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - - PORT_START("IN.1") // R11 port R0x - PORT_CONFNAME( 0x01, 0x01, "Players" ) PORT_CHANGED_MEMBER(DEVICE_SELF, cgalaxn_state, player_switch, NULL) - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x00, "2" ) - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) - - PORT_START("IN.3") // INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(cgalaxn_state::player_switch) -{ - // 2-player switch directly enables plate 14 - m_plate = (m_plate & 0x3fff) | (newval ? 0 : 0x4000); - prepare_display(); -} - - -static MACHINE_CONFIG_START( cgalaxn, cgalaxn_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_READ_R_CB(0, READ8(cgalaxn_state, input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cgalaxn_state, grid_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cgalaxn_state, grid_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cgalaxn_state, grid_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(cgalaxn_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Pac-Man (manufactured in Taiwan, licensed from Midway) - * PCB label Coleco 75690 - * Hitachi QFP HD38820A28/29 MCU - * cyan/red VFD display Futaba DM-34Z 2A, with color overlay - - known releases: - - USA: Pac-Man, by Coleco (name-license from Midway) - - Japan: Super Puck Monster, published by Gakken - - Select game mode on start: - - P1 Right: Pac-Man (default game) - - P1 Left: Head-to-Head Pac-Man (2-player mode) - - P1 Up: Eat & Run - - P1 Down: Demo - - BTANB note: 1st version doesn't show the whole maze on power-on - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class cpacman_state : public hh_hmcs40_state -{ -public: - cpacman_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ8_MEMBER(input_r); -}; - -// handlers - -WRITE8_MEMBER(cpacman_state::plate_w) -{ - // R1x-R6x(,D1,D2): vfd matrix plate - int shift = (offset - HMCS40_PORT_R1X) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); - UINT32 plate = BITSWAP32(m_plate,31,30,29,28,27,0,1,2,3,8,9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12,4,5,6,7); - display_matrix(27, 11, plate, grid); -} - -WRITE16_MEMBER(cpacman_state::grid_w) -{ - // D0: speaker out - m_speaker->level_w(data & 1); - - // D13-D15: input mux - m_inp_mux = data >> 13 & 7; - - // D5-D15: vfd matrix grid - m_grid = data >> 5 & 0x7ff; - - // D1,D2: plate 8,14 (update display there) - plate_w(space, 6 + HMCS40_PORT_R1X, data >> 1 & 3); -} - -READ8_MEMBER(cpacman_state::input_r) -{ - // R0x: multiplexed inputs - return read_inputs(3); -} - - -// config - -static INPUT_PORTS_START( cpacman ) - PORT_START("IN.0") // D13 port R0x - PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x01, "2" ) - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // D14 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - - PORT_START("IN.2") // D15 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( cpacman, cpacman_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_READ_R_CB(0, READ8(cpacman_state, input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cpacman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cpacman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cpacman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cpacman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cpacman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cpacman_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(cpacman_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Ms. Pac-Man (manufactured in Taiwan, licensed from Midway) - * PCB label Coleco 911171 - * Hitachi QFP HD38820A61 MCU - * cyan/red VFD display Futaba DM-60Z 3I, with color overlay - - Select game mode on start: - - P1 Left: Ms. Pac-Man (default game) - - P1 Down: Head-to-Head Ms. Pac-Man (2-player mode) - - P1 Up: Demo - - BTANB note: in demo-mode, she hardly ever walks to the upper two rows - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class cmspacmn_state : public hh_hmcs40_state -{ -public: - cmspacmn_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ8_MEMBER(input_r); -}; - -// handlers - -WRITE8_MEMBER(cmspacmn_state::plate_w) -{ - // R1x-R6x(,D0,D1): vfd matrix plate - int shift = (offset - HMCS40_PORT_R1X) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT16 grid = BITSWAP16(m_grid,15,14,13,11,10,9,8,7,6,5,4,3,2,1,0,1); - UINT64 plate = BIT(m_plate,15)<<32 | BITSWAP32(m_plate,14,13,12,4,5,6,7,24,23,25,22,21,20,13,24,3,19,14,12,11,24,2,10,8,7,25,0,9,1,18,17,16) | 0x1004080; - display_matrix(33, 12, plate, grid); -} - -WRITE16_MEMBER(cmspacmn_state::grid_w) -{ - // D2: speaker out - m_speaker->level_w(data >> 2 & 1); - - // D13-D15: input mux - m_inp_mux = data >> 13 & 7; - - // D5-D15: vfd matrix grid - m_grid = data >> 5 & 0x7ff; - - // D0,D1: more plates (update display there) - plate_w(space, 6 + HMCS40_PORT_R1X, data & 3); -} - -READ8_MEMBER(cmspacmn_state::input_r) -{ - // R0x: multiplexed inputs - return read_inputs(3); -} - - -// config - -static INPUT_PORTS_START( cmspacmn ) - PORT_START("IN.0") // D13 port R0x - PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x01, "2" ) - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // D14 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - - PORT_START("IN.2") // D15 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( cmspacmn, cmspacmn_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_READ_R_CB(0, READ8(cmspacmn_state, input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cmspacmn_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cmspacmn_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cmspacmn_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cmspacmn_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cmspacmn_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cmspacmn_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(cmspacmn_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex Galaxian 2 (manufactured in Japan) - * PCB labels ENTEX GALAXIAN PB-118/116/097 80-210137/135/114 - * Hitachi QFP HD38820A13 MCU - * cyan/red/green VFD display Futaba DM-20 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class egalaxn2_state : public hh_hmcs40_state -{ -public: - egalaxn2_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ8_MEMBER(input_r); -}; - -// handlers - -void egalaxn2_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,15,14,13,12,7,6,5,4,3,2,1,0,19,18,17,16,11,10,9,8); - display_matrix(24, 15, plate, grid); -} - -WRITE16_MEMBER(egalaxn2_state::grid_w) -{ - // D0: speaker out - m_speaker->level_w(data & 1); - - // D1-D4: input mux - m_inp_mux = data >> 1 & 0xf; - - // D1-D15: vfd matrix grid - m_grid = data >> 1 & 0x7fff; - prepare_display(); -} - -WRITE8_MEMBER(egalaxn2_state::plate_w) -{ - // R1x-R6x: vfd matrix plate - int shift = (offset - HMCS40_PORT_R1X) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -READ8_MEMBER(egalaxn2_state::input_r) -{ - // R0x: multiplexed inputs - return read_inputs(4); -} - - -// config - -static INPUT_PORTS_START( egalaxn2 ) - PORT_START("IN.0") // D1 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - - PORT_START("IN.1") // D2 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY - - PORT_START("IN.2") // D3 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // D4 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) - PORT_CONFSETTING( 0x02, "1" ) - PORT_CONFSETTING( 0x00, "2" ) - PORT_CONFNAME( 0x0c, 0x00, "Players" ) - PORT_CONFSETTING( 0x08, "0 (Demo)" ) // for Demo mode: need to hold down Fire button at power-on - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x04, "2" ) -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( egalaxn2, egalaxn2_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_READ_R_CB(0, READ8(egalaxn2_state, input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(egalaxn2_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(egalaxn2_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(egalaxn2_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(egalaxn2_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(egalaxn2_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(egalaxn2_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(egalaxn2_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex Pac Man 2 (manufactured in Japan) - * PCB labels ENTEX PAC-MAN PB-093/094 80-210149/50/51 - * Hitachi QFP HD38820A23 MCU - * cyan/red VFD display Futaba DM-28Z 1G(cyan Pac-Man) or DM-28 1K(orange Pac-Man) - - 2 VFD revisions are known, the difference is Pac-Man's color: cyan or red. - - NOTE!: MAME external artwork is required - -***************************************************************************/ -#if 0 -class epacman2_state : public egalaxn2_state -{ -public: - epacman2_state(const machine_config &mconfig, device_type type, const char *tag) - : egalaxn2_state(mconfig, type, tag) - { } -}; -#endif -// handlers are identical to Galaxian 2, so we can use those - -// config - -static INPUT_PORTS_START( epacman2 ) - PORT_START("IN.0") // D1 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - - PORT_START("IN.1") // D2 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY - - PORT_START("IN.2") // D3 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Skill Control") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Demo Light Test") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // D4 port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFNAME( 0x0c, 0x04, "Players" ) - PORT_CONFSETTING( 0x08, "0 (Demo)" ) - PORT_CONFSETTING( 0x04, "1" ) - PORT_CONFSETTING( 0x00, "2" ) -INPUT_PORTS_END - - - - - -/*************************************************************************** - - Entex Turtles (manufactured in Japan) - * PCB label 560359 - * Hitachi QFP HD38820A43 MCU - * COP411L sub MCU, labeled COP411L-KED/N - * cyan/red/green VFD display NEC FIP15BM32T - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class eturtles_state : public hh_hmcs40_state -{ -public: - eturtles_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag), - m_cop_irq(0) - { } - - virtual void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - UINT8 m_cop_irq; - DECLARE_WRITE_LINE_MEMBER(speaker_w); - DECLARE_WRITE8_MEMBER(cop_irq_w); - DECLARE_READ8_MEMBER(cop_latch_r); - DECLARE_READ8_MEMBER(cop_ack_r); - - void update_int(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); - -protected: - virtual void machine_start(); -}; - -// handlers: maincpu side - -void eturtles_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,1,14,13,12,11,10,9,8,7,6,5,4,3,2,0); - UINT32 plate = BITSWAP32(m_plate,31,30,11,12,18,19,16,17,22,15,20,21,27,26,23,25,24,2,3,1,0,6,4,5,10,9,2,8,7,14,1,13); - display_matrix(30, 15, plate | (grid >> 5 & 8), grid); // grid 8 also forces plate 3 high -} - -WRITE8_MEMBER(eturtles_state::plate_w) -{ - m_r[offset] = data; - - // R0x-R6x: vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(eturtles_state::grid_w) -{ - m_d = data; - - // D1-D6: input mux - UINT8 inp_mux = data >> 1 & 0x3f; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int(); - } - - // D1-D15: vfd matrix grid - m_grid = data >> 1 & 0x7fff; - prepare_display(); -} - -void eturtles_state::update_int() -{ - // INT0/1 on multiplexed inputs, and from COP D0 - UINT8 inp = read_inputs(6); - set_interrupt(0, (inp & 1) | m_cop_irq); - set_interrupt(1, inp & 2); -} - - -// handlers: COP side - -WRITE_LINE_MEMBER(eturtles_state::speaker_w) -{ - // SK: speaker out - m_speaker->level_w(!state); -} - -WRITE8_MEMBER(eturtles_state::cop_irq_w) -{ - // D0: maincpu INT0 (active low) - m_cop_irq = ~data & 1; - update_int(); -} - -READ8_MEMBER(eturtles_state::cop_latch_r) -{ - // L0-L3: soundlatch from maincpu R0x - return m_r[0]; -} - -READ8_MEMBER(eturtles_state::cop_ack_r) -{ - // G0: ack from maincpu D0 - return m_d & 1; -} - - -// config - -static INPUT_PORTS_START( eturtles ) - PORT_START("IN.0") // D1 INT0/1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - - PORT_START("IN.1") // D2 INT0/1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - - PORT_START("IN.2") // D3 INT0/1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - - PORT_START("IN.3") // D4 INT0/1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - - PORT_START("IN.4") // D5 INT0/1 - PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x00, "2" ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - - PORT_START("IN.5") // D6 INT0/1 - PORT_CONFNAME( 0x03, 0x00, "Players" ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_CONFSETTING( 0x02, "0 (Demo)" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x01, "2" ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(eturtles_state::input_changed) -{ - update_int(); -} - - -void eturtles_state::machine_start() -{ - hh_hmcs40_state::machine_start(); - - // register for savestates - save_item(NAME(m_cop_irq)); -} - -static MACHINE_CONFIG_START( eturtles, eturtles_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(eturtles_state, grid_w)) - - MCFG_CPU_ADD("audiocpu", COP411, 215000) // approximation - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed - MCFG_COP400_WRITE_SK_CB(WRITELINE(eturtles_state, speaker_w)) - MCFG_COP400_WRITE_D_CB(WRITE8(eturtles_state, cop_irq_w)) - MCFG_COP400_READ_L_CB(READ8(eturtles_state, cop_latch_r)) - MCFG_COP400_READ_G_CB(READ8(eturtles_state, cop_ack_r)) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex Stargate (manufactured in Japan) - * PCB label 5603521/31 - * Hitachi QFP HD38820A42 MCU - * COP411L sub MCU, labeled ~/B8236 COP411L-KEC/N - * cyan/red/green VFD display NEC FIP15AM32T (EL628-003) no. 2-421, with partial color overlay - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class estargte_state : public eturtles_state -{ -public: - estargte_state(const machine_config &mconfig, device_type type, const char *tag) - : eturtles_state(mconfig, type, tag) - { } - - virtual void prepare_display(); - DECLARE_READ8_MEMBER(cop_data_r); -}; - -// handlers (most of it is in eturtles_state above) - -void estargte_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,0,14,13,12,11,10,9,8,7,6,5,4,3,2,1); - UINT32 plate = BITSWAP32(m_plate,31,30,29,15,17,19,21,23,25,27,26,24,3,22,20,18,16,14,12,10,8,6,4,2,0,1,3,5,7,9,11,13); - display_matrix(29, 14, plate, grid); -} - -READ8_MEMBER(estargte_state::cop_data_r) -{ - // L0-L3: soundlatch from maincpu R0x - // L7: ack from maincpu D0 - return m_r[0] | (m_d << 7 & 0x80); -} - - -// config - -static INPUT_PORTS_START( estargte ) - PORT_START("IN.0") // D1 INT0/1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Inviso") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Smart Bomb") - - PORT_START("IN.1") // D2 INT0/1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Fire") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Change Direction") - - PORT_START("IN.2") // D3 INT0/1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - - PORT_START("IN.3") // D4 INT0/1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) PORT_NAME("Thrust") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // D5 INT0/1 - PORT_CONFNAME( 0x01, 0x00, "Players" ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_CONFSETTING( 0x00, "0 (Demo)" ) // yes, same value as 1-player, hold the Inviso button at boot to enter demo mode - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x01, "2" ) - PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, eturtles_state, input_changed, NULL) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - - PORT_START("IN.5") // D6 INT0/1 - PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( estargte, estargte_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(eturtles_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(eturtles_state, grid_w)) - - MCFG_CPU_ADD("audiocpu", COP411, 190000) // approximation - MCFG_COP400_CONFIG(COP400_CKI_DIVISOR_4, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_DISABLED) // guessed - MCFG_COP400_WRITE_SK_CB(WRITELINE(eturtles_state, speaker_w)) - MCFG_COP400_WRITE_D_CB(WRITE8(eturtles_state, cop_irq_w)) - MCFG_COP400_READ_L_CB(READ8(estargte_state, cop_data_r)) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Gakken Heiankyo Alien (manufactured in Japan) - * Hitachi HD38800A04 MCU - * cyan/red VFD display Futaba DM-11Z 1H - - known releases: - - Japan: Heiankyo Alien - - USA: Earth Invaders, published by CGL - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class ghalien_state : public hh_hmcs40_state -{ -public: - ghalien_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_READ16_MEMBER(input_r); -}; - -// handlers - -WRITE8_MEMBER(ghalien_state::plate_w) -{ - // R0x-R3x(,D10-D13): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,14,12,10,8,9,13,15,2,0,1,3,11,7,5,4,6,19,17,16,18); - display_matrix(20, 10, plate, grid); -} - -WRITE16_MEMBER(ghalien_state::grid_w) -{ - // D14: speaker out - m_speaker->level_w(data >> 14 & 1); - - // D0-D6: input mux - m_inp_mux = data & 0x7f; - - // D0-D9: vfd matrix grid - m_grid = data & 0x3ff; - - // D10-D13: more plates (update display there) - plate_w(space, 4, data >> 10 & 0xf); -} - -READ16_MEMBER(ghalien_state::input_r) -{ - // D15: multiplexed inputs - return read_inputs(7) & 0x8000; -} - - -// config - -static INPUT_PORTS_START( ghalien ) - PORT_START("IN.0") // D0 line D15 - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - - PORT_START("IN.1") // D1 line D15 - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - - PORT_START("IN.2") // D2 line D15 - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - - PORT_START("IN.3") // D3 line D15 - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - - PORT_START("IN.4") // D4 line D15 - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Dig") - - PORT_START("IN.5") // D5 line D15 - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Bury") - - PORT_START("IN.6") // D6 line D15 - PORT_CONFNAME( 0x8000, 0x0000, DEF_STR( Difficulty ) ) - PORT_CONFSETTING( 0x0000, "Amateur" ) - PORT_CONFSETTING( 0x8000, "Professional" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ghalien, ghalien_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(ghalien_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(ghalien_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(ghalien_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(ghalien_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(ghalien_state, grid_w)) - MCFG_HMCS40_READ_D_CB(READ16(ghalien_state, input_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Gakken Crazy Kong (manufactured in Japan) - * PCB label ZENY 5603601 - * Hitachi HD38800B01 MCU - * cyan/red/blue VFD display Futaba DM-54Z 2H, with bezel overlay - - known releases: - - Japan: Crazy Kong - - USA: Super Kong, published by CGL - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class gckong_state : public hh_hmcs40_state -{ -public: - gckong_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int1(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -WRITE8_MEMBER(gckong_state::plate_w) -{ - // R0x-R3x(,D0,D1): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); - UINT32 plate = BITSWAP32(m_plate,31,30,29,28,27,26,25,6,7,8,12,13,14,15,16,17,18,17,16,12,11,10,9,8,7,6,5,4,3,2,1,0) | 0x8000; - display_matrix(32, 11, plate, grid); -} - -WRITE16_MEMBER(gckong_state::grid_w) -{ - // D2: speaker out - m_speaker->level_w(data >> 2 & 1); - - // D5-D8: input mux - UINT8 inp_mux = data >> 5 & 0xf; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int1(); - } - - // D5-D15: vfd matrix grid - m_grid = data >> 5 & 0x7ff; - - // D0,D1: more plates (update display there) - plate_w(space, 4, data & 3); -} - -void gckong_state::update_int1() -{ - // INT1 on multiplexed inputs - set_interrupt(1, read_inputs(4)); -} - - -// config - -static INPUT_PORTS_START( gckong ) - PORT_START("IN.0") // D5 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gckong_state, input_changed, NULL) - - PORT_START("IN.1") // D6 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, gckong_state, input_changed, NULL) - - PORT_START("IN.2") // D7 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gckong_state, input_changed, NULL) - - PORT_START("IN.3") // D8 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, gckong_state, input_changed, NULL) - - PORT_START("IN.4") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) - - PORT_START("IN.5") // port D - PORT_CONFNAME( 0x0010, 0x0000, "Skill Level" ) - PORT_CONFSETTING( 0x0000, "A" ) - PORT_CONFSETTING( 0x0010, "B" ) - PORT_BIT( 0xffef, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(gckong_state::input_changed) -{ - update_int1(); -} - - -static MACHINE_CONFIG_START( gckong, gckong_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(gckong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(gckong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(gckong_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(gckong_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(gckong_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.5")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Gakken Dig Dug (manufactured in Japan) - * PCB label Gakken DIG-DAG KS-004283(A/B) - * Hitachi QFP HD38820A69 MCU - * cyan/red/green VFD display Futaba DM-69Z 3F, with color overlay - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class gdigdug_state : public hh_hmcs40_state -{ -public: - gdigdug_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int1(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -WRITE8_MEMBER(gdigdug_state::plate_w) -{ - // R0x-R6x(,D0-D3): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT32 plate = BITSWAP32(m_plate,30,31,0,1,2,3,4,5,6,7,20,21,22,27,26,25,28,29,24,23,15,14,13,12,8,9,10,11,19,18,17,16); - display_matrix(32, 9, plate, m_grid); -} - -WRITE16_MEMBER(gdigdug_state::grid_w) -{ - // D6: speaker out - m_speaker->level_w(data >> 6 & 1); - - // D11-D15: input mux - UINT8 inp_mux = data >> 11 & 0x1f; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int1(); - } - - // D7-D15: vfd matrix grid - m_grid = data >> 7 & 0x1ff; - - // D0-D3: more plates (update display there) - plate_w(space, 7, data & 0xf); -} - -void gdigdug_state::update_int1() -{ - // INT1 on multiplexed inputs - set_interrupt(1, read_inputs(5)); -} - - -// config - -static INPUT_PORTS_START( gdigdug ) - PORT_START("IN.0") // D11 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) - - PORT_START("IN.1") // D12 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) - - PORT_START("IN.2") // D13 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) - - PORT_START("IN.3") // D14 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) - - PORT_START("IN.4") // D15 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, gdigdug_state, input_changed, NULL) - - PORT_START("IN.5") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(gdigdug_state::input_changed) -{ - update_int1(); -} - - -static MACHINE_CONFIG_START( gdigdug, gdigdug_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(gdigdug_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(gdigdug_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(gdigdug_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(gdigdug_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(gdigdug_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(gdigdug_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(gdigdug_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(gdigdug_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Mattel World Championship Baseball - * PCB label MEL-001 Baseball Rev. B - * Hitachi QFP HD38820A09 MCU - * cyan/red/green VFD display Futaba DM-24ZK 1G, with etched overlay - - To start the game in 2-player mode, simply turn the game on. For 1-player, - turn the game on while holding the 1-key and use the visitor's side keypad - to play offsense. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class mwcbaseb_state : public hh_hmcs40_state -{ -public: - mwcbaseb_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(speaker_w); - DECLARE_READ8_MEMBER(input_r); -}; - -// handlers - -void mwcbaseb_state::prepare_display() -{ - UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - display_matrix(16, 8, m_plate, grid); -} - -WRITE8_MEMBER(mwcbaseb_state::plate_w) -{ - // R1x-R3x,R6x: vfd matrix plate - int shift = (offset == HMCS40_PORT_R6X) ? 12 : (offset - HMCS40_PORT_R1X) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(mwcbaseb_state::grid_w) -{ - // D9-D15: input mux - m_inp_mux = data >> 9 & 0x7f; - - // D0-D7: vfd matrix grid - m_grid = data & 0xff; - prepare_display(); -} - -WRITE8_MEMBER(mwcbaseb_state::speaker_w) -{ - // R50,R51+R52(tied together): speaker out - m_speaker->level_w(data & 7); -} - -READ8_MEMBER(mwcbaseb_state::input_r) -{ - // R4x: multiplexed inputs - return read_inputs(7); -} - - -// config - -/* physical button layout and labels is like this: - - (visitor team side) (home team side) - COMP PITCH [SCORE] [INNING] - [1] [2] [3] [1] [2] [3] - NEW PITCHER PINCH HITTER NEW PITCHER PINCH HITTER - - [4] [5] [6] [4] [5] [6] - BACKWARD (pitch) FORWARD BACKWARD (pitch) FORWARD - - [7] [8] [9] [7] [8] [9] - - BUNT NORMAL HR SWING BUNT NORMAL HR SWING - [CLEAR] [0] [ENTER] [CLEAR] [0] [ENTER] - SLOW CURVE FAST SLOW CURVE FAST -*/ - -static INPUT_PORTS_START( mwcbaseb ) - PORT_START("IN.0") // D9 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("P2 4") // note: P1 = left/visitor, P2 = right/home - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_NAME("P2 3") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_NAME("P2 2") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_NAME("P2 1") - - PORT_START("IN.1") // D10 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P2 8") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("P2 7") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("P2 6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("P2 5") - - PORT_START("IN.2") // D11 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("P2 Enter") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("P2 Clear") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("P2 0") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("P2 9") - - PORT_START("IN.3") // D12 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Inning") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Score") - - PORT_START("IN.4") // D13 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("P1 Enter") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("P1 Clear") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("P1 0") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("P1 9") - - PORT_START("IN.5") // D14 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("P1 8") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("P1 7") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("P1 6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("P1 5") - - PORT_START("IN.6") // D15 port R4x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("P1 4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("P1 3") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("P1 2") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("P1 1") -INPUT_PORTS_END - - -static const INT16 mwcbaseb_speaker_levels[] = { 0, 16384, -16384, 0, -16384, 0, -32768, -16384 }; - -static MACHINE_CONFIG_START( mwcbaseb, mwcbaseb_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(mwcbaseb_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(mwcbaseb_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(mwcbaseb_state, plate_w)) - MCFG_HMCS40_READ_R_CB(4, READ8(mwcbaseb_state, input_r)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(mwcbaseb_state, speaker_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(mwcbaseb_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(mwcbaseb_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(8, mwcbaseb_speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Parker Brothers Q*Bert - * PCB label 13662 REV-4 - * Hitachi QFP HD38820A70 MCU - * cyan/red/green/darkgreen VFD display Itron CP5137 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class pbqbert_state : public hh_hmcs40_state -{ -public: - pbqbert_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); -}; - -// handlers - -WRITE8_MEMBER(pbqbert_state::plate_w) -{ - // R0x-R6x(,D8): vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT32 plate = BITSWAP32(m_plate,31,30,24,25,26,27,28,15,14,29,13,12,11,10,9,8,7,6,5,4,3,2,1,0,16,17,18,19,20,21,22,23) | 0x400000; - display_matrix(30, 8, plate, m_grid); -} - -WRITE16_MEMBER(pbqbert_state::grid_w) -{ - // D14: speaker out - m_speaker->level_w(data >> 14 & 1); - - // D0-D7: vfd matrix grid - m_grid = data & 0xff; - - // D8: plate 25 (update display there) - plate_w(space, 7, data >> 8 & 1); -} - - -// config - -static INPUT_PORTS_START( pbqbert ) - PORT_START("IN.0") // port D - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) // up-left - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) // up-right - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) // down-right - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) // down-left - PORT_BIT( 0xe1ff, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( pbqbert, pbqbert_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(pbqbert_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(pbqbert_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(pbqbert_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(pbqbert_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(pbqbert_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(pbqbert_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(pbqbert_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(pbqbert_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.0")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy Kingman (manufactured in Japan) - * PCBs are labeled THF-01II 2E138E01/2E128E02 - * Hitachi HD38800B23 MCU - * cyan/red/blue VFD display Futaba DM-65ZK 3A - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class kingman_state : public hh_hmcs40_state -{ -public: - kingman_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int0(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -void kingman_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); - UINT32 plate = BITSWAP24(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12); - display_matrix(23, 9, plate, grid); -} - -WRITE8_MEMBER(kingman_state::plate_w) -{ - // R0x-R3x: vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(kingman_state::grid_w) -{ - // D6: speaker out - m_speaker->level_w(data >> 6 & 1); - - // D12-D15: input mux - UINT8 inp_mux = data >> 12 & 0xf; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int0(); - } - - // D7-D15: vfd matrix grid - m_grid = data >> 7 & 0x1ff; - - // D0-D4: more plates - m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x1f0000); - prepare_display(); -} - -void kingman_state::update_int0() -{ - // INT0 on multiplexed inputs - set_interrupt(0, read_inputs(4)); -} - - -// config - -static INPUT_PORTS_START( kingman ) - PORT_START("IN.0") // D12 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) - - PORT_START("IN.1") // D13 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) - - PORT_START("IN.2") // D14 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) - - PORT_START("IN.3") // D15 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) - - PORT_START("IN.4") // INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(kingman_state::input_changed) -{ - update_int0(); -} - - -static MACHINE_CONFIG_START( kingman, kingman_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(kingman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(kingman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(kingman_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(kingman_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(kingman_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy(tronic) Tron (manufactured in Japan) - * PCBs are labeled THN-02 2E114E07 - * Hitachi HD38800A88 MCU - * cyan/red/green VFD display NEC FIP10AM24T no. 2-8 1 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class tmtron_state : public hh_hmcs40_state -{ -public: - tmtron_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - - void update_int1(); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - -// handlers - -void tmtron_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0); - UINT32 plate = BITSWAP24(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15); - display_matrix(23, 10, plate, grid); -} - -WRITE8_MEMBER(tmtron_state::plate_w) -{ - // R0x-R3x: vfd matrix plate - int shift = offset * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(tmtron_state::grid_w) -{ - // D4: speaker out - m_speaker->level_w(data >> 4 & 1); - - // D12-D15: input mux - UINT8 inp_mux = data >> 12 & 0xf; - if (inp_mux != m_inp_mux) - { - m_inp_mux = inp_mux; - update_int1(); - } - - // D6-D15: vfd matrix grid - m_grid = data >> 6 & 0x3ff; - - // D0-D3,D5: more plates - m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x2f0000); - prepare_display(); -} - -void tmtron_state::update_int1() -{ - // INT1 on multiplexed inputs - set_interrupt(1, read_inputs(4)); -} - - -// config - -static INPUT_PORTS_START( tmtron ) - PORT_START("IN.0") // D12 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) - - PORT_START("IN.1") // D13 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) - - PORT_START("IN.2") // D14 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) - - PORT_START("IN.3") // D15 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) - - PORT_START("IN.4") // INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(tmtron_state::input_changed) -{ - update_int1(); -} - - -static MACHINE_CONFIG_START( tmtron, tmtron_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(tmtron_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(tmtron_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(tmtron_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(tmtron_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(tmtron_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - VTech Invaders (manufactured in Taiwan) - * Hitachi HD38750A45 MCU - * cyan/red VFD display Futaba DM-26Z 1G, with bezel - - known releases: - - USA: Invaders/Sonic Invader - - UK: Cosmic Invader, published by Grandstand - - UK: Galactic Invaders, published by Prinztronic - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class vinvader_state : public hh_hmcs40_state -{ -public: - vinvader_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_hmcs40_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); -}; - -// handlers - -WRITE8_MEMBER(vinvader_state::plate_w) -{ - // R1x-R3x(,D4-D6): vfd matrix plate - int shift = (offset - HMCS40_PORT_R1X) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // update display - UINT16 plate = BITSWAP16(m_plate,15,11,7,3,10,6,14,2,9,5,13,1,8,4,12,0); - display_matrix(12, 9, plate, m_grid); -} - -WRITE16_MEMBER(vinvader_state::grid_w) -{ - // D0: speaker out - m_speaker->level_w(data & 1); - - // D7-D15: vfd matrix grid - m_grid = data >> 7 & 0x1ff; - - // D4-D6: more plates (update display there) - plate_w(space, 3 + HMCS40_PORT_R1X, data >> 4 & 7); -} - - -// config - -static INPUT_PORTS_START( vinvader ) - PORT_START("IN.0") // port R0x - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // port D - PORT_CONFNAME( 0x0002, 0x0000, "Skill Level") - PORT_CONFSETTING( 0x0000, "1" ) - PORT_CONFSETTING( 0x0002, "2" ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0xfff5, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( vinvader, vinvader_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38750, 400000) // approximation - MCFG_HMCS40_READ_R_CB(0, IOPORT("IN.0")) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(vinvader_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(vinvader_state, plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(vinvader_state, plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(vinvader_state, grid_w)) - MCFG_HMCS40_READ_D_CB(IOPORT("IN.1")) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( bambball ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38750a08", 0x0000, 0x0800, CRC(907fef18) SHA1(73fe7ca7c6332268a3a9abc5ac88ada2991012fb) ) - ROM_CONTINUE( 0x0f00, 0x0080 ) -ROM_END - - -ROM_START( bmboxing ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38750a07", 0x0000, 0x0800, CRC(7f33e259) SHA1(c5fcdd6bf060c96666354f09f0570c754f6ed4e0) ) - ROM_CONTINUE( 0x0f00, 0x0080 ) -ROM_END - - -ROM_START( bfriskyt ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800a77", 0x0000, 0x1000, CRC(a2445c4f) SHA1(0aaccfec90b66d27dae194d4462d88e654c41578) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( packmon ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800a27", 0x0000, 0x1000, CRC(86e09e84) SHA1(ac7d3c43667d5720ca513f8ff51d146d9f2af124) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( msthawk ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800a73", 0x0000, 0x1000, CRC(a4f9a523) SHA1(465f06b02e2e7d2277218fd447830725790a816c) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( bzaxxon ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800b19", 0x0000, 0x1000, CRC(4fecb80d) SHA1(7adf079480ffd3825ad5ae1eaa4d892eecbcc42d) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( zackman ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a49", 0x0000, 0x1000, CRC(b97f5ef6) SHA1(7fe20e8107361caf9ea657e504be1f8b10b8b03f) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( bpengo ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a63", 0x0000, 0x1000, CRC(ebd6bc64) SHA1(0a322c47b9553a2739a85908ce64b9650cf93d49) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( bbtime ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a65", 0x0000, 0x1000, CRC(33611faf) SHA1(29b6a30ed543688d31ec2aa18f7938fa4eef30b0) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( bdoramon ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800b43", 0x0000, 0x1000, CRC(9387ca42) SHA1(8937e208934b34bd9f49700aa50287dfc8bda76c) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( bultrman ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800b52", 0x0000, 0x1000, CRC(88d372dc) SHA1(f2ac3b89be8afe6fb65914ccebe1a56316b9472a) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( machiman ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a85", 0x0000, 0x1000, CRC(894b4954) SHA1(cab49638a326b031aa548301beb16f818759ef62) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( pairmtch ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a88", 0x0000, 0x1000, CRC(ffa35730) SHA1(5a80b9025aaad2ac0ab0b1436a1355ae8cd3f868) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) - - ROM_REGION( 0x2000, "audiocpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a89", 0x0000, 0x1000, CRC(3533ec56) SHA1(556d69e78a0ee1bf766fce16ed58992d7272d57f) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( alnattck ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800a25", 0x0000, 0x1000, CRC(18b50869) SHA1(11e9d5f7b4ae818b077b0ee14a3b43190e20bff3) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( cdkong ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a45", 0x0000, 0x1000, CRC(196b8070) SHA1(da85d1eb4b048b77f3168630662ab94ec9baa262) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( cgalaxn ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800a70", 0x0000, 0x1000, CRC(a4c5ed1d) SHA1(0f647cb78437d7e62411febf7c9ce3c5b6753a80) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( cpacman ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a29", 0x0000, 0x1000, CRC(1082d577) SHA1(0ef73132bd41f6ca1e4c001ae19f7f7c97eaa8d1) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - -ROM_START( cpacmanr1 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a28", 0x0000, 0x1000, CRC(d2ed57e5) SHA1(f56f1341485ac28ea9e6cc4d162fab18d8a4c977) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( cmspacmn ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a61", 0x0000, 0x1000, CRC(76276318) SHA1(9d6ff3f49b4cdaee5c9e238c1ed638bfb9b99aa7) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( egalaxn2 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a13", 0x0000, 0x1000, CRC(112b721b) SHA1(4a185bc57ea03fe64f61f7db4da37b16eeb0cb54) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( epacman2 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a23", 0x0000, 0x1000, CRC(6eab640f) SHA1(509bdd02be915089e13769f22a08e03509f03af4) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( estargte ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a42", 0x0000, 0x1000, CRC(5f6d55a6) SHA1(0da32149790fa5f16097338fc80536b462169e0c) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) - - ROM_REGION( 0x0200, "audiocpu", 0 ) - ROM_LOAD( "cop411l-kec_n", 0x0000, 0x0200, CRC(fbd3c2d3) SHA1(65b8b24d38678c3fa970bfd639e9449a75a28927) ) -ROM_END - - -ROM_START( eturtles ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a43", 0x0000, 0x1000, CRC(446aa4e2) SHA1(d1c0fb14ea7081def53b1174964b39eed1e5d5e6) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) - - ROM_REGION( 0x0200, "audiocpu", 0 ) - ROM_LOAD( "cop411l-ked_n", 0x0000, 0x0200, CRC(503d26e9) SHA1(a53d24d62195bfbceff2e4a43199846e0950aef6) ) -ROM_END - - -ROM_START( ghalien ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800a04", 0x0000, 0x1000, CRC(019c3328) SHA1(9f1029c5c479f78350952c4f18747341ba5ea7a0) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( gckong ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800b01", 0x0000, 0x1000, CRC(d5a2cca3) SHA1(37bb5784383daab672ed1e0e2362c7a40d8d9b3f) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( gdigdug ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a69", 0x0000, 0x1000, CRC(501165a9) SHA1(8a15d00c4aa66e870cadde33148426463560d2e6) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( mwcbaseb ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a09", 0x0000, 0x1000, CRC(25ba7dc0) SHA1(69e0a867fdcf07b454b1faf835e576ae782432c0) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( pbqbert ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38820a70", 0x0000, 0x1000, CRC(be7c80b4) SHA1(0617a80ef7fe188ea221de32e760d45fd4318c67) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( kingman ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800b23", 0x0000, 0x1000, CRC(f8dfe14f) SHA1(660610d92ae7e5f92bddf5a3bcc2296b2ec3946b) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( tmtron ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38800a88", 0x0000, 0x1000, CRC(33db9670) SHA1(d6f747a59356526698784047bcfdbb59e79b9a23) ) - ROM_CONTINUE( 0x1e80, 0x0100 ) -ROM_END - - -ROM_START( vinvader ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "hd38750a45", 0x0000, 0x0800, CRC(32de6056) SHA1(70238c6c40c3d513f8eced1cb81bdd4dbe12f16c) ) - ROM_CONTINUE( 0x0f00, 0x0080 ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -CONS( 1979, bambball, 0, 0, bambball, bambball, driver_device, 0, "Bambino", "Dribble Away Basketball", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1979, bmboxing, 0, 0, bmboxing, bmboxing, driver_device, 0, "Bambino", "Knock-Em Out Boxing", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1982, bfriskyt, 0, 0, bfriskyt, bfriskyt, driver_device, 0, "Bandai", "Frisky Tom (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1981, packmon, 0, 0, packmon, packmon, driver_device, 0, "Bandai", "Packri Monster", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, msthawk, 0, 0, msthawk, msthawk, driver_device, 0, "Bandai (Mattel license)", "Star Hawk (Mattel)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, bzaxxon, 0, 0, bzaxxon, bzaxxon, driver_device, 0, "Bandai", "Zaxxon (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -CONS( 1983, zackman, 0, 0, zackman, zackman, driver_device, 0, "Bandai", "Zackman", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1983, bpengo, 0, 0, bpengo, bpengo, driver_device, 0, "Bandai", "Pengo (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -CONS( 1983, bbtime, 0, 0, bbtime, bbtime, driver_device, 0, "Bandai", "Burger Time (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -CONS( 1983, bdoramon, 0, 0, bdoramon, bdoramon, driver_device, 0, "Bandai", "Dokodemo Dorayaki Doraemon", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1983, bultrman, 0, 0, bultrman, bultrman, driver_device, 0, "Bandai", "Ultra Man (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -CONS( 1984, machiman, 0, 0, machiman, machiman, driver_device, 0, "Bandai", "Machine Man", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1984, pairmtch, 0, 0, pairmtch, pairmtch, driver_device, 0, "Bandai", "Pair Match", MACHINE_SUPPORTS_SAVE ) - -CONS( 1981, alnattck, 0, 0, alnattck, alnattck, driver_device, 0, "Coleco", "Alien Attack", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, cdkong, 0, 0, cdkong, cdkong, driver_device, 0, "Coleco", "Donkey Kong (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_SOUND ) -CONS( 1982, cgalaxn, 0, 0, cgalaxn, cgalaxn, driver_device, 0, "Coleco", "Galaxian (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_SOUND ) -CONS( 1981, cpacman, 0, 0, cpacman, cpacman, driver_device, 0, "Coleco", "Pac-Man (Coleco, Rev. 29)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1981, cpacmanr1, cpacman, 0, cpacman, cpacman, driver_device, 0, "Coleco", "Pac-Man (Coleco, Rev. 28)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1983, cmspacmn, 0, 0, cmspacmn, cmspacmn, driver_device, 0, "Coleco", "Ms. Pac-Man (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1981, egalaxn2, 0, 0, egalaxn2, egalaxn2, driver_device, 0, "Entex", "Galaxian 2 (Entex)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1981, epacman2, 0, 0, egalaxn2, epacman2, driver_device, 0, "Entex", "Pac Man 2 (Entex)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, estargte, 0, 0, estargte, estargte, driver_device, 0, "Entex", "Stargate (Entex)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, eturtles, 0, 0, eturtles, eturtles, driver_device, 0, "Entex", "Turtles (Entex)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1980, ghalien, 0, 0, ghalien, ghalien, driver_device, 0, "Gakken", "Heiankyo Alien (Gakken)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, gckong, 0, 0, gckong, gckong, driver_device, 0, "Gakken", "Crazy Kong (Gakken)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -CONS( 1983, gdigdug, 0, 0, gdigdug, gdigdug, driver_device, 0, "Gakken", "Dig Dug (Gakken)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1980, mwcbaseb, 0, 0, mwcbaseb, mwcbaseb, driver_device, 0, "Mattel", "World Championship Baseball", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1983, pbqbert, 0, 0, pbqbert, pbqbert, driver_device, 0, "Parker Brothers", "Q*Bert (Parker Brothers)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1982, kingman, 0, 0, kingman, kingman, driver_device, 0, "Tomy", "Kingman", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1984, tmtron, 0, 0, tmtron, tmtron, driver_device, 0, "Tomy", "Tron (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1981, vinvader, 0, 0, vinvader, vinvader, driver_device, 0, "VTech", "Invaders (VTech)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mess/drivers/hh_melps4.c b/src/mess/drivers/hh_melps4.c deleted file mode 100644 index 92e4bd09228..00000000000 --- a/src/mess/drivers/hh_melps4.c +++ /dev/null @@ -1,473 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Kevin Horton -/*************************************************************************** - - Mitsubishi MELPS 4 MCU tabletops/handhelds or other simple devices, - most of them are VFD electronic games/toys. - -***************************************************************************/ - -#include "emu.h" -#include "cpu/melps4/m58846.h" -#include "sound/speaker.h" - -#include "hh_melps4_test.lh" // common test-layout - use external artwork - - -class hh_melps4_state : public driver_device -{ -public: - hh_melps4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_inp_matrix(*this, "IN"), - m_speaker(*this, "speaker"), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) - { } - - // devices - required_device m_maincpu; - optional_ioport_array<4> m_inp_matrix; // max 4 - optional_device m_speaker; - - // misc common - UINT16 m_inp_mux; // multiplexed inputs mask - - UINT8 read_inputs(int columns); - DECLARE_INPUT_CHANGED_MEMBER(reset_button); - - // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) - - UINT32 m_grid; // VFD current row data - UINT32 m_plate; // VFD current column data - - UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - UINT32 m_display_cache[0x20]; // (internal use) - UINT8 m_display_decay[0x20][0x20]; // (internal use) - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - -protected: - virtual void machine_start(); - virtual void machine_reset(); -}; - - -// machine start/reset - -void hh_melps4_state::machine_start() -{ - // zerofill - memset(m_display_state, 0, sizeof(m_display_state)); - memset(m_display_cache, ~0, sizeof(m_display_cache)); - memset(m_display_decay, 0, sizeof(m_display_decay)); - memset(m_display_segmask, 0, sizeof(m_display_segmask)); - - m_inp_mux = 0; - m_grid = 0; - m_plate = 0; - - // register for savestates - save_item(NAME(m_display_maxy)); - save_item(NAME(m_display_maxx)); - save_item(NAME(m_display_wait)); - - save_item(NAME(m_display_state)); - /* save_item(NAME(m_display_cache)); */ // don't save! - save_item(NAME(m_display_decay)); - save_item(NAME(m_display_segmask)); - - save_item(NAME(m_inp_mux)); - save_item(NAME(m_grid)); - save_item(NAME(m_plate)); -} - -void hh_melps4_state::machine_reset() -{ -} - - - -/*************************************************************************** - - Helper Functions - -***************************************************************************/ - -// The device may strobe the outputs very fast, it is unnoticeable to the user. -// To prevent flickering here, we need to simulate a decay. - -void hh_melps4_state::display_update() -{ - UINT32 active_state[0x20]; - - for (int y = 0; y < m_display_maxy; y++) - { - active_state[y] = 0; - - for (int x = 0; x <= m_display_maxx; x++) - { - // turn on powered segments - if (m_display_state[y] >> x & 1) - m_display_decay[y][x] = m_display_wait; - - // determine active state - UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; - active_state[y] |= (ds << x); - } - } - - // on difference, send to output - for (int y = 0; y < m_display_maxy; y++) - if (m_display_cache[y] != active_state[y]) - { - if (m_display_segmask[y] != 0) - output_set_digit_value(y, active_state[y] & m_display_segmask[y]); - - const int mul = (m_display_maxx <= 10) ? 10 : 100; - for (int x = 0; x <= m_display_maxx; x++) - { - int state = active_state[y] >> x & 1; - char buf1[0x10]; // lampyx - char buf2[0x10]; // y.x - - if (x == m_display_maxx) - { - // always-on if selected - sprintf(buf1, "lamp%da", y); - sprintf(buf2, "%d.a", y); - } - else - { - sprintf(buf1, "lamp%d", y * mul + x); - sprintf(buf2, "%d.%d", y, x); - } - output_set_value(buf1, state); - output_set_value(buf2, state); - } - } - - memcpy(m_display_cache, active_state, sizeof(m_display_cache)); -} - -TIMER_DEVICE_CALLBACK_MEMBER(hh_melps4_state::display_decay_tick) -{ - // slowly turn off unpowered segments - for (int y = 0; y < m_display_maxy; y++) - for (int x = 0; x <= m_display_maxx; x++) - if (m_display_decay[y][x] != 0) - m_display_decay[y][x]--; - - display_update(); -} - -void hh_melps4_state::set_display_size(int maxx, int maxy) -{ - m_display_maxx = maxx; - m_display_maxy = maxy; -} - -void hh_melps4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) -{ - set_display_size(maxx, maxy); - - // update current state - UINT32 mask = (1 << maxx) - 1; - for (int y = 0; y < maxy; y++) - m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; - - display_update(); -} - - -// generic input handlers - -UINT8 hh_melps4_state::read_inputs(int columns) -{ - UINT8 ret = 0; - - // read selected input rows - for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) - ret |= m_inp_matrix[i]->read(); - - return ret; -} - -INPUT_CHANGED_MEMBER(hh_melps4_state::reset_button) -{ - // for when reset button is directly tied to MCU reset pin - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); -} - - - -/*************************************************************************** - - Minidrivers (subclass, I/O, Inputs, Machine Config) - -***************************************************************************/ - -/*************************************************************************** - - Coleco Frogger (manufactured in Japan, licensed from Sega) - * PCB label Coleco Frogger Code No. 01-81543, KS-003282 Japan - * Mitsubishi M58846-701P MCU - * cyan/red/green VFD display Itron CP5090GLR R1B, with partial color overlay - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class cfrogger_state : public hh_melps4_state -{ -public: - cfrogger_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_melps4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_WRITE_LINE_MEMBER(speaker_w); - DECLARE_READ16_MEMBER(input_r); -}; - -// handlers - -void cfrogger_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,0,1,2,3,4,5,6,7,8,9,10,11); - UINT16 plate = BITSWAP16(m_plate,12,4,13,5,14,6,15,7,3,11,2,10,1,9,0,8); - display_matrix(16, 12, plate, grid); -} - -WRITE8_MEMBER(cfrogger_state::plate_w) -{ - // F0,F1: input mux - if (offset == MELPS4_PORTF) - m_inp_mux = data & 3; - - // Sx,Fx,Gx: vfd matrix plate - int mask = (offset == MELPS4_PORTS) ? 0xff : 0xf; // port S is 8-bit - int shift = (offset == MELPS4_PORTS) ? 0 : (offset + 1) * 4; - m_plate = (m_plate & ~(mask << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(cfrogger_state::grid_w) -{ - // D0-D11: vfd matrix grid - m_grid = data; - prepare_display(); -} - -WRITE_LINE_MEMBER(cfrogger_state::speaker_w) -{ - // T: speaker out - m_speaker->level_w(state); -} - -READ16_MEMBER(cfrogger_state::input_r) -{ - // K0,K1: multiplexed inputs - // K2: N/C - // K3: fixed input - return (m_inp_matrix[2]->read() & 8) | (read_inputs(2) & 3); -} - - -// config - -static INPUT_PORTS_START( cfrogger ) - PORT_START("IN.0") // F0 port K0,K1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - - PORT_START("IN.1") // F1 port K0,K1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - - PORT_START("IN.2") // K3 - PORT_CONFNAME( 0x08, 0x00, "Skill Level" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x08, "2" ) - - PORT_START("IN.3") // fake - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_melps4_state, reset_button, NULL) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( cfrogger, cfrogger_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M58846, XTAL_600kHz) - MCFG_MELPS4_READ_K_CB(READ16(cfrogger_state, input_r)) - MCFG_MELPS4_WRITE_S_CB(WRITE8(cfrogger_state, plate_w)) - MCFG_MELPS4_WRITE_F_CB(WRITE8(cfrogger_state, plate_w)) - MCFG_MELPS4_WRITE_G_CB(WRITE8(cfrogger_state, plate_w)) - MCFG_MELPS4_WRITE_D_CB(WRITE16(cfrogger_state, grid_w)) - MCFG_MELPS4_WRITE_T_CB(WRITELINE(cfrogger_state, speaker_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_melps4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_melps4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Gakken Jungler (manufactured in Japan, licensed from Konami) - * PCB label Konami Gakken GR503 - * Mitsubishi M58846-702P MCU - * cyan/red/green VFD display Itron CP5143GLR SGA, with light-yellow color overlay - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class gjungler_state : public hh_melps4_state -{ -public: - gjungler_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_melps4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE16_MEMBER(grid_w); - DECLARE_WRITE_LINE_MEMBER(speaker_w); - DECLARE_READ16_MEMBER(input_r); -}; - -// handlers - -void gjungler_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0,1); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,8,9,10,11,17,16,15,14,13,12,0,7,1,6,2,5,3,4) | 0x2000; - display_matrix(18, 12, plate, grid); -} - -WRITE8_MEMBER(gjungler_state::plate_w) -{ - // G0,G1: input mux - if (offset == MELPS4_PORTG) - m_inp_mux = data & 3; - - // Sx,Fx,Gx,U: vfd matrix plate - int mask = (offset == MELPS4_PORTS) ? 0xff : 0xf; // port S is 8-bit - int shift = (offset == MELPS4_PORTS) ? 0 : (offset + 1) * 4; - m_plate = (m_plate & ~(mask << shift)) | (data << shift); - prepare_display(); -} - -WRITE16_MEMBER(gjungler_state::grid_w) -{ - // D0-D11: vfd matrix grid - m_grid = data; - prepare_display(); -} - -WRITE_LINE_MEMBER(gjungler_state::speaker_w) -{ - // T: speaker out - m_speaker->level_w(state); -} - -READ16_MEMBER(gjungler_state::input_r) -{ - // K0,K1: multiplexed inputs - // K2,K3: fixed inputs - return (m_inp_matrix[2]->read() & 0xc) | (read_inputs(2) & 3); -} - - -// config - -static INPUT_PORTS_START( gjungler ) - PORT_START("IN.0") // G0 port K0,K1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - - PORT_START("IN.1") // G1 port K0,K1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - - PORT_START("IN.2") // K2,K3 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_CONFNAME( 0x08, 0x00, "Game Mode" ) - PORT_CONFSETTING( 0x00, "A" ) - PORT_CONFSETTING( 0x08, "B" ) - - PORT_START("IN.3") // fake - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_melps4_state, reset_button, NULL) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( gjungler, gjungler_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M58846, XTAL_600kHz) - MCFG_MELPS4_READ_K_CB(READ16(gjungler_state, input_r)) - MCFG_MELPS4_WRITE_S_CB(WRITE8(gjungler_state, plate_w)) - MCFG_MELPS4_WRITE_F_CB(WRITE8(gjungler_state, plate_w)) - MCFG_MELPS4_WRITE_G_CB(WRITE8(gjungler_state, plate_w)) - MCFG_MELPS4_WRITE_U_CB(WRITE8(gjungler_state, plate_w)) - MCFG_MELPS4_WRITE_D_CB(WRITE16(gjungler_state, grid_w)) - MCFG_MELPS4_WRITE_T_CB(WRITELINE(gjungler_state, speaker_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_melps4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_melps4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( cfrogger ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "m58846-701p", 0x0000, 0x1000, CRC(ba52a242) SHA1(7fa53b617f4bb54be32eb209e9b88131e11cb518) ) -ROM_END - - -ROM_START( gjungler ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "m58846-702p", 0x0000, 0x1000, CRC(94ab7060) SHA1(3389bc115d1df8d01a30611fa9e95a900d32b29b) ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -CONS( 1981, cfrogger, 0, 0, cfrogger, cfrogger, driver_device, 0, "Coleco", "Frogger (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1982, gjungler, 0, 0, gjungler, gjungler, driver_device, 0, "Gakken / Konami", "Jungler (Gakken)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/hh_pic16.c b/src/mess/drivers/hh_pic16.c deleted file mode 100644 index 4a6e6088450..00000000000 --- a/src/mess/drivers/hh_pic16.c +++ /dev/null @@ -1,302 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/*************************************************************************** - - GI PIC16xx-driven dedicated handhelds or other simple devices. - - known chips: - - serial device etc. ------------------------------------------------------------ - @036 1655A 1979, Ideal Maniac - *061 1655A 1980, Lakeside Le Boom (have dump) - *094 1655A 1980, GAF Melody Madness (have dump) - *110 1650A 1979, Tiger Rocket Pinball - *192 1650 19??, (a phone dialer, have dump) - *255 1655 19??, (a talking clock, have dump) - - (* denotes not yet emulated by MAME, @ denotes it's in this driver) - - - TODO: - - it doesn't work, emu/cpu/pic16c5x needs some love (dev note: hack to make it - playable: remove the TRIS masks) - -***************************************************************************/ - -#include "emu.h" -#include "cpu/pic16c5x/pic16c5x.h" -#include "sound/speaker.h" - -#include "maniac.lh" - - -class hh_pic16_state : public driver_device -{ -public: - hh_pic16_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_inp_matrix(*this, "IN"), - m_speaker(*this, "speaker"), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) - { } - - // devices - required_device m_maincpu; - optional_ioport_array<2> m_inp_matrix; // max 2 - optional_device m_speaker; - - // misc common - UINT8 m_b; // MCU port B data - UINT8 m_c; // MCU port C data - - // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) - - UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - UINT32 m_display_cache[0x20]; // (internal use) - UINT8 m_display_decay[0x20][0x20]; // (internal use) - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - -protected: - virtual void machine_start(); - virtual void machine_reset(); -}; - - -// machine start/reset - -void hh_pic16_state::machine_start() -{ - // zerofill - memset(m_display_state, 0, sizeof(m_display_state)); - memset(m_display_cache, ~0, sizeof(m_display_cache)); - memset(m_display_decay, 0, sizeof(m_display_decay)); - memset(m_display_segmask, 0, sizeof(m_display_segmask)); - - m_b = 0; - m_c = 0; - - // register for savestates - save_item(NAME(m_display_maxy)); - save_item(NAME(m_display_maxx)); - save_item(NAME(m_display_wait)); - - save_item(NAME(m_display_state)); - /* save_item(NAME(m_display_cache)); */ // don't save! - save_item(NAME(m_display_decay)); - save_item(NAME(m_display_segmask)); - - save_item(NAME(m_b)); - save_item(NAME(m_c)); -} - -void hh_pic16_state::machine_reset() -{ -} - - - -/*************************************************************************** - - Helper Functions - -***************************************************************************/ - -// The device may strobe the outputs very fast, it is unnoticeable to the user. -// To prevent flickering here, we need to simulate a decay. - -void hh_pic16_state::display_update() -{ - UINT32 active_state[0x20]; - - for (int y = 0; y < m_display_maxy; y++) - { - active_state[y] = 0; - - for (int x = 0; x <= m_display_maxx; x++) - { - // turn on powered segments - if (m_display_state[y] >> x & 1) - m_display_decay[y][x] = m_display_wait; - - // determine active state - UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; - active_state[y] |= (ds << x); - } - } - - // on difference, send to output - for (int y = 0; y < m_display_maxy; y++) - if (m_display_cache[y] != active_state[y]) - { - if (m_display_segmask[y] != 0) - output_set_digit_value(y, active_state[y] & m_display_segmask[y]); - - const int mul = (m_display_maxx <= 10) ? 10 : 100; - for (int x = 0; x <= m_display_maxx; x++) - { - int state = active_state[y] >> x & 1; - char buf1[0x10]; // lampyx - char buf2[0x10]; // y.x - - if (x == m_display_maxx) - { - // always-on if selected - sprintf(buf1, "lamp%da", y); - sprintf(buf2, "%d.a", y); - } - else - { - sprintf(buf1, "lamp%d", y * mul + x); - sprintf(buf2, "%d.%d", y, x); - } - output_set_value(buf1, state); - output_set_value(buf2, state); - } - } - - memcpy(m_display_cache, active_state, sizeof(m_display_cache)); -} - -TIMER_DEVICE_CALLBACK_MEMBER(hh_pic16_state::display_decay_tick) -{ - // slowly turn off unpowered segments - for (int y = 0; y < m_display_maxy; y++) - for (int x = 0; x <= m_display_maxx; x++) - if (m_display_decay[y][x] != 0) - m_display_decay[y][x]--; - - display_update(); -} - -void hh_pic16_state::set_display_size(int maxx, int maxy) -{ - m_display_maxx = maxx; - m_display_maxy = maxy; -} - -void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) -{ - set_display_size(maxx, maxy); - - // update current state - UINT32 mask = (1 << maxx) - 1; - for (int y = 0; y < maxy; y++) - m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; - - display_update(); -} - - - -/*************************************************************************** - - Minidrivers (subclass, I/O, Inputs, Machine Config) - -***************************************************************************/ - -/*************************************************************************** - - Ideal Maniac, by Ralph Baer - * PIC1655A-036 - - -***************************************************************************/ - -class maniac_state : public hh_pic16_state -{ -public: - maniac_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_pic16_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(output_w); -}; - -// handlers - -WRITE8_MEMBER(maniac_state::output_w) -{ - // B,C: outputs - offset -= PIC16C5x_PORTB; - if (offset) - m_c = data; - else - m_b = data; - - // d7: speaker out - m_speaker->level_w((m_b >> 7 & 1) | (m_c >> 6 & 2)); - - // d0-d6: 7seg - m_display_segmask[offset] = 0x7f; - m_display_state[offset] = ~data & 0x7f; - - set_display_size(7, 2); - display_update(); -} - - -// config - -static INPUT_PORTS_START( maniac ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // bottom-right - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // upper-right - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) // bottom-left - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) // upper-left -INPUT_PORTS_END - - -static const INT16 maniac_speaker_levels[] = { 0, 32767, -32768, 0 }; - -static MACHINE_CONFIG_START( maniac, maniac_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", PIC16C55, 850000) // RC osc. R=13.4K, C=470pf, but unknown RC curve - measured 800-890kHz - MCFG_PIC16C5x_READ_A_CB(IOPORT("IN.0")) - MCFG_PIC16C5x_WRITE_B_CB(WRITE8(maniac_state, output_w)) - MCFG_PIC16C5x_WRITE_C_CB(WRITE8(maniac_state, output_w)) - MCFG_PIC16C5x_SET_CONFIG(0) // ? - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_pic16_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_maniac) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(4, maniac_speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( maniac ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "pic1655a-036", 0x0000, 0x0400, CRC(a96f7011) SHA1(e97ae44d3c1e74c7e1024bb0bdab03eecdc9f827) ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -CONS( 1979, maniac, 0, 0, maniac, maniac, driver_device, 0, "Ideal", "Maniac", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/hh_sm510.c b/src/mess/drivers/hh_sm510.c deleted file mode 100644 index 87c42f538bb..00000000000 --- a/src/mess/drivers/hh_sm510.c +++ /dev/null @@ -1,402 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Sean Riddle -/*************************************************************************** - - Sharp SM510 MCU x.. - - TODO: - - barnacles - -***************************************************************************/ - -#include "emu.h" -#include "cpu/sm510/sm510.h" -#include "sound/speaker.h" - -#include "hh_sm510_test.lh" // common test-layout - use external artwork - - -class hh_sm510_state : public driver_device -{ -public: - hh_sm510_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_inp_matrix(*this, "IN"), - m_speaker(*this, "speaker"), - m_inp_lines(0) - { } - - // devices - required_device m_maincpu; - optional_ioport_array<5> m_inp_matrix; // max 5 - optional_device m_speaker; - - // misc common - UINT16 m_inp_mux; // multiplexed inputs mask - int m_inp_lines; // number of input mux columns - UINT8 m_lcd_output_cache[0x100]; - - UINT8 read_inputs(int columns); - - virtual void update_k_line(); - virtual DECLARE_INPUT_CHANGED_MEMBER(input_changed); - virtual DECLARE_READ8_MEMBER(input_r); - virtual DECLARE_WRITE8_MEMBER(input_w); - virtual DECLARE_WRITE16_MEMBER(lcd_segment_w); - -protected: - virtual void machine_start(); - virtual void machine_reset(); -}; - - -// machine start/reset - -void hh_sm510_state::machine_start() -{ - // zerofill - m_inp_mux = 0; -// m_inp_lines = 0; - memset(m_lcd_output_cache, ~0, sizeof(m_lcd_output_cache)); - - // register for savestates - save_item(NAME(m_inp_mux)); - save_item(NAME(m_inp_lines)); - /* save_item(NAME(m_lcd_output_cache)); */ // don't save! -} - -void hh_sm510_state::machine_reset() -{ -} - - - -/*************************************************************************** - - Helper Functions - -***************************************************************************/ - -// lcd panel - on lcd handhelds, usually not a generic x/y screen device - -WRITE16_MEMBER(hh_sm510_state::lcd_segment_w) -{ - for (int seg = 0; seg < 0x10; seg++) - { - int state = data >> seg & 1; - int index = offset << 4 | seg; - - if (state != m_lcd_output_cache[index]) - { - // output to x.y, where x = row a/b/bs/c*4 + H1-4, y = seg1-16 - char buf[0x10]; - sprintf(buf, "%d.%d", offset, seg); - output_set_value(buf, state); - - m_lcd_output_cache[index] = state; - } - } -} - - -// generic input handlers - usually S output is input mux, and K input for buttons - -UINT8 hh_sm510_state::read_inputs(int columns) -{ - UINT8 ret = 0; - - // read selected input rows - for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) - ret |= m_inp_matrix[i]->read(); - - return ret; -} - -void hh_sm510_state::update_k_line() -{ - // this is necessary because the MCU can wake up on K input activity - m_maincpu->set_input_line(SM510_INPUT_LINE_K, read_inputs(m_inp_lines) ? ASSERT_LINE : CLEAR_LINE); -} - -INPUT_CHANGED_MEMBER(hh_sm510_state::input_changed) -{ - update_k_line(); -} - -WRITE8_MEMBER(hh_sm510_state::input_w) -{ - m_inp_mux = data; - update_k_line(); -} - -READ8_MEMBER(hh_sm510_state::input_r) -{ - return read_inputs(m_inp_lines); -} - - - -/*************************************************************************** - - Minidrivers (subclass, I/O, Inputs, Machine Config) - -***************************************************************************/ - -/*************************************************************************** - - Konami Top Gun - * PCB label BH003 - * Sharp SM510 under epoxy (die label CMS54C, KMS598) - - The ROM listing "BH003 Top Gun" from patent US5137277 is identical to the - released version, except for 2 probable bit errors and filler bytes. Unused - pages list data too, of what looks like assembler leftover garbage. - -***************************************************************************/ - -class ktopgun_state : public hh_sm510_state -{ -public: - ktopgun_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_sm510_state(mconfig, type, tag) - { - m_inp_lines = 3; - } - - DECLARE_WRITE8_MEMBER(speaker_w); -}; - -// handlers - -WRITE8_MEMBER(ktopgun_state::speaker_w) -{ - m_speaker->level_w(data >> 0 & 1); -} - - -// config - -static INPUT_PORTS_START( ktopgun ) - PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - - PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // sel - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // sound on/off - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // off - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // fire - - PORT_START("IN.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // on - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ktopgun, ktopgun_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SM510, XTAL_32_768kHz) - MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r)) - MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w)) - MCFG_SM510_WRITE_R_CB(WRITE8(ktopgun_state, speaker_w)) - - MCFG_DEFAULT_LAYOUT(layout_hh_sm510_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Konami Teenage Mutant Ninja Turtles - * Sharp SM511 under epoxy (die label KMS 73B, KMS 774) - - The ROM listing "BH005 TMNT" from patent US5150899 is identical to the - released version, excluding filler bytes. - -***************************************************************************/ - -class ktmnt_state : public hh_sm510_state -{ -public: - ktmnt_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_sm510_state(mconfig, type, tag) - { - m_inp_lines = 3; - } - - DECLARE_WRITE8_MEMBER(speaker_w); -}; - -// handlers - -WRITE8_MEMBER(ktmnt_state::speaker_w) -{ - m_speaker->level_w(data >> 0 & 1); -} - - -// config - -static INPUT_PORTS_START( ktmnt ) - PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - - PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // game select - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // sound on/off - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // off - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // on/start - - PORT_START("IN.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ktmnt, ktmnt_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SM511, XTAL_32_768kHz) - MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r)) - MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w)) - MCFG_SM510_WRITE_R_CB(WRITE8(ktmnt_state, speaker_w)) - - MCFG_DEFAULT_LAYOUT(layout_hh_sm510_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Nintendo Game & Watch: Mickey & Donald (model DM-53) - * PCB label DM-53 - * Sharp SM510 label DM-53 (die label CMS54C, CMS565) - -***************************************************************************/ - -class gnwmndon_state : public hh_sm510_state -{ -public: - gnwmndon_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_sm510_state(mconfig, type, tag) - { - m_inp_lines = 2; - } - - DECLARE_WRITE8_MEMBER(speaker_w); -}; - -// handlers - -WRITE8_MEMBER(gnwmndon_state::speaker_w) -{ - m_speaker->level_w(data >> 1 & 1); -} - - -// config - -static INPUT_PORTS_START( gnwmndon ) - PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) - - PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // time - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // b - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // a - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_sm510_state, input_changed, NULL) // alarm -INPUT_PORTS_END - -static MACHINE_CONFIG_START( gnwmndon, gnwmndon_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SM510, XTAL_32_768kHz) - MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w)) - MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r)) - MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w)) - MCFG_SM510_WRITE_R_CB(WRITE8(gnwmndon_state, speaker_w)) - - MCFG_DEFAULT_LAYOUT(layout_hh_sm510_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( ktopgun ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "cms54c_kms598", 0x0000, 0x1000, CRC(50870b35) SHA1(cda1260c2e1c180995eced04b7d7ff51616dcef5) ) -ROM_END - - -ROM_START( ktmnt ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "kms_73b_774.prog", 0x0000, 0x1000, CRC(a1064f87) SHA1(92156c35fbbb414007ee6804fe635128a741d5f1) ) - - ROM_REGION( 0x100, "maincpu:music", 0 ) - ROM_LOAD( "kms_73b_774.music", 0x000, 0x100, CRC(8270d626) SHA1(bd91ca1d5cd7e2a62eef05c0033b19dcdbe441ca) ) -ROM_END - - -ROM_START( gnwmndon ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "dm53_cms54c_565", 0x0000, 0x1000, CRC(e21fc0f5) SHA1(3b65ccf9f98813319410414e11a3231b787cdee6) ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -CONS( 1989, ktopgun, 0, 0, ktopgun, ktopgun, driver_device, 0, "Konami", "Top Gun (Konami)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -CONS( 1989, ktmnt, 0, 0, ktmnt, ktmnt, driver_device, 0, "Konami", "Teenage Mutant Ninja Turtles (Konami)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) - -CONS( 1982, gnwmndon, 0, 0, gnwmndon, gnwmndon, driver_device, 0, "Nintendo", "Game & Watch: Mickey & Donald", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/hh_tms1k.c b/src/mess/drivers/hh_tms1k.c deleted file mode 100644 index 357d0f496fe..00000000000 --- a/src/mess/drivers/hh_tms1k.c +++ /dev/null @@ -1,4636 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Sean Riddle, Kevin Horton -/*************************************************************************** - - This driver is a collection of simple dedicated handheld and tabletop - toys based around the TMS1000 MCU series. Anything more complex or clearly - part of a series is (or will be) in its own driver. - - Let's use this driver for a list of known devices and their serials, - excluding TI's own products (see ticalc1x.c, tispeak.c) - - serial device etc. --------------------------------------------------------------------- - @CP0904A TMS0970 1977, Milton Bradley Comp IV - @MP0905B TMS0970 1977, Parker Brothers Codename Sector - *MP0168 TMS1000? 1979, Conic Basketball - @MP0914 TMS1000 1979, Entex Baseball 1 - @MP0923 TMS1000 1979, Entex Baseball 2 - @MP1030 TMS1100 1980, APF Mathemagician - @MP1133 TMS1470 1979, Kosmos Astro - @MP1204 TMS1100 1980, Entex Baseball 3 (6007) - @MP1211 TMS1100 1980, Entex Space Invader - @MP1218 TMS1100 1980, Entex Basketball 2 (6010) - @MP1221 TMS1100 1980, Entex Raise The Devil - *MP1296 TMS1100? 1982, Entex Black Knight - *MP1312 TMS1100 198?, Tandy/RadioShack Science Fair Microcomputer Trainer - *MP1359 TMS1100? 1985, Capsela CRC2000 - @MP1525 TMS1170 1980, Coleco Head to Head Baseball - *MP1604 ? 1981, Hanzawa Twinvader III/Tandy Cosmic Fire Away 3000 (? note: VFD-capable) - @MP2105 TMS1370 1979, Gakken Poker - *MP2139 TMS1370? 1982, Gakken Galaxy Invader 1000 - @MP2726 TMS1040 1979, Tomy Break Up - *MP2788 TMS1040? 1980, Bandai Flight Time (? note: VFD-capable) - *MP3208 TMS1000 1977, Milton Bradley Electronic Battleship (1977, model 4750A or B) - @MP3226 TMS1000 1978, Milton Bradley Simon (model 4850) - *MP3232 TMS1000 1979, Fonas 2-Player Baseball (no "MP" on chip label) - *MP3300 TMS1000 1980, Estrela Genius (from Brazil, looks and plays identical to Simon) - @MP3301A TMS1000 1979, Milton Bradley Big Trak - *MP3320A TMS1000 1979, Coleco Head to Head Basketball - *M32001 TMS1000 1981, Coleco Quiz Wiz Challenger (note: MP3398, MP3399, M3200x?) - MP3403 TMS1100 1978, Marx Electronic Bowling -> elecbowl.c - @MP3404 TMS1100 1978, Parker Brothers Merlin - @MP3405 TMS1100 1979, Coleco Amaze-A-Tron - *MP3415 TMS1100 1978, Coleco Electronic Quarterback - @MP3438A TMS1100 1979, Kenner Star Wars Electronic Battle Command - MP3450A TMS1100 1979, MicroVision cartridge: Blockbuster - MP3454 TMS1100 1979, MicroVision cartridge: Star Trek Phaser Strike - MP3455 TMS1100 1980, MicroVision cartridge: Pinball - MP3457 TMS1100 1979, MicroVision cartridge: Mindbuster - @MP3460 TMS1100 1980, Coleco Head to Head Football - MP3474 TMS1100 1979, MicroVision cartridge: Vegas Slots - MP3475 TMS1100 1979, MicroVision cartridge: Bowling - @MP3476 TMS1100 1979, Milton Bradley Super Simon - MP3479 TMS1100 1980, MicroVision cartridge: Baseball - MP3481 TMS1100 1979, MicroVision cartridge: Connect Four - *MP3491 TMS1100 1980, Mattel Horserace Analyzer - MP3496 TMS1100 1980, MicroVision cartridge: Sea Duel - M34009 TMS1100 1981, MicroVision cartridge: Alien Raiders (note: MP3498, MP3499, M3400x..) - M34017 TMS1100 1981, MicroVision cartridge: Cosmic Hunter - M34047 TMS1100 1982, MicroVision cartridge: Super Blockbuster - *M34078A TMS1100 1983, Milton Bradley Arcade Mania - @MP6100A TMS0980 1979, Ideal Electronic Detective - @MP6101B TMS0980 1979, Parker Brothers Stop Thief - *MP6361 ? 1983, Defender Strikes (? note: VFD-capable) - *MP7303 TMS1400? 19??, Tiger 7-in-1 Sports Stadium - @MP7313 TMS1400 1980, Parker Brothers Bank Shot - @MP7314 TMS1400 1980, Parker Brothers Split Second - *MP7324 TMS1400? 1985, Coleco Talking Teacher - MP7332 TMS1400 1981, Milton Bradley Dark Tower -> mbdtower.c - @MP7334 TMS1400 1981, Coleco Total Control 4 - @MP7351 TMS1400CR 1982, Parker Brothers Master Merlin - @MP7551 TMS1670 1980, Entex Color Football 4 (6009) - *MP7573 TMS1670? 1981, Entex Select-a-Game cartridge: Football 4 (? note: 40-pin, VFD-capable) - - inconsistent: - - @MPF553 TMS1670 1980, Gakken Jackpot: Gin Rummy & Black Jack - *M95041 ? 1983, Tsukuda Game Pachinko (? note: 40-pin, VFD-capable) - @CD7282SL TMS1100 1981, Tandy/RadioShack Tandy-12 (serial is similar to TI Speak & Spell series?) - - (* denotes not yet emulated by MAME, @ denotes it's in this driver) - - - TODO: - - verify output PLA and microinstructions PLA for MCUs that have been dumped - electronically (mpla is usually the default, opla is often custom) - - unknown MCU clocks for some: TMS1000 RC curve is documented in the data manual, - but not for newer ones (rev. E or TMS1400 MCUs). TMS0970/0980 osc. is on-die. - - some of the games rely on the fact that faster/longer strobed leds appear - brighter: tc4/h2hfootb(offense), bankshot(cue ball), ... - - add softwarelist for tc4 cartridges? - - stopthiep: unable to start a game (may be intentional?) - - tbreakup: some of the leds flicker (rom and PLAs doublechecked) - -***************************************************************************/ - -#include "includes/hh_tms1k.h" -#include "machine/tms1024.h" -#include "sound/beep.h" - -// internal artwork -#include "amaztron.lh" -#include "astro.lh" -#include "bankshot.lh" -#include "bigtrak.lh" -#include "cnsector.lh" -#include "comp4.lh" -#include "ebball.lh" -#include "ebball2.lh" -#include "ebball3.lh" -#include "ebaskb2.lh" -#include "efootb4.lh" -#include "einvader.lh" // test-layout(but still playable) -#include "elecdet.lh" -#include "gjackpot.lh" -#include "gpoker.lh" -#include "h2hbaseb.lh" -#include "h2hfootb.lh" -#include "mathmagi.lh" -#include "merlin.lh" // clickable -#include "mmerlin.lh" // clickable -#include "simon.lh" // clickable -#include "ssimon.lh" // clickable -#include "splitsec.lh" -#include "starwbc.lh" -#include "stopthie.lh" -#include "tandy12.lh" // clickable -#include "tbreakup.lh" -#include "tc4.lh" - -#include "hh_tms1k_test.lh" // common test-layout - use external artwork - - -// machine_start/reset - -void hh_tms1k_state::machine_start() -{ - // zerofill - memset(m_display_state, 0, sizeof(m_display_state)); - memset(m_display_cache, ~0, sizeof(m_display_cache)); - memset(m_display_decay, 0, sizeof(m_display_decay)); - memset(m_display_segmask, 0, sizeof(m_display_segmask)); - - m_o = 0; - m_r = 0; - m_inp_mux = 0; - m_power_led = false; - m_power_on = false; - m_grid = 0; - m_plate = 0; - - // register for savestates - save_item(NAME(m_display_maxy)); - save_item(NAME(m_display_maxx)); - save_item(NAME(m_display_wait)); - - save_item(NAME(m_display_state)); - /* save_item(NAME(m_display_cache)); */ // don't save! - /* save_item(NAME(m_power_led)); */ // don't save! - save_item(NAME(m_display_decay)); - save_item(NAME(m_display_segmask)); - - save_item(NAME(m_o)); - save_item(NAME(m_r)); - save_item(NAME(m_inp_mux)); - save_item(NAME(m_power_on)); - save_item(NAME(m_grid)); - save_item(NAME(m_plate)); -} - -void hh_tms1k_state::machine_reset() -{ - m_power_on = true; -} - - - -/*************************************************************************** - - Helper Functions - -***************************************************************************/ - -// The device may strobe the outputs very fast, it is unnoticeable to the user. -// To prevent flickering here, we need to simulate a decay. - -void hh_tms1k_state::display_update() -{ - UINT32 active_state[0x20]; - - for (int y = 0; y < m_display_maxy; y++) - { - active_state[y] = 0; - - for (int x = 0; x <= m_display_maxx; x++) - { - // turn on powered segments - if (m_power_on && m_display_state[y] >> x & 1) - m_display_decay[y][x] = m_display_wait; - - // determine active state - UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; - active_state[y] |= (ds << x); - } - } - - // on difference, send to output - for (int y = 0; y < m_display_maxy; y++) - if (m_display_cache[y] != active_state[y]) - { - if (m_display_segmask[y] != 0) - output_set_digit_value(y, active_state[y] & m_display_segmask[y]); - - const int mul = (m_display_maxx <= 10) ? 10 : 100; - for (int x = 0; x <= m_display_maxx; x++) - { - int state = active_state[y] >> x & 1; - char buf1[0x10]; // lampyx - char buf2[0x10]; // y.x - - if (x == m_display_maxx) - { - // always-on if selected - sprintf(buf1, "lamp%da", y); - sprintf(buf2, "%d.a", y); - } - else - { - sprintf(buf1, "lamp%d", y * mul + x); - sprintf(buf2, "%d.%d", y, x); - } - output_set_value(buf1, state); - output_set_value(buf2, state); - } - } - - memcpy(m_display_cache, active_state, sizeof(m_display_cache)); - - // output optional power led - if (m_power_led != m_power_on) - { - m_power_led = m_power_on; - output_set_value("power_led", m_power_led ? 1 : 0); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(hh_tms1k_state::display_decay_tick) -{ - // slowly turn off unpowered segments - for (int y = 0; y < m_display_maxy; y++) - for (int x = 0; x <= m_display_maxx; x++) - if (m_display_decay[y][x] != 0) - m_display_decay[y][x]--; - - display_update(); -} - -void hh_tms1k_state::set_display_size(int maxx, int maxy) -{ - m_display_maxx = maxx; - m_display_maxy = maxy; -} - -void hh_tms1k_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) -{ - set_display_size(maxx, maxy); - - // update current state - UINT32 mask = (1 << maxx) - 1; - for (int y = 0; y < maxy; y++) - m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; - - display_update(); -} - -void hh_tms1k_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask) -{ - // expects m_display_segmask to be not-0 - for (int y = 0; y < maxy; y++) - m_display_segmask[y] &= segmask; - - display_matrix(maxx, maxy, setx, sety); -} - - -UINT8 hh_tms1k_state::read_inputs(int columns) -{ - UINT8 ret = 0; - - // read selected input rows - for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) - ret |= m_inp_matrix[i]->read(); - - return ret; -} - - -// devices with a TMS0980 can auto power-off - -WRITE_LINE_MEMBER(hh_tms1k_state::auto_power_off) -{ - if (state) - { - m_power_on = false; - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - } -} - -INPUT_CHANGED_MEMBER(hh_tms1k_state::power_button) -{ - m_power_on = (bool)(FPTR)param; - m_maincpu->set_input_line(INPUT_LINE_RESET, m_power_on ? CLEAR_LINE : ASSERT_LINE); -} - - - -/*************************************************************************** - - Minidrivers (subclass, I/O, Inputs, Machine Config) - -***************************************************************************/ - -/*************************************************************************** - - APF Mathemagician - * TMS1100 MCU, labeled MP1030 - * 2 x DS8870N - Hex LED Digit Driver - * 2 x DS8861N - MOS-to-LED 5-Segment Driver - * 10-digit 7seg LED display(2 custom ones) + 4 LEDs, no sound - - This is a tabletop educational calculator. It came with plastic overlays - for playing different kind of games. Refer to the manual on how to use it. - In short, to start from scratch, press [SEL]. By default the device is in - calculator teaching mode. If [SEL] is followed with 1-6 and then [NXT], - one of the games is started. - - 1) Number Machine - 2) Countin' On - 3) Walk The Plank - 4) Gooey Gumdrop - 5) Football - 6) Lunar Lander - -***************************************************************************/ - -class mathmagi_state : public hh_tms1k_state -{ -public: - mathmagi_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void mathmagi_state::prepare_display() -{ - // R0-R7: 7seg leds - for (int y = 0; y < 8; y++) - { - m_display_segmask[y] = 0x7f; - m_display_state[y] = (m_r >> y & 1) ? (m_o >> 1) : 0; - } - - // R8: custom math symbols digit - // R9: custom equals digit - // R10: misc lamps - for (int y = 8; y < 11; y++) - m_display_state[y] = (m_r >> y & 1) ? m_o : 0; - - set_display_size(8, 11); - display_update(); -} - -WRITE16_MEMBER(mathmagi_state::write_r) -{ - // R3,R5-R7,R9,R10: input mux - m_inp_mux = (data >> 3 & 1) | (data >> 4 & 0xe) | (data >> 5 & 0x30); - - // +others: - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(mathmagi_state::write_o) -{ - // O1-O7: digit segments A-G - // O0: N/C - data = (data << 1 & 0xfe) | (data >> 7 & 1); // because opla is unknown - m_o = data; -} - -READ8_MEMBER(mathmagi_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(6); -} - - -// config - -/* physical button layout and labels is like this: - - ON ONE [SEL] [NXT] [?] [/] - | | [7] [8] [9] [x] - OFF TWO [4] [5] [6] [-] - PLAYERS [1] [2] [3] [+] - [0] [_] [r] [=] -*/ - -static INPUT_PORTS_START( mathmagi ) - PORT_START("IN.0") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - - PORT_START("IN.1") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("_") // blank - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("r") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - - PORT_START("IN.2") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - - PORT_START("IN.3") // R7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("SEL") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("NXT") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("?") // check - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - - PORT_START("IN.4") // R9 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - - PORT_START("IN.5") // R10 - PORT_CONFNAME( 0x01, 0x00, "Players") - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x01, "2" ) - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -// output PLA is not dumped -static const UINT16 mathmagi_output_pla[0x20] = -{ - lA+lB+lC+lD+lE+lF, // 0 - lB+lC, // 1 - lA+lB+lG+lE+lD, // 2 - lA+lB+lG+lC+lD, // 3 - lF+lB+lG+lC, // 4 - lA+lF+lG+lC+lD, // 5 - lA+lF+lG+lC+lD+lE, // 6 - lA+lB+lC, // 7 - lA+lB+lC+lD+lE+lF+lG, // 8 - lA+lB+lG+lF+lC+lD, // 9 - lA+lB+lG+lE, // question mark - lE+lG, // r - lD, // underscore? - lA+lF+lG+lE+lD, // E - lG, // - - 0, // empty - 0, // empty - lG, // lamp 4 or MATH - - lD, // lamp 3 - lF+lE+lD+lC+lG, // b - lB, // lamp 2 - lB+lG, // MATH + - lB+lC, // MATH mul - lF+lG+lB+lC+lD, // y - lA, // lamp 1 - lA+lG, // MATH div - lA+lD, // EQUALS - 0, // ? - 0, // ? - lE+lD+lC+lG, // o - 0, // ? - lA+lF+lE+lD+lC // G -}; - -static MACHINE_CONFIG_START( mathmagi, mathmagi_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 175000) // RC osc. R=68K, C=82pf -> ~175kHz - MCFG_TMS1XXX_OUTPUT_PLA(mathmagi_output_pla) - MCFG_TMS1XXX_READ_K_CB(READ8(mathmagi_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mathmagi_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mathmagi_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_mathmagi) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Amaze-A-Tron, by Ralph Baer - * TMS1100 MCU, labeled MP3405(die label too) - * 2-digit 7seg LED display + 2 LEDs(one red, one green), 1bit sound - * 5x5 pressure-sensitive playing board - - This is an electronic board game with a selection of 8 maze games, - most of them for 2 players. A 5x5 playing grid and four markers are - required to play. Refer to the official manual for more information. - -***************************************************************************/ - -class amaztron_state : public hh_tms1k_state -{ -public: - amaztron_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void amaztron_state::prepare_display() -{ - // R8,R9: select digit - for (int y = 0; y < 2; y++) - { - m_display_segmask[y] = 0x7f; - m_display_state[y] = (m_r >> (y + 8) & 1) ? m_o : 0; - } - - // R6,R7: lamps (-> lamp20,21) - m_display_state[2] = m_r >> 6 & 3; - - set_display_size(8, 3); - display_update(); -} - -WRITE16_MEMBER(amaztron_state::write_r) -{ - // R0-R5: input mux - m_inp_mux = data & 0x3f; - - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // other bits: - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(amaztron_state::write_o) -{ - // O0-O6: digit segments A-G - // O7: N/C - m_o = data & 0x7f; - prepare_display(); -} - -READ8_MEMBER(amaztron_state::read_k) -{ - // K: multiplexed inputs - UINT8 k = read_inputs(6); - - // the 5th column is tied to K4+K8 - if (k & 0x10) k |= 0xc; - return k & 0xf; -} - - -// config - -static INPUT_PORTS_START( amaztron ) - PORT_START("IN.0") // R0 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Grid 1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Grid 6") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Grid 11") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Grid 16") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("Grid 21") - - PORT_START("IN.1") // R1 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Grid 2") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Grid 7") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Grid 12") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Grid 17") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Grid 22") - - PORT_START("IN.2") // R2 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Grid 3") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Grid 8") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Grid 13") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Grid 18") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Grid 23") - - PORT_START("IN.3") // R3 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Grid 4") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_NAME("Grid 9") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Grid 14") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Grid 19") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Grid 24") - - PORT_START("IN.4") // R4 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Grid 5") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_NAME("Grid 10") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Grid 15") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Grid 20") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Grid 25") - - PORT_START("IN.5") // R5 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Game Select") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("Game Start") - PORT_BIT(0x1c, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( amaztron, amaztron_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K?, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(amaztron_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(amaztron_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(amaztron_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_amaztron) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Head to Head Baseball - * PCB labels Coleco rev C 73891/2 - * TMS1170NLN MP1525-N2 (die labeled MP1525) - * 9-digit cyan VFD display, and other LEDs behind bezel, 1bit sound - - known releases: - - USA: Head to Head Baseball - - Japan: Computer Baseball, published by Tsukuda - -***************************************************************************/ - -class h2hbaseb_state : public hh_tms1k_state -{ -public: - h2hbaseb_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); - - void set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(skill_switch); - -protected: - virtual void machine_reset(); -}; - -// handlers - -void h2hbaseb_state::prepare_display() -{ - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); - display_matrix_seg(9, 9, (m_r & 0x100) | m_o, (m_r & 0xff) | (m_r >> 1 & 0x100), 0x7f); -} - -WRITE16_MEMBER(h2hbaseb_state::write_r) -{ - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R4-R7: input mux - m_inp_mux = data >> 4 & 0xf; - - // R0-R7,R9: select vfd digit/led - // R8: led state - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(h2hbaseb_state::write_o) -{ - // O0-O6: digit segments A-G - // O7: N/C - m_o = data; - prepare_display(); -} - -READ8_MEMBER(h2hbaseb_state::read_k) -{ - // K: multiplexed inputs (note: K8(Vss row) is always on) - return m_inp_matrix[4]->read() | read_inputs(4); -} - - -// config - -static INPUT_PORTS_START( h2hbaseb ) - PORT_START("IN.0") // R4 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("N") - PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("B") - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("S") - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Curve") // these two buttons appear twice on the board - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Fast Pitch") - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // Vss! - PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Swing") - - PORT_START("IN.5") // fake - PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, h2hbaseb_state, skill_switch, NULL) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x01, "2" ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(h2hbaseb_state::skill_switch) -{ - set_clock(); -} - - -void h2hbaseb_state::set_clock() -{ - // MCU clock is from an RC circuit with C=47pf, and R value is depending on - // skill switch: R=51K(1) or 43K(2) - m_maincpu->set_unscaled_clock((m_inp_matrix[5]->read() & 1) ? 400000 : 350000); -} - -void h2hbaseb_state::machine_reset() -{ - hh_tms1k_state::machine_reset(); - set_clock(); -} - -static MACHINE_CONFIG_START( h2hbaseb, h2hbaseb_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1170, 350000) // see set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(h2hbaseb_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hbaseb_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hbaseb_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_h2hbaseb) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Head to Head Football - * TMS1100NLLE (rev. E!) MP3460 (die labeled MP3460) - * 2*SN75492N LED display drivers, 9-digit LED grid, 1bit sound - - LED electronic football game. To distinguish between offense and defense, - offense blips (should) appear brighter. - -***************************************************************************/ - -class h2hfootb_state : public hh_tms1k_state -{ -public: - h2hfootb_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void h2hfootb_state::prepare_display() -{ - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); - display_matrix_seg(9, 9, m_o | (m_r >> 1 & 0x100), (m_r & 0x1ff), 0x7f); -} - -WRITE16_MEMBER(h2hfootb_state::write_r) -{ - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R0-R8: input mux - m_inp_mux = data & 0x1ff; - - // R0-R8: select led - // R9: led between digits - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(h2hfootb_state::write_o) -{ - // O0-O7: digit segments A-G,A' - m_o = data; - prepare_display(); -} - -READ8_MEMBER(h2hfootb_state::read_k) -{ - // K: multiplexed inputs - UINT8 k = 0; - - // compared to the usual setup, the button matrix is rotated - for (int i = 0; i < 4; i++) - if (m_inp_matrix[i]->read() & m_inp_mux) - k |= 1 << i; - - return k; -} - - -// config - -static INPUT_PORTS_START( h2hfootb ) - PORT_START("IN.0") // K1 - PORT_CONFNAME( 0x03, 0x01, "Players" ) - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - - PORT_START("IN.1") // K2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_TOGGLE PORT_NAME("P1 Play Selector") // pass - PORT_BIT( 0x02, 0x02, IPT_SPECIAL ) PORT_CONDITION("IN.1", 0x01, EQUALS, 0x00) // run/kick - - PORT_START("IN.2") // K4 - PORT_CONFNAME( 0x03, 0x01, "Skill Level" ) - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - - PORT_START("IN.3") // K8 - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("P1 Left/Right") - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Kick/Pass") - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Display") - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY -INPUT_PORTS_END - -static MACHINE_CONFIG_START( h2hfootb, h2hfootb_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 325000) // approximation - RC osc. R=39K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(h2hfootb_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(h2hfootb_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(h2hfootb_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_h2hfootb) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Coleco Total Control 4 - * TMS1400NLL MP7334-N2 (die labeled MP7334) - * 2x2-digit 7seg LED display + 4 LEDs, LED grid display, 1bit sound - - This is a head to head electronic tabletop LED-display sports console. - One cartridge(Football) was included with the console, the other three were - sold in a pack. Gameplay has emphasis on strategy, read the official manual - on how to play. Remember that you can rotate the view in MAME: rotate left - for Home(P1) orientation, rotate right for Visitor(P2) orientation. - - Cartridge socket: - 1 N/C - 2 9V+ - 3 power switch - 4 K8 - 5 K4 - 6 K2 - 7 K1 - 8 R9 - - The cartridge connects pin 8 with one of the K-pins. - - Available cartridges: - - Football (K8, confirmed) - - Hockey (K4?) - - Soccer (K2?) - - Basketball (K1?) - -***************************************************************************/ - -class tc4_state : public hh_tms1k_state -{ -public: - tc4_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void tc4_state::prepare_display() -{ - // R5,R7-R9 are 7segs - for (int y = 5; y < 10; y++) - if (y != 6) - m_display_segmask[y] = 0x7f; - - // update current state (note: R6 as extra column!) - display_matrix(9, 10, (m_o | (m_r << 2 & 0x100)), m_r); -} - -WRITE16_MEMBER(tc4_state::write_r) -{ - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R0-R5: input mux - // R9: to cartridge slot - m_inp_mux = (data & 0x3f) | (data >> 3 & 0x40); - - // R0-R4: select led - // R6: led 8 state - // R5,R7-R9: select digit - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(tc4_state::write_o) -{ - // O0-O7: led state - m_o = data; - prepare_display(); -} - -READ8_MEMBER(tc4_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(7); -} - - -// config - -static INPUT_PORTS_START( tc4 ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Pass/Shoot Button 3") // right - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Pass/Shoot Button 1") // left - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Pass/Shoot Button 2") // middle - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 D/K Button") - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(2) - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Pass/Shoot Button 3") // right - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Pass/Shoot Button 1") // left - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Pass/Shoot Button 2") // middle - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 D/K Button") - - PORT_START("IN.6") // R9 - PORT_CONFNAME( 0x0f, 0x08, "Cartridge") - PORT_CONFSETTING( 0x01, "Basketball" ) - PORT_CONFSETTING( 0x02, "Soccer" ) - PORT_CONFSETTING( 0x04, "Hockey" ) - PORT_CONFSETTING( 0x08, "Football" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( tc4, tc4_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=27.3K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(tc4_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tc4_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tc4_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_tc4) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex (Electronic) Baseball (1) - * TMS1000NLP MP0914 (die labeled MP0914A) - * 1 7seg LED, and other LEDs behind bezel, 1bit sound - - This is a handheld LED baseball game. One player controls the batter, the CPU - or other player controls the pitcher. Pitcher throw buttons are on a 'joypad' - obtained from a compartment in the back. Player scores are supposed to be - written down manually, the game doesn't save scores or innings (this annoyance - was resolved in the sequel). For more information, refer to the official manual. - - The overlay graphic is known to have 2 versions: one where the field players - are denoted by words ("left", "center", "short", etc), and an alternate one - with little guys drawn next to the LEDs. - - lamp translation table: led LDzz from game PCB = MAME lampyx: - - LD0 = - LD10 = lamp12 LD20 = lamp42 LD30 = lamp60 - LD1 = lamp23 LD11 = lamp4 LD21 = lamp41 LD31 = lamp61 - LD2 = lamp0 LD12 = lamp15 LD22 = lamp40 LD32 = lamp62 - LD3 = lamp1 LD13 = lamp22 LD23 = lamp43 LD33 = lamp70 - LD4 = lamp2 LD14 = lamp33 LD24 = lamp53 LD34 = lamp71 - LD5 = lamp10 LD15 = lamp32 LD25 = lamp52 - LD6 = lamp13 LD16 = lamp21 LD26 = lamp51 - LD7 = lamp11 LD17 = lamp31 LD27 = lamp50 - LD8 = lamp3 LD18 = lamp30 LD28 = lamp72 - LD9 = lamp14 LD19 = lamp20 LD29 = lamp73 - -***************************************************************************/ - -class ebball_state : public hh_tms1k_state -{ -public: - ebball_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void ebball_state::prepare_display() -{ - // R8 is a 7seg - m_display_segmask[8] = 0x7f; - - display_matrix(7, 9, ~m_o, m_r); -} - -WRITE16_MEMBER(ebball_state::write_r) -{ - // R1-R5: input mux - m_inp_mux = data >> 1 & 0x1f; - - // R9: speaker out - m_speaker->level_w(data >> 9 & 1); - - // R0-R8: led select - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(ebball_state::write_o) -{ - // O0-O6: led state - // O7: N/C - m_o = data & 0x7f; - prepare_display(); -} - -READ8_MEMBER(ebball_state::read_k) -{ - // K: multiplexed inputs (note: K8(Vss row) is always on) - return m_inp_matrix[5]->read() | read_inputs(5); -} - - -// config - -static INPUT_PORTS_START( ebball ) - PORT_START("IN.0") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Change Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Change Sides") - PORT_CONFNAME( 0x04, 0x04, "Players" ) - PORT_CONFSETTING( 0x04, "1" ) // Auto - PORT_CONFSETTING( 0x00, "2" ) // Manual - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Fast Ball") - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Knuckler") - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Curve") - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Slider") - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.5") // Vss! - PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Batter") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ebball, ebball_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 375000) // RC osc. R=43K, C=47pf -> ~375kHz - MCFG_TMS1XXX_READ_K_CB(READ8(ebball_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ebball) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex (Electronic) Baseball 2 - * PCBs are labeled: ZENY - * TMS1000 MCU, MP0923 (die labeled MP0923) - * 3 7seg LEDs, and other LEDs behind bezel, 1bit sound - - The Japanese version was published by Gakken, black casing instead of white. - - The sequel to Entex Baseball, this version keeps up with score and innings. - As its predecessor, the pitcher controls are on a separate joypad. - - lamp translation table: led zz from game PCB = MAME lampyx: - - 00 = - 10 = lamp94 20 = lamp74 30 = lamp50 - 01 = lamp53 11 = lamp93 21 = lamp75 31 = lamp51 - 02 = lamp7 12 = lamp92 22 = lamp80 32 = lamp52 - 03 = lamp17 13 = lamp62 23 = lamp81 33 = lamp40 - 04 = lamp27 14 = lamp70 24 = lamp82 34 = lamp41 - 05 = lamp97 15 = lamp71 25 = lamp83 35 = lamp31 - 06 = lamp90 16 = lamp61 26 = lamp84 36 = lamp30 - 07 = lamp95 17 = lamp72 27 = lamp85 37 = lamp33 - 08 = lamp63 18 = lamp73 28 = lamp42 38 = lamp32 - 09 = lamp91 19 = lamp60 29 = lamp43 - -***************************************************************************/ - -class ebball2_state : public hh_tms1k_state -{ -public: - ebball2_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void ebball2_state::prepare_display() -{ - // R0-R2 are 7segs - for (int y = 0; y < 3; y++) - m_display_segmask[y] = 0x7f; - - display_matrix(8, 10, ~m_o, m_r ^ 0x7f); -} - -WRITE16_MEMBER(ebball2_state::write_r) -{ - // R3-R6: input mux - m_inp_mux = data >> 3 & 0xf; - - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R0-R9: led select - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(ebball2_state::write_o) -{ - // O0-O7: led state - m_o = data; - prepare_display(); -} - -READ8_MEMBER(ebball2_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(4); -} - - -// config - -static INPUT_PORTS_START( ebball2 ) - PORT_START("IN.0") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_CONFNAME( 0x02, 0x02, "Players" ) - PORT_CONFSETTING( 0x02, "1" ) // Auto - PORT_CONFSETTING( 0x00, "2" ) // Manual - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Fast Ball") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Batter") - - PORT_START("IN.1") // R4 - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Steal") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Change Up") - PORT_BIT( 0x09, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // R5 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Slider") - PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Knuckler") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Curve") - PORT_BIT( 0x0a, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ebball2, ebball2_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=47K, C=47pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(ebball2_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball2_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball2_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ebball2) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex (Electronic) Baseball 3 - * PCBs are labeled: ZENY - * TMS1100NLL 6007 MP1204 (rev. E!) (die labeled MP1204) - * 2*SN75492N LED display driver - * 4 7seg LEDs, and other LEDs behind bezel, 1bit sound - - This is another improvement over Entex Baseball, where gameplay is a bit more - varied. Like the others, the pitcher controls are on a separate joypad. - - lamp translation table: led zz from game PCB = MAME lampyx: - note: unlabeled panel leds are listed here as Sz, Bz, Oz, Iz, z left-to-right - - 00 = - 10 = lamp75 20 = lamp72 - 01 = lamp60 11 = lamp65 21 = lamp84 - 02 = lamp61 12 = lamp55 22 = lamp85 - 03 = lamp62 13 = lamp52 23 = lamp90 - 04 = lamp63 14 = lamp80 24 = lamp92 - 05 = lamp73 15 = lamp81 25 = lamp91 - 06 = lamp53 16 = lamp51 26 = lamp93 - 07 = lamp74 17 = lamp82 27 = lamp95 - 08 = lamp64 18 = lamp83 28 = lamp94 - 09 = lamp54 19 = lamp50 - - S1,S2: lamp40,41 - B1-B3: lamp30-32 - O1,O2: lamp42,43 - I1-I6: lamp20-25, I7-I9: lamp33-35 - -***************************************************************************/ - -class ebball3_state : public hh_tms1k_state -{ -public: - ebball3_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); - - void set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(skill_switch); - -protected: - virtual void machine_reset(); -}; - -// handlers - -void ebball3_state::prepare_display() -{ - // update current state - for (int y = 0; y < 10; y++) - m_display_state[y] = (m_r >> y & 1) ? m_o : 0; - - // R0,R1 are normal 7segs - m_display_segmask[0] = m_display_segmask[1] = 0x7f; - - // R4,R7 contain segments(only F and B) for the two other digits - m_display_state[10] = (m_display_state[4] & 0x20) | (m_display_state[7] & 0x02); - m_display_state[11] = ((m_display_state[4] & 0x10) | (m_display_state[7] & 0x01)) << 1; - m_display_segmask[10] = m_display_segmask[11] = 0x22; - - set_display_size(7, 10+2); - display_update(); -} - -WRITE16_MEMBER(ebball3_state::write_r) -{ - // R0-R2: input mux - m_inp_mux = data & 7; - - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R0-R9: led select - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(ebball3_state::write_o) -{ - // O0-O6: led state - // O7: N/C - m_o = data & 0x7f; - prepare_display(); -} - -READ8_MEMBER(ebball3_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(3); -} - - -// config - -/* physical button layout and labels is like this: - - main device (batter side): remote pitcher: - - MAN - PRO | [FAST BALL] [CHANGE UP] [CURVE] [SLIDER] - | OFF| - o o [STEAL DEFENSE] [KNUCKLER] - AM AUTO - - [BUNT] [BATTER] [STEAL] -*/ - -static INPUT_PORTS_START( ebball3 ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Fast Ball") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Change Up") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Slider") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Curve") - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Knuckler") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Steal") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Batter") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Steal Defense") - - PORT_START("IN.2") // R2 - PORT_CONFNAME( 0x01, 0x01, "Players" ) - PORT_CONFSETTING( 0x01, "1" ) // Auto - PORT_CONFSETTING( 0x00, "2" ) // Manual - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Bunt") - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // fake - PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ebball3_state, skill_switch, NULL) - PORT_CONFSETTING( 0x00, "Amateur" ) - PORT_CONFSETTING( 0x01, "Professional" ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(ebball3_state::skill_switch) -{ - set_clock(); -} - - -void ebball3_state::set_clock() -{ - // MCU clock is from an RC circuit(R=47K, C=33pf) oscillating by default at ~340kHz, - // but on PRO, the difficulty switch adds an extra 150K resistor to Vdd to speed - // it up to around ~440kHz. - m_maincpu->set_unscaled_clock((m_inp_matrix[3]->read() & 1) ? 440000 : 340000); -} - -void ebball3_state::machine_reset() -{ - hh_tms1k_state::machine_reset(); - set_clock(); -} - -static MACHINE_CONFIG_START( ebball3, ebball3_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 340000) // see set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(ebball3_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball3_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball3_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ebball3) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex Space Invader - * TMS1100 MP1211 (die labeled MP1211) - * 3 7seg LEDs, LED matrix and overlay mask, 1bit sound - - There are two versions of this game: the first release(this one) is on - TMS1100, the second more widespread release runs on a COP400. There are - also differences with the overlay mask. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class einvader_state : public hh_tms1k_state -{ -public: - einvader_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - - void set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(skill_switch); - -protected: - virtual void machine_reset(); -}; - -// handlers - -void einvader_state::prepare_display() -{ - // R7-R9 are 7segs - for (int y = 7; y < 10; y++) - m_display_segmask[y] = 0x7f; - - display_matrix(8, 10, m_o, m_r); -} - -WRITE16_MEMBER(einvader_state::write_r) -{ - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R0-R9: led select - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(einvader_state::write_o) -{ - // O0-O7: led state - m_o = data; - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( einvader ) - PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_CONFNAME( 0x08, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, einvader_state, skill_switch, NULL) - PORT_CONFSETTING( 0x00, "Amateur" ) - PORT_CONFSETTING( 0x08, "Professional" ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(einvader_state::skill_switch) -{ - set_clock(); -} - - -void einvader_state::set_clock() -{ - // MCU clock is from an RC circuit(R=47K, C=56pf) oscillating by default at ~320kHz, - // but on PRO, the difficulty switch adds an extra 180K resistor to Vdd to speed - // it up to around ~400kHz. - m_maincpu->set_unscaled_clock((m_inp_matrix[0]->read() & 8) ? 400000 : 320000); -} - -void einvader_state::machine_reset() -{ - hh_tms1k_state::machine_reset(); - set_clock(); -} - -static MACHINE_CONFIG_START( einvader, einvader_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 320000) // see set_clock - MCFG_TMS1XXX_READ_K_CB(IOPORT("IN.0")) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(einvader_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(einvader_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_einvader) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex Color Football 4 - * TMS1670 6009 MP7551 (die also labeled MP7551) - * 9-digit cyan VFD display, 60 red and green LEDs behind bezel, 1bit sound - -***************************************************************************/ - -class efootb4_state : public hh_tms1k_state -{ -public: - efootb4_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void efootb4_state::prepare_display() -{ - // R10-R15 are 7segs - for (int y = 10; y < 16; y++) - m_display_segmask[y] = 0x7f; - - display_matrix(7, 16, m_o, m_r); -} - -WRITE16_MEMBER(efootb4_state::write_r) -{ - // R0-R4: input mux - m_inp_mux = data & 0x1f; - - // R0-R9: led select - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(efootb4_state::write_o) -{ - // O7: speaker out - m_speaker->level_w(data >> 7 & 1); - - // O0-O6: led state - m_o = data; - prepare_display(); -} - -READ8_MEMBER(efootb4_state::read_k) -{ - return read_inputs(5); -} - - -// config - -static INPUT_PORTS_START( efootb4 ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY // 1 - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY // 2 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY // 3 - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY // 4 - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY // 1 - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY // 2 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY // 3 - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY // 4 - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Run") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Pass") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Kick") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Run") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Pass") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL PORT_NAME("P2 Kick") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // R4 - PORT_CONFNAME( 0x01, 0x01, "Players" ) - PORT_CONFSETTING( 0x01, "1" ) // Auto - PORT_CONFSETTING( 0x00, "2" ) // Manual - PORT_CONFNAME( 0x02, 0x00, "Skill Level" ) - PORT_CONFSETTING( 0x00, "Amateur" ) - PORT_CONFSETTING( 0x02, "Professional" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Status") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( efootb4, efootb4_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1670, 475000) // approximation - RC osc. R=42K, C=47pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(efootb4_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(efootb4_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(efootb4_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_efootb4) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex (Electronic) Basketball 2 - * TMS1100 6010 MP1218 (die also labeled MP1218) - * 4 7seg LEDs, and other LEDs behind bezel, 1bit sound - - lamp translation table: led zz from game PCB = MAME lampyx: - - 11 = lamp90 21 = lamp91 31 = lamp92 41 = lamp93 51 = lamp95 - 12 = lamp80 22 = lamp81 32 = lamp82 42 = lamp83 52 = lamp85 - 13 = lamp70 23 = lamp71 33 = lamp72 43 = lamp73 53 = lamp84 - 14 = lamp60 24 = lamp61 34 = lamp62 44 = lamp63 54 = lamp75 - 15 = lamp50 25 = lamp51 35 = lamp52 45 = lamp53 55 = lamp74 - 16 = lamp40 26 = lamp41 36 = lamp42 46 = lamp43 56 = lamp65 - - A = lamp94 - B = lamp64 - -***************************************************************************/ - -class ebaskb2_state : public hh_tms1k_state -{ -public: - ebaskb2_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void ebaskb2_state::prepare_display() -{ - // R0-R3 are 7segs - for (int y = 0; y < 4; y++) - m_display_segmask[y] = 0x7f; - - display_matrix(7, 10, m_o, m_r); -} - -WRITE16_MEMBER(ebaskb2_state::write_r) -{ - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R6-R9: input mux - m_inp_mux = data >> 6 & 0xf; - - // R0-R9: led select - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(ebaskb2_state::write_o) -{ - // O0-O6: led state - // O7: N/C - m_o = data; - prepare_display(); -} - -READ8_MEMBER(ebaskb2_state::read_k) -{ - return read_inputs(4); -} - - -// config - -static INPUT_PORTS_START( ebaskb2 ) - PORT_START("IN.0") // R6 - PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) - PORT_CONFSETTING( 0x01, "Amateur" ) - PORT_CONFSETTING( 0x00, "Professional" ) - PORT_CONFNAME( 0x02, 0x02, "Players" ) - PORT_CONFSETTING( 0x02, "1" ) // Auto - PORT_CONFSETTING( 0x00, "2" ) // Manual - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Shoot") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Pass") - - PORT_START("IN.1") // R7 - PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Pass") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Shoot") - - PORT_START("IN.2") // R8 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY - - PORT_START("IN.3") // R9 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ebaskb2, ebaskb2_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 360000) // RC osc. R=33K, C=82pf -> ~360kHz - MCFG_TMS1XXX_READ_K_CB(READ8(ebaskb2_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebaskb2_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebaskb2_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ebaskb2) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Entex Raise The Devil - * TMS1100 MP1221 (die labeled MP1221) - * 4 7seg LEDs(rightmost one unused), and other LEDs behind bezel, 1bit sound - - lamp translation table: led zz from game PCB = MAME lampyx: - - 0 = - 10 = lamp44 20 = lamp53 30 = lamp95 40 = lamp92 - 1 = lamp30 11 = lamp45 21 = lamp54 31 = lamp85 41 = lamp93 - 2 = lamp31 12 = - 22 = - 32 = lamp65 42 = lamp90 - 3 = lamp32 13 = lamp50 23 = lamp60 33 = lamp74 43 = lamp91 - 4 = lamp33 14 = lamp51 24 = lamp61 34 = lamp70 - 5 = lamp34 15 = lamp52 25 = lamp62 35 = lamp71 - 6 = lamp40 16 = - 26 = lamp63 36 = lamp80 - 7 = lamp41 17 = lamp72 27 = lamp64 37 = lamp81 - 8 = lamp42 18 = lamp73 28 = lamp84 38 = lamp82 - 9 = lamp43 19 = - 29 = lamp94 39 = lamp83 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class raisedvl_state : public hh_tms1k_state -{ -public: - raisedvl_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); - - void set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(skill_switch); - -protected: - virtual void machine_reset(); -}; - -// handlers - -void raisedvl_state::prepare_display() -{ - // R0-R2 are 7segs - for (int y = 0; y < 3; y++) - m_display_segmask[y] = 0x7f; - - display_matrix(7, 10, m_o, m_r); -} - -WRITE16_MEMBER(raisedvl_state::write_r) -{ - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R0,R1: input mux - m_inp_mux = data & 3; - - // R0-R9: led select - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(raisedvl_state::write_o) -{ - // O0-O6: led state - // O7: N/C - m_o = data & 0x7f; - prepare_display(); -} - -READ8_MEMBER(raisedvl_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(2) & 0xf; -} - - -// config - -static INPUT_PORTS_START( raisedvl ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Shoot") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left Flipper") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right Flipper") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R1 (only bit 0) - PORT_CONFNAME( 0x31, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, raisedvl_state, skill_switch, NULL) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x10, "2" ) - PORT_CONFSETTING( 0x11, "3" ) - PORT_CONFSETTING( 0x21, "4" ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(raisedvl_state::skill_switch) -{ - set_clock(); -} - - -void raisedvl_state::set_clock() -{ - // MCU clock is from an RC circuit with C=47pf, R=47K by default. Skills - // 2 and 3 add a 150K resistor in parallel, and skill 4 adds a 100K one. - // 0: R=47K -> ~350kHz - // 2,3: R=35K8 -> ~425kHz (combined) - // 4: R=32K -> ~465kHz (combined) - UINT8 inp = m_inp_matrix[1]->read(); - m_maincpu->set_unscaled_clock((inp & 0x20) ? 465000 : ((inp & 0x10) ? 425000 : 350000)); -} - -void raisedvl_state::machine_reset() -{ - hh_tms1k_state::machine_reset(); - set_clock(); -} - -static MACHINE_CONFIG_START( raisedvl, raisedvl_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 350000) // see set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(raisedvl_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(raisedvl_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(raisedvl_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_tms1k_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Gakken Poker - * PCB label POKER. gakken - * TMS1370 MP2105 (die labeled MP2105) - * 11-digit cyan VFD display Itron FG1114B, oscillator sound - - known releases: - - Japan: Poker - - USA: Electronic Poker, published by Entex - -***************************************************************************/ - -class gpoker_state : public hh_tms1k_state -{ -public: - gpoker_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag), - m_beeper(*this, "beeper") - { } - - required_device m_beeper; - - void prepare_display(); - virtual DECLARE_WRITE16_MEMBER(write_r); - virtual DECLARE_WRITE16_MEMBER(write_o); - virtual DECLARE_READ8_MEMBER(read_k); - -protected: - virtual void machine_reset(); -}; - -// handlers - -void gpoker_state::prepare_display() -{ - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); - display_matrix_seg(12, 11, m_o | (m_r >> 3 & 0xf00), m_r & 0x7ff, 0x7f); -} - -WRITE16_MEMBER(gpoker_state::write_r) -{ - // R15: enable beeper - m_beeper->set_state(data >> 15 & 1); - - // R0-R6: input mux - m_inp_mux = data & 0x7f; - - // R0-R10: select digit - // R11-R14: card symbols - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(gpoker_state::write_o) -{ - // O0-O7: digit segments A-G,H - m_o = data; - prepare_display(); -} - -READ8_MEMBER(gpoker_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(7); -} - - -// config - -/* physical button layout and labels is like this: - - [7] [8] [9] [DL] | (on/off switch) - [4] [5] [6] [BT] - [1] [2] [3] [CA] [CE] - [0] [GO] [T] [AC] -*/ - -static INPUT_PORTS_START( gpoker ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_D) PORT_NAME("9/Deal") // DL, shares pad with 9 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear Entry") // CE - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear All") // AC - - PORT_START("IN.6") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Call") // CA - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Total") // T - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Bet") // BT -INPUT_PORTS_END - - -void gpoker_state::machine_reset() -{ - hh_tms1k_state::machine_reset(); - m_beeper->set_state(0); -} - -static MACHINE_CONFIG_START( gpoker, gpoker_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1370, 350000) // RC osc. R=47K, C=47pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(gpoker_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(gpoker_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(gpoker_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_gpoker) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 2405) // astable multivibrator - C1 and C2 are 0.003uF, R1 and R4 are 1K, R2 and R3 are 100K - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Gakken Jackpot: Gin Rummy & Black Jack - * PCB label gakken - * TMS1670 MPF553 (die labeled MPF553) - * 11-digit cyan VFD display Itron FG1114B, oscillator sound - - known releases: - - Japan: Jackpot(?) - - USA: Electronic Jackpot: Gin Rummy & Black Jack, published by Entex - -***************************************************************************/ - -class gjackpot_state : public gpoker_state -{ -public: - gjackpot_state(const machine_config &mconfig, device_type type, const char *tag) - : gpoker_state(mconfig, type, tag) - { } - - virtual DECLARE_WRITE16_MEMBER(write_r); -}; - -// handlers - -WRITE16_MEMBER(gjackpot_state::write_r) -{ - // same as gpoker, only input mux msb is R10 instead of R6 - gpoker_state::write_r(space, offset, data); - m_inp_mux = (data & 0x3f) | (data >> 4 & 0x40); -} - - -// config - -/* physical button layout and labels is like this: - (note: on dual-function buttons, upper label=Gin, lower label=Black Jack) - - BJ --o GIN - OFF - [7] [8] [9] [DL] - - [4] [5] [6] [ [KN - DB] SP] - [1] [2] [3] [DS] [DR] - BT] HT] - [10/1] [T] [MD [CH [AC] - GO] ST] -*/ - -static INPUT_PORTS_START( gjackpot ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("10/0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("Draw/Hit") // DR/HT - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Deal") // DL - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("Knock/Split") // KN/SP - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Total") // T - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Display/Bet") // DS/BT - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Meld/Go") // MD/GO - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Double") // DB - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Change/Stand") // CH/ST - PORT_BIT( 0x0a, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear Entry") // CE - PORT_BIT( 0x0a, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.6") // R10 - PORT_CONFNAME( 0x06, 0x04, "Game Select" ) - PORT_CONFSETTING( 0x04, "Gin Rummy" ) - PORT_CONFSETTING( 0x02, "Black Jack" ) - PORT_BIT( 0x09, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( gjackpot, gjackpot_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1670, 450000) // approximation - RC osc. R=47K, C=47pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(gpoker_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(gjackpot_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(gpoker_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_gjackpot) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 2405) // see gpoker - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Ideal Electronic Detective - * TMS0980NLL MP6100A (die labeled 0980B-00) - * 10-digit 7seg LED display, 1bit sound - - hardware (and concept) is very similar to Parker Bros Stop Thief - - This is an electronic board game. It requires game cards with suspect info, - and good old pen and paper to record game progress. To start the game, enter - difficulty(1-3), then number of players(1-4), then [ENTER]. Refer to the - manual for more information. - -***************************************************************************/ - -class elecdet_state : public hh_tms1k_state -{ -public: - elecdet_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(elecdet_state::write_r) -{ - // R7,R8: speaker on - m_speaker->level_w((data & 0x180 && m_o & 0x80) ? 1 : 0); - - // R0-R6: select digit - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); - display_matrix_seg(7, 7, BITSWAP8(m_o,7,5,2,1,4,0,6,3), data, 0x7f); -} - -WRITE16_MEMBER(elecdet_state::write_o) -{ - // O0,O1,O4,O6: input mux - m_inp_mux = (data & 3) | (data >> 2 & 4) | (data >> 3 & 8); - - // O0-O6: digit segments A-G - // O7: speaker out -> write_r - m_o = data; -} - -READ8_MEMBER(elecdet_state::read_k) -{ - // K: multiplexed inputs (note: the Vss row is always on) - return m_inp_matrix[4]->read() | read_inputs(4); -} - - -// config - -/* physical button layout and labels is like this: - - [1] [2] [3] [SUSPECT] - [4] [5] [6] [PRIVATE QUESTION] - [7] [8] [9] [I ACCUSE] - [0] [ENTER] - [ON] [OFF] [END TURN] -*/ - -static INPUT_PORTS_START( elecdet ) - PORT_START("IN.0") // O0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Private Question") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - - PORT_START("IN.1") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // O4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("I Accuse") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - - PORT_START("IN.3") // O6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Suspect") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - - // note: even though power buttons are on the matrix, they are not CPU-controlled - PORT_START("IN.4") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("End Turn") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( elecdet, elecdet_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0980, 425000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(elecdet_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecdet_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(elecdet_state, write_o)) - MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_elecdet) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Kenner Star Wars - Electronic Battle Command - * TMS1100 MCU, labeled MP3438A - * 4x4 LED grid display + 2 separate LEDs and 2-digit 7segs, 1bit sound - - This is a small tabletop space-dogfighting game. To start the game, - press BASIC/INTER/ADV and enter P#(number of players), then - START TURN. Refer to the official manual for more information. - -***************************************************************************/ - -class starwbc_state : public hh_tms1k_state -{ -public: - starwbc_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void starwbc_state::prepare_display() -{ - // R6,R8 are 7segs - m_display_segmask[6] = m_display_segmask[8] = 0x7f; - display_matrix(8, 10, m_o, m_r); -} - -WRITE16_MEMBER(starwbc_state::write_r) -{ - // R0,R1,R3,R5,R7: input mux - m_inp_mux = (data & 3) | (data >> 1 & 4) | (data >> 2 & 8) | (data >> 3 & 0x10); - - // R9: speaker out - m_speaker->level_w(data >> 9 & 1); - - // R0,R2,R4,R6,R8: led select - m_r = data & 0x155; - prepare_display(); -} - -WRITE16_MEMBER(starwbc_state::write_o) -{ - // O0-O7: led state - m_o = (data << 4 & 0xf0) | (data >> 4 & 0x0f); - prepare_display(); -} - -READ8_MEMBER(starwbc_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(5); -} - - -// config - -/* physical button layout and labels is like this: - - (reconnnaissance=yellow) (tactical reaction=green) - [MAGNA] [ENEMY] [EM] [BS] [SCR] - - [BASIC] [INTER] [START TURN] [END TURN] [MOVE] [FIRE] - [ADV] [P#] [<] [^] [>] [v] - (game=blue) (maneuvers=red) -*/ - -static INPUT_PORTS_START( starwbc ) - PORT_START("IN.0") // R0 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Basic Game") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Intermediate Game") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Advanced Game") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_NAME("Player Number") - - PORT_START("IN.1") // R1 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Start Turn") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("End Turn") - - PORT_START("IN.2") // R3 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Magna Scan") // only used in adv. game - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Enemy Scan") // only used in adv. game - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Screen Up") - - PORT_START("IN.3") // R5 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Evasive Maneuvers") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("Move") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Fire") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_NAME("Battle Stations") - - PORT_START("IN.4") // R7 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( starwbc, starwbc_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 325000) // RC osc. R=51K, C=47pf -> ~325kHz - MCFG_TMS1XXX_READ_K_CB(READ8(starwbc_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(starwbc_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(starwbc_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_starwbc) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Kosmos Astro - * TMS1470NLHL MP1133 (die labeled TMS1400 MP1133) - * 9digit 7seg VFD display + 8 LEDs(4 green, 4 yellow), no sound - - This is an astrological calculator, and also supports 4-function - calculations. Refer to the official manual on how to use this device. - -***************************************************************************/ - -class astro_state : public hh_tms1k_state -{ -public: - astro_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void astro_state::prepare_display() -{ - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); - display_matrix_seg(8, 10, m_o, m_r, 0xff); -} - -WRITE16_MEMBER(astro_state::write_r) -{ - // R0-R7: input mux - m_inp_mux = data & 0xff; - - // R0-R9: led select - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(astro_state::write_o) -{ - // O0-O7: led state - m_o = data; - prepare_display(); -} - -READ8_MEMBER(astro_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(8); -} - - -// config - -static INPUT_PORTS_START( astro ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE"/Sun") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY"/Mercury") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-/Venus") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+/Mars") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=/Astro") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_NAME("B1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("B2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.6") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("C") - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.7") // R7 - PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_CONFNAME( 0x08, 0x08, "Mode" ) - PORT_CONFSETTING( 0x00, "Calculator" ) - PORT_CONFSETTING( 0x08, "Astro" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( astro, astro_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1470, 450000) // approximation - RC osc. R=4.7K, C=33pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(astro_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(astro_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(astro_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_astro) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Milton Bradley Comp IV - * TMC0904NL CP0904A (die labeled 4A0970D-04A) - * 10 LEDs behind bezel, no sound - - This is small tabletop Mastermind game; a code-breaking game where the player - needs to find out the correct sequence of colours (numbers in our case). - It is known as Logic 5 in Europe, and as Pythaligoras in Japan. - - Press the R key to start, followed by a set of unique numbers and E. - Refer to the official manual for more information. - -***************************************************************************/ - -class comp4_state : public hh_tms1k_state -{ -public: - comp4_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(comp4_state::write_r) -{ - // leds: - // R4 R9 - // R10! R8 - // R2 R7 - // R1 R6 - // R0 R5 - m_r = data; - display_matrix(11, 1, m_r, m_o); -} - -WRITE16_MEMBER(comp4_state::write_o) -{ - // O1-O3: input mux - m_inp_mux = data >> 1 & 7; - - // O0: leds common - // other bits: N/C - m_o = data; - display_matrix(11, 1, m_r, m_o); -} - -READ8_MEMBER(comp4_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(3); -} - - -// config - -static INPUT_PORTS_START( comp4 ) - PORT_START("IN.0") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("R") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - - PORT_START("IN.1") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - - PORT_START("IN.2") // O3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("E") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( comp4, comp4_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0970, 250000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(comp4_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(comp4_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(comp4_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_comp4) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Milton Bradley Simon, created by Ralph Baer - - Revision A hardware: - * TMS1000 (die labeled MP3226) - * DS75494 Hex digit LED driver, 4 big lamps, 1bit sound - - Newer revisions (also Pocket Simon) have a smaller 16-pin MB4850 chip - instead of the TMS1000. This one has been decapped too, but we couldn't - find an internal ROM. It is possibly a cost-reduced custom ASIC specifically - for Simon. The semi-sequel Super Simon uses a TMS1100 (see next minidriver). - -***************************************************************************/ - -class simon_state : public hh_tms1k_state -{ -public: - simon_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(simon_state::write_r) -{ - // R4-R8 go through an 75494 IC first: - // R4 -> 75494 IN6 -> green lamp - // R5 -> 75494 IN3 -> red lamp - // R6 -> 75494 IN5 -> yellow lamp - // R7 -> 75494 IN2 -> blue lamp - display_matrix(4, 1, data >> 4, 1); - - // R8 -> 75494 IN0 -> speaker out - m_speaker->level_w(data >> 8 & 1); - - // R0-R2,R9: input mux - // R3: GND - // other bits: N/C - m_inp_mux = (data & 7) | (data >> 6 & 8); -} - -READ8_MEMBER(simon_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(4); -} - - -// config - -static INPUT_PORTS_START( simon ) - PORT_START("IN.0") // R0 - PORT_CONFNAME( 0x07, 0x02, "Game Select") - PORT_CONFSETTING( 0x02, "1" ) - PORT_CONFSETTING( 0x01, "2" ) - PORT_CONFSETTING( 0x04, "3" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Green Button") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Red Button") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Yellow Button") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Blue Button") - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Last") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Longest") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R9 - PORT_CONFNAME( 0x0f, 0x02, "Skill Level") - PORT_CONFSETTING( 0x02, "1" ) - PORT_CONFSETTING( 0x04, "2" ) - PORT_CONFSETTING( 0x08, "3" ) - PORT_CONFSETTING( 0x01, "4" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( simon, simon_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=33K, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(simon_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(simon_state, write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_simon) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Milton Bradley Super Simon - * TMS1100 MP3476NLL (die labeled MP3476) - * 8 big lamps(2 turn on at same time), 1bit sound - - The semi-squel to Simon, not as popular. It includes more game variations - and a 2-player head-to-head mode. - -***************************************************************************/ - -class ssimon_state : public hh_tms1k_state -{ -public: - ssimon_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_READ8_MEMBER(read_k); - - void set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(speed_switch); - -protected: - virtual void machine_reset(); -}; - -// handlers - -WRITE16_MEMBER(ssimon_state::write_r) -{ - // R0-R3,R9,R10: input mux - m_inp_mux = (data & 0xf) | (data >> 5 & 0x30); - - // R4: yellow lamps - // R5: green lamps - // R6: blue lamps - // R7: red lamps - display_matrix(4, 1, data >> 4, 1); - - // R8: speaker out - m_speaker->level_w(data >> 8 & 1); -} - -READ8_MEMBER(ssimon_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(6); -} - - -// config - -static INPUT_PORTS_START( ssimon ) - PORT_START("IN.0") // R0 - PORT_CONFNAME( 0x0f, 0x01, "Game Select") - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFSETTING( 0x04, "3" ) - PORT_CONFSETTING( 0x08, "4" ) - PORT_CONFSETTING( 0x00, "5" ) - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Yellow Button") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Green Button") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Blue Button") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Red Button") - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Last") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Longest") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Decision") - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 Yellow Button") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Green Button") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Blue Button") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Red Button") - - PORT_START("IN.4") // R9 - PORT_CONFNAME( 0x0f, 0x02, "Skill Level") - PORT_CONFSETTING( 0x00, "Head-to-Head" ) // this sets R10 K2, see below - PORT_CONFSETTING( 0x02, "1" ) - PORT_CONFSETTING( 0x04, "2" ) - PORT_CONFSETTING( 0x08, "3" ) - PORT_CONFSETTING( 0x01, "4" ) - - PORT_START("IN.5") // R10 - PORT_BIT( 0x02, 0x02, IPT_SPECIAL ) PORT_CONDITION("IN.4", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.6") // fake - PORT_CONFNAME( 0x03, 0x01, "Speed" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ssimon_state, speed_switch, NULL) - PORT_CONFSETTING( 0x00, "Simple" ) - PORT_CONFSETTING( 0x01, "Normal" ) - PORT_CONFSETTING( 0x02, "Super" ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(ssimon_state::speed_switch) -{ - set_clock(); -} - - -void ssimon_state::set_clock() -{ - // MCU clock is from an RC circuit with C=100pf, R=x depending on speed switch: - // 0 Simple: R=51K -> ~200kHz - // 1 Normal: R=37K -> ~275kHz - // 2 Super: R=22K -> ~400kHz - UINT8 inp = m_inp_matrix[6]->read(); - m_maincpu->set_unscaled_clock((inp & 2) ? 400000 : ((inp & 1) ? 275000 : 200000)); -} - -void ssimon_state::machine_reset() -{ - hh_tms1k_state::machine_reset(); - set_clock(); -} - -static MACHINE_CONFIG_START( ssimon, ssimon_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 275000) // see set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(ssimon_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ssimon_state, write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ssimon) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Milton Bradley Big Trak - * TMS1000NLL MP3301A or MP3301ANLL E (rev. E!) (die labeled 1000E MP3301) - * SN75494N Hex digit LED driver, 1 lamp, 3-level sound - * gearbox with magnetic clutch, 1 IR led+sensor, 2 motors(middle wheels) - * 24-button keypad, ext in/out ports - - Big Trak is a programmable toy car, up to 16 steps. Supported commands include - driving and turning, firing a photon cannon(hey, have some imagination!), - and I/O ports. The output port was used for powering the dump truck accessory. - - The In command was canceled midst production, it is basically a nop. Newer - releases and the European version removed the button completely. - -***************************************************************************/ - -class bigtrak_state : public hh_tms1k_state -{ -public: - bigtrak_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); - - int m_gearbox_pos; - bool sensor_state() { return m_gearbox_pos < 0 && m_display_decay[0][0] != 0; } - TIMER_DEVICE_CALLBACK_MEMBER(gearbox_sim_tick); - -protected: - virtual void machine_start(); -}; - -// handlers - -TIMER_DEVICE_CALLBACK_MEMBER(bigtrak_state::gearbox_sim_tick) -{ - // the last gear in the gearbox has 12 evenly spaced holes, it is located - // between an IR emitter and receiver - static const int speed = 17; - if (m_gearbox_pos >= speed) - m_gearbox_pos = -speed; - - if (m_o & 0x1e) - m_gearbox_pos++; -} - -WRITE16_MEMBER(bigtrak_state::write_r) -{ - // R0-R5,R8: input mux (keypad, ext in enable) - m_inp_mux = (data & 0x3f) | (data >> 2 & 0x40); - - // R6: N/C - // R7: IR led on - // R9: lamp on - display_matrix(2, 1, (data >> 7 & 1) | (data >> 8 & 2), 1); - - // (O0,O7,)R10(tied together): speaker out - m_speaker->level_w((m_o & 1) | (m_o >> 6 & 2) | (data >> 8 & 4)); - m_r = data; -} - -WRITE16_MEMBER(bigtrak_state::write_o) -{ - // O1: left motor forward - // O2: left motor reverse - // O3: right motor reverse - // O4: right motor reverse - // O5: ext out - // O6: N/C - output_set_value("left_motor_forward", data >> 1 & 1); - output_set_value("left_motor_reverse", data >> 2 & 1); - output_set_value("right_motor_forward", data >> 3 & 1); - output_set_value("right_motor_reverse", data >> 4 & 1); - output_set_value("ext_out", data >> 5 & 1); - - // O0,O7(,R10)(tied together): speaker out - m_speaker->level_w((data & 1) | (data >> 6 & 2) | (m_r >> 8 & 4)); - m_o = data; -} - -READ8_MEMBER(bigtrak_state::read_k) -{ - // K: multiplexed inputs - // K8: IR sensor - return read_inputs(7) | (sensor_state() ? 8 : 0); -} - - -// config - -/* physical button layout and labels is like this: - - USA version: UK version: - - [^] [CLR] [^] [CM] - [<] [HOLD] [>] [FIRE] [<] [P] [>] [\|/] - [v] [CLS] [v] [CE] - [7] [8] [9] [RPT] [7] [8] [9] [x2] - [4] [5] [6] [TEST] [4] [5] [6] [TEST] - [1] [2] [3] [CK] [1] [2] [3] [checkmark] - [IN] [0] [OUT] [GO] [0] [OUT] [GO] -*/ - -static INPUT_PORTS_START( bigtrak ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("Hold") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_UP) PORT_NAME("Forward") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Fire") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear Memory") - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Backward") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear Last Step") - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Repeat") - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Test") - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Check") - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("In") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_NAME("Out") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") - - PORT_START("IN.6") // R8 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CODE(KEYCODE_F1) PORT_NAME("Input Port") - PORT_BIT( 0x0b, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -void bigtrak_state::machine_start() -{ - hh_tms1k_state::machine_start(); - - // zerofill/register for savestates - m_gearbox_pos = 0; - save_item(NAME(m_gearbox_pos)); -} - -static const INT16 bigtrak_speaker_levels[] = { 0, 32767/3, 32767/3, 32767/3*2, 32767/3, 32767/3*2, 32767/3*2, 32767 }; - -static MACHINE_CONFIG_START( bigtrak, bigtrak_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 200000) // approximation - RC osc. R=83K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(bigtrak_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bigtrak_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bigtrak_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("gearbox", bigtrak_state, gearbox_sim_tick, attotime::from_msec(1)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_bigtrak) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(8, bigtrak_speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Parker Brothers Code Name: Sector, by Bob Doyle - * TMS0970 MCU, MP0905BNL ZA0379 (die labeled 0970F-05B) - * 6-digit 7seg LED display + 4 LEDs for compass, no sound - - This is a tabletop submarine pursuit game. A grid board and small toy - boats are used to remember your locations (a Paint app should be ok too). - Refer to the official manual for more information, it is not a simple game. - -***************************************************************************/ - -class cnsector_state : public hh_tms1k_state -{ -public: - cnsector_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(cnsector_state::write_r) -{ - // R0-R5: select digit (right-to-left) - for (int y = 0; y < 6; y++) - { - m_display_segmask[y] = 0xff; - m_display_state[y] = (data >> y & 1) ? m_o : 0; - } - - // R6-R9: direction leds (-> lamp60-63) - m_display_state[6] = data >> 6 & 0xf; - - set_display_size(8, 7); - display_update(); -} - -WRITE16_MEMBER(cnsector_state::write_o) -{ - // O0-O4: input mux - m_inp_mux = data & 0x1f; - - // O0-O7: digit segments - m_o = data; -} - -READ8_MEMBER(cnsector_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(5); -} - - -// config - -/* physical button layout and labels is like this: - - COMBAT INFORMATION CENTER - [NEXT SHIP] [RECALL] [MOVE SHIP] - - [LEFT] [RIGHT] o [SLOWER] [FASTER] - STEERING EVASIVE SUB SPEED o (on/off switch) - NAVIGATIONAL PROGRAMMING | - - [RANGE] [AIM] [FIRE] o [TEACH MODE] - SONAR CONTROL SUB FINDER -*/ - -static INPUT_PORTS_START( cnsector ) - PORT_START("IN.0") // O0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Next Ship") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Left") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Range") - - PORT_START("IN.1") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Aim") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Right") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Fire") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("Evasive Sub") // expert button - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Recall") - - PORT_START("IN.3") // O3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Sub Finder") // expert button - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Slower") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // O4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Teach Mode") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Faster") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( cnsector, cnsector_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0970, 250000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(cnsector_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnsector_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnsector_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_cnsector) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Parker Bros Merlin handheld game, by Bob Doyle - * TMS1100NLL MP3404A-N2 - * 11 LEDs behind buttons, 3-level sound - - Also published in Japan by Tomy as "Dr. Smith", white case instead of red. - The one with dark-blue case is the rare sequel Master Merlin, see below. - More sequels followed too, but on other hardware. - - To start a game, press NEW GAME, followed by a number: - 1: Tic-Tac-Toe - 2: Music Machine - 3: Echo - 4: Blackjack 13 - 5: Magic Square - 6: Mindbender - - Refer to the official manual for more information on the games. - -***************************************************************************/ - -class merlin_state : public hh_tms1k_state -{ -public: - merlin_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - virtual DECLARE_WRITE16_MEMBER(write_r); - virtual DECLARE_WRITE16_MEMBER(write_o); - virtual DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(merlin_state::write_r) -{ - /* leds: - - R0 - R1 R2 R3 - R4 R5 R6 - R7 R8 R9 - R10 - */ - display_matrix(11, 1, data, 1); -} - -WRITE16_MEMBER(merlin_state::write_o) -{ - // O4-O6(tied together): speaker out - m_speaker->level_w(data >> 4 & 7); - - // O0-O3: input mux - // O7: N/C - m_inp_mux = data & 0xf; -} - -READ8_MEMBER(merlin_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(4); -} - - -// config - -static INPUT_PORTS_START( merlin ) - PORT_START("IN.0") // O0 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("Button 0") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Button 1") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Button 3") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Button 2") - - PORT_START("IN.1") // O1 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Button 4") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Button 5") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Button 7") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Button 6") - - PORT_START("IN.2") // O2 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Button 8") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Button 9") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Same Game") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Button 10") - - PORT_START("IN.3") // O3 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Comp Turn") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Hit Me") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_N) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("New Game") -INPUT_PORTS_END - - -static const INT16 merlin_speaker_levels[] = { 0, 32767/3, 32767/3, 32767/3*2, 32767/3, 32767/3*2, 32767/3*2, 32767 }; - -static MACHINE_CONFIG_START( merlin, merlin_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(merlin_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(merlin_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(merlin_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_merlin) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(8, merlin_speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Parker Brothers Master Merlin - * TMS1400 MP7351-N2LL (die labeled 1400CR MP7351) - * 11 LEDs behind buttons, 3-level sound - - The TMS1400CR MCU has the same pinout as a standard TMS1100. The hardware - outside of the MCU is exactly the same as Merlin. - - The included minigames are: - 1: Three Shells - 2: Hi/Lo - 3: Match It - 4: Hit or Miss - 5: Pair Off - 6: Tempo - 7: Musical Ladder - 8: Patterns - 9: Hot Potato - -***************************************************************************/ - -class mmerlin_state : public merlin_state -{ -public: - mmerlin_state(const machine_config &mconfig, device_type type, const char *tag) - : merlin_state(mconfig, type, tag) - { } -}; - -// handlers: uses the ones in merlin_state - - -// config - -static INPUT_PORTS_START( mmerlin ) - PORT_INCLUDE( merlin ) - - PORT_MODIFY("IN.3") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Score") // instead of Hit Me -INPUT_PORTS_END - -static MACHINE_CONFIG_START( mmerlin, mmerlin_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=30K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(mmerlin_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mmerlin_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mmerlin_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_mmerlin) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(8, merlin_speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Parker Brothers Stop Thief, by Bob Doyle - * TMS0980NLL MP6101B (die labeled 0980B-01A) - * 3-digit 7seg LED display, 1bit sound - - Stop Thief is actually a board game, the electronic device emulated here - (called Electronic Crime Scanner) is an accessory. To start a game, press - the ON button. Otherwise, it is in test-mode where you can hear all sounds. - -***************************************************************************/ - -class stopthief_state : public hh_tms1k_state -{ -public: - stopthief_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(stopthief_state::write_r) -{ - // R0-R2: select digit - UINT8 o = BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f; - for (int y = 0; y < 3; y++) - { - m_display_segmask[y] = 0x7f; - m_display_state[y] = (data >> y & 1) ? o : 0; - } - - set_display_size(7, 3); - display_update(); - - // R3-R8: speaker on - m_speaker->level_w((data & 0x1f8 && m_o & 8) ? 1 : 0); -} - -WRITE16_MEMBER(stopthief_state::write_o) -{ - // O0,O6: input mux - m_inp_mux = (data & 1) | (data >> 5 & 2); - - // O3: speaker out - // O0-O2,O4-O7: led segments A-G - m_o = data; -} - -READ8_MEMBER(stopthief_state::read_k) -{ - // K: multiplexed inputs (note: the Vss row is always on) - return m_inp_matrix[2]->read() | read_inputs(2); -} - - -// config - -/* physical button layout and labels is like this: - - [1] [2] [OFF] - [3] [4] [ON] - [5] [6] [T, TIP] - [7] [8] [A, ARREST] - [9] [0] [C, CLUE] -*/ - -static INPUT_PORTS_START( stopthief ) - PORT_START("IN.0") // O0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - - PORT_START("IN.1") // O6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - - // note: even though power buttons are on the matrix, they are not CPU-controlled - PORT_START("IN.2") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Tip") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Arrest") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Clue") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( stopthief, stopthief_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0980, 425000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(stopthief_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(stopthief_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(stopthief_state, write_o)) - MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_stopthie) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Parker Brothers Bank Shot (known as Cue Ball in the UK), by Garry Kitchen - * TMS1400NLL MP7313-N2 (die labeled MP7313) - * LED grid display, 1bit sound - - Bank Shot is an electronic pool game. To select a game, repeatedly press - the [SELECT] button, then press [CUE UP] to start. Refer to the official - manual for more information. The game selections are: - 1: Straight Pool (1 player) - 2: Straight Pool (2 players) - 3: Poison Pool - 4: Trick Shots - -***************************************************************************/ - -class bankshot_state : public hh_tms1k_state -{ -public: - bankshot_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(bankshot_state::write_r) -{ - // R0: speaker out - m_speaker->level_w(data & 1); - - // R2,R3: input mux - m_inp_mux = data >> 2 & 3; - - // R2-R10: led select - m_r = data & ~3; - display_matrix(7, 11, m_o, m_r); -} - -WRITE16_MEMBER(bankshot_state::write_o) -{ - // O0-O6: led state - // O7: N/C - m_o = data & 0x7f; - display_matrix(7, 11, m_o, m_r); -} - -READ8_MEMBER(bankshot_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(2); -} - - -// config - -/* physical button layout and labels is like this: - (note: remember that you can rotate the display in MAME) - - [SELECT [BALL UP] [BALL OVER] - SCORE] - - ------ led display ------ - - [ANGLE] [AIM] [CUE UP - SHOOT] -*/ - -static INPUT_PORTS_START( bankshot ) - PORT_START("IN.0") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Angle") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Aim") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Cue Up/Shoot") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Select/Score") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Ball Up") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Ball Over") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( bankshot, bankshot_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(bankshot_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bankshot_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bankshot_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_bankshot) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Parker Brothers Split Second - * TMS1400NLL MP7314-N2 (die labeled MP7314) - * LED grid display(default round LEDs, and rectangular shape ones), 1bit sound - - This is an electronic handheld reflex gaming device, it's straightforward - to use. The included mini-games are: - 1, 2, 3: Mad Maze* - 4, 5: Space Attack* - 6: Auto Cross - 7: Stomp - 8: Speedball - - *: higher number indicates higher difficulty - - display layout, where number xy is lamp R(x),O(y) - - 00 02 04 - 10 01 12 03 14 05 16 - 11 13 15 - 20 21 22 23 24 25 26 - 31 33 35 - 30 41 32 43 34 45 36 - 51 53 55 - 40 61 42 63 44 65 46 - 71 73 75 - 50 60 52 62 54 64 56 - 70 72 74 - -***************************************************************************/ - -class splitsec_state : public hh_tms1k_state -{ -public: - splitsec_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(splitsec_state::write_r) -{ - // R8: speaker out - m_speaker->level_w(data >> 8 & 1); - - // R9,R10: input mux - m_inp_mux = data >> 9 & 3; - - // R0-R7: led select - m_r = data; - display_matrix(7, 8, m_o, m_r); -} - -WRITE16_MEMBER(splitsec_state::write_o) -{ - // O0-O6: led state - // O7: N/C - m_o = data & 0x7f; - display_matrix(7, 8, m_o, m_r); -} - -READ8_MEMBER(splitsec_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(2); -} - - -// config - -static INPUT_PORTS_START( splitsec ) - PORT_START("IN.0") // R9 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R10 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( splitsec, splitsec_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(splitsec_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_splitsec) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tandy Radio Shack Computerized Arcade (1981, 1982, 1995) - * TMS1100 MCU, labeled CD7282SL - * 12 lamps behind buttons, 1bit sound - - This handheld contains 12 minigames. It looks and plays like "Fabulous Fred" - by the Japanese company Mego Corp. in 1980, which in turn is a mix of Merlin - and Simon. Unlike Merlin and Simon, spin-offs like these were not successful. - There were releases with and without the prefix "Tandy-12", I don't know - which name was more common. Also not worth noting is that it needed five - batteries; 4 C-cells and a 9-volt. - - Some of the games require accessories included with the toy (eg. the Baseball - game is played with a board representing the playing field). To start a game, - hold the [SELECT] button, then press [START] when the game button lights up. - As always, refer to the official manual for more information. - - See below at the input defs for a list of the games. - -***************************************************************************/ - -class tandy12_state : public hh_tms1k_state -{ -public: - tandy12_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void tandy12_state::prepare_display() -{ - // O0-O7: button lamps 1-8, R0-R3: button lamps 9-12 - display_matrix(13, 1, (m_o << 1 & 0x1fe) | (m_r << 9 & 0x1e00), 1); -} - -WRITE16_MEMBER(tandy12_state::write_r) -{ - // R10: speaker out - m_speaker->level_w(data >> 10 & 1); - - // R5-R9: input mux - m_inp_mux = data >> 5 & 0x1f; - - // other bits: - m_r = data; - prepare_display(); -} - -WRITE16_MEMBER(tandy12_state::write_o) -{ - m_o = data; - prepare_display(); -} - -READ8_MEMBER(tandy12_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(5); -} - - -// config - -/* physical button layout and labels is like this: - - REPEAT-2 SPACE-2 - [O] OFF--ON [O] - - [purple]1 [blue]5 [l-green]9 - ORGAN TAG-IT TREASURE HUNT - - [l-orange]2 [turquoise]6 [red]10 - SONG WRITER ROULETTE COMPETE - - [pink]3 [yellow]7 [violet]11 - REPEAT BASEBALL FIRE AWAY - - [green]4 [orange]8 [brown]12 - TORPEDO REPEAT PLUS HIDE 'N SEEK - - [O] [O] [O] - START SELECT PLAY-2/HIT-7 -*/ - -static INPUT_PORTS_START( tandy12 ) - PORT_START("IN.0") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_EQUALS) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("Button 12") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("Button 11") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Button 10") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Button 9") - - PORT_START("IN.1") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Space-2") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Play-2/Hit-7") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Select") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Start") - - PORT_START("IN.2") // R7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Repeat-2") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R8 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Button 4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Button 3") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Button 2") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Button 1") - - PORT_START("IN.4") // R9 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Button 8") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Button 7") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Button 6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Button 5") -INPUT_PORTS_END - - -static const UINT16 tandy12_output_pla[0x20] = -{ - // these are certain - 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, - 0x80, 0x00, 0x00, 0x00, 0x00, - - // rest is unused? - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static MACHINE_CONFIG_START( tandy12, tandy12_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 400000) // RC osc. R=39K, C=47pf -> ~400kHz - MCFG_TMS1XXX_OUTPUT_PLA(tandy12_output_pla) - MCFG_TMS1XXX_READ_K_CB(READ8(tandy12_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tandy12_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tandy12_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_tandy12) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy(tronics) Break Up (manufactured in Japan) - * PCB label TOMY B.O. - * TMS1040 MP2726 TOMY WIPE (die labeled MP2726A) - * TMS1025N2LL I/O expander - * 2-digit 7seg display, 46 other leds, 1bit sound - - known releases: - - USA: Break Up - - Japan: Block Attack - - UK: Break-In - - lamp translation table: led zz from game PCB = MAME lampyx: - - 00 = - 10 = lamp50 20 = lamp42 - 01 = lamp70 11 = lamp51 21 = lamp33 - 02 = lamp71 12 = lamp52 22 = lamp22 - 03 = lamp72 13 = lamp53 - 04 = lamp73 14 = lamp43 - 05 = lamp60 15 = lamp31 - 06 = lamp61 16 = lamp32 - 07 = lamp62 17 = lamp30 - 08 = lamp63 18 = lamp41 - 09 = lamp40 19 = lamp21 - - the 7seg panel is lamp0x and lamp1x(aka digit0/1), and the - 8(2*4) * 3 rectangular leds panel, where x=0,1,2,3: - - lamp9x lamp11x - lamp8x lamp13x - lamp10x lamp12x - -***************************************************************************/ - -class tbreakup_state : public hh_tms1k_state -{ -public: - tbreakup_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag), - m_expander(*this, "expander") - { } - - required_device m_expander; - UINT8 m_exp_port[7]; - DECLARE_WRITE8_MEMBER(expander_w); - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); - - void set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(skill_switch); - -protected: - virtual void machine_reset(); - virtual void machine_start(); -}; - -// handlers - -void tbreakup_state::prepare_display() -{ - // 7seg leds from R0,R1 and O0-O6 - for (int y = 0; y < 2; y++) - { - m_display_segmask[y] = 0x7f; - m_display_state[y] = (m_r >> y & 1) ? (m_o & 0x7f) : 0; - } - - // 22 round leds from O2-O7 and expander port 7 - for (int y = 2; y < 8; y++) - m_display_state[y] = (m_o >> y & 1) ? m_exp_port[6] : 0; - - // 24 rectangular leds from expander ports 1-6 (not strobed) - for (int y = 0; y < 6; y++) - m_display_state[y+8] = m_exp_port[y]; - - set_display_size(8, 14); - display_update(); -} - -WRITE8_MEMBER(tbreakup_state::expander_w) -{ - // TMS1025 port 1-7 data - m_exp_port[offset] = data; -} - -WRITE16_MEMBER(tbreakup_state::write_r) -{ - // R6: speaker out - m_speaker->level_w(data >> 6 & 1); - - // R7,R8: input mux - m_inp_mux = data >> 7 & 3; - - // R3-R5: TMS1025 port S - // R2: TMS1025 STD pin - m_expander->write_s(space, 0, data >> 3 & 7); - m_expander->write_std(data >> 2 & 1); - - // R0,R1: select digit - m_r = ~data; - prepare_display(); -} - -WRITE16_MEMBER(tbreakup_state::write_o) -{ - // O0-O3: TMS1025 port H - m_expander->write_h(space, 0, data & 0xf); - - // O0-O7: led state - m_o = data; - prepare_display(); -} - -READ8_MEMBER(tbreakup_state::read_k) -{ - // K4: fixed input - // K8: multiplexed inputs - return (m_inp_matrix[2]->read() & 4) | (read_inputs(2) & 8); -} - - -// config - -static INPUT_PORTS_START( tbreakup ) - PORT_START("IN.0") // R7 K8 - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Ball") - - PORT_START("IN.1") // R8 K8 - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Hit") - - PORT_START("IN.2") // K4 - PORT_CONFNAME( 0x04, 0x00, DEF_STR( Lives ) ) - PORT_CONFSETTING( 0x00, "3" ) - PORT_CONFSETTING( 0x04, "5" ) - - PORT_START("IN.3") // fake - PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CHANGED_MEMBER(DEVICE_SELF, tbreakup_state, skill_switch, NULL) - PORT_CONFSETTING( 0x00, "Pro 1" ) - PORT_CONFSETTING( 0x01, "Pro 2" ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(tbreakup_state::skill_switch) -{ - set_clock(); -} - - -void tbreakup_state::set_clock() -{ - // MCU clock is from an analog circuit with resistor of 73K, PRO2 adds 100K - m_maincpu->set_unscaled_clock((m_inp_matrix[3]->read() & 1) ? 500000 : 325000); -} - -void tbreakup_state::machine_reset() -{ - hh_tms1k_state::machine_reset(); - set_clock(); -} - -void tbreakup_state::machine_start() -{ - hh_tms1k_state::machine_start(); - - // zerofill/register for savestates - memset(m_exp_port, 0, sizeof(m_exp_port)); - save_item(NAME(m_exp_port)); -} - -static MACHINE_CONFIG_START( tbreakup, tbreakup_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1040, 325000) // see set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(tbreakup_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tbreakup_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tbreakup_state, write_o)) - - MCFG_DEVICE_ADD("expander", TMS1025, 0) - MCFG_TMS1024_WRITE_PORT_CB(1, WRITE8(tbreakup_state, expander_w)) - MCFG_TMS1024_WRITE_PORT_CB(2, WRITE8(tbreakup_state, expander_w)) - MCFG_TMS1024_WRITE_PORT_CB(3, WRITE8(tbreakup_state, expander_w)) - MCFG_TMS1024_WRITE_PORT_CB(4, WRITE8(tbreakup_state, expander_w)) - MCFG_TMS1024_WRITE_PORT_CB(5, WRITE8(tbreakup_state, expander_w)) - MCFG_TMS1024_WRITE_PORT_CB(6, WRITE8(tbreakup_state, expander_w)) - MCFG_TMS1024_WRITE_PORT_CB(7, WRITE8(tbreakup_state, expander_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_tbreakup) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( mathmagi ) - ROM_REGION( 0x800, "maincpu", 0 ) - ROM_LOAD( "mp1030", 0x0000, 0x800, CRC(a81d7ccb) SHA1(4756ce42f1ea28ce5fe6498312f8306f10370969) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_mathmagi_output.pla", 0, 365, NO_DUMP ) -ROM_END - - -ROM_START( amaztron ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp3405", 0x0000, 0x0800, CRC(9cbc0009) SHA1(17772681271b59280687492f37fa0859998f041d) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_amaztron_output.pla", 0, 365, CRC(f3875384) SHA1(3c256a3db4f0aa9d93cf78124db39f4cbdc57e4a) ) -ROM_END - - -ROM_START( h2hbaseb ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp1525", 0x0000, 0x0800, CRC(b5d6bf9b) SHA1(2cc9f35f077c1209c46d16ec853af87e4725c2fd) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_h2hbaseb_output.pla", 0, 365, CRC(cb3d7e38) SHA1(6ab4a7c52e6010b7c7158463cb499973e52ff556) ) -ROM_END - - -ROM_START( h2hfootb ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp3460.u3", 0x0000, 0x0800, CRC(3a4e53a8) SHA1(5052e706f992c6c4bada1fa7769589eec3df6471) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_h2hfootb_output.pla", 0, 365, CRC(c8d85873) SHA1(16bd6fc8e3cd16d5f8fd32d0c74e67de77f5487e) ) -ROM_END - - -ROM_START( tc4 ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp7334", 0x0000, 0x1000, CRC(923f3821) SHA1(a9ae342d7ff8dae1dedcd1e4984bcfae68586581) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_tc4_output.pla", 0, 557, CRC(3b908725) SHA1(f83bf5faa5b3cb51f87adc1639b00d6f9a71ad19) ) -ROM_END - - -ROM_START( ebball ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "mp0914", 0x0000, 0x0400, CRC(3c6fb05b) SHA1(b2fe4b3ca72d6b4c9bfa84d67f64afdc215e7178) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1000_common2_micro.pla", 0, 867, CRC(d33da3cf) SHA1(13c4ebbca227818db75e6db0d45b66ba5e207776) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1000_ebball_output.pla", 0, 365, CRC(062bf5bb) SHA1(8d73ee35444299595961225528b153e3a5fe66bf) ) -ROM_END - - -ROM_START( ebball2 ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "mp0923", 0x0000, 0x0400, CRC(077acfe2) SHA1(a294ce7614b2cdb01c754a7a50d60d807e3f0939) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1000_common2_micro.pla", 0, 867, CRC(d33da3cf) SHA1(13c4ebbca227818db75e6db0d45b66ba5e207776) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1000_ebball2_output.pla", 0, 365, CRC(adcd73d1) SHA1(d69e590d288ef99293d86716498f3971528e30de) ) -ROM_END - - -ROM_START( ebball3 ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "6007_mp1204", 0x0000, 0x0800, CRC(987a29ba) SHA1(9481ae244152187d85349d1a08e439e798182938) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_ebball3_output.pla", 0, 365, CRC(00db663b) SHA1(6eae12503364cfb1f863df0e57970d3e766ec165) ) -ROM_END - - -ROM_START( einvader ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp1211", 0x0000, 0x0800, CRC(b6efbe8e) SHA1(d7d54921dab22bb0c2956c896a5d5b56b6f64969) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_einvader_output.pla", 0, 365, CRC(490158e1) SHA1(61cace1eb09244663de98d8fb04d9459b19668fd) ) -ROM_END - - -ROM_START( efootb4 ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "6009_mp7551", 0x0000, 0x1000, CRC(54fa7244) SHA1(4d16bd825c4a2db76ca8a263c373ade15c20e270) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_efootb4_output.pla", 0, 557, CRC(5c87c753) SHA1(bde9d4aa1e57a718affd969475c0a1edcf60f444) ) -ROM_END - - -ROM_START( ebaskb2 ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "6010_mp1218", 0x0000, 0x0800, CRC(0089ede8) SHA1(c8a79d5aca7e37b637a4d152150acba9f41aad96) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_ebaskb2_output.pla", 0, 365, CRC(c18103ae) SHA1(5a9bb8e1d95a9f6919b05ff9471fa0a8014b8b81) ) -ROM_END - - -ROM_START( raisedvl ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp1221", 0x0000, 0x0800, CRC(782791cc) SHA1(214249406fcaf44efc6350022bd534e59ec69c88) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_raisedvl_output.pla", 0, 365, CRC(00db663b) SHA1(6eae12503364cfb1f863df0e57970d3e766ec165) ) -ROM_END - - -ROM_START( gpoker ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp2105", 0x0000, 0x0800, CRC(95a8f5b4) SHA1(d14f00ba9f57e437264d972baa14a14a28ff8719) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_gpoker_output.pla", 0, 365, CRC(f7e2d812) SHA1(cc3abd89afb1d2145dc47636553ccd0ba7de70d9) ) -ROM_END - - -ROM_START( gjackpot ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mpf553", 0x0000, 0x1000, CRC(f45fd008) SHA1(8d5d6407a8a031a833ceedfb931f5c9d2725ecd0) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_gjackpot_output.pla", 0, 557, CRC(50e471a7) SHA1(9d862cb9f51a563882b62662c5bfe61b52e3df00) ) -ROM_END - - -ROM_START( elecdet ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp6100a", 0x0000, 0x1000, CRC(6f396bb8) SHA1(1f104d4ca9bee0d4572be4779b7551dfe20c4f04) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 1982, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0980_elecdet_output.pla", 0, 352, CRC(652d19c3) SHA1(75550c2b293453b6b9efed88c8cc77195a53161f) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) -ROM_END - - -ROM_START( starwbc ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "mp3438a", 0x0000, 0x0800, CRC(c12b7069) SHA1(d1f39c69a543c128023ba11cc6228bacdfab04de) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_starwbc_output.pla", 0, 365, CRC(d358a76d) SHA1(06b60b207540e9b726439141acadea9aba718013) ) -ROM_END - -ROM_START( starwbcp ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "us4270755", 0x0000, 0x0800, BAD_DUMP CRC(fb3332f2) SHA1(a79ac81e239983cd699b7cfcc55f89b203b2c9ec) ) // from patent US4270755, may have errors - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_starwbc_output.pla", 0, 365, CRC(d358a76d) SHA1(06b60b207540e9b726439141acadea9aba718013) ) -ROM_END - - -ROM_START( astro ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp1133", 0x0000, 0x1000, CRC(bc21109c) SHA1(05a433cce587d5c0c2d28b5fda5f0853ea6726bf) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common2_micro.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_astro_output.pla", 0, 557, CRC(eb08957e) SHA1(62ae0d13a1eaafb34f1b27d7df51441b400ccd56) ) -ROM_END - - -ROM_START( comp4 ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "tmc0904nl_cp0904a", 0x0000, 0x0400, CRC(6233ee1b) SHA1(738e109b38c97804b4ec52bed80b00a8634ad453) ) - - ROM_REGION( 782, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0970_common2_instr.pla", 0, 782, CRC(e038fc44) SHA1(dfc280f6d0a5828d1bb14fcd59ac29caf2c2d981) ) - ROM_REGION( 860, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0970_comp4_micro.pla", 0, 860, CRC(ee9d7d9e) SHA1(25484e18f6a07f7cdb21a07220e2f2a82fadfe7b) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0970_comp4_output.pla", 0, 352, CRC(a0f887d1) SHA1(3c666663d484d5bed81e1014f8715aab8a3d489f) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0970_comp4_segment.pla", 0, 157, CRC(e5bddd90) SHA1(4b1c6512c70e5bcd23c2dbf0c88cd8aa2c632a10) ) -ROM_END - - -ROM_START( simon ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "tms1000.u1", 0x0000, 0x0400, CRC(9961719d) SHA1(35dddb018a8a2b31f377ab49c1f0cb76951b81c0) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1000_simon_micro.pla", 0, 867, CRC(52f7c1f1) SHA1(dbc2634dcb98eac173ad0209df487cad413d08a5) ) - ROM_REGION( 365, "maincpu:opla", 0 ) // unused - ROM_LOAD( "tms1000_simon_output.pla", 0, 365, CRC(2943c71b) SHA1(bd5bb55c57e7ba27e49c645937ec1d4e67506601) ) -ROM_END - - -ROM_START( ssimon ) - ROM_REGION( 0x800, "maincpu", 0 ) - ROM_LOAD( "mp3476", 0x0000, 0x800, CRC(98200571) SHA1(cbd0bcfc11a534aa0be5d011584cdcac58ff437a) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 365, "maincpu:opla", 0 ) // unused - ROM_LOAD( "tms1100_ssimon_output.pla", 0, 365, CRC(0fea09b0) SHA1(27a56fcf2b490e9a7dbbc6ad48cc8aaca4cada94) ) -ROM_END - - -ROM_START( bigtrak ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "mp3301a", 0x0000, 0x0400, CRC(1351bcdd) SHA1(68865389c25b541c09a742be61f8fb6488134d4e) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1000_bigtrak_micro.pla", 0, 867, CRC(80912d0a) SHA1(7ae5293ed4d93f5b7a64d43fe30c3639f39fbe5a) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1000_bigtrak_output.pla", 0, 365, CRC(63be45f6) SHA1(918e38a223152db883c1a6f7acf56e87d7074734) ) -ROM_END - - -ROM_START( cnsector ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "mp0905bnl_za0379", 0x0000, 0x0400, CRC(201036e9) SHA1(b37fef86bb2bceaf0ac8bb3745b4702d17366914) ) - - ROM_REGION( 782, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0970_common2_instr.pla", 0, 782, CRC(e038fc44) SHA1(dfc280f6d0a5828d1bb14fcd59ac29caf2c2d981) ) - ROM_REGION( 860, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0970_cnsector_micro.pla", 0, 860, CRC(059f5bb4) SHA1(2653766f9fd74d41d44013bb6f54c0973a6080c9) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0970_cnsector_output.pla", 0, 352, CRC(7c0bdcd6) SHA1(dade774097e8095dca5deac7b2367d0c701aca51) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0970_common2_segment.pla", 0, 157, CRC(56c37a4f) SHA1(18ecc20d2666e89673739056483aed5a261ae927) ) -ROM_END - - -ROM_START( merlin ) - ROM_REGION( 0x800, "maincpu", 0 ) - ROM_LOAD( "mp3404", 0x0000, 0x800, CRC(7515a75d) SHA1(76ca3605d3fde1df62f79b9bb1f534c2a2ae0229) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common3_micro.pla", 0, 867, CRC(03574895) SHA1(04407cabfb3adee2ee5e4218612cb06c12c540f4) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_merlin_output.pla", 0, 365, CRC(3921b074) SHA1(12bd58e4d6676eb8c7059ef53598279e4f1a32ea) ) -ROM_END - - -ROM_START( mmerlin ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp7351", 0x0000, 0x1000, CRC(0f7a4c83) SHA1(242c1278ddfe92c28fd7cd87300e48e7a4827831) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_mmerlin_output.pla", 0, 557, CRC(fd3dcd93) SHA1(f2afc52df700daa0eb7356c7876af9b2966f971b) ) -ROM_END - - -ROM_START( stopthie ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp6101b", 0x0000, 0x1000, CRC(8bde5bb4) SHA1(8c318fcce67acc24c7ae361f575f28ec6f94665a) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 1982, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0980_stopthie_output.pla", 0, 352, CRC(50337a48) SHA1(4a9ea62ed797a9ac5190eec3bb6ebebb7814628c) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) -ROM_END - -ROM_START( stopthiep ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD16_WORD( "us4341385", 0x0000, 0x1000, CRC(07aec38a) SHA1(0a3d0956495c0d6d9ea771feae6c14a473a800dc) ) // from patent US4341385, data should be correct (it included checksums) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 1982, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0980_stopthie_output.pla", 0, 352, CRC(50337a48) SHA1(4a9ea62ed797a9ac5190eec3bb6ebebb7814628c) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) -ROM_END - - -ROM_START( bankshot ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp7313", 0x0000, 0x1000, CRC(7a5016a9) SHA1(a8730dc8a282ffaa3d89e675f371d43eb39f39b4) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_bankshot_output.pla", 0, 557, CRC(7539283b) SHA1(f791fa98259fc10c393ff1961d4c93040f1a2932) ) -ROM_END - - -ROM_START( splitsec ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp7314", 0x0000, 0x1000, CRC(e94b2098) SHA1(f0fc1f56a829252185592a2508740354c50bedf8) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_splitsec_output.pla", 0, 557, CRC(7539283b) SHA1(f791fa98259fc10c393ff1961d4c93040f1a2932) ) -ROM_END - - -ROM_START( tandy12 ) - ROM_REGION( 0x800, "maincpu", 0 ) - ROM_LOAD( "cd7282sl", 0x0000, 0x800, CRC(a10013dd) SHA1(42ebd3de3449f371b99937f9df39c240d15ac686) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, BAD_DUMP CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // not verified - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_tandy12_output.pla", 0, 365, NO_DUMP ) -ROM_END - - -ROM_START( tbreakup ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "mp2726a", 0x0000, 0x0400, CRC(1f7c28e2) SHA1(164cda4eb3f0b1d20955212a197c9aadf8d18a06) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1000_common2_micro.pla", 0, 867, CRC(d33da3cf) SHA1(13c4ebbca227818db75e6db0d45b66ba5e207776) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1000_tbreakup_output.pla", 0, 365, CRC(a1ea035e) SHA1(fcf0b57ed90b41441a8974223a697f530daac0ab) ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1980, mathmagi, 0, 0, mathmagi, mathmagi, driver_device, 0, "APF Electronics Inc.", "Mathemagician", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) - -CONS( 1979, amaztron, 0, 0, amaztron, amaztron, driver_device, 0, "Coleco", "Amaze-A-Tron", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, h2hbaseb, 0, 0, h2hbaseb, h2hbaseb, driver_device, 0, "Coleco", "Head to Head Baseball", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, h2hfootb, 0, 0, h2hfootb, h2hfootb, driver_device, 0, "Coleco", "Head to Head Football", MACHINE_SUPPORTS_SAVE ) -CONS( 1981, tc4, 0, 0, tc4, tc4, driver_device, 0, "Coleco", "Total Control 4", MACHINE_SUPPORTS_SAVE ) - -CONS( 1979, ebball, 0, 0, ebball, ebball, driver_device, 0, "Entex", "Electronic Baseball (Entex)", MACHINE_SUPPORTS_SAVE ) -CONS( 1979, ebball2, 0, 0, ebball2, ebball2, driver_device, 0, "Entex", "Electronic Baseball 2 (Entex)", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, ebball3, 0, 0, ebball3, ebball3, driver_device, 0, "Entex", "Electronic Baseball 3 (Entex)", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, einvader, 0, 0, einvader, einvader, driver_device, 0, "Entex", "Space Invader (Entex, TMS1100)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1980, efootb4 , 0, 0, efootb4, efootb4, driver_device, 0, "Entex", "Color Football 4 (Entex)", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, ebaskb2 , 0, 0, ebaskb2, ebaskb2, driver_device, 0, "Entex", "Electronic Basketball 2 (Entex)", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, raisedvl, 0, 0, raisedvl, raisedvl, driver_device, 0, "Entex", "Raise The Devil", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1979, gpoker, 0, 0, gpoker, gpoker, driver_device, 0, "Gakken", "Poker (Gakken, 1979 version)", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, gjackpot, 0, 0, gjackpot, gjackpot, driver_device, 0, "Gakken", "Jackpot: Gin Rummy & Black Jack", MACHINE_SUPPORTS_SAVE ) - -CONS( 1979, elecdet, 0, 0, elecdet, elecdet, driver_device, 0, "Ideal", "Electronic Detective", MACHINE_SUPPORTS_SAVE ) // *** - -CONS( 1979, starwbc, 0, 0, starwbc, starwbc, driver_device, 0, "Kenner", "Star Wars - Electronic Battle Command", MACHINE_SUPPORTS_SAVE ) -CONS( 1979, starwbcp, starwbc, 0, starwbc, starwbc, driver_device, 0, "Kenner", "Star Wars - Electronic Battle Command (patent)", MACHINE_SUPPORTS_SAVE ) - -COMP( 1979, astro, 0, 0, astro, astro, driver_device, 0, "Kosmos", "Astro", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) - -CONS( 1977, comp4, 0, 0, comp4, comp4, driver_device, 0, "Milton Bradley", "Comp IV", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -CONS( 1978, simon, 0, 0, simon, simon, driver_device, 0, "Milton Bradley", "Simon (Rev. A)", MACHINE_SUPPORTS_SAVE ) -CONS( 1979, ssimon, 0, 0, ssimon, ssimon, driver_device, 0, "Milton Bradley", "Super Simon", MACHINE_SUPPORTS_SAVE ) -CONS( 1979, bigtrak, 0, 0, bigtrak, bigtrak, driver_device, 0, "Milton Bradley", "Big Trak", MACHINE_SUPPORTS_SAVE | MACHINE_MECHANICAL ) // *** - -CONS( 1977, cnsector, 0, 0, cnsector, cnsector, driver_device, 0, "Parker Brothers", "Code Name: Sector", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) // *** -CONS( 1978, merlin, 0, 0, merlin, merlin, driver_device, 0, "Parker Brothers", "Merlin - The Electronic Wizard", MACHINE_SUPPORTS_SAVE ) -CONS( 1979, stopthie, 0, 0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner)", MACHINE_SUPPORTS_SAVE ) // *** -CONS( 1979, stopthiep, stopthie, 0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner) (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -CONS( 1980, bankshot, 0, 0, bankshot, bankshot, driver_device, 0, "Parker Brothers", "Bank Shot - Electronic Pool", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", MACHINE_SUPPORTS_SAVE ) -CONS( 1982, mmerlin, 0, 0, mmerlin, mmerlin, driver_device, 0, "Parker Brothers", "Master Merlin", MACHINE_SUPPORTS_SAVE ) - -CONS( 1981, tandy12, 0, 0, tandy12, tandy12, driver_device, 0, "Tandy Radio Shack", "Tandy-12: Computerized Arcade", MACHINE_SUPPORTS_SAVE ) // some of the minigames: *** - -CONS( 1979, tbreakup, 0, 0, tbreakup, tbreakup, driver_device, 0, "Tomy", "Break Up (Tomy)", MACHINE_SUPPORTS_SAVE ) - -// ***: As far as MAME is concerned, the game is emulated fine. But for it to be playable, it requires interaction -// with other, unemulatable, things eg. game board/pieces, playing cards, pen & paper, etc. diff --git a/src/mess/drivers/hh_ucom4.c b/src/mess/drivers/hh_ucom4.c deleted file mode 100644 index 8aa5836ffe9..00000000000 --- a/src/mess/drivers/hh_ucom4.c +++ /dev/null @@ -1,2552 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Kevin Horton -/*************************************************************************** - - NEC uCOM4 MCU tabletops/handhelds or other simple devices, - most of them (emulated ones) are VFD electronic games/toys. - - Commonly used VFD(vacuum fluorescent display) are by NEC or Futaba. - - NEC FIP9AM20T (example, Epoch Astro Command) - grcss - - FIP = fluorescent indicator panel - g = number of grids - A = revision of the VFD - M = custom display - 20 = unique display part number - - - known chips: - - serial device etc. ----------------------------------------------------------------- - @017 uPD552C 1979, Bambino UFO Master-Blaster Station (ET-02) - @042 uPD552C 1980, Tomy Cosmic Combat (TN-??) - @043 uPD552C 1979, Bambino Kick The Goal Soccer (ET-10) - *044 uPD552C 1979, Bambino Lucky Puck Ice Hockey (ET-08) - @048 uPD552C 1980, Tomy Tennis (TN-04) - @049 uPD552C 1981, Bambino Safari (ET-11) - @054 uPD552C 1980, Epoch Invader From Space - - @031 uPD553C 1979, Bambino Superstar Football (ET-03) - @049 uPD553C 1979, Mego Mini-Vid Break Free - @055 uPD553C 1980, Bambino Space Laser Fight (ET-12) - *073 uPD553C 1980, Sony ST-J75 FM Stereo Tuner - @080 uPD553C 1980, Epoch Electronic Football - *102 uPD553C 1981, Bandai Block Out - @153 uPD553C 1981, Epoch Galaxy II - @160 uPD553C 1982, Tomy Pac Man (TN-08) - @170 uPD553C 1982, Bandai Crazy Climber - @192 uPD553C 1982, Tomy Scramble (TN-10) - @202 uPD553C 1982, Epoch Astro Command - @206 uPD553C 1982, Epoch Dracula - @209 uPD553C 1982, Tomy Caveman (TN-12) - @258 uPD553C 1984, Tomy Alien Chase (TN-16) - - @512 uPD557LC 1980, Castle Toy Tactix - - *060 uPD650C 1979, Mattel Computer Gin - *085 uPD650C 1980, Roland TR-808 - *127 uPD650C 198?, Sony OA-S1100 Typecorder (subcpu, have dump) - *128 uPD650C 1981, Roland TR-606 - 133 uPD650C 1982, Roland TB-303 -> tb303.c - - (* denotes not yet emulated by MAME, @ denotes it's in this driver) - - -TODO: - - games that rely on the fact that faster/longer strobed elements appear brighter: - tactix(player 2) - -***************************************************************************/ - -#include "includes/hh_ucom4.h" - -// internal artwork -#include "efball.lh" -#include "mvbfree.lh" -#include "tactix.lh" // clickable - -#include "hh_ucom4_test.lh" // common test-layout - use external artwork - - -// machine start/reset - -void hh_ucom4_state::machine_start() -{ - // zerofill - memset(m_display_state, 0, sizeof(m_display_state)); - memset(m_display_cache, ~0, sizeof(m_display_cache)); - memset(m_display_decay, 0, sizeof(m_display_decay)); - memset(m_display_segmask, 0, sizeof(m_display_segmask)); - - memset(m_port, 0, sizeof(m_port)); - m_inp_mux = 0; - m_grid = 0; - m_plate = 0; - - // register for savestates - save_item(NAME(m_display_maxy)); - save_item(NAME(m_display_maxx)); - save_item(NAME(m_display_wait)); - - save_item(NAME(m_display_state)); - /* save_item(NAME(m_display_cache)); */ // don't save! - save_item(NAME(m_display_decay)); - save_item(NAME(m_display_segmask)); - - save_item(NAME(m_port)); - save_item(NAME(m_inp_mux)); - save_item(NAME(m_grid)); - save_item(NAME(m_plate)); -} - -void hh_ucom4_state::machine_reset() -{ -} - - - -/*************************************************************************** - - Helper Functions - -***************************************************************************/ - -// The device may strobe the outputs very fast, it is unnoticeable to the user. -// To prevent flickering here, we need to simulate a decay. - -void hh_ucom4_state::display_update() -{ - UINT32 active_state[0x20]; - - for (int y = 0; y < m_display_maxy; y++) - { - active_state[y] = 0; - - for (int x = 0; x <= m_display_maxx; x++) - { - // turn on powered segments - if (m_display_state[y] >> x & 1) - m_display_decay[y][x] = m_display_wait; - - // determine active state - UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; - active_state[y] |= (ds << x); - } - } - - // on difference, send to output - for (int y = 0; y < m_display_maxy; y++) - if (m_display_cache[y] != active_state[y]) - { - if (m_display_segmask[y] != 0) - output_set_digit_value(y, active_state[y] & m_display_segmask[y]); - - const int mul = (m_display_maxx <= 10) ? 10 : 100; - for (int x = 0; x <= m_display_maxx; x++) - { - int state = active_state[y] >> x & 1; - char buf1[0x10]; // lampyx - char buf2[0x10]; // y.x - - if (x == m_display_maxx) - { - // always-on if selected - sprintf(buf1, "lamp%da", y); - sprintf(buf2, "%d.a", y); - } - else - { - sprintf(buf1, "lamp%d", y * mul + x); - sprintf(buf2, "%d.%d", y, x); - } - output_set_value(buf1, state); - output_set_value(buf2, state); - } - } - - memcpy(m_display_cache, active_state, sizeof(m_display_cache)); -} - -TIMER_DEVICE_CALLBACK_MEMBER(hh_ucom4_state::display_decay_tick) -{ - // slowly turn off unpowered segments - for (int y = 0; y < m_display_maxy; y++) - for (int x = 0; x <= m_display_maxx; x++) - if (m_display_decay[y][x] != 0) - m_display_decay[y][x]--; - - display_update(); -} - -void hh_ucom4_state::set_display_size(int maxx, int maxy) -{ - m_display_maxx = maxx; - m_display_maxy = maxy; -} - -void hh_ucom4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety) -{ - set_display_size(maxx, maxy); - - // update current state - UINT32 mask = (1 << maxx) - 1; - for (int y = 0; y < maxy; y++) - m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; - - display_update(); -} - - -UINT8 hh_ucom4_state::read_inputs(int columns) -{ - UINT8 ret = 0; - - // read selected input rows - for (int i = 0; i < columns; i++) - if (m_inp_mux >> i & 1) - ret |= m_inp_matrix[i]->read(); - - return ret; -} - - - -/*************************************************************************** - - Minidrivers (subclass, I/O, Inputs, Machine Config) - -***************************************************************************/ - -/*************************************************************************** - - Bambino UFO Master-Blaster Station (manufactured in Japan) - * PCB label Emix Corp. ET-02 - * NEC uCOM-44 MCU, labeled EMIX D552C 017 - * cyan VFD display Emix-101, with blue color overlay - - This is Bambino's first game, it is not known if ET-01 exists. Emix Corp. - wasn't initially a toy company, the first release was through Tomy. Emix - created the Bambino brand afterwards. It is claimed to be the first - computerized VFD game (true, unless TI Speak & Spell(1978), or even Invicta - Electronic Mastermind(1977) are considered games) - - known releases: - - Japan: "Missile Guerilla Warfare Maneuvers", published by Tomy - - World: UFO Master-Blaster Station - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class ufombs_state : public hh_ucom4_state -{ -public: - ufombs_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE8_MEMBER(speaker_w); -}; - -// handlers - -void ufombs_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,3,2,1,0,4,5,6,7,8); - UINT16 plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,6,9,5,8,4,0,1,2,3); - display_matrix(10, 9, plate, grid); -} - -WRITE8_MEMBER(ufombs_state::grid_w) -{ - // F,G,H0: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTF) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(ufombs_state::plate_w) -{ - // C,D012,I: vfd matrix plate - int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(ufombs_state::speaker_w) -{ - // E01: speaker out - m_speaker->level_w(data & 3); -} - - -// config - -static INPUT_PORTS_START( ufombs ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY - PORT_BIT( 0x04, 0x04, IPT_SPECIAL ) PORT_CONDITION("IN.0", 0x0a, EQUALS, 0x00) // pad in the middle, pressed when joystick is centered - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY - - PORT_START("IN.1") // port B - PORT_CONFNAME( 0x07, 0x01, "Skill Level" ) - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFSETTING( 0x04, "3" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -static const INT16 ufombs_speaker_levels[] = { 0, 32767, -32768, 0 }; - -static MACHINE_CONFIG_START( ufombs, ufombs_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D552, 400000) // approximation - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(ufombs_state, plate_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(ufombs_state, plate_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(ufombs_state, speaker_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(ufombs_state, grid_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(ufombs_state, grid_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(ufombs_state, grid_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(ufombs_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(4, ufombs_speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bambino Superstar Football (manufactured in Japan) - * PCB label Emix Corp. ET-03 - * NEC uCOM-43 MCU, labeled D553C 031 - * cyan VFD display Emix-102, with bezel - - The game was rereleased in 1982 as Classic Football, with an improved VFD. - - Press the Kick button to start the game, an automatic sequence follows. - Then choose a formation(A,B,C) and either pass the ball, and/or start - running. For more information, refer to the official manual. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class ssfball_state : public hh_ucom4_state -{ -public: - ssfball_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_READ8_MEMBER(input_b_r); -}; - -// handlers - -void ssfball_state::prepare_display() -{ - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6); - display_matrix(16, 9, plate, m_grid); -} - -WRITE8_MEMBER(ssfball_state::grid_w) -{ - // C,D(,E3): vfd matrix grid 0-7(,8) - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(ssfball_state::plate_w) -{ - m_port[offset] = data; - - // E,F,G,H,I(not all!): vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // F3,G3: input mux + speaker - m_inp_mux = (m_port[NEC_UCOM4_PORTF] >> 3 & 1) | (m_port[NEC_UCOM4_PORTG] >> 2 & 2); - m_speaker->level_w(m_inp_mux); - - // E3: vfd matrix grid 8 - if (offset == NEC_UCOM4_PORTE) - grid_w(space, offset, data >> 3 & 1); - else - prepare_display(); -} - -READ8_MEMBER(ssfball_state::input_b_r) -{ - // B: input port 2, where B3 is multiplexed - return m_inp_matrix[2]->read() | read_inputs(2); -} - - -// config - -/* physical button layout and labels is like this: - - [A] [B] [C] [PASS] [KICK/ - ^FORMATION^ DISPLAY] - - [^] - [<>] - (game lvl sw) [v] - 1<---OFF--->2 -*/ - -static INPUT_PORTS_START( ssfball ) - PORT_START("IN.0") // F3 port B3 - PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Formation A") - - PORT_START("IN.1") // G3 port B3 - PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_CONFNAME( 0x08, 0x00, "Game Level" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x08, "2" ) - - PORT_START("IN.2") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Kick/Display") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Formation C") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Formation B") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) // multiplexed, handled in input_b_r - - PORT_START("IN.3") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY PORT_NAME("Ball-carrier Left/Right") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY PORT_NAME("Ball-carrier Up") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY PORT_NAME("Ball-carrier Down") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Pass") -INPUT_PORTS_END - - -static const INT16 ssfball_speaker_levels[] = { 0, 32767, -32768, 0 }; - -static MACHINE_CONFIG_START( ssfball, ssfball_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, 400000) // approximation - MCFG_UCOM4_READ_A_CB(IOPORT("IN.3")) - MCFG_UCOM4_READ_B_CB(READ8(ssfball_state, input_b_r)) - MCFG_UCOM4_WRITE_C_CB(WRITE8(ssfball_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(ssfball_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(ssfball_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(ssfball_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(ssfball_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(ssfball_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(ssfball_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(4, ssfball_speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bambino Kick The Goal Soccer - * PCB label Emix Corp. ET-10/08 (PCB is for 2 possible games) - * NEC uCOM-44 MCU, labeled D552C 043 - * cyan VFD display Emix-105, with bezel overlay - - Press the Display button twice to start the game. Action won't start until - player 1 presses one of the directional keys. In 2-player mode, player 2 - controls the goalkeeper, defensive players are still controlled by the CPU. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bmsoccer_state : public hh_ucom4_state -{ -public: - bmsoccer_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_READ8_MEMBER(input_a_r); -}; - -// handlers - -void bmsoccer_state::prepare_display() -{ - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,8,4,0,9,5,1,10,6,2); - display_matrix(16, 9, plate, m_grid); -} - -WRITE8_MEMBER(bmsoccer_state::grid_w) -{ - // C01: input mux - if (offset == NEC_UCOM4_PORTC) - m_inp_mux = data & 3; - - // C,D(,E3): vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(bmsoccer_state::plate_w) -{ - // G3: speaker out - if (offset == NEC_UCOM4_PORTG) - m_speaker->level_w(data >> 3 & 1); - - // E012,F012,G012,H,I: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // E3: grid 8 - if (offset == NEC_UCOM4_PORTE) - grid_w(space, offset, data >> 3 & 1); - else - prepare_display(); -} - -READ8_MEMBER(bmsoccer_state::input_a_r) -{ - // port A: multiplexed inputs - return read_inputs(2); -} - - -// config - -static INPUT_PORTS_START( bmsoccer ) - PORT_START("IN.0") // C0 port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("Ball-carrier Right") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY PORT_NAME("Ball-carrier Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY PORT_NAME("Ball-carrier Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY PORT_NAME("Ball-carrier Up") - - PORT_START("IN.1") // C1 port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL PORT_16WAY PORT_NAME("Goalkeeper Left") // note: swap buttons if viewed from the same angle as player 1 - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_16WAY PORT_NAME("Goalkeeper Right") - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // port B - PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x01, "2" ) - PORT_CONFNAME( 0x02, 0x00, "Players" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Display/Banana Shoot") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Shoot") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( bmsoccer, bmsoccer_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D552, 400000) // approximation - MCFG_UCOM4_READ_A_CB(READ8(bmsoccer_state, input_a_r)) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.2")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(bmsoccer_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(bmsoccer_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(bmsoccer_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(bmsoccer_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(bmsoccer_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(bmsoccer_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(bmsoccer_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bambino Safari (manufactured in Japan) - * PCB label Emix Corp. ET-11 - * NEC uCOM-44 MCU, labeled EMIX D552C 049 - * cyan VFD display Emix-108 - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bmsafari_state : public hh_ucom4_state -{ -public: - bmsafari_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE8_MEMBER(speaker_w); -}; - -// handlers - -void bmsafari_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); - UINT16 plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,2,9,5,8,4,0,1,6,3); - display_matrix(10, 9, plate, grid); -} - -WRITE8_MEMBER(bmsafari_state::grid_w) -{ - // C,D(,E3): vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(bmsafari_state::plate_w) -{ - // E012,H,I: vfd matrix plate - int shift = (offset == NEC_UCOM4_PORTE) ? 8 : (offset - NEC_UCOM4_PORTH) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - // E3: grid 0 - if (offset == NEC_UCOM4_PORTE) - grid_w(space, offset, data >> 3 & 1); - else - prepare_display(); -} - -WRITE8_MEMBER(bmsafari_state::speaker_w) -{ - // G0: speaker out - m_speaker->level_w(data & 1); -} - - -// config - -static INPUT_PORTS_START( bmsafari ) - PORT_START("IN.0") // port A - PORT_CONFNAME( 0x07, 0x04, "Skill Level" ) - PORT_CONFSETTING( 0x04, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFSETTING( 0x01, "3" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - - PORT_START("IN.1") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY -INPUT_PORTS_END - -static MACHINE_CONFIG_START( bmsafari, bmsafari_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D552, 400000) // approximation - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(bmsafari_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(bmsafari_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(bmsafari_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(bmsafari_state, speaker_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(bmsafari_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(bmsafari_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bambino Space Laser Fight (manufactured in Japan) - * PCB label Emix Corp. ET-12 - * NEC uCOM-43 MCU, labeled D553C 055 - * cyan VFD display Emix-104, with blue or green color overlay - - This is basically a revamp of their earlier Boxing game (ET-06), case and - buttons are exactly the same. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class splasfgt_state : public hh_ucom4_state -{ -public: - splasfgt_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_READ8_MEMBER(input_b_r); -}; - -// handlers - -void splasfgt_state::prepare_display() -{ - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3); - display_matrix(16, 9, plate, m_grid); -} - -WRITE8_MEMBER(splasfgt_state::grid_w) -{ - // G,H,I0: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTG) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - - // G(grid 0-3): input mux - m_inp_mux = m_grid & 0xf; - - // I2: vfd matrix plate 6 - if (offset == NEC_UCOM4_PORTI) - plate_w(space, 4 + NEC_UCOM4_PORTC, data >> 2 & 1); - else - prepare_display(); -} - -WRITE8_MEMBER(splasfgt_state::plate_w) -{ - // F01: speaker out - if (offset == NEC_UCOM4_PORTF) - m_speaker->level_w(data & 3); - - // C,D,E,F23(,I2): vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -READ8_MEMBER(splasfgt_state::input_b_r) -{ - // B: multiplexed buttons - return read_inputs(4); -} - - -// config - -/* physical button layout and labels is like this: - - * left = P1 side * * right = P2 side * (note: in 1P mode, switch sides between turns) - - [ JUMP ] [ HIGH ] (players sw) [ HIGH ] [ JUMP ] - 1<--->2 [START/ - [STRAIGHT] [MEDIUM] RESET] [MEDIUM] [STRAIGHT] - 1<---OFF--->2 - [ STOOP ] [ LOW ] (skill lvl sw) [ LOW ] [ STOOP ] -*/ - -static INPUT_PORTS_START( splasfgt ) - PORT_START("IN.0") // G0 port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("P1 Position Straight") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("P1 Position Jump") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("P1 Position Stoop") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // G1 port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("P1 Beam High") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("P1 Beam Medium") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("P1 Beam Low") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // G2 port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("P2 Position Straight") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("P2 Position Jump") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("P2 Position Stoop") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // G3 port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("P2 Beam High") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P2 Beam Medium") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("P2 Beam Low") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // port A - PORT_CONFNAME( 0x01, 0x00, "Players" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x01, "2" ) - PORT_CONFNAME( 0x02, 0x00, "Skill Level" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -static const INT16 splasfgt_speaker_levels[] = { 0, 32767, -32768, 0 }; - -static MACHINE_CONFIG_START( splasfgt, splasfgt_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, 400000) // approximation - MCFG_UCOM4_READ_A_CB(IOPORT("IN.4")) - MCFG_UCOM4_READ_B_CB(READ8(splasfgt_state, input_b_r)) - MCFG_UCOM4_WRITE_C_CB(WRITE8(splasfgt_state, plate_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(splasfgt_state, plate_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(splasfgt_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(splasfgt_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(splasfgt_state, grid_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(splasfgt_state, grid_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(splasfgt_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(4, splasfgt_speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Bandai Crazy Climber (manufactured in Japan) - * PCB labels SM-020/SM-021 - * NEC uCOM-43 MCU, labeled D553C 170 - * cyan/red/green VFD display NEC FIP6AM2-T no. 1-8 2, with partial color overlay and bezel - - known releases: - - Japan: FL Crazy Climbing - - USA: Crazy Climber - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class bcclimbr_state : public hh_ucom4_state -{ -public: - bcclimbr_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void bcclimbr_state::prepare_display() -{ - UINT8 grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,16,17,18,19,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); - display_matrix(20, 6, plate, grid); -} - -WRITE8_MEMBER(bcclimbr_state::grid_w) -{ - // I2: speaker out - if (offset == NEC_UCOM4_PORTI) - m_speaker->level_w(data >> 2 & 1); - - // H,I01: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTH) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(bcclimbr_state::plate_w) -{ - // C,D,E,F: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( bcclimbr ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) - - PORT_START("IN.1") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( bcclimbr, bcclimbr_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(bcclimbr_state, plate_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(bcclimbr_state, plate_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(bcclimbr_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(bcclimbr_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(bcclimbr_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(bcclimbr_state, grid_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(bcclimbr_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Castle Toy Tactix - * NEC uCOM-43 MCU, labeled D557LC 512 - * 16 LEDs behind buttons - - Tactix is similar to Merlin, for 1 or 2 players. In 2-player mode, simply - don't press the Comp Turn button. The four included minigames are: - 1: Capture (reversi) - 2: Jump-Off (peg solitaire) - 3: Triple Play (3 in a row) - 4: Concentration (memory) - - note: MAME external artwork is not needed for this game - -***************************************************************************/ - -class tactix_state : public hh_ucom4_state -{ -public: - tactix_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(leds_w); - DECLARE_WRITE8_MEMBER(speaker_w); - DECLARE_WRITE8_MEMBER(input_w); - DECLARE_READ8_MEMBER(input_r); -}; - -// handlers - -WRITE8_MEMBER(tactix_state::leds_w) -{ - // D,F: 4*4 led matrix - m_port[offset] = data; - display_matrix(4, 4, m_port[NEC_UCOM4_PORTD], m_port[NEC_UCOM4_PORTF]); -} - -WRITE8_MEMBER(tactix_state::speaker_w) -{ - // G0: speaker out - m_speaker->level_w(data & 1); -} - -WRITE8_MEMBER(tactix_state::input_w) -{ - // C,E0: input mux - m_port[offset] = data; - m_inp_mux = (m_port[NEC_UCOM4_PORTE] << 4 & 0x10) | m_port[NEC_UCOM4_PORTC]; -} - -READ8_MEMBER(tactix_state::input_r) -{ - // A: multiplexed inputs - return read_inputs(5); -} - - -// config - -static INPUT_PORTS_START( tactix ) - PORT_START("IN.0") // C0 port A - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Button 1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Button 5") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Button 9") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("Button 13") - - PORT_START("IN.1") // C1 port A - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Button 2") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Button 6") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Button 10") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Button 14") - - PORT_START("IN.2") // C2 port A - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Button 3") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Button 7") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Button 11") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Button 15") - - PORT_START("IN.3") // C3 port A - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Button 4") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Button 8") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Button 12") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Button 16") - - PORT_START("IN.4") // E0 port A - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("New Game") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Comp Turn") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( tactix, tactix_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D557L, 400000) // approximation - MCFG_UCOM4_READ_A_CB(READ8(tactix_state, input_r)) - MCFG_UCOM4_WRITE_C_CB(WRITE8(tactix_state, input_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(tactix_state, leds_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(tactix_state, input_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(tactix_state, leds_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(tactix_state, speaker_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_tactix) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Epoch Invader From Space (manufactured in Japan) - * PCB labels 36010(A/B) - * NEC uCOM-44 MCU, labeled D552C 054 - * cyan VFD display NEC FIP9AM18T tube no. 0D, with color overlay - - known releases: - - USA: Invader From Space - - UK: Invader From Space, published by Grandstand - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class invspace_state : public hh_ucom4_state -{ -public: - invspace_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void invspace_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,8,9,7,6,5,4,3,2,1,0); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,9,14,13,8,15,11,10,7,11,3,2,6,10,1,5,9,0,4,8); - display_matrix(19, 9, plate, grid); -} - -WRITE8_MEMBER(invspace_state::grid_w) -{ - // I0: speaker out - if (offset == NEC_UCOM4_PORTI) - m_speaker->level_w(data & 1); - - // C,D,I1: vfd matrix grid - int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(invspace_state::plate_w) -{ - // E,F,G,H123: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( invspace ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( invspace, invspace_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D552, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(invspace_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(invspace_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(invspace_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(invspace_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(invspace_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(invspace_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(invspace_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Epoch Electronic Football (manufactured in Japan) - * PCB labels 36020(A/B/C) - * NEC uCOM-43 MCU, labeled D553C 080 - * cyan VFD display NEC FIP10AM15T tube no. 0F, with bezel overlay - - known releases: - - USA: Electronic Football (aka Pro-Bowl Football) - - Japan: American Football - - note: MAME external artwork is not needed for this game - -***************************************************************************/ - -class efball_state : public hh_ucom4_state -{ -public: - efball_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void efball_state::prepare_display() -{ - UINT16 plate = BITSWAP16(m_plate,15,14,13,12,11,4,3,0,2,1,6,10,9,5,8,7); - display_matrix(11, 10, plate, m_grid); -} - -WRITE8_MEMBER(efball_state::grid_w) -{ - // H2: speaker out - if (offset == NEC_UCOM4_PORTH) - m_speaker->level_w(data >> 2 & 1); - - // F,G,H01: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTF) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(efball_state::plate_w) -{ - // D,E,I: vfd matrix plate - int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTD) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( efball ) - PORT_START("IN.0") // port A - PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) - PORT_CONFSETTING( 0x00, "Amateur" ) - PORT_CONFSETTING( 0x01, "Professional" ) - PORT_CONFNAME( 0x02, 0x02, "Players" ) - PORT_CONFSETTING( 0x02, "1" ) - PORT_CONFSETTING( 0x00, "2" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Down-Field") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P1 Score-Time") - - PORT_START("IN.1") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY PORT_NAME("P1 Left/Right") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Pass") - - PORT_START("IN.2") // port C - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Kick Return") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Kick") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( efball, efball_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_READ_C_CB(IOPORT("IN.2")) - MCFG_UCOM4_WRITE_D_CB(WRITE8(efball_state, plate_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(efball_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(efball_state, grid_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(efball_state, grid_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(efball_state, grid_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(efball_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_efball) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Epoch Galaxy II (manufactured in Japan) - * PCB labels 19096/96062 - * NEC uCOM-43 MCU, labeled D553C 153 - * cyan/red VFD display NEC FIP10xM20T, with color overlay. x = multiple VFD - revisions exist, with different graphics: rev B no. 1-8, rev. D no. 2-21. - - known releases: - - USA: Galaxy II - - Japan: Astro Wars - - UK: Astro Wars, published by Grandstand - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class galaxy2_state : public hh_ucom4_state -{ -public: - galaxy2_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void galaxy2_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - UINT16 plate = BITSWAP16(m_plate,15,3,2,6,1,5,4,0,11,10,7,12,14,13,8,9); - display_matrix(15, 10, plate, grid); -} - -WRITE8_MEMBER(galaxy2_state::grid_w) -{ - // E3: speaker out - if (offset == NEC_UCOM4_PORTE) - m_speaker->level_w(data >> 3 & 1); - - // C,D,E01: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(galaxy2_state::plate_w) -{ - // F,G,H,I: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTF) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( galaxy2 ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( galaxy2, galaxy2_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(galaxy2_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(galaxy2_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(galaxy2_state, grid_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(galaxy2_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(galaxy2_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(galaxy2_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(galaxy2_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Epoch Astro Command (manufactured in Japan) - * PCB labels 96111/96112 - * NEC uCOM-43 MCU, labeled D553C 202 - * cyan/red VFD display NEC FIP9AM20T no. 42-42, with color overlay + bezel - - known releases: - - Japan: Astro Command - - USA: Astro Command, published by Tandy - - UK: Scramble, published by Grandstand - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class astrocmd_state : public hh_ucom4_state -{ -public: - astrocmd_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void astrocmd_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,4,5,6,7,0,1,2,3); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,3,2,12,13,14,15,16,17,18,0,1,4,8,5,9,7,11,6,10); - display_matrix(17, 9, plate, grid); -} - -WRITE8_MEMBER(astrocmd_state::grid_w) -{ - // C,D(,E3): vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(astrocmd_state::plate_w) -{ - // E01,F,G,H,I: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - if (offset == NEC_UCOM4_PORTE) - { - // E2: speaker out - m_speaker->level_w(data >> 2 & 1); - - // E3: vfd matrix grid 8 - grid_w(space, offset, data >> 3 & 1); - } - else - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( astrocmd ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Missile") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Bomb") - - PORT_START("IN.1") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( astrocmd, astrocmd_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(astrocmd_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(astrocmd_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(astrocmd_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(astrocmd_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(astrocmd_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(astrocmd_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(astrocmd_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Epoch Dracula (manufactured in Japan) - * PCB label 96121 - * NEC uCOM-43 MCU, labeled D553C 206 - * cyan/red/green VFD display NEC FIP8BM20T no. 2-42 - - known releases: - - Japan: Dracula House, yellow case - - USA: Dracula, red case - - Other: Dracula, yellow case, published by Hales - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class edracula_state : public hh_ucom4_state -{ -public: - edracula_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -WRITE8_MEMBER(edracula_state::grid_w) -{ - // C,D: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - display_matrix(18, 8, m_plate, m_grid); -} - -WRITE8_MEMBER(edracula_state::plate_w) -{ - // I2: speaker out - if (offset == NEC_UCOM4_PORTI) - m_speaker->level_w(data >> 2 & 1); - - // E,F,G,H,I01: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - display_matrix(18, 8, m_plate, m_grid); -} - - -// config - -static INPUT_PORTS_START( edracula ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( edracula, edracula_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(edracula_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(edracula_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(edracula_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(edracula_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(edracula_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(edracula_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(edracula_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Mego Mini-Vid Break Free (manufactured in Japan) - * PCB label Mego 79 rev F - * NEC uCOM-43 MCU, labeled D553C 049 - * cyan VFD display Futaba DM-4.5 91 - - note: MAME external artwork is not needed for this game - -***************************************************************************/ - -class mvbfree_state : public hh_ucom4_state -{ -public: - mvbfree_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE8_MEMBER(speaker_w); -}; - -// handlers - -void mvbfree_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); - UINT16 plate = BITSWAP16(m_plate,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); - display_matrix(10, 14, plate, grid); -} - -WRITE8_MEMBER(mvbfree_state::grid_w) -{ - // E23,F,G,H: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - - // E01: plate 0,1 - if (offset == NEC_UCOM4_PORTE) - plate_w(space, 2 + NEC_UCOM4_PORTC, data & 3); - else - prepare_display(); -} - -WRITE8_MEMBER(mvbfree_state::plate_w) -{ - // C,D(,E01): vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(mvbfree_state::speaker_w) -{ - // I0: speaker out - m_speaker->level_w(data & 1); -} - - -// config - -static INPUT_PORTS_START( mvbfree ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - - PORT_START("IN.1") // port B - PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) // unimplemented p1/p2 buttons - PORT_CONFNAME( 0x0c, 0x04, "Game Select") - PORT_CONFSETTING( 0x04, "1" ) - PORT_CONFSETTING( 0x00, "2" ) - PORT_CONFSETTING( 0x08, "3" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( mvbfree, mvbfree_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, 400000) // approximation - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(mvbfree_state, plate_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(mvbfree_state, plate_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(mvbfree_state, grid_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(mvbfree_state, grid_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(mvbfree_state, grid_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(mvbfree_state, grid_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(mvbfree_state, speaker_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_mvbfree) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy(tronic) Cosmic Combat (manufactured in Japan) - * PCBs are labeled 2E1019-E01 - * NEC uCOM-44 MCU, labeled D552C 042 - * cyan VFD display NEC FIP32AM18Y tube no. 0E, with color overlay - - known releases: - - USA: Cosmic Combat - - Japan: Space Attack - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class tccombat_state : public hh_ucom4_state -{ -public: - tccombat_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void tccombat_state::prepare_display() -{ - UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,3,2,1,0,7,6,5,4); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,11,15,3,10,14,2,9,13,1,0,12,8,15,1,5,0,3,7,2,6); - display_matrix(20, 9, plate, grid); -} - -WRITE8_MEMBER(tccombat_state::grid_w) -{ - // I1: speaker out - if (offset == NEC_UCOM4_PORTI) - m_speaker->level_w(data >> 1 & 1); - - // C,D,I0: vfd matrix grid - int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(tccombat_state::plate_w) -{ - // E,F123,G,H: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( tccombat ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) - PORT_CONFSETTING( 0x02, "1" ) - PORT_CONFSETTING( 0x00, "2" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY -INPUT_PORTS_END - -static MACHINE_CONFIG_START( tccombat, tccombat_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D552, 400000) // approximation - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(tccombat_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(tccombat_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(tccombat_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(tccombat_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(tccombat_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(tccombat_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(tccombat_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy(tronic) Tennis (manufactured in Japan) - * PCB labeled TOMY TN-04 TENNIS - * NEC uCOM-44 MCU, labeled D552C 048 - * VFD display NEC FIP11AM15T tube no. 0F, with overlay - - The initial release of this game was in 1979, known as Pro-Tennis, - it has a D553 instead of D552, with just a little over 50% ROM used. - - Press the Serve button to start, then hit the ball by pressing one of the - positional buttons when the ball flies over it. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class tmtennis_state : public hh_ucom4_state -{ -public: - tmtennis_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); - DECLARE_WRITE8_MEMBER(port_e_w); - DECLARE_READ8_MEMBER(input_r); - - void set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(difficulty_switch); - -protected: - virtual void machine_reset(); -}; - -// handlers - -WRITE8_MEMBER(tmtennis_state::grid_w) -{ - // G,H,I: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTG) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - display_matrix(12, 12, m_plate, m_grid); -} - -WRITE8_MEMBER(tmtennis_state::plate_w) -{ - // C,D,F: vfd matrix plate - int shift = (offset == NEC_UCOM4_PORTF) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - display_matrix(12, 12, m_plate, m_grid); -} - -WRITE8_MEMBER(tmtennis_state::port_e_w) -{ - // E01: input mux - // E2: speaker out - // E3: N/C - m_inp_mux = data & 3; - m_speaker->level_w(data >> 2 & 1); -} - -READ8_MEMBER(tmtennis_state::input_r) -{ - // A,B: multiplexed buttons - return ~read_inputs(2) >> (offset*4); -} - - -// config - -/* Pro-Tennis physical button layout and labels is like this: - - * left = P2/CPU side * * right = P1 side * - - [SERVE] [1] [2] [3] [3] [2] [1] [SERVE] - [4] [5] [6] [6] [5] [4] - - PRACTICE<--PRO1-->PRO2 1PLAYER<--OFF-->2PLAYER -*/ - -static INPUT_PORTS_START( tmtennis ) - PORT_START("IN.0") // E0 port A/B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("P1 Serve") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("P2 Serve") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_NAME("P1 Button 1") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("P1 Button 4") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("P1 Button 2") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("P1 Button 5") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("P1 Button 3") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P1 Button 6") - - PORT_START("IN.1") // E1 port A/B - PORT_CONFNAME( 0x101, 0x100, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, tmtennis_state, difficulty_switch, NULL) - PORT_CONFSETTING( 0x001, "Practice" ) - PORT_CONFSETTING( 0x100, "Pro 1" ) // -> difficulty_switch - PORT_CONFSETTING( 0x000, "Pro 2" ) - PORT_CONFNAME( 0x02, 0x00, "Players" ) - PORT_CONFSETTING( 0x00, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("P2 Button 1") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("P2 Button 4") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("P2 Button 2") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("P2 Button 5") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("P2 Button 3") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("P2 Button 6") -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(tmtennis_state::difficulty_switch) -{ - set_clock(); -} - - -void tmtennis_state::set_clock() -{ - // MCU clock is from an LC circuit oscillating by default at ~360kHz, - // but on PRO1, the difficulty switch puts a capacitor across the LC circuit - // to slow it down to ~260kHz. - m_maincpu->set_unscaled_clock((m_inp_matrix[1]->read() & 0x100) ? 260000 : 360000); -} - -void tmtennis_state::machine_reset() -{ - hh_ucom4_state::machine_reset(); - set_clock(); -} - -static MACHINE_CONFIG_START( tmtennis, tmtennis_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D552, 360000) // see set_clock - MCFG_UCOM4_READ_A_CB(READ8(tmtennis_state, input_r)) - MCFG_UCOM4_READ_B_CB(READ8(tmtennis_state, input_r)) - MCFG_UCOM4_WRITE_C_CB(WRITE8(tmtennis_state, plate_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(tmtennis_state, plate_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(tmtennis_state, port_e_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(tmtennis_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(tmtennis_state, grid_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(tmtennis_state, grid_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(tmtennis_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy(tronic) Pac-Man (manufactured in Japan) - * PCBs are labeled TN-08 2E108E01 - * NEC uCOM-43 MCU, labeled D553C 160 - * cyan/red/green VFD display NEC FIP8AM18T no. 2-21 - * bright yellow round casing - - known releases: - - Japan: Puck Man - - USA: Pac Man - - UK: Puckman (Tomy), and also published by Grandstand as Munchman - - Australia: Pac Man-1, published by Futuretronics - - The game will start automatically after turning it on. This Pac Man refuses - to eat dots with his butt, you can only eat them going right-to-left. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class tmpacman_state : public hh_ucom4_state -{ -public: - tmpacman_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void tmpacman_state::prepare_display() -{ - UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,16,17,18,11,10,9,8,0,2,3,1,4,5,6,7,12,13,14,15) | 0x100; - display_matrix(19, 8, plate, grid); -} - -WRITE8_MEMBER(tmpacman_state::grid_w) -{ - // C,D: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(tmpacman_state::plate_w) -{ - // E1: speaker out - if (offset == NEC_UCOM4_PORTE) - m_speaker->level_w(data >> 1 & 1); - - // E023,F,G,H,I: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( tmpacman ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY - - PORT_START("IN.1") // port B - PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) - PORT_CONFSETTING( 0x00, "Amateur" ) - PORT_CONFSETTING( 0x01, "Professional" ) - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( tmpacman, tmpacman_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_430kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(tmpacman_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(tmpacman_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(tmpacman_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(tmpacman_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(tmpacman_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(tmpacman_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(tmpacman_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy(tronic) Scramble (manufactured in Japan) - * PCBs are labeled TN-10 2E114E01 - * NEC uCOM-43 MCU, labeled D553C 192 - * cyan/red/green VFD display NEC FIP10CM20T no. 2-41 - - known releases: - - World: Scramble - - USA: Scramble, published by Tandy - - UK: Astro Blaster, published by Hales (Epoch Astro Command was named Scramble) - - Germany: Rambler - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class tmscramb_state : public hh_ucom4_state -{ -public: - tmscramb_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void tmscramb_state::prepare_display() -{ - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,3,15,2,14,1,13,16,0,12,8,4,9,5,10,6,11,7) | 0x400; - display_matrix(17, 10, plate, m_grid); -} - -WRITE8_MEMBER(tmscramb_state::grid_w) -{ - // I2: speaker out - if (offset == NEC_UCOM4_PORTI) - m_speaker->level_w(data >> 2 & 1); - - // C,D,I01: vfd matrix grid - int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(tmscramb_state::plate_w) -{ - // E,F,G,H: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( tmscramb ) - PORT_START("IN.0") // port A - PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) - PORT_CONFSETTING( 0x00, "Amateur" ) - PORT_CONFSETTING( 0x01, "Professional" ) - PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - - PORT_START("IN.1") // port B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_2WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_2WAY - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( tmscramb, tmscramb_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(tmscramb_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(tmscramb_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(tmscramb_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(tmscramb_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(tmscramb_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(tmscramb_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(tmscramb_state, grid_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy(tronic) Caveman (manufactured in Japan) - * PCBs are labeled TN-12 2E114E03 - * NEC uCOM-43 MCU, labeled D553C 209 - * cyan/red/green VFD display NEC FIP8AM20T no. 2-42 - - known releases: - - World: Caveman - - USA: Caveman, published by Tandy - - UK: Cave Man - Jr. Caveman vs Dinosaur, published by Grandstand - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class tcaveman_state : public hh_ucom4_state -{ -public: - tcaveman_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE8_MEMBER(grid_w); - DECLARE_WRITE8_MEMBER(plate_w); -}; - -// handlers - -void tcaveman_state::prepare_display() -{ - UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,10,11,5,6,7,8,0,9,2,18,17,16,3,15,14,13,12,4,1) | 0x40; - display_matrix(19, 8, plate, grid); -} - -WRITE8_MEMBER(tcaveman_state::grid_w) -{ - // C,D: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - -WRITE8_MEMBER(tcaveman_state::plate_w) -{ - // E3: speaker out - if (offset == NEC_UCOM4_PORTE) - m_speaker->level_w(data >> 3 & 1); - - // E012,F,G,H,I: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - prepare_display(); -} - - -// config - -static INPUT_PORTS_START( tcaveman ) - PORT_START("IN.0") // port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_CONFNAME( 0x08, 0x00, DEF_STR( Difficulty ) ) - PORT_CONFSETTING( 0x00, "Amateur" ) - PORT_CONFSETTING( 0x08, "Professional" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( tcaveman, tcaveman_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(tcaveman_state, grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(tcaveman_state, grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(tcaveman_state, plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(tcaveman_state, plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(tcaveman_state, plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(tcaveman_state, plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(tcaveman_state, plate_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Tomy Alien Chase (manufactured in Japan) - * PCBs are labeled TN-16 2E121B01 - * NEC uCOM-43 MCU, labeled D553C 258 - * red/green VFD display NEC FIP9AM24T, with color overlay, 2-sided* - - *Player one views the VFD from the front (grid+filament side) while the - opposite player views it from the back side (through the conductive traces), - basically a mirror-image. - - To start the game, simply press [UP]. Hold a joystick direction to move around. - - NOTE!: MAME external artwork is required - -***************************************************************************/ - -class alnchase_state : public hh_ucom4_state -{ -public: - alnchase_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag) - { } - - DECLARE_WRITE8_MEMBER(output_w); - DECLARE_READ8_MEMBER(input_r); -}; - -// handlers - -WRITE8_MEMBER(alnchase_state::output_w) -{ - if (offset <= NEC_UCOM4_PORTE) - { - // C,D,E0: vfd matrix grid - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - - // C0(grid 0): input enable PL1 - // D0(grid 4): input enable PL2 - m_inp_mux = (m_grid & 1) | (m_grid >> 3 & 2); - - // E1: speaker out - if (offset == NEC_UCOM4_PORTE) - m_speaker->level_w(data >> 1 & 1); - } - - if (offset >= NEC_UCOM4_PORTE) - { - // E23,F,G,H,I: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTE) * 4; - m_plate = ((m_plate << 2 & ~(0xf << shift)) | (data << shift)) >> 2; - } - - display_matrix(17, 9, m_plate, m_grid); -} - -READ8_MEMBER(alnchase_state::input_r) -{ - // A: multiplexed buttons - return read_inputs(2); -} - - -// config - -/* physical button layout and labels is like this: - - POWER SOUND LEVEL PLAYER - ON ON PRO TWO START - o o | | - | | | | [joystick] - | | o o - OFF OFF AMA ONE GAME 0,1,2,3 - - 1 PLAYER SIDE - - other player side only has a joystick -*/ - -static INPUT_PORTS_START( alnchase ) - PORT_START("IN.0") // C0 port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - - PORT_START("IN.1") // D0 port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) // on non-mirrored view, swap P2 left/right - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) // " - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - - PORT_START("IN.2") // port B - PORT_CONFNAME( 0x01, 0x01, "Players" ) - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x00, "2" ) - PORT_CONFNAME( 0x02, 0x00, DEF_STR( Difficulty ) ) - PORT_CONFSETTING( 0x00, "Amateur" ) - PORT_CONFSETTING( 0x02, "Professional" ) - PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( alnchase, alnchase_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(READ8(alnchase_state, input_r)) - MCFG_UCOM4_READ_B_CB(IOPORT("IN.2")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(alnchase_state, output_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(alnchase_state, output_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(alnchase_state, output_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(alnchase_state, output_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(alnchase_state, output_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(alnchase_state, output_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(alnchase_state, output_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( ufombs ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "d552c-017", 0x0000, 0x0400, CRC(0e208cb3) SHA1(57db6566916c94325e2b67ccb94b4ea3b233487d) ) -ROM_END - - -ROM_START( ssfball ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-031", 0x0000, 0x0800, CRC(ff5d91d0) SHA1(9b2c0ae45f1e3535108ee5fef8a9010e00c8d5c3) ) -ROM_END - - -ROM_START( bmsoccer ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "d552c-043", 0x0000, 0x0400, CRC(10c2a4ea) SHA1(6ebca7d406e22ff7a8cd529579b55a700da487b4) ) -ROM_END - - -ROM_START( bmsafari ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "d552c-049", 0x0000, 0x0400, CRC(82fa3cbe) SHA1(019e7ec784e977eba09997fc46af253054fb222c) ) -ROM_END - - -ROM_START( splasfgt ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-055", 0x0000, 0x0800, CRC(eb471fbd) SHA1(f06cfe567bf6f9ed4dcdc88acdcfad50cd370a02) ) -ROM_END - - -ROM_START( bcclimbr ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-170", 0x0000, 0x0800, CRC(fc2eabdb) SHA1(0f5cc854be7fdf105d9bd2114659d40c65f9d782) ) -ROM_END - - -ROM_START( tactix ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d557lc-512", 0x0000, 0x0800, CRC(1df738cb) SHA1(15a5de28a3c03e6894d29c56b5b424983569ccf2) ) -ROM_END - - -ROM_START( invspace ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "d552c-054", 0x0000, 0x0400, CRC(913d9c13) SHA1(f20edb5458e54d2f6d4e45e5d59efd87e05a6f3f) ) -ROM_END - - -ROM_START( efball ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-080", 0x0000, 0x0800, CRC(54c1027f) SHA1(6cc98074dae9361fa8c0ed6501b6a57ad325ccbd) ) -ROM_END - - -ROM_START( galaxy2 ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-153.s01", 0x0000, 0x0800, CRC(70d552b3) SHA1(72d50647701cb4bf85ea947a149a317aaec0f52c) ) -ROM_END - - -ROM_START( astrocmd ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-202.s01", 0x0000, 0x0800, CRC(b4b34883) SHA1(6246d561c2df1f2124575d2ca671ef85b1819edd) ) -ROM_END - - -ROM_START( edracula ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-206.s01", 0x0000, 0x0800, CRC(b524857b) SHA1(c1c89ed5dd4bb1e6e98462dc8fa5af2aa48d8ede) ) -ROM_END - - -ROM_START( mvbfree ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-049", 0x0000, 0x0800, CRC(d64a8399) SHA1(97887e486fa29b1fc4a5a40cacf3c960f67aacbf) ) -ROM_END - - -ROM_START( tccombat ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "d552c-042", 0x0000, 0x0400, CRC(d7b5cfeb) SHA1(a267be8e43b7740758eb0881b655b1cc8aec43da) ) -ROM_END - - -ROM_START( tmtennis ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "d552c-048", 0x0000, 0x0400, CRC(78702003) SHA1(4d427d4dbeed901770c682338867f58c7b54eee3) ) -ROM_END - - -ROM_START( tmpacman ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-160", 0x0000, 0x0800, CRC(b21a8af7) SHA1(e3122be1873ce76a4067386bf250802776f0c2f9) ) -ROM_END - - -ROM_START( tmscramb ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-192", 0x0000, 0x0800, CRC(00fcc501) SHA1(a7771e934bf8268c83f38c7ec0acc668836e0939) ) -ROM_END - - -ROM_START( tcaveman ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-209", 0x0000, 0x0800, CRC(d230d4b7) SHA1(2fb12b60410f5567c5e3afab7b8f5aa855d283be) ) -ROM_END - - -ROM_START( alnchase ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d553c-258", 0x0000, 0x0800, CRC(c5284ff5) SHA1(6a20aaacc9748f0e0335958f3cea482e36153704) ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -CONS( 1979, ufombs, 0, 0, ufombs, ufombs, driver_device, 0, "Bambino", "UFO Master-Blaster Station", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1979, ssfball, 0, 0, ssfball, ssfball, driver_device, 0, "Bambino", "Superstar Football", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1979, bmsoccer, 0, 0, bmsoccer, bmsoccer, driver_device, 0, "Bambino", "Kick The Goal Soccer", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1981, bmsafari, 0, 0, bmsafari, bmsafari, driver_device, 0, "Bambino", "Safari (Bambino)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1980, splasfgt, 0, 0, splasfgt, splasfgt, driver_device, 0, "Bambino", "Space Laser Fight", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1982, bcclimbr, 0, 0, bcclimbr, bcclimbr, driver_device, 0, "Bandai", "Crazy Climber (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1980, tactix, 0, 0, tactix, tactix, driver_device, 0, "Castle Toy", "Tactix", MACHINE_SUPPORTS_SAVE ) - -CONS( 1980, invspace, 0, 0, invspace, invspace, driver_device, 0, "Epoch", "Invader From Space", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1980, efball, 0, 0, efball, efball, driver_device, 0, "Epoch", "Electronic Football (Epoch)", MACHINE_SUPPORTS_SAVE ) -CONS( 1981, galaxy2, 0, 0, galaxy2, galaxy2, driver_device, 0, "Epoch", "Galaxy II", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, astrocmd, 0, 0, astrocmd, astrocmd, driver_device, 0, "Epoch", "Astro Command", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, edracula, 0, 0, edracula, edracula, driver_device, 0, "Epoch", "Dracula (Epoch)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) - -CONS( 1979, mvbfree, 0, 0, mvbfree, mvbfree, driver_device, 0, "Mego", "Mini-Vid Break Free", MACHINE_SUPPORTS_SAVE ) - -CONS( 1980, tccombat, 0, 0, tccombat, tccombat, driver_device, 0, "Tomy", "Cosmic Combat", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1980, tmtennis, 0, 0, tmtennis, tmtennis, driver_device, 0, "Tomy", "Tennis (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, tmpacman, 0, 0, tmpacman, tmpacman, driver_device, 0, "Tomy", "Pac Man (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, tmscramb, 0, 0, tmscramb, tmscramb, driver_device, 0, "Tomy", "Scramble (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, tcaveman, 0, 0, tcaveman, tcaveman, driver_device, 0, "Tomy", "Caveman (Tomy)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1984, alnchase, 0, 0, alnchase, alnchase, driver_device, 0, "Tomy", "Alien Chase", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mess/drivers/hk68v10.c b/src/mess/drivers/hk68v10.c deleted file mode 100644 index 57ab539c7bd..00000000000 --- a/src/mess/drivers/hk68v10.c +++ /dev/null @@ -1,389 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Joakim Larsson Edstrom -/*************************************************************************** - * - * Heurikon HK68/V10 6U SBC driver, initially derived from hk68v10.c - * - * 21/08/2015 - * - * I baught this board from http://www.retrotechnology.com without documentation. - * It has a Motorola 68010 CPU @ 10MHz and two 2764 EPROMS with HBUG firmware - * The board is very populated and suitable to run a real server OS supported by - * FPU,MMU and DMA controller chips. The firmware supports SCSI, Centronics/FPI - * and a serial port. I have not found so much on the FPI interface yet and it is - * possibly Heurikon specific. There is also a Heurikon Multibus board called - * HK68/M10 for which I might add support from specs, however would need a ROM - * to verify. - * - * || - * || || - * ||||--|| - * ||||--|| - * || ||____________________________________________________________ ___ - * || | | | 12 PALs 68/V-... | | | | | |_| | - * || | | 2 x | |74 |74 |74 |74 | | | | - * || | | 74273 | VS4-01 VM4-00 | 244 573 645 645 | | | - * \==||| |SCSI | | VS3-00 VM3-03 | | | | | | | | - * ||| | | | VS2-01 VM2-02 |___|___|___|___| | | | - * || |NCR | | VS1-00 VM1-01 | | | | | | | - * || | 8530| 2 x | VBX-00 VDB-00 |74 |74 |74 | | |VME| - * || | | 74245 | VI1-00 VI2-00 | 244 641 245 | | | - * || | | | (90 deg ccw) | | | | | |P1 | - * SCSI || |_____| |_____________________|___|___|___| | | | - * port || | | _________ _________________________________ | | | - * || | | | || |74 |PAL | | | | | - * || | | | || 5 x | 244 MP2| 2 x | | | | - * || |CIO | | MC68881 || 74373 | | -00| 74646| | | | - * || |paral| | FPU || | | | | | | | - * || |Z8536| |_________||_________________|_ _| | | |_| | - * ||| | | | | | | ------------ |___| - * /==||| | | | | | | | 3 PALs | | - * FSM || | | | MC68010 | MC68451 | MC68450 | | MP1-00 | | - * 1234 || | | | CPU | MMU | DMA | | MX2-00 | | - * LEDs || |-----| |_________|__________|_________|__| MX1-01 |---| - * || | | ____ ____ ---| |__________|74 | - * \==||| | | | | | | |74| 4 x | 3 PALs |145| - * ||| |SCC | | | | | |804 74245 | CS3-00 |___| - * FPI || |seria| |U12 | |U23 | | | | CS2-00 | | - * paralell |Z8530A |HBUG| |HBUG| | | | CS1-00 | |___ - * port || | | | | | | ---_---------------|__________| _| | - * || | | | | | | |MTTLDL|MDLDM| 2 x |___________ | | | - * ||| | | |____|_|____|_|____40|TTL75|74280| | | | | - * /==||| | || |19. | | | | | |_____| | | | | - * \==||| |_____||75 |6608|16 |20 |74|74| ______| 9 x 4 | | | | - * ||| +--------+|173| MHz| MHz | MHz| 74 08| | | RAM chips| | |VME| - * || | ||___|____|_____|____|__|__||74 74 | on SIL | | | | - * || | 2 x || | | |259|257 boards | | |P2 | - * || | SIL || 12 PALs 90 deg ccw|74| -______- | | | | - * || | boards || |240 | | | | | | | - * || | with 2 || BER-00 FPI-01 | | |74 74 | | | | | - * Serial|| | DIP16 || AC4-00 ARB-01 |__|___|138|257 | | | | - * port || | surf || AC3-00 INT-00 |______| | | | | - * || | mounted|| AC2-01 IAK-00 | | | | | | | - * || | chips || AC1-01 PAS-01 |74 |74| | | | | - * || | each || RFS-01 |590|257 | | | | - * ||| | || RCT-01 | | | | |_| | - * /==||| +--------+|__________________________|___|__|__________| |___| - * || ||------------------------------------------------------------+-+ - * ||||--|| - * ||||--|| - * || - * - * History of Heurikon - *--------------------- - * The company was founded 1972 as cellar company. Heurikon was aquired - * 1989 by Computer Products, 1990 by Artesyn and finally in 2005 by Emerson - * Electric who consilidated it fully by 2009 and closed the office. - * - * Misc links about Heurikon and this board: - * http://www.heurikon.com/ - * http://www.nytimes.com/1992/01/07/business/company-news-briefs.html - * http://bitsavers.informatik.uni-stuttgart.de/pdf/heurikon/brochures/HK68_V10_Brochure.pdf - * http://bitsavers.informatik.uni-stuttgart.de/pdf/heurikon/Heurikon_UNIX_System_V_and_V.2_Reference_Guide_Apr87.pdf - * From http://www.iri.tudelft.nl/~sfwww/manuals/OS9/PDF/9OM_30.pdf: - * "In most cases, you will only need to change the device base address. Some hardware implementations of the MC68451 - * (specifically the Heurikon M10/V10 CPU's) use the DMA portion of the Address Space Table (AST) instead of the MPU - * section which is normally used. You should change the offsets for the AST registers to match your hardware. The - * ssmdefs.a file has conditional directives to accommodate either the standard or Heurikon style implementations." - * - * Address Map from the UNIX Ref Guide - * -------------------------------------------------------------------------- - * Address Range Memory Space (physical) Notes - * -------------------------------------------------------------------------- - * 0xffffff (top of memory) - * 0xffc200 0xffc220 Sky FFP 68881 FPU - * 0xff8000 ... MCT Reel-to-reel tape (V10) VME - * 0xff0000 0xff0100 Tapemaster(00B0,00B1) Reel-to-reel tape (M10) Multibus - * Ethernet(0010,0011) - * 0xff0000 (base of bus I/O) - * - * 0xfea000 SCC8530 device - * 0xfe9000 offset 6 seems also to be 2 access registers, ie register offset + data pairs - * 0xfe8000 offset E reading single byte - * 0xfe4000 front LED:s? or move ROM from 0x0 to 0xfc0000... - * 0xfe2000 cleared - * 0xfe0000 HK68 On-card I/O MMU, DMAC, SCC, SCSI - * 0xfc0000 HK68 ROM (128K) Hbug monitor - * 0xf00000 (reserved) - * (shared memory and logical area - * for shared text.) - * 0x800000 (Twilight Zone) (top of /dev/mem) - * 0x7c0000 (reserved) - * 0x780000 8 Chnl serial Expn(1-4) (CDC) - * HK68 (1-15) VRTX - * MLZ-93 (1-4) CP/M Shell - * 0x700000 - * (open) - * 0x*00000 (maxmeml) - * RAM (bus) (optional) - * 0x200000 (top of 2 meg RAM) - * RAM (bus) (optional) - * 0x100000 (top of 1 meg RAM) - * User RAM - * 0x001000 UNIX Kernel - * Exception Vectors - * 0x000000 (bottom of memory) - * -------------------------------------------------------------------------- - * - * Interrupt sources M10/V10 - * ---------------------------------------------------------- - * Description Device Lvl IRQ VME board - * /Board Vector Address - * ---------------------------------------------------------- - * On board Sources M10/V10 - * - * Off board Sources (other VME boards) - * EXOS Ethernet 5 4 - * TapeMaster Reel-to-Reel Tape 3 - * MCT Reel-to-Reel Tape 5 - * CDC MB1031 Serial Expansion 2 2 - * IT 2190 SMD Interface 1 3 - * IT 3200 SMD Interface 3 - * ---------------------------------------------------------- - * - * DMAC Channel Assignments - * ---------------------------------------------------------- - * Channel M10 V10 - * ---------------------------------------------------------- - * 0 SCSI SCSI - * 1 Streamer (P3) n/a - * 2 n/a n/a - * 3 SBX-FDIO n/a - * ---------------------------------------------------------- - * - * TODO: - * - Dump the ROMs (DONE) - * - Setup a working address map (DONE) - * - Fix terminal for HBUG (DONE) - * - Add VME bus driver - * - Add DMA/MMU devices - * - Add CIO port - * - ADD SCSI controller device - * - dump PALs and describe descrete logic - * - Setup BAUD generation correctly, (eg find that x32 divider) - * it is a multilayer PCB so very hard to trace. - * - Add LED:s - * - Add Jumpers and strap areas - * - Find and Boot Heurikon Unix from a SCSI device - * - Support that optional 68881 FPU - * - ****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/z80scc.h" -#include "bus/rs232/rs232.h" -#include "machine/clock.h" - -#define VERBOSE 0 - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -#if VERBOSE == 2 -#define logerror printf -#endif - -#ifdef _MSC_VER -#define FUNCNAME __func__ -#else -#define FUNCNAME __PRETTY_FUNCTION__ -#endif - -#define BAUDGEN_CLOCK XTAL_19_6608MHz /* Raltron */ -/* - */ -#define SCC_CLOCK (BAUDGEN_CLOCK / 128) /* This gives prompt at the RS232 terminal device (9600) */ -//#define SCC_CLOCK (BAUDGEN_CLOCK / 4) /* This is correct giving 4.9152MHz as documentation says */ -class hk68v10_state : public driver_device -{ -public: -hk68v10_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device (mconfig, type, tag), - m_maincpu (*this, "maincpu") - ,m_sccterm(*this, "scc") -// ,m_cart(*this, "exp_rom1") -{ -} - -DECLARE_READ16_MEMBER (bootvect_r); -DECLARE_WRITE16_MEMBER (bootvect_w); -DECLARE_READ16_MEMBER (vme_a24_r); -DECLARE_WRITE16_MEMBER (vme_a24_w); -DECLARE_READ16_MEMBER (vme_a16_r); -DECLARE_WRITE16_MEMBER (vme_a16_w); -virtual void machine_start (); -virtual void machine_reset (); -DECLARE_WRITE_LINE_MEMBER (write_sccterm_clock); - -protected: - -private: -required_device m_maincpu; -required_device m_sccterm; - -// Pointer to System ROMs needed by bootvect_r and masking RAM buffer for post reset accesses - UINT16 *m_sysrom; - UINT16 m_sysram[4]; -}; - -static ADDRESS_MAP_START (hk68v10_mem, AS_PROGRAM, 16, hk68v10_state) -ADDRESS_MAP_UNMAP_HIGH -AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r) /* ROM mirror just durin reset */ -AM_RANGE (0x000000, 0x000007) AM_RAM AM_WRITE (bootvect_w) /* After first write we act as RAM */ -AM_RANGE (0x000008, 0x1fffff) AM_RAM /* 2 Mb RAM */ -AM_RANGE (0xFC0000, 0xFC3fff) AM_ROM /* System EPROM Area 16Kb HBUG */ -AM_RANGE (0xFC4000, 0xFDffff) AM_ROM /* System EPROM Area an additional 112Kb for System ROM */ -AM_RANGE (0xFE9000, 0xFE9009) AM_RAM //AM_DEVREADWRITE8("scc", scc8530_device, ba_cd_r, ba_cd_w, 0xffff) /* Z80-PIO? */ -AM_RANGE (0xFEA000, 0xFEA001) AM_DEVREADWRITE8("scc", scc8530_device, ca_r, ca_w, 0xff00) /* Dual serial port Z80-SCC */ -AM_RANGE (0xFEA002, 0xFEA003) AM_DEVREADWRITE8("scc", scc8530_device, cb_r, cb_w, 0xff00) /* Dual serial port Z80-SCC */ -AM_RANGE (0xFEA004, 0xFEA005) AM_DEVREADWRITE8("scc", scc8530_device, da_r, da_w, 0xff00) /* Dual serial port Z80-SCC */ -AM_RANGE (0xFEA006, 0xFEA007) AM_DEVREADWRITE8("scc", scc8530_device, db_r, db_w, 0xff00) /* Dual serial port Z80-SCC */ -//AM_RANGE(0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ -//AM_RANGE(0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START (hk68v10) -INPUT_PORTS_END - -/* Start it up */ -void hk68v10_state::machine_start () -{ - LOG (("%" I64FMT "d %s\n", m_maincpu->total_cycles(), FUNCNAME)); - - /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ - m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x0fc0000); -} - -/* Support CPU resets - - TODO: Investigate why the user need two 'softreset' commands for the below to work. Eg F3 + F11 + F3 + F11 - If only one 'softreset' is given the reset PC gets the RAM content, not the intended ROM vector. - Race conditions? Wrong call order in memory system? Debugger prefetch accesses? Better way to to this? -*/ -void hk68v10_state::machine_reset () -{ - LOG (("%" I64FMT "d %s\n", m_maincpu->total_cycles(), FUNCNAME)); - - /* Reset pointer to bootvector in ROM for bootvector handler bootvect_r */ - if (m_sysrom == &m_sysram[0]) /* Condition needed because memory map is not setup first time */ - m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x0fc0000); -} - -/* Boot vector handler, the PCB hardwires the first 8 bytes from 0xfc0000 to 0x0 at reset*/ -/* - Right after HBUG reset the bootvector is masked by RAM: - FC001C: move.w #$700, $fe4000.l - FC0024: move.l #$0, $0.l # <- zeroing the reset vector - FC002E: move.l #$0, $4.l # There is for sure some hardware mapping going in here -*/ -READ16_MEMBER (hk68v10_state::bootvect_r){ - //LOG (("bootvect_r %s\n", m_sysrom != &m_sysram[0] ? "as reset" : "as swapped")); - return m_sysrom[offset]; -} - -WRITE16_MEMBER (hk68v10_state::bootvect_w){ - LOG (("bootvect_w offset %08x, mask %08x, data %04x\n", offset, mem_mask, data)); - m_sysram[offset % sizeof(m_sysram)] &= ~mem_mask; - m_sysram[offset % sizeof(m_sysram)] |= (data & mem_mask); - m_sysrom = &m_sysram[0]; // redirect all upcomming accesses to masking RAM until reset. -} - -#if 0 -/* Dummy VME access methods until the VME bus device is ready for use */ -READ16_MEMBER (hk68v10_state::vme_a24_r){ - LOG (("vme_a24_r\n")); - return (UINT16) 0; -} - -WRITE16_MEMBER (hk68v10_state::vme_a24_w){ - LOG (("vme_a24_w\n")); -} - -READ16_MEMBER (hk68v10_state::vme_a16_r){ - LOG (("vme_16_r\n")); - return (UINT16) 0; -} - -WRITE16_MEMBER (hk68v10_state::vme_a16_w){ - LOG (("vme_a16_w\n")); -} -#endif - -/* - * Serial port clock source depends on the CPU clock and divider settings - * HBUG has a control byte that needs to be patched accordingly: - * - * CPU clock SCC clock Baud rate offset 0x0b value - * 10 Mhz 4.9152MHz 9600 15 - * 10 Mhz 4.9152MHz 19200 55 - * 12 Mhz 4.9152MHz 9600 16 - * 12 Mhz 4.9152MHz 19200 56 - * - * Configuration word detail: - * D15-D8 reserved ( = 0 ) - * D7(MSB) = 0 - * D6 = 0 for console default 9600 baud - * D6 = 1 for console default 19,200 baud - * D5,D4,D3,D2 = 0101 for 4.9152 Mhz SCC clock - * D1,DO - * 01 for 10 Mhz MPU clock - * D1,DO = 10 for 12 Mhz MPU clock - * - * Original HBUG configuration word: 0x003D = 0000 0000 0011 1101 - * - */ -WRITE_LINE_MEMBER (hk68v10_state::write_sccterm_clock){ - m_sccterm->txca_w (state); - m_sccterm->rxca_w (state); -} - -/* - * Machine configuration - */ -static MACHINE_CONFIG_START (hk68v10, hk68v10_state) -/* basic machine hardware */ -MCFG_CPU_ADD ("maincpu", M68010, XTAL_10MHz) -MCFG_CPU_PROGRAM_MAP (hk68v10_mem) - -/* Terminal Port config */ -MCFG_SCC8530_ADD("scc", XTAL_4MHz, 0, 0, 0, 0 ) -MCFG_Z80SCC_OUT_TXDA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_txd)) -MCFG_Z80SCC_OUT_DTRA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_dtr)) -MCFG_Z80SCC_OUT_RTSA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_rts)) - -MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal") -MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("scc", scc8530_device, rxa_w)) -MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("scc", scc8530_device, ctsa_w)) - -MCFG_DEVICE_ADD ("sccterm_clock", CLOCK, SCC_CLOCK) -MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (hk68v10_state, write_sccterm_clock)) - -MACHINE_CONFIG_END - -/* ROM definitions */ -ROM_START (hk68v10) -ROM_REGION (0x1000000, "maincpu", 0) - -ROM_LOAD16_BYTE ("hk68kv10U23.bin", 0xFC0001, 0x2000, CRC (632aa026) SHA1 (f2b1ed0cc38dfbeb1602c013e00757015400720d)) -ROM_LOAD16_BYTE ("hk68kv10U12.bin", 0xFC0000, 0x2000, CRC (f2d688e9) SHA1 (e68699965645f0ce53de47625163c3eb02c8b727)) -/* - * System ROM information - * - * The ROMs contains HBUG v1.8, known commands from different sources: - * - * 'uc' Print HK68 Configuration - * 'um' Perform RAM test - * 'dm adrs' Display Memory - * 'sb adrs' Substitute Byte at adrs - * 'c adrs' Call Routine at adrs - * 'bw' Boot from Winchester - * 'bf' Boot from floppy (MIO, SBX-FDIO) - * 'bsf' Boot from floppy (SCSI) - * - */ -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP (1985, hk68v10, 0, 0, hk68v10, hk68v10, driver_device, 0, "Heurikon Corporation", "HK68/V10", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) diff --git a/src/mess/drivers/homelab.c b/src/mess/drivers/homelab.c deleted file mode 100644 index 0d6fc6735f1..00000000000 --- a/src/mess/drivers/homelab.c +++ /dev/null @@ -1,911 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Homelab driver by Miodrag Milanovic - - 31/08/2008 Preliminary driver. - 15/06/2012 Various updates [Robbbert] - - The emulator called HoLa! works fine, but it is closed source. - You can get HoLa! at: http://gaia.atilia.eu - - ToDO: - - HTP files should be a cassette format, not a quickload. - - Quickloads cause the emulated machine to hang or reboot. - - homelab2 - cassette to fix. - Note that rom code 0x40-48 is meaningless garbage, - had to patch to stop it crashing. Need a new dump. - - homelab3/4 - Need a dump of the TM188 prom. - cassette to fix. - up to 64k ram can be fitted. schematic only shows 16k. - Z80PIO - expansion only, doesn't do anything in the - machine. /CE connects to A6, A/B = A0, C/D = A1. - The bios never talks to it. Official port numbers - are 3C-3F. - - Brailab4 - same as homelab3. - - Braiplus - no work has been done. Needs to be developed from scratch. - - -TM188 is (it seems) equivalent to 27S19, TBP18S030N, 6331-1, 74S288, 82S123, -MB7051 - fuse programmed prom. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "audio/mea8000.h" -#include "sound/dac.h" -#include "imagedev/snapquik.h" - - - -class homelab_state : public driver_device -{ -public: - homelab_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cass(*this, "cassette") - { } - - DECLARE_READ8_MEMBER(key_r); - DECLARE_WRITE8_MEMBER(cass_w); - DECLARE_READ8_MEMBER(cass2_r); - DECLARE_READ8_MEMBER(exxx_r); - DECLARE_WRITE8_MEMBER(port7f_w); - DECLARE_WRITE8_MEMBER(portff_w); - DECLARE_WRITE8_MEMBER(brailab4_port7f_w); - DECLARE_WRITE8_MEMBER(brailab4_portff_w); - DECLARE_CUSTOM_INPUT_MEMBER(cass3_r); - const UINT8 *m_p_chargen; - const UINT8 *m_p_videoram; - bool m_nmi; - required_device m_maincpu; - required_device m_speaker; - required_device m_cass; - DECLARE_DRIVER_INIT(brailab4); - DECLARE_VIDEO_START(homelab2); - DECLARE_MACHINE_RESET(homelab3); - DECLARE_VIDEO_START(homelab3); - DECLARE_MACHINE_RESET(brailab4); - DECLARE_VIDEO_START(brailab4); - UINT32 screen_update_homelab2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_homelab3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(homelab_frame); - DECLARE_QUICKLOAD_LOAD_MEMBER(homelab); -}; - -INTERRUPT_GEN_MEMBER(homelab_state::homelab_frame) -{ - if (m_nmi) - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); -} - -READ8_MEMBER( homelab_state::key_r ) // offset 27F-2FE -{ - if (offset == 0x38) // 0x3838 - { - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return 0; - } - - UINT8 i,data = 0xff; - char kbdrow[8]; - - for (i=0; i<8; i++) - { - if (!BIT(offset, i)) - { - sprintf(kbdrow,"LINE%d", i); - data &= ioport(kbdrow)->read(); - } - } - - return data; -} - -READ8_MEMBER( homelab_state::cass2_r ) -{ - return (m_cass->input() > 0.03) ? 0xff : 0; -} - -WRITE8_MEMBER( homelab_state::cass_w ) -{ - if (offset == 0x73f) // 0x3f3f - m_nmi = true; - else - if (offset == 0x63e) // 0x3e3e - m_nmi = false; - else - if (offset == 0x400) // 0x3c00 - m_cass->output(BIT(data, 0) ? -1.0 : +1.0); // FIXME -} - -MACHINE_RESET_MEMBER(homelab_state,homelab3) -{ -} - -MACHINE_RESET_MEMBER(homelab_state,brailab4) -{ - membank("bank1")->set_entry(0); -} - -WRITE8_MEMBER( homelab_state::port7f_w ) -{ -} - -WRITE8_MEMBER( homelab_state::portff_w ) -{ -} - -WRITE8_MEMBER( homelab_state::brailab4_port7f_w ) -{ - membank("bank1")->set_entry(0); -} - -WRITE8_MEMBER( homelab_state::brailab4_portff_w ) -{ - membank("bank1")->set_entry(1); -} - -CUSTOM_INPUT_MEMBER( homelab_state::cass3_r ) -{ - return (m_cass->input() > 0.03); -} - - -READ8_MEMBER( homelab_state::exxx_r ) -{ -// keys E800-E813 but E810-E813 are not connected -// cassin E883 -// speaker/cass toggle E880, E802 - - - if (offset == 0x83) - return (m_cass->input() > 0.03); - else - if (offset == 0x80) - { - m_speaker->level_w(0); - m_cass->output(-1.0); - } - else - if (offset == 0x02) - { - m_speaker->level_w(1); - m_cass->output(+1.0); - } - - char kbdrow[8]; - UINT8 data = 0xff; - if (offset < 0x10) - { - sprintf(kbdrow,"X%X", offset); - data = ioport(kbdrow)->read(); - } - return data; -} - - -/* Address maps */ -static ADDRESS_MAP_START(homelab2_mem, AS_PROGRAM, 8, homelab_state) - AM_RANGE( 0x0000, 0x07ff ) AM_ROM // ROM 1 - AM_RANGE( 0x0800, 0x0fff ) AM_ROM // ROM 2 - AM_RANGE( 0x1000, 0x17ff ) AM_ROM // ROM 3 - AM_RANGE( 0x1800, 0x1fff ) AM_ROM // ROM 4 - AM_RANGE( 0x2000, 0x27ff ) AM_ROM // ROM 5 - AM_RANGE( 0x2800, 0x2fff ) AM_ROM // ROM 6 - AM_RANGE( 0x3000, 0x37ff ) AM_ROM // Empty - AM_RANGE( 0x3800, 0x3fff ) AM_READWRITE(key_r,cass_w) - AM_RANGE( 0x4000, 0x7fff ) AM_RAM - AM_RANGE( 0xc000, 0xc3ff ) AM_RAM AM_REGION("maincpu",0xc000) - AM_RANGE( 0xe000, 0xe0ff ) AM_READ(cass2_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(homelab3_mem, AS_PROGRAM, 8, homelab_state) - AM_RANGE( 0x0000, 0x3fff ) AM_ROM - AM_RANGE( 0x4000, 0x7fff ) AM_RAM - AM_RANGE( 0xe800, 0xefff ) AM_READ(exxx_r) - AM_RANGE( 0xf800, 0xffff ) AM_RAM AM_REGION("maincpu",0xf800) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(homelab3_io, AS_IO, 8, homelab_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x7f, 0x7f ) AM_WRITE(port7f_w) - AM_RANGE( 0xff, 0xff ) AM_WRITE(portff_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(brailab4_mem, AS_PROGRAM, 8, homelab_state) - AM_RANGE( 0x0000, 0x3fff ) AM_ROM - AM_RANGE( 0x4000, 0xcfff ) AM_RAM - AM_RANGE( 0xd000, 0xdfff ) AM_ROM - AM_RANGE( 0xe800, 0xefff ) AM_READ(exxx_r) - AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(brailab4_io, AS_IO, 8, homelab_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0xf8, 0xf9 ) AM_DEVREADWRITE("mea8000", mea8000_device, read, write) - AM_RANGE( 0x7f, 0x7f ) AM_WRITE(brailab4_port7f_w) - AM_RANGE( 0xff, 0xff ) AM_WRITE(brailab4_portff_w) -ADDRESS_MAP_END - - - -/* Input ports */ -static INPUT_PORTS_START( homelab ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) //PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Run/Brk") PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('<') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR('_') -INPUT_PORTS_END - -static INPUT_PORTS_START( homelab3 ) // F4 to F8 are foreign characters - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // A - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // D - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_VBLANK("screen") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, homelab_state, cass3_r, " ") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XB") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XC") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XD") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XE") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XF") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( brailab4 ) // F4 to F8 are foreign characters - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // A - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // D - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_VBLANK("screen") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, homelab_state, cass3_r, " ") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("X9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XB") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XC") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XD") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XE") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("XF") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -VIDEO_START_MEMBER(homelab_state,homelab2) -{ - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("maincpu")->base()+0xc000; -} - -VIDEO_START_MEMBER(homelab_state,homelab3) -{ - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("maincpu")->base()+0xf800; -} - -VIDEO_START_MEMBER(homelab_state,brailab4) -{ - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("maincpu")->base()+0x17800; -} - -UINT32 homelab_state::screen_update_homelab2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for(y = 0; y < 25; y++ ) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 40; x++) - { - chr = m_p_videoram[x]; // get char in videoram - gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=40; - } - return 0; -} - -UINT32 homelab_state::screen_update_homelab3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for(y = 0; y < 32; y++ ) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x++) - { - chr = m_p_videoram[x]; // get char in videoram - gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout homelab_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0, 1*256*8, 2*256*8, 3*256*8, 4*256*8, 5*256*8, 6*256*8, 7*256*8 }, - 8 /* every char takes 8 x 1 bytes */ -}; - -static GFXDECODE_START( homelab ) - GFXDECODE_ENTRY( "chargen", 0x0000, homelab_charlayout, 0, 1 ) -GFXDECODE_END - -QUICKLOAD_LOAD_MEMBER( homelab_state,homelab) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int i=0; - UINT8 ch; - UINT16 quick_addr; - UINT16 quick_length; - UINT16 quick_end; - dynamic_buffer quick_data; - char pgmname[256]; - UINT16 args[2]; - int read_; - - quick_length = image.length(); - quick_data.resize(quick_length); - - read_ = image.fread( &quick_data[0], quick_length); - if (read_ != quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); - image.message(" Cannot read the file"); - return IMAGE_INIT_FAIL; - } - - image.fseek(0x100, SEEK_SET); - ch = image.fgetc(); - if (ch != 0xA5) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); - image.message(" Invalid header"); - return IMAGE_INIT_FAIL; - } - - while((ch = image.fgetc())) - { - if (i >= (ARRAY_LENGTH(pgmname) - 1)) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long"); - image.message(" File name too long"); - return IMAGE_INIT_FAIL; - } - - pgmname[i] = ch; /* build program name */ - i++; - } - - pgmname[i] = '\0'; /* terminate string with a null */ - - if (image.fread(args, sizeof(args)) != sizeof(args)) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size"); - image.message(" Unexpected EOF while getting file size"); - return IMAGE_INIT_FAIL; - } - - quick_addr = LITTLE_ENDIANIZE_INT16(args[0]); - quick_length = LITTLE_ENDIANIZE_INT16(args[1]); - quick_end = quick_addr+quick_length-1; - - if (quick_end > 0x7fff) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too large"); - image.message(" File too large"); - return IMAGE_INIT_FAIL; - } - - /* display a message about the loaded quickload */ - image.message(" %s\nsize=%04X : start=%04X : end=%04X",pgmname,quick_length,quick_addr,quick_end); - - for (i = 0; i < quick_length; i++) - { - int j = (quick_addr + i); - if (image.fread(&ch, 1) != 1) - { - char message[256]; - snprintf(message, ARRAY_LENGTH(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); - image.seterror(IMAGE_ERROR_INVALIDIMAGE, message); - image.message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); - return IMAGE_INIT_FAIL; - } - space.write_byte(j, ch); - } - - return IMAGE_INIT_PASS; -} - -/* Machine driver */ -static MACHINE_CONFIG_START( homelab, homelab_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz / 2) - MCFG_CPU_PROGRAM_MAP(homelab2_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", homelab_state, homelab_frame) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(40*8, 25*8) - MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 25*8-1) - MCFG_VIDEO_START_OVERRIDE(homelab_state,homelab2) - MCFG_SCREEN_UPDATE_DRIVER(homelab_state, screen_update_homelab2) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", homelab) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_QUICKLOAD_ADD("quickload", homelab_state, homelab, "htp", 2) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( homelab3, homelab_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 4) - MCFG_CPU_PROGRAM_MAP(homelab3_mem) - MCFG_CPU_IO_MAP(homelab3_io) - MCFG_MACHINE_RESET_OVERRIDE(homelab_state,homelab3) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) - MCFG_VIDEO_START_OVERRIDE(homelab_state,homelab3) - MCFG_SCREEN_UPDATE_DRIVER(homelab_state, screen_update_homelab3) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", homelab) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_QUICKLOAD_ADD("quickload", homelab_state, homelab, "htp", 2) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( brailab4, homelab_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 4) - MCFG_CPU_PROGRAM_MAP(brailab4_mem) - MCFG_CPU_IO_MAP(brailab4_io) - MCFG_MACHINE_RESET_OVERRIDE(homelab_state,brailab4) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) - MCFG_VIDEO_START_OVERRIDE(homelab_state,brailab4) - MCFG_SCREEN_UPDATE_DRIVER(homelab_state, screen_update_homelab3) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", homelab) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD ( "speech", DAC, 0 ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MCFG_DEVICE_ADD("mea8000", MEA8000, 0) - MCFG_MEA8000_DAC("speech") - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_QUICKLOAD_ADD("quickload", homelab_state, homelab, "htp", 18) -MACHINE_CONFIG_END - -DRIVER_INIT_MEMBER(homelab_state,brailab4) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 2, &RAM[0xf800], 0x8000); -} - -/* ROM definition */ - -ROM_START( homelab2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hl2_1.rom", 0x0000, 0x0800, BAD_DUMP CRC(205365f7) SHA1(da93b65befd83513dc762663b234227ba804124d)) - ROM_LOAD( "hl2_2.rom", 0x0800, 0x0800, CRC(696af3c1) SHA1(b53bc6ae2b75975618fc90e7181fa5d21409fce1)) - ROM_LOAD( "hl2_3.rom", 0x1000, 0x0800, CRC(69e57e8c) SHA1(e98510abb715dbf513e1b29fb6b09ab54e9483b7)) - ROM_LOAD( "hl2_4.rom", 0x1800, 0x0800, CRC(97cbbe74) SHA1(34f0bad41302b059322018abc3d1c2336ecfbea8)) - ROM_LOAD( "hl2_m.rom", 0x2000, 0x0800, CRC(10040235) SHA1(e121dfb97cc8ea99193a9396a9f7af08585e0ff0) ) - ROM_FILL(0x46, 1, 0x18) // fix bad code - ROM_FILL(0x47, 1, 0x0E) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "hl2.chr", 0x0000, 0x0800, CRC(2e669d40) SHA1(639dd82ed29985dc69830aca3b904b6acc8fe54a)) - // found on net, looks like bad dump - //ROM_LOAD_OPTIONAL( "hl2_ch.rom", 0x0800, 0x1000, CRC(6a5c915a) SHA1(7e4e966358556c6aabae992f4c2b292b6aab59bd) ) -ROM_END - -ROM_START( homelab3 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hl3_1.rom", 0x0000, 0x1000, CRC(6b90a8ea) SHA1(8ac40ca889b8c26cdf74ca309fbafd70dcfdfbec)) - ROM_LOAD( "hl3_2.rom", 0x1000, 0x1000, CRC(bcac3c24) SHA1(aff371d17f61cb60c464998e092f04d5d85c4d52)) - ROM_LOAD( "hl3_3.rom", 0x2000, 0x1000, CRC(ab1b4ab0) SHA1(ad74c7793f5dc22061a88ef31d3407267ad08719)) - ROM_LOAD( "hl3_4.rom", 0x3000, 0x1000, CRC(bf67eff9) SHA1(2ef5d46f359616e7d0e5a124df528de44f0e850b)) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "hl3.chr", 0x0000, 0x0800, CRC(f58ee39b) SHA1(49399c42d60a11b218a225856da86a9f3975a78a)) -ROM_END - -ROM_START( homelab4 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hl4_1.rom", 0x0000, 0x1000, CRC(a549b2d4) SHA1(90fc5595da8431616aee56eb5143b9f04281e798)) - ROM_LOAD( "hl4_2.rom", 0x1000, 0x1000, CRC(151d33e8) SHA1(d32004bc1553f802b9d3266709552f7d5315fe44)) - ROM_LOAD( "hl4_3.rom", 0x2000, 0x1000, CRC(39571ab1) SHA1(8470cff2e3442101e6a0bc655358b3a6fc1ef944)) - ROM_LOAD( "hl4_4.rom", 0x3000, 0x1000, CRC(f4b77ca2) SHA1(ffbdb3c1819c7357e2a0fc6317c111a8a7ecfcd5)) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "hl4.chr", 0x0000, 0x0800, CRC(f58ee39b) SHA1(49399c42d60a11b218a225856da86a9f3975a78a)) -ROM_END - -ROM_START( brailab4 ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "brl1.rom", 0x0000, 0x1000, CRC(02323403) SHA1(3a2e853e0a39e05a04a8db58e1a76de1eda579c9)) - ROM_LOAD( "brl2.rom", 0x1000, 0x1000, CRC(36173fbc) SHA1(1c01398e16a1cbe4103e1be769347ceae873e090)) - ROM_LOAD( "brl3.rom", 0x2000, 0x1000, CRC(d3cdd108) SHA1(1a24e6c5f9c370ff6cb25045cb9d95e664467eb5)) - ROM_LOAD( "brl4.rom", 0x3000, 0x1000, CRC(d4047885) SHA1(00fe40c4c2c64a49bb429fb2b27cc7e0d0025a85)) - ROM_LOAD( "brl5.rom", 0xd000, 0x1000, CRC(8a76be04) SHA1(4b683b9be23b47117901fe874072eb7aa481e4ff)) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "hl4.chr", 0x0000, 0x0800, CRC(f58ee39b) SHA1(49399c42d60a11b218a225856da86a9f3975a78a)) - - // these roms were found on the net, to be investigated - ROM_REGION( 0x5020, "user1", 0 ) - // brl1 to 5 merged, with small changes - // 00BF: 28 18 87 -> 30 30 0c - // 0138: 07 0a 06 0b -> 0c 06 07 0a (keyboard assignments) - ROM_LOAD_OPTIONAL( "brl.rom", 0x0000, 0x5000, CRC(54af5d30) SHA1(d1e7b7f5866acba0503d47f610456f396526240b) ) - // a small prom - ROM_LOAD_OPTIONAL( "brlcpm.rom", 0x5000, 0x0020, CRC(b936d568) SHA1(150330eccbc4b664eba4103f051d6e932038e9e8) ) -ROM_END - -ROM_START( braiplus ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "brailabplus.bin", 0x0000, 0x4000, CRC(521d6952) SHA1(f7405520d86fc7abd2dec51d1d016658472f6fe8) ) - - ROM_REGION(0x0800, "chargen",0) // no idea what chargen it uses - ROM_LOAD( "hl4.chr", 0x0000, 0x0800, CRC(f58ee39b) SHA1(49399c42d60a11b218a225856da86a9f3975a78a)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, homelab2, 0, 0, homelab, homelab, driver_device, 0, "Jozsef and Endre Lukacs", "Homelab 2 / Aircomp 16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) -COMP( 1983, homelab3, homelab2, 0, homelab3, homelab3, driver_device, 0, "Jozsef and Endre Lukacs", "Homelab 3", MACHINE_NOT_WORKING ) -COMP( 1984, homelab4, homelab2, 0, homelab3, homelab3, driver_device, 0, "Jozsef and Endre Lukacs", "Homelab 4", MACHINE_NOT_WORKING ) -COMP( 1984, brailab4, homelab2, 0, brailab4, brailab4, homelab_state, brailab4, "Jozsef and Endre Lukacs", "Brailab 4", MACHINE_NOT_WORKING ) -COMP( 1988, braiplus, homelab2, 0, brailab4, brailab4, homelab_state, brailab4, "Jozsef and Endre Lukacs", "Brailab Plus", MACHINE_NOT_WORKING | MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/homez80.c b/src/mess/drivers/homez80.c deleted file mode 100644 index 3d403ba51d7..00000000000 --- a/src/mess/drivers/homez80.c +++ /dev/null @@ -1,315 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Homebrew Z80 Computer by Kun-Szabo Marton - - http://digitarworld.uw.hu/z80.htm - - 31/10/2010 Initial driver by Miodrag Milanovic - - All commands must be entered in uppercase, and since the capslock - doesn't work, you need to hold the shift key down. - - There is next to no error checking, for example the T command - is to set the time. Entering T by itself will set the time to - 99:99:99, while G will cause a jump to 9999 and so forth. Also - the parameter must be right next to the command, spaces will cause - invalid input. Example M1234 will display a byte of memory at 1234, - while M 1234 will display memory at 9123. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - - -class homez80_state : public driver_device -{ -public: - homez80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - , - m_p_videoram(*this, "p_videoram"){ } - - required_device m_maincpu; - DECLARE_READ8_MEMBER( homez80_keyboard_r ); - required_shared_ptr m_p_videoram; - UINT8* m_p_chargen; - bool m_irq; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(homez80_interrupt); -}; - - -READ8_MEMBER( homez80_state::homez80_keyboard_r ) -{ - char kbdrow[8]; - sprintf(kbdrow,"LINE%d",offset); - return ioport(kbdrow)->read(); -} - -static ADDRESS_MAP_START(homez80_mem, AS_PROGRAM, 8, homez80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_ROM // Monitor - AM_RANGE( 0x2000, 0x23ff ) AM_RAM AM_SHARE("p_videoram") // Video RAM - AM_RANGE( 0x7020, 0x702f ) AM_READ(homez80_keyboard_r) - AM_RANGE( 0x8000, 0xffff ) AM_RAM // 32 K RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( homez80_io, AS_IO, 8, homez80_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( homez80 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SCRLOCK) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PRTSCR) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PAUSE) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE10") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) - PORT_START("LINE11") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) - PORT_START("LINE12") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) - PORT_START("LINE13") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) - PORT_START("LINE14") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) - PORT_START("LINE15") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -void homez80_state::machine_reset() -{ - m_irq = 0; -} - -void homez80_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 homez80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 32; y++) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++, 44); - - for (x = ma; x < ma+32; x++) - { - chr = m_p_videoram[x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ (chr<<3) | ra]; - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=32; - } - return 0; -} - - -const gfx_layout homez80_charlayout = -{ - 8, 8, /* 8x8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {0, 1, 2, 3, 4, 5, 6, 7}, - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, - 8*8 /* size of one char */ -}; - -static GFXDECODE_START( homez80 ) - GFXDECODE_ENTRY( "chargen", 0x0000, homez80_charlayout, 0, 1 ) -GFXDECODE_END - - -INTERRUPT_GEN_MEMBER(homez80_state::homez80_interrupt) -{ - device.execute().set_input_line(0, (m_irq) ? HOLD_LINE : CLEAR_LINE); - m_irq ^= 1; -} - -static MACHINE_CONFIG_START( homez80, homez80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz / 2) - MCFG_CPU_PROGRAM_MAP(homez80_mem) - MCFG_CPU_IO_MAP(homez80_io) - MCFG_CPU_PERIODIC_INT_DRIVER(homez80_state, homez80_interrupt, 50) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(homez80_state, screen_update) - MCFG_SCREEN_SIZE(344, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 344-1, 0, 32*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", homez80 ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( homez80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "sysrom.bin", 0x0000, 0x1000, CRC(37ca7545) SHA1(3f597d7e45b1ab211d5bd4a99abb21915723c357) ) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "chargen.bin", 0x0000, 0x0800, CRC(93243be3) SHA1(718efc06c131843c15383e50af23f3a5cf44dd9b) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 2008, homez80, 0, 0, homez80, homez80, driver_device, 0, "Kun-Szabo Marton", "Homebrew Z80 Computer", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/horizon.c b/src/mess/drivers/horizon.c deleted file mode 100644 index a888a4a3e0a..00000000000 --- a/src/mess/drivers/horizon.c +++ /dev/null @@ -1,221 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - NorthStar Horizon - - 07/12/2009 Skeleton driver. - - It appears these machines say nothing until a floppy disk is - succesfully loaded. The memory range EA00-EB40 appears to be - used by devices, particularly the FDC. - - http://www.hartetechnologies.com/manuals/Northstar/ - -****************************************************************************/ - -/* - - TODO: - - - connect to S-100 bus - - USARTs - - parallel I/O - - motherboard ports - - RTC - - RAM boards - - floppy boards - - floating point board - - SOROC IQ 120 CRT terminal - - NEC 5530-2 SPINWRITER printer - - Anadex DP-8000 printer - -*/ - -#include "bus/rs232/rs232.h" -#include "bus/s100/s100.h" -#include "cpu/z80/z80.h" -#include "machine/i8251.h" - -#define Z80_TAG "z80" -#define I8251_L_TAG "3a" -#define I8251_R_TAG "4a" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" - -class horizon_state : public driver_device -{ -public: - horizon_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_usart_l(*this, I8251_L_TAG), - m_usart_r(*this, I8251_L_TAG) - { } - - required_device m_maincpu; - required_device m_usart_l; - required_device m_usart_r; -}; - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( horizon_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( horizon_mem, AS_PROGRAM, 8, horizon_state ) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( horizon_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( horizon_io, AS_IO, 8, horizon_state ) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( sage2 ) -//------------------------------------------------- - -static INPUT_PORTS_START( horizon ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - - -//------------------------------------------------- -// S100_INTERFACE( s100_intf ) -//------------------------------------------------- - -// slot devices -//#include "bus/s100/dj2db.h" -//#include "bus/s100/djdma.h" -//#include "bus/s100/mm65k16s.h" -#include "bus/s100/nsmdsa.h" -#include "bus/s100/nsmdsad.h" -//#include "bus/s100/wunderbus.h" - -static SLOT_INTERFACE_START( horizon_s100_cards ) - SLOT_INTERFACE("mdsa", S100_MDS_A) - SLOT_INTERFACE("mdsad", S100_MDS_AD) - //SLOT_INTERFACE("hram", S100_HRAM) - //SLOT_INTERFACE("ram32a", S100_RAM32A) - //SLOT_INTERFACE("ram16a", S100_RAM16A) - //SLOT_INTERFACE("fpb", S100_FPB) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( horizon ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( horizon, horizon_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(horizon_mem) - MCFG_CPU_IO_MAP(horizon_io) - - // devices - MCFG_DEVICE_ADD(I8251_L_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_L_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_L_TAG, i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_DEVICE_ADD(I8251_R_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_R_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_R_TAG, i8251_device, write_dsr)) - - // S-100 - MCFG_S100_BUS_ADD() - MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) - //MCFG_S100_SLOT_ADD("s100_1", horizon_s100_cards, NULL, NULL) // CPU - MCFG_S100_SLOT_ADD("s100_2", horizon_s100_cards, NULL) // RAM - MCFG_S100_SLOT_ADD("s100_3", horizon_s100_cards, "mdsad") // MDS - MCFG_S100_SLOT_ADD("s100_4", horizon_s100_cards, NULL) // FPB - MCFG_S100_SLOT_ADD("s100_5", horizon_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_6", horizon_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_7", horizon_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_8", horizon_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_9", horizon_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_10", horizon_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_11", horizon_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_12", horizon_s100_cards, NULL) - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "horizon") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( nshrz ) -//------------------------------------------------- - -ROM_START( nshrz ) - ROM_REGION( 0x400, Z80_TAG, 0 ) - ROM_LOAD( "option.prom", 0x000, 0x400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( vector1 ) -//------------------------------------------------- - -ROM_START( vector1 ) // This one have different I/O - ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF ) - ROM_LOAD( "horizon.bin", 0xe800, 0x0100, CRC(7aafa134) SHA1(bf1552c4818f30473798af4f54e65e1957e0db48)) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1976, nshrz, 0, 0, horizon, horizon, driver_device, 0, "North Star Computers", "Horizon (North Star Computers)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) -COMP( 1979, vector1, nshrz, 0, horizon, horizon, driver_device, 0, "Vector Graphic", "Vector 1+ (DD drive)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/hp16500.c b/src/mess/drivers/hp16500.c deleted file mode 100644 index b847da0c19b..00000000000 --- a/src/mess/drivers/hp16500.c +++ /dev/null @@ -1,507 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - Hewlett-Packard HP16500a/b/c Logic Analyzer - - These are weird, the "a" has more in common with the older 1650/1651 - than the 16500b. - - 16500a rev 00.00: - MC68000 @ 10 MHz - MC68A45 CRTC - FDC9793 floppy controller (WD1793 type) - TMS9914A GPIB bus interface - SCN2661 DUART/timer - - IRQ1 = VBL, IRQ2 = 20b007, IRQ3 = ?, IRQ4 = 20d000, IRQ5 = 20d007, - IRQ6 = ?, IRQ7 = ? - - 16500a rev 00.02: - MC68000 @ 10 MHz - MC68A45 CRTC - Z0765A08PSC floppy controller (NEC765 type) - TMS9914A GPIB bus interface - SCN2661 DUART/timer - - 16500b: - MC68EC030 @ 25 MHz - - WD37C65C floppy controller (NEC765 type) - Bt475 video RAMDAC - TMS9914A GPIB bus interface - Dallas DS1286 RTC/CMOS RAM - - IRQ 1 = VBL - IRQ 2 = 35b8 - IRQ 3 = 35ce (jump 840120) - IRQ 4 = 17768 - IRQ 5 = 814a - IRQ 6 = 35c8 (jump 840120) - IRQ 7 = 35d4 (jump 840120) - - 16500c: - Same as 16500b, but add: - 53C720 SCSI controller - DP83934 SONIC ethernet - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "video/mc6845.h" -#include "machine/mc68681.h" - -#define MAINCPU_TAG "maincpu" -#define CRTC_TAG "crtc" -#define SCREEN_TAG "screen" -#define DUART_TAG "duart" - -class hp16500_state : public driver_device -{ -public: - hp16500_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MAINCPU_TAG) - { } - - virtual void video_start(); - UINT32 screen_update_hp16500(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_hp16500a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - required_device m_maincpu; - std::vector m_vram; - - UINT8 m_mask, m_val; - - DECLARE_WRITE32_MEMBER(palette_w); - - DECLARE_WRITE16_MEMBER(vram_w); - DECLARE_READ8_MEMBER (vram_r); - DECLARE_WRITE8_MEMBER (mask_w); - DECLARE_WRITE8_MEMBER (val_w); - DECLARE_READ32_MEMBER(vbl_state_r); - DECLARE_WRITE32_MEMBER(vbl_ack_w); - DECLARE_READ16_MEMBER(vbl_ack16_r); - DECLARE_WRITE16_MEMBER(vbl_ack16_w); - - DECLARE_WRITE8_MEMBER(pal_ctrl_w); - DECLARE_WRITE8_MEMBER(pal_r_w); - DECLARE_WRITE8_MEMBER(pal_g_w); - DECLARE_WRITE8_MEMBER(pal_b_w); - - DECLARE_WRITE16_MEMBER(maskval_w); - - DECLARE_WRITE_LINE_MEMBER(vsync_changed); - MC6845_UPDATE_ROW(crtc_update_row); - MC6845_UPDATE_ROW(crtc_update_row_1650); - - INTERRUPT_GEN_MEMBER(vblank); - -private: - UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs; -}; - -READ32_MEMBER(hp16500_state::vbl_state_r) -{ - return 0x03000000; // bit 0 set means the interrupt handler advances the pSOS tick counter. -} - -WRITE32_MEMBER(hp16500_state::vbl_ack_w) -{ - m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); -} - -READ16_MEMBER(hp16500_state::vbl_ack16_r) -{ - m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); - return 0; -} - -WRITE16_MEMBER(hp16500_state::vbl_ack16_w) -{ - m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); -} - -WRITE_LINE_MEMBER( hp16500_state::vsync_changed ) -{ - if (state) - { - m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); - } -} - -MC6845_UPDATE_ROW( hp16500_state::crtc_update_row ) -{ - UINT32 *p = &bitmap.pix32(y); - int i, pos; - - pos = y * 144; - - for (i = 0; i < x_count; i++) - { - *p++ = m_palette[m_vram[pos+0x00000]]; - *p++ = m_palette[m_vram[pos+0x10000]]; - *p++ = m_palette[m_vram[pos+0x20000]]; - *p++ = m_palette[m_vram[pos+0x30000]]; - pos++; - *p++ = m_palette[m_vram[pos+0x00000]]; - *p++ = m_palette[m_vram[pos+0x10000]]; - *p++ = m_palette[m_vram[pos+0x20000]]; - *p++ = m_palette[m_vram[pos+0x30000]]; - pos++; - } -} - -MC6845_UPDATE_ROW( hp16500_state::crtc_update_row_1650 ) -{ - UINT32 *p = &bitmap.pix32(y); - int i, pos; - - pos = y * 148; - - for (i = 0; i < x_count; i++) - { - *p++ = m_palette[m_vram[pos+0x00000]]; - *p++ = m_palette[m_vram[pos+0x10000]]; - *p++ = m_palette[m_vram[pos+0x20000]]; - *p++ = m_palette[m_vram[pos+0x30000]]; - pos++; - *p++ = m_palette[m_vram[pos+0x00000]]; - *p++ = m_palette[m_vram[pos+0x10000]]; - *p++ = m_palette[m_vram[pos+0x20000]]; - *p++ = m_palette[m_vram[pos+0x30000]]; - pos++; - } -} - -WRITE8_MEMBER(hp16500_state::pal_ctrl_w) -{ - m_clutoffs = data & 0xf; -} - - -WRITE8_MEMBER(hp16500_state::pal_r_w) -{ - m_colors[0] = (data<<4); - m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]); -} - -WRITE8_MEMBER(hp16500_state::pal_g_w) -{ - m_colors[1] = (data<<4); - m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]); -} - -WRITE8_MEMBER(hp16500_state::pal_b_w) -{ - m_colors[2] = (data<<4); - m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]); -} - -WRITE16_MEMBER(hp16500_state::maskval_w) -{ - // by analogy with the string printer code from the 16500b, which - // appears to be a direct port... - m_val = ((data>>8) & 0xff) ^ 0xff; - m_mask = (data & 0xff) ^ 0xff; -} - -static ADDRESS_MAP_START(hp1650_map, AS_PROGRAM, 16, hp16500_state) - AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_REGION("bios", 0) - - AM_RANGE(0x201000, 0x201001) AM_WRITE(maskval_w) - - AM_RANGE(0x204000, 0x204001) AM_WRITE8(pal_ctrl_w, 0x00ff) - AM_RANGE(0x205000, 0x205001) AM_WRITE8(pal_r_w, 0x00ff) - AM_RANGE(0x206000, 0x206001) AM_WRITE8(pal_g_w, 0x00ff) - AM_RANGE(0x207000, 0x207001) AM_WRITE8(pal_b_w, 0x00ff) - - AM_RANGE(0x20c000, 0x20c001) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, status_r, address_w, 0x00ff) - AM_RANGE(0x20c002, 0x20c003) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, register_r, register_w, 0x00ff) - - AM_RANGE(0x20e000, 0x20e001) AM_READWRITE(vbl_ack16_r, vbl_ack16_w) - - AM_RANGE(0x2050fe, 0x2050ff) AM_NOP - AM_RANGE(0x206000, 0x206001) AM_NOP - AM_RANGE(0x20f000, 0x20f001) AM_NOP - - AM_RANGE(0x600000, 0x61ffff) AM_WRITE(vram_w) - AM_RANGE(0x600000, 0x67ffff) AM_READ8(vram_r, 0x00ff) - - AM_RANGE(0x900000, 0x9fffff) AM_RAM -ADDRESS_MAP_END - -// like 1650 but moves main RAM to match 16500a -static ADDRESS_MAP_START(hp1651_map, AS_PROGRAM, 16, hp16500_state) - AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_REGION("bios", 0) - - AM_RANGE(0x201000, 0x201001) AM_WRITE(maskval_w) - - AM_RANGE(0x204000, 0x204001) AM_WRITE8(pal_ctrl_w, 0x00ff) - AM_RANGE(0x205000, 0x205001) AM_WRITE8(pal_r_w, 0x00ff) - AM_RANGE(0x206000, 0x206001) AM_WRITE8(pal_g_w, 0x00ff) - AM_RANGE(0x207000, 0x207001) AM_WRITE8(pal_b_w, 0x00ff) - - AM_RANGE(0x20c000, 0x20c001) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, status_r, address_w, 0x00ff) - AM_RANGE(0x20c002, 0x20c003) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, register_r, register_w, 0x00ff) - - AM_RANGE(0x20e000, 0x20e001) AM_READWRITE(vbl_ack16_r, vbl_ack16_w) - - AM_RANGE(0x2050fe, 0x2050ff) AM_NOP - AM_RANGE(0x206000, 0x206001) AM_NOP - AM_RANGE(0x20f000, 0x20f001) AM_NOP - - AM_RANGE(0x600000, 0x61ffff) AM_WRITE(vram_w) - AM_RANGE(0x600000, 0x67ffff) AM_READ8(vram_r, 0x00ff) - - AM_RANGE(0x980000, 0xa7ffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(hp16500a_map, AS_PROGRAM, 16, hp16500_state) - AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_REGION("bios", 0) - - AM_RANGE(0x201000, 0x201001) AM_WRITE(maskval_w) - - AM_RANGE(0x204000, 0x204001) AM_WRITE8(pal_ctrl_w, 0x00ff) - AM_RANGE(0x205000, 0x205001) AM_WRITE8(pal_r_w, 0x00ff) - AM_RANGE(0x206000, 0x206001) AM_WRITE8(pal_g_w, 0x00ff) - AM_RANGE(0x207000, 0x207001) AM_WRITE8(pal_b_w, 0x00ff) - - AM_RANGE(0x20c000, 0x20c001) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, status_r, address_w, 0x00ff) - AM_RANGE(0x20c002, 0x20c003) AM_DEVREADWRITE8(CRTC_TAG, mc6845_device, register_r, register_w, 0x00ff) - - AM_RANGE(0x20e000, 0x20e001) AM_READWRITE(vbl_ack16_r, vbl_ack16_w) - - AM_RANGE(0x600000, 0x61ffff) AM_WRITE(vram_w) - AM_RANGE(0x600000, 0x67ffff) AM_READ8(vram_r, 0x00ff) - - AM_RANGE(0x980000, 0xa7ffff) AM_RAM -ADDRESS_MAP_END - -UINT32 hp16500_state::screen_update_hp16500a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static ADDRESS_MAP_START(hp16500_map, AS_PROGRAM, 32, hp16500_state) - AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("bios", 0) - AM_RANGE(0x0020f000, 0x0020f003) AM_WRITE(palette_w) - - AM_RANGE(0x00202800, 0x00202803) AM_WRITE(vbl_ack_w) - AM_RANGE(0x00203000, 0x00203003) AM_WRITE(vbl_ack_w) - AM_RANGE(0x00209800, 0x00209803) AM_READ(vbl_state_r) - - AM_RANGE(0x0020b800, 0x0020b8ff) AM_RAM // system ram test is really strange. - - AM_RANGE(0x00600000, 0x0061ffff) AM_WRITE16(vram_w, 0xffffffff) - AM_RANGE(0x00600000, 0x0067ffff) AM_READ8 (vram_r, 0x00ff00ff) - AM_RANGE(0x00700000, 0x00700003) AM_WRITE8 (mask_w, 0xff000000) - AM_RANGE(0x00740000, 0x00740003) AM_WRITE8 (val_w, 0xff000000) - AM_RANGE(0x00800000, 0x009fffff) AM_RAM -ADDRESS_MAP_END - -INTERRUPT_GEN_MEMBER(hp16500_state::vblank) -{ - m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); -} - -void hp16500_state::video_start() -{ - m_count = 0; - m_clutoffs = 0; - memset(m_palette, 0, sizeof(m_palette)); - m_vram.resize(0x40000); - m_mask = 0; - m_val = 0; -} - -// The test code is buggy, it writes a byte in the wrong position -// (even instead of odd). It still works because the 68k replicates -// the byte on the word and the hardware doesn't decode UDS/LDS. But -// that is why the handler needs to be 16 bits, or it won't be called -// in the first place. - -WRITE16_MEMBER(hp16500_state::vram_w) -{ - if(!ACCESSING_BITS_0_7) - data = data | (data >> 8); - for(int i=0; i<4; i++) { - int off = offset + i * 0x10000; - if(data & (8 >> i)) - m_vram[off] = (m_vram[off] & ~m_mask) | (m_val & m_mask); - else - m_vram[off] = (m_vram[off] & ~m_mask); - } -} - -READ8_MEMBER (hp16500_state::vram_r) -{ - return m_vram[offset]; -} - -WRITE8_MEMBER(hp16500_state::mask_w) -{ - m_mask = data; -} - -WRITE8_MEMBER(hp16500_state::val_w) -{ - m_val = data; -} - -WRITE32_MEMBER(hp16500_state::palette_w) -{ - if (mem_mask == 0xff000000) - { - m_clutoffs = (data>>24) & 0xff; - } - else if (mem_mask == 0x00ff0000) - { - m_colors[m_count++] = (data>>14) & 0xfc; - - if (m_count == 3) - { - m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]); - m_clutoffs++; - if (m_clutoffs > 255) - { - m_clutoffs = 0; - } - m_count = 0; - } - } -} - -// 4 bpp -// addr = ((Y * 0xfc0) + 0x360) + (X * 4) -UINT32 hp16500_state::screen_update_hp16500(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int pos = 0; - for (int y = 0; y < 384; y++) - { - UINT32 *scanline = &bitmap.pix32(y); - - for (int x = 0; x < 576; x+=4) - { - *scanline++ = m_palette[m_vram[pos+0x00000]]; - *scanline++ = m_palette[m_vram[pos+0x10000]]; - *scanline++ = m_palette[m_vram[pos+0x20000]]; - *scanline++ = m_palette[m_vram[pos+0x30000]]; - pos++; - } - } - - return 0; -} - -static MACHINE_CONFIG_START( hp1650, hp16500_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68000, 10000000) - MCFG_CPU_PROGRAM_MAP(hp1650_map) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_RAW_PARAMS(25000000, 0x330, 0, 0x250, 0x198, 0, 0x180 ) - MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, mc6845_device, screen_update ) - - MCFG_MC6845_ADD(CRTC_TAG, MC6845, SCREEN_TAG, 25000000/9) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(hp16500_state, crtc_update_row_1650) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(hp16500_state, vsync_changed)) - - MCFG_DEVICE_ADD(DUART_TAG, MC68681, 20000000) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp1651, hp16500_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68000, 10000000) - MCFG_CPU_PROGRAM_MAP(hp1651_map) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_RAW_PARAMS(25000000, 0x330, 0, 0x250, 0x198, 0, 0x180 ) - MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, mc6845_device, screen_update ) - - MCFG_MC6845_ADD(CRTC_TAG, MC6845, SCREEN_TAG, 25000000/9) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(hp16500_state, crtc_update_row_1650) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(hp16500_state, vsync_changed)) - - MCFG_DEVICE_ADD(DUART_TAG, MC68681, 20000000) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp16500a, hp16500_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68000, 10000000) - MCFG_CPU_PROGRAM_MAP(hp16500a_map) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_RAW_PARAMS(25000000, 0x320, 0, 0x240, 0x19c, 0, 0x170 ) - MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, mc6845_device, screen_update ) - - MCFG_MC6845_ADD(CRTC_TAG, MC6845, SCREEN_TAG, 25000000/9) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(hp16500_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(hp16500_state, vsync_changed)) - - MCFG_DEVICE_ADD(DUART_TAG, MC68681, 20000000) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp16500, hp16500_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68EC030, 25000000) - MCFG_CPU_PROGRAM_MAP(hp16500_map) - MCFG_CPU_VBLANK_INT_DRIVER(SCREEN_TAG, hp16500_state, vblank) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp16500_state, screen_update_hp16500) - MCFG_SCREEN_SIZE(576,384) - MCFG_SCREEN_VISIBLE_AREA(0, 576-1, 0, 384-1) - MCFG_SCREEN_REFRESH_RATE(60) - - MCFG_DEVICE_ADD(DUART_TAG, MC68681, 20000000) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") -MACHINE_CONFIG_END - -static INPUT_PORTS_START( hp16500 ) -INPUT_PORTS_END - -ROM_START( hp1650b ) - ROM_REGION16_BE(0x20000, "bios", 0) - ROM_LOAD16_BYTE( "la1.bin", 0x000000, 0x008000, CRC(7c60e334) SHA1(c3661e4bb58e0951e9c13208b4991f5d9dda633b) ) - ROM_LOAD16_BYTE( "la2.bin", 0x000001, 0x008000, CRC(b0c6fe60) SHA1(a77b2e7098f26af93b0946abe6e89711b3332210) ) -ROM_END - -ROM_START( hp1651b ) - ROM_REGION16_BE(0x20000, "bios", 0) - ROM_LOAD16_BYTE( "u102.bin", 0x000000, 0x008000, CRC(d7e1b091) SHA1(af813cc7ae748aedf1b1d9d522ee2154961315c2) ) - ROM_LOAD16_BYTE( "u103.bin", 0x000001, 0x008000, CRC(f32a37c7) SHA1(8addda59923f64fd9b7e909eb0e3a17cc02bb70e) ) -ROM_END - -ROM_START( hp165ka0 ) - ROM_REGION16_BE(0x20000, "bios", 0) - ROM_LOAD16_BYTE( "16500-80002.bin", 0x000000, 0x008000, CRC(0324b75a) SHA1(837855fce9288139226c914cc0c43061e25b57d2) ) - ROM_LOAD16_BYTE( "16500-80001.bin", 0x000001, 0x008000, CRC(362c8cbf) SHA1(812b79d1a31d09ec632a6842b11548168d82b5e7) ) -ROM_END - -ROM_START( hp16500b ) - ROM_REGION32_BE(0x20000, "bios", 0) - ROM_LOAD32_BYTE( "16500-80014.bin", 0x000000, 0x008000, CRC(35187716) SHA1(82067737892ecd356a5454a43d9ce9b38ac2397f) ) - ROM_LOAD32_BYTE( "16500-80015.bin", 0x000001, 0x008000, CRC(d8d26c1c) SHA1(b5b956c17c9d6e54519a686b5e4aa733b266bf6f) ) - ROM_LOAD32_BYTE( "16500-80016.bin", 0x000002, 0x008000, CRC(61457b39) SHA1(f209315ec22a8ee9d44a0ec009b1afb47794bece) ) - ROM_LOAD32_BYTE( "16500-80017.bin", 0x000003, 0x008000, CRC(e0b1096b) SHA1(426bb9a4756d8087bded4f6b61365d733ffbb09a) ) -ROM_END - -COMP( 1989, hp1650b, 0, 0, hp1650, hp16500, driver_device, 0, "Hewlett Packard", "HP 1650b", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) -COMP( 1989, hp1651b, 0, 0, hp1651, hp16500, driver_device, 0, "Hewlett Packard", "HP 1651b", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) -COMP( 1991, hp165ka0, 0, 0, hp16500a, hp16500, driver_device, 0, "Hewlett Packard", "HP 16500a", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) -COMP( 1991, hp16500b, 0, 0, hp16500, hp16500, driver_device, 0, "Hewlett Packard", "HP 16500b", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mess/drivers/hp48.c b/src/mess/drivers/hp48.c deleted file mode 100644 index 2b9e31dfcdc..00000000000 --- a/src/mess/drivers/hp48.c +++ /dev/null @@ -1,1373 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2008 - - Hewlett Packard HP48 S/SX & G/GX/G+ and HP49 G - -**********************************************************************/ - -#include "emu.h" -#include "cpu/saturn/saturn.h" -#include "sound/dac.h" -#include "machine/nvram.h" - -#include "includes/hp48.h" - -/* TODO: - - IR I/O port - - HP48 to HP48 serial connection - - set card size when creating a new card image - - some bits I/O RAM not implemented - - printer - - more accurate timing (accurate SATURN cycles, speedup when screen is off) - - save-state: figure what RAM to store & where (currently, when exiting, - base RAM is saved as nvram, RAM in expansion ports is saved as image, - IO RAM is & CPU state are discarded; save-state saves base & IO RAM, - CPU state, but not expansion port RAM) - - more accurate IRQ, NMI, sleep and wake-up handling - - HP49 G flash ROM write - - HP49 xmodem -*/ - - -/* - HP48: graphical calculators by Hewlett Packard. - - Two main series: S series & G series. - Each series is subdivised into an 'expandable' model (SX,GX) and a - cheaper 'non-expandable' model (S,G). - - Timeline: - - 1990-03-06 HP48SX (discontinued in ????) - - 1991-04-02 HP48S (discontinued in 1993) - - 1993-06-01 HP48G (discontinued in 1999) - HP48GX (discontinued in 2003) - - 1998-03-30 HP48G+ (discontinued in 2003) - - Common characteristics: - - HP family name: Charlemagne - - CPU: Saturn, 4-bit processor, chip version: 1LT8 - - BUS: - . 20-bit address bus - . nibble (4-bit) addressable - => 512 KB address space (i.e., 1 Mnibbles) - . daisy-chained modules - - Screen: 131x64 LCD, 2-color, 64 Hz refresh - - Keyboard: 49 keys - - IR I/O port - - 4-wire serial I/O port - - 1-bit beeper - - Power-source: 3 AAA cells - - Continuous memory - - - S series specific: - - Clarke IC - - clock speed: 2 MHz - - 256 KB ROM (various revisions, identical in S and SX) - - - S model specific: - + Codename: Shorty - + 32 KB RAM base, not expandable (in theory) - + no expansion port - - - SX model specific: - + Codename: Charlemagne - + 32 KB base RAM, expandable to 288 KB - + 2 expansion ports (port 1 and port 2) - up to 128 KB RAM per port, can be merged with base RAM - - G series specific: - - Yorke IC - - clock speed: ~4 MHz - - 512 KB ROM (various revisions, identical in G and GX) - - - G model specific: - + Codename: Alcuin - + 32 KB RAM, not expandable (in theory!) - + no expansion port - - - GX model specific: - + Codename: Hammer - + 128 KB base RAM, expandable up to 4 MB (banked) - + 2 expansion ports - . port 1: up to 128 KB RAM, can be merged with base RAM - . port 2: up to 4 MB RAM, in 32 banks of 128 KB, cannot be merged - - - G+ model specific: - + Codename: Plus - + 128 KB RAM, not expandable - + no expansion port - - - - HP49 G: - similar to HP48 G with the following differences: - - 2048 KB flash ROM (re-writtable) - - 512 KB RAM (not expandable) - - Keyboard: 51 keys - - no IR I/O port - - rewritten optimized OS makes the HP49 G much faster than HP48 despite - having the same CPU and clock rate (4 MHz York Saturn) - -*/ - - -/* - More about memory. - - The base RAM is treated as NVRAM: stored in a .nv file in your nvram - directory. - When first starting the emulator, or after nvram file has been deleted, - you'll get a "Try to recover memory?". This is expected. - Answer NO (F key): there is nothing to recover, but it will setup the - system-reserved RAM part correctly. - If the emulator is shut down properly (i.e., when the calculator is - not busy), the message should not appear next time it is run. - All the variables and port 0 should be conserved (in the .nv file), - but not the stack. - Stopping and restarting the emulator loosely corresponds to hitting the - reset button. - - Expansion RAMs are treated as images, not NVRAM. - The -p1 (resp. -p2) image option allows mapping some file to port 1 - (resp. port 2). - The file size should be between 32 KB and 128 KB (or 4 GB for port 2 on GX) - and be a power of two. -*/ - - -/* - More about serial connection. - - Normally, files are exchanged by serial connection to a computer running a - kermit communication program (xmodem is also allowed for the G/GX). - We emulate both the serial link and the communication program. - Thus, the emulated HP48 can directly upload/download image files. - The -k image option corresponds to the kermit protocol (SEND and RECV - commands on the HP48). - The -x image option corresponds to the xmodem protocol (XSEND and XRECV - commands on the HP48). -*/ - - - -/* - - References: - - - Voyage au centre de la HP48 S/SX, by Paul Courbis & S?bastien Lalande - (English version: HP48 machine language - a journey to the center - of the HP48 s/sx) - available at http://www.courbis.com - - - Voyage au centre de la HP48 G/GX, by Paul Courbis - available at http://www.courbis.com - - - Guide to the Saturn Processor (With HP48 Applications) - by Matthew Mastracci - - - Introduction to Saturn Assembly Language - by Gilbert Fernandes - - - http://www.hpcalc.org/ - -*/ - - - - -/**************************** inputs *******************************/ - -/* KEYBOARD - -------- - - keyboard layout for 48 models - - ------------------------------------------------- - | A | B | C | D | E | F | - |-------+-------+-------+-------+-------+-------| - | MTH | PRG | CST | VAR | up | NXT | - |-------+-------+-------+-------+-------+-------| - | ' | STO | EVAL | left | down | right | - |-------+-------+-------+-------+-------+-------| - | SIN | COS | TAN | sqrt | y^x | 1/x | - |---------------+-------+-------+-------+-------| - | ENTER | +/- | EEX | DEL | <= | - |-----------------------------------------------| - | alpha | 7 | 8 | 9 | / | - |---------+--------+--------+---------+---------| - | red | 4 | 5 | 6 | * | - |---------+--------+--------+---------+---------| - | green | 1 | 2 | 3 | - | - |---------+--------+--------+---------+---------| - | ON | 0 | . | SPC | + | - ------------------------------------------------- - - * 49 keys - * including 3 modifier keys: - - a blue/green shift (upper right) - - an orange/red shift (upper left) - - a white alpha key (lower right) - - Difference between G and S series: a few red and blue shifted keys. - -*/ - -/* S/SX */ -static INPUT_PORTS_START( hp48sx_kbd ) - - PORT_START( "LINE0" ) /* OUT = 0x001 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "+ { } : :" ) - PORT_CODE ( KEYCODE_EQUALS ) - PORT_CODE ( KEYCODE_PLUS_PAD ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "SPC \xCF\x80 \xE2\x88\xA1" /* pi, angle */ ) - PORT_CODE ( KEYCODE_SPACE ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( ". , \xE2\x86\xb5" /* return arrow */ ) - PORT_CODE ( KEYCODE_STOP ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "0 = \xE2\x86\x92" /* right arrow */ ) - PORT_CODE ( KEYCODE_0 ) - PORT_CODE ( KEYCODE_0_PAD ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "' M UP HOME" ) - PORT_CODE ( KEYCODE_QUOTE ) - PORT_CODE ( KEYCODE_M ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE1" ) /* OUT = 0x002 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "- << >> \" \"" ) - PORT_CODE ( KEYCODE_MINUS ) - PORT_CODE ( KEYCODE_MINUS_PAD ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "3 CMD MENU" ) - PORT_CODE ( KEYCODE_3 ) - PORT_CODE ( KEYCODE_3_PAD ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "2 STACK ARG" ) - PORT_CODE ( KEYCODE_2 ) - PORT_CODE ( KEYCODE_2_PAD ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "1 RAD POLAR" ) - PORT_CODE ( KEYCODE_1 ) - PORT_CODE ( KEYCODE_1_PAD ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "A" ) - PORT_CODE ( KEYCODE_A ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "right shift" ) - PORT_CODE ( KEYCODE_RSHIFT ) - - PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) - - - PORT_START( "LINE2" ) /* OUT = 0x004 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "* [ ] _" ) - PORT_CODE ( KEYCODE_ASTERISK ) - PORT_CODE ( KEYCODE_CLOSEBRACE ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "6 UNITS" ) - PORT_CODE ( KEYCODE_6_PAD ) - PORT_CODE ( KEYCODE_6 ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "5 STAT" ) - PORT_CODE ( KEYCODE_5_PAD ) - PORT_CODE ( KEYCODE_5 ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "4 TIME" ) - PORT_CODE ( KEYCODE_4_PAD ) - PORT_CODE ( KEYCODE_4 ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "MTH G PRINT") - PORT_CODE ( KEYCODE_G ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "left shift" ) - PORT_CODE ( KEYCODE_LSHIFT ) - - PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) - - - PORT_START( "LINE3" ) /* OUT = 0x008 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "/ ( ) #" ) - PORT_CODE ( KEYCODE_SLASH ) - PORT_CODE ( KEYCODE_SLASH_PAD ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "9 ALGEBRA" ) - PORT_CODE ( KEYCODE_9_PAD ) - PORT_CODE ( KEYCODE_9 ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "8 PLOT" ) - PORT_CODE ( KEYCODE_8_PAD ) - PORT_CODE ( KEYCODE_8 ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "7 SOLVE" ) - PORT_CODE ( KEYCODE_7_PAD ) - PORT_CODE ( KEYCODE_7 ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "SIN S ASIN \xE2\x88\x82" /* delta */ ) - PORT_CODE ( KEYCODE_S ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xCE\xB1 USER ENTRY" /* alpha */ ) - PORT_CODE ( KEYCODE_LALT ) - - PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) - - - PORT_START( "LINE4" ) /* OUT = 0x010 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME (" \xE2\x87\x90 DROP CLR" /* double left arrow */ ) - PORT_CODE ( KEYCODE_BACKSPACE ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "DEL PURGE" ) - PORT_CODE ( KEYCODE_DEL ) - PORT_CODE ( KEYCODE_DEL_PAD ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "EEX Z 2D 3D" ) - PORT_CODE ( KEYCODE_Z ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "+/- Y EDIT VISIT" ) - PORT_CODE ( KEYCODE_Y ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "ENTER EQUATION MATRIX") - PORT_CODE ( KEYCODE_ENTER ) - PORT_CODE ( KEYCODE_ENTER_PAD ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE5" ) /* OUT = 0x020 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "1/x X e^x LN" ) - PORT_CODE ( KEYCODE_X ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "y^x W 10^x LOG" ) - PORT_CODE ( KEYCODE_W ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x88\x9A V x^2 sqrt(x,y)" /* square root */ ) - PORT_CODE ( KEYCODE_V ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "TAN U ATAN \xE2\x88\x91" /* sum */ ) - PORT_CODE ( KEYCODE_U ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "COS T ACOS \xE2\x88\xAB" /* integral */ ) - PORT_CODE ( KEYCODE_T ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE6" ) /* OUT = 0x040 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x92 R SWAP" /* right arrow */ ) - PORT_CODE ( KEYCODE_RIGHT ) - PORT_CODE ( KEYCODE_R ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x93 Q REVIEW" /* down arrow */ ) - PORT_CODE ( KEYCODE_DOWN ) - PORT_CODE ( KEYCODE_Q) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x90 P GRAPH" /* left arrow */ ) - PORT_CODE ( KEYCODE_LEFT ) - PORT_CODE ( KEYCODE_P ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "EVAL O \xE2\x86\x92NUM UNDO" ) - PORT_CODE ( KEYCODE_O ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "STO N DEF RCL" ) - PORT_CODE ( KEYCODE_N ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE7" ) /* OUT = 0x080 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "NXT L PREV" ) - PORT_CODE ( KEYCODE_L ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x91 K LIBRARY" /* up arrow */ ) - PORT_CODE ( KEYCODE_UP ) - PORT_CODE ( KEYCODE_K ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "VAR J MEMORY" ) - PORT_CODE ( KEYCODE_J ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "CST I MODES" ) - PORT_CODE ( KEYCODE_I ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "PRG H I/O" ) - PORT_CODE ( KEYCODE_H ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE8" ) /* OUT = 0x100 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "F" ) - PORT_CODE ( KEYCODE_F ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "E" ) - PORT_CODE ( KEYCODE_E ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "D" ) - PORT_CODE ( KEYCODE_D ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "C" ) - PORT_CODE ( KEYCODE_C ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "B" ) - PORT_CODE ( KEYCODE_B ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "ON" ) /* ON key, appears on all OUT lines */ - - PORT_BIT ( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "ON CANCEL CONT OFF" ) - PORT_CODE ( KEYCODE_ESC ) - PORT_CODE ( KEYCODE_HOME ) - - PORT_BIT ( 0x7fff, 0, IPT_UNUSED ) - -INPUT_PORTS_END - - - -/* G/GX/G+ */ -static INPUT_PORTS_START( hp48gx_kbd ) - - PORT_START( "LINE0" ) /* OUT = 0x001 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "+ { } : :" ) - PORT_CODE ( KEYCODE_EQUALS ) - PORT_CODE ( KEYCODE_PLUS_PAD ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "SPC \xCF\x80 \xE2\x88\xA1" /* pi, angle */ ) - PORT_CODE ( KEYCODE_SPACE ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( ". , \xE2\x86\xb5" /* return arrow */ ) - PORT_CODE ( KEYCODE_STOP ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "0 = \xE2\x86\x92" /* right arrow */ ) - PORT_CODE ( KEYCODE_0 ) - PORT_CODE ( KEYCODE_0_PAD ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "' M UP HOME" ) - PORT_CODE ( KEYCODE_QUOTE ) - PORT_CODE ( KEYCODE_M ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE1" ) /* OUT = 0x002 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "- << >> \" \"" ) - PORT_CODE ( KEYCODE_MINUS ) - PORT_CODE ( KEYCODE_MINUS_PAD ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "3 EQ LIB" ) - PORT_CODE ( KEYCODE_3 ) - PORT_CODE ( KEYCODE_3_PAD ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "2 LIBRARY" ) - PORT_CODE ( KEYCODE_2 ) - PORT_CODE ( KEYCODE_2_PAD ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "1 I/O" ) - PORT_CODE ( KEYCODE_1 ) - PORT_CODE ( KEYCODE_1_PAD ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "A" ) - PORT_CODE ( KEYCODE_A ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "right shift" ) - PORT_CODE ( KEYCODE_RSHIFT ) - - PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) - - - PORT_START( "LINE2" ) /* OUT = 0x004 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "* [ ] _" ) - PORT_CODE ( KEYCODE_ASTERISK ) - PORT_CODE ( KEYCODE_CLOSEBRACE ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "6 UNITS" ) - PORT_CODE ( KEYCODE_6_PAD ) - PORT_CODE ( KEYCODE_6 ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "5 STAT" ) - PORT_CODE ( KEYCODE_5_PAD ) - PORT_CODE ( KEYCODE_5 ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "4 TIME" ) - PORT_CODE ( KEYCODE_4_PAD ) - PORT_CODE ( KEYCODE_4 ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "MTH G RAD POLAR") - PORT_CODE ( KEYCODE_G ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "left shift" ) - PORT_CODE ( KEYCODE_LSHIFT ) - - PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) - - - PORT_START( "LINE3" ) /* OUT = 0x008 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "/ ( ) #" ) - PORT_CODE ( KEYCODE_SLASH ) - PORT_CODE ( KEYCODE_SLASH_PAD ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "9 SYMBOLIC" ) - PORT_CODE ( KEYCODE_9_PAD ) - PORT_CODE ( KEYCODE_9 ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "8 PLOT" ) - PORT_CODE ( KEYCODE_8_PAD ) - PORT_CODE ( KEYCODE_8 ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "7 SOLVE" ) - PORT_CODE ( KEYCODE_7_PAD ) - PORT_CODE ( KEYCODE_7 ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "SIN S ASIN \xE2\x88\x82" /* delta */ ) - PORT_CODE ( KEYCODE_S ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xCE\xB1 USER ENTRY" /* alpha */ ) - PORT_CODE ( KEYCODE_LALT ) - - PORT_BIT ( 0xffc0, 0, IPT_UNUSED ) - - - PORT_START( "LINE4" ) /* OUT = 0x010 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME (" \xE2\x87\x90 DROP" /* double left arrow */ ) - PORT_CODE ( KEYCODE_BACKSPACE ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "DEL CLEAR" ) - PORT_CODE ( KEYCODE_DEL ) - PORT_CODE ( KEYCODE_DEL_PAD ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "EEX Z PURG ARG" ) - PORT_CODE ( KEYCODE_Z ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "+/- Y EDIT CMD" ) - PORT_CODE ( KEYCODE_Y ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "ENTER EQUATION MATRIX") - PORT_CODE ( KEYCODE_ENTER ) - PORT_CODE ( KEYCODE_ENTER_PAD ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE5" ) /* OUT = 0x020 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "1/x X e^x LN" ) - PORT_CODE ( KEYCODE_X ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "y^x W 10^x LOG" ) - PORT_CODE ( KEYCODE_W ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x88\x9A V x^2 sqrt(x,y)" /* square root */ ) - PORT_CODE ( KEYCODE_V ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "TAN U ATAN \xE2\x88\x91" /* sum */ ) - PORT_CODE ( KEYCODE_U ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "COS T ACOS \xE2\x88\xAB" /* integral */ ) - PORT_CODE ( KEYCODE_T ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE6" ) /* OUT = 0x040 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x92 R SWAP" /* right arrow */ ) - PORT_CODE ( KEYCODE_RIGHT ) - PORT_CODE ( KEYCODE_R ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x93 Q VIEW" /* down arrow */ ) - PORT_CODE ( KEYCODE_DOWN ) - PORT_CODE ( KEYCODE_Q) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x90 P PICTURE" /* left arrow */ ) - PORT_CODE ( KEYCODE_LEFT ) - PORT_CODE ( KEYCODE_P ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "EVAL O \xE2\x86\x92NUM UNDO" ) - PORT_CODE ( KEYCODE_O ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "STO N DEF RCL" ) - PORT_CODE ( KEYCODE_N ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE7" ) /* OUT = 0x080 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "NXT L PREV MENU" ) - PORT_CODE ( KEYCODE_L ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x91 K STACK" /* up arrow */ ) - PORT_CODE ( KEYCODE_UP ) - PORT_CODE ( KEYCODE_K ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "VAR J MEMORY" ) - PORT_CODE ( KEYCODE_J ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "CST I MODES" ) - PORT_CODE ( KEYCODE_I ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "PRG H CHARS" ) - PORT_CODE ( KEYCODE_H ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "LINE8" ) /* OUT = 0x100 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "F" ) - PORT_CODE ( KEYCODE_F ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "E" ) - PORT_CODE ( KEYCODE_E ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "D" ) - PORT_CODE ( KEYCODE_D ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "C" ) - PORT_CODE ( KEYCODE_C ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "B" ) - PORT_CODE ( KEYCODE_B ) - - PORT_BIT ( 0xffe0, 0, IPT_UNUSED ) - - - PORT_START( "ON" ) /* ON key, appears on all OUT lines */ - - PORT_BIT ( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "ON CANCEL CONT OFF" ) - PORT_CODE ( KEYCODE_ESC ) - PORT_CODE ( KEYCODE_HOME ) - - PORT_BIT ( 0x7fff, 0, IPT_UNUSED ) - -INPUT_PORTS_END - - - - -/* - keyboard layout for 49 G model - - ------------------------------------------------- - | F1 | F2 | F3 | F4 | F5 | F6 | - |-----------------------------------------------| - | APPS | MODE | TOOL | up | - |---------+--------+--------| left right | - | VAR | STO | NXT | down | - |---------+--------+--------+-------------------| - | HIST | CAT | EQW | SYMB | <= | - |---------+--------+--------+---------+---------| - | y^x | sqrt | SIN | COS | TAN | - |---------+--------+--------+---------+---------| - | EEX | +/- | X | 1/x | / | - |---------+--------+--------+---------+---------| - | alpha | 7 | 8 | 9 | * | - |---------+--------+--------+---------+---------| - | blue | 4 | 5 | 6 | - | - |---------+--------+--------+---------+---------| - | red | 1 | 2 | 3 | + | - |---------+--------+--------+---------+---------| - | ON | 0 | . | SPC | ENTER | - ------------------------------------------------- - - * 51 keys - * including 3 modifier keys: - - a red shift (upper right) - - a blue shift (upper left) - - a cyan alpha key (lower right) -*/ - - -static INPUT_PORTS_START( hp49g_kbd ) - - PORT_START( "LINE0" ) /* OUT = 0x001 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "ENTER ANS NUM") - PORT_CODE ( KEYCODE_ENTER ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "+ { } \xC2\xAB \xC2\xBB") /* << >> */ - PORT_CODE ( KEYCODE_EQUALS ) - PORT_CODE ( KEYCODE_PLUS_PAD ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "- ( ) _") - PORT_CODE ( KEYCODE_MINUS ) - PORT_CODE ( KEYCODE_MINUS_PAD ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "* [ ] \" \"") - PORT_CODE ( KEYCODE_ASTERISK ) - PORT_CODE ( KEYCODE_CLOSEBRACE ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "/ ABS ARG Z") - PORT_CODE ( KEYCODE_SLASH ) - PORT_CODE ( KEYCODE_SLASH_PAD ) - PORT_CODE ( KEYCODE_Z) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "TAN ATAN \xE2\x88\xAB U") /* integral */ - PORT_CODE ( KEYCODE_U ) - - PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x87\x90 DEL CLEAR") /* double left arrow */ - PORT_CODE ( KEYCODE_BACKSPACE ) - PORT_CODE ( KEYCODE_DEL ) - PORT_CODE ( KEYCODE_DEL_PAD ) - - PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "NXT PREV PASTE L") - PORT_CODE ( KEYCODE_L ) - - PORT_BIT ( 0x7f00, 0, IPT_UNUSED ) - - - PORT_START( "LINE1" ) /* OUT = 0x002 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "SPC \xCF\x80 ,") /* pi */ - PORT_CODE ( KEYCODE_SPACE ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "3 # BASE") - PORT_CODE ( KEYCODE_3 ) - PORT_CODE ( KEYCODE_3_PAD ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "6 CONVERT UNITS") - PORT_CODE ( KEYCODE_6 ) - PORT_CODE ( KEYCODE_6_PAD ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "9 FINANCE TIME") - PORT_CODE ( KEYCODE_9 ) - PORT_CODE ( KEYCODE_9_PAD ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "1/x \xE2\x89\xA5 > Y") /* >= */ - PORT_CODE ( KEYCODE_Y ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "COS ACOS \xE2\x88\x82 T") /* delta */ - PORT_CODE ( KEYCODE_T ) - - PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "SYMB MTH EVAL P") - PORT_CODE ( KEYCODE_P ) - - PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "STO\xE2\x8A\xB3 RCL CUT K") - PORT_CODE ( KEYCODE_K ) - - PORT_BIT ( 0x7f00, 0, IPT_UNUSED ) - - - PORT_START( "LINE2" ) /* OUT = 0x004 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( ". : : \xE2\x86\xb5") /* return arrow */ - PORT_CODE ( KEYCODE_STOP ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "2 DEF LIB") - PORT_CODE ( KEYCODE_2 ) - PORT_CODE ( KEYCODE_2_PAD ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "5 MATRICES STAT") - PORT_CODE ( KEYCODE_5 ) - PORT_CODE ( KEYCODE_5_PAD ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "8 EXP&LN TRIG") - PORT_CODE ( KEYCODE_8 ) - PORT_CODE ( KEYCODE_8_PAD ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "X \xE2\x89\xA4 < X") /* <= */ - PORT_CODE ( KEYCODE_X ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "SIN ASIN \xE2\x88\x91 S") /* sum */ - PORT_CODE ( KEYCODE_S ) - - PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "EQW MTRW ' O") - PORT_CODE ( KEYCODE_O ) - - PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "VAR UPDIR COPY J") - PORT_CODE ( KEYCODE_J ) - - PORT_BIT ( 0x7f00, 0, IPT_UNUSED ) - - - PORT_START( "LINE3" ) /* OUT = 0x008 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "0 \xE2\x88\x9E \xE2\x86\x92") /* infinity, right arrow */ - PORT_CODE ( KEYCODE_0 ) - PORT_CODE ( KEYCODE_0_PAD ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "1 ARITH CMPLX") - PORT_CODE ( KEYCODE_1 ) - PORT_CODE ( KEYCODE_1_PAD ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "4 CALC ALG") - PORT_CODE ( KEYCODE_4 ) - PORT_CODE ( KEYCODE_4_PAD ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "7 SSLV NUMSLV") - PORT_CODE ( KEYCODE_7 ) - PORT_CODE ( KEYCODE_7_PAD ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "+/- \xE2\x89\xA0 = W") /* =/ */ - PORT_CODE ( KEYCODE_W ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x88\x9A x^2 sqrt(x,y) R") /* square root */ - PORT_CODE ( KEYCODE_R ) - - PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "CAT PRG CHARS N") - PORT_CODE ( KEYCODE_N ) - - PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "TOOL i | I") - PORT_CODE ( KEYCODE_I ) - - PORT_BIT ( 0x7f00, 0, IPT_UNUSED ) - - - PORT_START( "LINE4" ) /* OUT = 0x010 */ - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "EEX 10^x LOG V") - PORT_CODE ( KEYCODE_V ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "y^x e^x LN Q") - PORT_CODE ( KEYCODE_Q ) - - PORT_BIT ( 64, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "HIST CMD UNDO M") - PORT_CODE ( KEYCODE_M ) - - PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "MODE CUSTOM END H") - PORT_CODE ( KEYCODE_H ) - - PORT_BIT ( 0x7f0f, 0, IPT_UNUSED ) - - - PORT_START( "LINE5" ) /* OUT = 0x020 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "F1 Y= A") - PORT_CODE ( KEYCODE_A ) - PORT_CODE ( KEYCODE_F1 ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "F2 WIN B") - PORT_CODE ( KEYCODE_B ) - PORT_CODE ( KEYCODE_F2 ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "F3 GRAPH C") - PORT_CODE ( KEYCODE_C ) - PORT_CODE ( KEYCODE_F3 ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "F4 2D/3D D") - PORT_CODE ( KEYCODE_D ) - PORT_CODE ( KEYCODE_F4 ) - - PORT_BIT ( 16, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "F5 TBLSET E") - PORT_CODE ( KEYCODE_E ) - PORT_CODE ( KEYCODE_F5 ) - - PORT_BIT ( 32, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "F6 TABLE F") - PORT_CODE ( KEYCODE_F ) - PORT_CODE ( KEYCODE_F6 ) - - PORT_BIT ( 128, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "APPS FILES BEGIN G") - PORT_CODE ( KEYCODE_G ) - - PORT_BIT ( 0x7f40, 0, IPT_UNUSED ) - - - PORT_START( "LINE6" ) /* OUT = 0x040 */ - - PORT_BIT ( 1, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x92") /* right arrow */ - PORT_CODE ( KEYCODE_RIGHT ) - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x93") /* down arrow */ - PORT_CODE ( KEYCODE_DOWN ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x90") /* left arrow */ - PORT_CODE ( KEYCODE_LEFT ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xE2\x86\x91") /* up arrow */ - PORT_CODE ( KEYCODE_UP ) - - PORT_BIT ( 0x7ff0, 0, IPT_UNUSED ) - - - PORT_START( "LINE7" ) /* OUT = 0x080 */ - - PORT_BIT ( 2, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "right shift") - PORT_CODE ( KEYCODE_RSHIFT ) - - PORT_BIT ( 4, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "left shift") - PORT_CODE ( KEYCODE_LSHIFT ) - - PORT_BIT ( 8, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "\xCE\xB1 USER ENTRY") /* alpha */ - PORT_CODE ( KEYCODE_LALT ) - - PORT_BIT ( 0x7ff1, 0, IPT_UNUSED ) - - - PORT_START( "LINE8" ) /* OUT = 0x100 */ - - PORT_BIT ( 0xffff, 0, IPT_UNUSED ) - - - PORT_START( "ON" ) /* ON key, appears on all OUT lines */ - - PORT_BIT ( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) - PORT_NAME ( "ON CONT OFF CANCEL" ) - PORT_CODE ( KEYCODE_ESC ) - PORT_CODE ( KEYCODE_HOME ) - - PORT_BIT ( 0x7fff, 0, IPT_UNUSED ) - -INPUT_PORTS_END - - - - -/* BATTERY - ------- - */ - -static INPUT_PORTS_START( hp48_battery ) - PORT_START( "BATTERY" ) - PORT_CONFNAME ( 0x03, 0, "Battery status" ) - PORT_CONFSETTING ( 0x00, DEF_STR( Normal ) ) - PORT_CONFSETTING ( 0x01, DEF_STR( Low ) ) - PORT_CONFSETTING ( 0x02, "Very low" ) -INPUT_PORTS_END - - - -/* MAIN - ----- - */ - -static INPUT_PORTS_START( hp48sx ) - PORT_INCLUDE( hp48sx_kbd ) - PORT_INCLUDE( hp48_battery ) -INPUT_PORTS_END - -static INPUT_PORTS_START( hp48gx ) - PORT_INCLUDE( hp48gx_kbd ) - PORT_INCLUDE( hp48_battery ) -INPUT_PORTS_END - -static INPUT_PORTS_START( hp49g ) - PORT_INCLUDE( hp49g_kbd ) - PORT_INCLUDE( hp48_battery ) -INPUT_PORTS_END - - - -/**************************** I/O **********************************/ - -//static const xmodem_config hp48_xmodem_rs232_conf = { &hp48_rs232_start_recv_byte }; -//static const kermit_config hp48_kermit_rs232_conf = { &hp48_rs232_start_recv_byte }; - - -/**************************** ROMs *********************************/ - -/* In ROMs, nibbles are packed into bytes, the lowest significant nibble in each byte - has the lowest address on the HP. - - Note that some ROMs you can find on the Internet has the reverse the two nibbles. - First byte should read 32 in hexa, not 23. - */ - - -/* These ROMS are common to the G, GX, and G+ models. - The ROM detects whether it runs a G or a GX by simply testing the memory: - if there are 32 KB (i.e., addresses wraps-around at 0x10000), it is a G; if there are - 128 KB, it is a GX. - When a G is detected, some specially optimized routines may be used (they use the fact that - no extension may be physically present). - The G+ model has always revision R. - */ -ROM_START ( hp48gx ) - ROM_REGION( 0x80000, "maincpu", 0 ) - ROM_DEFAULT_BIOS("r") - - /* in chronological order, from first revision, version r is default*/ - ROM_SYSTEM_BIOS( 0, "k", "Version K" ) - ROMX_LOAD( "gxrom-k", 0x00000, 0x80000, CRC(bdd5d2ee) SHA1(afa1498238e991b1e3d07fb8b4c227b115f7bcc1), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "l", "Version L" ) - ROMX_LOAD( "gxrom-l", 0x00000, 0x80000, CRC(70958e6b) SHA1(8eebac69ff804086247b989bf320e57a2d8a59a7), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS( 2, "m", "Version M" ) - ROMX_LOAD( "gxrom-m", 0x00000, 0x80000, CRC(e21a09e4) SHA1(09932d543594e459eeb94a79654168cd15e79a87), ROM_BIOS(3) ) - - /* there does not seem to exist an N revision? */ - - ROM_SYSTEM_BIOS( 3, "p", "Version P" ) - ROMX_LOAD( "gxrom-p", 0x00000, 0x80000, CRC(022d46df) SHA1(877a536865641f096212d1ce7296f580afbd6a2d), ROM_BIOS(4) ) - - ROM_SYSTEM_BIOS( 4, "r", "Version R" ) - ROMX_LOAD( "gxrom-r", 0x00000, 0x80000, CRC(00ee1a62) SHA1(5705fc9ea791916c4456ac35e22275862411db9b), ROM_BIOS(5) ) - -ROM_END - -#define rom_hp48g rom_hp48gx -#define rom_hp48gp rom_hp48gx - - -/* These ROMS are common to the S and SX models. - The only difference is that, the S being later, it was only shipped with revisions - E and later. - - (Note that G/GX revisions start at K, after the S/S revisions ends...) - */ - -ROM_START ( hp48sx ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_DEFAULT_BIOS("j") - - /* in chronological order, from first revision, version j is default*/ - ROM_SYSTEM_BIOS( 0, "a", "Version A" ) - ROMX_LOAD( "sxrom-a", 0x00000, 0x40000, CRC(a87696c7) SHA1(3271b103ad99254d069e20171beb418ace72cc90), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "b", "Version B" ) - ROMX_LOAD( "sxrom-b", 0x00000, 0x40000, CRC(034f6ce4) SHA1(acd256f2efee868ce402008f4131d94b312e60bc), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS( 2, "c", "Version C" ) - ROMX_LOAD( "sxrom-c", 0x00000, 0x40000, CRC(a9a0279d) SHA1(fee852d43ae6941d07a9d0d31f37e68e4f9051b1), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS( 3, "d", "Version D" ) - ROMX_LOAD( "sxrom-d", 0x00000, 0x40000, CRC(f8f5dc58) SHA1(3be5f895f4c731fd4c863237c7342cab4e8c42b1), ROM_BIOS(4) ) - - ROM_SYSTEM_BIOS( 4, "e", "Version E" ) - ROMX_LOAD( "sxrom-e", 0x00000, 0x40000, CRC(704ffa08) SHA1(0d498d135bf729c1d775cce522528837729e2e94), ROM_BIOS(5) ) - - ROM_SYSTEM_BIOS( 5, "j", "Version J" ) - ROMX_LOAD( "sxrom-j", 0x00000, 0x40000, CRC(1a6378ef) SHA1(5235f5379f1fd7edfe9bb6bf466b60d279163e73), ROM_BIOS(6) ) - - /* no F, G, H, I revisions? */ - -ROM_END - -#define rom_hp48s rom_hp48sx - -ROM_START ( hp38g ) - ROM_REGION( 0x80000, "maincpu", 0 ) - ROM_LOAD( "hp38g.rom", 0x00000, 0x80000, CRC(31d9affc) SHA1(bab3f5907a16cbb087943fd77230514af8fd5ac0)) -ROM_END - -ROM_START ( hp39g ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "hp39g.rom", 0x00000, 0x100000, CRC(28268fdc) SHA1(57a2b19075fe60307a9affa79d8e7cb550c621c3)) -ROM_END - -ROM_START ( hp49g ) - ROM_REGION( 0x200000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "1.00", "Version C-1.00" ) - ROMX_LOAD( "hp49gv100.rom", 0x00000, 0x200000, CRC(64c9826a) SHA1(da25371b97d439fc0003cb786dba143ee2be9160), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "1.05", "Version C-1.05" ) - ROMX_LOAD( "hp49gv105.rom", 0x00000, 0x200000, CRC(cf777cac) SHA1(b1d063b6e95083799aa990e4a2718214a38a372f), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "1.10", "Version C-1.10" ) - ROMX_LOAD( "hp49gv110.rom", 0x00000, 0x200000, CRC(e391efbd) SHA1(d4abad60f38faf4cb2d2d97804a24f54589dfa10), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "1.16", "Version C-1.16" ) - ROMX_LOAD( "hp49gv116.rom", 0x00000, 0x200000, CRC(dcc0b39c) SHA1(46f64b4731f5964eb114060b733aab2b23b4180c), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "1.18", "Version C-1.18" ) - ROMX_LOAD( "hp49gv118.rom", 0x00000, 0x200000, CRC(73a6a195) SHA1(3f283fe15a64c5cbc8c1b1254e10965957f58a84), ROM_BIOS(5)) - ROM_SYSTEM_BIOS( 5, "1.19", "Version B-1.19-6" ) - ROMX_LOAD( "hp49gv119.rom", 0x00000, 0x200000, CRC(75218a18) SHA1(ec0f661f0aa7158d1f6df61f24410260b5324fa9), ROM_BIOS(6)) -ROM_END - -/**************************** memory *******************************/ - -/* In memory, nibbles are unpacked: one nibble at each address. - This is due to the way the SATURN emulation is done. - As a consequence only the 4 lower bits of each byte is used, the 4 higher - bits being zeros. - Another consequence is that ROMs must be unpacked before use. - - Because of the complex memory manager, actual address mapping is done at - run-time. - */ - -static ADDRESS_MAP_START ( hp48, AS_PROGRAM, 8, hp48_state ) - - AM_RANGE( 0x00000, 0xfffff ) AM_NOP /* configured at run-time */ - -ADDRESS_MAP_END - - - -/*************************** layout ********************************/ - -static const char layout_hp48gx[] = "hp48gx"; -static const char layout_hp48g [] = "hp48g"; -static const char layout_hp48gp[] = "hp48gp"; -static const char layout_hp48sx[] = "hp48sx"; -static const char layout_hp48s [] = "hp48s"; -static const char layout_hp49g [] = "hp49g"; - - -/*************************** driver ********************************/ - - -static MACHINE_CONFIG_START( hp48_common, hp48_state ) - - /* cpu */ - MCFG_CPU_ADD ( "maincpu", SATURN, 3937007 ) /* almost 4 MHz */ - MCFG_CPU_PROGRAM_MAP ( hp48) - MCFG_SATURN_CONFIG( WRITE32(hp48_state, hp48_reg_out), READ32(hp48_state, hp48_reg_in), - WRITELINE(hp48_state, hp48_mem_reset), WRITE32(hp48_state, hp48_mem_config), - WRITE32(hp48_state, hp48_mem_unconfig), READ32(hp48_state, hp48_mem_id), - WRITE32(hp48_state, hp48_mem_crc), WRITELINE(hp48_state, hp48_rsi) ) - - /* memory */ - MCFG_NVRAM_ADD_0FILL("nvram") - - /* video */ - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_REFRESH_RATE( 64 ) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_SIZE ( 131, 64 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 130, 0, 63 ) - MCFG_SCREEN_UPDATE_DRIVER(hp48_state, screen_update_hp48) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD( "palette", 256 ) /* monochrome, but with varying contrast and grayscale */ - MCFG_PALETTE_INIT_OWNER(hp48_state, hp48) - - /* sound */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "dac", DAC, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* 1-bit beeper */ -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( hp48gx, hp48_common ) - MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48gx ) - MCFG_DEFAULT_LAYOUT ( layout_hp48gx ) - - /* expansion ports */ - MCFG_HP48_PORT_ADD ( "port1", 0, HP48_CE2, 128*1024 ) - MCFG_HP48_PORT_ADD ( "port2", 1, HP48_NCE3, 4*1024*1024 ) - - /* serial I/O */ - //MCFG_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) - //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( hp48g, hp48_common ) - MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48g ) - MCFG_DEFAULT_LAYOUT ( layout_hp48g ) - - /* serial I/O */ - //MCFG_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) - //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( hp48gp, hp48_common ) - MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48gp ) - MCFG_DEFAULT_LAYOUT ( layout_hp48gp ) - - /* serial I/O */ - //MCFG_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) - //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( hp48sx, hp48_common ) - MCFG_CPU_MODIFY ( "maincpu" ) - MCFG_CPU_CLOCK ( 2000000 ) - MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48sx ) - MCFG_DEFAULT_LAYOUT ( layout_hp48sx ) - - /* expansion ports */ - MCFG_HP48_PORT_ADD ( "port1", 0, HP48_CE1, 128*1024) - MCFG_HP48_PORT_ADD ( "port2", 1, HP48_CE2, 128*1024) - - /* serial I/O */ - //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( hp48s, hp48_common ) - MCFG_CPU_MODIFY ( "maincpu" ) - MCFG_CPU_CLOCK ( 2000000 ) - MCFG_MACHINE_START_OVERRIDE (hp48_state, hp48s ) - MCFG_DEFAULT_LAYOUT ( layout_hp48s ) - - /* serial I/O */ - //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( hp49g, hp48_common ) - MCFG_CPU_MODIFY ( "maincpu" ) - MCFG_MACHINE_START_OVERRIDE (hp48_state, hp49g ) - MCFG_DEFAULT_LAYOUT ( layout_hp49g ) - - /* serial I/O */ - //MCFG_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) - //MCFG_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) -MACHINE_CONFIG_END - - -COMP ( 1990, hp48sx, 0 , 0, hp48sx, hp48sx, hp48_state, hp48, "Hewlett Packard", "HP48SX", 0 ) -COMP ( 1991, hp48s , hp48sx, 0, hp48s, hp48sx, hp48_state, hp48, "Hewlett Packard", "HP48S", 0 ) -COMP ( 1993, hp48gx, 0 , 0, hp48gx, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP48GX", 0 ) -COMP ( 1993, hp48g , hp48gx, 0, hp48g, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP48G", 0 ) -COMP ( 1998, hp48gp, hp48gx, 0, hp48gp, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP48G+", 0 ) -COMP ( 1999, hp49g , 0, 0, hp49g, hp49g, hp48_state, hp48, "Hewlett Packard", "HP49G", 0 ) -COMP ( 1995, hp38g , 0, 0, hp48g, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP38G", 0 ) -COMP ( 2000, hp39g , 0, 0, hp48g, hp48gx, hp48_state, hp48, "Hewlett Packard", "HP39G", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/hp49gp.c b/src/mess/drivers/hp49gp.c deleted file mode 100644 index dafdf563516..00000000000 --- a/src/mess/drivers/hp49gp.c +++ /dev/null @@ -1,337 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/******************************************************************************* - - Hewlett Packard 49G+ Graphing Calculator - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "machine/s3c2410.h" -#include "rendlay.h" - -#define VERBOSE_LEVEL ( 0 ) - -struct lcd_spi_t -{ - int l1; - int data; - int l3; - UINT32 shift, bits; -}; - -class hp49gp_state : public driver_device -{ -public: - hp49gp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_s3c2410(*this, "s3c2410"), - m_steppingstone(*this, "steppingstone"), - m_maincpu(*this, "maincpu") { } - - UINT32 m_port[9]; - required_device m_s3c2410; - required_shared_ptr m_steppingstone; - lcd_spi_t m_lcd_spi; - DECLARE_DRIVER_INIT(hp49gp); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(port_changed); - DECLARE_READ32_MEMBER(s3c2410_gpio_port_r); - DECLARE_WRITE32_MEMBER(s3c2410_gpio_port_w); - inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); - void lcd_spi_reset( ); - void lcd_spi_init( ); - void lcd_spi_line_w( int line, int data); - int lcd_spi_line_r( int line); - required_device m_maincpu; -}; - -/*************************************************************************** - MACHINE HARDWARE -***************************************************************************/ - -// LCD SPI - -enum -{ - LCD_SPI_LINE_1, - LCD_SPI_LINE_DATA, - LCD_SPI_LINE_3 -}; - -inline void hp49gp_state::verboselog(int n_level, const char *s_fmt, ...) -{ - if (VERBOSE_LEVEL >= n_level) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt); - vsprintf( buf, s_fmt, v); - va_end( v); - logerror( "%s: %s", machine().describe_context( ), buf); - } -} - -void hp49gp_state::lcd_spi_reset( ) -{ - verboselog( 5, "lcd_spi_reset\n"); - m_lcd_spi.l1 = 0; - m_lcd_spi.data = 0; - m_lcd_spi.l3 = 0; -} - -void hp49gp_state::lcd_spi_init( ) -{ - verboselog( 5, "lcd_spi_init\n"); - lcd_spi_reset(); -} - -void hp49gp_state::lcd_spi_line_w( int line, int data) -{ - switch (line) - { - case LCD_SPI_LINE_1 : - { - if (data != m_lcd_spi.l1) - { - if (data == 0) - { - m_lcd_spi.shift = 0; - m_lcd_spi.bits = 0; - } - verboselog( 5, "LCD_SPI_LINE_1 <- %d\n", data); - m_lcd_spi.l1 = data; - } - } - break; - case LCD_SPI_LINE_DATA : - { - if (data != m_lcd_spi.data) - { - verboselog( 5, "LCD_SPI_LINE_DATA <- %d\n", data); - m_lcd_spi.data = data; - } - } - break; - case LCD_SPI_LINE_3 : - { - if (data != m_lcd_spi.l3) - { - if ((data != 0) && (m_lcd_spi.l1 == 0)) - { - verboselog( 5, "LCD SPI write bit %d\n", m_lcd_spi.data ? 1 : 0); - if (m_lcd_spi.bits < 8) - { - m_lcd_spi.shift = (m_lcd_spi.shift << 1) | (m_lcd_spi.data ? 1 : 0); - } - m_lcd_spi.bits++; - if (m_lcd_spi.bits == 8) - { - verboselog( 5, "LCD SPI write byte %02X\n", m_lcd_spi.shift); - } - else if (m_lcd_spi.bits == 9) - { - verboselog( 5, "LCD SPI write ack %d\n", (m_lcd_spi.data ? 1 : 0)); - } - } - verboselog( 5, "LCD_SPI_LINE_3 <- %d\n", data); - m_lcd_spi.l3 = data; - } - } - break; - } -} - -int hp49gp_state::lcd_spi_line_r( int line) -{ - switch (line) - { - case LCD_SPI_LINE_1 : - { - verboselog( 7, "LCD_SPI_LINE_1 -> %d\n", m_lcd_spi.l1); - return m_lcd_spi.l1; - } - case LCD_SPI_LINE_DATA : - { - verboselog( 7, "LCD_SPI_LINE_DATA -> %d\n", m_lcd_spi.data); - return m_lcd_spi.data; - } - case LCD_SPI_LINE_3 : - { - verboselog( 7, "LCD_SPI_LINE_3 -> %d\n", m_lcd_spi.l3); - return m_lcd_spi.l3; - } - } - return 0; -} - -// I/O PORT - -READ32_MEMBER(hp49gp_state::s3c2410_gpio_port_r) -{ - UINT32 data = m_port[offset]; - switch (offset) - { - case S3C2410_GPIO_PORT_C : - { - data = data | 0xF000; - } - break; - case S3C2410_GPIO_PORT_D : - { - data = data | 0x0008; - data = data & ~0x3200; - data |= (lcd_spi_line_r( LCD_SPI_LINE_1) ? 1 : 0) << 9; - data |= (lcd_spi_line_r( LCD_SPI_LINE_DATA) ? 1 : 0) << 12; - data |= (lcd_spi_line_r( LCD_SPI_LINE_3) ? 1 : 0) << 13; - } - break; - case S3C2410_GPIO_PORT_E : - { - data = data | 0xC000; - } - break; - case S3C2410_GPIO_PORT_F : - { - data = data | 0x0008; - } - break; - case S3C2410_GPIO_PORT_G : - { - data = data & ~0xFF00; - if ((data & 0x02) == 0) data |= (ioport( "ROW1")->read() << 8); - if ((data & 0x04) == 0) data |= (ioport( "ROW2")->read() << 8); - if ((data & 0x08) == 0) data |= (ioport( "ROW3")->read() << 8); - if ((data & 0x10) == 0) data |= (ioport( "ROW4")->read() << 8); - if ((data & 0x20) == 0) data |= (ioport( "ROW5")->read() << 8); - if ((data & 0x40) == 0) data |= (ioport( "ROW6")->read() << 8); - if ((data & 0x80) == 0) data |= (ioport( "ROW7")->read() << 8); - } - break; - case S3C2410_GPIO_PORT_H : - { - data = (data | 0x0080) & ~0x0040; - } - break; - } - return data; -} - -WRITE32_MEMBER(hp49gp_state::s3c2410_gpio_port_w) -{ - m_port[offset] = data; - switch (offset) - { - case S3C2410_GPIO_PORT_D : - { - lcd_spi_line_w( LCD_SPI_LINE_1, BIT( data, 9) ? 1 : 0); - lcd_spi_line_w( LCD_SPI_LINE_DATA, BIT( data, 12) ? 1 : 0); - lcd_spi_line_w( LCD_SPI_LINE_3, BIT( data, 13) ? 1 : 0); - } - break; - } -} - -// ... - -INPUT_CHANGED_MEMBER(hp49gp_state::port_changed) -{ - m_s3c2410->s3c2410_request_eint( (FPTR)param + 8); -} - -// ... - -void hp49gp_state::machine_start() -{ -} - -void hp49gp_state::machine_reset() -{ - m_maincpu->reset(); -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( hp49gp_map, AS_PROGRAM, 32, hp49gp_state ) - AM_RANGE(0x00000000, 0x001fffff) AM_ROM - AM_RANGE(0x08000000, 0x0801ffff) AM_RAM - AM_RANGE(0x08020000, 0x0803ffff) AM_RAM - AM_RANGE(0x08040000, 0x0807ffff) AM_RAM - AM_RANGE(0x40000000, 0x40000fff) AM_RAM AM_SHARE("steppingstone") -ADDRESS_MAP_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -DRIVER_INIT_MEMBER(hp49gp_state,hp49gp) -{ - UINT8 *rom = (UINT8 *)memregion( "maincpu")->base(); - memcpy( m_steppingstone, rom, 1024); - lcd_spi_init(); -} - -static MACHINE_CONFIG_START( hp49gp, hp49gp_state ) - MCFG_CPU_ADD("maincpu", ARM9, 400000000) - MCFG_CPU_PROGRAM_MAP(hp49gp_map) - - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(160, 85) - MCFG_SCREEN_VISIBLE_AREA(0, 131 - 1, 0, 80 - 1) - MCFG_SCREEN_UPDATE_DEVICE("s3c2410", s3c2410_device, screen_update) - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - - MCFG_DEVICE_ADD("s3c2410", S3C2410, 12000000) - MCFG_S3C2410_PALETTE("palette") - MCFG_S3C2410_GPIO_PORT_R_CB(READ32(hp49gp_state, s3c2410_gpio_port_r)) - MCFG_S3C2410_GPIO_PORT_W_CB(WRITE32(hp49gp_state, s3c2410_gpio_port_w)) - MCFG_S3C2410_LCD_FLAGS(S3C24XX_INTERFACE_LCD_REVERSE) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( hp49gp ) - PORT_START("ROW1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)1) PORT_NAME("F1 | A | Y=") PORT_CODE(KEYCODE_F1) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("ROW2") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)2) PORT_NAME("F2 | B | WIN") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("ROW3") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)3) PORT_NAME("F3 | C | GRAPH") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("ROW4") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)4) PORT_NAME("F4 | D | 2D/3D") PORT_CODE(KEYCODE_F4) - PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("ROW5") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)5) PORT_NAME("F5 | E | TBLSET") PORT_CODE(KEYCODE_F5) - PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("ROW6") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)6) PORT_NAME("F6 | F | TABLE") PORT_CODE(KEYCODE_F6) - PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("ROW7") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, hp49gp_state, port_changed, (void *)7) PORT_NAME("APPS | G | FILES | BEGIN") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0xDF, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -ROM_START( hp49gp ) - ROM_REGION( 0x200000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "319", "Version 3.19" ) - ROMX_LOAD( "319.bin", 0x0000, 0x4000, CRC(6bb5ebfb) SHA1(089c4e4ee7223b489e2f06c30aab0b89131d1c3c), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "315", "Version 3.15.04" ) - ROMX_LOAD( "31504.bin", 0x0000, 0x4000, CRC(9c71825e) SHA1(0a12b2b70a8573bc90ab5be06e6b2f814b8544ae), ROM_BIOS(2) ) -ROM_END - -COMP(2009, hp49gp, 0, 0, hp49gp, hp49gp, hp49gp_state, hp49gp, "Hewlett Packard", "HP49G+", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/hp64k.c b/src/mess/drivers/hp64k.c deleted file mode 100644 index e56ce89f62b..00000000000 --- a/src/mess/drivers/hp64k.c +++ /dev/null @@ -1,1424 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:F. Ulivi -// -// *************************************** -// Driver for HP 64000 development system -// *************************************** -// -// Documentation used for this driver: -// [1] HP, manual 64100-90910, dec 83 rev. - Model 64100A mainframe service manual -// [2] HP, manual 64941-90902, apr 83 rev. - Model 64941A Flexible disc (Floppy) drive -// controller service manual -// -// A 64100A system ("mainframe" in HP docs) is built around a 13 slot card cage. -// The first 4 slots are reserved for specific card types: -// J1 I/O card -// J2 Display and RAM card -// J3 CPU card -// J4 Floppy interface card -// -// The rest of the slots are for CPU emulators, logic analyzers and so on (i.e. those -// cards doing the main functions of a development system). -// This driver emulates the first 4 cards only. -// -// All cards are interconnected by 2 separate buses originating from the CPU: -// memory (16-bit data & 16-bit addresses) and I/O (16-bit data and 6-bit addresses) buses. -// The addresses on I/O bus are split in a 4-bit PA (peripheral address) and a 2-bit IC -// (register address). See also HP_MAKE_IOADDR. -// For the address mapping on the memory bus see [1] pg 229. -// Reading the schematics is complicated by the fact that all data & address -// lines of the buses are inverted. -// -// A brief description of each emulated card follows. -// -// ********** -// CPU card (64100-66521 or 64100-66532) -// -// This board holds the HP custom CPU with its massive heatsink, the BIOS roms and little else. -// U30 5061-3011 HP "hybrid" CPU @ 6.25 MHz -// U8 -// U9 -// U10 -// U11 -// U18 -// U19 -// U20 -// U21 2732 16kw of BIOS EPROMs -// -// ********** -// I/O card (64100-66520) -// -// This board has most of the I/O circuits of the system. -// It interfaces: -// - Keyboard -// - RS232 line -// - IEEE-488/HP-IB bus -// - Miscellaneous peripherals (watchdog, beeper, interrupt registers, option DIP switches) -// -// Emulation of beeper sound is far from correct: it should be a 2500 Hz tone inside an -// exponentially decaying envelope (a bell sound) whereas in the emulation it's inside a -// simple rectangular envelope. -// -//*U20 HP "PHI" Custom HP-IB interface microcontroller -// U28 i8251 RS232 UART -// -// ********** -// Display card (64100-66530) -// -// This card has the main DRAM of the system (64 kw) and the CRT controller that generates -// the video image. -// The framebuffer is stored in the main DRAM starting at a fixed location (0xf9f0) and it is -// fed into the CRTC by a lot of discrete TTL ICs. The transfer of framebuffer from DRAM to -// CRTC is designed to refresh the whole DRAM in parallel. For some mysterious reason the first -// display row is always blanked (its 40 words of RAM are even used for the stack!). -// -// U33 i8275 CRT controller -// U60 2716 Character generator ROM -// U23-U30 -// U38-U45 HM4864 64 kw of DRAM -// -// ********** -// Floppy I/F card (64941-66501) -// -// This card is optional. It interfaces 2 5.25" double-side double-density floppy drives. -// The interfacing between the 16-bit CPU and the 8-bit FDC (WD1791) is quite complex. It is -// based around a FSM that sequences the access of DMA or CPU to FDC. This FSM is implemented -// by 2 small PROMs for which no dump (AFAIK) is available. -// I tried to reverse engineer the FSM by looking at the schematics and applying some sensible -// assumptions. Then I did a sort of "clean room" re-implementation. It appears to work correctly. -// -// U4 FD1791A Floppy disk controller -// -// A brief summary of the reverse-engineered interface of this card follows. -// -// IC Content -// ========== -// 0 DMA transfers, all words in a block but the last one -// 1 Floppy I/F register, detailed below -// 2 DMA transfers, last word in a block -// 3 Diagnostic registers (not emulated) -// -// Floppy I/F register has 2 formats, one for writing and one for reading. -// Reading this register should always be preceded by a write that starts -// the read operation (bit 11 = 0: see below). -// -// Floppy I/F register format when writing: -// Bit Content -// =========== -// 15 Clear interrupts (1) -// 14 Direction of DMA transfers (1 = write to FDC, 0 = read from FDC) -// 13 DMA enable (1) -// 12 Reset FDC (1) -// 11 Direction of access to FDC/drive control (1 = write, 0 = read) -// 10 Access to either FDC (1) or drive control (0): this selects the -// content of lower byte (both when writing and reading) -// 9 ~A1 signal of FDC -// 8 ~A0 signal of FDC -// -// 7-0 FDC data (when bit 10 = 1) -// 7-0 Drive control (when bit 10 = 0) -// -// Floppy I/F register format when reading: -// Bit Content -// =========== -// 15 Interrupt from FDC pending (1) -// 14 Interrupt from DMA pending (1) -// 13 Drive 1 media changed (1) -// 12 Drive 1 write protected (1) -// 11 Drive 1 ready (0) -// 10 Drive 0 media changed (1) -// 9 Drive 0 write protected (1) -// 8 Drive 0 ready (0) -// -// 7-0 FDC data (when bit 10 = 1) -// 7-0 Drive control (when bit 10 = 0) -// -// Drive control register -// Bit Content -// =========== -// 7 Floppy side selection -// 6 N/U -// 5 Reset drive 1 media change (1) -// 4 Enable drive 1 motor (0) -// 3 Enable drive 1 (0) -// 2 Reset drive 0 media change (1) -// 1 Enable drive 0 motor (0) -// 0 Enable drive 0 (0) -// -// -// ICs that are not emulated yet are marked with "*" -// - -#include "emu.h" -#include "cpu/hphybrid/hphybrid.h" -#include "video/i8275.h" -#include "machine/wd_fdc.h" -#include "machine/74123.h" -#include "machine/rescap.h" -#include "sound/beep.h" -#include "machine/com8116.h" -#include "machine/i8251.h" -#include "bus/rs232/rs232.h" - -#define BIT_MASK(n) (1U << (n)) - -// Macros to clear/set single bits -#define BIT_CLR(w , n) ((w) &= ~BIT_MASK(n)) -#define BIT_SET(w , n) ((w) |= BIT_MASK(n)) - -class hp64k_state : public driver_device -{ -public: - hp64k_state(const machine_config &mconfig, device_type type, const char *tag); - - virtual void driver_start(); - //virtual void machine_start(); - virtual void video_start(); - virtual void machine_reset(); - - UINT8 hp64k_crtc_filter(UINT8 data); - DECLARE_WRITE16_MEMBER(hp64k_crtc_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_crtc_drq_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_crtc_vrtc_w); - - I8275_DRAW_CHARACTER_MEMBER(crtc_display_pixels); - - DECLARE_READ16_MEMBER(hp64k_rear_sw_r); - - IRQ_CALLBACK_MEMBER(hp64k_irq_callback); - void hp64k_update_irl(void); - DECLARE_WRITE16_MEMBER(hp64k_irl_mask_w); - - TIMER_DEVICE_CALLBACK_MEMBER(hp64k_kb_scan); - DECLARE_READ16_MEMBER(hp64k_kb_r); - - TIMER_DEVICE_CALLBACK_MEMBER(hp64k_line_sync); - DECLARE_READ16_MEMBER(hp64k_deltat_r); - DECLARE_WRITE16_MEMBER(hp64k_deltat_w); - - DECLARE_READ16_MEMBER(hp64k_slot_r); - DECLARE_WRITE16_MEMBER(hp64k_slot_w); - DECLARE_WRITE16_MEMBER(hp64k_slot_sel_w); - - DECLARE_READ16_MEMBER(hp64k_flp_r); - DECLARE_WRITE16_MEMBER(hp64k_flp_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_flp_drq_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_flp_intrq_w); - void hp64k_update_floppy_dma(void); - void hp64k_update_floppy_irq(void); - void hp64k_update_drv_ctrl(void); - DECLARE_WRITE8_MEMBER(hp64k_floppy0_rdy); - DECLARE_WRITE8_MEMBER(hp64k_floppy1_rdy); - void hp64k_floppy_idx_cb(floppy_image_device *floppy , int state); - void hp64k_floppy_wpt_cb(floppy_image_device *floppy , int state); - - DECLARE_READ16_MEMBER(hp64k_usart_r); - DECLARE_WRITE16_MEMBER(hp64k_usart_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_rxrdy_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_txrdy_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_txd_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_dtr_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_rts_w); - DECLARE_WRITE16_MEMBER(hp64k_loopback_w); - void hp64k_update_loopback(void); - DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_rxd_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_dcd_w); - DECLARE_WRITE_LINE_MEMBER(hp64k_rs232_cts_w); - - DECLARE_WRITE16_MEMBER(hp64k_beep_w); - TIMER_DEVICE_CALLBACK_MEMBER(hp64k_beeper_off); - - DECLARE_WRITE_LINE_MEMBER(hp64k_baud_clk_w); -private: - required_device m_cpu; - required_device m_crtc; - required_device m_palette; - required_ioport m_io_key0; - required_ioport m_io_key1; - required_ioport m_io_key2; - required_ioport m_io_key3; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_ss0; - required_device m_ss1; - required_ioport m_rear_panel_sw; - required_ioport m_rs232_sw; - required_device m_beeper; - required_device m_beep_timer; - required_device m_baud_rate; - required_ioport m_s5_sw; - required_device m_uart; - required_device m_rs232; - - // Character generator - const UINT8 *m_chargen; - - UINT32 m_crtc_ptr; - bool m_crtc_drq; - bool m_vrtc; - - // Interrupt handling - UINT8 m_irl_mask; - UINT8 m_irl_pending; - - // State of keyboard - ioport_value m_kb_state[ 4 ]; - UINT8 m_kb_row_col; - bool m_kb_scan_on; - bool m_kb_pressed; - - // Slot selection - std::vector m_low32k_ram; - UINT8 m_slot_select; - UINT8 m_slot_map; - - // Floppy I/F - UINT8 m_floppy_in_latch_msb; // U23 - UINT8 m_floppy_in_latch_lsb; // U38 - UINT8 m_floppy_out_latch_msb; // U22 - UINT8 m_floppy_out_latch_lsb; // U37 - UINT8 m_floppy_if_ctrl; // U24 - bool m_floppy_dmaen; - bool m_floppy_dmai; - bool m_floppy_mdci; - bool m_floppy_intrq; - bool m_floppy_drq; - bool m_floppy0_wpt; - bool m_floppy1_wpt; - UINT8 m_floppy_drv_ctrl; // U39 - UINT8 m_floppy_status; // U25 - - typedef enum { - HP64K_FLPST_IDLE, - HP64K_FLPST_DMAWR1, - HP64K_FLPST_DMAWR2, - HP64K_FLPST_DMARD1, - HP64K_FLPST_DMARD2 - } floppy_state_t; - - floppy_state_t m_floppy_if_state; - floppy_image_device *m_current_floppy; - - // RS232 I/F - bool m_16x_clk; - bool m_baud_clk; - UINT8 m_16x_div; - bool m_loopback; - bool m_txd_state; - bool m_dtr_state; - bool m_rts_state; -}; - -static ADDRESS_MAP_START(cpu_mem_map , AS_PROGRAM , 16 , hp64k_state) - AM_RANGE(0x0000 , 0x3fff) AM_ROM - AM_RANGE(0x4000 , 0x7fff) AM_READWRITE(hp64k_slot_r , hp64k_slot_w) - AM_RANGE(0x8000 , 0x8001) AM_WRITE(hp64k_crtc_w) - AM_RANGE(0x8002 , 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(cpu_io_map , AS_IO , 16 , hp64k_state) - // PA = 0, IC = [0..3] - // Keyboard input - AM_RANGE(HP_MAKE_IOADDR(0 , 0) , HP_MAKE_IOADDR(0 , 3)) AM_READ(hp64k_kb_r) - // PA = 2, IC = [0..3] - // Line sync interrupt clear/watchdog reset - AM_RANGE(HP_MAKE_IOADDR(2 , 0) , HP_MAKE_IOADDR(2 , 3)) AM_READWRITE(hp64k_deltat_r , hp64k_deltat_w) - // PA = 4, IC = [0..3] - // Floppy I/F - AM_RANGE(HP_MAKE_IOADDR(4 , 0) , HP_MAKE_IOADDR(4 , 3)) AM_READWRITE(hp64k_flp_r , hp64k_flp_w) - // PA = 5, IC = [0..3] - // Write to USART - AM_RANGE(HP_MAKE_IOADDR(5 , 0) , HP_MAKE_IOADDR(5 , 3)) AM_WRITE(hp64k_usart_w) - // PA = 6, IC = [0..3] - // Read from USART - AM_RANGE(HP_MAKE_IOADDR(6 , 0) , HP_MAKE_IOADDR(6 , 3)) AM_READ(hp64k_usart_r) - // PA = 7, IC = 2 - // Rear-panel switches and loopback relay control - AM_RANGE(HP_MAKE_IOADDR(7 , 2) , HP_MAKE_IOADDR(7 , 2)) AM_READWRITE(hp64k_rear_sw_r , hp64k_loopback_w) - // PA = 9, IC = [0..3] - // Beeper control & interrupt status read - AM_RANGE(HP_MAKE_IOADDR(9 , 0) , HP_MAKE_IOADDR(9 , 3)) AM_WRITE(hp64k_beep_w) - // PA = 10, IC = [0..3] - // Slot selection - AM_RANGE(HP_MAKE_IOADDR(10 , 0) , HP_MAKE_IOADDR(10 , 3)) AM_WRITE(hp64k_slot_sel_w) - // PA = 12, IC = [0..3] - // Interrupt mask - AM_RANGE(HP_MAKE_IOADDR(12 , 0) , HP_MAKE_IOADDR(12 , 3)) AM_WRITE(hp64k_irl_mask_w) -ADDRESS_MAP_END - -hp64k_state::hp64k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig , type , tag), - m_cpu(*this , "cpu"), - m_crtc(*this , "crtc"), - m_palette(*this , "palette"), - m_io_key0(*this , "KEY0"), - m_io_key1(*this , "KEY1"), - m_io_key2(*this , "KEY2"), - m_io_key3(*this , "KEY3"), - m_fdc(*this , "fdc"), - m_floppy0(*this , "fdc:0"), - m_floppy1(*this , "fdc:1"), - m_ss0(*this , "fdc_rdy0"), - m_ss1(*this , "fdc_rdy1"), - m_rear_panel_sw(*this , "rear_sw"), - m_rs232_sw(*this , "rs232_sw"), - m_beeper(*this , "beeper"), - m_beep_timer(*this , "beep_timer"), - m_baud_rate(*this , "baud_rate"), - m_s5_sw(*this , "s5_sw"), - m_uart(*this , "uart"), - m_rs232(*this , "rs232") -{ -} - -void hp64k_state::driver_start() -{ - // 32kW for lower RAM - m_low32k_ram.resize(0x8000); -} - -void hp64k_state::video_start() -{ - m_chargen = memregion("chargen")->base(); -} - -void hp64k_state::machine_reset() -{ - m_crtc_drq = false; - m_vrtc = false; - m_crtc_ptr = 0; - m_irl_mask = 0; - m_irl_pending = 0; - memset(&m_kb_state[ 0 ] , 0 , sizeof(m_kb_state)); - m_kb_row_col = 0; - m_kb_scan_on = true; - m_slot_select = 0; - m_slot_map = 3; - m_floppy_if_ctrl = ~0; - m_floppy_dmaen = false; - m_floppy_dmai = false; - m_floppy_mdci = false; - m_floppy_intrq = false; - m_floppy_drv_ctrl = ~0; - m_floppy_if_state = HP64K_FLPST_IDLE; - m_current_floppy = NULL; - m_floppy0_wpt = false; - m_floppy1_wpt = false; - m_beeper->set_state(0); - m_baud_rate->str_w((m_s5_sw->read() >> 1) & 0xf); - m_16x_clk = (m_rs232_sw->read() & 0x02) != 0; - m_loopback = false; - m_txd_state = true; - m_dtr_state = true; - m_rts_state = true; - -} - -UINT8 hp64k_state::hp64k_crtc_filter(UINT8 data) -{ - bool inv = (data & 0xe0) == 0xe0; - - return inv ? (data & 0xf2) : data; -} - -WRITE16_MEMBER(hp64k_state::hp64k_crtc_w) -{ - m_crtc->write(space , offset == 0 , hp64k_crtc_filter((UINT8)data)); -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_drq_w) -{ - bool crtc_drq = state != 0; - bool prev_crtc = m_crtc_drq; - m_crtc_drq = crtc_drq; - - if (!prev_crtc && crtc_drq) { - address_space& prog_space = m_cpu->space(AS_PROGRAM); - - UINT8 data = prog_space.read_byte(m_crtc_ptr); - m_crtc_ptr++; - - m_crtc->dack_w(prog_space , 0 , hp64k_crtc_filter(data)); - } -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_vrtc_w) -{ - bool vrtc = state != 0; - - if (!m_vrtc && vrtc) { - m_crtc_ptr = 0xf9f0 << 1; - } - m_vrtc = vrtc; -} - -I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chargen_byte = m_chargen[ linecount | ((unsigned)charcode << 4) ]; - bool lvid , livid; - UINT16 pixels_lvid , pixels_livid; - unsigned i; - - if (vsp) { - pixels_lvid = pixels_livid = ~0; - } else if (lten) { - pixels_livid = ~0; - if (rvv) { - pixels_lvid = ~0; - } else { - pixels_lvid = 0; - } - } else if (rvv) { - pixels_lvid = ~0; - pixels_livid = (UINT16)chargen_byte << 1; - } else { - pixels_lvid = ~((UINT16)chargen_byte << 1); - pixels_livid = ~0; - } - - for (i = 0; i < 9; i++) { - lvid = (pixels_lvid & (1U << (8 - i))) != 0; - livid = (pixels_livid & (1U << (8 - i))) != 0; - - if (!lvid) { - // Normal brightness - bitmap.pix32(y , x + i) = palette[ 2 ]; - } else if (livid) { - // Black - bitmap.pix32(y , x + i) = palette[ 0 ]; - } else { - // Half brightness - bitmap.pix32(y , x + i) = palette[ 1 ]; - } - } - -} - -READ16_MEMBER(hp64k_state::hp64k_rear_sw_r) -{ - return m_rear_panel_sw->read() | 0x0020; -} - -IRQ_CALLBACK_MEMBER(hp64k_state::hp64k_irq_callback) -{ - if (irqline == HPHYBRID_IRL) { - return 0xff00 | (m_irl_mask & m_irl_pending); - } else { - return ~0; - } -} - -void hp64k_state::hp64k_update_irl(void) -{ - m_cpu->set_input_line(HPHYBRID_IRL , (m_irl_mask & m_irl_pending) != 0); -} - -WRITE16_MEMBER(hp64k_state::hp64k_irl_mask_w) -{ - m_irl_mask = (UINT8)data; - hp64k_update_irl(); -} - -TIMER_DEVICE_CALLBACK_MEMBER(hp64k_state::hp64k_kb_scan) -{ - if (m_kb_scan_on) { - unsigned i; - - ioport_value input[ 4 ]; - input[ 0 ] = m_io_key0->read(); - input[ 1 ] = m_io_key1->read(); - input[ 2 ] = m_io_key2->read(); - input[ 3 ] = m_io_key3->read(); - - for (i = 0; i < 128; i++) { - if (++m_kb_row_col >= 128) { - m_kb_row_col = 0; - } - - ioport_value mask = BIT_MASK(m_kb_row_col & 0x1f); - unsigned idx = m_kb_row_col >> 5; - - if ((input[ idx ] ^ m_kb_state[ idx ]) & mask) { - // key changed state - m_kb_state[ idx ] ^= mask; - m_kb_pressed = (m_kb_state[ idx ] & mask) != 0; - m_kb_scan_on = false; - BIT_SET(m_irl_pending , 0); - hp64k_update_irl(); - break; - } - } - } -} - -READ16_MEMBER(hp64k_state::hp64k_kb_r) -{ - UINT16 ret = 0xff00 | m_kb_row_col; - - if (m_kb_pressed) { - BIT_SET(ret , 7); - } - - m_kb_scan_on = true; - BIT_CLR(m_irl_pending , 0); - hp64k_update_irl(); - - return ret; -} - -TIMER_DEVICE_CALLBACK_MEMBER(hp64k_state::hp64k_line_sync) -{ - BIT_SET(m_irl_pending , 2); - hp64k_update_irl(); -} - -READ16_MEMBER(hp64k_state::hp64k_deltat_r) -{ - BIT_CLR(m_irl_pending , 2); - hp64k_update_irl(); - return 0; -} - -WRITE16_MEMBER(hp64k_state::hp64k_deltat_w) -{ - BIT_CLR(m_irl_pending , 2); - hp64k_update_irl(); -} - -READ16_MEMBER(hp64k_state::hp64k_slot_r) -{ - if (m_slot_select == 0x0a) { - // Slot 10 selected - // On this (fictional) slot is allocated the lower 32KW of RAM - - switch (m_slot_map) { - case 0: - // IDEN - // ID of 32KW RAM expansion - return 0x402; - - case 1: - // MAP1 - // Lower half of RAM - return m_low32k_ram[ offset ]; - - default: - // MAP2&3 - // Upper half of RAM - return m_low32k_ram[ offset + 0x4000 ]; - } - } else { - return 0; - } -} - -WRITE16_MEMBER(hp64k_state::hp64k_slot_w) -{ - if (m_slot_select == 0x0a && m_slot_map != 0) { - if (m_slot_map != 1) { - // MAP2&3 - offset += 0x4000; - } - m_low32k_ram[ offset ] &= ~mem_mask; - m_low32k_ram[ offset ] |= (data & mem_mask); - } -} - -WRITE16_MEMBER(hp64k_state::hp64k_slot_sel_w) -{ - m_slot_map = (UINT8)offset; - m_slot_select = (UINT8)((data >> 8) & 0x3f); -} - -READ16_MEMBER(hp64k_state::hp64k_flp_r) -{ - m_cpu->dmar_w(0); - - switch (offset) { - case 0: - // DMA transfer, not at TC - if (m_floppy_if_state == HP64K_FLPST_DMARD2) { - m_floppy_if_state = HP64K_FLPST_IDLE; - } else { - logerror("Read from IC=0 with floppy state %d\n" , m_floppy_if_state); - } - break; - - case 1: - if (m_floppy_if_state != HP64K_FLPST_IDLE) { - logerror("read from IC=1 with floppy state %d\n" , m_floppy_if_state); - } - break; - - case 2: - // DMA transfer, at TC - if (m_floppy_if_state == HP64K_FLPST_DMARD2) { - m_floppy_if_state = HP64K_FLPST_IDLE; - m_floppy_dmaen = false; - m_floppy_dmai = true; - } else { - logerror("Read from IC=2 with floppy state %d\n" , m_floppy_if_state); - } - break; - - default: - logerror("read from IC=%d\n" , offset); - } - - hp64k_update_floppy_irq(); - - return ((UINT16)m_floppy_out_latch_msb << 8) | (UINT16)m_floppy_out_latch_lsb; -} - -WRITE16_MEMBER(hp64k_state::hp64k_flp_w) -{ - m_cpu->dmar_w(0); - - if (offset == 3) { - return; - } - - m_floppy_in_latch_msb = (UINT8)(data >> 8); - m_floppy_in_latch_lsb = (UINT8)data; - - switch (offset) { - case 0: - // DMA transfer, not at TC - if (m_floppy_if_state == HP64K_FLPST_DMAWR1) { - m_fdc->data_w(~m_floppy_in_latch_msb); - m_floppy_if_state = HP64K_FLPST_DMAWR2; - } else { - logerror("write to IC=0 with floppy state %d\n" , m_floppy_if_state); - } - break; - - case 1: - if (m_floppy_if_state != HP64K_FLPST_IDLE) { - logerror("write to IC=1 with floppy state %d\n" , m_floppy_if_state); - } - // I/F control register - m_floppy_if_ctrl = m_floppy_in_latch_msb; - if (BIT(m_floppy_if_ctrl , 4)) { - // FDC reset - m_fdc->soft_reset(); - } - if (BIT(m_floppy_if_ctrl , 7)) { - // Interrupt reset - m_floppy_dmai = false; - m_floppy_mdci = false; - } - if (BIT(m_floppy_if_ctrl , 3)) { - // Write (to either FDC or drive control) - if (BIT(m_floppy_if_ctrl , 2)) { - // FDC - m_fdc->gen_w(~m_floppy_if_ctrl & 3 , ~m_floppy_in_latch_lsb); - } else { - // Drive control - m_floppy_drv_ctrl = m_floppy_in_latch_lsb; - hp64k_update_drv_ctrl(); - } - } else { - // Read - if (BIT(m_floppy_if_ctrl , 2)) { - // FDC - m_floppy_out_latch_lsb = ~m_fdc->gen_r(~m_floppy_if_ctrl & 3); - } else { - // Drive control - m_floppy_out_latch_lsb = m_floppy_drv_ctrl; - } - } - // MSB of output latch is always filled with status register - m_floppy_out_latch_msb = m_floppy_status; - m_floppy_dmaen = BIT(m_floppy_if_ctrl , 5) != 0; - hp64k_update_floppy_dma(); - break; - - case 2: - // DMA transfer, at TC - if (m_floppy_if_state == HP64K_FLPST_DMAWR1) { - m_fdc->data_w(~m_floppy_in_latch_msb); - m_floppy_if_state = HP64K_FLPST_DMAWR2; - m_floppy_dmaen = false; - m_floppy_dmai = true; - } else { - logerror("write to IC=2 with floppy state %d\n" , m_floppy_if_state); - } - break; - } - - hp64k_update_floppy_irq(); -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_flp_drq_w) -{ - m_floppy_drq = state; - hp64k_update_floppy_dma(); -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_flp_intrq_w) -{ - if (state && !m_floppy_intrq && !BIT(m_floppy_if_ctrl , 7)) { - m_floppy_mdci = true; - hp64k_update_floppy_irq(); - } - m_floppy_intrq = state; -} - -void hp64k_state::hp64k_update_floppy_dma(void) -{ - if (m_floppy_drq && (m_floppy_dmaen || m_floppy_if_state != HP64K_FLPST_IDLE)) { - switch (m_floppy_if_state) { - case HP64K_FLPST_IDLE: - if (BIT(m_floppy_if_ctrl , 6)) { - // DMA writes - m_cpu->dmar_w(1); - m_floppy_if_state = HP64K_FLPST_DMAWR1; - } else { - // DMA reads - m_floppy_out_latch_msb = ~m_fdc->data_r(); - m_floppy_if_state = HP64K_FLPST_DMARD1; - } - break; - - case HP64K_FLPST_DMAWR2: - m_fdc->data_w(~m_floppy_in_latch_lsb); - m_floppy_if_state = HP64K_FLPST_IDLE; - break; - - case HP64K_FLPST_DMARD1: - m_floppy_out_latch_lsb = ~m_fdc->data_r(); - m_cpu->dmar_w(1); - m_floppy_if_state = HP64K_FLPST_DMARD2; - break; - - default: - logerror("DRQ with floppy state %d\n" , m_floppy_if_state); - } - } -} - -void hp64k_state::hp64k_update_floppy_irq(void) -{ - if (m_floppy_dmai) { - BIT_SET(m_floppy_status , 6); - } else { - BIT_CLR(m_floppy_status , 6); - } - if (m_floppy_mdci) { - BIT_SET(m_floppy_status , 7); - } else { - BIT_CLR(m_floppy_status , 7); - } - - bool ir4 = m_floppy_dmai || m_floppy_mdci || - (BIT(m_floppy_status , 2) && !BIT(m_floppy_drv_ctrl , 0)) || - (BIT(m_floppy_status , 5) && !BIT(m_floppy_drv_ctrl , 3)); - - if (ir4) { - BIT_SET(m_irl_pending , 4); - } else { - BIT_CLR(m_irl_pending , 4); - } - - hp64k_update_irl(); -} - -void hp64k_state::hp64k_update_drv_ctrl(void) -{ - floppy_image_device *floppy0 = m_floppy0->get_device(); - floppy_image_device *floppy1 = m_floppy1->get_device(); - - floppy0->mon_w(BIT(m_floppy_drv_ctrl , 1)); - floppy1->mon_w(BIT(m_floppy_drv_ctrl , 4)); - floppy0->ss_w(!BIT(m_floppy_drv_ctrl , 7)); - floppy1->ss_w(!BIT(m_floppy_drv_ctrl , 7)); - - if (BIT(m_floppy_drv_ctrl , 2)) { - BIT_CLR(m_floppy_status , 2); - } - if (BIT(m_floppy_drv_ctrl , 5)) { - BIT_CLR(m_floppy_status , 5); - } - hp64k_update_floppy_irq(); - - // Drive selection logic: - // m_floppy_drv_ctrl - // Bit 3 0 - Drive selected - // ======================== - // 0 0 - Invalid:both drives selected. Signals to/from drive 1 are routed to FDC anyway. - // 0 1 - Drive 1 - // 1 0 - Drive 0 - // 1 1 - None - floppy_image_device *new_drive; - - if (!BIT(m_floppy_drv_ctrl , 3)) { - new_drive = m_floppy1->get_device(); - } else if (!BIT(m_floppy_drv_ctrl , 0)) { - new_drive = m_floppy0->get_device(); - } else { - new_drive = NULL; - } - - if (new_drive != m_current_floppy) { - m_fdc->set_floppy(new_drive); - - floppy0->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(hp64k_state::hp64k_floppy_idx_cb) , this)); - floppy1->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(hp64k_state::hp64k_floppy_idx_cb) , this)); - - floppy0->setup_wpt_cb(floppy_image_device::wpt_cb(FUNC(hp64k_state::hp64k_floppy_wpt_cb) , this)); - floppy1->setup_wpt_cb(floppy_image_device::wpt_cb(FUNC(hp64k_state::hp64k_floppy_wpt_cb) , this)); - - m_current_floppy = new_drive; - } -} - -WRITE8_MEMBER(hp64k_state::hp64k_floppy0_rdy) -{ - if (data) { - BIT_CLR(m_floppy_status , 0); - } else { - BIT_SET(m_floppy_status , 0); - } -} - -WRITE8_MEMBER(hp64k_state::hp64k_floppy1_rdy) -{ - if (data) { - BIT_CLR(m_floppy_status , 3); - } else { - BIT_SET(m_floppy_status , 3); - } -} - -void hp64k_state::hp64k_floppy_idx_cb(floppy_image_device *floppy , int state) -{ - if (floppy == m_floppy0->get_device()) { - m_ss0->a_w(machine().driver_data()->generic_space() , 0 , !state); - } else if (floppy == m_floppy1->get_device()) { - m_ss1->a_w(machine().driver_data()->generic_space() , 0 , !state); - } - - if (floppy == m_current_floppy) { - m_fdc->index_callback(floppy , state); - } -} - -void hp64k_state::hp64k_floppy_wpt_cb(floppy_image_device *floppy , int state) -{ - if (floppy == m_floppy0->get_device()) { - logerror("floppy0_wpt %d\n" , state); - if (m_floppy0_wpt && !state) { - BIT_SET(m_floppy_status , 2); - hp64k_update_floppy_irq(); - } - if (state) { - BIT_SET(m_floppy_status, 1); - } else { - BIT_CLR(m_floppy_status, 1); - } - m_floppy0_wpt = state; - } else if (floppy == m_floppy1->get_device()) { - logerror("floppy1_wpt %d\n" , state); - if (m_floppy1_wpt && !state) { - BIT_SET(m_floppy_status , 5); - hp64k_update_floppy_irq(); - } - if (state) { - BIT_SET(m_floppy_status, 4); - } else { - BIT_CLR(m_floppy_status, 4); - } - m_floppy1_wpt = state; - } -} - -READ16_MEMBER(hp64k_state::hp64k_usart_r) -{ - UINT16 tmp; - - if ((offset & 1) == 0) { - tmp = m_uart->status_r(space , 0); - } else { - tmp = m_uart->data_r(space , 0); - } - - // bit 8 == bit 7 rear panel switches (modem/terminal) ??? - - tmp |= (m_rs232_sw->read() << 8); - - if (BIT(m_rear_panel_sw->read() , 7)) { - BIT_SET(tmp , 8); - } - - return tmp; -} - -WRITE16_MEMBER(hp64k_state::hp64k_usart_w) -{ - if ((offset & 1) == 0) { - m_uart->control_w(space , 0 , (UINT8)(data & 0xff)); - } else { - m_uart->data_w(space , 0 , (UINT8)(data & 0xff)); - } -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_rxrdy_w) -{ - if (state) { - BIT_SET(m_irl_pending , 6); - } else { - BIT_CLR(m_irl_pending , 6); - } - - hp64k_update_irl(); -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_txrdy_w) -{ - if (state) { - BIT_SET(m_irl_pending , 5); - } else { - BIT_CLR(m_irl_pending , 5); - } - - hp64k_update_irl(); -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_txd_w) -{ - m_txd_state = state; - if (m_loopback) { - m_uart->write_rxd(state); - } - m_rs232->write_txd(state); -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_dtr_w) -{ - m_dtr_state = state; - if (m_loopback) { - m_uart->write_dsr(state); - } - m_rs232->write_dtr(state); -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_rts_w) -{ - if (BIT(m_s5_sw->read() , 0)) { - // Full duplex, RTS/ = 0 - state = 0; - } - m_rts_state = state; - if (m_loopback) { - m_uart->write_cts(state); - } - m_rs232->write_rts(state); -} - -WRITE16_MEMBER(hp64k_state::hp64k_loopback_w) -{ - m_loopback = BIT(data , 11); - hp64k_update_loopback(); -} - -void hp64k_state::hp64k_update_loopback(void) -{ - if (m_loopback) { - m_uart->write_rxd(m_txd_state); - m_uart->write_dsr(m_dtr_state); - m_uart->write_cts(m_rts_state); - } else { - m_uart->write_rxd(m_rs232->rxd_r()); - m_uart->write_dsr(m_rs232->dcd_r()); - m_uart->write_cts(m_rs232->cts_r()); - } -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_rxd_w) -{ - if (!m_loopback) { - m_uart->write_rxd(state); - } -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_dcd_w) -{ - if (!m_loopback) { - m_uart->write_dsr(state); - } -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_rs232_cts_w) -{ - if (!m_loopback) { - m_uart->write_cts(state); - } -} - -WRITE16_MEMBER(hp64k_state::hp64k_beep_w) -{ - if (!BIT(offset , 0)) { - m_beeper->set_state(1); - // Duration is bogus: in the real hw envelope decays exponentially with RC=~136 ms - m_beep_timer->adjust(attotime::from_msec(130)); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(hp64k_state::hp64k_beeper_off) -{ - m_beeper->set_state(0); -} - -WRITE_LINE_MEMBER(hp64k_state::hp64k_baud_clk_w) -{ - if (!m_16x_clk) { - if (state && !m_baud_clk) { - m_16x_div++; - } - m_baud_clk = !!state; - state = BIT(m_16x_div , 3); - } - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - -static INPUT_PORTS_START(hp64k) - // Keyboard is arranged in a 8 x 16 matrix. Of the 128 possible positions, only 77 are used. - // For key arrangement on the matrix, see [1] pg 334 - // Keys are mapped on bit b of KEYn - // where b = (row & 1) << 4 + column, n = row >> 1 - // column = [0..15] - // row = [0..7] - PORT_START("KEY0") - PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_UNUSED) - - PORT_START("KEY1") - PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("RECALL") - PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("CLRLINE") - PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("CAPS") - PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_NAME("RESET") - PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("SK1") - PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("SK2") - PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("SK3") - PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("SK4") - PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("SK5") - PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("SK6") - PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("SK7") - PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("SK8") - PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_UNUSED) - - PORT_START("KEY2") - PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INSCHAR") - PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DELCHAR") - PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('_') PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("ROLLUP") - PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("NEXTPG") - - PORT_START("KEY3") - PORT_BIT(BIT_MASK(0) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(1) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(2) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(3) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(4) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(5) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(BIT_MASK(6) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(BIT_MASK(7) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(8) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(BIT_MASK(9) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(BIT_MASK(13) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(BIT_MASK(15) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(BIT_MASK(16) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(17) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(18) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(19) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(20) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(21) , IP_ACTIVE_HIGH , IPT_UNUSED) - PORT_BIT(BIT_MASK(22) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(BIT_MASK(27) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(BIT_MASK(28) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(BIT_MASK(29) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("ROLLDN") - PORT_BIT(BIT_MASK(30) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("PREVPG") - - PORT_START("rear_sw") - PORT_DIPNAME(0x8000 , 0x8000 , "E9-6 jumper") - PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) - PORT_DIPSETTING(0x8000 , DEF_STR(No)) - PORT_DIPNAME(0x4000 , 0x4000 , "E9-5 jumper") - PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) - PORT_DIPSETTING(0x4000 , DEF_STR(No)) - PORT_DIPNAME(0x2000 , 0x2000 , "E9-4 jumper") - PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) - PORT_DIPSETTING(0x2000 , DEF_STR(No)) - PORT_DIPNAME(0x1000 , 0x1000 , "E9-3 jumper") - PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) - PORT_DIPSETTING(0x1000 , DEF_STR(No)) - PORT_DIPNAME(0x0800 , 0x0800 , "E9-2 jumper") - PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) - PORT_DIPSETTING(0x0800 , DEF_STR(No)) - PORT_DIPNAME(0x0400 , 0x0400 , "E9-1 jumper") - PORT_DIPSETTING(0x0000 , DEF_STR(Yes)) - PORT_DIPSETTING(0x0400 , DEF_STR(No)) - PORT_DIPNAME(0x0018 , 0x0000 , "System source") - PORT_DIPLOCATION("S1:!7,!6") - PORT_DIPSETTING(0x0000 , "Sys bus") - PORT_DIPSETTING(0x0008 , "Local storage-talk only") - PORT_DIPSETTING(0x0010 , "Local storage-addressable") - PORT_DIPSETTING(0x0018 , "Performance verification") - PORT_DIPNAME(0x0300 , 0x0000 , "Upper bus address (N/U)") - PORT_DIPLOCATION("S1:!2,!1") - PORT_DIPSETTING(0x0000 , "0") - PORT_DIPSETTING(0x0100 , "1") - PORT_DIPSETTING(0x0200 , "2") - PORT_DIPSETTING(0x0300 , "3") - PORT_DIPNAME(0x0007 , 0x0000 , "System bus address") - PORT_DIPLOCATION("S1:!5,!4,!3") - PORT_DIPSETTING(0x0000 , "0") - PORT_DIPSETTING(0x0001 , "1") - PORT_DIPSETTING(0x0002 , "2") - PORT_DIPSETTING(0x0003 , "3") - PORT_DIPSETTING(0x0004 , "4") - PORT_DIPSETTING(0x0005 , "5") - PORT_DIPSETTING(0x0006 , "6") - PORT_DIPSETTING(0x0007 , "7") - PORT_DIPNAME(0x0080 , 0x0000 , "RS232 mode") - PORT_DIPLOCATION("S4 IO:!8") - PORT_DIPSETTING(0x0000 , "Terminal") - PORT_DIPSETTING(0x0080 , "Modem") - - PORT_START("rs232_sw") - PORT_DIPNAME(0xc0 , 0x00 , "Stop bits") - PORT_DIPLOCATION("S4 IO:!2,!1") - PORT_DIPSETTING(0x00 , "Invalid") - PORT_DIPSETTING(0x40 , "1") - PORT_DIPSETTING(0x80 , "1.5") - PORT_DIPSETTING(0xc0 , "2") - PORT_DIPNAME(0x20 , 0x00 , "Parity") - PORT_DIPLOCATION("S4 IO:!3") - PORT_DIPSETTING(0x00 , "Odd") - PORT_DIPSETTING(0x20 , "Even") - PORT_DIPNAME(0x10 , 0x00 , "Parity enable") - PORT_DIPLOCATION("S4 IO:!4") - PORT_DIPSETTING(0x00 , DEF_STR(No)) - PORT_DIPSETTING(0x10 , DEF_STR(Yes)) - PORT_DIPNAME(0x0c , 0x00 , "Char length") - PORT_DIPLOCATION("S4 IO:!6,!5") - PORT_DIPSETTING(0x00 , "5") - PORT_DIPSETTING(0x04 , "6") - PORT_DIPSETTING(0x08 , "7") - PORT_DIPSETTING(0x0c , "8") - PORT_DIPNAME(0x02 , 0x00 , "Baud rate factor") - PORT_DIPLOCATION("S4 IO:!7") - PORT_DIPSETTING(0x00 , "1x") - PORT_DIPSETTING(0x02 , "16x") - - PORT_START("s5_sw") - PORT_DIPNAME(0x01 , 0x00 , "Duplex") - PORT_DIPLOCATION("S5 IO:!1") - PORT_DIPSETTING(0x00 , "Half duplex") - PORT_DIPSETTING(0x01 , "Full duplex") - PORT_DIPNAME(0x1e , 0x00 , "Baud rate") - PORT_DIPLOCATION("S5 IO:!5,!4,!3,!2") - PORT_DIPSETTING(0x00 , "50") - PORT_DIPSETTING(0x02 , "75") - PORT_DIPSETTING(0x04 , "110") - PORT_DIPSETTING(0x06 , "134.5") - PORT_DIPSETTING(0x08 , "150") - PORT_DIPSETTING(0x0a , "300") - PORT_DIPSETTING(0x0c , "600") - PORT_DIPSETTING(0x0e , "1200") - PORT_DIPSETTING(0x10 , "1800") - PORT_DIPSETTING(0x12 , "2000") - PORT_DIPSETTING(0x14 , "2400") - PORT_DIPSETTING(0x16 , "3600") - PORT_DIPSETTING(0x18 , "4800") - PORT_DIPSETTING(0x1a , "7200") - PORT_DIPSETTING(0x1c , "9600") - PORT_DIPSETTING(0x1e , "19200") - -INPUT_PORTS_END - -static SLOT_INTERFACE_START(hp64k_floppies) - SLOT_INTERFACE("525dd" , FLOPPY_525_DD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START(hp64k , hp64k_state) - MCFG_CPU_ADD("cpu" , HP_5061_3011 , 6250000) - MCFG_CPU_PROGRAM_MAP(cpu_mem_map) - MCFG_CPU_IO_MAP(cpu_io_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(hp64k_state , hp64k_irq_callback) - MCFG_QUANTUM_TIME(attotime::from_hz(100)) - - // Actual keyboard refresh rate should be between 1 and 2 kHz - MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer" , hp64k_state , hp64k_kb_scan , attotime::from_hz(100)) - - // Line sync timer. A line frequency of 50 Hz is assumed. - MCFG_TIMER_DRIVER_ADD_PERIODIC("linesync_timer" , hp64k_state , hp64k_line_sync , attotime::from_hz(50)) - - // Clock = 25 MHz / 9 * (112/114) - MCFG_DEVICE_ADD("crtc" , I8275 , 2729045) - MCFG_VIDEO_SET_SCREEN("screen") - MCFG_I8275_CHARACTER_WIDTH(9) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(hp64k_state , crtc_display_pixels) - MCFG_I8275_DRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_drq_w)) - MCFG_I8275_VRTC_CALLBACK(WRITELINE(hp64k_state , hp64k_crtc_vrtc_w)) - - MCFG_SCREEN_ADD("screen" , RASTER) - MCFG_SCREEN_UPDATE_DEVICE("crtc" , i8275_device , screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(720 , 390) - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - MCFG_FD1791_ADD("fdc" , XTAL_4MHz / 4) - MCFG_WD_FDC_FORCE_READY - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_flp_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(hp64k_state , hp64k_flp_drq_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0" , hp64k_floppies , "525dd" , floppy_image_device::default_floppy_formats) - MCFG_SLOT_FIXED(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1" , hp64k_floppies , "525dd" , floppy_image_device::default_floppy_formats) - MCFG_SLOT_FIXED(true) - - MCFG_DEVICE_ADD("fdc_rdy0" , TTL74123 , 0) - MCFG_TTL74123_CONNECTION_TYPE(TTL74123_NOT_GROUNDED_NO_DIODE) - MCFG_TTL74123_RESISTOR_VALUE(RES_K(68.1)) - // Warning! Duration formula is not correct for LS123, actual capacitor is 10 uF - MCFG_TTL74123_CAPACITOR_VALUE(CAP_U(16)) - MCFG_TTL74123_B_PIN_VALUE(1) - MCFG_TTL74123_CLEAR_PIN_VALUE(1) - MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITE8(hp64k_state , hp64k_floppy0_rdy)); - - MCFG_DEVICE_ADD("fdc_rdy1" , TTL74123 , 0) - MCFG_TTL74123_CONNECTION_TYPE(TTL74123_NOT_GROUNDED_NO_DIODE) - MCFG_TTL74123_RESISTOR_VALUE(RES_K(68.1)) - MCFG_TTL74123_CAPACITOR_VALUE(CAP_U(16)) - MCFG_TTL74123_B_PIN_VALUE(1) - MCFG_TTL74123_CLEAR_PIN_VALUE(1) - MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITE8(hp64k_state , hp64k_floppy1_rdy)); - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper" , BEEP , 2500) - MCFG_SOUND_ROUTE(ALL_OUTPUTS , "mono" , 1.00) - - MCFG_TIMER_DRIVER_ADD("beep_timer" , hp64k_state , hp64k_beeper_off); - - MCFG_DEVICE_ADD("baud_rate" , COM8116 , XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(hp64k_state , hp64k_baud_clk_w)); - - MCFG_DEVICE_ADD("uart" , I8251 , 0) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(hp64k_state , hp64k_rxrdy_w)); - MCFG_I8251_TXRDY_HANDLER(WRITELINE(hp64k_state , hp64k_txrdy_w)); - MCFG_I8251_TXD_HANDLER(WRITELINE(hp64k_state , hp64k_txd_w)); - MCFG_I8251_DTR_HANDLER(WRITELINE(hp64k_state , hp64k_dtr_w)); - MCFG_I8251_RTS_HANDLER(WRITELINE(hp64k_state , hp64k_rts_w)); - - MCFG_RS232_PORT_ADD("rs232" , default_rs232_devices , NULL) - MCFG_RS232_RXD_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_rxd_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_dcd_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE(hp64k_state , hp64k_rs232_cts_w)) - -MACHINE_CONFIG_END - -ROM_START(hp64k) - ROM_REGION(0x8000 , "cpu" , ROMREGION_16BIT | ROMREGION_BE | ROMREGION_INVERT) - ROM_LOAD16_BYTE("64100_80022.bin" , 0x0000 , 0x1000 , CRC(38b2aae5) SHA1(bfd0f126bfaf3724dc501979ad2d46afc41913aa)) - ROM_LOAD16_BYTE("64100_80020.bin" , 0x0001 , 0x1000 , CRC(ac01b436) SHA1(be1e827ea1393a95abb02a52ab5cc35dc2cd96e4)) - ROM_LOAD16_BYTE("64100_80023.bin" , 0x2000 , 0x1000 , CRC(6b4bc2ce) SHA1(00e6c58ccae9640dc81cb3e92db90a8c69b02a93)) - ROM_LOAD16_BYTE("64100_80021.bin" , 0x2001 , 0x1000 , CRC(74f9d33c) SHA1(543a845a992b0ceac3e0491acdfb178df0adeb1f)) - ROM_LOAD16_BYTE("64100_80026.bin" , 0x4000 , 0x1000 , CRC(a74e834b) SHA1(a2ff9765628985d9bab4cb44ba23257a9b8d0965)) - ROM_LOAD16_BYTE("64100_80024.bin" , 0x4001 , 0x1000 , CRC(2e15a1d2) SHA1(ce4330f8f8015a26c02f0965b95baf7dfd615512)) - ROM_LOAD16_BYTE("64100_80027.bin" , 0x6000 , 0x1000 , CRC(b93c0e7a) SHA1(b239446d3d6e9d3dba6c0278b2771abe1623e1ad)) - ROM_LOAD16_BYTE("64100_80025.bin" , 0x6001 , 0x1000 , CRC(e6353085) SHA1(48d78835c798f2caf6ee539057676d4f3c8a4df9)) - - ROM_REGION(0x800 , "chargen" , 0) - ROM_LOAD("1816_1496_82S191.bin" , 0 , 0x800 , CRC(32a52664) SHA1(8b2a49a32510103ff424e8481d5ed9887f609f2f)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1979, hp64k, 0, 0, hp64k, hp64k, driver_device, 0, "HP", "HP 64000" , 0) diff --git a/src/mess/drivers/hp9845.c b/src/mess/drivers/hp9845.c deleted file mode 100644 index 2d382a2d1a1..00000000000 --- a/src/mess/drivers/hp9845.c +++ /dev/null @@ -1,172 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - HP 9845 - - http://www.hp9845.net/ - -*/ - -#include "emu.h" -#include "cpu/z80/z80.h" - -class hp9845_state : public driver_device -{ -public: - hp9845_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag) - { } - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); -}; - -static INPUT_PORTS_START( hp9845 ) -INPUT_PORTS_END - -UINT32 hp9845_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( hp9845a, hp9845_state ) - //MCFG_CPU_ADD("lpu", HP_5061_3010, XTAL_11_4MHz) - //MCFG_CPU_ADD("ppu", HP_5061_3011, XTAL_11_4MHz) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9845_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(560, 455) - MCFG_SCREEN_VISIBLE_AREA(0, 560-1, 0, 455-1) - - MCFG_SOFTWARE_LIST_ADD("optrom_list", "hp9845a_rom") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp9835a, hp9845_state ) - //MCFG_CPU_ADD("lpu", HP_5061_3001, XTAL_11_4MHz) - //MCFG_CPU_ADD("ppu", HP_5061_3001, XTAL_11_4MHz) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9845_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(560, 455) - MCFG_SCREEN_VISIBLE_AREA(0, 560-1, 0, 455-1) - - MCFG_SOFTWARE_LIST_ADD("optrom_list", "hp9835a_rom") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp9845b, hp9845_state ) - //MCFG_CPU_ADD("lpu", HP_5061_3001, XTAL_11_4MHz) - //MCFG_CPU_ADD("ppu", HP_5061_3001, XTAL_11_4MHz) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9845_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(560, 455) - MCFG_SCREEN_VISIBLE_AREA(0, 560-1, 0, 455-1) - - MCFG_SOFTWARE_LIST_ADD("optrom_list", "hp9845b_rom") -MACHINE_CONFIG_END - -ROM_START( hp9845a ) - ROM_REGION( 0200000, "lpu", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "09845-65544-65547-03-system_lpu.bin", 0000000, 0200000, CRC(47beb87f) SHA1(456caefacafcf19435e1e7e68b1c1e4010841664) ) - - ROM_REGION( 0200000, "ppu", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "09845-65540-65543-01-system_ppu.bin", 0000000, 0160000, CRC(bc0a34cc) SHA1(9ff215f4ba32ad85f144845d15f762a71e35588b) ) -ROM_END - -#define rom_hp9845s rom_hp9845a - -ROM_START( hp9835a ) - ROM_REGION( 0200000, "lpu", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "1818-2800-03_00-system-lpu.bin", 0000000, 020000, CRC(e0b0977a) SHA1(5afdc6c725abff70b674e46688d8ab38ccf8f3c1) ) - ROM_LOAD( "1818-2801-03_10-system-lpu.bin", 0020000, 020000, CRC(c51c1e3a) SHA1(798964fa2e7a1fc149ce4400b694630049293119) ) - ROM_LOAD( "1818-2802-03_20-system-lpu.bin", 0040000, 020000, CRC(bba70a7e) SHA1(2d488594493f8dfcd753e462414cc51c24596a2c) ) - ROM_LOAD( "1818-2803-03_30-system-lpu.bin", 0060000, 020000, CRC(65e9eba6) SHA1(a11f5d37e8ed14a428335c43e785d635b02d1129) ) - ROM_LOAD( "1818-2804-03_40-system-lpu.bin", 0100000, 020000, CRC(ef83b695) SHA1(8ca2914609ece2c9c59ebba6ece3fcbc8929aeaf) ) - ROM_LOAD( "1818-2805-03_50-system-lpu.bin", 0120000, 020000, CRC(401d539f) SHA1(00bda59f71632c4d4fc3268c04262bb81ef0eeba) ) - ROM_LOAD( "1818-2806-03_60-system-lpu.bin", 0140000, 020000, CRC(fe353db5) SHA1(0fb52d82d3743008cdebebb20c488e34ce2fca4b) ) - ROM_LOAD( "1818-2807-03_70-system-lpu.bin", 0160000, 020000, CRC(45a3cc5e) SHA1(35c9959331acf7c98ab6a880915b03e3e783a656) ) - - ROM_REGION( 0200000, "ppu", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "1818-2808-05_00-system-ppu.bin", 0000000, 020000, CRC(d0c96276) SHA1(cc578d586c4eda81469f29eb7cab7f667e0d5977) ) - ROM_LOAD( "1818-2809-05_30-system-ppu.bin", 0060000, 020000, CRC(ccdb7171) SHA1(1d24596bc1219983e7cb81f6987af094f2ca7d81) ) - ROM_LOAD( "1818-2810-05_40-system-ppu.bin", 0100000, 020000, CRC(97487d24) SHA1(823cd16671de8e6ff2c245060c99778acb6ff79c) ) - ROM_LOAD( "1818-2811-05_50-system-ppu.bin", 0120000, 020000, CRC(18aee6fd) SHA1(388d3b2a063ea2cfdfe9fb9f864fa5f08af817b0) ) - ROM_LOAD( "1818-2812-05_60-system-ppu.bin", 0140000, 020000, CRC(c0beeeae) SHA1(a5db36a7f7bad84c1013bd3ec4813c355f72427d) ) - ROM_LOAD( "1818-2813-05_70-system-ppu.bin", 0160000, 020000, CRC(75361bbf) SHA1(40f499c597da5c8c9a55a2a891976d946a54926b) ) -ROM_END - -#define rom_hp9835b rom_hp9835a - -ROM_START( hp9845b ) - ROM_REGION( 0200000, "lpu", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "1818-0823-0827-03_00-revb-system_lpu.bin", 0000000, 020000, CRC(7e49c781) SHA1(866c9ebd98d94bb6f99692e29d2d83f55b38c4b6) ) - ROM_LOAD( "1818-0823-0827-03_10-revb-system_lpu.bin", 0020000, 020000, CRC(2f819e3d) SHA1(250886378c3ce2253229997007c7bf0be80a8d1d) ) - ROM_LOAD( "1818-0824-0828-03_20-reva-system_lpu.bin", 0040000, 020000, CRC(834f7063) SHA1(5c390ed74671e4663cc80d899d07b69fd1fb4be6) ) - ROM_LOAD( "1818-0824-0828-03_20-revb-system_lpu.bin", 0040000, 020000, CRC(aa221deb) SHA1(7878643405ee45405dc5269c3b6dc9459f39437b) ) - ROM_LOAD( "1818-0824-0828-03_30-reva-system_lpu.bin", 0060000, 020000, CRC(0ebafdb2) SHA1(80733bfb7026d39a294841221d80ec40eafffe34) ) - ROM_LOAD( "1818-0824-0828-03_30-revb-system_lpu.bin", 0060000, 020000, CRC(0ebafdb2) SHA1(80733bfb7026d39a294841221d80ec40eafffe34) ) - ROM_LOAD( "1818-0825-0829-03_40-revb-system_lpu.bin", 0100000, 020000, CRC(beb09a57) SHA1(b832b995fa21c219673f0c7cf215dee70698f4f1) ) - ROM_LOAD( "1818-0825-0829-03_50-revb-system_lpu.bin", 0120000, 020000, CRC(bbb06222) SHA1(b0bfe1b48fac61eb955e27e0ddfbea020e09e0eb) ) - ROM_LOAD( "1818-0826-0830-03_60-revc-system_lpu.bin", 0140000, 020000, CRC(5c1c3abe) SHA1(fa9f99bf7c8a6df5c71e9fd8c807f0a2ff06640d) ) - ROM_LOAD( "1818-0826-0830-03_70-revc-system_lpu.bin", 0160000, 020000, CRC(0c61a266) SHA1(0cfbf482e7f8e99c87b97c77cf178682cd7af7d6) ) - - ROM_REGION( 0200000, "lpu_fast", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "1818-1506-1502-03_00-reva-system_fast_lpu.bin", 0000000, 020000, CRC(b77194d8) SHA1(6feec8605331783e6f5a2ab6d6cbd9285036e863) ) - ROM_LOAD( "1818-1506-1502-03_10-reva-system_fast_lpu.bin", 0020000, 020000, CRC(bc5557a5) SHA1(282237e561c3f2304cdeb45efa2432748581af45) ) - ROM_LOAD( "1818-1507-1503-03_20-reva-system_fast_lpu.bin", 0040000, 020000, CRC(2ebc71e2) SHA1(a2d39fb24d565465304833dfd0ff87dd5ef26fb3) ) - ROM_LOAD( "1818-1507-1503-03_30-reva-system_fast_lpu.bin", 0060000, 020000, CRC(82e56bc4) SHA1(36201f343382e533c248ddd123507a2e195cca39) ) - ROM_LOAD( "1818-1508-1504-03_40-reva-system_fast_lpu.bin", 0100000, 020000, CRC(70b0fcb0) SHA1(3f7ce60cad0ffec8344f33d584869492c7f73026) ) - ROM_LOAD( "1818-1508-1504-03_50-reva-system_fast_lpu.bin", 0120000, 020000, CRC(935fab96) SHA1(ecb1da2a0bd46e8c0da2875a1af8cf71d8f4bb56) ) - ROM_LOAD( "1818-1509-1505-03_60-reva-system_fast_lpu.bin", 0140000, 020000, CRC(f4119af7) SHA1(72a3e8b8d7d306e55f8adf0e23225bb81bc2b4ba) ) - ROM_LOAD( "1818-1509-1505-03_70-reva-system_fast_lpu.bin", 0160000, 020000, CRC(22fb0864) SHA1(4e1dce32e84ba216dbbd4116f3b22ca7f254f529) ) - - ROM_REGION( 0200000, "ppu", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "1818-0833-0837-05_40-revc-system_ppu.bin", 0100000, 020000, CRC(d790795c) SHA1(7ba1e245a98379a34833a780898a784049e33b86) ) - ROM_LOAD( "1818-0833-0837-05_40-revd-system_ppu.bin", 0100000, 020000, CRC(49897e40) SHA1(780a9973ff26d40f470e2004fccceb1019f8ba7f) ) - ROM_LOAD( "1818-0833-0837-05_50-revc-system_ppu.bin", 0120000, 020000, CRC(ef8acde4) SHA1(e68648543aac2b841b08d7758949ba1339a83701) ) - ROM_LOAD( "1818-0833-0837-05_50-revd-system_ppu.bin", 0120000, 020000, CRC(54f61d07) SHA1(f807fb8a59cd9cd221f63907e6a86948a0bf7c1d) ) - ROM_LOAD( "1818-0834-0838-05_60-revc-system_ppu.bin", 0140000, 020000, CRC(20f2100a) SHA1(9304f0b069de9233d697588328f9657dbeabc254) ) - ROM_LOAD( "1818-0834-0838-05_60-revd-system_ppu.bin", 0140000, 020000, CRC(454af601) SHA1(54b56e67e855fd2d699a0dbef0b4d2e8c150c39b) ) - ROM_LOAD( "1818-0834-0838-05_70-revc-system_ppu.bin", 0160000, 020000, CRC(43f62491) SHA1(a9489b37b3fa8768ca6e503f346bd023833ae3ac) ) - ROM_LOAD( "1818-0834-0838-05_70-revd-system_ppu.bin", 0160000, 020000, CRC(43f62491) SHA1(a9489b37b3fa8768ca6e503f346bd023833ae3ac) ) - ROM_LOAD( "1818-1899-1898-05_60-reva-system_ppu.bin", 0140000, 020000, CRC(454af601) SHA1(54b56e67e855fd2d699a0dbef0b4d2e8c150c39b) ) - ROM_LOAD( "1818-1899-1898-05_70-reva-system_ppu.bin", 0160000, 020000, CRC(049604f2) SHA1(89bfd8e086bc9365f156966b0a62c3ac720fc627) ) - - ROM_REGION( 0200000, "ppu_tops", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "1818-0831-0835-05_00-reva-tops_ppu.bin", 0000000, 020000, CRC(7ddce706) SHA1(746e34d3de52a17372af9a9eb1ed4974a4eae656) ) - ROM_LOAD( "1818-0831-0835-05_10-reva-tops_ppu.bin", 0020000, 020000, CRC(d7fc3d47) SHA1(a3d723fe62f047cb0c17d405d07bb0b08d08e830) ) - ROM_LOAD( "1818-1209-1208-05_00-revb-tops_ppu.bin", 0000000, 020000, CRC(0dc90614) SHA1(94c07553a62b2c86414bc95314601f90eb4e4022) ) - ROM_LOAD( "1818-1209-1208-05_10-revb-tops_ppu.bin", 0020000, 020000, CRC(4e362657) SHA1(b09098c0acd56b11ec3b72ff3e8b5a1e14ef3ae8) ) - ROM_LOAD( "1818-1592-1591-05_00-revb-tops_ppu.bin", 0000000, 020000, CRC(8cfe29a8) SHA1(f1007b6b1d3f2b603653880c44cec48b23701263) ) - ROM_LOAD( "1818-1592-1591-05_10-revb-tops_ppu.bin", 0020000, 020000, CRC(95048264) SHA1(36cfddef9d1289fdaf69596e10d95f88a520feae) ) - - ROM_REGION( 0200000, "ppu_kbd_us", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "1818-0832-0836-05_20-revc-keyboard_us.bin", 0040000, 020000, CRC(3bf6268a) SHA1(65d7dfeaf34c74dbc86ebe5d3bb65c6bd10163cb) ) - ROM_LOAD( "1818-0832-0836-05_30-revc-keyboard_us.bin", 0060000, 020000, CRC(2dfc619c) SHA1(5c54ff502d1344907817210bfdfcab7f8d6b61bd) ) - - ROM_REGION( 0200000, "ppu_kbd_de", ROMREGION_16BIT | ROMREGION_BE ) - ROM_LOAD( "1818-0841-0846-05_20-revc-keyboard_german.bin", 0040000, 020000, CRC(76667eca) SHA1(ac63e5d584d1f2da5668d8a9560f927f48e25e03) ) - ROM_LOAD( "1818-0841-0846-05_20-revd-keyboard_german.bin", 0060000, 020000, CRC(3bf6268a) SHA1(65d7dfeaf34c74dbc86ebe5d3bb65c6bd10163cb) ) - ROM_LOAD( "1818-0841-0846-05_30-revc-keyboard_german.bin", 0040000, 020000, CRC(2b83db22) SHA1(6eda714ce05d2d75f4c041e36b6b6df40697d94a) ) - ROM_LOAD( "1818-0841-0846-05_30-revd-keyboard_german.bin", 0060000, 020000, CRC(b4006959) SHA1(584a85f746a3b0c262fdf9e4be8e696c80cfd429) ) -ROM_END - -#define rom_hp9845t rom_hp9845b -#define rom_hp9845c rom_hp9845b - -COMP( 1978, hp9845a, 0, 0, hp9845a, hp9845, driver_device, 0, "Hewlett-Packard", "9845A", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1978, hp9845s, hp9845a, 0, hp9845a, hp9845, driver_device, 0, "Hewlett-Packard", "9845S", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1979, hp9835a, 0, 0, hp9835a, hp9845, driver_device, 0, "Hewlett-Packard", "9835A", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1979, hp9835b, hp9835a, 0, hp9835a, hp9845, driver_device, 0, "Hewlett-Packard", "9835B", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1980, hp9845b, 0, 0, hp9845b, hp9845, driver_device, 0, "Hewlett-Packard", "9845B", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1980, hp9845t, hp9845b, 0, hp9845b, hp9845, driver_device, 0, "Hewlett-Packard", "9845T", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1981, hp9845c, hp9845b, 0, hp9845b, hp9845, driver_device, 0, "Hewlett-Packard", "9845C", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/hp9k.c b/src/mess/drivers/hp9k.c deleted file mode 100644 index 9fa6ae09513..00000000000 --- a/src/mess/drivers/hp9k.c +++ /dev/null @@ -1,432 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Gabriele D'Antona, F. Ulivi - -/*************************************************************************** - -HP 9816 -1982 -MESS driver by friol (dantonag (at) gmail.com) -System reference mainly from O.De Smet -Driver started on 10/01/2012 - -=== - -Memory map: - -000000-00ffff - system rom -428000-428fff - keyboard -510000-51ffff - videoram -530000-53ffff - graphic memory -5f0000-5f3fff - system PROM -xxxxxx-ffffff - system RAM - -=== - -- 0x408: startup code, 68000 registers test -- 0x1002: bootrom test -- 0x1d18: PROM test -- 0x103C: prints "bootrom failed" -- 0x1150: other boot test -- 0x1164: keyboard test -- 0x1202: post-kbd test -- 0x12c6: "loading memory" test - -=== - -TODO: boot tests fail - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "video/mc6845.h" -#include "machine/terminal.h" -//#include "machine/ins8250.h" - -#define HP9816_CHDIMX 8 -#define HP9816_CHDIMY 16 -#define HP9816_ROWX 80 -#define HP9816_ROWY 25 - -// - -static UINT8 prom16a[256] = { - 0x00,0x00, // checksum - 0x00, // 256 bytes idprom - '2', '0', '1', '0', 'A', '0', '0', '0', '0', '0', '0', // serial in ascii DDDDCSSSSSS date code, country, serial number - '9', '8', '1', '6', 'A', ' ', ' ', // product number - 0xff, // 8 bits processor board config - 0x01, // keyboard 98203B - 0x02, // CRT alpha see crtid for monitor - 0x03, // HP-IB - 0x04, // Graphics - 0xff, // end - 0xff, - 0xff, - 0xff, - 0xff, - 0xff, - 0xff, - 0xff, - 0xff, - 0xff, - 0xff, - 0xff, - 0xff,0xfe,0x00,0x00, // bottom minimun address for ram size - 0xff,0xff, // 16 required IO cards here not used - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff, - 0xff,0xff,0xff,0xff, // boot msus to try before Boot list scan - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, // Boot file name - 0x00,0x00,0x00,0x00, // delay in millisec before boot scan - 0x00, // owner byte, HP format - 0x00, // id prom revision byte : 0x00 - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, // rest reserved at 0xFF - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff -}; - -// - -class hp9k_state : public driver_device -{ -private: - - int crtc_curreg; - int crtc_addrStartHi; - int crtc_addrStartLow; - - void calc_prom_crc(UINT8* prom); - void putChar(UINT8 thec,int x,int y,bitmap_ind16 &bitmap); - -public: - hp9k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - //m_terminal(*this, TERMINAL_TAG), - m_6845(*this, "mc6845"), - m_gfxdecode(*this, "gfxdecode") - { - kbdBit=0; - crtc_curreg=0; - crtc_addrStartHi=0; - crtc_addrStartLow=0; - calc_prom_crc(prom16a); - } - - UINT8 kbdBit; - - required_device m_maincpu; - //required_device<> m_terminal; - required_device m_6845; - - UINT8 m_videoram[0x4000]; - UINT8 m_screenram[0x800]; - - DECLARE_DRIVER_INIT(hp9k); - - DECLARE_READ16_MEMBER(buserror_r); - DECLARE_WRITE16_MEMBER(buserror_w); - - DECLARE_READ16_MEMBER(hp9k_videoram_r); - DECLARE_WRITE16_MEMBER(hp9k_videoram_w); - - DECLARE_READ16_MEMBER(hp9k_prom_r); - DECLARE_WRITE16_MEMBER(hp9k_prom_w); - - DECLARE_READ16_MEMBER(keyboard_r); - DECLARE_WRITE16_MEMBER(keyboard_w); - - DECLARE_READ16_MEMBER(leds_r); - DECLARE_WRITE16_MEMBER(leds_w); - - DECLARE_WRITE8_MEMBER(kbd_put); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - required_device m_gfxdecode; -}; - -// - -void hp9k_state::calc_prom_crc(UINT8* prom) -{ - int chksum; - int i; - - chksum = 0; - for (i=0; i < 256; i+=2) - { - chksum += ((prom[i] << 8) | prom[i+1]); - if (chksum&0x10000) chksum++; - chksum&=0xffff; - } - - chksum=(chksum+1)&0xffff; - - if (chksum!=0) - { - chksum=(0x10000-chksum); - prom[0]=(UINT8)(chksum>>8); - prom[1]=(UINT8)(chksum&0xff); - } -} - -READ16_MEMBER( hp9k_state::keyboard_r ) -{ - //printf("keyboard read at [%x] mask [%x]\n",offset,mem_mask); - return 0x31; -} - -WRITE16_MEMBER( hp9k_state::keyboard_w ) -{ - //printf("keyboard write of [%x] at [%x]\n",data,offset); -} - -READ16_MEMBER( hp9k_state::leds_r ) -{ - //printf("warning: leds read at [%x] mm [%x]\n",offset,mem_mask); - return 0; -} - -WRITE16_MEMBER( hp9k_state::leds_w ) -{ - //printf("warning: leds write of [%x] at [%x] mm [%x]\n",data,offset,mem_mask); -} - -READ16_MEMBER( hp9k_state::hp9k_prom_r ) -{ - //if (mem_mask!=0xff) printf("read of PROM at [%x] mem_mask [%x]\n",offset,mem_mask); - int k=prom16a[offset&0xff]; - if (mem_mask==0xff00) return (k<<8); - else return k; - //return 0; -} - -WRITE16_MEMBER( hp9k_state::hp9k_prom_w ) -{ - //printf("Error: write to prom\n"); -} - -READ16_MEMBER( hp9k_state::hp9k_videoram_r ) -{ - offset&=0x3fff; - - //printf("videoram read at [%x] mem_mask [%x]\n",offset,mem_mask); - - if (offset==0x0001) - { - //printf("m6845 read at [%x] mem_mask [%x]\n",offset,mem_mask); - return m_6845->register_r(space,0); - } - else - { - if (mem_mask==0xff00) - { - return m_videoram[offset]<<8; - } - else - { - return m_videoram[offset]; - } - } -} - -WRITE16_MEMBER( hp9k_state::hp9k_videoram_w ) -{ - offset&=0x3fff; - - if (offset==0x0000) - { - //printf("6845 address write [%x] at [%x] mask [%x]\n",data,offset,mem_mask); - data&=0x1f; - m_6845->address_w( space, 0, data ); - crtc_curreg=data; - } - else if (offset==0x0001) - { - //printf("6845 register write [%x] at [%x] mask [%x]\n",data,offset,mem_mask); - m_6845->register_w( space, 0, data ); - if (crtc_curreg==0x0c) crtc_addrStartHi=data; - if (crtc_curreg==0x0d) crtc_addrStartLow=data; - } - else - { - //printf("videoram write [%x] at [%x]\n",data,offset); - - if (mem_mask==0xff00) - { - m_screenram[offset&0x7ff]=data>>8; - m_videoram[offset&0x3fff]=data>>8; - - //UINT8 *rom = machine().region("bootrom")->base(); - //rom[0x90B]=0x00; - } - else - { - m_screenram[offset&0x7ff]=data; - m_videoram[offset&0x3fff]=data; - } - } -} - -READ16_MEMBER(hp9k_state::buserror_r) -{ - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - return 0; -} - -WRITE16_MEMBER(hp9k_state::buserror_w) -{ - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); -} - -static ADDRESS_MAP_START(hp9k_mem, AS_PROGRAM, 16, hp9k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x000909) AM_ROM AM_REGION("bootrom",0) - AM_RANGE(0x00090a, 0x00090d) AM_READWRITE(leds_r,leds_w) - AM_RANGE(0x00090e, 0x00ffff) AM_ROM AM_REGION("bootrom",0x90e) - AM_RANGE(0x010000, 0x427fff) AM_READWRITE(buserror_r,buserror_w) - AM_RANGE(0x428000, 0x428fff) AM_READWRITE(keyboard_r,keyboard_w) - AM_RANGE(0x429000, 0x50ffff) AM_READWRITE(buserror_r,buserror_w) - AM_RANGE(0x510000, 0x51ffff) AM_READWRITE(hp9k_videoram_r,hp9k_videoram_w) - AM_RANGE(0x520000, 0x52ffff) AM_READWRITE(buserror_r,buserror_w) - AM_RANGE(0x530000, 0x53ffff) AM_RAM // graphic memory - AM_RANGE(0x540000, 0x5effff) AM_READWRITE(buserror_r,buserror_w) - AM_RANGE(0x5f0000, 0x5f3fff) AM_READWRITE(hp9k_prom_r,hp9k_prom_w) - //AM_RANGE(0x5f0000, 0x5f3fff) AM_READWRITE(buserror_r,buserror_w) - AM_RANGE(0x5f4000, 0xfbffff) AM_READWRITE(buserror_r,buserror_w) - AM_RANGE(0xFC0000, 0xffffff) AM_RAM // system ram -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( hp9k ) -INPUT_PORTS_END - - -DRIVER_INIT_MEMBER(hp9k_state,hp9k) -{ -} - -static const gfx_layout hp9k_charlayout = -{ - HP9816_CHDIMX, HP9816_CHDIMY, - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { STEP8(0,1) }, - /* y offsets */ - { STEP16(0,8) }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( hp9k ) - GFXDECODE_ENTRY( "bootrom", 0x2000, hp9k_charlayout, 0, 1 ) -GFXDECODE_END - -void hp9k_state::putChar(UINT8 thec,int x,int y,bitmap_ind16 &bitmap) -{ - const UINT8* pchar=m_gfxdecode->gfx(0)->get_data(thec); - - for (int py=0;py m_maincpu; - virtual void machine_reset(); - - optional_shared_ptr m_vram16; - optional_shared_ptr m_vram; - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 hp98544_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 hp98544_16_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ16_MEMBER(buserror16_r); - DECLARE_WRITE16_MEMBER(buserror16_w); - DECLARE_READ32_MEMBER(buserror_r); - DECLARE_WRITE32_MEMBER(buserror_w); - -private: - bool m_in_buserr; - UINT32 m_last_buserr_pc; -}; - -UINT32 hp9k3xx_state::hp98544_16_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 *scanline; - int x, y; - UINT16 pixels; - UINT32 m_palette[2] = { 0x00000000, 0xffffffff }; - - for (y = 0; y < 768; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/2; x++) - { - pixels = m_vram16[(y * 512) + x]; - - *scanline++ = m_palette[(pixels>>8) & 1]; - *scanline++ = m_palette[(pixels & 1)]; - } - } - - return 0; -} - -UINT32 hp9k3xx_state::hp98544_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 *scanline; - int x, y; - UINT32 pixels; - UINT32 m_palette[2] = { 0x00000000, 0xffffffff }; - - for (y = 0; y < 768; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/4; x++) - { - pixels = m_vram[(y * 256) + x]; - - *scanline++ = m_palette[(pixels>>24) & 1]; - *scanline++ = m_palette[(pixels>>16) & 1]; - *scanline++ = m_palette[(pixels>>8) & 1]; - *scanline++ = m_palette[(pixels & 1)]; - } - } - - return 0; -} - -// shared mappings for all 9000/3xx systems -static ADDRESS_MAP_START(hp9k3xx_common, AS_PROGRAM, 32, hp9k3xx_state) - AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP // writes to 1fffc are the LED - - AM_RANGE(0x00500000, 0x0050000f) AM_RAM // this is sufficient to pass the DMA test for now - - AM_RANGE(0x00510000, 0x00510003) AM_READWRITE(buserror_r, buserror_w) // no "Alpha display" - AM_RANGE(0x00538000, 0x00538003) AM_READWRITE(buserror_r, buserror_w) // no "Graphics" - AM_RANGE(0x005c0000, 0x005c0003) AM_READWRITE(buserror_r, buserror_w) // no add-on FP coprocessor - AM_RANGE(0x005f8000, 0x005f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff00ff) -ADDRESS_MAP_END - -// 9000/310 - has onboard video that the graphics card used in other 3xxes conflicts with -static ADDRESS_MAP_START(hp9k310_map, AS_PROGRAM, 16, hp9k3xx_state) - AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP // writes to 1fffc are the LED - - AM_RANGE(0x510000, 0x510003) AM_READWRITE(buserror16_r, buserror16_w) // no "Alpha display" - AM_RANGE(0x538000, 0x538003) AM_READWRITE(buserror16_r, buserror16_w) // no "Graphics" - AM_RANGE(0x5c0000, 0x5c0003) AM_READWRITE(buserror16_r, buserror16_w) // no add-on FP coprocessor - - AM_RANGE(0x5f8000, 0x5f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff) - - AM_RANGE(0x200000, 0x2fffff) AM_RAM AM_SHARE("vram16") // 98544 mono framebuffer - AM_RANGE(0x560000, 0x563fff) AM_ROM AM_REGION("graphics", 0x0000) // 98544 mono ROM - - AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(buserror16_r, buserror16_w) - AM_RANGE(0x800000, 0xffffff) AM_RAM -ADDRESS_MAP_END - -// 9000/320 -static ADDRESS_MAP_START(hp9k320_map, AS_PROGRAM, 32, hp9k3xx_state) - AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram") // 98544 mono framebuffer - AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000) // 98544 mono ROM - - AM_RANGE(0xffe00000, 0xffefffff) AM_READWRITE(buserror_r, buserror_w) - AM_RANGE(0xfff00000, 0xffffffff) AM_RAM - - AM_IMPORT_FROM(hp9k3xx_common) -ADDRESS_MAP_END - -// 9000/330 and 9000/340 -static ADDRESS_MAP_START(hp9k330_map, AS_PROGRAM, 32, hp9k3xx_state) - AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram") // 98544 mono framebuffer - AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000) // 98544 mono ROM - - AM_RANGE(0xffb00000, 0xffbfffff) AM_READWRITE(buserror_r, buserror_w) - AM_RANGE(0xffc00000, 0xffffffff) AM_RAM - - AM_IMPORT_FROM(hp9k3xx_common) -ADDRESS_MAP_END - -// 9000/370 - 8 MB RAM standard -static ADDRESS_MAP_START(hp9k370_map, AS_PROGRAM, 32, hp9k3xx_state) - AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram") // 98544 mono framebuffer - AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000) // 98544 mono ROM - - AM_RANGE(0xff700000, 0xff7fffff) AM_READWRITE(buserror_r, buserror_w) - AM_RANGE(0xff800000, 0xffffffff) AM_RAM - - AM_IMPORT_FROM(hp9k3xx_common) -ADDRESS_MAP_END - -// 9000/382 - onboard VGA compatible video (where?) -static ADDRESS_MAP_START(hp9k382_map, AS_PROGRAM, 32, hp9k3xx_state) - AM_RANGE(0xffb00000, 0xffbfffff) AM_READWRITE(buserror_r, buserror_w) - AM_RANGE(0xffc00000, 0xffffffff) AM_RAM - - AM_IMPORT_FROM(hp9k3xx_common) -ADDRESS_MAP_END - -UINT32 hp9k3xx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -/* Input ports */ -static INPUT_PORTS_START( hp9k330 ) -INPUT_PORTS_END - - -void hp9k3xx_state::machine_reset() -{ - m_in_buserr = false; - m_last_buserr_pc = 0; -} - -READ16_MEMBER(hp9k3xx_state::buserror16_r) -{ - if (m_last_buserr_pc == space.device().safe_pc()) - { - return 0; - } - - if (!m_in_buserr) - { - m_in_buserr = true; - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - m_in_buserr = false; - m_last_buserr_pc = space.device().safe_pc(); - } - return 0; -} - -WRITE16_MEMBER(hp9k3xx_state::buserror16_w) -{ - if (m_last_buserr_pc == space.device().safe_pc()) - { - return; - } - - if (!m_in_buserr) - { - m_in_buserr = true; - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - m_in_buserr = false; - m_last_buserr_pc = space.device().safe_pc(); - } -} - -READ32_MEMBER(hp9k3xx_state::buserror_r) -{ - if (m_last_buserr_pc == space.device().safe_pc()) - { - return 0; - } - - if (!m_in_buserr) - { - m_in_buserr = true; - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - m_in_buserr = false; - m_last_buserr_pc = space.device().safe_pc(); - } - return 0; -} - -WRITE32_MEMBER(hp9k3xx_state::buserror_w) -{ - if (m_last_buserr_pc == space.device().safe_pc()) - { - return; - } - - if (!m_in_buserr) - { - m_in_buserr = true; - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - m_in_buserr = false; - m_last_buserr_pc = space.device().safe_pc(); - } -} - -static MACHINE_CONFIG_START( hp9k310, hp9k3xx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68010, 10000000) - MCFG_CPU_PROGRAM_MAP(hp9k310_map) - - MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 - MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) - - MCFG_SCREEN_ADD( "screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_16_update) - MCFG_SCREEN_SIZE(1024,768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - MCFG_SCREEN_REFRESH_RATE(70) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp9k320, hp9k3xx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68020FPU, 16670000) - MCFG_CPU_PROGRAM_MAP(hp9k320_map) - - MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 - MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) - - MCFG_SCREEN_ADD( "screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) - MCFG_SCREEN_SIZE(1024,768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - MCFG_SCREEN_REFRESH_RATE(70) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp9k330, hp9k3xx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68020PMMU, 16670000) - MCFG_CPU_PROGRAM_MAP(hp9k330_map) - - MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 - MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) - - MCFG_SCREEN_ADD( "screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) - MCFG_SCREEN_SIZE(1024,768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - MCFG_SCREEN_REFRESH_RATE(70) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp9k340, hp9k3xx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68030, 16670000) - MCFG_CPU_PROGRAM_MAP(hp9k330_map) - - MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 - MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) - - MCFG_SCREEN_ADD( "screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) - MCFG_SCREEN_SIZE(1024,768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - MCFG_SCREEN_REFRESH_RATE(70) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp9k370, hp9k3xx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68030, 33000000) - MCFG_CPU_PROGRAM_MAP(hp9k370_map) - - MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 - MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) - - MCFG_SCREEN_ADD( "screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) - MCFG_SCREEN_SIZE(1024,768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - MCFG_SCREEN_REFRESH_RATE(70) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp9k380, hp9k3xx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz? 33? - MCFG_CPU_PROGRAM_MAP(hp9k330_map) - - MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 - MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) - - MCFG_SCREEN_ADD( "screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp98544_update) - MCFG_SCREEN_SIZE(1024,768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - MCFG_SCREEN_REFRESH_RATE(70) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hp9k382, hp9k3xx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz? 33? - MCFG_CPU_PROGRAM_MAP(hp9k382_map) - - MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 - MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) - - MCFG_SCREEN_ADD( "screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, screen_update) - MCFG_SCREEN_SIZE(1024,768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - MCFG_SCREEN_REFRESH_RATE(70) -MACHINE_CONFIG_END - -ROM_START( hp9k310 ) - ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) - ROM_LOAD16_BYTE( "1818-3771.bin", 0x000001, 0x008000, CRC(b9e4e3ad) SHA1(ed6f1fad94a15d95362701dbe124b52877fc3ec4) ) - ROM_LOAD16_BYTE( "1818-3772.bin", 0x000000, 0x008000, CRC(a3665919) SHA1(ec1bc7e5b7990a1b09af947a06401e8ed3cb0516) ) - - ROM_REGION( 0x800, "mcu", 0 ) - ROM_LOAD( "1820-4784_1.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) ) - ROM_LOAD( "1820-4784_2.bin", 0x000000, 0x000800, CRC(8defcf50) SHA1(d3abfea468a43db7c2369500a3e390e77a8e22e6) ) - - ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE ) - ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000000, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) -ROM_END - -ROM_START( hp9k320 ) - ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) - ROM_LOAD16_BYTE( "5061-6538.bin", 0x000001, 0x004000, CRC(d6aafeb1) SHA1(88c6b0b2f504303cbbac0c496c26b85458ac5d63) ) - ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) ) - ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) ) - ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) ) - - ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) - ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) -ROM_END - -ROM_START( hp9k330 ) - ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) - ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) ) - ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) ) - - ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) - ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) -ROM_END - -ROM_START( hp9k340 ) - ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) - ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) ) - ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) ) - - ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) - ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) -ROM_END - -ROM_START( hp9k370 ) - ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) - ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) ) - ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) ) - - ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) - ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) -ROM_END - -ROM_START( hp9k380 ) - ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) - ROM_LOAD16_WORD_SWAP( "1818-5062_98754_9000-380_27c210.bin", 0x000000, 0x020000, CRC(500a0797) SHA1(4c0a3929e45202a2689e353657e5c4b58ff9a1fd) ) - - ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) - ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) -ROM_END - -ROM_START( hp9k382 ) - ROM_REGION( 0x20000, MAINCPU_TAG, 0 ) - ROM_LOAD16_WORD_SWAP( "1818-5468_27c1024.bin", 0x000000, 0x020000, CRC(d1d9ef13) SHA1(6bbb17b9adad402fbc516dc2f3143e9c38ceef8e) ) - - ROM_REGION( 0x2000, "unknown", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) - ROM_LOAD( "1818-5282_8ce61e951207_28c64.bin", 0x000000, 0x002000, CRC(740442f3) SHA1(ab65bd4eec1024afb97fc2dd3bd3f017e90f49ae) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, hp9k310, 0, 0, hp9k310, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/310", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1985, hp9k320, 0, 0, hp9k320, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/320", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1987, hp9k330, 0, 0, hp9k330, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/330", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1989, hp9k340, hp9k330,0, hp9k340, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/340", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1988, hp9k370, hp9k330,0, hp9k370, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/370", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1991, hp9k380, 0, 0, hp9k380, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/380", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1991, hp9k382, 0, 0, hp9k382, hp9k330, driver_device, 0, "Hewlett-Packard", "HP9000/382", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/hp_ipc.c b/src/mess/drivers/hp_ipc.c deleted file mode 100644 index 1eddffdf46f..00000000000 --- a/src/mess/drivers/hp_ipc.c +++ /dev/null @@ -1,358 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders: -/****************************************************************************** - - -Integral Personal Computer (HP9807A) -Hewlett-Packard, 1985 - -This is a portable mains-powered UNIX workstation computer system produced by Hewlett-Packard and launched in 1985 -Basic hardware specs are.... -- 68000 CPU at 7.96MHz -- 9" amber electro-luminescent display with a resolution of 255*512 pixels or up to 85 characters x 31 lines (default=80*24) with - dedicated 32Kb display memory -- Internal 3.5" floppy disk drive with the following specification.... - Encoding: Double Density HP MFM Format - Rotational speed: 600 RPM - Transfer speed: 62.5kB/second - Capacity: 709Kb (709632 bytes) - Bytes per sector: 512 - Sectors per track: 9 - Total tracks per surface: 80, Available: 77, Spare: 2, Wear: 1 - Surfaces: 2 - Interleave: 1 -- HP ThinkJet ink-jet printer integrated into the top of the case. This is a modified HP2225B Thinkjet printer -- 90-key detachable keyboard -- ROM: up to 512Kb standard and an additional 512Kb of option ROM -- RAM: 512Kb, arranged as 256Kbx16. RAM is expandable externally to 7Mb -- Real Time Clock -- Speaker -- External I/O bus with two I/O ports for interfaces and memory modules. Expandable to maximum 10 ports with two 5-port Bus Expander Modules -- HP-IB (IEEE-488) bus -- Runs the HP-UX Operating System III or System V (in ROM) - - -PCB Layouts -=========== - -CPU/Memory Board (LOGIC A PCA) ----------------- - -HP Part# 00095-60953 - |---------------------------------------------------------------------------------| - | 15.92MHz J1 J2 | - |LS74 | - | |---| | - | |T | | - | |M | | - | |S | | - | |4 | |-------------------------| | -|--------------------| |5 | | 68000 | | -| |0 | | | | -| MB81256 MB81256 |0 | |-------------------------| | -| |A | | -| MB81256 MB81256 |---| | -| |----------------J3-----------------| | -| MB81256 MB81256 | | | -| | | | -| MB81256 MB81256 | | | -| | | | -| MB81256 MB81256 | | | -| | | | -| MB81256 MB81256 | | | -| |----------------J4-----------------| | -| MB81256 MB81256 | -| U58 U60 | -| MB81256 MB81256 555 | -| | -| | -| | -| J5 J6 J7 | -|------------------------------------------------------------------------------------------------------| -Notes: - 68000 - 68000 CPU at U7. Clock input 7.96MHz [15.92/2] (DIP64) - LS74 - 74LS74 at U2 provides system clock dividers /4 /2 - MB81256 - Fujitsu MB81256 256Kx1 DRAM. Total RAM 512Kx8/256Kx16. HP part# 1818-3308. U20-U35 (DIP16) - TMS4500 - Texas Instruments TMS4500A DRAM Controller at U4. Clock input 3.98MHz [15.92/4] (DIP40) - U58 - HP-HIL Keyboard Interface 'Cerberus'. Clock input on pin 24 is unknown (DIP24) - U60 - Unknown IC used as an interrupt encoder. Possibly a logic chip? (DIP20) - 555 - 555 Timer - J1/J2 - Connectors joining to LOGIC B PCA (logic A to logic B bus) - J3/J4 - Connectors for ROM board - J5 - Power input connector from power supply PCB - J6 - 64-pin external I/O bus. This is connected to the I/O backplane PCB mounted at the rear of the case using a ribbon cable - J7 - 10 pin connector. Labelled on schematics as LOOP0 In/Out and LOOP1 In/Out. Connected to 'Cerberus' IC. Possibly for more input devices? - - -Interface & Control Board (LOGIC B PCA) -------------------------- - -HP Part# 00095-60952 -00095-60107 BD REV A -00095-60149 ASSY LOGIC B -|---------------------------------------------------------------------------------| -|SPEAKER NS58167A J11 J10 | -| LM358 32.768kHz | -| | -| 16Kx4 16Kx4 16Kx4 16Kx4 | -| ROM | -| | -| BT1 HP-IL(2) GPU | -| |--------------------| -| 1Kb | -| COP452 | -| | -| | -| WD2797 | -| LM393 HP-IL(1) | -| | -| LS193 | -| | -| | -| | -| LS74 24MHz LS161 | -| J2| -| | -| TMS9914 | -| | -| | -| 75162 75160 | -| | -| J14 J6 J5 J4 J3 J7 J1 J8 J9 J12 | -|------------------------------------------------------------------------------------------------------| -Notes: - GPU - GPU (Graphics Processor) at U1. Clock input 3MHz [24/8]. VSync on pin 45, HSync on pin 46 (DIP48) - 16Kx4 - 16Kx4 DRAM, organised as 32Kx8bit/16Kx16bit at U3, U4, U5 & U6. Chip type unknown, likely Fujitsu MB81416 (DIP18) - WD2797 - Western Digital WD2797 Floppy Disk Controller at U18. Clock input 2MHz [24/2/3/2] (DIP40) - HP-IL(1) - HP-IL 1LJ7-0015 'Saturn' Thinkjet Printer Controller IC at U28. Clock input 3MHz on pin 9 [24/8] (DIP48) - HP-IL(2) - HP-IL Interface IC at U31. Clock input 2MHz on pin 22 [24/2/3/2] (DIP28) - 1Kb - 1Kb RAM at U27 for printer buffer (DIP28, type unknown, very old, with only DATA0,1,2,3, C/D and DIN,DOUT) - ROM - 16Kb (2Kx8?) Some kind of very early DIP28 PROM/ROM? Same pinout as 1Kb RAM above. Holds the character font table for the printer - Four versions of this ROM exist, one each for Japan/Arabic/Hebrew and one for all other regions - NS58167A - National Semiconductor NS58167A Clock Controller RTC at U44. Clock input 32.768kHz (DIP24) - LM358 - National Semiconductor LM358 Operational Amplifier at U40 (DIP8) - LM393 - Texas Instruments LM393 Dual Comparator at U34 (DIP8) - BT1 - 3v lithium battery - COP452 - National Semiconductor COP452 Speaker Controller at U39. Clock input 2MHz [24/2/3/2]. This IC provides programmable square wave output from 100Hz to 5000Hz (DIP14) - TMS9914 - Texas Instruments TMS9914 General Purpose Interface Bus Adapter at U41. Clock input 4MHz [24/2/3] (DIP40) - 75160 - National Semiconductor DS75160A IEEE-488 General Purpose Interface Bus Transceiver at U42 (DIP20) - 75162 - National Semiconductor DS75162A IEEE-488 General Purpose Interface Bus Transceiver at U43 (DIP22) - LS193 - 74LS193 at U9 provides the main system clock dividers /8 /4 /2 (24MHz -> 12MHz, 6MHz, 3MHz). This is also the source of the 6MHz video clock on connector J1 - LS161 - 74LS161 at U46. Takes 12MHz clock input on pin 2 and outputs 4MHz on pin 13 (i.e. /3). This is the clock source for the TMS9914 - LS74 - LS74 at U16. Takes output of 4MHz from LS161 at U46 and outputs 2MHz on pin 5 (i.e. /2). This is the source of the 2MHz clocks - J1 - Connector joining to video display assembly - J2 - Connector joining to floppy drive - J3 - Connector joining to printer front switch panel assembly (ADV/CONT/FF/ATTN) - J4 - Connector joining to printer out of paper switch connected to ATTN - J5 - Connector joining to printer carriage motor - J6 - Connector joining to printer mechanism assembly including paper motor - J7 - Connector joining to printer printhead - J8 - Connector joining to HO?E switch (? ~ M, text unreadable on schems) - J9 - Connector for ? - J10/J11 - Connectors joining to LOGIC A PCA (logic A to logic B bus) - J12 - Power input connector from power supply PCB - J14 - Fan connector - - -ROM board (Operating System ROM PCA. Assembly# HP82991A or HP82995A) ---------- - -|----------------J3-----------------| -| | -| | -| | -|J1 U1 U2 U3 U4 J2| -| | -| | -| | -|----------------J4-----------------| -Notes: - J1/J2 - 20 pin connector joining to 'Option ROM PCA' - J3/J4 - 20 pin connector joining to 'LOGIC A PCA' - U1-U4 - 28 pin EPROM/MASKROM 0L/1L/0H/1H (note 1Mbit: 128Kx8 28 pin) - - -ROM board (Option ROM PCA) ---------- -Note this PCB plugs in upside-down on top of the Operating System ROM PCB - -|----------------J4-----------------| -| | -| | -| | -|J1 U1 U2 U3 U4 J2| -| | -| | -| | -|----------------J3-----------------| -Notes: - J1/J2 - 20 pin connector joining to 'Operating System ROM PCA' - J3/J4 - 20 pin connector joining to 'LOGIC A PCA' - U1-U4 - 28 pin EPROM/MASKROM 0L/1L/0H/1H (note 1Mbit: 128Kx8 28 pin) - - -Physical Memory Map -=================== -000000-07FFFF - Internal ROM (Operating System PCA 512Kb) -080000-0FFFFF - Internal ROM (Option ROM PCA 512Kb) -100000-4FFFFF - External ROM modules (up to 4Mb) -500000-5FFFFF - Reserved 1Mb -600000-6FFFFF - Internal I/O 1Mb - - Address Port Use - ------------------------- - 600000-60FFFF 0 MMU - 610000-61FFFF 1 Disk Drive - 620000-62FFFF 2 Display - 630000-63FFFF 3 HP-IB - 640000-64FFFF 4 RTC - 650000-65FFFF 5 Printer - 660000-66FFFF 6 Keyboard - 670000-67FFFF 7 Speaker - 680000-68FFFF 8 Reserved - 690000-69FFFF 9 Reserved - 6A0000-6AFFFF 10 Reserved - 6B0000-6BFFFF 11 Reserved - 6C0000-6CFFFF 12 Reserved - 6D0000-6DFFFF 13 Reserved - 6E0000-6EFFFF 14 Reserved - 6F0000-6FFFFF 15 Reserved - -700000-7FFFFF - External I/O 1Mb - - Address Port Use - ------------------------- - 700000-70FFFF 16 Mainframe Port A - 710000-71FFFF 17 Mainframe Port B - 720000-72FFFF 18 Bus Expander Port A1 - 730000-73FFFF 19 Bus Expander Port A2 - 740000-74FFFF 20 Bus Expander Port A3 - 750000-75FFFF 21 Bus Expander Port A4 - 760000-76FFFF 22 Bus Expander Port A5 - 770000-77FFFF 23 Reserved - 780000-78FFFF 24 Reserved - 790000-79FFFF 25 Reserved - 7A0000-7AFFFF 26 Bus Expander Port B1 - 7B0000-7BFFFF 27 Bus Expander Port B2 - 7C0000-7CFFFF 28 Bus Expander Port B3 - 7D0000-7DFFFF 29 Bus Expander Port B4 - 7E0000-7EFFFF 30 Bus Expander Port B5 - 7F0000-7FFFFF 31 Reserved - -800000-EFFFFF - External RAM modules (up to 7Mb) -F00000-F7FFFF - Internal RAM 512Kb -F80000-FFFFFF - Reserved 512Kb - -Access to 800000-FFFFFF can be remapped by the MMU registers. - - -Interrupts ----------- -High Priority 7 - Soft reset from keyboard (NMI) - /\ 6 - RTC or NBIR3 (external I/O) - || 5 - Disc Drive or NBIR2 (external I/O) - || 4 - GPU or NBIR1 (external I/O) - || 3 - HP-IB, printer or NBIR0 (external I/O) - \/ 2 - HP-HIL devices (keyboard/mouse) -Low Priority 1 - RTC - -Note external interrupt lines NBIR0 to NBIR3 can be asserted by an interface connected to the external I/O port - - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" - - -class hp_ipc_state : public driver_device -{ -public: - hp_ipc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - - DECLARE_WRITE16_MEMBER(mmu_w); - DECLARE_READ16_MEMBER(ram_r); - DECLARE_WRITE16_MEMBER(ram_w); - -private: - required_device m_maincpu; - - UINT32 m_mmu[4]; - UINT16 m_internal_ram[0x40000]; - - inline UINT32 get_ram_address(offs_t offset) { return (m_mmu[(m_maincpu->get_fc() >> 1) & 3] + offset) & 0x3FFFFF; } -}; - - -static ADDRESS_MAP_START(hp_ipc_mem, AS_PROGRAM, 16, hp_ipc_state) - AM_RANGE(0x000000, 0x07FFFF) AM_ROM - AM_RANGE(0x600000, 0x60FFFF) AM_WRITE(mmu_w) - AM_RANGE(0x800000, 0xFFFFFF) AM_READWRITE(ram_r, ram_w) -ADDRESS_MAP_END - - -static INPUT_PORTS_START(hp_ipc) -INPUT_PORTS_END - - -WRITE16_MEMBER(hp_ipc_state::mmu_w) -{ - logerror("mmu_w: offset = %08x, data = %04x, register = %d, data_to_add = %08x\n", offset, data, offset & 3, (data & 0xFFF) << 10); - m_mmu[offset & 3] = (data & 0xFFF) << 10; -} - - -READ16_MEMBER(hp_ipc_state::ram_r) -{ - UINT32 ram_address = get_ram_address(offset); - - //logerror("RAM read, offset = %08x, ram address = %08X\n", offset, ram_address); - - if (ram_address < 0x380000) - { - // External RAM modules - } - else if (ram_address < 0x3c0000) - { - // Internal RAM - return m_internal_ram[offset & 0x3ffff]; - } - return 0xffff; -} - - -WRITE16_MEMBER(hp_ipc_state::ram_w) -{ - UINT32 ram_address = get_ram_address(offset); - - //logerror("RAM write, offset = %08x, ram address = %08X, data = %04x\n", offset, ram_address, data); - - if (ram_address < 0x380000) - { - // External RAM modules - } - else if (ram_address < 0x3c0000) - { - // Internal RAM - m_internal_ram[offset & 0x3ffff] = data; - } -} - - -static MACHINE_CONFIG_START(hp_ipc, hp_ipc_state) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 15920000 / 2) - MCFG_CPU_PROGRAM_MAP(hp_ipc_mem) -MACHINE_CONFIG_END - - -ROM_START(hp_ipc) - ROM_REGION(0x100000, "maincpu" , 0) - ROM_LOAD("hp ipc os 82991A.bin", 0x00000, 0x80000, BAD_DUMP CRC(df45a37b) SHA1(476af9923bca0d2d0f40aeb81be5145ca76fddf5)) // Should be spread across 4 x 128K ROMs -ROM_END - - -COMP(1985, hp_ipc, 0, 0, hp_ipc, hp_ipc, driver_device, 0, "HP", "Integral Personal Computer", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/hprot1.c b/src/mess/drivers/hprot1.c deleted file mode 100644 index 6cff402b711..00000000000 --- a/src/mess/drivers/hprot1.c +++ /dev/null @@ -1,381 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders: Felipe Sanches -/*************************************************************************** - - HENRY Prot I/II - brazilian document timestamp printers - http://www.dataponto.com.br/protocoladores-prot1.html - - Driver by Felipe Sanches - Technical info at https://www.garoa.net.br/wiki/HENRY - - Changelog: - - 2014 JUN 13 [Felipe Sanches]: - * new derivative "CARD I PCB rev.08A" - * new derivative "CARD II PCB rev.6" - * fixed LCD rendering (now both lines are displayed properly) - * inverted logic of the inputs so that now we can navigate the menu - - 2014 JAN 03 [Felipe Sanches]: - * Initial driver skeleton - * Address lines bitswaping - * LCD works. We can see boot messages. - * Inputs are not working correctly - -TO-DO list: - -======= hprotr8a =========== -Loops during boot displaying an error message related to low power supply voltage. -We need to emulate the ADM695AN chip (Microprocessor Supervisory Circuits) in order to properly boot the device. - -======= hprot2r6 =========== -There are unhandled memory writes at 0xE000 and 0xA000 - -LCD commands are sent, but nothing shows up on screen. -The commands sent are supposed to display the message: - -"*Pouca Energia*" (LCD cmds range: 80-8F) (cmds logged but not displayed on screen) -"* no Sistema *" (LCD cmds range: C0-CF) (cmds logged but not displayed on screen) - -which means something like "too little energy for the system to operate". -We need to emulate the ADM695AN chip (Microprocessor Supervisory Circuits) in order to properly boot the device. - -Infinite loop is reached at address 0x7699 -======= hprot1 =========== - - There seems to be an eeprom or a realtime clock placed at U2 (DIP8): - pin1 -> 8031 pin 14 (T0: Timer 0 external input) - pin2 -> crystal at X2 (labeled 32.768) - pin3 -> ? - pin4 -> GND - pin5 -> ? - pin6 -> 8031 pin 5 (Port 1 bit 4) - pin7 -> 8031 pin 4 (Port 1 bit 3) - pin8 -> VCC - -****************************************************************************/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "video/hd44780.h" -#include "sound/speaker.h" -#include "rendlay.h" - -class hprot1_state : public driver_device -{ -public: - hprot1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_lcdc(*this, "hd44780") - { } - - //DECLARE_WRITE8_MEMBER(henry_io_w); - DECLARE_READ8_MEMBER(henry_io_r); - DECLARE_DRIVER_INIT(hprot1); - DECLARE_PALETTE_INIT(hprot1); -private: - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_lcdc; -}; - -#define LOG_IO_PORTS 0 - -static ADDRESS_MAP_START(i80c31_prg, AS_PROGRAM, 8, hprot1_state) - AM_RANGE(0x0000, 0xffff) AM_ROM -ADDRESS_MAP_END - -DRIVER_INIT_MEMBER( hprot1_state, hprot1 ) -{ - int i; - UINT8 *ROM = memregion("maincpu")->base(); - UINT8 bitswapped_ROM[0x10000]; - - for(i=0x0000;i<0x10000;i++) - bitswapped_ROM[i] = ROM[i]; - - for(i=0x0000;i<0x10000;i++) - ROM[BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 3, 2, 1, 0, 4, 5, 6, 7)] = bitswapped_ROM[i]; -} - -//A4 = display RS -//A5 = display R/W -//(A11 == 0) && (A10 == 0) => display CS -//(A14 == 1) && (A15 == 1) => enable signal for the mux that selects peripherals -//11?? 00?? ??00 ???? write data -//11?? 00?? ??01 ???? write command -//11?? 00?? ??10 ???? read data -//11?? 00?? ??11 ???? read command -//mirror=0x33cf - -//write: 0xc400 => U12 (74373 - possibly for the dot matrix printhead ?) -//write: 0xc800 => U11 (74373 - possibly for the dot matrix printhead ?) -//read: 0xc020 => display -//write: 0xc000 => display -//write: 0xc010 => display - -//P1.4 => WhatchDog Input (after timeout resets CPU) - -static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, hprot1_state) - AM_RANGE(0x0000,0x7fff) AM_RAM -/*TODO: verify the mirror mask value for the HD44780 device */ - AM_RANGE(0xc000,0xc000) AM_MIRROR(0x13cf) AM_DEVWRITE("hd44780", hd44780_device, control_write) - AM_RANGE(0xc010,0xc010) AM_MIRROR(0x13cf) AM_DEVWRITE("hd44780", hd44780_device, data_write) - AM_RANGE(0xc020,0xc020) AM_MIRROR(0x13cf) AM_DEVREAD("hd44780", hd44780_device, control_read) - AM_RANGE(0xc030,0xc030) AM_MIRROR(0x13cf) AM_DEVREAD("hd44780", hd44780_device, data_read) -/*TODO: attach the watchdog/brownout reset device: - AM_RANGE(0xe000,0xe0??) AM_MIRROR(?) AM_DEVREAD("adm965an", adm965an_device, data_read) */ - - //AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(henry_io_r, henry_io_w) - AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(henry_io_r) -ADDRESS_MAP_END - -static INPUT_PORTS_START( hprot1 ) -/* FIXME: I am still unsure whether all these inputs are Active High or Active Low: */ - PORT_START("inputs") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Upper Black Button") PORT_CODE(KEYCODE_A) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Lower Black Button") PORT_CODE(KEYCODE_B) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Blue Button") PORT_CODE(KEYCODE_C) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Paper Detector") PORT_CODE(KEYCODE_D) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("XMIN Endstop") PORT_CODE(KEYCODE_E) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( hprot_jumpers ) -/* -There is a set of 3 jumpers that switch the communications circuitry between a -RS232 chip (U8: MAX232AN) and a differential bus transceiver (U7: SN65176BP) - -It seems that all three jumpers must select the same configuration: -eighter differential bus or RS232. -And I don't see yet how this could affect the emulation of the device, so, for now, I'll -simply leave this note here but not actually include this details in the driver code. - - PORT_START("jumpers") - PORT_DIPNAME( 0x01, 0x01, "TX") - PORT_DIPSETTING( 0x01, "differential bus") - PORT_DIPSETTING( 0x00, "RS232") - PORT_DIPNAME( 0x02, 0x02, "RX") - PORT_DIPSETTING( 0x02, "differential bus") - PORT_DIPSETTING( 0x00, "RS232") - PORT_DIPNAME( 0x04, 0x04, "CPU-TX") - PORT_DIPSETTING( 0x04, "differential bus") - PORT_DIPSETTING( 0x00, "RS232") -*/ -INPUT_PORTS_END - -/* TODO: meanings for the jumpers may be different among machines, - so we may have to have individual declarations for each board. */ -static INPUT_PORTS_START( hprot2r6 ) - PORT_INCLUDE(hprot1) - PORT_INCLUDE(hprot_jumpers) -INPUT_PORTS_END - -static INPUT_PORTS_START( hprotr8a ) - PORT_INCLUDE(hprot1) - PORT_INCLUDE(hprot_jumpers) -INPUT_PORTS_END - -void hprot1_state::machine_start() -{ -} - -void hprot1_state::machine_reset() -{ -} - -READ8_MEMBER(hprot1_state::henry_io_r) -{ - switch (offset) - { - case 0x01: - { - UINT8 value = ioport("inputs")->read(); -#if LOG_IO_PORTS - printf("value:%02X\n", value); -#endif - return value; - } - default: -#if LOG_IO_PORTS - printf("Unhandled I/O Read at offset 0x%02X (return 0)\n", offset); -#endif - return 0; - } -} - -/* -WRITE8_MEMBER(hprot1_state::henry_io_w) -{ - static UINT8 p0=0, p1=0, p2=0, p3=0; - switch (offset) - { - case 0x00: - { - if (data != p0) - { - p0=data; -#if LOG_IO_PORTS - printf("Write to P0: %02X\n", data); -#endif - } - break; - } - case 0x01: - { - if (data != p1) - { - p1=data; - if (data != 0xFF && data != 0xEF) -#if LOG_IO_PORTS - printf("Write to P1: %02X\n", data); -#endif - } - break; - } - case 0x02: - { - if (data != p2) - { - p2=data; -#if LOG_IO_PORTS - printf("Write to P2: %02X\n", data); -#endif - } - break; - } - case 0x03: - { - if (data != p3) - { - p3=data; -#if LOG_IO_PORTS - printf("Write to P3: %02X\n", data); -#endif - } - break; - } - } -} -*/ - -PALETTE_INIT_MEMBER(hprot1_state, hprot1) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static const gfx_layout henry_prot_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( hprot1 ) - GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, henry_prot_charlayout, 0, 1 ) -GFXDECODE_END - -static HD44780_PIXEL_UPDATE(hprot1_pixel_update) -{ - if ( pos < 16 && line==0 ) - { - bitmap.pix16(y, pos*6 + x) = state; - } - - if ( pos >= 64 && pos < 80 && line==0 ) - { - bitmap.pix16(y+9,(pos-64)*6 + x) = state; - } -} - -static MACHINE_CONFIG_START( hprot1, hprot1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80C31, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(i80c31_prg) - MCFG_CPU_IO_MAP(i80c31_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_SIZE(6*16, 9*2) - MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(hprot1_state, hprot1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", hprot1) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 16) - MCFG_HD44780_PIXEL_UPDATE_CB(hprot1_pixel_update) - - /* TODO: figure out which RTC chip is in use. */ - - /* TODO: emulate the ADM695AN chip (watchdog/brownout reset)*/ -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( hprotr8a, hprot1 ) - MCFG_CPU_REPLACE("maincpu", I80C31, 11059200) // value of X1 cristal on the PCB - MCFG_CPU_PROGRAM_MAP(i80c31_prg) - MCFG_CPU_IO_MAP(i80c31_io) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* TODO: add an RS232 interface (emulate MAX232N chip) - (the board has GND/VCC/RX/TX pins available in a connector) */ - - /* TODO: add an I2C interface (the board has GND/VCC/SDA/SCL pins available in a connector) */ -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( hprot2r6, hprot1 ) - MCFG_CPU_REPLACE("maincpu", I80C31, 11059200) // value of X1 cristal on the PCB - MCFG_CPU_PROGRAM_MAP(i80c31_prg) - MCFG_CPU_IO_MAP(i80c31_io) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* TODO: add an RS232 interface (emulate MAX232N chip) */ -MACHINE_CONFIG_END - -ROM_START( hprot1 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "henry_prot1_rev1_v19.bin", 0x00000, 0x10000, CRC(dd7787fd) SHA1(61a37dd406b3440d568bd6da75a9fdc8a0f0e1e3) ) -ROM_END - -ROM_START( hprotr8a ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "hprot_card1_rev08a.u2", 0x00000, 0x10000, CRC(e827480f) SHA1(bd53e6cce9a0832ca01f1a485ddaab43c0baa136) ) -ROM_END - -ROM_START( hprot2r6 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "hprot_card2_rev6.u2", 0x00000, 0x10000, CRC(791f2425) SHA1(70af8911a27921cac6d98a5cd07602a7f59c2848) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 2002, hprot1, 0, 0, hprot1, hprot1, hprot1_state, hprot1, "HENRY", "Henry Prot I v19 (REV.1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) -/* fw version: "R19" Release date: February 1st, 2002. */ - -COMP( 2006, hprotr8a, hprot1, 0, hprotr8a, hprotr8a, hprot1_state, hprot1, "HENRY", "Henry Prot CARD I (REV.08A)", MACHINE_NOT_WORKING) -/* fw version: "V6.5QI I" Release date: September 18th, 2006. */ - -COMP( 2003, hprot2r6, hprot1, 0, hprot2r6, hprot2r6, hprot1_state, hprot1, "HENRY", "Henry Prot CARD II (REV.6)", MACHINE_NOT_WORKING) -/* fw version: "V5.8CF II" Release date: June 23rd, 2003. */ diff --git a/src/mess/drivers/hpz80unk.c b/src/mess/drivers/hpz80unk.c deleted file mode 100644 index 170aaabd55b..00000000000 --- a/src/mess/drivers/hpz80unk.c +++ /dev/null @@ -1,159 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -HP Z80-based unknown in a large metal cage - -2012-05-25 Skeleton driver [Robbbert] - -http://www.classiccmp.org/hp/unknown Z80 computer/ - -Looks like roms are in 2 banks in range C000-FFFF. -BASIC is included, if we can find out how to access it. - -Commands: -A disassemble -D -G -H -L -M -P Read Port -R -U -W Punch papertape -X choose Q,V,R,P (Q to quit; others ask for ram and prom ranges) -Y nothing -Z nothing - - ToDo: - - Almost everything; there are a lot of I/O ports used - - Hook up rom banking - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class hpz80unk_state : public driver_device -{ -public: - hpz80unk_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_p_rom(*this, "p_rom") - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(port02_r); - DECLARE_READ8_MEMBER(port03_r); - DECLARE_READ8_MEMBER(port04_r); - DECLARE_READ8_MEMBER(portfc_r); - DECLARE_WRITE8_MEMBER(kbd_put); - required_shared_ptr m_p_rom; - UINT8 m_term_data; - UINT8 m_port02_data; - virtual void machine_reset(); -}; - -READ8_MEMBER( hpz80unk_state::port02_r ) -{ - m_port02_data ^= 1; - return m_port02_data; -} - -READ8_MEMBER( hpz80unk_state::port03_r ) -{ - return (m_term_data) ? 0xff : 0xfd; -} - -READ8_MEMBER( hpz80unk_state::port04_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( hpz80unk_state::portfc_r ) -{ - return 0xfe; // or it halts -} - -static ADDRESS_MAP_START( hpz80unk_mem, AS_PROGRAM, 8, hpz80unk_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xbfff) AM_RAM - AM_RANGE(0xc000, 0xffff) AM_ROM AM_SHARE("p_rom") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( hpz80unk_io, AS_IO, 8, hpz80unk_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x01, 0x01) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x02, 0x02) AM_READ(port02_r) - AM_RANGE(0x03, 0x03) AM_READ(port03_r) - AM_RANGE(0x04, 0x04) AM_READ(port04_r) - AM_RANGE(0xfc, 0xfc) AM_READ(portfc_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( hpz80unk ) -INPUT_PORTS_END - - -void hpz80unk_state::machine_reset() -{ - UINT8* user1 = memregion("user1")->base(); - memcpy((UINT8*)m_p_rom, user1, 0x4000); - - // this should be rom/ram banking -} - -WRITE8_MEMBER( hpz80unk_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( hpz80unk, hpz80unk_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(hpz80unk_mem) - MCFG_CPU_IO_MAP(hpz80unk_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(hpz80unk_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( hpz80unk ) - ROM_REGION( 0x8000, "user1", 0 ) - // 1st bank - ROM_LOAD( "u1", 0x0000, 0x0800, CRC(080cd04a) SHA1(42004af65d44e3507a4e0f343c5bf385b6377c40) ) - ROM_LOAD( "u3", 0x0800, 0x0800, CRC(694075e1) SHA1(3db62645ade6a7f454b2d505aecc1661284c8ce2) ) - ROM_LOAD( "u5", 0x1000, 0x0800, CRC(5573bd05) SHA1(68c8f02b3fe9d77ecb83df407ca78430e118004a) ) - ROM_LOAD( "u7", 0x1800, 0x0800, CRC(d18a304a) SHA1(69dd0486bb6e4c2a22ab9da863bfb962016a321b) ) - ROM_LOAD( "u9", 0x2000, 0x0800, CRC(f7a8665c) SHA1(e39d0ba4ce2dc773622d411a25f40a6a24b45449) ) - ROM_LOAD( "u11", 0x2800, 0x0800, CRC(6c1ac77a) SHA1(50ca04ff0a11bd1c7d96f4731cef50978266ecca) ) - ROM_LOAD( "u13", 0x3000, 0x0800, CRC(8b166911) SHA1(4301dcd6840d37ccfa5bff998a0d88bebe99dc31) ) - ROM_LOAD( "u15", 0x3800, 0x0800, CRC(c6300499) SHA1(1b62d2a85c8f0b6a817e4be73ee34e0d90515c00) ) - // 2nd bank - ROM_LOAD( "u2", 0x4000, 0x0800, CRC(080cd04a) SHA1(42004af65d44e3507a4e0f343c5bf385b6377c40) ) - ROM_LOAD( "u4", 0x4800, 0x0800, CRC(66c3745c) SHA1(d79fe764312a222ac64d325bf5f4abc7ca401d0f) ) - ROM_LOAD( "u6", 0x5000, 0x0800, CRC(80761b4c) SHA1(5f6a12fbba533308b9fe7067c67a836be436a6f0) ) - ROM_LOAD( "u8", 0x5800, 0x0800, CRC(64a2be18) SHA1(b11c08fdc9dc126038559462493f458ecdc78532) ) - ROM_LOAD( "u10", 0x6000, 0x0800, CRC(40244d09) SHA1(106f8f978de36df9f3ebbe1e2c959b60e53273a2) ) - ROM_LOAD( "u12", 0x6800, 0x0800, CRC(6eb01765) SHA1(66f9036a9f86cf3a79493330bbc06fb6932ab771) ) - ROM_LOAD( "u14", 0x7000, 0x0800, CRC(3410e682) SHA1(30d94c0c0b6478dab202a603edaccca943008e35) ) - ROM_LOAD( "u16", 0x7800, 0x0800, CRC(c03fdcab) SHA1(1081d787085add489c6e2a1d450e1a5790d18885) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, hpz80unk, 0, 0, hpz80unk, hpz80unk, driver_device, 0, "Hewlett-Packard", "unknown Z80-based mainframe", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/ht68k.c b/src/mess/drivers/ht68k.c deleted file mode 100644 index 203ec4c8280..00000000000 --- a/src/mess/drivers/ht68k.c +++ /dev/null @@ -1,160 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Hawthorne Technology TinyGiant HT68k - - 29/11/2009 Skeleton driver. - -Monitor commands (from ht68k manual) (must be in Uppercase) -B Load binary file from disk. -C Compare memory. -D Display memory in Hex and ASCII. -E Examine and/or change memory (2 bytes). (. to escape) -F Fill a block of memory with a value. -G Go to an address and execute program. -K Peek. -L Load program from serial port. -M Move memory. -P Poke. -R Read binary file from disk. -S System boot. -T Test printer. -W Write binary file to disk. -X Examine long and/or change memory (4 bytes). (. to escape) - - -Lot of infos available at: http://www.classiccmp.org/cini/ht68k.htm - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "machine/mc68681.h" -#include "machine/wd_fdc.h" - -class ht68k_state : public driver_device -{ -public: - ht68k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_duart(*this, "duart68681"), - m_fdc(*this, "wd1770"), - m_floppy0(*this, "wd1770:0"), - m_floppy1(*this, "wd1770:1"), - m_floppy2(*this, "wd1770:2"), - m_floppy3(*this, "wd1770:3"), - m_floppy(NULL), - m_p_ram(*this, "p_ram") - { - } - - required_device m_maincpu; - required_device m_duart; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - floppy_image_device *m_floppy; - DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); - DECLARE_WRITE_LINE_MEMBER(duart_txb); - DECLARE_WRITE8_MEMBER(duart_output); - required_shared_ptr m_p_ram; - virtual void machine_reset(); -}; - - -static ADDRESS_MAP_START(ht68k_mem, AS_PROGRAM, 16, ht68k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_SHARE("p_ram") // 512 KB RAM / ROM at boot - //AM_RANGE(0x00080000, 0x000fffff) // Expansion - //AM_RANGE(0x00d80000, 0x00d8ffff) // Printer - AM_RANGE(0x00e00000, 0x00e00007) AM_MIRROR(0xfff8) AM_DEVREADWRITE8("wd1770", wd1770_t, read, write, 0x00ff) // FDC WD1770 - AM_RANGE(0x00e80000, 0x00e800ff) AM_MIRROR(0xff00) AM_DEVREADWRITE8("duart68681", mc68681_device, read, write, 0xff ) - AM_RANGE(0x00f00000, 0x00f07fff) AM_ROM AM_MIRROR(0xf8000) AM_REGION("user1",0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ht68k ) -INPUT_PORTS_END - -void ht68k_state::machine_reset() -{ - UINT8* user1 = memregion("user1")->base(); - - memcpy((UINT8*)m_p_ram.target(),user1,0x8000); - - m_maincpu->reset(); - - m_fdc->reset(); - m_fdc->set_floppy(NULL); -} - -WRITE_LINE_MEMBER(ht68k_state::duart_irq_handler) -{ - m_maincpu->set_input_line_and_vector(M68K_IRQ_3, state, M68K_INT_ACK_AUTOVECTOR); -} - -WRITE_LINE_MEMBER(ht68k_state::duart_txb) -{ - //This is the second serial channel named AUX, for modem or other serial devices. -} - -WRITE8_MEMBER(ht68k_state::duart_output) -{ - m_floppy = NULL; - - if ((BIT(data, 7)) == 0) { m_floppy = m_floppy0->get_device(); } - if ((BIT(data, 6)) == 0) { m_floppy = m_floppy1->get_device(); } - if ((BIT(data, 5)) == 0) { m_floppy = m_floppy2->get_device(); } - if ((BIT(data, 4)) == 0) { m_floppy = m_floppy3->get_device(); } - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) {m_floppy->ss_w(BIT(data,3) ? 0 : 1);} -} - -static SLOT_INTERFACE_START( ht68k_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( ht68k, ht68k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M68000, XTAL_8MHz) - MCFG_CPU_PROGRAM_MAP(ht68k_mem) - - /* video hardware */ - MCFG_MC68681_ADD( "duart68681", XTAL_8MHz / 2 ) - MCFG_MC68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(ht68k_state, duart_irq_handler)) - MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_MC68681_B_TX_CALLBACK(WRITELINE(ht68k_state, duart_txb)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(ht68k_state, duart_output)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duart68681", mc68681_device, rx_a_w)) - - MCFG_WD1770_ADD("wd1770", XTAL_8MHz ) - - MCFG_FLOPPY_DRIVE_ADD("wd1770:0", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1770:1", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1770:2", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1770:3", ht68k_floppies, "525dd", floppy_image_device::default_floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop525_list", "ht68k") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ht68k ) - ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "ht68k-u4.bin", 0x0000, 0x4000, CRC(3fbcdd0a) SHA1(45fcbbf920dc1e9eada3b7b0a55f5720d08ffdd5)) - ROM_LOAD16_BYTE( "ht68k-u3.bin", 0x0001, 0x4000, CRC(1d85d101) SHA1(8ba01e1595b0b3c4fb128a4a50242f3588b89c43)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, ht68k, 0, 0, ht68k, ht68k, driver_device, 0, "Hawthorne Technology", "TinyGiant HT68k", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/huebler.c b/src/mess/drivers/huebler.c deleted file mode 100644 index c97f5aafefc..00000000000 --- a/src/mess/drivers/huebler.c +++ /dev/null @@ -1,398 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Ausbaufaehiger Mikrocomputer mit dem U 880 - electronica Band 227/228 - -****************************************************************************/ - -/* - - TODO: - - - keyboard repeat - - shift lock is not PORT_TOGGLE, instead RS flipflop - - tone generator - - cassette serial clock - - eprom programmer - - power off - -*/ - -#include "includes/huebler.h" - -/* Keyboard */ - -void amu880_state::scan_keyboard() -{ - UINT8 data = m_key_row[m_key_a8 ? m_key_d6 : m_key_d7]->read(); - - int a8 = (data & 0x0f) == 0x0f; - - if (m_key_a8 && !a8) - { - m_key_d7 = m_key_d6; - m_key_a4 = !(BIT(data, 1) && BIT(data, 3)); - m_key_a5 = !(BIT(data, 2) && BIT(data, 3)); - } - - m_key_a8 = a8; - - m_key_d6++; - - if (m_key_d6 == 16) - { - m_key_d6 = 0; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(amu880_state::keyboard_tick) -{ - scan_keyboard(); -} - -/* Read/Write Handlers */ - -READ8_MEMBER( amu880_state::keyboard_r ) -{ - /* - - A0..A3 Y - A4 !(X0&X3) - A5 !(X2&X3) - A6 shift - A7 ctrl - A8 key pressed - A9 AB0 - - */ - - UINT8 special = m_special->read(); - - int ctrl = BIT(special, 0); - int shift = BIT(special, 2) & BIT(special, 1); - int ab0 = BIT(offset, 0); - - UINT16 address = (ab0 << 9) | (m_key_a8 << 8) | (ctrl << 7) | (shift << 6) | (m_key_a5 << 5) | (m_key_a4 << 4) | m_key_d7; - - return m_kb_rom->base()[address]; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( amu880_mem, AS_PROGRAM, 8, amu880_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xe7ff) AM_RAM - AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0xf000, 0xfbff) AM_ROM - AM_RANGE(0xfc00, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( amu880_io, AS_IO, 8, amu880_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -// AM_RANGE(0x00, 0x00) AM_MIRROR(0x03) AM_WRITE(power_off_w) -// AM_RANGE(0x04, 0x04) AM_MIRROR(0x02) AM_WRITE(tone_off_w) -// AM_RANGE(0x05, 0x05) AM_MIRROR(0x02) AM_WRITE(tone_on_w) - AM_RANGE(0x08, 0x09) AM_MIRROR(0x02) AM_READ(keyboard_r) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_device, read_alt, write_alt) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_device, read_alt, write_alt) - AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( amu880 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_END) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('?') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) // <-| - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('@') PORT_CHAR('\\') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y11") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y12") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('_') PORT_CHAR('|') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y13") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y14") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y15") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE -INPUT_PORTS_END - -/* Video */ - -UINT32 amu880_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int y, sx, x, line; - const pen_t *pen = m_palette->pens(); - - for (y = 0; y < 240; y++) - { - line = y % 10; - - for (sx = 0; sx < 64; sx++) - { - UINT16 videoram_addr = ((y / 10) * 64) + sx; - UINT8 videoram_data = m_video_ram[videoram_addr & 0x7ff]; - - UINT16 charrom_addr = ((videoram_data & 0x7f) << 3) | line; - UINT8 data = m_char_rom->base()[charrom_addr & 0x3ff]; - - for (x = 0; x < 6; x++) - { - int color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); - - bitmap.pix32(y, (sx * 6) + x) = pen[color]; - - data <<= 1; - } - } - } - - return 0; -} - -/* Z80-CTC Interface */ - -WRITE_LINE_MEMBER(amu880_state::ctc_z0_w) -{ -} - -WRITE_LINE_MEMBER(amu880_state::ctc_z2_w) -{ - /* cassette transmit/receive clock */ -} - -/* Z80-SIO Interface */ - -TIMER_DEVICE_CALLBACK_MEMBER( amu880_state::tape_tick ) -{ - m_z80sio->rxa_w(m_cassette->input() < 0.0); -} - -WRITE_LINE_MEMBER(amu880_state::cassette_w) -{ - m_cassette->output(state ? -1.0 : +1.0); -} - -/* Z80 Daisy Chain */ - -static const z80_daisy_config amu880_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80SIO_TAG }, - { Z80PIO1_TAG }, - { Z80PIO2_TAG }, - { NULL } -}; - -/* Machine Initialization */ - -void amu880_state::machine_start() -{ - // find keyboard rows - m_key_row[0] = m_y0; - m_key_row[1] = m_y1; - m_key_row[2] = m_y2; - m_key_row[3] = m_y3; - m_key_row[4] = m_y4; - m_key_row[5] = m_y5; - m_key_row[6] = m_y6; - m_key_row[7] = m_y7; - m_key_row[8] = m_y8; - m_key_row[9] = m_y9; - m_key_row[10] = m_y10; - m_key_row[11] = m_y11; - m_key_row[12] = m_y12; - m_key_row[13] = m_y13; - m_key_row[14] = m_y14; - m_key_row[15] = m_y15; - - /* register for state saving */ - save_item(NAME(m_key_d6)); - save_item(NAME(m_key_d7)); - save_item(NAME(m_key_a4)); - save_item(NAME(m_key_a5)); - save_item(NAME(m_key_a8)); -} - -/* Machine Driver */ - -/* F4 Character Displayer */ -static const gfx_layout amu880_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( amu880 ) - GFXDECODE_ENTRY( "chargen", 0x0000, amu880_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( amu880, amu880_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10MHz/4) // U880D - MCFG_CPU_PROGRAM_MAP(amu880_mem) - MCFG_CPU_IO_MAP(amu880_io) - MCFG_CPU_CONFIG(amu880_daisy_chain) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", amu880_state, keyboard_tick, attotime::from_hz(1500)) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(amu880_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(9000000, 576, 0*6, 64*6, 320, 0*10, 24*10) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", amu880) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_10MHz/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(amu880_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(amu880_state, ctc_z2_w)) - - MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, XTAL_10MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, XTAL_10MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_10MHz/4, 0, 0, 0, 0) // U856 - MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(amu880_state, cassette_w)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", amu880_state, tape_tick, attotime::from_hz(44100)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( amu880 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "v21" ) - ROM_SYSTEM_BIOS( 0, "v21", "H.MON v2.1" ) - ROMX_LOAD( "mon21a.bin", 0xf000, 0x0400, NO_DUMP, ROM_BIOS(1) ) - ROMX_LOAD( "mon21b.bin", 0xf400, 0x0400, NO_DUMP, ROM_BIOS(1) ) - ROMX_LOAD( "mon21c.bin", 0xf800, 0x0400, NO_DUMP, ROM_BIOS(1) ) - ROMX_LOAD( "mon21.bin", 0xf000, 0x0bdf, BAD_DUMP CRC(ba905563) SHA1(1fa0aeab5428731756bdfa74efa3c664898bf083), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v30", "H.MON v3.0" ) - ROMX_LOAD( "mon30.bin", 0xf000, 0x1000, CRC(033f8112) SHA1(0c6ae7b9d310dec093652db6e8ae84f8ebfdcd29), ROM_BIOS(2) ) - - ROM_REGION( 0x4800, "hbasic", 0 ) - ROM_LOAD( "mon30p_hbasic33p.bin", 0x0000, 0x4800, CRC(c927e7be) SHA1(2d1f3ff4d882c40438a1281872c6037b2f07fdf2) ) - - ROM_REGION( 0x400, "chargen", 0 ) - ROM_LOAD( "hemcfont.bin", 0x0000, 0x0400, CRC(1074d103) SHA1(e558279cff5744acef4eccf30759a9508b7f8750) ) - - ROM_REGION( 0x400, "keyboard", 0 ) - ROM_LOAD( "keyboard.bin", 0x0000, 0x0400, BAD_DUMP CRC(daa06361) SHA1(b0299bd8d1686e05dbeeaed54f6c41ae543be20c) ) // typed in from manual -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, amu880, 0, 0, amu880, amu880, driver_device, 0, "Militaerverlag der DDR", "Ausbaufaehiger Mikrocomputer mit dem U 880", MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/hunter2.c b/src/mess/drivers/hunter2.c deleted file mode 100644 index 75eb60c6115..00000000000 --- a/src/mess/drivers/hunter2.c +++ /dev/null @@ -1,442 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert,Barry Rodewald -/*************************************************************************** - - Skeleton driver for Husky Hunter 2 - - 2014-03-06 Skeleton [Robbbert] - 2014-03-07 Fixed screen [Barry Rodewald] - 2014-03-07 Added more stuff [Robbbert] - - http://www.seasip.info/VintagePC/husky2.html - - No schematics or manuals available. - - TODO: - - Add ports 83 and 85 - - Need software - - Add whatever image devices existed - - Probably lots of other stuff - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/hd61830.h" -#include "machine/mm58274c.h" -#include "rendlay.h" -#include "sound/speaker.h" -#include "machine/nsc810.h" -#include "bus/rs232/rs232.h" -#include "machine/nvram.h" -#include "machine/bankdev.h" - -class hunter2_state : public driver_device -{ -public: - hunter2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_speaker(*this, "speaker") - , m_rs232(*this, "serial") - , m_rom(*this, "roms") - , m_ram(*this, "rams") - , m_nvram(*this, "nvram") - , m_bank1(*this, "bank1") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - { } - - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_READ8_MEMBER(serial_dsr_r); - DECLARE_WRITE8_MEMBER(keyboard_w); - DECLARE_READ8_MEMBER(serial_rx_r); - DECLARE_WRITE8_MEMBER(display_ctrl_w); - DECLARE_WRITE8_MEMBER(port80_w); - DECLARE_WRITE8_MEMBER(serial_tx_w); - DECLARE_WRITE8_MEMBER(serial_dtr_w); - DECLARE_WRITE8_MEMBER(serial_rts_w); - DECLARE_WRITE8_MEMBER(speaker_w); - DECLARE_WRITE8_MEMBER(irqctrl_w); - DECLARE_WRITE8_MEMBER(memmap_w); - DECLARE_PALETTE_INIT(hunter2); - DECLARE_DRIVER_INIT(hunter2); - DECLARE_WRITE_LINE_MEMBER(timer0_out); - DECLARE_WRITE_LINE_MEMBER(timer1_out); - DECLARE_WRITE_LINE_MEMBER(cts_w); - DECLARE_WRITE_LINE_MEMBER(rxd_w); - -private: - UINT8 m_keydata; - UINT8 m_irq_mask; - virtual void machine_reset(); - required_device m_maincpu; - required_device m_speaker; - required_device m_rs232; - required_memory_region m_rom; - required_memory_region m_ram; - required_device m_nvram; - required_device m_bank1; - required_device m_bank2; - required_device m_bank3; -}; - -static ADDRESS_MAP_START(hunter2_banked_mem, AS_PROGRAM, 8, hunter2_state) - AM_RANGE(0x00000, 0x2ffff) AM_ROM AM_REGION("roms", 0x0000) - AM_RANGE(0x30000, 0x3ffff) AM_NOP - AM_RANGE(0x40000, 0xfffff) AM_RAM AM_REGION("rams", 0x0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(hunter2_mem, AS_PROGRAM, 8, hunter2_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) - AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("bank2", address_map_bank_device, read8, write8) - AM_RANGE(0x8000, 0xbfff) AM_DEVREADWRITE("bank3", address_map_bank_device, read8, write8) - AM_RANGE(0xc000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(hunter2_io, AS_IO, 8, hunter2_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x1f) AM_DEVREADWRITE("iotimer", nsc810_device, read, write) - AM_RANGE(0x20, 0x20) AM_DEVWRITE("lcdc", hd61830_device, data_w) - AM_RANGE(0x21, 0x21) AM_DEVREADWRITE("lcdc", hd61830_device, status_r, control_w) - AM_RANGE(0x3e, 0x3e) AM_DEVREAD("lcdc", hd61830_device, data_r) - AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("rtc", mm58274c_device, read, write) - AM_RANGE(0x60, 0x60) AM_WRITE(display_ctrl_w) - AM_RANGE(0x80, 0x80) AM_WRITE(port80_w) - AM_RANGE(0x81, 0x81) AM_WRITE(serial_tx_w) - AM_RANGE(0x82, 0x82) AM_WRITE(serial_dtr_w) - AM_RANGE(0x84, 0x84) AM_WRITE(serial_rts_w) - AM_RANGE(0x86, 0x86) AM_WRITE(speaker_w) - AM_RANGE(0xbb, 0xbb) AM_WRITE(irqctrl_w) - AM_RANGE(0xe0, 0xe0) AM_WRITE(memmap_w) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( hunter2 ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc/Brk") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lbl/Ins") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') -INPUT_PORTS_END - -READ8_MEMBER( hunter2_state::keyboard_r ) -{ - UINT8 i,data = 0xff; - for (i = 0; i < 7; i++) - { - if (!BIT(m_keydata, i)) - { - char kbdrow[6]; - sprintf(kbdrow,"X%d", i); - data &= ioport(kbdrow)->read(); - } - } - return data; -} - -READ8_MEMBER( hunter2_state::serial_dsr_r ) -{ - UINT8 res = 0x00; - - if(m_rs232->dsr_r()) - res |= 0x80; - - return res; -} - -WRITE8_MEMBER( hunter2_state::keyboard_w ) -{ - m_keydata = data; - //logerror("Key row select %02x\n",data); -} - -READ8_MEMBER( hunter2_state::serial_rx_r ) -{ - UINT8 res = 0x28; - - if(m_rs232->rxd_r()) - res |= 0x01; - if(m_rs232->dcd_r()) - res |= 0x02; - - return res; -} - -WRITE8_MEMBER( hunter2_state::display_ctrl_w ) -{ -/* according to the website, -Bit 2: Backlight toggle -Bits 1,0,7,6: Contrast level. -00 is being written here -*/ -} - -WRITE8_MEMBER( hunter2_state::port80_w ) -{ -} - -WRITE8_MEMBER( hunter2_state::serial_tx_w ) -{ - m_rs232->write_txd(data & 0x01); -// logerror("TXD write %02x\n",data); -} - -WRITE8_MEMBER( hunter2_state::serial_dtr_w ) -{ - m_rs232->write_dtr(data & 0x01); -// logerror("DTR write %02x\n",data); -} - -WRITE8_MEMBER( hunter2_state::serial_rts_w ) -{ - m_rs232->write_rts(data & 0x01); -// logerror("RTS write %02x\n",data); -} - -WRITE8_MEMBER( hunter2_state::speaker_w ) -{ - m_speaker->level_w(BIT(data, 0)); -} - -/* -Bit 0 = Enable normal interrupts -Bit 1 = Enable RSTC interrupts -Bit 2 = Enable RSTB interrupts -Bit 3 = Enable RSTA interrupts -*/ -WRITE8_MEMBER( hunter2_state::irqctrl_w ) -{ - m_irq_mask = data; - if(!(data & 0x08)) - m_maincpu->set_input_line(NSC800_RSTA, CLEAR_LINE); - if(!(data & 0x04)) - m_maincpu->set_input_line(NSC800_RSTB, CLEAR_LINE); - if(!(data & 0x02)) - m_maincpu->set_input_line(NSC800_RSTC, CLEAR_LINE); -} - -/* -data bank0 bank1 bank2 -00 00 01 02 -01 00 01 03 -02 00 01 04 -.... -09 00 01 11 -80 16 17 18 -.... -8F 61 62 63 -*/ -WRITE8_MEMBER( hunter2_state::memmap_w ) -{ - if (data < 0x0a) - { - m_bank1->set_bank(0); - m_bank2->set_bank(1); - m_bank3->set_bank(2 + data); - } - else - if (data >= 0x80) - { - UINT8 bank = data & 0x0f; - m_bank1->set_bank(16 + (bank*3)); - m_bank2->set_bank(17 + (bank*3)); - m_bank3->set_bank(18 + (bank*3)); - } -} - -void hunter2_state::machine_reset() -{ - m_keydata = 0xff; - m_irq_mask = 0; - m_bank1->set_bank(0); - m_bank2->set_bank(1); - m_bank3->set_bank(2); -} - -// it is presumed that writing to rom will go nowhere -DRIVER_INIT_MEMBER( hunter2_state, hunter2 ) -{ - UINT8 *ram = m_ram->base(); - - m_nvram->set_base(ram,m_ram->bytes()); -} - -PALETTE_INIT_MEMBER(hunter2_state, hunter2) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -WRITE_LINE_MEMBER(hunter2_state::timer0_out) -{ - if(state == ASSERT_LINE) - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -WRITE_LINE_MEMBER(hunter2_state::timer1_out) -{ - if(m_irq_mask & 0x08) - m_maincpu->set_input_line(NSC800_RSTA, state); -} - -WRITE_LINE_MEMBER(hunter2_state::cts_w) -{ - if(BIT(m_irq_mask, 1)) - { - m_maincpu->set_input_line(NSC800_RSTC, state); - popmessage("CTS: RSTC set %i\n",state); - } -} - -WRITE_LINE_MEMBER(hunter2_state::rxd_w) -{ - if(BIT(m_irq_mask, 2)) - m_maincpu->set_input_line(NSC800_RSTB, ASSERT_LINE); -} - -static MACHINE_CONFIG_START( hunter2, hunter2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NSC800, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(hunter2_mem) - MCFG_CPU_IO_MAP(hunter2_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(80) - MCFG_SCREEN_UPDATE_DEVICE("lcdc", hd61830_device, screen_update) - MCFG_SCREEN_SIZE(240, 128) - MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 63) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(hunter2_state, hunter2) - MCFG_DEVICE_ADD("lcdc", HD61830, XTAL_4_9152MHz/2/2) // unknown clock - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("rtc", MM58274C, 0) - // this is all a guess - MCFG_MM58274C_MODE24(0) // 12 hour - MCFG_MM58274C_DAY1(1) // monday - - MCFG_NSC810_ADD("iotimer",XTAL_4MHz,XTAL_4MHz) - MCFG_NSC810_PORTA_READ(READ8(hunter2_state,keyboard_r)) - MCFG_NSC810_PORTB_READ(READ8(hunter2_state,serial_dsr_r)) - MCFG_NSC810_PORTB_WRITE(WRITE8(hunter2_state,keyboard_w)) - MCFG_NSC810_PORTC_READ(READ8(hunter2_state,serial_rx_r)) - MCFG_NSC810_TIMER0_OUT(WRITELINE(hunter2_state,timer0_out)) - MCFG_NSC810_TIMER1_OUT(WRITELINE(hunter2_state,timer1_out)) - - MCFG_RS232_PORT_ADD("serial",default_rs232_devices,NULL) - MCFG_RS232_CTS_HANDLER(WRITELINE(hunter2_state,cts_w)) - MCFG_RS232_RXD_HANDLER(WRITELINE(hunter2_state,rxd_w)) - - MCFG_NVRAM_ADD_0FILL("nvram") - - MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(hunter2_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_DEVICE_ADD("bank2", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(hunter2_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_DEVICE_ADD("bank3", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(hunter2_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( hunter2 ) - ROM_REGION(0x30000, "roms", ROMREGION_ERASEFF) // board has space for 6 roms, but only 2 are populated normally - ROM_LOAD( "tr032kx8mrom0.ic50", 0x0000, 0x8000, CRC(694d252c) SHA1(b11dbf24faf648596d92b1823e25a8e4fb7f542c) ) - ROM_LOAD( "tr032kx8mrom1.ic51", 0x8000, 0x8000, CRC(82901642) SHA1(d84f2bbd2e9e052bd161a313c240a67918f774ad) ) - - // 48 x 4k blocks plus 1 sinkhole - ROM_REGION(0xc4000, "rams", ROMREGION_ERASEVAL(0xa5)) // board can have up to 736k of ram, but 192k is standard -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, hunter2, 0, 0, hunter2, hunter2, hunter2_state, hunter2, "Husky", "Hunter 2", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/hx20.c b/src/mess/drivers/hx20.c deleted file mode 100644 index bc39844c973..00000000000 --- a/src/mess/drivers/hx20.c +++ /dev/null @@ -1,922 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Epson HX-20 - - http://fjkraan.home.xs4all.nl/comp/hx20/ - -****************************************************************************/ - -/* - - TODO: - - - m6800.c rewrite - - keyboard interrupt - - LCD controller - - serial - - SW6 read - - RS-232 - - microcassette - - printer - - ROM cartridge - - floppy TF-20 - - barcode reader - -*/ - -#include "includes/hx20.h" - - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// update_interrupt - -//------------------------------------------------- - -void hx20_state::update_interrupt() -{ - int irq = m_rtc_irq || m_kbrequest; - - m_maincpu->set_input_line(M6800_IRQ_LINE, irq); -} - - -//------------------------------------------------- -// ksc_w - -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::ksc_w ) -{ - logerror("KSC %02x\n", data); - - m_ksc = data; -} - - -//------------------------------------------------- -// krtn07_r - -//------------------------------------------------- - -READ8_MEMBER( hx20_state::krtn07_r ) -{ - UINT8 data = 0xff; - - if (!BIT(m_ksc, 0)) data &= m_ksc0->read(); - if (!BIT(m_ksc, 1)) data &= m_ksc1->read(); - if (!BIT(m_ksc, 2)) data &= m_ksc2->read(); - if (!BIT(m_ksc, 3)) data &= m_ksc3->read(); - if (!BIT(m_ksc, 4)) data &= m_ksc4->read(); - if (!BIT(m_ksc, 5)) data &= m_ksc5->read(); - if (!BIT(m_ksc, 6)) data &= m_ksc6->read(); - if (!BIT(m_ksc, 7)) data &= m_ksc7->read(); - - return data; -} - - -//------------------------------------------------- -// krtn89_r - -//------------------------------------------------- - -READ8_MEMBER( hx20_state::krtn89_r ) -{ - /* - - bit description - - 0 KRTN8 - 1 KRTN9 - 2 - 3 - 4 - 5 - 6 _PWSW - 7 _BUSY - - */ - - UINT8 data = 0xff; - - if (!BIT(m_ksc, 0)) data &= m_ksc0->read() >> 8; - if (!BIT(m_ksc, 1)) data &= m_ksc1->read() >> 8; - if (!BIT(m_ksc, 2)) data &= m_ksc2->read() >> 8; - if (!BIT(m_ksc, 3)) data &= m_ksc3->read() >> 8; - if (!BIT(m_ksc, 4)) data &= m_ksc4->read() >> 8; - if (!BIT(m_ksc, 5)) data &= m_ksc5->read() >> 8; - if (!BIT(m_ksc, 6)) data &= m_ksc6->read() >> 8; - if (!BIT(m_ksc, 7)) data &= m_ksc7->read() >> 8; - - return data; -} - - -//------------------------------------------------- -// lcd_cs_w - -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::lcd_cs_w ) -{ - /* - - bit description - - 0 LCD CS bit 0 - 1 LCD CS bit 1 - 2 LCD CS bit 2 - 3 LCD C/_D - 4 KEY INT MASK - 5 SERIAL POUT - 6 MO1 - 7 MO2 - - */ - - logerror("LCD CS %02x\n", data); - - // LCD - m_lcdc0->cs_w(1); - m_lcdc1->cs_w(1); - m_lcdc2->cs_w(1); - m_lcdc3->cs_w(1); - m_lcdc4->cs_w(1); - m_lcdc5->cs_w(1); - - switch (data & 0x07) - { - case 1: m_lcdc0->cs_w(0); break; - case 2: m_lcdc1->cs_w(0); break; - case 3: m_lcdc2->cs_w(0); break; - case 4: m_lcdc3->cs_w(0); break; - case 5: m_lcdc4->cs_w(0); break; - case 6: m_lcdc5->cs_w(0); break; - } - - int cd = BIT(data, 3); - - m_lcdc0->cd_w(cd); - m_lcdc1->cd_w(cd); - m_lcdc2->cd_w(cd); - m_lcdc3->cd_w(cd); - m_lcdc4->cd_w(cd); - m_lcdc5->cd_w(cd); - - // serial - m_sio->pout_w(BIT(data, 5)); -} - - -//------------------------------------------------- -// lcd_data_w - -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::lcd_data_w ) -{ - logerror("LCD DATA %02x\n", data); - - m_lcd_data = data; -} - - -//------------------------------------------------- -// main_p1_r - main CPU port 1 read -//------------------------------------------------- - -READ8_MEMBER( hx20_state::main_p1_r ) -{ - /* - - bit description - - 0 RS-232 DSR - 1 RS-232 CTS - 2 - 3 _INT EX - 4 _PWA - 5 _K.B REQUEST - 6 SERIAL PIN - 7 CARTRIDGE MI1 (0=ROM, 1=microcassette) - - */ - - UINT8 data = 0x98; - - // RS-232 - data |= m_rs232->dsr_r(); - data |= m_rs232->cts_r() << 1; - - // keyboard - data |= m_kbrequest << 5; - - // serial - data |= m_sio_pin << 6; - - return data; -} - - -//------------------------------------------------- -// main_p1_w - main CPU port 1 write -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::main_p1_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ -} - - -//------------------------------------------------- -// main_p2_r - main CPU port 2 read -//------------------------------------------------- - -READ8_MEMBER( hx20_state::main_p2_r ) -{ - /* - - bit description - - 0 bar code reader data - 1 - 2 SLAVE P34 - 3 RX - 4 - 5 - 6 - 7 - - */ - - UINT8 data = M6801_MODE_4; - - // serial - data &= ~(!m_slave_flag << 2); - - if (m_slave_sio) - data |= m_slave_rx << 3; - else - data |= m_sio_rx << 3; - - return data; -} - - -//------------------------------------------------- -// main_p2_w - main CPU port 2 write -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::main_p2_w ) -{ - /* - - bit description - - 0 - 1 RS-232 TXD - 2 serial select (0=peripheral, 1=slave 6301) - 3 - 4 TX - 5 - 6 - 7 - - */ - - // RS-232 - m_rs232->write_txd(BIT(data, 1)); - - // serial - m_slave_sio = BIT(data, 2); - - if (m_slave_sio) - m_slave_tx = BIT(data, 4); - else - m_sio->tx_w(BIT(data, 4)); -} - - -//------------------------------------------------- -// slave_p1_r - slave CPU port 1 read -//------------------------------------------------- - -READ8_MEMBER( hx20_state::slave_p1_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 printer reset pulse - 7 printer timing pulse - - */ - - UINT8 data = 0; - - return data; -} - - -//------------------------------------------------- -// slave_p1_w - slave CPU port 1 write -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::slave_p1_w ) -{ - /* - - bit description - - 0 printer head 1 (1=on) - 1 printer head 2 - 2 printer head 3 - 3 printer head 4 - 4 printer motor (0=on) - 5 speaker (1=on) - 6 - 7 - - */ - - // speaker - m_speaker->level_w(BIT(data, 5)); -} - - -//------------------------------------------------- -// slave_p2_r - slave CPU port 2 read -//------------------------------------------------- - -READ8_MEMBER( hx20_state::slave_p2_r ) -{ - /* - - bit description - - 0 RS-232 RXD / microcassette (0=read, 1=write) - 1 - 2 - 3 TX - 4 - 5 - 6 - 7 - - */ - - UINT8 data = M6801_MODE_7; - - // serial - data |= m_slave_tx << 3; - - return data; -} - - -//------------------------------------------------- -// slave_p2_w - slave CPU port 2 write -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::slave_p2_w ) -{ - /* - - bit description - - 0 - 1 microcassette internal clock, write data - 2 serial select (0=brake, 1=normal) - 3 - 4 RX - 5 - 6 - 7 - - */ - - // serial - m_slave_rx = BIT(data, 4); -} - - -//------------------------------------------------- -// slave_p3_r - slave CPU port 3 read -//------------------------------------------------- - -READ8_MEMBER( hx20_state::slave_p3_r ) -{ - /* - - bit description - - 0 - 1 - 2 external cassette read data - 3 - 4 - 5 - 6 - 7 - - */ - - UINT8 data = 0; - - return data; -} - - -//------------------------------------------------- -// slave_p3_w - slave CPU port 3 write -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::slave_p3_w ) -{ - /* - - bit description - - 0 external cassette remote (0=on) - 1 RS-232 RTS - 2 - 3 external cassette write data - 4 slave status flag - 5 bar code power (1=on) - 6 RS-232 power (1=on) - 7 program power (1=on) - - */ - - // RS-232 - m_rs232->write_rts(BIT(data, 1)); - - // main - m_slave_flag = BIT(data, 4); -} - - -//------------------------------------------------- -// slave_p4_r - slave CPU port 4 read -//------------------------------------------------- - -READ8_MEMBER( hx20_state::slave_p4_r ) -{ - /* - - bit description - - 0 PLUG 2 - 1 - 2 - 3 - 4 - 5 - 6 - 7 RS-232 CD - - */ - - UINT8 data = 0; - - // RS-232 - data |= m_rs232->dcd_r() << 7; - - return data; -} - - -//------------------------------------------------- -// slave_p4_w - slave CPU port 4 write -//------------------------------------------------- - -WRITE8_MEMBER( hx20_state::slave_p4_w ) -{ - /* - - bit description - - 0 - 1 port enable always on / printer motor control (0=open, 1=brake) - 2 clear shift register / microcassette power switch (1=on) - 3 ROM cartridge power switch (1=on) / microcassette command - 4 ROM address counter clear / clock - 5 cassette/RS-232 select (0=RS-232, 1=microcassette) - 6 ROM cartridge select / microcassette clock (0=counter, 1=head switch) - 7 - - */ -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( hx20_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( hx20_mem, AS_PROGRAM, 8, hx20_state ) - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_MAIN_TAG, hd63701_cpu_device, m6801_io_r, m6801_io_w) - AM_RANGE(0x0020, 0x0020) AM_WRITE(ksc_w) - AM_RANGE(0x0022, 0x0022) AM_READ(krtn07_r) - AM_RANGE(0x0026, 0x0026) AM_WRITE(lcd_cs_w) - AM_RANGE(0x0028, 0x0028) AM_READ(krtn89_r) - AM_RANGE(0x002a, 0x002a) AM_WRITE(lcd_data_w) - AM_RANGE(0x002c, 0x002c) // mask interruption by using IC 8E in sleep mode - AM_RANGE(0x0040, 0x007f) AM_DEVREADWRITE(MC146818_TAG, mc146818_device, read, write) - AM_RANGE(0x0080, 0x00ff) AM_RAM - AM_RANGE(0x0100, 0x3fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(HD6301V1_MAIN_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( hx20_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( hx20_io, AS_IO, 8, hx20_state ) - AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READWRITE(main_p1_r, main_p1_w) - AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(main_p2_r, main_p2_w) - AM_RANGE(M6801_PORT3, M6801_PORT3) AM_NOP // A0-A7, D0-D7 - AM_RANGE(M6801_PORT4, M6801_PORT4) AM_NOP // A8-A15 -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( hx20_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( hx20_sub_mem, AS_PROGRAM, 8, hx20_state ) - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_SLAVE_TAG, hd63701_cpu_device, m6801_io_r, m6801_io_w) - AM_RANGE(0x0080, 0x00ff) AM_RAM - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6301V1_SLAVE_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( hx20_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( hx20_sub_io, AS_IO, 8, hx20_state ) - AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READWRITE(slave_p1_r, slave_p1_w) - AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(slave_p2_r, slave_p2_w) - AM_RANGE(M6801_PORT3, M6801_PORT3) AM_READWRITE(slave_p3_r, slave_p3_w) - AM_RANGE(M6801_PORT4, M6801_PORT4) AM_READWRITE(slave_p4_r, slave_p4_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( hx20 ) -//------------------------------------------------- - -static INPUT_PORTS_START( hx20 ) - PORT_START("KSC0") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // SW6:1 - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KSC1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // SW6:2 - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KSC2") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('@') PORT_CHAR('^') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // SW6:3 - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KSC3") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // SW6:4 - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KSC4") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KSC5") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" " UTF8_UP) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT" " UTF8_DOWN) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAPER FEED") - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KSC6") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NUM") - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRPH") - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KSC7") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SCRN") - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE") - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MENU") - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRTR ON/OFF") - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SW6") - PORT_DIPNAME( 0x07, 0x07, "Country" ) PORT_DIPLOCATION("SW6:1,2,3") - PORT_DIPSETTING( 0x00, "Spain" ) - PORT_DIPSETTING( 0x01, "Italy" ) - PORT_DIPSETTING( 0x02, "Sweden" ) - PORT_DIPSETTING( 0x03, "Denmark" ) - PORT_DIPSETTING( 0x04, "England" ) - PORT_DIPSETTING( 0x05, "Germany" ) - PORT_DIPSETTING( 0x06, "France" ) - PORT_DIPSETTING( 0x07, "America" ) - PORT_DIPNAME( 0x08, 0x00, "Floppy Drive TF-20" ) PORT_DIPLOCATION("SW6:4") - PORT_DIPSETTING( 0x00, "Installed" ) - PORT_DIPSETTING( 0x08, "Not Installed" ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( hx20e ) -//------------------------------------------------- - -static INPUT_PORTS_START( hx20e ) - PORT_INCLUDE(hx20) - - PORT_MODIFY("SW6") - PORT_DIPNAME( 0x07, 0x00, "Country" ) PORT_DIPLOCATION("SW6:1,2,3") - PORT_DIPSETTING( 0x00, "Sweden (ASCII)" ) - PORT_DIPSETTING( 0x01, "Germany (ASCII)" ) - PORT_DIPSETTING( 0x02, "France (ASCII)" ) - PORT_DIPSETTING( 0x03, "Denmark" ) - PORT_DIPSETTING( 0x04, "Sweden" ) - PORT_DIPSETTING( 0x05, "Germany" ) - PORT_DIPSETTING( 0x06, "France" ) - PORT_DIPSETTING( 0x07, "Norway" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// mc146818_interface rtc_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( hx20_state::rtc_irq_w ) -{ - m_rtc_irq = state; - - update_interrupt(); -} - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -PALETTE_INIT_MEMBER(hx20_state, hx20) -{ - palette.set_pen_color(0, 0xa5, 0xad, 0xa5); - palette.set_pen_color(1, 0x31, 0x39, 0x10); -} - - -//------------------------------------------------- -// SCREEN_UPDATE( hx20 ) -//------------------------------------------------- - -UINT32 hx20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_lcdc0->screen_update(screen, bitmap, cliprect); - m_lcdc1->screen_update(screen, bitmap, cliprect); - m_lcdc2->screen_update(screen, bitmap, cliprect); - m_lcdc3->screen_update(screen, bitmap, cliprect); - m_lcdc4->screen_update(screen, bitmap, cliprect); - m_lcdc5->screen_update(screen, bitmap, cliprect); - - return 0; -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( hx20 ) -//------------------------------------------------- - -void hx20_state::machine_start() -{ - // state saving - save_item(NAME(m_slave_rx)); - save_item(NAME(m_slave_tx)); - save_item(NAME(m_slave_flag)); - save_item(NAME(m_ksc)); - save_item(NAME(m_kbrequest)); - save_item(NAME(m_lcd_data)); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( hx20 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( hx20, hx20_state ) - // basic machine hardware - MCFG_CPU_ADD(HD6301V1_MAIN_TAG, HD63701, XTAL_2_4576MHz) - MCFG_CPU_PROGRAM_MAP(hx20_mem) - MCFG_CPU_IO_MAP(hx20_io) - - MCFG_CPU_ADD(HD6301V1_SLAVE_TAG, HD63701, XTAL_2_4576MHz) - MCFG_CPU_PROGRAM_MAP(hx20_sub_mem) - MCFG_CPU_IO_MAP(hx20_sub_io) - - // video hardware - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(120, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 32-1) - MCFG_SCREEN_UPDATE_DRIVER(hx20_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(hx20_state, hx20) - - MCFG_UPD7227_ADD(UPD7227_0_TAG, 0, 0) - MCFG_UPD7227_ADD(UPD7227_1_TAG, 40, 0) - MCFG_UPD7227_ADD(UPD7227_2_TAG, 80, 0) - MCFG_UPD7227_ADD(UPD7227_3_TAG, 0, 16) - MCFG_UPD7227_ADD(UPD7227_4_TAG, 40, 16) - MCFG_UPD7227_ADD(UPD7227_5_TAG, 80, 16) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_MC146818_ADD(MC146818_TAG, XTAL_4_194304Mhz) - MCFG_MC146818_IRQ_HANDLER(WRITELINE(hx20_state, rtc_irq_w)) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_CASSETTE_ADD(CASSETTE_TAG) - MCFG_EPSON_SIO_ADD("sio", "tf20") - MCFG_EPSON_SIO_RX(WRITELINE(hx20_state, sio_rx_w)) - MCFG_EPSON_SIO_PIN(WRITELINE(hx20_state, sio_pin_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("epson_cpm_list", "epson_cpm") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( hx20 ) -//------------------------------------------------- - -ROM_START( ehx20 ) - ROM_REGION( 0x8000, HD6301V1_MAIN_TAG, ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS( "v11" ) - ROM_SYSTEM_BIOS( 0, "v10", "version 1.0" ) - ROMX_LOAD( "hx20_v10.12e", 0x0000, 0x2000, CRC(ed7482c6) SHA1(8fba63037f2418aee9e933a353b052a5ed816ead), ROM_BIOS(1) ) - ROMX_LOAD( "hx20_v10.13e", 0x2000, 0x2000, CRC(f5cc8868) SHA1(3248a1ddf0d8df7e9f2fe96955385218d760c4ad), ROM_BIOS(1) ) - ROMX_LOAD( "hx20_v10.14e", 0x4000, 0x2000, CRC(27d743ed) SHA1(ebae367b0fa5f42ac78424df2534312296fd6fdc), ROM_BIOS(1) ) - ROMX_LOAD( "hx20_v10.15e", 0x6000, 0x2000, CRC(33fbb1ab) SHA1(292ace94b4dad267aa7786dc64e68ac6f3c98aa7), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v11", "version 1.1" ) - ROMX_LOAD( "hx20_v11.12e", 0x0000, 0x2000, CRC(4de0b4b6) SHA1(f15c537824b7effde9d9b9a21e92a081fb089371), ROM_BIOS(2) ) - ROMX_LOAD( "hx20_v11.13e", 0x2000, 0x2000, CRC(10d6ae76) SHA1(3163954ed9981f70f590ee98bcc8e19e4be6527a), ROM_BIOS(2) ) - ROMX_LOAD( "hx20_v11.14e", 0x4000, 0x2000, CRC(26c203a1) SHA1(b282d7233b2689820fcf718dbe1e93d623b67e4f), ROM_BIOS(2) ) - ROMX_LOAD( "hx20_v11.15e", 0x6000, 0x2000, CRC(101cb3e8) SHA1(e0b5cf107a9387e34a0e46f54328b89696c0bdc5), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, HD6301V1_SLAVE_TAG, 0 ) - ROM_LOAD( "hd6301v1.6d", 0x0000, 0x1000, CRC(b36f5b99) SHA1(c6b54163bb268e4f4f5c79aa2e83ec51f775b16a) ) -ROM_END - - -//------------------------------------------------- -// ROM( hx20e ) -//------------------------------------------------- - -ROM_START( ehx20e ) - ROM_REGION( 0x8000, HD6301V1_MAIN_TAG, ROMREGION_ERASEFF ) - ROMX_LOAD( "hx20_v11e.12e", 0x0000, 0x2000, CRC(4de0b4b6) SHA1(f15c537824b7effde9d9b9a21e92a081fb089371), ROM_BIOS(3) ) - ROMX_LOAD( "hx20_v11e.13e", 0x2000, 0x2000, CRC(10d6ae76) SHA1(3163954ed9981f70f590ee98bcc8e19e4be6527a), ROM_BIOS(3) ) - ROMX_LOAD( "hx20_v11e.14e", 0x4000, 0x2000, CRC(26c203a1) SHA1(b282d7233b2689820fcf718dbe1e93d623b67e4f), ROM_BIOS(3) ) - ROMX_LOAD( "hx20_v11e.15e", 0x6000, 0x2000, CRC(fd339aa5) SHA1(860c3579c45e96c5e6a877f4fbe77abacb0d674e), ROM_BIOS(3) ) - - ROM_REGION( 0x1000, HD6301V1_SLAVE_TAG, 0 ) - ROM_LOAD( "hd6301v1.6d", 0x0000, 0x1000, CRC(b36f5b99) SHA1(c6b54163bb268e4f4f5c79aa2e83ec51f775b16a) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, ehx20, 0, 0, hx20, hx20, driver_device, 0, "Epson", "Epson HX-20", MACHINE_NOT_WORKING ) -COMP( 1983, ehx20e, ehx20, 0, hx20, hx20e, driver_device, 0, "Epson", "Epson HX-20 (Europe)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/hyperscan.c b/src/mess/drivers/hyperscan.c deleted file mode 100644 index 15e1bb8da72..00000000000 --- a/src/mess/drivers/hyperscan.c +++ /dev/null @@ -1,647 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Mattel HyperScan - - 08/17/2013 Skeleton driver by Sandro Ronco - - SPG290 Interrupt: - - Vector Source - 63 SPU FIQ - 62 SPU Beatirq - 61 SPU Envirq - 60 CD servo - 59 ADC gain overflow / ADC recorder / FIFO overflow - 58 General purpose ADC - 57 Timer base - 56 Timer - 55 TV vblanking start - 54 LCD vblanking start - 53 PPU vblanking start - 52 TV - 51 Sensor frame end - 50 Sensor coordinate hit - 49 Sensor motion frame end - 48 Sensor capture done + sensor debug IRQ - 47 TV coordinate hit - 46 PPU coordinate hit - 45 USB host+device - 44 SIO - 43 SPI - 42 Uart (IrDA) - 41 NAND - 40 SD - 39 I2C master - 38 I2S slave - 37 APBDMA CH1 - 36 APBDMA CH2 - 35 LDM_DMA - 34 BLN_DMA - 33 APBDMA CH3 - 32 APBDMA CH4 - 31 Alarm + HMS - 30 MP4 - 29 C3 (ECC module) - 28 GPIO - 27 Bufctl (for debug) + TV/PPU vblanking end (for debug) - 26 RESERVED1 - 25 RESERVED2 - 24 RESERVED3 - -****************************************************************************/ - -#include "emu.h" -#include "cpu/score/score.h" - - -#define LOG_SPG290_REGISTER_ACCESS (1) - - - -class hyperscan_state : public driver_device -{ -public: - hyperscan_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - required_device m_maincpu; - - virtual void machine_start(); - virtual void machine_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - UINT32 spg290_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_READ32_MEMBER(spg290_regs_r); - DECLARE_WRITE32_MEMBER(spg290_regs_w); - void spg290_timers_update(); - void spg290_vblank_irq(screen_device &screen, bool state); - inline UINT32 spg290_read_mem(UINT32 offset); - inline void spg290_write_mem(UINT32 offset, UINT32 data); - void spg290_argb1555(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 posy, UINT16 posx, UINT16 argb); - void spg290_rgb565(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 posy, UINT16 posx, UINT16 rgb, UINT32 transrgb); - void spg290_blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, UINT32 *palettes, UINT32 buf_start); - void spg290_blit_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, int posy, int posx, UINT32 nptr, UINT32 buf_start, UINT32 transrgb); - void spg290_blit_character(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, int posy, int posx, UINT32 nptr, UINT32 buf_start, UINT32 transrgb); - -private: - static const device_timer_id TIMER_SPG290 = 0; - static const device_timer_id TIMER_I2C = 1; - - struct spg290_miu - { - UINT32 status; - }; - - struct spg290_ppu - { - UINT32 control; - UINT32 irq_control; - UINT32 irq_status; - UINT32 sprite_max; - UINT32 sprite_buf_start; - UINT32 frame_buff[3]; - UINT32 palettes[0x200]; - UINT32 tx_hoffset[0x200]; - UINT32 tx_hcomp[0x200]; - UINT32 transrgb; - - struct ppu_spite - { - UINT32 control; - UINT32 attribute; - } sprites[0x200]; - - struct ppu_tx - { - UINT32 control; - UINT32 attribute; - UINT32 posx; - UINT32 posy; - UINT32 nptr; - UINT32 buf_start[3]; - } txs[3]; - }; - - struct spg290_timer - { - UINT32 control; - UINT32 control2; - UINT16 preload; - UINT16 counter; - }; - - struct spg290_i2c - { - UINT32 config; - UINT32 irq_control; - UINT32 clock; - UINT8 count; - UINT32 id; - UINT32 port_addr; - UINT32 wdata; - UINT32 rdata; - }; - - spg290_miu m_miu; - spg290_ppu m_ppu; - spg290_timer m_timers[6]; - spg290_i2c m_i2c; - emu_timer * m_update_timer; - emu_timer * m_i2c_timer; -}; - - - -#if LOG_SPG290_REGISTER_ACCESS -static void log_spg290_regs(UINT8 module, UINT16 reg, UINT32 mem_mask, bool write, UINT32 data=0) -{ - static const char *const modules_name[] = - { - "CSI", "PPU", "JPG", "TV", "LCD", "SPU", "CD", "MIU", "APBDMA", "BUFCTL","IRQCTL", "GPUBUF", "LDMDMA", - "BLNDMA", "TPGBUF", "AHBDEC", "GPIO", "SPI", "SIO", "I2C", "I2S", "UART", "TIMERS/RTC", "WDOG", "SD", - "FLASH", "ADC", "USB device", "USB host", "Reserved", "Reserved", "Reserved", "SFTCFG", "CKG", "MP4", - "MIU2", "ECC" - }; - - if (module < 0x25) - logerror("SPG: %-10s", modules_name[module]); - else - logerror("SPG: mod 0x%02x ", module); - - if (!write) - logerror(" R 0x%04x", reg); - else - logerror(" W 0x%04x = 0x%08x", reg, data); - - if (mem_mask != 0xffffffffu) - logerror(" (0x%08x)\n", mem_mask); - else - logerror("\n"); -} -#endif - - -READ32_MEMBER(hyperscan_state::spg290_regs_r) -{ - UINT32 addr = offset << 2; - UINT32 data = 0; - - if (addr == 0x010000) // PPU Control - { - data = m_ppu.control; - } - else if (addr == 0x010084) // PPU IRQ Status - { - data = m_ppu.irq_status; - } - if (addr == 0x07006c) // MIU Status - { - data = m_miu.status; - } - else if ((addr & 0xff0fff) == 0x160000) // Timer X Status - { - int idx = (offset>>10) & 0x0f; - data = m_timers[idx].control; - } - else if(addr == 0x130024) // I2C interrupt - { - data = m_i2c.irq_control; - } - else if(addr == 0x130034) // I2C write data - { - data = m_i2c.wdata; - } - else if(addr == 0x130038) // I2C data data - { - data = m_i2c.rdata; - } - -#if LOG_SPG290_REGISTER_ACCESS - //else - { - if (!space.debugger_access()) - log_spg290_regs((offset >> 14) & 0xff, (offset<<2) & 0xffff, mem_mask, false); - } -#endif - - return data; -} - -WRITE32_MEMBER(hyperscan_state::spg290_regs_w) -{ - UINT32 addr = offset << 2; - - if (addr == 0x010000) // PPU Control - { - COMBINE_DATA(&m_ppu.control); - } - else if (addr == 0x010008) // PPU Max Sprites - { - COMBINE_DATA(&m_ppu.sprite_max); - } - else if (addr == 0x010010) // PPU Max Sprites - { - COMBINE_DATA(&m_ppu.transrgb); - } - else if (addr == 0x0100d0) // Sprites buffer start - { - COMBINE_DATA(&m_ppu.sprite_buf_start); - } - else if (addr == 0x010020 || addr == 0x01003c || addr == 0x010058) // Text Layers x pos - { - int idx = (((offset>>3) & 3) | ((offset>>4) & 1)) - 1; - COMBINE_DATA(&m_ppu.txs[idx].posx); - } - else if (addr == 0x010024 || addr == 0x010040 || addr == 0x01005c) // Text Layers y pos - { - int idx = (((offset>>3) & 3) | ((offset>>4) & 1)) - 1; - COMBINE_DATA(&m_ppu.txs[idx].posy); - } - else if (addr == 0x010028 || addr == 0x010044 || addr == 0x010060) // Text Layers attribute - { - int idx = ((offset>>3) & 3) - 1; - COMBINE_DATA(&m_ppu.txs[idx].attribute); - } - else if (addr == 0x01002c || addr == 0x010048 || addr == 0x010064) // Text Layers control - { - int idx = ((offset>>3) & 3) - 1; - COMBINE_DATA(&m_ppu.txs[idx].control); - } - else if (addr == 0x010030 || addr == 0x01004c || addr == 0x010068) // Text Layers number ptr - { - int idx = ((offset>>3) & 3) - 1; - COMBINE_DATA(&m_ppu.txs[idx].nptr); - } - else if (addr == 0x010080) // PPU IRQ Control - { - COMBINE_DATA(&m_ppu.irq_control); - } - else if (addr == 0x010084) // PPU IRQ ack - { - if (ACCESSING_BITS_0_7) - m_ppu.irq_status &= ~data; - } - else if (addr >= 0x0100a0 && addr <= 0x0100a8) // Tx1 buffer start - { - COMBINE_DATA(&m_ppu.txs[0].buf_start[offset & 3]); - } - else if (addr >= 0x0100ac && addr <= 0x0100b4) // Tx2 buffer start - { - COMBINE_DATA(&m_ppu.txs[1].buf_start[(offset+1) & 3]); - } - else if (addr >= 0x0100b8 && addr <= 0x0100c0) // Tx3 buffer starts - { - COMBINE_DATA(&m_ppu.txs[2].buf_start[(offset+2) & 3]); - } - else if ((addr & 0xfff000) == 0x011000) // Palettes - { - COMBINE_DATA(&m_ppu.palettes[offset & 0x01ff]); - } - else if ((addr & 0xfff000) == 0x012000) // Tx horizontal offset - { - COMBINE_DATA(&m_ppu.tx_hoffset[offset & 0x01ff]); - } - else if ((addr & 0xfff000) == 0x013000) // Tx horizontal compression - { - COMBINE_DATA(&m_ppu.tx_hcomp[offset & 0x01ff]); - } - else if ((addr & 0xfff000) == 0x014000) // Sprite Control Registers - { - int idx = (offset>>1) & 0x1ff; - if (offset & 1) - COMBINE_DATA(&m_ppu.sprites[idx].attribute); - else - COMBINE_DATA(&m_ppu.sprites[idx].control); - } - else if (addr == 0x07005c) // MIU Status - { - COMBINE_DATA(&m_miu.status); - } - else if ((addr & 0xff0fff) == 0x160000) // Timer X Control 1 - { - int idx = (offset>>10) & 0x07; - COMBINE_DATA(&m_timers[idx].control); - - if (ACCESSING_BITS_24_31) - m_timers[idx].control &= ~(data & 0x04000000); // Timers IRQ ack - } - else if ((addr & 0xff0fff) == 0x160004) // Timer X Control 2 - { - int idx = (offset>>10) & 0x07; - COMBINE_DATA(&m_timers[idx].control2); - } - else if ((addr & 0xff0fff) == 0x160008) // Timer X Preload - { - int idx = (offset>>10) & 0x07; - COMBINE_DATA(&m_timers[idx].preload); - } - else if (addr == 0x2100e4) // Timer Source Clock Selection - { - UINT32 timers_clk = XTAL_27MHz / ((data & 0xff) + 1); - m_update_timer->adjust(attotime::from_hz(timers_clk), 0, attotime::from_hz(timers_clk)); - } - else if(addr == 0x130020) // I2C configuration - { - COMBINE_DATA(&m_i2c.config); - } - else if(addr == 0x130024) // I2C interrupt - { - COMBINE_DATA(&m_i2c.irq_control); - - if (ACCESSING_BITS_0_7) - m_i2c.irq_control &= ~(data & 0x00000001); // I2C IRQ ack - } - else if(addr == 0x130028) // I2C clock setting - { - COMBINE_DATA(&m_i2c.clock); - UINT32 i2c_clk = XTAL_27MHz / ((m_i2c.clock & 0x3ff) + 1); - m_i2c_timer->adjust(attotime::from_hz(i2c_clk), 0, attotime::from_hz(i2c_clk)); - } - else if(addr == 0x13002c) // I2C ID - { - COMBINE_DATA(&m_i2c.id); - } - else if(addr == 0x130030) // I2C port address - { - COMBINE_DATA(&m_i2c.port_addr); - } - else if(addr == 0x130034) // I2C write data - { - COMBINE_DATA(&m_i2c.wdata); - } - else if(addr == 0x130038) // I2C data data - { - COMBINE_DATA(&m_i2c.rdata); - } - else if(addr == 0x150000) // UART data - { - if (ACCESSING_BITS_0_7) - printf("%c", data & 0xff); - } - -#if LOG_SPG290_REGISTER_ACCESS - //else - { - if (!space.debugger_access()) - log_spg290_regs((offset >> 14) & 0xff, (offset<<2) & 0xffff, mem_mask, true, data); - } -#endif -} - -inline UINT32 hyperscan_state::spg290_read_mem(UINT32 offset) -{ - return m_maincpu->space(0).read_dword(offset); -} - -inline void hyperscan_state::spg290_write_mem(UINT32 offset, UINT32 data) -{ - return m_maincpu->space(0).write_dword(offset, data); -} - -void hyperscan_state::spg290_argb1555(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 posy, UINT16 posx, UINT16 argb) -{ - if (!(argb & 0x8000) && cliprect.contains(posx, posy)) - { - rgb_t color = rgb_t(pal5bit(argb >> 10), pal5bit(argb >> 5), pal5bit(argb >> 0)); - bitmap.pix32(posy, posx) = color; - } -} - -void hyperscan_state::spg290_rgb565(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 posy, UINT16 posx, UINT16 rgb, UINT32 transrgb) -{ - if ((!(transrgb & 0x10000) || (transrgb & 0xffff) != rgb) && cliprect.contains(posx, posy)) - { - rgb_t color = rgb_t(pal5bit(rgb >> 11), pal6bit(rgb >> 5), pal5bit(rgb >> 0)); - bitmap.pix32(posy, posx) = color; - } -} - -void hyperscan_state::spg290_blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, UINT32 *palettes, UINT32 buf_start) -{ - UINT32 sprite_base = buf_start + ((control & 0xffff) << 8); - UINT16 sprite_x = (control >> 16) & 0x3ff; - UINT16 sprite_y = (attribute >> 16) & 0x3ff; - UINT8 sprite_hsize = 8 << ((attribute >> 4) & 0x03); - UINT8 sprite_vsize = 8 << ((attribute >> 6) & 0x03); - UINT8 bit_pixel = ((attribute & 3) + 1) << 1; - UINT8 pixel_word = 32 / bit_pixel; - UINT8 word_line = sprite_hsize / pixel_word; - UINT8 sprite_flip = (attribute >> 2) & 0x03; - - for (int y=0; y < sprite_vsize; y++) - for (int x=0; x < word_line; x++) - { - UINT32 data = spg290_read_mem(sprite_base + (y * pixel_word + x) * 4); - - for (int b=0; b < pixel_word; b++) - { - UINT16 pen = ((data >> (b * bit_pixel)) & ((1 << bit_pixel) - 1)); - UINT16 posx; - if (sprite_flip & 0x01) - posx = sprite_x + (sprite_hsize - (x * word_line + b)); - else - posx = sprite_x + x * (word_line) + b; - - UINT16 posy; - if (sprite_flip & 0x02) - posy = sprite_y + (sprite_vsize - y); - else - posy = sprite_y + y; - - spg290_argb1555(bitmap, cliprect, posy, posx, palettes[pen]); - } - } -} - -void hyperscan_state::spg290_blit_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, int posy, int posx, UINT32 nptr, UINT32 buf_start, UINT32 transrgb) -{ - for (int y=0; y<512; y++) - { - int line = (control & 0x04) ? 0 : y; - UINT32 tx_start = spg290_read_mem(nptr + (posy + line) * 4); - - for (int x=0; x < 1024>>1; x++) - { - UINT32 data = spg290_read_mem(buf_start + (tx_start + posx) * 2 + x * 4); - - for (int b=0; b < 2; b++) - { - UINT16 posx = x * 2 + b; - UINT16 posy = y; - UINT16 pix = (data >> (b*16)) & 0xffff; - - if (control & 0x0080) - spg290_argb1555(bitmap, cliprect, posy, posx, pix); - if (control & 0x1000) - spg290_rgb565(bitmap, cliprect, posy, posx, pix, transrgb); - } - } - } -} - -void hyperscan_state::spg290_blit_character(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 control, UINT32 attribute, int posy, int posx, UINT32 nptr, UINT32 buf_start, UINT32 transrgb) -{ - // TODO -} - - -UINT32 hyperscan_state::spg290_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - if (m_ppu.control & 0x1000) - { - for (int depth=0; depth<4; depth++) - { - // draw the bitmap/text layers - for (int l=0; l<3; l++) - if ((m_ppu.txs[l].control & 0x08) && ((m_ppu.txs[l].attribute >> 13) & 3) == depth) - { - if (m_ppu.txs[l].control & 0x01) - spg290_blit_bitmap(bitmap, cliprect, m_ppu.txs[l].control, m_ppu.txs[l].attribute, m_ppu.txs[l].posy & 0x1ff, m_ppu.txs[l].posx & 0x1ff, m_ppu.txs[l].nptr, m_ppu.txs[l].buf_start[0], m_ppu.transrgb); - else - spg290_blit_character(bitmap, cliprect, m_ppu.txs[l].control, m_ppu.txs[l].attribute, m_ppu.txs[l].posy & 0x1ff, m_ppu.txs[l].posx & 0x1ff, m_ppu.txs[l].nptr, m_ppu.txs[l].buf_start[0], m_ppu.transrgb); - } - - // draw the sprites - for (int i=0; i<=(m_ppu.sprite_max & 0x1ff); i++) - { - if (((m_ppu.sprites[i].attribute >> 13) & 3) == depth) - spg290_blit_sprite(bitmap, cliprect, m_ppu.sprites[i].control, m_ppu.sprites[i].attribute, m_ppu.palettes, m_ppu.sprite_buf_start); - } - } - } - else - { - bitmap.fill(rgb_t::black, cliprect); - } - - return 0; -} - -void hyperscan_state::spg290_timers_update() -{ - for(int i=0; i<6; i++) - if (m_timers[i].control & 0x80000000) - { - if (((m_timers[i].control2 >> 30) & 0x03) == 0x00) - { - if (m_timers[i].counter == 0xffff) - { - m_timers[i].counter = m_timers[i].preload; - if (m_timers[i].control & 0x08000000) - { - m_timers[i].control |= 0x04000000; - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 56); - } - } - else - m_timers[i].counter++; - } - else - { - // TODO: capture, comparison and PWM mode - - } - } -} - -void hyperscan_state::spg290_vblank_irq(screen_device &screen, bool state) -{ - if (state && m_ppu.irq_control & 0x01) // VBlanking Start IRQ - { - m_ppu.irq_status |= 0x01; - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 53); - } - else if (!state && m_ppu.irq_control & 0x02) // VBlanking End IRQ - { - m_ppu.irq_status |= 0x02; - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 53); - } -} - - -void hyperscan_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_SPG290: - spg290_timers_update(); - break; - case TIMER_I2C: - if ((m_i2c.config & 0x40) && (m_i2c.config & 0x01)) - { - // TODO: replace with real I2C emulation - m_i2c.rdata = 0; - - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 39); - } - break; - } -} - -static ADDRESS_MAP_START(spg290_mem, AS_PROGRAM, 32, hyperscan_state) - ADDRESS_MAP_GLOBAL_MASK(0x1fffffff) - AM_RANGE(0x00000000, 0x00ffffff) AM_RAM AM_MIRROR(0x07000000) - AM_RANGE(0x08000000, 0x09ffffff) AM_READWRITE(spg290_regs_r, spg290_regs_w) - AM_RANGE(0x0a000000, 0x0a003fff) AM_RAM // internal SRAM - AM_RANGE(0x0b000000, 0x0b007fff) AM_ROM AM_REGION("spg290", 0) // internal ROM - AM_RANGE(0x1e000000, 0x1e0fffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x0e000000) - AM_RANGE(0x1f000000, 0x1f0fffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x0e000000) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( hyperscan ) -INPUT_PORTS_END - - -void hyperscan_state::machine_start() -{ - m_update_timer = timer_alloc(TIMER_SPG290); - m_i2c_timer = timer_alloc(TIMER_I2C); -} - -void hyperscan_state::machine_reset() -{ - memset(&m_ppu, 0, sizeof(spg290_ppu)); - memset(&m_miu, 0, sizeof(spg290_miu)); - memset(&m_i2c, 0, sizeof(m_i2c)); - m_i2c_timer->adjust(attotime::never, 0, attotime::never); - - // disable JTAG - m_maincpu->set_state_int(SCORE_CR + 29, 0x20000000); -} - - -static MACHINE_CONFIG_START( hyperscan, hyperscan_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SCORE7, XTAL_27MHz * 4) // 108MHz S+core 7 - MCFG_CPU_PROGRAM_MAP(spg290_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(hyperscan_state, spg290_screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_VBLANK_DRIVER(hyperscan_state, spg290_vblank_irq) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( hs ) - ROM_REGION( 0x100000, "bios", ROMREGION_32BIT | ROMREGION_LE ) - ROM_LOAD32_DWORD("hyperscan.bin", 0x000000, 0x100000, CRC(ce346a14) SHA1(560cb747e7193e6781d4b8b0bd4d7b45d3d28690)) - - ROM_REGION( 0x008000, "spg290", ROMREGION_32BIT | ROMREGION_LE ) - ROM_LOAD32_DWORD("spg290.bin", 0x000000, 0x008000, NO_DUMP) // 256Kbit SPG290 internal ROM -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 2006, hs, 0, 0, hyperscan , hyperscan , driver_device, 0, "Mattel", "HyperScan", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/i7000.c b/src/mess/drivers/i7000.c deleted file mode 100644 index 01c561a5284..00000000000 --- a/src/mess/drivers/i7000.c +++ /dev/null @@ -1,401 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders: Felipe Sanches -/*************************************************************************** - - Itautec I7000 - - driver by Felipe C. da S. Sanches - with tech info provided by Alexandre Souza (a.k.a. Tabajara). - - The portuguese Wikipedia article available at - http://pt.wikipedia.org/wiki/Itautec_I-7000 - also provides a technical overview of this machine: - - The I-7000 was the first computer manufactured by Itautec - (http://www.itautec.com.br/pt-br/produtos). It was originally an 8 bit CP/M - computer that became an IBM PC-XT clone in later hardware revisions which - took the "I-7000 PC-XT" name. - - * Released in 1982 - * Operating System: SIM/M / BASIC - * CPU: National NSC800 D-4 at 4,00 MHz - * Memory: 64KB to 128KB - * keyboards: 80 keys (with a reduced numerical keypad and function keys) - * display: - - 40 X 25 text - - 80 X 25 text - - 160 X 100 (8 colors) - - 640 X 200 (monochrome, with an expansion board) - - 320 X 200 (16 colors, with an expansion board) - * Expansion slots: - - 1 frontal cart slot - - 4 internal expansion slots - * Ports: - - 1 composite video output for a color monitor - - 2 cassete interfaces - - 1 RS-232C serial port - - 1 parallel interface - * Storage: - - Cassetes recorder - - Up to 4 external floppy drives: 8" (FD/DD, 1,1MB) or 5" 1/4 - - Up to 1 external 10 MB hard-drive - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" //CPU was actually a NSC800 (Z80 compatible) -#include "bus/generic/carts.h" -#include "machine/pit8253.h" -#include "machine/i8279.h" -#include "sound/speaker.h" -#include "video/mc6845.h" - -class i7000_state : public driver_device -{ -public: - i7000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_card(*this, "cardslot"), - m_gfxdecode(*this, "gfxdecode"), - m_videoram(*this, "videoram") - { } - - void video_start(); - void machine_start(); - - required_device m_maincpu; - required_device m_card; - required_device m_gfxdecode; - required_shared_ptr m_videoram; - UINT32 screen_update_i7000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT8 *m_char_rom; - UINT8 m_row; - tilemap_t *m_bg_tilemap; - - TILE_GET_INFO_MEMBER(get_bg_tile_info); - MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr); - DECLARE_DRIVER_INIT(i7000); - DECLARE_PALETTE_INIT(i7000); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( i7000_card ); - - DECLARE_READ8_MEMBER(i7000_kbd_r); - DECLARE_WRITE8_MEMBER(i7000_scanlines_w); -}; - -WRITE8_MEMBER( i7000_state::i7000_scanlines_w ) -{ - m_row = data; -} - -READ8_MEMBER( i7000_state::i7000_kbd_r ) -{ - UINT8 data = 0xff; - - for (int i=0; i<40*25; i++){ - m_bg_tilemap->mark_tile_dirty(i); - } - - if (m_row < 8) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",m_row); - data = ioport(kbdrow)->read(); - } - return data; -} - -/* Input ports */ -static INPUT_PORTS_START( i7000 ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("!") PORT_CHAR('!') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0x9D") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0x8F") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^R DC2") //0x12 - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("$ ^") PORT_CHAR('$') PORT_CHAR('^') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0xA0") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("% +") PORT_CHAR('%') PORT_CHAR('+') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0x9C") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CHAR('@') - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 *") PORT_CODE(KEYCODE_5) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^U NAK") //0x15 - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("| <") PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^E ENQ") //0x05 - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^O SI") //0x0F - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("#") PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("{") PORT_CHAR('{') - - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^L FF") //0x0C - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^T DC4") //0x14 - - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(">") PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACEBAR") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("}") PORT_CHAR('}') - - PORT_START("DSW") /* DP01 */ - PORT_DIPNAME( 0x80, 0x80, "1") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x40, "2") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x00, "3") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x10, 0x10, "4") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x08, 0x08, "5") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x04, 0x04, "6") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x02, 0x00, "7") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x01, 0x01, "8") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) -INPUT_PORTS_END - -DRIVER_INIT_MEMBER(i7000_state, i7000) -{ -} - -void i7000_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - if (m_card->exists()) - { - // 0x4000 - 0xbfff 32KB ROM - program.install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_card)); - } -} - -PALETTE_INIT_MEMBER(i7000_state, i7000) -{ - palette.set_pen_color(0, rgb_t(0x33, 0x33, 0x33)); - palette.set_pen_color(1, rgb_t(0xBB, 0xBB, 0xBB)); -} - -/*FIXME: we still need to figure out the proper memory map - for the maincpu and where the cartridge slot maps to. */ -static ADDRESS_MAP_START(i7000_mem, AS_PROGRAM, 8, i7000_state) - AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("boot", 0) - AM_RANGE(0x2000, 0x2fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x4000, 0xffff) AM_RAM -// AM_RANGE(0x4000, 0xbfff) AM_ROM AM_REGION("cardslot", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( i7000_io , AS_IO, 8, i7000_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK (0xff) -// AM_RANGE(0x06, 0x06) AM_WRITE(i7000_io_?_w) -// AM_RANGE(0x08, 0x09) AM_WRITE(i7000_io_?_w) //printer perhaps? -// AM_RANGE(0x0c, 0x0c) AM_WRITE(i7000_io_?_w) //0x0C and 0x10 may be related to mem page swapping. (self-test "4. PAG") -// AM_RANGE(0x10, 0x10) AM_WRITE(i7000_io_?_w) -// AM_RANGE(0x14, 0x15) AM_WRITE(i7000_io_?_w) - - AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - -// AM_RANGE(0x1c, 0x1c) AM_WRITE(i7000_io_printer_data_w) //ASCII data - AM_RANGE(0x1d, 0x1d) AM_READ_PORT("DSW") -// AM_RANGE(0x1e, 0x1e) AM_READWRITE(i7000_io_printer_status_r, i7000_io_?_w) -// AM_RANGE(0x1f, 0x1f) AM_WRITE(i7000_io_printer_strobe_w) //self-test routine writes 0x08 and 0x09 (it seems that bit 0 is the strobe and bit 3 is an enable signal) -// AM_RANGE(0x20, 0x21) AM_READWRITE(i7000_io_keyboard_r, i7000_io_keyboard_w) - - AM_RANGE( 0x20, 0x20 ) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w) - AM_RANGE( 0x21, 0x21 ) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) - -// AM_RANGE(0x24, 0x24) AM_READ(i7000_io_?_r) -// AM_RANGE(0x25, 0x25) AM_WRITE(i7000_io_?_w) - -// AM_RANGE(0x28, 0x2d) AM_READWRITE(i7000_io_joystick_r, i7000_io_joystick_w) - -// AM_RANGE(0x3b, 0x3b) AM_WRITE(i7000_io_?_w) -// AM_RANGE(0x66, 0x67) AM_WRITE(i7000_io_?_w) -// AM_RANGE(0xbb, 0xbb) AM_WRITE(i7000_io_?_w) //may be related to page-swapping... -ADDRESS_MAP_END - -DEVICE_IMAGE_LOAD_MEMBER( i7000_state, i7000_card ) -{ - UINT32 size = m_card->common_get_size("rom"); - - m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG); - m_card->common_load_rom(m_card->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -static const gfx_layout i7000_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( i7000 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, i7000_charlayout, 0, 8 ) -GFXDECODE_END - -/**************************** -* Video/Character functions * -****************************/ - -TILE_GET_INFO_MEMBER(i7000_state::get_bg_tile_info) -{ - SET_TILE_INFO_MEMBER(0, /*code:*/ m_videoram[tile_index], /*color:*/ 0, 0); -} - -void i7000_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(i7000_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 40, 25); -} - -UINT32 i7000_state::screen_update_i7000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} - -/* ROCKWELL 6545 - Transparent Memory Addressing */ -MC6845_ON_UPDATE_ADDR_CHANGED(i7000_state::crtc_addr) -{ - /* What is this mandatory function meant to do ? */ -} - - -static MACHINE_CONFIG_START( i7000, i7000_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NSC800, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(i7000_mem) - MCFG_CPU_IO_MAP(i7000_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 200) /* 40x25 8x8 chars */ - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - - MCFG_SCREEN_UPDATE_DRIVER(i7000_state, screen_update_i7000) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", i7000) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(i7000_state, i7000) - - MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_20MHz) /* (?) */ - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_ADDR_CHANGED_CB(i7000_state, crtc_addr) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Programmable timer */ - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) -// MCFG_PIT8253_CLK0(XTAL_4MHz / 2) /* TODO: verify on PCB */ -// MCFG_PIT8253_OUT0_HANDLER(WRITELINE(i7000_state,i7000_pit_out0)) -// MCFG_PIT8253_CLK1(XTAL_4MHz / 2) /* TODO: verify on PCB */ -// MCFG_PIT8253_OUT1_HANDLER(WRITELINE(i7000_state,i7000_pit_out1)) - MCFG_PIT8253_CLK2(XTAL_4MHz / 2) /* TODO: verify on PCB */ - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) - - /* Keyboard interface */ - MCFG_DEVICE_ADD("i8279", I8279, 4000000) /* guessed value. TODO: verify on PCB */ - MCFG_I8279_OUT_SL_CB(WRITE8(i7000_state, i7000_scanlines_w)) // scan SL lines - MCFG_I8279_IN_RL_CB(READ8(i7000_state, i7000_kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // TODO: Shift key - MCFG_I8279_IN_CTRL_CB(VCC) // TODO: Ctrl key - - /* Cartridge slot */ - MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_romram_plain_slot, "i7000_card") - MCFG_GENERIC_EXTENSIONS("rom") - MCFG_GENERIC_LOAD(i7000_state, i7000_card) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("card_list", "i7000_card") -MACHINE_CONFIG_END - -ROM_START( i7000 ) - ROM_REGION( 0x1000, "boot", 0 ) - ROM_LOAD( "i7000_boot_v1_4r02_15_10_85_d52d.rom", 0x0000, 0x1000, CRC(622412e5) SHA1(bf187a095600fd46a739c35132a85b5f39b2f867) ) - - ROM_REGION( 0x0800, "gfx1", 0 ) - ROM_LOAD( "i7000_chargen.rom", 0x0000, 0x0800, CRC(7ba75183) SHA1(4af799f4a8bd385e1e4e5ece378df93e1133dc12) ) - - ROM_REGION( 0x1000, "drive", 0 ) - ROM_LOAD( "i7000_drive_ci01.rom", 0x0000, 0x1000, CRC(d8d6e5c1) SHA1(93e7db42fbfaa8243973321c7fc8c51ed80780be) ) - - ROM_REGION( 0x1000, "telex", 0 ) - ROM_LOAD( "i7000_telex_ci09.rom", 0x0000, 0x1000, CRC(c1c8fcc8) SHA1(cbf5fb600e587b998f190a9e3fb398a51d8a5e87) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, i7000, 0, 0, i7000, i7000, i7000_state, i7000, "Itautec", "I-7000", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/ibm6580.c b/src/mess/drivers/ibm6580.c deleted file mode 100644 index 8a10c35a487..00000000000 --- a/src/mess/drivers/ibm6580.c +++ /dev/null @@ -1,104 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -IBM 6580 DisplayWriter. - -2013-08-19 Skeleton driver. - -A green-screen dedicated word-processing workstation. It uses 20cm floppy -disks. It could have up to 224k of ram. - -ToDo: -- Everything! -- The roms need to be loaded properly. -- Chargen rom is not dumped. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" - -class ibm6580_state : public driver_device -{ -public: - ibm6580_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - - const UINT8 *m_p_chargen; - DECLARE_PALETTE_INIT(ibm6580); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -private: - virtual void machine_reset(); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(ibm6580_mem, AS_PROGRAM, 16, ibm6580_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0xfdfff) AM_RAM - AM_RANGE(0xfe000,0xfffff) AM_ROM AM_REGION("user1", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ibm6580_io, AS_IO, 16, ibm6580_state) - //ADDRESS_MAP_UNMAP_HIGH - //ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( ibm6580 ) -INPUT_PORTS_END - -UINT32 ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -PALETTE_INIT_MEMBER( ibm6580_state, ibm6580 ) -{ - palette.set_pen_color(0, 0, 0, 0 ); /* Black */ - palette.set_pen_color(1, 0, 255, 0 ); /* Full */ - palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */ -} - -void ibm6580_state::machine_reset() -{ - m_p_chargen = memregion("chargen")->base(); -} - -static MACHINE_CONFIG_START( ibm6580, ibm6580_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 4000000) // no idea - MCFG_CPU_PROGRAM_MAP(ibm6580_mem) - MCFG_CPU_IO_MAP(ibm6580_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(ibm6580_state, screen_update) - MCFG_SCREEN_SIZE(640, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(ibm6580_state, ibm6580) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ibm6580 ) - ROM_REGION16_LE( 0x2000, "user1", 0 ) - ROM_LOAD16_BYTE("8493823.bin", 0x0001, 0x1000, CRC(0bea066f) SHA1(8a42e24b609df7d9ca9cd52929702a61f7024635)) - ROM_LOAD16_BYTE("8493822.bin", 0x0000, 0x1000, CRC(6e67f41a) SHA1(600fee505efe5cbcc8bdbab91d233378c7be4f12)) - - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "8493383.bin", 0x0000, 0x2000, NO_DUMP ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, ibm6580, 0, 0, ibm6580, ibm6580, driver_device, 0, "IBM", "IBM 6580 DisplayWriter", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/ibmpc.c b/src/mess/drivers/ibmpc.c deleted file mode 100644 index 9f9f73e18a5..00000000000 --- a/src/mess/drivers/ibmpc.c +++ /dev/null @@ -1,577 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Miodrag Milanovic -/*************************************************************************** - - drivers/pc.c - -Driver file for IBM PC, IBM PC XT, and related machines. - - PC-XT memory map - - 00000-9FFFF RAM - A0000-AFFFF NOP or videoram EGA/VGA - B0000-B7FFF videoram MDA, page #0 - B8000-BFFFF videoram CGA and/or MDA page #1, T1T mapped RAM - C0000-C7FFF NOP or ROM EGA/VGA - C8000-C9FFF ROM XT HDC #1 - CA000-CBFFF ROM XT HDC #2 - D0000-EFFFF NOP or 'adapter RAM' - F0000-FDFFF NOP or ROM Basic + other Extensions - FE000-FFFFF ROM - -IBM PC 5150 -=========== - -- Intel 8088 at 4.77 MHz derived from a 14.31818 MHz crystal -- Onboard RAM: Revision A mainboard - min. 16KB, max. 64KB - Revision B mainboard - min. 64KB, max. 256KB -- Total RAM (using 5161 expansion chassis or ISA memory board): 512KB (rev 1 or rev 2 bios) or 640KB (rev 3 bios) -- Graphics: MDA, CGA, or MDA and CGA -- Cassette port -- Five ISA expansion slots (short type) -- PC/XT keyboard 83-key 'IBM Model F' (some early 'IBM Model M' keyboards can produce scancodes compatible with this as well, but it was an undocumented feature unsupported by IBM) -- Optional 8087 co-processor -- Optional up to 4 (2 internal, 2 external) 160KB single-sided or 360KB double-sided 5 1/4" floppy drives -- Optional 10MB hard disk (using 5161 expansion chassis) -- Optional Game port joystick ISA card (two analog joysticks with 2 buttons each) -- Optional Parallel port ISA card, Unidirectional (upgradable to bidirectional (as is on the ps/2) with some minor hacking; IBM had all the circuitry there but it wasn't hooked up properly) -- Optional Serial port ISA card - - -IBM PC-JR -========= - - -IBM PC-XT 5160 -============== - -- Intel 8088 at 4.77 MHz derived from a 14.31818 MHz crystal -- Onboard RAM: Revision A mainboard (P/N 6181655) - min. 64KB, max. 256KB (4x 64KB banks of 9 IMS2600 64kx1 drams plus parity); could be upgraded to 640KB with a hack; may support the weird 256k stacked-chip dram the AT rev 1 uses) - Revision B mainboard - min. 256KB, max 640KB (2x 256KB, 2x 64KB banks) -- Total RAM (using 5161 expansion chassis, ISA memory board, or rev B mainboard): 640KB -- Graphics: MDA, CGA, MDA and CGA, EGA, EGA and MDA, or EGA and CGA -- One internal 360KB double-sided 5 1/4" floppy drive -- PC/XT keyboard 83-key 'IBM Model F' (BIOS revisions 1 and 2) (some early 'IBM Model M' keyboards can produce scancodes compatible with this as well, but it was an undocumented feature unsupported by IBM) -- 84-key 'AT/Enhanced' keyboard or 101-key 'IBM Model M' (BIOS revisions 3 and 4) -- Eight ISA expansion slots (short type) -- Optional 8087 co-processor -- Optional second internal 360KB double-sided 5 1/4" floppy drive, if no internal hard disk -- Optional 'half height' 720KB double density 3 1/2" floppy drive -- Optional 10MB hard disk via 5161 expansion chassis -- Optional 10MB or 20MB Seagate ST-412 hard disk (in place of second floppy drive) -- Optional up to 2 external 360KB double-sided 5 1/4" floppy drive -- Optional Game port joystick ISA card (two analog joysticks with 2 buttons each) -- Optional Parallel port ISA card, Unidirectional (upgradable to bidirectional (as is on the ps/2) with some minor hacking; IBM had all the circuitry there but it wasn't hooked up properly) -- Optional Serial port ISA card - - -IBM PC Jr: - -TODO: Which clock signals are available in a PC Jr? - - What clock is Y1? This eventually gets passed on to the CPU (ZM40?) and some other components by a 8284 (ZM8?). - - Is the clock attached to the Video Gate Array (ZM36?) exactly 14MHz? - -IBM CGA/MDA: -Several different font roms were available, depending on what region the card was purchased in; -Currently known: (probably exist for all the standard codepages) -5788005: US (code page 437) -???????: Greek (code page 737) NOT DUMPED! -???????: Estonian/Lithuanian/Latvian (code page 775) NOT DUMPED! -???????: Icelandic (code page 861, characters 0x8B-0x8D, 0x95, 0x97-0x98, 0x9B, 0x9D, 0xA4-0xA7 differ from cp437) NOT DUMPED! -4733197: Danish/Norwegian (code page 865, characters 0x9B and 0x9D differ from cp437) -???????: Hebrew (code page 862) NOT DUMPED! - -========================= -IBM Roms thanks to Frode -========================= - -1504036.bin: IBM 4860 PC/jr BIOS. visible in memory at F0000-F7FFF. -1504037.bin: IBM 4860 PC/jr BIOS. visible in memory at F8000-FFFFF. - - ROM_LOAD( "1504036.bin", 0xf0000, 0x8000, CRC(de8fa668) SHA1(459341e033be1199c107e56d33680170e144b689)) - ROM_LOAD( "1504037.bin", 0xf8000, 0x8000, CRC(04c05f17) SHA1(319423cb6bb02b399ecf6e0cb82015c16ada68f5)) - -5601JDA.bin: IBM 5511 PC/JX BIOS. visible in memory at F0000-FFFFF. - ROM_LOAD( "5601jda.bin", 0xf0000, 0x10000, CRC(b1e12366) SHA1(751feb16b985aa4f1ec1437493ff77e2ebd5e6a6)) - -7396917.bin: IBM 5140 PC/Convertible BIOS. visible in memory at F0000-F7FFF. -7396918.bin: IBM 5140 PC/Convertible BIOS. visible in memory at F8000-FFFFF. - ROM_LOAD( "7396917.bin", 0xf0000, 0x8000, CRC(95c35652) SHA1(2bdac30715dba114fbe0895b8b4723f8dc26a90d)) - ROM_LOAD( "7396918.bin", 0xf8000, 0x8000, CRC(1b4202b0) SHA1(4797ff853ba1675860f293b6368832d05e2f3ea9)) - -5700019.bin: IBM 5150 PC BASIC 1.0. visible in memory at F6000-F7FFF. -5700027.bin: IBM 5150 PC BASIC 1.0. visible in memory at F8000-F9FFF. -5700035.bin: IBM 5150 PC BASIC 1.0. visible in memory at FA000-FBFFF. -5700043.bin: IBM 5150 PC BASIC 1.0. visible in memory at FC000-FDFFF. - ROM_LOAD( "5700019.bin", 0xf6000, 0x2000, CRC(b59e8f6c) SHA1(7a5db95370194c73b7921f2d69267268c69d2511)) - ROM_LOAD( "5700027.bin", 0xf8000, 0x2000, CRC(bfff99b8) SHA1(ca2f126ba69c1613b7b5a4137d8d8cf1db36a8e6)) - ROM_LOAD( "5700035.bin", 0xfa000, 0x2000, CRC(9fe4ec11) SHA1(89af8138185938c3da3386f97d3b0549a51de5ef)) - ROM_LOAD( "5700043.bin", 0xfc000, 0x2000, CRC(ea2794e6) SHA1(22fe58bc853ffd393d5e2f98defda7456924b04f)) - - -5700051.bin: First early IBM 5150 PC BIOS. visible in memory at FE000-FFFFF. - ROM_LOAD( "5700051.bin", 0xfe000, 0x2000, CRC(12d33fb8) SHA1(f046058faa016ad13aed5a082a45b21dea43d346)) -5700671.bin: Second early IBM 5150 PC BIOS. visible in memory at FE000-FFFFF. - ROM_LOAD( "5700671.bin", 0xfe000, 0x2000, CRC(b7d4ec46) SHA1(bdb06f846c4768f39eeff7e16b6dbff8cd2117d2)) - -5000019.bin: IBM 5150 PC BASIC 1.1. visible in memory at F6000-F7FFF. -5000021.bin: IBM 5150 PC BASIC 1.1. visible in memory at F8000-F9FFF. -5000022.bin: IBM 5150 PC BASIC 1.1. visible in memory at FA000-FBFFF. -5000023.bin: IBM 5150 PC BASIC 1.1. visible in memory at FC000-FDFFF. - ROM_LOAD( "5000019.bin", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) - ROM_LOAD( "5000021.bin", 0xf8000, 0x2000, CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731)) - ROM_LOAD( "5000022.bin", 0xfa000, 0x2000, CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74)) - ROM_LOAD( "5000023.bin", 0xfc000, 0x2000, CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7)) - - -5700476.0.bin: Late IBM 5150 PC BIOS. visible in memory at FE000-FFFFF. (1981 copyright) - ROM_LOAD( "1501476.0.bin", 0xfe000, 0x2000, CRC(9b791d3e) SHA1(0c93f07e62cd27688f7f473e9787ef5308535fa0)) -5700476.1.bin: Late IBM 5150 PC BIOS. visible in memory at FE000-FFFFF. (1982 copyright) - ROM_LOAD( "1501476.1.bin", 0xfe000, 0x2000, CRC(e88792b3) SHA1(40fce6a94dda4328a8b608c7ae2f39d1dc688af4)) - -5000027.bin: Early IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F6000-F7FFF. -5000026.bin: Prototype IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. - ROM_LOAD( "5000027.bin", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) - ROM_LOAD( "5000026.bin", 0xf8000, 0x8000, CRC(3c9b0ac3) SHA1(271c9f4cef5029a1560075550b67c3395db09fef)) - -6359116.bin: Early IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F6000-F7FFF. - ROM_LOAD( "6359116.bin", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) - -1501512.bin: Early IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. - ROM_LOAD( "1501512.bin", 0xf8000, 0x8000, CRC(79522c3d) SHA1(6bac726d8d033491d52507278aa388ec04cf8b7e)) - -62x0854.bin: First late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F0000-F7FFF. (PROM) -62x0851.bin: First late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. (PROM) - ROM_LOAD( "62x0854.bin", 0xf0000, 0x8000, CRC(b5fb0e83) SHA1(937b43759ffd472da4fb0fe775b3842f5fb4c3b3)) - ROM_LOAD( "62x0851.bin", 0xf8000, 0x8000, CRC(1054f7bd) SHA1(e7d0155813e4c650085144327581f05486ed1484)) - -62x0853.bin: First late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F0000-F7FFF. (EPROM) -62x0852.bin: First late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. (EPROM) - ROM_LOAD( "62x0853.bin", 0xf0000, 0x8000, CRC(b5fb0e83) SHA1(937b43759ffd472da4fb0fe775b3842f5fb4c3b3)) - ROM_LOAD( "62x0852.bin", 0xf8000, 0x8000, CRC(1054f7bd) SHA1(e7d0155813e4c650085144327581f05486ed1484)) - -68x4370.bin: Second late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F0000-F7FFF. (PROM) -62x0890.bin: Second late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. (PROM) - ROM_LOAD( "68x4370.bin", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2)) - ROM_LOAD( "62x0890.bin", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb)) - -62x0819.bin: Second late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F0000-F7FFF. (EPROM) -59x7268.bin: Second late IBM 5160 PC/XT BIOS/BASIC 1.1. visible in memory at F8000-FFFFF. (EPROM) - ROM_LOAD( "62x0819.bin", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2)) - ROM_LOAD( "59x7268.bin", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb)) - -78x7460.bin: IBM 5162 PC/XT 286 BIOS. visible in even memory at F0000-FFFFF (mirror at E0000-EFFFF). -78x7461.bin: IBM 5162 PC/XT 286 BIOS. visible in odd memory at F0000-FFFFF (mirror at E0000-EFFFF). - ROM_LOAD16_BYTE( "78x7460.bin", 0xf0000, 0x8000, CRC(1db4bd8f) SHA1(7be669fbb998d8b4626fefa7cd1208d3b2a88c31)) - ROM_LOAD16_BYTE( "78x7461.bin", 0xf0001, 0x8000, CRC(be14b453) SHA1(ec7c10087dbd53f9c6d1174e8f14212e2aec1818)) - -6181028.bin: First 6MHz IBM 5170 PC/AT BIOS. visible in even memory at F0000-FFFFF. -6181029.bin: First 6MHz IBM 5170 PC/AT BIOS. visible in odd memory at F0000-FFFFF. - ROM_LOAD16_BYTE( "6181028.bin", 0xf0000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a)) - ROM_LOAD16_BYTE( "6181029.bin", 0xf0001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be)) - -6480090.bin: Second 6MHz IBM 5170 PC/AT BIOS. visible in even memory at F0000-FFFFF. -6480091.bin: Second 6MHz IBM 5170 PC/AT BIOS. visible in odd memory at F0000-FFFFF. - ROM_LOAD16_BYTE( "6480090.bin", 0xf0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e)) - ROM_LOAD16_BYTE( "6480091.bin", 0xf0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16)) - -62x0820.bin: 8MHz IBM 5170 PC/AT BIOS. visible in even memory at F0000-FFFFF. (PROM) -62x0821.bin: 8MHz IBM 5170 PC/AT BIOS. visible in odd memory at F0000-FFFFF. (PROM) - ROM_LOAD( "62x0820.bin", 0xf0000, 0x8000, CRC(e9cc3761) SHA1(ff9373c1a1f34a32fb6acdabc189c61b01acf9aa)) - ROM_LOAD( "62x0821.bin", 0xf0001, 0x8000, CRC(b5978ccb) SHA1(2a1aeb9ae3cd7e60fc4c383ca026208b82156810)) - -61x9266.bin: 8MHz IBM 5170 PC/AT BIOS. visible in even memory at F0000-FFFFF. (EPROM) -61x9265.bin: 8MHz IBM 5170 PC/AT BIOS. visible in odd memory at F0000-FFFFF. (EPROM) - ROM_LOAD( "61x9265.bin", 0xf0001, 0x8000, CRC(c32713e4) SHA1(22ed4e2be9f948682891e2fd056a97dbea01203c)) - ROM_LOAD( "61x9266.bin", 0xf0000, 0x8000, CRC(4995be7a) SHA1(8e8e5c863ae3b8c55fd394e345d8cca48b6e575c)) - - -5788005.bin: IBM MDA/CGA font. Not mapped in PC memory. (American manufacture, otherwise similar to the European manufacture) - ROM_LOAD( "5788005.bin", 0x0000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) - -6359300.bin: IBM MDA/CGA font. Not mapped in PC memory. (European manufacture, otherwise similar to the American manufacture) - ROM_LOAD( "6359300.bin", 0x0000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) - -4733197.bin: IBM MDA/CGA Alternative font. Not mapped in PC memory. - ROM_LOAD( "4733197.bin", 0x0000, 0x2000, CRC(650c0f85) SHA1(0c8ac77248a9856d065b1c64658e712ea55b7507)) - -6277356.bin: IBM EGA ROM. Visible in memory at C3FFF-C0000. - ROM_LOAD( "6277356.bin", 0x0000, 0x4000, CRC(dc146448) SHA1(dc0794499b3e499c5777b3aa39554bbf0f2cc19b)) - -8222554.bin: IBM VGA ROM. Visible in memory at C0000-C5FFF. - ROM_LOAD( "8222554.bin", 0x0000, 0x6000, CRC(6c12d745) SHA1(c0156607100e377c6c9563f23967409dab3ab92b)) - -5000059.bin: First version Hard drive controller ROM. Visible in memory at C8000-C9FFF. - ROM_LOAD( "5000059.bin", 0xc8000, 0x2000, CRC(03e0ee9a) SHA1(6691be4f6a8d690c696ad8b259708d3e7e87ad89)) - -6359121.bin: First version Hard drive controller ROM. Visible in memory at C8000-C9FFF. - ROM_LOAD( "6359121.bin", 0xc8000, 0x2000, CRC(03e0ee9a) SHA1(6691be4f6a8d690c696ad8b259708d3e7e87ad89)) - -59x7291.bin: Second version Hard drive controller ROM. Visible in memory at C8000-C8FFF. - ROM_LOAD( "59x7291.bin", 0xc8000, 0x1000, CRC(25920437) SHA1(de970bcc5c6f1b588fbc4c76617165ce8eb2bf1d)) - -104839e.bin: Hard drive controller Z80 firmware ROM. Not mapped in PC memory. (Mapped in Z80 microcontroller memory at 0000-7FFF) - ROM_LOAD( "104839e.bin", 0x0000, 0x1000, CRC(3ad32fcc) SHA1(0127fa520aaee91285cb46a640ed835b4554e4b3)) - -6323581.bin: 3270 Keyboard adapter ROM. The first 0x800 bytes visible in memory at C0000-C07FF. The later 0x1800 bytes visible in memory at CA000-CB7FF. - ROM_LOAD( "6323581.bin", 0xc0000, 0x2000, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81)) - -1504161.bin: 3270 Character ROM (pixels 0-7). Not mapped in PC memory. -1504162.bin: 3270 Character ROM (pixel 8). Not mapped in PC memory. - ROM_LOAD( "1504161.bin", 0x0000, 0x2000, CRC(d9246cf5) SHA1(2eaed495893a4e6649b04d10dada7b5ef4abd140)) - ROM_LOAD( "1504162.bin", 0x2000, 0x2000, CRC(59e1dc32) SHA1(337b5cced203345a5acfb02532d6b5f526902ee7)) - -6137323.bin: Professional Graphics Controller, first half of x86 firmware. Not mapped in PC memory. (Mapped in 8088-2 microcontroller memory at 00000-07FFF) -6137322.bin: Professional Graphics Controller, second half of x86 firmware. Not mapped in PC memory. (Mapped in 8088-2 microcontroller memory at 08000-0FFFF and any address within (8-F)(0-F)(3/7/B/F)00-(8-F)(0-F)(3/7/B/F)FF) -___MISSING___ 6137560.bin: Professional Graphics Controller, CGA emulation font. Not mapped in PC memory. - ROM_LOAD( "6137322.bin", 0x8000, 0x8000, CRC(5e6cc82f) SHA1(45b3ffb5a9c51986862f8d47b3e03dcaaf4073d5)) - ROM_LOAD( "6137323.bin", 0x0000, 0x8000, CRC(f564f342) SHA1(c5ef17fd1569043cb59f61faf828ea8b0ee95526)) - - -XC215 C 0.bin: IBM Music feature card Z80 firmware ROM. Not mapped in PC memory. (Mapped in Z80 microcontroller memory at 0000-7FFF) - ROM_LOAD( "xc215 c 0.bin", 0x0000, 0x8000, CRC(28c58a4f) SHA1(e7edf28d20e6c146e3144526c89cd6beea64663b)) - -XT U44 IBM.bin: IBM 5160 PC/XT Bank-selection decoding ROM (256x4 bit). Not mapped in PC memory. - ROM_LOAD( "xt u44 ibm.bin",0x0000, 0x0080, CRC(60ebb6e5) SHA1(e96a83b2fd6a231235374272a99353ab362b8e37)) - -1503033.bin: IBM 5170 PC/AT keyboard controller i8042 firmware. Not mapped in PC memory. - ROM_LOAD( "1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729)) - -1503099.bin: IBM AT 84-key Keyboard firmware. Not mapped in PC memory. - ROM_LOAD( "1503099.bin", 0x0000, 0x0400, CRC(1e921f37) SHA1(5f722bdb3b57f5a532c02a5c3f78f30d785796f2)) - -1385001.bin: IBM Terminal 122-key Keyboard firmware. Not mapped in PC memory. - ROM_LOAD( "1385001.bin", 0x0000, 0x0400, CRC(c19767e9) SHA1(a3701e4617383a4de0fd5e2e86c4b74beaf94a7b)) - -30F9580.bin: IBM PS/2 model 30 286 even. -30F9579.bin: IBM PS/2 model 30 286 odd. - ROM_LOAD( "30f9579.bin", 0x0000, 0x10000, CRC(1448d3cb) SHA1(13fa26d895ce084278cd5ab1208fc16c80115ebe)) - ROM_LOAD( "30f9580.bin", 0x0000, 0x10000, CRC(9965a634) SHA1(c237b1760f8a4561ec47dc70fe2e9df664e56596)) - -90X7415.bin: IBM PS/2 model 25/30 external FDD support adapter. visible in memory at C8000-C9FFF. - ROM_LOAD( "90x7415.bin", 0x0000, 0x2000, CRC(02d28556) SHA1(5543a8634f90a9141cf95f6a13c71be7778ee2a1)) - - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "machine/ram.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "machine/pc_lpt.h" -#include "bus/pc_kbd/keyboards.h" -#include "includes/genpc.h" - -class ibmpc_state : public driver_device -{ -public: - ibmpc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - required_device m_maincpu; -}; - -static ADDRESS_MAP_START( pc8_map, AS_PROGRAM, 8, ibmpc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pc8_io, AS_IO, 8, ibmpc_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -static INPUT_PORTS_START( ibm5150 ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START(cga) - DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x20) -DEVICE_INPUT_DEFAULTS_END - -//static DEVICE_INPUT_DEFAULTS_START(ega) -// DEVICE_INPUT_DEFAULTS("DSW0",0x30, 0x00) -//DEVICE_INPUT_DEFAULTS_END - - -static MACHINE_CONFIG_START( ibm5150, ibmpc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8088, XTAL_14_31818MHz/3) - MCFG_CPU_PROGRAM_MAP(pc8_map) - MCFG_CPU_IO_MAP(pc8_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5150_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(cga) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") - MCFG_SOFTWARE_LIST_ADD("cass_list","ibm5150_cass") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ibm5140, ibm5150 ) - /* software lists */ - MCFG_DEVICE_REMOVE( "disk_list" ) - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5140") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( ibm5160, ibmpc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8088, XTAL_14_31818MHz/3) - MCFG_CPU_PROGRAM_MAP(pc8_map) - MCFG_CPU_IO_MAP(pc8_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(cga) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa7", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa8", pc_isa8_cards, NULL, false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("pc_disk_list","ibm5150") - MCFG_SOFTWARE_LIST_ADD("xt_disk_list","ibm5160_flop") -MACHINE_CONFIG_END - - -ROM_START( ibm5150 ) - ROM_REGION(0x100000,"maincpu", 0) -// ROM_LOAD("600963.u12", 0xc8000, 0x02000, CRC(f3daf85f) SHA1(3bd29538832d3084cbddeec92593988772755283)) /* Tandon/Western Digital Fixed Disk Adapter 600963-001__TYPE_5.U12.2764.bin - Meant for an IBM PC or XT which lacked bios support for HDDs */ - - /* Xebec 1210 and 1220 Z80-based ST409/ST412 MFM controllers */ -// ROM_LOAD("5000059.12d", 0xc8000, 0x02000, CRC(03e0ee9a) SHA1(6691be4f6a8d690c696ad8b259708d3e7e87ad89)) /* Xebec 1210 IBM OEM Fixed Disk Adapter - Revision 1, supplied with rev1 and rev2 XT, and PC/3270. supports 4 hdd types, selectable by jumpers (which on the older XTs were usually soldered to one setting) */ -// ROM_LOAD("62x0822.12d", 0xc8000, 0x02000, CRC(4cdd2193) SHA1(fe8f88333b5e13e170bf637a9a0090383dee454d)) /* Xebec 1210 IBM OEM Fixed Disk Adapter 62X0822__(M)_AMI_8621MAB__S68B364-P__(C)IBM_CORP_1982,1985__PHILIPPINES.12D.2364.bin - Revision 2, supplied with rev3 and rev4 XT. supports 4 hdd types, selectable by jumpers (which unlike the older XTs, were changeable without requiring soldering )*/ -// ROM_LOAD("unknown.12d", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1210 Non-IBM/Retail Fixed Disk Adapter - supports 4 hdd types, selectable by jumpers (changeable without soldering) */ -// ROM_LOAD("unknown.???", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1220 Non-IBM/Retail Fixed Disk Adapter plus Floppy Disk Adapter - supports 4 hdd types, selectable by jumpers (changeable without soldering) */ - - /* IBM PC 5150 (rev 3: 1501-476 10/27/82) 5-screw case 64-256k MB w/1501981 CGA Card, ROM Basic 1.1 */ - ROM_DEFAULT_BIOS( "rev3" ) - - ROM_SYSTEM_BIOS( 0, "rev3", "IBM PC 5150 1501476 10/27/82" ) - ROMX_LOAD("5000019.u29", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(1)) /* ROM Basic 1.1 F6000-F7FFF; IBM P/N: 5000019, FRU: 6359109 */ - ROMX_LOAD("5000021.u30", 0xf8000, 0x2000, CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(1)) /* ROM Basic 1.1 F8000-F9FFF; IBM P/N: 5000021, FRU: 6359111 */ - ROMX_LOAD("5000022.u31", 0xfa000, 0x2000, CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(1)) /* ROM Basic 1.1 FA000-FBFFF; IBM P/N: 5000022, FRU: 6359112 */ - ROMX_LOAD("5000023.u32", 0xfc000, 0x2000, CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(1)) /* ROM Basic 1.1 FC000-FDFFF; IBM P/N: 5000023, FRU: 6359113 */ - ROMX_LOAD("1501476.u33", 0xfe000, 0x2000, CRC(e88792b3) SHA1(40fce6a94dda4328a8b608c7ae2f39d1dc688af4), ROM_BIOS(1)) - - /* IBM PC 5150 (rev 1: 04/24/81) 2-screw case 16-64k MB w/MDA Card, ROM Basic 1.0 */ - ROM_SYSTEM_BIOS( 1, "rev1", "IBM PC 5150 5700051 04/24/81" ) - ROMX_LOAD("5700019.u29", 0xf6000, 0x2000, CRC(b59e8f6c) SHA1(7a5db95370194c73b7921f2d69267268c69d2511), ROM_BIOS(2)) /* ROM Basic 1.0 F6000-F7FFF */ - ROMX_LOAD("5700027.u30", 0xf8000, 0x2000, CRC(bfff99b8) SHA1(ca2f126ba69c1613b7b5a4137d8d8cf1db36a8e6), ROM_BIOS(2)) /* ROM Basic 1.0 F8000-F9FFF */ - ROMX_LOAD("5700035.u31", 0xfa000, 0x2000, CRC(9fe4ec11) SHA1(89af8138185938c3da3386f97d3b0549a51de5ef), ROM_BIOS(2)) /* ROM Basic 1.0 FA000-FBFFF */ - ROMX_LOAD("5700043.u32", 0xfc000, 0x2000, CRC(ea2794e6) SHA1(22fe58bc853ffd393d5e2f98defda7456924b04f), ROM_BIOS(2)) /* ROM Basic 1.0 FC000-FDFFF */ - ROMX_LOAD("5700051.u33", 0xfe000, 0x2000, CRC(12d33fb8) SHA1(f046058faa016ad13aed5a082a45b21dea43d346), ROM_BIOS(2)) - - /* IBM PC 5150 (rev 2: 10/19/81) 2-screw case, 16-64k MB w/MDA Card, ROM Basic 1.0 */ - ROM_SYSTEM_BIOS( 2, "rev2", "IBM PC 5150 5700671 10/19/81" ) - ROMX_LOAD("5700019.u29", 0xf6000, 0x2000, CRC(b59e8f6c) SHA1(7a5db95370194c73b7921f2d69267268c69d2511), ROM_BIOS(3)) /* ROM Basic 1.0 F6000-F7FFF */ - ROMX_LOAD("5700027.u30", 0xf8000, 0x2000, CRC(bfff99b8) SHA1(ca2f126ba69c1613b7b5a4137d8d8cf1db36a8e6), ROM_BIOS(3)) /* ROM Basic 1.0 F8000-F9FFF */ - ROMX_LOAD("5700035.u31", 0xfa000, 0x2000, CRC(9fe4ec11) SHA1(89af8138185938c3da3386f97d3b0549a51de5ef), ROM_BIOS(3)) /* ROM Basic 1.0 FA000-FBFFF */ - ROMX_LOAD("5700043.u32", 0xfc000, 0x2000, CRC(ea2794e6) SHA1(22fe58bc853ffd393d5e2f98defda7456924b04f), ROM_BIOS(3)) /* ROM Basic 1.0 FC000-FDFFF */ - ROMX_LOAD("5700671.u33", 0xfe000, 0x2000, CRC(b7d4ec46) SHA1(bdb06f846c4768f39eeff7e16b6dbff8cd2117d2), ROM_BIOS(3)) - - /* Z80 on the Xebec 1210 and 1220 Hard Disk Controllers */ -// ROM_REGION(0x10000, "cpu1", 0) -// ROM_LOAD("104839re.12a", 0x0000, 0x1000, CRC(3ad32fcc) SHA1(0127fa520aaee91285cb46a640ed835b4554e4b3)) /* Xebec 1210 IBM OEM Hard Disk Controller, silkscreened "104839RE // COPYRIGHT // XEBEC 1986" - Common for both XEBEC 1210 IBM OEM revisions. Some cards have the rom marked 104839E instead (John Eliott's card is like this), but contents are the same. */ -// /* Other versions probably exist for the non-IBM/Retail 1210 and the 1220 */ - - /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ - ROM_REGION(0x2000,"gfx1", 0) - ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ -ROM_END -ROM_START( ibm5155 ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD("5000027.u19", 0xf0000, 0x8000, CRC(fc982309) SHA1(2aa781a698a21c332398d9bc8503d4f580df0a05)) - ROM_LOAD("1501512.u18", 0xf8000, 0x8000, CRC(79522c3d) SHA1(6bac726d8d033491d52507278aa388ec04cf8b7e)) - /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ - ROM_REGION(0x2000,"gfx1", 0) - ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ -ROM_END -ROM_START( ibm5140 ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD("7396917.bin", 0xf0000, 0x08000, CRC(95c35652) SHA1(2bdac30715dba114fbe0895b8b4723f8dc26a90d)) - ROM_LOAD("7396918.bin", 0xf8000, 0x08000, CRC(1b4202b0) SHA1(4797ff853ba1675860f293b6368832d05e2f3ea9)) - /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ - ROM_REGION(0x2000,"gfx1", 0) - ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ -ROM_END -#ifdef UNUSED_DEFINITION -ROM_START( ibmpca ) - ROM_REGION(0x100000,"maincpu",0) - ROM_LOAD("basicc11.f6", 0xf6000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) - ROM_LOAD("basicc11.f8", 0xf8000, 0x2000, CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731)) - ROM_LOAD("basicc11.fa", 0xfa000, 0x2000, CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74)) - ROM_LOAD("basicc11.fc", 0xfc000, 0x2000, CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7)) - ROM_LOAD("pc081682.bin", 0xfe000, 0x2000, CRC(5c3f0256) SHA1(b42c78abd0a9c630a2f972ad2bae46d83c3a2a09)) - - /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ - ROM_REGION(0x2000,"gfx1", 0) - ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ -ROM_END -#endif - - -ROM_START( ibm5160 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) -// ROM_LOAD("600963.u12", 0xc8000, 0x02000, CRC(f3daf85f) SHA1(3bd29538832d3084cbddeec92593988772755283)) /* Tandon/Western Digital Fixed Disk Adapter 600963-001__TYPE_5.U12.2764.bin */ - - /* PC/3270 has a 3270 keyboard controller card, plus a rom on that card to tell the pc how to run it. - * Unlike the much more complex keyboard controller used in the AT/3270, this one only has one rom, - a motorola made "(M)1503828 // XE // 8434A XM // SC81155P" custom (an MCU?; the more complicated - 3270/AT keyboard card uses this same exact chip), an 8254, and some logic chips. - Thanks to high resolution pictures provided by John Elliott, I can see that the location of the - chips is unlabeled (except for by absolute pin position on the back), and there are no pals or proms. - * The board is stickered "2683114 // 874999 // 8446 SU" on the front. - * The board has a single DE-9 connector where the keyboard dongle connects to. - * The keyboard dongle has two connectors on it: a DIN-5 connector which connects to the Motherboard's - keyboard port, plus an RJ45-lookalike socket which the 3270 keyboard connects to. - * The rom is mapped very strangely to avoid hitting the hard disk controller: - The first 0x800 bytes appear at C0000-C07FF, and the last 0x1800 bytes appear at 0xCA000-CB7FF - */ -// ROM_LOAD("6323581.bin", 0xc0000, 0x00800, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81)) -// ROM_LOAD("6323581.bin", 0xca000, 0x01800, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81) ROM_SKIP(0x800)) - - /* Xebec 1210 and 1220 Z80-based ST409/ST412 MFM controllers */ -// ROM_LOAD("5000059.12d", 0xc8000, 0x02000, CRC(03e0ee9a) SHA1(6691be4f6a8d690c696ad8b259708d3e7e87ad89)) /* Xebec 1210 IBM OEM Fixed Disk Adapter - Revision 1, supplied with rev1 and rev2 XT, and PC/3270. supports 4 hdd types, selectable by jumpers (which on the older XTs were usually soldered to one setting) */ -// ROM_LOAD("62x0822.12d", 0xc8000, 0x02000, CRC(4cdd2193) SHA1(fe8f88333b5e13e170bf637a9a0090383dee454d)) /* Xebec 1210 IBM OEM Fixed Disk Adapter 62X0822__(M)_AMI_8621MAB__S68B364-P__(C)IBM_CORP_1982,1985__PHILIPPINES.12D.2364.bin - Revision 2, supplied with rev3 and rev4 XT. supports 4 hdd types, selectable by jumpers (which unlike the older XTs, were changeable without requiring soldering )*/ -// ROM_LOAD("unknown.12d", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1210 Non-IBM/Retail Fixed Disk Adapter - supports 4 hdd types, selectable by jumpers (changeable without soldering) */ -// ROM_LOAD("unknown.???", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1220 Non-IBM/Retail Fixed Disk Adapter plus Floppy Disk Adapter - supports 4 hdd types, selectable by jumpers (changeable without soldering) */ - - - ROM_DEFAULT_BIOS( "rev4" ) - - ROM_SYSTEM_BIOS( 0, "rev1", "IBM XT 5160 08/16/82" ) /* ROM at u18 marked as BAD_DUMP for now, as current dump, while likely correct, was regenerated from a number of smaller dumps, and needs a proper redump. */ - ROMX_LOAD("5000027.u19", 0xf0000, 0x8000, CRC(fc982309) SHA1(2aa781a698a21c332398d9bc8503d4f580df0a05), ROM_BIOS(1) ) - ROMX_LOAD("5000026.u18", 0xf8000, 0x8000, BAD_DUMP CRC(3c9b0ac3) SHA1(271c9f4cef5029a1560075550b67c3395db09fef), ROM_BIOS(1) ) /* This is probably a good dump, and works fine, but as it was manually regenerated based on a partial dump, it needs to be reverified. It's a very rare rom revision and may have only appeared on XT prototypes. */ - - ROM_SYSTEM_BIOS( 1, "rev2", "IBM XT 5160 11/08/82" ) /* Same as PC 5155 BIOS and PC/3270 BIOS */ - ROMX_LOAD("5000027.u19", 0xf0000, 0x8000, CRC(fc982309) SHA1(2aa781a698a21c332398d9bc8503d4f580df0a05), ROM_BIOS(2) ) /* silkscreen "MK37050N-4 // 5000027" - FRU: 6359116 - Contents repeat 4 times; Alt Silkscreen (from yesterpc.com): "(M) // 5000027 // (C) 1983 IBM CORP // X E // 8425B NM"*/ - ROMX_LOAD("1501512.u18", 0xf8000, 0x8000, CRC(79522c3d) SHA1(6bac726d8d033491d52507278aa388ec04cf8b7e), ROM_BIOS(2) ) /* silkscreen "MK38036N-25 // 1501512 // ZA // (C)IBM CORP // 1981,1983 // D MALAYSIA // 8438 AP"*/ - - ROM_SYSTEM_BIOS( 2, "rev3", "IBM XT 5160 01/10/86" ) /* Has enhanced keyboard support and a 3.5" drive */ - ROMX_LOAD("62x0854.u19", 0xf0000, 0x8000, CRC(b5fb0e83) SHA1(937b43759ffd472da4fb0fe775b3842f5fb4c3b3), ROM_BIOS(3) ) - ROMX_LOAD("62x0851.u18", 0xf8000, 0x8000, CRC(1054f7bd) SHA1(e7d0155813e4c650085144327581f05486ed1484), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS( 3, "rev4", "IBM XT 5160 05/09/86" ) /* Minor bugfixes to keyboard code, supposedly */ - ROMX_LOAD("68x4370.u19", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2), ROM_BIOS(4)) - ROMX_LOAD("62x0890.u18", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb), ROM_BIOS(4)) - -// ROM_SYSTEM_BIOS( 4, "xtdiag", "IBM XT 5160 w/Supersoft Diagnostics" ) /* ROMs marked as BAD_DUMP for now. We expect the data to be in a different ROM chip layout */ -// ROMX_LOAD("basicc11.f6", 0xf6000, 0x2000, BAD_DUMP CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(5) ) -// ROMX_LOAD("basicc11.f8", 0xf8000, 0x2000, BAD_DUMP CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(5) ) -// ROMX_LOAD("basicc11.fa", 0xfa000, 0x2000, BAD_DUMP CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(5) ) -// ROMX_LOAD("basicc11.fc", 0xfc000, 0x2000, BAD_DUMP CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(5) ) -// ROMX_LOAD("xtdiag.bin", 0xfe000, 0x2000, CRC(4e89a4d8) SHA1(39a28fb2fe9f1aeea24ed2c0255cebca76e37ed7), ROM_BIOS(5) ) - - /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ - ROM_REGION(0x2000,"gfx1", 0) - ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ - - /* Z80 ROM on the Xebec 1210 and 1220 Hard Disk Controllers */ -// ROM_REGION(0x10000, "cpu1", 0) -// ROM_LOAD("104839re.12a", 0x0000, 0x1000, CRC(3ad32fcc) SHA1(0127fa520aaee91285cb46a640ed835b4554e4b3)) /* Xebec 1210 IBM OEM Hard Disk Controller, silkscreened "104839RE // COPYRIGHT // XEBEC 1986" - Common for both XEBEC 1210 IBM OEM revisions. Some cards have the rom marked 104839E instead (John Eliott's card is like this), but contents are the same. */ -// /* Other versions probably exist for the non-IBM/Retail 1210 and the 1220 */ - - - /* PC/3270 and AT/3270 have a set of two (optionally 3) 3270PGC programmable graphics controller cards on them which - have 2 extra roms, plus a number of custom chips and at least one MCU. - Information on these three boards plus the keyboard interface can be found at: - http://www.seasip.info/VintagePC/5271.html - *** The descriptions below are based on the cards from the AT/3270, which are slightly - different from the PC/3270 cards. Changes between the PC/3270 and AT/3270 video cards are - listed: - 1. The card lip edge is changed on the APA and PS cards to allow them to be placed - in a 16-bit ISA slot. - 2. The Main Display board is exactly the same PCB (hence cannot be placed in a 16-bit - ISA slot), but the socket to the left of the 8255 is now populated, and has a lot of - rework wires connected to various places on the PCB. - 3. The APA board was completely redone, and no longer has an 8254 (though it does have an - empty socket) and has ?twice as much memory on it? (not sure about this). The APA - board also now connects to both main board connectors 1 and 3, instead of only - connector 1. - 4. The PS board has been minorly redone to allow clearance for a 16-bit ISA connector, - but no other significant chip changes were made. The connector 3 still exists on the - board but is unpopulated. Connector 2 still connects to the Main display board as - before. - - ** The Main Display Board (with one 48-pin custom, 3 40 pin customs at least one of which is - an MCU, four 2016BP-10 srams, an 8254 and an 8255 on it, two crystals (16.257MHz and - 21.676MHz) plus two mask roms ) is stickered "61X6579 // 983623 // 6390 SU" on the front. - * The pcb is trace-marked "6320987" on both the front and back. - * The card has a DE-9 connector on it for a monitor. - * The customs are marked: - "1503192 // TC15G008P-0009 // JAPAN 8549A" (40 pins, at U52) - "1503193 // TC15G008AP-0020 // JAPAN 8610A" (48 pins, at U29) - "(M)1503194 // XE KGA005 // 8616N XM // SC81156P" (40 pins, at U36, likely an MCU) - "S8613 // SCN2672B // C4N40 A // CP3303" (40 pins, at U24, also possibly an MCU) - - ** The All Points Addressable (Frame buffer?) card (with 2 48-pin customs on it which are - probably gate arrays and not MCUs, an empty socket (28 pins, U46), an Intel Id2147H-3, - a bank of twelve 16k*4-bit inmos ims2620p-15 DRAMs (tms4416 equivalent), and an Intel - D2147K 4096*1 byte SRAM) is stickered - "6487836 // A24969 // 6400 SU" on the back. - * The pcb is trace-marked "EC 999040" on the back, and silkscreened "RC 2682819" on the front - * The customs are marked: - "6323259 // TC15G008AP-0028 // JAPAN 8606A" (48 pins, at U67) - "6323260 // TC15G022AP-0018 // JAPAN 8606A" (48 pins, at U45) - - ** The optional Programmable Symbol Card (with an AMD AM9128-10PC, and six tms4416-15NL DRAMS, - and a fleet of discrete logic chips, but no roms, pals, or proms) is stickered - "6347750 // A24866 // 6285 SU" on the front. - * The PCB is trace-marked "PROGAMMABLE SYMBOL P/N 6347751 // ASSY. NO. 6347750" on the front, - and trace-marked "|||CIM0286 ECA2466 // 94V-O" on the back. - */ -// ROM_REGION(0x4000,"gfx2", 0) -// ROM_LOAD("1504161.u11", 0x00000, 0x2000, CRC(d9246cf5) SHA1(2eaed495893a4e6649b04d10dada7b5ef4abd140)) /* silkscreen: "AMI 8613MAJ // 9591-041 // S2364B // 1504161 // PHILIPPINES" - Purpose: Pixels 0 through 7 of built-in 3270 terminal font*/ -// ROM_LOAD("1504162.u26", 0x02000, 0x2000, CRC(59e1dc32) SHA1(337b5cced203345a5acfb02532d6b5f526902ee7)) /* silkscreen: "AMI 8607MAH // 9591-042 // S2364B // 1504162 // PHILIPPINES" - Purpose: Pixel 8 of built-in 3270 terminal font*/ -ROM_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1981, ibm5150, 0, 0, ibm5150, ibm5150, driver_device, 0, "International Business Machines", "IBM PC 5150" , 0) -COMP( 1982, ibm5155, ibm5150, 0, ibm5150, ibm5150, driver_device, 0, "International Business Machines", "IBM PC 5155" , 0) -COMP( 1985, ibm5140, ibm5150, 0, ibm5140, ibm5150, driver_device, 0, "International Business Machines", "IBM PC 5140 Convertible" , MACHINE_NOT_WORKING) - -// xt class (pc but 8086) -COMP( 1982, ibm5160, ibm5150, 0, ibm5160, ibm5150, driver_device, 0, "International Business Machines", "IBM XT 5160" , 0) diff --git a/src/mess/drivers/ibmpcjr.c b/src/mess/drivers/ibmpcjr.c deleted file mode 100644 index 13f421bf12e..00000000000 --- a/src/mess/drivers/ibmpcjr.c +++ /dev/null @@ -1,705 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#include "emu.h" -#include "cpu/i86/i86.h" -#include "sound/sn76496.h" -#include "sound/speaker.h" -#include "video/pc_t1t.h" -#include "machine/ins8250.h" -#include "machine/i8255.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "machine/pckeybrd.h" -#include "machine/pc_lpt.h" -#include "machine/pc_fdc.h" -#include "bus/rs232/rs232.h" -#include "bus/rs232/ser_mouse.h" -#include "bus/pc_joy/pc_joy.h" -#include "bus/isa/fdc.h" -#include "imagedev/cassette.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -class pcjr_state : public driver_device -{ -public: - pcjr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pic8259(*this, "pic8259"), - m_pit8253(*this, "pit8253"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_cart1(*this, "cartslot1"), - m_cart2(*this, "cartslot2"), - m_ram(*this, RAM_TAG), - m_fdc(*this, "fdc"), - m_keyboard(*this, "pc_keyboard") - { } - - required_device m_maincpu; - required_device m_pic8259; - required_device m_pit8253; - required_device m_speaker; - required_device m_cassette; - required_device m_cart1; - required_device m_cart2; - required_device m_ram; - required_device m_fdc; - required_device m_keyboard; - - DECLARE_WRITE_LINE_MEMBER(out2_changed); - DECLARE_WRITE_LINE_MEMBER(keyb_interrupt); - - DECLARE_WRITE8_MEMBER(pc_nmi_enable_w); - DECLARE_READ8_MEMBER(pcjr_nmi_enable_r); - DECLARE_WRITE_LINE_MEMBER(pic8259_set_int_line); - - DECLARE_WRITE8_MEMBER(pcjr_ppi_portb_w); - DECLARE_READ8_MEMBER(pcjr_ppi_porta_r); - DECLARE_READ8_MEMBER(pcjr_ppi_portc_r); - DECLARE_WRITE8_MEMBER(pcjr_fdc_dor_w); - DECLARE_READ8_MEMBER(pcjx_port_1ff_r); - DECLARE_WRITE8_MEMBER(pcjx_port_1ff_w); - void pcjx_set_bank(int unk1, int unk2, int unk3); - - int load_cart(device_image_interface &image, generic_slot_device *slot); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pcjr_cart1) { return load_cart(image, m_cart1); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pcjr_cart2) { return load_cart(image, m_cart2); } - void pc_speaker_set_spkrdata(UINT8 data); - - UINT8 m_pc_spkrdata; - UINT8 m_pit_out2; - UINT8 m_pcjr_dor; - UINT8 m_pcjx_1ff_count; - UINT8 m_pcjx_1ff_val; - UINT8 m_pcjx_1ff_bankval; - UINT8 m_pcjx_1ff_bank[20][2]; - int m_ppi_portc_switch_high; - UINT8 m_ppi_portb; - - UINT8 m_pc_keyb_data; - UINT8 m_transferring; - UINT8 m_latch; - UINT32 m_raw_keyb_data; - int m_signal_count; - UINT8 m_nmi_enabled; - - void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - emu_timer *m_pc_int_delay_timer; - emu_timer *m_pcjr_watchdog; - emu_timer *m_keyb_signal_timer; - - enum - { - TIMER_IRQ_DELAY, - TIMER_WATCHDOG, - TIMER_KB_SIGNAL - }; - - void machine_reset(); - DECLARE_DRIVER_INIT(pcjr); -}; - -static INPUT_PORTS_START( ibmpcjr ) - PORT_INCLUDE(pc_keyboard) - - PORT_START("IN0") /* IN0 */ - PORT_BIT ( 0xf0, 0xf0, IPT_UNUSED ) - PORT_BIT ( 0x08, 0x08, IPT_CUSTOM ) PORT_VBLANK("pcvideo_pcjr:screen") - PORT_BIT ( 0x07, 0x07, IPT_UNUSED ) -INPUT_PORTS_END - -DRIVER_INIT_MEMBER(pcjr_state, pcjr) -{ - m_pc_int_delay_timer = timer_alloc(TIMER_IRQ_DELAY); - m_pcjr_watchdog = timer_alloc(TIMER_WATCHDOG); - m_keyb_signal_timer = timer_alloc(TIMER_KB_SIGNAL); -} - -void pcjr_state::machine_reset() -{ - m_pc_spkrdata = 0; - m_pit_out2 = 1; - m_ppi_portc_switch_high = 0; - m_ppi_portb = 0; - m_pcjr_dor = 0; - m_speaker->level_w(0); - - m_pcjx_1ff_count = 0; - m_pcjx_1ff_val = 0; - m_pcjx_1ff_bankval = 0; - memset(m_pcjx_1ff_bank, 0, sizeof(m_pcjx_1ff_bank)); - - m_transferring = 0; - m_latch = 0; - m_raw_keyb_data = 0; - m_nmi_enabled = 0x80; -} - -void pcjr_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_IRQ_DELAY: - m_maincpu->set_input_line(0, param ? ASSERT_LINE : CLEAR_LINE); - break; - - case TIMER_WATCHDOG: - if(m_pcjr_dor & 0x20) - m_pic8259->ir6_w(1); - else - m_pic8259->ir6_w(0); - break; - - case TIMER_KB_SIGNAL: - m_raw_keyb_data = m_raw_keyb_data >> 1; - m_signal_count--; - - if ( m_signal_count <= 0 ) - { - m_keyb_signal_timer->adjust( attotime::never, 0, attotime::never ); - m_transferring = 0; - } - break; - } -} - -/************************************************************* - * - * PCJR pic8259 configuration - * - * Part of the PCJR CRT POST test at address F0452/F0454 writes - * to the PIC enabling an IRQ which is then immediately fired, - * however it is expected that the actual IRQ is taken one - * instruction later (the irq bit is reset by the instruction - * at F0454). Delaying taking of an IRQ by one instruction for - * all cases breaks floppy emulation. This seems to be a really - * tight corner case. For now we delay the IRQ by one instruction - * only for the PCJR and only when it's inside the POST checks. - * - *************************************************************/ - -WRITE_LINE_MEMBER(pcjr_state::pic8259_set_int_line) -{ - UINT32 pc = m_maincpu->pc(); - if ( (pc == 0xF0453) || (pc == 0xFF196) ) - { - m_pc_int_delay_timer->adjust( m_maincpu->cycles_to_attotime(20), state ); - } - else - { - m_maincpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); - } -} - -/************************************************************************* - * - * PC Speaker related - * - *************************************************************************/ -void pcjr_state::pc_speaker_set_spkrdata(UINT8 data) -{ - m_pc_spkrdata = data ? 1 : 0; - m_speaker->level_w(m_pc_spkrdata & m_pit_out2); -} - -WRITE_LINE_MEMBER(pcjr_state::out2_changed) -{ - m_pit_out2 = state ? 1 : 0; - m_speaker->level_w(m_pc_spkrdata & m_pit_out2); -} - -/************************************************************* - * - * PCJR NMI and raw keybaord handling - * - * raw signals on the keyboard cable: - * ---_-b0b1b2b3b4b5b6b7pa---------------------- - * | | | | | | | | | | | - * | | | | | | | | | | *--- 11 stop bits ( -- = 1 stop bit ) - * | | | | | | | | | *----- parity bit ( 0 = _-, 1 = -_ ) - * | | | | | | | | *------- bit 7 ( 0 = _-, 1 = -_ ) - * | | | | | | | *--------- bit 6 ( 0 = _-, 1 = -_ ) - * | | | | | | *----------- bit 5 ( 0 = _-, 1 = -_ ) - * | | | | | *------------- bit 4 ( 0 = _-, 1 = -_ ) - * | | | | *--------------- bit 3 ( 0 = _-, 1 = -_ ) - * | | | *----------------- bit 2 ( 0 = _-, 1 = -_ ) - * | | *------------------- bit 1 ( 0 = _-, 1 = -_ ) - * | *--------------------- bit 0 ( 0 = _-, 1 = -_ ) - * *----------------------- start bit (always _- ) - * - * An entire bit lasts for 440 uSec, half bit time is 220 uSec. - * Transferring an entire byte takes 21 x 440uSec. The extra - * time of the stop bits is to allow the CPU to do other things - * besides decoding keyboard signals. - * - * These signals get inverted before going to the PCJR - * handling hardware. The sequence for the start then - * becomes: - * - * __-_b0b1..... - * | - * *---- on the 0->1 transition of the start bit a keyboard - * latch signal is set to 1 and an NMI is generated - * when enabled. - * The keyboard latch is reset by reading from the - * NMI enable port (A0h). - * - *************************************************************/ - -WRITE_LINE_MEMBER(pcjr_state::keyb_interrupt) -{ - int data; - - if(state && (data = m_keyboard->read(machine().driver_data()->generic_space(), 0))) - { - UINT8 parity = 0; - int i; - - m_latch = 1; - - if(m_transferring) - return; - - m_pc_keyb_data = data; - - /* Calculate the raw data */ - for( i = 0; i < 8; i++ ) - { - if ( ( 1 << i ) & data ) - { - parity ^= 1; - } - } - m_raw_keyb_data = 0; - m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | ( parity ? 1 : 2 ); - for( i = 0; i < 8; i++ ) - { - m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | ( ( data & 0x80 ) ? 1 : 2 ); - data <<= 1; - } - /* Insert start bit */ - m_raw_keyb_data = ( m_raw_keyb_data << 2 ) | 1; - m_signal_count = 20 + 22; - - /* we are now transferring a byte of keyboard data */ - m_transferring = 1; - - /* Set timer */ - m_keyb_signal_timer->adjust( attotime::from_usec(220), 0, attotime::from_usec(220) ); - m_maincpu->set_input_line(INPUT_LINE_NMI, m_nmi_enabled && m_latch); - } -} - -READ8_MEMBER(pcjr_state::pcjr_nmi_enable_r) -{ - m_latch = 0; - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return m_nmi_enabled; -} - -WRITE8_MEMBER(pcjr_state::pc_nmi_enable_w) -{ - m_nmi_enabled = data & 0x80; - m_maincpu->set_input_line(INPUT_LINE_NMI, m_nmi_enabled && m_latch); -} - -WRITE8_MEMBER(pcjr_state::pcjr_ppi_portb_w) -{ - /* KB controller port B */ - m_ppi_portb = data; - m_ppi_portc_switch_high = data & 0x08; - m_pit8253->write_gate2(BIT(data, 0)); - pc_speaker_set_spkrdata( data & 0x02 ); - - m_cassette->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); -} - -/* - * Port C connections on a PCJR (notes from schematics): - * PC0 - KYBD LATCH - * PC1 - MODEM CD INSTALLED - * PC2 - DISKETTE CD INSTALLED - * PC3 - ATR CD IN - * PC4 - cassette audio - * PC5 - OUT2 from 8253 - * PC6 - KYBD IN - * PC7 - (keyboard) CABLE CONNECTED - */ -READ8_MEMBER(pcjr_state::pcjr_ppi_portc_r) -{ - int data=0xff; - - data&=~0x80; - data &= ~0x04; /* floppy drive installed */ - if ( m_ram->size() > 64 * 1024 ) /* more than 64KB ram installed */ - data &= ~0x08; - data = ( data & ~0x01 ) | ( m_latch ? 0x01: 0x00 ); - if ( ! ( m_ppi_portb & 0x08 ) ) - { - double tap_val = m_cassette->input(); - - if ( tap_val < 0 ) - { - data &= ~0x10; - } - else - { - data |= 0x10; - } - } - else - { - if ( m_ppi_portb & 0x01 ) - { - data = ( data & ~0x10 ) | ( m_pit_out2 ? 0x10 : 0x00 ); - } - } - data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); - data = ( data & ~0x40 ) | ( ( m_raw_keyb_data & 0x01 ) ? 0x40 : 0x00 ); - - return data; -} - -WRITE8_MEMBER(pcjr_state::pcjr_fdc_dor_w) -{ - logerror("fdc: dor = %02x\n", data); - UINT8 pdor = m_pcjr_dor; - floppy_image_device *floppy0 = m_fdc->subdevice("0")->get_device(); - floppy_image_device *floppy1 = NULL; - - if(m_fdc->subdevice("1")) - floppy1 = m_fdc->subdevice("1")->get_device(); - m_pcjr_dor = data; - - if(floppy0) - floppy0->mon_w(!(m_pcjr_dor & 1)); - if(floppy1) - floppy1->mon_w(!(m_pcjr_dor & 2)); - - if(m_pcjr_dor & 1) - m_fdc->set_floppy(floppy0); - else if(m_pcjr_dor & 2) - m_fdc->set_floppy(floppy1); - else - m_fdc->set_floppy(NULL); - - if((pdor^m_pcjr_dor) & 0x80) - m_fdc->reset(); - - if(m_pcjr_dor & 0x20) { - if((pdor & 0x40) && !(m_pcjr_dor & 0x40)) - m_pcjr_watchdog->adjust(attotime::from_seconds(3)); - } else { - m_pcjr_watchdog->adjust(attotime::never); - m_pic8259->ir6_w(0); - } -} - -// pcjx port 0x1ff, some info from Toshiya Takeda - -void pcjr_state::pcjx_set_bank(int unk1, int unk2, int unk3) -{ - logerror("pcjx: 0x1ff 0:%02x 1:%02x 2:%02x\n", unk1, unk2, unk3); -} - -WRITE8_MEMBER(pcjr_state::pcjx_port_1ff_w) -{ - switch(m_pcjx_1ff_count) { - case 0: - m_pcjx_1ff_bankval = data; - m_pcjx_1ff_count++; - break; - case 1: - m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][0] = data; - m_pcjx_1ff_count++; - break; - case 2: - m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][1] = data; - m_pcjx_1ff_count = 0; - pcjx_set_bank(m_pcjx_1ff_bankval, m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][0], data); - break; - } -} - -READ8_MEMBER(pcjr_state::pcjx_port_1ff_r) -{ - if(m_pcjx_1ff_count == 2) - pcjx_set_bank(m_pcjx_1ff_bankval, m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][0], m_pcjx_1ff_bank[m_pcjx_1ff_bankval & 0x1f][1]); - - m_pcjx_1ff_count = 0; - return 0x60; // expansion? -} - -int pcjr_state::load_cart(device_image_interface &image, generic_slot_device *slot) -{ - UINT32 size = slot->common_get_size("rom"); - bool imagic_hack = false; - - if (image.software_entry() == NULL) - { - int header_size = 0; - - // Check for supported header sizes - switch (size & 0x3ff) - { - case 0x80: - header_size = 0x80; - break; - case 0x200: - header_size = 0x200; - break; - default: - image.seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid header size" ); - return IMAGE_INIT_FAIL; - } - if (size - header_size == 0xa000) - { - // alloc 64K for the imagic carts, so to handle the necessary mirroring - size += 0x6000; - imagic_hack = true; - } - - size -= header_size; - image.fseek(header_size, SEEK_SET); - } - - slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - slot->common_load_rom(slot->get_rom_base(), size, "rom"); - - if (imagic_hack) - { - // in this case the image consists of 2x8K chunks - // the first chunk is unique, the second is repeated 4 times up to 0xa000 size - - // mirroring - UINT8 *ROM = slot->get_rom_base(); - memcpy(ROM + 0xe000, ROM + 0x2000, 0x2000); - memcpy(ROM + 0xc000, ROM + 0x2000, 0x2000); - memcpy(ROM + 0xa000, ROM + 0x2000, 0x2000); - memcpy(ROM + 0x8000, ROM + 0x2000, 0x2000); - memcpy(ROM + 0x6000, ROM, 0x2000); - memcpy(ROM + 0x4000, ROM, 0x2000); - memcpy(ROM + 0x2000, ROM, 0x2000); - } - return IMAGE_INIT_PASS; -} - - -static SLOT_INTERFACE_START( pcjr_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(pcjr_com) - SLOT_INTERFACE("microsoft_mouse", MSFT_SERIAL_MOUSE) - SLOT_INTERFACE("mousesys_mouse", MSYSTEM_SERIAL_MOUSE) -SLOT_INTERFACE_END - -static const gfx_layout pc_8_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 512, /* 512 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout kanji_layout = -{ - 16, 16, /* 8 x 8 characters */ - RGN_FRAC(1,1), /* 512 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { STEP16(0,1) }, - /* y offsets */ - { STEP16(0,16) }, - 16*16 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( pcjr ) - GFXDECODE_ENTRY( "gfx1", 0x0000, pc_8_charlayout, 3, 1 ) -GFXDECODE_END - - -static ADDRESS_MAP_START(ibmpcjr_map, AS_PROGRAM, 8, pcjr_state) - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xaffff) AM_RAM - AM_RANGE(0xb0000, 0xb7fff) AM_NOP - AM_RANGE(0xb8000, 0xbffff) AM_RAMBANK("bank14") - AM_RANGE(0xc0000, 0xc7fff) AM_NOP - AM_RANGE(0xc8000, 0xc9fff) AM_ROM - AM_RANGE(0xca000, 0xcffff) AM_NOP - AM_RANGE(0xd0000, 0xdffff) AM_DEVREAD("cartslot2", generic_slot_device, read_rom) - AM_RANGE(0xe0000, 0xeffff) AM_DEVREAD("cartslot1", generic_slot_device, read_rom) - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(ibmpcjr_io, AS_IO, 8, pcjr_state) - AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) - AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) - AM_RANGE(0x00a0, 0x00a0) AM_READWRITE(pcjr_nmi_enable_r, pc_nmi_enable_w ) - AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", sn76496_device, write) - AM_RANGE(0x00f2, 0x00f2) AM_WRITE(pcjr_fdc_dor_w) - AM_RANGE(0x00f4, 0x00f5) AM_DEVICE("fdc", upd765a_device, map) - AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("pc_joy", pc_joy_device, joy_port_r, joy_port_w) - AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w) - AM_RANGE(0x0378, 0x037b) AM_DEVREADWRITE("lpt_0", pc_lpt_device, read, write) - AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE("pcvideo_pcjr", pcvideo_pcjr_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ibmpcjx_map, AS_PROGRAM, 8, pcjr_state ) - AM_RANGE(0x80000, 0xb7fff) AM_ROM AM_REGION("kanji",0) - AM_IMPORT_FROM( ibmpcjr_map ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ibmpcjx_io, AS_IO, 8, pcjr_state) - AM_RANGE(0x01ff, 0x01ff) AM_READWRITE(pcjx_port_1ff_r, pcjx_port_1ff_w) - AM_IMPORT_FROM( ibmpcjr_io ) -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( ibmpcjr, pcjr_state) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8088, 4900000) - MCFG_CPU_PROGRAM_MAP(ibmpcjr_map) - MCFG_CPU_IO_MAP(ibmpcjr_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - -/* - On the PC Jr the input for clock 1 seems to be selectable - based on bit 4(/5?) written to output port A0h. This is not - supported yet. - */ - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_14_31818MHz/12) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_14_31818MHz/12) - MCFG_PIT8253_CLK2(XTAL_14_31818MHz/12) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(pcjr_state, out2_changed)) - - MCFG_PIC8259_ADD( "pic8259", WRITELINE(pcjr_state, pic8259_set_int_line), VCC, NULL ) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(CONSTANT(0xff)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pcjr_state, pcjr_ppi_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pcjr_state, pcjr_ppi_portc_r)) - - MCFG_DEVICE_ADD( "ins8250", INS8250, XTAL_1_8432MHz ) - MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport", rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport", rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport", rs232_port_device, write_rts)) - MCFG_INS8250_OUT_INT_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - - MCFG_RS232_PORT_ADD( "serport", pcjr_com, NULL ) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, dsr_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, ri_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ins8250", ins8250_uart_device, cts_w)) - - /* video hardware */ - MCFG_PCVIDEO_PCJR_ADD("pcvideo_pcjr") - - MCFG_GFXDECODE_ADD("gfxdecode", "pcvideo_pcjr:palette", pcjr) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - MCFG_SOUND_ADD("sn76496", SN76496, XTAL_14_31818MHz/4) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - /* printer */ - MCFG_DEVICE_ADD("lpt_0", PC_LPT, 0) - MCFG_PC_LPT_IRQ_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) - - MCFG_PC_JOY_ADD("pc_joy") - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_UPD765A_ADD("fdc", false, false) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcjr_floppies, "525dd", isa8_fdc_device::floppy_formats) - MCFG_SLOT_FIXED(true) - - MCFG_PC_KEYB_ADD("pc_keyboard", WRITELINE(pcjr_state, keyb_interrupt)) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_plain_slot, "ibmpcjr_cart") - MCFG_GENERIC_EXTENSIONS("bin,jrc") - MCFG_GENERIC_LOAD(pcjr_state, pcjr_cart1) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_plain_slot, "ibmpcjr_cart") - MCFG_GENERIC_EXTENSIONS("bin,jrc") - MCFG_GENERIC_LOAD(pcjr_state, pcjr_cart2) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","ibmpcjr_cart") - MCFG_SOFTWARE_LIST_ADD("flop_list","ibmpcjr_flop") -MACHINE_CONFIG_END - -static GFXDECODE_START( ibmpcjx ) - GFXDECODE_ENTRY( "gfx1", 0x0000, pc_8_charlayout, 3, 1 ) - GFXDECODE_ENTRY( "kanji", 0x0000, kanji_layout, 3, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_DERIVED( ibmpcjx, ibmpcjr ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(ibmpcjx_map) - MCFG_CPU_IO_MAP(ibmpcjx_io) - - MCFG_DEVICE_REMOVE("fdc:0"); - MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcjr_floppies, "35dd", isa8_fdc_device::floppy_formats) - MCFG_SLOT_FIXED(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", pcjr_floppies, "35dd", isa8_fdc_device::floppy_formats) - MCFG_SLOT_FIXED(true) - - MCFG_GFXDECODE_MODIFY("gfxdecode", ibmpcjx) -MACHINE_CONFIG_END - - - -ROM_START( ibmpcjr ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD("bios.rom", 0xf0000, 0x10000,CRC(31e3a7aa) SHA1(1f5f7013f18c08ff50d7942e76c4fbd782412414)) - - ROM_REGION(0x08100,"gfx1", 0) - ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) // from an unknown clone cga card -ROM_END - -ROM_START( ibmpcjx ) - ROM_REGION(0x100000,"maincpu", ROMREGION_ERASEFF) - ROM_DEFAULT_BIOS("unk") - ROM_SYSTEM_BIOS( 0, "5601jda", "5601jda" ) - ROMX_LOAD("5601jda.bin", 0xf0000, 0x10000, CRC(b1e12366) SHA1(751feb16b985aa4f1ec1437493ff77e2ebd5e6a6), ROM_BIOS(1)) - ROMX_LOAD("basicjx.rom", 0xe8000, 0x08000, NO_DUMP, ROM_BIOS(1)) // boot fails due of this. - ROM_SYSTEM_BIOS( 1, "unk", "unk" ) - ROMX_LOAD("ipljx.rom", 0xe0000, 0x20000, CRC(36a7b2de) SHA1(777db50c617725e149bca9b18cf51ce78f6dc548), ROM_BIOS(2)) - - ROM_REGION(0x08100,"gfx1", 0) //TODO: needs a different charset - ROM_LOAD("cga.chr", 0x00000, 0x01000, BAD_DUMP CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) // from an unknown clone cga card - - ROM_REGION(0x38000,"kanji", 0) - ROM_LOAD("kanji.rom", 0x00000, 0x38000, BAD_DUMP CRC(eaa6e3c3) SHA1(35554587d02d947fae8446964b1886fff5c9d67f)) // hand-made rom -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -// pcjr -COMP( 1983, ibmpcjr, ibm5150, 0, ibmpcjr, ibmpcjr, pcjr_state, pcjr, "International Business Machines", "IBM PC Jr", MACHINE_IMPERFECT_COLORS ) -COMP( 1985, ibmpcjx, ibm5150, 0, ibmpcjx, ibmpcjr, pcjr_state, pcjr, "International Business Machines", "IBM PC JX", MACHINE_IMPERFECT_COLORS | MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/icatel.c b/src/mess/drivers/icatel.c deleted file mode 100644 index 372dafb439a..00000000000 --- a/src/mess/drivers/icatel.c +++ /dev/null @@ -1,269 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders: Felipe Sanches -/*************************************************************************** - - icatel - Brazilian public payphone - manufactured by icatel http://www.icatel.com.br/ - - Partial schematics (drawn based on PCB inspection) available at: - https://github.com/garoa/Icatel/blob/master/doc/icatel.pdf - - Driver by Felipe Sanches - - Changelog: - - 2014 DEC 14 [Felipe Sanches]: - * Initial driver skeleton - -***************************************************************************/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "video/hd44780.h" -//#include "sound/speaker.h" -#include "rendlay.h" -#include "debugger.h" - -class icatel_state : public driver_device -{ -public: - icatel_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_lcdc(*this, "hd44780") - { } - - DECLARE_READ8_MEMBER(magic_string); - - DECLARE_READ8_MEMBER(ioport_r); - DECLARE_WRITE8_MEMBER(ioport_w); - - DECLARE_READ8_MEMBER(cn8_extension_r); - DECLARE_WRITE8_MEMBER(cn8_extension_w); - - DECLARE_READ8_MEMBER(modem_r); - DECLARE_WRITE8_MEMBER(modem_w); - - DECLARE_READ8_MEMBER(ci8_r); - DECLARE_WRITE8_MEMBER(ci8_w); - - DECLARE_READ8_MEMBER(ci15_r); - DECLARE_WRITE8_MEMBER(ci15_w); - - DECLARE_READ8_MEMBER(ci16_r); - DECLARE_WRITE8_MEMBER(ci16_w); - - DECLARE_DRIVER_INIT(icatel); - DECLARE_PALETTE_INIT(icatel); - -private: - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_lcdc; -}; - -static ADDRESS_MAP_START(i80c31_prg, AS_PROGRAM, 8, icatel_state) - AM_RANGE(0x0000, 0x7FFF) AM_MIRROR(0x8000) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, icatel_state) - AM_RANGE(0x0000,0x3FFF) AM_RAM - AM_RANGE(0x8000,0x8002) AM_RAM /* HACK! */ - AM_RANGE(0x8040,0x8040) AM_MIRROR(0x3F1E) AM_DEVWRITE("hd44780", hd44780_device, control_write) // not sure yet. CI12 (73LS273) - AM_RANGE(0x8041,0x8041) AM_MIRROR(0x3F1E) AM_DEVWRITE("hd44780", hd44780_device, data_write) // not sure yet. CI12 - AM_RANGE(0x8060,0x8060) AM_MIRROR(0x3F1F) AM_READWRITE(ci8_r, ci8_w) - AM_RANGE(0x8080,0x8080) AM_MIRROR(0x3F1F) AM_READWRITE(ci16_r, ci16_w) // card reader (?) - AM_RANGE(0x80C0,0x80C0) AM_MIRROR(0x3F1F) AM_READWRITE(ci15_r, ci15_w) // 74LS244 (tristate buffer) - AM_RANGE(0xC000,0xCFFF) AM_READWRITE(cn8_extension_r, cn8_extension_w) - AM_RANGE(0xE000,0xEFFF) AM_READWRITE(modem_r, modem_w) - AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(ioport_r, ioport_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(i80c31_data, AS_DATA, 8, icatel_state) -// AM_RANGE(0x0056,0x005A) AM_READ(magic_string) /* This is a hack! */ -ADDRESS_MAP_END - -DRIVER_INIT_MEMBER( icatel_state, icatel ) -{ -} - -void icatel_state::machine_start() -{ -} - -void icatel_state::machine_reset() -{ -} - -READ8_MEMBER(icatel_state::magic_string) -{ -// logerror("read: magic_string, offset=%04X\n", offset); - char mstr[] = "TP-OK"; - return mstr[offset%5]; -} - -READ8_MEMBER(icatel_state::ioport_r) -{ - switch (offset%4) - { - case 0: return 0xff; - case 1: return 0x7f; - case 2: return 0xff; - case 3: return 0xff; - } - return 0; -} - -WRITE8_MEMBER(icatel_state::ioport_w) -{ -} - -//---------------------------------------- - -READ8_MEMBER(icatel_state::cn8_extension_r) -{ - /* TODO: Implement-me! */ - logerror("read: cn8_extension\n"); - return 0; -} - -WRITE8_MEMBER(icatel_state::cn8_extension_w) -{ - /* TODO: Implement-me! */ - logerror("write: cn8_extension [%02x]\n", data); -} - -//---------------------------------------- - -READ8_MEMBER(icatel_state::modem_r) -{ - /* TODO: Implement-me! */ - logerror("read: modem\n"); - return 0; -} - -WRITE8_MEMBER(icatel_state::modem_w) -{ - /* TODO: Implement-me! */ - logerror("write: modem [%02x]\n", data); -} - -//---------------------------------------- - -READ8_MEMBER(icatel_state::ci8_r) -{ - /* TODO: Implement-me! */ - logerror("read: ci8\n"); - return 0; -} - -WRITE8_MEMBER(icatel_state::ci8_w) -{ - /* TODO: Implement-me! */ - logerror("write: ci8 [%02x]\n", data); -} - -//---------------------------------------- - -READ8_MEMBER(icatel_state::ci15_r) -{ - /* TODO: Implement-me! */ -// debugger_break(machine()); -// logerror("read: ci15\n"); - return (1 << 3) | (1 << 0); -} - -WRITE8_MEMBER(icatel_state::ci15_w) -{ - /* TODO: Implement-me! */ - logerror("write: ci15 [%02x]\n", data); -} - -//---------------------------------------- - -READ8_MEMBER(icatel_state::ci16_r) -{ - /* TODO: Implement-me! */ - // seems to be the card reader. - logerror("read: ci16\n"); - return 0; -} - -WRITE8_MEMBER(icatel_state::ci16_w) -{ - /* TODO: Implement-me! */ - // seems to be the card reader. - logerror("write: ci16 [%02x]\n", data); -} - -//---------------------------------------- - -PALETTE_INIT_MEMBER(icatel_state, icatel) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static const gfx_layout prot_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( icatel ) - GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, prot_charlayout, 0, 1 ) -GFXDECODE_END - -static HD44780_PIXEL_UPDATE(icatel_pixel_update) -{ - if ( pos < 16 && line==0 ) - { - bitmap.pix16(y, pos*6 + x) = state; - } - - if ( pos >= 64 && pos < 80 && line==0 ) - { - bitmap.pix16(y+9,(pos-64)*6 + x) = state; - } -} - -static MACHINE_CONFIG_START( icatel, icatel_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80C31, XTAL_2_097152MHz) - MCFG_CPU_PROGRAM_MAP(i80c31_prg) - MCFG_CPU_DATA_MAP(i80c31_data) - MCFG_CPU_IO_MAP(i80c31_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_SIZE(6*16, 9*2) - MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(icatel_state, icatel) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", icatel) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 16) - MCFG_HD44780_PIXEL_UPDATE_CB(icatel_pixel_update) -MACHINE_CONFIG_END - -ROM_START( icatel ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "icatel_tpci_em._4_v16.05.ci14", 0x00000, 0x8000, CRC(d310586e) SHA1(21736ad5a06cf9695f8cc5ff2dc2d19b101504f5) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1995, icatel, 0, 0, icatel, 0, icatel_state, icatel, "Icatel", "TPCI (Brazilian public payphone)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) -/*The hardware was clearly manufactured in 1995. There's no evindence of the actual date of the firmware.*/ diff --git a/src/mess/drivers/ie15.c b/src/mess/drivers/ie15.c deleted file mode 100644 index 405b33a2b5b..00000000000 --- a/src/mess/drivers/ie15.c +++ /dev/null @@ -1,663 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - 15IE-00-013 Terminal - - A serial (RS232 or current loop) green-screen terminal, mostly VT52 - compatible (no Hold Screen mode and no graphics character set). - - Alternate character set (selected by SO/SI chars) is Cyrillic. - -****************************************************************************/ - - -#include "emu.h" - -#include "bus/rs232/rs232.h" -#include "cpu/ie15/ie15.h" -#include "machine/ie15_kbd.h" -#include "sound/beep.h" -#include "ie15.lh" - -#define SCREEN_PAGE (80*48) - -#define IE_TRUE 0x80 -#define IE_FALSE 0 - -#define IE15_TOTAL_HORZ 1000 -#define IE15_DISP_HORZ 800 -#define IE15_HORZ_START 200 - -#define IE15_TOTAL_VERT 28*11 -#define IE15_DISP_VERT 25*11 -#define IE15_VERT_START 2*11 -#define IE15_STATUSLINE 11 - - -#define VERBOSE_DBG 1 /* general debug messages */ - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - - -class ie15_state : public driver_device, - public device_serial_interface -{ -public: - ie15_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - device_serial_interface(mconfig, *this), - m_maincpu(*this, "maincpu"), - m_beeper(*this, "beeper"), - m_rs232(*this, "rs232"), - m_screen(*this, "screen"), - m_io_keyboard(*this, "keyboard") - { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER( scanline_callback ); - DECLARE_WRITE16_MEMBER( kbd_put ); - DECLARE_PALETTE_INIT( ie15 ); - - DECLARE_WRITE_LINE_MEMBER( serial_rx_callback ); - virtual void rcv_complete(); - virtual void tra_callback(); - virtual void tra_complete(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - DECLARE_WRITE8_MEMBER( mem_w ); - DECLARE_READ8_MEMBER( mem_r ); - DECLARE_WRITE8_MEMBER( mem_addr_lo_w ); - DECLARE_WRITE8_MEMBER( mem_addr_hi_w ); - DECLARE_WRITE8_MEMBER( mem_addr_inc_w ); - DECLARE_WRITE8_MEMBER( mem_addr_dec_w ); - DECLARE_READ8_MEMBER( flag_r ); - DECLARE_WRITE8_MEMBER( flag_w ); - DECLARE_WRITE8_MEMBER( beep_w ); - DECLARE_READ8_MEMBER( kb_r ); - DECLARE_READ8_MEMBER( kb_ready_r ); - DECLARE_READ8_MEMBER( kb_s_red_r ); - DECLARE_READ8_MEMBER( kb_s_sdv_r ); - DECLARE_READ8_MEMBER( kb_s_dk_r ); - DECLARE_READ8_MEMBER( kb_s_dupl_r ); - DECLARE_READ8_MEMBER( kb_s_lin_r ); - DECLARE_WRITE8_MEMBER( kb_ready_w ); - DECLARE_READ8_MEMBER( serial_tx_ready_r ); - DECLARE_WRITE8_MEMBER( serial_w ); - DECLARE_READ8_MEMBER( serial_rx_ready_r ); - DECLARE_READ8_MEMBER( serial_r ); - DECLARE_WRITE8_MEMBER( serial_speed_w ); - -private: - TIMER_CALLBACK_MEMBER(ie15_beepoff); - void update_leds(); - UINT32 draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline); - rectangle m_tmpclip; - bitmap_ind16 m_tmpbmp; - bitmap_ind16 m_offbmp; - - const UINT8 *m_p_chargen; - UINT8 *m_p_videoram; - UINT8 m_long_beep; - UINT8 m_kb_control; - UINT8 m_kb_data; - UINT8 m_kb_flag0; - UINT8 m_kb_flag; - UINT8 m_kb_ruslat; - UINT8 m_latch; - struct { - UINT8 cursor; - UINT8 enable; - UINT8 line25; - UINT32 ptr1; - UINT32 ptr2; - } m_video; - - UINT8 m_serial_rx_ready; - UINT8 m_serial_tx_ready; - -protected: - required_device m_maincpu; - required_device m_beeper; - required_device m_rs232; - required_device m_screen; - required_ioport m_io_keyboard; -}; - -READ8_MEMBER( ie15_state::mem_r ) { - UINT8 ret; - - ret = m_p_videoram[m_video.ptr1]; - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && m_video.ptr1 >= SCREEN_PAGE) - { - DBG_LOG(2,"memory",("R @ %03x == %02x\n", m_video.ptr1, ret)); - } - m_video.ptr1++; - m_video.ptr1 &= 0xfff; - m_latch = 0; - return ret; -} - -WRITE8_MEMBER( ie15_state::mem_w ) { - if ((m_latch ^= 1) == 0) { - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && m_video.ptr1 >= SCREEN_PAGE) - { - DBG_LOG(2,"memory",("W @ %03x <- %02x\n", m_video.ptr1, data)); - } - m_p_videoram[m_video.ptr1++] = data; - m_video.ptr1 &= 0xfff; - } -} - -WRITE8_MEMBER( ie15_state::mem_addr_inc_w ) { - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) - { - DBG_LOG(2,"memory",("++ %03x\n", m_video.ptr1)); - } - m_video.ptr1++; - m_video.ptr1 &= 0xfff; - if (m_video.enable) - m_video.ptr2 = m_video.ptr1; -} - -WRITE8_MEMBER( ie15_state::mem_addr_dec_w ) { - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) - { - DBG_LOG(2,"memory",("-- %03x\n", m_video.ptr1)); - } - m_video.ptr1--; - m_video.ptr1 &= 0xfff; - if (m_video.enable) - m_video.ptr2 = m_video.ptr1; -} - -WRITE8_MEMBER( ie15_state::mem_addr_lo_w ) { - UINT16 tmp = m_video.ptr1; - - tmp &= 0xff0; - tmp |= ((data >> 4) & 0xf); - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) - { - DBG_LOG(2,"memory",("lo %03x <- %02x = %03x\n", m_video.ptr1, data, tmp)); - } - m_video.ptr1 = tmp; - if (m_video.enable) - m_video.ptr2 = tmp; -} - -WRITE8_MEMBER( ie15_state::mem_addr_hi_w ) { - UINT16 tmp = m_video.ptr1; - - tmp &= 0xf; - tmp |= (data << 4); - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) - { - DBG_LOG(2,"memory",("hi %03x <- %02x = %03x\n", m_video.ptr1, data, tmp)); - } - m_video.ptr1 = tmp; - if (m_video.enable) - m_video.ptr2 = tmp; -} - -TIMER_CALLBACK_MEMBER(ie15_state::ie15_beepoff) -{ - machine().device("beeper")->set_state(0); -} - -WRITE8_MEMBER( ie15_state::beep_w ) { - UINT16 length = (m_long_beep & IE_TRUE) ? 150 : 400; - - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) - { - DBG_LOG(1,"beep",("(%s)\n", m_long_beep ? "short" : "long")); - } - machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(ie15_state::ie15_beepoff),this)); - machine().device("beeper")->set_state(1); -} - -/* keyboard */ - -// active high -READ8_MEMBER( ie15_state::kb_r ) { - DBG_LOG(2,"keyboard",("R %02X '%c'\n", m_kb_data, m_kb_data < 0x20 ? ' ' : m_kb_data)); - return m_kb_data; -} - -// active low -READ8_MEMBER( ie15_state::kb_ready_r ) { - m_kb_flag &= IE_TRUE; - if (m_kb_flag != m_kb_flag0) { - DBG_LOG(2,"keyboard",("? %c\n", m_kb_flag ? 'n' : 'y')); - m_kb_flag0 = m_kb_flag; - } - return m_kb_flag; -} - -// active low -WRITE8_MEMBER( ie15_state::kb_ready_w ) { - DBG_LOG(2,"keyboard",("clear ready\n")); - m_kb_flag = IE_TRUE | IE_KB_ACK; -} - - -// active high; active = interpret controls, inactive = display controls -READ8_MEMBER( ie15_state::kb_s_red_r ) { - return m_io_keyboard->read() & IE_KB_RED ? IE_TRUE : 0; -} - -// active high; active = setup mode -READ8_MEMBER( ie15_state::kb_s_sdv_r ) { - return m_kb_control & IE_KB_SDV ? IE_TRUE : 0; -} - -// active high; active = keypress detected on aux keypad -READ8_MEMBER( ie15_state::kb_s_dk_r ) { - return m_kb_control & IE_KB_DK ? IE_TRUE : 0; -} - -// active low; active = full duplex, inactive = half duplex -READ8_MEMBER( ie15_state::kb_s_dupl_r ) { - return m_io_keyboard->read() & IE_KB_DUP ? IE_TRUE : 0; -} - -// active high; active = on-line, inactive = local editing -READ8_MEMBER( ie15_state::kb_s_lin_r ) { - return m_io_keyboard->read() & IE_KB_LIN ? IE_TRUE : 0; -} - -/* serial port */ - -void ie15_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - device_serial_interface::device_timer(timer, id, param, ptr); -} - -WRITE_LINE_MEMBER( ie15_state::serial_rx_callback ) -{ - device_serial_interface::rx_w(state); -} - -void ie15_state::rcv_complete() -{ - receive_register_extract(); - m_serial_rx_ready = IE_FALSE; -} - -void ie15_state::tra_callback() -{ - UINT8 bit = transmit_register_get_data_bit(); - m_rs232->write_txd(bit); -} - -void ie15_state::tra_complete() -{ - m_serial_tx_ready = IE_TRUE; -} - -// active low -READ8_MEMBER( ie15_state::serial_rx_ready_r ) { - return m_serial_rx_ready; -} - -// active high -READ8_MEMBER( ie15_state::serial_tx_ready_r ) { - return m_serial_tx_ready; -} - -// not called unless data are ready -READ8_MEMBER( ie15_state::serial_r ) { - UINT8 data; - - data = get_received_char(); - m_serial_rx_ready = IE_TRUE; - DBG_LOG(1,"serial",("R %02X '%c'\n", data, data < 0x20?' ':data)); - return data; -} - -WRITE8_MEMBER( ie15_state::serial_w ) { - DBG_LOG(1,"serial",("W %02X '%c'\n", data, data < 0x20?' ':data)); - - m_serial_tx_ready = IE_FALSE; - transmit_register_setup(data); -} - -WRITE8_MEMBER( ie15_state::serial_speed_w ) { - return; -} - -READ8_MEMBER( ie15_state::flag_r ) { - UINT8 ret = 0; - - switch (offset) - { - case 0: // hsync pulse (not hblank) - ret = m_screen->hpos() < IE15_HORZ_START; - break; - case 1: // marker scanline - ret = (m_screen->vpos() % 11) > 7; - break; - case 2: // vblank - ret = !m_screen->vblank(); - break; - case 4: - ret = m_kb_ruslat; - break; - default: - break; - } - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && ret) - { - DBG_LOG(2,"flag",("read %d: %d\n", offset, ret)); - } - return ret; -} - -WRITE8_MEMBER( ie15_state::flag_w ) { - switch (offset) - { - case 0: - m_video.enable = data; - break; - case 1: - m_video.cursor = data; - break; - case 2: - m_long_beep = data; - break; - case 3: - m_video.line25 = data; - break; - case 4: - m_kb_ruslat = data; - break; - default: - break; - } - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && !offset) - { - DBG_LOG(2,"flag",("%sset %d\n", data?"":"re", offset)); - } -} - -static ADDRESS_MAP_START( ie15_mem, AS_PROGRAM, 8, ie15_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ie15_io, AS_IO, 8, ie15_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(000, 000) AM_READWRITE(mem_r, mem_w) // 00h W: memory request, R: memory data [6.1.2.2] - AM_RANGE(001, 001) AM_READ(serial_rx_ready_r) AM_WRITENOP // 01h W: memory latch [6.1.2.2] - AM_RANGE(002, 002) AM_WRITE(mem_addr_hi_w) // 02h W: memory address high [6.1.2.2] - AM_RANGE(003, 003) AM_WRITE(mem_addr_lo_w) // 03h W: memory address low [6.1.2.2] - AM_RANGE(004, 004) AM_WRITE(mem_addr_inc_w) // 04h W: memory address counter + [6.1.2.2] - AM_RANGE(005, 005) AM_WRITE(mem_addr_dec_w) // 05h W: memory address counter - [6.1.2.2] - AM_RANGE(006, 006) AM_READWRITE(serial_r, serial_w) // 06h W: serial port data [6.1.5.4] -// port 7 is handled in cpu core - AM_RANGE(010, 010) AM_READWRITE(serial_tx_ready_r, beep_w) // 08h W: speaker control [6.1.5.4] - AM_RANGE(011, 011) AM_READ(kb_r) // 09h R: keyboard data [6.1.5.2] - AM_RANGE(012, 012) AM_READ(kb_s_red_r) // 0Ah I: keyboard mode "RED" [6.1.5.2] - AM_RANGE(013, 013) AM_READ(kb_ready_r) // 0Bh R: keyboard data ready [6.1.5.2] - AM_RANGE(014, 014) AM_READWRITE(kb_s_sdv_r, serial_speed_w) // 0Ch W: serial port speed [6.1.3.1], R: keyboard mode "SDV" [6.1.5.2] - AM_RANGE(015, 015) AM_READWRITE(kb_s_dk_r, kb_ready_w) // 0Dh I: keyboard mode "DK" [6.1.5.2] - AM_RANGE(016, 016) AM_READ(kb_s_dupl_r) // 0Eh I: keyboard mode "DUPL" [6.1.5.2] - AM_RANGE(017, 017) AM_READ(kb_s_lin_r) // 0Fh I: keyboard mode "LIN" [6.1.5.2] -// simulation of flag registers - AM_RANGE(020, 027) AM_READWRITE(flag_r, flag_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ie15 ) - PORT_START("keyboard") - PORT_DIPNAME(IE_KB_RED, IE_KB_RED, "RED (Interpret controls)") - PORT_DIPSETTING(0x00, "Off") - PORT_DIPSETTING(IE_KB_RED, "On") - PORT_DIPNAME(IE_KB_DUP, IE_KB_DUP, "DUP (Full duplex)") - PORT_DIPSETTING(0x00, "Off") - PORT_DIPSETTING(IE_KB_DUP, "On") - PORT_DIPNAME(IE_KB_LIN, IE_KB_LIN, "LIN (Online)") - PORT_DIPSETTING(0x00, "Off") - PORT_DIPSETTING(IE_KB_LIN, "On") -INPUT_PORTS_END - -WRITE16_MEMBER( ie15_state::kbd_put ) -{ - DBG_LOG(2,"keyboard",("W %02X<-%02X '%c' %02X (%c)\n", m_kb_data, data, 'x' /* data < 0x20 ? ' ' : (data & 255) */, - m_kb_flag, m_kb_flag ? 'n' : 'y')); - m_kb_control = (data >> 8) & 255; - // send new key only when firmware has processed previous one - if (m_kb_flag == IE_TRUE) { - m_kb_data = data & 255; - m_kb_flag = 0; - } -} - -void ie15_state::machine_reset() -{ - memset(&m_video, 0, sizeof(m_video)); - m_kb_ruslat = m_long_beep = m_kb_control = m_kb_data = m_kb_flag0 = 0; - m_kb_flag = IE_TRUE; - - machine().device("beeper")->set_frequency(2400); - machine().device("beeper")->set_state(0); - - m_serial_tx_ready = m_serial_rx_ready = IE_TRUE; - set_data_frame(1 /* start bits */, 8 /* data bits */, PARITY_NONE, STOP_BITS_1); - // device supports rates from 150 to 9600 baud but null_modem has hardcoded 9600 - set_rate(9600); -} - -void ie15_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("video")->base(); - m_video.ptr1 = m_video.ptr2 = m_latch = 0; - - m_tmpclip = rectangle(0, IE15_DISP_HORZ-1, 0, IE15_DISP_VERT-1); - m_tmpbmp.allocate(IE15_DISP_HORZ, IE15_DISP_VERT); - m_offbmp.allocate(IE15_DISP_HORZ, 1); - if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { - m_offbmp.fill(0); - } -} - -/* - Usable raster is 800 x 275 pixels (80 x 25 characters). 24 lines are - available to the user and 25th (topmost) line is the status line. - Status line, if enabled, displays current serial port speed, 16 setup - bits, and clock. There is no NVRAM, so setup bits are always 0 after - reset and clock starts counting at 0 XXX. - - No character attributes are available, but in 'display controls' mode - control characters stored in memory are shown as blinking chars. - - Character cell is 10 x 11; character generator provides 7 x 8 of that. - 3 extra horizontal pixels are always blank. Blinking cursor may be - displayed on 3 extra scan lines. - - On each scan line, video board draws 80 characters from any location - in video memory; this is used by firmware to provide instant scroll - and cursor, which is a character with code 0x7F stored in XXX. - - Video board output is controlled by - - control flag 0 "disable video": 0 == disable - - control flag 1 "cursor": 0 == if this scan line is one of extra 3, - enable video every 5 frames. - - control flag 3 "status line": 0 == current scan line is part of status line - - keyboard mode 'RED' ('display controls'): if character code is - less than 0x20 and RED is set, enable video every 5 frames; if RED is - unset, disable video. - - XXX 'dotted look' is caused by strobe at 2x pixel clock -- use HLSL for this. -*/ - -UINT32 ie15_state::draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline) -{ - UINT8 gfx, fg, bg, ra, blink, red; - UINT16 x, chr; - - bg = 0; fg = 1; ra = scanline % 8; - blink = (m_screen->frame_number() % 10) > 4; - red = m_io_keyboard->read() & IE_KB_RED; - - for (x = offset; x < offset + 80; x++) - { - chr = m_p_videoram[x] << 3; - gfx = m_p_chargen[chr | ra]; - - if (scanline > 7 && (!m_video.cursor || blink)) - gfx = 0; - else if (chr < (0x20<<3)) { - if (red && blink && m_video.line25) - gfx = m_p_chargen[chr | 0x200 | ra]; - else - gfx = 0; - } - - *p++ = BIT(gfx, 7) ? fg : bg; - *p++ = BIT(gfx, 6) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = bg; - *p++ = bg; - *p++ = bg; - } - return 0; -} - -void ie15_state::update_leds() -{ - UINT8 data = m_io_keyboard->read(); - output_set_value("lat_led", m_kb_ruslat ^ 1); - output_set_value("nr_led", BIT(m_kb_control, IE_KB_NR_BIT) ^ 1); - output_set_value("pch_led", BIT(data, IE_KB_PCH_BIT) ^ 1); - output_set_value("dup_led", BIT(data, IE_KB_DUP_BIT) ^ 1); - output_set_value("lin_led", BIT(data, IE_KB_LIN_BIT) ^ 1); - output_set_value("red_led", BIT(data, IE_KB_RED_BIT) ^ 1); - output_set_value("sdv_led", BIT(m_kb_control, IE_KB_SDV_BIT) ^ 1); - output_set_value("prd_led", 1); // XXX -} - -/* - VBlank is active for 3 topmost on-screen rows and 1 at the bottom; however, control flag 3 overrides VBlank, - allowing status line to be switched on and off. -*/ -TIMER_DEVICE_CALLBACK_MEMBER(ie15_state::scanline_callback) -{ - UINT16 y = m_screen->vpos(); - - DBG_LOG(3,"scanline_cb", - ("addr %03x frame %d x %.4d y %.3d row %.2d e:c:s %d:%d:%d\n", - m_video.ptr2, (int)m_screen->frame_number(), m_screen->hpos(), y, - y%11, m_video.enable, m_video.cursor, m_video.line25)); - - if (y < IE15_VERT_START) return; - y -= IE15_VERT_START; - if (y >= IE15_DISP_VERT) return; - - if (!m_video.enable || (y < IE15_STATUSLINE && m_video.line25)) { - copybitmap(m_tmpbmp, m_offbmp, 0, 0, 0, y, m_tmpclip); - } else { - draw_scanline(&m_tmpbmp.pix16(y), m_video.ptr2, y%11); - } -} - -UINT32 ie15_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - update_leds(); - copybitmap(bitmap, m_tmpbmp, 0, 0, IE15_HORZ_START, IE15_VERT_START, cliprect); - return 0; -} - - -/* F4 Character Displayer */ -static const gfx_layout ie15_charlayout = -{ - 7, 8, /* 7x8 pixels in 10x11 cell */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( ie15 ) - GFXDECODE_ENTRY("chargen", 0x0000, ie15_charlayout, 0, 1) -GFXDECODE_END - -PALETTE_INIT_MEMBER( ie15_state, ie15 ) -{ - palette.set_pen_color(0, rgb_t::black); // black - palette.set_pen_color(1, 0x00, 0xc0, 0x00); // green -} - -static MACHINE_CONFIG_START( ie15, ie15_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD("maincpu", IE15, XTAL_30_8MHz/10) - MCFG_CPU_PROGRAM_MAP(ie15_mem) - MCFG_CPU_IO_MAP(ie15_io) - MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", ie15_state, scanline_callback, attotime::from_hz(50*28*11)) - MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_30_8MHz/(2*IE15_HORZ_START))) - - /* Video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(ie15_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_30_8MHz/2, IE15_TOTAL_HORZ, IE15_HORZ_START, - IE15_HORZ_START+IE15_DISP_HORZ, IE15_TOTAL_VERT, IE15_VERT_START, - IE15_VERT_START+IE15_DISP_VERT); - - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ie15) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_DEFAULT_LAYOUT(layout_ie15) - - /* Devices */ - MCFG_DEVICE_ADD("keyboard", IE15_KEYBOARD, 0) - MCFG_IE15_KEYBOARD_CB(WRITE16(ie15_state, kbd_put)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") - MCFG_RS232_RXD_HANDLER(WRITELINE(ie15_state, serial_rx_callback)) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( ie15 ) - ROM_REGION(0x1000, "maincpu", ROMREGION_ERASE00) - ROM_DEFAULT_BIOS("5chip") - ROM_SYSTEM_BIOS(0, "5chip", "5-chip firmware (newer)") - ROMX_LOAD("dump1.bin", 0x0000, 0x1000, CRC(14b82284) SHA1(5ac4159fbb1c3b81445605e26cd97a713ae12b5f), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "6chip", "6-chip firmware (older)") - ROMX_LOAD("dump5.bin", 0x0000, 0x1000, CRC(01f2e065) SHA1(2b72dc0594e38a528400cd25aed0c47e0c432895), ROM_BIOS(2)) - - ROM_REGION(0x1000, "video", ROMREGION_ERASE00) - - ROM_REGION(0x0800, "chargen", ROMREGION_ERASE00) - ROM_LOAD("chargen-15ie.bin", 0x0000, 0x0800, CRC(ed16bf6b) SHA1(6af9fb75f5375943d5c0ce9ed408e0fb4621b17e)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, ie15, 0, 0, ie15, ie15, driver_device, 0, "USSR", "15IE-00-013", 0) diff --git a/src/mess/drivers/if800.c b/src/mess/drivers/if800.c deleted file mode 100644 index 610269b9642..00000000000 --- a/src/mess/drivers/if800.c +++ /dev/null @@ -1,117 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - if800 - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "machine/pic8259.h" -#include "video/upd7220.h" - - -class if800_state : public driver_device -{ -public: - if800_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_hgdc(*this, "upd7220"), - m_video_ram(*this, "video_ram"), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") { } - - required_device m_hgdc; - - required_shared_ptr m_video_ram; - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_palette; - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); -}; - -UPD7220_DISPLAY_PIXELS_MEMBER( if800_state::hgdc_display_pixels ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - int xi,gfx; - UINT8 pen; - - gfx = m_video_ram[address >> 1]; - - for(xi=0;xi<16;xi++) - { - pen = ((gfx >> xi) & 1) ? 1 : 0; - - bitmap.pix32(y, x + xi) = palette[pen]; - } -} - -static ADDRESS_MAP_START(if800_map, AS_PROGRAM, 16, if800_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0x0ffff) AM_RAM - AM_RANGE(0xfe000,0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(if800_io, AS_IO, 16, if800_state) - ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0x0640, 0x065f) dma? - AM_RANGE(0x0660, 0x0663) AM_DEVREADWRITE8("upd7220", upd7220_device, read, write,0x00ff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( if800 ) -INPUT_PORTS_END - -void if800_state::machine_start() -{ -} - - -void if800_state::machine_reset() -{ -} - -static ADDRESS_MAP_START( upd7220_map, AS_0, 16, if800_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( if800, if800_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 8000000) - MCFG_CPU_PROGRAM_MAP(if800_map) - MCFG_CPU_IO_MAP(if800_io) - - -// MCFG_PIC8259_ADD( "pic8259", if800_pic8259_config ) - MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/4) - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(if800_state, hgdc_display_pixels) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) - - MCFG_PALETTE_ADD("palette", 8) -// MCFG_PALETTE_INIT(black_and_white) - -// MCFG_VIDEO_START_OVERRIDE(if800_state,if800) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( if800 ) - ROM_REGION( 0x2000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(36212491) SHA1(6eaa8885e2dccb6dd86def6c0c9be1870cee957f)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, if800, 0, 0, if800, if800, driver_device, 0, "Oki Electric", "if800 model 60", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/imds.c b/src/mess/drivers/imds.c deleted file mode 100644 index 6e7e3a8d063..00000000000 --- a/src/mess/drivers/imds.c +++ /dev/null @@ -1,116 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Intel Intellec MDS - - 28/06/2011 Skeleton driver. - -This is a prototyping machine, very complex and expensive. - -It does all i/o via uarts, that is TTY, paper-tape puncher, CRT terminal. -It also has proms which can be dynamically programmed to alter the machine -architecture, so internal ports change meaning mid-stream. (e.g. port 80). - -The code below is just a sample; it does not represent any aspect of the -real hardware. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class imds_state : public driver_device -{ -public: - imds_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(term_r); - DECLARE_READ8_MEMBER(term_status_r); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_term_data; - virtual void machine_reset(); -}; - -READ8_MEMBER( imds_state::term_status_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( imds_state::term_r ) -{ - return (m_term_data) ? 0x21 : 0x20; -} - -static ADDRESS_MAP_START(imds_mem, AS_PROGRAM, 8, imds_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(imds_io, AS_IO, 8, imds_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( imds ) -INPUT_PORTS_END - -WRITE8_MEMBER( imds_state::kbd_put ) -{ - m_term_data = data; -} - -void imds_state::machine_reset() -{ - m_term_data = 0; -} - -//static const ins8250_interface imds_com_interface = -//{ -// 1843200, -// DEVCB_NULL, -// NULL, -// NULL, -// NULL -//}; - -static MACHINE_CONFIG_START( imds, imds_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, XTAL_4MHz) // no idea of clock. - MCFG_CPU_PROGRAM_MAP(imds_mem) - MCFG_CPU_IO_MAP(imds_io) - -// MCFG_INS8250_ADD( "ins8250", imds_com_interface ) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(imds_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( imds ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "a62_2716.bin", 0x0000, 0x0800, CRC(86a55b2f) SHA1(21033f7abb2c3e08028613e0c35ffecb703ff4f1)) - ROM_LOAD( "a51_2716.bin", 0x0800, 0x0800, CRC(ee55c448) SHA1(16c2f7e3b5baeb398adcc59603943910813e6a9b)) - ROM_LOAD( "a52_2716.bin", 0x1000, 0x0800, CRC(8db1b33e) SHA1(6fc5e438009636dd6d7185071b152b0491d3baeb)) - ROM_LOAD( "a53_2716.bin", 0x1800, 0x0800, CRC(01690f4f) SHA1(eadef30a3797f41e08d28e7691f8de44c0f3b8ea)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, imds, 0, 0, imds, imds, driver_device, 0, "Intel", "Intellec MDS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/imds2.c b/src/mess/drivers/imds2.c deleted file mode 100644 index aae8a4506f7..00000000000 --- a/src/mess/drivers/imds2.c +++ /dev/null @@ -1,876 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:F. Ulivi -// -// *************************************** -// Driver for Intel Intellec MDS series-II -// *************************************** -// -// Documentation used for this driver: -// [1] Intel, manual 9800554-04 rev. D - Intellec series II MDS - Schematic drawings -// [2] Intel, manual 9800556-02 rev. B - Intellec series II MDS - Hardware reference manual -// [3] Intel, manual 9800555-02 rev. B - Intellec series II MDS - Hardware interface manual -// [4] Intel, manual 9800605-02 rev. B - Intellec series II MDS - Boot/monitor listing -// -// All these manuals are available on http://www.bitsavers.org -// -// An Intellec MDS series-II is composed of the following boards: -// -// ********** -// Integrated Processor Card (IPC) or Integrated Processor Board (IPB) -// -// This is the board where the OS (ISIS-II) and the application software run. -// This driver emulates an IPC. -// IPC is composed as follows: -// A83 8085A-2 CPU @ 4 MHz -// 64k of DRAM -// A82 2732 EPROM with monitor & boot firmware (assembly source of this ROM is in [4]) -// A66 8259A System PIC -// A89 8259A Local PIC -//*A86 8253 PIT -//*A91 8251A Serial channel #0 -//*A90 8251A Serial channel #1 -// -// ********** -// I/O Controller (IOC) -// -// This board acts as a controller for all I/O of the system. -// It is structured as if it were 2 boards in one: -// One part (around 8080) controls Keyboard, CRT & floppy, the other part (around PIO 8041A) controls all parallel I/Os -// (Line printer, Paper tape puncher, Paper tape reader, I/O to PROM programmer). -// Both parts are interfaced to IPC through a bidirectional 8-bit bus. -// IOC is composed of these parts: -// A69 8080A-2 CPU @ 2.448 MHz -// 8k of DRAM -// A50 2716 -// A51 2716 -// A52 2716 -// A53 2716 EPROMs with IOC firmware -// A58 8257 DMA controller -// A35 8253 PIT -// A1 8271 Floppy controller -// A20 8275 CRT controller -// A19 2708 Character generator ROM -// LS1 3.3 kHz beeper -// A72 8041A CPU @ 6 MHz (PIO: parallel I/O) -// -// ********** -// Keyboard controller -// -// Keyboard is controlled by a 8741 CPU that scans the key matrix and sends key codes to IOC through a 8-bit bus. -// -// A3 8741 CPU @ 3.58 MHz -// -// ICs that are not emulated yet are marked with "*" -// -// NOTE: -// Firmware running on PIO is NOT original because a dump is not available at the moment. -// Emulator runs a version of PIO firmware that was specifically developped by me to implement -// line printer output. -// -// TODO: -// - Find a dump of the original PIO firmware -// - Emulate serial channels on IPC -// - Emulate PIT on IPC -// - Adjust speed of processors. Wait states are not accounted for yet. -// -// Huge thanks to Dave Mabry for dumping IOC firmware, KB firmware and character generator. This driver would not -// exist without his dumps. -// (https://web.archive.org/web/20080509062332/http://www.s100-manuals.com/intel/IOC_iMDX_511_Upgrade.zip) -// -// Basic usage / test info: -// To use the system set DIP switches to: -// Floppy present -// IOC mode Diagnostic -// Keyboard present -// and reset the system. The built-in diagnostic mode should start. -// -// Another test is loading ISIS-II (the Intel OS for this system). Floppy image -// 9500007-07_ISIS-II_OPERATING_SYSTEM_DISKETTE_Ver_4.3.IMD -// To load it, the "IOC mode" should be set to "On line", the floppy image -// should be mounted and the system reset. After a few seconds the ISIS-II -// prompt should appear. A command that could be tried is "DIR" that lists -// the content of floppy disk. - -#include "includes/imds2.h" - -// CPU oscillator of IPC board: 8 MHz -#define IPC_XTAL_Y2 XTAL_8MHz - -// Main oscillator of IOC board: 22.032 MHz -#define IOC_XTAL_Y2 22032000 - -// FDC oscillator of IOC board: 8 MHz -#define IOC_XTAL_Y1 XTAL_8MHz - -// PIO oscillator: 6 MHz -#define IOC_XTAL_Y3 XTAL_6MHz - -// Frequency of beeper -#define IOC_BEEP_FREQ 3300 - -static ADDRESS_MAP_START(ipc_mem_map , AS_PROGRAM , 8 , imds2_state) - AM_RANGE(0x0000 , 0xffff) AM_READWRITE(ipc_mem_read, ipc_mem_write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ipc_io_map , AS_IO , 8 , imds2_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0xc0 , 0xc0) AM_READWRITE(imds2_ipc_dbbout_r , imds2_ipc_dbbin_data_w) - AM_RANGE(0xc1 , 0xc1) AM_READWRITE(imds2_ipc_status_r , imds2_ipc_dbbin_cmd_w) - AM_RANGE(0xf8 , 0xf9) AM_DEVREADWRITE("iocpio" , i8041_device , upi41_master_r , upi41_master_w) - AM_RANGE(0xfa , 0xfb) AM_READWRITE(imds2_ipclocpic_r , imds2_ipclocpic_w) - AM_RANGE(0xfc , 0xfd) AM_READWRITE(imds2_ipcsyspic_r , imds2_ipcsyspic_w) - AM_RANGE(0xff , 0xff) AM_WRITE(imds2_ipc_control_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ioc_mem_map , AS_PROGRAM , 8 , imds2_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000 , 0x1fff) AM_ROM - AM_RANGE(0x4000 , 0x5fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ioc_io_map , AS_IO , 8 , imds2_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00 , 0x0f) AM_WRITE(imds2_ioc_dbbout_w) - AM_RANGE(0x20 , 0x2f) AM_WRITE(imds2_ioc_f0_w) - AM_RANGE(0x30 , 0x3f) AM_WRITE(imds2_ioc_set_f1_w) - AM_RANGE(0x40 , 0x4f) AM_WRITE(imds2_ioc_reset_f1_w) - AM_RANGE(0x50 , 0x5f) AM_WRITE(imds2_start_timer_w) - AM_RANGE(0x60 , 0x6f) AM_WRITE(imds2_miscout_w) - AM_RANGE(0x80 , 0x8f) AM_READ(imds2_miscin_r) - AM_RANGE(0x90 , 0x9f) AM_READ(imds2_kb_read) - AM_RANGE(0xa0 , 0xaf) AM_READ(imds2_ioc_status_r) - AM_RANGE(0xb0 , 0xbf) AM_READ(imds2_ioc_dbbin_r) - AM_RANGE(0xc0 , 0xcf) AM_DEVICE("iocfdc" , i8271_device, map) - AM_RANGE(0xd0 , 0xdf) AM_DEVREADWRITE("ioccrtc" , i8275_device , read , write) - AM_RANGE(0xe0 , 0xef) AM_DEVREADWRITE("ioctimer" , pit8253_device , read , write); -// DMA controller range doesn't extend to 0xff because register 0xfd needs to be read as 0xff -// This register is used by IOC firmware to detect DMA controller model (either 8237 or 8257) - AM_RANGE(0xf0 , 0xf8) AM_DEVREADWRITE("iocdma" , i8257_device , read , write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pio_io_map , AS_IO , 8 , imds2_state) - AM_RANGE(MCS48_PORT_P1 , MCS48_PORT_P1) AM_READWRITE(imds2_pio_port_p1_r , imds2_pio_port_p1_w) - AM_RANGE(MCS48_PORT_P2 , MCS48_PORT_P2) AM_READWRITE(imds2_pio_port_p2_r , imds2_pio_port_p2_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(kb_io_map , AS_IO , 8 , imds2_state) - AM_RANGE(MCS48_PORT_P1 , MCS48_PORT_P1) AM_WRITE(imds2_kb_port_p1_w) - AM_RANGE(MCS48_PORT_P2 , MCS48_PORT_P2) AM_READ(imds2_kb_port_p2_r) - AM_RANGE(MCS48_PORT_T0 , MCS48_PORT_T0) AM_READ(imds2_kb_port_t0_r) - AM_RANGE(MCS48_PORT_T1 , MCS48_PORT_T1) AM_READ(imds2_kb_port_t1_r) -ADDRESS_MAP_END - -imds2_state::imds2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig , type , tag), - m_ipccpu(*this , "ipccpu"), - m_ipcsyspic(*this , "ipcsyspic"), - m_ipclocpic(*this , "ipclocpic"), - m_ioccpu(*this , "ioccpu"), - m_iocdma(*this , "iocdma"), - m_ioccrtc(*this , "ioccrtc"), - m_iocbeep(*this , "iocbeep"), - m_ioctimer(*this , "ioctimer"), - m_iocfdc(*this , "iocfdc"), - m_flop0(*this, "iocfdc:0"), - m_flop1(*this, "iocfdc:1"), - m_iocpio(*this , "iocpio"), - m_kbcpu(*this , "kbcpu"), - m_palette(*this , "palette"), - m_gfxdecode(*this, "gfxdecode"), - m_centronics(*this , "centronics"), - m_io_key0(*this , "KEY0"), - m_io_key1(*this , "KEY1"), - m_io_key2(*this , "KEY2"), - m_io_key3(*this , "KEY3"), - m_io_key4(*this , "KEY4"), - m_io_key5(*this , "KEY5"), - m_io_key6(*this , "KEY6"), - m_io_key7(*this , "KEY7"), - m_ioc_options(*this , "IOC_OPTS"), - m_device_status_byte(0xff) -{ -} - -READ8_MEMBER(imds2_state::ipc_mem_read) -{ - if (imds2_in_ipc_rom(offset)) { - return m_ipc_rom[ (offset & 0x07ff) | ((offset & 0x1000) >> 1) ]; - } else { - return m_ipc_ram[ offset ]; - } -} - -WRITE8_MEMBER(imds2_state::ipc_mem_write) -{ - if (!imds2_in_ipc_rom(offset)) { - m_ipc_ram[ offset ] = data; - } -} - -WRITE8_MEMBER(imds2_state::imds2_ipc_control_w) -{ - // See A84, pg 28 of [1] - // b3 is ~(bit to be written) - // b2-b0 is ~(no. of bit to be written) - UINT8 mask = (1U << (~data & 0x07)); - - if (BIT(data , 3)) { - m_ipc_control &= ~mask; - } else { - m_ipc_control |= mask; - } -} - -WRITE_LINE_MEMBER(imds2_state::imds2_ipc_intr) -{ - m_ipccpu->set_input_line(I8085_INTR_LINE , (state != 0) && BIT(m_ipc_control , 2)); -} - -READ8_MEMBER(imds2_state::imds2_ipcsyspic_r) -{ - return m_ipcsyspic->read(space , offset == 0); -} - -READ8_MEMBER(imds2_state::imds2_ipclocpic_r) -{ - return m_ipclocpic->read(space , offset == 0); -} - -WRITE8_MEMBER(imds2_state::imds2_ipcsyspic_w) -{ - m_ipcsyspic->write(space , offset == 0 , data); -} - -WRITE8_MEMBER(imds2_state::imds2_ipclocpic_w) -{ - m_ipclocpic->write(space , offset == 0 , data); -} - -WRITE8_MEMBER(imds2_state::imds2_miscout_w) -{ - m_miscout = data; - imds2_update_beeper(); - // Send INTR to IPC - m_ipclocpic->ir6_w(BIT(m_miscout , 1)); -} - -READ8_MEMBER(imds2_state::imds2_miscin_r) -{ - UINT8 res = m_ioc_options->read(); - return res | ((m_beeper_timer == 0) << 2); -} - -WRITE_LINE_MEMBER(imds2_state::imds2_beep_timer_w) -{ - m_beeper_timer = state; - imds2_update_beeper(); -} - -WRITE8_MEMBER(imds2_state::imds2_start_timer_w) -{ - // Trigger timer 2 of ioctimer - m_ioctimer->write_gate2(0); - m_ioctimer->write_gate2(1); -} - -READ8_MEMBER(imds2_state::imds2_kb_read) -{ - return m_kbcpu->upi41_master_r(space , (offset & 2) >> 1); -} - -READ8_MEMBER(imds2_state::imds2_kb_port_p2_r) -{ - if ((m_kb_p1 & 3) == 0) { - // Row selected - // Row number is encoded on bits P15..P12, they are "backwards" (P15 is LSB) and keyboard rows are encoded starting with value 2 on these bits (see A4, pg 56 of [1]) - unsigned row = (m_kb_p1 >> 2) & 0x0f; - ioport_value data; - - switch (row) { - case 4: - // Row 0 - data = m_io_key0->read(); - break; - - case 12: - // Row 1 - data = m_io_key1->read(); - break; - - case 2: - // Row 2 - data = m_io_key2->read(); - break; - - case 10: - // Row 3 - data = m_io_key3->read(); - break; - - case 6: - // Row 4 - data = m_io_key4->read(); - break; - - case 14: - // Row 5 - data = m_io_key5->read(); - break; - - case 1: - // Row 6 - data = m_io_key6->read(); - break; - - case 9: - // Row 7 - data = m_io_key7->read(); - break; - - default: - data = 0xff; - break; - } - return data & 0xff; - } else { - // No row selected - return 0xff; - } -} - -WRITE8_MEMBER(imds2_state::imds2_kb_port_p1_w) -{ - m_kb_p1 = data; -} - -READ8_MEMBER(imds2_state::imds2_kb_port_t0_r) -{ - // T0 tied low - // It appears to be some kind of strapping option on kb hw - return 0; -} - -READ8_MEMBER(imds2_state::imds2_kb_port_t1_r) -{ - // T1 tied low - // It appears to be some kind of strapping option on kb hw - return 0; -} - -WRITE8_MEMBER(imds2_state::imds2_ioc_dbbout_w) -{ - m_ioc_obf = ~data; - // Set/reset OBF flag (b0) - m_ipc_ioc_status = ((offset & 1) == 0) | (m_ipc_ioc_status & ~0x01); -} - -WRITE8_MEMBER(imds2_state::imds2_ioc_f0_w) -{ - // Set/reset F0 flag (b2) - m_ipc_ioc_status = ((offset & 1) << 2) | (m_ipc_ioc_status & ~0x04); -} - -WRITE8_MEMBER(imds2_state::imds2_ioc_set_f1_w) -{ - // Set F1 flag (b3) - m_ipc_ioc_status |= 0x08; -} - -WRITE8_MEMBER(imds2_state::imds2_ioc_reset_f1_w) -{ - // Reset F1 flag (b3) - m_ipc_ioc_status &= ~0x08; -} - -READ8_MEMBER(imds2_state::imds2_ioc_status_r) -{ - return ~m_ipc_ioc_status; -} - -READ8_MEMBER(imds2_state::imds2_ioc_dbbin_r) -{ - // Reset IBF flag (b1) - m_ipc_ioc_status &= ~0x02; - return ~m_ioc_ibf; -} - -READ8_MEMBER(imds2_state::imds2_ipc_dbbout_r) -{ - // Reset OBF flag (b0) - m_ipc_ioc_status &= ~0x01; - return m_ioc_obf; -} - -READ8_MEMBER(imds2_state::imds2_ipc_status_r) -{ - return m_ipc_ioc_status; -} - -WRITE8_MEMBER(imds2_state::imds2_ipc_dbbin_data_w) -{ - // Set IBF flag (b1) - m_ipc_ioc_status |= 0x02; - // Reset F1 flag (b3) - m_ipc_ioc_status &= ~0x08; - m_ioc_ibf = data; -} - -WRITE8_MEMBER(imds2_state::imds2_ipc_dbbin_cmd_w) -{ - // Set IBF flag (b1) - m_ipc_ioc_status |= 0x02; - // Set F1 flag (b3) - m_ipc_ioc_status |= 0x08; - m_ioc_ibf = data; -} - -WRITE_LINE_MEMBER(imds2_state::imds2_hrq_w) -{ - // Should be propagated to HOLD input of IOC CPU - m_iocdma->hlda_w(state); -} - -READ8_MEMBER(imds2_state::imds2_ioc_mem_r) -{ - address_space& prog_space = m_ioccpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(imds2_state::imds2_ioc_mem_w) -{ - address_space& prog_space = m_ioccpu->space(AS_PROGRAM); - return prog_space.write_byte(offset , data); -} - -READ8_MEMBER(imds2_state::imds2_pio_port_p1_r) -{ - // If STATUS ENABLE/ == 0 return inverted device status byte, else return 0xff - // STATUS ENABLE/ == 0 when P23-P20 == 12 & P24 == 0 & P25 = 1 & P26 = 1 - if ((m_pio_port2 & 0x7f) == 0x6c) { - return ~m_device_status_byte; - } else { - return 0xff; -} -} - -WRITE8_MEMBER(imds2_state::imds2_pio_port_p1_w) -{ - m_pio_port1 = data; - imds2_update_printer(); -} - -READ8_MEMBER(imds2_state::imds2_pio_port_p2_r) -{ - return m_pio_port2; -} - -WRITE8_MEMBER(imds2_state::imds2_pio_port_p2_w) -{ - m_pio_port2 = data; - imds2_update_printer(); - // Send INTR to IPC - m_ipclocpic->ir5_w(BIT(data , 7)); -} - -WRITE_LINE_MEMBER(imds2_state::imds2_pio_lpt_ack_w) -{ - if (state) { - m_device_status_byte |= 0x20; - } else { - m_device_status_byte &= ~0x20; - } -} - -WRITE_LINE_MEMBER(imds2_state::imds2_pio_lpt_busy_w) -{ - // Busy is active high in centronics_device whereas it's active low in MDS - if (!state) { - m_device_status_byte |= 0x10; - } else { - m_device_status_byte &= ~0x10; - } -} - -WRITE_LINE_MEMBER(imds2_state::imds2_pio_lpt_select_w) -{ - if (state) { - m_device_status_byte |= 0x40; - } else { - m_device_status_byte &= ~0x40; - } -} - -I8275_DRAW_CHARACTER_MEMBER(imds2_state::crtc_display_pixels) -{ - unsigned i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; - UINT16 pixels; - - if (lten) { - pixels = ~0; - } else if (vsp != 0 || (linecount & 8) != 0) { - pixels = 0; - } else { - // See [2], pg 58 for the very peculiar way of generating character images - // Here each half-pixel is translated into a full pixel - UINT16 exp_pix_l; - UINT16 exp_pix_r; - - exp_pix_l = (UINT16)chargen_byte; - exp_pix_l = ((exp_pix_l & 0x80) << 5) | - ((exp_pix_l & 0x40) << 4) | - ((exp_pix_l & 0x20) << 3) | - ((exp_pix_l & 0x10) << 2) | - ((exp_pix_l & 0x08) << 1) | - (exp_pix_l & 0x04); - exp_pix_l |= (exp_pix_l << 1); - exp_pix_r = exp_pix_l; - - // Layout of exp_pix_l/r: - // Bit # : F E D C B A 9 8 7 6 5 4 3 2 1 0 - // Bit of chargen_byte: 0 0 b7 b7 b6 b6 b5 b5 b4 b4 b3 b3 b2 b2 0 0 - if ((chargen_byte & 2) == 0) { - exp_pix_l >>= 1; - } - exp_pix_l &= 0x3fc0; - - if ((chargen_byte & 1) == 0) { - exp_pix_r >>= 1; - } - exp_pix_r &= 0x003e; - - pixels = exp_pix_l | exp_pix_r; - } - - if (rvv) { - pixels = ~pixels; - } - - for (i = 0; i < 14; i++) { - bitmap.pix32(y, x + i) = palette[ (pixels & (1U << (13 - i))) != 0 ]; - } -} - -int imds2_state::floppy_load(floppy_image_device *dev) -{ - dev->mon_w(0); - return IMAGE_INIT_PASS; -} - -void imds2_state::floppy_unload(floppy_image_device *dev) -{ - dev->mon_w(1); -} - -void imds2_state::driver_start() -{ - // Allocate 64k for IPC RAM - m_ipc_ram.resize(0x10000); - - memory_region *ipcrom = memregion("ipcrom"); - if (ipcrom == NULL) { - fatalerror("Unable to find IPC ROM region\n"); - } else { - m_ipc_rom = ipcrom->base(); - } -} - -void imds2_state::machine_start() -{ - // As far as I can tell from the schmatic, there's no software motor control - m_flop0->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(imds2_state::floppy_load), this)); - m_flop0->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(imds2_state::floppy_unload), this)); - m_flop1->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(imds2_state::floppy_load), this)); - m_flop1->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(imds2_state::floppy_unload), this)); -} - -void imds2_state::video_start() -{ - m_chargen = memregion("gfx1")->base(); -} - -void imds2_state::machine_reset() -{ - m_iocbeep->set_frequency(IOC_BEEP_FREQ); - m_ipc_control = 0x00; - m_ipc_ioc_status = 0x0f; - m_flop0->get_device()->mon_w(!m_flop0->get_device()->exists()); - m_flop1->get_device()->mon_w(!m_flop1->get_device()->exists()); - - m_iocfdc->set_rate(500000); // The IMD images show a rate of 500kbps -} - -bool imds2_state::imds2_in_ipc_rom(offs_t offset) const -{ - offs_t masked_offset = offset & 0xf800; - - // Region 0000-07ff is in ROM when START_UP/ == 0 && SEL_BOOT/ == 0 - if (masked_offset == 0x0000 && (m_ipc_control & 0x28) == 0) { - return true; - } - - // Region e800-efff is in ROM when SEL_BOOT/ == 0 - if (masked_offset == 0xe800 && (m_ipc_control & 0x08) == 0) { - return true; - } - - // Region f800-ffff is always in ROM - if (masked_offset == 0xf800) { - return true; - } - - return false; -} - -void imds2_state::imds2_update_beeper(void) -{ - m_iocbeep->set_state(m_beeper_timer == 0 && BIT(m_miscout , 0) == 0); -} - -void imds2_state::imds2_update_printer(void) -{ - // Data to printer is ~P1 when STATUS ENABLE/==1, else 0xff (assuming pull-ups on printer) - UINT8 printer_data; - if ((m_pio_port2 & 0x7f) == 0x6c) { - printer_data = 0xff; - } else { - printer_data = ~m_pio_port1; - } - m_centronics->write_data0(BIT(printer_data , 0)); - m_centronics->write_data1(BIT(printer_data , 1)); - m_centronics->write_data2(BIT(printer_data , 2)); - m_centronics->write_data3(BIT(printer_data , 3)); - m_centronics->write_data4(BIT(printer_data , 4)); - m_centronics->write_data5(BIT(printer_data , 5)); - m_centronics->write_data6(BIT(printer_data , 6)); - m_centronics->write_data7(BIT(printer_data , 7)); - - // LPT DATA STROBE/ == 0 when P23-P20 == 9 & P24 == 0 - m_centronics->write_strobe((m_pio_port2 & 0x1f) != 0x09); -} - -static INPUT_PORTS_START(imds2) - // See [1], pg 56 for key matrix layout - // See [1], pg 57 for keyboard layout - PORT_START("KEY0") - PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') // OK - PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('@') PORT_CHAR('`') // OK - PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') // OK - PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // OK - PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // OK - PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(':') PORT_CHAR('*') // OK - PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') // OK - PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // OK - - PORT_START("KEY1") - PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // OK - PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // OK - PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // OK - PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // OK - PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_UNUSED) - PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // OK - PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // OK - PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // OK - - PORT_START("KEY2") - PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('~') // OK - PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') // OK - PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // OK - PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // OK - PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') // OK - PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') // OK - PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // OK - PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') // OK - - PORT_START("KEY3") - PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // OK - PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // OK - PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // OK - PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // OK - PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // OK - PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // OK - PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // OK - PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // OK - - PORT_START("KEY4") - PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // OK - PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // OK - PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // OK - PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // OK - PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // OK - PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // OK - PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // OK - PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // OK - - PORT_START("KEY5") - PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') // OK - PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // OK - PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') // OK - PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // OK - PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') // OK - PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // OK - PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') // OK - PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') // OK - - PORT_START("KEY6") - PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // BS - PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // OK - PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') // OK - PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // OK - PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) // OK - PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // OK - PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') // OK - PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // OK - - PORT_START("KEY7") - PORT_BIT(0x01 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // OK - PORT_BIT(0x02 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // OK - PORT_BIT(0x04 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') PORT_CHAR('^') // OK - PORT_BIT(0x08 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // OK - PORT_BIT(0x10 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) // OK - PORT_BIT(0x20 , IP_ACTIVE_LOW , IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x40 , IP_ACTIVE_LOW , IPT_UNUSED) - PORT_BIT(0x80 , IP_ACTIVE_LOW , IPT_UNUSED) - - // Options on IOC: see [1], pg 40 - PORT_START("IOC_OPTS") - PORT_DIPNAME(0x80 , 0x80 , "Keyboard present") - PORT_DIPSETTING(0x80 , DEF_STR(Yes)) - PORT_DIPSETTING(0x00 , DEF_STR(No)) - PORT_DIPNAME(0x28 , 0x00 , "IOC mode") - PORT_DIPSETTING(0x00 , "On line") - PORT_DIPSETTING(0x08 , "Local") - PORT_DIPSETTING(0x20 , "Diagnostic") - PORT_DIPNAME(0x02 , 0x00 , "Floppy present") - PORT_DIPSETTING(0x02 , DEF_STR(Yes)) - PORT_DIPSETTING(0x00 , DEF_STR(No)) - PORT_DIPNAME(0x01 , 0x01 , "CRT frame frequency") - PORT_DIPSETTING(0x01 , "50 Hz") - PORT_DIPSETTING(0x00 , "60 Hz") -INPUT_PORTS_END - -static GFXLAYOUT_RAW(imds2_charlayout , 8 , 8 , 8 , 64) - -static GFXDECODE_START(imds2) - GFXDECODE_ENTRY("gfx1" , 0x0000 , imds2_charlayout , 0 , 1) -GFXDECODE_END - -static SLOT_INTERFACE_START( imds2_floppies ) - SLOT_INTERFACE( "8sssd", FLOPPY_8_SSSD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START(imds2 , imds2_state) - MCFG_CPU_ADD("ipccpu" , I8085A , IPC_XTAL_Y2 / 2) // 4 MHz - MCFG_CPU_PROGRAM_MAP(ipc_mem_map) - MCFG_CPU_IO_MAP(ipc_io_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("ipcsyspic" , pic8259_device , inta_cb) - MCFG_QUANTUM_TIME(attotime::from_hz(100)) - - MCFG_PIC8259_ADD("ipcsyspic" , WRITELINE(imds2_state , imds2_ipc_intr) , VCC , NULL) - MCFG_PIC8259_ADD("ipclocpic" , DEVWRITELINE("ipcsyspic" , pic8259_device , ir7_w) , VCC , NULL) - - MCFG_CPU_ADD("ioccpu" , I8080A , IOC_XTAL_Y2 / 9) // 2.448 MHz - MCFG_CPU_PROGRAM_MAP(ioc_mem_map) - MCFG_CPU_IO_MAP(ioc_io_map) - MCFG_QUANTUM_TIME(attotime::from_hz(100)) - - // The IOC CRT hw is a bit complex, as the character clock (CCLK) to i8275 - // is varied according to the part of the video frame being scanned and according to - // the 50/60 Hz option jumper (W8). - // The basic clock (BCLK) runs at 22.032 MHz. - // CCLK = BCLK / 14 when in the active region of video - // CCLK = BCLK / 12 when in horizontal retrace (HRTC=1) - // CCLK = BCLK / 10 when in horizontal retrace of "short scan lines" (50 Hz only) - // - // ***** 50 Hz timings ***** - // 80 chars/row, 26 chars/h. retrace, 11 scan lines/row, 25 active rows, 3 vertical retrace rows - // Scan line: 80 chars * 14 BCLK + 26 chars * 12 BCLK = 1432 BCLK (64.996 usec) - // Scan row: 11 * scan lines = 15752 BCLK (714.960 usec) - // "Short" scan line: 80 chars * 14 BCLK + 26 chars * 10 BCLK = 1380 BCLK (62.636 usec) - // Frame: 28 scan rows (8 scan lines of 27th row are short): 27 * scan row + 3 * scan line + 8 * short scan line: 440640 BCLK (20 msec) - // - // ***** 60 Hz timings ***** - // 80 chars/row, 20 chars/h. retrace, 10 scan lines/row, 25 active rows, 2 vertical retrace rows - // Scan line: 80 chars * 14 BCLK + 20 chars * 12 BCLK = 1360 BCLK (61.728 usec) - // Scan row: 10 * scan lines = 13600 BCLK (617.284 usec) - // Frame: 27 scan rows : 367200 BCLK (16.667 msec) - // - // Clock here is semi-bogus: it gives the correct frame frequency at 50 Hz (with the incorrect - // assumption that CCLK is fixed at BCLK / 14) - MCFG_DEVICE_ADD("ioccrtc" , I8275 , 22853600 / 14) - MCFG_I8275_CHARACTER_WIDTH(14) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(imds2_state , crtc_display_pixels) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("iocdma" , i8257_device , dreq2_w)) - MCFG_I8275_IRQ_CALLBACK(INPUTLINE("ioccpu" , I8085_INTR_LINE)) - - MCFG_SCREEN_ADD("screen" , RASTER) - MCFG_SCREEN_UPDATE_DEVICE("ioccrtc" , i8275_device , screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_GFXDECODE_ADD("gfxdecode" , "palette" , imds2) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("iocbeep" , BEEP , 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS , "mono" , 1.00) - - MCFG_DEVICE_ADD("iocdma" , I8257 , IOC_XTAL_Y2 / 9) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(imds2_state, imds2_hrq_w)) - MCFG_I8257_IN_MEMR_CB(READ8(imds2_state , imds2_ioc_mem_r)) - MCFG_I8257_OUT_MEMW_CB(WRITE8(imds2_state , imds2_ioc_mem_w)) - MCFG_I8257_IN_IOR_1_CB(DEVREAD8("iocfdc" , i8271_device , data_r)) - MCFG_I8257_OUT_IOW_1_CB(DEVWRITE8("iocfdc" , i8271_device , data_w)) - MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("ioccrtc" , i8275_device , dack_w)) - - MCFG_DEVICE_ADD("ioctimer" , PIT8253 , 0) - MCFG_PIT8253_CLK0(IOC_XTAL_Y1 / 4) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("ioctimer" , pit8253_device , write_clk2)); - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(imds2_state , imds2_beep_timer_w)); - - MCFG_DEVICE_ADD("iocfdc" , I8271 , IOC_XTAL_Y1 / 2) - MCFG_I8271_DRQ_CALLBACK(DEVWRITELINE("iocdma" , i8257_device , dreq1_w)) - MCFG_FLOPPY_DRIVE_ADD("iocfdc:0", imds2_floppies, "8sssd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("iocfdc:1", imds2_floppies, "8sssd", floppy_image_device::default_floppy_formats) - - MCFG_CPU_ADD("iocpio" , I8041 , IOC_XTAL_Y3) - MCFG_CPU_IO_MAP(pio_io_map) - MCFG_QUANTUM_TIME(attotime::from_hz(100)) - - MCFG_CPU_ADD("kbcpu", I8741, XTAL_3_579545MHz) /* 3.579545 MHz */ - MCFG_CPU_IO_MAP(kb_io_map) - MCFG_QUANTUM_TIME(attotime::from_hz(100)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(imds2_state , imds2_pio_lpt_ack_w)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(imds2_state , imds2_pio_lpt_busy_w)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(imds2_state , imds2_pio_lpt_select_w)) -MACHINE_CONFIG_END - -ROM_START(imds2) - // ROM definition of IPC cpu (8085A) - ROM_REGION(0x1000 , "ipcrom" , 0) - ROM_LOAD("ipc_a82.bin" , 0x0000 , 0x1000 , CRC(0889394f) SHA1(b7525baf1884a7d67402dea4b5566016a9861ef2)) - - // ROM definition of IOC cpu (8080A) - ROM_REGION(0x2000 , "ioccpu" , 0) - ROM_LOAD("ioc_a50.bin" , 0x0000 , 0x0800 , CRC(d9f926a1) SHA1(bd9d0f7458acc2806120a6dbaab9c48be315b060)) - ROM_LOAD("ioc_a51.bin" , 0x0800 , 0x0800 , CRC(6aa2f86c) SHA1(d3a5314d86e3366545b4c97b29e323dfab383d5f)) - ROM_LOAD("ioc_a52.bin" , 0x1000 , 0x0800 , CRC(b88a38d5) SHA1(934716a1daec852f4d1f846510f42408df0c9584)) - ROM_LOAD("ioc_a53.bin" , 0x1800 , 0x0800 , CRC(c8df4bb9) SHA1(2dfb921e94ae7033a7182457b2f00657674d1b77)) - - // ROM definition of PIO controller (8041A) - // For the time being a specially developped PIO firmware is used until a dump of the original PIO is - // available. - ROM_REGION(0x400 , "iocpio" , 0) - ROM_LOAD("pio_a72.bin" , 0 , 0x400 , BAD_DUMP CRC(8c8e740b)) - - // ROM definition of keyboard controller (8741) - ROM_REGION(0x400 , "kbcpu" , 0) - ROM_LOAD("kbd511.bin" , 0 , 0x400 , CRC(ba7c4303) SHA1(19899af732d0ae1247bfc79979b1ee5f339ee5cf)) - // ROM definition of character generator (2708, A19 on IOC) - ROM_REGION(0x400 , "gfx1" , 0) - ROM_LOAD ("ioc_a19.bin" , 0x0000 , 0x0400 , CRC(47487d0f) SHA1(0ed98f9f06622949ee3cc2ffc572fb9702db0f81)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1979, imds2, 0, 0, imds2, imds2, driver_device, 0, "Intel", "Intellec MDS-II" , 0) diff --git a/src/mess/drivers/imsai.c b/src/mess/drivers/imsai.c deleted file mode 100644 index 60dca210781..00000000000 --- a/src/mess/drivers/imsai.c +++ /dev/null @@ -1,142 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Imsai MPU-B. One of the earliest single-board computers on a S100 card. - - 2013-09-11 Skeleton driver. - - Chips used: i8085, i8251, i8253, 3622 fusable prom. XTAL 6MHz - - Press any key to start the monitor program. - - ToDo: - - Banking - - Dipswitches - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8251.h" -#include "machine/pit8253.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class imsai_state : public driver_device -{ -public: - imsai_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_uart(*this, "uart"), - m_pit(*this, "pit") - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(keyin_r); - DECLARE_READ8_MEMBER(status_r); - DECLARE_WRITE8_MEMBER(control_w); - DECLARE_WRITE_LINE_MEMBER(write_uart_clock); - -private: - UINT8 m_term_data; - virtual void machine_reset(); - required_device m_maincpu; - required_device m_terminal; - required_device m_uart; - required_device m_pit; -}; - - -static ADDRESS_MAP_START(imsai_mem, AS_PROGRAM, 8, imsai_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0xd000, 0xd0ff) AM_RAM - AM_RANGE(0xd100, 0xd103) AM_DEVREADWRITE("pit", pit8253_device, read, write) - AM_RANGE(0xd800, 0xdfff) AM_ROM AM_REGION("roms", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(imsai_io, AS_IO, 8, imsai_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x02, 0x02) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x03, 0x03) AM_READ(status_r) - AM_RANGE(0x04, 0x04) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x05, 0x05) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x12, 0x12) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x13, 0x13) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x14, 0x14) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x15, 0x15) AM_READ(status_r) - AM_RANGE(0xf3, 0xf3) AM_WRITE(control_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( imsai ) -INPUT_PORTS_END - -READ8_MEMBER( imsai_state::keyin_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( imsai_state::status_r ) -{ - return (m_term_data) ? 3 : 1; -} - -WRITE8_MEMBER( imsai_state::kbd_put ) -{ - m_term_data = data; -} - -WRITE_LINE_MEMBER(imsai_state::write_uart_clock) -{ - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - -WRITE8_MEMBER( imsai_state::control_w ) -{ -} - -void imsai_state::machine_reset() -{ - m_term_data = 0; -} - -static MACHINE_CONFIG_START( imsai, imsai_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8085A, XTAL_6MHz) - MCFG_CPU_PROGRAM_MAP(imsai_mem) - MCFG_CPU_IO_MAP(imsai_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(imsai_state, kbd_put)) - - /* Devices */ - MCFG_DEVICE_ADD("uart", I8251, 0) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_6MHz / 3) /* Timer 0: baud rate gen for 8251 */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(imsai_state, write_uart_clock)) - MCFG_PIT8253_CLK1(XTAL_6MHz / 3) /* Timer 1: user */ - MCFG_PIT8253_CLK2(XTAL_6MHz / 3) /* Timer 2: user */ -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( imsai ) - ROM_REGION( 0x800, "roms", 0 ) - ROM_LOAD( "vdb-80.rom", 0x0000, 0x0800, CRC(0afc4683) SHA1(a5419aaee00badf339d7c627f50ef8b2538e42e2) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, imsai, 0, 0, imsai, imsai, driver_device, 0, "Imsai", "MPU-B", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/indiana.c b/src/mess/drivers/indiana.c deleted file mode 100644 index 23e08a8bb81..00000000000 --- a/src/mess/drivers/indiana.c +++ /dev/null @@ -1,122 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Indiana University 68030 board - - 08/12/2009 Skeleton driver. - 01/20/2014 Added ISA bus and peripherals - - TODO: Text appears in VGA f/b (0x6B8000), but doesn't display? - - System often reads/writes 6003D4/5, might be a cut-down 6845, - as it only uses registers C,D,E,F. - -****************************************************************************/ - -#include "bus/rs232/keyboard.h" -#include "cpu/m68000/m68000.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "machine/mc68901.h" - -#define M68K_TAG "maincpu" -#define ISABUS_TAG "isa" -#define MFP_TAG "mfp" - -class indiana_state : public driver_device -{ -public: - indiana_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, M68K_TAG) { } - DECLARE_DRIVER_INIT(indiana); - virtual void machine_reset(); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(indiana_mem, AS_PROGRAM, 32, indiana_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x0000ffff) AM_MIRROR(0x7f800000) AM_ROM AM_REGION("user1", 0) // 64Kb of EPROM - AM_RANGE(0x00100000, 0x00107fff) AM_MIRROR(0x7f8f8000) AM_RAM // SRAM 32Kb of SRAM - AM_RANGE(0x00200000, 0x002fffff) AM_DEVREADWRITE8(MFP_TAG, mc68901_device, read, write, 0xffffffff) AM_MIRROR(0x7f800000) // MFP - AM_RANGE(0x00400000, 0x004fffff) AM_DEVREADWRITE16(ISABUS_TAG, isa16_device, io16_swap_r, io16_swap_w, 0xffffffff) AM_MIRROR(0x7f800000) // 16 bit PC IO - AM_RANGE(0x00500000, 0x005fffff) AM_DEVREADWRITE16(ISABUS_TAG, isa16_device, prog16_swap_r, prog16_swap_w, 0xffffffff) AM_MIRROR(0x7f800000) // 16 bit PC MEM - AM_RANGE(0x00600000, 0x006fffff) AM_DEVREADWRITE8(ISABUS_TAG, isa16_device, io_r, io_w, 0xffffffff) AM_MIRROR(0x7f800000) // 8 bit PC IO - AM_RANGE(0x00700000, 0x007fffff) AM_DEVREADWRITE8(ISABUS_TAG, isa16_device, prog_r, prog_w, 0xffffffff) AM_MIRROR(0x7f800000) // 8 bit PC MEM - AM_RANGE(0x80000000, 0x803fffff) AM_RAM // 4 MB RAM - AM_RANGE(0xfffe0000, 0xfffe7fff) AM_RAM // SRAM mirror? -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( indiana ) -INPUT_PORTS_END - - -void indiana_state::machine_reset() -{ -} - -DRIVER_INIT_MEMBER(indiana_state,indiana) -{ -} - -SLOT_INTERFACE_START( indiana_isa_cards ) - // 8-bit - SLOT_INTERFACE("fdc_at", ISA8_FDC_AT) - SLOT_INTERFACE("comat", ISA8_COM_AT) - SLOT_INTERFACE("vga", ISA8_VGA) - - // 16-bit - SLOT_INTERFACE("ide", ISA16_IDE) -SLOT_INTERFACE_END - -static DEVICE_INPUT_DEFAULTS_START( keyboard ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_1200 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -static MACHINE_CONFIG_START( indiana, indiana_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M68K_TAG, M68030, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(indiana_mem) - - MCFG_DEVICE_ADD(ISABUS_TAG, ISA16, 0) - MCFG_ISA16_CPU(":" M68K_TAG) - MCFG_ISA16_BUS_CUSTOM_SPACES() - MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa1", indiana_isa_cards, "vga", false) - MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa2", indiana_isa_cards, "fdc_at", false) - MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa3", indiana_isa_cards, "comat", false) - MCFG_ISA16_SLOT_ADD(ISABUS_TAG, "isa4", indiana_isa_cards, "ide", false) - - MCFG_DEVICE_ADD(MFP_TAG, MC68901, XTAL_16MHz/4) - MCFG_MC68901_TIMER_CLOCK(XTAL_16MHz/4) - MCFG_MC68901_RX_CLOCK(0) - MCFG_MC68901_TX_CLOCK(0) - MCFG_MC68901_OUT_SO_CB(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD("keyboard", default_rs232_devices, "keyboard") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MFP_TAG, mc68901_device, write_rx)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("keyboard", keyboard) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( indiana ) - ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v9", "ver 0.9" ) - ROMX_LOAD( "prom0_9.bin", 0x0000, 0x10000, CRC(746ad75e) SHA1(7d5c123c8568b1e02ab683e8f3188d0fef78d740), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v8", "ver 0.8" ) - ROMX_LOAD( "prom0_8.bin", 0x0000, 0x10000, CRC(9d8dafee) SHA1(c824e5fe6eec08f51ef287c651a5034fe3c8b718), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v7", "ver 0.7" ) - ROMX_LOAD( "prom0_7.bin", 0x0000, 0x10000, CRC(d6a3b6bc) SHA1(01d8cee989ab29646d9d3f8b7262b10055653d41), ROM_BIOS(3)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1993, indiana, 0, 0, indiana, indiana, indiana_state, indiana, "Indiana University", "Indiana University 68030 board", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/instruct.c b/src/mess/drivers/instruct.c deleted file mode 100644 index ae806290293..00000000000 --- a/src/mess/drivers/instruct.c +++ /dev/null @@ -1,438 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Signetics Intructor 50 - - 2010-04-08 Skeleton driver. - 2012-05-20 Connected digits, system boots. [Robbbert] - 2012-05-20 Connected keyboard, system mostly usable. [Robbbert] - 2013-10-15 Fixed various regressions. [Robbbert] - - From looking at a blurry picture of it, this is what I can determine: - - Left side: 8 toggle switches, with a round red led above each one. - - Below this is the Port Address Switch with choice of 'Non-Extended', 'Extended' or 'Memory'. - - To the right of this is another toggle switch labelled 'Interrupt', the - choices are 'Direct' and 'Indirect'. - - Above this switch are 2 more round red leds: FLAG and RUN. - - Middle: a 4 down x3 across keypad containing the function keys. The - labels (from left to right, top to bottom) are: - SENS, WCAS, BKPT, INT, RCAS, REG, MON, STEP, MEM, RST, RUN, ENT/NXT. - - Right side: a 4x4 hexadecimal keypad. The keys are: - C, D, E, F, 8, 9, A, B, 4, 5, 6, 7, 0, 1, 2, 3 - - Above, extending from one side to the other is a metal plate with - printed mnemonics. At the right edge are sockets to connect up the - MIC and EAR cords to a cassette player. - - At the back is a S100 interface. - - Quick usage: - - Look at memory: Press minus key. Enter an address. Press UP key to see the next. - - Look at registers: Press R. Press 0. Press UP key to see the next. - - Set PC register: Press R. Press C. Type in new address, Press UP. - - Load a tape: Press L, enter file number (1 digit), press UP. On - completion of a successful load, HELLO will be displayed. - - ToDO: - - Connect round led for Run. - - Last Address Register - - Initial Jump Logic - - Single-step and Breakpoint don't stop execution because of the above. - - The "Port Address Switch" which selects which of the 3 sources will - be used for port_r and port_w. Currently all 3 are selected at once. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/s2650/s2650.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "instruct.lh" - -class instruct_state : public driver_device -{ -public: - instruct_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_p_ram(*this, "mainram") - , m_p_smiram(*this, "smiram") - , m_p_extram(*this, "extram") - , m_cass(*this, "cassette") - { } - - DECLARE_READ8_MEMBER(port_r); - DECLARE_READ8_MEMBER(portfc_r); - DECLARE_READ8_MEMBER(portfd_r); - DECLARE_READ8_MEMBER(portfe_r); - DECLARE_READ8_MEMBER(sense_r); - DECLARE_WRITE_LINE_MEMBER(flag_w); - DECLARE_WRITE8_MEMBER(port_w); - DECLARE_WRITE8_MEMBER(portf8_w); - DECLARE_WRITE8_MEMBER(portf9_w); - DECLARE_WRITE8_MEMBER(portfa_w); - DECLARE_QUICKLOAD_LOAD_MEMBER(instruct); - INTERRUPT_GEN_MEMBER(t2l_int); -private: - virtual void machine_reset(); - UINT16 m_lar; - UINT8 m_digit; - bool m_valid_digit; - bool m_cassin; - bool m_irqstate; - required_device m_maincpu; - required_shared_ptr m_p_ram; - required_shared_ptr m_p_smiram; - required_shared_ptr m_p_extram; - required_device m_cass; -}; - -// flag led -WRITE_LINE_MEMBER( instruct_state::flag_w ) -{ - output_set_value("led8", !state); -} - -// user port -WRITE8_MEMBER( instruct_state::port_w ) -{ - char ledname[8]; - for (int i = 0; i < 8; i++) - { - sprintf(ledname,"led%d",i); - output_set_value(ledname, !BIT(data, i)); - } -} - -// cassette port -WRITE8_MEMBER( instruct_state::portf8_w ) -{ - if BIT(data, 4) - m_cass->output(BIT(data, 3) ? -1.0 : +1.0); - else - m_cass->output(0.0); - - m_cassin = BIT(data, 7); -} - -// segment output -WRITE8_MEMBER( instruct_state::portf9_w ) -{ - if (m_valid_digit) - output_set_digit_value(m_digit, data); - m_valid_digit = false; -} - -// digit & keyrow-scan select -WRITE8_MEMBER( instruct_state::portfa_w ) -{ - m_digit = data; - m_valid_digit = true; -} - -// user switches -READ8_MEMBER( instruct_state::port_r ) -{ - return ioport("USW")->read(); -} - -// last address register A0-7 copied to 17E9 at boot -READ8_MEMBER( instruct_state::portfc_r ) -{ - return m_lar; -} - -// last address register A8-14 copied to 17E8 at boot -READ8_MEMBER( instruct_state::portfd_r ) -{ - return (m_lar >> 8) & 0x7f; -} - -// read keyboard -READ8_MEMBER( instruct_state::portfe_r ) -{ - for (UINT8 i = 0; i < 6; i++) - { - if (BIT(m_digit, i)) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",i); - return ioport(kbdrow)->read(); - } - } - - return 0xf; -} - - -// Read cassette and SENS key -READ8_MEMBER( instruct_state::sense_r ) -{ - if (m_cassin) - return (m_cass->input() > 0.03) ? 1 : 0; - else - return BIT(ioport("HW")->read(), 0); -} - -INTERRUPT_GEN_MEMBER( instruct_state::t2l_int ) -{ - UINT8 hwkeys = ioport("HW")->read(); - - // check RST key - if BIT(hwkeys, 3) - { - m_maincpu->set_state_int(S2650_PC, 0); - return; - } - else - // check MON key - if BIT(hwkeys, 2) - { - m_maincpu->set_state_int(S2650_PC, 0x1800); - return; - } - else - { - UINT8 switches = ioport("SW")->read(); - - // Set vector from INDIRECT sw - UINT8 vector = BIT(switches, 0) ? 0x87 : 0x07; - - // Check INT sw & key - if BIT(switches, 1) - device.execute().set_input_line_and_vector(0, BIT(hwkeys, 1) ? ASSERT_LINE : CLEAR_LINE, vector); - else - // process ac input - { - m_irqstate ^= 1; - device.execute().set_input_line_and_vector(0, m_irqstate ? ASSERT_LINE : CLEAR_LINE, vector); - } - } -} - -static ADDRESS_MAP_START( instruct_mem, AS_PROGRAM, 8, instruct_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0ffe) AM_RAM AM_SHARE("mainram") - AM_RANGE(0x0fff, 0x0fff) AM_READWRITE(port_r,port_w) - AM_RANGE(0x1780, 0x17ff) AM_RAM AM_SHARE("smiram") - AM_RANGE(0x1800, 0x1fff) AM_ROM AM_REGION("roms",0) - AM_RANGE(0x2000, 0x7fff) AM_RAM AM_SHARE("extram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( instruct_io, AS_IO, 8, instruct_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x07, 0x07) AM_READWRITE(port_r,port_w) - AM_RANGE(0xf8, 0xf8) AM_WRITE(portf8_w) - AM_RANGE(0xf9, 0xf9) AM_WRITE(portf9_w) - AM_RANGE(0xfa, 0xfa) AM_WRITE(portfa_w) - AM_RANGE(0xfc, 0xfc) AM_READ(portfc_r) - AM_RANGE(0xfd, 0xfd) AM_READ(portfd_r) - AM_RANGE(0xfe, 0xfe) AM_READ(portfe_r) - AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(port_r,port_w) - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(sense_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( instruct ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("WCAS") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RCAS") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BKPT") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT/NXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - - PORT_START("HW") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SENS") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MON") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - - PORT_START("SW") - PORT_DIPNAME( 0x01, 0x00, "INT") // Interrupt jumps to 0007 or *0007 - PORT_DIPSETTING( 0x01, "Indirect") - PORT_DIPSETTING( 0x00, "Direct") - PORT_DIPNAME( 0x02, 0x00, "AC/INT") // Interrupt comes from INT key or from power supply - PORT_DIPSETTING( 0x02, "INT") - PORT_DIPSETTING( 0x00, "AC") - - PORT_START("USW") - PORT_DIPNAME( 0x01, 0x00, "Switch A") PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x01, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x02, 0x02, "Switch B") PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x02, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x04, 0x04, "Switch C") PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x04, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x08, 0x00, "Switch D") PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x08, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x10, 0x00, "Switch E") PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x10, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x20, 0x20, "Switch F") PORT_DIPLOCATION("SW1:6") - PORT_DIPSETTING( 0x20, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x40, 0x40, "Switch G") PORT_DIPLOCATION("SW1:7") - PORT_DIPSETTING( 0x40, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x80, 0x00, "Switch H") PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x80, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) -INPUT_PORTS_END - - -void instruct_state::machine_reset() -{ - m_cassin = 0; - address_space &space = m_maincpu->space(AS_IO); - port_w(space, 0, 0); // turn round leds off - m_maincpu->set_state_int(S2650_PC, 0x1800); -} - -QUICKLOAD_LOAD_MEMBER( instruct_state, instruct ) -{ - UINT16 i, exec_addr, quick_length, read_; - int result = IMAGE_INIT_FAIL; - - quick_length = image.length(); - if (quick_length < 0x0100) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); - image.message(" File too short"); - } - else - if (quick_length > 0x8000) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); - image.message(" File too long"); - } - else - { - dynamic_buffer quick_data(quick_length); - read_ = image.fread( &quick_data[0], quick_length); - if (read_ != quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); - image.message(" Cannot read the file"); - } - else if (quick_data[0] != 0xc5) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); - image.message(" Invalid header"); - } - else - { - exec_addr = quick_data[1] * 256 + quick_data[2]; - - if (exec_addr >= quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); - image.message(" Exec address beyond end of file"); - } - else - { - // load to 0000-0FFE (standard ram + extra) - read_ = 0xfff; - if (quick_length < 0xfff) - read_ = quick_length; - m_p_ram[0] = 0x1f; // add jump for RST key - for (i = 1; i < read_; i++) - m_p_ram[i] = quick_data[i]; - - // load to 1780-17BF (spare ram inside 2656) - read_ = 0x17c0; - if (quick_length < 0x17c0) - read_ = quick_length; - if (quick_length > 0x1780) - for (i = 0x1780; i < read_; i++) - m_p_smiram[i-0x1780] = quick_data[i]; - - // put start address into PC so it can be debugged - m_p_smiram[0x68] = m_p_ram[1]; - m_p_smiram[0x69] = m_p_ram[2]; - - // load to 2000-7FFF (optional extra ram) - if (quick_length > 0x2000) - for (i = 0x2000; i < quick_length; i++) - m_p_extram[i-0x2000] = quick_data[i]; - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); - - // Start the quickload - JP exec_addr - m_maincpu->set_state_int(S2650_PC, 0); - - result = IMAGE_INIT_PASS; - } - } - } - - return result; -} - -static MACHINE_CONFIG_START( instruct, instruct_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_3_579545MHz / 4) - MCFG_CPU_PROGRAM_MAP(instruct_mem) - MCFG_CPU_IO_MAP(instruct_io) - MCFG_CPU_PERIODIC_INT_DRIVER(instruct_state, t2l_int, 120) - MCFG_S2650_FLAG_HANDLER(WRITELINE(instruct_state, flag_w)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_instruct) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", instruct_state, instruct, "pgm", 1) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( instruct ) - ROM_REGION( 0x0800, "roms", 0 ) - ROM_LOAD( "instruct.rom", 0x0000, 0x0800, CRC(131715a6) SHA1(4930b87d09046113ab172ba3fb31f5e455068ec7) ) - - ROM_REGION( 0x8020, "proms", 0 ) - ROM_LOAD( "82s123.33", 0x0000, 0x0020, CRC(b7aecef0) SHA1(b39fb35e8b6ab67b31f8f310fd5d56304bcd4123) ) - ROM_LOAD( "82s103.20", 0x0020, 0x8000, NO_DUMP ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, instruct, 0, 0, instruct, instruct, driver_device, 0, "Signetics", "Signetics Instructor 50", 0 ) diff --git a/src/mess/drivers/interact.c b/src/mess/drivers/interact.c deleted file mode 100644 index 31a7cf195f2..00000000000 --- a/src/mess/drivers/interact.c +++ /dev/null @@ -1,299 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:JJ Stacino -/*************************************************************************** - - Interact Family Computer - - 12/05/2009 Skeleton driver - Micko - 31/05/2009 Added notes - Robbbert - - This was made by Interact Company of Ann Arbor, Michigan. However, - just after launch, the company collapsed. The liquidator, Protecto, - sold some and MicroVideo sold the rest. MicroVideo continued to - develop but went under 2 years later. Meanwhile, the French company - Lambda Systems sold a clone called the Victor Lambda. But, like the - Americans, Lambda Systems also collapsed. Another French company, - Micronique, purchased all remaining stock and intellectual rights - from Lambda Systems, Microvideo and Interact, and the computer becomes - wholly French. The computer has a name change, becoming the Hector. - This in turn gets upgraded (2HR, HRX, MX). The line is finally - retired in about 1985. - - Hector 2HR+ - Victor - Hector 2HR - Hector HRX - Hector MX40c - Hector MX80c - Hector 1 - Interact - - 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com - 31/06/2009 Video - Robbbert - - 29/10/2009 Update skeleton to functional machine - by yo_fr (jj.stac @ aliceadsl.fr) - - => add Keyboard, - => add color, - => add cassette, - => add sn76477 sound and 1bit sound, - => add joysticks (stick, pot, fire) - => add BR/HR switching - => add bank switch for HRX - => add device MX80c and bank switching for the ROM - Importante note : the keyboard function add been piked from - DChector project : http://dchector.free.fr/ made by DanielCoulom - (thank's Daniel) - TODO : Add the cartridge function, - Adjust the one shot and A/D timing (sn76477) -****************************************************************************/ -/* Mapping for joystick see hec2hrp.c*/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "formats/hect_tap.h" -#include "imagedev/printer.h" -#include "sound/wave.h" /* for K7 sound*/ -#include "sound/discrete.h" /* for 1 Bit sound*/ -#include "machine/upd765.h" /* for floppy disc controller */ - -#include "includes/hec2hrp.h" - - -class interact_state : public hec2hrp_state -{ -public: - interact_state(const machine_config &mconfig, device_type type, const char *tag) - : hec2hrp_state(mconfig, type, tag), - m_videoram(*this, "videoram") { } - - required_shared_ptr m_videoram; - DECLARE_MACHINE_START(interact); - DECLARE_MACHINE_RESET(interact); - UINT32 screen_update_interact(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - - -static ADDRESS_MAP_START(interact_mem, AS_PROGRAM, 8, interact_state ) - ADDRESS_MAP_UNMAP_HIGH - /* Hardware address mapping*/ -/* AM_RANGE(0x0800,0x0808) AM_WRITE(hector_switch_bank_w)// Bank management not udsed in BR machine*/ - AM_RANGE(0x1000,0x1000) AM_WRITE(hector_color_a_w) /* Color c0/c1*/ - AM_RANGE(0x1800,0x1800) AM_WRITE(hector_color_b_w) /* Color c2/c3*/ - AM_RANGE(0x2000,0x2003) AM_WRITE(hector_sn_2000_w) /* Sound*/ - AM_RANGE(0x2800,0x2803) AM_WRITE(hector_sn_2800_w) /* Sound*/ - AM_RANGE(0x3000,0x3000) AM_READWRITE(hector_cassette_r, hector_sn_3000_w)/* Write necessary*/ - AM_RANGE(0x3800,0x3807) AM_READWRITE(hector_keyboard_r, hector_keyboard_w) /* Keyboard*/ - - /* Main ROM page*/ - AM_RANGE(0x0000,0x3fff) AM_ROM /*BANK(2)*/ - /* AM_RANGE(0x1000,0x3fff) AM_RAM*/ - - /* Video br mapping*/ - AM_RANGE(0x4000,0x49ff) AM_RAM AM_SHARE("videoram") - /* continous RAM*/ - AM_RANGE(0x4A00,0xffff) AM_RAM - -ADDRESS_MAP_END - - -MACHINE_RESET_MEMBER(interact_state,interact) -{ - hector_reset(0, 0); -} - -MACHINE_START_MEMBER(interact_state,interact) -{ - hector_init(); -} - -UINT32 interact_state::screen_update_interact(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_videoram; - screen.set_visible_area(0, 113, 0, 75); - hector_hr(bitmap, videoram, 77, 32); - return 0; -} - -static MACHINE_CONFIG_START( interact, interact_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(interact_mem) - MCFG_CPU_PERIODIC_INT_DRIVER(interact_state, irq0_line_hold, 50) /* put on the I8080 irq in Hz*/ - - MCFG_MACHINE_RESET_OVERRIDE(interact_state,interact) - MCFG_MACHINE_START_OVERRIDE(interact_state,interact) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 79) - MCFG_SCREEN_VISIBLE_AREA(0, 112, 0, 77) - MCFG_SCREEN_UPDATE_DRIVER(interact_state, screen_update_interact) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) /* 8 colours, but only 4 at a time*/ - - MCFG_VIDEO_START_OVERRIDE(interact_state,hec2hrp) - - MCFG_FRAGMENT_ADD(hector_audio) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(hector_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MASK_SPEAKER) - MCFG_CASSETTE_INTERFACE("interact_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","interact") - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( hector1, interact_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_1_75MHz) - MCFG_CPU_PROGRAM_MAP(interact_mem) - MCFG_CPU_PERIODIC_INT_DRIVER(interact_state, irq0_line_hold, 50) /* put on the I8080 irq in Hz*/ - - MCFG_MACHINE_RESET_OVERRIDE(interact_state,interact) - MCFG_MACHINE_START_OVERRIDE(interact_state,interact) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 79) - MCFG_SCREEN_VISIBLE_AREA(0, 112, 0, 77) - MCFG_SCREEN_UPDATE_DRIVER(interact_state, screen_update_interact) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) /* 8 colours, but only 4 at a time*/ - - MCFG_VIDEO_START_OVERRIDE(interact_state,hec2hrp) - - MCFG_FRAGMENT_ADD(hector_audio) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(hector_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MASK_SPEAKER) - MCFG_CASSETTE_INTERFACE("interact_cass") - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - -MACHINE_CONFIG_END - -/* Input ports */ -static INPUT_PORTS_START( interact ) - /* keyboard input */ - PORT_START("KEY.0") /* [0] - port 3000 @ 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("KEY.1") /* [1] - port 3000 @ 1 */ /* touches => 2 1 0 / . - , + */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - - PORT_START("KEY.2") /* [1] - port 3000 @ 2 */ /* touches => .. 9 8 7 6 5 4 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 :") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 !") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_START("KEY.3") /* [1] - port 3000 @ 3 */ /* touches => B A .. ? .. = .. ; */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_START("KEY.4") /* [1] - port 3000 @ 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("KEY.5") /* [1] - port 3000 @ 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - - PORT_START("KEY.6") /* [1] - port 3000 @ 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - - PORT_START("KEY.7") /* [1] - port 3000 @ 7 JOYSTICK */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) LEFT") PORT_CODE(KEYCODE_1_PAD) /* Joy(1) on numpad*/ - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) RIGHT") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) UP") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) DOWN") PORT_CODE(KEYCODE_2_PAD) - - PORT_START("KEY.8") /* [1] - port 3000 @ 8 not for the real machine, but to emulate the analog signal of the joystick */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) FIRE") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) FIRE") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)+") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)-") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)+") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)-") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/* ROM definition */ -ROM_START( interact ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "interact.rom", 0x0000, 0x0800, CRC(1aa50444) SHA1(405806c97378abcf7c7b0d549430c78c7fc60ba2)) -ROM_END - -ROM_START( hector1 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hector1.rom", 0x0000, 0x1000, CRC(3be6628b) SHA1(1c106d6732bed743d8283d39e5b8248271f18c42)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP(1979, interact, 0, 0, interact, interact, driver_device, 0, "Interact", "Interact Family Computer", MACHINE_IMPERFECT_SOUND) -COMP(1983, hector1, interact, 0, hector1, interact, driver_device, 0, "Micronique", "Hector 1", MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/intv.c b/src/mess/drivers/intv.c deleted file mode 100644 index 023cd6fcc36..00000000000 --- a/src/mess/drivers/intv.c +++ /dev/null @@ -1,752 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,Frank Palazzolo -/************************************************************************ - * Mattel Intellivision + Keyboard Component Drivers - * - * Frank Palazzolo - * Kyle Davis - * - * TBD: - * Add tape support (intvkbd) - * Add runtime tape loading - * Fix memory system workaround - * (memory handler stuff in CP1610, debugger, and shared mem) - * STIC - * reenable dirty support - * Cleanup - * Separate stic & video better, get rid of *2 for kbd comp - * Add better runtime cart loading - * Switch to tilemap system - * Note from kevtris about IntelliVoice Hookup: - the intv uses a special chip - called the SPB640 - it is really cool and lame at the same time - it holds 64 10 bit words, which it simply serializes and sends to the SP0256 - the SP0256-012 just blindly jumps to 02000h or something when you try to play one of the samples - the SPB640 sits at 2000h and when it sees that address come up, it will send out the 640 bits to the '256 - this means you cannot use any gotos/gosubs in your speech data, but that is OK - it's just a single serial stream. the intv simply watches the buffer state and refills it periodically. there's enough buffer to keep it full for 1 frame - that's about it - the samples are stored in the game ROMs, and are easy to extract - -9502, 9503 and 9504 are the chips used in the intv1 (the sears one may use different chips) -9505 is used in some carts -9503 and 9506 are the chips used in the intv2 - -Known roms so far: -RO-3-9502-011 = 4KiB(2Kiw) self-decoding mask rom with decoder & bus, (DIP40 containing 1/2 of EXEC, maps at words 0000-0fff or 1000-1fff [unclear which, guess is 0000], i/o maps at ?), located at U5 on intv1 -RO-3-9503-003 = 2KiB(1Kiw) self-decoding mask rom with decoder & bus, (DIP40 containing GROM, maps at words 0x3000-0x37FF, i/o maps at ?), located at U21 in intv1, U5 in intv2 -RO-3-9504-021 = 4KiB(2Kiw) self-decoding mask rom without decoder or bus, (DIP28 containing 1/2 of EXEC, maps at words 0000-0fff or 1000-1fff [unclear which, guess is 1000]), located at U6 in intv1 -RO-3-9506-010 = 8KiB(4Kiw)+512B(256W) self-decoding mask rom with decoder & bus, (DIP40 containing EXEC2, maps at words 0000-1fff and 0400-04FF, i/o maps at ?) located at U6 in intv2 - -rom types (suspected, not proven yet): -RO-3-9502 = 4KiB (2Kiw) self decoding address mask rom with external address decoder & bus (DIP40) -RO-3-9503 = 2KiB (1Kiw) self decoding address mask rom with external address decoder & bus (DIP40) -RO-3-9504 = 4KiB (2Kiw) self decoding address mask rom without external address decoder or bus (DIP28) -RO-3-9505 = 8KiB (4Kiw) self decoding address mask rom without external address decoder or bus (DIP28) -RO-3-9506 = 8KiB (4Kiw) self decoding address mask rom with external address decoder & bus (DIP40) - - * - ************************************************************************/ - - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "cpu/cp1610/cp1610.h" -#include "includes/intv.h" -#include "sound/ay8910.h" - -#ifndef VERBOSE -#ifdef MAME_DEBUG -#define VERBOSE 1 -#else -#define VERBOSE 0 -#endif -#endif - -static const unsigned char intv_colors[] = -{ - 0x00, 0x00, 0x00, /* BLACK */ - 0x00, 0x2D, 0xFF, /* BLUE */ - 0xFF, 0x3D, 0x10, /* RED */ - 0xC9, 0xCF, 0xAB, /* TAN */ - 0x38, 0x6B, 0x3F, /* DARK GREEN */ - 0x00, 0xA7, 0x56, /* GREEN */ - 0xFA, 0xEA, 0x50, /* YELLOW */ - 0xFF, 0xFC, 0xFF, /* WHITE */ - 0xBD, 0xAC, 0xC8, /* GRAY */ - 0x24, 0xB8, 0xFF, /* CYAN */ - 0xFF, 0xB4, 0x1F, /* ORANGE */ - 0x54, 0x6E, 0x00, /* BROWN */ - 0xFF, 0x4E, 0x57, /* PINK */ - 0xA4, 0x96, 0xFF, /* LIGHT BLUE */ - 0x75, 0xCC, 0x80, /* YELLOW GREEN */ - 0xB5, 0x1A, 0x58 /* PURPLE */ -}; - -PALETTE_INIT_MEMBER(intv_state, intv) -{ - int k = 0; - UINT8 r, g, b; - /* Two copies of everything (why?) */ - - for (int i = 0; i < 16; i++) - { - r = intv_colors[i * 3 + 0]; - g = intv_colors[i * 3 + 1]; - b = intv_colors[i * 3 + 2]; - palette.set_indirect_color(i, rgb_t(r, g, b)); - palette.set_indirect_color(i + 16, rgb_t(r, g, b)); - } - - for (int i = 0; i < 16; i++) - { - for (int j = 0; j < 16; j++) - { - palette.set_pen_indirect(k++, i); - palette.set_pen_indirect(k++, j); - } - } - - for (int i = 0; i < 16; i++) - { - for (int j = 16; j < 32; j++) - { - palette.set_pen_indirect(k++, i); - palette.set_pen_indirect(k++, j); - } - } -} - -/* graphics output */ - -static const gfx_layout intvkbd_charlayout = -{ - 8, 8, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 -}; - -static GFXDECODE_START( intvkbd ) - GFXDECODE_ENTRY( "gfx1", 0x0000, intvkbd_charlayout, 0, 256 ) -GFXDECODE_END - -static INPUT_PORTS_START( intv ) - - /* Left Player Controller */ - PORT_START("KEYPAD1") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/Clear") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Left/Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left/Upper") PORT_PLAYER(1) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Left/Lower-Left") PORT_PLAYER(1) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Left/Lower-Right") PORT_PLAYER(1) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("DISC1") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Left/Up") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Right-Up-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Left/Right") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Right-Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Down-Right") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Left/Down") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Left-Down-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Left/Left") PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Left-Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left/Up-Up-Left") PORT_CONDITION("OPTIONS",0x01,EQUALS,0x00) - - PORT_START("DISCX1") - PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("Left/X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x01) - - PORT_START("DISCY1") - PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("Left/Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_PLAYER(1) PORT_CONDITION("OPTIONS",0x01,EQUALS,0x01) - - /* Right Player Controller */ - PORT_START("KEYPAD2") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/1") - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/2") - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/3") - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/4") - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/5") - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/6") - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/7") - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/8") - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/9") - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/Clear") - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/0") - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Right/Enter") - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Right/Upper") PORT_PLAYER(2) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right/Lower-Left") PORT_PLAYER(2) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Right/Lower-Right") PORT_PLAYER(2) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("DISC2") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Right/Up") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Right-Up-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Right/Right") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Right-Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Down-Right") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Right/Down") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Left-Down-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Right/Left") PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Left-Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right/Up-Up-Left") PORT_CONDITION("OPTIONS",0x02,EQUALS,0x00) - - PORT_START("DISCX2") - PORT_BIT( 0xff, 0x50, IPT_AD_STICK_X ) PORT_NAME("Right/X") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x02) - - PORT_START("DISCY2") - PORT_BIT( 0xff, 0x50, IPT_AD_STICK_Y ) PORT_NAME("Right/Y") PORT_MINMAX(0x00,0x9f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x50) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F) PORT_PLAYER(2) PORT_CONDITION("OPTIONS",0x02,EQUALS,0x02) - - PORT_START("OPTIONS") - PORT_CONFNAME( 0x01, 0x00, "Left Disc" ) - PORT_CONFSETTING( 0x00, "Digital" ) - PORT_CONFSETTING( 0x01, "Analog" ) - PORT_CONFNAME( 0x02, 0x00, "Right Disc" ) - PORT_CONFSETTING( 0x00, "Digital" ) - PORT_CONFSETTING( 0x02, "Analog" ) -INPUT_PORTS_END - - -/* - Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 - - Row 0 NC NC NC NC NC NC CTRL SHIFT - Row 1 NC NC NC NC NC NC RPT LOCK - Row 2 NC / , N V X NC SPC - Row 3 (right) . M B C Z NC CLS - Row 4 (down) ; K H F S NC TAB - Row 5 ] P I Y R W NC Q - Row 6 (up) - 9 7 5 3 NC 1 - Row 7 = 0 8 6 4 2 NC [ - Row 8 (return)(left) O U T E NC ESC - Row 9 DEL ' L J G D NC A - -2008-05 FP: -The keyboard layout is quite strange, with '[' and ']' at the two ends of the 1st row, -'Esc' in the 2nd row (between 'Tab' and 'Q'), and with Cursor keys and 'Enter' where -you would expect the braces. Moreover, Shift + Cursor keys produce characters. -The emulated layout moves 'Esc', '[' and ']' to their usual position. - -Moreover, a small note on natural keyboard support: currently -- "Clear Screen" is mapped to 'Left Alt' -- "Repeat" is mapped to 'F1' -- "Lock" is mapped to 'F2' -*/ - -static INPUT_PORTS_START( intvkbd ) - PORT_START("ROW0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("ROW1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("ROW2") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("ROW3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('>') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clear Screen") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - - PORT_START("ROW4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('\\') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - - PORT_START("ROW5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - - PORT_START("ROW6") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('|') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_CHAR('-') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("ROW7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('O') PORT_CHAR(')') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\xA2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') // this one would be 1st row, 1st key (at 'Esc' position) - - PORT_START("ROW8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // this one would be 2nd row, 2nd key (between 'Tab' and 'Q') - - PORT_START("ROW9") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - - PORT_START("TEST") /* For tape drive testing... */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) - - /* 2008-05 FP: I include here the controller inputs to make happy the read_handler. - Please remove this (and re-tag accordingly the inputs above) if intv_right_control_r - is supposed to scan the keyboard inputs when the Keyboard Component is connected */ - PORT_INCLUDE( intv ) -INPUT_PORTS_END - -static ADDRESS_MAP_START( intv_mem, AS_PROGRAM, 16, intv_state ) - AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) - AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) - AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) - AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) - AM_RANGE(0x0400, 0x04ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom04) - AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000 << 1) // Exec ROM, 10-bits wide - AM_RANGE(0x2000, 0x2fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom20) - AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) // GROM, 8-bits wide - AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM, 8-bits wide - AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM Alias, 8-bits wide - AM_RANGE(0x4000, 0x47ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom40) - AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom48) - AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom50) - AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom60) - AM_RANGE(0x7000, 0x7fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom70) - AM_RANGE(0x8000, 0x8fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom80) - AM_RANGE(0x9000, 0x9fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom90) - AM_RANGE(0xa000, 0xafff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_roma0) - AM_RANGE(0xb000, 0xbfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romb0) - AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romc0) - AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romd0) - AM_RANGE(0xe000, 0xefff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rome0) - AM_RANGE(0xf000, 0xffff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romf0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( intvoice_mem, AS_PROGRAM, 16, intv_state ) - AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) - AM_RANGE(0x0080, 0x0081) AM_DEVREADWRITE("voice", intv_voice_device, read_speech, write_speech) // Intellivoice - AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) - AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) - AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) - AM_RANGE(0x0400, 0x04ff) AM_DEVREAD("voice", intv_voice_device, read_rom04) - AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000 << 1) // Exec ROM, 10-bits wide - AM_RANGE(0x2000, 0x2fff) AM_DEVREAD("voice", intv_voice_device, read_rom20) - AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) // GROM, 8-bits wide - AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM, 8-bits wide - AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM Alias, 8-bits wide - AM_RANGE(0x4000, 0x47ff) AM_DEVREAD("voice", intv_voice_device, read_rom40) - AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("voice", intv_voice_device, read_rom48) - AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("voice", intv_voice_device, read_rom50) - AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("voice", intv_voice_device, read_rom60) - AM_RANGE(0x7000, 0x7fff) AM_DEVREAD("voice", intv_voice_device, read_rom70) - AM_RANGE(0x8000, 0x8fff) AM_DEVREAD("voice", intv_voice_device, read_rom80) - AM_RANGE(0x9000, 0x9fff) AM_DEVREAD("voice", intv_voice_device, read_rom90) - AM_RANGE(0xa000, 0xafff) AM_DEVREAD("voice", intv_voice_device, read_roma0) - AM_RANGE(0xb000, 0xbfff) AM_DEVREAD("voice", intv_voice_device, read_romb0) - AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("voice", intv_voice_device, read_romc0) - AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("voice", intv_voice_device, read_romd0) - AM_RANGE(0xe000, 0xefff) AM_DEVREAD("voice", intv_voice_device, read_rome0) - AM_RANGE(0xf000, 0xffff) AM_DEVREAD("voice", intv_voice_device, read_romf0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( intv2_mem , AS_PROGRAM, 16, intv_state ) - AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) - AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) - AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) - AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) - AM_RANGE(0x0400, 0x04ff) AM_ROM AM_REGION("maincpu", 0x400 << 1) // Exec ROM, 10-bits wide - AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000 << 1) // Exec ROM, 10-bits wide - AM_RANGE(0x2000, 0x2fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom20) - AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) // GROM, 8-bits wide - AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM, 8-bits wide - AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) // GRAM Alias, 8-bits wide - AM_RANGE(0x4000, 0x47ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom40) - AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom48) - AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom50) - AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom60) - AM_RANGE(0x7000, 0x7fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom70) - AM_RANGE(0x8000, 0x8fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom80) - AM_RANGE(0x9000, 0x9fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom90) - AM_RANGE(0xa000, 0xafff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_roma0) - AM_RANGE(0xb000, 0xbfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romb0) - AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romc0) - AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romd0) - AM_RANGE(0xe000, 0xefff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rome0) - AM_RANGE(0xf000, 0xffff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romf0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( intvecs_mem , AS_PROGRAM, 16, intv_state ) - AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) - AM_RANGE(0x0080, 0x0081) AM_DEVREADWRITE("speech", sp0256_device, spb640_r, spb640_w) /* Intellivoice */ - // AM_RANGE(0x00E0, 0x00E3) AM_READWRITE( intv_ecs_uart_r, intv_ecs_uart_w ) - AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_ay, write_ay) /* ecs psg */ - AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) - AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) - AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) - AM_RANGE(0x0400, 0x04ff) AM_DEVREAD("ecs", intv_ecs_device, read_rom04) - AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000<<1) /* Exec ROM, 10-bits wide */ - AM_RANGE(0x2000, 0x2fff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_rom20, write_rom20) - AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) /* GROM, 8-bits wide */ - AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) /* GRAM, 8-bits wide */ - AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) /* GRAM Alias, 8-bits wide */ - AM_RANGE(0x4000, 0x47ff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_ram, write_ram) - AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom48) - AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom50) - AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom60) - AM_RANGE(0x7000, 0x7fff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_rom70, write_rom70) - AM_RANGE(0x8000, 0x8fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom80) - AM_RANGE(0x9000, 0x9fff) AM_DEVREAD("ecs", intv_ecs_device, read_rom90) - AM_RANGE(0xa000, 0xafff) AM_DEVREAD("ecs", intv_ecs_device, read_roma0) - AM_RANGE(0xb000, 0xbfff) AM_DEVREAD("ecs", intv_ecs_device, read_romb0) - AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("ecs", intv_ecs_device, read_romc0) - AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("ecs", intv_ecs_device, read_romd0) - AM_RANGE(0xe000, 0xefff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_rome0, write_rome0) - AM_RANGE(0xf000, 0xffff) AM_DEVREADWRITE("ecs", intv_ecs_device, read_romf0, write_romf0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( intvkbd_mem , AS_PROGRAM, 16, intv_state ) - AM_RANGE(0x0000, 0x003f) AM_READWRITE(intv_stic_r, intv_stic_w) - AM_RANGE(0x0100, 0x01ef) AM_READWRITE(intv_ram8_r, intv_ram8_w) - AM_RANGE(0x01f0, 0x01ff) AM_DEVREADWRITE8("ay8914", ay8914_device, read, write, 0x00ff) - AM_RANGE(0x0200, 0x035f) AM_READWRITE(intv_ram16_r, intv_ram16_w) - AM_RANGE(0x0400, 0x04ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom04) - AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0x1000<<1) /* Exec ROM, 10-bits wide */ - AM_RANGE(0x2000, 0x2fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom20) - AM_RANGE(0x3000, 0x37ff) AM_DEVREAD("stic", stic_device, grom_read) /* GROM, 8-bits wide */ - AM_RANGE(0x3800, 0x39ff) AM_READWRITE(intv_gram_r, intv_gram_w) /* GRAM, 8-bits wide */ - AM_RANGE(0x3a00, 0x3bff) AM_READWRITE(intv_gram_r, intv_gram_w) /* GRAM Alias, 8-bits wide */ - AM_RANGE(0x4000, 0x47ff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom40) - AM_RANGE(0x4800, 0x4fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom48) - AM_RANGE(0x5000, 0x5fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom50) - AM_RANGE(0x6000, 0x6fff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rom60) - AM_RANGE(0x7000, 0x7fff) AM_ROM AM_REGION("maincpu", 0x7000<<1) /* Keyboard ROM */ - AM_RANGE(0x8000, 0xbfff) AM_RAM_WRITE(intvkbd_dualport16_w) AM_SHARE("dualport_ram") /* Dual-port RAM */ - AM_RANGE(0xc000, 0xcfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romc0) - AM_RANGE(0xd000, 0xdfff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romd0) - AM_RANGE(0xe000, 0xefff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_rome0) - AM_RANGE(0xf000, 0xffff) AM_DEVREAD("cartslot", intv_cart_slot_device, read_romf0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( intvkbd2_mem , AS_PROGRAM, 8, intv_state ) - ADDRESS_MAP_UNMAP_HIGH /* Required because of probing */ - AM_RANGE(0x0000, 0x3fff) AM_READWRITE(intvkbd_dualport8_lsb_r, intvkbd_dualport8_lsb_w) /* Dual-port RAM */ - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(intvkbd_dualport8_msb_r, intvkbd_dualport8_msb_w) /* Dual-port RAM */ - AM_RANGE(0xb7f8, 0xb7ff) AM_RAM /* ??? */ - AM_RANGE(0xb800, 0xbfff) AM_RAM AM_SHARE("videoram") /* Text Display */ - AM_RANGE(0xc000, 0xdfff) AM_ROM - AM_RANGE(0xe000, 0xffff) AM_READ(intvkb_iocart_r) -ADDRESS_MAP_END - -void intv_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_INTV_INTERRUPT2_COMPLETE: - intv_interrupt2_complete(ptr, param); - break; - case TIMER_INTV_INTERRUPT_COMPLETE: - intv_interrupt_complete(ptr, param); - break; - case TIMER_INTV_BTB_FILL: - intv_btb_fill(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in intv_state::device_timer"); - } -} - - -/* This is needed because MAME core does not allow PULSE_LINE. - The time interval is not critical, although it should be below 1000. */ - -TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt2_complete) -{ - m_keyboard->set_input_line(0, CLEAR_LINE); -} - -INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt2) -{ - m_keyboard->set_input_line(0, ASSERT_LINE); - timer_set(m_keyboard->cycles_to_attotime(100), TIMER_INTV_INTERRUPT2_COMPLETE); -} - - -static MACHINE_CONFIG_START( intv, intv_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", CP1610, XTAL_3_579545MHz/4) /* Colorburst/4 */ - MCFG_CPU_PROGRAM_MAP(intv_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", intv_state, intv_interrupt) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_STIC_ADD("stic") - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.92) - //MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2400)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(intv_state, screen_update_intv) - MCFG_SCREEN_SIZE((STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTV_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTV_Y_SCALE) - MCFG_SCREEN_VISIBLE_AREA(0, (STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTV_X_SCALE-1, 0, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTV_Y_SCALE-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 0x400) - MCFG_PALETTE_INDIRECT_ENTRIES(32) - MCFG_PALETTE_INIT_OWNER(intv_state, intv) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8914", AY8914, XTAL_3_579545MHz/2) - MCFG_AY8910_PORT_A_READ_CB(READ8(intv_state, intv_right_control_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(intv_state, intv_left_control_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33) - - /* cartridge */ - MCFG_INTV_CARTRIDGE_ADD("cartslot", intv_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "intv") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ecs_list", "intvecs") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( intv2, intv ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(intv2_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( intvoice, intv ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(intvoice_mem) - - MCFG_DEVICE_REMOVE("cartslot") - MCFG_DEVICE_ADD("voice", INTV_ROM_VOICE, 0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( intvecs, intv ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(intvecs_mem) - - MCFG_DEVICE_REMOVE("cartslot") - MCFG_DEVICE_ADD("ecs", INTV_ROM_ECS, 0) - - MCFG_SOUND_ADD("speech", SP0256, 3120000) - /* The Intellivoice uses a speaker with its own volume control so the relative volumes to use are subjective */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* cassette */ - //MCFG_CASSETTE_ADD( "cassette" ) - - /* software lists */ - MCFG_DEVICE_REMOVE("cart_list") - MCFG_DEVICE_REMOVE("ecs_list") - MCFG_SOFTWARE_LIST_ADD("cart_list", "intvecs") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("intv_list", "intv") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( intvkbd, intv ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(intvkbd_mem) - - MCFG_CPU_ADD("keyboard", M6502, XTAL_3_579545MHz/2) /* Colorburst/2 */ - MCFG_CPU_PROGRAM_MAP(intvkbd2_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", intv_state, intv_interrupt2) - - MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - - /* video hardware */ - MCFG_GFXDECODE_ADD("gfxdecode", "palette", intvkbd) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(intv_state, intv) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE((STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTVKBD_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTVKBD_Y_SCALE) - MCFG_SCREEN_VISIBLE_AREA(0, (STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTVKBD_X_SCALE-1, 0, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTVKBD_Y_SCALE-1) - MCFG_SCREEN_UPDATE_DRIVER(intv_state, screen_update_intvkbd) - - /* I/O cartslots for BASIC */ - MCFG_GENERIC_CARTSLOT_ADD("ioslot1", generic_plain_slot, "intbasic_cart") - MCFG_GENERIC_CARTSLOT_ADD("ioslot2", generic_plain_slot, "intbasic_cart") -MACHINE_CONFIG_END - -ROM_START(intv) // the intv1 exec rom should be two roms: RO-3-9502-011.U5 and RO-3-9504-021.U6 - ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD16_WORD( "exec.bin", (0x1000<<1)+0, 0x2000, CRC(cbce86f7) SHA1(5a65b922b562cb1f57dab51b73151283f0e20c7a)) -ROM_END - -#define rom_intvoice rom_intv - -// the later intellivision 2's exec rom is a single ro-3-9506-010 at location ic6 holding 8k plus 512 bytes; the 1st 512 bytes are at 0x400 and the 8k at 0x1000 -ROM_START(intv2) - ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD16_WORD_SWAP( "ro-3-9506-010.ic6", (0x400<<1)+0, 0x200, CRC(dd7e1237) SHA1(fb821a643b7714ed4c812553cd3f668766fd44ab)) - ROM_CONTINUE( (0x1000<<1)+0, 0x2000 ) -ROM_END - -ROM_START(intvsrs) // the intv1 sears exec rom should be two roms: RO-3-9502-???.U5 and RO-3-9504-???.U6 but the correct names are unknown as of yet - ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD16_WORD( "searsexc.bin", (0x1000<<1)+0, 0x2000, CRC(ea552a22) SHA1(834339de056d42a35571cae7fd5b04d1344001e9)) -ROM_END - -ROM_START(intvecs) // the intv1 exec rom should be two roms: RO-3-9502-011.U5 and RO-3-9504-021.U6 - ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD16_WORD( "exec.bin", (0x1000<<1)+0, 0x2000, CRC(cbce86f7) SHA1(5a65b922b562cb1f57dab51b73151283f0e20c7a)) - - ROM_REGION( 0x10000<<1, "speech", 0 ) - /* SP0256-012 Speech chip w/2KiB mask rom */ - ROM_LOAD( "sp0256-012.bin", 0x1000, 0x0800, CRC(0de7579d) SHA1(618563e512ff5665183664f52270fa9606c9d289) ) -ROM_END - -/* -Intellivision Keyboard Component - Prototype -------------------------------------------------------------- - -GI 9333B-0104 0104.U20 4Kx8 Mask ROM, 6502 code -Intel 2732 "CPU 2D" CPU2D.U21 4Kx8 EPROM, 6502 code - -TI 8S030N 1149-0360 0360.U58 32x8 Timing prom? -TI 8S030N 1149-0370 0370.U74 32x8 Timing prom? - -GI RO-3-9502-024 024.U60 2Kx10 Mask ROM+Addr Decoder, CP1600 code -GI 9316B-4D72 4D72.U62 2Kx8 Mask ROM, CP1600 code (upper) -GI 9316B-4D71 4D71.U63 2Kx8 Mask ROM, CP1600 code (lower) -GI 9316B-4C52 4C52.U34 2Kx8 Mask ROM, Alphanumerics - -Main board also includes: - - 2 2114 DRAMS 1Kx4 Character memory - 10 MM5290J DRAMS 16Kx10 CP1600 memory? - 1 6502 - 1 Mystery 40-pin chip (under heat sink) - (actually a SMC CRT5027 aka TI TMS9927 CRT controller) -*/ - -ROM_START(intvkbd) // the intv1 exec rom should be two roms: RO-3-9502-011.U5 and RO-3-9504-021.U6 - ROM_REGION(0x10000<<1,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD16_WORD( "exec.bin", 0x1000<<1, 0x2000, CRC(cbce86f7) SHA1(5a65b922b562cb1f57dab51b73151283f0e20c7a)) - ROM_LOAD16_WORD( "024.u60", 0x7000<<1, 0x1000, CRC(4f7998ec) SHA1(ec006d0ae9002e9d56d83a71f5f2eddd6a456a40)) - ROM_LOAD16_BYTE( "4d72.u62", 0x7800<<1, 0x0800, CRC(aa57c594) SHA1(741860d489d90f5882ca53daa3169b6abacdf130)) - ROM_LOAD16_BYTE( "4d71.u63", (0x7800<<1)+1, 0x0800, CRC(069b2f0b) SHA1(070850bb32f8474107cc52c5183cfaa32d640f9a)) - - ROM_REGION(0x10000,"keyboard",0) - ROM_LOAD( "0104.u20", 0xc000, 0x1000, CRC(5c6f1256) SHA1(271931fb354dfae6a1a5697ee888924a89a15ca8)) - ROM_RELOAD( 0xe000, 0x1000 ) - ROM_LOAD("cpu2d.u21", 0xd000, 0x1000, CRC(2c2dba33) SHA1(0db5d177fec3f8ae89abeef2e6900ad4f3460266)) - ROM_RELOAD( 0xf000, 0x1000 ) - - ROM_REGION(0x00800,"gfx1",0) - ROM_LOAD( "4c52.u34", 0x0000, 0x0800, CRC(cbeb2e96) SHA1(f0e17adcd278fb376c9f90833c7fbbb60193dbe3)) - - ROM_REGION(0x0100,"proms",0) - ROM_LOAD( "0360.u58", 0x00, 0x20, CRC(1295528a) SHA1(b35e598891f1185e02cbacb4811d2334357abd79)) - ROM_LOAD( "0370.u74", 0x20, 0x20, CRC(19da5096) SHA1(76af50e4fd29649fc4837120c245321a8fc84cd3)) -ROM_END - -DRIVER_INIT_MEMBER(intv_state,intv) -{ - m_stic->set_x_scale(INTV_X_SCALE); - m_stic->set_y_scale(INTV_Y_SCALE); - m_is_keybd = 0; -} - -DRIVER_INIT_MEMBER(intv_state,intvkbd) -{ - m_stic->set_x_scale(INTVKBD_X_SCALE); - m_stic->set_y_scale(INTVKBD_Y_SCALE); - m_is_keybd = 1; -} - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1979, intv, 0, 0, intv, intv, intv_state, intv, "Mattel", "Intellivision", MACHINE_SUPPORTS_SAVE ) -CONS( 1981, intvsrs, intv, 0, intv, intv, intv_state, intv, "Sears", "Super Video Arcade", MACHINE_SUPPORTS_SAVE ) -COMP( 1981, intvkbd, intv, 0, intvkbd, intvkbd, intv_state, intvkbd, "Mattel", "Intellivision Keyboard Component (Unreleased)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -CONS( 1982, intv2, intv, 0, intv2, intv, intv_state, intv, "Mattel", "Intellivision II", MACHINE_SUPPORTS_SAVE ) - -// made up, user friendlier machines with pre-mounted passthu expansions -COMP( 1982, intvoice, intv, 0, intvoice, intv, intv_state, intv, "Mattel", "Intellivision w/IntelliVoice expansion", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, intvecs, intv, 0, intvecs, intv, intv_state, intv, "Mattel", "Intellivision w/Entertainment Computer System + Intellivoice expansions", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/ip20.c b/src/mess/drivers/ip20.c deleted file mode 100644 index b03fb978c78..00000000000 --- a/src/mess/drivers/ip20.c +++ /dev/null @@ -1,632 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*********************************************************************\ -* -* SGI IP20 IRIS Indigo workstation -* -* Skeleton Driver -* -* Todo: Everything -* -* Note: Machine uses R4400, not R4600 -* -* Memory map: -* -* 1fa00000 - 1fa02047 Memory Controller -* 1fb80000 - 1fb9a7ff HPC1 CHIP0 -* 1fc00000 - 1fc7ffff BIOS -* -\*********************************************************************/ - -#include "emu.h" -#include "cpu/mips/mips3.h" -#include "machine/8530scc.h" -#include "machine/sgi.h" -#include "machine/eepromser.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsicd.h" -#include "machine/wd33c93.h" - -struct HPC_t -{ - UINT8 nMiscStatus; - UINT32 nParBufPtr; - UINT32 nLocalIOReg0Mask; - UINT32 nLocalIOReg1Mask; - UINT32 nVMEIntMask0; - UINT32 nVMEIntMask1; - UINT32 nSCSI0Descriptor; - UINT32 nSCSI0DMACtrl; -}; - -struct ip20_RTC_t -{ - UINT8 nRAM[32]; - UINT8 nTemp; -}; - -class ip20_state : public driver_device -{ -public: - enum - { - TIMER_RTC - }; - - ip20_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_wd33c93(*this, "wd33c93"), - m_scc(*this, "scc"), - m_eeprom(*this, "eeprom"), - m_maincpu(*this, "maincpu") - { - } - - HPC_t m_HPC; - ip20_RTC_t m_RTC; - DECLARE_READ32_MEMBER(hpc_r); - DECLARE_WRITE32_MEMBER(hpc_w); - DECLARE_READ32_MEMBER(int_r); - DECLARE_WRITE32_MEMBER(int_w); - DECLARE_WRITE_LINE_MEMBER(scsi_irq); - DECLARE_DRIVER_INIT(ip204415); - virtual void machine_start(); - virtual void video_start(); - UINT32 screen_update_ip204415(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(ip20_timer_rtc); - required_device m_wd33c93; - required_device m_scc; - required_device m_eeprom; - inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... ); - required_device m_maincpu; - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -#define VERBOSE_LEVEL ( 2 ) - -inline void ATTR_PRINTF(3,4) ip20_state::verboselog(int n_level, const char *s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%08x: %s", m_maincpu->pc(), buf ); - } -} - -void ip20_state::video_start() -{ -} - -UINT32 ip20_state::screen_update_ip204415(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - - -#define RTC_DAYOFWEEK m_RTC.nRAM[0x0e] -#define RTC_YEAR m_RTC.nRAM[0x0b] -#define RTC_MONTH m_RTC.nRAM[0x0a] -#define RTC_DAY m_RTC.nRAM[0x09] -#define RTC_HOUR m_RTC.nRAM[0x08] -#define RTC_MINUTE m_RTC.nRAM[0x07] -#define RTC_SECOND m_RTC.nRAM[0x06] -#define RTC_HUNDREDTH m_RTC.nRAM[0x05] - -READ32_MEMBER(ip20_state::hpc_r) -{ - offset <<= 2; - if( offset >= 0x0e00 && offset <= 0x0e7c ) - { - verboselog(2, "RTC RAM[0x%02x] Read: %02x\n", ( offset - 0xe00 ) >> 2, m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ] ); - return m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ]; - } - switch( offset ) - { - case 0x05c: - verboselog(2, "HPC Unknown Read: %08x (%08x) (returning 0x000000a5 as kludge)\n", 0x1fb80000 + offset, mem_mask ); - return 0x0000a500; - case 0x00ac: - verboselog(2, "HPC Parallel Buffer Pointer Read: %08x (%08x)\n", m_HPC.nParBufPtr, mem_mask ); - return m_HPC.nParBufPtr; - case 0x00c0: - verboselog(2, "HPC Endianness Read: %08x (%08x)\n", 0x0000001f, mem_mask ); - return 0x0000001f; - case 0x0120: - if (ACCESSING_BITS_8_15) - { - return ( m_wd33c93->read( space, 0 ) << 8 ); - } - else - { - return 0; - } - case 0x0124: - if (ACCESSING_BITS_8_15) - { - return ( m_wd33c93->read( space, 1 ) << 8 ); - } - else - { - return 0; - } - case 0x01b0: - verboselog(2, "HPC Misc. Status Read: %08x (%08x)\n", m_HPC.nMiscStatus, mem_mask ); - return m_HPC.nMiscStatus; - case 0x01bc: -// verboselog(machine, 2, "HPC CPU Serial EEPROM Read\n" ); - return m_eeprom->do_read() << 4; - case 0x01c4: - verboselog(2, "HPC Local IO Register 0 Mask Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask ); - return m_HPC.nLocalIOReg0Mask; - case 0x01cc: - verboselog(2, "HPC Local IO Register 1 Mask Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask ); - return m_HPC.nLocalIOReg1Mask; - case 0x01d4: - verboselog(2, "HPC VME Interrupt Mask 0 Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask ); - return m_HPC.nVMEIntMask0; - case 0x01d8: - verboselog(2, "HPC VME Interrupt Mask 1 Read: %08x (%08x)\n", m_HPC.nLocalIOReg0Mask, mem_mask ); - return m_HPC.nVMEIntMask1; - case 0x0d00: - verboselog(2, "HPC DUART0 Channel B Control Read\n" ); -// return 0x00000004; - return 0x7c; //m_scc->reg_r(space, 0); - case 0x0d04: - verboselog(2, "HPC DUART0 Channel B Data Read\n" ); -// return 0; - return m_scc->reg_r(space, 2); - case 0x0d08: - verboselog(2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask ); -// return 0x40; - return 0x7c; //m_scc->reg_r(space, 1); - case 0x0d0c: - verboselog(2, "HPC DUART0 Channel A Data Read\n" ); -// return 0; - return m_scc->reg_r(space, 3); - case 0x0d10: -// verboselog(machine, 2, "HPC DUART1 Channel B Control Read\n" ); - return 0x00000004; - case 0x0d14: - verboselog(2, "HPC DUART1 Channel B Data Read\n" ); - return 0; - case 0x0d18: - verboselog(2, "HPC DUART1 Channel A Control Read\n" ); - return 0; - case 0x0d1c: - verboselog(2, "HPC DUART1 Channel A Data Read\n" ); - return 0; - case 0x0d20: - verboselog(2, "HPC DUART2 Channel B Control Read\n" ); - return 0x00000004; - case 0x0d24: - verboselog(2, "HPC DUART2 Channel B Data Read\n" ); - return 0; - case 0x0d28: - verboselog(2, "HPC DUART2 Channel A Control Read\n" ); - return 0; - case 0x0d2c: - verboselog(2, "HPC DUART2 Channel A Data Read\n" ); - return 0; - case 0x0d30: - verboselog(2, "HPC DUART3 Channel B Control Read\n" ); - return 0x00000004; - case 0x0d34: - verboselog(2, "HPC DUART3 Channel B Data Read\n" ); - return 0; - case 0x0d38: - verboselog(2, "HPC DUART3 Channel A Control Read\n" ); - return 0; - case 0x0d3c: - verboselog(2, "HPC DUART3 Channel A Data Read\n" ); - return 0; - } - verboselog(0, "Unmapped HPC read: 0x%08x (%08x)\n", 0x1fb80000 + offset, mem_mask ); - return 0; -} - -WRITE32_MEMBER(ip20_state::hpc_w) -{ - offset <<= 2; - if( offset >= 0x0e00 && offset <= 0x0e7c ) - { - verboselog(2, "RTC RAM[0x%02x] Write: %02x\n", ( offset - 0xe00 ) >> 2, data & 0x000000ff ); - m_RTC.nRAM[ ( offset - 0xe00 ) >> 2 ] = data & 0x000000ff; - switch( ( offset - 0xe00 ) >> 2 ) - { - case 0: - break; - case 4: - if( !( m_RTC.nRAM[0x00] & 0x80 ) ) - { - if( data & 0x80 ) - { - m_RTC.nRAM[0x19] = m_RTC.nRAM[0x06]; //RTC_SECOND; - m_RTC.nRAM[0x1a] = m_RTC.nRAM[0x07]; //RTC_MINUTE; - m_RTC.nRAM[0x1b] = m_RTC.nRAM[0x08]; //RTC_HOUR; - m_RTC.nRAM[0x1c] = m_RTC.nRAM[0x09]; //RTC_DAY; - m_RTC.nRAM[0x1d] = m_RTC.nRAM[0x0a]; //RTC_MONTH; - } - } - break; - } - return; - } - switch( offset ) - { - case 0x0090: // SCSI0 next descriptor pointer - m_HPC.nSCSI0Descriptor = data; - break; - - case 0x0094: // SCSI0 control flags - m_HPC.nSCSI0DMACtrl = data; - #if 0 - if (data & 0x80) - { - UINT32 next; - - osd_printf_info("DMA activated for SCSI0\n"); - osd_printf_info("Descriptor block:\n"); - osd_printf_info("CTL: %08x BUFPTR: %08x DESCPTR %08x\n", - program_read_dword(m_HPC.nSCSI0Descriptor), program_read_dword(m_HPC.nSCSI0Descriptor+4), - program_read_dword(m_HPC.nSCSI0Descriptor+8)); - - next = program_read_dword(m_HPC.nSCSI0Descriptor+8); - osd_printf_info("CTL: %08x BUFPTR: %08x DESCPTR %08x\n", - program_read_dword(next), program_read_dword(next+4), - program_read_dword(next+8)); - } - #endif - break; - - case 0x00ac: - verboselog(2, "HPC Parallel Buffer Pointer Write: %08x (%08x)\n", data, mem_mask ); - m_HPC.nParBufPtr = data; - break; - case 0x0120: - if (ACCESSING_BITS_8_15) - { - verboselog(2, "HPC SCSI Controller Register Write: %08x\n", ( data >> 8 ) & 0x000000ff ); - m_wd33c93->write( space, 0, ( data >> 8 ) & 0x000000ff ); - } - else - { - return; - } - break; - case 0x0124: - if (ACCESSING_BITS_8_15) - { - verboselog(2, "HPC SCSI Controller Data Write: %08x\n", ( data >> 8 ) & 0x000000ff ); - m_wd33c93->write( space, 1, ( data >> 8 ) & 0x000000ff ); - } - else - { - return; - } - break; - case 0x01b0: - verboselog(2, "HPC Misc. Status Write: %08x (%08x)\n", data, mem_mask ); - if( data & 0x00000001 ) - { - verboselog(2, " Force DSP hard reset\n" ); - } - if( data & 0x00000002 ) - { - verboselog(2, " Force IRQA\n" ); - } - if( data & 0x00000004 ) - { - verboselog(2, " Set IRQA polarity high\n" ); - } - else - { - verboselog(2, " Set IRQA polarity low\n" ); - } - if( data & 0x00000008 ) - { - verboselog(2, " SRAM size: 32K\n" ); - } - else - { - verboselog(2, " SRAM size: 8K\n" ); - } - m_HPC.nMiscStatus = data; - break; - case 0x01bc: -// verboselog(machine, 2, "HPC CPU Serial EEPROM Write: %08x (%08x)\n", data, mem_mask ); - if( data & 0x00000001 ) - { - verboselog(2, " CPU board LED on\n" ); - } - m_eeprom->di_write((data & 0x00000008) ? 1 : 0 ); - m_eeprom->cs_write((data & 0x00000002) ? CLEAR_LINE : ASSERT_LINE ); - m_eeprom->clk_write((data & 0x00000004) ? CLEAR_LINE : ASSERT_LINE ); - break; - case 0x01c4: - verboselog(2, "HPC Local IO Register 0 Mask Write: %08x (%08x)\n", data, mem_mask ); - m_HPC.nLocalIOReg0Mask = data; - break; - case 0x01cc: - verboselog(2, "HPC Local IO Register 1 Mask Write: %08x (%08x)\n", data, mem_mask ); - m_HPC.nLocalIOReg1Mask = data; - break; - case 0x01d4: - verboselog(2, "HPC VME Interrupt Mask 0 Write: %08x (%08x)\n", data, mem_mask ); - m_HPC.nVMEIntMask0 = data; - break; - case 0x01d8: - verboselog(2, "HPC VME Interrupt Mask 1 Write: %08x (%08x)\n", data, mem_mask ); - m_HPC.nVMEIntMask1 = data; - break; - case 0x0d00: - verboselog(2, "HPC DUART0 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); - m_scc->reg_w(space, 0, data); - break; - case 0x0d04: - verboselog(2, "HPC DUART0 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); - m_scc->reg_w(space, 2, data); - break; - case 0x0d08: - verboselog(2, "HPC DUART0 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); - m_scc->reg_w(space, 1, data); - break; - case 0x0d0c: - verboselog(2, "HPC DUART0 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); - m_scc->reg_w(space, 3, data); - break; - case 0x0d10: - if( ( data & 0x000000ff ) >= 0x00000020 ) - { -// verboselog(2, "HPC DUART1 Channel B Control Write: %08x (%08x) %c\n", data, mem_mask, data & 0x000000ff ); - //osd_printf_info( "%c", data & 0x000000ff ); - } - else - { -// verboselog(2, "HPC DUART1 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); - } - break; - case 0x0d14: - if( ( data & 0x000000ff ) >= 0x00000020 || ( data & 0x000000ff ) == 0x0d || ( data & 0x000000ff ) == 0x0a ) - { - verboselog(2, "HPC DUART1 Channel B Data Write: %08x (%08x) %c\n", data, mem_mask, data & 0x000000ff ); - osd_printf_info( "%c", data & 0x000000ff ); - } - else - { - verboselog(2, "HPC DUART1 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); - } - break; - case 0x0d18: - osd_printf_info("HPC DUART1 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d1c: - verboselog(2, "HPC DUART1 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d20: - osd_printf_info("HPC DUART2 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d24: - verboselog(2, "HPC DUART2 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d28: - osd_printf_info("HPC DUART2 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d2c: - verboselog(2, "HPC DUART2 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d30: - osd_printf_info("HPC DUART3 Channel B Control Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d34: - verboselog(2, "HPC DUART3 Channel B Data Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d38: - osd_printf_info("HPC DUART3 Channel A Control Write: %08x (%08x)\n", data, mem_mask ); - break; - case 0x0d3c: - verboselog(2, "HPC DUART3 Channel A Data Write: %08x (%08x)\n", data, mem_mask ); - break; - default: - osd_printf_info("Unmapped HPC write: 0x%08x (%08x): %08x\n", 0x1fb80000 + offset, mem_mask, data); - break; - } -} - -// INT/INT2/INT3 interrupt controllers -READ32_MEMBER(ip20_state::int_r) -{ - osd_printf_info("INT: read @ ofs %x (mask %x) (PC=%x)\n", offset, mem_mask, space.device().safe_pc()); - return 0; -} - -WRITE32_MEMBER(ip20_state::int_w) -{ - osd_printf_info("INT: write %x to ofs %x (mask %x) (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); -} - -static ADDRESS_MAP_START( ip204415_map, AS_PROGRAM, 32, ip20_state ) - AM_RANGE( 0x00000000, 0x001fffff ) AM_RAM AM_SHARE("share10") - AM_RANGE( 0x08000000, 0x08ffffff ) AM_RAM AM_SHARE("share5") - AM_RANGE( 0x09000000, 0x097fffff ) AM_RAM AM_SHARE("share6") - AM_RANGE( 0x0a000000, 0x0a7fffff ) AM_RAM AM_SHARE("share7") - AM_RANGE( 0x0c000000, 0x0c7fffff ) AM_RAM AM_SHARE("share8") - AM_RANGE( 0x10000000, 0x107fffff ) AM_RAM AM_SHARE("share9") - AM_RANGE( 0x18000000, 0x187fffff ) AM_RAM AM_SHARE("share1") - AM_RANGE( 0x1fa00000, 0x1fa1ffff ) AM_DEVREADWRITE("sgi_mc", sgi_mc_device, read, write ) - AM_RANGE( 0x1fb80000, 0x1fb8ffff ) AM_READWRITE(hpc_r, hpc_w ) - AM_RANGE( 0x1fbd9000, 0x1fbd903f ) AM_READWRITE(int_r, int_w ) - AM_RANGE( 0x1fc00000, 0x1fc7ffff ) AM_ROM AM_SHARE("share2") AM_REGION( "user1", 0 ) - AM_RANGE( 0x80000000, 0x801fffff ) AM_RAM AM_SHARE("share10") - AM_RANGE( 0x88000000, 0x88ffffff ) AM_RAM AM_SHARE("share5") - AM_RANGE( 0xa0000000, 0xa01fffff ) AM_RAM AM_SHARE("share10") - AM_RANGE( 0xa8000000, 0xa8ffffff ) AM_RAM AM_SHARE("share5") - AM_RANGE( 0xa9000000, 0xa97fffff ) AM_RAM AM_SHARE("share6") - AM_RANGE( 0xaa000000, 0xaa7fffff ) AM_RAM AM_SHARE("share7") - AM_RANGE( 0xac000000, 0xac7fffff ) AM_RAM AM_SHARE("share8") - AM_RANGE( 0xb0000000, 0xb07fffff ) AM_RAM AM_SHARE("share9") - AM_RANGE( 0xb8000000, 0xb87fffff ) AM_RAM AM_SHARE("share1") - AM_RANGE( 0xbfa00000, 0xbfa1ffff ) AM_DEVREADWRITE("sgi_mc", sgi_mc_device, read, write ) - AM_RANGE( 0xbfb80000, 0xbfb8ffff ) AM_READWRITE(hpc_r, hpc_w ) - AM_RANGE( 0xbfbd9000, 0xbfbd903f ) AM_READWRITE(int_r, int_w ) - AM_RANGE( 0xbfc00000, 0xbfc7ffff ) AM_ROM AM_SHARE("share2") /* BIOS Mirror */ -ADDRESS_MAP_END - -WRITE_LINE_MEMBER(ip20_state::scsi_irq) -{ -} - -DRIVER_INIT_MEMBER(ip20_state,ip204415) -{ -} - -void ip20_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_RTC: - ip20_timer_rtc(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in ip20_state::device_timer"); - } -} - -TIMER_CALLBACK_MEMBER(ip20_state::ip20_timer_rtc) -{ - // update RTC every 10 milliseconds - m_RTC.nTemp++; - if (m_RTC.nTemp >= 10) - { - m_RTC.nTemp = 0; - RTC_HUNDREDTH++; - - if( ( RTC_HUNDREDTH & 0x0f ) == 0x0a ) - { - RTC_HUNDREDTH -= 0x0a; - RTC_HUNDREDTH += 0x10; - if( ( RTC_HUNDREDTH & 0xa0 ) == 0xa0 ) - { - RTC_HUNDREDTH = 0; - RTC_SECOND++; - - if( ( RTC_SECOND & 0x0f ) == 0x0a ) - { - RTC_SECOND -= 0x0a; - RTC_SECOND += 0x10; - if( RTC_SECOND == 0x60 ) - { - RTC_SECOND = 0; - RTC_MINUTE++; - - if( ( RTC_MINUTE & 0x0f ) == 0x0a ) - { - RTC_MINUTE -= 0x0a; - RTC_MINUTE += 0x10; - if( RTC_MINUTE == 0x60 ) - { - RTC_MINUTE = 0; - RTC_HOUR++; - - if( ( RTC_HOUR & 0x0f ) == 0x0a ) - { - RTC_HOUR -= 0x0a; - RTC_HOUR += 0x10; - if( RTC_HOUR == 0x24 ) - { - RTC_HOUR = 0; - RTC_DAY++; - } - } - } - } - } - } - } - } - } - - timer_set(attotime::from_msec(1), TIMER_RTC); -} - -void ip20_state::machine_start() -{ - m_HPC.nMiscStatus = 0; - m_HPC.nParBufPtr = 0; - m_HPC.nLocalIOReg0Mask = 0; - m_HPC.nLocalIOReg1Mask = 0; - m_HPC.nVMEIntMask0 = 0; - m_HPC.nVMEIntMask1 = 0; - - m_RTC.nTemp = 0; - - timer_set(attotime::from_msec(1), TIMER_RTC); -} - -static INPUT_PORTS_START( ip204415 ) - PORT_START("unused") - PORT_BIT ( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - -#if 0 -static const mips3_config config = -{ - 32768, /* code cache size */ - 32768 /* data cache size */ -}; -#endif - -static MACHINE_CONFIG_FRAGMENT( cdrom_config ) - MCFG_DEVICE_MODIFY( "cdda" ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "^^^^mono", 1.0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ip204415, ip20_state ) - MCFG_CPU_ADD( "maincpu", R4600BE, 50000000*3 ) - MCFG_CPU_CONFIG( config ) - MCFG_CPU_PROGRAM_MAP( ip204415_map) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE( 60 ) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(800, 600) - MCFG_SCREEN_VISIBLE_AREA(0, 799, 0, 599) - MCFG_SCREEN_UPDATE_DRIVER(ip20_state, screen_update_ip204415) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 65536) - - - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_DEVICE_ADD("scc", SCC8530, 7000000) - - MCFG_DEVICE_ADD("sgi_mc", SGI_MC, 0) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_6) - MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config) - - MCFG_DEVICE_ADD("wd33c93", WD33C93, 0) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_WD33C93_IRQ_CB(WRITELINE(ip20_state, scsi_irq)) /* command completion IRQ */ - - MCFG_EEPROM_SERIAL_93C56_ADD("eeprom") -MACHINE_CONFIG_END - -ROM_START( ip204415 ) - ROM_REGION( 0x80000, "user1", 0 ) - ROM_LOAD( "ip204415.bin", 0x000000, 0x080000, CRC(940d960e) SHA1(596aba530b53a147985ff3f6f853471ce48c866c) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1993, ip204415, 0, 0, ip204415, ip204415, ip20_state, ip204415, "Silicon Graphics Inc", "IRIS Indigo (R4400, 150MHz)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/ip22.c b/src/mess/drivers/ip22.c deleted file mode 100644 index 2ea0ea03fd6..00000000000 --- a/src/mess/drivers/ip22.c +++ /dev/null @@ -1,1675 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*********************************************************************\ -* -* SGI IP22 Indigo2/Indy workstation -* -* Todo: Fix tod clock set problem -* Fix NVRAM saving -* Fix SCSI DMA to handle chains properly -* Probably many more things -* -* Memory map: -* -* 18000000 - 1effffff RESERVED - Unused -* 1f000000 - 1f3fffff GIO - GFX -* 1f400000 - 1f5fffff GIO - EXP0 -* 1f600000 - 1f9fffff GIO - EXP1 - Unused -* 1fa00000 - 1fa02047 Memory Controller -* 1fb00000 - 1fb1a7ff HPC3 CHIP1 -* 1fb80000 - 1fb9a7ff HPC3 CHIP0 -* 1fc00000 - 1fc7ffff BIOS -* -* References used: -* MipsLinux: http://www.mips-linux.org/ -* linux-2.6.6/include/newport.h -* linux-2.6.6/include/asm-mips/sgi/gio.h -* linux-2.6.6/include/asm-mips/sgi/mc.h -* linux-2.6.6/include/asm-mips/sgi/hpc3.h -* NetBSD: http://www.netbsd.org/ -* gxemul: http://gavare.se/gxemul/ -* -* Gentoo LiveCD r5 boot instructions: -* mess -cdrom gentoor5.chd ip225015 -* enter the command interpreter and type "sashARCS". press enter and -* it'll autoboot. -* -* IRIX boot instructions: -* mess -cdrom irix656inst1.chd ip225015 -* at the menu, choose either "run diagnostics" or "install system software" -* -\*********************************************************************/ - -#include "emu.h" -#include "cpu/mips/mips3.h" -#include "sound/cdda.h" -#include "machine/sgi.h" -#include "machine/pckeybrd.h" -#include "machine/pc_lpt.h" -#include "includes/at.h" -#include "machine/8042kbdc.h" -#include "machine/pit8253.h" -#include "video/newport.h" -#include "sound/dac.h" -#include "machine/nvram.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsicd.h" -#include "bus/scsi/scsihd.h" -#include "machine/wd33c93.h" - -struct RTC_t -{ - UINT8 nRegs[0x80]; - UINT8 nUserRAM[0x200]; - UINT8 nRAM[0x800]; -}; - -struct HPC3_t -{ - UINT32 nenetr_nbdp; - UINT32 nenetr_cbp; - UINT32 nunk0; - UINT32 nunk1; - UINT32 nIC_Unk0; - UINT32 nSCSI0Descriptor; - UINT32 nSCSI0DMACtrl; -}; - -struct HAL2_t -{ - UINT32 nIAR; - UINT32 nIDR[4]; -}; - -struct PBUS_DMA_t -{ - UINT8 nActive; - UINT32 nCurPtr; - UINT32 nDescPtr; - UINT32 nNextPtr; - UINT32 nWordsLeft; -}; - -class ip22_state : public driver_device -{ -public: - enum - { - TIMER_IP22_DMA, - TIMER_IP22_MSEC - }; - - ip22_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_wd33c93(*this, "wd33c93"), - m_unkpbus0(*this, "unkpbus0"), - m_mainram(*this, "mainram"), - m_lpt0(*this, "lpt_0"), - m_pit(*this, "pit8254"), - m_sgi_mc(*this, "sgi_mc"), - m_newport(*this, "newport"), - m_dac(*this, "dac"), - m_kbdc8042(*this, "kbdc") - { - } - - required_device m_maincpu; - required_device m_wd33c93; - required_shared_ptr m_unkpbus0; - required_shared_ptr m_mainram; - required_device m_lpt0; - required_device m_pit; - required_device m_sgi_mc; - required_device m_newport; - required_device m_dac; - required_device m_kbdc8042; - - RTC_t m_RTC; - UINT32 m_int3_regs[64]; - UINT32 m_nIOC_ParReadCnt; - /*UINT8 m_nIOC_ParCntl;*/ - HPC3_t m_HPC3; - HAL2_t m_HAL2; - PBUS_DMA_t m_PBUS_DMA; - UINT32 m_nIntCounter; - UINT8 m_dma_buffer[4096]; - DECLARE_READ32_MEMBER(hpc3_pbus6_r); - DECLARE_WRITE32_MEMBER(hpc3_pbus6_w); - DECLARE_READ32_MEMBER(hpc3_hd_enet_r); - DECLARE_WRITE32_MEMBER(hpc3_hd_enet_w); - DECLARE_READ32_MEMBER(hpc3_hd0_r); - DECLARE_WRITE32_MEMBER(hpc3_hd0_w); - DECLARE_READ32_MEMBER(hpc3_pbus4_r); - DECLARE_WRITE32_MEMBER(hpc3_pbus4_w); - DECLARE_READ32_MEMBER(rtc_r); - DECLARE_WRITE32_MEMBER(rtc_w); - DECLARE_WRITE32_MEMBER(ip22_write_ram); - DECLARE_READ32_MEMBER(hal2_r); - DECLARE_WRITE32_MEMBER(hal2_w); - DECLARE_READ32_MEMBER(hpc3_pbusdma_r); - DECLARE_WRITE32_MEMBER(hpc3_pbusdma_w); - DECLARE_READ32_MEMBER(hpc3_unkpbus0_r); - DECLARE_WRITE32_MEMBER(hpc3_unkpbus0_w); - DECLARE_WRITE_LINE_MEMBER(scsi_irq); - DECLARE_DRIVER_INIT(ip225015); - virtual void machine_start(); - virtual void machine_reset(); - INTERRUPT_GEN_MEMBER(ip22_vbl); - TIMER_CALLBACK_MEMBER(ip22_dma); - TIMER_CALLBACK_MEMBER(ip22_timer); - inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... ); - void int3_raise_local0_irq(UINT8 source_mask); - void int3_lower_local0_irq(UINT8 source_mask); - void int3_raise_local1_irq(UINT8 source_mask); - void int3_lower_local1_irq(UINT8 source_mask); - void dump_chain(address_space &space, UINT32 ch_base); - void rtc_update(); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -#define VERBOSE_LEVEL ( 0 ) - - -inline void ATTR_PRINTF(3,4) ip22_state::verboselog(int n_level, const char *s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror("%08x: %s", m_maincpu->pc(), buf); - } -} - - -#define RTC_DAY m_RTC.nRAM[0x09] -#define RTC_HOUR m_RTC.nRAM[0x08] -#define RTC_MINUTE m_RTC.nRAM[0x07] -#define RTC_SECOND m_RTC.nRAM[0x06] -#define RTC_HUNDREDTH m_RTC.nRAM[0x05] - -// interrupt sources handled by INT3 -#define INT3_LOCAL0_FIFO (0x01) -#define INT3_LOCAL0_SCSI0 (0x02) -#define INT3_LOCAL0_SCSI1 (0x04) -#define INT3_LOCAL0_ETHERNET (0x08) -#define INT3_LOCAL0_MC_DMA (0x10) -#define INT3_LOCAL0_PARALLEL (0x20) -#define INT3_LOCAL0_GRAPHICS (0x40) -#define INT3_LOCAL0_MAPPABLE0 (0x80) - -#define INT3_LOCAL1_GP0 (0x01) -#define INT3_LOCAL1_PANEL (0x02) -#define INT3_LOCAL1_GP2 (0x04) -#define INT3_LOCAL1_MAPPABLE1 (0x08) -#define INT3_LOCAL1_HPC_DMA (0x10) -#define INT3_LOCAL1_AC_FAIL (0x20) -#define INT3_LOCAL1_VSYNC (0x40) -#define INT3_LOCAL1_RETRACE (0x80) - -// raise a local0 interrupt -void ip22_state::int3_raise_local0_irq(UINT8 source_mask) -{ - // signal the interrupt is pending - m_int3_regs[0] |= source_mask; - - // if it's not masked, also assert it now at the CPU - if (m_int3_regs[1] & source_mask) - m_maincpu->set_input_line(MIPS3_IRQ0, ASSERT_LINE); -} - -// lower a local0 interrupt -void ip22_state::int3_lower_local0_irq(UINT8 source_mask) -{ - m_int3_regs[0] &= ~source_mask; -} - -#ifdef UNUSED_FUNCTION -// raise a local1 interrupt -void ip22_state::int3_raise_local1_irq(UINT8 source_mask) -{ - // signal the interrupt is pending - m_int3_regs[2] |= source_mask; - - // if it's not masked, also assert it now at the CPU - if (m_int3_regs[2] & source_mask) - m_maincpu->set_input_line(MIPS3_IRQ1, ASSERT_LINE); -} - -// lower a local1 interrupt -void ip22_state::int3_lower_local1_irq(UINT8 source_mask) -{ - m_int3_regs[2] &= ~source_mask; -} -#endif - -READ32_MEMBER(ip22_state::hpc3_pbus6_r) -{ - UINT8 ret8; - switch( offset ) - { - case 0x004/4: - ret8 = m_lpt0->control_r(space, 0) ^ 0x0d; - //verboselog(0, "Parallel Control Read: %02x\n", ret8 ); - return ret8; - case 0x008/4: - ret8 = m_lpt0->status_r(space, 0) ^ 0x80; - //verboselog(0, "Parallel Status Read: %02x\n", ret8 ); - return ret8; - case 0x030/4: - //verboselog(2, "Serial 1 Command Transfer Read, 0x1fbd9830: %02x\n", 0x04 ); - switch(space.device().safe_pc()) - { - case 0x9fc1d9e4: // interpreter (ip244415) - case 0x9fc1d9e0: // DRC (ip244415) - case 0x9fc1f8e0: // interpreter (ip224613) - case 0x9fc1f8dc: // DRC (ip224613) - case 0x9fc204c8: // interpreter (ip225015) - case 0x9fc204c4: // DRC (ip225015) - return 0x00000005; - } - return 0x00000004; - case 0x038/4: - //verboselog(2, "Serial 2 Command Transfer Read, 0x1fbd9838: %02x\n", 0x04 ); - return 0x00000004; - case 0x40/4: - return m_kbdc8042->data_r(space, 0); - case 0x44/4: - return m_kbdc8042->data_r(space, 4); - case 0x58/4: - return 0x20; // chip rev 1, board rev 0, "Guinness" (Indy) => 0x01 for "Full House" (Indigo2) - case 0x80/4: - case 0x84/4: - case 0x88/4: - case 0x8c/4: - case 0x90/4: - case 0x94/4: - case 0x98/4: - case 0x9c/4: - case 0xa0/4: - case 0xa4/4: - case 0xa8/4: - case 0xac/4: -// osd_printf_info("INT3: r @ %x mask %08x (PC=%x)\n", offset*4, mem_mask, activecpu_get_pc()); - return m_int3_regs[offset-0x80/4]; - case 0xb0/4: - ret8 = m_pit->read(space, 0); - //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); - return ret8; - case 0xb4/4: - ret8 = m_pit->read(space, 1); - //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); - return ret8; - case 0xb8/4: - ret8 = m_pit->read(space, 2); - //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); - return ret8; - case 0xbc/4: - ret8 = m_pit->read(space, 3); - //verboselog(0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask ); - return ret8; - default: - //verboselog(0, "Unknown HPC PBUS6 Read: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), mem_mask ); - return 0; - } -} - -WRITE32_MEMBER(ip22_state::hpc3_pbus6_w) -{ - char cChar; - - switch( offset ) - { - case 0x004/4: - //verboselog(0, "Parallel Control Write: %08x\n", data ); - m_lpt0->control_w(space, 0, data ^ 0x0d); - //m_nIOC_ParCntl = data; - break; - case 0x030/4: - if( ( data & 0x000000ff ) >= 0x20 ) - { - //verboselog(2, "Serial 1 Command Transfer Write: %02x: %c\n", data & 0x000000ff, data & 0x000000ff ); - } - else - { - //verboselog(2, "Serial 1 Command Transfer Write: %02x\n", data & 0x000000ff ); - } - cChar = data & 0x000000ff; - if( cChar >= 0x20 || cChar == 0x0d || cChar == 0x0a ) - { -// osd_printf_info( "%c", cChar ); - } - break; - case 0x034/4: - if( ( data & 0x000000ff ) >= 0x20 ) - { - //verboselog(2, "Serial 1 Data Transfer Write: %02x: %c\n", data & 0x000000ff, data & 0x000000ff ); - } - else - { - //verboselog(2, "Serial 1 Data Transfer Write: %02x\n", data & 0x000000ff ); - } - cChar = data & 0x000000ff; - if( cChar >= 0x20 || cChar == 0x0d || cChar == 0x0a ) - { -// osd_printf_info( "%c", cChar ); - } - break; - case 0x40/4: - m_kbdc8042->data_w(space, 0, data); - break; - case 0x44/4: - m_kbdc8042->data_w(space, 4, data); - break; - case 0x80/4: - case 0x84/4: - case 0x88/4: - case 0x8c/4: - case 0x90/4: - case 0x94/4: - case 0x98/4: - case 0x9c/4: - case 0xa0/4: - case 0xa4/4: -// osd_printf_info("INT3: w %x to %x (reg %d) mask %08x (PC=%x)\n", data, offset*4, offset-0x80/4, mem_mask, activecpu_get_pc()); - m_int3_regs[offset-0x80/4] = data; - - // if no local0 interrupts now, clear the input to the CPU - if ((m_int3_regs[0] & m_int3_regs[1]) == 0) - m_maincpu->set_input_line(MIPS3_IRQ0, CLEAR_LINE); - else - m_maincpu->set_input_line(MIPS3_IRQ0, ASSERT_LINE); - - // if no local1 interrupts now, clear the input to the CPU - if ((m_int3_regs[2] & m_int3_regs[3]) == 0) - m_maincpu->set_input_line(MIPS3_IRQ1, CLEAR_LINE); - else - m_maincpu->set_input_line(MIPS3_IRQ1, ASSERT_LINE); - - break; - case 0xb0/4: - //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 0 Register Write: 0x%08x (%08x)\n", data, mem_mask ); - m_pit->write(space, 0, data & 0x000000ff); - return; - case 0xb4/4: - //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 1 Register Write: 0x%08x (%08x)\n", data, mem_mask ); - m_pit->write(space, 1, data & 0x000000ff); - return; - case 0xb8/4: - //verboselog(0, "HPC PBUS6 IOC4 Timer Counter 2 Register Write: 0x%08x (%08x)\n", data, mem_mask ); - m_pit->write(space, 2, data & 0x000000ff); - return; - case 0xbc/4: - //verboselog(0, "HPC PBUS6 IOC4 Timer Control Word Register Write: 0x%08x (%08x)\n", data, mem_mask ); - m_pit->write(space, 3, data & 0x000000ff); - return; - default: - //verboselog(0, "Unknown HPC PBUS6 Write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd9800 + ( offset << 2 ), data, mem_mask ); - break; - } -} - -READ32_MEMBER(ip22_state::hpc3_hd_enet_r) -{ - switch( offset ) - { - case 0x0004/4: - //verboselog((machine, 0, "HPC3 SCSI0DESC Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, m_HPC3.nSCSI0Descriptor ); - return m_HPC3.nSCSI0Descriptor; - case 0x1004/4: - //verboselog((machine, 0, "HPC3 SCSI0DMACTRL Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, m_HPC3.nSCSI0DMACtrl ); - return m_HPC3.nSCSI0DMACtrl; - case 0x4000/4: - //verboselog((machine, 2, "HPC3 ENETR CBP Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, m_HPC3.nenetr_nbdp ); - return m_HPC3.nenetr_cbp; - case 0x4004/4: - //verboselog((machine, 2, "HPC3 ENETR NBDP Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, m_HPC3.nenetr_nbdp ); - return m_HPC3.nenetr_nbdp; - default: - //verboselog((machine, 0, "Unknown HPC3 ENET/HDx Read: %08x (%08x)\n", 0x1fb90000 + ( offset << 2 ), mem_mask ); - return 0; - } -} - -WRITE32_MEMBER(ip22_state::hpc3_hd_enet_w) -{ - switch( offset ) - { - case 0x0004/4: - //verboselog((machine, 2, "HPC3 SCSI0DESC Write: %08x\n", data ); - m_HPC3.nSCSI0Descriptor = data; - break; - case 0x1004/4: - //verboselog((machine, 2, "HPC3 SCSI0DMACTRL Write: %08x\n", data ); - m_HPC3.nSCSI0DMACtrl = data; - break; - case 0x4000/4: - //verboselog((machine, 2, "HPC3 ENETR CBP Write: %08x\n", data ); - m_HPC3.nenetr_cbp = data; - break; - case 0x4004/4: - //verboselog((machine, 2, "HPC3 ENETR NBDP Write: %08x\n", data ); - m_HPC3.nenetr_nbdp = data; - break; - default: - //verboselog((machine, 0, "Unknown HPC3 ENET/HDx write: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2 ), mem_mask, data ); - break; - } -} - -READ32_MEMBER(ip22_state::hpc3_hd0_r) -{ - switch( offset ) - { - case 0x0000/4: - case 0x4000/4: -// //verboselog((machine, 2, "HPC3 HD0 Status Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC3_hd0_regs[0x17] ); - if (ACCESSING_BITS_0_7) - { - return m_wd33c93->read( space, 0 ); - } - else - { - return 0; - } - case 0x0004/4: - case 0x4004/4: -// //verboselog((machine, 2, "HPC3 HD0 Register Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC3_hd0_regs[nHPC3_hd0_register] ); - if (ACCESSING_BITS_0_7) - { - return m_wd33c93->read( space, 1 ); - } - else - { - return 0; - } - default: - //verboselog((machine, 0, "Unknown HPC3 HD0 Read: %08x (%08x) [%x] PC=%x\n", 0x1fbc0000 + ( offset << 2 ), mem_mask, offset, space.device().safe_pc() ); - return 0; - } -} - -WRITE32_MEMBER(ip22_state::hpc3_hd0_w) -{ - switch( offset ) - { - case 0x0000/4: - case 0x4000/4: -// //verboselog((machine, 2, "HPC3 HD0 Register Select Write: %08x\n", data ); - if (ACCESSING_BITS_0_7) - { - m_wd33c93->write( space, 0, data & 0x000000ff ); - } - break; - case 0x0004/4: - case 0x4004/4: -// //verboselog((machine, 2, "HPC3 HD0 Register %d Write: %08x\n", nHPC3_hd0_register, data ); - if (ACCESSING_BITS_0_7) - { - m_wd33c93->write( space, 1, data & 0x000000ff ); - } - break; - default: - //verboselog((machine, 0, "Unknown HPC3 HD0 Write: %08x (%08x): %08x\n", 0x1fbc0000 + ( offset << 2 ), mem_mask, data ); - break; - } -} - - -READ32_MEMBER(ip22_state::hpc3_pbus4_r) -{ - switch( offset ) - { - case 0x0004/4: - //verboselog((machine, 2, "HPC3 PBUS4 Unknown 0 Read: (%08x): %08x\n", mem_mask, m_HPC3.nunk0 ); - return m_HPC3.nunk0; - case 0x000c/4: - //verboselog((machine, 2, "Interrupt Controller(?) Read: (%08x): %08x\n", mem_mask, m_HPC3.nIC_Unk0 ); - return m_HPC3.nIC_Unk0; - case 0x0014/4: - //verboselog((machine, 2, "HPC3 PBUS4 Unknown 1 Read: (%08x): %08x\n", mem_mask, m_HPC3.nunk1 ); - return m_HPC3.nunk1; - default: - //verboselog((machine, 0, "Unknown HPC3 PBUS4 Read: %08x (%08x)\n", 0x1fbd9000 + ( offset << 2 ), mem_mask ); - return 0; - } -} - -WRITE32_MEMBER(ip22_state::hpc3_pbus4_w) -{ - switch( offset ) - { - case 0x0004/4: - //verboselog((machine, 2, "HPC3 PBUS4 Unknown 0 Write: %08x (%08x)\n", data, mem_mask ); - m_HPC3.nunk0 = data; - break; - case 0x000c/4: - //verboselog((machine, 2, "Interrupt Controller(?) Write: (%08x): %08x\n", mem_mask, data ); - m_HPC3.nIC_Unk0 = data; - break; - case 0x0014/4: - //verboselog((machine, 2, "HPC3 PBUS4 Unknown 1 Write: %08x (%08x)\n", data, mem_mask ); - m_HPC3.nunk1 = data; - break; - default: - //verboselog((machine, 0, "Unknown HPC3 PBUS4 Write: %08x (%08x): %08x\n", 0x1fbd9000 + ( offset << 2 ), mem_mask, data ); - break; - } -} - -#define RTC_SECONDS m_RTC.nRegs[0x00] -#define RTC_SECONDS_A m_RTC.nRegs[0x01] -#define RTC_MINUTES m_RTC.nRegs[0x02] -#define RTC_MINUTES_A m_RTC.nRegs[0x03] -#define RTC_HOURS m_RTC.nRegs[0x04] -#define RTC_HOURS_A m_RTC.nRegs[0x05] -#define RTC_DAYOFWEEK m_RTC.nRegs[0x06] -#define RTC_DAYOFMONTH m_RTC.nRegs[0x07] -#define RTC_MONTH m_RTC.nRegs[0x08] -#define RTC_YEAR m_RTC.nRegs[0x09] -#define RTC_REGISTERA m_RTC.nRegs[0x0a] -#define RTC_REGISTERB m_RTC.nRegs[0x0b] -#define RTC_REGISTERC m_RTC.nRegs[0x0c] -#define RTC_REGISTERD m_RTC.nRegs[0x0d] -#define RTC_MODELBYTE m_RTC.nRegs[0x40] -#define RTC_SERBYTE0 m_RTC.nRegs[0x41] -#define RTC_SERBYTE1 m_RTC.nRegs[0x42] -#define RTC_SERBYTE2 m_RTC.nRegs[0x43] -#define RTC_SERBYTE3 m_RTC.nRegs[0x44] -#define RTC_SERBYTE4 m_RTC.nRegs[0x45] -#define RTC_SERBYTE5 m_RTC.nRegs[0x46] -#define RTC_CRC m_RTC.nRegs[0x47] -#define RTC_CENTURY m_RTC.nRegs[0x48] -#define RTC_DAYOFMONTH_A m_RTC.nRegs[0x49] -#define RTC_EXTCTRL0 m_RTC.nRegs[0x4a] -#define RTC_EXTCTRL1 m_RTC.nRegs[0x4b] -#define RTC_RTCADDR2 m_RTC.nRegs[0x4e] -#define RTC_RTCADDR3 m_RTC.nRegs[0x4f] -#define RTC_RAMLSB m_RTC.nRegs[0x50] -#define RTC_RAMMSB m_RTC.nRegs[0x51] -#define RTC_WRITECNT m_RTC.nRegs[0x5e] - -READ32_MEMBER(ip22_state::rtc_r) -{ - if( offset <= 0x0d ) - { - switch( offset ) - { - case 0x0000: -// //verboselog((machine, 2, "RTC Seconds Read: %d \n", RTC_SECONDS ); - return RTC_SECONDS; - case 0x0001: -// //verboselog((machine, 2, "RTC Seconds Alarm Read: %d \n", RTC_SECONDS_A ); - return RTC_SECONDS_A; - case 0x0002: - //verboselog((machine, 3, "RTC Minutes Read: %d \n", RTC_MINUTES ); - return RTC_MINUTES; - case 0x0003: - //verboselog((machine, 3, "RTC Minutes Alarm Read: %d \n", RTC_MINUTES_A ); - return RTC_MINUTES_A; - case 0x0004: - //verboselog((machine, 3, "RTC Hours Read: %d \n", RTC_HOURS ); - return RTC_HOURS; - case 0x0005: - //verboselog((machine, 3, "RTC Hours Alarm Read: %d \n", RTC_HOURS_A ); - return RTC_HOURS_A; - case 0x0006: - //verboselog((machine, 3, "RTC Day of Week Read: %d \n", RTC_DAYOFWEEK ); - return RTC_DAYOFWEEK; - case 0x0007: - //verboselog((machine, 3, "RTC Day of Month Read: %d \n", RTC_DAYOFMONTH ); - return RTC_DAYOFMONTH; - case 0x0008: - //verboselog((machine, 3, "RTC Month Read: %d \n", RTC_MONTH ); - return RTC_MONTH; - case 0x0009: - //verboselog((machine, 3, "RTC Year Read: %d \n", RTC_YEAR ); - return RTC_YEAR; - case 0x000a: - //verboselog((machine, 3, "RTC Register A Read: %02x \n", RTC_REGISTERA ); - return RTC_REGISTERA; - case 0x000b: - //verboselog((machine, 3, "RTC Register B Read: %02x \n", RTC_REGISTERB ); - return RTC_REGISTERB; - case 0x000c: - //verboselog((machine, 3, "RTC Register C Read: %02x \n", RTC_REGISTERC ); - return RTC_REGISTERC; - case 0x000d: - //verboselog((machine, 3, "RTC Register D Read: %02x \n", RTC_REGISTERD ); - return RTC_REGISTERD; - default: - //verboselog((machine, 3, "Unknown RTC Read: %08x (%08x)\n", 0x1fbe0000 + ( offset << 2 ), mem_mask ); - return 0; - } - } - - if( offset >= 0x0e && offset < 0x40 ) - return m_RTC.nRegs[offset]; - - if( offset >= 0x40 && offset < 0x80 && !( RTC_REGISTERA & 0x10 ) ) - return m_RTC.nUserRAM[offset - 0x40]; - - if( offset >= 0x40 && offset < 0x80 && ( RTC_REGISTERA & 0x10 ) ) - { - switch( offset ) - { - case 0x0040: - //verboselog((machine, 3, "RTC Model Byte Read: %02x\n", RTC_MODELBYTE ); - return RTC_MODELBYTE; - case 0x0041: - //verboselog((machine, 3, "RTC Serial Byte 0 Read: %02x\n", RTC_SERBYTE0 ); - return RTC_SERBYTE0; - case 0x0042: - //verboselog((machine, 3, "RTC Serial Byte 1 Read: %02x\n", RTC_SERBYTE1 ); - return RTC_SERBYTE1; - case 0x0043: - //verboselog((machine, 3, "RTC Serial Byte 2 Read: %02x\n", RTC_SERBYTE2 ); - return RTC_SERBYTE2; - case 0x0044: - //verboselog((machine, 3, "RTC Serial Byte 3 Read: %02x\n", RTC_SERBYTE3 ); - return RTC_SERBYTE3; - case 0x0045: - //verboselog((machine, 3, "RTC Serial Byte 4 Read: %02x\n", RTC_SERBYTE4 ); - return RTC_SERBYTE4; - case 0x0046: - //verboselog((machine, 3, "RTC Serial Byte 5 Read: %02x\n", RTC_SERBYTE5 ); - return RTC_SERBYTE5; - case 0x0047: - //verboselog((machine, 3, "RTC CRC Read: %02x\n", RTC_CRC ); - return RTC_CRC; - case 0x0048: - //verboselog((machine, 3, "RTC Century Read: %02x\n", RTC_CENTURY ); - return RTC_CENTURY; - case 0x0049: - //verboselog((machine, 3, "RTC Day of Month Alarm Read: %02x \n", RTC_DAYOFMONTH_A ); - return RTC_DAYOFMONTH_A; - case 0x004a: - //verboselog((machine, 3, "RTC Extended Control 0 Read: %02x \n", RTC_EXTCTRL0 ); - return RTC_EXTCTRL0; - case 0x004b: - //verboselog((machine, 3, "RTC Extended Control 1 Read: %02x \n", RTC_EXTCTRL1 ); - return RTC_EXTCTRL1; - case 0x004e: - //verboselog((machine, 3, "RTC SMI Recovery Address 2 Read: %02x \n", RTC_RTCADDR2 ); - return RTC_RTCADDR2; - case 0x004f: - //verboselog((machine, 3, "RTC SMI Recovery Address 3 Read: %02x \n", RTC_RTCADDR3 ); - return RTC_RTCADDR3; - case 0x0050: - //verboselog((machine, 3, "RTC RAM LSB Read: %02x \n", RTC_RAMLSB ); - return RTC_RAMLSB; - case 0x0051: - //verboselog((machine, 3, "RTC RAM MSB Read: %02x \n", RTC_RAMMSB ); - return RTC_RAMMSB; - case 0x0053: - return m_RTC.nRAM[ (( RTC_RAMMSB << 8 ) | RTC_RAMLSB) & 0x7ff ]; - case 0x005e: - return RTC_WRITECNT; - default: - //verboselog((machine, 3, "Unknown RTC Ext. Reg. Read: %02x\n", offset ); - return 0; - } - } - - if( offset >= 0x80 ) - return m_RTC.nUserRAM[ offset - 0x80 ]; - - return 0; -} - -WRITE32_MEMBER(ip22_state::rtc_w) -{ - RTC_WRITECNT++; - -// osd_printf_info("RTC_W: offset %x => %x (PC=%x)\n", data, offset, space.device().safe_pc()); - - if( offset <= 0x0d ) - { - switch( offset ) - { - case 0x0000: - //verboselog((machine, 3, "RTC Seconds Write: %02x \n", data ); - RTC_SECONDS = data; - break; - case 0x0001: - //verboselog((machine, 3, "RTC Seconds Alarm Write: %02x \n", data ); - RTC_SECONDS_A = data; - break; - case 0x0002: - //verboselog((machine, 3, "RTC Minutes Write: %02x \n", data ); - RTC_MINUTES = data; - break; - case 0x0003: - //verboselog((machine, 3, "RTC Minutes Alarm Write: %02x \n", data ); - RTC_MINUTES_A = data; - break; - case 0x0004: - //verboselog((machine, 3, "RTC Hours Write: %02x \n", data ); - RTC_HOURS = data; - break; - case 0x0005: - //verboselog((machine, 3, "RTC Hours Alarm Write: %02x \n", data ); - RTC_HOURS_A = data; - break; - case 0x0006: - //verboselog((machine, 3, "RTC Day of Week Write: %02x \n", data ); - RTC_DAYOFWEEK = data; - break; - case 0x0007: - //verboselog((machine, 3, "RTC Day of Month Write: %02x \n", data ); - RTC_DAYOFMONTH = data; - break; - case 0x0008: - //verboselog((machine, 3, "RTC Month Write: %02x \n", data ); - RTC_MONTH = data; - break; - case 0x0009: - //verboselog((machine, 3, "RTC Year Write: %02x \n", data ); - RTC_YEAR = data; - break; - case 0x000a: - //verboselog((machine, 3, "RTC Register A Write (Bit 7 Ignored): %02x \n", data ); - RTC_REGISTERA = data & 0x0000007f; - break; - case 0x000b: - //verboselog((machine, 3, "RTC Register B Write: %02x \n", data ); - RTC_REGISTERB = data; - break; - case 0x000c: - //verboselog((machine, 3, "RTC Register C Write (Ignored): %02x \n", data ); - break; - case 0x000d: - //verboselog((machine, 3, "RTC Register D Write (Ignored): %02x \n", data ); - break; - default: - //verboselog((machine, 3, "Unknown RTC Write: %08x (%08x): %08x\n", 0x1fbe0000 + ( offset << 2 ), mem_mask, data ); - break; - } - } - if( offset >= 0x0e && offset < 0x40 ) - { - m_RTC.nRegs[offset] = data; - return; - } - if( offset >= 0x40 && offset < 0x80 && !( RTC_REGISTERA & 0x10 ) ) - { - m_RTC.nUserRAM[offset - 0x40] = data; - return; - } - if( offset >= 0x40 && offset < 0x80 && ( RTC_REGISTERA & 0x10 ) ) - { - switch( offset ) - { - case 0x0040: - case 0x0041: - case 0x0042: - case 0x0043: - case 0x0044: - case 0x0045: - case 0x0046: - //verboselog((machine, 3, "Invalid write to RTC serial number byte %d: %02x\n", offset - 0x0040, data ); - break; - case 0x0047: - //verboselog((machine, 3, "RTC Century Write: %02x \n", data ); - RTC_CENTURY = data; - break; - case 0x0048: - //verboselog((machine, 3, "RTC Century Write: %02x \n", data ); - RTC_CENTURY = data; - break; - case 0x0049: - //verboselog((machine, 3, "RTC Day of Month Alarm Write: %02x \n", data ); - RTC_DAYOFMONTH_A = data; - break; - case 0x004a: - //verboselog((machine, 3, "RTC Extended Control 0 Write: %02x \n", data ); - RTC_EXTCTRL0 = data; - break; - case 0x004b: - //verboselog((machine, 3, "RTC Extended Control 1 Write: %02x \n", data ); - RTC_EXTCTRL1 = data; - break; - case 0x004e: - //verboselog((machine, 3, "RTC SMI Recovery Address 2 Write: %02x \n", data ); - RTC_RTCADDR2 = data; - break; - case 0x004f: - //verboselog((machine, 3, "RTC SMI Recovery Address 3 Write: %02x \n", data ); - RTC_RTCADDR3 = data; - break; - case 0x0050: - //verboselog((machine, 3, "RTC RAM LSB Write: %02x \n", data ); - RTC_RAMLSB = data; - break; - case 0x0051: - //verboselog((machine, 3, "RTC RAM MSB Write: %02x \n", data ); - RTC_RAMMSB = data; - break; - case 0x0053: - m_RTC.nRAM[ (( RTC_RAMMSB << 8 ) | RTC_RAMLSB) & 0x7ff ] = data; - break; - default: - //verboselog((machine, 3, "Unknown RTC Ext. Reg. Write: %02x: %02x\n", offset, data ); - break; - } - } - if( offset >= 0x80 ) - { - m_RTC.nUserRAM[ offset - 0x80 ] = data; - } -} - -// a bit hackish, but makes the memory detection work properly and allows a big cleanup of the mapping -WRITE32_MEMBER(ip22_state::ip22_write_ram) -{ - // if banks 2 or 3 are enabled, do nothing, we don't support that much memory - if (m_sgi_mc->read(space, 0xc8/4, 0xffffffff) & 0x10001000) - { - // a random perturbation so the memory test fails - data ^= 0xffffffff; - } - - // if banks 0 or 1 have 2 membanks, also kill it, we only want 128 MB - if (m_sgi_mc->read(space, 0xc0/4, 0xffffffff) & 0x40004000) - { - // a random perturbation so the memory test fails - data ^= 0xffffffff; - } - COMBINE_DATA(&m_mainram[offset]); -} - - -#define H2_IAR_TYPE 0xf000 -#define H2_IAR_NUM 0x0f00 -#define H2_IAR_ACCESS_SEL 0x0080 -#define H2_IAR_PARAM 0x000c -#define H2_IAR_RB_INDEX 0x0003 - -#define H2_ISR_TSTATUS 0x01 -#define H2_ISR_USTATUS 0x02 -#define H2_ISR_QUAD_MODE 0x04 -#define H2_ISR_GLOBAL_RESET 0x08 -#define H2_ISR_CODEC_RESET 0x10 - -READ32_MEMBER(ip22_state::hal2_r) -{ - switch( offset ) - { - case 0x0010/4: - //verboselog((machine, 0, "HAL2 Status read: 0x0004\n" ); - return 0x0004; - case 0x0020/4: - //verboselog((machine, 0, "HAL2 Revision read: 0x4011\n" ); - return 0x4011; - } - //verboselog((machine, 0, "Unknown HAL2 read: 0x%08x (%08x)\n", 0x1fbd8000 + offset*4, mem_mask ); - return 0; -} - -WRITE32_MEMBER(ip22_state::hal2_w) -{ - switch( offset ) - { - case 0x0010/4: - //verboselog((machine, 0, "HAL2 Status Write: 0x%08x (%08x)\n", data, mem_mask ); - if( data & H2_ISR_GLOBAL_RESET ) - { - //verboselog((machine, 0, " HAL2 Global Reset\n" ); - } - if( data & H2_ISR_CODEC_RESET ) - { - //verboselog((machine, 0, " HAL2 Codec Reset\n" ); - } - break; - case 0x0030/4: - //verboselog((machine, 0, "HAL2 Indirect Address Register Write: 0x%08x (%08x)\n", data, mem_mask ); - m_HAL2.nIAR = data; - switch( data & H2_IAR_TYPE ) - { - case 0x1000: - //verboselog((machine, 0, " DMA Port\n" ); - switch( data & H2_IAR_NUM ) - { - case 0x0100: - //verboselog((machine, 0, " Synth In\n" ); - break; - case 0x0200: - //verboselog((machine, 0, " AES In\n" ); - break; - case 0x0300: - //verboselog((machine, 0, " AES Out\n" ); - break; - case 0x0400: - //verboselog((machine, 0, " DAC Out\n" ); - break; - case 0x0500: - //verboselog((machine, 0, " ADC Out\n" ); - break; - case 0x0600: - //verboselog((machine, 0, " Synth Control\n" ); - break; - } - break; - case 0x2000: - //verboselog((machine, 0, " Bresenham\n" ); - switch( data & H2_IAR_NUM ) - { - case 0x0100: - //verboselog((machine, 0, " Bresenham Clock Gen 1\n" ); - break; - case 0x0200: - //verboselog((machine, 0, " Bresenham Clock Gen 2\n" ); - break; - case 0x0300: - //verboselog((machine, 0, " Bresenham Clock Gen 3\n" ); - break; - } - break; - case 0x3000: - //verboselog((machine, 0, " Unix Timer\n" ); - switch( data & H2_IAR_NUM ) - { - case 0x0100: - //verboselog((machine, 0, " Unix Timer\n" ); - break; - } - break; - case 0x9000: - //verboselog((machine, 0, " Global DMA Control\n" ); - switch( data & H2_IAR_NUM ) - { - case 0x0100: - //verboselog((machine, 0, " DMA Control\n" ); - break; - } - break; - } - switch( data & H2_IAR_ACCESS_SEL ) - { - case 0x0000: - //verboselog((machine, 0, " Write\n" ); - break; - case 0x0080: - //verboselog((machine, 0, " Read\n" ); - break; - } - //verboselog((machine, 0, " Parameter: %01x\n", ( data & H2_IAR_PARAM ) >> 2 ); - return; - /* FIXME: this code is never excuted */ - //verboselog((machine, 0, " Read Back Index: %01x\n", ( data & H2_IAR_RB_INDEX ) ); - //break; - case 0x0040/4: - //verboselog((machine, 0, "HAL2 Indirect Data Register 0 Write: 0x%08x (%08x)\n", data, mem_mask ); - m_HAL2.nIDR[0] = data; - return; - case 0x0050/4: - //verboselog((machine, 0, "HAL2 Indirect Data Register 1 Write: 0x%08x (%08x)\n", data, mem_mask ); - m_HAL2.nIDR[1] = data; - return; - case 0x0060/4: - //verboselog((machine, 0, "HAL2 Indirect Data Register 2 Write: 0x%08x (%08x)\n", data, mem_mask ); - m_HAL2.nIDR[2] = data; - return; - case 0x0070/4: - //verboselog((machine, 0, "HAL2 Indirect Data Register 3 Write: 0x%08x (%08x)\n", data, mem_mask ); - m_HAL2.nIDR[3] = data; - return; - } - //verboselog((machine, 0, "Unknown HAL2 write: 0x%08x: 0x%08x (%08x)\n", 0x1fbd8000 + offset*4, data, mem_mask ); -} - -#define PBUS_CTRL_ENDIAN 0x00000002 -#define PBUS_CTRL_RECV 0x00000004 -#define PBUS_CTRL_FLUSH 0x00000008 -#define PBUS_CTRL_DMASTART 0x00000010 -#define PBUS_CTRL_LOAD_EN 0x00000020 -#define PBUS_CTRL_REALTIME 0x00000040 -#define PBUS_CTRL_HIGHWATER 0x0000ff00 -#define PBUS_CTRL_FIFO_BEG 0x003f0000 -#define PBUS_CTRL_FIFO_END 0x3f000000 - -#define PBUS_DMADESC_EOX 0x80000000 -#define PBUS_DMADESC_EOXP 0x40000000 -#define PBUS_DMADESC_XIE 0x20000000 -#define PBUS_DMADESC_IPG 0x00ff0000 -#define PBUS_DMADESC_TXD 0x00008000 -#define PBUS_DMADESC_BC 0x00003fff - - -void ip22_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_IP22_DMA: - ip22_dma(ptr, param); - break; - case TIMER_IP22_MSEC: - ip22_timer(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in ip22_state::device_timer"); - } -} - -TIMER_CALLBACK_MEMBER(ip22_state::ip22_dma) -{ - timer_set(attotime::never, TIMER_IP22_DMA); -#if 0 - if( m_PBUS_DMA.nActive ) - { - UINT16 temp16 = ( m_mainram[(m_PBUS_DMA.nCurPtr - 0x08000000)/4] & 0xffff0000 ) >> 16; - INT16 stemp16 = (INT16)((temp16 >> 8) | (temp16 << 8)); - - m_dac->write_signed16(stemp16 ^ 0x8000); - - m_PBUS_DMA.nCurPtr += 4; - - m_PBUS_DMA.nWordsLeft -= 4; - if( m_PBUS_DMA.nWordsLeft == 0 ) - { - if( m_PBUS_DMA.nNextPtr != 0 ) - { - m_PBUS_DMA.nDescPtr = m_PBUS_DMA.nNextPtr; - m_PBUS_DMA.nCurPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4]; - m_PBUS_DMA.nWordsLeft = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+1]; - m_PBUS_DMA.nNextPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+2]; - } - else - { - m_PBUS_DMA.nActive = 0; - return; - } - } - timer_set(attotime::from_hz(44100), TIMER_IP22_DMA); - } -#endif -} - -READ32_MEMBER(ip22_state::hpc3_pbusdma_r) -{ - //UINT32 channel = offset / (0x2000/4); - //verboselog((machine(), 0, "PBUS DMA Channel %d Read: 0x%08x (%08x)\n", channel, 0x1fb80000 + offset*4, mem_mask ); - return 0; -} - -WRITE32_MEMBER(ip22_state::hpc3_pbusdma_w) -{ - UINT32 channel = offset / (0x2000/4); - - switch( offset & 0x07ff ) - { - case 0x0000/4: - //verboselog((machine, 0, "PBUS DMA Channel %d Buffer Pointer Write: 0x%08x\n", channel, data ); - return; - case 0x0004/4: - //verboselog((machine, 0, "PBUS DMA Channel %d Descriptor Pointer Write: 0x%08x\n", channel, data ); - if( channel == 1 ) - { - m_PBUS_DMA.nDescPtr = data; - m_PBUS_DMA.nCurPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4]; - m_PBUS_DMA.nWordsLeft = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+1]; - m_PBUS_DMA.nNextPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+2]; - //verboselog((machine, 0, "nPBUS_DMA_DescPtr = %08x\n", m_PBUS_DMA.nDescPtr ); - //verboselog((machine, 0, "nPBUS_DMA_CurPtr = %08x\n", m_PBUS_DMA.nCurPtr ); - //verboselog((machine, 0, "nPBUS_DMA_WordsLeft = %08x\n", m_PBUS_DMA.nWordsLeft ); - //verboselog((machine, 0, "nPBUS_DMA_NextPtr = %08x\n", m_PBUS_DMA.nNextPtr ); - } - return; - case 0x1000/4: - //verboselog((machine, 0, "PBUS DMA Channel %d Control Register Write: 0x%08x\n", channel, data ); - if( data & PBUS_CTRL_ENDIAN ) - { - //verboselog((machine, 0, " Little Endian\n" ); - } - else - { - //verboselog((machine, 0, " Big Endian\n" ); - } - if( data & PBUS_CTRL_RECV ) - { - //verboselog((machine, 0, " RX DMA\n" ); - } - else - { - //verboselog((machine, 0, " TX DMA\n" ); - } - if( data & PBUS_CTRL_FLUSH ) - { - //verboselog((machine, 0, " Flush for RX\n" ); - } - if( data & PBUS_CTRL_DMASTART ) - { - //verboselog((machine, 0, " Start DMA\n" ); - } - if( data & PBUS_CTRL_LOAD_EN ) - { - //verboselog((machine, 0, " Load Enable\n" ); - } - //verboselog((machine, 0, " High Water Mark: %04x bytes\n", ( data & PBUS_CTRL_HIGHWATER ) >> 8 ); - //verboselog((machine, 0, " FIFO Begin: Row %04x\n", ( data & PBUS_CTRL_FIFO_BEG ) >> 16 ); - //verboselog((machine, 0, " FIFO End: Rowe %04x\n", ( data & PBUS_CTRL_FIFO_END ) >> 24 ); - if( ( data & PBUS_CTRL_DMASTART ) || ( data & PBUS_CTRL_LOAD_EN ) ) - { - timer_set(attotime::from_hz(44100), TIMER_IP22_DMA); - m_PBUS_DMA.nActive = 1; - } - return; - } - //verboselog((machine, 0, "Unknown PBUS DMA Channel %d Write: 0x%08x: 0x%08x (%08x)\n", channel, 0x1fb80000 + offset*4, data, mem_mask ); -} - -READ32_MEMBER(ip22_state::hpc3_unkpbus0_r) -{ - return 0; - ////verboselog((machine(), 0, "Unknown PBUS Read: 0x%08x (%08x)\n", 0x1fbc8000 + offset*4, mem_mask ); - //return m_unkpbus0[offset]; -} - -WRITE32_MEMBER(ip22_state::hpc3_unkpbus0_w) -{ - ////verboselog((machine(), 0, "Unknown PBUS Write: 0x%08x = 0x%08x (%08x)\n", 0x1fbc8000 + offset*4, data, mem_mask ); - //COMBINE_DATA(&m_unkpbus0[offset]); -} - -static ADDRESS_MAP_START( ip225015_map, AS_PROGRAM, 32, ip22_state ) - AM_RANGE( 0x00000000, 0x0007ffff ) AM_RAMBANK( "bank1" ) /* mirror of first 512k of main RAM */ - AM_RANGE( 0x08000000, 0x0fffffff ) AM_SHARE("mainram") AM_RAM_WRITE(ip22_write_ram) /* 128 MB of main RAM */ - AM_RANGE( 0x1f0f0000, 0x1f0f1fff ) AM_DEVREADWRITE("newport", newport_video_device, rex3_r, rex3_w ) - AM_RANGE( 0x1fa00000, 0x1fa1ffff ) AM_DEVREADWRITE("sgi_mc", sgi_mc_device, read, write ) - AM_RANGE( 0x1fb90000, 0x1fb9ffff ) AM_READWRITE(hpc3_hd_enet_r, hpc3_hd_enet_w ) - AM_RANGE( 0x1fbb0000, 0x1fbb0003 ) AM_RAM /* unknown, but read a lot and discarded */ - AM_RANGE( 0x1fbc0000, 0x1fbc7fff ) AM_READWRITE(hpc3_hd0_r, hpc3_hd0_w ) - AM_RANGE( 0x1fbc8000, 0x1fbcffff ) AM_READWRITE(hpc3_unkpbus0_r, hpc3_unkpbus0_w ) AM_SHARE("unkpbus0") - AM_RANGE( 0x1fb80000, 0x1fb8ffff ) AM_READWRITE(hpc3_pbusdma_r, hpc3_pbusdma_w ) - AM_RANGE( 0x1fbd8000, 0x1fbd83ff ) AM_READWRITE(hal2_r, hal2_w ) - AM_RANGE( 0x1fbd8400, 0x1fbd87ff ) AM_RAM /* hack */ - AM_RANGE( 0x1fbd9000, 0x1fbd93ff ) AM_READWRITE(hpc3_pbus4_r, hpc3_pbus4_w ) - AM_RANGE( 0x1fbd9800, 0x1fbd9bff ) AM_READWRITE(hpc3_pbus6_r, hpc3_pbus6_w ) - AM_RANGE( 0x1fbdc000, 0x1fbdc7ff ) AM_RAM - AM_RANGE( 0x1fbdd000, 0x1fbdd3ff ) AM_RAM - AM_RANGE( 0x1fbe0000, 0x1fbe04ff ) AM_READWRITE(rtc_r, rtc_w ) - AM_RANGE( 0x1fc00000, 0x1fc7ffff ) AM_ROM AM_REGION( "user1", 0 ) - AM_RANGE( 0x20000000, 0x27ffffff ) AM_SHARE("mainram") AM_RAM_WRITE(ip22_write_ram) -ADDRESS_MAP_END - - -TIMER_CALLBACK_MEMBER(ip22_state::ip22_timer) -{ - timer_set(attotime::from_msec(1), TIMER_IP22_MSEC); -} - -void ip22_state::machine_reset() -{ - m_HPC3.nenetr_nbdp = 0x80000000; - m_HPC3.nenetr_cbp = 0x80000000; - m_nIntCounter = 0; - RTC_REGISTERB = 0x08; - RTC_REGISTERD = 0x80; - - timer_set(attotime::from_msec(1), TIMER_IP22_MSEC); - - // set up low RAM mirror - membank("bank1")->set_base(m_mainram); - - m_PBUS_DMA.nActive = 0; - - m_maincpu->mips3drc_set_options(MIPS3DRC_COMPATIBLE_OPTIONS | MIPS3DRC_CHECK_OVERFLOWS); -} - -void ip22_state::dump_chain(address_space &space, UINT32 ch_base) -{ - printf("node: %08x %08x %08x (len = %x)\n", space.read_dword(ch_base), space.read_dword(ch_base+4), space.read_dword(ch_base+8), space.read_dword(ch_base+4) & 0x3fff); - - if ((space.read_dword(ch_base+8) != 0) && !(space.read_dword(ch_base+4) & 0x80000000)) - { - dump_chain(space, space.read_dword(ch_base+8)); - } -} - -// HPC3 SCSI DMA control register bits -#define HPC3_DMACTRL_IRQ (0x01) -#define HPC3_DMACTRL_ENDIAN (0x02) -#define HPC3_DMACTRL_DIR (0x04) -#define HPC3_DMACTRL_ENABLE (0x10) - - -WRITE_LINE_MEMBER(ip22_state::scsi_irq) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - if (state) - { - if (m_wd33c93->get_dma_count()) - { - printf("m_wd33c93->get_dma_count() is %d\n", m_wd33c93->get_dma_count() ); - if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) - { - if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_IRQ) logerror("IP22: Unhandled SCSI DMA IRQ\n"); - } - - // HPC3 DMA: host to device - if ((m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_DIR)) - { - UINT32 wptr, tmpword; - int words, dptr, twords; - - words = m_wd33c93->get_dma_count(); - words /= 4; - - wptr = space.read_dword(m_HPC3.nSCSI0Descriptor); - m_HPC3.nSCSI0Descriptor += words*4; - dptr = 0; - - printf("DMA to device: %d words @ %x\n", words, wptr); - - dump_chain(space, m_HPC3.nSCSI0Descriptor); - - if (words <= (512/4)) - { - // one-shot - //m_wd33c93->dma_read_data(m_wd33c93->get_dma_count(), m_dma_buffer); - - while (words) - { - tmpword = space.read_dword(wptr); - - if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) - { - m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; - m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; - m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; - m_dma_buffer[dptr] = tmpword&0xff; - } - else - { - m_dma_buffer[dptr] = (tmpword>>24)&0xff; - m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; - m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; - m_dma_buffer[dptr+3] = tmpword&0xff; - } - - wptr += 4; - dptr += 4; - words--; - } - - words = m_wd33c93->get_dma_count(); - m_wd33c93->dma_write_data(words, m_dma_buffer); - } - else - { - while (words) - { - //m_wd33c93->dma_read_data(512, m_dma_buffer); - twords = 512/4; - m_HPC3.nSCSI0Descriptor += 512; - dptr = 0; - - while (twords) - { - tmpword = space.read_dword(wptr); - - if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) - { - m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; - m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; - m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; - m_dma_buffer[dptr] = tmpword&0xff; - } - else - { - m_dma_buffer[dptr] = (tmpword>>24)&0xff; - m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; - m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; - m_dma_buffer[dptr+3] = tmpword&0xff; - } - - wptr += 4; - dptr += 4; - twords--; - } - - m_wd33c93->dma_write_data(512, m_dma_buffer); - - words -= (512/4); - } - } - - // clear DMA on the controller too - m_wd33c93->clear_dma(); -#if 0 - UINT32 dptr, tmpword; - UINT32 bc = space.read_dword(m_HPC3.nSCSI0Descriptor + 4); - UINT32 rptr = space.read_dword(m_HPC3.nSCSI0Descriptor); - int length = bc & 0x3fff; - int xie = (bc & 0x20000000) ? 1 : 0; - int eox = (bc & 0x80000000) ? 1 : 0; - - dump_chain(space, m_HPC3.nSCSI0Descriptor); - - printf("PC is %08x\n", machine.device("maincpu")->safe_pc()); - printf("DMA to device: length %x xie %d eox %d\n", length, xie, eox); - - if (length <= 0x4000) - { - dptr = 0; - while (length > 0) - { - tmpword = space.read_dword(rptr); - if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) - { - m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; - m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; - m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; - m_dma_buffer[dptr] = tmpword&0xff; - } - else - { - m_dma_buffer[dptr] = (tmpword>>24)&0xff; - m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; - m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; - m_dma_buffer[dptr+3] = tmpword&0xff; - } - - dptr += 4; - rptr += 4; - length -= 4; - } - - length = space.read_dword(m_HPC3.nSCSI0Descriptor+4) & 0x3fff; - m_wd33c93->write_data(length, m_dma_buffer); - - // clear DMA on the controller too - m_wd33c93->clear_dma(); - } - else - { - logerror("IP22: overly large host to device transfer, can't handle!\n"); - } -#endif - } - - // HPC3 DMA: device to host - if ((m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && !(m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_DIR)) - { - UINT32 wptr, tmpword; - int words, sptr, twords; - - words = m_wd33c93->get_dma_count(); - words /= 4; - - wptr = space.read_dword(m_HPC3.nSCSI0Descriptor); - sptr = 0; - -// osd_printf_info("DMA from device: %d words @ %x\n", words, wptr); - - dump_chain(space, m_HPC3.nSCSI0Descriptor); - - if (words <= (1024/4)) - { - // one-shot - m_wd33c93->dma_read_data(m_wd33c93->get_dma_count(), m_dma_buffer); - - while (words) - { - if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) - { - tmpword = m_dma_buffer[sptr+3]<<24 | m_dma_buffer[sptr+2]<<16 | m_dma_buffer[sptr+1]<<8 | m_dma_buffer[sptr]; - } - else - { - tmpword = m_dma_buffer[sptr]<<24 | m_dma_buffer[sptr+1]<<16 | m_dma_buffer[sptr+2]<<8 | m_dma_buffer[sptr+3]; - } - - space.write_dword(wptr, tmpword); - wptr += 4; - sptr += 4; - words--; - } - } - else - { - while (words) - { - m_wd33c93->dma_read_data(512, m_dma_buffer); - twords = 512/4; - sptr = 0; - - while (twords) - { - if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) - { - tmpword = m_dma_buffer[sptr+3]<<24 | m_dma_buffer[sptr+2]<<16 | m_dma_buffer[sptr+1]<<8 | m_dma_buffer[sptr]; - } - else - { - tmpword = m_dma_buffer[sptr]<<24 | m_dma_buffer[sptr+1]<<16 | m_dma_buffer[sptr+2]<<8 | m_dma_buffer[sptr+3]; - } - space.write_dword(wptr, tmpword); - - wptr += 4; - sptr += 4; - twords--; - } - - words -= (512/4); - } - } - - // clear DMA on the controller too - m_wd33c93->clear_dma(); - } - } - - // clear HPC3 DMA active flag - m_HPC3.nSCSI0DMACtrl &= ~HPC3_DMACTRL_ENABLE; - - // set the interrupt - int3_raise_local0_irq(INT3_LOCAL0_SCSI0); - } - else - { - int3_lower_local0_irq(INT3_LOCAL0_SCSI0); - } -} - -void ip22_state::machine_start() -{ - // SCSI init - machine().device("nvram_user")->set_base(m_RTC.nUserRAM, 0x200); - machine().device("nvram")->set_base(m_RTC.nRAM, 0x200); -} - -DRIVER_INIT_MEMBER(ip22_state,ip225015) -{ - // IP22 uses 2 pieces of PC-compatible hardware: the 8042 PS/2 keyboard/mouse - // interface and the 8254 PIT. Both are licensed cores embedded in the IOC custom chip. - m_nIOC_ParReadCnt = 0; -} - -static INPUT_PORTS_START( ip225015 ) - PORT_START("IN0") // unused IN0 - PORT_START("DSW0") // unused IN1 - PORT_START("DSW1") // unused IN2 - PORT_START("DSW2") // unused IN3 - PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ -INPUT_PORTS_END - -void ip22_state::rtc_update() -{ - RTC_SECONDS++; - - switch( RTC_REGISTERB & 0x04 ) - { - case 0x00: /* Non-BCD */ - if( RTC_SECONDS == 60 ) - { - RTC_SECONDS = 0; - RTC_MINUTES++; - } - if( RTC_MINUTES == 60 ) - { - RTC_MINUTES = 0; - RTC_HOURS++; - } - if( RTC_HOURS == 24 ) - { - RTC_HOURS = 0; - RTC_DAYOFMONTH++; - } - RTC_SECONDS_A = RTC_SECONDS; - RTC_MINUTES_A = RTC_MINUTES; - RTC_HOURS_A = RTC_HOURS; - break; - case 0x04: /* BCD */ - if( ( RTC_SECONDS & 0x0f ) == 0x0a ) - { - RTC_SECONDS -= 0x0a; - RTC_SECONDS += 0x10; - } - if( ( RTC_SECONDS & 0xf0 ) == 0x60 ) - { - RTC_SECONDS -= 0x60; - RTC_MINUTES++; - } - if( ( RTC_MINUTES & 0x0f ) == 0x0a ) - { - RTC_MINUTES -= 0x0a; - RTC_MINUTES += 0x10; - } - if( ( RTC_MINUTES & 0xf0 ) == 0x60 ) - { - RTC_MINUTES -= 0x60; - RTC_HOURS++; - } - if( ( RTC_HOURS & 0x0f ) == 0x0a ) - { - RTC_HOURS -= 0x0a; - RTC_HOURS += 0x10; - } - if( RTC_HOURS == 0x24 ) - { - RTC_HOURS = 0; - RTC_DAYOFMONTH++; - } - RTC_SECONDS_A = RTC_SECONDS; - RTC_MINUTES_A = RTC_MINUTES; - RTC_HOURS_A = RTC_HOURS; - break; - } -} - -INTERRUPT_GEN_MEMBER(ip22_state::ip22_vbl) -{ - m_nIntCounter++; -// if( m_nIntCounter == 60 ) - { - m_nIntCounter = 0; - rtc_update(); - } -} - -#if 0 -static const mips3_config config = -{ - 32768, /* code cache size */ - 32768 /* data cache size */ -}; -#endif - -static MACHINE_CONFIG_FRAGMENT( cdrom_config ) - MCFG_DEVICE_MODIFY( "cdda" ) - MCFG_SOUND_ROUTE( 0, "^^^^lspeaker", 1.0 ) - MCFG_SOUND_ROUTE( 1, "^^^^rspeaker", 1.0 ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ip225015, ip22_state ) - MCFG_CPU_ADD( "maincpu", R5000BE, 50000000*3 ) - MCFG_CPU_CONFIG( config ) - MCFG_CPU_PROGRAM_MAP( ip225015_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", ip22_state, ip22_vbl) - - - MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_NVRAM_ADD_0FILL("nvram_user") - - MCFG_DEVICE_ADD("pit8254", PIT8254, 0) - MCFG_PIT8253_CLK0(1000000) - MCFG_PIT8253_CLK1(1000000) - MCFG_PIT8253_CLK2(1000000) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("kbdc", kbdc8042_device, write_out2)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE( 60 ) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1280+64, 1024+64) - MCFG_SCREEN_VISIBLE_AREA(0, 1279, 0, 1023) - MCFG_SCREEN_UPDATE_DEVICE("newport", newport_video_device, screen_update) - - MCFG_PALETTE_ADD("palette", 65536) - - MCFG_NEWPORT_ADD("newport") - - MCFG_DEVICE_ADD("sgi_mc", SGI_MC, 0) - - MCFG_DEVICE_ADD("lpt_0", PC_LPT, 0) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD( "dac", DAC, 0 ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_1) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "cdrom", SCSICD, SCSI_ID_4) - MCFG_SLOT_OPTION_MACHINE_CONFIG("cdrom", cdrom_config) - - MCFG_DEVICE_ADD("wd33c93", WD33C93, 0) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_WD33C93_IRQ_CB(WRITELINE(ip22_state,scsi_irq)) - - MCFG_DEVICE_ADD("kbdc", KBDC8042, 0) - MCFG_KBDC8042_KEYBOARD_TYPE(KBDC8042_STANDARD) - MCFG_KBDC8042_SYSTEM_RESET_CB(INPUTLINE("maincpu", INPUT_LINE_RESET)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ip224613, ip225015 ) - MCFG_CPU_REPLACE( "maincpu", R4600BE, 133333333 ) - MCFG_CPU_CONFIG( config ) - MCFG_CPU_PROGRAM_MAP( ip225015_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", ip22_state, ip22_vbl) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ip244415, ip225015 ) - MCFG_CPU_REPLACE( "maincpu", R4600BE, 150000000 ) - MCFG_CPU_CONFIG( config ) - MCFG_CPU_PROGRAM_MAP( ip225015_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", ip22_state, ip22_vbl) -MACHINE_CONFIG_END - -ROM_START( ip225015 ) - ROM_REGION( 0x80000, "user1", 0 ) - ROM_LOAD( "ip225015.bin", 0x000000, 0x080000, CRC(aee5502e) SHA1(9243fef0a3508790651e0d6d2705c887629b1280) ) -ROM_END - -ROM_START( ip224613 ) - ROM_REGION( 0x80000, "user1", 0 ) - ROM_LOAD( "ip224613.bin", 0x000000, 0x080000, CRC(f1868b5b) SHA1(0dcbbd776e671785b9b65f3c6dbd609794a40157) ) -ROM_END - -ROM_START( ip244415 ) - ROM_REGION( 0x80000, "user1", 0 ) - ROM_LOAD( "ip244415.bin", 0x000000, 0x080000, CRC(2f37825a) SHA1(0d48c573b53a307478820b85aacb57b868297ca3) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1993, ip225015, 0, 0, ip225015, ip225015, ip22_state, ip225015, "Silicon Graphics Inc", "Indy (R5000, 150MHz)", MACHINE_NOT_WORKING ) -COMP( 1993, ip224613, 0, 0, ip224613, ip225015, ip22_state, ip225015, "Silicon Graphics Inc", "Indy (R4600, 133MHz)", MACHINE_NOT_WORKING ) -COMP( 1994, ip244415, 0, 0, ip244415, ip225015, ip22_state, ip225015, "Silicon Graphics Inc", "Indigo2 (R4400, 150MHz)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/ipc.c b/src/mess/drivers/ipc.c deleted file mode 100644 index 672b3b1c354..00000000000 --- a/src/mess/drivers/ipc.c +++ /dev/null @@ -1,140 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Intel iPB and iPC - - 17/12/2009 Skeleton driver. - - 22/04/2011 Connected to a terminal, it responds. Modernised. - - --> When started, you must press Space, then it will start to work. - - Monitor commands: - A - Dn n - dump memory - E - Fn n n - fill memory - G - Hn n - hex arithmetic - Mn n n - move (copy) memory block - N - Q - R - Sn - modify a byte of memory - W - display memory in Intel? format - X - show and modify registers - - - Preliminary Memory Map - E800-F7FF BIOS ROM area - F800-FFFF Monitor ROM (or other user interface) - - I/O F4/F5 main console input and output - I/O F6/F7 alternate console input - - ToDo: - - Everything! - - iPC - Find missing rom F800-FFFF - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class ipc_state : public driver_device -{ -public: - ipc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER( ipc_f4_r ); - DECLARE_READ8_MEMBER( ipc_f5_r ); - DECLARE_WRITE8_MEMBER( kbd_put ); - UINT8 *m_ram; - UINT8 m_term_data; - virtual void machine_reset(); -}; - -READ8_MEMBER( ipc_state::ipc_f4_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -// bit 0 high = ok to send to terminal; bit 1 high = key is pressed -READ8_MEMBER( ipc_state::ipc_f5_r ) -{ - return (m_term_data) ? 3 : 1; -} - - -static ADDRESS_MAP_START(ipc_mem, AS_PROGRAM, 8, ipc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xdfff) AM_RAM - AM_RANGE(0xe800, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ipc_io, AS_IO, 8, ipc_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf4, 0xf4) AM_READ(ipc_f4_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0xf5, 0xf5) AM_READ(ipc_f5_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ipc ) -INPUT_PORTS_END - - -void ipc_state::machine_reset() -{ - m_maincpu->set_state_int(I8085_PC, 0xE800); -} - -WRITE8_MEMBER( ipc_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( ipc, ipc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8085A, XTAL_19_6608MHz / 4) - MCFG_CPU_PROGRAM_MAP(ipc_mem) - MCFG_CPU_IO_MAP(ipc_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ipc_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ipb ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ipb_e8_v1.3.bin", 0xe800, 0x0800, CRC(fc9d4703) SHA1(2ce078e1bcd8b24217830c54bcf04c5d146d1b76) ) - ROM_LOAD( "ipb_f8_v1.3.bin", 0xf800, 0x0800, CRC(966ba421) SHA1(d6a904c7d992a05ed0f451d7d34c1fc8de9547ee) ) -ROM_END - -ROM_START( ipc ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ipc_u82_v1.3_104584-001.bin", 0xe800, 0x1000, CRC(0889394f) SHA1(b7525baf1884a7d67402dea4b5566016a9861ef2) ) - - // required rom is missing. Using this one from 'ipb' for now. - ROM_LOAD( "ipb_f8_v1.3.bin", 0xf800, 0x0800, BAD_DUMP CRC(966ba421) SHA1(d6a904c7d992a05ed0f451d7d34c1fc8de9547ee) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, ipb, 0, 0, ipc, ipc, driver_device, 0, "Intel", "iPB", MACHINE_NO_SOUND) -COMP( 19??, ipc, ipb, 0, ipc, ipc, driver_device, 0, "Intel", "iPC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/ipds.c b/src/mess/drivers/ipds.c deleted file mode 100644 index 4b25d00bebc..00000000000 --- a/src/mess/drivers/ipds.c +++ /dev/null @@ -1,168 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Intel iPDS - - 17/12/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "video/i8275.h" -#include "machine/keyboard.h" - -#define KEYBOARD_TAG "keyboard" - -class ipds_state : public driver_device -{ -public: - ipds_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "i8275"), - m_palette(*this, "palette") - { - } - - required_device m_maincpu; - required_device m_crtc; - required_device m_palette; - DECLARE_READ8_MEMBER(ipds_b0_r); - DECLARE_READ8_MEMBER(ipds_b1_r); - DECLARE_READ8_MEMBER(ipds_c0_r); - DECLARE_WRITE8_MEMBER(ipds_b1_w); - DECLARE_WRITE8_MEMBER(kbd_put); - I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); - UINT8 m_term_data; - virtual void machine_reset(); -}; - -READ8_MEMBER( ipds_state::ipds_b0_r ) -{ - if (m_term_data) - return 0xc0; - else - return 0x80; -} - -READ8_MEMBER( ipds_state::ipds_b1_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( ipds_state::ipds_c0_r ) { return 0x55; } - -WRITE8_MEMBER( ipds_state::ipds_b1_w ) -{ -} - -static ADDRESS_MAP_START(ipds_mem, AS_PROGRAM, 8, ipds_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ipds_io, AS_IO, 8, ipds_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xb0, 0xb0) AM_READ(ipds_b0_r) - AM_RANGE(0xb1, 0xb1) AM_READWRITE(ipds_b1_r,ipds_b1_w) - AM_RANGE(0xc0, 0xc0) AM_READ(ipds_c0_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ipds ) -INPUT_PORTS_END - -void ipds_state::machine_reset() -{ -} - -I8275_DRAW_CHARACTER_MEMBER( ipds_state::crtc_display_pixels ) -{ - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 *charmap = memregion("chargen")->base(); - UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; - - if (vsp) - pixels = 0; - - if (lten) - pixels = 0xff; - - if (rvv) - pixels ^= 0xff; - - for(i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; -} - -/* F4 Character Displayer */ -static const gfx_layout ipds_charlayout = -{ - 8, 11, /* 8 x 11 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( ipds ) - GFXDECODE_ENTRY( "chargen", 0x0000, ipds_charlayout, 0, 1 ) -GFXDECODE_END - - -WRITE8_MEMBER( ipds_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( ipds, ipds_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8085A, XTAL_19_6608MHz / 4) - MCFG_CPU_PROGRAM_MAP(ipds_mem) - MCFG_CPU_IO_MAP(ipds_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ipds) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_DEVICE_ADD("i8275", I8275, XTAL_19_6608MHz / 4) - MCFG_I8275_CHARACTER_WIDTH(6) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(ipds_state, crtc_display_pixels) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(ipds_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ipds ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "164180.bin", 0x0000, 0x0800, CRC(10ba23ce) SHA1(67a9d03a08cdd7c70a867fb7e069703c7a0b9094) ) - - ROM_REGION( 0x10000, "slavecpu", ROMREGION_ERASEFF ) - ROM_LOAD( "164196.bin", 0x0000, 0x1000, CRC(d3e18bc6) SHA1(01bc233be154bdfea9e8015839c5885cdaa08f11) ) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "163642.bin", 0x0000, 0x0800, CRC(3d81b2d1) SHA1(262a42920f15f1156ad0717c876cc0b2ed947ec5) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, ipds, 0, 0, ipds, ipds, driver_device, 0, "Intel", "iPDS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/iq151.c b/src/mess/drivers/iq151.c deleted file mode 100644 index f6acd08bdd4..00000000000 --- a/src/mess/drivers/iq151.c +++ /dev/null @@ -1,476 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - IQ-151 - - 12/05/2009 Skeleton driver. - - 07/June/2011 Added screen & keyboard (by looking at the Z80 code) - - -This computer depends on RAM just happening to be certain values at powerup. -If the conditions are not met, it may crash. - -Monitor Commands: -C Call (address) -D Dump memory, any key to dump more, Return to finish -F Fill memory (start, end, withwhat) -G Goto (address) -L Cassette load -M Move (source start, source end, destination) -R Run -S Edit memory -W Cassette save (start, end, goto (0 for null)) -X Display/Edit registers - - -ToDo: -- Add whatever devices may exist. - -- Line 32 does not scroll, should it show? - (could be reserved for a status line in a terminal mode) - -- Note that the system checks for 3E at C000, if exist, jump to C000; - otherwise then checks for non-FF at C800, if so, jumps to C800. Could be - extra roms or some sort of boot device. - -- Key beep sounds better if clock speed changed to 1MHz, but it is still - highly annoying. Press Ctrl-G to hear the 2-tone bell. - -- Cassette support is tested only in the emulator (monitor, BASIC and AMOS), - needs to be tested with a real cassette dump. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/pic8259.h" -#include "machine/i8255.h" -#include "sound/speaker.h" -#include "imagedev/cassette.h" - -// cartridge slot -#include "bus/iq151/iq151.h" -#include "bus/iq151/rom.h" -#include "bus/iq151/disc2.h" -#include "bus/iq151/minigraf.h" -#include "bus/iq151/ms151a.h" -#include "bus/iq151/staper.h" -#include "bus/iq151/grafik.h" -#include "bus/iq151/video32.h" -#include "bus/iq151/video64.h" - - - -class iq151_state : public driver_device -{ -public: - iq151_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pic(*this, "pic8259"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette") - { } - - required_device m_maincpu; - required_device m_pic; - required_device m_speaker; - required_device m_cassette; - - DECLARE_READ8_MEMBER(keyboard_row_r); - DECLARE_READ8_MEMBER(keyboard_column_r); - DECLARE_READ8_MEMBER(ppi_portc_r); - DECLARE_WRITE8_MEMBER(ppi_portc_w); - DECLARE_WRITE8_MEMBER(boot_bank_w); - DECLARE_READ8_MEMBER(cartslot_r); - DECLARE_WRITE8_MEMBER(cartslot_w); - DECLARE_READ8_MEMBER(cartslot_io_r); - DECLARE_WRITE8_MEMBER(cartslot_io_w); - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - UINT8 m_vblank_irq_state; - UINT8 m_cassette_clk; - UINT8 m_cassette_data; - iq151cart_slot_device * m_carts[5]; - DECLARE_DRIVER_INIT(iq151); - INTERRUPT_GEN_MEMBER(iq151_vblank_interrupt); - DECLARE_INPUT_CHANGED_MEMBER(iq151_break); - TIMER_DEVICE_CALLBACK_MEMBER(cassette_timer); -}; - -READ8_MEMBER(iq151_state::keyboard_row_r) -{ - char kbdrow[6]; - UINT8 data = 0xff; - - for (int i = 0; i < 8; i++) - { - sprintf(kbdrow,"X%X",i); - data &= ioport(kbdrow)->read(); - } - - return data; -} - -READ8_MEMBER(iq151_state::keyboard_column_r) -{ - char kbdrow[6]; - UINT8 data = 0x00; - - for (int i = 0; i < 8; i++) - { - sprintf(kbdrow,"X%X",i); - if (ioport(kbdrow)->read() == 0xff) - data |= (1 << i); - } - - return data; -} - -READ8_MEMBER(iq151_state::ppi_portc_r) -{ - UINT8 data = 0x00; - - if (m_cassette_data & 0x06) - { - // cassette read - data |= ((m_cassette_clk & 1) << 5); - data |= (m_cassette->input() > 0.00 ? 0x80 : 0x00); - } - else - { - // kb read - data = ioport("X8")->read(); - } - - return (data & 0xf0) | (m_cassette_data & 0x0f); -} - - -WRITE8_MEMBER(iq151_state::ppi_portc_w) -{ - m_speaker->level_w(BIT(data, 3)); - m_cassette_data = data; -} - -WRITE8_MEMBER(iq151_state::boot_bank_w) -{ - membank("boot")->set_entry(data & 1); -} - - -//************************************************************************** -// Cartridge slot emulation -//************************************************************************** - -READ8_MEMBER(iq151_state::cartslot_r) -{ - UINT8 data = 0xff; - - for (int i=0; i<5; i++) - m_carts[i]->read(offset, data); - - return data; -} - -WRITE8_MEMBER(iq151_state::cartslot_w) -{ - for (int i=0; i<5; i++) - m_carts[i]->write(offset, data); -} - -READ8_MEMBER(iq151_state::cartslot_io_r) -{ - UINT8 data = 0xff; - - for (int i=0; i<5; i++) - m_carts[i]->io_read(offset, data); - - return data; -} - -WRITE8_MEMBER(iq151_state::cartslot_io_w) -{ - for (int i=0; i<5; i++) - m_carts[i]->io_write(offset, data); -} - -static ADDRESS_MAP_START(iq151_mem, AS_PROGRAM, 8, iq151_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("boot") - AM_RANGE( 0x0800, 0x7fff ) AM_RAM - AM_RANGE( 0xf000, 0xffff ) AM_ROM - - AM_RANGE( 0x0000, 0xffff ) AM_READWRITE(cartslot_r, cartslot_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(iq151_io, AS_IO, 8, iq151_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x80, 0x80 ) AM_WRITE(boot_bank_w) - AM_RANGE( 0x84, 0x87 ) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) - AM_RANGE( 0x88, 0x89 ) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) - - AM_RANGE( 0x00, 0xff ) AM_READWRITE(cartslot_io_r, cartslot_io_w) -ADDRESS_MAP_END - - -INPUT_CHANGED_MEMBER(iq151_state::iq151_break) -{ - m_pic->ir5_w(newval & 1); -} - -/* Input ports */ -static INPUT_PORTS_START( iq151 ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DL") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("IL") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_END) // its actually some sort of graphic character - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("X8") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FA") PORT_CODE(KEYCODE_RSHIFT) // Function A - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FB") PORT_CODE(KEYCODE_RCONTROL) // Function B - - PORT_START("BREAK") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, iq151_state, iq151_break, 0) PORT_CHAR(UCHAR_MAMEKEY(ESC)) -INPUT_PORTS_END - - -INTERRUPT_GEN_MEMBER(iq151_state::iq151_vblank_interrupt) -{ - m_pic->ir6_w(m_vblank_irq_state & 1); - m_vblank_irq_state ^= 1; -} - -TIMER_DEVICE_CALLBACK_MEMBER(iq151_state::cassette_timer) -{ - m_cassette_clk ^= 1; - - m_cassette->output((m_cassette_data & 1) ^ (m_cassette_clk & 1) ? +1 : -1); -} - -DRIVER_INIT_MEMBER(iq151_state,iq151) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entry(0, RAM + 0xf800); - membank("boot")->configure_entry(1, RAM + 0x0000); - - // keep machine pointers to slots - m_carts[0] = machine().device("slot1"); - m_carts[1] = machine().device("slot2"); - m_carts[2] = machine().device("slot3"); - m_carts[3] = machine().device("slot4"); - m_carts[4] = machine().device("slot5"); -} - -void iq151_state::machine_reset() -{ - membank("boot")->set_entry(0); - - m_vblank_irq_state = 0; -} - -// this machine don't have a built-in video controller, but uses external cartridge -UINT32 iq151_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0, cliprect); - - for (int i=0; i<5; i++) - m_carts[i]->video_update(bitmap, cliprect); - - return 0; -} - -static SLOT_INTERFACE_START(iq151_cart) - SLOT_INTERFACE("video32", IQ151_VIDEO32) // video32 - SLOT_INTERFACE("video64", IQ151_VIDEO64) // video64 - SLOT_INTERFACE("grafik" , IQ151_GRAFIK) // Grafik - SLOT_INTERFACE("disc2" , IQ151_DISC2) // Disc 2 - SLOT_INTERFACE("minigraf" , IQ151_MINIGRAF) // Aritma Minigraf 0507 - SLOT_INTERFACE("ms151a" , IQ151_MS151A) // MS151A XY Plotter - SLOT_INTERFACE("staper" , IQ151_STAPER) // STAPER - SLOT_INTERFACE("basic6" , IQ151_BASIC6) // BASIC6 - SLOT_INTERFACE("basicg" , IQ151_BASICG) // BASICG - SLOT_INTERFACE("amos1" , IQ151_AMOS1) // AMOS cart 1 - SLOT_INTERFACE("amos2" , IQ151_AMOS2) // AMOS cart 2 - SLOT_INTERFACE("amos3" , IQ151_AMOS3) // AMOS cart 3 -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( iq151, iq151_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(iq151_mem) - MCFG_CPU_IO_MAP(iq151_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", iq151_state, iq151_vblank_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(iq151_state, screen_update) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 32*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(iq151_state, keyboard_row_r)) - MCFG_I8255_IN_PORTB_CB(READ8(iq151_state, keyboard_column_r)) - MCFG_I8255_IN_PORTC_CB(READ8(iq151_state, ppi_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(iq151_state, ppi_portc_w)) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) - MCFG_CASSETTE_INTERFACE("iq151_cass") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", iq151_state, cassette_timer, attotime::from_hz(2000)) - - /* cartridge */ - MCFG_DEVICE_ADD("slot1", IQ151CART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, NULL, false) - MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) - MCFG_DEVICE_ADD("slot2", IQ151CART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, NULL, false) - MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) - MCFG_DEVICE_ADD("slot3", IQ151CART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, NULL, false) - MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) - MCFG_DEVICE_ADD("slot4", IQ151CART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, NULL, false) - MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) - MCFG_DEVICE_ADD("slot5", IQ151CART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(iq151_cart, "video32", false) - MCFG_IQ151CART_SLOT_OUT_IRQ0_CB(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ1_CB(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - MCFG_IQ151CART_SLOT_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "iq151_cart") - MCFG_SOFTWARE_LIST_ADD("flop_list", "iq151_flop") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( iq151 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE ) - /* A number of bios versions here. The load address is shown for each */ - ROM_SYSTEM_BIOS( 0, "orig", "Original" ) - ROMX_LOAD( "iq151_monitor_orig.rom", 0xf000, 0x1000, CRC(acd10268) SHA1(4d75c73f155ed4dc2ac51a9c22232f869cca95e2),ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "disasm", "Disassembler" ) - ROMX_LOAD( "iq151_monitor_disasm.rom", 0xf000, 0x1000, CRC(45c2174e) SHA1(703e3271a124c3ef9330ae399308afd903316ab9),ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "cpm", "CPM" ) - ROMX_LOAD( "iq151_monitor_cpm.rom", 0xf000, 0x1000, CRC(26f57013) SHA1(4df396edc375dd2dd3c82c4d2affb4f5451066f1),ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "cpmold", "CPM (old)" ) - ROMX_LOAD( "iq151_monitor_cpm_old.rom", 0xf000, 0x1000, CRC(6743e1b7) SHA1(ae4f3b1ba2511a1f91c4e8afdfc0e5aeb0fb3a42),ROM_BIOS(4)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, iq151, 0, 0, iq151, iq151, iq151_state, iq151, "ZPA Novy Bor", "IQ-151", 0 ) diff --git a/src/mess/drivers/irisha.c b/src/mess/drivers/irisha.c deleted file mode 100644 index be633aa7bce..00000000000 --- a/src/mess/drivers/irisha.c +++ /dev/null @@ -1,441 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Irisha driver by Miodrag Milanovic - - 2008-03-27 Preliminary driver. - - Jump addresses: - Option 1: 0800 (Monitor - the only choice that works) - Option 2: 046E - Option 3: 0423 (then jumps to 4000) - Option 4: 0501 - Option 5: 042E - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/i8251.h" -#include "sound/speaker.h" - -class irisha_state : public driver_device -{ -public: - irisha_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_pit(*this, "pit8253"), - m_speaker(*this, "speaker"), - m_uart(*this, "uart") - { - } - - DECLARE_READ8_MEMBER(irisha_keyboard_r); - DECLARE_READ8_MEMBER(irisha_8255_portb_r); - DECLARE_READ8_MEMBER(irisha_8255_portc_r); - DECLARE_WRITE8_MEMBER(irisha_8255_porta_w); - DECLARE_WRITE8_MEMBER(irisha_8255_portb_w); - DECLARE_WRITE8_MEMBER(irisha_8255_portc_w); - DECLARE_WRITE_LINE_MEMBER(speaker_w); - DECLARE_WRITE_LINE_MEMBER(write_uart_clock); - TIMER_CALLBACK_MEMBER(irisha_key); - DECLARE_WRITE_LINE_MEMBER(irisha_pic_set_int_line); - UINT32 screen_update_irisha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; - -private: - bool m_sg1_line; - bool m_keypressed; - UINT8 m_keyboard_cnt; - UINT8 m_ppi_porta; - UINT8 m_ppi_portc; - void update_speaker(); - virtual void machine_start(); - virtual void machine_reset(); - ioport_port *m_io_ports[10]; - required_device m_maincpu; - required_device m_pit; - required_device m_speaker; - required_device m_uart; -}; - - -/* Address maps */ -static ADDRESS_MAP_START(irisha_mem, AS_PROGRAM, 8, irisha_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM // ROM - AM_RANGE(0x4000, 0xdfff) AM_RAM // RAM - AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( irisha_io , AS_IO, 8, irisha_state ) - AM_RANGE(0x04, 0x05) AM_READ(irisha_keyboard_r) - AM_RANGE(0x06, 0x06) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) - AM_RANGE(0x07, 0x07) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x08, 0x0B) AM_DEVREADWRITE("pit8253", pit8253_device, read, write ) - AM_RANGE(0x0C, 0x0F) AM_DEVREADWRITE("pic8259", pic8259_device, read, write ) AM_MASK( 0x01 ) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( irisha ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('\xA6') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) // - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) -INPUT_PORTS_END - -/************************************************* - - Video - -*************************************************/ - -UINT32 irisha_state::screen_update_irisha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 gfx; - UINT16 y,ma=0,x; - UINT16 *p; - - for (y = 0; y < 200; y++) - { - p = &bitmap.pix16(y); - - for (x = ma; x < ma+40; x++) - { - gfx = m_p_videoram[x]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - ma+=40; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout irisha_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( irisha ) - GFXDECODE_ENTRY( "maincpu", 0x3800, irisha_charlayout, 0, 1 ) -GFXDECODE_END - - -/************************************************* - - i8255 - -*************************************************/ - -READ8_MEMBER(irisha_state::irisha_8255_portb_r) -{ - if (m_keypressed==1) - { - m_keypressed = 0; - return 0x80; - } - - return 0x00; -} - -READ8_MEMBER(irisha_state::irisha_8255_portc_r) -{ - logerror("irisha_8255_portc_r\n"); - return 0; -} - -WRITE8_MEMBER(irisha_state::irisha_8255_porta_w) -{ - logerror("irisha_8255_porta_w %02x\n",data); - - m_ppi_porta = data; - - update_speaker(); -} - -WRITE8_MEMBER(irisha_state::irisha_8255_portb_w) -{ - logerror("irisha_8255_portb_w %02x\n",data); -} - -WRITE8_MEMBER(irisha_state::irisha_8255_portc_w) -{ - //logerror("irisha_8255_portc_w %02x\n",data); - - if BIT(data, 6) - m_pit->write_gate2((BIT(m_ppi_porta, 5) && !BIT(data, 5)) ? 1 : 0); - - m_ppi_portc = data; - - update_speaker(); -} - -/************************************************* - - i8259 - -*************************************************/ - -WRITE_LINE_MEMBER(irisha_state::irisha_pic_set_int_line) -{ - m_maincpu->set_input_line(0, state ? HOLD_LINE : CLEAR_LINE); -} - - -/************************************************* - - Sound - -*************************************************/ - -void irisha_state::update_speaker() -{ - int level = ( (BIT(m_ppi_portc, 5)) || (BIT(m_ppi_porta, 4)) || !m_sg1_line) ? 1 : 0; - - m_speaker->level_w(level); -} - - -WRITE_LINE_MEMBER(irisha_state::speaker_w) -{ - m_sg1_line = state; - update_speaker(); -} - - -/************************************************* - - Keyboard - -*************************************************/ - -TIMER_CALLBACK_MEMBER(irisha_state::irisha_key) -{ - m_keypressed = 1; - m_keyboard_cnt = 0; -} - -READ8_MEMBER(irisha_state::irisha_keyboard_r) -{ - UINT8 keycode; - - if (m_keyboard_cnt!=0 && m_keyboard_cnt<11) - keycode = m_io_ports[m_keyboard_cnt-1]->read() ^ 0xff; - else - keycode = 0xff; - - m_keyboard_cnt++; - - return keycode; -} - -WRITE_LINE_MEMBER(irisha_state::write_uart_clock) -{ - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - - -/************************************************* - - Machine - -*************************************************/ - -void irisha_state::machine_start() -{ - static const char *const keynames[] = { - "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", - "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" - }; - - for ( UINT8 i = 0; i < 10; i++ ) - m_io_ports[i] = ioport( keynames[i] ); - - machine().scheduler().timer_pulse(attotime::from_msec(30), timer_expired_delegate(FUNC(irisha_state::irisha_key),this)); -} - -void irisha_state::machine_reset() -{ - m_sg1_line = 0; - m_keypressed = 0; - m_keyboard_cnt = 0; - m_ppi_porta = 0; - m_ppi_portc = 0; -} - -/* Machine driver */ -static MACHINE_CONFIG_START( irisha, irisha_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, XTAL_16MHz / 9) - MCFG_CPU_PROGRAM_MAP(irisha_mem) - MCFG_CPU_IO_MAP(irisha_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(irisha_state, screen_update_irisha) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", irisha) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("uart", I8251, 0) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_16MHz / 9) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_16MHz / 9 / 8 / 8) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(irisha_state, write_uart_clock)) - MCFG_PIT8253_CLK2(XTAL_16MHz / 9) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(irisha_state, speaker_w)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(irisha_state, irisha_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(irisha_state, irisha_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(irisha_state, irisha_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(irisha_state, irisha_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(irisha_state, irisha_8255_portc_w)) - - MCFG_PIC8259_ADD( "pic8259", WRITELINE(irisha_state,irisha_pic_set_int_line), VCC, NULL ) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( irisha ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ir_bootm.bin", 0x0000, 0x2000, CRC(7f9f4f0e) SHA1(05f97e1a1d7a15f4451129dba6c0bddc87ea748e)) - ROM_LOAD( "ir_conou.bin", 0x2000, 0x2000, CRC(bf92beed) SHA1(696c482ba53bc6261db11061ecc7141c67f1d820)) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, irisha, 0, 0, irisha, irisha, driver_device, 0, "MGU", "Irisha", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/isbc.c b/src/mess/drivers/isbc.c deleted file mode 100644 index d7a9ba149e0..00000000000 --- a/src/mess/drivers/isbc.c +++ /dev/null @@ -1,367 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Intel iSBC series - - 09/12/2009 Skeleton driver. - -Notes: - -isbc86 commands: BYTE WORD REAL EREAL ROMTEST. ROMTEST works, the others hang. - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/i86/i86.h" -#include "cpu/i86/i286.h" -#include "machine/terminal.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "machine/z80dart.h" -#include "bus/centronics/ctronics.h" -#include "bus/isbx/isbx.h" -#include "machine/isbc_215g.h" - -class isbc_state : public driver_device -{ -public: - isbc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_uart8251(*this, "uart8251"), - m_uart8274(*this, "uart8274"), - m_pic_0(*this, "pic_0"), - m_pic_1(*this, "pic_1"), - m_centronics(*this, "centronics"), - m_cent_status_in(*this, "cent_status_in") - { - } - - required_device m_maincpu; - optional_device m_uart8251; - optional_device m_uart8274; - required_device m_pic_0; - optional_device m_pic_1; - optional_device m_centronics; - optional_device m_cent_status_in; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - - DECLARE_WRITE_LINE_MEMBER(isbc86_tmr2_w); - DECLARE_WRITE_LINE_MEMBER(isbc286_tmr2_w); - DECLARE_WRITE_LINE_MEMBER(isbc_uart8274_irq); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE8_MEMBER(ppi_c_w); -}; - -static ADDRESS_MAP_START(rpc86_mem, AS_PROGRAM, 16, isbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x3ffff) AM_RAM - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(rpc86_io, AS_IO, 16, isbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0080, 0x008f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) - AM_RANGE(0x0090, 0x009f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) - AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) - AM_RANGE(0x00b0, 0x00bf) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) - AM_RANGE(0x00c0, 0x00c3) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x00c4, 0x00c7) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x00c8, 0x00cf) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) - AM_RANGE(0x00d0, 0x00d7) AM_DEVREADWRITE8("pit", pit8253_device, read, write, 0x00ff) - AM_RANGE(0x00d8, 0x00d9) AM_DEVREADWRITE8("uart8251", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0x00da, 0x00db) AM_DEVREADWRITE8("uart8251", i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0x00dc, 0x00dd) AM_DEVREADWRITE8("uart8251", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0x00de, 0x00df) AM_DEVREADWRITE8("uart8251", i8251_device, status_r, control_w, 0x00ff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(isbc86_mem, AS_PROGRAM, 16, isbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0xfbfff) AM_RAM - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(isbc_io, AS_IO, 16, isbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00c0, 0x00c3) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x00c4, 0x00c7) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x00c8, 0x00cf) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) - AM_RANGE(0x00d0, 0x00d7) AM_DEVREADWRITE8("pit", pit8253_device, read, write, 0x00ff) - AM_RANGE(0x00d8, 0x00d9) AM_DEVREADWRITE8("uart8251", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0x00da, 0x00db) AM_DEVREADWRITE8("uart8251", i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0x00dc, 0x00dd) AM_DEVREADWRITE8("uart8251", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0x00de, 0x00df) AM_DEVREADWRITE8("uart8251", i8251_device, status_r, control_w, 0x00ff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(isbc286_io, AS_IO, 16, isbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0080, 0x008f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) - AM_RANGE(0x0080, 0x008f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs0_r, mcs0_w, 0xff00) - AM_RANGE(0x0090, 0x009f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) - AM_RANGE(0x0090, 0x009f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs1_r, mcs1_w, 0xff00) - AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) - AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs0_r, mcs0_w, 0xff00) - AM_RANGE(0x00b0, 0x00bf) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) - AM_RANGE(0x00b0, 0x00bf) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs1_r, mcs1_w, 0xff00) - AM_RANGE(0x00c0, 0x00c3) AM_DEVREADWRITE8("pic_0", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x00c4, 0x00c7) AM_DEVREADWRITE8("pic_1", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x00c8, 0x00cf) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) - AM_RANGE(0x00d0, 0x00d7) AM_DEVREADWRITE8("pit", pit8254_device, read, write, 0x00ff) - AM_RANGE(0x00d8, 0x00df) AM_DEVREADWRITE8("uart8274", i8274_device, cd_ba_r, cd_ba_w, 0x00ff) - AM_RANGE(0x0100, 0x0101) AM_DEVWRITE8("isbc_215g", isbc_215g_device, write, 0x00ff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(isbc286_mem, AS_PROGRAM, 16, isbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0xdffff) AM_RAM - AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION("user1",0) - AM_RANGE(0xfe0000, 0xffffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(isbc2861_mem, AS_PROGRAM, 16, isbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0xdffff) AM_RAM - AM_RANGE(0xf0000, 0xfffff) AM_ROM AM_REGION("user1",0) - AM_RANGE(0xff0000, 0xffffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( isbc ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START( isbc86_terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_300 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_300 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) -DEVICE_INPUT_DEFAULTS_END - -static DEVICE_INPUT_DEFAULTS_START( isbc286_terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -WRITE_LINE_MEMBER( isbc_state::isbc86_tmr2_w ) -{ - m_uart8251->write_rxc(state); - m_uart8251->write_txc(state); -} - -READ8_MEMBER( isbc_state::get_slave_ack ) -{ - if (offset == 7) - return m_pic_1->acknowledge(); - - return 0x00; -} - -WRITE_LINE_MEMBER( isbc_state::isbc286_tmr2_w ) -{ - m_uart8274->rxca_w(state); - m_uart8274->txca_w(state); -} - -WRITE_LINE_MEMBER( isbc_state::write_centronics_ack ) -{ - m_cent_status_in->write_bit4(state); - - if(state) - m_pic_1->ir7_w(1); -} - -WRITE8_MEMBER( isbc_state::ppi_c_w ) -{ - m_centronics->write_strobe(data & 1); - - if(data & 0x80) - m_pic_1->ir7_w(0); -} - -WRITE_LINE_MEMBER(isbc_state::isbc_uart8274_irq) -{ - m_uart8274->m1_r(); // always set - m_pic_0->ir6_w(state); -} - -static MACHINE_CONFIG_START( isbc86, isbc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(isbc86_mem) - MCFG_CPU_IO_MAP(isbc_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb) - - MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, NULL) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_22_1184MHz/18) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_22_1184MHz/18) - MCFG_PIT8253_CLK2(XTAL_22_1184MHz/18) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(isbc_state, isbc86_tmr2_w)) - - MCFG_DEVICE_ADD("ppi", I8255A, 0) - - MCFG_DEVICE_ADD("uart8251", I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir6_w)) - - /* video hardware */ - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_cts)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", isbc86_terminal) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( rpc86, isbc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, XTAL_5MHz) - MCFG_CPU_PROGRAM_MAP(rpc86_mem) - MCFG_CPU_IO_MAP(rpc86_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb) - - MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, NULL) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_22_1184MHz/18) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir2_w)) - MCFG_PIT8253_CLK1(XTAL_22_1184MHz/144) - MCFG_PIT8253_CLK2(XTAL_22_1184MHz/18) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(isbc_state, isbc86_tmr2_w)) - - MCFG_DEVICE_ADD("ppi", I8255A, 0) - - MCFG_DEVICE_ADD("uart8251", I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir6_w)) - - /* video hardware */ - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - - MCFG_ISBX_SLOT_ADD("sbx1", 0, isbx_cards, NULL) - //MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_0", pic8259_device, ir3_w)) - //MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_0", pic8259_device, ir4_w)) - MCFG_ISBX_SLOT_ADD("sbx2", 0, isbx_cards, NULL) - //MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_0", pic8259_device, ir5_w)) - //MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_0", pic8259_device, ir6_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( isbc286, isbc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80286, XTAL_16MHz/2) - MCFG_CPU_PROGRAM_MAP(isbc286_mem) - MCFG_CPU_IO_MAP(isbc286_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb) - - MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, READ8(isbc_state, get_slave_ack)) - MCFG_PIC8259_ADD("pic_1", DEVWRITELINE("pic_0", pic8259_device, ir7_w), GND, NULL) - - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(XTAL_22_1184MHz/18) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_22_1184MHz/18) - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("uart8274", z80dart_device, rxtxcb_w)) - MCFG_PIT8253_CLK2(XTAL_22_1184MHz/18) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(isbc_state, isbc286_tmr2_w)) - - MCFG_DEVICE_ADD("ppi", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_IN_PORTB_CB(DEVREAD8("cent_status_in", input_buffer_device, read)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(isbc_state, ppi_c_w)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(isbc_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) - MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit6)) - - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_I8274_ADD("uart8274", XTAL_16MHz/4, 0, 0, 0, 0) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232a", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232a", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232a", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(WRITELINE(isbc_state, isbc_uart8274_irq)) - - MCFG_RS232_PORT_ADD("rs232a", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8274", z80dart_device, ctsa_w)) - - MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, dcdb_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8274", z80dart_device, ctsb_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", isbc286_terminal) - - MCFG_ISBX_SLOT_ADD("sbx1", 0, isbx_cards, NULL) - MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir3_w)) - MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir4_w)) - MCFG_ISBX_SLOT_ADD("sbx2", 0, isbx_cards, NULL) - MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir5_w)) - MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir6_w)) - - MCFG_ISBC_215_ADD("isbc_215g", 0x100, "maincpu") - MCFG_ISBC_215_IRQ(DEVWRITELINE("pic_0", pic8259_device, ir5_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( isbc2861, isbc286 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(isbc2861_mem) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( isbc86 ) - ROM_REGION( 0x4000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "8612_2u.bin", 0x0001, 0x1000, CRC(84fa14cf) SHA1(783e1459ab121201fd49368d4bf769c1bab6447a)) - ROM_LOAD16_BYTE( "8612_2l.bin", 0x0000, 0x1000, CRC(922bda5f) SHA1(15743e69f3aba56425fa004d19b82ec20532fd72)) - ROM_LOAD16_BYTE( "8612_3u.bin", 0x2001, 0x1000, CRC(68d47c3e) SHA1(16c17f26b33daffa84d065ff7aefb581544176bd)) - ROM_LOAD16_BYTE( "8612_3l.bin", 0x2000, 0x1000, CRC(17f27ad2) SHA1(c3f379ac7d67dc4a0a7a611a0bc6323b8a3d4840)) -ROM_END - -ROM_START( isbc286 ) - ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "u79.bin", 0x00001, 0x10000, CRC(144182ea) SHA1(4620ca205a6ac98fe2636183eaead7c4bfaf7a72)) - ROM_LOAD16_BYTE( "u36.bin", 0x00000, 0x10000, CRC(22db075f) SHA1(fd29ea77f5fc0697c8f8b66aca549aad5b9db3ea)) -ROM_END - -ROM_START( isbc2861 ) - ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "174894-001.bin", 0x0000, 0x4000, CRC(79e4f7af) SHA1(911a4595d35e6e82b1149e75bb027927cd1c1658)) - ROM_LOAD16_BYTE( "174894-002.bin", 0x0001, 0x4000, CRC(66747d21) SHA1(4094b1f10a8bc7db8d6dd48d7128e14e875776c7)) - ROM_LOAD16_BYTE( "174894-003.bin", 0x8000, 0x4000, CRC(c98c7f17) SHA1(6e9a14aedd630824dccc5eb6052867e73b1d7db6)) - ROM_LOAD16_BYTE( "174894-004.bin", 0x8001, 0x4000, CRC(61bc1dc9) SHA1(feed5a5f0bb4630c8f6fa0d5cca30654a80b4ee5)) -ROM_END - -ROM_START( rpc86 ) - ROM_REGION( 0x4000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "145068-001.bin", 0x0001, 0x1000, CRC(0fa9db83) SHA1(4a44f8683c263c9ef6850cbe05aaa73f4d4d4e06)) - ROM_LOAD16_BYTE( "145069-001.bin", 0x2001, 0x1000, CRC(1692a076) SHA1(0ce3a4a867cb92340871bb8f9c3e91ce2984c77c)) - ROM_LOAD16_BYTE( "145070-001.bin", 0x0000, 0x1000, CRC(8c8303ef) SHA1(60f94daa76ab9dea6e309ac580152eb212b847a0)) - ROM_LOAD16_BYTE( "145071-001.bin", 0x2000, 0x1000, CRC(a49681d8) SHA1(e81f8b092cfa2d1737854b1fa270a4ce07d61a9f)) -ROM_END -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, rpc86, 0, 0, rpc86, isbc, driver_device, 0, "Intel", "RPC 86",MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1978, isbc86, 0, 0, isbc86, isbc, driver_device, 0, "Intel", "iSBC 86/12A",MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 19??, isbc286, 0, 0, isbc286, isbc, driver_device, 0, "Intel", "iSBC 286",MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1983, isbc2861, 0, 0, isbc2861, isbc, driver_device, 0, "Intel", "iSBC 286/10",MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/iskr103x.c b/src/mess/drivers/iskr103x.c deleted file mode 100644 index 31aae050f61..00000000000 --- a/src/mess/drivers/iskr103x.c +++ /dev/null @@ -1,146 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - drivers/iskr103x.c - - Driver file for Iskra-1030, 1031 - - TODO - - fix cyrillic chargen upload for CGA and MDA - - replace DIP switch definition - - keyboard test is not passing (code 301) - - hard disk is connected but untested - -***************************************************************************/ - - -#include "emu.h" - -#include "includes/genpc.h" - -#include "cpu/i86/i86.h" -#include "cpu/nec/nec.h" -#include "bus/isa/xsu_cards.h" -#include "bus/pc_kbd/keyboards.h" -#include "machine/pc_lpt.h" -#include "machine/ram.h" - -#define DBG_LOG(a,b,c) - -class iskr103x_state : public driver_device -{ -public: - iskr103x_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - required_device m_maincpu; -}; - -static ADDRESS_MAP_START( iskr1031_map, AS_PROGRAM, 16, iskr103x_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(iskr1031_io, AS_IO, 16, iskr103x_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - - -static INPUT_PORTS_START( iskr1030m ) -INPUT_PORTS_END - -static INPUT_PORTS_START( iskr1031 ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START(iskr1030m) - DEVICE_INPUT_DEFAULTS("DSW0", 0x31, 0x21) -DEVICE_INPUT_DEFAULTS_END - -static DEVICE_INPUT_DEFAULTS_START(iskr1031) - DEVICE_INPUT_DEFAULTS("DSW0", 0x30, 0x20) -DEVICE_INPUT_DEFAULTS_END - -// XXX -static MACHINE_CONFIG_START( iskr1030m, iskr103x_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 4772720) - MCFG_CPU_PROGRAM_MAP(iskr1031_map) - MCFG_CPU_IO_MAP(iskr1031_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(iskr1030m) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", iskr103x_isa8_cards, "cga_iskr1030m", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", iskr103x_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", iskr103x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", iskr103x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", iskr103x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", iskr103x_isa8_cards, NULL, false) - - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) -// MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_ISKR_1030) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( iskr1031, iskr103x_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 4772720) - MCFG_CPU_PROGRAM_MAP(iskr1031_map) - MCFG_CPU_IO_MAP(iskr1031_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb","maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(iskr1031) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", iskr103x_isa8_cards, "cga_iskr1031", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", iskr103x_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", iskr103x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", iskr103x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", iskr103x_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", iskr103x_isa8_cards, NULL, false) - -// MCFG_SOFTWARE_LIST_ADD("flop_list", "iskr1031") - - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) -// MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_ISKR_1030) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - -ROM_START( iskr1030m ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROMX_LOAD( "iskra-1030m_0.rom", 0xfc000, 0x2000, CRC(0d698e19) SHA1(2fe117c9f4f8c4b59085d5a41f919d743c425fdd), ROM_SKIP(1)) - ROMX_LOAD( "iskra-1030m_1.rom", 0xfc001, 0x2000, CRC(fe808337) SHA1(b0b7ebe14324ada8aa9a6926a82b18e80f78a257), ROM_SKIP(1)) -ROM_END - -ROM_START( iskr1031 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "v1", "v1") - ROMX_LOAD( "150-02.bin", 0xfc000, 0x2000, CRC(e33fb974) SHA1(f5f3ece67c025c0033716ff516e1a34fbeb32749), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "150-03.bin", 0xfc001, 0x2000, CRC(8c482258) SHA1(90ef48955e0df556dc06a000a797ef42ccf430c5), ROM_SKIP(1) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "v2") - ROMX_LOAD( "150-06.bin", 0xfc000, 0x2000, CRC(1adbf969) SHA1(08c0a0fc50a75e6207b1987bae389cca60893eac), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "150-07.bin", 0xfc001, 0x2000, CRC(0dc4b65a) SHA1(c96f066251a7343eac8113ea9dcb2cb12d0334d5), ROM_SKIP(1) | ROM_BIOS(2)) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1989, iskr1030m, ibm5150, 0, iskr1030m, iskr1030m, driver_device, 0, "Schetmash", "Iskra 1030M", MACHINE_NOT_WORKING) -COMP ( 1989, iskr1031, ibm5150, 0, iskr1031, iskr1031, driver_device, 0, "", "Iskra 1031", 0) diff --git a/src/mess/drivers/itt3030.c b/src/mess/drivers/itt3030.c deleted file mode 100644 index 2a006a84259..00000000000 --- a/src/mess/drivers/itt3030.c +++ /dev/null @@ -1,819 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont, Olivier Galibert -/*************************************************************************** - - ITT 3030 - - - ToDo: - - Check Beeper - - finish hooking up keyboard - - According to the manual, the keyboard is based on a 8278 ... it's nowhere to be found. The keyboard / video card has a 8741 instead of which a ROM dump exists - - serial port - - daisy chain - - ... - - - CPU Board, all ICs shown: - - |-----------------------------------------------------------------| - | | - | 74LS640N Z80_Combo 74LS138N | - | 74LS00N | - | 74LS240N 74LS74AN | - | 74LS00N | - |C 74LS240N Z80_CPU 74LS240N C| - |N 74LS74AN N| - |1 74LS241N 74LS240N 2| - | ROM_1 74LS20N 74LS38N | - | 74LS240N 74LS240N | - | 74LS04N 74LS02N | - | 74LS138N 74LS74AN | - | 74LS175N | - | 75154N 74LS156N 74LS00N | - | 74LS123N | - | 75150P 75150P 74LS175N X1 74LS00N 74LS132N | - |-----------------------------------------------------------------| - - Z80_Combo: Mostek MK3886 Z80 Combo Chip, Serial, Timer, 256 bytes RAM, Interrupt Controller - Z80_CPU: Zilog Z80A CPU - ROM_1: NEC D2716D marked "BOOTV1.2" - X1: Crystal 4,194 MHz - CN1: Bus Connector - CN2: Memory Board Connector - ----------------------------------------------------------------------------------- - - Video / Keyboard Combination board, all ICs shown: - - |-----------------------------------------------------------------| - | | - | X1 74276N MCU_1 74LS85N | - | | - | 74LS138N 74LS240 74LS240N | - | 75LS257AN 74LS166AN | - | 74LS08N 74LS85N 74LS241N | - | 75LS257AN ROM_1 C| - | 74LS132N 74LS32N 74LS240N N| - | 75LS257AN 1| - | 74LS10N 74LS08N 74LS240N | - | 75LS257AN RAM_1 | - | 74LS163AN 74LS173AN 74LS374N | - | | - | 74LS86N 74LS240N 74LS640N | - | Video_1 | - | 74LS74AN 74LS240N 74LS640N | - |-----------------------------------------------------------------| - - X1: Crystal 6 MHz - MCU_1: NEC D8741AD marked "V1.1 3030" - ROM_1: MBM 2716 marked "GB 136-0" - RAM_1: NEC D4016D - Video_1 Video-IC SND5027E, compatible with TMS9927 - ----------------------------------------------------------------------------------- - - Floppy Controller board, all ICs shown - - |-----------------------------------------------------------------| - | | - | X1 74LS51N F 74LS74AN 74LS02N MC4044P | - | D 567 | - | 74LS04N C 74LS00N 74LS01N ::: MC4024P | - | | - | 74LS00N 1 74LS74AN 74LS74AN 74LS14N C| - | 7 N| - | 74LS240N 9 74LS161N 74LS393N 74LS74AN 1| - | 1 | - | 74LS132N 74LS14N 74LS14N 74LS374N | - | | - | 74LS123N 74LS04N 74LS163N 74LS14N 74LS241N | - | | - | 74LS393N 74LS138 74LS175N 74LS85N 74LS645N | - | | - |-----------------------------------------------------------------| - - X1: Crystal 8 MHz - FDC: Siemens SAB1791-02P - 567: Jumper Pad (emtpy) - ----------------------------------------------------------------------------------- - - 256K RAM board, all ICs shown: - - |-----------------------------------------------------------------| - | | - | HM4864P HM4864P HM4864P HM4864P 74LS245N | - | | - | HM4864P HM4864P HM4864P HM4864P P 74LS14N | - | R | - | HM4864P HM4864P HM4864P HM4864P M 74LS00N | - | C| - | HM4864P HM4864P HM4864P HM4864P AM A N| - | 29 M 1| - | HM4864P HM4864P HM4864P HM4864P 66 2 | - | PC 9 | - | HM4864P HM4864P HM4864P HM4864P 6 | - | AM 4 | - | HM4864P HM4864P HM4864P HM4864P 29 8 | - | 66 P | - | HM4864P HM4864P HM4864P HM4864P PC C | - | SN7474N | - |-----------------------------------------------------------------| - - PRM: N82S129F 1K Bipolar PROM - AM2966PC: Octal Dynamic Memory Drivers with Three-State Outputs - AM29648PC - CN1: Connector to CN2 of Z80 CPU card - ----------------------------------------------------------------------------------- - - Parallel I/O board, all ICs shown: - - |-------------------------------------| | - | | - | 74 74 | - | LS LS Z80A PIO | - | 00 14 | - | N N | - | | - | | - | 74 74 74 74 D4 74 | - | LS LS LS LS I3 LS | - | 13 14 24 85 P2 64 | - | 2N N 1N N 1 0N | - | | - | CN1 | - | | - | 74LS00N | - |-------------------------------------| - - CN1: Bus connector - DIP: 4x DIP current setting: off-on-on-off, sets the address for the parallel port - ----------------------------------------------------------------------------------- - -Beeper Circuit, all ICs shown: - - |---------------------------| | - | | - | BEEP 74LS132N | - | R1 | - | 74LS14N | - | | - | 74LS132N 74LS193N | - | | - | 74LS74AN 74LS165N | - | CN1 | - |---------------------------| - - CN1: Connector to mainboard - R1: looks like a potentiometer - BEEP: Beeper ... touted in the manual as "Hupe" ... i.e. "horn" :) - ----------------------------------------------------------------------------------- - - Other boards and extensions mentioned in the manual: - - S100 bus adapter board - - IEEE 488 bus adapter board - - 64K memory board - - 8086 CPU board - - external harddisk - - TV adapter B/W (TV, Save/Load from Audio Cassette) with PROM/RAM/BASIC-Module with 16K or 32K RAM - - TV adapter color with connection to Video / Keyboard combination card - - Monitor adapters B/W and color - - Video / Keyboard interface 2 with grayscale, 8 colors, loadable character set, blinking - - Graphics Adapter with 16 colours, hi-res 512x256 pixels - - RTC - - Arithmetics chip - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/wd_fdc.h" -#include "machine/bankdev.h" -#include "machine/ram.h" -#include "formats/itt3030_dsk.h" -#include "video/tms9927.h" //Display hardware -#include "sound/beep.h" -#include "cpu/mcs48/mcs48.h" //Keyboard MCU ... talks to the 8278 on the keyboard circuit - -#define MAIN_CLOCK XTAL_4.194MHz - -class itt3030_state : public driver_device -{ -public: - itt3030_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_kbdmcu(*this, "kbdmcu") - , m_ram(*this, "mainram") - , m_crtc(*this, "crt5027") - , m_48kbank(*this, "lowerbank") - , m_fdc (*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - , m_beep(*this, "beeper") - , m_keyrow1(*this, "ROW1") - , m_keyrow2(*this, "ROW2") - , m_keyrow3(*this, "ROW3") - , m_keyrow4(*this, "ROW4") - , m_keyrow5(*this, "ROW5") - , m_keyrow6(*this, "ROW6") - , m_keyrow7(*this, "ROW7") - , m_keyrow8(*this, "ROW8") - , m_keyrow9(*this, "ROW9") - , m_keyrow10(*this, "ROW10") - , m_keyrow11(*this, "ROW11") - , m_keyrow12(*this, "ROW12") - , m_keyrow13(*this, "ROW13") - , m_keyrow14(*this, "ROW14") - , m_keyrow15(*this, "ROW15") - , m_keyrow16(*this, "ROW16") - , m_vram(*this, "vram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - // devices - required_device m_maincpu; - required_device m_kbdmcu; - required_device m_ram; - required_device m_crtc; - required_device m_48kbank; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_beep; - - required_ioport m_keyrow1, m_keyrow2, m_keyrow3, m_keyrow4, m_keyrow5, m_keyrow6, m_keyrow7, m_keyrow8, m_keyrow9; - required_ioport m_keyrow10, m_keyrow11, m_keyrow12, m_keyrow13, m_keyrow14, m_keyrow15, m_keyrow16; - - // shared pointers - required_shared_ptr m_vram; - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); -public: - - DECLARE_READ8_MEMBER(vsync_r); - DECLARE_READ8_MEMBER(i8078_r); - DECLARE_WRITE8_MEMBER(i8078_w); - DECLARE_WRITE8_MEMBER( beep_w ); - DECLARE_WRITE8_MEMBER(bank_w); - DECLARE_READ8_MEMBER(bankl_r); - DECLARE_WRITE8_MEMBER(bankl_w); - DECLARE_READ8_MEMBER(bankh_r); - DECLARE_WRITE8_MEMBER(bankh_w); - DECLARE_READ8_MEMBER(kbd_fifo_r); - DECLARE_READ8_MEMBER(kbd_matrix_r); - DECLARE_WRITE8_MEMBER(kbd_matrix_w); - DECLARE_READ8_MEMBER(fdc_r); - DECLARE_WRITE8_MEMBER(fdc_w); - DECLARE_READ8_MEMBER(fdc_stat_r); - DECLARE_WRITE8_MEMBER(fdc_cmd_w); - DECLARE_FLOPPY_FORMATS(itt3030_floppy_formats); - - DECLARE_WRITE_LINE_MEMBER(fdcirq_w); - DECLARE_WRITE_LINE_MEMBER(fdcdrq_w); - DECLARE_WRITE_LINE_MEMBER(fdchld_w); - -private: - UINT8 m_unk; - UINT8 m_bank; - UINT8 m_kbdrow, m_kbdcol, m_kbdclk, m_kbdread; - required_device m_gfxdecode; - required_device m_palette; - floppy_image_device *m_curfloppy; - bool m_fdc_irq, m_fdc_drq, m_fdc_hld; - floppy_connector *m_con1, *m_con2, *m_con3; - bool m_keyskip; -}; - -void itt3030_state::video_start() -{ - m_unk = 0x80; -} - -READ8_MEMBER(itt3030_state::vsync_r) -{ - UINT8 ret = 0; - - if (machine().first_screen()->vblank()) - { - ret |= 0xc0; // set both bits 6 and 7 if vblank - } - - if (machine().first_screen()->hblank()) - { - ret |= 0x80; // set only bit 7 if hblank - } - - return ret; -} - -// TODO: make this a correct device once we figure out how everything goes together in this system -READ8_MEMBER(itt3030_state::i8078_r) -{ - if (offset) - { -// printf("Read 8078 status\n"); - if (!m_keyskip) - { - return 0x10; - } - } - else - { -// printf("Read 8078 data\n"); - if (!m_keyskip) - { - m_keyskip = true; // don't keep reporting the 'b' key, just the once to trick the boot ROM - return 0x0c; - } - } - - return 0; -} - -WRITE8_MEMBER(itt3030_state::i8078_w) -{ - #if 0 - if (offset) - { - printf("%02x to 8078 command\n", data); - } - else - { - printf("%02x to 8078 data\n", data); - } - #endif -} - -WRITE8_MEMBER( itt3030_state::beep_w ) -{ - m_beep->set_state(data&0x32); -} - -WRITE8_MEMBER(itt3030_state::bank_w) -{ - int bank = 0; - m_bank = data>>4; - - if (!(m_bank & 1)) // bank 8 - { - bank = 8; - } - else - { - bank = m_bank >> 1; - } - -// printf("bank_w: new value %02x, m_bank %x, bank %x\n", data, m_bank, bank); - - m_48kbank->set_bank(bank); -} - -READ8_MEMBER(itt3030_state::bankl_r) -{ - return m_ram->read(offset); -} - -WRITE8_MEMBER(itt3030_state::bankl_w) -{ - m_ram->write(offset, data); -} - -READ8_MEMBER(itt3030_state::bankh_r) -{ - return m_ram->read(((m_bank>>1)*0x10000) + offset + 0xc000); -} - -WRITE8_MEMBER(itt3030_state::bankh_w) -{ - m_ram->write(((m_bank>>1)*0x10000) + offset + 0xc000, data); -} - -UINT32 itt3030_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for(int y = 0; y < 24; y++ ) - { - for(int x = 0; x < 80; x++ ) - { - UINT8 code = m_vram[x + y*128]; - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*16); - } - } - - return 0; -} - -WRITE_LINE_MEMBER(itt3030_state::fdcirq_w) -{ - m_fdc_irq = state; -} - -#include "debugger.h" - -WRITE_LINE_MEMBER(itt3030_state::fdcdrq_w) -{ - m_fdc_drq = state; -} - -WRITE_LINE_MEMBER(itt3030_state::fdchld_w) -{ - m_fdc_hld = state; -} - -/* - 7 Data Request (DRQ - inverted 1791-Signal) - 6 Interrupt Request (INTRQ - 1791-Signal) - 5 Head Load (HLD - inverted 1791-Signal) - 4 Ready 3 (Drive 3 ready) - 3 Ready 2 (Drive 2 ready) - 2 Ready l (Drive 1 ready) - 1 Write protect (the disk in the selected drive is write protected) - 0 HLT (Halt signal during head load and track change) -*/ -READ8_MEMBER(itt3030_state::fdc_stat_r) -{ - UINT8 res = 0; - floppy_image_device *floppy1 = m_con1 ? m_con1->get_device() : 0; - floppy_image_device *floppy2 = m_con2 ? m_con2->get_device() : 0; - floppy_image_device *floppy3 = m_con3 ? m_con3->get_device() : 0; - - res = m_fdc_drq ? 0x80 : 0x00; - res |= m_fdc_irq ? 0x40 : 0x00; - res |= m_fdc_hld ? 0x00 : 0x20; - if (floppy3) res |= floppy3->ready_r() ? 0x10 : 0; - if (floppy2) res |= floppy2->ready_r() ? 0x08 : 0; - if (floppy1) res |= floppy1->ready_r() ? 0x04 : 0; - if (m_curfloppy) res |= m_curfloppy->wpt_r() ? 0x02 : 0; - - return res; -} - -/* As far as we can tell, the mess of ttl de-inverts the bus */ -READ8_MEMBER(itt3030_state::fdc_r) -{ - return m_fdc->gen_r(offset) ^ 0xff; -} - -WRITE8_MEMBER(itt3030_state::fdc_w) -{ - m_fdc->gen_w(offset, data ^ 0xff); -} - -/* - 7 SEL1 - Select drive 1 - 6 SEL2 - Select drive 2 - 5 SEL3 - Select drive 3 - 4 MOTOR - Motor on - 3 DOOR - Drive door lock drives 1 + 2 (not possible with all drives) - 2 SIDESEL - Select disk side - 1 KOMP - write comp on/off - 0 RG J - Change separator stage to read -*/ -WRITE8_MEMBER(itt3030_state::fdc_cmd_w) -{ - floppy_image_device *floppy = NULL; - - logerror("%02x to fdc_cmd_w: motor %d side %d\n", data, (data & 0x10)>>4, (data & 4)>>2); - - // select drive - if (data & 0x80) - { - floppy = m_con1 ? m_con1->get_device() : 0; - } - else if (data & 0x40) - { - floppy = m_con2 ? m_con2->get_device() : 0; - } - else if (data & 0x20) - { - floppy = m_con3 ? m_con3->get_device() : 0; - } - - // selecting a new drive? - if (floppy != m_curfloppy) - { - m_fdc->set_floppy(floppy); - m_curfloppy = floppy; - } - - if (floppy != NULL) - { - // side select - floppy->ss_w((data & 4) ? 1 : 0); - - // motor control (active low) - floppy->mon_w((data & 0x10) ? 0 : 1); - } -} - -// The lower 48K is switchable among the first 48K of each of 8 64K banks numbered 0-7 or "bank 8" which is the internal ROM and VRAM -// The upper 16K is always the top 16K of the selected bank 0-7, which allows bank/bank copies and such -// Port F6 bits 7-5 select banks 0-7, bit 4 enables bank 8 - -static ADDRESS_MAP_START( itt3030_map, AS_PROGRAM, 8, itt3030_state ) - AM_RANGE(0x0000, 0xbfff) AM_DEVICE("lowerbank", address_map_bank_device, amap8) - AM_RANGE(0xc000, 0xffff) AM_READWRITE(bankh_r, bankh_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( lower48_map, AS_PROGRAM, 8, itt3030_state ) - AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(bankl_r, bankl_w) // pages 0-7 - AM_RANGE(0x80000, 0x807ff) AM_ROM AM_REGION("maincpu", 0) // begin "page 8" - AM_RANGE(0x80800, 0x80fff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x81000, 0x810ff) AM_RAM AM_MIRROR(0x100) // only 256 bytes, but ROM also clears 11xx? - AM_RANGE(0x83000, 0x83fff) AM_RAM AM_SHARE("vram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( itt3030_io, AS_IO, 8, itt3030_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x20, 0x26) AM_DEVREADWRITE("crt5027", crt5027_device, read, write) - AM_RANGE(0x30, 0x31) AM_READWRITE(i8078_r, i8078_w) - AM_RANGE(0x32, 0x32) AM_WRITE(beep_w) - AM_RANGE(0x35, 0x35) AM_READ(vsync_r) - AM_RANGE(0x40, 0x40) AM_READ(kbd_fifo_r) - AM_RANGE(0x50, 0x53) AM_READWRITE(fdc_r, fdc_w) - AM_RANGE(0x54, 0x54) AM_READWRITE(fdc_stat_r, fdc_cmd_w) - AM_RANGE(0xf6, 0xf6) AM_WRITE(bank_w) -ADDRESS_MAP_END - -READ8_MEMBER(itt3030_state::kbd_fifo_r) -{ - return m_kbdmcu->upi41_master_r(space, 0); // offset 0 is data, 1 is status -} - -READ8_MEMBER(itt3030_state::kbd_matrix_r) -{ - return m_kbdread; -} - -WRITE8_MEMBER(itt3030_state::kbd_matrix_w) -{ - ioport_port *ports[16] = { m_keyrow1, m_keyrow2, m_keyrow3, m_keyrow4, m_keyrow5, m_keyrow6, m_keyrow7, m_keyrow8, m_keyrow9, - m_keyrow10, m_keyrow11, m_keyrow12, m_keyrow13, m_keyrow14, m_keyrow15, m_keyrow16 }; - int col_masks[8] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80 }; - int tmp_read; - - m_kbdrow = data & 0xf; - m_kbdcol = (data >> 4) & 0x7; - - if ((data & 0x80) && (!m_kbdclk)) - { - tmp_read = ports[m_kbdrow]->read() & col_masks[m_kbdcol]; - m_kbdread = (tmp_read != 0) ? 1 : 0; - } - - m_kbdclk = (data & 0x80) ? 1 : 0; -} - -// Schematics say: -// Port 1 goes to the keyboard matrix. -// bits 0-3 select matrix rows, bits 4-6 choose column to read, bit 7 clocks the process (rising edge strobes the row, falling edge reads the data) -// T0 is the key matrix return -// Port 2 bit 2 is shown as "IRQ" on the schematics, and the code does a lot with it as well (debug?) -static ADDRESS_MAP_START( kbdmcu_io, AS_IO, 8, itt3030_state ) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(kbd_matrix_r) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kbd_matrix_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_NOP AM_WRITENOP -ADDRESS_MAP_END - -static INPUT_PORTS_START( itt3030 ) - PORT_START("ROW1") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("ROW2") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("ROW3") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // actually UK pound symbol - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("ROW4") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - - PORT_START("ROW5") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("ROW6") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - - PORT_START("ROW7") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("ROW8") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("ROW9") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - - PORT_START("ROW10") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_F9) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - - PORT_START("ROW11") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_F10) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('@') PORT_CHAR('?') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('`') - - PORT_START("ROW12") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_F11) PORT_CHAR(27) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('/') PORT_CHAR('\\') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - - PORT_START("ROW13") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(R)") PORT_CODE(KEYCODE_F12) PORT_CHAR('=') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('~') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR('^') // PC doesn't have 3 keys to the right of L, so we sub DEL for the 3rd one - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("ROW14") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(CL)") PORT_CODE(KEYCODE_F13) PORT_CHAR(4) // produces control-D always - PORT_BIT(0x001e, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("ROW15") - PORT_BIT(0x001f, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("ROW16") - PORT_BIT(0x001f, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static const gfx_layout charlayout = -{ - 8, 16, /* 8x16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {7, 6, 5, 4, 3, 2, 1, 0}, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* size of one char */ -}; - -static GFXDECODE_START( itt3030 ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) -GFXDECODE_END - - -void itt3030_state::machine_start() -{ - save_item(NAME(m_unk)); - save_item(NAME(m_bank)); - save_item(NAME(m_kbdrow)); - save_item(NAME(m_kbdcol)); - save_item(NAME(m_kbdclk)); - save_item(NAME(m_kbdread)); - - m_kbdclk = 0; // must be initialized here b/c mcs48_reset() causes write of 0xff to all ports -} - -void itt3030_state::machine_reset() -{ - m_bank = 9; - m_48kbank->set_bank(8); - m_kbdread = 1; - m_kbdrow = m_kbdcol = 0; - m_kbdclk = 1; - m_fdc_irq = m_fdc_drq = m_fdc_hld = 0; - m_curfloppy = NULL; - m_keyskip = false; - - // look up floppies in advance - m_con1 = machine().device("fdc:0"); - m_con2 = machine().device("fdc:1"); - m_con3 = machine().device("fdc:2"); -} - -FLOPPY_FORMATS_MEMBER( itt3030_state::itt3030_floppy_formats ) - FLOPPY_ITT3030_FORMAT -FLOPPY_FORMATS_END - - -static SLOT_INTERFACE_START( itt3030_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( itt3030, itt3030_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80,XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(itt3030_map) - MCFG_CPU_IO_MAP(itt3030_io) - - MCFG_CPU_ADD("kbdmcu", I8041, XTAL_6MHz) - MCFG_CPU_IO_MAP(kbdmcu_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) - MCFG_SCREEN_UPDATE_DRIVER(itt3030_state, screen_update) - MCFG_SCREEN_SIZE(80*8, 24*16) - MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*16-1) - MCFG_SCREEN_PALETTE("palette") - - /* devices */ - MCFG_DEVICE_ADD("lowerbank", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(lower48_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x10000) - - MCFG_DEVICE_ADD("crt5027", CRT5027, XTAL_6MHz) - MCFG_TMS9927_CHAR_WIDTH(16) - - MCFG_FD1791_ADD("fdc", XTAL_20MHz / 20) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(itt3030_state, fdcirq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(itt3030_state, fdcdrq_w)) - MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(itt3030_state, fdchld_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", itt3030) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* internal ram */ - MCFG_RAM_ADD("mainram") - MCFG_RAM_DEFAULT_SIZE("512K") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( itt3030 ) - ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "bootv1.2.bin", 0x0000, 0x0800, CRC(90279d45) SHA1(a39a3f31f4f98980b1ef50805870837fbf72261d)) - ROM_REGION( 0x0800, "gfx1", ROMREGION_ERASE00 ) - ROM_LOAD( "gb136-0.bin", 0x0000, 0x0800, CRC(6a3895a8) SHA1(f3b977ffa2f54c346521c9ef034830de8f404621)) - ROM_REGION( 0x0400, "kbdmcu", ROMREGION_ERASE00 ) - ROM_LOAD( "8741ad.bin", 0x0000, 0x0400, CRC(cabf4394) SHA1(e5d1416b568efa32b578ca295a29b7b5d20c0def)) -ROM_END - -COMP( 1982, itt3030, 0, 0, itt3030, itt3030, driver_device, 0, "ITT RFA", "ITT3030", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/jade.c b/src/mess/drivers/jade.c deleted file mode 100644 index 1f554d92ad1..00000000000 --- a/src/mess/drivers/jade.c +++ /dev/null @@ -1,111 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Jade JGZ80 Single board computer on a S100 card. - - 2013-09-12 Skeleton driver. - - No info found as yet. - - It takes about 8 seconds to start up. - Type HE to get a list of commands. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8251.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class jade_state : public driver_device -{ -public: - jade_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_uart(*this, "uart") - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(keyin_r); - DECLARE_READ8_MEMBER(status_r); - DECLARE_READ8_MEMBER(data_r); -private: - UINT8 m_term_data; - virtual void machine_reset(); - required_device m_maincpu; - required_device m_terminal; - required_device m_uart; -}; - - -static ADDRESS_MAP_START(jade_mem, AS_PROGRAM, 8, jade_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0xe000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(jade_io, AS_IO, 8, jade_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - //AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - //AM_RANGE(0x32, 0x32) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x30, 0x30) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x32, 0x32) AM_READ(status_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( jade ) -INPUT_PORTS_END - -READ8_MEMBER( jade_state::keyin_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return (ret) ? ret : 0x13; -} - -READ8_MEMBER( jade_state::status_r ) -{ - return (m_term_data) ? 5 : 4; -} - -WRITE8_MEMBER( jade_state::kbd_put ) -{ - m_term_data = data; -} - -void jade_state::machine_reset() -{ - m_term_data = 0; -} - -static MACHINE_CONFIG_START( jade, jade_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(jade_mem) - MCFG_CPU_IO_MAP(jade_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(jade_state, kbd_put)) - - /* Devices */ - MCFG_DEVICE_ADD("uart", I8251, 0) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( jade ) - ROM_REGION( 0x800, "roms", 0 ) - ROM_LOAD( "jgz80.rom", 0x0000, 0x0800, CRC(90c4a1ef) SHA1(8a93a11051cc27f3edca24f0f4297ebe0099964e) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, jade, 0, 0, jade, jade, driver_device, 0, "Jade", "JGZ80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/jonos.c b/src/mess/drivers/jonos.c deleted file mode 100644 index 4f4a0ad2593..00000000000 --- a/src/mess/drivers/jonos.c +++ /dev/null @@ -1,158 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Jonos Escort - - 2013-09-12 Skeleton driver - - This computer is some sort of portable Z80-based system. - - Haven't found any info. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - - -class jonos_state : public driver_device -{ -public: - jonos_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_p_videoram(*this, "videoram") - , m_maincpu(*this, "maincpu") - { } - - DECLARE_DRIVER_INIT(jonos); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; -private: - const UINT8 *m_p_chargen; - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; -}; - - - -static ADDRESS_MAP_START(jonos_mem, AS_PROGRAM, 8, jonos_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0x1000, 0x17ff) AM_RAM - AM_RANGE(0x1800, 0x1fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x2000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( jonos_io, AS_IO, 8, jonos_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( jonos ) -INPUT_PORTS_END - -void jonos_state::machine_reset() -{ -} - -void jonos_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 jonos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 12; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 80; x++) - { - chr = m_p_videoram[x]; - - if (ra < 8) - gfx = m_p_chargen[(chr<<3) | ra ]; - else - gfx = m_p_chargen[(chr<<3) | (ra&7) | 0x400]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 0); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 7); - } - } - ma+=80; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout jonos_charlayout = -{ - 8, 12, /* 8 x 12 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 1024*8, 1025*8, 1026*8, 1027*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( jonos ) - GFXDECODE_ENTRY( "chargen", 0x0000, jonos_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( jonos, jonos_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(jonos_mem) - MCFG_CPU_IO_MAP(jonos_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(jonos_state, screen_update) - MCFG_SCREEN_SIZE(640, 300) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 299) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", jonos) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -DRIVER_INIT_MEMBER(jonos_state,jonos) -{ -} - -/* ROM definition */ -ROM_START( jonos ) - ROM_REGION( 0x1000, "roms", 0 ) - ROM_LOAD( "jocrts04.rom", 0x0000, 0x1000, CRC(6a3d4048) SHA1(bdb0bc2c8c4e54261376e4ea3c2827d00d3d89bc) ) - - ROM_REGION( 0x0800, "user1", 0 ) // Z80 code for serial & parallel ports - ROM_LOAD( "joz80.rom", 0x0000, 0x0800, CRC(de1e8998) SHA1(270df08caf30cc8f18e740ef05dc8727a925a5da) ) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "jochset0.rom", 0x0000, 0x0800, CRC(1d8e9640) SHA1(74f3604acc71f9bc1e1f9479f6438feda79293a2) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, jonos, 0, 0, jonos, jonos, jonos_state, jonos, "Jonos", "Escort", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/jr100.c b/src/mess/drivers/jr100.c deleted file mode 100644 index b8a09453c92..00000000000 --- a/src/mess/drivers/jr100.c +++ /dev/null @@ -1,425 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - JR-100 National / Panasonic - - 23/08/2010 Initial driver version - - TODO: - - beeper doesn't work correctly when a key is pressed (should have - more time but it's quickly shut off), presumably there are M6802 - timing bugs that causes this quirk. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "machine/6522via.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "sound/speaker.h" -#include "sound/beep.h" -#include "imagedev/snapquik.h" - - -class jr100_state : public driver_device -{ -public: - jr100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_ram(*this, "ram"), - m_pcg(*this, "pcg"), - m_vram(*this, "vram"), - m_via(*this, "via"), - m_cassette(*this, "cassette"), - m_beeper(*this, "beeper"), - m_speaker(*this, "speaker"), - m_region_maincpu(*this, "maincpu"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1"), - m_line2(*this, "LINE2"), - m_line3(*this, "LINE3"), - m_line4(*this, "LINE4"), - m_line5(*this, "LINE5"), - m_line6(*this, "LINE6"), - m_line7(*this, "LINE7"), - m_line8(*this, "LINE8") , - m_maincpu(*this, "maincpu") { } - - required_shared_ptr m_ram; - required_shared_ptr m_pcg; - required_shared_ptr m_vram; - UINT8 m_keyboard_line; - bool m_use_pcg; - UINT8 m_speaker_data; - UINT16 m_t1latch; - UINT8 m_beep_en; - DECLARE_WRITE8_MEMBER(jr100_via_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(sound_tick); - DECLARE_READ8_MEMBER(jr100_via_read_b); - DECLARE_WRITE8_MEMBER(jr100_via_write_a); - DECLARE_WRITE8_MEMBER(jr100_via_write_b); - DECLARE_WRITE_LINE_MEMBER(jr100_via_write_cb2); - UINT32 readByLittleEndian(UINT8 *buf,int pos); - DECLARE_QUICKLOAD_LOAD_MEMBER(jr100); - - -protected: - required_device m_via; - required_device m_cassette; - required_device m_beeper; - required_device m_speaker; - required_memory_region m_region_maincpu; - required_ioport m_line0; - required_ioport m_line1; - required_ioport m_line2; - required_ioport m_line3; - required_ioport m_line4; - required_ioport m_line5; - required_ioport m_line6; - required_ioport m_line7; - required_ioport m_line8; - required_device m_maincpu; -}; - - - - -WRITE8_MEMBER(jr100_state::jr100_via_w) -{ - /* ACR: beeper masking */ - if(offset == 0x0b) - { - //printf("BEEP %s\n",((data & 0xe0) == 0xe0) ? "ON" : "OFF"); - m_beep_en = ((data & 0xe0) == 0xe0); - - if(!m_beep_en) - m_beeper->set_state(0); - } - - /* T1L-L */ - if(offset == 0x04) - { - m_t1latch = (m_t1latch & 0xff00) | (data & 0xff); - //printf("BEEP T1CL %02x\n",data); - } - - /* T1L-H */ - if(offset == 0x05) - { - m_t1latch = (m_t1latch & 0xff) | ((data & 0xff) << 8); - //printf("BEEP T1CH %02x\n",data); - - /* writing here actually enables the beeper, if above masking condition is satisfied */ - if(m_beep_en) - { - m_beeper->set_state(1); - m_beeper->set_frequency(894886.25 / (double)(m_t1latch) / 2.0); - } - } - m_via->write(space,offset,data); -} - -static ADDRESS_MAP_START(jr100_mem, AS_PROGRAM, 8, jr100_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("ram") - AM_RANGE(0xc000, 0xc0ff) AM_RAM AM_SHARE("pcg") - AM_RANGE(0xc100, 0xc3ff) AM_RAM AM_SHARE("vram") - AM_RANGE(0xc800, 0xc80f) AM_DEVREAD("via", via6522_device, read) AM_WRITE(jr100_via_w) - AM_RANGE(0xe000, 0xffff) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( jr100 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) // Z - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) // X - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) // C - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) // A - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) // S - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) // D - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) // F - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) // G - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) // Q - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) // W - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) // E - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) // R - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) // T - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) // 1 - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) // 2 - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) // 3 - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) // 4 - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) // 5 - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) // 6 - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) // 7 - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) // 8 - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) // 9 - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) // 0 - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) // Y - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) // U - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) // I - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) // O - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) // P - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) // H - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) // J - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) // K - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) // L - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) // ; - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) // V - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) // B - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) // N - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) // M - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) // , - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) // . - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) // space - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) // : - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) // enter - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) // - - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -void jr100_state::machine_start() -{ - m_beeper->set_frequency(0); - m_beeper->set_state(0); -} - -void jr100_state::machine_reset() -{ -} - -void jr100_state::video_start() -{ -} - -UINT32 jr100_state::screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,xi,yi; - - UINT8 *rom_pcg = m_region_maincpu->base() + 0xe000; - for (y = 0; y < 24; y++) - { - for (x = 0; x < 32; x++) - { - UINT8 tile = m_vram[x + y*32]; - UINT8 attr = tile >> 7; - // ATTR is inverted for normal char or use PCG in case of CMODE1 - UINT8 *gfx_data = rom_pcg; - if (m_use_pcg && attr) { - gfx_data = m_pcg; - attr = 0; // clear attr so bellow code stay same - } - tile &= 0x7f; - for(yi=0;yi<8;yi++) - { - for(xi=0;xi<8;xi++) - { - UINT8 pen = (gfx_data[(tile*8)+yi]>>(7-xi) & 1); - bitmap.pix16(y*8+yi, x*8+xi) = attr ^ pen; - } - } - } - } - - return 0; -} - -static const gfx_layout tiles8x8_layout = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( jr100 ) - GFXDECODE_ENTRY( "maincpu", 0xe000, tiles8x8_layout, 0, 1 ) -GFXDECODE_END - -READ8_MEMBER(jr100_state::jr100_via_read_b) -{ - UINT8 val = 0x1f; - switch ( m_keyboard_line ) - { - case 0: val = m_line0->read(); break; - case 1: val = m_line1->read(); break; - case 2: val = m_line2->read(); break; - case 3: val = m_line3->read(); break; - case 4: val = m_line4->read(); break; - case 5: val = m_line5->read(); break; - case 6: val = m_line6->read(); break; - case 7: val = m_line7->read(); break; - case 8: val = m_line8->read(); break; - } - return val; -} - -WRITE8_MEMBER(jr100_state::jr100_via_write_a) -{ - m_keyboard_line = data & 0x0f; -} - -WRITE8_MEMBER(jr100_state::jr100_via_write_b) -{ - m_use_pcg = (data & 0x20) ? TRUE : FALSE; - m_speaker_data = data>>7; -} - -WRITE_LINE_MEMBER(jr100_state::jr100_via_write_cb2) -{ - m_cassette->output(state ? -1.0 : +1.0); -} - -TIMER_DEVICE_CALLBACK_MEMBER(jr100_state::sound_tick) -{ - m_speaker->level_w(m_speaker_data); - m_speaker_data = 0; - - double level = (m_cassette->input()); - if (level > 0.0) { - m_via->write_ca1(0); - m_via->write_cb1(0); - } else { - m_via->write_ca1(1); - m_via->write_cb1(1); - } -} - -UINT32 jr100_state::readByLittleEndian(UINT8 *buf,int pos) -{ - return buf[pos] + (buf[pos+1] << 8) + (buf[pos+2] << 16) + (buf[pos+3] << 24); -} - -QUICKLOAD_LOAD_MEMBER( jr100_state,jr100) -{ - int quick_length; - UINT8 buf[0x10000]; - int read_; - quick_length = image.length(); - if (quick_length >= 0xffff) - return IMAGE_INIT_FAIL; - read_ = image.fread(buf, quick_length); - if (read_ != quick_length) - return IMAGE_INIT_FAIL; - - if (buf[0]!=0x50 || buf[1]!=0x52 || buf[2]!=0x4F || buf[3]!=0x47) { - // this is not PRG - return IMAGE_INIT_FAIL; - } - int pos = 4; - if (readByLittleEndian(buf,pos)!=1) { - // not version 1 of PRG file - return IMAGE_INIT_FAIL; - } - pos += 4; - UINT32 len =readByLittleEndian(buf,pos); pos+= 4; - pos += len; // skip name - UINT32 start_address = readByLittleEndian(buf,pos); pos+= 4; - UINT32 code_length = readByLittleEndian(buf,pos); pos+= 4; - UINT32 flag = readByLittleEndian(buf,pos); pos+= 4; - - UINT32 end_address = start_address + code_length - 1; - // copy code - memcpy(m_ram + start_address,buf + pos,code_length); - if (flag == 0) { - m_ram[end_address + 1] = 0xdf; - m_ram[end_address + 2] = 0xdf; - m_ram[end_address + 3] = 0xdf; - m_ram[6 ] = (end_address >> 8 & 0xFF); - m_ram[7 ] = (end_address & 0xFF); - m_ram[8 ] = ((end_address + 1) >> 8 & 0xFF); - m_ram[9 ] = ((end_address + 1) & 0xFF); - m_ram[10] = ((end_address + 2) >> 8 & 0xFF); - m_ram[11] = ((end_address + 2) & 0xFF); - m_ram[12] = ((end_address + 3) >> 8 & 0xFF); - m_ram[13] = ((end_address + 3) & 0xFF); - } - - return IMAGE_INIT_PASS; -} - -static MACHINE_CONFIG_START( jr100, jr100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6802, XTAL_14_31818MHz / 4) // clock devided internaly by 4 - MCFG_CPU_PROGRAM_MAP(jr100_mem) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 192) /* border size not accurate */ - MCFG_SCREEN_VISIBLE_AREA(0, 256 - 1, 0, 192 - 1) - MCFG_SCREEN_UPDATE_DRIVER(jr100_state, screen_update_jr100) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", jr100) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_DEVICE_ADD("via", VIA6522, XTAL_14_31818MHz / 16) - MCFG_VIA6522_READPB_HANDLER(READ8(jr100_state,jr100_via_read_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(jr100_state,jr100_via_write_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(jr100_state,jr100_via_write_b)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(jr100_state, jr100_via_write_cb2)) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("sound_tick", jr100_state, sound_tick, attotime::from_hz(XTAL_14_31818MHz / 16)) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", jr100_state, jr100, "prg", 2) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( jr100 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "jr100.rom", 0xe000, 0x2000, CRC(951d08a1) SHA1(edae3daaa94924e444bbe485ac2bcd5cb5b22ca2)) -ROM_END - -ROM_START( jr100u ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "jr100u.rom", 0xe000, 0x2000, CRC(f589dd8d) SHA1(78a51f2ae055bf4dc1b0887a6277f5dbbd8ba512)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, jr100, 0, 0, jr100, jr100, driver_device, 0, "National", "JR-100", 0) -COMP( 1981, jr100u, jr100, 0, jr100, jr100, driver_device, 0, "Panasonic", "JR-100U", 0) diff --git a/src/mess/drivers/jr200.c b/src/mess/drivers/jr200.c deleted file mode 100644 index 8e2fba33614..00000000000 --- a/src/mess/drivers/jr200.c +++ /dev/null @@ -1,601 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Roberto Zandona' -/*************************************************************************** - - JR-200 (c) 1982 National / Panasonic - - driver by Roberto Zandona' and Angelo Salese - - http://www.armchairarcade.com/neo/node/1598 - - TODO: - - Timings are basically screwed, it takes too much to load the POST but - then the cursor blink is too fast - - keyboard MCU irq and data polling simulation should be inside a timer - callback - - MN1544 4-bit CPU core and ROM dump - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "sound/beep.h" - - -class jr200_state : public driver_device -{ -public: - jr200_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_vram(*this, "vram"), - m_cram(*this, "cram"), - m_mn1271_ram(*this, "mn1271_ram"), - m_maincpu(*this, "maincpu"), - m_beeper(*this, "beeper"), - m_pcg(*this, "pcg"), - m_gfx_rom(*this, "gfx_rom"), - m_gfx_ram(*this, "gfx_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_row8(*this, "ROW8"), - m_row9(*this, "ROW9"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - required_shared_ptr m_vram; - required_shared_ptr m_cram; - required_shared_ptr m_mn1271_ram; - UINT8 m_border_col; - UINT8 m_old_keydata; - UINT8 m_freq_reg[2]; - emu_timer *m_timer_d; - DECLARE_READ8_MEMBER(jr200_pcg_1_r); - DECLARE_READ8_MEMBER(jr200_pcg_2_r); - DECLARE_WRITE8_MEMBER(jr200_pcg_1_w); - DECLARE_WRITE8_MEMBER(jr200_pcg_2_w); - DECLARE_READ8_MEMBER(jr200_bios_char_r); - DECLARE_WRITE8_MEMBER(jr200_bios_char_w); - DECLARE_READ8_MEMBER(mcu_keyb_r); - DECLARE_WRITE8_MEMBER(jr200_beep_w); - DECLARE_WRITE8_MEMBER(jr200_beep_freq_w); - DECLARE_WRITE8_MEMBER(jr200_border_col_w); - DECLARE_READ8_MEMBER(mn1271_io_r); - DECLARE_WRITE8_MEMBER(mn1271_io_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(timer_d_callback); - -protected: - required_device m_maincpu; - required_device m_beeper; - required_memory_region m_pcg; - required_memory_region m_gfx_rom; - required_memory_region m_gfx_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_row8; - required_ioport m_row9; - required_device m_gfxdecode; - required_device m_palette; -}; - - - -/* TODO: double check this */ -static const UINT8 jr200_keycodes[4][9][8] = -{ - /* unshifted */ - { - { 0x00, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 }, - { 0x38, 0x39, 0x30, 0x2d, 0x5e, 0x08, 0x7f, 0x2d }, - { 0x37, 0x38, 0x39, 0x09, 0x71, 0x77, 0x65, 0x72 }, - { 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x40, 0x5b }, - { 0x1b, 0x2b, 0x34, 0x35, 0x36, 0x61, 0x73, 0x64 }, - { 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27 }, - { 0x0d, 0x0a, 0x1e, 0x31, 0x32, 0x33, 0x7a, 0x78 }, - { 0x63, 0x76, 0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2f }, - { 0x1d, 0x1f, 0x1c, 0x30, 0x2e, 0x20, 0x03, 0x00 } - }, - - /* shifted */ - { - { 0x00, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26 }, - { 0x2a, 0x28, 0x29, 0x3d, 0x10, 0x08, 0x7f, 0x2d }, - { 0x37, 0x38, 0x39, 0x09, 0x51, 0x57, 0x45, 0x52 }, - { 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x40, 0x7b }, - { 0x1b, 0x2b, 0x34, 0x35, 0x36, 0x41, 0x53, 0x44 }, - { 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22 }, - { 0x0d, 0x0a, 0x1e, 0x31, 0x32, 0x33, 0x5a, 0x58 }, - { 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x3c, 0x3e, 0x3f }, - { 0x1d, 0x1f, 0x1c, 0x30, 0x2e, 0x20, 0x00, 0x00 } - }, - - /* graph on */ - { - { 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97 }, - { 0x98, 0x99, 0x90, 0x1f, 0x9a, 0x88, 0xff, 0xad }, - { 0xb7, 0xb8, 0xb9, 0x89, 0x11, 0x17, 0x05, 0x12 }, - { 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d }, - { 0x9b, 0xab, 0xb4, 0xb5, 0xb6, 0x01, 0x13, 0x04 }, - { 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0x7e, 0x60 }, - { 0x8d, 0x8a, 0x81, 0xb1, 0xb2, 0xb3, 0x1a, 0x18 }, - { 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x1c, 0x7c, 0x5c }, - { 0x84, 0x82, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 } - }, - - /* graph on shifted*/ - { - { 0x9e, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97 }, - { 0x98, 0x99, 0x90, 0x1f, 0x9a, 0x88, 0xff, 0xad }, - { 0xb7, 0xb8, 0xb9, 0x89, 0x11, 0x17, 0x05, 0x12 }, - { 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d }, - { 0x9b, 0xab, 0xb4, 0xb5, 0xb6, 0x01, 0x13, 0x04 }, - { 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0x7e, 0x60 }, - { 0x8d, 0x8a, 0x81, 0xb1, 0xb2, 0xb3, 0x1a, 0x18 }, - { 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x1c, 0x7c, 0x5c }, - { 0x84, 0x82, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 } - } -}; - - -void jr200_state::video_start() -{ -} - -UINT32 jr200_state::screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,xi,yi,pen; - - bitmap.fill(m_border_col, cliprect); - - for (y = 0; y < 24; y++) - { - for (x = 0; x < 32; x++) - { - UINT8 tile = m_vram[x + y*32]; - UINT8 attr = m_cram[x + y*32]; - - for(yi=0;yi<8;yi++) - { - for(xi=0;xi<8;xi++) - { - UINT8 *gfx_data; - - if(attr & 0x80) //bitmap mode - { - /* - this mode draws 4 x 4 dot blocks, by combining lower 6 bits of tile and attribute vram - - tile def - 00xx x--- up-right - 00-- -xxx up-left - attr def - 10xx x--- down-right - 10-- -xxx down-left - */ - int step; - - step = ((xi & 4) ? 3 : 0); - step+= ((yi & 4) ? 6 : 0); - - pen = ((((attr & 0x3f) << 6) | (tile & 0x3f)) >> (step)) & 0x07; - } - else // tile mode - { - gfx_data = (attr & 0x40) ? m_pcg->base() : m_gfx_ram->base(); - - pen = (gfx_data[(tile*8)+yi]>>(7-xi) & 1) ? (attr & 0x7) : ((attr & 0x38) >> 3); - } - - bitmap.pix16(y*8+yi+16, x*8+xi+16) = m_palette->pen(pen); - } - } - } - } - - return 0; -} - -READ8_MEMBER(jr200_state::jr200_pcg_1_r) -{ - return m_pcg->base()[offset+0x000]; -} - -READ8_MEMBER(jr200_state::jr200_pcg_2_r) -{ - return m_pcg->base()[offset+0x400]; -} - -WRITE8_MEMBER(jr200_state::jr200_pcg_1_w) -{ - m_pcg->base()[offset+0x000] = data; - m_gfxdecode->gfx(1)->mark_dirty((offset+0x000) >> 3); -} - -WRITE8_MEMBER(jr200_state::jr200_pcg_2_w) -{ - m_pcg->base()[offset+0x400] = data; - m_gfxdecode->gfx(1)->mark_dirty((offset+0x400) >> 3); -} - -READ8_MEMBER(jr200_state::jr200_bios_char_r) -{ - return m_gfx_ram->base()[offset]; -} - - -WRITE8_MEMBER(jr200_state::jr200_bios_char_w) -{ - /* TODO: writing is presumably controlled by an I/O bit */ -// m_gfx_ram->base()[offset] = data; -// m_gfxdecode->gfx(0)->mark_dirty(offset >> 3); -} - -/* - -I/O Device - -*/ - -READ8_MEMBER(jr200_state::mcu_keyb_r) -{ - int row, col, table = 0; - UINT8 keydata = 0; - - if (m_row9->read() & 0x07) - { - /* shift, upper case */ - table = 1; - } - - /* scan keyboard */ - for (row = 0; row < 9; row++) - { - UINT8 data = 0xff; - - switch ( row ) - { - case 0: data = m_row0->read(); break; - case 1: data = m_row1->read(); break; - case 2: data = m_row2->read(); break; - case 3: data = m_row3->read(); break; - case 4: data = m_row4->read(); break; - case 5: data = m_row5->read(); break; - case 6: data = m_row6->read(); break; - case 7: data = m_row7->read(); break; - case 8: data = m_row8->read(); break; - } - - for (col = 0; col < 8; col++) - { - if (!BIT(data, col)) - { - /* latch key data */ - keydata = jr200_keycodes[table][row][col]; - } - } - } - - if(m_old_keydata == keydata) - return 0x00; - - m_old_keydata = keydata; - - return keydata; -} - -WRITE8_MEMBER(jr200_state::jr200_beep_w) -{ - /* writing 0x0e enables the beeper, writing anything else disables it */ - m_beeper->set_state(((data & 0xf) == 0x0e) ? 1 : 0); -} - -WRITE8_MEMBER(jr200_state::jr200_beep_freq_w) -{ - UINT32 beep_freq; - - m_freq_reg[offset] = data; - - beep_freq = ((m_freq_reg[0]<<8) | (m_freq_reg[1] & 0xff)) + 1; - - m_beeper->set_frequency(84000 / beep_freq); -} - -WRITE8_MEMBER(jr200_state::jr200_border_col_w) -{ - m_border_col = data; -} - - -TIMER_CALLBACK_MEMBER(jr200_state::timer_d_callback) -{ - m_maincpu->set_input_line(0, HOLD_LINE); -} - -READ8_MEMBER(jr200_state::mn1271_io_r) -{ - UINT8 retVal = m_mn1271_ram[offset]; - if((offset+0xc800) > 0xca00) - retVal= 0xff; - - switch(offset+0xc800) - { - case 0xc801: retVal= mcu_keyb_r(space,0); break; - case 0xc803: retVal= (m_mn1271_ram[0x03] & 0xcf) | 0x30; break;//---x ---- printer status ready (ACTIVE HIGH) - case 0xc807: retVal= (m_mn1271_ram[0x07] & 0x80) | 0x60; break; - case 0xc80a: retVal= (m_mn1271_ram[0x0a] & 0xfe); break; - case 0xc80c: retVal= (m_mn1271_ram[0x0c] & 0xdf) | 0x20; break; - case 0xc80e: retVal= 0; break; - case 0xc810: retVal= 0; break; - case 0xc816: retVal= 0x4e; break; - case 0xc81c: retVal= (m_mn1271_ram[0x1c] & 0xfe) | 1; break;//bit 0 needs to be high otherwise system refuses to boot - case 0xc81d: retVal= (m_mn1271_ram[0x1d] & 0xed); break; - } - //logerror("mn1271_io_r [%04x] = %02x\n",offset+0xc800,retVal); - return retVal; -} - -WRITE8_MEMBER(jr200_state::mn1271_io_w) -{ - m_mn1271_ram[offset] = data; - switch(offset+0xc800) - { - case 0xc805: break; //LPT printer port W - case 0xc816: if (data!=0) { - m_timer_d->adjust(attotime::zero, 0, attotime::from_hz(XTAL_14_31818MHz) * (m_mn1271_ram[0x17]*0x100 + m_mn1271_ram[0x18])); - } else { - m_timer_d->adjust(attotime::zero, 0, attotime::zero); - } - break; - case 0xc819: jr200_beep_w(space,0,data); break; - case 0xc81a: - case 0xc81b: jr200_beep_freq_w(space,offset-0x1a,data); break; - case 0xca00: jr200_border_col_w(space,0,data); break; - } -} - -static ADDRESS_MAP_START(jr200_mem, AS_PROGRAM, 8, jr200_state ) -/* - 0000-3fff RAM - 4000-4fff RAM ( 4k expansion) - 4000-7fff RAM (16k expansion) - 4000-bfff RAM (32k expansion) -*/ - AM_RANGE(0x0000, 0x7fff) AM_RAM - - AM_RANGE(0xa000, 0xbfff) AM_ROM - - AM_RANGE(0xc000, 0xc0ff) AM_READWRITE(jr200_pcg_1_r,jr200_pcg_1_w) //PCG area (1) - AM_RANGE(0xc100, 0xc3ff) AM_RAM AM_SHARE("vram") - AM_RANGE(0xc400, 0xc4ff) AM_READWRITE(jr200_pcg_2_r,jr200_pcg_2_w) //PCG area (2) - AM_RANGE(0xc500, 0xc7ff) AM_RAM AM_SHARE("cram") - -// 0xc800 - 0xcfff I / O area - AM_RANGE(0xc800, 0xcfff) AM_READWRITE(mn1271_io_r,mn1271_io_w) AM_SHARE("mn1271_ram") - - AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(jr200_bios_char_r,jr200_bios_char_w) //BIOS PCG RAM area - AM_RANGE(0xd800, 0xdfff) AM_ROM // cart space (header 0x7e) - AM_RANGE(0xe000, 0xffff) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( jr200 ) -// PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") - - PORT_START("ROW0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_TILDE) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) - - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - - PORT_START("ROW3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("ROW4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - - PORT_START("ROW5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - - PORT_START("ROW6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("ROW7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("ROW8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("ROW9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) -INPUT_PORTS_END - -static const gfx_layout tiles8x8_layout = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( jr200 ) - GFXDECODE_ENTRY( "gfx_ram", 0, tiles8x8_layout, 0, 1 ) - GFXDECODE_ENTRY( "pcg", 0, tiles8x8_layout, 0, 1 ) -GFXDECODE_END - -void jr200_state::machine_start() -{ - m_beeper->set_frequency(0); - m_beeper->set_state(0); - m_timer_d = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jr200_state::timer_d_callback),this)); -} - -void jr200_state::machine_reset() -{ - UINT8 *gfx_rom = m_gfx_rom->base(); - UINT8 *gfx_ram = m_gfx_ram->base(); - int i; - memset(m_mn1271_ram,0,0x800); - - for(i=0;i<0x800;i++) - gfx_ram[i] = gfx_rom[i]; - - for(i=0;i<0x800;i+=8) - m_gfxdecode->gfx(0)->mark_dirty(i >> 3); -} - - -static MACHINE_CONFIG_START( jr200, jr200_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6802, XTAL_14_31818MHz / 4) /* MN1800A, ? Mhz assumption that it is same as JR-100*/ - MCFG_CPU_PROGRAM_MAP(jr200_mem) - -// MCFG_CPU_ADD("mn1544", MN1544, ?) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(16 + 256 + 16, 16 + 192 + 16) /* border size not accurate */ - MCFG_SCREEN_VISIBLE_AREA(0, 16 + 256 + 16 - 1, 0, 16 + 192 + 16 - 1) - MCFG_SCREEN_UPDATE_DRIVER(jr200_state, screen_update_jr200) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", jr200) - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - MCFG_SPEAKER_STANDARD_MONO("mono") - - // AY-8910 ? - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) -MACHINE_CONFIG_END - - - -/* ROM definition */ -ROM_START( jr200 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "rom1.bin", 0xa000, 0x2000, CRC(bfed707b) SHA1(551823e7ca63f459eb46eb4c7a3e1e169fba2ca2)) - ROM_LOAD( "rom2.bin", 0xe000, 0x2000, CRC(a1cb5027) SHA1(5da98d4ce9cba8096d98e6f2de60baa1673406d0)) - - ROM_REGION( 0x10000, "mn1544", ROMREGION_ERASEFF ) - ROM_LOAD( "mn1544.bin", 0x0000, 0x0400, NO_DUMP ) - - ROM_REGION( 0x0800, "gfx_rom", ROMREGION_ERASEFF ) - ROM_LOAD( "char.rom", 0x0000, 0x0800, CRC(cb641624) SHA1(6fe890757ebc65bbde67227f9c7c490d8edd84f2) ) - - ROM_REGION( 0x0800, "gfx_ram", ROMREGION_ERASEFF ) - - ROM_REGION( 0x0800, "pcg", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( jr200u ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "basic.rom", 0xa000, 0x2000, CRC(cc53eb52) SHA1(910927b98a8338ba072173d79613422a8cb796da) ) - ROM_LOAD( "jr200u.bin", 0xe000, 0x2000, CRC(37ca3080) SHA1(17d3fdedb4de521da7b10417407fa2b61f01a77a) ) - - ROM_REGION( 0x10000, "mn1544", ROMREGION_ERASEFF ) - ROM_LOAD( "mn1544.bin", 0x0000, 0x0400, NO_DUMP ) - - ROM_REGION( 0x0800, "gfx_rom", ROMREGION_ERASEFF ) - ROM_LOAD( "char.rom", 0x0000, 0x0800, CRC(cb641624) SHA1(6fe890757ebc65bbde67227f9c7c490d8edd84f2) ) - - ROM_REGION( 0x0800, "gfx_ram", ROMREGION_ERASEFF ) - - ROM_REGION( 0x0800, "pcg", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, jr200, 0, 0, jr200, jr200, driver_device, 0, "National", "JR-200", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1982, jr200u, jr200, 0, jr200, jr200, driver_device, 0, "Panasonic", "JR-200U", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/jtc.c b/src/mess/drivers/jtc.c deleted file mode 100644 index fe1a0a4e140..00000000000 --- a/src/mess/drivers/jtc.c +++ /dev/null @@ -1,851 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Jugend+Technik CompJU+TEr - - 15/07/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z8/z8.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "machine/ram.h" -#include "sound/speaker.h" -#include "sound/wave.h" - -#define SCREEN_TAG "screen" -#define UB8830D_TAG "ub8830d" -#define CENTRONICS_TAG "centronics" - -#define JTC_ES40_VIDEORAM_SIZE 0x2000 - -class jtc_state : public driver_device -{ -public: - jtc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, UB8830D_TAG), - m_cassette(*this, "cassette"), - m_speaker(*this, "speaker"), - m_centronics(*this, CENTRONICS_TAG), - m_video_ram(*this, "video_ram"){ } - - required_device m_maincpu; - required_device m_cassette; - required_device m_speaker; - required_device m_centronics; - - virtual void machine_start(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE8_MEMBER( p2_w ); - DECLARE_READ8_MEMBER( p3_r ); - DECLARE_WRITE8_MEMBER( p3_w ); - DECLARE_PALETTE_INIT(jtc_es40); - optional_shared_ptr m_video_ram; - - int m_centronics_busy; - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); -}; - - -class jtces88_state : public jtc_state -{ -public: - jtces88_state(const machine_config &mconfig, device_type type, const char *tag) - : jtc_state(mconfig, type, tag) - { } -}; - - -class jtces23_state : public jtc_state -{ -public: - jtces23_state(const machine_config &mconfig, device_type type, const char *tag) - : jtc_state(mconfig, type, tag) - { } - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - - -class jtces40_state : public jtc_state -{ -public: - jtces40_state(const machine_config &mconfig, device_type type, const char *tag) - : jtc_state(mconfig, type, tag) - { } - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( videoram_r ); - DECLARE_WRITE8_MEMBER( videoram_w ); - DECLARE_WRITE8_MEMBER( banksel_w ); - - UINT8 m_video_bank; - UINT8 *m_color_ram_r; - UINT8 *m_color_ram_g; - UINT8 *m_color_ram_b; -}; - - -/* Read/Write Handlers */ - -WRITE8_MEMBER( jtc_state::p2_w ) -{ - /* - - bit description - - P20 - P21 - P22 - P23 - P24 - P25 centronics strobe output - P26 V4093 pins 1,2 - P27 DL299 pin 18 - - */ - - m_centronics->write_strobe(BIT(data, 5)); -} - -DECLARE_WRITE_LINE_MEMBER( jtc_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -READ8_MEMBER( jtc_state::p3_r ) -{ - /* - - bit description - - P30 tape input - P31 - P32 - P33 centronics busy input - P34 - P35 - P36 tape output - P37 speaker output - - */ - - UINT8 data = 0; - - data |= ((m_cassette)->input() < 0.0) ? 1 : 0; - data |= m_centronics_busy << 3; - - return data; -} - -WRITE8_MEMBER( jtc_state::p3_w ) -{ - /* - - bit description - - P30 tape input - P31 - P32 - P33 centronics busy input - P34 - P35 - P36 tape output - P37 speaker output - - */ - - /* tape */ - m_cassette->output( BIT(data, 6) ? +1.0 : -1.0); - - /* speaker */ - m_speaker->level_w(BIT(data, 7)); -} - -READ8_MEMBER( jtces40_state::videoram_r ) -{ - UINT8 data = 0; - - if (m_video_bank & 0x80) data |= m_color_ram_r[offset]; - if (m_video_bank & 0x40) data |= m_color_ram_g[offset]; - if (m_video_bank & 0x20) data |= m_color_ram_b[offset]; - if (m_video_bank & 0x10) data |= m_video_ram[offset]; - - return data; -} - -WRITE8_MEMBER( jtces40_state::videoram_w ) -{ - if (m_video_bank & 0x80) m_color_ram_r[offset] = data; - if (m_video_bank & 0x40) m_color_ram_g[offset] = data; - if (m_video_bank & 0x20) m_color_ram_b[offset] = data; - if (m_video_bank & 0x10) m_video_ram[offset] = data; -} - -WRITE8_MEMBER( jtces40_state::banksel_w ) -{ - m_video_bank = offset & 0xf0; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( jtc_mem, AS_PROGRAM, 8, jtc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1") - AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2") - AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3") - AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x0ff0) AM_READ_PORT("Y4") - AM_RANGE(0x7005, 0x7005) AM_MIRROR(0x0ff0) AM_READ_PORT("Y5") - AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x0ff0) AM_READ_PORT("Y6") - AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x0ff0) AM_READ_PORT("Y7") - AM_RANGE(0x7008, 0x7008) AM_MIRROR(0x0ff0) AM_READ_PORT("Y8") - AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9") - AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10") - AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11") - AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12") - AM_RANGE(0xe000, 0xfdff) AM_RAM - AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( jtc_es1988_mem, AS_PROGRAM, 8, jtces88_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0800, 0x0fff) AM_ROM - AM_RANGE(0x2000, 0x27ff) AM_ROM - AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1") - AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2") - AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3") - AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x0ff0) AM_READ_PORT("Y4") - AM_RANGE(0x7005, 0x7005) AM_MIRROR(0x0ff0) AM_READ_PORT("Y5") - AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x0ff0) AM_READ_PORT("Y6") - AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x0ff0) AM_READ_PORT("Y7") - AM_RANGE(0x7008, 0x7008) AM_MIRROR(0x0ff0) AM_READ_PORT("Y8") - AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9") - AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10") - AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11") - AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12") - AM_RANGE(0xe000, 0xfdff) AM_RAM - AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( jtc_es23_mem, AS_PROGRAM, 8, jtces23_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0800, 0x17ff) AM_ROM - AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0ff0) AM_READ_PORT("Y0") - AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1") - AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2") - AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3") - AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x0ff0) AM_READ_PORT("Y4") - AM_RANGE(0x7005, 0x7005) AM_MIRROR(0x0ff0) AM_READ_PORT("Y5") - AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x0ff0) AM_READ_PORT("Y6") - AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x0ff0) AM_READ_PORT("Y7") - AM_RANGE(0x7008, 0x7008) AM_MIRROR(0x0ff0) AM_READ_PORT("Y8") - AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9") - AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10") - AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11") - AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12") - AM_RANGE(0x700d, 0x700d) AM_MIRROR(0x0ff0) AM_READ_PORT("Y13") - AM_RANGE(0x700e, 0x700e) AM_MIRROR(0x0ff0) AM_READ_PORT("Y14") - AM_RANGE(0x700f, 0x700f) AM_MIRROR(0x0ff0) AM_READ_PORT("Y15") - AM_RANGE(0xe000, 0xfdff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( jtc_es40_mem, AS_PROGRAM, 8, jtces40_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0800, 0x1fff) AM_ROM - AM_RANGE(0x4000, 0x5fff) AM_READWRITE(videoram_r, videoram_w) - AM_RANGE(0x6000, 0x63ff) AM_WRITE(banksel_w) - AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1") - AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2") - AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3") - AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x0ff0) AM_READ_PORT("Y4") - AM_RANGE(0x7005, 0x7005) AM_MIRROR(0x0ff0) AM_READ_PORT("Y5") - AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x0ff0) AM_READ_PORT("Y6") - AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x0ff0) AM_READ_PORT("Y7") - AM_RANGE(0x7008, 0x7008) AM_MIRROR(0x0ff0) AM_READ_PORT("Y8") - AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9") - AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10") - AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11") - AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12") - AM_RANGE(0x8000, 0xffff) AM_RAM//BANK(1) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( jtc_io, AS_IO, 8, jtc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_NOP // A8-A15 - AM_RANGE(0x01, 0x01) AM_NOP // AD0-AD7 - AM_RANGE(0x02, 0x02) AM_WRITE(p2_w) - AM_RANGE(0x03, 0x03) AM_READWRITE(p3_r, p3_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( jtc ) - PORT_START("Y1") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 \xE2\x86\x93") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90 \xE2\x86\x92") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y2") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Y') - - PORT_START("Y3") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("Y4") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - - PORT_START("Y5") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - - PORT_START("Y6") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - - PORT_START("Y7") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Z') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - - PORT_START("Y8") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(0x2030) // per mille - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - - PORT_START("Y9") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("Y10") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("Y11") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR('*') PORT_CHAR(':') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("Y12") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('+') PORT_CHAR(';') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) -INPUT_PORTS_END - -static INPUT_PORTS_START( jtces23 ) - PORT_START("Y0") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("Y1") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Y') - - PORT_START("Y2") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("Y3") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - - PORT_START("Y4") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - - PORT_START("Y5") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - - PORT_START("Y6") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Z') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - - PORT_START("Y7") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - - PORT_START("Y8") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('[') - - PORT_START("Y9") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(']') - - PORT_START("Y10") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("Y11") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('\\') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RET") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("Y12") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) //PORT_CODE() PORT_CHAR('=') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) //PORT_CODE() PORT_CHAR('*') PORT_CHAR('^') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y13") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) // DBS - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) // DEL - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SPA - - PORT_START("Y14") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) // INS - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) // HOM - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("Y15") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) // CLS - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SOL - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) // RET -INPUT_PORTS_END - -static INPUT_PORTS_START( jtces40 ) - PORT_START("Y1") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHT3") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHT2") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHT1") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("Y2") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y') - - PORT_START("Y3") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("Y4") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - - PORT_START("Y5") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("Y6") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - - PORT_START("Y7") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("Y8") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("Y9") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('[') PORT_CHAR('{') - - PORT_START("Y10") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("Y11") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('=') PORT_CHAR('_') - - PORT_START("Y12") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('+') PORT_CHAR('-') PORT_CHAR('\\') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('*') PORT_CHAR('/') PORT_CHAR('|') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RET") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR('?') PORT_CHAR('~') -INPUT_PORTS_END - -/* Video */ - -void jtc_state::video_start() -{ -} - -UINT32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, sx; - - for (y = 0; y < 64; y++) - { - for (sx = 0; sx < 8; sx++) - { - UINT8 data = m_video_ram[(y * 8) + sx]; - - for (x = 0; x < 8; x++) - { - int color = BIT(data, x); - bitmap.pix16(y, (sx * 8) + x) = color; - } - } - } - - return 0; -} - -void jtces23_state::video_start() -{ -} - -UINT32 jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, sx; - - for (y = 0; y < 128; y++) - { - for (sx = 0; sx < 16; sx++) - { - UINT8 data = m_video_ram[(y * 16) + sx]; - - for (x = 0; x < 8; x++) - { - int color = BIT(data, x); - bitmap.pix16(y, (sx * 8) + x) = color; - } - } - } - - return 0; -} - -PALETTE_INIT_MEMBER(jtc_state,jtc_es40) -{ -} - -void jtces40_state::video_start() -{ - /* allocate memory */ - m_video_ram.allocate(JTC_ES40_VIDEORAM_SIZE); - m_color_ram_r = auto_alloc_array(machine(), UINT8, JTC_ES40_VIDEORAM_SIZE); - m_color_ram_g = auto_alloc_array(machine(), UINT8, JTC_ES40_VIDEORAM_SIZE); - m_color_ram_b = auto_alloc_array(machine(), UINT8, JTC_ES40_VIDEORAM_SIZE); - - /* register for state saving */ - save_item(NAME(m_video_bank)); - save_pointer(NAME(m_video_ram.target()), JTC_ES40_VIDEORAM_SIZE); - save_pointer(NAME(m_color_ram_r), JTC_ES40_VIDEORAM_SIZE); - save_pointer(NAME(m_color_ram_g), JTC_ES40_VIDEORAM_SIZE); - save_pointer(NAME(m_color_ram_b), JTC_ES40_VIDEORAM_SIZE); - save_item(NAME(m_centronics_busy)); -} - -UINT32 jtces40_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, sx; - - for (y = 0; y < 192; y++) - { - for (sx = 0; sx < 40; sx++) - { - UINT8 data = m_video_ram[(y * 40) + sx]; - UINT8 color_r = m_color_ram_r[(y * 40) + sx]; - UINT8 color_g = m_color_ram_g[(y * 40) + sx]; - UINT8 color_b = m_color_ram_b[(y * 40) + sx]; - - for (x = 0; x < 8; x++) - { - int color = (BIT(color_r, x) << 3) | (BIT(color_g, x) << 2) | (BIT(color_b, x) << 1) | BIT(data, x); - - bitmap.pix16(y, (sx * 8) + x) = color; - } - } - } - - return 0; -} - -/* Machine Initialization */ - -void jtc_state::machine_start() -{ - /* register for state saving */ -} - -/* Machine Driver */ - -/* F4 Character Displayer */ -static const gfx_layout jtces23_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 64, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout jtces40_charlayout = -{ - 8, 8, /* 8 x 16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( jtces23 ) - GFXDECODE_ENTRY( UB8830D_TAG, 0x1000, jtces23_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( jtces40 ) - GFXDECODE_ENTRY( UB8830D_TAG, 0x1000, jtces40_charlayout, 0, 8 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( basic, jtc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(UB8830D_TAG, UB8830D, XTAL_8MHz) - MCFG_CPU_PROGRAM_MAP(jtc_mem) - MCFG_CPU_IO_MAP(jtc_io) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(1, "mono", 0.25) - - /* cassette */ - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - /* printer */ - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(jtc_state, write_centronics_busy)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( jtc, basic ) - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(jtc_state, screen_update) - MCFG_SCREEN_SIZE(64, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 64-1, 0, 64-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( jtces88, jtc, jtces88_state ) - /* basic machine hardware */ - MCFG_CPU_MODIFY(UB8830D_TAG) - MCFG_CPU_PROGRAM_MAP(jtc_es1988_mem) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( jtces23, basic, jtces23_state ) - /* basic machine hardware */ - MCFG_CPU_MODIFY(UB8830D_TAG) - MCFG_CPU_PROGRAM_MAP(jtc_es23_mem) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(jtc_state, screen_update) - MCFG_SCREEN_SIZE(128, 128) - MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 128-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", jtces23) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( jtces40, basic, jtces40_state ) - /* basic machine hardware */ - MCFG_CPU_MODIFY(UB8830D_TAG) - MCFG_CPU_PROGRAM_MAP(jtc_es40_mem) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(jtc_state, screen_update) - MCFG_SCREEN_SIZE(320, 192) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 192-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", jtces40) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(jtc_state,jtc_es40) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_RAM_EXTRA_OPTIONS("16K,32K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( jtc ) - ROM_REGION( 0x10000, UB8830D_TAG, 0 ) - ROM_LOAD( "u883rom.bin", 0x0000, 0x0800, CRC(2453c8c1) SHA1(816f5d08f8064b69b1779eb6661fde091aa58ba8) ) - ROM_LOAD( "u2716c1.bin", 0x0800, 0x0800, NO_DUMP ) - ROM_LOAD( "u2716c2.bin", 0x2000, 0x0800, NO_DUMP ) -ROM_END - -ROM_START( jtces88 ) - ROM_REGION( 0x10000, UB8830D_TAG, 0 ) - ROM_LOAD( "u883rom.bin", 0x0000, 0x0800, CRC(2453c8c1) SHA1(816f5d08f8064b69b1779eb6661fde091aa58ba8) ) - ROM_LOAD( "es1988_0800.bin", 0x0800, 0x0800, CRC(af3e882f) SHA1(65af0d0f5f882230221e9552707d93ed32ba794d) ) - ROM_LOAD( "es1988_2000.bin", 0x2000, 0x0800, CRC(5ff87c1e) SHA1(fbd2793127048bd9706970b7bce84af2cb258dc5) ) -ROM_END - -ROM_START( jtces23 ) - ROM_REGION( 0x10000, UB8830D_TAG, 0 ) - ROM_LOAD( "u883rom.bin", 0x0000, 0x0800, CRC(2453c8c1) SHA1(816f5d08f8064b69b1779eb6661fde091aa58ba8) ) - ROM_LOAD( "es23_0800.bin", 0x0800, 0x1000, CRC(16128b64) SHA1(90fb0deeb5660f4a2bb38d51981cc6223d5ddf6b) ) -ROM_END - -ROM_START( jtces40 ) - ROM_REGION( 0x10000, UB8830D_TAG, 0 ) - ROM_LOAD( "u883rom.bin", 0x0000, 0x0800, CRC(2453c8c1) SHA1(816f5d08f8064b69b1779eb6661fde091aa58ba8) ) - ROM_LOAD( "es40_0800.bin", 0x0800, 0x1800, CRC(770c87ce) SHA1(1a5227ba15917f2a572cb6c27642c456f5b32b90) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, jtc, 0, 0, jtc, jtc, driver_device, 0, "Jugend+Technik", "CompJU+TEr", MACHINE_NOT_WORKING ) -COMP( 1988, jtces88, jtc, 0, jtces88,jtc, driver_device, 0, "Jugend+Technik", "CompJU+TEr (EMR-ES 1988)", MACHINE_NOT_WORKING ) -COMP( 1989, jtces23, jtc, 0, jtces23,jtces23, driver_device, 0, "Jugend+Technik", "CompJU+TEr (ES 2.3)", MACHINE_NOT_WORKING ) -COMP( 1990, jtces40, jtc, 0, jtces40,jtces40, driver_device, 0, "Jugend+Technik", "CompJU+TEr (ES 4.0)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/juicebox.c b/src/mess/drivers/juicebox.c deleted file mode 100644 index 0e84e6a1b20..00000000000 --- a/src/mess/drivers/juicebox.c +++ /dev/null @@ -1,362 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/******************************************************************************* - - Mattel Juice Box - - (C) 2011 Tim Schuerewegen - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "machine/s3c44b0.h" -#include "machine/smartmed.h" -#include "sound/dac.h" -#include "rendlay.h" - -//#define JUICEBOX_ENTER_DEBUG_MENU -//#define JUICEBOX_DISPLAY_ROM_ID - -#define VERBOSE_LEVEL ( 0 ) - -struct jb_smc_t -{ - int add_latch; - int cmd_latch; - int busy; -}; - -class juicebox_state : public driver_device -{ -public: - juicebox_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac"), - m_s3c44b0(*this, "s3c44b0"), - m_smartmedia(*this, "smartmedia") - { } - - required_device m_maincpu; - required_device m_dac; - required_device m_s3c44b0; - required_device m_smartmedia; - UINT32 port[9]; - jb_smc_t smc; - - #if defined(JUICEBOX_ENTER_DEBUG_MENU) || defined(JUICEBOX_DISPLAY_ROM_ID) - int port_g_read_count; - #endif - DECLARE_READ32_MEMBER(juicebox_nand_r); - DECLARE_WRITE32_MEMBER(juicebox_nand_w); - DECLARE_DRIVER_INIT(juicebox); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(port_changed); - inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); - void smc_reset( ); - void smc_init( ); - UINT8 smc_read( ); - void smc_write( UINT8 data); - DECLARE_READ32_MEMBER(s3c44b0_gpio_port_r); - DECLARE_WRITE32_MEMBER(s3c44b0_gpio_port_w); - DECLARE_WRITE16_MEMBER(s3c44b0_i2s_data_w); -}; - -inline void juicebox_state::verboselog(int n_level, const char *s_fmt, ...) -{ - if (VERBOSE_LEVEL >= n_level) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt); - vsprintf( buf, s_fmt, v); - va_end( v); - logerror( "%s: %s", machine().describe_context(), buf); - } -} - - -/*************************************************************************** - MACHINE HARDWARE -***************************************************************************/ - - -// SMARTMEDIA - -void juicebox_state::smc_reset( ) -{ - verboselog(5, "smc_reset\n"); - smc.add_latch = 0; - smc.cmd_latch = 0; -} - -void juicebox_state::smc_init( ) -{ - verboselog(5, "smc_init\n"); - smc_reset(); -} - -UINT8 juicebox_state::smc_read( ) -{ - UINT8 data; - if (m_smartmedia->is_present()) - { - data = m_smartmedia->data_r(); - } - else - { - data = 0xFF; - } - verboselog(5, "smc_read %08X\n", data); - return data; -} - -void juicebox_state::smc_write( UINT8 data) -{ - verboselog(5, "smc_write %08X\n", data); - if (m_smartmedia->is_present()) - { - if (smc.cmd_latch) - { - verboselog(5, "smartmedia_command_w %08X\n", data); - m_smartmedia->command_w(data); - } - else if (smc.add_latch) - { - verboselog(5, "smartmedia_address_w %08X\n", data); - m_smartmedia->address_w(data); - } - else - { - verboselog(5, "smartmedia_data_w %08X\n", data); - m_smartmedia->data_w(data); - } - } -} - -READ32_MEMBER(juicebox_state::s3c44b0_gpio_port_r) -{ - UINT32 data = port[offset]; - switch (offset) - { - case S3C44B0_GPIO_PORT_A : - { - data = 0x00000210; - } - break; - case S3C44B0_GPIO_PORT_B : - { - data = 0x00000000; - } - break; - case S3C44B0_GPIO_PORT_C : - { - // 0C0062C4 -> bit 8 is turned on - //data |= 1 << 13; - data = 0x0000FF15; - data &= (1 << 2) | (1 << 9) | (1 << 10) | (1 << 11); - data |= (1 << 2) | (1 << 9) | (1 << 10) | (1 << 11); - } - break; - case S3C44B0_GPIO_PORT_D : - { - data = 0x00000010; - } - break; - case S3C44B0_GPIO_PORT_E : - { - data = 0x000000DF; - } - break; - case S3C44B0_GPIO_PORT_F : - { - data = data | (0 << 7); - data = 0x0000009F; - data &= ~0xE0; - if (smc.cmd_latch) data = data | 0x00000020; - if (smc.add_latch) data = data | 0x00000040; - if (!smc.busy) data = data | 0x00000080; - } - break; - case S3C44B0_GPIO_PORT_G : - { - data = 0x0000009F; - data = (data & ~0x1F) | (ioport( "PORTG")->read() & 0x1F); - #if defined(JUICEBOX_ENTER_DEBUG_MENU) - if (port_g_read_count++ < 1) - { - data = 0x00000095; // PLAY + REVERSE - } - #elif defined(JUICEBOX_DISPLAY_ROM_ID) - if (port_g_read_count++ < 3) - { - data = 0x0000008A; // RETURN + FORWARD + STAR - } - #endif - } - break; - } -// data = ((rand() & 0xFF) << 24) | ((rand() & 0xFF) << 16) | ((rand() & 0xFF) << 8) | ((rand() & 0xFF) << 0); - return data; -} - -WRITE32_MEMBER(juicebox_state::s3c44b0_gpio_port_w) -{ - port[offset] = data; - switch (offset) - { - case S3C44B0_GPIO_PORT_F : - { - smc.cmd_latch = ((data & 0x00000020) != 0); - smc.add_latch = ((data & 0x00000040) != 0); - verboselog( 5, "s3c44b0_gpio_port_w - nand cle %d ale %d\n", (data & 0x20) ? 1 : 0, (data & 0x40) ? 1 : 0); - } - break; - } -} - -// ... - -READ32_MEMBER(juicebox_state::juicebox_nand_r) -{ - UINT32 data = 0; - if (mem_mask & 0x000000FF) data = data | (smc_read() << 0); - if (mem_mask & 0x0000FF00) data = data | (smc_read() << 8); - if (mem_mask & 0x00FF0000) data = data | (smc_read() << 16); - if (mem_mask & 0xFF000000) data = data | (smc_read() << 24); - verboselog( 5, "juicebox_nand_r %08X %08X %08X\n", offset, mem_mask, data); - return data; -} - -WRITE32_MEMBER(juicebox_state::juicebox_nand_w) -{ - verboselog( 5, "juicebox_nand_w %08X %08X %08X\n", offset, mem_mask, data); - if (mem_mask & 0x000000FF) smc_write((data >> 0) & 0xFF); - if (mem_mask & 0x0000FF00) smc_write((data >> 8) & 0xFF); - if (mem_mask & 0x00FF0000) smc_write((data >> 16) & 0xFF); - if (mem_mask & 0xFF000000) smc_write((data >> 24) & 0xFF); -} - -// I2S - -WRITE16_MEMBER(juicebox_state::s3c44b0_i2s_data_w ) -{ - m_dac->write_signed16(data ^ 0x8000); -} - -// ... - -INPUT_CHANGED_MEMBER(juicebox_state::port_changed) -{ - m_s3c44b0->request_eint((FPTR)param); -} - -// ... - -void juicebox_state::machine_start() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - smc_init(); - - space.install_readwrite_handler(0x01c00000, 0x01c0000b, 0, 0, read32_delegate(FUNC(s3c44b0_device::cpuwrap_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::cpuwrap_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d00000, 0x01d0002b, 0, 0, read32_delegate(FUNC(s3c44b0_device::uart_0_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::uart_0_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d04000, 0x01d0402b, 0, 0, read32_delegate(FUNC(s3c44b0_device::uart_1_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::uart_1_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d14000, 0x01d14013, 0, 0, read32_delegate(FUNC(s3c44b0_device::sio_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::sio_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d18000, 0x01d18013, 0, 0, read32_delegate(FUNC(s3c44b0_device::iis_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::iis_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d20000, 0x01d20057, 0, 0, read32_delegate(FUNC(s3c44b0_device::gpio_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::gpio_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d30000, 0x01d3000b, 0, 0, read32_delegate(FUNC(s3c44b0_device::wdt_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::wdt_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d40000, 0x01d4000b, 0, 0, read32_delegate(FUNC(s3c44b0_device::adc_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::adc_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d50000, 0x01d5004f, 0, 0, read32_delegate(FUNC(s3c44b0_device::pwm_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::pwm_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d60000, 0x01d6000f, 0, 0, read32_delegate(FUNC(s3c44b0_device::iic_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::iic_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01d80000, 0x01d8000f, 0, 0, read32_delegate(FUNC(s3c44b0_device::clkpow_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::clkpow_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01e00000, 0x01e0003f, 0, 0, read32_delegate(FUNC(s3c44b0_device::irq_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::irq_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01e80000, 0x01e8001b, 0, 0, read32_delegate(FUNC(s3c44b0_device::zdma_0_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::zdma_0_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01e80020, 0x01e8003b, 0, 0, read32_delegate(FUNC(s3c44b0_device::zdma_1_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::zdma_1_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01f00000, 0x01f00047, 0, 0, read32_delegate(FUNC(s3c44b0_device::lcd_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::lcd_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01f80000, 0x01f8001b, 0, 0, read32_delegate(FUNC(s3c44b0_device::bdma_0_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::bdma_0_w), &(*m_s3c44b0))); - space.install_readwrite_handler(0x01f80020, 0x01f8003b, 0, 0, read32_delegate(FUNC(s3c44b0_device::bdma_1_r), &(*m_s3c44b0)), write32_delegate(FUNC(s3c44b0_device::bdma_1_w), &(*m_s3c44b0))); -} - -void juicebox_state::machine_reset() -{ - m_maincpu->reset(); - smc_reset(); -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( juicebox_map, AS_PROGRAM, 32, juicebox_state ) - AM_RANGE(0x00000000, 0x007fffff) AM_ROM - AM_RANGE(0x04000000, 0x04ffffff) AM_READWRITE(juicebox_nand_r, juicebox_nand_w ) - AM_RANGE(0x0c000000, 0x0c1fffff) AM_RAM AM_MIRROR(0x00600000) -ADDRESS_MAP_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -DRIVER_INIT_MEMBER(juicebox_state,juicebox) -{ - // do nothing -} - -static MACHINE_CONFIG_START( juicebox, juicebox_state ) - MCFG_CPU_ADD("maincpu", ARM7, 66000000) - MCFG_CPU_PROGRAM_MAP(juicebox_map) - - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(240, 160) - MCFG_SCREEN_VISIBLE_AREA(0, 240 - 1, 0, 160 - 1) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_SCREEN_UPDATE_DEVICE("s3c44b0", s3c44b0_device, video_update) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - - MCFG_DEVICE_ADD("s3c44b0", S3C44B0, 10000000) - MCFG_S3C44B0_GPIO_PORT_R_CB(READ32(juicebox_state, s3c44b0_gpio_port_r)) - MCFG_S3C44B0_GPIO_PORT_W_CB(WRITE32(juicebox_state, s3c44b0_gpio_port_w)) - MCFG_S3C44B0_I2S_DATA_W_CB(WRITE16(juicebox_state, s3c44b0_i2s_data_w)) - - MCFG_DEVICE_ADD("smartmedia", SMARTMEDIA, 0) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","juicebox") -MACHINE_CONFIG_END - -static INPUT_PORTS_START( juicebox ) - PORT_START( "PORTG" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("RETURN") PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("PLAY") PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("FORWARD") PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("REVERSE") PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, juicebox_state, port_changed, (void *)0) PORT_NAME("STAR") PORT_PLAYER(1) -INPUT_PORTS_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -ROM_START( juicebox ) - ROM_REGION( 0x800000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "juicebox", "Juice Box v.28 08242004" ) - ROMX_LOAD( "juicebox.rom", 0, 0x800000, CRC(ac731197) SHA1(8278891c3531b3b6b5fec2a97a3ef6f0de1ac81d), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "uclinuxp", "uClinux 2.4.24-uc0 (patched)" ) - ROMX_LOAD( "newboot.rom", 0, 0x1A0800, CRC(443f48b7) SHA1(38f0dc07b5cf02b972a851aa9e87f5d93d03f629), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "uclinux", "uClinux 2.4.24-uc0" ) - ROMX_LOAD( "image.rom", 0, 0x19E400, CRC(6c0308bf) SHA1(5fe21a38a4cd0d86bb60920eb100138b0e924d90), ROM_BIOS(3) ) -ROM_END - -COMP(2004, juicebox, 0, 0, juicebox, juicebox, juicebox_state, juicebox, "Mattel", "Juice Box", 0) diff --git a/src/mess/drivers/junior.c b/src/mess/drivers/junior.c deleted file mode 100644 index d40101213d6..00000000000 --- a/src/mess/drivers/junior.c +++ /dev/null @@ -1,259 +0,0 @@ -// license:??? -// copyright-holders:Robbbert, Manfred Schneider -/*************************************************************************** - - Elektor Junior - - 17/07/2009 Skeleton driver. - -This is heavily based on the KIM-1, the keycodes and operation being -identical. - -Pasting: - 0-F : as is - + (inc) : ^ - AD : - - DA : = - GO : X - -(note: DA only works when addressing RAM) - -Test Paste: - =11^22^33^44^55^66^77^88^99^-0000 - Now press up-arrow to confirm the data has been entered. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/mos6530n.h" -#include "junior.lh" - - -class junior_state : public driver_device -{ -public: - junior_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_riot(*this, "riot") - , - m_maincpu(*this, "maincpu") { } - - required_device m_riot; - DECLARE_READ8_MEMBER(junior_riot_a_r); - DECLARE_READ8_MEMBER(junior_riot_b_r); - DECLARE_WRITE8_MEMBER(junior_riot_a_w); - DECLARE_WRITE8_MEMBER(junior_riot_b_w); - DECLARE_WRITE_LINE_MEMBER(junior_riot_irq); - UINT8 m_port_a; - UINT8 m_port_b; - UINT8 m_led_time[6]; - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(junior_reset); - TIMER_DEVICE_CALLBACK_MEMBER(junior_update_leds); - required_device m_maincpu; -}; - - - - -static ADDRESS_MAP_START(junior_mem, AS_PROGRAM, 8, junior_state) - ADDRESS_MAP_GLOBAL_MASK(0x1FFF) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x03ff) AM_RAM // 1K RAM - AM_RANGE(0x1a00, 0x1a7f) AM_DEVICE("riot", mos6532_t, ram_map) - AM_RANGE(0x1a80, 0x1a9f) AM_DEVICE("riot", mos6532_t, io_map) - AM_RANGE(0x1c00, 0x1fff) AM_ROM // Monitor -ADDRESS_MAP_END - - -INPUT_CHANGED_MEMBER(junior_state::junior_reset) -{ - if (newval == 0) - m_maincpu->reset(); -} - - -/* Input ports */ -static INPUT_PORTS_START( junior ) -PORT_START("LINE0") /* IN0 keys row 0 */ - PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - - PORT_START("LINE1") /* IN1 keys row 1 */ - PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("LINE2") /* IN2 keys row 2 */ - PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_F6) - - PORT_START("LINE3") /* IN3 STEP and RESET keys, MODE switch */ - PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("sw1: ST") PORT_CODE(KEYCODE_F7) - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("sw2: RST") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, junior_state, junior_reset, NULL) - PORT_DIPNAME(0x10, 0x10, "sw3: SS (NumLock)") PORT_CODE(KEYCODE_NUMLOCK) PORT_TOGGLE - PORT_DIPSETTING( 0x00, "single step") - PORT_DIPSETTING( 0x10, "run") - PORT_BIT( 0x08, 0x00, IPT_UNUSED ) - PORT_BIT( 0x04, 0x00, IPT_UNUSED ) - PORT_BIT( 0x02, 0x00, IPT_UNUSED ) - PORT_BIT( 0x01, 0x00, IPT_UNUSED ) -INPUT_PORTS_END - - - -READ8_MEMBER( junior_state::junior_riot_a_r ) -{ - UINT8 data = 0xff; - - switch( ( m_port_b >> 1 ) & 0x0f ) - { - case 0: - data = ioport("LINE0")->read(); - break; - case 1: - data = ioport("LINE1")->read(); - break; - case 2: - data = ioport("LINE2")->read(); - break; - } - return data; - -} - - -READ8_MEMBER( junior_state::junior_riot_b_r ) -{ - if ( m_port_b & 0x20 ) - return 0xFF; - - return 0x7F; - -} - - -WRITE8_MEMBER( junior_state::junior_riot_a_w ) -{ - UINT8 idx = ( m_port_b >> 1 ) & 0x0f; - - m_port_a = data; - - if ((idx >= 4 && idx < 10) & ( m_port_a != 0xff )) - { - output_set_digit_value( idx-4, m_port_a ^ 0x7f ); - m_led_time[idx - 4] = 10; - } -} - - -WRITE8_MEMBER( junior_state::junior_riot_b_w ) -{ - UINT8 idx = ( data >> 1 ) & 0x0f; - - m_port_b = data; - - if ((idx >= 4 && idx < 10) & ( m_port_a != 0xff )) - { - output_set_digit_value( idx-4, m_port_a ^ 0x7f ); - m_led_time[idx - 4] = 10; - } -} - - -WRITE_LINE_MEMBER( junior_state::junior_riot_irq ) -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, state ? HOLD_LINE : CLEAR_LINE); -} - - -TIMER_DEVICE_CALLBACK_MEMBER(junior_state::junior_update_leds) -{ - int i; - - for ( i = 0; i < 6; i++ ) - { - if ( m_led_time[i] ) - m_led_time[i]--; - else - output_set_digit_value( i, 0 ); - } -} - - -void junior_state::machine_start() -{ - save_item(NAME(m_port_a)); - save_item(NAME(m_port_b)); -} - - -void junior_state::machine_reset() -{ - int i; - - for ( i = 0; i < 6; i++ ) - m_led_time[i] = 0; -} - - -static MACHINE_CONFIG_START( junior, junior_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6502, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(junior_mem) - MCFG_QUANTUM_TIME(attotime::from_hz(50)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_junior ) - - /* Devices */ - MCFG_DEVICE_ADD("riot", MOS6532n, XTAL_1MHz) - MCFG_MOS6530n_IN_PA_CB(READ8(junior_state, junior_riot_a_r)) - MCFG_MOS6530n_OUT_PA_CB(WRITE8(junior_state, junior_riot_a_w)) - MCFG_MOS6530n_IN_PB_CB(READ8(junior_state, junior_riot_b_r)) - MCFG_MOS6530n_OUT_PB_CB(WRITE8(junior_state, junior_riot_b_w)) - MCFG_MOS6530n_IRQ_CB(WRITELINE(junior_state, junior_riot_irq)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", junior_state, junior_update_leds, attotime::from_hz(50)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( junior ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS("orig") - - ROM_SYSTEM_BIOS( 0, "orig", "Original ESS503" ) - ROMX_LOAD( "ess503.ic2", 0x1c00, 0x0400, CRC(9e804f8c) SHA1(181bdb69fb4711cb008e7966747d4775a5e3ef69), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "mod-orig", "Mod-Original (2708)" ) - ROMX_LOAD( "junior-mod.ic2", 0x1c00, 0x0400, CRC(ee8aa69d) SHA1(a132a51603f1a841c354815e6d868b335ac84364), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS( 2, "2732", "Just monitor (2732)" ) - ROMX_LOAD( "junior27321a.ic2", 0x1c00, 0x0400, CRC(e22f24cc) SHA1(a6edb52a9eea5e99624c128065e748e5a3fb2e4c), ROM_BIOS(3)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, junior, 0, 0, junior, junior, driver_device, 0, "Elektor Electronics", "Junior Computer", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/jupace.c b/src/mess/drivers/jupace.c deleted file mode 100644 index 9a3856bcc1c..00000000000 --- a/src/mess/drivers/jupace.c +++ /dev/null @@ -1,835 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Robbbert -/*************************************************************************** -Jupiter Ace memory map - - CPU: Z80 - 0000-1fff ROM - 2000-23ff Mirror of 2400-27FF - 2400-27ff RAM (1K RAM used for screen and edit/cassette buffer) - 2800-2bff Mirror of 2C00-2FFF - 2c00-2fff RAM (1K RAM for char set, write only) - 3000-3bff Mirror of 3C00-3FFF - 3c00-3fff RAM (1K RAM standard) - 4000-7fff RAM (16K Expansion) - 8000-ffff RAM (48K Expansion) - -Interrupts: - - IRQ: - 50Hz vertical sync - -Ports: - - Out 0xfe: - Tape and buzzer - - In 0xfe: - Keyboard input, tape, and buzzer - - http://www.jupiter-ace.co.uk/ - -***************************************************************************/ - -/* - - TODO: - - - Ace Colour Board - - 96K ram expansion - - Deep Thought disc interface (6850, 6821) - -*/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "formats/ace_tap.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8255.h" -#include "machine/ram.h" -#include "machine/z80pio.h" -#include "sound/ay8910.h" -#include "sound/sp0256.h" -#include "sound/speaker.h" -#include "sound/wave.h" - - -#define Z80_TAG "z0" -#define AY8910_TAG "ay8910" -#define I8255_TAG "i8255" -#define SP0256AL2_TAG "ic1" -#define Z80PIO_TAG "z80pio" -#define CENTRONICS_TAG "centronics" -#define SCREEN_TAG "screen" - -class ace_state : public driver_device -{ -public: - ace_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ppi(*this, I8255_TAG), - m_z80pio(*this, Z80PIO_TAG), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_centronics(*this, CENTRONICS_TAG), - m_ram(*this, RAM_TAG), - m_sp0256(*this, SP0256AL2_TAG), - m_video_ram(*this, "video_ram"), - m_char_ram(*this, "char_ram"), - m_a8(*this, "A8"), - m_a9(*this, "A9"), - m_a10(*this, "A10"), - m_a11(*this, "A11"), - m_a12(*this, "A12"), - m_a13(*this, "A13"), - m_a14(*this, "A14"), - m_a15(*this, "A15"), - m_joy(*this, "JOY") - { } - - virtual void machine_start(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - DECLARE_READ8_MEMBER( ppi_pa_r ); - DECLARE_WRITE8_MEMBER( ppi_pa_w ); - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_WRITE8_MEMBER( ppi_pb_w ); - DECLARE_READ8_MEMBER( ppi_pc_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - DECLARE_READ8_MEMBER( ppi_control_r ); - DECLARE_WRITE8_MEMBER( ppi_control_w ); - DECLARE_READ8_MEMBER( pio_pa_r ); - DECLARE_WRITE8_MEMBER( pio_pa_w ); - - UINT32 screen_update_ace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(set_irq); - TIMER_DEVICE_CALLBACK_MEMBER(clear_irq); - DECLARE_READ8_MEMBER(pio_ad_r); - DECLARE_READ8_MEMBER(pio_bd_r); - DECLARE_READ8_MEMBER(pio_ac_r); - DECLARE_READ8_MEMBER(pio_bc_r); - DECLARE_WRITE8_MEMBER(pio_ad_w); - DECLARE_WRITE8_MEMBER(pio_bd_w); - DECLARE_WRITE8_MEMBER(pio_ac_w); - DECLARE_WRITE8_MEMBER(pio_bc_w); - DECLARE_READ8_MEMBER(sby_r); - DECLARE_WRITE8_MEMBER(ald_w); - DECLARE_SNAPSHOT_LOAD_MEMBER( ace ); - -private: - required_device m_maincpu; - required_device m_ppi; - required_device m_z80pio; - required_device m_speaker; - required_device m_cassette; - required_device m_centronics; - required_device m_ram; - required_device m_sp0256; - required_shared_ptr m_video_ram; - required_shared_ptr m_char_ram; - required_ioport m_a8; - required_ioport m_a9; - required_ioport m_a10; - required_ioport m_a11; - required_ioport m_a12; - required_ioport m_a13; - required_ioport m_a14; - required_ioport m_a15; - required_ioport m_joy; -}; - - -/* Load in .ace files. These are memory images of 0x2000 to 0x7fff - and compressed as follows: - - ED 00 : End marker - ED : repeat count times - : -*/ - -/****************************************************************************** - Snapshot Handling -******************************************************************************/ - -SNAPSHOT_LOAD_MEMBER( ace_state, ace ) -{ - cpu_device *cpu = m_maincpu; - UINT8 *RAM = memregion(cpu->tag())->base(); - address_space &space = cpu->space(AS_PROGRAM); - unsigned char ace_repeat, ace_byte, loop; - int done=0, ace_index=0x2000; - - if (m_ram->size() < 16*1024) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "At least 16KB RAM expansion required"); - image.message("At least 16KB RAM expansion required"); - return IMAGE_INIT_FAIL; - } - - logerror("Loading file %s.\r\n", image.filename()); - while (!done && (ace_index < 0x8001)) - { - image.fread( &ace_byte, 1); - if (ace_byte == 0xed) - { - image.fread(&ace_byte, 1); - switch (ace_byte) - { - case 0x00: - logerror("File loaded!\r\n"); - done = 1; - break; - case 0x01: - image.fread(&ace_byte, 1); - RAM[ace_index++] = ace_byte; - break; - default: - image.fread(&ace_repeat, 1); - for (loop = 0; loop < ace_byte; loop++) - RAM[ace_index++] = ace_repeat; - break; - } - } - else - RAM[ace_index++] = ace_byte; - } - - logerror("Decoded %X bytes.\r\n", ace_index-0x2000); - - if (!done) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "EOF marker not found"); - image.message("EOF marker not found"); - return IMAGE_INIT_FAIL; - } - - // patch CPU registers - // Some games do not follow the standard, and have rubbish in the CPU area. So, - // we check that some other bytes are correct. - // 2080 = memory size of original machine, should be 0000 or 8000 or C000. - // 2118 = new stack pointer, do not use if between 8000 and FF00. - - ace_index = RAM[0x2080] | (RAM[0x2081] << 8); - - if ((ace_index & 0x3FFF)==0) - { - cpu->set_state_int(Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8)); - cpu->set_state_int(Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8)); - cpu->set_state_int(Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8)); - cpu->set_state_int(Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8)); - cpu->set_state_int(Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8)); - cpu->set_state_int(Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8)); - cpu->set_pc(RAM[0x211c] | (RAM[0x211d] << 8)); - cpu->set_state_int(Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8)); - cpu->set_state_int(Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8)); - cpu->set_state_int(Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8)); - cpu->set_state_int(Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8)); - cpu->set_state_int(Z80_IM, RAM[0x2130]); - cpu->set_state_int(Z80_IFF1, RAM[0x2134]); - cpu->set_state_int(Z80_IFF2, RAM[0x2138]); - cpu->set_state_int(Z80_I, RAM[0x213c]); - cpu->set_state_int(Z80_R, RAM[0x2140]); - - if ((RAM[0x2119] < 0x80) || !ace_index) - cpu->set_state_int(STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8)); - } - - /* Copy data to the address space */ - for (ace_index = 0x2000; ace_index < 0x8000; ace_index++) - space.write_byte(ace_index, RAM[ace_index]); - - return IMAGE_INIT_PASS; -} - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// io_r - -//------------------------------------------------- - -READ8_MEMBER( ace_state::io_r ) -{ - UINT8 data = 0xff; - - if (!BIT(offset, 8)) data &= m_a8->read(); - if (!BIT(offset, 9)) data &= m_a9->read(); - if (!BIT(offset, 10)) data &= m_a10->read(); - if (!BIT(offset, 11)) data &= m_a11->read(); - if (!BIT(offset, 12)) data &= m_a12->read(); - if (!BIT(offset, 13)) data &= m_a13->read(); - if (!BIT(offset, 14)) data &= m_a14->read(); - - if (!BIT(offset, 15)) - { - data &= m_a15->read(); - - m_cassette->output(-1); - m_speaker->level_w(0); - } - - if (m_cassette->input() > 0) - { - data &= ~0x20; - } - - return data; -} - - -//------------------------------------------------- -// io_w - -//------------------------------------------------- - -WRITE8_MEMBER( ace_state::io_w ) -{ - m_cassette->output(1); - m_speaker->level_w(1); -} - - -//------------------------------------------------- -// ppi_r - -//------------------------------------------------- - -READ8_MEMBER( ace_state::ppi_pa_r ) -{ - return m_ppi->read(space, 0); -} - -READ8_MEMBER( ace_state::ppi_pb_r ) -{ - return m_ppi->read(space, 1); -} - -READ8_MEMBER( ace_state::ppi_pc_r ) -{ - return m_ppi->read(space, 2); -} - -READ8_MEMBER( ace_state::ppi_control_r ) -{ - return m_ppi->read(space, 3); -} - - -//------------------------------------------------- -// ppi_w - -//------------------------------------------------- - -WRITE8_MEMBER( ace_state::ppi_pa_w ) -{ - m_ppi->write(space, 0, data); -} - -WRITE8_MEMBER( ace_state::ppi_pb_w ) -{ - m_ppi->write(space, 1, data); -} - -WRITE8_MEMBER( ace_state::ppi_pc_w ) -{ - m_ppi->write(space, 2, data); -} - -WRITE8_MEMBER( ace_state::ppi_control_w ) -{ - m_ppi->write(space, 3, data); -} - - -//------------------------------------------------- -// pio_r - -//------------------------------------------------- - -READ8_MEMBER(ace_state::pio_ad_r) -{ - return m_z80pio->data_read(0); -} - -READ8_MEMBER(ace_state::pio_bd_r) -{ - return m_z80pio->data_read(1); -} - -READ8_MEMBER(ace_state::pio_ac_r) -{ - return m_z80pio->control_read(); -} - -READ8_MEMBER(ace_state::pio_bc_r) -{ - return m_z80pio->control_read(); -} - - -//------------------------------------------------- -// pio_w - -//------------------------------------------------- - -WRITE8_MEMBER(ace_state::pio_ad_w) -{ - m_z80pio->data_write(0, data); -} - -WRITE8_MEMBER(ace_state::pio_bd_w) -{ - m_z80pio->data_write(1, data); -} - -WRITE8_MEMBER(ace_state::pio_ac_w) -{ - m_z80pio->control_write(0, data); -} - -WRITE8_MEMBER(ace_state::pio_bc_w) -{ - m_z80pio->control_write(1, data); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( ace_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ace_mem, AS_PROGRAM, 8, ace_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0400) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0x2800, 0x2bff) AM_MIRROR(0x0400) AM_RAM AM_SHARE("char_ram") AM_REGION(Z80_TAG, 0xfc00) - AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM - AM_RANGE(0x4000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( ace_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ace_io, AS_IO, 8, ace_state ) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xfffe) AM_MASK(0xff00) AM_READWRITE(io_r, io_w) - AM_RANGE(0x01, 0x01) AM_MIRROR(0xff00) AM_READ_PORT("JOY") - AM_RANGE(0x41, 0x41) AM_MIRROR(0xff80) AM_READWRITE(ppi_pa_r, ppi_pa_w) - AM_RANGE(0x43, 0x43) AM_MIRROR(0xff80) AM_READWRITE(ppi_pb_r, ppi_pb_w) - AM_RANGE(0x45, 0x45) AM_MIRROR(0xff80) AM_READWRITE(ppi_pc_r, ppi_pc_w) - AM_RANGE(0x47, 0x47) AM_MIRROR(0xff80) AM_READWRITE(ppi_control_r, ppi_control_w) - AM_RANGE(0x81, 0x81) AM_MIRROR(0xff38) AM_READWRITE(pio_ad_r, pio_ad_w) - AM_RANGE(0x83, 0x83) AM_MIRROR(0xff38) AM_READWRITE(pio_bd_r, pio_bd_w) - AM_RANGE(0x85, 0x85) AM_MIRROR(0xff38) AM_READWRITE(pio_ac_r, pio_ac_w) - AM_RANGE(0x87, 0x87) AM_MIRROR(0xff38) AM_READWRITE(pio_bc_r, pio_bc_w) - AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w) - AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_DEVREADWRITE(AY8910_TAG, ay8910_device, data_r, data_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( ace ) -//------------------------------------------------- - -static INPUT_PORTS_START( ace ) - PORT_START("A8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Symbol Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(':') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('\xA3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('?') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("A9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR('~') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR('|') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR('\\') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("A10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR('>') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("A11") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_LEFT) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("A12") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_DOWN) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_UP) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("A13") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(';') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00A9) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(']') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR('[') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("A14") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("h H \xE2\x86\x91") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("A15") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR('.') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(',') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR('/') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("JOY") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -//------------------------------------------------- -// gfx_layout ace_charlayout -//------------------------------------------------- - -static const gfx_layout ace_charlayout = -{ - 8,8, - 128, - 1, - { RGN_FRAC(0,1) }, - { STEP8(0,1) }, - { STEP8(0,8) }, - 8*8 -}; - - -//------------------------------------------------- -// GFXDECODE( ace ) -//------------------------------------------------- - -static GFXDECODE_START( ace ) - GFXDECODE_ENTRY( Z80_TAG, 0xfc00, ace_charlayout, 0, 1 ) -GFXDECODE_END - - -//------------------------------------------------- -// TIMER_DEVICE_CALLBACK_MEMBER( set_irq ) -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(ace_state::set_irq) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); -} - - -//------------------------------------------------- -// TIMER_DEVICE_CALLBACK_MEMBER( clear_irq ) -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(ace_state::clear_irq) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); -} - - -UINT32 ace_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=56,ma=0,x; - - for (y = 0; y < 24; y++) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++, 40); - - for (x = ma; x < ma+32; x++) - { - chr = m_video_ram[x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=32; - } - return 0; -} - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// I8255A interface -//------------------------------------------------- - -READ8_MEMBER(ace_state::sby_r) -{ - /* - - bit description - - PC0 SP0256 SBY - PC1 - PC2 - PC3 - PC4 - PC5 - PC6 - PC7 - - */ - - return m_sp0256->sby_r(); -} - -WRITE8_MEMBER(ace_state::ald_w) -{ - /* - - bit description - - PA0 SP0256 A1 - PA1 SP0256 A2 - PA2 SP0256 A3 - PA3 SP0256 A4 - PA4 SP0256 A5 - PA5 SP0256 A6 - PA6 SP0256 _ALD - PA7 - - */ - - if (!BIT(data, 6)) - { - m_sp0256->ald_w(space, 0, data & 0x3f); - } -} - -//------------------------------------------------- -// Z80PIO -//------------------------------------------------- - -READ8_MEMBER( ace_state::pio_pa_r ) -{ - /* - - bit description - - PA0 - PA1 RxD - PA2 - PA3 - PA4 - PA5 - PA6 - PA7 - - */ - - return 0; -} - -WRITE8_MEMBER( ace_state::pio_pa_w ) -{ - /* - - bit description - - PA0 RTS - PA1 - PA2 CTS - PA3 TxD - PA4 - PA5 - PA6 STB - PA7 - - */ - - // centronics strobe - m_centronics->write_strobe(!BIT(data, 6)); -} - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( ace ) -//------------------------------------------------- - -void ace_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* configure RAM */ - switch (m_ram->size()) - { - case 1*1024: - program.unmap_readwrite(0x4000, 0xffff); - break; - - case 16*1024: - program.unmap_readwrite(0x8000, 0xffff); - break; - - case 32*1024: - program.unmap_readwrite(0xc000, 0xffff); - break; - } -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( ace ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ace, ace_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_6_5MHz/2) - MCFG_CPU_PROGRAM_MAP(ace_mem) - MCFG_CPU_IO_MAP(ace_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(ace_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_6_5MHz, 416, 0, 336, 312, 0, 304) - MCFG_SCREEN_PALETTE("palette") - - MCFG_TIMER_DRIVER_ADD_SCANLINE("set_irq", ace_state, set_irq, SCREEN_TAG, 31*8, 264) - MCFG_TIMER_DRIVER_ADD_SCANLINE("clear_irq", ace_state, clear_irq, SCREEN_TAG, 32*8, 264) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ace) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_6_5MHz/2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_ADD(SP0256AL2_TAG, SP0256, XTAL_3MHz) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(ace_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) - MCFG_CASSETTE_INTERFACE("jupace_cass") - - MCFG_SNAPSHOT_ADD("snapshot", ace_state, ace, "ace", 1) - - MCFG_DEVICE_ADD(I8255_TAG, I8255A, 0) - MCFG_I8255_IN_PORTB_CB(READ8(ace_state, sby_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(ace_state, ald_w)) - - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_6_5MHz/2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(ace_state, pio_pa_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(ace_state, pio_pa_w)) - MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") - MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "jupace_cass") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( ace ) -//------------------------------------------------- - -ROM_START( jupace ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "rom-a.z1", 0x0000, 0x1000, CRC(dc8438a5) SHA1(8fa97eb71e5dd17c7d190c6587ee3840f839347c) ) - ROM_LOAD( "rom-b.z2", 0x1000, 0x1000, CRC(4009f636) SHA1(98c5d4bcd74bcf014268cf4c00b2007ea5cc21f3) ) - - ROM_REGION( 0x1000, "fdc", 0 ) // Deep Thought disc interface - ROM_LOAD( "dos 4.bin", 0x0000, 0x1000, CRC(04c70448) SHA1(53ddcced6ae2feafd687a3b55864726656b71412) ) - - ROM_REGION( 0x10000, SP0256AL2_TAG, 0 ) - ROM_LOAD( "sp0256-al2.ic1", 0x000, 0x800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1981, jupace, 0, 0, ace, ace, driver_device, 0, "Jupiter Cantab", "Jupiter Ace" , 0 ) diff --git a/src/mess/drivers/jupiter.c b/src/mess/drivers/jupiter.c deleted file mode 100644 index 7d0fc11250a..00000000000 --- a/src/mess/drivers/jupiter.c +++ /dev/null @@ -1,365 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Robbbert -/************************************************************************** - -Wave Mate Jupiter - - - -Jupiter 3 -********* - -Status: Preliminary -Hangs if your input line starts with 'k'. - -ToDo: -- Connect all devices -- Everything! - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "machine/keyboard.h" -#include "machine/terminal.h" -#include "machine/wd_fdc.h" -#include "includes/jupiter.h" - -#define TERMINAL_TAG "terminal" -#define KEYBOARD_TAG "keyboard" - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( jupiter_m6800_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( jupiter_m6800_mem, AS_PROGRAM, 8, jupiter2_state ) - AM_RANGE(0x0000, 0x7fff) AM_RAM -// AM_RANGE(0xc000, 0xcfff) Video RAM - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(MCM6571AP_TAG, 0) -// AM_RANGE(0xff58, 0xff5c) Cartridge Disk Controller PIA -// AM_RANGE(0xff60, 0xff76) DMA Controller -// AM_RANGE(0xff80, 0xff83) Floppy PIA - AM_RANGE(0xff84, 0xff87) AM_DEVREADWRITE(INS1771N1_TAG, wd_fdc_t, read, write) -// AM_RANGE(0xff90, 0xff93) Hytype Parallel Printer PIA -// AM_RANGE(0xffa0, 0xffa7) Persci Floppy Disk Controller -// AM_RANGE(0xffb0, 0xffb3) Video PIA -// AM_RANGE(0xffc0, 0xffc1) Serial Port 0 ACIA -// AM_RANGE(0xffc4, 0xffc5) Serial Port 1 ACIA -// AM_RANGE(0xffc8, 0xffc9) Serial Port 2 ACIA -// AM_RANGE(0xffcc, 0xffcd) Serial Port 3 ACIA -// AM_RANGE(0xffd0, 0xffd1) Serial Port 4 ACIA / Cassette -// AM_RANGE(0xffd4, 0xffd5) Serial Port 5 ACIA / EPROM Programmer (2704/2708) -// AM_RANGE(0xffd8, 0xffd9) Serial Port 6 ACIA / Hardware Breakpoint Registers -// AM_RANGE(0xffdc, 0xffdd) Serial Port 7 ACIA -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( jupiter_m6800_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( jupiter_m6800_io, AS_IO, 8, jupiter2_state ) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( jupiter3_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( jupiter3_mem, AS_PROGRAM, 8, jupiter3_state ) - AM_RANGE(0x0000, 0xbfff) AM_RAM AM_SHARE("p_ram") - AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("p_videoram") - AM_RANGE(0xe000, 0xefff) AM_ROM AM_REGION(Z80_TAG, 0) - AM_RANGE(0xf000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( jupiter3_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( jupiter3_io, AS_IO, 8, jupiter3_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xa1, 0xa4) AM_READ(ff_r) - AM_RANGE(0xb0, 0xb0) AM_READ(status_r) - AM_RANGE(0xb2, 0xb2) AM_READ(key_r) -ADDRESS_MAP_END - -READ8_MEMBER( jupiter3_state::ff_r ) -{ - return 0xfd; -} - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( jupiter ) -//------------------------------------------------- - -static INPUT_PORTS_START( jupiter ) -INPUT_PORTS_END - -READ8_MEMBER( jupiter3_state::key_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( jupiter3_state::status_r ) -{ - return (m_term_data) ? 0x80 : 0x00; -} - -WRITE8_MEMBER( jupiter3_state::kbd_put ) -{ - if (data) - m_term_data = data ^ 0x80; -} - - -//************************************************************************** -// VIDEO -//************************************************************************** - -void jupiter3_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 jupiter3_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 32; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x++) - { - gfx = 0; - if (ra < 9) - { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<4) | ra ]; - } - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} - - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -static SLOT_INTERFACE_START( jupiter_floppies ) - SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) -SLOT_INTERFACE_END - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( jupiter ) -//------------------------------------------------- - -void jupiter2_state::machine_start() -{ -} - - -//------------------------------------------------- -// MACHINE_START( jupiter3 ) -//------------------------------------------------- - -void jupiter3_state::machine_reset() -{ - UINT8* ROM = memregion(Z80_TAG)->base(); - memcpy(m_p_ram, ROM, 0x1000); - m_maincpu->set_pc(0xe000); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( jupiter ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( jupiter, jupiter2_state ) - // basic machine hardware - MCFG_CPU_ADD(MCM6571AP_TAG, M6800, 2000000) - MCFG_CPU_PROGRAM_MAP(jupiter_m6800_mem) - MCFG_CPU_IO_MAP(jupiter_m6800_io) - - // devices - MCFG_DEVICE_ADD(INS1771N1_TAG, FD1771, 1000000) - MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":0", jupiter_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":1", jupiter_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( jupiter3 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( jupiter3, jupiter3_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(jupiter3_mem) - MCFG_CPU_IO_MAP(jupiter3_io) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(jupiter3_state, screen_update) - MCFG_SCREEN_SIZE(512, 320) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 320-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - // devices - MCFG_DEVICE_ADD(INS1771N1_TAG, FD1771, 1000000) - MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":0", jupiter_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(INS1771N1_TAG":1", jupiter_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(jupiter3_state, kbd_put)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( jupiter2 ) -//------------------------------------------------- - -ROM_START( jupiter2 ) - ROM_REGION( 0x1000, MCM6571AP_TAG, ROMREGION_INVERT ) // address and data lines are inverted - ROM_LOAD( "idb v1.1 for 60k jii f000.1c", 0x0000, 0x0400, CRC(50893aae) SHA1(da0222c4cb6188f6cfc657fc33558d0a6a41cd1a) ) - ROM_LOAD( "idb v1.1 for 60k jii f400.6c", 0x0400, 0x0400, CRC(a435344a) SHA1(bc4f4143301b10ec762ecc0cb69e5a9d4c4bef7b) ) - ROM_LOAD( "idb v1.1 for 60k jii f800.1d", 0x0800, 0x0400, CRC(ab82df45) SHA1(be7ea5347ff0582401e26c2fa10e13463cbe57c6) ) - ROM_LOAD( "boot_v2.6_sn5d00000000000003_fc00.6d", 0x0c00, 0x0400, CRC(8f33e4ed) SHA1(fb206e5019c166583ff516de3608ae86d2636d2a) ) - ROM_LOAD( "jupiter ii boot rom v2.6 12_18_82 s_n 5d000...0015.6d", 0x0c00, 0x0400, CRC(f87cefdf) SHA1(229ea961e6036ec39e0ae33abc7f554bf9d8361b) ) -ROM_END - - -//------------------------------------------------- -// ROM( jupiter3 ) -//------------------------------------------------- - -ROM_START( jupiter3 ) - ROM_REGION( 0x1000, Z80_TAG, ROMREGION_INVERT ) // address and data lines are inverted - ROM_LOAD( "jove 2.0 78_034 4v2d000 1.1c", 0x0000, 0x0400, CRC(be92a76c) SHA1(9c7d9b37c2bbf0c2e9465421e3e1bcf3dd9e66a6) ) - ROM_LOAD( "jove 2.0 78_034 4v2d000 2.6c", 0x0400, 0x0400, CRC(ee98dd32) SHA1(0513261c7c0d911225ea957ee67394871a36ada4) ) - ROM_LOAD( "jove 2.0 78_034 4v2d000 3.1d", 0x0800, 0x0400, CRC(51476b1d) SHA1(ab6f4eb244bcf9718aafdae67da086ec81f33fa6) ) - ROM_LOAD( "jove 2.0 78_034 4v2d000 4.6d", 0x0c00, 0x0400, CRC(16a9595d) SHA1(06150278650590497732e1f3f42356de56737921) ) - - // character generator is missing, using one from c10 for now - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - - - -//************************************************************************** -// DRIVER INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// DRIVER_INIT( jupiter ) -//------------------------------------------------- - -DRIVER_INIT_MEMBER(jupiter2_state,jupiter) -{ - UINT8 *rom = memregion(MCM6571AP_TAG)->base(); - UINT8 inverted[0x1000]; - - memcpy(inverted, rom, 0x1000); - - for (offs_t addr = 0; addr < 0x400; addr++) - { - // invert address lines - rom[0x3ff - addr] = inverted[addr]; - rom[0x7ff - addr] = inverted[addr + 0x400]; - rom[0xbff - addr] = inverted[addr + 0x800]; - rom[0xfff - addr] = inverted[addr + 0xc00]; - } -} - - -//------------------------------------------------- -// DRIVER_INIT( jupiter3 ) -//------------------------------------------------- - -DRIVER_INIT_MEMBER(jupiter3_state,jupiter3) -{ - UINT8 *rom = memregion(Z80_TAG)->base(); - UINT8 inverted[0x1000]; - - memcpy(inverted, rom, 0x1000); - - for (offs_t addr = 0; addr < 0x400; addr++) - { - // invert address lines - rom[0x3ff - addr] = inverted[addr]; - rom[0x7ff - addr] = inverted[addr + 0x400]; - rom[0xbff - addr] = inverted[addr + 0x800]; - rom[0xfff - addr] = inverted[addr + 0xc00]; - } -} - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1976, jupiter2, 0, 0, jupiter, jupiter, jupiter2_state, jupiter, "Wave Mate", "Jupiter II", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) -COMP( 1976, jupiter3, 0, 0, jupiter3, jupiter, jupiter3_state, jupiter3,"Wave Mate", "Jupiter III", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/k1003.c b/src/mess/drivers/k1003.c deleted file mode 100644 index 3fa0b6d1cd3..00000000000 --- a/src/mess/drivers/k1003.c +++ /dev/null @@ -1,197 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Robotron K1003 - - 20/11/2009 Skeleton driver. - - -'maincpu' (004B): unmapped i/o memory write to 0B = 00 & FF -'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF -'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF -'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF -'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF -'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF -'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF -'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF -'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF -'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF -'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF -'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF -'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF -'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF -'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF -'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF -'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF -'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF -'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF -'maincpu' (0322): unmapped i/o memory write to 0A = FF & FF -'maincpu' (0323): unmapped i/o memory write to 13 = FF & FF -'maincpu' (0325): unmapped i/o memory write to 11 = 00 & FF -'maincpu' (02F2): unmapped i/o memory write to 0A = 00 & FF -'maincpu' (02F2): unmapped i/o memory write to 0A = 00 & FF -'maincpu' (02F2): unmapped i/o memory write to 0A = 0C & FF -'maincpu' (02F2): unmapped i/o memory write to 0A = 0C & FF -'maincpu' (02F2): unmapped i/o memory write to 0A = 0C & FF - -The writes to ports 0A, 11 & 13 are continuous. - -- Need a keyboard - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8008/i8008.h" -#include "k1003.lh" - - -class k1003_state : public driver_device -{ -public: - k1003_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_READ8_MEMBER(port2_r); - DECLARE_READ8_MEMBER(key_r); - DECLARE_WRITE8_MEMBER(disp_1_w); - DECLARE_WRITE8_MEMBER(disp_2_w); - DECLARE_WRITE8_MEMBER(disp_w); - UINT8 m_disp_1; - UINT8 m_disp_2; - UINT8 bit_to_dec(UINT8 val); - virtual void machine_reset(); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START( k1003_mem, AS_PROGRAM, 8, k1003_state ) - AM_RANGE(0x0000,0x07ff) AM_ROM - AM_RANGE(0x0800,0x17ff) AM_RAM - AM_RANGE(0x1800,0x1fff) AM_ROM - AM_RANGE(0x2000,0x27ff) AM_ROM - AM_RANGE(0x2800,0x2fff) AM_RAM - AM_RANGE(0x3000,0x3aff) AM_ROM -ADDRESS_MAP_END - -READ8_MEMBER( k1003_state::port2_r ) -{ - return 0x00; -} - -READ8_MEMBER( k1003_state::key_r ) -{ - return 0x00; -} - - -WRITE8_MEMBER( k1003_state::disp_1_w ) -{ - m_disp_1 = data; -} - -WRITE8_MEMBER( k1003_state::disp_2_w ) -{ - m_disp_2 = data; -} - -UINT8 k1003_state::bit_to_dec(UINT8 val) -{ - if (BIT(val,0)) return 0; - if (BIT(val,1)) return 1; - if (BIT(val,2)) return 2; - if (BIT(val,3)) return 3; - if (BIT(val,4)) return 4; - if (BIT(val,5)) return 5; - if (BIT(val,6)) return 6; - if (BIT(val,7)) return 7; - return 0; -} - -WRITE8_MEMBER( k1003_state::disp_w ) -{ - output_set_digit_value(bit_to_dec(data)*2, m_disp_1); - output_set_digit_value(bit_to_dec(data)*2+1, m_disp_2); -} - -static ADDRESS_MAP_START( k1003_io, AS_IO, 8, k1003_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00,0x00) AM_READ(key_r) - AM_RANGE(0x02,0x02) AM_READ(port2_r) - - AM_RANGE(0x08,0x08) AM_WRITE(disp_w) - AM_RANGE(0x09,0x09) AM_WRITE(disp_2_w) - AM_RANGE(0x10,0x10) AM_WRITE(disp_1_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( k1003 ) -INPUT_PORTS_END - - -void k1003_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( k1003, k1003_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8008, 800000) - MCFG_CPU_PROGRAM_MAP(k1003_mem) - MCFG_CPU_IO_MAP(k1003_io) - - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_k1003) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( k1003 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "k1003.01", 0x0000, 0x0100, CRC(9342f67d) SHA1(75d33cad89cf47e8e691a6ddbb86a8c11f454434)) - ROM_LOAD( "k1003.02", 0x0100, 0x0100, CRC(a6846b2b) SHA1(a38b15ae0ac3f216e49aef4618363ea0d262fe52)) - ROM_LOAD( "k1003.03", 0x0200, 0x0100, CRC(3fddd922) SHA1(9c9f28ad8a611d8a0911d2935ffa262976a0272d)) - ROM_LOAD( "k1003.04", 0x0300, 0x0100, CRC(ec3edbe9) SHA1(d58064db7f2d085760088da1899f44f7a5b02923)) - ROM_LOAD( "k1003.05", 0x0400, 0x0100, CRC(93836b34) SHA1(7397c9748c1adb347270529464f1e10d3ac92879)) - ROM_LOAD( "k1003.06", 0x0500, 0x0100, CRC(79e39c8f) SHA1(bffc24a47867834d749d32307dca1053231a1b62)) - ROM_LOAD( "k1003.07", 0x0600, 0x0100, CRC(1f7279e0) SHA1(1e625adf606f87a55b6e8827fc9764d8a777903a)) - ROM_LOAD( "k1003.08", 0x0700, 0x0100, CRC(4b950957) SHA1(268c7dbf52a85bdf4eb5ebbe6d01aae45e853a72)) - - ROM_LOAD( "k1003.09", 0x1800, 0x0100, CRC(f3ec866f) SHA1(0b274be7290c9d469205136851c48595cd4f15e2)) - ROM_LOAD( "k1003.10", 0x1900, 0x0100, CRC(c4af2cf7) SHA1(1815030d08072542fa56c4063b6de1d64b146887)) - ROM_LOAD( "k1003.11", 0x1a00, 0x0100, CRC(473ef6db) SHA1(45372e09babf6fa08875e53d43e90d53f9cc0ec1)) - ROM_LOAD( "k1003.12", 0x1b00, 0x0100, CRC(8af505d4) SHA1(21302f2bb660ddaf5e4526335ec457479f1673d5)) - ROM_LOAD( "k1003.13", 0x1c00, 0x0100, CRC(753166da) SHA1(90b91bac845f5d0ecd3af4d67174d351e478b632)) - ROM_LOAD( "k1003.14", 0x1d00, 0x0100, CRC(a885a676) SHA1(e899ea5b97734360421d2696e0a75d65fa8a031c)) - ROM_LOAD( "k1003.15", 0x1e00, 0x0100, CRC(db63b0cd) SHA1(726d80bb34862301df773b8587acccbeedfcc38d)) - ROM_LOAD( "k1003.16", 0x1f00, 0x0100, CRC(9457f1bd) SHA1(aae0a7c0a63d8213a57850383aaf92927577be7a)) - - // Math pack - ROM_LOAD( "026.bin", 0x2000, 0x0100, CRC(d678e80c) SHA1(bdf696e9704c286ed0ad5ffbdae206580a277c38)) - ROM_LOAD( "027.bin", 0x2100, 0x0100, CRC(dbe2ca8e) SHA1(2060bbb6b6dee87c98ddcf84a49069547749ae9b)) - ROM_LOAD( "028.bin", 0x2200, 0x0100, CRC(2cd742ed) SHA1(ec3f1ba548c64b0fe538af365a383f2341c81988)) - ROM_LOAD( "029.bin", 0x2300, 0x0100, CRC(12165b43) SHA1(7bb2c97893a07196cf245c8ac3a64c0ee49bb75e)) - ROM_LOAD( "030.bin", 0x2400, 0x0100, CRC(545dd7e0) SHA1(ab9f2e8cd4d3d4ba8accf74caec20de2e3094a66)) - ROM_LOAD( "031.bin", 0x2500, 0x0100, CRC(315d27d2) SHA1(26bb39d50781eed8d8be4ad6e1f13bc2b4672ce2)) - ROM_LOAD( "032.bin", 0x2600, 0x0100, CRC(d03f7cc7) SHA1(5a1c0614eed6dfe21d0d1776f409c1c2209a74d1)) - ROM_LOAD( "033.bin", 0x2700, 0x0100, CRC(efaeb541) SHA1(decdbbd3c4084dc18b34577f78ddf7044341764a)) - - ROM_LOAD( "k1003.17", 0x3000, 0x0100, CRC(9031390b) SHA1(6f99a9f643b19770a373242edb0df8f342bbc230)) - ROM_LOAD( "k1003.18", 0x3100, 0x0100, CRC(38435ffe) SHA1(7db78d304fe8a8f71c067babcdcf3c06da908ad3)) - ROM_LOAD( "k1003.19", 0x3200, 0x0100, CRC(3cfddbda) SHA1(7e9d5c6126d0f08fcb7d88d0cc26eb24467f7321)) - ROM_LOAD( "k1003.20", 0x3300, 0x0100, CRC(08707172) SHA1(fef18e407ebec13d34c2bd6925ffae533139551e)) - ROM_LOAD( "k1003.21", 0x3400, 0x0100, CRC(4038b284) SHA1(f6ee7fd8fb06a73a7d1ed71ca7022f1c76c207bd)) - ROM_LOAD( "k1003.22", 0x3500, 0x0100, CRC(04691d40) SHA1(72f96994811f435adecc74585f3dfaa89d0f192a)) - ROM_LOAD( "k1003.23", 0x3600, 0x0100, CRC(a2f7170c) SHA1(2cd9a64019c2cd7f6f6146d1886de6a1aa5ccc88)) - ROM_LOAD( "k1003.24", 0x3700, 0x0100, CRC(c0935c12) SHA1(f3fc7c3fa97b2bcb9ec522002ee760a226eb329a)) - ROM_LOAD( "k1003.25", 0x3800, 0x0100, CRC(a827aec0) SHA1(a8f582a9a6b31581d8a174a0bc2f4588d6b53400)) - ROM_LOAD( "k1003.26", 0x3900, 0x0100, CRC(fc949804) SHA1(088b63b7f8704efb6867be899b81d64a294af6be)) - ROM_LOAD( "k1003.27", 0x3a00, 0x0100, CRC(ddcdd065) SHA1(e29c6f2dd1e4da125d150e28cf51f8c558ec9ee5)) - // 0x3b00 - missing on board - returning 0xff -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, k1003, 0, 0, k1003, k1003, driver_device, 0, "Robotron", "K1003", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/k8915.c b/src/mess/drivers/k8915.c deleted file mode 100644 index 7ec4cde5d0e..00000000000 --- a/src/mess/drivers/k8915.c +++ /dev/null @@ -1,187 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Robotron K8915 - - 30/08/2010 Skeleton driver - - When it says DIAGNOSTIC RAZ P, press enter. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/keyboard.h" - -#define KEYBOARD_TAG "keyboard" - -class k8915_state : public driver_device -{ -public: - k8915_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_p_videoram(*this, "p_videoram") - { - } - - required_device m_maincpu; - DECLARE_READ8_MEMBER( k8915_52_r ); - DECLARE_READ8_MEMBER( k8915_53_r ); - DECLARE_WRITE8_MEMBER( k8915_a8_w ); - DECLARE_WRITE8_MEMBER( kbd_put ); - required_shared_ptr m_p_videoram; - UINT8 *m_p_chargen; - UINT8 m_framecnt; - UINT8 m_term_data; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DRIVER_INIT(k8915); -}; - -READ8_MEMBER( k8915_state::k8915_52_r ) -{ -// get data from ascii keyboard - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( k8915_state::k8915_53_r ) -{ -// keyboard status - return m_term_data ? 1 : 0; -} - -WRITE8_MEMBER( k8915_state::k8915_a8_w ) -{ -// seems to switch ram and rom around. - if (data == 0x87) - membank("boot")->set_entry(0); // ram at 0000 - else - membank("boot")->set_entry(1); // rom at 0000 -} - -static ADDRESS_MAP_START(k8915_mem, AS_PROGRAM, 8, k8915_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot") - AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE("p_videoram") - AM_RANGE(0x1800, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(k8915_io, AS_IO, 8, k8915_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x52, 0x52) AM_READ(k8915_52_r) - AM_RANGE(0x53, 0x53) AM_READ(k8915_53_r) - AM_RANGE(0xa8, 0xa8) AM_WRITE(k8915_a8_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( k8915 ) -INPUT_PORTS_END - -void k8915_state::machine_reset() -{ - membank("boot")->set_entry(1); -} - -DRIVER_INIT_MEMBER(k8915_state,k8915) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x10000); -} - -void k8915_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 k8915_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - m_framecnt++; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 80; x++) - { - gfx = 0; - - if (ra < 9) - { - chr = m_p_videoram[x]; - - /* Take care of flashing characters */ - if ((chr & 0x80) && (m_framecnt & 0x08)) - chr = 0x20; - - chr &= 0x7f; - - gfx = m_p_chargen[(chr<<4) | ra ]; - } - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=80; - } - return 0; -} - -WRITE8_MEMBER( k8915_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( k8915, k8915_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(k8915_mem) - MCFG_CPU_IO_MAP(k8915_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(k8915_state, screen_update) - MCFG_SCREEN_SIZE(640, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(k8915_state, kbd_put)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( k8915 ) - ROM_REGION( 0x11000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "k8915.bin", 0x10000, 0x1000, CRC(ca70385f) SHA1(a34c14adae9be821678aed7f9e33932ee1f3e61c)) - - /* character generator not dumped, using the one from 'c10' for now */ - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, k8915, 0, 0, k8915, k8915, k8915_state, k8915, "Robotron", "K8915", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/kaypro.c b/src/mess/drivers/kaypro.c deleted file mode 100644 index 7213db9ebe6..00000000000 --- a/src/mess/drivers/kaypro.c +++ /dev/null @@ -1,461 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/************************************************************************************************* - - - Kaypro 2/83 computer - the very first Kaypro II - 2 full size floppy drives. - Each disk was single sided, and could hold 191k. The computer had 2x pio - and 1x sio. One of the sio ports communicated with the keyboard with a coiled - telephone cord, complete with modular plug on each end. The keyboard carries - its own Intel 87C51 processor and is an intelligent device. - - Kaypro 10 notes: - - This machine comes with a 10MB hard drive, split into 2 5MB partitions. It also - has one floppy drive. The drive letters change depending on what drive it was booted - from. The boot drive is always A:. - If booted from floppy: - A: floppy - B: HD partition 1 - C: HD partition 2 - If booted from HD (presumably partition 1) - A: HD partition 1 - B: HD partition 2 - C: floppy - - ToDo: - - - See about getting keyboard to work as a serial device. - - Need dump of 87C51 cpu in the keyboard. - - - Kaypro 2x, 4a: floppy not working "No operating system present on this disk" - - Kaypro 10: Boots from floppy, but needs hard drive added. - - Kaypro 4p88: works as a normal Kaypro 4, extra hardware not done - - Kaypro Robie: has twin 2.6MB 5.25 floppy drives which we don't support, no software available - - - Hard Disk not emulated. - The controller is a WD1002 (original version, for Winchester drives). - - - RTC type MM58167A to be added. Modem chips TMS99531, TMS99532 to be developed. - - - Once everything works, sort out parent and compat relationships. - -**************************************************************************************************/ - -#include "includes/kaypro.h" -#include "formats/kaypro_dsk.h" - - -READ8_MEMBER( kaypro_state::kaypro2x_87_r ) { return 0x7f; } /* to bypass unemulated HD controller */ - -/*********************************************************** - - Address Maps - -************************************************************/ - -static ADDRESS_MAP_START( kaypro_map, AS_PROGRAM, 8, kaypro_state ) - AM_RANGE(0x0000, 0x2fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank3") - AM_RANGE(0x4000, 0xffff) AM_RAM AM_REGION("rambank", 0x4000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( kayproii_io, AS_IO, 8, kaypro_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_DEVWRITE("brg", com8116_device, stt_w) - AM_RANGE(0x04, 0x07) AM_READWRITE(kaypro_sio_r, kaypro_sio_w) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_g", z80pio_device, read_alt, write_alt) - AM_RANGE(0x0c, 0x0f) AM_DEVWRITE("brg", com8116_device, str_w) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", fd1793_t, read, write) - AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_s", z80pio_device, read_alt, write_alt) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( kaypro2x_io, AS_IO, 8, kaypro_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_DEVWRITE("brg", com8116_device, str_w) - AM_RANGE(0x04, 0x07) AM_READWRITE(kaypro_sio_r, kaypro_sio_w) - AM_RANGE(0x08, 0x0b) AM_DEVWRITE("brg", com8116_device, stt_w) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80sio_2x", z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", fd1793_t, read, write) - AM_RANGE(0x14, 0x17) AM_READWRITE(kaypro2x_system_port_r,kaypro2x_system_port_w) - AM_RANGE(0x18, 0x1b) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x1c, 0x1c) AM_READWRITE(kaypro2x_status_r,kaypro2x_index_w) - AM_RANGE(0x1d, 0x1d) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(kaypro2x_register_w) - AM_RANGE(0x1f, 0x1f) AM_READWRITE(kaypro2x_videoram_r,kaypro2x_videoram_w) - - /* The below are not emulated */ -/* AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80pio", kaypro2x_pio_r, kaypro2x_pio_w) - for RTC and Modem - AM_RANGE(0x24, 0x27) communicate with MM58167A RTC. Modem uses TMS99531 and TMS99532 chips. - AM_RANGE(0x80, 0x80) Hard drive controller card I/O port - 10MB hard drive only fitted to the Kaypro 10 - AM_RANGE(0x81, 0x81) Hard Drive READ error register, WRITE precomp - AM_RANGE(0x82, 0x82) Hard Drive Sector register count I/O - AM_RANGE(0x83, 0x83) Hard Drive Sector register number I/O - AM_RANGE(0x84, 0x84) Hard Drive Cylinder low register I/O - AM_RANGE(0x85, 0x85) Hard Drive Cylinder high register I/O - AM_RANGE(0x86, 0x86) Hard Drive Size / Drive / Head register I/O - AM_RANGE(0x87, 0x87) Hard Drive READ status register, WRITE command register */ - AM_RANGE(0x20, 0x86) AM_NOP - AM_RANGE(0x87, 0x87) AM_READ(kaypro2x_87_r) -ADDRESS_MAP_END - - -/*************************************************************** - - F4 CHARACTER DISPLAYER - -****************************************************************/ -static const gfx_layout kayproii_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout kaypro2x_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( kayproii ) - GFXDECODE_ENTRY( "chargen", 0x0000, kayproii_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( kaypro2x ) - GFXDECODE_ENTRY( "chargen", 0x0000, kaypro2x_charlayout, 0, 1 ) -GFXDECODE_END - -/*************************************************************** - - Interfaces - -****************************************************************/ - -static const z80_daisy_config kayproii_daisy_chain[] = -{ - { "z80sio" }, /* sio */ - { "z80pio_s" }, /* System pio */ - { "z80pio_g" }, /* General purpose pio */ - { NULL } -}; - -static const z80_daisy_config kaypro2x_daisy_chain[] = -{ - { "z80sio" }, /* sio for RS232C and keyboard */ - { "z80sio_2x" }, /* sio for serial printer and inbuilt modem */ - { NULL } -}; - - - -//static WRITE_LINE_DEVICE_HANDLER( rx_tx_w ) -//{ -// downcast(device)->rx_clock_in(); -// downcast(device)->tx_clock_in(); -//} - - - -/*********************************************************** - - Machine Driver - -************************************************************/ - -FLOPPY_FORMATS_MEMBER( kaypro_state::kayproii_floppy_formats ) - FLOPPY_KAYPROII_FORMAT -FLOPPY_FORMATS_END - -FLOPPY_FORMATS_MEMBER( kaypro_state::kaypro2x_floppy_formats ) - FLOPPY_KAYPRO2X_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( kaypro_floppies ) - SLOT_INTERFACE( "drive0", FLOPPY_525_DD ) - SLOT_INTERFACE( "drive1", FLOPPY_525_DD ) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( kayproii, kaypro_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_20MHz / 8) - MCFG_CPU_PROGRAM_MAP(kaypro_map) - MCFG_CPU_IO_MAP(kayproii_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt) /* this doesn't actually exist, it is to run the keyboard */ - MCFG_CPU_CONFIG(kayproii_daisy_chain) - - MCFG_MACHINE_START_OVERRIDE(kaypro_state, kayproii ) - MCFG_MACHINE_RESET_OVERRIDE(kaypro_state, kaypro ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(80*7, 24*10) - MCFG_SCREEN_VISIBLE_AREA(0,80*7-1,0,24*10-1) - MCFG_VIDEO_START_OVERRIDE(kaypro_state, kaypro ) - MCFG_SCREEN_UPDATE_DRIVER(kaypro_state, screen_update_kayproii) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", kayproii) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_QUICKLOAD_ADD("quickload", kaypro_state, kaypro, "com,cpm", 3) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kaypro_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) // WD1943, SMC8116 - - MCFG_DEVICE_ADD("z80pio_g", Z80PIO, XTAL_20MHz / 8) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - - MCFG_DEVICE_ADD("z80pio_s", Z80PIO, XTAL_20MHz / 8) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(kaypro_state, pio_system_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(kaypro_state, kayproii_pio_system_w)) - - MCFG_Z80SIO0_ADD("z80sio", XTAL_20MHz / 8, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_FD1793_ADD("fdc", XTAL_20MHz / 20) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w)) - MCFG_WD_FDC_FORCE_READY - MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "drive0", kaypro_state::kayproii_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "drive1", kaypro_state::kayproii_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_SOFTWARE_LIST_ADD("flop_list","kayproii") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( kaypro4, kayproii ) - MCFG_DEVICE_REMOVE("z80pio_s") - MCFG_DEVICE_ADD("z80pio_s", Z80PIO, 2500000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(kaypro_state, pio_system_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(kaypro_state, kaypro4_pio_system_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( kaypro2x, kaypro_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(kaypro_map) - MCFG_CPU_IO_MAP(kaypro2x_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", kaypro_state, kay_kbd_interrupt) - MCFG_CPU_CONFIG(kaypro2x_daisy_chain) - - MCFG_MACHINE_RESET_OVERRIDE(kaypro_state, kaypro ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(80*8, 25*16) - MCFG_SCREEN_VISIBLE_AREA(0,80*8-1,0,25*16-1) - MCFG_VIDEO_START_OVERRIDE(kaypro_state, kaypro ) - MCFG_SCREEN_UPDATE_DRIVER(kaypro_state, screen_update_kaypro2x) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", kaypro2x) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(kaypro_state, kaypro) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", 2000000) /* comes out of ULA - needs to be measured */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(7) - MCFG_MC6845_UPDATE_ROW_CB(kaypro_state, kaypro2x_update_row) - - MCFG_QUICKLOAD_ADD("quickload", kaypro_state, kaypro, "com,cpm", 3) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kaypro_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_Z80SIO0_ADD("z80sio", XTAL_16MHz / 4, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO0_ADD("z80sio_2x", XTAL_16MHz / 4, 0, 0, 0, 0) /* extra sio for modem and printer */ - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) // WD1943, SMC8116 - MCFG_FD1793_ADD("fdc", XTAL_16MHz / 16) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(kaypro_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(kaypro_state, fdc_drq_w)) - MCFG_WD_FDC_FORCE_READY - MCFG_FLOPPY_DRIVE_ADD("fdc:0", kaypro_floppies, "drive0", kaypro_state::kaypro2x_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", kaypro_floppies, "drive1", kaypro_state::kaypro2x_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( kaypro10, kaypro2x ) - MCFG_DEVICE_REMOVE("fdc:1") // only has 1 floppy drive - // need to add hard drive & controller -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( omni2, kaypro4 ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(kaypro_state, screen_update_omni2) -MACHINE_CONFIG_END - -DRIVER_INIT_MEMBER( kaypro_state, kaypro ) -{ - UINT8 *main = memregion("roms")->base(); - UINT8 *ram = memregion("rambank")->base(); - - membank("bankr0")->configure_entry(1, &main[0x0000]); - membank("bankr0")->configure_entry(0, &ram[0x0000]); - membank("bank3")->configure_entry(1, &main[0x3000]); - membank("bank3")->configure_entry(0, &ram[0x3000]); - membank("bankw0")->configure_entry(0, &ram[0x0000]); -} - - -/*********************************************************** - - Game driver - -************************************************************/ - -/* The detested bios "universal rom" is part number 81-478 */ - -ROM_START(kayproii) - /* The board could take a 2716 or 2732 */ - ROM_REGION(0x4000, "roms",0) - ROM_SYSTEM_BIOS( 0, "149", "149") - ROMX_LOAD("81-149.u47", 0x0000, 0x0800, CRC(28264bc1) SHA1(a12afb11a538fc0217e569bc29633d5270dfa51b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "149b", "149B") - ROMX_LOAD("81-149b.u47", 0x0000, 0x0800, CRC(c008549e) SHA1(b9346a16f5f9ffb6bb0eb1766c348b74056485a8), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "149c", "149C") - ROMX_LOAD("81-149c.u47", 0x0000, 0x0800, CRC(1272aa65) SHA1(027fee2f5f17ba71a4738f00188e132e326536ff), ROM_BIOS(3) ) - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) - - ROM_REGION(0x0800, "chargen", ROMREGION_INVERT) - ROM_LOAD("81-146.u43", 0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) ) -ROM_END - -ROM_START(kaypro4) - ROM_REGION(0x4000, "roms",0) - ROM_LOAD("81-232.u47", 0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2) ) - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) - - ROM_REGION(0x0800, "chargen", ROMREGION_INVERT) - ROM_LOAD("81-146.u43", 0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) ) -ROM_END - -ROM_START(kaypro4p88) // "KAYPRO-88" board has 128k or 256k of its own ram on it - ROM_REGION(0x4000, "roms",0) - ROM_LOAD("81-232.u47", 0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2) ) - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) - - ROM_REGION(0x0800, "chargen", ROMREGION_INVERT) - ROM_LOAD("81-146.u43", 0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) ) - - ROM_REGION(0x1000, "8088cpu",0) - ROM_LOAD("81-356.u29", 0x0000, 0x1000, CRC(948556db) SHA1(6e779866d099cc0dc8c6369bdfb37a923ac448a4) ) -ROM_END - -ROM_START(omni2) - ROM_REGION(0x4000, "roms",0) - ROM_LOAD("omni2.u47", 0x0000, 0x1000, CRC(2883f9e0) SHA1(d98c784e62853582d298bf7ca84c75872847ac9b) ) - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) - - ROM_REGION(0x0800, "chargen", ROMREGION_INVERT) - ROM_LOAD("omni2.u43", 0x0000, 0x0800, CRC(049b3381) SHA1(46f1d4f038747ba9048b075dc617361be088f82a) ) -ROM_END - -ROM_START(kaypro2x) - ROM_REGION(0x4000, "roms",0) - ROM_SYSTEM_BIOS( 0, "292", "292") - ROMX_LOAD("81-292.u34", 0x0000, 0x2000, CRC(5eb69aec) SHA1(525f955ca002976e2e30ac7ee37e4a54f279fe96), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "292a", "292A") - ROMX_LOAD("81-292a.u34", 0x0000, 0x1000, CRC(241f27a5) SHA1(82711289d19e9b165e35324da010466d225e503a), ROM_BIOS(2) ) - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD("81-235.u9", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) -ROM_END - -ROM_START(kaypro4a) // same as kaypro2x ?? - ROM_REGION(0x4000, "roms",0) - ROM_LOAD("81-292.u34", 0x0000, 0x2000, CRC(5eb69aec) SHA1(525f955ca002976e2e30ac7ee37e4a54f279fe96) ) - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD("81-235.u9", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) -ROM_END - -ROM_START(kaypro10) - ROM_REGION(0x4000, "roms",0) - ROM_SYSTEM_BIOS( 0, "302", "V1.9E") - ROMX_LOAD("81-302.u42", 0x0000, 0x1000, CRC(3f9bee20) SHA1(b29114a199e70afe46511119b77a662e97b093a0), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "188", "V1.9") - ROMX_LOAD("81-188.u42", 0x0000, 0x1000, CRC(6cbd6aa0) SHA1(47004f8c6e17407e4f8d613c9520f9316716d9e2), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "277", "V1.9E(F)") - ROMX_LOAD("81-277.u42", 0x0000, 0x1000, CRC(e4e1831f) SHA1(1de31ed532a461ace7a4abad1f6647eeddceb3e7), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "478", "V2.01") - ROMX_LOAD("81-478.u42", 0x0000, 0x2000, CRC(de618380) SHA1(c8d6312e6eeb62a53e741f1ff3b878bdcb7b5aaa), ROM_BIOS(4) ) - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD("81-187.u31", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) -ROM_END - -ROM_START(robie) - ROM_REGION(0x4000, "roms",0) - ROM_SYSTEM_BIOS( 0, "326", "V1.7R") - ROMX_LOAD("81-326.u34", 0x0000, 0x2000, CRC(7f0c3f68) SHA1(54b088a1b2200f9df4b9b347bbefb0115f3a4976), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "u", "V1.4") - ROMX_LOAD("robie_u.u34", 0x0000, 0x2000, CRC(da7248b5) SHA1(1dc053b3e44ead47255cc166b7b4b0adaeb3dd3d), ROM_BIOS(2) ) // rom number unknown - - ROM_REGION(0x10000, "rambank", ROMREGION_ERASEFF) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD("81-235.u9", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1982, kayproii, 0, 0, kayproii, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro II - 2/83" , 0 ) -COMP( 1983, kaypro4, kayproii, 0, kaypro4, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 4 - 4/83" , 0 ) // model 81-004 -COMP( 1983, kaypro4p88, kayproii, 0, kaypro4, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 4 plus88 - 4/83" , MACHINE_NOT_WORKING ) // model 81-004 with an added 8088 daughterboard and rom -COMP( 198?, omni2, kayproii, 0, omni2, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Omni II Logic Analyzer" , 0 ) -COMP( 1984, kaypro2x, 0, 0, kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 2x" , MACHINE_NOT_WORKING ) // model 81-025 -COMP( 1984, kaypro4a, kaypro2x, 0, kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 4 - 4/84" , MACHINE_NOT_WORKING ) // model 81-015 -// Kaypro 4/84 plus 88 goes here, model 81-015 with an added 8088 daughterboard and rom -COMP( 1983, kaypro10, 0, 0, kaypro10, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro 10" , MACHINE_NOT_WORKING ) // model 81-005 -COMP( 1984, robie, 0, 0, kaypro2x, kay_kbd, kaypro_state, kaypro, "Non Linear Systems", "Kaypro Robie" , MACHINE_NOT_WORKING ) // model 81-005 diff --git a/src/mess/drivers/kc.c b/src/mess/drivers/kc.c deleted file mode 100644 index b6b21733d69..00000000000 --- a/src/mess/drivers/kc.c +++ /dev/null @@ -1,320 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/****************************************************************************** - - kc.c - system driver - - A big thankyou to Torsten Paul for his great help with this - driver! - - - Kevin Thacker [MESS driver] - - ******************************************************************************/ - - -/* Core includes */ -#include "emu.h" -#include "includes/kc.h" - - -static ADDRESS_MAP_START(kc85_4_io, AS_IO, 8, kc85_4_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0084, 0x0085) AM_MIRROR(0xff00) AM_READWRITE(kc85_4_84_r, kc85_4_84_w) - AM_RANGE(0x0086, 0x0087) AM_MIRROR(0xff00) AM_READWRITE(kc85_4_86_r, kc85_4_86_w) - AM_RANGE(0x0088, 0x008b) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) - AM_RANGE(0x008c, 0x008f) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - - AM_RANGE(0x0000, 0xffff) AM_READWRITE(expansion_io_read, expansion_io_write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(kc85_4_mem, AS_PROGRAM, 8, kc85_4_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_READWRITE_BANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank2") - AM_RANGE(0x8000, 0xa7ff) AM_READWRITE_BANK("bank3") - AM_RANGE(0xa800, 0xbfff) AM_READWRITE_BANK("bank6") - AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank4") - AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bank5") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(kc85_3_mem, AS_PROGRAM, 8, kc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_READWRITE_BANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank3") - AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank4") - AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bank5") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(kc85_3_io, AS_IO, 8, kc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0088, 0x008b) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) - AM_RANGE(0x008c, 0x008f) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - - AM_RANGE(0x0000, 0xffff) AM_READWRITE(expansion_io_read, expansion_io_write) -ADDRESS_MAP_END - -static INPUT_PORTS_START( kc85 ) -INPUT_PORTS_END - - -/* priority derived from schematics */ -static const z80_daisy_config kc85_daisy_chain[] = -{ - { "z80ctc" }, - { "z80pio" }, - { NULL } -}; - -extern SLOT_INTERFACE_START(kc85_cart) - SLOT_INTERFACE("standard", KC_STANDARD) // standard 8KB ROM module - SLOT_INTERFACE("m006", KC_M006) // BASIC - SLOT_INTERFACE("m011", KC_M011) // 64KB RAM - SLOT_INTERFACE("m022", KC_M022) // 16KB RAM - SLOT_INTERFACE("m032", KC_M032) // 256KB segmented RAM - SLOT_INTERFACE("m033", KC_M033) // TypeStar - SLOT_INTERFACE("m034", KC_M034) // 512KB segmented RAM - SLOT_INTERFACE("m035", KC_M035) // 1MB segmented RAM - SLOT_INTERFACE("m036", KC_M036) // 128KB segmented RAM -SLOT_INTERFACE_END - -extern SLOT_INTERFACE_START(kc85_exp) - SLOT_INTERFACE("d002", KC_D002) // D002 Bus Driver - SLOT_INTERFACE("d004", KC_D004) // D004 Floppy Disk Interface - SLOT_INTERFACE("d004gide", KC_D004_GIDE) // D004 Floppy Disk + GIDE Interface -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( kc85_3, kc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, KC85_3_CLOCK) - MCFG_CPU_PROGRAM_MAP(kc85_3_mem) - MCFG_CPU_IO_MAP(kc85_3_io) - MCFG_CPU_CONFIG(kc85_daisy_chain) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, KC85_3_CLOCK) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_Z80PIO_IN_PA_CB(READ8(kc_state, pio_porta_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(kc_state, pio_porta_w)) - MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(kc_state, pio_ardy_cb)) - MCFG_Z80PIO_IN_PB_CB(READ8(kc_state, pio_portb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(kc_state, pio_portb_w)) - MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(kc_state, pio_brdy_cb)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, KC85_3_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(kc_state, ctc_zc0_callback)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(kc_state, ctc_zc1_callback)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(kc_state, video_toggle_blink_state)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_28_37516MHz/2, 908, 0, 320, 312, 0, 256) - MCFG_SCREEN_UPDATE_DRIVER(kc_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kc_state, kc_scanline, "screen", 0, 1) - - MCFG_PALETTE_ADD("palette", KC85_PALETTE_SIZE) - MCFG_PALETTE_INIT_OWNER(kc_state, kc85 ) - - MCFG_DEVICE_ADD("keyboard", KC_KEYBOARD, XTAL_4MHz) - MCFG_KC_KEYBOARD_OUT_CALLBACK(WRITELINE(kc_state, keyboard_cb)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_QUICKLOAD_ADD("quickload", kc_state, kc, "kcc", 2) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(kc_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("kc_cass") - - /* cartridge slot */ - MCFG_DEVICE_ADD("m8", KCCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, "m011", false) - MCFG_KCCART_SLOT_NEXT_SLOT("mc") - MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) - MCFG_DEVICE_ADD("mc", KCCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, NULL, false) - MCFG_KCCART_SLOT_NEXT_SLOT("exp") - MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) - - /* expansion interface */ - MCFG_DEVICE_ADD("exp", KCEXP_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(kc85_exp, NULL, false) - MCFG_KCCART_SLOT_NEXT_SLOT(NULL) - MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "kc_cart") - MCFG_SOFTWARE_LIST_ADD("flop_list", "kc_flop") - MCFG_SOFTWARE_LIST_ADD("cass_list", "kc_cass") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( kc85_4, kc85_4_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, KC85_4_CLOCK) - MCFG_CPU_PROGRAM_MAP(kc85_4_mem) - MCFG_CPU_IO_MAP(kc85_4_io) - MCFG_CPU_CONFIG(kc85_daisy_chain) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, KC85_4_CLOCK) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_Z80PIO_IN_PA_CB(READ8(kc_state, pio_porta_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(kc_state, pio_porta_w)) - MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(kc_state, pio_ardy_cb)) - MCFG_Z80PIO_IN_PB_CB(READ8(kc_state, pio_portb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(kc_state, pio_portb_w)) - MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(kc_state, pio_brdy_cb)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, KC85_4_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(kc_state, ctc_zc0_callback)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(kc_state, ctc_zc1_callback)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(kc_state, video_toggle_blink_state)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_28_37516MHz/2, 908, 0, 320, 312, 0, 256) - MCFG_SCREEN_UPDATE_DRIVER(kc85_4_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kc85_4_state, kc_scanline, "screen", 0, 1) - - MCFG_PALETTE_ADD("palette", KC85_PALETTE_SIZE) - MCFG_PALETTE_INIT_OWNER(kc85_4_state, kc85 ) - - MCFG_DEVICE_ADD("keyboard", KC_KEYBOARD, XTAL_4MHz) - MCFG_KC_KEYBOARD_OUT_CALLBACK(WRITELINE(kc_state, keyboard_cb)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_QUICKLOAD_ADD("quickload", kc_state, kc, "kcc", 2) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(kc_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("kc_cass") - - /* cartridge slot */ - MCFG_DEVICE_ADD("m8", KCCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, "m011", false) - MCFG_KCCART_SLOT_NEXT_SLOT("mc") - MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) - MCFG_DEVICE_ADD("mc", KCCART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(kc85_cart, NULL, false) - MCFG_KCCART_SLOT_NEXT_SLOT("exp") - MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) - - /* expansion interface */ - MCFG_DEVICE_ADD("exp", KCEXP_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(kc85_exp, NULL, false) - MCFG_KCCART_SLOT_NEXT_SLOT(NULL) - MCFG_KCCART_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_KCCART_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_KCCART_SLOT_OUT_HALT_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "kc_cart") - MCFG_SOFTWARE_LIST_ADD("flop_list", "kc_flop") - MCFG_SOFTWARE_LIST_ADD("cass_list", "kc_cass") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( kc85_5, kc85_4 ) - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") -MACHINE_CONFIG_END - - -ROM_START(kc85_2) - ROM_REGION(0x4000, "caos", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "hc900", "HC900 CAOS" ) - ROMX_LOAD( "hc900.852", 0x2000, 0x2000, CRC(e6f4c0ab) SHA1(242a777788c774c5f764313361b1e0a65139ab32), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "caos22", "CAOS 2.2" ) - ROMX_LOAD( "caos__e0.852", 0x2000, 0x2000, CRC(48d5624c) SHA1(568dd59bfad4c604ba36bc05b094fc598a642f85), ROM_BIOS(2)) -ROM_END - -ROM_START(kc85_3) - ROM_REGION(0x2000, "basic", 0) - ROM_LOAD( "basic_c0.853", 0x0000, 0x2000, CRC(dfe34b08) SHA1(c2e3af55c79e049e811607364f88c703b0285e2e)) - - ROM_REGION(0x4000, "caos", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "caos31", "CAOS 3.1" ) - ROMX_LOAD( "caos__e0.853", 0x2000, 0x2000, CRC(639e4864) SHA1(efd002fc9146116936e6e6be0366d2afca33c1ab), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "caos33", "CAOS 3.3" ) - ROMX_LOAD( "caos33.853", 0x2000, 0x2000, CRC(ca0fecad) SHA1(20447d27c9aa41a1c7a3d6ad0699edb06a207aa6), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "caos34", "CAOS 3.4" ) - ROMX_LOAD( "caos34.853", 0x2000, 0x2000, CRC(d0245a3e) SHA1(ee9f8e7427b9225ae2cecbcfb625d629ab6a601d), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "pi88ge", "OS PI/88 (yellow/blue)" ) - ROMX_LOAD( "pi88_ge.853", 0x2000, 0x2000, CRC(4bf0cfde) SHA1(b8373a44e4553197e3dd23008168d5214b878837), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "pi88sw", "OS PI/88 (black/white)" ) - ROMX_LOAD( "pi88_sw.853", 0x2000, 0x2000, CRC(f7d2e8fc) SHA1(9b5c068f10ff34bc3253f5b51abad51c8da9dd5d), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "pi88ws", "OS PI/88 (white/blue)" ) - ROMX_LOAD( "pi88_ws.853", 0x2000, 0x2000, CRC(9ef4efbf) SHA1(b8b6f606b76bce9fb7fcd61a14120e5e026b6b6e), ROM_BIOS(6)) -ROM_END - -ROM_START(kc85_4) - ROM_REGION(0x2000, "basic", 0) - ROM_LOAD("basic_c0.854", 0x0000, 0x2000, CRC(dfe34b08) SHA1(c2e3af55c79e049e811607364f88c703b0285e2e)) - ROM_REGION(0x4000, "caos", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "caos42", "CAOS 4.2" ) - ROMX_LOAD("caos__c0.854", 0x0000, 0x1000, CRC(57d9ab02) SHA1(774fc2496a59b77c7c392eb5aa46420e7722797e), ROM_BIOS(1)) - ROMX_LOAD("caos__e0.854", 0x2000, 0x2000, CRC(ee273933) SHA1(4300f7ff813c1fb2d5c928dbbf1c9e1fe52a9577), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "caos41", "CAOS 4.1" ) - ROMX_LOAD( "caos41c.854", 0x0000, 0x1000, CRC(c7e1c011) SHA1(acd998e3d9e8f592cd884aafc8ac4d291e40e097), ROM_BIOS(2)) - ROMX_LOAD( "caos41e.854", 0x2000, 0x2000, CRC(60e045e5) SHA1(e19819fb477dcb742a13729a9bf5943d63abe863), ROM_BIOS(2)) -ROM_END - -ROM_START(kc85_5) - ROM_REGION(0x8000, "basic", 0) - ROM_LOAD("basic_c0.855", 0x0000, 0x8000, CRC(0ed9f8b0) SHA1(be2c68a5b461014c57e33a127c3ffb32b0ff2346)) - - ROM_REGION(0x4000, "caos", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "caos44", "CAOS 4.4" ) - ROMX_LOAD( "caos__c0.855",0x0000, 0x2000, CRC(f56d5c18) SHA1(2cf8023ee71ca50b92f9f151b7519f59727d1c79), ROM_BIOS(1)) - ROMX_LOAD( "caos__e0.855",0x2000, 0x2000, CRC(1dbc2e6d) SHA1(53ba4394d96e287ff8af01322af1e9879d4e77c4), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "caos43", "CAOS 4.3" ) - ROMX_LOAD( "caos43c.855", 0x0000, 0x2000, CRC(2f0f9eaa) SHA1(5342be5104206d15e7471b094c7749a8a3d708ad), ROM_BIOS(2)) - ROMX_LOAD( "caos43e.855", 0x2000, 0x2000, CRC(b66fc6c3) SHA1(521ac2fbded4148220f8af2d5a5ab99634364079), ROM_BIOS(2)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1987, kc85_2, 0, 0, kc85_3, kc85, driver_device, 0, "VEB Mikroelektronik", "HC900 / KC 85/2", MACHINE_NOT_WORKING) -COMP( 1987, kc85_3, kc85_2, 0, kc85_3, kc85, driver_device, 0, "VEB Mikroelektronik", "KC 85/3", MACHINE_NOT_WORKING) -COMP( 1989, kc85_4, kc85_2, 0, kc85_4, kc85, driver_device, 0, "VEB Mikroelektronik", "KC 85/4", MACHINE_NOT_WORKING) -COMP( 1989, kc85_5, kc85_2, 0, kc85_5, kc85, driver_device, 0, "VEB Mikroelektronik", "KC 85/5", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/kim1.c b/src/mess/drivers/kim1.c deleted file mode 100644 index 71a98a96cdf..00000000000 --- a/src/mess/drivers/kim1.c +++ /dev/null @@ -1,359 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/****************************************************************************** - KIM-1 - - system driver - - Juergen Buchmueller, Oct 1999 - - KIM-1 memory map - - range short description - 0000-03FF RAM - 1400-16FF ??? - 1700-173F 6530-003 see 6530 - 1740-177F 6530-002 see 6530 - 1780-17BF RAM internal 6530-003 - 17C0-17FF RAM internal 6530-002 - 1800-1BFF ROM internal 6530-003 - 1C00-1FFF ROM internal 6530-002 - - 6530 - offset R/W short purpose - 0 X DRA Data register A - 1 X DDRA Data direction register A - 2 X DRB Data register B - 3 X DDRB Data direction register B - 4 W CNT1T Count down from value, divide by 1, disable IRQ - 5 W CNT8T Count down from value, divide by 8, disable IRQ - 6 W CNT64T Count down from value, divide by 64, disable IRQ - R LATCH Read current counter value, disable IRQ - 7 W CNT1KT Count down from value, divide by 1024, disable IRQ - R STATUS Read counter statzs, bit 7 = 1 means counter overflow - 8 X DRA Data register A - 9 X DDRA Data direction register A - A X DRB Data register B - B X DDRB Data direction register B - C W CNT1I Count down from value, divide by 1, enable IRQ - D W CNT8I Count down from value, divide by 8, enable IRQ - E W CNT64I Count down from value, divide by 64, enable IRQ - R LATCH Read current counter value, enable IRQ - F W CNT1KI Count down from value, divide by 1024, enable IRQ - R STATUS Read counter statzs, bit 7 = 1 means counter overflow - - 6530-002 (U2) - DRA bit write read - --------------------------------------------- - 0-6 segments A-G key columns 1-7 - 7 PTR KBD - - DRB bit write read - --------------------------------------------- - 0 PTR -/- - 1-4 dec 1-3 key row 1-3 - 4 RW3 - 5-9 7-seg 1-6 - 6530-003 (U3) - DRA bit write read - --------------------------------------------- - 0-7 bus PA0-7 bus PA0-7 - - DRB bit write read - --------------------------------------------- - 0-7 bus PB0-7 bus PB0-7 - - -The cassette interface -====================== - -The KIM-1 stores data on cassette using 2 frequencies: ~3700Hz (high) and ~2400Hz -(low). A high tone is output for 9 cycles and a low tone for 6 cycles. A logic bit -is encoded using 3 sequences of high and low tones. It always starts with a high -tone and ends with a low tone. The middle tone is high for a logic 0 and low for -0 logic 1. - -These high and low tone signals are fed to a circuit containing a LM565 PLL and -a 311 comparator. For a high tone a 1 is passed to DB7 of 6530-U2 for a low tone -a 0 is passed. The KIM-1 software measures the time it takes for the signal to -change from 1 to 0. - - - -Pasting: - 0-F : as is - + (inc) : ^ - AD : - - DA : = - GO : X - -(note: DA only works when addressing RAM) - -Test Paste: - =11^22^33^44^55^66^77^88^99^-0000 - Now press up-arrow to confirm the data has been entered. - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "sound/dac.h" -#include "machine/mos6530.h" -#include "imagedev/cassette.h" -#include "formats/kim1_cas.h" -#include "kim1.lh" - - -class kim1_state : public driver_device -{ -public: - kim1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_riot2(*this, "miot_u2"), - m_cass(*this, "cassette"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1"), - m_line2(*this, "LINE2"), - m_line3(*this, "LINE3") { } - - required_device m_maincpu; - required_device m_riot2; - required_device m_cass; - DECLARE_READ8_MEMBER(kim1_u2_read_a); - DECLARE_WRITE8_MEMBER(kim1_u2_write_a); - DECLARE_READ8_MEMBER(kim1_u2_read_b); - DECLARE_WRITE8_MEMBER(kim1_u2_write_b); - UINT8 m_u2_port_b; - UINT8 m_311_output; - UINT32 m_cassette_high_count; - UINT8 m_led_time[6]; - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(kim1_reset); - TIMER_DEVICE_CALLBACK_MEMBER(kim1_cassette_input); - TIMER_DEVICE_CALLBACK_MEMBER(kim1_update_leds); - -protected: - required_ioport m_line0; - required_ioport m_line1; - required_ioport m_line2; - required_ioport m_line3; -}; - - - - - -static ADDRESS_MAP_START(kim1_map, AS_PROGRAM, 8, kim1_state) - AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0xe000) AM_RAM - AM_RANGE(0x1700, 0x173f) AM_MIRROR(0xe000) AM_DEVREADWRITE("miot_u3", mos6530_device, read, write ) - AM_RANGE(0x1740, 0x177f) AM_MIRROR(0xe000) AM_DEVREADWRITE("miot_u2", mos6530_device, read, write ) - AM_RANGE(0x1780, 0x17bf) AM_MIRROR(0xe000) AM_RAM - AM_RANGE(0x17c0, 0x17ff) AM_MIRROR(0xe000) AM_RAM - AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0xe000) AM_ROM - AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0xe000) AM_ROM -ADDRESS_MAP_END - - -INPUT_CHANGED_MEMBER(kim1_state::kim1_reset) -{ - if (newval == 0) - m_maincpu->reset(); -} - - -static INPUT_PORTS_START( kim1 ) - PORT_START("LINE0") /* IN0 keys row 0 */ - PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - - PORT_START("LINE1") /* IN1 keys row 1 */ - PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("LINE2") /* IN2 keys row 2 */ - PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_F6) - - PORT_START("LINE3") /* IN3 STEP and RESET keys, MODE switch */ - PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("sw1: ST") PORT_CODE(KEYCODE_F7) - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("sw2: RS") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, kim1_state, kim1_reset, NULL) - PORT_DIPNAME(0x10, 0x10, "sw3: SS") PORT_CODE(KEYCODE_NUMLOCK) PORT_TOGGLE - PORT_DIPSETTING( 0x00, "single step") - PORT_DIPSETTING( 0x10, "run") - PORT_BIT( 0x08, 0x00, IPT_UNUSED ) - PORT_BIT( 0x04, 0x00, IPT_UNUSED ) - PORT_BIT( 0x02, 0x00, IPT_UNUSED ) - PORT_BIT( 0x01, 0x00, IPT_UNUSED ) -INPUT_PORTS_END - - -READ8_MEMBER( kim1_state::kim1_u2_read_a ) -{ - UINT8 data = 0xff; - - switch( ( m_u2_port_b >> 1 ) & 0x0f ) - { - case 0: - data = m_line0->read(); - break; - case 1: - data = m_line1->read(); - break; - case 2: - data = m_line2->read(); - break; - } - return data; -} - - -WRITE8_MEMBER( kim1_state::kim1_u2_write_a ) -{ - UINT8 idx = ( m_u2_port_b >> 1 ) & 0x0f; - - if ( idx >= 4 && idx < 10 ) - { - if ( data & 0x80 ) - { - output_set_digit_value( idx-4, data & 0x7f ); - m_led_time[idx - 4] = 15; - } - } -} - -READ8_MEMBER( kim1_state::kim1_u2_read_b ) -{ - if ( m_riot2->portb_out_get() & 0x20 ) - return 0xFF; - - return 0x7F | ( m_311_output ^ 0x80 ); -} - - -WRITE8_MEMBER( kim1_state::kim1_u2_write_b ) -{ - m_u2_port_b = data; - - if ( data & 0x20 ) - /* cassette write/speaker update */ - m_cass->output(( data & 0x80 ) ? -1.0 : 1.0 ); - - /* Set IRQ when bit 7 is cleared */ -} - - -TIMER_DEVICE_CALLBACK_MEMBER(kim1_state::kim1_cassette_input) -{ - double tap_val = m_cass->input(); - - if ( tap_val <= 0 ) - { - if ( m_cassette_high_count ) - { - m_311_output = ( m_cassette_high_count < 8 ) ? 0x80 : 0; - m_cassette_high_count = 0; - } - } - - if ( tap_val > 0 ) - m_cassette_high_count++; -} - - -TIMER_DEVICE_CALLBACK_MEMBER(kim1_state::kim1_update_leds) -{ - UINT8 i; - - for ( i = 0; i < 6; i++ ) - { - if ( m_led_time[i] ) - m_led_time[i]--; - else - output_set_digit_value( i, 0 ); - } -} - - -void kim1_state::machine_start() -{ - save_item(NAME(m_u2_port_b)); - save_item(NAME(m_311_output)); - save_item(NAME(m_cassette_high_count)); -} - - -void kim1_state::machine_reset() -{ - UINT8 i; - - for ( i = 0; i < 6; i++ ) - m_led_time[i] = 0; - - m_311_output = 0; - m_cassette_high_count = 0; -} - - -static MACHINE_CONFIG_START( kim1, kim1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 1000000) /* 1 MHz */ - MCFG_CPU_PROGRAM_MAP(kim1_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - - /* video */ - MCFG_DEFAULT_LAYOUT( layout_kim1 ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_DEVICE_ADD("miot_u2", MOS6530, 1000000) - MCFG_MOS6530_IN_PA_CB(READ8(kim1_state, kim1_u2_read_a)) - MCFG_MOS6530_OUT_PA_CB(WRITE8(kim1_state, kim1_u2_write_a)) - MCFG_MOS6530_IN_PB_CB(READ8(kim1_state, kim1_u2_read_b)) - MCFG_MOS6530_OUT_PB_CB(WRITE8(kim1_state, kim1_u2_write_b)) - - MCFG_DEVICE_ADD("miot_u3", MOS6530, 1000000) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(kim1_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", kim1_state, kim1_update_leds, attotime::from_hz(60)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", kim1_state, kim1_cassette_input, attotime::from_hz(44100)) -MACHINE_CONFIG_END - - -ROM_START(kim1) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("6530-003.bin", 0x1800, 0x0400, CRC(a2a56502) SHA1(60b6e48f35fe4899e29166641bac3e81e3b9d220)) - ROM_LOAD("6530-002.bin", 0x1c00, 0x0400, CRC(2b08e923) SHA1(054f7f6989af3a59462ffb0372b6f56f307b5362)) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1975, kim1, 0, 0, kim1, kim1, driver_device, 0, "MOS Technologies", "KIM-1" , MACHINE_SUPPORTS_SAVE) diff --git a/src/mess/drivers/konin.c b/src/mess/drivers/konin.c deleted file mode 100644 index a9c5022a5ec..00000000000 --- a/src/mess/drivers/konin.c +++ /dev/null @@ -1,115 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Mera-Elzab Konin - - It's industrial computer used in Poland - - 29/12/2011 Skeleton driver. - -'maincpu' (0384): unmapped i/o memory write to 00F8 = 56 & FF -'maincpu' (0388): unmapped i/o memory write to 00F8 = B6 & FF -'maincpu' (038C): unmapped i/o memory write to 0024 = 00 & FF -'maincpu' (0A0B): unmapped i/o memory write to 0080 = BE & FF -'maincpu' (0A0F): unmapped i/o memory write to 0080 = 08 & FF -'maincpu' (0A13): unmapped i/o memory write to 0080 = 0C & FF -'maincpu' (0A15): unmapped i/o memory read from 0082 & FF -'maincpu' (0A19): unmapped i/o memory write to 0080 = 05 & FF -'maincpu' (04DE): unmapped i/o memory write to 00F6 = 27 & FF -'maincpu' (04E2): unmapped i/o memory write to 00F6 = 40 & FF -'maincpu' (04E6): unmapped i/o memory write to 00F6 = CE & FF -'maincpu' (04EA): unmapped i/o memory write to 00F6 = 27 & FF -'maincpu' (043B): unmapped i/o memory write to 00F8 = B6 & FF -'maincpu' (043F): unmapped i/o memory write to 00F6 = 27 & FF -'maincpu' (2AA3): unmapped i/o memory write to 00F8 = 14 & FF -'maincpu' (2AA7): unmapped i/o memory write to 00FB = C0 & FF -'maincpu' (2AC2): unmapped i/o memory write to 00F8 = 56 & FF -'maincpu' (2AC6): unmapped i/o memory write to 00FA = 03 & FF -'maincpu' (0082): unmapped i/o memory write to 0024 = 06 & FF - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - -class konin_state : public driver_device -{ -public: - konin_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_konin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START( konin_mem, AS_PROGRAM, 8, konin_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x4fff) AM_ROM - AM_RANGE(0x5000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( konin_io, AS_IO, 8, konin_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( konin ) -INPUT_PORTS_END - - -void konin_state::machine_reset() -{ -} - -void konin_state::video_start() -{ -} - -UINT32 konin_state::screen_update_konin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( konin, konin_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(konin_mem) - MCFG_CPU_IO_MAP(konin_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(konin_state, screen_update_konin) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( konin ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "001.bin", 0x0000, 0x0800, CRC(0b13208a) SHA1(38ea17be591b729158d601c03bfd9954f32e0e67)) - ROM_LOAD( "008.bin", 0x0800, 0x0800, CRC(f003e407) SHA1(11f79ef3b90788cf627ee39705bbbd04dbf45f50)) - ROM_LOAD( "007.bin", 0x1000, 0x0800, CRC(3d390c03) SHA1(ac2fe31c065e8f630381d6cebd2eb58b403c1e02)) - ROM_LOAD( "006.bin", 0x1800, 0x0800, CRC(68c9732e) SHA1(f40a79719dca485a2db29be5c0c781f559c2551c)) - ROM_LOAD( "005.bin", 0x2000, 0x0800, CRC(14548ac4) SHA1(8987e528b3e479c4c5941366628f34f086d06838)) - ROM_LOAD( "004.bin", 0x2800, 0x0800, CRC(8a354cff) SHA1(24d9f1fb15458fc96f5265f79d54e030b68d9fc9)) - ROM_LOAD( "002.bin", 0x3000, 0x0800, CRC(791fb30d) SHA1(8dfbe0edb741e02cfdd138432999f89480b20471)) - ROM_LOAD( "003.bin", 0x3800, 0x0800, CRC(27dc9864) SHA1(0d3da7fd1db895883c106f5133f8c7228333ecc8)) - ROM_LOAD( "009.bin", 0x4000, 0x0800, CRC(80947d15) SHA1(0757fb191913d79f306874684f9fc082ce18a28e)) - ROM_LOAD( "010.bin", 0x4800, 0x0800, CRC(f0157e0c) SHA1(60ace1eaf0ba01a45987c2286e18f3d56441c994)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, konin, 0, 0, konin, konin, driver_device, 0, "Mera-Elzab", "Konin", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/korgm1.c b/src/mess/drivers/korgm1.c deleted file mode 100644 index 99658c0057d..00000000000 --- a/src/mess/drivers/korgm1.c +++ /dev/null @@ -1,209 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Korg M1 (c) 1988 - - skeleton driver - - Note: driver isn't yet hooked up to mess.lst / mess.mak, until a ROM - dump is found. - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/nec/nec.h" -//#include "sound/ay8910.h" - -#define MAIN_CLOCK XTAL_16MHz // Unknown clock - -class korgm1_state : public driver_device -{ -public: - korgm1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - // devices - required_device m_maincpu; - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - virtual void palette_init(); -}; - -void korgm1_state::video_start() -{ -} - -UINT32 korgm1_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - return 0; -} - -static ADDRESS_MAP_START( korgm1_map, AS_PROGRAM, 16, korgm1_state ) - AM_RANGE(0x00000, 0x0ffff) AM_RAM // 64 KB -// AM_RANGE(0x50000, 0x57fff) AM_RAM // memory card 32 KB - AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( korgm1_io, AS_IO, 16, korgm1_state ) -// AM_RANGE(0x0000, 0x00ff) internal peripheral (?) -// AM_RANGE(0x0100, 0x01ff) VDF 1 (MB87404) -// AM_RANGE(0x0200, 0x02ff) VDF 2 (MB87404) -// AM_RANGE(0x0500, 0x0503) MDE (MB87405) -// AM_RANGE(0x0600, 0x0601) OPZ 1 (8-bit port) -// AM_RANGE(0x0700, 0x0701) OPZ 2 (8-bit port) -// AM_RANGE(0x0800, 0x0801) SCAN (8-bit port) (keyboard) -// AM_RANGE(0x0900, 0x09??) A/D Converter (M58990P, Joystick, "value" and After Touch routes here) ** -// AM_RANGE(0x0a00, 0x0a03) PPI (CXD1095, presumably i8255 compatible, LCD, LED and SW routes here) * -// AM_RANGE(0x0b00, 0x0b01) LCDC (8-bit port) -// AM_RANGE(0x1000, 0x11ff) TG (MB87402) -// AM_RANGE(0x2000, 0x23ff) SCSI -// AM_RANGE(0x3000, 0x33ff) FDC -// TG 2? -ADDRESS_MAP_END - -// * Rail Chase 2 shares this (iocpu) -// ** Lock-On shares this - -static INPUT_PORTS_START( korgm1 ) - /* dummy active high structure */ - PORT_START("SYSA") - PORT_DIPNAME( 0x01, 0x00, "SYSA" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - - /* dummy active low structure */ - PORT_START("DSWA") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -#if 0 -static const gfx_layout charlayout = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { RGN_FRAC(0,1) }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; -#endif - -static GFXDECODE_START( korgm1 ) -// GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) -GFXDECODE_END - - -void korgm1_state::machine_start() -{ -} - -void korgm1_state::machine_reset() -{ -} - - -PALETTE_INIT_MEMBER(korgm1_state, korgm1) -{ -} - -static MACHINE_CONFIG_START( korgm1, korgm1_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",V30,MAIN_CLOCK) // V50 actually - MCFG_CPU_PROGRAM_MAP(korgm1_map) - MCFG_CPU_IO_MAP(korgm1_io) - - /* video hardware */ - /* TODO: LCD actually */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(korgm1_state, screen_update) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", korgm1) - - MCFG_PALETTE_ADD("palette", 8) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( korgm1 ) - ROM_REGION( 0x20000, "ipl", ROMREGION_ERASE00 ) - ROM_LOAD( "bios.rom", 0x00000, 0x20000, NO_DUMP ) - - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASE00 ) - ROM_LOAD( "pcm.rom", 0x00000, 0x200000, NO_DUMP ) - -// ROM_REGION( 0x10000, "gfx1", ROMREGION_ERASE00 ) -ROM_END - -GAME( 1988, korgm1, 0, korgm1, korgm1, 0, ROT0, "Korg", "M1", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/kramermc.c b/src/mess/drivers/kramermc.c deleted file mode 100644 index db139591a34..00000000000 --- a/src/mess/drivers/kramermc.c +++ /dev/null @@ -1,151 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Kramer MC driver by Miodrag Milanovic - - 13/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80pio.h" -#include "includes/kramermc.h" - -static GFXDECODE_START( kramermc ) - GFXDECODE_ENTRY( "gfx1", 0x0000, kramermc_charlayout, 0, 1 ) -GFXDECODE_END - -/* Address maps */ -static ADDRESS_MAP_START(kramermc_mem, AS_PROGRAM, 8, kramermc_state ) - AM_RANGE( 0x0000, 0x03ff ) AM_ROM // Monitor - AM_RANGE( 0x0400, 0x07ff ) AM_ROM // Debugger - AM_RANGE( 0x0800, 0x0bff ) AM_ROM // Reassembler - AM_RANGE( 0x0c00, 0x0fff ) AM_RAM // System RAM - AM_RANGE( 0x1000, 0x7fff ) AM_RAM // User RAM - AM_RANGE( 0x8000, 0xafff ) AM_ROM // BASIC - AM_RANGE( 0xc000, 0xc3ff ) AM_ROM // Editor - AM_RANGE( 0xc400, 0xdfff ) AM_ROM // Assembler - AM_RANGE( 0xfc00, 0xffff ) AM_RAM // Video RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( kramermc_io, AS_IO, 8, kramermc_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xfc, 0x0ff) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( kramermc ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(">") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_START("LINE7") - PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/* Machine driver */ -static MACHINE_CONFIG_START( kramermc, kramermc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 1500000) - MCFG_CPU_PROGRAM_MAP(kramermc_mem) - MCFG_CPU_IO_MAP(kramermc_io) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, 1500000) - MCFG_Z80PIO_IN_PA_CB(READ8(kramermc_state, kramermc_port_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(kramermc_state, kramermc_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(kramermc_state, kramermc_port_b_r)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*8, 16*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*8-1) - MCFG_SCREEN_UPDATE_DRIVER(kramermc_state, screen_update_kramermc) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", kramermc ) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( kramermc ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "io-mon.kmc", 0x0000, 0x0400, CRC(ba230fc8) SHA1(197d4ede31ee8768dd4a17854ee21c468e98b3d6) ) - ROM_LOAD( "debugger.kmc", 0x0400, 0x0400, CRC(5ea3d9e1) SHA1(42e5ced4f965124ae50ec7ac9861d6b668cfab99) ) - ROM_LOAD( "reass.kmc", 0x0800, 0x0400, CRC(7cc8e605) SHA1(3319a96aad710441af30dace906b9725e07ca92c) ) - ROM_LOAD( "basic.kmc", 0x8000, 0x3000, CRC(7531801e) SHA1(61d055495ffcc4a281ef0abc3e299ea95f42544b) ) - ROM_LOAD( "editor.kmc", 0xc000, 0x0400, CRC(2fd4cb84) SHA1(505615a218865aa8becde13848a23e1241a14b96) ) - ROM_LOAD( "ass.kmc", 0xc400, 0x1c00, CRC(9a09422e) SHA1(a578d2cf0ea6eb35dcd13e4107e15187de906097) ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("chargen.kmc", 0x0000, 0x0800, CRC(1ba52f9f) SHA1(71bbad90dd427d0132c871a4d3848ab3d4d84b8a)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, kramermc, 0, 0, kramermc, kramermc, kramermc_state, kramermc,"Manfred Kramer", "Kramer MC", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/kyocera.c b/src/mess/drivers/kyocera.c deleted file mode 100644 index af4b466f09b..00000000000 --- a/src/mess/drivers/kyocera.c +++ /dev/null @@ -1,1640 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/****************************************************************************************** - - Kyocera Kyotronics 85 (and similar laptop computers) - - 2009/04 Very Preliminary Driver (video emulation courtesy of very old code by - Hamish Coleman) - - Comments about bit usage from Tech References and Virtual T source. - - Supported systems: - - Kyosei Kyotronic 85 - - Olivetti M10 (slightly diff hw, BIOS is shifted by 2 words) - - NEC PC-8201A (slightly diff hw) - - TRS-80 Model 100 - - Tandy Model 102 (slightly diff hw) - - Tandy Model 200 (diff video & rtc) - - To Do: - - Find dumps of systems which could easily be added: - * Olivetti M10 Modem (US) (diff BIOS than the European version) - * NEC PC-8201 (original Japanese version of PC-8201A) - * NEC PC-8300 (similar hardware to PC-8201) - * NEC PC-8300 w/BradyWriter II ROMs - -******************************************************************************************/ - -/* - - TODO: - - - bar code reader (!RxDB -> RST5.5, Hewlett-Packard HREDS-3050 interface) - - un-Y2K-hack tandy200 - - keyboard is unresponsive for couple of seconds after boot - - soft power on/off - - pc8201 48K RAM option - - pc8201 NEC PC-8241A video interface (TMS9918, 16K videoRAM, 8K ROM) - - pc8201 NEC PC-8233 floppy controller - - pc8201 NEC floppy disc drives (PC-8031-1W, PC-8031-2W, PC-80S31) - - trsm100 Tandy Portable Disk Drive (TPDD: 100k 3?", TPDD2: 200k 3?") (undumped HD63A01V1 MCU + full custom uPD65002, serial comms via IM6042) - - trsm100 Chipmunk disk drive (384k 3?") (full custom logic, not going to happen) - - trsm100 RS232/modem select - - tandy200 RTC alarm - - tandy200 TCM5089 DTMF sound - - international keyboard option ROMs - - 10 FOR A=0 TO 255 - 20 PRINT CHR$(A); - 30 NEXT A - -*/ - -/* - - * PC-8201/8300 HARDWARE PORT DEFINITIONS * - - -Port- - Name Hex Dec Notes - -------- --- --- ----------------------------------------- - A8255 070 112 Video interface port A (8255) - B8255 071 113 Video interface port B (8255) - C8255 072 114 Video interface port C (8255) - CW8255 073 115 Video interface command/mode port (8255) - -*/ - - -#include "includes/kyocera.h" - -/* Read/Write Handlers */ - -READ8_MEMBER( pc8201_state::bank_r ) -{ - /* - - bit signal description - - 0 LADR1 select address 0 to 7fff - 1 LADR2 select address 0 to 7fff - 2 HADR1 select address 8000 to ffff - 3 HADR2 select address 8000 to ffff - 4 - 5 - 6 SELB serial interface status bit 1 - 7 SELA serial interface status bit 0 - - */ - - return (m_iosel << 5) | m_bank; -} - -void pc8201_state::bankswitch(UINT8 data) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - int rom_bank = data & 0x03; - int ram_bank = (data >> 2) & 0x03; - - m_bank = data & 0x0f; - - if (rom_bank > 1) - { - /* RAM */ - program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); - } - else - { - /* ROM */ - program.install_read_bank(0x0000, 0x7fff, "bank1"); - program.unmap_write(0x0000, 0x7fff); - } - - membank("bank1")->set_entry(rom_bank); - - switch (ram_bank) - { - case 0: - if (m_ram->size() > 16 * 1024) - { - program.install_readwrite_bank(0x8000, 0xffff, "bank2"); - } - else - { - program.unmap_readwrite(0x8000, 0xbfff); - program.install_readwrite_bank(0xc000, 0xffff, "bank2"); - } - break; - - case 1: - program.unmap_readwrite(0x8000, 0xffff); - break; - - case 2: - if (m_ram->size() > 32 * 1024) - program.install_readwrite_bank(0x8000, 0xffff, "bank2"); - else - program.unmap_readwrite(0x8000, 0xffff); - break; - - case 3: - if (m_ram->size() > 64 * 1024) - program.install_readwrite_bank(0x8000, 0xffff, "bank2"); - else - program.unmap_readwrite(0x8000, 0xffff); - break; - } - - membank("bank2")->set_entry(ram_bank); -} - -WRITE8_MEMBER( pc8201_state::bank_w ) -{ - /* - - bit signal description - - 0 LADR1 select address 0 to 7fff - 1 LADR2 select address 0 to 7fff - 2 HADR1 select address 8000 to ffff - 3 HADR2 select address 8000 to ffff - 4 - 5 - 6 - 7 - - */ -printf("bank %02x\n",data); - bankswitch(data); -} - -WRITE8_MEMBER( pc8201_state::scp_w ) -{ - /* - - bit signal description - - 0 - 1 - 2 - 3 REMOTE cassette motor - 4 TSTB RTC strobe - 5 PSTB printer strobe - 6 SELB serial interface select bit 1 - 7 SELA serial interface select bit 0 - - */ - - /* cassette motor */ - m_cassette->change_state(BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - /* RTC strobe */ - m_rtc->stb_w(BIT(data, 4)); - - /* printer strobe */ - m_centronics->write_strobe(BIT(data, 5)); - - /* serial interface select */ - m_iosel = data >> 5; -} - -WRITE8_MEMBER( kc85_state::uart_ctrl_w ) -{ - /* - - bit signal description - - 0 SBS stop bit select - 1 EPE even parity enable - 2 PI parity inhibit - 3 CLS1 character length select bit 1 - 4 CLS2 character length select bit 2 - 5 - 6 - 7 - - */ - - m_uart->sbs_w(BIT(data, 0)); - m_uart->epe_w(BIT(data, 1)); - m_uart->pi_w(BIT(data, 2)); - m_uart->cls1_w(BIT(data, 3)); - m_uart->cls2_w(BIT(data, 4)); - - m_uart->crl_w(1); -} - -READ8_MEMBER( kc85_state::uart_status_r ) -{ - /* - - bit signal description - - 0 CD carrier detect - 1 OE overrun error - 2 FE framing error - 3 PE parity error - 4 TBRE transmit buffer register empty - 5 RP - 6 +5V - 7 _LPS low power sensor - - */ - - UINT8 data = 0x40; - - // carrier detect - data |= m_rs232->dcd_r(); - - // overrun error - data |= m_uart->oe_r() << 1; - - // framing error - data |= m_uart->fe_r() << 2; - - // parity error - data |= m_uart->pe_r() << 3; - - // transmit buffer register empty - data |= m_uart->tbre_r() << 4; - - // rp TODO - data |= 0x20; - - // low power sensor - data |= BIT(m_battery->read(), 0) << 7; - - return data; -} - -READ8_MEMBER( pc8201_state::uart_status_r ) -{ - /* - - bit signal description - - 0 _DCD/_RD data carrier detect / ring detect - 1 OE overrun error - 2 FE framing error - 3 PE parity error - 4 TBRE transmit buffer register empty - 5 RP - 6 +5V - 7 _LPS low power signal - - */ - - UINT8 data = 0x40; - - // data carrier detect / ring detect - data |= m_rs232->dcd_r(); - - // overrun error - data |= m_uart->oe_r() << 1; - - // framing error - data |= m_uart->fe_r() << 2; - - // parity error - data |= m_uart->pe_r() << 3; - - // transmit buffer register empty - data |= m_uart->tbre_r() << 4; - - // rp TODO - data |= 0x20; - - // low power sensor - data |= BIT(m_battery->read(), 0) << 7; - - return data; -} - -WRITE8_MEMBER( pc8201_state::romah_w ) -{ - /* - - bit signal - - 0 A16 - 1 ROM SEL - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - // ROM address bit 16 - m_rom_addr = (BIT(data, 0) << 16) | (m_rom_addr & 0xffff); - - // ROM select - m_rom_sel = BIT(data, 1); -} - -WRITE8_MEMBER( pc8201_state::romal_w ) -{ - /* - - bit signal - - 0 A0 - 1 A1 - 2 A2 - 3 A3 - 4 A4 - 5 A5 - 6 A6 - 7 A7 - - */ - - m_rom_addr = (m_rom_addr & 0x1ff00) | data; -} - -WRITE8_MEMBER( pc8201_state::romam_w ) -{ - /* - - bit signal - - 0 A8 - 1 A9 - 2 A10 - 3 A11 - 4 A12 - 5 A13 - 6 A14 - 7 A15 - - */ - - m_rom_addr = (m_rom_addr & 0x100ff) | (data << 8); -} - -READ8_MEMBER( pc8201_state::romrd_r ) -{ - UINT8 data = 0xff; - - if (m_rom_sel) - data = m_cas_cart->read_rom(space, m_rom_addr & 0x1ffff); - - return data; -} - -WRITE8_MEMBER( kc85_state::modem_w ) -{ - /* - - bit signal description - - 0 telephone line signal selection relay output - 1 EN MC14412 enable output - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - //m_modem->en_w(BIT(data, 1)); -} - -WRITE8_MEMBER( kc85_state::ctrl_w ) -{ - /* - - bit signal description - - 0 _STROM ROM selection (0=standard, 1=option) - 1 _STROBE printer strobe output - 2 STB RTC strobe output - 3 _REMOTE cassette motor - 4 - 5 - 6 - 7 - - */ - - /* ROM bank selection */ - membank("bank1")->set_entry(BIT(data, 0)); - - /* printer strobe */ - m_centronics->write_strobe(BIT(data, 1)); - - /* RTC strobe */ - m_rtc->stb_w(BIT(data, 2)); - - /* cassette motor */ - m_cassette->change_state(BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - -READ8_MEMBER( kc85_state::keyboard_r ) -{ - UINT8 data = 0xff; - - if (!BIT(m_keylatch, 0)) data &= m_y0->read(); - if (!BIT(m_keylatch, 1)) data &= m_y1->read(); - if (!BIT(m_keylatch, 2)) data &= m_y2->read(); - if (!BIT(m_keylatch, 3)) data &= m_y3->read(); - if (!BIT(m_keylatch, 4)) data &= m_y4->read(); - if (!BIT(m_keylatch, 5)) data &= m_y5->read(); - if (!BIT(m_keylatch, 6)) data &= m_y6->read(); - if (!BIT(m_keylatch, 7)) data &= m_y7->read(); - if (!BIT(m_keylatch, 8)) data &= m_y8->read(); - - return data; -} - -void tandy200_state::bankswitch(UINT8 data) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - int rom_bank = data & 0x03; - int ram_bank = (data >> 2) & 0x03; - - m_bank = data & 0x0f; - - if (rom_bank == 3) - { - /* invalid ROM bank */ - program.unmap_readwrite(0x0000, 0x7fff); - } - else - { - program.install_read_bank(0x0000, 0x7fff, "bank1"); - program.unmap_write(0x0000, 0x7fff); - membank("bank1")->set_entry(rom_bank); - } - - if (m_ram->size() < ((ram_bank + 1) * 24 * 1024)) - { - /* invalid RAM bank */ - program.unmap_readwrite(0xa000, 0xffff); - } - else - { - program.install_readwrite_bank(0xa000, 0xffff, "bank2"); - membank("bank2")->set_entry(ram_bank); - } -} - -READ8_MEMBER( tandy200_state::bank_r ) -{ - return m_bank; -} - -WRITE8_MEMBER( tandy200_state::bank_w ) -{ - bankswitch(data); -} - -READ8_MEMBER( tandy200_state::stbk_r ) -{ - UINT8 data = 0xff; - - if (!BIT(m_keylatch, 0)) data &= m_y0->read(); - if (!BIT(m_keylatch, 1)) data &= m_y1->read(); - if (!BIT(m_keylatch, 2)) data &= m_y2->read(); - if (!BIT(m_keylatch, 3)) data &= m_y3->read(); - if (!BIT(m_keylatch, 4)) data &= m_y4->read(); - if (!BIT(m_keylatch, 5)) data &= m_y5->read(); - if (!BIT(m_keylatch, 6)) data &= m_y6->read(); - if (!BIT(m_keylatch, 7)) data &= m_y7->read(); - if (!BIT(m_keylatch, 8)) data &= m_y8->read(); - - return data; -} - -WRITE8_MEMBER( tandy200_state::stbk_w ) -{ - /* - - bit signal description - - 0 _PSTB printer strobe output - 1 REMOTE cassette motor - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - /* printer strobe */ - m_centronics->write_strobe(BIT(data, 0)); - - /* cassette motor */ - m_cassette->change_state(BIT(data,1) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - -READ8_MEMBER( kc85_state::lcd_r ) -{ - UINT8 data = 0; - - data |= m_lcdc0->read(space, offset); - data |= m_lcdc1->read(space, offset); - data |= m_lcdc2->read(space, offset); - data |= m_lcdc3->read(space, offset); - data |= m_lcdc4->read(space, offset); - data |= m_lcdc5->read(space, offset); - data |= m_lcdc6->read(space, offset); - data |= m_lcdc7->read(space, offset); - data |= m_lcdc8->read(space, offset); - data |= m_lcdc9->read(space, offset); - - return data; -} - -WRITE8_MEMBER( kc85_state::lcd_w ) -{ - m_lcdc0->write(space, offset, data); - m_lcdc1->write(space, offset, data); - m_lcdc2->write(space, offset, data); - m_lcdc3->write(space, offset, data); - m_lcdc4->write(space, offset, data); - m_lcdc5->write(space, offset, data); - m_lcdc6->write(space, offset, data); - m_lcdc7->write(space, offset, data); - m_lcdc8->write(space, offset, data); - m_lcdc9->write(space, offset, data); -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( kc85_mem, AS_PROGRAM, 8, kc85_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8201_mem, AS_PROGRAM, 8, pc8201_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tandy200_mem, AS_PROGRAM, 8, tandy200_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0x9fff) AM_ROM - AM_RANGE(0xa000, 0xffff) AM_RAMBANK("bank2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( kc85_io, AS_IO, 8, kc85_state ) - ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional RAM unit -// AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional I/O controller unit -// AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) optional answering telephone unit -// AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) optional modem - AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_device, io_r, io_w) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_device, read, write) - AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(uart_status_r, uart_ctrl_w) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(keyboard_r, ctrl_w) - AM_RANGE(0xf0, 0xf1) AM_MIRROR(0x0e) AM_READWRITE(lcd_r, lcd_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( trsm100_io, AS_IO, 8, kc85_state ) - AM_IMPORT_FROM(kc85_io) - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(modem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8201_io, AS_IO, 8, pc8201_state ) - ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional video interface 8255 - AM_RANGE(0x80, 0x80) AM_MIRROR(0x03) AM_WRITE(romah_w) - AM_RANGE(0x84, 0x84) AM_MIRROR(0x03) AM_WRITE(romal_w) - AM_RANGE(0x88, 0x88) AM_MIRROR(0x03) AM_WRITE(romam_w) - AM_RANGE(0x8c, 0x8c) AM_MIRROR(0x03) AM_READ(romrd_r) - AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) AM_WRITE(scp_w) - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_READWRITE(bank_r, bank_w) - AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_device, io_r, io_w) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_device, read, write) - AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READ(uart_status_r) AM_WRITE(uart_ctrl_w) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READ(keyboard_r) - AM_RANGE(0xf0, 0xf1) AM_MIRROR(0x0e) AM_READWRITE(lcd_r, lcd_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tandy200_io, AS_IO, 8, tandy200_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x90, 0x9f) AM_DEVREADWRITE(RP5C01A_TAG, rp5c01_device, read, write) -// AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_DEVWRITE(TCM5089_TAG, write) - AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_device, io_r, io_w) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) - AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) - AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(bank_r, bank_w) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(stbk_r, stbk_w) - AM_RANGE(0xf0, 0xf0) AM_MIRROR(0x0e) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, data_r, data_w) - AM_RANGE(0xf1, 0xf1) AM_MIRROR(0x0e) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, status_r, control_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( kc85 ) - PORT_START("Y0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("Y1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START("Y2") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START("Y3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("Y4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("Y5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - - PORT_START("Y6") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LABEL") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PASTE") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92|") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("Y8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE BREAK") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NUM") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CODE") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) - PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x00, "Low Battery" ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc8201 ) - PORT_INCLUDE( kc85 ) - - PORT_MODIFY("Y3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('^') - - PORT_MODIFY("Y4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - - PORT_MODIFY("Y5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAST INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_MODIFY("Y6") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92|") PORT_CODE(KEYCODE_TAB) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_MODIFY("Y7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_MODIFY("Y8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc8201a ) - PORT_INCLUDE( kc85 ) - - PORT_MODIFY("Y3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('^') - - PORT_MODIFY("Y4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - - PORT_MODIFY("Y5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAST INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_MODIFY("Y6") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92|") PORT_CODE(KEYCODE_TAB) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_MODIFY("Y7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_MODIFY("Y8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( olivm10 ) - PORT_START("Y0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START("Y1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - - PORT_START("Y2") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("Y3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START("Y4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - - PORT_START("Y5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - - PORT_START("Y6") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PASTE") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92|") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("Y7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("Y8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE BREAK") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NUM") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LABEL") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) - PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x00, "Low Battery" ) -INPUT_PORTS_END - - -/* 8155 Interface */ - -WRITE8_MEMBER( kc85_state::i8155_pa_w ) -{ - /* - - bit description - - 0 LCD chip select 0, key scan 0, RTC C0 - 1 LCD chip select 1, key scan 1, RTC C1 - 2 LCD chip select 2, key scan 2, RTC C2 - 3 LCD chip select 3, key scan 3, RTC CLK - 4 LCD chip select 4, key scan 4, RTC DATA IN - 5 LCD chip select 5, key scan 5 - 6 LCD chip select 6, key scan 6 - 7 LCD chip select 7, key scan 7 - - */ - - /* keyboard */ - m_keylatch = (m_keylatch & 0x100) | data; - - /* LCD */ - m_lcdc0->cs2_w(BIT(data, 0)); - m_lcdc1->cs2_w(BIT(data, 1)); - m_lcdc2->cs2_w(BIT(data, 2)); - m_lcdc3->cs2_w(BIT(data, 3)); - m_lcdc4->cs2_w(BIT(data, 4)); - m_lcdc5->cs2_w(BIT(data, 5)); - m_lcdc6->cs2_w(BIT(data, 6)); - m_lcdc7->cs2_w(BIT(data, 7)); - - /* RTC */ - m_rtc->c0_w(BIT(data, 0)); - m_rtc->c1_w(BIT(data, 1)); - m_rtc->c2_w(BIT(data, 2)); - m_rtc->clk_w(BIT(data, 3)); - m_rtc->data_in_w(BIT(data, 4)); -} - -WRITE8_MEMBER( kc85_state::i8155_pb_w ) -{ - /* - - bit signal description - - 0 LCD chip select 8, key scan 8 - 1 LCD chip select 9 - 2 _MC melody control output - 3 DCD/_RD RS232 DCD/_RD select (0=RS232, 1=modem) - 4 APO auto power off output - 5 BELL buzzer output (0=ring, 1=not ring) - 6 _DTR RS232 data terminal ready output - 7 _RTS RS232 request to send output - - */ - - /* keyboard */ - m_keylatch = (BIT(data, 0) << 8) | (m_keylatch & 0xff); - - /* LCD */ - m_lcdc8->cs2_w(BIT(data, 0)); - m_lcdc9->cs2_w(BIT(data, 1)); - - /* beeper */ - m_buzzer = BIT(data, 2); - m_bell = BIT(data, 5); - - if (m_buzzer) m_speaker->level_w(m_bell); - - // RS-232 - m_rs232->write_dtr(BIT(data, 6)); - m_rs232->write_rts(BIT(data, 7)); -} - -WRITE_LINE_MEMBER( kc85_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( kc85_state::write_centronics_select ) -{ - m_centronics_select = state; -} - -READ8_MEMBER( kc85_state::i8155_pc_r ) -{ - /* - - bit description - - 0 CDI clock data input - 1 SLCT _BUSY signal from printer - 2 BUSY BUSY signal from printer - 3 BCR bar code reader data input - 4 _CTS RS232 clear to send input - 5 _DSR RS232 DSR input - - */ - - UINT8 data = 0; - - // clock data input - data |= m_rtc->data_out_r(); - - // centronics busy - data |= m_centronics_select << 1; - data |= m_centronics_busy << 2; - - // RS-232 - data |= m_rs232->cts_r() << 4; - data |= m_rs232->dsr_r() << 5; - - return data; -} - -WRITE_LINE_MEMBER( kc85_state::i8155_to_w ) -{ - if (!m_buzzer && m_bell) - { - m_speaker->level_w(state); - } - - m_uart->trc_w(state); - m_uart->rrc_w(state); -} - -WRITE8_MEMBER( tandy200_state::i8155_pa_w ) -{ - /* - - bit description - - 0 print data 0, key scan 0 - 1 print data 1, key scan 1 - 2 print data 2, key scan 2 - 3 print data 3, key scan 3 - 4 print data 4, key scan 4 - 5 print data 5, key scan 5 - 6 print data 6, key scan 6 - 7 print data 7, key scan 7 - - */ - - m_cent_data_out->write(space, 0, data); - - m_keylatch = (m_keylatch & 0x100) | data; -} - -WRITE8_MEMBER( tandy200_state::i8155_pb_w ) -{ - /* - - bit signal description - - 0 key scan 8 - 1 ORIG/ANS (1=ORIG, 0=ANS) - 2 _BUZZER (0=data from 8155 TO, 1=data from PB2) - 3 _RS232C (1=modem, 0=RS-232) - 4 PCS power cut signal - 5 BELL buzzer data output - 6 MEN modem enable output - 7 CALL connects and disconnects the phone line - - */ - - /* keyboard */ - m_keylatch = (BIT(data, 0) << 8) | (m_keylatch & 0xff); - - /* beeper */ - m_buzzer = BIT(data, 2); - m_bell = BIT(data, 5); - - if (m_buzzer) m_speaker->level_w(m_bell); -} - -WRITE_LINE_MEMBER( tandy200_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( tandy200_state::write_centronics_select ) -{ - m_centronics_select = state; -} - -READ8_MEMBER( tandy200_state::i8155_pc_r ) -{ - /* - - bit signal description - - 0 _LPS low power sense input - 1 _BUSY not busy input - 2 BUSY busy input - 3 BCR bar code reader data input - 4 CD carrier detect input - 5 CDBD carrier detect break down input - - */ - - UINT8 data = 0x01; - - // centronics - data |= m_centronics_select << 1; - data |= m_centronics_busy << 2; - - // RS-232 - data |= m_rs232->dcd_r() << 4; - - return data; -} - -WRITE_LINE_MEMBER( tandy200_state::i8155_to_w ) -{ - if (!m_buzzer && m_bell) - { - m_speaker->level_w(state); - } -} - -/* Machine Drivers */ - -void kc85_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - std::string region_tag; - m_opt_region = memregion(region_tag.assign(m_opt_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - /* initialize RTC */ - m_rtc->cs_w(1); - m_rtc->oe_w(1); - - /* configure ROM banking */ - program.install_read_bank(0x0000, 0x7fff, "bank1"); - program.unmap_write(0x0000, 0x7fff); - membank("bank1")->configure_entry(0, m_rom->base()); - membank("bank1")->configure_entry(1, m_opt_region ? m_opt_region->base() : m_rom->base()); - membank("bank1")->set_entry(0); - - /* configure RAM banking */ - switch (m_ram->size()) - { - case 16 * 1024: - program.unmap_readwrite(0x8000, 0xbfff); - program.install_readwrite_bank(0xc000, 0xffff, "bank2"); - break; - - case 32 * 1024: - program.install_readwrite_bank(0x8000, 0xffff,"bank2"); - break; - } - - membank("bank2")->configure_entry(0, m_ram->pointer()); - membank("bank2")->set_entry(0); - - /* register for state saving */ - save_item(NAME(m_bank)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_buzzer)); - save_item(NAME(m_bell)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_select)); -} - -void pc8201_state::machine_start() -{ - UINT8 *ram = m_ram->pointer(); - - std::string region_tag; - m_opt_region = memregion(region_tag.assign(m_opt_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - /* initialize RTC */ - m_rtc->cs_w(1); - m_rtc->oe_w(1); - - /* configure ROM banking */ - membank("bank1")->configure_entry(0, m_rom->base()); - membank("bank1")->configure_entry(1, m_opt_region ? m_opt_region->base() : m_rom->base()); - membank("bank1")->configure_entries(2, 2, ram + 0x8000, 0x8000); - membank("bank1")->set_entry(0); - - /* configure RAM banking */ - membank("bank2")->configure_entry(0, ram); - membank("bank2")->configure_entries(2, 2, ram + 0x8000, 0x8000); - membank("bank2")->set_entry(0); - - bankswitch(0); - - /* register for state saving */ - save_item(NAME(m_bank)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_buzzer)); - save_item(NAME(m_bell)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_select)); - save_item(NAME(m_iosel)); -} - -void trsm100_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - std::string region_tag; - m_opt_region = memregion(region_tag.assign(m_opt_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - /* initialize RTC */ - m_rtc->cs_w(1); - m_rtc->oe_w(1); - - /* configure ROM banking */ - program.install_read_bank(0x0000, 0x7fff, "bank1"); - program.unmap_write(0x0000, 0x7fff); - membank("bank1")->configure_entry(0, m_rom->base()); - membank("bank1")->configure_entry(1, m_opt_region ? m_opt_region->base() : m_rom->base()); - membank("bank1")->set_entry(0); - - /* configure RAM banking */ - switch (m_ram->size()) - { - case 8 * 1024: - program.unmap_readwrite(0x8000, 0xcfff); - program.install_readwrite_bank(0xe000, 0xffff, "bank2"); - break; - - case 16 * 1024: - program.unmap_readwrite(0x8000, 0xbfff); - program.install_readwrite_bank(0xc000, 0xffff, "bank2"); - break; - - case 24 * 1024: - program.unmap_readwrite(0x8000, 0x9fff); - program.install_readwrite_bank(0xa000, 0xffff, "bank2"); - break; - - case 32 * 1024: - program.install_readwrite_bank(0x8000, 0xffff, "bank2"); - break; - } - - membank("bank2")->configure_entry(0, m_ram->pointer()); - membank("bank2")->set_entry(0); - - /* register for state saving */ - save_item(NAME(m_bank)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_buzzer)); - save_item(NAME(m_bell)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_select)); -} - -void tandy200_state::machine_start() -{ - std::string region_tag; - m_opt_region = memregion(region_tag.assign(m_opt_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - /* configure ROM banking */ - membank("bank1")->configure_entry(0, m_rom->base()); - membank("bank1")->configure_entry(1, m_rom->base() + 0x10000); - membank("bank1")->configure_entry(2, m_opt_region ? m_opt_region->base() : m_rom->base()); - membank("bank1")->set_entry(0); - - /* configure RAM banking */ - membank("bank2")->configure_entries(0, 3, m_ram->pointer(), 0x6000); - membank("bank2")->set_entry(0); - - /* register for state saving */ - save_item(NAME(m_bank)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_buzzer)); - save_item(NAME(m_bell)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_select)); - save_item(NAME(m_tp)); -} - -WRITE_LINE_MEMBER( kc85_state::kc85_sod_w ) -{ - m_cassette->output(state ? +1.0 : -1.0); -} - -READ_LINE_MEMBER( kc85_state::kc85_sid_r ) -{ - return m_cassette->input() > 0.0; -} - -WRITE_LINE_MEMBER( tandy200_state::kc85_sod_w ) -{ - m_cassette->output(state ? +1.0 : -1.0); -} - -READ_LINE_MEMBER( tandy200_state::kc85_sid_r ) -{ - return m_cassette->input() > 0.0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(tandy200_state::tandy200_tp_tick) -{ - m_maincpu->set_input_line(I8085_RST75_LINE, m_tp); - - m_tp = !m_tp; -} - -static MACHINE_CONFIG_START( kc85, kc85_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I8085_TAG, I8085A, XTAL_4_9152MHz) - MCFG_CPU_PROGRAM_MAP(kc85_mem) - MCFG_CPU_IO_MAP(kc85_io) - MCFG_I8085A_SID(READLINE(kc85_state,kc85_sid_r)) - MCFG_I8085A_SOD(WRITELINE(kc85_state,kc85_sod_w)) - - /* video hardware */ - MCFG_FRAGMENT_ADD(kc85_video) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_4_9152MHz/2) - MCFG_I8155_OUT_PORTA_CB(WRITE8(kc85_state, i8155_pa_w)) - MCFG_I8155_OUT_PORTB_CB(WRITE8(kc85_state, i8155_pb_w)) - MCFG_I8155_IN_PORTC_CB(READ8(kc85_state, i8155_pc_r)) - MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(kc85_state, i8155_to_w)) - - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE)) - - MCFG_IM6402_ADD(IM6402_TAG, 0, 0) - MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kc85_state, write_centronics_busy)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(kc85_state, write_centronics_select)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* option ROM cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("opt_cartslot", generic_linear_slot, "trsm100_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "trsm100") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pc8201, pc8201_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I8085_TAG, I8085A, XTAL_4_9152MHz) - MCFG_CPU_PROGRAM_MAP(pc8201_mem) - MCFG_CPU_IO_MAP(pc8201_io) - MCFG_I8085A_SID(READLINE(kc85_state,kc85_sid_r)) - MCFG_I8085A_SOD(WRITELINE(kc85_state,kc85_sod_w)) - - /* video hardware */ - MCFG_FRAGMENT_ADD(kc85_video) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_4_9152MHz/2) - MCFG_I8155_OUT_PORTA_CB(WRITE8(kc85_state, i8155_pa_w)) - MCFG_I8155_OUT_PORTB_CB(WRITE8(kc85_state, i8155_pb_w)) - MCFG_I8155_IN_PORTC_CB(READ8(kc85_state, i8155_pc_r)) - MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(kc85_state, i8155_to_w)) - - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE)) - - MCFG_IM6402_ADD(IM6402_TAG, 0, 0) - MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kc85_state, write_centronics_busy)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(kc85_state, write_centronics_select)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* option ROM cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("opt_cartslot", generic_linear_slot, "pc8201_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* 128KB ROM cassette */ - MCFG_GENERIC_CARTSLOT_ADD("cas_cartslot", generic_linear_slot, "pc8201_cart2") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "pc8201") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K,64K,96K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc8300, pc8201 ) - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("64K,96K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( trsm100, trsm100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I8085_TAG, I8085A, XTAL_4_9152MHz) - MCFG_CPU_PROGRAM_MAP(kc85_mem) - MCFG_CPU_IO_MAP(trsm100_io) - MCFG_I8085A_SID(READLINE(kc85_state,kc85_sid_r)) - MCFG_I8085A_SOD(WRITELINE(kc85_state,kc85_sod_w)) - - /* video hardware */ - MCFG_FRAGMENT_ADD(kc85_video) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_4_9152MHz/2) - MCFG_I8155_OUT_PORTA_CB(WRITE8(kc85_state, i8155_pa_w)) - MCFG_I8155_OUT_PORTB_CB(WRITE8(kc85_state, i8155_pb_w)) - MCFG_I8155_IN_PORTC_CB(READ8(kc85_state, i8155_pc_r)) - MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(kc85_state, i8155_to_w)) - - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE)) - - MCFG_IM6402_ADD(IM6402_TAG, 0, 0) - MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - -// MCFG_MC14412_ADD(MC14412_TAG, XTAL_1MHz) - - /* option ROM cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("opt_cartslot", generic_linear_slot, "trsm100_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "trsm100") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_RAM_EXTRA_OPTIONS("16K,24K,32K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tandy102, trsm100 ) - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("24K") - MCFG_RAM_EXTRA_OPTIONS("32K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( tandy200, tandy200_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I8085_TAG, I8085A, XTAL_4_9152MHz) - MCFG_CPU_PROGRAM_MAP(tandy200_mem) - MCFG_CPU_IO_MAP(tandy200_io) - MCFG_I8085A_SID(READLINE(tandy200_state,kc85_sid_r)) - MCFG_I8085A_SOD(WRITELINE(tandy200_state,kc85_sod_w)) - - /* video hardware */ - MCFG_FRAGMENT_ADD(tandy200_video) - - /* TP timer */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("tp", tandy200_state, tandy200_tp_tick, attotime::from_hz(XTAL_4_9152MHz/2/8192)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -// MCFG_TCM5089_ADD(TCM5089_TAG, XTAL_3_579545MHz) - - /* devices */ - MCFG_DEVICE_ADD(I8155_TAG, I8155, XTAL_4_9152MHz/2) - MCFG_I8155_OUT_PORTA_CB(WRITE8(tandy200_state, i8155_pa_w)) - MCFG_I8155_OUT_PORTB_CB(WRITE8(tandy200_state, i8155_pb_w)) - MCFG_I8155_IN_PORTC_CB(READ8(tandy200_state, i8155_pc_r)) - MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(tandy200_state, i8155_to_w)) - - MCFG_DEVICE_ADD(RP5C01A_TAG, RP5C01, XTAL_32_768kHz) - - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) /*XTAL_4_9152MHz/2,*/ - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - -// MCFG_MC14412_ADD(MC14412_TAG, XTAL_1MHz) - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(tandy200_state, write_centronics_busy)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(tandy200_state, write_centronics_select)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* option ROM cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("opt_cartslot", generic_linear_slot, "tandy200_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "tandy200") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("24K") - MCFG_RAM_EXTRA_OPTIONS("48K,72K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( kc85 ) - ROM_REGION( 0x8000, I8085_TAG, 0 ) - ROM_LOAD( "kc85rom.bin", 0x0000, 0x8000, CRC(8a9ddd6b) SHA1(9d18cb525580c9e071e23bc3c472380aa46356c0) ) -ROM_END - -ROM_START( pc8201 ) - ROM_REGION( 0x10000, I8085_TAG, 0 ) - ROM_LOAD( "3256a41-3b1 n 82 basic.rom0", 0x0000, 0x8000, CRC(3dbaa484) SHA1(9886a973faa639ca9e0ba478790bab20e5163495) ) -ROM_END - -ROM_START( pc8201a ) - ROM_REGION( 0x10000, I8085_TAG, 0 ) - ROM_LOAD( "pc8201rom.rom", 0x0000, 0x8000, CRC(30555035) SHA1(96f33ff235db3028bf5296052acedbc94437c596) ) -ROM_END - -ROM_START( npc8300 ) - ROM_REGION( 0x10000, I8085_TAG, 0 ) - ROM_LOAD( "831000-438_n83a_basic_1986_microsoft_8716_z01.bin", 0x0000, 0x8000, CRC(a3c15dcb) SHA1(f0322dfe3f2e951de043bf6d0973e6ffc2c87181)) -ROM_END - -ROM_START( trsm100 ) - /* - Board Code ROM type ROM Code Comment - ------------------------------------------------------------------- - PLX110CH1X custom LH535618 early North America - PLX110EH1X 27C256 compatible 3256C07-3J1/11US late North America - PLX120CH1X 27C256 compatible 3256C05-3E1/11EP European/Italian - */ - ROM_REGION( 0x8000, I8085_TAG, 0 ) - ROM_LOAD( "m100rom.m12", 0x0000, 0x8000, CRC(730a3611) SHA1(094dbc4ac5a4ea5cdf51a1ac581a40a9622bb25d) ) -ROM_END - -ROM_START( m10 ) - // 3256C02-4B3/I Italian - ROM_REGION( 0x8010, I8085_TAG, 0 ) - ROM_LOAD( "m10rom.m12", 0x0000, 0x8000, CRC(f0e8447a) SHA1(d58867276213116a79f7074109b7d7ce02e8a3af) ) -ROM_END - -ROM_START( tandy102 ) - ROM_REGION( 0x8000, I8085_TAG, 0 ) - ROM_LOAD( "m102rom.m12", 0x0000, 0x8000, CRC(08e9f89c) SHA1(b6ede7735a361c80419f4c9c0e36e7d480c36d11) ) -ROM_END - -ROM_START( tandy200 ) - ROM_REGION( 0x18000, I8085_TAG, 0 ) - ROM_LOAD( "rom #1-1.m15", 0x00000, 0x8000, NO_DUMP ) - ROM_LOAD( "rom #1-2.m13", 0x08000, 0x2000, NO_DUMP ) - ROM_LOAD( "rom #2.m14", 0x10000, 0x8000, NO_DUMP ) - ROM_LOAD( "t200rom.bin", 0x0000, 0xa000, BAD_DUMP CRC(e3358b38) SHA1(35d4e6a5fb8fc584419f57ec12b423f6021c0991) ) /* Y2K hacked */ - ROM_CONTINUE( 0x10000, 0x8000 ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1983, kc85, 0, 0, kc85, kc85, driver_device, 0, "Kyosei", "Kyotronic 85 (Japan)", 0 ) -COMP( 1983, m10, kc85, 0, kc85, olivm10, driver_device, 0, "Olivetti", "M-10", 0 ) -//COMP( 1983, m10m, kc85, 0, kc85, olivm10, driver_device, 0, "Olivetti", "M-10 Modem (US)", 0 ) -COMP( 1983, trsm100, 0, 0, trsm100, kc85, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 100", 0 ) -COMP( 1986, tandy102, trsm100,0, tandy102, kc85, driver_device, 0, "Tandy Radio Shack", "Tandy 102", 0 ) -COMP( 1983, pc8201, 0, 0, pc8201, pc8201, driver_device, 0, "Nippon Electronic Company", "PC-8201 (Japan)", MACHINE_NOT_WORKING ) // keyboard layout wrong -COMP( 1983, pc8201a, pc8201, 0, pc8201, pc8201a, driver_device, 0, "Nippon Electronic Company", "PC-8201A", 0 ) -COMP( 1987, npc8300, pc8201, 0, pc8300, pc8201a, driver_device, 0, "Nippon Electronic Company", "PC-8300", MACHINE_NOT_WORKING ) -COMP( 1984, tandy200, 0, 0, tandy200, kc85, driver_device, 0, "Tandy Radio Shack", "Tandy 200", 0 ) diff --git a/src/mess/drivers/laser3k.c b/src/mess/drivers/laser3k.c deleted file mode 100644 index a7a3fa3bfa3..00000000000 --- a/src/mess/drivers/laser3k.c +++ /dev/null @@ -1,1037 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - laser3k.c - Driver for VTech Laser 3000 / Dick Smith Electronics "The Cat" - - This machine is somewhat similar to a 48K Apple II if you blur your eyes - a lot, but it generally fits in poorly with 100% compatible machines - (no chance of a compatible language card or auxmem) so it gets its own driver. - - An "emulation cartridge" is required to run Apple II software; it's unclear - what that consists of. - - Banking theory: - - 6502 has 4 banking windows, 0000-3FFF, 4000-7FFF, 8000-BFFF, C000-FFFF - - Physical address space is 0x00000-0x3FFFF. ROM and I/O at the top, RAM - up to 0x2FFFF (192k max). - - Each window has a bank number register at physical 3C07C/D/E/F - - Technical manual at: - http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/LASER/LASER%203000/Manuals/The%20Cat%20Technical%20Reference%20Manual.pdf - - TODO: - - Finish keyboard - - RGB graphics mode - - FDC C800 page appears to be inside the FDC cartridge, need a dump :( (can hack to use IWM in the meantime) - - Centronics printer port (data at 3c090, read ack at 3c1c0, read busy at 3c1c2) - - cassette - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/bankdev.h" -#include "machine/ram.h" -#include "machine/kb3600.h" -#include "sound/speaker.h" -#include "sound/sn76496.h" - -enum -{ - TEXT = 0, - HIRES, - RGB, - DHIRES -}; - -#define BLACK 0 -#define DKRED 1 -#define DKBLUE 2 -#define PURPLE 3 -#define DKGREEN 4 -#define DKGRAY 5 -#define BLUE 6 -#define LTBLUE 7 -#define BROWN 8 -#define ORANGE 9 -#define GRAY 10 -#define PINK 11 -#define GREEN 12 -#define YELLOW 13 -#define AQUA 14 -#define WHITE 15 - -class laser3k_state : public driver_device -{ -public: - laser3k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_ram(*this, "mainram") - , m_bank0(*this, "bank0") - , m_bank1(*this, "bank1") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - , m_ay3600(*this, "ay3600") - , m_speaker(*this, "speaker") - , m_sn(*this, "sn76489") - , m_kbspecial(*this, "keyb_special") - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_bank0; - required_device m_bank1; - required_device m_bank2; - required_device m_bank3; - required_device m_ay3600; - required_device m_speaker; - required_device m_sn; - required_ioport m_kbspecial; - - READ8_MEMBER( ram_r ); - WRITE8_MEMBER( ram_w ); - READ8_MEMBER( io_r ); - WRITE8_MEMBER( io_w ); - READ8_MEMBER( io2_r ); - - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(laser3k); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - - DECLARE_READ_LINE_MEMBER(ay3600_shift_r); - DECLARE_READ_LINE_MEMBER(ay3600_control_r); - DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); - -private: - UINT8 m_bank0val, m_bank1val, m_bank2val, m_bank3val; - int m_flash; - int m_speaker_state; - int m_disp_page; - int m_bg_color, m_fg_color, m_border_color; - UINT16 m_lastchar, m_strobe; - UINT8 m_transchar; - bool m_80col; - bool m_mix; - int m_gfxmode; - UINT16 *m_hires_artifact_map; - UINT16 *m_dhires_artifact_map; - - void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen); - void do_io(int offset); -}; - -/*************************************************************************** - ADDRESS MAP -***************************************************************************/ - -static ADDRESS_MAP_START( laser3k_map, AS_PROGRAM, 8, laser3k_state ) - AM_RANGE(0x0000, 0x3fff) AM_DEVICE("bank0", address_map_bank_device, amap8) - AM_RANGE(0x4000, 0x7fff) AM_DEVICE("bank1", address_map_bank_device, amap8) - AM_RANGE(0x8000, 0xbfff) AM_DEVICE("bank2", address_map_bank_device, amap8) - AM_RANGE(0xc000, 0xffff) AM_DEVICE("bank3", address_map_bank_device, amap8) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( banks_map, AS_PROGRAM, 8, laser3k_state ) - AM_RANGE(0x00000, 0x2ffff) AM_READWRITE(ram_r, ram_w) - AM_RANGE(0x38000, 0x3bfff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x3c000, 0x3c0ff) AM_READWRITE(io_r, io_w) - AM_RANGE(0x3c100, 0x3c1ff) AM_READ(io2_r) - AM_RANGE(0x3c200, 0x3ffff) AM_ROM AM_REGION("maincpu", 0x4200) -ADDRESS_MAP_END - -void laser3k_state::machine_start() -{ - static const UINT8 hires_artifact_color_table[] = - { - BLACK, PURPLE, GREEN, WHITE, - BLACK, BLUE, ORANGE, WHITE - }; - - static const UINT8 dhires_artifact_color_table[] = - { - BLACK, DKGREEN, BROWN, GREEN, - DKRED, DKGRAY, ORANGE, YELLOW, - DKBLUE, BLUE, GRAY, AQUA, - PURPLE, LTBLUE, PINK, WHITE - }; - int i, j; - UINT16 c; - - /* 2^3 dependent pixels * 2 color sets * 2 offsets */ - m_hires_artifact_map = auto_alloc_array(machine(), UINT16, 8 * 2 * 2); - - /* 2^4 dependent pixels */ - m_dhires_artifact_map = auto_alloc_array(machine(), UINT16, 16); - - /* build hires artifact map */ - for (i = 0; i < 8; i++) - { - for (j = 0; j < 2; j++) - { - if (i & 0x02) - { - if ((i & 0x05) != 0) - c = 3; - else - c = j ? 2 : 1; - } - else - { - if ((i & 0x05) == 0x05) - c = j ? 1 : 2; - else - c = 0; - } - m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % 8]; - m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % 8]; - } - } - - /* build double hires artifact map */ - for (i = 0; i < 16; i++) - { - m_dhires_artifact_map[i] = dhires_artifact_color_table[i]; - } -} - -void laser3k_state::machine_reset() -{ - m_bank0val = 0; - m_bank1val = 1; - m_bank2val = 2; - m_bank3val = 0xf; - m_bank0->set_bank(m_bank0val); - m_bank1->set_bank(m_bank1val); - m_bank2->set_bank(m_bank2val); - m_bank3->set_bank(m_bank3val); - - // reset the 6502 here with the banking set up so we get the right vector - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - - m_flash = 0; - m_speaker_state = 0; - m_disp_page = 0; - m_bg_color = 0; - m_fg_color = 15; - m_border_color = 0; - m_strobe = 0; - m_transchar = 0; - m_lastchar = 0; - m_80col = 0; - m_mix = false; - m_gfxmode = TEXT; - - UINT8 *rom = (UINT8 *)memregion("maincpu")->base(); - - // patch out disk controller ID for now so it drops right into BASIC - rom[0x4607] = 0; -} - -READ8_MEMBER( laser3k_state::ram_r ) -{ - return m_ram->read(offset); -} - -WRITE8_MEMBER( laser3k_state::ram_w ) -{ - m_ram->write(offset, data); -} - -// most softswitches don't care about read vs write, so handle them here -void laser3k_state::do_io(int offset) -{ - switch (offset) - { - case 0x08: // set border color to black - m_border_color = 0; - break; - case 0x09: // set border color to red - m_border_color = 1; - break; - case 0x0a: // set border color to green - m_border_color = 12; - break; - case 0x0b: // set border color to yellow - m_border_color = 13; - break; - case 0x0c: // set border color to blue - m_border_color = 6; - break; - case 0x0d: // set border color to magenta - m_border_color = 3; - break; - case 0x0e: // set border color to cyan - m_border_color = 14; - break; - case 0x0f: // set border color to white - m_border_color = 15; - break; - - case 0x18: // set bg color to black - m_bg_color = 0; - break; - case 0x19: // set bg color to red - m_bg_color = 1; - break; - case 0x1a: // set bg color to green - m_bg_color = 12; - break; - case 0x1b: // set bg color to yellow - m_bg_color = 13; - break; - case 0x1c: // set bg color to blue - m_bg_color = 6; - break; - case 0x1d: // set bg color to magenta - m_bg_color = 3; - break; - case 0x1e: // set bg color to cyan - m_bg_color = 14; - break; - case 0x1f: // set bg color to white - m_bg_color = 15; - break; - - case 0x28: // set fg color to normal - m_fg_color = 15; - break; - case 0x29: // set fg color to red - m_fg_color = 1; - break; - case 0x2a: // set fg color to green - m_fg_color = 12; - break; - case 0x2b: // set fg color to yellow - m_fg_color = 13; - break; - case 0x2c: // set fg color to blue - m_fg_color = 6; - break; - case 0x2d: // set fg color to magenta - m_fg_color = 3; - break; - case 0x2e: // set fg color to cyan - m_fg_color = 14; - break; - case 0x2f: // set fg color to white - m_fg_color = 15; - break; - - case 0x30: - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - break; - - case 0x4c: // low resolution (40 column) - m_80col = false; - m_maincpu->set_unscaled_clock(1021800); - break; - - case 0x4d: // RGB mode - m_gfxmode = RGB; - break; - - case 0x4e: // double hi-res - m_80col = true; - m_gfxmode = DHIRES; - m_maincpu->set_unscaled_clock(1021800*2); - break; - - case 0x4f: // high resolution (80 column). Yes, the CPU clock also doubles when the pixel clock does (!) - m_80col = true; - m_maincpu->set_unscaled_clock(1021800*2); - break; - - case 0x50: // graphics mode - m_gfxmode = HIRES; - break; - - case 0x51: // text mode - m_gfxmode = TEXT; - break; - - case 0x52: // no mix - m_mix = false; - break; - - case 0x53: // mixed mode - m_mix = true; - break; - - case 0x54: // set page 1 - m_disp_page = 0; - break; - - case 0x55: // set page 2 - m_disp_page = 1; - break; - - case 0x56: // disable emulation (?) - break; - - default: - printf("do_io: unknown softswitch @ %x\n", offset); - break; - } -} - -READ8_MEMBER( laser3k_state::io_r ) -{ - switch (offset) - { - case 0x00: // keyboard latch - return m_transchar | m_strobe; - - case 0x10: // keyboard strobe - { - UINT8 rv = m_transchar | m_strobe; - m_strobe = 0; - return rv; - } - - case 0x7c: - return m_bank0val; - - case 0x7d: - return m_bank1val; - - case 0x7e: - return m_bank2val; - - case 0x7f: - return m_bank3val; - - default: - do_io(offset); - break; - } - - return 0xff; -} - -WRITE8_MEMBER( laser3k_state::io_w ) -{ - switch (offset) - { - case 0x10: // clear keyboard latch - m_strobe = 0; - break; - - case 0x68: // SN76489 sound - m_sn->write(space, 0, data); - break; - - case 0x78: // called "SYSTEM" in the boot ROM listing, but unsure what it does - break; - - case 0x7c: // bank 0 - m_bank0val = data & 0xf; - m_bank0->set_bank(m_bank0val); - break; - - case 0x7d: // bank 1 - m_bank1val = data & 0xf; - m_bank1->set_bank(m_bank1val); - break; - - case 0x7e: // bank 2 - m_bank2val = data & 0xf; - m_bank2->set_bank(m_bank2val); - break; - - case 0x7f: // bank 3 - m_bank3val = data & 0xf; - m_bank3->set_bank(m_bank3val); - break; - - default: - do_io(offset); - break; - } -} - -READ8_MEMBER( laser3k_state::io2_r ) -{ - switch (offset) - { - case 0xc2: // h-blank status - return space.machine().first_screen()->hblank() ? 0x80 : 0x00; - - case 0xc3: // v-blank status - return space.machine().first_screen()->vblank() ? 0x80 : 0x00; - - case 0xc5: // CPU 1/2 MHz status? - return 0x00; - - default: - printf("io2_r @ unknown %x\n", offset); - break; - } - - return 0xff; -} - -void laser3k_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, - const UINT8 *textgfx_data, UINT32 textgfx_datalen) -{ - int x, y, i; - int fg = m_fg_color; - int bg = m_bg_color; - const UINT8 *chardata; - UINT16 color; - - /* look up the character data */ - chardata = &textgfx_data[(code * 8) % textgfx_datalen]; - - if (m_flash && (code >= 0x40) && (code <= 0x7f)) - { - /* we're flashing; swap */ - i = fg; - fg = bg; - bg = i; - } - - for (y = 0; y < 8; y++) - { - for (x = 0; x < 7; x++) - { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; - - for (i = 0; i < xscale; i++) - { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; - } - } - } -} - -void laser3k_state::text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - int row, col; - UINT32 start_address; - UINT32 address; - UINT8 *m_a2_videoram = m_ram->pointer(); - - if (m_80col) - { - start_address = (m_disp_page == 0) ? 0x1000 : 0x1800; - } - else - { - start_address = (m_disp_page == 0) ? 0x400 : 0x800; - } - - m_flash = ((machine().time() * 4).seconds() & 1) ? 1 : 0; - - beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - - for (row = beginrow; row <= endrow; row += 8) - { - if (m_80col) - { - for (col = 0; col < 40; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - - plot_text_character(bitmap, col * 7, row, 1, m_a2_videoram[address], - memregion("gfx1")->base(), memregion("gfx1")->bytes()); - plot_text_character(bitmap, (col + 40) * 7, row, 1, m_a2_videoram[address+0x400], - memregion("gfx1")->base(), memregion("gfx1")->bytes()); - } - } - else - { - for (col = 0; col < 40; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character(bitmap, col * 14, row, 2, m_a2_videoram[address], - memregion("gfx1")->base(), memregion("gfx1")->bytes()); - } - } - } -} - -void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - const UINT8 *vram; - int row, col, b; - int offset; - UINT8 vram_row[42] ; - UINT16 v; - UINT16 *p; - UINT32 w; - UINT16 *artifact_map_ptr; - - /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; - if (endrow < beginrow) - return; - - vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); - - vram_row[0] = 0; - vram_row[41] = 0; - - for (row = beginrow; row <= endrow; row++) - { - for (col = 0; col < 40; col++) - { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); - vram_row[1+col] = vram[offset]; - } - - p = &bitmap.pix16(row); - - for (col = 0; col < 40; col++) - { - w = (((UINT32) vram_row[col+0] & 0x7f) << 0) - | (((UINT32) vram_row[col+1] & 0x7f) << 7) - | (((UINT32) vram_row[col+2] & 0x7f) << 14); - - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) - { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; - *(p++) = v; - *(p++) = v; - } - } - } -} - -void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - const UINT8 *vram; - int row, col, b; - int offset; - UINT8 vram_row[82]; - UINT16 v; - UINT16 *p; - UINT32 w; - - /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; - if (endrow < beginrow) - return; - - vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); - - vram_row[0] = 0; - vram_row[81] = 0; - - for (row = beginrow; row <= endrow; row++) - { - for (col = 0; col < 40; col++) - { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); - if (col < 40) - { - vram_row[1+(col*2)+0] = vram[offset]; - vram_row[1+(col*2)+1] = vram[offset+1]; - } - else - { - vram_row[1+(col*2)+0] = vram[offset+0x2000]; - vram_row[1+(col*2)+1] = vram[offset+0x2001]; - } - } - - p = &bitmap.pix16(row); - - for (col = 0; col < 80; col++) - { - w = (((UINT32) vram_row[col+0] & 0x7f) << 0) - | (((UINT32) vram_row[col+1] & 0x7f) << 7) - | (((UINT32) vram_row[col+2] & 0x7f) << 14); - - for (b = 0; b < 7; b++) - { - v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; - *(p++) = v; - } - } - } -} - -UINT32 laser3k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - switch (m_gfxmode) - { - case TEXT: - text_update(screen, bitmap, cliprect, 0, 191); - break; - - case HIRES: - if (m_mix) - { - hgr_update(screen, bitmap, cliprect, 0, 159); - text_update(screen, bitmap, cliprect, 160, 191); - } - else - { - hgr_update(screen, bitmap, cliprect, 0, 191); - } - break; - - case RGB: - break; - - case DHIRES: - if (m_mix) - { - dhgr_update(screen, bitmap, cliprect, 0, 159); - text_update(screen, bitmap, cliprect, 160, 191); - } - else - { - dhgr_update(screen, bitmap, cliprect, 0, 191); - } - break; - } - - return 0; -} - -READ_LINE_MEMBER(laser3k_state::ay3600_shift_r) -{ - // either shift key - if (m_kbspecial->read() & 0x06) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -READ_LINE_MEMBER(laser3k_state::ay3600_control_r) -{ - if (m_kbspecial->read() & 0x08) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -static const UINT8 key_remap[0x32][4] = -{ -/* norm shft ctrl both */ - { 0x33,0x23,0x33,0x23 }, /* 3 # 00 */ - { 0x34,0x24,0x34,0x24 }, /* 4 $ 01 */ - { 0x35,0x25,0x35,0x25 }, /* 5 % 02 */ - { 0x36,0x5e,0x35,0x53 }, /* 6 ^ 03 */ - { 0x37,0x26,0x37,0x26 }, /* 7 & 04 */ - { 0x38,0x2a,0x38,0x2a }, /* 8 * 05 */ - { 0x39,0x28,0x39,0x28 }, /* 9 ( 06 */ - { 0x30,0x29,0x30,0x29 }, /* 0 ) 07 */ - { 0x3b,0x3a,0x3b,0x3a }, /* ; : 08 */ - { 0x2d,0x5f,0x2d,0x1f }, /* - _ 09 */ - { 0x51,0x51,0x11,0x11 }, /* q Q 0a */ - { 0x57,0x57,0x17,0x17 }, /* w W 0b */ - { 0x45,0x45,0x05,0x05 }, /* e E 0c */ - { 0x52,0x52,0x12,0x12 }, /* r R 0d */ - { 0x54,0x54,0x14,0x14 }, /* t T 0e */ - { 0x59,0x59,0x19,0x19 }, /* y Y 0f */ - { 0x55,0x55,0x15,0x15 }, /* u U 10 */ - { 0x49,0x49,0x09,0x09 }, /* i I 11 */ - { 0x4f,0x4f,0x0f,0x0f }, /* o O 12 */ - { 0x50,0x50,0x10,0x10 }, /* p P 13 */ - { 0x44,0x44,0x04,0x04 }, /* d D 14 */ - { 0x46,0x46,0x06,0x06 }, /* f F 15 */ - { 0x47,0x47,0x07,0x07 }, /* g G 16 */ - { 0x48,0x48,0x08,0x08 }, /* h H 17 */ - { 0x4a,0x4a,0x0a,0x0a }, /* j J 18 */ - { 0x4b,0x4b,0x0b,0x0b }, /* k K 19 */ - { 0x4c,0x4c,0x0c,0x0c }, /* l L 1a */ - { 0x3d,0x2b,0x3d,0x2b }, /* = + 1b */ - { 0x08,0x08,0x08,0x08 }, /* Left 1c */ - { 0x15,0x15,0x15,0x15 }, /* Right 1d */ - { 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */ - { 0x58,0x58,0x18,0x18 }, /* x X 1f */ - { 0x43,0x43,0x03,0x03 }, /* c C 20 */ - { 0x56,0x56,0x16,0x16 }, /* v V 21 */ - { 0x42,0x42,0x02,0x02 }, /* b B 22 */ - { 0x4e,0x4e,0x0e,0x0e }, /* n N 23 */ - { 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */ - { 0x2c,0x3c,0x2c,0x3c }, /* , < 25 */ - { 0x2e,0x3e,0x2e,0x3e }, /* . > 26 */ - { 0x2f,0x3f,0x2f,0x3f }, /* / ? 27 */ - { 0x53,0x53,0x13,0x13 }, /* s S 28 */ - { 0x32,0x40,0x32,0x00 }, /* 2 @ 29 */ - { 0x31,0x21,0x31,0x31 }, /* 1 ! 2a */ - { 0x9b,0x9b,0x9b,0x9b }, /* Escape 2b */ - { 0x41,0x41,0x01,0x01 }, /* a A 2c */ - { 0x20,0x20,0x20,0x20 }, /* Space 2d */ - { 0x27,0x22,0x27,0x22 }, /* ' " 2e */ - { 0x00,0x00,0x00,0x00 }, /* 0x2f unused */ - { 0x00,0x00,0x00,0x00 }, /* 0x30 unused */ - { 0x0d,0x0d,0x0d,0x0d }, /* Enter 31 */ -}; - -WRITE_LINE_MEMBER(laser3k_state::ay3600_data_ready_w) -{ - if (state == ASSERT_LINE) - { - int mod = 0; - m_lastchar = m_ay3600->b_r(); - - mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; - mod |= (m_kbspecial->read() & 0x08) ? 0x02 : 0x00; - -// printf("lastchar = %02x\n", m_lastchar & 0x3f); - - m_transchar = key_remap[m_lastchar&0x3f][mod]; - - if (m_transchar != 0) - { - m_strobe = 0x80; -// printf("new char = %04x (%02x)\n", m_lastchar&0x3f, m_transchar); - } - } -} - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( laser3k ) - PORT_START("X0") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - - PORT_START("X1") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - - PORT_START("X2") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - - PORT_START("X3") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("X4") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("X5") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("X6") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("X7") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("X8") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyb_special") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) -INPUT_PORTS_END - -// this is an apple II palette; it seems more likely the -// actual laser3000 has a digital RGB palette... -static const rgb_t laser3k_palette[] = -{ - rgb_t::black, - rgb_t(0xE3, 0x1E, 0x60), /* Dark Red */ - rgb_t(0x60, 0x4E, 0xBD), /* Dark Blue */ - rgb_t(0xFF, 0x44, 0xFD), /* Purple */ - rgb_t(0x00, 0xA3, 0x60), /* Dark Green */ - rgb_t(0x9C, 0x9C, 0x9C), /* Dark Gray */ - rgb_t(0x14, 0xCF, 0xFD), /* Medium Blue */ - rgb_t(0xD0, 0xC3, 0xFF), /* Light Blue */ - rgb_t(0x60, 0x72, 0x03), /* Brown */ - rgb_t(0xFF, 0x6A, 0x3C), /* Orange */ - rgb_t(0x9C, 0x9C, 0x9C), /* Light Grey */ - rgb_t(0xFF, 0xA0, 0xD0), /* Pink */ - rgb_t(0x14, 0xF5, 0x3C), /* Light Green */ - rgb_t(0xD0, 0xDD, 0x8D), /* Yellow */ - rgb_t(0x72, 0xFF, 0xD0), /* Aquamarine */ - rgb_t(0xFF, 0xFF, 0xFF) /* White */ -}; - -/* Initialize the palette */ -PALETTE_INIT_MEMBER(laser3k_state, laser3k) -{ - palette.set_pen_colors(0, laser3k_palette, ARRAY_LENGTH(laser3k_palette)); -} - -static MACHINE_CONFIG_START( laser3k, laser3k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 1021800) - MCFG_CPU_PROGRAM_MAP(laser3k_map) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(300*2, 192) - MCFG_SCREEN_VISIBLE_AREA(0, (280*2)-1,0,192-1) - MCFG_SCREEN_UPDATE_DRIVER(laser3k_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(laser3k_palette)) - MCFG_PALETTE_INIT_OWNER(laser3k_state, laser3k) - - /* memory banking */ - MCFG_DEVICE_ADD("bank0", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(banks_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(banks_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - MCFG_DEVICE_ADD("bank2", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(banks_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - MCFG_DEVICE_ADD("bank3", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(banks_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_RAM_ADD("mainram") - MCFG_RAM_DEFAULT_SIZE("192K") - - /* the 8048 isn't dumped, so substitute modified real Apple II h/w */ - MCFG_DEVICE_ADD("ay3600", AY3600, 0) - MCFG_AY3600_MATRIX_X0(IOPORT("X0")) - MCFG_AY3600_MATRIX_X1(IOPORT("X1")) - MCFG_AY3600_MATRIX_X2(IOPORT("X2")) - MCFG_AY3600_MATRIX_X3(IOPORT("X3")) - MCFG_AY3600_MATRIX_X4(IOPORT("X4")) - MCFG_AY3600_MATRIX_X5(IOPORT("X5")) - MCFG_AY3600_MATRIX_X6(IOPORT("X6")) - MCFG_AY3600_MATRIX_X7(IOPORT("X7")) - MCFG_AY3600_MATRIX_X8(IOPORT("X8")) - MCFG_AY3600_SHIFT_CB(READLINE(laser3k_state, ay3600_shift_r)) - MCFG_AY3600_CONTROL_CB(READLINE(laser3k_state, ay3600_control_r)) - MCFG_AY3600_DATA_READY_CB(WRITELINE(laser3k_state, ay3600_data_ready_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_ADD("sn76489", SN76489, 1020484) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - -ROM_START(las3000) - ROM_REGION(0x0800,"gfx1",0) - ROM_LOAD ( "341-0036.chr", 0x0000, 0x0800, CRC(64f415c6) SHA1(f9d312f128c9557d9d6ac03bfad6c3ddf83e5659)) - - ROM_REGION(0x8000, "maincpu", 0) - ROM_LOAD ( "las3000.rom", 0x0000, 0x8000, CRC(9c7aeb09) SHA1(3302adf41e258cf50210c19736948c8fa65e91de)) - - ROM_REGION(0x100, "fdc", 0) - ROM_LOAD ( "l3kdisk.rom", 0x0000, 0x0100, CRC(2d4b1584) SHA1(989780b77e100598124df7b72663e5a31a3339c0)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1983, las3000, 0, 0, laser3k, laser3k, driver_device, 0, "Video Technology", "Laser 3000", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/lc80.c b/src/mess/drivers/lc80.c deleted file mode 100644 index 046bd69af0e..00000000000 --- a/src/mess/drivers/lc80.c +++ /dev/null @@ -1,441 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - LC-80 - - 12/05/2009 Skeleton driver. - - When first started, the screen is blank. Wait about 8 seconds for - it to introduce itself, then you may use it or paste to it. - The decimal points indicate which side of the display you will - be updating. - - Pasting: - 0-F : as is - + (inc) : ^ - - (dec) : V - ADR : - - DAT : = - GO : X - - Test Paste: (lc80_2 only) - -2000=11^22^33^44^55^66^77^88^99^-2000 - Now press up-arrow to confirm the data has been entered. - - - ToDo: - - Most characters are lost when pasting (lc80, sc80). - -****************************************************************************/ - -/* - - TODO: - - - HALT led - - KSD11 switch - - banking for ROM 4-5 - - Schachcomputer SC-80 - - CTC clock inputs - -*/ - -#include "includes/lc80.h" -#include "lc80.lh" - -/* Memory Maps */ - -static ADDRESS_MAP_START( lc80_mem, AS_PROGRAM, 8, lc80_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3fff) - AM_RANGE(0x0000, 0x07ff) AM_ROMBANK("bank1") - AM_RANGE(0x0800, 0x0fff) AM_ROMBANK("bank2") - AM_RANGE(0x1000, 0x17ff) AM_ROMBANK("bank3") - AM_RANGE(0x2000, 0x23ff) AM_RAM - AM_RANGE(0x2400, 0x2fff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -#if 0 -static ADDRESS_MAP_START( sc80_mem, AS_PROGRAM, 8, lc80_state ) - AM_IMPORT_FROM(lc80_mem) - AM_RANGE(0xc000, 0xcfff) AM_ROM -ADDRESS_MAP_END -#endif - -static ADDRESS_MAP_START( lc80_io, AS_IO, 8, lc80_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1f) - AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_device, read, write) - AM_RANGE(0xf8, 0xfb) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_device, read, write) - AM_RANGE(0xec, 0xef) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( lc80_state::trigger_reset ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER( lc80_state::trigger_nmi ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - -static INPUT_PORTS_START( lc80 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LD") PORT_CODE(KEYCODE_L) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ST") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DAT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EX") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ADR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RES") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, lc80_state, trigger_reset, 0) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NMI") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, lc80_state, trigger_nmi, 0) -INPUT_PORTS_END - -/* Z80-CTC Interface */ - -WRITE_LINE_MEMBER( lc80_state::ctc_z0_w ) -{ -} - -WRITE_LINE_MEMBER( lc80_state::ctc_z1_w ) -{ -} - -WRITE_LINE_MEMBER( lc80_state::ctc_z2_w ) -{ -} - -/* Z80-PIO Interface */ - -void lc80_state::update_display() -{ - int i; - - for (i = 0; i < 6; i++) - { - if (!BIT(m_digit, i)) output_set_digit_value(5 - i, m_segment); - } -} - -WRITE8_MEMBER( lc80_state::pio1_pa_w ) -{ - /* - - bit description - - PA0 VQE23 segment B - PA1 VQE23 segment F - PA2 VQE23 segment A - PA3 VQE23 segment G - PA4 VQE23 segment DP - PA5 VQE23 segment C - PA6 VQE23 segment E - PA7 VQE23 segment D - - */ - - m_segment = BITSWAP8(~data, 4, 3, 1, 6, 7, 5, 0, 2); - - update_display(); -} - -READ8_MEMBER( lc80_state::pio1_pb_r ) -{ - /* - - bit description - - PB0 tape input - PB1 tape output - PB2 digit 0 - PB3 digit 1 - PB4 digit 2 - PB5 digit 3 - PB6 digit 4 - PB7 digit 5 - - */ - - return (m_cassette->input() < +0.0); -} - -WRITE8_MEMBER( lc80_state::pio1_pb_w ) -{ - /* - - bit description - - PB0 tape input - PB1 tape output, speaker output, OUT led - PB2 digit 0 - PB3 digit 1 - PB4 digit 2 - PB5 digit 3 - PB6 digit 4 - PB7 digit 5 - - */ - - /* tape output */ - m_cassette->output( BIT(data, 1) ? +1.0 : -1.0); - - /* speaker */ - m_speaker->level_w(!BIT(data, 1)); - - /* OUT led */ - output_set_led_value(0, !BIT(data, 1)); - - /* keyboard */ - m_digit = data >> 2; - - /* display */ - update_display(); -} - -READ8_MEMBER( lc80_state::pio2_pb_r ) -{ - /* - - bit description - - PB0 - PB1 - PB2 - PB3 - PB4 key row 0 - PB5 key row 1 - PB6 key row 2 - PB7 key row 3 - - */ - - UINT8 data = 0xf0; - int i; - - for (i = 0; i < 6; i++) - { - if (!BIT(m_digit, i)) - { - if (!BIT(m_y0->read(), i)) data &= ~0x10; - if (!BIT(m_y1->read(), i)) data &= ~0x20; - if (!BIT(m_y2->read(), i)) data &= ~0x40; - if (!BIT(m_y3->read(), i)) data &= ~0x80; - } - } - - return data; -} - -#if 0 -/* Z80 Daisy Chain */ - -static const z80_daisy_config lc80_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80PIO2_TAG }, - { Z80PIO1_TAG }, - { NULL } -}; -#endif - -/* Machine Initialization */ - -void lc80_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - UINT8 *ROM = memregion(Z80_TAG)->base(); - - /* setup memory banking */ - membank("bank1")->configure_entry(0, &ROM[0]); // TODO - membank("bank1")->configure_entry(1, &ROM[0]); - membank("bank1")->set_entry(1); - - membank("bank2")->configure_entry(0, &ROM[0x800]); // TODO - membank("bank2")->configure_entry(1, &ROM[0x800]); - membank("bank2")->set_entry(1); - - membank("bank3")->configure_entry(0, &ROM[0x1000]); // TODO - membank("bank3")->configure_entry(1, &ROM[0x1000]); - membank("bank3")->set_entry(1); - - membank("bank4")->configure_entry(0, &ROM[0x2000]); - membank("bank4")->set_entry(0); - - program.install_readwrite_bank(0x0000, 0x07ff, "bank1"); - program.install_readwrite_bank(0x0800, 0x0fff, "bank2"); - program.install_readwrite_bank(0x1000, 0x17ff, "bank3"); - - switch (m_ram->size()) - { - case 1*1024: - program.install_readwrite_bank(0x2000, 0x23ff, "bank4"); - program.unmap_readwrite(0x2400, 0x2fff); - break; - - case 2*1024: - program.install_readwrite_bank(0x2000, 0x27ff, "bank4"); - program.unmap_readwrite(0x2800, 0x2fff); - break; - - case 3*1024: - program.install_readwrite_bank(0x2000, 0x2bff, "bank4"); - program.unmap_readwrite(0x2c00, 0x2fff); - break; - - case 4*1024: - program.install_readwrite_bank(0x2000, 0x2fff, "bank4"); - break; - } - - /* register for state saving */ - save_item(NAME(m_digit)); - save_item(NAME(m_segment)); -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( lc80, lc80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 900000) /* UD880D */ - MCFG_CPU_PROGRAM_MAP(lc80_mem) - MCFG_CPU_IO_MAP(lc80_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_lc80 ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 900000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(lc80_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(lc80_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(lc80_state, ctc_z2_w)) - - MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, 900000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(lc80_state, pio1_pa_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(lc80_state, pio1_pb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(lc80_state, pio1_pb_w)) - - MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, 900000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PB_CB(READ8(lc80_state, pio2_pb_r)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") - MCFG_RAM_EXTRA_OPTIONS("2K,3K,4K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( lc80_2, lc80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 1800000) /* UD880D */ - MCFG_CPU_PROGRAM_MAP(lc80_mem) - MCFG_CPU_IO_MAP(lc80_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_lc80 ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 900000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(lc80_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(lc80_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(lc80_state, ctc_z2_w)) - - MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, 900000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(lc80_state, pio1_pa_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(lc80_state, pio1_pb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(lc80_state, pio1_pb_w)) - - MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, 900000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PB_CB(READ8(lc80_state, pio2_pb_r)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") -MACHINE_CONFIG_END - -#if 0 -static MACHINE_CONFIG_DERIVED( sc80, lc80_2 ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY(Z80_TAG) - MCFG_CPU_PROGRAM_MAP(sc80_mem) -MACHINE_CONFIG_END -#endif - -/* ROMs */ - -ROM_START( lc80 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "u505", "LC 80 (2x U505)" ) - ROMX_LOAD( "lc80.d202", 0x0000, 0x0400, CRC(e754ef53) SHA1(044440b13e62addbc3f6a77369cfd16f99b39752), ROM_BIOS(1) ) - ROMX_LOAD( "lc80.d203", 0x0800, 0x0400, CRC(2b544da1) SHA1(3a6cbd0c57c38eadb7055dca4b396c348567d1d5), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "2716", "LC 80 (2716)" ) - ROMX_LOAD( "lc80_2716.bin", 0x0000, 0x0800, CRC(b3025934) SHA1(6fff953f0f1eee829fd774366313ab7e8053468c), ROM_BIOS(2)) -ROM_END - -ROM_START( lc80_2 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "lc80_2.bin", 0x0000, 0x1000, CRC(2e06d768) SHA1(d9cddaf847831e4ab21854c0f895348b7fda20b8) ) -ROM_END - -ROM_START( sc80 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "lc80e-0000-schach.rom", 0x0000, 0x1000, CRC(e3cca61d) SHA1(f2be3f2a9d3780d59657e49b3abeffb0fc13db89) ) - ROM_LOAD( "lc80e-1000-schach.rom", 0x1000, 0x1000, CRC(b0323160) SHA1(0ea019b0944736ae5b842bf9aa3537300f259b98) ) - ROM_LOAD( "lc80e-c000-schach.rom", 0xc000, 0x1000, CRC(9c858d9c) SHA1(2f7b3fd046c965185606253f6cd9372da289ca6f) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, lc80, 0, 0, lc80, lc80, driver_device, 0, "VEB Mikroelektronik", "Lerncomputer LC 80", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, lc80_2, lc80, 0, lc80_2, lc80, driver_device, 0, "VEB Mikroelektronik", "Lerncomputer LC 80.2", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, sc80, lc80, 0, lc80_2, lc80, driver_device, 0, "VEB Mikroelektronik", "Schachcomputer SC-80", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/lcmate2.c b/src/mess/drivers/lcmate2.c deleted file mode 100644 index b4ef3350601..00000000000 --- a/src/mess/drivers/lcmate2.c +++ /dev/null @@ -1,268 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco, Robbbert -/*************************************************************************** - - Laser Compumate2 - - 17/04/2011 Initial driver by Robbbert, using info supplied by - DMEnduro. He owns one of these machines. - 21/04/2011 Hooked up the lcd controller and added keyboard - input. [Sandro Ronco] - 22/04/2011 Small adjustments resulting from team investigations. - - Chips: Z80 CPU, 8K of RAM, 32K ROM, 'VTCL', '8826KX', - RP5C15 RTC. - - Display: 2 lines of 20 characters LCD. - - There are no devices for file saving or loading, is more of - a PDA format with all programs (address book, etc) in the ROM. - - Sound: a piezo speaker. - - ToDo: - - RTC doesn't remember the time - - Alarm doesn't work - - Reset/On button to be added - - The ROM has INT and NMI code; investigate if something uses it. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/rp5c15.h" -#include "machine/nvram.h" -#include "video/hd44780.h" -#include "sound/speaker.h" -#include "rendlay.h" - - -class lcmate2_state : public driver_device -{ -public: - lcmate2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_lcdc(*this, "hd44780"), - m_rtc(*this, "rtc"), - m_speaker(*this, "speaker") - { } - - required_device m_maincpu; - required_device m_lcdc; - required_device m_rtc; - required_device m_speaker; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( key_r ); - DECLARE_WRITE8_MEMBER( speaker_w ); - DECLARE_WRITE8_MEMBER( bankswitch_w ); - DECLARE_PALETTE_INIT(lcmate2); -}; - -WRITE8_MEMBER( lcmate2_state::speaker_w ) -{ - m_speaker->level_w(BIT(data, 6)); -} - -// offsets are FE,FD,FB,F7,EF,DF,BF,7F to scan a particular row, or 00 to check if any key pressed -READ8_MEMBER( lcmate2_state::key_r ) -{ - UINT8 i,data = 0xff; - char kbdrow[8]; - - for (i=0; i<8; i++) - { - if (BIT(offset, i)==0) - { - sprintf(kbdrow,"LINE%d", i); - data &= ioport(kbdrow)->read(); - } - } - - return data; -} - -WRITE8_MEMBER( lcmate2_state::bankswitch_w ) -{ - membank("rombank")->set_entry(data&0x0f); -} - -static ADDRESS_MAP_START(lcmate2_mem, AS_PROGRAM, 8, lcmate2_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x3fff ) AM_ROM - AM_RANGE( 0x4000, 0x7fff ) AM_ROMBANK("rombank") - AM_RANGE( 0x8000, 0x9fff ) AM_RAM AM_MIRROR(0x6000) AM_SHARE("nvram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(lcmate2_io, AS_IO, 8, lcmate2_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("rtc", rp5c15_device, read, write) - AM_RANGE(0x1000, 0x1000) AM_WRITE(speaker_w) - AM_RANGE(0x1fff, 0x1fff) AM_WRITE(bankswitch_w) - - AM_RANGE(0x3000, 0x3000) AM_DEVWRITE("hd44780", hd44780_device, control_write) - AM_RANGE(0x3001, 0x3001) AM_DEVWRITE("hd44780", hd44780_device, data_write) - AM_RANGE(0x3002, 0x3002) AM_DEVREAD("hd44780", hd44780_device, control_read) - AM_RANGE(0x3003, 0x3003) AM_DEVREAD("hd44780", hd44780_device, data_read) - - AM_RANGE(0x5000, 0x50ff) AM_READ(key_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( lcmate2 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('/') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('?') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLOck") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED -INPUT_PORTS_END - -PALETTE_INIT_MEMBER(lcmate2_state, lcmate2) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -void lcmate2_state::machine_start() -{ - membank("rombank")->configure_entries(0, 0x10, (UINT8*)memregion("maincpu")->base(), 0x4000); -} - -static const gfx_layout lcmate2_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( lcmate2 ) - GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, lcmate2_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( lcmate2, lcmate2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz) // confirmed - MCFG_CPU_PROGRAM_MAP(lcmate2_mem) - MCFG_CPU_IO_MAP(lcmate2_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_SIZE(120, 18) - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(lcmate2_state, lcmate2) - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", lcmate2) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 20) - - MCFG_NVRAM_ADD_0FILL("nvram") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("rtc", RP5C15, XTAL_32_768kHz) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( lcmate2 ) - ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "u2.bin", 0x00000, 0x08000, CRC(521931b9) SHA1(743a6e2928c4365fbf5ed9a173e2c1bfe695850f) ) - ROM_LOAD( "u3.bin", 0x20000, 0x20000, CRC(84fe767a) SHA1(8dd306f203e1220f0eab1a284be3095e2642c5b6) ) // spell library -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, lcmate2, 0, 0, lcmate2, lcmate2, driver_device, 0, "Vtech", "Laser Compumate 2", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/leapster.c b/src/mess/drivers/leapster.c deleted file mode 100644 index 3a569ed71d2..00000000000 --- a/src/mess/drivers/leapster.c +++ /dev/null @@ -1,340 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -/* - LeapFrog - Leapster - - educational system from 2003, software is all developed in MXFlash - - hwspecs - - - CPU: - Custom ASIC (ARCTangent 5.1 CPU @ 96MHz) - - Memory: - Leapster: 2MB onboard RAM, 256 bytes NVRAM. - Leapster2: 16MB RAM, 128kbytes NVRAM - - Media type: - Cartridges of 4-16MB with between 2 and 512kb NVRAM - - Graphics: - 4Mb ATI chip. - - Audio: - Custom - - Screen: - 160x160 CSTN with touchscreen. - - - The Leapster 2 also has - USB 1.1 (client only) + full-sized SD slot. - -*/ - -/* Cartridge pinout - for games list see hash/leapster.xml - -CARTRIDGE-PINOUT: ------------------ -Look at the Cartridge-Slot: - - B A - ------------ - VCC |01| VCC - NC |02| VSS - D11 |03| D04 - D03 |04| D12 - D10 |05| D05 - VSS |06| D02 - D13 |07| D09 - NC |08| NC - D06 |09| D01 - D14 |10| D08 - ----|--|---- - D07 |11| VSS - D00 |12| D15 - Byte |13| OE - NC |14| A22 - NC |15| A23 - CE |16| A16 - A00 |17| A15 - A01 |18| A14 - A02 |19| A13 - VSS |20| A03 - A12 |21| A04 - A11 |22| A05 - A10 |23| A06 - A09 |24| A07 - A08 |25| A17 - A19 |26| A18 - A20 |27| A21 - WE |28| VSS -PIN7 of 24LC02B <---| |29| |---> PIN7 of 24LC02B - NC |30| |---> PIN6 of 24LC02B - ---------- - - - - -PCB - Handheld-Console: - - +-----------------------------+ - | | - +------------| |------------+ - | | C A R T R I D G E - S L O T | | - | | | | - | +-----------------------------+ | - | | - |ASY 310-10069 +-------------------+ | - | | | | - | | | | - |LEAPSTER MAIN | | | - |Leap Frog | U3| | - |(c) 2004 +-------------------+ +-----+ | - | |ISSI | | - | | | | - | +---------+ |IS42S| | - | | | |16100| | - \ +-+ | EPOXY | |AT-7T| / - \ |A| | BLOCK | | | / - \ +-+ | | | U2| / - \ | U1| +-----+ / - \ +---------+ / - \ / - \ / - \ / - \ / - \ / - \ / - \ / - \ / - \ / - \-------------------------/ - - -A = 24LC02B / SN0429 - - - - -ETCHES ON THE BACK OF THE PCB: - -"FAB-300-10069-C" - -"702800254.01A" -"SW1208 Rev.5" - - - - - - - - -PCB - Cartridge: -FRONT: - -+-------------------------------------+ -| LEAPSTER ROM CARTRIDGE | -| +--+ +---------+ Leap Frog | -| |B1|U2 | | (c) 2003 | -+-+ +--+ |E P O X Y| +-+ - | | U3| | -+-+ +---------+ +-+ -| 20232-003-1020| -| ASY 310-10028 REV:00 | -+-+ +-+ +-+ - |||||||||||||||||||||| |||||||||||| - +--------------------+ +----------+ - A30 A01 - -B1: 24L002B - - - - -24L002B: - - +-----+ - (GND)<- A0-| |-VCC - (GND)<- A1-| |-WP - (GND)<- A2-| |-SCL - VSS-| |-SDA - +-----+ - - - - - -PCB - LEAPSTER-TV: - - - -+-----------------------------------------------------------------------+ -| | -| | -| 20300+003+0015 | - \ REV:06 / - | | - | | - | +----+ +-------+ | - \ | | | EPOXY | / - | +----+ | | | | | - | |EPOX| | | | | | - | |Y | | | | U1| +-+ | - \ +----+ | | +-------+ | | / - | | U2| +-+U4 | - | +----+ | - | +--------------+ ROADRUNNER CONSOLE | - \ | AM29PL160CB | Leap Frog (c) 2006/ - | | -90SF | Asy 310-10378 | - | | U6| | - | +--------------+ | - \ / - | +-----------------------------+ | - | | C A R T R I D G E - S L O T | | - | +-----------------------------+ | - \ / - +-----------------------------------------------+ - - - - - - - -*/ - -#include "emu.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "cpu/arcompact/arcompact.h" - - -class leapster_state : public driver_device -{ -public: - leapster_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot") - { } - - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update_leapster(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(leapster_cart); - DECLARE_DRIVER_INIT(leapster); - - DECLARE_READ32_MEMBER(leapster_random_r) - { - return rand() | (rand()<<16); // there is a loop checking that this is above a certain value - } - - DECLARE_WRITE32_MEMBER(leapster_aux004b_w) - { - printf("leapster_aux004b_w %04x\n", data); - } - -protected: - required_device m_maincpu; - required_device m_cart; - - memory_region *m_cart_rom; -}; - - - - -static INPUT_PORTS_START( leapster ) -INPUT_PORTS_END - - - -UINT32 leapster_state::screen_update_leapster(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -DEVICE_IMAGE_LOAD_MEMBER( leapster_state, leapster_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - m_cart->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -void leapster_state::machine_start() -{ - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - if (m_cart_rom) - { - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.install_readwrite_bank(0x80000000, 0x807fffff, "cartrom"); - membank("cartrom")->set_base(m_cart_rom->base()); - } -} - -void leapster_state::machine_reset() -{ -} - -static ADDRESS_MAP_START( leapster_map, AS_PROGRAM, 32, leapster_state ) - AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_MIRROR(0x40000000) // pointers in the bios region seem to be to the 40xxxxxx region, either we mirror there or something (real bios?) is acutally missing - AM_RANGE(0x0180D800, 0x0180D803) AM_READ(leapster_random_r) - AM_RANGE(0x03000000, 0x030007ff) AM_RAM // puts stack here, writes a pointer @ 0x03000000 on startup - AM_RANGE(0x3c000000, 0x3c1fffff) AM_RAM // really ram, or has our code execution gone wrong? -// AM_RANGE(0x80000000, 0x807fffff) AM_ROMBANK("cartrom") // game ROM pointers are all to the 80xxxxxx region, so I assume it maps here - installed if a cart is present -ADDRESS_MAP_END - -static ADDRESS_MAP_START( leapster_aux, AS_IO, 32, leapster_state ) - AM_RANGE(0x00000012c, 0x00000012f) AM_WRITE(leapster_aux004b_w) // this address isn't used by ARC internal stuff afaik, so probably leapster specific -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( leapster, leapster_state ) - /* basic machine hardware */ - // CPU is ArcTangent-A5 '5.1' (ARCompact core) - MCFG_CPU_ADD("maincpu", ARCA5, 96000000/10) - MCFG_CPU_PROGRAM_MAP(leapster_map) - MCFG_CPU_IO_MAP(leapster_aux) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(160, 160) - MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 160-1) - MCFG_SCREEN_UPDATE_DRIVER(leapster_state, screen_update_leapster) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "leapster_cart") - MCFG_GENERIC_EXTENSIONS("bin") - MCFG_GENERIC_LOAD(leapster_state, leapster_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "leapster") -MACHINE_CONFIG_END - -ROM_START(leapster) - ROM_REGION(0x200000, "maincpu", ROMREGION_ERASE00) - ROM_LOAD( "155-10072-a.bin", 0x00000, 0x200000, CRC(af05e5a0) SHA1(d4468d060543ba7e44785041093bc98bcd9afa07) ) -ROM_END - -ROM_START(leapstertv) - ROM_REGION(0x200000, "maincpu", ROMREGION_ERASE00) - ROM_LOAD( "am29pl160cb-90sf.bin", 0x00000, 0x200000, BAD_DUMP CRC(dc281f1f) SHA1(17588de54ab3bb82801bd5062f3e6aa687412178) ) -ROM_END - -DRIVER_INIT_MEMBER(leapster_state,leapster) -{ -} - -CONS(2003, leapster, 0, 0, leapster, leapster, leapster_state, leapster, "LeapFrog", "Leapster (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IS_SKELETON ) -CONS(2005, leapstertv, leapster, 0, leapster, leapster, leapster_state, leapster, "LeapFrog", "Leapster TV (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/lft.c b/src/mess/drivers/lft.c deleted file mode 100644 index 2034ec9219d..00000000000 --- a/src/mess/drivers/lft.c +++ /dev/null @@ -1,117 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -2013-09-09 Skeleton of LFT computer system. A search on the net produces - no finds. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i186.h" -#include "machine/terminal.h" - - -class lft_state : public driver_device -{ -public: - lft_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_terminal(*this, "terminal") - {} - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE16_MEMBER(term_w); - DECLARE_READ16_MEMBER(keyin_r); - DECLARE_READ16_MEMBER(status_r); - -private: - UINT8 m_term_data; - virtual void machine_reset(); - required_device m_maincpu; - required_device m_terminal; -}; - -static ADDRESS_MAP_START(lft_mem, AS_PROGRAM, 16, lft_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x5ffff) AM_RAM - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("roms", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(lft_io, AS_IO, 16, lft_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // screen 1 - AM_RANGE(0x00, 0x01) AM_READNOP - AM_RANGE(0x04, 0x05) AM_READWRITE(keyin_r,term_w) - // screen 2 - AM_RANGE(0x02, 0x03) AM_READNOP - AM_RANGE(0x06, 0x07) AM_WRITENOP -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( lft ) -INPUT_PORTS_END - -READ16_MEMBER( lft_state::keyin_r ) -{ - UINT16 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ16_MEMBER( lft_state::status_r ) -{ - return (m_term_data) ? 5 : 4; -} - -WRITE8_MEMBER( lft_state::kbd_put ) -{ - m_term_data = data; -} - -WRITE16_MEMBER( lft_state::term_w ) -{ - m_terminal->write(space, 0, data & 0x7f); // fix backspace -} - -void lft_state::machine_reset() -{ - m_term_data = 0; -} - -static MACHINE_CONFIG_START( lft, lft_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80186, 4000000) // no idea - MCFG_CPU_PROGRAM_MAP(lft_mem) - MCFG_CPU_IO_MAP(lft_io) - - /* video hardware */ - MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(lft_state, kbd_put)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( lft1230 ) - ROM_REGION(0x4000, "roms", 0) - ROM_LOAD16_BYTE( "1230lf29", 0x0000, 0x2000, CRC(11c87367) SHA1(0879650aa98e19a4e6ca7b6ee7874f81c9c8ccfa) ) - ROM_LOAD16_BYTE( "1230lf42", 0x0001, 0x2000, CRC(ab82b620) SHA1(8c7d93950703f348e5ce0f9e376d157dd6098c6a) ) -ROM_END - -ROM_START( lft1510 ) - ROM_REGION(0x4000, "roms", 0) - ROM_LOAD16_BYTE( "1510lfev", 0x2000, 0x1000, CRC(47dbb290) SHA1(b557e9a54a30d9a16edfdef4a6b12a5393d30bf3) ) - ROM_IGNORE(0x1000) - ROM_LOAD16_BYTE( "1510lfod", 0x2001, 0x1000, CRC(ba8c23fc) SHA1(d4b82f69fccd653b31e7bd05ee884b323ff0007b) ) - ROM_IGNORE(0x1000) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( ????, lft1510, 0, 0, lft, lft, driver_device, 0, "LFT", "LFT 1510", MACHINE_IS_SKELETON) -COMP( ????, lft1230, lft1510, 0, lft, lft, driver_device, 0, "LFT", "LFT 1230", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/lg-dvd.c b/src/mess/drivers/lg-dvd.c deleted file mode 100644 index 0ea3c2ad14a..00000000000 --- a/src/mess/drivers/lg-dvd.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - Rather skeleton driver for a LG GP40NW10 usb dvd writer. - - Main cpu, a MT1839, seems to be a mcs51 variant. -*/ - -#include "emu.h" -#include "debugger.h" -#include "cpu/mcs51/mcs51.h" - -class lg_dvd_state : public driver_device { -public: - lg_dvd_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - maincpu(*this, "maincpu") - { } - - required_device maincpu; -}; - -static INPUT_PORTS_START( lg ) -INPUT_PORTS_END - -static ADDRESS_MAP_START( lg_dvd_map, AS_PROGRAM, 8, lg_dvd_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( lg, lg_dvd_state ) - MCFG_CPU_ADD( "maincpu", I80C52, XTAL_16MHz ) - MCFG_CPU_PROGRAM_MAP( lg_dvd_map ) -MACHINE_CONFIG_END - -ROM_START( lggp40 ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "bios0", "1.00" ) - ROMX_LOAD( "firm-1.00.bin", 0x000000, 0x100000, CRC(c7f24f3b) SHA1(c2ce96c02ab419fb7e0b38703cdaeeccb2b7f34b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "bios1", "1.01" ) - ROMX_LOAD( "firm-1.01.bin", 0x000000, 0x100000, CRC(28820e0c) SHA1(c5f2c1e14e6cff2e57c5196cabcebfaaff7284ce), ROM_BIOS(2) ) -ROM_END - -SYST( 2011, lggp40, 0, 0, lg, lg, driver_device, 0, "LG", "GP40NW10 dvd writer", MACHINE_NOT_WORKING|MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/lisa.c b/src/mess/drivers/lisa.c deleted file mode 100644 index d496742cd8d..00000000000 --- a/src/mess/drivers/lisa.c +++ /dev/null @@ -1,486 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/********************************************************************* - - drivers/lisa.c - - Experimental LISA driver - - Raphael Nabet, 2000 - -*********************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6504.h" -#include "cpu/cop400/cop400.h" -#include "includes/lisa.h" -#include "formats/ap_dsk35.h" - - -/*************************************************************************** - ADDRESS MAP -***************************************************************************/ - -static ADDRESS_MAP_START(lisa_map, AS_PROGRAM, 16, lisa_state ) - AM_RANGE(0x000000, 0xffffff) AM_READWRITE(lisa_r, lisa_w) /* no fixed map, we use an MMU */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(lisa_fdc_map, AS_PROGRAM, 8, lisa_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1fff) // only 8k of address space - AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("fdc_ram") /* RAM (shared with 68000) */ - AM_RANGE(0x0400, 0x07ff) AM_READWRITE(lisa_fdc_io_r, lisa_fdc_io_w) /* disk controller (IWM and TTL logic) */ - AM_RANGE(0x0800, 0x0fff) AM_NOP - AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("fdccpu", 0x1000) AM_SHARE("fdc_rom") /* ROM */ - AM_RANGE(0x2000, 0xffff) AM_READWRITE(lisa_fdc_r, lisa_fdc_w) /* handler for wrap-around */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(lisa210_fdc_map, AS_PROGRAM, 8, lisa_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1fff) // only 8k of address space - AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("fdc_ram") /* RAM (shared with 68000) */ - AM_RANGE(0x0400, 0x07ff) AM_NOP /* nothing, or RAM wrap-around ??? */ - AM_RANGE(0x0800, 0x0bff) AM_READWRITE(lisa_fdc_io_r, lisa_fdc_io_w) /* disk controller (IWM and TTL logic) */ - AM_RANGE(0x0c00, 0x0fff) AM_NOP /* nothing, or IO port wrap-around ??? */ - AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("fdccpu", 0x1000) AM_SHARE("fdc_rom") /* ROM */ - AM_RANGE(0x2000, 0xffff) AM_READWRITE(lisa_fdc_r, lisa_fdc_w) /* handler for wrap-around */ -ADDRESS_MAP_END - - - -/*************************************************************************** - DEVICE CONFIG -***************************************************************************/ - -static void lisa2_set_iwm_enable_lines(device_t *device,int enable_mask) -{ - /* E1 & E2 is connected to the Sony SEL line (?) */ - /*logerror("new sel line state %d\n", (enable_mask) ? 0 : 1);*/ - sony_set_sel_line(device,(enable_mask) ? 0 : 1); -} - -static void lisa210_set_iwm_enable_lines(device_t *device,int enable_mask) -{ - /* E2 is connected to the Sony enable line (?) */ - sony_set_enable_lines(device,enable_mask >> 1); -} - -static const applefdc_interface lisa2_fdc_interface = -{ - sony_set_lines, - lisa2_set_iwm_enable_lines, - - sony_read_data, - sony_write_data, - sony_read_status -}; - -static const applefdc_interface lisa210_fdc_interface = -{ - sony_set_lines, - lisa210_set_iwm_enable_lines, - - sony_read_data, - sony_write_data, - sony_read_status -}; - -static const floppy_interface lisa_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(apple35_mac), - "floppy_5_25" -}; - -/*************************************************************************** - MACHINE DRIVER -***************************************************************************/ - -/* Lisa1 and Lisa 2 machine */ -static MACHINE_CONFIG_START( lisa, lisa_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 5093760) /* 20.37504 MHz / 4 */ - MCFG_CPU_PROGRAM_MAP(lisa_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", lisa_state, lisa_interrupt) - - MCFG_CPU_ADD(COP421_TAG, COP421, 3900000) - MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) - - MCFG_CPU_ADD(KB_COP421_TAG, COP421, 3900000) // ? - MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) - - MCFG_CPU_ADD("fdccpu", M6504, 2000000) /* 16.000 MHz / 8 in when DIS asserted, 16.000 MHz / 9 otherwise (?) */ - MCFG_CPU_PROGRAM_MAP(lisa_fdc_map) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(880, 380) - MCFG_SCREEN_VISIBLE_AREA(0, 720-1, 0, 364-1) - MCFG_SCREEN_UPDATE_DRIVER(lisa_state, screen_update_lisa) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* nvram */ - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", lisa_state, nvram_init) - - /* devices */ - MCFG_IWM_ADD("fdc", lisa2_fdc_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(lisa_floppy_interface) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","lisa") - - /* via */ - MCFG_DEVICE_ADD("via6522_0", VIA6522, 500000) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(lisa_state, COPS_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(lisa_state, COPS_via_out_b)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(lisa_state, COPS_via_out_ca2)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(lisa_state, COPS_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(lisa_state, COPS_via_irq_func)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 500000) - - MCFG_DEVICE_ADD("scc", SCC8530, 7833600) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( lisa210, lisa ) - MCFG_CPU_MODIFY( "fdccpu" ) - MCFG_CPU_PROGRAM_MAP(lisa210_fdc_map) - - /* Lisa 2/10 and MacXL had a slightly different FDC interface */ - MCFG_IWM_MODIFY("fdc", lisa210_fdc_interface) - - /* via */ - MCFG_DEVICE_MODIFY("via6522_0") - MCFG_DEVICE_CLOCK(1250000) - MCFG_DEVICE_MODIFY("via6522_1") - MCFG_DEVICE_CLOCK(1250000) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( macxl, lisa210 ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE( 768/* ???? */, 447/* ???? */) - MCFG_SCREEN_VISIBLE_AREA(0, 608-1, 0, 431-1) -MACHINE_CONFIG_END - -/* 2008-05 FP: -Small note about natural keyboard support: currently, -- "Clear" (on the Keypad) is mapped to 'F1' -- "Enter" (different from Return) is mapped to 'F2' -- "Keypad ," is currently unmapped */ - -static INPUT_PORTS_START( lisa ) - PORT_START("MOUSE_X") /* Mouse - X AXIS */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START("MOUSE_Y") /* Mouse - Y AXIS */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - /* pseudo-input ports with keyboard layout (based on pictures) */ - PORT_START("LINE0") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") - - PORT_START("LINE1") - PORT_BIT(0xFFFF, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE2") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad ,") // this one would be between '+' and 'Enter' on a modern keypad. - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - - PORT_START("LINE3") - PORT_BIT(0xFFFF, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE4") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') // this one would be 2nd row, 3rd key from 'P' -#if 1 - /* US layout */ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNUSED) -#else - /* European layout */ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~ `") PORT_CODE(KEYCODE_BACKSLASH2) - /* 2008-05 FP: Differences in European Layout (based on a couple of pictures found in the web): - - at KEYCODE_ESC, "` ~" is replaced by "? #" - - Shift + 3 gives the pound symbol (\xC2\xA3) - - There is no "\ |" key after "] }" - - There is an additional key at 3rd row, 3rd key from 'L', and it's "` ~" - - Between Left Shift and Z there is another key, but the image is not clear on that key - */ -#endif - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_MENU) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x0C00, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Option") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE5") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('l') PORT_CHAR('M') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('m') PORT_CHAR('L') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("LINE6") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("LINE7") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Option") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) -INPUT_PORTS_END - - /* Note we're missing a whole bunch of lisa bootrom revisions; based on http://www.cs.dartmouth.edu/~woz/bootrom.pdf : - ?A?(10/12/82) ?B?(11/19/82) ?C?(1/28/83) D(5/12/83) 3B(9/8/83) E(10/20/83) F(12/21/83) G(2/8/84) and H(2/24/84) are known to exist. Earlier prototypes existed as well. Only F and H are dumped. */ - /* Based on http://www.cs.dartmouth.edu/~woz/bootrom.pdf and other information, at least the following systems existed: - * Lisa: two 890K twiggy drives, old MB (slow 500khz-clock parallel port via), old i/o board w/io40 disk rom, supports profile hdd, all bootrom revs (practically speaking, it only appeared with bootroms A, B, C, D, E or F) - * Lisa2 (aka Lisa2/5): one 400K SSDD drive, old MB (slow 500khz-clock parallel port via), old i/o board w/ioa8 disk rom, supports profile hdd, bootrom revs "3B", E, F, G, H - * Lisa2/10: one 400K SSDD drive, new MB (fast 1.25MHz-clock parallel port via), new i/o board w/ioa8 disk rom, internal widget 10mb drive (no profile hdd ports), bootrom revs F, G, H - * MacXL: one 400K SSDD drive, new MB (fast 1.25MHz-clock parallel port via), new i/o board w/io88 disk rom, internal widget 10mb drive (no profile hdd ports), bootrom rev 3A, different screen aspect, no serial number in video state rom so lisa office would not run - * Sun-remanufactured MacXL: one 800K DSDD drive, new MB (fast 1.25MHz-clock parallel port via), sun-made custom disk rom (3 revisions exist), internal custom 10mb,20mb, or 40mb drive (?no profile hdd ports?), bootrom rev 3A, different screen aspect, no serial number in video state rom so lisa apps would not run - */ - /* the old i/o board has a battery pack on it which often leaks and destroys the board, and has a socket for an amd 2915 math co-procesor; the new i/o board lacks the battery pack and the socket for the coprocessor, and integrates some of the function of the old twiggy-to-400k drive convertor board (which all lisa2/5s had) on it, requiring a mod to be done to the old convertor if used with a new i/o board.*/ - /* Twiggy disk format notes: twiggy disks seem to have wide '48tpi' heads, but cram 62.5tpi on the media by closely spacing the tracks! Twiggy media is DSHD-grade (needing strong magnetic field to set due to high data rate, see http://www.folklore.org/StoryView.py?project=Macintosh&story=Hide_Under_This_Desk.txt). The twiggy format is *PROBABLY* GCR encoding similar to apple2 and mac800k. The disks are 5.25" disks with TWO holes for the drive heads on both sides of the media, and the write protect notch in an unusual place (the index hole is in its normal position, though). By using variable motor speed similar to the later apple 3.5" disks, double sided disks, and tight track spacing, 871,424 bytes are stored per disk. see http://www.brouhaha.com/~eric/retrocomputing/lisa/twiggy.html - The drives were notoriously unreliable and were replaced by a single SSDD Sony-made varialble speed 400k drive in the lisa2, which was also used on the original macintosh. */ - /* which systems used the 341-0193-A parallel interface card rom? */ - - -ROM_START( lisa ) /* with twiggy drives, io40 i/o rom; technically any of the bootroms will work on this. */ - ROM_REGION16_BE(0x204000,"maincpu",0) /* 68k rom and ram */ - ROM_DEFAULT_BIOS( "revh" ) - - ROM_SYSTEM_BIOS( 0, "revh", "LISA Bootrom Rev H (2/24/84)") - ROMX_LOAD( "341-0175-h", 0x000000, 0x2000, CRC(adfd4516) SHA1(97a89ce1218b8aa38f69f92f6f363f435c887914), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0175-H LISA Bootrom Rev H (2/24/84) (High) */ - ROMX_LOAD( "341-0176-h", 0x000001, 0x2000, CRC(546d6603) SHA1(2a81e4d483f50ae8a2519621daeb7feb440a3e4d), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0176-H LISA Bootrom Rev H (2/24/84) (Low) */ - - ROM_SYSTEM_BIOS( 1, "revg", "LISA Bootrom Rev G (2/08/84)") /* limited test release before release of rom rev H */ - ROMX_LOAD( "341-0175-g", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0175-G LISA Bootrom Rev G (2/08/84) (High) */ - ROMX_LOAD( "341-0176-g", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0176-G LISA Bootrom Rev G (2/08/84) (Low) */ - - ROM_SYSTEM_BIOS( 2, "revf", "LISA Bootrom Rev F (12/21/83)") - ROMX_LOAD( "341-0175-f", 0x000000, 0x2000, CRC(701b9dab) SHA1(b116e5fada7b9a51f1b6e25757b2814d1b2737a5), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0175-F LISA Bootrom Rev F (12/21/83) (High) */ - ROMX_LOAD( "341-0176-f", 0x000001, 0x2000, CRC(036010b6) SHA1(ac93e6dbe4ce59396d7d191ee3e3e79a504e518f), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0176-F LISA Bootrom Rev F (12/21/83) (Low) */ - - ROM_SYSTEM_BIOS( 3, "reve", "LISA Bootrom Rev E (10/20/83)") - ROMX_LOAD( "341-0175-e", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(4)) /* 341-0175-E LISA Bootrom Rev E (10/20/83) (High) */ - ROMX_LOAD( "341-0176-e", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(4)) /* 341-0176-E LISA Bootrom Rev E (10/20/83) (Low) */ - - ROM_SYSTEM_BIOS( 4, "revd", "LISA Bootrom Rev D (5/12/83)") - ROMX_LOAD( "341-0175-d", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(5)) /* 341-0175-D LISA Bootrom Rev D (5/12/83) (High) */ - ROMX_LOAD( "341-0176-d", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(5)) /* 341-0176-D LISA Bootrom Rev D (5/12/83) (Low) */ - - ROM_SYSTEM_BIOS( 5, "revc", "LISA Bootrom Rev C (1/28/83?)") - ROMX_LOAD( "341-0175-c", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(6)) /* 341-0175-C LISA Bootrom Rev C (1/28/83) (High) */ - ROMX_LOAD( "341-0176-c", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(6)) /* 341-0176-C LISA Bootrom Rev C (1/28/83) (Low) */ - - ROM_SYSTEM_BIOS( 6, "revb", "LISA Bootrom Rev B (11/19/82?)") - ROMX_LOAD( "341-0175-b", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(7)) /* 341-0175-B LISA Bootrom Rev B (11/19/82?) (High) */ - ROMX_LOAD( "341-0176-b", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(7)) /* 341-0176-B LISA Bootrom Rev B (11/19/82?) (Low) */ - - ROM_SYSTEM_BIOS( 7, "reva", "LISA Bootrom Rev A (10/12/82?)") /* possibly only prototypes */ - ROMX_LOAD( "341-0175-a", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(8)) /* 341-0175-A LISA Bootrom Rev A (10/12/82?) (High) */ - ROMX_LOAD( "341-0176-a", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(8)) /* 341-0176-A LISA Bootrom Rev A (10/12/82?) (Low) */ - - ROM_REGION( 0x400, COP421_TAG, 0 ) - ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) - - ROM_REGION( 0x400, KB_COP421_TAG, 0 ) - ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) - - ROM_REGION(0x2000,"fdccpu",0) /* 6504 RAM and ROM */ - /* note: other ?prototype? revisions of this rom for the lisa probably exist as well */ - ROM_LOAD( "341-0138f.bin", 0x001000, 0x001000, CRC(edd8d560) SHA1(872211d21386cd9625b3735d7682e2b2ecff05b4) ) - - ROM_REGION(0x4000,"profile", 0) /* Profile/5 HDD */ - ROM_LOAD_OPTIONAL( "341-0080-b", 0x0000, 0x800, CRC(26df0b8d) SHA1(08f6689afb517e0a2bdaa48433003e62a66ae3c7)) /* 341-0080-B z8 mcu piggyback rom */ - - /* TODO: the 341-0193-A parallel interface card rom should be loaded here as well for the lisa 1 and 2/5? */ - - ROM_REGION(0x100,"gfx1",0) /* video ROM (includes S/N) */ - ROM_LOAD( "vidstate.rom", 0x00, 0x100, CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) -ROM_END - -ROM_START( lisa2 ) /* internal apple codename was 'pepsi'; has one SSDD 400K drive, ioa8 i/o rom */ - ROM_REGION16_BE(0x204000,"maincpu",0) /* 68k rom and ram */ - ROM_DEFAULT_BIOS( "revh" ) - - ROM_SYSTEM_BIOS( 0, "revh", "LISA Bootrom Rev H (2/24/84)") - ROMX_LOAD( "341-0175-h", 0x000000, 0x2000, CRC(adfd4516) SHA1(97a89ce1218b8aa38f69f92f6f363f435c887914), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0175-H LISA Bootrom Rev H (2/24/84) (High) */ - ROMX_LOAD( "341-0176-h", 0x000001, 0x2000, CRC(546d6603) SHA1(2a81e4d483f50ae8a2519621daeb7feb440a3e4d), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0176-H LISA Bootrom Rev H (2/24/84) (Low) */ - - ROM_SYSTEM_BIOS( 1, "revg", "LISA Bootrom Rev G (2/08/84)") /* limited test release before release of rom rev H */ - ROMX_LOAD( "341-0175-g", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0175-G LISA Bootrom Rev G (2/08/84) (High) */ - ROMX_LOAD( "341-0176-g", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0176-G LISA Bootrom Rev G (2/08/84) (Low) */ - - ROM_SYSTEM_BIOS( 2, "revf", "LISA Bootrom Rev F (12/21/83)") - ROMX_LOAD( "341-0175-f", 0x000000, 0x2000, CRC(701b9dab) SHA1(b116e5fada7b9a51f1b6e25757b2814d1b2737a5), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0175-F LISA Bootrom Rev F (12/21/83) (High) */ - ROMX_LOAD( "341-0176-f", 0x000001, 0x2000, CRC(036010b6) SHA1(ac93e6dbe4ce59396d7d191ee3e3e79a504e518f), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0176-F LISA Bootrom Rev F (12/21/83) (Low) */ - - ROM_SYSTEM_BIOS( 3, "reve", "LISA Bootrom Rev E (10/20/83)") - ROMX_LOAD( "341-0175-e", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(4)) /* 341-0175-E LISA Bootrom Rev E (10/20/83) (High) */ - ROMX_LOAD( "341-0176-e", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(4)) /* 341-0176-E LISA Bootrom Rev E (10/20/83) (Low) */ - - ROM_SYSTEM_BIOS( 4, "rev3b", "LISA Bootrom Rev 3B (9/8/83)") /* Earliest lisa2 rom, prototype. */ - ROMX_LOAD( "341-0175-3b", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(5)) /* ?label? 341-0175-3b LISA Bootrom Rev 3B (9/8/83) (High) */ - ROMX_LOAD( "341-0176-3b", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(5)) /* ?label? 341-0176-3b LISA Bootrom Rev 3B (9/8/83) (Low) */ - - ROM_REGION( 0x400, COP421_TAG, 0 ) - ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) - - ROM_REGION( 0x400, KB_COP421_TAG, 0 ) - ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) - - ROM_REGION(0x2000,"fdccpu",0) /* 6504 RAM and ROM */ - ROM_LOAD( "341-0290-b", 0x1000, 0x1000, CRC(bc6364f1) SHA1(f3164923330a51366a06d9d8a4a01ec7b0d3a8aa)) /* 341-0290-B LISA 2/5 Disk Rom (ioa8), supports profile on external port */ - - ROM_REGION(0x4000,"profile", 0) /* Profile/5 HDD */ - ROM_LOAD_OPTIONAL( "341-0080-b", 0x0000, 0x800, CRC(26df0b8d) SHA1(08f6689afb517e0a2bdaa48433003e62a66ae3c7)) /* 341-0080-B z8 mcu piggyback rom */ - - /* TODO: the 341-0193-A parallel interface card rom should be loaded here as well for the lisa 1 and 2/5? */ - - ROM_REGION(0x100,"gfx1",0) /* video ROM (includes S/N) */ - ROM_LOAD( "vidstate.rom", 0x00, 0x100, CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) -ROM_END - -ROM_START( lisa210 ) /* newer motherboard and i/o board; has io88 i/o rom, built in widget hdd */ - ROM_REGION16_BE(0x204000,"maincpu", 0) /* 68k rom and ram */ - ROM_DEFAULT_BIOS( "revh" ) - ROM_SYSTEM_BIOS( 0, "revh", "LISA Bootrom Rev H (2/24/84)") - ROMX_LOAD( "341-0175-h", 0x000000, 0x2000, CRC(adfd4516) SHA1(97a89ce1218b8aa38f69f92f6f363f435c887914), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0175-H LISA Bootrom Rev H (2/24/84) (High) */ - ROMX_LOAD( "341-0176-h", 0x000001, 0x2000, CRC(546d6603) SHA1(2a81e4d483f50ae8a2519621daeb7feb440a3e4d), ROM_SKIP(1) | ROM_BIOS(1)) /* 341-0176-H LISA Bootrom Rev H (2/24/84) (Low) */ - - ROM_SYSTEM_BIOS( 1, "revg", "LISA Bootrom Rev G (2/08/84)") /* limited test release before release of rom rev H */ - ROMX_LOAD( "341-0175-g", 0x000000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0175-G LISA Bootrom Rev G (2/08/84) (High) */ - ROMX_LOAD( "341-0176-g", 0x000001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(2)) /* 341-0176-G LISA Bootrom Rev G (2/08/84) (Low) */ - - ROM_SYSTEM_BIOS( 2, "revf", "LISA Bootrom Rev F (12/21/83)") - ROMX_LOAD( "341-0175-f", 0x000000, 0x2000, CRC(701b9dab) SHA1(b116e5fada7b9a51f1b6e25757b2814d1b2737a5), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0175-F LISA Bootrom Rev F (12/21/83) (High) */ - ROMX_LOAD( "341-0176-f", 0x000001, 0x2000, CRC(036010b6) SHA1(ac93e6dbe4ce59396d7d191ee3e3e79a504e518f), ROM_SKIP(1) | ROM_BIOS(3)) /* 341-0176-F LISA Bootrom Rev F (12/21/83) (Low) */ - - ROM_REGION( 0x400, COP421_TAG, 0 ) - ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) - - ROM_REGION( 0x400, KB_COP421_TAG, 0 ) - ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) - -#if 1 - ROM_REGION(0x2000,"fdccpu", 0) /* 6504 RAM and ROM */ - ROM_LOAD( "341-0281-d", 0x1000, 0x1000, CRC(e343fe74) SHA1(a0e484ead2d2315fca261f39fff2f211ff61b0ef)) /* 341-0281-D LISA 2/10 Disk Rom (io88), supports widget on internal port */ -#else - ROM_REGION(0x2000,"fdccpu", 0) /* 6504 RAM and ROM */ - ROM_LOAD( "341-8003-c", 0x1000, 0x1000, CRC(8c67959a) SHA1(aa446b0c4acb4cb6c9d0adfbbea900fb8c04c1e9)) /* 341-8003-C Sun Mac XL Disk rom for 800k drives (Rev C, from Goodwill XL) (io88800k) */ - /* Note: there are two earlier/alternate versions of this rom as well which are dumped */ -#endif - - ROM_REGION(0x4000,"widget", 0) /* Widget HDD controller */ - ROM_LOAD( "341-0288-a", 0x0000, 0x800, CRC(a26ef1c6) SHA1(5aaeb6ff7f7d4f7ce7c70402f75e82533635dda4)) /* 341-0288-A z8 mcu piggyback rom */ - ROM_LOAD( "341-0289-d", 0x2000, 0x2000, CRC(25e86e95) SHA1(72a346c2074d2256adde491b930023ebdcb5f51a)) /* 341-0289-D external rom on widget board */ - - ROM_REGION(0x100,"gfx1", 0) /* video ROM (includes S/N) */ - ROM_LOAD( "vidstate.rom", 0x00, 0x100, CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) -ROM_END - -ROM_START( macxl ) - ROM_REGION16_BE(0x204000,"maincpu", 0) /* 68k rom and ram */ - ROM_LOAD16_BYTE( "341-0347-a", 0x000000, 0x2000, CRC(80add605) SHA1(82215688b778d8c712a8186235f7981e3dc4dd7f)) /* 341-0347-A Mac XL '3A' Bootrom Hi (boot3a.hi)*/ - ROM_LOAD16_BYTE( "341-0346-a", 0x000001, 0x2000, CRC(edf5222f) SHA1(b0388ee8dbbc51a2d628473dc29b65ce913fcd76)) /* 341-0346-A Mac XL '3A' Bootrom Lo (boot3a.lo)*/ - - ROM_REGION( 0x400, COP421_TAG, 0 ) - ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) - - ROM_REGION( 0x400, KB_COP421_TAG, 0 ) - ROM_LOAD( "341-0064a.u9f", 0x000, 0x400, CRC(e6849910) SHA1(d46e67df75c9e3e773d20542fb9d5b1d2ac0fb9b) ) - -#if 1 - ROM_REGION(0x2000,"fdccpu", 0) /* 6504 RAM and ROM */ - ROM_LOAD( "341-0281-d", 0x1000, 0x1000, CRC(e343fe74) SHA1(a0e484ead2d2315fca261f39fff2f211ff61b0ef)) /* 341-0281-D LISA 2/10 Disk Rom (io88), supports widget on internal port */ -#else - ROM_REGION(0x2000,"fdccpu", 0) /* 6504 RAM and ROM */ - ROM_LOAD( "341-8003-c", 0x1000, 0x1000, CRC(8c67959a) SHA1(aa446b0c4acb4cb6c9d0adfbbea900fb8c04c1e9)) /* 341-8003-C Sun Mac XL Disk rom for 800k drives (Rev C, from Goodwill XL) (io88800k) */ - /* Note: there are two earlier/alternate versions of this rom as well which are dumped */ -#endif - - ROM_REGION(0x100,"gfx1", 0) /* video ROM (includes S/N) ; no dump known, although Lisa ROM works fine at our level of emulation */ - ROM_LOAD( "vidstatem.rom", 0x00, 0x100, BAD_DUMP CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) -ROM_END - -/* - Lisa drivers boot MacWorks, but do not boot the Lisa OS, which is why we set - the MACHINE_NOT_WORKING flag... -*/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1983, lisa, 0, 0, lisa, lisa, lisa_state, lisa2, "Apple Computer", "Lisa", MACHINE_NOT_WORKING ) -COMP( 1984, lisa2, 0, 0, lisa, lisa, lisa_state, lisa2, "Apple Computer", "Lisa2", MACHINE_NOT_WORKING ) -COMP( 1984, lisa210, lisa2, 0, lisa210, lisa, lisa_state, lisa210, "Apple Computer", "Lisa2/10", MACHINE_NOT_WORKING ) -COMP( 1985, macxl, lisa2, 0, macxl, lisa, lisa_state, mac_xl, "Apple Computer", "Macintosh XL", /*MACHINE_NOT_WORKING*/0 ) diff --git a/src/mess/drivers/llc.c b/src/mess/drivers/llc.c deleted file mode 100644 index 45cb0ce5348..00000000000 --- a/src/mess/drivers/llc.c +++ /dev/null @@ -1,311 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/****************************************************************************** - - LLC driver by Miodrag Milanovic - - 17/04/2009 Preliminary driver. - - July 2012, updates by Robbbert - - Very little info available on these computers. - - LLC1: - Handy addresses (set the pc register in the debugger, because the - monitor's Go command has problems): - 0800 = BASIC cold start - 0803 = BASIC warm start - 13BE = display Monitor logo - This machine has an 8-digit LED display with hex keyboard, - and also a 64x16 monochrome screen with full keyboard. - The monitor uses the hex keyboard, while Basic uses the full keyboard. - Monitor output is on the digits, but the single-step command displays - a running register dump on the main screen. - There are no storage facilities, and no sound. - BASIC is integer only (-32768 to 32767), about 6k of space, and all - input is to be in uppercase. It does have minimal string capability, - but there is no $ sign, so how to create a string variable is unknown. - To exit back to the monitor, type BYE. - The user instructions of the monitor (in German) are here: - http://www.jens-mueller.org/jkcemu/llc1.html - - LLC2: - The BEL character plays a short tune. - In the monitor, it is case sensitive, most commands are uppercase, - but some are lowercase. - To start Basic, the command is b. To quit basic, use BYE. - Inside Basic, it is not case-sensitive. - - ToDo: - - LLC1: Get good dump of monitor rom, has a number of bad bytes - - LLC1: In Basic, pressing enter several times causes the start - of the line to be shifted 1 or 2 characters to the right. - - LLC1: Go command crashes - - LLC2: Keyboard is incomplete - - Lots of other things - -*******************************************************************************/ - - -#include "machine/keyboard.h" -#include "includes/llc.h" -#include "llc1.lh" - -#define KEYBOARD_TAG "keyboard" - -/* Address maps */ -static ADDRESS_MAP_START( llc1_mem, AS_PROGRAM, 8, llc_state ) - AM_RANGE(0x0000, 0x07ff) AM_ROM // Monitor ROM - AM_RANGE(0x0800, 0x13ff) AM_ROM // BASIC ROM - AM_RANGE(0x1400, 0x1bff) AM_RAM // RAM - AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_SHARE("videoram") // Video RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( llc1_io, AS_IO, 8, llc_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xEC, 0xEF) AM_DEVREADWRITE("z80pio2", z80pio_device, read, write) - AM_RANGE(0xF4, 0xF7) AM_DEVREADWRITE("z80pio1", z80pio_device, read, write) - AM_RANGE(0xF8, 0xFB) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( llc2_mem, AS_PROGRAM, 8, llc_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x5fff) AM_RAMBANK("bank2") - AM_RANGE(0x6000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( llc2_io, AS_IO, 8, llc_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xE0, 0xE3) AM_WRITE(llc2_rom_disable_w) - AM_RANGE(0xE4, 0xE7) AM_DEVREADWRITE("z80pio2", z80pio_device, read, write) - AM_RANGE(0xE8, 0xEB) AM_DEVREADWRITE("z80pio1", z80pio_device, read, write) - AM_RANGE(0xEC, 0xEC) AM_WRITE(llc2_basic_enable_w) - AM_RANGE(0xF8, 0xFB) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( llc1 ) - PORT_START("X4") // out F4,BF - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_START("X5") // out F4,DF - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M (Mem)") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ST (Start)") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('^') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) // resets - PORT_START("X6") // out F4,EF - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ES (Step)") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DL (Go)") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HP (BP)") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) // does nothing -INPUT_PORTS_END - -static INPUT_PORTS_START( llc2 ) -INPUT_PORTS_END - - -WRITE8_MEMBER( llc_state::kbd_put ) -{ - static UINT8 s1[16]={0x40, 0x1e, 0x12, 0x1b, 0x19, 0x14, 0x15, 0x1d, 0x16, 0x17, 0x1c, 0x3c, 0x3f, 0x3d, 0x3e, 0x10}; // 0x20 to 0x2F - static UINT8 s2[7] ={0x1a, 0x11, 0x7c, 0x13, 0x7b, 0x1f, 0x00}; // 0x3A to 0x40 - static UINT8 s3[6] ={0x5c, 0x00, 0x5b, 0x7e, 0x00, 0x5e}; // 0x5B to 0x60 - - m_term_data = data; - - if ((data >= 0x20) && (data <= 0x2f)) - m_term_data = s1[data-0x20]; - else - if ((data >= 0x3a) && (data <= 0x40)) - m_term_data = s2[data-0x3a]; - else - if ((data >= 0x5b) && (data <= 0x60)) - m_term_data = s3[data-0x5b]; - else - if (data >= 0x7b) - m_term_data = 0; - - if (m_term_data) - m_term_status = 0xff; -} - -static const z80_daisy_config llc1_daisy_chain[] = -{ - { "z80ctc" }, - { NULL } -}; - -static const z80_daisy_config llc2_daisy_chain[] = -{ - { "z80pio1" }, - { "z80ctc" }, - { NULL } -}; - -/* F4 Character Displayer */ -static const gfx_layout llc1_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8 }, - 8 /* every char takes 8 x 1 bytes */ -}; - -static const gfx_layout llc2_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( llc1 ) - GFXDECODE_ENTRY( "chargen", 0x0000, llc1_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( llc2 ) - GFXDECODE_ENTRY( "chargen", 0x0000, llc2_charlayout, 0, 1 ) -GFXDECODE_END - -/* Machine driver */ -static MACHINE_CONFIG_START( llc1, llc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_3MHz) - MCFG_CPU_CONFIG(llc1_daisy_chain) - MCFG_CPU_PROGRAM_MAP(llc1_mem) - MCFG_CPU_IO_MAP(llc1_io) - - MCFG_MACHINE_START_OVERRIDE(llc_state, llc1 ) - MCFG_MACHINE_RESET_OVERRIDE(llc_state, llc1 ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*8, 16*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*8-1) - MCFG_SCREEN_UPDATE_DRIVER(llc_state, screen_update_llc1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", llc1) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_DEFAULT_LAYOUT(layout_llc1) - - MCFG_DEVICE_ADD("z80pio1", Z80PIO, XTAL_3MHz) - MCFG_Z80PIO_IN_PA_CB(READ8(llc_state, llc1_port1_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(llc_state, llc1_port1_a_w)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(llc_state, llc1_port1_b_w)) - - MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_3MHz) - MCFG_Z80PIO_IN_PA_CB(READ8(llc_state, llc1_port2_a_r)) - MCFG_Z80PIO_IN_PB_CB(READ8(llc_state, llc1_port2_b_r)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_3MHz) - // timer 0 irq does digit display, and timer 3 irq does scan of the - // monitor keyboard. - // No idea how the CTC is connected, so guessed. - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(llc_state, kbd_put)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( llc2, llc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_3MHz) - MCFG_CPU_CONFIG(llc2_daisy_chain) - MCFG_CPU_PROGRAM_MAP(llc2_mem) - MCFG_CPU_IO_MAP(llc2_io) - - MCFG_MACHINE_RESET_OVERRIDE(llc_state, llc2 ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(llc_state, screen_update_llc2) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", llc2) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) - - MCFG_DEVICE_ADD("z80pio1", Z80PIO, XTAL_3MHz) - MCFG_Z80PIO_IN_PA_CB(DEVREAD8(K7659_KEYBOARD_TAG, k7659_keyboard_device, read)) - MCFG_Z80PIO_IN_PB_CB(READ8(llc_state, llc2_port1_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(llc_state, llc2_port1_b_w)) - - MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_3MHz) - MCFG_Z80PIO_IN_PA_CB(READ8(llc_state, llc2_port2_a_r)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_3MHz) - - MCFG_K7659_KEYBOARD_ADD() - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END -/* ROM definition */ - -ROM_START( llc1 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - //ROM_LOAD( "llc1-monitor.rom", 0x0000, 0x0800, BAD_DUMP CRC(0e81378d) SHA1(0fbb6eca016d0f439ea1c9aa0cb0affb5f49ea69) ) - ROM_LOAD( "llc1mon.bin", 0x0000, 0x0800, BAD_DUMP CRC(e291dd63) SHA1(31a71bef84f7c164a270d0895cb645e078e9c6f2) ) - ROM_LOAD( "llc1_tb1.bin", 0x0800, 0x0400, CRC(0d9d4039) SHA1(b515e385af57f4faf3a9f7b4a1edd59a1c1ea260) ) - ROM_LOAD( "llc1_tb2.bin", 0x0c00, 0x0400, CRC(28bfea2a) SHA1(a68a8b87bfc931627ddd8d124b153e511477fbaf) ) - ROM_LOAD( "llc1_tb3.bin", 0x1000, 0x0400, CRC(fe5e3132) SHA1(cc3b191e41f5772a4b86b8eb0ebe6fce67872df6) ) - ROM_FILL(0x23b, 1, 0x00) // don't reboot when typing into the monitor - ROM_FILL(0x2dc, 1, 0x0f) // fix display of AF in the reg command - ROM_REGION(0x0400, "chargen",0) - ROM_LOAD ("llc1_zg.bin", 0x0000, 0x0400, CRC(fa2cd659) SHA1(1fa5f9992f35929f656c4ce55ed6980c5da1772b) ) -ROM_END - -ROM_START( llc2 ) - ROM_REGION( 0x12000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "scchmon_91.bin", 0x0000, 0x1000, CRC(218d8236) SHA1(b8297272cc79751afc2eb8688d99b40691346dcb) ) - ROM_LOAD( "gsbasic.bin", 0x10000, 0x2000, CRC(78a5f388) SHA1(e7b475b98dce36b24540ad11eb89046ddb4f02af) ) - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD ("llc2font.bin", 0x0000, 0x0800, CRC(ce53e55d) SHA1(da23d93f14a8a1f8d82bb72470a96b0bfd81ed1b) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, llc1, 0, 0, llc1, llc1, llc_state, llc1, "SCCH", "LLC-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1984, llc2, llc1, 0, llc2, llc2, llc_state, llc2, "SCCH", "LLC-2", 0 ) diff --git a/src/mess/drivers/lola8a.c b/src/mess/drivers/lola8a.c deleted file mode 100644 index c6f2e9a6c4f..00000000000 --- a/src/mess/drivers/lola8a.c +++ /dev/null @@ -1,295 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Lola 8A - - Ivo Lola Ribar Institute - - 2013-08-28 Skeleton driver. - - - BASIC commands : - - LET NEXT IF GOTO GOSUB RETURN READ DATA FOR CLS INPUT DIM STOP END RESTORE - REM CLEAR PUSH POKE PRINT OUT ERROR USR CURSOR NORMAL INVERSE PLOT UNPLOT - ELSE WIPE COLOUR CENTRE RANGE DRAW CIRCLE LOAD SAVE VERIFY HLOAD HSAVE HVERIFY - DLOAD DSAVE DVERIFY MERGE CAT RUN NEW ON LIST DEF MON GWIND TWIND UNDER - SPC OFF TAB THEN TO STEP AND OR XOR NOT ABS LEN SQR INT ASC CHR VAL STR MID - ARG CALL RND LEFT RIGHT DOT SGN SIN FREE PI FN TAN COS POP PEEK INP LN EXP ATN -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "video/mc6845.h" -#include "sound/ay8910.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" - -#define AY8910_TAG "g12" -#define HD46505SP_TAG "h45" - - -class lola8a_state : public driver_device -{ -public: - lola8a_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_cass(*this, "cassette"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - - virtual void machine_reset() { m_maincpu->set_pc(0x8000); } - - DECLARE_READ8_MEMBER(lola8a_port_a_r); - DECLARE_WRITE8_MEMBER(lola8a_port_b_w); - DECLARE_WRITE_LINE_MEMBER(crtc_vsync); - DECLARE_READ_LINE_MEMBER(cass_r); - DECLARE_WRITE_LINE_MEMBER(cass_w); - - DECLARE_READ8_MEMBER(keyboard_r); - MC6845_UPDATE_ROW(crtc_update_row); - -private: - UINT8 m_portb; - required_device m_cass; -public: - required_device m_palette; -}; - -static ADDRESS_MAP_START(lola8a_mem, AS_PROGRAM, 8, lola8a_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x1fff ) AM_RAM // 6264 at G45 - AM_RANGE( 0x2000, 0x3fff ) AM_RAM // 6264 at F45 - // empty place for 6264 at E45 - // empty place for 6264 at D45 - AM_RANGE( 0x8000, 0x9fff ) AM_ROM // 2764A at B45 - AM_RANGE( 0xa000, 0xbfff ) AM_ROM // 2764A at C45 - AM_RANGE( 0xc000, 0xdfff ) AM_ROM // 2764A at H67 - AM_RANGE( 0xe000, 0xffff ) AM_RAM // 6264 at G67 -ADDRESS_MAP_END - -static ADDRESS_MAP_START(lola8a_io, AS_IO, 8, lola8a_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x80, 0x80) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w) - AM_RANGE(0x84, 0x84) AM_DEVREADWRITE(AY8910_TAG, ay8910_device, data_r, data_w) - AM_RANGE(0x88, 0x88) AM_READ(keyboard_r) - - AM_RANGE(0x90, 0x90) AM_DEVREADWRITE(HD46505SP_TAG, mc6845_device, status_r, address_w) - AM_RANGE(0x92, 0x92) AM_DEVREADWRITE(HD46505SP_TAG, mc6845_device, register_r, register_w) - -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( lola8a ) - PORT_START("line_0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)// Z" - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) // C" - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) // = - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // S" - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) // C' - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // ; - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)// / - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // ???? - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // : - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - - PORT_START("line_9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) // return - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) // ???? - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // ???? - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) // ???? - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)// @ - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) -INPUT_PORTS_END - -MC6845_UPDATE_ROW( lola8a_state::crtc_update_row ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - for (int sx = 0; sx < x_count; sx++) - { - UINT16 addr = 0xa000 + sx*8 + ra + ma * 8; - UINT8 code = program.read_byte(addr); - - for (int x = 0; x <= 8; x++) - { - int color = BIT(code, 7-x) ? 7 : 0; - if (cursor_x==sx) color = 7; - bitmap.pix32(y, x + sx*8) = m_palette->pen_color(color); - } - } -} - -READ8_MEMBER(lola8a_state::lola8a_port_a_r) -{ - logerror("lola8a_port_a_r\n"); - return 0x00; -} - -WRITE8_MEMBER(lola8a_state::lola8a_port_b_w) -{ - m_portb = data; -} - -READ_LINE_MEMBER( lola8a_state::cass_r ) -{ - return (m_cass->input() < 0.03); -} - -WRITE_LINE_MEMBER( lola8a_state::cass_w ) -{ - m_cass->output(state ? -1.0 : +1.0); -} - -READ8_MEMBER(lola8a_state::keyboard_r) -{ - static const char *const keynames[] = - { - "line_0", "line_1", "line_2", "line_3", - "line_4", "line_5", "line_6", "line_7", - "line_8", "line_9", NULL, NULL, - NULL,NULL,NULL,NULL - }; - - if( keynames[m_portb & 0x0f]) - return ioport(keynames[m_portb & 0x0f])->read(); - return 0xff; -} - -WRITE_LINE_MEMBER(lola8a_state::crtc_vsync) -{ - m_maincpu->set_input_line(I8085_RST75_LINE, state? ASSERT_LINE : CLEAR_LINE); -} - -static MACHINE_CONFIG_START( lola8a, lola8a_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8085A, XTAL_4_9152MHz) - MCFG_CPU_PROGRAM_MAP(lola8a_mem) - MCFG_CPU_IO_MAP(lola8a_io) - MCFG_I8085A_SID(READLINE(lola8a_state, cass_r)) - MCFG_I8085A_SOD(WRITELINE(lola8a_state, cass_w)) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_4_9152MHz / 4) - MCFG_AY8910_PORT_A_READ_CB(READ8(lola8a_state, lola8a_port_a_r)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(lola8a_state, lola8a_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",1.0) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE(HD46505SP_TAG, hd6845_device, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - - MCFG_MC6845_ADD(HD46505SP_TAG, HD6845, "screen", XTAL_8MHz / 8) // HD6845 == HD46505S - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(lola8a_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(lola8a_state, crtc_vsync)) - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - /* Cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( lola8a ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "lola 8a r0 w06 22.11.86.b45", 0x8000, 0x2000, CRC(aca1fc08) SHA1(f7076d937bb53b0addcba2a5b7c05ab75d6d0d93)) - ROM_LOAD( "lola 8a r1 w06 22.11.86.c45", 0xa000, 0x2000, CRC(99f8ec9b) SHA1(88eafd09c479f177525fa0039cf04d74bae39dab)) - ROM_LOAD( "lola 8a r2 w06 22.11.86.h67", 0xc000, 0x2000, CRC(1e7cd46b) SHA1(048b2583ee7baeb9621e629b79ed64583ac5d554)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, lola8a, 0, 0, lola8a, lola8a, driver_device, 0, "Institut Ivo Lola Ribar", "Lola 8A", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/lviv.c b/src/mess/drivers/lviv.c deleted file mode 100644 index 1861e026e71..00000000000 --- a/src/mess/drivers/lviv.c +++ /dev/null @@ -1,491 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/******************************************************************************* - -PK-01 Lviv driver by Krzysztof Strzecha - -Big thanks go to: -Anton V. Ignatichev for informations about Lviv hardware. -Dr. Volodimir Mosorov for two Lviv machines. - -What's new: ------------ -28.02.2003 Snapshot veryfing function added. -07.01.2003 Support for .SAV snapshots. Joystick support (there are strange - problems with "Doroga (1991)(-)(Ru).lvt". -21.12.2002 Cassette support rewritten, WAVs saving and loading are working now. -08.12.2002 Comments on emulation status updated. Changed 'lvive' to 'lvivp'. - ADC r instruction in I8080 core fixed (Arkanoid works now). - Orginal keyboard layout added. -20.07.2002 "Reset" key fixed. I8080 core fixed (all BASIC commands works). - now). Unsupported .lvt files versions aren't now loaded. -xx.07.2002 Improved port and memory mapping (Raphael Nabet). - Hardware description updated (Raphael Nabet). -27.03.2002 CPU clock changed to 2.5MHz. - New Lviv driver added for different ROM revision. -24.03.2002 Palette emulation. - Bit 7 of port 0xc1 emulated - speaker enabled/disabled. - Some notes about hardware added. - "Reset" key added. -23.03.2002 Hardware description and notes on emulation status added. - Few changes in keyboard mapping. - -Notes on emulation status and to do list: ------------------------------------------ -1. LIMITATION: Printer is not emulated. -2. LIMITATION: Timings are not implemented, due to it emulated machine runs - twice fast as orginal. -3. LIMITATION: .RSS files are not supported. -4. LIMITATION: Some usage notes and trivia are needed in sysinfo.dat. - -Lviv technical information -========================== - -CPU: ----- - I8080 2.5MHz (2MHz in first machines) - -Memory map: ------------ - start-up map (cleared by the first I/O write operation done by the CPU): - 0000-3fff ROM mirror #1 - 4000-7fff ROM mirror #2 - 8000-bfff ROM mirror #3 - c000-ffff ROM - - normal map with video RAM off: - 0000-3fff RAM - 4000-7fff RAM - 8000-bfff RAM - c000-ffff ROM - - normal map with video RAM on: - 0000-3fff mirrors 8000-bfff - 4000-7fff video RAM - 8000-bfff RAM - c000-ffff ROM - -Interrupts: ------------ - No interrupts in Lviv. - -Ports: ------- - Only A4-A5 are decoded. A2-A3 is ignored in the console, but could be used by extension - devices. - - C0-C3 8255 PPI - Port A: extension slot output, printer data - bits 0-4 joystick scanner output - Port B: palette control, extension slot input or output - sound on/off - bit 7 sound on/off - bits 0-6 palette select - Port C: memory page changing, tape input and output, - printer control, sound - bits 0-3 extension slot input - bits 4-7 extension slot output - bit 7: joystick scanner input - bit 6: printer control AC/busy - bit 5: not used - bit 4: tape in - bit 3: not used - bit 2: printer control SC/strobe - bit 1: memory paging, 0 - video ram, 1 - ram - bit 0: tape out, sound - - D0-D3 8255 PPI - Port A: - keyboard scaning - Port B: - keyboard reading - Port C: - keyboard scaning/reading - -Keyboard: ---------- - Reset - connected to CPU reset line - - Port D0 - --------T-------T-------T-------T-------T-------T-------T-------?? - | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - +-------+-------+-------+-------+-------+-------+-------+-------+---?? - | Shift | ; | | CLS | Space | R | G | 6 | 0 | - +-------+-------+-------+-------+-------+-------+-------+-------+---+ - | Q |Russian| | (G) | B | O | [ | 7 | 1 | - +-------+-------+-------+-------+-------+-------+-------+-------+---+ - | ^ | Key | J | (B) | @ | L | ] | 8 | 2 | - +-------+-------+-------+-------+-------+-------+-------+-------+---+ - | X | P | N | 5 | Alt | Del | Enter | Ready | 3 | - +-------+-------+-------+-------+-------+-------+-------+-------+---+ Port D1 - | T | A | E | 4 | _ | . | Run | Tab | 4 | - +-------+-------+-------+-------+-------+-------+-------+-------+---+ - | I | W | K | 3 | Latin | \ | : | - | 5 | - +-------+-------+-------+-------+-------+-------+-------+-------+---+ - | M | Y | U | 2 | / | V | H | 0 | 6 | - +-------+-------+-------+-------+-------+-------+-------+-------+---+ - | S | F | C | 1 | , | D | Z | 9 | 7 | - L-------+-------+-------+-------+-------+-------+-------+-------+---- - - Port D2 - --------T-------T-------T-------?? - | 3 | 2 | 1 | 0 | - +-------+-------+-------+-------+-----?? - | Right | Home |ScrPrn |PrnLock| 4 | - +-------+-------+-------+-------+-----+ - | Up | F5 | F0 |ScrLock| 5 | - +-------+-------+-------+-------+-----+ Port D2 - | Left | F4 | F1 | Sound | 6 | - +-------+-------+-------+-------+-----+ - | Down | F3 | F2 | (R) | 7 | - L-------+-------+-------+-------+------ - - Notes: - CLS - clear screen - (G) - clear screen with border and set COLOR 0,0,0 - (B) - clear screen with border and set COLOR 1,0,6 - (R) - clear screen with border and set COLOR 0,7,3 - Sound - sound on/off - ScrLock - screen lock - PrnLock - printer on/off - ScrPrn - screen and printer output mode - Russian - russian keyboard mode - Latin - latin keyboard mode - Right - cursor key - Up - cursor key - Left - cursor key - Down - cursor key - Keyword - BASIC keyword - - -Video: ------ - Screen resolution is 256x256 pixels. 4 colors at once are possible, - but there is a posiibility of palette change. Bits 0..6 of port 0xc1 - are used for palette setting. - - One byte of video-RAM sets 4 pixels. Colors of pixels are corrected - by current palette. Each bits combination (2 bits sets one pixel on - the display), corrected with palette register, sets REAL pixel color. - - PBx - bit of port 0xC1 numbered x - R,G,B - output color components - == - "is equal" - ! - inversion - - 00 R = PB3 == PB4; G = PB5; B = PB2 == PB6; - 01 R = PB4; G = !PB5; B = PB6; - 10 R = PB0 == PB4; G = PB5; B = !PB6; - 11 R = !PB4; G = PB1 == PB5; B = PB6; - - Bit combinations are result of concatenation of appropriate bits of - high and low byte halfs. - - Example: - ~~~~~~~~ - - Some byte of video RAM: 1101 0001 - Value of port 0xC1: x000 1110 - - 1101 - 0001 - ---- - 10 10 00 11 - - 1st pixel (10): R = 1; G = 0; B = 1; - 2nd pixel (10): R = 1; G = 0; B = 1; - 3rd pixel (00): R = 0; G = 0; B = 0; - 4th pixel (11): R = 1; G = 0; B = 0; - - -Sound: ------- - Buzzer connected to port 0xc2 (bit 0). - Bit 7 of port 0xc1 - enable/disable speaker. - - -Timings: --------- - - The CPU timing is controlled by a KR580GF24 (Sovietic copy of i8224) connected to a 18MHz(?) - oscillator. CPU frequency must be 18MHz/9 = 2MHz. - - Memory timing uses a 8-phase clock, derived from a 20MHz(?) video clock (called VCLK0 here: - in the schematics, it comes from pin 6 of V8, and it is labelled "0'" in the video clock bus). - This clock is divided by G7, G6 and D5 to generate the signals we call VCLK1-VCLK11. The memory - clock phases Phi0-Phi7 are generated in D7, whereas PHI'14 and PHI'15 are generated in D8. - - When the CPU accesses RAM, wait states are inserted until the RAM transfer is complete. - - CPU clock: 18MHz/9 = 2MHz - memory cycle time: 20MHz/8 = 2.5MHz - CPU memory access time: (min) approx. 9/20MHz = 450ns - (max) approx. 25/20MHz = 1250ns - pixel clock: 20MHz/4 = 5MHz - screen size: 256*256 - HBL: 64 pixel clock cycles - VBL: 64 lines - horizontal frequency: 5MHZ/(256+64) = 15.625kHz - vertical frequency: 15.625kHz/(256+64) = 48.83Hz - - |<--------VIDEO WINDOW--------->|<----------CPU WINDOW--------->|<-- - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - VCLK0 |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| | - _ ___ ___ ___ ___ ___ ___ ___ ___ ___ - VCLK1 |___| |___| |___| |___| |___| |___| |___| |___| |___| | - _ _______ _______ _______ _______ - VCLK2 |_______| |_______| |_______| |_______| |______| - _ _______________ _______________ - VCLK3 |_______________| |_______________| |_______ - _ _______________________________ - VCLK4 |_______________________________| |_______ - - _ _ _ - PHI0 _| |_____________________________| |_____________________________| |_____ - _ _ _ - PHI1 _____| |_____________________________| |_____________________________| |_ - _ _ - PHI2 _________| |_____________________________| |_____________________________ - _ _ - PHI3 _____________| |_____________________________| |_________________________ - _ _ - PHI4 _________________| |_____________________________| |_____________________ - _ _ - PHI5 _____________________| |_____________________________| |_________________ - _ _ - PHI6 _________________________| |_____________________________| |_____________ - _ _ - PHI7 _____________________________| |_____________________________| |_________ - _ - PHI'14 _________________________________________________________| |_____________ - _ - PHI'15 _____________________________________________________________| |_________ - __________ __________________________________________________ - RAS* \___________/ \_a_________/ - ______________ __________________________________________ - CAS* \_______________/ \_a_____________/ - _________________________________________________________________________ - WR* \_b_________//////// - _________________________________________________________________________ - WRM* \\\\\\\\\\\\\\\\\\\\\\\\\\_b__________________________________/////////// - _________________________________________________________________________ - RDM* \\\\\\\\\\\\\\\\\\\\\\\\\\_c __________________________________/////////// - _________________________________________________________________________ - RA \\\\\\\\\\\\\\\\\\\\\\\\\\_a__________________________________/ - - DRAM - ADDRESS video row /\ video column /XXX\CPU row (a)/\ CPU column (a) /\ video row - - a: only if the CPU is requesting a RAM read/write - b: only if the CPU is requesting a RAM write - c: only if the CPU is requesting a RAM read - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "machine/i8255.h" -#include "includes/lviv.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "formats/lviv_lvt.h" -#include "machine/ram.h" - -/* I/O ports */ - -static ADDRESS_MAP_START(io_map, AS_IO, 8, lviv_state ) - AM_RANGE(0x00, 0xff) AM_READWRITE(lviv_io_r,lviv_io_w) -ADDRESS_MAP_END - -/* memory w/r functions */ - -static ADDRESS_MAP_START(lviv_mem , AS_PROGRAM, 8, lviv_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - - -/* keyboard input */ -static INPUT_PORTS_START (lviv) - PORT_START("KEY0") /* 2nd PPI port A bit 0 low */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ready") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_START("KEY1") /* 2nd PPI port A bit 1 low */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('G') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('[') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR(']') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Run") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR(':') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('H') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('Z') - PORT_START("KEY2") /* 2nd PPI port A bit 2 low */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('D') - PORT_START("KEY3") /* 2nd PPI port A bit 3 low */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('B') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('@') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Latin") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(',') PORT_CHAR('<') - PORT_START("KEY4") /* 2nd PPI port A bit 4 low */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cls") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(G)") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(B)") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_START("KEY5") /* 2nd PPI port A bit 5 low */ - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('E') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('U') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('C') - PORT_START("KEY6") /* 2nd PPI port A bit 6 low */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Russian") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Key") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('Y') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('F') - PORT_START("KEY7") /* 2nd PPI port A bit 7 low */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('^') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('S') - PORT_START("KEY8") /* 2nd PPI port C bit 0 low */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PrnLck") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ScrLck") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sound") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(R)") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_START("KEY9") /* 2nd PPI port C bit 1 low */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ScrPrn") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_START("KEY10") /* 2nd PPI port C bit 2 low */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_START("KEY11") /* 2nd PPI port C bit 3 low */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_START("RESET") /* CPU */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_CHANGED_MEMBER(DEVICE_SELF, lviv_state, lviv_reset, 0) - PORT_START("JOY") /* Joystick */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - - -/* machine definition */ -static MACHINE_CONFIG_START( lviv, lviv_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2500000) - MCFG_CPU_PROGRAM_MAP(lviv_mem) - MCFG_CPU_IO_MAP(io_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(lviv_state, lviv_ppi_0_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(lviv_state, lviv_ppi_0_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(lviv_state, lviv_ppi_0_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(lviv_state, lviv_ppi_0_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(lviv_state, lviv_ppi_0_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(lviv_state, lviv_ppi_0_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(lviv_state, lviv_ppi_1_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(lviv_state, lviv_ppi_1_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(lviv_state, lviv_ppi_1_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(lviv_state, lviv_ppi_1_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(lviv_state, lviv_ppi_1_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(lviv_state, lviv_ppi_1_portc_w)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(0) - - /* video hardware */ - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(lviv_state, screen_update_lviv) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", sizeof (lviv_palette) / 3) - MCFG_PALETTE_INIT_OWNER(lviv_state, lviv) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* snapshot */ - MCFG_SNAPSHOT_ADD("snapshot", lviv_state, lviv, "sav", 0) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(lviv_lvt_format) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("lviv_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","lviv") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - -ROM_START(lviv) - ROM_REGION(0x14000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "lviv", "Lviv/L'vov" ) - ROMX_LOAD("lviv.bin", 0x10000, 0x4000, CRC(44a347d9) SHA1(74e067493b2b7d9ab17333202009a1a4f5e460fd), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "lviva", "Lviv/L'vov (alternate)" ) - ROMX_LOAD("lviva.bin", 0x10000, 0x4000, CRC(551622f5) SHA1(b225f3542b029d767b7db9dce562e8a3f77f92a2), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "lvivp", "Lviv/L'vov (prototype)" ) - ROMX_LOAD("lvivp.bin", 0x10000, 0x4000, CRC(f171c282) SHA1(c7dc2bdb02400e6b5cdcc50040eb06f506a7ed84), ROM_BIOS(3)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, lviv, 0, 0, lviv, lviv, driver_device, 0, "V. I. Lenin", "PK-01 Lviv" , 0 ) diff --git a/src/mess/drivers/lynx.c b/src/mess/drivers/lynx.c deleted file mode 100644 index 5bde2a0cf15..00000000000 --- a/src/mess/drivers/lynx.c +++ /dev/null @@ -1,199 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - PeT peter.trauner@utanet.at 2000,2001 - - info found in bastian schick's bll - and in cc65 for lynx - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m65sc02.h" -#include "audio/lynx.h" -#include "includes/lynx.h" - -#include "lynx.lh" - -static ADDRESS_MAP_START( lynx_mem , AS_PROGRAM, 8, lynx_state ) - AM_RANGE(0x0000, 0xfbff) AM_RAM AM_SHARE("mem_0000") - AM_RANGE(0xfc00, 0xfcff) AM_RAM AM_SHARE("mem_fc00") - AM_RANGE(0xfd00, 0xfdff) AM_RAM AM_SHARE("mem_fd00") - AM_RANGE(0xfe00, 0xfff7) AM_READ_BANK("bank3") AM_WRITEONLY AM_SHARE("mem_fe00") - AM_RANGE(0xfff8, 0xfff8) AM_RAM - AM_RANGE(0xfff9, 0xfff9) AM_READWRITE(lynx_memory_config_r, lynx_memory_config_w) - AM_RANGE(0xfffa, 0xffff) AM_READ_BANK("bank4") AM_WRITEONLY AM_SHARE("mem_fffa") -ADDRESS_MAP_END - -static INPUT_PORTS_START( lynx ) - PORT_START("JOY") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Opt 2") PORT_CODE(KEYCODE_2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Opt 1") PORT_CODE(KEYCODE_1) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) - - PORT_START("PAUSE") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_3) - // power on and power off buttons -INPUT_PORTS_END - -PALETTE_INIT_MEMBER(lynx_state, lynx) -{ - int i; - - for (i=0; i< 0x1000; i++) - { - palette.set_pen_color(i, - ((i >> 0) & 0x0f) * 0x11, - ((i >> 4) & 0x0f) * 0x11, - ((i >> 8) & 0x0f) * 0x11); - } -} - -void lynx_state::video_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); -} - -UINT32 lynx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - -// callback for Mikey call of shift(3) which shall act on the lynx_timer_count_down -void lynx_state::sound_cb() -{ - lynx_timer_count_down(1); -} - -static MACHINE_CONFIG_START( lynx, lynx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M65SC02, 4000000) /* vti core, integrated in vlsi, stz, but not bbr bbs */ - MCFG_CPU_PROGRAM_MAP(lynx_mem) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(LCD_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(lynx_state, screen_update) - MCFG_SCREEN_SIZE(160, 102) - MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 102-1) - MCFG_SCREEN_PALETTE("palette") - MCFG_DEFAULT_LAYOUT(layout_lynx) - - MCFG_PALETTE_ADD("palette", 0x1000) - MCFG_PALETTE_INIT_OWNER(lynx_state, lynx) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", LYNX_SND, 0) - MCFG_LYNX_SND_SET_TIMER(lynx_state, sound_cb) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_QUICKLOAD_ADD("quickload", lynx_state, lynx, "o", 0) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "lynx_cart") - MCFG_GENERIC_EXTENSIONS("lnx,lyx") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(lynx_state, lynx_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","lynx") -MACHINE_CONFIG_END - -#if 0 -static MACHINE_CONFIG_DERIVED( lynx2, lynx ) - - /* sound hardware */ - MCFG_DEVICE_REMOVE("mono") - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_DEVICE_REMOVE("lynx") - MCFG_SOUND_ADD("custom", LYNX2_SND, 0) - MCFG_LYNX_SND_SET_TIMER(lynx_state, sound_cb) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) -MACHINE_CONFIG_END -#endif - -/* these 2 dumps are saved from an running machine, - and therefor the rom byte at 0xfff9 is not readable! - (memory configuration) - these 2 dumps differ only in this byte! -*/ - -ROM_START(lynx) - ROM_REGION(0x200,"maincpu", 0) - ROM_SYSTEM_BIOS( 0, "default", "rom save" ) - ROMX_LOAD( "lynx.bin", 0x00000, 0x200, BAD_DUMP CRC(e1ffecb6) SHA1(de60f2263851bbe10e5801ef8f6c357a4bc077e6), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "a", "alternate rom save" ) - ROMX_LOAD( "lynxa.bin", 0x00000, 0x200, BAD_DUMP CRC(0d973c9d) SHA1(e4ed47fae31693e016b081c6bda48da5b70d7ccb), ROM_BIOS(2)) - - ROM_REGION(0x100,"gfx1", ROMREGION_ERASE00) -ROM_END - -#if 0 -ROM_START(lynx2) - ROM_REGION(0x200,"maincpu", 0) - ROM_LOAD("lynx2.bin", 0, 0x200, NO_DUMP) - - ROM_REGION(0x100,"gfx1", ROMREGION_ERASE00) -ROM_END -#endif - - -QUICKLOAD_LOAD_MEMBER( lynx_state, lynx ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - dynamic_buffer data; - UINT8 *rom = memregion("maincpu")->base(); - UINT8 header[10]; // 80 08 dw Start dw Len B S 9 3 - UINT16 start, length; - int i; - - if (image.fread( header, sizeof(header)) != sizeof(header)) - return IMAGE_INIT_FAIL; - - /* Check the image */ - if (lynx_verify_cart((char*)header, LYNX_QUICKLOAD) == IMAGE_VERIFY_FAIL) - return IMAGE_INIT_FAIL; - - start = header[3] | (header[2]<<8); //! big endian format in file format for little endian cpu - length = header[5] | (header[4]<<8); - length -= 10; - - data.resize(length); - - if (image.fread( &data[0], length) != length) - { - return IMAGE_INIT_FAIL; - } - - for (i = 0; i < length; i++) - space.write_byte(start + i, data[i]); - - rom[0x1fc] = start & 0xff; - rom[0x1fd] = start >> 8; - space.write_byte(0x1fc, start & 0xff); - space.write_byte(0x1fd, start >> 8); - - m_maincpu->set_pc(start); - - return IMAGE_INIT_PASS; -} - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1989, lynx, 0, 0, lynx, lynx, driver_device, 0, "Atari", "Lynx", MACHINE_SUPPORTS_SAVE ) -// CONS( 1991, lynx2, lynx, 0, lynx2, lynx, driver_device, 0, "Atari", "Lynx II", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mess/drivers/m20.c b/src/mess/drivers/m20.c deleted file mode 100644 index 6ff98525238..00000000000 --- a/src/mess/drivers/m20.c +++ /dev/null @@ -1,860 +0,0 @@ -// license:??? -// copyright-holders:Christian Grossler -/* - - Olivetti M20 skeleton driver, by incog (19/05/2009) - -Needs a proper Z8001 CPU core, check also - -ftp://ftp.groessler.org/pub/chris/olivetti_m20/misc/bios/rom.s - ---- - -APB notes: - -0xfc903 checks for the string TEST at 0x3f4-0x3f6, does an int 0xfe if so, unknown purpose - -Error codes: -Triangle Test CPU registers and instructions -Square Test ROM -4 vertical lines CPU call or trap instructions failed -Diamond Test system RAM -E C0 8255 parallel interface IC test failed -E C1 6845 CRT controller IC test failed -E C2 1797 floppy disk controller chip failed -E C3 8253 timer IC failed -E C4 8251 keyboard interface failed -E C5 8251 keyboard test failed -E C6 8259 PIC IC test failed -E K0 Keyboard did not respond -E K1 Keyboard responds, but self test failed -E D1 Disk drive 1 test failed -E D0 Disk drive 0 test failed -E I0 Non-vectored interrupt error -E I1 Vectored interrupt error - -*************************************************************************************************/ - - -#include "emu.h" -#include "cpu/z8000/z8000.h" -#include "cpu/i86/i86.h" -#include "video/mc6845.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "machine/i8251.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "formats/m20_dsk.h" -#include "formats/pc_dsk.h" -#include "machine/m20_kbd.h" -#include "bus/rs232/rs232.h" -#include "machine/m20_8086.h" - -class m20_state : public driver_device -{ -public: - m20_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_kbdi8251(*this, "i8251_1"), - m_ttyi8251(*this, "i8251_2"), - m_i8255(*this, "ppi8255"), - m_i8259(*this, "i8259"), - m_fd1797(*this, "fd1797"), - m_floppy0(*this, "fd1797:0:5dd"), - m_floppy1(*this, "fd1797:1:5dd"), - m_apb(*this, "apb"), - m_p_videoram(*this, "p_videoram"), - m_palette(*this, "palette") - { - } - - required_device m_maincpu; - required_device m_ram; - required_device m_kbdi8251; - required_device m_ttyi8251; - required_device m_i8255; - required_device m_i8259; - required_device m_fd1797; - required_device m_floppy0; - required_device m_floppy1; - optional_device m_apb; - - required_shared_ptr m_p_videoram; - required_device m_palette; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ16_MEMBER(m20_i8259_r); - DECLARE_WRITE16_MEMBER(m20_i8259_w); - DECLARE_READ16_MEMBER(port21_r); - DECLARE_WRITE16_MEMBER(port21_w); - DECLARE_WRITE_LINE_MEMBER(tty_clock_tick_w); - DECLARE_WRITE_LINE_MEMBER(kbd_clock_tick_w); - DECLARE_WRITE_LINE_MEMBER(timer_tick_w); - DECLARE_WRITE_LINE_MEMBER(halt_apb_w); - DECLARE_WRITE_LINE_MEMBER(int_w); - MC6845_UPDATE_ROW(update_row); - -private: - offs_t m_memsize; - UINT8 m_port21; - void install_memory(); - -public: - DECLARE_FLOPPY_FORMATS( floppy_formats ); - IRQ_CALLBACK_MEMBER(m20_irq_callback); -}; - - -#define MAIN_CLOCK 4000000 /* 4 MHz */ -#define PIXEL_CLOCK XTAL_4_433619MHz - - -MC6845_UPDATE_ROW( m20_state::update_row ) -{ - UINT32 *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i, j; - - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ((ma | (ra << 1)) << 4) + i; - UINT16 data = m_p_videoram[ offset ]; - - for ( j = 15; j >= 0; j-- ) - { - *p = palette[( data & 1 << j ) ? 1 : 0]; - p++; - } - } -} - -/* -port21 = 0x21 !TTL latch -! (see hw1 document, fig 2-33, pg 2-47) -! Output Input -! ====== ===== -! B0 0 selects floppy 0 -! 1 deselects floppy 0 -! B1 0 selects floppy 1 -! 1 deselects floppy 1 -! B2 Motor On (Not Used) -! B3 0 selects double density 0 => Skip basic tests -! 1 selects single density 1 => Perform basic tests -! Latched copy when B7 is written to Port21 -! B4 Uncommitted output 0 => 128K card(s) present -! 1 => 32K card(s) present -! Cannot mix types! -! B5 Uncommitted output 0 => 8-colour card present -! 1 => 4-colour card present -! B6 Uncommitted output 0 => RAM -! 1 => ROM (???) -! B7 See B3 input 0 => colour card present -*/ - -READ16_MEMBER(m20_state::port21_r) -{ - //printf("port21 read: offset 0x%x\n", offset); - return m_port21; -} - -WRITE16_MEMBER(m20_state::port21_w) -{ - //printf("port21 write: offset 0x%x, data 0x%x\n", offset, data); - m_port21 = (m_port21 & 0xf8) | (data & 0x7); - - // floppy drive select - if (data & 1) { - m_floppy0->mon_w(0); - m_fd1797->set_floppy(m_floppy0); - } - else - m_floppy0->mon_w(1); - - if (data & 2) { - m_floppy1->mon_w(0); - m_fd1797->set_floppy(m_floppy1); - } - else - m_floppy1->mon_w(1); - - if(!(data & 3)) - m_fd1797->set_floppy(NULL); - - // density select 1 - sd, 0 - dd - m_fd1797->dden_w(data & 8); -} - -READ16_MEMBER(m20_state::m20_i8259_r) -{ - return m_i8259->read(space, offset)<<1; -} - -WRITE16_MEMBER(m20_state::m20_i8259_w) -{ - m_i8259->write(space, offset, (data>>1)); -} - -WRITE_LINE_MEMBER( m20_state::tty_clock_tick_w ) -{ - m_ttyi8251->write_txc(state); - m_ttyi8251->write_rxc(state); -} - -WRITE_LINE_MEMBER( m20_state::kbd_clock_tick_w ) -{ - m_kbdi8251->write_txc(state); - m_kbdi8251->write_rxc(state); -} - -WRITE_LINE_MEMBER( m20_state::timer_tick_w ) -{ - /* Using HOLD_LINE is not completely correct: - * The output of the 8253 is connected to a 74LS74 flop chip. - * The output of the flop chip is connected to NVI CPU input. - * The flop is reset by a 1:8 decoder which compares CPU ST0-ST3 - * outputs to detect an interrupt acknowledge transaction. - * 8253 is programmed in square wave mode, not rate - * generator mode. - */ - if(m_apb) - m_apb->nvi_w(state); - m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? HOLD_LINE /*ASSERT_LINE*/ : CLEAR_LINE); -} - - -/* Memory map description (by courtesy of Dwight Elvey) - - DRAM0 = motherboard (128K) - DRAM1 = first slot from keyboard end - DRAM2 = second slot from keyboard end - DRAM3 = third slot from keyboard end - SRAM0 = memory window for expansion slot - ROM0 = ROM - -Expansion cards are either 32K or 128K. They cannot be mixed, all installed -cards need to be the same type. - -B/W, 32K cards, 3 cards => 224K of memory: -<0>0000 D DRAM0 4000 I DRAM0 4000 <8>0000 D DRAM0 18000 I DRAM0 8000 -<0>4000 D DRAM1 4000 I DRAM0 8000 <8>4000 D DRAM0 1C000 I DRAM0 C000 -<0>8000 D DRAM2 0000 I DRAM0 C000 <8>8000 D DRAM2 4000 I DRAM1 4000 -<0>C000 D DRAM2 4000 I DRAM0 10000 <8>C000 D DRAM3 0000 I DRAM2 0000 -<1>0000 D DRAM0 14000 I DRAM0 8000 <9>0000 D DRAM0 18000 I DRAM0 18000 -<1>4000 D DRAM0 18000 I DRAM0 C000 <9>4000 D DRAM0 1C000 I DRAM0 1C000 -<1>8000 D DRAM0 1C000 I DRAM0 10000 <9>8000 D DRAM2 4000 I DRAM2 4000 -<1>C000 D DRAM1 0000 I None <9>C000 D DRAM3 0000 I DRAM3 0000 -<2>0000 D DRAM0 14000 I DRAM0 14000 0000 D DRAM0 8000 I DRAM0 8000 -<2>4000 D DRAM0 18000 I DRAM0 18000 4000 D DRAM0 C000 I DRAM0 C000 -<2>8000 D DRAM0 1C000 I DRAM0 1C000 8000 D DRAM1 4000 I DRAM1 4000 -<2>C000 D DRAM1 0000 I DRAM1 0000 C000 D DRAM2 0000 I DRAM2 0000 -<3>0000 D DRAM0 0000 I DRAM0 0000 0000 D DRAM3 4000 I DRAM3 4000 -<3>4000 D None I None 4000 D None I None -<3>8000 D None I None 8000 D None I None -<3>C000 D None I None C000 D None I None -<4>0000 D ROM0 0000 I ROM0 0000 0000 D DRAM3 4000 I None -<4>4000 D DRAM3 0000 I ROM0 10000 4000 D None I None -<4>8000 D DRAM3 4000 I ROM0 14000 8000 D None I None -<4>C000 D None I ROM0 18000 C000 D None I None -<5>0000 D DRAM0 8000 I ROM0 10000 0000 D None I None -<5>4000 D DRAM0 C000 I ROM0 14000 4000 D None I None -<5>8000 D DRAM0 10000 I ROM0 18000 8000 D None I None -<5>C000 D SRAM0 0000 I SRAM0 0000 C000 D None I None -<6>0000 D DRAM0 8000 I DRAM0 8000 0000 D None I None -<6>4000 D DRAM0 C000 I DRAM0 C000 4000 D None I None -<6>8000 D DRAM0 10000 I DRAM0 10000 8000 D None I None -<6>C000 D None I None C000 D None I None -<7>0000 D ROM0 0000 I ROM0 0000 0000 D None I None -<7>4000 D ROM0 10000 I ROM0 10000 4000 D None I None -<7>8000 D ROM0 14000 I ROM0 14000 8000 D None I None -<7>C000 D ROM0 18000 I ROM0 18000 C000 D None I None - -B/W, 128K cards, 3 cards => 512K of memory: -<0>0000 D DRAM0 4000 I DRAM0 4000 <8>0000 D DRAM0 18000 I DRAM0 8000 -<0>4000 D DRAM1 4000 I DRAM0 8000 <8>4000 D DRAM0 1C000 I DRAM0 C000 -<0>8000 D DRAM2 0000 I DRAM0 C000 <8>8000 D DRAM1 C000 I DRAM1 4000 -<0>C000 D DRAM2 4000 I DRAM0 10000 <8>C000 D DRAM1 10000 I DRAM1 8000 -<1>0000 D DRAM0 14000 I DRAM0 8000 <9>0000 D DRAM0 18000 I DRAM0 18000 -<1>4000 D DRAM0 18000 I DRAM0 C000 <9>4000 D DRAM0 1C000 I DRAM0 1C000 -<1>8000 D DRAM0 1C000 I DRAM0 10000 <9>8000 D DRAM1 C000 I DRAM1 C000 -<1>C000 D DRAM1 0000 I None <9>C000 D DRAM1 10000 I DRAM1 10000 -<2>0000 D DRAM0 14000 I DRAM0 14000 0000 D DRAM0 8000 I DRAM0 8000 -<2>4000 D DRAM0 18000 I DRAM0 18000 4000 D DRAM0 C000 I DRAM0 C000 -<2>8000 D DRAM0 1C000 I DRAM0 1C000 8000 D DRAM1 4000 I DRAM1 4000 -<2>C000 D DRAM1 0000 I DRAM1 0000 C000 D DRAM1 8000 I DRAM1 8000 -<3>0000 D DRAM0 0000 I DRAM0 0000 0000 D DRAM1 14000 I DRAM1 14000 -<3>4000 D None I None 4000 D DRAM1 18000 I DRAM1 18000 -<3>8000 D None I None 8000 D DRAM1 1C000 I DRAM1 1C000 -<3>C000 D None I None C000 D DRAM2 0000 I DRAM2 0000 -<4>0000 D ROM0 0000 I ROM0 0000 0000 D DRAM2 4000 I DRAM2 4000 -<4>4000 D DRAM3 0000 I None 4000 D DRAM2 8000 I DRAM2 8000 -<4>8000 D DRAM3 4000 I None 8000 D DRAM2 C000 I DRAM2 C000 -<4>C000 D None I None C000 D DRAM2 10000 I DRAM2 10000 -<5>0000 D DRAM0 8000 I ROM0 10000 0000 D DRAM2 14000 I DRAM2 14000 -<5>4000 D DRAM0 C000 I ROM0 14000 4000 D DRAM2 18000 I DRAM2 18000 -<5>8000 D DRAM0 10000 I ROM0 18000 8000 D DRAM2 1C000 I DRAM2 1C000 -<5>C000 D SRAM0 0000 I SRAM0 0000 C000 D DRAM3 0000 I DRAM3 0000 -<6>0000 D DRAM0 8000 I DRAM0 8000 0000 D DRAM3 4000 I DRAM3 4000 -<6>4000 D DRAM0 C000 I DRAM0 C000 4000 D DRAM3 8000 I DRAM3 8000 -<6>8000 D DRAM0 10000 I DRAM0 10000 8000 D DRAM3 C000 I DRAM3 C000 -<6>C000 D None I None C000 D DRAM3 10000 I DRAM3 10000 -<7>0000 D ROM0 0000 I ROM0 0000 0000 D DRAM3 14000 I DRAM3 14000 -<7>4000 D ROM0 10000 I ROM0 10000 4000 D DRAM3 18000 I DRAM3 18000 -<7>8000 D ROM0 14000 I ROM0 14000 8000 D DRAM3 1C000 I DRAM3 1C000 -<7>C000 D ROM0 18000 I ROM0 18000 C000 D DRAM3 0000 I DRAM3 0000 -*/ - - -static ADDRESS_MAP_START(m20_program_mem, AS_PROGRAM, 16, m20_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x30000, 0x33fff ) AM_RAM AM_SHARE("p_videoram") - AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu", 0x00000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(m20_data_mem, AS_DATA, 16, m20_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x30000, 0x33fff ) AM_RAM AM_SHARE("p_videoram") - AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu", 0x00000) -ADDRESS_MAP_END - - -void m20_state::install_memory() -{ - m_memsize = m_ram->size(); - UINT8 *memptr = m_ram->pointer(); - address_space& pspace = m_maincpu->space(AS_PROGRAM); - address_space& dspace = m_maincpu->space(AS_DATA); - - /* install mainboard memory (aka DRAM0) */ - - /* <0>0000 */ - pspace.install_readwrite_bank(0x0000, 0x3fff, 0x3fff, 0, "dram0_4000"); - dspace.install_readwrite_bank(0x0000, 0x3fff, 0x3fff, 0, "dram0_4000"); - /* <0>4000 */ - pspace.install_readwrite_bank(0x4000, 0x7fff, 0x3fff, 0, "dram0_8000"); - /* <0>8000 */ - pspace.install_readwrite_bank(0x8000, 0xbfff, 0x3fff, 0, "dram0_c000"); - /* <0>C000 */ - pspace.install_readwrite_bank(0xc000, 0xcfff, 0x3fff, 0, "dram0_10000"); - /* <1>0000 */ - pspace.install_readwrite_bank(0x10000, 0x13fff, 0x3fff, 0, "dram0_8000"); - dspace.install_readwrite_bank(0x10000, 0x13fff, 0x3fff, 0, "dram0_14000"); - /* <1>4000 */ - pspace.install_readwrite_bank(0x14000, 0x17fff, 0x3fff, 0, "dram0_c000"); - dspace.install_readwrite_bank(0x14000, 0x17fff, 0x3fff, 0, "dram0_18000"); - /* <1>8000 */ - pspace.install_readwrite_bank(0x18000, 0x1bfff, 0x3fff, 0, "dram0_10000"); - dspace.install_readwrite_bank(0x18000, 0x1bfff, 0x3fff, 0, "dram0_1c000"); - /* <1>c000 empty*/ - /* <2>0000 */ - pspace.install_readwrite_bank(0x20000, 0x23fff, 0x3fff, 0, "dram0_14000"); - dspace.install_readwrite_bank(0x20000, 0x23fff, 0x3fff, 0, "dram0_14000"); - /* <2>4000 */ - pspace.install_readwrite_bank(0x24000, 0x27fff, 0x3fff, 0, "dram0_18000"); - dspace.install_readwrite_bank(0x24000, 0x27fff, 0x3fff, 0, "dram0_18000"); - /* <2>8000 */ - pspace.install_readwrite_bank(0x28000, 0x2bfff, 0x3fff, 0, "dram0_1c000"); - dspace.install_readwrite_bank(0x28000, 0x2bfff, 0x3fff, 0, "dram0_1c000"); - /* <2>c000 empty*/ - /* <3>0000 (video buffer) - pspace.install_readwrite_bank(0x30000, 0x33fff, 0x3fff, 0, "dram0_0000"); - dspace.install_readwrite_bank(0x30000, 0x33fff, 0x3fff, 0, "dram0_0000"); - */ - - /* <5>0000 */ - dspace.install_readwrite_bank(0x50000, 0x53fff, 0x3fff, 0, "dram0_8000"); - /* <5>4000 */ - dspace.install_readwrite_bank(0x54000, 0x57fff, 0x3fff, 0, "dram0_c000"); - /* <5>8000 */ - dspace.install_readwrite_bank(0x58000, 0x5bfff, 0x3fff, 0, "dram0_10000"); - /* <5>c000 expansion bus */ - /* <6>0000 */ - pspace.install_readwrite_bank(0x60000, 0x63fff, 0x3fff, 0, "dram0_8000"); - dspace.install_readwrite_bank(0x60000, 0x63fff, 0x3fff, 0, "dram0_8000"); - /* <6>4000 */ - pspace.install_readwrite_bank(0x64000, 0x67fff, 0x3fff, 0, "dram0_c000"); - dspace.install_readwrite_bank(0x64000, 0x67fff, 0x3fff, 0, "dram0_c000"); - /* <6>8000 */ - pspace.install_readwrite_bank(0x68000, 0x6bfff, 0x3fff, 0, "dram0_10000"); - dspace.install_readwrite_bank(0x68000, 0x6bfff, 0x3fff, 0, "dram0_10000"); - /* <6>c000 empty*/ - /* segment <7> expansion ROM? */ - /* <8>0000 */ - pspace.install_readwrite_bank(0x80000, 0x83fff, 0x3fff, 0, "dram0_8000"); - dspace.install_readwrite_bank(0x80000, 0x83fff, 0x3fff, 0, "dram0_18000"); - /* <8>4000 */ - pspace.install_readwrite_bank(0x84000, 0x87fff, 0x3fff, 0, "dram0_c000"); - dspace.install_readwrite_bank(0x84000, 0x87fff, 0x3fff, 0, "dram0_1c000"); - /* <9>0000 */ - pspace.install_readwrite_bank(0x90000, 0x93fff, 0x3fff, 0, "dram0_18000"); - dspace.install_readwrite_bank(0x90000, 0x93fff, 0x3fff, 0, "dram0_18000"); - /* <9>4000 */ - pspace.install_readwrite_bank(0x94000, 0x97fff, 0x3fff, 0, "dram0_1c000"); - dspace.install_readwrite_bank(0x94000, 0x97fff, 0x3fff, 0, "dram0_1c000"); - /* 0000 */ - pspace.install_readwrite_bank(0xa0000, 0xa3fff, 0x3fff, 0, "dram0_8000"); - dspace.install_readwrite_bank(0xa0000, 0xa3fff, 0x3fff, 0, "dram0_8000"); - /* 4000 */ - pspace.install_readwrite_bank(0xa4000, 0xa7fff, 0x3fff, 0, "dram0_c000"); - dspace.install_readwrite_bank(0xa4000, 0xa7fff, 0x3fff, 0, "dram0_c000"); - - //membank("dram0_0000")->set_base(memptr); - membank("dram0_4000")->set_base(memptr + 0x4000); - membank("dram0_8000")->set_base(memptr + 0x8000); - membank("dram0_c000")->set_base(memptr + 0xc000); - membank("dram0_10000")->set_base(memptr + 0x10000); - membank("dram0_14000")->set_base(memptr + 0x14000); - membank("dram0_18000")->set_base(memptr + 0x18000); - membank("dram0_1c000")->set_base(memptr + 0x1c000); - - if (m_memsize > 128 * 1024) { - /* install memory expansions (DRAM1..DRAM3) */ - - if (m_memsize < 256 * 1024) { - /* 32K expansion cards */ - - /* DRAM1, 32K */ - - /* prog - AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000") - AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram1_4000") - AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000") - */ - pspace.install_readwrite_bank(0x2c000, 0x2ffff, 0x3fff, 0, "dram1_0000"); - pspace.install_readwrite_bank(0x88000, 0x8bfff, 0x3fff, 0, "dram1_4000"); - pspace.install_readwrite_bank(0xa8000, 0xabfff, 0x3fff, 0, "dram1_4000"); - - /* - data - AM_RANGE( 0x04000, 0x07fff ) AM_RAM AM_SHARE("dram1_4000") - AM_RANGE( 0x1c000, 0x1ffff ) AM_RAM AM_SHARE("dram1_0000") - AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000") - AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000") - */ - dspace.install_readwrite_bank(0x4000, 0x7fff, 0x3fff, 0, "dram1_4000"); - dspace.install_readwrite_bank(0x1c000, 0x1ffff, 0x3fff, 0, "dram1_0000"); - dspace.install_readwrite_bank(0x2c000, 0x2ffff, 0x3fff, 0, "dram1_0000"); - dspace.install_readwrite_bank(0xa8000, 0xabfff, 0x3fff, 0, "dram1_4000"); - - membank("dram1_0000")->set_base(memptr + 0x20000); - membank("dram1_4000")->set_base(memptr + 0x24000); - - if (m_memsize > 128 * 1024 + 32768) { - /* DRAM2, 32K */ - - /* prog - AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram2_0000") - AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram2_4000") - AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram2_0000") - */ - pspace.install_readwrite_bank(0x8c000, 0x8ffff, 0x3fff, 0, "dram2_0000"); - pspace.install_readwrite_bank(0x98000, 0x9bfff, 0x3fff, 0, "dram2_4000"); - pspace.install_readwrite_bank(0xac000, 0xaffff, 0x3fff, 0, "dram2_0000"); - - /* data - AM_RANGE( 0x08000, 0x0bfff ) AM_RAM AM_SHARE("dram2_0000") - AM_RANGE( 0x0c000, 0x0ffff ) AM_RAM AM_SHARE("dram2_4000") - AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram2_4000") - AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram2_4000") - AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram2_0000") - */ - dspace.install_readwrite_bank(0x8000, 0xbfff, 0x3fff, 0, "dram2_0000"); - dspace.install_readwrite_bank(0xc000, 0xffff, 0x3fff, 0, "dram2_4000"); - dspace.install_readwrite_bank(0x88000, 0x8bfff, 0x3fff, 0, "dram2_4000"); - dspace.install_readwrite_bank(0x98000, 0x9bfff, 0x3fff, 0, "dram2_4000"); - dspace.install_readwrite_bank(0xac000, 0xaffff, 0x3fff, 0, "dram2_0000"); - - membank("dram2_0000")->set_base(memptr + 0x28000); - membank("dram2_4000")->set_base(memptr + 0x2c000); - } - if (m_memsize > 128 * 1024 + 2 * 32768) { - /* DRAM3, 32K */ - - /* prog - AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram3_0000") - AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram3_4000") - */ - pspace.install_readwrite_bank(0x9c000, 0x9ffff, 0x3fff, 0, "dram3_0000"); - pspace.install_readwrite_bank(0xb0000, 0xb3fff, 0x3fff, 0, "dram3_4000"); - - /* data - AM_RANGE( 0x44000, 0x47fff ) AM_RAM AM_SHARE("dram3_0000") - AM_RANGE( 0x48000, 0x4bfff ) AM_RAM AM_SHARE("dram3_4000") - AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram3_0000") - AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram3_0000") - AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram3_4000") - AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM AM_SHARE("dram3_4000") - */ - dspace.install_readwrite_bank(0x44000, 0x47fff, 0x3fff, 0, "dram3_0000"); - dspace.install_readwrite_bank(0x48000, 0x4bfff, 0x3fff, 0, "dram3_4000"); - dspace.install_readwrite_bank(0x8c000, 0x8ffff, 0x3fff, 0, "dram3_0000"); - dspace.install_readwrite_bank(0x9c000, 0x9ffff, 0x3fff, 0, "dram3_0000"); - dspace.install_readwrite_bank(0xb0000, 0xb3fff, 0x3fff, 0, "dram3_4000"); - dspace.install_readwrite_bank(0xc0000, 0xc3fff, 0x3fff, 0, "dram3_4000"); - - membank("dram3_0000")->set_base(memptr + 0x30000); - membank("dram3_4000")->set_base(memptr + 0x34000); - } - } - else { - /* 128K expansion cards */ - - /* DRAM1, 128K */ - - /* prog - AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000") - AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram1_4000") - AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram1_8000") - AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram1_c000") - AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram1_10000") - AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000") - AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram1_8000") - AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram1_14000") - AM_RANGE( 0xb4000, 0xb7fff ) AM_RAM AM_SHARE("dram1_18000") - AM_RANGE( 0xb8000, 0xbbfff ) AM_RAM AM_SHARE("dram1_1c000") - */ - pspace.install_readwrite_bank(0x2c000, 0x2ffff, 0x3fff, 0, "dram1_0000"); - pspace.install_readwrite_bank(0x88000, 0x8bfff, 0x3fff, 0, "dram1_4000"); - pspace.install_readwrite_bank(0x8c000, 0x8ffff, 0x3fff, 0, "dram1_8000"); - pspace.install_readwrite_bank(0x98000, 0x9bfff, 0x3fff, 0, "dram1_c000"); - pspace.install_readwrite_bank(0x9c000, 0x9ffff, 0x3fff, 0, "dram1_10000"); - pspace.install_readwrite_bank(0xa8000, 0xabfff, 0x3fff, 0, "dram1_4000"); - pspace.install_readwrite_bank(0xac000, 0xaffff, 0x3fff, 0, "dram1_8000"); - pspace.install_readwrite_bank(0xb0000, 0xb3fff, 0x3fff, 0, "dram1_14000"); - pspace.install_readwrite_bank(0xb4000, 0xb7fff, 0x3fff, 0, "dram1_18000"); - pspace.install_readwrite_bank(0xb8000, 0xbbfff, 0x3fff, 0, "dram1_1c000"); - - /* data - AM_RANGE( 0x04000, 0x07fff ) AM_RAM AM_SHARE("dram1_4000") - AM_RANGE( 0x1c000, 0x1ffff ) AM_RAM AM_SHARE("dram1_0000") - AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000") - AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram1_c000") - AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram1_10000") - AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram1_c000") - AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram1_10000") - AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000") - AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram1_8000") - AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram1_14000") - AM_RANGE( 0xb4000, 0xb7fff ) AM_RAM AM_SHARE("dram1_18000") - AM_RANGE( 0xb8000, 0xbbfff ) AM_RAM AM_SHARE("dram1_1c000") - */ - dspace.install_readwrite_bank(0x4000, 0x7fff, 0x3fff, 0, "dram1_4000"); - dspace.install_readwrite_bank(0x1c000, 0x1ffff, 0x3fff, 0, "dram1_0000"); - dspace.install_readwrite_bank(0x2c000, 0x2ffff, 0x3fff, 0, "dram1_0000"); - dspace.install_readwrite_bank(0x88000, 0x8bfff, 0x3fff, 0, "dram1_c000"); - dspace.install_readwrite_bank(0x8c000, 0x8ffff, 0x3fff, 0, "dram1_10000"); - dspace.install_readwrite_bank(0x98000, 0x9bfff, 0x3fff, 0, "dram1_c000"); - dspace.install_readwrite_bank(0x9c000, 0x9ffff, 0x3fff, 0, "dram1_10000"); - dspace.install_readwrite_bank(0xa8000, 0xabfff, 0x3fff, 0, "dram1_4000"); - dspace.install_readwrite_bank(0xac000, 0xaffff, 0x3fff, 0, "dram1_8000"); - dspace.install_readwrite_bank(0xb0000, 0xb3fff, 0x3fff, 0, "dram1_14000"); - dspace.install_readwrite_bank(0xb4000, 0xb7fff, 0x3fff, 0, "dram1_18000"); - dspace.install_readwrite_bank(0xb8000, 0xbbfff, 0x3fff, 0, "dram1_1c000"); - - membank("dram1_0000")->set_base(memptr + 0x20000); - membank("dram1_4000")->set_base(memptr + 0x24000); - membank("dram1_8000")->set_base(memptr + 0x28000); - membank("dram1_c000")->set_base(memptr + 0x2c000); - membank("dram1_10000")->set_base(memptr + 0x30000); - membank("dram1_14000")->set_base(memptr + 0x34000); - membank("dram1_18000")->set_base(memptr + 0x38000); - membank("dram1_1c000")->set_base(memptr + 0x3c000); - - if (m_memsize > 256 * 1024) { - /* DRAM2, 128K */ - - /* prog - AM_RANGE( 0xbc000, 0xbffff ) AM_RAM AM_SHARE("dram2_0000") - - AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM AM_SHARE("dram2_4000") - AM_RANGE( 0xc4000, 0xc7fff ) AM_RAM AM_SHARE("dram2_8000") - AM_RANGE( 0xc8000, 0xcbfff ) AM_RAM AM_SHARE("dram2_c000") - AM_RANGE( 0xcc000, 0xcffff ) AM_RAM AM_SHARE("dram2_10000") - - AM_RANGE( 0xd0000, 0xd3fff ) AM_RAM AM_SHARE("dram2_14000") - AM_RANGE( 0xd4000, 0xd7fff ) AM_RAM AM_SHARE("dram2_18000") - AM_RANGE( 0xd8000, 0xdbfff ) AM_RAM AM_SHARE("dram2_1c000") - */ - pspace.install_readwrite_bank(0xbc000, 0xbffff, 0x3fff, 0, "dram2_0000"); - pspace.install_readwrite_bank(0xc0000, 0xc3fff, 0x3fff, 0, "dram2_4000"); - pspace.install_readwrite_bank(0xc4000, 0xc7fff, 0x3fff, 0, "dram2_8000"); - pspace.install_readwrite_bank(0xc8000, 0xcbfff, 0x3fff, 0, "dram2_c000"); - pspace.install_readwrite_bank(0xcc000, 0xcffff, 0x3fff, 0, "dram2_10000"); - pspace.install_readwrite_bank(0xd0000, 0xd3fff, 0x3fff, 0, "dram2_14000"); - pspace.install_readwrite_bank(0xd4000, 0xd7fff, 0x3fff, 0, "dram2_18000"); - pspace.install_readwrite_bank(0xd8000, 0xdbfff, 0x3fff, 0, "dram2_1c000"); - - /* data - AM_RANGE( 0x08000, 0x0bfff ) AM_RAM AM_SHARE("dram2_0000") - AM_RANGE( 0x0c000, 0x0ffff ) AM_RAM AM_SHARE("dram2_4000") - - AM_RANGE( 0xbc000, 0xbffff ) AM_RAM AM_SHARE("dram2_0000") - - AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM AM_SHARE("dram2_4000") - AM_RANGE( 0xc4000, 0xc7fff ) AM_RAM AM_SHARE("dram2_8000") - AM_RANGE( 0xc8000, 0xcbfff ) AM_RAM AM_SHARE("dram2_c000") - AM_RANGE( 0xcc000, 0xcffff ) AM_RAM AM_SHARE("dram2_10000") - - AM_RANGE( 0xd0000, 0xd3fff ) AM_RAM AM_SHARE("dram2_14000") - AM_RANGE( 0xd4000, 0xd7fff ) AM_RAM AM_SHARE("dram2_18000") - AM_RANGE( 0xd8000, 0xdbfff ) AM_RAM AM_SHARE("dram2_1c000") - */ - dspace.install_readwrite_bank(0x8000, 0xbfff, 0x3fff, 0, "dram2_0000"); - dspace.install_readwrite_bank(0xc000, 0xffff, 0x3fff, 0, "dram2_4000"); - dspace.install_readwrite_bank(0xbc000, 0xbffff, 0x3fff, 0, "dram2_0000"); - dspace.install_readwrite_bank(0xc0000, 0xc3fff, 0x3fff, 0, "dram2_4000"); - dspace.install_readwrite_bank(0xc4000, 0xc7fff, 0x3fff, 0, "dram2_8000"); - dspace.install_readwrite_bank(0xc8000, 0xcbfff, 0x3fff, 0, "dram2_c000"); - dspace.install_readwrite_bank(0xcc000, 0xcffff, 0x3fff, 0, "dram2_10000"); - dspace.install_readwrite_bank(0xd0000, 0xd3fff, 0x3fff, 0, "dram2_14000"); - dspace.install_readwrite_bank(0xd4000, 0xd7fff, 0x3fff, 0, "dram2_18000"); - dspace.install_readwrite_bank(0xd8000, 0xdbfff, 0x3fff, 0, "dram2_1c000"); - - membank("dram2_0000")->set_base(memptr + 0x40000); - membank("dram2_4000")->set_base(memptr + 0x44000); - membank("dram2_8000")->set_base(memptr + 0x48000); - membank("dram2_c000")->set_base(memptr + 0x4c000); - membank("dram2_10000")->set_base(memptr + 0x50000); - membank("dram2_14000")->set_base(memptr + 0x54000); - membank("dram2_18000")->set_base(memptr + 0x58000); - membank("dram2_1c000")->set_base(memptr + 0x5c000); - } - if (m_memsize > 384 * 1024) { - /* DRAM3, 128K */ - - /* prog - AM_RANGE( 0xdc000, 0xdffff ) AM_RAM AM_SHARE("dram3_0000") - - AM_RANGE( 0xe0000, 0xe3fff ) AM_RAM AM_SHARE("dram3_4000") - AM_RANGE( 0xe4000, 0xe7fff ) AM_RAM AM_SHARE("dram3_8000") - AM_RANGE( 0xe8000, 0xebfff ) AM_RAM AM_SHARE("dram3_c000") - AM_RANGE( 0xec000, 0xeffff ) AM_RAM AM_SHARE("dram3_10000") - - AM_RANGE( 0xf0000, 0xf3fff ) AM_RAM AM_SHARE("dram3_14000") - AM_RANGE( 0xf4000, 0xf7fff ) AM_RAM AM_SHARE("dram3_18000") - AM_RANGE( 0xf8000, 0xfbfff ) AM_RAM AM_SHARE("dram3_1c000") - AM_RANGE( 0xfc000, 0xfffff ) AM_RAM AM_SHARE("dram3_0000") - */ - pspace.install_readwrite_bank(0xdc000, 0xdffff, 0x3fff, 0, "dram3_0000"); - pspace.install_readwrite_bank(0xe0000, 0xe3fff, 0x3fff, 0, "dram3_4000"); - pspace.install_readwrite_bank(0xe4000, 0xe7fff, 0x3fff, 0, "dram3_8000"); - pspace.install_readwrite_bank(0xe8000, 0xebfff, 0x3fff, 0, "dram3_c000"); - pspace.install_readwrite_bank(0xec000, 0xeffff, 0x3fff, 0, "dram3_10000"); - pspace.install_readwrite_bank(0xf0000, 0xf3fff, 0x3fff, 0, "dram3_14000"); - pspace.install_readwrite_bank(0xf4000, 0xf7fff, 0x3fff, 0, "dram3_18000"); - pspace.install_readwrite_bank(0xf8000, 0xfbfff, 0x3fff, 0, "dram3_1c000"); - pspace.install_readwrite_bank(0xfc000, 0xfffff, 0x3fff, 0, "dram3_0000"); - - /* data - AM_RANGE( 0x44000, 0x47fff ) AM_RAM AM_SHARE("dram3_0000") - AM_RANGE( 0x48000, 0x4bfff ) AM_RAM AM_SHARE("dram3_4000") - AM_RANGE( 0xdc000, 0xdffff ) AM_RAM AM_SHARE("dram3_0000") - - AM_RANGE( 0xe0000, 0xe3fff ) AM_RAM AM_SHARE("dram3_4000") - AM_RANGE( 0xe4000, 0xe7fff ) AM_RAM AM_SHARE("dram3_8000") - AM_RANGE( 0xe8000, 0xebfff ) AM_RAM AM_SHARE("dram3_c000") - AM_RANGE( 0xec000, 0xeffff ) AM_RAM AM_SHARE("dram3_10000") - - AM_RANGE( 0xf0000, 0xf3fff ) AM_RAM AM_SHARE("dram3_14000") - AM_RANGE( 0xf4000, 0xf7fff ) AM_RAM AM_SHARE("dram3_18000") - AM_RANGE( 0xf8000, 0xfbfff ) AM_RAM AM_SHARE("dram3_1c000") - AM_RANGE( 0xfc000, 0xfffff ) AM_RAM AM_SHARE("dram3_0000") - */ - dspace.install_readwrite_bank(0x44000, 0x47fff, 0x3fff, 0, "dram3_0000"); - dspace.install_readwrite_bank(0x48000, 0x4bfff, 0x3fff, 0, "dram3_4000"); - dspace.install_readwrite_bank(0xdc000, 0xdffff, 0x3fff, 0, "dram3_0000"); - dspace.install_readwrite_bank(0xe0000, 0xe3fff, 0x3fff, 0, "dram3_4000"); - dspace.install_readwrite_bank(0xe4000, 0xe7fff, 0x3fff, 0, "dram3_8000"); - dspace.install_readwrite_bank(0xe8000, 0xebfff, 0x3fff, 0, "dram3_c000"); - dspace.install_readwrite_bank(0xec000, 0xeffff, 0x3fff, 0, "dram3_10000"); - dspace.install_readwrite_bank(0xf0000, 0xf3fff, 0x3fff, 0, "dram3_14000"); - dspace.install_readwrite_bank(0xf4000, 0xf7fff, 0x3fff, 0, "dram3_18000"); - dspace.install_readwrite_bank(0xf8000, 0xfbfff, 0x3fff, 0, "dram3_1c000"); - dspace.install_readwrite_bank(0xfc000, 0xfffff, 0x3fff, 0, "dram3_0000"); - - membank("dram3_0000")->set_base(memptr + 0x60000); - membank("dram3_4000")->set_base(memptr + 0x64000); - membank("dram3_8000")->set_base(memptr + 0x68000); - membank("dram3_c000")->set_base(memptr + 0x6c000); - membank("dram3_10000")->set_base(memptr + 0x70000); - membank("dram3_14000")->set_base(memptr + 0x74000); - membank("dram3_18000")->set_base(memptr + 0x78000); - membank("dram3_1c000")->set_base(memptr + 0x7c000); - } - } - } -} - -static ADDRESS_MAP_START(m20_io, AS_IO, 16, m20_state) - ADDRESS_MAP_UNMAP_HIGH - - AM_RANGE(0x00, 0x07) AM_DEVREADWRITE8("fd1797", fd1797_t, read, write, 0x00ff) - - AM_RANGE(0x20, 0x21) AM_READWRITE(port21_r, port21_w); - - AM_RANGE(0x60, 0x61) AM_DEVWRITE8("crtc", mc6845_device, address_w, 0x00ff) - AM_RANGE(0x62, 0x63) AM_DEVWRITE8("crtc", mc6845_device, address_w, 0xff00) // FIXME - AM_RANGE(0x62, 0x63) AM_DEVREADWRITE8("crtc", mc6845_device, register_r, register_w, 0x00ff) - AM_RANGE(0x64, 0x65) AM_DEVREADWRITE8("crtc", mc6845_device, register_r, register_w, 0xff00) - - AM_RANGE(0x80, 0x87) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0x00ff) - - AM_RANGE(0xa0, 0xa1) AM_DEVREADWRITE8("i8251_1", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0xa2, 0xa3) AM_DEVREADWRITE8("i8251_1", i8251_device, status_r, control_w, 0x00ff) - - AM_RANGE(0xc0, 0xc1) AM_DEVREADWRITE8("i8251_2", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0xc2, 0xc3) AM_DEVREADWRITE8("i8251_2", i8251_device, status_r, control_w, 0x00ff) - - AM_RANGE(0x120, 0x127) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0x00ff) - - AM_RANGE(0x140, 0x143) AM_READWRITE(m20_i8259_r, m20_i8259_w) - - AM_RANGE(0x3ffa, 0x3ffd) AM_DEVWRITE("apb", m20_8086_device, handshake_w) -ADDRESS_MAP_END - -IRQ_CALLBACK_MEMBER(m20_state::m20_irq_callback) -{ - if (! irqline) - return 0xff; // NVI, value ignored - else - return m_i8259->acknowledge(); -} - -WRITE_LINE_MEMBER(m20_state::int_w) -{ - if(m_apb && !m_apb->halted()) - m_apb->vi_w(state); - m_maincpu->set_input_line(INPUT_LINE_IRQ1, state ? ASSERT_LINE : CLEAR_LINE); -} - -void m20_state::machine_start() -{ - install_memory(); -} - -void m20_state::machine_reset() -{ - UINT8 *ROM = memregion("maincpu")->base(); - UINT8 *RAM = (UINT8 *)(m_ram->pointer() + 0x4000); - - if (m_memsize >= 256 * 1024) - m_port21 = 0xdf; - else - m_port21 = 0xff; - - if(system_bios() > 0) // bits have different meanings? - m_port21 &= ~8; - - m_fd1797->reset(); - - memcpy(RAM, ROM, 8); // we need only the reset vector - m_maincpu->reset(); // reset the CPU to ensure it picks up the new vector - if(m_apb) - m_apb->m_8086->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); -} - - -static SLOT_INTERFACE_START( m20_floppies ) - SLOT_INTERFACE( "5dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( m20_state::floppy_formats ) - FLOPPY_M20_FORMAT, - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START(keyboard) - SLOT_INTERFACE("m20", M20_KEYBOARD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( m20, m20_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z8001, MAIN_CLOCK) - MCFG_CPU_PROGRAM_MAP(m20_program_mem) - MCFG_CPU_DATA_MAP(m20_data_mem) - MCFG_CPU_IO_MAP(m20_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(m20_state,m20_irq_callback) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("160K") - MCFG_RAM_DEFAULT_VALUE(0) - MCFG_RAM_EXTRA_OPTIONS("128K,192K,224K,256K,384K,512K") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* Devices */ - MCFG_FD1797_ADD("fd1797", 1000000) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("i8259", pic8259_device, ir0_w)) - MCFG_FLOPPY_DRIVE_ADD("fd1797:0", m20_floppies, "5dd", m20_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd1797:1", m20_floppies, "5dd", m20_state::floppy_formats) - - MCFG_MC6845_ADD("crtc", MC6845, "screen", PIXEL_CLOCK/8) /* hand tuned to get ~50 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(16) - MCFG_MC6845_UPDATE_ROW_CB(m20_state, update_row) - - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) - - MCFG_DEVICE_ADD("i8251_1", I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("kbd", rs232_port_device, write_txd)) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("i8259", pic8259_device, ir4_w)) - - MCFG_DEVICE_ADD("i8251_2", I8251, 0) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(1230782) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(m20_state, tty_clock_tick_w)) - MCFG_PIT8253_CLK1(1230782) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m20_state, kbd_clock_tick_w)) - MCFG_PIT8253_CLK2(1230782) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(m20_state, timer_tick_w)) - - MCFG_PIC8259_ADD("i8259", WRITELINE(m20_state, int_w), VCC, NULL) - - MCFG_RS232_PORT_ADD("kbd", keyboard, "m20") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251_1", i8251_device, write_rxd)) - - MCFG_DEVICE_ADD("apb", M20_8086, 0) - - MCFG_SOFTWARE_LIST_ADD("flop_list","m20") -MACHINE_CONFIG_END - -ROM_START(m20) - ROM_REGION(0x2000,"maincpu", 0) - ROM_SYSTEM_BIOS( 0, "m20", "M20 1.0" ) - ROMX_LOAD("m20.bin", 0x0000, 0x2000, CRC(5c93d931) SHA1(d51025e087a94c55529d7ee8fd18ff4c46d93230), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "m20-20d", "M20 2.0d" ) - ROMX_LOAD("m20-20d.bin", 0x0000, 0x2000, CRC(cbe265a6) SHA1(c7cb9d9900b7b5014fcf1ceb2e45a66a91c564d0), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "m20-20f", "M20 2.0f" ) - ROMX_LOAD("m20-20f.bin", 0x0000, 0x2000, CRC(db7198d8) SHA1(149d8513867081d31c73c2965dabb36d5f308041), ROM_BIOS(3)) -ROM_END - -ROM_START(m40) - ROM_REGION(0x14000,"maincpu", 0) - ROM_SYSTEM_BIOS( 0, "m40-81", "M40 15.dec.81" ) - ROMX_LOAD( "m40rom-15-dec-81", 0x0000, 0x2000, CRC(e8e7df84) SHA1(e86018043bf5a23ff63434f9beef7ce2972d8153), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "m40-82", "M40 17.dec.82" ) - ROMX_LOAD( "m40rom-17-dec-82", 0x0000, 0x2000, CRC(cf55681c) SHA1(fe4ae14a6751fef5d7bde49439286f1da3689437), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "m40-41", "M40 4.1" ) - ROMX_LOAD( "m40rom-4.1", 0x0000, 0x2000, CRC(cf55681c) SHA1(fe4ae14a6751fef5d7bde49439286f1da3689437), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "m40-60", "M40 6.0" ) - ROMX_LOAD( "m40rom-6.0", 0x0000, 0x4000, CRC(8114ebec) SHA1(4e2c65b95718c77a87dbee0288f323bd1c8837a3), ROM_BIOS(4)) - - ROM_REGION(0x4000, "apb_bios", ROMREGION_ERASEFF) // Processor board with 8086 -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, m20, 0, 0, m20, 0, driver_device, 0, "Olivetti", "Olivetti L1 M20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1981, m40, m20, 0, m20, 0, driver_device, 0, "Olivetti", "Olivetti L1 M40", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/m24.c b/src/mess/drivers/m24.c deleted file mode 100644 index c9504ef6eec..00000000000 --- a/src/mess/drivers/m24.c +++ /dev/null @@ -1,312 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#include "emu.h" - -#include "cpu/i86/i86.h" -#include "cpu/tms7000/tms7000.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "machine/m24_kbd.h" -#include "machine/m24_z8000.h" -#include "machine/mm58274c.h" -#include "includes/genpc.h" -#include "formats/pc_dsk.h" -#include "formats/naslite_dsk.h" -#include "formats/m20_dsk.h" - -class m24_state : public driver_device -{ -public: - m24_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_mb(*this, "mb"), - m_kbc(*this, "kbc"), - m_keyboard(*this, "keyboard"), - m_z8000_apb(*this, "z8000_apb") - { } - required_device m_maincpu; - required_device m_mb; - required_device m_kbc; - required_device m_keyboard; - optional_device m_z8000_apb; - - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(keyboard_w); - DECLARE_READ8_MEMBER(pa_r); - DECLARE_WRITE8_MEMBER(pb_w); - DECLARE_READ8_MEMBER(kbcdata_r); - DECLARE_WRITE8_MEMBER(kbcdata_w); - DECLARE_WRITE_LINE_MEMBER(kbcin_w); - DECLARE_WRITE_LINE_MEMBER(dma_hrq_w); - DECLARE_WRITE_LINE_MEMBER(int_w); - DECLARE_WRITE_LINE_MEMBER(halt_i86_w); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - void machine_reset(); - - UINT8 m_sysctl, m_pa, m_kbcin, m_kbcout; - bool m_kbcibf, m_kbdata, m_i86_halt, m_i86_halt_perm; -}; - -void m24_state::machine_reset() -{ - m_sysctl = 0; - m_pa = 0x40; - m_kbcibf = false; - m_kbdata = true; - m_i86_halt = false; - m_i86_halt_perm = false; - if(m_z8000_apb) - m_z8000_apb->m_z8000->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); -} - -READ8_MEMBER(m24_state::keyboard_r) -{ - switch(offset) - { - case 0: - m_pa |= 0x40; - m_mb->m_pic8259->ir1_w(0); - return m_kbcout; - case 1: - return m_sysctl; - case 2: - return 0; - case 4: - return (m_kbcibf ? 2 : 0) | ((m_pa & 0x40) ? 0 : 1); - } - return 0xff; -} - -WRITE8_MEMBER(m24_state::keyboard_w) -{ - switch(offset) - { - case 0: - m_kbc->set_input_line(TMS7000_INT1_LINE, ASSERT_LINE); - m_kbcibf = true; - m_kbcin = data; - break; - case 1: - m_sysctl = data; - m_mb->m_pit8253->write_gate2(BIT(data, 0)); - m_mb->pc_speaker_set_spkrdata(BIT(data, 1)); - if(BIT(data, 6)) - m_pa |= 4; - else - m_pa &= ~4; - break; - case 5: - m_maincpu->set_input_line(INPUT_LINE_HALT, (data & 0x40) ? ASSERT_LINE : CLEAR_LINE); - m_i86_halt = true; - m_i86_halt_perm = true; - } -} - -READ8_MEMBER(m24_state::pa_r) -{ - return m_pa & (m_kbdata ? 0xff : 0xfd); -} - -WRITE8_MEMBER(m24_state::pb_w) -{ - m_keyboard->clock_w(!BIT(data, 0)); - m_keyboard->data_w(!BIT(data, 1)); - m_pa = (m_pa & ~3) | (~data & 3); -} - -READ8_MEMBER(m24_state::kbcdata_r) -{ - m_kbc->set_input_line(TMS7000_INT1_LINE, CLEAR_LINE); - m_kbcibf = false; - return m_kbcin; -} - -WRITE8_MEMBER(m24_state::kbcdata_w) -{ - m_pa &= ~0x40; - m_mb->m_pic8259->ir1_w(1); - m_kbcout = data; -} - -WRITE_LINE_MEMBER(m24_state::kbcin_w) -{ - m_kbdata = state; -} - -WRITE_LINE_MEMBER(m24_state::dma_hrq_w) -{ - if(!m_i86_halt) - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - if(m_z8000_apb && !m_z8000_apb->halted()) - m_z8000_apb->m_z8000->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - /* Assert HLDA */ - m_mb->m_dma8237->hack_w(state); -} - -WRITE_LINE_MEMBER(m24_state::int_w) -{ - if(!m_i86_halt) - m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); - if(m_z8000_apb && !m_z8000_apb->halted()) - m_z8000_apb->m_z8000->set_input_line(INPUT_LINE_IRQ1, state ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER(m24_state::halt_i86_w) -{ - if(m_i86_halt_perm) - return; - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - m_i86_halt = state ? true : false; -} - -static ADDRESS_MAP_START( m24_map, AS_PROGRAM, 16, m24_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xeffff) AM_NOP - AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(m24_io, AS_IO, 16, m24_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0060, 0x0065) AM_READWRITE8(keyboard_r, keyboard_w, 0xffff) - AM_RANGE(0x0066, 0x0067) AM_READ_PORT("DSW0") - AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("mm58174an", mm58274c_device, read, write, 0xffff) - AM_RANGE(0x80c0, 0x80c1) AM_DEVREADWRITE8("z8000_apb", m24_z8000_device, handshake_r, handshake_w, 0xff00) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(kbc_map, AS_PROGRAM, 8, m24_state) - AM_RANGE(0x8000, 0x8fff) AM_READ(kbcdata_r) - AM_RANGE(0xa000, 0xafff) AM_WRITE(kbcdata_w) - AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION("kbc", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(kbc_io, AS_IO, 8, m24_state) - AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(pa_r) - AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(pb_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( m24 ) - PORT_START("DSW0") - PORT_DIPNAME( 0x8f, 0x89, "RAM banks") - PORT_DIPSETTING( 0x01, "128K" ) - PORT_DIPSETTING( 0x82, "256K" ) - PORT_DIPSETTING( 0x84, "512K - 256/256" ) - PORT_DIPSETTING( 0x08, "512K - 512/0" ) - PORT_DIPSETTING( 0x85, "640K - 256/384" ) - PORT_DIPSETTING( 0x8d, "640K - 128/512" ) - PORT_DIPSETTING( 0x89, "640K - 512/128" ) - PORT_DIPNAME( 0x10, 0x00, "8087 installed") - PORT_DIPSETTING( 0x00, DEF_STR(No) ) - PORT_DIPSETTING( 0x10, DEF_STR(Yes) ) - PORT_DIPNAME( 0x20, 0x00, "Serial Port") - PORT_DIPSETTING( 0x20, "Z8530 SCC") - PORT_DIPSETTING( 0x00, "INS8250" ) - - //PORT_START("DSW1") - PORT_DIPNAME( 0x0100, 0x0000, "FDD Type") - PORT_DIPSETTING( 0x0000, "360K" ) - PORT_DIPSETTING( 0x0100, "720K" ) - PORT_DIPNAME( 0x0200, 0x0200, "FDD spinup") - PORT_DIPSETTING( 0x0000, "Slow" ) - PORT_DIPSETTING( 0x0200, "Fast" ) - PORT_DIPNAME( 0x0400, 0x0400, "HDD ROM") - PORT_DIPSETTING( 0x0000, "Internal" ) - PORT_DIPSETTING( 0x0400, "External" ) - PORT_DIPNAME( 0x0800, 0x0000, "Scroll rate") - PORT_DIPSETTING( 0x0800, "Slow" ) - PORT_DIPSETTING( 0x0000, "Fast") - PORT_DIPNAME( 0x3000, 0x2000, "Graphics adapter") - PORT_DIPSETTING( 0x0000, "EGA/VGA" ) - PORT_DIPSETTING( 0x1000, "Color 40x25" ) - PORT_DIPSETTING( 0x2000, "Color 80x25" ) - PORT_DIPSETTING( 0x3000, "Monochrome" ) - PORT_DIPNAME( 0xc000, 0x4000, "Number of floppy drives") - PORT_DIPSETTING( 0x0000, "1" ) - PORT_DIPSETTING( 0x4000, "2" ) - PORT_DIPSETTING( 0x8000, "3" ) - PORT_DIPSETTING( 0xc000, "4" ) -INPUT_PORTS_END - -FLOPPY_FORMATS_MEMBER( m24_state::floppy_formats ) - FLOPPY_PC_FORMAT, - FLOPPY_NASLITE_FORMAT, - FLOPPY_M20_FORMAT -FLOPPY_FORMATS_END - -static MACHINE_CONFIG_FRAGMENT( cfg_m20_format ) - MCFG_DEVICE_MODIFY("fdc:0") - static_cast(device)->set_formats(m24_state::floppy_formats); - - MCFG_DEVICE_MODIFY("fdc:1") - static_cast(device)->set_formats(m24_state::floppy_formats); -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( olivetti, m24_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, XTAL_8MHz) - MCFG_CPU_PROGRAM_MAP(m24_map) - MCFG_CPU_IO_MAP(m24_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") - - MCFG_ISA8_SLOT_ADD("mb:isa", "mb1", pc_isa8_cards, "cga_m24", true) - MCFG_ISA8_SLOT_ADD("mb:isa", "mb2", pc_isa8_cards, "fdc_xt", true) - MCFG_SLOT_OPTION_MACHINE_CONFIG("fdc_xt", cfg_m20_format) - MCFG_ISA8_SLOT_ADD("mb:isa", "mb3", pc_isa8_cards, "lpt", true) - MCFG_ISA8_SLOT_ADD("mb:isa", "mb4", pc_isa8_cards, "com", true) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - MCFG_CPU_ADD("kbc", TMS7000, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(kbc_map) - MCFG_CPU_IO_MAP(kbc_io) - - MCFG_DEVICE_ADD("keyboard", M24_KEYBOARD, 0) - MCFG_M24_KEYBOARD_OUT_DATA_HANDLER(WRITELINE(m24_state, kbcin_w)) - - MCFG_DEVICE_ADD("mm58174an", MM58274C, 0) - MCFG_MM58274C_MODE24(1) // ? - MCFG_MM58274C_DAY1(1) // ? - - MCFG_DEVICE_ADD("z8000_apb", M24_Z8000, 0) - MCFG_M24_Z8000_HALT(WRITELINE(m24_state, halt_i86_w)) - MCFG_DEVICE_MODIFY("mb:dma8237") - MCFG_I8237_OUT_HREQ_CB(DEVWRITELINE(":", m24_state, dma_hrq_w)) - MCFG_DEVICE_MODIFY("mb:pic8259") - devcb = &pic8259_device::static_set_out_int_callback(*device, DEVCB_DEVWRITELINE(":", m24_state, int_w)); - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - -ROM_START( m24 ) - ROM_REGION16_LE(0x8000,"maincpu", 0) - ROMX_LOAD("olivetti_m24_version_1.43_high.bin",0x4001, 0x2000, CRC(04e697ba) SHA1(1066dcc849e6289b5ac6372c84a590e456d497a6), ROM_SKIP(1)) - ROMX_LOAD("olivetti_m24_version_1.43_low.bin", 0x4000, 0x2000, CRC(ff7e0f10) SHA1(13423011a9bae3f3193e8c199f98a496cab48c0f), ROM_SKIP(1)) - - ROM_REGION(0x800, "kbc", 0) - ROM_LOAD("pdbd.tms2516.keyboardmcureplacementdaughterboard_10u", 0x000, 0x800, CRC(b8c4c18a) SHA1(25b4c24e19ff91924c53557c66513ab242d926c6)) -ROM_END - -ROM_START( m240 ) - ROM_REGION16_LE(0x8000,"maincpu", 0) - ROMX_LOAD("olivetti_m240_pch5_2.04_high.bin", 0x0001, 0x4000, CRC(ceb97b59) SHA1(84fabbeab355e0a4c9445910f2b7d1ec98886642), ROM_SKIP(1)) - ROMX_LOAD("olivetti_m240_pch6_2.04_low.bin", 0x0000, 0x4000, CRC(c463aa94) SHA1(a30c763c1ace9f3ff79e7136b252d624108a50ae), ROM_SKIP(1)) - - // is this one the same? - ROM_REGION(0x800, "kbc", 0) - ROM_LOAD("pdbd.tms2516.keyboardmcureplacementdaughterboard_10u", 0x000, 0x800, BAD_DUMP CRC(b8c4c18a) SHA1(25b4c24e19ff91924c53557c66513ab242d926c6)) -ROM_END - -COMP( 1983, m24, ibm5150, 0, olivetti, m24, driver_device, 0, "Olivetti", "M24", MACHINE_NOT_WORKING) -COMP( 1987, m240, ibm5150, 0, olivetti, m24, driver_device, 0, "Olivetti", "M240", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/m5.c b/src/mess/drivers/m5.c deleted file mode 100644 index 9912827631d..00000000000 --- a/src/mess/drivers/m5.c +++ /dev/null @@ -1,726 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Sord m.5 - - http://www.retropc.net/mm/m5/ - http://www.museo8bits.es/wiki/index.php/Sord_M5 - http://k5.web.klfree.net/content/view/10/11/ - http://k5.web.klfree.net/images/stories/sord/m5heap.htm - -****************************************************************************/ - -/* - - TODO: - - - floppy - - SI-5 serial interface (8251, ROM) - - 64KB RAM expansions - -*/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "formats/m5_dsk.h" -#include "formats/sord_cas.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8255.h" -#include "machine/ram.h" -#include "machine/upd765.h" -#include "machine/z80ctc.h" -#include "sound/sn76496.h" -#include "video/tms9928a.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "includes/m5.h" - - - -//************************************************************************** -// MEMORY BANKING -//************************************************************************** - -WRITE_LINE_MEMBER( m5_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -//------------------------------------------------- -// sts_r - -//------------------------------------------------- - -READ8_MEMBER( m5_state::sts_r ) -{ - /* - - bit description - - 0 cassette input - 1 busy - 2 - 3 - 4 - 5 - 6 - 7 RESET key - - */ - - UINT8 data = 0; - - // cassette input - data |= m_cassette->input() >= 0 ? 1 : 0; - - // centronics busy - data |= m_centronics_busy << 1; - - // RESET key - data |= m_reset->read(); - - return data; -} - - -//------------------------------------------------- -// com_w - -//------------------------------------------------- - -WRITE8_MEMBER( m5_state::com_w ) -{ - /* - - bit description - - 0 cassette output, centronics strobe - 1 cassette remote - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - // cassette output - m_cassette->output( BIT(data, 0) ? -1.0 : 1.0); - - // centronics strobe - m_centronics->write_strobe(BIT(data, 0)); - - // cassette remote - m_cassette->change_state(BIT(data,1) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - - - -//************************************************************************** -// FD-5 -//************************************************************************** - -//------------------------------------------------- -// fd5_data_r - -//------------------------------------------------- - -READ8_MEMBER( m5_state::fd5_data_r ) -{ - m_ppi->pc6_w(0); - - return m_fd5_data; -} - - -//------------------------------------------------- -// fd5_data_w - -//------------------------------------------------- - -WRITE8_MEMBER( m5_state::fd5_data_w ) -{ - m_fd5_data = data; - - m_ppi->pc4_w(0); -} - - -//------------------------------------------------- -// fd5_com_r - -//------------------------------------------------- - -READ8_MEMBER( m5_state::fd5_com_r ) -{ - /* - - bit description - - 0 ? - 1 1? - 2 IBFA? - 3 OBFA? - 4 - 5 - 6 - 7 - - */ - - return m_obfa << 3 | m_ibfa << 2 | 0x02; -} - - -//------------------------------------------------- -// fd5_com_w - -//------------------------------------------------- - -WRITE8_MEMBER( m5_state::fd5_com_w ) -{ - /* - - bit description - - 0 PPI PC2 - 1 PPI PC0 - 2 PPI PC1 - 3 - 4 - 5 - 6 - 7 - - */ - - m_fd5_com = data; -} - - -//------------------------------------------------- -// fd5_com_w - -//------------------------------------------------- - -WRITE8_MEMBER( m5_state::fd5_ctrl_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - m_floppy0->mon_w(!BIT(data, 0)); -} - - -//------------------------------------------------- -// fd5_com_w - -//------------------------------------------------- - -WRITE8_MEMBER( m5_state::fd5_tc_w ) -{ - m_fdc->tc_w(true); - m_fdc->tc_w(false); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( m5_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( m5_mem, AS_PROGRAM, 8, m5_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM - //AM_RANGE(0x2000, 0x6fff) // mapped by the cartslot - AM_RANGE(0x7000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( m5_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( m5_io, AS_IO, 8, m5_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) - AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) - AM_RANGE(0x20, 0x20) AM_MIRROR(0x0f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0x30, 0x30) AM_MIRROR(0x08) AM_READ_PORT("Y0") // 64KBF bank select - AM_RANGE(0x31, 0x31) AM_MIRROR(0x08) AM_READ_PORT("Y1") - AM_RANGE(0x32, 0x32) AM_MIRROR(0x08) AM_READ_PORT("Y2") - AM_RANGE(0x33, 0x33) AM_MIRROR(0x08) AM_READ_PORT("Y3") - AM_RANGE(0x34, 0x34) AM_MIRROR(0x08) AM_READ_PORT("Y4") - AM_RANGE(0x35, 0x35) AM_MIRROR(0x08) AM_READ_PORT("Y5") - AM_RANGE(0x36, 0x36) AM_MIRROR(0x08) AM_READ_PORT("Y6") - AM_RANGE(0x37, 0x37) AM_MIRROR(0x08) AM_READ_PORT("JOY") - AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READWRITE(sts_r, com_w) -// AM_RANGE(0x60, 0x63) SIO -// AM_RANGE(0x6c, 0x6c) EM-64/64KBI bank select - AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) -// AM_RANGE(0x7f, 0x7f) 64KRD/64KRX bank select -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( fd5_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( fd5_mem, AS_PROGRAM, 8, m5_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( fd5_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( fd5_io, AS_IO, 8, m5_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x01) AM_DEVICE(UPD765_TAG, upd765a_device, map) - AM_RANGE(0x10, 0x10) AM_READWRITE(fd5_data_r, fd5_data_w) - AM_RANGE(0x20, 0x20) AM_WRITE(fd5_com_w) - AM_RANGE(0x30, 0x30) AM_READ(fd5_com_r) - AM_RANGE(0x40, 0x40) AM_WRITE(fd5_ctrl_w) - AM_RANGE(0x50, 0x50) AM_WRITE(fd5_tc_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( m5 ) -//------------------------------------------------- - -static INPUT_PORTS_START( m5 ) - PORT_START("Y0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Func") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("Y1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("Y2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - - PORT_START("Y3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("Y4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("Y5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_ Triangle") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') - - PORT_START("Y6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("JOY") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - - PORT_START("RESET") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) /* 1st line, 1st key from right! */ -INPUT_PORTS_END - -//------------------------------------------------- -// TMS9928a_interface vdp_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER(m5_state::sordm5_video_interrupt_callback) -{ - if (state) - { - m_ctc->trg3(1); - m_ctc->trg3(0); - } -} - - -//------------------------------------------------- -// I8255 Interface -//------------------------------------------------- - -READ8_MEMBER( m5_state::ppi_pa_r ) -{ - return m_fd5_data; -} - -READ8_MEMBER( m5_state::ppi_pc_r ) -{ - /* - - bit description - - 0 ? - 1 ? - 2 ? - 3 - 4 STBA - 5 - 6 ACKA - 7 - - */ - - return ( - /* FD5 bit 0-> M5 bit 2 */ - ((m_fd5_com & 0x01)<<2) | - /* FD5 bit 2-> M5 bit 1 */ - ((m_fd5_com & 0x04)>>1) | - /* FD5 bit 1-> M5 bit 0 */ - ((m_fd5_com & 0x02)>>1) - ); -} - -WRITE8_MEMBER( m5_state::ppi_pa_w ) -{ - m_fd5_data = data; -} - -WRITE8_MEMBER( m5_state::ppi_pb_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - if (data == 0xf0) - { - m_fd5cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_fd5cpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - } -} - -WRITE8_MEMBER( m5_state::ppi_pc_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 INTRA - 4 - 5 IBFA - 6 - 7 OBFA - - */ - - m_intra = BIT(data, 3); - m_ibfa = BIT(data, 5); - m_obfa = BIT(data, 7); -} - -//------------------------------------------------- -// upd765_interface fdc_intf -//------------------------------------------------- - -FLOPPY_FORMATS_MEMBER( m5_state::floppy_formats ) - FLOPPY_M5_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( m5_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -//------------------------------------------------- -// z80_daisy_config m5_daisy_chain -//------------------------------------------------- - -static const z80_daisy_config m5_daisy_chain[] = -{ - { Z80CTC_TAG }, - { NULL } -}; - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( m5 ) -//------------------------------------------------- - -void m5_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - // configure RAM - switch (m_ram->size()) - { - case 4*1024: - program.unmap_readwrite(0x8000, 0xffff); - break; - - case 36*1024: - break; - - case 68*1024: - break; - } - - if (m_cart->exists()) - program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - // register for state saving - save_item(NAME(m_fd5_data)); - save_item(NAME(m_fd5_com)); - save_item(NAME(m_intra)); - save_item(NAME(m_ibfa)); - save_item(NAME(m_obfa)); -} - - -void m5_state::machine_reset() -{ -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( m5 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( m5, m5_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_14_31818MHz/4) - MCFG_CPU_PROGRAM_MAP(m5_mem) - MCFG_CPU_IO_MAP(m5_io) - MCFG_CPU_CONFIG(m5_daisy_chain) - - MCFG_CPU_ADD(Z80_FD5_TAG, Z80, XTAL_14_31818MHz/4) - MCFG_CPU_PROGRAM_MAP(fd5_mem) - MCFG_CPU_IO_MAP(fd5_io) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_14_31818MHz/4) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_14_31818MHz/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - // CK0 = EXINT, CK1 = GND, CK2 = TCK, CK3 = VDP INT - // ZC2 = EXCLK - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(m5_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(sordm5_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("m5_cass") - - MCFG_DEVICE_ADD(I8255A_TAG, I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(m5_state, ppi_pa_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(m5_state, ppi_pa_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(m5_state, ppi_pb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(m5_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(m5_state, ppi_pc_w)) - - MCFG_UPD765A_ADD(UPD765_TAG, true, true) - MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE(Z80_FD5_TAG, INPUT_LINE_IRQ0)) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", m5_floppies, "525dd", m5_state::floppy_formats) - - // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "m5_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - //MCFG_GENERIC_MANDATORY - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list", "m5_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "m5_cass") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("36K,68K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG_DERIVED( ntsc, m5 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( ntsc, m5 ) - // video hardware - MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(m5_state, sordm5_video_interrupt_callback)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG_DERIVED( pal, m5 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pal, m5 ) - // video hardware - MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(m5_state, sordm5_video_interrupt_callback)) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( m5 ) -//------------------------------------------------- - -ROM_START( m5 ) - ROM_REGION( 0x7000, Z80_TAG, ROMREGION_ERASEFF ) - ROM_LOAD( "sordjap.ic21", 0x0000, 0x2000, CRC(92cf9353) SHA1(b0a4b3658fde68cb1f344dfb095bac16a78e9b3e) ) - - ROM_REGION( 0x4000, Z80_FD5_TAG, 0 ) - ROM_LOAD( "sordfd5.rom", 0x0000, 0x4000, CRC(7263bbc5) SHA1(b729500d3d2b2e807d384d44b76ea5ad23996f4a)) -ROM_END - - -//------------------------------------------------- -// ROM( m5p ) -//------------------------------------------------- - -ROM_START( m5p ) - ROM_REGION( 0x7000, Z80_TAG, ROMREGION_ERASEFF ) - ROM_LOAD( "sordint.ic21", 0x0000, 0x2000, CRC(78848d39) SHA1(ac042c4ae8272ad6abe09ae83492ef9a0026d0b2) ) - - ROM_REGION( 0x4000, Z80_FD5_TAG, 0 ) - ROM_LOAD( "sordfd5.rom", 0x0000, 0x4000, CRC(7263bbc5) SHA1(b729500d3d2b2e807d384d44b76ea5ad23996f4a)) -ROM_END - - - -//************************************************************************** -// DRIVER INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// ROM( ntsc ) -//------------------------------------------------- - -DRIVER_INIT_MEMBER(m5_state,ntsc) -{ -} - - -//------------------------------------------------- -// ROM( pal ) -//------------------------------------------------- - -DRIVER_INIT_MEMBER(m5_state,pal) -{ -} - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, m5, 0, 0, ntsc, m5, m5_state, ntsc, "Sord", "m.5 (Japan)", 0 ) -COMP( 1983, m5p, m5, 0, pal, m5, m5_state, pal, "Sord", "m.5 (Europe)", 0 ) diff --git a/src/mess/drivers/m6805evs.c b/src/mess/drivers/m6805evs.c deleted file mode 100644 index 91400aa4a6d..00000000000 --- a/src/mess/drivers/m6805evs.c +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/****************************************************************************************************** - -Motorola M68HC05EVS evaluation system - -Chips: -Main board: XC68HC26P, R65C52P2, MS62256l-70PC, MS6264L-70PC, eprom. Xtal = 3.6864MHz -Emulator board: MC68C705P9CP, undumped 28-pin prom. Xtal = 4MHz - -R65C52 = Dual ACIA with inbuilt baud rate divider, uses 8 addresses, uses the 3.6864MHz crystal -XC68HC26P = PPI (3 ports), uses 8 addresses. - -2014-01-12 Skeleton driver - -The rom is larger than the available address space, but not all of it is programmed. The code -ranges are 800-18FF,1FF0-1FFF. There must be a banking scheme in use. - -Memory map guess -000-07F Stack (and user ram?) -080-0FF RAM (or devices?) -100-FFF ROM - -ToDo: -- Everything - -******************************************************************************************************/ - -#include "emu.h" -#include "cpu/m6805/m6805.h" - - -class m6805evs_state : public driver_device -{ -public: - m6805evs_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - -private: - required_device m_maincpu; - virtual void machine_reset(); -}; - - -static ADDRESS_MAP_START( m6805evs_mem, AS_PROGRAM, 8, m6805evs_state ) - AM_RANGE(0x0000, 0x00ff) AM_RAM - AM_RANGE(0x0100, 0x07ff) AM_ROM AM_REGION("roms", 0x1100) - AM_RANGE(0x0800, 0x0fef) AM_ROM AM_REGION("roms", 0x0800) - AM_RANGE(0x0ff0, 0x0fff) AM_ROM AM_REGION("roms", 0x1ff0) -ADDRESS_MAP_END - -static INPUT_PORTS_START( m6805evs ) -INPUT_PORTS_END - -void m6805evs_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( m6805evs, m6805evs_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68705, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(m6805evs_mem) -MACHINE_CONFIG_END - -ROM_START(m6805evs) - ROM_REGION(0x2000, "roms", 0) - ROM_LOAD( "evsbug12.bin", 0x0000, 0x2000, CRC(8b581aef) SHA1(eacf425cc8a042085ccc4097cc61570b633b1e38) ) -ROM_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1990, m6805evs, 0, 0, m6805evs, m6805evs, driver_device, 0, "Motorola", "M68HC05EVS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/m79152pc.c b/src/mess/drivers/m79152pc.c deleted file mode 100644 index cf8bf82d908..00000000000 --- a/src/mess/drivers/m79152pc.c +++ /dev/null @@ -1,145 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Mera-Elzab 79152pc - - This is terminal - - 29/12/2011 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - -class m79152pc_state : public driver_device -{ -public: - m79152pc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_videoram(*this, "p_videoram"), - m_p_attributes(*this, "p_attributes"), - m_maincpu(*this, "maincpu") { } - - UINT8 *m_p_chargen; - required_shared_ptr m_p_videoram; - required_shared_ptr m_p_attributes; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_m79152pc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(m79152pc_mem, AS_PROGRAM, 8, m79152pc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x8000, 0x8fff) AM_RAM AM_SHARE("p_videoram") - AM_RANGE(0x9000, 0x9fff) AM_RAM AM_SHARE("p_attributes") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( m79152pc_io, AS_IO, 8, m79152pc_state) - //ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( m79152pc ) -INPUT_PORTS_END - - -void m79152pc_state::machine_reset() -{ -} - -void m79152pc_state::video_start() -{ - m_p_chargen = memregion("chargen")->base()+4; -} - -UINT32 m79152pc_state::screen_update_m79152pc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -// Attributes are unknown so are not implemented - UINT8 y,ra,chr,gfx; //,attr; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 12; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 80; x++) - { - chr = m_p_videoram[x]; - //attr = m_p_attributes[x]; - gfx = m_p_chargen[(chr<<4) | ra ]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=80; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout m79152pc_charlayout = -{ - 8, 12, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( m79152pc ) - GFXDECODE_ENTRY( "chargen", 0x0000, m79152pc_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( m79152pc, m79152pc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(m79152pc_mem) - MCFG_CPU_IO_MAP(m79152pc_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 300) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 300-1) - MCFG_SCREEN_UPDATE_DRIVER(m79152pc_state, screen_update_m79152pc) - MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", m79152pc) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( m79152pc ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "left.bin", 0x0000, 0x4000, CRC(8cd677fc) SHA1(7ad28f3ba984383f24a36639ca27fc1eb5a5d002)) - - ROM_REGION( 0x1800, "chargen", ROMREGION_INVERT ) - ROM_LOAD( "right.bin", 0x0000, 0x1000, CRC(93f83fdc) SHA1(e8121b3d175c46c02828f43ec071a7d9c62e7c26)) // chargen - ROM_LOAD( "char.bin", 0x1000, 0x0800, CRC(da3792a5) SHA1(b4a4f0d61d8082b7909a346a5b01494c53cf8d05)) // unknown -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( ????, m79152pc, 0, 0, m79152pc, m79152pc, driver_device, 0, "Mera-Elzab", "MERA 79152 PC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mac.c b/src/mess/drivers/mac.c deleted file mode 100644 index 5ba63ada537..00000000000 --- a/src/mess/drivers/mac.c +++ /dev/null @@ -1,2482 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/**************************************************************************** - - drivers/mac.c - Macintosh family emulation - - Nate Woods, Raphael Nabet, R. Belmont - - 0x000000 - 0x3fffff RAM/ROM (switches based on overlay) - 0x400000 - 0x4fffff ROM - 0x580000 - 0x5fffff 5380 NCR/Symbios SCSI peripherals chip (Mac Plus only) - 0x600000 - 0x6fffff RAM - 0x800000 - 0x9fffff Zilog 8530 SCC (Serial Control Chip) Read - 0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Control Chip) Write - 0xc00000 - 0xdfffff IWM (Integrated Woz Machine; floppy) - 0xe80000 - 0xefffff Rockwell 6522 VIA - 0xf00000 - 0xffffef ??? (the ROM appears to be accessing here) - 0xfffff0 - 0xffffff Auto Vector - - - Interrupts: - M68K: - Level 1 from VIA - Level 2 from SCC - Level 4 : Interrupt switch (not implemented) - - VIA: - CA1 from VBLANK - CA2 from 1 Hz clock (RTC) - CB1 from Keyboard Clock - CB2 from Keyboard Data - SR from Keyboard Data Ready - - SCC: - PB_EXT from mouse Y circuitry - PA_EXT from mouse X circuitry - - NOTES: - - pmac6100: with recent PPC fixes now gets into the 68000 emulator and executes part of the 680x0 startup code. - 'g 6802c73c' to get to the interesting part (wait past the boot chime). PPC register r24 is the 68000 PC. - when the PC hits GetCPUID, the move.l (a2), d0 at PC = 0x10000 will cause an MMU fault (jump to 0xFFF00300). why? - a2 = 0x5ffffffc (the CPU ID register). MMU is unable to resolve this; defect in the MMU emulation probable. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "cpu/powerpc/ppc.h" -#include "cpu/m6805/m6805.h" -#include "machine/6522via.h" -#include "machine/applefdc.h" -#include "machine/swim.h" -#include "machine/sonydriv.h" -#include "formats/ap_dsk35.h" -#include "machine/ram.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsihd.h" -#include "bus/scsi/scsicd.h" -#include "sound/asc.h" -#include "sound/awacs.h" -#include "sound/cdda.h" - -// NuBus and 030/040 PDS cards -#include "bus/nubus/nubus_48gc.h" -#include "bus/nubus/nubus_cb264.h" -#include "bus/nubus/nubus_vikbw.h" -#include "bus/nubus/nubus_specpdq.h" -#include "bus/nubus/nubus_m2hires.h" -#include "bus/nubus/nubus_spec8.h" -#include "bus/nubus/nubus_radiustpd.h" -#include "bus/nubus/nubus_wsportrait.h" -#include "bus/nubus/nubus_asntmc3b.h" -#include "bus/nubus/nubus_image.h" -#include "bus/nubus/nubus_m2video.h" -#include "bus/nubus/pds30_cb264.h" -#include "bus/nubus/pds30_procolor816.h" -#include "bus/nubus/pds30_sigmalview.h" -#include "bus/nubus/pds30_30hr.h" -#include "bus/nubus/pds30_mc30.h" - -// 68000 PDS cards -#include "bus/macpds/pds_tpdfpd.h" - -#include "includes/mac.h" -#include "mac.lh" - -#define C7M (7833600) -#define C15M (C7M*2) -#define C32M (C15M*2) - -// do this here - screen_update is called each scanline when stepping in the -// debugger, which means you can't escape the VIA2 IRQ handler -// -// RBV/MDU bits in IER/IFR: -// -// CA1: any slot interrupt = 0x02 -// CA2: SCSI interrupt = 0x01 -// CB1: ASC interrupt = 0x10 - -INTERRUPT_GEN_MEMBER(mac_state::mac_rbv_vbl) -{ - m_rbv_regs[2] &= ~0x40; // set vblank signal - m_rbv_vbltime = 10; - -// printf("RBV: raising VBL!\n"); - - if (m_rbv_regs[0x12] & 0x40) - { - rbv_recalc_irqs(); - } -} - -READ32_MEMBER( mac_state::rbv_ramdac_r ) -{ - return 0; -} - -WRITE32_MEMBER( mac_state::rbv_ramdac_w ) -{ - if (!offset) - { - m_rbv_clutoffs = data>>24; - m_rbv_count = 0; - } - else - { - m_rbv_colors[m_rbv_count++] = data>>24; - - if (m_rbv_count == 3) - { - // for portrait display, force monochrome by using the blue channel - if (m_model != MODEL_MAC_CLASSIC_II) - { - // Color Classic has no MONTYPE so the default gets us 512x384, which is right - if ((m_montype ? m_montype->read() : 2) == 1) - { - m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2])); - m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]); - m_rbv_clutoffs++; - m_rbv_count = 0; - } - else - { - m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2])); - m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); - m_rbv_clutoffs++; - m_rbv_count = 0; - } - } - } - } -} - -WRITE32_MEMBER( mac_state::ariel_ramdac_w ) // this is for the "Ariel" style RAMDAC -{ - if (mem_mask == 0xff000000) - { - m_rbv_clutoffs = data>>24; - m_rbv_count = 0; - } - else if (mem_mask == 0x00ff0000) - { - m_rbv_colors[m_rbv_count++] = data>>16; - - if (m_rbv_count == 3) - { - // for portrait display, force monochrome by using the blue channel - if (m_model != MODEL_MAC_CLASSIC_II) - { - // Color Classic has no MONTYPE so the default gets us 512x384, which is right - if ((m_montype ? m_montype->read() : 2) == 1) - { - m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2])); - m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]); - m_rbv_clutoffs++; - m_rbv_count = 0; - } - else - { - m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2])); - m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); - m_rbv_clutoffs++; - m_rbv_count = 0; - } - } - } - } - else if (mem_mask == 0x0000ff00) - { - // config reg -// printf("Ariel: %02x to config\n", (data>>8)&0xff); - } - else // color key reg - { - } -} - -READ8_MEMBER( mac_state::mac_sonora_vctl_r ) -{ - if (offset == 2) - { -// printf("Sonora: read monitor ID at PC=%x\n", m_maincpu->pc()); - return ((m_montype ? m_montype->read() : 6)<<4); - } - - return m_sonora_vctl[offset]; -} - -WRITE8_MEMBER( mac_state::mac_sonora_vctl_w ) -{ -// printf("Sonora: %02x to vctl %x\n", data, offset); - m_sonora_vctl[offset] = data; -} - -void mac_state::rbv_recalc_irqs() -{ - // check slot interrupts and bubble them down to IFR - UINT8 slot_irqs = (~m_rbv_regs[2]) & 0x78; - slot_irqs &= (m_rbv_regs[0x12] & 0x78); - - if (slot_irqs) - { - m_rbv_regs[3] |= 2; // any slot - } - else // no slot irqs, clear the pending bit - { - m_rbv_regs[3] &= ~2; // any slot - } - - UINT8 ifr = (m_rbv_regs[3] & m_rbv_ier) & 0x1b; //m_rbv_regs[0x13]); - -// printf("ifr = %02x (reg3 %02x reg13 %02x)\n", ifr, m_rbv_regs[3], m_rbv_regs[0x13]); - if (ifr != 0) - { - m_rbv_regs[3] = ifr | 0x80; - m_rbv_ifr = ifr | 0x80; - -// printf("VIA2 raise\n"); - set_via2_interrupt(1); - } - else - { -// printf("VIA2 lower\n"); - set_via2_interrupt(0); - } -} - -READ8_MEMBER ( mac_state::mac_rbv_r ) -{ - int data = 0; - - if (offset < 0x100) - { - data = m_rbv_regs[offset]; - - if (offset == 0x10) - { - data &= ~0x38; - data |= ((m_montype ? m_montype->read() : 2)<<3); -// printf("rbv_r montype: %02x (PC %x)\n", data, space.cpu->safe_pc()); - } - - // bit 7 of these registers always reads as 0 on RBV - if ((offset == 0x12) || (offset == 0x13)) - { - data &= ~0x80; - } - } - else - { - offset >>= 9; - - switch (offset) - { - case 13: // IFR -// printf("Read IER = %02x (PC=%x) 2=%02x\n", m_rbv_ier, m_maincpu->pc(), m_rbv_regs[2]); - data = m_rbv_ifr; - break; - - case 14: // IER -// printf("Read IFR = %02x (PC=%x) 2=%02x\n", m_rbv_ifr, m_maincpu->pc(), m_rbv_regs[2]); - data = m_rbv_ier; - break; - - default: - logerror("rbv_r: Unknown extended RBV VIA register %d access\n", offset); - break; - } - } - -// printf("rbv_r: %x = %02x (PC=%x)\n", offset, data, m_maincpu->pc()); - - return data; -} - -WRITE8_MEMBER ( mac_state::mac_rbv_w ) -{ - if (offset < 0x100) - { -// if (offset == 0x10) -// printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, m_maincpu->pc()); - switch (offset) - { - case 0x00: - if (m_model == MODEL_MAC_LC) - { - m68000_base_device *m68k = downcast(m_maincpu.target()); - m68k->set_hmmu_enable((data & 0x8) ? M68K_HMMU_DISABLE : M68K_HMMU_ENABLE_LC); - } - break; - - case 0x01: - if (((data & 0xc0) != (m_rbv_regs[1] & 0xc0)) && (m_rbv_type == RBV_TYPE_V8)) - { - m_rbv_regs[1] = data; - this->v8_resize(); - } - break; - - case 0x02: - data &= 0x40; - m_rbv_regs[offset] &= ~data; - rbv_recalc_irqs(); - break; - - case 0x03: // write here to ack - if (data & 0x80) // 1 bits write 1s - { - m_rbv_regs[offset] |= data & 0x7f; - m_rbv_ifr |= data & 0x7f; - } - else // 1 bits write 0s - { - m_rbv_regs[offset] &= ~(data & 0x7f); - m_rbv_ifr &= ~(data & 0x7f); - } - rbv_recalc_irqs(); - break; - - case 0x10: - if (data != 0) - { - m_rbv_immed10wr = 1; - } - m_rbv_regs[offset] = data; - break; - - case 0x12: - if (data & 0x80) // 1 bits write 1s - { - m_rbv_regs[offset] |= data & 0x7f; - } - else // 1 bits write 0s - { - m_rbv_regs[offset] &= ~(data & 0x7f); - } - rbv_recalc_irqs(); - break; - - case 0x13: - if (data & 0x80) // 1 bits write 1s - { - m_rbv_regs[offset] |= data & 0x7f; - - if (data == 0xff) m_rbv_regs[offset] = 0x1f; // I don't know why this is special, but the IIci ROM's POST demands it - } - else // 1 bits write 0s - { - m_rbv_regs[offset] &= ~(data & 0x7f); - } - break; - - default: - m_rbv_regs[offset] = data; - break; - } - } - else - { - offset >>= 9; - - switch (offset) - { - case 13: // IFR -// printf("%02x to IFR (PC=%x)\n", data, m_maincpu->pc()); - if (data & 0x80) - { - data = 0x7f; - } - rbv_recalc_irqs(); - break; - - case 14: // IER -// printf("%02x to IER (PC=%x)\n", data, m_maincpu->pc()); - if (data & 0x80) // 1 bits write 1s - { - m_rbv_ier |= data & 0x7f; - } - else // 1 bits write 0s - { - m_rbv_ier &= ~(data & 0x7f); - } - rbv_recalc_irqs(); - break; - - default: - logerror("rbv_w: Unknown extended RBV VIA register %d access\n", offset); - break; - } - } -} - -// Portable/PB100 video -VIDEO_START_MEMBER(mac_state,macprtb) -{ -} - -READ16_MEMBER(mac_state::mac_config_r) -{ - return 0xffff; // returns nonzero if no PDS RAM expansion, 0 if present -} - -// IIfx -READ32_MEMBER(mac_state::biu_r) -{ -// printf("biu_r @ %x, mask %08x\n", offset, mem_mask); - return 0; -} - -WRITE32_MEMBER(mac_state::biu_w) -{ -// printf("biu_w %x @ %x, mask %08x\n", data, offset, mem_mask); -} - -READ8_MEMBER(mac_state::oss_r) -{ -// printf("oss_r @ %x\n", offset); -// if (offset <= 0xe) // for interrupt mask registers, we're intended to return something different than is written in the low 3 bits (?) -// { -// return m_oss_regs[offset]<<4; -// } - - return m_oss_regs[offset]; -} - -WRITE8_MEMBER(mac_state::oss_w) -{ -// printf("oss_w %x @ %x\n", data, offset); - m_oss_regs[offset] = data; -} - -READ32_MEMBER(mac_state::buserror_r) -{ - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - return 0; -} - -READ8_MEMBER(mac_state::scciop_r) -{ -// printf("scciop_r @ %x (PC=%x)\n", offset, m_maincpu->pc()); - return 0; -} - -WRITE8_MEMBER(mac_state::scciop_w) -{ -// printf("scciop_w %x @ %x (PC=%x)\n", data, offset, m_maincpu->pc()); -} - -READ8_MEMBER(mac_state::swimiop_r) -{ -// printf("swimiop_r @ %x (PC=%x)\n", offset, m_maincpu->pc()); - return 0; -} - -WRITE8_MEMBER(mac_state::swimiop_w) -{ -// printf("swimiop_w %x @ %x (PC=%x)\n", data, offset, m_maincpu->pc()); -} - -READ8_MEMBER(mac_state::pmac_diag_r) -{ - switch (offset) - { - case 0: // return 0 here to get the 'car crash' sound after the boot bong, 1 otherwise - return 1; - } - - return 0; -} - -READ8_MEMBER(mac_state::amic_dma_r) -{ - return 0; -} - -WRITE8_MEMBER(mac_state::amic_dma_w) -{ -// printf("amic_dma_w: %02x at %x (PC=%x)\n", data, offset+0x1000, m_maincpu->pc()); -} - -// HMC has one register: a 35-bit shift register which is accessed one bit at a time (see pmac6100 code at 4030383c which makes this obvious) -READ8_MEMBER(mac_state::hmc_r) -{ - UINT8 rv = (UINT8)(m_hmc_shiftout&1); - m_hmc_shiftout>>= 1; - return rv; -} - -WRITE8_MEMBER(mac_state::hmc_w) -{ - // writes to xxx8 reset the bit shift position - if ((offset&0x8) == 8) - { - m_hmc_shiftout = m_hmc_reg; - } - else - { - UINT64 temp = (data & 1) ? U64(0x400000000) : U64(0x0); - m_hmc_reg >>= 1; - m_hmc_reg |= temp; - } -} - -READ8_MEMBER(mac_state::mac_gsc_r) -{ - if (offset == 1) - { - return 5; - } - - return 0; -} - -WRITE8_MEMBER(mac_state::mac_gsc_w) -{ -} - -READ8_MEMBER(mac_state::mac_5396_r) -{ - if (offset < 0x100) - { - return m_539x_1->read(space, offset>>4); - } - else // pseudo-DMA: read from the FIFO - { - return m_539x_1->read(space, 2); - } - - // never executed - //return 0; -} - -WRITE8_MEMBER(mac_state::mac_5396_w) -{ - if (offset < 0x100) - { - m_539x_1->write(space, offset>>4, data); - } - else // pseudo-DMA: write to the FIFO - { - m_539x_1->write(space, 2, data); - } -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START(mac512ke_map, AS_PROGRAM, 16, mac_state ) - AM_RANGE(0x800000, 0x9fffff) AM_READ(mac_scc_r) - AM_RANGE(0xa00000, 0xbfffff) AM_WRITE(mac_scc_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) - AM_RANGE(0xe80000, 0xefffff) AM_READWRITE(mac_via_r, mac_via_w) - AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(macplus_map, AS_PROGRAM, 16, mac_state ) - AM_RANGE(0x580000, 0x5fffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w) - AM_RANGE(0x800000, 0x9fffff) AM_READ(mac_scc_r) - AM_RANGE(0xa00000, 0xbfffff) AM_WRITE(mac_scc_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) - AM_RANGE(0xe80000, 0xefffff) AM_READWRITE(mac_via_r, mac_via_w) - AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(macse_map, AS_PROGRAM, 16, mac_state ) - AM_RANGE(0x580000, 0x5fffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w) - AM_RANGE(0x900000, 0x9fffff) AM_READ(mac_scc_r) - AM_RANGE(0xb00000, 0xbfffff) AM_WRITE(mac_scc_w) - AM_RANGE(0xd00000, 0xdfffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) - AM_RANGE(0xe80000, 0xefffff) AM_READWRITE(mac_via_r, mac_via_w) - AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(macprtb_map, AS_PROGRAM, 16, mac_state ) - AM_RANGE(0x900000, 0x93ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0c0000) - AM_RANGE(0xf60000, 0xf6ffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) - AM_RANGE(0xf70000, 0xf7ffff) AM_READWRITE(mac_via_r, mac_via_w) - AM_RANGE(0xf90000, 0xf9ffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w) - AM_RANGE(0xfa8000, 0xfaffff) AM_RAM AM_SHARE("vram16") // VRAM - AM_RANGE(0xfb0000, 0xfbffff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffff) - AM_RANGE(0xfc0000, 0xfcffff) AM_READ(mac_config_r) - AM_RANGE(0xfd0000, 0xfdffff) AM_READWRITE(mac_scc_r, mac_scc_2_w) - AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(maclc_map, AS_PROGRAM, 32, mac_state ) - ADDRESS_MAP_GLOBAL_MASK(0x80ffffff) // V8 uses bit 31 and 23-0 for address decoding only - - AM_RANGE(0xa00000, 0xafffff) AM_ROM AM_REGION("bootrom", 0) // ROM (in 32-bit mode) - - AM_RANGE(0xf00000, 0xf01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) - AM_RANGE(0xf04000, 0xf05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) - AM_RANGE(0xf06000, 0xf07fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) - AM_RANGE(0xf10000, 0xf11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) - AM_RANGE(0xf12000, 0xf13fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) - AM_RANGE(0xf14000, 0xf15fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) - AM_RANGE(0xf16000, 0xf17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) - AM_RANGE(0xf24000, 0xf24003) AM_READWRITE(rbv_ramdac_r, ariel_ramdac_w) - AM_RANGE(0xf26000, 0xf27fff) AM_READWRITE8(mac_rbv_r, mac_rbv_w, 0xffffffff) // VIA2 (V8) - AM_RANGE(0xf40000, 0xfbffff) AM_RAM AM_SHARE("vram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(maclc3_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) - - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50006000, 0x50007fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x00f00000) - AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50012000, 0x50013fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x00f00000) - AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50024000, 0x50025fff) AM_WRITE( ariel_ramdac_w ) AM_MIRROR(0x00f00000) - AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE8(mac_rbv_r, mac_rbv_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50028000, 0x50028003) AM_READWRITE8(mac_sonora_vctl_r, mac_sonora_vctl_w, 0xffffffff) AM_MIRROR(0x00f00000) - - AM_RANGE(0x5ffffffc, 0x5fffffff) AM_READ(mac_read_id) - - AM_RANGE(0x60000000, 0x600fffff) AM_RAM AM_MIRROR(0x0ff00000) AM_SHARE("vram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(macii_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ffc0000) - - // MMU remaps I/O without the F - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50006000, 0x50006003) AM_WRITE(macii_scsi_drq_w) AM_MIRROR(0x00f00000) - AM_RANGE(0x50006060, 0x50006063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) - AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) - AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(maciici_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x4007ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff80000) - - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50006000, 0x50007fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x00f00000) - AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) - AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50024000, 0x50024007) AM_WRITE( rbv_ramdac_w ) AM_MIRROR(0x00f00000) - AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE8(mac_rbv_r, mac_rbv_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(macse30_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x4003ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ffc0000) - - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50006000, 0x50007fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x00f00000) - AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) - AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) // mirror - - AM_RANGE(0xfe000000, 0xfe00ffff) AM_RAM AM_SHARE("vram") - AM_RANGE(0xfee00000, 0xfee0ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x000f0000) - AM_RANGE(0xfeffe000, 0xfeffffff) AM_ROM AM_REGION("se30vrom", 0x0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(maciifx_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x4007ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff80000) - - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE8(scciop_r, scciop_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x5000a000, 0x5000bfff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x5000c060, 0x5000c063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) - AM_RANGE(0x5000d000, 0x5000d003) AM_WRITE(macii_scsi_drq_w) AM_MIRROR(0x00f00000) - AM_RANGE(0x5000d060, 0x5000d063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x00f00000) - AM_RANGE(0x50010000, 0x50011fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50012000, 0x50013fff) AM_READWRITE8(swimiop_r, swimiop_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50018000, 0x50019fff) AM_READWRITE(biu_r, biu_w) AM_MIRROR(0x00f00000) - AM_RANGE(0x5001a000, 0x5001bfff) AM_READWRITE8(oss_r, oss_w, 0xffffffff) AM_MIRROR(0x00f00000) - AM_RANGE(0x50024000, 0x50027fff) AM_READ(buserror_r) AM_MIRROR(0x00f00000) // must bus error on access here so ROM can determine we're an FMC - AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) -ADDRESS_MAP_END - -// ROM detects the "Jaws" ASIC by checking for I/O space mirrored at 0x01000000 boundries -static ADDRESS_MAP_START(macpb140_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) - - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x01f00000) - AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x01f00000) - AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x01f00000) - AM_RANGE(0x50006000, 0x50007fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) AM_MIRROR(0x01f00000) - AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) AM_MIRROR(0x01f00000) - AM_RANGE(0x50012060, 0x50012063) AM_READ(macii_scsi_drq_r) AM_MIRROR(0x01f00000) - AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x01f00000) - AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x01f00000) - AM_RANGE(0x50024000, 0x50027fff) AM_READ(buserror_r) AM_MIRROR(0x01f00000) // bus error here to make sure we aren't mistaken for another decoder - - AM_RANGE(0xfee08000, 0xfeffffff) AM_RAM AM_SHARE("vram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(macpb160_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) - - AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) - AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) - AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) - AM_RANGE(0x50f06000, 0x50f07fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) - AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) - AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r) - AM_RANGE(0x50f14000, 0x50f15fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) - AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) - AM_RANGE(0x50f20000, 0x50f21fff) AM_READWRITE8(mac_gsc_r, mac_gsc_w, 0xffffffff) - AM_RANGE(0x50f24000, 0x50f27fff) AM_READ(buserror_r) // bus error here to make sure we aren't mistaken for another decoder - - AM_RANGE(0x60000000, 0x6001ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x0ffe0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(macpb165c_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) - - AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) - AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) - AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) - AM_RANGE(0x50f06000, 0x50f07fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) - AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) - AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r) - AM_RANGE(0x50f14000, 0x50f15fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) - AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) - AM_RANGE(0x50f20000, 0x50f21fff) AM_READ(buserror_r) // bus error here to detect we're not the grayscale 160/165/180 - AM_RANGE(0x50f24000, 0x50f27fff) AM_READ(buserror_r) // bus error here to make sure we aren't mistaken for another decoder - - // on-board color video on 165c/180c - AM_RANGE(0xfc000000, 0xfc07ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x00380000) // 512k of VRAM - AM_RANGE(0xfc400000, 0xfcefffff) AM_READWRITE(macwd_r, macwd_w) -// fc4003c8 = DAC control, fc4003c9 = DAC data -// fc4003da bit 3 is VBL - AM_RANGE(0xfcff8000, 0xfcffffff) AM_ROM AM_REGION("vrom", 0x0000) -ADDRESS_MAP_END -#if 0 -static ADDRESS_MAP_START(macpd210_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) - - AM_RANGE(0x50f00000, 0x50f01fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) - AM_RANGE(0x50f02000, 0x50f03fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) - AM_RANGE(0x50f04000, 0x50f05fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) - AM_RANGE(0x50f06000, 0x50f07fff) AM_READWRITE(macii_scsi_drq_r, macii_scsi_drq_w) - AM_RANGE(0x50f10000, 0x50f11fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffff) - AM_RANGE(0x50f12060, 0x50f12063) AM_READ(macii_scsi_drq_r) - AM_RANGE(0x50f14000, 0x50f15fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) - AM_RANGE(0x50f16000, 0x50f17fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) - AM_RANGE(0x50f20000, 0x50f21fff) AM_READWRITE8(mac_gsc_r, mac_gsc_w, 0xffffffff) - AM_RANGE(0x50f24000, 0x50f27fff) AM_READ(buserror_r) // bus error here to make sure we aren't mistaken for another decoder - - AM_RANGE(0x5ffffffc, 0x5fffffff) AM_READ(mac_read_id) - - AM_RANGE(0x60000000, 0x6001ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x0ffe0000) -ADDRESS_MAP_END -#endif -static ADDRESS_MAP_START(quadra700_map, AS_PROGRAM, 32, mac_state ) - AM_RANGE(0x40000000, 0x400fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0ff00000) - - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00fc0000) - AM_RANGE(0x50002000, 0x50003fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffff) AM_MIRROR(0x00fc0000) -// 50008000 = Ethernet MAC ID PROM -// 5000a000 = Sonic (DP83932) ethernet -// 5000f000 = SCSI cf96, 5000f402 = SCSI #2 cf96 - AM_RANGE(0x5000f000, 0x5000f3ff) AM_READWRITE8(mac_5396_r, mac_5396_w, 0xffffffff) AM_MIRROR(0x00fc0000) - AM_RANGE(0x5000c000, 0x5000dfff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffff) AM_MIRROR(0x00fc0000) - AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("asc", asc_device, read, write, 0xffffffff) AM_MIRROR(0x00fc0000) - AM_RANGE(0x5001e000, 0x5001ffff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffff) AM_MIRROR(0x00fc0000) - - AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00fc0000) - // f9800000 = VDAC / DAFB - AM_RANGE(0xf9000000, 0xf91fffff) AM_RAM AM_SHARE("vram") - AM_RANGE(0xf9800000, 0xf98001ff) AM_READWRITE(dafb_r, dafb_w) - AM_RANGE(0xf9800200, 0xf980023f) AM_READWRITE(dafb_dac_r, dafb_dac_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pwrmac_map, AS_PROGRAM, 64, mac_state ) - AM_RANGE(0x00000000, 0x007fffff) AM_RAM // 8 MB standard - - AM_RANGE(0x40000000, 0x403fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0fc00000) - - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - // 50008000 = ethernet ID PROM - // 5000a000 = MACE ethernet controller - AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - // 50014000 = sound registers (AWACS) - AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("awacs", awacs_device, read, write, U64(0xffffffffffffffff)) AM_MIRROR(0x01f00000) - AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50024000, 0x50025fff) AM_WRITE32( ariel_ramdac_w, U64(0xffffffffffffffff) ) AM_MIRROR(0x00f00000) - AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE16(mac_via2_r, mac_via2_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50028000, 0x50028007) AM_READWRITE8(mac_sonora_vctl_r, mac_sonora_vctl_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - // 5002a000 = interrupt controller - // 5002c000 = diagnostic registers - AM_RANGE(0x5002c000, 0x5002dfff) AM_READ8(pmac_diag_r, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50031000, 0x50032fff) AM_READWRITE8(amic_dma_r, amic_dma_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50040000, 0x5004000f) AM_READWRITE8(hmc_r, hmc_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x5ffffff8, 0x5fffffff) AM_READ32(mac_read_id, U64(0xffffffffffffffff)) - - AM_RANGE(0xffc00000, 0xffffffff) AM_ROM AM_REGION("bootrom", 0) -ADDRESS_MAP_END - -/*************************************************************************** - DEVICE CONFIG -***************************************************************************/ - -static const applefdc_interface mac_iwm_interface = -{ - sony_set_lines, - mac_fdc_set_enable_lines, - - sony_read_data, - sony_write_data, - sony_read_status -}; - -static SLOT_INTERFACE_START(mac_nubus_cards) - SLOT_INTERFACE("m2video", NUBUS_M2VIDEO) /* Apple Macintosh II Video Card */ - SLOT_INTERFACE("48gc", NUBUS_48GC) /* Apple 4*8 Graphics Card */ - SLOT_INTERFACE("824gc", NUBUS_824GC) /* Apple 8*24 Graphics Card */ - SLOT_INTERFACE("cb264", NUBUS_CB264) /* RasterOps ColorBoard 264 */ - SLOT_INTERFACE("vikbw", NUBUS_VIKBW) /* Moniterm Viking board */ - SLOT_INTERFACE("image", NUBUS_IMAGE) /* Disk Image Pseudo-Card */ - SLOT_INTERFACE("specpdq", NUBUS_SPECPDQ) /* SuperMac Spectrum PDQ */ - SLOT_INTERFACE("m2hires", NUBUS_M2HIRES) /* Apple Macintosh II Hi-Resolution Card */ - SLOT_INTERFACE("spec8s3", NUBUS_SPEC8S3) /* SuperMac Spectrum/8 Series III */ -// SLOT_INTERFACE("thundergx", NUBUS_THUNDERGX) /* Radius Thunder GX (not yet) */ - SLOT_INTERFACE("radiustpd", NUBUS_RADIUSTPD) /* Radius Two Page Display */ - SLOT_INTERFACE("asmc3nb", NUBUS_ASNTMC3NB) /* Asante MC3NB Ethernet card */ - SLOT_INTERFACE("portrait", NUBUS_WSPORTRAIT) /* Apple Macintosh II Portrait video card */ - SLOT_INTERFACE("enetnb", NUBUS_APPLEENET) /* Apple NuBus Ethernet */ -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(mac_pds030_cards) - SLOT_INTERFACE("cb264", PDS030_CB264SE30) // RasterOps Colorboard 264/SE30 - SLOT_INTERFACE("pc816", PDS030_PROCOLOR816) // Lapis ProColor Server 8*16 PDS - SLOT_INTERFACE("lview", PDS030_LVIEW) // Sigma Designs L-View - SLOT_INTERFACE("30hr", PDS030_XCEED30HR) // Micron/XCEED Technology Color 30HR - SLOT_INTERFACE("mc30", PDS030_XCEEDMC30) // Micron/XCEED Technology MacroColor 30 -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(mac_sepds_cards) - SLOT_INTERFACE("radiusfpd", PDS_SEDISPLAY) // Radius Full Page Display card for SE -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(mac_lcpds_cards) -SLOT_INTERFACE_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static const floppy_interface mac_floppy_interface = -{ - FLOPPY_STANDARD_3_5_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(apple35_mac), - "floppy_3_5" -}; - -static MACHINE_CONFIG_START( mac512ke, mac_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, C7M) /* 7.8336 MHz */ - MCFG_CPU_PROGRAM_MAP(mac512ke_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_REFRESH_RATE(60.15) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_SIZE(MAC_H_TOTAL, MAC_V_TOTAL) - MCFG_SCREEN_VISIBLE_AREA(0, MAC_H_VIS-1, 0, MAC_V_VIS-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_mac) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(mac_state,mac) - - MCFG_VIDEO_START_OVERRIDE(mac_state,mac) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", MAC_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) - MCFG_IWM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - MCFG_MACKBD_ADD(MACKBD_TAG) -#ifdef MAC_USE_EMULATED_KBD - MCFG_MACKBD_DATAOUT_HANDLER(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) - MCFG_MACKBD_CLKOUT_HANDLER(WRITELINE(mac_state, mac_kbd_clk_in)) -#endif - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mac128k, mac512ke ) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( macplus, mac512ke ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(macplus_map) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) - - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_MODIFY(mac_floppy_interface) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("1M,2M,2560K,4M") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( macse, macplus ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(macse_map) - - MCFG_DEVICE_REMOVE("via6522_0") - MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("2M,2560K,4M") - - MCFG_MACKBD_REMOVE(MACKBD_TAG) - - MCFG_MACPDS_BUS_ADD("sepds", "maincpu") - MCFG_MACPDS_SLOT_ADD("sepds", "pds", mac_sepds_cards, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( macclasc, macplus ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(macse_map) - - MCFG_DEVICE_REMOVE("via6522_0") - MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("2M,2560K,4M") - - MCFG_MACKBD_REMOVE(MACKBD_TAG) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( macprtb, mac_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, C15M) - MCFG_CPU_PROGRAM_MAP(macprtb_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_REFRESH_RATE(60.15) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_SIZE(700, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macprtb) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(mac_state,mac) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* devices */ - MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) - - MCFG_IWM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a_pmu)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b_pmu)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a_pmu)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_pmu)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1M") - MCFG_RAM_EXTRA_OPTIONS("1M,3M,5M,7M,9M") - - // software list - MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( macii, mac_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68020PMMU, C15M) - MCFG_CPU_PROGRAM_MAP(macii_map) - - MCFG_PALETTE_ADD("palette", 256) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* devices */ - MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) - MCFG_DEVICE_ADD("nubus", NUBUS, 0) - MCFG_NUBUS_CPU("maincpu") - MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) - MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) - MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) - MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) - MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) - MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) - MCFG_NUBUS_SLOT_ADD("nubus","nb9", mac_nubus_cards, "48gc") - MCFG_NUBUS_SLOT_ADD("nubus","nba", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbb", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbc", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "cdrom", SCSICD, SCSI_ID_4) - - MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) - - MCFG_IWM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, C7M/10) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("8M,32M,64M,96M,128M") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maciihmu, macii ) - MCFG_CPU_REPLACE("maincpu", M68020HMMU, C15M) - MCFG_CPU_PROGRAM_MAP(macii_map) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( maciifx, mac_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68030, 40000000) - MCFG_CPU_PROGRAM_MAP(maciifx_map) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* devices */ - MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) - MCFG_DEVICE_ADD("nubus", NUBUS, 0) - MCFG_NUBUS_CPU("maincpu") - MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) - MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) - MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) - MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) - MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) - MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) - MCFG_NUBUS_SLOT_ADD("nubus","nb9", mac_nubus_cards, "48gc") - MCFG_NUBUS_SLOT_ADD("nubus","nba", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbb", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbc", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) - - MCFG_IWM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,64M,96M,128M") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maclc, macii ) - - MCFG_CPU_REPLACE("maincpu", M68020HMMU, C15M) - MCFG_CPU_PROGRAM_MAP(maclc_map) - MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(256) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macv8) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) - - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) - MCFG_SCREEN_SIZE(1024,768) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macv8) - MCFG_DEFAULT_LAYOUT(layout_mac) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("4M,6M,8M,10M") - - MCFG_DEVICE_MODIFY("via6522_0") - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_egadb)) - - MCFG_NUBUS_SLOT_REMOVE("nb9") - MCFG_NUBUS_SLOT_REMOVE("nba") - MCFG_NUBUS_SLOT_REMOVE("nbb") - MCFG_NUBUS_SLOT_REMOVE("nbc") - MCFG_NUBUS_SLOT_REMOVE("nbd") - MCFG_NUBUS_SLOT_REMOVE("nbe") - MCFG_DEVICE_REMOVE("nubus") - - MCFG_DEVICE_ADD("pds", NUBUS, 0) - MCFG_NUBUS_CPU("maincpu") - MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) - MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) - MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) - MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) - MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) - MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) - MCFG_NUBUS_SLOT_ADD("pds","lcpds", mac_lcpds_cards, NULL) - - MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_V8, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_EGRET_ADD(EGRET_341S0850) - MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) - MCFG_QUANTUM_PERFECT_CPU("maincpu") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maclc2, maclc ) - - MCFG_CPU_REPLACE("maincpu", M68030, C15M) - MCFG_CPU_PROGRAM_MAP(maclc_map) - MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("6M,8M,10M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maccclas, maclc2 ) - - MCFG_EGRET_REMOVE() - MCFG_CUDA_ADD(CUDA_341S0788) // should be 0417, but that version won't sync up properly with the '030 right now - MCFG_CUDA_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_CUDA_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_CUDA_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_CUDA_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) - - MCFG_DEVICE_MODIFY("via6522_0") - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_cdadb)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maclc3, maclc ) - - MCFG_CPU_REPLACE("maincpu", M68030, 25000000) - MCFG_CPU_PROGRAM_MAP(maclc3_map) - MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macsonora) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macsonora) - - MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macsonora) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,48M,64M,80M") - - MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_SONORA, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_EGRET_REPLACE(EGRET_341S0851) - MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maclc520, maclc3 ) - - MCFG_EGRET_REMOVE() - MCFG_CUDA_ADD(CUDA_341S0060) - MCFG_CUDA_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_CUDA_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_CUDA_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_CUDA_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) - - MCFG_DEVICE_MODIFY("via6522_0") - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_cdadb)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maciivx, maclc ) - - MCFG_CPU_REPLACE("maincpu", M68030, C32M) - MCFG_CPU_PROGRAM_MAP(maclc3_map) - MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macv8) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) - - MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbvvram) - - MCFG_DEVICE_ADD("nubus", NUBUS, 0) - MCFG_NUBUS_CPU("maincpu") - MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) - MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) - MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) - MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) - MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) - MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) - MCFG_NUBUS_SLOT_ADD("nubus","nbc", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M,28M,32M,36M,40M,44M,48M,52M,56M,60M,64M") - - MCFG_EGRET_REPLACE(EGRET_341S0851) - MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maciivi, maclc ) - - MCFG_CPU_REPLACE("maincpu", M68030, C15M) - MCFG_CPU_PROGRAM_MAP(maclc3_map) - MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macv8) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) - - MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbvvram) - - MCFG_DEVICE_ADD("nubus", NUBUS, 0) - MCFG_NUBUS_CPU("maincpu") - MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) - MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) - MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) - MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) - MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) - MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) - MCFG_NUBUS_SLOT_ADD("nubus","nbc", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M,28M,32M,36M,40M,44M,48M,52M,56M,60M,64M") - - MCFG_EGRET_REPLACE(EGRET_341S0851) - MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maciix, macii ) - - MCFG_CPU_REPLACE("maincpu", M68030, C15M) - MCFG_CPU_PROGRAM_MAP(macii_map) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("8M,32M,64M,96M,128M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maciicx, maciix ) // IIcx is a IIx with only slots 9/a/b - MCFG_NUBUS_SLOT_REMOVE("nbc") - MCFG_NUBUS_SLOT_REMOVE("nbd") - MCFG_NUBUS_SLOT_REMOVE("nbe") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( macse30, mac_state ) - - MCFG_CPU_ADD("maincpu", M68030, C15M) - MCFG_CPU_PROGRAM_MAP(macse30_map) - - /* video hardware */ - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_REFRESH_RATE(60.15) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) - MCFG_SCREEN_SIZE(MAC_H_TOTAL, MAC_V_TOTAL) - MCFG_SCREEN_VISIBLE_AREA(0, MAC_H_VIS-1, 0, MAC_V_VIS-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macse30) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(mac_state,mac) - - MCFG_VIDEO_START_OVERRIDE(mac_state,mac) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* devices */ - MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) - - MCFG_DEVICE_ADD("pdss", NUBUS, 0) - MCFG_NUBUS_CPU("maincpu") - MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) - MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) - MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) - MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) - MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) - MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) - MCFG_NUBUS_SLOT_ADD("pds","pds030", mac_pds030_cards, NULL) - - MCFG_SWIM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,48M,64M,96M,128M") - - MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( macpb140, mac_state ) - - MCFG_CPU_ADD("maincpu", M68030, C15M) - MCFG_CPU_PROGRAM_MAP(macpb140_map) - - /* video hardware */ - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_REFRESH_RATE(60.15) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) - MCFG_SCREEN_SIZE(700, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macpb140) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(mac_state,mac) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* devices */ - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) - - MCFG_SWIM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b_via2pmu)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_via2pmu)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a_pmu)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b_pmu)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a_pmu)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b_pmu)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("4M,6M,8M") - - MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") -MACHINE_CONFIG_END - -// PowerBook 145 = 140 @ 25 MHz (still 2MB RAM - the 145B upped that to 4MB) -static MACHINE_CONFIG_DERIVED( macpb145, macpb140 ) - MCFG_CPU_REPLACE("maincpu", M68030, 25000000) - MCFG_CPU_PROGRAM_MAP(macpb140_map) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("6M,8M") -MACHINE_CONFIG_END - -// PowerBook 170 = 140 @ 25 MHz with an active-matrix LCD (140/145/145B were passive) -static MACHINE_CONFIG_DERIVED( macpb170, macpb140 ) - MCFG_CPU_REPLACE("maincpu", M68030, 25000000) - MCFG_CPU_PROGRAM_MAP(macpb140_map) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("6M,8M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( macpb160, mac_state ) - - MCFG_CPU_ADD("maincpu", M68030, 25000000) - MCFG_CPU_PROGRAM_MAP(macpb160_map) - - /* video hardware */ - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_REFRESH_RATE(60.15) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) - MCFG_SCREEN_SIZE(700, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macpb160) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(mac_state,macgsc) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_ASC_ADD("asc", C15M, ASC_TYPE_ASC, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* devices */ - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) - - MCFG_SWIM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b_via2pmu)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_via2pmu)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a_pmu)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b_pmu)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a_pmu)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b_pmu)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M") - - MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( macpb180, macpb160 ) - MCFG_CPU_REPLACE("maincpu", M68030, 33000000) - MCFG_CPU_PROGRAM_MAP(macpb160_map) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( macpb180c, macpb160 ) - MCFG_CPU_REPLACE("maincpu", M68030, 33000000) - MCFG_CPU_PROGRAM_MAP(macpb165c_map) - - MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) - MCFG_SCREEN_SIZE(800, 525) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macpbwd) - MCFG_SCREEN_NO_PALETTE - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M") -MACHINE_CONFIG_END -#if 0 -static MACHINE_CONFIG_DERIVED( macpd210, macpb160 ) - MCFG_CPU_REPLACE("maincpu", M68030, 25000000) - MCFG_CPU_PROGRAM_MAP(macpd210_map) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,12M,16M,20M,24M") -MACHINE_CONFIG_END -#endif -static MACHINE_CONFIG_DERIVED( macclas2, maclc ) - MCFG_CPU_REPLACE("maincpu", M68030, C15M) - MCFG_CPU_PROGRAM_MAP(maclc_map) - MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macv8) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,maceagle) - - MCFG_SCREEN_MODIFY(MAC_SCREEN_NAME) - MCFG_SCREEN_SIZE(MAC_H_TOTAL, MAC_V_TOTAL) - MCFG_SCREEN_VISIBLE_AREA(0, MAC_H_VIS-1, 0, MAC_V_VIS-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv) - - MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_EAGLE, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("10M") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,6M,8M,10M") - - MCFG_EGRET_REPLACE(EGRET_341S0851) - MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maciici, macii ) - - MCFG_CPU_REPLACE("maincpu", M68030, 25000000) - MCFG_CPU_PROGRAM_MAP(maciici_map) - MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(256) - - // IIci only has slots c/d/e - MCFG_NUBUS_SLOT_REMOVE("nb9") - MCFG_NUBUS_SLOT_REMOVE("nba") - MCFG_NUBUS_SLOT_REMOVE("nbb") - - MCFG_VIDEO_START_OVERRIDE(mac_state,macrbv) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) - - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) - MCFG_SCREEN_SIZE(640, 870) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv) - MCFG_DEFAULT_LAYOUT(layout_mac) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M,48M,64M,128M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( maciisi, macii ) - - MCFG_CPU_REPLACE("maincpu", M68030, 20000000) - MCFG_CPU_PROGRAM_MAP(maciici_map) - MCFG_CPU_VBLANK_INT_DRIVER(MAC_SCREEN_NAME, mac_state, mac_rbv_vbl) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(256) - - MCFG_NUBUS_SLOT_REMOVE("nb9") - MCFG_NUBUS_SLOT_REMOVE("nba") - MCFG_NUBUS_SLOT_REMOVE("nbb") - MCFG_NUBUS_SLOT_REMOVE("nbc") - MCFG_NUBUS_SLOT_REMOVE("nbd") - MCFG_NUBUS_SLOT_REMOVE("nbe") - MCFG_DEVICE_REMOVE("nubus") - - MCFG_VIDEO_START_OVERRIDE(mac_state,macrbv) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) - - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) - MCFG_SCREEN_SIZE(640, 870) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv) - MCFG_DEFAULT_LAYOUT(layout_mac) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M,48M,64M,128M") - - MCFG_DEVICE_MODIFY("via6522_0") - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_egadb)) - - MCFG_EGRET_ADD(EGRET_344S0100) - MCFG_EGRET_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_EGRET_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_EGRET_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_EGRET_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) - MCFG_QUANTUM_PERFECT_CPU("maincpu") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pwrmac, mac_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", PPC601, 60000000) - MCFG_CPU_PROGRAM_MAP(pwrmac_map) - - /* video hardware */ - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - // dot clock, htotal, hstart, hend, vtotal, vstart, vend - MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_SIZE(1024, 768) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macrbv) - - MCFG_PALETTE_ADD("palette", 256) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macsonora) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_AWACS_ADD("awacs", 44100) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* devices */ - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD("ncr5380", NCR5380, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR5380_IRQ_CB(WRITELINE(mac_state, mac_scsi_irq)) - - MCFG_IWM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_cdadb)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 783360) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8M") - MCFG_RAM_EXTRA_OPTIONS("16M,32M,64M,128M") - - MCFG_CUDA_ADD(CUDA_341S0060) - MCFG_CUDA_RESET_CALLBACK(WRITELINE(mac_state, cuda_reset_w)) - MCFG_CUDA_LINECHANGE_CALLBACK(WRITELINE(mac_state, adb_linechange_w)) - MCFG_CUDA_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_CUDA_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( macqd700, mac_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68040, 25000000) - MCFG_CPU_PROGRAM_MAP(quadra700_map) - - MCFG_SCREEN_ADD(MAC_SCREEN_NAME, RASTER) - MCFG_SCREEN_REFRESH_RATE(75.08) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260)) - MCFG_SCREEN_SIZE(1152, 870) - MCFG_SCREEN_VISIBLE_AREA(0, 1152-1, 0, 870-1) - MCFG_SCREEN_UPDATE_DRIVER(mac_state, screen_update_macdafb) - - MCFG_VIDEO_START_OVERRIDE(mac_state,macdafb) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macdafb) - - MCFG_PALETTE_ADD("palette", 256) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_ASC_ADD("asc", C15M, ASC_TYPE_EASC, WRITELINE(mac_state, mac_asc_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - /* devices */ - MCFG_RTC3430042_ADD("rtc", XTAL_32_768kHz) - MCFG_DEVICE_ADD("nubus", NUBUS, 0) - MCFG_NUBUS_CPU("maincpu") - MCFG_NUBUS_OUT_IRQ9_CB(WRITELINE(mac_state, nubus_irq_9_w)) - MCFG_NUBUS_OUT_IRQA_CB(WRITELINE(mac_state, nubus_irq_a_w)) - MCFG_NUBUS_OUT_IRQB_CB(WRITELINE(mac_state, nubus_irq_b_w)) - MCFG_NUBUS_OUT_IRQC_CB(WRITELINE(mac_state, nubus_irq_c_w)) - MCFG_NUBUS_OUT_IRQD_CB(WRITELINE(mac_state, nubus_irq_d_w)) - MCFG_NUBUS_OUT_IRQE_CB(WRITELINE(mac_state, nubus_irq_e_w)) - MCFG_NUBUS_SLOT_ADD("nubus","nbd", mac_nubus_cards, NULL) - MCFG_NUBUS_SLOT_ADD("nubus","nbe", mac_nubus_cards, NULL) - - MCFG_IWM_ADD("fdc", mac_iwm_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) - - MCFG_DEVICE_ADD("scc", SCC8530, C7M) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(mac_state, set_scc_interrupt)) - - MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b_bbadb)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, C7M/10) - MCFG_VIA6522_READPA_HANDLER(READ8(mac_state, mac_via2_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(mac_state, mac_via2_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via2_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via2_out_b)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via2_irq)) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD(MAC_539X_1_TAG, NCR539X, C7M) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_NCR539X_OUT_IRQ_CB(WRITELINE(mac_state, irq_539x_1_w)) - MCFG_NCR539X_OUT_DRQ_CB(WRITELINE(mac_state, drq_539x_1_w)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("8M,16M,32M,64M,68M,72M,80M,96M,128M") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop35_list","mac_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "mac_hdd") -MACHINE_CONFIG_END - -static INPUT_PORTS_START( macplus ) - PORT_START("MOUSE0") /* Mouse - button */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) - - PORT_START("MOUSE1") /* Mouse - X AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START("MOUSE2") /* Mouse - Y AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - /* R Nabet 000531 : pseudo-input ports with keyboard layout */ - /* we only define US layout for keyboard - international layout is different! */ - /* note : 16 bits at most per port! */ - - /* main keyboard pad */ - - PORT_START("KEY0") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) /* extra key on ISO : */ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - - PORT_START("KEY1") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("KEY2") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("KEY3") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) /* keyboard Enter : */ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_UNUSED) /* escape: */ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Option") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_UNUSED) /* Control: */ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_UNUSED) /* keypad pseudo-keycode */ - PORT_BIT(0xE000, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */ - - /* keypad */ - PORT_START("KEY4") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x0038, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad Clear") PORT_CODE(/*KEYCODE_NUMLOCK*/KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad =") PORT_CODE(/*CODE_OTHER*/KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) - PORT_BIT(0x0E00, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("KEY5") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0xE000, IP_ACTIVE_HIGH, IPT_UNUSED) - - /* Arrow keys */ - PORT_START("KEY6") - PORT_BIT(0x0003, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Arrow") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x0038, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Arrow") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down Arrow") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x1E00, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up Arrow") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0xC000, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( macadb ) - PORT_START("MOUSE0") /* Mouse - button */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) - - PORT_START("MOUSE1") /* Mouse - X AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START("MOUSE2") /* Mouse - Y AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - /* This handles the standard (not Extended) Apple ADB keyboard, which is similar to the IIgs's */ - /* main keyboard */ - - PORT_START("KEY0") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) /* extra key on ISO : */ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - - PORT_START("KEY1") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("KEY2") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("KEY3") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) /* keyboard Enter : */ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command / Open Apple") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Option / Solid Apple") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Arrow") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Arrow") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down Arrow") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up Arrow") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) /* ??? */ - - /* keypad */ - PORT_START("KEY4") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x40 - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // 0x41 - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x42 - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // 0x43 - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x44 - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // 0x45 - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x46 - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad Clear") PORT_CODE(/*KEYCODE_NUMLOCK*/KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) // 0x47 - PORT_BIT(0x0700, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x48, 49, 4a - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // 0x4b - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // 0x4c - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x4d - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // 0x4e - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x4f - - PORT_START("KEY5") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x50 - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad =") PORT_CODE(/*CODE_OTHER*/KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // 0x51 - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 0x52 - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 0x53 - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 0x54 - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 0x55 - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 0x56 - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 0x57 - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 0x58 - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 0x59 - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_UNUSED) // 0x5a - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 0x5b - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 0x5c - PORT_BIT(0xE000, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -INPUT_PORTS_START( maciici ) - PORT_INCLUDE(macadb) - - PORT_START("MONTYPE") - PORT_CONFNAME(0x0f, 0x06, "Connected monitor") - PORT_CONFSETTING( 0x01, "15\" Portrait Display (640x870)") - PORT_CONFSETTING( 0x02, "12\" RGB (512x384)") - PORT_CONFSETTING( 0x06, "13\" RGB (640x480)") -INPUT_PORTS_END - -/*************************************************************************** - - Game driver(s) - - The Mac driver uses a convention of placing the BIOS in "bootrom" - -***************************************************************************/ - -/* -ROM_START( mactw ) - ROM_REGION16_BE(0x20000, "bootrom", 0) - ROM_LOAD( "rom4.3t_07-04-83.bin", 0x0000, 0x10000, CRC(d2c42f18) SHA1(f868c09ca70383a69751c37a5a3110a9597462a4) ) -ROM_END -*/ - -ROM_START( mac128k ) - ROM_REGION16_BE(0x20000, "bootrom", 0) - ROM_LOAD16_WORD( "mac128k.rom", 0x00000, 0x10000, CRC(6d0c8a28) SHA1(9d86c883aa09f7ef5f086d9e32330ef85f1bc93b) ) -ROM_END - -ROM_START( mac512k ) - ROM_REGION16_BE(0x20000, "bootrom", 0) - ROM_LOAD16_WORD( "mac512k.rom", 0x00000, 0x10000, CRC(cf759e0d) SHA1(5b1ced181b74cecd3834c49c2a4aa1d7ffe944d7) ) -ROM_END - -ROM_START( unitron ) - ROM_REGION16_BE(0x20000, "bootrom", 0) - ROM_LOAD16_WORD( "unitron_512.rom", 0x00000, 0x10000, CRC(1eabd37f) SHA1(a3d3696c08feac6805effb7ee07b68c2bf1a8dd7) ) -ROM_END - -ROM_START( mac512ke ) - ROM_REGION16_BE(0x20000, "bootrom", 0) - ROM_LOAD16_WORD( "macplus.rom", 0x00000, 0x20000, CRC(b2102e8e) SHA1(7d2f808a045aa3a1b242764f0e2c7d13e288bf1f)) -ROM_END - - -ROM_START( macplus ) - ROM_REGION16_BE(0x40000, "bootrom", 0) - ROM_SYSTEM_BIOS(0, "v3", "Loud Harmonicas") - ROMX_LOAD( "macplus.rom", 0x00000, 0x20000, CRC(b2102e8e) SHA1(7d2f808a045aa3a1b242764f0e2c7d13e288bf1f), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "v2", "Lonely Heifers") - ROMX_LOAD( "23512-1007__342-0342-a.rom-lo.u7d", 0x000000, 0x010000, CRC(5aaa4a2f) SHA1(5dfbfbe279ddadfae691c95f552fd9db41e3ed90), ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD( "23512-1010__342-0341-b.rom-hi.u6d", 0x000001, 0x010000, CRC(65341487) SHA1(bf43fa4f5a3dcbbac20f1fe1deedee0895454379), ROM_SKIP(1) | ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "v1", "Lonely Hearts") - ROMX_LOAD( "4d1eeee1 - macplus v1.rom", 0x000000, 0x020000, CRC(4fa5b399) SHA1(e0da7165b92dee90d8b1522429c033729fa73fd2), ROM_GROUPWORD | ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "romdisk", "mac68k.info self-boot (1/1/2015)") - ROMX_LOAD( "modplus-harp2.bin", 0x000000, 0x028000, CRC(ba56078d) SHA1(debdf328ac73e1662d274a044d8750224f47edef), ROM_GROUPWORD | ROM_BIOS(4) ) -ROM_END - - -ROM_START( macse ) - ROM_REGION16_BE(0x40000, "bootrom", 0) - ROM_LOAD16_WORD( "macse.rom", 0x00000, 0x40000, CRC(0f7ff80c) SHA1(58532b7d0d49659fd5228ac334a1b094f0241968)) -ROM_END - -ROM_START( macsefd ) - ROM_REGION16_BE(0x40000, "bootrom", 0) - ROM_LOAD( "be06e171.rom", 0x000000, 0x040000, CRC(f530cb10) SHA1(d3670a90273d12e53d86d1228c068cb660b8c9d1) ) -ROM_END - -ROM_START( macclasc ) - ROM_REGION16_BE(0x80000, "bootrom", 0) - ROM_LOAD( "a49f9914.rom", 0x000000, 0x080000, CRC(510d7d38) SHA1(ccd10904ddc0fb6a1d216b2e9effd5ec6cf5a83d) ) -ROM_END - -ROM_START( maclc ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD("350eacf0.rom", 0x000000, 0x080000, CRC(71681726) SHA1(6bef5853ae736f3f06c2b4e79772f65910c3b7d4)) - - ROM_REGION(0x1100, "egret", 0) - ROM_LOAD( "341s0851.bin", 0x000000, 0x001100, CRC(ea9ea6e4) SHA1(8b0dae3ec66cdddbf71567365d2c462688aeb571) ) -ROM_END - -ROM_START( macii ) - ROM_REGION32_BE(0x40000, "bootrom", 0) - ROM_SYSTEM_BIOS(0, "default", "rev. B") - ROMX_LOAD( "9779d2c4.rom", 0x000000, 0x040000, CRC(4df6d054) SHA1(db6b504744281369794e26ba71a6e385cf6227fa), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "original", "rev. A") - ROMX_LOAD( "97851db6.rom", 0x000000, 0x040000, CRC(8c8b9d03) SHA1(5c264fe976f1e8495d364947c932a5e8309b4300), ROM_BIOS(2) ) -ROM_END - -ROM_START( maciihmu ) - ROM_REGION32_BE(0x40000, "bootrom", 0) - ROM_SYSTEM_BIOS(0, "default", "rev. B") - ROMX_LOAD( "9779d2c4.rom", 0x000000, 0x040000, CRC(4df6d054) SHA1(db6b504744281369794e26ba71a6e385cf6227fa), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "original", "rev. A") - ROMX_LOAD( "97851db6.rom", 0x000000, 0x040000, CRC(8c8b9d03) SHA1(5c264fe976f1e8495d364947c932a5e8309b4300), ROM_BIOS(2) ) -ROM_END - -ROM_START( mac2fdhd ) // same ROM for II FDHD, IIx, IIcx, and SE/30 - ROM_REGION32_BE(0x40000, "bootrom", 0) - ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) ) -ROM_END - -ROM_START( maciix ) - ROM_REGION32_BE(0x40000, "bootrom", 0) - ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) ) -ROM_END - -ROM_START( maciicx ) - ROM_REGION32_BE(0x40000, "bootrom", 0) - ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) ) -ROM_END - -ROM_START( macse30 ) - ROM_REGION32_BE(0x40000, "bootrom", 0) - ROM_LOAD( "97221136.rom", 0x000000, 0x040000, CRC(ce3b966f) SHA1(753b94351d94c369616c2c87b19d568dc5e2764e) ) - - ROM_REGION32_BE(0x2000, "se30vrom", 0) - ROM_LOAD( "se30vrom.uk6", 0x000000, 0x002000, CRC(b74c3463) SHA1(584201cc67d9452b2488f7aaaf91619ed8ce8f03) ) -ROM_END - -ROM_START( maciifx ) - ROM_REGION32_BE(0x80000, "bootrom", 0) - ROM_LOAD( "4147dd77.rom", 0x000000, 0x080000, CRC(ef441bbd) SHA1(9fba3d4f672a630745d65788b1d1119afa2c6728) ) -ROM_END - -ROM_START( maciici ) - ROM_REGION32_BE(0x80000, "bootrom", 0) - ROM_LOAD( "368cadfe.rom", 0x000000, 0x080000, CRC(46adbf74) SHA1(b54f9d2ed16b63c49ed55adbe4685ebe73eb6e80) ) -ROM_END - -ROM_START( maciisi ) - ROM_REGION32_BE(0x80000, "bootrom", 0) - ROM_LOAD( "36b7fb6c.rom", 0x000000, 0x080000, CRC(f304d973) SHA1(f923de4125aae810796527ff6e25364cf1d54eec) ) -ROM_END - -ROM_START( maciivx ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "4957eb49.rom", 0x000000, 0x100000, CRC(61be06e5) SHA1(560ce203d65178657ad09d03f532f86fa512bb40) ) -ROM_END - -ROM_START( maciivi ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "4957eb49.rom", 0x000000, 0x100000, CRC(61be06e5) SHA1(560ce203d65178657ad09d03f532f86fa512bb40) ) -ROM_END - -ROM_START( macclas2 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "3193670e.rom", 0x000000, 0x080000, CRC(96d2e1fd) SHA1(50df69c1b6e805e12a405dc610bc2a1471b2eac2) ) -ROM_END - -ROM_START( maclc2 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD32_BYTE( "341-0476_ue2-hh.bin", 0x000000, 0x020000, CRC(0c3b0ce4) SHA1(e4e8c883d7f2e002a3f7b7aefaa3840991e57025) ) - ROM_LOAD32_BYTE( "341-0475_ud2-mh.bin", 0x000001, 0x020000, CRC(7b013595) SHA1(0b82d8fac570270db9774f6254017d28611ae756) ) - ROM_LOAD32_BYTE( "341-0474_uc2-ml.bin", 0x000002, 0x020000, CRC(2ff2f52b) SHA1(876850df61d0233c1dd3c00d48d8d6690186b164) ) - ROM_LOAD32_BYTE( "341-0473_ub2-ll.bin", 0x000003, 0x020000, CRC(8843c37c) SHA1(bb5104110507ca543d106f11c6061245fd90c1a7) ) -ROM_END - -ROM_START( maclc3 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "ecbbc41c.rom", 0x000000, 0x100000, CRC(e578f5f3) SHA1(c77df3220c861f37a2c553b6ee9241b202dfdffc) ) -ROM_END - -ROM_START( pmac6100 ) - ROM_REGION64_BE(0x400000, "bootrom", 0) - ROM_LOAD( "9feb69b3.rom", 0x000000, 0x400000, CRC(a43fadbc) SHA1(6fac1c4e920a077c077b03902fef9199d5e8f2c3) ) -ROM_END - -ROM_START( macprtb ) - ROM_REGION16_BE(0x40000, "bootrom", 0) - ROM_LOAD16_WORD( "93ca3846.rom", 0x000000, 0x040000, CRC(497348f8) SHA1(79b468b33fc53f11e87e2e4b195aac981bf0c0a6) ) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv1.bin", 0x000000, 0x001800, CRC(01dae148) SHA1(29d2fca7426c31f2b9334832ed3d257974a61bb1) ) -ROM_END - -ROM_START( macpb100 ) - ROM_REGION16_BE(0x40000, "bootrom", 0) - ROM_LOAD16_WORD( "96645f9c.rom", 0x000000, 0x040000, CRC(29ac7ee9) SHA1(7f3acf40b1f63612de2314a2e9fcfeafca0711fc) ) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv1.bin", 0x000000, 0x001800, CRC(01dae148) SHA1(29d2fca7426c31f2b9334832ed3d257974a61bb1) ) -ROM_END - -ROM_START( macpb140 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) -ROM_END - -ROM_START( macpb145 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) -ROM_END - -ROM_START( macpb145b ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) -ROM_END - -ROM_START( macpb170 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) -ROM_END - -ROM_START( macqd700 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) -ROM_END - -ROM_START( macpb160 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "e33b2724.rom", 0x000000, 0x100000, CRC(536c60f4) SHA1(c0510682ae6d973652d7e17f3c3b27629c47afac) ) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv3.bin", 0x000000, 0x001800, CRC(f2df696c) SHA1(fc312cbfd407c6f0248c6463910e41ad6b5b0daa) ) -ROM_END - -ROM_START( macpb180 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "e33b2724.rom", 0x000000, 0x100000, CRC(536c60f4) SHA1(c0510682ae6d973652d7e17f3c3b27629c47afac) ) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv3.bin", 0x000000, 0x001800, CRC(f2df696c) SHA1(fc312cbfd407c6f0248c6463910e41ad6b5b0daa) ) -ROM_END - -ROM_START( macpb180c ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "e33b2724.rom", 0x000000, 0x100000, CRC(536c60f4) SHA1(c0510682ae6d973652d7e17f3c3b27629c47afac) ) - - ROM_REGION32_BE(0x8000, "vrom", 0) - ROM_LOAD( "pb180cvrom.bin", 0x0000, 0x8000, CRC(810c75ad) SHA1(3a936e97dee5ceeb25e50197ef504e514ae689a4)) - - ROM_REGION(0x1800, "pmu", 0) - ROM_LOAD( "pmuv3.bin", 0x000000, 0x001800, CRC(f2df696c) SHA1(fc312cbfd407c6f0248c6463910e41ad6b5b0daa) ) -ROM_END - -ROM_START( maccclas ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "ecd99dc0.rom", 0x000000, 0x100000, CRC(c84c3aa5) SHA1(fd9e852e2d77fe17287ba678709b9334d4d74f1e) ) -ROM_END -/* -ROM_START( macpd210 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "ecfa989b.rom", 0x000000, 0x100000, CRC(b86ed854) SHA1(ed1371c97117a5884da4a6605ecfc5abed48ae5a) ) -ROM_END -*/ - -ROM_START( maclc520 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "ede66cbd.rom", 0x000000, 0x100000, CRC(a893cb0f) SHA1(c54ee2f45020a4adeb7451adce04cd6e5fb69790) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -//COMP( 1983, mactw, 0, 0, mac128k, macplus, mac_state, mac128k512k, "Apple Computer", "Macintosh (4.3T Prototype)", MACHINE_NOT_WORKING ) -COMP( 1984, mac128k, 0, 0, mac128k, macplus, mac_state, mac128k512k, "Apple Computer", "Macintosh 128k", MACHINE_NOT_WORKING ) -COMP( 1984, mac512k, mac128k, 0, mac512ke, macplus, mac_state, mac128k512k, "Apple Computer", "Macintosh 512k", MACHINE_NOT_WORKING ) -COMP( 1986, mac512ke, macplus, 0, mac512ke, macplus, mac_state, mac512ke, "Apple Computer", "Macintosh 512ke", 0 ) -COMP( 1985, unitron, macplus, 0, mac512ke, macplus, mac_state, mac512ke, "bootleg (Unitron)", "Mac 512", MACHINE_NOT_WORKING ) -COMP( 1986, macplus, 0, 0, macplus, macplus, mac_state, macplus, "Apple Computer", "Macintosh Plus", 0 ) -COMP( 1987, macse, 0, 0, macse, macadb, mac_state, macse, "Apple Computer", "Macintosh SE", 0 ) -COMP( 1987, macsefd, 0, 0, macse, macadb, mac_state, macse, "Apple Computer", "Macintosh SE (FDHD)", 0 ) -COMP( 1987, macii, 0, 0, macii, macadb, mac_state, macii, "Apple Computer", "Macintosh II", 0 ) -COMP( 1987, maciihmu, macii, 0, maciihmu, macadb, mac_state, macii, "Apple Computer", "Macintosh II (w/o 68851 MMU)", 0 ) -COMP( 1988, mac2fdhd, 0, 0, macii, macadb, mac_state, maciifdhd, "Apple Computer", "Macintosh II (FDHD)", 0 ) -COMP( 1988, maciix, mac2fdhd, 0, maciix, macadb, mac_state, maciix, "Apple Computer", "Macintosh IIx", 0 ) -COMP( 1989, macprtb, 0, 0, macprtb, macadb, mac_state, macprtb, "Apple Computer", "Macintosh Portable", MACHINE_NOT_WORKING ) -COMP( 1989, macse30, mac2fdhd, 0, macse30, macadb, mac_state, macse30, "Apple Computer", "Macintosh SE/30", 0 ) -COMP( 1989, maciicx, mac2fdhd, 0, maciicx, macadb, mac_state, maciicx, "Apple Computer", "Macintosh IIcx", 0 ) -COMP( 1989, maciici, 0, 0, maciici, maciici, mac_state, maciici, "Apple Computer", "Macintosh IIci", 0 ) -COMP( 1990, maciifx, 0, 0, maciifx, macadb, mac_state, maciifx, "Apple Computer", "Macintosh IIfx", MACHINE_NOT_WORKING ) -COMP( 1990, macclasc, 0, 0, macclasc, macadb, mac_state, macclassic, "Apple Computer", "Macintosh Classic", 0 ) -COMP( 1990, maclc, 0, 0, maclc, maciici, mac_state, maclc, "Apple Computer", "Macintosh LC", MACHINE_IMPERFECT_SOUND ) -COMP( 1990, maciisi, 0, 0, maciisi, maciici, mac_state, maciisi, "Apple Computer", "Macintosh IIsi", 0 ) -COMP( 1991, macpb100, 0, 0, macprtb, macadb, mac_state, macprtb, "Apple Computer", "Macintosh PowerBook 100", MACHINE_NOT_WORKING ) -COMP( 1991, macpb140, 0, 0, macpb140, macadb, mac_state, macpb140, "Apple Computer", "Macintosh PowerBook 140", MACHINE_NOT_WORKING ) -COMP( 1991, macpb170, macpb140, 0, macpb170, macadb, mac_state, macpb140, "Apple Computer", "Macintosh PowerBook 170", MACHINE_NOT_WORKING ) -COMP( 1991, macqd700, macpb140, 0, macqd700, macadb, mac_state, macquadra700, "Apple Computer", "Macintosh Quadra 700", MACHINE_NOT_WORKING ) -COMP( 1991, macclas2, 0, 0, macclas2, macadb, mac_state, macclassic2, "Apple Computer", "Macintosh Classic II", MACHINE_IMPERFECT_SOUND ) -COMP( 1991, maclc2, 0, 0, maclc2, maciici, mac_state, maclc2, "Apple Computer", "Macintosh LC II", MACHINE_IMPERFECT_SOUND ) -COMP( 1992, macpb145, macpb140, 0, macpb145, macadb, mac_state, macpb140, "Apple Computer", "Macintosh PowerBook 145", MACHINE_NOT_WORKING ) -COMP( 1992, macpb160, 0, 0, macpb160, macadb, mac_state, macpb160, "Apple Computer", "Macintosh PowerBook 160", MACHINE_NOT_WORKING ) -COMP( 1992, macpb180, macpb160, 0, macpb180, macadb, mac_state, macpb160, "Apple Computer", "Macintosh PowerBook 180", MACHINE_NOT_WORKING ) -COMP( 1992, macpb180c,macpb160, 0, macpb180c,macadb, mac_state, macpb160, "Apple Computer", "Macintosh PowerBook 180c", MACHINE_NOT_WORKING ) -//COMP( 1992, macpd210, 0, 0, macpd210, macadb, mac_state, macpd210, "Apple Computer", "Macintosh PowerBook Duo 210", MACHINE_NOT_WORKING ) -COMP( 1993, maccclas, 0, 0, maccclas, macadb, mac_state, maclrcclassic,"Apple Computer", "Macintosh Color Classic", MACHINE_NOT_WORKING ) -COMP( 1992, macpb145b,macpb140, 0, macpb170, macadb, mac_state, macpb140, "Apple Computer", "Macintosh PowerBook 145B", MACHINE_NOT_WORKING ) -COMP( 1993, maclc3, 0, 0, maclc3, maciici, mac_state, maclc3, "Apple Computer", "Macintosh LC III", MACHINE_IMPERFECT_SOUND ) -COMP( 1993, maciivx, 0, 0, maciivx, maciici, mac_state, maciivx, "Apple Computer", "Macintosh IIvx", MACHINE_IMPERFECT_SOUND ) -COMP( 1993, maciivi, maciivx, 0, maciivi, maciici, mac_state, maciivx, "Apple Computer", "Macintosh IIvi", MACHINE_IMPERFECT_SOUND ) -COMP( 1993, maclc520, 0, 0, maclc520, maciici, mac_state, maclc520, "Apple Computer", "Macintosh LC 520", MACHINE_NOT_WORKING ) -COMP( 1994, pmac6100, 0, 0, pwrmac, macadb, mac_state, macpm6100, "Apple Computer", "Power Macintosh 6100/60", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/macpci.c b/src/mess/drivers/macpci.c deleted file mode 100644 index 10f938d108f..00000000000 --- a/src/mess/drivers/macpci.c +++ /dev/null @@ -1,166 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - macpci.c: second-generation Old World PowerMacs based on PCI instead of NuBus - - Preliminary driver by R. Belmont (based on pippin.c skeleton by Angelo Salese) - - Pippin: - - Apple ASICs identified: - ----------------------- - 343S1125 Grand Central (SWIM III, Sound, VIA) - 341S0060 Cuda (68HC05 MCU, handles ADB and parameter ("CMOS") RAM) - 343S1146 ??? (likely SCSI due to position on board) - 343S1191(x2) Athens Prime PLL Clock Generator - - Other chips - ----------- - Z8530 SCC - CS4217 audio DAC - Bt856 video DAC - - Pippin-type map - F3000000 : Grand Central DMA/IRQ controller - F3012000 : SCC - F3013000 : Grand Central system controller - F3014000 : AWACS audio - F3015000 : SWIM III - F3016000 : VIA1 - F3018000 : SCSI (53C96) - - NOTE: the PowerPC starts off disabled; the Cuda 68HC05 starts it up once it's booted. - - NOTE 2: goes off into the weeds in the subroutine at fff05010 - -****************************************************************************/ - -#include "emu.h" -#include "includes/macpci.h" -#include "cpu/powerpc/ppc.h" -#include "imagedev/chd_cd.h" -#include "sound/cdda.h" - -READ64_MEMBER( macpci_state::unk1_r ) -{ - m_unk1_test ^= 0x0400; //PC=ff808760 - - return m_unk1_test << 16; -} - -READ64_MEMBER( macpci_state::unk2_r ) -{ - if (ACCESSING_BITS_32_47) - return (UINT64)0xe1 << 32; //PC=fff04810 - - return 0; -} - -static ADDRESS_MAP_START(pippin_mem, AS_PROGRAM, 64, macpci_state) - AM_RANGE(0x00000000, 0x005fffff) AM_RAM - - /* writes at 0x0*c01000 the string "Mr. Kesh" and wants it to be read back, true color VRAMs perhaps? */ - AM_RANGE(0x00c00000, 0x00c01007) AM_RAM - AM_RANGE(0x01c00000, 0x01c01007) AM_RAM - AM_RANGE(0x02c00000, 0x02c01007) AM_RAM - AM_RANGE(0x03c00000, 0x03c01007) AM_RAM - - AM_RANGE(0x40000000, 0x403fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0fc00000) // mirror of ROM for 680x0 emulation - - AM_RANGE(0xf00dfff8, 0xf00dffff) AM_READ(unk2_r) - AM_RANGE(0xf3008800, 0xf3008807) AM_READ(unk1_r) - - AM_RANGE(0xf3016000, 0xf3017fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff)) - - AM_RANGE(0xffc00000, 0xffffffff) AM_ROM AM_REGION("bootrom",0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pippin ) -INPUT_PORTS_END - - -UINT32 macpci_state::screen_update_pippin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( pippin, macpci_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", PPC603, 66000000) - MCFG_CPU_PROGRAM_MAP(pippin_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(macpci_state, screen_update_pippin) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD( "cdda", CDDA, 0 ) - MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) - MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) - - MCFG_CDROM_ADD("cdrom") - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32M") - - MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10) - MCFG_VIA6522_READPA_HANDLER(READ8(macpci_state, mac_via_in_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(macpci_state, mac_via_in_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(macpci_state,mac_via_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(macpci_state,mac_via_out_b)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(macpci_state, mac_adb_via_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(macpci_state,mac_via_irq)) - - //MCFG_DEVICE_ADD("scc", SCC8530, C7M) - //MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(macpci_state, set_scc_interrupt)) - MCFG_CUDA_ADD(CUDA_341S0060) - MCFG_CUDA_RESET_CALLBACK(WRITELINE(macpci_state, cuda_reset_w)) - MCFG_CUDA_LINECHANGE_CALLBACK(WRITELINE(macpci_state, cuda_adb_linechange_w)) - MCFG_CUDA_VIA_CLOCK_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb1)) - MCFG_CUDA_VIA_DATA_CALLBACK(DEVWRITELINE("via6522_0", via6522_device, write_cb2)) - MCFG_QUANTUM_PERFECT_CPU("maincpu") -MACHINE_CONFIG_END - -/* ROM definition */ -/* - - BIOS versions - - dev - monitor 341S0241 - 245,247,248,250 - 1.0 341S0251..254 U1-U4 - 1.2 341S0297..300 U15,U20,U31,U35 - 1.3 341S0328..331 U1/U31, U2/U35, U3/U15 and U4/U20 - -*/ - -ROM_START( pippin ) - ROM_REGION( 0x400000, "bootrom", ROMREGION_64BIT | ROMREGION_BE ) - ROM_SYSTEM_BIOS(0, "v1", "Kinka v 1.0") - ROMX_LOAD( "341s0251.u1", 0x000006, 0x100000, CRC(aaea2449) SHA1(2f63e215260a42fb7c5f2364682d5e8c0604646f),ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6) | ROM_BIOS(1)) - ROMX_LOAD( "341s0252.u2", 0x000004, 0x100000, CRC(3d584419) SHA1(e29c764816755662693b25f1fb3c24faef4e9470),ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6) | ROM_BIOS(1)) - ROMX_LOAD( "341s0253.u3", 0x000002, 0x100000, CRC(d8ae5037) SHA1(d46ce4d87ca1120dfe2cf2ba01451f035992b6f6),ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6) | ROM_BIOS(1)) - ROMX_LOAD( "341s0254.u4", 0x000000, 0x100000, CRC(3e2851ba) SHA1(7cbf5d6999e890f5e9ab2bc4b10ca897c4dc2016),ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6) | ROM_BIOS(1)) - - ROM_SYSTEM_BIOS(1, "pre", "Kinka pre-release") - ROMX_LOAD( "kinka-pre.rom", 0x000000, 0x400000, CRC(4ff875e6) SHA1(eb8739cab1807c6c7c51acc7f4a3afc1f9c6ddbb),ROM_BIOS(2)) - - ROM_REGION( 0x10000, "cdrom", 0 ) /* MATSUSHITA CR504-L OEM */ - ROM_LOAD( "504par4.0i.ic7", 0x0000, 0x10000, CRC(25f7dd46) SHA1(ec3b3031742807924c6259af865e701827208fec) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1996, pippin, 0, 0, pippin, pippin, driver_device, 0, "Apple / Bandai", "Pippin @mark", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/mbc200.c b/src/mess/drivers/mbc200.c deleted file mode 100644 index 104b12435e4..00000000000 --- a/src/mess/drivers/mbc200.c +++ /dev/null @@ -1,267 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Sanyo MBC-200 - - Machine MBC-1200 is identical but sold outside of Japan - - 16 x HM6116P-3 2K x 8 SRAM soldered onboard (so 32k ram) - 4 x HM6116P-3 2K x 8 SRAM socketed (so 8k ram) - 4 x MB83256 32K x 8 socketed (128k ram) - Floppy = 5.25" - MBC1200 has one floppy while MBC1250 has 2. The systems - are otherwise identical. - - On back side: - - keyboard DIN connector - - Centronics printer port - - RS-232C 25pin connector - - TODO: - - Keyboard - - Sound - - CP/M display (it runs into the weeds internally) - - Other connections to the various PPI's - - UART connections - - Any other devices? - - 2011-10-31 Skeleton driver. - 2014-05-18 Made rom get copied into ram, boot code from disk - requires that ram is there otherwise you get - a MEMORY ERROR. Now, CP/M loads and is executed, but - nothing shows on the screen. - Tried new wdc code, but the disk couldn't be read at all. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "video/mc6845.h" -#include "machine/wd_fdc.h" - - -class mbc200_state : public driver_device -{ -public: - mbc200_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_crtc(*this, "crtc") - , m_ppi_m(*this, "ppi_m") - , m_vram(*this, "vram") - , m_maincpu(*this, "maincpu") - , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - { } - - DECLARE_READ8_MEMBER(p2_porta_r); - DECLARE_WRITE8_MEMBER(pm_porta_w); - DECLARE_WRITE8_MEMBER(pm_portb_w); - MC6845_UPDATE_ROW(update_row); - required_device m_palette; - -private: - virtual void machine_start(); - virtual void machine_reset(); - UINT8 m_comm_latch; - required_device m_crtc; - required_device m_ppi_m; - required_shared_ptr m_vram; - required_device m_maincpu; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; -}; - - -static ADDRESS_MAP_START(mbc200_mem, AS_PROGRAM, 8, mbc200_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_RAM AM_REGION("maincpu", 0) - AM_RANGE( 0x1000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -WRITE8_MEMBER( mbc200_state::pm_porta_w ) -{ - machine().scheduler().synchronize(); // force resync - printf("A %02x %c\n",data,data); - m_comm_latch = data; // to slave CPU -} - -WRITE8_MEMBER( mbc200_state::pm_portb_w ) -{ - floppy_image_device *floppy = NULL; - - // to be verified - switch (data & 0x01) - { - case 0: floppy = m_floppy0->get_device(); break; - case 1: floppy = m_floppy1->get_device(); break; - } - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(BIT(data, 7)); - } -} - -static ADDRESS_MAP_START( mbc200_io , AS_IO, 8, mbc200_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xe0, 0xe0) AM_DEVREADWRITE("i8251_1", i8251_device, data_r, data_w) - AM_RANGE(0xe1, 0xe1) AM_DEVREADWRITE("i8251_1", i8251_device, status_r, control_w) - AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("fdc", mb8876_t, read, write) - AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("ppi_m", i8255_device, read, write) - AM_RANGE(0xec, 0xec) AM_DEVREADWRITE("i8251_2", i8251_device, data_r, data_w) - AM_RANGE(0xed, 0xed) AM_DEVREADWRITE("i8251_2", i8251_device, status_r, control_w) -ADDRESS_MAP_END - - - -static ADDRESS_MAP_START(mbc200_sub_mem, AS_PROGRAM, 8, mbc200_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x2fff ) AM_ROM - AM_RANGE( 0x3000, 0x7fff ) AM_RAM - AM_RANGE( 0x8000, 0xffff ) AM_RAM AM_SHARE("vram") -ADDRESS_MAP_END - -READ8_MEMBER(mbc200_state::p2_porta_r) -{ - machine().scheduler().synchronize(); // force resync - UINT8 tmp = m_comm_latch; - m_comm_latch = 0; - m_ppi_m->pc6_w(0); // ppi_ack - return tmp; -} - -static ADDRESS_MAP_START( mbc200_sub_io , AS_IO, 8, mbc200_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x70, 0x73) AM_DEVREADWRITE("ppi_1", i8255_device, read, write) - AM_RANGE(0xb0, 0xb0) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0xb1, 0xb1) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("ppi_2", i8255_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mbc200 ) -INPUT_PORTS_END - -void mbc200_state::machine_start() -{ -} - -void mbc200_state::machine_reset() -{ - UINT8* roms = memregion("roms")->base(); - UINT8* main = memregion("maincpu")->base(); - memcpy(main, roms, 0x1000); -} - -static SLOT_INTERFACE_START( mbc200_floppies ) - SLOT_INTERFACE("qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -MC6845_UPDATE_ROW( mbc200_state::update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 gfx; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - mem = (ma+x)*4+ra; - gfx = m_vram[mem]; - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} - -static const gfx_layout mbc200_chars_8x8 = -{ - 8,8, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( mbc200 ) - GFXDECODE_ENTRY( "subcpu", 0x1800, mbc200_chars_8x8, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( mbc200, mbc200_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz/2) // NEC D780C-1 - MCFG_CPU_PROGRAM_MAP(mbc200_mem) - MCFG_CPU_IO_MAP(mbc200_io) - - MCFG_CPU_ADD("subcpu",Z80, XTAL_8MHz/2) // NEC D780C-1 - MCFG_CPU_PROGRAM_MAP(mbc200_sub_mem) - MCFG_CPU_IO_MAP(mbc200_sub_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", h46505_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mbc200) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_8MHz / 4) // HD46505SP - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(mbc200_state, update_row) - - MCFG_DEVICE_ADD("ppi_1", I8255, 0) - - MCFG_DEVICE_ADD("ppi_2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mbc200_state, p2_porta_r)) - - MCFG_DEVICE_ADD("ppi_m", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mbc200_state, pm_porta_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mbc200_state, pm_portb_w)) - - MCFG_DEVICE_ADD("i8251_1", I8251, 0) // INS8251N - MCFG_DEVICE_ADD("i8251_2", I8251, 0) // INS8251A - - MCFG_MB8876_ADD("fdc", XTAL_8MHz / 8) // guess - MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbc200_floppies, "qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbc200_floppies, "qd", floppy_image_device::default_floppy_formats) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("flop_list", "mbc200") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mbc200 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x1000, "roms", 0 ) - ROM_LOAD( "d2732a.bin", 0x0000, 0x1000, CRC(bf364ce8) SHA1(baa3a20a5b01745a390ef16628dc18f8d682d63b)) - ROM_REGION( 0x10000, "subcpu", ROMREGION_ERASEFF ) - ROM_LOAD( "m5l2764.bin", 0x0000, 0x2000, CRC(377300a2) SHA1(8563172f9e7f84330378a8d179f4138be5fda099)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, mbc200, 0, 0, mbc200, mbc200, driver_device, 0, "Sanyo", "MBC-200", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mbc55x.c b/src/mess/drivers/mbc55x.c deleted file mode 100644 index 602eb146c8a..00000000000 --- a/src/mess/drivers/mbc55x.c +++ /dev/null @@ -1,316 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phill Harvey-Smith -/* - drivers/mbc55x.c - - Machine driver for the Sanyo MBC-550 and MBC-555. - - Phill Harvey-Smith - 2011-01-29. - - -ToDo: -- Fix the sound -- Add serial uart - -*/ - - -#include "includes/mbc55x.h" - - -const unsigned char mbc55x_palette[SCREEN_NO_COLOURS][3] = -{ - /*normal brightness */ - { 0x00,0x00,0x00 }, /* black */ - { 0x00,0x00,0x80 }, /* blue */ - { 0x00,0x80,0x00 }, /* green */ - { 0x00,0x80,0x80 }, /* cyan */ - { 0x80,0x00,0x00 }, /* red */ - { 0x80,0x00,0x80 }, /* magenta */ - { 0x80,0x80,0x00 }, /* yellow */ - { 0x80,0x80,0x80 }, /* light grey */ -}; - - -static ADDRESS_MAP_START(mbc55x_mem, AS_PROGRAM, 8, mbc55x_state) - AM_RANGE( 0x00000, 0x0FFFF ) AM_RAMBANK(RAM_BANK00_TAG) - AM_RANGE( 0x10000, 0x1FFFF ) AM_RAMBANK(RAM_BANK01_TAG) - AM_RANGE( 0x20000, 0x2FFFF ) AM_RAMBANK(RAM_BANK02_TAG) - AM_RANGE( 0x30000, 0x3FFFF ) AM_RAMBANK(RAM_BANK03_TAG) - AM_RANGE( 0x40000, 0x4FFFF ) AM_RAMBANK(RAM_BANK04_TAG) - AM_RANGE( 0x50000, 0x5FFFF ) AM_RAMBANK(RAM_BANK05_TAG) - AM_RANGE( 0x60000, 0x6FFFF ) AM_RAMBANK(RAM_BANK06_TAG) - AM_RANGE( 0x70000, 0x7FFFF ) AM_RAMBANK(RAM_BANK07_TAG) - AM_RANGE( 0x80000, 0x8FFFF ) AM_RAMBANK(RAM_BANK08_TAG) - AM_RANGE( 0x90000, 0x9FFFF ) AM_RAMBANK(RAM_BANK09_TAG) - AM_RANGE( 0xA0000, 0xAFFFF ) AM_RAMBANK(RAM_BANK0A_TAG) - AM_RANGE( 0xB0000, 0xBFFFF ) AM_RAMBANK(RAM_BANK0B_TAG) - AM_RANGE( 0xC0000, 0xCFFFF ) AM_RAMBANK(RAM_BANK0C_TAG) - AM_RANGE( 0xD0000, 0xDFFFF ) AM_RAMBANK(RAM_BANK0D_TAG) - AM_RANGE( 0xE0000, 0xEFFFF ) AM_RAMBANK(RAM_BANK0E_TAG) - AM_RANGE( 0xF0000, 0xF3FFF ) AM_RAMBANK(RED_PLANE_TAG) - AM_RANGE( 0xF4000, 0xF7FFF ) AM_RAMBANK(BLUE_PLANE_TAG) - AM_RANGE( 0xF8000, 0xFBFFF ) AM_NOP - AM_RANGE( 0xFC000, 0xFFFFF ) AM_ROM AM_WRITENOP AM_REGION(MAINCPU_TAG, 0x0000) AM_MIRROR(0x002000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbc55x_io, AS_IO, 8, mbc55x_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0X0000, 0X0003) AM_READWRITE(mbcpic8259_r, mbcpic8259_w) - AM_RANGE( 0x0008, 0x000F) AM_READWRITE(mbc55x_disk_r, mbc55x_disk_w) - AM_RANGE( 0X0010, 0X0010) AM_READWRITE( vram_page_r, vram_page_w) - AM_RANGE( 0x0018, 0x001F) AM_READWRITE( ppi8255_r, ppi8255_w) - AM_RANGE( 0X0020, 0X0027) AM_READWRITE(mbcpit8253_r, mbcpit8253_w) - AM_RANGE( 0x0028, 0x002B) AM_READWRITE( mbc55x_usart_r, mbc55x_usart_w) - AM_RANGE( 0x0030, 0x0031) AM_DEVREADWRITE(VID_MC6845_NAME, mc6845_device, status_r, address_w ) - AM_RANGE( 0x0032, 0x0033) AM_DEVREADWRITE(VID_MC6845_NAME, mc6845_device, register_r, register_w ) - AM_RANGE( 0x0038, 0x003B) AM_READWRITE(mbc55x_kb_usart_r, mbc55x_kb_usart_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( mbc55x ) - PORT_START("KEY0") /* Key row 0 scancodes 00..07 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - - PORT_START("KEY1") /* Key row 1 scancodes 08..0F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BSLASH") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("KEY2") /* Key row 2 scancodes 10..17 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - - - PORT_START("KEY3") /* Key row 3 scancodes 18..1F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - - PORT_START("KEY4") /* Key row 4 scancodes 20..27 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TILDE") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("#") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0D) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - - PORT_START("KEY5") /* Key row 5 scancodes 28..2F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - - PORT_START("KEY6") /* Key row 6 scancodes 30..37 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - -#if 0 - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSLASH") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) // Ether control - - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRSCR") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - - PORT_START("KEY7") /* Key row 7 scancodes 38..3F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - - PORT_START("KEY8") /* Key row 8 scancodes 40..47 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLK") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SCRLK") PORT_CODE(KEYCODE_SCRLOCK) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - - PORT_START("KEY9") /* Key row 9 scancodes 48..4F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP8") PORT_CODE(KEYCODE_8_PAD) //PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP9") PORT_CODE(KEYCODE_9_PAD) //PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP-") PORT_CODE(KEYCODE_MINUS_PAD) //PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP4") PORT_CODE(KEYCODE_4_PAD) //PORT_CHAR('4') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) //PORT_CHAR('5') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) //PORT_CHAR('6') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) //PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) //PORT_CHAR('1') - - PORT_START("KEY10") /* Key row 10 scancodes 50..57 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP2") PORT_CODE(KEYCODE_2_PAD) //PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP3") PORT_CODE(KEYCODE_3_PAD) //PORT_CHAR('3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP0") PORT_CODE(KEYCODE_0_PAD) //PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP.") PORT_CODE(KEYCODE_DEL_PAD) //PORT_CHAR('.') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - //PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - //PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') -#endif - - PORT_START(KEY_SPECIAL_TAG) - PORT_BIT(KEY_BIT_LSHIFT, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(KEY_BIT_RSHIFT, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(KEY_BIT_CTRL, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) // Ether control - PORT_BIT(KEY_BIT_GRAPH, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - -INPUT_PORTS_END - - -PALETTE_INIT_MEMBER(mbc55x_state, mbc55x) -{ - int colourno; - - logerror("initializing palette\n"); - - for ( colourno = 0; colourno < SCREEN_NO_COLOURS; colourno++ ) - palette.set_pen_color(colourno, mbc55x_palette[colourno][RED], mbc55x_palette[colourno][GREEN], mbc55x_palette[colourno][BLUE]); -} - - -FLOPPY_FORMATS_MEMBER( mbc55x_state::floppy_formats ) - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - - -// MBC-550 : 1 x 5.25" disk-drive (160 KB) -// MBC-555 : 2 x 5.25" disk-drive (160 KB) -// MBC-555-2 : 2 x 5.25" disk-drive (360 KB) -// MBC-555-3 : 2 x 5.25" disk-drive (720 KB) - -static SLOT_INTERFACE_START( mbc55x_floppies ) - SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) - SLOT_INTERFACE("dd", FLOPPY_525_DD) - SLOT_INTERFACE("qd", FLOPPY_525_QD) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( mbc55x, mbc55x_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, I8088, 3600000) - MCFG_CPU_PROGRAM_MAP(mbc55x_mem) - MCFG_CPU_IO_MAP(mbc55x_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(PIC8259_TAG, pic8259_device, inta_cb) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,896,0,300,262,0,200) - MCFG_SCREEN_UPDATE_DEVICE(VID_MC6845_NAME, mc6845_device, screen_update) - MCFG_SCREEN_VBLANK_DRIVER(mbc55x_state, screen_eof_mbc55x) - - MCFG_PALETTE_ADD("palette", SCREEN_NO_COLOURS * 3) - MCFG_PALETTE_INIT_OWNER(mbc55x_state, mbc55x) -// MCFG_SCREEN_SIZE(650, 260) -// MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("128K,192K,256K,320K,384K,448K,512K,576K,640K") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO(MONO_TAG) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,MONO_TAG, 0.75) - - /* Devices */ - MCFG_DEVICE_ADD(I8251A_KB_TAG, I8251, 0) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(PIC8259_TAG, pic8259_device, ir3_w)) - - MCFG_DEVICE_ADD(PIT8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(PIT_C0_CLOCK) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(PIC8259_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(PIT_C1_CLOCK) - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE(PIC8259_TAG, pic8259_device, ir1_w)) - MCFG_PIT8253_CLK2(PIT_C2_CLOCK) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mbc55x_state, pit8253_t2)) - - MCFG_PIC8259_ADD( PIC8259_TAG, INPUTLINE(MAINCPU_TAG, INPUT_LINE_IRQ0), VCC, NULL ) - - MCFG_DEVICE_ADD(PPI8255_TAG, I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mbc55x_state, mbc55x_ppi_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mbc55x_state, mbc55x_ppi_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(mbc55x_state, mbc55x_ppi_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mbc55x_state, mbc55x_ppi_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(mbc55x_state, mbc55x_ppi_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mbc55x_state, mbc55x_ppi_portc_w)) - - MCFG_MC6845_ADD(VID_MC6845_NAME, MC6845, SCREEN_TAG, XTAL_14_31818MHz/8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(mbc55x_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(mbc55x_state, vid_hsync_changed)) - MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(mbc55x_state, vid_vsync_changed)) - - /* Backing storage */ - MCFG_FD1793_ADD(FDC_TAG, XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", mbc55x_floppies, "qd", mbc55x_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", mbc55x_floppies, "qd", mbc55x_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":2", mbc55x_floppies, "", mbc55x_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":3", mbc55x_floppies, "", mbc55x_state::floppy_formats) - - /* Software list */ - MCFG_SOFTWARE_LIST_ADD("disk_list","mbc55x") -MACHINE_CONFIG_END - - -ROM_START( mbc55x ) - ROM_REGION( 0x4000, MAINCPU_TAG, 0 ) - - ROM_SYSTEM_BIOS(0, "v120", "mbc55x BIOS v1.20 (1983)") - ROMX_LOAD("mbc55x-v120.rom", 0x0000, 0x2000, CRC(b439b4b8) SHA1(6e8df0f3868e3fd0229a5c2720d6c01e46815cab), ROM_BIOS(1) ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, mbc55x, 0, 0, mbc55x, mbc55x, driver_device, 0, "Sanyo", "MBC-55x", 0 /*MACHINE_NO_SOUND*/) diff --git a/src/mess/drivers/mbdtower.c b/src/mess/drivers/mbdtower.c deleted file mode 100644 index 65d27fb06f4..00000000000 --- a/src/mess/drivers/mbdtower.c +++ /dev/null @@ -1,285 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Sean Riddle -/*************************************************************************** - - ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** - - Milton Bradley Dark Tower - * TMS1400NLL MP7332-N1.U1(Rev. B) or MP7332-N2LL(Rev. C), die labeled MP7332 - (assume same ROM contents between revisions) - * SN75494N MOS-to-LED digit driver - * motorized rotating reel + lightsensor, 1bit-sound - - This is a board game, it obviously requires game pieces and the board. - The emulated part is the centerpiece, a black tower with a rotating card - panel and LED digits for displaying health, amount of gold, etc. As far - as MAME is concerned, the game works fine. - - To start up the game, first press [MOVE], the machine now does a self-test. - Then select level and number of players and the game will start. Read the - official manual on how to play the game. - -***************************************************************************/ - -#include "includes/hh_tms1k.h" -#include "mbdtower.lh" - - -class mbdtower_state : public hh_tms1k_state -{ -public: - mbdtower_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - - void prepare_display(); - bool sensor_led_on() { return m_display_decay[0][0] != 0; } - - int m_motor_pos; - int m_motor_pos_prev; - int m_motor_decay; - bool m_motor_on; - bool m_sensor_blind; - - TIMER_DEVICE_CALLBACK_MEMBER(motor_sim_tick); - - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_READ8_MEMBER(read_k); - -protected: - virtual void machine_start(); -}; - - -/*************************************************************************** - - Display, Motor - -***************************************************************************/ - -void mbdtower_state::prepare_display() -{ - // declare display matrix size and the 2 7segs - set_display_size(7, 3); - m_display_segmask[1] = m_display_segmask[2] = 0x7f; - - // update current state - if (~m_r & 0x10) - { - UINT8 o = BITSWAP8(m_o,7,0,4,3,2,1,6,5) & 0x7f; - m_display_state[2] = (m_o & 0x80) ? o : 0; - m_display_state[1] = (m_o & 0x80) ? 0 : o; - m_display_state[0] = (m_r >> 8 & 1) | (m_r >> 4 & 0xe); - - display_update(); - } - else - { - // display items turned off - display_matrix(7, 3, 0, 0); - } -} - - -TIMER_DEVICE_CALLBACK_MEMBER(mbdtower_state::motor_sim_tick) -{ - // it rotates counter-clockwise (when viewed from above) - if (m_motor_on) - { - m_motor_pos = (m_motor_pos - 1) & 0x7f; - - // give it some time to spin out when it's turned off - if (m_r & 0x200) - m_motor_decay += (m_motor_decay < 4); - else if (m_motor_decay > 0) - m_motor_decay--; - else - m_motor_on = false; - } - - // 8 evenly spaced holes in the rotation disc for the sensor to 'see' through. - // The first hole is much bigger, enabling the game to determine the position. - if ((m_motor_pos & 0xf) < 4 || m_motor_pos < 0xc) - m_sensor_blind = false; - else - m_sensor_blind = true; - - // on change, output info - if (m_motor_pos != m_motor_pos_prev) - output_set_value("motor_pos", 100 * (m_motor_pos / (float)0x80)); - - /* 3 display cards per hole, like this: - - (0) <---- display increments this way <---- (7) - - CURSED VICTORY WIZARD DRAGON GOLD KEY SCOUT WARRIOR (void) - LOST WARRIORS BAZAAR CLOSED SWORD SILVER KEY HEALER FOOD (void) - PLAGUE BRIGANDS KEY MISSING PEGASUS BRASS KEY GOLD BEAST (void) - */ - int card_pos = m_motor_pos >> 4 & 7; - if (card_pos != (m_motor_pos_prev >> 4 & 7)) - output_set_value("card_pos", card_pos); - - m_motor_pos_prev = m_motor_pos; -} - - - -/*************************************************************************** - - I/O - -***************************************************************************/ - -WRITE16_MEMBER(mbdtower_state::write_r) -{ - // R0-R2: input mux - m_inp_mux = data & 7; - - // R9: motor on - if ((m_r ^ data) & 0x200) - output_set_value("motor_on", data >> 9 & 1); - if (data & 0x200) - m_motor_on = true; - - // R3: N/C - // R4: 75494 /EN (speaker, lamps, digit select go through that IC) - // R5-R7: tower lamps - // R8: rotation sensor led - m_r = data; - prepare_display(); - - // R10: speaker out - m_speaker->level_w(~data >> 4 & data >> 10 & 1); -} - -WRITE16_MEMBER(mbdtower_state::write_o) -{ - // O0-O6: led segments A-G - // O7: digit select - m_o = data; - prepare_display(); -} - -READ8_MEMBER(mbdtower_state::read_k) -{ - // K: multiplexed inputs - // K8: rotation sensor - return read_inputs(3) | ((!m_sensor_blind && sensor_led_on()) ? 8 : 0); -} - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -/* physical button layout and labels is like this: - - (green) (l.blue) (red) - [YES/ [REPEAT] [NO/ - BUY] END] - - (yellow) (blue) (white) - [HAGGLE] [BAZAAR] [CLEAR] - - (blue) (blue) (blue) - [TOMB/ [MOVE] [SANCTUARY/ - RUIN] CITADEL] - - (orange) (blue) (d.yellow) - [DARK [FRONTIER] [INVENTORY] - TOWER] -*/ - -static INPUT_PORTS_START( mbdtower ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Inventory") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("No/End") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Clear") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Sanctuary/Citadel") - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Frontier") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("Repeat") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Bazaar") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Move") - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Dark Tower") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("Yes/Buy") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Haggle") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Tomb/Ruin") -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -void mbdtower_state::machine_start() -{ - hh_tms1k_state::machine_start(); - - // zerofill - m_motor_pos = 0; - m_motor_pos_prev = -1; - m_motor_decay = 0; - m_motor_on = false; - m_sensor_blind = false; - - // register for savestates - save_item(NAME(m_motor_pos)); - /* save_item(NAME(m_motor_pos_prev)); */ // don't save! - save_item(NAME(m_motor_decay)); - save_item(NAME(m_motor_on)); - save_item(NAME(m_sensor_blind)); -} - - -static MACHINE_CONFIG_START( mbdtower, mbdtower_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1400, 425000) // approximation - RC osc. R=43K, C=56pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(mbdtower_state, read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mbdtower_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mbdtower_state, write_o)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("tower_motor", mbdtower_state, motor_sim_tick, attotime::from_msec(3500/0x80)) // ~3.5sec for a full rotation - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_mbdtower) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( mbdtower ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "mp7332", 0x0000, 0x1000, CRC(ebeab91a) SHA1(7edbff437da371390fa8f28b3d183f833eaa9be9) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_common1_micro.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) - ROM_REGION( 557, "maincpu:opla", 0 ) - ROM_LOAD( "tms1400_mbdtower_output.pla", 0, 557, CRC(64c84697) SHA1(72ce6d24cedf9c606f1742cd5620f75907246e87) ) -ROM_END - - -CONS( 1981, mbdtower, 0, 0, mbdtower, mbdtower, driver_device, 0, "Milton Bradley", "Dark Tower (Milton Bradley)", MACHINE_SUPPORTS_SAVE | MACHINE_MECHANICAL ) diff --git a/src/mess/drivers/mbee.c b/src/mess/drivers/mbee.c deleted file mode 100644 index 35cfd694d67..00000000000 --- a/src/mess/drivers/mbee.c +++ /dev/null @@ -1,1164 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Driver completely rewritten by Robbbert, in a process begun on 2009-02-24. -Assistance/advice was gratefully received from: - E.J.Wordsworth (owner of Microbee Systems), nama, ChickenMan, - and the author of the "ubee512" emulator. - -Previous driver was written by Juergen Buchmueller, Jan 2000 with assistance -from Brett Selwood and Andrew Davies. - - - Keyboard notes are in video/microbee.c - - 256tc: The 1.31 rom version which appears to fit the 256TC is actually - part of the Z80 emulation in the Matilda model. If you fit this rom into a real - 256TC, the floppy disk will not be detected. - - The unemulated Matilda is a IBM XT clone fitted with a NEC V40, and has the - ability to emulate the 256TC as mentioned above. - - Floppy formats: - - All disks are the standard CPCEMU 'dsk' format. - - Types are 9/13cm 40/80 track (single or double sided) - - 13cm has been specified as QD to prevent a nasty crash if an 80-track disk was mounted - - The tracks/sector layout is the same regardless of size - - Although certain models came with particular drives as standard, users could add - the other size if they wished. We support both sizes on any model. - - Early machines have 'standard' video (128 hires characters). - Later machines had the option of 'premium' video which - provides thousands of hires characters, enough to simulate - bit-mapped graphics. - - Commands to call up built-in roms (depends on the model): - NET - Jump to E000, usually the Telcom communications program. - This rom can be replaced with the Dreamdisk Chip-8 rom. - Note that Telcom 3.21 is 8k, it uses a rombank switch - (by reading port 0A) to swap between the two halves. - See Telcom notes below. - - EDASM - Jump to C000, usually the Editor/Assembler package. - - MENU - Do a rombank switch to bank 5 and jump to C000 to start the Shell - - PAK n - Do a rombank switch (write to port 0A) to bank "n" and jump to C000. - - These early colour computers have a PROM to create the foreground palette. - - Notes about the printer: - - Older models default to a 1200 baud serial printer, which we do not support. - - You need to change it to parallel by entering OUTL#1 while in Basic. - - After you mount/create a printfile, you can LPRINT and LLIST in Basic, - or by using the printing option in other apps. - - Notes about Telcom: - - On the older models, Telcom is called up by entering NET from within Basic. Models - from the pc85 onwards have it as a menu option. - - To exit, press Enter without any input. Disk versions, enter CPM or press ^C. - - After being used, version 3 and up will enable the use of OUT#7 in Basic, which - changes the screen to 80x24. Enter OUT#0 to revert to normal. - - Most versions of Telcom can have their parameters adjusted directly from Basic, - without needing to enter the Telcom program. - - Most versions of Telcom have an optional clock. In older models firstly select VS - from the MESS config menu, then enter NET CLOCK to enable it. NET TIME hhmm to set - the time (24hour format). NET CLOCKD is supposed to remove the status line, but it - doesn't, although the clock stops updating. NET CLOCK and NET CLOCKD are toggles. - - Telcom 1.2 (used in mbeeic) has a bug. If you enter NET CLOCK, the status line is - filled with inverse K. You can fix this from Basic by doing NET CLOCK 3 times. - - Notes about Disk System - - Ports 44 to 47 are for standard connection to FD2793. - - Port 48 is used for drive/side/density select on write, and intrq/drq on read. - intrq and drq are OR'd together, then gated to bit 7 of the data bus whenever - port 48 is activated on read. There are no interrupts used. - - How to use the config switch for PIO B7: - - Teleterm: Must use RTC. Anything else makes teleterm go crazy. - - 256TC, 128, 128p: Doesn't seem to matter, leave at the default. - - Standard: Has no effect, best left at "Tied High" - - Other rom-based models: "VS" to make the Telcom clock work, or "Tied high". - - 56k: not sure yet, leave as "Tied high" until more is known. - -*************************************************************************** - - TODO/not working: - - - 256tc: Paste ignores shift key - - All others: Paste drops most characters. - - - various fdc issues: - - B drive doesn't work with most disks. - - some disks cause MESS to freeze. - - ENMF pin missing from wd_fdc. - - incorrect timing for track register causes 256tc failure to boot a disk. - - - Simply Write has keyboard problems (in 128k, no keys work). - - - 256tc: At the menu, if F2 pressed to activate the Monitor, the emulated machine - crashes due to a bug in z80pio emulation. - - - 256tc: the Intro disk doesn't work - - - 256tc, Teleterm: Keyboard CPU inbuilt ROM needs to be dumped. - - 128k, 64k: PALs need to be dumped for the bankswitching. - - - Teleterm: keyboard has problems. The schematic shows it using the old-style keyboard, - however it actually uses the new keyboard with interrupts. - - - Mouse: a few programs support the use of a serial mouse which interfaced - directly to the Z80PIO. However there's little info to be found. - PIO B3 to ground activates the mouse pointer in Shell v3.01. - - - Hard drive (10MB) & controller - -*******************************************************************************/ - -#include "includes/mbee.h" -#include "formats/mbee_cas.h" - -#define XTAL_13_5MHz 13500000 - -/********** NOTE !!! *********************************************************** - The microbee uses lots of bankswitching and the memory maps are still - being determined. Please don't merge memory maps !! -********************************************************************************/ - - -static ADDRESS_MAP_START(mbee_mem, AS_PROGRAM, 8, mbee_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xefff) AM_ROM - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) - AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbeeic_mem, AS_PROGRAM, 8, mbee_state) - AM_RANGE(0x0000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") - AM_RANGE(0xe000, 0xefff) AM_ROM - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) - AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbeepc_mem, AS_PROGRAM, 8, mbee_state) - AM_RANGE(0x0000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") - AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom") - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) - AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbeeppc_mem, AS_PROGRAM, 8, mbee_state) - AM_RANGE(0x0000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("basic") - AM_RANGE(0xa000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") - AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom") - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) - AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbee56_mem, AS_PROGRAM, 8, mbee_state) - AM_RANGE(0x0000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xefff) AM_ROM - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) - AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbee256_mem, AS_PROGRAM, 8, mbee_state) - AM_RANGE(0x0000, 0x0fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x1000, 0x1fff) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") - AM_RANGE(0x2000, 0x2fff) AM_READ_BANK("bankr2") AM_WRITE_BANK("bankw2") - AM_RANGE(0x3000, 0x3fff) AM_READ_BANK("bankr3") AM_WRITE_BANK("bankw3") - AM_RANGE(0x4000, 0x4fff) AM_READ_BANK("bankr4") AM_WRITE_BANK("bankw4") - AM_RANGE(0x5000, 0x5fff) AM_READ_BANK("bankr5") AM_WRITE_BANK("bankw5") - AM_RANGE(0x6000, 0x6fff) AM_READ_BANK("bankr6") AM_WRITE_BANK("bankw6") - AM_RANGE(0x7000, 0x7fff) AM_READ_BANK("bankr7") AM_WRITE_BANK("bankw7") - AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bankr8") AM_WRITE_BANK("bankw8") - AM_RANGE(0x9000, 0x9fff) AM_READ_BANK("bankr9") AM_WRITE_BANK("bankw9") - AM_RANGE(0xa000, 0xafff) AM_READ_BANK("bankr10") AM_WRITE_BANK("bankw10") - AM_RANGE(0xb000, 0xbfff) AM_READ_BANK("bankr11") AM_WRITE_BANK("bankw11") - AM_RANGE(0xc000, 0xcfff) AM_READ_BANK("bankr12") AM_WRITE_BANK("bankw12") - AM_RANGE(0xd000, 0xdfff) AM_READ_BANK("bankr13") AM_WRITE_BANK("bankw13") - AM_RANGE(0xe000, 0xefff) AM_READ_BANK("bankr14") AM_WRITE_BANK("bankw14") - AM_RANGE(0xf000, 0xffff) AM_READ_BANK("bankr15") AM_WRITE_BANK("bankw15") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbeett_mem, AS_PROGRAM, 8, mbee_state) - AM_RANGE(0x0000, 0x7fff) AM_RAM - AM_RANGE(0x8000, 0x9fff) AM_ROM - AM_RANGE(0xa000, 0xbfff) AM_RAM - AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") - AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom") - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(video_low_r, video_low_w) - AM_RANGE(0xf800, 0xffff) AM_READWRITE(video_high_r, video_high_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbee_io, AS_IO, 8, mbee_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_MIRROR(0x10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_WRITE(port0b_w) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) - AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbeeic_io, AS_IO, 8, mbee_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_MIRROR(0x10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x08, 0x08) AM_MIRROR(0x10) AM_READWRITE(port08_r, port08_w) - AM_RANGE(0x09, 0x09) AM_WRITENOP /* Listed as "Colour Wait Off" or "USART 2651" but doesn't appear in the schematics */ - AM_RANGE(0x0a, 0x0a) AM_MIRROR(0x10) AM_WRITE(port0a_w) - AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_WRITE(port0b_w) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) - AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbeepc_io, AS_IO, 8, mbee_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(port08_r, port08_w) - AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP - AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_WRITE(port0b_w) - AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) - AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) - AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_low_r, port0a_w) - AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_high_r, port0a_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbeeppc_io, AS_IO, 8, mbee_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(port08_r, port08_w) - AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP - AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_WRITE(port0b_w) - AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) - AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) - AM_RANGE(0x001c, 0x001c) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) - AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_low_r, port0a_w) - AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_high_r, port0a_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbeett_io, AS_IO, 8, mbee_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x0004, 0x0004) AM_MIRROR(0xff00) AM_WRITE(port04_w) - AM_RANGE(0x0006, 0x0006) AM_MIRROR(0xff00) AM_WRITE(port06_w) - AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(port07_r) - AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(port08_r, port08_w) - AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_WRITE(port0b_w) - AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) - AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) - AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(port18_r) - AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) - AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xfe00) AM_READ(speed_low_r) - AM_RANGE(0x0109, 0x0109) AM_MIRROR(0xfe00) AM_READ(speed_high_r) - AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe00) AM_READWRITE(telcom_low_r, port0a_w) - AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe00) AM_READWRITE(telcom_high_r, port0a_w) - AM_RANGE(0x0068, 0x006f) AM_MIRROR(0xff00) AM_DEVREADWRITE("scc", scc8530_t, reg_r, reg_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbee56_io, AS_IO, 8, mbee_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r, port08_w) - AM_RANGE(0x09, 0x09) AM_WRITENOP - AM_RANGE(0x0b, 0x0b) AM_WRITE(port0b_w) - AM_RANGE(0x0c, 0x0c) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) - AM_RANGE(0x0d, 0x0d) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) - AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write) - AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbee128_io, AS_IO, 8, mbee_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x04, 0x04) AM_WRITE(port04_w) - AM_RANGE(0x06, 0x06) AM_WRITE(port06_w) - AM_RANGE(0x07, 0x07) AM_READ(port07_r) - AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r, port08_w) - AM_RANGE(0x09, 0x09) AM_WRITENOP - AM_RANGE(0x0b, 0x0b) AM_WRITE(port0b_w) - AM_RANGE(0x0c, 0x0c) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) - AM_RANGE(0x0d, 0x0d) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) - AM_RANGE(0x1c, 0x1f) AM_READWRITE(port1c_r, port1c_w) - AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write) - AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w) - AM_RANGE(0x50, 0x57) AM_WRITE(mbee128_50_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mbee256_io, AS_IO, 8, mbee_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0x0004, 0x0004) AM_MIRROR(0xff00) AM_WRITE(port04_w) - AM_RANGE(0x0006, 0x0006) AM_MIRROR(0xff00) AM_WRITE(port06_w) - AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(port07_r) - AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(port08_r, port08_w) - AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xfd00) AM_READ(speed_low_r) - AM_RANGE(0x0209, 0x0209) AM_MIRROR(0xfd00) AM_READ(speed_high_r) - AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP - AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_WRITE(port0b_w) - AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) - AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) - // AM_RANGE(0x0010, 0x0013) AM_MIRROR(0xff00) Optional SN76489AN audio chip - AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(port18_r) - AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) - AM_RANGE(0x0044, 0x0047) AM_MIRROR(0xff00) AM_DEVREADWRITE("fdc", wd2793_t, read, write) - AM_RANGE(0x0048, 0x004f) AM_MIRROR(0xff00) AM_READWRITE(fdc_status_r, fdc_motor_w) - AM_RANGE(0x0050, 0x0057) AM_MIRROR(0xff00) AM_WRITE(mbee256_50_w) - // AM_RANGE(0x0058, 0x005f) AM_MIRROR(0xff00) External options: floppy drive, hard drive and keyboard - // AM_RANGE(0x0060, 0x0067) AM_MIRROR(0xff00) Reserved for file server selection (unused) - // AM_RANGE(0x0068, 0x006f) AM_MIRROR(0xff00) Reserved for 8530 SCC (unused) -ADDRESS_MAP_END - -static INPUT_PORTS_START( oldkb ) - PORT_START("X.0") /* IN0 KEY ROW 0 [000] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) - - PORT_START("X.1") /* IN1 KEY ROW 1 [080] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) - - PORT_START("X.2") /* IN2 KEY ROW 2 [100] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) - - PORT_START("X.3") /* IN3 KEY ROW 3 [180] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("^") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) PORT_CHAR(0x5f) PORT_CHAR(0x1f) // port_char not working - hijacked - - PORT_START("X.4") /* IN4 KEY ROW 4 [200] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("X.5") /* IN5 KEY ROW 5 [280] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("X.6") /* IN6 KEY ROW 6 [300] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Linefeed") PORT_CODE(KEYCODE_HOME) PORT_CHAR(10) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_END) PORT_CHAR(3) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("X.7") /* IN7 KEY ROW 7 [380] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - -static INPUT_PORTS_START( mbee ) - - PORT_INCLUDE( oldkb ) - - // Autorun on quickload - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x01, DEF_STR(Yes)) - // monochrome monitor could be used - PORT_CONFNAME( 0x30, 0x00, "Monitor type") - PORT_CONFSETTING( 0x00, "Colour") - PORT_CONFSETTING( 0x10, "Green") - PORT_CONFSETTING( 0x20, "Amber") - PORT_CONFSETTING( 0x30, "White") - // Wire links on motherboard - PORT_CONFNAME( 0xc0, 0x00, "PIO B7") - PORT_CONFSETTING( 0x00, "VS") // sync pulse to enable telcom clock - PORT_CONFSETTING( 0x40, "RTC") // optional board usually not fitted - PORT_CONFSETTING( 0x80, "Tied high") // default resistor to vcc - PORT_CONFSETTING( 0xc0, "Reserved for net") -INPUT_PORTS_END - -static INPUT_PORTS_START( mbee128 ) - - PORT_INCLUDE( oldkb ) - - // Autorun on quickload - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x01, DEF_STR(Yes)) - // monochrome monitor could be used - PORT_CONFNAME( 0x30, 0x00, "Monitor type") - PORT_CONFSETTING( 0x00, "Colour") - PORT_CONFSETTING( 0x10, "Green") - PORT_CONFSETTING( 0x20, "Amber") - PORT_CONFSETTING( 0x30, "White") - // Wire links on motherboard - PORT_CONFNAME( 0xc0, 0x40, "PIO B7") - PORT_CONFSETTING( 0x00, "VS") // sync pulse to enable telcom clock - PORT_CONFSETTING( 0x40, "RTC") // RTC IRQ for clock - PORT_CONFSETTING( 0x80, "Tied high") // default resistor to vcc - PORT_CONFSETTING( 0xc0, "Reserved for net") -INPUT_PORTS_END - -static INPUT_PORTS_START( mbee256 ) - PORT_START("Y.0") /* IN0 KEY ROW 0 [+00] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_END) PORT_CHAR(3) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 (num)") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL (num)") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y.1") /* IN1 KEY ROW 1 [+08] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Linefeed") PORT_CODE(KEYCODE_HOME) PORT_CHAR(10) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) - - PORT_START("Y.2") /* IN2 KEY ROW 2 [+10] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+ (num)") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 (num)") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 (num)") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) - - PORT_START("Y.3") /* IN3 KEY ROW 3 [+18] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- (num)") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 (num)") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 (num)") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) - - PORT_START("Y.4") /* IN4 KEY ROW 4 [+20] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* (num)") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (num)") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (num)") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) - - PORT_START("Y.5") /* IN5 KEY ROW 5 [+28] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 (num)") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 (num)") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 (num)") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) - - PORT_START("Y.6") /* IN6 KEY ROW 6 [+30] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ (num)") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) - - PORT_START("Y.7") /* IN7 KEY ROW 7 [+38] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) - - PORT_START("Y.8") /* IN0 KEY ROW 0 [+40] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) - - PORT_START("Y.9") /* IN1 KEY ROW 1 [+48] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("Y.10") /* IN2 KEY ROW 2 [+50] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(127) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("Y.11") /* IN3 KEY ROW 3 [+58] */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("Y.12") /* IN4 KEY ROW 4 [+60] */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("Y.13") /* IN5 KEY ROW 5 [+68] */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("Y.14") /* IN6 KEY ROW 6 [+70] */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - - // Autorun on quickload - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x01, DEF_STR(Yes)) - // Wire links on motherboard - PORT_CONFNAME( 0xc0, 0x40, "PIO B7") - PORT_CONFSETTING( 0x00, "VS") // sync pulse to enable telcom clock - PORT_CONFSETTING( 0x40, "RTC") // RTC IRQ must be used on teleterm - PORT_CONFSETTING( 0x80, "Tied high") // default resistor to vcc - PORT_CONFSETTING( 0xc0, "Reserved for net") -INPUT_PORTS_END - -static const z80_daisy_config mbee_daisy_chain[] = -{ - { "z80pio" }, - { NULL } -}; - -/**************************** F4 CHARACTER DISPLAYER */ -static const gfx_layout mbee_charlayout = -{ - 8,16, /* 8 x 16 characters */ - RGN_FRAC(1,1), - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( mono ) - GFXDECODE_ENTRY( "gfx", 0x0000, mbee_charlayout, 96, 1 ) -GFXDECODE_END - -static GFXDECODE_START( standard ) - GFXDECODE_ENTRY( "gfx", 0x0000, mbee_charlayout, 0, 48 ) -GFXDECODE_END - -static GFXDECODE_START( premium ) - GFXDECODE_ENTRY( "gfx", 0x0000, mbee_charlayout, 0, 8 ) -GFXDECODE_END - -static SLOT_INTERFACE_START( mbee_floppies ) - SLOT_INTERFACE( "drive3a", FLOPPY_35_DD ) - SLOT_INTERFACE( "drive3b", FLOPPY_35_DD ) - SLOT_INTERFACE( "drive5a", FLOPPY_525_QD ) - SLOT_INTERFACE( "drive5b", FLOPPY_525_QD ) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( mbee, mbee_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 6) /* 2 MHz */ - MCFG_CPU_PROGRAM_MAP(mbee_mem) - MCFG_CPU_IO_MAP(mbee_io) - MCFG_CPU_CONFIG(mbee_daisy_chain) - - MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_12MHz / 6) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(mbee_state, pio_ardy)) - MCFG_Z80PIO_IN_PB_CB(READ8(mbee_state, pio_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(mbee_state, pio_port_b_w)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) /* not accurate */ - MCFG_SCREEN_SIZE(64*8, 19*16) /* need at least 17 lines for NET */ - MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 19*16-1) - MCFG_SCREEN_UPDATE_DRIVER(mbee_state, screen_update_mbee) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mono) - - MCFG_PALETTE_ADD("palette", 100) - MCFG_PALETTE_INIT_OWNER(mbee_state, standard) - - MCFG_VIDEO_START_OVERRIDE(mbee_state, mono) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_12MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(mbee_state, crtc_update_row) - MCFG_MC6845_ADDR_CHANGED_CB(mbee_state, crtc_update_addr) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(mbee_state, crtc_vs)) - - MCFG_QUICKLOAD_ADD("quickload", mbee_state, mbee, "mwb,com,bee", 3) - MCFG_QUICKLOAD_ADD("quickload2", mbee_state, mbee_z80bin, "bin", 3) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("z80pio", z80pio_device, strobe_a)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(mbee_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( mbeeic, mbee_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_13_5MHz / 4) /* 3.37500 MHz */ - MCFG_CPU_PROGRAM_MAP(mbeeic_mem) - MCFG_CPU_IO_MAP(mbeeic_io) - MCFG_CPU_CONFIG(mbee_daisy_chain) - - MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, 3375000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(mbee_state, pio_ardy)) - MCFG_Z80PIO_IN_PB_CB(READ8(mbee_state, pio_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(mbee_state, pio_port_b_w)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) /* not accurate */ - MCFG_SCREEN_SIZE(80*8, 310) - MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 19*16-1) - MCFG_SCREEN_UPDATE_DRIVER(mbee_state, screen_update_mbee) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", standard) - - MCFG_PALETTE_ADD("palette", 100) - MCFG_PALETTE_INIT_OWNER(mbee_state, standard) - - MCFG_VIDEO_START_OVERRIDE(mbee_state, standard) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_13_5MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(mbee_state, crtc_update_row) - MCFG_MC6845_ADDR_CHANGED_CB(mbee_state, crtc_update_addr) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(mbee_state, crtc_vs)) - - MCFG_QUICKLOAD_ADD("quickload", mbee_state, mbee, "mwb,com,bee", 2) - MCFG_QUICKLOAD_ADD("quickload2", mbee_state, mbee_z80bin, "bin", 2) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("z80pio", z80pio_device, strobe_a)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(mbee_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mbeepc, mbeeic ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(mbeepc_mem) - MCFG_CPU_IO_MAP(mbeepc_io) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mbeeppc, mbeeic ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(mbeeppc_mem) - MCFG_CPU_IO_MAP(mbeeppc_io) - MCFG_VIDEO_START_OVERRIDE(mbee_state, premium) - MCFG_GFXDECODE_MODIFY("gfxdecode", premium) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(mbee_state, premium) - MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) - MCFG_MC146818_IRQ_HANDLER(WRITELINE(mbee_state, rtc_irq_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mbee56, mbeeic ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(mbee56_mem) - MCFG_CPU_IO_MAP(mbee56_io) - MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee56) - MCFG_WD2793_ADD("fdc", XTAL_4MHz / 2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(mbee_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(mbee_state, fdc_drq_w)) - MCFG_WD_FDC_ENMF_CALLBACK(GND) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "drive5a", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "drive5b", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mbee128, mbee56 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(mbee256_mem) - MCFG_CPU_IO_MAP(mbee128_io) - MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128) - MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) - MCFG_MC146818_IRQ_HANDLER(WRITELINE(mbee_state, rtc_irq_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mbee128p, mbeeppc ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(mbee256_mem) - MCFG_CPU_IO_MAP(mbee128_io) - MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128) - MCFG_WD2793_ADD("fdc", XTAL_4MHz / 2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(mbee_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(mbee_state, fdc_drq_w)) - MCFG_WD_FDC_ENMF_CALLBACK(GND) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "drive5a", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "drive5b", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mbee256, mbee128p ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(mbee256_mem) - MCFG_CPU_IO_MAP(mbee256_io) - MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee256) - - MCFG_DEVICE_REMOVE("fdc:0") - MCFG_DEVICE_REMOVE("fdc:1") - MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "drive3a", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "drive3b", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mbeett, mbeeppc ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(mbeett_mem) - MCFG_CPU_IO_MAP(mbeett_io) - MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbeett) - MCFG_DEVICE_REMOVE("quickload") - MCFG_DEVICE_REMOVE("quickload2") - MCFG_DEVICE_ADD("scc", SCC8530, 4000000) // clock unknown -MACHINE_CONFIG_END - -/* Unused roms: - ROM_LOAD_OPTIONAL("net.rom", 0xe000, 0x1000, CRC(e14aac4c) SHA1(330902cf47f53c22c85003a620f7d7d3261ebb67) ) - customised for a certain high school. Requires pulsing at bit 3 port 0 before it runs. - - ROM_LOAD_OPTIONAL("chip8_22.rom", 0xe000, 0x1000, CRC(11fbb547) SHA1(7bd9dc4b67b33b8e1be99beb6a0ddff25bdbd3f7) ) - Dreamcards Chip-8 V2.2 rom - - ROM_LOAD_OPTIONAL("telcom11.rom", 0xe000, 0x1000, CRC(15516499) SHA1(2d4953f994b66c5d3b1d457b8c92d9a0a69eb8b8) ) - Telcom 1.1 for the mbeeic (It could have 1.0, 1.1 or 1.2) - -*/ - - -/* gfxram: - 0000 = normal characters in charrom - 0800 = small characters in charrom - 1000 = characters selected - 1800 = pcg */ - -ROM_START( mbee ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD("bas510a.ic25", 0x8000, 0x1000, CRC(2ca47c36) SHA1(f36fd0afb3f1df26edc67919e78000b762b6cbcb) ) - ROM_LOAD("bas510b.ic27", 0x9000, 0x1000, CRC(a07a0c51) SHA1(dcbdd9df78b4b6b2972de2e4050dabb8ae9c3f5a) ) - ROM_LOAD("bas510c.ic28", 0xa000, 0x1000, CRC(906ac00f) SHA1(9b46458e5755e2c16cdb191a6a70df6de9fe0271) ) - ROM_LOAD("bas510d.ic30", 0xb000, 0x1000, CRC(61727323) SHA1(c0fea9fd0e25beb9faa7424db8efd07cf8d26c1b) ) - ROM_LOAD_OPTIONAL("edasma.ic31", 0xc000, 0x1000, CRC(120c3dea) SHA1(32c9bb6e54dd50d5218bb43cc921885a0307161d) ) - ROM_LOAD_OPTIONAL("edasmb.ic33", 0xd000, 0x1000, CRC(a23bf3c8) SHA1(73a57c2800a1c744b527d0440b170b8b03351753) ) - ROM_LOAD_OPTIONAL("telcom10.rom", 0xe000, 0x1000, CRC(cc9ac94d) SHA1(6804b5ff54d16f8e06180751d8681c44f351e0bb) ) - - ROM_REGION(0x2000, "gfx", 0) - ROM_LOAD("charrom.ic13", 0x1000, 0x0800, CRC(b149737b) SHA1(a3cd4f5d0d3c71137cd1f0f650db83333a2e3597) ) - ROM_RELOAD( 0x0000, 0x0800 ) - ROM_RELOAD( 0x0800, 0x0800 ) - - ROM_REGION( 0x0020, "proms", 0 ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0000, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) -ROM_END - -ROM_START( mbeeic ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD("bas522a.rom", 0x8000, 0x2000, CRC(7896a696) SHA1(a158f7803296766160e1f258dfc46134735a9477) ) - ROM_LOAD("bas522b.rom", 0xa000, 0x2000, CRC(b21d9679) SHA1(332844433763331e9483409cd7da3f90ac58259d) ) - ROM_LOAD_OPTIONAL("telcom12.rom", 0xe000, 0x1000, CRC(0231bda3) SHA1(be7b32499034f985cc8f7865f2bc2b78c485585c) ) - - /* PAK option roms */ - ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) - ROM_LOAD_OPTIONAL("edasm.rom", 0x0000, 0x2000, CRC(1af1b3a9) SHA1(d035a997c2dbbb3918b3395a3a5a1076aa203ee5) ) // 0 - ROM_LOAD_OPTIONAL("wbee12.rom", 0x2000, 0x2000, CRC(0fc21cb5) SHA1(33b3995988fc51ddef1568e160dfe699867adbd5) ) // 1 - ROM_LOAD_OPTIONAL("forth11.rom", 0x4000, 0x2000, CRC(f0fc2358) SHA1(b7303b94abe647d5a6ffb2fba5d205412f970c16) ) // 2 - - ROM_REGION(0x2000, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) -ROM_END - -ROM_START( mbeepc ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD("bas522a.rom", 0x8000, 0x2000, CRC(7896a696) SHA1(a158f7803296766160e1f258dfc46134735a9477) ) - ROM_LOAD("bas522b.rom", 0xa000, 0x2000, CRC(b21d9679) SHA1(332844433763331e9483409cd7da3f90ac58259d) ) - - ROM_REGION(0x2000, "telcomrom", 0) - ROM_LOAD_OPTIONAL("telcom31.rom", 0x0000, 0x2000, CRC(5a904a29) SHA1(3120fb65ccefeb180ab80d8d35440c70dc8452c8) ) - - /* PAK option roms */ - ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) - ROM_LOAD_OPTIONAL("edasm.rom", 0x0000, 0x2000, CRC(1af1b3a9) SHA1(d035a997c2dbbb3918b3395a3a5a1076aa203ee5) ) // 0 - ROM_LOAD_OPTIONAL("wbee12.rom", 0x2000, 0x2000, CRC(0fc21cb5) SHA1(33b3995988fc51ddef1568e160dfe699867adbd5) ) // 1 - ROM_LOAD_OPTIONAL("mwbhelp.rom", 0x4000, 0x2000, CRC(d34fae54) SHA1(5ed30636f48e9d208ce2da367ba4425782a5bce3) ) // 2 - - ROM_REGION(0x2000, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) -ROM_END - -ROM_START( mbeepc85 ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("bas525a.rom", 0x8000, 0x2000, CRC(a6e02afe) SHA1(0495308c7e1d84b5989a3af6d3b881f4580b2641) ) - ROM_LOAD("bas525b.rom", 0xa000, 0x2000, CRC(245dd36b) SHA1(dd288f3e6737627f50d3d2a49df3e57c423d3118) ) - - ROM_REGION(0x2000, "telcomrom", 0) - ROM_LOAD_OPTIONAL("telco321.rom", 0x0000, 0x2000, CRC(36852a11) SHA1(c45b8d03629e86231c6b256a7435abd87d8872a4) ) - - /* PAK option roms - Wordbee must be in slot 0 and Shell must be in slot 5. */ - ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) - ROM_LOAD("wbee13.rom", 0x0000, 0x2000, CRC(d7c58b7b) SHA1(5af1b8d21a0f21534ed1833ae919dbbc6ca973e2) ) // 0 - ROM_LOAD_OPTIONAL("cmdhelp.rom", 0x2000, 0x2000, CRC(a4f1fa90) SHA1(1456abc6ed0501a3b15a99b4302750843293ae5f) ) // 1 - ROM_LOAD_OPTIONAL("edasm.rom", 0x4000, 0x2000, CRC(1af1b3a9) SHA1(d035a997c2dbbb3918b3395a3a5a1076aa203ee5) ) // 2 - ROM_LOAD_OPTIONAL("forth.rom", 0x6000, 0x2000, CRC(c0795c2b) SHA1(8faa0a46fbbdb8a1019d706a40cd4431a5063f8c) ) // 3 - ROM_LOAD("shell.rom", 0xa000, 0x2000, CRC(5a2c7cd6) SHA1(8edc086710cb558f2146d660eddc8a18ba6a141c) ) // 5 - ROM_LOAD_OPTIONAL("ozlogo.rom", 0xc000, 0x2000, CRC(47c3ef69) SHA1(8274d27c323ca4a6cc9e7d24946ae9c0531c3112) ) // 6 - ROM_LOAD_OPTIONAL("chess.rom", 0xe000, 0x2000, CRC(fe9ee9d0) SHA1(a316559414e68c0101af5f00755db551e7c5788e) ) // 7 - - ROM_REGION(0x2000, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) -ROM_END - -ROM_START( mbeepc85b ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("bas525a.rom", 0x8000, 0x2000, CRC(a6e02afe) SHA1(0495308c7e1d84b5989a3af6d3b881f4580b2641) ) - ROM_LOAD("bas525b.rom", 0xa000, 0x2000, CRC(245dd36b) SHA1(dd288f3e6737627f50d3d2a49df3e57c423d3118) ) - - ROM_REGION(0x2000, "telcomrom", 0) - ROM_LOAD_OPTIONAL("telco321.rom", 0x0000, 0x2000, CRC(36852a11) SHA1(c45b8d03629e86231c6b256a7435abd87d8872a4) ) - - /* PAK option roms - Wordbee must be in slot 0 and Shell must be in slot 5. */ - ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) - ROM_LOAD("wbee13.rom", 0x0000, 0x2000, CRC(d7c58b7b) SHA1(5af1b8d21a0f21534ed1833ae919dbbc6ca973e2) ) // 0 - ROM_LOAD_OPTIONAL("cmdhelp.rom", 0x2000, 0x2000, CRC(a4f1fa90) SHA1(1456abc6ed0501a3b15a99b4302750843293ae5f) ) // 1 - ROM_LOAD_OPTIONAL("busy.rom", 0x4000, 0x2000, CRC(56255f60) SHA1(fd2e37209fd49290be6875bc460cfc05392938ba) ) // 2 - ROM_CONTINUE( 0x14000, 0x2000 ) - ROM_LOAD_OPTIONAL("graphics.rom", 0x6000, 0x2000, CRC(9e9d327c) SHA1(aebf60ed153004380b9f271f2212376910a6cef9) ) // 3 - ROM_CONTINUE( 0x16000, 0x2000 ) - ROM_LOAD_OPTIONAL("viatel.rom", 0x8000, 0x2000, CRC(2da2411f) SHA1(d3cfa978165feef0a96e28197f6a762aa6604799) ) // 4 - ROM_LOAD("shell-b.rom", 0xa000, 0x2000, CRC(17bf2d58) SHA1(ae22a5fc5783f37066ba5555497e40945272ca3d) ) // 5 - - ROM_REGION(0x2000, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) -ROM_END - -ROM_START( mbeepc85s ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("bas524a.rom", 0x8000, 0x2000, CRC(ec9c7a60) SHA1(a4021bcedc8da8c0eb0bda036a1d457619a175b0) ) - ROM_LOAD("bas524b.rom", 0xa000, 0x2000, CRC(17d3eac7) SHA1(d40d376cc5e751d257d951909a34445e70506c7b) ) - - ROM_REGION(0x2000, "telcomrom", 0) - ROM_LOAD_OPTIONAL("telco321s.rom", 0x0000, 0x2000, CRC(00f8fde1) SHA1(eb881bbab90c85fd6e29540decd25e884c67f738) ) - - /* PAK roms - These are not optional and will only work in the correct slots. */ - ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) - ROM_LOAD("wbee20-s.rom", 0x0000, 0x2000, CRC(6a0fe57f) SHA1(a101b588b1872e19382b9e9ea50fabb0fd060aa6) ) // 0 - ROM_LOAD("db-s.rom", 0x2000, 0x2000, CRC(e2094771) SHA1(62d7fb66c91d2bd24523bc84e4f005cf2c4480bb) ) // 1 - ROM_LOAD("kalk-s.rom", 0x4000, 0x2000, CRC(08dd71ee) SHA1(c9d506d8bb56f602c3481b253d4cac226f545d98) ) // 2 - ROM_LOAD("bg-s.rom", 0x6000, 0x2000, CRC(5aa4813e) SHA1(a8638e9046bfb9d5a98c878322295ce408bd879d) ) // 3 - ROM_LOAD("videotex-s.rom", 0x8000, 0x2000, CRC(67592b3f) SHA1(7f1d23ded34781ccda5f36b4a4fa118a8c0e44ec) ) // 4 - ROM_LOAD("shell-s.rom", 0xa000, 0x2000, CRC(bdf1768f) SHA1(4385351d07288cf94947ac63131eeed98572caa1) ) // 5 - - ROM_REGION(0x2000, "gfx", 0) - ROM_LOAD("charrom-s.bin", 0x1000, 0x1000, CRC(1bcbf083) SHA1(6438649b8b5fc20dd772ec7195e69a5bbe016b09) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) -ROM_END - -ROM_START( mbeett ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD("kernel_106.rom", 0x8000, 0x2000, CRC(5ab9cb1d) SHA1(a1fb971622f85c4d866b91cb4bec6d75757e8c5f) ) - - ROM_REGION(0x2000, "telcomrom", 0) - ROM_LOAD("wm_106.rom", 0x0000, 0x2000, CRC(77e0b355) SHA1(1db6769cd6b12e1c335c83f17f8c139986c87758) ) - - ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) - ROM_LOAD("tv_470311.rom", 0x2000, 0x2000, CRC(2c4c2dcb) SHA1(77cd75166a389cb2d1d8abf00b1ddd077ce98354) ) // 1 - ROM_CONTINUE( 0x12000, 0x2000 ) - ROM_LOAD("tw_103.rom", 0x4000, 0x2000, CRC(881edb4b) SHA1(f6e30a12b1537bd55b69d1319799b150e80a471b) ) // 2 - ROM_CONTINUE( 0x14000, 0x2000 ) - ROM_LOAD("oside_107.rom", 0x6000, 0x2000, CRC(05d99aba) SHA1(4f88d63025f99bcc54d6f2abc20a699c97384f68) ) // 3 - ROM_CONTINUE( 0x16000, 0x1000 ) - ROM_LOAD("test_105.rom", 0x8000, 0x2000, CRC(b69aa618) SHA1(49de8cbad59f549c7ad9f8efc9beee0cfcd901fe) ) // 4 - - ROM_REGION(0x9800, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) -ROM_END - -ROM_START( mbeeppc ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("bas529b.rom", 0xa000, 0x2000, CRC(a1bd986b) SHA1(5d79f210c9042db5aefc85a0bdf45210cb9e9899) ) - - ROM_REGION(0x4000, "basicrom", 0) - ROM_LOAD("bas529a.rom", 0x0000, 0x4000, CRC(fe8242e1) SHA1(ff790edf4fcc7a134d451dbad7779157b07f6abf) ) - - ROM_REGION(0x2000, "telcomrom", 0) - ROM_LOAD_OPTIONAL("telco321.rom", 0x0000, 0x2000, CRC(36852a11) SHA1(c45b8d03629e86231c6b256a7435abd87d8872a4) ) - - /* PAK option roms - Wordbee must be in slot 0 and Shell must be in slot 5. */ - ROM_REGION(0x20000, "pakrom", ROMREGION_ERASEFF) - ROM_LOAD("wbee13.rom", 0x0000, 0x2000, CRC(d7c58b7b) SHA1(5af1b8d21a0f21534ed1833ae919dbbc6ca973e2) ) // 0 - ROM_LOAD_OPTIONAL("cmdhelp.rom", 0x2000, 0x2000, CRC(a4f1fa90) SHA1(1456abc6ed0501a3b15a99b4302750843293ae5f) ) // 1 - ROM_LOAD_OPTIONAL("busy-p.rom", 0x4000, 0x2000, CRC(f2897427) SHA1(b4c351bdac72d89589980be6d654f9b931bcba6b) ) // 2 - ROM_CONTINUE( 0x14000, 0x2000 ) - ROM_LOAD_OPTIONAL("graphics.rom", 0x6000, 0x2000, CRC(9e9d327c) SHA1(aebf60ed153004380b9f271f2212376910a6cef9) ) // 3 - ROM_CONTINUE( 0x16000, 0x2000 ) - ROM_LOAD_OPTIONAL("vtex235.rom", 0x8000, 0x2000, CRC(8c30ecb2) SHA1(cf068462d7def885bdb5d3a265851b88c727c0d7) ) // 4 - ROM_LOAD("ppcshell.rom", 0xa000, 0x2000, CRC(1e793555) SHA1(ddeaa081ec4408e80e3fb192865d87daa035c701) ) // 5 - - ROM_REGION(0x9800, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) - ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) -ROM_END - -ROM_START( mbee56 ) - ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF) - ROM_LOAD("56kb.rom", 0xe000, 0x1000, CRC(28211224) SHA1(b6056339402a6b2677b0e6c57bd9b78a62d20e4f) ) - - ROM_REGION(0x2000, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) -ROM_END - -ROM_START( mbee128 ) // Standard 128k (CIAB is the same thing with half the ram) - ROM_REGION(0x20000, "rams", ROMREGION_ERASEFF) - - ROM_REGION(0x8000, "roms", 0) - ROM_LOAD("bn54.bin", 0x0000, 0x2000, CRC(995c53db) SHA1(46e1a5cfd5795b8cf528bacf9dc79398ff7d64af) ) - - ROM_REGION(0x2000, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION(0x4000, "pals", 0) // undumped; using prom from 256tc for now - ROM_LOAD( "silver.u39", 0x0000, 0x4000, BAD_DUMP CRC(c34aab64) SHA1(781fe648488dec90185760f8e081e488b73b68bf) ) - - ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) -ROM_END - -ROM_START( mbee128p ) // Premium 128K - ROM_REGION(0x20000, "rams", ROMREGION_ERASEFF) - - ROM_REGION(0x8000, "roms", 0) // rom plus optional undumped roms plus dummy area - ROM_SYSTEM_BIOS( 0, "bn56", "bn56" ) - ROMX_LOAD("bn56.rom", 0x0000, 0x2000, CRC(3f76769d) SHA1(cfae2069d739c26fe39f734d9f705a3c965d1e6f), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "bn59", "Version 2.02" ) - ROMX_LOAD("bn59.rom", 0x0000, 0x2000, CRC(97384116) SHA1(87f2c4ab1a1f2964ba4f2bb60e62dc9c163831ba), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "bn60", "Version 2.03" ) - ROMX_LOAD("bn60.rom", 0x0000, 0x2000, CRC(ed15d4ee) SHA1(3ea42b63d42b9a4c5402676dee8912ad1f906bda), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "bn55", "bn55" ) - ROMX_LOAD("bn55.rom", 0x0000, 0x2000, CRC(ca2c1073) SHA1(355d90d181de899cc7af892df96305fead9c81b4), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "bn54", "bn54" ) - ROMX_LOAD("bn54.rom", 0x0000, 0x2000, CRC(995c53db) SHA1(46e1a5cfd5795b8cf528bacf9dc79398ff7d64af), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "hd18", "Hard Disk System" ) - ROMX_LOAD("hd18.rom", 0x0000, 0x2000, CRC(ed53ace7) SHA1(534e2e00cc527197c76b3c106b3c9ff7f1328487), ROM_BIOS(6) ) - - ROM_REGION(0x4000, "pals", 0) // undumped; using prom from 256tc for now - ROM_LOAD( "silver.u39", 0x0000, 0x4000, BAD_DUMP CRC(c34aab64) SHA1(781fe648488dec90185760f8e081e488b73b68bf) ) - - ROM_REGION(0x9800, "gfx", 0) - ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) - ROM_RELOAD( 0x0000, 0x1000 ) - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) - ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) -ROM_END - -ROM_START( mbee256 ) // 256tc - ROM_REGION(0x40000, "rams", ROMREGION_ERASEFF) - - ROM_REGION(0x5000, "roms", 0) // rom plus dummy area - ROM_SYSTEM_BIOS( 0, "1.20", "Version 1.20" ) - ROMX_LOAD("256tc_boot_1.20.u38", 0x0000, 0x4000, CRC(fe8d6a84) SHA1(a037a1b90b18a2180e9f5f216b829fcd480449a4), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "1.15", "Version 1.15" ) - ROMX_LOAD("256tc_boot_1.15.u38", 0x0000, 0x4000, CRC(1902062d) SHA1(e4a1c0b3f4996e313da0bac0edb6d34e3270723e), ROM_BIOS(2) ) - - ROM_REGION(0x4000, "pals", 0) - ROM_LOAD( "silver.u39", 0x0000, 0x4000, CRC(c34aab64) SHA1(781fe648488dec90185760f8e081e488b73b68bf) ) - - ROM_REGION(0x9800, "gfx", 0) - ROM_LOAD("char256.u53", 0x1000, 0x1000, CRC(9372af3c) SHA1(a63591822c0504de2fed52e88d64e1dbd6124b74) ) - ROM_IGNORE( 0x1000 ) // throw away swedish characters for now - ROM_COPY( "gfx", 0x1000, 0x0000, 0x1000 ) - - ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) - ROM_REGION( 0x0800, "colorram", ROMREGION_ERASEVAL(2)) - ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1982, mbee, 0, 0, mbee, mbee, mbee_state, mbee, "Applied Technology", "Microbee 16 Standard" , 0 ) -COMP( 1982, mbeeic, mbee, 0, mbeeic, mbee, mbee_state, mbeeic, "Applied Technology", "Microbee 32 IC" , 0 ) -COMP( 1982, mbeepc, mbee, 0, mbeepc, mbee, mbee_state, mbeepc, "Applied Technology", "Microbee Personal Communicator" , 0 ) -COMP( 1985, mbeepc85, mbee, 0, mbeepc, mbee, mbee_state, mbeepc85, "Applied Technology", "Microbee PC85" , 0 ) -COMP( 1985, mbeepc85b,mbee, 0, mbeepc, mbee, mbee_state, mbeepc85, "Applied Technology", "Microbee PC85 (New version)" , 0 ) -COMP( 1985, mbeepc85s,mbee, 0, mbeepc, mbee, mbee_state, mbeepc85, "Applied Technology", "Microbee PC85 (Swedish)" , 0 ) -COMP( 1986, mbeeppc, mbee, 0, mbeeppc, mbee, mbee_state, mbeeppc, "Applied Technology", "Microbee Premium PC85" , 0 ) -COMP( 1986, mbeett, mbee, 0, mbeett, mbee256, mbee_state, mbeett, "Applied Technology", "Microbee Teleterm" , MACHINE_NOT_WORKING ) -COMP( 1986, mbee56, mbee, 0, mbee56, mbee, mbee_state, mbee56, "Applied Technology", "Microbee 56k" , MACHINE_NOT_WORKING ) -COMP( 1986, mbee128, mbee, 0, mbee128, mbee128, mbee_state, mbee128, "Applied Technology", "Microbee 128k Standard" , MACHINE_NOT_WORKING ) -COMP( 1986, mbee128p, mbee, 0, mbee128p, mbee128, mbee_state, mbee128, "Applied Technology", "Microbee 128k Premium" , MACHINE_NOT_WORKING ) -COMP( 1987, mbee256, mbee, 0, mbee256, mbee256, mbee_state, mbee256, "Applied Technology", "Microbee 256TC" , MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/mc10.c b/src/mess/drivers/mc10.c deleted file mode 100644 index af38ba6cc63..00000000000 --- a/src/mess/drivers/mc10.c +++ /dev/null @@ -1,608 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Dirk Best -/*************************************************************************** - - TRS-80 Radio Shack MicroColor Computer - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "sound/dac.h" -#include "video/mc6847.h" -#include "video/ef9345.h" -#include "imagedev/cassette.h" -#include "imagedev/printer.h" -#include "formats/coco_cas.h" -#include "machine/ram.h" - - -//printer state -enum -{ - PRINTER_WAIT, - PRINTER_REC, - PRINTER_DONE -}; - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -class mc10_state : public driver_device -{ -public: - mc10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_mc6847(*this, "mc6847"), - m_ef9345(*this, "ef9345"), - m_dac(*this, "dac"), - m_ram(*this, RAM_TAG), - m_cassette(*this, "cassette"), - m_printer(*this, "printer") - { } - - required_device m_maincpu; - optional_device m_mc6847; - optional_device m_ef9345; - required_device m_dac; - required_device m_ram; - required_device m_cassette; - required_device m_printer; - - UINT8 *m_ram_base; - UINT32 m_ram_size; - UINT8 m_keyboard_strobe; - UINT8 m_port2; - - // printer - UINT8 m_pr_buffer; - UINT8 m_pr_counter; - UINT8 m_pr_state; - - DECLARE_READ8_MEMBER( mc10_bfff_r ); - DECLARE_WRITE8_MEMBER( mc10_bfff_w ); - DECLARE_READ8_MEMBER( alice90_bfff_r ); - DECLARE_WRITE8_MEMBER( alice32_bfff_w ); - DECLARE_READ8_MEMBER( mc10_port1_r ); - DECLARE_WRITE8_MEMBER( mc10_port1_w ); - DECLARE_READ8_MEMBER( mc10_port2_r ); - DECLARE_WRITE8_MEMBER( mc10_port2_w ); - DECLARE_READ8_MEMBER( mc6847_videoram_r ); - DECLARE_DRIVER_INIT(mc10); - TIMER_DEVICE_CALLBACK_MEMBER(alice32_scanline); -}; - - -/*************************************************************************** - MEMORY MAPPED I/O -***************************************************************************/ - -READ8_MEMBER( mc10_state::mc10_bfff_r ) -{ - UINT8 result = 0xff; - - if (!BIT(m_keyboard_strobe, 0)) result &= ioport("pb0")->read(); - if (!BIT(m_keyboard_strobe, 1)) result &= ioport("pb1")->read(); - if (!BIT(m_keyboard_strobe, 2)) result &= ioport("pb2")->read(); - if (!BIT(m_keyboard_strobe, 3)) result &= ioport("pb3")->read(); - if (!BIT(m_keyboard_strobe, 4)) result &= ioport("pb4")->read(); - if (!BIT(m_keyboard_strobe, 5)) result &= ioport("pb5")->read(); - if (!BIT(m_keyboard_strobe, 6)) result &= ioport("pb6")->read(); - if (!BIT(m_keyboard_strobe, 7)) result &= ioport("pb7")->read(); - - return result; -} - -READ8_MEMBER( mc10_state::alice90_bfff_r ) -{ - UINT8 result = 0xff; - - if (!BIT(m_keyboard_strobe, 7)) result &= ioport("pb7")->read(); - else - if (!BIT(m_keyboard_strobe, 6)) result &= ioport("pb6")->read(); - else - if (!BIT(m_keyboard_strobe, 5)) result &= ioport("pb5")->read(); - else - if (!BIT(m_keyboard_strobe, 4)) result &= ioport("pb4")->read(); - else - if (!BIT(m_keyboard_strobe, 3)) result &= ioport("pb3")->read(); - else - if (!BIT(m_keyboard_strobe, 2)) result &= ioport("pb2")->read(); - else - if (!BIT(m_keyboard_strobe, 1)) result &= ioport("pb1")->read(); - else - if (!BIT(m_keyboard_strobe, 0)) result &= ioport("pb0")->read(); - - return result; -} - -WRITE8_MEMBER( mc10_state::mc10_bfff_w ) -{ - /* bit 2 to 6, mc6847 mode lines */ - m_mc6847->gm2_w(BIT(data, 2)); - m_mc6847->intext_w(BIT(data, 2)); - m_mc6847->gm1_w(BIT(data, 3)); - m_mc6847->gm0_w(BIT(data, 4)); - m_mc6847->ag_w(BIT(data, 5)); - m_mc6847->css_w(BIT(data, 6)); - - /* bit 7, dac output */ - m_dac->write_unsigned8(BIT(data, 7)); -} - -WRITE8_MEMBER( mc10_state::alice32_bfff_w ) -{ - /* bit 7, dac output */ - m_dac->write_unsigned8(BIT(data, 7)); -} - - -/*************************************************************************** - MC6803 I/O -***************************************************************************/ - -/* keyboard strobe */ -READ8_MEMBER( mc10_state::mc10_port1_r ) -{ - return m_keyboard_strobe; -} - -/* keyboard strobe */ -WRITE8_MEMBER( mc10_state::mc10_port1_w ) -{ - m_keyboard_strobe = data; -} - -READ8_MEMBER( mc10_state::mc10_port2_r ) -{ - UINT8 result = 0xeb; - - /* bit 1, keyboard line pa6 */ - if (!BIT(m_keyboard_strobe, 0)) result &= ioport("pb0")->read() >> 5; - if (!BIT(m_keyboard_strobe, 2)) result &= ioport("pb2")->read() >> 5; - if (!BIT(m_keyboard_strobe, 7)) result &= ioport("pb7")->read() >> 5; - - /* bit 2, printer ots input */ - result |= (m_printer->is_ready() ? 0 : 4); - - /* bit 3, rs232 input */ - - /* bit 4, cassette input */ - result |= ((m_cassette)->input() >= 0 ? 1 : 0) << 4; - - return result; -} - -WRITE8_MEMBER( mc10_state::mc10_port2_w ) -{ - /* bit 0, cassette & printer output */ - m_cassette->output( BIT(data, 0) ? +1.0 : -1.0); - - switch (m_pr_state) - { - case PRINTER_WAIT: - if (BIT(m_port2, 0) && !BIT(data, 0)) - { - m_pr_state = PRINTER_REC; - m_pr_counter = 8; - m_pr_buffer = 0; - } - break; - case PRINTER_REC: - if (m_pr_counter--) - m_pr_buffer |= (BIT(data,0)<<(7-m_pr_counter)); - else - m_pr_state = PRINTER_DONE; - break; - case PRINTER_DONE: - if (BIT(data,0)) - m_printer->output(m_pr_buffer); - m_pr_state = PRINTER_WAIT; - break; - } - - m_port2 = data; -} - - -/*************************************************************************** - VIDEO EMULATION -***************************************************************************/ - -READ8_MEMBER( mc10_state::mc6847_videoram_r ) -{ - if (offset == ~0) return 0xff; - m_mc6847->inv_w(BIT(m_ram_base[offset], 6)); - m_mc6847->as_w(BIT(m_ram_base[offset], 7)); - - return m_ram_base[offset]; -} - -TIMER_DEVICE_CALLBACK_MEMBER(mc10_state::alice32_scanline) -{ - m_ef9345->update_scanline((UINT16)param); -} - -/*************************************************************************** - DRIVER INIT -***************************************************************************/ - -DRIVER_INIT_MEMBER(mc10_state,mc10) -{ - address_space &prg = m_maincpu->space(AS_PROGRAM); - - /* initialize keyboard strobe */ - m_keyboard_strobe = 0x00; - - /* initialize memory */ - m_ram_base = m_ram->pointer(); - m_ram_size = m_ram->size(); - m_pr_state = PRINTER_WAIT; - - membank("bank1")->set_base(m_ram_base); - - /* initialize memory expansion */ - if (m_ram_size == 20*1024) - membank("bank2")->set_base(m_ram_base + 0x1000); - else if (m_ram_size == 24*1024) - membank("bank2")->set_base(m_ram_base + 0x2000); - else if (m_ram_size != 32*1024) //ensure that is not alice90 - prg.nop_readwrite(0x5000, 0x8fff); - - /* register for state saving */ - save_item(NAME(m_keyboard_strobe)); - - //for alice32 force port4 DDR to 0xff at startup - if (!strcmp(machine().system().name, "alice32") || !strcmp(machine().system().name, "alice90")) - m_maincpu->m6801_io_w(prg, 0x05, 0xff); -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( mc10_mem, AS_PROGRAM, 8 , mc10_state) - AM_RANGE(0x0100, 0x3fff) AM_NOP /* unused */ - AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank1") /* 4k internal ram */ - AM_RANGE(0x5000, 0x8fff) AM_RAMBANK("bank2") /* 16k memory expansion */ - AM_RANGE(0x9000, 0xbffe) AM_NOP /* unused */ - AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(mc10_bfff_r, mc10_bfff_w) - AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) /* ROM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mc10_io, AS_IO, 8 , mc10_state) - AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READWRITE(mc10_port1_r, mc10_port1_w) - AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READWRITE(mc10_port2_r, mc10_port2_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( alice32_mem, AS_PROGRAM, 8 , mc10_state) - AM_RANGE(0x0100, 0x2fff) AM_NOP /* unused */ - AM_RANGE(0x3000, 0x4fff) AM_RAMBANK("bank1") /* 8k internal ram */ - AM_RANGE(0x5000, 0x8fff) AM_RAMBANK("bank2") /* 16k memory expansion */ - AM_RANGE(0x9000, 0xafff) AM_NOP /* unused */ - AM_RANGE(0xbf20, 0xbf29) AM_DEVREADWRITE("ef9345", ef9345_device, data_r, data_w) - AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(mc10_bfff_r, alice32_bfff_w) - AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) /* ROM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( alice90_mem, AS_PROGRAM, 8 , mc10_state) - AM_RANGE(0x0100, 0x2fff) AM_NOP /* unused */ - AM_RANGE(0x3000, 0xafff) AM_RAMBANK("bank1") /* 32k internal ram */ - AM_RANGE(0xbf20, 0xbf29) AM_DEVREADWRITE("ef9345", ef9345_device, data_r, data_w) - AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(alice90_bfff_r, alice32_bfff_w) - AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) /* ROM */ -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/* MC-10 keyboard - - PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 - PA6: Ctl N/c Brk N/c N/c N/c N/c Shift - PA5: 8 9 : ; , - . / - PA4: 0 1 2 3 4 5 6 7 - PA3: X Y Z N/c N/c N/c Ent Space - PA2: P Q R S T U V W - PA1: H I J K L M N O - PA0: @ A B C D E F G - */ - -/* Port Key description Emulated key Natural key Shift 1 Shift 2 (Ctrl) */ -static INPUT_PORTS_START( mc10 ) - PORT_START("pb0") /* KEY ROW 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ INPUT") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H THEN") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P INKEY$") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X SQN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 ( CLS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb1") /* KEY ROW 1 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A \xE2\x86\x90") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I NEXT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q L.DEL") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y RESTORE") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! RUN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ) PRINT") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb2") /* KEY ROW 2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ABS") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J GOTO") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R RESET") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z \xE2\x86\x93") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \" CONT") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": * END") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb3") /* KEY ROW 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C INT") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K SOUND") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S \xE2\x86\x92") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # CSAVE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; + POKE") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb4") /* KEY ROW 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D GOSUB") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L PEEK") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T READ") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLOAD") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", < TAN") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb5") /* KEY ROW 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E SET") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M COS") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U FOR") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % NEW") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- = STOP") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb6") /* KEY ROW 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F RETURN") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N SIN") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V RND") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 & LIST") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". > LOG") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb7") /* KEY ROW 7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G IF") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O STEP") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W \xE2\x86\x91") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ' CLEAR") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ? SQR") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/* Alice uses an AZERTY keyboard */ -/* Port Key description Emulated key Natural key Shift 1 Shift 2 (Ctrl) */ -static INPUT_PORTS_START( alice ) - PORT_START("pb0") /* KEY ROW 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ INPUT") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H THEN") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P INKEY$") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X SQN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 ( CLS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb1") /* KEY ROW 1 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q L.DEL") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I NEXT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A \xE2\x86\x90") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y RESTORE") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! RUN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ) PRINT") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb2") /* KEY ROW 2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ABS") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J GOTO") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R RESET") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W \xE2\x86\x91") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \" CONT") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": * END") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb3") /* KEY ROW 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C INT") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K SOUND") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S \xE2\x86\x92") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # CSAVE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M COS") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb4") /* KEY ROW 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D GOSUB") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L PEEK") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T READ") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLOAD") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", < TAN") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb5") /* KEY ROW 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E SET") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ? SQR") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U FOR") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % NEW") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- = STOP") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb6") /* KEY ROW 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F RETURN") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N SIN") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V RND") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 & LIST") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". > LOG") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("pb7") /* KEY ROW 7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G IF") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O STEP") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z \xE2\x86\x93") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ' CLEAR") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; + POKE") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static MACHINE_CONFIG_START( mc10, mc10_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6803, XTAL_3_579545MHz) /* 0,894886 MHz */ - MCFG_CPU_PROGRAM_MAP(mc10_mem) - MCFG_CPU_IO_MAP(mc10_io) - - /* video hardware */ - MCFG_SCREEN_MC6847_NTSC_ADD("screen", "mc6847") - - MCFG_DEVICE_ADD("mc6847", MC6847_NTSC, XTAL_3_579545MHz) - MCFG_MC6847_INPUT_CALLBACK(READ8(mc10_state, mc6847_videoram_r)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(coco_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("mc10_cass") - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("20K") - MCFG_RAM_EXTRA_OPTIONS("4K") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list", "mc10") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( alice32, mc10_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6803, XTAL_3_579545MHz) - MCFG_CPU_PROGRAM_MAP(alice32_mem) - MCFG_CPU_IO_MAP(mc10_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DEVICE("ef9345", ef9345_device, screen_update) - MCFG_SCREEN_SIZE(336, 270) - MCFG_SCREEN_VISIBLE_AREA(00, 336-1, 00, 270-1) - MCFG_PALETTE_ADD("palette", 8) - - MCFG_DEVICE_ADD("ef9345", EF9345, 0) - MCFG_EF9345_PALETTE("palette") - MCFG_TIMER_DRIVER_ADD_SCANLINE("alice32_sl", mc10_state, alice32_scanline, "screen", 0, 10) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(alice32_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("mc10_cass") - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("24K") - MCFG_RAM_EXTRA_OPTIONS("8K") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list", "alice32") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("mc10_cass", "mc10") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( alice90, alice32 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(alice90_mem) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - - /* Software lists */ - MCFG_SOFTWARE_LIST_MODIFY("cass_list", "alice90") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("alice32_cass", "alice32") - MCFG_DEVICE_REMOVE("mc10_cass") -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( mc10 ) - ROM_REGION(0x2000, "maincpu", 0) - ROM_LOAD("mc10.rom", 0x0000, 0x2000, CRC(11fda97e) SHA1(4afff2b4c120334481aab7b02c3552bf76f1bc43)) -ROM_END - -ROM_START( alice ) - ROM_REGION(0x2000, "maincpu", 0) - ROM_LOAD("alice.rom", 0x0000, 0x2000, CRC(f876abe9) SHA1(c2166b91e6396a311f486832012aa43e0d2b19f8)) -ROM_END - -ROM_START( alice32 ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_LOAD("alice32.rom", 0x0000, 0x4000, CRC(c3854ddf) SHA1(f34e61c3cf711fb59ff4f1d4c0d2863dab0ab5d1)) - - ROM_REGION( 0x2000, "ef9345", 0 ) - ROM_LOAD( "charset.rom", 0x0000, 0x2000, BAD_DUMP CRC(b2f49eb3) SHA1(d0ef530be33bfc296314e7152302d95fdf9520fc) ) // from dcvg5k -ROM_END - -ROM_START( alice90 ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_LOAD("alice90.rom", 0x0000, 0x4000, CRC(d0a874bb) SHA1(a65c7be2d516bed2584c51c1ef78b045b91faef6)) - - ROM_REGION( 0x2000, "ef9345", 0 ) - ROM_LOAD( "charset.rom", 0x0000, 0x2000, BAD_DUMP CRC(b2f49eb3) SHA1(d0ef530be33bfc296314e7152302d95fdf9520fc) ) // from dcvg5k -ROM_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, mc10, 0, 0, mc10, mc10, mc10_state, mc10, "Tandy Radio Shack", "MC-10", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, alice, mc10, 0, mc10, alice, mc10_state, mc10, "Matra & Hachette", "Alice", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, alice32, 0, 0, alice32, alice, mc10_state, mc10, "Matra & Hachette", "Alice 32", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -COMP( 1985, alice90, alice32, 0, alice90, alice, mc10_state, mc10, "Matra & Hachette", "Alice 90", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/mc1000.c b/src/mess/drivers/mc1000.c deleted file mode 100644 index defef2a94c0..00000000000 --- a/src/mess/drivers/mc1000.c +++ /dev/null @@ -1,502 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - MC 1000 - - 12/05/2009 Skeleton driver. - - http://ensjo.wikispaces.com/MC-1000+on+JEMU - http://ensjo.blogspot.com/2006/11/color-artifacting-no-mc-1000.html - -****************************************************************************/ - -/* - - TODO: - - - xtal frequency? - - Z80 wait at 0x0000-0x1fff when !hsync & !vsync - - 80-column card (MC6845) character generator ROM - - Charlemagne / GEM-1000 / Junior Computer ROMs - -*/ - -#include "includes/mc1000.h" - -/* Memory Banking */ - -void mc1000_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* MC6845 video RAM */ - membank("bank2")->set_entry(m_mc6845_bank); - - /* extended RAM */ - if (m_ram->size() > 16*1024) - { - program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); - } - else - { - program.unmap_readwrite(0x4000, 0x7fff); - } - - /* MC6847 video RAM */ - if (m_mc6847_bank) - { - if (m_ram->size() > 16*1024) - { - program.install_readwrite_bank(0x8000, 0x97ff, "bank4"); - } - else - { - program.unmap_readwrite(0x8000, 0x97ff); - } - } - else - { - program.install_readwrite_bank(0x8000, 0x97ff, "bank4"); - } - - membank("bank4")->set_entry(m_mc6847_bank); - - /* extended RAM */ - if (m_ram->size() > 16*1024) - { - program.install_readwrite_bank(0x9800, 0xbfff, "bank5"); - } - else - { - program.unmap_readwrite(0x9800, 0xbfff); - } -} - -/* Read/Write Handlers */ - -WRITE_LINE_MEMBER( mc1000_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -READ8_MEMBER( mc1000_state::printer_r ) -{ - return m_centronics_busy; -} - -WRITE8_MEMBER( mc1000_state::printer_w ) -{ - m_centronics->write_strobe(BIT(data, 0)); -} - -WRITE8_MEMBER( mc1000_state::mc6845_ctrl_w ) -{ - m_mc6845_bank = BIT(data, 0); - - bankswitch(); -} - -WRITE8_MEMBER( mc1000_state::mc6847_attr_w ) -{ - /* - - bit description - - 0 enable CPU video RAM access - 1 CSS - 2 GM0 - 3 GM1 - 4 GM2 - 5 _INT/EXT - 6 _A/S - 7 _A/G - - */ - - m_mc6847_bank = BIT(data, 0); - m_vdg->css_w(BIT(data, 1)); - m_vdg->gm0_w(BIT(data, 2)); - m_vdg->gm1_w(BIT(data, 3)); - m_vdg->gm2_w(BIT(data, 4)); - m_vdg->intext_w(BIT(data, 5)); - m_vdg->as_w(BIT(data, 6)); - m_vdg->ag_w(BIT(data, 7)); - - bankswitch(); -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( mc1000_mem, AS_PROGRAM, 8, mc1000_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") - AM_RANGE(0x2000, 0x27ff) AM_RAMBANK("bank2") AM_SHARE("mc6845_vram") - AM_RANGE(0x2800, 0x3fff) AM_RAM - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank3") - AM_RANGE(0x8000, 0x97ff) AM_RAMBANK("bank4") AM_SHARE("mc6847_vram") - AM_RANGE(0x9800, 0xbfff) AM_RAMBANK("bank5") - AM_RANGE(0xc000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mc1000_io, AS_IO, 8, mc1000_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x04, 0x04) AM_READWRITE(printer_r, printer_w) - AM_RANGE(0x05, 0x05) AM_DEVWRITE("cent_data_out", output_latch_device, write) -// AM_RANGE(0x10, 0x10) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) -// AM_RANGE(0x11, 0x11) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r, register_w) - AM_RANGE(0x12, 0x12) AM_WRITE(mc6845_ctrl_w) - AM_RANGE(0x20, 0x20) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w) - AM_RANGE(0x40, 0x40) AM_DEVREAD(AY8910_TAG, ay8910_device, data_r) - AM_RANGE(0x60, 0x60) AM_DEVWRITE(AY8910_TAG, ay8910_device, data_w) - AM_RANGE(0x80, 0x80) AM_WRITE(mc6847_attr_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( mc1000 ) - PORT_START("JOYA") /* Player 1 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) /* = 'I' */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) /* = 'Q' */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) /* = 'Y' */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) /* = '1' */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* = '9' */ - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("JOYB") /* Player 2 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* = '@' */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) /* = 'H' */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) /* = 'P' */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) /* = 'X' */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) /* = '0' */ - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUBOUT") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("MODIFIERS") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - - PORT_START("JOYAKEYMAP") - PORT_CONFNAME( 0x01, 0x00, "JOYSTICK A (P1) keyboard mapping" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - - PORT_START("JOYBKEYMAP") - PORT_CONFNAME( 0x01, 0x00, "JOYSTICK B (P2) keyboard mapping" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) -INPUT_PORTS_END - -/* Video */ - -WRITE_LINE_MEMBER( mc1000_state::fs_w ) -{ - m_vsync = state; -} - -WRITE_LINE_MEMBER( mc1000_state::hs_w ) -{ - m_hsync = state; -} - -READ8_MEMBER( mc1000_state::videoram_r ) -{ - if (offset == ~0) return 0xff; - - m_vdg->inv_w(BIT(m_mc6847_video_ram[offset], 7)); - - return m_mc6847_video_ram[offset]; -} - -/* AY-3-8910 Interface */ - -WRITE8_MEMBER( mc1000_state::keylatch_w ) -{ - m_keylatch = data; - - m_cassette->output(BIT(data, 7) ? -1.0 : +1.0); -} - -READ8_MEMBER( mc1000_state::keydata_r ) -{ - UINT8 data = 0xff; - - if (!BIT(m_keylatch, 0)) - { - data &= m_y0->read(); - if (m_joybkeymap->read()) data &= m_joyb->read(); - } - if (!BIT(m_keylatch, 1)) - { - data &= m_y1->read(); - if (m_joyakeymap->read()) data &= m_joya->read(); - } - if (!BIT(m_keylatch, 2)) data &= m_y2->read(); - if (!BIT(m_keylatch, 3)) data &= m_y3->read(); - if (!BIT(m_keylatch, 4)) data &= m_y4->read(); - if (!BIT(m_keylatch, 5)) data &= m_y5->read(); - if (!BIT(m_keylatch, 6)) data &= m_y6->read(); - if (!BIT(m_keylatch, 7)) data &= m_y7->read(); - - data = (m_modifiers->read() & 0xc0) | (data & 0x3f); - - if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) - { - if (m_cassette->input() >= +0.0) data &= 0x7f; - } - - return data; -} - -/* Machine Initialization */ - -void mc1000_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* setup memory banking */ - UINT8 *rom = m_rom->base(); - - program.install_readwrite_bank(0x0000, 0x1fff, "bank1"); - membank("bank1")->configure_entry(0, rom); - membank("bank1")->configure_entry(1, rom + 0xc000); - membank("bank1")->set_entry(1); - - m_rom0000 = 1; - - program.install_readwrite_bank(0x2000, 0x27ff, "bank2"); - membank("bank2")->configure_entry(0, rom + 0x2000); - membank("bank2")->configure_entry(1, m_mc6845_video_ram); - membank("bank2")->set_entry(0); - - membank("bank3")->configure_entry(0, rom + 0x4000); - membank("bank3")->set_entry(0); - - membank("bank4")->configure_entry(0, m_mc6847_video_ram); - membank("bank4")->configure_entry(1, rom + 0x8000); - membank("bank4")->set_entry(0); - - membank("bank5")->configure_entry(0, rom + 0x9800); - membank("bank5")->set_entry(0); - - bankswitch(); - - /* register for state saving */ - save_item(NAME(m_rom0000)); - save_item(NAME(m_mc6845_bank)); - save_item(NAME(m_mc6847_bank)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_hsync)); - save_item(NAME(m_vsync)); -} - -void mc1000_state::machine_reset() -{ - membank("bank1")->set_entry(1); - - m_rom0000 = 1; -} - -/* Machine Driver */ - -/* - - Interrupt generator: - NE555 chip in astable circuit. - - +---------*---*---o V+ - | | | - +-+ | | - | |390K | | - | |R17 |8 |4 - +-+ +-------+ - | 7| |3 - *-------| |-------> /INT (Z80) - | | | - | | | - +-+R16 2| IC 28 | - | |1K +--| | - | | | | 555 | - +-+ | | | - | | 6| |5 - *----*--| |---+ - | | | | - ---C30 +-------+ ---C29 - ---10n |1 ---10n - _|_ _|_ _|_ - /// /// /// - - Calculated properties: - - * 99.74489795918367 Duty Cycle Percentage - * 367.3469387755102 Frequency in Hertz - * 0.00000693 Seconds Low - * 0.00270963 Seconds High - - */ - -#define MC1000_NE555_FREQ (367) /* Hz */ -#define MC1000_NE555_DUTY_CYCLE (99.745) /* % */ - -TIMER_DEVICE_CALLBACK_MEMBER(mc1000_state::ne555_tick) -{ - // (m_ne555_int not needed anymore and can be done with?) - m_ne555_int = param; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, param); -} - -static MACHINE_CONFIG_START( mc1000, mc1000_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 3579545) - MCFG_CPU_PROGRAM_MAP(mc1000_mem) - MCFG_CPU_IO_MAP(mc1000_io) - - /* timers */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("ne555clear", mc1000_state, ne555_tick, attotime::from_hz(MC1000_NE555_FREQ)) - MCFG_TIMER_PARAM(CLEAR_LINE) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ne555assert", mc1000_state, ne555_tick, attotime::from_hz(MC1000_NE555_FREQ)) - MCFG_TIMER_START_DELAY(attotime::from_hz(MC1000_NE555_FREQ * 100 / MC1000_NE555_DUTY_CYCLE)) - MCFG_TIMER_PARAM(ASSERT_LINE) - - /* video hardware */ - MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, MC6847_TAG) - - MCFG_DEVICE_ADD(MC6847_TAG, MC6847_NTSC, XTAL_3_579545MHz) - MCFG_MC6847_HSYNC_CALLBACK(WRITELINE(mc1000_state, hs_w)) - MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(mc1000_state, fs_w)) - MCFG_MC6847_INPUT_CALLBACK(READ8(mc1000_state, videoram_r)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(AY8910_TAG, AY8910, 3579545/2) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_RES_LOADS(RES_K(2.2), 0, 0) - MCFG_AY8910_PORT_B_READ_CB(READ8(mc1000_state, keydata_r)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(mc1000_state, keylatch_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_SOFTWARE_LIST_ADD("cass_list", "mc1000_cass") - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(mc1000_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("48K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( mc1000 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "mc1000.ic17", 0xc000, 0x2000, CRC(8e78d80d) SHA1(9480270e67a5db2e7de8bc5c8b9e0bb210d4142b) ) - ROM_LOAD( "mc1000.ic12", 0xe000, 0x2000, CRC(750c95f0) SHA1(fd766f5ea4481ef7fd4df92cf7d8397cc2b5a6c4) ) -ROM_END - - -/* Driver Initialization */ - -DIRECT_UPDATE_MEMBER(mc1000_state::mc1000_direct_update_handler) -{ - if (m_rom0000) - { - if (address >= 0xc000) - { - membank("bank1")->set_entry(0); - m_rom0000 = 0; - } - } - - return address; -} - -DRIVER_INIT_MEMBER(mc1000_state,mc1000) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mc1000_state::mc1000_direct_update_handler), this)); -} - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, mc1000, 0, 0, mc1000, mc1000, mc1000_state, mc1000, "CCE", "MC-1000", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/mc1502.c b/src/mess/drivers/mc1502.c deleted file mode 100644 index 12134cbc3ab..00000000000 --- a/src/mess/drivers/mc1502.c +++ /dev/null @@ -1,410 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - drivers/mc1502.c - - Driver file for Electronika MC 1502 - -***************************************************************************/ - -#include "emu.h" -#include "includes/mc1502.h" -#include "bus/rs232/rs232.h" - -#include "cpu/i86/i86.h" -#include "machine/kb_7007_3.h" -#include "sound/speaker.h" -#include "sound/wave.h" - -#define VERBOSE_DBG 0 - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - -/* - * onboard devices: - */ - -// Timer - -/* check if any keys are pressed, raise IRQ1 if so */ - -TIMER_CALLBACK_MEMBER(mc1502_state::keyb_signal_callback) -{ - UINT8 key = 0; - - key |= ioport("Y1")->read(); - key |= ioport("Y2")->read(); - key |= ioport("Y3")->read(); - key |= ioport("Y4")->read(); - key |= ioport("Y5")->read(); - key |= ioport("Y6")->read(); - key |= ioport("Y7")->read(); - key |= ioport("Y8")->read(); - key |= ioport("Y9")->read(); - key |= ioport("Y10")->read(); - key |= ioport("Y11")->read(); - key |= ioport("Y12")->read(); -// DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, m_kbd.pulsing, -// (key || m_kbd.pulsing) ? " will IRQ" : "")); - - /* - If a key is pressed and we're not pulsing yet, start pulsing the IRQ1; - keep pulsing while any key is pressed, and pulse one time after all keys - are released. - */ - if (key) { - if (m_kbd.pulsing < 2) { - m_kbd.pulsing += 2; - } - } - - if (m_kbd.pulsing) { - m_pic8259->ir1_w(m_kbd.pulsing & 1); - m_kbd.pulsing--; - } -} - -WRITE8_MEMBER(mc1502_state::mc1502_ppi_portb_w) -{ -// DBG_LOG(2,"mc1502_ppi_portb_w",("( %02X )\n", data)); - m_ppi_portb = data; - m_pit8253->write_gate2(BIT(data, 0)); - mc1502_speaker_set_spkrdata(BIT(data, 1)); - m_centronics->write_strobe(BIT(data, 2)); - m_centronics->write_autofd(BIT(data, 3)); - m_centronics->write_init(BIT(data, 4)); -} - -// bit 0: parallel port data transfer direction (default = 0 = out) -// bits 1-2: CGA_FONT (default = 01) -// bit 3: i8251 SYNDET pin triggers NMI (default = 1 = no) -WRITE8_MEMBER(mc1502_state::mc1502_ppi_portc_w) -{ -// DBG_LOG(2,"mc1502_ppi_portc_w",("( %02X )\n", data)); - m_ppi_portc = data & 15; -} - -// 0x80 -- serial RxD -// 0x40 -- CASS IN, also loops back T2OUT (gated by CASWR) -// 0x20 -- T2OUT -// 0x10 -- SNDOUT -READ8_MEMBER(mc1502_state::mc1502_ppi_portc_r) -{ - int data = 0xff; - double tap_val = m_cassette->input(); - - data = ( data & ~0x40 ) | ( tap_val < 0 ? 0x40 : 0x00 ) | ( (BIT(m_ppi_portb, 7) && m_pit_out2) ? 0x40 : 0x00 ); - data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); - data = ( data & ~0x10 ) | ( (BIT(m_ppi_portb, 1) && m_pit_out2) ? 0x10 : 0x00 ); - -// DBG_LOG(2,"mc1502_ppi_portc_r",("= %02X (tap_val %f t2out %d) at %s\n", -// data, tap_val, m_pit_out2, machine().describe_context())); - return data; -} - -READ8_MEMBER(mc1502_state::mc1502_kppi_porta_r) -{ - UINT8 key = 0; - - if (m_kbd.mask & 0x0001) { key |= ioport("Y1")->read(); } - if (m_kbd.mask & 0x0002) { key |= ioport("Y2")->read(); } - if (m_kbd.mask & 0x0004) { key |= ioport("Y3")->read(); } - if (m_kbd.mask & 0x0008) { key |= ioport("Y4")->read(); } - if (m_kbd.mask & 0x0010) { key |= ioport("Y5")->read(); } - if (m_kbd.mask & 0x0020) { key |= ioport("Y6")->read(); } - if (m_kbd.mask & 0x0040) { key |= ioport("Y7")->read(); } - if (m_kbd.mask & 0x0080) { key |= ioport("Y8")->read(); } - if (m_kbd.mask & 0x0100) { key |= ioport("Y9")->read(); } - if (m_kbd.mask & 0x0200) { key |= ioport("Y10")->read(); } - if (m_kbd.mask & 0x0400) { key |= ioport("Y11")->read(); } - if (m_kbd.mask & 0x0800) { key |= ioport("Y12")->read(); } - key ^= 0xff; -// DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key)); - return key; -} - -WRITE8_MEMBER(mc1502_state::mc1502_kppi_portb_w) -{ - m_kbd.mask &= ~255; - m_kbd.mask |= data ^ 255; - if (!BIT(data, 0)) - m_kbd.mask |= 1 << 11; - else - m_kbd.mask &= ~(1 << 11); -// DBG_LOG(2,"mc1502_kppi_portb_w",("( %02X -> %04X )\n", data, m_kbd.mask)); -} - -WRITE8_MEMBER(mc1502_state::mc1502_kppi_portc_w) -{ - m_kbd.mask &= ~(7 << 8); - m_kbd.mask |= ((data ^ 7) & 7) << 8; -// DBG_LOG(2,"mc1502_kppi_portc_w",("( %02X -> %04X )\n", data, m_kbd.mask)); -} - -WRITE_LINE_MEMBER(mc1502_state::mc1502_i8251_syndet) -{ - if (!BIT(m_ppi_portc,3)) - m_maincpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER(mc1502_state::mc1502_pit8253_out1_changed) -{ - m_upd8251->write_txc(state); - m_upd8251->write_rxc(state); -} - -WRITE_LINE_MEMBER(mc1502_state::mc1502_pit8253_out2_changed) -{ - m_pit_out2 = state; - m_speaker->level_w(m_spkrdata & m_pit_out2); - m_cassette->output(state ? 1 : -1); -} - -WRITE_LINE_MEMBER(mc1502_state::mc1502_speaker_set_spkrdata) -{ - m_spkrdata = state ? 1 : 0; - m_speaker->level_w(m_spkrdata & m_pit_out2); -} - -DRIVER_INIT_MEMBER( mc1502_state, mc1502 ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - DBG_LOG(0,"init",("driver_init()\n")); - - program.unmap_readwrite(0, 0x7ffff); - program.install_readwrite_bank(0, m_ram->size()-1, "bank10"); - membank( "bank10" )->set_base( m_ram->pointer() ); -} - -MACHINE_START_MEMBER( mc1502_state, mc1502 ) -{ - DBG_LOG(0,"init",("machine_start()\n")); - - /* - Keyboard polling circuit holds IRQ1 high until a key is - pressed, then it starts a timer that pulses IRQ1 low each - 40ms (check) for 20ms (check) until all keys are released. - Last pulse causes BIOS to write a 'break' scancode into port 60h. - */ - m_pic8259->ir1_w(1); - memset(&m_kbd, 0, sizeof(m_kbd)); - m_kbd.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc1502_state::keyb_signal_callback),this)); - m_kbd.keyb_signal_timer->adjust( attotime::from_msec(20), 0, attotime::from_msec(20) ); -} - -MACHINE_RESET_MEMBER( mc1502_state, mc1502 ) -{ - DBG_LOG(0,"init",("machine_reset()\n")); - - m_spkrdata = 0; - m_pit_out2 = 1; - m_ppi_portb = 0; - m_ppi_portc = 0; - m_speaker->level_w(0); -} - -/* - * macros - */ - -static ADDRESS_MAP_START( mc1502_map, AS_PROGRAM, 8, mc1502_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x97fff) AM_RAM /* 96K on mainboard + 512K on extension card */ - AM_RANGE(0xc0000, 0xfbfff) AM_NOP - AM_RANGE(0xfc000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pk88_map, AS_PROGRAM, 8, mc1502_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x1ffff) AM_RAMBANK("bank10") /* 96K on mainboard */ - AM_RANGE(0xf0000, 0xf7fff) AM_ROM /* BASIC */ - AM_RANGE(0xfc000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mc1502_io, AS_IO, 8, mc1502_state ) - AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) - AM_RANGE(0x0028, 0x0028) AM_DEVREADWRITE("upd8251", i8251_device, data_r, data_w) - AM_RANGE(0x0029, 0x0029) AM_DEVREADWRITE("upd8251", i8251_device, status_r, control_w) - AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255n1", i8255_device, read, write) - AM_RANGE(0x0068, 0x006B) AM_DEVREADWRITE("ppi8255n2", i8255_device, read, write) // keyboard poll -ADDRESS_MAP_END - -static INPUT_PORTS_START( mc1502 ) - PORT_INCLUDE( mc7007_3_keyboard ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( mc1502, mc1502_state ) - MCFG_CPU_ADD("maincpu", I8088, XTAL_16MHz/3) - MCFG_CPU_PROGRAM_MAP(mc1502_map) - MCFG_CPU_IO_MAP(mc1502_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - MCFG_MACHINE_START_OVERRIDE( mc1502_state, mc1502 ) - MCFG_MACHINE_RESET_OVERRIDE( mc1502_state, mc1502 ) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_16MHz/12) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_16MHz/12) /* serial port */ - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(mc1502_state, mc1502_pit8253_out1_changed)) - MCFG_PIT8253_CLK2(XTAL_16MHz/12) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mc1502_state, mc1502_pit8253_out2_changed)) - - MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), VCC, NULL ) - - MCFG_DEVICE_ADD("ppi8255n1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mc1502_state, mc1502_ppi_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(mc1502_state, mc1502_ppi_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mc1502_state, mc1502_ppi_portc_w)) - - MCFG_DEVICE_ADD("ppi8255n2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mc1502_state, mc1502_kppi_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mc1502_state, mc1502_kppi_portb_w)) - MCFG_I8255_IN_PORTC_CB(DEVREAD8("cent_status_in", input_buffer_device, read)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mc1502_state, mc1502_kppi_portc_w)) - - MCFG_DEVICE_ADD( "upd8251", I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("irps", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE("irps", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE("irps", rs232_port_device, write_rts)) - /* XXX RxD data are accessible via PPI port C, bit 7 */ - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) /* default handler does nothing */ - MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) - MCFG_I8251_SYNDET_HANDLER(WRITELINE(mc1502_state, mc1502_i8251_syndet)) - - MCFG_RS232_PORT_ADD("irps", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd8251", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("upd8251", i8251_device, write_dsr)) - - MCFG_DEVICE_ADD("isa", ISA8, 0) - MCFG_ISA8_CPU(":maincpu") - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("pic8259", pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("pic8259", pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) - - MCFG_ISA8_SLOT_ADD("isa", "board0", mc1502_isa8_cards, "cga_mc1502", true) - MCFG_ISA8_SLOT_ADD("isa", "isa1", mc1502_isa8_cards, "fdc", false) - MCFG_ISA8_SLOT_ADD("isa", "isa2", mc1502_isa8_cards, "rom", false) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit6)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) - MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) - MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) - - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_SOFTWARE_LIST_ADD("flop_list","mc1502_flop") -// MCFG_SOFTWARE_LIST_ADD("cass_list","mc1502_cass") - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("608K") /* 96 base + 512 on expansion card */ - MCFG_RAM_EXTRA_OPTIONS("96K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pk88, mc1502 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pk88_map) -MACHINE_CONFIG_END - - -/* - Apparently there was a hardware revision with built-in floppy - controller mapped to alternate set of ports; v531 and v533 - support this revision. v533 is possibly not an original BIOS, it - supports autoboot which none of others do. v521h is a version - with support for 3rd party hard disk controller (not emulated). - v51 is designed for a different keyboard layout (JCUKEN, not - QWERTY). -*/ -ROM_START( mc1502 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - - ROM_DEFAULT_BIOS("v52") - ROM_SYSTEM_BIOS(0, "v50", "v5.0 10/05/89") - ROMX_LOAD( "monitor_5_0.rom", 0xfc000, 0x4000, CRC(9e97c6a0) SHA1(16a304e8de69ec4d8b92acda6bf28454c361a24f),ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v52", "v5.2 22/03/91") - ROMX_LOAD( "monitor_5_2.rom", 0xfc000, 0x4000, CRC(0e65491e) SHA1(8a4d556473b5e0e59b05fab77c79c29f4d562412),ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v521", "v5.21 12/10/92") - ROMX_LOAD( "monitor_5_21.rom", 0xfc000, 0x4000, CRC(28c8f653) SHA1(04b0b09e0b86d9648a83352cc1590eb8963833e0),ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v531", "v5.31 12/10/92") - ROMX_LOAD( "monitor_5_31.rom", 0xfc000, 0x4000, CRC(a48295d5) SHA1(6f38977c22f9cc6c2bc6f6e53edc4048ca6b6721),ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v533", "v5.33 01/08/93") - ROMX_LOAD( "0_(cbc0).bin", 0xfc000, 0x2000, CRC(9a55bc4f) SHA1(81da44eec2e52cf04b1fc7053502270f51270590),ROM_BIOS(5)) - ROMX_LOAD( "1_(dfe2).bin", 0xfe000, 0x2000, CRC(8dec077a) SHA1(d6f6d7cc2183abc77fbd9cd59132de5766f7c458),ROM_BIOS(5)) - - // 5.21 + 3rd party HDC support. fails checksum test so marked BAD_DUMP. - ROM_SYSTEM_BIOS(5, "v521h", "v5.21h 22/09/93") - ROMX_LOAD( "mshbios0.pgm", 0xfc000, 0x2000, BAD_DUMP CRC(be447261) SHA1(b93c597c17dfa4b678f72c20a3f7119b73e6ba1c),ROM_BIOS(6)) - ROMX_LOAD( "mshbios1.pgm", 0xfe000, 0x2000, BAD_DUMP CRC(89e2eaf2) SHA1(37d6b225b5e35574fdac81219589407d925225be),ROM_BIOS(6)) - - // 5.3 - ROM_SYSTEM_BIOS(6, "v53", "v5.3 10/11/91") - ROMX_LOAD( "1502~3b0.pgm", 0xfc000, 0x2000, CRC(dc148763) SHA1(7a5e66438007b2de328ac680614f9c4ff60f6a75),ROM_BIOS(7)) - ROMX_LOAD( "1502~3b1.pgm", 0xfe000, 0x2000, CRC(17fc2af2) SHA1(a060d7b7302dfa639025f025106b50412cf26953),ROM_BIOS(7)) - // 5.1 -- JCUKEN keyboard - ROM_SYSTEM_BIOS(7, "v51", "v5.1 10/12/90") - ROMX_LOAD( "ms1502b0.pgm", 0xfc000, 0x2000, CRC(92fcc29a) SHA1(930a4cffcd6ec6110dd9a18bd389b78f0ccb110a),ROM_BIOS(8)) - ROMX_LOAD( "ms1502b1.pgm", 0xfe000, 0x2000, CRC(fe355a58) SHA1(b4ef7775045c6f2095e2b487fe19824986a4892c),ROM_BIOS(8)) - // 5.31 - ROM_SYSTEM_BIOS(8, "v531_92", "v5.31 12/10/92") - ROMX_LOAD( "ms531b0.pgm", 0xfc000, 0x2000, CRC(d97157d1) SHA1(cb1a1e0e2d9a0fcc78f9b09bfb4814d408ee4fae),ROM_BIOS(9)) - ROMX_LOAD( "ms531b1.pgm", 0xfe000, 0x2000, CRC(b1368e1a) SHA1(286496d25dc0ac2d8fe1802caffc6c37b236d105),ROM_BIOS(9)) - // 5.2 - ROM_SYSTEM_BIOS(9, "v52_91", "v5.2 10/11/91") - ROMX_LOAD( "msv5~2b0.pgm", 0xfc000, 0x2000, CRC(f7f370e9) SHA1(e069a35005581a02856853b57dd511ab8e10054b),ROM_BIOS(10)) - ROMX_LOAD( "msv5~2b1.pgm", 0xfe000, 0x2000, CRC(d50e1c43) SHA1(22724dec0052ee9e52f44f5914f2f5f3fae14612),ROM_BIOS(10)) - - ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) - ROM_LOAD( "symgen.rom", 0x0000, 0x2000, CRC(b2747a52) SHA1(6766d275467672436e91ac2997ac6b77700eba1e)) -ROM_END - -/* - Predecessor of MC1502, same keyboard attachment but - different video subsystem (not emulated). -*/ -ROM_START( pk88 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - - ROM_LOAD( "b0.064", 0xf0000, 0x2000, CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9)) - ROM_LOAD( "b1.064", 0xf2000, 0x2000, CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731)) - ROM_LOAD( "b2.064", 0xf4000, 0x2000, CRC(1ee66152) SHA1(7ed8c4c6c582487e802beabeca5b86702e5083e8)) - ROM_LOAD( "b3.064", 0xf6000, 0x2000, CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7)) - ROM_LOAD( "pk88-0.064", 0xfc000, 0x2000, CRC(1e4666cf) SHA1(6364c5241f2792909ff318194161eb2c29737546)) - ROM_LOAD( "pk88-1.064", 0xfe000, 0x2000, CRC(6fa7e7ef) SHA1(d68bc273baa46ba733ac6ad4df7569dd70cf60dd)) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1989, mc1502, ibm5150, 0, mc1502, mc1502, mc1502_state, mc1502, "NPO Microprocessor", "Elektronika MC-1502", 0) -COMP ( 1988, pk88, ibm5150, 0, pk88, mc1502, mc1502_state, mc1502, "NPO Microprocessor", "Elektronika PK-88", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mc80.c b/src/mess/drivers/mc80.c deleted file mode 100644 index ee2ae44bfee..00000000000 --- a/src/mess/drivers/mc80.c +++ /dev/null @@ -1,304 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - MC-80.xx driver by Miodrag Milanovic - - 15/05/2009 Initial implementation - 12/05/2009 Skeleton driver. - 01/09/2011 Modernised, added a keyboard to mc8020 - -Real workings of mc8020 keyboard need to be understood and implemented. - -mc8030: very little info available. The area from FFD8-FFFF is meant for -interrupt vectors and so on, but most of it is zeroes. Appears the keyboard -is an ascii keyboard with built-in beeper. It communicates via the SIO, -which needs a rewrite to become useful. The asp ctc needs at least 2 -triggers. The purpose of the zve pio is unknown. The system uses interrupts -for various things, but none of that is working. - -****************************************************************************/ - -#include "includes/mc80.h" - -static ADDRESS_MAP_START(mc8020_mem, AS_PROGRAM, 8, mc80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0bff) AM_ROM - AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_SHARE("videoram")// 1KB RAM ZRE - AM_RANGE(0x2000, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mc8020_io, AS_IO, 8, mc80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mc8030_mem, AS_PROGRAM, 8, mc80_state) - ADDRESS_MAP_UNMAP_HIGH - // ZRE 4 * 2KB - AM_RANGE(0x0000, 0x1fff) AM_ROM // ZRE ROM's 4 * 2716 - AM_RANGE(0x2000, 0x27ff) AM_ROM // SPE ROM's 2 * 2708 - AM_RANGE(0x2800, 0x3fff) AM_ROM // For extension - AM_RANGE(0x4000, 0xbfff) AM_RAM // SPE RAM - AM_RANGE(0xc000, 0xffff) AM_RAM // ZRE RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mc8030_io, AS_IO, 8, mc80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x30, 0x3f) AM_MIRROR(0xff00) AM_NOP //"mass storage" - AM_RANGE(0x80, 0x83) AM_MIRROR(0xff00) AM_DEVREADWRITE("zve_ctc", z80ctc_device, read, write) // user CTC - AM_RANGE(0x84, 0x87) AM_MIRROR(0xff00) AM_DEVREADWRITE("zve_pio", z80pio_device, read, write) // PIO unknown usage - AM_RANGE(0x88, 0x8f) AM_MIRROR(0xff00) AM_WRITE(mc8030_zve_write_protect_w) - AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_WRITE(mc8030_vis_w) AM_MASK(0xffff) - AM_RANGE(0xd0, 0xd3) AM_MIRROR(0xff00) AM_DEVREADWRITE("asp_sio", z80sio0_device, cd_ba_r, cd_ba_w) // keyboard & IFSS? - AM_RANGE(0xd4, 0xd7) AM_MIRROR(0xff00) AM_DEVREADWRITE("asp_ctc", z80ctc_device, read, write) // sio bauds, KMBG? and kbd - AM_RANGE(0xd8, 0xdb) AM_MIRROR(0xff00) AM_DEVREADWRITE("asp_pio", z80pio_device, read, write) // external bus - AM_RANGE(0xe0, 0xef) AM_MIRROR(0xff00) AM_WRITE(mc8030_eprom_prog_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mc8020 ) - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('#') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('&') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('(') - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR('\"') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('^') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('/') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("X4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("X5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("X6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('?') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_START("X7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) -INPUT_PORTS_END - -static INPUT_PORTS_START( mc8030 ) -INPUT_PORTS_END - - -TIMER_DEVICE_CALLBACK_MEMBER(mc80_state::mc8020_kbd) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - char kbdrow[6]; - UINT8 i; - for (i = 1; i < 8; i++) - { - sprintf(kbdrow,"X%X", i); - mem.write_word(0xd20+i, ioport(kbdrow)->read()); - } -} - -// this is a guess there is no information available -static const z80_daisy_config mc8030_daisy_chain[] = -{ - { "asp_ctc" }, /* System ctc */ - { "asp_pio" }, /* System pio */ - { "asp_sio" }, /* sio */ - { "zve_pio" }, /* User pio */ - { "zve_ctc" }, /* User ctc */ - { NULL } -}; - -static MACHINE_CONFIG_START( mc8020, mc80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) - MCFG_CPU_PROGRAM_MAP(mc8020_mem) - MCFG_CPU_IO_MAP(mc8020_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(mc80_state,mc8020_irq_callback) - - MCFG_MACHINE_RESET_OVERRIDE(mc80_state,mc8020) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(32*6, 16*8) - MCFG_SCREEN_VISIBLE_AREA(0, 32*6-1, 0, 16*8-1) - MCFG_VIDEO_START_OVERRIDE(mc80_state,mc8020) - MCFG_SCREEN_UPDATE_DRIVER(mc80_state, screen_update_mc8020) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* devices */ - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_2_4576MHz) - MCFG_Z80PIO_IN_PA_CB(READ8(mc80_state, mc80_port_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(mc80_state, mc80_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(mc80_state, mc80_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(mc80_state, mc80_port_b_w)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_2_4576MHz / 100) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(mc80_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(mc80_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(mc80_state, ctc_z2_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("mc8020_kbd", mc80_state, mc8020_kbd, attotime::from_hz(50)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( mc8030, mc80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) - MCFG_CPU_PROGRAM_MAP(mc8030_mem) - MCFG_CPU_IO_MAP(mc8030_io) - MCFG_CPU_CONFIG(mc8030_daisy_chain) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(mc80_state,mc8030_irq_callback) - - MCFG_MACHINE_RESET_OVERRIDE(mc80_state,mc8030) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_VIDEO_START_OVERRIDE(mc80_state,mc8030) - MCFG_SCREEN_UPDATE_DRIVER(mc80_state, screen_update_mc8030) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* Devices */ - MCFG_DEVICE_ADD("zve_pio", Z80PIO, XTAL_2_4576MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(mc80_state, zve_port_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(mc80_state, zve_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(mc80_state, zve_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(mc80_state, zve_port_b_w)) - - MCFG_DEVICE_ADD("zve_ctc", Z80CTC, XTAL_2_4576MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - // ZC0, ZC1, ZC2 for user - - MCFG_DEVICE_ADD("asp_pio", Z80PIO, XTAL_2_4576MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(mc80_state, asp_port_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(mc80_state, asp_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(mc80_state, asp_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(mc80_state, asp_port_b_w)) - - MCFG_DEVICE_ADD("asp_ctc", Z80CTC, XTAL_2_4576MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - // ZC0: to SIO CLK CH A - // ZC1: to SIO CLK CH B - // ZC2: KMBG (??) - - MCFG_Z80SIO0_ADD("asp_sio", 4800, 0, 0, 0, 0 ) - // SIO CH A in = keyboard; out = beeper; CH B = IFSS (??) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mc8020 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "ver1", "Version 1") - ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(1)) - ROMX_LOAD( "s02.rom", 0x0400, 0x0400, CRC(93b5811c) SHA1(8559d24072c9b5908a2627ff986d818308f51d59), ROM_BIOS(1)) - ROMX_LOAD( "s03.rom", 0x0800, 0x0400, CRC(3d32c334) SHA1(56d3012595540d03054ad3c6795ed5d929581a04), ROM_BIOS(1)) - ROMX_LOAD( "mo01_v2.rom", 0x2000, 0x0400, CRC(7e47201c) SHA1(db49afdc5c1fe4065a979c56cbdbd3c58f5d942f), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS(1, "ver2", "Version 2") - ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(2)) - ROMX_LOAD( "s02_v2.rom", 0x0400, 0x0400, CRC(dd26c90a) SHA1(1108c11362fa63d21110a3b17868c1854a318c09), ROM_BIOS(2)) - ROMX_LOAD( "s03_v2.rom", 0x0800, 0x0400, CRC(5b64ee7b) SHA1(3b4cbfcb8e2dedcfd4a3680c81fe6ceb2211b275), ROM_BIOS(2)) - ROMX_LOAD( "mo01.rom", 0x2000, 0x0400, CRC(c65a470f) SHA1(71325fed1a342149b5efc2234ecfc8adfff0a42d), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS(2, "ver3", "Version 3") - ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(3)) - ROMX_LOAD( "s02_v3.rom", 0x0400, 0x0400, CRC(40c7a694) SHA1(bcdf382e8dad9bb6e06d23ec018e9df55c8d8d0c), ROM_BIOS(3)) - ROMX_LOAD( "s03.rom", 0x0800, 0x0400, CRC(3d32c334) SHA1(56d3012595540d03054ad3c6795ed5d929581a04), ROM_BIOS(3)) - ROMX_LOAD( "mo01_v2.rom",0x2000, 0x0400, CRC(7e47201c) SHA1(db49afdc5c1fe4065a979c56cbdbd3c58f5d942f), ROM_BIOS(3)) - - // m02 doesn't exist on board - ROM_LOAD( "mo03.rom", 0x2800, 0x0400, CRC(29685056) SHA1(39e77658fb7af5a28112341f0893e007d73c1b7a)) - ROM_LOAD( "mo04.rom", 0x2c00, 0x0400, CRC(fd315b73) SHA1(cfb943ec8c884a9b92562d05f92faf06fe42ad68)) - ROM_LOAD( "mo05.rom", 0x3000, 0x0400, CRC(453d6370) SHA1(d96f0849a2da958d7e92a31667178ad140719477)) - ROM_LOAD( "mo06.rom", 0x3400, 0x0400, CRC(6357aba5) SHA1(a4867766f6e14e9fe66f22a6839f17c01058c8af)) - ROM_LOAD( "mo07.rom", 0x3800, 0x0400, CRC(a1eb6021) SHA1(b05b63f02de89f065f337bbe54c5b48244e3a4ba)) - ROM_LOAD( "mo08.rom", 0x3c00, 0x0400, CRC(8221cc32) SHA1(65e0ee4241d39d138205c88374b3bcd127e21511)) - ROM_LOAD( "mo09.rom", 0x4000, 0x0400, CRC(7ad5944d) SHA1(ef2781b114277a09ce0cf2e7decfdb7c48a693e3)) - ROM_LOAD( "mo10.rom", 0x4400, 0x0400, CRC(11de8c76) SHA1(b384d22506ff7e3e28bd2dcc33b7a69617eeb52a)) - ROM_LOAD( "mo11.rom", 0x4800, 0x0400, CRC(370cc672) SHA1(133f6e8bfd4e1ca2e9e0a8e2342084419f895e3c)) - ROM_LOAD( "mo12.rom", 0x4c00, 0x0400, CRC(a3838f2b) SHA1(e3602943700bf5068117946bf86f052f5c587169)) - ROM_LOAD( "mo13.rom", 0x5000, 0x0400, CRC(88b61d12) SHA1(00dd4452b4d4191e589ab58ba924ed21b10f323b)) - ROM_LOAD( "mo14.rom", 0x5400, 0x0400, CRC(2168da19) SHA1(c1ce1263167067d8be0a90604d9c29b7379a0545)) - ROM_LOAD( "mo15.rom", 0x5800, 0x0400, CRC(e32f54c4) SHA1(c3d9ca2204e7adbc625cf96031acb8c1df0447c7)) - ROM_LOAD( "mo16.rom", 0x5c00, 0x0400, CRC(403be935) SHA1(4e74355a78ab090ce180437156fed8e4a1d1c787)) -ROM_END - -ROM_START( mc8030 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "zve_1.rom", 0x0000, 0x0800, CRC(31ec0159) SHA1(a97ea9eb733c462e77d625a7942134e45d911c0a)) - ROM_LOAD( "zve_2.rom", 0x0800, 0x0800, CRC(5104983d) SHA1(7516274904042f4fc6813aa8b2a75c0a64f9b937)) - ROM_LOAD( "zve_3.rom", 0x1000, 0x0800, CRC(4bcfd727) SHA1(d296e587098e70270ad60db8edaa685af368b849)) - ROM_LOAD( "zve_4.rom", 0x1800, 0x0800, CRC(f949ae43) SHA1(68c324cf5578497db7ae65da5695fcb30493f612)) - ROM_LOAD( "spe_1.rom", 0x2000, 0x0400, CRC(826f609c) SHA1(e77ff6c180f5a6d7756d076173ae264a0e26f066)) - ROM_LOAD( "spe_2.rom", 0x2400, 0x0400, CRC(98320040) SHA1(6baf87e196f1ccdf44912deafa6042becbfb0679)) - - ROM_REGION( 0x4000, "vram", ROMREGION_ERASE00 ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, mc8020, 0, 0, mc8020, mc8020, driver_device, 0, "VEB Elektronik Gera", "MC-80.21/22", MACHINE_NO_SOUND) -COMP( 198?, mc8030, mc8020, 0, mc8030, mc8030, driver_device, 0, "VEB Elektronik Gera", "MC-80.30/31", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | ORIENTATION_FLIP_X) diff --git a/src/mess/drivers/mcb216.c b/src/mess/drivers/mcb216.c deleted file mode 100644 index 05aaf8960f8..00000000000 --- a/src/mess/drivers/mcb216.c +++ /dev/null @@ -1,161 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - 2013-12-01 Driver for Cromemco MCB-216 SCC (Single Card Computer), - and also the earlier CB-308. - - The driver is working, just missing some hardware info (see ToDo). - - TODO: - - Find out cpu clock speed - - Find out what UART type is used - - Memory allocation - - 0000 to 0FFF - standard roms - - 1000 to 1FFF - optional roms or ram (expect roms) - - 2000 to 23FF - standard ram - - 2400 to FFFF - optional whatever the user wants (expect ram) - - MCB-216: - Press Enter twice. You will see the Basic OK prompt. To get into the - monitor, use the QUIT command, and to return use the B command. - - The mcb216 can use an optional floppy-disk-drive unit. The only other - storage is paper-tape, which is expected to be attached to the terminal. - - CB-308: - Press Enter twice. You will see the Monitor logo. To get into the BASIC, - enter GE400. To return to the monitor, use the QUIT command followed by - pressing Enter twice. All monitor commands must be in uppercase. The - only storage is paper-tape. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class mcb216_state : public driver_device -{ -public: - mcb216_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(keyin_r); - DECLARE_READ8_MEMBER(status_r); - DECLARE_MACHINE_RESET(mcb216); - DECLARE_MACHINE_RESET(cb308); - -private: - UINT8 m_term_data; - required_device m_maincpu; - required_device m_terminal; -}; - -static ADDRESS_MAP_START(mcb216_mem, AS_PROGRAM, 8, mcb216_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0x2000, 0x23ff) AM_RAM - AM_RANGE(0x2400, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mcb216_io, AS_IO, 8, mcb216_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(status_r) - AM_RANGE(0x01, 0x01) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(cb308_mem, AS_PROGRAM, 8, mcb216_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_RAM - AM_RANGE(0xe000, 0xefff) AM_ROM AM_REGION("roms", 0) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( mcb216 ) -INPUT_PORTS_END - - -READ8_MEMBER( mcb216_state::keyin_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -// 0x40 - a keystroke is available -// 0x80 - ok to send to terminal -READ8_MEMBER( mcb216_state::status_r ) -{ - return (m_term_data) ? 0xc0 : 0x80; -} - -WRITE8_MEMBER( mcb216_state::kbd_put ) -{ - m_term_data = data; -} - -MACHINE_RESET_MEMBER( mcb216_state, mcb216 ) -{ - m_term_data = 0; -} - -MACHINE_RESET_MEMBER( mcb216_state, cb308 ) -{ - m_term_data = 0; - m_maincpu->set_state_int(Z80_PC, 0xe000); -} - -static MACHINE_CONFIG_START( mcb216, mcb216_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(mcb216_mem) - MCFG_CPU_IO_MAP(mcb216_io) - MCFG_MACHINE_RESET_OVERRIDE(mcb216_state, mcb216) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mcb216_state, kbd_put)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( cb308, mcb216_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(cb308_mem) - MCFG_CPU_IO_MAP(mcb216_io) - MCFG_MACHINE_RESET_OVERRIDE(mcb216_state, cb308) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mcb216_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mcb216 ) - ROM_REGION(0x1000, "roms", 0) - ROM_LOAD( "mcb216r0", 0x0000, 0x0800, CRC(86d20cea) SHA1(9fb8fdbcb8d31bd3304a0b3339c7f423188e9d37) ) - ROM_LOAD( "mcb216r1", 0x0800, 0x0800, CRC(68a25b2c) SHA1(3eadd4a5d65726f767742deb4b51a97df813f37d) ) -ROM_END - -ROM_START( cb308 ) - ROM_REGION(0x1000, "roms", 0) - ROM_LOAD( "cb308r0", 0x0000, 0x0400, CRC(62f50531) SHA1(3071e2ab7fc6b2ca889e4fb5cf7cc9ee8fbe53d3) ) - ROM_LOAD( "cb308r1", 0x0400, 0x0400, CRC(03191ac1) SHA1(84665dfc797c9f51bb659291b18399986ed846fb) ) - ROM_LOAD( "cb308r2", 0x0800, 0x0400, CRC(695ea521) SHA1(efe36a712e2a038ee804e556c5ebe05443cf798e) ) - ROM_LOAD( "cb308r3", 0x0c00, 0x0400, CRC(e3e4a778) SHA1(a7c14458f8636d860ae25b10387fa6f7f2ef6ef9) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, mcb216, 0, 0, mcb216, mcb216, driver_device, 0, "Cromemco", "MCB-216", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) -COMP( 1977, cb308, mcb216, 0, cb308, mcb216, driver_device, 0, "Cromemco", "CB-308", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/mccpm.c b/src/mess/drivers/mccpm.c deleted file mode 100644 index 7821bd59c3e..00000000000 --- a/src/mess/drivers/mccpm.c +++ /dev/null @@ -1,152 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - mc-CP/M-Computer - - 31/08/2010 Skeleton driver. - 18/11/2010 Connected to a terminal - 28/09/2011 Added more bioses - -Some Monitor commands (varies between versions): - -B - boot a floppy (^N to regain control) -E - prints a number -I - Select boot drive/set parameters -K,O - display version header -N - newline -Z - print 'EFFF' - -URL for v3.4: http://www.hanshehl.de/mc-prog.htm (German language) - -I/O ports (my guess) -30 - fdc (1st drive) -40 - fdc (2nd drive) -F0 - terminal in/out -F1 - terminal status - -SIO? - F0 to F3 -PIO A-Data 0F4h, A-Command 0F5h, B-Data 0F6h, B-Command 0F7h - -'maincpu' (F59C): unmapped i/o memory write to 00F1 = 01 & FF -'maincpu' (F59C): unmapped i/o memory write to 00F1 = 00 & FF -'maincpu' (F59C): unmapped i/o memory write to 00F1 = 03 & FF -'maincpu' (F59C): unmapped i/o memory write to 00F1 = E1 & FF -'maincpu' (F59C): unmapped i/o memory write to 00F1 = 04 & FF -'maincpu' (F59C): unmapped i/o memory write to 00F1 = 4C & FF -'maincpu' (F59C): unmapped i/o memory write to 00F1 = 05 & FF -'maincpu' (F59C): unmapped i/o memory write to 00F1 = EA & FF -'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 01 & FF -'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 00 & FF -'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 03 & FF -'maincpu' (F5A5): unmapped i/o memory write to 00F3 = E1 & FF -'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 04 & FF -'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 4C & FF -'maincpu' (F5A5): unmapped i/o memory write to 00F3 = 05 & FF -'maincpu' (F5A5): unmapped i/o memory write to 00F3 = EA & FF -'maincpu' (F5A9): unmapped i/o memory write to 00F5 = CF & FF -'maincpu' (F5AD): unmapped i/o memory write to 00F5 = 7F & FF -'maincpu' (F5B1): unmapped i/o memory write to 00F7 = CF & FF -'maincpu' (F5B4): unmapped i/o memory write to 00F7 = 00 & FF -'maincpu' (F149): unmapped i/o memory write to 0040 = D0 & FF -'maincpu' (F14B): unmapped i/o memory write to 0030 = D0 & FF - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class mccpm_state : public driver_device -{ -public: - mccpm_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_p_ram(*this, "p_ram") - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(mccpm_f0_r); - DECLARE_READ8_MEMBER(mccpm_f1_r); - DECLARE_WRITE8_MEMBER(kbd_put); - required_shared_ptr m_p_ram; - UINT8 m_term_data; - virtual void machine_reset(); -}; - - - -READ8_MEMBER( mccpm_state::mccpm_f0_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -// bit 0 - key pressed -// bit 2 - ready to send to terminal -READ8_MEMBER( mccpm_state::mccpm_f1_r ) -{ - return (m_term_data) ? 5 : 4; -} - -static ADDRESS_MAP_START(mccpm_mem, AS_PROGRAM, 8, mccpm_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_RAM AM_SHARE("p_ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mccpm_io, AS_IO, 8, mccpm_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf0, 0xf0) AM_READ(mccpm_f0_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0xf1, 0xf1) AM_READ(mccpm_f1_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mccpm ) -INPUT_PORTS_END - - -void mccpm_state::machine_reset() -{ - UINT8* bios = memregion("maincpu")->base(); - memcpy(m_p_ram, bios, 0x1000); -} - -WRITE8_MEMBER( mccpm_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( mccpm, mccpm_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(mccpm_mem) - MCFG_CPU_IO_MAP(mccpm_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mccpm_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mccpm ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v36", "V3.6") - ROMX_LOAD( "mon36.j15", 0x0000, 0x1000, CRC(9c441537) SHA1(f95bad52d9392b8fc9d9b8779b7b861672a0022b), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v34", "V3.4") - ROMX_LOAD( "monhemc.bin", 0x0000, 0x1000, CRC(cae7b56e) SHA1(1f40be9491a595e6705099a452743cc0d49bfce8), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v34a", "V3.4 (alt)") - ROMX_LOAD( "mc01mon.bin", 0x0000, 0x0d00, CRC(d1c89043) SHA1(f52a0ed3793dde0de74596be7339233b6a1770af), ROM_BIOS(3)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, mccpm, 0, 0, mccpm, mccpm, driver_device, 0, "GRAF Elektronik Systeme GmbH", "mc-CP/M-Computer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/megadriv.c b/src/mess/drivers/megadriv.c deleted file mode 100644 index 63164a11d0f..00000000000 --- a/src/mess/drivers/megadriv.c +++ /dev/null @@ -1,939 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood - -#include "emu.h" -#include "includes/md_cons.h" -#include "sound/sn76496.h" - -#include "imagedev/chd_cd.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#include "formats/imageutl.h" - - -/************************************* - * - * Input handlers - * - *************************************/ - -/* These overwrite the MAME ones in DRIVER_INIT */ -/* They're needed to give the users the choice between different controllers */ -READ8_MEMBER(md_cons_state::mess_md_io_read_data_port) -{ - int portnum = offset; - - UINT8 retdata; - int controller; - UINT8 helper_6b = (m_megadrive_io_ctrl_regs[portnum] & 0x3f) | 0xc0; // bits 6 & 7 always come from megadrive_io_data_regs - UINT8 helper_3b = (m_megadrive_io_ctrl_regs[portnum] & 0x7f) | 0x80; // bit 7 always comes from megadrive_io_data_regs - - switch (portnum) - { - case 0: - controller = (m_io_ctrlr->read() & 0x0f); - break; - - case 1: - controller = (m_io_ctrlr->read() & 0xf0); - break; - - default: - controller = 0; - break; - } - - /* Are we using a 6 buttons Joypad? */ - if (controller) - { - if (m_megadrive_io_data_regs[portnum] & 0x40) - { - if (m_io_stage[portnum] == 2) - { - /* here we read B, C & the additional buttons */ - retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - ((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x30) | - ((m_io_pad6b[1][portnum] ? m_io_pad6b[1][portnum]->read() : 0) & 0x0f)) & ~helper_6b); - } - else - { - /* here we read B, C & the directional buttons */ - retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - (((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x3f) & ~helper_6b); - } - } - else - { - if (m_io_stage[portnum] == 1) - { - /* here we read ((Start & A) >> 2) | 0x00 */ - retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - ((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) & ~helper_6b); - } - else if (m_io_stage[portnum]==2) - { - /* here we read ((Start & A) >> 2) | 0x0f */ - retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - (((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) | 0x0f) & ~helper_6b); - } - else - { - /* here we read ((Start & A) >> 2) | Up and Down */ - retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - (((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) | - ((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x03)) & ~helper_6b); - } - } - - // osd_printf_debug("read io data port stage %d port %d %02x\n",mess_io_stage[portnum],portnum,retdata); - - retdata |= (retdata << 8); - } - /* Otherwise it's a 3 buttons Joypad */ - else - { - UINT8 svp_test = 0; - if (m_cart) - svp_test = m_cart->read_test(); - - // handle test input for SVP test - if (portnum == 0 && svp_test) - { - retdata = (m_megadrive_io_data_regs[0] & 0xc0); - } - else if (m_megadrive_io_data_regs[portnum] & 0x40) - { - /* here we read B, C & the directional buttons */ - retdata = (m_megadrive_io_data_regs[portnum] & helper_3b) | - ((((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0x3f) | 0x40) & ~helper_3b); - } - else - { - /* here we read ((Start & A) >> 2) | Up and Down */ - retdata = (m_megadrive_io_data_regs[portnum] & helper_3b) | - (((((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0xc0) >> 2) | - ((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0x03) | 0x40) & ~helper_3b); - } - } - - return retdata; -} - - -WRITE16_MEMBER(md_cons_state::mess_md_io_write_data_port) -{ - int portnum = offset; - int controller; - - switch (portnum) - { - case 0: - controller = (m_io_ctrlr->read() & 0x0f); - break; - - case 1: - controller = (m_io_ctrlr->read() & 0xf0); - break; - - default: - controller = 0; - break; - } - - if (controller) - { - if (m_megadrive_io_ctrl_regs[portnum] & 0x40) - { - if (((m_megadrive_io_data_regs[portnum] & 0x40) == 0x00) && ((data & 0x40) == 0x40)) - { - m_io_stage[portnum]++; - m_io_timeout[portnum]->adjust(m_maincpu->cycles_to_attotime(8192)); - } - - } - } - m_megadrive_io_data_regs[portnum] = data; - //osd_printf_debug("Writing IO Data Register #%d data %04x\n",portnum,data); -} - - -/************************************* - * - * Input ports - * - *************************************/ - - -static INPUT_PORTS_START( md ) - PORT_START("CTRLSEL") /* Controller selection */ - PORT_CONFNAME( 0x0f, 0x00, "Player 1 Controller" ) - PORT_CONFSETTING( 0x00, "Joystick 3 Buttons" ) - PORT_CONFSETTING( 0x01, "Joystick 6 Buttons" ) -// PORT_CONFSETTING( 0x02, "Sega Mouse" ) -/* there exists both a 2 buttons version of the Mouse (Jpn ver, to be used with RPGs, it - can aslo be used as trackball) and a 3 buttons version (US ver, no trackball feats.) */ -// PORT_CONFSETTING( 0x03, "Sega Menacer" ) -// PORT_CONFSETTING( 0x04, "Konami Justifier" ) -// PORT_CONFSETTING( 0x05, "Team Player (Sega Multitap)" ) -// PORT_CONFSETTING( 0x06, "4-Play (EA Multitap)" ) -// PORT_CONFSETTING( 0x07, "J-Cart" ) - PORT_CONFNAME( 0xf0, 0x00, "Player 2 Controller" ) - PORT_CONFSETTING( 0x00, "Joystick 3 Buttons" ) - PORT_CONFSETTING( 0x10, "Joystick 6 Buttons" ) - - PORT_START("PAD1_3B") /* Joypad 1 (3 button + start) NOT READ DIRECTLY */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) - - PORT_START("PAD2_3B") /* Joypad 2 (3 button + start) NOT READ DIRECTLY */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) - - PORT_START("PAD1_6B") /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 B") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 A") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - - PORT_START("EXTRA1") /* Extra buttons for Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Z") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Y") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 X") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Mode") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - - PORT_START("PAD2_6B") /* Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 B") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 A") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - - PORT_START("EXTRA2") /* Extra buttons for Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Z") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Y") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 X") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Mode") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - - PORT_START("RESET") /* Buttons on Genesis Console */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?) -INPUT_PORTS_END - - - -/************************************* - * - * Machine driver - * - *************************************/ - -MACHINE_START_MEMBER(md_cons_state, md_common) -{ - static const char *const pad6names[2][4] = { - { "PAD1_6B", "PAD2_6B", "UNUSED", "UNUSED" }, - { "EXTRA1", "EXTRA2", "UNUSED", "UNUSED" } - }; - static const char *const pad3names[4] = { "PAD1_3B", "PAD2_3B", "UNUSED", "UNUSED" }; - - m_io_ctrlr = ioport("CTRLSEL"); - - for (int i = 0; i < 4; i++) - { - m_io_pad3b[i] = ioport(pad3names[i]); - m_io_pad6b[0][i] = ioport(pad6names[0][i]); - m_io_pad6b[1][i] = ioport(pad6names[1][i]); - } - - // setup timers for 6 button pads - for (int i = 0; i < 3; i++) - m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this), (void*)(FPTR)i); - - m_vdp->stop_timers(); - - if (m_cart) - m_cart->save_nvram(); -} - -MACHINE_START_MEMBER(md_cons_state, ms_megadriv) -{ - MACHINE_START_CALL_MEMBER( md_common ); - - // the SVP introduces some kind of DMA 'lag', which we have to compensate for, this is obvious even on gfx DMAd from ROM (the Speedometer) - if (m_cart->get_type() == SEGA_SVP) - m_vdp->set_dma_delay(2); - - // for now m_cartslot is only in MD and not 32x and SegaCD - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_cart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_cart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_cart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)m_cart)); -} - -MACHINE_START_MEMBER(md_cons_state, ms_megacd) -{ - MACHINE_START_CALL_MEMBER( md_common ); - - // the segaCD introduces some kind of DMA 'lag', which we have to compensate for, - // at least when reading wordram? we might need to check what mode we're in the DMA... - m_vdp->set_dma_delay(2); -} - -MACHINE_RESET_MEMBER(md_cons_state, ms_megadriv) -{ - m_maincpu->reset(); - MACHINE_RESET_CALL_MEMBER( megadriv ); - - // if the system has a 32x, pause the extra CPUs until they are actually turned on - if (m_32x) - m_32x->pause_cpu(); -} - -// same as screen_eof_megadriv but with addition of 32x and SegaCD/MegaCD pieces -void md_cons_state::screen_eof_console(screen_device &screen, bool state) -{ - if (m_io_reset && (m_io_reset->read() & 0x01)) - m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - - // rising edge - if (state) - { - if (!m_vdp->m_use_alt_timing) - { - bool mode3 = (m_vdp->get_imode() == 3); - m_vdp->vdp_handle_eof(); - m_vdp->m_megadriv_scanline_timer->adjust(attotime::zero); - - if (m_32x) - { - m_32x->m_32x_vblank_flag = 0; - m_32x->m_32x_hcount_compare_val = -1; - m_32x->update_total_scanlines(mode3); - } - if (m_segacd) - m_segacd->update_total_scanlines(mode3); - } - } -} - -static MACHINE_CONFIG_START( ms_megadriv, md_cons_state ) - MCFG_FRAGMENT_ADD( md_ntsc ) - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megadriv) - MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) - - MCFG_SCREEN_MODIFY("megadriv") - MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) - - MCFG_MD_CARTRIDGE_ADD("mdslot", md_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","megadriv") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ms_megadpal, md_cons_state ) - MCFG_FRAGMENT_ADD( md_pal ) - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megadriv) - MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) - - MCFG_SCREEN_MODIFY("megadriv") - MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) - - MCFG_MD_CARTRIDGE_ADD("mdslot", md_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","megadriv") -MACHINE_CONFIG_END - - - - -/************************************* - * - * ROM definition(s) - * - *************************************/ - - -/* we don't use the bios rom (it's not needed and only provides security on early models) */ - -ROM_START(genesis) - ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) - ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) -ROM_END - -ROM_START(megadriv) - ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) - ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) -ROM_END - -ROM_START(megadrij) - ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) - ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) -ROM_END - - -/************************************* - * - * Driver initialization - * - *************************************/ - -DRIVER_INIT_MEMBER(md_cons_state, mess_md_common) -{ - m_megadrive_io_read_data_port_ptr = read8_delegate(FUNC(md_cons_state::mess_md_io_read_data_port),this); - m_megadrive_io_write_data_port_ptr = write16_delegate(FUNC(md_cons_state::mess_md_io_write_data_port),this); -} - -DRIVER_INIT_MEMBER(md_cons_state, genesis) -{ - DRIVER_INIT_CALL(megadriv); - DRIVER_INIT_CALL(mess_md_common); - - if (m_32x) - { - m_32x->set_32x_pal(FALSE); - m_32x->set_framerate(60); - m_32x->set_total_scanlines(262); - } - if (m_segacd) - { - m_segacd->set_framerate(60); - m_segacd->set_total_scanlines(262); - } - - m_version_hi_nibble = 0x80; // Export NTSC - if (!m_segacd) - m_version_hi_nibble |= 0x20; -} - -DRIVER_INIT_MEMBER(md_cons_state, md_eur) -{ - DRIVER_INIT_CALL(megadrie); - DRIVER_INIT_CALL(mess_md_common); - - if (m_32x) - { - m_32x->set_32x_pal(TRUE); - m_32x->set_framerate(50); - m_32x->set_total_scanlines(313); - } - if (m_segacd) - { - m_segacd->set_framerate(50); - m_segacd->set_total_scanlines(313); - } - - m_version_hi_nibble = 0xc0; // Export PAL - if (!m_segacd) - m_version_hi_nibble |= 0x20; -} - -DRIVER_INIT_MEMBER(md_cons_state, md_jpn) -{ - DRIVER_INIT_CALL(megadrij); - DRIVER_INIT_CALL(mess_md_common); - - if (m_32x) - { - m_32x->set_32x_pal(FALSE); - m_32x->set_framerate(60); - m_32x->set_total_scanlines(262); - } - if (m_segacd) - { - m_segacd->set_framerate(60); - m_segacd->set_total_scanlines(262); - } - - m_version_hi_nibble = 0x00; // JPN NTSC - if (!m_segacd) - m_version_hi_nibble |= 0x20; -} - -/****************************************** 32X emulation ****************************************/ - -DEVICE_IMAGE_LOAD_MEMBER( md_cons_state, _32x_cart ) -{ - UINT32 length; - dynamic_buffer temp_copy; - UINT16 *ROM16; - UINT32 *ROM32; - int i; - - if (image.software_entry() == NULL) - { - length = image.length(); - temp_copy.resize(length); - image.fread(&temp_copy[0], length); - } - else - { - length = image.get_software_region_length("rom"); - temp_copy.resize(length); - memcpy(&temp_copy[0], image.get_software_region("rom"), length); - } - - /* Copy the cart image in the locations the driver expects */ - // Notice that, by using pick_integer, we are sure the code works on both LE and BE machines - ROM16 = (UINT16 *) memregion("gamecart")->base(); - for (i = 0; i < length; i += 2) - ROM16[i / 2] = pick_integer_be(&temp_copy[0], i, 2); - - ROM32 = (UINT32 *) memregion("gamecart_sh2")->base(); - for (i = 0; i < length; i += 4) - ROM32[i / 4] = pick_integer_be(&temp_copy[0], i, 4); - - ROM16 = (UINT16 *) memregion("maincpu")->base(); - for (i = 0x00; i < length; i += 2) - ROM16[i / 2] = pick_integer_be(&temp_copy[0], i, 2); - - return IMAGE_INIT_PASS; -} - - -void md_cons_state::_32x_scanline_callback(int x, UINT32 priority, UINT16 &lineptr) -{ - if (m_32x) - m_32x->_32x_render_videobuffer_to_screenbuffer(x, priority, lineptr); -} - -void md_cons_state::_32x_interrupt_callback(int scanline, int irq6) -{ - if (m_32x) - m_32x->_32x_interrupt_cb(scanline, irq6); -} - -void md_cons_state::_32x_scanline_helper_callback(int scanline) -{ - if (m_32x) - m_32x->_32x_render_videobuffer_to_screenbuffer_helper(scanline); -} - -static MACHINE_CONFIG_START( genesis_32x, md_cons_state ) - MCFG_FRAGMENT_ADD( md_ntsc ) - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, md_common) - MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) - - MCFG_DEVICE_MODIFY("gen_vdp") - MCFG_SEGA315_5313_32X_SCANLINE_CB(md_cons_state, _32x_scanline_callback); - MCFG_SEGA315_5313_32X_SCANLINE_HELPER_CB(md_cons_state, _32x_scanline_helper_callback); - MCFG_SEGA315_5313_32X_INTERRUPT_CB(md_cons_state, _32x_interrupt_callback); - - MCFG_DEVICE_ADD("sega32x", SEGA_32X_NTSC, 0) - MCFG_SEGA_32X_PALETTE("gen_vdp:palette") - - MCFG_SCREEN_MODIFY("megadriv") - MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) - - // we need to remove and re-add the sound system because the balance is different - // due to MAME / MESS having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is slient?!) - MCFG_DEVICE_REMOVE("ymsnd") - MCFG_DEVICE_REMOVE("snsnd") - - MCFG_SOUND_ADD("ymsnd", YM2612, MASTER_CLOCK_NTSC/7) - MCFG_SOUND_ROUTE(0, "lspeaker", (0.50)/2) - MCFG_SOUND_ROUTE(1, "rspeaker", (0.50)/2) - - /* sound hardware */ - MCFG_SOUND_ADD("snsnd", SEGAPSG, MASTER_CLOCK_NTSC/15) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart") - MCFG_GENERIC_EXTENSIONS("32x,bin") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(md_cons_state, _32x_cart) - - MCFG_SOFTWARE_LIST_ADD("cart_list","32x") - MCFG_SOFTWARE_LIST_FILTER("cart_list","NTSC-U") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( mdj_32x, md_cons_state ) - MCFG_FRAGMENT_ADD( md_ntsc ) - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, md_common) - MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) - - MCFG_DEVICE_MODIFY("gen_vdp") - MCFG_SEGA315_5313_32X_SCANLINE_CB(md_cons_state, _32x_scanline_callback); - MCFG_SEGA315_5313_32X_SCANLINE_HELPER_CB(md_cons_state, _32x_scanline_helper_callback); - MCFG_SEGA315_5313_32X_INTERRUPT_CB(md_cons_state, _32x_interrupt_callback); - - MCFG_DEVICE_ADD("sega32x", SEGA_32X_NTSC, 0) - MCFG_SEGA_32X_PALETTE("gen_vdp:palette") - - MCFG_SCREEN_MODIFY("megadriv") - MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) - - // we need to remove and re-add the sound system because the balance is different - // due to MAME / MESS having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is slient?!) - MCFG_DEVICE_REMOVE("ymsnd") - MCFG_DEVICE_REMOVE("snsnd") - - MCFG_SOUND_ADD("ymsnd", YM2612, MASTER_CLOCK_NTSC/7) - MCFG_SOUND_ROUTE(0, "lspeaker", (0.50)/2) - MCFG_SOUND_ROUTE(1, "rspeaker", (0.50)/2) - - /* sound hardware */ - MCFG_SOUND_ADD("snsnd", SEGAPSG, MASTER_CLOCK_NTSC/15) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart") - MCFG_GENERIC_EXTENSIONS("32x,bin") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(md_cons_state, _32x_cart) - - MCFG_SOFTWARE_LIST_ADD("cart_list","32x") - MCFG_SOFTWARE_LIST_FILTER("cart_list","NTSC-J") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( md_32x, md_cons_state ) - MCFG_FRAGMENT_ADD( md_pal ) - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, md_common) - MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) - - MCFG_DEVICE_MODIFY("gen_vdp") - MCFG_SEGA315_5313_32X_SCANLINE_CB(md_cons_state, _32x_scanline_callback); - MCFG_SEGA315_5313_32X_SCANLINE_HELPER_CB(md_cons_state, _32x_scanline_helper_callback); - MCFG_SEGA315_5313_32X_INTERRUPT_CB(md_cons_state, _32x_interrupt_callback); - - MCFG_DEVICE_ADD("sega32x", SEGA_32X_PAL, 0) - MCFG_SEGA_32X_PALETTE("gen_vdp:palette") - - MCFG_SCREEN_MODIFY("megadriv") - MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) - - // we need to remove and re-add the sound system because the balance is different - // due to MAME / MESS having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is slient?!) - MCFG_DEVICE_REMOVE("ymsnd") - MCFG_DEVICE_REMOVE("snsnd") - - MCFG_SOUND_ADD("ymsnd", YM2612, MASTER_CLOCK_NTSC/7) - MCFG_SOUND_ROUTE(0, "lspeaker", (0.50)/2) - MCFG_SOUND_ROUTE(1, "rspeaker", (0.50)/2) - - /* sound hardware */ - MCFG_SOUND_ADD("snsnd", SEGAPSG, MASTER_CLOCK_NTSC/15) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart") - MCFG_GENERIC_EXTENSIONS("32x,bin") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(md_cons_state, _32x_cart) - - MCFG_SOFTWARE_LIST_ADD("cart_list","32x") - MCFG_SOFTWARE_LIST_FILTER("cart_list","PAL") -MACHINE_CONFIG_END - - - -#define _32X_ROMS \ - ROM_REGION16_BE( 0x400000, "gamecart", ROMREGION_ERASE00 ) /* 68000 Code */ \ - ROM_REGION32_BE( 0x400000, "gamecart_sh2", ROMREGION_ERASE00 ) /* Copy for the SH2 */ \ - ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */ \ - ROM_LOAD( "32x_g_bios.bin", 0x000000, 0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) ) \ - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) \ - /* temp, rom should only be visible here when one of the regs is set, tempo needs it */ \ - ROM_COPY( "32x_68k_bios", 0x0, 0x0, 0x100) \ - ROM_REGION32_BE( 0x400000, "master", 0 ) /* SH2 Code */ \ - ROM_SYSTEM_BIOS( 0, "retail", "Mars Version 1.0 (retail)" ) \ - ROMX_LOAD( "32x_m_bios.bin", 0x000000, 0x000800, CRC(dd9c46b8) SHA1(1e5b0b2441a4979b6966d942b20cc76c413b8c5e), ROM_BIOS(1) ) \ - ROM_SYSTEM_BIOS( 1, "sdk", "Mars Version 1.0 (early sdk)" ) \ - ROMX_LOAD( "32x_m_bios_sdk.bin", 0x000000, 0x000800, BAD_DUMP CRC(c7102c53) SHA1(ed73a47f186b373b8eff765f84ef26c3d9ef6cb0), ROM_BIOS(2) ) \ - ROM_REGION32_BE( 0x400000, "slave", 0 ) /* SH2 Code */ \ - ROM_LOAD( "32x_s_bios.bin", 0x000000, 0x000400, CRC(bfda1fe5) SHA1(4103668c1bbd66c5e24558e73d4f3f92061a109a) ) - -ROM_START( 32x ) - _32X_ROMS -ROM_END - -ROM_START( 32xe ) - _32X_ROMS -ROM_END - -ROM_START( 32xj ) - _32X_ROMS -ROM_END - - -/****************************************** SegaCD emulation ****************************************/ - -static MACHINE_CONFIG_START( genesis_scd, md_cons_state ) - MCFG_FRAGMENT_ADD( md_ntsc ) - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd) - MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) - - MCFG_SCREEN_MODIFY("megadriv") - MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) - - MCFG_DEVICE_ADD("segacd", SEGA_SEGACD_US, 0) - MCFG_GFX_PALETTE("gen_vdp:palette") - - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("scd_cdrom") - - MCFG_SOFTWARE_LIST_ADD("cd_list","segacd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( md_scd, md_cons_state ) - MCFG_FRAGMENT_ADD( md_pal ) - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd) - MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) - - MCFG_SCREEN_MODIFY("megadriv") - MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) - - MCFG_DEVICE_ADD("segacd", SEGA_SEGACD_EUROPE, 0) - MCFG_GFX_PALETTE("gen_vdp:palette") - - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("scd_cdrom") - - MCFG_SOFTWARE_LIST_ADD("cd_list","megacd") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( mdj_scd, md_cons_state ) - MCFG_FRAGMENT_ADD( md_ntsc ) - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd) - MCFG_MACHINE_RESET_OVERRIDE(md_cons_state, ms_megadriv) - - MCFG_SCREEN_MODIFY("megadriv") - MCFG_SCREEN_VBLANK_DRIVER(md_cons_state, screen_eof_console) - - MCFG_DEVICE_ADD("segacd", SEGA_SEGACD_JAPAN, 0) - MCFG_GFX_PALETTE("gen_vdp:palette") - - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("scd_cdrom") - - MCFG_SOFTWARE_LIST_ADD("cd_list","megacdj") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( genesis_32x_scd, genesis_32x ) - - MCFG_DEVICE_ADD("segacd", SEGA_SEGACD_US, 0) - MCFG_GFX_PALETTE("gen_vdp:palette") - - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("scd_cdrom") - - MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd) - - MCFG_DEVICE_REMOVE("cartslot") - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart") - MCFG_GENERIC_EXTENSIONS("32x,bin") - MCFG_GENERIC_LOAD(md_cons_state, _32x_cart) - - //MCFG_QUANTUM_PERFECT_CPU("32x_master_sh2") -MACHINE_CONFIG_END - - - -/* We need proper names for most of these BIOS ROMs! */ -ROM_START( segacd ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - /* v1.10 confirmed dump by dead_screem */ - ROM_LOAD( "mpr-15045b.bin", 0x000000, 0x020000, CRC(c6d10268) SHA1(f4f315adcef9b8feb0364c21ab7f0eaf5457f3ed) ) -ROM_END - -ROM_START( megacd ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - /* v1.00, confirmed good dump */ - ROM_LOAD( "megacd_model1_bios_1_00_e.bin", 0x000000, 0x020000, CRC(529ac15a) SHA1(f891e0ea651e2232af0c5c4cb46a0cae2ee8f356) ) -ROM_END - -ROM_START( megacdj ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - ROM_DEFAULT_BIOS("v100g") // this seems the only revision where the cursor in CD menu works, allowing to boot games - /* Confirmed by ElBarto */ - ROM_SYSTEM_BIOS(0, "v100s", "v1.00S") - ROMX_LOAD( "mpr-14088h.bin", 0x000000, 0x020000, CRC(3773d5aa) SHA1(bbf729a1aaa1667b783749299e1ad932aaf5f253), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE) - /* Confirmed by ElBarto */ - ROM_SYSTEM_BIOS(1, "v100g", "v1.00G") - ROMX_LOAD( "epr-14088b.bin", 0x000000, 0x020000, CRC(69ed6ccd) SHA1(27d11c3836506f01ee81cd142c0cd8b51abebbd2), ROM_BIOS(2) | ROM_GROUPWORD | ROM_REVERSE) - /* Confirmed by ElBarto */ - ROM_SYSTEM_BIOS(2, "v100l", "v1.00L") - ROMX_LOAD( "mpr-14088c.bin", 0x000000, 0x020000, CRC(03134289) SHA1(d60cb5a53f26d6b13e354bc149217587f2301718), ROM_BIOS(3) | ROM_GROUPWORD | ROM_REVERSE) - /* Confirmed by ElBarto */ - ROM_SYSTEM_BIOS(3, "v100o", "v1.00O") - ROMX_LOAD( "epr-14088d.bin", 0x000000, 0x020000, CRC(dfa95ee9) SHA1(e13666c76fa0a2e94e2f651b26b0fd625bf55f07), ROM_BIOS(4) | ROM_GROUPWORD | ROM_REVERSE) - ROM_SYSTEM_BIOS(4, "v100p", "v1.00P") // CRC: e2e70bc8 when byteswapped - ROMX_LOAD( "epr-14088e.bin", 0x000000, 0x020000, CRC(9d2da8f2) SHA1(4846f448160059a7da0215a5df12ca160f26dd69), ROM_BIOS(5) ) -ROM_END - -/* Asia bios, when run in USA region will show : -ERROR! -THIS IS A PAL-COMPATIBLE MEGA CD -FOR EXCLUSIVE USE IN SOUTHEAST ASIA. - -Confirmed by Jakovasaur -*/ -ROM_START( megacda ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "epr-14536h.bin", 0x000000, 0x020000, CRC(550f30bb) SHA1(e4193c6ae44c3cea002707d2a88f1fbcced664de)) -ROM_END - -ROM_START( segacd2 ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - ROM_SYSTEM_BIOS(0, "v211x", "Model 2 v2.11X") - ROMX_LOAD( "mpr-15764-t.bin", 0x000000, 0x020000, CRC(2e49d72c) SHA1(328a3228c29fba244b9db2055adc1ec4f7a87e6b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "v200", "Model 2 v2.00") /* verified dump */ - ROMX_LOAD( "us_scd2_930314.bin", 0x000000, 0x020000, CRC(8af65f58) SHA1(5a8c4b91d3034c1448aac4b5dc9a6484fce51636), ROM_BIOS(2) ) - /* this is reportedly a bad dump, it has many differences from the verified dump and does not boot in Kega */ - /* ROMX_LOAD( "segacd_model2_bios_2_00_u.bin", 0x000000, 0x020000, CRC(340b4be4) SHA1(bd3ee0c8ab732468748bf98953603ce772612704), ROM_BIOS(2) ) */ - ROM_SYSTEM_BIOS(2, "v200w", "Model 2 v2.00W") - ROMX_LOAD( "segacd_model2_bios_2_00w_u.bin", 0x000000, 0x020000, CRC(9f6f6276) SHA1(5adb6c3af218c60868e6b723ec47e36bbdf5e6f0), ROM_BIOS(3) ) -ROM_END - -/* All confirmed good dump by ElBarto */ -ROM_START( megacd2 ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - ROM_SYSTEM_BIOS(0, "v200w", "v2.00W") - ROMX_LOAD( "mpr-15512a.bin", 0x000000, 0x020000, CRC(53f1757c) SHA1(67bf3970ca5a05fd5ce3d6c446789c5d971b98a4), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE ) - ROM_SYSTEM_BIOS(1, "v200", "v2.00") - ROMX_LOAD( "mpr-15512.bin", 0x000000, 0x020000, CRC(cb76f114) SHA1(939f173cadc41e996a3c34498da1bf55e7e18ff8), ROM_BIOS(2) | ROM_GROUPWORD | ROM_REVERSE ) -ROM_END - -/* Confirmed good dump by ElBarto */ -ROM_START( megacd2j ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - ROM_SYSTEM_BIOS(0, "v200c", "v2.00C") - ROMX_LOAD( "mpr-15398.bin", 0x000000, 0x020000, CRC(1e4344e6) SHA1(4d1251a6973d932e734ae5e8c6b9b55eb40e4143), ROM_BIOS(1) | ROM_GROUPWORD | ROM_REVERSE ) -ROM_END - -ROM_START( aiwamcd ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - /* v2.11 */ - ROM_LOAD( "mpr-15768-t.bin", 0x000000, 0x020000, CRC(8052c7a0) SHA1(219d284dcf63ce366a4dc6d1ff767a0d2eea283d) ) -ROM_END - -ROM_START( laseract ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - ROM_SYSTEM_BIOS(0, "v104", "v1.04") - ROMX_LOAD( "laseractive_bios_1_04_u.bin", 0x000000, 0x020000, CRC(50cd3d23) SHA1(aa811861f8874775075bd3f53008c8aaf59b07db), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "v102", "v1.02") - ROMX_LOAD( "laseractive_bios_1_02_u.bin", 0x000000, 0x020000, CRC(3b10cf41) SHA1(8af162223bb12fc19b414f126022910372790103), ROM_BIOS(2) ) -ROM_END - -ROM_START( laseractj ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - ROM_SYSTEM_BIOS(0, "v105", "v1.05") - ROMX_LOAD( "mega-ld 1.05 bios.bin", 0x000000, 0x020000, CRC(474aaa44) SHA1(b3b1d880e288b6dc79eec0ff1b0480c229ec141d), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "v102", "v1.02") - ROMX_LOAD( "laseractive_bios_1_02_j.bin", 0x000000, 0x020000, CRC(00eedb3a) SHA1(26237b333db4a4c6770297fa5e655ea95840d5d9), ROM_BIOS(2) ) -ROM_END - -ROM_START( xeye ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - /* v2.00 (US), confirmed good with a chip dump */ - ROM_LOAD( "g304.bin", 0x000000, 0x020000, CRC(290f8e33) SHA1(651f14d5a5e0ecb974a60c0f43b1d2006323fb09) ) -ROM_END - -ROM_START( wmega ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - /* v1.00 (Japan NTSC) Sega BIOS, chip-dumped */ - ROM_LOAD( "g301.bin", 0x000000, 0x020000, CRC(d21fe71d) SHA1(3fc9358072f74bd24e3e297ea11b2bf15a7af891) ) -ROM_END - -ROM_START( wmegam2 ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - /* v2.00 */ - ROM_LOAD( "wondermega_m2_bios_2_00_j.bin", 0x000000, 0x020000, CRC(2b19972f) SHA1(b3f32e409bd5508c89ed8be33d41a58d791d0e5d) ) -ROM_END - -ROM_START( cdx ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - /* v2.21X */ - ROM_LOAD( "segacdx_bios_2_21_u.bin", 0x000000, 0x020000, CRC(d48c44b5) SHA1(2b125c0545afa089b617f2558e686ea723bdc06e) ) -ROM_END - -ROM_START( multmega ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - /* v2.21X */ - ROM_LOAD( "opr-16140.bin", 0x000000, 0x020000, CRC(aacb851e) SHA1(75548ac9aaa6e81224499f9a1403b2b42433f5b7) ) - /* the below was marked "confirmed good dump", but 0x72 and 0x73 are 0xFF, indicating a bad dump made from memory */ - /* ROM_LOAD( "multimega_bios_2_21_e.bin", 0x000000, 0x020000, CRC(34d3cce1) SHA1(73fc9c014ad803e9e7d8076b3642a8a5224b3e51) ) */ -ROM_END - -/* some games use the 32x and SegaCD together to give better quality FMV */ -ROM_START( 32x_scd ) - ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 ) - - ROM_REGION16_BE( 0x400000, "gamecart", 0 ) /* 68000 Code */ - ROM_LOAD( "mpr-15764-t.bin", 0x000000, 0x020000, CRC(2e49d72c) SHA1(328a3228c29fba244b9db2055adc1ec4f7a87e6b) ) - - ROM_REGION32_BE( 0x400000, "gamecart_sh2", 0 ) /* Copy for the SH2 */ - ROM_COPY( "gamecart", 0x0, 0x0, 0x400000) - - ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */ - ROM_LOAD( "32x_g_bios.bin", 0x000000, 0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) ) - - ROM_REGION32_BE( 0x400000, "master", 0 ) /* SH2 Code */ - ROM_LOAD( "32x_m_bios.bin", 0x000000, 0x000800, CRC(dd9c46b8) SHA1(1e5b0b2441a4979b6966d942b20cc76c413b8c5e) ) - - ROM_REGION32_BE( 0x400000, "slave", 0 ) /* SH2 Code */ - ROM_LOAD( "32x_s_bios.bin", 0x000000, 0x000400, CRC(bfda1fe5) SHA1(4103668c1bbd66c5e24558e73d4f3f92061a109a) ) -ROM_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1989, genesis, 0, 0, ms_megadriv, md, md_cons_state, genesis, "Sega", "Genesis (USA, NTSC)", MACHINE_SUPPORTS_SAVE ) -CONS( 1990, megadriv, genesis, 0, ms_megadpal, md, md_cons_state, md_eur, "Sega", "Mega Drive (Europe, PAL)", MACHINE_SUPPORTS_SAVE ) -CONS( 1988, megadrij, genesis, 0, ms_megadriv, md, md_cons_state, md_jpn, "Sega", "Mega Drive (Japan, NTSC)", MACHINE_SUPPORTS_SAVE ) - -// the 32X plugged in the cart slot, games plugged into the 32x. Maybe it should be handled as an expansion device? -CONS( 1994, 32x, 0, 0, genesis_32x, md, md_cons_state, genesis, "Sega", "Genesis with 32X (USA, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1994, 32xe, 32x, 0, md_32x, md, md_cons_state, md_eur, "Sega", "Mega Drive with 32X (Europe, PAL)", MACHINE_NOT_WORKING ) -CONS( 1994, 32xj, 32x, 0, mdj_32x, md, md_cons_state, md_jpn, "Sega", "Mega Drive with 32X (Japan, NTSC)", MACHINE_NOT_WORKING ) - -// the SegaCD plugged into the expansion port.. -CONS( 1992, segacd, 0, 0, genesis_scd, md, md_cons_state, genesis, "Sega", "Sega CD (USA, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1993, megacd, segacd, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Mega-CD (Europe, PAL)", MACHINE_NOT_WORKING ) -CONS( 1991, megacdj, segacd, 0, mdj_scd, md, md_cons_state, md_jpn, "Sega", "Mega-CD (Japan, NTSC)", MACHINE_NOT_WORKING ) // this bios doesn't work with our ram interleave needed by a few games?! -CONS( 1991, megacda, segacd, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Mega-CD (Asia, PAL)", MACHINE_NOT_WORKING ) -CONS( 1993, segacd2, 0, 0, genesis_scd, md, md_cons_state, genesis, "Sega", "Sega CD 2 (USA, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1993, megacd2, segacd2, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Mega-CD 2 (Europe, PAL)", MACHINE_NOT_WORKING ) -CONS( 1993, megacd2j, segacd2, 0, mdj_scd, md, md_cons_state, md_jpn, "Sega", "Mega-CD 2 (Japan, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1994, aiwamcd, segacd2, 0, mdj_scd, md, md_cons_state, md_jpn, "AIWA", "Mega-CD CSD-G1M (Japan, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1993, laseract, 0, 0, genesis_scd, md, md_cons_state, genesis, "Pioneer","LaserActive (USA, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1993, laseractj, laseract, 0, mdj_scd, md, md_cons_state, md_jpn, "Pioneer","LaserActive (Japan, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1993, xeye, 0, 0, genesis_scd, md, md_cons_state, genesis, "JVC", "X'eye (USA, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1992, wmega, xeye, 0, mdj_scd, md, md_cons_state, md_jpn, "Sega", "Wondermega (Japan, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1993, wmegam2, xeye, 0, mdj_scd, md, md_cons_state, md_jpn, "Victor", "Wondermega M2 (Japan, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1994, cdx, 0, 0, genesis_scd, md, md_cons_state, genesis, "Sega", "CDX (USA, NTSC)", MACHINE_NOT_WORKING ) -CONS( 1994, multmega, cdx, 0, md_scd, md, md_cons_state, md_eur, "Sega", "Multi-Mega (Europe, PAL)", MACHINE_NOT_WORKING ) -CONS( 1994, 32x_scd, 0, 0, genesis_32x_scd, md, md_cons_state, genesis, "Sega", "Sega CD (USA, NTSC, w/32X)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/mekd2.c b/src/mess/drivers/mekd2.c deleted file mode 100644 index 8bac598dea0..00000000000 --- a/src/mess/drivers/mekd2.c +++ /dev/null @@ -1,426 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Robbbert -/****************************************************************************** - Motorola Evaluation Kit 6800 D2 - MEK6800D2 - - system driver - - Juergen Buchmueller, Jan 2000 - 2013-06-16 Working driver [Robbbert] - - memory map - - range short description - 0000-00ff RAM 256 bytes RAM - 0100-01ff RAM optional 256 bytes RAM - 6000-63ff PROM optional PROM - or - 6000-67ff ROM optional ROM - 8004-8007 PIA expansion port - 8008-8009 ACIA cassette interface - 8020-8023 PIA keyboard interface - a000-a07f RAM 128 bytes RAM (JBUG scratch) - c000-c3ff PROM optional PROM - or - c000-c7ff ROM optional ROM - e000-e3ff ROM JBUG monitor program - e400-ffff -/- mirrors of monitor rom - - -Enter the 4 digit address then the command key: - - - M : Examine and Change Memory (example: E000M, then G to skip to next, ESC to exit) - - E : Escape (abort) operation (ESC key in our emulation) - - R : Examine Registers - - G : Begin execution at specified address - - P : Punch data from memory to magnetic tape - - L : Load memory from magnetic tape - - N : Trace one instruction - - V : Set (and remove) breakpoints - -The keys are laid out as: - - P L N V - - 7 8 9 A M - 4 5 6 B E - 1 2 3 C R - 0 F E D G - - -Pasting: - 0-F : as is - NEXT : ^ - MEM : = - GO : ^ - -Test Paste: - HA030=11^22^33^44^55^66^77^88^99^HA030= - Now press up-arrow to confirm the data has been entered. - - If you wish to follow the tutorial in the manual, here is the test - program that you need to enter in step 1: - H0020=8E^00^FF^4F^C6^04^CE^00^10^AB^00^08^5A^26^FA^97^15^3F^H - - Save the above program to tape: - HA002=00^20^00^32^HP (A002 has start address, A004 has end address, big endian) - -TODO - Display should go blank during cassette operations - - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "machine/6821pia.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "sound/wave.h" -#include "mekd2.lh" - -#define XTAL_MEKD2 1228800 - -class mekd2_state : public driver_device -{ -public: - enum - { - TIMER_TRACE - }; - - mekd2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pia_s(*this, "pia_s"), - m_pia_u(*this, "pia_u"), - m_acia(*this, "acia"), - m_cass(*this, "cassette") - { } - - DECLARE_READ_LINE_MEMBER(mekd2_key40_r); - DECLARE_READ8_MEMBER(mekd2_key_r); - DECLARE_WRITE_LINE_MEMBER(mekd2_nmi_w); - DECLARE_WRITE8_MEMBER(mekd2_digit_w); - DECLARE_WRITE8_MEMBER(mekd2_segment_w); - DECLARE_QUICKLOAD_LOAD_MEMBER(mekd2_quik); - DECLARE_WRITE_LINE_MEMBER(cass_w); - TIMER_DEVICE_CALLBACK_MEMBER(mekd2_c); - TIMER_DEVICE_CALLBACK_MEMBER(mekd2_p); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - UINT8 m_cass_data[4]; - UINT8 m_segment; - UINT8 m_digit; - UINT8 m_keydata; - bool m_cass_state; - bool m_cassold; - required_device m_maincpu; - required_device m_pia_s; - required_device m_pia_u; - required_device m_acia; - required_device m_cass; -}; - - - -/*********************************************************** - - Address Map - -************************************************************/ - -static ADDRESS_MAP_START( mekd2_mem , AS_PROGRAM, 8, mekd2_state) - AM_RANGE(0x0000, 0x00ff) AM_RAM // user ram - AM_RANGE(0x8004, 0x8007) AM_DEVREADWRITE("pia_u", pia6821_device, read, write) - AM_RANGE(0x8008, 0x8008) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) - AM_RANGE(0x8009, 0x8009) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) - AM_RANGE(0x8020, 0x8023) AM_DEVREADWRITE("pia_s", pia6821_device, read, write) - AM_RANGE(0xa000, 0xa07f) AM_RAM // system ram - AM_RANGE(0xe000, 0xe3ff) AM_ROM AM_MIRROR(0x1c00) /* JBUG ROM */ -ADDRESS_MAP_END - -/*********************************************************** - - Keys - -************************************************************/ - -static INPUT_PORTS_START( mekd2 ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E (hex)") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') // save tape - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') // load tape - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') // trace (step) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') // breakpoint - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('=') // memory - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E (escape)") PORT_CODE(KEYCODE_ESC) PORT_CHAR('H') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') // regs - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') // go, next -INPUT_PORTS_END - - -/*********************************************************** - - Trace hardware (what happens when N is pressed) - -************************************************************/ - -void mekd2_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_TRACE: - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - break; - default: - assert_always(FALSE, "Unknown id in mekd2_state::device_timer"); - } -} - - -WRITE_LINE_MEMBER( mekd2_state::mekd2_nmi_w ) -{ - if (state) - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - else - timer_set(attotime::from_usec(18), TIMER_TRACE); -} - - - -/*********************************************************** - - Keyboard - -************************************************************/ - -READ_LINE_MEMBER( mekd2_state::mekd2_key40_r ) -{ - return BIT(m_keydata, 6); -} - -READ8_MEMBER( mekd2_state::mekd2_key_r ) -{ - char kbdrow[4]; - UINT8 i; - m_keydata = 0xff; - - for (i = 0; i < 6; i++) - { - if (BIT(m_digit, i)) - { - sprintf(kbdrow,"X%d",i); - m_keydata &= ioport(kbdrow)->read(); - } - } - - i = 0x80; - if (m_digit < 0x40) - i = BIT(m_keydata, 0) ? 0x80 : 0; - else - if (m_digit < 0x80) - i = BIT(m_keydata, 1) ? 0x80 : 0; - else - if (m_digit < 0xc0) - i = BIT(m_keydata, 2) ? 0x80 : 0; - else - i = BIT(m_keydata, 3) ? 0x80 : 0; - - return i | m_segment; -} - - - -/*********************************************************** - - LED display - -************************************************************/ - -WRITE8_MEMBER( mekd2_state::mekd2_segment_w ) -{ - m_segment = data & 0x7f; -} - -WRITE8_MEMBER( mekd2_state::mekd2_digit_w ) -{ - UINT8 i; - if (data < 0x3f) - { - for (i = 0; i < 6; i++) - { - if (BIT(data, i)) - output_set_digit_value(i, ~m_segment & 0x7f); - } - } - m_digit = data; -} - - - -/*********************************************************** - - Interfaces - -************************************************************/ - -WRITE_LINE_MEMBER( mekd2_state::cass_w ) -{ - m_cass_state = state; -} - -QUICKLOAD_LOAD_MEMBER( mekd2_state, mekd2_quik ) -{ - static const char magic[] = "MEK6800D2"; - char buff[9]; - UINT16 addr, size; - UINT8 ident, *RAM = memregion("maincpu")->base(); - - image.fread(buff, sizeof (buff)); - if (memcmp(buff, magic, sizeof (buff))) - { - logerror("mekd2 rom load: magic '%s' not found\n", magic); - return IMAGE_INIT_FAIL; - } - image.fread(&addr, 2); - addr = LITTLE_ENDIANIZE_INT16(addr); - image.fread(&size, 2); - size = LITTLE_ENDIANIZE_INT16(size); - image.fread(&ident, 1); - logerror("mekd2 rom load: $%04X $%04X $%02X\n", addr, size, ident); - while (size-- > 0) - image.fread(&RAM[addr++], 1); - - return IMAGE_INIT_PASS; -} - -TIMER_DEVICE_CALLBACK_MEMBER(mekd2_state::mekd2_c) -{ - m_cass_data[3]++; - - if (m_cass_state != m_cassold) - { - m_cass_data[3] = 0; - m_cassold = m_cass_state; - } - - if (m_cass_state) - m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz - else - m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz -} - -TIMER_DEVICE_CALLBACK_MEMBER(mekd2_state::mekd2_p) -{ - /* cassette - turn 1200/2400Hz to a bit */ - m_cass_data[1]++; - UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0; - - if (cass_ws != m_cass_data[0]) - { - m_cass_data[0] = cass_ws; - m_acia->write_rxd((m_cass_data[1] < 12) ? 1 : 0); - m_cass_data[1] = 0; - } -} - -/*********************************************************** - - Machine - -************************************************************/ - -static MACHINE_CONFIG_START( mekd2, mekd2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6800, XTAL_MEKD2 / 2) /* 614.4 kHz */ - MCFG_CPU_PROGRAM_MAP(mekd2_mem) - - MCFG_DEFAULT_LAYOUT(layout_mekd2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD("cassette") - - /* Devices */ - MCFG_DEVICE_ADD("pia_s", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(mekd2_state, mekd2_key_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(mekd2_state, mekd2_key40_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(mekd2_state, mekd2_segment_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(mekd2_state, mekd2_digit_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(mekd2_state, mekd2_nmi_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, nmi_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, nmi_line)) - - MCFG_DEVICE_ADD("pia_u", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6800_cpu_device, irq_line)) - - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(mekd2_state, cass_w)) - - MCFG_DEVICE_ADD("acia_tx_clock", CLOCK, XTAL_MEKD2 / 256) // 4800Hz - MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("acia", acia6850_device, write_txc)) - - MCFG_DEVICE_ADD("acia_rx_clock", CLOCK, 300) // toggled by cassette circuit - MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxc)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("mekd2_c", mekd2_state, mekd2_c, attotime::from_hz(4800)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("mekd2_p", mekd2_state, mekd2_p, attotime::from_hz(40000)) - - MCFG_QUICKLOAD_ADD("quickload", mekd2_state, mekd2_quik, "d2", 1) -MACHINE_CONFIG_END - -/*********************************************************** - - ROMS - -************************************************************/ - -ROM_START(mekd2) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("jbug.rom", 0xe000, 0x0400, CRC(5ed08792) SHA1(b06e74652a4c4e67c4a12ddc191ffb8c07f3332e) ) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, mekd2, 0, 0, mekd2, mekd2, driver_device, 0, "Motorola", "MEK6800D2" , 0 ) diff --git a/src/mess/drivers/mephisto.c b/src/mess/drivers/mephisto.c deleted file mode 100644 index faf3cd69797..00000000000 --- a/src/mess/drivers/mephisto.c +++ /dev/null @@ -1,470 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Dirk Verwiebe, Cowering -/****************************************************************************** - Mephisto 4 + 5 Chess Computer - 2007 Dirk V. - -CPU 65C02 P4 -Clock 4.9152 MHz -NMI CLK 600 Hz -IRQ Line is set to VSS -8 KByte SRAM Sony CXK5864-15l - -1-CD74HC4060E 14 Bit Counter -1-CD74HC166E -1-CD74HC251E -1-SN74HC138N TI -1-SN74HC139N TI -1-74HC14AP Toshiba -1-74HC02AP Toshiba -1-74HC00AP Toshiba -1-CD74HC259E - - -$0000-$1fff S-RAM -$2000 LCD 4 Byte Shift Register writeonly right to left -every 2nd char xor'd by $FF - -2c00-2c07 Keyboard (8to1 Multiplexer) 74HCT251 -2*8 Matrix -Adr. 0x3407 -==0 !=0 -2c00 CL E5 -2c01 POS F6 -2c02 MEMO G7 -2c03 INFO A1 -2c04 LEV H8 -2c05 ENT B2 -2c06 >0 C3 -2c07 <9 D4 - -$3400-$3407 LED 1-6, Buzzer, Keyboard select - -$2400 // Chess Board -$2800 // Chess Board -$3000 // Chess Board - -$4000-7FFF Opening Modul HG550 -$8000-$FFF ROM - -Mephisto 4 Turbo Kit 18mhz - (mm4tk) - This is a replacement rom combining the turbo kit initial rom with the original MM IV. - The Turbo Kit powers up to it's tiny rom, copies itself to ram, banks in normal rom, - copies that to faster SRAM, then patches the checksum and the LED blink delays. - If someone else wants to code up the power up banking, feel free - - There is an undumped MM V Turbo Kit, which will be the exact same except for location of - the patches. The mm5tk just needs the normal mm5 ROM swapped out for that one to - blinks the LEDs a little slower. - - -- Cowering (2011) - -***********************************************************************************************/ - - -#include "emu.h" -#include "cpu/m6502/m65c02.h" -#include "sound/beep.h" -//#include "mephisto.lh" - -#include "includes/mboard.h" - - -class mephisto_state : public mboard_state -{ -public: - mephisto_state(const machine_config &mconfig, device_type type, const char *tag) - : mboard_state(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_beep(*this, "beeper") - , m_key1_0(*this, "KEY1_0") - , m_key1_1(*this, "KEY1_1") - , m_key1_2(*this, "KEY1_2") - , m_key1_3(*this, "KEY1_3") - , m_key1_4(*this, "KEY1_4") - , m_key1_5(*this, "KEY1_5") - , m_key1_6(*this, "KEY1_6") - , m_key1_7(*this, "KEY1_7") - , m_key2_0(*this, "KEY2_0") - , m_key2_1(*this, "KEY2_1") - , m_key2_2(*this, "KEY2_2") - , m_key2_3(*this, "KEY2_3") - , m_key2_4(*this, "KEY2_4") - , m_key2_5(*this, "KEY2_5") - , m_key2_6(*this, "KEY2_6") - , m_key2_7(*this, "KEY2_7") - { } - - required_device m_maincpu; - required_device m_beep; - DECLARE_WRITE8_MEMBER(write_lcd); - DECLARE_WRITE8_MEMBER(mephisto_NMI); - DECLARE_READ8_MEMBER(read_keys); - DECLARE_WRITE8_MEMBER(write_led); - DECLARE_WRITE8_MEMBER(write_led_mm2); - UINT8 m_lcd_shift_counter; - UINT8 m_led_status; - //UINT8 *m_p_ram; - UINT8 m_led7; - UINT8 m_allowNMI; - DECLARE_DRIVER_INIT(mephisto); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_MACHINE_START(mm2); - TIMER_DEVICE_CALLBACK_MEMBER(update_nmi); - TIMER_DEVICE_CALLBACK_MEMBER(update_nmi_r5); - TIMER_DEVICE_CALLBACK_MEMBER(update_irq); - -protected: - required_ioport m_key1_0; - required_ioport m_key1_1; - required_ioport m_key1_2; - required_ioport m_key1_3; - required_ioport m_key1_4; - required_ioport m_key1_5; - required_ioport m_key1_6; - required_ioport m_key1_7; - required_ioport m_key2_0; - required_ioport m_key2_1; - required_ioport m_key2_2; - required_ioport m_key2_3; - required_ioport m_key2_4; - required_ioport m_key2_5; - required_ioport m_key2_6; - required_ioport m_key2_7; -}; - - -WRITE8_MEMBER( mephisto_state::write_lcd ) -{ - if (m_led7 == 0) output_set_digit_value(m_lcd_shift_counter,data); // 0x109 MM IV // 0x040 MM V - - //output_set_digit_value(m_lcd_shift_counter,data ^ m_p_ram[0x165]); // 0x109 MM IV // 0x040 MM V - m_lcd_shift_counter--; - m_lcd_shift_counter &= 3; -} - -WRITE8_MEMBER( mephisto_state::mephisto_NMI ) -{ - m_allowNMI = 1; -} - -READ8_MEMBER( mephisto_state::read_keys ) -{ - UINT8 data = 0; - - if (((m_led_status & 0x80) == 0x00)) - { - switch ( offset ) - { - case 0: data = m_key1_0->read(); break; - case 1: data = m_key1_1->read(); break; - case 2: data = m_key1_2->read(); break; - case 3: data = m_key1_3->read(); break; - case 4: data = m_key1_4->read(); break; - case 5: data = m_key1_5->read(); break; - case 6: data = m_key1_6->read(); break; - case 7: data = m_key1_7->read(); break; - } - } - else - { - switch ( offset ) - { - case 0: data = m_key2_0->read(); break; - case 1: data = m_key2_1->read(); break; - case 2: data = m_key2_2->read(); break; - case 3: data = m_key2_3->read(); break; - case 4: data = m_key2_4->read(); break; - case 5: data = m_key2_5->read(); break; - case 6: data = m_key2_6->read(); break; - case 7: data = m_key2_7->read(); break; - } - } - - logerror("Keyboard Port = %d-%d Data = %d\n ", ((m_led_status & 0x80) == 0x00) ? 0 : 1, offset, data); - return data | 0x7f; -} - -WRITE8_MEMBER( mephisto_state::write_led ) -{ - UINT8 LED_offset=100; - data &= 0x80; - - if (data==0)m_led_status &= 255-(1<set_input_line(INPUT_LINE_NMI,PULSE_LINE); - } - m_beep->set_state(m_led_status&64?1:0); -} - -TIMER_DEVICE_CALLBACK_MEMBER(mephisto_state::update_nmi_r5) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); - m_beep->set_state(m_led_status&64?1:0); -} - -TIMER_DEVICE_CALLBACK_MEMBER(mephisto_state::update_irq)//only mm2 -{ - m_maincpu->set_input_line(M65C02_IRQ_LINE, HOLD_LINE); - - m_beep->set_state(m_led_status&64?1:0); -} - -void mephisto_state::machine_start() -{ - m_lcd_shift_counter = 3; - m_allowNMI = 1; - mboard_savestate_register(); -} - -MACHINE_START_MEMBER(mephisto_state,mm2) -{ - m_lcd_shift_counter = 3; - m_led7=0xff; - - mboard_savestate_register(); -} - - -void mephisto_state::machine_reset() -{ - m_lcd_shift_counter = 3; - m_allowNMI = 1; - mboard_set_border_pieces(); - mboard_set_board(); - -/* adjust artwork depending on current emulation*/ - - if (!strcmp(machine().system().name,"mm2") ) - output_set_value("MM",1); - else if (!strcmp(machine().system().name,"mm4") ) - output_set_value("MM",2); - else if (!strcmp(machine().system().name,"mm4tk") ) - output_set_value("MM",5); - else if (!strcmp(machine().system().name,"mm5tk") ) - output_set_value("MM",5); - else if (!strcmp(machine().system().name,"mm5") ) - output_set_value("MM",3); - else if (!strcmp(machine().system().name,"mm50") ) - output_set_value("MM",3); - else if (!strcmp(machine().system().name,"rebel5") ) - output_set_value("MM",4); -} - - -static MACHINE_CONFIG_START( mephisto, mephisto_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M65C02,4915200) /* 65C02 */ - MCFG_CPU_PROGRAM_MAP(mephisto_mem) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", mephisto_state, update_nmi, attotime::from_hz(600)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", mephisto_state, mboard_update_artwork, attotime::from_hz(100)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( rebel5, mephisto ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(rebel5_mem) - MCFG_DEVICE_REMOVE("nmi_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer_r5", mephisto_state, update_nmi_r5, attotime::from_hz(600)) - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mm2, mephisto ) - MCFG_CPU_REPLACE("maincpu", M65C02, 3700000) - MCFG_CPU_PROGRAM_MAP(mm2_mem) - MCFG_MACHINE_START_OVERRIDE(mephisto_state, mm2 ) - - MCFG_DEVICE_REMOVE("nmi_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", mephisto_state, update_irq, attotime::from_hz(450)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mm4tk, mephisto ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_REPLACE("maincpu", M65C02, 18000000) - MCFG_CPU_PROGRAM_MAP(mephisto_mem) -MACHINE_CONFIG_END - -ROM_START(rebel5) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("rebel5.rom", 0x8000, 0x8000, CRC(8d02e1ef) SHA1(9972c75936613bd68cfd3fe62bd222e90e8b1083)) -ROM_END - -ROM_START(mm2) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("mm2_1.bin", 0x8000, 0x4000, CRC(e2daac82) SHA1(c9fa59ca92362f8ee770733073bfa2ab8c7904ad)) - ROM_LOAD("mm2_2.bin", 0xc000, 0x4000, CRC(5e296939) SHA1(badd2a377259cf738cd076d8fb245c3dc284c24d)) -ROM_END - -ROM_START(mm4) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("mephisto4.rom", 0x8000, 0x8000, CRC(f68a4124) SHA1(d1d03a9aacc291d5cb720d2ee2a209eeba13a36c)) - ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) - ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" ) - ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(2)) -ROM_END - -ROM_START(mm4tk) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("mm4tk.rom", 0x8000, 0x8000, CRC(51cb36a4) SHA1(9e184b4e85bb721e794b88d8657ae8d2ff5a24af)) - ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) - ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" ) - ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(0)) -ROM_END - -ROM_START(mm5tk) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, BAD_DUMP CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048)) - ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) - ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) - ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(0)) -ROM_END - -ROM_START(mm5) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048)) - ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) - ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) - ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2)) -ROM_END - -ROM_START(mm50) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("mm50.rom", 0x8000, 0x8000, CRC(fcfa7e6e) SHA1(afeac3a8c957ba58cefaa27b11df974f6f2066da)) - ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" ) - ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" ) - ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2)) -ROM_END - - -DRIVER_INIT_MEMBER(mephisto_state,mephisto) -{ - m_lcd_shift_counter = 3; -} - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ - -CONS( 1984, mm2, mm4, 0, mm2, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto MM2 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1986, rebel5, mm4, 0, rebel5, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto Rebell 5,0 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1987, mm4, 0, 0, mephisto, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 4 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1987, mm4tk, mm4, 0, mm4tk, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 4 Schachcomputer Turbo Kit + HG440", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1990, mm5, mm4, 0, mephisto, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 5.1 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1990, mm50, mm4, 0, mephisto, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 5.0 Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1990, mm5tk, mm4, 0, mm4tk, mephisto, mephisto_state, mephisto, "Hegener & Glaser", "Mephisto 5.1 Schachcomputer Turbo Kit + HG550", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mess/drivers/mes.c b/src/mess/drivers/mes.c deleted file mode 100644 index 80e710ee471..00000000000 --- a/src/mess/drivers/mes.c +++ /dev/null @@ -1,141 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Schleicher MES - - 30/08/2010 Skeleton driver - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - - -class mes_state : public driver_device -{ -public: - mes_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_p_videoram(*this, "p_videoram"){ } - - required_device m_maincpu; - const UINT8 *m_p_chargen; - required_shared_ptr m_p_videoram; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - - - -static ADDRESS_MAP_START(mes_mem, AS_PROGRAM, 8, mes_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0xefff) AM_RAM - AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("p_videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mes_io, AS_IO, 8, mes_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mes ) -INPUT_PORTS_END - -void mes_state::machine_reset() -{ -} - -void mes_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -/* This system appears to have 2 screens. Not implemented. - Also the screen dimensions are a guess. */ -UINT32 mes_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - //static UINT8 framecnt=0; - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x,xx; - - //framecnt++; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - xx = ma; - for (x = ma; x < ma + 80; x++) - { - gfx = 0; - if (ra < 9) - { - chr = m_p_videoram[xx++]; - - // /* Take care of flashing characters */ - // if ((chr < 0x80) && (framecnt & 0x08)) - // chr |= 0x80; - - if (chr & 0x80) // ignore attribute bytes - x--; - else - gfx = m_p_chargen[(chr<<4) | ra ]; - } - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=80; - } - return 0; -} - -static MACHINE_CONFIG_START( mes, mes_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(mes_mem) - MCFG_CPU_IO_MAP(mes_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(mes_state, screen_update) - MCFG_SCREEN_SIZE(640, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( mes ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mescpu.bin", 0x0000, 0x1000, CRC(b6d90cf4) SHA1(19e608af5bdaabb00a134e1106b151b00e2a0b04)) - - ROM_REGION( 0x10000, "xebec", ROMREGION_ERASEFF ) - ROM_LOAD( "mesxebec.bin", 0x0000, 0x2000, CRC(061b7212) SHA1(c5d600116fb7563c69ebd909eb9613269b2ada0f)) - - /* character generator not dumped, using the one from 'c10' for now */ - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, mes, 0, 0, mes, mes, driver_device, 0, "Schleicher", "MES", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mice.c b/src/mess/drivers/mice.c deleted file mode 100644 index 3e5662dd50d..00000000000 --- a/src/mess/drivers/mice.c +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - -Microtek International Inc MICE - -2013-08-27 Skeleton driver. - -This is a CPU emulator for development work. - -Each CPU has a plugin card with various chips. The usual complement is - the selected CPU, a 8085, 8255/8251/8155/6116, eproms and crystals. - -The connection to the outside world is via RS232 to a terminal. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class mice_state : public driver_device -{ -public: - mice_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(port50_r); - DECLARE_READ8_MEMBER(port51_r); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_term_data; - virtual void machine_reset(); -}; - - -READ8_MEMBER( mice_state::port50_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( mice_state::port51_r ) -{ - return (m_term_data) ? 5 : 1; -} - -static ADDRESS_MAP_START(mice_mem, AS_PROGRAM, 8, mice_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x5fff ) AM_ROM AM_REGION("mice_6502", 0) - AM_RANGE( 0x6000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mice_io, AS_IO, 8, mice_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x50, 0x50) AM_READ(port50_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x51, 0x51) AM_READ(port51_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mice ) -INPUT_PORTS_END - - -void mice_state::machine_reset() -{ -} - -WRITE8_MEMBER( mice_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( mice, mice_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8085A, XTAL_6_144MHz) - MCFG_CPU_PROGRAM_MAP(mice_mem) - MCFG_CPU_IO_MAP(mice_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mice_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mice ) - ROM_REGION( 0x10000, "mice2_z80b", 0 ) - ROM_LOAD( "z80_u2_v.3.0", 0x4000, 0x2000, CRC(992b1b53) SHA1(f7b66c49ab26a9f97b2e6ebe45d162daa66d8a67) ) - ROM_LOAD( "z80_u3_v.3.0", 0x2000, 0x2000, CRC(48d0be9b) SHA1(602af21868b1b5e6d488706a831259d78fefad6f) ) - ROM_LOAD( "z80_u4_v.3.0", 0x0000, 0x2000, CRC(4fe2d08d) SHA1(902b98357b8f2e61f68dd171478368a3ac47af6e) ) - ROM_REGION( 0x10000, "mice2_6502", 0 ) - ROM_LOAD( "6502_u1_v.3.2", 0x6000, 0x2000, CRC(0ba10943) SHA1(e7590e2c1d9d2b1ff8cca0f5da366650ea4d50e3) ) - ROM_LOAD( "6502_u2_v.3.2", 0x4000, 0x2000, CRC(f3169423) SHA1(a588a2e1894f523cf11c34d036beadbfe5b10538) ) - ROM_LOAD( "6502_u3_v.3.2", 0x2000, 0x2000, CRC(d5c77c3f) SHA1(71439735ed62db07bee713775ee2189120d1a1e7) ) - ROM_LOAD( "6502_u4_v.3.2", 0x0000, 0x2000, CRC(6acfc3a1) SHA1(3572a4798873c21a247a43da8419e7b9a181c67d) ) - ROM_REGION( 0x10000, "mice2_8085", 0 ) - ROM_LOAD( "8085_u2_v.3.1", 0x4000, 0x2000, CRC(2fce00a5) SHA1(0611f928be663a9279781d9f496fc950fd4ee7e2) ) - ROM_LOAD( "8085_u3_v.3.1", 0x2000, 0x2000, CRC(16ee3018) SHA1(9e215504bcea2c5ebfb7578ecf371eec45cbe5d7) ) - ROM_LOAD( "8085_u4_v.3.1", 0x0000, 0x2000, CRC(5798f2b5) SHA1(e0fe9411394bded8a77bc6a0f71519aad7800125) ) - ROM_REGION( 0x10000, "mice2_6809", 0 ) - ROM_LOAD( "6809_u1_v.3.4", 0x0000, 0x8000, CRC(b94d043d) SHA1(822697485f064286155f2a66cdbdcb0bd66ddb8c) ) - ROM_REGION( 0x10000, "mice_6502", 0 ) - ROM_LOAD( "6502_u10_v.2.0", 0x2000, 0x1000, CRC(496c53a7) SHA1(f28cddef18ab3e0eca1fea125dd678a54817c9df) ) - ROM_LOAD( "6502_u11_v.2.0", 0x1000, 0x1000, CRC(8d655bd2) SHA1(94936553f1692ede0934e3c7b599f3ad6adb6aec) ) - ROM_LOAD( "6502_u12_v.2.0", 0x0000, 0x1000, CRC(cee810ee) SHA1(ab642cda73f4b3f715ddc2909ba2b48cbd474d4d) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, mice, 0, 0, mice, mice, driver_device, 0, "Microtek International Inc", "Mice", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/microdec.c b/src/mess/drivers/microdec.c deleted file mode 100644 index 8f2494087da..00000000000 --- a/src/mess/drivers/microdec.c +++ /dev/null @@ -1,142 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Morrow Designs Micro Decision - - 2009-12-10 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/upd765.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class microdec_state : public driver_device -{ -public: - microdec_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_terminal(*this, TERMINAL_TAG), - m_maincpu(*this, "maincpu") - { - } - - DECLARE_READ8_MEMBER(status_r); - DECLARE_READ8_MEMBER(keyin_r); - DECLARE_WRITE8_MEMBER(kbd_put); -private: - UINT8 m_term_data; - virtual void machine_reset(); - virtual void machine_start(); - required_device m_terminal; - required_device m_maincpu; -}; - - -READ8_MEMBER( microdec_state::status_r ) -{ - return (m_term_data) ? 3 : 1; -} - -READ8_MEMBER( microdec_state::keyin_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -static ADDRESS_MAP_START(microdec_mem, AS_PROGRAM, 8, microdec_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_ROM - AM_RANGE( 0x1000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(microdec_io, AS_IO, 8, microdec_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xfa, 0xfb) AM_DEVICE("upd765", upd765a_device, map) - AM_RANGE(0xfc, 0xfc) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0xfd, 0xfd) AM_READ(status_r) - // AM_RANGE(0xf0, 0xf3) 8253 PIT (md3 only) used as a baud rate generator for serial ports - // AM_RANGE(0xf4, 0xf4) Centronics data - // AM_RANGE(0xf5, 0xf5) motor check (md1/2) - // AM_RANGE(0xf5, 0xf5) Centronics status (md3) read bit 3 (ack=1); read bit 4 (busy=1); write bit 7 (stb=0) - // AM_RANGE(0xf6, 0xf6) rom enable (w=enable; r=disable) - // AM_RANGE(0xf7, 0xf7) VFO Count set - // AM_RANGE(0xf8, 0xf8) Motor and SHift control - // AM_RANGE(0xfa, 0xfb) uPD765C fdc FA=status; FB=data - // AM_RANGE(0xfc, 0xfd) Serial Port 1 FC=data FD=status - // AM_RANGE(0xfe, 0xff) Serial Port 2 FE=data FF=status -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( microdec ) -INPUT_PORTS_END - -void microdec_state::machine_start() -{ -} - -void microdec_state::machine_reset() -{ - m_term_data = 0; -} - -WRITE8_MEMBER( microdec_state::kbd_put ) -{ - m_term_data = data; -} - -static SLOT_INTERFACE_START( microdec_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( microdec, microdec_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(microdec_mem) - MCFG_CPU_IO_MAP(microdec_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(microdec_state, kbd_put)) - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", microdec_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", microdec_floppies, "525hd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( md2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v13", "v1.3" ) - ROMX_LOAD( "md2-13.bin", 0x0000, 0x0800, CRC(43f4c9ab) SHA1(48a35cbee4f341310e9cba5178c3fd6e74ef9748), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v13a", "v1.3a" ) - ROMX_LOAD( "md2-13a.bin", 0x0000, 0x0800, CRC(d7fcddfd) SHA1(cae29232b737ebb36a27b8ad17bc69e9968f1309), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v13b", "v1.3b" ) - ROMX_LOAD( "md2-13b.bin", 0x0000, 0x1000, CRC(a8b96835) SHA1(c6b111939aa7e725da507da1915604656540b24e), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "v20", "v2.0" ) - ROMX_LOAD( "md2-20.bin", 0x0000, 0x1000, CRC(a604735c) SHA1(db6e6e82a803f5cbf4f628f5778a93ae3e211fe1), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "v23", "v2.3" ) - ROMX_LOAD( "md2-23.bin", 0x0000, 0x1000, CRC(49bae273) SHA1(00381a226fe250aa3636b0b740df0af63efb0d18), ROM_BIOS(5)) -ROM_END - -ROM_START( md3 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v23a", "v2.3a" ) - ROMX_LOAD( "md3-23a.bin", 0x0000, 0x1000, CRC(95d59980) SHA1(ae65a8e8e2823cf4cf6b1d74c0996248e290e9f1), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v25", "v2.5" ) - ROMX_LOAD( "md3-25.bin", 0x0000, 0x1000, CRC(14f86bc5) SHA1(82fe022c85f678744bb0340ca3f88b18901fdfcb), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v31", "v3.1" ) - ROMX_LOAD( "md3-31.bin", 0x0000, 0x1000, CRC(bd4014f6) SHA1(5b33220af34c64676756177db4915f97840b2996), ROM_BIOS(3)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, md2, 0, 0, microdec, microdec, driver_device, 0, "Morrow Designs", "Micro Decision MD-2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1982, md3, md2, 0, microdec, microdec, driver_device, 0, "Morrow Designs", "Micro Decision MD-3", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/microkit.c b/src/mess/drivers/microkit.c deleted file mode 100644 index 9082931f21f..00000000000 --- a/src/mess/drivers/microkit.c +++ /dev/null @@ -1,46 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - RCA COSMAC Microkit - - http://www.vintagecomputer.net/browse_thread.cfm?id=511 - -*/ - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" - -class microkit_state : public driver_device -{ -public: - microkit_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - { } -}; - -static ADDRESS_MAP_START( microkit_mem, AS_PROGRAM, 8, microkit_state ) - AM_RANGE(0x0000, 0x01ff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( microkit_io, AS_IO, 8, microkit_state ) -ADDRESS_MAP_END - -static INPUT_PORTS_START( microkit ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( microkit, microkit_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", CDP1801, 2000000) - MCFG_CPU_PROGRAM_MAP(microkit_mem) - MCFG_CPU_IO_MAP(microkit_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) -MACHINE_CONFIG_END - -ROM_START( microkit ) - ROM_REGION( 0x200, "maincpu", ROMREGION_INVERT ) - ROM_LOAD( "3.2b", 0x000, 0x100, CRC(6799357e) SHA1(c46e3322b8b1b6534a7da04806be29fa265951b7) ) - ROM_LOAD( "4.2a", 0x100, 0x100, CRC(27267bad) SHA1(838df9be2dc175584a1a6ee1770039118e49482e) ) -ROM_END - -COMP( 1975, microkit, 0, 0, microkit, microkit, driver_device, 0, "RCA", "COSMAC Microkit", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/micronic.c b/src/mess/drivers/micronic.c deleted file mode 100644 index 90a898854ef..00000000000 --- a/src/mess/drivers/micronic.c +++ /dev/null @@ -1,399 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Micronics 1000 - - 06/2010 (Sandro Ronco) - - ROM/RAM banking - - keypad input - - Periodic IRQ (RTC-146818) - - NVRAM - - TODO: - - IR I/O port - - LCD contrast and backlight - - NOTE: - The display shows "TESTING..." for about 2 min before showing the information screen - - More info: - http://www.philpem.me.uk/elec/micronic/ - http://members.lycos.co.uk/leeedavison/z80/micronic/index.html - http://reocities.com/SiliconValley/Port/8052/ - -****************************************************************************/ - -/* - - KBD_R: EQU 00h ; key matrix read port - KBD_W: EQU 02h ; key matrix write port - LCD_D: EQU 03h ; LCD data port - Port_04: EQU 04h ; IRQ hardware mask - ; .... ...0 = keyboard interrupt enable - ; .... ..0. = RTC interrupt enable - ; .... .0.. = IR port interrupt enable - ; .... 0... = main battery interrupt enable - ; ...0 .... = backup battery interrupt enable - Port_05: EQU 05h ; interrupt flag byte - ; .... ...1 = keyboard interrupt - ; .... ..1. = RTC interrupt - ; .... .1.. = IR port interrupt ?? - ; .... 1... = main battery interrupt - ; ...1 .... = backup battery interrupt - Port_07: EQU 07h ; - ; .... ...x - ; .... ..x. - RTC_A: EQU 08h ; RTC address port - LCD_C: EQU 23h ; LCD command port - RTC_D: EQU 28h ; RTC data port - Port_2A: EQU 2Ah ; - ; .... ...x - ; .... ..x. - ; ...x .... - ; ..x. .... - Port_2B: EQU 2Bh ; .... xxxx = beep tone - ; .... 0000 = off - ; .... 0001 = 0.25mS = 4.000kHz - ; .... 0010 = 0.50mS = 2.000kHz - ; .... 0011 = 0.75mS = 1.333kHz - ; .... 0100 = 1.00mS = 1.000kHz - ; .... 0101 = 1.25mS = 0.800kHz - ; .... 0110 = 1.50mS = 0.667kHz - ; .... 0111 = 1.75mS = 0.571kHz - ; .... 1000 = 2.00mS = 0.500kHz - ; .... 1001 = 2.25mS = 0.444kHz - ; .... 1010 = 2.50mS = 0.400kHz - ; .... 1011 = 2.75mS = 0.364kHz - ; .... 1100 = 3.00mS = 0.333kHz - ; .... 1101 = 3.25mS = 0.308kHz - ; .... 1110 = 3.50mS = 0.286kHz - ; .... 1111 = 3.75mS = 0.267kHz - Port_2C: EQU 2Ch ; - ; .... ...x V24_ADAPTER IR port clock - ; .... ..x. V24_ADAPTER IR port data - ; ...1 .... = backlight on - ; ..xx ..xx - Port_2D: EQU 2Dh ; - ; .... ...x - ; .... ..x. - Port_33: EQU 33h ; - Port_46: EQU 46h ; LCD contrast port - MEM_P: EQU 47h ; memory page - Port_48: EQU 48h ; - ; .... ...x - ; .... ..x. - Port_49: EQU 49h ; - ; .... ...x - ; .... ..x. - Port_4A: EQU 4Ah ; end IR port output - ; .... ...x - ; .... ..x. - ; ...x .... - ; ..x. .... - ; .x.. .... - ; x... .... - Port_4B: EQU 4Bh ; IR port status byte - ; .... ...1 RX buffer full - ; ...x .... - ; .x.. .... - ; 1... .... TX buffer empty - Port_4C: EQU 4Ch ; - ; .... ...x - ; x... .... - Port_4D: EQU 4Dh ; IR transmit byte - Port_4E: EQU 4Eh ; IR receive byte - Port_4F: EQU 4Fh ; - ; .... ...x - ; .... ..x. - ; .... .x.. - ; .... x... - ; ...x .... - -*/ - - -#include "emu.h" -#include "includes/micronic.h" -#include "rendlay.h" - -READ8_MEMBER( micronic_state::keypad_r ) -{ - UINT8 data = 0; - - for (UINT8 bit = 0; bit < 8; bit++) - { - if (m_kp_matrix & (1 << bit)) - { - data |= m_bit0->read() & (0x01 << bit) ? 0x01 : 0x00; - data |= m_bit1->read() & (0x01 << bit) ? 0x02 : 0x00; - data |= m_bit2->read() & (0x01 << bit) ? 0x04 : 0x00; - data |= m_bit3->read() & (0x01 << bit) ? 0x08 : 0x00; - data |= m_bit4->read() & (0x01 << bit) ? 0x10 : 0x00; - data |= m_bit5->read() & (0x01 << bit) ? 0x20 : 0x00; - } - } - return data; -} - -READ8_MEMBER( micronic_state::status_flag_r ) -{ - return m_status_flag; -} - -WRITE8_MEMBER( micronic_state::status_flag_w ) -{ - m_status_flag = data; -} - -WRITE8_MEMBER( micronic_state::kp_matrix_w ) -{ - m_kp_matrix = data; -} - -WRITE8_MEMBER( micronic_state::beep_w ) -{ - UINT16 frequency[16] = - { - 0, 4000, 2000, 1333, 1000, 800, 667, 571, - 500, 444, 400, 364, 333, 308, 286, 267 - }; - - m_beep->set_frequency(frequency[data & 0x0f]); - m_beep->set_state((data & 0x0f) ? 1 : 0); -} - -READ8_MEMBER( micronic_state::irq_flag_r ) -{ - return (m_backbattery->read()<<4) | (m_mainbattery->read()<<3) | (keypad_r(space, offset) ? 0 : 1); -} - -WRITE8_MEMBER( micronic_state::bank_select_w ) -{ - if (data < 2) - { - m_bank1->set_entry(data); - m_maincpu->space(AS_PROGRAM).unmap_write(0x0000, 0x7fff); - } - else - { - m_bank1->set_entry((data <= m_banks_num) ? data : m_banks_num); - m_maincpu->space(AS_PROGRAM).install_write_bank(0x0000, 0x7fff, "bank1"); - } -} - -WRITE8_MEMBER( micronic_state::lcd_contrast_w ) -{ - m_lcd_contrast = data; -} - -WRITE8_MEMBER( micronic_state::port_2c_w ) -{ - m_lcd_backlight = BIT(data, 4); -} - - -/*************************************************************************** - RTC-146818 -***************************************************************************/ - -WRITE8_MEMBER( micronic_state::rtc_address_w ) -{ - m_rtc->write(space, 0, data); -} - -READ8_MEMBER( micronic_state::rtc_data_r ) -{ - return m_rtc->read(space, 1); -} - -WRITE8_MEMBER( micronic_state::rtc_data_w ) -{ - m_rtc->write(space, 1, data); -} - -/*************************************************************************** - Machine -***************************************************************************/ - -static ADDRESS_MAP_START(micronic_mem, AS_PROGRAM, 8, micronic_state) - AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram_base") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(micronic_io, AS_IO, 8, micronic_state) - ADDRESS_MAP_GLOBAL_MASK (0xff) - - /* keypad */ - AM_RANGE(0x00, 0x00) AM_READ(keypad_r) - AM_RANGE(0x02, 0x02) AM_WRITE(kp_matrix_w) - - /* hd61830 */ - AM_RANGE(0x03, 0x03) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, data_r, data_w) - AM_RANGE(0x23, 0x23) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, status_r, control_w) - - /* rtc-146818 */ - AM_RANGE(0x08, 0x08) AM_WRITE(rtc_address_w) - AM_RANGE(0x28, 0x28) AM_READWRITE(rtc_data_r, rtc_data_w) - - /* sound */ - AM_RANGE(0x2b, 0x2b) AM_WRITE(beep_w) - - /* basic machine */ - AM_RANGE(0x05, 0x05) AM_READ(irq_flag_r) - AM_RANGE(0x2c, 0x2c) AM_WRITE(port_2c_w) - AM_RANGE(0x47, 0x47) AM_WRITE(bank_select_w) - AM_RANGE(0x46, 0x46) AM_WRITE(lcd_contrast_w) - AM_RANGE(0x48, 0x48) AM_WRITE(status_flag_w) - AM_RANGE(0x49, 0x49) AM_READ(status_flag_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( micronic ) - PORT_START("MAINBATTERY") - PORT_CONFNAME( 0x01, 0x01, "Main Battery Status" ) - PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x00, "Low Battery" ) - PORT_START("BACKBATTERY") - PORT_CONFNAME( 0x01, 0x01, "Backup Battery Status" ) - PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x00, "Low Battery" ) - - PORT_START("BIT0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MODE") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A (") PORT_CODE(KEYCODE_A) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B )") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("U 1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) - PORT_START("BIT1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D DEL") PORT_CODE(KEYCODE_D) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F &") PORT_CODE(KEYCODE_F) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("V 2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("SPACE 0") PORT_CODE(KEYCODE_0) - PORT_START("BIT2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G +") PORT_CODE(KEYCODE_G) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H /") PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("I ,") PORT_CODE(KEYCODE_I) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("J ?") PORT_CODE(KEYCODE_J) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("W 3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("NO") PORT_CODE(KEYCODE_PGUP) - PORT_START("BIT3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K -") PORT_CODE(KEYCODE_K) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L *") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("M .") PORT_CODE(KEYCODE_M) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("N Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("YES") PORT_CODE(KEYCODE_PGDN) - PORT_START("BIT4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("O 7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P 8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Q 9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("DEPT") PORT_CODE(KEYCODE_R) - PORT_START("BIT5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R 4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("S 5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T 6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("END") PORT_CODE(KEYCODE_END) -INPUT_PORTS_END - - -void micronic_state::nvram_init(nvram_device &nvram, void *data, size_t size) -{ - m_status_flag = 0; -} - - -PALETTE_INIT_MEMBER(micronic_state, micronic) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -void micronic_state::machine_start() -{ - /* ROM banks */ - m_bank1->configure_entries(0x00, 0x02, memregion(Z80_TAG)->base(), 0x10000); - - /* RAM banks */ - m_banks_num = (m_ram->size() >> 15) + 1; - m_bank1->configure_entries(0x02, m_banks_num - 1, m_ram->pointer(), 0x8000); - - m_nvram1->set_base(m_ram_base, 0x8000); - m_nvram2->set_base(m_ram->pointer(), m_ram->size()); - - /* register for state saving */ - save_item(NAME(m_banks_num)); - save_item(NAME(m_kp_matrix)); - save_item(NAME(m_lcd_contrast)); - save_item(NAME(m_lcd_backlight)); - save_item(NAME(m_status_flag)); - // TODO: restore RAM bank at state load... -} - -void micronic_state::machine_reset() -{ - m_bank1->set_entry(0); - m_maincpu->space(AS_PROGRAM).unmap_write(0x0000, 0x7fff); -} - - -WRITE_LINE_MEMBER( micronic_state::mc146818_irq ) -{ - m_maincpu->set_input_line(0, !state ? HOLD_LINE : CLEAR_LINE); -} - - -static MACHINE_CONFIG_START( micronic, micronic_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_3_579545MHz) - MCFG_CPU_PROGRAM_MAP(micronic_mem) - MCFG_CPU_IO_MAP(micronic_io) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(80) - MCFG_SCREEN_UPDATE_DEVICE(HD61830_TAG, hd61830_device, screen_update) - MCFG_SCREEN_SIZE(120, 64) //6x20, 8x8 - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 64-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(micronic_state, micronic) - - MCFG_DEVICE_ADD(HD61830_TAG, HD61830, XTAL_4_9152MHz/2/2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - /* ram banks */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("224K") - - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram1", micronic_state, nvram_init) // base ram - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram2", micronic_state, nvram_init) // additional ram banks - - MCFG_MC146818_ADD( MC146818_TAG, XTAL_32_768kHz ) - MCFG_MC146818_IRQ_HANDLER(WRITELINE(micronic_state, mc146818_irq)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( micronic ) - ROM_REGION( 0x18000, Z80_TAG, 0 ) - ROM_SYSTEM_BIOS(0, "v228", "Micronic 1000") - ROMX_LOAD( "micron1.bin", 0x0000, 0x8000, CRC(5632c8b7) SHA1(d1c9cf691848e9125f9ea352e4ffa41c288f3e29), ROM_BIOS(1)) - ROMX_LOAD( "micron2.bin", 0x10000, 0x8000, CRC(dc8e7341) SHA1(927dddb3914a50bb051256d126a047a29eff7c65), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "test", "Micronic 1000 LCD monitor") - ROMX_LOAD( "monitor2.bin", 0x0000, 0x8000, CRC(c6ae2bbf) SHA1(1f2e3a3d4720a8e1bb38b37f4ab9e0e32676d030), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, micronic, 0, 0, micronic, micronic, driver_device, 0, "Victor Micronic", "Micronic 1000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/microtan.c b/src/mess/drivers/microtan.c deleted file mode 100644 index 5503e3285e8..00000000000 --- a/src/mess/drivers/microtan.c +++ /dev/null @@ -1,288 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/****************************************************************************** - * Microtan 65 - * - * system driver - * - * Juergen Buchmueller , Jul 2000 - * - * Thanks go to Geoff Macdonald - * for his site http:://www.geo255.redhotant.com - * and to Fabrice Frances - * for his site http://www.ifrance.com/oric/microtan.html - * - * Microtan65 memory map - * - * range short description - * 0000-01FF SYSRAM system ram - * 0000-003f variables - * 0040-00ff basic - * 0100-01ff stack - * 0200-03ff VIDEORAM display - * 0400-afff RAM main memory - * bc00-bc01 AY8912-0 sound chip #0 - * bc02-bc03 AY8912-1 sound chip #1 - * bc04 SPACEINV space invasion sound (?) - * bfc0-bfcf VIA6522-0 VIA 6522 #0 - * bfd0-bfd3 SIO serial i/o - * bfe0-bfef VIA6522-1 VIA 6522 #0 - * bff0 GFX_KBD R: chunky graphics on W: reset KBD interrupt - * bff1 NMI W: start delayed NMI - * bff2 HEX W: hex. keypad column - * bff3 KBD_GFX R: ASCII KBD / hex. keypad row W: chunky graphics off - * c000-e7ff BASIC BASIC Interpreter ROM - * f000-f7ff XBUG XBUG ROM - * f800-ffff TANBUG TANBUG ROM - * - *****************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "includes/microtan.h" - -/* Components */ -#include "sound/ay8910.h" -#include "sound/dac.h" -#include "sound/wave.h" -#include "machine/6522via.h" -#include "machine/mos6551.h" - -/* Devices */ -#include "imagedev/cassette.h" - - -static ADDRESS_MAP_START( microtan_map, AS_PROGRAM, 8, microtan_state ) - AM_RANGE(0x0000, 0x01ff) AM_RAM - AM_RANGE(0x0200, 0x03ff) AM_RAM_WRITE(microtan_videoram_w) AM_SHARE("videoram") - AM_RANGE(0xbc00, 0xbc00) AM_DEVWRITE("ay8910.1", ay8910_device, address_w) - AM_RANGE(0xbc01, 0xbc01) AM_DEVREADWRITE("ay8910.1", ay8910_device, data_r, data_w) - AM_RANGE(0xbc02, 0xbc02) AM_DEVWRITE("ay8910.2", ay8910_device, address_w) - AM_RANGE(0xbc03, 0xbc03) AM_DEVREADWRITE("ay8910.2", ay8910_device, data_r, data_w) - AM_RANGE(0xbfc0, 0xbfcf) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) - AM_RANGE(0xbfd0, 0xbfd3) AM_DEVREADWRITE("acia", mos6551_device, read, write) - AM_RANGE(0xbfe0, 0xbfef) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) - AM_RANGE(0xbff0, 0xbfff) AM_READWRITE(microtan_bffx_r, microtan_bffx_w) - AM_RANGE(0xc000, 0xe7ff) AM_ROM - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static INPUT_PORTS_START( microtan ) - PORT_START("DSW") - PORT_DIPNAME( 0x03, 0x00, "Memory size" ) - PORT_DIPSETTING( 0x00, "1K" ) - PORT_DIPSETTING( 0x01, "1K + 7K TANEX" ) - PORT_DIPSETTING( 0x02, "1K + 7K TANEX + 40K TANRAM" ) - PORT_BIT( 0xfc, 0xfc, IPT_UNUSED ) - - PORT_START("ROW0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) - - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - - PORT_START("ROW3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - - PORT_START("ROW4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - - PORT_START("ROW5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (L)") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - - PORT_START("ROW6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (R)") PORT_CODE(KEYCODE_RSHIFT) - - PORT_START("ROW7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LINE FEED") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER (KP)") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". (KP)") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 (KP)") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 (KP)") PORT_CODE(KEYCODE_1_PAD) - - PORT_START("ROW8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 (KP)") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 (KP)") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 (KP)") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 (KP)") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 (KP)") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 (KP)") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD) - - PORT_START("JOY") // VIA #1 PORT A - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY -INPUT_PORTS_END - -static const gfx_layout char_layout = -{ - 8, 16, /* 8 x 16 graphics */ - 128, /* 128 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, - 8 * 16 /* code takes 8 times 16 bits */ -}; - -static const gfx_layout chunky_layout = -{ - 8, 16, /* 8 x 16 graphics */ - 256, /* 256 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, - 8 * 16 /* code takes 8 times 16 bits */ -}; - -static GFXDECODE_START( microtan ) - GFXDECODE_ENTRY( "gfx1", 0, char_layout, 0, 1 ) - GFXDECODE_ENTRY( "gfx2", 0, chunky_layout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( microtan, microtan_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 750000) // 750 kHz - MCFG_CPU_PROGRAM_MAP(microtan_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", microtan_state, microtan_interrupt) - - - /* video hardware - include overscan */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(32*8, 16*16) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*16, 16*16-1) - MCFG_SCREEN_UPDATE_DRIVER(microtan_state, screen_update_microtan) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", microtan) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8910.1", AY8910, 1000000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("ay8910.2", AY8910, 1000000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* snapshot/quickload */ - MCFG_SNAPSHOT_ADD("snapshot", microtan_state, microtan, "m65", 0.5) - MCFG_QUICKLOAD_ADD("quickload", microtan_state, microtan, "hex", 0.5) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - - /* acia */ - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - - /* via */ - MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) - MCFG_VIA6522_READPA_HANDLER(READ8(microtan_state, via_0_in_a)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(microtan_state, via_0_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(microtan_state, via_0_out_b)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(microtan_state, via_0_out_ca2)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(microtan_state, via_0_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(microtan_state, via_0_irq)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 0) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(microtan_state, via_1_out_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(microtan_state, via_1_out_b)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(microtan_state, via_1_out_ca2)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(microtan_state, via_1_out_cb2)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(microtan_state, via_1_irq)) -MACHINE_CONFIG_END - -ROM_START( microtan ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "tanex_j2.rom", 0xc000, 0x1000, CRC(3e09d384) SHA1(15a98941a672ff16242cc73f1dcf1d81fccd8910) ) - ROM_LOAD( "tanex_h2.rom", 0xd000, 0x1000, CRC(75105113) SHA1(c6fea4d65b7c52f43aa1589cace9467349a0f290) ) - ROM_LOAD( "tanex_d3.rom", 0xe000, 0x0800, CRC(ee6e8412) SHA1(7e1bca84bab79d94a4ab8554d23e2bc28ccd0384) ) - ROM_LOAD( "tanex_e2.rom", 0xe800, 0x0800, CRC(bd87fd34) SHA1(f41895df4a733dddfaf1c89ecff5040addcab804) ) - ROM_LOAD( "tanex_g2.rom", 0xf000, 0x0800, CRC(9fd233ee) SHA1(7b0be2d0402229ec80b062f7a0bed793686bcbf9) ) - ROM_LOAD( "tanbug_2.rom", 0xf800, 0x0400, CRC(7e215313) SHA1(c8fb3d33ce2beaf624dc75ec57d34c216b086274) ) - ROM_LOAD( "tanbug.rom", 0xfc00, 0x0400, CRC(c8221d9e) SHA1(c7fe4c174523aaaab30be7a8c9baf2bc08b33968) ) - - ROM_REGION( 0x00800, "gfx1", 0 ) - ROM_LOAD( "charset.rom", 0x0000, 0x0800, CRC(3b3c5360) SHA1(a3a2f74149107f8b8f35b15069c71f3aa843d12f) ) - - ROM_REGION( 0x01000, "gfx2", ROMREGION_ERASEFF ) - // initialized in init_microtan -ROM_END - - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME -COMP( 1979, microtan, 0, 0, microtan, microtan, microtan_state, microtan, "Tangerine", "Microtan 65" , 0) diff --git a/src/mess/drivers/microvsn.c b/src/mess/drivers/microvsn.c deleted file mode 100644 index e322bf47615..00000000000 --- a/src/mess/drivers/microvsn.c +++ /dev/null @@ -1,707 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - Milton Bradley MicroVision - - To Do: - * Add support for the paddle control - * Finish support for i8021 based cartridges - -Since the microcontrollers were on the cartridges it was possible to have -different clocks on different games. -The Connect Four I8021 game is clocked at around 2MHz. The TMS1100 versions -of the games were clocked at around 500KHz, 550KHz, or 300KHz. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "cpu/tms0980/tms0980.h" -#include "sound/dac.h" -#include "rendlay.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -#define LOG 0 - - -class microvision_state : public driver_device -{ -public: - microvision_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_dac( *this, "dac" ), - m_i8021( *this, "maincpu1" ), - m_tms1100( *this, "maincpu2" ), - m_cart(*this, "cartslot") - { } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_PALETTE_INIT(microvision); - DECLARE_MACHINE_START(microvision); - DECLARE_MACHINE_RESET(microvision); - - void screen_vblank(screen_device &screen, bool state); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( microvsn_cart ); - - // i8021 interface - DECLARE_WRITE8_MEMBER(i8021_p0_write); - DECLARE_WRITE8_MEMBER(i8021_p1_write); - DECLARE_WRITE8_MEMBER(i8021_p2_write); - DECLARE_READ8_MEMBER(i8021_t1_read); - DECLARE_READ8_MEMBER(i8021_bus_read); - - // TMS1100 interface - DECLARE_READ8_MEMBER(tms1100_read_k); - DECLARE_WRITE16_MEMBER(tms1100_write_o); - DECLARE_WRITE16_MEMBER(tms1100_write_r); - - // enums - enum cpu_type - { - CPU_TYPE_I8021, - CPU_TYPE_TMS1100 - }; - - enum pcb_type - { - PCB_TYPE_4952_REV_A, - PCB_TYPE_4952_9_REV_B, - PCB_TYPE_4971_REV_C, - PCB_TYPE_7924952D02, - PCB_TYPE_UNKNOWN - }; - - enum rc_type - { - RC_TYPE_100PF_21_0K, - RC_TYPE_100PF_23_2K, - RC_TYPE_100PF_39_4K, - RC_TYPE_UNKNOWN - }; - - cpu_type m_cpu_type; - pcb_type m_pcb_type; - rc_type m_rc_type; - -protected: - required_device m_dac; - required_device m_i8021; - required_device m_tms1100; - required_device m_cart; - - // Timers - static const device_timer_id TIMER_PADDLE = 0; - emu_timer *m_paddle_timer; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // i8021 variables - UINT8 m_p0; - UINT8 m_p2; - UINT8 m_t1; - - // tms1100 variables - UINT16 m_r; - UINT16 m_o; - - // generic variables - void update_lcd(); - void lcd_write(UINT8 control, UINT8 data); - void speaker_write(UINT8 speaker); - bool m_pla; - - UINT8 m_lcd_latch[8]; - UINT8 m_lcd_holding_latch[8]; - UINT8 m_lcd_latch_index; - UINT8 m_lcd[16][16]; - UINT8 m_lcd_control_old; -}; - - -PALETTE_INIT_MEMBER(microvision_state,microvision) -{ - palette.set_pen_color( 15, 0x00, 0x00, 0x00 ); - palette.set_pen_color( 14, 0x11, 0x11, 0x11 ); - palette.set_pen_color( 13, 0x22, 0x22, 0x22 ); - palette.set_pen_color( 12, 0x33, 0x33, 0x33 ); - palette.set_pen_color( 11, 0x44, 0x44, 0x44 ); - palette.set_pen_color( 10, 0x55, 0x55, 0x55 ); - palette.set_pen_color( 9, 0x66, 0x66, 0x66 ); - palette.set_pen_color( 8, 0x77, 0x77, 0x77 ); - palette.set_pen_color( 7, 0x88, 0x88, 0x88 ); - palette.set_pen_color( 6, 0x99, 0x99, 0x99 ); - palette.set_pen_color( 5, 0xaa, 0xaa, 0xaa ); - palette.set_pen_color( 4, 0xbb, 0xbb, 0xbb ); - palette.set_pen_color( 3, 0xcc, 0xcc, 0xcc ); - palette.set_pen_color( 2, 0xdd, 0xdd, 0xdd ); - palette.set_pen_color( 1, 0xee, 0xee, 0xee ); - palette.set_pen_color( 0, 0xff, 0xff, 0xff ); -} - - -MACHINE_START_MEMBER(microvision_state, microvision) -{ - m_paddle_timer = timer_alloc(TIMER_PADDLE); - - save_item(NAME(m_p0)); - save_item(NAME(m_p2)); - save_item(NAME(m_t1)); - save_item(NAME(m_r)); - save_item(NAME(m_o)); - save_item(NAME(m_lcd_latch)); - save_item(NAME(m_lcd_latch_index)); - save_item(NAME(m_lcd)); - save_item(NAME(m_lcd_control_old)); - save_item(NAME(m_pla)); - save_item(NAME(m_lcd_holding_latch)); -} - - -MACHINE_RESET_MEMBER(microvision_state, microvision) -{ - for( int i = 0; i < 8; i++ ) - { - m_lcd_latch[i] = 0; - } - - for( int i = 0; i < 16; i++ ) - { - for ( int j = 0; j < 16; j++ ) - { - m_lcd[i][j] = 0; - } - } - - m_o = 0; - m_r = 0; - m_p0 = 0; - m_p2 = 0; - m_t1 = 0; - - m_paddle_timer->adjust( attotime::never ); - - switch ( m_cpu_type ) - { - case CPU_TYPE_I8021: - m_i8021->resume( SUSPEND_REASON_DISABLE ); - m_tms1100->suspend( SUSPEND_REASON_DISABLE, 0 ); - break; - - case CPU_TYPE_TMS1100: - m_i8021->suspend( SUSPEND_REASON_DISABLE, 0 ); - m_tms1100->resume( SUSPEND_REASON_DISABLE ); - - switch ( m_rc_type ) - { - case RC_TYPE_100PF_21_0K: - static_set_clock( m_tms1100, 550000 ); - break; - - case RC_TYPE_100PF_23_2K: - case RC_TYPE_UNKNOWN: // Default to most occurring setting - static_set_clock( m_tms1100, 500000 ); - break; - - case RC_TYPE_100PF_39_4K: - static_set_clock( m_tms1100, 300000 ); - break; - } - break; - } -} - - -void microvision_state::update_lcd() -{ - UINT16 row = ( m_lcd_holding_latch[0] << 12 ) | ( m_lcd_holding_latch[1] << 8 ) | ( m_lcd_holding_latch[2] << 4 ) | m_lcd_holding_latch[3]; - UINT16 col = ( m_lcd_holding_latch[4] << 12 ) | ( m_lcd_holding_latch[5] << 8 ) | ( m_lcd_holding_latch[6] << 4 ) | m_lcd_holding_latch[7]; - - if (LOG) logerror("row = %04x, col = %04x\n", row, col ); - for ( int i = 0; i < 16; i++ ) - { - UINT16 temp = row; - - for ( int j = 0; j < 16; j++ ) - { - if ( ( temp & col ) & 0x8000 ) - { - m_lcd[j][i] = 15; - } - temp <<= 1; - } - col <<= 1; - } -} - - -UINT32 microvision_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for ( UINT8 i = 0; i < 16; i++ ) - { - for ( UINT8 j = 0; j < 16; j++ ) - { - bitmap.pix16(i,j) = m_lcd [i] [j]; - } - } - - return 0; -} - - -void microvision_state::screen_vblank(screen_device &screen, bool state) -{ - if ( state ) - { - for ( int i = 0; i < 16; i++ ) - { - for ( int j= 0; j < 16; j++ ) - { - if ( m_lcd[i][j] ) - { - m_lcd[i][j]--; - } - } - } - update_lcd(); - } -} - - -/* -control is signals LCD5 LCD4 - LCD5 = -Data Clk on 0488 - LCD4 = Latch pulse on 0488 - LCD3 = Data 0 - LCD2 = Data 1 - LCD1 = Data 2 - LCD0 = Data 3 -data is signals LCD3 LCD2 LCD1 LCD0 -*/ -void microvision_state::lcd_write(UINT8 control, UINT8 data) -{ - // Latch pulse, when high, resets the %8 latch address counter - if ( control & 0x01 ) { - m_lcd_latch_index = 0; - } - - // The addressed latches load when -Data Clk is low - if ( ! ( control & 0x02 ) ) { - m_lcd_latch[ m_lcd_latch_index & 0x07 ] = data & 0x0f; - } - - // The latch address counter is incremented on rising edges of -Data Clk - if ( ( ! ( m_lcd_control_old & 0x02 ) ) && ( control & 0x02 ) ) { - // Check if Latch pule is low - if ( ! ( control & 0x01 ) ) { - m_lcd_latch_index++; - } - } - - // A parallel transfer of data from the addressed latches to the holding latches occurs - // whenever Latch Pulse is high and -Data Clk is high - if ( control == 3 ) { - for ( int i = 0; i < 8; i++ ) { - m_lcd_holding_latch[i] = m_lcd_latch[i]; - } - update_lcd(); - } - - m_lcd_control_old = control; -} - - -/* -speaker is SPKR1 SPKR0 -*/ -void microvision_state::speaker_write(UINT8 speaker) -{ - const INT8 speaker_level[4] = { 0, 127, -128, 0 }; - - m_dac->write_signed8( speaker_level[ speaker & 0x03 ] ); -} - - -void microvision_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch ( id ) - { - case TIMER_PADDLE: - m_t1 = 0; - break; - } -} - - -/* - x--- ---- KEY3 - -x-- ---- KEY4 - --x- ---- KEY5 - ---x ---- KEY6 - ---- x--- - ---- -x-- KEY0 - ---- --x- KEY1 - ---- ---x KEY2 -*/ -WRITE8_MEMBER( microvision_state::i8021_p0_write ) -{ - if (LOG) logerror( "p0_write: %02x\n", data ); - - m_p0 = data; -} - - -/* - x--- ---- LCD3 - -x-- ---- LCD2 - --x- ---- LCD1 - ---x ---- LCD0 - ---- --x- LCD5 - ---- ---x LCD4 -*/ -WRITE8_MEMBER( microvision_state::i8021_p1_write ) -{ - if (LOG) logerror( "p1_write: %02x\n", data ); - - lcd_write( data & 0x03, data >> 4 ); -} - - -/* ----- xx-- CAP2 (paddle) ----- --x- SPKR1 ----- ---x SPKR0 -*/ -WRITE8_MEMBER( microvision_state::i8021_p2_write ) -{ - if (LOG) logerror( "p2_write: %02x\n", data ); - - m_p2 = data; - - speaker_write( m_p2 & 0x03 ); - - if ( m_p2 & 0x0c ) - { - m_t1 = 1; - // Stop paddle timer - m_paddle_timer->adjust( attotime::never ); - } - else - { - // Start paddle timer (min is 160uS, max is 678uS) - UINT8 paddle = 255 - ioport("PADDLE")->read(); - m_paddle_timer->adjust( attotime::from_usec(160 + ( 518 * paddle ) / 255 ) ); - } -} - - -READ8_MEMBER( microvision_state::i8021_t1_read ) -{ - return m_t1; -} - - -READ8_MEMBER( microvision_state::i8021_bus_read ) -{ - UINT8 data = m_p0; - - UINT8 col0 = ioport("COL0")->read(); - UINT8 col1 = ioport("COL1")->read(); - UINT8 col2 = ioport("COL2")->read(); - - // Row scanning - if ( ! ( m_p0 & 0x80 ) ) - { - UINT8 t = ( ( col0 & 0x01 ) << 2 ) | ( ( col1 & 0x01 ) << 1 ) | ( col2 & 0x01 ); - - data &= ( t ^ 0xFF ); - } - if ( ! ( m_p0 & 0x40 ) ) - { - UINT8 t = ( ( col0 & 0x02 ) << 1 ) | ( col1 & 0x02 ) | ( ( col2 & 0x02 ) >> 1 ); - - data &= ( t ^ 0xFF ); - } - if ( ! ( m_p0 & 0x20 ) ) - { - UINT8 t = ( col0 & 0x04 ) | ( ( col1 & 0x04 ) >> 1 ) | ( ( col2 & 0x04 ) >> 2 ); - - data &= ( t ^ 0xFF ); - } - if ( ! ( m_p0 & 0x10 ) ) - { - UINT8 t = ( ( col0 & 0x08 ) >> 1 ) | ( ( col1 & 0x08 ) >> 2 ) | ( ( col2 & 0x08 ) >> 3 ); - - data &= ( t ^ 0xFF ); - } - return data; -} - - -READ8_MEMBER( microvision_state::tms1100_read_k ) -{ - UINT8 data = 0; - - if (LOG) logerror("read_k\n"); - - if ( m_r & 0x100 ) - { - data |= ioport("COL0")->read(); - } - if ( m_r & 0x200 ) - { - data |= ioport("COL1")->read(); - } - if ( m_r & 0x400 ) - { - data |= ioport("COL2")->read(); - } - return data; -} - - -WRITE16_MEMBER( microvision_state::tms1100_write_o ) -{ - if (LOG) logerror("write_o: %04x\n", data); - - m_o = data; - - lcd_write( ( m_r >> 6 ) & 0x03, m_o & 0x0f ); -} - - -/* -x-- ---- ---- KEY2 --x- ---- ---- KEY1 ---x ---- ---- KEY0 ---- x--- ---- LCD5 ---- -x-- ---- LCD4 ---- ---- --x- SPKR0 ---- ---- ---x SPKR1 -*/ -WRITE16_MEMBER( microvision_state::tms1100_write_r ) -{ - if (LOG) logerror("write_r: %04x\n", data); - - m_r = data; - - speaker_write( ( ( m_r & 0x01 ) << 1 ) | ( ( m_r & 0x02 ) >> 1 ) ); - lcd_write( ( m_r >> 6 ) & 0x03, m_o & 0x0f ); -} - - -static const UINT16 microvision_output_pla_0[0x20] = -{ - /* O output PLA configuration currently unknown */ - 0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E, - 0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - - -static const UINT16 microvision_output_pla_1[0x20] = -{ - /* O output PLA configuration currently unknown */ - /* Reversed bit order */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - - -DEVICE_IMAGE_LOAD_MEMBER(microvision_state, microvsn_cart) -{ - UINT8 *rom1 = memregion("maincpu1")->base(); - UINT8 *rom2 = memregion("maincpu2")->base(); - UINT32 file_size = m_cart->common_get_size("rom"); - m_pla = 0; - - if ( file_size != 1024 && file_size != 2048 ) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid rom file size"); - return IMAGE_INIT_FAIL; - } - - /* Read cartridge */ - if (image.software_entry() == NULL) - { - if (image.fread(rom1, file_size) != file_size) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file"); - return IMAGE_INIT_FAIL; - } - } - else - { - // Copy rom contents - memcpy(rom1, image.get_software_region("rom"), file_size); - - // Get PLA type - const char *pla = image.get_feature("pla"); - - if (pla) - m_pla = 1; - - tms1xxx_cpu_device::set_output_pla(m_tms1100, m_pla ? microvision_output_pla_1 : microvision_output_pla_0); - - // Set default setting for PCB type and RC type - m_pcb_type = microvision_state::PCB_TYPE_UNKNOWN; - m_rc_type = microvision_state::RC_TYPE_UNKNOWN; - - // Detect settings for PCB type - const char *pcb = image.get_feature("pcb"); - - if (pcb) - { - static const struct { const char *pcb_name; microvision_state::pcb_type pcbtype; } pcb_types[] = - { - { "4952 REV-A", microvision_state::PCB_TYPE_4952_REV_A }, - { "4952-79 REV-B", microvision_state::PCB_TYPE_4952_9_REV_B }, - { "4971-REV-C", microvision_state::PCB_TYPE_4971_REV_C }, - { "7924952D02", microvision_state::PCB_TYPE_7924952D02 } - }; - - for (int i = 0; i < ARRAY_LENGTH(pcb_types) && m_pcb_type == microvision_state::PCB_TYPE_UNKNOWN; i++) - { - if (!core_stricmp(pcb, pcb_types[i].pcb_name)) - { - m_pcb_type = pcb_types[i].pcbtype; - } - } - } - - // Detect settings for RC types - const char *rc = image.get_feature("rc"); - - if (rc) - { - static const struct { const char *rc_name; microvision_state::rc_type rctype; } rc_types[] = - { - { "100pf/21.0K", microvision_state::RC_TYPE_100PF_21_0K }, - { "100pf/23.2K", microvision_state::RC_TYPE_100PF_23_2K }, - { "100pf/39.4K", microvision_state::RC_TYPE_100PF_39_4K } - }; - - for (int i = 0; i < ARRAY_LENGTH(rc_types) && m_rc_type == microvision_state::RC_TYPE_UNKNOWN; i++) - { - if (!core_stricmp(rc, rc_types[i].rc_name)) - { - m_rc_type = rc_types[i].rctype; - } - } - } - } - - // Mirror rom data to maincpu2 region - memcpy(rom2, rom1, file_size); - - // Based on file size select cpu: - // - 1024 -> I8021 - // - 2048 -> TI TMS1100 - - switch (file_size) - { - case 1024: - m_cpu_type = microvision_state::CPU_TYPE_I8021; - break; - - case 2048: - m_cpu_type = microvision_state::CPU_TYPE_TMS1100; - break; - } - return IMAGE_INIT_PASS; -} - - -static INPUT_PORTS_START( microvision ) - PORT_START("COL0") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CODE(KEYCODE_3) PORT_NAME("B01") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_CODE(KEYCODE_E) PORT_NAME("B04") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_CODE(KEYCODE_D) PORT_NAME("B07") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_CODE(KEYCODE_C) PORT_NAME("B10") - - PORT_START("COL1") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_CODE(KEYCODE_4) PORT_NAME("B02") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_CODE(KEYCODE_R) PORT_NAME("B05") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON8) PORT_CODE(KEYCODE_F) PORT_NAME("B08") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON11) PORT_CODE(KEYCODE_V) PORT_NAME("B11") - - PORT_START("COL2") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_CODE(KEYCODE_5) PORT_NAME("B03") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_CODE(KEYCODE_T) PORT_NAME("B06") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_CODE(KEYCODE_G) PORT_NAME("B09") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON12) PORT_CODE(KEYCODE_B) PORT_NAME("B12") - - PORT_START("PADDLE") - PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(1) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) -INPUT_PORTS_END - - -static ADDRESS_MAP_START( microvision_8021_io, AS_IO, 8, microvision_state ) - AM_RANGE( 0x00, 0xFF ) AM_WRITE( i8021_p0_write ) - AM_RANGE( MCS48_PORT_P0, MCS48_PORT_P0 ) AM_WRITE( i8021_p0_write ) - AM_RANGE( MCS48_PORT_P1, MCS48_PORT_P1 ) AM_WRITE( i8021_p1_write ) - AM_RANGE( MCS48_PORT_P2, MCS48_PORT_P2 ) AM_WRITE( i8021_p2_write ) - AM_RANGE( MCS48_PORT_T1, MCS48_PORT_T1 ) AM_READ( i8021_t1_read ) - AM_RANGE( MCS48_PORT_BUS, MCS48_PORT_BUS ) AM_READ( i8021_bus_read ) -ADDRESS_MAP_END - - -static MACHINE_CONFIG_START( microvision, microvision_state ) - MCFG_CPU_ADD("maincpu1", I8021, 2000000) // approximately - MCFG_CPU_IO_MAP( microvision_8021_io ) - MCFG_CPU_ADD("maincpu2", TMS1100, 500000) // most games seem to be running at approximately this speed - MCFG_TMS1XXX_OUTPUT_PLA( microvision_output_pla_0 ) - MCFG_TMS1XXX_READ_K_CB( READ8( microvision_state, tms1100_read_k ) ) - MCFG_TMS1XXX_WRITE_O_CB( WRITE16( microvision_state, tms1100_write_o ) ) - MCFG_TMS1XXX_WRITE_R_CB( WRITE16( microvision_state, tms1100_write_r ) ) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(microvision_state, microvision ) - MCFG_MACHINE_RESET_OVERRIDE(microvision_state, microvision ) - - MCFG_SCREEN_UPDATE_DRIVER(microvision_state, screen_update) - MCFG_SCREEN_VBLANK_DRIVER(microvision_state, screen_vblank) - MCFG_SCREEN_SIZE(16, 16) - MCFG_SCREEN_VISIBLE_AREA(0, 15, 0, 15) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(microvision_state,microvision) - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "microvision_cart") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(microvision_state, microvsn_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","microvision") -MACHINE_CONFIG_END - - -ROM_START( microvsn ) - ROM_REGION( 0x800, "maincpu1", ROMREGION_ERASE00 ) - ROM_REGION( 0x800, "maincpu2", ROMREGION_ERASE00 ) - ROM_REGION( 867, "maincpu2:mpla", 0 ) - ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) // verified for: pinball, blockbuster, bowling - - ROM_REGION( 365, "maincpu2:opla", ROMREGION_ERASE00 ) -ROM_END - - -CONS( 1979, microvsn, 0, 0, microvision, microvision, driver_device, 0, "Milton Bradley", "MicroVision", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/mikro80.c b/src/mess/drivers/mikro80.c deleted file mode 100644 index 178be26ce25..00000000000 --- a/src/mess/drivers/mikro80.c +++ /dev/null @@ -1,239 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - MIKRO80 driver by Miodrag Milanovic - - 10/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/wave.h" -#include "includes/mikro80.h" -#include "formats/rk_cas.h" -#include "sound/dac.h" - -/* Address maps */ -static ADDRESS_MAP_START(mikro80_mem, AS_PROGRAM, 8, mikro80_state ) - AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x0800, 0xdfff ) AM_RAM // RAM - AM_RANGE( 0xe000, 0xe7ff ) AM_RAM AM_SHARE("cursor_ram")// Video RAM - AM_RANGE( 0xe800, 0xefff ) AM_RAM AM_SHARE("video_ram") // Video RAM - AM_RANGE( 0xd000, 0xf7ff ) AM_RAM // RAM - AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mikro80_io , AS_IO, 8, mikro80_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x01, 0x01) AM_READWRITE(mikro80_tape_r, mikro80_tape_w ) - AM_RANGE( 0x04, 0x07) AM_READWRITE(mikro80_keyboard_r, mikro80_keyboard_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( kristall_io , AS_IO, 8, mikro80_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( radio99_io , AS_IO, 8, mikro80_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x01, 0x01) AM_READWRITE(mikro80_tape_r, mikro80_tape_w ) - AM_RANGE( 0x04, 0x04) AM_DEVWRITE("dac", dac_device, write_unsigned8) - AM_RANGE( 0x05, 0x05) AM_READWRITE(mikro80_8255_portc_r, mikro80_8255_portc_w ) - AM_RANGE( 0x06, 0x06) AM_READ(mikro80_8255_portb_r) - AM_RANGE( 0x07, 0x07) AM_WRITE(mikro80_8255_porta_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mikro80 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/* F4 Character Displayer */ -static const gfx_layout mikro80_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( mikro80 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, mikro80_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( mikro80, mikro80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(mikro80_mem) - MCFG_CPU_IO_MAP(mikro80_io) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mikro80_state, mikro80_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(mikro80_state, mikro80_8255_portb_r)) - MCFG_I8255_IN_PORTC_CB(READ8(mikro80_state, mikro80_8255_portc_r)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(mikro80_state, screen_update_mikro80) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mikro80) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rk8_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("mikro80_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "mikro80") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( radio99, mikro80 ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(radio99_io) - - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 16.00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( kristall, mikro80 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(kristall_io) -MACHINE_CONFIG_END - - -/* ROM definition */ - -ROM_START( mikro80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mikro80.rom", 0xf800, 0x0800, CRC(63a4b72a) SHA1(6bd3e396539a15e2ccffa7486cae06ef6ddd1d03)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("mikro80.fnt", 0x0000, 0x0800, CRC(43eb72bb) SHA1(761319cc6747661b33e84aa449cec83800543b5b) ) -ROM_END - -ROM_START( radio99 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "monrk88.bin", 0xf800, 0x0800, CRC(5415d847) SHA1(c8233c72548bc79846b9d998766a10df349c5bda)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("mikro80.fnt", 0x0000, 0x0800, CRC(43eb72bb) SHA1(761319cc6747661b33e84aa449cec83800543b5b) ) -ROM_END - -ROM_START( kristall2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "kristall-2.rom", 0xf800, 0x0800, CRC(e1b5c60f) SHA1(8ce5158def7fca91ec7e11efbb10aa5d70b7c36d)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD( "kristall-2.fnt", 0x0000, 0x0800, CRC(9661c9f5) SHA1(830c38735dcb1c8a271fa0027f94b4e034848fc8)) -ROM_END - - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, mikro80, 0, 0, mikro80, mikro80, mikro80_state, mikro80, "", "Mikro-80", 0) -COMP( 1993, radio99, mikro80, 0, radio99, mikro80, mikro80_state, radio99, "", "Radio-99DM", 0) -COMP( 1987, kristall2, mikro80, 0, kristall, mikro80, mikro80_state, mikro80, "", "Kristall-2", 0) diff --git a/src/mess/drivers/mikromik.c b/src/mess/drivers/mikromik.c deleted file mode 100644 index c802478f6ad..00000000000 --- a/src/mess/drivers/mikromik.c +++ /dev/null @@ -1,578 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Nokia Elektroniikka pj - - Controller ILC 9534 - FDC-Interface ILC 9530 - - Parts: - - 6,144 MHz xtal (CPU clock) - 18,720 MHz xtal (pixel clock) - 16 MHz xtal (FDC clock) - Intel I8085AP (CPU) - Intel 8253-5P (PIT) - Intel 8275P (CRTC) - Intel 8212P (I/OP) - Intel 8237A-5P (DMAC) - NEC uPD7220C (GDC) - NEC uPD7201P (MPSC=uart) - NEC uPD765 (FDC) - TMS4116-15 (16Kx4 DRAM)*4 = 32KB Video RAM for 7220 - 2164-6P (64Kx1 DRAM)*8 = 64KB Work RAM - - DMA channels: - - 0 CRT - 1 MPSC transmit - 2 MPSC receive - 3 FDC - - Interrupts: - - INTR MPSC INT - RST5.5 FDC IRQ - RST6.5 8212 INT - RST7.5 DMA EOP - -*/ - -/* - - TODO: - - - NEC uPD7220 GDC - - accurate video timing - - floppy DRQ during RECALL = 0 - - PCB layout - - NEC uPD7201 MPSC - - model M7 5MB hard disk - -*/ - -#include "includes/mikromik.h" - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - -#define MMU_IOEN 0x01 -#define MMU_RAMEN 0x02 -#define MMU_CE4 0x08 -#define MMU_CE0 0x10 -#define MMU_CE1 0x20 -#define MMU_CE2 0x40 -#define MMU_CE3 0x80 - - - -//************************************************************************** -// MEMORY MANAGEMENT UNIT -//************************************************************************** - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( mm1_state::read ) -{ - UINT8 data = 0; - UINT8 mmu = m_mmu_rom->base()[(m_a8 << 8) | (offset >> 8)]; - - if (mmu & MMU_IOEN) - { - switch ((offset >> 4) & 0x07) - { - case 0: - data = m_dmac->read(space, offset & 0x0f); - break; - - case 1: - data = m_mpsc->cd_ba_r(space, offset & 0x03); - break; - - case 2: - data = m_crtc->read(space, offset & 0x01); - break; - - case 3: - data = m_pit->read(space, offset & 0x03); - break; - - case 4: - data = m_iop->read(space, 0); - break; - - case 5: - if (BIT(offset, 0)) - { - data = m_fdc->fifo_r(space, 0, 0xff); - } - else - { - data = m_fdc->msr_r(space, 0, 0xff); - } - break; - - case 7: - data = m_hgdc->read(space, offset & 0x01); - break; - } - } - else - { - if (mmu & MMU_RAMEN) - { - data = m_ram->pointer()[offset]; - } - else if (!(mmu & MMU_CE0)) - { - data = m_rom->base()[offset & 0x1fff]; - } - else if (!(mmu & MMU_CE1)) - { - data = m_rom->base()[0x2000 + (offset & 0x1fff)]; - } - } - - return data; -} - - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( mm1_state::write ) -{ - UINT8 mmu = m_mmu_rom->base()[(m_a8 << 8) | (offset >> 8)]; - - if (mmu & MMU_IOEN) - { - switch ((offset >> 4) & 0x07) - { - case 0: - m_dmac->write(space, offset & 0x0f, data); - break; - - case 1: - m_mpsc->cd_ba_w(space, offset & 0x03, data); - break; - - case 2: - m_crtc->write(space, offset & 0x01, data); - break; - - case 3: - m_pit->write(space, offset & 0x03, data); - break; - - case 4: - m_iop->write(space, 0, data); - break; - - case 5: - if (BIT(offset, 0)) - { - m_fdc->fifo_w(space, 0, data, 0xff); - } - break; - - case 6: - ls259_w(space, offset & 0x07, data); - break; - - case 7: - m_hgdc->write(space, offset & 0x01, data); - break; - } - } - else - { - if (mmu & MMU_RAMEN) - { - m_ram->pointer()[offset] = data; - } - } -} - - -//------------------------------------------------- -// ls259_w - -//------------------------------------------------- - -WRITE8_MEMBER( mm1_state::ls259_w ) -{ - int d = BIT(data, 0); - - switch (offset) - { - case 0: // IC24 A8 - if (LOG) logerror("IC24 A8 %u\n", d); - m_a8 = d; - break; - - case 1: // RECALL - if (LOG) logerror("RECALL %u\n", d); - m_recall = d; - if (d) m_fdc->soft_reset(); - break; - - case 2: // _RV28/RX21 - m_rx21 = d; - break; - - case 3: // _TX21 - m_tx21 = d; - break; - - case 4: // _RCL - m_rcl = d; - break; - - case 5: // _INTC - m_intc = d; - break; - - case 6: // LLEN - if (LOG) logerror("LLEN %u\n", d); - m_llen = d; - break; - - case 7: // MOTOR ON - if (LOG) logerror("MOTOR %u\n", d); - m_floppy0->mon_w(!d); - m_floppy1->mon_w(!d); - break; - } -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( mm1_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( mm1_map, AS_PROGRAM, 8, mm1_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( mm1 ) -//------------------------------------------------- - -static INPUT_PORTS_START( mm1 ) - // defined in machine/mm1kb.h - - PORT_START("T5") - PORT_CONFNAME( 0x01, 0x00, "Floppy Drive Type") - PORT_CONFSETTING( 0x00, "640 KB" ) - PORT_CONFSETTING( 0x01, "160/320 KB" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// I8237_INTERFACE( dmac_intf ) -//------------------------------------------------- - -void mm1_state::update_tc() -{ - int fdc_tc = m_tc && !m_dack3; - - if (m_fdc_tc != fdc_tc) - { - m_fdc_tc = fdc_tc; - m_fdc->tc_w(m_fdc_tc); - } -} - -WRITE_LINE_MEMBER( mm1_state::dma_hrq_w ) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - // Assert HLDA - m_dmac->hack_w(state); -} - -READ8_MEMBER( mm1_state::mpsc_dack_r ) -{ - // clear data request - m_dmac->dreq2_w(CLEAR_LINE); - - return 1;//m_mpsc->dtra_r(); -} - -WRITE8_MEMBER( mm1_state::mpsc_dack_w ) -{ - //m_mpsc->hai_w(data); - - // clear data request - m_dmac->dreq1_w(CLEAR_LINE); -} - -WRITE_LINE_MEMBER( mm1_state::dma_eop_w ) -{ - m_maincpu->set_input_line(I8085_RST75_LINE, state); - - m_tc = state; - update_tc(); -} - -WRITE_LINE_MEMBER( mm1_state::dack3_w ) -{ - m_dack3 = state; - update_tc(); -} - -WRITE_LINE_MEMBER( mm1_state::itxc_w ) -{ - if (!m_intc) - { - m_mpsc->txca_w(state); - } -} - -WRITE_LINE_MEMBER( mm1_state::irxc_w ) -{ - if (!m_intc) - { - m_mpsc->rxca_w(state); - } -} - -WRITE_LINE_MEMBER( mm1_state::auxc_w ) -{ - m_mpsc->txcb_w(state); - m_mpsc->rxcb_w(state); -} - -//------------------------------------------------- -// UPD7201 -//------------------------------------------------- - -WRITE_LINE_MEMBER( mm1_state::drq2_w ) -{ - if (state) - { - m_dmac->dreq2_w(ASSERT_LINE); - } -} - -WRITE_LINE_MEMBER( mm1_state::drq1_w ) -{ - if (state) - { - m_dmac->dreq1_w(ASSERT_LINE); - } -} - -READ_LINE_MEMBER( mm1_state::dsra_r ) -{ - return 1; -} - - -//------------------------------------------------- -// upd765_interface fdc_intf -//------------------------------------------------- - -FLOPPY_FORMATS_MEMBER( mm1_state::floppy_formats ) - FLOPPY_MM1_FORMAT -FLOPPY_FORMATS_END -/* -FLOPPY_FORMATS_MEMBER( mm2_state::floppy_formats ) - FLOPPY_MM2_FORMAT -FLOPPY_FORMATS_END -*/ -static SLOT_INTERFACE_START( mm1_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( mm1 ) -//------------------------------------------------- - -void mm1_state::machine_start() -{ - // register for state saving - save_item(NAME(m_llen)); - save_item(NAME(m_intc)); - save_item(NAME(m_rx21)); - save_item(NAME(m_tx21)); - save_item(NAME(m_rcl)); - save_item(NAME(m_recall)); -} - - -void mm1_state::machine_reset() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - // reset LS259 - for (int i = 0; i < 8; i++) - { - ls259_w(program, i, 0); - } - - // reset FDC - m_fdc->reset(); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( mm1 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( mm1, mm1_state ) - // basic system hardware - MCFG_CPU_ADD(I8085A_TAG, I8085A, XTAL_6_144MHz) - MCFG_CPU_PROGRAM_MAP(mm1_map) - MCFG_I8085A_SID(READLINE(mm1_state, dsra_r)) - MCFG_I8085A_SOD(DEVWRITELINE(KB_TAG, mm1_keyboard_t, bell_w)) - MCFG_QUANTUM_PERFECT_CPU(I8085A_TAG) - - // peripheral hardware - MCFG_DEVICE_ADD(I8212_TAG, I8212, 0) - MCFG_I8212_IRQ_CALLBACK(INPUTLINE(I8085A_TAG, I8085_RST65_LINE)) - MCFG_I8212_DI_CALLBACK(DEVREAD8(KB_TAG, mm1_keyboard_t, read)) - - MCFG_DEVICE_ADD(I8237_TAG, AM9517A, XTAL_6_144MHz/2) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(mm1_state, dma_hrq_w)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(mm1_state, dma_eop_w)) - MCFG_I8237_IN_MEMR_CB(READ8(mm1_state, read)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(mm1_state, write)) - MCFG_I8237_IN_IOR_2_CB(READ8(mm1_state, mpsc_dack_r)) - MCFG_I8237_IN_IOR_3_CB(DEVREAD8(UPD765_TAG, upd765_family_device, mdma_r)) - MCFG_I8237_OUT_IOW_0_CB(DEVWRITE8(I8275_TAG, i8275_device, dack_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(mm1_state, mpsc_dack_w)) - MCFG_I8237_OUT_IOW_3_CB(DEVWRITE8(UPD765_TAG, upd765_family_device, mdma_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(mm1_state, dack3_w)) - - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_6_144MHz/2/2) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(mm1_state, itxc_w)) - MCFG_PIT8253_CLK1(XTAL_6_144MHz/2/2) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(mm1_state, irxc_w)) - MCFG_PIT8253_CLK2(XTAL_6_144MHz/2/2) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mm1_state, auxc_w)) - - MCFG_UPD765A_ADD(UPD765_TAG, /* XTAL_16MHz/2/2 */ true, true) - MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE(I8085A_TAG, I8085_RST55_LINE)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq3_w)) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", mm1_floppies, "525qd", mm1_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", mm1_floppies, "525qd", mm1_state::floppy_formats) - - MCFG_UPD7201_ADD(UPD7201_TAG, XTAL_6_144MHz/2, 0, 0, 0, 0) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_RXDRQA_CB(WRITELINE(mm1_state, drq2_w)) - MCFG_Z80DART_OUT_TXDRQA_CB(WRITELINE(mm1_state, drq1_w)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, rxa_w)) - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_PORT_ADD(RS232_C_TAG, default_rs232_devices, NULL) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, ctsb_w)) - - MCFG_DEVICE_ADD(KB_TAG, MM1_KEYBOARD, 2500) // actual KBCLK is XTAL_6_144MHz/2/16 - MCFG_MM1_KEYBOARD_KBST_CALLBACK(DEVWRITELINE(I8212_TAG, i8212_device, stb_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "mm1_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( mm1m6 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( mm1m6, mm1 ) - // video hardware - MCFG_FRAGMENT_ADD(mm1m6_video) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( mm1m7 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( mm1m7, mm1 ) - // video hardware - MCFG_FRAGMENT_ADD(mm1m6_video) - - // TODO hard disk -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( mm1m6 ) -//------------------------------------------------- - -ROM_START( mm1m6 ) - ROM_REGION( 0x4000, I8085A_TAG, 0 ) // BIOS - ROM_LOAD( "9081b.ic2", 0x0000, 0x2000, CRC(2955feb3) SHA1(946a6b0b8fb898be3f480c04da33d7aaa781152b) ) - - ROM_REGION( 0x200, "address", 0 ) // address decoder - ROM_LOAD( "720793a.ic24", 0x0000, 0x0200, CRC(deea87a6) SHA1(8f19e43252c9a0b1befd02fc9d34fe1437477f3a) ) - - ROM_REGION( 0x1000, "chargen", 0 ) // character generator - ROM_LOAD( "6807b.ic61", 0x0000, 0x1000, CRC(32b36220) SHA1(8fe7a181badea3f7e656dfaea21ee9e4c9baf0f1) ) -ROM_END - - -//------------------------------------------------- -// ROM( mm1m7 ) -//------------------------------------------------- - -#define rom_mm1m7 rom_mm1m6 - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1981, mm1m6, 0, 0, mm1m6, mm1, driver_device, 0, "Nokia Data", "MikroMikko 1 M6", MACHINE_SUPPORTS_SAVE ) -COMP( 1981, mm1m7, mm1m6, 0, mm1m7, mm1, driver_device, 0, "Nokia Data", "MikroMikko 1 M7", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/mikrosha.c b/src/mess/drivers/mikrosha.c deleted file mode 100644 index 8320400b4de..00000000000 --- a/src/mess/drivers/mikrosha.c +++ /dev/null @@ -1,281 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Mikrosha driver by Miodrag Milanovic - - 05/06/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/wave.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "imagedev/cassette.h" -#include "formats/rk_cas.h" -#include "includes/radio86.h" - - -class mikrosha_state : public radio86_state -{ -public: - mikrosha_state(const machine_config &mconfig, device_type type, const char *tag) - : radio86_state(mconfig, type, tag), - m_cart(*this, "cartslot") - { } - DECLARE_WRITE_LINE_MEMBER(mikrosha_pit_out2); - I8275_DRAW_CHARACTER_MEMBER(display_pixels); - DECLARE_MACHINE_RESET(mikrosha); - -protected: - required_device m_cart; -}; - -MACHINE_RESET_MEMBER(mikrosha_state,mikrosha) -{ - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0x8000+m_cart->get_rom_size()-1, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - MACHINE_RESET_CALL_MEMBER(radio86); -} - -/* Address maps */ -static ADDRESS_MAP_START(mikrosha_mem, AS_PROGRAM, 8, mikrosha_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM - AM_RANGE( 0xc000, 0xc003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x07fc) - AM_RANGE( 0xc800, 0xc803 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x07fc) - AM_RANGE( 0xd000, 0xd001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x07fe) // video - AM_RANGE( 0xd800, 0xd803 ) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) AM_MIRROR(0x07fc) // Timer - AM_RANGE( 0xe000, 0xf7ff ) AM_READ(radio_cpu_state_r) // Not connected - AM_RANGE( 0xf800, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mikrosha_io , AS_IO, 8, mikrosha_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00, 0xff ) AM_READWRITE(radio_io_r,radio_io_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mikrosha ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\\') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Center") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('~') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgDn") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - -WRITE_LINE_MEMBER(mikrosha_state::mikrosha_pit_out2) -{ -} - -I8275_DRAW_CHARACTER_MEMBER(mikrosha_state::display_pixels) -{ - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const UINT8 *charmap = m_charmap + (m_mikrosha_font_page & 1) * 0x400; - UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; - if(linecount == 8) - pixels = 0; - if (vsp) { - pixels = 0; - } - if (lten) { - pixels = 0xff; - } - if (rvv) { - pixels ^= 0xff; - } - for(i=0;i<6;i++) { - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; - } -} - -/* F4 Character Displayer */ -static const gfx_layout mikrosha_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( mikrosha ) - GFXDECODE_ENTRY( "gfx1", 0x0000, mikrosha_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( mikrosha, mikrosha_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, XTAL_16MHz / 9) - MCFG_CPU_PROGRAM_MAP(mikrosha_mem) - MCFG_CPU_IO_MAP(mikrosha_io) - - MCFG_MACHINE_RESET_OVERRIDE(mikrosha_state, mikrosha) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_OUT_PORTB_CB(WRITE8(radio86_state, mikrosha_8255_font_page_w)) - - MCFG_DEVICE_ADD("i8275", I8275, XTAL_16MHz / 12) - MCFG_I8275_CHARACTER_WIDTH(6) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(mikrosha_state, display_pixels) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma8257",i8257_device, dreq2_w)) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_CLK1(0) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mikrosha_state, mikrosha_pit_out2)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(78*6, 30*10) - MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mikrosha) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(mikrosha_state,radio86) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(radio86_state, hrq_w)) - MCFG_I8257_IN_MEMR_CB(READ8(radio86_state, memory_read_byte)) - MCFG_I8257_OUT_MEMW_CB(WRITE8(radio86_state, memory_write_byte)) - MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("i8275", i8275_device, dack_w)) - MCFG_I8257_REVERSE_RW_MODE(1) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rkm_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("mikrosha_cass") - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mikrosha_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "mikrosha_cass") - MCFG_SOFTWARE_LIST_ADD("cart_list", "mikrosha_cart") -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( mikrosha ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mikrosha.rom", 0xf800, 0x0800, CRC(86a83556) SHA1(94b1baad0a419145939a891ff51f4324e8e4ddd2)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("mikrosha.fnt", 0x0000, 0x0800, CRC(b315da1c) SHA1(b5bf9abc0fff75b1aba709a7f08b23d4a89bb04b)) -ROM_END - -ROM_START( m86rk ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "m86rk.bin", 0xf800, 0x0800, CRC(a898d77a) SHA1(c2497bf8434b5028fe0a9fc09be311465d5553a5)) - ROM_REGION(0x0800, "gfx1",0) - /* here should probably be different rom */ - ROM_LOAD ("mikrosha.fnt", 0x0000, 0x0800, CRC(b315da1c) SHA1(b5bf9abc0fff75b1aba709a7f08b23d4a89bb04b)) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, mikrosha, radio86,0, mikrosha, mikrosha, radio86_state, radio86, "Lianozovo Electromechanical Factory", "Mikrosha", 0) -COMP( 1987, m86rk, radio86,0, mikrosha, mikrosha, radio86_state, radio86, "", "Mikrosha-86RK", 0) diff --git a/src/mess/drivers/mini2440.c b/src/mess/drivers/mini2440.c deleted file mode 100644 index c9402e57a9c..00000000000 --- a/src/mess/drivers/mini2440.c +++ /dev/null @@ -1,275 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/******************************************************************************* - - FriendlyARM Mini2440 - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "machine/s3c2440.h" -#include "machine/smartmed.h" -#include "sound/dac.h" -#include "rendlay.h" - -#define VERBOSE_LEVEL ( 0 ) - -class mini2440_state : public driver_device -{ -public: - mini2440_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_s3c2440(*this, "s3c2440"), - m_nand(*this, "nand"), - m_dac1(*this, "dac1"), - m_dac2(*this, "dac2"), - m_penx(*this, "PENX"), - m_peny(*this, "PENY") { } - - required_device m_maincpu; - required_device m_s3c2440; - required_device m_nand; - required_device m_dac1; - required_device m_dac2; - required_ioport m_penx; - required_ioport m_peny; - - UINT32 m_port[9]; - DECLARE_DRIVER_INIT(mini2440); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(mini2440_input_changed); - inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); - DECLARE_READ32_MEMBER(s3c2440_gpio_port_r); - DECLARE_WRITE32_MEMBER(s3c2440_gpio_port_w); - DECLARE_READ32_MEMBER(s3c2440_core_pin_r); - DECLARE_WRITE8_MEMBER(s3c2440_nand_command_w ); - DECLARE_WRITE8_MEMBER(s3c2440_nand_address_w ); - DECLARE_READ8_MEMBER(s3c2440_nand_data_r ); - DECLARE_WRITE8_MEMBER(s3c2440_nand_data_w ); - DECLARE_WRITE16_MEMBER(s3c2440_i2s_data_w ); - DECLARE_READ32_MEMBER(s3c2440_adc_data_r ); - -}; - -inline void mini2440_state::verboselog(int n_level, const char *s_fmt, ...) -{ - if (VERBOSE_LEVEL >= n_level) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt); - vsprintf( buf, s_fmt, v); - va_end( v); - logerror( "%s: %s", machine().describe_context(), buf); - } -} - -/*************************************************************************** - MACHINE HARDWARE -***************************************************************************/ - -// GPIO - -READ32_MEMBER(mini2440_state::s3c2440_gpio_port_r) -{ - UINT32 data = m_port[offset]; - switch (offset) - { - case S3C2440_GPIO_PORT_G : - { - data = (data & ~(1 << 13)) | (1 << 13); // [nand] 1 = 2048 byte page (if ncon = 1) - data = (data & ~(1 << 14)) | (1 << 14); // [nand] 1 = 5 address cycle (if ncon = 1) - data = (data & ~(1 << 15)) | (0 << 15); // [nand] 0 = 8-bit bus width (if ncon = 1) - data = data | 0x8E9; // for "load Image of Linux..." - } - break; - } - return data; -} - -WRITE32_MEMBER(mini2440_state::s3c2440_gpio_port_w) -{ - m_port[offset] = data; - switch (offset) - { - case S3C2440_GPIO_PORT_B : - { - verboselog(5, "LED %d %d %d %d\n", BIT( data, 5), BIT( data, 6), BIT( data, 7), BIT( data, 8)); - } - break; - } -} - -// CORE - -/* - -OM[1:0] = 00: Enable NAND flash memory boot - -NCON: NAND flash memory selection (Normal / Advance) -0: Normal NAND flash (256Words/512Bytes page size, 3/4 address cycle) -1: Advance NAND flash (1KWords/2KBytes page size, 4/5 address cycle) - -*/ - -READ32_MEMBER(mini2440_state::s3c2440_core_pin_r) -{ - int data = 0; - switch (offset) - { - case S3C2440_CORE_PIN_NCON : data = 1; break; - case S3C2440_CORE_PIN_OM0 : data = 0; break; - case S3C2440_CORE_PIN_OM1 : data = 0; break; - } - return data; -} - -// NAND - -WRITE8_MEMBER(mini2440_state::s3c2440_nand_command_w ) -{ - m_nand->command_w(data); -} - -WRITE8_MEMBER(mini2440_state::s3c2440_nand_address_w ) -{ - m_nand->address_w(data); -} - -READ8_MEMBER(mini2440_state::s3c2440_nand_data_r ) -{ - return m_nand->data_r(); -} - -WRITE8_MEMBER(mini2440_state::s3c2440_nand_data_w ) -{ - m_nand->data_w(data); -} - -// I2S - -WRITE16_MEMBER(mini2440_state::s3c2440_i2s_data_w ) -{ - if ( offset ) - m_dac1->write_signed16(data + 0x8000); - else - m_dac2->write_signed16(data + 0x8000); -} - -// ADC - -READ32_MEMBER(mini2440_state::s3c2440_adc_data_r ) -{ - UINT32 data = 0; - switch (offset) - { - case 2 + 0 : data = m_penx->read(); break; - case 2 + 1 : data = 915 - m_peny->read() + 90; break; - } - verboselog(5, "s3c2440_adc_data_r %08X\n", data); - return data; -} - -// TOUCH - -INPUT_CHANGED_MEMBER(mini2440_state::mini2440_input_changed) -{ - m_s3c2440->s3c2440_touch_screen( (newval & 0x01) ? 1 : 0); -} - -// ... - -void mini2440_state::machine_start() -{ - m_nand->set_data_ptr(memregion("nand")->base()); -} - -void mini2440_state::machine_reset() -{ - m_maincpu->reset(); - memset( m_port, 0, sizeof( m_port)); -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( mini2440_map, AS_PROGRAM, 32, mini2440_state ) -// AM_RANGE(0x00000000, 0x001fffff) AM_ROM - AM_RANGE(0x30000000, 0x37ffffff) AM_RAM -ADDRESS_MAP_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -DRIVER_INIT_MEMBER(mini2440_state,mini2440) -{ - // do nothing -} - -static MACHINE_CONFIG_START( mini2440, mini2440_state ) - MCFG_CPU_ADD("maincpu", ARM920T, 400000000) - MCFG_CPU_PROGRAM_MAP(mini2440_map) - - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1024, 768) - MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 319) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_SCREEN_UPDATE_DEVICE("s3c2440", s3c2440_device, screen_update) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("dac1", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ADD("dac2", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) - - MCFG_DEVICE_ADD("s3c2440", S3C2440, 12000000) - MCFG_S3C2440_PALETTE("palette") - MCFG_S3C2440_CORE_PIN_R_CB(READ32(mini2440_state, s3c2440_core_pin_r)) - MCFG_S3C2440_GPIO_PORT_R_CB(READ32(mini2440_state, s3c2440_gpio_port_r)) - MCFG_S3C2440_GPIO_PORT_W_CB(WRITE32(mini2440_state, s3c2440_gpio_port_w)) - MCFG_S3C2440_ADC_DATA_R_CB(READ32(mini2440_state, s3c2440_adc_data_r)) - MCFG_S3C2440_I2S_DATA_W_CB(WRITE16(mini2440_state, s3c2440_i2s_data_w)) - MCFG_S3C2440_NAND_COMMAND_W_CB(WRITE8(mini2440_state, s3c2440_nand_command_w)) - MCFG_S3C2440_NAND_ADDRESS_W_CB(WRITE8(mini2440_state, s3c2440_nand_address_w)) - MCFG_S3C2440_NAND_DATA_R_CB(READ8(mini2440_state, s3c2440_nand_data_r)) - MCFG_S3C2440_NAND_DATA_W_CB(WRITE8(mini2440_state, s3c2440_nand_data_w)) - - MCFG_DEVICE_ADD("nand", NAND, 0) - MCFG_NAND_TYPE(NAND_CHIP_K9F1G08U0B) - MCFG_NAND_RNB_CALLBACK(DEVWRITELINE("s3c2440", s3c2440_device, frnb_w)) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( mini2440 ) - PORT_START( "PENB" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Pen Button") PORT_CHANGED_MEMBER(DEVICE_SELF, mini2440_state, mini2440_input_changed, NULL) PORT_PLAYER(1) - PORT_START( "PENX" ) - PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_X ) PORT_NAME("Pen X") PORT_MINMAX(80, 950) PORT_SENSITIVITY(50) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_KEYDELTA(30) PORT_PLAYER(1) - PORT_START( "PENY" ) - PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_Y ) PORT_NAME("Pen Y") PORT_MINMAX(90, 915) PORT_SENSITIVITY(50) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_KEYDELTA(30) PORT_PLAYER(1) -INPUT_PORTS_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -ROM_START( mini2440 ) - ROM_REGION( 0x8400000, "nand", 0 ) - ROM_SYSTEM_BIOS( 0, "linux", "Linux 2.6.29.4-FriendlyARM + Qtopia 2.2.0 (2009/07/08)" ) - ROMX_LOAD( "linux.bin", 0, 0x8400000, CRC(7c98b249) SHA1(7c2e76edcbbcbfc3f3b0e53fb42d3e5c96e9a9fb), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "wince", "Windows Embedded CE 6.00 (2011/03/14)" ) - ROMX_LOAD( "wince.bin", 0, 0x8400000, CRC(6acd56b8) SHA1(d039968820348fb1169827fa12b38b94e80a076f), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "android", "Android 1.5 (2009/05/13)" ) - ROMX_LOAD( "android.bin", 0, 0x8400000, CRC(4721837d) SHA1(88fcf553b106d9fc624c9615d9c1da9c705ccb46), ROM_BIOS(3) ) -ROM_END - -COMP(2009, mini2440, 0, 0, mini2440, mini2440, mini2440_state, mini2440, "FriendlyARM", "Mini2440", 0) diff --git a/src/mess/drivers/minicom.c b/src/mess/drivers/minicom.c deleted file mode 100644 index f5ac1f0aed4..00000000000 --- a/src/mess/drivers/minicom.c +++ /dev/null @@ -1,254 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders: Felipe Sanches -/*************************************************************************** - - Ultratec Minicom IV - http://www.ultratec.com/ttys/non-printing/minicom.php - - Driver by Felipe Sanches - -There messages are displayed in a 20 digit 14 segment VFD. - - *********** - * * * * * - * * * * * - * * * * * - ***** ***** - * * * * * - * * * * * - * * * * * - *********** * - -Digits seem to be selected by a mux fed by a counter that is incremented by pulses in P1.2 -There may be a bit connected to the counter reset signal... - -Segment data is sent to each 14seg digit by first writing half of the data to port P0 and - toggling T0 and then the other half of data is written to P0 again but toggling T1 afterwards. - - Changelog: - - 2014 JUL 22 [Felipe Sanches]: - * Fixing alignment of 14-seg display multiplexation - - 2014 JUL 19 [Felipe Sanches]: - * Got the display working except for a few glitches - - 2014 JUL 16 [Felipe Sanches]: - * Initial driver skeleton -*/ - -#define LOG_IO_PORTS 0 -#define PRINTER_ATTACHED 1 - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "minicom.lh" - -class minicom_state : public driver_device -{ -public: - minicom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - - DECLARE_WRITE8_MEMBER(minicom_io_w); - DECLARE_READ8_MEMBER(minicom_io_r); - DECLARE_DRIVER_INIT(minicom); -private: - UINT8 m_p[4]; - UINT16 m_display_data; - int m_digit_index; - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(i87c52_io, AS_IO, 8, minicom_state) - AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(minicom_io_r, minicom_io_w) -ADDRESS_MAP_END - -void minicom_state::machine_start() -{ - // zerofill - memset(m_p, 0, 4); - m_digit_index = 0; - m_display_data = 0; - - // register for savestates - save_item(NAME(m_p)); - save_item(NAME(m_digit_index)); - save_item(NAME(m_display_data)); -} - -void minicom_state::machine_reset() -{ - m_digit_index = 19; - m_display_data = 0; - - for (int i=0; i<20; i++) - output_set_digit_value(i, 0); -} - -READ8_MEMBER(minicom_state::minicom_io_r) -{ - switch (offset) - { - case 1: - //P1.3 seems to be an indicator of whether or not we have a printer device attached. - // at address 0xABF the code checks this flag in order to decide which string to display: - // "MINIPRINT IS RESET" or "MINICOM IS RESET" - return PRINTER_ATTACHED << 3; - case 2: -// return 0; //para a palestra no Garoa... :-) - return 1; //to skip the "NO POWER" warning. I'm not sure why. - default: -#if LOG_IO_PORTS - printf("Unhandled I/O Read at offset 0x%02X (return 0)\n", offset); -#endif - return 0; - } -} - -#if LOG_IO_PORTS -static void printbits(UINT8 v) { - int i; - for(i = 7; i >= 0; i--) putchar('0' + ((v >> i) & 1)); -} -#endif - -#define FALLING_EDGE(old_data, new_data, bit) (BIT(old_data ^ new_data, bit) && !BIT(new_data, bit)) -#define RISING_EDGE(old_data, new_data, bit) (BIT(old_data ^ new_data, bit) && BIT(new_data, bit)) - -#define P1_UNKNOWN_BITS (0xFF & ~(1 << 2)) -#define P2_UNKNOWN_BITS 0xFF -#define P3_UNKNOWN_BITS (0xFF & ~((1 << 4)|(1 << 5))) -WRITE8_MEMBER(minicom_state::minicom_io_w) -{ - switch (offset) - { - case 0x00: - { - if (data != m_p[offset]) - { - m_p[offset]=data; - - //Bit P0.1 is the serial-input of a 20-bit shift register (made of a couple of chained UCN5810AF chips) - //We are emulating the display based on the assumption that the firmware will multiplex it by defining one digit at a given time - //It would be better (in terms of being closer to the actual hardware) to emulate the 20 bit shift register and update all digits - //for which a bit is TTL high. It seems to me that in the real hardware that would result in dimmer brightness in the display and it - //does not seem trivial to me to implement this using our current layout system. I'm leaving this note to whoever finds it exciting - //to explore these possibilities (perhaps myself in the future?). - if (BIT(data,1)){ - m_digit_index = 0; - } - } - break; - } - case 0x01: - { - if (data != m_p[offset]) - { -#if LOG_IO_PORTS - UINT8 changed = m_p[offset] ^ data; - if (changed ^ P1_UNKNOWN_BITS) - { - printf("Write to P1: %02X changed: ( ) (", data); - printbits(changed); - printf(") ( ) ( )\n"); - } -#endif - if (FALLING_EDGE(m_p[offset], data, 2)) - { - m_digit_index--; - if (m_digit_index<0) m_digit_index = 19; - } - m_p[offset]=data; - } - break; - } - case 0x02: - { - if (data != m_p[offset]) - { -#if LOG_IO_PORTS - UINT8 changed = m_p[offset] ^ data; - if (changed ^ P2_UNKNOWN_BITS) - { - printf("Write to P2: %02X changed: ( ) ( ) (", data); - printbits(changed); - printf(") ( )\n"); - } -#endif - m_p[offset]=data; - } - break; - } - case 0x03: - { - if (data != m_p[offset]) - { - UINT8 changed = m_p[offset] ^ data; -#if LOG_IO_PORTS - if (changed ^ P3_UNKNOWN_BITS) - { - printf("Write to P3: %02X changed: ( ) ( ) ( ) (", data); - printbits(changed); - printf(")\n"); - } -#endif - - if (FALLING_EDGE(m_p[offset], data, 4)) //P3.4 = T0 - { - m_display_data &= 0xFF00; - m_display_data |= m_p[0]; - } - - if (FALLING_EDGE(m_p[offset], data, 5)) //P3.5 = T1 - { - m_display_data &= 0xFF; - m_display_data |= (m_p[0] << 8); - } - - if (BIT(changed,4) || BIT(changed,5)) - { - output_set_digit_value(m_digit_index, BITSWAP16(m_display_data, 9, 1, 3, 11, 12, 4, 2, 10, 14, 6, 7, 5, 0, 15, 13, 8) & 0x3FFF); - } - m_p[offset]=data; - } - break; - } - } -} - -DRIVER_INIT_MEMBER( minicom_state, minicom ) -{ -} - -static MACHINE_CONFIG_START( minicom, minicom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I87C52, XTAL_10MHz) /*FIX-ME: verify the correct clock frequency */ - MCFG_CPU_IO_MAP(i87c52_io) - - /* video hardware */ - /* fluorescent 14-segment display forming a row of 20 characters */ - MCFG_DEFAULT_LAYOUT(layout_minicom) - -/* TODO: Map the keyboard rows/cols inputs (43-key, 4-row keyboard) */ - -/* TODO: Treat the modem as a sound device. That may be an interesting challenge... :-) */ -MACHINE_CONFIG_END - -ROM_START( minicom ) - ROM_REGION( 0x2000, "maincpu", 0 ) - ROM_LOAD( "ultratec_minicom_iv.rom", 0x0000, 0x2000, CRC(22881366) SHA1(fc3faea5ecc1476e5bcb7999638f3150d06c9a81) ) -ROM_END - -ROM_START( mcom4_02 ) - ROM_REGION( 0x2000, "maincpu", 0 ) - ROM_LOAD( "ultratec_minicom_iv_20020419.rom", 0x0000, 0x2000, CRC(99b6cc35) SHA1(32577005bf02042f893c8880f8ce5b3d8a5f55f9) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1997, minicom, 0, 0, minicom, 0, minicom_state, minicom, "Ultratec", "Minicom IV (1997-08-11)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) /* fw release data: 11th Aug 1997 */ -COMP( 2002, mcom4_02, 0, 0, minicom, 0, minicom_state, minicom, "Ultratec", "Minicom IV (2002-04-19)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) /* fw release data: 19th Apr 2002 */ diff --git a/src/mess/drivers/mits680b.c b/src/mess/drivers/mits680b.c deleted file mode 100644 index f0f0d24ed15..00000000000 --- a/src/mess/drivers/mits680b.c +++ /dev/null @@ -1,117 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - MITS Altair 680b - - 03/12/2009 Skeleton driver. - - 08/June/2011 connected to a terminal - -Monitor Commands: -J -L switch to terminal mode -M -N modify memory in a limited way -P this does a rti and causes a momentary crash. Weird. - - -ToDo: -- Hook ACIA back up, when there is some way to use it. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "machine/mos6551.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class mits680b_state : public driver_device -{ -public: - mits680b_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(terminal_status_r); - DECLARE_READ8_MEMBER(terminal_r); - DECLARE_READ8_MEMBER(status_check_r); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_term_data; - virtual void machine_reset(); -}; - -READ8_MEMBER( mits680b_state::status_check_r ) -{ - return 0; // crashes at start if bit 7 high -} - -READ8_MEMBER( mits680b_state::terminal_status_r ) -{ - return (m_term_data) ? 3 : 2; -} - -READ8_MEMBER( mits680b_state::terminal_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - - -static ADDRESS_MAP_START(mits680b_mem, AS_PROGRAM, 8, mits680b_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x03ff ) AM_RAM // 1024 bytes RAM - //AM_RANGE( 0xf000, 0xf003 ) AM_DEVREADWRITE("acia", mos6551_device, read, write ) - AM_RANGE( 0xf000, 0xf000 ) AM_READ(terminal_status_r) - AM_RANGE( 0xf001, 0xf001 ) AM_READ(terminal_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE( 0xf002, 0xf002 ) AM_READ(status_check_r) - AM_RANGE( 0xff00, 0xffff ) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mits680b ) -INPUT_PORTS_END - - -void mits680b_state::machine_reset() -{ - m_term_data = 0; -} - -WRITE8_MEMBER( mits680b_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( mits680b, mits680b_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6800, XTAL_1MHz / 2) - MCFG_CPU_PROGRAM_MAP(mits680b_mem) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(mits680b_state, kbd_put)) - - /* acia */ - //MCFG_ACIA6551_ADD("acia") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mits680b ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mits680b.bin", 0xff00, 0x0100, CRC(397e717f) SHA1(257d3eb1343b8611dc05455aeed33615d581f29c)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1976, mits680b, 0, 0, mits680b, mits680b, driver_device, 0, "MITS", "Altair 680b", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mk1.c b/src/mess/drivers/mk1.c deleted file mode 100644 index 22d18396d2c..00000000000 --- a/src/mess/drivers/mk1.c +++ /dev/null @@ -1,209 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - - mk1.c - -Driver file to handle emulation of the Novag/Videomaster Chess Champion MK 1 -by PeT mess@utanet.at 2000,2001. - -Minor updates by Wilbert Pol - 2007 - -Hardware descriptions: -- An F8 3850 CPU accompanied by a 3853 memory interface - Variations seen: - - MOSTEK MK 3853N 7915 Philippines ( static memory interface for f8) - - MOSTEK MK 3850N-3 7917 Philipines (fairchild f8 cpu) - - 3850PK F7901 SINGAPORE (Fairchild F8 CPU) - - 3853PK F7851 SINGAPORE (static memory interface for F8) -- 2KB 2316 compatible ROM - Variations seen: - - Signetics 7916E C48091 82S210-1 COPYRIGHT - - RO-3-8316A 8316A-4480 7904 TAIWAN -- 2 x 2111 256x4 SRAM to provide 256 bytes of RAM - Variations seen: - - AM9111 BPC / P2111A-4 7851 -- 16 keys placed in a 4 x 4 matrix -- Power on switch -- L/S switch. This switch is directly tied to the RESET pin of the F8 CPU. - This allows the user to reset the CPU without destroying the RAM contents. -- A 4 character 11 segment digit display using a 15 pin interface. Of the 15 - pins 3 pins are not connected, so three segments are never used and this - leaves a standard 7 segments display with a dot in the lower right. -- The digit display is driven by two other components: - - SN75492N MALAYSIA 7840B - - ULN2033A 7847 -- Hardware addressing is controlled by a NBF4001AE. -- Unknown if there is a speaker. - -TODO: -- Figure out exact clock frequency - -******************************************************************************/ - -#include "emu.h" -#include "cpu/f8/f8.h" -#include "machine/f3853.h" -#include "mk1.lh" - - -class mk1_state : public driver_device -{ -public: - mk1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_READ8_MEMBER(mk1_f8_r); - DECLARE_WRITE8_MEMBER(mk1_f8_w); - UINT8 m_f8[2]; - UINT8 m_led[4]; - virtual void machine_start(); - TIMER_DEVICE_CALLBACK_MEMBER(mk1_update_leds); - F3853_INTERRUPT_REQ_CB(mk1_interrupt); - required_device m_maincpu; -}; - - -#define MAIN_CLOCK 1000000 - - -READ8_MEMBER( mk1_state::mk1_f8_r ) -{ - UINT8 i, data = m_f8[offset]; - - if ( offset == 0 ) - { - if (BIT(data, 0)) data |= ioport("LINE1")->read(); - if (BIT(data, 1)) data |= ioport("LINE2")->read(); - if (BIT(data, 2)) data |= ioport("LINE3")->read(); - if (BIT(data, 3)) data |= ioport("LINE4")->read(); - - for (i = 4; i < 8; i++) - { - if (BIT(data, i)) - { - if (BIT(ioport("LINE1")->read(), i)) data |= 1; - if (BIT(ioport("LINE2")->read(), i)) data |= 2; - if (BIT(ioport("LINE3")->read(), i)) data |= 4; - if (BIT(ioport("LINE4")->read(), i)) data |= 8; - } - } - } - return data; -} - -WRITE8_MEMBER( mk1_state::mk1_f8_w ) -{ - /* 0 is high and allows also input */ - m_f8[offset] = data; - - if ( ! ( m_f8[1] & 1 ) ) m_led[0] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 2 ) ) m_led[1] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 4 ) ) m_led[2] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 8 ) ) m_led[3] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 ); -} - -static ADDRESS_MAP_START( mk1_mem, AS_PROGRAM, 8, mk1_state ) - AM_RANGE( 0x0000, 0x07ff ) AM_ROM - AM_RANGE( 0x1800, 0x18ff ) AM_RAM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( mk1_io, AS_IO, 8, mk1_state ) - AM_RANGE( 0x0, 0x1 ) AM_READWRITE( mk1_f8_r, mk1_f8_w ) - AM_RANGE( 0xc, 0xf ) AM_DEVREADWRITE("f3853", f3853_device, read, write ) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( mk1 ) - PORT_START("RESET") /* 0 */ - PORT_DIPNAME ( 0x01, 0x01, "Switch") - PORT_DIPSETTING( 0, "L" ) - PORT_DIPSETTING( 1, "S" ) - - PORT_START("LINE1") /* 1 */ - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White A King") PORT_CODE(KEYCODE_A) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White B Queen") PORT_CODE(KEYCODE_B) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White C Bishop") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White D PLAY") PORT_CODE(KEYCODE_D) - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("LINE2") /* 2 */ - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White E Knight") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White F Castle") PORT_CODE(KEYCODE_F) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White G Pawn") PORT_CODE(KEYCODE_G) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White H md") PORT_CODE(KEYCODE_H) - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("LINE3") /* 3 */ - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 1 King") PORT_CODE(KEYCODE_1) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 2 Queen") PORT_CODE(KEYCODE_2) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 3 Bishop") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 4 fp") PORT_CODE(KEYCODE_4) - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("LINE4") /* 4 */ - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 5 Knight") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 6 Castle") PORT_CODE(KEYCODE_6) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 7 Pawn") PORT_CODE(KEYCODE_7) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black 8 ep") PORT_CODE(KEYCODE_8) - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -TIMER_DEVICE_CALLBACK_MEMBER(mk1_state::mk1_update_leds) -{ - for (int i = 0; i < 4; i++) - { - output_set_digit_value(i, m_led[i] >> 1); - output_set_led_value(i, m_led[i] & 0x01); - m_led[i] = 0; - } -} - - -void mk1_state::machine_start() -{ -} - - -F3853_INTERRUPT_REQ_CB(mk1_state::mk1_interrupt) -{ - m_maincpu->set_input_line_vector(F8_INPUT_LINE_INT_REQ, addr); - m_maincpu->set_input_line(F8_INPUT_LINE_INT_REQ, level ? ASSERT_LINE : CLEAR_LINE); -} - -static MACHINE_CONFIG_START( mk1, mk1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", F8, MAIN_CLOCK ) /* MK3850 */ - MCFG_CPU_PROGRAM_MAP(mk1_mem) - MCFG_CPU_IO_MAP(mk1_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - - MCFG_DEVICE_ADD("f3853", F3853, MAIN_CLOCK) - MCFG_F3853_EXT_INPUT_CB(mk1_state, mk1_interrupt) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mk1) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", mk1_state, mk1_update_leds, attotime::from_hz(30)) -MACHINE_CONFIG_END - - -ROM_START( ccmk1 ) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("82c210-1", 0x0000, 0x800, CRC(278f7bf3) SHA1(b384c95ba691d52dfdddd35987a71e9746a46170)) -ROM_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -// seams to be developed by mostek (MK) -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1979, ccmk1, 0, 0, mk1, mk1, driver_device, 0, "Computer Electronic", "Chess Champion MK I", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/mk14.c b/src/mess/drivers/mk14.c deleted file mode 100644 index ba30757020b..00000000000 --- a/src/mess/drivers/mk14.c +++ /dev/null @@ -1,163 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Science of Cambridge MK-14 - - 20/11/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/scmp/scmp.h" -#include "machine/ins8154.h" -#include "mk14.lh" - - -class mk14_state : public driver_device -{ -public: - mk14_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(display_w); - virtual void machine_reset(); - required_device m_maincpu; -}; - -/* -000-1FF 512 byte SCIOS ROM Decoded by 0xxx -200-3FF ROM Shadow / Expansion RAM -400-5FF ROM Shadow / Expansion RAM -600-7FF ROM Shadow / Expansion RAM -800-87F 128 bytes I/O chip RAM Decoded by 1xx0 -880-8FF I/O Ports Decoded by 1xx0 -900-9FF Keyboard & Display Decoded by 1x01 -A00-AFF I/O Port & RAM Shadow -B00-BFF 256 bytes RAM (Extended) / VDU RAM Decoded by 1011 -C00-CFF I/O Port & RAM Shadow -D00-DFF Keyboard & Display Shadow -E00-EFF I/O Port & RAM Shadow -F00-FFF 256 bytes RAM (Standard) / VDU RAM Decoded by 1111 - -*/ - - -READ8_MEMBER( mk14_state::keyboard_r ) -{ - if (offset < 8) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",offset); - return ioport(kbdrow)->read(); - } - else - return 0xff; -} - -WRITE8_MEMBER( mk14_state::display_w ) -{ - if (offset < 8 ) - output_set_digit_value(offset, data); - else - { - //logerror("write %02x to %02x\n",data,offset); - } -} - -static ADDRESS_MAP_START(mk14_mem, AS_PROGRAM, 8, mk14_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x0fff) - AM_RANGE(0x000, 0x1ff) AM_ROM AM_MIRROR(0x600) // ROM - AM_RANGE(0x800, 0x87f) AM_RAM AM_MIRROR(0x600) // 128 I/O chip RAM - AM_RANGE(0x880, 0x8ff) AM_DEVREADWRITE("ic8", ins8154_device, ins8154_r, ins8154_w) AM_MIRROR(0x600) // I/O - AM_RANGE(0x900, 0x9ff) AM_READWRITE(keyboard_r, display_w) AM_MIRROR(0x400) - AM_RANGE(0xb00, 0xbff) AM_RAM // VDU RAM - AM_RANGE(0xf00, 0xfff) AM_RAM // Standard RAM -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( mk14 ) - PORT_START("X0") - PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_START("X1") - PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_START("X2") - PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_START("X3") - PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_START("X4") - PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("AB") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_START("X5") - PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_START("X6") - PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_START("X7") - PORT_BIT(0x0F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TERM") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) -INPUT_PORTS_END - - -void mk14_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( mk14, mk14_state ) - /* basic machine hardware */ - // IC1 1SP-8A/600 (8060) SC/MP Microprocessor - MCFG_CPU_ADD("maincpu", INS8060, XTAL_4_433619MHz) - MCFG_CPU_PROGRAM_MAP(mk14_mem) - - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mk14) - - /* devices */ - MCFG_DEVICE_ADD("ic8", INS8154, 0) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mk14 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // IC2,3 74S571 512 x 4 bit ROM - ROM_LOAD( "scios.bin", 0x0000, 0x0200, CRC(8b667daa) SHA1(802dc637ce5391a2a6627f76f919b12a869b56ef)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, mk14, 0, 0, mk14, mk14, driver_device, 0, "Science of Cambridge", "MK-14", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mk2.c b/src/mess/drivers/mk2.c deleted file mode 100644 index cd929668fed..00000000000 --- a/src/mess/drivers/mk2.c +++ /dev/null @@ -1,225 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - PeT mess@utanet.at September 2000 - -chess champion mk II - -MOS MPS 6504 2179 -MOS MPS 6530 024 1879 - layout of 6530 dumped with my adapter - 0x1300-0x133f io - 0x1380-0x13bf ram - 0x1400-0x17ff rom - -2x2111 ram (256x4?) -MOS MPS 6332 005 2179 -74145 bcd to decimal encoder (10 low active select lines) -(7400) - -4x 7 segment led display (each with dot) -4 single leds -21 keys - - -83, 84 contains display variables - - -port a - 0..7 led output - 0..6 keyboard input - -port b - 0..5 outputs - 0 speaker out - 6 as chipselect used!? - 7 interrupt out? - - c4, c5, keyboard polling - c0, c1, c2, c3 led output - -Usage: - - under the black keys are operations to be added as first sign - black and white box are only changing the player - - for the computer to start as white - switch to black (h enter) - swap players (g enter) - -******************************************************************************/ - -#include "emu.h" -#include "machine/mos6530.h" -#include "cpu/m6502/m6504.h" -#include "sound/speaker.h" -#include "mk2.lh" - - -class mk2_state : public driver_device -{ -public: - mk2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_miot(*this, "miot") - { } - - required_device m_maincpu; - required_device m_speaker; - required_device m_miot; - DECLARE_READ8_MEMBER(mk2_read_a); - DECLARE_WRITE8_MEMBER(mk2_write_a); - DECLARE_READ8_MEMBER(mk2_read_b); - DECLARE_WRITE8_MEMBER(mk2_write_b); - UINT8 m_led[5]; - virtual void machine_start(); - TIMER_DEVICE_CALLBACK_MEMBER(update_leds); -}; - - -// only lower 12 address bits on bus! -static ADDRESS_MAP_START(mk2_mem , AS_PROGRAM, 8, mk2_state) - AM_RANGE( 0x0000, 0x01ff) AM_RAM // 2 2111, should be mirrored - AM_RANGE( 0x0b00, 0x0b0f) AM_DEVREADWRITE("miot", mos6530_device, read, write) - AM_RANGE( 0x0b80, 0x0bbf) AM_RAM // rriot ram - AM_RANGE( 0x0c00, 0x0fff) AM_ROM // rriot rom - AM_RANGE( 0x1000, 0x1fff) AM_ROM -ADDRESS_MAP_END - -static INPUT_PORTS_START( mk2 ) - PORT_START("EXTRA") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW GAME") PORT_CODE(KEYCODE_F3) // seems to be direct wired to reset - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_START("BLACK") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black A Black") PORT_CODE(KEYCODE_A) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black B Field") PORT_CODE(KEYCODE_B) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black C Time?") PORT_CODE(KEYCODE_C) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black D Time?") PORT_CODE(KEYCODE_D) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black E Time off?") PORT_CODE(KEYCODE_E) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black F LEVEL") PORT_CODE(KEYCODE_F) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black G Swap") PORT_CODE(KEYCODE_G) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Black H White") PORT_CODE(KEYCODE_H) - PORT_START("WHITE") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("White 8") PORT_CODE(KEYCODE_8) -INPUT_PORTS_END - - -TIMER_DEVICE_CALLBACK_MEMBER(mk2_state::update_leds) -{ - int i; - - for (i=0; i<4; i++) - output_set_digit_value(i, m_led[i]); - - output_set_led_value(0, BIT(m_led[4], 3)); - output_set_led_value(1, BIT(m_led[4], 5)); - output_set_led_value(2, BIT(m_led[4], 4)); - output_set_led_value(3, BIT(m_led[4], 4) ? 0 : 1); - - m_led[0]= m_led[1]= m_led[2]= m_led[3]= m_led[4]= 0; -} - -void mk2_state::machine_start() -{ -} - -READ8_MEMBER( mk2_state::mk2_read_a ) -{ - int data=0xff; - int help=ioport("BLACK")->read() | ioport("WHITE")->read(); // looks like white and black keys are the same! - - switch (m_miot->portb_out_get()&0x7) - { - case 4: - if (BIT(help, 5)) data&=~0x1; //F - if (BIT(help, 4)) data&=~0x2; //E - if (BIT(help, 3)) data&=~0x4; //D - if (BIT(help, 2)) data&=~0x8; // C - if (BIT(help, 1)) data&=~0x10; // B - if (BIT(help, 0)) data&=~0x20; // A - break; - case 5: - if (BIT(ioport("EXTRA")->read(), 2)) data&=~0x8; // Enter - if (BIT(ioport("EXTRA")->read(), 1)) data&=~0x10; // Clear - if (BIT(help, 7)) data&=~0x20; // H - if (BIT(help, 6)) data&=~0x40; // G - break; - } - return data; -} - -WRITE8_MEMBER( mk2_state::mk2_write_a ) -{ - UINT8 temp = m_miot->portb_out_get(); - - m_led[temp & 3] |= data; -} - - -READ8_MEMBER( mk2_state::mk2_read_b ) -{ - return 0xff&~0x40; // chip select mapped to pb6 -} - - -WRITE8_MEMBER( mk2_state::mk2_write_b ) -{ - if ((data & 0x06) == 0x06) - m_speaker->level_w(BIT(data, 0)); - - m_led[4]|=data; - - m_maincpu->set_input_line(M6502_IRQ_LINE, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE ); -} - - -static MACHINE_CONFIG_START( mk2, mk2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6504, 1000000) - MCFG_CPU_PROGRAM_MAP(mk2_mem) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mk2) - - MCFG_DEVICE_ADD("miot", MOS6530, 1000000) - MCFG_MOS6530_IN_PA_CB(READ8(mk2_state, mk2_read_a)) - MCFG_MOS6530_OUT_PA_CB(WRITE8(mk2_state, mk2_write_a)) - MCFG_MOS6530_IN_PB_CB(READ8(mk2_state, mk2_read_b)) - MCFG_MOS6530_OUT_PB_CB(WRITE8(mk2_state, mk2_write_b)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", mk2_state, update_leds, attotime::from_hz(60)) -MACHINE_CONFIG_END - - -ROM_START(ccmk2) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("024_1879", 0x0c00, 0x0400, CRC(4f28c443) SHA1(e33f8b7f38e54d7a6e0f0763f2328cc12cb0eade)) - ROM_LOAD("005_2179", 0x1000, 0x1000, CRC(6f10991b) SHA1(90cdc5a15d9ad813ad20410f21081c6e3e481812)) // chess mate 7.5 -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -CONS( 1979, ccmk2, 0, 0, mk2, mk2, driver_device, 0, "Quelle International", "Chess Champion MK II", 0) -// second design sold (same computer/program?) diff --git a/src/mess/drivers/mk85.c b/src/mess/drivers/mk85.c deleted file mode 100644 index c84df818ed9..00000000000 --- a/src/mess/drivers/mk85.c +++ /dev/null @@ -1,92 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Elektronika MK-85 - - 12/05/2009 Skeleton driver. - - http://www.taswegian.com/MOSCOW/mk-85.html - -This is a Soviet computer-calculator, very similar in looks to the Sharp. -It has a LCD display. - -Models: - MK-85: 2K of RAM - MK-85M: 6K of RAM - MK-85C: Military cryptographic device. Typing text into it produces - a string of numbers. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/t11/t11.h" - - -class mk85_state : public driver_device -{ -public: - mk85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_mk85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(mk85_mem, AS_PROGRAM, 16, mk85_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x3fff ) AM_ROM AM_MIRROR(0x4000) - AM_RANGE( 0x8000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mk85 ) -INPUT_PORTS_END - - -void mk85_state::machine_reset() -{ -} - -void mk85_state::video_start() -{ -} - -UINT32 mk85_state::screen_update_mk85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( mk85, mk85_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_4MHz) - MCFG_T11_INITIAL_MODE(0) - MCFG_CPU_PROGRAM_MAP(mk85_mem) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(mk85_state, screen_update_mk85) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mk85 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mk85.rom", 0x0000, 0x4000, CRC(398e4fd1) SHA1(5e2f877d0f451b46840f01190004552bad5248c8)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, mk85, 0, 0, mk85, mk85, driver_device, 0, "Elektronika", "MK-85", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mk90.c b/src/mess/drivers/mk90.c deleted file mode 100644 index 3f9249a899f..00000000000 --- a/src/mess/drivers/mk90.c +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Elektronika MK-90 - - 12/05/2009 Skeleton driver. - - - http://www.pisi.com.pl/piotr433/index.htm#mk90 - http://www.taswegian.com/MOSCOW/mk-90.html - -This is a Soviet computer-calculator, very similar in looks to the Sharp. -It has a LCD display. It cost about 1500 roubles, which is the wages for 6 -months for an average citizen. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/t11/t11.h" - - -class mk90_state : public driver_device -{ -public: - mk90_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_mk90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(mk90_mem, AS_PROGRAM, 16, mk90_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_RAM // RAM - AM_RANGE(0x4000, 0x7fff) AM_ROM // Extension ROM - AM_RANGE(0x8000, 0xffff) AM_ROM // Main ROM -// AM_RANGE(0xe800, 0xe801) LCD address -// AM_RANGE(0xe802, 0xe803) LCD data -// AM_RANGE(0xe810, 0xe810) serial bus controller data -// AM_RANGE(0xe812, 0xe813) serial bus controller transfer rate -// AM_RANGE(0xe814, 0xe814) serial bus controller control/status -// AM_RANGE(0xe816, 0xe816) serial bus controller command -// AM_RANGE(0xea00, 0xea7e) RTC -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mk90 ) -INPUT_PORTS_END - - -void mk90_state::machine_reset() -{ -} - -void mk90_state::video_start() -{ -} - -UINT32 mk90_state::screen_update_mk90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( mk90, mk90_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_4MHz) - MCFG_T11_INITIAL_MODE(0x8000) - MCFG_CPU_PROGRAM_MAP(mk90_mem) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(mk90_state, screen_update_mk90) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mk90 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "bas1", "Basic 1") - ROMX_LOAD( "mk90ro10.bin", 0x8000, 0x8000, CRC(fac18038) SHA1(639f09a1be5f781f897603d0f799f7c6efd1b67f), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS(1, "bas2", "Basic 2") - ROMX_LOAD( "mk90ro20.bin", 0x8000, 0x8000, CRC(d8b3a5f5) SHA1(8f7ab2d97c7466392b6354c0ea7017531c2133ae), ROM_BIOS(2)) - ROMX_LOAD( "mk90ro20t.bin", 0x4000, 0x4000, CRC(0f4b9434) SHA1(c74bbde6d201913c9e67ef8e2abe14b784187f8d), ROM_BIOS(2)) // Expansion ROM -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, mk90, 0, 0, mk90, mk90, driver_device, 0, "Elektronika", "MK-90", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mkit09.c b/src/mess/drivers/mkit09.c deleted file mode 100644 index 1e39600ecd1..00000000000 --- a/src/mess/drivers/mkit09.c +++ /dev/null @@ -1,212 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Multitech Microkit09 - - 2013-12-08 Mostly working driver. - - The only documentation is in French, so the operation of the system - is a bit of a mystery. - -ToDo: - - Fix Cassette - - Need software to test with - -Pasting: - 0-F : as is - (inc) : ^ - (dec) : V - M (memory) : - - G (Go) : X - -Test Paste: - -0000 00^11^22^33^44^55^66^77^88^99^--0000 - Now press up-arrow to confirm the data has been entered. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/6821pia.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "mkit09.lh" - - -class mkit09_state : public driver_device -{ -public: - mkit09_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_pia(*this, "pia") - , m_cass(*this, "cassette") - , m_maincpu(*this, "maincpu") - { } - - DECLARE_READ8_MEMBER(pa_r); - DECLARE_READ8_MEMBER(pb_r); - DECLARE_WRITE8_MEMBER(pa_w); - DECLARE_WRITE8_MEMBER(pb_w); - DECLARE_INPUT_CHANGED_MEMBER(trigger_reset); - DECLARE_INPUT_CHANGED_MEMBER(trigger_nmi); -private: - UINT8 m_keydata; - virtual void machine_reset(); - required_device m_pia; - required_device m_cass; - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(mkit09_mem, AS_PROGRAM, 8, mkit09_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000,0x07ff) AM_MIRROR(0x1800) AM_RAM - AM_RANGE(0xa004,0xa007) AM_MIRROR(0x1ff8) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) - AM_RANGE(0xe000,0xe7ff) AM_MIRROR(0x1800) AM_ROM AM_REGION("roms", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mkit09_io, AS_IO, 8, mkit09_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mkit09 ) - PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Inc") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Dec") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_M) PORT_CHAR('-') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BP") PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("cnt") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ofs") PORT_CODE(KEYCODE_O) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, mkit09_state, trigger_reset, 0) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NMI") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, mkit09_state, trigger_nmi, 0) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER( mkit09_state::trigger_reset ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER( mkit09_state::trigger_nmi ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - - -void mkit09_state::machine_reset() -{ - m_keydata = 0; -} - -// read keyboard -READ8_MEMBER( mkit09_state::pa_r ) -{ - if (m_keydata < 4) - { - char kbdrow[4]; - sprintf(kbdrow,"X%d",m_keydata); - return ioport(kbdrow)->read(); - } - - return 0xff; -} - -// read cassette -READ8_MEMBER( mkit09_state::pb_r ) -{ - return m_keydata | ((m_cass->input() > +0.03) ? 0x80 : 0); -} - -// write display segments -WRITE8_MEMBER( mkit09_state::pa_w ) -{ - data ^= 0xff; - if (m_keydata > 3) - { - output_set_digit_value(m_keydata, BITSWAP8(data, 7, 0, 5, 6, 4, 2, 1, 3)); - m_keydata = 0; - } - - return; -} - -// write cassette, select keyboard row, select a digit -WRITE8_MEMBER( mkit09_state::pb_w ) -{ - m_cass->output(BIT(data, 6) ? -1.0 : +1.0); - m_keydata = data & 15; - return; -} - - -static MACHINE_CONFIG_START( mkit09, mkit09_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6809E, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(mkit09_mem) - MCFG_CPU_IO_MAP(mkit09_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mkit09) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(mkit09_state, pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(mkit09_state, pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(mkit09_state, pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(mkit09_state, pb_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mkit09 ) - ROM_REGION( 0x800, "roms", 0 ) - ROM_LOAD( "micromon.bin", 0x0000, 0x0800, CRC(c993c7c2) SHA1(2f54a2b423b925798f669f8a6d2cadeb8a82e968) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, mkit09, 0, 0, mkit09, mkit09, driver_device, 0, "Multitech", "Microkit09", 0 ) diff --git a/src/mess/drivers/mmd1.c b/src/mess/drivers/mmd1.c deleted file mode 100644 index 99c4f4569b0..00000000000 --- a/src/mess/drivers/mmd1.c +++ /dev/null @@ -1,531 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - MMD-1 & MMD-2 driver by Miodrag Milanovic - - 12/05/2009 Initial version - - 2011-JAN-12 MMD2 working {Robbbert] - -MMD-1 -***** - - It appears that you enter an 3 digit octal number and then hit a function key. - H - puts the number in the H register - L - puts the number in the L register - S - puts the number into memory pointed to by HL and then increments HL. - G - Loads the program counter with the contents of HL - -1) There is a 'working byte' which you can enter using the octal digits -(just press them in order), and which is displayed on the port 2 LEDs -when KEX is running. - -2) 'R' is a hardware reset - -3) 'H' and 'L' are used to load the address (high and low parts, and it -really is the HL register of the 8080). So to enter a particular address, -you type in the high half (in octal), press H. Then type in the low half -and press L. The address is displayed on the port 0 and port 1 LEDs when -KEX is running. - -4) 'S' is 'Step' or 'Store'. It stores the working byte at the current -address (in HL), and then increments the address. It's used to enter -bytes into memory - -5) 'G' is 'go'. It loads the 8080 PC with the address in HL, and thus -executes a program at that address. - -OK, this is what I would try. - -1) Press 'R' to reset the 8080 and start KEX running. - -2) Type 004 H 000 L to load the start address of your program. The bytes -should appear on the rightmost 8 LEDs as you enter them and should then -also appear on the left and middle sets of LEDs when you press H and L. - -3) Enter the program - -076 S 123 S 323 S 000 S 166S - -As you type each byte it should appear on the rightmost LEDs. When you -press S, the address on the rest of the LEDs should increment by 1. - -4) Re-enter the start address -004 H 000 L - -5) Press G to run the program. The left most LEDs should change to -.*.*..** (. = off, * = on), I think. The keys will then do nothing (as -the CPU is halted) until you press R again to re-run KEX. - -When is keyboard LINE3 scanned? it isn't - it's a reset button. - -MMD-2 -***** - -http://www.cs.unc.edu/~yakowenk/classiccmp/mmd2/ -Memory map: - - * 4K RAM addresses $0000..$0FFF - * ROM addresses $D800..$E7FF - * 256 bytes of RAM, ($FC00..$FCFF?) - -DIP switches: - - * WE 0 - Write enable for addresses $0000..$03FF - * WE 1 - Write enable for addresses $0400..$07FF - * WE 2 - Write enable for addresses $0800..$0BFF - * WE 3 - Write enable for addresses $0C00..$0FFF - * SPARE - ??? - * HEX OCT - choose display and entry to be in Hexadecimal or Octal - * PUP RESET - ??? - * EXEC USER - update binary LED's with data entry? Or not? - (in either setting, outputs to ports 0,1,2 still show) - -Operation: - - * Enter bytes on the keypad of hex digits - * Set MSByte of address by entering it on the keypad & pressing "HIGH". - * ... LSByte ... "LOW" - * Change contents of memory at the selected address by entering the new value & pressing "STORE". - * Look at adjacent memory locations with "NEXT" and "PREV". - * Execute the program at the selected address by pressing "GO". - -AUX functions: - - * BRL HI # - OFF disables BRL LO - * BRL LO # - * STEP # - * SRC HI # - source for COPY/DUMP - OFF disables "DUMP" function - * DES HI # - destination for COPY/DUMP - * LEN HI # - length for COPY/DUMP - * CLR TST ON - test if PROM is empty - * POP PRM ON - program a PROM - * DUP TST ON - test if PROM duplicated okay - * PROM 2708/2716 - * MEM MAP RAM/ROM - * BAUD 110/150/300/600/1200 - -The memory map can be rearranged by the system by using IN5, IN6, IN7. -A pair of undumped proms control what goes where on each map. -Each set of ROMs also has its own pair of PROMs. - - -I/O ports: -IN0: user expansion -IN1: 0-TTYIN, 1-CASSIN, 3-SW8(binary/ports), 4-SW7(reset/pup), 5-SW6(hex/oct), 6-(pup signal) -IN3: 8279 status -IN4: 8279 key -IN5: set MAP1 -IN6: set MAP2 -IN7: set MAP3 -IN8: read eprom (in the eprom programmer) -OUT0: PORT0 LEDs -OUT1: PORT1 LEDs -OUT2: PORT2 LEDs -OUT3: 8279 control -OUT4: 8279 7-segment LED data -OUT5: TTYOUT, CASSOUT -OUT9: turn pup signal off -OUTA: programming pulse on/off (eprom programmer) - -Dips: -SW1-4 hardware control of RAM being writable -SW5 not used -SW6 Control if the 7-segment displays show Octal (low) or Hex (high). -SW7 Reset only causes the cpu to perform a warm start. PUP does a cold start (Power-UP). -SW8 Control if the PORT displays echo the 7-segment displays (high), or just act as normal output ports (low). - - -ToDo -- Hook up reset key and dipswitch -- Add interrupt module (INTE LED is always on atm) -- Lots of other things - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8279.h" -#include "mmd1.lh" -#include "mmd2.lh" - - -class mmd1_state : public driver_device -{ -public: - mmd1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_WRITE8_MEMBER(mmd1_port0_w); - DECLARE_WRITE8_MEMBER(mmd1_port1_w); - DECLARE_WRITE8_MEMBER(mmd1_port2_w); - DECLARE_READ8_MEMBER(mmd1_keyboard_r); - DECLARE_READ8_MEMBER(mmd2_01_r); - DECLARE_READ8_MEMBER(mmd2_bank_r); - DECLARE_READ8_MEMBER(mmd2_kbd_r); - DECLARE_WRITE8_MEMBER(mmd2_scanlines_w); - DECLARE_WRITE8_MEMBER(mmd2_digit_w); - DECLARE_WRITE8_MEMBER(mmd2_status_callback); - DECLARE_WRITE_LINE_MEMBER(mmd2_inte_callback); - UINT8 m_return_code; - UINT8 m_digit; - DECLARE_DRIVER_INIT(mmd2); - DECLARE_MACHINE_RESET(mmd1); - DECLARE_MACHINE_RESET(mmd2); - required_device m_maincpu; -}; - - -WRITE8_MEMBER( mmd1_state::mmd1_port0_w ) -{ - output_set_value("p0_7", BIT(data,7) ? 0 : 1); - output_set_value("p0_6", BIT(data,6) ? 0 : 1); - output_set_value("p0_5", BIT(data,5) ? 0 : 1); - output_set_value("p0_4", BIT(data,4) ? 0 : 1); - output_set_value("p0_3", BIT(data,3) ? 0 : 1); - output_set_value("p0_2", BIT(data,2) ? 0 : 1); - output_set_value("p0_1", BIT(data,1) ? 0 : 1); - output_set_value("p0_0", BIT(data,0) ? 0 : 1); -} - -WRITE8_MEMBER( mmd1_state::mmd1_port1_w ) -{ - output_set_value("p1_7", BIT(data,7) ? 0 : 1); - output_set_value("p1_6", BIT(data,6) ? 0 : 1); - output_set_value("p1_5", BIT(data,5) ? 0 : 1); - output_set_value("p1_4", BIT(data,4) ? 0 : 1); - output_set_value("p1_3", BIT(data,3) ? 0 : 1); - output_set_value("p1_2", BIT(data,2) ? 0 : 1); - output_set_value("p1_1", BIT(data,1) ? 0 : 1); - output_set_value("p1_0", BIT(data,0) ? 0 : 1); -} - -WRITE8_MEMBER( mmd1_state::mmd1_port2_w ) -{ - output_set_value("p2_7", BIT(data,7) ? 0 : 1); - output_set_value("p2_6", BIT(data,6) ? 0 : 1); - output_set_value("p2_5", BIT(data,5) ? 0 : 1); - output_set_value("p2_4", BIT(data,4) ? 0 : 1); - output_set_value("p2_3", BIT(data,3) ? 0 : 1); - output_set_value("p2_2", BIT(data,2) ? 0 : 1); - output_set_value("p2_1", BIT(data,1) ? 0 : 1); - output_set_value("p2_0", BIT(data,0) ? 0 : 1); -} - -// keyboard has a keydown and a keyup code. Keyup = last keydown + bit 7 set -READ8_MEMBER( mmd1_state::mmd1_keyboard_r ) -{ - UINT8 line1 = ioport("LINE1")->read(); - UINT8 line2 = ioport("LINE2")->read(); - UINT8 i, data = 0xff; - - - for (i = 0; i < 8; i++) - { - if (!BIT(line1, i)) - data = i; - } - - for (i = 0; i < 8; i++) - { - if (!BIT(line2, i)) - data = i+8; - } - - if (data < 0x10) - { - m_return_code = data | 0x80; - return data; - } - else - return m_return_code; -} - -static ADDRESS_MAP_START(mmd1_mem, AS_PROGRAM, 8, mmd1_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x00ff ) AM_ROM // Main ROM - AM_RANGE( 0x0100, 0x01ff ) AM_ROM // Expansion slot - AM_RANGE( 0x0200, 0x02ff ) AM_RAM - AM_RANGE( 0x0300, 0x03ff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mmd1_io, AS_IO, 8, mmd1_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x07) - AM_RANGE( 0x00, 0x00 ) AM_READWRITE(mmd1_keyboard_r, mmd1_port0_w) - AM_RANGE( 0x01, 0x01 ) AM_WRITE(mmd1_port1_w) - AM_RANGE( 0x02, 0x02 ) AM_WRITE(mmd1_port2_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mmd2_mem, AS_PROGRAM, 8, mmd1_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x03ff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") - AM_RANGE(0x0400, 0x0fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4") - AM_RANGE(0xd800, 0xe3ff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank6") - AM_RANGE(0xe400, 0xe7ff) AM_READ_BANK("bank7") AM_WRITE_BANK("bank8") - AM_RANGE(0xfc00, 0xfcff) AM_RAM // Scratchpad -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mmd2_io, AS_IO, 8, mmd1_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00, 0x00 ) AM_WRITE(mmd1_port0_w) - AM_RANGE( 0x01, 0x01 ) AM_READWRITE(mmd2_01_r,mmd1_port1_w) - AM_RANGE( 0x02, 0x02 ) AM_WRITE(mmd1_port2_w) - AM_RANGE( 0x03, 0x03 ) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) - AM_RANGE( 0x04, 0x04 ) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w) - AM_RANGE( 0x05, 0x07 ) AM_READ(mmd2_bank_r) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( mmd1 ) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) -INPUT_PORTS_END - -static INPUT_PORTS_START( mmd2 ) - PORT_START("DSW") - PORT_BIT( 0x87, 0x00, IPT_UNUSED ) - PORT_DIPNAME( 0x20, 0x00, "Sw6") PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x20, "Hex") - PORT_DIPSETTING( 0x00, "Octal") - PORT_DIPNAME( 0x10, 0x00, "Sw7") PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x10, "PUP") - PORT_DIPSETTING( 0x00, "Reset") - PORT_DIPNAME( 0x08, 0x08, "Sw8") PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x08, "Exec") - PORT_DIPSETTING( 0x00, "User") - - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CANCEL") PORT_CODE(KEYCODE_X) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("AUX") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REGS") PORT_CODE(KEYCODE_R) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_MINUS) - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PROM") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DUMP") PORT_CODE(KEYCODE_I) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOAD") PORT_CODE(KEYCODE_O) - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OPTION") PORT_CODE(KEYCODE_S) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_G) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOW") PORT_CODE(KEYCODE_L) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HIGH") PORT_CODE(KEYCODE_H) - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PREV") PORT_CODE(KEYCODE_DOWN) - PORT_START("RESET") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F1) -INPUT_PORTS_END - -/* -Keyboard -0 1 2 3 PREV STORE NEXT STEP -4 5 6 7 HIGH LOW GO OPTION -8 9 A B LOAD DUMP PROM COPY -C D E F MEM REGS AUX CANCEL - -*/ - -READ8_MEMBER( mmd1_state::mmd2_bank_r ) -{ - membank("bank1")->set_entry(offset); - membank("bank2")->set_entry(offset); - membank("bank3")->set_entry(offset); - membank("bank4")->set_entry(offset); - membank("bank5")->set_entry(offset); - membank("bank6")->set_entry(offset); - membank("bank7")->set_entry(offset); - membank("bank8")->set_entry(offset); - return 0xff; -} - -READ8_MEMBER( mmd1_state::mmd2_01_r ) -{ - // need to add cassin, ttyin bits - UINT8 data = 0x87; - data |= ioport("DSW")->read(); - return data; -} - -WRITE8_MEMBER( mmd1_state::mmd2_scanlines_w ) -{ - m_digit = data; -} - -WRITE8_MEMBER( mmd1_state::mmd2_digit_w ) -{ - if (m_digit < 9) - output_set_digit_value(m_digit, data); -} - -READ8_MEMBER( mmd1_state::mmd2_kbd_r ) -{ - UINT8 data = 0xff; - - if (m_digit < 4) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",m_digit); - data = ioport(kbdrow)->read(); - } - return data; -} - -WRITE8_MEMBER( mmd1_state::mmd2_status_callback ) -{ - // operate the HALT LED - output_set_value("led_halt", ~data & I8085_STATUS_HLTA); - // operate the HOLD LED - this should connect to the HLDA pin, - // but it isn't emulated, using WO instead (whatever that does). - output_set_value("led_hold", data & I8085_STATUS_WO); -} - -WRITE_LINE_MEMBER( mmd1_state::mmd2_inte_callback ) -{ - // operate the INTE LED - output_set_value("led_inte", state); -} - -MACHINE_RESET_MEMBER(mmd1_state,mmd1) -{ - m_return_code = 0xff; -} - -MACHINE_RESET_MEMBER(mmd1_state,mmd2) -{ - membank("bank1")->set_entry(0); - membank("bank2")->set_entry(0); - membank("bank3")->set_entry(0); - membank("bank4")->set_entry(0); - membank("bank5")->set_entry(0); - membank("bank6")->set_entry(0); - membank("bank7")->set_entry(0); - membank("bank8")->set_entry(0); -} - -DRIVER_INIT_MEMBER(mmd1_state,mmd2) -{ -/* -We preset all banks here, so that bankswitching will incur no speed penalty. -0000/0400 indicate ROMs, D800/DC00/E400 indicate RAM, 8000 is a dummy write area for ROM banks. -*/ - UINT8 *p_ram = memregion("maincpu")->base(); - membank("bank1")->configure_entry(0, &p_ram[0x0000]); - membank("bank1")->configure_entry(1, &p_ram[0xd800]); - membank("bank1")->configure_entry(2, &p_ram[0x0c00]); - membank("bank2")->configure_entry(0, &p_ram[0x8000]); - membank("bank2")->configure_entry(1, &p_ram[0xd800]); - membank("bank2")->configure_entry(2, &p_ram[0x8000]); - membank("bank3")->configure_entry(0, &p_ram[0x0400]); - membank("bank3")->configure_entry(1, &p_ram[0xdc00]); - membank("bank3")->configure_entry(2, &p_ram[0xdc00]); - membank("bank4")->configure_entry(0, &p_ram[0x8000]); - membank("bank4")->configure_entry(1, &p_ram[0xdc00]); - membank("bank4")->configure_entry(2, &p_ram[0xdc00]); - membank("bank5")->configure_entry(0, &p_ram[0xd800]); - membank("bank5")->configure_entry(1, &p_ram[0x0000]); - membank("bank5")->configure_entry(2, &p_ram[0x0000]); - membank("bank6")->configure_entry(0, &p_ram[0xd800]); - membank("bank6")->configure_entry(1, &p_ram[0x8000]); - membank("bank6")->configure_entry(2, &p_ram[0x8000]); - membank("bank7")->configure_entry(0, &p_ram[0xe400]); - membank("bank7")->configure_entry(1, &p_ram[0x0c00]); - membank("bank7")->configure_entry(2, &p_ram[0xd800]); - membank("bank8")->configure_entry(0, &p_ram[0xe400]); - membank("bank8")->configure_entry(1, &p_ram[0x8000]); - membank("bank8")->configure_entry(2, &p_ram[0xd800]); -} - -static MACHINE_CONFIG_START( mmd1, mmd1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, 6750000 / 9) - MCFG_CPU_PROGRAM_MAP(mmd1_mem) - MCFG_CPU_IO_MAP(mmd1_io) - - MCFG_MACHINE_RESET_OVERRIDE(mmd1_state,mmd1) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mmd1) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( mmd2, mmd1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, 6750000 / 9) - MCFG_CPU_PROGRAM_MAP(mmd2_mem) - MCFG_CPU_IO_MAP(mmd2_io) - MCFG_I8085A_STATUS(WRITE8(mmd1_state, mmd2_status_callback)) - MCFG_I8085A_INTE(WRITELINE(mmd1_state, mmd2_inte_callback)) - - MCFG_MACHINE_RESET_OVERRIDE(mmd1_state,mmd2) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mmd2) - - /* Devices */ - MCFG_DEVICE_ADD("i8279", I8279, 400000) // based on divider - MCFG_I8279_OUT_SL_CB(WRITE8(mmd1_state, mmd2_scanlines_w)) // scan SL lines - MCFG_I8279_OUT_DISP_CB(WRITE8(mmd1_state, mmd2_digit_w)) // display A&B - MCFG_I8279_IN_RL_CB(READ8(mmd1_state, mmd2_kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key - MCFG_I8279_IN_CTRL_CB(VCC) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mmd1 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "kex.ic15", 0x0000, 0x0100, CRC(434f6923) SHA1(a2af60deda54c8d3f175b894b47ff554eb37e9cb)) -ROM_END - -ROM_START( mmd2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mmd2330.bin", 0x0000, 0x0800, CRC(69a77199) SHA1(6c83093b2c32a558c969f4fe8474b234023cc348)) - ROM_LOAD( "mmd2340.bin", 0x0800, 0x0800, CRC(70681bd6) SHA1(c37e3cf34a75e8538471030bb49b8aed45d00ec3)) - ROM_LOAD( "mmd2350.bin", 0x1000, 0x0800, CRC(359f577c) SHA1(9405ca0c1977721e4540a4017907c06dab08d398)) - ROM_LOAD( "mmd2360.bin", 0x1800, 0x0800, CRC(967e69b8) SHA1(c21ec8bef955806a2c6e1b1c8e9068662fb88038)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1976, mmd1, 0, 0, mmd1, mmd1, driver_device, 0, "E&L Instruments Inc", "MMD-1", MACHINE_NO_SOUND_HW) -COMP( 1976, mmd2, mmd1, 0, mmd2, mmd2, mmd1_state, mmd2, "E&L Instruments Inc", "MMD-2", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/mmodular.c b/src/mess/drivers/mmodular.c deleted file mode 100644 index 17c2d2c3499..00000000000 --- a/src/mess/drivers/mmodular.c +++ /dev/null @@ -1,1911 +0,0 @@ -// license:??? -// copyright-holders:Dirk Verwiebe, Ralf Schaefer, Cowering -/****************************************************************************** - Mephisto Chess Computers using plugin modules - - Vancouver Chess Computer 68000 (driver recalled) by R. Schaefer (2010) - - (most of the magnetic sensor versions with 680x0 family modules) - - Almeria 68000 12Mhz - Almeria 68020 12Mhz - Lyon 68000 12Mhz - Lyon 68020 12Mhz - Vancouver 68000 12Mhz - Vancouver 68020 12Mhz - Genius 68030 V4.00 33.333 Mhz - Genius 68030 V4.01 33.333 Mhz - Genius 68030 V4.01 33.333x2 Mhz (custom MESS overclocked version for higher ELO) - Berlin Pro 68020 24.576 Mhz (not modular board, but otherwise close to milano) - Berlin Pro (London) 68020 24.576 Mhz (not modular board, but otherwise close to milano) - London 68030 V5.00k 33.333 Mhz (probably the Genius 3/4 update ROM) - - note: The Almeria 68000 is the 'parent' of all these, but Vancouver 68000 is used as parent in the driver. - It was the first to have 'Bavaria' sensors, and will make the other drivers easier when inheriting this - feature later - - - misc non-modular/non-68K boards - - RISC 2500 (Skeleton, does not work, and not sure the same internal chessboard connections are used) - Academy 65C02 4.9152mhz - Monte Carlo IV, Mega IV and any others not listed above have correct ROM/RAM and maybe LCD, not much else for now - - Novag boards: (should go in different .c eventually) - Super Forte and Super Expert are the same, except one is touch board, other is magnetic. - The Diablo 68000 is Super Expert board but 68K based - - Notes by Cowering (2011) - - TODO: add Bavaria sensor support (unknown1,2,3 handlers in current driver) - proper 'bezel' for all games/cpuspeeds so 'Vancouver' does not say 'Almeria', etc - custom handler to read/write the Battery RAM so 68000 can share files with 020/030 (real modular machine can do this) - find a timing to let the player see the flashing LEDs on the 68030 versions (might be fixed with waitstates in core) - add the missing machines.. including all Portorose and the very rare overclocked 'TM' Tournament Machines - match I/S= diag speed test with real hardware (good test for proper waitstates) - load LCD rom inside the LCD driver - - TODO2: (these worked before .140 core) - LCD off by a couple of pixels in artwork now - no longer see the custom white hand when selecting chess pieces - parent/clone for artwork so there are not multiple copies of chessboard+pieces - - - TODO3: Oct 2011 - commented out all ACIA functions until they are ported to new device - - Undocumented buttons: holding ENTER and LEFT cursor on cold boot runs diagnostics on modular 680x0 boards - holding UP and RIGHT cursor will clear the Battery Backed RAM on modular 680x0 boards - holding CLEAR clears Battery Backed RAM on the Berlin (Pro) 68020 -******************************************************************************/ - -/****************************************************************************** - Mephisto Polgar & Milano - 2010 Dirk V., Ralf Schafer, Cowering - -******************************************************************************/ - -/* - -CPU 65C02 P4 4.9152 MHz - -// lese Tastatur von 2c00 - 2c07, -2c00 Trn -2c01 Info -2c02 Mem -2c03 Pos -2c04 Lev -2c05 Fct -2c06 Ent -2c07 CL - -$1ff0 -Bit 0 LCD Command/Data 0/1 -Bit 1 LCD Enable (signals Data is valid) -Bit 2 Beeper -Bit 3 Beeper -Bit 4+7 LED A-H enable -Bit 5+6 LED 1-8 enable -*/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "cpu/m6502/m65c02.h" -#include "cpu/arm/arm.h" -#include "sound/beep.h" -//#include "machine/mos6551.h" -#include "video/hd44780.h" - -#include "rendlay.h" - -#include "includes/mboard.h" -#include "machine/nvram.h" - -//static UINT16 unknown2_data = 0; -// Berlin Pro 68020 -static UINT32 BPL32latch_data = 0; - - -// Mephisto Academy -static UINT8 academyallowNMI = 0; - -//Monte Carlo IV key/board selects - -static UINT8 monteciv_select[2] = { 0xff,0xff }; -static UINT8 montecivtop = 0, montecivbot = 0; -static UINT8 montecivtopnew = 0, montecivbotnew = 0; - -//Mephisto Mega IV latch -UINT8 latch2400 = 0; - -UINT8 diablo68_3c0000 = 0; - -UINT8 sfortea_latch = 0; - - -INPUT_PORTS_EXTERN( chessboard ); - -UINT8 lcd32_char; - -class polgar_state : public mboard_state -{ -public: - polgar_state(const machine_config &mconfig, device_type type, const char *tag) - : mboard_state(mconfig, type, tag), - m_lcdc(*this, "hd44780"), - m_beeper(*this, "beeper") - { } - - optional_device m_lcdc; - optional_device m_beeper; - - UINT8 led_status; - UINT8 lcd_char; - //UINT8 led7; - UINT8 latch_data; - DECLARE_WRITE8_MEMBER(write_polgar_IO); - DECLARE_WRITE8_MEMBER(write_LCD_polgar); - DECLARE_READ8_MEMBER(read_1ff1_sfortea); - DECLARE_READ8_MEMBER(read_1ff0_sfortea); - DECLARE_WRITE8_MEMBER(write_latch_sfortea); - DECLARE_WRITE8_MEMBER(write_lcd_IO_sfortea); - DECLARE_WRITE8_MEMBER(write_LCD_academy); -// DECLARE_WRITE16_MEMBER(diablo68_aciawrite); -// DECLARE_READ16_MEMBER(diablo68_aciaread); - DECLARE_WRITE16_MEMBER(diablo68_reg_select); - DECLARE_WRITE16_MEMBER(diablo68_write_LCD); - DECLARE_WRITE8_MEMBER(milano_write_LED); - DECLARE_WRITE8_MEMBER(megaiv_write_LED); - DECLARE_WRITE8_MEMBER(academy_write_LED); - DECLARE_WRITE8_MEMBER(academy_inhibitNMI); - DECLARE_WRITE32_MEMBER(write_LED_BPL32); - DECLARE_WRITE8_MEMBER(polgar_write_LED); - DECLARE_WRITE8_MEMBER(monteciv_write_LCD); - DECLARE_WRITE8_MEMBER(monteciv_3007); - DECLARE_WRITE8_MEMBER(monteciv_3005); - DECLARE_WRITE8_MEMBER(monteciv_3006); - DECLARE_WRITE8_MEMBER(academy_write_board); - DECLARE_WRITE8_MEMBER(milano_write_board); - DECLARE_READ8_MEMBER(milano_read_board); - DECLARE_READ8_MEMBER(read_keys); - DECLARE_READ8_MEMBER(read_keys_megaiv); - DECLARE_READ32_MEMBER(read_keys_BPL32); - DECLARE_WRITE8_MEMBER(beep_academy); - DECLARE_WRITE8_MEMBER(megaiv_IO); - DECLARE_WRITE8_MEMBER(monteciv_select_line); - DECLARE_READ8_MEMBER(read_keys_board_monteciv); - DECLARE_READ8_MEMBER(read_keys_board_academy); - DECLARE_WRITE32_MEMBER(write_board_BPL32); - DECLARE_READ32_MEMBER(read_buttons_gen32); - DECLARE_READ32_MEMBER(read_buttons_van32); - DECLARE_READ16_MEMBER(read_buttons_van16); - DECLARE_WRITE32_MEMBER(write_LCD_data_32); - DECLARE_WRITE16_MEMBER(write_LCD_data); - DECLARE_WRITE32_MEMBER(write_IOenables_32); - DECLARE_WRITE16_MEMBER(write_IOenables); - DECLARE_READ32_MEMBER(read_unknown1_32); - DECLARE_READ16_MEMBER(read_unknown1); - DECLARE_WRITE32_MEMBER(write_unknown2_32); - DECLARE_WRITE16_MEMBER(write_unknown2); - DECLARE_READ32_MEMBER(read_unknown3_32); - DECLARE_READ16_MEMBER(read_unknown3); - DECLARE_READ32_MEMBER(read_1800000); - DECLARE_WRITE32_MEMBER(write_1000000); - DECLARE_DRIVER_INIT(polgar); - DECLARE_MACHINE_START(polgar); - DECLARE_MACHINE_RESET(polgar); - DECLARE_MACHINE_START(sfortea); - DECLARE_MACHINE_RESET(sfortea); - DECLARE_MACHINE_START(van32); - DECLARE_MACHINE_RESET(van16); - DECLARE_MACHINE_RESET(monteciv); - DECLARE_MACHINE_START(diablo68); - DECLARE_MACHINE_START(van16); - DECLARE_MACHINE_START(risc); - DECLARE_MACHINE_RESET(academy); - DECLARE_PALETTE_INIT(chess_lcd); - TIMER_DEVICE_CALLBACK_MEMBER(cause_nmi); - TIMER_DEVICE_CALLBACK_MEMBER(cause_M6502_irq); - TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq6); - TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq2); - TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq_academy); - void common_chess_start(); - UINT8 convert_imputmask(UINT8 input); - UINT8 convertMCIV2LED(UINT8 codedchar); - void write_IOenable(unsigned char data,address_space &space); -}; - -UINT8 polgar_state::convert_imputmask(UINT8 input) -{ - input^=0xff; - switch (input) { - case 0x01: - return 0x80; - case 0x02: - return 0x40; - case 0x04: - return 0x20; - case 0x08: - return 0x10; - case 0x10: - return 0x08; - case 0x20: - return 0x04; - case 0x40: - return 0x02; - case 0x80: - return 0x01; - default: - return 0x00; - } -} - -WRITE8_MEMBER(polgar_state::write_polgar_IO) -{ - int i; - - if (BIT(data,1)) { - m_lcdc->write(space, BIT(data,0), lcd_char); - } - - if (BIT(data,2) || BIT(data,3)) - m_beeper->set_state(1); - else - m_beeper->set_state(0); - - if (BIT(data,7) && BIT(data, 4)) { - for (i = 0;i < 8;i++) - output_set_led_value(i,!BIT(latch_data,i)); - } - else if (BIT(data,6) && BIT(data,5)) { - for (i = 0;i < 8;i++) - output_set_led_value(10+i,!BIT(latch_data,7-i)); - } - else if (!data && (!strcmp(machine().system().name,"milano"))) { - for (i=0;i<8;i++) { - output_set_led_value(i,!BIT(latch_data,i)); - output_set_led_value(10+i,!BIT(latch_data,7-i)); - } - } - - - //logerror("LCD Status Data = %d\n",data); - -} - - -WRITE8_MEMBER(polgar_state::write_LCD_polgar) -{ - lcd_char = data; - - logerror("LCD Data = %d %02x [%c]\n",data,data,(data&0xff)); - -} - -READ8_MEMBER(polgar_state::read_1ff1_sfortea) -{ - UINT8 data; - data = ioport("BUTTONS_SFOR1")->read(); - logerror("1ff0 data %02x\n",data); - return 0; -// return data; -} - -READ8_MEMBER(polgar_state::read_1ff0_sfortea) -{ - UINT8 data; - data = ioport("BUTTONS_SFOR2")->read(); - logerror("1ff0 data %02x\n",data); - return 0; -// return data; - -// static UINT8 temp = 0; -// temp++; -// logerror("read 1ff0 %02x\n",temp); -// printf("read 1ff0 %02x\n",temp); - -// return (0x00); -} - - - -WRITE8_MEMBER(polgar_state::write_latch_sfortea) -{ - sfortea_latch = data; - logerror("latch data %02x\n",data); -// printf("latch data %02x\n",data); - -} - -WRITE8_MEMBER(polgar_state::write_lcd_IO_sfortea) -{ -/* bits -7 -6 paired with 5 -5 -4 -3 irq on off? -2 select HD44780 -1 -0 LCD command/data select -*/ - - - if (BIT(sfortea_latch,2)) - { - if(BIT(sfortea_latch,0)) { - m_lcdc->data_write(space, 0, data); - logerror("LCD DTA = %02x\n",data); - } else { - if (BIT(data,7)) { - if ((data & 0x7f) >= 0x40) data -= 56; // adjust for 16x1 display as 2 sets of 8 - } - m_lcdc->control_write(space, 0, data); - logerror("LCD CMD = %02x\n",data); - } - } -} - -WRITE8_MEMBER(polgar_state::write_LCD_academy) -{ - m_lcdc->write(space, offset & 1, data); -} - -// AM_RANGE( 0x3a0000,0x3a0000 ) AM_READ(diablo68_write_LCD) -// AM_RANGE( 0x3c0000,0x3c0000 ) AM_READ(diablo68_reg_select) - -/*WRITE16_MEMBER(polgar_state::diablo68_aciawrite) -{ -// device_t *acia = machine().device("acia65c51"); -// acia_6551_w(acia, offset & 0x03, data >> 8); -// printf("ACIA write data %04x offset %02x\n",data,offset); - logerror("ACIA write data %04x offset %02x\n",data,offset); -} - -READ16_MEMBER(polgar_state::diablo68_aciaread) -{ -// device_t *acia = machine().device("acia65c51"); - UINT16 result; -// result = acia_6551_r(acia, offset & 0x03); -// logerror("ACIA read offset %02x\n",offset); -// printf("ACIA read offset %02x\n",offset); - - result <<= 8; - - return result; -} -*/ - -WRITE16_MEMBER(polgar_state::diablo68_reg_select) -{ - diablo68_3c0000 = data >> 8; - //printf("3c0000 = %04x\n",data>>8); - logerror("3c0000 = %04x\n",data>>8); - -} - - -WRITE16_MEMBER(polgar_state::diablo68_write_LCD) -{ - data >>= 8; - if (!(diablo68_3c0000 & 0x02)) { - if (BIT(data,7)) { - if ((data & 0x7f) >= 0x40) data -= 56; // adjust for 16x1 display as 2 sets of 8 - } - m_lcdc->control_write(space, 0, data); -// logerror("Control %02x\n", data); -// printf("Control %02x\n", data); - } else { - m_lcdc->data_write(space, 0, data); -// printf("LCDdata %04x [%c]\n", data,data); -// logerror("LCDdata %04x [%c]\n", data,data); - } - - //logerror("LCD Status Data = %d\n",data); - -} - -WRITE8_MEMBER(polgar_state::milano_write_LED) -{ - UINT8 LED_offset = 100; - if (data == 0xff) output_set_led_value(LED_offset+offset,1); - else output_set_led_value(LED_offset+offset,0); - - //logerror("LEDs Offset = %d Data = %d\n",offset,data); -} - -WRITE8_MEMBER(polgar_state::megaiv_write_LED) -{ - if (BIT(data,7)) - m_beeper->set_state(1); - else - m_beeper->set_state(0); - output_set_led_value(102,BIT(data,1)?1:0); - output_set_led_value(107,BIT(data,6)?1:0); - -// logerror("LEDs FUNC = %02x found = %d\n",data,found); - logerror("LED mask %d\n",data); -// printf("LED mask %d\n",data); - -} - - -WRITE8_MEMBER(polgar_state::academy_write_LED) -{ -int found = 0; - -// LED mask debugging, please don't delete -/*static int r[4] = { 0,0,0,0 }; -static int pr[4] = { -1,-1,-1,-1 }; -static int new1 = 0,start = 0,z = 0,i2; -if (data == 0xf8) { - if (start == 0) { - start = 1; - z = 0; - } -} -if (start == 1) { - new1 = 0; - pr[z] = r[z]; - r[z] = data; - for (i2 = 0; i2 < 4; i2++) if(pr[i2] != r[i2]) new1 = 1; - z++; - if(z == 4) z = 0; - if (new1) printf("[%02x] [%02x] [%02x] [%02x]\n",r[0],r[1],r[2],r[3]); -} -*/ - -if ((data & 0x68) == 0x68) { - output_set_led_value(103,BIT(data,4)?0:1); // POS - output_set_led_value(107,BIT(data,7)?0:1); // white - found = 1; -} - -if ((data & 0x64) == 0x64) { - output_set_led_value(102,BIT(data,4)?0:1); // MEM - output_set_led_value(106,BIT(data,7)?0:1); // black - found = 1; -} - -if ((data & 0xa2) == 0xa2) { - output_set_led_value(101,BIT(data,4)?0:1); // INFO - output_set_led_value(105,BIT(data,6)?0:1); // FUNC - found = 1; -} - -if ((data & 0xa1) == 0xa1) { - output_set_led_value(100,BIT(data,4)?0:1); // TRN - output_set_led_value(104,BIT(data,6)?0:1); // LVL - found = 1; -} - -if (BIT(data,7)) - m_beeper->set_state(1); -else - m_beeper->set_state(0); -if (BIT(data,1)) - m_beeper->set_state(1); -else - m_beeper->set_state(0); -// logerror("LEDs FUNC = %02x found = %d\n",data,found); - if (!found) { - logerror("unknown LED mask %d\n",data); -// printf("unknown LED mask %d\n",data); - } -} - - -WRITE8_MEMBER(polgar_state::academy_inhibitNMI) -{ - academyallowNMI = data; - -} - - -WRITE32_MEMBER(polgar_state::write_LED_BPL32) -{ - int i; - - data >>= 24; - for (i=0;i<8;i++) { - output_set_led_value(i,BIT(data,i)); - output_set_led_value(10+i,!BIT(BPL32latch_data,7-i)); - } - - logerror("LEDs Offset = %d Data = %08x Latch = %08x\n",offset,data,BPL32latch_data); - -} - - -WRITE8_MEMBER(polgar_state::polgar_write_LED) -{ -#define LED_offset 100 - - data &= 0x80; - - if (data == 0) { - led_status &= 255-(1<read(); - - if (tmp != 0xff) - data = convert_imputmask(tmp); - - } - - return data; - -} - -READ8_MEMBER(polgar_state::read_keys) -{ - UINT8 data; - static const char *const keynames[1][8] = - { - { "KEY1_0", "KEY1_1", "KEY1_2", "KEY1_3", "KEY1_4", "KEY1_5", "KEY1_6", "KEY1_7" } - }; - - data = ioport(keynames[0][offset])->read(); - // logerror("Keyboard Port = %s Data = %d\n ", ((led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data); - return data | 0x7f; -} - -READ8_MEMBER(polgar_state::read_keys_megaiv) -{ - UINT8 data; - static const char *const keynames[1][8] = - { - { "KEY1_0", "KEY1_1", "KEY1_2", "KEY1_3", "KEY1_4", "KEY1_5", "KEY1_6", "KEY1_7" } - }; - - data = ioport(keynames[0][offset])->read(); - logerror("Keyboard Port = %s Data = %d\n ", keynames[0][offset] , data); - return data | 0x7f; -} - - -READ32_MEMBER(polgar_state::read_keys_BPL32) -{ - UINT32 data = 0; - UINT8 tmp = 0xff, line = 0; - static const char *const board_lines[8] = - { "LINE.0", "LINE.1", "LINE.2", "LINE.3", "LINE.4", "LINE.5", "LINE.6", "LINE.7" }; - - if (BPL32latch_data == 0xff) { - tmp = ioport("BUTTONS_BPL")->read(); - logerror("Keyboard Port Offset = %d tmp %d\n", offset,tmp); - - data = tmp << 24; - } else { - if (BPL32latch_data & 0x7f) { - logerror("ReadingBoard %02x\n",BPL32latch_data); - line = get_first_cleared_bit(BPL32latch_data); - tmp = ioport(board_lines[line])->read(); - - if (tmp != 0xff) - data = convert_imputmask(tmp) << 24; - } - } - -// logerror("Keyboard Port = %s Data = %d Offset = %d tmp %d line %02x\n", keynames[0][line], data, offset,tmp,line); - return data; -} - -WRITE8_MEMBER(polgar_state::beep_academy) -{ - if (!BIT(data,7)) - m_beeper->set_state(1); - else - m_beeper->set_state(0); -} - -WRITE8_MEMBER(polgar_state::megaiv_IO) -{ -// if (BIT(data,0)) beep_set_state(machine->device("beeper"),1); else beep_set_state(machine->device("beeper"),0); - logerror("$2400 = %02x\n",data); - latch2400 = data; -} - - -WRITE8_MEMBER(polgar_state::monteciv_select_line) -{ - monteciv_select[offset] = data; -} - -// FIXME : unlike polgar, academy shares port IO for keys and board, and i just can't seem to get the board latched right (H7 and H8 are always flashing) -- Cow -READ8_MEMBER(polgar_state::read_keys_board_monteciv) -{ - UINT8 data = 0; - - if (monteciv_select[0] == 0xff && monteciv_select[1] == 0xff) { - data = mboard_read_board_8(space,0); - } else { - if (monteciv_select[0] == 0x0) { - data = ioport("BUTTONS_MONTE2")->read(); -#if 0 - if (data) { - output_set_digit_value(0,64); - output_set_digit_value(1,113+128); - output_set_digit_value(2,190); - output_set_digit_value(3,64); - - output_set_digit_value(4,246-128); - output_set_digit_value(5,247-128); - output_set_digit_value(6,219-128); - output_set_digit_value(7,249-128); - } -#endif - } else { - data = ioport("BUTTONS_MONTE1")->read(); - } - } - return data; -} - - -// FIXME : unlike polgar, academy shares port IO for keys and board, and I just can't seem to get the board latched right (H7 and H8 are always flashing) -- Cow -READ8_MEMBER(polgar_state::read_keys_board_academy) -{ -// static int startup = 0; - UINT8 data = 0; -// UINT8 tmp = 0xff, line = 0; -// static const char *const board_lines[8] = -// { "LINE.0", "LINE.1", "LINE.2", "LINE.3", "LINE.4", "LINE.5", "LINE.6", "LINE.7" }; - - if (latch_data == 0xff) { - data = ioport("BUTTONS_ACAD")->read(); - } else { -// if (latch_data & 0x7f) { - data = mboard_read_board_8(space,0); -// data = milano_read_board(space,0); - -// logerror("ReadingBoard %02x\n",latch_data); -// line = get_first_cleared_bit(latch_data); -// tmp = machine.root_device().ioport(board_lines[line])->read(); -// mboard_write_board_8(space,0, latch_data); -// data = mboard_read_board_8(space,0); -// logerror("BoardRead Port Offset = %d data %02x Latch %02x\n", offset,data,latch_data); -// printf ("BoardRead Port Offset = %d data %02x Latch %02x\n", offset,data,latch_data); -// } else { -// logerror("no keys or board\n"); -// } - } -// logerror("Keyboard Port Offset = %d tmp %d Latch %d\n", offset,tmp,latch_data); -// logerror("Keyboard Port = %s Data = %d Offset = %d tmp %d line %02x\n", keynames[0][line], data, offset,tmp,line); - return data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::cause_nmi) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::cause_M6502_irq) -{ - m_maincpu->set_input_line(M65C02_IRQ_LINE, HOLD_LINE); -} - - -WRITE32_MEMBER(polgar_state::write_board_BPL32) -{ - BPL32latch_data = data >> 24; - logerror("Write BPL32 board Data Latch %08x Offset: %08x\n",BPL32latch_data,offset); - -} - -READ32_MEMBER(polgar_state::read_buttons_gen32) -{ - UINT32 data; - static const char *const keynames[4] = { "BUTTON_1", "BUTTON_2", "", "BUTTON_3" }; - - data = ioport(keynames[offset])->read(); - - data = data|data<<8|data<<16|data<<24; // this might not be needed if MAME does handle odd alignment over 32bit boundaries right - logerror("Read from Buttons: %08x %08x\n",offset,data); - return data; -} - -READ32_MEMBER(polgar_state::read_buttons_van32) -{ - UINT32 data; - static const char *const keynames[4] = { "BUTTON_1", "", "BUTTON_2", "BUTTON_3" }; - - - data = ioport(keynames[offset])->read(); - - data = data << 8; - logerror("Read from Buttons: %08x %08x\n",offset,data); - return data; -} - -READ16_MEMBER(polgar_state::read_buttons_van16) -{ - UINT16 data; - static const char *const keynames[3] = { "BUTTON_1", "BUTTON_2", "BUTTON_3" }; - - - data = ioport(keynames[offset>>1])->read() << 8; - - logerror("Read from %06x offset: %x %04x\n",0xf00000,offset,data); - return data; -} - -WRITE32_MEMBER(polgar_state::write_LCD_data_32) -{ -// printf("Write LCD Data Latch %08x o: %08x\n",data,offset); - logerror("Write LCD Data Latch %08x o: %08x\n",data,offset); - lcd32_char = data>>24; -// cpu_adjust_icount(cpu,-5000); - -} - -WRITE16_MEMBER(polgar_state::write_LCD_data) -{ - lcd32_char = data>>8; - -} - -void polgar_state::write_IOenable(unsigned char data,address_space &space) -{ - hd44780_device * hd44780 = space.machine().device("hd44780"); - - if (BIT(data,5) && BIT(data,4)) { - if (BIT(data,1)) { - // delay until LCD is ready - // (this is now patched on a per ROM basis) - // ROMs have a very specific delay loop to avoid a busy spin while checking moves in the background - // 48 tst.l (a4)+ instuctions need to be > ~42us (for 33.33mhz 030) (a4 is pointing at ROM) - // MAME core does not appear to have this opcode timed right. - // This also allows 'fake' clocks to test ELO at impossibly high speeds on real hardware - // The original programmer says RAM is 2x as fast as the ROM on the 030 machines, maybe waitstates can be put in MAME core someday -// cpu_spinuntil_time(space.cpu, ATTOTIME_IN_USEC(50)); - if (BIT(data,0)) { - logerror("Write LCD_DATA [%02x] [%c]\n",lcd32_char,lcd32_char); -// printf("Write LCD_DATA [%02x] [%c]\n",lcd32_char,lcd32_char); - } else { - logerror("Write LCD_CTRL [%02x] [%c]\n",lcd32_char,lcd32_char); -// printf("Write LCD_CTRL [%02x] [%c]\n",lcd32_char,lcd32_char); - } - - hd44780->write(space, BIT(data,0), lcd32_char); - } - - logerror("Write to IOENBL data: %08x\n",data); - - if (BIT(data,2) || BIT(data,3)) - m_beeper->set_state(1); - else - m_beeper->set_state(0); - } - -} - -WRITE32_MEMBER(polgar_state::write_IOenables_32){ - write_IOenable(data>>24,space); -} - -WRITE16_MEMBER(polgar_state::write_IOenables) -{ - write_IOenable(data>>8,space); -} - -/* Unknown read/write */ - -READ32_MEMBER(polgar_state::read_unknown1_32) -{ - logerror("Read from unknown1 offset: %x\n",offset); - return 0xff00ff00; -} - -READ16_MEMBER(polgar_state::read_unknown1) -{ - logerror("Read from %06x offset: %x\n",0xe80002,offset); - return 0xff00; -} - -WRITE32_MEMBER(polgar_state::write_unknown2_32) -{ - //unknown2_data = data; - logerror("Write to unknown2 data: %04x\n",data); -} - -WRITE16_MEMBER(polgar_state::write_unknown2) -{ - //unknown2_data = data; - logerror("Write from %06x data: %04x\n",0xe80004,data); -} - -READ32_MEMBER(polgar_state::read_unknown3_32) -{ - logerror("Read from unknown3 offset: %x %08x\n",offset,(unsigned int) m_maincpu->state_int(M68K_PC)); - return 0xffffffff; - //return unknown2_data|unknown2_data<<24; - -} - -READ16_MEMBER(polgar_state::read_unknown3) -{ - logerror("Read from %06x offset: %x\n",0xe80006,offset); - return 0xffff; - //return unknown2_data; - -} - -READ32_MEMBER(polgar_state::read_1800000) -{ - logerror("Read from RISC2500 1800000\n"); - return 0; -} - -WRITE32_MEMBER(polgar_state::write_1000000) -{ - logerror("Write to RISC2500 1000000\n"); -} - -TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq6) -{ - m_maincpu->set_input_line(6, HOLD_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq2) -{ - m_maincpu->set_input_line(2, HOLD_LINE); -} - - -TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq_academy) -{ - if (academyallowNMI) { - m_maincpu->set_input_line(6, HOLD_LINE); - } -} - - -MACHINE_START_MEMBER(polgar_state,van32) -{ -// patch LCD delay loop on the 68030 machines until waitstates and/or opcode timings are fixed in MAME core -// patches gen32 gen32_41 gen32_oc lond030 - - UINT8 *rom = memregion("maincpu")->base(); - - if(rom[0x870] == 0x0c && rom[0x871] == 0x78) { - if (!strcmp(machine().system().name,"gen32_oc")) { - rom[0x870] = 0x6c; - } else { - rom[0x870] = 0x38; - } - } -} - - -MACHINE_START_MEMBER(polgar_state,risc) -{ -} - - -void polgar_state::common_chess_start() -{ - mboard_set_border_pieces(); - mboard_set_board(); -} - -MACHINE_START_MEMBER(polgar_state,polgar) -{ - common_chess_start(); - mboard_savestate_register(); -} - -MACHINE_START_MEMBER(polgar_state,sfortea) -{ - common_chess_start(); - mboard_savestate_register(); -} - -MACHINE_START_MEMBER(polgar_state,diablo68) -{ - common_chess_start(); -} - -MACHINE_START_MEMBER(polgar_state,van16) -{ - mboard_savestate_register(); -} - -MACHINE_RESET_MEMBER(polgar_state,van16) -{ - common_chess_start(); -} - -MACHINE_RESET_MEMBER(polgar_state,polgar) -{ - common_chess_start(); -} - -MACHINE_RESET_MEMBER(polgar_state,sfortea) -{ - common_chess_start(); -} - -MACHINE_RESET_MEMBER(polgar_state,monteciv) -{ - montecivtop = 0; - montecivbot = 0; - monteciv_select[0] = 0; - monteciv_select[1] = 0; - academyallowNMI = 0; - common_chess_start(); -} - - -MACHINE_RESET_MEMBER(polgar_state,academy) -{ - academyallowNMI = 0; - common_chess_start(); -} - -PALETTE_INIT_MEMBER(polgar_state,chess_lcd) -{ - // palette.set_pen_color(0, rgb_t(138, 146, 148)); // some think this is closer, but slightly less readable - palette.set_pen_color(0, rgb_t(255, 255, 255)); - palette.set_pen_color(1, rgb_t(0, 0, 0)); -} - -static const gfx_layout chess_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 224, /* 224 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( chess_lcd ) - GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, chess_charlayout, 0, 1 ) -GFXDECODE_END - -static ADDRESS_MAP_START(polgar_mem , AS_PROGRAM, 8, polgar_state ) - AM_RANGE( 0x0000, 0x1fff ) AM_RAM - AM_RANGE( 0x2400, 0x2400 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard - AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(mboard_write_board_8) // Chessboard - AM_RANGE( 0x3000, 0x3000 ) AM_READ(mboard_read_board_8 ) // Chessboard - AM_RANGE( 0x3400, 0x3405 ) AM_WRITE(polgar_write_LED) // Function LEDs - AM_RANGE( 0x2c00, 0x2c07 ) AM_READ(read_keys) - AM_RANGE( 0x2004, 0x2004 ) AM_WRITE(write_polgar_IO ) // LCD Instr. Reg + Beeper - AM_RANGE( 0x2000, 0x2000 ) AM_WRITE(write_LCD_polgar ) // LCD Char Reg. - AM_RANGE( 0x4000, 0xffff ) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sfortea_mem , AS_PROGRAM, 8, polgar_state ) - AM_RANGE( 0x0000, 0x1fef ) AM_RAM - AM_RANGE( 0x1ff6, 0x1ff6 ) AM_WRITE(write_latch_sfortea) // IO control - AM_RANGE( 0x1ff7, 0x1ff7 ) AM_WRITE(write_lcd_IO_sfortea) // LCD Char Reg. -// AM_RANGE( 0x1ffc, 0x1fff ) AM_DEVREADWRITE_LEGACY("acia65c51", acia_6551_r,acia_6551_w) - AM_RANGE( 0x1ff1, 0x1ff1 ) AM_READ(read_1ff1_sfortea ) - AM_RANGE( 0x1ff0, 0x1ff0 ) AM_READ(read_1ff0_sfortea ) - AM_RANGE( 0x2000, 0xffff ) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(gen32_mem, AS_PROGRAM, 32, polgar_state ) - - AM_RANGE( 0x00000000, 0x0003ffff ) AM_ROM - - AM_RANGE( 0xc0000000 , 0xc0000003 ) AM_READ(mboard_read_board_32 ) - AM_RANGE( 0xc8000000 , 0xc8000003 ) AM_WRITE(mboard_write_board_32 ) - AM_RANGE( 0xc8000004 , 0xc8000007 ) AM_WRITE(mboard_write_board_32 ) - AM_RANGE( 0xd0000000 , 0xd0000003 ) AM_WRITE(mboard_write_LED_32 ) - AM_RANGE( 0xd0000004 , 0xd0000007 ) AM_WRITE(mboard_write_LED_32 ) - AM_RANGE( 0xf0000004 , 0xf0000013 ) AM_READ(read_buttons_gen32 ) - AM_RANGE( 0xe0000000 , 0xe0000003 ) AM_WRITE(write_LCD_data_32 ) - AM_RANGE( 0xe0000010 , 0xe0000013 ) AM_WRITE(write_IOenables_32 ) - AM_RANGE( 0xd8000008 , 0xd800000b ) AM_WRITE(write_unknown2_32 ) - AM_RANGE( 0xd8000004 , 0xd8000007 ) AM_READ(read_unknown1_32 ) - AM_RANGE( 0xd800000c , 0xd800000f ) AM_READ(read_unknown3_32 ) - - AM_RANGE( 0x40000000, 0x4007ffff ) AM_RAM /* 512KB */ - AM_RANGE( 0x80000000, 0x8003ffff ) AM_RAM /* 256KB */ - AM_RANGE( 0xe8000000, 0xe8007fff ) AM_RAM AM_SHARE("nvram") - - ADDRESS_MAP_END - -static ADDRESS_MAP_START(bpl32_mem, AS_PROGRAM, 32, polgar_state ) - - AM_RANGE( 0x000000, 0x03ffff ) AM_ROM - AM_RANGE( 0x800000 , 0x800003 ) AM_READ(read_keys_BPL32 ) - AM_RANGE( 0x900000 , 0x900003 ) AM_WRITE(write_board_BPL32 ) - AM_RANGE( 0xa00000 , 0xa00003 ) AM_WRITE(write_LED_BPL32 ) - AM_RANGE( 0xc00000 , 0xc00003 ) AM_WRITE(write_LCD_data_32 ) - AM_RANGE( 0xb00000 , 0xb00003 ) AM_WRITE(write_IOenables_32 ) - AM_RANGE( 0x400000 , 0x4fffff ) AM_RAM /* 1024KB */ - AM_RANGE( 0xd00000 , 0xd07fff ) AM_RAM AM_SHARE("nvram") - - ADDRESS_MAP_END - -static ADDRESS_MAP_START(van32_mem, AS_PROGRAM, 32, polgar_state ) - - AM_RANGE( 0x00000000, 0x0003ffff ) AM_ROM - - AM_RANGE( 0x800000fc , 0x800000ff ) AM_READ(mboard_read_board_32 ) - AM_RANGE( 0x88000000 , 0x88000007 ) AM_WRITE(mboard_write_board_32 ) - AM_RANGE( 0x90000000 , 0x90000007 ) AM_WRITE(mboard_write_LED_32 ) - AM_RANGE( 0x800000ec , 0x800000ff ) AM_READ(read_buttons_van32 ) - AM_RANGE( 0xa0000000 , 0xa0000003 ) AM_WRITE(write_LCD_data_32 ) - AM_RANGE( 0xa0000010 , 0xa0000013 ) AM_WRITE(write_IOenables_32 ) - AM_RANGE( 0x98000008 , 0x9800000b ) AM_WRITE(write_unknown2_32 ) - AM_RANGE( 0x98000004 , 0x98000007 ) AM_READ(read_unknown1_32 ) - AM_RANGE( 0x9800000c , 0x9800000f ) AM_READ(read_unknown3_32 ) - - AM_RANGE( 0x40000000, 0x400fffff ) AM_RAM /* 1024KB */ - AM_RANGE( 0xa8000000, 0xa8007fff ) AM_RAM AM_SHARE("nvram") - - ADDRESS_MAP_END - - -static ADDRESS_MAP_START(alm32_mem, AS_PROGRAM, 32, polgar_state ) - - AM_RANGE( 0x00000000, 0x0001ffff ) AM_ROM - - AM_RANGE( 0x800000fc , 0x800000ff ) AM_READ(mboard_read_board_32 ) - AM_RANGE( 0x88000000 , 0x88000007 ) AM_WRITE(mboard_write_board_32 ) - AM_RANGE( 0x90000000 , 0x90000007 ) AM_WRITE(mboard_write_LED_32 ) - AM_RANGE( 0x800000ec , 0x800000ff ) AM_READ(read_buttons_van32 ) - AM_RANGE( 0xa0000000 , 0xa0000003 ) AM_WRITE(write_LCD_data_32 ) - AM_RANGE( 0xa0000010 , 0xa0000013 ) AM_WRITE(write_IOenables_32 ) - AM_RANGE( 0x98000008 , 0x9800000b ) AM_WRITE(write_unknown2_32 ) - AM_RANGE( 0x98000004 , 0x98000007 ) AM_READ(read_unknown1_32 ) - AM_RANGE( 0x9800000c , 0x9800000f ) AM_READ(read_unknown3_32 ) - - AM_RANGE( 0x40000000, 0x400fffff ) AM_RAM - AM_RANGE( 0xa8000000, 0xa8007fff ) AM_RAM AM_SHARE("nvram") - - ADDRESS_MAP_END - -static ADDRESS_MAP_START(risc_mem, AS_PROGRAM, 32, polgar_state ) - - AM_RANGE( 0x02000000, 0x0201ffff ) AM_ROM AM_REGION("maincpu", 0) // AM_MIRROR(0x2000000) - AM_RANGE( 0x01000000, 0x01000003 ) AM_WRITE(write_1000000 ) - AM_RANGE( 0x01800000, 0x01800003 ) AM_READ(read_1800000 ) - AM_RANGE( 0x00000000, 0x0001ffff ) AM_RAM - - ADDRESS_MAP_END - -static ADDRESS_MAP_START(van16_mem, AS_PROGRAM, 16, polgar_state ) - - AM_RANGE( 0x000000, 0x03ffff ) AM_ROM - - AM_RANGE( 0xc00000 , 0xc00001 ) AM_READ(mboard_read_board_16 ) - AM_RANGE( 0xc80000 , 0xc80001 ) AM_WRITE(mboard_write_board_16 ) - AM_RANGE( 0xd00000 , 0xd00001 ) AM_WRITE(mboard_write_LED_16 ) - AM_RANGE( 0xf00000 , 0xf00009 ) AM_READ(read_buttons_van16 ) - AM_RANGE( 0xd80000 , 0xd80001 ) AM_WRITE(write_LCD_data ) - AM_RANGE( 0xd80008 , 0xd80009 ) AM_WRITE(write_IOenables ) - AM_RANGE( 0xe80004 , 0xe80005 ) AM_WRITE(write_unknown2 ) - AM_RANGE( 0xe80002 , 0xe80003 ) AM_READ(read_unknown1 ) - AM_RANGE( 0xe80006 , 0xe80007 ) AM_READ(read_unknown3 ) - - AM_RANGE( 0x400000, 0x47ffff ) AM_RAM /* 512KB */ - AM_RANGE( 0x800000, 0x803fff ) AM_RAM AM_SHARE("nvram") - - ADDRESS_MAP_END - -static ADDRESS_MAP_START(alm16_mem, AS_PROGRAM, 16, polgar_state ) - - AM_RANGE( 0x000000, 0x01ffff ) AM_ROM - - AM_RANGE( 0xc00000 , 0xc00001 ) AM_READ(mboard_read_board_16 ) - AM_RANGE( 0xc80000 , 0xc80001 ) AM_WRITE(mboard_write_board_16 ) - AM_RANGE( 0xd00000 , 0xd00001 ) AM_WRITE(mboard_write_LED_16 ) - AM_RANGE( 0xf00000 , 0xf00009 ) AM_READ(read_buttons_van16 ) - AM_RANGE( 0xd80000 , 0xd80001 ) AM_WRITE(write_LCD_data ) - AM_RANGE( 0xd80008 , 0xd80009 ) AM_WRITE(write_IOenables ) -// AM_RANGE( 0xe80004 , 0xe80005 ) AM_WRITE(write_unknown2 ) -// AM_RANGE( 0xe80002 , 0xe80003 ) AM_READ(read_unknown1 ) -// AM_RANGE( 0xe80006 , 0xe80007 ) AM_READ(read_unknown3 ) - - - AM_RANGE( 0x400000, 0x47ffff ) AM_RAM /* 512KB */ - AM_RANGE( 0x800000, 0x803fff ) AM_RAM AM_SHARE("nvram") -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(milano_mem , AS_PROGRAM, 8, polgar_state ) - AM_RANGE( 0x0000, 0x1f9f ) AM_RAM - AM_RANGE( 0x1fd0, 0x1fd0 ) AM_WRITE(milano_write_board ) // Chessboard - AM_RANGE( 0x1fe0, 0x1fe0 ) AM_READ(milano_read_board ) // Chessboard - AM_RANGE( 0x1fe8, 0x1fed ) AM_WRITE(milano_write_LED ) // Function LEDs - AM_RANGE( 0x1fd8, 0x1fdf ) AM_READ(read_keys) - AM_RANGE( 0x1ff0, 0x1ff0 ) AM_WRITE(write_polgar_IO) // IO control - AM_RANGE( 0x1fc0, 0x1fc0 ) AM_WRITE(write_LCD_polgar) // LCD Char Reg. (latched) - AM_RANGE( 0x2000, 0xffff ) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(academy_mem , AS_PROGRAM, 8, polgar_state ) - AM_RANGE( 0x0000, 0x1fff ) AM_RAM - AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_academy ) - AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(academy_write_board ) // Chessboard - AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard - AM_RANGE( 0x3002, 0x3002 ) AM_WRITE(beep_academy ) - AM_RANGE( 0x3001, 0x3001 ) AM_WRITE(academy_inhibitNMI ) - AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED ) - AM_RANGE( 0x3800, 0x3801 ) AM_WRITE(write_LCD_academy ) - AM_RANGE( 0x4000, 0xffff ) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(monteciv_mem , AS_PROGRAM, 8, polgar_state ) - AM_RANGE( 0x0000, 0x1fff ) AM_RAM - AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_monteciv ) - AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(academy_write_board ) // Chessboard - AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard - AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED ) // Status LEDs - AM_RANGE( 0x3000, 0x3001 ) AM_WRITE(monteciv_select_line ) // Select Keyline - AM_RANGE( 0x3002, 0x3002 ) AM_WRITE(beep_academy ) - AM_RANGE( 0x3004, 0x3004 ) AM_WRITE(monteciv_write_LCD ) - AM_RANGE( 0x3005, 0x3005 ) AM_WRITE(monteciv_3005 ) - AM_RANGE( 0x3007, 0x3007 ) AM_WRITE(monteciv_3007 ) - AM_RANGE( 0x3006, 0x3006 ) AM_WRITE(monteciv_3006 ) - AM_RANGE( 0x2000, 0x2000 ) AM_WRITE(academy_inhibitNMI ) - AM_RANGE( 0x8000, 0xffff ) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(megaiv_mem , AS_PROGRAM, 8, polgar_state ) - AM_RANGE( 0x0000, 0x1fff ) AM_RAM -/// AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_monteciv ) - AM_RANGE( 0x6800, 0x6800 ) AM_WRITE(academy_write_board ) // 2800 // Chessboard -/// AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard -/// AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED ) // Status LEDs - AM_RANGE( 0x4400, 0x4400 ) AM_WRITE(megaiv_write_LED ) // 2400 // Select Keyline - AM_RANGE( 0x7000, 0x7001 ) AM_WRITE(megaiv_IO ) // Select Keyline -/// AM_RANGE( 0x3002, 0x3002 ) AM_WRITE(beep_academy ) - AM_RANGE( 0x4000, 0x4007 ) AM_READ(read_keys_megaiv ) // 3000-7 fixio - AM_RANGE( 0x2c04, 0x2c04 ) AM_WRITE(monteciv_write_LCD ) // 2c04 - AM_RANGE( 0x2c05, 0x2c05 ) AM_WRITE(monteciv_3005 ) // 2c05 - AM_RANGE( 0x2c07, 0x2c07 ) AM_WRITE(monteciv_3007 ) // 2c07 - AM_RANGE( 0x2c06, 0x2c06 ) AM_WRITE(monteciv_3006 ) // 2c06 -/// AM_RANGE( 0x2000, 0x2000 ) AM_WRITE(academy_inhibitNMI ) - AM_RANGE( 0x8000, 0xffff ) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(diablo68_mem , AS_PROGRAM, 16, polgar_state ) - AM_RANGE( 0x00000000, 0x0000ffff ) AM_ROM // OS -// AM_RANGE( 0x00200000, 0x0020ffff ) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE( 0x00ff0000, 0x00ff7fff ) AM_ROM AM_REGION("maincpu",10000) // Opening Book -// AM_RANGE( 0x00300000, 0x00300007 ) AM_READ(diablo68_aciaread) -// AM_RANGE( 0x00300000, 0x00300007 ) AM_READ(diablo68_aciawrite) -// AM_RANGE( 0x00300002, 0x00300003 ) AM_READ(diablo68_flags) - AM_RANGE( 0x003a0000, 0x003a0001 ) AM_WRITE(diablo68_write_LCD) - AM_RANGE( 0x003c0000, 0x003c0001 ) AM_WRITE(diablo68_reg_select) - AM_RANGE( 0x00280000, 0x0028ffff ) AM_RAM // hash tables - AM_RANGE( 0x00ff8000, 0x00ffffff ) AM_RAM -ADDRESS_MAP_END - - -/* Input ports */ - -static INPUT_PORTS_START( polgar ) - - PORT_START("KEY1_0") //Port $2c00 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Trn") PORT_CODE(KEYCODE_F1) - PORT_START("KEY1_1") //Port $2c01 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Info") PORT_CODE(KEYCODE_F2) - PORT_START("KEY1_2") //Port $2c02 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Mem") PORT_CODE(KEYCODE_F3) - PORT_START("KEY1_3") //Port $2c03 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Pos") PORT_CODE(KEYCODE_F4) - PORT_START("KEY1_4") //Port $2c04 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" LEV") PORT_CODE(KEYCODE_F5) - PORT_START("KEY1_5") //Port $2c05 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" FCT") PORT_CODE(KEYCODE_F6) - PORT_START("KEY1_6") //Port $2c06 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" ENT") PORT_CODE(KEYCODE_F7) - PORT_START("KEY1_7") //Port $2c07 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" CL") PORT_CODE(KEYCODE_F8) -// PORT_START("KEY1_8") -// PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" A") PORT_CODE(KEYCODE_1) - - PORT_INCLUDE( chessboard ) - -INPUT_PORTS_END - -static INPUT_PORTS_START( sfortea ) - PORT_START("BUTTONS_SFOR1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_8) - - PORT_START("BUTTONS_SFOR2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_F8) - -/* PORT_START("BUTTONS_SFOR3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_8) -*/ - - PORT_INCLUDE( chessboard ) -INPUT_PORTS_END - -static INPUT_PORTS_START( academy ) - PORT_START("BUTTONS_ACAD") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Trn") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Info") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Mem") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" Pos") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" LEV") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" FCT") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" ENT") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" CL") PORT_CODE(KEYCODE_F8) - - PORT_INCLUDE( chessboard ) -INPUT_PORTS_END - -static INPUT_PORTS_START( megaiv ) - - PORT_START("KEY1_0") //Port $2c00 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Trn") PORT_CODE(KEYCODE_F1) - PORT_START("KEY1_1") //Port $2c01 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Info") PORT_CODE(KEYCODE_F2) // mem - PORT_START("KEY1_2") //Port $2c02 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Mem") PORT_CODE(KEYCODE_F3) - PORT_START("KEY1_3") //Port $2c03 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" Pos") PORT_CODE(KEYCODE_F4) - PORT_START("KEY1_4") //Port $2c04 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" LEV") PORT_CODE(KEYCODE_F5) - PORT_START("KEY1_5") //Port $2c05 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" FCT") PORT_CODE(KEYCODE_F6) - PORT_START("KEY1_6") //Port $2c06 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" ENT") PORT_CODE(KEYCODE_F7) - PORT_START("KEY1_7") //Port $2c07 - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" CL") PORT_CODE(KEYCODE_F8) -// PORT_START("KEY1_8") -// PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" A") PORT_CODE(KEYCODE_1) - - PORT_INCLUDE( chessboard ) - -INPUT_PORTS_END - - -static INPUT_PORTS_START( monteciv ) - PORT_START("BUTTONS_MONTE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 1 Pawn") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 2 Knight") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 3 Bishop") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 4 Rook") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 5 Queen") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 6 King") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 7 Black") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" 8 White") PORT_CODE(KEYCODE_F8) - - PORT_START("BUTTONS_MONTE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 Book") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 Pos") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mem") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Info") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Level") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_8) - - - PORT_INCLUDE( chessboard ) -INPUT_PORTS_END - - -static INPUT_PORTS_START( gen32 ) - - PORT_START("BUTTON_1") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) - - PORT_START("BUTTON_2") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - - PORT_START("BUTTON_3") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_BACKSLASH) - - PORT_INCLUDE( chessboard ) - -INPUT_PORTS_END - -static INPUT_PORTS_START( bpl32 ) - PORT_START("BUTTONS_BPL") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST1") PORT_CODE(KEYCODE_7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST2") PORT_CODE(KEYCODE_6) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_BACKSLASH) - - PORT_INCLUDE( chessboard ) -INPUT_PORTS_END - - - -static INPUT_PORTS_START( van32 ) - - PORT_START("BUTTON_3") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) - - PORT_START("BUTTON_2") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - - PORT_START("BUTTON_1") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_BACKSLASH) - - PORT_INCLUDE( chessboard ) - - INPUT_PORTS_END - -static INPUT_PORTS_START( van16 ) - - PORT_START("BUTTON_1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) - - PORT_START("BUTTON_2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - - PORT_START("BUTTON_3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_BACKSLASH) - - PORT_INCLUDE( chessboard ) - -INPUT_PORTS_END - -static MACHINE_CONFIG_FRAGMENT ( chess_common ) - - /* video hardware */ - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(100, 22) - MCFG_SCREEN_VISIBLE_AREA(0, 100-1, 0, 22-3) - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(polgar_state,chess_lcd) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", chess_lcd) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 16) - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( polgar, polgar_state ) - MCFG_CPU_ADD("maincpu",M65C02,4915200) - MCFG_CPU_PROGRAM_MAP(polgar_mem) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_MACHINE_START_OVERRIDE(polgar_state, polgar ) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state, polgar ) - MCFG_FRAGMENT_ADD( chess_common ) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_nmi, attotime::from_hz(600)) - MCFG_TIMER_START_DELAY(attotime::from_hz(60)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100)) - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( sfortea, polgar_state ) - MCFG_CPU_ADD("maincpu",M65C02,5000000) - MCFG_CPU_PROGRAM_MAP(sfortea_mem) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_MACHINE_START_OVERRIDE(polgar_state, sfortea ) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state, sfortea ) - MCFG_FRAGMENT_ADD( chess_common ) - - /* acia */ -// MCFG_MOS6551_ADD("acia65c51", XTAL_1_8432MHz, NULL) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_M6502_irq, attotime::from_hz(600)) - MCFG_TIMER_START_DELAY(attotime::from_hz(60)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( alm32, polgar_state ) - MCFG_CPU_ADD("maincpu", M68020, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(alm32_mem) - MCFG_MACHINE_START_OVERRIDE(polgar_state,van32) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) - - MCFG_FRAGMENT_ADD( chess_common ) - MCFG_NVRAM_ADD_0FILL("nvram") - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( academy, polgar ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(academy_mem) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state, academy ) - //MCFG_DEVICE_REMOVE("int_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq_academy, attotime::from_hz(600)) - -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( milano, polgar ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(milano_mem) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( monteciv, polgar_state ) - MCFG_CPU_ADD("maincpu",M65C02,8000000) - MCFG_CPU_PROGRAM_MAP( monteciv_mem ) - MCFG_MACHINE_START_OVERRIDE(polgar_state, polgar ) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state, monteciv ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_nmi, attotime::from_hz(600)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100)) - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( megaiv, monteciv ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK( 4915200 ) - MCFG_CPU_PROGRAM_MAP(megaiv_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( diablo68, polgar_state ) - MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(diablo68_mem) - MCFG_MACHINE_START_OVERRIDE(polgar_state,diablo68) - MCFG_FRAGMENT_ADD( chess_common ) - - /* acia */ -// MCFG_MOS6551_ADD("acia65c51", XTAL_1_8432MHz, NULL) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq2, attotime::from_hz(60)) - MCFG_TIMER_START_DELAY(attotime::from_hz(30)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) - - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( van16, polgar_state ) - MCFG_CPU_ADD("maincpu", M68000, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(van16_mem) - MCFG_MACHINE_START_OVERRIDE(polgar_state,van16) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(600)) - //MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(587)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) - MCFG_FRAGMENT_ADD( chess_common ) - MCFG_NVRAM_ADD_0FILL("nvram") - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( alm16, van16 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(alm16_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( van32, polgar_state ) - MCFG_CPU_ADD("maincpu", M68020, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(van32_mem) - MCFG_MACHINE_START_OVERRIDE(polgar_state,van32) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) - - MCFG_FRAGMENT_ADD( chess_common ) - MCFG_NVRAM_ADD_0FILL("nvram") - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( risc, polgar_state ) - MCFG_CPU_ADD("maincpu", ARM, 14000000) - MCFG_CPU_PROGRAM_MAP(risc_mem) - MCFG_MACHINE_START_OVERRIDE(polgar_state,risc) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) - - MCFG_FRAGMENT_ADD( chess_common ) -// MCFG_NVRAM_ADD_0FILL("nvram") - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( gen32, polgar_state ) - MCFG_CPU_ADD("maincpu", M68030, XTAL_33_333MHz) - MCFG_CPU_PROGRAM_MAP(gen32_mem) - MCFG_MACHINE_START_OVERRIDE(polgar_state,van32) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(375)) - //MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(368.64)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120)) - - MCFG_FRAGMENT_ADD( chess_common ) - MCFG_NVRAM_ADD_0FILL("nvram") - - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( gen32_oc, gen32 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK( XTAL_33_333MHz * 2 ) - MCFG_DEVICE_REMOVE("int_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(500)) - - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( bpl32, polgar_state ) - MCFG_CPU_ADD("maincpu", M68020, XTAL_24_576MHz) - MCFG_CPU_PROGRAM_MAP(bpl32_mem) - MCFG_MACHINE_START_OVERRIDE(polgar_state,van32) - MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16) - MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100)) - - MCFG_FRAGMENT_ADD( chess_common ) - MCFG_NVRAM_ADD_0FILL("nvram") - -MACHINE_CONFIG_END - - -/* ROM definitions */ - - - -ROM_START(polgar) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("polgar.bin", 0x0000, 0x10000, CRC(88d55c0f) SHA1(e86d088ec3ac68deaf90f6b3b97e3e31b1515913)) -ROM_END - -ROM_START(sfortea) - ROM_REGION(0x18000,"maincpu",0) - ROM_LOAD("sfalo.bin", 0x0000, 0x8000, CRC(86e0230a) SHA1(0d6e18a17e636b8c7292c8f331349d361892d1a8)) - ROM_LOAD("sfahi.bin", 0x8000, 0x8000, CRC(81c02746) SHA1(0bf68b68ade5a3263bead88da0a8965fc71483c1)) - ROM_LOAD("sfabook.bin", 0x10000, 0x8000, CRC(3e42cf7c) SHA1(b2faa36a127e08e5755167a25ed4a07f12d62957)) -ROM_END - -ROM_START( alm16 ) - ROM_REGION16_BE( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE("alm16eve.bin", 0x00000, 0x10000,CRC(EE5B6EC4) SHA1(30920C1B9E16FFAE576DA5AFA0B56DA59ADA3DBB)) - ROM_LOAD16_BYTE("alm16odd.bin" , 0x00001, 0x10000,CRC(D0BE4EE4) SHA1(D36C074802D2C9099CD44E75F9DE3FC7D1FD9908)) -ROM_END - -ROM_START( alm32 ) - ROM_REGION32_BE( 0x20000, "maincpu", 0 ) - ROM_LOAD("alm32.bin", 0x00000, 0x20000,CRC(38F4B305) SHA1(43459A057FF29248C74D656A036AC325202B9C15)) -ROM_END - -ROM_START(sforteb) - ROM_REGION(0x18000,"maincpu",0) - ROM_LOAD("forte_b.lo", 0x0000, 0x8000, CRC(48bfe5d6) SHA1(323642686b6d2fb8db2b7d50c6cd431058078ce1)) - ROM_LOAD("forte_b.hi1", 0x8000, 0x8000, CRC(9778ca2c) SHA1(d8b88b9768a1a9171c68cbb0892b817d68d78351)) - ROM_LOAD("forte_b.hi0", 0x10000, 0x8000, CRC(bb07ad52) SHA1(30cf9005021ab2d7b03facdf2d3588bc94dc68a6)) -ROM_END - -ROM_START(sforteba) - ROM_REGION(0x18000,"maincpu",0) - ROM_LOAD("forte b_l.bin", 0x0000, 0x8000, CRC(e3d194a1) SHA1(80457580d7c57e07895fd14bfdaf14b30952afca)) - ROM_LOAD("forte b_h.bin", 0x8000, 0x8000, CRC(dd824be8) SHA1(cd8666b6b525887f9fc48a730b71ceabcf07f3b9)) - ROM_LOAD("forte_b.hi0", 0x10000, 0x8000, BAD_DUMP CRC(bb07ad52) SHA1(30cf9005021ab2d7b03facdf2d3588bc94dc68a6)) -ROM_END - -ROM_START(sexpertb) - ROM_REGION(0x18000,"maincpu",0) - ROM_LOAD("seb69u3.bin", 0x0000, 0x8000, CRC(92002eb6) SHA1(ed8ca16701e00b48fa55c856fa4a8c6613079c02)) - ROM_LOAD("seb69u1.bin", 0x8000, 0x8000, CRC(814b4420) SHA1(c553e6a8c048dcc1cf48d410111a86e06b99d356)) - ROM_LOAD("seb605u2.bin", 0x10000, 0x8000, CRC(bb07ad52) SHA1(30cf9005021ab2d7b03facdf2d3588bc94dc68a6)) -ROM_END - -ROM_START(academy) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("acad8000.bin", 0x8000, 0x8000, CRC(a967922b) SHA1(1327903ff89bf96d72c930c400f367ae19e3ec68)) - ROM_LOAD("acad4000.bin", 0x4000, 0x4000, CRC(ee1222b5) SHA1(98541d87755a7186b69b9723cc4adbd07f20f0e2)) -ROM_END - -ROM_START(megaiv) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("megaiv.bin", 0x8000, 0x8000, CRC(dee355d2) SHA1(6bc79c0fb169020f017412f5f9696b9ecafbf99f)) - -ROM_END - -ROM_START(milano) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("milano.bin", 0x0000, 0x10000, CRC(0e9c8fe1) SHA1(e9176f42d86fe57e382185c703c7eff7e63ca711)) -ROM_END - - -ROM_START(sfortec) - ROM_REGION(0x18000,"maincpu",0) - ROM_LOAD("sfclow.bin", 0x0000, 0x8000, CRC(f040cf30) SHA1(1fc1220b8ed67cdffa3866d230ce001721cf684f)) - ROM_LOAD("sfchi.bin", 0x8000, 0x8000, CRC(0f926b32) SHA1(9c7270ecb3f41dd9172a9a7928e6e04e64b2a340)) - ROM_LOAD("sfcbook.bin", 0x10000, 0x8000, CRC(c6a1419a) SHA1(017a0ffa9aa59438c879624a7ddea2071d1524b8)) -ROM_END - - -ROM_START(sexpertc) - ROM_REGION(0x18000,"maincpu",0) // Version 3.6 of firmware - ROM_LOAD("seclow.bin", 0x0000, 0x8000, CRC(5a29105e) SHA1(be37bb29b530dbba847a5e8d27d81b36525e47f7)) - ROM_LOAD("sechi.bin", 0x8000, 0x8000, CRC(0085c2c4) SHA1(d84bf4afb022575db09dd9dc12e9b330acce35fa)) - ROM_LOAD("secbook.bin", 0x10000, 0x8000, CRC(2d085064) SHA1(76162322aa7d23a5c07e8356d0bbbb33816419af)) -ROM_END - -ROM_START( lyon16 ) - ROM_REGION16_BE( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE("lyon16ev.bin", 0x00000, 0x10000,CRC(497BD41A) SHA1(3FFEFEEAC694F49997C10D248EC6A7AA932898A4)) - ROM_LOAD16_BYTE("lyon16od.bin" , 0x00001, 0x10000,CRC(F9DE3F54) SHA1(4060E29566D2F40122CCDE3C1F84C94A9C1ED54F)) -ROM_END - -ROM_START( lyon32 ) - ROM_REGION32_BE( 0x20000, "maincpu", 0 ) - ROM_LOAD("lyon32.bin", 0x00000, 0x20000, CRC(5c128b06) SHA1(954c8f0d3fae29900cb1e9c14a41a9a07a8e185f)) -ROM_END - - -ROM_START(monteciv) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("mciv.bin", 0x8000, 0x8000, CRC(c4887694) SHA1(7f482d2a40fcb3125266e7a5407da315b4f9b49c)) - -ROM_END - -ROM_START( diablo68 ) - ROM_REGION16_BE( 0x20000, "maincpu", 0 ) - ROM_LOAD16_BYTE("evenurom.bin", 0x00000, 0x8000,CRC(03477746) SHA1(8bffcb159a61e59bfc45411e319aea6501ebe2f9)) - ROM_LOAD16_BYTE("oddlrom.bin", 0x00001, 0x8000,CRC(e182dbdd) SHA1(24dacbef2173fa737636e4729ff22ec1e6623ca5)) - ROM_LOAD16_BYTE("book.bin", 0x10000, 0x8000,CRC(553a5c8c) SHA1(ccb5460ff10766a5ca8008ae2cffcff794318108)) -ROM_END - -ROM_START( van16 ) - ROM_REGION16_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD16_BYTE("va16even.bin", 0x00000, 0x20000,CRC(E87602D5) SHA1(90CB2767B4AE9E1B265951EB2569B9956B9F7F44)) - ROM_LOAD16_BYTE("va16odd.bin" , 0x00001, 0x20000,CRC(585F3BDD) SHA1(90BB94A12D3153A91E3760020E1EA2A9EAA7EC0A)) -ROM_END - - -ROM_START( van32 ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("vanc32.bin", 0x00000, 0x40000,CRC(F872BEB5) SHA1(9919F207264F74E2B634B723B048AE9CA2CEFBC7)) -ROM_END - - -ROM_START( risc ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD("s2500.bin", 0x000000, 0x20000, CRC(7a707e82) SHA1(87187fa58117a442f3abd30092cfcc2a4d7c7efc)) -ROM_END - -ROM_START( gen32 ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("gen32_4.bin", 0x00000, 0x40000,CRC(6CC4DA88) SHA1(EA72ACF9C67ED17C6AC8DE56A165784AA629C4A1)) -ROM_END - -ROM_START( gen32_41 ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("gen32_41.bin", 0x00000, 0x40000,CRC(ea9938c0) SHA1(645cf0b5b831b48104ad6cec8d78c63dbb6a588c)) -ROM_END - -ROM_START( gen32_oc ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("gen32_41.bin", 0x00000, 0x40000,CRC(ea9938c0) SHA1(645cf0b5b831b48104ad6cec8d78c63dbb6a588c)) -ROM_END - -ROM_START( berlinp ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("berlinp.bin", 0x00000, 0x40000,CRC(82FBAF6E) SHA1(729B7CEF3DFAECC4594A6178FC4BA6015AFA6202)) -ROM_END - -ROM_START( bpl32 ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("bpl32.bin", 0x00000, 0x40000,CRC(D75E170F) SHA1(AC0EBDAA114ABD4FEF87361A03DF56928768B1AE)) -ROM_END - -ROM_START( lond020 ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("lond020.bin", 0x00000, 0x40000,CRC(3225B8DA) SHA1(FD8F6F4E9C03B6CDC86D8405E856C26041BFAD12)) -ROM_END - -ROM_START( lond030 ) - ROM_REGION32_BE( 0x40000, "maincpu", 0 ) - ROM_LOAD("lond030.bin", 0x00000, 0x40000,CRC(853BAA4E) SHA1(946951081D4E91E5BDD9E93D0769568A7FE79BAD)) -ROM_END - -DRIVER_INIT_MEMBER(polgar_state,polgar) -{ - led_status=0; -} - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ - CONS( 1986, polgar, 0, 0, polgar, polgar, polgar_state, polgar, "Hegener & Glaser", "Mephisto Polgar Schachcomputer", MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK) - CONS( 1987, sfortea, 0, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version A)", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1988, alm16, van16, 0, alm16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Almeria 68000", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1988, alm32, van16, 0, alm32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Alimera 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1988, sforteb, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version B)", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1988, sforteba, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version B, alt)", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1988, sexpertb, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Expert B Chess Computer", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1989, academy, 0, 0, academy, academy, driver_device, 0, "Hegener & Glaser", "Mephisto Academy Schachcomputer", MACHINE_REQUIRES_ARTWORK|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1989, megaiv, 0, 0, megaiv, megaiv, driver_device, 0, "Hegener & Glaser", "Mephisto Mega IV Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1989, milano, polgar, 0, milano, polgar, polgar_state, polgar, "Hegener & Glaser", "Mephisto Milano Schachcomputer", MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) -//CONS( 1989, montec4, 0, 0, monteciv, monteciv, driver_device, 0, "Hegener & Glaser", "Mephisto Monte Carlo IV", MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1989, sfortec, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Forte Chess Computer (version C)", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1989, sexpertc, sfortea, 0, sfortea, sfortea, driver_device, 0, "Novag", "Novag Super Expert C Chess Computer", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1990, lyon16, van16, 0, alm16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Lyon 68000", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1990, lyon32, van16, 0, alm32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Lyon 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1990, monteciv, 0, 0, monteciv, monteciv, driver_device, 0, "Hegener & Glaser", "Mephisto Monte Carlo IV LE Schachcomputer", MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1991, diablo68, 0, 0, diablo68, sfortea, driver_device, 0, "Novag", "Novag Diablo 68000 Chess Computer", MACHINE_NO_SOUND|MACHINE_SUPPORTS_SAVE|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1991, van16, 0, 0, van16, van16, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Vancouver 68000", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1991, van32, van16, 0, van32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Vancouver 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1992, risc, 0, 0, risc, van16, driver_device, 0, "Saitek", "RISC2500", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK|MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1993, gen32, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.00", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1993, gen32_41, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.01", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1993, gen32_oc, van16, 0, gen32_oc, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 V4.01OC", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK|MACHINE_UNOFFICIAL | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1994, berlinp, van16, 0, bpl32, bpl32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Berlin Pro 68020", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1996, bpl32, van16, 0, bpl32, bpl32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Berlin Pro London Upgrade V5.00", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1996, lond020, van16, 0, van32, van32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto London 68020 32 Bit", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) - CONS( 1996, lond030, van16, 0, gen32, gen32, driver_device, 0, "Hegener & Glaser Muenchen", "Mephisto Genius030 London Upgrade V5.00", MACHINE_SUPPORTS_SAVE|MACHINE_REQUIRES_ARTWORK | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mess/drivers/mod8.c b/src/mess/drivers/mod8.c deleted file mode 100644 index 48574a94df9..00000000000 --- a/src/mess/drivers/mod8.c +++ /dev/null @@ -1,171 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - -Microsystems International Limited MOD-8 - -M.I.L. was formed in 1968 from a joint venture between the Canadian -Government and Northern Telecom. It produced a variety of computer -chips, eproms, etc, plus parts for the telephone company. It folded -in 1975. -(Info from http://www.cse.yorku.ca/museum/v_tour/artifacts/artifacts.htm) - - - 2009-11-18 Skeleton driver. - 2009-12-02 Working driver [Miodrag Milanovic] - 2011-06-14 Modernised & above notes added. - -Commands: -All commands consist of 3 uppercase letters. If further info is required -then a * prompt is printed on a new line, where you will enter the data. -All numbers are OCTAL (3/6 digits with leading zeros). Since a teletypewriter -is being used, there is no cursor. Do NOT press Enter except after these -commands, otherwise things get confusing. - -LOC - set current location pointer (the CLP) -DLP - display CLP -DPS - dump symbolic -LDO - load octal -DPO - dump octal -LBF - load BNPF format -DBF - dump BNPF format -EDT - enter Edit Mode -XQT - initiate program execution -CPY - copy routine -TRN - translate routine -SBP - set breakpoint -CBP - clear breakpoint -PRG - program PROM - -Pressing Ctrl-A will escape back to the monitor. You will see 8 dashes. - -Commands in the Edit Mode: -When you enter the Edit Mode it displays the CLP followed by a slash. - -nnn - enter a new value into this memory location and increment the CLP -` (tic) - decrement CLP -@ - same as XQT -R - return to monitor -*nnnnnn - change CLP to this value -space - display current contents of memory - -While in 'space' mode, press a letter to increment CLP, or shift-delete -(underscore character) followed by a new byte for this location. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8008/i8008.h" -#include "machine/teleprinter.h" - -class mod8_state : public driver_device -{ -public: - mod8_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_teleprinter(*this, TELEPRINTER_TAG) - , m_maincpu(*this, "maincpu") - { } - - DECLARE_WRITE8_MEMBER(out_w); - DECLARE_WRITE8_MEMBER(tty_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(tty_r); - IRQ_CALLBACK_MEMBER(mod8_irq_callback); -private: - UINT16 m_tty_data; - UINT8 m_tty_key_data; - int m_tty_cnt; - virtual void machine_reset(); - required_device m_teleprinter; - required_device m_maincpu; -}; - -WRITE8_MEMBER( mod8_state::out_w ) -{ - m_tty_data >>= 1; - m_tty_data |= BIT(data, 0) ? 0x8000 : 0; - m_tty_cnt++; - - if (m_tty_cnt == 10) - { - m_teleprinter->write(space, 0, (m_tty_data >> 7) & 0x7f); - m_tty_cnt = 0; - } -} - -WRITE8_MEMBER( mod8_state::tty_w ) -{ - m_tty_data = 0; - m_tty_cnt = 0; -} - -READ8_MEMBER( mod8_state::tty_r ) -{ - UINT8 d = m_tty_key_data & 1; - m_tty_key_data >>= 1; - return d; -} - -static ADDRESS_MAP_START(mod8_mem, AS_PROGRAM, 8, mod8_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000,0x6ff) AM_ROM - AM_RANGE(0x700,0xfff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mod8_io, AS_IO, 8, mod8_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00,0x00) AM_READ(tty_r) - AM_RANGE(0x0a,0x0a) AM_WRITE(out_w) - AM_RANGE(0x0b,0x0b) AM_WRITE(tty_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mod8 ) -INPUT_PORTS_END - -IRQ_CALLBACK_MEMBER(mod8_state::mod8_irq_callback) -{ - return 0xC0; // LAA - NOP equivalent -} - -void mod8_state::machine_reset() -{ -} - -WRITE8_MEMBER( mod8_state::kbd_put ) -{ - m_tty_key_data = data ^ 0xff; - m_maincpu->set_input_line(0, HOLD_LINE); -} - -static MACHINE_CONFIG_START( mod8, mod8_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8008, 800000) - MCFG_CPU_PROGRAM_MAP(mod8_mem) - MCFG_CPU_IO_MAP(mod8_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(mod8_state,mod8_irq_callback) - - /* video hardware */ - MCFG_DEVICE_ADD(TELEPRINTER_TAG, TELEPRINTER, 0) - MCFG_GENERIC_TELEPRINTER_KEYBOARD_CB(WRITE8(mod8_state, kbd_put)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( mod8 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mon8.001", 0x0000, 0x0100, CRC(b82ac6b8) SHA1(fbea5a6dd4c779ca1671d84089f857a3f548ffcb)) - ROM_LOAD( "mon8.002", 0x0100, 0x0100, CRC(8b82bc3c) SHA1(66222511527b27e56a5a1f9656d424d407eac7d3)) - ROM_LOAD( "mon8.003", 0x0200, 0x0100, CRC(679ae913) SHA1(22423efcb9051c9812fcbac9a27af70415d0dd81)) - ROM_LOAD( "mon8.004", 0x0300, 0x0100, CRC(2a4e580f) SHA1(8b0cb9660fde3cacd299faaa31724e4f3262d77f)) - ROM_LOAD( "mon8.005", 0x0400, 0x0100, CRC(e281bb1a) SHA1(cc7c2746e075512dbf5eed88ae3aea009558dbd0)) - ROM_LOAD( "mon8.006", 0x0500, 0x0100, CRC(b7e2f585) SHA1(5408adabc3df6e6ea8dcfb2327b2883b435ab85e)) - ROM_LOAD( "mon8.007", 0x0600, 0x0100, CRC(49a5c626) SHA1(66c1865db9151818d3b20ec3c68dd793cb98a221)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1974, mod8, 0, 0, mod8, mod8, driver_device, 0, "Microsystems International Ltd", "MOD-8", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/modellot.c b/src/mess/drivers/modellot.c deleted file mode 100644 index 9c2421bddd0..00000000000 --- a/src/mess/drivers/modellot.c +++ /dev/null @@ -1,189 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/********************************************************************************** - - General Processor Modello T - - 2012-12-10 Skeleton driver. - 2013-09-27 Added keyboard and cursor. - - Made in Italy, a single board with numerous small daughter boards. - The 3 units (keyboard, disk drives, main unit) had wooden cabinets. - It had an inbuilt small green-screen CRT, like a Kaypro, and the RAM could - be 16, 32, or 48k. The FDC is a FD1791. - - All the articles and doco (what there is of it) is all in Italian. - -***********************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/keyboard.h" - -#define KEYBOARD_TAG "keyboard" - -class modellot_state : public driver_device -{ -public: - modellot_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu") - { - } - - DECLARE_READ8_MEMBER(port77_r); - DECLARE_READ8_MEMBER(portff_r); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT32 screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; -private: - UINT8 m_term_data; - const UINT8 *m_p_chargen; - virtual void machine_reset(); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(modellot_mem, AS_PROGRAM, 8, modellot_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xbfff) AM_RAM // 48k ram - AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0xe000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(modellot_io, AS_IO, 8, modellot_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x77, 0x77) AM_READ(port77_r) - AM_RANGE(0xff, 0xff) AM_READ(portff_r) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( modellot ) -INPUT_PORTS_END - -READ8_MEMBER( modellot_state::port77_r) -{ - return 4; -} - -READ8_MEMBER( modellot_state::portff_r) -{ - UINT8 data = (m_term_data) ? m_term_data ^ 0x7f : 0xff; - m_term_data = 0; - return data; -} - -WRITE8_MEMBER( modellot_state::kbd_put ) -{ - m_term_data = data; -} - -void modellot_state::machine_reset() -{ - m_term_data = 1; - m_p_chargen = memregion("chargen")->base(); - m_maincpu->set_state_int(Z80_PC, 0xe000); -} - -const gfx_layout modellot_charlayout = -{ - 8, 16, /* 8x16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {0,1,2,3,4,5,6,7}, - {0, 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, - 0x400*8, 0x401*8, 0x402*8, 0x403*8, 0x404*8, 0x405*8, 0x406*8, 0x407*8}, - 8*8 /* space between characters */ -}; - -static GFXDECODE_START( modellot ) - GFXDECODE_ENTRY( "chargen", 0x0000, modellot_charlayout, 0, 1 ) -GFXDECODE_END - - -UINT32 modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,inv; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 16; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 64; x++) - { - inv = 0; - - chr = m_p_videoram[x+ma]; - - if BIT(chr, 7) inv = 0xff; - - chr &= 0x7f; // cursor - - if (ra < 8) - gfx = m_p_chargen[(chr<<3) | ra ]; - else - gfx = m_p_chargen[(chr<<3) | (ra-8) | 0x400]; - - gfx ^= inv; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} - -static MACHINE_CONFIG_START( modellot, modellot_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(modellot_mem) - MCFG_CPU_IO_MAP(modellot_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*8, 16*16) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) - MCFG_SCREEN_UPDATE_DRIVER(modellot_state, screen_update_modellot) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", modellot ) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* Devices */ - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(modellot_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( modellot ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - //ROM_LOAD( "fdc8119.u3", 0x0000, 0x0400, CRC(a8aee944) SHA1(f2cc598ed2e7a1a620e2f3f53c1a573965f6af26)) - ROM_LOAD( "dt49-48.u1", 0xe000, 0x0400, CRC(2441c438) SHA1(832994a4214a744b7e19e5f74000c95ae65e3759)) - ROM_LOAD( "ht20.u2", 0xe400, 0x0400, CRC(497c0495) SHA1(d03beebc4c31284729f6eac3bdf1fbf44adf7fff)) - - ROM_REGION( 0x0800, "chargen", ROMREGION_INVERT ) - ROM_LOAD( "gcem1.u3", 0x0000, 0x0200, CRC(e7739268) SHA1(091ef69282abe657d5f38c70a572964f5200a1d5)) - ROM_CONTINUE(0x400, 0x200) - ROM_LOAD( "gcem2.u4", 0x0200, 0x0200, CRC(6614330e) SHA1(880a541fb0ef6f37ac89439f9ea75a313c3e53d6)) - ROM_CONTINUE(0x600, 0x200) -ROM_END - -/* Driver */ -COMP( 1979, modellot, 0, 0, modellot, modellot, driver_device, 0, "General Processor", "Modello T", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/molecular.c b/src/mess/drivers/molecular.c deleted file mode 100644 index d976f124fe3..00000000000 --- a/src/mess/drivers/molecular.c +++ /dev/null @@ -1,356 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders: Angelo Salese -/*********************************************************************************** - -MOLECULAR Computer - -Notes: - -File Processor i/os -0x00 DMA -0x10-0x13 CTC -0x20-0x23 CTC (Serial A Clock, Serial B Clock, Parity Error IRQ, Bus IRQ) -0x40-0x43 SIO (Serial A Data, Serial A Control, Serial B Data, Serial B Control) -0x60-0x63 FDC (Control, Cylinder, Sector, Data) -0x70 PLOW Lower Parallel i/o -0x71 PHI Upper Parallel i/o -0x80-0x87 HDD (Status, Data, Result 0-5) - -Application Processor i/os -0x00-0x03 PIO (Parallel A Data, Parallel A Control, Parallel B Data, Parallel B Control) -0x20 DMA -0x30-0x33 CTC (Serial A Clock, Serial B Clock, Parity Error IRQ, Bus IRQ) -0x60-0x63 SIO (Serial A Data, Serial A Control, Serial B Data, Serial B Control) - -File Processor irqs: -0xf80c PIO Ch A -0xf80e PIO Ch B -0xf810-0xf81e SIO Vector N -0xf820-0xf826 CTC A, Channel N -0xf828-0xf82e CTC B, Channel N (do not use) -0xf830 DMA (do not use) - -Application Processor irqs: -0xf80c PIO Ch A -0xf80e PIO Ch B -0xf810 DMA (do not use) -0xf820-0xf82e SIO Vector N - -App Processor puts on sio port: -"??250 INITIALIZING..." - -File Processor puts on sio port: -"??FP RESTART" - -TODO: -- Info on HW ports is pretty scarse, other than a trim i/o documentation and schematics - -***********************************************************************************/ - - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "cpu/z80/z80.h" -//#include "sound/ay8910.h" - -#define I86_CLOCK XTAL_24MHz -#define Z80_CLOCK XTAL_16MHz - -class molecula_state : public driver_device -{ -public: - molecula_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_filecpu(*this, "filecpu") - { } - - // devices - required_device m_filecpu; - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - UINT8 *m_file_rom; - UINT8 *m_app_rom; - UINT8 *m_file_ram; - UINT8 *m_app_ram; - DECLARE_READ8_MEMBER(file_r); - DECLARE_WRITE8_MEMBER(file_w); - - DECLARE_READ8_MEMBER(app_r); - DECLARE_WRITE8_MEMBER(app_w); - - DECLARE_WRITE8_MEMBER(file_output_w); - DECLARE_WRITE8_MEMBER(app_output_w); - - DECLARE_READ8_MEMBER( sio_r ); - DECLARE_WRITE8_MEMBER( sio_w ); - - UINT8 app_ram_enable; - UINT8 file_ram_enable; - - DECLARE_PALETTE_INIT(molecula); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); -}; - -void molecula_state::video_start() -{ -} - -UINT32 molecula_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - return 0; -} - -READ8_MEMBER(molecula_state::file_r) -{ - if(file_ram_enable) - return m_file_ram[offset]; - - return m_file_rom[offset & 0x7ff]; -} - - -WRITE8_MEMBER(molecula_state::file_w) -{ - m_file_ram[offset] = data; -} - -READ8_MEMBER(molecula_state::app_r) -{ - if(app_ram_enable) - return m_app_ram[offset]; - - return m_app_rom[offset & 0x7ff]; -} - - -WRITE8_MEMBER(molecula_state::app_w) -{ - m_app_ram[offset] = data; -} - -WRITE8_MEMBER(molecula_state::file_output_w) -{ - if(offset == 0) - file_ram_enable = (data & 0x80) >> 7; - - if(data & 0x7f || offset) - printf("FILE output -> %02x %02x\n",data,offset); -} - - -WRITE8_MEMBER(molecula_state::app_output_w) -{ - app_ram_enable = (data & 0x80) >> 7; - - if(data & 0x7f) - printf("APP 0x10 -> %02x\n",data); -} - -READ8_MEMBER( molecula_state::sio_r) -{ - if(offset == 1) - return 4; - - return 0; -} - -WRITE8_MEMBER( molecula_state::sio_w) -{ - if(offset == 0) - printf("%c",data); -} - -static ADDRESS_MAP_START( molecula_file_map, AS_PROGRAM, 8, molecula_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(file_r,file_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( molecula_file_io, AS_IO, 8, molecula_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) -// AM_RANGE(0x40, 0x43) AM_READWRITE(sio_r,sio_w) - AM_RANGE(0x72, 0x73) AM_WRITE(file_output_w) // unknown -ADDRESS_MAP_END - -static ADDRESS_MAP_START( molecula_app_map, AS_PROGRAM, 8, molecula_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(app_r,app_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( molecula_app_io, AS_IO, 8, molecula_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x10, 0x10) AM_WRITE(app_output_w) - AM_RANGE(0x60, 0x63) AM_READWRITE(sio_r,sio_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( molecula ) - /* dummy active high structure */ - PORT_START("SYSA") - PORT_DIPNAME( 0x01, 0x00, "SYSA" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - - /* dummy active low structure */ - PORT_START("DSWA") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -#if 0 -static const gfx_layout charlayout = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { RGN_FRAC(0,1) }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; -#endif - -static GFXDECODE_START( molecula ) -// GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) -GFXDECODE_END - - -void molecula_state::machine_start() -{ - m_file_rom = memregion("fileipl")->base(); - m_app_rom = memregion("appipl")->base(); - - m_file_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_app_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); -} - -void molecula_state::machine_reset() -{ - app_ram_enable = 0; - file_ram_enable = 0; -} - - -PALETTE_INIT_MEMBER(molecula_state, molecula) -{ -} - -static MACHINE_CONFIG_START( molecula, molecula_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("filecpu",Z80,Z80_CLOCK/2) - MCFG_CPU_PROGRAM_MAP(molecula_file_map) - MCFG_CPU_IO_MAP(molecula_file_io) - MCFG_DEVICE_DISABLE() - - MCFG_CPU_ADD("appcpu",Z80,Z80_CLOCK/2) - MCFG_CPU_PROGRAM_MAP(molecula_app_map) - MCFG_CPU_IO_MAP(molecula_app_io) - -// MCFG_CPU_ADD("sub",I8086,I86_CLOCK/2) -// MCFG_CPU_PROGRAM_MAP(molecula_map) -// MCFG_CPU_IO_MAP(molecula_io) -// MCFG_DEVICE_DISABLE() - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(molecula_state, screen_update) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", molecula) - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(molecula_state, molecula) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( molecula ) - ROM_REGION( 0x10000, "fileipl", ROMREGION_ERASE00 ) - ROM_LOAD( "sm32-111782-255-ff.bin", 0x000000, 0x000800, CRC(818f5f5a) SHA1(829b8fef99e6667d04d1944112823f3ea6a1a7e8) ) - - ROM_REGION( 0x10000, "appipl", ROMREGION_ERASE00 ) - ROM_LOAD( "ap-111181-fa.bin", 0x000000, 0x000800, CRC(c289fc90) SHA1(2c0a17808971400e0289d65a11ef09e1f5eb90a0) ) - - ROM_REGION( 0x1000, "x86ipl", ROMREGION_ERASE00 ) - ROM_LOAD16_BYTE( "ap86eve_2716.bin", 0x000000, 0x000800, CRC(d6484a11) SHA1(19cfea72afbc796e5b59c47095529d6d6350dd98) ) - ROM_LOAD16_BYTE( "ap86odd_2716.bin", 0x000001, 0x000800, CRC(a4403c13) SHA1(2aeb07ad1f3381cbd1ec901e1f095ae737ded538) ) - - /* same as ap-111181-fa.bin, with a different & bad byte at [3]*/ - ROM_REGION( 0x10000, "user2", ROMREGION_ERASE00 ) - ROM_LOAD( "ap-111181-253-fd.bin", 0x000000, 0x000800, CRC(10f16080) SHA1(10f13a04c525cd4b67e2b6e1a3eed46c619a439c) ) - - /* proms */ - ROM_REGION( 0x10000, "user3", ROMREGION_ERASE00 ) - ROM_LOAD( "ms01_82s131.bin", 0x000000, 0x000200, CRC(433b139c) SHA1(32c1e853faacf85b11506a6903789ef129dd6adc) ) - ROM_LOAD( "ms11_82s131.bin", 0x000200, 0x000200, CRC(cff86fed) SHA1(554ec15799afc6305c8cae0f9d55b32004479cdb) ) - - ROM_REGION( 0x10000, "misc", ROMREGION_ERASE00 ) - ROM_LOAD( "mem_16r4.jed", 0x000000, 0x00caef, CRC(a8cfbdfe) SHA1(92be58ab3299e0d3ac37bd1e258054c881b9ad7f) ) - ROM_LOAD( "rx_16r8.jed", 0x000000, 0x00caef, CRC(76f11ea8) SHA1(3ec41e5af04a89659f1b30270ee00e1fdf302ad6) ) - ROM_LOAD( "tx_16r8.jed", 0x000000, 0x00caef, CRC(a91dcf0b) SHA1(16d261f064a4af29c3da58f3ae8a867bdc953ce6) ) - ROM_LOAD( "wait_16r4.jed", 0x000000, 0x00caef, CRC(3aacfeb4) SHA1(1af1a8046e5a8a0337c85b55adceaef6e45702b7) ) -ROM_END - -COMP( 1982, molecula, 0, 0, molecula, molecula, driver_device, 0, "MOLECULAR", "MOLECULAR Computer", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/monty.c b/src/mess/drivers/monty.c deleted file mode 100644 index 3ac595f9691..00000000000 --- a/src/mess/drivers/monty.c +++ /dev/null @@ -1,288 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Andrew Gardner -/*************************************************************************** - - 2015-05-08 Skeleton driver for Ritam Monty Plays Scrabble BRAND crossword game - - Scrabble computer that allows you play a game of Scrabble by yourself (or you - can play with up to 3 players). Has a built-in 12,000 vocabulary, expandable - to 44,000 by way of 2 expansion modules each containing 16,000 more obscure words. - You can use the included 'score cards' (which look like little Scrabble boards), - or you can use a real Scrabble board and tiles to play. Also note, Monty - apparently originally came with a little pen. - - This game was later upgraded by Ritam to Master Monty which had 24,000 words - built-in (expandable to a total of 56,000 with the same 2 expansion modules). - Two variations on Master Monty have been seen: one looks exactly the same as the - Monty but the electronics on the inside have been upgraded. The later version - is blue and says Master Monty at the top. Both of these versions are hand-upgraded - by adding chips and wires to the inside of the game. - - TODO: - - Need instructions - - Proper SED1503F emulation (it's simulated in-driver for now) - - After each keypress it hits a HALT instruction. I guess the controller's - sync pin is involved somehow. - - When it wants tiles, put 64 into FD1B (monty), 7D1B (mmonty) and press - Enter. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/sed1520.h" -#include "sound/speaker.h" - - -class monty_state : public driver_device -{ -public: - monty_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_speaker(*this, "speaker") - , m_sed0(*this, "sed1520_0") - , m_writeUpper(false) - { - for (int i = 0; i < 42*32; i++) - m_pixels[i] = 0xff000000; - } - - DECLARE_WRITE8_MEMBER(sound_w); - DECLARE_WRITE8_MEMBER(ioDisplayWrite_w); - DECLARE_WRITE8_MEMBER(ioCommandWrite0_w); - DECLARE_WRITE8_MEMBER(ioCommandWrite1_w); - - // screen updates - UINT32 lcd_update(screen_device& screen, bitmap_rgb32& bitmap, const rectangle& cliprect); - -private: - required_device m_maincpu; - required_device m_speaker; - required_device m_sed0; // TODO: This isn't actually a SED1520, it's a SED1503F - //required_device m_sed1; // TODO: Also, there are 2 SED1503Fs on the board - one is flipped upside down - - // Test - UINT8 m_writeUpper; - UINT32 m_pixels[42*32]; - bool m_sound_sw; - bool m_dirty; -}; - - -static ADDRESS_MAP_START( monty_mem, AS_PROGRAM, 8, monty_state ) - AM_RANGE(0x0000, 0xbfff) AM_ROM - //AM_RANGE(0x4000, 0x4000) // The main rom checks to see if another program is here on startup - AM_RANGE(0xf800, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mmonty_mem, AS_PROGRAM, 8, monty_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - //AM_RANGE(0xc000, 0xc000) // The main rom checks to see if another program is here on startup - AM_RANGE(0x8000, 0xffff) AM_ROM - AM_RANGE(0x7800, 0x7fff) AM_RAM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( monty_io, AS_IO, 8, monty_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(ioCommandWrite0_w) - AM_RANGE(0x01, 0x01) AM_WRITE(sound_w) - AM_RANGE(0x02, 0x02) AM_WRITE(ioCommandWrite1_w) - AM_RANGE(0x80, 0xff) AM_WRITE(ioDisplayWrite_w) - - // 7 reads from a bit shifted IO port - AM_RANGE(0x01, 0x01) AM_READ_PORT("X1") - AM_RANGE(0x02, 0x02) AM_READ_PORT("X2") - AM_RANGE(0x04, 0x04) AM_READ_PORT("X3") - AM_RANGE(0x08, 0x08) AM_READ_PORT("X4") - AM_RANGE(0x10, 0x10) AM_READ_PORT("X5") - AM_RANGE(0x20, 0x20) AM_READ_PORT("X6") - AM_RANGE(0x40, 0x40) AM_READ_PORT("X7") -ADDRESS_MAP_END - - -// Input ports -static INPUT_PORTS_START( monty ) - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("X7") - PORT_BIT( 0xFF, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -WRITE8_MEMBER( monty_state::sound_w ) -{ - m_sound_sw ^= 1; - m_speaker->level_w(m_sound_sw); -} - - -WRITE8_MEMBER( monty_state::ioCommandWrite0_w ) -{ - //printf("(%04x) Command Port 0 write : %02x\n", m_maincpu->pc(), data); - m_writeUpper = false; -} - - -WRITE8_MEMBER( monty_state::ioCommandWrite1_w ) -{ - //if (data == 0xfe) - // printf("---\n"); - - //printf("(%04x) Command Port 1 write : %02x\n", m_maincpu->pc(), data); - m_writeUpper = true; -} - - -WRITE8_MEMBER( monty_state::ioDisplayWrite_w ) -{ - m_dirty = true; - // Offset directly corresponds to sed1503, DD RAM address (offset 0x7f may be special?) - //printf("(%04x) %02x %02x\n", m_maincpu->pc(), offset, data); - - UINT8 x = offset & 0x3f; - UINT8 y = (BIT(offset, 6) + (m_writeUpper ? 2 : 0)) << 3; - - // Skip the controller and write straight to the LCD (pc=134f) - for (int i = 0; i < 8; i++) - { - // Pixel color - if (x < 42) - m_pixels[(y*42) + x] = BIT(data, i) ? 0xffffffff : 0xff000000; - - y++; - } -} - - -UINT32 monty_state::lcd_update(screen_device& screen, bitmap_rgb32& bitmap, const rectangle& cliprect) -{ - if (!m_dirty) - return 1; - - UINT8 x,y,z; - m_dirty = false; - for (y = 0; y < 32; y++) - { - for (z = 0; z < 8; z++) - { - for (x = 0; x < 5; x++) - { - bitmap.pix32(y, x+z*6) = m_pixels[y*42 + z*5 + x]; - } - bitmap.pix32(y, 5+z*6) = 0; // space between letters - } - bitmap.pix32(y, 48) = m_pixels[y*42 + 40]; - bitmap.pix32(y, 49) = m_pixels[y*42 + 41]; - } - - return 0; -} - - -SED1520_UPDATE_CB(monty_screen_update) -{ - // TODO: Not really a SED1520 - there are two SED1503s - return 0x00; -} - - -// TODO: Additional machine definition - Master Monty has a different memory layout -static MACHINE_CONFIG_START( monty, monty_state ) - // Basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, 3580000) // Ceramic resonator labeled 3.58MT - MCFG_CPU_PROGRAM_MAP(monty_mem) - MCFG_CPU_IO_MAP(monty_io) - - // Video hardware - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // Not accurate - MCFG_SCREEN_SIZE(50, 32) // Two SED1503s (42x16 pixels) control the top and bottom halves - MCFG_SCREEN_VISIBLE_AREA(0, 50-1, 0, 32-1) - MCFG_SCREEN_UPDATE_DRIVER(monty_state, lcd_update) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - // LCD controller interfaces - MCFG_SED1520_ADD("sed1520_0", monty_screen_update) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mmonty, monty ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(mmonty_mem) -MACHINE_CONFIG_END - - -// ROM definitions -ROM_START( monty ) - ROM_REGION(0xc000, "maincpu", 0) - ROM_LOAD( "monty_main.bin", 0x0000, 0x4000, CRC(720b4f55) SHA1(0106eb88d3fbbf25a745b9b6ee785ba13689d095) ) // 27128 - ROM_LOAD( "monty_module1.bin", 0x4000, 0x4000, CRC(2725d8c3) SHA1(8273b9779c0915f9c7c43ea4fb460f43ce036358) ) // 27128 - ROM_LOAD( "monty_module2.bin", 0x8000, 0x4000, CRC(db672e47) SHA1(bb14fe86df06cfa4b19625ba417d1a5bc8eae155) ) // 27128 - ROM_FILL(0x1193,1,0) // patch out HALT so we can type in our names -ROM_END - -ROM_START( mmonty ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "master_monty_main.bin", 0x0000, 0x8000, CRC(bb5ef4d4) SHA1(ba2c759e429f8740df419f9abb60832eddfba8ab) ) // 27C256 - ROM_LOAD( "monty_module1.bin", 0x8000, 0x4000, CRC(2725d8c3) SHA1(8273b9779c0915f9c7c43ea4fb460f43ce036358) ) // 27128 - ROM_LOAD( "monty_module2.bin", 0xc000, 0x4000, CRC(db672e47) SHA1(bb14fe86df06cfa4b19625ba417d1a5bc8eae155) ) // 27128 - ROM_FILL(0x1487,1,0) // patch out HALT so we can type in our names -ROM_END - - -// Drivers -// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS -COMP( 1980, monty, 0, 0, monty, monty, driver_device, 0, "Ritam", "Monty Plays Scrabble", MACHINE_NOT_WORKING ) -COMP( 1982, mmonty, 0, 0, mmonty, monty, driver_device, 0, "Ritam", "Master Monty", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/mpf1.c b/src/mess/drivers/mpf1.c deleted file mode 100644 index b8ed818e0e8..00000000000 --- a/src/mess/drivers/mpf1.c +++ /dev/null @@ -1,483 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Curt Coder -/************************************************\ -* Multitech Micro Professor 1 * -* * -* CPU: Z80 @ 1.79 MHz * -* ROM: 4-kilobyte ROM monitor * -* RAM: 4 kilobytes * -* Input: Hex keypad * -* Storage: Cassette tape * -* Video: 6x 7-segment LED display * -* Sound: Speaker * -\************************************************/ - -/* - - Keys: - 0-9,A-F : hexadecimal numbers - ADR : enter an address to work with. After the 4 digits are entered, - the data at that address shows, and you can modify the data. - + : Enter the data into memory, and increment the address by 1. - GO : execute the program located at the current address. - - Pasting: - 0-F : as is - + : ^ - - : V - ADDR : - - DATA : = - GO : X - PC : P - - Test Paste: - -1800=11^22^33^44^55^66^77^88^99^-1800 - Now press up-arrow to confirm the data has been entered. - - TODO: - - - remove halt callback - - crt board - - speech board - - printers - - clickable artwork - - video board (has 6845) - - mpf1p has 49-key keyboard - - computer can't keep up with paste - - paste only set up for mpf1 - -*/ - -#include "includes/mpf1.h" -#include "mpf1.lh" -#include "mpf1b.lh" -#include "mpf1p.lh" - -/* Address Maps */ - -static ADDRESS_MAP_START( mpf1_map, AS_PROGRAM, 8, mpf1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1800, 0x1fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mpf1b_map, AS_PROGRAM, 8, mpf1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1800, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0x2fff) AM_ROM - AM_RANGE(0x5000, 0x6fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mpf1p_map, AS_PROGRAM, 8, mpf1_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x6000, 0x6fff) AM_ROM - AM_RANGE(0xf000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mpf1_io_map, AS_IO, 8, mpf1_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_MIRROR(0x3c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) - AM_RANGE(0x40, 0x43) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mpf1b_io_map, AS_IO, 8, mpf1_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_MIRROR(0x3c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) - AM_RANGE(0x40, 0x43) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) - AM_RANGE(0xfe, 0xfe) AM_MIRROR(0x01) AM_DEVREADWRITE(TMS5220_TAG, tms5220_device, status_r, data_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mpf1p_io_map, AS_IO, 8, mpf1_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_MIRROR(0x3c) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) - AM_RANGE(0x40, 0x43) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( mpf1_state::trigger_nmi ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER( mpf1_state::trigger_irq ) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER( mpf1_state::trigger_res ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -static INPUT_PORTS_START( mpf1 ) - PORT_START("PC0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 HL") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 HL'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B I*IF") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F *PNC'") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 DE") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 DE'") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A SP") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E SZ*H'") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 BC") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 BC'") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 IY") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D *PNC") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STEP") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAPE RD") PORT_CODE(KEYCODE_F5) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 AF") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 AF'") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 IX") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C SZ*H") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAPE WR") PORT_CODE(KEYCODE_F6) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBR") PORT_CODE(KEYCODE_N) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_COMMA) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ADDR") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_SLASH) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RELA") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SBR") PORT_CODE(KEYCODE_H) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DATA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_COLON) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MOVE") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("USER KEY") PORT_CODE(KEYCODE_U) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MONI") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_nmi, 0) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INTR") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_irq, 0) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_res, 0) -INPUT_PORTS_END - -static INPUT_PORTS_START( mpf1b ) - PORT_START("PC0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 >") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B STOP") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F LET") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 *") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 <") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A CALL") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E INPUT") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 -") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 =") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 P") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D PRINT") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CONT") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOAD") PORT_CODE(KEYCODE_F5) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 +") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 * *") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 M") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C NEXT") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SAVE") PORT_CODE(KEYCODE_F6) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("IF/\xE2\x88\xA7") PORT_CODE(KEYCODE_PGUP) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TO/\xE2\x86\x93") PORT_CODE(KEYCODE_T) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("THEN/\xE2\x88\xA8") PORT_CODE(KEYCODE_PGDN) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GOTO") PORT_CODE(KEYCODE_G) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RET/\xE2\x89\x81") PORT_CODE(KEYCODE_R) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GOSUB") PORT_CODE(KEYCODE_O) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PC5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FOR/\xE2\x86\x91") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LIST") PORT_CODE(KEYCODE_L) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NEW") PORT_CODE(KEYCODE_N) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR/\xE2\x86\x92") PORT_CODE(KEYCODE_INSERT) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL/\xE2\x86\x90") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MONI") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_nmi, 0) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INTR") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_irq, 0) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, mpf1_state, trigger_res, 0) -INPUT_PORTS_END - -/* Intel 8255A Interface */ - -TIMER_CALLBACK_MEMBER(mpf1_state::led_refresh) -{ - if (BIT(m_lednum, 5)) output_set_digit_value(0, param); - if (BIT(m_lednum, 4)) output_set_digit_value(1, param); - if (BIT(m_lednum, 3)) output_set_digit_value(2, param); - if (BIT(m_lednum, 2)) output_set_digit_value(3, param); - if (BIT(m_lednum, 1)) output_set_digit_value(4, param); - if (BIT(m_lednum, 0)) output_set_digit_value(5, param); -} - -READ8_MEMBER( mpf1_state::ppi_pa_r ) -{ - UINT8 data = 0x7f; - - /* bit 0 to 5, keyboard rows 0 to 5 */ - if (!BIT(m_lednum, 0)) data &= m_pc0->read(); - if (!BIT(m_lednum, 1)) data &= m_pc1->read(); - if (!BIT(m_lednum, 2)) data &= m_pc2->read(); - if (!BIT(m_lednum, 3)) data &= m_pc3->read(); - if (!BIT(m_lednum, 4)) data &= m_pc4->read(); - if (!BIT(m_lednum, 5)) data &= m_pc5->read(); - - /* bit 6, user key */ - data &= m_special->read() & 1 ? 0xff : 0xbf; - - /* bit 7, tape input */ - data |= ((m_cassette)->input() > 0) ? 0x80 : 0; - - return data; -} - -WRITE8_MEMBER( mpf1_state::ppi_pb_w ) -{ - /* swap bits around for the mame 7-segment emulation */ - UINT8 led_data = BITSWAP8(data, 6, 1, 2, 0, 7, 5, 4, 3); - - /* timer to update segments */ - m_led_refresh_timer->adjust(attotime::from_usec(70), led_data); -} - -WRITE8_MEMBER( mpf1_state::ppi_pc_w ) -{ - /* bits 0-5, led select and keyboard latch */ - m_lednum = data & 0x3f; - m_led_refresh_timer->adjust(attotime::never); - - /* bit 6, monitor break control */ - m_break = BIT(data, 6); - - if (m_break) - { - m_m1 = 0; - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - } - - /* bit 7, tape output, tone and led */ - set_led_status(machine(), 0, !BIT(data, 7)); - m_speaker->level_w(BIT(data, 7)); - m_cassette->output( BIT(data, 7) ? 1.0 : -1.0); -} - -/* Z80 Daisy Chain */ - -static const z80_daisy_config mpf1_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80PIO_TAG }, - { NULL } -}; - -/* Machine Initialization */ - -TIMER_DEVICE_CALLBACK_MEMBER(mpf1_state::check_halt_callback) -{ - // halt-LED; the red one, is turned on when the processor is halted - // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix - INT64 led_halt = m_maincpu->state_int(Z80_HALT); - set_led_status(machine(), 1, led_halt); -} - -void mpf1_state::machine_start() -{ - m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mpf1_state::led_refresh),this)); - - /* register for state saving */ - save_item(NAME(m_break)); - save_item(NAME(m_m1)); - save_item(NAME(m_lednum)); -} - -void mpf1_state::machine_reset() -{ - m_lednum = 0; -} - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( mpf1, mpf1_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_3_579545MHz/2) - MCFG_CPU_PROGRAM_MAP(mpf1_map) - MCFG_CPU_IO_MAP(mpf1_io_map) - MCFG_CPU_CONFIG(mpf1_daisy_chain) - - /* devices */ - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_3_579545MHz/2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_3_579545MHz/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mpf1_state, ppi_pa_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mpf1_state, ppi_pb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mpf1_state, ppi_pc_w)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mpf1) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( mpf1b, mpf1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_3_579545MHz/2) - MCFG_CPU_PROGRAM_MAP(mpf1b_map) - MCFG_CPU_IO_MAP(mpf1b_io_map) - MCFG_CPU_CONFIG(mpf1_daisy_chain) - - /* devices */ - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_3_579545MHz/2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_3_579545MHz/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mpf1_state, ppi_pa_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mpf1_state, ppi_pb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mpf1_state, ppi_pc_w)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mpf1b) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_ADD(TMS5220_TAG, TMS5220, 680000L) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( mpf1p, mpf1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 2500000) - MCFG_CPU_PROGRAM_MAP(mpf1p_map) - MCFG_CPU_IO_MAP(mpf1p_io_map) - MCFG_CPU_CONFIG(mpf1_daisy_chain) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_mpf1p) - - /* devices */ - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, 2500000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 2500000) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mpf1_state, ppi_pa_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mpf1_state, ppi_pb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mpf1_state, ppi_pc_w)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( mpf1 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "mpf.u6", 0x0000, 0x1000, CRC(b60249ce) SHA1(78e0e8874d1497fabfdd6378266d041175e3797f) ) -ROM_END - -ROM_START( mpf1b ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "c55167.u6", 0x0000, 0x1000, CRC(28b06dac) SHA1(99cfbab739d71a914c39302d384d77bddc4b705b) ) - ROM_LOAD( "basic.u7", 0x2000, 0x1000, CRC(d276ed6b) SHA1(a45fb98961be5e5396988498c6ed589a35398dcf) ) - ROM_LOAD( "ssb-mpf.u", 0x5000, 0x1000, CRC(f926334f) SHA1(35847f8164eed4c0794a8b74e5d7fa972b10eb90) ) - ROM_LOAD( "prt-mpf.u5", 0x6000, 0x1000, CRC(730f2fb0) SHA1(f31536ee9dbb9babb9ce16a7490db654ca0b5749) ) -ROM_END - -ROM_START( mpf1p ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "mpf1pmon.bin", 0x0000, 0x2000, BAD_DUMP CRC(91ace7d3) SHA1(22e3c16a81ac09f37741ad1b526a4456b2ba9493) ) // A9 stuck low when dumped - ROM_LOAD( "prt-mpf-ip.u5", 0x6000, 0x1000, CRC(4dd2a4eb) SHA1(6a3e7daa7834d67fd572261ed4a9a62c4594fe3f) ) -ROM_END - -/* System Drivers */ - -DIRECT_UPDATE_MEMBER(mpf1_state::mpf1_direct_update_handler) -{ - if (!m_break) - { - m_m1++; - - if (m_m1 == 5) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - } - } - - return address; -} - -DRIVER_INIT_MEMBER(mpf1_state,mpf1) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mpf1_state::mpf1_direct_update_handler), this)); -} - -COMP( 1979, mpf1, 0, 0, mpf1, mpf1, mpf1_state, mpf1, "Multitech", "Micro Professor 1", 0) -COMP( 1979, mpf1b, mpf1, 0, mpf1b,mpf1b, mpf1_state, mpf1, "Multitech", "Micro Professor 1B", 0) -COMP( 1982, mpf1p, mpf1, 0, mpf1p,mpf1b, mpf1_state, mpf1, "Multitech", "Micro Professor 1 Plus", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/mps1230.c b/src/mess/drivers/mps1230.c deleted file mode 100644 index 9537036fd2a..00000000000 --- a/src/mess/drivers/mps1230.c +++ /dev/null @@ -1,154 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - mps1230.c - Commodore MPS-1230 dot-matrix printer - - Skeleton made September, 2015 by R. Belmont - -------------------------------------- - -Commodore MPS-1230 Dot Matrix Printer -Commodore 1988/89 - -This is a 9-pin dot matrix printer manufactured by Commodore (possibly under license from Olivetti) -The printer is based on the Olivetti DM100 9-pin dot matrix printer with an added Commodore -serial port and other Commodore modifications. The service manual shows the PCB as 'DM10XC2', -however the actual PCB does not exactly match that shown in the service manual. -The firmware is modified by Commodore to support the CBM ASCII character and command set. - -The printer comes standard with Centronics Parallel and Commodore Serial ports, sheet feed -and tractor feed and can be used with Commodore 64, 128/D, Amiga and IBM compatibles. - -The ink ribbons are compatible with, and used in the following printers.... -Commodore MPS 1230 printer -Olivetti DM 100, DM 90-1, DM 95, DM 99 & PR 98 printers -Birch BR-600 POS/cash register -Facit E 440 printer -Philips NMS 1016 & NMS 1432 printers -Senor Science K-700 & K-750 POS/cash register -Triumph Adler MPR 7120 printer - - -PCB Layout ----------- - -BA235 -OLIVETTI OPE MADE IN HONGKONG -750746Y00-A-B9 - - CENTRONICS SERIAL -|-|------------|--------|---|----------| -|J899 J369 9306 7407 J02G L387A| -| J169| -| D7810 6264 27512 | -|J708 MB624207 | -|-----| | - | 11.06MHz J532 | - | | - | 555 L293 L6210 2803 2803 | - |J404 74LS14 J477 2803 J821| - |--------------------------------| -Notes: (all IC's shown) - D7810 - NEC D7810HG ROM-less Microcontroller, clock input 11.06MHz (64 pin 'spider' package) - MB624207 - Fujitsu MB624207U MB62XXXX UHB Series 1.5um CMOS Gate Array marked 'OPE 200' (SDIP64) - 6264 - 8k x8 SRAM (DIP28) - 27512 - TMS27C512 64k x8 EPROM (DIP28) - S/W revisions dumped: - 'Release R - 1.1D 10/NOV/1988' with label 'PDL2' - 'Release R - 2.1E 09/AUG/1989' with label 'PEEK' - L387A - ST L387A 5V @ 0.5A Voltage Regulator - 2803 - ULN2803A 8-Channel Darlinton Driver (DIP18) - L6210 - ST L6210R Dual Schottky Diode Bridge (DIP16) - L293 - ST L293ER Quad Push-Pull Driver (DIP20) - 74LS14 - National DM74LS14N Hex Inverter with Schmitt Trigger (DIP14) - 555 - Texas Instruments NE555P Timer (DIP8) - 9306 - National NMC9306N 32bytes Serial EEPROM (DIP8) - 7407 - Texas Instruments ON7404N Hex Buffer with High Voltage Open-Collector Outputs (DIP14) - J169 - 3-pin 9v power input connector (from built-in transformer) - J821 - 6-pin connector for paper feed motor - J532 - 12-pin connector for print head - J477 - 2-pin print head transport motor connector - J404 - 4-pin connector for paper-out photosensor - J708 - 6-pin connector for transport motor encoder - J899 - 15-pin connector for ribbon cable for console buttons and leds (feed, online etc) - J369 - 36-pin centronics parallel connector - J02G - 6-pin Commodore serial bus connector - -************************************************************************/ - -#include "emu.h" - -#include "cpu/upd7810/upd7810.h" - -#define CPU_TAG "maincpu" - -class mps1230_state : public driver_device -{ -public: - mps1230_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CPU_TAG) - { } - - required_device m_maincpu; - - virtual void machine_start(); - virtual void machine_reset(); - -private: -}; - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -/*************************************************************************** - START/RESET -***************************************************************************/ - -void mps1230_state::machine_start() -{ -} - -void mps1230_state::machine_reset() -{ -} - -/*************************************************************************** - ADDRESS MAP -***************************************************************************/ - -static ADDRESS_MAP_START( mps1230_map, AS_PROGRAM, 8, mps1230_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("mps1230", 0) - AM_RANGE(0xc000, 0xdfff) AM_RAM // as per the service manual - AM_RANGE(0xff00, 0xffff) AM_RAM // tested at PC=77, then used for the 7810's stack -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( mps1230 ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( mps1230, mps1230_state ) - MCFG_CPU_ADD(CPU_TAG, UPD7810, 11060000) - MCFG_CPU_PROGRAM_MAP(mps1230_map) -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(mps1230) - ROM_REGION(0x10000, "mps1230", 0) - ROM_LOAD( "pdl2.f03ee", 0x000000, 0x010000, CRC(f8a9f45c) SHA1(4e7bb0d382c55432665f5576b6a5cd3c4c33bd8e) ) // ver 1.1D, 10/NOV/1988 - ROM_LOAD( "peek.f03ee", 0x000000, 0x010000, CRC(b5215f25) SHA1(dcfdd16942652447c472301392d9b39514547af1) ) // ver 2.1E, 09/AUG/1989 - -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1988, mps1230, 0, 0, mps1230, mps1230, driver_device, 0, "Commodore Business Machines", "MPS-1230 NLQ Printer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_TYPE_OTHER ) diff --git a/src/mess/drivers/mpz80.c b/src/mess/drivers/mpz80.c deleted file mode 100644 index b8a947a4903..00000000000 --- a/src/mess/drivers/mpz80.c +++ /dev/null @@ -1,807 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Morrow MPZ80 "Decision" - - Skeleton driver - -*/ - -/* - - TODO: - - - trap logic - - trap stop - - trap aux - - trap halt - - trap int - - trap void - - in/out trap - - read/write trap - - exec trap - - front panel LEDs - - keyboard - - I/O - - Mult I/O (8259A PIC, 3x 8250 ACE, uPD1990C RTC, 4K ROM/RAM) - - floppy - - DJ/DMA controller (Z80, 1K RAM, 2/4K ROM, TTL floppy control logic) for 5.25" floppy drives - - DJ2D/B controller for 8" floppy drives - - hard disk - - HDC/DMA controller (Seagate ST-506/Shugart SA1000) - - HDCA controller (Shugart SA4000/Fujitsu M2301B/Winchester M2320B) - - AM9512 FPU - - models - - Decision I Desk Top Model D1 (MPZ80, MM65KS, Wunderbus) - - Decision I Desk Top Model D2 (MPZ80, MM65KS, Wunderbus, DJDMA, 2x DSDD 5.25") - - Decision I Desk Top Model D2A (MPZ80, MM65KS, Wunderbus, DJDMA, 2x DSDD 5.25", HDCDMA, 5 or 16 MB hard disk?) - - Decision I Desk Top Model D3A (MPZ80, MM65KS, Wunderbus, DJDMA, 2x DSDD 5.25", HDCDMA, 5 or 16 MB hard disk?) - - Decision I Desk Top Model D3C (MPZ80, MM65KS, Wunderbus, DJDMA, 2x DSDD 5.25", HDCDMA, 5 or 16 MB hard disk?) - -*/ - -#include "includes/mpz80.h" - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -enum -{ - NO_ACCESS = 0, - READ_ONLY, - EXECUTE_ONLY, - FULL_ACCESS -}; - -#define TASK0 ((m_task & 0x0f) == 0) - -#define R10 0x04 - - -// mask register -#define MASK_STOP_ENBL 0x01 -#define MASK_AUX_ENBL 0x02 -#define MASK_TINT_ENBL 0x04 -#define MASK_RUN_ENBL 0x08 -#define MASK_HALT_ENBL 0x10 -#define MASK_SINT_ENBL 0x20 -#define MASK_IOENBL 0x40 -#define MASK_ZIO_MODE 0x80 - - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// check_traps - -//------------------------------------------------- - -inline void mpz80_state::check_traps() -{ - m_pretrap = !(m_trap_int & m_trap_halt & m_trap_stop & m_trap_aux); - - if (m_pretrap) - { - // latch trap condition - m_status = m_trap_void; - m_status |= m_trap_halt << 2; - m_status |= m_trap_int << 3; - m_status |= m_trap_stop << 4; - m_status |= m_trap_aux << 5; - - // latch trap address - m_pretrap_addr = ((m_addr >> 8) & 0xf0) | (m_pretrap_addr >> 4); - - // set M1 trap region start address - m_trap_start = m_addr; - } -} - - -//------------------------------------------------- -// check_interrupt - -//------------------------------------------------- - -inline void mpz80_state::check_interrupt() -{ - int tint_enbl = (m_mask & MASK_TINT_ENBL) ? 1 : 0; - int sint_enbl = (m_mask & MASK_SINT_ENBL) ? 0 : 1; - - m_int_pend = !(m_nmi & m_pint); - m_trap_int = !(m_int_pend & tint_enbl); - - int z80irq = CLEAR_LINE; - int z80nmi = CLEAR_LINE; - - if (TASK0) - { - if (!m_pint && !sint_enbl) z80irq = ASSERT_LINE; - if (!m_nmi && !sint_enbl) z80nmi = ASSERT_LINE; - } - else - { - if (!m_pint && !tint_enbl) z80irq = ASSERT_LINE; - if (!m_nmi && !tint_enbl) z80nmi = ASSERT_LINE; - } - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, z80irq); - m_maincpu->set_input_line(INPUT_LINE_NMI, z80nmi); - - check_traps(); -} - - - -//************************************************************************** -// MEMORY MANAGEMENT -//************************************************************************** - -//------------------------------------------------- -// get_address - -//------------------------------------------------- - -inline offs_t mpz80_state::get_address(offs_t offset) -{ - UINT16 map_addr = ((m_task & 0x0f) << 5) | ((offset & 0xf000) >> 11); - UINT8 map = m_map_ram[map_addr]; - //UINT8 attr = m_map_ram[map_addr + 1]; - - //logerror("task %02x map_addr %03x map %02x attr %02x address %06x\n", m_task, map_addr, map, attr, offset); - - // T7 T6 T5 T4 M7 M6 M5 M4 M3 M2 M1 M0 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 - return ((m_task & 0xf0) << 16) | (map << 12) | (offset & 0xfff); -} - - -//------------------------------------------------- -// mmu_r - -//------------------------------------------------- - -READ8_MEMBER( mpz80_state::mmu_r ) -{ - m_addr = get_address(offset); - UINT8 data = 0; - - if (m_pretrap) - { - m_pretrap = 0; - m_trap = 1; - - // latch trap address - m_pretrap_addr = ((m_addr >> 8) & 0xf0) | (m_pretrap_addr >> 4); - m_trap_addr = m_pretrap_addr; - } - - if (TASK0 && (offset < 0x1000)) - { - if (offset < 0x400) - { - data = m_ram->pointer()[offset & 0x3ff]; - } - else if (offset == 0x400) - { - data = trap_addr_r(space, 0); - } - else if (offset == 0x401) - { - data = keyboard_r(space, 0); - } - else if (offset == 0x402) - { - data = switch_r(space, 0); - } - else if (offset == 0x403) - { - data = status_r(space, 0); - } - else if (offset >= 0x600 && offset < 0x800) - { - // TODO this might change the map RAM contents - } - else if (offset < 0xc00) - { - UINT16 rom_addr = (m_trap_reset << 10) | (offset & 0x3ff); - data = m_rom->base()[rom_addr]; - } - else - { - logerror("Unmapped LOCAL read at %06x\n", offset); - } - } - else - { - data = m_s100->smemr_r(space, m_addr); - } - - return data; -} - - -//------------------------------------------------- -// mmu_w - -//------------------------------------------------- - -WRITE8_MEMBER( mpz80_state::mmu_w ) -{ - m_addr = get_address(offset); - - if (TASK0 && (offset < 0x1000)) - { - if (offset < 0x400) - { - m_ram->pointer()[offset & 0x3ff] = data; - } - else if (offset == 0x400) - { - disp_seg_w(space, 0, data); - } - else if (offset == 0x401) - { - disp_col_w(space, 0, data); - } - else if (offset == 0x402) - { - task_w(space, 0, data); - } - else if (offset == 0x403) - { - mask_w(space, 0, data); - } - else if (offset >= 0x600 && offset < 0x800) - { - m_map_ram[offset - 0x600] = data; - } - else - { - logerror("Unmapped LOCAL write at %06x\n", offset); - } - } - else - { - m_s100->mwrt_w(space, m_addr, data); - } -} - - -//------------------------------------------------- -// get_io_address - -//------------------------------------------------- - -inline offs_t mpz80_state::get_io_address(offs_t offset) -{ - if (m_mask & MASK_ZIO_MODE) - { - // echo port address onto upper address lines (8080 emulation) - offset = ((offset << 8) & 0xff00) | (offset & 0xff); - } - - return offset; -} - - -//------------------------------------------------- -// mmu_io_r - -//------------------------------------------------- - -READ8_MEMBER( mpz80_state::mmu_io_r ) -{ - return m_s100->sinp_r(space, get_io_address(offset)); -} - - -//------------------------------------------------- -// mmu_io_w - -//------------------------------------------------- - -WRITE8_MEMBER( mpz80_state::mmu_io_w ) -{ - m_s100->sout_w(space, get_io_address(offset), data); -} - - -//------------------------------------------------- -// trap_addr_r - trap address register -//------------------------------------------------- - -READ8_MEMBER( mpz80_state::trap_addr_r ) -{ - /* - - bit description - - 0 DADDR 12 - 1 DADDR 13 - 2 DADDR 14 - 3 DADDR 15 - 4 I-ADDR 12 - 5 I-ADDR 13 - 6 I-ADDR 14 - 7 I-ADDR 15 - - */ - - return m_trap_addr; -} - - -//------------------------------------------------- -// status_r - trap status register -//------------------------------------------------- - -READ8_MEMBER( mpz80_state::status_r ) -{ - /* - - bit description - - 0 _TRAP VOID - 1 _IORQ - 2 _TRAP HALT - 3 _TRAP INT - 4 _TRAP STOP - 5 _TRAP AUX - 6 R10 - 7 _RD STB - - */ - - return m_status; -} - - -//------------------------------------------------- -// task_w - task register -//------------------------------------------------- - -WRITE8_MEMBER( mpz80_state::task_w ) -{ - /* - - bit description - - 0 T0, A16 - 1 T1, A17 - 2 T2, A18 - 3 T3, A19 - 4 T4, S-100 A20 - 5 T5, S-100 A21 - 6 T6, S-100 A22 - 7 T7, S-100 A23 - - */ - - m_task = data; - - m_trap_reset = 1; - check_traps(); -} - - -//------------------------------------------------- -// mask_w - mask register -//------------------------------------------------- - -WRITE8_MEMBER( mpz80_state::mask_w ) -{ - /* - - bit description - - 0 _STOP ENBL - 1 AUX ENBL - 2 _TINT ENBL - 3 RUN ENBL - 4 _HALT ENBL - 5 SINT ENBL - 6 _IOENBL - 7 _ZIO MODE - - */ - - m_mask = data; -} - - - -//************************************************************************** -// FRONT PANEL -//************************************************************************** - -//------------------------------------------------- -// keyboard_r - front panel keyboard -//------------------------------------------------- - -READ8_MEMBER( mpz80_state::keyboard_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - return 0; -} - - -//------------------------------------------------- -// switch_r - switch register -//------------------------------------------------- - -READ8_MEMBER( mpz80_state::switch_r ) -{ - /* - - bit description - - 0 _TRAP RESET - 1 INT PEND - 2 16C S6 - 3 16C S5 - 4 16C S4 - 5 16C S3 - 6 16C S2 - 7 16C S1 - - */ - - UINT8 data = 0; - - // trap reset - data |= m_trap_reset; - - // interrupt pending - data |= m_int_pend << 1; - - // boot address - data |= m_16c->read() & 0xfc; - - return data; -} - - -//------------------------------------------------- -// disp_seg_w - front panel segment -//------------------------------------------------- - -WRITE8_MEMBER( mpz80_state::disp_seg_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ -} - - -//------------------------------------------------- -// disp_col_w - front panel column -//------------------------------------------------- - -WRITE8_MEMBER( mpz80_state::disp_col_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( mpz80_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( mpz80_mem, AS_PROGRAM, 8, mpz80_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(mmu_r, mmu_w) -/* - Task 0 Segment 0 map: - - AM_RANGE(0x0000, 0x03ff) AM_RAM - AM_RANGE(0x0400, 0x0400) AM_READWRITE(trap_addr_r, disp_seg_w) - AM_RANGE(0x0401, 0x0401) AM_READWRITE(keyboard_r, disp_col_w) - AM_RANGE(0x0402, 0x0402) AM_READWRITE(switch_r, task_w) - AM_RANGE(0x0403, 0x0403) AM_READWRITE(status_r, mask_w) - AM_RANGE(0x0600, 0x07ff) AM_RAM AM_SHARE("map_ram") - AM_RANGE(0x0800, 0x0bff) AM_ROM AM_REGION(Z80_TAG, 0) - AM_RANGE(0x0c00, 0x0c00) AM_DEVREADWRITE(AM9512_TAG, am9512_device, read, write) -*/ -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( mpz80_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( mpz80_io, AS_IO, 8, mpz80_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(mmu_io_r, mmu_io_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( mpz80 ) -//------------------------------------------------- - -static INPUT_PORTS_START( mpz80 ) - PORT_START("16C") - PORT_DIPNAME( 0xf8, 0xf8, "Power-On-Jump Address" ) PORT_DIPLOCATION("16C:1,2,3,4,5") PORT_CONDITION("12C", 0x02, EQUALS, 0x02) - PORT_DIPSETTING( 0xf8, "F800H" ) - PORT_DIPSETTING( 0xf0, "F000H" ) - PORT_DIPSETTING( 0xe8, "E800H" ) - PORT_DIPSETTING( 0xe0, "E000H" ) - PORT_DIPSETTING( 0xd8, "D800H" ) - PORT_DIPSETTING( 0xd0, "D000H" ) - PORT_DIPSETTING( 0xc8, "C800H" ) - PORT_DIPSETTING( 0xc0, "C000H" ) - PORT_DIPSETTING( 0xb8, "B800H" ) - PORT_DIPSETTING( 0xb0, "B000H" ) - PORT_DIPSETTING( 0xa8, "A800H" ) - PORT_DIPSETTING( 0xa0, "A000H" ) - PORT_DIPSETTING( 0x98, "9800H" ) - PORT_DIPSETTING( 0x90, "9000H" ) - PORT_DIPSETTING( 0x88, "8800H" ) - PORT_DIPSETTING( 0x80, "8000H" ) - PORT_DIPSETTING( 0x78, "7800H" ) - PORT_DIPSETTING( 0x70, "7000H" ) - PORT_DIPSETTING( 0x68, "6800H" ) - PORT_DIPSETTING( 0x60, "6000H" ) - PORT_DIPSETTING( 0x58, "5800H" ) - PORT_DIPSETTING( 0x50, "5000H" ) - PORT_DIPSETTING( 0x48, "4800H" ) - PORT_DIPSETTING( 0x40, "4000H" ) - PORT_DIPSETTING( 0x38, "3800H" ) - PORT_DIPSETTING( 0x30, "3000H" ) - PORT_DIPSETTING( 0x28, "2800H" ) - PORT_DIPSETTING( 0x20, "2000H" ) - PORT_DIPSETTING( 0x18, "1800H" ) - PORT_DIPSETTING( 0x10, "Boot DJ/DMA" ) - PORT_DIPSETTING( 0x08, "Boot HD/DMA" ) - PORT_DIPSETTING( 0x00, "Boot HDCA" ) - PORT_DIPNAME( 0x70, 0x00, "Diagnostics" ) PORT_DIPLOCATION("16C:2,3,4") PORT_CONDITION("12C", 0x02, EQUALS, 0x00) - PORT_DIPSETTING( 0x00, "Read Registers" ) - PORT_DIPSETTING( 0x10, "Write Registers" ) - PORT_DIPSETTING( 0x20, "Write Map RAMs" ) - PORT_DIPSETTING( 0x30, "Write R/W RAMs" ) - PORT_DIPSETTING( 0x40, "R/W FPP" ) - PORT_DIPSETTING( 0x50, "R/W S-100 Bus (High/Low)" ) - PORT_DIPSETTING( 0x60, "R/W S-100 Bus (Alternating)" ) - PORT_DIPSETTING( 0x70, "Read Switches" ) - PORT_DIPNAME( 0x04, 0x00, "Power Up" ) PORT_DIPLOCATION("16C:6") - PORT_DIPSETTING( 0x04, "Boot Address" ) - PORT_DIPSETTING( 0x00, "Monitor" ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("16C:7") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x01, 0x00, "S-100 MWRITE" ) PORT_DIPLOCATION("16C:8") - PORT_DIPSETTING( 0x01, "Disabled" ) - PORT_DIPSETTING( 0x00, "Enabled" ) - - PORT_START("12C") - PORT_DIPNAME( 0x02, 0x02, "Operation Mode" ) - PORT_DIPSETTING( 0x02, "Monitor" ) - PORT_DIPSETTING( 0x00, "Diagnostic" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// S100_INTERFACE( s100_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( mpz80_state::s100_pint_w ) -{ - m_pint = (state == ASSERT_LINE) ? 0 : 1; - - check_interrupt(); -} - -WRITE_LINE_MEMBER( mpz80_state::s100_nmi_w ) -{ - if (state == ASSERT_LINE) - { - m_nmi = 0; - } - - check_interrupt(); -} - -// slot devices -#include "bus/s100/dj2db.h" -#include "bus/s100/djdma.h" -#include "bus/s100/mm65k16s.h" -//#include "bus/s100/nsmdsa.h" -//#include "bus/s100/nsmdsad.h" -#include "bus/s100/wunderbus.h" - -static SLOT_INTERFACE_START( mpz80_s100_cards ) - SLOT_INTERFACE("mm65k16s", S100_MM65K16S) - SLOT_INTERFACE("wunderbus", S100_WUNDERBUS) - SLOT_INTERFACE("dj2db", S100_DJ2DB) - SLOT_INTERFACE("djdma", S100_DJDMA) -// SLOT_INTERFACE("multio", S100_MULTIO) -// SLOT_INTERFACE("hdcdma", S100_HDCDMA) -// SLOT_INTERFACE("hdca", S100_HDCA) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( mpz80 ) -//------------------------------------------------- - -void mpz80_state::machine_start() -{ - m_map_ram.allocate(0x200); -} - - -void mpz80_state::machine_reset() -{ - m_trap_reset = 0; - m_trap = 1; - m_trap_start = 0; - - m_nmi = 1; - - check_interrupt(); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( mpz80 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( mpz80, mpz80_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(mpz80_mem) - MCFG_CPU_IO_MAP(mpz80_io) - - // S-100 - MCFG_S100_BUS_ADD() - MCFG_S100_IRQ_CALLBACK(WRITELINE(mpz80_state, s100_pint_w)) - MCFG_S100_NMI_CALLBACK(WRITELINE(mpz80_state, s100_nmi_w)) - MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) - MCFG_S100_SLOT_ADD("s100_1", mpz80_s100_cards, "mm65k16s") - MCFG_S100_SLOT_ADD("s100_2", mpz80_s100_cards, "wunderbus") - MCFG_S100_SLOT_ADD("s100_3", mpz80_s100_cards, "dj2db") - MCFG_S100_SLOT_ADD("s100_4", mpz80_s100_cards, NULL)//"hdcdma") - MCFG_S100_SLOT_ADD("s100_5", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_6", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_7", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_8", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_9", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_10", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_11", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_12", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_13", mpz80_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_14", mpz80_s100_cards, NULL) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("65K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "mpz80") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( mpz80 ) -//------------------------------------------------- - -ROM_START( mpz80 ) - ROM_REGION( 0x1000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS("447") - ROM_SYSTEM_BIOS( 0, "373", "3.73" ) - ROMX_LOAD( "mpz80 mon3.73 fb34.17c", 0x0000, 0x1000, CRC(0bbffaec) SHA1(005ba726fc071f06cb1c969d170960438a3fc1a8), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "375", "3.75" ) - ROMX_LOAD( "mpz80 mon3.75 0706.17c", 0x0000, 0x1000, CRC(1118a592) SHA1(d70f94c09602cd0bdc4fbaeb14989e8cc1540960), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "447", "4.47" ) - ROMX_LOAD( "mon 4.47 f4f6.17c", 0x0000, 0x1000, CRC(b99c5d7f) SHA1(11181432ee524c7e5a68ead0671fc945256f5d1b), ROM_BIOS(3) ) - - ROM_REGION( 0x20, "s100rev2", 0 ) - ROM_LOAD( "z80-2 15a.15a", 0x00, 0x20, CRC(8a84249d) SHA1(dfbc49c5944f110f48419fd893fa84f4f0e113b8) ) // 82S123 or 6331 - - ROM_REGION( 0xeb, "s100rev3", 0 ) - ROM_LOAD( "z80-15a-a.15a", 0x00, 0xeb, CRC(713243cd) SHA1(802b318cc9795d87f03622e878d9a4d5d7dea7d4) ) // 82S153 - - ROM_REGION( 0x104, "mm1", 0 ) - ROM_LOAD( "z80-2 5c.5c", 0x000, 0x104, CRC(732be0cd) SHA1(545a37e5a871fcd1bb59b30056b837f03889b4d5) ) // PAL16R4 -ROM_END - - - -//************************************************************************** -// DRIVER INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// DRIVER_INIT( mpz80 ) -//------------------------------------------------- - -DIRECT_UPDATE_MEMBER(mpz80_state::mpz80_direct_update_handler) -{ - if (m_trap && address >= m_trap_start && address <= m_trap_start + 0xf) - { - direct.explicit_configure(m_trap_start, m_trap_start + 0xf, 0xf, m_rom->base() + ((m_trap_reset << 10) | 0x3f0)); - return ~0; - } - - return address; -} - -DRIVER_INIT_MEMBER(mpz80_state,mpz80) -{ - address_space &program = machine().device(Z80_TAG)->space(AS_PROGRAM); - program.set_direct_update_handler(direct_update_delegate(FUNC(mpz80_state::mpz80_direct_update_handler), this)); -} - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1980, mpz80, 0, 0, mpz80, mpz80, mpz80_state, mpz80, "Morrow Designs", "MPZ80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/ms0515.c b/src/mess/drivers/ms0515.c deleted file mode 100644 index 9f72a325764..00000000000 --- a/src/mess/drivers/ms0515.c +++ /dev/null @@ -1,258 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Elektronika MS-0515 - - 06/08/2012 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/t11/t11.h" -#include "machine/wd_fdc.h" -#include "machine/ram.h" -#include "machine/i8255.h" - -class ms0515_state : public driver_device -{ -public: - ms0515_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_floppy(*this, "vg93:0:525qd") - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_floppy; - - DECLARE_WRITE16_MEMBER(ms0515_bank_w); - DECLARE_WRITE8_MEMBER(ms0515_sys_w); - - virtual void machine_reset(); - - UINT8 *m_video_ram; - UINT8 m_sysreg; - int m_blink; - DECLARE_PALETTE_INIT(ms0515); - UINT32 screen_update_ms0515(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE8_MEMBER(ms0515_portc_w); -}; - -static ADDRESS_MAP_START(ms0515_mem, AS_PROGRAM, 16, ms0515_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0000000, 0017777) AM_RAMBANK("bank0") // RAM - AM_RANGE(0020000, 0037777) AM_RAMBANK("bank1") // RAM - AM_RANGE(0040000, 0057777) AM_RAMBANK("bank2") // RAM - AM_RANGE(0060000, 0077777) AM_RAMBANK("bank3") // RAM - AM_RANGE(0100000, 0117777) AM_RAMBANK("bank4") // RAM - AM_RANGE(0120000, 0137777) AM_RAMBANK("bank5") // RAM - AM_RANGE(0140000, 0157777) AM_RAMBANK("bank6") // RAM - - AM_RANGE(0160000, 0177377) AM_ROM - - AM_RANGE(0177400, 0177437) AM_WRITE(ms0515_bank_w) // Register for RAM expansion - - //AM_RANGE(0177440, 0177441) // read data - //AM_RANGE(0177460, 0177461) // write data Elektronika MS-7004 Keyboard - //AM_RANGE(0177442, 0177443) // read - //AM_RANGE(0177462, 0177463) // write - - //AM_RANGE(0177500, 0177501) - //AM_RANGE(0177502, 0177503) - //AM_RANGE(0177504, 0177505) // i8253 - //AM_RANGE(0177506, 0177507) - - //AM_RANGE(0177540, 0177541) - //AM_RANGE(0177542, 0177543) - //AM_RANGE(0177544, 0177545) // i8255 for MS-7007 Keyboard - //AM_RANGE(0177546, 0177547) - - AM_RANGE(0177600, 0177607) AM_DEVREADWRITE8("ppi8255_1", i8255_device, read, write, 0x00ff) - - AM_RANGE(0177640, 0177641) AM_DEVREADWRITE8("vg93", fd1793_t, status_r, cmd_w,0x00ff) - AM_RANGE(0177642, 0177643) AM_DEVREADWRITE8("vg93", fd1793_t, track_r, track_w,0x00ff) - AM_RANGE(0177644, 0177645) AM_DEVREADWRITE8("vg93", fd1793_t, sector_r, sector_w,0x00ff) - AM_RANGE(0177646, 0177647) AM_DEVREADWRITE8("vg93", fd1793_t, data_r, data_w,0x00ff) - - //AM_RANGE(0177700, 0177701) // read data - //AM_RANGE(0177720, 0177721) // write data // protocol S2 - //AM_RANGE(0177702, 0177703) // read status - //AM_RANGE(0177722, 0177723) // write control - - //AM_RANGE(0177770, 0177771) // read/write -ADDRESS_MAP_END - -WRITE16_MEMBER(ms0515_state::ms0515_bank_w) -{ - UINT8 *ram = m_ram->pointer(); - membank("bank0")->set_base(ram + 0000000 + BIT(data,0) * 0160000); - membank("bank1")->set_base(ram + 0020000 + BIT(data,1) * 0160000); - membank("bank2")->set_base(ram + 0040000 + BIT(data,2) * 0160000); - membank("bank3")->set_base(ram + 0060000 + BIT(data,3) * 0160000); - membank("bank4")->set_base(ram + 0100000 + BIT(data,4) * 0160000); - membank("bank5")->set_base(ram + 0120000 + BIT(data,5) * 0160000); - membank("bank6")->set_base(ram + 0140000 + BIT(data,6) * 0160000); - if (BIT(data,7)) { - switch((data >> 10) % 3) - { - case 0: // 000000 - 037777 - membank("bank0")->set_base(ram + 0000000 + 0340000); - membank("bank1")->set_base(ram + 0020000 + 0340000); - break; - case 1: // 040000 - 077777 - membank("bank2")->set_base(ram + 0000000 + 0340000); - membank("bank3")->set_base(ram + 0020000 + 0340000); - break; - case 2: - case 3: // 100000 - 137777 - membank("bank4")->set_base(ram + 0000000 + 0340000); - membank("bank5")->set_base(ram + 0020000 + 0340000); - break; - } - } -} - -WRITE8_MEMBER(ms0515_state::ms0515_sys_w) -{ - m_sysreg = data; -} - -void ms0515_state::machine_reset() -{ - UINT8 *ram = m_ram->pointer(); - ms0515_bank_w(machine().driver_data()->generic_space(),0,0); - - m_video_ram = ram + 0000000 + 0340000; - m_blink = 0; - - m_floppy->mon_w(0); // turn it on -} - -/* Input ports */ -static INPUT_PORTS_START( ms0515 ) -INPUT_PORTS_END - -// disk format: 80 tracks, 1 head, 10 sectors, 512 bytes sector length, first sector id 0 - -static SLOT_INTERFACE_START( ms0515_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // 720 KB -SLOT_INTERFACE_END - -UINT32 ms0515_state::screen_update_ms0515(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int y, x, b; - int addr = 0; - if (BIT(m_sysreg,3)) { - for (y = 0; y < 200; y++) - { - int horpos = 0; - for (x = 0; x < 40; x++) - { - UINT16 code = (m_video_ram[addr++] << 8); - code += m_video_ram[addr++]; - for (b = 0; b < 16; b++) - { - // In lower res mode we will just double pixels - bitmap.pix16(y, horpos++) = ((code >> (15-b)) & 0x01) ? 0 : 7; - } - } - } - } else { - for (y = 0; y < 200; y++) - { - int horpos = 0; - for (x = 0; x < 40; x++) - { - UINT8 code = m_video_ram[addr++]; - UINT8 attr = m_video_ram[addr++]; - UINT8 fg = (attr & 7) + BIT(attr,6)*8; - UINT8 bg = ((attr >> 3) & 7) + BIT(attr,6)*8; - if (BIT(attr,7) && (m_blink == 20)) { - UINT8 tmp = fg; - fg = bg; bg = tmp; - m_blink = -1; - } - for (b = 0; b < 8; b++) - { - // In lower res mode we will just double pixels - bitmap.pix16(y, horpos++) = ((code >> (7-b)) & 0x01) ? fg : bg; - bitmap.pix16(y, horpos++) = ((code >> (7-b)) & 0x01) ? fg : bg; - } - } - } - } - m_blink++; - return 0; -} - -PALETTE_INIT_MEMBER(ms0515_state, ms0515) -{ - palette.set_pen_color(0, rgb_t(0, 0, 0)); - palette.set_pen_color(1, rgb_t(0, 0, 127)); - palette.set_pen_color(2, rgb_t(127, 0, 0)); - palette.set_pen_color(3, rgb_t(127, 0, 127)); - palette.set_pen_color(4, rgb_t(0, 127, 0)); - palette.set_pen_color(5, rgb_t(0, 127, 127)); - palette.set_pen_color(6, rgb_t(127, 127, 0)); - palette.set_pen_color(7, rgb_t(127, 127, 127)); - - palette.set_pen_color(8, rgb_t(127, 127, 127)); - palette.set_pen_color(9, rgb_t(127, 127, 255)); - palette.set_pen_color(10, rgb_t(255, 127, 127)); - palette.set_pen_color(11, rgb_t(255, 127, 255)); - palette.set_pen_color(12, rgb_t(127, 255, 127)); - palette.set_pen_color(13, rgb_t(127, 255, 255)); - palette.set_pen_color(14, rgb_t(255, 255, 127)); - palette.set_pen_color(15, rgb_t(255, 255, 255)); -} - -WRITE8_MEMBER(ms0515_state::ms0515_portc_w) -{ - m_sysreg = data; -} - -static MACHINE_CONFIG_START( ms0515, ms0515_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) // Need proper CPU here - MCFG_T11_INITIAL_MODE(0xf2ff) - MCFG_CPU_PROGRAM_MAP(ms0515_mem) - - MCFG_DEVICE_ADD("vg93", FD1793, 1000000) - MCFG_FLOPPY_DRIVE_ADD("vg93:0", ms0515_floppies, "525qd", floppy_image_device::default_floppy_formats) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(ms0515_state, screen_update_ms0515) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(ms0515_state, ms0515) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_OUT_PORTC_CB(WRITE8(ms0515_state, ms0515_portc_w)) - - //MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ms0515 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "7004l.bin", 0xc000, 0x2000, CRC(b08b3b73) SHA1(c12fd4672598cdf499656dcbb4118d787769d589)) - ROM_LOAD16_BYTE( "7004h.bin", 0xc001, 0x2000, CRC(515dcf99) SHA1(edd34300fd642c89ce321321e1b12493cd16b7a5)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( ????, ms0515, 0, 0, ms0515, ms0515, driver_device, 0, "Elektronika", "MS-0515", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/ms9540.c b/src/mess/drivers/ms9540.c deleted file mode 100644 index 16f48730c50..00000000000 --- a/src/mess/drivers/ms9540.c +++ /dev/null @@ -1,106 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Millennium Systems 9520 and 9540 Software Development systems. - -2013-08-30 Skeleton driver - -The only roms known to be dumped are the main roms of the 9540, and the disk -controller roms of the 9520. - -There's no known documents for the 9540, so everything in here is a guess. - -The 9520 is Z80-based, but is currently not emulated. -The 9540 is 68000-based. - -Chips: -- Main board: MC68000L8, 2x SCN2661C, uPD8253C. Crystals: 5.0688, 16MHz - ROMS: 0950-0131-01, 0950-0132-01, 0954-0133-01, 0954-0134-01, - 0954-0135-01, 0954-0135-02 -- Disk board: FD1797A-02, AM9517A, 0954-0039-01 -- Serial board: 6x SCN2661C, 2x AM9517A, 0954-0029-01. Crystal: 5.0688MHz - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class ms9540_state : public driver_device -{ -public: - ms9540_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_base(*this, "rambase"), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - -private: - UINT8 m_term_data; - virtual void machine_reset(); - required_shared_ptr m_p_base; - required_device m_maincpu; - required_device m_terminal; -}; - - -static ADDRESS_MAP_START(ms9540_mem, AS_PROGRAM, 16, ms9540_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xffffff) - AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_SHARE("rambase") - AM_RANGE(0x010000, 0x013fff) AM_ROM AM_REGION("9540", 0) - AM_RANGE(0x018000, 0x018fff) AM_RAM -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( ms9540 ) -INPUT_PORTS_END - - -void ms9540_state::machine_reset() -{ - UINT8* ROM = memregion("9540")->base(); - memcpy(m_p_base, ROM, 8); - m_maincpu->reset(); -} - -WRITE8_MEMBER( ms9540_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( ms9540, ms9540_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 8000000) // unknown clock - MCFG_CPU_PROGRAM_MAP(ms9540_mem) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ms9540_state, kbd_put)) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ms9540 ) - ROM_REGION16_BE(0x4000, "9540", 0) - ROM_LOAD16_BYTE("0954-0135-01.20n", 0x00000, 0x2000, CRC(93ee9363) SHA1(73bc09e0379e06e0da96279cb5cc1581a0f0bf77) ) - ROM_LOAD16_BYTE("0954-0135-02.16n", 0x00001, 0x2000, CRC(a21077c5) SHA1(51dcbe543317d2042fb1acb1885461ba1790721e) ) - - ROM_REGION(0x1800, "9520", 0) - ROM_LOAD( "z80-hd.bin", 0x0000, 0x1000, CRC(b1c37286) SHA1(36b38fec9ef46e3e594423bbd1c64c5e9a4bc74d) ) - ROM_LOAD( "z80-flp.bin", 0x1000, 0x0800, CRC(f256b8c3) SHA1(780b444e999c3149eb0f137733703682d65746b4) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, ms9540, 0, 0, ms9540, ms9540, driver_device, 0, "Millennium Systems", "ms9540", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/msbc1.c b/src/mess/drivers/msbc1.c deleted file mode 100644 index 08178eaec02..00000000000 --- a/src/mess/drivers/msbc1.c +++ /dev/null @@ -1,113 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Curt Coder -/* - -Omnibyte MSBC-1 - -PCB Layout ----------- - -REV B - -|-----------------------------------------------------------| -| CN1 CN2 CN3 CN4 SW1 CN5 | -| | -| 3.6864MHz 3.6864MHz ROM1 | -| ROM0 | -| SIO SIO SW3 SW2 | -| PIT | -| 12.5MHz 41256 41256 41256 | -| 41256 41256 41256 | -| 8MHz CPU 41245 41256 | -| | -| 8419 | -| SW4 | -|-|-------------CN6----------------|----|-------CN7-------|-| - |--------------------------------| |-----------------| - -Notes: - Relevant IC's shown. - - CPU - Motorola MC68000R12 - SIO - Mostek MK68564N-5A Serial Input/Output - PIT - Motorola MC68230L10 Parallel Interface/Timer - 8419 - National Semiconductor DP8419N DRAM Controller - 41256 - Fujitsu MB81256-12 256Kx1 RAM - ROM0 - AMD AM27128ADC 16Kx8 ROM "47-2818-36G1" - ROM1 - AMD AM27128ADC 16Kx8 ROM "47-2818-36G2" - SW1 - push button - SW2 - rotary hex DIP - SW3 - rotary hex DIP - SW4 - DIP8 - CN1 - - CN2 - - CN3 - - CN4 - - CN5 - - CN6 - - CN7 - - -*/ - - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/terminal.h" -#include "includes/msbc1.h" - -#define TERMINAL_TAG "terminal" - -static ADDRESS_MAP_START( msbc1_mem, AS_PROGRAM, 16, msbc1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x03ffff) AM_RAM - AM_RANGE(0xf80000, 0xf87fff) AM_ROM AM_REGION(MC68000R12_TAG, 0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( msbc1 ) -INPUT_PORTS_END - -void msbc1_state::machine_reset() -{ - void *ram = m_maincpu->space(AS_PROGRAM).get_write_ptr(0); - UINT8 *rom = memregion(MC68000R12_TAG)->base(); - - memcpy(ram, rom, 8); - - m_maincpu->reset(); -} - -static MACHINE_CONFIG_START( msbc1, msbc1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MC68000R12_TAG, M68000, XTAL_12_5MHz) - MCFG_CPU_PROGRAM_MAP(msbc1_mem) - - // devices - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( msbc1 ) - ROM_REGION16_BE( 0x8000, MC68000R12_TAG, 0 ) - ROM_LOAD16_BYTE( "47-2818-36g1.u18", 0x0000, 0x4000, CRC(14f25d47) SHA1(964bc49c1dd9e9680c0d3d89ff3794c5044bea62) ) - ROM_LOAD16_BYTE( "47-2818-36g2.u19", 0x0001, 0x4000, CRC(4814b9e1) SHA1(d96cf75084c6588cb33513830c6beeeffc2de853) ) - - ROM_REGION( 0x100, "plds", 0 ) - ROM_LOAD( "p21.1.u22", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p22.0.u37", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p23.0.u38", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p24.0.u43", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p25.0.u44", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p26.0.u45", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p27.0.u46", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p28.1.u49", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p29.0.u58", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p30.0.u60", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p31.0.u61", 0x000, 0x100, NO_DUMP ) - ROM_LOAD( "p32.0.u76", 0x000, 0x100, NO_DUMP ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, msbc1, 0, 0, msbc1, msbc1, driver_device, 0, "Omnibyte", "MSBC-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mstation.c b/src/mess/drivers/mstation.c deleted file mode 100644 index d49478f0b56..00000000000 --- a/src/mess/drivers/mstation.c +++ /dev/null @@ -1,560 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - CIDCO MailStation - - 22/10/2011 Preliminary driver by Sandro Ronco - - Hardware: - - Z80 CPU - - 29f080 8 Mbit flash - - 28SF040 4 Mbit flash (for user data) - - 128kb RAM - - 320x128 LCD - - RCV336ACFW 33.6kbps modem - - TODO: - - RCV336ACFW modem - - Add similar models (Mivo 100/150/200/250/350) - - New Mail led - - NVRAM - - More info: - http://www.fybertech.net/mailstation/info.php - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/intelfsh.h" -#include "machine/rp5c01.h" -#include "machine/ram.h" -#include "rendlay.h" - -class mstation_state : public driver_device -{ -public: - mstation_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - - intelfsh8_device *m_flashes[2]; - UINT8 m_bank1[2]; - UINT8 m_bank2[2]; - UINT8 *m_ram_base; - int m_flash_at_0x4000; - int m_flash_at_0x8000; - UINT8 *m_vram; - UINT8 m_screen_column; - UINT8 m_port2; - UINT8 m_irq; - UINT16 m_kb_matrix; - - DECLARE_READ8_MEMBER( flash_0x0000_read_handler ); - DECLARE_WRITE8_MEMBER( flash_0x0000_write_handler ); - DECLARE_READ8_MEMBER( flash_0x4000_read_handler ); - DECLARE_WRITE8_MEMBER( flash_0x4000_write_handler ); - DECLARE_READ8_MEMBER( flash_0x8000_read_handler ); - DECLARE_WRITE8_MEMBER( flash_0x8000_write_handler ); - DECLARE_READ8_MEMBER( modem_r ); - DECLARE_WRITE8_MEMBER( modem_w ); - - void lcd_w(UINT16 offset, int column, UINT8 data); - UINT8 lcd_r(UINT16 offset, int column); - DECLARE_READ8_MEMBER( lcd_right_r ); - DECLARE_WRITE8_MEMBER( lcd_right_w ); - DECLARE_READ8_MEMBER( lcd_left_r ); - DECLARE_WRITE8_MEMBER( lcd_left_w ); - - void refresh_memory(UINT8 bank, UINT8 chip_select); - DECLARE_READ8_MEMBER( bank1_r ); - DECLARE_WRITE8_MEMBER( bank1_w ); - DECLARE_READ8_MEMBER( bank2_r ); - DECLARE_WRITE8_MEMBER( bank2_w ); - - DECLARE_READ8_MEMBER( battery_status_r ); - DECLARE_WRITE8_MEMBER( port2_w ); - DECLARE_READ8_MEMBER( kb_r ); - DECLARE_WRITE8_MEMBER( kb_w ); - DECLARE_READ8_MEMBER( irq_r ); - DECLARE_WRITE8_MEMBER( irq_w ); - void refresh_ints(); - - DECLARE_WRITE_LINE_MEMBER( rtc_irq ); - - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_PALETTE_INIT(mstation); - TIMER_DEVICE_CALLBACK_MEMBER(mstation_1hz_timer); - TIMER_DEVICE_CALLBACK_MEMBER(mstation_kb_timer); -}; - -READ8_MEMBER( mstation_state::flash_0x0000_read_handler ) -{ - return m_flashes[0]->read(offset); -} - -WRITE8_MEMBER( mstation_state::flash_0x0000_write_handler ) -{ - m_flashes[0]->write(offset, data); -} - -READ8_MEMBER( mstation_state::flash_0x4000_read_handler ) -{ - return m_flashes[m_flash_at_0x4000]->read(((m_bank1[0] & 0x3f)<<14) | offset); -} - -WRITE8_MEMBER( mstation_state::flash_0x4000_write_handler ) -{ - m_flashes[m_flash_at_0x4000]->write(((m_bank1[0] & 0x3f)<<14) | offset, data); -} - -READ8_MEMBER( mstation_state::flash_0x8000_read_handler ) -{ - return m_flashes[m_flash_at_0x8000]->read(((m_bank2[0] & 0x3f)<<14) | offset); -} - -WRITE8_MEMBER( mstation_state::flash_0x8000_write_handler ) -{ - m_flashes[m_flash_at_0x8000]->write(((m_bank2[0] & 0x3f)<<14) | offset, data); -} - -READ8_MEMBER( mstation_state::modem_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( mstation_state::modem_w ) -{ -} - - -//*************************************************************************** -// video hardware emulation -//***************************************************************************/ - -void mstation_state::lcd_w(UINT16 offset, int column, UINT8 data) -{ - if (m_port2 & 0x08) - m_vram[(column * 240) + (offset % 240)] = data; - else - m_screen_column = data % 20; -} - -UINT8 mstation_state::lcd_r(UINT16 offset, int column) -{ - if (m_port2 & 0x08) - return m_vram[(column * 240) + (offset % 240)]; - else - return m_screen_column % 20; -} - -READ8_MEMBER ( mstation_state::lcd_left_r ) { return lcd_r(offset, m_screen_column); } -WRITE8_MEMBER( mstation_state::lcd_left_w ) { lcd_w(offset, m_screen_column, data); } -READ8_MEMBER ( mstation_state::lcd_right_r ) { return lcd_r(offset, m_screen_column + 20); } -WRITE8_MEMBER( mstation_state::lcd_right_w ) { lcd_w(offset, m_screen_column + 20, data); } - -UINT32 mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int x=0; x<40; x++) - for (int y=0; y<128; y++) - { - UINT8 data = m_vram[56 + y + x * 240]; - - for (int b=0; b<8; b++) - { - // columns are inverted (right to left) - int col = ((x < 20) ? 19 : 59) - x; - - bitmap.pix16(y, col*8 + b)= BIT(data, 0); - data >>= 1; - } - } - return 0; -} - -//*************************************************************************** -// Bankswitch -//***************************************************************************/ - -void mstation_state::refresh_memory(UINT8 bank, UINT8 chip_select) -{ - address_space& program = m_maincpu->space(AS_PROGRAM); - int &active_flash = (bank == 1 ? m_flash_at_0x4000 : m_flash_at_0x8000); - char bank_tag[6]; - - switch (chip_select) - { - case 0: // flash 0 - case 3: // flash 1 - if (active_flash < 0) - { - if (bank == 1) - program.install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x4000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x4000_write_handler), this)); - else - program.install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x8000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x8000_write_handler), this)); - } - - active_flash = chip_select ? 1 : 0; - break; - case 1: // banked RAM - sprintf(bank_tag,"bank%d", bank); - membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1[0] : m_bank2[0]) & 0x07)<<14)); - program.install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag); - active_flash = -1; - break; - case 2: // left LCD panel - program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_left_r), this), write8_delegate(FUNC(mstation_state::lcd_left_w), this)); - active_flash = -1; - break; - case 4: // right LCD panel - program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_right_r), this), write8_delegate(FUNC(mstation_state::lcd_right_w), this)); - active_flash = -1; - break; - case 5: // modem - program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0x07, 0, read8_delegate(FUNC(mstation_state::modem_r), this), write8_delegate(FUNC(mstation_state::modem_w), this)); - active_flash = -1; - break; - - default: - logerror("Unknown chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff); - program.unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff); - active_flash = -1; - break; - } -} - -READ8_MEMBER( mstation_state::bank1_r ) -{ - return m_bank1[offset]; -} - -READ8_MEMBER( mstation_state::bank2_r ) -{ - return m_bank2[offset]; -} - -WRITE8_MEMBER( mstation_state::bank1_w ) -{ - m_bank1[offset] = data; - - refresh_memory(1, m_bank1[1] & 0x07); -} - -WRITE8_MEMBER( mstation_state::bank2_w ) -{ - m_bank2[offset] = data; - - refresh_memory(2, m_bank2[1] & 0x07); -} - - - -WRITE8_MEMBER( mstation_state::port2_w ) -{ - m_port2 = data; - - m_kb_matrix = (m_kb_matrix & 0xff) | ((data & 0x03)<<8); -} - -/* - IRQ bits (port 3) ordered by priority: - - bit 7: power down request - bit 5: real time clock - bit 6: modem - bit 4: 1 sec int - bit 3: unknown - bit 0: unknown - bit 1: keyboard int - bit 2: unknown -*/ - -void mstation_state::refresh_ints() -{ - if (m_irq != 0) - m_maincpu->set_input_line(0, HOLD_LINE); - else - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -READ8_MEMBER( mstation_state::irq_r ) -{ - return m_irq; -} - -WRITE8_MEMBER( mstation_state::irq_w ) -{ - m_irq &= data; - - refresh_ints(); -} - -READ8_MEMBER( mstation_state::battery_status_r ) -{ - /* - bit 0-3 - unknown - bit 4-7 - battery status - */ - return 0xf0; -} - -WRITE8_MEMBER( mstation_state::kb_w ) -{ - m_kb_matrix = (m_kb_matrix & 0x300) | data; -} - -READ8_MEMBER( mstation_state::kb_r ) -{ - static const char *const bitnames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", - "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; - UINT8 data = 0xff; - - for (int i=0; i<10; i++) - { - if (!(m_kb_matrix & (1<read(); - } - - return data; -} - - -static ADDRESS_MAP_START(mstation_mem, AS_PROGRAM, 8, mstation_state) - AM_RANGE(0x0000, 0x3fff) AM_READWRITE(flash_0x0000_read_handler, flash_0x0000_write_handler) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank1") // bank 1 - AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank2") // bank 2 - AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("sysram") // system ram always first RAM bank -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mstation_io , AS_IO, 8, mstation_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x01, 0x01 ) AM_READWRITE(kb_r, kb_w) - AM_RANGE( 0x02, 0x02 ) AM_WRITE(port2_w) - AM_RANGE( 0x03, 0x03 ) AM_READWRITE(irq_r, irq_w) - AM_RANGE( 0x05, 0x06 ) AM_READWRITE(bank1_r, bank1_w) - AM_RANGE( 0x07, 0x08 ) AM_READWRITE(bank2_r, bank2_w) - AM_RANGE( 0x09, 0x09 ) AM_READ(battery_status_r) - AM_RANGE( 0x10, 0x1f ) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) - //AM_RANGE( 0x2c, 0x2c ) printer -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( mstation ) - PORT_START( "LINE0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Main Menu") PORT_CODE( KEYCODE_HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Back") PORT_CODE( KEYCODE_DEL ) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Print") PORT_CODE( KEYCODE_F6 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE( KEYCODE_F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE( KEYCODE_F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE( KEYCODE_F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE( KEYCODE_F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE( KEYCODE_F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START( "LINE1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_END ) PORT_CHAR('@') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A-A Size") PORT_CODE( KEYCODE_F7 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Check Spelling") PORT_CODE( KEYCODE_F8 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Get E-Mail") PORT_CODE( KEYCODE_F9 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PG Up") PORT_CODE( KEYCODE_PGUP ) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - - PORT_START( "LINE2" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xb4") PORT_CODE( KEYCODE_0_PAD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3 ) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4 ) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5 ) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHAR('7') PORT_CHAR('&') - - PORT_START( "LINE3" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS ) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_EQUALS ) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE( KEYCODE_BACKSPACE ) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH ) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PG Down") PORT_CODE( KEYCODE_PGDN ) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - - PORT_START( "LINE4" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE( KEYCODE_TAB ) PORT_CHAR(9) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_E ) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_R ) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_T ) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_U ) PORT_CHAR('u') PORT_CHAR('U') - - PORT_START( "LINE5" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_I ) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_O ) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_P ) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_OPENBRACE ) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CLOSEBRACE ) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COLON ) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE( KEYCODE_ENTER ) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) - - PORT_START( "LINE6" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CapsLock") PORT_CODE( KEYCODE_CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_S ) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_D ) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F ) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_G ) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_H ) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_J ) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START( "LINE7" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_K ) PORT_CHAR('K') PORT_CHAR('K') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_L ) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_STOP ) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH ) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Up") PORT_CODE( KEYCODE_UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE( KEYCODE_DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE( KEYCODE_RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START( "LINE8" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE( KEYCODE_LSHIFT ) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_X ) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_C ) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_V ) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_B ) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_N ) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START( "LINE9" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Function") PORT_CODE( KEYCODE_LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE( KEYCODE_SPACE ) PORT_CHAR(' ') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE( KEYCODE_LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) -INPUT_PORTS_END - -void mstation_state::machine_start() -{ - m_flashes[0] = machine().device("flash0"); - m_flashes[1] = machine().device("flash1"); - - // allocate the videoram - m_vram = (UINT8*)machine().memory().region_alloc( "vram", 9600, 1, ENDIANNESS_LITTLE )->base(); - m_ram_base = (UINT8*)m_ram->pointer(); - - // map firsh RAM bank at 0xc000-0xffff - membank("sysram")->set_base(m_ram_base); -} - - -void mstation_state::machine_reset() -{ - m_flash_at_0x4000 = 0; - m_flash_at_0x8000 = 0; - m_bank1[0] = m_bank1[1] = 0; - m_bank2[0] = m_bank2[1] = 0; - memset(m_vram, 0, 9600); - - // reset banks - refresh_memory(1, m_bank1[1]); - refresh_memory(2, m_bank2[1]); -} - -WRITE_LINE_MEMBER( mstation_state::rtc_irq ) -{ - if (state) - m_irq |= (1<<5); - else - m_irq &=~(1<<5); - - refresh_ints(); -} - -TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_1hz_timer) -{ - m_irq |= (1<<4); - - refresh_ints(); -} - -TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_kb_timer) -{ - m_irq |= (1<<1); - - refresh_ints(); -} - -PALETTE_INIT_MEMBER(mstation_state, mstation) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - - -static MACHINE_CONFIG_START( mstation, mstation_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) //unknown clock - MCFG_CPU_PROGRAM_MAP(mstation_mem) - MCFG_CPU_IO_MAP(mstation_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(mstation_state, screen_update) - MCFG_SCREEN_SIZE(320, 128) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 128-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(mstation_state, mstation) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_AMD_29F080_ADD("flash0") - MCFG_SST_28SF040_ADD("flash1") - - // IRQ 4 is generated every second, used for auto power off - MCFG_TIMER_DRIVER_ADD_PERIODIC("1hz_timer", mstation_state, mstation_1hz_timer, attotime::from_hz(1)) - - // IRQ 1 is used for scan the kb and for cursor blinking - MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer", mstation_state, mstation_kb_timer, attotime::from_hz(50)) - - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) - MCFG_RP5C01_OUT_ALARM_CB(WRITELINE(mstation_state, rtc_irq)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mstation ) - ROM_REGION( 0x100000, "flash0", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v303a", "v3.03a" ) - ROMX_LOAD( "ms303a.bin", 0x000000, 0x100000, CRC(7a5cf752) SHA1(15629ccaecd8094dd883987bed94c16eee6de7c2), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v253", "v2.53" ) - ROMX_LOAD( "ms253.bin", 0x000000, 0x0fc000, BAD_DUMP CRC(a27e7f8b) SHA1(ae5a0aa0f1e23f3b183c5c0bcf4d4c1ae54b1798), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1999, mstation, 0, 0, mstation, mstation, driver_device, 0, "CIDCO", "MailStation", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/msx.c b/src/mess/drivers/msx.c deleted file mode 100644 index 3dfd67a935a..00000000000 --- a/src/mess/drivers/msx.c +++ /dev/null @@ -1,8494 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/* -** msx.c : driver for MSX -** -** cpc300: -** To get out of the MSX Tutor press the SELECT key. Entering SET SYSTEM 1 should -** disable the MSX Tutor on next boot and SET SYSTEM 0 should enable. -** -** tpp311: -** This machine is supposed to boot into logo; it was made to only run logo. -** -** tps312: -** - To get into MSX-WRITE type: CALL WRITE -** - To get into MSX-PLAN type: CALL MSXPLAN -** -** -** There really were a lot of different MSX systems released by quite a few -** manufacturers. Until we have identified all the unique characteristics of -** each machine the machines will stay listed separately. After that -** de-duplication of machine descriptions and rom sets may happen. -** -** -** Todo/known issues: -** - piopx7/piopx7uk/piopxv60: Pioneer System Remote (home entertainment/Laserdisc control) not implemented -** - piopx7: Dump is from a PAL (EU/AU) machine, we have no known good dumps from JP or US NTSC machines -** - spc800: Haven't been able to test operation of the han rom yet -** - svi728: Expansion slot not emulated -** - svi738: v9938 not emulated -** - svi738: rs232c not emulated -** - hx10: Expansion slot not emulated (hx10s also??) -** - y503iir: Keyboard not responding correctly -** - y503iir, y503iir2: RTC not emulated -** - y503iir, y503iir2: Net not emulated -** - y503iir, y503iir2: Floppy support broken -** - cpc300: Config for MSX Tutor ON/OFF is not saved -** - fs4600: Kanji12 not emulated; how to trigger usage of kanji12?? -** - fsa1fm: Firmware not emulated -** - fsa1fm: kanji12 not emulated -** - fsa1fm: Modem not emulated -** - nms8280, nms8280g: Digitizer functionality not emulated -** - vg8230j: Floppy support broken? -** - hbf1: Does not boot. This seems to be caused by a race condition between setting the VBlank bit in the -** VDP status register and the z80 taking the interrupt. Currently the interrupt gets taken before the -** bit can be read, so the code goes into an infinite loop. -** - hbf12: Does not boot; see hbf1. -** - tpc310: Floppy support broken -** 7fbb <- c7 => seek 199??? -** - hx23f: The builtin word processor displays white squares instead of text -** - expert3i: IDE not emulated -** - expert3t: Turbo not emulated -** - expertac: Does not boot -** - fsa1gt: Add Turbo-R support -** - fsa1st: Add Turbo-R support -** - canonv20e/f/g/s: Investigate different keyboard layouts -** - canonv30: Mapper RAM size unknown -** - mx101: External antenna not emulated -** - pv7: Add support for KB-7 (8KB ram + 2 cartslots) -** - cpc50a/cpc50b: Remove keyboard; and add an external keyboard?? -** - cpc51/cpc61: Remove keyboard and add a keyboard connector -** - cpc50a/cpc50b/cpc51: Boot to a black screen, is this correct? -** - mbh2: speed controller not implemented -** - mbh70: Verify firmware operation -** - kmc5000: Floppy supprt broken -** - mlg3: rs232c not emulated -** - perfect1: Firmware broken -** - mpc2500f: Fix keyboard layout? -** - nms8260: HDD not emulated -** - mpc27: Light pen not emulated -** - phc77: firmware not emulated -** - phc77: printer not emulated -** - hx21, hx22: Hook up kanji rom -** - hx21, hx22: Does not start firmware -** - victhc90/95/95a: Turbo/2nd cpu not supported. -** - victhc90/95/95a: Firmware not working. -** - y503iiir/e: Fix keyboard support -** - y503iiir/e: Floppy support broken -** - y805*: Floppy support broken -** - y8805128r2/e: Firmware not working -** - cpg120: Remove ports -** - cpg120: Add V9958 -** -** TODO: -** - Add T6950 support. T6950 is selectable between pal and ntsc by a pin. -** -** Possibly missing machines: -** - Sanyo MPC-1 (T6950) -** - Toshibo HX-51i (T7937) -** - Sony HB-101 (TMS9118) -************************************************************************ - -This following list is probably incomplete. Corrections are welcome. -Entries marked with * still need to be processed. - -Al Alamiah AX-150 - MSX1 - ax150 -Al Alamiah AX-170 - MSX1 - ax170 -Al Alamiah AX-350II - MSX2 - ax350 -Al Alamiah AX-370 - MSX2 - ax370 -*Ascii MSXPLAYer 2003 -*Ascii One Chip MSX -Canon V-8 - MSX1 - canonv8 -Canon V-10 - MSX1 - canonv10 -Canon V-20 - MSX1 - canonv20 -Canon V-20E - MSX1 - canonv20e -Canon V-20F - MSX1 - canonv20f -Canon V-20G - MSX1 - canonv20g -Canon V-20S - MSX1 - canonv20s -Canon V-25 - MSX2 - canonv25 -Canon V-30 - MSX2 - canonv30 -Canon V-30F - MSX2 - canonv30f -Casio MX-10 - MSX1 - mx10 -Casio MX-15 - MSX1 - mx15 -Casio MX-101 - MSX1 - mx101 -Casio PV-7 - MSX1 - pv7 -*Casio PV-7 + KB-7 -Casio PV-16 - MSX1 - pv16 -Ciel Expert 3 IDE - MSX2+ - expert3i -Ciel Expert 3 Turbo = MSX2+ - expert3t -====================================== -This one is a full motherboard by CIEL (not an upgrade kit), created to replace the motherboard of a Gradiente Expert (which means that only the case, the analog boards and the keyboard remains Gradiente). This new motherboard has the following built-in features: - -1) MSX2+ -2) Support either 3.57MHz or 7.14MHz natively, switched either by software (*1) or by a hardware-switch on the front panel. Turbo-led included. -3) Up to 4MB of Memory Mapper (1MB is the most common configuration) -4) MSX-Music -5) 4 expansion slots (two external on the front panel, two internal) -6) Stereo sound (YM2413 channels 0-6 on right, PSG+YM2413 channels 7-9 on left) -7) Support the V9938 instead of the V9958 by switching some jumpers -8) The main-ram can be placed on slot 2 or slot 3, using jumpers (slot 2 is the default) - - -*1: A routine hidden inside the BIOS frame-0 is used to switch the turbo. - -Daewoo CPC-88 - MSX1 - cpc88 -Daewoo CPC-300 - MSX2 - cpc300 -Daewoo CPC-300E - MSX2 - cpc300e -Daewoo CPC-330K - MSX2 - cpc330k -Daewoo CPC-400 - MSX2 - cpc400 -Daewoo CPC-400S - MSX2 cpc400s -Daewoo DPC-100 - MSX1 - dpc100 -Daewoo DPC-180 - MSX1 - dpc180 -Daewoo DPC-200 - MSX1 - dpc200 -Daewoo DPC-200E - MSX1 - dpc200e -Daewoo Zemmix CPC-50A - MSX1 - cpc50a -Daewoo Zemmix CPC-50B - MSX1 - cpc50b -Daewoo Zemmix CPC-51 - MSX1 - cpc51 -Daewoo Zemmix CPC-61 - MSX2 - cpc61 -Daewoo Zemmix CPG-120 Normal (no clock chip, no printer port) - MSX2 - cpg120 -*Daewoo Zemmix CPG-120 Turbo - MSX2 - cpg120t -Fenner DPC-200 - MSX1 - fdpc200 -Fenner FPC-500 - MSX1 - fpc500 -Fenner FPC-900 - MSX2 - fpc900 -Fenner SPC-800 - MSX1 - fspc800 -Frael Bruc 100-1 - MSX1 - bruc100 -Fujitsu FM-X - MSX1 - fmx -Goldstar FC-80U - MSX1 - gsfc80u -Goldstar FC-200 - MSX1 - gsfc200 -Goldstar GFC-1080 - MSX1 - gfc1080 -Goldstar GFC-1080A - MSX1 - gfc1080a -Gradiente Expert 1.0 - MSX1 - expert10 -Gradiente Expert 1.1 - MSX1 - expert11 -Gradiente Expert 1.3 - MSX1 - expert13 -Gradiente Expert 2.0 - MSX2 - expert20 -Gradiente Expert AC88+ - MSX2+ - expertac -Gradiente Expert DDPlus - MSX1 - expertdp -Gradiente Expert DDX+ - MSX2+ - expertdx -Gradiente Expert Plus - MSX1 - expertpl -*Haesung Virtual Console -*Hitachi MB-H1 -*Hitachi MB-H1E -Hitachi MB-H2 - MSX1 - mbh2 -*Hitachi MB-H3 - MSX2 (64KB VRAM) -*Hitachi MB-H21 - MSX1 -Hitachi MB-H25 - MSX1 - mbh25 -Hitachi MB-H50 - MSX1 - mbh50 -Hitachi MB-H70 - MSX2 - mbh70 -*Hitachi MB-H80 - MSX1 -JVC HC-7GB - MSX1 -jvchc7gb -Kawai KMC-5000 - MSX2 - kmc5000 -Mitsubishi ML-F48 - MSX1 - mlf48 -Mitsubishi ML-F80 - MSX1 - mlf80 -Mitsubishi ML-F110 - MSX1 - mlf110 -Mitsubishi ML-F120 - MSX1 - mlf120 -Mitsubishi ML-FX1 - MSX1 - mlfx1 -Mitsubishi ML-G1 - MSX2 - mlg1 -Mitsubishi ML-G3 - MSX2 - mlg3 -Mitsubishi ML-G10 - MSX2 - mlg10 -Mitsubishi ML-G30 Model 1 - MSX2 - mlg30 -Mitsubishi ML-G30 Model 2 - MSX2 - See Mitsubishi ML-G30 Model 1 -National CF-1200 - MSX1 - cf1200 -National CF-2000 - MSX1 - cf2000 -National CF-2700 - MSX1 - cf2700 -National CF-3000 - MSX1 - cf3000 -National CF-3300 - MSX1 - cf3300 -National FS-1300 - MSX1 - fs1300 -National FS-4000 - MSX1 - fs4000 -Matioanl FS-4000 (alt) - MSX1 - fs4000a -National FS-4500 - MSX2 - fs4500 -National FS-4600 - MSX2 - fs4600 -National FS-4700 - MSX2 - fs4700 -National FS-5000F2 - MSX2 - fs5000 -National FS-5500F1 - MSX2 - fs5500 -National FS-5500F2 - MSX2 - fs5500 -Olympia PHC-2 - MSX1 - phc2 -Olympia PHC-28 - MSX1 - phc28 -Panasonic CF-2700G - MSX1 - cf2700g -Panasonic FS-A1 - MSX2 - fsa1 / fsa1a -Panasonic FS-A1 MK2 - MSX2 - fsa1mk2 -Panasonic FS-A1F - MSX2 - fsa1f -Panasonic FS-A1FM - MSX2 - fsa1fm -Panasonic FS-A1FX - MSX2+ - fsa1fx -Panasonic FS-A1GT - MSX Turbo-R - fsa1gt -Panasonic FS-A1ST - MSX Turbo-R - fsa1st -Panasonic FS-A1WSX - MSX2+ - fsa1wsx -Panasonic FS-A1WX - MSX2+ - fsa1wx / fsa1wxa -Perfect Perfect1 - MSX1 - perfect1 -*Perfect Perfect2 - MSX2 -Philips NMS-801 - MSX1 - nms801 -Philips NMS-8220 - MSX2 - nms8220 / nms8220a -Philips NMS-8245 - MSX2 - nms8245 -Philips NMS-8245F - MSX2 - nms8245f -Philips NMS-8250 - MSX2 - nms8250 -Philips NMS-8250F - MSX2 - nms8250f -Philips NMS-8250J - MSX2 - nms8250j -Philips NMS-8255 - MSX2 - nms8255 -Philips NMS-8255F - MSX2 - nms8255f -Philips NMS-8260 - MSX2 - nms8260 -Philips NMS-8270 - MSX2 - nms8270 - not confirmed to exist yet -Philips NMS-8280 - MSX2 - nms8280 -Philips NMS-8280F - MSX2 - nms8280f -Philips NMS-8280G - MSX2 - nms8280g -*Philips PTC MSX PC -Philips VG-8000 - MSX1 - vg8000 -Philips VG-8010 - MSX1 - vg8010 -Philips VG-8010F - MSX1 - vg8010f -Philips VG-8020-00 - MSX1 - vg802000 -Philips VG-8020-20 - MSX1 - vg802020 -*Philips VG-8020-40 - MSX1 - -Philips VG-8020F - MSX1 - vg8020f -Philips VG-8230 - MSX2 - vg8230 -Philips VG-8230J - MSX2 - vg8230j -Philips VG-8235 - MSX2 - vg8235 -Philips VG-8235F - MSX2 - vg8235f -Philips VG-8240 - MSX2 - vg8240 -=============================== - -PCB Layout missing - - -Pioneer PX-7 - MSX1 - piopx7 -============================ - -|---------------------------------------| -| CN1 CN2 | -| | -| | -| IC33 |---------------------------------| -| CN3 | -| IC32 IC34 IC38 IC40 | -| IC20 | -| IC15 IC18 IC43 IC8 IC35 IC6 |----IC3---| | -| |----------| IC21 | -| IC16 IC19 |---IC13---| IC7 IC10 | -| |----------| IC36 IC29 --- | -| IC17 IC14 X2 | | | -| |--IC12---| |----IC1-----| IC37 |I| | -| IC28 IC11 |---------| |------------| X1 |C| | -| |2| | -| |----IC4----| |----IC5----| IC39 IC9 IC42 IC44 | | | -| |-----------| |-----------| --- | -| | -| IC45 IC31 IC30 IC41 | -| | -| CN4 CN5 CN6 CN7 CN8 | -|-------------------------------------------------------------------------| - -Notes: - X1 - 3.579MHz - X2 - 500kHz - IC1 - Sharp LH0080A Z80A-CPU-D - IC2 - TMS91289NL - IC3 - MB111S112 Z10 (500kHz) - IC4 - M5L8255AP-5 - IC5 - YM2149F - IC6,IC7,IC8,IC10,IC45 - SN74LS367AN - IC9 - SN74LS245N - IC11,IC34 - SN74LS139N - IC12 - YM2301-23908 / 53 18 85 A (might indicate a version) - IC13 - Pioneer PD5031 2364-213 514100 (M5L2764-213) - IC14,IC17,IC30,IC31 - SN74LS157N - IC15-IC19 - MB81416-12 - IC20,IC21 - TMS4416-I5NL - IC28 - SN74LS153N - IC29 - SN74LS02N - IC32 - SN74LS374N - IC33 - M5218P - IC35 - SN74LS74AN - IC36 - SN74LS30N - IC37-IC39 - SN74LS04N - IC40,IC41 - SN74LS05N - IC42 - SN74LS08N - IC43,IC44 - SN74LS32N - CN1 - Printer - CN2 - Cassette recorder - CN3 - Expansion slot - CN4 - Keyboard - CN5 - Keyboard - CN6 - Controller #1 - CN7 - Controller #2 - CN8 - Expansion slot - - -Pioneer PX-7UK - MSX1 - piopx7uk -Pioneer PX-V60 - MSX1 - piopxv60 -Samsung SPC-800 MSX1 - spc800 -Sanyo MPC-64 - MSX1 - mpc64 -Sanyo MPC-100 - MSX1 - mpc100 -Sanyo MPC-200 - MSX1 - mpc200 -Sanyo MPC-200SP - MSX1 - mpc200sp -Sanyo MPC-2300 - MSX2 - mpc2300 -Sanyo MPC-2500FD - MSX2 - mpc2500f -Sanyo PHC-28L - MSX1 - phc28l -Sanyo PHC-28S - MSX1 - phc28s -Sanyo Wavy MPC-10 - MSX1 - mpc10 -Sanyo Wavy MPC-25FD - MSX2 - mpc25fd -Sanyo Wavy MPC-27 - MSX2 - mpc27 -Sanyo Wavy PHC-23 - MSX2 - phc23 -Sanyo Wavy PHC-35J - MSX2+ - phc35j -Sanyo Wavy PHC-55FD2 - MSX2 - phc55fd2 -Sanyo Wavy PHC-70FD1 - MSX2+ - phc70fd -Sanyo Wavy PHC-70FD2 - MSX2+ - phc70fd2 -Sanyo Wavy PHC-77 - MSX2 - phc77 -Sharp Epcom HotBit 1.1 - MSX1 - hotbit11 -Sharp Epcom HotBit 1.2 - MSX1 - hotbit12 -Sharp Epcom HotBit 1.3b - MSX1 - hotbi13b -Sharp Epcom HotBit 1.3p - MSX1 - hotbi13p -Sharp Epcom HotBit 2.0 - MSX2 - hotbit20 -Sony HB-10 - MSX1 - hb10 -*Sony HB-10D - MSX1 -Sony HB-10P - MSX1 - hb10p -Sony HB-20P - MSX1 - hb20p -Sony HB-55 Version 1 - MSX1 - hb55 -Sony HB-55D - MSX1 - hb55d -Sony HB-55P - MSX1 - hb55p -Sony HB-75D - MSX1 - hb75d -Sony HB-75P - MSX1 - hb75p -*Sony HB-101 - MSX1 -Sony HB-101P - MSX1 - hb101p -Sony HB-201 - MSX1 - hp201 -Sony HB-201P - MSX1 - hb201p -Sony HB-501P - MSX1 - hb501p -Sony HB-701FD - MSX1 - hb701fd -Sony HB-F1 - MSX2 - hbf1 -Sony HB-F1II - MSX2 - hbf12 -Sony HB-F1XD - MSX2 - hbf1xd -Sony HB-F1XD MK2 - MSX2 - hbf1xdm2 -Sony HB-F1XDJ - MSX2+ - hbf1xdj -Sony HB-F1XV - MSX2+ - hbf1xv -Sony HB-F5 - MSX2 - hbf5 -Sony HB-F500 - MSX2 - hbf500 -Sony HB-F500F - MSX2 - hbf500f -Sony HB-F500P - MSX2 - hbf500p -Sony HB-F700D - MSX2 - hbf700d -Sony HB-F700F - MSX2 - hbf700f -Sony HB-F700P - MSX2 - hbf700p -Sony HB-F700S - MSX2 - hbf700s -*Sony HB-F750+ -Sony HB-F900 - MSX2 - hbf900 / hbf900a -Sony HB-F9P - MSX2 - hbf9p -Sony HB-F9P Russian - MSX2 - hbf9pr -Sony HB-F9S - MSX2 - hbf9s -Sony HB-F9S+ - MSX2+ - hbf9sp -Sony HB-G900AP - MSX2 - hbg900ap -Sony HB-G900P - MSX2 - hbg900p -*Sony HB-T7 -Spectravideo SVI-728 - MSX1 - svi728 -Spectravideo SVI-738 - MSX1 - svi738 -Spectravideo SVI-738 Arabic - MSX1 - svi738ar -Spectravideo SVI-738 Danish - MSX1 - svi738dk -Spectravideo SVI-738 Polish - MSX1 - svi738pl -Spectravideo SVI-738 Spanish - MSX1 - svi738sp -Spectravideo SVI-738 Swedish - MSX1 - svi738sw -Talent DPC-200 - MSX1 - tadpc200 -Talent DPC-200A - MSX1 - tadpc20a -Talent TPC-310 - MSX2 - tpc310 -Talent TPP-311 - MSX2 - tpp311 -Talent TPS-312 - MSX2 - tps312 -============================== - -PCB Layouts missing - - -Toshiba HX-10 - MSX1 - hx10 -=========================== - -Code on PCB: MSX TUK - |---------------------------|-------------------|-------------| - | CN1 CN2 CN3 CN4 CN5 | - | |---------------------------| | - | |---------------------------| | - | CN6 | - | IC40 | - | CN7 | - | IC38 IC32 IC33 IC37 | - | | - | Q2 IC31 IC34 IC35 | - | Q1 CN8 | - | IC39 | - | |--IC15------| |--IC2----| |----IC1-----| | - | |------------| |---------| |------------| | - | IC30 | - | IC3 IC4 CN9 | - | |-----IC15-------| | - | IC17 IC18 IC7 IC8 |----------------| | - | IC27 | - | IC19 IC20 IC9 IC10 |----IC25------| | -|----| | |--------------| IC26 | -| Q | | IC21 IC22 IC11 IC12 | -| | | | -| S | | IC23 IC24 IC13 IC14 IC29 IC28 | -| L | | | -| | | CN11 CN10 | -|----| |-------------------------------------------------------------| - -Notes: - Mainboard components: - IC1 - Sharp LH0080A Z80A-CPU-D - IC2 - MB83256 - IC3,IC4,IC27,IC28 - Texas Instruments SN74LS157N - IC7-IC14 - HM4864AP - IC15 - Toshiba TCX-1007 (64pin custom chip) - IC16 - 40pin chip covered with some kind of heatsink(?), probably TMS9929A - IC17-IC24 - 4116-3 - IC25 - AY-3-8910A - IC26 - SN74LS09N - IC29 - HD74LS145P - IC30-IC34 - M74LS367AP - IC35 - MB74LS74A - IC37 - HD74LS373P - IC38 - Toshiba TC74HCU04P - IC39 - HD74LS08P - IC40 - TA75559P - Q1 - 10687.5 - Q2 - 3579545 - CN1 - Cassette connecter - CN2 - RF connector - CN3 - Audio connector - CN4 - Video connector - CN5 - Expansion connector - CN6 - Cartridge connector - CN7 - Printer connector - CN8 - Joystick 2 connector - CN9 - Joystick 1 connector - CN10 - Keyboard connector 1 - CN11 - Keyboard connector 2 - - Extra pcb (video related?) components:: - Q - 4.433619 - S - 74LS04 - L - LVA510 - - -Toshiba HX-10D - MSX1 - hx10d -Toshiba HX-10DP - MSX1 - hx10dp -Toshiba HX-10E - MSX1 - hx10e -Toshiba HX-10F - MSX1 - hx10f -Toshiba HX-10S - MSX1 - hx10s -Toshiba HX-10SA - MSX1 - hx10sa -Toshiba HX-20 - MSX1 - hx20 -Toshiba HX-20I - MSX1 - hx20i -Toshiba HX-21 - MXS1 - -hx21 -Toshiba HX-21I - MSX1 - hx21i -Toshiba HX-22 - MSX1 - hx22 -Toshiba HX-22I - MSX1 - hx22i -Toshiba HX-23 - MSX2 - hx23 -Toshiba HX-23F - MSX2 - hx23f -Toshiba HX-23I - HSX2 - hx23i -Toshiba HX-33 - MSX2 - hx33 -Toshiba HX-34 - MSX2 - hx34 -Toshiba HX-34I - MSX2 - hx34i -Toshiba FS-TM1 - MSX2 - fstm1 -Victor HC-5 - MSX1 - hc5 -Victor HC-6 - MSX1 - hc6 -*Victor HC-6AV - MSX1 -Victor HC-7 - MSX1 - hc7 -*Victor HC-7E - MSX1 -*Victor HC-7GB - MSX1 -*Victor HC-9S - MSX2 -*Victor HC-80 - MSX2 -Victor HC-90 - MSX2 - victhc90 -Victor HC-95 - MSX2 - victhc95 -Victor HC-95A - MSX2 - victhc95a -*Victor HC-95T - MSX2 -*Victor HC-95V - MSX2 -Yamaha CX5F-1 - MSX1 - cx5f1 -Yamaha CX5F-2 - MSX1 - cx5f -Yamaha CX5M - MSX1 - cx5m -Yamaha CX5MII-128 - MSX1 - cx5m128 -Yamaha CX5MII - MSX1 - cx5m2 -Yamaha CX7M - MSX2 - cx7m -Yamaha CX7M/128 - MSX2 - cx7m128 -Yamaha YIS-303 - MSX1 - yis303 -Yamaha YIS-503 - MSX1 - yis503 -Yamaha YIS-503F - MSX1 - yis503f -Yamaha YIS-503II - MSX1 - yis503ii -Yamaha YIS-503IIR (Russian) - MSX1 - y503iir -Yamaha YIS-503IIR (Estonian) - MSX1 - y503iir2 -Yamaha YIS-503M - MSX1 - yis503m -Yamaha YIS-503IIIR - MSX2 - y503iiir -Yamaha YIS-503IIIR Estonion - MSX2 - y503iiire -Ymaha YIS604 - MSX2 - yis60464 -Yamaha YIS604-128 - MSX2 - yis604 -Yamaha YIS805-128 - MSX2 - y805128 -Yamaha YIS805-128R2 - MSX2 - y805128r2 -Yamaha YIS805-128R2 Estonian - MSX2 - y805128r2e -Yamaha YIS805-256 - MSX2 - y805256 -*Yamaha YIS805-256 2+ - MSX2+ - was this a real machine? -Yashica YC-64 - MSX1 - yc64 -Yeno DPC-64 (same bios as Olympia PHC-2) -Yeno MX64 - MSX1 - mx64 -============= - -PCB Layouts missing - - -*/ - - -#include "includes/msx.h" -#include "formats/dsk_dsk.h" -#include "formats/dmk_dsk.h" -#include "machine/msx_matsushita.h" -#include "machine/msx_s1985.h" -#include "machine/msx_systemflags.h" - - -static ADDRESS_MAP_START ( msx_memory_map, AS_PROGRAM, 8, msx_state ) - AM_RANGE(0x0000, 0xfffe) AM_READWRITE(msx_mem_read, msx_mem_write) - AM_RANGE(0xffff, 0xffff) AM_READWRITE(msx_sec_slot_r, msx_sec_slot_w) -ADDRESS_MAP_END - - -WRITE8_MEMBER(msx_state::msx_ay8910_w) -{ - if ( offset & 1 ) - m_ay8910->data_w( space, offset, data ); - else - m_ay8910->address_w( space, offset, data ); -} - - -static ADDRESS_MAP_START ( msx_io_map, AS_IO, 8, msx_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // 0x7c - 0x7d : MSX-MUSIC/FM-PAC write port. Handlers will be installed if MSX-MUSIC is present in a system - AM_RANGE( 0x90, 0x90) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE( 0x90, 0x90) AM_DEVWRITE("cent_ctrl_out", output_latch_device, write) - AM_RANGE( 0x91, 0x91) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE( 0xa0, 0xa7) AM_DEVREAD("ay8910", ay8910_device, data_r) AM_WRITE(msx_ay8910_w) - AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) - AM_RANGE( 0x98, 0x98) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) - AM_RANGE( 0x99, 0x99) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) - AM_RANGE( 0xd8, 0xd9) AM_READWRITE(msx_kanji_r, msx_kanji_w) - // 0xfc - 0xff : Memory mapper I/O ports. I/O handlers will be installed if a memory mapper is present in a system -ADDRESS_MAP_END - - -static ADDRESS_MAP_START ( msx2_io_map, AS_IO, 8, msx_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x40, 0x4f) AM_READWRITE(msx_switched_r, msx_switched_w) - // 0x7c - 0x7d : MSX-MUSIC/FM-PAC write port. Handlers will be installed if MSX-MUSIC is present in a system - AM_RANGE( 0x90, 0x90) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE( 0x90, 0x90) AM_DEVWRITE("cent_ctrl_out", output_latch_device, write) - AM_RANGE( 0x91, 0x91) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE( 0xa0, 0xa7) AM_DEVREAD("ay8910", ay8910_device, data_r) AM_WRITE(msx_ay8910_w) - AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) - AM_RANGE( 0x98, 0x9b) AM_DEVREADWRITE("v9938", v9938_device, read, write) - AM_RANGE( 0xb4, 0xb4) AM_WRITE(msx_rtc_latch_w) - AM_RANGE( 0xb5, 0xb5) AM_READWRITE(msx_rtc_reg_r, msx_rtc_reg_w) - AM_RANGE( 0xd8, 0xd9) AM_READWRITE(msx_kanji_r, msx_kanji_w) - // 0xfc - 0xff : Memory mapper I/O ports. I/O handlers will be installed if a memory mapper is present in a system -ADDRESS_MAP_END - - -static ADDRESS_MAP_START ( msx2p_io_map, AS_IO, 8, msx_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x40, 0x4f) AM_READWRITE(msx_switched_r, msx_switched_w) - // 0x7c - 0x7d : MSX-MUSIC/FM-PAC write port. Handlers will be installed if MSX-MUSIC is present in a system - AM_RANGE( 0x90, 0x90) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE( 0x90, 0x90) AM_DEVWRITE("cent_ctrl_out", output_latch_device, write) - AM_RANGE( 0x91, 0x91) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE( 0xa0, 0xa7) AM_DEVREAD("ay8910", ay8910_device, data_r) AM_WRITE(msx_ay8910_w) - AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) - AM_RANGE( 0x98, 0x9b) AM_DEVREADWRITE("v9958", v9958_device, read, write) - AM_RANGE( 0xb4, 0xb4) AM_WRITE(msx_rtc_latch_w) - AM_RANGE( 0xb5, 0xb5) AM_READWRITE(msx_rtc_reg_r, msx_rtc_reg_w) - AM_RANGE( 0xd8, 0xd9) AM_READWRITE(msx_kanji_r, msx_kanji_w) - // 0xfc - 0xff : Memory mapper I/O ports. I/O handlers will be installed if a memory mapper is present in a system -ADDRESS_MAP_END - - -DEVICE_ADDRESS_MAP_START( switched_device_map, 8, msx_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - - -static INPUT_PORTS_START( msx_dips ) - PORT_START("JOY0") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON1) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_BUTTON2) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_DIPNAME( 0x80, 0, "Game port 1") - PORT_DIPSETTING( 0x00, DEF_STR( Joystick )) - PORT_DIPSETTING( 0x80, "Mouse") - - PORT_START("JOY1") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_DIPNAME( 0x80, 0, "Game port 2") - PORT_DIPSETTING( 0x00, DEF_STR( Joystick )) - PORT_DIPSETTING( 0x80, "Mouse") - - PORT_START("DSW") - PORT_DIPNAME( 0x40, 0, "Swap game port 1 and 2") - PORT_DIPSETTING( 0, DEF_STR( No ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) - - PORT_START("MOUSE0") - PORT_BIT( 0xff00, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - PORT_BIT( 0x00ff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START("MOUSE1") - PORT_BIT( 0xff00, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2) - PORT_BIT( 0x00ff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2) -INPUT_PORTS_END - - -/* 2008-05 FP: About keyboards - -Even if some later Philips (and maybe others) models started to use a layout similar to current -PC keyboards, common MSX keyboards have a couple of keys which do not fit usual mapping -- the key in the 1st row before 'Backspace', 3rd key from '0', here re-mapped to KEYCODE_BACKSLASH2 -- the last key in the 4th row, 4th key from 'M' (not counting Shift), here re-mapped to KEYCODE_TILDE - -These keys corresponds to the following symbols - - input_port | msx | msxuk | msxjp | msxkr |hotbit |expert | - ------------------------------------------------------------- - BACKSLASH2 | \ | | \ | | ? | | won | | \ ^ | { } | - ------------------------------------------------------------- - TILDE | DK* | DK* | _ | _ | < > | / ? | - -* DK = "Dead Key" -Notice that 'expert' input_ports covers both versions 1.0 and 1.1. -msx2 input_ports have the same symbols as their msx counterparts. - -TO DO: -- check Expert 1.0 layout with the real thing -- check Korean layout -- fix natural support in systems using msx inputs but with different mapping -(these systems could have different uses for keys mapped at the following -locations: COLON, QUOTE, BACKSLASH, OPENBRACE, CLOSEBRACE, BACKSLASH2, TILDE. -The corresponding symbols would not work properly in -natural mode). - -Additional note about natural keyboard support: currently, -- "Keypad ," is not mapped -- "Graph" is mapped to 'F6' (this key could be labeled "L Graph") -- "Code" is mapped to 'F7' (this key could be labeled "R Graph", "Kana" or "Hangul") -- "Stop" is mapped to 'F8' -- "Select" is mapped to 'F9' -*/ - -#define KEYB_ROW0 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - -#define KEYB_EXPERT11_ROW0 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - -#define KEYB_HOTBIT_ROW0 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('"') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - -#define KEYB_ROW1 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') \ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - -#define KEYB_HOTBIT_ROW1 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('^') \ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\'') PORT_CHAR('`') \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('"') PORT_CHAR('`') \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('\xC7') PORT_CHAR('\xE7') - -#define KEYB_EXPERT11_ROW1 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('\'') \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('{') PORT_CHAR('}') \ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\'') PORT_CHAR('`') \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR(']') \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') PORT_CHAR('^') - -#define KEYB_ROW2 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('`') PORT_CHAR('~') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dead Key") PORT_CODE(KEYCODE_TILDE) \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - -#define KEYB_HOTBIT_ROW2 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') PORT_CHAR('^') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR(']') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('<') PORT_CHAR('>') \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - -#define KEYB_EXPERT10_ROW2 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xC7') PORT_CHAR('\xE7') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dead Key") PORT_CODE(KEYCODE_TILDE) \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - -#define KEYB_EXPERT11_ROW2 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('@') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('\xC7') PORT_CHAR('\xE7') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('/') PORT_CHAR('?') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(';') PORT_CHAR(':') \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - -#define KEYB_ROW3 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') \ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - -#define KEYB_ROW4 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - -#define KEYB_ROW5 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') \ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - -#define KEYB_ROW6 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CODE") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - -#define KEYB_EXPERT11_ROW6 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L GRA") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R GRA") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - -#define KEYB_ROW7 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4 F9") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F10") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(F8)) \ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SELECT") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F9)) \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - -#define KEYB_ROW8 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))\ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - -#define KEYB_ROW9 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) \ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - -#define KEYB_ROW10 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_ENTER_PAD) \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - -static INPUT_PORTS_START( msx ) - PORT_START("KEY0") - KEYB_ROW0 - KEYB_ROW1 - - PORT_START("KEY1") - KEYB_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - KEYB_ROW6 - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY5") - PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - -#ifdef UNREFERENCED_CODE -static INPUT_PORTS_START( msxuk ) - PORT_START("KEY0") - KEYB_ROW0 - KEYB_ROW1 - - PORT_START("KEY1") - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xA3') PORT_CHAR('~') - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dead Key") PORT_CODE(KEYCODE_TILDE) - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - KEYB_ROW6 - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY5") - PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END -#endif - -#define KEYB_JAP_ROW0 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - -#define KEYB_JAP_ROW1 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA5') PORT_CHAR('|')\ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - -#define KEYB_KOR_ROW1 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') \ - PORT_BIT (0x1000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x82\xA9 |") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0xffe6) PORT_CHAR('|') \ - PORT_BIT (0x2000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') \ - PORT_BIT (0x4000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') \ - PORT_BIT (0x8000, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - -#define KEYB_JAP_ROW2 \ - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') \ - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') \ - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') \ - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') \ - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') \ - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') \ - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') \ - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - -static INPUT_PORTS_START( msxjp ) - PORT_START("KEY0") - KEYB_JAP_ROW0 - KEYB_JAP_ROW1 - - PORT_START("KEY1") - KEYB_JAP_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY5") - PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - -static INPUT_PORTS_START( msxkr ) - PORT_START("KEY0") - KEYB_JAP_ROW0 - KEYB_KOR_ROW1 - - PORT_START("KEY1") - KEYB_JAP_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Hangul") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY5") - PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - -static INPUT_PORTS_START( hotbit ) - PORT_START("KEY0") - KEYB_HOTBIT_ROW0 - KEYB_HOTBIT_ROW1 - - PORT_START("KEY1") - KEYB_HOTBIT_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - KEYB_ROW6 - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY5") - PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - -/* 2008-05 FP: I guess these belong to the keypad */ -#define KEYB_EXPERT11_ROW9 \ - PORT_BIT (0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) \ - PORT_BIT (0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) \ - PORT_BIT (0x0400, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) \ - PORT_BIT (0x0800, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) \ - PORT_BIT (0xf000, IP_ACTIVE_LOW, IPT_UNUSED) -static INPUT_PORTS_START( expert11 ) - PORT_START("KEY0") - KEYB_EXPERT11_ROW0 - KEYB_EXPERT11_ROW1 - - PORT_START("KEY1") - KEYB_EXPERT11_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - KEYB_EXPERT11_ROW6 - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - KEYB_EXPERT11_ROW9 - - PORT_START("KEY5") - PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - -static INPUT_PORTS_START( expert10 ) - PORT_START("KEY0") - KEYB_ROW0 - KEYB_ROW1 - - PORT_START("KEY1") - KEYB_EXPERT10_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - KEYB_EXPERT11_ROW6 - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - KEYB_EXPERT11_ROW9 - - PORT_START("KEY5") - PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - -static INPUT_PORTS_START( msx2 ) - PORT_START("KEY0") - KEYB_ROW0 - KEYB_ROW1 - - PORT_START("KEY1") - KEYB_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - KEYB_ROW6 - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - KEYB_ROW9 - - PORT_START("KEY5") - KEYB_ROW10 - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - -static INPUT_PORTS_START( msx2jp ) - PORT_START("KEY0") - KEYB_JAP_ROW0 - KEYB_JAP_ROW1 - - PORT_START("KEY1") - KEYB_JAP_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - KEYB_ROW9 - - PORT_START("KEY5") - KEYB_ROW10 - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - -static INPUT_PORTS_START( msx2kr ) - PORT_START("KEY0") - KEYB_JAP_ROW0 - KEYB_KOR_ROW1 - - PORT_START("KEY1") - KEYB_JAP_ROW2 - KEYB_ROW3 - - PORT_START("KEY2") - KEYB_ROW4 - KEYB_ROW5 - - PORT_START("KEY3") - PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT (0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT (0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Hangul") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT (0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT (0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT (0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - KEYB_ROW7 - - PORT_START("KEY4") - KEYB_ROW8 - PORT_BIT (0xff00, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY5") - PORT_BIT (0xffff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( msx_dips ) -INPUT_PORTS_END - - -// Some MSX2+ can switch the z80 clock between 3.5 and 5.3 MHz -WRITE_LINE_MEMBER(msx_state::turbo_w) -{ - // 0 - 5.369317 MHz - // 1 - 3.579545 MHz - m_maincpu->set_unscaled_clock(state ? XTAL_21_4772MHz/6 : XTAL_21_4772MHz/4); -} - - -#define MSX_XBORDER_PIXELS 15 -#define MSX_YBORDER_PIXELS 27 -#define MSX_TOTAL_XRES_PIXELS 256 + (MSX_XBORDER_PIXELS * 2) -#define MSX_TOTAL_YRES_PIXELS 192 + (MSX_YBORDER_PIXELS * 2) -#define MSX_VISIBLE_XBORDER_PIXELS 8 -#define MSX_VISIBLE_YBORDER_PIXELS 24 - - -static MACHINE_CONFIG_FRAGMENT( msx1_cartlist ) - MCFG_SOFTWARE_LIST_ADD("cart_list", "msx1_cart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx1_floplist ) - MCFG_SOFTWARE_LIST_ADD("flop_list", "msx1_flop") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx2_cartlist ) - MCFG_SOFTWARE_LIST_ADD("cart_list", "msx2_cart") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_crt_l", "msx1_cart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx2_floplist ) - MCFG_SOFTWARE_LIST_ADD("flop_list", "msx2_flop") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flp_l", "msx1_flop") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx2p_floplist ) - MCFG_SOFTWARE_LIST_ADD("flop_list", "msx2p_flop") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx2_flp_l", "msx2_flop") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flp_l", "msx1_flop") // maybe not? -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msxr_floplist ) - MCFG_SOFTWARE_LIST_ADD("flop_list", "msxr_flop") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx2p_flp_l", "msx2p_flop") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx2_flp_l", "msx2_flop") // maybe not? - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flp_l", "msx1_flop") // maybe not? -MACHINE_CONFIG_END - -FLOPPY_FORMATS_MEMBER( msx_state::floppy_formats ) - FLOPPY_MSX_FORMAT, - FLOPPY_DMK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( msx_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) - SLOT_INTERFACE( "35ssdd", FLOPPY_35_SSDD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_FRAGMENT( msx_fd1793 ) - MCFG_FD1793_ADD("fdc", XTAL_4MHz / 4) - MCFG_WD_FDC_FORCE_READY -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_wd2793_force_ready ) - // From NMS8245 schematics: - // READY + HLT - pulled high - // SSO/-ENMF + -DDEN + ENP + -5/8 - pulled low - MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) - MCFG_WD_FDC_FORCE_READY -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_wd2793 ) - MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_mb8877a ) - // From CF-3300 FDC schematic: - // READY + HLT - pulled high - // -DDEN - pulled low - MCFG_MB8877_ADD("fdc", XTAL_4MHz / 4) - MCFG_WD_FDC_FORCE_READY -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_tc8566af ) - MCFG_TC8566AF_ADD("fdc") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_microsol ) - MCFG_WD2793_ADD("fdc", XTAL_4MHz / 4) - MCFG_WD_FDC_FORCE_READY -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_1_35_ssdd_drive ) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35ssdd", msx_state::floppy_formats) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_1_35_dd_drive ) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_state::floppy_formats) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_2_35_dd_drive ) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", msx_floppies, "35dd", msx_state::floppy_formats) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx_ym2413 ) - MCFG_SOUND_ADD("ym2413", YM2413, XTAL_21_4772MHz/6) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( msx2_64kb_vram ) - MCFG_DEVICE_MODIFY("v9938") - v9938_device::static_set_vram_size(*device, 0x10000); -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( msx, msx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_10_738635MHz/3) /* 3.579545 MHz */ - MCFG_CPU_PROGRAM_MAP(msx_memory_map) - MCFG_CPU_IO_MAP(msx_io_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", msx_state, msx_interrupt) /* Needed for mouse updates */ - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(msx_state, msx_ppi_port_a_w)) - MCFG_I8255_IN_PORTB_CB(READ8(msx_state, msx_ppi_port_b_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(msx_state, msx_ppi_port_c_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_10_738635MHz/3/2) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_PORT_A_READ_CB(READ8(msx_state, msx_psg_port_a_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(msx_state, msx_psg_port_b_r)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(msx_state, msx_psg_port_a_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(msx_state, msx_psg_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) - MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(fmsx_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("msx_cass") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list","msx1_cass") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_ntsc, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_tms9118, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9118, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_tms9128, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9128, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_tms9918, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9918, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_tms9918a, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9918A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_tms9928, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_pal, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_tms9129, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9129, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx_tms9929, msx ) - /* Video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0)) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( msx2, msx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_21_4772MHz/6) /* 3.579545 MHz */ - MCFG_CPU_PROGRAM_MAP(msx_memory_map) - MCFG_CPU_IO_MAP(msx2_io_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(msx_state, msx_ppi_port_a_w)) - MCFG_I8255_IN_PORTB_CB(READ8(msx_state, msx_ppi_port_b_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(msx_state, msx_ppi_port_c_w)) - - /* video hardware */ - MCFG_V9938_ADD("v9938", "screen", 0x20000, XTAL_21_4772MHz) - MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(msx_state,msx_irq_source0)) - MCFG_V99X8_SCREEN_ADD_NTSC("screen", "v9938", XTAL_21_4772MHz) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_21_4772MHz/6/2) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_PORT_A_READ_CB(READ8(msx_state, msx_psg_port_a_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(msx_state, msx_psg_port_b_r)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(msx_state, msx_psg_port_a_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(msx_state, msx_psg_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) - MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(fmsx_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("msx_cass") - - /* real time clock */ - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list", "msx2_cass") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_cas_l", "msx1_cass") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( msx2p, msx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_21_4772MHz/6) /* 3.579545 MHz */ - MCFG_CPU_PROGRAM_MAP(msx_memory_map) - MCFG_CPU_IO_MAP(msx2p_io_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(msx_state, msx_ppi_port_a_w)) - MCFG_I8255_IN_PORTB_CB(READ8(msx_state, msx_ppi_port_b_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(msx_state, msx_ppi_port_c_w)) - - /* video hardware */ - MCFG_V9958_ADD("v9958", "screen", 0x20000, XTAL_21_4772MHz) - MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(msx_state,msx_irq_source0)) - MCFG_V99X8_SCREEN_ADD_NTSC("screen", "v9958", XTAL_21_4772MHz) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_21_4772MHz/6/2) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_PORT_A_READ_CB(READ8(msx_state, msx_psg_port_a_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(msx_state, msx_psg_port_b_r)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(msx_state, msx_psg_port_a_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(msx_state, msx_psg_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) - MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(fmsx_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("msx_cass") - - /* real time clock */ - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list", "msx2_cass") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_cas_l", "msx1_cass") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( msx2_pal, msx2 ) - MCFG_DEVICE_REMOVE("screen") - MCFG_V99X8_SCREEN_ADD_PAL("screen", "v9938", XTAL_21_4772MHz) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/******************************** MSX 1 **********************************/ - -/* MSX - Al Alamiah AX-150 */ - -ROM_START(ax150) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("ax150bios.rom", 0x0000, 0x8000, CRC(bd95c436) SHA1(5e094fca95ab8e91873ee372a3f1239b9a48a48d)) - ROM_LOAD ("ax150arab.rom", 0x8000, 0x8000, CRC(339cd1aa) SHA1(0287b2ec897b9196788cd9f10c99e1487d7adbbb)) -ROM_END - -static MACHINE_CONFIG_DERIVED( ax150, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("arab", 1, 0, 1, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 2, 2) /* 32KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Al Alamiah AX-170 */ - -ROM_START (ax170) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("ax170bios.rom", 0x0000, 0x8000, CRC(bd95c436) SHA1(5e094fca95ab8e91873ee372a3f1239b9a48a48d)) - ROM_LOAD ("ax170arab.rom", 0x8000, 0x8000, CRC(339cd1aa) SHA1(0287b2ec897b9196788cd9f10c99e1487d7adbbb)) -ROM_END - - -static MACHINE_CONFIG_DERIVED( ax170, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // T7937 (in ax170mk2) - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("arab", 1, 0, 1, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Canon V-8 */ - -ROM_START (canonv8) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("v8bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( canonv8, msx_ntsc ) - // AY8910/YM2149?? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 8KB RAM */ - MCFG_MSX_SLOT_RAM_8KB - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot12", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Canon V-10 */ - -ROM_START (canonv10) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("v10bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( canonv10, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot12", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Canon V-20 */ - -ROM_START (canonv20) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("v20bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( canonv20, msx_tms9929 ) - // YM2149 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Canon V-20E */ - -ROM_START (canonv20e) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("v20ebios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -/* MSX - Canon V-20F */ - -ROM_START (canonv20f) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("v20fbios.rom", 0x0000, 0x8000, CRC(e0e894b7) SHA1(d99eebded5db5fce1e072d08e642c0909bc7efdd)) -ROM_END - -/* MSX - Canon V-20G */ - -ROM_START (canonv20g) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("v20gbios.rom", 0x0000, 0x8000, CRC(d6e704ad) SHA1(d67be6d7d56d7229418f4e122f2ec27990db7d19)) -ROM_END - -/* MSX - Canon V-20S */ - -ROM_START (canonv20s) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("v20sbios.rom", 0x0000, 0x8000, CRC(c72b186e) SHA1(9fb289ea5c11d497ee00703f64e82575d1c59923)) -ROM_END - -/* MSX - Casio MX-10 */ - -ROM_START (mx10) - ROM_REGION(0x8000, "maincpu", 0) - ROM_LOAD( "mx10bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mx10, msx_tms9118 ) - // FDC: None, 0 drives - // 2? Cartridge slots - // Z80: uPD780C-1 - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) // 16KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Casio MX-15 */ - -ROM_START (mx15) - ROM_REGION(0x8000, "maincpu", 0) - ROM_LOAD( "mx15bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mx15, msx_ntsc ) - // FDC: None, 0 drives - // 3 Cartridge slots - // T6950 - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) // 16KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot3", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Casio MX-101 */ - -ROM_START (mx101) - ROM_REGION(0x8000, "maincpu", 0) - ROM_LOAD( "mx101bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mx101, msx_ntsc ) - // FDC: None, 0 drives - // 2? Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) // 16KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Casio PV-7 */ - -ROM_START (pv7) - ROM_REGION(0x8000, "maincpu", 0) - ROM_LOAD("pv7bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( pv7, msx_tms9118 ) - // AY8910? - // FDC: None, 0 drives - // 1 Cartridge slot + expansion slot, or 2 cartridge slots? - // By adding a Casio KB-7 2 additional cartridge slots become available and 8KB extra RAM? - // No cassette port - // No printer port - // Z80: uPD780C-1 - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 8KB RAM */ - MCFG_MSX_SLOT_RAM_8KB - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Casio PV-16 */ - -ROM_START (pv16) - ROM_REGION(0x8000, "maincpu", 0) - ROM_LOAD("pv16.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( pv16, msx_tms9118 ) - // AY8910 - // FDC: None, 0 drives - // 1 Cartridge slot - // No printer port - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Daewoo CPC-88 */ - -ROM_START (cpc88) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("88bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) - ROM_LOAD ("88han.rom", 0x8000, 0x2000, CRC(938db440) SHA1(d41676fde0a3047792f93c4a41509b8749e55e74)) - ROM_RELOAD (0xa000, 0x2000) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc88, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2? Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Daewoo DPC-100 */ - -ROM_START (dpc100) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("100bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) - ROM_LOAD ("100han.rom", 0x8000, 0x4000, CRC(97478efb) SHA1(4421fa2504cbce18f7c84b5ea97f04e017007f07)) -ROM_END - -static MACHINE_CONFIG_DERIVED( dpc100, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Daewoo DPC-180 */ - -ROM_START (dpc180) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("180bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) - ROM_LOAD ("180han.rom", 0x8000, 0x4000, CRC(97478efb) SHA1(4421fa2504cbce18f7c84b5ea97f04e017007f07)) -ROM_END - -static MACHINE_CONFIG_DERIVED( dpc180, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Daewoo DPC-200 */ - -ROM_START (dpc200) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("200bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) - ROM_LOAD ("200han.rom", 0x8000, 0x4000, CRC(97478efb) SHA1(4421fa2504cbce18f7c84b5ea97f04e017007f07)) -ROM_END - -static MACHINE_CONFIG_DERIVED( dpc200, msx_tms9918 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Daewoo DPC-200E */ - -ROM_START (dpc200e) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("dpc200ebios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) -ROM_END - -static MACHINE_CONFIG_DERIVED( dpc200e, msx_pal ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Daewoo Zemmix CPC-50A */ - -ROM_START (cpc50a) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("50abios.rom", 0x0000, 0x8000, CRC(c3a868ef) SHA1(a08a940aa87313509e00bc5ac7494d53d8e03492)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc50a, msx_tms9918 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 1? Cartridge slot - // No keyboard? - // No cassette port? - // No printer port? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 8KB RAM */ - MCFG_MSX_SLOT_RAM_8KB - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Daewoo Zemmix CPC-50B */ - -ROM_START (cpc50b) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("50bbios.rom", 0x0000, 0x8000, CRC(c3a868ef) SHA1(a08a940aa87313509e00bc5ac7494d53d8e03492)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc50b, msx_tms9118 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 1? Cartridge slot - // No keyboard? - // No cassette port? - // No printer port? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Daewoo Zemmix CPC-51 */ - -ROM_START (cpc51) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("51bios.rom", 0x0000, 0x8000, CRC(c3a868ef) SHA1(a08a940aa87313509e00bc5ac7494d53d8e03492)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc51, msx_tms9118 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 1 Cartridge slot - // No keyboard, just a keyboard connector - // No cassette port - // No printer port - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Fenner DPC-200 */ - -ROM_START (fdpc200) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("dpc200bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fdpc200, msx_pal ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Fenner FPC-500 */ - -ROM_START (fpc500) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("fpc500bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fpc500, msx_pal ) - // AY8910? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Fenner SPC-800 */ - -ROM_START (fspc800) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("spc800bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fspc800, msx_tms9929 ) - // AY8910? - // FDC: None, 0 drives - // 2 Cartridge slots - // Z80: GSS Z8400APS - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Frael Bruc 100-1 */ - -ROM_START (bruc100) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD("bruc100-1bios.rom", 0x0000, 0x8000, CRC(c7bc4298) SHA1(3abca440cba16ac5e162b602557d30169f77adab)) -ROM_END - -static MACHINE_CONFIG_DERIVED( bruc100, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Fujitsu FM-X */ - -ROM_START (fmx) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("fmxbios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fmx, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 1 Cartridge slot, 2 "Fujistu expansion slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) // 16KB RAM - // Fujitsu expansion slot #1 in slot 1 - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - // Fijutsu expansion slot #2 in slot 3 - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Goldstar FC-80U */ - -ROM_START (gsfc80u) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("fc80ubios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) - ROM_LOAD ("fc80uhan.rom", 0x8000, 0x2000, CRC(0cdb8501) SHA1(58dbe73ae80c2c409e766c3ace730ecd7bec89d0)) - ROM_RELOAD (0xa000, 0x2000) -ROM_END - -static MACHINE_CONFIG_DERIVED( gsfc80u, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Goldstar FC-200 */ - -ROM_START (gsfc200) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("fc200bios.rom.u5a", 0x0000, 0x4000, CRC(61f473fb) SHA1(c425750bbb2ae1d278216b45029d303e37d8df2f)) - ROM_LOAD ("fc200bios.rom.u5b", 0x4000, 0x4000, CRC(1a99b1a1) SHA1(e18f72271b64693a2a2bc226e1b9ebd0448e07c0)) -ROM_END - -static MACHINE_CONFIG_DERIVED( gsfc200, msx_tms9129 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Goldstar GFC-1080 */ - -ROM_START (gfc1080) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("gfc1080bios.rom", 0x0000, 0x8000, CRC(d9cdd4a6) SHA1(6b0be712b9c95c1e912252ab5703e1c0bc457d9e)) - ROM_LOAD ("gfc1080han.rom", 0x8000, 0x4000, CRC(f209448c) SHA1(141b44212ba28e7d03e0b54126fedd9e0807dc42)) - ROM_LOAD ("gfc1080pasocalc.rom", 0xC000, 0x4000, CRC(4014f7ea) SHA1(a5581fa3ce10f90f15ba3dc53d57b02d6e4af172)) -ROM_END - -static MACHINE_CONFIG_DERIVED( gfc1080, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 4, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) // 64KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Goldstar GFC-1080A */ - -ROM_START (gfc1080a) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("gfc1080abios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) - ROM_LOAD ("gfc1080ahan.rom", 0x8000, 0x2000, CRC(0cdb8501) SHA1(58dbe73ae80c2c409e766c3ace730ecd7bec89d0)) - ROM_RELOAD (0xa000, 0x2000) -ROM_END - -static MACHINE_CONFIG_DERIVED( gfc1080a, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 3, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) // 64KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Gradiente Expert 1.0 */ - -ROM_START (expert10) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("expbios.rom", 0x0000, 0x8000, CRC(07610d77) SHA1(ef3e010eb57e4476700a3bbff9d2119ab3acdf62)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expert10, msx_tms9128 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Gradiente Expert 1.1 */ -ROM_START (expert11) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("expbios11.rom", 0x0000, 0x8000, CRC(efb4b972) SHA1(d6720845928ee848cfa88a86accb067397685f02)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expert11, msx_tms9128 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Gradiente Expert 1.3 */ -ROM_START (expert13) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("expbios13.rom", 0x0000, 0x8000, CRC(5638bc38) SHA1(605f5af3f358c6811f54e0173bad908614a198c0)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expert13, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Gradiente Expert DDPlus */ -ROM_START (expertdp) - ROM_REGION (0xc000, "maincpu",0) - ROM_LOAD ("eddpbios.rom", 0x0000, 0x8000, CRC(efb4b972) SHA1(d6720845928ee848cfa88a86accb067397685f02)) - ROM_LOAD ("eddpdisk.rom", 0x8000, 0x4000, CRC(549f1d90) SHA1(f1525de4e0b60a6687156c2a96f8a8b2044b6c56)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expertdp, msx_ntsc ) - // AY8910/YM2149? - // FDC: mb8877a, 1 3.5" DSDD drive - // 2 Cartridge slots - // MSX Engine T7937A (also VDP) - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Gradiente Expert Plus */ - -ROM_START (expertpl) - ROM_REGION (0xc000, "maincpu",0) - ROM_LOAD ("exppbios.rom", 0x0000, 0x8000, CRC(efb4b972) SHA1(d6720845928ee848cfa88a86accb067397685f02)) - ROM_LOAD ("exppdemo.rom", 0x8000, 0x4000, CRC(a9bbef64) SHA1(d4cea8c815f3eeabe0c6a1c845f902ec4318bf6b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expertpl, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // MSX Engine T7937A - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_ROM("demo", 3, 3, 2, 1, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Hitachi MB-H2 */ - -ROM_START (mbh2) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("mbh2bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) - ROM_LOAD ("mbh2firm.rom", 0x8000, 0x4000, CRC(4f03c947) SHA1(e2140fa2e8e59090ecccf55b62323ea9dcc66d0b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mbh2, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // Builtin cassette player - // Speed controller (normal, slow 1, slow 2) - - MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 3, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) // 64KB RAM - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Hitachi MB-H25 */ - -ROM_START (mbh25) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mbh25bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mbh25, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) // 32KB RAM - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Hitachi MB-H50 */ - -ROM_START (mbh50) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mbh50bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mbh50, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // T6950 - - MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) // 64KB RAM - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - JVC HC-7GB */ - -ROM_START (jvchc7gb) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("hc7gbbios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( jvchc7gb, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("rom", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Mitsubishi ML-F48 */ - -ROM_START (mlf48) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mlf48bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlf48, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 2, 2) // 32KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Mitsubishi ML-F80 */ - -ROM_START (mlf80) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mlf80bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlf80, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Mitsubishi ML-F110 */ - -ROM_START (mlf110) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mlf110bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlf110, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 3, 1) // 16KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Mitsubishi ML-F120 */ - -ROM_START (mlf120) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("mlf120bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) - ROM_LOAD ("mlf120firm.rom", 0x8000, 0x4000, CRC(4b5f3173) SHA1(21a9f60cb6370d0617ce54c42bb7d8e40a4ab560)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlf120, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2? Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("firm", 1, 0, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 2, 2) // 32KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Mitsubishi ML-FX1 */ - -ROM_START (mlfx1) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mlfx1bios.rom", 0x0000, 0x8000, CRC(62867dce) SHA1(0cbe0df4af45e8f531e9c761403ac9e71808f20c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlfx1, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - National CF-1200 */ - -ROM_START (cf1200) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("1200bios.rom", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cf1200, msx_tms9918a ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - National CF-2000 */ - -ROM_START (cf2000) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("2000bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cf2000, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - National CF-2700 */ -ROM_START (cf2700) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("2700bios.rom.ic32", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cf2700, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - National CF-3000 */ - -ROM_START (cf3000) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("3000bios.rom", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cf3000, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - National CF-3300 */ -ROM_START (cf3300) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("3300bios.rom", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) - ROM_LOAD ("3300disk.rom", 0x8000, 0x4000, CRC(549f1d90) SHA1(f1525de4e0b60a6687156c2a96f8a8b2044b6c56)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cf3300, msx_ntsc ) - // AY8910/YM2149? - // FDC: mb8877a, 1 3.5" SSDD drive - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - National FS-1300 */ - -ROM_START (fs1300) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("1300bios.rom", 0x0000, 0x8000, CRC(5ad03407) SHA1(c7a2c5baee6a9f0e1c6ee7d76944c0ab1886796c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs1300, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - National FS-4000 */ - -ROM_START (fs4000) - ROM_REGION (0x18000 ,"maincpu", 0) - ROM_LOAD ("4000bios.rom", 0x0000, 0x8000, CRC(071135e0) SHA1(df48902f5f12af8867ae1a87f255145f0e5e0774)) - ROM_LOAD ("4000word.rom", 0x8000, 0x8000, CRC(950b6c87) SHA1(931d6318774bd495a32ec3dabf8d0edfc9913324)) - ROM_LOAD ("4000kdr.rom", 0x10000, 0x8000, CRC(ebaa5a1e) SHA1(77bd67d5d10d459d343e79eafcd8e17eb0f209dd)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("4000kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs4000, msx_tms9128 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("word", 3, 0, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - National FS-4000 (Alt) */ - -ROM_START (fs4000a) - ROM_REGION (0x18000 ,"maincpu", 0) - ROM_LOAD ("4000bios.rom", 0x0000, 0x8000, CRC(071135e0) SHA1(df48902f5f12af8867ae1a87f255145f0e5e0774)) - ROM_LOAD ("4000wora.rom", 0x8000, 0x8000, CRC(52f4cdf7) SHA1(acbac3cb5b700254bed2cacc19fa54f1950f371d)) - ROM_LOAD ("4000kdra.rom", 0x10000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("4000kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs4000a, msx_tms9128 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("word", 3, 0, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/*MSX - Olympia PHC-2*/ - -ROM_START (phc2) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("phc2bios.rom", 0x0000, 0x8000, CRC(4f7bb04b) SHA1(ab0177624d46dd77ab4f50ffcb983c3ba88223f4)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc2, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Olympia PHC-28 */ - -ROM_START (phc28) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("phc28bios.rom", 0x0000, 0x8000, CRC(eceb2802) SHA1(195950173701abeb460a1a070d83466f3f53b337)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc28, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Panasonic CF-2700G */ - -ROM_START (cf2700g) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("cf2700g.rom", 0x0000, 0x8000, CRC(4aa194f4) SHA1(69bf27b610e11437dad1f7a1c37a63179a293d12)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cf2700g, msx_tms9929 ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB?? RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Perfect Perfect1 */ - -ROM_START (perfect1) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("perfect1bios.rom", 0x0000, 0x8000, CRC(a317e6b4) SHA1(e998f0c441f4f1800ef44e42cd1659150206cf79)) - ROM_LOAD ("perfect1arab.rom", 0x8000, 0x8000, CRC(6db04a4d) SHA1(01012a0e2738708861f66b6921b2e2108f2edb54)) - ROM_RELOAD (0x10000, 0x8000) -ROM_END - -static MACHINE_CONFIG_DERIVED( perfect1, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 dribes - // 1 Cartridge slot - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("arab", 0, 1, 0, 4, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 2, 0, 4) // 64KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Philips NMS-801 */ - -ROM_START (nms801) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("801bios.rom", 0x0000, 0x8000, CRC(fa089461) SHA1(21329398c0f350e330b353f45f21aa7ba338fc8d)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms801, msx_pal ) - // AY8910 - // FDC: None, 0 drives - // 0 Cartridge slots - // No printer port - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ -MACHINE_CONFIG_END - -/* MSX - Philips VG-8000 */ - -ROM_START (vg8000) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("8000bios.rom", 0x0000, 0x8000, CRC(efd970b0) SHA1(42252cf87deeb58181a7bfec7c874190a1351779)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8000, msx_tms9129 ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots - // No printer port - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 3, 1) /* 16KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Philips VG-8010 */ - -ROM_START (vg8010) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("8010bios.rom", 0x0000, 0x8000, CRC(efd970b0) SHA1(42252cf87deeb58181a7bfec7c874190a1351779)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8010, msx_tms9129 ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots - // No printer port - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Philips VG-8010F */ - -ROM_START (vg8010f) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("8010fbios.rom", 0x0000, 0x8000, CRC(df57c9ca) SHA1(898630ad1497dc9a329580c682ee55c4bcb9c30c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8010f, msx_tms9129 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // No printer port - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Philips VG-8020-00 */ - -ROM_START (vg802000) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("8020-00bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg802000, msx_tms9929 ) - // YM2149 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Philips VG-8020-20 */ - -ROM_START (vg802020) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("8020-20bios.rom", 0x0000, 0x8000, CRC(a317e6b4) SHA1(e998f0c441f4f1800ef44e42cd1659150206cf79)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg802020, msx_tms9129 ) - // YM2149 (in S-3527 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Philips VG-8020F */ - -ROM_START (vg8020f) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("vg8020f.rom", 0x0000, 0x8000, CRC(6e692fa1) SHA1(9eaad185efc8e224368d1db4949eb9659c26fb2c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8020f, msx_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB?? RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Pioneer PX-7 */ - -ROM_START (piopx7) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("ym2301.ic12", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) - ROM_LOAD ("pd5031.ic13", 0x8000, 0x2000, CRC(91e0df72) SHA1(4f0102cdc27216fd9bcdb9663db728d2ccd8ca6d)) - ROM_FILL( 0xa000, 0x2000, 0x6E ) -ROM_END - -static MACHINE_CONFIG_DERIVED( piopx7, msx_pal ) - // TMS9129NL VDP with sync/overlay interface - // AY-3-8910 PSG - // Pioneer System Remote (SR) system control interface - // FDC: None, 0 drives - // 2 Cartridge slots - - // Line-level stereo audio input can be mixed with sound output, balance controlled with slider on front panel - // Front-panel switch allows audio input to be passed through bypassing the mixing circuit - // Line input can be muted under software control, e.g. when loading data from Laserdisc - // Right channel of line input is additionally routed via some signal processing to the cassette input for loading data from Laserdisc - - // PSG port B bits 0-5 can be used to drive controller pins 1-6, 1-7, 2-6, 2-7, 1-8 and 2-8 low if 0 is written - - // Slot #2 7FFE is the SR control register LCON - // Bit 7 R = /ACK (significant with acknowledge 1->0 with respect to remote control signal transmission) - // Bit 0 R = RMCLK (clock produced by dividing CLK1/CLK2 frequency by 128) - // Bit 0 W = /REM (high output with bit serial data output generated in synchronisation with RMCLK) - - // Slot #2 7FFF is the video overlay control register VCON - // Bit 7 R = /EXTV (low when external video input available; high when not available) - // Bit 7 W = Mute (line input signal muting) - // Bit 0 R = INTEXV (interrupt available when external video signal OFF, reset on read) - // Bit 0 W = /OVERLAY (0 = superimpose, 1 = non-superimpose) - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("rom2", 2, 0, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Pioneer PX-7UK */ - -ROM_START (piopx7uk) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("px7ukbios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) - ROM_LOAD ("px7ukpbasic.rom", 0x8000, 0x2000, CRC(91e0df72) SHA1(4f0102cdc27216fd9bcdb9663db728d2ccd8ca6d)) - ROM_FILL( 0xa000, 0x2000, 0x6E ) - ROM_LOAD ("videoart.rom", 0xc000, 0x8000, CRC(0ba148dc) SHA1(b7b4e4cd40a856bb071976e6cf0f5e546fc86a78)) -ROM_END - -static MACHINE_CONFIG_DERIVED( piopx7uk, msx_tms9129 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("rom2", 2, 0, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Pioneer PX-V60 */ - -ROM_START (piopxv60) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("pxv60bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) - ROM_LOAD ("pxv60pbasic.rom", 0x8000, 0x2000, CRC(91e0df72) SHA1(4f0102cdc27216fd9bcdb9663db728d2ccd8ca6d)) - ROM_FILL( 0xa000, 0x2000, 0x6E ) -ROM_END - -static MACHINE_CONFIG_DERIVED( piopxv60, msx_tms9128 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("rom2", 2, 0, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Samsung SPC-800 */ - -ROM_START (spc800) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("spc800bios.rom", 0x0000, 0x8000, CRC(3ab0cd3b) SHA1(171b587bd5a947a13f3114120b6e7baca3b57d78)) - ROM_LOAD ("spc800han.rom", 0x8000, 0x4000, CRC(5ae2b013) SHA1(1e7616261a203580c1044205ad8766d104f1d874)) -ROM_END - -static MACHINE_CONFIG_DERIVED( spc800, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 0, 4, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB?? RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sanyo MPC-64 */ - -ROM_START (mpc64) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mpc64bios.rom", 0x0000, 0x8000, CRC(d6e704ad) SHA1(d67be6d7d56d7229418f4e122f2ec27990db7d19)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc64, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sanyo MPC-100 */ - -ROM_START (mpc100) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mpc100bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc100, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sanyo MPC-200 */ - -ROM_START (mpc200) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mpc200bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc200, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2? Cartridge slots - // T6950 - // T7775 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) // 64KB RAM - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sanyo MPC-200SP */ - -ROM_START (mpc200sp) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mpcsp200bios.rom", 0x0000, 0x8000, CRC(bcd79900) SHA1(fc8c2b69351e60dc902add232032c2d69f00e41e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc200sp, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2? Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) // 64KB RAM - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sanyo PHC-28L */ - -ROM_START (phc28l) - ROM_REGION( 0x8000, "maincpu", 0) - ROM_LOAD ("28lbios.rom", 0x0000, 0x8000, CRC(d2110d66) SHA1(d3af963e2529662eae63f04a2530454685a1989f)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc28l, msx_tms9929 ) - // YM2149 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sanyo PHC-28S */ - -ROM_START (phc28s) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("28sbios.rom", 0x0000, 0x8000, CRC(e5cf6b3c) SHA1(b1cce60ef61c058f5e42ef7ac635018d1a431168)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc28s, msx_tms9929 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sanyo Wavy MPC-10 */ - -ROM_START (mpc10) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("mpc10.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc10, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sharp Epcom HotBit 1.1 */ - -ROM_START (hotbit11) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hotbit11.rom", 0x0000, 0x8000, CRC(b6942694) SHA1(663f8c512d04d213fa616b0db5eefe3774012a4b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hotbit11, msx_tms9128 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sharp Epcom HotBit 1.2 */ - -ROM_START (hotbit12) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hotbit12.rom", 0x0000, 0x8000, CRC(f59a4a0c) SHA1(9425815446d468058705bae545ffa13646744a87)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hotbit12, msx_tms9128 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sharp Epcom HotBit 1.3b */ - -ROM_START (hotbi13b) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hotbit13b.rom", 0x0000, 0x8000, CRC(7a19820e) SHA1(e0c2bfb078562d15acabc5831020a2370ea87052)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hotbi13b, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sharp Epcom HotBit 1.3p */ - -ROM_START (hotbi13p) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hotbit13p.rom", 0x0000, 0x8000, CRC(150e239c) SHA1(942f9507d206cd8156f15601fe8032fcf0e3875b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hotbi13p, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-10 */ - -ROM_START (hb10) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("hb10bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb10, msx_ntsc ) - // YM2149 (in S-1985 MSX-Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX-Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 3, 1) /* 16KB? RAM */ - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-10P */ - -ROM_START (hb10p) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("10pbios.rom", 0x0000, 0x8000, CRC(0f488dd8) SHA1(5e7c8eab238712d1e18b0219c0f4d4dae180420d)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb10p, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // T6950 - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-20P */ - -ROM_START (hb20p) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("20pbios.rom", 0x0000, 0x8000, CRC(21af423f) SHA1(365c93d7652c9f727221689bcc348652832a7b7a)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb20p, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // T6950 - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-201 */ - -ROM_START (hb201) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("201bios.rom.ic9", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) - ROM_LOAD ("201note.rom.ic8", 0x8000, 0x4000, CRC(74567244) SHA1(0f4f09f1a6ef7535b243afabfb44a3a0eb0498d9)) - ROM_FILL( 0xc000, 0x4000, 0xff ) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb201, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-201P */ - -ROM_START (hb201p) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("201pbios.rom.ic9", 0x0000, 0x8000, CRC(0f488dd8) SHA1(5e7c8eab238712d1e18b0219c0f4d4dae180420d)) - ROM_LOAD ("201pnote.rom.ic8", 0x8000, 0x4000, CRC(1ff9b6ec) SHA1(e84d3ec7a595ee36b50e979683c84105c1871857)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb201p, msx_pal ) - // YM2149 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-501P */ - -ROM_START (hb501p) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("501pbios.rom", 0x0000, 0x8000, CRC(0f488dd8) SHA1(5e7c8eab238712d1e18b0219c0f4d4dae180420d)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb501p, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-55 (Version 1) */ - -ROM_START (hb55) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("hb55bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) - ROM_LOAD ("hb55note.rom", 0x8000, 0x2000, CRC(5743ab55) SHA1(b9179db93608c4da649532e704f072e0a3ea1b22)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb55, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-55D */ - -ROM_START (hb55d) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("55dbios.rom", 0x0000, 0x8000, CRC(7e2b32dd) SHA1(38a645febd0e0fe86d594f27c2d14be995acc730)) - ROM_LOAD ("55dnote.rom", 0x8000, 0x4000, CRC(8aae0494) SHA1(97ce59892573cac3c440efff6d74c8a1c29a5ad3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb55d, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-55P */ - -ROM_START (hb55p) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("55pbios.ic42", 0x0000, 0x4000, CRC(24c198be) SHA1(7f8c94cb8913db32a696dec80ffc78e46693f1b7)) - ROM_LOAD ("55pbios.ic43", 0x4000, 0x4000, CRC(e516e7e5) SHA1(05fedd4b9bfcf4949020c79d32c4c3f03a54fb62)) - ROM_LOAD ("55pnote.ic44", 0x8000, 0x4000, CRC(492b12f8) SHA1(b262aedc71b445303f84efe5e865cbb71fd7d952)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb55p, msx_pal ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-75D */ - -ROM_START (hb75d) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("75dbios.rom", 0x0000, 0x8000, CRC(7e2b32dd) SHA1(38a645febd0e0fe86d594f27c2d14be995acc730)) - ROM_LOAD ("75dnote.rom", 0x8000, 0x4000, CRC(8aae0494) SHA1(97ce59892573cac3c440efff6d74c8a1c29a5ad3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb75d, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-75P */ - -ROM_START (hb75p) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("75pbios.ic42", 0x0000, 0x4000, CRC(24c198be) SHA1(7f8c94cb8913db32a696dec80ffc78e46693f1b7)) - ROM_LOAD ("75pbios.ic43", 0x4000, 0x4000, CRC(e516e7e5) SHA1(05fedd4b9bfcf4949020c79d32c4c3f03a54fb62)) - ROM_LOAD ("75pnote.ic44", 0x8000, 0x4000, CRC(492b12f8) SHA1(b262aedc71b445303f84efe5e865cbb71fd7d952)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb75p, msx_tms9929 ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("note", 0, 0, 2, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-101P */ - -ROM_START (hb101p) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("101pbios.rom", 0x0000, 0x8000, CRC(0f488dd8) SHA1(5e7c8eab238712d1e18b0219c0f4d4dae180420d)) - ROM_LOAD ("101pnote.rom", 0x8000, 0x4000, CRC(525017c2) SHA1(8ffc24677fd9d2606a79718764261cdf02434f0a)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb101p, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("note", 3, 0, 1, 1, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Sony HB-701FD */ - -ROM_START (hb701fd) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("hb701fdbios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) - ROM_LOAD ("hb701fddisk.rom", 0x8000, 0x4000, CRC(71961d9d) SHA1(2144036d6573d666143e890e5413956bfe8f66c5)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hb701fd, msx_tms9928 ) - // YM2149 (in S-1985) - // FDC: WD2793?, 1 3.5" SSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0x8000) // Is this correct?? - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Spectravideo SVI-728 */ - -ROM_START (svi728) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("728bios.rom", 0x0000, 0x8000, CRC(1ce9246c) SHA1(ea6a82cf8c6e65eb30b98755c8577cde8d9186c0)) -// ROM_LOAD ("707disk.rom", 0x8000, 0x4000, CRC(f9978853) SHA1(6aa856cc56eb98863c9da7a566571605682b5c6b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( svi728, msx_tms9129 ) - // AY8910 - // FDC: None, 0 drives - // 1 Cartridge slots, 1 Expansion slot (eg for SVI-707) - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 2, 0) -// MSX_LAYOUT_SLOT (3, 0, 1, 1, DISK_ROM2, 0x4000, 0x8000) -// MSX_LAYOUT_SLOT (3, 1, 0, 4, CARTRIDGE2, 0x0000, 0x0000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Spectravideo SVI-738 */ - -ROM_START (svi738) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("738bios.rom", 0x0000, 0x8000, CRC(ad007d62) SHA1(c53b3f2c00f31683914f7452f3f4d94ae2929c0d)) - ROM_LOAD ("738disk.rom", 0x8000, 0x4000, CRC(acd27a36) SHA1(99a40266bc296cef1d432cb0caa8df1a7e570be4)) - ROM_LOAD ("738232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) - ROM_FILL (0xe000, 0x2000, 0xff) -ROM_END - -static MACHINE_CONFIG_DERIVED( svi738, msx_pal ) - // AY8910 - // FDC: wd1793, 1 3.5" SSDD drive - // 2 Cartridge slots - // builtin 80 columns card (V9938) - // RS-232C interface - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) - - MCFG_FRAGMENT_ADD( msx_fd1793 ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Spectravideo SVI-738 Arabic */ - -ROM_START (svi738ar) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("738arbios.rom", 0x0000, 0x8000, CRC(ad007d62) SHA1(c53b3f2c00f31683914f7452f3f4d94ae2929c0d)) - ROM_LOAD ("738ardisk.rom", 0x8000, 0x4000, CRC(acd27a36) SHA1(99a40266bc296cef1d432cb0caa8df1a7e570be4)) - ROM_LOAD ("738ar232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) - ROM_FILL (0xe000, 0x2000, 0xff) - ROM_LOAD ("738arab.rom", 0x10000, 0x8000, CRC(339cd1aa) SHA1(0287b2ec897b9196788cd9f10c99e1487d7adbbb)) -ROM_END - -static MACHINE_CONFIG_DERIVED( svi738ar, msx_pal ) - // AY8910 - // FDC: wd2793, 1 3.5" SSDD drive - // 2 Cartridge slots - // builtin 80 columns card (V9938) - // RS-232C interface - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) - MCFG_MSX_LAYOUT_ROM("arab", 3, 3, 1, 2, "maincpu", 0x10000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Spectravideo SVI-738 Danish */ - -ROM_START (svi738dk) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("738dkbios.rom", 0x0000, 0x8000, CRC(88720320) SHA1(1bda5af20cb86565bdc1ebd1e59a691fed7f9256)) - ROM_LOAD ("738dkdisk.rom", 0x8000, 0x4000, CRC(fb884df4) SHA1(6d3a530ae822ec91f6444c681c9b08b9efadc7e7)) - ROM_LOAD ("738dk232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) - ROM_FILL (0xe000, 0x2000, 0xff) -ROM_END - -static MACHINE_CONFIG_DERIVED( svi738dk, msx_pal ) - // AY8910 - // FDC: wd2793, 1 3.5" SSDD drive - // 2 Cartridge slots - // builtin 80 columns card (V9938) - // RS-232C interface - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Spectravideo SVI-738 Spanish */ - -ROM_START (svi738sp) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("738spbios.rom", 0x0000, 0x8000, CRC(f0c0cbb9) SHA1(5f04d5799ed72ea4993e7c4302a1dd55ac1ea8cd)) - ROM_LOAD ("738spdisk.rom", 0x8000, 0x4000, CRC(fb884df4) SHA1(6d3a530ae822ec91f6444c681c9b08b9efadc7e7)) - ROM_LOAD ("738sp232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) - ROM_FILL (0xe000, 0x2000, 0xff) -ROM_END - -static MACHINE_CONFIG_DERIVED( svi738sp, msx_pal ) - // AY8910 - // FDC: wd2793, 1 3.5" SSDD drive - // 2 Cartridge slots - // builtin 80 columns card (V9938) - // RS-232C interface - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Spectravideo SVI-738 Swedish */ - -ROM_START (svi738sw) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("738sebios.rom", 0x0000, 0x8000, CRC(c8ccdaa0) SHA1(87f4d0fa58cfe9cef818a3185df2735e6da6168c)) - ROM_LOAD ("738sedisk.rom", 0x8000, 0x4000, CRC(fb884df4) SHA1(6d3a530ae822ec91f6444c681c9b08b9efadc7e7)) - ROM_LOAD ("738se232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) - ROM_FILL (0xe000, 0x2000, 0xff) -ROM_END - -static MACHINE_CONFIG_DERIVED( svi738sw, msx_pal ) - // AY8910 - // FDC: wd2793, 1 3.5" SSDD drive - // 2 Cartridge slots - // builtin 80 columns card (V9938) - // RS-232C interface - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Spectravideo SVI-738 Poland*/ - -ROM_START (svi738pl) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("738plbios.rom", 0x0000, 0x8000, CRC(431b8bf5) SHA1(c90077ed84133a947841e07856e71133ba779da6)) // IC51 on board - ROM_LOAD ("738disk.rom", 0x8000, 0x4000, CRC(acd27a36) SHA1(99a40266bc296cef1d432cb0caa8df1a7e570be4)) - ROM_LOAD ("738232c.rom", 0xc000, 0x2000, CRC(3353dcc6) SHA1(4e9384c9d137f0ab65ffc5a78f04cd8c9df6c8b7)) - ROM_FILL (0xe000, 0x2000, 0xff) -ROM_END - -static MACHINE_CONFIG_DERIVED( svi738pl, msx_pal ) - // AY8910 - // FDC: wd2793, 1 3.5" SSDD drive - // 2 Cartridge slots - // builtin 80 columns card (V9938) - // RS-232C interface - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_ROM("rs232", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 2) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Talent DPC-200 */ - -ROM_START (tadpc200) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("dpc200bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) -ROM_END - -static MACHINE_CONFIG_DERIVED( tadpc200, msx_tms9129 ) - // AY8910 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Talent DPC-200A */ - -ROM_START (tadpc20a) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("dpc200abios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) -ROM_END - -static MACHINE_CONFIG_DERIVED( tadpc20a, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 1, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-10 */ -/* The BIOS on the Toshiba HX-10 is inside a big 64pin Toshiba chip label TCX-1007 */ - -ROM_START (hx10) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("tcx-1007.ic15", 0x0000, 0x8000, CRC(5486b711) SHA1(4dad9de7c28b452351cc12910849b51bd9a37ab3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx10, msx_pal ) - // AY8910 - // FDC: None, 0 drives - // 1 Cartridge slot, 1 Toshiba Expension slot - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - //MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) // Expansion slot - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-10D */ - -ROM_START (hx10d) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hx10dbios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx10d, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-10DP */ - -ROM_START (hx10dp) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hx10dpbios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx10dp, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-10E */ - -ROM_START (hx10e) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hx10ebios.rom", 0x0000, 0x8000, CRC(5486b711) SHA1(4dad9de7c28b452351cc12910849b51bd9a37ab3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx10e, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-10F */ - -ROM_START (hx10f) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hx10fbios.rom", 0x0000, 0x8000, CRC(e0e894b7) SHA1(d99eebded5db5fce1e072d08e642c0909bc7efdd)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx10f, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-10S */ - -ROM_START (hx10s) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hx10sbios.rom", 0x0000, 0x8000, CRC(5486b711) SHA1(4dad9de7c28b452351cc12910849b51bd9a37ab3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx10s, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) /* 16KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-10SA */ - -ROM_START (hx10sa) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("hx10sabios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx10sa, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-20 */ - -ROM_START (hx20) - ROM_REGION (0x10000, "maincpu",0) - ROM_LOAD ("hx20bios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) - ROM_LOAD ("hx20word.rom", 0x8000, 0x8000, CRC(39b3e1c0) SHA1(9f7cfa932bd7dfd0d9ecaadc51655fb557c2e125)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx20, msx_tms9129 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // T6950 - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-20I */ - -ROM_START (hx20i) - ROM_REGION (0x10000, "maincpu",0) - ROM_LOAD ("hx20ibios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) - ROM_LOAD ("hx20iword.rom", 0x8000, 0x8000, CRC(39b3e1c0) SHA1(9f7cfa932bd7dfd0d9ecaadc51655fb557c2e125)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx20i, msx_tms9129 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // T6950 VDP instead of TMS9928A - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-21 */ - -ROM_START (hx21) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("hx21bios.rom", 0x0000, 0x8000, CRC(83ba6fde) SHA1(01600d06d83072d4e757b29728555efde2c79705)) - ROM_LOAD ("hx21word.rom", 0x8000, 0x8000, CRC(87508e78) SHA1(4e2ec9c0294a18a3ab463f182f9333d2af68cdca)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("hx21kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx21, msx_tms9928 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-21I */ - -ROM_START (hx21i) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("hx21ibios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) - ROM_LOAD ("hx21iword.rom", 0x8000, 0x8000, CRC(f9e29c66) SHA1(3289336b2c12161fd926a7e5ce865770ae7038af)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx21i, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-22 */ - -ROM_START (hx22) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("hx22bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) - ROM_LOAD ("hx22word.rom", 0x8000, 0x8000, CRC(87508e78) SHA1(4e2ec9c0294a18a3ab463f182f9333d2af68cdca)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("hx22kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx22, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // RS232C builtin? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Toshiba HX-22I */ - -ROM_START (hx22i) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("hx22ibios.rom", 0x0000, 0x8000, CRC(8205795e) SHA1(829c00c3114f25b3dae5157c0a238b52a3ac37db)) - ROM_LOAD ("hx22iword.rom", 0x8000, 0x8000, CRC(f9e29c66) SHA1(3289336b2c12161fd926a7e5ce865770ae7038af)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx22i, msx_tms9929 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - // RS232C builtin? - // Z80: LH0080A - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Victor HC-5 */ - -ROM_START (hc5) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("hc5bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hc5, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives, - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1) // 16KB or 32KB RAM ? - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Victor HC-6 */ - -ROM_START (hc6) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("hc6bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hc6, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives, - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 2, 2) // 32KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Victor HC-7 */ - -ROM_START (hc7) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("hc7bios.rom", 0x0000, 0x8000, CRC(ee229390) SHA1(302afb5d8be26c758309ca3df611ae69cced2821)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hc7, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives, - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) // 64KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha CX5F (with SFG01) */ - -ROM_START (cx5f1) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("cx5fbios.rom", 0x0000, 0x8000, CRC(dc662057) SHA1(36d77d357a5fd15af2ab266ee66e5091ba4770a3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cx5f1, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 1 Cartridge slot? - // 1 Yamaha expansion slot? - // S-5327 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) // 32KB RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 2, 0, "sfg01") - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha CX5F (with SFG05) */ - -ROM_START (cx5f) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("cx5fbios.rom", 0x0000, 0x8000, CRC(dc662057) SHA1(36d77d357a5fd15af2ab266ee66e5091ba4770a3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cx5f, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 1 Cartridge slot? - // 1 Yamaha expansion slot? - // S-5327 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 0, "sfg05") - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) // 32KB RAM - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha CX5M / Yamaha CX5M-2 */ - -ROM_START (cx5m) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("cx5mbios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cx5m, msx_tms9929 ) - // YM2149 - // FDC: None, 0 drives - // 2 Cartridge slots - // 1 Expansion slot (60 pins interface instead of regular 50 pin cartridge interface) - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 0, "sfg01") - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha CX5M-128 */ - -ROM_START (cx5m128) - ROM_REGION (0x18000, "maincpu",0) - ROM_LOAD ("cx5m128bios.rom", 0x0000, 0x8000, CRC(507b2caa) SHA1(0dde59e8d98fa524961cd37b0e100dbfb42cf576)) - ROM_LOAD ("cx5m128ext.rom", 0x8000, 0x4000, CRC(feada82e) SHA1(48b0c2ff1f1e407cc44394219f7b3878efaa919f)) - ROM_LOAD ("yrm502.rom", 0x14000, 0x4000, CRC(5330fe21) SHA1(7b1798561ee1844a7d6432924fbee9b4fc591c19)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cx5m128, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("yrm", 3, 1, 1, 1, "maincpu", 0x14000) /* YRM-502 */ - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha CX5MII */ - -ROM_START (cx5m2) - ROM_REGION (0x14000, "maincpu",0) - ROM_LOAD ("cx5m2bios.rom", 0x0000, 0x8000, CRC(507b2caa) SHA1(0dde59e8d98fa524961cd37b0e100dbfb42cf576)) - ROM_LOAD ("cx5m2ext.rom", 0x8000, 0x4000, CRC(feada82e) SHA1(48b0c2ff1f1e407cc44394219f7b3878efaa919f)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cx5m2, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha YIS303 */ - -ROM_START (yis303) - ROM_REGION (0x14000, "maincpu",0) - ROM_LOAD ("yis303bios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) - ROM_FILL( 0x8000, 0xc000, 0xff ) -ROM_END - -static MACHINE_CONFIG_DERIVED( yis303, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("fillff", 3, 0, 0, 3, "maincpu", 0x0000) /* Fill FF */ - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 3, 1) /* 16KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha YIS503 */ - -ROM_START (yis503) - ROM_REGION (0x14000, "maincpu",0) - ROM_LOAD ("yis503bios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) - ROM_FILL( 0x8000, 0xc000, 0xff ) -ROM_END - -static MACHINE_CONFIG_DERIVED( yis503, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("fillff", 3, 0, 0, 3, "maincpu", 0x0000) /* Fill FF */ - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha YIS503F */ - -ROM_START (yis503f) - ROM_REGION (0x8000, "maincpu", 0) - ROM_LOAD ("yis503f.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( yis503f, msx_pal ) - // YM2149 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB?? RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha YIS503II */ - -ROM_START (yis503ii) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("yis503iibios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( yis503ii, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha YIS503IIR Russian */ - -ROM_START (y503iir) - ROM_REGION (0x10000, "maincpu",0) - ROM_LOAD ("yis503iirbios.rom", 0x0000, 0x8000, CRC(225a4f9e) SHA1(5173ac403e26c462f904f85c9ef5e7b1e19253e7)) - ROM_LOAD ("yis503iirdisk.rom", 0x8000, 0x4000, CRC(9eb7e24d) SHA1(3a481c7b7e4f0406a55952bc5b9f8cf9d699376c)) - ROM_LOAD ("yis503iirnet.rom", 0xc000, 0x2000, CRC(0731db3f) SHA1(264fbb2de69fdb03f87dc5413428f6aa19511a7f)) -ROM_END - -static MACHINE_CONFIG_DERIVED( y503iir, msx_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793/mb8877?, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - // RTC - // V9938 VDP - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) /* National disk */ - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_ROM("net", 3, 3, 1, 1, "maincpu", 0xc000) /* Net */ - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha YIS503IIR Estonian */ - -ROM_START (y503iir2) - ROM_REGION (0x10000, "maincpu",0) - ROM_LOAD ("yis503ii2bios.rom", 0x0000, 0x8000, CRC(1548cee3) SHA1(42c7fff25b1bd90776ac0aea971241aedce8947d)) - ROM_LOAD ("yis503iirdisk.rom", 0x8000, 0x4000, CRC(9eb7e24d) SHA1(3a481c7b7e4f0406a55952bc5b9f8cf9d699376c)) - ROM_LOAD ("yis503iirnet.rom", 0xc000, 0x2000, CRC(0731db3f) SHA1(264fbb2de69fdb03f87dc5413428f6aa19511a7f)) -ROM_END - -static MACHINE_CONFIG_DERIVED( y503iir2, msx_pal ) - // AY8910/YM2149? - // FDC: wd2793/mb8877?, 1 3.5" DSDD drive? - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x8000) /* National disk */ - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_ROM("net", 3, 3, 1, 1, "maincpu", 0xc000) /* Net */ - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx1_floplist ) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yamaha YIS503M */ - -ROM_START (yis503m) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("yis503mbios.rom", 0x0000, 0x8000, CRC(e2242b53) SHA1(706dd67036baeec7127e4ccd8c8db8f6ce7d0e4c)) -ROM_END - -static MACHINE_CONFIG_DERIVED( yis503m, msx_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 0, "sfg05") - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 2, 2) /* 32KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yashica YC-64 */ - -ROM_START (yc64) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("yc64bios.rom", 0x0000, 0x8000, CRC(e9ccd789) SHA1(8963fc041975f31dc2ab1019cfdd4967999de53e)) -ROM_END - -static MACHINE_CONFIG_DERIVED( yc64, msx_pal ) - // YM2149 - // FDC: None, 0 drives - // 1 Cartridge slot (slot 1) - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - -/* MSX - Yeno MX64 */ - -ROM_START (mx64) - ROM_REGION (0x8000, "maincpu",0) - ROM_LOAD ("mx64bios.rom", 0x0000, 0x8000, CRC(e0e894b7) SHA1(d99eebded5db5fce1e072d08e642c0909bc7efdd)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mx64, msx_ntsc ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx1_cartlist ) -MACHINE_CONFIG_END - - -/******************************** MSX 2 **********************************/ - -/* MSX2 - Al Alamiah AX-350 */ - -ROM_START (ax350) - ROM_REGION (0x30000, "maincpu", 0) - ROM_LOAD ("ax350bios.rom", 0x00000, 0x8000, CRC(ea306155) SHA1(35195ab67c289a0b470883464df66bc6ea5b00d3)) - ROM_LOAD ("ax350ext.rom", 0x08000, 0x4000, CRC(7c7540b7) SHA1(ebb76f9061e875365023523607db610f2eda1d26)) - ROM_LOAD ("ax350arab.rom", 0x0c000, 0x8000, CRC(c0d8fc85) SHA1(2c9600c6e0025fee10d249e97448ecaa37e38c42)) - ROM_LOAD ("ax350swp.rom", 0x14000, 0x8000, CRC(076f40fc) SHA1(4b4508131dca6d811694ae6379f41364c477de58)) - ROM_LOAD ("ax350paint.rom",0x1c000, 0x10000, CRC(18956e3a) SHA1(ace202e87337fbc54fea21e22c0b3af0abe6f4ae)) - ROM_LOAD ("ax350disk.rom", 0x2c000, 0x4000, CRC(1e7d6512) SHA1(78cd7f847e77fd8cd51a647efb2725ba93f4c471)) -ROM_END - -static MACHINE_CONFIG_DERIVED( ax350, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793/tc8566af?, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) /* Bios */ - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) /* Ext */ - MCFG_MSX_LAYOUT_ROM("arab", 0, 1, 1, 2, "maincpu", 0xc000) /* Arab */ - MCFG_MSX_LAYOUT_ROM("swp", 0, 2, 1, 2, "maincpu", 0x14000) /* SWP */ - MCFG_MSX_LAYOUT_ROM("paint", 0, 3, 0, 4, "maincpu", 0x1c000) /* Paint */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 1, 1, 1, "maincpu", 0x2c000) /* Disk */ - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Al Alamiah AX-370 */ - -ROM_START (ax370) - ROM_REGION (0x30000, "maincpu", 0) - ROM_LOAD ("ax370bios.rom", 0x0000, 0x8000, CRC(ea306155) SHA1(35195ab67c289a0b470883464df66bc6ea5b00d3)) - ROM_LOAD ("ax370ext.rom", 0x8000, 0x4000, CRC(7c7540b7) SHA1(ebb76f9061e875365023523607db610f2eda1d26)) - ROM_LOAD ("ax370arab.rom", 0xc000, 0x8000, CRC(c0d8fc85) SHA1(2c9600c6e0025fee10d249e97448ecaa37e38c42)) - ROM_LOAD ("ax370swp.rom", 0x14000, 0x8000, CRC(076f40fc) SHA1(4b4508131dca6d811694ae6379f41364c477de58)) - ROM_LOAD ("ax370paint.rom",0x1c000, 0x10000, CRC(18956e3a) SHA1(ace202e87337fbc54fea21e22c0b3af0abe6f4ae)) - ROM_LOAD ("ax370disk.rom", 0x2c000, 0x4000, CRC(60f8baba) SHA1(95de8809d2758fc0a743390ea5085b602e59e101)) -ROM_END - -static MACHINE_CONFIG_DERIVED( ax370, msx2_pal ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) /* Bios */ - MCFG_MSX_LAYOUT_ROM("swp", 0, 2, 1, 2, "maincpu", 0x14000) /* SWP */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) /* Ext */ - MCFG_MSX_LAYOUT_ROM("arab", 3, 1, 1, 2, "maincpu", 0xc000) /* Arab */ - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0x2c000) - MCFG_MSX_LAYOUT_ROM("paint", 3, 3, 0, 4, "maincpu", 0x1c000) /* Paint */ - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Canon V-25 */ - -ROM_START (canonv25) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("v25bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("v25ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) -ROM_END - -static MACHINE_CONFIG_DERIVED( canonv25, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - // 64KB VRAM - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) // BIOS - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) // EXT - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) // 64KB Mapper RAM - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_64kb_vram ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Canon V-30 */ - -ROM_START (canonv30) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("v30bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("v30ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("v30disk.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) -ROM_END - -static MACHINE_CONFIG_DERIVED( canonv30, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: ??, 2 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) // BIOS - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) // EXT - MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) // DISK - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) // 64KB?? Mapper RAM - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Canon V-30F */ - -ROM_START (canonv30f) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("v30fbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("v30fext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("v30fdisk.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) -ROM_END - -static MACHINE_CONFIG_DERIVED( canonv30f, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: ??, 2 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) // BIOS - MCFG_MSX_LAYOUT_CARTRIDGE("cartridge1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartridge2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) // EXT - MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) // DISK - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Daewoo CPC-300 */ - -ROM_START (cpc300) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("300bios.rom", 0x0000, 0x8000, CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) - ROM_LOAD ("300ext.rom", 0x8000, 0x8000, CRC(d64da39c) SHA1(fb51c505adfbc174df94289fa894ef969f5357bc)) - ROM_LOAD ("300han.rom", 0x10000, 0x8000, CRC(e78cd87f) SHA1(47a9d9a24e4fc6f9467c6e7d61a02d45f5a753ef)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc300, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Daewoo CPC-300E */ - -// These roms apparently came from a hacked set, see: http://www.vik.cc/bluemsx/blueforum/viewtopic.php?t=1569&start=75 -ROM_START (cpc300e) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("300ebios.rom", 0x0000, 0x8000, BAD_DUMP CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) - ROM_LOAD ("300eext.rom", 0x8000, 0x8000, BAD_DUMP CRC(d64da39c) SHA1(fb51c505adfbc174df94289fa894ef969f5357bc)) - ROM_LOAD ("300ehan.rom", 0x10000, 0x4000, BAD_DUMP CRC(5afea78d) SHA1(f08c91f8c78d681e1f02eaaaaafb87ad81112b60)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc300e, msx2 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - // No clockchip - // No joystick port?? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Daewoo CPC-330K */ - -ROM_START (cpc330k) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("330kbios.rom", 0x0000, 0x8000, CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) - ROM_LOAD ("330kext.rom", 0x8000, 0x8000, CRC(5d685cca) SHA1(97afbadd8fe34ab658cce8222a27cdbe19bcef39)) - ROM_LOAD ("330khan.rom", 0x10000, 0x4000, CRC(3d6dd335) SHA1(d2b058989a700ca772b9591f42c01ed0f45f74d6)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc330k, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - // Ergonomic keyboard, 2 builtin game controllers - // builtin FM?? builtin SCC?? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Daewoo CPC-400 */ - -ROM_START (cpc400) - ROM_REGION (0x1c000, "maincpu", 0) - ROM_LOAD ("400bios.rom", 0x0000, 0x8000, CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) - ROM_LOAD ("400disk.rom", 0x8000, 0x4000, CRC(5fa517df) SHA1(914f6ccb25d78621186001f2f5e2aaa2d628cd0c)) - ROM_LOAD ("400ext.rom", 0xc000, 0x8000, CRC(2ba104a3) SHA1(b6d3649a6647fa9f6bd61efc317485a20901128f)) - ROM_LOAD ("400han.rom", 0x14000, 0x8000, CRC(a8ead5e3) SHA1(87936f808423dddfd00629056d6807b4be1dc63e)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("400kfn.rom", 0, 0x20000, CRC(b663c605) SHA1(965f4982790f1817bcbabbb38c8777183b231a55)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc400, msx2 ) - // AY8910/YM2149? - // FDC: mb8877a, 1 3.5" DS?DD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 2, "maincpu", 0x14000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_DISK2("disk", 2, 0, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Daewoo CPC-400S */ - -ROM_START (cpc400s) - ROM_REGION (0x1c000, "maincpu", 0) - ROM_LOAD ("400sbios.rom", 0x0000, 0x8000, CRC(53850907) SHA1(affa3c5cd8db79a1450ad8a7f405a425b251653d)) - ROM_LOAD ("400sdisk.rom", 0x8000, 0x4000, CRC(5fa517df) SHA1(914f6ccb25d78621186001f2f5e2aaa2d628cd0c)) - ROM_LOAD ("400sext.rom", 0xc000, 0x8000, CRC(2ba104a3) SHA1(b6d3649a6647fa9f6bd61efc317485a20901128f)) - ROM_LOAD ("400shan.rom", 0x14000, 0x8000, CRC(975e7a31) SHA1(6a50295ea35e720ba6f4ba5616c3441128b384ed)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("400skfn.rom", 0, 0x20000, CRC(fa85368c) SHA1(30fff22e3e3d464993707488442721a5e56a9707)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc400s, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: mb8877a, 1 3.5" DS?DD drive - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("han", 0, 1, 1, 2, "maincpu", 0x14000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_DISK2("disk", 2, 0, 1, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Daewoo Zemmix CPC-61 */ - -ROM_START (cpc61) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("61bios.rom", 0x0000, 0x8000, CRC(b80c8e45) SHA1(310a02a9746bc062834e0cf2fabf7f3e0f7e829e)) - ROM_LOAD ("61ext.rom", 0x8000, 0x8000, CRC(b3d740b4) SHA1(7121c3c5ee6e4931fceda14a06f4c0e3b8eda437)) - - ROM_REGION(0x40000, "kanji", 0) - ROM_LOAD ("61kfn.rom", 0x00000, 0x40000, CRC(9a3cf67c) SHA1(22d5f4e522250dc5eb17e15b68f4a51bb752cba1)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpc61, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 1 Cartridge slot - // S-1985 MSX Engine - // No clock chip - // No keyboard, but a keyboard connector - // No printer port - // No cassette port? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x10000) // 64KB Mapper RAM? - MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Daewoo Zemmix CPG-120 Normal */ - -ROM_START (cpg120) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("cpg120bios.rom", 0x0000, 0x8000, CRC(b80c8e45) SHA1(310a02a9746bc062834e0cf2fabf7f3e0f7e829e)) - ROM_LOAD ("cpg120ext.rom", 0x8000, 0x8000, CRC(b3d740b4) SHA1(7121c3c5ee6e4931fceda14a06f4c0e3b8eda437)) - ROM_LOAD ("cpg128music.rom", 0x10000, 0x4000, CRC(73491999) SHA1(b9ee4f30a36e283a2b1b9a28a70ab9b9831570c6)) - - ROM_REGION (0x40000, "kanji", 0) - ROM_LOAD ("cpg120kfn.rom", 0x0000, 0x40000, CRC(9a3cf67c) SHA1(22d5f4e522250dc5eb17e15b68f4a51bb752cba1)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cpg120, msx2 ) - // YM2149 (in S1985) - // FDC: None, 0 drives - // 2 Cartridge slots? - // S-1985 MSX Engine - // V9958 VDP - // FM built in - // No keyboard, bot a keyboard connector? - // No clock chip - // No printer port - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x20000) // 128KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("ext", 0, 3, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_MUSIC("mus", 2, 0, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Daewoo Zemmic CPG-120 Turbo */ -/* Same as normal CPG-120 but with CPU running at 5.369317 MHz */ - -/* MSX2 - Fenner FPC-900 */ - -ROM_START (fpc900) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("fpc900bios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("fpc900ext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) - ROM_LOAD ("fpc900disk.rom", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fpc900, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: WD2793?, 1 3.5" DSDD drive - // 2? Cartridge slots - // S-3527 MSX Engine - // 256KB?? VRAM - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x40000) // 256KB? Mapper RAM - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Gradiente Expert 2.0 */ - -ROM_START (expert20) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("exp20bios.rom", 0x0000, 0x8000, CRC(6bacdce4) SHA1(9c43106dba3ae2829e9a11dffa9d000ed6d6454c)) - ROM_LOAD ("exp20ext.rom", 0x8000, 0x4000, CRC(08ced880) SHA1(4f2a7e0172f0214f025f23845f6e053d0ffd28e8)) - ROM_LOAD ("xbasic2.rom", 0xc000, 0x4000, CRC(2825b1a0) SHA1(47370bec7ca1f0615a54eda548b07fbc0c7ef398)) - ROM_LOAD ("microsoldisk.rom", 0x10000, 0x4000, CRC(6704ef81) SHA1(a3028515ed829e900cc8deb403e17b09a38bf9b0)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expert20, msx2_pal ) - // AY8910/YM2149? - // FDC: microsol, 1? 3.5"? DS?DD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) /* EXT */ - MCFG_MSX_LAYOUT_ROM("xbasic", 1, 1, 1, 1, "maincpu", 0xc000) /* XBASIC */ - MCFG_MSX_LAYOUT_DISK5("disk", 1, 3, 1, 1, "maincpu", 0x10000) /* Microsol controller */ - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx_microsol ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Hitachi MB-H70 */ - -ROM_START (mbh70) - ROM_REGION (0x110000, "maincpu", 0) - ROM_LOAD ("mbh70bios.rom" , 0x0000, 0x8000, CRC(a27c563d) SHA1(c1e46c00f1e38fc9e0ab487bf0513bd93ce61f3f)) - ROM_LOAD ("mbh70ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("mbh70disk.rom", 0xc000, 0x4000, CRC(05661a3f) SHA1(e695fc0c917577a3183901a08ca9e5f9c60b8317)) - ROM_LOAD ("mbh70halnote.rom", 0x10000, 0x100000, CRC(40313fec) SHA1(1af617bfd11b10a71936c606174a80019762ea71)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("mbh70kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mbh70, msx2 ) - // YM2149 (in S-1985) - // FDC: WD2793?, 1? 3.5" DSDD drive - // S-1985 MSX Engine - // 2? Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_SONY08("firm", 0, 3, 0, 4, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Kawai KMC-5000 */ - -ROM_START (kmc5000) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("kmc5000bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("kmc5000ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("kmc5000disk.rom", 0xc000, 0x4000, CRC(e25cacca) SHA1(607cfca605eaf82e3efa33459d6583efb7ecc13b)) - ROM_LOAD ("kmc5000kdr.rom", 0x10000, 0x8000, CRC(2dbea5ec) SHA1(ea35cc2cad9cfdf56cae224d8ee41579de37f000)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("kmc5000kfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( kmc5000, msx2 ) - // YM2149 (in S-1985) - // FDC: TC8566AF?, 1? 3.5" DSDD drive - // S-1985 MSX Engine - // 2? Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Mitsubishi ML-G1 */ - -ROM_START (mlg1) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("mlg1bios.rom", 0x0000, 0x8000, CRC(0cc7f817) SHA1(e4fdf518a8b9c8ab4290c21b83be2c347965fc24)) - ROM_LOAD ("mlg1ext.rom", 0x8000, 0x4000, CRC(dc0951bd) SHA1(1e9a955943aeea9b1807ddf1250ba6436d8dd276)) - ROM_LOAD ("mlg1paint.rom", 0xc000, 0x8000, CRC(64df1750) SHA1(5cf0abca6dbcf940bc33c433ecb4e4ada02fbfe6)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlg1, msx2_pal ) - // YM2149 (in S-1985) - // FDC: None, 0 drives - // S-1985 MSX Engine - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 64KB or 128KB Mapper RAM ? - MCFG_MSX_LAYOUT_ROM("paint", 3, 3, 0, 2, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Mitsubishi ML-G3 */ - -ROM_START (mlg3) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("mlg3bios.rom", 0x0000, 0x8000, CRC(0cc7f817) SHA1(e4fdf518a8b9c8ab4290c21b83be2c347965fc24)) - ROM_LOAD ("mlg3ext.rom", 0x8000, 0x4000, CRC(dc0951bd) SHA1(1e9a955943aeea9b1807ddf1250ba6436d8dd276)) - ROM_LOAD ("mlg3disk.rom", 0xc000, 0x4000, CRC(b94ebc7a) SHA1(30ba1144c872a0bb1c91768e75a2c28ab1f4e3c6)) - ROM_LOAD ("mlg3rs232c.rom", 0x10000, 0x4000, CRC(90b8a114) SHA1(dc50f2c9db233e505b0981c244ff3de553ac9d68)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlg3, msx2_pal ) - // YM2149 (in S-1985) - // FDC: wd2793?, 1 3.5" DSDD drive - // S-1985 MSX Engine - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 64KB or 128KB Mapper RAM? - //MCFG_MSX_LAYOUT_ROM("rs232c", 3, 3, 1, 1, "maincpu", 0x10000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Mitsubishi ML-G10 */ - -ROM_START (mlg10) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("mlg10bios.rom", 0x0000, 0x8000, CRC(a27c563d) SHA1(c1e46c00f1e38fc9e0ab487bf0513bd93ce61f3f)) - ROM_LOAD ("mlg10ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("mlg10kfn.rom", 0, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlg10, msx2 ) - // YM2149 (in S-1985) - // FDC: None, 0 drives - // S-1985 MSX Engine - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 64KB or 128KB Mapper RAM? - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Mitsubishi ML-G30 Model 1/Model 2 */ - -ROM_START (mlg30) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("g30bios.rom", 0x0000, 0x8000, CRC(a27c563d) SHA1(c1e46c00f1e38fc9e0ab487bf0513bd93ce61f3f)) - ROM_LOAD ("g30ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("g30disk.rom", 0xc000, 0x4000, CRC(05661a3f) SHA1(e695fc0c917577a3183901a08ca9e5f9c60b8317)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("g30kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mlg30, msx2 ) - // AY8910/YM2149? - // FDC: wd2793/tc8566af?, 1 or 2? 3.5" DSDD drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) /* Slot 2 subslot 0 */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - National FS-4500 */ - -ROM_START (fs4500) - ROM_REGION (0x40000, "maincpu",0) - ROM_LOAD ("4500bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("4500ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("4500font.rom", 0xc000, 0x4000, CRC(4bd54f95) SHA1(3ce8e35790eb4689b21e14c7ecdd4b63943ee158)) - ROM_LOAD ("4500buns.rom", 0x10000, 0x8000, CRC(c9398e11) SHA1(e89ea1e8e583392e2dd9debb8a4b6a162f58ba91)) - ROM_LOAD ("4500jush.rom", 0x18000, 0x8000, CRC(4debfd2d) SHA1(6442c1c5cece64c6dae90cc6ae3675f070d93e06)) - ROM_LOAD ("4500wor1.rom", 0x20000, 0xc000, CRC(0c8b5cfb) SHA1(3f047469b62d93904005a0ea29092e892724ce0b)) - ROM_LOAD ("4500wor2.rom", 0x2c000, 0xc000, CRC(d9909451) SHA1(4c8ea05c09b40c41888fa18db065575a317fda16)) - ROM_LOAD ("4500kdr1.rom", 0x38000, 0x4000, CRC(f8c7f0db) SHA1(df07e89fa0b1c7874f9cdf184c136f964fea4ff4)) - ROM_LOAD ("4500kdr2.rom", 0x3c000, 0x4000, CRC(69e87c31) SHA1(c63db26660da96af56f8a7d3ea18544b9ae5a37c)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("4500kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) - - /* Matsushita Bunsetsu Henkan ROM must be emulated */ - ROM_REGION(0x20000, "bunsetsu", 0) - ROM_LOAD ("4500budi.rom", 0, 0x20000, CRC(f94590f8) SHA1(1ebb06062428fcdc66808a03761818db2bba3c73)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs4500, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - // Matsushita switched device - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("font", 0, 2, 0, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_BUNSETSU("buns", 0, 2, 1, 2, "maincpu", 0x10000, "bunsetsu") - MCFG_MSX_LAYOUT_ROM("jush", 0, 3, 1, 2, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("wor1", 3, 0, 0, 3, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_ROM("kdr1", 3, 0, 3, 1, "maincpu", 0x38000) - MCFG_MSX_LAYOUT_ROM("wor2", 3, 1, 0, 3, "maincpu", 0x2c000) - MCFG_MSX_LAYOUT_ROM("kdr2", 3, 1, 3, 1, "maincpu", 0x3c000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - National FS-4600 */ - -ROM_START (fs4600) - ROM_REGION (0x120000, "maincpu",0) - ROM_LOAD ("4600bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("4600ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("4600disk.rom", 0xc000, 0x4000, CRC(ae4e65b7) SHA1(073feb8bb645d935e099afaf61e6f04f52adee42)) - ROM_LOAD ("4600fon1.rom", 0x10000, 0x4000, CRC(7391389b) SHA1(31292b9ca9fe7d1d8833530f44c0a5671bfefe4e)) - ROM_LOAD ("4600fon2.rom", 0x14000, 0x4000, CRC(c3a6b445) SHA1(02155fc25c9bd23e1654fe81c74486351e1ecc28)) - ROM_LOAD ("4600kdr.rom", 0x18000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) - ROM_LOAD ("4600firm.rom", 0x20000, 0x100000, CRC(1df57472) SHA1(005794c10a4237de3907ba4a44d436078d3c06c2)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("4600kfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) - - /* Matsushita 12 dots Kanji ROM must be emulated */ - ROM_REGION(0x20000, "kanji12", 0) - ROM_LOAD ("4600kf12.rom", 0, 0x20000, CRC(340d1ef7) SHA1(a7a23dc01314e88381eee88b4878b39931ab4818)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs4600, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: mb8877a, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("fon1", 0, 2, 0, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_ROM("kdr", 0, 2, 1, 2, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_ROM("fon2", 0, 3, 0, 1, "maincpu", 0x14000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_FS4600("firm", 3, 1, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - National FS-4700 */ - -ROM_START (fs4700) - ROM_REGION (0x44000, "maincpu",0) - ROM_LOAD ("4700bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("4700ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("4700disk.rom", 0xc000, 0x4000, CRC(1e7d6512) SHA1(78cd7f847e77fd8cd51a647efb2725ba93f4c471)) - ROM_LOAD ("4700font.rom", 0x10000, 0x4000, CRC(4bd54f95) SHA1(3ce8e35790eb4689b21e14c7ecdd4b63943ee158)) - ROM_LOAD ("4700buns.rom", 0x14000, 0x8000, CRC(c9398e11) SHA1(e89ea1e8e583392e2dd9debb8a4b6a162f58ba91)) - ROM_LOAD ("4700jush.rom", 0x1c000, 0x8000, CRC(4debfd2d) SHA1(6442c1c5cece64c6dae90cc6ae3675f070d93e06)) - ROM_LOAD ("4700wor1.rom", 0x24000, 0xc000, CRC(5f39a727) SHA1(f5af1d2a8bcf247f78847e1a9d995e581df87e8e)) - ROM_LOAD ("4700wor2.rom", 0x30000, 0xc000, CRC(d9909451) SHA1(4c8ea05c09b40c41888fa18db065575a317fda16)) - ROM_LOAD ("4700kdr1.rom", 0x3c000, 0x4000, CRC(f8c7f0db) SHA1(df07e89fa0b1c7874f9cdf184c136f964fea4ff4)) - ROM_LOAD ("4700kdr2.rom", 0x40000, 0x4000, CRC(69e87c31) SHA1(c63db26660da96af56f8a7d3ea18544b9ae5a37c)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("4700kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) - - /* Matsushita Bunsetsu Henkan ROM must be emulated */ - ROM_REGION(0x20000, "bunsetsu", 0) - ROM_LOAD ("4700budi.rom", 0, 0x20000, CRC(f94590f8) SHA1(1ebb06062428fcdc66808a03761818db2bba3c73)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs4700, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: mb8877a, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - // Matsushita switched device - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("font", 0, 2, 0, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_BUNSETSU("buns", 0, 2, 1, 2, "maincpu", 0x14000, "bunsetsu") - MCFG_MSX_LAYOUT_ROM("jush", 0, 3, 1, 2, "maincpu", 0x1c000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("wor1", 3, 0, 0, 3, "maincpu", 0x24000) - MCFG_MSX_LAYOUT_ROM("kdr1", 3, 0, 3, 1, "maincpu", 0x3c000) - MCFG_MSX_LAYOUT_ROM("wor2", 3, 1, 0, 3, "maincpu", 0x30000) - MCFG_MSX_LAYOUT_ROM("kdr2", 3, 1, 3, 1, "maincpu", 0x40000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - National FS-5000 */ - -ROM_START (fs5000) - ROM_REGION (0x30000, "maincpu",0) - ROM_LOAD ("5000bios.rom", 0x0000, 0x8000, CRC(a44ea707) SHA1(59967765d6e9328909dee4dac1cbe4cf9d47d315)) - ROM_LOAD ("5000ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("5000disk.rom", 0xc000, 0x4000, CRC(ae4e65b7) SHA1(073feb8bb645d935e099afaf61e6f04f52adee42)) - ROM_LOAD ("5000rtc.rom", 0x10000, 0x8000, CRC(03351598) SHA1(98bbfa3ab07b7a5cad55d7ddf7cbd9440caa2a86)) - ROM_LOAD ("5000kdr.rom", 0x18000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) - ROM_FILL (0x20000, 0x10000, 0xff) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("5000kfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs5000, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: wd2793, 2 3.5" DSDD drives - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("empty1", 0, 1, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_ROM("empty2", 0, 2, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_ROM("empty3", 0, 3, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 0, 1, 2, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_ROM("rtcrom", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - National FS-5500F2*/ -/* The National FS-5500 had two versions: */ -/* F1 has 1 floppy drive */ -/* F2 has 2 floppy drives */ - -ROM_START (fs5500f1) - ROM_REGION (0x30000, "maincpu",0) - ROM_LOAD ("5500bios.rom", 0x0000, 0x8000, CRC(5bf38e13) SHA1(44e0dd215b2a9f0770dd76fb49187c05b083eed9)) - ROM_LOAD ("5500ext.rom", 0x8000, 0x4000, CRC(3c42c367) SHA1(4be8371f3b03e70ddaca495958345f3c4f8e2d36)) - ROM_LOAD ("5500disk.rom", 0xc000, 0x4000, CRC(1e7d6512) SHA1(78cd7f847e77fd8cd51a647efb2725ba93f4c471)) - ROM_LOAD ("5500imp.rom", 0x10000, 0x8000, CRC(6173a88c) SHA1(b677a861b67e8763a11d5dcf52416b42493ade57)) - ROM_LOAD ("5500kdr.rom", 0x18000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) - ROM_FILL (0x20000, 0x10000, 0xff) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("5500kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs5500f1, msx2 ) - // YM2149 in (S-1985 MSX Engine) - // FDC: mb8877a, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - // Matsushita switched device - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("empty1", 0, 1, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_ROM("empty2", 0, 2, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_ROM("empty3", 0, 3, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 0, 1, 2, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_ROM("imp", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - National FS-5500F2*/ -/* The National FS-5500 had two versions: */ -/* F1 has 1 floppy drive */ -/* F2 has 2 floppy drives */ - -ROM_START (fs5500f2) - ROM_REGION (0x30000, "maincpu",0) - ROM_LOAD ("5500bios.rom", 0x0000, 0x8000, CRC(5bf38e13) SHA1(44e0dd215b2a9f0770dd76fb49187c05b083eed9)) - ROM_LOAD ("5500ext.rom", 0x8000, 0x4000, CRC(3c42c367) SHA1(4be8371f3b03e70ddaca495958345f3c4f8e2d36)) - ROM_LOAD ("5500disk.rom", 0xc000, 0x4000, CRC(1e7d6512) SHA1(78cd7f847e77fd8cd51a647efb2725ba93f4c471)) - ROM_LOAD ("5500imp.rom", 0x10000, 0x8000, CRC(6173a88c) SHA1(b677a861b67e8763a11d5dcf52416b42493ade57)) - ROM_LOAD ("5500kdr.rom", 0x18000, 0x8000, CRC(b2db6bf5) SHA1(3a9a942ed888dd641cddf8deada1879c454df3c6)) - ROM_FILL (0x20000, 0x10000, 0xff) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("5500kfn.rom", 0, 0x20000, CRC(956dc96d) SHA1(9ed3ab6d893632b9246e91b412cd5db519e7586b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fs5500f2, msx2 ) - // YM2149 in (S-1985 MSX Engine) - // FDC: mb8877a, 2 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - // Matsushita switched device - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("empty1", 0, 1, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_ROM("empty2", 0, 2, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_ROM("empty3", 0, 3, 0, 4, "maincpu", 0x20000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 0, 1, 2, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_ROM("imp", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_DISK2("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Panasonic FS-A1 */ - -ROM_START (fsa1) - ROM_REGION (0x20000, "maincpu",0) - ROM_LOAD ("a1bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("a1ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("a1desk1.rom", 0x10000, 0x8000, CRC(99c48147) SHA1(63098f27beac9eca6b39d837d2a552395df33fe1)) - ROM_LOAD ("a1desk2.rom", 0x18000, 0x8000, CRC(7f6f4aa1) SHA1(7f5b76605e3d898cc4b5aacf1d7682b82fe84353)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1, msx2 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64 KB RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("desk1", 3, 2, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_ROM("desk2", 3, 3, 1, 2, "maincpu", 0x18000) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Panasonic FS-A1 (a) */ - -ROM_START (fsa1a) - ROM_REGION (0x1c000, "maincpu",0) - ROM_LOAD ("a1bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("a1ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("a1desk1a.rom", 0xc000, 0x8000, CRC(25b5b170) SHA1(d9307bfdaab1312d25e38af7c0d3a7671a9f716b)) - ROM_LOAD ("a1desk2.rom", 0x14000, 0x8000, CRC(7f6f4aa1) SHA1(7f5b76605e3d898cc4b5aacf1d7682b82fe84353)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1a, msx2 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram", 3, 0, 0, 4) /* 64KB RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("desk1", 3, 2, 1, 2, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("desk2", 3, 3, 1, 2, "maincpu", 0x14000) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Panasonic FS-A1F */ - -ROM_START (fsa1f) - ROM_REGION (0x20000, "maincpu",0) - ROM_LOAD ("a1fbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("a1fext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("a1fdisk.rom", 0xc000, 0x4000, CRC(e25cacca) SHA1(607cfca605eaf82e3efa33459d6583efb7ecc13b)) - ROM_LOAD ("a1fkdr.rom", 0x10000, 0x8000, CRC(2dbea5ec) SHA1(ea35cc2cad9cfdf56cae224d8ee41579de37f000)) - ROM_LOAD ("a1fcock.rom", 0x18000, 0x8000, CRC(5c2948cd) SHA1(4a99f2444f29c2b642efd6f084081d6fd96bfa9b)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("a1fkfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1f, msx2 ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("fkdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("fcock", 3, 3, 1, 2, "maincpu", 0x18000) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Panasonic FS-A1FM */ - -ROM_START (fsa1fm) - ROM_REGION (0x110000, "maincpu",0) - ROM_LOAD ("a1fmbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("a1fmext.rom", 0x8000, 0x4000, CRC(ad295b5d) SHA1(d552319a19814494e3016de4b8f010e8f7b97e02)) - ROM_LOAD ("a1fmdisk.rom", 0xc000, 0x4000, CRC(e25cacca) SHA1(607cfca605eaf82e3efa33459d6583efb7ecc13b)) - ROM_LOAD ("a1fmfirm.rom", 0x10000, 0x100000, CRC(8ce0ece7) SHA1(f89e3d8f3b6855c29d71d3149cc762e0f6918ad5)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("a1fmkfn.rom", 0, 0x20000, CRC(c61ddc5d) SHA1(5e872d5853698731a0ed22fb72dbcdfd59cd19c3)) - - /* Matsushita 12 dots Kanji ROM must be emulated */ - ROM_REGION(0x20000, "kanji12", 0) - ROM_LOAD ("a1fmkf12.rom", 0, 0x20000, CRC(340d1ef7) SHA1(a7a23dc01314e88381eee88b4878b39931ab4818)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1fm, msx2 ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots - // Integrated 1200baud modem - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) -/* MSX_LAYOUT_SLOT (3, 1, 1, 4, MODEM_ROM, 0x20000, 0x10000) */ /* Modem Mapper of FS-CM1/A1FM must be emulated */ - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) -/* MSX_LAYOUT_SLOT (3, 3, 0, 4, FSA1FM_ROM, 0x100000, 0x10000) */ /* Panasonic FS-A1FM Mapper must be emulated */ - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Panasonic FS-A1MK2 */ - -ROM_START (fsa1mk2) - ROM_REGION (0x20000, "maincpu",0) - ROM_LOAD ("a1mkbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("a1mk2ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("a1mkcoc1.rom", 0xc000, 0x8000, CRC(0eda3f57) SHA1(2752cd89754c05abdf7c23cba132d38e3ef0f27d)) - ROM_LOAD ("a1mkcoc2.rom", 0x14000, 0x4000, CRC(756d7128) SHA1(e194d290ebfa4595ce0349ea2fc15442508485b0)) - ROM_LOAD ("a1mkcoc3.rom", 0x18000, 0x8000, CRC(c1945676) SHA1(a3f4e2e4934074925d775afe30ac72f150ede543)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1mk2, msx2 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64 KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("coc1", 3, 1, 1, 2, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("coc2", 3, 2, 1, 1, "maincpu", 0x14000) - MCFG_MSX_LAYOUT_ROM("coc3", 3, 3, 1, 2, "maincpu", 0x18000) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8220 - 2 possible sets (/00 /16) */ - -ROM_START (nms8220) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8220bios.rom.u14", 0x0000, 0x8000, BAD_DUMP CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("8220ext.rom.u14", 0x8000, 0x4000, BAD_DUMP CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) - ROM_LOAD ("8220pen.rom.u13", 0xc000, 0x4000, CRC(3d38c53e) SHA1(cb754aed85b3e97a7d3c5894310df7ca18f89f41)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8220, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_ROM("pen", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8220 (a) */ - -ROM_START (nms8220a) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8220bios.rom.u14", 0x0000, 0x8000, BAD_DUMP CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("8220ext.rom.u14", 0x8000, 0x4000, BAD_DUMP CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) - ROM_LOAD ("8220pena.rom.u13", 0xc000, 0x4000, CRC(17817b5a) SHA1(5df95d033ae70b107697b69470126ce1b7ae9eb5)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8220a, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_ROM("pen", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8245 - 2 possible sets (/00 /16) */ -/* /00 - A16 = 0 */ -/* /16 - A16 = 1 */ -/* /19 - Azerty keyboard */ - -ROM_START (nms8245) - ROM_REGION (0x20000, "maincpu", 0) - ROM_LOAD ("nms8245.u7", 0x0000, 0x20000, BAD_DUMP CRC(0c827d5f) SHA1(064e706cb1f12b99b329944ceeedc0efc3b2d9be)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8245, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext",3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8245F */ -/* NMS-8245/19? */ - -ROM_START (nms8245f) - ROM_REGION (0x20000, "maincpu", 0) - ROM_LOAD ("nms8245.u7", 0x0000, 0x20000, BAD_DUMP CRC(0c827d5f) SHA1(064e706cb1f12b99b329944ceeedc0efc3b2d9be)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8245f, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0x1c000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8250 */ -/* Labels taken from an NMS-8250/00 */ - -ROM_START (nms8250) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("d23c256eac.ic119", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("d23128ec.ic118", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) - ROM_LOAD ("jq00014.ic117", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8250, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8250F */ - -ROM_START (nms8250f) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("nms8250fbios.rom", 0x0000, 0x8000, CRC(5cd35ced) SHA1(b034764e6a8978db60b1d652917f5e24a66a7925)) - ROM_LOAD ("nms8250fext.rom", 0x8000, 0x4000, CRC(781ba055) SHA1(fd4bcc81a8160a1dea06036c5f79d200f948f4d6)) - ROM_LOAD ("nms8250fdisk.rom", 0xc000, 0x4000, CRC(13b60725) SHA1(58ba1887e8fd21c912b6859cae6514bd874ffcca)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8250f, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8250J */ - -ROM_START (nms8250j) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8250jbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("8250jext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("8250jdisk.rom", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("8250jkfn.rom", 0x00000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8250j, msx2 ) - // AY8910/YM2149? - // FDC: wd2793?, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8255 */ - -ROM_START (nms8255) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8255bios.rom.ic119", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("8255ext.rom.ic118", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) - ROM_LOAD ("8255disk.rom.ic117", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8255, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 2 3.5" DSDD drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8255F */ - -ROM_START (nms8255f) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("nms8255fbios.rom", 0x0000, 0x8000, CRC(5cd35ced) SHA1(b034764e6a8978db60b1d652917f5e24a66a7925)) - ROM_LOAD ("nms8255fext.rom", 0x8000, 0x4000, CRC(781ba055) SHA1(fd4bcc81a8160a1dea06036c5f79d200f948f4d6)) - ROM_LOAD ("nms8255fdisk.rom", 0xc000, 0x4000, CRC(13b60725) SHA1(58ba1887e8fd21c912b6859cae6514bd874ffcca)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8255f, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 2 3.5" DSDD drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8260 */ -/* Prototype created by JVC for Philips. Based on an NMS-8250 with the floppy drive removed and replaced with a 20MB JVC harddisk */ - -ROM_START (nms8260) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("nms8260bios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("nms8260ext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) - ROM_LOAD ("nms8260disk.rom", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) - ROM_LOAD ("nms8260hdd.rom", 0x10000, 0x4000, CRC(0051afc3) SHA1(77f9fe964f6d8cb8c4af3b5fe63ce6591d5288e6)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8260, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("hdd", 2, 0, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - // There is actually only an FDC inside the real thing. With a floppy controller to attach an external floppy drive - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8270 - Not confirmed to exist yet */ - -/* MSX2 - Philips NMS-8280 - 2 possible sets (/00 /16) */ - -ROM_START (nms8280) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8280bios.rom.ic119", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("8280ext.rom.ic118", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) - ROM_LOAD ("8280disk.rom.ic117", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8280, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 2 3.5" DSDD drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8280F */ - -ROM_START (nms8280f) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8280fbios.rom", 0x0000, 0x8000, CRC(5cd35ced) SHA1(b034764e6a8978db60b1d652917f5e24a66a7925)) - ROM_LOAD ("8280fext.rom", 0x8000, 0x4000, CRC(781ba055) SHA1(fd4bcc81a8160a1dea06036c5f79d200f948f4d6)) - ROM_LOAD ("8280fdisk.rom", 0xc000, 0x4000, CRC(13b60725) SHA1(58ba1887e8fd21c912b6859cae6514bd874ffcca)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8280f, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 2 3.5" DSDD drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips NMS-8280G */ - -ROM_START (nms8280g) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8280gbios.rom.ic119", 0x0000, 0x8000, CRC(8fa060e2) SHA1(b17d9bea0eb16a1aa2d0ccbd7c9488da9f57698e)) - ROM_LOAD ("8280gext.rom.ic118", 0x8000, 0x4000, CRC(41e36d03) SHA1(4ab7b2030d022f5486abaab22aaeaf8aa23e05f3)) - ROM_LOAD ("8280gdisk.rom.ic117", 0xc000, 0x4000, CRC(d0beebb8) SHA1(d1001f93c87ff7fb389e418e33bf7bc81bdbb65f)) -ROM_END - -static MACHINE_CONFIG_DERIVED( nms8280g, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 2 3.5" DSDD drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips VG-8230 (u11 - exp, u12 - basic, u13 - disk */ - -ROM_START (vg8230) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8230bios.rom.u12", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) - ROM_LOAD ("8230ext.rom.u11", 0x8000, 0x4000, CRC(8f84f783) SHA1(3288894e1be6af705871499b23c85732dbc40993)) - ROM_LOAD ("8230disk.rom.u13", 0xc000, 0x4000, CRC(77c4e5bc) SHA1(849f93867ff7846b27f84d0be418569faf058ac2)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8230, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 3.5" SSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips VG-8230J */ - -ROM_START (vg8230j) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8230jbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("8230jext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("8230jdisk.rom", 0xc000, 0x4000, CRC(7639758a) SHA1(0f5798850d11b316a4254b222ca08cc4ad6d4da2)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("8230jkfn.rom", 0x00000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8230j, msx2 ) - // AY8910/YM2149? - // FDC: wd2793?, 1 3.5" SSDD drive? - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips VG-8235 3 psosible basic and ext roms (/00 /02 /19) */ - -ROM_START (vg8235) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8235bios.rom.u48", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("8235ext.rom.u49", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) - ROM_LOAD ("8235disk.rom.u50", 0xc000, 0x4000, CRC(51daeb25) SHA1(8954e59aa79310c7b719ecf0cde1e82fb731dcd1)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8235, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 3.5" SSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips VG-8235F */ - -ROM_START (vg8235f) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8235fbios.rom.u48", 0x0000, 0x8000, CRC(c0577a50) SHA1(3926cdd91fa89657a811463e48cfbdb350676e51)) - ROM_LOAD ("8235fext.rom.u49", 0x8000, 0x4000, CRC(e235d5c8) SHA1(792e6b2814ab783d06c7576c1e3ccd6a9bbac34a)) - ROM_LOAD ("8235fdisk.rom.u50", 0xc000, 0x4000, CRC(77c4e5bc) SHA1(849f93867ff7846b27f84d0be418569faf058ac2)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8235f, msx2_pal ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 3.5" SSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_ssdd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Philips VG-8240 */ - -ROM_START (vg8240) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("8240bios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("8240ext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) - ROM_LOAD ("8240disk.rom", 0xc000, 0x4000, CRC(ca3307d3) SHA1(c3efedda7ab947a06d9345f7b8261076fa7ceeef)) -ROM_END - -static MACHINE_CONFIG_DERIVED( vg8240, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0xf8) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 3, 1, 1, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sanyo MPC-2300 */ - -ROM_START (mpc2300) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("2300bios.rom", 0x0000, 0x8000, CRC(e7d08e29) SHA1(0f851ee7a1cf79819f61cc89e9948ee72a413802)) - ROM_LOAD ("2300ext.rom", 0x8000, 0x4000, CRC(3d7dc718) SHA1(e1f834b28c3ee7c9f79fe6fbf2b23c8a0617892b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc2300, msx2 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB?? Mapper RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sanyo MPC-2500FD */ - -ROM_START (mpc2500f) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("mpc2500fdbios.rom", 0x0000, 0x8000, CRC(e7d08e29) SHA1(0f851ee7a1cf79819f61cc89e9948ee72a413802)) - ROM_LOAD ("mpc2500fdext.rom", 0x8000, 0x4000, CRC(3d7dc718) SHA1(e1f834b28c3ee7c9f79fe6fbf2b23c8a0617892b)) - ROM_LOAD ("mpc2500fddisk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc2500f, msx2 ) - // YM2149 - // FDC: wd2793?, 1? 3.5" DSDD drive? - // 2 Cartridge slots? - // S-3527 MSX Eninge - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 2, 3, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xC000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB?? Mapper RAM */ - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sanyo Wavy MPC-25FD */ - -ROM_START (mpc25fd) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("25fdbios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("25fdext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("25fddisk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc25fd, msx2 ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793, 1 drive - // 1 Cartridge slot (slot 1) - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) - MCFG_MSX_LAYOUT_ROM("ext", 2, 3, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB?? RAM */ - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sanyo Wavy MPC-27 */ - -ROM_START (mpc27) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("mpc27bios.rom", 0x0000, 0x8000, CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) - ROM_LOAD ("mpc27ext.rom", 0x8000, 0x4000, CRC(90ca25b5) SHA1(fd9fa78bac25aa3c0792425b21d14e364cf7eea4)) - ROM_LOAD ("mpc27disk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) - ROM_LOAD ("mlp27.rom", 0x10000, 0x2000, CRC(8f9e6ba0) SHA1(c3a47480c9dd2235f40f9a53dab68e3c48adca01)) - ROM_RELOAD (0x12000, 0x2000) -ROM_END - -static MACHINE_CONFIG_DERIVED( mpc27, msx2 ) - // YM2149 (in S-3527 MSX Engine) - // FDC: wd2793?, 1 drive - // 2 Cartridge slots? - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB?? RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("lpen", 3, 3, 1, 1, "maincpu", 0x10000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sanyo Wavy PHC-23 = PHC-23J(B)*/ - -ROM_START (phc23) - ROM_REGION (0xc000, "maincpu",0) - ROM_LOAD ("23bios.rom", 0x0000, 0x8000, CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) - ROM_LOAD ("23ext.rom", 0x8000, 0x4000, CRC(90ca25b5) SHA1(fd9fa78bac25aa3c0792425b21d14e364cf7eea4)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc23, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 2, 0, 4) /* 64KB RAM */ - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sanyo Wavy PHC-55FD2 */ - -ROM_START (phc55fd2) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("phc55fd2bios.rom", 0x0000, 0x8000, CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) - ROM_LOAD ("phc55fd2ext.rom", 0x8000, 0x4000, CRC(90ca25b5) SHA1(fd9fa78bac25aa3c0792425b21d14e364cf7eea4)) - ROM_LOAD ("phc55fd2disk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc55fd2, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: wd2793?, 2 3.5" DSDD drives - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sanyo Wavy PHC-77 */ - -ROM_START (phc77) - ROM_REGION (0x90000, "maincpu", 0) - ROM_LOAD ("phc77bios.rom", 0x0000, 0x8000, CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) - ROM_LOAD ("phc77ext.rom", 0x8000, 0x4000, CRC(90ca25b5) SHA1(fd9fa78bac25aa3c0792425b21d14e364cf7eea4)) - ROM_LOAD ("phc77disk.rom", 0xc000, 0x4000, CRC(38454059) SHA1(58ac78bba29a06645ca8d6a94ef2ac68b743ad32)) - ROM_LOAD ("phc77msxwrite.rom", 0x10000, 0x80000, CRC(ef02e4f3) SHA1(4180544158a57c99162269e33e4f2c77c9fce84e)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("phc77kfn.rom", 0x0000, 0x20000, CRC(3b8fdf44) SHA1(fc71561a64f73da0e0043d256f67fd18d7fc3a7f)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc77, msx2 ) - // YM2149 (in S-1985 MSX Engine) - // FDC: wd2793?, 1 drive - // 2 Cartridge slots - // S-1985 MSX Engine - // Builtin printer - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("write", 3, 3, 1, 2, "maincpu", 0x10000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sharp Epcom HotBit 2.0 */ - -ROM_START (hotbit20) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("hb2bios.rom", 0x0000, 0x8000, CRC(0160e8c9) SHA1(d0cfc35f22b150a1cb10decae4841dfe63b78251)) - ROM_LOAD ("hb2ext.rom", 0x8000, 0x4000, CRC(08ced880) SHA1(4f2a7e0172f0214f025f23845f6e053d0ffd28e8)) - ROM_LOAD ("xbasic2.rom", 0xc000, 0x4000, CRC(2825b1a0) SHA1(47370bec7ca1f0615a54eda548b07fbc0c7ef398)) - ROM_LOAD ("microsoldisk.rom", 0x10000, 0x4000, CRC(6704ef81) SHA1(a3028515ed829e900cc8deb403e17b09a38bf9b0)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hotbit20, msx2_pal ) - // AY8910/YM2149? - // FDC: microsol, 1 or 2 drives? - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) /* EXT */ - MCFG_MSX_LAYOUT_ROM("xbasic", 1, 1, 1, 1, "maincpu", 0xc000) /* XBASIC */ - MCFG_MSX_LAYOUT_DISK5("disk", 1, 3, 1, 1, "maincpu", 0x10000) /* Microsol controller */ - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx_microsol ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F1 */ - -ROM_START (hbf1) - ROM_REGION (0x20000, "maincpu",0) - ROM_LOAD ("f1bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("f1ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("f1note1.rom", 0xc000, 0x4000, CRC(84810ea8) SHA1(9db72bb78792595a12499c821048504dc96ef848)) - ROM_LOAD ("f1note2.rom", 0x10000, 0x8000, CRC(e32e5ee0) SHA1(aa78fc9bcd2343f84cf790310a768ee47f90c841)) - ROM_LOAD ("f1note3.rom", 0x18000, 0x8000, CRC(73eb9329) SHA1(58accf41a90693874b86ce98d8d43c27beb8b6dc)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf1, msx2 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("note1", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("note2", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_ROM("note3", 3, 2, 1, 2, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_RAM("ram", 3, 3, 0, 4) /* 64KB RAM */ - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F1II */ - -ROM_START (hbf12) - ROM_REGION (0x20000, "maincpu",0) - ROM_LOAD ("f12bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("f12ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("f12note1.rom", 0xc000, 0x4000, CRC(dcacf970) SHA1(30d914cda2180889a40a3328e0a0c1327f4eaa10)) - ROM_LOAD ("f12note2.rom", 0x10000, 0x8000, CRC(b0241a61) SHA1(ed2fea5c2a3c2e58d4f69f9d636e08574486a2b1)) - ROM_LOAD ("f12note3.rom", 0x18000, 0x8000, CRC(44a10e6a) SHA1(917d1c079e03c4a44de864f123d03c4e32c8daae)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf12, msx2 ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("note1", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("note2", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_ROM("note3", 3, 2, 1, 2, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F1XD */ - -ROM_START (hbf1xd) - ROM_REGION (0x10000, "maincpu",0) - ROM_LOAD ("f1xdbios.rom.ic27", 0x0000, 0x8000, BAD_DUMP CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) - ROM_LOAD ("f1xdext.rom.ic27", 0x8000, 0x4000, BAD_DUMP CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("f1xddisk.rom.ic27", 0xc000, 0x4000, BAD_DUMP CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf1xd, msx2 ) - // YM2149 (in S-1895 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F1XDMK2 */ - -ROM_START (hbf1xdm2) - ROM_REGION (0x10000, "maincpu",0) - ROM_LOAD ("f1m2bios.rom.ic27", 0x0000, 0x8000, BAD_DUMP CRC(ba81b3dd) SHA1(4ce41fcc1a603411ec4e99556409c442078f0ecf)) - ROM_LOAD ("f1m2ext.rom.ic27", 0x8000, 0x4000, BAD_DUMP CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("f1m2disk.rom.ic27", 0xc000, 0x4000, BAD_DUMP CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf1xdm2, msx2 ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F5 */ - -ROM_START (hbf5) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("hbf5bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("hbf5ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("hbf5note.rom", 0xc000, 0x4000, CRC(0cdc0777) SHA1(06ba91d6732ee8a2ecd5dcc38b0ce42403d86708)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf5, msx2_pal ) - // YM2149 - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("note", 0, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x10000) /* 64KB?? Mapper RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F500 */ - -ROM_START (hbf500) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("f500bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("f500ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("f500disk.rom", 0xc000, 0x4000, CRC(f7f5b0ea) SHA1(e93b8da1e8dddbb3742292b0e5e58731b90e9313)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("f500kfn.rom", 0, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf500, msx2 ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM("ram2", 0, 2, 0, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F500F */ - -ROM_START (hbf500f) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("hbf500fbios.rom", 0x0000, 0x8000, CRC(440dae3c) SHA1(fedd9b682d056ddd1e9b3d281723e12f859b2e69)) - ROM_LOAD ("hbf500fext.rom", 0x8000, 0x4000, CRC(e235d5c8) SHA1(792e6b2814ab783d06c7576c1e3ccd6a9bbac34a)) - ROM_LOAD ("hbf500fdisk.rom", 0xc000, 0x4000, CRC(6e718f5c) SHA1(0e081572f84555dc13bdb0c7044a19d6c164d985)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf500f, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 3 Cartridge slots or 2 Cartridge slots and 1 expansion slot ? - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM("ram2", 0, 2, 0, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F500P */ - -ROM_START (hbf500p) - ROM_REGION (0x1c000, "maincpu", 0) - ROM_LOAD ("500pbios.rom.ic41", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) - ROM_LOAD ("500pext.ic47", 0x8000, 0x8000, CRC(cdd4824a) SHA1(505031f1e8396a6e0cb11c1540e6e7f6999d1191)) - ROM_FILL (0x10000, 0xc000, 0xFF) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf500p, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 3 Cartridge slots or 2 Cartridge slots and 1 expansion slot ? - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM("ram2", 0, 2, 0, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("empty", 3, 0, 0, 4, "maincpu", 0xc000) // Empty? or is this the 3rd cartridge/expansion slot ? - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F700D */ - -ROM_START (hbf700d) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("700dbios.rom.ic5", 0x0000, 0x8000, CRC(e975aa79) SHA1(cef16eb95502ba6ab2265fcafcedde470a101541)) - ROM_LOAD ("700dext.ic6", 0x8000, 0x8000, CRC(100cf756) SHA1(317722fa36c2ed31c07c5218b43490fd5badf1f8)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf700d, msx2_pal ) - // YM2149 (in S-1985 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x40000) /* 256KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F700F */ - -ROM_START (hbf700f) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("700fbios.ic5", 0x0000, 0x8000, CRC(440dae3c) SHA1(fedd9b682d056ddd1e9b3d281723e12f859b2e69)) - ROM_LOAD ("700fext.ic6", 0x8000, 0x8000, CRC(7c8b07b1) SHA1(ecacb20ba0a9bbd25e8c0f128d64dd66f8cd8bee)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf700f, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x40000) /* 256KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F700P */ - -ROM_START (hbf700p) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("700pbios.rom.ic5", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) - ROM_LOAD ("700pext.ic6", 0x8000, 0x8000, CRC(63e1bffc) SHA1(496698a60432490dc1306c8cc1d4a6ded275261a)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf700p, msx2_pal ) - // YM2149 (in S-1985 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x40000) /* 256KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F700S */ - -ROM_START (hbf700s) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("700sbios.rom.ic5", 0x0000, 0x8000, CRC(c2b889a5) SHA1(4811956f878c3e03da46317f787cdc4bebc86f47)) - ROM_LOAD ("700sext.ic6", 0x8000, 0x8000, CRC(28d1badf) SHA1(ae3ed88a2d7034178e08f7bdf5409f462bf67fc9)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf700s, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 3, 0x40000) /* 256KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F900 */ -ROM_START (hbf900) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("f900bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("f900ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("f900disk.rom", 0xc000, 0x4000, CRC(f83d0ea6) SHA1(fc760d1d7b16370abc7eea39955f230b95b37df6)) - ROM_LOAD ("f900util.rom", 0x10000, 0x4000, CRC(bc6c7c66) SHA1(558b7383544542cf7333700ff90c3efbf93ba2a3)) - ROM_FILL (0x14000, 0x4000, 0) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("f900kfn.rom", 0, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf900, msx2 ) - // AY8910/YM2149? - // FDC: wd2793, 2 3.5" DSDD drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 1, 0x40000) /* 256KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("empty", 3, 3, 1, 1, "maincpu", 0x14000) // Empty/unknown, optional fmpac rom used to be loaded here, or should the util rom be loaded? - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F900 (a) */ -ROM_START (hbf900a) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("f900bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("f900ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("f900disa.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) - ROM_LOAD ("f900util.rom", 0x10000, 0x4000, CRC(bc6c7c66) SHA1(558b7383544542cf7333700ff90c3efbf93ba2a3)) - ROM_FILL (0x14000, 0x4000, 0) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("f900kfn.rom", 0, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf900a, msx2 ) - // AY8910/YM2149? - // FDC: wd2793, 2 3.5" DSDD drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 1, 0x40000) /* 256KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("empty", 3, 3, 1, 1, "maincpu", 0x14000) // Empty/unknown, optional fmpac rom used to be loaded here, or should the util rom be loaded? - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F9P */ - -ROM_START (hbf9p) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("f9pbios.rom.ic11", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) - ROM_LOAD ("f9pfirm1.ic12", 0x8000, 0x8000, CRC(524f67aa) SHA1(41a186afced50ca6312cb5b6c4adb684faca6232)) - ROM_LOAD ("f9pfirm2.rom.ic13", 0x10000, 0x8000, CRC(ea97069f) SHA1(2d1880d1f5a6944fcb1b198b997a3d90ecd1903d)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf9p, msx2_pal ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("firm1", 3, 0, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("firm2", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F9P Russian */ - -ROM_START (hbf9pr) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("f9prbios.rom", 0x0000, 0x8000, CRC(39d7674a) SHA1(47642bb0a2c46a82100543dc3970d0a49fc53b69)) - ROM_LOAD ("f9prext.rom", 0x8000, 0x4000, CRC(8b966f50) SHA1(65253cb38ab11084f355a2d4ad78fa6c64cbe660)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf9pr, msx2_pal ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-F9S */ - -ROM_START (hbf9s) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("f9sbios.ic11", 0x0000, 0x8000, CRC(c2b889a5) SHA1(4811956f878c3e03da46317f787cdc4bebc86f47)) - ROM_LOAD ("f9sfirm1.ic12", 0x8000, 0x8000, CRC(cf39620b) SHA1(1166a93d7185ba024bdf2bfa9a30e1c447fb6db1)) - ROM_LOAD ("f9sfirm2.ic13", 0x10000, 0x8000, CRC(ea97069f) SHA1(2d1880d1f5a6944fcb1b198b997a3d90ecd1903d)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf9s, msx2_pal ) - // YM2149 (in S-1985 MSX Engine) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("firm1", 3, 0, 0, 2, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("firm2", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-G900AP */ - -/* IC109 - 32KB Basic ROM SLOT#00 0000-7FFF */ -/* IC112 - 16KB Basic ROM SLOT#01 0000-3FFF */ -/* IC117 - 16KB Disk ROM SLOT#01 4000-7FFF */ -/* IC123 - 32KB ROM RS232C ROM SLOT#02 4000-7FFF / Video Utility ROM SLOT#03 4000-7FFF */ - -/* MSX2 - Sony HB-G900AP */ -ROM_START (hbg900ap) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("g900bios.rom", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) - ROM_LOAD ("g900ext.rom", 0x8000, 0x4000, CRC(8f84f783) SHA1(3288894e1be6af705871499b23c85732dbc40993)) - ROM_LOAD ("g900disk.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) - ROM_LOAD ("g900232c.rom", 0x10000, 0x4000, CRC(06cf1da6) SHA1(373aa82d0426830880a7344ef98f7309d93814c7)) - ROM_LOAD ("g900util.rom", 0x14000, 0x4000, CRC(d0417c20) SHA1(8779b004e7605a3c419825f0373a5d8fa84e1d5b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbg900ap, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) -/* MSX_LAYOUT_SLOT ("rs232c", 0, 2, 1, 1, "maincpu", 0x10000) */ /* RS232C must be emulated */ - MCFG_MSX_LAYOUT_ROM("util", 0, 3, 1, 1, "maincpu", 0x14000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x80000) /* 512KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Sony HB-G900P - 3x 32KB ROMs */ - -ROM_START (hbg900p) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("g900bios.rom", 0x0000, 0x8000, CRC(b31c851d) SHA1(0de3c802057560560a03d7965fcc4cff69f8575c)) - ROM_LOAD ("g900ext.rom", 0x8000, 0x4000, CRC(8f84f783) SHA1(3288894e1be6af705871499b23c85732dbc40993)) - ROM_LOAD ("g900disk.rom", 0xc000, 0x4000, CRC(54c73ad6) SHA1(12f2cc79b3d09723840bae774be48c0d721ec1c6)) - ROM_LOAD ("g900232c.rom", 0x10000, 0x4000, CRC(06cf1da6) SHA1(373aa82d0426830880a7344ef98f7309d93814c7)) - ROM_LOAD ("g900util.rom", 0x14000, 0x4000, CRC(d0417c20) SHA1(8779b004e7605a3c419825f0373a5d8fa84e1d5b)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbg900p, msx2_pal ) - // AY8910/YM2149? - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 0, 1, 1, 1, "maincpu", 0xc000) -/* MSX_LAYOUT_SLOT ("rs232c", 0, 2, 1, 1, "maincpu", 0x10000) */ /* RS232C must be emulated */ - MCFG_MSX_LAYOUT_ROM("util", 0, 3, 1, 1, "maincpu", 0x14000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Talent TPC-310 */ -ROM_START (tpc310) - ROM_REGION (0x1c000, "maincpu", 0) - ROM_LOAD ("tpc310bios.rom", 0x0000, 0x8000, CRC(8cd3e845) SHA1(7bba23669b7abfb6a142f9e1735b847d6e4e8267)) - ROM_LOAD ("tpc310ext.rom", 0x8000, 0x4000, CRC(094a9e7a) SHA1(39dfc46260f99b670916b1e55f67a5d4136e6e54)) - ROM_LOAD ("dpf550disk.rom", 0xc000, 0x4000, CRC(347b1b44) SHA1(c1d83c559e1e6a6da961eafa55aab105681c634c)) - ROM_LOAD ("tpc310turbo.rom", 0x10000, 0x4000, CRC(0ea62a4d) SHA1(181bf58da7184e128cd419da3109b93344a543cf)) - ROM_LOAD ("tpc310acc.rom", 0x14000, 0x8000, CRC(4fb8fab3) SHA1(cdeb0ed8adecaaadb78d5a5364fd603238591685)) -ROM_END - -static MACHINE_CONFIG_DERIVED( tpc310, msx2_pal ) - // YM2149 (in S-1985 MSX Engine) - // FDC: mb8877a?, 1 3.5" DSDD drive - // 1 Cartridge slot (slot 2) - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 1, 0, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("turbo", 3, 0, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_ROM("acc", 3, 1, 1, 2, "maincpu", 0x14000) - MCFG_MSX_LAYOUT_DISK2("disk", 3, 2, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_mb8877a ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Talent TPP-311 */ - -ROM_START (tpp311) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("311bios.rom", 0x0000, 0x8000, CRC(8cd3e845) SHA1(7bba23669b7abfb6a142f9e1735b847d6e4e8267)) - ROM_LOAD ("311ext.rom", 0x8000, 0x4000, CRC(094a9e7a) SHA1(39dfc46260f99b670916b1e55f67a5d4136e6e54)) - ROM_LOAD ("311logo.rom", 0xc000, 0x8000, CRC(0e6ecb9f) SHA1(e45ddc5bf1a1e63756d11fb43fc50276ca35cab0)) -ROM_END - -static MACHINE_CONFIG_DERIVED( tpp311, msx2_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 0 Cartridge slots? - // 64KB VRAM - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 1, 0, 0x10000) /* 64KB?? Mapper RAM */ - MCFG_MSX_LAYOUT_ROM("logo", 2, 0, 1, 2, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - - MCFG_FRAGMENT_ADD( msx2_64kb_vram ) -MACHINE_CONFIG_END - -/* MSX2 - Talent TPS-312 */ - -ROM_START (tps312) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("312bios.rom", 0x0000, 0x8000, CRC(8cd3e845) SHA1(7bba23669b7abfb6a142f9e1735b847d6e4e8267)) - ROM_LOAD ("312ext.rom", 0x8000, 0x4000, CRC(094a9e7a) SHA1(39dfc46260f99b670916b1e55f67a5d4136e6e54)) - ROM_LOAD ("312plan.rom", 0xc000, 0x8000, CRC(b3a6aaf6) SHA1(6de80e863cdd7856ab7aac4c238224a5352bda3b)) - ROM_LOAD ("312write.rom", 0x14000, 0x4000, CRC(63c6992f) SHA1(93682f5baba7697c40088e26f99ee065c78e83b8)) -ROM_END - -static MACHINE_CONFIG_DERIVED( tps312, msx2_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - // 64KB VRAM - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 1, 0, 0x20000) /* 128KB?? Mapper RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("write", 3, 1, 1, 1, "maincpu", 0x14000) - MCFG_MSX_LAYOUT_ROM("plan", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("planlow", 3, 2, 0, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 3) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) - - MCFG_FRAGMENT_ADD( msx2_64kb_vram ) -MACHINE_CONFIG_END - -/* MSX2 - Toshiba HX-23 */ - -ROM_START (hx23) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("hx23bios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("hx23ext.rom", 0x8000, 0x4000, CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) - ROM_LOAD ("hx23word.rom", 0xc000, 0x8000, CRC(39b3e1c0) SHA1(9f7cfa932bd7dfd0d9ecaadc51655fb557c2e125)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx23, msx2_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - // 64KB VRAM - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_RAM("ram1", 0, 0, 2, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM("ram2", 3, 0, 0, 2) /* 32KB RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) - - MCFG_FRAGMENT_ADD( msx2_64kb_vram ) -MACHINE_CONFIG_END - -/* MSX2 - Toshiba HX-23F */ - -ROM_START (hx23f) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("hx23fbios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("hx23fext.rom", 0x8000, 0x4000, CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) - ROM_LOAD ("hx23fword.rom", 0xc000, 0x8000, CRC(39b3e1c0) SHA1(9f7cfa932bd7dfd0d9ecaadc51655fb557c2e125)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx23f, msx2_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0xc000) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Toshiba HX-23I */ - -ROM_START (hx23i) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("hx23ibios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("hx23iext.rom", 0x8000, 0x4000, CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) - ROM_LOAD ("hx23iword.rom", 0xc000, 0x8000, CRC(d50db5b4) SHA1(64cf27a6be1393b1da9f8d5d43df617c9f22fbd2)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx23i, msx2_pal ) - // YM2149 (in S-1985) - // FDC: None, 0 drives - // 2 Cartridge slots? - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("word", 3, 3, 1, 2, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX@ - Toshiba HX-33 */ - -ROM_START (hx33) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("hx33bios.rom", 0x0000, 0x8000, CRC(3891e0f7) SHA1(7dfb18262d48e559fffb4199acbe29d9b4bee9db)) - ROM_LOAD ("hx33ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("hx33firm.rom", 0xc000, 0x8000, CRC(d05b5ca6) SHA1(7eea205044af48cfde9b7fff277d961704c4d45c)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("hx33kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx33, msx2 ) - // YM2149 (in S-1985) - // FDC: None, 0, drives - // 2 Cartridge slots? - // RS232C builtin? - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) // 64KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("firm", 3, 2, 1, 2, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_64kb_vram ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX@ - Toshiba HX-34 */ - -ROM_START (hx34) -ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("hx34bios.rom", 0x0000, 0x8000, CRC(3891e0f7) SHA1(7dfb18262d48e559fffb4199acbe29d9b4bee9db)) - ROM_LOAD ("hx34ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - // hx34disk.rom has contents of floppy registers at offset 3ff0-3ff7 and mirrored at 3ff8-3fff - ROM_LOAD ("hx34disk.rom", 0xc000, 0x4000, BAD_DUMP CRC(b6203bc8) SHA1(d31236e8b2491bca678d905546b365e9d365b072)) - ROM_LOAD ("hx34firm.rom", 0x10000, 0x8000, CRC(d05b5ca6) SHA1(7eea205044af48cfde9b7fff277d961704c4d45c)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("hx34kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx34, msx2 ) - // YM2149 (in S-1985) - // FDC: wd2793??, 1 3.5" DSDD drive - // 2 Cartridge slots? - // RS232C builtin? - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) // 64KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK6("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("firm", 3, 3, 1, 2, "maincpu", 0x10000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX@ - Toshiba HX-34I */ - -ROM_START (hx34i) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("hx34ibios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("hx34iext.rom", 0x8000, 0x4000, CRC(06e4f5e6) SHA1(f5eb0a396097572589f2a6efeed045044e9425e4)) - // hx34idisk.rom has contents of floppy registers at offset 3ff0-3ff7 and mirrored at 3ff8-3fff - ROM_LOAD ("hx34idisk.rom", 0xc000, 0x4000, BAD_DUMP CRC(b6203bc8) SHA1(d31236e8b2491bca678d905546b365e9d365b072)) - ROM_LOAD ("hx34ifirm.rom", 0x10000, 0x8000, CRC(f9e29c66) SHA1(3289336b2c12161fd926a7e5ce865770ae7038af)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hx34i, msx2_pal ) - // YM2149 (in S-1985) - // FDC: wd2793??, 1 3.5" DSDD drive - // 2 Cartridge slots? - // RS232C builtin? - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) // 64KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK6("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("firm", 3, 3, 1, 2, "maincpu", 0x10000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Toshiba FS-TM1 */ - -ROM_START (fstm1) - ROM_REGION (0x1c000, "maincpu", 0) - ROM_LOAD ("fstm1bios.rom", 0x0000, 0x8000, CRC(d1e11d52) SHA1(7a69e9b9595f3b0060155f4b419c915d4d9d8ca1)) - ROM_LOAD ("fstm1ext.rom", 0x8000, 0x4000, CRC(4eebe9b1) SHA1(a4bdbdb20bf9fd3c492a890fbf541bf092eaa8e1)) - ROM_LOAD ("fstm1desk1.rom", 0xc000, 0x8000, CRC(8b802086) SHA1(30737040d90c136d34dd409fe579bc4cca11c469)) - ROM_LOAD ("fstm1desk2.rom", 0x14000, 0x8000, CRC(304820ea) SHA1(ff6e07d3976b0874164fae680ae028d598752049)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fstm1, msx2_pal ) - // YM2149 (in S-1985) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) // 64KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("desk1", 3, 2, 1, 2, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("desk2", 3, 3, 1, 2, "maincpu", 0x14000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Victor HC-90 */ - -ROM_START (victhc90) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("hc90bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("hc90ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("hc90disk.rom", 0xc000, 0x4000, CRC(11bca2ed) SHA1(a7a34671bddb48fa6c74182e2977f9129558ec32)) - ROM_LOAD ("hc90firm.rom", 0x10000, 0x4000, CRC(53791d91) SHA1(caeffdd654394726c8c0824b21af7ff51c0b1031)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("hc90kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( victhc90, msx2 ) - // YM2149 (in S-1985) - // FDC: wd2793?, 1 3.5" DSDD drive - // RS232C builtin - // 2nd CPU HD-64B180 @ 6.144 MHz - // 1 Cartridge slot (slot 1 or 2?) - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("firm", 0, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x10000) // 64KB Mapper RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Victor HC-95 */ - -ROM_START (victhc95) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("hc95bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("hc95ext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("hc95disk.rom", 0xc000, 0x4000, CRC(11bca2ed) SHA1(a7a34671bddb48fa6c74182e2977f9129558ec32)) - ROM_LOAD ("hc95firm.rom", 0x10000, 0x4000, CRC(53791d91) SHA1(caeffdd654394726c8c0824b21af7ff51c0b1031)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("hc95kfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( victhc95, msx2 ) - // YM2149 (in S-1985) - // FDC: wd2793?, 2 3.5" DSDD drive - // RS232C builtin - // 2nd CPU HD-64B180 @ 6.144 MHz - // 1 Cartridge slot (slot 1 or 2?) - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("firm", 0, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x10000) // 64KB Mapper RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Victor HC-95A */ - -ROM_START (victhc95a) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("hc95abios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("hc95aext.rom", 0x8000, 0x4000, CRC(4a48779c) SHA1(b8e30d604d319d511cbfbc61e5d8c38fbb9c5a33)) - ROM_LOAD ("hc95adisk.rom", 0xc000, 0x4000, CRC(11bca2ed) SHA1(a7a34671bddb48fa6c74182e2977f9129558ec32)) - ROM_LOAD ("hc95afirm.rom", 0x10000, 0x4000, CRC(53791d91) SHA1(caeffdd654394726c8c0824b21af7ff51c0b1031)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("hc95akfn.rom", 0x0000, 0x20000, CRC(d23d4d2d) SHA1(db03211b7db46899df41db2b1dfbec972109a967)) -ROM_END - -static MACHINE_CONFIG_DERIVED( victhc95a, msx2 ) - // YM2149 (in S-1985) - // FDC: wd2793?, 2 3.5" DSDD drive - // RS232C builtin - // 2nd CPU HD-64B180 @ 6.144 MHz - // 1 Cartridge slot (slot 1 or 2?) - // S-1985 MSX Engine - // V9958 VDP - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("firm", 0, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 0, 2, 0x40000) // 256KB Mapper RAM - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 1, 0) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha CX7M */ - -ROM_START (cx7m) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("cx7mbios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("cx7mext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cx7m, msx2_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha CX7M/128 */ - -ROM_START (cx7m128) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("cx7mbios.rom", 0x0000, 0x8000, CRC(6cdaf3a5) SHA1(6103b39f1e38d1aa2d84b1c3219c44f1abb5436e)) - ROM_LOAD ("cx7mext.rom", 0x8000, 0x4000, CRC(66237ecf) SHA1(5c1f9c7fb655e43d38e5dd1fcc6b942b2ff68b02)) - ROM_LOAD ("yrm502.rom", 0xc000, 0x4000, CRC(51f7ddd1) SHA1(2a4b4a4657e3077df8a88f98210b76883d3702b1)) -ROM_END - -static MACHINE_CONFIG_DERIVED( cx7m128, msx2_pal ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("yrm502", 3, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) /* 128KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha YIS-503 III R */ - -ROM_START (y503iiir) - ROM_REGION (0x1c000, "maincpu", 0) - ROM_LOAD ("yis503iiirbios.rom", 0x0000, 0x8000, CRC(e7d08e29) SHA1(0f851ee7a1cf79819f61cc89e9948ee72a413802)) - ROM_LOAD ("yis503iiirext.rom", 0x8000, 0x4000, CRC(34d21778) SHA1(03bf6d2ac86f5c9ab618e155442787c700f99fed)) - ROM_LOAD ("yis503iiircpm.rom", 0xc000, 0x4000, CRC(417bf00e) SHA1(f4f7a54cdf5a9dd6c59f7cb219c2c5eb0a00fa8a)) - ROM_LOAD ("yis503iiirnet.rom", 0x10000, 33121, CRC(b10fb61c) SHA1(af2b7004a8888d7a72eee937783fccaca0f38621)) // Very odd size for a rom... -ROM_END - -static MACHINE_CONFIG_DERIVED( y503iiir, msx2_pal ) - // YM2149 (in S-3527) - // FDC: wd2793?, 1 3.5" DSDD drive - // 2 Cartridge slots - // Networking builtin - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("cpm", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("net", 3, 3, 0, 3, "maincpu", 0x10000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha YIS-503 III R Estonian */ - -ROM_START (y503iiire) - ROM_REGION (0x1c000, "maincpu", 0) - ROM_LOAD ("yis503iiirebios.rom", 0x0000, 0x8000, CRC(d0c20f54) SHA1(ebb7eb540a390509edfd36c84288ba85e63f2d1f)) - ROM_LOAD ("yis503iiireext.rom", 0x8000, 0x4000, CRC(34d21778) SHA1(03bf6d2ac86f5c9ab618e155442787c700f99fed)) - ROM_LOAD ("yis503iiirecpm.rom", 0xc000, 0x4000, CRC(417bf00e) SHA1(f4f7a54cdf5a9dd6c59f7cb219c2c5eb0a00fa8a)) - ROM_LOAD ("yis503iiirenet.rom", 0x10000, 33121, CRC(b10fb61c) SHA1(af2b7004a8888d7a72eee937783fccaca0f38621)) // Very odd size for a rom... -ROM_END - -static MACHINE_CONFIG_DERIVED( y503iiire, msx2_pal ) - // YM2149 (in S-3527) - // FDC: wd2793?, 1 3.5" DSDD drive - // 2 Cartridge slots - // Networking builtin - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("cpm", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("net", 3, 3, 0, 3, "maincpu", 0x10000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha YIS604 */ - -ROM_START (yis60464) - ROM_REGION (0xc000, "maincpu", 0) - ROM_LOAD ("yis604bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("yis604ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("yis604kfn.rom", 0x0000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( yis60464, msx2 ) - // YM2149 (in S-3527) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) // 64KB Mapper RAM - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha YIS604/128 */ - -ROM_START (yis604) - ROM_REGION (0x10000, "maincpu", 0) - ROM_LOAD ("yis604bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("yis604ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("yrm502.rom", 0xc000, 0x4000, CRC(51f7ddd1) SHA1(2a4b4a4657e3077df8a88f98210b76883d3702b1)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("yis604kfn.rom", 0x0000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( yis604, msx2 ) - // YM2149 (in S-3527) - // FDC: None, 0 drives - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("yrm502", 3, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) // 64KB Mapper RAM - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha YIS-805/128 */ - -ROM_START (y805128) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("yis805128bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("yis805128ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("yis805128disk.rom", 0xc000, 0x4000, CRC(ab94a273) SHA1(4b08a057e5863ade179dcf8bc9377e90940e6d61)) - ROM_LOAD ("yrm502.rom", 0x10000, 0x4000, CRC(51f7ddd1) SHA1(2a4b4a4657e3077df8a88f98210b76883d3702b1)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("yis805128kfn.rom", 0x0000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( y805128, msx2 ) - // YM2149 (in S-3527) - // FDC: wd2793?, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("yrm502", 3, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha YIS-805R2/128 */ - -ROM_START (y805128r2) - ROM_REGION (0x28000, "maincpu", 0) - ROM_LOAD ("yis805128r2bios.rom", 0x0000, 0x8000, CRC(e7d08e29) SHA1(0f851ee7a1cf79819f61cc89e9948ee72a413802)) - ROM_LOAD ("yis805128r2ext.rom", 0x8000, 0x4000, CRC(34d21778) SHA1(03bf6d2ac86f5c9ab618e155442787c700f99fed)) - ROM_LOAD ("yis805128r2disk.rom", 0xc000, 0x4000, CRC(9eb7e24d) SHA1(3a481c7b7e4f0406a55952bc5b9f8cf9d699376c)) - ROM_LOAD ("yis805128r2net.rom", 0x10000, 0x8000, CRC(0e345b43) SHA1(e8fd2bbc1bdab12c73a0fec178a190f9063547bb)) - ROM_LOAD ("yis805128r2paint.rom", 0x18000, 0x10000, CRC(1bda68a3) SHA1(7fd2a28c4fdaeb140f3c8c8fb90271b1472c97b9)) -ROM_END - -static MACHINE_CONFIG_DERIVED( y805128r2, msx2_pal ) - // YM2149 (in S-3527) - // FDC: wd2793?, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - // Networking built in - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("paint", 3, 0, 0, 4, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("net", 3, 3, 0, 2, "maincpu", 0x10000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha YIS-805R2/128 Estonian */ - -ROM_START (y805128r2e) - ROM_REGION (0x28000, "maincpu", 0) - ROM_LOAD ("yis805128r2ebios.rom", 0x0000, 0x8000, CRC(d0c20f54) SHA1(ebb7eb540a390509edfd36c84288ba85e63f2d1f)) - ROM_LOAD ("yis805128r2eext.rom", 0x8000, 0x4000, CRC(34d21778) SHA1(03bf6d2ac86f5c9ab618e155442787c700f99fed)) - ROM_LOAD ("yis805128r2edisk.rom", 0xc000, 0x4000, CRC(9eb7e24d) SHA1(3a481c7b7e4f0406a55952bc5b9f8cf9d699376c)) - ROM_LOAD ("yis805128r2enet.rom", 0x10000, 0x8000, CRC(0e345b43) SHA1(e8fd2bbc1bdab12c73a0fec178a190f9063547bb)) - ROM_LOAD ("yis805128r2epaint.rom", 0x18000, 0x10000, CRC(1bda68a3) SHA1(7fd2a28c4fdaeb140f3c8c8fb90271b1472c97b9)) -ROM_END - -static MACHINE_CONFIG_DERIVED( y805128r2e, msx2_pal ) - // YM2149 (in S-3527) - // FDC: wd2793?, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - // Networking built in - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("paint", 3, 0, 0, 4, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 1, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x20000) // 128KB Mapper RAM - MCFG_MSX_LAYOUT_ROM("net", 3, 3, 0, 2, "maincpu", 0x10000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2 - Yamaha YIS-805/256 */ - -ROM_START (y805256) - ROM_REGION (0x14000, "maincpu", 0) - ROM_LOAD ("yis805256bios.rom", 0x0000, 0x8000, CRC(9b3e7b97) SHA1(0081ea0d25bc5cd8d70b60ad8cfdc7307812c0fd)) - ROM_LOAD ("yis805256ext.rom", 0x8000, 0x4000, CRC(43e7a7fc) SHA1(0fbd45ef3dd7bb82d4c31f1947884f411f1ca344)) - ROM_LOAD ("yis805256disk.rom", 0xc000, 0x4000, CRC(ab94a273) SHA1(4b08a057e5863ade179dcf8bc9377e90940e6d61)) - ROM_LOAD ("yrm502.rom", 0x10000, 0x4000, CRC(51f7ddd1) SHA1(2a4b4a4657e3077df8a88f98210b76883d3702b1)) - - ROM_REGION (0x20000, "kanji", 0) - ROM_LOAD ("yis805256kfn.rom", 0x0000, 0x20000, CRC(5a59926e) SHA1(6acaf2eeb57f65f7408235d5e07b7563229de799)) -ROM_END - -static MACHINE_CONFIG_DERIVED( y805256, msx2 ) - // YM2149 (in S-3527) - // FDC: wd2793?, 1 3.5" DSDD drive - // 2 Cartridge slots - // S-3527 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("yrm502", 3, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x40000) // 256KB Mapper RAM - MCFG_MSX_LAYOUT_YAMAHA_EXPANSION("expansion", 3, 3, "sfg05") - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/******************************** MSX 2+ **********************************/ - -/* MSX2+ - Ciel Expert 3 IDE */ - -ROM_START (expert3i ) - ROM_REGION (0x24000, "maincpu", 0) - ROM_LOAD ("exp30bios.rom", 0x0000, 0x8000, CRC(a10bb1ce) SHA1(5029cf47031b22bd5d1f68ebfd3be6d6da56dfe9)) - ROM_LOAD ("exp30ext.rom", 0x8000, 0x4000, CRC(6bcf4100) SHA1(cc1744c6c513d6409a142b4fb42fbe70a95d9b7f)) - ROM_LOAD ("cieldisk.rom", 0xc000, 0x4000, CRC(bb550b09) SHA1(0274dd9b5096065a7f4ed019101124c9bd1d56b8)) - ROM_LOAD ("exp30mus.rom", 0x10000, 0x4000, CRC(9881b3fd) SHA1(befebc916bfdb5e8057040f0ae82b5517a7750db)) - ROM_LOAD ("ide240a.rom", 0x14000, 0x10000, CRC(7adf857f) SHA1(8a919dbeed92db8c06a611279efaed8552810239)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expert3i, msx2p ) - // AY8910/YM2149? - // FDC: wd2793, 1 or 2? drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_MUSIC("mus", 1, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK1("disk", 1, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("ide", 1, 3, 0, 4, "maincpu", 0x14000) /* IDE hardware needs to be emulated */ - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x40000) /* 256KB?? Mapper RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Ciel Expert 3 Turbo */ - -/* Uses a Z84C0010 - CMOS processor working at 7 MHz */ -ROM_START (expert3t ) - ROM_REGION (0x18000, "maincpu",0) - ROM_LOAD ("exp30bios.rom", 0x0000, 0x8000, CRC(a10bb1ce) SHA1(5029cf47031b22bd5d1f68ebfd3be6d6da56dfe9)) - ROM_LOAD ("exp30ext.rom", 0x8000, 0x4000, CRC(6bcf4100) SHA1(cc1744c6c513d6409a142b4fb42fbe70a95d9b7f)) - ROM_LOAD ("cieldisk.rom", 0xc000, 0x4000, CRC(bb550b09) SHA1(0274dd9b5096065a7f4ed019101124c9bd1d56b8)) - ROM_LOAD ("exp30mus.rom", 0x10000, 0x4000, CRC(9881b3fd) SHA1(befebc916bfdb5e8057040f0ae82b5517a7750db)) - ROM_LOAD ("turbo.rom", 0x14000, 0x4000, CRC(ab528416) SHA1(d468604269ae7664ac739ea9f922a05e14ffa3d1)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expert3t, msx2p ) - // AY8910 - // FDC: wd2793?, 1 or 2? drives - // 4 Cartridge/Expansion slots? - // FM/YM2413 built-in - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_MUSIC("mus", 1, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_ROM("turbo", 1, 2, 1, 1, "maincpu", 0x14000) /* Turbo hardware needs to be emulated */ - MCFG_MSX_LAYOUT_DISK1("disk", 1, 3, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x40000) /* 256KB Mapper RAM */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Gradiente Expert AC88+ */ - -ROM_START (expertac) - ROM_REGION(0x18000, "maincpu", 0) - ROM_LOAD ("ac88bios.rom", 0x0000, 0x8000, CRC(9ce0da44) SHA1(1fc2306911ab6e1ebdf7cb8c3c34a7f116414e88)) - ROM_LOAD ("ac88ext.rom", 0x8000, 0x4000, CRC(c74c005c) SHA1(d5528825c7eea2cfeadd64db1dbdbe1344478fc6)) - ROM_LOAD ("panadisk.rom", 0xc000, 0x4000, CRC(17fa392b) SHA1(7ed7c55e0359737ac5e68d38cb6903f9e5d7c2b6)) - ROM_LOAD ("ac88asm.rom", 0x10000, 0x4000, CRC(a8a955ae) SHA1(91e522473a8470511584df3ee5b325ea5e2b81ef)) - ROM_LOAD ("xbasic2.rom", 0x14000, 0x4000, CRC(2825b1a0) SHA1(47370bec7ca1f0615a54eda548b07fbc0c7ef398)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expertac, msx2p ) - // AY8910/YM2149? - // FDC: wd2793?, 1 or 2? drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM?? */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("asm", 3, 1, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("xbasic", 3, 3, 1, 1, "maincpu", 0x14000) - - MCFG_FRAGMENT_ADD( msx_wd2793_force_ready ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Gradiente Expert DDX+ */ - -ROM_START (expertdx) - ROM_REGION(0x1c000, "maincpu", 0) - ROM_LOAD ("ddxbios.rom", 0x0000, 0x8000, CRC(e00af3dc) SHA1(5c463dd990582e677c8206f61035a7c54d8c67f0)) - ROM_LOAD ("ddxext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("panadisk.rom", 0xc000, 0x4000, CRC(17fa392b) SHA1(7ed7c55e0359737ac5e68d38cb6903f9e5d7c2b6)) - ROM_LOAD ("xbasic2.rom", 0x10000, 0x4000, CRC(2825b1a0) SHA1(47370bec7ca1f0615a54eda548b07fbc0c7ef398)) - ROM_LOAD ("kanji.rom", 0x14000, 0x8000, CRC(b4fc574d) SHA1(dcc3a67732aa01c4f2ee8d1ad886444a4dbafe06)) -ROM_END - -static MACHINE_CONFIG_DERIVED( expertdx, msx2p ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive? - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_ROM("ext", 1, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("xbasic", 1, 2, 1, 1, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 1, 3, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 2, 0, 0x10000) /* 64KB Mapper RAM?? */ - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0) - /* Kanji? */ - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Panasonic FS-A1FX */ - -ROM_START (fsa1fx) - ROM_REGION (0x20000, "maincpu",0) - ROM_LOAD ("a1fxbios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) - ROM_LOAD ("a1fxext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("a1fxdisk.rom", 0xc000, 0x4000, CRC(2bda0184) SHA1(2a0d228afde36ac7c5d3c2aac9c7c664dd071a8c)) - ROM_LOAD ("a1fxkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) - ROM_LOAD ("a1fxcock.rom", 0x18000, 0x8000, CRC(f662e6eb) SHA1(9d67fab55b85f4ac4f5924323a70020eb8589057)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("a1fxkfn.rom", 0, 0x20000, CRC(b244f6cf) SHA1(e0e99cd91e88ce2676445663f832c835d74d6fd4)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1fx, msx2p ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("cock", 3, 3, 1, 2, "maincpu", 0x18000) - - MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) - MCFG_MSX_MATSUSHITA_TURBO_CB(WRITELINE(msx_state, turbo_w)) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Panasonic FS-A1WSX */ - -ROM_START (fsa1wsx) - ROM_REGION (0x21c000, "maincpu",0) - ROM_LOAD ("a1wsbios.rom", 0x0000, 0x8000, CRC(358ec547) SHA1(f4433752d3bf876bfefb363c749d4d2e08a218b6)) - ROM_LOAD ("a1wsext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("a1wsdisk.rom", 0xc000, 0x4000, CRC(ac7d92b4) SHA1(b7068e2aab02072852ca249596b7550ac632c4c2)) - ROM_LOAD ("a1wskdr.rom", 0x10000, 0x8000, CRC(b4fc574d) SHA1(dcc3a67732aa01c4f2ee8d1ad886444a4dbafe06)) - ROM_LOAD ("a1wsmusp.rom", 0x18000, 0x4000, CRC(456e494e) SHA1(6354ccc5c100b1c558c9395fa8c00784d2e9b0a3)) - ROM_LOAD ("a1wsfirm.rom", 0x1c000, 0x200000, CRC(e363595d) SHA1(3330d9b6b76e3c4ccb7cf252496ed15d08b95d3f)) - - ROM_REGION(0x40000, "kanji", 0) - ROM_LOAD ("a1wskfn.rom", 0, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1wsx, msx2p ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots - // FM built-in - // No cassette port - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_PANASONIC08("firm", 3, 3, 0, 4, "maincpu", 0x1c000) - - MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) - MCFG_MSX_MATSUSHITA_TURBO_CB(WRITELINE(msx_state, turbo_w)) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Panasonic FS-A1WX */ - -ROM_START (fsa1wx) - ROM_REGION (0x21c000, "maincpu",0) - ROM_LOAD ("a1wxbios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) - ROM_LOAD ("a1wxext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("a1wxdisk.rom", 0xc000, 0x4000, CRC(2bda0184) SHA1(2a0d228afde36ac7c5d3c2aac9c7c664dd071a8c)) - ROM_LOAD ("a1wxkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) - ROM_LOAD ("a1wxmusp.rom", 0x18000, 0x4000, CRC(456e494e) SHA1(6354ccc5c100b1c558c9395fa8c00784d2e9b0a3)) - ROM_LOAD ("a1wxfirm.rom", 0x1c000, 0x200000, CRC(283f3250) SHA1(d37ab4bd2bfddd8c97476cbe7347ae581a6f2972)) - - ROM_REGION(0x40000, "kanji", 0) - ROM_LOAD ("a1wxkfn.rom", 0, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1wx, msx2p ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots - // FM built-in - // MSX Engine T9769A - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_PANASONIC08("firm", 3, 3, 0, 4, "maincpu", 0x1c000) - - MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) - MCFG_MSX_MATSUSHITA_TURBO_CB(WRITELINE(msx_state, turbo_w)) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Panasonic FS-A1WX (a) */ -ROM_START (fsa1wxa) - ROM_REGION (0x21c000, "maincpu",0) - ROM_LOAD ("a1wxbios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) - ROM_LOAD ("a1wxext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("a1wxdisk.rom", 0xc000, 0x4000, CRC(2bda0184) SHA1(2a0d228afde36ac7c5d3c2aac9c7c664dd071a8c)) - ROM_LOAD ("a1wxkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) - ROM_LOAD ("a1wxmusp.rom", 0x18000, 0x4000, CRC(456e494e) SHA1(6354ccc5c100b1c558c9395fa8c00784d2e9b0a3)) - ROM_LOAD ("a1wxfira.rom", 0x1c000, 0x200000, CRC(58440a8e) SHA1(8e0d4a77e7d5736e8225c2df4701509363eb230f)) - - ROM_REGION(0x40000, "kanji", 0) - ROM_LOAD ("a1wxkfn.rom", 0, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1wxa, msx2p ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots? - // FM built-in - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_PANASONIC08("firm", 3, 3, 0, 4, "maincpu", 0x1c000) - - MCFG_MSX_MATSUSHITA_ADD( "matsushita" ) - MCFG_MSX_MATSUSHITA_TURBO_CB(WRITELINE(msx_state, turbo_w)) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Sanyo Wavy PHC-35J */ - -ROM_START (phc35j) - ROM_REGION (0x14000, "maincpu",0) - ROM_LOAD ("35jbios.rom", 0x0000, 0x8000, CRC(358ec547) SHA1(f4433752d3bf876bfefb363c749d4d2e08a218b6)) - ROM_LOAD ("35jext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("35jkdr.rom", 0xc000, 0x8000, CRC(b4fc574d) SHA1(dcc3a67732aa01c4f2ee8d1ad886444a4dbafe06)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("35jkfn.rom", 0, 0x20000, CRC(c9651b32) SHA1(84a645becec0a25d3ab7a909cde1b242699a8662)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc35j, msx2p ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0xc000) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Sanyo Wavy PHC-70FD1 */ - -ROM_START (phc70fd) - ROM_REGION (0x20000, "maincpu",0) - ROM_LOAD ("70fdbios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) - ROM_LOAD ("70fdext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("70fddisk.rom", 0xc000, 0x4000, CRC(db7f1125) SHA1(9efa744be8355675e7bfdd3976bbbfaf85d62e1d)) - ROM_LOAD ("70fdkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) - ROM_LOAD ("70fdmus.rom", 0x18000, 0x4000, CRC(5c32eb29) SHA1(aad42ba4289b33d8eed225d42cea930b7fc5c228)) - ROM_LOAD ("70fdbas.rom", 0x1c000, 0x4000, CRC(da7be246) SHA1(22b3191d865010264001b9d896186a9818478a6b)) - - ROM_REGION(0x20000, "kanji", 0) - ROM_LOAD ("70fdkfn.rom", 0, 0x20000, CRC(c9651b32) SHA1(84a645becec0a25d3ab7a909cde1b242699a8662)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc70fd, msx2p ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots - // FM built-in - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_MUSIC("mus", 3, 3, 1, 1, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_ROM("bas", 3, 3, 2, 1, "maincpu", 0x1c000) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Sanyo Wavy PHC-70FD2 */ -ROM_START (phc70fd2) - ROM_REGION (0x20000, "maincpu",0) - ROM_LOAD ("70f2bios.rom", 0x0000, 0x8000, CRC(19771608) SHA1(e90f80a61d94c617850c415e12ad70ac41e66bb7)) - ROM_LOAD ("70f2ext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("70f2disk.rom", 0xc000, 0x4000, CRC(db7f1125) SHA1(9efa744be8355675e7bfdd3976bbbfaf85d62e1d)) - ROM_LOAD ("70f2kdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) - ROM_LOAD ("70f2mus.rom", 0x18000, 0x4000, CRC(5c32eb29) SHA1(aad42ba4289b33d8eed225d42cea930b7fc5c228)) - ROM_LOAD ("70f2bas.rom", 0x1c000, 0x4000, CRC(da7be246) SHA1(22b3191d865010264001b9d896186a9818478a6b)) - - ROM_REGION(0x40000, "kanji", 0) - ROM_LOAD ("70f2kfn.rom", 0, 0x40000, CRC(9a850db9) SHA1(bcdb4dae303dfe5234f372d70a5e0271d3202c36)) -ROM_END - -static MACHINE_CONFIG_DERIVED( phc70fd2, msx2p ) - // AY8910/YM2149? - // FDC: tc8566af, 2 3.5" DSDD drives - // 2 Cartridge slots - // FM built-in - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK3("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_MUSIC("mus", 3, 3, 1, 1, "maincpu", 0x18000) - MCFG_MSX_LAYOUT_ROM("bas", 3, 3, 2, 1, "maincpu", 0x1c000) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0xff) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_2_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Sony HB-F1XDJ */ - -ROM_START (hbf1xdj) - ROM_REGION (0x11c000, "maincpu",0) - ROM_LOAD ("f1xjbios.rom", 0x0000, 0x8000, CRC(00870134) SHA1(e2fbd56e42da637609d23ae9df9efd1b4241b18a)) - ROM_LOAD ("f1xjext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("f1xjdisk.rom", 0xc000, 0x4000, CRC(a21f5266) SHA1(c1bb307a570ab833e3bfcc4a58a4f4e12dc1df0f)) - ROM_LOAD ("f1xjkdr.rom", 0x10000, 0x8000, CRC(a068cba9) SHA1(1ef3956f7f918873fb9b031339bba45d1e5e5878)) - ROM_LOAD ("f1xjmus.rom", 0x18000, 0x4000, CRC(5c32eb29) SHA1(aad42ba4289b33d8eed225d42cea930b7fc5c228)) - ROM_LOAD ("f1xjfirm.rom", 0x1c000, 0x100000, CRC(77be583f) SHA1(ade0c5ba5574f8114d7079050317099b4519e88f)) - - ROM_REGION(0x40000, "kanji", 0) - ROM_LOAD ("f1xjkfn.rom", 0, 0x40000, CRC(7016dfd0) SHA1(218d91eb6df2823c924d3774a9f455492a10aecb)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf1xdj, msx2p ) - // YM2149 (in S-1985 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drive - // 2 Cartridge slots - // FM built-in - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_SONY08("firm", 0, 3, 0, 4, "maincpu", 0x1c000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_MUSIC("mus", 3, 3, 1, 1, "maincpu", 0x18000) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Sony HB-F1XV */ - -ROM_START (hbf1xv) - ROM_REGION (0x11c000, "maincpu",0) - ROM_LOAD ("f1xvbios.rom", 0x0000, 0x8000, CRC(2c7ed27b) SHA1(174c9254f09d99361ff7607630248ff9d7d8d4d6)) - ROM_LOAD ("f1xvext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("f1xvdisk.rom", 0xc000, 0x4000, CRC(04e4e533) SHA1(5a4e7dbbfb759109c7d2a3b38bda9c60bf6ffef5)) - ROM_LOAD ("f1xvkdr.rom", 0x10000, 0x8000, CRC(b4fc574d) SHA1(dcc3a67732aa01c4f2ee8d1ad886444a4dbafe06)) - ROM_LOAD ("f1xvmus.rom", 0x18000, 0x4000, CRC(5c32eb29) SHA1(aad42ba4289b33d8eed225d42cea930b7fc5c228)) - ROM_LOAD ("f1xvfirm.rom", 0x1c000, 0x100000, CRC(77be583f) SHA1(ade0c5ba5574f8114d7079050317099b4519e88f)) - - ROM_REGION(0x40000, "kanji", 0) - ROM_LOAD ("f1xvkfn.rom", 0, 0x40000, CRC(7016dfd0) SHA1(218d91eb6df2823c924d3774a9f455492a10aecb)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf1xv, msx2p ) - // YM2149 (in S-1985 MSX Engine) - // FDC: wd2793, 1 3.5" DSDD drives - // 2 Cartridge slots - // FM built-in - // S-1985 MSX Engine - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_SONY08("firm", 0, 3, 0, 4, "maincpu", 0x1c000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */ - MCFG_MSX_RAMIO_SET_BITS(0x80) - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_DISK1("disk", 3, 2, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_MUSIC("mus", 3, 3, 1, 1, "maincpu", 0x18000) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) - - MCFG_MSX_S1985_ADD("s1985") - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_wd2793 ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msx2p_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX2+ - Sony HB-F9S+ */ - -ROM_START (hbf9sp) - ROM_REGION (0x18000, "maincpu", 0) - ROM_LOAD ("f9spbios.rom", 0x0000, 0x8000, CRC(994d3a80) SHA1(03556d380a9bd413faf1b9e3cbd7da47c7238775)) - ROM_LOAD ("f9spext.rom", 0x8000, 0x4000, CRC(b8ba44d3) SHA1(fe0254cbfc11405b79e7c86c7769bd6322b04995)) - ROM_LOAD ("f9psfrm1.rom", 0xc000, 0x4000, CRC(43d4cef1) SHA1(8948704bad9ff27873fa9ccd0ef89868e2bd6479)) - ROM_LOAD ("f9spfrm2.rom", 0x10000, 0x8000, CRC(ea97069f) SHA1(2d1880d1f5a6944fcb1b198b997a3d90ecd1903d)) -ROM_END - -static MACHINE_CONFIG_DERIVED( hbf9sp, msx2p ) - // AY8910/YM2149? - // FDC: None, 0 drives - // 2 Cartridge slots? - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("firm1", 3, 0, 1, 1, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("firm2", 3, 1, 1, 2, "maincpu", 0x10000) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 2, 0x10000) /* 64KB?? Mapper RAM */ - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX Turbo-R - Panasonic FS-A1GT */ - -ROM_START (fsa1gt) - ROM_REGION (0x46c000, "maincpu", 0) - ROM_LOAD ("a1gtbios.rom", 0x0000, 0x8000, CRC(937c8dbb) SHA1(242e73d8284a012b275c0a266844ebbc4269d787)) - ROM_LOAD ("a1gtext.rom", 0x8000, 0x4000, CRC(70aea0fe) SHA1(018d7a5222f28514908fb1b1513286a6558a6d05)) - ROM_LOAD ("a1gtdos.rom", 0xc000, 0x10000, CRC(bb2a0eae) SHA1(4880bf34f1c86fff5456ec2b4cf70d02339e2caa)) - ROM_LOAD ("a1gtkdr.rom", 0x1c000, 0x8000, CRC(eaf0d125) SHA1(5b39c1ccd3a213b78e02927f56a9abc72cd8c28d)) - ROM_LOAD ("a1gtmus.rom", 0x24000, 0x4000, CRC(f5f93437) SHA1(6aea1aef5ec31c1826c22edf580525f93baad425)) - ROM_LOAD ("a1gtopt.rom", 0x28000, 0x4000, CRC(50d11f60) SHA1(b4433a3975c57dd440d6bf12dbd28b2ac1b90ef4)) - ROM_LOAD ("a1gtkfn.rom", 0x2c000, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) - ROM_LOAD ("a1gtfirm.rom", 0x6c000, 0x400000, CRC(feefeadc) SHA1(e779c338eb91a7dea3ff75f3fde76b8af22c4a3a)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1gt, msx2 ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots - // FM built-in - // MIDI - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x24000) - MCFG_MSX_LAYOUT_ROM("opt", 0, 3, 1, 1, "maincpu", 0x28000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB?? Mapper RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x1c000) - MCFG_MSX_LAYOUT_DISK4("dos", 3, 2, 1, 3, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("firm", 3, 3, 0, 4, "maincpu", 0x6c000) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msxr_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - -/* MSX Turbo-R - Panasonic FS-A1ST */ - -ROM_START (fsa1st) - ROM_REGION (0x46c000, "maincpu", 0) - ROM_LOAD ("a1stbios.rom", 0x0000, 0x8000, CRC(77b94ae0) SHA1(f078b5ec56884bfb81481d45c7151418770bff5a)) - ROM_LOAD ("a1stext.rom", 0x8000, 0x4000, CRC(2c2c77a4) SHA1(373412f9c32762de1c3a7e27fc3d80614e0a0c8e)) - ROM_LOAD ("a1stdos.rom", 0xc000, 0x10000, CRC(1fc71407) SHA1(5d2186658adcf4ce0c2d3232384b5712341108e5)) - ROM_LOAD ("a1stkdr.rom", 0x1c000, 0x8000, CRC(eaf0d125) SHA1(5b39c1ccd3a213b78e02927f56a9abc72cd8c28d)) - ROM_LOAD ("a1stmus.rom", 0x24000, 0x4000, CRC(fd7dec41) SHA1(e002a9b426732e6c2d31e548c40cf7c122348ce3)) - ROM_LOAD ("a1stopt.rom", 0x28000, 0x4000, CRC(c6a4a2a1) SHA1(cb06dea7b025745f9d2b87dcf03ded615287ead3)) - ROM_LOAD ("a1stkfn.rom", 0x2c000, 0x40000, CRC(1f6406fb) SHA1(5aff2d9b6efc723bc395b0f96f0adfa83cc54a49)) - ROM_LOAD ("a1stfirm.rom", 0x6c000, 0x400000, CRC(139ac99c) SHA1(c212b11fda13f83dafed688c54d098e7e47ab225)) -ROM_END - -static MACHINE_CONFIG_DERIVED( fsa1st, msx2 ) - // AY8910/YM2149? - // FDC: tc8566af, 1 3.5" DSDD drive - // 2 Cartridge slots - // FM built-in - - MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) - MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x24000) - MCFG_MSX_LAYOUT_ROM("opt", 0, 3, 1, 1, "maincpu", 0x28000) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0) - MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0) - MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x20000) /* 128KB?? Mapper RAM */ - MCFG_MSX_LAYOUT_ROM("ext", 3, 1, 0, 1, "maincpu", 0x8000) - MCFG_MSX_LAYOUT_ROM("kdr", 3, 1, 1, 2, "maincpu", 0x1c000) - MCFG_MSX_LAYOUT_DISK4("dos", 3, 2, 1, 3, "maincpu", 0xc000) - MCFG_MSX_LAYOUT_ROM("firm", 3, 3, 0, 4, "maincpu", 0x6c000) - - MCFG_MSX_SYSTEMFLAGS_ADD("sysflags", 0x00) - - MCFG_FRAGMENT_ADD( msx_ym2413 ) - - MCFG_FRAGMENT_ADD( msx_tc8566af ) - MCFG_FRAGMENT_ADD( msx_1_35_dd_drive ) - MCFG_FRAGMENT_ADD( msxr_floplist ) - - MCFG_FRAGMENT_ADD( msx2_cartlist ) -MACHINE_CONFIG_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -/* MSX1 */ -COMP(1986, ax150, 0, 0, ax150, msx, driver_device, 0, "Al Alamiah", "AX-150 (Arabic) (MSX1)", 0) -COMP(1986, ax170, 0, 0, ax170, msx, driver_device, 0, "Al Alamiah", "AX-170 (Arabic) (MSX1)", 0) -COMP(1983, canonv8, 0, 0, canonv8, msx, driver_device, 0, "Canon", "V-8 (MSX1)", 0) -COMP(1983, canonv10, canonv20, 0, canonv10, msx, driver_device, 0, "Canon", "V-10 (MSX1)", 0) -COMP(1983, canonv20, 0, 0, canonv20, msx, driver_device, 0, "Canon", "V-20 (MSX1)", 0) -COMP(1983, canonv20e, canonv20, 0, canonv20, msx, driver_device, 0, "Canon", "V-20E (MSX1)", 0) // Different Euro keyboard layout? -COMP(1983, canonv20f, canonv20, 0, canonv20, msx, driver_device, 0, "Canon", "V-20F (MSX1)", 0) // Different French keyboard layout? -COMP(1983, canonv20g, canonv20, 0, canonv20, msx, driver_device, 0, "Canon", "V-20G (MSX1)", 0) // Different German keyboard layout? -COMP(1983, canonv20s, canonv20, 0, canonv20, msx, driver_device, 0, "Canon", "V-20S (MSX1)", 0) // Different Spanish keyboard layout? -COMP(1984, mx10, 0, 0, mx10, msx, driver_device, 0, "Casio", "MX-10 (MSX1)", 0) -COMP(1984, mx101, mx10, 0, mx101, msx, driver_device, 0, "Casio", "MX-101 (MSX1)", 0) -COMP(1984, mx15, mx10, 0, mx15, msx, driver_device, 0, "Casio", "MX-15 (MSX1)", 0) -COMP(1984, pv7, 0, 0, pv7, msx, driver_device, 0, "Casio", "PV-7 (MSX1)", 0) -COMP(1984, pv16, 0, 0, pv16, msx, driver_device, 0, "Casio", "PV-16 (MSX1)", 0) -COMP(198?, cpc88, 0, 0, cpc88, msxkr, driver_device, 0, "Daewoo", "CPC-88 (Korea) (MSX1)", 0) -COMP(1984, dpc100, dpc200, 0, dpc100, msxkr, driver_device, 0, "Daewoo", "IQ-1000 DPC-100 (Korea) (MSX1)", 0) -COMP(1984, dpc180, dpc200, 0, dpc180, msxkr, driver_device, 0, "Daewoo", "IQ-1000 DPC-180 (Korea) (MSX1)", 0) -COMP(1984, dpc200, 0, 0, dpc200, msxkr, driver_device, 0, "Daewoo", "IQ-1000 DPC-200 (Korea) (MSX1)", 0) -COMP(1985, dpc200e, 0, 0, dpc200e, msx, driver_device, 0, "Daewoo", "DPC-200E (MSX1)", 0) -COMP(1983, cpc50a, cpc51, 0, cpc50a, msxkr, driver_device, 0, "Daewoo", "Zemmix CPC-50A (Korea) (MSX1)", 0) -COMP(1983, cpc50b, cpc51, 0, cpc50b, msxkr, driver_device, 0, "Daewoo", "Zemmix CPC-50B (Korea) (MSX1)", 0) -COMP(1986, cpc51, 0, 0, cpc51, msxkr, driver_device, 0, "Daewoo", "Zemmix CPC-51 (Korea) (MSX1)", 0) -COMP(1983, fdpc200, 0, 0, fdpc200, msx, driver_device, 0, "Fenner", "DPC-200 (MSX1) ", 0) -COMP(1984, fpc500, 0, 0, fpc500, msx, driver_device, 0, "Fenner", "FPC-500 (MSX1)", 0) -COMP(1986, fspc800, 0, 0, fspc800, msx, driver_device, 0, "Fenner", "SPC-800 (MSX1) ", 0) -COMP(1984, bruc100, 0, 0, bruc100, msx, driver_device, 0, "Frael", "Bruc 100-1 (MSX1)", 0) -COMP(1983, fmx, 0, 0, fmx, msxjp, driver_device, 0, "Fujitsu", "FM-X (MSX1)", 0) -COMP(1984, gsfc80u, 0, 0, gsfc80u, msxkr, driver_device, 0, "Goldstar", "FC-80U (MSX1)", 0) -COMP(1983, gsfc200, 0, 0, gsfc200, msx, driver_device, 0, "Goldstar", "FC-200 (MSX1)", 0) -COMP(198?, gfc1080, 0, 0, gfc1080, msxkr, driver_device, 0, "Goldstar", "GFC-1080 (MSX1)", 0) -COMP(198?, gfc1080a, 0, 0, gfc1080a, msxkr, driver_device, 0, "Goldstar", "GFC-1080A (MSX1)", 0) -COMP(1983, expert10, expert13, 0, expert10, expert10, driver_device, 0, "Gradiente", "Expert 1.0 (Brazil) (MSX1)", 0) -COMP(1984, expert11, expert13, 0, expert11, expert11, driver_device, 0, "Gradiente", "Expert 1.1 (Brazil) (MSX1)", 0) -COMP(1984, expert13, 0, 0, expert13, expert11, driver_device, 0, "Gradiente", "Expert 1.3 (Brazil) (MSX1)", 0) -COMP(1985, expertdp, 0, 0, expertdp, expert11, driver_device, 0, "Gradiente", "Expert DDPlus (Brazil) (MSX1)", 0) -COMP(1984, expertpl, 0, 0, expertpl, expert11, driver_device, 0, "Gradiente", "Expert Plus (Brazil) (MSX1)", 0) -COMP(1984, mbh2, 0, 0, mbh2, msxjp, driver_device, 0, "Hitachi", "MB-H2 (MSX1)", 0) -COMP(1984, mbh25, 0, 0, mbh25, msxjp, driver_device, 0, "Hitachi", "MB-H25 (MSX1)", 0) -COMP(1983, mbh50, 0, 0, mbh50, msxjp, driver_device, 0, "Hitachi", "MB-H50 (MSX1)", 0) -COMP(1983, jvchc7gb, 0, 0, jvchc7gb, msx, driver_device, 0, "JVC", "HC-7GB (MSX1)", 0) -COMP(198?, mlf48, 0, 0, mlf48, msx, driver_device, 0, "Mitsubishi", "ML-F48 (MSX1)", 0) -COMP(1983, mlf80, 0, 0, mlf80, msx, driver_device, 0, "Mitsubishi", "ML-F80 (MSX1)", 0) -COMP(1984, mlf110, 0, 0, mlf110, msxjp, driver_device, 0, "Mitsubishi", "ML-F110 (MSX1)", 0) -COMP(1984, mlf120, 0, 0, mlf120, msxjp, driver_device, 0, "Mitsubishi", "ML-F120 (MSX1)", 0) -COMP(1983, mlfx1, 0, 0, mlfx1, msx, driver_device, 0, "Mitsubishi", "ML-FX1 (MSX1)", 0) -COMP(1984, cf1200, 0, 0, cf1200, msxjp, driver_device, 0, "National / Matsushita", "CF-1200 (Japan) (MSX1)", 0) -COMP(1983, cf2000, 0, 0, cf2000, msxjp, driver_device, 0, "National / Matsushita", "CF-2000 (Japan) (MSX1)", 0) -COMP(1984, cf2700, 0, 0, cf2700, msxjp, driver_device, 0, "National / Matsushita", "CF-2700 (Japan) (MSX1)", 0) -COMP(1984, cf3000, 0, 0, cf3000, msxjp, driver_device, 0, "National / Matsushita", "CF-3000 (Japan) (MSX1)", 0) -COMP(1985, cf3300, 0, 0, cf3300, msxjp, driver_device, 0, "National / Matsushita", "CF-3300 (Japan) (MSX1)", 0) -COMP(1985, fs1300, 0, 0, fs1300, msxjp, driver_device, 0, "National / Matsushita", "FS-1300 (Japan) (MSX1)", 0) -COMP(1985, fs4000, 0, 0, fs4000, msxjp, driver_device, 0, "National / Matsushita", "FS-4000 (Japan) (MSX1)", 0) -COMP(1985, fs4000a, fs4000, 0, fs4000a, msxjp, driver_device, 0, "National / Matsushita", "FS-4000 (alt) (Japan) (MSX1)", 0) -COMP(1983, phc2, 0, 0, phc2, msx, driver_device, 0, "Olympia", "PHC-2 (MSX1)" , 0) -COMP(19??, phc28, 0, 0, phc28, msx, driver_device, 0, "Olympia", "PHC-28 (MSX1)", 0) -COMP(1984, cf2700g, 0, 0, cf2700g, msx, driver_device, 0, "Panasonic", "CF-2700G (Germany) (MSX1)", 0) -COMP(198?, perfect1, 0, 0, perfect1, msx, driver_device, 0, "Perfect", "Perfect1 (MSX1)", MACHINE_NOT_WORKING) -COMP(1983, nms801, 0, 0, nms801, msx, driver_device, 0, "Philips", "NMS-801 (MSX1)", 0) -COMP(1984, vg8000, vg8010, 0, vg8000, msx, driver_device, 0, "Philips", "VG-8000 (MSX1)", 0) -COMP(1984, vg8010, 0, 0, vg8010, msx, driver_device, 0, "Philips", "VG-8010 (MSX1)", 0) -COMP(1984, vg8010f, vg8010, 0, vg8010f, msx, driver_device, 0, "Philips", "VG-8010F (MSX1)" , 0) -COMP(1985, vg802000, vg802020, 0, vg802000, msx, driver_device, 0, "Philips", "VG-8020-00 (MSX1)", 0) -COMP(1985, vg802020, 0, 0, vg802020, msx, driver_device, 0, "Philips", "VG-8020-20 (MSX1)", 0) -COMP(19??, vg8020f, vg802020, 0, vg8020f, msx, driver_device, 0, "Philips", "VG-8020F (MSX1)", 0) -COMP(1985, piopx7, 0, 0, piopx7, msx, driver_device, 0, "Pioneer", "PX-07 Palcom (MSX1)", 0) -COMP(1985, piopx7uk, piopx7, 0, piopx7uk, msx, driver_device, 0, "Pioneer", "PX-07UK Palcom (MSX1)", 0) -COMP(1984, piopxv60, piopx7, 0, piopxv60, msxjp, driver_device, 0, "Pioneer", "PX-V60 (MSX1)", 0) -COMP(19??, spc800, 0, 0, spc800, msx, driver_device, 0, "Samsung", "SPC-800 (MSX1)", 0) -COMP(1985, mpc64, 0, 0, mpc64, msxjp, driver_device, 0, "Sanyo", "MPC-64 (MSX1)", 0) -COMP(1985, mpc100, 0, 0, mpc100, msx, driver_device, 0, "Sanyo", "MPC-100 (MSX1)", 0) -COMP(1983, mpc200, 0, 0, mpc200, msx, driver_device, 0, "Sanyo", "MPC-200 (MSX1)", 0) -COMP(1983, mpc200sp, mpc200, 0, mpc200sp, msx, driver_device, 0, "Sanyo", "MPC-200SP (MSX1)", 0) // Spanish keyboard? -COMP(1983, phc28l, 0, 0, phc28l, msx, driver_device, 0, "Sanyo", "PHC-28L (MSX1)", 0) -COMP(1983, phc28s, 0, 0, phc28s, msx, driver_device, 0, "Sanyo", "PHC-28S (MSX1)", 0) -COMP(19??, mpc10, 0, 0, mpc10, msx, driver_device, 0, "Sanyo", "Wavy MPC-10 (MSX1)", 0) -COMP(1985, hotbit11, hotbi13p, 0, hotbit11, hotbit, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 1.1 (MSX1)", 0) -COMP(1985, hotbit12, hotbi13p, 0, hotbit12, hotbit, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 1.2 (MSX1)", 0) -COMP(1985, hotbi13b, hotbi13p, 0, hotbi13b, hotbit, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 1.3b (MSX1)", 0) -COMP(1985, hotbi13p, 0, 0, hotbi13p, hotbit, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 1.3p (MSX1)", 0) -COMP(198?, hb10, hb10p, 0, hb10, msxjp, driver_device, 0, "Sony", "HB-10 (MSX1)", 0) -COMP(1985, hb10p, 0, 0, hb10p, msx, driver_device, 0, "Sony", "HB-10P (MSX1)", 0) -COMP(1984, hb101p, 0, 0, hb101p, msx, driver_device, 0, "Sony", "HB-101P (MSX1)", 0) -COMP(1985, hb20p, 0, 0, hb20p, msx, driver_device, 0, "Sony", "HB-20P (Spanish) (MSX1)", 0) -COMP(1985, hb201, hb201p, 0, hb201, msxjp, driver_device, 0, "Sony", "HB-201 (Japan) (MSX1)", 0) -COMP(1985, hb201p, 0, 0, hb201p, msx, driver_device, 0, "Sony", "HB-201P (MSX1)", 0) -COMP(1984, hb501p, 0, 0, hb501p, msx, driver_device, 0, "Sony", "HB-501P (MSX1)", 0) -COMP(1983, hb55, hb55p, 0, hb55, msxjp, driver_device, 0, "Sony", "HB-55 (MSX1)", 0) -COMP(1983, hb55d, hb55p, 0, hb55d, msx, driver_device, 0, "Sony", "HB-55D (Germany) (MSX1)", 0) -COMP(1983, hb55p, 0, 0, hb55p, msx, driver_device, 0, "Sony", "HB-55P (MSX1)", 0) -COMP(1984, hb701fd, 0, 0, hb701fd, msxjp, driver_device, 0, "Sony", "HB-701FD (MSX1)", 0) -COMP(1983, hb75d, hb75p, 0, hb75d, msx, driver_device, 0, "Sony", "HB-75D (Germany) (MSX1)", 0) -COMP(1983, hb75p, 0, 0, hb75p, msx, driver_device, 0, "Sony", "HB-75P (MSX1)", 0) -COMP(1985, svi728, 0, 0, svi728, msx, driver_device, 0, "Spectravideo", "SVI-728 (MSX1)", 0) -COMP(1985, svi738, 0, 0, svi738, msx, driver_device, 0, "Spectravideo", "SVI-738 (MSX1)", 0) -COMP(1983, svi738ar, svi738, 0, svi738ar, msx, driver_device, 0, "Spectravideo", "SVI-738 (Arabic) (MSX1)", 0) -COMP(1983, svi738dk, svi738, 0, svi738dk, msx, driver_device, 0, "Spectravideo", "SVI-738 (Denmark) (MSX1)", 0) -COMP(1983, svi738sp, svi738, 0, svi738sp, msx, driver_device, 0, "Spectravideo", "SVI-738 (Spain) (MSX1)", 0) -COMP(1983, svi738sw, svi738, 0, svi738sw, msx, driver_device, 0, "Spectravideo", "SVI-738 (Swedish) (MSX1)", 0) -COMP(1983, svi738pl, svi738, 0, svi738pl, msx, driver_device, 0, "Spectravideo", "SVI-738 (Poland) (MSX1)", 0) -COMP(1983, tadpc200, dpc200, 0, tadpc200, msx, driver_device, 0, "Talent", "DPC-200 (MSX1)", 0) -COMP(1983, tadpc20a, dpc200, 0, tadpc20a, msx, driver_device, 0, "Talent", "DPC-200A (MSX1)", 0) -COMP(1984, hx10, 0, 0, hx10, msx, driver_device, 0, "Toshiba", "HX-10 (MSX1)", 0) -COMP(1984, hx10d, hx10, 0, hx10d, msxjp, driver_device, 0, "Toshiba", "HX-10D (MSX1)", 0) -COMP(1984, hx10dp, hx10, 0, hx10dp, msxjp, driver_device, 0, "Toshiba", "HX-10DP (MSX1)", 0) -COMP(1984, hx10e, hx10, 0, hx10e, msx, driver_device, 0, "Toshiba", "HX-10E (MSX1)", 0) -COMP(1984, hx10f, hx10, 0, hx10f, msx, driver_device, 0, "Toshiba", "HX-10F (MSX1)", 0) -COMP(1984, hx10s, hx10, 0, hx10s, msx, driver_device, 0, "Toshiba", "HX-10S (MSX1)", 0) -COMP(1984, hx10sa, hx10, 0, hx10sa, msxjp, driver_device, 0, "Toshiba", "HX-10SA (MSX1)", 0) -COMP(1984, hx20, 0, 0, hx20, msx, driver_device, 0, "Toshiba", "HX-20 (MSX1)", 0) -COMP(1984, hx20i, hx20, 0, hx20i, msx, driver_device, 0, "Toshiba", "HX-20I (MSX1)", 0) -COMP(1984, hx21, 0, 0, hx21, msxjp, driver_device, 0, "Toshiba", "HX-21 (MSX1)", MACHINE_NOT_WORKING) // Does not go into firmware -COMP(1984, hx21i, hx21, 0, hx21i, msx, driver_device, 0, "Toshiba", "HX-21I (MSX1)", 0) -COMP(1984, hx22, 0, 0, hx22, msxjp, driver_device, 0, "Toshiba", "HX-22 (MSX1)", MACHINE_NOT_WORKING) // Does not go into firmware -COMP(1984, hx22i, hx22, 0, hx22i, msx, driver_device, 0, "Toshiba", "HX-22I (MSX1)", 0) -COMP(198?, hc5, hc7, 0, hc5, msxjp, driver_device, 0, "Victor", "HC-5 (MSX1)", 0) -COMP(198?, hc6, hc7, 0, hc6, msxjp, driver_device, 0, "Victor", "HC-6 (MSX1)", 0) -COMP(198?, hc7, 0, 0, hc7, msxjp, driver_device, 0, "Victor", "HC-7 (MSX1)", 0) -COMP(1984, cx5f1, cx5f, 0, cx5f1, msxjp, driver_device, 0, "Yamaha", "CX5F (w/SFG01) (MSX1)", 0) -COMP(1984, cx5f, 0, 0, cx5f, msxjp, driver_device, 0, "Yamaha", "CX5F (w/SFG05) (MSX1)", 0) -COMP(1984, cx5m, cx5m128, 0, cx5m, msx, driver_device, 0, "Yamaha", "CX5M (MSX1)", 0) -COMP(1984, cx5m128, 0, 0, cx5m128, msx, driver_device, 0, "Yamaha", "CX5M-128 (MSX1)", 0) -COMP(1984, cx5m2, cx5m128, 0, cx5m2, msx, driver_device, 0, "Yamaha", "CX5MII (MSX1)", 0) -COMP(1984, yis303, 0, 0, yis303, msx, driver_device, 0, "Yamaha", "YIS303 (MSX1)", 0) -COMP(1984, yis503, 0, 0, yis503, msx, driver_device, 0, "Yamaha", "YIS503 (MSX1)", 0) -COMP(19??, yis503f, yis503, 0, yis503f, msx, driver_device, 0, "Yamaha", "YIS503F (MSX1)", 0) -COMP(1984, yis503ii, yis503, 0, yis503ii, msx, driver_device, 0, "Yamaha", "YIS503II (MSX1)", 0) -COMP(1986, y503iir, yis503, 0, y503iir, msx, driver_device, 0, "Yamaha", "YIS503IIR (Russian) (MSX1)", 0) -COMP(1986, y503iir2, yis503, 0, y503iir2, msx, driver_device, 0, "Yamaha", "YIS503IIR (Estonian) (MSX1)", 0) -COMP(1984, yis503m, yis503, 0, yis503m, msx, driver_device, 0, "Yamaha", "YIS503M (MSX1)", 0) -COMP(1984, yc64, 0, 0, yc64, msx, driver_device, 0, "Yashica", "YC-64 (MSX1)", 0) -COMP(1984, mx64, 0, 0, mx64, msxkr, driver_device, 0, "Yeno", "MX64 (MSX1)", 0) - -/* MSX2 */ -COMP(1986, ax350, 0, 0, ax350, msx2, driver_device, 0, "Al Alamiah", "AX-350 (Arabic) (MSX2)", 0) -COMP(1986, ax370, 0, 0, ax370, msx2, driver_device, 0, "Al Alamiah", "AX-370 (Arabic) (MSX2)", 0) -COMP(1985, canonv25, 0, 0, canonv25, msx2, driver_device, 0, "Canon", "V-25 (MSX2)", 0) -COMP(1985, canonv30, 0, 0, canonv30, msx2, driver_device, 0, "Canon", "V-30 (MSX2)", 0) -COMP(1985, canonv30f, canonv30, 0, canonv30f, msx2, driver_device, 0, "Canon", "V-30F (MSX2)", 0) -COMP(1986, cpc300, 0, 0, cpc300, msx2kr, driver_device, 0, "Daewoo", "IQ-2000 CPC-300 (Korea) (MSX2)", 0) -COMP(1986, cpc300e, 0, 0, cpc300e, msx2kr, driver_device, 0, "Daewoo", "IQ-2000 CPC-300E (Korea) (MSX2)", 0) -COMP(1985, cpc330k, 0, 0, cpc330k, msx2kr, driver_device, 0, "Daewoo", "CPC-330K KOBO (Korea) (MSX2)", 0) -COMP(1988, cpc400, 0, 0, cpc400, msx2kr, driver_device, 0, "Daewoo", "X-II CPC-400 (Korea) (MSX2)", 0) -COMP(1988, cpc400s, 0, 0, cpc400s, msx2kr, driver_device, 0, "Daewoo", "X-II CPC-400S (Korea) (MSX2)", 0) -COMP(1990, cpc61, 0, 0, cpc61, msx2kr, driver_device, 0, "Daewoo", "Zemmix CPC-61 (Korea) (MSX2)", 0) -COMP(1991, cpg120, 0, 0, cpg120, msx2kr, driver_device, 0, "Daewoo", "Zemmix CPG-120 Normal (Korea) (MSX2)", MACHINE_NOT_WORKING) // v9958 not added -COMP(198?, fpc900, 0, 0, fpc900, msx2, driver_device, 0, "Fenner", "FPC-900 (MSX2)", 0) -COMP(1986, expert20, 0, 0, expert20, msx2, driver_device, 0, "Gradiente", "Expert 2.0 (Brazil) (MSX2)", 0) -COMP(198?, mbh70, 0, 0, mbh70, msx2jp, driver_device, 0, "Hitachi", "MB-H70 (MSX2)", MACHINE_NOT_WORKING) // Firmware not working -COMP(1987, kmc5000, 0, 0, kmc5000, msx2jp, driver_device, 0, "Kawai", "KMC-5000 (MSX2)", 0) -COMP(1985, mlg1, 0, 0, mlg1, msx2, driver_device, 0, "Mitsubishi", "ML-G1 (MSX2)", 0) -COMP(198?, mlg3, 0, 0, mlg3, msx2, driver_device, 0, "Mitsubishi", "ML-G3 (MSX2)", 0) -COMP(1985, mlg10, 0, 0, mlg10, msx2jp, driver_device, 0, "Mitsubishi", "ML-G10 (MSX2)", 0) -COMP(1983, mlg30, 0, 0, mlg30, msx2, driver_device, 0, "Mitsubishi", "ML-G30 (MSX2)", 0) -COMP(1985, fs5500f1, fs5500f2, 0, fs5500f1, msx2jp, driver_device, 0, "National / Matsushita", "FS-5500F1 (Japan) (MSX2)", 0) -COMP(1985, fs5500f2, 0, 0, fs5500f2, msx2jp, driver_device, 0, "National / Matsushita", "FS-5500F2 (Japan) (MSX2)", 0) -COMP(1986, fs4500, 0, 0, fs4500, msx2jp, driver_device, 0, "National / Matsushita", "FS-4500 (Japan) (MSX2)", 0) -COMP(1986, fs4700, 0, 0, fs4700, msx2jp, driver_device, 0, "National / Matsushita", "FS-4700 (Japan) (MSX2)", 0) -COMP(1986, fs5000, 0, 0, fs5000, msx2jp, driver_device, 0, "National / Matsushita", "FS-5000F2 (Japan) (MSX2)", 0) -COMP(1986, fs4600, 0, 0, fs4600, msx2jp, driver_device, 0, "National / Matsushita", "FS-4600 (Japan) (MSX2)", 0) -COMP(1986, fsa1, fsa1a, 0, fsa1, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1 / 1st released version (Japan) (MSX2)", 0) -COMP(1986, fsa1a, 0, 0, fsa1a, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1 / 2nd released version (Japan) (MSX2)", 0) -COMP(1987, fsa1mk2, 0, 0, fsa1mk2, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1MK2 (Japan) (MSX2)", 0) -COMP(1987, fsa1f, 0, 0, fsa1f, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1F (Japan) (MSX2)", 0) -COMP(1987, fsa1fm, 0, 0, fsa1fm, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1FM (Japan) (MSX2)", 0) -COMP(1986, nms8220, nms8220a, 0, nms8220, msx2, driver_device, 0, "Philips", "NMS-8220 (12-jun-1986) (MSX2)", 0) -COMP(1986, nms8220a, 0, 0, nms8220a, msx2, driver_device, 0, "Philips", "NMS-8220 (13-aug-1986) (MSX2)", 0) -COMP(1986, vg8230, 0, 0, vg8230, msx2, driver_device, 0, "Philips", "VG-8230 (MSX2)", 0) -COMP(19??, vg8230j, vg8230, 0, vg8230j, msx2jp, driver_device, 0, "Philips", "VG-8230J (MSX2)", MACHINE_NOT_WORKING) // Screen flashes a few times before going into basic -COMP(1986, vg8235, 0, 0, vg8235, msx2, driver_device, 0, "Philips", "VG-8235 (MSX2)", 0) -COMP(1986, vg8235f, vg8235, 0, vg8235f, msx2, driver_device, 0, "Philips", "VG-8235F (MSX2)", 0) -COMP(1986, vg8240, 0, 0, vg8240, msx2, driver_device, 0, "Philips", "VG-8240 (MSX2)", 0) -COMP(1986, nms8245, 0, 0, nms8245, msx2, driver_device, 0, "Philips", "NMS-8245 (MSX2)", 0) -COMP(1986, nms8245f, nms8245, 0, nms8245f, msx2, driver_device, 0, "Philips", "NMS-8245F (MSX2)", 0) -COMP(1986, nms8250, nms8255, 0, nms8250, msx2, driver_device, 0, "Philips", "NMS-8250 (MSX2)", 0) -COMP(1986, nms8250f, nms8255, 0, nms8250f, msx2, driver_device, 0, "Philips", "NMS-8250F (MSX2)", 0) // French keyboard -COMP(19??, nms8250j, nms8255, 0, nms8250j, msx2jp, driver_device, 0, "Philips", "NMS-8250J (MSX2)", 0) -COMP(1986, nms8255, 0, 0, nms8255, msx2, driver_device, 0, "Philips", "NMS-8255 (MSX2)", 0) -COMP(1986, nms8255f, nms8255, 0, nms8255f, msx2, driver_device, 0, "Philips", "NMS-8255F (MSX2)", 0) // French keyboard -COMP(1986, nms8260, 0, 0, nms8260, msx2, driver_device, 0, "Philips", "NMS-8260 (Prototype) (MSX2)", MACHINE_NOT_WORKING) -COMP(1986, nms8280, 0, 0, nms8280, msx2, driver_device, 0, "Philips", "NMS-8280 (MSX2)", 0) -COMP(1986, nms8280f, nms8280, 0, nms8280f, msx2, driver_device, 0, "Philips", "NMS-8280F (MSX2)", 0) // French keyboard -COMP(1986, nms8280g, nms8280, 0, nms8280g, msx2, driver_device, 0, "Philips", "NMS-8280G (MSX2)", 0) -COMP(19??, mpc2300, 0, 0, mpc2300, msx2, driver_device, 0, "Sanyo", "MPC-2300 (MSX2)", MACHINE_NOT_WORKING) // Keyboard responds differently -COMP(198?, mpc2500f, 0, 0, mpc2500f, msx2, driver_device, 0, "Sanyo", "MPC-2500FD (MSX2)", MACHINE_NOT_WORKING) // Russian keyboard? -COMP(19??, mpc25fd, 0, 0, mpc25fd, msx2, driver_device, 0, "Sanyo", "Wavy MPC-25FD (MSX2)", 0) -COMP(198?, mpc27, 0, 0, mpc27, msx2jp, driver_device, 0, "Sanyo", "Wavy MPC-27 (MSX2)", MACHINE_NOT_WORKING) // Light pen not emulated -COMP(1988, phc23, 0, 0, phc23, msx2jp, driver_device, 0, "Sanyo", "Wavy PHC-23 (Japan) (MSX2)", 0) -COMP(198?, phc55fd2, 0, 0, phc55fd2, msx2jp, driver_device, 0, "Sanyo", "Wavy PHC-55FD2 (MSX2)", 0) -COMP(198?, phc77, 0, 0, phc77, msx2jp, driver_device, 0, "Sanyo", "Wavy PHC-77 (MSX2)", MACHINE_NOT_WORKING) // Firmware not emulated -COMP(1986, hbf1, 0, 0, hbf1, msx2jp, driver_device, 0, "Sony", "HB-F1 (Japan) (MSX2)", MACHINE_NOT_WORKING ) // Screen stays a single color after a while -COMP(1987, hbf12, 0, 0, hbf12, msx2jp, driver_device, 0, "Sony", "HB-F1II (Japan) (MSX2)", MACHINE_NOT_WORKING ) // Screen stays a single color after a while -COMP(1987, hbf1xd, 0, 0, hbf1xd, msx2jp, driver_device, 0, "Sony", "HB-F1XD (Japan) (MSX2)", 0) -COMP(1988, hbf1xdm2, 0, 0, hbf1xdm2, msx2jp, driver_device, 0, "Sony", "HB-F1XDMK2 (Japan) (MSX2)", 0) -COMP(19??, hbf5, 0, 0, hbf5, msx2, driver_device, 0, "Sony", "HB-F5 (MSX2)", 0) -COMP(1985, hbf9p, 0, 0, hbf9p, msx2, driver_device, 0, "Sony", "HB-F9P (MSX2)", 0) -COMP(19??, hbf9pr, hbf9p, 0, hbf9pr, msx2, driver_device, 0, "Sony", "HB-F9P Russion (MSX2)", MACHINE_NOT_WORKING) // Keyboard responds differently -COMP(1985, hbf9s, hbf9p, 0, hbf9s, msx2, driver_device, 0, "Sony", "HB-F9S (MSX2)", 0) -COMP(1986, hbf500, hbf500p, 0, hbf500, msx2jp, driver_device, 0, "Sony", "HB-F500 (Japan) (MSX2)", 0) -COMP(198?, hbf500f, hbf500p, 0, hbf500f, msx2, driver_device, 0, "Sony", "HB-F500F (MSX2)", 0) // French keyboard? -COMP(1985, hbf500p, 0, 0, hbf500p, msx2, driver_device, 0, "Sony", "HB-F500P (MSX2)", 0) -COMP(1985, hbf700d, hbf700p, 0, hbf700d, msx2, driver_device, 0, "Sony", "HB-F700D (Germany) (MSX2)", 0) -COMP(1985, hbf700f, hbf700p, 0, hbf700f, msx2, driver_device, 0, "Sony", "HB-F700F (MSX2)", 0) -COMP(1985, hbf700p, 0, 0, hbf700p, msx2, driver_device, 0, "Sony", "HB-F700P (MSX2)", 0) -COMP(1985, hbf700s, hbf700p, 0, hbf700s, msx2, driver_device, 0, "Sony", "HB-F700S (Spain) (MSX2)", 0) -COMP(1986, hbf900, hbf900a, 0, hbf900, msx2jp, driver_device, 0, "Sony", "HB-F900 / 1st released version (Japan) (MSX2)", 0) -COMP(1986, hbf900a, 0, 0, hbf900a, msx2jp, driver_device, 0, "Sony", "HB-F900 / 2nd released version (Japan) (MSX2)", 0) -COMP(1986, hbg900ap, hbg900p, 0, hbg900ap, msx2, driver_device, 0, "Sony", "HB-G900AP (MSX2)", 0 ) -COMP(1986, hbg900p, 0, 0, hbg900p, msx2, driver_device, 0, "Sony", "HB-G900P (MSX2)", 0 ) -COMP(1986, hotbit20, 0, 0, hotbit20, msx2, driver_device, 0, "Sharp / Epcom", "HB-8000 Hotbit 2.0 (MSX2)", 0) // Black screen -COMP(1986, tpc310, 0, 0, tpc310, msx2, driver_device, 0, "Talent", "TPC-310 (MSX2)", 0) -COMP(19??, tpp311, 0, 0, tpp311, msx2, driver_device, 0, "Talent", "TPP-311 (MSX2)", 0) -COMP(19??, tps312, 0, 0, tps312, msx2, driver_device, 0, "Talent", "TPS-312 (MSX2)", 0) -COMP(1986, hx23, hx23i, 0, hx23, msx2, driver_device, 0, "Toshiba", "HX-23 (MSX2)", 0) -COMP(1986, hx23f, hx23i, 0, hx23f, msx2, driver_device, 0, "Toshiba", "HX-23F (MSX2)", 0) -COMP(190?, hx23i, 0, 0, hx23i, msx2, driver_device, 0, "Toshiba", "HX-23I (MSX2)", 0) -COMP(1985, hx33, 0, 0, hx33, msx2jp, driver_device, 0, "Toshiba", "HX-33 (MSX2)", 0) -COMP(1985, hx34, hx34i, 0, hx34, msx2jp, driver_device, 0, "Toshiba", "HX-34 (MSX2)", 0) -COMP(1985, hx34i, 0, 0, hx34i, msx, driver_device, 0, "Toshiba", "HX-34I (MSX2)", 0) -COMP(1985, fstm1, 0, 0, fstm1, msx, driver_device, 0, "Toshiba", "FS-TM1 (MSX2)", 0) -COMP(198?, victhc90, victhc95, 0, victhc90, msxjp, driver_device, 0, "Victor", "HC-90 (MSX2)", MACHINE_NOT_WORKING) // 2nd cpu/turbo not emulated, firmware won't start -COMP(1986, victhc95, 0, 0, victhc95, msxjp, driver_device, 0, "Victor", "HC-95 (MSX2)", MACHINE_NOT_WORKING) // 2nd cpu/turbo not emulated, firmware won't start -COMP(1986, victhc95a, victhc95, 0, victhc95a, msxjp, driver_device, 0, "Victor", "HC-95A (MSX2)", MACHINE_NOT_WORKING) // 2nd cpu/turbo not emulated, firmware won't start -COMP(1986, cx7m, cx7m128, 0, cx7m, msx2, driver_device, 0, "Yamaha", "CX7M (MSX2)", 0) -COMP(1986, cx7m128, 0, 0, cx7m128, msx2, driver_device, 0, "Yamaha", "CX7M/128 (MSX2)", 0) -COMP(198?, y503iiir, 0, 0, y503iiir, msx2, driver_device, 0, "Yamaha", "YIS-503 III R (Russian) (MSX2)", MACHINE_NOT_WORKING) // Russian keyboard, floppy support broken -COMP(198?, y503iiire, y503iiir, 0, y503iiire, msx2, driver_device, 0, "Yamaha", "YIS-503 III R (Estonian) (MSX2)", MACHINE_NOT_WORKING) // Russian/Estonian keyboard, floppy support broken -COMP(1985, yis60464, yis604, 0, yis60464, msx2jp, driver_device, 0, "Yamaha", "YIS604 (64KB) (MSX2)", 0) -COMP(1985, yis604, 0, 0, yis604, msx2jp, driver_device, 0, "Yamaha", "YIS604 (128KB) (MSX2)", 0) -COMP(198?, y805128, y805256, 0, y805128, msx2jp, driver_device, 0, "Yamaha", "YIS805/128 (Russian) (MSX2)", MACHINE_NOT_WORKING) // Floppy support broken -COMP(198?, y805128r2, y805256, 0, y805128r2, msx2jp, driver_device, 0, "Yamaha", "YIS805R2/128 (Russian) (MSX2)", MACHINE_NOT_WORKING) // Floppy support broken -COMP(198?, y805128r2e, y805256, 0, y805128r2e, msx2jp, driver_device, 0, "Yamaha", "YIS805R2/128 (Estonian) (MSX2)", MACHINE_NOT_WORKING) // Floppy support broken -COMP(198?, y805256, 0, 0, y805256, msx2jp, driver_device, 0, "Yamaha", "YIS805/256 (Russian) (MSX2)", MACHINE_NOT_WORKING) // Floppy support broken - -/* MSX2+ */ -COMP(19??, expert3i, 0, 0, expert3i, msx2, driver_device, 0, "Ciel", "Expert 3 IDE (MSX2+)", MACHINE_NOT_WORKING ) // Some hardware not emulated -COMP(1996, expert3t, 0, 0, expert3t, msx2, driver_device, 0, "Ciel", "Expert 3 Turbo (MSX2+)", MACHINE_NOT_WORKING ) // Some hardware not emulated -COMP(19??, expertac, 0, 0, expertac, msx2, driver_device, 0, "Gradiente", "Expert AC88+ (MSX2+)", MACHINE_NOT_WORKING ) // Some hardware not emulated -COMP(19??, expertdx, 0, 0, expertdx, msx2, driver_device, 0, "Gradiente", "Expert DDX+ (MSX2+)", MACHINE_NOT_WORKING ) // Some hardware not emulated -COMP(1988, fsa1fx, 0, 0, fsa1fx, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1FX (Japan) (MSX2+)", 0 ) -COMP(1988, fsa1wx, fsa1wxa, 0, fsa1wx, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1WX / 1st released version (Japan) (MSX2+)", 0 ) -COMP(1988, fsa1wxa, 0, 0, fsa1wxa, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1WX / 2nd released version (Japan) (MSX2+)", 0 ) -COMP(1989, fsa1wsx, 0, 0, fsa1wsx, msx2jp, driver_device, 0, "Panasonic / Matsushita", "FS-A1WSX (Japan) (MSX2+)", 0 ) -COMP(1988, hbf1xdj, 0, 0, hbf1xdj, msx2jp, driver_device, 0, "Sony", "HB-F1XDJ (Japan) (MSX2+)", 0 ) -COMP(1989, hbf1xv, 0, 0, hbf1xv, msx2jp, driver_device, 0, "Sony", "HB-F1XV (Japan) (MSX2+)", 0 ) -COMP(1988, phc70fd, phc70fd2, 0, phc70fd, msx2jp, driver_device, 0, "Sanyo", "WAVY PHC-70FD (Japan) (MSX2+)", 0 ) -COMP(1988, phc70fd2, 0, 0, phc70fd2, msx2jp, driver_device, 0, "Sanyo", "WAVY PHC-70FD2 (Japan) (MSX2+)", 0 ) -COMP(1989, phc35j, 0, 0, phc35j, msx2jp, driver_device, 0, "Sanyo", "WAVY PHC-35J (Japan) (MSX2+)", 0) -COMP(19??, hbf9sp, 0, 0, hbf9sp, msx2jp, driver_device, 0, "Sony", "HB-F9S+ (MSX2+)", 0) - -/* MSX Turbo-R */ -/* Temporary placeholders, Turbo-R hardware is not supported yet */ -COMP(19??, fsa1gt, 0, 0, fsa1gt, msx2jp, driver_device, 0, "Panasonic", "FS-A1GT (MSX Turbo-R)", MACHINE_NOT_WORKING) -COMP(19??, fsa1st, 0, 0, fsa1st, msx2jp, driver_device, 0, "Panasonic", "FS-A1ST (MSX Turbo-R)", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/mt735.c b/src/mess/drivers/mt735.c deleted file mode 100644 index 569f612d875..00000000000 --- a/src/mess/drivers/mt735.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - Brother MT735 thermal printer -*/ - - -#include "emu.h" -#include "cpu/m68000/m68000.h" - -class mt735_state : public driver_device -{ -public: - mt735_state(const machine_config &mconfig, device_type type, const char *tag); - - required_device m_cpu; - - DECLARE_READ8_MEMBER(p4_r); - DECLARE_READ8_MEMBER(p5_r); - - virtual void machine_start(); - virtual void machine_reset(); -}; - -mt735_state::mt735_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_cpu(*this, "maincpu") -{ -} - -void mt735_state::machine_start() -{ -} - -void mt735_state::machine_reset() -{ -} - -READ8_MEMBER(mt735_state::p4_r) -{ - logerror("p4_r (%06x)\n", space.device().safe_pc()); - return 0xe0; -} - -READ8_MEMBER(mt735_state::p5_r) -{ - logerror("p5_r (%06x)\n", space.device().safe_pc()); - return 0x00; -} - -static ADDRESS_MAP_START( mt735_map, AS_PROGRAM, 16, mt735_state ) - AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x278000, 0x287fff) AM_RAM - AM_RANGE(0x400000, 0x4fffff) AM_RAM - AM_RANGE(0xff8004, 0xff8005) AM_READ8(p4_r, 0xff00) - AM_RANGE(0xff8004, 0xff8005) AM_READ8(p5_r, 0x00ff) -ADDRESS_MAP_END - -static INPUT_PORTS_START( mt735 ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( mt735, mt735_state ) - MCFG_CPU_ADD("maincpu", M68000, XTAL_48MHz/6) - MCFG_CPU_PROGRAM_MAP(mt735_map) -MACHINE_CONFIG_END - -ROM_START( mt735 ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "spg_m_e_ic103.bin", 0, 0x20000, CRC(1ab58bc9) SHA1(c10d50f38819c037d28435b77e09f2b6923e8369) ) - ROM_LOAD16_BYTE( "spg_m_o_ic102.bin", 1, 0x20000, CRC(84d8446b) SHA1(b1cedd8b09556eb8118f79b012aeec5b61e3ff32) ) -ROM_END - -COMP( ????, mt735, 0, 0, mt735, mt735, driver_device, 0, "Brother", "MT735", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/mtx.c b/src/mess/drivers/mtx.c deleted file mode 100644 index f6839299480..00000000000 --- a/src/mess/drivers/mtx.c +++ /dev/null @@ -1,444 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Lee Ward, Dirk Best, Curt Coder -/************************************************************************* - - Memotech MTX 500, MTX 512 and RS 128 - -**************************************************************************/ - -/* - - TODO: - - - cassette - - cartridges - - SDX/FDX floppy - - HDX hard disk - - HRX high resolution graphics - - CBM (all RAM) mode - - "Silicon" disks - - Multi Effect Video Wall - - */ - -#include "emu.h" -#include "includes/mtx.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "imagedev/snapquik.h" -#include "bus/centronics/ctronics.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "video/tms9928a.h" -#include "sound/sn76496.h" - -/*************************************************************************** - MEMORY MAPS -***************************************************************************/ - -/*------------------------------------------------- - ADDRESS_MAP( mtx_mem ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( mtx_mem, AS_PROGRAM, 8, mtx_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1") - AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank2") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank3") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank4") - AM_RANGE(0xc000, 0xffff) AM_RAM -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( mtx_io ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( mtx_io, AS_IO, 8, mtx_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READWRITE(mtx_strobe_r, mtx_bankswitch_w) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("tms9929a", tms9929a_device, vram_read, vram_write) - AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("tms9929a", tms9929a_device, register_read, register_write) - AM_RANGE(0x03, 0x03) AM_READWRITE(mtx_sound_strobe_r, mtx_cst_w) - AM_RANGE(0x04, 0x04) AM_READ(mtx_prt_r) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x05, 0x05) AM_READWRITE(mtx_key_lo_r, mtx_sense_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(mtx_key_hi_r, mtx_sound_latch_w) -// AM_RANGE(0x07, 0x07) PIO - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x30, 0x31) AM_WRITE(hrx_address_w) - AM_RANGE(0x32, 0x32) AM_READWRITE(hrx_data_r, hrx_data_w) - AM_RANGE(0x33, 0x33) AM_READWRITE(hrx_attr_r, hrx_attr_w) -// AM_RANGE(0x38, 0x38) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) -// AM_RANGE(0x39, 0x39) AM_DEVWRITE(MC6845_TAG, mc6845_device, register_r, register_w) -/* AM_RANGE(0x40, 0x43) AM_DEVREADWRITE_LEGACY(FD1791_TAG, wd17xx_r, wd17xx_w) - AM_RANGE(0x44, 0x44) AM_READWRITE(fdx_status_r, fdx_control_w) - AM_RANGE(0x45, 0x45) AM_WRITE(fdx_drv_sel_w) - AM_RANGE(0x46, 0x46) AM_WRITE(fdx_dma_lo_w) - AM_RANGE(0x47, 0x47) AM_WRITE(fdx_dma_hi_w)*/ -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( rs128_io ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( rs128_io, AS_IO, 8, mtx_state ) - AM_IMPORT_FROM(mtx_io) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, cd_ba_r, cd_ba_w) -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/*------------------------------------------------- - INPUT_PORTS( mtx512 ) --------------------------------------------------*/ - -static INPUT_PORTS_START( mtx512 ) - PORT_START("ROW0") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Page") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("ROW1") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 EOL") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("ROW2") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('\t') PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("ROW3") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Linefeed") PORT_CODE(KEYCODE_PRTSCR) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("ROW4") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AlphaLock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("ROW5") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("ROW6") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("ROW7") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter CLS") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("country_code") - PORT_DIPNAME(0x04, 0x00, "Country Code Switch 1") - PORT_DIPSETTING(0x04, DEF_STR(Off) ) - PORT_DIPSETTING(0x00, DEF_STR(On) ) - PORT_DIPNAME(0x08, 0x00, "Country Code Switch 0") - PORT_DIPSETTING(0x08, DEF_STR(Off) ) - PORT_DIPSETTING(0x00, DEF_STR(On) ) - PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/*************************************************************************** - DEVICE CONFIGURATION -***************************************************************************/ - -/*------------------------------------------------- - Z80CTC --------------------------------------------------*/ - -TIMER_DEVICE_CALLBACK_MEMBER(mtx_state::ctc_tick) -{ - m_z80ctc->trg1(1); - m_z80ctc->trg1(0); - m_z80ctc->trg2(1); - m_z80ctc->trg2(0); -} - -WRITE_LINE_MEMBER(mtx_state::ctc_trg1_w) -{ - if (m_z80dart) - { - m_z80dart->rxca_w(state); - m_z80dart->txca_w(state); - } -} - -WRITE_LINE_MEMBER(mtx_state::ctc_trg2_w) -{ - if (m_z80dart) - { - m_z80dart->rxtxcb_w(state); - } -} - -/*------------------------------------------------- - z80_daisy_config mtx_daisy_chain --------------------------------------------------*/ - -static const z80_daisy_config mtx_daisy_chain[] = -{ - { Z80CTC_TAG }, - { NULL } -}; - -/*------------------------------------------------- - z80_daisy_config rs128_daisy_chain --------------------------------------------------*/ - -static const z80_daisy_config rs128_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80DART_TAG }, - { NULL } -}; - - -TIMER_DEVICE_CALLBACK_MEMBER(mtx_state::cassette_tick) -{ - int data = ((m_cassette)->input() > +0.0) ? 0 : 1; - - m_z80ctc->trg3(data); -} - -/*------------------------------------------------- - mtx_tms9928a_interface --------------------------------------------------*/ - -WRITE_LINE_MEMBER(mtx_state::mtx_tms9929a_interrupt) -{ - m_z80ctc->trg0(state ? 0 : 1); -} - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -/*------------------------------------------------- - MACHINE_CONFIG_START( mtx512, mtx_state ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( mtx512, mtx_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(mtx_mem) - MCFG_CPU_IO_MAP(mtx_io) - MCFG_CPU_CONFIG(mtx_daisy_chain) - - MCFG_MACHINE_START_OVERRIDE(mtx_state,mtx512) - MCFG_MACHINE_RESET_OVERRIDE(mtx_state,mtx512) - - /* video hardware */ - MCFG_DEVICE_ADD( "tms9929a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(mtx_state, mtx_tms9929a_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9929a", tms9929a_device, screen_update ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SN76489A_TAG, SN76489A, XTAL_4MHz) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(mtx_state, ctc_trg1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(mtx_state, ctc_trg2_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_timer", mtx_state, ctc_tick, attotime::from_hz(XTAL_4MHz/13)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(mtx_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(mtx_state, write_centronics_fault)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(mtx_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(mtx_state, write_centronics_select)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_SNAPSHOT_ADD("snapshot", mtx_state, mtx, "mtx", 1) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - MCFG_CASSETTE_INTERFACE("mtx_cass") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", mtx_state, cassette_tick, attotime::from_hz(44100)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("96K,128K,160K,192K,224K,256K,288K,320K,352K,384K,416K,448K,480K,512K") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "mtx_cass") -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_CONFIG_DERIVED( mtx500, mtx512 ) --------------------------------------------------*/ - -static MACHINE_CONFIG_DERIVED( mtx500, mtx512 ) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("64K,96K,128K,160K,192K,224K,256K,288K,320K,352K,384K,416K,448K,480K,512K") -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_CONFIG_DERIVED( rs128, mtx512 ) --------------------------------------------------*/ - -static MACHINE_CONFIG_DERIVED( rs128, mtx512 ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY(Z80_TAG) - MCFG_CPU_IO_MAP(rs128_io) - MCFG_CPU_CONFIG(rs128_daisy_chain) - - /* devices */ - MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_4MHz, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("160K,192K,224K,256K,288K,320K,352K,384K,416K,448K,480K,512K") -MACHINE_CONFIG_END - -/*************************************************************************** - ROMS -***************************************************************************/ - -ROM_START( mtx512 ) - ROM_REGION( 0x02000, "user1", 0 ) - ROM_LOAD( "osrom", 0x0000, 0x2000, CRC(9ca858cc) SHA1(3804503a58f0bcdea96bb6488833782ebd03976d) ) - - ROM_REGION( 0x10000, "user2", 0 ) - ROM_LOAD( "basicrom", 0x0000, 0x2000, CRC(87b4e59c) SHA1(c49782a82a7f068c1195cd967882ba9edd546eaf) ) - ROM_LOAD( "assemrom", 0x2000, 0x2000, CRC(9d7538c3) SHA1(d1882c4ea61a68b1715bd634ded5603e18a99c5f) ) - ROM_LOAD( "newword0", 0x4000, 0x2000, CRC(5433bd01) SHA1(56897f385476864337b7b994c1b46f50eaa57128) ) - ROM_LOAD( "newword1", 0x6000, 0x2000, CRC(10980c03) SHA1(8245c42fb1eda43b67fa483e50e4ee3bc5f3f29f) ) - ROM_LOAD( "newword2", 0x8000, 0x2000, CRC(cbff7130) SHA1(b4ab27def6020ba8e32959a1b988fce77bcc1d7f) ) - ROM_LOAD( "newword3", 0xa000, 0x2000, CRC(e6bbc33b) SHA1(26faa4a8d952c4659f610e94608b630456ab89aa) ) - - ROM_REGION( 0x2000, "sdx", 0 ) - ROM_LOAD( "sdx", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x2000, "mtx", 0 ) - ROM_LOAD( "sm2 fdcx1 v03", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x1000, MC6845_TAG, 0 ) - ROM_LOAD( "80z.bin", 0x0000, 0x1000, CRC(ea6fe865) SHA1(f84883f79bed34501e5828336894fad929bddbb5) ) - - /* Device GAL16V8 converted from PAL14L4 JEDEC map */ - ROM_REGION( 0x117, "plds", 0 ) - ROM_LOAD( "memotech-mtx512.bin", 0x0000, 0x0117, CRC(31f88133) SHA1(5bef3ce764121b3510b538824b2768f082b422bb) ) -ROM_END - -#define rom_mtx500 rom_mtx512 -#define rom_rs128 rom_mtx512 - -/*************************************************************************** - SYSTEM DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, mtx512, 0, 0, mtx512, mtx512, driver_device, 0, "Memotech Ltd", "MTX 512", 0 ) -COMP( 1983, mtx500, mtx512, 0, mtx500, mtx512, driver_device, 0, "Memotech Ltd", "MTX 500", 0 ) -COMP( 1984, rs128, mtx512, 0, rs128, mtx512, driver_device, 0, "Memotech Ltd", "RS 128", 0 ) - - -/* -The following roms are available should they be considered useful: - -ROM_START( mtx_roms ) - ROM_LOAD( "assem.rom", CRC(599d5b6b) SHA1(3ec1f7f476a21ca3206012ded22198c020b47f7d) ) - ROM_LOAD( "basic.rom", CRC(d1e9ff36) SHA1(e89ae3a627716e6cee7e35054be8a2472bdd49d4) ) - ROM_LOAD( "boot.rom", CRC(ed98d6dd) SHA1(4671ee49bb96262b0468f7122a49bf2588170903) ) - ROM_LOAD( "mtx3-an.rom", CRC(54c9eca2) SHA1(3e628beaa360e635264c8c2c3a5b8312951a220b) ) - ROM_LOAD( "nboot.rom", CRC(9caea81c) SHA1(93fca6e7ffbc7ae3283b8bda9f01c36b2bed1c54) ) -ROM_END - -BASIC.ROM this contains the monitor ROM plus the BASIC ROM. - It's good to view them as one, because the monitor - ROM contains a good deal of BASIC code and the machine - code just runs from the monitor ROM into the BASIC ROM. - It's also handy if you want to disassemble it (which - you don't need because it's already done). - -MTX3-AN.ROM the monitor ROM, but slightly modified - While detecting memory size, the startup code destroys - RAM content. When you have a lot of RAM it is convenient - to have a ramdisk for CP/M, but it is a nuisance if the - ramdisk is trashed at each reset. The modification simply - prevents RAM trashing. - -ASSEM.ROM assembler ROM - -BOOT.ROM FDX floppy boot ROM - -NBOOT.ROM replacement FDX boot ROM written by M. Kessler (supports - booting from different disk formats and different drives) -*/ diff --git a/src/mess/drivers/multi16.c b/src/mess/drivers/multi16.c deleted file mode 100644 index 3e9722b990e..00000000000 --- a/src/mess/drivers/multi16.c +++ /dev/null @@ -1,167 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Mitsubishi Multi 16 - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "video/mc6845.h" -#include "machine/pic8259.h" - - -class multi16_state : public driver_device -{ -public: - multi16_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pic(*this, "pic8259"), - m_crtc(*this, "crtc"), - m_palette(*this, "palette") - , - m_p_vram(*this, "p_vram"){ } - - required_device m_maincpu; - required_device m_pic; - required_device m_crtc; - required_device m_palette; - DECLARE_WRITE8_MEMBER(multi16_6845_address_w); - DECLARE_WRITE8_MEMBER(multi16_6845_data_w); - required_shared_ptr m_p_vram; - UINT8 m_crtc_vreg[0x100],m_crtc_index; - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_multi16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - - -void multi16_state::video_start() -{ -} - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - - -UINT32 multi16_state::screen_update_multi16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - int count; - int xi; - - count = 0; - - for(y=0;y> (15-xi)) & 0x1; - - if(screen.visible_area().contains(x*16+xi, y)) - bitmap.pix16(y, x*16+xi) = m_palette->pen(dot); - } - - count++; - } - } - - return 0; -} - -static ADDRESS_MAP_START(multi16_map, AS_PROGRAM, 16, multi16_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0x7ffff) AM_RAM - AM_RANGE(0xd8000,0xdffff) AM_RAM AM_SHARE("p_vram") - AM_RANGE(0xe0000,0xeffff) AM_RAM - AM_RANGE(0xf0000,0xf3fff) AM_MIRROR(0xc000) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -WRITE8_MEMBER( multi16_state::multi16_6845_address_w ) -{ - m_crtc_index = data; - m_crtc->address_w(space, offset, data); -} - -WRITE8_MEMBER( multi16_state::multi16_6845_data_w ) -{ - m_crtc_vreg[m_crtc_index] = data; - m_crtc->register_w(space, offset, data); -} - -static ADDRESS_MAP_START(multi16_io, AS_IO, 16, multi16_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x02, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff) // i8259 - AM_RANGE(0x40, 0x41) AM_WRITE8(multi16_6845_address_w, 0x00ff) - AM_RANGE(0x40, 0x41) AM_WRITE8(multi16_6845_data_w, 0xff00) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( multi16 ) -INPUT_PORTS_END - -void multi16_state::machine_start() -{ -} - - -void multi16_state::machine_reset() -{ -} - - -static MACHINE_CONFIG_START( multi16, multi16_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 8000000) - MCFG_CPU_PROGRAM_MAP(multi16_map) - MCFG_CPU_IO_MAP(multi16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(multi16_state, screen_update_multi16) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - - /* devices */ - MCFG_MC6845_ADD("crtc", H46505, "screen", 16000000/5) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), GND, NULL ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( multi16 ) - ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x4000, CRC(5beb5e94) SHA1(d3b9dc9a08995a0f26af9671893417e795370306)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, multi16, 0, 0, multi16, multi16, driver_device, 0, "Mitsubishi", "Multi 16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/multi8.c b/src/mess/drivers/multi8.c deleted file mode 100644 index d10ea348ea8..00000000000 --- a/src/mess/drivers/multi8.c +++ /dev/null @@ -1,681 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Multi 8 (c) 1983 Mitsubishi - - preliminary driver by Angelo Salese - - TODO: - - dunno how to trigger the text color mode in BASIC, I just modify - $f0b1 to 1 for now - - bitmap B/W mode is untested - - keyboard - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/2203intf.h" -#include "video/mc6845.h" -#include "machine/i8255.h" -#include "sound/beep.h" - - -class multi8_state : public driver_device -{ -public: - multi8_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ppi(*this, "ppi8255_0"), - m_crtc(*this, "crtc"), - m_beeper(*this, "beeper") - { } - - required_device m_maincpu; - required_device m_ppi; - required_device m_crtc; - required_device m_beeper; - DECLARE_WRITE8_MEMBER(multi8_6845_w); - DECLARE_READ8_MEMBER(key_input_r); - DECLARE_READ8_MEMBER(key_status_r); - DECLARE_READ8_MEMBER(multi8_vram_r); - DECLARE_WRITE8_MEMBER(multi8_vram_w); - DECLARE_READ8_MEMBER(pal_r); - DECLARE_WRITE8_MEMBER(pal_w); - DECLARE_READ8_MEMBER(multi8_kanji_r); - DECLARE_WRITE8_MEMBER(multi8_kanji_w); - DECLARE_READ8_MEMBER(porta_r); - DECLARE_WRITE8_MEMBER(portb_w); - DECLARE_WRITE8_MEMBER(portc_w); - DECLARE_WRITE8_MEMBER(ym2203_porta_w); - UINT8 *m_p_vram; - UINT8 *m_p_wram; - UINT8 *m_p_kanji; - UINT8 *m_p_chargen; - UINT8 m_mcu_init; - UINT8 m_keyb_press; - UINT8 m_keyb_press_flag; - UINT8 m_shift_press_flag; - UINT8 m_display_reg; - UINT8 m_crtc_vreg[0x100],m_crtc_index; - UINT8 m_vram_bank; - UINT8 m_pen_clut[8]; - UINT8 m_bw_mode; - UINT16 m_knj_addr; - DECLARE_READ8_MEMBER(ay8912_0_r); - DECLARE_READ8_MEMBER(ay8912_1_r); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_multi8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); - void multi8_draw_pixel(bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width); -}; - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - -void multi8_state::video_start() -{ - m_keyb_press = m_keyb_press_flag = m_shift_press_flag = m_display_reg = 0; - - for (m_bw_mode = 0; m_bw_mode < 8; m_bw_mode++) - m_pen_clut[m_bw_mode]=0; - - m_vram_bank = 8; - m_bw_mode = 0; - m_p_chargen = memregion("chargen")->base(); -} - -void multi8_state::multi8_draw_pixel(bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width) -{ - if(!machine().first_screen()->visible_area().contains(x, y)) - return; - - if(width) - { - bitmap.pix16(y, x*2+0) = pen; - bitmap.pix16(y, x*2+1) = pen; - } - else - bitmap.pix16(y, x) = pen; -} - -UINT32 multi8_state::screen_update_multi8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,count; - UINT8 x_width; - UINT8 xi,yi; - - count = 0x0000; - - x_width = (m_display_reg & 0x40) ? 80 : 40; - - for(y=0; y<200; y++) - { - for(x=0; x<80; x++) - { - for(xi=0; xi<8; xi++) - { - int pen_r,pen_g,pen_b,color; - - pen_b = (m_p_vram[count | 0x0000] >> (7-xi)) & 1; - pen_r = (m_p_vram[count | 0x4000] >> (7-xi)) & 1; - pen_g = (m_p_vram[count | 0x8000] >> (7-xi)) & 1; - - if (m_bw_mode) - { - pen_b = (m_display_reg & 1) ? pen_b : 0; - pen_r = (m_display_reg & 2) ? pen_r : 0; - pen_g = (m_display_reg & 4) ? pen_g : 0; - - color = ((pen_b) | (pen_r) | (pen_g)) ? 7 : 0; - } - else - color = (pen_b) | (pen_r << 1) | (pen_g << 2); - - multi8_draw_pixel(bitmap, y, x*8+xi,m_pen_clut[color], 0); - } - count++; - } - } - - count = 0xc000; - - for(y=0;y<25;y++) - { - for(x=0; x> (7-xi) & 1) ? 0 : color; - else - pen = (m_p_chargen[tile*8+yi] >> (7-xi) & 1) ? color : 0; - - if(pen) - multi8_draw_pixel(bitmap, y*mc6845_tile_height+yi, x*8+xi, pen, (m_display_reg & 0x40) == 0x00); - } - } - - // m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile,color >> 5, 0, 0, x*8, y*8); - - // draw cursor - if(mc6845_cursor_addr+0xc000 == count) - { - int xc,yc,cursor_on; - - cursor_on = 0; - switch(mc6845_cursor_y_start & 0x60) - { - case 0x00: cursor_on = 1; break; //always on - case 0x20: cursor_on = 0; break; //always off - case 0x40: if(machine().first_screen()->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink - case 0x60: if(machine().first_screen()->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink - } - - if(cursor_on) - { - for (yc=0; yc<(mc6845_tile_height-(mc6845_cursor_y_start & 7)); yc++) - { - for (xc=0; xc<8; xc++) - multi8_draw_pixel(bitmap, y*mc6845_tile_height+yc, x*8+xc,0x07,(m_display_reg & 0x40) == 0x00); - - } - } - } - - (m_display_reg & 0x40) ? count++ : count+=2; - } - } - return 0; -} - -WRITE8_MEMBER( multi8_state::multi8_6845_w ) -{ - if (!offset) - { - m_crtc_index = data; - m_crtc->address_w(space, offset, data); - } - else - { - m_crtc_vreg[m_crtc_index] = data; - m_crtc->register_w(space, offset, data); - } -} - -READ8_MEMBER( multi8_state::key_input_r ) -{ - if (m_mcu_init == 0) - { - m_mcu_init++; - return 3; - } - - m_keyb_press_flag &= 0xfe; - - return m_keyb_press; -} - -READ8_MEMBER( multi8_state::key_status_r ) -{ - if (m_mcu_init == 0) - return 1; - else - if (m_mcu_init == 1) - { - m_mcu_init++; - return 1; - } - else - if (m_mcu_init == 2) - { - m_mcu_init++; - return 0; - } - - return m_keyb_press_flag | (m_shift_press_flag << 7); -} - -READ8_MEMBER( multi8_state::multi8_vram_r ) -{ - UINT8 res; - - if (!BIT(m_vram_bank, 4)) //select plain work ram - return m_p_wram[offset]; - - res = 0xff; - - if (!BIT(m_vram_bank, 0)) - res &= m_p_vram[offset | 0x0000]; - - if (!BIT(m_vram_bank, 1)) - res &= m_p_vram[offset | 0x4000]; - - if (!BIT(m_vram_bank, 2)) - res &= m_p_vram[offset | 0x8000]; - - if (!BIT(m_vram_bank, 3)) - res &= m_p_vram[offset | 0xc000]; - - return res; -} - -WRITE8_MEMBER( multi8_state::multi8_vram_w ) -{ - if (!BIT(m_vram_bank, 4)) //select plain work ram - { - m_p_wram[offset] = data; - return; - } - - if (!BIT(m_vram_bank, 0)) - m_p_vram[offset | 0x0000] = data; - - if (!BIT(m_vram_bank, 1)) - m_p_vram[offset | 0x4000] = data; - - if (!BIT(m_vram_bank, 2)) - m_p_vram[offset | 0x8000] = data; - - if (!BIT(m_vram_bank, 3)) - m_p_vram[offset | 0xc000] = data; -} - -READ8_MEMBER( multi8_state::pal_r ) -{ - return m_pen_clut[offset]; -} - -WRITE8_MEMBER( multi8_state::pal_w ) -{ - m_pen_clut[offset] = data; - - UINT8 i; - for(i=0;i<8;i++) - { - if (m_pen_clut[i]) - { - m_bw_mode = 0; - return; - } - m_bw_mode = 1; - } -} - -READ8_MEMBER(multi8_state::ay8912_0_r){ return machine().device("aysnd")->data_r(space, 0); } -READ8_MEMBER(multi8_state::ay8912_1_r){ return machine().device("aysnd")->data_r(space, 1); } - -READ8_MEMBER( multi8_state::multi8_kanji_r ) -{ - return m_p_kanji[(m_knj_addr << 1) | (offset & 1)]; -} - -WRITE8_MEMBER( multi8_state::multi8_kanji_w ) -{ - m_knj_addr = (offset == 0) ? (m_knj_addr & 0xff00) | (data & 0xff) : (m_knj_addr & 0x00ff) | (data << 8); -} - -static ADDRESS_MAP_START(multi8_mem, AS_PROGRAM, 8, multi8_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_READWRITE( multi8_vram_r, multi8_vram_w ) - AM_RANGE(0xc000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(multi8_io, AS_IO, 8, multi8_state) -// ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(key_input_r) AM_WRITENOP//keyboard - AM_RANGE(0x01, 0x01) AM_READ(key_status_r) AM_WRITENOP//keyboard - AM_RANGE(0x18, 0x19) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) - AM_RANGE(0x18, 0x18) AM_READ(ay8912_0_r) - AM_RANGE(0x1a, 0x1a) AM_READ(ay8912_1_r) - AM_RANGE(0x1c, 0x1d) AM_WRITE(multi8_6845_w) -// AM_RANGE(0x20, 0x21) //sio, cmt -// AM_RANGE(0x24, 0x27) //pit - AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) -// AM_RANGE(0x2c, 0x2d) //i8259 - AM_RANGE(0x30, 0x37) AM_READWRITE(pal_r,pal_w) - AM_RANGE(0x40, 0x41) AM_READWRITE(multi8_kanji_r,multi8_kanji_w) //kanji regs -// AM_RANGE(0x70, 0x74) //upd765a fdc -// AM_RANGE(0x78, 0x78) //memory banking -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( multi8 ) - PORT_START("VBLANK") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") - - PORT_START("key1") //0x00-0x1f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x01 soh - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x02 stx - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x03 etx - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x04 etx - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x05 eot - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x06 enq - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x07 ack - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0a - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0b lf - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0c vt - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e cr - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f so - - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x10 si - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x11 dle - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x12 dc1 - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x13 dc2 - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x15 dc4 - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x17 syn - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x18 etb - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1a em - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1c ??? - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1d fs - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1e gs - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1f us - - PORT_START("key2") //0x20-0x3f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2e . - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2f / - - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? - - PORT_START("key3") //0x40-0x5f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") - - PORT_START("key_modifiers") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) -INPUT_PORTS_END - -TIMER_DEVICE_CALLBACK_MEMBER(multi8_state::keyboard_callback) -{ - static const char *const portnames[3] = { "key1","key2","key3" }; - int i,port_i,scancode; - UINT8 keymod = ioport("key_modifiers")->read() & 0x1f; - scancode = 0; - - m_shift_press_flag = ((keymod & 0x02) >> 1); - - for(port_i=0;port_i<3;port_i++) - { - for(i=0;i<32;i++) - { - if((ioport(portnames[port_i])->read()>>i) & 1) - { - //key_flag = 1; - if(!m_shift_press_flag) // shift not pressed - { - if(scancode >= 0x41 && scancode < 0x5b) - scancode += 0x20; // lowercase - } - else - { - if(scancode >= 0x31 && scancode < 0x3a) - scancode -= 0x10; - if(scancode == 0x30) - scancode = 0x3d; - - if(scancode == 0x3b) - scancode = 0x2c; - - if(scancode == 0x3a) - scancode = 0x2e; - if(scancode == 0x5b) - scancode = 0x2b; - if(scancode == 0x3c) - scancode = 0x3e; - } - m_keyb_press = scancode; - m_keyb_press_flag = 1; - return; - } - scancode++; - } - } -} - -static const gfx_layout multi8_charlayout = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP8(0,1) }, - { STEP8(0,8) }, - 8*8 -}; - -static const gfx_layout multi8_kanjilayout = -{ - 16,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP16(0,1) }, - { STEP16(0,16) }, - 16*16 -}; - -static GFXDECODE_START( multi8 ) - GFXDECODE_ENTRY( "chargen", 0x0000, multi8_charlayout, 0, 1 ) - GFXDECODE_ENTRY( "kanji", 0x0000, multi8_kanjilayout, 0, 1 ) -GFXDECODE_END - - -READ8_MEMBER( multi8_state::porta_r ) -{ - int vsync = (ioport("VBLANK")->read() & 0x1) << 5; - /* - -x-- ---- kanji rom is present (0) yes - --x- ---- vsync - ---- --x- fdc rom is present (0) yes - */ - - return 0x9f | vsync | 0x00; -} - - -WRITE8_MEMBER( multi8_state::portb_w ) -{ - /* - x--- ---- color mode - -x-- ---- screen width (80 / 40) - ---- x--- memory bank status - ---- -xxx page screen graphics in B/W mode - */ - - m_display_reg = data; -} - -WRITE8_MEMBER( multi8_state::portc_w ) -{ -// printf("Port C w = %02x\n",data); - m_vram_bank = data & 0x1f; - - if (data & 0x20 && data != 0xff) - printf("Work RAM bank selected!\n"); -// fatalerror("Work RAM bank selected\n"); -} - - -WRITE8_MEMBER( multi8_state::ym2203_porta_w ) -{ - m_beeper->set_state((data & 0x08)); -} - -void multi8_state::machine_start() -{ - m_p_vram = memregion("vram")->base(); - m_p_wram = memregion("wram")->base(); - m_p_kanji = memregion("kanji")->base(); -} - -void multi8_state::machine_reset() -{ - m_beeper->set_frequency(1200); //guesswork - m_beeper->set_state(0); - m_mcu_init = 0; -} - -static MACHINE_CONFIG_START( multi8, multi8_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(multi8_mem) - MCFG_CPU_IO_MAP(multi8_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(multi8_state, screen_update_multi8) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", multi8) - - /* Audio */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("aysnd", AY8912, 1500000) //unknown clock / divider - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(multi8_state, ym2203_porta_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) - - /* devices */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", multi8_state, keyboard_callback, attotime::from_hz(240/32)) - - MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_3_579545MHz/2) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(multi8_state, porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(multi8_state, portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(multi8_state, portc_w)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( multi8 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "basic.rom", 0x0000, 0x8000, CRC(2131a3a8) SHA1(0f5a565ecfbf79237badbf9011dcb374abe74a57)) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(08f9ed0e) SHA1(57480510fb30af1372df5a44b23066ca61c6f0d9)) - - ROM_REGION( 0x20000, "kanji", 0 ) - ROM_LOAD( "kanji.rom", 0x0000, 0x20000, BAD_DUMP CRC(c3cb3ff9) SHA1(7173cc5053a281d73cfecfacd31442e21ee7474a)) - - ROM_REGION( 0x0100, "mcu", ROMREGION_ERASEFF ) - ROM_LOAD( "kbd.rom", 0x0000, 0x0100, NO_DUMP ) - - ROM_REGION( 0x1000, "fdc_bios", 0 ) - ROM_LOAD( "disk.rom", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x10000, "vram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x4000, "wram", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, multi8, 0, 0, multi8, multi8, driver_device, 0, "Mitsubishi", "Multi 8", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mvme350.c b/src/mess/drivers/mvme350.c deleted file mode 100644 index 62bf38926d3..00000000000 --- a/src/mess/drivers/mvme350.c +++ /dev/null @@ -1,257 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Joakim Larsson Edstrom -/*************************************************************************** - * - * Motorola MVME-350 6U Intelligent Tape Controller driver, initially derived - * from hk68v10.c - * - * 31/08/2015 - * - * I baught this board from http://www.retrotechnology.com without documentation. - * It has a Motorola 68010 CPU @ 10MHz, 128 Mb RAM and two 2764 EPROMS with - * QIC-02 tape controller firmware. The board also populates a 68230 PIT and loads - * of descrete TTL components. - * - * - * || - * || || - * ||||--|| - * ||||--|| - * || ||__________________________________________________________ ___ - * ||_______________________________________________________ |_| | - * || |74F74 | xxxxx | xxxxx | 74LS245 | 74ALS645| | | | - * || |______|________|_________|___________| ________| | | | - * || |74F74 | xxxxx | xxxxx | 74LS245 | 74ALS645| | | | - * || |______|________|_________|___________| ________| | | | - * || |74LS02| 74LS08||Am25LS251| 74S38 |74LS20|Jumpers | | | - * || |______|_______||_________|_______|______|______| | |VME| - * || |74F04 | 74LS32||74LS374 | 74LS374 |74S244 | | | | - * ||+---+ |______|_______||_________|___________|_________| | |P1 | - * |||CON| |74F04 | 74LS85||74S244 | 74S240 |PAL | | | | - * ||| | |______|_______||_________|___________|_________| | | | - * ||| | |74LS04| | |74S244 | | | | - * ||| | |______| | PIT |_________| | | | - * ||| | |74LS125 | MC68230L10 |74LS145 | | | | - * ||| | |______| __|_______________________|---------| | | | - * ||| | |74LS74| |25LS251 | | RAM |74S244 | |_| | - * ||+---+ ---------- |---------- | HM6264P-12 |---------| |___| - * || | PAL | | 74245 | |______________|74S244 | | - * || +--------- |_________| | U40 27128 |---------| | - * || | 74F32 | | || System ROM |74LS682 | | - * Red || +-------- | CPU || |-+-------| | - * FAIL ||LED | 74F138| | MC68010 |+--------------+ |DIPSW__| | - * Red || +-------- | || RAM | |74S38 | | - * HALT ||LED | 74F32 | |__________|| HM6264P-12 | |______ | | - * Green || +-------+ |74245 |+--------------+ |74F08 | | - * RUN ||LED |XTAL | |__________|| U47 27128 | |______ | |___ - * ||+---+|20MHz | |74244 || System ROM | |74F00 | _| | - * |||CON|--------+___|__________|+--------------+_|_______| | | | - * ||| |74LS08 |74F74 |74LS148| |PAL | | PAL | | | | - * ||| |________|________|_______| |________|_|_________| | | | - * ||| | 74LS138|74F32 | PAL | |74F74 |Am29823 | | | | - * ||| |________|________|_______| |________|-+---------| | |VME| - * ||| | 74LS11 |74F04 |74LS374| |74LS374 | |74S240 | | | | - * ||| |________|________|_______| |________|_|---------| | |P2 | - * ||| | 74F138 |BLANK |74LS374| |74LS374 |74S240 | | | | - * ||| |________|________|_______| +----------+---------| | | | - * ||| | 74LS08 |74F32 |74LS11|74LS393|74LS393|resistors | | | - * ||| |________|________|______|______ |_______|________| | | | - * ||| |DM2585 |74F74 |DM2230| 74LS00| 74F02 |74F32 | | | | - * ||+---+--------+--------+------+-------+---------+------| | | | - * || |74LS74 |74F20 |74S260| 74S74 | 74F08 |74LS02| | | | - * || +------------------------------------------+------| | | | - * || |DM2353 |74F10 |74F32 | 74LS32| 74F08 |DM2353| |_| | - * || +------------------------------------------+------+-+ |___| - * || ||------------------------------------------------------------+-+ - * ||||--|| - * ||||--|| - * || - * - * History of Motorola VME division (https://en.wikipedia.org/wiki/VMEbus) - *--------------------------------- - * When Motorola released the 68000 processor 1979 the ambition of the deisgners - * was also to standardize a versatile CPU bus to be able to build computer - * systems without constructing PCB:s from scratch. This become VersaBus but the - * boards was really too big and the computer world already saw the systems shrink - * in size. Motorola's design center in Munich proposed to use the smaller and - * already used Euroboard form factor and call it Versabus-E. This later became - * VME which was standardized in the VITA organization 1981 - * - * Misc links about Motorola VME division and this board: - * http://bitsavers.trailing-edge.com/pdf/motorola/_dataBooks/1987_Microcomputer_Systems_and_Components.pdf - * - * Description - * ------------ - * Streaming Tape Controller released 1984 with the following feature set - * - * - Double High (6U) VMEmodule - * - QIC-02 Streaming Tape Interface - * - Supports One 01C-02 compatible 1/4-inch Streaming Tape Drive - * - Standard VMEbus Interface - * - Supports 24- or 32-bit DMA Addressing/16-bit Data - * - Generates Seven Levels of VMEbus Interrupts with Programmable Interrupt Vector - * - 10 MHz MC68010 Microprocessor - * - 90Kb/s Continuous Transfer Rate for QIC-02 Interface, 200Kb/s Burst rate - * - Controls Tape Cartridges Offering 20Mb, 45Mb and 60Mb of Formatted Data Storage - * - MC68230 PIT-based Timer - * - 16Kb of Static RAM Provides Buffer Storage and CPU Workspace - * - Multitasking Kernel-based Firmware Package - * - Buffered Pipe Communication Protocol Allows Multiple Hosts to Oueue Commands Without Interlock - * - High Level Command/Status Packets offer efficient Operating System Support - * - Permits Chaining of Host Command - * - * Address Map - * -------------------------------------------------------------------------- - * Local to VME Decscription - * -------------------------------------------------------------------------- - * 0x000000 Up to 128Kb System ROM with RESET vector - * 0x020000 RAM with vectors - * 0x020500 RAM Top of stack - * 0x040000 PIT device? - * 0x060000 RAM? - * 0x080000 PIT device? - * -------------------------------------------------------------------------- - * - * Interrupt sources MVME - * ---------------------------------------------------------- - * Description Device Lvl IRQ VME board - * /Board Vector Address - * ---------------------------------------------------------- - * On board Sources - * - * Off board Sources (other VME boards) - * - * ---------------------------------------------------------- - * - * DMAC Channel Assignments - * ---------------------------------------------------------- - * Channel M10 V10 - * ---------------------------------------------------------- - * - * - * TODO: - * - Dump the ROMs (DONE) - * - Setup a working address map (STARTED) - * - Get documentation for VME interface - * - Add VME bus driver - * - Hook up a CPU board that supports boot from tape (ie MVME-162, MVME 147) - * - Get a tape file with a bootable data on it. - * - ****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/68230pit.h" - -#define LOG(x) x - -class mvme350_state : public driver_device -{ -public: -mvme350_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device (mconfig, type, tag), - m_maincpu (*this, "maincpu"), - m_pit(*this, "pit") -{ -} - -DECLARE_READ16_MEMBER (vme_a24_r); -DECLARE_WRITE16_MEMBER (vme_a24_w); -DECLARE_READ16_MEMBER (vme_a16_r); -DECLARE_WRITE16_MEMBER (vme_a16_w); -virtual void machine_start (); -virtual void machine_reset (); -protected: - -private: - required_device m_maincpu; - required_device m_pit; - -}; - -static ADDRESS_MAP_START (mvme350_mem, AS_PROGRAM, 16, mvme350_state) -ADDRESS_MAP_UNMAP_HIGH - AM_RANGE (0x000000, 0x01ffff) AM_ROM /* 128 Mb ROM */ - AM_RANGE (0x020000, 0x03ffff) AM_RAM /* 128 Mb RAM */ -#if 1 - AM_RANGE(0x040000, 0x040035) AM_DEVREADWRITE8("pit", pit68230_device, read, write, 0x00ff) /* PIT ?*/ - AM_RANGE(0x060000, 0x06001f) AM_RAM /* Area is cleared on start */ - AM_RANGE(0x080000, 0x080035) AM_DEVREADWRITE8("pit", pit68230_device, read, write, 0x00ff) /* PIT ?*/ -#endif -//AM_RANGE(0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ -//AM_RANGE(0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START (mvme350) -INPUT_PORTS_END - -/* Start it up */ -void mvme350_state::machine_start () -{ - LOG (logerror ("machine_start\n")); -} - -void mvme350_state::machine_reset () -{ - LOG (logerror ("machine_reset\n")); -} - -#if 0 -/* Dummy VME access methods until the VME bus device is ready for use */ -READ16_MEMBER (mvme350_state::vme_a24_r){ - LOG (logerror ("vme_a24_r\n")); - return (UINT16) 0; -} - -WRITE16_MEMBER (mvme350_state::vme_a24_w){ - LOG (logerror ("vme_a24_w\n")); -} - -READ16_MEMBER (mvme350_state::vme_a16_r){ - LOG (logerror ("vme_16_r\n")); - return (UINT16) 0; -} - -WRITE16_MEMBER (mvme350_state::vme_a16_w){ - LOG (logerror ("vme_a16_w\n")); -} -#endif - -/* - * Machine configuration - */ -static MACHINE_CONFIG_START (mvme350, mvme350_state) - /* basic machine hardware */ - MCFG_CPU_ADD ("maincpu", M68010, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP (mvme350_mem) - /* PIT Parallel Interface and Timer device, assuming strapped for on board clock */ - MCFG_DEVICE_ADD("pit", PIT68230, XTAL_16MHz / 2) - -MACHINE_CONFIG_END - -/* ROM definitions */ -ROM_START (mvme350) -ROM_REGION (0x1000000, "maincpu", 0) - -ROM_LOAD16_BYTE ("mvme350U40v2.3.bin", 0x0000, 0x4000, CRC (bcef82ef) SHA1 (e6fdf26e4714cbaeb3e97d7b5acf02d64d8ad744)) -ROM_LOAD16_BYTE ("mvme350U47v2.3.bin", 0x0001, 0x4000, CRC (582ce095) SHA1 (d0929dbfeb0cfda63df6b5bc29ee27fbf665def7)) - -/* - * System ROM information - * - * The ROMs known commands from different sources: - * - * It communicates with the master through data buffers in shared memory and VME bus interrupts - * as desribed in - * http://bitsavers.trailing-edge.com/pdf/motorola/_dataBooks/1987_Microcomputer_Systems_and_Components.pdf - * - * The board is pretty boring as stand alone, it initializes everything and then executes a STOP instruction - * awaiting a CPU on the VME bus to request its services. However, it enables boot from tape devices, we just - * need a MVME-131 and a dump of a VersaDOS or Motorola UNIX System V system tape and some work. - */ -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP (1984, mvme350, 0, 0, mvme350, mvme350, driver_device, 0, "Motorola", "MVME-350", MACHINE_NO_SOUND_HW | MACHINE_TYPE_COMPUTER ) diff --git a/src/mess/drivers/mx2178.c b/src/mess/drivers/mx2178.c deleted file mode 100644 index a1fc4fb1a22..00000000000 --- a/src/mess/drivers/mx2178.c +++ /dev/null @@ -1,204 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************************************** - - Skeleton driver for Memorex 2178 - - Chips: Z80A, N8X305N, 2x B8452A, 4x D4016C-3, 2x HD468A50P, HD46505SP-1 - Crystal: 18.8696MHz - There is a large piezo-beeper. - - TODO: - - Connect up the beeper - - RS232 not working (6850 parameters are /64, 8 bit, 2 stop bit, IRQ when key pressed) - - Unknown port i/o 80 - - Unknown memory i/o C000, 4000 - - Need schematic / tech manual - - Gets stuck waiting for E011 to become zero somehow. If you skip that, a status line appears. - - Doesn't seem to be any dips, looks like all settings and modes are controlled by keystrokes. - -***************************************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "machine/keyboard.h" - -#define KEYBOARD_TAG "keyboard" - -class mx2178_state : public driver_device -{ -public: - mx2178_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_acia(*this, "acia"), - m_palette(*this, "palette") - { - } - - DECLARE_READ8_MEMBER(keyin_r); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - MC6845_UPDATE_ROW(crtc_update_row); - - const UINT8 *m_p_chargen; - required_shared_ptr m_p_videoram; - -protected: - virtual void machine_reset(); - -private: - UINT8 m_term_data; - required_device m_maincpu; - required_device m_acia; -public: - required_device m_palette; -}; - -static ADDRESS_MAP_START(mx2178_mem, AS_PROGRAM, 8, mx2178_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0x2000, 0x27ff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x6000, 0x6fff) AM_RAM - AM_RANGE(0xe000, 0xe7ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mx2178_io, AS_IO, 8, mx2178_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_DEVWRITE("crtc", mc6845_device, address_w) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - //AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) - //AM_RANGE(0xa1, 0xa1) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) - AM_RANGE(0xa0, 0xa1) AM_READ(keyin_r) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( mx2178 ) -INPUT_PORTS_END - -READ8_MEMBER( mx2178_state::keyin_r ) -{ - if (offset) - { - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; - } - else - return (m_term_data) ? 0x83 : 0x82; -} - -WRITE8_MEMBER( mx2178_state::kbd_put ) -{ - m_term_data = data; - m_maincpu->set_input_line(0, HOLD_LINE); -} - -MC6845_UPDATE_ROW( mx2178_state::crtc_update_row ) -{ - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); - - /* Display a scanline of a character (8 pixels) */ - *p++ = pens[BIT(gfx, 7)]; - *p++ = pens[BIT(gfx, 6)]; - *p++ = pens[BIT(gfx, 5)]; - *p++ = pens[BIT(gfx, 4)]; - *p++ = pens[BIT(gfx, 3)]; - *p++ = pens[BIT(gfx, 2)]; - *p++ = pens[BIT(gfx, 1)]; - *p++ = pens[BIT(gfx, 0)]; - } -} - -/* F4 Character Displayer */ -static const gfx_layout mx2178_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8 }, - 8*16 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( mx2178 ) - GFXDECODE_ENTRY( "chargen", 0x0000, mx2178_charlayout, 0, 1 ) -GFXDECODE_END - -void mx2178_state::machine_reset() -{ - m_p_chargen = memregion("chargen")->base(); -} - -WRITE_LINE_MEMBER(mx2178_state::write_acia_clock) -{ - m_acia->write_txc(state); - m_acia->write_rxc(state); -} - -static MACHINE_CONFIG_START( mx2178, mx2178_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 18869600/5) // guess - MCFG_CPU_PROGRAM_MAP(mx2178_mem) - MCFG_CPU_IO_MAP(mx2178_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not correct - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mx2178) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* Devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", 18869600 / 8) // clk unknown - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(mx2178_state, crtc_update_row) - - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - - /// TODO: hook up acia to keyboard and memory map - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(mx2178_state, kbd_put)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 614400) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(mx2178_state, write_acia_clock)) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mx2178 ) - ROM_REGION(0x2000, "roms", 0) - ROM_LOAD( "96274139.bin", 0x000000, 0x002000, CRC(eb471a27) SHA1(433abefd1a72653d0bf35bcaaeccf9943b96260b) ) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "96273883.bin", 0x000000, 0x001000, CRC(8311fadd) SHA1(573bbad23e893ad9374edc929642dc1cba3452d2) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, mx2178, 0, 0, mx2178, mx2178, driver_device, 0, "Memorex", "Memorex 2178", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/myb3k.c b/src/mess/drivers/myb3k.c deleted file mode 100644 index 96677868c1e..00000000000 --- a/src/mess/drivers/myb3k.c +++ /dev/null @@ -1,286 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Matsushita / Panasonic My Brain 3000 / JB-3000 - - preliminary driver by Angelo Salese - - TODO: - - needs a working floppy image, fdc probably needs IRQ / DRQ lines - hooked up. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "video/mc6845.h" -#include "machine/wd_fdc.h" - -class myb3k_state : public driver_device -{ -public: - myb3k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_fdc(*this, "fdc"), - m_crtc(*this, "crtc"), - m_floppy0(*this, "fdc:0:8dsdd"), - m_floppy1(*this, "fdc:1:8dsdd"), - m_p_vram(*this, "p_vram"), - m_palette(*this, "palette") { } - - required_device m_maincpu; - required_device m_fdc; - required_device m_crtc; - required_device m_floppy0; - required_device m_floppy1; - DECLARE_WRITE8_MEMBER(myb3k_6845_address_w); - DECLARE_WRITE8_MEMBER(myb3k_6845_data_w); - DECLARE_WRITE8_MEMBER(myb3k_video_mode_w); - DECLARE_WRITE8_MEMBER(myb3k_fdc_output_w); - required_shared_ptr m_p_vram; - required_device m_palette; - UINT8 m_crtc_vreg[0x100],m_crtc_index; - UINT8 m_vmode; - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_myb3k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - -void myb3k_state::video_start() -{ -} - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - - -UINT32 myb3k_state::screen_update_myb3k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - int xi,yi; - int dot; - int h_step; - - h_step = 64 >> (m_vmode & 3); - - //popmessage("%02x %d",m_vmode,h_step); - - for(y=0;y> (7-xi)) & 1; - if((yi & ~7 && (!(m_vmode & 4))) || (yi & ~0xf && (m_vmode & 4))) - dot = 0; - - if(y*mc6845_tile_height+yi < 200 && x*8+xi < 320) /* TODO: safety check */ - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(dot); - } - } - } - } - - return 0; -} - -WRITE8_MEMBER( myb3k_state::myb3k_6845_address_w ) -{ - m_crtc_index = data; - m_crtc->address_w(space, offset, data); -} - -WRITE8_MEMBER( myb3k_state::myb3k_6845_data_w ) -{ - m_crtc_vreg[m_crtc_index] = data; - m_crtc->register_w(space, offset, data); -} - -WRITE8_MEMBER( myb3k_state::myb3k_video_mode_w ) -{ - /* ---- -x-- interlace mode */ - /* ---- --xx horizontal step count (number of offsets of vram RAM data to skip, 64 >> n) */ - - m_vmode = data; - -} -WRITE8_MEMBER( myb3k_state::myb3k_fdc_output_w ) -{ - /* TODO: complete guesswork! (it just does a 0x24 -> 0x20 in there) */ - floppy_image_device *floppy = NULL; - - if (data & 1) floppy = m_floppy0; - if (data & 2) floppy = m_floppy1; - - if (floppy) - { - floppy->mon_w(!(data & 4) ? 1: 0); - floppy->ss_w((data & 0x10)>>4); - } -} - -static ADDRESS_MAP_START(myb3k_map, AS_PROGRAM, 8, myb3k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0x7ffff) AM_RAM - AM_RANGE(0x80000,0x8ffff) AM_NOP - AM_RANGE(0xd0000,0xdffff) AM_RAM AM_SHARE("p_vram") -// AM_RANGE(0xe0000,0xexxxx) option ROM board - AM_RANGE(0xfc000,0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(myb3k_io, AS_IO, 8, myb3k_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0x01, 0x01) AM_READ_PORT("DSW1") - AM_RANGE(0x03, 0x03) AM_WRITENOP - AM_RANGE(0x04, 0x04) AM_WRITE(myb3k_video_mode_w) - AM_RANGE(0x06, 0x06) AM_READ_PORT("DSW2") - AM_RANGE(0x1c, 0x1c) AM_WRITE(myb3k_6845_address_w) - AM_RANGE(0x1d, 0x1d) AM_WRITE(myb3k_6845_data_w) - AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("fdc", mb8877_t, read, write) //FDC, almost likely wd17xx - AM_RANGE(0x24, 0x24) AM_WRITE(myb3k_fdc_output_w) -// AM_RANGE(0x520,0x524) mirror of above -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( myb3k ) - PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) // - these two plays with the video modes - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) // / - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, "FDC mapping" ) - PORT_DIPSETTING( 0x80, "0x520-0x524 range" ) - PORT_DIPSETTING( 0x00, "0x20-0x24 range" ) - PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, "ROM information" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - - -void myb3k_state::machine_start() -{ -} - -void myb3k_state::machine_reset() -{ -} - - -static const gfx_layout myb3k_charlayout = -{ - 8, 8, - 0x400, - 1, - { 0 }, - { STEP8(0,1) }, - { STEP8(0,8) }, - 8*8 -}; - -static GFXDECODE_START( myb3k ) - GFXDECODE_ENTRY( "ipl", 0x0000, myb3k_charlayout, 0, 1 ) -GFXDECODE_END - -static SLOT_INTERFACE_START( myb3k_floppies ) - SLOT_INTERFACE( "525sssd", FLOPPY_525_SSSD ) - SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( myb3k, myb3k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8088, 4000000) /* unknown clock*/ - MCFG_CPU_PROGRAM_MAP(myb3k_map) - MCFG_CPU_IO_MAP(myb3k_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(myb3k_state, screen_update_myb3k) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", myb3k) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* devices */ - MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_3_579545MHz/4) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_DEVICE_ADD("fdc", MB8877, 2000000) // unknown type - MCFG_FLOPPY_DRIVE_ADD("fdc:0", myb3k_floppies, "8dsdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", myb3k_floppies, "8dsdd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( myb3k ) - ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x4000, CRC(64a864a1) SHA1(d3ccfd28f2938e71a26ae5a0085439a3265f60bf)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, myb3k, 0, 0, myb3k, myb3k, driver_device, 0, "Panasonic", "MyBrain 3000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mycom.c b/src/mess/drivers/mycom.c deleted file mode 100644 index be3978d2ddf..00000000000 --- a/src/mess/drivers/mycom.c +++ /dev/null @@ -1,585 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Robbbert -/****************************************************************************** - - MYCOMZ-80A (c) 1981 Japan Electronics College - - preliminary driver by Angelo Salese - additions by Robbbert - - THE KEYBOARD - - Uses a 4MO1003A custom mcu. - - Every combination is documented in the manual, including the unused ones. - - All commands must be in uppercase - lowercase will produce errors. - - There are 5 special keys which do crude editing functions. These are in - the range 0x61 to 0x75. Kana characters occupy the range 0xa0 to 0xff. - Graphics characters are found in 0x00 to 0x1f, and 0x80 to 0x9f. - - Editing characters (hold down shift to get them): - a - shiftlock (toggle). You can then enter any lowercase character. - c - clear screen and home cursor - d - insert - f - vertical tab (cursor up) You can scroll backwards with this, - and you can reuse old input lines. - u - cursor right - - There are switches on the right-hand side which are connected directly - to one of the PIAs. The switches (not emulated): - s2 - ?unknown - s3 - ?unknown but must be high for the keyboard to function - s4 - cassette motor on/off - s5 - ?unknown - - There is also switch s1 which it is not known what it connects to. - - Please note: The Takeda 80-column monitor expects the enter key to be the - line feed key. This is the numpad-enter in our emulation. Strangely, the - standard monitor, and Basic, will also respond to this key. - - The keyboard has a "English" key on the left, and a "Japan" key on the - right. Pressing the appropriate key toggles the input language mode. - Internally, this turns the Kana bit off/on. On our keyboard, the ALT key - toggles between English and Kana. - - TODO/info: - - Sound not working. The info makes its way to the audio chip but for - some unknown reason, nothing is heard. - - FDC, little info, guessing (143kb, single sided, 525sd) - - Cassette doesn't load - - Printer - - Keyboard lookup table for Kana and Shifted Kana - - Keyboard autorepeat - - Need software - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "machine/i8255.h" -#include "sound/sn76496.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "machine/msm5832.h" -#include "machine/wd_fdc.h" - - -class mycom_state : public driver_device -{ -public: - mycom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_ppi0(*this, "ppi8255_0") - , m_ppi1(*this, "ppi8255_1") - , m_ppi2(*this, "ppi8255_2") - , m_cass(*this, "cassette") - , m_wave(*this, WAVE_TAG) - , m_crtc(*this, "crtc") - , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - , m_audio(*this, "sn1") - , m_rtc(*this, "rtc"), - m_palette(*this, "palette") - { } - - DECLARE_READ8_MEMBER(mycom_upper_r); - DECLARE_WRITE8_MEMBER(mycom_upper_w); - DECLARE_READ8_MEMBER(vram_data_r); - DECLARE_WRITE8_MEMBER(vram_data_w); - DECLARE_WRITE8_MEMBER(mycom_00_w); - DECLARE_WRITE8_MEMBER(mycom_04_w); - DECLARE_WRITE8_MEMBER(mycom_06_w); - DECLARE_WRITE8_MEMBER(mycom_0a_w); - DECLARE_READ8_MEMBER(mycom_05_r); - DECLARE_READ8_MEMBER(mycom_06_r); - DECLARE_READ8_MEMBER(mycom_08_r); - DECLARE_DRIVER_INIT(mycom); - TIMER_DEVICE_CALLBACK_MEMBER(mycom_kbd); - DECLARE_WRITE8_MEMBER(mycom_rtc_w); - MC6845_UPDATE_ROW(crtc_update_row); - UINT8 *m_p_videoram; - UINT8 *m_p_chargen; - UINT8 m_0a; -private: - UINT16 m_i_videoram; - UINT8 m_keyb_press; - UINT8 m_keyb_press_flag; - UINT8 m_sn_we; - UINT32 m_upper_sw; - UINT8 *m_p_ram; - virtual void machine_reset(); - virtual void machine_start(); - virtual void video_start(); - required_device m_maincpu; - required_device m_ppi0; - required_device m_ppi1; - required_device m_ppi2; - required_device m_cass; - required_device m_wave; - required_device m_crtc; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_audio; - required_device m_rtc; -public: - required_device m_palette; -}; - - - -void mycom_state::video_start() -{ - m_p_videoram = memregion("vram")->base(); - m_p_chargen = memregion("chargen")->base(); -} - -MC6845_UPDATE_ROW( mycom_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx=0,z; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - if (m_0a & 0x40) - { - for (x = 0; x < x_count; x++) // lores pixels - { - UINT8 dbit=1; - if (x == cursor_x) dbit=0; - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - z = ra / 3; - *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; - *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; - *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; - *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; - z += 4; - *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; - *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; - *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; - *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; - } - } - else - { - for (x = 0; x < x_count; x++) // text - { - UINT8 inv=0; - if (x == cursor_x) inv=0xff; - mem = (ma + x) & 0x7ff; - if (ra > 7) - gfx = inv; // some blank spacing lines - else - { - chr = m_p_videoram[mem]; - gfx = m_p_chargen[(chr<<3) | ra] ^ inv; - } - - /* Display a scanline of a character */ - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } - } -} - -WRITE8_MEMBER( mycom_state::mycom_00_w ) -{ - switch(data) - { - case 0x00: membank("boot")->set_entry(1); break; - case 0x01: membank("boot")->set_entry(0); break; - case 0x02: m_upper_sw = 0x10000; break; - case 0x03: m_upper_sw = 0x0c000; break; - } -} - -READ8_MEMBER( mycom_state::mycom_upper_r ) -{ - return m_p_ram[offset | m_upper_sw]; -} - -WRITE8_MEMBER( mycom_state::mycom_upper_w ) -{ - m_p_ram[offset | 0xc000] = data; -} - -READ8_MEMBER( mycom_state::vram_data_r ) -{ - return m_p_videoram[m_i_videoram]; -} - -WRITE8_MEMBER( mycom_state::vram_data_w ) -{ - m_p_videoram[m_i_videoram] = data; -} - -static ADDRESS_MAP_START(mycom_map, AS_PROGRAM, 8, mycom_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot") - AM_RANGE(0x1000, 0xbfff) AM_RAM - AM_RANGE(0xc000, 0xffff) AM_READWRITE(mycom_upper_r,mycom_upper_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mycom_io, AS_IO, 8, mycom_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(mycom_00_w) - AM_RANGE(0x01, 0x01) AM_READWRITE(vram_data_r,vram_data_w) - AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0x03, 0x03) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", fd1771_t, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mycom ) - PORT_START("X0") - PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) - PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("X1") - PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("X2") - PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(17) - PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(23) - PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(5) - PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(18) - PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(20) - PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(25) - PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(21) - PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(9) - PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(15) - - PORT_START("X3") - PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(1) - PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(19) - PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(4) - PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(6) - PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(7) - PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(8) - PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(10) - PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(11) - PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(12) - - PORT_START("X4") - PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(26) - PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(24) - PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(3) - PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(22) - PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(2) - PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(14) - PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(13) - PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("< ,") PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') - PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("> .") PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') - - PORT_START("X5") - PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(u)") PORT_CHAR('u') - PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(c)") PORT_CHAR('c') - - PORT_START("X6") - PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(30) - PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ _") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('_') PORT_CHAR(28) - PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(d)") PORT_CHAR('d') - PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(f)") PORT_CHAR('f') - - PORT_START("X7") - PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(16) - PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(0) - PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(27) - PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LineFeed") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(10) - PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(a)") PORT_CHAR('a') - - PORT_START("X8") - PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(29) - PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("XX") - PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_TOGGLE -INPUT_PORTS_END - - -/* F4 Character Displayer */ -static const gfx_layout mycom_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( mycom ) - GFXDECODE_ENTRY( "chargen", 0x0000, mycom_charlayout, 0, 1 ) -GFXDECODE_END - -WRITE8_MEMBER( mycom_state::mycom_04_w ) -{ - m_i_videoram = (m_i_videoram & 0x700) | data; - - m_sn_we = data; -} - -WRITE8_MEMBER( mycom_state::mycom_06_w ) -{ - m_i_videoram = (m_i_videoram & 0x0ff) | ((data & 0x007) << 8); -} - -READ8_MEMBER( mycom_state::mycom_08_r ) -{ - /* - x--- ---- display flag - ---- --x- keyboard shift - ---- ---x keyboard strobe - */ - UINT8 data = 0; - - data = m_keyb_press_flag; //~m_keyb_press_flag & 1; - - if ((m_cass)->input() > 0.03) // not working - data+=4; - - return data; -} - -READ8_MEMBER( mycom_state::mycom_06_r ) -{ - /* - x--- ---- keyboard s5 - -x-- ---- keyboard s4 (motor on/off) - --x- ---- keyboard s3 (must be high) - ---x ---- keyboard s2 - */ - return 0xff; -} - -READ8_MEMBER( mycom_state::mycom_05_r ) -{ - return m_keyb_press; -} - -WRITE8_MEMBER( mycom_state::mycom_0a_w ) -{ - /* - x--- ---- width 80/40 (0 = 80, 1 = 40) - -x-- ---- video mode (0= tile, 1 = bitmap) - --x- ---- PSG Chip Select bit - ---x ---- PSG Write Enable bit - ---- x--- cmt remote (defaults to on) - ---- -x-- cmt output - ---- --x- printer reset - ---- ---x printer strobe - */ - - if ( (BIT(m_0a, 3)) != (BIT(data, 3)) ) - m_cass->change_state( - BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - if (BIT(data, 3)) // motor on - m_cass->output( BIT(data, 2) ? -1.0 : +1.0); - - if ( (BIT(data, 7)) != (BIT(m_0a, 7)) ) - m_crtc->set_clock(BIT(data, 7) ? 1008000 : 2016000); - - m_0a = data; - - // if WE & CE are low, pass sound command to audio chip - if ((data & 0x30)==0) - m_audio->write(space, 0, m_sn_we); -} - -WRITE8_MEMBER(mycom_state::mycom_rtc_w) -{ - m_rtc->address_w(data & 0x0f); - - m_rtc->hold_w(BIT(data, 4)); - m_rtc->read_w(BIT(data, 5)); - m_rtc->write_w(BIT(data, 6)); - m_rtc->cs_w(BIT(data, 7)); -} - -static const UINT8 mycom_keyval[] = { 0, -0x1b,0x1b,0x7c,0x7c,0x18,0x18,0x0f,0x0f,0x09,0x09,0x1c,0x1c,0x30,0x00,0x50,0x70,0x3b,0x2b, -0x00,0x00,0x31,0x21,0x51,0x71,0x41,0x61,0x5a,0x7a,0x17,0x17,0x2d,0x3d,0x40,0x60,0x3a,0x2a, -0x0b,0x0b,0x32,0x22,0x57,0x77,0x53,0x73,0x58,0x78,0x03,0x03,0x5e,0x7e,0x5b,0x7b,0x5d,0x7d, -0x1f,0x1f,0x33,0x23,0x45,0x65,0x44,0x64,0x43,0x63,0x0c,0x0c,0x5c,0x7c,0x0a,0x0a,0x00,0x00, -0x01,0x01,0x34,0x24,0x52,0x72,0x46,0x66,0x56,0x76,0x04,0x04,0x7f,0x7f,0x08,0x08,0x0e,0x0e, -0x02,0x02,0x35,0x25,0x54,0x74,0x47,0x67,0x42,0x62,0x75,0x75,0x64,0x64,0x00,0x00,0x20,0x20, -0x1e,0x1e,0x36,0x26,0x59,0x79,0x48,0x68,0x4e,0x6e,0x37,0x37,0x34,0x34,0x31,0x31,0x30,0x30, -0x1d,0x1d,0x37,0x27,0x55,0x75,0x4a,0x6a,0x4d,0x6d,0x38,0x38,0x35,0x35,0x32,0x32,0x11,0x11, -0x0d,0x0d,0x38,0x28,0x49,0x69,0x4b,0x6b,0x2c,0x3c,0x39,0x39,0x36,0x36,0x33,0x33,0x12,0x12, -0x07,0x07,0x39,0x29,0x4f,0x6f,0x4c,0x6c,0x2e,0x3e,0x63,0x63,0x66,0x66,0x61,0x61,0x2f,0x3f }; - -TIMER_DEVICE_CALLBACK_MEMBER(mycom_state::mycom_kbd) -{ - UINT8 x, y, scancode = 0; - UINT16 pressed[9]; - char kbdrow[3]; - UINT8 modifiers = ioport("XX")->read(); - UINT8 shift_pressed = (modifiers & 2) >> 1; - m_keyb_press_flag = 0; - - /* see what is pressed */ - for (x = 0; x < 9; x++) - { - sprintf(kbdrow,"X%d",x); - pressed[x] = (ioport(kbdrow)->read()); - } - - /* find what has changed */ - for (x = 0; x < 9; x++) - { - if (pressed[x]) - { - /* get scankey value */ - for (y = 0; y < 10; y++) - { - if (BIT(pressed[x], y)) - { - scancode = ((x + y * 9) << 1) + shift_pressed + 1; - m_keyb_press_flag = 1; - m_keyb_press = mycom_keyval[scancode]; - } - } - } - } - - if (m_keyb_press_flag) - { - if (modifiers & 1) m_keyb_press &= 0xbf; - if (modifiers & 4) m_keyb_press |= 0x80; - } -} - - - -static SLOT_INTERFACE_START( mycom_floppies ) - SLOT_INTERFACE( "525sd", FLOPPY_525_SD ) -SLOT_INTERFACE_END - -void mycom_state::machine_start() -{ - m_p_ram = memregion("maincpu")->base(); -} - -void mycom_state::machine_reset() -{ - membank("boot")->set_entry(1); - m_upper_sw = 0x10000; - m_0a = 0; -} - -DRIVER_INIT_MEMBER(mycom_state,mycom) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x10000); -} - -static MACHINE_CONFIG_START( mycom, mycom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_10MHz / 4) - MCFG_CPU_PROGRAM_MAP(mycom_map) - MCFG_CPU_IO_MAP(mycom_io) - - MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mycom_state, mycom_04_w)) - MCFG_I8255_IN_PORTB_CB(READ8(mycom_state, mycom_05_r)) - MCFG_I8255_IN_PORTC_CB(READ8(mycom_state, mycom_06_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mycom_state, mycom_06_w)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mycom_state, mycom_08_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mycom_state, mycom_0a_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_IN_PORTB_CB(DEVREAD8("rtc", msm5832_device, data_r)) - MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("rtc", msm5832_device, data_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mycom_state, mycom_rtc_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 192-1) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mycom) - - /* Manual states clock is 1.008mhz for 40 cols, and 2.016 mhz for 80 cols. - The CRTC is a HD46505S - same as a 6845. The start registers need to be readable. */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", 1008000) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(mycom_state, crtc_update_row) - - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_ADD("sn1", SN76489, XTAL_10MHz / 4) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50) - - /* Devices */ - MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_FD1771_ADD("fdc", XTAL_16MHz / 16) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", mycom_floppies, "525sd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", mycom_floppies, "525sd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", mycom_state, mycom_kbd, attotime::from_hz(20)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mycom ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS("mycom") - ROM_SYSTEM_BIOS(0, "mycom", "40 column") - ROMX_LOAD( "bios0.rom", 0x10000, 0x3000, CRC(e6f50355) SHA1(5d3acea360c0a8ab547db03a43e1bae5125f9c2a), ROM_BIOS(1)) - ROMX_LOAD( "basic0.rom",0x13000, 0x1000, CRC(3b077465) SHA1(777427182627f371542c5e0521ed3ca1466a90e1), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "Takeda", "80 column") - ROMX_LOAD( "bios1.rom", 0x10000, 0x3000, CRC(c51d7fcb) SHA1(31d39db43b77cca4d49ff9814d531e056924e716), ROM_BIOS(2)) - ROMX_LOAD( "basic1.rom",0x13000, 0x1000, CRC(30a573f1) SHA1(e3fe2e73644e831b52e2789dc7c181989cc30b82), ROM_BIOS(2)) - /* Takeda bios has no cursor. Use the next lines to turn on cursor, but you must comment out when done. */ - //ROM_FILL( 0x11eb6, 1, 0x47 ) - //ROM_FILL( 0x11eb7, 1, 0x07 ) - - ROM_REGION( 0x0800, "vram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(4039bb6f) SHA1(086ad303bf4bcf983fd6472577acbf744875fea8) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, mycom, 0, 0, mycom, mycom, mycom_state, mycom, "Japan Electronics College", "MYCOMZ-80A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/myvision.c b/src/mess/drivers/myvision.c deleted file mode 100644 index 5881ebf8389..00000000000 --- a/src/mess/drivers/myvision.c +++ /dev/null @@ -1,250 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - Nichibutsu My Vision - driver by Wilbert Pol - - 2013/12/01 Skeleton driver. - 2013/12/02 Working driver. - - Known issues: - - The inputs sometimes feel a bit unresponsive. Was the real unit like - that? Or is it just because we have incorrect clocks? - - TODO: - - Review software list - - Add clickable artwork - - Verify sound chip model - - Verify exact TMS9918 model - - Verify clock crystal(s) - - Verify size of vram - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/tms9928a.h" -#include "sound/ay8910.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class myvision_state : public driver_device -{ -public: - myvision_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_cart(*this, "cartslot") - , m_io_row0(*this, "ROW0") - , m_io_row1(*this, "ROW1") - , m_io_row2(*this, "ROW2") - , m_io_row3(*this, "ROW3") - { } - - DECLARE_WRITE_LINE_MEMBER( vdp_interrupt ); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( cart ); - DECLARE_READ8_MEMBER( ay_port_a_r ); - DECLARE_READ8_MEMBER( ay_port_b_r ); - DECLARE_WRITE8_MEMBER( ay_port_a_w ); - DECLARE_WRITE8_MEMBER( ay_port_b_w ); - -private: - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_cart; - UINT8 m_column; - required_ioport m_io_row0; - required_ioport m_io_row1; - required_ioport m_io_row2; - required_ioport m_io_row3; -}; - - -static ADDRESS_MAP_START(myvision_mem, AS_PROGRAM, 8, myvision_state) - ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0x0000, 0x5fff) // mapped by the cartslot - AM_RANGE(0xa000, 0xa7ff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE("tms9918", tms9918a_device, vram_read, vram_write) - AM_RANGE(0xe002, 0xe002) AM_DEVREADWRITE("tms9918", tms9918a_device, register_read, register_write) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(myvision_io, AS_IO, 8, myvision_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0x01, 0x01) AM_DEVWRITE("ay8910", ay8910_device, data_w) - AM_RANGE(0x02, 0x02) AM_DEVREAD("ay8910", ay8910_device, data_r) -ADDRESS_MAP_END - - -/* Input ports */ -/* - Keyboard layout is something like: - B - A D E - C - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - */ -static INPUT_PORTS_START( myvision ) - PORT_START("ROW0") - PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M) PORT_NAME("13") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("C/Down") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_I) PORT_NAME("9") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_MAHJONG_E) PORT_NAME("5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_MAHJONG_A) PORT_NAME("1") - - PORT_START("ROW1") - PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("B/Up") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_L) PORT_NAME("12") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_MAHJONG_H) PORT_NAME("8") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_MAHJONG_D) PORT_NAME("4") - - PORT_START("ROW2") - PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N) PORT_NAME("14/Start") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("D/Right") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_J) PORT_NAME("10") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_MAHJONG_F) PORT_NAME("6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_MAHJONG_B) PORT_NAME("2") - - PORT_START("ROW3") - PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("A/Left") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("E") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_K) PORT_NAME("11") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_MAHJONG_G) PORT_NAME("7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_MAHJONG_C) PORT_NAME("3") - -INPUT_PORTS_END - - -void myvision_state::machine_start() -{ - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - save_item(NAME(m_column)); -} - - -void myvision_state::machine_reset() -{ - m_column = 0xff; -} - - -DEVICE_IMAGE_LOAD_MEMBER( myvision_state, cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size != 0x4000 && size != 0x6000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - -WRITE_LINE_MEMBER(myvision_state::vdp_interrupt) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); -} - -READ8_MEMBER( myvision_state::ay_port_a_r ) -{ - UINT8 data = 0xFF; - - if ( ! ( m_column & 0x80 ) ) - { - data &= m_io_row0->read(); - } - - if ( ! ( m_column & 0x40 ) ) - { - data &= m_io_row1->read(); - } - - if ( ! ( m_column & 0x20 ) ) - { - data &= m_io_row2->read(); - } - - if ( ! ( m_column & 0x10 ) ) - { - data &= m_io_row3->read(); - } - - return data; -} - - -READ8_MEMBER( myvision_state::ay_port_b_r ) -{ - return 0xff; -} - - -WRITE8_MEMBER( myvision_state::ay_port_a_w ) -{ -} - - -// Upper 4 bits select column -WRITE8_MEMBER( myvision_state::ay_port_b_w ) -{ - m_column = data; -} - -static MACHINE_CONFIG_START( myvision, myvision_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_10_738635MHz/3) /* Not verified */ - MCFG_CPU_PROGRAM_MAP(myvision_mem) - MCFG_CPU_IO_MAP(myvision_io) - - /* video hardware */ - MCFG_DEVICE_ADD( "tms9918", TMS9918A, XTAL_10_738635MHz / 2 ) /* Exact model not verified */ - MCFG_TMS9928A_VRAM_SIZE(0x4000) /* Not verified */ - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(myvision_state, vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9918", tms9918a_device, screen_update ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_10_738635MHz/3/2) /* Exact model and clock not verified */ - MCFG_AY8910_PORT_A_READ_CB(READ8(myvision_state, ay_port_a_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(myvision_state, ay_port_b_r)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(myvision_state, ay_port_a_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(myvision_state, ay_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "myvision_cart") - MCFG_GENERIC_LOAD(myvision_state, cart) - //MCFG_GENERIC_MANDATORY - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","myvision") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( myvision ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1983, myvision, 0, 0, myvision, myvision, driver_device, 0, "Nichibutsu", "My Vision (KH-1000)", 0 ) diff --git a/src/mess/drivers/mz2000.c b/src/mess/drivers/mz2000.c deleted file mode 100644 index 1fa43c6fcd6..00000000000 --- a/src/mess/drivers/mz2000.c +++ /dev/null @@ -1,908 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Sharp MZ-2000 - - driver by Angelo Salese - font conversion by Tomasz Slanina - - Basically a simpler version of Sharp MZ-2500 - - TODO: - - cassette interface, basically any program that's bigger than 8kb fails to load; - - implement remaining video capabilities - - add 80b compatibility support; - - Vosque (color): keyboard doesn't work properly; - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80pio.h" -#include "machine/i8255.h" -#include "machine/wd_fdc.h" -#include "machine/pit8253.h" -#include "sound/beep.h" -#include "sound/wave.h" -#include "machine/rp5c15.h" -#include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" -#include "formats/2d_dsk.h" -#include "formats/mz_cas.h" - -#define MASTER_CLOCK XTAL_17_73447MHz/5 /* TODO: was 4 MHz, but otherwise cassette won't work due of a bug with MZF support ... */ - - -class mz2000_state : public driver_device -{ -public: - mz2000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cass(*this, "cassette"), - m_floppy(NULL), - m_maincpu(*this, "maincpu"), - m_mb8877a(*this, "mb8877a"), - m_floppy0(*this, "mb8877a:0"), - m_floppy1(*this, "mb8877a:1"), - m_floppy2(*this, "mb8877a:2"), - m_floppy3(*this, "mb8877a:3"), - m_pit8253(*this, "pit"), - m_beeper(*this, "beeper"), - m_region_tvram(*this, "tvram"), - m_region_gvram(*this, "gvram"), - m_region_chargen(*this, "chargen"), - m_region_ipl(*this, "ipl"), - m_region_wram(*this, "wram"), - m_io_key0(*this, "KEY0"), - m_io_key1(*this, "KEY1"), - m_io_key2(*this, "KEY2"), - m_io_key3(*this, "KEY3"), - m_io_key4(*this, "KEY4"), - m_io_key5(*this, "KEY5"), - m_io_key6(*this, "KEY6"), - m_io_key7(*this, "KEY7"), - m_io_key8(*this, "KEY8"), - m_io_key9(*this, "KEY9"), - m_io_keya(*this, "KEYA"), - m_io_keyb(*this, "KEYB"), - m_io_keyc(*this, "KEYC"), - m_io_keyd(*this, "KEYD"), - m_io_unused(*this, "UNUSED"), - m_io_config(*this, "CONFIG"), - m_palette(*this, "palette") { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - required_device m_cass; - - floppy_image_device *m_floppy; - - UINT8 m_ipl_enable; - UINT8 m_tvram_enable; - UINT8 m_gvram_enable; - UINT8 m_gvram_bank; - - UINT8 m_key_mux; - - UINT8 m_old_portc; - UINT8 m_width80; - UINT8 m_tvram_attr; - UINT8 m_gvram_mask; - - UINT8 m_color_mode; - UINT8 m_has_fdc; - UINT8 m_hi_mode; - - UINT8 m_porta_latch; - UINT8 m_tape_ctrl; - DECLARE_READ8_MEMBER(mz2000_ipl_r); - DECLARE_READ8_MEMBER(mz2000_wram_r); - DECLARE_WRITE8_MEMBER(mz2000_wram_w); - DECLARE_READ8_MEMBER(mz2000_tvram_r); - DECLARE_WRITE8_MEMBER(mz2000_tvram_w); - DECLARE_READ8_MEMBER(mz2000_gvram_r); - DECLARE_WRITE8_MEMBER(mz2000_gvram_w); - DECLARE_READ8_MEMBER(mz2000_mem_r); - DECLARE_WRITE8_MEMBER(mz2000_mem_w); - DECLARE_WRITE8_MEMBER(mz2000_gvram_bank_w); - DECLARE_WRITE8_MEMBER(floppy_select_w); - DECLARE_WRITE8_MEMBER(floppy_side_w); - DECLARE_WRITE8_MEMBER(timer_w); - DECLARE_WRITE8_MEMBER(mz2000_tvram_attr_w); - DECLARE_WRITE8_MEMBER(mz2000_gvram_mask_w); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_mz2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER(fdc_r); - DECLARE_WRITE8_MEMBER(fdc_w); - DECLARE_READ8_MEMBER(mz2000_porta_r); - DECLARE_READ8_MEMBER(mz2000_portb_r); - DECLARE_READ8_MEMBER(mz2000_portc_r); - DECLARE_WRITE8_MEMBER(mz2000_porta_w); - DECLARE_WRITE8_MEMBER(mz2000_portb_w); - DECLARE_WRITE8_MEMBER(mz2000_portc_w); - DECLARE_WRITE8_MEMBER(mz2000_pio1_porta_w); - DECLARE_READ8_MEMBER(mz2000_pio1_portb_r); - DECLARE_READ8_MEMBER(mz2000_pio1_porta_r); - -protected: - required_device m_maincpu; - required_device m_mb8877a; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_device m_pit8253; - required_device m_beeper; - required_memory_region m_region_tvram; - required_memory_region m_region_gvram; - required_memory_region m_region_chargen; - required_memory_region m_region_ipl; - required_memory_region m_region_wram; - required_ioport m_io_key0; - required_ioport m_io_key1; - required_ioport m_io_key2; - required_ioport m_io_key3; - required_ioport m_io_key4; - required_ioport m_io_key5; - required_ioport m_io_key6; - required_ioport m_io_key7; - required_ioport m_io_key8; - required_ioport m_io_key9; - required_ioport m_io_keya; - required_ioport m_io_keyb; - required_ioport m_io_keyc; - required_ioport m_io_keyd; - required_ioport m_io_unused; - required_ioport m_io_config; - required_device m_palette; -}; - -void mz2000_state::video_start() -{ -} - -UINT32 mz2000_state::screen_update_mz2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *tvram = m_region_tvram->base(); - UINT8 *gvram = m_region_gvram->base(); - UINT8 *gfx_data = m_region_chargen->base(); - int x,y,xi,yi; - UINT8 x_size; - UINT32 count; - - count = 0; - - for(y=0;y<200;y++) - { - for(x=0;x<640;x+=8) - { - for(xi=0;xi<8;xi++) - { - int pen; - pen = ((gvram[count+0x4000] >> (xi)) & 1) ? 1 : 0; //B - pen |= ((gvram[count+0x8000] >> (xi)) & 1) ? 2 : 0; //R - pen |= ((gvram[count+0xc000] >> (xi)) & 1) ? 4 : 0; //G - pen &= m_gvram_mask; - - bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen); - } - count++; - } - } - - x_size = (m_width80+1)*40; - - for(y=0;y<25;y++) - { - for(x=0;x 640-1 || res_y > (200*(m_hi_mode+1))-1) - continue; - - tile_offset = tile*(8*(m_hi_mode+1))+yi + (m_hi_mode * 0x800); - - pen = ((gfx_data[tile_offset] >> (7-xi)) & 1) ? color : -1; - - /* TODO: clean this up */ - if(pen != -1) - { - if(m_hi_mode) - { - if(m_width80 == 0) - { - bitmap.pix16(res_y, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y, res_x*2+1) = m_palette->pen(pen); - } - else - { - bitmap.pix16(res_y, res_x) = m_palette->pen(pen); - } - } - else - { - if(m_width80 == 0) - { - bitmap.pix16(res_y*2+0, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y*2+0, res_x*2+1) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x*2+1) = m_palette->pen(pen); - } - else - { - bitmap.pix16(res_y*2+0, res_x) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x) = m_palette->pen(pen); - } - } - } - } - } - } - } - - return 0; -} - -READ8_MEMBER(mz2000_state::mz2000_ipl_r) -{ - return m_region_ipl->base()[offset]; -} - -READ8_MEMBER(mz2000_state::mz2000_wram_r) -{ - return m_region_wram->base()[offset]; -} - -WRITE8_MEMBER(mz2000_state::mz2000_wram_w) -{ - m_region_wram->base()[offset] = data; -} - -READ8_MEMBER(mz2000_state::mz2000_tvram_r) -{ - return m_region_tvram->base()[offset]; -} - -WRITE8_MEMBER(mz2000_state::mz2000_tvram_w) -{ - m_region_tvram->base()[offset] = data; -} - -READ8_MEMBER(mz2000_state::mz2000_gvram_r) -{ - return m_region_gvram->base()[offset+m_gvram_bank*0x4000]; -} - -WRITE8_MEMBER(mz2000_state::mz2000_gvram_w) -{ - m_region_gvram->base()[offset+m_gvram_bank*0x4000] = data; -} - - -READ8_MEMBER(mz2000_state::mz2000_mem_r) -{ - UINT8 page_mem; - - page_mem = (offset & 0xf000) >> 12; - - if(page_mem == 0 && m_ipl_enable) - return mz2000_ipl_r(space,offset & 0xfff); - - if(((page_mem & 8) == 0) && m_ipl_enable == 0) // if ipl is enabled, 0x1000 - 0x7fff accesses to dummy region - return mz2000_wram_r(space,offset); - - if(page_mem & 8) - { - if(page_mem == 0xd && m_tvram_enable) - return mz2000_tvram_r(space,offset & 0xfff); - else if(page_mem >= 0xc && m_gvram_enable) - return mz2000_gvram_r(space,offset & 0x3fff); - else - { - UINT16 wram_mask = (m_ipl_enable) ? 0x7fff : 0xffff; - return mz2000_wram_r(space,offset & wram_mask); - } - } - - return 0xff; -} - -WRITE8_MEMBER(mz2000_state::mz2000_mem_w) -{ - UINT8 page_mem; - - page_mem = (offset & 0xf000) >> 12; - - if((page_mem & 8) == 0 && m_ipl_enable == 0) - mz2000_wram_w(space,offset,data); - - if(page_mem & 8) - { - if(page_mem == 0xd && m_tvram_enable) - mz2000_tvram_w(space,offset & 0xfff,data); - else if(page_mem >= 0xc && m_gvram_enable) - mz2000_gvram_w(space,offset & 0x3fff,data); - else - { - UINT16 wram_mask = (m_ipl_enable) ? 0x7fff : 0xffff; - - mz2000_wram_w(space,offset & wram_mask,data); - } - } -} - -WRITE8_MEMBER(mz2000_state::mz2000_gvram_bank_w) -{ - m_gvram_bank = data & 3; -} - -READ8_MEMBER(mz2000_state::fdc_r) -{ - if(m_has_fdc) - return m_mb8877a->read(space, offset) ^ 0xff; - - return 0xff; -} - -WRITE8_MEMBER(mz2000_state::fdc_w) -{ - if(m_has_fdc) - m_mb8877a->write(space, offset, data ^ 0xff); -} - -WRITE8_MEMBER(mz2000_state::floppy_select_w) -{ - switch (data & 0x03) - { - case 0: m_floppy = m_floppy0->get_device(); break; - case 1: m_floppy = m_floppy1->get_device(); break; - case 2: m_floppy = m_floppy2->get_device(); break; - case 3: m_floppy = m_floppy3->get_device(); break; - } - - m_mb8877a->set_floppy(m_floppy); - - // todo: bit 2 is connected to something too... - - if (m_floppy) - m_floppy->mon_w(!BIT(data, 7)); -} - -WRITE8_MEMBER(mz2000_state::floppy_side_w) -{ - if (m_floppy) - m_floppy->ss_w(BIT(data, 0)); -} - -WRITE8_MEMBER(mz2000_state::timer_w) -{ - m_pit8253->write_gate0(1); - m_pit8253->write_gate1(1); - m_pit8253->write_gate0(0); - m_pit8253->write_gate1(0); - m_pit8253->write_gate0(1); - m_pit8253->write_gate1(1); -} - -WRITE8_MEMBER(mz2000_state::mz2000_tvram_attr_w) -{ - m_tvram_attr = data; -} - -WRITE8_MEMBER(mz2000_state::mz2000_gvram_mask_w) -{ - m_gvram_mask = data; -} - -static ADDRESS_MAP_START(mz2000_map, AS_PROGRAM, 8, mz2000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xffff ) AM_READWRITE(mz2000_mem_r,mz2000_mem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mz2000_io, AS_IO, 8, mz2000_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xd8, 0xdb) AM_READWRITE(fdc_r, fdc_w) - AM_RANGE(0xdc, 0xdc) AM_WRITE(floppy_select_w) - AM_RANGE(0xdd, 0xdd) AM_WRITE(floppy_side_w) - AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("i8255_0", i8255_device, read, write) - AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("pit", pit8253_device, read, write) - AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) - AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w) -// AM_RANGE(0xf4, 0xf7) CRTC - AM_RANGE(0xf5, 0xf5) AM_WRITE(mz2000_tvram_attr_w) - AM_RANGE(0xf6, 0xf6) AM_WRITE(mz2000_gvram_mask_w) - AM_RANGE(0xf7, 0xf7) AM_WRITE(mz2000_gvram_bank_w) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( mz2000 ) - PORT_START("KEY0") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - - PORT_START("KEY1") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("00 (PAD)") //PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) - - PORT_START("KEY2") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) - - PORT_START("KEY3") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BREAK") //PORT_CODE(KEYCODE_ESC) - - PORT_START("KEY4") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") //PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("KEY5") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("KEY6") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("KEY7") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("\\") - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("_") - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(".") - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(",") - - PORT_START("KEY8") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("KEY9") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(":") - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(";") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@") - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[") - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYA") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYB") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SLOCK") - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RVS") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_UNUSED) - PORT_BIT(0xe0,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYC") - PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYD") - PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("UNUSED") - PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED ) - - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Video Board" ) - PORT_CONFSETTING( 0x00, "Monochrome" ) - PORT_CONFSETTING( 0x01, "Color" ) - PORT_CONFNAME( 0x02, 0x02, "Floppy Device" ) - PORT_CONFSETTING( 0x00, DEF_STR( No ) ) - PORT_CONFSETTING( 0x02, DEF_STR( Yes ) ) - PORT_CONFNAME( 0x04, 0x04, "High Resolution" ) - PORT_CONFSETTING( 0x00, DEF_STR( No ) ) - PORT_CONFSETTING( 0x04, DEF_STR( Yes ) ) -INPUT_PORTS_END - - -void mz2000_state::machine_reset() -{ - m_ipl_enable = 1; - m_tvram_enable = 0; - m_gvram_enable = 0; - - m_beeper->set_frequency(4096); - m_beeper->set_state(0); - - m_color_mode = m_io_config->read() & 1; - m_has_fdc = (m_io_config->read() & 2) >> 1; - m_hi_mode = (m_io_config->read() & 4) >> 2; -} - - -static const gfx_layout mz2000_charlayout_8 = -{ - 8, 8, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static const gfx_layout mz2000_charlayout_16 = -{ - 8, 16, - 256, - 1, - { 0 }, - { STEP8(0,1) }, - { STEP16(0,8) }, - 8*16 -}; - -static GFXDECODE_START( mz2000 ) - GFXDECODE_ENTRY( "chargen", 0x0000, mz2000_charlayout_8, 0, 1 ) - GFXDECODE_ENTRY( "chargen", 0x0800, mz2000_charlayout_16, 0, 1 ) -GFXDECODE_END - -READ8_MEMBER(mz2000_state::mz2000_porta_r) -{ - printf("A R\n"); - return 0xff; -} - -READ8_MEMBER(mz2000_state::mz2000_portb_r) -{ - /* - x--- ---- break key - -x-- ---- read tape data - --x- ---- no tape signal - ---x ---- no tape write signal - ---- x--- end of tape reached - ---- ---x "blank" control - */ - UINT8 res = 0x80; - - if(m_cass->get_image() != NULL) - { - res |= (m_cass->input() > 0.0038) ? 0x40 : 0x00; - res |= ((m_cass->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) ? 0x00 : 0x20; - res |= (m_cass->get_position() >= m_cass->get_length()) ? 0x08 : 0x00; - } - else - res |= 0x20; - - res |= (machine().first_screen()->vblank()) ? 0x00 : 0x01; - - return res; -} - -READ8_MEMBER(mz2000_state::mz2000_portc_r) -{ - printf("C R\n"); - return 0xff; -} - -WRITE8_MEMBER(mz2000_state::mz2000_porta_w) -{ - /* - These are enabled thru a 0->1 transition - x--- ---- tape "APSS" - -x-- ---- tape "APLAY" - --x- ---- tape "AREW" - ---x ---- reverse video - ---- x--- tape stop - ---- -x-- tape play - ---- --x- tape ff - ---- ---x tape rewind - */ - - if((m_tape_ctrl & 0x80) == 0 && data & 0x80) - { - //printf("Tape APSS control\n"); - } - - if((m_tape_ctrl & 0x40) == 0 && data & 0x40) - { - //printf("Tape APLAY control\n"); - } - - if((m_tape_ctrl & 0x20) == 0 && data & 0x20) - { - //printf("Tape AREW control\n"); - } - - if((m_tape_ctrl & 0x10) == 0 && data & 0x10) - { - //printf("reverse video control\n"); - } - - if((m_tape_ctrl & 0x08) == 0 && data & 0x08) // stop - { - m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - m_cass->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - } - - if((m_tape_ctrl & 0x04) == 0 && data & 0x04) // play - { - m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - m_cass->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); - } - - if((m_tape_ctrl & 0x02) == 0 && data & 0x02) - { - //printf("Tape FF control\n"); - } - - if((m_tape_ctrl & 0x01) == 0 && data & 0x01) - { - //printf("Tape Rewind control\n"); - } - - m_tape_ctrl = data; -} - -WRITE8_MEMBER(mz2000_state::mz2000_portb_w) -{ - //printf("B W %02x\n",data); - - // ... -} - -WRITE8_MEMBER(mz2000_state::mz2000_portc_w) -{ - /* - x--- ---- tape data write - -x-- ---- tape rec - --x- ---- tape ? - ---x ---- tape open - ---- x--- 0->1 transition = IPL reset - ---- -x-- beeper state - ---- --x- 0->1 transition = Work RAM reset - */ - //printf("C W %02x\n",data); - - if(((m_old_portc & 8) == 0) && data & 8) - m_ipl_enable = 1; - - if(((m_old_portc & 2) == 0) && data & 2) - { - m_ipl_enable = 0; - /* correct? */ - m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - } - - m_beeper->set_state(data & 0x04); - - m_old_portc = data; -} - -WRITE8_MEMBER(mz2000_state::mz2000_pio1_porta_w) -{ - m_tvram_enable = ((data & 0xc0) == 0xc0); - m_gvram_enable = ((data & 0xc0) == 0x80); - m_width80 = ((data & 0x20) >> 5); - m_key_mux = data & 0x1f; - - m_porta_latch = data; -} - -READ8_MEMBER(mz2000_state::mz2000_pio1_portb_r) -{ - ioport_port* keynames[] = { m_io_key0, m_io_key1, m_io_key2, m_io_key3, - m_io_key4, m_io_key5, m_io_key6, m_io_key7, - m_io_key8, m_io_key9, m_io_keya, m_io_keyb, - m_io_keyc, m_io_keyd, m_io_unused, m_io_unused }; - - if(((m_key_mux & 0x10) == 0x00) || ((m_key_mux & 0x0f) == 0x0f)) //status read - { - int res,i; - - res = 0xff; - for(i=0;i<0xe;i++) - res &= keynames[i]->read(); - - return res; - } - - return keynames[m_key_mux & 0xf]->read(); -} - -READ8_MEMBER(mz2000_state::mz2000_pio1_porta_r) -{ - return m_porta_latch; -} - - -FLOPPY_FORMATS_MEMBER( mz2000_state::floppy_formats ) - FLOPPY_2D_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( mz2000_floppies ) - SLOT_INTERFACE("dd", FLOPPY_525_DD) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( mz2000, mz2000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, MASTER_CLOCK) - MCFG_CPU_PROGRAM_MAP(mz2000_map) - MCFG_CPU_IO_MAP(mz2000_io) - - MCFG_DEVICE_ADD("i8255_0", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mz2000_state, mz2000_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mz2000_state, mz2000_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(mz2000_state, mz2000_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mz2000_state, mz2000_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(mz2000_state, mz2000_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mz2000_state, mz2000_portc_w)) - - MCFG_DEVICE_ADD("z80pio_1", Z80PIO, MASTER_CLOCK) - MCFG_Z80PIO_IN_PA_CB(READ8(mz2000_state, mz2000_pio1_porta_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(mz2000_state, mz2000_pio1_porta_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(mz2000_state, mz2000_pio1_portb_r)) - - /* TODO: clocks aren't known */ - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(31250) - MCFG_PIT8253_CLK1(31250) /* needed by "Art Magic" to boot */ - MCFG_PIT8253_CLK2(31250) - - MCFG_MB8877_ADD("mb8877a", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("mb8877a:0", mz2000_floppies, "dd", mz2000_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("mb8877a:1", mz2000_floppies, "dd", mz2000_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("mb8877a:2", mz2000_floppies, "dd", mz2000_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("mb8877a:3", mz2000_floppies, "dd", mz2000_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "mz2000_flop") - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(mz700_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("mz_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","mz2000_cass") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) - MCFG_SCREEN_UPDATE_DRIVER(mz2000_state, screen_update_mz2000) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz2000) - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15) -MACHINE_CONFIG_END - - - -ROM_START( mz2000 ) - ROM_REGION( 0x1000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "mz20ipl.bin",0x0000, 0x0800, CRC(d7ccf37f) SHA1(692814ffc2cf50fa8bf9e30c96ebe4a9ee536a86)) - - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x10000, "wram", ROMREGION_ERASE00 ) - //ROM_LOAD( "vosque2000.mzt",0x0000, 0x80, CRC(1) SHA1(1)) - //ROM_CONTINUE( 0x0000, 0x7f80 ) - - ROM_REGION( 0x1000, "tvram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x10000, "gvram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x1800, "chargen", 0 ) -// ROM_LOAD( "mzfont.rom", 0x0000, 0x0800, BAD_DUMP CRC(0631efc3) SHA1(99b206af5c9845995733d877e9e93e9681b982a8) ) //original has JP characters - /* these are hand-crafted roms, converted from bmps floating around the net */ - ROM_LOAD( "font.bin", 0x0000, 0x0800, BAD_DUMP CRC(6ae6ce8e) SHA1(6adcdab9e4647429dd8deb73146264746b5eccda) ) - ROM_LOAD( "font400.bin", 0x0800, 0x1000, BAD_DUMP CRC(56c5d2bc) SHA1(fea655ff5eedacf8978fa3c185485db44376e24d) ) -ROM_END - -ROM_START( mz2200 ) - ROM_REGION( 0x10000, "ipl", 0 ) - ROM_LOAD( "mz2200ipl.bin", 0x0000, 0x0800, CRC(476801e8) SHA1(6b1f0620945c5492475ea1694bd09a3fcf88549d) ) - - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x10000, "wram", ROMREGION_ERASE00 ) - //ROM_LOAD( "vosque2000.mzt",0x0000, 0x80, CRC(1) SHA1(1)) - //ROM_CONTINUE( 0x0000, 0x7f80 ) - - ROM_REGION( 0x1000, "tvram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x10000, "gvram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x1800, "chargen", 0 ) -// ROM_LOAD( "mzfont.rom", 0x0000, 0x0800, BAD_DUMP CRC(0631efc3) SHA1(99b206af5c9845995733d877e9e93e9681b982a8) ) //original has JP characters - /* these are hand-crafted roms, converted from bmps floating around the net */ - ROM_LOAD( "font.bin", 0x0000, 0x0800, BAD_DUMP CRC(6ae6ce8e) SHA1(6adcdab9e4647429dd8deb73146264746b5eccda) ) - ROM_LOAD( "font400.bin", 0x0800, 0x1000, BAD_DUMP CRC(56c5d2bc) SHA1(fea655ff5eedacf8978fa3c185485db44376e24d) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, mz2000, mz80b, 0, mz2000, mz2000, driver_device, 0, "Sharp", "MZ-2000", MACHINE_NOT_WORKING ) -COMP( 1982, mz2200, mz80b, 0, mz2000, mz2000, driver_device, 0, "Sharp", "MZ-2200", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/mz2500.c b/src/mess/drivers/mz2500.c deleted file mode 100644 index 9e30a8c2ac5..00000000000 --- a/src/mess/drivers/mz2500.c +++ /dev/null @@ -1,2201 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/******************************************************************************************************************************** - - Sharp MZ-2500 (c) 1985 Sharp Corporation - - driver by Angelo Salese - - TODO: - - Kanji text is cutted in half when font_size is 1 / interlace is disabled, different ROM used? (check Back to the Future); - - Implement external ROM hook-up; - - Add remaining missing peripherals, SIO, HDD and w1300a network; - - FDC loading without the IPLPRO doesn't work at all, why? - - reverse / blanking tvram attributes; - - clean-ups! ^^' - - per-game/program specific TODO: - - Dust Box vol. 1-3: they die with text garbage, might be bad dumps; - - Dust Box vol. 4: window effect transition is bugged; - - Dust Box vol. n: three items returns "purple" text, presumably HW failures (DFJustin: joystick "digital", mouse "not installed", HDD "not installed"); - - LayDock: hangs at title screen due of a PIT bug (timer irq dies for whatever reason); - - Moon Child: needs mixed 3+3bpp tvram supported, kludged for now (not a real test case); - - Moon Child: window masking doesn't mask bottom part of the screen? - - Moon Child: appears to be a network / system link game, obviously doesn't work with current MAME / MESS framework; - - Marchen Veil I: doesn't load if you try to run it directly, it does if you load another game first (for example Mappy) then do a soft reset; - - Mugen no Shinzou II - The Prince of Darkness: dies on IPLPRO loading, presumably a wd17xx core bug; - - Multiplan: random hangs/crashes after you set the RTC, sometimes it loads properly; - - Murder Club: has lots of CG artifacts, FDC issue? - - Orrbit 3: floppy issue makes it to throw a game over as soon as you start a game; - - Penguin Kun Wars: has a bug with window effects ("Push space or trigger" msg on the bottom"), needs investigation; - - Sound Gal Music Editor: wants a "master disk", that apparently isn't available; - - Yukar K2 (normal version): moans about something, DFJustin: "please put the system disk back to normal", disk write-protected? - - memory map: - 0x00000-0x3ffff Work RAM - 0x40000-0x5ffff CG RAM - 0x60000-0x67fff "Read modify write" area (related to the CG RAM) (0x30-0x33) - 0x68000-0x6ffff IPL ROM (0x34-0x37) - 0x70000-0x71fff TVRAM (0x38) - 0x72000-0x73fff Kanji ROM / PCG RAM (banked) (0x39) - 0x74000-0x75fff Dictionary ROM (banked) (0x3a) - 0x76000-0x77fff NOP (0x3b) - 0x78000-0x7ffff Phone ROM (0x3c-0x3f) - -********************************************************************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "machine/i8255.h" -#include "machine/wd_fdc.h" -#include "machine/pit8253.h" -#include "sound/2203intf.h" -#include "sound/beep.h" -#include "machine/rp5c15.h" - -//#include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" - -#define RP5C15_TAG "rp5c15" - -class mz2500_state : public driver_device -{ -public: - mz2500_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_rtc(*this, RP5C15_TAG), - m_pit(*this, "pit"), - m_beeper(*this, "beeper"), - m_gfxdecode(*this, "gfxdecode"), - m_fdc(*this, "mb8877a"), - m_floppy0(*this, "mb8877a:0"), - m_floppy1(*this, "mb8877a:1"), - m_floppy2(*this, "mb8877a:2"), - m_floppy3(*this, "mb8877a:3"), - m_floppy(NULL), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_rtc; - required_device m_pit; - required_device m_beeper; - required_device m_gfxdecode; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - - floppy_image_device *m_floppy; - - UINT8 *m_main_ram; - UINT8 *m_ipl_rom; - UINT8 *m_kanji_rom; - UINT8 *m_kanji2_rom; - UINT8 *m_pcg_ram; - UINT8 *m_emm_ram; - UINT8 *m_dic_rom; - UINT8 *m_phone_rom; - UINT8 *m_iplpro_rom; - - UINT8 m_bank_val[8]; - UINT8 m_bank_addr; - UINT8 m_irq_sel; - UINT8 m_irq_vector[4]; - UINT8 m_irq_mask[4]; - UINT8 m_irq_pending[4]; - UINT8 m_kanji_bank; - UINT8 m_dic_bank; - UINT8 m_fdc_reverse; - UINT8 m_key_mux; - UINT8 m_monitor_type; - UINT8 m_text_reg[0x100]; - UINT8 m_text_reg_index; - UINT8 m_text_col_size; - UINT8 m_text_font_reg; - UINT8 m_pal_select; - UINT16 m_cg_vs; - UINT16 m_cg_ve; - UINT16 m_cg_hs; - UINT16 m_cg_he; - INT16 m_tv_vs; - INT16 m_tv_ve; - INT16 m_tv_hs; - INT16 m_tv_he; - UINT8 m_cg_latch[4]; - UINT8 m_cg_reg_index; - UINT8 m_cg_reg[0x20]; - UINT8 m_clut16[0x10]; - UINT16 m_clut256[0x100]; - UINT8 m_cg_mask; - int m_scr_x_size; - int m_scr_y_size; - UINT8 m_cg_clear_flag; - UINT32 m_rom_index; - UINT8 m_hrom_index; - UINT8 m_lrom_index; - struct { UINT8 r,g,b; } m_pal[16]; - UINT8 m_joy_mode; - UINT16 m_kanji_index; - UINT32 m_emm_offset; - UINT8 m_old_portc; - UINT8 m_prev_col_val; - UINT8 m_pio_latchb; - UINT8 m_ym_porta; - UINT8 m_screen_enable; - DECLARE_READ8_MEMBER(bank0_r); - DECLARE_READ8_MEMBER(bank1_r); - DECLARE_READ8_MEMBER(bank2_r); - DECLARE_READ8_MEMBER(bank3_r); - DECLARE_READ8_MEMBER(bank4_r); - DECLARE_READ8_MEMBER(bank5_r); - DECLARE_READ8_MEMBER(bank6_r); - DECLARE_READ8_MEMBER(bank7_r); - DECLARE_WRITE8_MEMBER(bank0_w); - DECLARE_WRITE8_MEMBER(bank1_w); - DECLARE_WRITE8_MEMBER(bank2_w); - DECLARE_WRITE8_MEMBER(bank3_w); - DECLARE_WRITE8_MEMBER(bank4_w); - DECLARE_WRITE8_MEMBER(bank5_w); - DECLARE_WRITE8_MEMBER(bank6_w); - DECLARE_WRITE8_MEMBER(bank7_w); - DECLARE_READ8_MEMBER(mz2500_bank_addr_r); - DECLARE_WRITE8_MEMBER(mz2500_bank_addr_w); - DECLARE_READ8_MEMBER(mz2500_bank_data_r); - DECLARE_WRITE8_MEMBER(mz2500_bank_data_w); - DECLARE_WRITE8_MEMBER(mz2500_kanji_bank_w); - DECLARE_WRITE8_MEMBER(mz2500_dictionary_bank_w); - DECLARE_READ8_MEMBER(mz2500_crtc_hvblank_r); - DECLARE_WRITE8_MEMBER(mz2500_tv_crtc_w); - DECLARE_WRITE8_MEMBER(mz2500_irq_sel_w); - DECLARE_WRITE8_MEMBER(mz2500_irq_data_w); - DECLARE_READ8_MEMBER(mz2500_rom_r); - DECLARE_WRITE8_MEMBER(mz2500_rom_w); - DECLARE_WRITE8_MEMBER(palette4096_io_w); - DECLARE_READ8_MEMBER(mz2500_bplane_latch_r); - DECLARE_READ8_MEMBER(mz2500_rplane_latch_r); - DECLARE_READ8_MEMBER(mz2500_gplane_latch_r); - DECLARE_READ8_MEMBER(mz2500_iplane_latch_r); - DECLARE_WRITE8_MEMBER(mz2500_cg_addr_w); - DECLARE_WRITE8_MEMBER(mz2500_cg_data_w); - DECLARE_WRITE8_MEMBER(timer_w); - DECLARE_READ8_MEMBER(mz2500_joystick_r); - DECLARE_WRITE8_MEMBER(mz2500_joystick_w); - DECLARE_READ8_MEMBER(mz2500_kanji_r); - DECLARE_WRITE8_MEMBER(mz2500_kanji_w); - DECLARE_READ8_MEMBER(rp5c15_8_r); - DECLARE_WRITE8_MEMBER(rp5c15_8_w); - DECLARE_READ8_MEMBER(mz2500_emm_data_r); - DECLARE_WRITE8_MEMBER(mz2500_emm_addr_w); - DECLARE_WRITE8_MEMBER(mz2500_emm_data_w); - UINT8 mz2500_cg_latch_compare(); - UINT8 mz2500_ram_read(UINT16 offset, UINT8 bank_num); - void mz2500_ram_write(UINT16 offset, UINT8 data, UINT8 bank_num); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(mz2500); - UINT32 screen_update_mz2500(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(mz2500_vbl); - - DECLARE_READ8_MEMBER(fdc_r); - DECLARE_WRITE8_MEMBER(fdc_w); - DECLARE_WRITE8_MEMBER(floppy_select_w); - DECLARE_WRITE8_MEMBER(floppy_side_w); - - DECLARE_READ8_MEMBER(mz2500_porta_r); - DECLARE_READ8_MEMBER(mz2500_portb_r); - DECLARE_READ8_MEMBER(mz2500_portc_r); - DECLARE_WRITE8_MEMBER(mz2500_porta_w); - DECLARE_WRITE8_MEMBER(mz2500_portb_w); - DECLARE_WRITE8_MEMBER(mz2500_portc_w); - DECLARE_WRITE8_MEMBER(mz2500_pio1_porta_w); - DECLARE_READ8_MEMBER(mz2500_pio1_porta_r); - DECLARE_READ8_MEMBER(mz2500_pio1_portb_r); - DECLARE_READ8_MEMBER(opn_porta_r); - DECLARE_WRITE8_MEMBER(opn_porta_w); - DECLARE_WRITE_LINE_MEMBER(pit8253_clk0_irq); - DECLARE_WRITE_LINE_MEMBER(mz2500_rtc_alarm_irq); - IRQ_CALLBACK_MEMBER( mz2500_irq_ack ); - - void draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr); - void draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr); - void draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri); - void draw_cg16_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri); - void draw_cg256_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri); - void draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect); - void draw_cg_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri); - - void mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,UINT16 pen,UINT8 width,UINT8 height); - void mz2500_reconfigure_screen(); - UINT8 pal_256_param(int index, int param); - void mz2500_reset(mz2500_state *state, UINT8 type); - required_device m_palette; -}; - - -/* machine stuff */ - -#define WRAM_RESET 0 -#define IPL_RESET 1 - -static const UINT8 bank_reset_val[2][8] = -{ - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }, - { 0x34, 0x35, 0x36, 0x37, 0x04, 0x05, 0x06, 0x07 } -}; - -/* video stuff*/ - -void mz2500_state::video_start() -{ -} - -/* -[0] xxxx xxxx tile -[1] ---- -xxx color offset -[1] ---- x--- PCG combine mode -[1] --xx ---- PCG select -[1] xx-- ---- reverse / blink attributes -[2] --xx xxxx tile bank (for kanji ROMs) -[2] xx-- ---- kanji select -*/ - -/* helper function, to draw stuff without getting crazy with height / width conditions :) */ -void mz2500_state::mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,UINT16 pen,UINT8 width,UINT8 height) -{ - if(width && height) - { - bitmap.pix16(y*2+0, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y*2+0, x*2+1) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x*2+1) = m_palette->pen(pen); - } - else if(width) - { - bitmap.pix16(y, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y, x*2+1) = m_palette->pen(pen); - } - else if(height) - { - bitmap.pix16(y*2+0, x) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x) = m_palette->pen(pen); - } - else - bitmap.pix16(y, x) = m_palette->pen(pen); -} - -void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr) -{ - UINT8 *vram = m_main_ram; // TODO - int x,y,count,xi,yi; - UINT8 *gfx_data; - UINT8 y_step; - UINT8 s_y; - UINT8 y_height; - - count = (map_addr & 0x7ff); - - y_step = (m_text_font_reg) ? 1 : 2; - y_height = (m_text_reg[0] & 0x10) ? 10 : 8; - s_y = m_text_reg[9] & 0xf; - - for (y=0;y<26*y_step;y+=y_step) - { - for (x=0;x<80;x++) - { - int tile = vram[0x70000+count+0x0000] & 0xff; - int attr = vram[0x70000+count+0x0800]; - int tile_bank = vram[0x70000+count+0x1000] & 0x3f; - int gfx_sel = (attr & 0x38) | (vram[0x70000+count+0x1000] & 0xc0); - int color = attr & 7; - int inv_col = (attr & 0x40) >> 6; - - if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms - gfx_data = m_pcg_ram; - else if(gfx_sel == 0x80) - { - gfx_data = m_kanji_rom; - tile|= tile_bank << 8; - if(y_step == 2) - tile &= 0x3ffe; - } - else if(gfx_sel == 0xc0) - { - gfx_data = m_kanji_rom; - tile|= (tile_bank << 8); - if(y_step == 2) - tile &= 0x3ffe; - tile|=0x4000; - } - else - { - gfx_data = m_pcg_ram; - } - - for(yi=0;yi<8*y_step;yi++) - { - for(xi=0;xi<8;xi++) - { - UINT8 pen_bit[3],pen; - int res_x,res_y; - - res_x = x*8+xi; - res_y = y*y_height+yi-s_y; - - /* check TV window boundaries */ - if(res_x < m_tv_hs || res_x >= m_tv_he || res_y < m_tv_vs || res_y >= m_tv_ve) - continue; - - if(gfx_sel & 0x8) - { - pen_bit[0] = ((gfx_data[tile*8+yi+0x1800]>>(7-xi)) & 1) ? (4+8) : 0; //G - pen_bit[1] = ((gfx_data[tile*8+yi+0x1000]>>(7-xi)) & 1) ? (2+8) : 0; //R - pen_bit[2] = ((gfx_data[tile*8+yi+0x0800]>>(7-xi)) & 1) ? (1+8) : 0; //B - - pen = (pen_bit[0]|pen_bit[1]|pen_bit[2]); - - //if(inv_col) { pen ^= 7; } breaks Mappy - } - else - pen = (((gfx_data[tile*8+yi+((gfx_sel & 0x30)<<7)]>>(7-xi)) & 1) ^ inv_col) ? (color+8) : 0; - - if(pen) - { - if((res_y) >= 0 && (res_y) < 200*y_step) - mz2500_draw_pixel(bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),0,0); - } - } - } - - count++; - count&=0x7ff; - } - } -} - -void mz2500_state::draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr) -{ - UINT8 *vram = m_main_ram; // TODO - int x,y,count,xi,yi; - UINT8 *gfx_data; - UINT8 y_step; - UINT8 s_y; - UINT8 y_height; - - count = (((plane * 0x400) + map_addr) & 0x7ff); - - y_step = (m_text_font_reg) ? 1 : 2; - y_height = (m_text_reg[0] & 0x10) ? 10 : 8; - s_y = m_text_reg[9] & 0xf; - - for (y=0;y<26*y_step;y+=y_step) - { - for (x=0;x<40;x++) - { - int tile = vram[0x70000+count+0x0000] & 0xff; - int attr = vram[0x70000+count+0x0800]; - int tile_bank = vram[0x70000+count+0x1000] & 0x3f; - int gfx_sel = (attr & 0x38) | (vram[0x70000+count+0x1000] & 0xc0); - //int gfx_num; - int color = attr & 7; - int inv_col = (attr & 0x40) >> 6; - - if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms - gfx_data = m_pcg_ram; - else if(gfx_sel == 0x80) - { - gfx_data = m_kanji_rom; - tile|= tile_bank << 8; - if(y_step == 2) - tile &= 0x3ffe; - } - else if(gfx_sel == 0xc0) - { - gfx_data = m_kanji_rom; - tile|= (tile_bank << 8); - if(y_step == 2) - tile &= 0x3ffe; - tile|=0x4000; - } - else - { - gfx_data = m_pcg_ram; - } - - for(yi=0;yi<8*y_step;yi++) - { - for(xi=0;xi<8;xi++) - { - UINT8 pen_bit[3],pen; - int res_x,res_y; - - res_x = x*8+xi; - res_y = y*y_height+yi-s_y; - - /* check TV window boundaries */ - if(res_x < m_tv_hs || res_x >= m_tv_he || res_y < m_tv_vs || res_y >= m_tv_ve) - continue; - - if(gfx_sel & 0x8) - { - pen_bit[0] = ((gfx_data[tile*8+yi+0x1800]>>(7-xi)) & 1) ? (4+8) : 0; //G - pen_bit[1] = ((gfx_data[tile*8+yi+0x1000]>>(7-xi)) & 1) ? (2+8) : 0; //R - pen_bit[2] = ((gfx_data[tile*8+yi+0x0800]>>(7-xi)) & 1) ? (1+8) : 0; //B - - pen = (pen_bit[0]|pen_bit[1]|pen_bit[2]); - - //if(inv_col) { pen ^= 7; } breaks Mappy - } - else - pen = (((gfx_data[tile*8+yi+((gfx_sel & 0x30)<<7)]>>(7-xi)) & 1) ^ inv_col) ? (color+8) : 0; - - if(pen) - { - if((res_y) >= 0 && (res_y) < 200*y_step) - mz2500_draw_pixel(bitmap,res_x,res_y,pen+(m_pal_select ? 0x00 : 0x10),m_scr_x_size == 640,0); - } - } - } - - count++; - count&=0x7ff; - } - } -} - -void mz2500_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) -{ - UINT32 count; - UINT8 *vram = m_main_ram; // TODO - UINT8 pen,pen_bit[2]; - int x,y,xi,pen_i; - int res_x,res_y; - - count = 0x40000; - - for(y=0;y<400;y++) - { - for(x=0;x<640;x+=8) - { - for(xi=0;xi<8;xi++) - { - res_x = x+xi; - res_y = y; - - /* check window boundaries */ - //if(res_x < m_cg_hs || res_x >= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) - // continue; - - /* TODO: very preliminary, just Yukar K2 uses this so far*/ - pen_bit[0] = (vram[count + 0x00000]>>(xi)) & 1 ? 7 : 0; // B - pen_bit[1] = (vram[count + 0x0c000]>>(xi)) & 1 ? 7 : 0; // R - - pen = 0; - for(pen_i=0;pen_i<2;pen_i++) - pen |= pen_bit[pen_i]; - - { - //if(pri == ((m_clut256[pen] & 0x100) >> 8)) - mz2500_draw_pixel(bitmap,res_x,res_y,pen,0,0); - } - } - count++; - } - } -} - -void mz2500_state::draw_cg16_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri) -{ - UINT32 count; - UINT8 *vram = m_main_ram; //TODO - UINT8 pen,pen_bit[4]; - int x,y,xi,pen_i; - UINT32 wa_reg; - UINT8 s_x; - UINT8 base_mask; - int res_x,res_y; - UINT8 cg_interlace; - UINT8 pen_mask; - - base_mask = (x_size == 640) ? 0x3f : 0x1f; - - count = (m_cg_reg[0x10]) | ((m_cg_reg[0x11] & base_mask) << 8); - wa_reg = (m_cg_reg[0x12]) | ((m_cg_reg[0x13] & base_mask) << 8); - /* TODO: layer 2 scrolling */ - s_x = (m_cg_reg[0x0f] & 0xf); - cg_interlace = m_text_font_reg ? 1 : 2; - pen_mask = (m_cg_reg[0x18] >> ((plane & 1) * 4)) & 0x0f; - -// popmessage("%d %d %d %d",m_cg_hs,m_cg_he,m_cg_vs,m_cg_ve); - - for(y=0;y<200;y++) - { - for(x=0;x= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) - continue; - - pen_bit[0] = (vram[count+0x40000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x01) : 0; //B - pen_bit[1] = (vram[count+0x44000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x02) : 0; //R - pen_bit[2] = (vram[count+0x48000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x04) : 0; //G - pen_bit[3] = (vram[count+0x4c000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x08) : 0; //I - - pen = 0; - for(pen_i=0;pen_i<4;pen_i++) - pen |= pen_bit[pen_i]; - - if(pri == ((m_clut16[pen] & 0x10) >> 4) && m_clut16[pen] != 0x00 && pen_mask) //correct? - mz2500_draw_pixel(bitmap,res_x,res_y,(m_clut16[pen] & 0x0f)+0x10,(x_size == 320 && m_scr_x_size == 640),cg_interlace == 2); - } - count++; - count&=((base_mask<<8) | 0xff); - if(count > wa_reg) - count = 0; - } - } -} - -void mz2500_state::draw_cg256_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri) -{ - UINT32 count; - UINT8 *vram = m_main_ram; - UINT8 pen,pen_bit[8]; - int x,y,xi,pen_i; - UINT32 wa_reg; - UINT8 s_x; - UINT8 base_mask; - int res_x,res_y; - UINT8 cg_interlace; - - base_mask = 0x3f; //no x_size == 640 - - count = (m_cg_reg[0x10]) | ((m_cg_reg[0x11] & base_mask) << 8); - wa_reg = (m_cg_reg[0x12]) | ((m_cg_reg[0x13] & base_mask) << 8); - /* TODO: layer 2 scrolling */ - s_x = (m_cg_reg[0x0f] & 0xf); - cg_interlace = m_text_font_reg ? 1 : 2; - - for(y=0;y<200;y++) - { - for(x=0;x<320;x+=8) - { - for(xi=0;xi<8;xi++) - { - res_x = x+xi+s_x; - res_y = y; - - /* check window boundaries */ - if(res_x < m_cg_hs || res_x >= m_cg_he || res_y < m_cg_vs || res_y >= m_cg_ve) - continue; - - pen_bit[0] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x2000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x10) : 0; // B1 - pen_bit[1] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x0000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x01) : 0; // B0 - pen_bit[2] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x6000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x20) : 0; // R1 - pen_bit[3] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x4000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x02) : 0; // R0 - pen_bit[4] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xa000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x40) : 0; // G1 - pen_bit[5] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x8000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x04) : 0; // G0 - pen_bit[6] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xe000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x80) : 0; // I1 - pen_bit[7] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xc000]>>(xi)) & 1 ? (m_cg_reg[0x18] & 0x08) : 0; // I0 - - pen = 0; - for(pen_i=0;pen_i<8;pen_i++) - pen |= pen_bit[pen_i]; - - if(pri == ((m_clut256[pen] & 0x100) >> 8)) - mz2500_draw_pixel(bitmap,res_x,res_y,(m_clut256[pen] & 0xff)+0x100,m_scr_x_size == 640,cg_interlace == 2); - } - count++; - count&=((base_mask<<8) | 0xff); - if(count > wa_reg) - count = 0; - } - } -} - -void mz2500_state::draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect) -{ - UINT16 base_addr; - - base_addr = m_text_reg[1] | ((m_text_reg[2] & 0x7) << 8); - -// popmessage("%02x",m_clut16[0]); -// popmessage("%d %d %d %d",m_tv_hs,(m_tv_he),m_tv_vs,(m_tv_ve)); - - if(m_text_col_size) - draw_80x25(bitmap,cliprect,base_addr); - else - { - int tv_mode; - - tv_mode = m_text_reg[0] >> 2; - - switch(tv_mode & 3) - { - case 0: //mixed 6bpp mode, TODO - draw_40x25(bitmap,cliprect,0,base_addr); - break; - case 1: - draw_40x25(bitmap,cliprect,0,base_addr); - break; - case 2: - draw_40x25(bitmap,cliprect,1,base_addr); - break; - case 3: - draw_40x25(bitmap,cliprect,1,base_addr); - draw_40x25(bitmap,cliprect,0,base_addr); - break; - //default: popmessage("%02x %02x %02x",tv_mode & 3,m_text_reg[1],m_text_reg[2]); break; - } - } -} - -void mz2500_state::draw_cg_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) -{ - //popmessage("%02x %02x",m_cg_reg[0x0e],m_cg_reg[0x18]); - - switch(m_cg_reg[0x0e]) - { - case 0x00: - break; - case 0x03: - draw_cg4_screen(bitmap,cliprect,0); - break; - case 0x14: - draw_cg16_screen(bitmap,cliprect,0,320,pri); - draw_cg16_screen(bitmap,cliprect,1,320,pri); - break; - case 0x15: - draw_cg16_screen(bitmap,cliprect,1,320,pri); - draw_cg16_screen(bitmap,cliprect,0,320,pri); - break; - case 0x17: - draw_cg16_screen(bitmap,cliprect,0,640,pri); - break; - case 0x1d: - draw_cg256_screen(bitmap,cliprect,0,pri); - break; - case 0x97: - draw_cg16_screen(bitmap,cliprect,2,640,pri); - break; - default: - popmessage("Unsupported CG mode %02x, contact MESS dev",m_cg_reg[0x0e]); - break; - } -} - -UINT32 mz2500_state::screen_update_mz2500(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(m_palette->pen(0), cliprect); //TODO: correct? - - if(m_screen_enable) - return 0; - - draw_cg_screen(bitmap,cliprect,0); - draw_tv_screen(bitmap,cliprect); - draw_cg_screen(bitmap,cliprect,1); - // popmessage("%02x (%02x %02x) (%02x %02x) (%02x %02x) (%02x %02x)",m_cg_reg[0x0f],m_cg_reg[0x10],m_cg_reg[0x11],m_cg_reg[0x12],m_cg_reg[0x13],m_cg_reg[0x14],m_cg_reg[0x15],m_cg_reg[0x16],m_cg_reg[0x17]); - // popmessage("%02x",m_text_reg[0x0f]); - - - return 0; -} - -void mz2500_state::mz2500_reconfigure_screen() -{ - rectangle visarea; - - if((m_cg_reg[0x0e] & 0x1f) == 0x17 || (m_cg_reg[0x0e] & 0x1f) == 0x03 || m_text_col_size) - m_scr_x_size = 640; - else - m_scr_x_size = 320; - - if((m_cg_reg[0x0e] & 0x1f) == 0x03) - m_scr_y_size = 400; - else - m_scr_y_size = 200 * ((m_text_font_reg) ? 1 : 2); - - visarea.set(0, m_scr_x_size - 1, 0, m_scr_y_size - 1); - - //popmessage("%d %d %d %d %02x",vs,ve,hs,he,m_cg_reg[0x0e]); - - machine().first_screen()->configure(720, 480, visarea, machine().first_screen()->frame_period().attoseconds()); - - /* calculate CG window parameters here */ - m_cg_vs = (m_cg_reg[0x08]) | ((m_cg_reg[0x09]<<8) & 1); - m_cg_ve = (m_cg_reg[0x0a]) | ((m_cg_reg[0x0b]<<8) & 1); - m_cg_hs = ((m_cg_reg[0x0c] & 0x7f)*8); - m_cg_he = ((m_cg_reg[0x0d] & 0x7f)*8); - - if(m_scr_x_size == 320) - { - m_cg_hs /= 2; - m_cg_he /= 2; - } - - /* calculate TV window parameters here */ - { - int x_offs,y_offs; - - m_monitor_type = ((m_text_reg[0x0f] & 0x08) >> 3); - - switch((m_monitor_type|m_text_col_size<<1) & 3) - { - default: - case 0: x_offs = 64; break; - case 1: x_offs = 80; break; - case 2: x_offs = 72; break; - case 3: x_offs = 88; break; - } - //printf("%d %d %d\n",x_offs,(m_text_reg[7] & 0x7f) * 8,(m_text_reg[8] & 0x7f)* 8); - - y_offs = (m_monitor_type) ? 76 : 34; - - m_tv_hs = ((m_text_reg[7] & 0x7f)*8) - x_offs; - m_tv_he = ((m_text_reg[8] & 0x7f)*8) - x_offs; - m_tv_vs = (m_text_reg[3]*2) - y_offs; - m_tv_ve = (m_text_reg[5]*2) - y_offs; - - if(m_scr_x_size == 320) - { - m_tv_hs /= 2; - m_tv_he /= 2; - } - - if(m_scr_y_size == 200) - { - m_tv_vs /= 2; - m_tv_ve /= 2; - } - } -} - -UINT8 mz2500_state::mz2500_cg_latch_compare() -{ - UINT8 compare_val = m_cg_reg[0x07] & 0xf; - UINT8 pix_val; - UINT8 res; - UINT16 i; - res = 0; - - for(i=1;i<0x100;i<<=1) - { - pix_val = ((m_cg_latch[0] & i) ? 1 : 0) | ((m_cg_latch[1] & i) ? 2 : 0) | ((m_cg_latch[2] & i) ? 4 : 0) | ((m_cg_latch[3] & i) ? 8 : 0); - if(pix_val == compare_val) - res|=i; - } - - return res; -} - -UINT8 mz2500_state::mz2500_ram_read(UINT16 offset, UINT8 bank_num) -{ - UINT8 *ram = m_main_ram; // TODO - UINT8 cur_bank = m_bank_val[bank_num]; - - switch(cur_bank) - { - case 0x30: - case 0x31: - case 0x32: - case 0x33: - { - // READ MODIFY WRITE - if(m_cg_reg[0x0e] == 0x3) - { - // ... - } - else - { - int plane; - m_cg_latch[0] = ram[offset+((cur_bank & 3)*0x2000)+0x40000]; //B - m_cg_latch[1] = ram[offset+((cur_bank & 3)*0x2000)+0x44000]; //R - m_cg_latch[2] = ram[offset+((cur_bank & 3)*0x2000)+0x48000]; //G - m_cg_latch[3] = ram[offset+((cur_bank & 3)*0x2000)+0x4c000]; //I - plane = m_cg_reg[0x07] & 3; - - if(m_cg_reg[0x07] & 0x10) - return mz2500_cg_latch_compare(); - else - return m_cg_latch[plane]; - } - } - break; - case 0x39: - { - if(m_kanji_bank & 0x80) //kanji ROM - return m_kanji_rom[(offset & 0x7ff)+((m_kanji_bank & 0x7f)*0x800)]; - else //PCG RAM - return m_pcg_ram[offset]; - } - case 0x3a: - { - return m_dic_rom[(offset & 0x1fff) + ((m_dic_bank & 0x1f)*0x2000)]; - } - case 0x3c: - case 0x3d: - case 0x3e: - case 0x3f: - { - return m_phone_rom[offset+(cur_bank & 3)*0x2000]; - } - default: return ram[offset+cur_bank*0x2000]; - } - - // never executed - return 0xff; -} - -void mz2500_state::mz2500_ram_write(UINT16 offset, UINT8 data, UINT8 bank_num) -{ - UINT8 *ram = m_main_ram; // TODO - UINT8 cur_bank = m_bank_val[bank_num]; - -// if(cur_bank >= 0x30 && cur_bank <= 0x33) -// printf("CG REG = %02x %02x %02x %02x | offset = %04x | data = %02x\n",m_cg_reg[0],m_cg_reg[1],m_cg_reg[2],m_cg_reg[3],offset,data); - - switch(cur_bank) - { - case 0x30: - case 0x31: - case 0x32: - case 0x33: - { - // READ MODIFY WRITE - if(m_cg_reg[0x0e] == 0x3) - { - // ... - } - else - { - if((m_cg_reg[0x05] & 0xc0) == 0x00) //replace - { - if(m_cg_reg[5] & 1) //B - { - ram[offset+((cur_bank & 3)*0x2000)+0x40000] &= ~m_cg_reg[6]; - ram[offset+((cur_bank & 3)*0x2000)+0x40000] |= (m_cg_reg[4] & 1) ? (data & m_cg_reg[0] & m_cg_reg[6]) : 0; - } - if(m_cg_reg[5] & 2) //R - { - ram[offset+((cur_bank & 3)*0x2000)+0x44000] &= ~m_cg_reg[6]; - ram[offset+((cur_bank & 3)*0x2000)+0x44000] |= (m_cg_reg[4] & 2) ? (data & m_cg_reg[1] & m_cg_reg[6]) : 0; - } - if(m_cg_reg[5] & 4) //G - { - ram[offset+((cur_bank & 3)*0x2000)+0x48000] &= ~m_cg_reg[6]; - ram[offset+((cur_bank & 3)*0x2000)+0x48000] |= (m_cg_reg[4] & 4) ? (data & m_cg_reg[2] & m_cg_reg[6]) : 0; - } - if(m_cg_reg[5] & 8) //I - { - ram[offset+((cur_bank & 3)*0x2000)+0x4c000] &= ~m_cg_reg[6]; - ram[offset+((cur_bank & 3)*0x2000)+0x4c000] |= (m_cg_reg[4] & 8) ? (data & m_cg_reg[3] & m_cg_reg[6]) : 0; - } - } - else if((m_cg_reg[0x05] & 0xc0) == 0x40) //pset - { - if(m_cg_reg[5] & 1) //B - { - ram[offset+((cur_bank & 3)*0x2000)+0x40000] &= ~data; - ram[offset+((cur_bank & 3)*0x2000)+0x40000] |= (m_cg_reg[4] & 1) ? (data & m_cg_reg[0]) : 0; - } - if(m_cg_reg[5] & 2) //R - { - ram[offset+((cur_bank & 3)*0x2000)+0x44000] &= ~data; - ram[offset+((cur_bank & 3)*0x2000)+0x44000] |= (m_cg_reg[4] & 2) ? (data & m_cg_reg[1]) : 0; - } - if(m_cg_reg[5] & 4) //G - { - ram[offset+((cur_bank & 3)*0x2000)+0x48000] &= ~data; - ram[offset+((cur_bank & 3)*0x2000)+0x48000] |= (m_cg_reg[4] & 4) ? (data & m_cg_reg[2]) : 0; - } - if(m_cg_reg[5] & 8) //I - { - ram[offset+((cur_bank & 3)*0x2000)+0x4c000] &= ~data; - ram[offset+((cur_bank & 3)*0x2000)+0x4c000] |= (m_cg_reg[4] & 8) ? (data & m_cg_reg[3]) : 0; - } - } - } - break; - } - case 0x34: - case 0x35: - case 0x36: - case 0x37: - { - // IPL ROM, WRITENOP - //printf("%04x %02x\n",offset+bank_num*0x2000,data); - break; - } - case 0x38: - { - // TVRAM - ram[offset+cur_bank*0x2000] = data; - break; - } - case 0x39: - { - ram[offset+cur_bank*0x2000] = data; - if(m_kanji_bank & 0x80) //kanji ROM - { - //NOP - } - else //PCG RAM - { - m_pcg_ram[offset] = data; - if((offset & 0x1800) == 0x0000) - m_gfxdecode->gfx(3)->mark_dirty((offset) >> 3); - else - m_gfxdecode->gfx(4)->mark_dirty((offset & 0x7ff) >> 3); - } - break; - } - case 0x3a: - { - // DIC ROM, WRITENOP - break; - } - case 0x3c: - case 0x3d: - case 0x3e: - case 0x3f: - { - // PHONE ROM, WRITENOP - break; - } - default: ram[offset+cur_bank*0x2000] = data; break; - } -} - -READ8_MEMBER(mz2500_state::bank0_r){ return mz2500_ram_read(offset, 0); } -READ8_MEMBER(mz2500_state::bank1_r){ return mz2500_ram_read(offset, 1); } -READ8_MEMBER(mz2500_state::bank2_r){ return mz2500_ram_read(offset, 2); } -READ8_MEMBER(mz2500_state::bank3_r){ return mz2500_ram_read(offset, 3); } -READ8_MEMBER(mz2500_state::bank4_r){ return mz2500_ram_read(offset, 4); } -READ8_MEMBER(mz2500_state::bank5_r){ return mz2500_ram_read(offset, 5); } -READ8_MEMBER(mz2500_state::bank6_r){ return mz2500_ram_read(offset, 6); } -READ8_MEMBER(mz2500_state::bank7_r){ return mz2500_ram_read(offset, 7); } -WRITE8_MEMBER(mz2500_state::bank0_w){ mz2500_ram_write(offset, data, 0); } -WRITE8_MEMBER(mz2500_state::bank1_w){ mz2500_ram_write(offset, data, 1); } -WRITE8_MEMBER(mz2500_state::bank2_w){ mz2500_ram_write(offset, data, 2); } -WRITE8_MEMBER(mz2500_state::bank3_w){ mz2500_ram_write(offset, data, 3); } -WRITE8_MEMBER(mz2500_state::bank4_w){ mz2500_ram_write(offset, data, 4); } -WRITE8_MEMBER(mz2500_state::bank5_w){ mz2500_ram_write(offset, data, 5); } -WRITE8_MEMBER(mz2500_state::bank6_w){ mz2500_ram_write(offset, data, 6); } -WRITE8_MEMBER(mz2500_state::bank7_w){ mz2500_ram_write(offset, data, 7); } - - -READ8_MEMBER(mz2500_state::mz2500_bank_addr_r) -{ - return m_bank_addr; -} - -WRITE8_MEMBER(mz2500_state::mz2500_bank_addr_w) -{ -// printf("%02x\n",data); - m_bank_addr = data & 7; -} - -READ8_MEMBER(mz2500_state::mz2500_bank_data_r) -{ - UINT8 res; - - res = m_bank_val[m_bank_addr]; - - m_bank_addr++; - m_bank_addr&=7; - - return res; -} - -WRITE8_MEMBER(mz2500_state::mz2500_bank_data_w) -{ -// static const char *const bank_name[] = { "bank0", "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7" }; - - m_bank_val[m_bank_addr] = data & 0x3f; - -// if((data*2) >= 0x70) -// printf("%s %02x\n",bank_name[m_bank_addr],m_bank_val[m_bank_addr]*2); - -// membank(bank_name[m_bank_addr])->set_base(&m_main_ram[m_bank_val[m_bank_addr]*0x2000]); - - m_bank_addr++; - m_bank_addr&=7; -} - -WRITE8_MEMBER(mz2500_state::mz2500_kanji_bank_w) -{ - m_kanji_bank = data; -} - -WRITE8_MEMBER(mz2500_state::mz2500_dictionary_bank_w) -{ - m_dic_bank = data; -} - -/* 0xf4 - 0xf7 all returns vblank / hblank states */ -READ8_MEMBER(mz2500_state::mz2500_crtc_hvblank_r) -{ - UINT8 vblank_bit, hblank_bit; - - vblank_bit = machine().first_screen()->vblank() ? 0 : 1; - hblank_bit = machine().first_screen()->hblank() ? 0 : 2; - - return vblank_bit | hblank_bit; -} - -/* -TVRAM / CRTC registers - -[0x00] ---x ---- line height (0) 16 (1) 20 -[0x00] ---- xx-- 40 column mode (0) 64 colors (1) screen 1 (2) screen 2 (3) screen 1 + screen 2 -[0x00] ---- --x- (related to the transparent pen) -[0x01] xxxx xxxx TV map offset low address value -[0x02] ---- -xxx TV map offset high address value -[0x03] xxxx xxxx CRTC vertical start register - -[0x05] xxxx xxxx CRTC vertical end register - -[0x07] -xxx xxxx CRTC horizontal start register -[0x08] -xxx xxxx CRTC horizontal end register -[0x09] ---- xxxx vertical scrolling shift position -[0x0a] --GG RRBB 256 color mode -[0x0b] -r-- ---- Back plane red gradient -[0x0b] ---- -b-- Back plane blue gradient -[0x0b] ---- ---i Back plane i gradient -[0x0c] ---- ---g Back plane green gradient - -[0x0f] ---- x--- sets monitor type interlace / progressive -*/ - -UINT8 mz2500_state::pal_256_param(int index, int param) -{ - UINT8 val = 0; - - switch(param & 3) - { - case 0: val = index & 0x80 ? 1 : 0; break; - case 1: val = index & 0x08 ? 1 : 0; break; - case 2: val = 1; break; - case 3: val = 0; break; - } - - return val; -} - -WRITE8_MEMBER(mz2500_state::mz2500_tv_crtc_w) -{ - switch(offset) - { - case 0: m_text_reg_index = data; break; - case 1: - m_text_reg[m_text_reg_index] = data; - - #if 0 - //printf("[%02x] <- %02x\n",m_text_reg_index,data); - popmessage("(%02x %02x) (%02x %02x %02x %02x) (%02x %02x %02x) (%02x %02x %02x %02x)" - ,m_text_reg[0] & ~0x1e,m_text_reg[3] - ,m_text_reg[4],m_text_reg[5],m_text_reg[6],m_text_reg[7] - ,m_text_reg[8],m_text_reg[10],m_text_reg[11] - ,m_text_reg[12],m_text_reg[13],m_text_reg[14],m_text_reg[15]); - - #endif - //popmessage("%d %02x %d %02x %d %d",m_text_reg[3],m_text_reg[4],m_text_reg[5],m_text_reg[6],m_text_reg[7]*8,m_text_reg[8]*8); - - mz2500_reconfigure_screen(); - - if(m_text_reg_index == 0x0a) // set 256 color palette - { - int i,r,g,b; - UINT8 b_param,r_param,g_param; - - b_param = (data & 0x03) >> 0; - r_param = (data & 0x0c) >> 2; - g_param = (data & 0x30) >> 4; - - for(i = 0;i < 0x100;i++) - { - int bit0,bit1,bit2; - - bit0 = pal_256_param(i,b_param) ? 1 : 0; - bit1 = i & 0x01 ? 2 : 0; - bit2 = i & 0x10 ? 4 : 0; - b = bit0|bit1|bit2; - bit0 = pal_256_param(i,r_param) ? 1 : 0; - bit1 = i & 0x02 ? 2 : 0; - bit2 = i & 0x20 ? 4 : 0; - r = bit0|bit1|bit2; - bit0 = pal_256_param(i,g_param) ? 1 : 0; - bit1 = i & 0x04 ? 2 : 0; - bit2 = i & 0x40 ? 4 : 0; - g = bit0|bit1|bit2; - - m_palette->set_pen_color(i+0x100,pal3bit(r),pal3bit(g),pal3bit(b)); - } - } - if(m_text_reg_index >= 0x80 && m_text_reg_index <= 0x8f) //Bitmap 16 clut registers - { - /* - ---x ---- priority - ---- xxxx clut number - */ - m_clut16[m_text_reg_index & 0xf] = data & 0x1f; - //printf("%02x -> [%02x]\n",m_text_reg[m_text_reg_index],m_text_reg_index); - - { - int i; - - for(i=0;i<0x10;i++) - { - m_clut256[(m_text_reg_index & 0xf) | (i << 4)] = (((data & 0x1f) << 4) | i); - } - } - } - break; - case 2: /* CG Mask reg (priority mixer) */ - m_cg_mask = data; - break; - case 3: - /* Font size reg */ - m_text_font_reg = data & 1; - mz2500_reconfigure_screen(); - break; - } -} - -WRITE8_MEMBER(mz2500_state::mz2500_irq_sel_w) -{ - m_irq_sel = data; - //printf("%02x\n",m_irq_sel); - // activeness is trusted, see Tower of Druaga - m_irq_mask[0] = (data & 0x08); //CRTC - m_irq_mask[1] = (data & 0x04); //i8253 - m_irq_mask[2] = (data & 0x02); //printer - m_irq_mask[3] = (data & 0x01); //RP5c15 -} - -WRITE8_MEMBER(mz2500_state::mz2500_irq_data_w) -{ - if(m_irq_sel & 0x80) - m_irq_vector[0] = data; //CRTC - if(m_irq_sel & 0x40) - m_irq_vector[1] = data; //i8253 - if(m_irq_sel & 0x20) - m_irq_vector[2] = data; //printer - if(m_irq_sel & 0x10) - m_irq_vector[3] = data; //RP5c15 - -// popmessage("%02x %02x %02x %02x",m_irq_vector[0],m_irq_vector[1],m_irq_vector[2],m_irq_vector[3]); -} - -WRITE8_MEMBER(mz2500_state::floppy_select_w) -{ - switch ((data & 0x03) ^ m_fdc_reverse) - { - case 0: m_floppy = m_floppy0->get_device(); break; - case 1: m_floppy = m_floppy1->get_device(); break; - case 2: m_floppy = m_floppy2->get_device(); break; - case 3: m_floppy = m_floppy3->get_device(); break; - } - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) - m_floppy->mon_w(!BIT(data, 7)); -} - -WRITE8_MEMBER(mz2500_state::floppy_side_w) -{ - if (m_floppy) - m_floppy->ss_w(BIT(data, 0)); -} - - -static ADDRESS_MAP_START(mz2500_map, AS_PROGRAM, 8, mz2500_state ) - AM_RANGE(0x0000, 0x1fff) AM_READWRITE(bank0_r,bank0_w) - AM_RANGE(0x2000, 0x3fff) AM_READWRITE(bank1_r,bank1_w) - AM_RANGE(0x4000, 0x5fff) AM_READWRITE(bank2_r,bank2_w) - AM_RANGE(0x6000, 0x7fff) AM_READWRITE(bank3_r,bank3_w) - AM_RANGE(0x8000, 0x9fff) AM_READWRITE(bank4_r,bank4_w) - AM_RANGE(0xa000, 0xbfff) AM_READWRITE(bank5_r,bank5_w) - AM_RANGE(0xc000, 0xdfff) AM_READWRITE(bank6_r,bank6_w) - AM_RANGE(0xe000, 0xffff) AM_READWRITE(bank7_r,bank7_w) -ADDRESS_MAP_END - - -READ8_MEMBER(mz2500_state::mz2500_rom_r) -{ - m_lrom_index = (m_maincpu->state_int(Z80_B)); - - m_rom_index = (m_rom_index & 0xffff00) | (m_lrom_index & 0xff); - - return m_iplpro_rom[m_rom_index]; -} - -WRITE8_MEMBER(mz2500_state::mz2500_rom_w) -{ - m_hrom_index = (m_maincpu->state_int(Z80_B)); - - m_rom_index = (data << 8) | (m_rom_index & 0x0000ff) | ((m_hrom_index & 0xff)<<16); - //printf("%02x\n",data); -} - -/* sets 16 color entries out of 4096 possible combinations */ -WRITE8_MEMBER(mz2500_state::palette4096_io_w) -{ - UINT8 pal_index; - UINT8 pal_entry; - - pal_index = m_maincpu->state_int(Z80_B); - pal_entry = (pal_index & 0x1e) >> 1; - - if(pal_index & 1) - m_pal[pal_entry].g = (data & 0x0f); - else - { - m_pal[pal_entry].r = (data & 0xf0) >> 4; - m_pal[pal_entry].b = data & 0x0f; - } - - m_palette->set_pen_color(pal_entry+0x10, pal4bit(m_pal[pal_entry].r), pal4bit(m_pal[pal_entry].g), pal4bit(m_pal[pal_entry].b)); -} - -READ8_MEMBER(mz2500_state::fdc_r) -{ - return m_fdc->read(space, offset) ^ 0xff; -} - -WRITE8_MEMBER(mz2500_state::fdc_w) -{ - m_fdc->write(space, offset, data ^ 0xff); -} - -READ8_MEMBER(mz2500_state::mz2500_bplane_latch_r) -{ - if(m_cg_reg[7] & 0x10) - return mz2500_cg_latch_compare(); - else - return m_cg_latch[0]; -} - - -READ8_MEMBER(mz2500_state::mz2500_rplane_latch_r) -{ - if(m_cg_reg[0x07] & 0x10) - { - UINT8 vblank_bit; - - vblank_bit = machine().first_screen()->vblank() ? 0 : 0x80 | m_cg_clear_flag; - - return vblank_bit; - } - else - return m_cg_latch[1]; -} - -READ8_MEMBER(mz2500_state::mz2500_gplane_latch_r) -{ - return m_cg_latch[2]; -} - -READ8_MEMBER(mz2500_state::mz2500_iplane_latch_r) -{ - return m_cg_latch[3]; -} - -/* -"GDE" CRTC registers - -0x00: CG B - Replace / Pset register data mask -0x01: CG R - Replace / Pset register data mask -0x02: CG G - Replace / Pset register data mask -0x03: CG I - Replace / Pset register data mask -0x04: CG Replace / Pset active pixel -0x05: CG Replace / Pset mode register -0x06: CG Replace data register -0x07: compare CG buffer register -0x08: CG window vertical start lo reg -0x09: CG window vertical start hi reg (upper 1 bit) -0x0a: CG window vertical end lo reg -0x0b: CG window vertical end hi reg (upper 1 bit) -0x0c: CG window horizontal start reg (7 bits, val x 8) -0x0d: CG window horizontal end reg (7 bits, val x 8) -0x0e: CG mode -0x0f: vertical scroll shift (---- xxxx) -0x10: CG map base lo reg -0x11: CG map base hi reg -0x12: CG layer 0 end address lo reg -0x13: CG layer 0 end address hi reg -0x14: CG layer 1 start address lo reg -0x15: CG layer 1 start address hi reg -0x16: CG layer 1 y pixel start lo reg -0x17: CG layer 1 y pixel start hi reg -0x18: CG color masking -*/ - -WRITE8_MEMBER(mz2500_state::mz2500_cg_addr_w) -{ - m_cg_reg_index = data; -} - -WRITE8_MEMBER(mz2500_state::mz2500_cg_data_w) -{ - m_cg_reg[m_cg_reg_index & 0x1f] = data; - - if((m_cg_reg_index & 0x1f) == 0x08) //accessing VS LO reg clears VS HI reg - m_cg_reg[0x09] = 0; - - if((m_cg_reg_index & 0x1f) == 0x0a) //accessing VE LO reg clears VE HI reg - m_cg_reg[0x0b] = 0; - - if((m_cg_reg_index & 0x1f) == 0x05 && (m_cg_reg[0x05] & 0xc0) == 0x80) //clear bitmap buffer - { - UINT32 i; - UINT8 *vram = m_main_ram; // TODO - UINT32 layer_bank; - - layer_bank = (m_cg_reg[0x0e] & 0x80) ? 0x10000 : 0x00000; - - /* TODO: this isn't yet 100% accurate */ - if(m_cg_reg[0x05] & 1) - { - for(i=0;i<0x4000;i++) - vram[i+0x40000+layer_bank] = 0x00; //clear B - } - if(m_cg_reg[0x05] & 2) - { - for(i=0;i<0x4000;i++) - vram[i+0x44000+layer_bank] = 0x00; //clear R - } - if(m_cg_reg[0x05] & 4) - { - for(i=0;i<0x4000;i++) - vram[i+0x48000+layer_bank] = 0x00; //clear G - } - if(m_cg_reg[0x05] & 8) - { - for(i=0;i<0x4000;i++) - vram[i+0x4c000+layer_bank] = 0x00; //clear I - } - m_cg_clear_flag = 1; - } - - { - mz2500_reconfigure_screen(); - } - - if(m_cg_reg_index & 0x80) //enable auto-inc - m_cg_reg_index = (m_cg_reg_index & 0xfc) | ((m_cg_reg_index + 1) & 0x03); -} - -WRITE8_MEMBER(mz2500_state::timer_w) -{ - m_pit->write_gate0(1); - m_pit->write_gate1(1); - m_pit->write_gate0(0); - m_pit->write_gate1(0); - m_pit->write_gate0(1); - m_pit->write_gate1(1); -} - - -READ8_MEMBER(mz2500_state::mz2500_joystick_r) -{ - UINT8 res,dir_en,in_r; - - res = 0xff; - in_r = ~ioport(m_joy_mode & 0x40 ? "JOY_2P" : "JOY_1P")->read(); - - if(m_joy_mode & 0x40) - { - if(!(m_joy_mode & 0x04)) res &= ~0x20; - if(!(m_joy_mode & 0x08)) res &= ~0x10; - dir_en = (m_joy_mode & 0x20) ? 0 : 1; - } - else - { - if(!(m_joy_mode & 0x01)) res &= ~0x20; - if(!(m_joy_mode & 0x02)) res &= ~0x10; - dir_en = (m_joy_mode & 0x10) ? 0 : 1; - } - - if(dir_en) - res &= (~((in_r) & 0x0f)); - - res &= (~((in_r) & 0x30)); - - return res; -} - -WRITE8_MEMBER(mz2500_state::mz2500_joystick_w) -{ - m_joy_mode = data; -} - - -READ8_MEMBER(mz2500_state::mz2500_kanji_r) -{ - printf("Read from kanji 2 ROM\n"); - - return m_kanji2_rom[(m_kanji_index << 1) | (offset & 1)]; -} - -WRITE8_MEMBER(mz2500_state::mz2500_kanji_w) -{ - (offset & 1) ? (m_kanji_index = (data << 8) | (m_kanji_index & 0xff)) : (m_kanji_index = (data & 0xff) | (m_kanji_index & 0xff00)); -} - -READ8_MEMBER(mz2500_state::rp5c15_8_r) -{ - UINT8 rtc_index = (m_maincpu->state_int(Z80_B)); - - return m_rtc->read(space, rtc_index); -} - -WRITE8_MEMBER(mz2500_state::rp5c15_8_w) -{ - UINT8 rtc_index = (m_maincpu->state_int(Z80_B)); - - m_rtc->write(space, rtc_index, data); -} - - -READ8_MEMBER(mz2500_state::mz2500_emm_data_r) -{ - UINT8 emm_lo_index; - - emm_lo_index = (m_maincpu->state_int(Z80_B)); - - m_emm_offset = (m_emm_offset & 0xffff00) | (emm_lo_index & 0xff); - - if(m_emm_offset < 0x100000) //emm max size - return m_emm_ram[m_emm_offset]; - - return 0xff; -} - -WRITE8_MEMBER(mz2500_state::mz2500_emm_addr_w) -{ - UINT8 emm_hi_index; - - emm_hi_index = (m_maincpu->state_int(Z80_B)); - - m_emm_offset = ((emm_hi_index & 0xff) << 16) | ((data & 0xff) << 8) | (m_emm_offset & 0xff); -} - -WRITE8_MEMBER(mz2500_state::mz2500_emm_data_w) -{ - UINT8 emm_lo_index; - - emm_lo_index = (m_maincpu->state_int(Z80_B)); - - m_emm_offset = (m_emm_offset & 0xffff00) | (emm_lo_index & 0xff); - - if(m_emm_offset < 0x100000) //emm max size - m_emm_ram[m_emm_offset] = data; -} - -static ADDRESS_MAP_START(mz2500_io, AS_IO, 8, mz2500_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) -// AM_RANGE(0x60, 0x63) AM_WRITE(w3100a_w) -// AM_RANGE(0x63, 0x63) AM_READ(w3100a_r) -// AM_RANGE(0x98, 0x99) ADPCM, unknown type, custom? - AM_RANGE(0xa0, 0xa3) AM_DEVREADWRITE("z80sio",z80sio0_device, ba_cd_r, ba_cd_w) -// AM_RANGE(0xa4, 0xa5) AM_READWRITE(sasi_r, sasi_w) - AM_RANGE(0xa8, 0xa8) AM_WRITE(mz2500_rom_w) - AM_RANGE(0xa9, 0xa9) AM_READ(mz2500_rom_r) - AM_RANGE(0xac, 0xac) AM_WRITE(mz2500_emm_addr_w) - AM_RANGE(0xad, 0xad) AM_READ(mz2500_emm_data_r) AM_WRITE(mz2500_emm_data_w) - AM_RANGE(0xae, 0xae) AM_WRITE(palette4096_io_w) -// AM_RANGE(0xb0, 0xb3) AM_READWRITE(sio_r,sio_w) - AM_RANGE(0xb4, 0xb4) AM_READWRITE(mz2500_bank_addr_r,mz2500_bank_addr_w) - AM_RANGE(0xb5, 0xb5) AM_READWRITE(mz2500_bank_data_r,mz2500_bank_data_w) - AM_RANGE(0xb7, 0xb7) AM_WRITENOP - AM_RANGE(0xb8, 0xb9) AM_READWRITE(mz2500_kanji_r,mz2500_kanji_w) - AM_RANGE(0xbc, 0xbc) AM_READ(mz2500_bplane_latch_r) AM_WRITE(mz2500_cg_addr_w) - AM_RANGE(0xbd, 0xbd) AM_READ(mz2500_rplane_latch_r) AM_WRITE(mz2500_cg_data_w) - AM_RANGE(0xbe, 0xbe) AM_READ(mz2500_gplane_latch_r) - AM_RANGE(0xbf, 0xbf) AM_READ(mz2500_iplane_latch_r) - AM_RANGE(0xc6, 0xc6) AM_WRITE(mz2500_irq_sel_w) - AM_RANGE(0xc7, 0xc7) AM_WRITE(mz2500_irq_data_w) - AM_RANGE(0xc8, 0xc9) AM_DEVREADWRITE("ym", ym2203_device, read, write) -// AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w) - AM_RANGE(0xcc, 0xcc) AM_READWRITE(rp5c15_8_r, rp5c15_8_w) - AM_RANGE(0xce, 0xce) AM_WRITE(mz2500_dictionary_bank_w) - AM_RANGE(0xcf, 0xcf) AM_WRITE(mz2500_kanji_bank_w) - AM_RANGE(0xd8, 0xdb) AM_READWRITE(fdc_r, fdc_w) - AM_RANGE(0xdc, 0xdc) AM_WRITE(floppy_select_w) - AM_RANGE(0xdd, 0xdd) AM_WRITE(floppy_side_w) - AM_RANGE(0xde, 0xde) AM_WRITENOP - AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("i8255_0", i8255_device, read, write) - AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("pit", pit8253_device, read, write) - AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) - AM_RANGE(0xef, 0xef) AM_READWRITE(mz2500_joystick_r,mz2500_joystick_w) - AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w) - AM_RANGE(0xf4, 0xf7) AM_READ(mz2500_crtc_hvblank_r) AM_WRITE(mz2500_tv_crtc_w) -// AM_RANGE(0xf8, 0xf9) AM_READWRITE(extrom_r,extrom_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mz2500 ) - PORT_START("KEY0") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - - PORT_START("KEY1") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", (PAD)") //PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) - - PORT_START("KEY2") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) - - PORT_START("KEY3") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BREAK") //PORT_CODE(KEYCODE_ESC) - - PORT_START("KEY4") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") //PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("KEY5") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("KEY6") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("KEY7") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) //Yen symbol - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("_") - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(".") - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(",") - - PORT_START("KEY8") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("KEY9") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(":") - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(";") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@") - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[") - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYA") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("COPY") - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CLR") - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("INST") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("ESC") - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) - - PORT_START("KEYB") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SLOCK") - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") - PORT_BIT(0xe0,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYC") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KJ1") - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KJ2") - PORT_BIT(0xfc,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYD") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("LOGO KEY") - PORT_BIT(0xfe,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("UNUSED") - PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED ) - - /* this enables HD-loader */ - PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x01, "DSW1" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x30, 0x30, "IPLPRO" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x30, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Monitor Interlace" ) //not all games support this - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - - PORT_START("JOY_1P") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("JOY_2P") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -void mz2500_state::mz2500_reset(mz2500_state *state, UINT8 type) -{ - int i; - - for(i=0;i<8;i++) - m_bank_val[i] = bank_reset_val[type][i]; -} - -static const gfx_layout mz2500_pcg_layout_1bpp = -{ - 8, 8, - 0x100, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 -}; - -static const gfx_layout mz2500_pcg_layout_3bpp = -{ - 8, 8, - 0x100, - 3, - { 0x1800*8, 0x1000*8, 0x800*8 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 -}; - -void mz2500_state::machine_start() -{ - /* TODO: main RAM actually needs to be splitted */ - m_main_ram = auto_alloc_array_clear(machine(), UINT8, 0x80000); - m_pcg_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - m_ipl_rom = memregion("ipl")->base(); - m_kanji_rom = memregion("kanji")->base(); - m_kanji2_rom = memregion("kanji2")->base(); - m_emm_ram = auto_alloc_array_clear(machine(), UINT8, 0x100000); - m_dic_rom = memregion("dictionary")->base(); - m_phone_rom = memregion("phone")->base(); - m_iplpro_rom = memregion("iplpro")->base(); - - save_pointer(NAME(m_main_ram), 0x80000); - save_pointer(NAME(m_pcg_ram), 0x2000); - save_pointer(NAME(m_emm_ram), 0x100000); - - /* TODO: gfx[4] crashes as per now */ - m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_1bpp, (UINT8 *)m_pcg_ram, 0, 0x10, 0))); - m_gfxdecode->set_gfx(4, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_3bpp, (UINT8 *)m_pcg_ram, 0, 4, 0))); -} - -void mz2500_state::machine_reset() -{ - UINT32 i; - - mz2500_reset(this, IPL_RESET); - - //m_irq_vector[0] = 0xef; /* RST 28h - vblank */ - - m_text_col_size = 0; - m_text_font_reg = 0; - - /* copy IPL to its natural bank ROM/RAM position */ - for(i=0;i<0x8000;i++) - { - //m_main_ram[i] = IPL[i]; - m_main_ram[i+0x68000] = m_ipl_rom[i]; - } - - /* clear CG RAM */ - for(i=0;i<0x20000;i++) - m_main_ram[i+0x40000] = 0x00; - - /* disable IRQ */ - for(i=0;i<4;i++) - { - m_irq_mask[i] = 0; - m_irq_pending[i] = 0; - } - m_kanji_bank = 0; - - m_cg_clear_flag = 0; - - m_beeper->set_frequency(4096); - m_beeper->set_state(0); - -// m_monitor_type = ioport("DSW1")->read() & 0x40 ? 1 : 0; -} - -static const gfx_layout mz2500_cg_layout = -{ - 8, 8, /* 8 x 8 graphics */ - RGN_FRAC(1,1), /* 512 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 /* code takes 8 times 8 bits */ -}; - -/* gfx1 is mostly 16x16, but there are some 8x8 characters */ -static const gfx_layout mz2500_8_layout = -{ - 8, 8, /* 8 x 8 graphics */ - 1920, /* 1920 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 /* code takes 8 times 8 bits */ -}; - -static const gfx_layout mz2500_16_layout = -{ - 16, 16, /* 16 x 16 graphics */ - RGN_FRAC(1,1), /* 8192 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - { 0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 16 * 16 /* code takes 16 times 16 bits */ -}; - -/* these are just for viewer sake, actually they aren't used in drawing routines */ -static GFXDECODE_START( mz2500 ) - GFXDECODE_ENTRY("kanji", 0, mz2500_cg_layout, 0, 256) - GFXDECODE_ENTRY("kanji", 0x4400, mz2500_8_layout, 0, 256) - GFXDECODE_ENTRY("kanji", 0, mz2500_16_layout, 0, 256) -// GFXDECODE_ENTRY("pcg", 0, mz2500_pcg_layout_1bpp, 0, 0x10) -// GFXDECODE_ENTRY("pcg", 0, mz2500_pcg_layout_3bpp, 0, 4) -GFXDECODE_END - -INTERRUPT_GEN_MEMBER(mz2500_state::mz2500_vbl) -{ - if(m_irq_mask[0]) - { - m_irq_pending[0] = 1; - m_maincpu->set_input_line(0, ASSERT_LINE); - } - m_cg_clear_flag = 0; -} - -IRQ_CALLBACK_MEMBER(mz2500_state::mz2500_irq_ack) -{ - int i; - for(i=0;i<4;i++) - { - if(m_irq_mask[i] && m_irq_pending[i]) - { - m_irq_pending[i] = 0; - m_maincpu->set_input_line(0, CLEAR_LINE); - return m_irq_vector[i]; - } - } - return 0; -} - -READ8_MEMBER(mz2500_state::mz2500_porta_r) -{ - logerror("PPI PORTA R\n"); - - return 0xff; -} - -READ8_MEMBER(mz2500_state::mz2500_portb_r) -{ - UINT8 vblank_bit; - - vblank_bit = machine().first_screen()->vblank() ? 0 : 1; //Guess: NOBO wants this bit to be high/low - - return 0xfe | vblank_bit; -} - -READ8_MEMBER(mz2500_state::mz2500_portc_r) -{ - logerror("PPI PORTC R\n"); - - return 0xff; -} - -WRITE8_MEMBER(mz2500_state::mz2500_porta_w) -{ - logerror("PPI PORTA W %02x\n",data); -} - -WRITE8_MEMBER(mz2500_state::mz2500_portb_w) -{ - logerror("PPI PORTB W %02x\n",data); -} - -WRITE8_MEMBER(mz2500_state::mz2500_portc_w) -{ - /* - ---- x--- 0->1 transition = IPL reset - ---- -x-- beeper state - ---- --x- 0->1 transition = Work RAM reset - ---- ---x screen mask - */ - - /* work RAM reset */ - if((m_old_portc & 0x02) == 0x00 && (data & 0x02)) - { - mz2500_reset(this, WRAM_RESET); - /* correct? */ - m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - } - - /* bit 2 is speaker */ - - /* IPL reset */ - if((m_old_portc & 0x08) == 0x00 && (data & 0x08)) - mz2500_reset(this, IPL_RESET); - - m_old_portc = data; - - m_beeper->set_state(data & 0x04); - - m_screen_enable = data & 1; - - if(data & ~0x0f) - logerror("PPI PORTC W %02x\n",data & ~0x0f); -} - -WRITE8_MEMBER(mz2500_state::mz2500_pio1_porta_w) -{ -// printf("%02x\n",data); - - if(m_prev_col_val != ((data & 0x20) >> 5)) - { - m_text_col_size = ((data & 0x20) >> 5); - m_prev_col_val = m_text_col_size; - mz2500_reconfigure_screen(); - } - m_key_mux = data & 0x1f; -} - - -READ8_MEMBER(mz2500_state::mz2500_pio1_porta_r) -{ - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", - "KEY4", "KEY5", "KEY6", "KEY7", - "KEY8", "KEY9", "KEYA", "KEYB", - "KEYC", "KEYD", "UNUSED", "UNUSED" }; - - if(((m_key_mux & 0x10) == 0x00) || ((m_key_mux & 0x0f) == 0x0f)) //status read - { - int res,i; - - res = 0xff; - for(i=0;i<0xe;i++) - res &= ioport(keynames[i])->read(); - - m_pio_latchb = res; - - return res; - } - - m_pio_latchb = ioport(keynames[m_key_mux & 0xf])->read(); - - return ioport(keynames[m_key_mux & 0xf])->read(); -} - -#if 0 -READ8_MEMBER(mz2500_state::mz2500_pio1_portb_r) -{ - return m_pio_latchb; -} -#endif - -READ8_MEMBER(mz2500_state::opn_porta_r) -{ - return m_ym_porta; -} - -WRITE8_MEMBER(mz2500_state::opn_porta_w) -{ - /* - ---- x--- mouse select - ---- -x-- palette bit (16/4096 colors) - ---- --x- floppy reverse bit (controls wd17xx bits in command registers) - */ - - m_fdc_reverse = data & 2; - m_pal_select = (data & 4) ? 1 : 0; - - m_ym_porta = data; -} - -PALETTE_INIT_MEMBER(mz2500_state, mz2500) -{ - int i; - - for(i=0;i<0x200;i++) - palette.set_pen_color(i,pal1bit(0),pal1bit(0),pal1bit(0)); - - /* set up 8 colors (PCG) */ - for(i=0;i<8;i++) - m_palette->set_pen_color(i+8,pal1bit((i & 2)>>1),pal1bit((i & 4)>>2),pal1bit((i & 1)>>0)); - - /* set up 16 colors (PCG / CG) */ - - /* set up 256 colors (CG) */ - { - int r,g,b; - - for(i = 0;i < 0x100;i++) - { - int bit0,bit1,bit2; - - bit0 = pal_256_param(i,0) ? 1 : 0; - bit1 = i & 0x01 ? 2 : 0; - bit2 = i & 0x10 ? 4 : 0; - b = bit0|bit1|bit2; - bit0 = pal_256_param(i,0) ? 1 : 0; - bit1 = i & 0x02 ? 2 : 0; - bit2 = i & 0x20 ? 4 : 0; - r = bit0|bit1|bit2; - bit0 = pal_256_param(i,0) ? 1 : 0; - bit1 = i & 0x04 ? 2 : 0; - bit2 = i & 0x40 ? 4 : 0; - g = bit0|bit1|bit2; - - m_palette->set_pen_color(i+0x100,pal3bit(r),pal3bit(g),pal3bit(b)); - } - } -} - -/* PIT8253 Interface */ - -WRITE_LINE_MEMBER(mz2500_state::pit8253_clk0_irq) -{ - if(m_irq_mask[1] && state & 1) - { - m_irq_pending[1] = 1; - m_maincpu->set_input_line(0, ASSERT_LINE); - } -} - -WRITE_LINE_MEMBER(mz2500_state::mz2500_rtc_alarm_irq) -{ - /* TODO: doesn't work yet */ -// if(m_irq_mask[3] && state & 1) -// m_maincpu->set_input_line_and_vector(0, HOLD_LINE,drvm_irq_vector[3]); -} - - -static SLOT_INTERFACE_START( mz2500_floppies ) - SLOT_INTERFACE("dd", FLOPPY_35_DD) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( mz2500, mz2500_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 6000000) - MCFG_CPU_PROGRAM_MAP(mz2500_map) - MCFG_CPU_IO_MAP(mz2500_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", mz2500_state, mz2500_vbl) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(mz2500_state,mz2500_irq_ack) - - MCFG_DEVICE_ADD("i8255_0", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(mz2500_state, mz2500_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mz2500_state, mz2500_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(mz2500_state, mz2500_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mz2500_state, mz2500_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(mz2500_state, mz2500_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mz2500_state, mz2500_portc_w)) - - MCFG_DEVICE_ADD("z80pio_1", Z80PIO, 6000000) - MCFG_Z80PIO_IN_PA_CB(READ8(mz2500_state, mz2500_pio1_porta_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(mz2500_state, mz2500_pio1_porta_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(mz2500_state, mz2500_pio1_porta_r)) - - MCFG_Z80SIO0_ADD("z80sio", 6000000, 0, 0, 0, 0) - - MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) - MCFG_RP5C15_OUT_ALARM_CB(WRITELINE(mz2500_state, mz2500_rtc_alarm_irq)) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(31250) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(mz2500_state, pit8253_clk0_irq)) - // TODO: is this really right? - MCFG_PIT8253_CLK1(0) - MCFG_PIT8253_CLK2(16) //CH2, used by Super MZ demo / The Black Onyx and a few others (TODO: timing of this) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pit", pit8253_device, write_clk1)) - - MCFG_MB8877_ADD("mb8877a", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("mb8877a:0", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("mb8877a:1", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("mb8877a:2", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("mb8877a:3", mz2500_floppies, "dd", floppy_image_device::default_floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "mz2500") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_21_4772MHz, 640+108, 0, 640, 480, 0, 200) //unknown clock / divider - MCFG_SCREEN_UPDATE_DRIVER(mz2500_state, screen_update_mz2500) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 0x200) - MCFG_PALETTE_INIT_OWNER(mz2500_state, mz2500) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz2500) - - - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("ym", YM2203, 2000000) //unknown clock / divider - MCFG_AY8910_PORT_A_READ_CB(READ8(mz2500_state, opn_porta_r)) // read A - MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1")) // read B - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(mz2500_state, opn_porta_w)) // write A - MCFG_SOUND_ROUTE(0, "mono", 0.25) - MCFG_SOUND_ROUTE(1, "mono", 0.25) - MCFG_SOUND_ROUTE(2, "mono", 0.50) - MCFG_SOUND_ROUTE(3, "mono", 0.50) - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) -MACHINE_CONFIG_END - - - -/* ROM definition */ -ROM_START( mz2500 ) - ROM_REGION( 0x08000, "ipl", 0 ) - ROM_LOAD( "ipl.rom", 0x00000, 0x8000, CRC(7a659f20) SHA1(ccb3cfdf461feea9db8d8d3a8815f7e345d274f7) ) - - /* this is probably an hand made ROM, will be removed in the end ...*/ - ROM_REGION( 0x1000, "cgrom", 0 ) - ROM_LOAD( "cg.rom", 0x0000, 0x0800, CRC(a082326f) SHA1(dfa1a797b2159838d078650801c7291fa746ad81) ) - - ROM_REGION( 0x40000, "kanji", 0 ) - ROM_LOAD( "kanji.rom", 0x0000, 0x40000, CRC(dd426767) SHA1(cc8fae0cd1736bc11c110e1c84d3f620c5e35b80) ) - - ROM_REGION( 0x20000, "kanji2", 0 ) - ROM_LOAD( "kanji2.rom", 0x0000, 0x20000, CRC(eaaf20c9) SHA1(771c4d559b5241390215edee798f3bce169d418c) ) - - ROM_REGION( 0x40000, "dictionary", 0 ) - ROM_LOAD( "dict.rom", 0x00000, 0x40000, CRC(aa957c2b) SHA1(19a5ba85055f048a84ed4e8d471aaff70fcf0374) ) - - ROM_REGION( 0x8000, "iplpro", ROMREGION_ERASEFF ) - ROM_LOAD( "sasi.rom", 0x00000, 0x8000, CRC(a7bf39ce) SHA1(3f4a237fc4f34bac6fe2bbda4ce4d16d42400081) ) - - ROM_REGION( 0x8000, "phone", ROMREGION_ERASEFF ) - ROM_LOAD( "phone.rom", 0x00000, 0x4000, CRC(8e49e4dc) SHA1(2589f0c95028037a41ca32a8fd799c5f085dab51) ) -ROM_END - -ROM_START( mz2520 ) - ROM_REGION( 0x08000, "ipl", 0 ) - ROM_LOAD( "ipl2520.rom", 0x00000, 0x8000, CRC(0a126eb2) SHA1(faf71236b3ad82d30184adea951d43d10ced663d) ) - - /* this is probably an hand made ROM, will be removed in the end ...*/ - ROM_REGION( 0x1000, "cgrom", 0 ) - ROM_LOAD( "cg.rom", 0x0000, 0x0800, CRC(a082326f) SHA1(dfa1a797b2159838d078650801c7291fa746ad81) ) - - ROM_REGION( 0x40000, "kanji", 0 ) - ROM_LOAD( "kanji.rom", 0x0000, 0x40000, CRC(dd426767) SHA1(cc8fae0cd1736bc11c110e1c84d3f620c5e35b80) ) - - ROM_REGION( 0x20000, "kanji2", 0 ) - ROM_LOAD( "kanji2.rom", 0x0000, 0x20000, CRC(eaaf20c9) SHA1(771c4d559b5241390215edee798f3bce169d418c) ) - - ROM_REGION( 0x40000, "dictionary", 0 ) - ROM_LOAD( "dict.rom", 0x00000, 0x40000, CRC(aa957c2b) SHA1(19a5ba85055f048a84ed4e8d471aaff70fcf0374) ) - - ROM_REGION( 0x8000, "iplpro", ROMREGION_ERASEFF ) - ROM_LOAD( "sasi.rom", 0x00000, 0x8000, CRC(a7bf39ce) SHA1(3f4a237fc4f34bac6fe2bbda4ce4d16d42400081) ) - - ROM_REGION( 0x8000, "phone", ROMREGION_ERASEFF ) - ROM_LOAD( "phone.rom", 0x00000, 0x4000, CRC(8e49e4dc) SHA1(2589f0c95028037a41ca32a8fd799c5f085dab51) ) -ROM_END - -/* Driver */ - -COMP( 1985, mz2500, 0, 0, mz2500, mz2500, driver_device, 0, "Sharp", "MZ-2500", MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1985, mz2520, mz2500, 0, mz2500, mz2500, driver_device, 0, "Sharp", "MZ-2520", MACHINE_IMPERFECT_GRAPHICS ) // looks a stripped down version of the regular MZ-2500, with only two floppies drives and no cassette interface diff --git a/src/mess/drivers/mz3500.c b/src/mess/drivers/mz3500.c deleted file mode 100644 index 8a5828e0401..00000000000 --- a/src/mess/drivers/mz3500.c +++ /dev/null @@ -1,873 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - MZ-3500 (c) 198? Sharp - - preliminary driver by Angelo Salese - - TODO: - - BUSREQ / BUSACK signals. - - master/slave comms aren't perfect (especially noticeable if you change the video DIP) - - Notes: - Sub-CPU test meanings: - * RA (tests RAM, first is work RAM, other two are shared RAM banks) - * VR (tests VRAM) - * CRT interface test: - - 40x20 - - 80x25 - - monochrome attribute test - - 80x25 color test (text B-R-G-W, border: black, blue, red, green, black) - - 40x20 color test (text B-R-G-W, border: black, blue, red, green, black) - * Speaker test - * PR (Printer interface test) - * LP (Light pen test) - * RS (RS-232C interface test) - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/upd765.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "sound/beep.h" -#include "video/upd7220.h" - -#define MAIN_CLOCK XTAL_8MHz - -class mz3500_state : public driver_device -{ -public: - mz3500_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_master(*this, "master"), - m_slave(*this, "slave"), - m_hgdc1(*this, "upd7220_chr"), - m_hgdc2(*this, "upd7220_gfx"), - m_fdc(*this, "upd765a"), - m_video_ram(*this, "video_ram"), - m_beeper(*this, "beeper"), - m_palette(*this, "palette"), - m_system_dsw(*this, "SYSTEM_DSW"), - m_fd_dsw(*this, "FD_DSW") - { } - - // devices - required_device m_master; - required_device m_slave; - required_device m_hgdc1; - required_device m_hgdc2; - required_device m_fdc; - required_shared_ptr m_video_ram; - required_device m_beeper; - required_device m_palette; - - UINT8 *m_ipl_rom; - UINT8 *m_basic_rom; - UINT8 *m_work_ram; - UINT8 *m_shared_ram; - UINT8 *m_char_rom; - - UINT8 m_ma,m_mo,m_ms,m_me2,m_me1; - UINT8 m_crtc[0x10]; - - UINT8 m_srdy; - - UINT8 m_fdd_sel; - - DECLARE_READ8_MEMBER(mz3500_master_mem_r); - DECLARE_WRITE8_MEMBER(mz3500_master_mem_w); - DECLARE_READ8_MEMBER(mz3500_ipl_r); - DECLARE_READ8_MEMBER(mz3500_basic_r); - DECLARE_READ8_MEMBER(mz3500_work_ram_r); - DECLARE_WRITE8_MEMBER(mz3500_work_ram_w); - DECLARE_READ8_MEMBER(mz3500_shared_ram_r); - DECLARE_WRITE8_MEMBER(mz3500_shared_ram_w); - DECLARE_READ8_MEMBER(mz3500_io_r); - DECLARE_WRITE8_MEMBER(mz3500_io_w); - DECLARE_WRITE8_MEMBER(mz3500_crtc_w); - DECLARE_READ8_MEMBER(mz3500_fdc_r); - DECLARE_WRITE8_MEMBER(mz3500_fdc_w); - DECLARE_READ8_MEMBER(mz3500_fdc_dma_r); - DECLARE_WRITE8_MEMBER(mz3500_pa_w); - DECLARE_WRITE8_MEMBER(mz3500_pb_w); - DECLARE_WRITE8_MEMBER(mz3500_pc_w); - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); - UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - -private: - required_ioport m_system_dsw; - required_ioport m_fd_dsw; - floppy_connector *m_floppy_connector[4]; -}; - -void mz3500_state::video_start() -{ -} - -/* -CRTC regs -[0] ----- -x-- "Choice of whether attribute or cursor be put on the frame that displayed on CRT2" (whatever that means ...) ----- --x- CRT2 output ----- ---x CRT1 output -[1] ----- -GRB CRT1 color output -[2] ----- -GRB CRT2 color output -[3] ----- -GRB background color output -[4] ----- --x- border color mode in effect ----- ---x color mode -[5] ----- --x- width setting (0: 40 chars, 1: 80 chars) ----- ---x data size for graphics RAM (0: 8 bits, 1: 16 bits) -[6] ----- -x-- "Connection of graphic GDC" ----- --x- "Connection of the 96K bytes VRAM" ----- ---x "Connection of a 400 raster CRT" -[7] ----- ---x 0: 25 lines, 1: 20 lines display -[d] -(mirror of [5]?) -*/ - -UPD7220_DISPLAY_PIXELS_MEMBER( mz3500_state::hgdc_display_pixels ) -{ - // ... -} - -UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int x; - int xi,yi; - int tile; - int attr; - UINT8 tile_data; - UINT8 width80; - UINT8 char_size; - UINT8 hires; - UINT8 color_mode; - -// popmessage("%02x",m_crtc[6]); - - color_mode = m_crtc[4] & 1; - width80 = (m_crtc[5] & 2) >> 1; - hires = (m_crtc[6] & 1); - char_size = (hires) ? 16 : 8; - - for( x = 0; x < pitch; x++ ) - { - tile = (m_video_ram[(((addr+x)*2) & 0x1fff) >> 1] & 0xff); - attr = ((m_video_ram[(((addr+x)*2+1) & 0x3ffff) >> 1] >> 8) & 0x0f); - - //if(hires) - // tile <<= 1; - - for( yi = 0; yi < lr; yi++) - { - tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)]; - - for( xi = 0; xi < 8; xi++) - { - int res_x,res_y; - int pen; - - if(yi >= char_size) - pen = -1; - else - { - if(color_mode) - pen = (tile_data >> (7-xi)) & 1 ? (attr ^ 7) : -1; - else - { - /* TODO: "highlight" */ - //if(attr & 4) - // tile_data ^= 0xff; - - if(attr & 1) // VL - tile_data |= 8; - - /* TODO: correct position of HL */ - if(attr & 2 && yi == char_size/2) // HL - tile_data |= 0xff; - - /* TODO: blink (bit 3) */ - - pen = (tile_data >> (7-xi)) & 1 ? 7 : -1; - } - } - - res_x = x * 8 + xi; - res_y = y + yi; - - if(pen != -1) - { - if(!width80) - { - bitmap.pix32(res_y, res_x*2+0) = palette[pen]; - bitmap.pix32(res_y, res_x*2+1) = palette[pen]; - } - else - bitmap.pix32(res_y, res_x) = palette[pen]; - } - } - } - } - -} - -UINT32 mz3500_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) -{ - bitmap.fill(m_palette->pen((m_crtc[4] & 2) ? m_crtc[3] & 7 : 0), cliprect); - - /* graphics */ - m_hgdc2->screen_update(screen, bitmap, cliprect); - m_hgdc1->screen_update(screen, bitmap, cliprect); - return 0; -} - -READ8_MEMBER(mz3500_state::mz3500_ipl_r) -{ - return m_ipl_rom[offset]; -} - -READ8_MEMBER(mz3500_state::mz3500_basic_r) -{ - return m_basic_rom[offset]; -} - -READ8_MEMBER(mz3500_state::mz3500_work_ram_r) -{ - return m_work_ram[offset]; -} - -WRITE8_MEMBER(mz3500_state::mz3500_work_ram_w) -{ - m_work_ram[offset] = data; -} - - -READ8_MEMBER(mz3500_state::mz3500_master_mem_r) -{ - if(m_ms == 0) - { - if((offset & 0xe000) == 0x0000) { return mz3500_ipl_r(space,(offset & 0xfff) | 0x1000); } - if((offset & 0xe000) == 0x2000) { return mz3500_basic_r(space,(offset & 0x1fff) | 0x2000); } - if((offset & 0xc000) == 0x4000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x4000); } - if((offset & 0xc000) == 0x8000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x8000); } - if((offset & 0xc000) == 0xc000) - { - if(m_ma == 0x0) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0xc000); } - if(m_ma == 0x1) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x0000); } - if(m_ma == 0xf) { return mz3500_shared_ram_r(space,(offset & 0x7ff)); } - } - - printf("Read with unmapped memory bank offset %04x MS %02x MA %02x\n",offset,m_ms,m_ma); - } - else if(m_ms == 1) - { - return ((offset & 0xf800) == 0xf800) ? mz3500_shared_ram_r(space,(offset & 0x7ff)) : mz3500_work_ram_r(space,offset); - } - else if(m_ms == 2) // ROM based BASIC - { - if((offset & 0xe000) == 0x0000) { return mz3500_basic_r(space,offset & 0x1fff); } - if((offset & 0xe000) == 0x2000) - { - switch(m_mo) - { - case 0x0: return mz3500_basic_r(space,(offset & 0x1fff) | 0x2000); - case 0x1: return mz3500_basic_r(space,(offset & 0x1fff) | 0x4000); - case 0x2: return mz3500_basic_r(space,(offset & 0x1fff) | 0x6000); - } - } - if((offset & 0xc000) == 0x4000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x4000); } - if((offset & 0xc000) == 0x8000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x8000); } - if((offset & 0xc000) == 0xc000) - { - switch(m_ma) - { - case 0x0: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x0c000); - case 0x1: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x00000); - case 0x2: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x10000); - case 0x3: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x14000); - case 0x4: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x18000); - case 0x5: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x1c000); - case 0x6: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x20000); - case 0x7: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x24000); - case 0x8: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x28000); - case 0x9: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x2c000); - case 0xa: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x30000); - case 0xb: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x34000); - case 0xc: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x38000); - case 0xd: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x3c000); - case 0xf: return mz3500_shared_ram_r(space,(offset & 0x7ff)); - } - } - - printf("Read with unmapped memory bank offset %04x MS %02x MA %02x MO %02x\n",offset,m_ms,m_ma,m_mo); - } - else if (m_ms == 3) // RAM based BASIC - { - if((offset & 0xe000) == 0x0000) { return mz3500_work_ram_r(space,offset & 0x1fff); } - if((offset & 0xe000) == 0x2000) - { - switch(m_mo) - { - case 0x0: return mz3500_work_ram_r(space,(offset & 0x1fff) | 0x2000); - case 0x1: return mz3500_work_ram_r(space,(offset & 0x1fff) | 0xc000); - case 0x2: return mz3500_work_ram_r(space,(offset & 0x1fff) | 0xe000); - } - - printf("Read with unmapped memory bank offset %04x MS %02x MO %02x\n",offset,m_ms,m_mo); - } - if((offset & 0xc000) == 0x4000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x4000); } - if((offset & 0xc000) == 0x8000) { return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x8000); } - if((offset & 0xc000) == 0xc000) - { - switch(m_ma) - { - case 0x0: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x10000); - case 0x1: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x14000); - case 0x2: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x18000); - case 0x3: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x1c000); - case 0x4: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x20000); - case 0x5: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x24000); - case 0x6: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x28000); - case 0x7: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x2c000); - case 0x8: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x30000); - case 0x9: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x34000); - case 0xa: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x38000); - case 0xb: return mz3500_work_ram_r(space,(offset & 0x3fff) | 0x3c000); - case 0xf: return mz3500_shared_ram_r(space,(offset & 0x7ff)); - } - } - } - - - return 0xff; // shouldn't happen -} - -WRITE8_MEMBER(mz3500_state::mz3500_master_mem_w) -{ - if(m_ms == 0) // Initialize State - { - if((offset & 0xc000) == 0x4000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x4000,data); return; } - if((offset & 0xc000) == 0x8000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x8000,data); return; } - if((offset & 0xc000) == 0xc000) - { - if(m_ma == 0x0) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0xc000,data); return; } - if(m_ma == 0x1) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x0000,data); return; } - if(m_ma == 0xf) { mz3500_shared_ram_w(space,(offset & 0x7ff),data); return; } - } - - printf("Write with unmapped memory bank offset %04x data %02x MS %02x MA %02x\n",offset,data,m_ms,m_ma); - } - else if(m_ms == 1) // System Loading & CP/M - { - if((offset & 0xf800) == 0xf800) - mz3500_shared_ram_w(space,(offset & 0x7ff),data); - else - mz3500_work_ram_w(space,offset,data); - - return; - } - else if(m_ms == 2) // ROM based BASIC - { - if((offset & 0xc000) == 0x4000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x4000,data); return; } - if((offset & 0xc000) == 0x8000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x8000,data); return; } - if((offset & 0xc000) == 0xc000) - { - switch(m_ma) - { - case 0x0: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x0c000,data); return; - case 0x1: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x00000,data); return; - case 0x2: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x10000,data); return; - case 0x3: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x14000,data); return; - case 0x4: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x18000,data); return; - case 0x5: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x1c000,data); return; - case 0x6: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x20000,data); return; - case 0x7: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x24000,data); return; - case 0x8: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x28000,data); return; - case 0x9: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x2c000,data); return; - case 0xa: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x30000,data); return; - case 0xb: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x34000,data); return; - case 0xc: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x38000,data); return; - case 0xd: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x3c000,data); return; - case 0xf: mz3500_shared_ram_w(space,(offset & 0x7ff),data); return; - } - } - - printf("Write with unmapped memory bank offset %04x data %02x MS %02x MA %02x\n",offset,data,m_ms,m_ma); - } - else if (m_ms == 3) // RAM based BASIC - { - if((offset & 0xe000) == 0x0000) { mz3500_work_ram_w(space,offset & 0x1fff,data); return; } - if((offset & 0xe000) == 0x2000) - { - switch(m_mo) - { - case 0x0: mz3500_work_ram_w(space,(offset & 0x1fff) | 0x2000,data); return; - case 0x1: mz3500_work_ram_w(space,(offset & 0x1fff) | 0xc000,data); return; - case 0x2: mz3500_work_ram_w(space,(offset & 0x1fff) | 0xe000,data); return; - } - - printf("Read with unmapped memory bank offset %04x MS %02x MO %02x\n",offset,m_ms,m_mo); - } - if((offset & 0xc000) == 0x4000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x4000,data); return; } - if((offset & 0xc000) == 0x8000) { mz3500_work_ram_w(space,(offset & 0x3fff) | 0x8000,data); return; } - if((offset & 0xc000) == 0xc000) - { - switch(m_ma) - { - case 0x0: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x10000,data); return; - case 0x1: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x14000,data); return; - case 0x2: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x18000,data); return; - case 0x3: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x1c000,data); return; - case 0x4: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x20000,data); return; - case 0x5: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x24000,data); return; - case 0x6: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x28000,data); return; - case 0x7: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x2c000,data); return; - case 0x8: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x30000,data); return; - case 0x9: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x34000,data); return; - case 0xa: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x38000,data); return; - case 0xb: mz3500_work_ram_w(space,(offset & 0x3fff) | 0x3c000,data); return; - case 0xf: mz3500_shared_ram_w(space,(offset & 0x7ff),data); return; - } - } - } -} - -READ8_MEMBER(mz3500_state::mz3500_shared_ram_r) -{ - return m_shared_ram[offset]; -} - -WRITE8_MEMBER(mz3500_state::mz3500_shared_ram_w) -{ - m_shared_ram[offset] = data; -} - -READ8_MEMBER(mz3500_state::mz3500_io_r) -{ - /* - [2] - ---x xxx- system assign switch - ---- ---x "SEC" FD assign - [3] - xxx- ---- FD assign - ---x ---- slave CPU Ready signal - ---- x--- slave CPU ack signal - ---- -xxx interrupt status - */ - - switch(offset) - { - case 2: - return ((m_system_dsw->read() & 0x0f) << 1) | ((m_fd_dsw->read() & 0x8) >> 3); - case 3: - return ((m_fd_dsw->read() & 0x7)<<5) | (m_srdy << 4); - } - - return 0; -} - -WRITE8_MEMBER(mz3500_state::mz3500_io_w) -{ - /* - [0] - ---- --x- SRQ bus request from master to slave - ---- ---x E1 - [1] - x--- ---- slave reset signal - ---- --xx memory system define - [2] - xxxx ---- ma bank (memory 0xc000-0xffff) - ---- -xxx mo bank (memory 0x2000-0x3fff) - [3] - x--- ---- me2 bank (memory 0x8000-0xbfff) - -x-- ---- me1 bank (memory 0x4000-0x7fff) - */ - - switch(offset) - { - case 0: - /* HACK: actually busreq */ - m_slave->set_input_line(INPUT_LINE_HALT, data & 2 ? ASSERT_LINE : CLEAR_LINE); - - break; - case 1: - m_ms = data & 3; - break; - case 2: - m_ma = (data & 0xf0) >> 4; - m_mo = (data & 0x07); - break; - case 3: - m_me2 = (data & 0x80) >> 7; - m_me1 = (data & 0x40) >> 6; - break; - } -} - -WRITE8_MEMBER(mz3500_state::mz3500_crtc_w) -{ - if(offset & 8) - { - if(offset == 0xd) - m_crtc[offset & 7] = data; - else - printf("CRTC register access %02x\n",offset); // probably just a mirror, but who knows ... - } - else - m_crtc[offset] = data; -} - -READ8_MEMBER(mz3500_state::mz3500_fdc_r) -{ - /* - ---- -x-- Motor - ---- --x- Index - ---- ---x Drq - */ - - floppy_image_device *floppy = m_floppy_connector[m_fdd_sel]->get_device(); - - return (floppy->mon_r() << 2) | (floppy->idx_r() << 1) | (m_fdc->get_drq() & 1); -} - -WRITE8_MEMBER(mz3500_state::mz3500_fdc_w) -{ - /* - x--- ---- FDC int enable - -x-- ---- FDD select signal - --x- ---- FDC TC - ---x ---- motor on signal - ---- xxxx Select FDD 0-3 (bit-wise) - */ - - if(data & 0x40) - { - for(int i=0;i<4;i++) - { - if(data & 1 << i) - { - m_fdd_sel = i; - break; - } - } - } - - m_floppy_connector[m_fdd_sel]->get_device()->mon_w(data & 0x10 ? CLEAR_LINE : ASSERT_LINE); - -} - -READ8_MEMBER(mz3500_state::mz3500_fdc_dma_r) -{ - return m_fdc->dma_r(); -} - -static ADDRESS_MAP_START( mz3500_master_map, AS_PROGRAM, 8, mz3500_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(mz3500_master_mem_r,mz3500_master_mem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mz3500_master_io, AS_IO, 8, mz3500_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) -// ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0xe4, 0xe7) SFD upd765 -// AM_RANGE(0xe8, 0xeb) SFD I/O port and DMAC chip select -// AM_RANGE(0xec, 0xef) irq signal from slave to master CPU - AM_RANGE(0xf4, 0xf5) AM_DEVICE("upd765a", upd765a_device, map) // MFD upd765 -// AM_RANGE(0xf8, 0xfb) MFD I/O port - AM_RANGE(0xf8, 0xf8) AM_READWRITE(mz3500_fdc_r,mz3500_fdc_w) - AM_RANGE(0xf9, 0xf9) AM_READ(mz3500_fdc_dma_r) - AM_RANGE(0xfc, 0xff) AM_READWRITE(mz3500_io_r,mz3500_io_w) // memory mapper -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mz3500_slave_map, AS_PROGRAM, 8, mz3500_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("ipl", 0) - AM_RANGE(0x2000, 0x27ff) AM_READWRITE(mz3500_shared_ram_r, mz3500_shared_ram_w) - AM_RANGE(0x4000, 0x5fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mz3500_slave_io, AS_IO, 8, mz3500_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0x00, 0x0f) f/f and irq to master CPU -// AM_RANGE(0x10, 0x1f) i8251 -// AM_RANGE(0x20, 0x2f) pit8253 - AM_RANGE(0x30, 0x33) AM_DEVREADWRITE("i8255", i8255_device, read, write) - AM_RANGE(0x40, 0x40) AM_READ_PORT("DSW") - AM_RANGE(0x50, 0x5f) AM_RAM_WRITE(mz3500_crtc_w) - AM_RANGE(0x60, 0x61) AM_DEVREADWRITE("upd7220_gfx", upd7220_device, read, write) - AM_RANGE(0x70, 0x71) AM_DEVREADWRITE("upd7220_chr", upd7220_device, read, write) -ADDRESS_MAP_END - -WRITE8_MEMBER(mz3500_state::mz3500_pa_w) -{ - // printer data -} - -WRITE8_MEMBER(mz3500_state::mz3500_pb_w) -{ - /* - x--- ---- CG select (ROM and/or upd7220 clock?) - -x-- ---- SRDY signal (to master) - --xx xxxx upd1990 RTC (CLK, Din, C2, C1, C0, STRB) - - */ - //printf("%02x PB\n",data); - - m_srdy = (data & 0x40) >> 6; -} - -WRITE8_MEMBER(mz3500_state::mz3500_pc_w) -{ - /* - x--- ---- printer OBF output - -x-- ---- printer ACK input - --x- ---- printer STROBE - ---x ---- buzzer - ---- -xxx Keyboard (ACKC, STC, DC) - */ - //printf("%02x PC\n",data); - - m_beeper->set_state(data & 0x10); - -} - -static INPUT_PORTS_START( mz3500 ) - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x00, "SYSA" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Sub-CPU Test" ) /* hack */ - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("FD_DSW") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("SYSTEM_DSW") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "CRT Select" ) - PORT_DIPSETTING( 0x04, "Normal Display (MZ1D01, MZ1D06)" ) - PORT_DIPSETTING( 0x00, "Hi-Res Display (MZ1D02, MZ1D03)" ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -static const gfx_layout charlayout_8x8 = -{ - 8,8, - 0x100, - 1, - { RGN_FRAC(0,1) }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*16 -}; - - -static const gfx_layout charlayout_8x16 = -{ - 8,16, - 0x100, - 1, - { RGN_FRAC(0,1) }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { STEP16(0,8) }, - 8*16 -}; - -static GFXDECODE_START( mz3500 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout_8x8, 0, 1 ) - GFXDECODE_ENTRY( "gfx1", 0x0008, charlayout_8x8, 0, 1 ) - GFXDECODE_ENTRY( "gfx1", 0x1000, charlayout_8x16, 0, 1 ) -GFXDECODE_END - -void mz3500_state::machine_start() -{ - m_ipl_rom = memregion("ipl")->base(); - m_basic_rom = memregion("basic")->base(); - m_char_rom = memregion("gfx1")->base(); - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x40000); - m_shared_ram = auto_alloc_array_clear(machine(), UINT8, 0x800); - - static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"}; - - for (int i = 0; i < 4; i++) - { - m_floppy_connector[i] = machine().device(m_fddnames[i]); - } -} - -void mz3500_state::machine_reset() -{ - /* init memory bank states */ - m_ms = 0; - m_ma = 0; - m_mo = 0; - m_me1 = 0; - m_me2 = 0; - //m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_srdy = 0; - - upd765a_device *fdc; - fdc = machine().device(":upd765a"); - - if (fdc) - { - m_fdd_sel = 0; - { - for(int i=0;i<4;i++) - { - m_floppy_connector[i]->get_device()->mon_w(ASSERT_LINE); - m_floppy_connector[i]->get_device()->set_rpm(300); - } - - machine().device("upd765a")->set_rate(250000); - } - } - - m_beeper->set_frequency(2400); - m_beeper->set_state(0); -} - - -static ADDRESS_MAP_START( upd7220_1_map, AS_0, 16, mz3500_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1fff) - AM_RANGE(0x00000, 0x00fff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( upd7220_2_map, AS_0, 16, mz3500_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM // AM_SHARE("video_ram_2") -ADDRESS_MAP_END - -static SLOT_INTERFACE_START( mz3500_floppies ) - SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) -SLOT_INTERFACE_END - -/* TODO: clocks */ -static MACHINE_CONFIG_START( mz3500, mz3500_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("master",Z80,MAIN_CLOCK/2) - MCFG_CPU_PROGRAM_MAP(mz3500_master_map) - MCFG_CPU_IO_MAP(mz3500_master_io) - - MCFG_CPU_ADD("slave",Z80,MAIN_CLOCK/2) - MCFG_CPU_PROGRAM_MAP(mz3500_slave_map) - MCFG_CPU_IO_MAP(mz3500_slave_io) - - MCFG_QUANTUM_PERFECT_CPU("master") - - MCFG_DEVICE_ADD("i8255", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mz3500_state, mz3500_pa_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(mz3500_state, mz3500_pb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mz3500_state, mz3500_pc_w)) - - MCFG_UPD765A_ADD("upd765a", true, true) - MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE("master", INPUT_LINE_IRQ0)) - MCFG_FLOPPY_DRIVE_ADD("upd765a:0", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765a:1", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765a:2", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765a:3", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD("upd7220_chr", UPD7220, MAIN_CLOCK/5) - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map) - MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(mz3500_state, hgdc_draw_text) - MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_gfx", upd7220_device, ext_sync_w)) - - MCFG_DEVICE_ADD("upd7220_gfx", UPD7220, MAIN_CLOCK/5) - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz3500_state, hgdc_display_pixels) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(mz3500_state, screen_update) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz3500) - - MCFG_PALETTE_ADD_3BIT_BRG("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( mz3500 ) - ROM_REGION( 0x2000, "ipl", ROMREGION_ERASE00 ) - ROM_LOAD( "mz-3500_ipl-rom_2-0a_m5l2764k.bin", 0x000000, 0x002000, CRC(119708b9) SHA1(de81979608ba6ab76f09088a92bfd1a5bc42530e) ) - - ROM_REGION( 0x8000, "basic", ROMREGION_ERASE00 ) - ROM_LOAD( "basic.rom", 0x00000, 0x8000, NO_DUMP ) - - ROM_REGION( 0x2000, "gfx1", ROMREGION_ERASE00 ) - ROM_LOAD( "mz-3500_cg-rom_2-b_m5l2764k.bin", 0x000000, 0x002000, CRC(29f2f80a) SHA1(64b307cd9de5a3327e3ec9f3d0d6b3485706f436) ) -ROM_END - -COMP( 198?, mz3500, 0, 0, mz3500, mz3500, driver_device, 0, "Sharp", "MZ-3500", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/mz6500.c b/src/mess/drivers/mz6500.c deleted file mode 100644 index 31e9a2ee917..00000000000 --- a/src/mess/drivers/mz6500.c +++ /dev/null @@ -1,180 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Sharp MZ-6500 - - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "machine/upd765.h" -#include "video/upd7220.h" - -class mz6500_state : public driver_device -{ -public: - mz6500_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_hgdc(*this, "upd7220"), - m_fdc(*this, "upd765"), - m_video_ram(*this, "video_ram"), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") { } - - required_device m_hgdc; - required_device m_fdc; - DECLARE_READ8_MEMBER(mz6500_vram_r); - DECLARE_WRITE8_MEMBER(mz6500_vram_w); - void fdc_irq(bool state); - void fdc_drq(bool state); - required_shared_ptr m_video_ram; - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; - required_device m_palette; - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); -}; - -UPD7220_DISPLAY_PIXELS_MEMBER( mz6500_state::hgdc_display_pixels ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int gfx[3]; - UINT8 i,pen; - - gfx[0] = m_video_ram[(address + 0x00000) >> 1]; - gfx[1] = m_video_ram[(address + 0x10000) >> 1]; - gfx[2] = m_video_ram[(address + 0x20000) >> 1]; - - for(i=0; i<16; i++) - { - pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); - - bitmap.pix32(y, x + i) = palette[pen]; - } -} - - -void mz6500_state::video_start() -{ -} - - -READ8_MEMBER( mz6500_state::mz6500_vram_r ) -{ - return m_video_ram[offset >> 1] >> ((offset & 1) ? 8 : 0); -} - -WRITE8_MEMBER( mz6500_state::mz6500_vram_w ) -{ - int mask = (offset & 1) ? 8 : 0; - offset >>= 1; - m_video_ram[offset] &= 0xff00 >> mask; - m_video_ram[offset] |= data << mask; -} - -static ADDRESS_MAP_START(mz6500_map, AS_PROGRAM, 16, mz6500_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0x9ffff) AM_RAM -// AM_RANGE(0xa0000,0xbffff) kanji/dictionary ROM - AM_RANGE(0xc0000,0xeffff) AM_READWRITE8(mz6500_vram_r,mz6500_vram_w,0xffff) - AM_RANGE(0xfc000,0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mz6500_io, AS_IO, 16, mz6500_state) - ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0x0000, 0x000f) i8237 dma -// AM_RANGE(0x0010, 0x001f) i8255 - AM_RANGE(0x0020, 0x0021) AM_MIRROR(0xe) AM_DEVICE8("upd765", upd765a_device, map, 0xffff) -// AM_RANGE(0x0030, 0x003f) i8259 master -// AM_RANGE(0x0040, 0x004f) i8259 slave -// AM_RANGE(0x0050, 0x0050) segment byte for DMA -// AM_RANGE(0x0060, 0x0060) system port A -// AM_RANGE(0x0070, 0x0070) system port C -// AM_RANGE(0x00cd, 0x00cd) MZ-1R32 - AM_RANGE(0x0100, 0x0103) AM_MIRROR(0xc) AM_DEVREADWRITE8("upd7220", upd7220_device, read, write, 0x00ff) -// AM_RANGE(0x0110, 0x011f) video address / data registers (priority) -// AM_RANGE(0x0120, 0x012f) video registers -// AM_RANGE(0x0130, 0x013f) video register -// AM_RANGE(0x0140, 0x015f) palette pens -// AM_RANGE(0x0200, 0x020f) z80sio -// AM_RANGE(0x0210, 0x021f) z80ctc -// AM_RANGE(0x0220, 0x022f) rp5c01 -// AM_RANGE(0x0230, 0x023f) ay-3-8912 -// AM_RANGE(0x0240, 0x0240) z80ctc vector ack -// AM_RANGE(0x0250, 0x0250) z80sio vector ack -// AM_RANGE(0x0270, 0x0270) system port B -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( mz6500 ) -INPUT_PORTS_END - - -void mz6500_state::machine_reset() -{ -} - -void mz6500_state::fdc_irq(bool state) -{ - //printf("%02x IRQ\n",state); -} - -void mz6500_state::fdc_drq(bool state) -{ - //printf("%02x DRQ\n",state); -} - -static SLOT_INTERFACE_START( mz6500_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -static ADDRESS_MAP_START( upd7220_map, AS_0, 16, mz6500_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - - -static MACHINE_CONFIG_START( mz6500, mz6500_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 8000000) //unk clock - MCFG_CPU_PROGRAM_MAP(mz6500_map) - MCFG_CPU_IO_MAP(mz6500_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_PALETTE_ADD("palette", 8) - - /* Devices */ - MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/6) // unk clock - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz6500_state, hgdc_display_pixels) - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mz6500 ) - ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x4000,CRC(6c978ac4) SHA1(7872d7e6d9cda2ed9f47ed4833a5caa4dfe0e55c)) - - ROM_REGION( 0x40000, "dictionary", ROMREGION_ERASEFF ) - ROM_LOAD( "dict.rom", 0x0000, 0x40000, CRC(2df3cfd3) SHA1(d420ede09658c2626b0bb650a063d88b1783e554)) - - ROM_REGION( 0x40000, "kanji", ROMREGION_ERASEFF ) - ROM_LOAD( "kanji.rom", 0x0000, 0x40000, CRC(b618e25d) SHA1(1da93337fecde6c0f8a5bd68f3f0b3222a38d63e)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, mz6500, 0, 0, mz6500, mz6500, driver_device, 0, "Sharp", "MZ-6500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/mz700.c b/src/mess/drivers/mz700.c deleted file mode 100644 index 4039da71e14..00000000000 --- a/src/mess/drivers/mz700.c +++ /dev/null @@ -1,456 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Dirk Best -/****************************************************************************** - * Sharp MZ700 - * - * Reference: http://sharpmz.computingmuseum.com - * - * MZ700 memory map - * - * 0000-0FFF 1Z-013A ROM or RAM - * 1000-CFFF RAM - * D000-D7FF videoram or RAM - * D800-DFFF colorram or RAM - * E000-FFFF memory mapped IO or RAM - * - * xxx0 PPI8255 port A (output) - * bit 7 556RST (reset NE556) - * bit 6-4 unused - * bit 3-0 keyboard row demux (LS145) - * - * xxx1 PPI8255 port B (input) - * bit 7-0 keyboard matrix code - * - * xxx2 PPI8255 port C (input/output) - * bit 7 R -VBLANK input - * bit 6 R 556OUT (1.5Hz) - * bit 5 R RDATA from cassette - * bit 4 R MOTOR from cassette - * bit 3 W M-ON control - * bit 2 W INTMASK 1=enable 0=disabel clock interrupt - * bit 1 W WDATA to cassette - * bit 0 W unused - * - * xxx3 PPI8255 control - * - * xxx4 PIT8253 timer 0 (clock input 1,108800 MHz) - * xxx5 PIT8253 timer 1 (clock input 15,611 kHz) - * xxx6 PIT8253 timer 2 (clock input OUT1 1Hz (default)) - * xxx7 PIT8253 control/status - * - * xxx8 bit 7 R -HBLANK - * bit 6 R unused - * bit 5 R unused - * bit 4 R joystick JB2 - * bit 3 R joystick JB1 - * bit 2 R joystick JA2 - * bit 1 R joystick JA1 - * bit 0 R NE556 OUT (32Hz IC BJ) - * W gate0 of PIT8253 (sound enable) - * - * MZ800 memory map - * - * 0000-0FFF ROM or RAM - * 1000-1FFF PCG ROM or RAM - * 2000-7FFF RAM - * 8000-9FFF videoram or RAM - * A000-BFFF videoram or RAM - * C000-CFFF PCG RAM or RAM - * D000-DFFF videoram or RAM - * E000-FFFF memory mapped IO or RAM - * - *****************************************************************************/ - -#include "emu.h" -#include "includes/mz700.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/z80pio.h" -#include "machine/74145.h" -#include "bus/centronics/ctronics.h" -#include "sound/sn76496.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "formats/mz_cas.h" - - -/*************************************************************************** - TIMER DEVICE CALLBACKS -***************************************************************************/ - -TIMER_DEVICE_CALLBACK_MEMBER(mz_state::ne556_cursor_callback) -{ - m_cursor_timer ^= 1; -} - -TIMER_DEVICE_CALLBACK_MEMBER(mz_state::ne556_other_callback) -{ - m_other_timer ^= 1; -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( mz700_mem, AS_PROGRAM, 8, mz_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mz700_io, AS_IO, 8, mz_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xe0, 0xe0) AM_WRITE(mz700_bank_0_w) - AM_RANGE(0xe1, 0xe1) AM_WRITE(mz700_bank_1_w) - AM_RANGE(0xe2, 0xe2) AM_WRITE(mz700_bank_2_w) - AM_RANGE(0xe3, 0xe3) AM_WRITE(mz700_bank_3_w) - AM_RANGE(0xe4, 0xe4) AM_WRITE(mz700_bank_4_w) - AM_RANGE(0xe5, 0xe5) AM_WRITE(mz700_bank_5_w) - AM_RANGE(0xe6, 0xe6) AM_WRITE(mz700_bank_6_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mz800_mem, AS_PROGRAM, 8, mz_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mz800_io, AS_IO, 8, mz_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xcc, 0xcc) AM_WRITE(mz800_write_format_w ) - AM_RANGE(0xcd, 0xcd) AM_WRITE(mz800_read_format_w ) - AM_RANGE(0xce, 0xce) AM_READWRITE(mz800_crtc_r, mz800_display_mode_w ) - AM_RANGE(0xcf, 0xcf) AM_WRITE(mz800_scroll_border_w ) - AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) - AM_RANGE(0xd4, 0xd7) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE(0xe0, 0xe0) AM_READWRITE(mz800_bank_0_r, mz800_bank_0_w) - AM_RANGE(0xe1, 0xe1) AM_READWRITE(mz800_bank_1_r, mz700_bank_1_w) - AM_RANGE(0xe2, 0xe2) AM_WRITE(mz700_bank_2_w) - AM_RANGE(0xe3, 0xe3) AM_WRITE(mz700_bank_3_w) - AM_RANGE(0xe4, 0xe4) AM_WRITE(mz700_bank_4_w) - AM_RANGE(0xe5, 0xe5) AM_WRITE(mz700_bank_5_w) - AM_RANGE(0xe6, 0xe6) AM_WRITE(mz700_bank_6_w) - AM_RANGE(0xea, 0xea) AM_READWRITE(mz800_ramdisk_r, mz800_ramdisk_w ) - AM_RANGE(0xeb, 0xeb) AM_WRITE(mz800_ramaddr_w ) - AM_RANGE(0xf0, 0xf0) AM_READ_PORT("atari_joy1") AM_WRITE(mz800_palette_w) - AM_RANGE(0xf1, 0xf1) AM_READ_PORT("atari_joy2") - AM_RANGE(0xf2, 0xf2) AM_DEVWRITE("sn76489n", sn76489_device, write) - AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/* 2008-05 FP: -Notice that there is no Backspace key, only a 'Del' one. - -Small note about natural keyboard support: currently, -- "Alpha" is mapped to 'F6' -- "Graph" is mapped to 'F7' -- "Break" is mapped to 'F8' */ - -static INPUT_PORTS_START( mz700 ) - PORT_START("ROW0") - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, 0x08, IPT_UNUSED ) - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_NAME("Alpha") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93 \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\xA3') // this one would be 2nd row, 3rd key after 'P' - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_CHAR('_') // this one would be 2nd row, 4th key after 'P' - - PORT_START("ROW1") - PORT_BIT(0x07, 0x07, IPT_UNUSED ) - PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - - PORT_START("ROW2") - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START("ROW3") - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - - PORT_START("ROW4") - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START("ROW5") - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("ROW6") - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_NAME("0 Pi") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('~') - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_CHAR('\\') PORT_CHAR('|') // this one would be 1st row, 3rd key after '0' - - PORT_START("ROW7") - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("/ \xE2\x86\x90") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("? \xE2\x86\x92") PORT_CODE(KEYCODE_END) PORT_CHAR('?') // this one would be 4th row, 4th key after 'M' - PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("INST") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("ROW8") - PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x3e, 0x3e, IPT_UNUSED) - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F8)) // this one would be at Backspace position - - PORT_START("ROW9") - PORT_BIT(0x07, 0x07, IPT_UNUSED) - PORT_BIT(0x08, 0x08, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x10, 0x10, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x20, 0x20, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("JOY") - PORT_BIT(0x01, 0x00, IPT_UNUSED) - PORT_BIT(0x02, 0x00, IPT_JOYSTICK_UP) PORT_8WAY - PORT_BIT(0x04, 0x00, IPT_JOYSTICK_DOWN) PORT_8WAY - PORT_BIT(0x08, 0x00, IPT_JOYSTICK_LEFT) PORT_8WAY - PORT_BIT(0x10, 0x00, IPT_JOYSTICK_RIGHT) PORT_8WAY -INPUT_PORTS_END - -static INPUT_PORTS_START( mz800 ) - PORT_INCLUDE(mz700) - - PORT_MODIFY("JOY") - PORT_BIT(0x1f, 0x00, IPT_UNUSED) - - PORT_START("atari_joy1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) - - PORT_START("atari_joy2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) - - PORT_START("system_settings") - PORT_DIPNAME(0x01, 0x00, "Mode selection") - PORT_DIPLOCATION("SW:4") - PORT_DIPSETTING(0x01, "MZ-700") - PORT_DIPSETTING(0x00, "MZ-800") - PORT_DIPNAME(0x06, 0x06, "Printer selection") - PORT_DIPLOCATION("SW:3,2") - PORT_DIPSETTING(0x06, "MZ printer") - PORT_DIPSETTING(0x00, "Centronics printer") - PORT_DIPNAME(0x08, 0x08, "Cassette polarity") - PORT_DIPLOCATION("SW:1") - PORT_DIPSETTING(0x08, DEF_STR(Unknown)) - PORT_DIPSETTING(0x00, DEF_STR(Unknown)) -INPUT_PORTS_END - - -/*************************************************************************** - GFX LAYOUT -***************************************************************************/ - -static const gfx_layout mz700_layout = -{ - 8, 8, /* 8 x 8 graphics */ - 512, /* 512 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 /* code takes 8 times 8 bits */ -}; - -static GFXDECODE_START( mz700 ) - GFXDECODE_ENTRY("cgrom", 0, mz700_layout, 0, 256) -GFXDECODE_END - -static GFXDECODE_START( mz800 ) - GFXDECODE_ENTRY(NULL, 0, mz700_layout, 0, 256) - GFXDECODE_ENTRY("monitor", 0x1000, mz700_layout, 0, 256) // for mz800 viewer only -GFXDECODE_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static MACHINE_CONFIG_START( mz700, mz_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_17_73447MHz/5) - MCFG_CPU_PROGRAM_MAP(mz700_mem) - MCFG_CPU_IO_MAP(mz700_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_17_73447MHz/2, 568, 0, 40*8, 312, 0, 25*8) - MCFG_SCREEN_UPDATE_DRIVER(mz_state, screen_update_mz700) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz700) - MCFG_PALETTE_ADD("palette", 256*2) - MCFG_PALETTE_INDIRECT_ENTRIES(8) - MCFG_PALETTE_INIT_OWNER(mz_state, mz) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* ne556 timers */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("cursor", mz_state, ne556_cursor_callback, attotime::from_hz(1.5)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("other", mz_state, ne556_other_callback, attotime::from_hz(34.5)) - - /* devices */ - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_17_73447MHz/20) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(mz_state, pit_out0_changed)) - MCFG_PIT8253_CLK1(15611.0) - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pit8253", pit8253_device, write_clk2)) - MCFG_PIT8253_CLK2(0) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mz_state, pit_irq_2)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mz_state, pio_port_a_w)) - MCFG_I8255_IN_PORTB_CB(READ8(mz_state, pio_port_b_r)) - MCFG_I8255_IN_PORTC_CB(READ8(mz_state, pio_port_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mz_state, pio_port_c_w)) - - MCFG_DEVICE_ADD("ls145", TTL74145, 0) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(mz700_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("mz_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","mz700_cass") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( mz800, mz700 ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(mz800_mem) - MCFG_CPU_IO_MAP(mz800_io) - - MCFG_GFXDECODE_MODIFY("gfxdecode",mz800) - - MCFG_VIDEO_START_OVERRIDE(mz_state,mz800) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(mz_state, screen_update_mz800) - - MCFG_SOUND_ADD("sn76489n", SN76489, XTAL_17_73447MHz/5) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_DEVICE_REMOVE("cass_list") - MCFG_SOFTWARE_LIST_ADD("cass_list","mz800_cass") - - /* devices */ - MCFG_DEVICE_MODIFY("pit8253") - MCFG_PIT8253_CLK0(XTAL_17_73447MHz/16) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_17_73447MHz/5) - MCFG_Z80PIO_OUT_INT_CB(WRITELINE(mz_state, mz800_z80pio_irq)) - MCFG_Z80PIO_IN_PA_CB(READ8(mz_state, mz800_z80pio_port_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(mz_state, mz800_z80pio_port_a_w)) - MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( mz700 ) - ROM_REGION( 0x1000, "monitor", 0 ) - ROM_LOAD( "1z-013a.rom", 0x0000, 0x1000, CRC(4c6c6b7b) SHA1(ef8f7399e86c1dc638a5cb83efdb73369c2b5735) ) - - ROM_REGION( 0x1000, "cgrom", 0 ) - ROM_LOAD( "mz700fon.int", 0x0000, 0x1000, CRC(42b9e8fb) SHA1(5128ad179a702f8e0bd9910a58bad8fbe4c20167) ) -ROM_END - -ROM_START( mz700j ) - ROM_REGION( 0x1000, "monitor", 0 ) - ROM_LOAD( "1z-009b.rom", 0x0000, 0x1000, CRC(ab1fbe6f) SHA1(7b10d7965c541393e33a265bcf71a00314d2db7a)) - - ROM_REGION( 0x1000, "cgrom", 0 ) - //ROM_LOAD( "mz700fon.jp", 0x0000, 0x1000, CRC(697ec121) SHA1(5eb1d42d273b1fd2cab120486279ab8ff6c85dc7)) - ROM_LOAD( "mz700fon.jpn", 0x0000, 0x1000, CRC(425eedf5) SHA1(bd2cc750f2d2f63e50a59786668509e81a276e32) ) -ROM_END - -ROM_START( mz800 ) - ROM_REGION( 0x4000, "monitor", 0 ) - ROM_LOAD( "mz800.rom", 0x0000, 0x4000, CRC(600d17e1) SHA1(950ce4b51429916f8036e41ba6130fac149b36e4) ) -ROM_END - -ROM_START( mz1500 ) - ROM_REGION( 0x4000, "monitor", 0 ) - ROM_LOAD( "9z-502m.rom", 0x0000, 0x2800, CRC(643db428) SHA1(c2ad8af2ef00db32afde54d5741b07de5d4da16a)) - ROM_REGION( 0x1000, "cgrom", 0 ) - //ROM_LOAD( "mz700fon.jp", 0x0000, 0x1000, CRC(697ec121) SHA1(5eb1d42d273b1fd2cab120486279ab8ff6c85dc7)) - ROM_LOAD( "mz700fon.jpn", 0x0000, 0x1000, CRC(425eedf5) SHA1(bd2cc750f2d2f63e50a59786668509e81a276e32) ) -ROM_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1982, mz700, 0, 0, mz700, mz700, mz_state, mz700, "Sharp", "MZ-700", 0 ) -COMP( 1982, mz700j, mz700, 0, mz700, mz700, mz_state, mz700, "Sharp", "MZ-700 (Japan)", 0 ) -COMP( 1984, mz800, 0, 0, mz800, mz800, mz_state, mz800, "Sharp", "MZ-800", MACHINE_NOT_WORKING ) -COMP( 1984, mz1500, 0, 0, mz800, mz800, mz_state, mz800, "Sharp", "MZ-1500", MACHINE_NOT_WORKING ) // Japanese version of the MZ-800 diff --git a/src/mess/drivers/mz80.c b/src/mess/drivers/mz80.c deleted file mode 100644 index 0bd1f92b71a..00000000000 --- a/src/mess/drivers/mz80.c +++ /dev/null @@ -1,380 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - MZ80 driver by Miodrag Milanovic - - 22/11/2008 Preliminary driver. - -MZ80K Monitor - no commands seem to do anything - -MZ80A Monitor Commands: -B - turn key beep on/off -F - boot from Floppy (press enter at the question) -L - load a cassette -could be more - -MZ80A ToDo: -- System writes CF to D800-DFFF -- System uses E200-E2FF (contents are read then discarded) -- SYstem uses E800 -- Disk uses ports D8-DC -- Keyboard issues listed below - -MZ80B -- Makes extensive use of io ports -- D000-FFFF is banked ram - -****************************************************************************/ - -#include "includes/mz80.h" - - -/* Note about natural keyboard support: - - Keys G1 -> G25 are not mapped in natural mode, switch to emulated mode to use them - */ -static INPUT_PORTS_START( mz80k ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G4") PORT_CODE(KEYCODE_4_PAD) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(0x03C0) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G5") PORT_CODE(KEYCODE_5_PAD) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G9") PORT_CODE(KEYCODE_9_PAD) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G10") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\xA3') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G12") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G14") PORT_CODE(KEYCODE_F4) - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G11") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G13") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G15") PORT_CODE(KEYCODE_F5) - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SML CAP") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G17") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G19") PORT_CODE(KEYCODE_F9) - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G16") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G18") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G20") PORT_CODE(KEYCODE_F10) - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Left") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G22") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G24") PORT_CODE(KEYCODE_PGDN) - - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G21") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G23") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G25") PORT_CODE(KEYCODE_TILDE) -INPUT_PORTS_END - -// One of the keys labeled as 'Unused' in Line0 should be the Graph key; another one is the Spacebar. Also, PORT_NAMEs need to be verified -static INPUT_PORTS_START( mz80a ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') // Left Arrow - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('?') // Up Arrow - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Left") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("00") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused?") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) -INPUT_PORTS_END - -static ADDRESS_MAP_START( mz80k_mem, AS_PROGRAM, 8, mz80_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0xcfff) AM_RAM AM_SHARE("p_ram") // 48 KB of RAM - AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("p_videoram") // Video RAM - AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) /* PPIA 8255 */ - AM_RANGE(0xe004, 0xe007) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) /* PIT 8253 */ - AM_RANGE(0xe008, 0xe00b) AM_READWRITE( mz80k_strobe_r, mz80k_strobe_w) - AM_RANGE(0xf000, 0xf3ff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mz80k_io, AS_IO, 8, mz80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -static GFXDECODE_START( mz80k ) - GFXDECODE_ENTRY( "chargen", 0x0000, mz80k_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( mz80kj ) - GFXDECODE_ENTRY( "chargen", 0x0000, mz80kj_charlayout, 0, 1 ) -GFXDECODE_END - -TIMER_DEVICE_CALLBACK_MEMBER(mz80_state::ne555_tempo_callback) -{ - m_mz80k_tempo_strobe ^= 1; -} - -static MACHINE_CONFIG_START( mz80k, mz80_state ) - /* basic machine hardware */ - - /* main CPU */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz / 4) /* 2 MHz */ - MCFG_CPU_PROGRAM_MAP(mz80k_mem) - MCFG_CPU_IO_MAP(mz80k_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 199) - MCFG_SCREEN_UPDATE_DRIVER(mz80_state, screen_update_mz80k) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz80k) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* Audio */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(mz80_state, mz80k_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(mz80_state, mz80k_8255_portb_r)) - MCFG_I8255_IN_PORTC_CB(READ8(mz80_state, mz80k_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(mz80_state, mz80k_8255_portc_w)) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_8MHz/4) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(mz80_state, pit_out0_changed)) - MCFG_PIT8253_CLK1(XTAL_8MHz/256) - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pit8253", pit8253_device, write_clk2)) - MCFG_PIT8253_CLK2(0) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(mz80_state, pit_out2_changed)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("tempo", mz80_state, ne555_tempo_callback, attotime::from_hz(34)) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mz80kj, mz80k ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(mz80_state, screen_update_mz80kj) - MCFG_GFXDECODE_MODIFY("gfxdecode", mz80kj) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mz80a, mz80k ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(mz80_state, screen_update_mz80a) -MACHINE_CONFIG_END - - -ROM_START( mz80k ) - ROM_REGION( 0x10000, "maincpu", 0) - ROM_SYSTEM_BIOS( 0, "sp1002", "sp1002" ) - ROMX_LOAD( "sp1002.rom", 0x0000, 0x1000, CRC(2223e677) SHA1(518ffbe2333582ab36e6d76d1e03879a246ffa1c), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "tc", "tc" ) - ROMX_LOAD( "80ktc.rom", 0x0000, 0x1000, CRC(19ed6546) SHA1(2bbeff916c2fa8991e718070ca4195beb45e0848), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v44", "v44" ) - ROMX_LOAD( "80kv44.rom", 0x0000, 0x1000, CRC(d66af028) SHA1(718904c011dfcfcfabbb7dbdaaa35b9f3ac41baf), ROM_BIOS(3) ) - ROM_LOAD( "mz80kfdif.rom", 0xf000, 0x0400, CRC(d36505e0) SHA1(1f60027e8739313962a37edbf98172df7062df49) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "80kcg.rom", 0x0000, 0x0800, CRC(9b2fb88b) SHA1(6d4d120bd0e3a8c781c581e3c379a39db610a4d2) ) - // This is listed as "fixed" English - ROM_LOAD( "80kcgf.rom", 0x0800, 0x0800, CRC(be952852) SHA1(e8273de9cce88b10630187841f81aa9be22520b7) ) -ROM_END - -ROM_START( mz80kj ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "sp1002.rom", 0x0000, 0x1000, CRC(2223e677) SHA1(518ffbe2333582ab36e6d76d1e03879a246ffa1c) ) - // TC monitor not possible to be used on japanese version since chargen doesn't have upcase/lowecase, but japanese letters - ROM_LOAD( "mz80kfdif.rom", 0xf000, 0x0400, CRC(d36505e0) SHA1(1f60027e8739313962a37edbf98172df7062df49) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "mz80k.jpn", 0x0000, 0x0800, CRC(bffe3312) SHA1(7058e565f338f5ec2bba85c19c9671e5c4fe258e) ) - // This has a different Japanese set - ROM_LOAD( "80kcgj.rom", 0x0800, 0x0800, CRC(7767f11e) SHA1(8dc88d088b2e7d3198bf856bd44d364fb6e5cfa4) ) -ROM_END - -ROM_START( mz80a ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "sa1510.rom", 0x0000, 0x1000, CRC(ae63ab39) SHA1(3c2180c52fc470131ba668a6c16e77656adeccf8) ) - ROM_LOAD( "mz80afi.rom", 0xf000, 0x0800, CRC(e3b3ddfb) SHA1(ec94cc3d236716f53e747f0c8ac9186d72bf9c10) ) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "mz80acg.rom", 0x0000, 0x0800, CRC(a87c2e2b) SHA1(e8aefbdb48a63e5f96692af868c353ca7e1bfcd2) ) -ROM_END - -ROM_START( mz80b ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "ipl.rom", 0x0000, 0x0800, CRC(80beeec0) SHA1(d2b8167cc77ad023a807198993cb5e7a94c9e19e) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "mzfont.rom", 0x0000, 0x0800, CRC(0631efc3) SHA1(99b206af5c9845995733d877e9e93e9681b982a8) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1979, mz80kj, 0, 0, mz80kj, mz80k, mz80_state, mz80k, "Sharp", "MZ-80K (Japanese)", 0 ) -COMP( 1979, mz80k, mz80kj, 0, mz80k, mz80k, mz80_state, mz80k, "Sharp", "MZ-80K", 0 ) - -// These may need a separate driver! -COMP( 1982, mz80a, 0, 0, mz80a, mz80a, mz80_state, mz80k, "Sharp", "MZ-80A", 0 ) -COMP( 1981, mz80b, 0, 0, mz80k, mz80k, mz80_state, mz80k, "Sharp", "MZ-80B", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/mzr8105.c b/src/mess/drivers/mzr8105.c deleted file mode 100644 index e1679e2a146..00000000000 --- a/src/mess/drivers/mzr8105.c +++ /dev/null @@ -1,369 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Joakim Larsson Edstrom -/*************************************************************************** - * - * Mizar VME8105 rev D 3U SBC driver, initially derived from force68k.c - * - * 19/08/2015 - * - * I baught this board from http://www.retrotechnology.com without documentation. - * It has a Motorola 68000 CPU @ 10MHz and two 27128 EPROMS with OS9 DEBUG labels - * and not much more except 16 or so TTLs, 2 PALs and a VME P1 connector. It is a - * 2 sided design so it shold be possible to trace the schematics quite easily. - * There is a date on the P1 Connector: "Feb 20 1987" - * - * || - * || - * || - * || - * ||____________________________________________________________ ___ - * || --------------K2|U6-7432|U7-7474|U14-7405|U21-74645 | |_| | - * || | 2764 - low |-+-------+-------+--------+-----------+ | | | - * || | OS9 DEBUG U4| +---------+ +--------+---------+ | | | - * || -------------- | | |U13-7474|U20-74645| | | | - * || ______________ | | +--------+---------+ | | | - * || | | | | ______________K4____ | | | - * || | U3| | | |U12-7438|U19-74244| | |VME| - * || -------------- | |+------K6---------K3---+ | | | - * || ______________ | ||U11-PAL20L10|U18-74244| | |P1 | - * || | 2764 - high | | |+-----021102-+---------+ | | | - * || | OS9 DEBUG U2| |MC68000L10+------------+---------+ | | | - * || |______________| | ||U10-PAL14L4 |U17-74244| | | | - * || | |+-----021001-+---------+ | | | - * || -------------- | |+----+_______|U16-74244|+--+| | | - * || | | | |XTAL |U9-7410+---------+| || | | - * ||K1 | U1| | |FOX100-------+---------+|K5||_| | - * || -------------- |_________|10MHz|U8-7404|U15-74148|| || |___| - * ||--||--------------------------------+----+-------+---------++--+ - * ||--|| - * || - * - * PAL:s - *------ - * The board has two PAL:s, a PAL20L10 and a PAL14L4. - * - * _____ _____ - * OD/CLK 1 |* \_/ | 20 VCC - * CPU A13 I0 2 | | 19 O0/LR A23 - * U9 7410p12 I1 3 | | 18 O1/A0 A22 - * CPU *AS I2 4 | | 17 02/A1 U2/U4 2764p22 *OE - * GND I3 5 | | 16 03/A2 U11 PAL20L10p6 I4 - * CPU A14 I4 6 | U10 | 15 A0/O0 U11 PAL20L10p7 I5 - * CPU A15 I5 7 | PAL14L4 | 14 A1/O1 U19 74LS244p11 I0b - * CPU A16 I6 8 | | 13 A2/O2 A18 - * CPU A17 I7 9 | | 12 LR/O3 A20 - * GND 10 |_____________| 11 CLK/OD A21 - * - * _____ _____ - * OD/CLK 1 |* \_/ | 24 VCC - * I0 2 | | 23 O0/LR - * CPU *AS I1 3 | | 22 O1/A0 - * U10 PAL14L4p3 I2 4 | | 21 02/A1 - * I3 5 | | 20 03/A2 - * U10 PAL14L4p16 I4 6 | U10 | 19 04/NC - * U10 PAL14L4p15 I5 7 | PAL20L10 | 18 NC/O0 - * I6 8 | | 17 A2/O1 - * I7 9 | | 16 A1/O2 - * I8 10 | | 15 A0/O3 - * I9 11 | | 14 LR/O4 - * GND 12 |_____________| 13 CLK/OD - * - * Trace is not fully completed and validated. - * - * History of Mizar - *------------------- - * Mizar was one of the first companies that released VME boards in 1982-3 together with - * Force Computers and Motorola. Their systems was often supported by OS9/68000 from Microware. - * In 1993 Mizar discontinued their OS9/CPU board product range and focused entirely on DSP - * boards. RTSI was founded by Mizar employees preserving the knowledge in OS9 as consultants. - * In 1998 Blue Wave resulted from the merger of Mizar and Loughborough Sound Images. - * Not much tech information availabe but I found some quotes about Mizar on the internet: - * - * From http://archive.org/stream/68micro-vol-11-num-02/V11N02_Feb1989_djvu.txt : - *-------------------------------------------------------------------------------- - * " Mizar provides complete OS-9 solutions for the VMEbus. Mizar's VME CPUs - * offer (he functions and performance your application demands. Our single - * height (3U) VME processors are uniquely configurable computing engines, - * Through Mizar's unique MXbus expansion interface, standard and custom side - * modules can be added to basic processors to create double-height (6U) boards - * tor specific applications, 3U CPU options include 68010, 66020, and 63030 - * microprocessors, up to one MB of DRAM, serial I/O, real-time clock, and - * mailbox interrupt support. Standard MXbus side modules include additional DRAM. - * SRAM, and I/O. - * - * Mizar's standard double- height (6U) processors provide additional features such - * as a high-speed cache to enhance 68030 performance, floating, point coprocessor - * support, up to four MB dual ported DRAM, VSB memory interface, Ethernet, and SCSI. - * - * Mizar also supports OS-9 with completely configured OS9 development systems and - * OS-9 application server systems. For more information, call Mizar today - * - * 800-635-0200 MIZAR 1419 Dunn Drive CarrolHon, TX 75006 214-446-2664" - * - * Known boards from Mizar: - * - *-Comp.Os.Vxworks diguest mailing list May 1992: VxWorks Drivers Available from Mizar: - * EMX 7320 Serial I/O Board - * EMX 7550 Ethernet Controller Board (AMD 7990 Lance) MAC: 00:80:F8 MIZAR, INC. - * MZ 7300 Serial I/O Board (Z8530) - * MZ 7400 Disk Controller Board (WD 2010; WD 1772) - * MZ 7500 IEEE-488 (GPIB) Interface Board - * MZ 7810 I/O Expansion Module (6681 DUART) - * MZ 7831 SCSI Expansion Module (WD 33C93A) - * MZ 7850 Ethernet Expansion Module (WD 83C690) - * MZ 8505 IEEE-488 (GPIB) Interface Board" - *- Other sources: - * MZ 8000 ?? - * MZ 8105 3U 68000 CPU board - * MZ 8300 3U serial board, 2 NEC 7201 (Z80 DART) and 1 AMD CTS9513 5 x 16 bit Counter/Timer - * - * From http://www.megalextoria.com/forum2/index.php?t=msg&goto=73945& - *-------------------------------------------------------------------- - * Aug 20 1984 a report by James Jones from the OS/9 conferance in Des Moines: - * "... - * Mizar: is selling VME bus 68010 boards, running OS-9/68000; they also make - * various memory and I/O boards, disk controller boards, and and a NEC 7220-based - * graphics controller board...." - * - * Misc links about Mizar: - * http://www.vita.com/History - * http://www.verycomputer.com/154_e272024804bbe203_1.htm - * https://www.aihitdata.com/company/00814595/RTSI/overview - * - * Address Map - * -------------------------------------------------------------------------- - * Address Range Description/Assumption - * -------------------------------------------------------------------------- - * 0x000000 0x01ffff ROM because of fixed vectors - * 0x020000 0x03ffff RAM because bootvector stack starts at 0x21000 - * -- VME adresses--- - * 0xff0000 0xff0003 Bootstrap expects to find a UPD7201 serial device here - * -------------------------------------------------------------------------- - * - * Interrupt sources - * ---------------------------------------------------------- - * Description Device Lvl IRQ VME board - * /Board Vector Address - * ---------------------------------------------------------- - * On board Sources - * TBD - * Off board Sources (other VME boards) - * TBD - * ---------------------------------------------------------- - * - * TODO: - * - Dump the ROMs (DONE) - * - Setup a working address map (DONE) - * - Add VME bus driver (Faked one) - * - ****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/z80dart.h" -#include "bus/rs232/rs232.h" -#include "machine/clock.h" - -#define CARDSLOT 0 - -#if CARDSLOT // Awaiting info on how to boot the user eproms -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#endif - -#define LOG(x) x - - -/* These values are borrowed just to get the terminal going and should be replaced - * once a proper serial board hardware (ie MZ 8300) is found and emulated. */ -#define BAUDGEN_CLOCK XTAL_19_6608MHz /* fake */ -#define UPD_CLOCK (BAUDGEN_CLOCK / 128) /* This will give prompt */ - -class mzr8105_state : public driver_device -{ -public: -mzr8105_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device (mconfig, type, tag), - m_maincpu (*this, "maincpu") - ,m_updterm(*this, "upd") -// ,m_cart(*this, "exp_rom1") -{ -} - -DECLARE_READ16_MEMBER (vme_a24_r); -DECLARE_WRITE16_MEMBER (vme_a24_w); -DECLARE_READ16_MEMBER (vme_a16_r); -DECLARE_WRITE16_MEMBER (vme_a16_w); -virtual void machine_start (); -DECLARE_WRITE_LINE_MEMBER (write_updterm_clock); - -#if CARDSLOT -// User EPROM/SRAM slot(s) -int mzr8105_load_cart(device_image_interface &image, generic_slot_device *slot); -DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return mzr8105_load_cart(image, m_cart); } -DECLARE_READ16_MEMBER (read16_rom); -#endif - -protected: - -private: -required_device m_maincpu; -required_device m_updterm; - -// Pointer to System ROMs needed by bootvect_r -// UINT16 *m_sysrom; - -#if CARDSLOT -UINT16 *m_usrrom; -required_device m_cart; -#endif -}; - -static ADDRESS_MAP_START (mzr8105_mem, AS_PROGRAM, 16, mzr8105_state) -ADDRESS_MAP_UNMAP_HIGH -//AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r) /* Not verified */ -AM_RANGE (0x000000, 0x003fff) AM_ROM /* System EPROM Area 16Kb OS9 DEBUG - not verified */ -AM_RANGE (0x004000, 0x01ffff) AM_ROM /* System EPROM Area 112Kb for System ROM - not verified */ -AM_RANGE (0x020000, 0x03ffff) AM_RAM /* Not verified */ -//AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, max 128Kb mapped by a cartslot */ -//AM_RANGE (0x0c0080, 0x0c0081) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, status_r, control_w, 0xff00) -//AM_RANGE (0x0c0082, 0x0c0083) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, data_r, data_w, 0xff00) -AM_RANGE(0x100000, 0xfeffff) AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */ -//AM_RANGE(0xff0000, 0xffffff) AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */ -// Faking a Mizar 8300 SIO BOARD in VME A16 adress space - AM_RANGE (0xFF0000, 0xFF0001) AM_DEVREADWRITE8("upd", upd7201_device, da_r, da_w, 0x00ff) /* Dual serial port NEC uPD7201 */ - AM_RANGE (0xFF0002, 0xFF0003) AM_DEVREADWRITE8("upd", upd7201_device, ca_r, ca_w, 0x00ff) /* Dual serial port NEC uPD7201 */ - AM_RANGE (0xFF0004, 0xFF0005) AM_DEVREADWRITE8("upd", upd7201_device, db_r, db_w, 0x00ff) /* Dual serial port NEC uPD7201 */ - AM_RANGE (0xFF0006, 0xFF0007) AM_DEVREADWRITE8("upd", upd7201_device, cb_r, cb_w, 0x00ff) /* Dual serial port NEC uPD7201 */ - -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START (mzr8105) -INPUT_PORTS_END - -/* Start it up */ -void mzr8105_state::machine_start () -{ - LOG (logerror ("machine_start\n")); - -#if CARDSLOT - /* Map user ROM/RAM socket(s) */ - if (m_cart->exists()) - { - m_usrrom = (UINT16*)m_cart->get_rom_base(); - m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(generic_slot_device::read16_rom), (generic_slot_device*)m_cart)); - } -#endif -} - -/* Dummy VME access methods until the VME bus device is ready for use */ -READ16_MEMBER (mzr8105_state::vme_a24_r){ - LOG (logerror ("vme_a24_r\n")); - return (UINT16) 0; -} - -WRITE16_MEMBER (mzr8105_state::vme_a24_w){ - LOG (logerror ("vme_a24_w\n")); -} - -READ16_MEMBER (mzr8105_state::vme_a16_r){ - LOG (logerror ("vme_16_r\n")); - return (UINT16) 0; -} - -WRITE16_MEMBER (mzr8105_state::vme_a16_w){ - LOG (logerror ("vme_a16_w\n")); -} - -#if CARDSLOT -/* - * 4. The USER EPROM Area - */ -// Implementation of static 2 x 64K EPROM in sockets U1/U3 as 16 bit wide cartridge for easier -// software handling. TODO: make configurable according to table above. -static MACHINE_CONFIG_FRAGMENT( mzr8105_eprom_sockets ) - MCFG_GENERIC_CARTSLOT_ADD("exp_rom1", generic_plain_slot, "mzr8105_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) - MCFG_GENERIC_LOAD(mzr8105_state, exp1_load) -// MCFG_SOFTWARE_LIST_ADD("cart_list", "mzr8105_cart") -MACHINE_CONFIG_END - -/*************************** - Rom loading functions -****************************/ -int mzr8105_state::mzr8105_load_cart(device_image_interface &image, generic_slot_device *slot) -{ - UINT32 size = slot->common_get_size("rom"); - - if (size > 0x20000) // Max 128Kb - not verified - { - LOG( printf("Cartridge size exceeding max size (128Kb): %d\n", size) ); - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (128Kb)"); - return IMAGE_INIT_FAIL; - } - - slot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG); - slot->common_load_rom(slot->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} -#endif - -WRITE_LINE_MEMBER (mzr8105_state::write_updterm_clock){ - m_updterm->txca_w (state); - m_updterm->rxca_w (state); -} - -/* - * Machine configuration - */ -static MACHINE_CONFIG_START (mzr8105, mzr8105_state) -/* basic machine hardware */ -MCFG_CPU_ADD ("maincpu", M68000, XTAL_10MHz) -MCFG_CPU_PROGRAM_MAP (mzr8105_mem) - - -/* Terminal Port config */ -MCFG_UPD7201_ADD("upd", XTAL_4MHz, 0, 0, 0, 0 ) -MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_txd)) -MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_dtr)) -MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_rts)) - -MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal") -MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("upd", upd7201_device, rxa_w)) -MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("upd", upd7201_device, ctsa_w)) - -MCFG_DEVICE_ADD ("updterm_clock", CLOCK, UPD_CLOCK) -MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (mzr8105_state, write_updterm_clock)) - -#if CARDSLOT - -// EPROM sockets -MCFG_FRAGMENT_ADD(mzr8105_eprom_sockets) -#endif - -MACHINE_CONFIG_END - -/* ROM definitions */ -ROM_START (mzr8105) -ROM_REGION (0x1000000, "maincpu", 0) - -ROM_LOAD16_BYTE ("mzros9LB.bin", 0x000001, 0x2000, CRC (7c6a354d) SHA1 (2721eb649c8046dbcb517a36a97dc0816cd133f2)) -ROM_LOAD16_BYTE ("mzros9HB.bin", 0x000000, 0x2000, CRC (d18e69a6) SHA1 (a00b68f4d649bcc09a29361f8692e52be12b3792)) - -/* - * System ROM information - * - * The ROMs contains an OS9 bootloader. It is position independent but reset vector suggests that it sits flat on adress 0 (zero) - * - * We got a prompt but the command reportoair are very sparse to non OS9 users so investigation needed. - * - */ -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP (1987, mzr8105, 0, 0, mzr8105, mzr8105, driver_device, 0, "Mizar Inc", "Mizar VME8105", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/n64.c b/src/mess/drivers/n64.c deleted file mode 100644 index a5c2e3c7499..00000000000 --- a/src/mess/drivers/n64.c +++ /dev/null @@ -1,499 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/* - Nintendo 64 - - Driver by Ville Linde - Reformatted to share hardware by R. Belmont - Additional work by Ryan Holtz - Porting from Mupen64 by Harmony -*/ - -#include "emu.h" -#include "cpu/rsp/rsp.h" -#include "cpu/mips/mips3.h" -#include "sound/dmadac.h" -#include "includes/n64.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "imagedev/snapquik.h" - -class n64_mess_state : public n64_state -{ -public: - n64_mess_state(const machine_config &mconfig, device_type type, const char *tag) - : n64_state(mconfig, type, tag) - { } - - DECLARE_READ32_MEMBER(dd_null_r); - DECLARE_MACHINE_START(n64dd); - INTERRUPT_GEN_MEMBER(n64_reset_poll); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(n64_cart); - void mempak_format(UINT8* pak); - int quickload(device_image_interface &image, const char *file_type, int quickload_size); - DECLARE_QUICKLOAD_LOAD_MEMBER( n64dd ); -}; - -READ32_MEMBER(n64_mess_state::dd_null_r) -{ - return 0xffffffff; -} - -static ADDRESS_MAP_START( n64_map, AS_PROGRAM, 32, n64_mess_state ) - AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("rdram") // RDRAM - AM_RANGE(0x03f00000, 0x03f00027) AM_DEVREADWRITE("rcp", n64_periphs, rdram_reg_r, rdram_reg_w) - AM_RANGE(0x04000000, 0x04000fff) AM_RAM AM_SHARE("rsp_dmem") // RSP DMEM - AM_RANGE(0x04001000, 0x04001fff) AM_RAM AM_SHARE("rsp_imem") // RSP IMEM - AM_RANGE(0x04040000, 0x040fffff) AM_DEVREADWRITE("rcp", n64_periphs, sp_reg_r, sp_reg_w) // RSP - AM_RANGE(0x04100000, 0x041fffff) AM_DEVREADWRITE("rcp", n64_periphs, dp_reg_r, dp_reg_w) // RDP - AM_RANGE(0x04300000, 0x043fffff) AM_DEVREADWRITE("rcp", n64_periphs, mi_reg_r, mi_reg_w) // MIPS Interface - AM_RANGE(0x04400000, 0x044fffff) AM_DEVREADWRITE("rcp", n64_periphs, vi_reg_r, vi_reg_w) // Video Interface - AM_RANGE(0x04500000, 0x045fffff) AM_DEVREADWRITE("rcp", n64_periphs, ai_reg_r, ai_reg_w) // Audio Interface - AM_RANGE(0x04600000, 0x046fffff) AM_DEVREADWRITE("rcp", n64_periphs, pi_reg_r, pi_reg_w) // Peripheral Interface - AM_RANGE(0x04700000, 0x047fffff) AM_DEVREADWRITE("rcp", n64_periphs, ri_reg_r, ri_reg_w) // RDRAM Interface - AM_RANGE(0x04800000, 0x048fffff) AM_DEVREADWRITE("rcp", n64_periphs, si_reg_r, si_reg_w) // Serial Interface - AM_RANGE(0x05000508, 0x0500050b) AM_READ(dd_null_r); - AM_RANGE(0x08000000, 0x0801ffff) AM_RAM AM_SHARE("sram") // Cartridge SRAM - AM_RANGE(0x10000000, 0x13ffffff) AM_ROM AM_REGION("user2", 0) // Cartridge - AM_RANGE(0x1fc00000, 0x1fc007bf) AM_ROM AM_REGION("user1", 0) // PIF ROM - AM_RANGE(0x1fc007c0, 0x1fc007ff) AM_DEVREADWRITE("rcp", n64_periphs, pif_ram_r, pif_ram_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( n64dd_map, AS_PROGRAM, 32, n64_mess_state ) - AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("rdram") // RDRAM - AM_RANGE(0x03f00000, 0x03f00027) AM_DEVREADWRITE("rcp", n64_periphs, rdram_reg_r, rdram_reg_w) - AM_RANGE(0x04000000, 0x04000fff) AM_RAM AM_SHARE("rsp_dmem") // RSP DMEM - AM_RANGE(0x04001000, 0x04001fff) AM_RAM AM_SHARE("rsp_imem") // RSP IMEM - AM_RANGE(0x04040000, 0x040fffff) AM_DEVREADWRITE("rcp", n64_periphs, sp_reg_r, sp_reg_w) // RSP - AM_RANGE(0x04100000, 0x041fffff) AM_DEVREADWRITE("rcp", n64_periphs, dp_reg_r, dp_reg_w) // RDP - AM_RANGE(0x04300000, 0x043fffff) AM_DEVREADWRITE("rcp", n64_periphs, mi_reg_r, mi_reg_w) // MIPS Interface - AM_RANGE(0x04400000, 0x044fffff) AM_DEVREADWRITE("rcp", n64_periphs, vi_reg_r, vi_reg_w) // Video Interface - AM_RANGE(0x04500000, 0x045fffff) AM_DEVREADWRITE("rcp", n64_periphs, ai_reg_r, ai_reg_w) // Audio Interface - AM_RANGE(0x04600000, 0x046fffff) AM_DEVREADWRITE("rcp", n64_periphs, pi_reg_r, pi_reg_w) // Peripheral Interface - AM_RANGE(0x04700000, 0x047fffff) AM_DEVREADWRITE("rcp", n64_periphs, ri_reg_r, ri_reg_w) // RDRAM Interface - AM_RANGE(0x04800000, 0x048fffff) AM_DEVREADWRITE("rcp", n64_periphs, si_reg_r, si_reg_w) // Serial Interface - AM_RANGE(0x05000000, 0x05ffffff) AM_DEVREADWRITE("rcp", n64_periphs, dd_reg_r, dd_reg_w) // 64DD Interface - AM_RANGE(0x06000000, 0x063fffff) AM_ROM AM_REGION("ddipl", 0) // 64DD IPL ROM - AM_RANGE(0x08000000, 0x0801ffff) AM_RAM AM_SHARE("sram") // Cartridge SRAM - AM_RANGE(0x10000000, 0x13ffffff) AM_ROM AM_REGION("user2", 0) // Cartridge - AM_RANGE(0x1fc00000, 0x1fc007bf) AM_ROM AM_REGION("user1", 0) // PIF ROM - AM_RANGE(0x1fc007c0, 0x1fc007ff) AM_DEVREADWRITE("rcp", n64_periphs, pif_ram_r, pif_ram_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( rsp_map, AS_PROGRAM, 32, n64_mess_state ) - AM_RANGE(0x00000000, 0x00000fff) AM_RAM AM_SHARE("rsp_dmem") - AM_RANGE(0x00001000, 0x00001fff) AM_RAM AM_SHARE("rsp_imem") - AM_RANGE(0x04000000, 0x04000fff) AM_RAM AM_SHARE("rsp_dmem") - AM_RANGE(0x04001000, 0x04001fff) AM_RAM AM_SHARE("rsp_imem") -ADDRESS_MAP_END - -static INPUT_PORTS_START( n64 ) - PORT_START("input") - PORT_CONFNAME(0x0003, 0x0001, "Controller Port 0 Device") - PORT_CONFSETTING(0x00, "None") - PORT_CONFSETTING(0x01, "Joypad") - PORT_CONFSETTING(0x02, "Mouse") - PORT_CONFNAME(0x000C, 0x0000, "Controller Port 1 Device") - PORT_CONFSETTING(0x00, "None") - PORT_CONFSETTING(0x04, "Joypad") - PORT_CONFSETTING(0x08, "Mouse") - PORT_CONFNAME(0x0030, 0x0000, "Controller Port 2 Device") - PORT_CONFSETTING(0x00, "None") - PORT_CONFSETTING(0x10, "Joypad") - PORT_CONFSETTING(0x20, "Mouse") - PORT_CONFNAME(0x00C0, 0x0000, "Controller Port 3 Device") - PORT_CONFSETTING(0x00, "None") - PORT_CONFSETTING(0x40, "Joypad") - PORT_CONFSETTING(0x80, "Mouse") - - PORT_CONFNAME(0x0100, 0x0000, "Disk Drive") - PORT_CONFSETTING(0x0000, "Retail") - PORT_CONFSETTING(0x0100, "Development") - - //Player 1 - PORT_START("P1") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Button A / Left Click") - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Button B / Right Click") - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Button Z") - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1) PORT_NAME("P1 Start") - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("P1 Joypad \xE2\x86\x91") /* Up */ - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 Joypad \xE2\x86\x93") /* Down */ - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad \xE2\x86\x90") /* Left */ - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad \xE2\x86\x92") /* Right */ - PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Button L") - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Button R") - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Button C \xE2\x86\x91") /* Up */ - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("P1 Button C \xE2\x86\x93") /* Down */ - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(1) PORT_NAME("P1 Button C \xE2\x86\x90") /* Left */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_PLAYER(1) PORT_NAME("P1 Button C \xE2\x86\x92") /* Right */ - - PORT_START("P1_ANALOG_X") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) - - PORT_START("P1_ANALOG_Y") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) PORT_REVERSE - - PORT_START("P1_MOUSE_X") - PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_X ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START("P1_MOUSE_Y") - PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_Y ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_REVERSE - - //Player 2 - PORT_START("P2") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Button A / Left Click") - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Button B / Right Click") - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Button Z") - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(2) PORT_NAME("P2 Start") - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_NAME("P2 Joypad \xE2\x86\x91") /* Up */ - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 Joypad \xE2\x86\x93") /* Down */ - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad \xE2\x86\x90") /* Left */ - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad \xE2\x86\x92") /* Right */ - PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Button L") - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Button R") - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Button C \xE2\x86\x91") /* Up */ - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Button C \xE2\x86\x93") /* Down */ - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(2) PORT_NAME("P2 Button C \xE2\x86\x90") /* Left */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_PLAYER(2) PORT_NAME("P2 Button C \xE2\x86\x92") /* Right */ - - PORT_START("P2_ANALOG_X") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(2) - - PORT_START("P2_ANALOG_Y") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(2) PORT_REVERSE - - PORT_START("P2_MOUSE_X") - PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_X ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2) - - PORT_START("P2_MOUSE_Y") - PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_Y ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2) PORT_REVERSE - - //Player 3 - PORT_START("P3") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 Button A / Left Click") - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 Button B / Right Click") - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 Button Z") - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(3) PORT_NAME("P3 Start") - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_NAME("P3 Joypad \xE2\x86\x91") /* Up */ - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_NAME("P3 Joypad \xE2\x86\x93") /* Down */ - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad \xE2\x86\x90") /* Left */ - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad \xE2\x86\x92") /* Right */ - PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(3) PORT_NAME("P3 Button L") - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(3) PORT_NAME("P3 Button R") - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(3) PORT_NAME("P3 Button C \xE2\x86\x91") /* Up */ - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(3) PORT_NAME("P3 Button C \xE2\x86\x93") /* Down */ - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(3) PORT_NAME("P3 Button C \xE2\x86\x90") /* Left */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_PLAYER(3) PORT_NAME("P3 Button C \xE2\x86\x92") /* Right */ - - PORT_START("P3_ANALOG_X") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(3) - - PORT_START("P3_ANALOG_Y") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(3) PORT_REVERSE - - PORT_START("P3_MOUSE_X") - PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_X ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(3) - - PORT_START("P3_MOUSE_Y") - PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_Y ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(3) PORT_REVERSE - - //Player 4 - PORT_START("P4") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 Button A / Left Click") - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 Button B / Right Click") - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 Button Z") - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(4) PORT_NAME("P4 Start") - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_NAME("P4 Joypad \xE2\x86\x91") /* Up */ - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_NAME("P4 Joypad \xE2\x86\x93") /* Down */ - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad \xE2\x86\x90") /* Left */ - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad \xE2\x86\x92") /* Right */ - PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(4) PORT_NAME("P4 Button L") - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(4) PORT_NAME("P4 Button R") - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(4) PORT_NAME("P4 Button C \xE2\x86\x91") /* Up */ - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(4) PORT_NAME("P4 Button C \xE2\x86\x93") /* Down */ - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(4) PORT_NAME("P4 Button C \xE2\x86\x90") /* Left */ - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_PLAYER(4) PORT_NAME("P4 Button C \xE2\x86\x92") /* Right */ - - PORT_START("P4_ANALOG_X") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(4) - - PORT_START("P4_ANALOG_Y") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(4) PORT_REVERSE - - PORT_START("P4_MOUSE_X") - PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_X ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(4) - - PORT_START("P4_MOUSE_Y") - PORT_BIT( 0xffff, 0x0000, IPT_MOUSE_Y ) PORT_MINMAX(0x0000,0xffff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(4) PORT_REVERSE - - PORT_START("RESET") - PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Warm Reset") PORT_CODE(KEYCODE_3) - -INPUT_PORTS_END - -#if 0 -/* ?? */ -static const mips3_config config = -{ - 16384, /* code cache size */ - 8192, /* data cache size */ - 62500000 /* system clock */ -}; -#endif - -void n64_mess_state::mempak_format(UINT8* pak) -{ - unsigned char pak_header[] = - { - 0x81,0x01,0x02,0x03, 0x04,0x05,0x06,0x07, 0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f, - 0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17, 0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f, - 0xff,0xff,0xff,0xff, 0x05,0x1a,0x5f,0x13, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x01,0xff, 0x66,0x25,0x99,0xcd, - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0xff,0xff,0xff,0xff, 0x05,0x1a,0x5f,0x13, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x01,0xff, 0x66,0x25,0x99,0xcd, - 0xff,0xff,0xff,0xff, 0x05,0x1a,0x5f,0x13, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x01,0xff, 0x66,0x25,0x99,0xcd, - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0xff,0xff,0xff,0xff, 0x05,0x1a,0x5f,0x13, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x01,0xff, 0x66,0x25,0x99,0xcd, - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, - 0x00,0x71,0x00,0x03, 0x00,0x03,0x00,0x03, 0x00,0x03,0x00,0x03, 0x00,0x03,0x00,0x03 - }; - - for (int i = 0; i < 0x8000; i += 2) - { - pak[i+0] = 0x00; - pak[i+1] = 0x03; - } - memcpy(pak, pak_header, 272); -} - -DEVICE_IMAGE_LOAD_MEMBER(n64_mess_state,n64_cart) -{ - int i, length; - n64_periphs *periphs = machine().device("rcp"); - UINT8 *cart = memregion("user2")->base(); - - if (image.software_entry() == NULL) - { - length = image.fread(cart, 0x4000000); - } - else - { - length = image.get_software_region_length("rom"); - memcpy(cart, image.get_software_region("rom"), length); - } - periphs->cart_length = length; - - if (cart[0] == 0x37 && cart[1] == 0x80) - { - for (i = 0; i < length; i += 4) - { - UINT8 b1 = cart[i + 0]; - UINT8 b2 = cart[i + 1]; - UINT8 b3 = cart[i + 2]; - UINT8 b4 = cart[i + 3]; - cart[i + 0] = b3; - cart[i + 1] = b4; - cart[i + 2] = b1; - cart[i + 3] = b2; - } - } - else - { - for (i = 0; i < length; i += 4) - { - UINT8 b1 = cart[i + 0]; - UINT8 b2 = cart[i + 1]; - UINT8 b3 = cart[i + 2]; - UINT8 b4 = cart[i + 3]; - cart[i + 0] = b4; - cart[i + 1] = b3; - cart[i + 2] = b2; - cart[i + 3] = b1; - } - } - - periphs->m_nvram_image = image; - - logerror("cart length = %d\n", length); - - device_image_interface *battery_image = dynamic_cast(periphs->m_nvram_image); - if(battery_image) - { - //printf("Loading\n"); - UINT8 data[0x30800]; - battery_image->battery_load(data, 0x30800, 0x00); - //memcpy(n64_sram, data, 0x20000); - memcpy(memshare("sram")->ptr(), data, 0x20000); - memcpy(periphs->m_save_data.eeprom, data + 0x20000, 0x800); - memcpy(periphs->m_save_data.mempak[0], data + 0x20800, 0x8000); - memcpy(periphs->m_save_data.mempak[1], data + 0x28800, 0x8000); - } - - if(periphs->m_save_data.mempak[0][0] == 0) // Init if new - { - memset(periphs->m_save_data.eeprom, 0, 0x800); - mempak_format(periphs->m_save_data.mempak[0]); - mempak_format(periphs->m_save_data.mempak[1]); - } - - return IMAGE_INIT_PASS; -} - -MACHINE_START_MEMBER(n64_mess_state,n64dd) -{ - machine_start(); - machine().device("rcp")->dd_present = true; - UINT8 *ipl = memregion("ddipl")->base(); - - for (int i = 0; i < 0x400000; i += 4) - { - UINT8 b1 = ipl[i + 0]; - UINT8 b2 = ipl[i + 1]; - UINT8 b3 = ipl[i + 2]; - UINT8 b4 = ipl[i + 3]; - ipl[i + 0] = b1; - ipl[i + 1] = b2; - ipl[i + 2] = b3; - ipl[i + 3] = b4; - } -} - -QUICKLOAD_LOAD_MEMBER(n64_mess_state,n64dd) -{ - return quickload(image, file_type, quickload_size); -} - -int n64_mess_state::quickload(device_image_interface &image, const char *file_type, int quickload_size) -{ - image.fseek(0, SEEK_SET); - image.fread(memregion("disk")->base(), quickload_size); - machine().device("rcp")->disk_present = true; - return IMAGE_INIT_PASS; -} - - -INTERRUPT_GEN_MEMBER(n64_mess_state::n64_reset_poll) -{ - n64_periphs *periphs = machine().device("rcp"); - periphs->poll_reset_button((ioport("RESET")->read() & 1) ? true : false); -} - -static MACHINE_CONFIG_START( n64, n64_mess_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", VR4300BE, 93750000) - MCFG_FORCE_NO_DRC() - MCFG_CPU_CONFIG(config) - MCFG_CPU_PROGRAM_MAP(n64_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", n64_mess_state, n64_reset_poll) - - MCFG_CPU_ADD("rsp", RSP, 62500000) - MCFG_RSP_DP_REG_R_CB(DEVREAD32("rcp",n64_periphs, dp_reg_r)) - MCFG_RSP_DP_REG_W_CB(DEVWRITE32("rcp",n64_periphs, dp_reg_w)) - MCFG_RSP_SP_REG_R_CB(DEVREAD32("rcp",n64_periphs, sp_reg_r)) - MCFG_RSP_SP_REG_W_CB(DEVWRITE32("rcp",n64_periphs, sp_reg_w)) - MCFG_RSP_SP_SET_STATUS_CB(DEVWRITE32("rcp",n64_periphs, sp_set_status)) - MCFG_CPU_PROGRAM_MAP(rsp_map) - - MCFG_QUANTUM_TIME(attotime::from_hz(500000)) - //MCFG_QUANTUM_TIME(attotime::from_hz(1200)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - /* Video DACRATE is for quarter pixels, so the horizontal is also given in quarter pixels. However, the horizontal and vertical timing and sizing is adjustable by register and will be reset when the registers are written. */ - MCFG_SCREEN_RAW_PARAMS(DACRATE_NTSC*2,3093,0,3093,525,0,525) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - //MCFG_SCREEN_SIZE(640, 525) - //MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) - MCFG_SCREEN_UPDATE_DRIVER(n64_state, screen_update_n64) - MCFG_SCREEN_VBLANK_DRIVER(n64_state, screen_eof_n64) - - MCFG_PALETTE_ADD("palette", 0x1000) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD("dac2", DMADAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ADD("dac1", DMADAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) - - MCFG_N64_PERIPHS_ADD("rcp"); - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "n64_cart") - MCFG_GENERIC_EXTENSIONS("v64,z64,rom,n64,bin") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(n64_mess_state, n64_cart) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "n64") - - MCFG_FORCE_NO_DRC() -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( n64dd, n64 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(n64dd_map) - - MCFG_MACHINE_START_OVERRIDE(n64_mess_state, n64dd) - - MCFG_DEVICE_REMOVE("cartslot") - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "n64_cart") - MCFG_GENERIC_EXTENSIONS("v64,z64,rom,n64,bin") - MCFG_GENERIC_LOAD(n64_mess_state, n64_cart) - - MCFG_QUICKLOAD_ADD("quickload", n64_mess_state, n64dd, "bin,dsk", 0) - MCFG_QUICKLOAD_INTERFACE("n64dd_disk") - - MCFG_SOFTWARE_LIST_ADD("dd_list", "n64dd") -MACHINE_CONFIG_END - -ROM_START( n64 ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for R4300 */ - - ROM_REGION32_BE( 0x800, "user1", 0 ) - ROM_LOAD( "pifdata.bin", 0x0000, 0x0800, CRC(5ec82be9) SHA1(9174eadc0f0ea2654c95fd941406ab46b9dc9bdd) ) - - ROM_REGION32_BE( 0x4000000, "user2", ROMREGION_ERASEFF) - - ROM_REGION16_BE( 0x80, "normpoint", 0 ) - ROM_LOAD( "normpnt.rom", 0x00, 0x80, CRC(e7f2a005) SHA1(c27b4a364a24daeee6e99fd286753fd6216362b4) ) - - ROM_REGION16_BE( 0x80, "normslope", 0 ) - ROM_LOAD( "normslp.rom", 0x00, 0x80, CRC(4f2ae525) SHA1(eab43f8cc52c8551d9cff6fced18ef80eaba6f05) ) -ROM_END - -ROM_START( n64dd ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for R4300 */ - - ROM_REGION32_BE( 0x800, "user1", 0 ) - ROM_LOAD( "pifdata.bin", 0x0000, 0x0800, CRC(5ec82be9) SHA1(9174eadc0f0ea2654c95fd941406ab46b9dc9bdd) ) - - ROM_REGION32_BE( 0x4000000, "user2", ROMREGION_ERASEFF) - - ROM_REGION32_BE( 0x400000, "ddipl", ROMREGION_ERASEFF) - ROM_LOAD( "64ddipl.bin", 0x000000, 0x400000, CRC(7f933ce2) SHA1(bf861922dcb78c316360e3e742f4f70ff63c9bc3) ) - - ROM_REGION32_LE( 0x4400000, "disk", ROMREGION_ERASEFF) - - ROM_REGION16_BE( 0x80, "normpoint", 0 ) - ROM_LOAD( "normpnt.rom", 0x00, 0x80, CRC(e7f2a005) SHA1(c27b4a364a24daeee6e99fd286753fd6216362b4) ) - - ROM_REGION16_BE( 0x80, "normslope", 0 ) - ROM_LOAD( "normslp.rom", 0x00, 0x80, CRC(4f2ae525) SHA1(eab43f8cc52c8551d9cff6fced18ef80eaba6f05) ) -ROM_END - -CONS(1996, n64, 0, 0, n64, n64, driver_device, 0, "Nintendo", "Nintendo 64", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -CONS(1996, n64dd, n64, 0, n64dd, n64, driver_device, 0, "Nintendo", "Nintendo 64DD", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/nakajies.c b/src/mess/drivers/nakajies.c deleted file mode 100644 index 29b2ba35af8..00000000000 --- a/src/mess/drivers/nakajies.c +++ /dev/null @@ -1,835 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol,Sandro Ronco -/****************************************************************************** - - Driver for the ES-2xx series electronic typewriters made by Nakajima. - -Nakajima was the OEM manufacturer for a series of typewriters which were -sold by different brands around the world. The PCB layouts for these -machines are the same. The models differed in the amount of (static) RAM: -128KB or 256KB; and in the system rom (mainly only different language -support). - - -Model | SRAM | Language | Branded model ---------+-------+----------+---------------------- -ES-210N | 128KB | German | Walther ES-210 -ES-220 | 128KB | English | NTS DreamWriter T100 -ES-220 | 256KB | English | NTS DreamWriter T400 -ES-210N | 128KB | Spanish | Dator 3000 -ES-210N | 128KB | English | NTS DreamWriter 325 -ES-250 | xxxKB | English | NTS DreamWriter T200 - - -The LCD is driven by 6x Sanyo LC7940 and 1x Sanyo LC7942. - - -The keyboard matrix: - - | | | | | | | | | - | | | | | | | | | --- LSHIFT -- ----- LEFT --- ENTER -- -- -- -- RSHIFT -- --- - | | | | | | | | | --- 3 ------- Q ----- W ------ E ------ S -- D -- -- 2 ------- --- - | | | | | | | | | --- 4 ------- Z ----- X ------ A ------ R -- F -- -- ------- --- - | | | | | | | | | --- ------- B ----- V ------ T ------ G -- C -- Y -- ------- --- - | | | | | | | | | --- CTRL ---- 1 ----- TAB ---- ------ -- -- -- CAPS ---- --- - | | | | | | | | | --- ALT ----- CAN --- SPACE -- ------ 5 -- -- -- ` ------- --- - | | | | | | | | | --- ------- INS --- RIGHT -- \ ------ H -- N -- / -- DOWN ---- 6 --- - | | | | | | | | | --- ------- ORGN -- UP ----- WP ----- M -- K -- U -- 7 ------- = --- - | | | | | | | | | --- ------- ] ----- [ ------ ' ------ J -- , -- I -- - ------- 8 --- - | | | | | | | | | --- ------- BACK -- P ------ ; ------ O -- . -- L -- 9 ------- 0 --- - | | | | | | | | | - | | | | | | | | | - - - -NTS information from http://web.archive.org/web/19980205154137/nts.dreamwriter.com/dreamwt4.html: - -File Management & Memory: - -- Uniquely name up to 128 files -- Recall, rename or delete files -- Copy files to and from PCMCIA Memory card -- PCMCIA Memory expansion cards available for 60 or 250 pages of text -- Working memory allows up to 20 pages of text (50KB) to be displayed -- Storage memory allows up to 80 pages of text (128KB) in total -- DreamLink software exports and imports documents in RTF retaining all - formatting to Macintosh or Windows PC to all commonly used Word Processing programs -- Transfer cable provided compatible to both Macintosh and Windows PC's. -- T400 is field upgradeable to IR with the optional Infrared module. - -Hardware: - -- LCD Screen displays 8 lines by 80 characters raised and tilted 30 degrees -- Contrast Dial and feet adjust to user preference -- Parallel and Serial ports( IR Upgrade Optional) for connectivity to printers, Macintosh and Windows PC's -- Full size 64 key keyboard with color coded keys and quick reference menu bar -- NiCad rechargeable batteries for up to 8 hours of continuous use prior to recharging -- AC adapter for recharging batteries is lightweight and compact design -- NEC V20HL 9.83 MHz processor for fast response time -- Durable solid state construction weighing 2.2 lbs including battery pack -- Dimensions approximately 11" wide by 8" long by 1" deep -- FCC and CSA approved - - -I/O Map: - -0000 - unknown - 0x00 written during boot sequence - -0010 - unknown - 0x17 written during boot sequence - -0011 - unknown - 0x1e written during boot sequence - -0012 - unknown - 0x1f written during boot sequence - -0013 - unknown - 0x1e written during boot sequence - -0014 - unknown - 0x1d written during boot sequence - -0015 - unknown - 0x1c written during boot sequence - -0012-0015 - banking? -T200: -Time: 15 - 02; call ADxxx -Database: 15 - 02; call B3xxx -Spreadsheet: 15 - 02; call B9xxx - -T450: -Regular boot: 12 - 1f; 13 - 1e; 14 - 1d; 15 - 1c -Typing game: 15 - 02; call B100:0; -Edit Text: 12 - 07; 13 - 06; 14 - 05; 15 - 04; call 4000:0000 -c000:0000 - ffff:ffff = not banked? - -T400, wales210: -Regular boot: 12 - 1f; 13 - 1e; 14 - 1d; 15 - 1c -Next step during boot: 12 - 17; 13 - 3; 14 - 2; jump to 3000:0000 -writing 17 to port 12 maps rom offset 30000 to 3000:0000? - -1f, 1e, 1d, 1c is banked RAM ?? - -banking possibility: -0010-0017 - control banking: -0010 - 00000 - 1ffff -0011 - 20000 - 3ffff -0012 - 40000 - 5ffff -0013 - 60000 - 7ffff -0014 - 80000 - 9ffff -0015 - a0000 - bffff -0016 - c0000 - dffff -0017 - e0000 - fffff - -values 00-0f select a rom bank - 00 - selects last 20000h region of rom - 01 - 20000h region before last - 02 - etc - -values 10-1f select a ram bank - -on reset 0017 is set to 0, pointing to last 20000h bytes of ROM containing the boot setup code - - -0016 - unknown - 0x01 written during boot sequence - -0017 - unknown - 0x00 written during boot sequence - -0020 - unknown - 0x00 written during boot sequence - -0030 - unknown - Looking at code at C0769 bit 5 this seems to be used - as some kind of clock for data that was written to - I/O port 0040h. - -0040 - unknown - 0xff written during boot sequence - -Sounds related? -On boot: 50 = 98, 51 = 06, 52 = 7f - 52 = ff - 50 - 26, 51 = 01, 52 = 7f - 52 = ff - (mem check) - 50 = 98, 51 = 06, 52 = 7f - 52 = ff - 50 = 74, 51 = 04, 52 = 7f - 52 = ff - 50 = 98, 51 = 06, 52 = 7f - 52 = ff - (menu) - (type 1 - medium frequency sound ) - 50 = 5d, 51 = 01, 52 = 7f - 52 = ff - 52 = ff - 52 = ff - 50 = 00, 51 = 01, 52 = 7f - 52 = ff - (type 2 - simple lower sound) - 50 = ba, 51 = 02, 52 = 7f - 52 = ff - (type 3 - highest frequency sound) - 50 = 26, 51 = 01, 52 = 7f - 52 = ff - 50 = 06, 51 = 01, 52 = 7f - 52 = ff - 50 = e9, 51 = 00, 52 = 7f - 52 = ff - 50 = dc, 51 = 00, 52 = 7f - 52 = ff - 50 = c4, 51 = 00, 52 = 7f - 52 = ff -0050 - counter low? -0051 - counter high? -0052 - counter enable/disable? - -0060 - Irq enable/disable (?) - 0xff written at start of boot sequence - 0x7e written just before enabling interrupts - -0061 - unknown - 0xFE written in irq 0xFB handler - -0070 - uknown 0x01 is written when going to terminal mode (enable rs232 receive?) - -0090 - Interrupt source clear - b7 - 1 = clear interrupt source for irq vector 0xf8 - b6 - 1 = clear interrupt source for irq vector 0xf9 - b5 - 1 = clear interrupt source for irq vector 0xfa - b4 - 1 = clear interrupt source for irq vector 0xfb - b3 - 1 = clear interrupt source for irq vector 0xfc - b2 - 1 = clear interrupt source for irq vector 0xfd - b1 - 1 = clear interrupt source for irq vector 0xfe - b0 - 1 = clear interrupt source for irq vector 0xff - -00A0 - unknown - Read during initial boot sequence, expects to have bit 3 set at least once durnig the boot sequence - -00D0 - 00DC - Keyboard?? - -00DD - unknown - 0xf8 written during boot sequence - -00DE - unknown - 0xf0 written during boot sequence - - -IRQ 0xF8: -The handler clears the irq active bit and copies a word from 6D79 to 6D85 and -from 6D7B to 6D87 then enters an endless loop (with interrupts disabled). -Perhaps power on/off related?? - - -IRQ 0xF9: (T400: C049A) -Purpose unknown. IRQ handler clear bit 0 of 6DA9. - - -IRQ 0xFA: (T400: C04AE) -Purpose unknown. Expects 6D4F to be set up properly. Enables irq 0xFD. Reads -from input port 0xB0 and resets and sets bit 0 of output port 0x61. - - -IRQ 0xFB: (T400: C04D1) -Purpose unknown. Reads from input port 0xB0, sets bit 7 of 6D28 when -non-zero data was read. - - -IRQ 0xFC: (T400: C0550) -Purpose unknown. Reads from input port 0xC1 and 0xC0 and possibly outputs -something to output port 0xC1 depending on data read from 0xC1. - - -IRQ 0xFD: (T400: C0724) -Purpose unknown. Clears bit 3 of 70A5. - - -IRQ 0xFE: (T400: C0738) -Purpose unknown. Expects 6D4F to be set up properly. Enables irq 0xf9 or outputs -a byte to ports 0x40 and 0x30. No endless loop. - - -IRQ 0xFF: -This does some simple processing and then enters an endless loop (with interrupts -disabled). Perhaps power on/off related?? - -******************************************************************************/ - - -#include "emu.h" -#include "cpu/nec/nec.h" -#include "machine/rp5c01.h" -#include "sound/speaker.h" -#include "rendlay.h" - - -#define LOG 0 - - -class nakajies_state : public driver_device -{ -public: - nakajies_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "v20hl") - {} - - required_device m_maincpu; - - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void nakajies_update_irqs(); - DECLARE_READ8_MEMBER( irq_clear_r ); - DECLARE_WRITE8_MEMBER( irq_clear_w ); - DECLARE_READ8_MEMBER( irq_enable_r ); - DECLARE_WRITE8_MEMBER( irq_enable_w ); - DECLARE_READ8_MEMBER( unk_a0_r ); - DECLARE_WRITE8_MEMBER( lcd_memory_start_w ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_WRITE8_MEMBER( banking_w ); - void update_banks(); - void bank_w(UINT8 banknr, offs_t offset, UINT8 data); - DECLARE_WRITE8_MEMBER( bank0_w ); - DECLARE_WRITE8_MEMBER( bank1_w ); - DECLARE_WRITE8_MEMBER( bank2_w ); - DECLARE_WRITE8_MEMBER( bank3_w ); - DECLARE_WRITE8_MEMBER( bank4_w ); - DECLARE_WRITE8_MEMBER( bank5_w ); - DECLARE_WRITE8_MEMBER( bank6_w ); - DECLARE_WRITE8_MEMBER( bank7_w ); - - /* IRQ handling */ - UINT8 m_irq_enabled; - UINT8 m_irq_active; - - UINT8 m_lcd_memory_start; - UINT8* m_ram_base1; - - UINT8 m_matrix; - - /* ROM */ - UINT8 *m_rom_base; - UINT32 m_rom_size; - - /* RAM */ - UINT8 *m_ram_base; - UINT32 m_ram_size; - - /* Banking */ - UINT8 m_bank[8]; - UINT8 *m_bank_base[8]; - DECLARE_PALETTE_INIT(nakajies); - DECLARE_INPUT_CHANGED_MEMBER(trigger_irq); - TIMER_DEVICE_CALLBACK_MEMBER(kb_timer); -}; - - -#define X301 19660000 - - -void nakajies_state::update_banks() -{ - for( int i = 0; i < 8; i++ ) - { - if ( m_bank[i] & 0x10 ) - { - /* RAM banking */ - /* Not entirely sure if bank 0x1f refers to first or second ram bank ... */ - m_bank_base[i] = m_ram_base + ( ( ( ( m_bank[i] & 0x0f ) ^ 0xf ) << 17 ) % m_ram_size ); - } - else - { - /* ROM banking */ - /* 0 is last bank, 1 bank before last, etc */ - m_bank_base[i] = m_rom_base + ( ( ( ( m_bank[i] & 0x0f ) ^ 0xf ) << 17 ) % m_rom_size ); - } - } - membank( "bank0" )->set_base( m_bank_base[0] ); - membank( "bank1" )->set_base( m_bank_base[1] ); - membank( "bank2" )->set_base( m_bank_base[2] ); - membank( "bank3" )->set_base( m_bank_base[3] ); - membank( "bank4" )->set_base( m_bank_base[4] ); - membank( "bank5" )->set_base( m_bank_base[5] ); - membank( "bank6" )->set_base( m_bank_base[6] ); - membank( "bank7" )->set_base( m_bank_base[7] ); -} - -void nakajies_state::bank_w( UINT8 banknr, offs_t offset, UINT8 data ) -{ - if ( m_bank[banknr] & 0x10 ) - { - m_bank_base[banknr][offset] = data; - } -} - -WRITE8_MEMBER( nakajies_state::bank0_w ) { bank_w( 0, offset, data ); } -WRITE8_MEMBER( nakajies_state::bank1_w ) { bank_w( 1, offset, data ); } -WRITE8_MEMBER( nakajies_state::bank2_w ) { bank_w( 2, offset, data ); } -WRITE8_MEMBER( nakajies_state::bank3_w ) { bank_w( 3, offset, data ); } -WRITE8_MEMBER( nakajies_state::bank4_w ) { bank_w( 4, offset, data ); } -WRITE8_MEMBER( nakajies_state::bank5_w ) { bank_w( 5, offset, data ); } -WRITE8_MEMBER( nakajies_state::bank6_w ) { bank_w( 6, offset, data ); } -WRITE8_MEMBER( nakajies_state::bank7_w ) { bank_w( 7, offset, data ); } - - -static ADDRESS_MAP_START( nakajies_map, AS_PROGRAM, 8, nakajies_state ) - AM_RANGE( 0x00000, 0x1ffff ) AM_READ_BANK( "bank0" ) AM_WRITE( bank0_w ) - AM_RANGE( 0x20000, 0x3ffff ) AM_READ_BANK( "bank1" ) AM_WRITE( bank1_w ) - AM_RANGE( 0x40000, 0x5ffff ) AM_READ_BANK( "bank2" ) AM_WRITE( bank2_w ) - AM_RANGE( 0x60000, 0x7ffff ) AM_READ_BANK( "bank3" ) AM_WRITE( bank3_w ) - AM_RANGE( 0x80000, 0x9ffff ) AM_READ_BANK( "bank4" ) AM_WRITE( bank4_w ) - AM_RANGE( 0xa0000, 0xbffff ) AM_READ_BANK( "bank5" ) AM_WRITE( bank5_w ) - AM_RANGE( 0xc0000, 0xdffff ) AM_READ_BANK( "bank6" ) AM_WRITE( bank6_w ) - AM_RANGE( 0xe0000, 0xfffff ) AM_READ_BANK( "bank7" ) AM_WRITE( bank7_w ) -ADDRESS_MAP_END - - -/********************************************* - IRQ Handling -*********************************************/ - -void nakajies_state::nakajies_update_irqs() -{ - // Hack: IRQ mask is temporarily disabled because doesn't allow the IRQ vector 0xFA - // and 0xFB that are used for scan the kb, this need further investigation. - UINT8 irq = m_irq_active; // & m_irq_enabled; - UINT8 vector = 0xff; - - if (LOG) - logerror("nakajies_update_irqs: irq_enabled = %02x, irq_active = %02x\n", m_irq_enabled, m_irq_active ); - - /* Assuming irq 0xFF has the highest priority and 0xF8 the lowest */ - while( vector >= 0xf8 && ! ( irq & 0x01 ) ) - { - irq >>= 1; - vector -= 1; - } - - if ( vector >= 0xf8 ) - { - m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, vector ); - } - else - { - m_maincpu->set_input_line(0, CLEAR_LINE ); - } -} - - -READ8_MEMBER( nakajies_state::irq_clear_r ) -{ - return 0x00; -} - - -WRITE8_MEMBER( nakajies_state::irq_clear_w ) -{ - m_irq_active &= ~data; - nakajies_update_irqs(); -} - - -READ8_MEMBER( nakajies_state::irq_enable_r ) -{ - return m_irq_enabled; -} - - -WRITE8_MEMBER( nakajies_state::irq_enable_w ) -{ - m_irq_enabled = data; - nakajies_update_irqs(); -} - - -/* - I/O Port a0: - bit 7-4 - unknown - bit 3 - battery low (when set) - bit 2-0 - unknown -*/ -READ8_MEMBER( nakajies_state::unk_a0_r ) -{ - return 0xf7; -} - -WRITE8_MEMBER( nakajies_state::lcd_memory_start_w ) -{ - m_lcd_memory_start = data; -} - - -WRITE8_MEMBER( nakajies_state::banking_w ) -{ - m_bank[offset] = data; - update_banks(); -} - - -READ8_MEMBER( nakajies_state::keyboard_r ) -{ - static const char *const bitnames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", - "ROW5", "ROW6", "ROW7", "ROW8", "ROW9" }; - - return (m_matrix > 0x00) ? ioport(bitnames[m_matrix - 1])->read() : 0; -} - - -static ADDRESS_MAP_START( nakajies_io_map, AS_IO, 8, nakajies_state ) - AM_RANGE( 0x0000, 0x0000 ) AM_WRITE( lcd_memory_start_w ) - AM_RANGE( 0x0010, 0x0017 ) AM_WRITE( banking_w ) - AM_RANGE( 0x0060, 0x0060 ) AM_READWRITE( irq_enable_r, irq_enable_w ) - AM_RANGE( 0x0090, 0x0090 ) AM_READWRITE( irq_clear_r, irq_clear_w ) - AM_RANGE( 0x00a0, 0x00a0 ) AM_READ( unk_a0_r ) - AM_RANGE( 0x00b0, 0x00b0 ) AM_READ( keyboard_r ) - AM_RANGE( 0x00d0, 0x00df ) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) -ADDRESS_MAP_END - - -INPUT_CHANGED_MEMBER(nakajies_state::trigger_irq) -{ - UINT8 irqs = ioport( "debug" )->read(); - - m_irq_active |= irqs; - nakajies_update_irqs(); -} - - -static INPUT_PORTS_START( nakajies ) - PORT_START( "debug" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F1 ) PORT_NAME( "irq 0xff" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F2 ) PORT_NAME( "irq 0xfe" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F3 ) PORT_NAME( "irq 0xfd" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F4 ) PORT_NAME( "irq 0xfc" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F5 ) PORT_NAME( "irq 0xfb" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F6 ) PORT_NAME( "irq 0xfa" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F7 ) PORT_NAME( "irq 0xf9" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F8 ) PORT_NAME( "irq 0xf8" ) PORT_CHANGED_MEMBER(DEVICE_SELF, nakajies_state, trigger_irq, NULL ) - - PORT_START( "ROW0" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE( KEYCODE_LSHIFT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE( KEYCODE_RSHIFT ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT") PORT_CODE( KEYCODE_LEFT ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE( KEYCODE_ENTER ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "ROW1" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE( KEYCODE_LALT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("`") PORT_CODE( KEYCODE_BACKSLASH2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAN") PORT_CODE( KEYCODE_ESC ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE( KEYCODE_SPACE ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE( KEYCODE_5 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "ROW2" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE( KEYCODE_LCONTROL ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPSLOCK") PORT_CODE( KEYCODE_CAPSLOCK ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE( KEYCODE_1 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE( KEYCODE_TAB ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "ROW3" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE( KEYCODE_3 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE( KEYCODE_2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE( KEYCODE_Q ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE( KEYCODE_W ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE( KEYCODE_E ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE( KEYCODE_S ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE( KEYCODE_D ) - - PORT_START( "ROW4" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE( KEYCODE_4 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE( KEYCODE_Z ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE( KEYCODE_X ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE( KEYCODE_A ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE( KEYCODE_R ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE( KEYCODE_F ) - - PORT_START( "ROW5" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE( KEYCODE_B ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE( KEYCODE_V ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE( KEYCODE_T ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE( KEYCODE_Y ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE( KEYCODE_G ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE( KEYCODE_C ) - - PORT_START( "ROW6" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE( KEYCODE_6 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE( KEYCODE_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INSERT") PORT_CODE( KEYCODE_INSERT ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE( KEYCODE_RIGHT ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\") PORT_CODE( KEYCODE_BACKSLASH ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE( KEYCODE_SLASH ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE( KEYCODE_H ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE( KEYCODE_N ) - - PORT_START( "ROW7" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("=") PORT_CODE( KEYCODE_EQUALS ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE( KEYCODE_7 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ORGN") PORT_CODE( KEYCODE_PGUP ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE( KEYCODE_UP ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("WP") PORT_CODE( KEYCODE_PGDN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE( KEYCODE_U ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE( KEYCODE_M ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE( KEYCODE_K ) - - PORT_START( "ROW8" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE( KEYCODE_8 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE( KEYCODE_MINUS ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE( KEYCODE_CLOSEBRACE ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE( KEYCODE_OPENBRACE ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\'") PORT_CODE( KEYCODE_QUOTE ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE( KEYCODE_I ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE( KEYCODE_J ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE( KEYCODE_COMMA ) - - PORT_START( "ROW9" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE( KEYCODE_0 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE( KEYCODE_9 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BACK") PORT_CODE( KEYCODE_BACKSPACE ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE( KEYCODE_P ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE( KEYCODE_COLON ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE( KEYCODE_L ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE( KEYCODE_O ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE( KEYCODE_STOP ) -INPUT_PORTS_END - - -void nakajies_state::machine_start() -{ - m_rom_base = memregion("bios")->base(); - m_rom_size = memregion("bios")->bytes(); - - const char *gamename = machine().system().name; - - m_ram_size = 128 * 1024; - if ( strcmp( gamename, "drwrt400" ) == 0 || strcmp( gamename, "drwrt200" ) == 0 ) - { - m_ram_size = 256 * 1024; - } - m_ram_base = machine().memory().region_alloc( "mainram", m_ram_size, 1, ENDIANNESS_LITTLE )->base(); -} - - -void nakajies_state::machine_reset() -{ - m_irq_enabled = 0; - m_irq_active = 0; - m_lcd_memory_start = 0; - m_matrix = 0; - - /* Initialize banks */ - for ( int i = 0; i < 8; i++ ) - { - m_bank[i] = 0; - } - memset(m_ram_base, 0, m_ram_size); - update_banks(); -} - -UINT32 nakajies_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8* lcd_memory_start = m_ram_base + (m_lcd_memory_start<<9); - int height = screen.height(); - - for (int y=0; y 0x09) - { - // reset the keyboard scan - m_matrix = 0; - m_irq_active |= 0x20; - } - else - { - // next row - m_matrix++; - m_irq_active |= 0x10; - } - - nakajies_update_irqs(); -} - - -PALETTE_INIT_MEMBER(nakajies_state, nakajies) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - - -/* F4 Character Displayer */ -static const gfx_layout nakajies_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 2331, /* 2331 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( wales210 ) - GFXDECODE_ENTRY( "bios", 0x55043, nakajies_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( dator3k ) - GFXDECODE_ENTRY( "bios", 0x54fb1, nakajies_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( drwrt200 ) - GFXDECODE_ENTRY( "bios", 0xdbbeb, nakajies_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( drwrt400 ) - GFXDECODE_ENTRY( "bios", 0x580b6, nakajies_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( nakajies210, nakajies_state ) - MCFG_CPU_ADD( "v20hl", V20, X301 / 2 ) - MCFG_CPU_PROGRAM_MAP( nakajies_map) - MCFG_CPU_IO_MAP( nakajies_io_map) - - MCFG_SCREEN_ADD( "screen", LCD ) - MCFG_SCREEN_REFRESH_RATE( 50 ) /* Wild guess */ - MCFG_SCREEN_UPDATE_DRIVER( nakajies_state, screen_update ) - MCFG_SCREEN_SIZE( 80 * 6, 8 * 8 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 6 * 80 - 1, 0, 8 * 8 - 1 ) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", wales210) - MCFG_PALETTE_ADD( "palette", 2 ) - MCFG_PALETTE_INIT_OWNER(nakajies_state, nakajies) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* sound */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "speaker", SPEAKER_SOUND, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - /* rtc */ - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer", nakajies_state, kb_timer, attotime::from_hz(250)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dator3k, nakajies210 ) - MCFG_GFXDECODE_MODIFY("gfxdecode", dator3k) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nakajies220, nakajies210 ) - MCFG_GFXDECODE_MODIFY("gfxdecode", drwrt400) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nakajies250, nakajies210 ) - MCFG_SCREEN_MODIFY( "screen" ) - MCFG_SCREEN_SIZE( 80 * 6, 16 * 8 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 6 * 80 - 1, 0, 16 * 8 - 1 ) - MCFG_GFXDECODE_MODIFY("gfxdecode", drwrt200) -MACHINE_CONFIG_END - - -ROM_START(wales210) - ROM_REGION( 0x80000, "bios", 0 ) - - ROM_SYSTEM_BIOS( 0, "wales210", "Walther ES-210" ) - ROMX_LOAD("wales210.ic303", 0x00000, 0x80000, CRC(a8e8d991) SHA1(9a133b37b2fbf689ae1c7ab5c7f4e97cd33fd596), ROM_BIOS(1)) /* 27c4001 */ - - ROM_SYSTEM_BIOS( 1, "drwrtr325", "NTS DreamWriter 325" ) - ROMX_LOAD("dr3_1_02uk.ic303", 0x00000, 0x80000, CRC(027db9fe) SHA1(eb52a30510f2e2924c6dae9bc4348cd3572f4997), ROM_BIOS(2)) -ROM_END - - -ROM_START(dator3k) - ROM_REGION( 0x80000, "bios", 0 ) - ROM_LOAD("dator3000.ic303", 0x00000, 0x80000, CRC(b67fffeb) SHA1(e48270d15bef9453bcb6ba8aa949fd2ab3feceed)) -ROM_END - - -ROM_START(drwrt100) - ROM_REGION( 0x80000, "bios", 0 ) - ROM_LOAD("t100_2.3.ic303", 0x00000, 0x80000, CRC(8a16f12f) SHA1(0a907186db3d1756566d767ee847a7ecf694e74b)) /* Checksum 01F5 on label */ -ROM_END - - -ROM_START(drwrt200) - ROM_REGION( 0x100000, "bios", 0 ) - ROM_LOAD("drwrt200.bin", 0x000000, 0x100000, CRC(3c39483c) SHA1(48293e6bdb7e7322d76da7174b716243c0ab7c2c) ) -ROM_END - - -ROM_START(drwrt400) - ROM_REGION( 0x80000, "bios", 0 ) - ROM_LOAD("t4_ir_2.1.ic303", 0x00000, 0x80000, CRC(f0f45fd2) SHA1(3b4d5722b3e32e202551a1be8ae36f34ad705ddd)) -ROM_END - - -ROM_START(drwrt450) - ROM_REGION( 0x100000, "bios", 0 ) - ROM_LOAD("t4_ir_35ba308.ic303", 0x00000, 0x100000, CRC(3b5a580d) SHA1(72df34ece1e6d70adf953025d1c458e22ce819e1)) -ROM_END - - -ROM_START( es210_es ) - ROM_REGION( 0x80000, "bios", 0 ) - ROM_LOAD("nakajima_es.ic303", 0x00000, 0x80000, CRC(214d73ce) SHA1(ce9967c5b2d122ebebe9401278d8ea374e8fb289)) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 199?, wales210, 0, 0, nakajies210, nakajies, driver_device, 0, "Walther", "ES-210", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* German, 128KB RAM */ -COMP( 199?, dator3k, wales210, 0, dator3k, nakajies, driver_device, 0, "Dator", "Dator 3000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* Spanish, 128KB RAM */ -COMP( 199?, es210_es, wales210, 0, nakajies210, nakajies, driver_device, 0, "Nakajima","ES-210 (Spain)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* Spanish, 128KB RAM */ -COMP( 199?, drwrt100, wales210, 0, nakajies220, nakajies, driver_device, 0, "NTS", "DreamWriter T100", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* English, 128KB RAM */ -COMP( 1996, drwrt400, wales210, 0, nakajies220, nakajies, driver_device, 0, "NTS", "DreamWriter T400", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* English, 256KB RAM */ -COMP( 199?, drwrt450, wales210, 0, nakajies220, nakajies, driver_device, 0, "NTS", "DreamWriter 450", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* English, 128KB RAM */ -COMP( 199?, drwrt200, wales210, 0, nakajies250, nakajies, driver_device, 0, "NTS", "DreamWriter T200", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) /* English, 256KB? RAM */ diff --git a/src/mess/drivers/nanos.c b/src/mess/drivers/nanos.c deleted file mode 100644 index 6552b696a98..00000000000 --- a/src/mess/drivers/nanos.c +++ /dev/null @@ -1,544 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Nanos - - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "machine/z80ctc.h" -#include "machine/upd765.h" -#include "formats/nanos_dsk.h" -#include "machine/ram.h" - - -class nanos_state : public driver_device -{ -public: - nanos_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pio(*this, "z80pio"), - m_pio_0(*this, "z80pio_0"), - m_pio_1(*this, "z80pio_1"), - m_sio_0(*this, "z80sio_0"), - m_sio_1(*this, "z80sio_1"), - m_ctc_0(*this, "z80ctc_0"), - m_ctc_1(*this, "z80ctc_1"), - m_fdc(*this, "upd765"), - m_key_t(*this, "keyboard_timer"), - m_ram(*this, RAM_TAG), - m_region_maincpu(*this, "maincpu"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1"), - m_line2(*this, "LINE2"), - m_line3(*this, "LINE3"), - m_line4(*this, "LINE4"), - m_line5(*this, "LINE5"), - m_line6(*this, "LINE6"), - m_linec(*this, "LINEC") - { } - - required_device m_maincpu; - required_device m_pio; - required_device m_pio_0; - required_device m_pio_1; - required_device m_sio_0; - required_device m_sio_1; - required_device m_ctc_0; - required_device m_ctc_1; - required_device m_fdc; - required_device m_key_t; - required_device m_ram; - const UINT8 *m_p_chargen; - UINT8 m_key_command; - UINT8 m_last_code; - UINT8 m_key_pressed; - DECLARE_WRITE8_MEMBER( nanos_tc_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); - virtual void machine_reset(); - virtual void machine_start(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); - DECLARE_WRITE_LINE_MEMBER(z80daisy_interrupt); - DECLARE_READ8_MEMBER(nanos_port_a_r); - DECLARE_READ8_MEMBER(nanos_port_b_r); - DECLARE_WRITE8_MEMBER(nanos_port_b_w); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - -protected: - required_memory_region m_region_maincpu; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_ioport m_line0; - required_ioport m_line1; - required_ioport m_line2; - required_ioport m_line3; - required_ioport m_line4; - required_ioport m_line5; - required_ioport m_line6; - required_ioport m_linec; - UINT8 row_number(UINT8 code); -}; - - - -static ADDRESS_MAP_START(nanos_mem, AS_PROGRAM, 8, nanos_state) - AM_RANGE( 0x0000, 0x0fff ) AM_READ_BANK("bank1") AM_WRITE_BANK("bank3") - AM_RANGE( 0x1000, 0xffff ) AM_RAMBANK("bank2") -ADDRESS_MAP_END - -WRITE8_MEMBER(nanos_state::nanos_tc_w) -{ - m_fdc->tc_w(BIT(data,1)); -} - - -/* Z80-CTC Interface */ - -WRITE_LINE_MEMBER( nanos_state::ctc_z0_w ) -{ -} - -WRITE_LINE_MEMBER( nanos_state::ctc_z1_w ) -{ -} - -WRITE_LINE_MEMBER( nanos_state::ctc_z2_w ) -{ -} - -/* Z80-SIO Interface */ - -WRITE_LINE_MEMBER(nanos_state::z80daisy_interrupt) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); -} - -/* Z80 Daisy Chain */ - -static const z80_daisy_config nanos_daisy_chain[] = -{ - { "z80pio" }, - { "z80pio_0" }, - { "z80pio_1" }, - { "z80sio_0" }, - { "z80ctc_0" }, - { "z80sio_1" }, - { "z80ctc_1" }, - { NULL } -}; - -static ADDRESS_MAP_START( nanos_io , AS_IO, 8, nanos_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - /* CPU card */ - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) - - /* I/O card */ - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80pio_0", z80pio_device, read, write) - AM_RANGE(0x84, 0x87) AM_DEVREADWRITE("z80sio_0", z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x88, 0x8B) AM_DEVREADWRITE("z80pio_1", z80pio_device, read, write) - AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE("z80ctc_0", z80ctc_device, read, write) - - /* FDC card */ - AM_RANGE(0x92, 0x92) AM_WRITE(nanos_tc_w) - AM_RANGE(0x94, 0x95) AM_DEVICE("upd765", upd765a_device, map) - /* V24+IFSS card */ - AM_RANGE(0xA0, 0xA3) AM_DEVREADWRITE("z80sio_0", z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0xA4, 0xA7) AM_DEVREADWRITE("z80ctc_1", z80ctc_device, read, write) - - /* 256-k RAM card I - 64k OS-Memory + 192k-RAM-Floppy */ - //AM_RANGE(0xC0, 0xC7) - - /* 256-k RAM card II - 64k OS-Memory + 192k-RAM-Floppy */ - //AM_RANGE(0xC8, 0xCF) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( nanos ) - PORT_START("LINEC") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_END) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL")PORT_CODE(KEYCODE_BACKSPACE) - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) -INPUT_PORTS_END - - -void nanos_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -// static UINT8 framecnt=0; - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - -// framecnt++; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 80; x++) - { - if (ra < 8) - { - chr = m_ram->pointer()[0xf800+ x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | ra ]; - } - else - gfx = 0; - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=80; - } - return 0; -} - -READ8_MEMBER(nanos_state::nanos_port_a_r) -{ - UINT8 retVal; - if (m_key_command==0) { - return m_key_pressed; - } else { - retVal = m_last_code; - m_last_code = 0; - return retVal; - } -} - -READ8_MEMBER(nanos_state::nanos_port_b_r) -{ - return 0xff; -} - - -WRITE8_MEMBER(nanos_state::nanos_port_b_w) -{ - m_key_command = BIT(data,1); - if (BIT(data,7)) { - m_bank1->set_base(m_region_maincpu->base()); - } else { - m_bank1->set_base(m_ram->pointer()); - } -} - -UINT8 nanos_state::row_number(UINT8 code) -{ - if BIT(code,0) return 0; - if BIT(code,1) return 1; - if BIT(code,2) return 2; - if BIT(code,3) return 3; - if BIT(code,4) return 4; - if BIT(code,5) return 5; - if BIT(code,6) return 6; - if BIT(code,7) return 7; - return 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(nanos_state::keyboard_callback) -{ - ioport_port *io_ports[] = { m_line0, m_line1, m_line2, m_line3, m_line4, m_line5, m_line6 }; - - int i; - UINT8 code; - UINT8 key_code = 0; - UINT8 shift = m_linec->read() & 0x02 ? 1 : 0; - UINT8 ctrl = m_linec->read() & 0x01 ? 1 : 0; - m_key_pressed = 0xff; - for(i = 0; i < 7; i++) - { - code = io_ports[i]->read(); - if (code != 0) - { - if (i==0 && shift==0) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - if (i==0 && shift==1) { - key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers - } - if (i==1 && shift==0) { - if (row_number(code) < 4) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i==1 && shift==1) { - if (row_number(code) < 4) { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i>=2 && i<=4 && shift==1 && ctrl==0) { - key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters - } - if (i>=2 && i<=4 && shift==0 && ctrl==0) { - key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters - } - if (i>=2 && i<=4 && ctrl==1) { - key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters - } - if (i==5 && shift==1 && ctrl==0) { - if (row_number(code)<7) { - key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters - } else { - key_code = 0x40 + row_number(code) + (i-2)*8; // for signs it is switched - } - } - if (i==5 && shift==0 && ctrl==0) { - if (row_number(code)<7) { - key_code = 0x40 + row_number(code) + (i-2)*8; // for small letters - } else { - key_code = 0x60 + row_number(code) + (i-2)*8; // for signs it is switched - } - } - if (i==5 && shift==0 && ctrl==1) { - key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl - } - if (i==6) { - switch(row_number(code)) - { - case 0: key_code = 0x11; break; - case 1: key_code = 0x12; break; - case 2: key_code = 0x13; break; - case 3: key_code = 0x14; break; - case 4: key_code = 0x20; break; // Space - case 5: key_code = 0x0D; break; // Enter - case 6: key_code = 0x09; break; // TAB - case 7: key_code = 0x0A; break; // LF - } - } - m_last_code = key_code; - } - } - if (key_code==0){ - m_key_pressed = 0xf7; - } -} - -void nanos_state::machine_start() -{ - m_key_pressed = 0xff; -} - -void nanos_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.install_write_bank(0x0000, 0x0fff, "bank3"); - space.install_write_bank(0x1000, 0xffff, "bank2"); - - m_bank1->set_base(m_region_maincpu->base()); - m_bank2->set_base(m_ram->pointer() + 0x1000); - m_bank3->set_base(m_ram->pointer()); - - machine().device("upd765:0")->get_device()->mon_w(false); -} - -FLOPPY_FORMATS_MEMBER( nanos_state::floppy_formats ) - FLOPPY_NANOS_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( nanos_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -/* F4 Character Displayer */ -static const gfx_layout nanos_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( nanos ) - GFXDECODE_ENTRY( "chargen", 0x0000, nanos_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( nanos, nanos_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(nanos_mem) - MCFG_CPU_IO_MAP(nanos_io) - MCFG_CPU_CONFIG(nanos_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(nanos_state, screen_update) - MCFG_SCREEN_SIZE(80*8, 25*10) - MCFG_SCREEN_VISIBLE_AREA(0,80*8-1,0,25*10-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", nanos) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* devices */ - MCFG_DEVICE_ADD("z80ctc_0", Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(nanos_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(nanos_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(nanos_state, ctc_z2_w)) - - MCFG_DEVICE_ADD("z80ctc_1", Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(nanos_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(nanos_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(nanos_state, ctc_z2_w)) - - MCFG_DEVICE_ADD("z80pio_0", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80pio_1", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_Z80SIO0_ADD("z80sio_0", XTAL_4MHz, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(WRITELINE(nanos_state, z80daisy_interrupt)) - - MCFG_Z80SIO0_ADD("z80sio_1", XTAL_4MHz, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(WRITELINE(nanos_state, z80daisy_interrupt)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_IN_PA_CB(READ8(nanos_state, nanos_port_a_r)) - MCFG_Z80PIO_IN_PB_CB(READ8(nanos_state, nanos_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(nanos_state, nanos_port_b_w)) - - /* UPD765 */ - MCFG_UPD765A_ADD("upd765", false, true) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", nanos_floppies, "525hd", nanos_state::floppy_formats) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", nanos_state, keyboard_callback, attotime::from_hz(24000)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( nanos ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "k7634_1.rom", 0x0000, 0x0800, CRC(8e34e6ac) SHA1(fd342f6effe991823c2a310737fbfcba213c4fe3)) - ROM_LOAD( "k7634_2.rom", 0x0800, 0x0180, CRC(4e01b02b) SHA1(8a279da886555c7470a1afcbb3a99693ea13c237)) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "zg_nanos.rom", 0x0000, 0x0800, CRC(5682d3f9) SHA1(5b738972c815757821c050ee38b002654f8da163)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, nanos, 0, 0, nanos, nanos, driver_device, 0, "Ingenieurhochschule fur Seefahrt Warnemunde/Wustrow", "NANOS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/nascom1.c b/src/mess/drivers/nascom1.c deleted file mode 100644 index 216d9de8e64..00000000000 --- a/src/mess/drivers/nascom1.c +++ /dev/null @@ -1,776 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Nascom 1/2/3 - - Single board computer - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "machine/z80pio.h" -#include "machine/ay31015.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "bus/nasbus/nasbus.h" - - -//************************************************************************** -// CONSTANTS/MACROS -//************************************************************************** - -#define NASCOM1_KEY_RESET 0x02 -#define NASCOM1_KEY_INCR 0x01 - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -struct nascom1_portstat_t -{ - UINT8 stat_flags; - UINT8 stat_count; -}; - -class nascom_state : public driver_device -{ -public: - nascom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_hd6402(*this, "hd6402"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_videoram(*this, "videoram"), - m_keyboard(*this, "KEY") - { } - - required_device m_maincpu; - required_device m_hd6402; - required_device m_cassette; - required_device m_ram; - required_device m_gfxdecode; - required_device m_palette; - required_shared_ptr m_videoram; - required_ioport_array<9> m_keyboard; - - int m_tape_size; - UINT8 *m_tape_image; - int m_tape_index; - nascom1_portstat_t m_portstat; - - DECLARE_READ8_MEMBER(nascom1_port_00_r); - DECLARE_WRITE8_MEMBER(nascom1_port_00_w); - DECLARE_READ8_MEMBER(nascom1_port_01_r); - DECLARE_WRITE8_MEMBER(nascom1_port_01_w); - DECLARE_READ8_MEMBER(nascom1_port_02_r); - DECLARE_DRIVER_INIT(nascom); - void screen_update(bitmap_ind16 &bitmap, const rectangle &cliprect, int char_height); - DECLARE_READ8_MEMBER(nascom1_hd6402_si); - DECLARE_WRITE8_MEMBER(nascom1_hd6402_so); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( nascom1_cassette ); - DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( nascom1_cassette ); - DECLARE_SNAPSHOT_LOAD_MEMBER( nascom1 ); - -protected: - virtual void machine_reset(); - -private: - -}; - -class nascom1_state : public nascom_state -{ -public: - nascom1_state(const machine_config &mconfig, device_type type, const char *tag) : - nascom_state(mconfig, type, tag) - {} - - UINT32 screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -private: -}; - -class nascom2_state : public nascom_state -{ -public: - nascom2_state(const machine_config &mconfig, device_type type, const char *tag) : - nascom_state(mconfig, type, tag), - m_nasbus(*this, "nasbus"), - m_socket1(*this, "socket1"), - m_socket2(*this, "socket2"), - m_lsw1(*this, "lsw1") - {} - - DECLARE_WRITE_LINE_MEMBER(ram_disable_w); - DECLARE_WRITE_LINE_MEMBER(ram_disable_cpm_w); - DECLARE_DRIVER_INIT(nascom2); - DECLARE_DRIVER_INIT(nascom2c); - UINT32 screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - int load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(socket1_load) { return load_cart(image, m_socket1, 1); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(socket2_load) { return load_cart(image, m_socket2, 2); } - -protected: - virtual void machine_reset(); - -private: - required_device m_nasbus; - required_device m_socket1; - required_device m_socket2; - required_ioport m_lsw1; -}; - - -//************************************************************************** -// KEYBOARD -//************************************************************************** - -READ8_MEMBER( nascom_state::nascom1_port_00_r ) -{ - if (m_portstat.stat_count < 9) - return ((m_keyboard[m_portstat.stat_count])->read() | ~0x7f); - - return 0xff; -} - -WRITE8_MEMBER( nascom_state::nascom1_port_00_w ) -{ - m_cassette->change_state( - (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - if (!(data & NASCOM1_KEY_RESET)) - { - if (m_portstat.stat_flags & NASCOM1_KEY_RESET) - m_portstat.stat_count = 0; - } - else - m_portstat.stat_flags = NASCOM1_KEY_RESET; - - if (!(data & NASCOM1_KEY_INCR)) - { - if (m_portstat.stat_flags & NASCOM1_KEY_INCR) - m_portstat.stat_count++; - } - else - m_portstat.stat_flags = NASCOM1_KEY_INCR; -} - - -//************************************************************************** -// CASSETTE -//************************************************************************** - -READ8_MEMBER( nascom_state::nascom1_port_01_r ) -{ - return m_hd6402->get_received_data(); -} - - -WRITE8_MEMBER( nascom_state::nascom1_port_01_w ) -{ - m_hd6402->set_transmit_data(data); -} - -READ8_MEMBER( nascom_state::nascom1_port_02_r ) -{ - UINT8 data = 0x31; - - m_hd6402->set_input_pin(AY31015_SWE, 0); - data |= m_hd6402->get_output_pin(AY31015_OR ) ? 0x02 : 0; - data |= m_hd6402->get_output_pin(AY31015_PE ) ? 0x04 : 0; - data |= m_hd6402->get_output_pin(AY31015_FE ) ? 0x08 : 0; - data |= m_hd6402->get_output_pin(AY31015_TBMT) ? 0x40 : 0; - data |= m_hd6402->get_output_pin(AY31015_DAV ) ? 0x80 : 0; - m_hd6402->set_input_pin(AY31015_SWE, 1); - - return data; -} - -READ8_MEMBER( nascom_state::nascom1_hd6402_si ) -{ - return 1; -} - -WRITE8_MEMBER( nascom_state::nascom1_hd6402_so ) -{ -} - -DEVICE_IMAGE_LOAD_MEMBER( nascom_state, nascom1_cassette ) -{ - m_tape_size = image.length(); - m_tape_image = (UINT8*)image.ptr(); - - if (!m_tape_image) - return IMAGE_INIT_FAIL; - - m_tape_index = 0; - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_UNLOAD_MEMBER( nascom_state, nascom1_cassette ) -{ - m_tape_image = NULL; - m_tape_size = m_tape_index = 0; -} - - -//************************************************************************** -// SNAPSHOTS -//************************************************************************** - -SNAPSHOT_LOAD_MEMBER( nascom_state, nascom1 ) -{ - UINT8 line[35]; - - while (image.fread( &line, sizeof(line)) == sizeof(line)) - { - unsigned int addr, b0, b1, b2, b3, b4, b5, b6, b7, dummy; - - if (sscanf((char *)line, "%x %x %x %x %x %x %x %x %x %x\010\010\n", - &addr, &b0, &b1, &b2, &b3, &b4, &b5, &b6, &b7, &dummy) == 10) - { - m_maincpu->space(AS_PROGRAM).write_byte(addr++, b0); - m_maincpu->space(AS_PROGRAM).write_byte(addr++, b1); - m_maincpu->space(AS_PROGRAM).write_byte(addr++, b2); - m_maincpu->space(AS_PROGRAM).write_byte(addr++, b3); - m_maincpu->space(AS_PROGRAM).write_byte(addr++, b4); - m_maincpu->space(AS_PROGRAM).write_byte(addr++, b5); - m_maincpu->space(AS_PROGRAM).write_byte(addr++, b6); - m_maincpu->space(AS_PROGRAM).write_byte(addr++, b7); - } - } - - return IMAGE_INIT_PASS; -} - - -//************************************************************************** -// SOCKETS -//************************************************************************** - -int nascom2_state::load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id) -{ - // loading directly from file - if (image.software_entry() == NULL) - { - if (slot->length() > 0x1000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported file size"); - return IMAGE_INIT_FAIL; - } - - slot->rom_alloc(slot->length(), GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - slot->fread(slot->get_rom_base(), slot->length()); - - // we just assume that socket1 should be loaded to 0xc000 and socket2 to 0xd000 - switch (slot_id) - { - case 1: - m_maincpu->space(AS_PROGRAM).install_rom(0xc000, 0xc000 + slot->length() - 1, slot->get_rom_base()); - break; - case 2: - m_maincpu->space(AS_PROGRAM).install_rom(0xd000, 0xd000 + slot->length() - 1, slot->get_rom_base()); - break; - } - } - - // loading from software list. this supports multiple regions to load to - else - { - UINT8 *region_b000 = image.get_software_region("b000"); - UINT8 *region_c000 = image.get_software_region("c000"); - UINT8 *region_d000 = image.get_software_region("d000"); - - if (region_b000 != NULL) - { - UINT32 size = image.get_software_region_length("b000"); - m_maincpu->space(AS_PROGRAM).install_rom(0xb000, 0xb000 + size - 1, region_b000); - } - - if (region_c000 != NULL) - { - UINT32 size = image.get_software_region_length("c000"); - m_maincpu->space(AS_PROGRAM).install_rom(0xc000, 0xc000 + size - 1, region_c000); - } - - if (region_d000 != NULL) - { - UINT32 size = image.get_software_region_length("d000"); - m_maincpu->space(AS_PROGRAM).install_rom(0xd000, 0xd000 + size - 1, region_d000); - } - } - - return IMAGE_INIT_PASS; -} - - -//************************************************************************** -// DRIVER INIT -//************************************************************************** - -void nascom_state::machine_reset() -{ - // Set up hd6402 pins - m_hd6402->set_input_pin(AY31015_SWE, 1); - - m_hd6402->set_input_pin(AY31015_CS, 0); - m_hd6402->set_input_pin(AY31015_NP, 1); - m_hd6402->set_input_pin(AY31015_NB1, 1); - m_hd6402->set_input_pin(AY31015_NB2, 1); - m_hd6402->set_input_pin(AY31015_EPS, 1); - m_hd6402->set_input_pin(AY31015_TSB, 1); - m_hd6402->set_input_pin(AY31015_CS, 1); -} - -DRIVER_INIT_MEMBER( nascom_state, nascom ) -{ - // install extra memory - if (m_ram->size() > 0) - { - m_maincpu->space(AS_PROGRAM).install_ram(0x1000, 0x1000 + m_ram->size() - 1, m_ram->pointer()); - } -} - -void nascom2_state::machine_reset() -{ - // base machine reset - nascom_state::machine_reset(); - - // restart address (on the real system, a12 to a15 are forced to 1 for one memory cycle) - m_maincpu->set_state_int(Z80_PC, m_lsw1->read() << 12); -} - -DRIVER_INIT_MEMBER( nascom2_state, nascom2 ) -{ - DRIVER_INIT_CALL(nascom); - - // setup nasbus - m_nasbus->set_program_space(&m_maincpu->space(AS_PROGRAM)); - m_nasbus->set_io_space(&m_maincpu->space(AS_IO)); -} - -// since we don't know for which regions we should disable ram, we just let other devices -// overwrite the region they need, and re-install our ram when they are disabled -WRITE_LINE_MEMBER( nascom2_state::ram_disable_w ) -{ - if (state) - { - // enable ram again - m_maincpu->space(AS_PROGRAM).install_ram(0x1000, 0x1000 + m_ram->size() - 1, m_ram->pointer()); - } -} - -DRIVER_INIT_MEMBER( nascom2_state, nascom2c ) -{ - // install memory - m_maincpu->space(AS_PROGRAM).install_ram(0x0000, 0x0000 + m_ram->size() - 1, m_ram->pointer()); - - // setup nasbus - m_nasbus->set_program_space(&m_maincpu->space(AS_PROGRAM)); - m_nasbus->set_io_space(&m_maincpu->space(AS_IO)); -} - -WRITE_LINE_MEMBER( nascom2_state::ram_disable_cpm_w ) -{ - if (state) - { - // enable ram again - m_maincpu->space(AS_PROGRAM).install_ram(0x0000, 0x0000 + m_ram->size() - 1, m_ram->pointer()); - } -} - - -//************************************************************************** -// VIDEO -//************************************************************************** - -static const gfx_layout nascom1_charlayout = -{ - 8, 16, - 128, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, - 8 * 16 -}; - -static GFXDECODE_START( nascom1 ) - GFXDECODE_ENTRY("gfx1", 0x0000, nascom1_charlayout, 0, 1) -GFXDECODE_END - -UINT32 nascom1_state::screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - screen_update(bitmap, cliprect, 16); - return 0; -} - -static const gfx_layout nascom2_charlayout = -{ - 8, 14, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, - 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8 }, - 8 * 16 -}; - -static GFXDECODE_START( nascom2 ) - GFXDECODE_ENTRY("gfx1", 0x0000, nascom2_charlayout, 0, 1) -GFXDECODE_END - -UINT32 nascom2_state::screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - screen_update(bitmap, cliprect, 14); - return 0; -} - -void nascom_state::screen_update(bitmap_ind16 &bitmap, const rectangle &cliprect, int char_height) -{ - for (int sx = 0; sx < 48; sx++) - { - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[0x03ca + sx], 1, 0, 0, sx * 8, 0); - } - - for (int sy = 0; sy < 15; sy++) - { - for (int sx = 0; sx < 48; sx++) - { - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[0x000a + (sy * 64) + sx], 1, 0, 0, sx * 8, (sy + 1) * char_height); - } - } -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -static ADDRESS_MAP_START( nascom1_mem, AS_PROGRAM, 8, nascom1_state ) - AM_RANGE(0x0000, 0x07ff) AM_ROM // MONITOR - AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x0c00, 0x0fff) AM_RAM // WRAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( nascom1_io, AS_IO, 8, nascom1_state ) - ADDRESS_MAP_GLOBAL_MASK(0x0f) - AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w) - AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w) - AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( nascom2_mem, AS_PROGRAM, 8, nascom2_state ) - AM_RANGE(0x0000, 0x07ff) AM_ROM // MONITOR - AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x0c00, 0x0fff) AM_RAM // WRAM - AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("basic", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( nascom2_io, AS_IO, 8, nascom2_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w) - AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w) - AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( nascom2c_mem, AS_PROGRAM, 8, nascom2_state ) - AM_RANGE(0xf000, 0xf7ff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0xfc00, 0xffff) AM_RAM // WRAM -ADDRESS_MAP_END - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -static INPUT_PORTS_START( nascom1 ) - PORT_START("KEY.0") - PORT_BIT(0x6f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("KEY.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("KEY.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("KEY.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("KEY.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("KEY.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace ClearScreen") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("New Line") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x58, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_SHIFT_2) PORT_CHAR('@') -INPUT_PORTS_END - -static INPUT_PORTS_START( nascom2 ) - PORT_INCLUDE(nascom1) - - PORT_MODIFY("KEY.6") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('[') PORT_CHAR('\\') - - PORT_MODIFY("KEY.7") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(']') PORT_CHAR('_') - - PORT_MODIFY("KEY.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back CS") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter Escape") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR(27) - - // link switch on board - PORT_START("lsw1") - PORT_DIPNAME(0x0f, 0x00, "Restart address") - PORT_DIPLOCATION("LSW1:2,3,4,5") - PORT_DIPSETTING(0x00, "0000H") - PORT_DIPSETTING(0x01, "1000H") - PORT_DIPSETTING(0x02, "2000H") - PORT_DIPSETTING(0x03, "3000H") - PORT_DIPSETTING(0x04, "4000H") - PORT_DIPSETTING(0x05, "5000H") - PORT_DIPSETTING(0x06, "6000H") - PORT_DIPSETTING(0x07, "7000H") - PORT_DIPSETTING(0x08, "8000H") - PORT_DIPSETTING(0x09, "9000H") - PORT_DIPSETTING(0x0a, "A000H") - PORT_DIPSETTING(0x0b, "B000H") - PORT_DIPSETTING(0x0c, "C000H") - PORT_DIPSETTING(0x0d, "D000H") - PORT_DIPSETTING(0x0e, "E000H") - PORT_DIPSETTING(0x0f, "F000H") -INPUT_PORTS_END - -static INPUT_PORTS_START( nascom2c ) - PORT_INCLUDE(nascom2) - - PORT_MODIFY("lsw1") - PORT_DIPNAME(0x0f, 0x0f, "Restart address") - PORT_DIPLOCATION("LSW1:2,3,4,5") - PORT_DIPSETTING(0x00, "0000H") - PORT_DIPSETTING(0x01, "1000H") - PORT_DIPSETTING(0x02, "2000H") - PORT_DIPSETTING(0x03, "3000H") - PORT_DIPSETTING(0x04, "4000H") - PORT_DIPSETTING(0x05, "5000H") - PORT_DIPSETTING(0x06, "6000H") - PORT_DIPSETTING(0x07, "7000H") - PORT_DIPSETTING(0x08, "8000H") - PORT_DIPSETTING(0x09, "9000H") - PORT_DIPSETTING(0x0a, "A000H") - PORT_DIPSETTING(0x0b, "B000H") - PORT_DIPSETTING(0x0c, "C000H") - PORT_DIPSETTING(0x0d, "D000H") - PORT_DIPSETTING(0x0e, "E000H") - PORT_DIPSETTING(0x0f, "F000H") -INPUT_PORTS_END - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static MACHINE_CONFIG_START( nascom1, nascom1_state ) - // main cpu - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 8) - MCFG_CPU_PROGRAM_MAP(nascom1_mem) - MCFG_CPU_IO_MAP(nascom1_io) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(48 * 8, 16 * 16) - MCFG_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 16 - 1) - MCFG_SCREEN_UPDATE_DRIVER(nascom1_state, screen_update_nascom) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", nascom1) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - // uart - MCFG_DEVICE_ADD( "hd6402", AY31015, 0 ) - MCFG_AY31015_TX_CLOCK(( XTAL_16MHz / 16 ) / 256) - MCFG_AY31015_RX_CLOCK(( XTAL_16MHz / 16 ) / 256) - MCFG_AY51013_READ_SI_CB(READ8(nascom_state, nascom1_hd6402_si)) - MCFG_AY51013_WRITE_SO_CB(WRITE8(nascom_state, nascom1_hd6402_so)) - - // cassette is connected to the uart - MCFG_CASSETTE_ADD("cassette") - - // pio - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_16MHz/8) - - // internal extra ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") - MCFG_RAM_EXTRA_OPTIONS("8K,16K,32K") - - // devices - MCFG_SNAPSHOT_ADD("snapshot", nascom_state, nascom1, "nas", 0.5) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( nascom2, nascom1, nascom2_state ) - MCFG_CPU_REPLACE("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(nascom2_mem) - MCFG_CPU_IO_MAP(nascom2_io) - - // video hardware - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(48 * 8, 16 * 14) - MCFG_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 14 - 1) - MCFG_SCREEN_UPDATE_DRIVER(nascom2_state, screen_update_nascom) - - MCFG_GFXDECODE_MODIFY("gfxdecode", nascom2) - - // generic sockets for ram/rom (todo: support ram here) - MCFG_GENERIC_SOCKET_ADD("socket1", generic_plain_slot, "nascom_socket") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(nascom2_state, socket1_load) - MCFG_GENERIC_SOCKET_ADD("socket2", generic_plain_slot, "nascom_socket") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(nascom2_state, socket2_load) - - MCFG_SOFTWARE_LIST_ADD("socket_list", "nascom_socket") - - // nasbus expansion bus - MCFG_NASBUS_ADD(NASBUS_TAG) - MCFG_NASBUS_RAM_DISABLE_HANDLER(WRITELINE(nascom2_state, ram_disable_w)) - MCFG_NASBUS_SLOT_ADD("nasbus1", nasbus_slot_cards, NULL) - MCFG_NASBUS_SLOT_ADD("nasbus2", nasbus_slot_cards, NULL) - MCFG_NASBUS_SLOT_ADD("nasbus3", nasbus_slot_cards, NULL) - MCFG_NASBUS_SLOT_ADD("nasbus4", nasbus_slot_cards, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( nascom2c, nascom2, nascom2_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(nascom2c_mem) - - MCFG_DEVICE_REMOVE(RAM_TAG) - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("60K") - - MCFG_DEVICE_MODIFY(NASBUS_TAG) - MCFG_NASBUS_RAM_DISABLE_HANDLER(WRITELINE(nascom2_state, ram_disable_cpm_w)) -MACHINE_CONFIG_END - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( nascom1 ) - ROM_REGION(0x0800, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "T4", "NasBug T4") - ROMX_LOAD("nasbugt4.rom", 0x0000, 0x0800, CRC(f391df68) SHA1(00218652927afc6360c57e77d6a4fd32d4e34566), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "T1", "NasBug T1") - ROMX_LOAD("nasbugt1.rom", 0x0000, 0x0400, CRC(8ea07054) SHA1(3f9a8632826003d6ea59d2418674d0fb09b83a4c), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "T2", "NasBug T2") - ROMX_LOAD("nasbugt2.rom", 0x0000, 0x0400, CRC(e371b58a) SHA1(485b20a560b587cf9bb4208ba203b12b3841689b), ROM_BIOS(3)) - - ROM_REGION(0x0800, "gfx1", 0) - ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52)) -ROM_END - -ROM_START( nascom2 ) - ROM_REGION(0x0800, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "NS3", "NasSys 3") - ROMX_LOAD("nassys3.rom", 0x0000, 0x0800, CRC(3da17373) SHA1(5fbda15765f04e4cd08cf95c8d82ce217889f240), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "NS1", "NasSys 1") - ROMX_LOAD("nassys1.rom", 0x0000, 0x0800, CRC(b6300716) SHA1(29da7d462ba3f569f70ed3ecd93b981f81c7adfa), ROM_BIOS(2)) - - ROM_REGION(0x2000, "basic", 0) - ROM_LOAD("basic.rom", 0x0000, 0x2000, CRC(5cb5197b) SHA1(c41669c2b6d6dea808741a2738426d97bccc9b07)) - - ROM_REGION(0x1000, "gfx1", 0) - ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52)) - ROM_LOAD("nasgra.chr", 0x0800, 0x0800, CRC(2bc09d32) SHA1(d384297e9b02cbcb283c020da51b3032ff62b1ae)) -ROM_END - -ROM_START( nascom2c ) - ROM_REGION(0x0800, "maincpu", 0) - ROM_LOAD("cpmboot.rom", 0x0000, 0x0800, CRC(44b67ffc) SHA1(60c8335f24798f8de7ad48a4cd03e56a60d87b63)) - - ROM_REGION(0x1000, "gfx1", 0) - ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52)) - ROM_LOAD("nasgra.chr", 0x0800, 0x0800, CRC(2bc09d32) SHA1(d384297e9b02cbcb283c020da51b3032ff62b1ae)) -ROM_END - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, nascom1, 0, 0, nascom1, nascom1, nascom_state, nascom, "Nascom Microcomputers", "Nascom 1", MACHINE_NO_SOUND_HW ) -COMP( 1979, nascom2, 0, 0, nascom2, nascom2, nascom2_state, nascom2, "Nascom Microcomputers", "Nascom 2", MACHINE_NO_SOUND_HW ) -COMP( 1980, nascom2c, nascom2, 0, nascom2c, nascom2c, nascom2_state, nascom2c, "Nascom Microcomputers", "Nascom 2 (CP/M)", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/nc.c b/src/mess/drivers/nc.c deleted file mode 100644 index 7bf13f6d188..00000000000 --- a/src/mess/drivers/nc.c +++ /dev/null @@ -1,1556 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Wilbert Pol, Kevin Thacker -/****************************************************************************** - - nc.c - - NC100/NC150/NC200 Notepad computer - - system driver - - - Thankyou to: - Cliff Lawson, Russell Marks and Tim Surtel - - Documentation: - - NC100: - NC100 I/O Specification by Cliff Lawson, - NC100EM by Russell Marks - NC200: - Dissassembly of the NC200 ROM + e-mail - exchange with Russell Marks - - - NC100: - - Hardware: - - Z80 CPU, 6 MHz - - memory powered by lithium batterys! - - 2 channel tone (programmable frequency beep's) - - LCD screen - - laptop/portable computer - - qwerty keyboard - - serial/parallel connection - - Amstrad custom ASIC chip - - tc8521 real time clock - - intel 8251 compatible uart - - PCMCIA Memory cards supported, up to 1mb! - - NC200: - - Hardware: - - Z80 CPU - - Intel 8251 compatible uart - - upd765 compatible floppy disc controller - - mc146818 real time clock? - - 720k floppy disc drive (compatible with MS-DOS) - (disc drive can be not ready). - - PCMCIA Memory cards supported, up to 1mb! - - TODO: - - find out what the unused key bits are for - (checked all unused bits on nc200! - do not seem to have any use!) - - complete serial (xmodem protocol!) - - overlay would be nice! - - finish NC200 disc drive emulation (closer!) - - add NC150 driver - ROM needed!!! - - on/off control - - check values read from other ports that are not described! - - what is read from unmapped ports? - - what is read from uart when it is off? - - check if uart ints are generated when it is off? - - are ints cancelled if uart is turned off after int has been caused? - - check keyboard ints - are these regular or what?? - - PCMCIA memory cards are stored as a direct dump of the contents. There is no header - information. No distinction is made between RAM and ROM cards. - - Memory card sizes are a power of 2 in size (e.g. 1mb, 512k, 256k etc), - however the code allows any size, but it limits access to power of 2 sizes, with - minimum access being 16k. If a file which is less than 16k is used, no memory card - will be present. If a file which is greater than 1mb is used, only 1mb will be accessed. - - Interrupt system of NC100: - - The IRQ mask is used to control the interrupt sources that can interrupt. - - The IRQ status can be read to determine which devices are interrupting. - Some devices, e.g. serial, cannot be cleared by writing to the irq status - register. These can only be cleared by performing an operation on the - device (e.g. reading a data register). - - Self Test: - - - requires memory save and real time clock save to be working! - (i.e. for MESS nc100 driver, nc100.nv can be created) - - turn off nc (use NMI button) - - reset+FUNCTION+SYMBOL must be pressed together. - - Note: NC200 Self test does not test disc hardware :( - - - - Kevin Thacker [MESS driver] - - ******************************************************************************/ - -#include "emu.h" -#include "emuopts.h" -#include "cpu/z80/z80.h" -#include "includes/nc.h" -#include "machine/mc146818.h" /* for NC200 real time clock */ -#include "machine/rp5c01.h" /* for NC100 real time clock */ -#include "machine/upd765.h" /* for NC200 disk drive interface */ -#include "formats/pc_dsk.h" /* for NC200 disk image */ -#include "sound/beep.h" -#include "machine/ram.h" -#include "rendlay.h" - - -#define VERBOSE 0 -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -#define NC200_DEBUG 1 -#define LOG_DEBUG(x) do { if (NC200_DEBUG) logerror x; } while (0) - - -/* the serial clock is generated by the nc hardware and connected to the i8251 -receive clock and transmit clock inputs */ - -/* - Port 0x00: - ========== - - Display memory start: - - NC100: - bit 7 A15 - bit 6 A14 - bit 5 A13 - bit 4 A12 - bits 3-0 Not Used - NC200: - bit 7 A15 - bit 6 A14 - bit 5 A13 - bits 4-0 Not Used - - Port 0x010-0x013: - ================= - - Memory management control: - - NC100 & NC200: - - 10 controls 0000-3FFF - 11 controls 4000-7FFF - 12 controls 8000-BFFF - 13 controls C000-FFFF - - Port 0x030: - =========== - - NC100: - bit 7 select card register 1=common, 0=attribute - bit 6 parallel interface Strobe signal - bit 5 Not Used - bit 4 uPD4711 line driver, 1=off, 0=on - bit 3 UART clock and reset, 1=off, 0=on - - bits 2-0 set the baud rate as follows - - 000 = 150 - 001 = 300 - 010 = 600 - 011 = 1200 - 100 = 2400 - 101 = 4800 - 110 = 9600 - 111 = 19200 - NC200: - bit 7 select card register 1=common, 0=attribute - bit 6 parallel interface Strobe signal - - bit 5 used in disc interface; (set to 0) - - bit 4 uPD4711 line driver, 1=off, 0=on - bit 3 UART clock and reset, 1=off, 0=on - - bits 2-0 set the baud rate as follows - - 000 = 150 - 001 = 300 - 010 = 600 - 011 = 1200 - 100 = 2400 - 101 = 4800 - 110 = 9600 - 111 = 19200 - - - Port 0x0a0: - =========== - - NC100: - bit 7: memory card present 0 = yes, 1 = no - bit 6: memory card write protected 1 = yes, 0 = no - bit 5: input voltage = 1, if >= to 4 volts - bit 4: mem card battery: 0 = battery low - bit 3: alkaline batteries. 0 if >=3.2 volts - bit 2: lithium battery 0 if >= 2.7 volts - bit 1: parallel interface busy (0 if busy) - bit 0: parallel interface ack (1 if ack) - - NC200: - - bit 7: memory card present 0 = yes, 1 = no - bit 6: memory card write protected 1 = yes, 0 = no - bit 5: lithium battery 0 if >= 2.7 volts - bit 4: input voltage = 1, if >= to 4 volts - bit 3: ?? - bit 2: alkaline batteries. 0 if >=3.2 volts - bit 1: ?? - bit 0: battery power: if 1: batteries are too low for disk usage, if 0: batteries ok for disc usage - - - Port 0x060 (IRQ MASK), Port 0x090 (IRQ STATUS): - =============================================== - - NC100: - bit 7: not used - bit 6: not used - bit 5: not used - bit 4: not used - Bit 3: Key scan interrupt (10ms) - Bit 2: ACK from parallel interface - Bit 1: Tx Ready - Bit 0: Rx Ready - - NC200: - bit 7: ??? - bit 6: RTC alarm? - bit 5: FDC interrupt - bit 4: Power off interrupt - Bit 3: Key scan interrupt (10ms) - Bit 2: serial interrupt (tx ready/rx ready combined) - Bit 1: not used - Bit 0: ACK from parallel interface - - Port 0x070: On/off control - - NC200: - bit 7: nc200 power on/off: 1 = on, 0=off - bit 2: backlight: 1=off, 0=on - bit 1: disk motor: 1=off, 0=disk motor??? - bit 0: upd765 terminal count input -*/ - - - -/* latched interrupts are interrupts that cannot be cleared by writing to the irq -mask. latched interrupts can only be cleared by accessing the interrupting -device e.g. serial chip, fdc */ -/* this is a mask of irqs that are latched, and it is different for nc100 and -nc200 */ - -void nc_state::nc_update_interrupts() -{ - m_irq_status &= ~m_irq_latch_mask; - m_irq_status |= m_irq_latch; - - /* any ints set and they are not masked? */ - if ( - (((m_irq_status & m_irq_mask) & 0x3f)!=0) - ) - { - logerror("int set %02x\n", m_irq_status & m_irq_mask); - /* set int */ - m_maincpu->set_input_line(0, HOLD_LINE); - } - else - { - /* clear int */ - m_maincpu->set_input_line(0, CLEAR_LINE); - } -} - -TIMER_CALLBACK_MEMBER(nc_state::nc_keyboard_timer_callback) -{ - LOG(("keyboard int\n")); - - /* set int */ - m_irq_status |= (1<<3); - - /* update ints */ - nc_update_interrupts(); - - /* don't trigger again, but don't free it */ - m_keyboard_timer->reset(); -} - - -static const char *const nc_bankhandler_r[]={ -"bank1", "bank2", "bank3", "bank4"}; - -static const char *const nc_bankhandler_w[]={ -"bank5", "bank6", "bank7", "bank8"}; - -void nc_state::nc_refresh_memory_bank_config(int bank) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *ptr; - int mem_type; - int mem_bank; - char bank1[10]; - char bank5[10]; - sprintf(bank1,"bank%d",bank+1); - sprintf(bank5,"bank%d",bank+5); - - mem_type = (m_memory_config[bank]>>6) & 0x03; - mem_bank = m_memory_config[bank] & 0x03f; - - space.install_read_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_r[bank]); - - switch (mem_type) - { - /* ROM */ - case 3: - case 0: - { - mem_bank &= m_membank_rom_mask; - ptr = (memregion("maincpu")->base() + 0x010000) + (mem_bank << 14); - - membank(bank1)->set_base(ptr); - - space.nop_write((bank * 0x4000), (bank * 0x4000) + 0x3fff); - LOG(("BANK %d: ROM %d\n",bank,mem_bank)); - } - break; - - /* internal RAM */ - case 1: - { - mem_bank &= m_membank_internal_ram_mask; - ptr = m_ram->pointer() + (mem_bank << 14); - - membank(bank1)->set_base(ptr); - membank(bank5)->set_base(ptr); - - space.install_write_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_w[bank]); - LOG(("BANK %d: RAM\n",bank)); - } - break; - - /* card RAM */ - case 2: - { - /* card connected? */ - if (m_card_status && m_card_ram) - { - mem_bank &= m_membank_card_ram_mask; - ptr = m_card_ram->base() + (mem_bank << 14); - - membank(bank1)->set_base(ptr); - - /* write enabled? */ - if (ioport("EXTRA")->read() & 0x02) - { - /* yes */ - membank(bank5)->set_base(ptr); - space.install_write_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_w[bank]); - } - else - { - /* no */ - space.nop_write((bank * 0x4000), (bank * 0x4000) + 0x3fff); - } - - LOG(("BANK %d: CARD-RAM\n",bank)); - } - else - { - /* if no card connected, then writes fail */ - space.nop_readwrite((bank * 0x4000), (bank * 0x4000) + 0x3fff); - } - } - break; - } -} - -void nc_state::nc_refresh_memory_config() -{ - nc_refresh_memory_bank_config(0); - nc_refresh_memory_bank_config(1); - nc_refresh_memory_bank_config(2); - nc_refresh_memory_bank_config(3); -} - - -TIMER_DEVICE_CALLBACK_MEMBER(nc_state::dummy_timer_callback) -{ - int inputport_10_state; - int changed_bits; - - inputport_10_state = ioport("EXTRA")->read(); - - changed_bits = inputport_10_state^m_previous_inputport_10_state; - - /* on/off button changed state? */ - if (changed_bits & 0x01) - { - if (inputport_10_state & 0x01) - { - /* on NC100 on/off button causes a nmi, on - nc200 on/off button causes an int */ - switch (m_type) - { - case NC_TYPE_1xx: - { - LOG(("nmi triggered\n")); - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } - break; - - case NC_TYPE_200: - { - m_irq_status |= (1 << 4); - nc_update_interrupts(); - } - break; - } - } - } - - /* memory card write enable/disable state changed? */ - if (changed_bits & 0x02) - { - /* yes refresh memory config */ - nc_refresh_memory_config(); - } - - m_previous_inputport_10_state = inputport_10_state; -} - - - -void nc_state::nc_common_init_machine() -{ - /* setup reset state */ - m_display_memory_start = 0; - - /* setup reset state */ - m_memory_config[0] = 0; - m_memory_config[1] = 0; - m_memory_config[2] = 0; - m_memory_config[3] = 0; - - m_previous_inputport_10_state = ioport("EXTRA")->read(); - - /* setup reset state ints are masked */ - m_irq_mask = 0; - /* setup reset state no ints wanting servicing */ - m_irq_status = 0; - /* at reset set to 0x0ffff */ - - m_irq_latch = 0; - m_irq_latch_mask = 0; - - /* setup reset state */ - m_sound_channel_periods[0] = (m_sound_channel_periods[1] = 0x0ffff); - - /* at reset set to 1 */ - m_poweroff_control = 1; - - nc_refresh_memory_config(); - nc_update_interrupts(); - - /* at reset set to 0x0ff */ - m_uart_control = 0x0ff; -} - -static ADDRESS_MAP_START(nc_map, AS_PROGRAM, 8, nc_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank5") - AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank6") - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank7") - AM_RANGE(0xc000, 0xffff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank8") -ADDRESS_MAP_END - - -READ8_MEMBER(nc_state::nc_memory_management_r) -{ - return m_memory_config[offset]; -} - -WRITE8_MEMBER(nc_state::nc_memory_management_w) -{ - LOG(("Memory management W: %02x %02x\n",offset,data)); - m_memory_config[offset] = data; - - nc_refresh_memory_config(); -} - -WRITE8_MEMBER(nc_state::nc_irq_mask_w) -{ - LOG(("irq mask w: %02x\n", data)); - LOG_DEBUG(("irq mask nc200 w: %02x\n",data & ((1<<4) | (1<<5) | (1<<6) | (1<<7)))); - - /* writing mask clears ints that are to be masked? */ - m_irq_mask = data; - - nc_update_interrupts(); -} - -WRITE8_MEMBER(nc_state::nc_irq_status_w) -{ - LOG(("irq status w: %02x\n", data)); - data = data^0x0ff; - - if (m_type == NC_TYPE_200) - { - /* Russell Marks confirms that on the NC200, the key scan interrupt must be explicitly - cleared. It is not automatically cleared when reading 0x0b9 */ - if ((data & (1<<3))!=0) - { - /* set timer to occur again */ - m_keyboard_timer->reset(attotime::from_msec(10)); - - nc_update_interrupts(); - } - } - - -/* writing to status will clear int, will this re-start the key-scan? */ -#if 0 - if ( - /* clearing keyboard int? */ - ((data & (1<<3))!=0) && - /* keyboard int request? */ - ((m_irq_status & (1<<3))!=0) - ) - { - /* set timer to occur again */ - m_keyboard_timer->reset(attotime::from_msec(10)); - } -#endif - m_irq_status &=~data; - - nc_update_interrupts(); -} - -READ8_MEMBER(nc_state::nc_irq_status_r) -{ - return ~((m_irq_status & (~m_irq_latch_mask)) | m_irq_latch); -} - - -READ8_MEMBER(nc_state::nc_key_data_in_r) -{ - static const char *const keynames[] = { - "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", - "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" - }; - - if (offset==9) - { - /* reading 0x0b9 will clear int and re-start scan procedure! */ - m_irq_status &= ~(1<<3); - - /* set timer to occur again */ - m_keyboard_timer->reset(attotime::from_msec(10)); - - nc_update_interrupts(); - } - - return ioport(keynames[offset])->read(); -} - - -void nc_state::nc_sound_update(int channel) -{ - int on; - int frequency; - int period; - beep_device *beeper_device = NULL; - - switch(channel) - { - case 0: - beeper_device = m_beeper1; - break; - case 1: - beeper_device = m_beeper2; - break; - } - - period = m_sound_channel_periods[channel]; - - /* if top bit is 0, sound is on */ - on = ((period & (1<<15))==0); - - /* calculate frequency from period */ - frequency = (int)(1000000.0f/((float)((period & 0x07fff)<<1) * 1.6276f)); - - /* set state */ - beeper_device->set_state(on); - /* set frequency */ - beeper_device->set_frequency(frequency); -} - -WRITE8_MEMBER(nc_state::nc_sound_w) -{ - LOG(("sound w: %04x %02x\n", offset, data)); - - switch (offset) - { - case 0x0: - { - /* update period value */ - m_sound_channel_periods[0] = - (m_sound_channel_periods[0] & 0x0ff00) | (data & 0x0ff); - - nc_sound_update(0); - } - break; - - case 0x01: - { - m_sound_channel_periods[0] = - (m_sound_channel_periods[0] & 0x0ff) | ((data & 0x0ff)<<8); - - nc_sound_update(0); - } - break; - - case 0x02: - { - /* update period value */ - m_sound_channel_periods[1] = - (m_sound_channel_periods[1] & 0x0ff00) | (data & 0x0ff); - - nc_sound_update(1); - } - break; - - case 0x03: - { - m_sound_channel_periods[1] = - (m_sound_channel_periods[1] & 0x0ff) | ((data & 0x0ff)<<8); - - nc_sound_update(1); - } - break; - - default: - break; - } -} - -static const int baud_rate_table[]= -{ - 128, //150 - 64, //300 - 32, //600 - 16, //1200 - 8, //2400 - 4, //4800 - 2, //9600 - 1, //19200 -}; - -WRITE_LINE_MEMBER(nc_state::write_uart_clock) -{ - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - -WRITE8_MEMBER(nc_state::nc_uart_control_w) -{ - /* same for nc100 and nc200 */ - m_centronics->write_strobe(BIT(data, 6)); - - /* on/off changed state? */ - if (((m_uart_control ^ data) & (1<<3))!=0) - { - /* changed uart from off to on */ - if ((data & (1<<3))==0) - { - machine().device("uart")->reset(); - } - } - - m_uart_clock->set_clock_scale((double)1 / baud_rate_table[(data & 0x07)]); - - m_uart_control = data; -} - -/* NC100 printer emulation */ -/* port 0x040 (write only) = 8-bit printer data */ -/* port 0x030 bit 6 = printer strobe */ - - - -/********************************************************************************************************/ -/* NC100 hardware */ - - - -WRITE8_MEMBER(nc_state::nc100_display_memory_start_w) -{ - /* bit 7: A15 */ - /* bit 6: A14 */ - /* bit 5: A13 */ - /* bit 4: A12 */ - /* bit 3-0: not used */ - m_display_memory_start = (data & 0x0f0)<<(12-4); - - LOG(("disp memory w: %04x\n", (int) m_display_memory_start)); -} - - -WRITE8_MEMBER(nc_state::nc100_uart_control_w) -{ - nc_uart_control_w(space, offset,data); - -// /* is this correct?? */ -// if (data & (1<<3)) -// { -// /* clear latched irq's */ -// m_irq_latch &= ~3; -// nc_update_interrupts(machine); -// } -} - - -WRITE_LINE_MEMBER(nc_state::nc100_tc8521_alarm_callback) -{ - // TODO -} - -WRITE_LINE_MEMBER(nc_state::nc100_txrdy_callback) -{ - m_irq_latch &= ~(1 << 1); - - /* uart on? */ - if ((m_uart_control & (1 << 3)) == 0) - { - if (state) - { - logerror("tx ready\n"); - m_irq_latch |= (1 << 1); - } - } - - nc_update_interrupts(); -} - -WRITE_LINE_MEMBER(nc_state::nc100_rxrdy_callback) -{ - m_irq_latch &= ~(1<<0); - - if ((m_uart_control & (1<<3))==0) - { - if (state) - { - logerror("rx ready\n"); - m_irq_latch |= (1<<0); - } - } - - nc_update_interrupts(); -} - -WRITE_LINE_MEMBER(nc_state::write_nc100_centronics_ack) -{ - m_centronics_ack = state; - - if (state) - m_irq_status |= 0x04; - else - m_irq_status &= ~0x04; - - /* trigger an int if the irq is set */ - nc_update_interrupts(); -} - -WRITE_LINE_MEMBER(nc_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -void nc_state::machine_reset() -{ - /* 256k of rom */ - m_membank_rom_mask = 0x0f; - - m_membank_internal_ram_mask = 3; - - m_membank_card_ram_mask = 0x03f; - - nc_common_init_machine(); - - /* serial */ - m_irq_latch_mask = (1<<0) | (1<<1); -} - -void nc_state::machine_start() -{ - m_type = NC_TYPE_1xx; - - std::string region_tag; - m_card_ram = memregion(region_tag.assign(m_card->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - if (m_card_ram) - m_card_size = m_card_ram->bytes(); - else - m_card_size = 0; - - /* keyboard timer */ - m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this)); - m_keyboard_timer->adjust(attotime::from_msec(10)); - - m_nvram->set_base(m_ram->pointer(), m_ram->size()); -} - - -WRITE8_MEMBER(nc_state::nc100_poweroff_control_w) -{ - /* bits 7-1: not used */ - /* bit 0: 1 = no effect, 0 = power off */ - m_poweroff_control = data; - LOG(("nc poweroff control: %02x\n",data)); -} - - -/* nc100 version of card/battery status */ -READ8_MEMBER(nc_state::nc100_card_battery_status_r) -{ - int nc_card_battery_status = 0x0fc; - - /* printer */ - nc_card_battery_status |= m_centronics_ack; - nc_card_battery_status |= m_centronics_busy << 1; - - if (m_card_status) - { - /* card present */ - nc_card_battery_status &=~(1<<7); - } - - if (ioport("EXTRA")->read() & 0x02) - { - /* card write enable */ - nc_card_battery_status &=~(1<<6); - } - - /* enough power - see bit assignments where - nc card battery status is defined */ - nc_card_battery_status |= (1<<5); - nc_card_battery_status &= ~((1<<2) | (1<<3)); - - return nc_card_battery_status; -} - -WRITE8_MEMBER(nc_state::nc100_memory_card_wait_state_w) -{ - LOG(("nc100 memory card wait state: %02x\n",data)); -} - - - -static ADDRESS_MAP_START(nc100_io, AS_IO, 8, nc_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x0f) AM_WRITE(nc100_display_memory_start_w) - AM_RANGE(0x10, 0x13) AM_READWRITE(nc_memory_management_r, nc_memory_management_w) - AM_RANGE(0x20, 0x20) AM_WRITE(nc100_memory_card_wait_state_w) - AM_RANGE(0x30, 0x30) AM_WRITE(nc100_uart_control_w) - AM_RANGE(0x40, 0x40) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x50, 0x53) AM_WRITE(nc_sound_w) - AM_RANGE(0x60, 0x60) AM_WRITE(nc_irq_mask_w) - AM_RANGE(0x70, 0x70) AM_WRITE(nc100_poweroff_control_w) - AM_RANGE(0x90, 0x90) AM_READWRITE(nc_irq_status_r, nc_irq_status_w) - AM_RANGE(0x91, 0x9f) AM_READ(nc_irq_status_r) - AM_RANGE(0xa0, 0xaf) AM_READ(nc100_card_battery_status_r) - AM_RANGE(0xb0, 0xb9) AM_READ(nc_key_data_in_r) - AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) - AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0xd0, 0xdf) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) -ADDRESS_MAP_END - - -/* 2008-05 FP: -Small note about natural keyboard support (both for nc100 and nc200): currently, -- "Shift" (both L & R) and "Caps Lock" do not work in natural mode (to be investigated) -- "Function" is mapped to 'Left Control' -- "Control" is mapped to 'Right Control' -- "Caps Lock" is mapped to 'Right Alt' -- "On" is mapped to 'F1' -- "Stop" is mapped to 'F2' -- "Symbol" is mapped to 'F3' -- "Menu" is mapped to 'F4' -*/ - -static INPUT_PORTS_START(nc100) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT(0x04, 0x00, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Left (Red)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, 0x00, IPT_UNUSED) - PORT_BIT(0x80, 0x00, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Function (Yellow)") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 5th row, 1st key on left (where 'fn' is on mac keyboards) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10, 0x00, IPT_UNUSED) - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x80, 0x00, IPT_UNUSED) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Symbol") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F3)) // 5th row, 3rd key (where 'Alt' usually stays) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x10, 0x00, IPT_UNUSED) - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, 0x00, IPT_UNUSED) - PORT_BIT(0x80, 0x00, IPT_UNUSED) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, 0x00, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - - PORT_START("LINE5") - PORT_BIT(0x01, 0x00, IPT_UNUSED) - PORT_BIT(0x02, 0x00, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Down (Blue)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del>") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Right (Green)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('~') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('@') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del<") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('8') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - /* these are not part of the nc100 keyboard */ - /* extra */ - PORT_START("EXTRA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("On Button") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F1)) - /* pcmcia memory card setting */ - PORT_DIPNAME( 0x02, 0x002, "PCMCIA Memory card write enable") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) -INPUT_PORTS_END - -/**********************************************************************************************************/ -/* NC150 hardware */ -/* to be completed! */ - -#if 0 -void nc_state::nc150_init_machine() -{ - m_membank_internal_ram_mask = 7; - - m_membank_card_ram_mask = 0x03f; - - nc_common_init_machine(machine); -} -#endif - - - -/**********************************************************************************************************/ -/* NC200 hardware */ - -#ifdef UNUSED_FUNCTION -WRITE8_MEMBER(nc_state::nc200_display_memory_start_w) -{ - /* bit 7: A15 */ - /* bit 6: A14 */ - /* bit 5: A13 */ - /* bit 4-0: not used */ - m_display_memory_start = (data & 0x0e0)<<(12-4); - - LOG(("disp memory w: %04x\n", (int) m_display_memory_start)); -} -#endif - - -WRITE_LINE_MEMBER(nc_state::write_nc200_centronics_ack) -{ - if (state) - m_irq_status |= 0x01; - else - m_irq_status &= ~0x01; - - /* trigger an int if the irq is set */ - nc_update_interrupts(); -} - -/* assumption. nc200 uses the same uart chip. The rxrdy and txrdy are combined -together with a or to generate a single interrupt */ - -void nc_state::nc200_refresh_uart_interrupt() -{ - m_irq_latch &=~(1<<2); - - /* uart enabled? */ - if ((m_uart_control & (1<<3))==0) - { - if ((m_nc200_uart_interrupt_irq & 0x03)!=0) - { - m_irq_latch |= (1<<2); - } - } - nc_update_interrupts(); -} - -WRITE_LINE_MEMBER(nc_state::nc200_txrdy_callback) -{ -// m_nc200_uart_interrupt_irq &=~(1<<0); -// -// if (state) -// { -// m_nc200_uart_interrupt_irq |=(1<<0); -// } -// -// nc200_refresh_uart_interrupt(); -} - -WRITE_LINE_MEMBER(nc_state::nc200_rxrdy_callback) -{ - m_nc200_uart_interrupt_irq &=~(1<<1); - - if (state) - { - m_nc200_uart_interrupt_irq |=(1<<1); - } - - nc200_refresh_uart_interrupt(); -} - -WRITE_LINE_MEMBER( nc_state::nc200_fdc_interrupt ) -{ -#if 0 - m_irq_latch &=~(1<<5); - - if (state) - { - m_irq_latch |=(1<<5); - } -#endif - m_irq_status &=~(1<<5); - - if (state) - { - m_irq_status |=(1<<5); - } - - nc_update_interrupts(); -} - -#ifdef UNUSED_FUNCTION -void nc_state::nc200_floppy_drive_index_callback(int drive_id) -{ - LOG_DEBUG(("nc200 index pulse\n")); -// m_irq_status |= (1<<4); - -// nc_update_interrupts(Machine); -} -#endif - -MACHINE_RESET_MEMBER(nc_state, nc200) -{ - /* 512k of rom */ - m_membank_rom_mask = 0x1f; - - m_membank_internal_ram_mask = 7; - - m_membank_card_ram_mask = 0x03f; - - nc_common_init_machine(); - - m_nc200_uart_interrupt_irq = 0; - - /* fdc, serial */ - m_irq_latch_mask = /*(1<<5) |*/ (1<<2); - - nc200_video_set_backlight(0); -} - -MACHINE_START_MEMBER(nc_state, nc200) -{ - m_type = NC_TYPE_200; - - std::string region_tag; - m_card_ram = memregion(region_tag.assign(m_card->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - if (m_card_ram) - m_card_size = m_card_ram->bytes(); - else - m_card_size = 0; - - /* keyboard timer */ - m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this)); - m_keyboard_timer->adjust(attotime::from_msec(10)); - - m_nvram->set_base(m_ram->pointer(), m_ram->size()); -} - -/* -NC200: - - bit 7: memory card present 0 = yes, 1 = no - bit 6: memory card write protected 1=yes 0=no - bit 5: lithium battery 0 if >= 2.7 volts - bit 4: input voltage = 1, if >= to 4 volts - bit 3: ?? - bit 2: alkaline batteries. 0 if >=3.2 volts - bit 1: ?? - bit 0: battery power: if 1: batteries are too low for disk usage, if 0: batteries ok for disc usage -*/ - - -/* nc200 version of card/battery status */ -READ8_MEMBER(nc_state::nc200_card_battery_status_r) -{ - int nc_card_battery_status = 0x0ff; - - /* enough power */ - - /* input voltage ok */ - nc_card_battery_status |=(1<<4); - /* lithium batteries and alkaline batteries have enough power, - and there is enough power for disk usage */ - nc_card_battery_status &=~((1<<5) | (1<<2) | (1<<0)); - - if (m_card_status) - { - /* card present */ - nc_card_battery_status&=~(1<<7); - } - - if (ioport("EXTRA")->read() & 0x02) - { - /* card write enable */ - nc_card_battery_status &=~(1<<6); - } - - return nc_card_battery_status; -} - - -/* port &80: - - bit 0: Parallel interface BUSY - */ - -READ8_MEMBER(nc_state::nc200_printer_status_r) -{ - UINT8 result = 0; - - result |= m_centronics_busy; - - return result; -} - - -WRITE8_MEMBER(nc_state::nc200_uart_control_w) -{ - /* int reset_fdc = (m_uart_control^data) & (1<<5); */ - - nc_uart_control_w(space, offset,data); - - if (data & (1<<3)) - { - m_nc200_uart_interrupt_irq &=~3; - - nc200_refresh_uart_interrupt(); - } - - /* bit 5 is used in disk interface */ - LOG_DEBUG(("bit 5: PC: %04x %02x\n", m_maincpu->pc(), data & (1 << 5))); -} - - -/* bit 7: same as nc100 */ -/* bit 2: ?? */ -/* bit 1: ?? */ -/* %10000110 = 0x086 */ -/* %10000010 = 0x082 */ -/* %10000011 = 0x083 */ -/* writes 86,82 */ - -/* bit 7: nc200 power control: 1=on, 0=off */ -/* bit 1: disk motor?? */ -/* bit 0: UPD765 Terminal Count input */ - -WRITE8_MEMBER(nc_state::nc200_memory_card_wait_state_w) -{ - upd765a_device *fdc = machine().device("upd765"); - LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n", m_maincpu->pc(), data)); -#if 0 - floppy_drive_set_motor_state(0, 1); - floppy_drive_set_ready_state(0, 1, 1); -#endif - fdc->tc_w(data & 0x01); -} - -/* bit 2: backlight: 1=off, 0=on */ -/* bit 1 cleared to zero in disk code */ -/* bit 0 seems to be the same as nc100 */ -WRITE8_MEMBER(nc_state::nc200_poweroff_control_w) -{ - LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", m_maincpu->pc(), data)); - - nc200_video_set_backlight(((data ^ (1 << 2)) >> 2) & 0x01); -} - -static ADDRESS_MAP_START(nc200_io, AS_IO, 8, nc_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x0f) AM_WRITE(nc100_display_memory_start_w) - AM_RANGE(0x10, 0x13) AM_READWRITE(nc_memory_management_r, nc_memory_management_w) - AM_RANGE(0x20, 0x20) AM_WRITE(nc200_memory_card_wait_state_w) - AM_RANGE(0x30, 0x30) AM_WRITE(nc200_uart_control_w) - AM_RANGE(0x40, 0x40) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x50, 0x53) AM_WRITE(nc_sound_w) - AM_RANGE(0x60, 0x60) AM_WRITE(nc_irq_mask_w) - AM_RANGE(0x70, 0x70) AM_WRITE(nc200_poweroff_control_w) - AM_RANGE(0x80, 0x80) AM_READ(nc200_printer_status_r) - AM_RANGE(0x90, 0x90) AM_READWRITE(nc_irq_status_r, nc_irq_status_w) - AM_RANGE(0xa0, 0xa0) AM_READ(nc200_card_battery_status_r) - AM_RANGE(0xb0, 0xb9) AM_READ(nc_key_data_in_r) - AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) - AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0xd0, 0xd1) AM_DEVREADWRITE("mc", mc146818_device, read, write) - AM_RANGE(0xe0, 0xe1) AM_DEVICE("upd765", upd765a_device, map) -ADDRESS_MAP_END - -static INPUT_PORTS_START(nc200) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Left (Red)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, 0x00, IPT_UNUSED) - PORT_BIT(0x80, 0x00, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Function (Yellow)") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 5th row, 1st key on left (where 'fn' is on mac keyboards) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10, 0x00, IPT_UNUSED) - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, 0x00, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Symbol") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F3)) // 5th row, 3rd key (where 'Alt' usually stays) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x80, 0x00, IPT_UNUSED) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x20, 0x00, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - - PORT_START("LINE5") - PORT_BIT(0x01, 0x00, IPT_UNUSED) - PORT_BIT(0x02, 0x00, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("LINE6") - PORT_BIT(0x01, 0x00, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Down (Blue)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del>") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Right (Green)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('~') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("LINE7") - PORT_BIT(0x01, 0x00, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Up (White)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("LINE8") - PORT_BIT(0x01, 0x00, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('@') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("LINE9") - PORT_BIT(0x01, 0x00, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del<") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('8') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - /* not part of the nc200 keyboard */ - PORT_START("EXTRA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("On Button") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F1)) - /* pcmcia memory card setting */ - PORT_DIPNAME( 0x02, 0x002, "PCMCIA Memory card write enable") - PORT_DIPSETTING( 0x00, DEF_STR( Off) ) - PORT_DIPSETTING( 0x02, DEF_STR( On) ) -INPUT_PORTS_END - -/**********************************************************************************************************/ - -static MACHINE_CONFIG_START( nc100, nc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, /*6000000*/ 4606000) /* Russell Marks says this is more accurate */ - MCFG_CPU_PROGRAM_MAP(nc_map) - MCFG_CPU_IO_MAP(nc100_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(480, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 64-1) - MCFG_SCREEN_UPDATE_DRIVER(nc_state, screen_update_nc) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", NC_NUM_COLOURS) - MCFG_PALETTE_INIT_OWNER(nc_state, nc) - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beep.1", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("beep.2", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(nc_state, write_nc100_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(nc_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* uart */ - MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(nc_state,nc100_rxrdy_callback)) - MCFG_I8251_TXRDY_HANDLER(WRITELINE(nc_state,nc100_txrdy_callback)) - - MCFG_DEVICE_ADD("uart_clock", CLOCK, 19200) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(nc_state, write_uart_clock)) - - /* rtc */ - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) - MCFG_RP5C01_OUT_ALARM_CB(WRITELINE(nc_state, nc100_tc8521_alarm_callback)) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_plain_slot, NULL) - MCFG_GENERIC_LOAD(nc_state, nc_pcmcia_card) - MCFG_GENERIC_UNLOAD(nc_state, nc_pcmcia_card) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_NVRAM_ADD_NO_FILL("nvram") - - /* dummy timer */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("dummy_timer", nc_state, dummy_timer_callback, attotime::from_hz(50)) -MACHINE_CONFIG_END - -static const floppy_format_type ibmpc_floppy_formats[] = { - FLOPPY_PC_FORMAT, - FLOPPY_MFI_FORMAT, - NULL -}; - -static SLOT_INTERFACE_START( ibmpc_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_DERIVED( nc200, nc100 ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_IO_MAP(nc200_io) - - MCFG_MACHINE_START_OVERRIDE(nc_state, nc200) - MCFG_MACHINE_RESET_OVERRIDE(nc_state, nc200) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(NC200_SCREEN_WIDTH, NC200_SCREEN_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, NC200_SCREEN_WIDTH-1, 0, NC200_SCREEN_HEIGHT-1) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(NC200_NUM_COLOURS) - MCFG_PALETTE_INIT_OWNER(nc_state, nc) - - /* printer */ - MCFG_DEVICE_MODIFY("centronics") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(nc_state, write_nc200_centronics_ack)) - - /* uart */ - MCFG_DEVICE_MODIFY("uart") - MCFG_I8251_RXRDY_HANDLER(WRITELINE(nc_state,nc200_rxrdy_callback)) - MCFG_I8251_TXRDY_HANDLER(WRITELINE(nc_state,nc200_txrdy_callback)) - - /* no rtc */ - MCFG_DEVICE_REMOVE("rtc") - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(nc_state, nc200_fdc_interrupt)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", ibmpc_floppies, "525dd", ibmpc_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", ibmpc_floppies, "525dd", ibmpc_floppy_formats) - - MCFG_MC146818_ADD( "mc", XTAL_4_194304Mhz ) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(nc100) - ROM_REGION(((64*1024)+(256*1024)), "maincpu",0) - ROM_SYSTEM_BIOS(0, "106", "ROM v1.06") - ROMX_LOAD("nc100a.rom", 0x010000, 0x040000, CRC(849884f9) SHA1(ff030dd334ca867d620ee4a94b142ef0d93b69b6), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "102dk", "ROM v1.02 Danish") - ROMX_LOAD("nc100_dk_a1.rom", 0x010000, 0x040000, CRC(ebb54923) SHA1(30321011384c5e10204b9a837430c36fc63580d2), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "102de", "ROM v1.02 German") - ROMX_LOAD("nc100_de_a1.rom", 0x010000, 0x040000, CRC(bd9ce223) SHA1(2efb26911832bf1456d76d2508e24c0733dc216d), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "100", "ROM v1.00") - ROMX_LOAD("nc100.rom", 0x010000, 0x040000, CRC(a699eca3) SHA1(ce217d5a298b959ccc3d7bc5c93b1dba043f1339), ROM_BIOS(4)) -ROM_END - - -ROM_START(dw225) - ROM_REGION(((64*1024)+(512*1024)), "maincpu",0) - ROM_LOAD("dr (1.06).ic303", 0x010000, 0x080000, CRC(fcf2f7bd) SHA1(a69951618b24e97154cb4284d215cbf4aa9fb34f)) -ROM_END - - -ROM_START(nc150) - ROM_REGION(((64*1024)+(512*1024)), "maincpu",0) - ROM_SYSTEM_BIOS(0, "b2", "French B2") - ROMX_LOAD("nc150_fr_b2.rom", 0x010000, 0x080000, CRC(be442d14) SHA1(f141d409dc72dc1e6662c21a147231c4df3be6b8), ROM_BIOS(1)) /* French */ - ROM_SYSTEM_BIOS(1, "b1", "Italian B1") - ROMX_LOAD("nc150_it_b1.rom", 0x010000, 0x080000, CRC(1b2fe2fd) SHA1(67eb6bce0b0d4668401d9c8f5a900dc6bd135c21), ROM_BIOS(2)) /* Italian */ -ROM_END - - -ROM_START(nc200) - ROM_REGION(((64*1024)+(512*1024)), "maincpu",0) - ROM_LOAD("nc200.rom", 0x010000, 0x080000, CRC(bb8180e7) SHA1(fb5c93b0a3e199202c6a12548d2617f7a09bae47)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1992, nc100, 0, 0, nc100, nc100, nc_state, nc, "Amstrad plc", "NC100", 0 ) -COMP( 1992, dw225, nc100, 0, nc100, nc100, nc_state, nc, "NTS Computer Systems", "DreamWriter 225", 0 ) -COMP( 1992, nc150, nc100, 0, nc100, nc100, nc_state, nc, "Amstrad plc", "NC150", 0 ) -COMP( 1993, nc200, 0, 0, nc200, nc200, nc_state, nc, "Amstrad plc", "NC200", MACHINE_NOT_WORKING ) // boot hangs while checking the MC146818 UIP (update in progress) bit diff --git a/src/mess/drivers/nes.c b/src/mess/drivers/nes.c deleted file mode 100644 index 124749f07b0..00000000000 --- a/src/mess/drivers/nes.c +++ /dev/null @@ -1,347 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Brad Oliver,Fabio Priuli -/*************************************************************************** - - nes.c - - Driver file to handle emulation of the Nintendo Entertainment System (Famicom). - - MESS driver by Brad Oliver (bradman@pobox.com), NES sound code by Matt Conte. - Based in part on the old xNes code, by Nicolas Hamel, Chuck Mason, Brad Oliver, - Richard Bannister and Jeff Mitchell. - -***************************************************************************/ - -#include "emu.h" -#include "includes/nes.h" -#include "cpu/m6502/n2a03.h" - -READ8_MEMBER(nes_state::psg_4015_r) -{ - return m_sound->read(space, 0x15); -} - -WRITE8_MEMBER(nes_state::psg_4015_w) -{ - m_sound->write(space, 0x15, data); -} - -WRITE8_MEMBER(nes_state::psg_4017_w) -{ - m_sound->write(space, 0x17, data); -} - -WRITE8_MEMBER(nes_state::nes_vh_sprite_dma_w) -{ - m_ppu->spriteram_dma(space, data); -} - -static ADDRESS_MAP_START( nes_map, AS_PROGRAM, 8, nes_state ) - AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) /* RAM */ - AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write) /* PPU registers */ - AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nessound", nesapu_device, read, write) /* PSG primary registers */ - AM_RANGE(0x4014, 0x4014) AM_WRITE(nes_vh_sprite_dma_w) /* stupid address space hole */ - AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */ - AM_RANGE(0x4016, 0x4016) AM_READWRITE(nes_in0_r, nes_in0_w) /* IN0 - input port 1 */ - AM_RANGE(0x4017, 0x4017) AM_READ(nes_in1_r) /* IN1 - input port 2 */ - AM_RANGE(0x4017, 0x4017) AM_WRITE(psg_4017_w) /* PSG second control register */ - // 0x4100-0x5fff -> LOW HANDLER defined on a pcb base - // 0x6000-0x7fff -> MID HANDLER defined on a pcb base - // 0x8000-0xffff -> HIGH HANDLER defined on a pcb base -ADDRESS_MAP_END - -static INPUT_PORTS_START( nes ) - // input devices go through slot options - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x00, "Draw Top/Bottom 8 Lines") - PORT_CONFSETTING( 0x01, DEF_STR(No) ) - PORT_CONFSETTING( 0x00, DEF_STR(Yes) ) - PORT_CONFNAME( 0x02, 0x00, "Enforce 8 Sprites/line") - PORT_CONFSETTING( 0x02, DEF_STR(No) ) - PORT_CONFSETTING( 0x00, DEF_STR(Yes) ) -INPUT_PORTS_END - -static INPUT_PORTS_START( famicom ) - // input devices go through slot options - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x00, "Draw Top/Bottom 8 Lines") - PORT_CONFSETTING( 0x01, DEF_STR(No) ) - PORT_CONFSETTING( 0x00, DEF_STR(Yes) ) - PORT_CONFNAME( 0x02, 0x00, "Enforce 8 Sprites/line") - PORT_CONFSETTING( 0x02, DEF_STR(No) ) - PORT_CONFSETTING( 0x00, DEF_STR(Yes) ) - - PORT_START("FLIPDISK") /* fake key */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Change Disk Side") PORT_CODE(KEYCODE_SPACE) -INPUT_PORTS_END - - -void nes_state::ppu_nmi(int *ppu_regs) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - - -static MACHINE_CONFIG_START( nes, nes_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", N2A03, NTSC_CLOCK) - MCFG_CPU_PROGRAM_MAP(nes_map) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60.098) - // This isn't used so much to calulate the vblank duration (the PPU code tracks that manually) but to determine - // the number of cycles in each scanline for the PPU scanline timer. Since the PPU has 20 vblank scanlines + 2 - // non-rendering scanlines, we compensate. This ends up being 2500 cycles for the non-rendering portion, 2273 - // cycles for the actual vblank period. - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((113.66/(NTSC_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_NTSC-PPU_VBLANK_FIRST_SCANLINE+1+2))) - MCFG_SCREEN_SIZE(32*8, 262) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(nes_state, screen_update_nes) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 4*16*8) - MCFG_PALETTE_INIT_OWNER(nes_state, nes) - - MCFG_PPU2C02_ADD("ppu") - MCFG_PPU2C0X_CPU("maincpu") - MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("nessound", NES_APU, NTSC_CLOCK) - MCFG_NES_APU_CPU("maincpu") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) - - MCFG_NES_CONTROL_PORT_ADD("ctrl1", nes_control_port1_devices, "joypad") - MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel) - MCFG_NES_CONTROL_PORT_ADD("ctrl2", nes_control_port2_devices, "joypad") - MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel) - - MCFG_NES_CARTRIDGE_ADD("nes_slot", nes_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list", "nes") - MCFG_SOFTWARE_LIST_ADD("ade_list", "nes_ade") // Camerica/Codemasters Aladdin Deck Enhancer mini-carts - MCFG_SOFTWARE_LIST_ADD("ntb_list", "nes_ntbrom") // Sunsoft Nantettate! Baseball mini-carts - MCFG_SOFTWARE_LIST_ADD("kstudio_list", "nes_kstudio") // Bandai Karaoke Studio expansion carts - MCFG_SOFTWARE_LIST_ADD("datach_list", "nes_datach") // Bandai Datach Joint ROM System mini-carts -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nespal, nes ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(PAL_CLOCK) - - MCFG_DEVICE_REMOVE("ppu") - MCFG_PPU2C07_ADD("ppu") - MCFG_PPU2C0X_CPU("maincpu") - MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(53.355) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((106.53/(PAL_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE+1+2))) - MCFG_SCREEN_SIZE(32*8, 312) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - - /* sound hardware */ - MCFG_SOUND_REPLACE("nessound", NES_APU, PAL_CLOCK) - MCFG_NES_APU_CPU("maincpu") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dendy, nes ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_CLOCK( 26601712/15 ) /* 26.601712MHz / 15 == 1.77344746666... MHz */ - - MCFG_DEVICE_REMOVE("ppu") - MCFG_PPU2C07_ADD("ppu") - MCFG_PPU2C0X_CPU("maincpu") - MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(50.00697796827) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((106.53/(PAL_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE+1+2))) - - /* sound hardware */ - MCFG_SOUND_REPLACE("nessound", NES_APU, 26601712/15) /* 26.601712MHz / 15 == 1.77344746666... MHz */ - MCFG_NES_APU_CPU("maincpu") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( famicom, nes ) - MCFG_DEVICE_REMOVE("ctrl1") - MCFG_DEVICE_REMOVE("ctrl2") - MCFG_NES_CONTROL_PORT_ADD("ctrl1", fc_control_port1_devices, "joypad") - MCFG_NES_CONTROL_PORT_ADD("ctrl2", fc_control_port2_devices, "joypad") - MCFG_FC_EXPANSION_PORT_ADD("exp", fc_expansion_devices, NULL) - MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "famicom_flop") - MCFG_SOFTWARE_LIST_ADD("cass_list", "famicom_cass") -MACHINE_CONFIG_END - -void nes_state::setup_disk(nes_disksys_device *slot) -{ - if (slot) - { - address_space &space = m_maincpu->space(AS_PROGRAM); - - // Set up memory handlers - space.install_read_handler(0x4020, 0x40ff, read8_delegate(FUNC(nes_disksys_device::read_ex), (nes_disksys_device *)slot)); - space.install_write_handler(0x4020, 0x40ff, write8_delegate(FUNC(nes_disksys_device::write_ex), (nes_disksys_device *)slot)); - space.install_read_handler(0x4100, 0x5fff, read8_delegate(FUNC(device_nes_cart_interface::read_l), (device_nes_cart_interface *)slot)); - space.install_write_handler(0x4100, 0x5fff, write8_delegate(FUNC(device_nes_cart_interface::write_l), (device_nes_cart_interface *)slot)); - space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(nes_disksys_device::read_m), (nes_disksys_device *)slot)); - space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(nes_disksys_device::write_m), (nes_disksys_device *)slot)); - space.install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(nes_disksys_device::read_h), (nes_disksys_device *)slot)); - space.install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(nes_disksys_device::write_h), (nes_disksys_device *)slot)); - - slot->vram_alloc(0x2000); - slot->prgram_alloc(0x8000); - - slot->pcb_start(machine(), m_ciram, FALSE); - m_ppu->space(AS_PROGRAM).install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(device_nes_cart_interface::chr_r),(device_nes_cart_interface *)slot), write8_delegate(FUNC(device_nes_cart_interface::chr_w),(device_nes_cart_interface *)slot)); - m_ppu->space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(device_nes_cart_interface::nt_r),(device_nes_cart_interface *)slot), write8_delegate(FUNC(device_nes_cart_interface::nt_w),(device_nes_cart_interface *)slot)); - m_ppu->set_scanline_callback(ppu2c0x_scanline_delegate(FUNC(device_nes_cart_interface::scanline_irq),(device_nes_cart_interface *)slot)); - m_ppu->set_hblank_callback(ppu2c0x_hblank_delegate(FUNC(nes_disksys_device::hblank_irq),(nes_disksys_device *)slot)); - m_ppu->set_latch(ppu2c0x_latch_delegate(FUNC(device_nes_cart_interface::ppu_latch),(device_nes_cart_interface *)slot)); - } -} - - -MACHINE_START_MEMBER( nes_state, fds ) -{ - m_ciram = auto_alloc_array(machine(), UINT8, 0x800); - m_io_disksel = ioport("FLIPDISK"); - setup_disk(m_disk); - - // register saves - save_item(NAME(m_last_frame_flip)); - save_pointer(NAME(m_ciram), 0x800); -} - -MACHINE_RESET_MEMBER( nes_state, fds ) -{ - // Reset the mapper variables - m_disk->pcb_reset(); - - // the rest is the same as for nes/famicom/dendy - m_maincpu->reset(); -} - -static MACHINE_CONFIG_DERIVED( fds, famicom ) - MCFG_MACHINE_START_OVERRIDE( nes_state, fds ) - MCFG_MACHINE_RESET_OVERRIDE( nes_state, fds ) - - MCFG_DEVICE_REMOVE("nes_slot") - MCFG_DEVICE_ADD("disk", NES_DISKSYS, 0) - - MCFG_DEVICE_REMOVE("cart_list") - MCFG_DEVICE_REMOVE("cass_list") -MACHINE_CONFIG_END - - -MACHINE_START_MEMBER( nes_state, famitwin ) -{ - // start the base nes stuff - machine_start(); - - // if there is no cart inserted, setup the disk expansion instead - if (!m_cartslot->exists()) - { - setup_disk(m_disk); - - // replace the famicom disk ROM with the famicom twin one (until we modernize the floppy drive) - m_maincpu->space(AS_PROGRAM).install_read_bank(0xe000, 0xffff, "ftbios"); - membank("ftbios")->set_base(machine().root_device().memregion("maincpu")->base() + 0xe000); - } -} - -MACHINE_RESET_MEMBER( nes_state, famitwin ) -{ - // Reset the mapper variables. Will also mark the char-gen ram as dirty - m_cartslot->pcb_reset(); - // if there is no cart inserted, initialize the disk expansion instead - if (!m_cartslot->exists()) - m_disk->pcb_reset(); - - // the rest is the same as for nes/famicom/dendy - m_maincpu->reset(); -} - -static MACHINE_CONFIG_DERIVED( famitwin, famicom ) - - MCFG_MACHINE_START_OVERRIDE( nes_state, famitwin ) - MCFG_MACHINE_RESET_OVERRIDE( nes_state, famitwin ) - - MCFG_DEVICE_MODIFY("nes_slot") - MCFG_NES_CARTRIDGE_NOT_MANDATORY - - MCFG_DEVICE_ADD("disk", NES_DISKSYS, 0) -MACHINE_CONFIG_END - - - -ROM_START( nes ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ -ROM_END - -ROM_START( nespal ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ -ROM_END - -ROM_START( famicom ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ -ROM_END - -#define rom_fds rom_famicom - -ROM_START( famitwin ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Main RAM */ - ROM_LOAD( "rp2c33a-02.bin", 0xe000, 0x2000, CRC(4df24a6c) SHA1(e4e41472c454f928e53eb10e0509bf7d1146ecc1) ) // "Famicom" logo instead of Nintendo logo -ROM_END - -ROM_START( m82 ) - ROM_REGION( 0x14000, "maincpu", 0 ) /* Main RAM + program banks */ - /* Banks to be mapped at 0xe000? More investigations needed... */ - ROM_LOAD( "m82_v1_0.bin", 0x10000, 0x4000, CRC(7d56840a) SHA1(cbd2d14fa073273ba58367758f40d67fd8a9106d) ) -ROM_END - -// see http://www.disgruntleddesigner.com/chrisc/drpcjr/index.html -// and http://www.disgruntleddesigner.com/chrisc/drpcjr/DrPCJrMemMap.txt -ROM_START( drpcjr ) - ROM_REGION( 0x18000, "maincpu", 0 ) /* Main RAM + program banks */ - /* 4 banks to be mapped in 0xe000-0xffff (or 8 banks to be mapped in 0xe000-0xefff & 0xf000-0xffff). - Banks selected by writing at 0x4180 */ - ROM_LOAD("drpcjr_bios.bin", 0x10000, 0x8000, CRC(c8fbef89) SHA1(2cb0a817b31400cdf27817d09bae7e69f41b062b) ) // bios vers. 1.0a - // Not sure if we should support this: hacked version 1.5a by Chris Covell with bugfixes and GameGenie support -// ROM_LOAD("drpcjr_v1_5_gg.bin", 0x10000, 0x8000, CRC(98f2033b) SHA1(93c114da787a19279d1a46667c2f69b49e25d4f1) ) -ROM_END - -ROM_START( dendy ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ -ROM_END - -ROM_START( gchinatv ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1985, nes, 0, 0, nes, nes, driver_device, 0, "Nintendo", "Nintendo Entertainment System / Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1987, nespal, nes, 0, nespal, nes, driver_device, 0, "Nintendo", "Nintendo Entertainment System (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1983, famicom, nes, 0, famicom, famicom, nes_state, famicom, "Nintendo", "Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1983, fds, nes, 0, fds, famicom, nes_state, famicom, "Nintendo", "Famicom (w/ Disk System add-on)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1986, famitwin, nes, 0, famitwin, famicom, nes_state, famicom, "Sharp", "Famicom Twin", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 198?, m82, nes, 0, nes, nes, driver_device, 0, "Nintendo", "M82 Display Unit", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -CONS( 1996, drpcjr, nes, 0, famicom, famicom, nes_state, famicom, "Bung", "Doctor PC Jr", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1992, dendy, nes, 0, dendy, nes, driver_device, 0, "Steepler", "Dendy Classic", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 198?, gchinatv, nes, 0, nespal, nes, driver_device, 0, "Golden China", "Golden China TV Game", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/newbrain.c b/src/mess/drivers/newbrain.c deleted file mode 100644 index 84699034a75..00000000000 --- a/src/mess/drivers/newbrain.c +++ /dev/null @@ -1,1493 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "includes/newbrain.h" -#include "formats/mfi_dsk.h" - -/* - - NewBrain - Grundy Business Systems Ltd. - - 32K RAM - 28K ROM - - Z80 @ 2MHz - COP420 @ 2MHz - - Z80 @ 4MHz (416): INT/NMI=+5V, WAIT=EXTBUSRQ|BUSAKD, RESET=_FDC RESET, - NEC 765AC @ 4 MHz (418) - MC6850 ACIA (459) - Z80CTC (458) - ADC0809 (427) - DAC0808 (461) - - Models according to the Software Technical Manual: - - Model M: 'Page Register', Expansion Port onto Z80 bus, Video, ACIA/CTC, User Port - Model A: Expansion Port, Video, no User Port but has software driver serial port - s/w Printer, s/w V24 - Model V: ACIA/CTC, User Port - -*/ - -/* - - TODO: - - - bitmapped graphics mode - - COP420 microbus access - - escape key is missing - - CP/M 2.2 ROMs - - floppy disc controller - - convert FDC into a device - - convert EIM into a device - - - Micropage ROM/RAM card - - Z80 PIO board - - peripheral (PI) box - - sound card - -*/ - -void newbrain_state::check_interrupt() -{ - int level = (!m_clkint || !m_copint) ? ASSERT_LINE : CLEAR_LINE; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, level); -} - -/* Bank Switching */ - -#define memory_install_unmapped(program, bank, bank_start, bank_end) \ - program.unmap_readwrite(bank_start, bank_end); - -#define memory_install_rom_helper(program, bank, bank_start, bank_end) \ - program.install_read_bank(bank_start, bank_end, bank); \ - program.unmap_write(bank_start, bank_end); - -#define memory_install_ram_helper(program, bank, bank_start, bank_end) \ - program.install_readwrite_bank(bank_start, bank_end, bank); - -void newbrain_eim_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - int bank; - - for (bank = 1; bank < 9; bank++) - { - int page = (m_a16 << 3) | bank; - UINT8 data = ~m_pr[page]; - int ch = (data >> 3) & 0x03; - int eim_bank = data & 0x07; - - UINT16 eim_bank_start = eim_bank * 0x2000; - UINT16 bank_start = (bank - 1) * 0x2000; - UINT16 bank_end = bank_start + 0x1fff; - char bank_name[10]; - sprintf(bank_name,"bank%d",bank); - switch (ch) - { - case 0: - /* ROM */ - memory_install_rom_helper(program, bank_name, bank_start, bank_end); - membank(bank_name)->configure_entry(0, m_eim_rom->base() + eim_bank_start); - break; - - case 2: - /* RAM */ - memory_install_ram_helper(program, bank_name, bank_start, bank_end); - membank(bank_name)->configure_entry(0, m_eim_ram + eim_bank_start); - break; - - default: - logerror("Invalid memory channel %u!\n", ch); - break; - } - } -} - -void newbrain_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - int bank; - - for (bank = 1; bank < 9; bank++) - { - UINT16 bank_start = (bank - 1) * 0x2000; - UINT16 bank_end = bank_start + 0x1fff; - char bank_name[10]; - sprintf(bank_name,"bank%d",bank); - - if (m_pwrup) - { - /* all banks point to ROM at 0xe000 */ - memory_install_rom_helper(program, bank_name, bank_start, bank_end); - membank(bank_name)->configure_entry(0, m_rom->base() + 0xe000); - } - else - { - membank(bank_name)->configure_entry(0, m_rom->base() + bank_start); - - if (bank < 5) - { - /* bank is RAM */ - memory_install_ram_helper(program, bank_name, bank_start, bank_end); - } - else if (bank == 5) - { - /* 0x8000-0x9fff */ - if (m_eim_rom) - { - /* expansion interface ROM */ - memory_install_rom_helper(program, bank_name, bank_start, bank_end); - membank(bank_name)->configure_entry(0, m_eim_rom->base() + 0x4000); - } - else - { - /* mirror of 0xa000-0xbfff */ - if (m_rom->base()[0xa001] == 0) - { - /* unmapped on the M model */ - memory_install_unmapped(program, bank_name, bank_start, bank_end); - } - else - { - /* bank is ROM on the A model */ - memory_install_rom_helper(program, bank_name, bank_start, bank_end); - } - - membank(bank_name)->configure_entry(0, m_rom->base() + 0xa000); - } - } - else if (bank == 6) - { - /* 0xa000-0xbfff */ - if (m_rom->base()[0xa001] == 0) - { - /* unmapped on the M model */ - memory_install_unmapped(program, bank_name, bank_start, bank_end); - } - else - { - /* bank is ROM on the A model */ - memory_install_rom_helper(program, bank_name, bank_start, bank_end); - } - } - else - { - /* bank is ROM */ - memory_install_rom_helper(program, bank_name, bank_start, bank_end); - } - } - - membank(bank_name)->set_entry(0); - } -} - -/* Enable/Status */ - -WRITE8_MEMBER( newbrain_state::enrg1_w ) -{ - /* - - bit signal description - - 0 _CLK enable frame frequency clock interrupts - 1 enable user interrupt - 2 TVP enable video display - 3 enable V24 - 4 V24 Select Receive Bit 0 - 5 V24 Select Receive Bit 1 - 6 V24 Select Transmit Bit 0 - 7 V24 Select Transmit Bit 1 - - */ - - m_enrg1 = data; -} - -WRITE8_MEMBER( newbrain_state::a_enrg1_w ) -{ - /* - - bit signal description - - 0 _CLK Clock Enable - 1 - 2 TVP TV Enable - 3 IOPOWER - 4 _CTS Clear to Send V24 - 5 DO Transmit Data V24 - 6 - 7 PO Transmit Data Printer - - */ - - m_enrg1 = data; -} - -READ8_MEMBER( newbrain_state::ust_r ) -{ - /* - - bit signal description - - 0 variable - 1 variable - 2 MNS mains present - 3 _USRINT0 user status - 4 _USRINT user interrupt - 5 _CLKINT clock interrupt - 6 _ACINT ACIA interrupt - 7 _COPINT COP interrupt - - */ - - UINT8 data = (m_copint << 7) | (m_aciaint << 6) | (m_clkint << 5) | (m_userint << 4) | 0x04; - - switch ((m_enrg1 & NEWBRAIN_ENRG1_UST_BIT_0_MASK) >> 6) - { - case 0: - // excess, 1=24, 0=4 - if (m_tvctl & NEWBRAIN_VIDEO_32_40) - { - data |= 0x01; - } - break; - - case 1: - // characters per line, 1=40, 0=80 - if (m_tvctl & NEWBRAIN_VIDEO_80L) - { - data |= 0x01; - } - break; - - case 2: - // tape in - break; - - case 3: - // calling indicator - break; - } - - switch ((m_enrg1 & NEWBRAIN_ENRG1_UST_BIT_1_MASK) >> 4) - { - case 0: - // PWRUP, if set indicates that power is supplied to Z80 and memory - if (m_pwrup) - { - data |= 0x02; - } - break; - - case 1: - // TVCNSL, if set then processor has video device as primary console output - if (m_tvcnsl) - { - data |= 0x02; - } - break; - - case 2: - // _BEE, if set then processor is Model A type - if (m_bee) - { - data |= 0x02; - } - break; - - case 3: - // _CALLIND, calling indicator - data |= 0x02; - break; - } - - return data; -} - -READ8_MEMBER( newbrain_state::a_ust_r ) -{ - /* - - bit signal description - - 0 +5V - 1 PWRUP - 2 - 3 - 4 - 5 _CLKINT clock interrupt - 6 - 7 _COPINT COP interrupt - - */ - - return (m_copint << 7) | (m_clkint << 5) | (m_pwrup << 1) | 0x01; -} - -READ8_MEMBER( newbrain_state::user_r ) -{ - /* - - bit signal description - - 0 RDDK Received Data V24 - 1 _CTSD _Clear to Send V24 - 2 - 3 - 4 - 5 TPIN Tape in - 6 - 7 _CTSP _Clear to Send Printer - - */ - - m_user = 0; - - return 0xff; -} - -WRITE8_MEMBER( newbrain_state::user_w ) -{ - m_user = data; -} - -/* Interrupts */ - -READ8_MEMBER( newbrain_state::clclk_r ) -{ - m_clkint = 1; - check_interrupt(); - - return 0xff; -} - -WRITE8_MEMBER( newbrain_state::clclk_w ) -{ - m_clkint = 1; - check_interrupt(); -} - -READ8_MEMBER( newbrain_state::clusr_r ) -{ - m_userint = 1; - - return 0xff; -} - -WRITE8_MEMBER( newbrain_state::clusr_w ) -{ - m_userint = 1; -} - -/* COP420 */ - -READ8_MEMBER( newbrain_state::cop_l_r ) -{ - // connected to the Z80 data bus - return m_cop_bus; -} - -WRITE8_MEMBER( newbrain_state::cop_l_w ) -{ - // connected to the Z80 data bus - m_cop_bus = data; -} - -WRITE8_MEMBER( newbrain_state::cop_g_w ) -{ - /* - - bit description - - G0 _COPINT - G1 _TM1 - G2 not connected - G3 _TM2 - - */ - - m_copint = BIT(data, 0); - check_interrupt(); - - /* tape motor enable */ - - m_cassette1->change_state(BIT(data,1) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_cassette2->change_state(BIT(data,3) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); -} - -READ8_MEMBER( newbrain_state::cop_g_r ) -{ - /* - - bit description - - G0 not connected - G1 K9 - G2 K7 - G3 K3 - - */ - - return (BIT(m_keydata, 3) << 3) | (BIT(m_keydata, 0) << 2) | (BIT(m_keydata, 1) << 1); -} - -WRITE8_MEMBER( newbrain_state::cop_d_w ) -{ - /* - bit description - - D0 inverted to K4 -> CD4024 pin 2 (reset) - D1 TDO - D2 inverted to K6 -> CD4024 pin 1 (clock), CD4076 pin 7 (clock), inverted to DS8881 pin 3 (enable) - D3 not connected - - */ - - /* keyboard row reset */ - - if (!BIT(data, 0)) - { - m_keylatch = 0; - } - - /* tape data output */ - - m_cop_tdo = BIT(data, 1); - - m_cassette1->output(m_cop_tdo ? -1.0 : +1.0); - m_cassette2->output(m_cop_tdo ? -1.0 : +1.0); - - /* keyboard and display clock */ - - if (!BIT(data, 2)) - { - m_keylatch++; - - if (m_keylatch == 16) - { - m_keylatch = 0; - } - - m_keydata = m_key_row[m_keylatch]->read(); - - output_set_digit_value(m_keylatch, m_segment_data[m_keylatch]); - } -} - -READ8_MEMBER( newbrain_state::cop_in_r ) -{ - /* - - bit description - - IN0 K8 - IN1 _RD - IN2 _COP - IN3 _WR - - */ - - return (m_cop_wr << 3) | (m_cop_access << 2) | (m_cop_rd << 1) | BIT(m_keydata, 2); -} - -WRITE_LINE_MEMBER( newbrain_state::cop_so_w ) -{ - // connected to K1 - m_cop_so = state; -} - -WRITE_LINE_MEMBER( newbrain_state::cop_sk_w ) -{ - // connected to K2 - m_segment_data[m_keylatch] >>= 1; - m_segment_data[m_keylatch] = (m_cop_so << 15) | (m_segment_data[m_keylatch] & 0x7fff); -} - -READ_LINE_MEMBER( newbrain_state::cop_si_r ) -{ - // connected to TDI - m_cop_tdi = (((m_cassette1)->input() > +1.0) || ((m_cassette2)->input() > +1.0)) ^ m_cop_tdo; - - return m_cop_tdi; -} - -/* Video */ - -void newbrain_state::tvram_w(UINT8 data, int a6) -{ - /* latch video address counter bits A5-A0 */ - m_tvram = (m_tvctl & NEWBRAIN_VIDEO_80L) ? 0x04 : 0x02; - - /* latch video address counter bit A6 */ - m_tvram |= a6 << 6; - - /* latch data to video address counter bits A14-A7 */ - m_tvram = (data << 7); -} - -READ8_MEMBER( newbrain_state::tvl_r ) -{ - UINT8 data = 0xff; - - tvram_w(data, !offset); - - return data; -} - -WRITE8_MEMBER( newbrain_state::tvl_w ) -{ - tvram_w(data, !offset); -} - -WRITE8_MEMBER( newbrain_state::tvctl_w ) -{ - /* - - bit signal description - - 0 RV 1 reverses video over entire field, ie. black on white - 1 FS 0 generates 128 characters and 128 reverse field characters from 8 bit character code. 1 generates 256 characters from 8 bit character code - 2 32/_40 0 generates 320 or 640 horizontal dots in pixel graphics mode. 1 generates 256 or 512 horizontal dots in pixel graphics mode - 3 UCR 0 selects 256 characters expressed in an 8x10 matrix, and 25 lines (max) displayed. 1 selects 256 characters in an 8x8 matrix, and 31 lines (max) displayed - 4 - 5 - 6 80L 0 selects 40 character line length. 1 selects 80 character line length - 7 - - */ - - m_tvctl = data; -} - -/* Disc Controller */ - -WRITE8_MEMBER( newbrain_eim_state::fdc_auxiliary_w ) -{ - /* - - bit description - - 0 MOTON - 1 765 RESET - 2 TC - 3 - 4 - 5 PA15 - 6 - 7 - - */ - - m_floppy->mon_w(!BIT(data, 0)); - - if(BIT(data, 1)) - m_fdc->reset(); - - m_fdc->tc_w(BIT(data, 2)); -} - -READ8_MEMBER( newbrain_eim_state::fdc_control_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 FDC INT - 6 PAGING - 7 FDC ATT - - */ - - return (m_fdc_att << 7) | (m_paging << 6) | (m_fdc_int << 5); -} - -READ8_MEMBER( newbrain_eim_state::ust2_r ) -{ - /* - - bit description - - 0 RDDK (V24 RxD) - 1 _CTSD (V24 Clear to Send) - 2 - 3 - 4 - 5 TPIN - 6 - 7 _CTSP (Printer Clear to Send) - - */ - - return 0; -} - -#define NEWBRAIN_COPCMD_NULLCOM 0xd0 -#define NEWBRAIN_COPCMD_DISPCOM 0xa0 -//#define NEWBRAIN_COPCMD_TIMCOM 0x -#define NEWBRAIN_COPCMD_PDNCOM 0xb8 -#define NEWBRAIN_COPCMD_TAPECOM 0x80 - -#define NEWBRAIN_COP_TAPE_RECORD 0x00 -#define NEWBRAIN_COP_TAPE_PLAYBK 0x04 -#define NEWBRAIN_COP_TAPE_MOTOR1 0x08 -#define NEWBRAIN_COP_TAPE_MOTOR2 0x02 - -#define NEWBRAIN_COP_TIMER0 0x01 - -#define NEWBRAIN_COP_NO_DATA 0x01 -#define NEWBRAIN_COP_BREAK_PRESSED 0x02 - -#define NEWBRAIN_COP_REGINT 0x00 -/*#define NEWBRAIN_COP_CASSERR 0x -#define NEWBRAIN_COP_CASSIN 0x -#define NEWBRAIN_COP_KBD 0x -#define NEWBRAIN_COP_CASSOUT 0x*/ - -enum -{ - NEWBRAIN_COP_STATE_COMMAND = 0, - NEWBRAIN_COP_STATE_DATA -}; - - -READ8_MEMBER( newbrain_state::cop_r ) -{ - m_copint = 1; - check_interrupt(); - - return m_copdata; -} - -WRITE8_MEMBER( newbrain_state::cop_w ) -{ - m_copdata = data; - - switch (m_copstate) - { - case NEWBRAIN_COP_STATE_COMMAND: - logerror("COP command %02x\n", data); - - switch (data) - { - case NEWBRAIN_COPCMD_NULLCOM: - break; - - case NEWBRAIN_COPCMD_DISPCOM: - m_copregint = 0; - m_copbytes = 18; - m_copstate = NEWBRAIN_COP_STATE_DATA; - - m_copdata = NEWBRAIN_COP_NO_DATA; - m_copint = 0; - check_interrupt(); - - break; - -#if 0 - case NEWBRAIN_COPCMD_TIMCOM: - m_copregint = 0; - m_copbytes = 6; - m_copstate = NEWBRAIN_COP_STATE_DATA; - break; -#endif - case NEWBRAIN_COPCMD_PDNCOM: - /* power down */ - m_copregint = 0; - break; - - default: - if (data & NEWBRAIN_COPCMD_TAPECOM) - { - m_copregint = 0; - } - } - break; - - case NEWBRAIN_COP_STATE_DATA: - logerror("COP data %02x\n", data); - m_copbytes--; - - if (m_copbytes == 0) - { - m_copstate = NEWBRAIN_COP_STATE_COMMAND; - m_copregint = 1; - } - - m_copdata = NEWBRAIN_COP_NO_DATA; - m_copint = 0; - check_interrupt(); - - break; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(newbrain_state::cop_regint_tick) -{ - if (m_copregint) - { - logerror("COP REGINT\n"); - m_copint = 0; - check_interrupt(); - } -} - -/* Expansion Interface Module */ - -WRITE8_MEMBER( newbrain_eim_state::enrg2_w ) -{ - /* - - bit signal description - - 0 _USERP 0 enables user data bus interrupt and also parallel latched data output (or centronics printer) interrupt - 1 ANP 1 enables ADC conversion complete interrupt and also calling indicator interrupt - 2 MLTMD 1 enables serial receive clock into multiplier input of DAC and signals data terminal not ready - 3 MSPD 1 enables 50K Baud serial data rate to be obtained ie. CTC input clock of 800 kHz. 0 selects xxx.692 kHz - 4 ENOR 1 enables serial receive clock to sound output summer, and also selects serial input from the printer port. 0 selects serial input from the comms port - 5 ANSW 1 enables second bank of 4 analogue inputs (voltage, non-ratiometric), ie. ch4-7, and enabled sound output, 0 selects ch03 - 6 ENOT 1 enables serial transmit clock to sound ouput summer, and also selects serial output to the printer port. 0 selects serial output to the comms port - 7 9th output bit for centronics printer port - - */ - - m_enrg2 = data; -} - -WRITE8_MEMBER( newbrain_eim_state::pr_w ) -{ - /* - - bit signal description - - 0 HP0 - 1 HP1 - 2 HP2 - 3 HP3 - 4 HP4 - 5 HP5 - 6 HP6 - 7 HP11 - - HP0-HP2 are decoded to _ROM0..._ROM7 signals - HP3-HP4 are decoded to _CH0..._CH3 signals - - */ - - int page = (BIT(offset, 12) >> 9) | (BIT(offset, 15) >> 13) | (BIT(offset, 14) >> 13) | (BIT(offset, 13) >> 13); - int bank = (BIT(offset, 11) >> 3) | (data & 0x7f); - - m_pr[page] = bank; - - bankswitch(); -} - -READ8_MEMBER( newbrain_eim_state::user_r ) -{ - m_user = 0xff; - - return 0xff; -} - -WRITE8_MEMBER( newbrain_eim_state::user_w ) -{ - m_user = data; -} - -READ8_MEMBER( newbrain_eim_state::anout_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( newbrain_eim_state::anout_w ) -{ -} - -READ8_MEMBER( newbrain_eim_state::anin_r ) -{ -// int channel = offset & 0x03; - - return 0; -} - -WRITE8_MEMBER( newbrain_eim_state::anio_w ) -{ -// int channel = offset & 0x03; -} - -READ8_MEMBER( newbrain_eim_state::st0_r ) -{ - /* - - bit signal description - - 0 fixed at 1 - indicates excess of 24 or 48, obsolete - 1 PWRUP 1 indicates power up from 'cold' - necessary in battery machines with power switching - 2 1 indicates analogue or calling indicator interrupts - 3 _USRINT0 0 indicates centronics printer (latched output data) port interrupt - 4 _USRINT 0 indicates parallel data bus port interrupt - 5 _CLKINT 0 indicates frame frequency clock interrupt - 6 _ACINT 0 indicates ACIA interrupt - 7 _COPINT 0 indicates interrupt from micro-controller COP420M - - */ - - return (m_copint << 7) | (m_aciaint << 6) | (m_clkint << 5) | (m_userint << 4) | (m_userint0 << 3) | (m_pwrup) << 1 | 0x01; -} - -READ8_MEMBER( newbrain_eim_state::st1_r ) -{ - /* - - bit signal description - - 0 - 1 - 2 N/_RV 1 selects normal video on power up (white on black), 0 selects reversed video (appears as D0 on the first 200 EI's) - 3 ANCH 1 indicates power is being taken from the mains supply - 4 40/_80 1 indicates that 40 column video is selected on power up. 0 selects 80 column video - 5 - 6 TVCNSL 1 indicates that a video display is required on power up - 7 - - */ - - return (m_tvcnsl << 6) | 0x10 | 0x08 | 0x04; -} - -READ8_MEMBER( newbrain_eim_state::st2_r ) -{ - /* - - bit signal description - - 0 received serial data from communications port - 1 0 indicates 'clear-to-send' condition at communications port - 2 - 3 - 4 - 5 logic level tape input - 6 - 7 0 indicates 'clear-to-send' condition at printer port - - */ - - return 0; -} - -READ8_MEMBER( newbrain_eim_state::usbs_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( newbrain_eim_state::usbs_w ) -{ -} - -WRITE8_MEMBER( newbrain_eim_state::paging_w ) -{ - if (BIT(offset, 8)) - { - // expansion interface module - - /* - - bit signal description - - 0 PG 1 enables paging circuits - 1 WPL unused - 2 A16 1 sets local A16 to 1 (ie. causes second set of 8 page registers to select addressed memory) - 3 _MPM 0 selects multi-processing mode. among other effects this extends the page registers from 8 to 12 bits in length - 4 HISLT 1 isolates the local machine. this is used in multi-processing mode - 5 - 6 - 7 - - */ - - m_paging = BIT(data, 0); - m_a16 = BIT(data, 2); - m_mpm = BIT(data, 3); - } - else if (BIT(offset, 9)) - { - // disc controller - - /* - - bit signal description - - 0 PAGING 1 enables paging circuits - 1 - 2 HA16 1 sets local A16 to 1 (ie. causes second set of 8 page registers to select addressed memory) - 3 MPM 0 selects multi-processing mode. among other effects this extends the page registers from 8 to 12 bits in length - 4 - 5 _FDC RESET - 6 - 7 FDC ATT - - */ - - m_fdccpu->set_input_line(INPUT_LINE_RESET, BIT(data, 5) ? HOLD_LINE : CLEAR_LINE); - - m_paging = BIT(data, 0); - m_a16 = BIT(data, 2); - m_mpm = BIT(data, 3); - m_fdc_att = BIT(data, 7); - } - else if (BIT(offset, 10)) - { - // network controller - } -} - -/* A/D Converter */ - -WRITE_LINE_MEMBER( newbrain_eim_state::adc_eoc_w ) -{ - m_anint = state; -} - -ADC0808_ANALOG_READ_CB( newbrain_eim_state::adc_vref_pos_r ) -{ - return 5.0; -} - -ADC0808_ANALOG_READ_CB( newbrain_eim_state::adc_vref_neg_r ) -{ - return 0.0; -} - -ADC0808_ANALOG_READ_CB( newbrain_eim_state::adc_input_r ) -{ - return 0.0; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( newbrain_map, AS_PROGRAM, 8, newbrain_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") - AM_RANGE(0x2000, 0x3fff) AM_RAMBANK("bank2") - AM_RANGE(0x4000, 0x5fff) AM_RAMBANK("bank3") - AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("bank4") - AM_RANGE(0x8000, 0x9fff) AM_RAMBANK("bank5") - AM_RANGE(0xa000, 0xbfff) AM_RAMBANK("bank6") - AM_RANGE(0xc000, 0xdfff) AM_RAMBANK("bank7") - AM_RANGE(0xe000, 0xffff) AM_RAMBANK("bank8") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( newbrain_ei_io_map, AS_IO, 8, newbrain_eim_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(clusr_r, clusr_w) - AM_RANGE(0x01, 0x01) AM_MIRROR(0xff00) AM_WRITE(enrg2_w) - AM_RANGE(0x02, 0x02) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE(pr_w) - AM_RANGE(0x03, 0x03) AM_MIRROR(0xff00) AM_READWRITE(user_r, user_w) - AM_RANGE(0x04, 0x04) AM_MIRROR(0xff00) AM_READWRITE(clclk_r, clclk_w) - AM_RANGE(0x05, 0x05) AM_MIRROR(0xff00) AM_READWRITE(anout_r, anout_w) - AM_RANGE(0x06, 0x06) AM_MIRROR(0xff00) AM_READWRITE(cop_r, cop_w) - AM_RANGE(0x07, 0x07) AM_MIRROR(0xff00) AM_WRITE(enrg1_w) - AM_RANGE(0x08, 0x09) AM_MIRROR(0xff02) AM_READWRITE(tvl_r, tvl_w) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff03) AM_WRITE(tvctl_w) - AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_READWRITE(anin_r, anio_w) - AM_RANGE(0x14, 0x14) AM_MIRROR(0xff00) AM_READ(st0_r) - AM_RANGE(0x15, 0x15) AM_MIRROR(0xff00) AM_READ(st1_r) - AM_RANGE(0x16, 0x16) AM_MIRROR(0xff00) AM_READ(st2_r) - AM_RANGE(0x17, 0x17) AM_MIRROR(0xff00) AM_READWRITE(usbs_r, usbs_w) - AM_RANGE(0x18, 0x18) AM_MIRROR(0xff00) AM_DEVREADWRITE(MC6850_TAG, acia6850_device, status_r, control_w) - AM_RANGE(0x19, 0x19) AM_MIRROR(0xff00) AM_DEVREADWRITE(MC6850_TAG, acia6850_device, data_r, data_w) - AM_RANGE(0x1c, 0x1f) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE(paging_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( newbrain_a_io_map, AS_IO, 8, newbrain_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_MIRROR(0xffc0) AM_READWRITE(clusr_r, clusr_w) - AM_RANGE(0x03, 0x03) AM_MIRROR(0xffc0) AM_WRITE(user_w) - AM_RANGE(0x04, 0x04) AM_MIRROR(0xffc0) AM_READWRITE(clclk_r, clclk_w) - AM_RANGE(0x06, 0x06) AM_MIRROR(0xffc0) AM_READWRITE(cop_r, cop_w) - AM_RANGE(0x07, 0x07) AM_MIRROR(0xffc0) AM_WRITE(a_enrg1_w) - AM_RANGE(0x08, 0x09) AM_MIRROR(0xffc2) AM_READWRITE(tvl_r, tvl_w) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xffc3) AM_WRITE(tvctl_w) - AM_RANGE(0x14, 0x14) AM_MIRROR(0xffc3) AM_READ(a_ust_r) - AM_RANGE(0x16, 0x16) AM_MIRROR(0xffc0) AM_READ(user_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( newbrain_fdc_map, AS_PROGRAM, 8, newbrain_eim_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( newbrain_fdc_io_map, AS_IO, 8, newbrain_eim_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x01) AM_DEVICE(UPD765_TAG, upd765a_device, map) - AM_RANGE(0x20, 0x20) AM_WRITE(fdc_auxiliary_w) - AM_RANGE(0x40, 0x40) AM_READ(fdc_control_r) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( newbrain ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('(') PORT_CHAR('[') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(')') PORT_CHAR(']') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* \xC2\xA3") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR(0x00A3) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("VIDEO TEXT") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) // Vd - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - - PORT_START("Y10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("Y11") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') PORT_CHAR('\\') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("Y12") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('^') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("Y13") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NEW LINE") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // NL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("Y14") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // CH - - PORT_START("Y15") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // SH - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) // GR - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPEAT") // RPT - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // GL -INPUT_PORTS_END - -/* Machine Initialization */ - -WRITE_LINE_MEMBER( newbrain_eim_state::acia_tx ) -{ - m_acia_txd = state; -} - -WRITE_LINE_MEMBER( newbrain_eim_state::acia_interrupt ) -{ - m_aciaint = state; -} - -WRITE_LINE_MEMBER( newbrain_eim_state::fdc_interrupt ) -{ - m_fdc_int = state; -} - -WRITE_LINE_MEMBER( newbrain_eim_state::ctc_z2_w ) -{ - /* connected to CTC channel 0/1 clock inputs */ - m_ctc->trg0(state); - m_ctc->trg1(state); -} - -TIMER_DEVICE_CALLBACK_MEMBER(newbrain_eim_state::ctc_c2_tick) -{ - m_ctc->trg2(1); - m_ctc->trg2(0); -} - -inline int newbrain_state::get_reset_t() -{ - return RES_K(220) * CAP_U(10) * 1000; // t = R128 * C125 = 2.2s -} - -inline int newbrain_state::get_pwrup_t() -{ - return RES_K(560) * CAP_U(10) * 1000; // t = R129 * C127 = 5.6s -} - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void newbrain_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_ID_RESET: - m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - m_copcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - break; - - case TIMER_ID_PWRUP: - m_pwrup = 0; - bankswitch(); - break; - } -} - -void newbrain_state::machine_start() -{ - m_copregint = 1; - - /* set power up timer */ - timer_set(attotime::from_usec(get_pwrup_t()), TIMER_ID_PWRUP); - - /* initialize variables */ - m_pwrup = 1; - m_userint = 1; - m_userint0 = 1; - m_clkint = 1; - m_aciaint = 1; - m_copint = 1; - m_bee = 1; - m_tvcnsl = 1; - - /* set up memory banking */ - bankswitch(); - - // find keyboard rows - m_key_row[0] = m_y0; - m_key_row[1] = m_y1; - m_key_row[2] = m_y2; - m_key_row[3] = m_y3; - m_key_row[4] = m_y4; - m_key_row[5] = m_y5; - m_key_row[6] = m_y6; - m_key_row[7] = m_y7; - m_key_row[8] = m_y8; - m_key_row[9] = m_y9; - m_key_row[10] = m_y10; - m_key_row[11] = m_y11; - m_key_row[12] = m_y12; - m_key_row[13] = m_y13; - m_key_row[14] = m_y14; - m_key_row[15] = m_y15; - - /* register for state saving */ - save_item(NAME(m_pwrup)); - save_item(NAME(m_userint)); - save_item(NAME(m_userint0)); - save_item(NAME(m_clkint)); - save_item(NAME(m_aciaint)); - save_item(NAME(m_copint)); - save_item(NAME(m_anint)); - save_item(NAME(m_bee)); - save_item(NAME(m_enrg1)); - save_item(NAME(m_enrg2)); - save_item(NAME(m_cop_bus)); - save_item(NAME(m_cop_so)); - save_item(NAME(m_cop_tdo)); - save_item(NAME(m_cop_tdi)); - save_item(NAME(m_cop_rd)); - save_item(NAME(m_cop_wr)); - save_item(NAME(m_cop_access)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_keydata)); - save_item(NAME(m_user)); -} - -void newbrain_eim_state::machine_start() -{ - newbrain_state::machine_start(); - - /* allocate expansion RAM */ - m_eim_ram.allocate(NEWBRAIN_EIM_RAM_SIZE); - - /* register for state saving */ - save_item(NAME(m_mpm)); - save_item(NAME(m_a16)); - save_item(NAME(m_pr)); - save_item(NAME(m_fdc_int)); - save_item(NAME(m_fdc_att)); - save_item(NAME(m_paging)); -} - -void newbrain_state::machine_reset() -{ - timer_set(attotime::from_usec(get_reset_t()), TIMER_ID_RESET); -} - -INTERRUPT_GEN_MEMBER(newbrain_state::newbrain_interrupt) -{ - if (!(m_enrg1 & NEWBRAIN_ENRG1_CLK)) - { - m_clkint = 0; - check_interrupt(); - } -} - -/* Machine Drivers */ - -/* F4 Character Displayer */ -static const gfx_layout newbrain_charlayout = -{ - 8, 10, /* 8 x 10 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*256*8, 1*256*8, 2*256*8, 3*256*8, 4*256*8, 5*256*8, 6*256*8, 7*256*8, 8*256*8, 9*256*8, 10*256*8, 11*256*8, 12*256*8, 13*256*8, 14*256*8, 15*256*8 }, - 8 /* every char takes 16 x 1 bytes */ -}; - -static GFXDECODE_START( newbrain ) - GFXDECODE_ENTRY( "chargen", 0x0000, newbrain_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( newbrain_a, newbrain_state ) - // basic system hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/8) - MCFG_CPU_PROGRAM_MAP(newbrain_map) - MCFG_CPU_IO_MAP(newbrain_a_io_map) - MCFG_CPU_VBLANK_INT_DRIVER(SCREEN_TAG, newbrain_state, newbrain_interrupt) - - MCFG_CPU_ADD(COP420_TAG, COP420, XTAL_16MHz/8) // COP420-GUW/N - MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) - MCFG_COP400_READ_L_CB(READ8(newbrain_state, cop_l_r)) - MCFG_COP400_WRITE_L_CB(WRITE8(newbrain_state, cop_l_w)) - MCFG_COP400_READ_G_CB(READ8(newbrain_state, cop_g_r)) - MCFG_COP400_WRITE_G_CB(WRITE8(newbrain_state, cop_g_w)) - MCFG_COP400_WRITE_D_CB(WRITE8(newbrain_state, cop_d_w)) - MCFG_COP400_READ_IN_CB(READ8(newbrain_state, cop_in_r)) - MCFG_COP400_WRITE_SK_CB(WRITELINE(newbrain_state, cop_sk_w)) - MCFG_COP400_READ_SI_CB(READLINE(newbrain_state, cop_si_r)) - MCFG_COP400_WRITE_SO_CB(WRITELINE(newbrain_state, cop_so_w)) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", newbrain) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("cop_regint", newbrain_state, cop_regint_tick, attotime::from_usec(12500)) - - // video hardware - MCFG_FRAGMENT_ADD(newbrain_video) - - // devices - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_CASSETTE_ADD("cassette2") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") -MACHINE_CONFIG_END - -static SLOT_INTERFACE_START( newbrain_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_DERIVED_CLASS( newbrain_eim, newbrain_a, newbrain_eim_state ) - // basic system hardware - MCFG_CPU_MODIFY(Z80_TAG) - MCFG_CPU_IO_MAP(newbrain_ei_io_map) - - MCFG_CPU_ADD(FDC_Z80_TAG, Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(newbrain_fdc_map) - MCFG_CPU_IO_MAP(newbrain_fdc_io_map) - - // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/8) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(MC6850_TAG, acia6850_device, write_rxc)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(MC6850_TAG, acia6850_device, write_txc)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(newbrain_eim_state, ctc_z2_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_c2", newbrain_eim_state, ctc_c2_tick, attotime::from_hz(XTAL_16MHz/4/13)) - MCFG_DEVICE_ADD(ADC0809_TAG, ADC0808, 500000) - MCFG_ADC0808_OUT_EOC_CB(WRITELINE(newbrain_eim_state, adc_eoc_w)) - MCFG_ADC0808_IN_VREF_POS_CB(newbrain_eim_state, adc_vref_pos_r) - MCFG_ADC0808_IN_VREF_NEG_CB(newbrain_eim_state, adc_vref_neg_r) - MCFG_ADC0808_IN_IN_0_CB(newbrain_eim_state, adc_input_r) - MCFG_ADC0808_IN_IN_1_CB(newbrain_eim_state, adc_input_r) - MCFG_ADC0808_IN_IN_2_CB(newbrain_eim_state, adc_input_r) - MCFG_ADC0808_IN_IN_3_CB(newbrain_eim_state, adc_input_r) - MCFG_ADC0808_IN_IN_4_CB(newbrain_eim_state, adc_input_r) - MCFG_ADC0808_IN_IN_5_CB(newbrain_eim_state, adc_input_r) - MCFG_ADC0808_IN_IN_6_CB(newbrain_eim_state, adc_input_r) - MCFG_ADC0808_IN_IN_7_CB(newbrain_eim_state, adc_input_r) - - MCFG_DEVICE_ADD(MC6850_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(newbrain_eim_state, acia_tx)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(newbrain_eim_state, acia_interrupt)) - - MCFG_UPD765A_ADD(UPD765_TAG, false, true) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) - - // internal ram - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("96K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( newbrain ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "rom20" ) - - ROM_SYSTEM_BIOS( 0, "issue1", "Issue 1 (v?)" ) - ROMX_LOAD( "aben.ic6", 0xa000, 0x2000, CRC(308f1f72) SHA1(a6fd9945a3dca47636887da2125fde3f9b1d4e25), ROM_BIOS(1) ) - ROMX_LOAD( "cd iss 1.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(1) ) - ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "issue2", "Issue 2 (v1.9)" ) - ROMX_LOAD( "aben19.ic6", 0xa000, 0x2000, CRC(d0283eb1) SHA1(351d248e69a77fa552c2584049006911fb381ff0), ROM_BIOS(2) ) - ROMX_LOAD( "cdi2.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(2) ) - ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS( 2, "issue3", "Issue 3 (v1.91)" ) - ROMX_LOAD( "aben191.ic6", 0xa000, 0x2000, CRC(b7be8d89) SHA1(cce8d0ae7aa40245907ea38b7956c62d039d45b7), ROM_BIOS(3) ) - ROMX_LOAD( "cdi3.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(3) ) - ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS( 3, "series2", "Series 2 (v?)" ) - ROMX_LOAD( "abs2.ic6", 0xa000, 0x2000, CRC(9a042acb) SHA1(80d83a2ea3089504aa68b6cf978d80d296cd9bda), ROM_BIOS(4) ) - ROMX_LOAD( "cds2.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(4) ) - ROMX_LOAD( "efs2.ic8", 0xe000, 0x2000, CRC(b222d798) SHA1(c0c816b4d4135b762f2c5f1b24209d0096f22e56), ROM_BIOS(4) ) - - ROM_SYSTEM_BIOS( 4, "rom20", "? (v2.0)" ) - ROMX_LOAD( "aben20.rom", 0xa000, 0x2000, CRC(3d76d0c8) SHA1(753b4530a518ad832e4b81c4e5430355ba3f62e0), ROM_BIOS(5) ) - ROMX_LOAD( "cd20tci.rom", 0xc000, 0x4000, CRC(f65b2350) SHA1(1ada7fbf207809537ec1ffb69808524300622ada), ROM_BIOS(5) ) - - ROM_REGION( 0x400, COP420_TAG, 0 ) - ROM_LOAD( "cop420.419", 0x000, 0x400, NO_DUMP ) - - ROM_REGION( 0x1000, "chargen", ROMREGION_ERASE00 ) - ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x0a01, BAD_DUMP CRC(46ecbc65) SHA1(3fe064d49a4de5e3b7383752e98ad35a674e26dd) ) // 8248R7 -ROM_END - -#define rom_newbraina rom_newbrain - -ROM_START( newbraineim ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "rom20" ) - - ROM_SYSTEM_BIOS( 0, "issue1", "Issue 1 (v?)" ) - ROMX_LOAD( "aben.ic6", 0xa000, 0x2000, CRC(308f1f72) SHA1(a6fd9945a3dca47636887da2125fde3f9b1d4e25), ROM_BIOS(1) ) - ROMX_LOAD( "cd iss 1.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(1) ) - ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "issue2", "Issue 2 (v1.9)" ) - ROMX_LOAD( "aben19.ic6", 0xa000, 0x2000, CRC(d0283eb1) SHA1(351d248e69a77fa552c2584049006911fb381ff0), ROM_BIOS(2) ) - ROMX_LOAD( "cdi2.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(2) ) - ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS( 2, "issue3", "Issue 3 (v1.91)" ) - ROMX_LOAD( "aben191.ic6", 0xa000, 0x2000, CRC(b7be8d89) SHA1(cce8d0ae7aa40245907ea38b7956c62d039d45b7), ROM_BIOS(3) ) - ROMX_LOAD( "cdi3.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(3) ) - ROMX_LOAD( "ef iss 1.ic8", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS( 3, "series2", "Series 2 (v?)" ) - ROMX_LOAD( "abs2.ic6", 0xa000, 0x2000, CRC(9a042acb) SHA1(80d83a2ea3089504aa68b6cf978d80d296cd9bda), ROM_BIOS(4) ) - ROMX_LOAD( "cds2.ic7", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a), ROM_BIOS(4) ) - ROMX_LOAD( "efs2.ic8", 0xe000, 0x2000, CRC(b222d798) SHA1(c0c816b4d4135b762f2c5f1b24209d0096f22e56), ROM_BIOS(4) ) - - ROM_SYSTEM_BIOS( 4, "rom20", "? (v2.0)" ) - ROMX_LOAD( "aben20.rom", 0xa000, 0x2000, CRC(3d76d0c8) SHA1(753b4530a518ad832e4b81c4e5430355ba3f62e0), ROM_BIOS(5) ) - ROMX_LOAD( "cd20tci.rom", 0xc000, 0x4000, CRC(f65b2350) SHA1(1ada7fbf207809537ec1ffb69808524300622ada), ROM_BIOS(5) ) - - ROM_REGION( 0x400, COP420_TAG, 0 ) - ROM_LOAD( "cop420.419", 0x000, 0x400, NO_DUMP ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x0a01, BAD_DUMP CRC(46ecbc65) SHA1(3fe064d49a4de5e3b7383752e98ad35a674e26dd) ) // 8248R7 - - ROM_REGION( 0x10000, "eim", 0 ) // Expansion Interface Module - ROM_LOAD( "e415-2.rom", 0x4000, 0x2000, CRC(5b0e390c) SHA1(0f99cae57af2e64f3f6b02e5325138d6ba015e72) ) - ROM_LOAD( "e415-3.rom", 0x4000, 0x2000, CRC(2f88bae5) SHA1(04e03f230f4b368027442a7c2084dae877f53713) ) // 18/8/83.aci - ROM_LOAD( "e416-3.rom", 0x6000, 0x2000, CRC(8b5099d8) SHA1(19b0cfce4c8b220eb1648b467f94113bafcb14e0) ) // 10/8/83.mtv - ROM_LOAD( "e417-2.rom", 0x8000, 0x2000, CRC(6a7afa20) SHA1(f90db4f8318777313a862b3d5bab83c2fd260010) ) - - ROM_REGION( 0x10000, FDC_Z80_TAG, 0 ) // Floppy Disk Controller - ROM_LOAD( "d413-2.rom", 0x0000, 0x2000, CRC(097591f1) SHA1(c2aa1d27d4f3a24ab0c8135df746a4a44201a7f4) ) - ROM_LOAD( "d417-1.rom", 0x0000, 0x2000, CRC(40fad31c) SHA1(5137be4cc026972c0ffd4fa6990e8583bdfce163) ) - ROM_LOAD( "d417-2.rom", 0x0000, 0x2000, CRC(e8bda8b9) SHA1(c85a76a5ff7054f4ef4a472ce99ebaed1abd269c) ) -ROM_END - -ROM_START( newbrainmd ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "cdmd.rom", 0xc000, 0x2000, CRC(6b4d9429) SHA1(ef688be4e75aced61f487c928258c8932a0ae00a) ) - ROM_LOAD( "efmd.rom", 0xe000, 0x2000, CRC(20dd0b49) SHA1(74b517ca223cefb588e9f49e72ff2d4f1627efc6) ) - - ROM_REGION( 0x400, COP420_TAG, 0 ) - ROM_LOAD( "cop420.419", 0x000, 0x400, NO_DUMP ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x0a01, BAD_DUMP CRC(46ecbc65) SHA1(3fe064d49a4de5e3b7383752e98ad35a674e26dd) ) // 8248R7 -ROM_END - -/* System Drivers */ - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1981, newbrain, 0, 0, newbrain_a, newbrain, driver_device, 0, "Grundy Business Systems Ltd", "NewBrain AD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1981, newbraineim,newbrain, 0, newbrain_eim, newbrain, driver_device, 0, "Grundy Business Systems Ltd", "NewBrain AD with Expansion Interface", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1981, newbraina, newbrain, 0, newbrain_a, newbrain, driver_device, 0, "Grundy Business Systems Ltd", "NewBrain A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1981, newbrainmd, newbrain, 0, newbrain_a, newbrain, driver_device, 0, "Grundy Business Systems Ltd", "NewBrain MD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/next.c b/src/mess/drivers/next.c deleted file mode 100644 index 90901333a35..00000000000 --- a/src/mess/drivers/next.c +++ /dev/null @@ -1,1225 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -/*************************************************************************** - - NeXT - - TODO: - - - Hook up the sound output, it is shared with the keyboard port - - - Implement more of the scc and its dma interactions so that the - start up test passes, but not before sound out is done (if the scc - test passes all the other test pass up to sound out which - infloops) - - - Really implement the MO, it's only faking it for the startup test right now - - - Fix the networking - - - Find out why netbsd goes to hell even before loading the kernel - - Memory map and other bits can be found here: - http://fxr.watson.org/fxr/source/arch/next68k/include/cpu.h?v=NETBSD5#L366 - -****************************************************************************/ - - -#include "includes/next.h" -#include "formats/pc_dsk.h" -#include "formats/mfi_dsk.h" -#include "machine/nscsi_cd.h" -#include "machine/nscsi_hd.h" - -UINT32 next_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - // We don't handle partial updates, but we don't generate them either :-) - if(cliprect.min_x || cliprect.min_y || cliprect.max_x+1 != screen_sx || cliprect.max_y+1 != screen_sy) - return 0; - - // 0,1,2,4=0b000000, 3=2c000000, 5,8,9=0c000000 - // 1152x832 (0,1,2,3c,4) - // 1120x832 (8) - // 832x624 (5c,9c) - if(screen_color) { - const UINT32 *vr = vram; - for(int y=0; y(bitmap.raw_pixptr(y)); - for(int x=0; x> (16-(xi*16))) & 0xffff; - UINT32 r = (pen & 0xf000) >> 12; - UINT32 g = (pen & 0x0f00) >> 8; - UINT32 b = (pen & 0x00f0) >> 4; - UINT32 col = (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b; - *pix++ = col; - } - } - vr += screen_skip; - } - } else { - static UINT32 colors[4] = { 0xffffff, 0xaaaaaa, 0x555555, 0x000000 }; - const UINT32 *vr = vram; - for(int y=0; y(bitmap.raw_pixptr(y)); - for(int x=0; x> (30-(xi*2))) & 0x3]; - } - vr += screen_skip; - } - } - - return 0; -} - -/* Dummy catcher for any unknown r/w */ -READ8_MEMBER( next_state::io_r ) -{ - if(!space.debugger_access()) - printf("io_r %08x (%08x)\n",offset+0x02000000, space.device().safe_pc()); - - if(offset == 0xc0) - return 0; - - return 0xff; -} - -WRITE8_MEMBER( next_state::io_w ) -{ - if(!space.debugger_access()) - printf("io_w %08x, %02x (%08x)\n",offset+0x02000000,data, space.device().safe_pc()); -} - -/* map ROM at 0x01000000-0x0101ffff? */ -READ32_MEMBER( next_state::rom_map_r ) -{ - if(0 && !space.debugger_access()) - printf("%08x ROM MAP?\n",space.device().safe_pc()); - return 0x01000000; -} - -READ32_MEMBER( next_state::scr2_r ) -{ - if(0 && !space.debugger_access()) - printf("%08x\n",space.device().safe_pc()); - /* - x--- ---- ---- ---- ---- ---- ---- ---- dsp reset - -x-- ---- ---- ---- ---- ---- ---- ---- dsp block end - --x- ---- ---- ---- ---- ---- ---- ---- dsp unpacked - ---x ---- ---- ---- ---- ---- ---- ---- dsp mode b - ---- x--- ---- ---- ---- ---- ---- ---- dsp mode a - ---- -x-- ---- ---- ---- ---- ---- ---- remote int - ---- ---x ---- ---- ---- ---- ---- ---- local int - ---- ---- ---x ---- ---- ---- ---- ---- dram 256k - ---- ---- ---- ---x ---- ---- ---- ---- dram 1m - ---- ---- ---- ---- x--- ---- ---- ---- "timer on ipl7" - ---- ---- ---- ---- -xxx ---- ---- ---- rom waitstates - ---- ---- ---- ---- ---- x--- ---- ---- ROM 1M - ---- ---- ---- ---- ---- -x-- ---- ---- MCS1850 rtdata - ---- ---- ---- ---- ---- --x- ---- ---- MCS1850 rtclk - ---- ---- ---- ---- ---- ---x ---- ---- MCS1850 rtce - ---- ---- ---- ---- ---- ---- x--- ---- rom overlay - ---- ---- ---- ---- ---- ---- -x-- ---- dsp ie - ---- ---- ---- ---- ---- ---- --x- ---- mem en - ---- ---- ---- ---- ---- ---- ---- ---x led - - 68040-25, 100ns, 32M: 00000c80 - 68040-25, 100ns, 20M: 00ff0c80 - - */ - - UINT32 data = scr2 & 0xfffffbff; - - data |= rtc->sdo_r() << 10; - - return data; -} - -WRITE32_MEMBER( next_state::scr2_w ) -{ - if(0 && !space.debugger_access()) - printf("scr2_w %08x (%08x)\n", data, space.device().safe_pc()); - COMBINE_DATA(&scr2); - - rtc->ce_w(BIT(scr2, 8)); - rtc->sdi_w(BIT(scr2, 10)); - rtc->sck_w(BIT(scr2, 9)); - irq_set(0, scr2 & 0x01000000); - irq_set(1, scr2 & 0x02000000); -} - -READ32_MEMBER( next_state::scr1_r ) -{ - /* - xxxx ---- ---- ---- ---- ---- ---- ---- slot ID - ---- ---- xxxx xxxx ---- ---- ---- ---- DMA type - ---- ---- ---- ---- xxxx ---- ---- ---- machine type - ---- ---- ---- ---- ---- xxxx ---- ---- board revision - ---- ---- ---- ---- ---- ---- -xx- ---- video mem speed - ---- ---- ---- ---- ---- ---- ---x x--- mem speed - ---- ---- ---- ---- ---- ---- ---- -xxx cpu speed 16/20/25/33/40/50/66/80 - - machine types: - 0 NeXT_CUBE - 1 NeXT_WARP9 - 2 NeXT_X15 - 3 NeXT_WARP9C - 4 NeXT_Turbo - 5 NeXT_TurboC - 6 Unknown - 7 Unknown - 8 NeXT_TurboCube - 9 NeXT_TurboCubeC - - 68040-25: 00011102 - 68040-25: 00013002 (non-turbo, color) - */ - - return scr1; -} - -// Interrupt subsystem -// source bit level -// nmi 31 7 * -// pfail 30 7 -// timer 29 6 * -// enetxdma 28 6 * -// enetrdma 27 6 * -// scsidma 26 6 * -// diskdma 25 6 -// prndma 24 6 * -// sndoutdma 23 6 -// sndindma 22 6 -// sccdma 21 6 -// dspdma 20 6 -// m2rdma 19 6 -// r2mdma 18 6 -// scc 17 5 -// remote 16 5 * -// bus 15 5 * -// dsp4 14 4 -// disk/cvid 13 3 -// scsi 12 3 * -// printer 11 3 -// enetx 10 3 * -// enetr 9 3 -// soundovr 8 3 * -// phone 7 3 * -- floppy -// dsp3 6 3 -// video 5 3 -// monitor 4 3 -// kbdmouse 3 3 * -// power 2 3 * -// softint1 1 2 * -// softint0 0 1 * - -void next_state::irq_set(int id, bool raise) -{ - UINT32 mask = 1U << id; - UINT32 old_status = irq_status; - if(raise) - irq_status |= mask; - else - irq_status &= ~mask; - if(old_status != irq_status) - irq_check(); -} - - -READ32_MEMBER( next_state::irq_status_r ) -{ - return irq_status; -} - -READ32_MEMBER( next_state::irq_mask_r ) -{ - return irq_mask; -} - -WRITE32_MEMBER( next_state::irq_mask_w ) -{ - COMBINE_DATA(&irq_mask); - irq_check(); -} - -void next_state::irq_check() -{ - UINT32 act = irq_status & (irq_mask | 0x80000000); - int bit; - for(bit=31; bit >= 0 && !(act & (1U << bit)); bit--); - - int level; - if (bit < 0) level = 0; - else if(bit < 1) level = 1; - else if(bit < 2) level = 2; - else if(bit < 14) level = 3; - else if(bit < 15) level = 4; - else if(bit < 18) level = 5; - else if(bit < 30) level = 6; - else level = 7; - - logerror("IRQ info %08x/%08x - %d\n", irq_status, irq_mask, level); - - if(level != irq_level) { - maincpu->set_input_line(irq_level, CLEAR_LINE); - maincpu->set_input_line_and_vector(level, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - irq_level = level; - } -} - -const char *next_state::dma_targets[0x20] = { - 0, "scsi", 0, 0, "soundout", "disk", 0, 0, - "soundin", "printer", 0, 0, "scc", "dsp", 0, 0, - "s-enetx", "enetx", 0, 0, "s-enetr", "enetr", 0, 0, - "video", 0, 0, 0, "r2m", "m2r", 0, 0 -}; - -const int next_state::dma_irqs[0x20] = { - -1, 26, -1, -1, 23, 25, -1, -1, 22, 24, -1, -1, 21, 20, -1, -1, - -1, 28, -1, -1, -1, 27, -1, -1, 5, -1, -1, -1, 18, 19, -1, -1 -}; - -const bool next_state::dma_has_saved[0x20] = { - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, true, false, false, false, true, false, false, - false, false, false, false, false, false, false, false, -}; - -const char *next_state::dma_name(int slot) -{ - static char buf[32]; - if(dma_targets[slot]) - return dma_targets[slot]; - sprintf(buf, "<%02x>", slot); - return buf; -} - -void next_state::dma_drq_w(int slot, bool state) -{ - // fprintf(stderr, "DMA drq_w %d, %d\n", slot, state); - dma_slot &ds = dma_slots[slot]; - ds.drq = state; - if(state && (ds.state & DMA_ENABLE)) { - address_space &space = maincpu->space(AS_PROGRAM); - if(ds.state & DMA_READ) { - while(ds.drq) { - dma_check_update(slot); - UINT8 val; - bool eof; - bool err; - dma_read(slot, val, eof, err); - if(err) { - ds.state = (ds.state & ~DMA_ENABLE) | DMA_BUSEXC; - logerror("DMA: bus error on read slot %d\n", slot); - return; - } - space.write_byte(ds.current++, val); - dma_check_end(slot, eof); - if(!(ds.state & DMA_ENABLE)) - return; - } - } else { - while(ds.drq) { - dma_check_update(slot); - UINT8 val = space.read_byte(ds.current++); - bool eof = ds.current == (ds.limit & 0x7fffffff) && (ds.limit & 0x80000000); - bool err; - dma_write(slot, val, eof, err); - if(err) { - ds.state = (ds.state & ~DMA_ENABLE) | DMA_BUSEXC; - logerror("DMA: bus error on write slot %d\n", slot); - return; - } - dma_check_end(slot, false); - if(!(ds.state & DMA_ENABLE)) - return; - } - } - } -} - -void next_state::dma_read(int slot, UINT8 &val, bool &eof, bool &err) -{ - err = false; - eof = false; - switch(slot) { - case 1: - if(fdc && fdc->get_drq()) { - val = fdc->dma_r(); - if(eof) { - fdc->tc_w(true); - fdc->tc_w(false); - } - } else - val = scsi->dma_r(); - break; - - case 5: - val = mo->dma_r(); - break; - - case 21: - net->rx_dma_r(val, eof); - logerror("dma read net %02x %s\n", val, eof ? "eof" : ""); - break; - - default: - err = true; - val = 0; - break; - } -} - -void next_state::dma_write(int slot, UINT8 data, bool eof, bool &err) -{ - err = false; - switch(slot) { - case 1: - if(fdc && fdc->get_drq()) { - fdc->dma_w(data); - if(eof) { - fdc->tc_w(true); - fdc->tc_w(false); - } - } else - scsi->dma_w(data); - break; - - case 4: - break; - - case 5: - mo->dma_w(data); - break; - - case 17: - net->tx_dma_w(data, eof); - break; - - default: - err = true; - break; - } -} - -void next_state::dma_check_update(int slot) -{ - dma_slot &ds = dma_slots[slot]; - if(ds.restart) { - ds.current = ds.start; - ds.restart = false; - } -} - -void next_state::dma_end(int slot) -{ - dma_slot &ds = dma_slots[slot]; - if(dma_has_saved[slot]) { - dma_slot &ds1 = dma_slots[(slot-1) & 31]; - ds1.current = ds.start; - ds1.limit = ds.current; - } - - if(!ds.supdate) - ds.state &= ~DMA_ENABLE; - else { - ds.start = ds.chain_start; - ds.limit = ds.chain_limit; - ds.restart = true; - ds.supdate = false; - ds.state &= ~DMA_SUPDATE; - } - ds.state |= DMA_COMPLETE; - logerror("dma end slot %d irq %d\n", slot, dma_irqs[slot]); - if(dma_irqs[slot] >= 0) - irq_set(dma_irqs[slot], true); -} - -void next_state::dma_check_end(int slot, bool eof) -{ - dma_slot &ds = dma_slots[slot]; - if(eof || ds.current == (ds.limit & 0x7fffffff)) - dma_end(slot); -} - -READ32_MEMBER( next_state::dma_regs_r) -{ - int slot = offset >> 2; - int reg = offset & 3; - - UINT32 res; - - switch(reg) { - case 0: - res = dma_slots[slot].current; - break; - case 1: - res = dma_slots[slot].limit; - break; - case 2: - res = dma_slots[slot].chain_start; - break; - case 3: default: - res = dma_slots[slot].chain_limit; - break; - } - - const char *name = dma_name(slot); - logerror("dma_regs_r %s:%d %08x (%08x)\n", name, reg, res, space.device().safe_pc()); - - return res; -} - -WRITE32_MEMBER( next_state::dma_regs_w) -{ - int slot = offset >> 2; - int reg = offset & 3; - - const char *name = dma_name(slot); - - logerror("dma_regs_w %s:%d %08x (%08x)\n", name, reg, data, space.device().safe_pc()); - switch(reg) { - case 0: - dma_slots[slot].start = data; - dma_slots[slot].current = data; - break; - case 1: - dma_slots[slot].limit = data; - break; - case 2: - dma_slots[slot].chain_start = data; - break; - case 3: - dma_slots[slot].chain_limit = data; - break; - } -} - -READ32_MEMBER( next_state::dma_ctrl_r) -{ - int slot = offset >> 2; - int reg = offset & 3; - - const char *name = dma_name(slot); - - if(space.device().safe_pc() != 0x409bb4e) - logerror("dma_ctrl_r %s:%d %02x (%08x)\n", name, reg, dma_slots[slot].state, space.device().safe_pc()); - - return reg ? 0 : dma_slots[slot].state << 24; -} - -WRITE32_MEMBER( next_state::dma_ctrl_w) -{ - int slot = offset >> 2; - int reg = offset & 3; - const char *name = dma_name(slot); - logerror("dma_ctrl_w %s:%d %08x @ %08x (%08x)\n", name, reg, data, mem_mask, space.device().safe_pc()); - if(!reg) { - if(ACCESSING_BITS_16_23) - dma_do_ctrl_w(slot, data >> 16); - else if(ACCESSING_BITS_24_31) - dma_do_ctrl_w(slot, data >> 24); - } -} - -void next_state::dma_do_ctrl_w(int slot, UINT8 data) -{ - const char *name = dma_name(slot); -#if 0 - fprintf(stderr, "dma_ctrl_w %s %02x (%08x)\n", name, data, maincpu->pc()); - - fprintf(stderr, " ->%s%s%s%s%s%s%s\n", - data & DMA_SETENABLE ? " enable" : "", - data & DMA_SETSUPDATE ? " supdate" : "", - data & DMA_SETREAD ? " read" : "", - data & DMA_CLRCOMPLETE ? " complete" : "", - data & DMA_RESET ? " reset" : "", - data & DMA_INITBUF ? " initbuf" : "", - data & DMA_INITBUFTURBO ? " initbufturbo" : ""); -#endif - if(data & DMA_SETENABLE) - logerror("dma enable %s %s %08x (%08x)\n", name, data & DMA_SETREAD ? "read" : "write", (dma_slots[slot].limit-dma_slots[slot].start) & 0x7fffffff, maincpu->pc()); - - dma_slot &ds = dma_slots[slot]; - if(data & (DMA_RESET|DMA_INITBUF|DMA_INITBUFTURBO)) { - ds.state = 0; - if(dma_irqs[slot] >= 0) - irq_set(dma_irqs[slot], false); - } - if(data & DMA_SETSUPDATE) { - ds.state |= DMA_SUPDATE; - ds.supdate = true; - } - if(data & DMA_SETREAD) - ds.state |= DMA_READ; - if(data & DMA_CLRCOMPLETE) { - ds.state &= ~DMA_COMPLETE; - if(dma_irqs[slot] >= 0) - irq_set(dma_irqs[slot], false); - } - if(data & DMA_SETENABLE) { - ds.state |= DMA_ENABLE; - // fprintf(stderr, "dma slot %d drq=%s\n", slot, ds.drq ? "on" : "off"); - if(ds.drq) - dma_drq_w(slot, ds.drq); - } -} - -const int next_state::scsi_clocks[4] = { 10000000, 12000000, 20000000, 16000000 }; - -READ32_MEMBER( next_state::scsictrl_r ) -{ - UINT32 res = (scsictrl << 24) | (scsistat << 16); - logerror("scsictrl_read %08x @ %08x (%08x)\n", res, mem_mask, space.device().safe_pc()); - return res; -} - -WRITE32_MEMBER( next_state::scsictrl_w ) -{ - if(ACCESSING_BITS_24_31) { - scsictrl = data >> 24; - if(scsictrl & 0x02) - scsi->reset(); - device_t::static_set_clock(*scsi, scsi_clocks[scsictrl >> 6]); - - logerror("SCSIctrl %dMHz int=%s dma=%s dmadir=%s%s%s dest=%s (%08x)\n", - scsi_clocks[scsictrl >> 6]/1000000, - scsictrl & 0x20 ? "on" : "off", - scsictrl & 0x10 ? "on" : "off", - scsictrl & 0x08 ? "read" : "write", - scsictrl & 0x04 ? " flush" : "", - scsictrl & 0x02 ? " reset" : "", - scsictrl & 0x01 ? "wd3392" : "ncr5390", - space.device().safe_pc()); - } - if(ACCESSING_BITS_16_23) { - scsistat = data >> 16; - logerror("SCSIstat %02x (%08x)\n", data, space.device().safe_pc()); - } -} - -READ32_MEMBER( next_state::event_counter_r) -{ - // Event counters, around that time, are usually fixed-frequency counters. - // This one being 1MHz seems to make sense - - // The v74 rom seems pretty convinced that it's 20 bits only. - - if(ACCESSING_BITS_24_31) - eventc_latch = machine().time().as_ticks(1000000) & 0xfffff; - return eventc_latch; -} - -READ32_MEMBER( next_state::dsp_r) -{ - return 0x7fffffff; -} - -WRITE32_MEMBER( next_state::fdc_control_w ) -{ - logerror("FDC write %02x (%08x)\n", data >> 24, space.device().safe_pc()); -} - -READ32_MEMBER( next_state::fdc_control_r ) -{ - // Type of floppy present - // 0 = no floppy in drive - // 1 = ed - // 2 = hd - // 3 = dd - - // The rom strangely can't boot on anything else than ED, it has - // code for the other densities but forces ED for some mysterious - // reason. The kernel otoh behaves as expected. - - if(fdc) { - floppy_image_device *fdev = machine().device(":fdc:0")->get_device(); - if(fdev->exists()) { - UINT32 variant = fdev->get_variant(); - switch(variant) { - case floppy_image::SSSD: - case floppy_image::SSDD: - case floppy_image::DSDD: - return 3 << 24; - - case floppy_image::DSHD: - return 2 << 24; - - case floppy_image::DSED: - return 1 << 24; - } - } - } - - return 0 << 24; -} - -READ32_MEMBER( next_state::phy_r ) -{ - logerror("phy_r %d %08x (%08x)\n", offset, phy[offset], space.device().safe_pc()); - return phy[offset] | (0 << 24); -} - -WRITE32_MEMBER( next_state::phy_w ) -{ - COMBINE_DATA(phy+offset); - logerror("phy_w %d %08x (%08x)\n", offset, phy[offset], space.device().safe_pc()); -} - -void next_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - irq_set(29, true); - timer_data = timer_next_data; - if(timer_ctrl & 0x40000000) - timer_start(); - else - timer_ctrl &= 0x7fffffff; -} - -READ32_MEMBER( next_state::timer_data_r ) -{ - if(timer_ctrl & 0x80000000) - timer_update(); - return timer_data; -} - -WRITE32_MEMBER( next_state::timer_data_w ) -{ - if(timer_ctrl & 0x80000000) { - COMBINE_DATA(&timer_next_data); - timer_next_data &= 0xffff0000; - } else { - COMBINE_DATA(&timer_data); - timer_data &= 0xffff0000; - } -} - -READ32_MEMBER( next_state::timer_ctrl_r ) -{ - irq_set(29, false); - return timer_ctrl; -} - -WRITE32_MEMBER( next_state::timer_ctrl_w ) -{ - bool oldact = timer_ctrl & 0x80000000; - COMBINE_DATA(&timer_ctrl); - bool newact = timer_ctrl & 0x80000000; - if(oldact != newact) { - if(oldact) { - timer_update(); - irq_set(29, false); - } else { - timer_next_data = timer_data; - timer_start(); - } - } -} - -void next_state::timer_update() -{ - int delta = timer_vbase - (machine().time() - timer_tbase).as_ticks(1000000); - if(delta < 0) - delta = 0; - timer_data = delta << 16; -} - -void next_state::timer_start() -{ - timer_tbase = machine().time(); - timer_vbase = timer_data >> 16; - timer_tm->adjust(attotime::from_usec(timer_vbase)); -} - -WRITE_LINE_MEMBER(next_state::scc_irq) -{ - irq_set(17, state); -} - -WRITE_LINE_MEMBER(next_state::keyboard_irq) -{ - irq_set(3, state); -} - -WRITE_LINE_MEMBER(next_state::power_irq) -{ - irq_set(2, state); -} - -WRITE_LINE_MEMBER(next_state::nmi_irq) -{ - irq_set(31, state); -} - -WRITE_LINE_MEMBER(next_state::fdc_irq) -{ - irq_set(7, state); -} - -WRITE_LINE_MEMBER(next_state::fdc_drq) -{ - dma_drq_w(1, state); -} - -WRITE_LINE_MEMBER(next_state::net_tx_irq) -{ - irq_set(10, state); -} - -WRITE_LINE_MEMBER(next_state::net_rx_irq) -{ - irq_set(9, state); -} - -WRITE_LINE_MEMBER(next_state::net_tx_drq) -{ - dma_drq_w(17, state); -} - -WRITE_LINE_MEMBER(next_state::net_rx_drq) -{ - dma_drq_w(21, state); -} - -WRITE_LINE_MEMBER(next_state::mo_irq) -{ - irq_set(13, state); -} - -WRITE_LINE_MEMBER(next_state::mo_drq) -{ - dma_drq_w(5, state); -} - -WRITE_LINE_MEMBER(next_state::scsi_irq) -{ - irq_set(12, state); -} - -WRITE_LINE_MEMBER(next_state::scsi_drq) -{ - dma_drq_w(1, state); -} - -WRITE8_MEMBER(next_state::ramdac_w) -{ - switch(offset) { - case 0: - switch(data) { - case 0x05: - if(screen_color) - irq_set(13, false); - else - irq_set(5, false); - vbl_enabled = false; - break; - - case 0x06: - vbl_enabled = true; - break; - - default: - fprintf(stderr, "ramdac_w %d, %02x\n", offset, data); - break; - } - break; - - default: - fprintf(stderr, "ramdac_w %d, %02x\n", offset, data); - break; - } -} - -void next_state::setup(UINT32 _scr1, int size_x, int size_y, int skip, bool color) -{ - scr1 = _scr1; - screen_sx = size_x; - screen_sy = size_y; - screen_skip = skip; - screen_color = color; -} - -void next_state::machine_start() -{ - save_item(NAME(scr2)); - save_item(NAME(irq_status)); - save_item(NAME(irq_mask)); - save_item(NAME(irq_level)); - save_item(NAME(phy)); - save_item(NAME(scsictrl)); - save_item(NAME(scsistat)); - save_item(NAME(timer_tbase)); - save_item(NAME(timer_vbase)); - save_item(NAME(timer_data)); - save_item(NAME(timer_next_data)); - save_item(NAME(timer_ctrl)); - save_item(NAME(eventc_latch)); - save_item(NAME(esp)); - - for(int i=0; i<0x20; i++) { - save_item(NAME(dma_slots[i].start), i); - save_item(NAME(dma_slots[i].limit), i); - save_item(NAME(dma_slots[i].chain_start), i); - save_item(NAME(dma_slots[i].chain_limit), i); - save_item(NAME(dma_slots[i].current), i); - save_item(NAME(dma_slots[i].state), i); - save_item(NAME(dma_slots[i].supdate), i); - save_item(NAME(dma_slots[i].restart), i); - save_item(NAME(dma_slots[i].drq), i); - } - - timer_tm = timer_alloc(0); - - system_time systime; - machine().base_datetime(systime); - rtc->set_counter(systime.time); -} - -void next_state::machine_reset() -{ - scr2 = 0; - irq_status = 0; - irq_mask = 0; - irq_level = 0; - esp = 0; - scsictrl = 0; - scsistat = 0; - phy[0] = phy[1] = 0; - eventc_latch = 0; - timer_vbase = 0; - timer_data = 0; - timer_next_data = 0; - timer_ctrl = 0; - vbl_enabled = true; - dma_drq_w(4, true); // soundout -} - -void next_state::vblank_w(screen_device &screen, bool vblank_state) -{ - if(vbl_enabled) { - if(screen_color) - irq_set(13, vblank_state); - else - irq_set(5, vblank_state); - } -} - -static ADDRESS_MAP_START( next_mem, AS_PROGRAM, 32, next_state ) - AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("user1", 0) - AM_RANGE(0x01000000, 0x0101ffff) AM_ROM AM_REGION("user1", 0) - AM_RANGE(0x02000000, 0x020001ff) AM_MIRROR(0x300200) AM_READWRITE(dma_ctrl_r, dma_ctrl_w) - AM_RANGE(0x02004000, 0x020041ff) AM_MIRROR(0x300200) AM_READWRITE(dma_regs_r, dma_regs_w) - AM_RANGE(0x02006000, 0x0200600f) AM_MIRROR(0x300000) AM_DEVICE8("net", mb8795_device, map, 0xffffffff) -// AM_RANGE(0x02006010, 0x02006013) AM_MIRROR(0x300000) memory timing - AM_RANGE(0x02007000, 0x02007003) AM_MIRROR(0x300000) AM_READ(irq_status_r) - AM_RANGE(0x02007800, 0x02007803) AM_MIRROR(0x300000) AM_READWRITE(irq_mask_r,irq_mask_w) - AM_RANGE(0x02008000, 0x02008003) AM_MIRROR(0x300000) AM_READ(dsp_r) - AM_RANGE(0x0200c000, 0x0200c003) AM_MIRROR(0x300000) AM_READ(scr1_r) - AM_RANGE(0x0200c800, 0x0200c803) AM_MIRROR(0x300000) AM_READ(rom_map_r) - AM_RANGE(0x0200d000, 0x0200d003) AM_MIRROR(0x300000) AM_READWRITE(scr2_r,scr2_w) -// AM_RANGE(0x0200d800, 0x0200d803) AM_MIRROR(0x300000) RMTINT - AM_RANGE(0x0200e000, 0x0200e00b) AM_MIRROR(0x300000) AM_DEVICE("keyboard", nextkbd_device, amap) -// AM_RANGE(0x0200f000, 0x0200f003) AM_MIRROR(0x300000) printer -// AM_RANGE(0x02010000, 0x02010003) AM_MIRROR(0x300000) brightness - AM_RANGE(0x02012000, 0x0201201f) AM_MIRROR(0x300000) AM_DEVICE8("mo", nextmo_device, map, 0xffffffff) - AM_RANGE(0x02014000, 0x0201400f) AM_MIRROR(0x300000) AM_DEVICE8("scsibus:7:ncr5390", ncr5390_device, map, 0xffffffff) - AM_RANGE(0x02014020, 0x02014023) AM_MIRROR(0x300000) AM_READWRITE(scsictrl_r, scsictrl_w) - AM_RANGE(0x02016000, 0x02016003) AM_MIRROR(0x300000) AM_READWRITE(timer_data_r, timer_data_w) - AM_RANGE(0x02016004, 0x02016007) AM_MIRROR(0x300000) AM_READWRITE(timer_ctrl_r, timer_ctrl_w) - AM_RANGE(0x02018000, 0x02018003) AM_MIRROR(0x300000) AM_DEVREADWRITE8("scc", scc8530_t, reg_r, reg_w, 0xffffffff) -// AM_RANGE(0x02018004, 0x02018007) AM_MIRROR(0x300000) SCC CLK -// AM_RANGE(0x02018190, 0x02018197) AM_MIRROR(0x300000) warp 9c DRAM timing -// AM_RANGE(0x02018198, 0x0201819f) AM_MIRROR(0x300000) warp 9c VRAM timing - AM_RANGE(0x0201a000, 0x0201a003) AM_MIRROR(0x300000) AM_READ(event_counter_r) // EVENTC -// AM_RANGE(0x020c0000, 0x020c0004) AM_MIRROR(0x300000) BMAP - AM_RANGE(0x020c0030, 0x020c0037) AM_MIRROR(0x300000) AM_READWRITE(phy_r, phy_w) - AM_RANGE(0x04000000, 0x07ffffff) AM_RAM //work ram -// AM_RANGE(0x0c000000, 0x0c03ffff) video RAM w A+B-AB function -// AM_RANGE(0x0d000000, 0x0d03ffff) video RAM w (1-A)B function -// AM_RANGE(0x0e000000, 0x0e03ffff) video RAM w ceil(A+B) function -// AM_RANGE(0x0f000000, 0x0f03ffff) video RAM w AB function -// AM_RANGE(0x10000000, 0x1003ffff) main RAM w A+B-AB function -// AM_RANGE(0x14000000, 0x1403ffff) main RAM w (1-A)B function -// AM_RANGE(0x18000000, 0x1803ffff) main RAM w ceil(A+B) function -// AM_RANGE(0x1c000000, 0x1c03ffff) main RAM w AB function -ADDRESS_MAP_END - -static ADDRESS_MAP_START( next_0b_m_nofdc_mem, AS_PROGRAM, 32, next_state ) - AM_RANGE(0x0b000000, 0x0b03ffff) AM_RAM AM_SHARE("vram") - - AM_IMPORT_FROM(next_mem) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( next_fdc_mem, AS_PROGRAM, 32, next_state ) - AM_RANGE(0x02014100, 0x02014107) AM_MIRROR(0x300000) AM_DEVICE8("fdc", n82077aa_device, map, 0xffffffff) - AM_RANGE(0x02014108, 0x0201410b) AM_MIRROR(0x300000) AM_READWRITE(fdc_control_r, fdc_control_w) - - AM_IMPORT_FROM(next_mem) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( next_0b_m_mem, AS_PROGRAM, 32, next_state ) - AM_RANGE(0x0b000000, 0x0b03ffff) AM_RAM AM_SHARE("vram") - - AM_IMPORT_FROM(next_fdc_mem) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( next_0c_m_mem, AS_PROGRAM, 32, next_state ) - AM_RANGE(0x0c000000, 0x0c1fffff) AM_RAM AM_SHARE("vram") - - AM_IMPORT_FROM(next_fdc_mem) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( next_0c_c_mem, AS_PROGRAM, 32, next_state ) - AM_RANGE(0x0c000000, 0x0c1fffff) AM_RAM AM_SHARE("vram") - AM_RANGE(0x02018180, 0x02018183) AM_MIRROR(0x300000) AM_WRITE8(ramdac_w, 0xffffffff) - - AM_IMPORT_FROM(next_fdc_mem) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( next_2c_c_mem, AS_PROGRAM, 32, next_state ) - AM_RANGE(0x2c000000, 0x2c1fffff) AM_RAM AM_SHARE("vram") - AM_RANGE(0x02018180, 0x02018183) AM_MIRROR(0x300000) AM_WRITE8(ramdac_w, 0xffffffff) - - AM_IMPORT_FROM(next_fdc_mem) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( next ) -INPUT_PORTS_END - -FLOPPY_FORMATS_MEMBER( next_state::floppy_formats ) - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( next_floppies ) - SLOT_INTERFACE( "35ed", FLOPPY_35_ED ) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START( next_scsi_devices ) - SLOT_INTERFACE("cdrom", NSCSI_CDROM) - SLOT_INTERFACE("harddisk", NSCSI_HARDDISK) - SLOT_INTERFACE_INTERNAL("ncr5390", NCR5390) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_FRAGMENT( ncr5390 ) - MCFG_DEVICE_CLOCK(10000000) - MCFG_NCR5390_IRQ_HANDLER(DEVWRITELINE(":", next_state, scsi_irq)) - MCFG_NCR5390_DRQ_HANDLER(DEVWRITELINE(":", next_state, scsi_drq)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( next_base, next_state ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(next_state, screen_update) - MCFG_SCREEN_SIZE(1120, 900) - MCFG_SCREEN_VISIBLE_AREA(0, 1120-1, 0, 832-1) - MCFG_SCREEN_VBLANK_DRIVER(next_state, vblank_w) - - // devices - MCFG_NSCSI_BUS_ADD("scsibus") - MCFG_DEVICE_ADD("rtc", MCCS1850, XTAL_32_768kHz) - MCFG_DEVICE_ADD("scc", SCC8530, XTAL_25MHz) - MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(next_state, scc_irq)) - MCFG_DEVICE_ADD("keyboard", NEXTKBD, 0) - MCFG_NEXTKBD_INT_CHANGE_CALLBACK(WRITELINE(next_state, keyboard_irq)) - MCFG_NEXTKBD_INT_POWER_CALLBACK(WRITELINE(next_state, power_irq)) - MCFG_NEXTKBD_INT_NMI_CALLBACK(WRITELINE(next_state, nmi_irq)) - MCFG_NSCSI_ADD("scsibus:0", next_scsi_devices, "harddisk", false) - MCFG_NSCSI_ADD("scsibus:1", next_scsi_devices, "cdrom", false) - MCFG_NSCSI_ADD("scsibus:2", next_scsi_devices, 0, false) - MCFG_NSCSI_ADD("scsibus:3", next_scsi_devices, 0, false) - MCFG_NSCSI_ADD("scsibus:4", next_scsi_devices, 0, false) - MCFG_NSCSI_ADD("scsibus:5", next_scsi_devices, 0, false) - MCFG_NSCSI_ADD("scsibus:6", next_scsi_devices, 0, false) - MCFG_NSCSI_ADD("scsibus:7", next_scsi_devices, "ncr5390", true) - MCFG_DEVICE_CARD_MACHINE_CONFIG("ncr5390", ncr5390) - - MCFG_DEVICE_ADD("net", MB8795, 0) - MCFG_MB8795_TX_IRQ_CALLBACK(WRITELINE(next_state, net_tx_irq)) - MCFG_MB8795_RX_IRQ_CALLBACK(WRITELINE(next_state, net_rx_irq)) - MCFG_MB8795_TX_DRQ_CALLBACK(WRITELINE(next_state, net_tx_drq)) - MCFG_MB8795_RX_DRQ_CALLBACK(WRITELINE(next_state, net_rx_drq)) - - MCFG_DEVICE_ADD("mo", NEXTMO, 0) - MCFG_NEXTMO_IRQ_CALLBACK(WRITELINE(next_state, mo_irq)) - MCFG_NEXTMO_DRQ_CALLBACK(WRITELINE(next_state, mo_drq)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( next, next_base ) - MCFG_CPU_ADD("maincpu", M68030, XTAL_25MHz) - MCFG_CPU_PROGRAM_MAP(next_0b_m_nofdc_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( next_fdc_base, next_base ) - MCFG_N82077AA_ADD("fdc", n82077aa_device::MODE_PS2) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(next_state, fdc_irq)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE(next_state, fdc_drq)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", next_floppies, "35ed", next_state::floppy_formats) - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "next") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nexts, next_fdc_base ) - MCFG_CPU_ADD("maincpu", M68040, XTAL_25MHz) - MCFG_CPU_PROGRAM_MAP(next_0b_m_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nexts2, next_fdc_base ) - MCFG_CPU_ADD("maincpu", M68040, XTAL_25MHz) - MCFG_CPU_PROGRAM_MAP(next_0b_m_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nextsc, next_fdc_base ) - MCFG_CPU_ADD("maincpu", M68040, XTAL_25MHz) - MCFG_CPU_PROGRAM_MAP(next_2c_c_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nextst, next_fdc_base ) - MCFG_CPU_ADD("maincpu", M68040, XTAL_33MHz) - MCFG_CPU_PROGRAM_MAP(next_0b_m_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nextstc, next_fdc_base ) - MCFG_CPU_ADD("maincpu", M68040, XTAL_33MHz) - MCFG_CPU_PROGRAM_MAP(next_0c_c_mem) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VISIBLE_AREA(0, 832-1, 0, 624-1) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nextct, next_fdc_base ) - MCFG_CPU_ADD("maincpu", M68040, XTAL_33MHz) - MCFG_CPU_PROGRAM_MAP(next_0c_m_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nextctc, next_fdc_base ) - MCFG_CPU_ADD("maincpu", M68040, XTAL_33MHz) - MCFG_CPU_PROGRAM_MAP(next_0c_c_mem) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VISIBLE_AREA(0, 832-1, 0, 624-1) -MACHINE_CONFIG_END - -/* ROM definition */ -#define ROM_NEXT_V1 \ - ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) \ - ROM_SYSTEM_BIOS( 0, "v12", "v1.2" ) /* MAC address/serial number word at 0xC: 005AD0 */ \ - ROMX_LOAD( "rev_1.2.bin", 0x0000, 0x10000, CRC(7070bd78) SHA1(e34418423da61545157e36b084e2068ad41c9e24), ROM_BIOS(1)) /* Label: "(C) 1990 NeXT, Inc. // All Rights Reserved. // Release 1.2 // 1142.02", underlabel exists but unknown */ \ - ROM_SYSTEM_BIOS( 1, "v10", "v1.0 v41" ) /* MAC address/serial number word at 0xC: 003090 */ \ - ROMX_LOAD( "rev_1.0_v41.bin", 0x0000, 0x10000, CRC(54df32b9) SHA1(06e3ecf09ab67a571186efd870e6b44028612371), ROM_BIOS(2)) /* Label: "(C) 1989 NeXT, Inc. // All Rights Reserved. // Release 1.0 // 1142.00", underlabel: "MYF // 1.0.41 // 0D5C" */ \ - ROM_SYSTEM_BIOS( 2, "v10p", "v1.0 v41 alternate" ) /* MAC address/serial number word at 0xC: 0023D9 */ \ - ROMX_LOAD( "rev_1.0_proto.bin", 0x0000, 0x10000, CRC(f44974f9) SHA1(09eaf9f5d47e379cfa0e4dc377758a97d2869ddc), ROM_BIOS(3)) /* Label: "(C) 1989 NeXT, Inc. // All Rights Reserved. // Release 1.0 // 1142.00", no underlabel */ - -#define ROM_NEXT_V2 \ - ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) \ - ROM_SYSTEM_BIOS( 0, "v25", "v2.5 v66" ) /* MAC address/serial number word at 0xC: 00F302 */ \ - ROMX_LOAD( "rev_2.5_v66.bin", 0x0000, 0x20000, CRC(f47e0bfe) SHA1(b3534796abae238a0111299fc406a9349f7fee24), ROM_BIOS(1)) \ - ROM_SYSTEM_BIOS( 1, "v24", "v2.4 v65" ) /* MAC address/serial number word at 0xC: 00A634 */ \ - ROMX_LOAD( "rev_2.4_v65.bin", 0x0000, 0x20000, CRC(74e9e541) SHA1(67d195351288e90818336c3a84d55e6a070960d2), ROM_BIOS(2)) \ - ROM_SYSTEM_BIOS( 2, "v22", "v2.2 v63" ) /* MAC address/serial number word at 0xC: 00894C */ \ - ROMX_LOAD( "rev_2.2_v63.bin", 0x0000, 0x20000, CRC(739d7c07) SHA1(48ffe54cf2038782a92a0850337c5c6213c98571), ROM_BIOS(3)) /* Label: "(C) 1990 NeXT Computer, Inc. // All Rights Reserved. // Release 2.1 // 2918.AB" */ \ - ROM_SYSTEM_BIOS( 3, "v21", "v2.1 v59" ) /* MAC address/serial number word at 0xC: 0072FE */ \ - ROMX_LOAD( "rev_2.1_v59.bin", 0x0000, 0x20000, CRC(f20ef956) SHA1(09586c6de1ca73995f8c9b99870ee3cc9990933a), ROM_BIOS(4)) \ - ROM_SYSTEM_BIOS( 4, "v12", "v1.2 v58" ) /* MAC address/serial number word at 0xC: 006372 */ \ - ROMX_LOAD( "rev_1.2_v58.bin", 0x0000, 0x20000, CRC(b815b6a4) SHA1(97d8b09d03616e1487e69d26609487486db28090), ROM_BIOS(5)) /* Label: "V58 // (C) 1990 NeXT, Inc. // All Rights Reserved // Release 1.2 // 1142.02" */ - -#define ROM_NEXT_V3 \ - ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) \ - ROM_SYSTEM_BIOS( 0, "v33", "v3.3 v74" ) /* MAC address/serial number word at 0xC: 123456 */ \ - ROMX_LOAD( "rev_3.3_v74.bin", 0x0000, 0x20000, CRC(fbc3a2cd) SHA1(a9bef655f26f97562de366e4a33bb462e764c929), ROM_BIOS(1)) \ - ROM_SYSTEM_BIOS( 1, "v32", "v3.2 v72" ) /* MAC address/serial number word at 0xC: 012f31 */ \ - ROMX_LOAD( "rev_3.2_v72.bin", 0x0000, 0x20000, CRC(e750184f) SHA1(ccebf03ed090a79c36f761265ead6cd66fb04329), ROM_BIOS(2)) \ - ROM_SYSTEM_BIOS( 2, "v30", "v3.0 v70" ) /* MAC address/serial number word at 0xC: 0106e8 */ \ - ROMX_LOAD( "rev_3.0_v70.bin", 0x0000, 0x20000, CRC(37250453) SHA1(a7e42bd6a25c61903c8ca113d0b9a624325ee6cf), ROM_BIOS(3)) - - -ROM_START(next) - ROM_NEXT_V1 -ROM_END - -ROM_START(nexts) - ROM_NEXT_V2 -ROM_END - -ROM_START(nexts2) - ROM_NEXT_V2 -ROM_END - -ROM_START(nextsc) - ROM_NEXT_V2 -ROM_END - -ROM_START(nextst) - ROM_NEXT_V3 -ROM_END - -ROM_START(nextstc) - ROM_NEXT_V3 -ROM_END - -ROM_START(nextct) - ROM_NEXT_V3 -ROM_END - -ROM_START(nextctc) - ROM_NEXT_V3 -ROM_END - -DRIVER_INIT_MEMBER(next_state,next) -{ - setup(0x00010002, 1120, 832, 2, false); -} - -DRIVER_INIT_MEMBER(next_state,nexts) -{ - setup(0x00011002, 1120, 832, 2, false); -} - -DRIVER_INIT_MEMBER(next_state,nexts2) -{ - setup(0x00012102, 1120, 832, 2, false); -} - -DRIVER_INIT_MEMBER(next_state,nextsc) -{ - setup(0x00013102, 1120, 832, 16, true); -} - -DRIVER_INIT_MEMBER(next_state,nextst) -{ - setup(0x00014103, 1120, 832, 2, false); -} - -DRIVER_INIT_MEMBER(next_state,nextstc) -{ - setup(0x00015103, 832, 624, 0, true); -} - -DRIVER_INIT_MEMBER(next_state,nextct) -{ - setup(0x00018103, 1120, 832, 0, false); -} - -DRIVER_INIT_MEMBER(next_state,nextctc) -{ - setup(0x00019103, 832, 624, 0, true); -} - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, next, 0, 0, next, next, next_state, next, "Next Software Inc", "NeXT Cube", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1990, nexts, 0, 0, nexts, next, next_state, nexts, "Next Software Inc", "NeXTstation", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1990, nexts2, nexts, 0, nexts2, next, next_state, nexts2, "Next Software Inc", "NeXTstation (X15 variant)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1990, nextsc, nexts, 0, nextsc, next, next_state, nextsc, "Next Software Inc", "NeXTstation color", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1990, nextst, 0, 0, nextst, next, next_state, nextst, "Next Software Inc", "NeXTstation turbo", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1990, nextstc, nextst, 0, nextstc, next, next_state, nextstc, "Next Software Inc", "NeXTstation turbo color", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( ????, nextct, nextst, 0, nextct, next, next_state, nextct, "Next Software Inc", "NeXT Cube turbo", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( ????, nextctc, nextst, 0, nextctc, next, next_state, nextctc, "Next Software Inc", "NeXT Cube turbo color", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/ng_aes.c b/src/mess/drivers/ng_aes.c deleted file mode 100644 index 63f49e0823a..00000000000 --- a/src/mess/drivers/ng_aes.c +++ /dev/null @@ -1,1641 +0,0 @@ -// license:??? -// copyright-holders:Bryan McPhail,Fuzz,Ernesto Corvi,Andrew Prime,Zsolt Vasvari -/*************************************************************************** - - Neo-Geo AES hardware - - Credits (from MAME neogeo.c, since this is just a minor edit of that driver): - * This driver was made possible by the research done by - Charles MacDonald. For a detailed description of the Neo-Geo - hardware, please visit his page at: - http://cgfm2.emuviews.com/temp/mvstech.txt - * Presented to you by the Shin Emu Keikaku team. - * The following people have all spent probably far - too much time on this: - AVDB - Bryan McPhail - Fuzz - Ernesto Corvi - Andrew Prime - Zsolt Vasvari - - MESS cartridge support by R. Belmont based on work by Michael Zapf - - Current status: - - Cartridges run. - - Riding Hero runs in slow-mo due to the unemulated comm link MCU in the cartridge. - In MAME if dip SW6 is set to ON to enable link play, it runs the same way! - On AES there are no dipswitches, and so it always tries to talk to the MCU. - - - Neo-Geo CD hardware - - Thanks to: - * The FBA team (Barry Harris) for much of the CDC / CDD code and system details. - ( http://www.barryharris.me.uk/ ) - * Mirko Buffoni for a commented disassembly of the NeoCD bios rom. - - Current status: - - NeoCDZ runs, the original NeoCD does not - - Might think the tray is open? (check) - - Some unknown / unhandled CD commands, code is still a bit messy - - CDDA continues to play during loading, should stop it - - Games using Raster Effects are broken without a kludge - - CPU gets overloaded with IRQs from the timer callback... - - Double Dragon doesn't load, it erases the IRQ table - - might need better handling of the Vector Table Mapping, or better interrupts (see point above) - - Softlist are based on an old Tosec set and should be updated to the TruRip set once we can convert CCD - without throwing away gap data etc. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "includes/neogeo.h" -#include "machine/nvram.h" -#include "cpu/z80/z80.h" -#include "sound/2610intf.h" -#include "imagedev/chd_cd.h" -#include "sound/cdda.h" -#include "machine/megacdcd.h" - - -extern const char layout_neogeo[]; - - - - - -/* Stubs for various functions called by the FBA code, replace with MAME specifics later */ - -UINT8 *NeoSpriteRAM, *NeoTextRAM; -//UINT8* NeoSpriteROM; -//UINT8* NeoTextROM; -UINT8* YM2610ADPCMAROM; -UINT8* NeoZ80ROMActive; - -// was it actually released in eu / asia? -#define NEOCD_REGION_ASIA 3 // IronClad runs with a darkened screen (MVS has the same issue) -#define NEOCD_REGION_EUROPE 2 // ^ -#define NEOCD_REGION_US 1 -#define NEOCD_REGION_JAPAN 0 - - -UINT8 NeoSystem = NEOCD_REGION_JAPAN; - - - - - - - - -class ng_aes_state : public neogeo_state -{ -public: - ng_aes_state(const machine_config &mconfig, device_type type, const char *tag) - : neogeo_state(mconfig, type, tag) - , m_tempcdc(*this,"tempcdc") - , m_io_in2(*this, "IN2") - , m_io_in0(*this, "IN0") - , m_io_in1(*this, "IN1") - , m_io_mj01_p1(*this, "MJ01_P1") - , m_io_mj02_p1(*this, "MJ02_P1") - , m_io_mj03_p1(*this, "MJ03_P1") - , m_io_mj04_p1(*this, "MJ04_P1") - , m_io_mj01_p2(*this, "MJ01_P2") - , m_io_mj02_p2(*this, "MJ02_P2") - , m_io_mj03_p2(*this, "MJ03_P2") - , m_io_mj04_p2(*this, "MJ04_P2") - , m_io_ctrlsel(*this, "CTRLSEL") - { - NeoCDDMAAddress1 = 0; - NeoCDDMAAddress2 = 0; - NeoCDDMAValue1 = 0; - NeoCDDMAValue2 = 0; - NeoCDDMACount = 0; - NeoCDDMAMode = 0; - nIRQAcknowledge = ~0; - nNeoCDIRQVectorAck = 0; - nNeoCDIRQVector = 0; - m_has_sprite_bus = true; - m_has_text_bus = true; - m_has_ymrom_bus = true; - m_has_z80_bus = true; - } - - optional_device m_tempcdc; - - - - void NeoCDDoDMA(address_space& curr_space); - void set_DMA_regs(int offset, UINT16 wordValue); - - DECLARE_READ16_MEMBER(neocd_memcard_r); - DECLARE_WRITE16_MEMBER(neocd_memcard_w); - DECLARE_READ16_MEMBER(neocd_control_r); - DECLARE_WRITE16_MEMBER(neocd_control_w); - DECLARE_READ8_MEMBER(neocd_transfer_r); - DECLARE_WRITE8_MEMBER(neocd_transfer_w); - DECLARE_READ16_MEMBER(aes_in0_r); - DECLARE_READ16_MEMBER(aes_in1_r); - DECLARE_READ16_MEMBER(aes_in2_r); - - DECLARE_INPUT_CHANGED_MEMBER(aes_jp1); - - DECLARE_MACHINE_START(neocd); - DECLARE_MACHINE_START(neogeo); - DECLARE_MACHINE_RESET(neogeo); - DECLARE_MACHINE_RESET(neocd); - - // neoCD - - UINT8 neogeoReadTransfer(UINT32 sekAddress, int is_byte_transfer); - void neogeoWriteTransfer(UINT32 sekAddress, UINT8 byteValue, int is_byte_transfer); - - INT32 nActiveTransferArea; - INT32 nSpriteTransferBank; - INT32 nADPCMTransferBank; - INT32 NeoCDDMAAddress1; - INT32 NeoCDDMAAddress2; - INT32 NeoCDDMAValue1; - INT32 NeoCDDMAValue2; - INT32 NeoCDDMACount; - INT32 NeoCDDMAMode; - INT32 nIRQAcknowledge; - int nNeoCDIRQVectorAck; - int nNeoCDIRQVector; - - bool m_has_sprite_bus; - bool m_has_text_bus; - bool m_has_ymrom_bus; - bool m_has_z80_bus; - - int get_nNeoCDIRQVectorAck(void) { return nNeoCDIRQVectorAck; } - void set_nNeoCDIRQVectorAck(int val) { nNeoCDIRQVectorAck = val; } - int get_nNeoCDIRQVector(void) { return nNeoCDIRQVector; } - void NeoCDIRQUpdate(UINT8 byteValue); - - // from the CDC - void interrupt_callback_type1(void); - void interrupt_callback_type2(void); - void interrupt_callback_type3(void); - - UINT8 nTransferWriteEnable; - - bool prohibit_cdc_irq; // hack? - - UINT32 screen_update_neocd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_DRIVER_INIT(neogeo); - - DECLARE_DRIVER_INIT(neocdz); - DECLARE_DRIVER_INIT(neocdzj); - - IRQ_CALLBACK_MEMBER(neocd_int_callback); - - UINT8 *m_meminternal_data; -protected: - required_ioport m_io_in2; - required_ioport m_io_in0; - required_ioport m_io_in1; - required_ioport m_io_mj01_p1; - required_ioport m_io_mj02_p1; - required_ioport m_io_mj03_p1; - required_ioport m_io_mj04_p1; - required_ioport m_io_mj01_p2; - required_ioport m_io_mj02_p2; - required_ioport m_io_mj03_p2; - required_ioport m_io_mj04_p2; - required_ioport m_io_ctrlsel; - - void common_machine_start(); - INT32 SekIdle(INT32 nCycles); -}; - - - - - - -/************************************* - * - * Memory card - * - *************************************/ - -#define MEMCARD_SIZE 0x0800 - - -/* The NeoCD has an 8kB internal memory card, instead of memcard slots like the MVS and AES */ -READ16_MEMBER(ng_aes_state::neocd_memcard_r) -{ - return m_meminternal_data[offset] | 0xff00; -} - - -WRITE16_MEMBER(ng_aes_state::neocd_memcard_w) -{ - if (ACCESSING_BITS_0_7) - { - m_meminternal_data[offset] = data; - } -} - - - - - - -/************************************* - * - * System control register - * - *************************************/ - - - -READ16_MEMBER(ng_aes_state::neocd_control_r) -{ - UINT32 sekAddress = 0xff0000+ (offset*2); - - switch (sekAddress & 0xFFFF) { - case 0x0016: - return m_tempcdc->nff0016_r(); - - // LC8951 registers - case 0x0100: - return m_tempcdc->segacd_cdc_mode_address_r(space, 0, 0xffff); - case 0x0102: - return m_tempcdc->CDC_Reg_r(); - - // CD mechanism communication - case 0x0160: - return m_tempcdc->neocd_cdd_rx_r(); - - case 0x011C: // region - return ~((0x10 | (NeoSystem & 3)) << 8); - } - - -// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X read (word, PC: 0x%06X)\n"), sekAddress, SekGetPC(-1)); - - return ~0; -} - - -WRITE16_MEMBER(ng_aes_state::neocd_control_w) -{ - UINT32 sekAddress = 0xff0000+ (offset*2); - UINT16 wordValue = data; - -// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); - int byteValue = wordValue & 0xff; - - switch (sekAddress & 0xFFFE) { - case 0x0002: - - m_tempcdc->nff0002_set(wordValue); - - break; - - case 0x000E: - NeoCDIRQUpdate(wordValue); // irqack - break; - - case 0x0016: - m_tempcdc->nff0016_set(byteValue); - break; - - // DMA controller - case 0x0060: - if (byteValue & 0x40) { - NeoCDDoDMA(space); - } - break; - - case 0x0064: - case 0x0066: - case 0x0068: - case 0x006A: - case 0x006C: - case 0x006E: - case 0x0070: - case 0x0072: - case 0x007E: - set_DMA_regs(sekAddress & 0xFFFE, wordValue); - break; - - // upload DMA controller program - - case 0x0080: - case 0x0082: - case 0x0084: - case 0x0086: - case 0x0088: - case 0x008A: - case 0x008C: - case 0x008E: -// bprintf(PRINT_NORMAL, _T(" - DMA controller program[%02i] -> 0x%04X (PC: 0x%06X)\n"), sekAddress & 0x0F, wordValue, SekGetPC(-1)); - break; - - // LC8951 registers - case 0x0100: - m_tempcdc->segacd_cdc_mode_address_w(space, 0, byteValue, 0xffff); - break; - case 0x0102: - m_tempcdc->CDC_Reg_w(byteValue); - break; - - case 0x0104: -// bprintf(PRINT_NORMAL, _T(" - NGCD 0xE00000 area -> 0x%02X (PC: 0x%06X)\n"), byteValue, SekGetPC(-1)); - if (ACCESSING_BITS_0_7) - { - nActiveTransferArea = byteValue; - } - break; - - case 0x0120: -// bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); - m_has_sprite_bus = false; - break; - case 0x0122: -// bprintf(PRINT_NORMAL, _T(" - NGCD PCM BUSREQ -> 1 (PC: 0x%06X) %x\n"), SekGetPC(-1), byteValue); - m_has_ymrom_bus = false; - break; - case 0x0126: -// bprintf(PRINT_NORMAL, _T(" - NGCD Z80 BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); - m_has_z80_bus = false; - space.machine().scheduler().synchronize(); - m_audiocpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - break; - case 0x0128: -// bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 1 (PC: 0x%06X)\n"), SekGetPC(-1)); - m_has_text_bus = false; - break; - case 0x0140: -// bprintf(PRINT_NORMAL, _T(" - NGCD OBJ BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); - m_has_sprite_bus = true; - m_sprgen->optimize_sprite_data(); - break; - case 0x0142: -// bprintf(PRINT_NORMAL, _T(" - NGCD PCM BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); - m_has_ymrom_bus = true; - break; - case 0x0146: -// bprintf(PRINT_NORMAL, _T(" - NGCD Z80 BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); - m_has_z80_bus = true; - space.machine().scheduler().synchronize(); - m_audiocpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - break; - case 0x0148: -// bprintf(PRINT_NORMAL, _T(" - NGCD FIX BUSREQ -> 0 (PC: 0x%06X)\n"), SekGetPC(-1)); - m_has_text_bus = true; - break; - - // CD mechanism communication - case 0x0162: - m_tempcdc->neocd_cdd_tx_w(byteValue); - break; - case 0x0164: - m_tempcdc->NeoCDCommsControl(byteValue & 1, byteValue & 2); - break; - - case 0x016c: -// bprintf(PRINT_ERROR, _T(" - NGCD port 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1)); - //MapVectorTable(!(byteValue == 0xFF)); - if (ACCESSING_BITS_0_7) - { - // even like this doubledr ends up mapping vectors in, then erasing them causing the loading to crash?? - // is there some way to enable write protection on the RAM vector area or is it some IRQ masking issue? - // the games still write to the normal address for this too? - // writes 00 / 01 / ff - printf("MapVectorTable? %04x %04x\n",data,mem_mask); - - //m_bank_vectors->set_entry(data == 0 ? 0 : 1); - m_use_cart_vectors = (data == 0 ? 0 : 1); - } - -//extern INT32 bRunPause; -//bRunPause = 1; - break; - - case 0x016e: -// bprintf(PRINT_IMPORTANT, _T(" - NGCD 0xE00000 area write access %s (0x%02X, PC: 0x%06X)\n"), byteValue ? _T("enabled") : _T("disabled"), byteValue, SekGetPC(-1)); - - nTransferWriteEnable = byteValue; - break; - - case 0x0180: { - // 1 during CD access, 0 otherwise, written frequently - //printf("reset cdc %04x %04x\n",data, mem_mask); - - if (ACCESSING_BITS_0_7) - { - if (data==0x00) - { - // not a good idea, causes hangs - // m_tempcdc->NeoCDCommsReset(); - - // I doubt this is correct either, but we need something to stop - // the interrupts during gameplay and I'm not sure what... - prohibit_cdc_irq = true; - } - else - { - prohibit_cdc_irq = false; - } - } - break; - } - case 0x0182: { - // printf("blah %02x\n", byteValue); - if (byteValue == 0x00) - { - machine().device("ymsnd")->reset(); - m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - } - else m_audiocpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - - break; - } - case 0x01A0: - nSpriteTransferBank = (byteValue & 3) << 20; - break; - case 0x01A2: - nADPCMTransferBank = (byteValue & 1) << 19; - break; - - - default: { -// bprintf(PRINT_NORMAL, _T(" - NGCD port 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1)); - } - } - -} - - - - -/* - * Handling NeoCD banked RAM - * When the Z80 space is banked in to 0xe00000, only the low byte of each word is used - */ - - -READ8_MEMBER(ng_aes_state::neocd_transfer_r) -{ - UINT32 sekAddress = 0xe00000+ (offset); - int address; - sekAddress ^= 1; - - switch (nActiveTransferArea) { - case 0: // Sprites - address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF)); - - // address is swizzled a bit due to out sprite decoding - if ((address&3)==0) return NeoSpriteRAM[address]; - if ((address&3)==1) return NeoSpriteRAM[address^3]; - if ((address&3)==2) return NeoSpriteRAM[address^3]; - if ((address&3)==3) return NeoSpriteRAM[address]; - - return NeoSpriteRAM[nSpriteTransferBank + (sekAddress & 0x0FFFFF)]; - case 1: // ADPCM - return YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)]; - case 4: // Z80 - if ((sekAddress & 0xfffff) >= 0x20000) return ~0; - return NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1]; - case 5: // Text - return NeoTextRAM[(sekAddress & 0x3FFFF) >> 1]; - } - - return ~0; - -} - -WRITE8_MEMBER(ng_aes_state::neocd_transfer_w) -{ - UINT8 byteValue = data; - UINT32 sekAddress = 0xe00000+ (offset); - - if (!nTransferWriteEnable) { -// return; - } - int address; - - sekAddress ^= 1; - - switch (nActiveTransferArea) { - case 0: // Sprites - address = (nSpriteTransferBank + (sekAddress & 0x0FFFFF)); - - // address is swizzled a bit due to out sprite decoding - if ((address&3)==0) NeoSpriteRAM[address] = byteValue; - if ((address&3)==1) NeoSpriteRAM[address^3] = byteValue; - if ((address&3)==2) NeoSpriteRAM[address^3] = byteValue; - if ((address&3)==3) NeoSpriteRAM[address] = byteValue; - - break; - case 1: // ADPCM - YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue; - break; - case 4: // Z80 - - // kof98 and lresort attempt to write here when the system still has the z80 bank - // it seems they attempt to write regular samples (not even deltat) maybe there is - // some kind of fall-through behavior, or it shouldn't be allowed to select a - // transfer area without the bus? - this should really be checked on hw - if (m_has_z80_bus) - { - YM2610ADPCMAROM[nADPCMTransferBank + ((sekAddress & 0x0FFFFF) >> 1)] = byteValue; - } - else - { - // printf("sekAddress %08x %02x\n", sekAddress, data); - if ((sekAddress & 0xfffff) >= 0x20000) break; - NeoZ80ROMActive[(sekAddress & 0x1FFFF) >> 1] = byteValue; - } - break; - case 5: // Text - NeoTextRAM[(sekAddress & 0x3FFFF) >> 1] = byteValue; - break; - } -} - - - -void ng_aes_state::set_DMA_regs(int offset, UINT16 wordValue) -{ - switch (offset) - { - case 0x0064: - NeoCDDMAAddress1 &= 0x0000FFFF; - NeoCDDMAAddress1 |= wordValue << 16; - break; - case 0x0066: - NeoCDDMAAddress1 &= 0xFFFF0000; - NeoCDDMAAddress1 |= wordValue; - break; - case 0x0068: - NeoCDDMAAddress2 &= 0x0000FFFF; - NeoCDDMAAddress2 |= wordValue << 16; - break; - case 0x006A: - NeoCDDMAAddress2 &= 0xFFFF0000; - NeoCDDMAAddress2 |= wordValue; - break; - case 0x006C: - NeoCDDMAValue1 = wordValue; - break; - case 0x006E: - NeoCDDMAValue2 = wordValue; - break; - case 0x0070: - NeoCDDMACount &= 0x0000FFFF; - NeoCDDMACount |= wordValue << 16; - break; - case 0x0072: - NeoCDDMACount &= 0xFFFF0000; - NeoCDDMACount |= wordValue; - break; - - case 0x007E: - NeoCDDMAMode = wordValue; -// bprintf(PRINT_NORMAL, _T(" - DMA controller 0x%2X -> 0x%04X (PC: 0x%06X)\n"), sekAddress & 0xFF, wordValue, SekGetPC(-1)); - break; - - } -} - - - -INT32 ng_aes_state::SekIdle(INT32 nCycles) -{ - return nCycles; -} - - - -/* - * CD-ROM / DMA control - * - * DMA - - FF0061 Write 0x40 means start DMA transfer - FF0064 Source address (in copy mode), Target address (in filll mode) - FF0068 Target address (in copy mode) - FF006C Fill word - FF0070 Words count - FF007E \ - ...... | DMA programming words? NeoGeoCD uses Sanyo Puppet LC8359 chip to - FF008E / interface with CD, and do DMA transfers - - Memory access control - - FF011C DIP SWITCH (Region code) - FF0105 Area Selector (5 = FIX, 0 = SPR, 4 = Z80, 1 = PCM) - FF01A1 Sprite bank selector - FF01A3 PCM bank selector - FF0120 Prepare sprite area for transfer - FF0122 Prepare PCM area for transfer - FF0126 Prepare Z80 area for transfer - FF0128 Prepare Fix area for transfer - FF0140 Terminate work on Spr Area (Sprites must be decoded here) - FF0142 Terminate work on Pcm Area - FF0146 Terminate work on Z80 Area (Z80 needs to be reset) - FF0148 Terminate work on Fix Area - - CD-ROM: - 0xff0102 == 0xF0 start cd transfer - int m=bcd(fast_r8(0x10f6c8)); - int s=bcd(fast_r8(0x10f6c9)); - int f=bcd(fast_r8(0x10f6ca)); - int seccount=fast_r16(0x10f688); - - inisec=((m*60)+s)*75+f; - inisec-=150; - dstaddr=0x111204; // this must come from somewhere - - the value @ 0x10f688 is decremented each time a sector is read until it's 0. - - * - */ - - -void ng_aes_state::NeoCDDoDMA(address_space& curr_space) -{ - // The LC8953 chip has a programmable DMA controller, which is not properly emulated. - // Since the software only uses it in a limited way, we can apply a simple heuristic - // to determnine the requested operation. - - // Additionally, we don't know how many cycles DMA operations take. - // Here, only bus access is used to get a rough approximation -- - // each read/write takes a single cycle, setup and everything else is ignored. - -// bprintf(PRINT_IMPORTANT, _T(" - DMA controller transfer started (PC: 0x%06X)\n"), SekGetPC(-1)); - - switch (NeoCDDMAMode) { - case 0xCFFD: { -// bprintf(PRINT_NORMAL, _T(" adr : 0x%08X - 0x%08X <- address, skip odd bytes\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 8); - - // - DMA controller 0x7E -> 0xCFFD (PC: 0xC07CE2) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) - // - DMA controller program[02] -> 0xE8DA (PC: 0xC07CEE) - // - DMA controller program[04] -> 0x92DA (PC: 0xC07CF4) - // - DMA controller program[06] -> 0x92DB (PC: 0xC07CFA) - // - DMA controller program[08] -> 0x96DB (PC: 0xC07D00) - // - DMA controller program[10] -> 0x96F6 (PC: 0xC07D06) - // - DMA controller program[12] -> 0x2E02 (PC: 0xC07D0C) - // - DMA controller program[14] -> 0xFDFF (PC: 0xC07D12) - - SekIdle(NeoCDDMACount * 4); - - while (NeoCDDMACount--) { - curr_space.write_word(NeoCDDMAAddress1 + 0, NeoCDDMAAddress1 >> 24); - curr_space.write_word(NeoCDDMAAddress1 + 2, NeoCDDMAAddress1 >> 16); - curr_space.write_word(NeoCDDMAAddress1 + 4, NeoCDDMAAddress1 >> 8); - curr_space.write_word(NeoCDDMAAddress1 + 6, NeoCDDMAAddress1 >> 0); - NeoCDDMAAddress1 += 8; - } - - break; - } - - case 0xE2DD: { -// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- 0x%08X - 0x%08X, skip odd bytes\n"), NeoCDDMAAddress2, NeoCDDMAAddress2 + NeoCDDMACount * 2, NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); - - // - DMA controller 0x7E -> 0xE2DD (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0x82BE (PC: 0xC0A194) - // - DMA controller program[04] -> 0x93DA (PC: 0xC0A196) - // - DMA controller program[06] -> 0xBE93 (PC: 0xC0A198) - // - DMA controller program[08] -> 0xDABE (PC: 0xC0A19A) - // - DMA controller program[10] -> 0xF62D (PC: 0xC0A19C) - // - DMA controller program[12] -> 0x02FD (PC: 0xC0A19E) - // - DMA controller program[14] -> 0xFFFF (PC: 0xC0A1A0) - - SekIdle(NeoCDDMACount * 1); - - while (NeoCDDMACount--) { - curr_space.write_word(NeoCDDMAAddress2 + 0, curr_space.read_byte(NeoCDDMAAddress1 + 0)); - curr_space.write_word(NeoCDDMAAddress2 + 2, curr_space.read_byte(NeoCDDMAAddress1 + 1)); - NeoCDDMAAddress1 += 2; - NeoCDDMAAddress2 += 4; - } - - break; - } - - case 0xFC2D: { -// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- LC8951 external buffer, skip odd bytes\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); - - // - DMA controller 0x7E -> 0xFC2D (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0x8492 (PC: 0xC0A194) - // - DMA controller program[04] -> 0xDA92 (PC: 0xC0A196) - // - DMA controller program[06] -> 0xDAF6 (PC: 0xC0A198) - // - DMA controller program[08] -> 0x2A02 (PC: 0xC0A19A) - // - DMA controller program[10] -> 0xFDFF (PC: 0xC0A19C) - // - DMA controller program[12] -> 0x48E7 (PC: 0xC0A19E) - // - DMA controller program[14] -> 0xFFFE (PC: 0xC0A1A0) - - char* data = m_tempcdc->LC8915InitTransfer(NeoCDDMACount); - if (data == NULL) { - break; - } - - SekIdle(NeoCDDMACount * 4); - - while (NeoCDDMACount--) { - curr_space.write_byte(NeoCDDMAAddress1 + 0, data[0]); - curr_space.write_byte(NeoCDDMAAddress1 + 2, data[1]); - NeoCDDMAAddress1 += 4; - data += 2; - } - - m_tempcdc->LC8915EndTransfer(); - - break; - } - - case 0xFE3D: - - // - DMA controller 0x7E -> 0xFE3D (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0x82BF (PC: 0xC0A194) - // - DMA controller program[04] -> 0x93BF (PC: 0xC0A196) - // - DMA controller program[06] -> 0xF629 (PC: 0xC0A198) - // - DMA controller program[08] -> 0x02FD (PC: 0xC0A19A) - // - DMA controller program[10] -> 0xFFFF (PC: 0xC0A19C) - // - DMA controller program[12] -> 0xF17D (PC: 0xC0A19E) - // - DMA controller program[14] -> 0xFCF5 (PC: 0xC0A1A0) - - case 0xFE6D: { -// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- 0x%08X - 0x%08X\n"), NeoCDDMAAddress2, NeoCDDMAAddress2 + NeoCDDMACount * 2, NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2); - - // - DMA controller 0x7E -> 0xFE6D (PC: 0xC0FD7A) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0FD7C) - // - DMA controller program[02] -> 0x82BF (PC: 0xC0FD7E) - // - DMA controller program[04] -> 0xF693 (PC: 0xC0FD80) - // - DMA controller program[06] -> 0xBF29 (PC: 0xC0FD82) - // - DMA controller program[08] -> 0x02FD (PC: 0xC0FD84) - // - DMA controller program[10] -> 0xFFFF (PC: 0xC0FD86) - // - DMA controller program[12] -> 0xC515 (PC: 0xC0FD88) - // - DMA controller program[14] -> 0xFCF5 (PC: 0xC0FD8A) - - SekIdle(NeoCDDMACount * 1); - - while (NeoCDDMACount--) { - curr_space.write_word(NeoCDDMAAddress2, curr_space.read_word(NeoCDDMAAddress1)); - NeoCDDMAAddress1 += 2; - NeoCDDMAAddress2 += 2; - } - -if (NeoCDDMAAddress2 == 0x0800) { -// MapVectorTable(false); -// bprintf(PRINT_ERROR, _T(" RAM vectors mapped (PC = 0x%08X\n"), SekGetPC(0)); -// extern INT32 bRunPause; -// bRunPause = 1; -} - break; - } - - case 0xFEF5: { -// bprintf(PRINT_NORMAL, _T(" adr : 0x%08X - 0x%08X <- address\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 4); - - // - DMA controller 0x7E -> 0xFEF5 (PC: 0xC07CE2) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) - // - DMA controller program[02] -> 0x92E8 (PC: 0xC07CEE) - // - DMA controller program[04] -> 0xBE96 (PC: 0xC07CF4) - // - DMA controller program[06] -> 0xF629 (PC: 0xC07CFA) - // - DMA controller program[08] -> 0x02FD (PC: 0xC07D00) - // - DMA controller program[10] -> 0xFFFF (PC: 0xC07D06) - // - DMA controller program[12] -> 0xFC3D (PC: 0xC07D0C) - // - DMA controller program[14] -> 0xFCF5 (PC: 0xC07D12) - - SekIdle(NeoCDDMACount * 2); - - while (NeoCDDMACount--) { - curr_space.write_word(NeoCDDMAAddress1 + 0, NeoCDDMAAddress1 >> 16); - curr_space.write_word(NeoCDDMAAddress1 + 2, NeoCDDMAAddress1 >> 0); - NeoCDDMAAddress1 += 4; - } - - break; - } - - case 0xFFC5: { -// bprintf(PRINT_NORMAL, _T(" copy: 0x%08X - 0x%08X <- LC8951 external buffer\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2); - - // - DMA controller 0x7E -> 0xFFC5 (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0xA6F6 (PC: 0xC0A194) - // - DMA controller program[04] -> 0x2602 (PC: 0xC0A196) - // - DMA controller program[06] -> 0xFDFF (PC: 0xC0A198) - // - DMA controller program[08] -> 0xFC2D (PC: 0xC0A19A) - // - DMA controller program[10] -> 0xFCF5 (PC: 0xC0A19C) - // - DMA controller program[12] -> 0x8492 (PC: 0xC0A19E) - // - DMA controller program[14] -> 0xDA92 (PC: 0xC0A1A0) - - char* data = m_tempcdc->LC8915InitTransfer(NeoCDDMACount); - if (data == NULL) { - break; - } - - SekIdle(NeoCDDMACount * 4); - - while (NeoCDDMACount--) { - curr_space.write_byte(NeoCDDMAAddress1 + 0, data[0]); - curr_space.write_byte(NeoCDDMAAddress1 + 1, data[1]); - NeoCDDMAAddress1 += 2; - data += 2; - } - - m_tempcdc->LC8915EndTransfer(); - - break; - } - - case 0xFFCD: - - // - DMA controller 0x7E -> 0xFFCD (PC: 0xC0A190) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC0A192) - // - DMA controller program[02] -> 0x92F6 (PC: 0xC0A194) - // - DMA controller program[04] -> 0x2602 (PC: 0xC0A196) - // - DMA controller program[06] -> 0xFDFF (PC: 0xC0A198) - // - DMA controller program[08] -> 0x7006 (PC: 0xC0A19A) - // - DMA controller program[10] -> 0x6100 (PC: 0xC0A19C) - // - DMA controller program[12] -> 0x2412 (PC: 0xC0A19E) - // - DMA controller program[14] -> 0x13FC (PC: 0xC0A1A0) - - case 0xFFDD: { -// bprintf(PRINT_NORMAL, _T(" Fill: 0x%08X - 0x%08X <- 0x%04X\n"), NeoCDDMAAddress1, NeoCDDMAAddress1 + NeoCDDMACount * 2, NeoCDDMAValue1); - - // - DMA controller 0x7E -> 0xFFDD (PC: 0xC07CE2) - // - DMA controller program[00] -> 0xFCF5 (PC: 0xC07CE8) - // - DMA controller program[02] -> 0x92F6 (PC: 0xC07CEE) - // - DMA controller program[04] -> 0x2602 (PC: 0xC07CF4) - // - DMA controller program[06] -> 0xFDFF (PC: 0xC07CFA) - // - DMA controller program[08] -> 0xFFFF (PC: 0xC07D00) - // - DMA controller program[10] -> 0xFCF5 (PC: 0xC07D06) - // - DMA controller program[12] -> 0x8AF0 (PC: 0xC07D0C) - // - DMA controller program[14] -> 0x1609 (PC: 0xC07D12) - - SekIdle(NeoCDDMACount * 1); - - while (NeoCDDMACount--) { - curr_space.write_word(NeoCDDMAAddress1, NeoCDDMAValue1); - NeoCDDMAAddress1 += 2; - } - - break; - } - default: { - //bprintf(PRINT_ERROR, _T(" Unknown transfer type 0x%04X (PC: 0x%06X)\n"), NeoCDDMAMode, SekGetPC(-1)); - //bprintf(PRINT_NORMAL, _T(" ??? : 0x%08X 0x%08X 0x%04X 0x%04X 0x%08X\n"), NeoCDDMAAddress1, NeoCDDMAAddress2, NeoCDDMAValue1, NeoCDDMAValue2, NeoCDDMACount); - -//extern INT32 bRunPause; -//bRunPause = 1; - - } - } -} - - -/* - * Handling selectable controller types - */ - -READ16_MEMBER(ng_aes_state::aes_in0_r) -{ - UINT32 ret = 0xffff; - UINT32 ctrl = m_io_ctrlsel->read(); - - switch(ctrl & 0x0f) - { - case 0x00: - ret = 0xffff; - break; - case 0x01: - ret = m_io_in0->read(); - break; - case 0x02: - switch (m_controller_select) - { - case 0x09: ret = m_io_mj01_p1->read(); break; - case 0x12: ret = m_io_mj02_p1->read(); break; - case 0x1b: ret = m_io_mj03_p1->read(); break; /* player 1 normal inputs? */ - case 0x24: ret = m_io_mj04_p1->read(); break; - default: - ret = m_io_in0->read(); - break; - } - break; - } - - return ret; -} - -READ16_MEMBER(ng_aes_state::aes_in1_r) -{ - UINT32 ret = 0xffff; - UINT32 ctrl = m_io_ctrlsel->read(); - - switch(ctrl & 0xf0) - { - case 0x00: - ret = 0xffff; - break; - case 0x10: - ret = m_io_in1->read(); - break; - case 0x20: - switch (m_controller_select) - { - case 0x09: ret = m_io_mj01_p2->read(); break; - case 0x12: ret = m_io_mj02_p2->read(); break; - case 0x1b: ret = m_io_mj03_p2->read(); break; /* player 2 normal inputs? */ - case 0x24: ret = m_io_mj04_p2->read(); break; - default: - ret = m_io_in1->read(); - break; - } - break; - } - - return ret; -} - - -READ16_MEMBER(ng_aes_state::aes_in2_r) -{ - UINT32 in2 = m_io_in2->read(); - UINT32 ret = in2; - UINT32 sel = m_io_ctrlsel->read(); - - if((sel & 0x02) && (m_controller_select == 0x24)) - ret ^= 0x0200; - - if((sel & 0x20) && (m_controller_select == 0x24)) - ret ^= 0x0800; - - return ret; -} - - -/************************************* - * - * Machine initialization - * - *************************************/ - - -void ng_aes_state::common_machine_start() -{ - /* set the initial main CPU bank */ - neogeo_main_cpu_banking_init(); - - /* set the initial audio CPU ROM banks */ - neogeo_audio_cpu_banking_init(1); - - create_interrupt_timers(); - - /* irq levels for MVS / AES */ - m_vblank_level = 1; - m_raster_level = 2; - - /* start with an IRQ3 - but NOT on a reset */ - m_irq3_pending = 1; - - /* register state save */ - save_item(NAME(m_display_position_interrupt_control)); - save_item(NAME(m_display_counter)); - save_item(NAME(m_vblank_interrupt_pending)); - save_item(NAME(m_display_position_interrupt_pending)); - save_item(NAME(m_irq3_pending)); - save_item(NAME(m_audio_cpu_nmi_enabled)); - save_item(NAME(m_audio_cpu_nmi_pending)); - save_item(NAME(m_controller_select)); - save_item(NAME(m_use_cart_vectors)); - save_item(NAME(m_use_cart_audio)); - //save_item(NAME(m_main_cpu_bank_address)); - - machine().save().register_postload(save_prepost_delegate(FUNC(ng_aes_state::neogeo_postload), this)); - - - m_cartslots[0] = m_cartslot1; - m_cartslots[1] = m_cartslot2; - m_cartslots[2] = m_cartslot3; - m_cartslots[3] = m_cartslot4; - m_cartslots[4] = m_cartslot5; - m_cartslots[5] = m_cartslot6; - - m_sprgen->set_screen(m_screen); - - m_sprgen->set_sprite_region(m_region_sprites->base(), m_region_sprites->bytes()); - m_sprgen->set_fixed_regions(m_region_fixed->base(), m_region_fixed->bytes(), m_region_fixedbios); - -} - -MACHINE_START_MEMBER(ng_aes_state,neogeo) -{ - m_type = NEOGEO_AES; - common_machine_start(); -} - -MACHINE_START_MEMBER(ng_aes_state,neocd) -{ - m_type = NEOGEO_CD; - common_machine_start(); - - /* irq levels for NEOCD (swapped compared to MVS / AES) */ - m_vblank_level = 2; - m_raster_level = 1; - - /* initialize the memcard data structure */ - /* NeoCD doesn't have memcard slots, rather, it has a larger internal memory which works the same */ - m_meminternal_data = auto_alloc_array_clear(machine(), UINT8, 0x2000); - machine().device("saveram")->set_base(m_meminternal_data, 0x2000); - save_pointer(NAME(m_meminternal_data), 0x2000); - - //m_bank_vectors->set_entry(0); // default to the BIOS vectors - m_use_cart_vectors = 0; - - m_tempcdc->reset_cd(); -} - - -/************************************* - * - * Machine reset - * - *************************************/ - -MACHINE_RESET_MEMBER(ng_aes_state,neogeo) -{ - offs_t offs; - address_space &space = m_maincpu->space(AS_PROGRAM); - - /* reset system control registers */ - for (offs = 0; offs < 8; offs++) - system_control_w(space, offs, 0); - - // disable audiocpu nmi - m_audio_cpu_nmi_enabled = false; - m_audio_cpu_nmi_pending = false; - audio_cpu_check_nmi(); - - m_maincpu->reset(); - - start_interrupt_timers(); - - /* trigger the IRQ3 that was set by MACHINE_START */ - update_interrupts(); - - m_recurse = false; - - /* AES has no SFIX ROM and always uses the cartridge's */ - m_sprgen->neogeo_set_fixed_layer_source(1); - - if (m_cartslots[0]) // if thie system has cart slots then do some extra initialization - { - set_slot_number(0); - } - - NeoSpriteRAM = memregion("sprites")->base(); - YM2610ADPCMAROM = memregion("ymsnd")->base(); - NeoZ80ROMActive = memregion("audiocpu")->base(); - NeoTextRAM = memregion("fixed")->base(); -} - -MACHINE_RESET_MEMBER(ng_aes_state,neocd) -{ - MACHINE_RESET_CALL_MEMBER( neogeo ); - - m_tempcdc->NeoCDCommsReset(); - - m_audiocpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - - nTransferWriteEnable = 0; -} - - -/************************************* - * - * Main CPU memory handlers - * - *************************************/ - -static ADDRESS_MAP_START( aes_main_map, AS_PROGRAM, 16, ng_aes_state ) -// AM_RANGE(0x000000, 0x00007f) AM_ROMBANK("vectors") - AM_RANGE(0x000000, 0x00007f) AM_READ(neogeo_slot_rom_low_bectors_r) - AM_RANGE(0x000080, 0x0fffff) AM_ROM - AM_RANGE(0x100000, 0x10ffff) AM_MIRROR(0x0f0000) AM_RAM - /* some games have protection devices in the 0x200000 region, it appears to map to cart space, not surprising, the ROM is read here too */ - //AM_RANGE(0x200000, 0x2fffff) AM_ROMBANK("cartridge") - //AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w) - AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_READ(aes_in0_r) - AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("AUDIO") AM_WRITE8(audio_command_w, 0xff00) - AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ(aes_in1_r) - AM_RANGE(0x360000, 0x37ffff) AM_READ(neogeo_unmapped_r) - AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r) - AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff) - AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(neogeo_unmapped_r) AM_WRITE8(system_control_w, 0x00ff) - AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(neogeo_video_register_r) - AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE(neogeo_video_register_w) - AM_RANGE(0x3e0000, 0x3fffff) AM_READ(neogeo_unmapped_r) - AM_RANGE(0x400000, 0x401fff) AM_MIRROR(0x3fe000) AM_READWRITE(neogeo_paletteram_r, neogeo_paletteram_w) - AM_RANGE(0x800000, 0x800fff) AM_READWRITE(memcard_r, memcard_w) - AM_RANGE(0xc00000, 0xc1ffff) AM_MIRROR(0x0e0000) AM_ROM AM_REGION("mainbios", 0) - AM_RANGE(0xd00000, 0xffffff) AM_READ(neogeo_unmapped_r) -ADDRESS_MAP_END - - - - -static ADDRESS_MAP_START( neocd_main_map, AS_PROGRAM, 16, ng_aes_state ) -// AM_RANGE(0x000000, 0x00007f) AM_READ_BANK("vectors") // writes will fall through to area below - AM_RANGE(0x000000, 0x00007f) AM_READ(banked_vectors_r) - AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_REGION("maincpu", 0x00000) - - AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_READ(aes_in0_r) - AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("AUDIO") AM_WRITE8(audio_command_w, 0xff00) - AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_READ(aes_in1_r) - AM_RANGE(0x360000, 0x37ffff) AM_READ(neogeo_unmapped_r) - AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r) - AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff) - AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(neogeo_unmapped_r) AM_WRITE8(system_control_w, 0x00ff) - AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(neogeo_video_register_r) - AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE(neogeo_video_register_w) - AM_RANGE(0x3e0000, 0x3fffff) AM_READ(neogeo_unmapped_r) - AM_RANGE(0x400000, 0x401fff) AM_MIRROR(0x3fe000) AM_READWRITE(neogeo_paletteram_r, neogeo_paletteram_w) - AM_RANGE(0x800000, 0x803fff) AM_READWRITE(neocd_memcard_r, neocd_memcard_w) - AM_RANGE(0xc00000, 0xc7ffff) AM_MIRROR(0x080000) AM_ROM AM_REGION("mainbios", 0) - AM_RANGE(0xd00000, 0xdfffff) AM_READ(neogeo_unmapped_r) - AM_RANGE(0xe00000, 0xefffff) AM_READWRITE8(neocd_transfer_r,neocd_transfer_w, 0xffff) - AM_RANGE(0xf00000, 0xfeffff) AM_READ(neogeo_unmapped_r) - AM_RANGE(0xff0000, 0xff01ff) AM_READWRITE(neocd_control_r, neocd_control_w) // CDROM / DMA - AM_RANGE(0xff0200, 0xffffff) AM_READ(neogeo_unmapped_r) -ADDRESS_MAP_END - - - - - -/************************************* - * - * Audio CPU port handlers - * - *************************************/ - - -static ADDRESS_MAP_START( neocd_audio_map, AS_PROGRAM, 8, ng_aes_state ) - AM_RANGE(0x0000, 0xffff) AM_RAM AM_REGION("audiocpu", 0x00000) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( neocd_audio_io_map, AS_IO, 8, ng_aes_state ) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(audio_command_r, soundlatch_clear_byte_w) - AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) - AM_RANGE(0x08, 0x08) AM_MIRROR(0xff10) AM_MASK(0x0010) AM_WRITE(audio_cpu_enable_nmi_w) - // banking reads are actually NOP on NeoCD? but some games still access them -// AM_RANGE(0x08, 0x0b) AM_MIRROR(0xfff0) AM_MASK(0xff03) AM_READ(audio_cpu_bank_select_r) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_WRITE(soundlatch2_byte_w) - - // ?? - AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_WRITENOP - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0xff00) AM_WRITENOP - AM_RANGE(0xc1, 0xc1) AM_MIRROR(0xff00) AM_WRITENOP -ADDRESS_MAP_END - - -/************************************* - * - * Input port definitions - * - *************************************/ - - -static INPUT_PORTS_START( controller ) - PORT_START("IN0") - PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) - - - PORT_START("IN1") - PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) -INPUT_PORTS_END - -static INPUT_PORTS_START( mjpanel ) - PORT_START("MJ01_P1") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("MJ02_P1") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - - PORT_START("MJ03_P1") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - - PORT_START("MJ04_P1") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("MJ01_P2") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("MJ02_P2") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("MJ03_P2") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - - PORT_START("MJ04_P2") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) -INPUT_PORTS_END - -static INPUT_PORTS_START( aes ) - PORT_START("CTRLSEL") /* Select Controller Type */ - PORT_CONFNAME( 0x0f, 0x01, "P1 Controller") - PORT_CONFSETTING( 0x00, "Unconnected" ) - PORT_CONFSETTING( 0x01, "NeoGeo Controller" ) - PORT_CONFSETTING( 0x02, "NeoGeo Mahjong Panel" ) - PORT_CONFNAME( 0xf0, 0x10, "P2 Controller") - PORT_CONFSETTING( 0x00, "Unconnected" ) - PORT_CONFSETTING( 0x10, "NeoGeo Controller" ) - PORT_CONFSETTING( 0x20, "NeoGeo Mahjong Panel" ) - - PORT_INCLUDE( controller ) - - PORT_INCLUDE( mjpanel ) - - PORT_START("IN2") - PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SELECT ) PORT_PLAYER(1) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SELECT ) PORT_PLAYER(2) - PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state, get_memcard_status, NULL) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* Hardware type (AES=0, MVS=1) Some games check this and show a piracy warning screen if the hardware and BIOS don't match */ - - PORT_START("AUDIO") - PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_UNUSED ) /* AES has no coin slots, it's a console */ - PORT_BIT( 0x0018, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* what is this? Universe BIOS uses these bits to detect MVS or AES hardware */ - PORT_BIT( 0x00e0, IP_ACTIVE_HIGH, IPT_UNUSED ) /* AES has no upd4990a */ - PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state, get_audio_result, NULL) - - PORT_START("JP") // JP1 and JP2 are jumpers or solderpads depending on AES board revision, intended for use on the Development BIOS - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Short JP1 (Debug Monitor)") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, ng_aes_state, aes_jp1, 0) -// PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) // what is JP2 for? somehow related to system reset, disable watchdog? -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(ng_aes_state::aes_jp1) -{ - // Shorting JP1 causes a 68000 /BERR (Bus Error). On Dev Bios, this pops up the debug monitor. - if (newval) - m_maincpu->set_input_line(M68K_LINE_BUSERROR, HOLD_LINE); -} - - -static INPUT_PORTS_START( neocd ) - PORT_INCLUDE( aes ) - - PORT_MODIFY("IN2") - PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_UNUSED ) // the NeoCD memcard is internal -INPUT_PORTS_END - - -/************************************* - * - * Machine driver - * - *************************************/ - - -static MACHINE_CONFIG_DERIVED_CLASS( aes, neogeo_base, ng_aes_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(aes_main_map) - - MCFG_NEOGEO_MEMCARD_ADD("memcard") - - MCFG_MACHINE_START_OVERRIDE(ng_aes_state, neogeo) - MCFG_MACHINE_RESET_OVERRIDE(ng_aes_state, neogeo) - - MCFG_NEOGEO_CARTRIDGE_ADD("cartslot1", neogeo_cart, NULL) - - MCFG_SOFTWARE_LIST_ADD("cart_list","neogeo") - MCFG_SOFTWARE_LIST_FILTER("cart_list","AES") -MACHINE_CONFIG_END - - -/* NeoCD uses custom vectors on IRQ4 to handle various events from the CDC */ - -IRQ_CALLBACK_MEMBER(ng_aes_state::neocd_int_callback) -{ - if (irqline==4) - { - if (get_nNeoCDIRQVectorAck()) { - set_nNeoCDIRQVectorAck(0); - return get_nNeoCDIRQVector(); - } - } - - return (0x60+irqline*4)/4; -} - -void ng_aes_state::interrupt_callback_type1(void) -{ - nIRQAcknowledge &= ~0x20; - NeoCDIRQUpdate(0); -} - -void ng_aes_state::interrupt_callback_type2(void) -{ - nIRQAcknowledge &= ~0x10; - NeoCDIRQUpdate(0); -} - -void ng_aes_state::interrupt_callback_type3(void) -{ - nIRQAcknowledge &= ~0x08; - NeoCDIRQUpdate(0); -} - - -void ng_aes_state::NeoCDIRQUpdate(UINT8 byteValue) -{ - // do we also need to check the regular interrupts like FBA? - - nIRQAcknowledge |= (byteValue & 0x38); - - if (!prohibit_cdc_irq) - { - if ((nIRQAcknowledge & 0x08) == 0) { - nNeoCDIRQVector = 0x17; - nNeoCDIRQVectorAck = 1; - m_maincpu->set_input_line(4, HOLD_LINE); - return; - } - if ((nIRQAcknowledge & 0x10) == 0) { - nNeoCDIRQVector = 0x16; - nNeoCDIRQVectorAck = 1; - m_maincpu->set_input_line(4, HOLD_LINE); - return; - } - if ((nIRQAcknowledge & 0x20) == 0) { - nNeoCDIRQVector = 0x15; - nNeoCDIRQVectorAck = 1; - m_maincpu->set_input_line(4, HOLD_LINE); - return; - } - } -} - - -UINT32 ng_aes_state::screen_update_neocd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - // fill with background color first - bitmap.fill(*m_bg_pen, cliprect); - - if (m_has_sprite_bus) m_sprgen->draw_sprites(bitmap, cliprect.min_y); - - if (m_has_text_bus) m_sprgen->draw_fixed_layer(bitmap, cliprect.min_y); - - return 0; -} - - -static MACHINE_CONFIG_DERIVED_CLASS( neocd, neogeo_base, ng_aes_state ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(neocd_main_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(ng_aes_state,neocd_int_callback) - - MCFG_CPU_MODIFY("audiocpu") - MCFG_CPU_PROGRAM_MAP(neocd_audio_map) - MCFG_CPU_IO_MAP(neocd_audio_io_map) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(ng_aes_state, screen_update_neocd) - - // temporary until things are cleaned up - MCFG_DEVICE_ADD("tempcdc", LC89510_TEMP, 0) // cd controller - MCFG_SEGACD_HACK_SET_NEOCD - MCFG_SET_TYPE1_INTERRUPT_CALLBACK( ng_aes_state, interrupt_callback_type1 ) - MCFG_SET_TYPE2_INTERRUPT_CALLBACK( ng_aes_state, interrupt_callback_type2 ) - MCFG_SET_TYPE3_INTERRUPT_CALLBACK( ng_aes_state, interrupt_callback_type3 ) - - MCFG_NVRAM_ADD_0FILL("saveram") - - MCFG_MACHINE_START_OVERRIDE(ng_aes_state,neocd) - MCFG_MACHINE_RESET_OVERRIDE(ng_aes_state,neocd) - - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("neocd_cdrom") - MCFG_SOFTWARE_LIST_ADD("cd_list","neocd") -MACHINE_CONFIG_END - -/************************************* - * - * Driver initalization - * - *************************************/ - -#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \ - ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios+1)) /* Note '+1' */ - -ROM_START( aes ) - ROM_REGION16_BE( 0x20000, "mainbios", 0 ) - ROM_SYSTEM_BIOS( 0, "asia", "Asia AES" ) - ROM_LOAD16_WORD_SWAP_BIOS( 0, "neo-epo.bin", 0x00000, 0x020000, CRC(d27a71f1) SHA1(1b3b22092f30c4d1b2c15f04d1670eb1e9fbea07) ) /* AES Console (Asia?) Bios */ - ROM_SYSTEM_BIOS( 1, "japan", "Japan AES" ) - ROM_LOAD16_WORD_SWAP_BIOS( 1, "neo-po.bin", 0x00000, 0x020000, CRC(16d0c132) SHA1(4e4a440cae46f3889d20234aebd7f8d5f522e22c) ) /* AES Console (Japan) Bios */ - ROM_SYSTEM_BIOS( 2, "devel", "Development System ROM" ) - ROM_LOAD16_WORD_SWAP_BIOS( 2, "neodebug.rom", 0x00000, 0x020000, CRC(698ebb7d) SHA1(081c49aa8cc7dad5939833dc1b18338321ea0a07) ) /* Official debug (development) ROM, for home-use base board */ - ROM_SYSTEM_BIOS( 3, "unibios31", "Universe Bios (Hack, Ver. 3.1)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 3, "uni-bios_3_1.rom", 0x00000, 0x020000, CRC(0c58093f) SHA1(29329a3448c2505e1ff45ffa75e61e9693165153) ) /* Universe Bios v3.1 (hack) */ - ROM_SYSTEM_BIOS( 4, "unibios30", "Universe Bios (Hack, Ver. 3.0)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 4, "uni-bios_3_0.rom", 0x00000, 0x020000, CRC(a97c89a9) SHA1(97a5eff3b119062f10e31ad6f04fe4b90d366e7f) ) /* Universe Bios v3.0 (hack) */ - ROM_SYSTEM_BIOS( 5, "unibios23", "Universe Bios (Hack, Ver. 2.3)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 5, "uni-bios_2_3.rom", 0x00000, 0x020000, CRC(27664eb5) SHA1(5b02900a3ccf3df168bdcfc98458136fd2b92ac0) ) /* Universe Bios v2.3 (hack) */ - ROM_SYSTEM_BIOS( 6, "unibios23o", "Universe Bios (Hack, Ver. 2.3, older?)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 6, "uni-bios_2_3o.rom", 0x00000, 0x020000, CRC(601720ae) SHA1(1b8a72c720cdb5ee3f1d735bbcf447b09204b8d9) ) /* Universe Bios v2.3 (hack) alt version, withdrawn? */ - ROM_SYSTEM_BIOS( 7, "unibios22", "Universe Bios (Hack, Ver. 2.2)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 7, "uni-bios_2_2.rom", 0x00000, 0x020000, CRC(2d50996a) SHA1(5241a4fb0c63b1a23fd1da8efa9c9a9bd3b4279c) ) /* Universe Bios v2.2 (hack) */ - ROM_SYSTEM_BIOS( 8, "unibios21", "Universe Bios (Hack, Ver. 2.1)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 8, "uni-bios_2_1.rom", 0x00000, 0x020000, CRC(8dabf76b) SHA1(c23732c4491d966cf0373c65c83c7a4e88f0082c) ) /* Universe Bios v2.1 (hack) */ - ROM_SYSTEM_BIOS( 9, "unibios20", "Universe Bios (Hack, Ver. 2.0)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 9, "uni-bios_2_0.rom", 0x00000, 0x020000, CRC(0c12c2ad) SHA1(37bcd4d30f3892078b46841d895a6eff16dc921e) ) /* Universe Bios v2.0 (hack) */ - ROM_SYSTEM_BIOS(10, "unibios13", "Universe Bios (Hack, Ver. 1.3)" ) - ROM_LOAD16_WORD_SWAP_BIOS(10, "uni-bios_1_3.rom", 0x00000, 0x020000, CRC(b24b44a0) SHA1(eca8851d30557b97c309a0d9f4a9d20e5b14af4e) ) /* Universe Bios v1.3 (hack) - note: versions older than 1.3 don't support AES hardware */ - - ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x20000, "zoomy", 0 ) - ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) ) - - ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF ) - - ROM_REGION( 0x1000000, "ymsnd", ROMREGION_ERASEFF ) - - ROM_REGION( 0x1000000, "ymsnd.deltat", ROMREGION_ERASEFF ) - - ROM_REGION( 0x900000, "sprites", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( neocd ) - ROM_REGION16_BE( 0x80000, "mainbios", 0 ) - ROM_SYSTEM_BIOS( 0, "top", "Top loading NeoGeo CD" ) - ROMX_LOAD( "top-sp1.bin", 0x00000, 0x80000, CRC(c36a47c0) SHA1(235f4d1d74364415910f73c10ae5482d90b4274f), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "front", "Front loading NeoGeo CD" ) - ROMX_LOAD( "front-sp1.bin", 0x00000, 0x80000, CRC(cac62307) SHA1(53bc1f283cdf00fa2efbb79f2e36d4c8038d743a), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(2)) - - ROM_REGION( 0x100000, "ymsnd", ROMREGION_ERASEFF ) - /* 1MB of Sound RAM */ - - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) - /* 64KB of Z80 RAM */ - - ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASE00 ) - /* 2MB of 68K RAM */ - - ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF ) - /* 4MB of Sprite Tile RAM */ - - ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF ) - /* 128KB of Text Tile RAM */ - - ROM_REGION( 0x20000, "zoomy", 0 ) - ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) ) -ROM_END - -ROM_START( neocdz ) - ROM_REGION16_BE( 0x80000, "mainbios", 0 ) - ROM_LOAD16_WORD_SWAP( "neocd.bin", 0x00000, 0x80000, CRC(df9de490) SHA1(7bb26d1e5d1e930515219cb18bcde5b7b23e2eda) ) - - ROM_REGION( 0x100000, "ymsnd", ROMREGION_ERASEFF ) - /* 1MB of Sound RAM */ - - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) - /* 64KB of Z80 RAM */ - - ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASE00 ) - /* 2MB of 68K RAM */ - - ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF ) - /* 4MB of Sprite Tile RAM */ - - ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF ) - /* 128KB of Text Tile RAM */ - - ROM_REGION( 0x20000, "zoomy", 0 ) - ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) ) -ROM_END - -#define rom_neocdzj rom_neocdz - -DRIVER_INIT_MEMBER(ng_aes_state,neogeo) -{ - if (!m_cartslots[0]) m_banked_cart->install_banks(machine(), m_maincpu, m_region_maincpu->base(), m_region_maincpu->bytes()); -} - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1990, aes, 0, 0, aes, aes, ng_aes_state, neogeo, "SNK", "Neo-Geo AES", MACHINE_SUPPORTS_SAVE ) - -DRIVER_INIT_MEMBER(ng_aes_state,neocdz) -{ - NeoSystem = NEOCD_REGION_US; -} - -DRIVER_INIT_MEMBER(ng_aes_state,neocdzj) -{ - NeoSystem = NEOCD_REGION_JAPAN; -} - - -CONS( 1996, neocdz, 0, 0, neocd, neocd, ng_aes_state, neocdz, "SNK", "Neo-Geo CDZ (US)", 0 ) // the CDZ is the newer model -CONS( 1996, neocdzj, neocdz, 0, neocd, neocd, ng_aes_state, neocdzj, "SNK", "Neo-Geo CDZ (Japan)", 0 ) - - -CONS( 1994, neocd, neocdz, 0, neocd, neocd, ng_aes_state, neogeo, "SNK", "Neo-Geo CD", MACHINE_NOT_WORKING ) // older model, ignores disc protections? diff --git a/src/mess/drivers/ngen.c b/src/mess/drivers/ngen.c deleted file mode 100644 index 29f492e5f30..00000000000 --- a/src/mess/drivers/ngen.c +++ /dev/null @@ -1,1179 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/* - - Convergent NGen series - - 10-11-14 - Skeleton driver - - Interrupts based on patents: - level 1 - SIO - level 3 - timer (from PIT, presumably channel 0? Patent says "channel 3") - level 4 - "interrupt detector" - keyboard, printer, RTC - level 7 - floppy/hard disk - - DMA channels: - channel 0 - communications (RS-232) - channel 1 - X-Bus expansion modules (except disk and graphics) - channel 2 - graphics? - channel 3 - hard disk - On the CP-001/B26 channels 4 on are handled by the 80186. - channel 4 - floppy disk - - To get to "menu mode", press Space quickly after reset (might need good timing) - The bootstrap ROM version number is displayed, along with "B,D,L,M,P,T:" - You can press one of these keys for the following tests: - B: Bootstrap - Loads the system image file (from disk or master workstation) - D: Dump - RAM contents are dumped to a local disk drive or master workstation - L: Load - Loads the system image file, then enters the Panel Debugger. Exiting the Panel - Debugger will continue execution of the system image - M: Memory Test - Continuously performs the Memory Test until the system is reset. - P: Panel Debugger - Enters the Panel Debugger - T: Type of Operating System - Gives an "OS:" prompt, at which you can enter the number of the system image to - load at the master workstation. - - Panel Debugger: - - Open/Modify RAM - Enter an address (seg:off) followed by a forward-slash, the contents of this word will - appear, you can enter a value to set it to, or just press Next (default: Enter) to leave - it as is. It will then go on to the next word. Pressing Return (scan code unknown - currently) will return to the debugger prompt. - - Open/Modify Register - Enter the register only, and the contents will appear, you can leave it or alter it (you - must enter all digits (eg: 0A03 if you're modifying DX) then press Return. - - I/O to or from a port - Input: Address (segment is ignored, and not required) followed by I, a byte is read from - the port defined by the offset, and the byte is displayed. - Output: Address followed by O, you are now prompted with an '='. Enter the byte to send - to the port, and press Return. - - Set Haltpoint: - Enter an address (seg:off) followed by H. Sets a haltpoint at the specified address. Does - not work for ROM addresses. Only one allowed at a time. Haltpoint info is stored at - 0000:01F0. Uses a software interrupt (INT 7C), rather than INT 3. - - To start or continue from the current address, enter P. - To start from a specific address, enter the address (seg:off) followed by a G. -*/ - -#include "emu.h" -#include "cpu/i86/i186.h" -#include "cpu/i386/i386.h" -#include "video/mc6845.h" -#include "machine/i8251.h" -#include "machine/am9517a.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/z80dart.h" -#include "machine/wd_fdc.h" -#include "machine/wd2010.h" -#include "bus/rs232/rs232.h" -#include "machine/ngen_kb.h" -#include "machine/clock.h" -#include "imagedev/harddriv.h" - -class ngen_state : public driver_device -{ -public: - ngen_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_i386cpu(*this,"i386cpu"), - m_crtc(*this,"crtc"), - m_viduart(*this,"videouart"), - m_iouart(*this,"iouart"), - m_dmac(*this,"dmac"), - m_pic(*this,"pic"), - m_pit(*this,"pit"), - m_disk_rom(*this,"disk"), - m_fdc(*this,"fdc"), - m_fd0(*this,"fdc:0"), - m_fdc_timer(*this,"fdc_timer"), - m_hdc(*this,"hdc"), - m_hdc_timer(*this,"hdc_timer"), - m_hd_buffer(*this,"hd_buffer_ram") - {} - - DECLARE_WRITE_LINE_MEMBER(pit_out0_w); - DECLARE_WRITE_LINE_MEMBER(pit_out1_w); - DECLARE_WRITE_LINE_MEMBER(pit_out2_w); - DECLARE_WRITE_LINE_MEMBER(cpu_timer_w); - DECLARE_WRITE_LINE_MEMBER(timer_clk_out); - DECLARE_WRITE16_MEMBER(cpu_peripheral_cb); - DECLARE_WRITE16_MEMBER(peripheral_w); - DECLARE_READ16_MEMBER(peripheral_r); - DECLARE_WRITE16_MEMBER(xbus_w); - DECLARE_READ16_MEMBER(xbus_r); - DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); - DECLARE_WRITE_LINE_MEMBER(dma_eop_changed); - DECLARE_WRITE_LINE_MEMBER(dack0_w); - DECLARE_WRITE_LINE_MEMBER(dack1_w); - DECLARE_WRITE_LINE_MEMBER(dack2_w); - DECLARE_WRITE_LINE_MEMBER(dack3_w); - DECLARE_READ8_MEMBER(dma_read_word); - DECLARE_WRITE8_MEMBER(dma_write_word); - MC6845_UPDATE_ROW(crtc_update_row); - // TODO: sort out what devices use which channels - DECLARE_READ8_MEMBER( dma_0_dack_r ) { UINT16 ret = 0xffff; m_dma_high_byte = ret & 0xff00; return ret; } - DECLARE_READ8_MEMBER( dma_1_dack_r ) { UINT16 ret = 0xffff; m_dma_high_byte = ret & 0xff00; return ret; } - DECLARE_READ8_MEMBER( dma_2_dack_r ) { UINT16 ret = 0xffff; m_dma_high_byte = ret & 0xff00; return ret; } - DECLARE_READ8_MEMBER( dma_3_dack_r ); - DECLARE_WRITE8_MEMBER( dma_0_dack_w ){ popmessage("IOW0: data %02x",data); } - DECLARE_WRITE8_MEMBER( dma_1_dack_w ){ } - DECLARE_WRITE8_MEMBER( dma_2_dack_w ){ } - DECLARE_WRITE8_MEMBER( dma_3_dack_w ){ popmessage("IOW3: data %02x",data); } - - DECLARE_WRITE16_MEMBER(hfd_w); - DECLARE_READ16_MEMBER(hfd_r); - DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - DECLARE_WRITE8_MEMBER(fdc_control_w); - DECLARE_READ8_MEMBER(irq_cb); - DECLARE_WRITE8_MEMBER(hdc_control_w); - DECLARE_WRITE8_MEMBER(disk_addr_ext); - DECLARE_READ8_MEMBER(hd_buffer_r); - DECLARE_WRITE8_MEMBER(hd_buffer_w); - - DECLARE_READ16_MEMBER(b38_keyboard_r); - DECLARE_WRITE16_MEMBER(b38_keyboard_w); - DECLARE_READ16_MEMBER(b38_crtc_r); - DECLARE_WRITE16_MEMBER(b38_crtc_w); -protected: - virtual void machine_reset(); - virtual void machine_start(); - -private: - optional_device m_maincpu; - optional_device m_i386cpu; - required_device m_crtc; - required_device m_viduart; - required_device m_iouart; - required_device m_dmac; - required_device m_pic; - required_device m_pit; - optional_memory_region m_disk_rom; - memory_array m_vram; - memory_array m_fontram; - optional_device m_fdc; - optional_device m_fd0; - optional_device m_fdc_timer; - optional_device m_hdc; - optional_device m_hdc_timer; - optional_shared_ptr m_hd_buffer; - - void set_dma_channel(int channel, int state); - - UINT8 m_xbus_current; // currently selected X-Bus module - UINT16 m_peripheral; - UINT16 m_upper; - UINT16 m_middle; - UINT16 m_port00; - UINT16 m_periph141; - UINT8 m_dma_offset[4]; - INT8 m_dma_channel; - UINT16 m_dma_high_byte; - UINT16 m_control; - UINT16 m_disk_rom_ptr; - UINT8 m_hdc_control; - UINT8 m_disk_page; -}; - -class ngen386_state : public ngen_state -{ -public: - ngen386_state(const machine_config &mconfig, device_type type, const char *tag) - : ngen_state(mconfig, type, tag) - {} -private: -}; - -WRITE_LINE_MEMBER(ngen_state::pit_out0_w) -{ - m_pic->ir3_w(state); // Timer interrupt - popmessage("PIT Timer 0 state %i\n",state); -} - -WRITE_LINE_MEMBER(ngen_state::pit_out1_w) -{ - popmessage("PIT Timer 1 state %i\n",state); - m_iouart->rxcb_w(state); - m_iouart->txcb_w(state); // channels in the correct order? -} - -WRITE_LINE_MEMBER(ngen_state::pit_out2_w) -{ - m_iouart->rxca_w(state); - m_iouart->txca_w(state); - popmessage("PIT Timer 2 state %i\n",state); -} - -WRITE_LINE_MEMBER(ngen_state::cpu_timer_w) -{ - if(state != 0) - popmessage("80186 Timer 0 state %i\n",state); - m_pic->ir5_w(state); -} - -WRITE_LINE_MEMBER(ngen_state::timer_clk_out) -{ - m_viduart->write_rxc(state); // Keyboard UART Rx/Tx clocks - m_viduart->write_txc(state); - // 80186 timer pins also? EXT bit is enabled for BTOS PIT test. - if(m_maincpu) - { - m_maincpu->tmrin0_w(state); - //m_maincpu->tmrin1_w(state); - } -} - -WRITE16_MEMBER(ngen_state::cpu_peripheral_cb) -{ - UINT32 addr; - - switch(offset) - { - case 0: // upper memory - m_upper = data; - break; - case 2: // peripheral - m_peripheral = data; - addr = (m_peripheral & 0xffc0) << 4; - if(m_middle & 0x0040) - { - m_maincpu->device_t::memory().space(AS_PROGRAM).install_readwrite_handler(addr, addr + 0x3ff, read16_delegate(FUNC(ngen_state::peripheral_r), this), write16_delegate(FUNC(ngen_state::peripheral_w), this)); - logerror("Mapped peripherals to memory 0x%08x\n",addr); - } - else - { - addr &= 0xffff; - m_maincpu->device_t::memory().space(AS_IO).install_readwrite_handler(addr, addr + 0x3ff, read16_delegate(FUNC(ngen_state::peripheral_r), this), write16_delegate(FUNC(ngen_state::peripheral_w), this)); - logerror("Mapped peripherals to I/O 0x%04x\n",addr); - } - break; - case 4: - m_middle = data; - break; - } -} - -// 80186 peripheral space -// Largely guesswork at this stage -WRITE16_MEMBER(ngen_state::peripheral_w) -{ - switch(offset) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - case 0x04: - case 0x05: - case 0x06: - case 0x07: - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - if(mem_mask & 0x00ff) - m_dmac->write(space,offset,data & 0xff); - break; - case 0x80: // DMA page offset? - case 0x81: - case 0x82: - case 0x83: - if(mem_mask & 0x00ff) - m_dma_offset[offset-0x80] = data & 0xff; - break; - case 0xc0: // X-Bus modules reset - m_xbus_current = 0; - break; - case 0x10c: - if(mem_mask & 0x00ff) - m_pic->write(space,0,data & 0xff); - break; - case 0x10d: - if(mem_mask & 0x00ff) - m_pic->write(space,1,data & 0xff); - break; - case 0x110: - case 0x111: - case 0x112: - case 0x113: - if(mem_mask & 0x00ff) - m_pit->write(space,offset-0x110,data & 0xff); - break; - case 0x141: - // bit 1 enables speaker? - COMBINE_DATA(&m_periph141); - break; - case 0x144: - if(mem_mask & 0x00ff) - m_crtc->address_w(space,0,data & 0xff); - break; - case 0x145: - if(mem_mask & 0x00ff) - m_crtc->register_w(space,0,data & 0xff); - break; - case 0x146: - if(mem_mask & 0x00ff) - m_viduart->data_w(space,0,data & 0xff); - break; - case 0x147: - if(mem_mask & 0x00ff) - m_viduart->control_w(space,0,data & 0xff); - break; - case 0x1a0: // serial? - logerror("Serial(?) 0x1a0 write offset %04x data %04x mask %04x\n",offset,data,mem_mask); - break; - default: - logerror("Unknown 80186 peripheral write offset %04x data %04x mask %04x\n",offset,data,mem_mask); - } -} - -READ16_MEMBER(ngen_state::peripheral_r) -{ - UINT16 ret = 0xffff; - switch(offset) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - case 0x04: - case 0x05: - case 0x06: - case 0x07: - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - if(mem_mask & 0x00ff) - ret = m_dmac->read(space,offset); - logerror("DMA read offset %04x mask %04x returning %04x\n",offset,mem_mask,ret); - break; - case 0x80: // DMA page offset? - case 0x81: - case 0x82: - case 0x83: - if(mem_mask & 0x00ff) - ret = m_dma_offset[offset-0x80] & 0xff; - break; - case 0x10c: - if(mem_mask & 0x00ff) - ret = m_pic->read(space,0); - break; - case 0x10d: - if(mem_mask & 0x00ff) - ret = m_pic->read(space,1); - break; - case 0x110: - case 0x111: - case 0x112: - case 0x113: - if(mem_mask & 0x00ff) - ret = m_pit->read(space,offset-0x110); - break; - case 0x141: - ret = m_periph141; - break; - case 0x144: - if(mem_mask & 0x00ff) - ret = m_crtc->status_r(space,0); - break; - case 0x145: - if(mem_mask & 0x00ff) - ret = m_crtc->register_r(space,0); - break; - case 0x146: - if(mem_mask & 0x00ff) - ret = m_viduart->data_r(space,0); - break; - case 0x147: // keyboard UART - // expects bit 0 to be set (UART transmit ready) - if(mem_mask & 0x00ff) - ret = m_viduart->status_r(space,0); - break; - case 0x1a0: // I/O control register? - ret = m_control; // end of DMA transfer? (maybe a per-channel EOP?) Bit 6 is set during a transfer? - break; -// default: -// logerror("Unknown 80186 peripheral read offset %04x mask %04x returning %04x\n",offset,mem_mask,ret); - } - return ret; -} - -// X-bus module select -// The bootstrap ROM creates a table at 0:FC9h, with a count, followed by the module IDs of each -// expansion module. The base I/O address for the currently selected module is set by writing to -// this register (bits 0-7 are ignored) -// TODO: make expansion modules slot devices -WRITE16_MEMBER(ngen_state::xbus_w) -{ - UINT16 addr = (data & 0x00ff) << 8; - cpu_device* cpu; - - if(m_maincpu) - cpu = m_maincpu; - else - cpu = m_i386cpu; - address_space& io = cpu->device_t::memory().space(AS_IO); - switch(m_xbus_current) - { - case 0x00: // Floppy/Hard disk module - io.install_readwrite_handler(addr,addr+0xff,read16_delegate(FUNC(ngen_state::hfd_r),this),write16_delegate(FUNC(ngen_state::hfd_w),this),0xffffffff); - break; - default: - cpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); // reached end of the modules - break; - } - if(addr != 0) - logerror("SYS: X-Bus module %i address set %04x\n",m_xbus_current+1,addr); - m_xbus_current++; -} - -// returns X-bus module ID and info in the low byte (can indicate if the device is bootable, has a boot ROM (needs to be written to RAM via DMA), or if it supports a non-80186 CPU) -// bit 6, I think, indicates a bootable device -// Known module IDs: -// 0x1070 - Floppy/Hard disk module -// 0x3141 - QIC Tape module -READ16_MEMBER(ngen_state::xbus_r) -{ - UINT16 ret = 0xffff; - - switch(m_xbus_current) - { - case 0x00: - ret = 0x1070; // Floppy/Hard disk module - break; - default: - if(m_maincpu) - m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); // reached the end of the modules - else - m_i386cpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); - ret = 0x0080; - break; - } - return ret; -} - - -// Floppy/Hard disk module -WRITE16_MEMBER(ngen_state::hfd_w) -{ - switch(offset) - { - case 0x00: - case 0x01: - case 0x02: - if(mem_mask & 0x00ff) - m_fdc->write(space,offset,data & 0xff); - break; - case 0x03: - if(mem_mask & 0x00ff) - { - m_fdc->write(space,offset,data & 0xff); - m_fdc_timer->write_clk0(1); - m_fdc_timer->write_clk0(0); // Data register access clocks the FDC's PIT channel 0 - } - break; - case 0x04: - if(mem_mask & 0x00ff) - fdc_control_w(space,0,data & 0xff); - break; - case 0x05: - if(mem_mask & 0x00ff) - hdc_control_w(space,0,data & 0xff); - break; - case 0x07: - if(mem_mask & 0x00ff) - disk_addr_ext(space,0,data & 0xff); - break; - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - if(mem_mask & 0x00ff) - m_fdc_timer->write(space,offset-0x08,data & 0xff); - break; - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - if(mem_mask & 0x00ff) - m_hdc->write(space,offset-0x10,data & 0xff); - logerror("WD1010 register %i write %02x mask %04x\n",offset-0x10,data & 0xff,mem_mask); - break; - case 0x18: - case 0x19: - case 0x1a: - case 0x1b: - if(mem_mask & 0x00ff) - m_hdc_timer->write(space,offset-0x18,data & 0xff); - break; - } -} - -READ16_MEMBER(ngen_state::hfd_r) -{ - UINT16 ret = 0xffff; - - switch(offset) - { - case 0x00: - case 0x01: - case 0x02: - if(mem_mask & 0x00ff) - ret = m_fdc->read(space,offset); - break; - case 0x03: - if(mem_mask & 0x00ff) - { - ret = m_fdc->read(space,offset); - m_fdc_timer->write_clk0(1); - m_fdc_timer->write_clk0(0); // Data register access clocks the FDC's PIT channel 0 - } - break; - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - if(mem_mask & 0x00ff) - ret = m_fdc_timer->read(space,offset-0x08); - break; - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - if(mem_mask & 0x00ff) - ret = m_hdc->read(space,offset-0x10); - logerror("WD1010 register %i read, mask %04x\n",offset-0x10,mem_mask); - break; - case 0x18: - case 0x19: - case 0x1a: - case 0x1b: - if(mem_mask & 0x00ff) - ret = m_hdc_timer->read(space,offset-0x18); - break; - } - - return ret; -} - -WRITE_LINE_MEMBER(ngen_state::fdc_irq_w) -{ - m_pic->ir7_w(state); -} - -WRITE_LINE_MEMBER(ngen_state::fdc_drq_w) -{ - m_dmac->dreq3_w(state); -} - -// Floppy disk control register -// Bit 0 - enable drive and LED -// Bit 2 - floppy motor -// Bit 5 - side select -// Bit 6 - 1 = 2Mhz for seek, 0 = 1MHz for read/write -// Bit 7 - FDC reset -WRITE8_MEMBER(ngen_state::fdc_control_w) -{ - m_fdc->set_floppy(m_fd0->get_device()); - m_fd0->get_device()->mon_w(~data & 0x04); - m_fd0->get_device()->ss_w(data & 0x20); - if(~data & 0x80) - m_fdc->soft_reset(); -} - -// Hard disk control register -// bit 0 - Drive select 0 - selects module hard disk -// bit 1 - Drive select 1 - selects expansion module hard disk (if available) -// bit 2 - enable DMA transfer of module ROM contents to X-Bus master memory -// bits 3-5 - select head / expansion module head -// bit 6 - write enable, must be set to write to a hard disk -// bit 7 - HDC reset -WRITE8_MEMBER(ngen_state::hdc_control_w) -{ - m_hdc_control = data; - if(m_hdc_control & 0x04) - { - m_disk_rom_ptr = 0; - popmessage("HDD: DMA ROM transfer start\n"); - m_dmac->dreq3_w(1); - //m_dmac->dreq3_w(0); - } -} - -// page of system RAM to access -// bit 7 = disables read/write signals to the WD1010 -WRITE8_MEMBER(ngen_state::disk_addr_ext) -{ - m_disk_page = data & 0x7f; -} - -READ8_MEMBER(ngen_state::hd_buffer_r) -{ - return m_hd_buffer[offset]; -} - -WRITE8_MEMBER(ngen_state::hd_buffer_w) -{ - m_hd_buffer[offset] = data; -} - -WRITE_LINE_MEMBER( ngen_state::dma_hrq_changed ) -{ - if(m_maincpu) - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - else - m_i386cpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER( ngen_state::dma_eop_changed ) -{ - if(m_dma_channel == 0) - { - if(state) - m_control |= 0x02; - else - m_control &= ~0x02; - } - if(m_dma_channel == 3) - { - if(state) - { - if(m_hdc_control & 0x04) // ROM transfer - m_hdc_control &= ~0x04; // switch it off when done - } - } -} - -void ngen_state::set_dma_channel(int channel, int state) -{ - if(!state) - m_dma_channel = channel; - else if(m_dma_channel == channel) - m_dma_channel = -1; -} - -WRITE_LINE_MEMBER( ngen_state::dack0_w ) { set_dma_channel(0, state); } -WRITE_LINE_MEMBER( ngen_state::dack1_w ) { set_dma_channel(1, state); } -WRITE_LINE_MEMBER( ngen_state::dack2_w ) { set_dma_channel(2, state); } -WRITE_LINE_MEMBER( ngen_state::dack3_w ) { set_dma_channel(3, state); } - -READ8_MEMBER(ngen_state::dma_3_dack_r) -{ - UINT16 ret = 0xffff; - - if((m_hdc_control & 0x04) && m_disk_rom) - { - ret = m_disk_rom->base()[m_disk_rom_ptr++] << 8; - printf("DMA3 DACK: returning %02x\n",ret); - if(m_disk_rom_ptr < 0x1000) - { - m_dmac->dreq3_w(1); - //m_dmac->dreq3_w(0); - } - } - m_dma_high_byte = ret & 0xff00; - return ret; -} - -READ8_MEMBER(ngen_state::dma_read_word) -{ - cpu_device* cpu; - UINT16 result; - - if(m_maincpu) - cpu = m_maincpu; - else - cpu = m_i386cpu; - address_space& prog_space = cpu->space(AS_PROGRAM); // get the right address space - - if(m_dma_channel == -1) - return 0xff; - offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0xFE0000; - - result = prog_space.read_word(page_offset + (offset << 1)); - m_dma_high_byte = result & 0xFF00; - popmessage("DMA byte address %06x read %04x\n",page_offset+(offset<<1),result); - return result & 0xff; -} - - -WRITE8_MEMBER(ngen_state::dma_write_word) -{ - cpu_device* cpu; - - if(m_maincpu) - cpu = m_maincpu; - else - cpu = m_i386cpu; - address_space& prog_space = cpu->space(AS_PROGRAM); // get the right address space - - if(m_dma_channel == -1) - return; - offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0xFE0000; - - prog_space.write_word(page_offset + (offset << 1), data); - popmessage("DMA byte address %06x write %04x\n",page_offset+(offset<<1), m_dma_high_byte | data); -} - - -MC6845_UPDATE_ROW( ngen_state::crtc_update_row ) -{ - UINT16 addr = ma; - - for(int x=0;xacknowledge(); -} - -READ16_MEMBER( ngen_state::b38_keyboard_r ) -{ - UINT8 ret = 0; - switch(offset) - { - case 0: - if(mem_mask & 0x00ff) - ret = m_viduart->data_r(space,0); - break; - case 1: // keyboard UART - // expects bit 0 to be set (UART transmit ready) - if(mem_mask & 0x00ff) - ret = m_viduart->status_r(space,0); - break; - } - return ret; -} - -WRITE16_MEMBER( ngen_state::b38_keyboard_w ) -{ - switch(offset) - { - case 0: - if(mem_mask & 0x00ff) - m_viduart->data_w(space,0,data & 0xff); - break; - case 1: - if(mem_mask & 0x00ff) - m_viduart->control_w(space,0,data & 0xff); - break; - } -} - -READ16_MEMBER( ngen_state::b38_crtc_r ) -{ - UINT8 ret = 0; - switch(offset) - { - case 0: - if(mem_mask & 0x00ff) - ret = m_crtc->register_r(space,0); - break; - case 1: - if(mem_mask & 0x00ff) - ret = m_viduart->data_r(space,0); - break; - } - return ret; -} - -WRITE16_MEMBER( ngen_state::b38_crtc_w ) -{ - switch(offset) - { - case 0: - if(mem_mask & 0x00ff) - m_crtc->address_w(space,0,data & 0xff); - break; - case 1: - if(mem_mask & 0x00ff) - m_crtc->register_w(space,0,data & 0xff); - break; - } -} - -void ngen_state::machine_start() -{ - memory_share* vidshare = memshare("vram"); - memory_share* fontshare = memshare("fontram"); - m_hd_buffer.allocate(1024*8); // 8kB buffer RAM for HD controller - if(vidshare == NULL || fontshare == NULL) - fatalerror("Error: VRAM not found"); - m_vram.set(*vidshare,2); - m_fontram.set(*fontshare,2); -} - -void ngen_state::machine_reset() -{ - m_port00 = 0; - m_control = 0; - m_xbus_current = 0; - m_viduart->write_dsr(0); - m_viduart->write_cts(0); - m_fd0->get_device()->set_rpm(300); -} - -// boot ROMs from modules are not mapped anywhere, instead, they have to send the code from the boot ROM via DMA -static ADDRESS_MAP_START( ngen_mem, AS_PROGRAM, 16, ngen_state ) - AM_RANGE(0x00000, 0xf7fff) AM_RAM - AM_RANGE(0xf8000, 0xf9fff) AM_RAM AM_SHARE("vram") - AM_RANGE(0xfa000, 0xfbfff) AM_RAM AM_SHARE("fontram") - AM_RANGE(0xfc000, 0xfcfff) AM_RAM - AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("bios",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ngen_io, AS_IO, 16, ngen_state ) - AM_RANGE(0x0000, 0x0001) AM_READWRITE(xbus_r,xbus_w) - - // Floppy/Hard disk module -// AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff) // a guess for now -// AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff) -// AM_RANGE(0x010a, 0x010b) AM_WRITE8(hdc_control_w,0x00ff) -// AM_RANGE(0x010e, 0x010f) AM_WRITE8(disk_addr_ext,0x00ff) // X-Bus extended address register -// AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff) - // 0x0120-0x012f - WD1010 Winchester disk controller (unemulated) -// AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff) - -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ngen386_mem, AS_PROGRAM, 32, ngen_state ) - AM_RANGE(0x00000000, 0x000f7fff) AM_RAM - AM_RANGE(0x000f8000, 0x000f9fff) AM_RAM AM_SHARE("vram") - AM_RANGE(0x000fa000, 0x000fbfff) AM_RAM AM_SHARE("fontram") - AM_RANGE(0x000fc000, 0x000fcfff) AM_RAM - AM_RANGE(0x000fe000, 0x000fffff) AM_ROM AM_REGION("bios",0) - AM_RANGE(0x00100000, 0x00ffffff) AM_RAM // some extra RAM - AM_RANGE(0xffffe000, 0xffffffff) AM_ROM AM_REGION("bios",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ngen386i_mem, AS_PROGRAM, 32, ngen_state ) - AM_RANGE(0x00000000, 0x000f7fff) AM_RAM - AM_RANGE(0x000f8000, 0x000f9fff) AM_RAM AM_SHARE("vram") - AM_RANGE(0x000fa000, 0x000fbfff) AM_RAM AM_SHARE("fontram") - AM_RANGE(0x000fc000, 0x000fffff) AM_ROM AM_REGION("bios",0) - AM_RANGE(0x00100000, 0x00ffffff) AM_RAM // some extra RAM - AM_RANGE(0xffffc000, 0xffffffff) AM_ROM AM_REGION("bios",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ngen386_io, AS_IO, 32, ngen_state ) - AM_RANGE(0x0000, 0x0003) AM_READWRITE16(xbus_r, xbus_w, 0x0000ffff) -// AM_RANGE(0xf800, 0xfeff) AM_READWRITE16(peripheral_r, peripheral_w,0xffffffff) - AM_RANGE(0xfd08, 0xfd0b) AM_READWRITE16(b38_crtc_r, b38_crtc_w,0xffffffff) - AM_RANGE(0xfd0c, 0xfd0f) AM_READWRITE16(b38_keyboard_r, b38_keyboard_w,0xffffffff) -ADDRESS_MAP_END - -static INPUT_PORTS_START( ngen ) -INPUT_PORTS_END - -static SLOT_INTERFACE_START(keyboard) - SLOT_INTERFACE("ngen", NGEN_KEYBOARD) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START( ngen_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( ngen, ngen_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", I80186, XTAL_16MHz / 2) - MCFG_CPU_PROGRAM_MAP(ngen_mem) - MCFG_CPU_IO_MAP(ngen_io) - MCFG_80186_CHIP_SELECT_CB(WRITE16(ngen_state, cpu_peripheral_cb)) - MCFG_80186_TMROUT0_HANDLER(WRITELINE(ngen_state, cpu_timer_w)) - MCFG_80186_IRQ_SLAVE_ACK(READ8(ngen_state, irq_cb)) - - MCFG_PIC8259_ADD( "pic", DEVWRITELINE("maincpu",i80186_cpu_device,int0_w), VCC, NULL ) - - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(78120/4) // 19.53kHz, /4 of the CPU timer output? - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(ngen_state, pit_out0_w)) // RS232 channel B baud rate - MCFG_PIT8253_CLK1(XTAL_14_7456MHz/12) // correct? - based on patent - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(ngen_state, pit_out1_w)) // RS232 channel A baud rate - MCFG_PIT8253_CLK2(XTAL_14_7456MHz/12) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(ngen_state, pit_out2_w)) - - MCFG_DEVICE_ADD("dmac", AM9517A, XTAL_14_7456MHz / 3) // NEC D8237A, divisor unknown - MCFG_I8237_OUT_HREQ_CB(WRITELINE(ngen_state, dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(ngen_state, dma_eop_changed)) - MCFG_I8237_IN_MEMR_CB(READ8(ngen_state, dma_read_word)) // DMA is always 16-bit - MCFG_I8237_OUT_MEMW_CB(WRITE8(ngen_state, dma_write_word)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(ngen_state, dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(ngen_state, dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(ngen_state, dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(ngen_state, dack3_w)) - MCFG_I8237_IN_IOR_0_CB(READ8(ngen_state, dma_0_dack_r)) - MCFG_I8237_IN_IOR_1_CB(READ8(ngen_state, dma_1_dack_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(ngen_state, dma_2_dack_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(ngen_state, dma_3_dack_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(ngen_state, dma_0_dack_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(ngen_state, dma_1_dack_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(ngen_state, dma_2_dack_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(ngen_state, dma_3_dack_w)) - - // I/O board - MCFG_UPD7201_ADD("iouart",0,0,0,0,0) // clocked by PIT channel 2? - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232_a", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("iouart", upd7201_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("iouart", upd7201_device, ctsa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("iouart", upd7201_device, dcda_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("iouart", upd7201_device, ria_w)) - - MCFG_RS232_PORT_ADD("rs232_b", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("iouart", upd7201_device, rxb_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("iouart", upd7201_device, ctsb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("iouart", upd7201_device, dcdb_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("iouart", upd7201_device, rib_w)) - - // TODO: SCN2652 MPCC (not implemented), used for RS-422 cluster communications? - - // video board - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(720,348) - MCFG_SCREEN_VISIBLE_AREA(0,719,0,347) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DEVICE("crtc",mc6845_device, screen_update) - - MCFG_MC6845_ADD("crtc", MC6845, NULL, 19980000 / 9) // divisor unknown -- /9 gives 60Hz output, so likely correct - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(9) - MCFG_MC6845_UPDATE_ROW_CB(ngen_state, crtc_update_row) - MCFG_VIDEO_SET_SCREEN("screen") - - // keyboard UART (patent says i8251 is used for keyboard communications, it is located on the video board) - MCFG_DEVICE_ADD("videouart", I8251, 0) // main clock unknown, Rx/Tx clocks are 19.53kHz -// MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w)) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) - MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd)) - - MCFG_DEVICE_ADD("refresh_clock", CLOCK, 19200*16) // should be 19530Hz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ngen_state,timer_clk_out)) - - // floppy disk / hard disk module (WD2797 FDC, WD1010 HDC, plus an 8253 timer for each) - MCFG_WD2797_ADD("fdc", XTAL_20MHz / 20) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ngen_state,fdc_irq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu",i80186_cpu_device,drq1_w)) - MCFG_WD_FDC_FORCE_READY - MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) // clocked on FDC data register access - MCFG_PIT8253_CLK1(XTAL_20MHz / 20) -// MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) // 1MHz - MCFG_PIT8253_CLK2(XTAL_20MHz / 20) -// MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) - - // TODO: WD1010 HDC (not implemented), use WD2010 for now - MCFG_DEVICE_ADD("hdc", WD2010, XTAL_20MHz / 4) - MCFG_WD2010_OUT_INTRQ_CB(DEVWRITELINE("pic",pic8259_device,ir2_w)) - MCFG_WD2010_IN_BCS_CB(READ8(ngen_state,hd_buffer_r)) - MCFG_WD2010_OUT_BCS_CB(WRITE8(ngen_state,hd_buffer_w)) - MCFG_WD2010_IN_DRDY_CB(VCC) - MCFG_WD2010_IN_INDEX_CB(VCC) - MCFG_WD2010_IN_WF_CB(VCC) - MCFG_WD2010_IN_TK000_CB(VCC) - MCFG_WD2010_IN_SC_CB(VCC) - MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0) - MCFG_PIT8253_CLK2(XTAL_20MHz / 10) // 2MHz - MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_HARDDISK_ADD("hard0") - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ngen386, ngen386_state ) - MCFG_CPU_ADD("i386cpu", I386, XTAL_50MHz / 2) - MCFG_CPU_PROGRAM_MAP(ngen386_mem) - MCFG_CPU_IO_MAP(ngen386_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic", pic8259_device, inta_cb) - - MCFG_PIC8259_ADD( "pic", INPUTLINE("i386cpu",0), VCC, NULL ) - - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(78120/4) // 19.53kHz, /4 of the CPU timer output? - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(ngen_state, pit_out0_w)) // RS232 channel B baud rate - MCFG_PIT8253_CLK1(XTAL_14_7456MHz/12) // correct? - based on patent - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(ngen_state, pit_out1_w)) // RS232 channel A baud rate - MCFG_PIT8253_CLK2(XTAL_14_7456MHz/12) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(ngen_state, pit_out2_w)) - - MCFG_DEVICE_ADD("dmac", AM9517A, XTAL_14_7456MHz / 3) // NEC D8237A, divisor unknown - MCFG_I8237_OUT_HREQ_CB(WRITELINE(ngen_state, dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(ngen_state, dma_eop_changed)) - MCFG_I8237_IN_MEMR_CB(READ8(ngen_state, dma_read_word)) // DMA is always 16-bit - MCFG_I8237_OUT_MEMW_CB(WRITE8(ngen_state, dma_write_word)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(ngen_state, dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(ngen_state, dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(ngen_state, dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(ngen_state, dack3_w)) - MCFG_I8237_IN_IOR_0_CB(READ8(ngen_state, dma_0_dack_r)) - MCFG_I8237_IN_IOR_1_CB(READ8(ngen_state, dma_1_dack_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(ngen_state, dma_2_dack_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(ngen_state, dma_3_dack_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(ngen_state, dma_0_dack_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(ngen_state, dma_1_dack_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(ngen_state, dma_2_dack_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(ngen_state, dma_3_dack_w)) - - // I/O board - MCFG_UPD7201_ADD("iouart",0,0,0,0,0) // clocked by PIT channel 2? - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232_a", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("iouart", upd7201_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("iouart", upd7201_device, ctsa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("iouart", upd7201_device, dcda_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("iouart", upd7201_device, ria_w)) - - MCFG_RS232_PORT_ADD("rs232_b", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("iouart", upd7201_device, rxb_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("iouart", upd7201_device, ctsb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("iouart", upd7201_device, dcdb_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("iouart", upd7201_device, rib_w)) - - // TODO: SCN2652 MPCC (not implemented), used for RS-422 cluster communications? - - // video board - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(720,348) - MCFG_SCREEN_VISIBLE_AREA(0,719,0,347) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DEVICE("crtc",mc6845_device, screen_update) - - MCFG_MC6845_ADD("crtc", MC6845, NULL, 19980000 / 9) // divisor unknown -- /9 gives 60Hz output, so likely correct - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(9) - MCFG_MC6845_UPDATE_ROW_CB(ngen_state, crtc_update_row) - MCFG_VIDEO_SET_SCREEN("screen") - - // keyboard UART (patent says i8251 is used for keyboard communications, it is located on the video board) - MCFG_DEVICE_ADD("videouart", I8251, 0) // main clock unknown, Rx/Tx clocks are 19.53kHz -// MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w)) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) - MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd)) - - MCFG_DEVICE_ADD("refresh_clock", CLOCK, 19200*16) // should be 19530Hz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ngen_state,timer_clk_out)) - - // floppy disk / hard disk module (WD2797 FDC, WD1010 HDC, plus an 8253 timer for each) - MCFG_WD2797_ADD("fdc", XTAL_20MHz / 20) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ngen_state,fdc_irq_w)) -// MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("i386cpu",i80186_cpu_device,drq1_w)) - MCFG_WD_FDC_FORCE_READY - MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) // clocked on FDC data register access - MCFG_PIT8253_CLK1(XTAL_20MHz / 20) -// MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) // 1MHz - MCFG_PIT8253_CLK2(XTAL_20MHz / 20) -// MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir5_w)) - - // TODO: WD1010 HDC (not implemented), use WD2010 for now - MCFG_DEVICE_ADD("hdc", WD2010, XTAL_20MHz / 4) - MCFG_WD2010_OUT_INTRQ_CB(DEVWRITELINE("pic",pic8259_device,ir2_w)) - MCFG_WD2010_IN_BCS_CB(READ8(ngen_state,hd_buffer_r)) - MCFG_WD2010_OUT_BCS_CB(WRITE8(ngen_state,hd_buffer_w)) - MCFG_WD2010_IN_DRDY_CB(VCC) - MCFG_WD2010_IN_INDEX_CB(VCC) - MCFG_WD2010_IN_WF_CB(VCC) - MCFG_WD2010_IN_TK000_CB(VCC) - MCFG_WD2010_IN_SC_CB(VCC) - MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0) - MCFG_PIT8253_CLK2(XTAL_20MHz / 10) // 2MHz - MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_HARDDISK_ADD("hard0") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( 386i, ngen386 ) - MCFG_CPU_MODIFY("i386cpu") - MCFG_CPU_PROGRAM_MAP(ngen386i_mem) -MACHINE_CONFIG_END - -ROM_START( ngen ) - ROM_REGION( 0x2000, "bios", 0) - ROM_LOAD16_BYTE( "72-00414_80186_cpu.bin", 0x000000, 0x001000, CRC(e1387a03) SHA1(ddca4eba67fbf8b731a8009c14f6b40edcbc3279) ) // bootstrap ROM v8.4 - ROM_LOAD16_BYTE( "72-00415_80186_cpu.bin", 0x000001, 0x001000, CRC(a6dde7d9) SHA1(b4d15c1bce31460ab5b92ff43a68c15ac5485816) ) - - ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) - ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x1000, "disk", 0) - ROM_LOAD( "72-00422_10mb_disk.bin", 0x000000, 0x001000, CRC(f5b046b6) SHA1(b303c6f6aa40504016de9826879bc316e44389aa) ) - - ROM_REGION( 0x20, "disk_prom", 0) - ROM_LOAD( "72-00422_10mb_disk_15d.bin", 0x000000, 0x000020, CRC(121ee494) SHA1(9a8d3c336cc7378a71f9d48c99f88515eb236fbf) ) -ROM_END - -// not sure just how similar these systems are to the 80186 model, but are here at the moment to document the dumps -ROM_START( ngenb38 ) - ROM_REGION( 0x2000, "bios", 0) - ROM_LOAD16_BYTE( "72-168_fpc_386_cpu.bin", 0x000000, 0x001000, CRC(250a3b68) SHA1(49c070514bac264fa4892f284f7d2c852ae6605d) ) - ROM_LOAD16_BYTE( "72-167_fpc_386_cpu.bin", 0x000001, 0x001000, CRC(4010cc4e) SHA1(74a3024d605569056484d08b63f19fbf8eaf31c6) ) - - ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) - ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) -ROM_END - -ROM_START( 386i ) - ROM_REGION( 0x4000, "bios", 0) - ROM_LOAD16_BYTE( "72-1561o_386i_cpu.bin", 0x000000, 0x002000, CRC(b5efd768) SHA1(8b250d47d9c6eb82e1afaeb2244d8c4134ecbc47) ) - ROM_LOAD16_BYTE( "72-1562e_386i_cpu.bin", 0x000001, 0x002000, CRC(002d0d3a) SHA1(31de8592999377db9251acbeff348390a2d2602a) ) - - ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) - ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x2000, "video", 0) - ROM_LOAD( "72-1630_gc-104_vga.bin", 0x000000, 0x002000, CRC(4e4d8ebe) SHA1(50c96ccb4d0bd1beb2d1aee0d18b2c462d25fc8f) ) -ROM_END - - -COMP( 1983, ngen, 0, 0, ngen, ngen, driver_device, 0, "Convergent Technologies", "NGEN CP-001", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1991, ngenb38, ngen, 0, ngen386, ngen, driver_device, 0, "Financial Products Corp.", "B28/38", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1990, 386i, ngen, 0, 386i, ngen, driver_device, 0, "Convergent Technologies", "386i", MACHINE_IS_SKELETON | MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/ngp.c b/src/mess/drivers/ngp.c deleted file mode 100644 index 1443d671c19..00000000000 --- a/src/mess/drivers/ngp.c +++ /dev/null @@ -1,895 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/****************************************************************************** - -SNK NeoGeo Pocket driver - -The NeoGeo Pocket (Color) contains one big chip which contains the following -components: -- Toshiba TLCS-900/H cpu core with 64KB ROM -- Z80 cpu core -- K1GE (mono)/K2GE (color) graphics chip + lcd controller -- SN76489A compatible sound chip -- DAC for additional sound -- RTC -- RAM - - -The following TLCS-900/H input sources are known: -- INT0 - Alarm/RTC irq -- INT4 - VBlank irq -- INT5 - Interrupt from Z80 -- AN0 - Analog input which is used to determine the battery level -- NMI - Triggered by power button -- TIO - HBlank signal - - -The following TLCS-900/H output destination are known: -- TO3 - connected to Z80 INT pin - - -The cartridges -============== - -The cartridges used flash chips produced by Toshiba, Sharp or Samsung. These -are the only 3 manufacturers supported by the NeoGeo pocket bios. The device -IDs supported appear to be SNK exclusive. Most likely because of the factory -blocked game data areas on these chip. - -These manufacturer IDs are supported: 0x98, 0xec, 0xb0 -These device IDs are supported: 0xab, 0x2c, 0x2f - -There is support for 3 different sizes of flash roms: 4Mbit, 8Mbit 16Mbit. The -32Mbit games appear to be 2 16Mbit flash chips in 2 different memory regions (?). - -The flash chips have a couple of different sized blocks. When writing to a -cartridge the neogeo pocket bios will erase the proper block and write the data -to the block. - -The relation between block number and flash chip is as follows: - - # | 16Mbit (2f) | 8Mbit (2c) | 4Mbit (ab) ----+---------------+-------------+------------- - 0 | 000000-00ffff | 00000-0ffff | 00000-0ffff - 1 | 010000-01ffff | 10000-1ffff | 10000-1ffff - 2 | 020000-02ffff | 20000-2ffff | 20000-2ffff - 3 | 030000-03ffff | 30000-3ffff | 30000-3ffff - 4 | 040000-01ffff | 40000-4ffff | 40000-4ffff - 5 | 050000-01ffff | 50000-5ffff | 50000-5ffff - 6 | 060000-01ffff | 60000-6ffff | 60000-6ffff - 7 | 070000-01ffff | 70000-7ffff | 70000-77fff - 8 | 080000-01ffff | 80000-8ffff | 78000-79fff - 9 | 090000-01ffff | 90000-9ffff | 7a000-7bfff -10 | 0a0000-01ffff | a0000-affff | 7c000-7ffff -11 | 0b0000-01ffff | b0000-bffff | -12 | 0c0000-01ffff | c0000-cffff | -13 | 0d0000-01ffff | d0000-dffff | -14 | 0e0000-01ffff | e0000-effff | -15 | 0f0000-01ffff | f0000-f7fff | -16 | 100000-10ffff | f8000-f9fff | -17 | 110000-11ffff | fa000-fbfff | -18 | 120000-12ffff | fc000-fffff | -19 | 130000-13ffff | | -20 | 140000-14ffff | | -21 | 150000-15ffff | | -22 | 160000-16ffff | | -23 | 170000-17ffff | | -24 | 180000-18ffff | | -25 | 190000-19ffff | | -26 | 1a0000-1affff | | -27 | 1b0000-1bffff | | -28 | 1c0000-1cffff | | -29 | 1d0000-1dffff | | -30 | 1e0000-1effff | | -31 | 1f0000-1f7fff | | -32 | 1f8000-1f9fff | | -33 | 1fa000-1fbfff | | -34 | 1fc000-1fffff | | - -The last block is always reserved for use by the system. The Neogeo Pocket Color -bios does some tests on this last block to see if the flash functionality is -working. It does this on every boot! - -The Toshiba TC58FVT004 seems to have an interface similar to what is used in -the Neogeo Pocket. - - -******************************************************************************/ - - -#include "emu.h" -#include "cpu/tlcs900/tlcs900.h" -#include "cpu/z80/z80.h" -#include "sound/t6w28.h" -#include "sound/dac.h" -#include "video/k1ge.h" -#include "rendlay.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -enum flash_state -{ - F_READ, /* xxxx F0 or 5555 AA 2AAA 55 5555 F0 */ - F_PROG1, - F_PROG2, - F_COMMAND, - F_ID_READ, /* 5555 AA 2AAA 55 5555 90 */ - F_AUTO_PROGRAM, /* 5555 AA 2AAA 55 5555 A0 address data */ - F_AUTO_CHIP_ERASE, /* 5555 AA 2AAA 55 5555 80 5555 AA 2AAA 55 5555 10 */ - F_AUTO_BLOCK_ERASE, /* 5555 AA 2AAA 55 5555 80 5555 AA 2AAA 55 block_address 30 */ - F_BLOCK_PROTECT /* 5555 AA 2AAA 55 5555 9A 5555 AA 2AAA 55 5555 9A */ -}; - - -class ngp_state : public driver_device, public device_nvram_interface -{ -public: - ngp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - device_nvram_interface(mconfig, *this), - m_tlcs900(*this, "maincpu"), - m_z80(*this, "soundcpu"), - m_t6w28(*this, "t6w28"), - m_dac_l(*this, "dac_l"), - m_dac_r(*this, "dac_r"), - m_cart(*this, "cartslot"), - m_mainram(*this, "mainram"), - m_k1ge(*this, "k1ge"), - m_io_controls(*this, "Controls"), - m_io_power(*this, "Power") , - m_maincpu(*this, "maincpu") - { - m_flash_chip[0].present = 0; - m_flash_chip[0].state = F_READ; - m_flash_chip[0].data = NULL; - - m_flash_chip[1].present = 0; - m_flash_chip[1].state = F_READ; - m_flash_chip[1].data = NULL; - - m_nvram_loaded = false; - } - - virtual void machine_start(); - virtual void machine_reset(); - - UINT8 m_io_reg[0x40]; - UINT8 m_old_to3; - emu_timer* m_seconds_timer; - - struct { - int present; - UINT8 manufacturer_id; - UINT8 device_id; - UINT8 *data; - UINT8 org_data[16]; - int state; - UINT8 command[2]; - } m_flash_chip[2]; - - required_device m_tlcs900; - required_device m_z80; - required_device m_t6w28; - required_device m_dac_l; - required_device m_dac_r; - required_device m_cart; - required_shared_ptr m_mainram; - required_device m_k1ge; - - DECLARE_READ8_MEMBER( ngp_io_r ); - DECLARE_WRITE8_MEMBER( ngp_io_w ); - - void flash_w( int which, offs_t offset, UINT8 data ); - DECLARE_WRITE8_MEMBER( flash0_w ); - DECLARE_WRITE8_MEMBER( flash1_w ); - - DECLARE_READ8_MEMBER( ngp_z80_comm_r ); - DECLARE_WRITE8_MEMBER( ngp_z80_comm_w ); - DECLARE_WRITE8_MEMBER( ngp_z80_signal_main_w ); - - DECLARE_WRITE8_MEMBER( ngp_z80_clear_irq ); - - DECLARE_WRITE_LINE_MEMBER( ngp_vblank_pin_w ); - DECLARE_WRITE_LINE_MEMBER( ngp_hblank_pin_w ); - DECLARE_WRITE8_MEMBER( ngp_tlcs900_porta ); - UINT32 screen_update_ngp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_INPUT_CHANGED_MEMBER(power_callback); - TIMER_CALLBACK_MEMBER(ngp_seconds_callback); - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( ngp_cart); - DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( ngp_cart ); - -protected: - bool m_nvram_loaded; - required_ioport m_io_controls; - required_ioport m_io_power; - - virtual void nvram_default(); - virtual void nvram_read(emu_file &file); - virtual void nvram_write(emu_file &file); - required_device m_maincpu; -}; - - -TIMER_CALLBACK_MEMBER(ngp_state::ngp_seconds_callback) -{ - m_io_reg[0x16] += 1; - if ( ( m_io_reg[0x16] & 0x0f ) == 0x0a ) - { - m_io_reg[0x16] += 0x06; - } - - if ( m_io_reg[0x16] >= 0x60 ) - { - m_io_reg[0x16] = 0; - m_io_reg[0x15] += 1; - if ( ( m_io_reg[0x15] & 0x0f ) == 0x0a ) { - m_io_reg[0x15] += 0x06; - } - - if ( m_io_reg[0x15] >= 0x60 ) - { - m_io_reg[0x15] = 0; - m_io_reg[0x14] += 1; - if ( ( m_io_reg[0x14] & 0x0f ) == 0x0a ) { - m_io_reg[0x14] += 0x06; - } - - if ( m_io_reg[0x14] == 0x24 ) - { - m_io_reg[0x14] = 0; - } - } - } -} - - -READ8_MEMBER( ngp_state::ngp_io_r ) -{ - UINT8 data = m_io_reg[offset]; - - switch( offset ) - { - case 0x30: /* Read controls */ - data = m_io_controls->read(); - break; - case 0x31: - data = m_io_power->read() & 0x01; - /* Sub-batttery OK */ - data |= 0x02; - break; - } - return data; -} - - -WRITE8_MEMBER( ngp_state::ngp_io_w ) -{ - switch( offset ) - { - case 0x20: /* t6w28 "right" */ - case 0x21: /* t6w28 "left" */ - if ( m_io_reg[0x38] == 0x55 && m_io_reg[0x39] == 0xAA ) - { - m_t6w28->write( space, 0, data ); - } - break; - - case 0x22: /* DAC right */ - m_dac_r->write_unsigned8(data ); - break; - case 0x23: /* DAC left */ - m_dac_l->write_unsigned8(data ); - break; - - /* Internal eeprom related? */ - case 0x36: - case 0x37: - break; - case 0x38: /* Sound enable/disable. */ - switch( data ) - { - case 0x55: /* Enabled sound */ - m_t6w28->set_enable( true ); - break; - case 0xAA: /* Disable sound */ - m_t6w28->set_enable( false ); - break; - } - break; - - case 0x39: /* Z80 enable/disable. */ - switch( data ) - { - case 0x55: /* Enable Z80 */ - m_z80->resume(SUSPEND_REASON_HALT ); - m_z80->reset(); - m_z80->set_input_line(0, CLEAR_LINE ); - break; - case 0xAA: /* Disable Z80 */ - m_z80->suspend(SUSPEND_REASON_HALT, 1 ); - break; - } - break; - - case 0x3a: /* Trigger Z80 NMI */ - m_z80->set_input_line(INPUT_LINE_NMI, PULSE_LINE ); - break; - } - m_io_reg[offset] = data; -} - - -void ngp_state::flash_w( int which, offs_t offset, UINT8 data ) -{ - if ( ! m_flash_chip[which].present ) - return; - - switch( m_flash_chip[which].state ) - { - case F_READ: - if ( offset == 0x5555 && data == 0xaa ) - m_flash_chip[which].state = F_PROG1; - m_flash_chip[which].command[0] = 0; - break; - case F_PROG1: - if ( offset == 0x2aaa && data == 0x55 ) - m_flash_chip[which].state = F_PROG2; - else - m_flash_chip[which].state = F_READ; - break; - case F_PROG2: - if ( data == 0x30 ) - { - if ( m_flash_chip[which].command[0] == 0x80 ) - { - int size = 0x10000; - UINT8 *block = m_flash_chip[which].data; - - m_flash_chip[which].state = F_AUTO_BLOCK_ERASE; - switch( m_flash_chip[which].device_id ) - { - case 0xab: - if ( offset < 0x70000 ) - block = m_flash_chip[which].data + ( offset & 0x70000 ); - else - { - if ( offset & 0x8000 ) - { - if ( offset & 0x4000 ) - { - block = m_flash_chip[which].data + ( offset & 0x7c000 ); - size = 0x4000; - } - else - { - block = m_flash_chip[which].data + ( offset & 0x7e000 ); - size = 0x2000; - } - } - else - { - block = m_flash_chip[which].data + ( offset & 0x78000 ); - size = 0x8000; - } - } - break; - case 0x2c: - if ( offset < 0xf0000 ) - block = m_flash_chip[which].data + ( offset & 0xf0000 ); - else - { - if ( offset & 0x8000 ) - { - if ( offset & 0x4000 ) - { - block = m_flash_chip[which].data + ( offset & 0xfc000 ); - size = 0x4000; - } - else - { - block = m_flash_chip[which].data + ( offset & 0xfe000 ); - size = 0x2000; - } - } - else - { - block = m_flash_chip[which].data + ( offset & 0xf8000 ); - size = 0x8000; - } - } - break; - case 0x2f: - if ( offset < 0x1f0000 ) - block = m_flash_chip[which].data + ( offset & 0x1f0000 ); - else - { - if ( offset & 0x8000 ) - { - if ( offset & 0x4000 ) - { - block = m_flash_chip[which].data + ( offset & 0x1fc000 ); - size = 0x4000; - } - else - { - block = m_flash_chip[which].data + ( offset & 0x1fe000 ); - size = 0x2000; - } - } - else - { - block = m_flash_chip[which].data + ( offset & 0x1f8000 ); - size = 0x8000; - } - } - break; - } - memset( block, 0xFF, size ); - } - else - m_flash_chip[which].state = F_READ; - } - else if ( offset == 0x5555 ) - { - switch( data ) - { - case 0x80: - m_flash_chip[which].command[0] = 0x80; - m_flash_chip[which].state = F_COMMAND; - break; - case 0x90: - m_flash_chip[which].data[0x1fc000] = m_flash_chip[which].manufacturer_id; - m_flash_chip[which].data[0xfc000] = m_flash_chip[which].manufacturer_id; - m_flash_chip[which].data[0x7c000] = m_flash_chip[which].manufacturer_id; - m_flash_chip[which].data[0] = m_flash_chip[which].manufacturer_id; - m_flash_chip[which].data[0x1fc001] = m_flash_chip[which].device_id; - m_flash_chip[which].data[0xfc001] = m_flash_chip[which].device_id; - m_flash_chip[which].data[0x7c001] = m_flash_chip[which].device_id; - m_flash_chip[which].data[1] = m_flash_chip[which].device_id; - m_flash_chip[which].data[0x1fc002] = 0x02; - m_flash_chip[which].data[0xfc002] = 0x02; - m_flash_chip[which].data[0x7c002] = 0x02; - m_flash_chip[which].data[2] = 0x02; - m_flash_chip[which].data[0x1fc003] = 0x80; - m_flash_chip[which].data[0xfc003] = 0x80; - m_flash_chip[which].data[0x7c003] = 0x80; - m_flash_chip[which].data[3] = 0x80; - m_flash_chip[which].state = F_ID_READ; - break; - case 0x9a: - if ( m_flash_chip[which].command[0] == 0x9a ) - m_flash_chip[which].state = F_BLOCK_PROTECT; - else - { - m_flash_chip[which].command[0] = 0x9a; - m_flash_chip[which].state = F_COMMAND; - } - break; - case 0xa0: - m_flash_chip[which].state = F_AUTO_PROGRAM; - break; - case 0xf0: - default: - m_flash_chip[which].state = F_READ; - break; - } - } - else - m_flash_chip[which].state = F_READ; - break; - case F_COMMAND: - if ( offset == 0x5555 && data == 0xaa ) - m_flash_chip[which].state = F_PROG1; - else - m_flash_chip[which].state = F_READ; - break; - case F_ID_READ: - if ( offset == 0x5555 && data == 0xaa ) - m_flash_chip[which].state = F_PROG1; - else - m_flash_chip[which].state = F_READ; - m_flash_chip[which].command[0] = 0; - break; - case F_AUTO_PROGRAM: - /* Only 1 -> 0 changes can be programmed */ - m_flash_chip[which].data[offset] = m_flash_chip[which].data[offset] & data; - m_flash_chip[which].state = F_READ; - break; - case F_AUTO_CHIP_ERASE: - m_flash_chip[which].state = F_READ; - break; - case F_AUTO_BLOCK_ERASE: - m_flash_chip[which].state = F_READ; - break; - case F_BLOCK_PROTECT: - m_flash_chip[which].state = F_READ; - break; - } - - if ( m_flash_chip[which].state == F_READ ) - { - /* Exit command/back to normal operation*/ - m_flash_chip[which].data[0] = m_flash_chip[which].org_data[0]; - m_flash_chip[which].data[1] = m_flash_chip[which].org_data[1]; - m_flash_chip[which].data[2] = m_flash_chip[which].org_data[2]; - m_flash_chip[which].data[3] = m_flash_chip[which].org_data[3]; - m_flash_chip[which].data[0x7c000] = m_flash_chip[which].org_data[4]; - m_flash_chip[which].data[0x7c001] = m_flash_chip[which].org_data[5]; - m_flash_chip[which].data[0x7c002] = m_flash_chip[which].org_data[6]; - m_flash_chip[which].data[0x7c003] = m_flash_chip[which].org_data[7]; - m_flash_chip[which].data[0xfc000] = m_flash_chip[which].org_data[8]; - m_flash_chip[which].data[0xfc001] = m_flash_chip[which].org_data[9]; - m_flash_chip[which].data[0xfc002] = m_flash_chip[which].org_data[10]; - m_flash_chip[which].data[0xfc003] = m_flash_chip[which].org_data[11]; - m_flash_chip[which].data[0x1fc000] = m_flash_chip[which].org_data[12]; - m_flash_chip[which].data[0x1fc001] = m_flash_chip[which].org_data[13]; - m_flash_chip[which].data[0x1fc002] = m_flash_chip[which].org_data[14]; - m_flash_chip[which].data[0x1fc003] = m_flash_chip[which].org_data[15]; - m_flash_chip[which].command[0] = 0; - } -} - - -WRITE8_MEMBER( ngp_state::flash0_w ) -{ - flash_w( 0, offset, data ); -} - - -WRITE8_MEMBER( ngp_state::flash1_w ) -{ - flash_w( 1, offset, data ); -} - - -static ADDRESS_MAP_START( ngp_mem, AS_PROGRAM, 8, ngp_state ) - AM_RANGE( 0x000080, 0x0000bf ) AM_READWRITE(ngp_io_r, ngp_io_w) /* ngp/c specific i/o */ - AM_RANGE( 0x004000, 0x006fff ) AM_RAM AM_SHARE("mainram") /* work ram */ - AM_RANGE( 0x007000, 0x007fff ) AM_RAM AM_SHARE("share1") /* shared with sound cpu */ - AM_RANGE( 0x008000, 0x00bfff ) AM_DEVREADWRITE("k1ge", k1ge_device, read, write) /* video chip */ - AM_RANGE( 0x200000, 0x3fffff ) AM_WRITE(flash0_w) /* cart area #1 */ - AM_RANGE( 0x800000, 0x9fffff ) AM_WRITE(flash1_w) /* cart area #2 */ - AM_RANGE( 0xff0000, 0xffffff ) AM_ROM AM_REGION("maincpu", 0) /* system rom */ -ADDRESS_MAP_END - - -READ8_MEMBER( ngp_state::ngp_z80_comm_r ) -{ - return m_io_reg[0x3c]; -} - - -WRITE8_MEMBER( ngp_state::ngp_z80_comm_w ) -{ - m_io_reg[0x3c] = data; -} - - -WRITE8_MEMBER( ngp_state::ngp_z80_signal_main_w ) -{ - m_tlcs900->set_input_line(TLCS900_INT5, ASSERT_LINE ); -} - - -static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, ngp_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_RAM AM_SHARE("share1") /* shared with tlcs900 */ - AM_RANGE( 0x4000, 0x4001 ) AM_DEVWRITE("t6w28", t6w28_device, write ) /* sound chip (right, left) */ - AM_RANGE( 0x8000, 0x8000 ) AM_READWRITE( ngp_z80_comm_r, ngp_z80_comm_w ) /* main-sound communication */ - AM_RANGE( 0xc000, 0xc000 ) AM_WRITE( ngp_z80_signal_main_w ) /* signal irq to main cpu */ -ADDRESS_MAP_END - - -WRITE8_MEMBER( ngp_state::ngp_z80_clear_irq ) -{ - m_z80->set_input_line(0, CLEAR_LINE ); - - /* I am not exactly sure what causes the maincpu INT5 signal to be cleared. This will do for now. */ - m_tlcs900->set_input_line(TLCS900_INT5, CLEAR_LINE ); -} - - -static ADDRESS_MAP_START( z80_io, AS_IO, 8, ngp_state ) - AM_RANGE( 0x0000, 0xffff ) AM_WRITE( ngp_z80_clear_irq ) -ADDRESS_MAP_END - - -INPUT_CHANGED_MEMBER(ngp_state::power_callback) -{ - if ( m_io_reg[0x33] & 0x04 ) - { - m_tlcs900->set_input_line(TLCS900_NMI, (m_io_power->read() & 0x01 ) ? CLEAR_LINE : ASSERT_LINE ); - } -} - - -static INPUT_PORTS_START( ngp ) - PORT_START("Controls") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Button A") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Button B") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SELECT) PORT_NAME("Option") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("Power") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_Q) PORT_NAME("Power") PORT_CHANGED_MEMBER(DEVICE_SELF, ngp_state, power_callback, NULL) -INPUT_PORTS_END - - -WRITE_LINE_MEMBER( ngp_state::ngp_vblank_pin_w ) -{ - m_tlcs900->set_input_line(TLCS900_INT4, state ? ASSERT_LINE : CLEAR_LINE ); -} - - -WRITE_LINE_MEMBER( ngp_state::ngp_hblank_pin_w ) -{ - m_tlcs900->set_input_line(TLCS900_TIO, state ? ASSERT_LINE : CLEAR_LINE ); -} - - -WRITE8_MEMBER( ngp_state::ngp_tlcs900_porta ) -{ - int to3 = BIT(data,3); - if ( to3 && ! m_old_to3 ) - m_z80->set_input_line(0, ASSERT_LINE ); - - m_old_to3 = to3; -} - - -void ngp_state::machine_start() -{ - if (m_cart->exists()) - { - std::string region_tag; - UINT8 *cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(); - - m_maincpu->space(AS_PROGRAM).install_read_bank(0x200000, 0x3fffff, "flash0"); - m_maincpu->space(AS_PROGRAM).install_read_bank(0x800000, 0x9fffff, "flash1"); - membank("flash0")->set_base(cart); - membank("flash1")->set_base(cart + 0x200000); - - m_flash_chip[0].data = cart; - m_flash_chip[0].org_data[0] = m_flash_chip[0].data[0]; - m_flash_chip[0].org_data[1] = m_flash_chip[0].data[1]; - m_flash_chip[0].org_data[2] = m_flash_chip[0].data[2]; - m_flash_chip[0].org_data[3] = m_flash_chip[0].data[3]; - m_flash_chip[0].org_data[4] = m_flash_chip[0].data[0x7c000]; - m_flash_chip[0].org_data[5] = m_flash_chip[0].data[0x7c001]; - m_flash_chip[0].org_data[6] = m_flash_chip[0].data[0x7c002]; - m_flash_chip[0].org_data[7] = m_flash_chip[0].data[0x7c003]; - m_flash_chip[0].org_data[8] = m_flash_chip[0].data[0xfc000]; - m_flash_chip[0].org_data[9] = m_flash_chip[0].data[0xfc001]; - m_flash_chip[0].org_data[10] = m_flash_chip[0].data[0xfc002]; - m_flash_chip[0].org_data[11] = m_flash_chip[0].data[0xfc003]; - m_flash_chip[0].org_data[12] = m_flash_chip[0].data[0x1fc000]; - m_flash_chip[0].org_data[13] = m_flash_chip[0].data[0x1fc001]; - m_flash_chip[0].org_data[14] = m_flash_chip[0].data[0x1fc002]; - m_flash_chip[0].org_data[15] = m_flash_chip[0].data[0x1fc003]; - - m_flash_chip[1].data = cart + 0x200000; - m_flash_chip[1].org_data[0] = m_flash_chip[1].data[0]; - m_flash_chip[1].org_data[1] = m_flash_chip[1].data[1]; - m_flash_chip[1].org_data[2] = m_flash_chip[1].data[2]; - m_flash_chip[1].org_data[3] = m_flash_chip[1].data[3]; - m_flash_chip[1].org_data[4] = m_flash_chip[1].data[0x7c000]; - m_flash_chip[1].org_data[5] = m_flash_chip[1].data[0x7c001]; - m_flash_chip[1].org_data[6] = m_flash_chip[1].data[0x7c002]; - m_flash_chip[1].org_data[7] = m_flash_chip[1].data[0x7c003]; - m_flash_chip[1].org_data[8] = m_flash_chip[1].data[0xfc000]; - m_flash_chip[1].org_data[9] = m_flash_chip[1].data[0xfc001]; - m_flash_chip[1].org_data[10] = m_flash_chip[1].data[0xfc002]; - m_flash_chip[1].org_data[11] = m_flash_chip[1].data[0xfc003]; - m_flash_chip[1].org_data[12] = m_flash_chip[1].data[0x1fc000]; - m_flash_chip[1].org_data[13] = m_flash_chip[1].data[0x1fc001]; - m_flash_chip[1].org_data[14] = m_flash_chip[1].data[0x1fc002]; - m_flash_chip[1].org_data[15] = m_flash_chip[1].data[0x1fc003]; - } - else - { - m_maincpu->space(AS_PROGRAM).unmap_read(0x200000, 0x3fffff); - m_maincpu->space(AS_PROGRAM).unmap_read(0x800000, 0x9fffff); - } - - m_seconds_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ngp_state::ngp_seconds_callback),this)); - m_seconds_timer->adjust( attotime::from_seconds(1), 0, attotime::from_seconds(1) ); - - save_item(NAME(m_io_reg)); - save_item(NAME(m_old_to3)); - // TODO: check if these are handled correctly... - save_item(NAME(m_flash_chip[0].present)); - save_item(NAME(m_flash_chip[0].manufacturer_id)); - save_item(NAME(m_flash_chip[0].device_id)); - save_item(NAME(m_flash_chip[0].org_data)); - save_item(NAME(m_flash_chip[0].state)); - save_item(NAME(m_flash_chip[0].command)); - save_item(NAME(m_flash_chip[1].present)); - save_item(NAME(m_flash_chip[1].manufacturer_id)); - save_item(NAME(m_flash_chip[1].device_id)); - save_item(NAME(m_flash_chip[1].org_data)); - save_item(NAME(m_flash_chip[1].state)); - save_item(NAME(m_flash_chip[1].command)); -} - - -void ngp_state::machine_reset() -{ - m_old_to3 = 0; - - m_z80->suspend(SUSPEND_REASON_HALT, 1); - m_z80->set_input_line(0, CLEAR_LINE); - - if ( m_nvram_loaded ) - { - m_tlcs900->set_state_int(TLCS900_PC, 0xFF1800); - } -} - - -UINT32 ngp_state::screen_update_ngp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_k1ge->update( bitmap, cliprect ); - return 0; -} - - -DEVICE_IMAGE_LOAD_MEMBER( ngp_state, ngp_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size != 0x8000 && size != 0x80000 && size != 0x100000 && size != 0x200000 && size != 0x400000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - // alloc 0x400000 ROM to simplify mapping in the address map - m_cart->rom_alloc(0x400000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - //printf("%2x%2x - %x - %x\n", (unsigned int) memregion("cart")->u8(0x20), (unsigned int) memregion("cart")->u8(0x21), - // (unsigned int) memregion("cart")->u8(0x22), (unsigned int) memregion("cart")->u8(0x23)); - m_flash_chip[0].manufacturer_id = 0x98; - m_flash_chip[0].present = 1; - m_flash_chip[0].state = F_READ; - - switch (size) - { - case 0x8000: - case 0x80000: - m_flash_chip[0].device_id = 0xab; - break; - case 0x100000: - m_flash_chip[0].device_id = 0x2c; - break; - case 0x200000: - case 0x400000: - m_flash_chip[0].device_id = 0x2f; - break; - } - - if (size == 0x400000) - { - m_flash_chip[1].manufacturer_id = 0x98; - m_flash_chip[1].device_id = 0x2f; - m_flash_chip[1].present = 1; - m_flash_chip[1].state = F_READ; - } - - return IMAGE_INIT_PASS; -} - - -DEVICE_IMAGE_UNLOAD_MEMBER( ngp_state, ngp_cart ) -{ - m_flash_chip[0].present = 0; - m_flash_chip[0].state = F_READ; - - m_flash_chip[1].present = 0; - m_flash_chip[1].state = F_READ; -} - - -void ngp_state::nvram_default() -{ -} - - -void ngp_state::nvram_read(emu_file &file) -{ - file.read(m_mainram, 0x3000); - m_nvram_loaded = true; -} - - -void ngp_state::nvram_write(emu_file &file) -{ - file.write(m_mainram, 0x3000); -} - - -static MACHINE_CONFIG_START( ngp_common, ngp_state ) - - MCFG_CPU_ADD( "maincpu", TMP95C061, XTAL_6_144MHz ) - MCFG_TLCS900H_AM8_16(1) - MCFG_CPU_PROGRAM_MAP( ngp_mem) - MCFG_TMP95C061_PORTA_WRITE(WRITE8(ngp_state,ngp_tlcs900_porta)) - - MCFG_CPU_ADD( "soundcpu", Z80, XTAL_6_144MHz/2 ) - MCFG_CPU_PROGRAM_MAP( z80_mem) - MCFG_CPU_IO_MAP( z80_io) - - MCFG_SCREEN_ADD( "screen", LCD ) - MCFG_SCREEN_RAW_PARAMS( XTAL_6_144MHz, 515, 0, 160 /*480*/, 199, 0, 152 ) - MCFG_SCREEN_UPDATE_DRIVER(ngp_state, screen_update_ngp) - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO( "lspeaker","rspeaker" ) - - MCFG_SOUND_ADD( "t6w28", T6W28, XTAL_6_144MHz/2 ) - MCFG_SOUND_ROUTE( 0, "lspeaker", 0.50 ) - MCFG_SOUND_ROUTE( 1, "rspeaker", 0.50 ) - - MCFG_SOUND_ADD( "dac_l", DAC, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "lspeaker", 0.50 ) - MCFG_SOUND_ADD( "dac_r", DAC, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "rspeaker", 0.50 ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ngp, ngp_common ) - - MCFG_K1GE_ADD( "k1ge", XTAL_6_144MHz, "screen", WRITELINE( ngp_state, ngp_vblank_pin_w ), WRITELINE( ngp_state, ngp_hblank_pin_w ) ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_PALETTE("k1ge:palette") - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ngp_cart") - MCFG_GENERIC_EXTENSIONS("bin,ngp,npc,ngc") - MCFG_GENERIC_LOAD(ngp_state, ngp_cart) - MCFG_GENERIC_UNLOAD(ngp_state, ngp_cart) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","ngp") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ngpc_list","ngpc") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ngpc, ngp_common ) - MCFG_K2GE_ADD( "k1ge", XTAL_6_144MHz, "screen", WRITELINE( ngp_state, ngp_vblank_pin_w ), WRITELINE( ngp_state, ngp_hblank_pin_w ) ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_PALETTE("k1ge:palette") - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ngp_cart") - MCFG_GENERIC_EXTENSIONS("bin,ngp,npc,ngc") - MCFG_GENERIC_LOAD(ngp_state, ngp_cart) - MCFG_GENERIC_UNLOAD(ngp_state, ngp_cart) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","ngpc") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ngp_list","ngp") -MACHINE_CONFIG_END - - -ROM_START( ngp ) - ROM_REGION( 0x10000, "maincpu" , 0 ) - ROM_LOAD( "ngp_bios.ngp", 0x0000, 0x10000, CRC(6232df8d) SHA1(2f6429b68446536d8b03f35d02f1e98beb6460a0) ) -ROM_END - - -ROM_START( ngpc ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "ngpcbios.rom", 0x0000, 0x10000, CRC(6eeb6f40) SHA1(edc13192054a59be49c6d55f83b70e2510968e86) ) -ROM_END - - -CONS( 1998, ngp, 0, 0, ngp, ngp, driver_device, 0, "SNK", "NeoGeo Pocket", MACHINE_SUPPORTS_SAVE ) -CONS( 1999, ngpc, ngp, 0, ngpc, ngp, driver_device, 0, "SNK", "NeoGeo Pocket Color", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/ob68k1a.c b/src/mess/drivers/ob68k1a.c deleted file mode 100644 index e28b6234825..00000000000 --- a/src/mess/drivers/ob68k1a.c +++ /dev/null @@ -1,292 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Omnibyte OB68K1A - -PCB Layout ----------- - -REV-B - -|-----------------------------------------------------------| -| 555 CN3 CN4 CN5 8116 SW5 10MHz | -| 5.0688MHz | -| PIA PIA | -| ACIA ROM1 ROM0 | -| ACIA PTM ROM3 ROM2 | -| SW1 ROM5 ROM4 | -| CPU | -| SW2 4164 4164 4164 4164 | -| 4164 4164 4164 4164 | -| SW3 4164 4164 4164 4164 | -| 555 4164 4164 4164 4164 | -| SW4 8409 | -|-|-------------CN1----------------|----|-------CN2-------|-| - |--------------------------------| |-----------------| - -Notes: - Relevant IC's shown. - - CPU - Motorola MC68000L10 - PIA - Motorola MC6821P - ACIA - Motorola MC6850P - PTM - Motorola MC6840P - 8116 - SMC COM8116 - 8409 - National Semiconductor DP8409N DRAM Controller - 4164 - Fujitsu MB8264A-12 64Kx1 RAM - 555 - NE555N - SW1 - RAM address DIP8 - SW2 - I/O address DIP8 - SW3 - ROM address DIP8 - SW4 - external RAM access address DIP8 - SW5 - push button - CN1 - 2x43 PCB edge, IEEE 796 (Multibus) - CN2 - 2x30 PCB edge, IEEE 796 (Multibus) - CN3 - 2x25 header, ACIA 0 - CN4 - 2x25 header, ACIA 1 - CN5 - 2x50 header, PIA - -*/ - -/* - - TODO: - - - interrupts - - configuration switches - - PIA odd/even byte access - -*/ - - -#include "includes/ob68k1a.h" - - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// com8116_w - baud rate selection -//------------------------------------------------- - -WRITE8_MEMBER( ob68k1a_state::com8116_w ) -{ - m_dbrg->stt_w(data & 0x0f); - m_dbrg->str_w(data >> 4); -} - - -//------------------------------------------------- -// pia_r - trampoline for PIA odd/even access -//------------------------------------------------- - -READ8_MEMBER( ob68k1a_state::pia_r ) -{ - if (offset) { - return m_pia1->read(space,0); - } else { - return m_pia0->read(space,0); - } -} - - -//------------------------------------------------- -// pia_w - trampoline for PIA odd/even access -//------------------------------------------------- - -WRITE8_MEMBER( ob68k1a_state::pia_w ) -{ - if (offset) { - m_pia1->write(space,0,data); - } else { - m_pia0->write(space,0,data); - } -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( ob68k1a_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ob68k1a_mem, AS_PROGRAM, 16, ob68k1a_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x01ffff) AM_RAM - AM_RANGE(0xfe0000, 0xfeffff) AM_ROM AM_REGION(MC68000L10_TAG, 0) - AM_RANGE(0xffff00, 0xffff01) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, status_r, control_w, 0x00ff) - AM_RANGE(0xffff02, 0xffff03) AM_DEVREADWRITE8(MC6850_0_TAG, acia6850_device, data_r, data_w, 0x00ff) - AM_RANGE(0xffff10, 0xffff11) AM_WRITE8(com8116_w, 0xff00) - AM_RANGE(0xffff20, 0xffff21) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, status_r, control_w, 0x00ff) - AM_RANGE(0xffff22, 0xffff23) AM_DEVREADWRITE8(MC6850_1_TAG, acia6850_device, data_r, data_w, 0x00ff) -// AM_RANGE(0xffff40, 0xffff47) AM_DEVREADWRITE8(MC6821_0_TAG, pia6821_device, read, write, 0x00ff) -// AM_RANGE(0xffff40, 0xffff47) AM_DEVREADWRITE8(MC6821_1_TAG, pia6821_device, read, write, 0xff00) - AM_RANGE(0xffff40, 0xffff47) AM_READWRITE8(pia_r, pia_w, 0xffff) - AM_RANGE(0xffff60, 0xffff6f) AM_DEVREADWRITE8(MC6840_TAG, ptm6840_device, read, write, 0x00ff) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( ob68k1a ) -//------------------------------------------------- - -INPUT_PORTS_START( ob68k1a ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - - -//------------------------------------------------- -// COM8116_INTERFACE( dbrg_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( ob68k1a_state::rx_tx_0_w ) -{ - m_acia0->write_txc(state); - m_acia0->write_rxc(state); -} - -WRITE_LINE_MEMBER( ob68k1a_state::rx_tx_1_w ) -{ - m_acia1->write_txc(state); - m_acia1->write_rxc(state); -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( ob68k1a ) -//------------------------------------------------- - -void ob68k1a_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - // configure RAM - switch (m_ram->size()) - { - case 32*1024: - program.unmap_readwrite(0x008000, 0x01ffff); - break; - } -} - - -void ob68k1a_state::machine_reset() -{ - // initialize COM8116 - m_dbrg->stt_w(0x0e); - m_dbrg->str_w(0x0e); - - // set reset vector - void *ram = m_maincpu->space(AS_PROGRAM).get_write_ptr(0); - UINT8 *rom = memregion(MC68000L10_TAG)->base(); - - memcpy(ram, rom, 8); - - m_maincpu->reset(); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( ob68k1a ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ob68k1a, ob68k1a_state ) - // basic machine hardware - MCFG_CPU_ADD(MC68000L10_TAG, M68000, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(ob68k1a_mem) - - // devices - MCFG_DEVICE_ADD(MC6821_0_TAG, PIA6821, 0) - MCFG_DEVICE_ADD(MC6821_1_TAG, PIA6821, 0) - MCFG_DEVICE_ADD(MC6840_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(XTAL_10MHz/10) - MCFG_PTM6840_EXTERNAL_CLOCKS(0, 0, 0) - - MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC6850_0_TAG, acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC6850_0_TAG, acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC6850_0_TAG, acia6850_device, write_cts)) - - MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(MC6850_1_TAG, acia6850_device, write_cts)) - - MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(ob68k1a_state, rx_tx_0_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE(ob68k1a_state, rx_tx_1_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("128K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( ob68k1a ) -//------------------------------------------------- - -ROM_START( ob68k1a ) - ROM_REGION16_BE( 0x10000, MC68000L10_TAG, 0 ) - ROM_LOAD16_BYTE( "macsbug.u60", 0x0000, 0x2000, CRC(7c8905ff) SHA1(eba6c70f6b5b40d60e2885c2bd33dd93ec2aae48) ) - ROM_LOAD16_BYTE( "macsbug.u61", 0x0001, 0x2000, CRC(b5069252) SHA1(b310465d8ece944bd694cc9726d03fed0f4b2c0f) ) - ROM_LOAD16_BYTE( "idris_boot.u62", 0x4000, 0x2000, CRC(091e900e) SHA1(ea0c9f3ad5179eab2e743459c8afb707c059f0e2) ) - ROM_LOAD16_BYTE( "idris_boot.u63", 0x4001, 0x2000, CRC(a132259f) SHA1(34216bf1d22ff0f0af29699a1e4e0e57631f775d) ) - - ROM_REGION( 0x100, "plds", 0 ) - ROM_LOAD( "1.0.u18", 0x000, 0x100, NO_DUMP ) // PAL16L8 - ROM_LOAD( "2.5.u20", 0x000, 0x100, NO_DUMP ) // PAL16L8 - ROM_LOAD( "3.2.u21", 0x000, 0x100, NO_DUMP ) // PAL16R4 - ROM_LOAD( "4.3.u49", 0x000, 0x100, NO_DUMP ) // PAL16R4 - ROM_LOAD( "5.1.u51", 0x000, 0x100, NO_DUMP ) // PAL16L8 - ROM_LOAD( "6.2.u55", 0x000, 0x100, NO_DUMP ) // PAL16L8 -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1982, ob68k1a, 0, 0, ob68k1a, ob68k1a, driver_device, 0, "Omnibyte", "OB68K1A", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/octopus.c b/src/mess/drivers/octopus.c deleted file mode 100644 index 7e9ce91967e..00000000000 --- a/src/mess/drivers/octopus.c +++ /dev/null @@ -1,198 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Hilger Analytical AB6089 Mk. 1 (LSI Octopus) - -2013-07-26 Skeleton driver. - -http://computers.mcbx.netne.net/8bit/hilger/index.htm - -Below is an extract from the page: - -The computer has 2 CPUs: Z80 and 8088. Most circuits are dated 1985-1986, display circuitry is made by Signetics. -Mainboard was manufactured by LSI Computers Ltd. under part numbers: 15000SS100 and 15000P4100. All steel parts -of casing are grounded by wires. It's graphics card works in pass-through mode: It takes picture from mainboard's -TTL output and adds image to it, then it puts it to monitor. Its ROM is prepared for hard disk and some type of -network, yet no HDD controller nor network interfaces are present inside - it seems that they were added as -expansion cards. - -UPDATE: It's re-branded LSI Octopus computer, a very well-expandable machine which was designed to "grow with a -company". First stage was a computer which could be used even with TV set. As requirements increased, Octopus -could be equipped with hard disk controller, network adapter, multi-terminal serial port card to act as a terminal -server or even CPU cards to run concurrent systems. There were even tape backup devices for it. Octopus could run -CP/M, MP/M (concurrent - multitasking-like OS, even with terminals), or even MS-DOS - CP/M or MP/M could be used -with Z80 or 8080. There was also LSI ELSIE system, a concurrent DOS. Last British LSI machines were 386 computers -which could be used as servers for Octopus computers. - -Manufacturer Hilger Analytical / LSI Computers Ltd. - -Origin UK -Year of unit 1986? -Year of introduction 1985 -End of production ? -CPU Z80, 8088 -Speed ?? -RAM 256kB -ROM 16kB (Basic) -Colors: ?? -Sound: Speaker. Beeps :) -OS: CP/M 80 or 86 -MP/M 80 o 86 -Concurrent CP/M -LSI ELSIE -MS-DOS -Display modes: Text: ?? -Graphics: ?? - -Media: Two internal 5.25" floppy disk drives, DS DD, 96tpi. -Probably hard disk - -Power supply: -Built-in switching power supply. - -I/O: Serial port -2 parallel ports - -Video TTL Output -Composite video output - -Possible upgrades: Many - -Software accessibility: -Dedicated: Impossible. -CP/M - Good -DOS - Good. - -It won't take XT nor AT keyboard, but pinout is quite similar. UPDATE: I saw a few photos of keyboard. -It's another Z80 computer! It has an EPROM, simple memory and CPU. - -After powering on, it should perform POST writing: - -TESTING... - Main Processor - PROM - DMA Controllers - RAM - Interrupts - Floppy Discs - Hard Disc Controller (optionally - if installed) - -Waiting for hard Disc... (Optionally - if installed) - -Firmware versions: - -SYSTEM 18B (or other) -GRAPHICS 4 (if graphic card installed) - -And probably it should boot or display: - -Insert System Disk. - -Or maybe: - -Nowhere to boot from. - -Load options: - Floppy - Pro Network - Winchester -Enter selection: - -This information was gained by studying boot ROM of the machine. - -It's a very rare computer. It has 2 processors, Z80 and 8088, so it seems that it may run CP/M and DOS. -Its BIOS performs POST and halts as there's no keyboard. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" - - -class octopus_state : public driver_device -{ -public: - octopus_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - DECLARE_WRITE8_MEMBER(port_c9); - UINT32 screen_update_octopus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START( octopus_mem, AS_PROGRAM, 8, octopus_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x1ffff) AM_RAM - AM_RANGE(0xe4000, 0xe4fff) AM_RAM // character definitions - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( octopus_io, AS_IO, 8, octopus_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xc5, 0xc9) AM_WRITE(port_c9) -ADDRESS_MAP_END - -WRITE8_MEMBER( octopus_state::port_c9 ) -{ - if (offset == 0) - printf("\n"); - if (offset == 4) - printf("%c",data); -} - - -/* Input ports */ -static INPUT_PORTS_START( octopus ) -INPUT_PORTS_END - - -void octopus_state::machine_reset() -{ -} - -void octopus_state::video_start() -{ -} - -UINT32 octopus_state::screen_update_octopus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( octopus, octopus_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8088, XTAL_9_8304MHz) // absolutely no idea what frequency - MCFG_CPU_PROGRAM_MAP(octopus_mem) - MCFG_CPU_IO_MAP(octopus_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(octopus_state, screen_update_octopus) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( octopus ) - ROM_REGION( 0x4000, "user1", 0 ) - ROM_LOAD( "octopus_main_prom", 0x0000, 0x4000, CRC(b5b4518d) SHA1(41b8729c4c9074914fd4ea181c8b6d4805ee2b93) ) - - // This rom was on the graphics card (yes, it has slots) - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "octopus_gfx_card", 0x0000, 0x2000, CRC(b2386534) SHA1(5e3c4682afb4eb222e48a7203269a16d26911836) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, octopus, 0, 0, octopus, octopus, driver_device, 0, "Digital Microsystems", "LSI Octopus", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/odyssey2.c b/src/mess/drivers/odyssey2.c deleted file mode 100644 index fdd98f3b815..00000000000 --- a/src/mess/drivers/odyssey2.c +++ /dev/null @@ -1,833 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - /drivers/odyssey2.c - - Driver file to handle emulation of the Odyssey2. - - Minor update to "the voice" rom names, and add comment about - the older revision of "the voice" - LN, 10/03/08 - -***************************************************************************/ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "video/i8244.h" -#include "machine/i8243.h" -#include "video/ef9340_1.h" - -#include "bus/odyssey2/slot.h" - - -class odyssey2_state : public driver_device -{ -public: - odyssey2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_i8244(*this, "i8244"), - m_cart(*this, "cartslot"), - m_keyboard(*this, "KEY"), - m_joysticks(*this, "JOY") { } - - required_device m_maincpu; - required_device m_i8244; - required_device m_cart; - - UINT8 m_ram[256]; - UINT8 m_p1; - UINT8 m_p2; - UINT8 m_lum; - DECLARE_READ8_MEMBER(io_read); - DECLARE_WRITE8_MEMBER(io_write); - DECLARE_READ8_MEMBER(bus_read); - DECLARE_WRITE8_MEMBER(bus_write); - DECLARE_READ8_MEMBER(p1_read); - DECLARE_WRITE8_MEMBER(p1_write); - DECLARE_READ8_MEMBER(p2_read); - DECLARE_WRITE8_MEMBER(p2_write); - DECLARE_READ8_MEMBER(t1_read); - DECLARE_DRIVER_INIT(odyssey2); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(odyssey2); - UINT32 screen_update_odyssey2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(irq_callback); - - DECLARE_WRITE16_MEMBER(scanline_postprocess); - -protected: - /* constants */ - static const UINT8 P1_BANK_LO_BIT = 0x01; - static const UINT8 P1_BANK_HI_BIT = 0x02; - static const UINT8 P1_KEYBOARD_SCAN_ENABLE = 0x04; /* active low */ - static const UINT8 P1_VDC_ENABLE = 0x08; /* active low */ - static const UINT8 P1_EXT_RAM_ENABLE = 0x10; /* active low */ - static const UINT8 P1_VPP_ENABLE = 0x20; /* active low */ - static const UINT8 P1_VDC_COPY_MODE_ENABLE = 0x40; - static const UINT8 P2_KEYBOARD_SELECT_MASK = 0x07; /* select row to scan */ - - required_ioport_array<6> m_keyboard; - required_ioport_array<2> m_joysticks; -}; - -class g7400_state : public odyssey2_state -{ -public: - g7400_state(const machine_config &mconfig, device_type type, const char *tag) - : odyssey2_state(mconfig, type, tag) - , m_i8243(*this, "i8243") - , m_ef9340_1(*this, "ef9340_1") - { } - - required_device m_i8243; - required_device m_ef9340_1; - - DECLARE_PALETTE_INIT(g7400); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_WRITE8_MEMBER(p2_write); - DECLARE_READ8_MEMBER(io_read); - DECLARE_WRITE8_MEMBER(io_write); - DECLARE_WRITE8_MEMBER(i8243_port_w); - DECLARE_WRITE16_MEMBER(scanline_postprocess); - -protected: - UINT8 m_ic674_decode[8]; - UINT8 m_ic678_decode[8]; -}; - - -static ADDRESS_MAP_START( odyssey2_mem , AS_PROGRAM, 8, odyssey2_state ) - AM_RANGE(0x0000, 0x03ff) AM_ROM - AM_RANGE(0x0400, 0x0bff) AM_DEVREAD("cartslot", o2_cart_slot_device, read_rom04) - AM_RANGE(0x0c00, 0x0fff) AM_DEVREAD("cartslot", o2_cart_slot_device, read_rom0c) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( odyssey2_io , AS_IO, 8, odyssey2_state ) - AM_RANGE(0x00, 0xff) AM_READWRITE(io_read, io_write) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_read, p1_write) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_read, p2_write) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_read, bus_write) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_DEVREAD("cartslot", o2_cart_slot_device, t0_read) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_read) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( g7400_io , AS_IO, 8, g7400_state ) - AM_RANGE(0x00, 0xff) AM_READWRITE(io_read, io_write) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_read, p1_write) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_read, p2_write) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_read, bus_write) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_DEVREAD("cartslot", o2_cart_slot_device, t0_read) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_read) - AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w); -ADDRESS_MAP_END - - -static INPUT_PORTS_START( odyssey2 ) - PORT_START("KEY.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("KEY.1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?? :") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?? $") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - - PORT_START("KEY.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("KEY.3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - - PORT_START("KEY.4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - - PORT_START("KEY.5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(DEF_STR( Yes )) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(DEF_STR( No )) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - - PORT_START("JOY.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT( 0xe0, 0xe0, IPT_UNUSED ) - - PORT_START("JOY.1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT( 0xe0, 0xe0, IPT_UNUSED ) -INPUT_PORTS_END - - -/* character sprite colors - dark grey, red, green, yellow, blue, violet, light grey, white - dark back / grid colors - black, dark blue, dark green, light green, red, violet, yellow, light grey - light back / grid colors - black, blue, green, light green, red, violet, yellow, light grey */ - -const UINT8 odyssey2_colors[] = -{ - /* Background,Grid Dim */ - 0x00,0x00,0x00, /* Black */ // i r g b - 0x1A,0x37,0xBE, /* Blue - Calibrated To Real VideoPac */ // i r g B - 0x00,0x6D,0x07, /* Green - Calibrated To Real VideoPac */ // i r G b - 0x2A,0xAA,0xBE, /* Blue-Green - Calibrated To Real VideoPac */ // i r G B - 0x79,0x00,0x00, /* Red - Calibrated To Real VideoPac */ // i R g b - 0x94,0x30,0x9F, /* Violet - Calibrated To Real VideoPac */ // i R g B - 0x77,0x67,0x0B, /* Khaki - Calibrated To Real VideoPac */ // i R g B - 0xCE,0xCE,0xCE, /* Lt Grey */ // i R G B - - /* Background,Grid Bright */ - 0x67,0x67,0x67, /* Grey - Calibrated To Real VideoPac */ // I R g B - 0x5C,0x80,0xF6, /* Lt Blue - Calibrated To Real VideoPac */ // I R g B - 0x56,0xC4,0x69, /* Lt Green - Calibrated To Real VideoPac */ // I R g B - 0x77,0xE6,0xEB, /* Lt Blue-Green - Calibrated To Real VideoPac */ // I R g b - 0xC7,0x51,0x51, /* Lt Red - Calibrated To Real VideoPac */ // I R g b - 0xDC,0x84,0xE8, /* Lt Violet - Calibrated To Real VideoPac */ // I R g B - 0xC6,0xB8,0x6A, /* Lt Yellow - Calibrated To Real VideoPac */ // I R G b - 0xFF,0xFF,0xFF, /* White */ // I R G B -}; - - -PALETTE_INIT_MEMBER(odyssey2_state, odyssey2) -{ - for ( int i = 0; i < 16; i++ ) - { - palette.set_pen_color( i, odyssey2_colors[i*3], odyssey2_colors[i*3+1], odyssey2_colors[i*3+2] ); - } -} - - -PALETTE_INIT_MEMBER(g7400_state, g7400) -{ - const UINT8 g7400_colors[] = - { - 0x00,0x00,0x00, // Black - 0x1A,0x37,0xBE, // Blue - 0x00,0x6D,0x07, // Green - 0x2A,0xAA,0xBE, // Blue-Green - 0x79,0x00,0x00, // Red - 0x94,0x30,0x9F, // Violet - 0x77,0x67,0x0B, // Khaki - 0xCE,0xCE,0xCE, // Lt Grey - - 0x67,0x67,0x67, // Grey - 0x5C,0x80,0xF6, // Lt Blue - 0x56,0xC4,0x69, // Lt Green - 0x77,0xE6,0xEB, // Lt Blue-Green - 0xC7,0x51,0x51, // Lt Red - 0xDC,0x84,0xE8, // Lt Violet - 0xC6,0xB8,0x6A, // Lt Yellow - 0xff,0xff,0xff // White - - }; - - for ( int i = 0; i < 16; i++ ) - { - palette.set_pen_color( i, g7400_colors[i*3], g7400_colors[i*3+1], g7400_colors[i*3+2] ); - } -} - - -WRITE_LINE_MEMBER(odyssey2_state::irq_callback) -{ - m_maincpu->set_input_line(0, state); -} - - -DRIVER_INIT_MEMBER(odyssey2_state,odyssey2) -{ - UINT8 *gfx = memregion("gfx1")->base(); - - for (int i = 0; i < 256; i++) - { - gfx[i] = i; /* TODO: Why i and not 0? */ - m_ram[i] = 0; - } -} - - -void odyssey2_state::machine_start() -{ - save_pointer(NAME(m_ram),256); - save_item(NAME(m_p1)); - save_item(NAME(m_p2)); - save_item(NAME(m_lum)); -} - - -void odyssey2_state::machine_reset() -{ - m_lum = 0; - - /* jump to "last" bank, will work for all sizes due to being mirrored */ - m_p1 = 0xff; - m_p2 = 0xff; - m_cart->write_bank(m_p1); -} - - -void g7400_state::machine_start() -{ - odyssey2_state::machine_start(); - - save_pointer(NAME(m_ic674_decode),8); - save_pointer(NAME(m_ic678_decode),8); -} - - -void g7400_state::machine_reset() -{ - odyssey2_state::machine_reset(); - - for ( int i = 0; i < 8; i++ ) - { - m_ic674_decode[i] = 0; - m_ic678_decode[i] = 0; - } -} - -/****** External RAM ******************************/ - -READ8_MEMBER(odyssey2_state::io_read) -{ - if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0) - { - return m_i8244->read(space, offset); - } - if (!(m_p1 & P1_EXT_RAM_ENABLE)) - { - return m_ram[offset]; - } - - return 0; -} - - -WRITE8_MEMBER(odyssey2_state::io_write) -{ - if ((m_p1 & (P1_EXT_RAM_ENABLE | P1_VDC_COPY_MODE_ENABLE)) == 0x00) - { - m_ram[offset] = data; - if (offset & 0x80) - { - logerror("voice write %02X, data = %02X (p1 = %02X)\n", offset, data, m_p1); - m_cart->io_write(space, offset, data); - } - } - else if (!(m_p1 & P1_VDC_ENABLE)) - { - m_i8244->write(space, offset, data); - } -} - - -READ8_MEMBER(g7400_state::io_read) -{ - if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0) - { - return m_i8244->read(space, offset); - } - else if (!(m_p1 & P1_EXT_RAM_ENABLE)) - { - return m_ram[offset]; - } - else if (!(m_p1 & P1_VPP_ENABLE)) - { - return m_ef9340_1->ef9341_read( offset & 0x02, offset & 0x01 ); - } - - return 0; -} - - -WRITE8_MEMBER(g7400_state::io_write) -{ - if ((m_p1 & (P1_EXT_RAM_ENABLE | P1_VDC_COPY_MODE_ENABLE)) == 0x00) - { - m_ram[offset] = data; - if (offset & 0x80) - { - logerror("voice write %02X, data = %02X (p1 = %02X)\n", offset, data, m_p1); - m_cart->io_write(space, offset, data); - } - } - else if (!(m_p1 & P1_VDC_ENABLE)) - { - m_i8244->write(space, offset, data); - } - else if (!(m_p1 & P1_VPP_ENABLE)) - { - m_ef9340_1->ef9341_write( offset & 0x02, offset & 0x01, data ); - } -} - - -WRITE16_MEMBER(odyssey2_state::scanline_postprocess) -{ - int vpos = data; - bitmap_ind16 *bitmap = m_i8244->get_bitmap(); - - if ( vpos < i8244_device::START_Y || vpos >= i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) - { - return; - } - - // apply external LUM setting - for ( int x = i8244_device::START_ACTIVE_SCAN; x < i8244_device::END_ACTIVE_SCAN; x++ ) - { - bitmap->pix16( vpos, x ) |= ( m_lum ^ 0x08 ); - } -} - - -WRITE16_MEMBER(g7400_state::scanline_postprocess) -{ - int vpos = data; - int y = vpos - i8244_device::START_Y - 5; - bitmap_ind16 *bitmap = m_i8244->get_bitmap(); - bitmap_ind16 *ef934x_bitmap = m_ef9340_1->get_bitmap(); - - if ( vpos < i8244_device::START_Y || vpos >= i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) - { - return; - } - - // apply external LUM setting - int x_real_start = i8244_device::START_ACTIVE_SCAN + i8244_device::BORDER_SIZE + 5; - int x_real_end = i8244_device::END_ACTIVE_SCAN - i8244_device::BORDER_SIZE + 5; - for ( int x = i8244_device::START_ACTIVE_SCAN; x < i8244_device::END_ACTIVE_SCAN; x++ ) - { - UINT16 d = bitmap->pix16( vpos, x ); - - if ( ( ! m_ic678_decode[ d & 0x07 ] ) && x >= x_real_start && x < x_real_end && y >= 0 && y < 240 ) - { - // Use EF934x input - d = ef934x_bitmap->pix16( y, x - x_real_start ) & 0x07; - - if ( ! m_ic674_decode[ d & 0x07 ] ) - { - d |= 0x08; - } - } - else - { - // Use i8245 input - d |= ( m_lum ^ 0x08 ); - } - bitmap->pix16( vpos, x ) = d; - } -} - - -UINT32 odyssey2_state::screen_update_odyssey2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return m_i8244->screen_update(screen, bitmap, cliprect); -} - - -READ8_MEMBER(odyssey2_state::t1_read) -{ - if ( m_i8244->vblank() || m_i8244->hblank() ) - { - return 1; - } - return 0; -} - - -READ8_MEMBER(odyssey2_state::p1_read) -{ - UINT8 data = m_p1; - - return data; -} - - -WRITE8_MEMBER(odyssey2_state::p1_write) -{ - m_p1 = data; - m_lum = ( data & 0x80 ) >> 4; - m_cart->write_bank(m_p1); -} - - -READ8_MEMBER(odyssey2_state::p2_read) -{ - UINT8 h = 0xFF; - int i, j; - - if (!(m_p1 & P1_KEYBOARD_SCAN_ENABLE)) - { - if ((m_p2 & P2_KEYBOARD_SELECT_MASK) <= 5) /* read keyboard */ - { - h &= m_keyboard[m_p2 & P2_KEYBOARD_SELECT_MASK]->read(); - } - - for (i= 0x80, j = 0; i > 0; i >>= 1, j++) - { - if (!(h & i)) - { - m_p2 &= ~0x10; /* set key was pressed indicator */ - m_p2 = (m_p2 & ~0xE0) | (j << 5); /* column that was pressed */ - - break; - } - } - - if (h == 0xFF) /* active low inputs, so no keypresses */ - { - m_p2 = m_p2 | 0xF0; - } - } - else - { - m_p2 = m_p2 | 0xF0; - } - - return m_p2; -} - - -WRITE8_MEMBER(odyssey2_state::p2_write) -{ - m_p2 = data; -} - - -WRITE8_MEMBER(g7400_state::p2_write) -{ - m_p2 = data; - m_i8243->i8243_p2_w( space, 0, m_p2 & 0x0f ); -} - - -READ8_MEMBER(odyssey2_state::bus_read) -{ - UINT8 data = 0xff; - - if ((m_p2 & P2_KEYBOARD_SELECT_MASK) == 1) - { - data &= m_joysticks[0]->read(); - } - - if ((m_p2 & P2_KEYBOARD_SELECT_MASK) == 0) - { - data &= m_joysticks[1]->read(); - } - - return data; -} - - -WRITE8_MEMBER(odyssey2_state::bus_write) -{ - logerror("%.6f bus written %.2x\n", machine().time().as_double(), data); -} - - -/* - i8243 in the g7400 -*/ - -WRITE8_MEMBER(g7400_state::i8243_port_w) -{ - switch ( offset & 3 ) - { - case 0: // "port 4" -logerror("setting ef-port4 to %02x\n", data); - m_ic674_decode[4] = BIT(data,0); - m_ic674_decode[5] = BIT(data,1); - m_ic674_decode[6] = BIT(data,2); - m_ic674_decode[7] = BIT(data,3); - break; - - case 1: // "port 5" -logerror("setting ef-port5 to %02x\n", data); - m_ic674_decode[0] = BIT(data,0); - m_ic674_decode[1] = BIT(data,1); - m_ic674_decode[2] = BIT(data,2); - m_ic674_decode[3] = BIT(data,3); - break; - - case 2: // "port 6" -logerror("setting vdc-port6 to %02x\n", data); - m_ic678_decode[4] = BIT(data,0); - m_ic678_decode[5] = BIT(data,1); - m_ic678_decode[6] = BIT(data,2); - m_ic678_decode[7] = BIT(data,3); - break; - - case 3: // "port 7" -logerror("setting vdc-port7 to %02x\n", data); - m_ic678_decode[0] = BIT(data,0); - m_ic678_decode[1] = BIT(data,1); - m_ic678_decode[2] = BIT(data,2); - m_ic678_decode[3] = BIT(data,3); - break; - - } -} - - -static const gfx_layout odyssey2_graphicslayout = -{ - 8,1, - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - /* x offsets */ - { - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - }, - /* y offsets */ - { 0 }, - 1*8 -}; - - -static const gfx_layout odyssey2_spritelayout = -{ - 8,1, - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - /* x offsets */ - { - 7,6,5,4,3,2,1,0 - }, - /* y offsets */ - { 0 }, - 1*8 -}; - - -static GFXDECODE_START( odyssey2 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, odyssey2_graphicslayout, 0, 2 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, odyssey2_spritelayout, 0, 2 ) -GFXDECODE_END - - - -static MACHINE_CONFIG_FRAGMENT( odyssey2_cartslot ) - MCFG_O2_CARTRIDGE_ADD("cartslot", o2_cart, NULL) - - MCFG_SOFTWARE_LIST_ADD("cart_list","odyssey2") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( odyssey2, odyssey2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8048, ( ( XTAL_7_15909MHz * 3 ) / 4 ) ) - MCFG_CPU_PROGRAM_MAP(odyssey2_mem) - MCFG_CPU_IO_MAP(odyssey2_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( XTAL_7_15909MHz/2 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8244_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) - MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", odyssey2 ) - MCFG_PALETTE_ADD("palette", 32) - MCFG_PALETTE_INIT_OWNER(odyssey2_state, odyssey2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_I8244_ADD( "i8244", XTAL_7_15909MHz/2 * 2, "screen", WRITELINE( odyssey2_state, irq_callback ), WRITE16( odyssey2_state, scanline_postprocess ) ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) - - MCFG_FRAGMENT_ADD(odyssey2_cartslot) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( videopac, odyssey2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8048, ( XTAL_17_73447MHz / 3 ) ) - MCFG_CPU_PROGRAM_MAP(odyssey2_mem) - MCFG_CPU_IO_MAP(odyssey2_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( XTAL_17_73447MHz/5 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8245_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) - MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", odyssey2 ) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(odyssey2_state, odyssey2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_I8245_ADD( "i8244", XTAL_17_73447MHz/5 * 2, "screen", WRITELINE( odyssey2_state, irq_callback ), WRITE16( odyssey2_state, scanline_postprocess ) ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) - - MCFG_FRAGMENT_ADD(odyssey2_cartslot) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( g7400, g7400_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8048, XTAL_5_911MHz ) - MCFG_CPU_PROGRAM_MAP(odyssey2_mem) - MCFG_CPU_IO_MAP(g7400_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( 3540000 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8245_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) - MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", odyssey2 ) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(g7400_state, g7400) - - MCFG_I8243_ADD( "i8243", NOOP, WRITE8(g7400_state,i8243_port_w)) - - MCFG_EF9340_1_ADD( "ef9340_1", 3540000, "screen" ) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_I8245_ADD( "i8244", 3540000 * 2, "screen", WRITELINE( odyssey2_state, irq_callback ), WRITE16( g7400_state, scanline_postprocess ) ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) - - MCFG_FRAGMENT_ADD(odyssey2_cartslot) - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list","g7400") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ody2_list","odyssey2") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( odyssey3, g7400_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8048, XTAL_5_911MHz ) - MCFG_CPU_PROGRAM_MAP(odyssey2_mem) - MCFG_CPU_IO_MAP(g7400_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( 3540000 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8244_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) - MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", odyssey2 ) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(g7400_state, g7400) - - MCFG_I8243_ADD( "i8243", NOOP, WRITE8(g7400_state,i8243_port_w)) - - MCFG_EF9340_1_ADD( "ef9340_1", 3540000, "screen" ) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_I8244_ADD( "i8244", 3540000 * 2, "screen", WRITELINE( odyssey2_state, irq_callback ), WRITE16( g7400_state, scanline_postprocess ) ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) - - MCFG_FRAGMENT_ADD(odyssey2_cartslot) - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list","g7400") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ody2_list","odyssey2") -MACHINE_CONFIG_END - - -ROM_START (odyssey2) - ROM_REGION(0x10000,"maincpu",0) /* safer for the memory handler/bankswitching??? */ - ROM_LOAD ("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) - ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) -ROM_END - - -ROM_START (videopac) - ROM_REGION(0x10000,"maincpu",0) /* safer for the memory handler/bankswitching??? */ - ROM_SYSTEM_BIOS( 0, "g7000", "g7000" ) - ROMX_LOAD ("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "c52", "c52" ) - ROMX_LOAD ("c52.bin", 0x0000, 0x0400, CRC(a318e8d6) SHA1(a6120aed50831c9c0d95dbdf707820f601d9452e), ROM_BIOS(2)) - ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) -ROM_END - - -ROM_START (g7400) - ROM_REGION(0x10000,"maincpu",0) /* safer for the memory handler/bankswitching??? */ - ROM_LOAD ("g7400.bin", 0x0000, 0x0400, CRC(e20a9f41) SHA1(5130243429b40b01a14e1304d0394b8459a6fbae)) - ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) -ROM_END - - -ROM_START (jopac) - ROM_REGION(0x10000,"maincpu",0) /* safer for the memory handler/bankswitching??? */ - ROM_LOAD ("jopac.bin", 0x0000, 0x0400, CRC(11647ca5) SHA1(54b8d2c1317628de51a85fc1c424423a986775e4)) - ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) -ROM_END - - -ROM_START (odyssey3) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD ("odyssey3.bin", 0x0000, 0x0400, CRC(e2b23324) SHA1(0a38c5f2cea929d2fe0a23e5e1a60de9155815dc)) - - ROM_REGION(0x100, "gfx1", ROMREGION_ERASEFF) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, odyssey2, 0, 0, odyssey2, odyssey2, odyssey2_state, odyssey2, "Magnavox", "Odyssey 2", 0 ) -COMP( 1979, videopac, odyssey2, 0, videopac, odyssey2, odyssey2_state, odyssey2, "Philips", "Videopac G7000/C52", 0 ) -COMP( 1983, g7400, odyssey2, 0, g7400, odyssey2, odyssey2_state, odyssey2, "Philips", "Videopac Plus G7400", MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1983, jopac, odyssey2, 0, g7400, odyssey2, odyssey2_state, odyssey2, "Brandt", "Jopac JO7400", MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1983, odyssey3, odyssey2, 0, odyssey3, odyssey2, odyssey2_state, odyssey2, "Magnavox", "Odyssey 3 Command Center (prototype)", MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/okean240.c b/src/mess/drivers/okean240.c deleted file mode 100644 index 8fc87a52848..00000000000 --- a/src/mess/drivers/okean240.c +++ /dev/null @@ -1,538 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Okeah-240 (Ocean-240) - - 28/12/2011 Skeleton driver. - - Info from EMU80: - -intctl : K580wn59 - irq[0]=kbd.irq2 - irq[1]=kbd.irq - irq[4]=tim.out[0] - -ppa40 : K580ww55 - portA=kbd.pressed.mask - portB[2]=cas.playback - portB[5]=kbd.key[58] - portB[6]=kbd.key[59] - portC[0-3]=kbd.pressed.row - portC[4]=kbd.ack - -ppaC0 : K580ww55 - portA=vid.scroll.y - portB[0-3]=mem.frame[0].page - portB[1-3]=mem.frame[1].page - portB[4-5]=mm.page - portC=vid.scroll.x - - -NOTE ABOUT THE TEST ROM (okean240t): -- You need to press a key every so often. - - -ToDo: -- Add devices -- Find out if any unconnected keyboard entries are real keys -- Colours? -- Sound? (perhaps port E4 bit 3) -- Add disks -- Cassette? -- Add memory banking (perhaps port C1) - -Usage of terminal: -- okean240 - the keyboard -- okean240a - not used -- okean240t - the keyboard & screen - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/keyboard.h" -#include "machine/terminal.h" - -#define KEYBOARD_TAG "keyboard" -#define TERMINAL_TAG "terminal" - -class okean240_state : public driver_device -{ -public: - enum - { - TIMER_OKEAN_BOOT - }; - - okean240_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_term_data(0), - m_j(0), - m_scroll(0), - m_p_videoram(*this, "p_videoram"), - m_io_modifiers(*this, "MODIFIERS"), - m_maincpu(*this, "maincpu") - { - } - - DECLARE_READ8_MEMBER(okean240_kbd_status_r); - DECLARE_READ8_MEMBER(okean240a_kbd_status_r); - DECLARE_READ8_MEMBER(term_status_r); - DECLARE_READ8_MEMBER(term_r); - DECLARE_READ8_MEMBER(okean240_keyboard_r); - DECLARE_WRITE8_MEMBER(okean240_keyboard_w); - DECLARE_READ8_MEMBER(okean240a_keyboard_r); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE8_MEMBER(scroll_w); - UINT8 m_term_data; - UINT8 m_j; - UINT8 m_scroll; - required_shared_ptr m_p_videoram; - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_DRIVER_INIT(okean240); - UINT32 screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - optional_ioport m_io_modifiers; - ioport_port *m_io_port[11]; - required_device m_maincpu; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -// okean240 requires bit 4 to change -READ8_MEMBER( okean240_state::okean240_kbd_status_r ) -{ - if (m_term_data) - return (machine().rand() & 0x10) | 2; - else - return machine().rand() & 0x10; -} - -// see if a key is pressed and indicate status -READ8_MEMBER( okean240_state::okean240a_kbd_status_r ) -{ - UINT8 i,j; - - for (i = 0; i < 11; i++) - { - j = m_io_port[i]->read(); - if (j) - return (machine().rand() & 0x10) | 2; - } - m_j = 0; - return machine().rand() & 0x10; -} - -// for test rom -READ8_MEMBER( okean240_state::term_status_r ) -{ - return (m_term_data) ? 3 : 1; -} - -READ8_MEMBER( okean240_state::okean240_keyboard_r ) -{ - if (offset == 0) // port 40 (get ascii key value) - return term_r(space, offset); - else - if (offset == 1) // port 41 bit 1 (test rom status bit) - { - return (machine().rand() & 2); - } - else // port 42 (not used) - return 0; -} - -READ8_MEMBER( okean240_state::okean240a_keyboard_r ) -{ - UINT8 i,j; - - if (offset == 0) // port 40 (get a column) - { - for (i = 0; i < 11; i++) - { - j = m_io_port[i]->read(); - if (j) - { - if (j==m_j) return 0; - m_j=j; - return j; - } - } - m_j=0; - return 0; - } - else - if (offset == 1) // port 41 bits 6&7 (modifier keys), and bit 1 (test rom status bit) - { - return (machine().rand() & 2) | m_io_modifiers->read(); - } - else // port 42 (get a row) - { - for (i = 0; i < 11; i++) - { - if (m_io_port[i]->read() ) - return i; - } - } - return 0; -} - -// This is a keyboard acknowledge pulse, it goes high then -// straightaway low, if reading port 40 indicates a key is pressed. -WRITE8_MEMBER( okean240_state::okean240_keyboard_w ) -{ -// okean240: port 42 bit 7 -// okean240a: port 42 bit 4 -} - -// for test rom -READ8_MEMBER( okean240_state::term_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( okean240_state::scroll_w ) -{ - m_scroll = data; -} - -static ADDRESS_MAP_START(okean240_mem, AS_PROGRAM, 8, okean240_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") - AM_RANGE(0x0800, 0x3fff) AM_RAM - AM_RANGE(0x4000, 0x7fff) AM_RAM AM_SHARE("p_videoram") - AM_RANGE(0x8000, 0xbfff) AM_RAM - AM_RANGE(0xc000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(okean240_io, AS_IO, 8, okean240_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x42) AM_READWRITE(okean240_keyboard_r,okean240_keyboard_w) - AM_RANGE(0x80, 0x80) AM_READ(okean240_kbd_status_r) - AM_RANGE(0xa0, 0xa0) AM_READ(term_r) - AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r) - AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(okean240a_io, AS_IO, 8, okean240_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x42) AM_READWRITE(okean240a_keyboard_r,okean240_keyboard_w) - AM_RANGE(0x80, 0x80) AM_READ(okean240a_kbd_status_r) - AM_RANGE(0xa0, 0xa0) AM_READ(term_r) - AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r) - AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w) - // AM_RANGE(0x00, 0x1f)=ppa00.data - // AM_RANGE(0x20, 0x23)=dsk.data - // AM_RANGE(0x24, 0x24)=dsk.wait - // AM_RANGE(0x25, 0x25)=dskctl.data - // AM_RANGE(0x40, 0x5f)=ppa40.data - // AM_RANGE(0x60, 0x7f)=tim.data - // AM_RANGE(0x80, 0x81)=intctl.data - // AM_RANGE(0xa0, 0xa1)=comport.data - // AM_RANGE(0xc0, 0xdf)=ppaC0.data - // AM_RANGE(0xe0, 0xff)=ppaE0.data -ADDRESS_MAP_END - -static ADDRESS_MAP_START(okean240t_io, AS_IO, 8, okean240_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x42) AM_READWRITE(okean240_keyboard_r,okean240_keyboard_w) - AM_RANGE(0x80, 0x80) AM_READ(okean240_kbd_status_r) - AM_RANGE(0xa0, 0xa0) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0xa0, 0xa0) AM_READ(term_r) - AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r) - AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( okean240 ) -INPUT_PORTS_END - - -static INPUT_PORTS_START( okean240a ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) // comma - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) // minus - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) // null - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) // null - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) // null - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num9") PORT_CODE(KEYCODE_9_PAD) - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) // null - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) // null - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) // null - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("numdel") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("numenter") PORT_CODE(KEYCODE_ENTER_PAD) - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) // null - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num3") PORT_CODE(KEYCODE_3_PAD) - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //9E - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("num6") PORT_CODE(KEYCODE_6_PAD) - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //81 - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) // plus - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) //7F - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) //03 - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //86 - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) //99 - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) //8B - - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) //84 - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //92 prints # and line feed - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) //98 - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) //85 cr and line feed - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_END) - - PORT_START("X8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) //83 cancel input - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - - PORT_START("X9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) //93 - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_START("XA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("MODIFIERS") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - - -void okean240_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_OKEAN_BOOT: - /* after the first 6 bytes have been read from ROM, switch the ram back in */ - membank("boot")->set_entry(0); - break; - default: - assert_always(FALSE, "Unknown id in okean240_state::device_timer"); - } -} - - -void okean240_state::machine_start() -{ - char kbdrow[6]; - - for (int i = 0; i < 11; i++) - { - sprintf(kbdrow,"X%X",i); - m_io_port[i] = ioport(kbdrow); - } -} - - -void okean240_state::machine_reset() -{ - timer_set(attotime::from_usec(10), TIMER_OKEAN_BOOT); - membank("boot")->set_entry(1); - m_term_data = 0; - m_j = 0; - m_scroll = 0; -} - -WRITE8_MEMBER( okean240_state::kbd_put ) -{ - m_term_data = data; -} - -DRIVER_INIT_MEMBER(okean240_state,okean240) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000); -} - -void okean240_state::video_start() -{ -} - -UINT32 okean240_state::screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 gfx,ma; // ma must be 8bit - UINT16 x,y; - - for (y = 0; y < 256; y++) - { - ma = y + m_scroll; - UINT16 *p = &bitmap.pix16(y); - - for (x = 0; x < 0x4000; x+=0x200) - { - gfx = m_p_videoram[x|ma] | m_p_videoram[x|ma|0x100]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 0); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 7); - } - } - return 0; -} - - -/* F4 Character Displayer */ -static const gfx_layout okean240_charlayout = -{ - 8, 7, /* 8 x 7 characters */ - 160, /* 160 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8 }, - 8*7 /* every char takes 7 bytes */ -}; - -static GFXDECODE_START( okean240 ) - GFXDECODE_ENTRY( "maincpu", 0xec08, okean240_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( okean240a ) - GFXDECODE_ENTRY( "maincpu", 0xef63, okean240_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( okean240t, okean240_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_12MHz / 6) - MCFG_CPU_PROGRAM_MAP(okean240_mem) - MCFG_CPU_IO_MAP(okean240t_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 255) - MCFG_SCREEN_UPDATE_DRIVER(okean240_state, screen_update_okean240) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(okean240_state, kbd_put)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( okean240a, okean240t ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(okean240a_io) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", okean240a) - MCFG_DEVICE_REMOVE(TERMINAL_TAG) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(okean240_state, kbd_put)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( okean240, okean240t ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(okean240_io) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", okean240) - MCFG_DEVICE_REMOVE(TERMINAL_TAG) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(okean240_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( okean240 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "monitor.bin", 0xe000, 0x2000, CRC(587799bc) SHA1(1f677afa96722ca4ed2643eaca243548845fc854) ) - ROM_LOAD( "cpm80.bin", 0xc000, 0x2000, CRC(7378e4f9) SHA1(c3c06c6f2e953546452ca6f82140a79d0e4953b4) ) -ROM_END - -ROM_START( okean240a ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "fddmonitor.bin", 0xe000, 0x2000, CRC(bcac5ca0) SHA1(602ab824704d3d5d07b3787f6227ff903c33c9d5) ) - ROM_LOAD( "fddcpm80.bin", 0xc000, 0x2000, CRC(b89a7e16) SHA1(b8f937c04f430be18e48f296ed3ef37194171204) ) -ROM_END - -ROM_START( okean240t ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "test.bin", 0xe000, 0x0800, CRC(e9e2b7b9) SHA1(e4e0b6984a2514b6ba3e97500d487ea1a68b7577) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, okean240, 0, 0, okean240, okean240, okean240_state, okean240, "", "Okeah-240", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1986, okean240a, okean240,0, okean240a, okean240a, okean240_state, okean240, "", "Ocean-240 with fdd", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1986, okean240t, okean240,0, okean240t, okean240, okean240_state, okean240, "", "Ocean-240 Test Rom", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/ondra.c b/src/mess/drivers/ondra.c deleted file mode 100644 index 7631a89b702..00000000000 --- a/src/mess/drivers/ondra.c +++ /dev/null @@ -1,183 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Ondra driver by Miodrag Milanovic - - 08/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "includes/ondra.h" - -/* Address maps */ -static ADDRESS_MAP_START(ondra_mem, AS_PROGRAM, 8, ondra_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0xdfff) AM_RAMBANK("bank2") - AM_RANGE(0xe000, 0xffff) AM_RAMBANK("bank3") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ondra_io, AS_IO, 8, ondra_state ) - ADDRESS_MAP_GLOBAL_MASK(0x0b) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x03, 0x03) AM_WRITE(ondra_port_03_w) - //AM_RANGE(0x09, 0x09) AM_WRITE(ondra_port_09_w) - //AM_RANGE(0x0a, 0x0a) AM_WRITE(ondra_port_0a_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ondra ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0-9") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CS") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UpCase") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT)PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) - PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("NMI") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_ESC) -INPUT_PORTS_END - -INTERRUPT_GEN_MEMBER(ondra_state::ondra_interrupt) -{ - device.execute().set_input_line(0, HOLD_LINE); -} - -/* Machine driver */ -static MACHINE_CONFIG_START( ondra, ondra_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 2000000) - MCFG_CPU_PROGRAM_MAP(ondra_mem) - MCFG_CPU_IO_MAP(ondra_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", ondra_state, ondra_interrupt) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(320, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(ondra_state, screen_update_ondra) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("ondra_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","ondra") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( ondrat ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "tesla_a.rom", 0x10000, 0x0800, CRC(6d56b815) SHA1(7feb4071d5142e4c2f891747b75fa4d48ccad262) ) - ROM_COPY( "maincpu", 0x10000, 0x10800, 0x0800 ) - ROM_COPY( "maincpu", 0x10000, 0x11000, 0x0800 ) - ROM_COPY( "maincpu", 0x10000, 0x11800, 0x0800 ) - ROM_LOAD( "tesla_b.rom", 0x12000, 0x0800, CRC(5f145eaa) SHA1(c1eac68b13fedc4d0d6f98b15e2a5397f0139dc3) ) - ROM_COPY( "maincpu", 0x10000, 0x12800, 0x0800 ) - ROM_COPY( "maincpu", 0x10000, 0x13000, 0x0800 ) - ROM_COPY( "maincpu", 0x10000, 0x13800, 0x0800 ) -ROM_END - -ROM_START( ondrav ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "vili_a.rom", 0x10000, 0x0800, CRC(76932657) SHA1(1f3700f670f158e4bed256aed751e2c1331a28e8) ) - ROM_COPY( "maincpu", 0x10000, 0x10800, 0x0800 ) - ROM_COPY( "maincpu", 0x10000, 0x11000, 0x0800 ) - ROM_COPY( "maincpu", 0x10000, 0x11800, 0x0800 ) - ROM_LOAD( "vili_b.rom", 0x12000, 0x0800, CRC(03a6073f) SHA1(66f198e63f473e09350bcdbb10fe0cf440111bec) ) - ROM_COPY( "maincpu", 0x10000, 0x12800, 0x0800 ) - ROM_COPY( "maincpu", 0x10000, 0x13000, 0x0800 ) - ROM_COPY( "maincpu", 0x10000, 0x13800, 0x0800 ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, ondrat, 0, 0, ondra, ondra, driver_device, 0, "Tesla", "Ondra", 0) -COMP( 1989, ondrav, ondrat, 0, ondra, ondra, driver_device, 0, "ViLi", "Ondra ViLi", 0) diff --git a/src/mess/drivers/onyx.c b/src/mess/drivers/onyx.c deleted file mode 100644 index 85d02013975..00000000000 --- a/src/mess/drivers/onyx.c +++ /dev/null @@ -1,169 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*********************************************************************************************** - -Onyx C8002 - -2013-08-18 Skeleton Driver - -Copied from p8k.c - -The C8002 is one of the earliest minicomputers to use Unix as an operating system. - -The system consists of a main CPU (Z8002), and a slave CPU for Mass Storage control (Z80) - -The Z80 board contains a 19.6608 and 16 MHz crystals; 2x Z80CTC; 3x Z80SIO/0; Z80DMA; 3x Z80PIO; -2 eproms marked 459-3 and 460-3, plus 2 proms. - -The Z8002 board contains a 16 MHz crystal; 3x Z80CTC; 5x Z80SIO/0; 3x Z80PIO; 2 eproms marked -466-E and 467E, plus the remaining 7 small proms. - -The system can handle 8 RS232 terminals, 7 hard drives, a tape cartridge drive, parallel i/o, -and be connected to a RS422 network. - -*************************************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z8000/z8000.h" -//#include "cpu/z80/z80daisy.h" -//#include "machine/z80ctc.h" -//#include "machine/z80pio.h" -//#include "machine/z80dart.h" -//#include "machine/z80dma.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class onyx_state : public driver_device -{ -public: - onyx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_MACHINE_RESET(c8002); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(portff05_r); - -private: - UINT8 m_term_data; - required_device m_maincpu; - required_device m_terminal; -}; - - -READ8_MEMBER( onyx_state::portff05_r ) -{ - //return m_term_data; - - return 4; -} - -WRITE8_MEMBER( onyx_state::kbd_put ) -{ - m_term_data = data; -} - - -/* Input ports */ -static INPUT_PORTS_START( c8002 ) -INPUT_PORTS_END - - -MACHINE_RESET_MEMBER(onyx_state, c8002) -{ -} - -static ADDRESS_MAP_START(c8002_mem, AS_PROGRAM, 16, onyx_state) - AM_RANGE(0x00000, 0x00fff) AM_ROM AM_SHARE("share0") - AM_RANGE(0x01000, 0x07fff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2") -ADDRESS_MAP_END - -//static ADDRESS_MAP_START(c8002_data, AS_DATA, 16, onyx_state) -// AM_RANGE(0x00000, 0x00fff) AM_ROM AM_SHARE("share0") -// AM_RANGE(0x01000, 0x07fff) AM_RAM AM_SHARE("share1") -// AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2") -//ADDRESS_MAP_END - -static ADDRESS_MAP_START(c8002_io, AS_IO, 8, onyx_state) - AM_RANGE(0xff00, 0xff01) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0xff04, 0xff05) AM_READ(portff05_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(submem, AS_PROGRAM, 8, onyx_state) - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(subio, AS_IO, 8, onyx_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - - -/*************************************************************************** - - Machine Drivers - -****************************************************************************/ - -static MACHINE_CONFIG_START( c8002, onyx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z8002, XTAL_4MHz ) - //MCFG_CPU_CONFIG(main_daisy_chain) - MCFG_CPU_PROGRAM_MAP(c8002_mem) - //MCFG_CPU_DATA_MAP(c8002_data) - MCFG_CPU_IO_MAP(c8002_io) - - MCFG_CPU_ADD("subcpu", Z80, XTAL_4MHz ) - //MCFG_CPU_CONFIG(sub_daisy_chain) - MCFG_CPU_PROGRAM_MAP(submem) - MCFG_CPU_IO_MAP(subio) - MCFG_MACHINE_RESET_OVERRIDE(onyx_state, c8002) - - /* peripheral hardware */ - //MCFG_DEVICE_ADD("z80ctc_0", Z80CTC, XTAL_4MHz) - //MCFG_DEVICE_ADD("z80ctc_1", Z80CTC, XTAL_4MHz) - //MCFG_Z80SIO0_ADD("z80sio_0", 9600, 0, 0, 0, 0) - //MCFG_Z80SIO0_ADD("z80sio_1", 9600, 0, 0, 0, 0) - //MCFG_DEVICE_ADD("z80pio_0", Z80CTC, XTAL_4MHz) - //MCFG_DEVICE_ADD("z80pio_1", Z80CTC, XTAL_4MHz) - //MCFG_DEVICE_ADD("z80pio_2", Z80CTC, XTAL_4MHz) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(onyx_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( c8002 ) - ROM_REGION16_BE( 0x100000, "maincpu", 0 ) - ROM_LOAD16_BYTE("466-e", 0x0001, 0x0800, CRC(13534bcb) SHA1(976c76c69af40b0c0a5038e428a10b39a619a036)) - ROM_LOAD16_BYTE("467-e", 0x0000, 0x0800, CRC(0d5b557f) SHA1(0802bc6c2774f4e7de38a9c92e8558d710eed287)) - - ROM_REGION( 0x10000, "subcpu", 0 ) - ROM_LOAD("459-3", 0x0000, 0x0800, CRC(c8906653) SHA1(7dea9fffa974479ef5926df567261f2aaa7a3283)) - ROM_LOAD("460-3", 0x0800, 0x0800, CRC(ce6c0214) SHA1(f69ee4c6c0d1e72574a9cf828dbb3e08f06d029a)) - - ROM_REGION( 0x900, "proms", 0 ) - // for main cpu - ROM_LOAD("468-a", 0x000, 0x100, CRC(89781491) SHA1(f874d0cf42a733eb2b92b15647aeac7178d7b9b1)) - ROM_LOAD("469-a", 0x100, 0x100, CRC(45e439de) SHA1(4f1af44332ae709d92e919c9e48433f29df5e632)) - ROM_LOAD("470a-3", 0x200, 0x100, CRC(c50622a9) SHA1(deda0df93fc4e4b5f4be313e4bfe0c5fc669a024)) - ROM_LOAD("471-a", 0x300, 0x100, CRC(c09ca06b) SHA1(cb99172f5342427c68a109ee108a0c49b44e7010)) - ROM_LOAD("472-a", 0x400, 0x100, CRC(e1316fed) SHA1(41ed2d822c74da4e1ce06eb229629576e7f5035f)) - ROM_LOAD("473-a", 0x500, 0x100, CRC(5e8efd7f) SHA1(647064e0c3b0d795a333febc57228472b1b32345)) - ROM_LOAD("474-a", 0x600, 0x100, CRC(0052edfd) SHA1(b5d18c9a6adce7a6d627ece40a60aab8c55a6597)) - // for sub cpu - ROM_LOAD("453-a", 0x700, 0x100, CRC(7bc3871e) SHA1(6f75eb04911fa1ff66714276b8a88be62438a1b0)) - ROM_LOAD("454-a", 0x800, 0x100, CRC(aa2233cd) SHA1(4ec3a8c06cccda02f080e89831ecd8a9c96d3650)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, c8002, 0, 0, c8002, c8002, driver_device, 0, "Onyx", "C8002", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/orao.c b/src/mess/drivers/orao.c deleted file mode 100644 index 04090619ef8..00000000000 --- a/src/mess/drivers/orao.c +++ /dev/null @@ -1,215 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Orao driver by Miodrag Milanovic - - 01/03/2008 Updated to work with latest SVN code - 23/02/2008 Sound support added. - 22/02/2008 Preliminary driver. - - Driver is based on work of Josip Perusanec - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "includes/orao.h" -#include "imagedev/cassette.h" -#include "formats/orao_cas.h" - -/* Address maps */ -static ADDRESS_MAP_START(orao_mem, AS_PROGRAM, 8, orao_state ) - AM_RANGE( 0x0000, 0x5fff ) AM_RAM AM_SHARE("memory") - AM_RANGE( 0x6000, 0x7fff ) AM_RAM AM_SHARE("video_ram") // video ram - AM_RANGE( 0x8000, 0x9fff ) AM_READWRITE(orao_io_r, orao_io_w ) - AM_RANGE( 0xa000, 0xafff ) AM_RAM // extension - AM_RANGE( 0xb000, 0xbfff ) AM_RAM // DOS - AM_RANGE( 0xc000, 0xdfff ) AM_ROM - AM_RANGE( 0xe000, 0xffff ) AM_ROM -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( orao ) - PORT_START("LINE.0") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("LINE.1") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.2") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("LINE.3") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.4") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - - PORT_START("LINE.5") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.6") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE.7") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.8") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("LINE.9") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.10") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - - PORT_START("LINE.11") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.12") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - - PORT_START("LINE.13") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.14") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - - PORT_START("LINE.15") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.16") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ch") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cj") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Zh") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') - - PORT_START("LINE.17") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('^') PORT_CHAR('@') - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.18") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dj") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sh") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(';') PORT_CHAR('+') - - PORT_START("LINE.19") - PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/* Machine driver */ -static MACHINE_CONFIG_START( orao, orao_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 1000000) - MCFG_CPU_PROGRAM_MAP(orao_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(orao_state, screen_update_orao) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette") - MCFG_CASSETTE_FORMATS(orao_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("orao_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","orao") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( orao ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bas12.rom", 0xc000, 0x2000, CRC(42ae6f69) SHA1(b9d4a544fae13a9c492af027545178addd557111) ) - ROM_LOAD( "crt12.rom", 0xe000, 0x2000, CRC(94ebdc94) SHA1(3959d717f96558823ccc806c842d2fb5ab0c3890) ) -ROM_END - -ROM_START( orao103 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bas13.rom", 0xc000, 0x2000, CRC(35daf5da) SHA1(499c5a4bd930c26ec6226623c2793b4c7f771658) ) - ROM_LOAD( "crt13.rom", 0xe000, 0x2000, CRC(e7076014) SHA1(0e213287b0b520440af6a2a6297788a9356818c2) ) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, orao, 0, 0, orao, orao, orao_state, orao, "PEL Varazdin", "Orao 102", 0) -COMP( 1985, orao103, orao, 0, orao, orao, orao_state, orao103, "PEL Varazdin", "Orao 103", 0) diff --git a/src/mess/drivers/oric.c b/src/mess/drivers/oric.c deleted file mode 100644 index 5748b412c0b..00000000000 --- a/src/mess/drivers/oric.c +++ /dev/null @@ -1,951 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -/********************************************************************* - - drivers/oric.c - - Systems supported by this driver: - - Oric 1, - Oric Atmos, - Oric Telestrat, - Pravetz 8D - - Pravetz is a Bulgarian copy of the Oric Atmos and uses - Apple 2 disc drives for storage. - - This driver originally by Paul Cook, rewritten by Kevin Thacker, - re-rewritten by Olivier Galibert. - -*********************************************************************/ - -#include "emu.h" -#include "bus/oricext/oricext.h" -#include "cpu/m6502/m6502.h" -#include "sound/ay8910.h" -#include "sound/wave.h" -#include "machine/6522via.h" -#include "machine/mos6551.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/floppy.h" -#include "imagedev/cassette.h" -#include "machine/wd_fdc.h" -#include "formats/oric_dsk.h" -#include "formats/oric_tap.h" - -class oric_state : public driver_device -{ -public: - // Permanent attributes (kept from one line to the other) and line - // attributes (reset at start of line) - enum { - PATTR_50HZ = 0x02, - PATTR_HIRES = 0x04, - LATTR_ALT = 0x01, - LATTR_DSIZE = 0x02, - LATTR_BLINK = 0x04 - }; - - oric_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette"), - m_psg(*this, "ay8912"), - m_centronics(*this, "centronics"), - m_cent_data_out(*this, "cent_data_out"), - m_cassette(*this, "cassette"), - m_via(*this, "via6522"), - m_ram(*this, "ram"), - m_rom(*this, "maincpu"), - m_bank_c000_r(*this, "bank_c000_r"), - m_bank_e000_r(*this, "bank_e000_r"), - m_bank_f800_r(*this, "bank_f800_r"), - m_bank_c000_w(*this, "bank_c000_w"), - m_bank_e000_w(*this, "bank_e000_w"), - m_bank_f800_w(*this, "bank_f800_w"), - m_config(*this, "CONFIG") { } - - DECLARE_INPUT_CHANGED_MEMBER(nmi_pressed); - DECLARE_WRITE8_MEMBER(via_a_w); - DECLARE_WRITE8_MEMBER(via_b_w); - DECLARE_WRITE_LINE_MEMBER(via_ca2_w); - DECLARE_WRITE_LINE_MEMBER(via_cb2_w); - DECLARE_WRITE_LINE_MEMBER(via_irq_w); - DECLARE_WRITE_LINE_MEMBER(ext_irq_w); - DECLARE_WRITE8_MEMBER(psg_a_w); - TIMER_DEVICE_CALLBACK_MEMBER(update_tape); - - virtual void machine_start(); - virtual void video_start(); - UINT32 screen_update_oric(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void vblank_w(screen_device &screen, bool state); - -protected: - required_device m_maincpu; - required_device m_palette; - required_device m_psg; - required_device m_centronics; - required_device m_cent_data_out; - required_device m_cassette; - required_device m_via; - required_shared_ptr m_ram; - optional_memory_region m_rom; - required_memory_bank m_bank_c000_r; - optional_memory_bank m_bank_e000_r; - optional_memory_bank m_bank_f800_r; - required_memory_bank m_bank_c000_w; - optional_memory_bank m_bank_e000_w; - optional_memory_bank m_bank_f800_w; - required_ioport m_config; - ioport_port *m_kbd_row[8]; - - int m_blink_counter; - UINT8 m_pattr; - UINT8 m_via_a, m_via_b, m_psg_a; - bool m_via_ca2, m_via_cb2, m_via_irq; - bool m_ext_irq; - - virtual void update_irq(); - void update_psg(address_space &space); - void update_keyboard(); - void machine_start_common(); -}; - -class telestrat_state : public oric_state -{ -public: - telestrat_state(const machine_config &mconfig, device_type type, const char *tag) : - oric_state(mconfig, type, tag), - m_via2(*this, "via6522_2"), - m_fdc(*this, "fdc"), - m_telmatic(*this, "telmatic"), - m_teleass(*this, "teleass"), - m_hyperbas(*this, "hyperbas"), - m_telmon24(*this, "telmon24"), - m_joy1(*this, "JOY1"), - m_joy2(*this, "JOY2") - { } - - DECLARE_WRITE8_MEMBER(via2_a_w); - DECLARE_WRITE8_MEMBER(via2_b_w); - DECLARE_WRITE_LINE_MEMBER(via2_ca2_w); - DECLARE_WRITE_LINE_MEMBER(via2_cb2_w); - DECLARE_WRITE_LINE_MEMBER(via2_irq_w); - DECLARE_WRITE8_MEMBER(port_314_w); - DECLARE_READ8_MEMBER(port_314_r); - DECLARE_READ8_MEMBER(port_318_r); - - DECLARE_WRITE_LINE_MEMBER(acia_irq_w); - - DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_hld_w); - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - virtual void machine_start(); - virtual void machine_reset(); - -protected: - enum { - P_IRQEN = 0x01, - P_DDS = 0x04, - P_DDEN = 0x08, - P_SS = 0x10, - P_DRIVE = 0x60 - }; - - required_device m_via2; - required_device m_fdc; - required_memory_region m_telmatic; - required_memory_region m_teleass; - required_memory_region m_hyperbas; - required_memory_region m_telmon24; - required_ioport m_joy1; - required_ioport m_joy2; - - floppy_image_device *m_floppies[4]; - UINT8 m_port_314; - UINT8 m_via2_a, m_via2_b; - bool m_via2_ca2, m_via2_cb2, m_via2_irq; - bool m_acia_irq; - bool m_fdc_irq, m_fdc_drq, m_fdc_hld; - - UINT8 m_junk_read[0x4000], m_junk_write[0x4000]; - - virtual void update_irq(); - void remap(); -}; - -/* Ram is 64K, with 16K hidden by the rom. The 300-3ff is also hidden by the i/o */ -static ADDRESS_MAP_START(oric_mem, AS_PROGRAM, 8, oric_state ) - AM_RANGE( 0x0300, 0x030f) AM_DEVREADWRITE("via6522", via6522_device, read, write) AM_MIRROR(0xf0) - AM_RANGE( 0xc000, 0xdfff) AM_READ_BANK("bank_c000_r") AM_WRITE_BANK("bank_c000_w") - AM_RANGE( 0xe000, 0xf7ff) AM_READ_BANK("bank_e000_r") AM_WRITE_BANK("bank_e000_w") - AM_RANGE( 0xf800, 0xffff) AM_READ_BANK("bank_f800_r") AM_WRITE_BANK("bank_f800_w") - AM_RANGE( 0x0000, 0xffff) AM_RAM AM_SHARE("ram") -ADDRESS_MAP_END - -/* -The telestrat has the memory regions split into 16k blocks. -Memory region &c000-&ffff can be ram or rom. */ -static ADDRESS_MAP_START(telestrat_mem, AS_PROGRAM, 8, telestrat_state ) - AM_RANGE( 0x0300, 0x030f) AM_DEVREADWRITE("via6522", via6522_device, read, write) - AM_RANGE( 0x0310, 0x0313) AM_DEVREADWRITE("fdc", fd1793_t, read, write) - AM_RANGE( 0x0314, 0x0314) AM_READWRITE(port_314_r, port_314_w) - AM_RANGE( 0x0318, 0x0318) AM_READ(port_318_r) - AM_RANGE( 0x031c, 0x031f) AM_DEVREADWRITE("acia", mos6551_device, read, write) - AM_RANGE( 0x0320, 0x032f) AM_DEVREADWRITE("via6522_2", via6522_device, read, write) - AM_RANGE( 0xc000, 0xffff) AM_READ_BANK("bank_c000_r") AM_WRITE_BANK("bank_c000_w") - AM_RANGE( 0x0000, 0xffff) AM_RAM AM_SHARE("ram") -ADDRESS_MAP_END - -UINT32 oric_state::screen_update_oric(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - bool blink_state = m_blink_counter & 0x20; - m_blink_counter = (m_blink_counter + 1) & 0x3f; - - UINT8 pattr = m_pattr; - - for(int y=0; y<224; y++) { - // Line attributes and current colors - UINT8 lattr = 0; - UINT32 fgcol = m_palette->pen_color(7); - UINT32 bgcol = m_palette->pen_color(0); - - UINT32 *p = &bitmap.pix32(y); - - for(int x=0; x<40; x++) { - // Lookup the byte and, if needed, the pattern data - UINT8 ch, pat; - if((pattr & PATTR_HIRES) && y < 200) - ch = pat = m_ram[0xa000 + y*40 + x]; - - else { - ch = m_ram[0xbb80 + (y>>3)*40 + x]; - int off = (lattr & LATTR_DSIZE ? y >> 1 : y ) & 7; - const UINT8 *base; - if(pattr & PATTR_HIRES) - if(lattr & LATTR_ALT) - base = m_ram + 0x9c00; - else - base = m_ram + 0x9800; - else - if(lattr & LATTR_ALT) - base = m_ram + 0xb800; - else - base = m_ram + 0xb400; - pat = base[((ch & 0x7f) << 3) | off]; - } - - // Handle state-chaging attributes - if(!(ch & 0x60)) { - pat = 0x00; - switch(ch & 0x18) { - case 0x00: fgcol = m_palette->pen_color(ch & 7); break; - case 0x08: lattr = ch & 7; break; - case 0x10: bgcol = m_palette->pen_color(ch & 7); break; - case 0x18: pattr = ch & 7; break; - } - } - - // Pick up the colors for the pattern - UINT32 c_fgcol = fgcol; - UINT32 c_bgcol = bgcol; - - // inverse video - if(ch & 0x80) { - c_bgcol = c_bgcol ^ 0xffffff; - c_fgcol = c_fgcol ^ 0xffffff; - } - // blink - if((lattr & LATTR_BLINK) && blink_state) - c_fgcol = c_bgcol; - - // Draw the pattern - *p++ = pat & 0x20 ? c_fgcol : c_bgcol; - *p++ = pat & 0x10 ? c_fgcol : c_bgcol; - *p++ = pat & 0x08 ? c_fgcol : c_bgcol; - *p++ = pat & 0x04 ? c_fgcol : c_bgcol; - *p++ = pat & 0x02 ? c_fgcol : c_bgcol; - *p++ = pat & 0x01 ? c_fgcol : c_bgcol; - } - } - - m_pattr = pattr; - - return 0; -} - -void oric_state::update_keyboard() -{ - m_via->write_pb3((m_kbd_row[m_via_b & 7]->read() | m_psg_a) != 0xff); -} - -void oric_state::update_psg(address_space &space) -{ - if(m_via_ca2) - if(m_via_cb2) - m_psg->address_w(space, 0, m_via_a); - else - m_via->write_pa(space, 0, m_psg->data_r(space, 0)); - else if(m_via_cb2) - m_psg->data_w(space, 0, m_via_a); -} - -void oric_state::update_irq() -{ - m_maincpu->set_input_line(m6502_device::IRQ_LINE, m_via_irq || m_ext_irq ? ASSERT_LINE : CLEAR_LINE); -} - -INPUT_CHANGED_MEMBER(oric_state::nmi_pressed) -{ - m_maincpu->set_input_line(m6502_device::NMI_LINE, newval ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE8_MEMBER(oric_state::via_a_w) -{ - m_via_a = data; - m_cent_data_out->write(space, 0, m_via_a); - update_psg(space); -} - -WRITE8_MEMBER(oric_state::via_b_w) -{ - m_via_b = data; - update_keyboard(); - m_centronics->write_strobe(data & 0x10 ? 1 : 0); - m_cassette->change_state(data & 0x40 ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, - CASSETTE_MOTOR_DISABLED); - m_cassette->output(data & 0x80 ? -1.0 : +1.0); -} - -WRITE_LINE_MEMBER(oric_state::via_ca2_w) -{ - m_via_ca2 = state; - update_psg(m_maincpu->space(AS_PROGRAM)); -} - -WRITE_LINE_MEMBER(oric_state::via_cb2_w) -{ - m_via_cb2 = state; - update_psg(m_maincpu->space(AS_PROGRAM)); -} - -WRITE_LINE_MEMBER(oric_state::via_irq_w) -{ - m_via_irq = state; - update_irq(); -} - -WRITE_LINE_MEMBER(oric_state::ext_irq_w) -{ - m_ext_irq = state; - update_irq(); -} - -WRITE8_MEMBER(oric_state::psg_a_w) -{ - m_psg_a = data; - update_keyboard(); -} - -TIMER_DEVICE_CALLBACK_MEMBER(oric_state::update_tape) -{ - if(!m_config->read()) - m_via->write_cb1(m_cassette->input() > 0.0038); -} - -void oric_state::vblank_w(screen_device &screen, bool state) -{ - if(m_config->read()) - m_via->write_cb1(state); -} - -void oric_state::video_start() -{ - m_blink_counter = 0; - m_pattr = 0; -} - -void oric_state::machine_start_common() -{ - m_via_a = 0xff; - m_via_b = 0xff; - m_psg_a = 0x00; - m_via_ca2 = false; - m_via_cb2 = false; - m_via_irq = false; - m_ext_irq = false; - - for(int i=0; i<8; i++) { - char name[10]; - sprintf(name, "ROW%d", i); - m_kbd_row[i] = machine().root_device().ioport(name); - } -} - -void oric_state::machine_start() -{ - machine_start_common(); - m_bank_c000_r->set_base(m_rom->base()); - m_bank_e000_r->set_base(m_rom->base() + 0x2000); - m_bank_f800_r->set_base(m_rom->base() + 0x3800); -} - - -void telestrat_state::machine_start() -{ - machine_start_common(); - for(int i=0; i<4; i++) { - char name[32]; - sprintf(name, "fdc:%d", i); - m_floppies[i] = subdevice(name)->get_device(); - } - m_fdc_irq = m_fdc_drq = m_fdc_hld = false; - m_acia_irq = false; - - memset(m_junk_read, 0x00, sizeof(m_junk_read)); - memset(m_junk_write, 0x00, sizeof(m_junk_write)); -} - -void telestrat_state::machine_reset() -{ - m_port_314 = 0x00; - m_via2_a = 0xff; - remap(); -} - -void telestrat_state::update_irq() -{ - m_maincpu->set_input_line(m6502_device::IRQ_LINE, - m_via_irq || - m_ext_irq || - (m_fdc_irq && (m_port_314 & P_IRQEN)) || - m_via2_irq || - m_acia_irq ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE8_MEMBER(telestrat_state::via2_a_w) -{ - m_via2_a = data; - remap(); -} - -WRITE8_MEMBER(telestrat_state::via2_b_w) -{ - m_via2_b = data; - UINT8 port = 0xff; - if(!(m_via2_b & 0x40)) - port &= m_joy1->read(); - if(!(m_via2_b & 0x80)) - port &= m_joy2->read(); - - m_via2->write_pb(space, 0, port); -} - -WRITE_LINE_MEMBER(telestrat_state::via2_ca2_w) -{ - m_via2_ca2 = state; -} - -WRITE_LINE_MEMBER(telestrat_state::via2_cb2_w) -{ - m_via2_cb2 = state; -} - -WRITE_LINE_MEMBER(telestrat_state::via2_irq_w) -{ - m_via2_irq = state; - update_irq(); -} - -WRITE8_MEMBER(telestrat_state::port_314_w) -{ - m_port_314 = data; - floppy_image_device *floppy = m_floppies[(m_port_314 >> 5) & 3]; - m_fdc->set_floppy(floppy); - m_fdc->dden_w(m_port_314 & P_DDEN); - if(floppy) { - floppy->ss_w(m_port_314 & P_SS ? 1 : 0); - floppy->mon_w(0); - } - update_irq(); -} - -READ8_MEMBER(telestrat_state::port_314_r) -{ - return (m_fdc_irq && (m_port_314 & P_IRQEN)) ? 0x7f : 0xff; -} - -READ8_MEMBER(telestrat_state::port_318_r) -{ - return m_fdc_drq ? 0x7f : 0xff; -} - - -WRITE_LINE_MEMBER(telestrat_state::acia_irq_w) -{ - m_acia_irq = state; - update_irq(); -} - -WRITE_LINE_MEMBER(telestrat_state::fdc_irq_w) -{ - m_fdc_irq = state; - update_irq(); -} - -WRITE_LINE_MEMBER(telestrat_state::fdc_drq_w) -{ - m_fdc_drq = state; -} - -WRITE_LINE_MEMBER(telestrat_state::fdc_hld_w) -{ - m_fdc_hld = state; -} - -void telestrat_state::remap() -{ - // Theorically, these are cartridges. There's no real point to - // making them configurable, when only 4 existed and there are 7 - // slots. - - switch(m_via2_a & 7) { - case 0: - m_bank_c000_r->set_base(m_ram+0xc000); - m_bank_c000_w->set_base(m_ram+0xc000); - break; - case 1: - case 2: - case 3: - m_bank_c000_r->set_base(m_junk_read); - m_bank_c000_w->set_base(m_junk_write); - break; - case 4: - m_bank_c000_r->set_base(m_telmatic->base()); - m_bank_c000_w->set_base(m_junk_write); - break; - case 5: - m_bank_c000_r->set_base(m_teleass->base()); - m_bank_c000_w->set_base(m_junk_write); - break; - case 6: - m_bank_c000_r->set_base(m_hyperbas->base()); - m_bank_c000_w->set_base(m_junk_write); - break; - case 7: - m_bank_c000_r->set_base(m_telmon24->base()); - m_bank_c000_w->set_base(m_junk_write); - break; - } -} - - - -static INPUT_PORTS_START(oric) - PORT_START("ROW0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - - PORT_START("ROW1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START("ROW2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("ROW3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('\xA3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("ROW4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("ROW5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - - PORT_START("ROW6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - - PORT_START("ROW7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - - PORT_START("NMI") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NMI") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHANGED_MEMBER(DEVICE_SELF, oric_state, nmi_pressed, 0) - - /* vsync cable hardware. This is a simple cable connected to the video output - to the monitor/television. The sync signal is connected to the cassette input - allowing interrupts to be generated from the vsync signal. */ - PORT_START("CONFIG") - PORT_CONFNAME(0x01, 0x00, "Tape input") - PORT_CONFSETTING( 0x00, "Tape") - PORT_CONFSETTING( 0x01, "VSync cable") -INPUT_PORTS_END - -static INPUT_PORTS_START(orica) - PORT_INCLUDE( oric ) - - PORT_MODIFY("ROW5") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Funct") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) -INPUT_PORTS_END - -static INPUT_PORTS_START(prav8d) - PORT_START("ROW0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X \xd0\xac") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V \xd0\x96") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N \xd0\x9d") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("ROW1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D \xd0\x94") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q \xd0\xaf") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F \xd0\xa4") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R \xd0\xa0") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T \xd0\xa2") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J \xd0\x99") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - - PORT_START("ROW2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C \xd0\xa6") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z \xd0\x97") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MK") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B \xd0\x91") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M \xd0\x9c") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - - PORT_START("ROW3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] \xd0\xa9") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C/L") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // this one is 5th line, 1st key from right - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ \xd0\xa8") PORT_CODE(KEYCODE_COLON) PORT_CHAR('[') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K \xd0\x9a") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - - PORT_START("ROW4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("ROW5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xd0\xae") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ \xd0\xad") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // this one is 5th line, 1st key from left - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P \xd0\x9f") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O \xd0\x9e") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I \xd0\x98") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U \xd0\xa3") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - - PORT_START("ROW6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W \xd0\x92") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S \xd0\xa1") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A \xd0\x90") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E \xd0\x95") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G \xd0\x93") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H \xd0\xa5") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y \xd0\xaa") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - - PORT_START("ROW7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ \xd0\xa7") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('^') // this one would be on 2nd line, 3rd key from 'P' - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L \xd0\x9b") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("NMI") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NMI") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHANGED_MEMBER(DEVICE_SELF, oric_state, nmi_pressed, 0) - - /* vsync cable hardware. This is a simple cable connected to the video output - to the monitor/television. The sync signal is connected to the cassette input - allowing interrupts to be generated from the vsync signal. */ - PORT_START("CONFIG") - PORT_CONFNAME(0x01, 0x00, "Tape input") - PORT_CONFSETTING( 0x00, "Tape") - PORT_CONFSETTING( 0x01, "VSync cable") -INPUT_PORTS_END - -static INPUT_PORTS_START(telstrat) - PORT_INCLUDE( orica ) - -// The telestrat does not have the NMI button - PORT_MODIFY("NMI") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("JOY1") /* left joystick port */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(1) - - PORT_START("JOY2") /* right joystick port */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(2) -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( oric, oric_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, XTAL_12MHz/12) - MCFG_CPU_PROGRAM_MAP(oric_mem) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(40*6, 28*8) - MCFG_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 28*8-1) - MCFG_SCREEN_UPDATE_DRIVER(oric_state, screen_update_oric) - MCFG_SCREEN_VBLANK_DRIVER(oric_state, vblank_w) - - MCFG_PALETTE_ADD_3BIT_RGB("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8912", AY8912, XTAL_12MHz/12) - MCFG_AY8910_OUTPUT_TYPE(AY8910_DISCRETE_OUTPUT) - MCFG_AY8910_RES_LOADS(4700, 4700, 4700) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(oric_state, psg_a_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522", via6522_device, write_ca1)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(oric_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("tape_timer", oric_state, update_tape, attotime::from_hz(4800)) - - /* via */ - MCFG_DEVICE_ADD( "via6522", VIA6522, XTAL_12MHz/12 ) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(oric_state, via_a_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(oric_state, via_b_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(oric_state, via_ca2_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(oric_state, via_cb2_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(oric_state, via_irq_w)) - - /* extension port */ - MCFG_ORICEXT_ADD( "ext", oricext_intf, NULL, "maincpu", WRITELINE(oric_state, ext_irq_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( prav8d, oric ) -MACHINE_CONFIG_END - -FLOPPY_FORMATS_MEMBER( telestrat_state::floppy_formats ) - FLOPPY_ORIC_DSK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( telestrat_floppies ) - SLOT_INTERFACE( "3dsdd", FLOPPY_3_DSDD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_DERIVED_CLASS( telstrat, oric, telestrat_state ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(telestrat_mem) - - /* acia */ - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(telestrat_state, acia_irq_w)) - - /* via */ - MCFG_DEVICE_ADD( "via6522_2", VIA6522, XTAL_12MHz/12 ) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(telestrat_state, via2_a_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(telestrat_state, via2_b_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(telestrat_state, via2_ca2_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(telestrat_state, via2_cb2_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(telestrat_state, via2_irq_w)) - - /* microdisc */ - MCFG_FD1793_ADD("fdc", XTAL_8MHz/8) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(telestrat_state, fdc_irq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(telestrat_state, fdc_drq_w)) - MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(telestrat_state, fdc_hld_w)) - MCFG_WD_FDC_FORCE_READY - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", telestrat_floppies, "3dsdd", telestrat_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", telestrat_floppies, NULL, telestrat_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", telestrat_floppies, NULL, telestrat_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", telestrat_floppies, NULL, telestrat_state::floppy_formats) -MACHINE_CONFIG_END - - -ROM_START(oric1) - ROM_REGION(0x4000, "maincpu", 0) - ROM_LOAD ("basic10.rom", 0, 0x04000, CRC(f18710b4) SHA1(333116e6884d85aaa4dfc7578a91cceeea66d016)) -ROM_END - -ROM_START(orica) - ROM_REGION(0x4000, "maincpu", 0) - ROM_SYSTEM_BIOS( 0, "ver11", "Basic 1.1") - ROMX_LOAD ("basic11b.rom", 0, 0x04000, CRC(c3a92bef) SHA1(9451a1a09d8f75944dbd6f91193fc360f1de80ac), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "ver12", "Basic 1.2 (Pascal Leclerc)") // 1987/1999 - various enhancements and bugfixes - ROMX_LOAD ("basic12.rom", 0, 0x04000, CRC(dc4f22dc) SHA1(845e1a893de3dc0f856fdf2f69c3b73770b4094f), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "ver121", "Basic 1.21 (Pascal Leclerc)") // 07.1999 - DRAW enhancement - ROMX_LOAD ("basic121.rom", 0, 0x04000, CRC(0a2860b1) SHA1(b727d5c3bbc8cb1d510f224eb1e0d90d609e8506), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "ver122", "Basic 1.22 (Pascal Leclerc)") // 08.2001 - added EUR symbol - ROMX_LOAD ("basic122.rom", 0, 0x04000, CRC(5ef2a861) SHA1(9ab6dc47b6e9dc65a4137ce0f0f12fc2b6ca8442), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "ver11de", "Basic 1.1 DE") - ROMX_LOAD( "bas11_de.rom", 0, 0x04000, CRC(65233b2d) SHA1(b01cabb1a21980a6785a2fe37a8f8572c892123f), ROM_BIOS(5)) - ROM_SYSTEM_BIOS( 5, "ver11es", "Basic 1.1 ES") - ROMX_LOAD( "bas11_es.rom", 0, 0x04000, CRC(47bf26c7) SHA1(4fdbadd68db9ab8ad1cd56b4e5cbe51a9c3f11ae), ROM_BIOS(6)) - ROM_SYSTEM_BIOS( 6, "ver11fr", "Basic 1.1 FR") - ROMX_LOAD( "bas11_fr.rom", 0, 0x04000, CRC(603b1fbf) SHA1(2a4583df3b59ca454d67d5631f242c96ec4cf99a), ROM_BIOS(7)) - ROM_SYSTEM_BIOS( 7, "ver11se", "Basic 1.1 SE") - ROMX_LOAD( "bas11_se.rom", 0, 0x04000, CRC(a71523ac) SHA1(ce53acf84baec6ab5cbac9f9cefa71b3efeb2ead), ROM_BIOS(8)) - ROM_SYSTEM_BIOS( 8, "ver11uk", "Basic 1.1 UK") - ROMX_LOAD( "bas11_uk.rom", 0, 0x04000, CRC(303370d1) SHA1(589ff66fac8e06d65af3369491faa67a71f1322a), ROM_BIOS(9)) - ROM_SYSTEM_BIOS( 9, "ver12es", "Basic 1.2 ES") - ROMX_LOAD( "bas12es_le.rom", 0, 0x04000, CRC(70de4aeb) SHA1(b327418aa7d8a5a03c135e3d8acdd511df625893), ROM_BIOS(10)) - ROM_SYSTEM_BIOS( 10, "ver12fr", "Basic 1.2 FR") - ROMX_LOAD( "bas12fr_le.rom", 0, 0x04000, CRC(47a437fc) SHA1(70271bc3ed5c3bf4d339d6f5de3de8c3c50ff573), ROM_BIOS(11)) - ROM_SYSTEM_BIOS( 11, "ver12ge", "Basic 1.2 GE") - ROMX_LOAD( "bas12ge_le.rom", 0, 0x04000, CRC(f5f0dd52) SHA1(75359302452ee7b19537698f124aaefd333688d0), ROM_BIOS(12)) - ROM_SYSTEM_BIOS( 12, "ver12sw", "Basic 1.2 SW") - ROMX_LOAD( "bas12sw_le.rom", 0, 0x04000, CRC(100abe68) SHA1(6211d5969c4d7a6acb86ed19c5e51a33a3bef431), ROM_BIOS(13)) - ROM_SYSTEM_BIOS( 13, "ver12uk", "Basic 1.2 UK") - ROMX_LOAD( "bas12uk_le.rom", 0, 0x04000, CRC(00fce8a6) SHA1(d40558bdf61b8aba6260293c9424fd463be7fad8), ROM_BIOS(14)) - ROM_SYSTEM_BIOS( 14, "ver121es", "Basic 1.211 ES") - ROMX_LOAD( "bas121es_le.rom", 0, 0x04000, CRC(87ec679b) SHA1(5de6a5f5121f69069c9b93d678046e814b5b64e9), ROM_BIOS(15)) - ROM_SYSTEM_BIOS( 15, "ver121fr", "Basic 1.211 FR") - ROMX_LOAD( "bas121fr_le.rom", 0, 0x04000, CRC(e683dec2) SHA1(20df7ebc0f13aa835f286d50137f1a7ff7430c29), ROM_BIOS(16)) - ROM_SYSTEM_BIOS( 16, "ver121ge", "Basic 1.211 GE") - ROMX_LOAD( "bas121ge_le.rom", 0, 0x04000, CRC(94fe32bf) SHA1(1024776d20030d602e432e50014502524658643a), ROM_BIOS(17)) - ROM_SYSTEM_BIOS( 17, "ver121sw", "Basic 1.211 SW") - ROMX_LOAD( "bas121sw_le.rom", 0, 0x04000, CRC(e6ad11c7) SHA1(309c94a9861fcb770636dcde1801a5c68ca819b4), ROM_BIOS(18)) - ROM_SYSTEM_BIOS( 18, "ver121uk", "Basic 1.211 UK") - ROMX_LOAD( "bas121uk_le.rom", 0, 0x04000, CRC(75aa1aa9) SHA1(ca99e244d9cbef625344c2054023504a4f9dcfe4), ROM_BIOS(19)) - ROM_SYSTEM_BIOS( 19, "ver122es", "Basic 1.22 ES") - ROMX_LOAD( "bas122es_le.rom", 0, 0x04000, CRC(9144f9e0) SHA1(acf2094078af057e74a31d90d7010be51b9033fa), ROM_BIOS(20)) - ROM_SYSTEM_BIOS( 20, "ver122fr", "Basic 1.22 FR") - ROMX_LOAD( "bas122fr_le.rom", 0, 0x04000, CRC(370cfda4) SHA1(fad9a0661256e59bcc2915578647573e4128e1bb), ROM_BIOS(21)) - ROM_SYSTEM_BIOS( 21, "ver122ge", "Basic 1.22 GE") - ROMX_LOAD( "bas122ge_le.rom", 0, 0x04000, CRC(9a42bd62) SHA1(8a9c80f314daf4e5e64fa202e583b8a65796db8b), ROM_BIOS(22)) - ROM_SYSTEM_BIOS( 22, "ver122sw", "Basic 1.22 SW") - ROMX_LOAD( "bas122sw_le.rom", 0, 0x04000, CRC(e7fd57a4) SHA1(c75cbf7cfafaa02712dc7ca2f972220aef86fb8d), ROM_BIOS(23)) - ROM_SYSTEM_BIOS( 23, "ver122uk", "Basic 1.22 UK") - ROMX_LOAD( "bas122uk_le.rom", 0, 0x04000, CRC(9865bcd7) SHA1(2a92e2d119463e682bf10647e3880e26656d65b5), ROM_BIOS(24)) -ROM_END - -ROM_START(telstrat) - ROM_REGION(0x4000, "telmatic", 0) - ROM_LOAD ("telmatic.rom", 0, 0x2000, CRC(94358dc6) SHA1(35f92a0477a88f5cf564971125047ffcfa02ec10) ) - ROM_RELOAD (0x2000, 0x2000) - - ROM_REGION(0x4000, "teleass", 0) - ROM_LOAD ("teleass.rom", 0, 0x4000, CRC(68b0fde6) SHA1(9e9af51dae3199cccf49ab3f0d47e2b9be4ba97d) ) - - ROM_REGION(0x4000, "hyperbas", 0) - ROM_LOAD ("hyperbas.rom", 0, 0x4000, CRC(1d96ab50) SHA1(f5f70a0eb59f8cd6c261e179ae78ef906f68ed63) ) - - ROM_REGION(0x4000, "telmon24", 0) - ROM_LOAD ("telmon24.rom", 0, 0x4000, CRC(aa727c5d) SHA1(86fc8dc0932f983efa199e31ae05a4424772f959) ) -ROM_END - -ROM_START(prav8d) - ROM_REGION(0x4000, "maincpu", 0) /* 0x10000 + 0x04000 + 0x00100 + 0x00200 */ - ROM_LOAD( "pravetzt.rom", 0, 0x4000, CRC(58079502) SHA1(7afc276cb118adff72e4f16698f94bf3b2c64146) ) -// ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) ) -// ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) ) -ROM_END - -ROM_START(prav8dd) - ROM_REGION(0x4000, "maincpu", 0) /* 0x10000 + 0x04000 + 0x00100 + 0x00200 */ - ROM_SYSTEM_BIOS( 0, "default", "Disk ROM, 1989") - ROMX_LOAD( "8d.rom", 0, 0x4000, CRC(b48973ef) SHA1(fd47c977fc215a3b577596a7483df53e8a1e9c83), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "radosoft", "RadoSoft Disk ROM, 1992") - ROMX_LOAD( "pravetzd.rom", 0, 0x4000, CRC(f8d23821) SHA1(f87ad3c5832773b6e0614905552a80c98dc8e2a5), ROM_BIOS(2) ) -// ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) ) -// ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1983, oric1, 0, 0, oric, oric, driver_device, 0, "Tangerine", "Oric 1" , 0) -COMP( 1984, orica, oric1, 0, oric, orica, driver_device, 0, "Tangerine", "Oric Atmos" , 0) -COMP( 1985, prav8d, oric1, 0, prav8d, prav8d, driver_device, 0, "Pravetz", "Pravetz 8D", 0) -COMP( 1989, prav8dd, oric1, 0, prav8d, prav8d, driver_device, 0, "Pravetz", "Pravetz 8D (Disk ROM)", MACHINE_UNOFFICIAL) -COMP( 1986, telstrat, oric1, 0, telstrat, telstrat, driver_device, 0, "Tangerine", "Oric Telestrat", 0 ) diff --git a/src/mess/drivers/orion.c b/src/mess/drivers/orion.c deleted file mode 100644 index ac3d9ab8430..00000000000 --- a/src/mess/drivers/orion.c +++ /dev/null @@ -1,372 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Orion driver by Miodrag Milanovic - - 22/04/2008 Orion Pro added - 02/04/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/orion.h" -#include "imagedev/cassette.h" -#include "formats/smx_dsk.h" -#include "formats/rk_cas.h" - -/* Address maps */ - -/* Orion 128 */ -static ADDRESS_MAP_START(orion128_mem, AS_PROGRAM, 8, orion_state ) - AM_RANGE( 0x0000, 0xefff ) AM_RAMBANK("bank1") - AM_RANGE( 0xf000, 0xf3ff ) AM_RAMBANK("bank2") - AM_RANGE( 0xf400, 0xf4ff ) AM_READWRITE(orion128_system_r,orion128_system_w) // Keyboard and cassette - AM_RANGE( 0xf500, 0xf5ff ) AM_READWRITE(orion128_romdisk_r,orion128_romdisk_w) - AM_RANGE( 0xf700, 0xf7ff ) AM_READWRITE(orion128_floppy_r,orion128_floppy_w) - AM_RANGE( 0xf800, 0xffff ) AM_ROM - AM_RANGE( 0xf800, 0xf8ff ) AM_WRITE(orion128_video_mode_w) - AM_RANGE( 0xf900, 0xf9ff ) AM_WRITE(orion128_memory_page_w) - AM_RANGE( 0xfa00, 0xfaff ) AM_WRITE(orion128_video_page_w) -ADDRESS_MAP_END - -/* Orion Z80 Card II */ -static ADDRESS_MAP_START( orion128_io , AS_IO, 8, orion_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0xf8, 0xf8) AM_WRITE(orion128_video_mode_w ) - AM_RANGE( 0xf9, 0xf9) AM_WRITE(orion128_memory_page_w ) - AM_RANGE( 0xfa, 0xfa) AM_WRITE(orion128_video_page_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(orionz80_mem, AS_PROGRAM, 8, orion_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x4000, 0xefff ) AM_RAMBANK("bank2") - AM_RANGE( 0xf000, 0xf3ff ) AM_RAMBANK("bank3") - AM_RANGE( 0xf400, 0xf7ff ) AM_RAMBANK("bank4") - AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank5") -ADDRESS_MAP_END - -/* Orion Pro */ -static ADDRESS_MAP_START( orionz80_io , AS_IO, 8, orion_state ) - AM_RANGE( 0x0000, 0xffff) AM_READWRITE(orionz80_io_r, orionz80_io_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(orionpro_mem, AS_PROGRAM, 8, orion_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x1fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x2000, 0x3fff ) AM_RAMBANK("bank2") - AM_RANGE( 0x4000, 0x7fff ) AM_RAMBANK("bank3") - AM_RANGE( 0x8000, 0xbfff ) AM_RAMBANK("bank4") - AM_RANGE( 0xc000, 0xefff ) AM_RAMBANK("bank5") - AM_RANGE( 0xf000, 0xf3ff ) AM_RAMBANK("bank6") - AM_RANGE( 0xf400, 0xf7ff ) AM_RAMBANK("bank7") - AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank8") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( orionpro_io , AS_IO, 8, orion_state ) - AM_RANGE( 0x0000, 0xffff) AM_READWRITE(orionpro_io_r, orionpro_io_w ) -ADDRESS_MAP_END - -FLOPPY_FORMATS_MEMBER( orion_state::orion_floppy_formats ) - FLOPPY_SMX_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( orion_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -/* Machine driver */ -static MACHINE_CONFIG_START( orion128, orion_state ) - MCFG_CPU_ADD("maincpu", I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(orion128_mem) - MCFG_CPU_IO_MAP(orion128_io) - - MCFG_MACHINE_START_OVERRIDE(orion_state, orion128 ) - MCFG_MACHINE_RESET_OVERRIDE(orion_state, orion128 ) - - MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(orion_state, orion_romdisk_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(orion_state, orion_romdisk_portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(orion_state, orion_romdisk_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(384, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(orion_state, screen_update_orion128) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 18) - MCFG_PALETTE_INIT_OWNER(orion_state, orion128 ) - - MCFG_VIDEO_START_OVERRIDE(orion_state,orion128) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rko_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("orion_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") - - MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) - - MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd2", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd3", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","orion_flop") - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "orion_cart") - - MCFG_SOFTWARE_LIST_ADD("cart_list", "orion_cart") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( orion128ms, orion128 ) - MCFG_DEVICE_REMOVE("ppi8255_2") - MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, rk7007_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( orionz80, orion_state ) - MCFG_CPU_ADD("maincpu", Z80, 2500000) - MCFG_CPU_PROGRAM_MAP(orionz80_mem) - MCFG_CPU_IO_MAP(orionz80_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", orion_state, orionz80_interrupt) - - MCFG_MACHINE_START_OVERRIDE(orion_state, orionz80 ) - MCFG_MACHINE_RESET_OVERRIDE(orion_state, orionz80 ) - - MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(orion_state, orion_romdisk_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(orion_state, orion_romdisk_portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(orion_state, orion_romdisk_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(384, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(orion_state, screen_update_orion128) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 18) - MCFG_PALETTE_INIT_OWNER(orion_state, orion128 ) - - MCFG_VIDEO_START_OVERRIDE(orion_state,orion128) - - MCFG_MC146818_ADD( "rtc", XTAL_4_194304Mhz ) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8912", AY8912, 1773400) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rko_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("orion_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") - - MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) - - MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd2", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd3", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","orion_flop") - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "orion_cart") - - MCFG_SOFTWARE_LIST_ADD("cart_list", "orion_cart") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( orionz80ms, orionz80 ) - - MCFG_DEVICE_REMOVE("ppi8255_2") - MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, rk7007_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( orionpro, orion_state ) - MCFG_CPU_ADD("maincpu", Z80, 5000000) - MCFG_CPU_PROGRAM_MAP(orionpro_mem) - MCFG_CPU_IO_MAP(orionpro_io) - - MCFG_MACHINE_RESET_OVERRIDE(orion_state, orionpro ) - - MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(orion_state, orion_romdisk_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(orion_state, orion_romdisk_portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(orion_state, orion_romdisk_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(384, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(orion_state, screen_update_orion128) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 18) - MCFG_PALETTE_INIT_OWNER(orion_state, orion128 ) - - MCFG_VIDEO_START_OVERRIDE(orion_state,orion128) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8912", AY8912, 1773400) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rko_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("orion_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "orion_cass") - - MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) - - MCFG_FLOPPY_DRIVE_ADD("fd0", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd1", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd2", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd3", orion_floppies, "525qd", orion_state::orion_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","orionpro_flop") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop128_list","orion_flop") - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "orion_cart") - - MCFG_SOFTWARE_LIST_ADD("cart_list", "orion_cart") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( orion128 ) - ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "m2rk", "Version 3.2 rk" ) - ROMX_LOAD( "m2rk.bin", 0x0f800, 0x0800, CRC(2025c234) SHA1(caf86918629be951fe698cddcdf4589f07e2fb96), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "m2_2rk", "Version 3.2.2 rk" ) - ROMX_LOAD( "m2_2rk.bin", 0x0f800, 0x0800, CRC(fc662351) SHA1(7c6de67127fae5869281449de1c503597c0c058e), ROM_BIOS(2) ) -ROM_END - -ROM_START( orionms ) - ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ms7007.bin", 0x0f800, 0x0800, CRC(c6174ba3) SHA1(8f9a42c3e09684718fe4121a8408e7860129d26f) ) -ROM_END - -ROM_START( orionz80 ) - ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "m31", "Version 3.1" ) - ROMX_LOAD( "m31.bin", 0x0f800, 0x0800, CRC(007c6dc6) SHA1(338ff95497c820338f7f79c75f65bc540a5541c4), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "m32zrk", "Version 3.2 zrk" ) - ROMX_LOAD( "m32zrk.bin", 0x0f800, 0x0800, CRC(4ec3f012) SHA1(6b0b2bfc515a80e7caf72c3c33cf2dcf192d4711), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "m33zrkd", "Version 3.3 zrkd" ) - ROMX_LOAD( "m33zrkd.bin", 0x0f800, 0x0800, CRC(f404032d) SHA1(088cd9ed05f0dda4fa0a005c609208d9f57ad3d9), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "m34zrk", "Version 3.4 zrk" ) - ROMX_LOAD( "m34zrk.bin", 0x0f800, 0x0800, CRC(787c3903) SHA1(476c1c0b88e5efb582292eebec15e24d054c8851), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "m35zrkd", "Version 3.5 zrkd" ) - ROMX_LOAD( "m35zrkd.bin", 0x0f800, 0x0800, CRC(9368b38f) SHA1(64a77f22119d40c9b18b64d78ad12acc6fff9efb), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "peter", "Peterburg '91" ) - ROMX_LOAD( "peter.bin", 0x0f800, 0x0800, CRC(df9b1d8c) SHA1(c7f1e074e58ad1c1799cf522161b4f4cffa5aefa), ROM_BIOS(6) ) -ROM_END - -ROM_START( orionide ) - ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "m35zrkh.bin", 0x0f800, 0x0800, CRC(b7745f28) SHA1(c3bd3e662db7ec56ecbab54bf6b3a4c26200d0bb) ) -ROM_END - -ROM_START( orionzms ) - ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "m32zms", "Version 3.2 zms" ) - ROMX_LOAD( "m32zms.bin", 0x0f800, 0x0800, CRC(44cfd2ae) SHA1(84d53fbc249938c56be76ee4e6ab297f0461835b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "m34zms", "Version 3.4 zms" ) - ROMX_LOAD( "m34zms.bin", 0x0f800, 0x0800, CRC(0f87a80b) SHA1(ab1121092e61268d8162ed8a7d4fd081016a409a), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "m35zmsd", "Version 3.5 zmsd" ) - ROMX_LOAD( "m35zmsd.bin", 0x0f800, 0x0800, CRC(f714ff37) SHA1(fbe9514adb3384aff146cbedd4fede37ce9591e1), ROM_BIOS(3) ) -ROM_END - -ROM_START( orionidm ) - ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "m35zmsh.bin", 0x0f800, 0x0800, CRC(01e66df4) SHA1(8c785a3c32fe3eacda73ec79157b41a6e4b63ba8) ) -ROM_END - -ROM_START( orionpro ) - ROM_REGION( 0x32000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "ver21", "Version 2.1" ) - ROMX_LOAD( "rom1-210.bin", 0x20000, 0x2000, CRC(8e1a0c78) SHA1(61c8a5ed596ce7e3fd32da920dcc80dc5375b421), ROM_BIOS(1) ) - ROMX_LOAD( "rom2-210.bin", 0x22000, 0x10000, CRC(7cb7a49b) SHA1(601f3dd61db323407c4874fd7f23c10dccac0209), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "ver20", "Version 2.0" ) - ROMX_LOAD( "rom1-200.bin", 0x20000, 0x2000, CRC(4fbe83cc) SHA1(9884d43770b4c0fbeb519b96618b01957c0b8511), ROM_BIOS(2) ) - ROMX_LOAD( "rom2-200.bin", 0x22000, 0x10000, CRC(618aaeb7) SHA1(3e7e5d3ff9d2c683708928558e69aa62db877811), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "ver10", "Version 1.0" ) - ROMX_LOAD( "rom1-100.bin", 0x20000, 0x2000, CRC(4fd6c408) SHA1(b0c2e4fb5be5a74a7efa9bba14b746865122af1d), ROM_BIOS(3) ) - ROMX_LOAD( "rom2-100.bin", 0x22000, 0x8000, CRC(370ffdca) SHA1(169e2acac2d0b382e2d0a144da0af18bfa38db5c), ROM_BIOS(3) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1990, orion128, 0, 0, orion128, radio86, driver_device, 0, "", "Orion 128", 0) -COMP( 1990, orionms, orion128, 0, orion128ms, ms7007, driver_device, 0, "", "Orion 128 (MS7007)", 0) -COMP( 1990, orionz80, orion128, 0, orionz80, radio86, driver_device, 0, "", "Orion 128 + Z80 Card II", 0) -COMP( 1990, orionide, orion128, 0, orionz80, radio86, driver_device, 0, "", "Orion 128 + Z80 Card II + IDE", 0) -COMP( 1990, orionzms, orion128, 0, orionz80ms, ms7007, driver_device, 0, "", "Orion 128 + Z80 Card II (MS7007)", 0) -COMP( 1990, orionidm, orion128, 0, orionz80ms, ms7007, driver_device, 0, "", "Orion 128 + Z80 Card II + IDE (MS7007)", 0) -COMP( 1994, orionpro, orion128, 0, orionpro, radio86, driver_device, 0, "", "Orion Pro", 0) diff --git a/src/mess/drivers/osbexec.c b/src/mess/drivers/osbexec.c deleted file mode 100644 index 0318dfa31a0..00000000000 --- a/src/mess/drivers/osbexec.c +++ /dev/null @@ -1,581 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - Osborne Executive driver file - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "sound/speaker.h" -#include "machine/wd_fdc.h" -#include "machine/6821pia.h" -#include "machine/z80dart.h" -#include "machine/pit8253.h" -#include "machine/ram.h" - - -#define MAIN_CLOCK 23961600 - - -class osbexec_state : public driver_device -{ -public: - osbexec_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu( *this, "maincpu" ), - m_mb8877( *this, "mb8877" ), - m_messram( *this, RAM_TAG ), - m_pia_0( *this, "pia_0" ), - m_pia_1( *this, "pia_1" ), - m_sio( *this, "sio" ), - m_speaker( *this, "speaker" ), - m_floppy0( *this, "mb8877:0:525ssdd" ), - m_floppy1( *this, "mb8877:1:525ssdd" ) - { } - - required_device m_maincpu; - required_device m_mb8877; - required_device m_messram; - required_device m_pia_0; - required_device m_pia_1; - required_device m_sio; - required_device m_speaker; - required_device m_floppy0; - required_device m_floppy1; - - virtual void video_start(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - bitmap_ind16 m_bitmap; - - memory_region *m_fontram_region; - memory_region *m_vram_region; - UINT8 *m_fontram; - UINT8 *m_vram; - UINT8 *m_ram_0000; - UINT8 *m_ram_c000; - UINT8 m_temp_attr; - emu_timer *m_video_timer; - - /* PIA 0 (UD12) */ - UINT8 m_pia0_porta; - UINT8 m_pia0_portb; - int m_pia0_irq_state; - int m_pia0_cb2; /* 60/50 */ - - /* PIA 1 (UD8) */ - int m_pia1_irq_state; - - /* Vblank counter ("RTC") */ - UINT8 m_rtc; - - void set_banks() - { - UINT8 *ram_ptr = m_messram->pointer(); - - m_ram_0000 = ram_ptr; - - if ( m_pia0_porta & 0x01 ) - m_ram_0000 += 0x10000; - - membank( "0000" )->set_base( m_ram_0000 + 0x0000 ); - membank( "2000" )->set_base( m_ram_0000 + 0x2000 ); - membank( "4000" )->set_base( m_ram_0000 + 0x4000 ); - m_ram_c000 = m_ram_0000 + 0xc000; - membank( "e000" )->set_base( m_ram_0000 + 0xe000 ); - - if ( m_pia0_porta & 0x80 ) - { - membank( "0000" )->set_base( memregion("maincpu")->base()); - /* When BIOS is enabled 2000-3FFF is set to the "ROM RAM" */ - membank( "2000" )->set_base( ram_ptr + 0x20000 ); - } - - if ( m_pia0_porta & 0x40 ) - m_ram_c000 = m_vram_region->base(); - } - - void update_irq_state() - { - if ( m_pia0_irq_state || m_pia1_irq_state ) - m_maincpu->set_input_line(0, ASSERT_LINE ); - else - m_maincpu->set_input_line(0, CLEAR_LINE ); - } - DECLARE_WRITE8_MEMBER(osbexec_0000_w); - DECLARE_READ8_MEMBER(osbexec_c000_r); - DECLARE_WRITE8_MEMBER(osbexec_c000_w); - DECLARE_READ8_MEMBER(osbexec_kbd_r); - DECLARE_READ8_MEMBER(osbexec_rtc_r); - DECLARE_DRIVER_INIT(osbexec); - virtual void machine_reset(); - TIMER_CALLBACK_MEMBER(osbexec_video_callback); - DECLARE_READ8_MEMBER(osbexec_pia0_a_r); - DECLARE_WRITE8_MEMBER(osbexec_pia0_a_w); - DECLARE_READ8_MEMBER(osbexec_pia0_b_r); - DECLARE_WRITE8_MEMBER(osbexec_pia0_b_w); - DECLARE_WRITE_LINE_MEMBER(osbexec_pia0_ca2_w); - DECLARE_WRITE_LINE_MEMBER(osbexec_pia0_cb2_w); - DECLARE_WRITE_LINE_MEMBER(osbexec_pia0_irq); - DECLARE_WRITE_LINE_MEMBER(osbexec_pia1_irq); -}; - - -WRITE8_MEMBER(osbexec_state::osbexec_0000_w) -{ - /* Font RAM writing is enabled when ROM bank is enabled */ - if ( m_pia0_porta & 0x80 ) - { - if ( offset < 0x1000 ) - m_fontram[ offset ] = data; - } - else - { - m_ram_0000[ offset ] = data; - } -} - - -READ8_MEMBER(osbexec_state::osbexec_c000_r) -{ - UINT8 data = m_ram_c000[offset]; - - if ( ( m_pia0_porta & 0x40 ) && offset < 0x1000 ) - { - m_temp_attr = m_ram_c000[ 0x1000 + offset ]; - } - - return data; -} - - -WRITE8_MEMBER(osbexec_state::osbexec_c000_w) -{ - m_ram_c000[offset] = data; - - if ( ( m_pia0_porta & 0x40 ) && offset < 0x1000 ) - { - m_ram_c000[ 0x1000 + offset ] = m_temp_attr; - } -} - - -READ8_MEMBER(osbexec_state::osbexec_kbd_r) -{ - UINT8 data = 0xFF; - - if ( offset & 0x0100 ) - data &= ioport( "ROW0" )->read(); - - if ( offset & 0x0200 ) - data &= ioport( "ROW1" )->read(); - - if ( offset & 0x0400 ) - data &= ioport( "ROW2" )->read(); - - if ( offset & 0x0800 ) - data &= ioport( "ROW3" )->read(); - - if ( offset & 0x1000 ) - data &= ioport( "ROW4" )->read(); - - if ( offset & 0x2000 ) - data &= ioport( "ROW5" )->read(); - - if ( offset & 0x4000 ) - data &= ioport( "ROW6" )->read(); - - if ( offset & 0x8000 ) - data &= ioport( "ROW7" )->read(); - - return data; -} - - -READ8_MEMBER(osbexec_state::osbexec_rtc_r) -{ - return m_rtc; -} - - -static ADDRESS_MAP_START( osbexec_mem, AS_PROGRAM, 8, osbexec_state ) - AM_RANGE( 0x0000, 0x1FFF ) AM_READ_BANK("0000") AM_WRITE(osbexec_0000_w ) /* ROM and maybe also banked ram */ - AM_RANGE( 0x2000, 0x3FFF ) AM_RAMBANK("2000") /* Banked RAM */ - AM_RANGE( 0x4000, 0xBFFF ) AM_RAMBANK("4000") /* Banked RAM */ - AM_RANGE( 0xC000, 0xDFFF ) AM_READWRITE(osbexec_c000_r, osbexec_c000_w ) /* Video ram / Banked RAM */ - AM_RANGE( 0xE000, 0xEFFF ) AM_RAMBANK("e000") /* Banked RAM */ - AM_RANGE( 0xF000, 0xFFFF ) AM_RAM /* 4KB of non-banked RAM for system stack etc */ -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( osbexec_io, AS_IO, 8, osbexec_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00, 0x03 ) AM_MIRROR( 0xff00 ) AM_DEVREADWRITE( "pia_0", pia6821_device, read, write) /* 6821 PIA @ UD12 */ - /* 0x04 - 0x07 - 8253 @UD1 */ - AM_RANGE( 0x08, 0x0B ) AM_MIRROR( 0xff00 ) AM_DEVREADWRITE("mb8877", wd_fdc_t, read, write ) /* MB8877 @ UB17 input clock = 1MHz */ - AM_RANGE( 0x0C, 0x0F ) AM_MIRROR( 0xff00 ) AM_DEVREADWRITE("sio", z80sio2_device, ba_cd_r, ba_cd_w ) /* SIO @ UD4 */ - AM_RANGE( 0x10, 0x13 ) AM_MIRROR( 0xff00 ) AM_DEVREADWRITE( "pia_1", pia6821_device, read, write) /* 6821 PIA @ UD8 */ - AM_RANGE( 0x14, 0x17 ) AM_MIRROR( 0xff00 ) AM_MASK( 0xff00 ) AM_READ(osbexec_kbd_r ) /* KBD */ - AM_RANGE( 0x18, 0x1b ) AM_MIRROR( 0xff00 ) AM_READ(osbexec_rtc_r ) /* "RTC" @ UE13/UF13 */ - /* ?? - vid ? */ -ADDRESS_MAP_END - - -static INPUT_PORTS_START( osbexec ) - PORT_START("ROW0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("ROW1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("ROW2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START("ROW3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START("ROW4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("ROW5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("ROW6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("ROW7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_DIPNAME( 0x08, 0, "Alpha Lock" ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -void osbexec_state::video_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); -} - -UINT32 osbexec_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - -/* - UD12 - 6821 PIA - - Port A: - PA7 - ROM BANK ENA - PA6 - VRAM BANK ENA - PA5 - BANK6ENA - PA4 - BANK5ENA - PA3 - BANK4ENA - PA2 - BANK3ENA - PA1 - BANK2ENA - PA0 - BANK1ENA - CA1 - DMA IRQ - CA2 - KBD STB (i/o) - - Port B: - PB7 - MODEM RI (input) - PB6 - MODEM DSR (input) - PB5 - TXC SEL - PB4 - RXC SEL - PB3 - speaker - PB2 - DSEL2 - PB1 - DSEL1 - PB0 - DDEN - CB1 - VBlank (input) - CB2 - 60/50 (?) -*/ - -READ8_MEMBER(osbexec_state::osbexec_pia0_a_r) -{ - return m_pia0_porta; -} - - -WRITE8_MEMBER(osbexec_state::osbexec_pia0_a_w) -{ - logerror("osbexec_pia0_a_w: %02x\n", data ); - - m_pia0_porta = data; - - set_banks(); -} - - -READ8_MEMBER(osbexec_state::osbexec_pia0_b_r) -{ - return m_pia0_portb; -} - - -WRITE8_MEMBER(osbexec_state::osbexec_pia0_b_w) -{ - m_pia0_portb = data; - - m_speaker->level_w(!BIT(data, 3)); - - switch ( data & 0x06 ) - { - case 0x02: - m_mb8877->set_floppy(m_floppy1); - m_floppy1->mon_w(0); - break; - case 0x04: - m_mb8877->set_floppy(m_floppy0); - m_floppy0->mon_w(0); - break; - default: - m_mb8877->set_floppy(NULL); - break; - } - - m_mb8877->dden_w(( data & 0x01 ) ? 1 : 0 ); -} - - -WRITE_LINE_MEMBER(osbexec_state::osbexec_pia0_ca2_w) -{ - logerror("osbexec_pia0_ca2_w: state = %d\n", state); -} - - -WRITE_LINE_MEMBER(osbexec_state::osbexec_pia0_cb2_w) -{ - m_pia0_cb2 = state; -} - - -WRITE_LINE_MEMBER(osbexec_state::osbexec_pia0_irq) -{ - m_pia0_irq_state = state; - update_irq_state(); -} - - -WRITE_LINE_MEMBER(osbexec_state::osbexec_pia1_irq) -{ - m_pia1_irq_state = state; - update_irq_state(); -} - - -/* - * The Osborne Executive supports the following disc formats: (TODO: Verify) - * - Osborne single density: 40 tracks, 10 sectors per track, 256-byte sectors (100 KByte) - * - Osborne double density: 40 tracks, 5 sectors per track, 1024-byte sectors (200 KByte) - * - IBM Personal Computer: 40 tracks, 8 sectors per track, 512-byte sectors (160 KByte) - * - Xerox 820 Computer: 40 tracks, 18 sectors per track, 128-byte sectors (90 KByte) - * - DEC 1820 double density: 40 tracks, 9 sectors per track, 512-byte sectors (180 KByte) - * - */ - -static SLOT_INTERFACE_START( osborne2_floppies ) - SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) -SLOT_INTERFACE_END - - -TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) -{ - int y = machine().first_screen()->vpos(); - - /* Start of frame */ - if ( y == 0 ) - { - /* Clear CB1 on PIA @ UD12 */ - m_pia_0->cb1_w(0); - } - else if ( y == 240 ) - { - /* Set CB1 on PIA @ UD12 */ - m_pia_0->cb1_w(1); - m_rtc++; - } - if ( y < 240 ) - { - UINT16 row_addr = ( y / 10 ) * 128; - UINT16 *p = &m_bitmap.pix16(y); - UINT8 char_line = y % 10; - - for ( int x = 0; x < 80; x++ ) - { - UINT8 ch = m_vram[ row_addr + x ]; - UINT8 attr = m_vram[ 0x1000 + row_addr + x ]; - UINT8 fg_col = ( attr & 0x80 ) ? 2 : 1; - UINT8 font_bits = m_fontram[ ( ( attr & 0x10 ) ? 0x800 : 0 ) + ( ch & 0x7f ) * 16 + char_line ]; - - /* Check for underline */ - if ( ( attr & 0x40 ) && char_line == 9 ) - font_bits = 0xFF; - - /* Check for blink */ - if ( ( attr & 0x20 ) && ( m_rtc & 0x10 ) ) - font_bits = 0; - - /* Check for inverse video */ - if ( ( ch & 0x80 ) && ! ( attr & 0x10 ) ) - font_bits ^= 0xFF; - - for ( int b = 0; b < 8; b++ ) - { - p[ x * 8 + b ] = ( font_bits & 0x80 ) ? fg_col : 0; - font_bits <<= 1; - } - } - } - - m_video_timer->adjust( machine().first_screen()->time_until_pos( y + 1, 0 ) ); -} - - -DRIVER_INIT_MEMBER(osbexec_state,osbexec) -{ - m_fontram_region = machine().memory().region_alloc( "fontram", 0x1000, 1, ENDIANNESS_LITTLE); - m_vram_region = machine().memory().region_alloc( "vram", 0x2000, 1, ENDIANNESS_LITTLE ); - m_vram = m_vram_region->base(); - m_fontram = m_fontram_region->base(); - - - memset( m_fontram, 0x00, 0x1000 ); - memset( m_vram, 0x00, 0x2000 ); - - m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osbexec_state::osbexec_video_callback),this)); -} - - -void osbexec_state::machine_reset() -{ - m_pia0_porta = 0xC0; /* Enable ROM and VRAM on reset */ - - set_banks(); - - m_video_timer->adjust( machine().first_screen()->time_until_pos( 0, 0 ) ); - - m_rtc = 0; -} - - -static const z80_daisy_config osbexec_daisy_config[] = -{ - { "sio" }, - { NULL } -}; - - -static MACHINE_CONFIG_START( osbexec, osbexec_state ) - MCFG_CPU_ADD( "maincpu", Z80, MAIN_CLOCK/6 ) - MCFG_CPU_PROGRAM_MAP( osbexec_mem) - MCFG_CPU_IO_MAP( osbexec_io) - MCFG_CPU_CONFIG( osbexec_daisy_config ) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(osbexec_state, screen_update) - MCFG_SCREEN_RAW_PARAMS( MAIN_CLOCK/2, 768, 0, 640, 260, 0, 240 ) /* May not be correct */ - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - -// MCFG_PIT8253_ADD("pit", osbexec_pit_config) - - MCFG_DEVICE_ADD("pia_0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(osbexec_state, osbexec_pia0_a_r)) - MCFG_PIA_READPB_HANDLER(READ8(osbexec_state, osbexec_pia0_b_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(osbexec_state, osbexec_pia0_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(osbexec_state, osbexec_pia0_b_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(osbexec_state, osbexec_pia0_ca2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(osbexec_state, osbexec_pia0_cb2_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(osbexec_state, osbexec_pia0_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(osbexec_state, osbexec_pia0_irq)) - - MCFG_DEVICE_ADD("pia_1", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(WRITELINE(osbexec_state, osbexec_pia1_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(osbexec_state, osbexec_pia1_irq)) - - MCFG_Z80SIO2_ADD("sio", MAIN_CLOCK/6, 0, 0, 0, 0) - - MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/24) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pia_1", pia6821_device, cb1_w)) - MCFG_FLOPPY_DRIVE_ADD("mb8877:0", osborne2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("mb8877:1", osborne2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("136K") /* 128KB Main RAM + RAM in ROM bank (8) */ - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("flop_list", "osborne2") -MACHINE_CONFIG_END - - -ROM_START( osbexec ) - ROM_REGION(0x2000, "maincpu", 0) - ROM_LOAD( "execv12.ud18", 0x0000, 0x2000, CRC(70798c2f) SHA1(2145a72da563bed1d6d455c77e48cc011a5f1153) ) /* Checksum C6B2 */ -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, osbexec, 0, 0, osbexec, osbexec, osbexec_state, osbexec, "Osborne", "Executive", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/osborne1.c b/src/mess/drivers/osborne1.c deleted file mode 100644 index 4910ee5e0cc..00000000000 --- a/src/mess/drivers/osborne1.c +++ /dev/null @@ -1,262 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - Osborne-1 driver file - -The Osborne-1 memory is divided into 3 "banks". - -Bank 1 simply consists of 64KB of RAM. The upper 4KB is used for the lower 8 -bit of video RAM entries. - -Bank 2 holds the BIOS ROM and I/O area. Only addresses 0000-3FFF are used -by bank 2. Bank 2 is divided as follows: -3000-3FFF Unused -2C00-2C03 Video PIA -2A00-2A01 Serial interface -2900-2903 488 PIA -2201-2280 Keyboard -2100-2103 Floppy -1000-1FFF Unused -0000-0FFF BIOS ROM - -Bank 3 has the ninth bit needed to complete the full Video RAM. These bits -are stored at F000-FFFF. Only the highest bit is used. - -On bootup bank 2 is active. - -The actual banking is done through I/O ports 00-03. -00 - Have both bank 2 and bank 1 active. This seems to be the power up default. -01 - Only have bank 1 active. -02 - Have both bank 2 and bank 3 active. (Not 100% sure, also bank 1 from 4000-EFFF?) -03 - Have both bank 2 and bank 1 active. - -TODO: - - Verify frequency of the beep/audio alarm. - -***************************************************************************/ - -#include "includes/osborne1.h" - - -#define MAIN_CLOCK 15974400 - - -static ADDRESS_MAP_START( osborne1_mem, AS_PROGRAM, 8, osborne1_state ) - AM_RANGE( 0x0000, 0x0FFF ) AM_READ_BANK("bank1") AM_WRITE( osborne1_0000_w ) - AM_RANGE( 0x1000, 0x1FFF ) AM_READ_BANK("bank2") AM_WRITE( osborne1_1000_w ) - AM_RANGE( 0x2000, 0x2FFF ) AM_READWRITE( osborne1_2000_r, osborne1_2000_w ) - AM_RANGE( 0x3000, 0x3FFF ) AM_READ_BANK("bank3") AM_WRITE( osborne1_3000_w ) - AM_RANGE( 0x4000, 0xEFFF ) AM_RAM - AM_RANGE( 0xF000, 0xFFFF ) AM_READ_BANK("bank4") AM_WRITE( osborne1_videoram_w ) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( osborne1_io, AS_IO, 8, osborne1_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x00, 0x03 ) AM_WRITE( osborne1_bankswitch_w ) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( osborne1 ) - PORT_START("ROW0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("ROW1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("ROW2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("ROW3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START("ROW4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START("ROW5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("ROW6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("ROW7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_DIPNAME( 0x08, 0, "Alpha Lock" ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -static const z80_daisy_config osborne1_daisy_chain[] = -{ -/* { osborne1_z80_reset, osborne1_z80_irq_state, osborne1_z80_irq_ack, osborne1_z80_irq_reti, 0 }, */ - { "osborne1_daisy" }, - { NULL } -}; - - -/* - * The Osborne-1 supports the following disc formats: - * - Osborne single density: 40 tracks, 10 sectors per track, 256-byte sectors (100 KByte) - * - Osborne double density: 40 tracks, 5 sectors per track, 1024-byte sectors (200 KByte) - * - IBM Personal Computer: 40 tracks, 8 sectors per track, 512-byte sectors (160 KByte) - * - Xerox 820 Computer: 40 tracks, 18 sectors per track, 128-byte sectors (90 KByte) - * - DEC 1820 double density: 40 tracks, 9 sectors per track, 512-byte sectors (180 KByte) - * - */ - -static SLOT_INTERFACE_START( osborne1_floppies ) - SLOT_INTERFACE( "525sssd", FLOPPY_525_SSSD ) // Siemens FDD 100-5, custom Osborne electronics - SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) // MPI 52(?), custom Osborne electronics -SLOT_INTERFACE_END - - -/* F4 Character Displayer */ -static const gfx_layout osborne1_charlayout = -{ - 8, 10, /* 8 x 10 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*128*8, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8, 8*128*8, 9*128*8 }, - 8 /* every char takes 16 x 1 bytes */ -}; - -static GFXDECODE_START( osborne1 ) - GFXDECODE_ENTRY( "chargen", 0x0000, osborne1_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( osborne1, osborne1_state ) - MCFG_CPU_ADD( "maincpu", Z80, MAIN_CLOCK/4 ) - MCFG_CPU_PROGRAM_MAP( osborne1_mem) - MCFG_CPU_IO_MAP( osborne1_io) - MCFG_CPU_CONFIG( osborne1_daisy_chain ) - - MCFG_DEVICE_ADD( "osborne1_daisy", OSBORNE1_DAISY, 0 ) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(osborne1_state, screen_update) - MCFG_SCREEN_RAW_PARAMS( MAIN_CLOCK/2, 512, 0, 416, 260, 0, 240 ) - MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", osborne1) - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - MCFG_DEVICE_ADD("pia_0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) - MCFG_PIA_READPB_HANDLER(READ8(osborne1_state, ieee_pia_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(osborne1_state, ieee_pia_pb_w)) - MCFG_PIA_CA2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ifc_w)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ren_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(osborne1_state, ieee_pia_irq_a_func)) - - MCFG_DEVICE_ADD( "pia_1", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(osborne1_state, video_pia_port_a_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(osborne1_state, video_pia_port_b_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(osborne1_state, video_pia_out_cb2_dummy)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(osborne1_state, video_pia_irq_a_func)) - - MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/16) - MCFG_WD_FDC_FORCE_READY - MCFG_FLOPPY_DRIVE_ADD("mb8877:0", osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("mb8877:1", osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - - MCFG_IEEE488_BUS_ADD() - MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE("pia_0", pia6821_device, ca2_w)) - MCFG_SOFTWARE_LIST_ADD("flop_list","osborne1") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("68K") /* 64KB Main RAM and 4Kbit video attribute RAM */ -MACHINE_CONFIG_END - - -ROM_START( osborne1 ) - ROM_REGION(0x1000, "maincpu", 0) - ROM_SYSTEM_BIOS( 0, "ver144", "BIOS version 1.44" ) - ROMX_LOAD( "3a10082-00rev-e.ud11", 0x0000, 0x1000, CRC(c0596b14) SHA1(ee6a9cc9be3ddc5949d3379351c1d58a175ce9ac), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "verA", "BIOS version A" ) - ROMX_LOAD( "osba.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "ver12", "BIOS version 1.2" ) - ROMX_LOAD( "osb12.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "ver121", "BIOS version 1.2.1" ) - ROMX_LOAD( "osb121.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "ver13", "BIOS version 1.3" ) - ROMX_LOAD( "osb13.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "ver14", "BISO version 1.4" ) - ROMX_LOAD( "rev1.40.ud11", 0x0000, 0x1000, CRC(3d966335) SHA1(0c60b97a3154a75868efc6370d26995eadc7d927), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS( 6, "ver143", "BIOS version 1.43" ) - ROMX_LOAD( "rev1.43.ud11", 0x0000, 0x1000, CRC(91a48e3c) SHA1(c37b83f278d21e6e92d80f9c057b11f7f22d88d4), ROM_BIOS(7) ) - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "7a3007-00.ud15", 0x0000, 0x800, CRC(6c1eab0d) SHA1(b04459d377a70abc9155a5486003cb795342c801) ) - //ROM_LOAD( "char.ua15", 0x0000, 0x800, CRC(5297C109) SHA1(e1a59d87edd66e6c226102cb0688e9cb74dbb594) ) // this is CHRROM from v1.4 BIOS MB. I don't know how to hook up diff CHR to ROM_BIOS(6) - -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, osborne1, 0, 0, osborne1, osborne1, osborne1_state, osborne1, "Osborne", "Osborne-1", 0 ) diff --git a/src/mess/drivers/osi.c b/src/mess/drivers/osi.c deleted file mode 100644 index 01e59360901..00000000000 --- a/src/mess/drivers/osi.c +++ /dev/null @@ -1,908 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Robbbert, Wilbert Pol -/* - -Ohio Scientific Superboard II Model 600 - -PCB Layout ----------- - -OHIO SCIENTIFIC MODEL 600 REV D - -|-------------------------------------------------------------------------------------------| -| 2114 2114 | -| LS138 CN1 | -| IC1 2114 2114 | -| LS04 LS75 LS75 | -| 2114 2114 | -| LS138 | -| 2114 2114 LS125 LS125 | -| LS138 | -| - 2114 2114 8T28 8T28 | -| | | -|C| 2114 2114 | -|N| | -|3| 2114 2114 6502 | -| | | -| - 2114 2114 | -| | -| 2114 8T28 ROM0 | -| LS163 LS157 LS174 | -| 2114 8T28 ROM1 | -| CA3130 LS163 LS157 LS02 | -| 2114 8T28 ROM2 | -| LS14 LS163 LS157 LS04 | -| SW1 ROM3 | -| 7417 7404 LS20 ROM5 7408 LS139 | -| ROM4 | -| - 74123 7474 LS163 LS165 7474 | -|C| | -|N| 7476 7400 LS157 LS93 LS04 6850 | -|2| | -| - 7403 74123 3.7MHz LS86 LS163 LS20 CN4 | -|-------------------------------------------------------------------------------------------| - -Notes: - All IC's shown. - - ROM0-5 - - 6502 - - 6850 - Asynchronous Communications Interface Adapter - 8T28 - 4-Bit Bidirectional Bus Transceiver - CA3130 - Operational Amplifier - CN1 - OSI-48 bus connector - CN2 - - CN3 - - CN4 - sound connector - SW1 - - -*/ - -/* - -Compukit UK101 - -PCB Layout ----------- - -|-------------------------------------------------------------------------------------------| -| 2114 2114 | -| LS138 CN1 | -| IC1 2114 2114 | -| 7404 LS75 LS75 | -| 2114 2114 | -| LS138 | -| 2114 2114 LS125 LS125 | -| LS138 | -| - 2114* 2114* 8T28* 8T28* | -| | | -|C| 2114* 2114* | -|N| CN4 | -|3| 2114* 2114* 6502 | -| | | -| - 2114* 2114* | -| | -| 2114 8T28 ROM0 | -| 74163 LS157 | -| 2114 8T28 ROM1 | -| IC66' 74163 LS157 7402 | -| ROM2 | -| IC67' 74163 LS157 7404 | -| ROM3 | -| IC68' 7404 7420 ROM5 LS139 | -| ROM4 | -| - LS123 7474 74163 74165 LS123 | -|C| | -|N| 7476 7400 7493 7404 6850 | -|2| | -| - 7403 LS123 8MHz 74163 LS20 | -|-------------------------------------------------------------------------------------------| - -Notes: - All IC's shown. - - ROM0-5 - - 6502 - - 6850 - Asynchronous Communications Interface Adapter - 8T28 - 4-Bit Bidirectional Bus Transceiver - CN1 - OSI-48 Bus Connector - CN2 - - CN3 - - CN4 - UHF Modulator Output - * - present when 8KB of RAM installed - ' - present when cassette option installed - -*/ - -/* - -Ohio Scientific Single Sided Floppy Interface - -PCB Layout ----------- - -OSI 470 REV B - -|-------------------------------------------------------------------| -| | -| 8T26 8T26 | -| | -| 7417 | -| | -| 6820 6850 7400 U2C | -| 7417 | -| | -| | -| 7417 7404 | -| | -| | -| 7417 | -| | -| 7400 7404 74123 74123 7410 | -| 4MHz | -| | -| | -| 7400 7493 74390 74390 74390 7404 7430 7404 | -| | -| | -| U6A | -| | -|-------------------------------------------------------------------| - -Notes: - All IC's shown. - - 6850 - Asynchronous Communications Interface Adapter - 6820 - Peripheral Interface Adapter - 8T26 - 4-Bit Bidirectional Bus Transceiver - U2C - PROTO? - U6A - PROTO? - -*/ - -/* - - TODO: - - - fix uk101 video to 64x16 - - floppy PIA is actually a 6820 - - break key - - power on reset - - Superboard II revisions A/C/D - - uk101 medium resolution graphics - - uk101 ay-3-8910 sound - - cassette - - faster cassette - - floppy - - wemon? - -*/ - -/* Notes added 2012-05-11 [Robbbert] - General - - Added F1 key to toggle the sound on 'sb2m600b', to silence the awful screech. - - Added F3 key to simulate the RESET / BREAK key on the real keyboard. - - These machines only uses uppercase input. Shift-Lock must be on at all times. - - At boot you get a screen DCWM or similar: - D = boot from floppy - C = Cold boot & start BASIC - W = Warm boot (don't use after turning on the machine) jump to 0000. - M = Monitor (only options are to read/modify memory, Go, Load a tape). - - The corrupt error messages in Basic are normal and are documented in the user - manual. It's not a bug. - - Compukit UK101 - - The Monitor ROM that had always been there is for a 32x32 screen. I assume it - was the prototype referred to in the first Practical Electronics construction - article. Also, the keyboard doesn't work in Basic. - - I found a working rom in another emulator, this runs fine on the 64x16 screen. - - But, the proper rom that came with the kit needs to be found. - - The proper rom (and the prototype) allow you to boot from floppy, but this is - not normally fitted. It appears that it would work the same as in the other - systems in this driver. - -*/ - -/* Notes added 2013-01-20 - Added a modified basic rom, which fixes the garbage collection problem. - Try the following program with -bios 0 and -bios 1. It will work only - with bios 1. You can copy/paste this code, but make sure you include the - trailing blank line. - -10 DIM A$(3) -RUN -PRINT FRE(0) - -*/ - - -#include "includes/osi.h" -#include "machine/clock.h" - -/* Sound */ - -static const discrete_dac_r1_ladder osi600_dac = -{ - 4, // size of ladder - { 180, 180, 180, 180, 0, 0, 0, 0 }, // R68, R69, R70, R71 - 5, // 5V - RES_K(1), // R67 - 0, // no rGnd - 0 // no cFilter -}; - -static DISCRETE_SOUND_START( osi600_discrete_interface ) - DISCRETE_INPUT_DATA(NODE_01) - - DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &osi600_dac) - DISCRETE_CRFILTER(NODE_03, NODE_02, (int)(1.0/(1.0/RES_K(1)+1.0/180+1.0/180+1.0/180+1.0/180)), CAP_U(0.1)) - DISCRETE_OUTPUT(NODE_03, 100) - DISCRETE_GAIN(NODE_04, NODE_03, 32767.0/5) - DISCRETE_OUTPUT(NODE_04, 100) -DISCRETE_SOUND_END - -#if 0 -static const discrete_dac_r1_ladder osi600c_dac = -{ - 8, // size of ladder - { RES_K(68), RES_K(33), RES_K(16), RES_K(8.2), RES_K(3.9), RES_K(2), RES_K(1), 510 }, // R73, R71, R70, R67, R68, R69, R75, R74 - 5, // 5V - 510, // R86 - 0, // no rGnd - CAP_U(33) // C63 -}; -#endif - -static DISCRETE_SOUND_START( osi600c_discrete_interface ) - DISCRETE_INPUT_DATA(NODE_01) - DISCRETE_INPUT_LOGIC(NODE_10) - - DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &osi600_dac) - DISCRETE_ONOFF(NODE_03, NODE_10, NODE_02) - DISCRETE_OUTPUT(NODE_03, 100) -DISCRETE_SOUND_END - -/* Keyboard */ - -READ8_MEMBER( sb2m600_state::keyboard_r ) -{ - if (m_io_reset->read()) - m_maincpu->reset(); - - UINT8 data = 0xff; - - if (!BIT(m_keylatch, 0)) - data &= m_io_row0->read(); - if (!BIT(m_keylatch, 1)) - data &= m_io_row1->read(); - if (!BIT(m_keylatch, 2)) - data &= m_io_row2->read(); - if (!BIT(m_keylatch, 3)) - data &= m_io_row3->read(); - if (!BIT(m_keylatch, 4)) - data &= m_io_row4->read(); - if (!BIT(m_keylatch, 5)) - data &= m_io_row5->read(); - if (!BIT(m_keylatch, 6)) - data &= m_io_row6->read(); - if (!BIT(m_keylatch, 7)) - data &= m_io_row7->read(); - - return data; -} - -WRITE8_MEMBER( sb2m600_state::keyboard_w ) -{ - m_keylatch = data; - - if (m_io_sound->read()) - m_discrete->write(space, NODE_01, (data >> 2) & 0x0f); -} - -WRITE8_MEMBER( uk101_state::keyboard_w ) -{ - m_keylatch = data; -} - -WRITE8_MEMBER( sb2m600_state::ctrl_w ) -{ - /* - - bit signal description - - 0 _32 screen size (0=32x32, 1=64x16) - 1 COLOR EN color enable - 2 BK0 - 3 BK1 - 4 DAC DISABLE DAC sound enable - 5 - 6 - 7 - - */ - - m_32 = BIT(data, 0); - m_coloren = BIT(data, 1); - - m_discrete->write(space, NODE_10, BIT(data, 4)); -} - -WRITE8_MEMBER( c1p_state::osi630_ctrl_w ) -{ - /* - - bit description - - 0 AC control enable - 1 tone generator enable - 2 modem select (0 = printer, 1 = modem) - 3 - 4 - 5 - 6 - 7 - - */ - - m_beep->set_state(BIT(data, 1)); -} - -WRITE8_MEMBER( c1p_state::osi630_sound_w ) -{ - if (data) m_beep->set_frequency(49152 / data); -} - -/* Disk Drive */ - -/* - C000 FLOPIN FLOPPY DISK STATUS PORT - - BIT FUNCTION - 0 DRIVE 0 READY (0 IF READY) - 1 TRACK 0 (0 IF AT TRACK 0) - 2 FAULT (0 IF FAULT) - 3 - 4 DRIVE 1 READY (0 IF READY) - 5 WRITE PROTECT (0 IF WRITE PROTECT) - 6 DRIVE SELECT (1 = A OR C, 0 = B OR D) - 7 INDEX (0 IF AT INDEX HOLE) - - C002 FLOPOT FLOPPY DISK CONTROL PORT - - BIT FUNCTION - 0 WRITE ENABLE (0 ALLOWS WRITING) - 1 ERASE ENABLE (0 ALLOWS ERASING) - ERASE ENABLE IS ON 200us AFTER WRITE IS ON - ERASE ENABLE IS OFF 530us AFTER WRITE IS OFF - 2 STEP BIT : INDICATES DIRECTION OF STEP (WAIT 10us FIRST) - 0 INDICATES STEP TOWARD 76 - 1 INDICATES STEP TOWARD 0 - 3 STEP (TRANSITION FROM 1 TO 0) - MUST HOLD AT LEAST 10us, MIN 8us BETWEEN - 4 FAULT RESET (0 RESETS) - 5 SIDE SELECT (1 = A OR B, 0 = C OR D) - 6 LOW CURRENT (0 FOR TRKS 43-76, 1 FOR TRKS 0-42) - 7 HEAD LOAD (0 TO LOAD : MUST WAIT 40ms AFTER) - - C010 ACIA DISK CONTROLLER ACIA STATUS PORT - C011 ACIAIO DISK CONTROLLER ACIA I/O PORT -*/ - -void sb2m600_state::floppy_index_callback(floppy_image_device *floppy, int state) -{ - m_fdc_index = state; -} - -READ8_MEMBER( c1pmf_state::osi470_pia_pa_r ) -{ - /* - - bit description - - 0 _READY DRIVE 1 - 1 _TRACK 00 - 2 _FAULT - 3 _SECTOR - 4 _READY DRIVE 2 - 5 _WRITE PROTECT - 6 - 7 _INDEX - - */ - - return (m_fdc_index << 7); -} - -WRITE8_MEMBER( c1pmf_state::osi470_pia_pa_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 drive select - 7 - - */ -} - -WRITE8_MEMBER( c1pmf_state::osi470_pia_pb_w ) -{ - /* - - bit description - - 0 _WRITE ENABLE - 1 _ERASE ENABLE - 2 _STEP IN - 3 _STEP - 4 _FAULT RESET - 5 side select - 6 _LOW CURRENT - 7 _HEAD LOAD - - */ -} - -WRITE_LINE_MEMBER( c1pmf_state::osi470_pia_cb2_w ) -{ -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( osi600_mem, AS_PROGRAM, 8, sb2m600_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") - AM_RANGE(0xa000, 0xbfff) AM_ROM - AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0xdf00, 0xdf00) AM_READWRITE(keyboard_r, keyboard_w) - AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("acia_0", acia6850_device, status_r, control_w) - AM_RANGE(0xf001, 0xf001) AM_DEVREADWRITE("acia_0", acia6850_device, data_r, data_w) - AM_RANGE(0xf800, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( uk101_mem, AS_PROGRAM, 8, uk101_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") - AM_RANGE(0xa000, 0xbfff) AM_ROM - AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0xd400, 0xd7ff) AM_NOP // bios sets this to spaces at boot - AM_RANGE(0xdc00, 0xdfff) AM_READ(keyboard_r) AM_WRITE(keyboard_w) - AM_RANGE(0xf000, 0xf000) AM_MIRROR(0x00fe) AM_DEVREADWRITE("acia_0", acia6850_device, status_r, control_w) - AM_RANGE(0xf001, 0xf001) AM_MIRROR(0x00fe) AM_DEVREADWRITE("acia_0", acia6850_device, data_r, data_w) - AM_RANGE(0xf800, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c1p_mem, AS_PROGRAM, 8, c1p_state ) - AM_RANGE(0x0000, 0x4fff) AM_RAMBANK("bank1") - AM_RANGE(0xa000, 0xbfff) AM_ROM - AM_RANGE(0xc704, 0xc707) AM_DEVREADWRITE("pia_1", pia6821_device, read, write) - AM_RANGE(0xc708, 0xc70b) AM_DEVREADWRITE("pia_2", pia6821_device, read, write) - AM_RANGE(0xc70c, 0xc70f) AM_DEVREADWRITE("pia_3", pia6821_device, read, write) - AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_SHARE("color_ram") - AM_RANGE(0xd800, 0xd800) AM_WRITE(ctrl_w) - AM_RANGE(0xdf00, 0xdf00) AM_READWRITE(keyboard_r, keyboard_w) - AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("acia_0", acia6850_device, status_r, control_w) - AM_RANGE(0xf001, 0xf001) AM_DEVREADWRITE("acia_0", acia6850_device, data_r, data_w) - AM_RANGE(0xf7c0, 0xf7c0) AM_WRITE(osi630_sound_w) - AM_RANGE(0xf7e0, 0xf7e0) AM_WRITE(osi630_ctrl_w) - AM_RANGE(0xf800, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c1pmf_mem, AS_PROGRAM, 8, c1pmf_state ) - AM_RANGE(0x0000, 0x4fff) AM_RAMBANK("bank1") - AM_RANGE(0xa000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc003) AM_DEVREADWRITE("pia_0", pia6821_device, read, write) // FDC - AM_RANGE(0xc010, 0xc010) AM_DEVREADWRITE("acia_1", acia6850_device, status_r, control_w) - AM_RANGE(0xc011, 0xc011) AM_DEVREADWRITE("acia_1", acia6850_device, data_r, data_w) - AM_RANGE(0xc704, 0xc707) AM_DEVREADWRITE("pia_1", pia6821_device, read, write) - AM_RANGE(0xc708, 0xc70b) AM_DEVREADWRITE("pia_2", pia6821_device, read, write) - AM_RANGE(0xc70c, 0xc70f) AM_DEVREADWRITE("pia_3", pia6821_device, read, write) - AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_SHARE("color_ram") - AM_RANGE(0xd800, 0xd800) AM_WRITE(ctrl_w) - AM_RANGE(0xdf00, 0xdf00) AM_READWRITE(keyboard_r, keyboard_w) - AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("acia_0", acia6850_device, status_r, control_w) - AM_RANGE(0xf001, 0xf001) AM_DEVREADWRITE("acia_0", acia6850_device, data_r, data_w) - AM_RANGE(0xf7c0, 0xf7c0) AM_WRITE(osi630_sound_w) - AM_RANGE(0xf7e0, 0xf7e0) AM_WRITE(osi630_ctrl_w) - AM_RANGE(0xf800, 0xffff) AM_ROM -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( osi600 ) - PORT_START("ROW0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TAB) PORT_CHAR(27) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("ROW3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - - PORT_START("ROW4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("ROW5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(10) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("ROW6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUB OUT") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("ROW7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("Sound") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_TOGGLE - - PORT_START("Reset") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) -INPUT_PORTS_END - -static INPUT_PORTS_START( uk101 ) - PORT_INCLUDE(osi600) - - PORT_MODIFY("ROW0") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') - - PORT_MODIFY("ROW5") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') -INPUT_PORTS_END - -/* Machine Start */ - -WRITE_LINE_MEMBER( sb2m600_state::write_cassette_clock ) -{ - m_acia_0->write_rxd((m_cassette->input() > 0.0) ? 1 : 0); - - m_acia_0->write_txc(state); - m_acia_0->write_rxc(state); -} - -WRITE_LINE_MEMBER( sb2m600_state::cassette_tx ) -{ - m_cassette->output(state ? +1.0 : -1.0); -} - -void sb2m600_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* configure RAM banking */ - membank("bank1")->configure_entry(0, memregion(M6502_TAG)->base()); - membank("bank1")->set_entry(0); - - switch (m_ram->size()) - { - case 4*1024: - program.install_readwrite_bank(0x0000, 0x0fff, "bank1"); - program.unmap_readwrite(0x1000, 0x1fff); - break; - - case 8*1024: - program.install_readwrite_bank(0x0000, 0x1fff, "bank1"); - break; - } - - /* register for state saving */ - save_item(NAME(m_keylatch)); - save_pointer(NAME(m_video_ram.target()), OSI600_VIDEORAM_SIZE); -} - -void c1p_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* configure RAM banking */ - membank("bank1")->configure_entry(0, memregion(M6502_TAG)->base()); - membank("bank1")->set_entry(0); - - switch (m_ram->size()) - { - case 8*1024: - program.install_readwrite_bank(0x0000, 0x1fff, "bank1"); - program.unmap_readwrite(0x2000, 0x4fff); - break; - - case 20*1024: - program.install_readwrite_bank(0x0000, 0x4fff, "bank1"); - break; - } - - /* register for state saving */ - save_item(NAME(m_keylatch)); - save_item(NAME(m_32)); - save_item(NAME(m_coloren)); - save_pointer(NAME(m_video_ram.target()), OSI600_VIDEORAM_SIZE); - save_pointer(NAME(m_color_ram.target()), OSI630_COLORRAM_SIZE); -} - -void c1pmf_state::machine_start() -{ - c1p_state::machine_start(); - - // drive select logic missing - if (m_floppy0->get_device()) - m_floppy0->get_device()->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(sb2m600_state::floppy_index_callback), this)); -} - -// disk format: 1 head, 36 tracks (? - manual displays a directory listing with 40 tracks), -// 10 sectors, 256 byte sector length, first sector id 0 -static SLOT_INTERFACE_START( osi_floppies ) - SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) -SLOT_INTERFACE_END - -/* F4 Character Displayer */ -static const gfx_layout osi_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( osi ) - GFXDECODE_ENTRY( "chargen", 0x0000, osi_charlayout, 0, 1 ) -GFXDECODE_END - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( osi600, sb2m600_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M6502_TAG, M6502, X1/4) // .98304 MHz - MCFG_CPU_PROGRAM_MAP(osi600_mem) - - /* video hardware */ - MCFG_FRAGMENT_ADD(osi600_video) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", osi) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(osi600_discrete_interface) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* cassette ACIA */ - MCFG_DEVICE_ADD("acia_0", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(sb2m600_state, cassette_tx)) - - MCFG_DEVICE_ADD("cassette_clock", CLOCK, X1/32) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sb2m600_state, write_cassette_clock)) - - /* cassette */ - MCFG_CASSETTE_ADD("cassette") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("8K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( uk101, uk101_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M6502_TAG, M6502, UK101_X1/8) // 1 MHz - MCFG_CPU_PROGRAM_MAP(uk101_mem) - - /* video hardware */ - MCFG_FRAGMENT_ADD(uk101_video) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", osi) - - /* cassette ACIA */ - MCFG_DEVICE_ADD("acia_0", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(sb2m600_state, cassette_tx)) - - MCFG_DEVICE_ADD("cassette_clock", CLOCK, 500000) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sb2m600_state, write_cassette_clock)) - - /* cassette */ - MCFG_CASSETTE_ADD("cassette") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("8K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( c1p, c1p_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M6502_TAG, M6502, X1/4) // .98304 MHz - MCFG_CPU_PROGRAM_MAP(c1p_mem) - - /* video hardware */ - MCFG_FRAGMENT_ADD(osi630_video) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", osi) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(osi600c_discrete_interface) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_DEVICE_ADD("pia_1", PIA6821, 0) - MCFG_DEVICE_ADD("pia_2", PIA6821, 0) - MCFG_DEVICE_ADD("pia_3", PIA6821, 0) - - /* cassette ACIA */ - MCFG_DEVICE_ADD("acia_0", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(sb2m600_state, cassette_tx)) - - MCFG_DEVICE_ADD("cassette_clock", CLOCK, X1/32) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sb2m600_state, write_cassette_clock)) - - /* cassette */ - MCFG_CASSETTE_ADD("cassette") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_RAM_EXTRA_OPTIONS("20K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( c1pmf, c1p, c1pmf_state ) - MCFG_CPU_MODIFY(M6502_TAG) - MCFG_CPU_PROGRAM_MAP(c1pmf_mem) - - MCFG_DEVICE_ADD("pia_0", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(c1pmf_state, osi470_pia_pa_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(c1pmf_state, osi470_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(c1pmf_state, osi470_pia_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(c1pmf_state, osi470_pia_cb2_w)) - - /* floppy ACIA */ - MCFG_DEVICE_ADD("acia_1", ACIA6850, 0) - - MCFG_DEVICE_ADD("floppy_clock", CLOCK, XTAL_4MHz/8) // 250 kHz - MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("acia_1", acia6850_device, write_txc)) - - MCFG_FLOPPY_DRIVE_ADD("floppy0", osi_floppies, "ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("floppy1", osi_floppies, NULL, floppy_image_device::default_floppy_formats) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("20K") -MACHINE_CONFIG_END - -/* ROMs */ - - - -ROM_START( sb2m600b ) - ROM_REGION( 0x10000, M6502_TAG, 0 ) - ROM_LOAD( "basus01.u9", 0xa000, 0x0800, CRC(f4f5dec0) SHA1(b41bf24b4470b6e969d32fe48d604637276f846e) ) - ROM_LOAD( "basus02.u10", 0xa800, 0x0800, CRC(0039ef6a) SHA1(1397f0dc170c16c8e0c7d02e63099e986e86385b) ) - ROM_LOAD( "basus04.u12", 0xb800, 0x0800, CRC(8ee6030e) SHA1(71f210163e4268cba2dd78a97c4d8f5dcebf980e) ) - ROM_LOAD( "monde01.u13", 0xf800, 0x0800, CRC(95a44d2e) SHA1(4a0241c4015b94c436d0f0f58b3dd9d5207cd847) ) // also known as syn600.rom - ROM_SYSTEM_BIOS(0, "original", "Original") - ROMX_LOAD("basus03.u11", 0xb000, 0x0800, CRC(ca25f8c1) SHA1(f5e8ee93a5e0656657d0cc60ef44e8a24b8b0a80), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "fixed", "Fixed") - ROMX_LOAD( "basic3.rom", 0xb000, 0x0800, CRC(ac37d575) SHA1(11407eb24d1ba7afb889b7677c987e8be1a61aab), ROM_BIOS(2) ) - - ROM_REGION( 0x0800, "chargen",0) - ROM_LOAD( "chgsup2.u41", 0x0000, 0x0800, CRC(735f5e0a) SHA1(87c6271497c5b00a974d905766e91bb965180594) ) - - ROM_REGION( 0x0800, "user1",0) - // Another bios rom - ROM_LOAD( "c2 c4 synmon.rom", 0x0000, 0x0800, CRC(03cdbcc5) SHA1(5426ae14522ef485b6089472011db0ae1d192630) ) -ROM_END - -// same roms are used in Challenger 2P and 4P -#define rom_c1p rom_sb2m600b -#define rom_c1pmf rom_sb2m600b - -ROM_START( uk101 ) - ROM_REGION( 0x10000, M6502_TAG, 0 ) - ROM_LOAD( "basuk01.ic9", 0xa000, 0x0800, CRC(9d3caa92) SHA1(b2c3d1af0c4f3cead1dbd44aaf5a11680880f772) ) - ROM_LOAD( "basus02.ic10", 0xa800, 0x0800, CRC(0039ef6a) SHA1(1397f0dc170c16c8e0c7d02e63099e986e86385b) ) - ROM_LOAD( "basuk03.ic11", 0xb000, 0x0800, CRC(0d011242) SHA1(54bd33522a5d1991086eeeff3a4f73c026be45b6) ) - ROM_LOAD( "basuk04.ic12", 0xb800, 0x0800, CRC(667223e8) SHA1(dca78be4b98317413376d69119942d692e39575a) ) - // This monitor came from another emulator and works well on the 64x16 screen - ROM_LOAD( "monuk02.ic13", 0xf800, 0x0800, CRC(e5b7028d) SHA1(74f0934014fdf83d33c8d3579e562b53c0683270) ) - // This monitor is for a 32x32 screen, and could be the prototype referred to in Practical Electronics - //ROM_LOAD( "monuk02.ic13", 0xf800, 0x0800, CRC(04ac5822) SHA1(2bbbcd0ca18103fd68afcf64a7483653b925d83e) ) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "chguk101.ic41", 0x0000, 0x0800, CRC(fce2c84a) SHA1(baa66a7a48e4d62282671ef53abfaf450b888b70) ) -ROM_END - -/* Driver Initialization */ - -void sb2m600_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_SETUP_BEEP: - m_beeper->set_state(0); - m_beeper->set_frequency(300); - break; - default: - assert_always(FALSE, "Unknown id in sb2m600_state::device_timer"); - } -} - -DRIVER_INIT_MEMBER(c1p_state,c1p) -{ - timer_set(attotime::zero, TIMER_SETUP_BEEP); -} - - -/* System Drivers */ - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME -COMP( 1978, sb2m600b, 0, 0, osi600, osi600, driver_device, 0, "Ohio Scientific", "Superboard II Model 600 (Rev. B)", MACHINE_NOT_WORKING) -//COMP( 1980, sb2m600c, 0, 0, osi600c, osi600, driver_device, 0, "Ohio Scientific", "Superboard II Model 600 (Rev. C)", MACHINE_NOT_WORKING) -COMP( 1980, c1p, sb2m600b, 0, c1p, osi600, c1p_state, c1p, "Ohio Scientific", "Challenger 1P Series 2", MACHINE_NOT_WORKING) -COMP( 1980, c1pmf, sb2m600b, 0, c1pmf, osi600, c1p_state, c1p, "Ohio Scientific", "Challenger 1P MF Series 2", MACHINE_NOT_WORKING) -COMP( 1979, uk101, sb2m600b, 0, uk101, uk101, driver_device, 0, "Compukit", "UK101", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/p112.c b/src/mess/drivers/p112.c deleted file mode 100644 index 30b81997663..00000000000 --- a/src/mess/drivers/p112.c +++ /dev/null @@ -1,128 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - P112 Single Board Computer - - 30/08/2010 Skeleton driver - -The P112 is a stand-alone 8-bit CPU board. Typically running CP/M (tm) or a -similar operating system, it provides a Z80182 (Z-80 upgrade) CPU with up to -1MB of memory, serial, parallel and diskette IO, and realtime clock, in a -3.5-inch drive form factor. Powered solely from 5V, it draws 150mA (nominal: -not including disk drives) with a 16MHz CPU clock. Clock speeds up to 24.576MHz -are possible. - -http://members.iinet.net.au/~daveb/p112/p112.html - -Some of the parts: - 32kHz crystal 1 Y2 (RTC crystal) - 16MHz crystal 1 Y1 Parallel resonant (CPU clock) - 24MHz crystal 1 Y3 Parallel resonant (IO chip clock) - 28F256A 1 U4 (Intel Flash ROM, programmed) - 74HCT00 1 U5 - 74ACT02 1 U8 - 74ACT139 1 U11 - 62256 2 U2 U3 (Static RAM, 32kB) - DS1202 1 U6 (Dallas RTC chip) - FDC37C665IR 1 U9 (SMC Super-IO chip) - LT1133 2 U7 U10 (Linear Technology RS232 Tx/Rx) - NMF0512S 1 U12 (Newport Components Flash ROM power) - TL7705ACP 1 U15 (Texas Insts. Reset genr.) - Z8018216 1 U1 (Zilog CPU chip) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z180/z180.h" - - -class p112_state : public driver_device -{ -public: - p112_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_p112(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(p112_mem, AS_PROGRAM, 8, p112_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x07fff) AM_ROM - AM_RANGE(0x08000, 0xfffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(p112_io, AS_IO, 8, p112_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( p112 ) -INPUT_PORTS_END - - -void p112_state::machine_reset() -{ -} - -void p112_state::video_start() -{ -} - -UINT32 p112_state::screen_update_p112(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( p112, p112_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z180, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(p112_mem) - MCFG_CPU_IO_MAP(p112_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(240, 320) - MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 320-1) - MCFG_SCREEN_UPDATE_DRIVER(p112_state, screen_update_p112) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( p112 ) - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "960513", "ver 13-05-1996" ) - ROMX_LOAD( "960513.bin", 0x00000, 0x8000, CRC(077c1c40) SHA1(c1e6b4b0de50bba90f0d4667f9344815bb578b9b), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "970308", "ver 08-03-1997" ) - ROMX_LOAD( "970308.bin", 0x00000, 0x8000, CRC(15e61f0d) SHA1(66ba1af7da0450b69650086ab20230390ba23e17), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "4b1", "ver 4b1" ) - ROMX_LOAD( "romv4b1.bin", 0x00000, 0x8000, CRC(15d79beb) SHA1(f971f75a717e3f6d59b257eb3af369d4d2e0f301), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "4b2", "ver 4b2" ) - ROMX_LOAD( "romv4b2.bin", 0x00000, 0x8000, CRC(9b9a8a5e) SHA1(c40151ee654008b9f803d6a05d692a5a3619a726), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "4b3", "ver 4b3" ) - ROMX_LOAD( "romv4b3.bin", 0x00000, 0x8000, CRC(734031ea) SHA1(2e5e5ac6bd17d15cab24a36bc3da42ca49cbde92), ROM_BIOS(5)) - ROM_SYSTEM_BIOS( 5, "4b4", "ver 4b4" ) - ROMX_LOAD( "romv4b4.bin", 0x00000, 0x8000, CRC(cd419c40) SHA1(6002130d874387c9ec23b4363fe9f0ca78208878), ROM_BIOS(6)) - ROM_SYSTEM_BIOS( 6, "5", "ver 5" ) - ROMX_LOAD( "051103.bin", 0x00000, 0x8000, CRC(6c47ec13) SHA1(24f5bf1524425186fe10e1d29d05f6efbd3366d9), ROM_BIOS(7)) - ROM_SYSTEM_BIOS( 7, "5b1", "ver 5b1" ) - ROMX_LOAD( "romv5b1.bin", 0x00000, 0x8000, CRC(047296f7) SHA1(380f8e4237525636c605b7e37d989ace8437beb4), ROM_BIOS(8)) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1996, p112, 0, 0, p112, p112, driver_device, 0, "Dave Brooks", "P112", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/p2000t.c b/src/mess/drivers/p2000t.c deleted file mode 100644 index 303092f96a1..00000000000 --- a/src/mess/drivers/p2000t.c +++ /dev/null @@ -1,291 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels -/************************************************************************ -Philips P2000 1 Memory map - - CPU: Z80 - 0000-0fff ROM - 1000-4fff ROM (appl) - 5000-57ff RAM (Screen T ver) - 5000-5fff RAM (Screen M ver) - 6000-9fff RAM (system) - a000-ffff RAM (extension) - - Interrupts: - - Ports: - 00-09 Keyboard input - 10-1f Output ports - 20-2f Input ports - 30-3f Scroll reg (T ver) - 50-5f Beeper - 70-7f DISAS (M ver) - 88-8B CTC - 8C-90 Floppy ctrl - 94 RAM Bank select - - Display: SAA5050 - -************************************************************************/ - -#include "includes/p2000t.h" - - -/* port i/o functions */ -static ADDRESS_MAP_START( p2000t_io, AS_IO, 8, p2000t_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x0f) AM_READ(p2000t_port_000f_r) - AM_RANGE(0x10, 0x1f) AM_WRITE(p2000t_port_101f_w) - AM_RANGE(0x20, 0x2f) AM_READ(p2000t_port_202f_r) - AM_RANGE(0x30, 0x3f) AM_WRITE(p2000t_port_303f_w) - AM_RANGE(0x50, 0x5f) AM_WRITE(p2000t_port_505f_w) - AM_RANGE(0x70, 0x7f) AM_WRITE(p2000t_port_707f_w) - AM_RANGE(0x88, 0x8b) AM_WRITE(p2000t_port_888b_w) - AM_RANGE(0x8c, 0x90) AM_WRITE(p2000t_port_8c90_w) - AM_RANGE(0x94, 0x94) AM_WRITE(p2000t_port_9494_w) -ADDRESS_MAP_END - -/* Memory w/r functions */ -static ADDRESS_MAP_START( p2000t_mem, AS_PROGRAM, 8, p2000t_state ) - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0x4fff) AM_ROM - AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x5800, 0x9fff) AM_RAM - AM_RANGE(0xa000, 0xffff) AM_NOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START( p2000m_mem, AS_PROGRAM, 8, p2000t_state ) - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0x4fff) AM_ROM - AM_RANGE(0x5000, 0x5fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x6000, 0x9fff) AM_RAM - AM_RANGE(0xa000, 0xffff) AM_NOP -ADDRESS_MAP_END - -/* graphics output */ - -static const gfx_layout p2000m_charlayout = -{ - 6, 10, - 256, - 1, - { 0 }, - { 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, - 5*8, 6*8, 7*8, 8*8, 9*8 }, - 8 * 10 -}; - -PALETTE_INIT_MEMBER(p2000t_state,p2000m) -{ - palette.set_pen_color(0,rgb_t::white); /* white */ - palette.set_pen_color(1,rgb_t::black); /* black */ - palette.set_pen_color(2,rgb_t::black); /* black */ - palette.set_pen_color(3,rgb_t::white); /* white */ -} - -static GFXDECODE_START( p2000m ) - GFXDECODE_ENTRY( "gfx1", 0x0000, p2000m_charlayout, 0, 2 ) -GFXDECODE_END - -/* Keyboard input */ - -/* 2008-05 FP: -TO DO: verify position of the following keys: '1/4 3/4', '-> <-', '@ up', 'Clrln' -Also, notice that pictures of p2000 units shows slightly different key mappings, suggesting -many different .chr roms could exist - -Small note about natural keyboard support: currently, -- "Keypad 00" and "Keypad ," are not mapped -- "Code" is mapped to 'F1' -- "Clrln" is mapped to 'F2' -*/ - -static INPUT_PORTS_START (p2000t) - PORT_START("KEY.0") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - - PORT_START("KEY.1") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - - PORT_START("KEY.2") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("# \xE2\x96\xAA") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("KEY.3") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("KEY.4") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Code") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - - PORT_START("KEY.5") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clrln") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0xFF0D) - - PORT_START("KEY.6") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xE2\x86\x91") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - - PORT_START("KEY.7") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92 \xE2\x86\x90") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - - PORT_START("KEY.8") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00BC) PORT_CHAR(0x00BE) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - - PORT_START("KEY.9") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N/C") - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - - -INTERRUPT_GEN_MEMBER(p2000t_state::p2000_interrupt) -{ - m_maincpu->set_input_line(0, HOLD_LINE); -} - -READ8_MEMBER( p2000t_state::videoram_r ) -{ - return m_videoram[offset]; -} - -/* Machine definition */ -static MACHINE_CONFIG_START( p2000t, p2000t_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 2500000) - MCFG_CPU_PROGRAM_MAP(p2000t_mem) - MCFG_CPU_IO_MAP(p2000t_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", p2000t_state, p2000_interrupt) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(40 * 12, 24 * 20) - MCFG_SCREEN_VISIBLE_AREA(0, 40 * 12 - 1, 0, 24 * 20 - 1) - MCFG_SCREEN_UPDATE_DEVICE("saa5050", saa5050_device, screen_update) - - MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000) - MCFG_SAA5050_D_CALLBACK(READ8(p2000t_state, videoram_r)) - MCFG_SAA5050_SCREEN_SIZE(40, 24, 80) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - -/* Machine definition */ -static MACHINE_CONFIG_START( p2000m, p2000t_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 2500000) - MCFG_CPU_PROGRAM_MAP(p2000m_mem) - MCFG_CPU_IO_MAP(p2000t_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", p2000t_state, p2000_interrupt) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(80 * 12, 24 * 20) - MCFG_SCREEN_VISIBLE_AREA(0, 80 * 12 - 1, 0, 24 * 20 - 1) - MCFG_VIDEO_START_OVERRIDE(p2000t_state,p2000m) - MCFG_SCREEN_UPDATE_DRIVER(p2000t_state, screen_update_p2000m) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", p2000m ) - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(p2000t_state,p2000m) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - -ROM_START(p2000t) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("p2000.rom", 0x0000, 0x1000, CRC(650784a3) SHA1(4dbb28adad30587f2ea536ba116898d459faccac)) - ROM_LOAD("basic.rom", 0x1000, 0x4000, CRC(9d9d38f9) SHA1(fb5100436c99634a2592a10dff867f85bcff7aec)) -ROM_END - -ROM_START(p2000m) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("p2000.rom", 0x0000, 0x1000, CRC(650784a3) SHA1(4dbb28adad30587f2ea536ba116898d459faccac)) - ROM_LOAD("basic.rom", 0x1000, 0x4000, CRC(9d9d38f9) SHA1(fb5100436c99634a2592a10dff867f85bcff7aec)) - - ROM_REGION(0x01000, "gfx1",0) - ROM_LOAD("p2000.chr", 0x0140, 0x08c0, BAD_DUMP CRC(78c17e3e) SHA1(4e1c59dc484505de1dc0b1ba7e5f70a54b0d4ccc)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1980, p2000t, 0, 0, p2000t, p2000t, driver_device, 0, "Philips", "Philips P2000T", 0) -COMP ( 1980, p2000m, p2000t, 0, p2000m, p2000t, driver_device, 0, "Philips", "Philips P2000M", 0) diff --git a/src/mess/drivers/p8k.c b/src/mess/drivers/p8k.c deleted file mode 100644 index c4f326f76c7..00000000000 --- a/src/mess/drivers/p8k.c +++ /dev/null @@ -1,595 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Fabio Priuli -/*************************************************************************** - - P8000 - - 09/2009 Skeleton driver based on Matt Knoth's emulator. - P8000emu (http://knothusa.net/Home.php) has been a great source of info. - Other info from - * http://www.pofo.de/P8000/notes/books/ - * http://www.pofo.de/P8000/ - - P8000 memory layout - * divided into 3 banks of 64k - * bank A is for roms, only 0000-1FFF is populated - * bank B is for static ram, only 2000-2FFF exists - * bank C is for dynamic ram, all 64k is available. - * selection is done with OUT(c), code - * code = 0 for do nothing; 1 = bank A; 2 = bank B; 4 = bank C. - * Reg C = 0; Reg B = start address of memory that is being switched, - for example B = 20 indicates "bank2" in memory map, and also the - corresponding address in bank A/B/C. - - P8000 monitor commands - * B : ? - * D : display and modify memory - * F : fill memory - * G : go to - * M : move (copy) memory - * N : dump registers - * O : boot from floppy - * P : ? - * Q : ? - * R : dump registers - * S : boot from floppy - * T : jump to ROM at CEF0 - * X : jump to ROM at DB00 - * return : boot from floppy disk - - P8000_16 : All input must be in uppercase. - - TODO: - * properly implement Z80 daisy chain in 16 bit board - * Find out how to enter hardware check on 16 bit board - * hook the sio back up when it becomes usable - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z8000/z8000.h" -#include "cpu/z80/z80daisy.h" -#include "machine/upd765.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "machine/z80dma.h" -#include "sound/beep.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class p8k_state : public driver_device -{ -public: - p8k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_READ8_MEMBER(p8k_port0_r); - DECLARE_WRITE8_MEMBER(p8k_port0_w); - DECLARE_READ8_MEMBER(p8k_port24_r); - DECLARE_WRITE8_MEMBER(p8k_port24_w); - DECLARE_READ16_MEMBER(portff82_r); - DECLARE_WRITE16_MEMBER(portff82_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE8_MEMBER(kbd_put_16); - UINT8 m_term_data; - required_device m_maincpu; - required_device m_terminal; - DECLARE_DRIVER_INIT(p8k); - DECLARE_MACHINE_RESET(p8k); - DECLARE_MACHINE_RESET(p8k_16); - - DECLARE_WRITE_LINE_MEMBER(fdc_irq); - - virtual void machine_start(); - - DECLARE_WRITE_LINE_MEMBER( p8k_daisy_interrupt ); - DECLARE_WRITE_LINE_MEMBER( p8k_dma_irq_w ); - DECLARE_WRITE_LINE_MEMBER( p8k_16_daisy_interrupt ); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); -}; - -/*************************************************************************** - - P8000 8bit - -****************************************************************************/ - -static ADDRESS_MAP_START(p8k_memmap, AS_PROGRAM, 8, p8k_state) - AM_RANGE(0x0000, 0x0FFF) AM_RAMBANK("bank0") - AM_RANGE(0x1000, 0x1FFF) AM_RAMBANK("bank1") - AM_RANGE(0x2000, 0x2FFF) AM_RAMBANK("bank2") - AM_RANGE(0x3000, 0x3FFF) AM_RAMBANK("bank3") - AM_RANGE(0x4000, 0x4FFF) AM_RAMBANK("bank4") - AM_RANGE(0x5000, 0x5FFF) AM_RAMBANK("bank5") - AM_RANGE(0x6000, 0x6FFF) AM_RAMBANK("bank6") - AM_RANGE(0x7000, 0x7FFF) AM_RAMBANK("bank7") - AM_RANGE(0x8000, 0x8FFF) AM_RAMBANK("bank8") - AM_RANGE(0x9000, 0x9FFF) AM_RAMBANK("bank9") - AM_RANGE(0xA000, 0xAFFF) AM_RAMBANK("bank10") - AM_RANGE(0xB000, 0xBFFF) AM_RAMBANK("bank11") - AM_RANGE(0xC000, 0xCFFF) AM_RAMBANK("bank12") - AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK("bank13") - AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK("bank14") - AM_RANGE(0xF000, 0xFFFF) AM_RAMBANK("bank15") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(p8k_iomap, AS_IO, 8, p8k_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x07) AM_READWRITE(p8k_port0_r,p8k_port0_w) // MH7489 - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80ctc_0", z80ctc_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80pio_0", z80pio_device, read_alt, write_alt) - AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("z80pio_1", z80pio_device, read_alt, write_alt) - AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_2", z80pio_device, read_alt, write_alt) - AM_RANGE(0x20, 0x21) AM_DEVICE("i8272", i8272a_device, map) - //AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("z80sio_0", z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x24, 0x27) AM_READWRITE(p8k_port24_r,p8k_port24_w) - AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("z80sio_1", z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80ctc_1", z80ctc_device, read, write) - AM_RANGE(0x3c, 0x3c) AM_DEVREADWRITE("z80dma", z80dma_device, read, write) -ADDRESS_MAP_END - - - -READ8_MEMBER( p8k_state::p8k_port0_r ) -{ - return 0; -} - -// see memory explanation above -WRITE8_MEMBER( p8k_state::p8k_port0_w ) -{ - UINT8 breg = m_maincpu->state_int(Z80_B) >> 4; - if ((data==1) || (data==2) || (data==4)) - { - char banknum[8]; - sprintf(banknum,"bank%d", breg); - - offset = 0; - if (data==2) - offset = 16; - else - if (data==4) - offset = 32; - - offset += breg; - - membank(banknum)->set_entry(offset); - } - else - if (data) - printf("Invalid data %X for bank %d\n",data,breg); -} - -READ8_MEMBER( p8k_state::p8k_port24_r ) -{ - if (offset == 3) - return 0xff; - if (offset == 2) - return m_term_data; - - return 0; -} - -WRITE8_MEMBER( p8k_state::p8k_port24_w ) -{ - if (offset == 2) - m_terminal->write(space, 0, data); -} - -WRITE8_MEMBER( p8k_state::kbd_put ) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - m_term_data = data; - // This is a dreadful hack.. - // simulate interrupt by saving current pc on - // the stack and jumping to interrupt handler. - UINT16 spreg = m_maincpu->state_int(Z80_SP); - UINT16 pcreg = m_maincpu->state_int(Z80_PC); - spreg--; - mem.write_byte(spreg, pcreg >> 8); - spreg--; - mem.write_byte(spreg, pcreg); - m_maincpu->set_state_int(Z80_SP, spreg); - m_maincpu->set_state_int(Z80_PC, 0x078A); -} - -/*************************************************************************** - - P8000 8bit Peripherals - -****************************************************************************/ - -WRITE_LINE_MEMBER( p8k_state::p8k_daisy_interrupt ) -{ - m_maincpu->set_input_line(0, state); -} - -/* Z80 DMA */ - -WRITE_LINE_MEMBER( p8k_state::p8k_dma_irq_w ) -{ - i8272a_device *i8272 = machine().device("i8272"); - i8272->tc_w(state); - - p8k_daisy_interrupt(state); -} - -READ8_MEMBER(p8k_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(p8k_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - prog_space.write_byte(offset, data); -} - -READ8_MEMBER(p8k_state::io_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(p8k_state::io_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - prog_space.write_byte(offset, data); -} - - -/* Z80 Daisy Chain */ - -static const z80_daisy_config p8k_daisy_chain[] = -{ - { "z80dma" }, /* FDC related */ - { "z80pio_2" }, - { "z80ctc_0" }, - { "z80sio_0" }, - { "z80sio_1" }, - { "z80pio_0" }, - { "z80pio_1" }, - { "z80ctc_1" }, - { NULL } -}; - -/* Intel 8272 Interface */ - -DECLARE_WRITE_LINE_MEMBER( p8k_state::fdc_irq ) -{ - z80pio_device *z80pio = machine().device("z80pio_2"); - - z80pio->port_b_write(state ? 0x10 : 0x00); -} - -void p8k_state::machine_start() -{ -} - -static SLOT_INTERFACE_START( p8k_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -/* Input ports */ -static INPUT_PORTS_START( p8k ) - PORT_START("DSW") - PORT_BIT( 0x7f, 0x7f, IPT_UNUSED ) - PORT_DIPNAME( 0x80, 0x00, "Hardware Test") - PORT_DIPSETTING( 0x00, DEF_STR(Off)) - PORT_DIPSETTING( 0x80, DEF_STR(On)) -INPUT_PORTS_END - - -MACHINE_RESET_MEMBER(p8k_state,p8k) -{ - membank("bank0")->set_entry(0); - membank("bank1")->set_entry(0); - membank("bank2")->set_entry(0); - membank("bank3")->set_entry(0); - membank("bank4")->set_entry(0); - membank("bank5")->set_entry(0); - membank("bank6")->set_entry(0); - membank("bank7")->set_entry(0); - membank("bank8")->set_entry(0); - membank("bank9")->set_entry(0); - membank("bank10")->set_entry(0); - membank("bank11")->set_entry(0); - membank("bank12")->set_entry(0); - membank("bank13")->set_entry(0); - membank("bank14")->set_entry(0); - membank("bank15")->set_entry(0); -} - -DRIVER_INIT_MEMBER(p8k_state,p8k) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("bank0")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank1")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank2")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank3")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank4")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank5")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank6")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank7")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank8")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank9")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank10")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank11")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank12")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank13")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank14")->configure_entries(0, 48, &RAM[0x0000], 0x1000); - membank("bank15")->configure_entries(0, 48, &RAM[0x0000], 0x1000); -} - - -/*************************************************************************** - - P8000 16bit - -****************************************************************************/ - -WRITE8_MEMBER( p8k_state::kbd_put_16 ) -{ - address_space &mem = m_maincpu->space(AS_DATA); - // keyboard int handler is at 0x0700 - m_term_data = data; - // This is another dire hack.. - UINT8 offs = mem.read_byte(0x43a5); - UINT16 addr = 0x41b0 + (UINT16) offs; - mem.write_byte(addr, data); - mem.write_byte(0x43a0, 1); -} - -MACHINE_RESET_MEMBER(p8k_state,p8k_16) -{ -} - -READ16_MEMBER( p8k_state::portff82_r ) -{ - if (offset == 3) // FF87 - return 0xff; - else - if (offset == 1) // FF83 - return m_term_data; - return 0; -} - -WRITE16_MEMBER( p8k_state::portff82_w ) -{ - if (offset == 1) // FF83 - { - address_space &mem = m_maincpu->space(AS_PROGRAM); - m_terminal->write(mem, 0, data); - } -} - -static ADDRESS_MAP_START(p8k_16_memmap, AS_PROGRAM, 16, p8k_state) - AM_RANGE(0x00000, 0x03fff) AM_ROM AM_SHARE("share0") - AM_RANGE(0x04000, 0x07fff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(p8k_16_datamap, AS_DATA, 16, p8k_state) - AM_RANGE(0x00000, 0x03fff) AM_ROM AM_SHARE("share0") - AM_RANGE(0x04000, 0x07fff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x08000, 0xfffff) AM_RAM AM_SHARE("share2") -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(p8k_16_iomap, AS_IO, 16, p8k_state) -// AM_RANGE(0x0fef0, 0x0feff) // clock - //AM_RANGE(0x0ff80, 0x0ff87) AM_DEVREADWRITE8("z80sio_0", z80sio0_device, ba_cd_r, ba_cd_w, 0xff) - AM_RANGE(0x0ff80, 0x0ff87) AM_READWRITE(portff82_r,portff82_w) - AM_RANGE(0x0ff88, 0x0ff8f) AM_DEVREADWRITE8("z80sio_1", z80sio0_device, ba_cd_r, ba_cd_w, 0xff) //"z80sio_1", - AM_RANGE(0x0ff90, 0x0ff97) AM_DEVREADWRITE8("z80pio_0", z80pio_device, read_alt, write_alt, 0xff) //"z80pio_0", - AM_RANGE(0x0ff98, 0x0ff9f) AM_DEVREADWRITE8("z80pio_1", z80pio_device, read_alt, write_alt, 0xff) //"z80pio_1", - AM_RANGE(0x0ffa0, 0x0ffa7) AM_DEVREADWRITE8("z80pio_2", z80pio_device, read_alt, write_alt, 0xff) //"z80pio_2", - AM_RANGE(0x0ffa8, 0x0ffaf) AM_DEVREADWRITE8("z80ctc_0", z80ctc_device, read, write, 0xff) //"z80ctc_0", - AM_RANGE(0x0ffb0, 0x0ffb7) AM_DEVREADWRITE8("z80ctc_1", z80ctc_device, read, write, 0xff) //"z80ctc_1", -// AM_RANGE(0x0ffc0, 0x0ffc1) // SCR -// AM_RANGE(0x0ffc8, 0x0ffc9) // SBR -// AM_RANGE(0x0ffd0, 0x0ffd1) // NBR -// AM_RANGE(0x0ffd8, 0x0ffd9) // SNVR -// AM_RANGE(0x0ffe0, 0x0ffe1) // RETI -// AM_RANGE(0x0fff0, 0x0fff1) // TRPL -// AM_RANGE(0x0fff8, 0x0fff9) // IF1L -ADDRESS_MAP_END - - -/*************************************************************************** - - P8000 16bit Peripherals - -****************************************************************************/ - -WRITE_LINE_MEMBER( p8k_state::p8k_16_daisy_interrupt ) -{ - // this must be studied a little bit more :-) -} - - -/* Z80 Daisy Chain */ - -static const z80_daisy_config p8k_16_daisy_chain[] = -{ - { "z80ctc_0" }, - { "z80ctc_1" }, - { "z80sio_0" }, - { "z80sio_1" }, - { "z80pio_0" }, - { "z80pio_1" }, - { "z80pio_2" }, - { NULL } -}; - - - -#if 0 -/* F4 Character Displayer */ -static const gfx_layout p8k_charlayout = -{ - 8, 12, /* 8 x 12 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( p8k ) - GFXDECODE_ENTRY( "chargen", 0x0000, p8k_charlayout, 0, 1 ) -GFXDECODE_END -#endif - - -/*************************************************************************** - - Machine Drivers - -****************************************************************************/ - -static MACHINE_CONFIG_START( p8k, p8k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz ) - MCFG_CPU_CONFIG(p8k_daisy_chain) - MCFG_CPU_PROGRAM_MAP(p8k_memmap) - MCFG_CPU_IO_MAP(p8k_iomap) - MCFG_MACHINE_RESET_OVERRIDE(p8k_state,p8k) - - /* peripheral hardware */ - MCFG_DEVICE_ADD("z80dma", Z80DMA, XTAL_4MHz) - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(p8k_state, p8k_dma_irq_w)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(p8k_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(p8k_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(p8k_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(p8k_state, io_write_byte)) - - MCFG_DEVICE_ADD("z80ctc_0", Z80CTC, 1229000) /* 1.22MHz clock */ - // to implement: callbacks! - // manual states the callbacks should go to - // Baud Gen 3, FDC, System-Kanal - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80ctc_1", Z80CTC, 1229000) /* 1.22MHz clock */ - // to implement: callbacks! - // manual states the callbacks should go to - // Baud Gen 0, Baud Gen 1, Baud Gen 2, - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_Z80SIO0_ADD("z80sio_0", XTAL_4MHz, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO0_ADD("z80sio_1", XTAL_4MHz, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80pio_0", Z80PIO, 1229000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80pio_1", Z80PIO, 1229000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80pio_2", Z80PIO, 1229000) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(IOPORT("DSW")) - - MCFG_I8272A_ADD("i8272", true) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("z80dma", z80dma_device, rdy_w)) - MCFG_FLOPPY_DRIVE_ADD("i8272:0", p8k_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("i8272:1", p8k_floppies, "525hd", floppy_image_device::default_floppy_formats) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(p8k_state, kbd_put)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( p8k_16, p8k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z8001, XTAL_4MHz ) - MCFG_CPU_CONFIG(p8k_16_daisy_chain) - MCFG_CPU_PROGRAM_MAP(p8k_16_memmap) - MCFG_CPU_DATA_MAP(p8k_16_datamap) - MCFG_CPU_IO_MAP(p8k_16_iomap) - MCFG_MACHINE_RESET_OVERRIDE(p8k_state,p8k_16) - - /* peripheral hardware */ - MCFG_DEVICE_ADD("z80ctc_0", Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) - - MCFG_DEVICE_ADD("z80ctc_1", Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) - - MCFG_Z80SIO0_ADD("z80sio_0", XTAL_4MHz, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO0_ADD("z80sio_1", XTAL_4MHz, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80pio_0", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) - - MCFG_DEVICE_ADD("z80pio_1", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) - - MCFG_DEVICE_ADD("z80pio_2", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(WRITELINE(p8k_state, p8k_16_daisy_interrupt)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(p8k_state, kbd_put_16)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( p8000 ) - ROM_REGION( 0x30000, "maincpu", 0 ) - ROM_LOAD("mon8_1_3.1", 0x0000, 0x1000, CRC(ad1bb118) SHA1(2332963acd74d5d1a009d9bce8a2b108de01d2a5)) - ROM_LOAD("mon8_2_3.1", 0x1000, 0x1000, CRC(daced7c2) SHA1(f1f778e72568961b448020fc543ed6e81bbe81b1)) - - // this is for the p8000's terminal, not the p8000 itself - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD("p8t_zs", 0x0000, 0x0800, CRC(f9321251) SHA1(a6a796b58d50ec4a416f2accc34bd76bc83f18ea)) - ROM_LOAD("p8tdzs.2", 0x0800, 0x0800, CRC(32736503) SHA1(6a1d7c55dddc64a7d601dfdbf917ce1afaefbb0a)) -ROM_END - -ROM_START( p8000_16 ) - ROM_REGION16_BE( 0x4000, "maincpu", 0 ) - ROM_LOAD16_BYTE("mon16_1h_3.1_udos", 0x0000, 0x1000, CRC(0c3c28da) SHA1(0cd35444c615b404ebb9cf80da788593e573ddb5)) - ROM_LOAD16_BYTE("mon16_1l_3.1_udos", 0x0001, 0x1000, CRC(e8857bdc) SHA1(f89c65cbc479101130c71806fd3ddc28e6383f12)) - ROM_LOAD16_BYTE("mon16_2h_3.1_udos", 0x2000, 0x1000, CRC(cddf58d5) SHA1(588bad8df75b99580459c7a8e898a3396907e3a4)) - ROM_LOAD16_BYTE("mon16_2l_3.1_udos", 0x2001, 0x1000, CRC(395ee7aa) SHA1(d72fadb1608cd0915cd5ce6440897303ac5a12a6)) - - // this is for the p8000's terminal, not the p8000 itself - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD("p8t_zs", 0x0000, 0x0800, CRC(f9321251) SHA1(a6a796b58d50ec4a416f2accc34bd76bc83f18ea)) - ROM_LOAD("p8tdzs.2", 0x0800, 0x0800, CRC(32736503) SHA1(6a1d7c55dddc64a7d601dfdbf917ce1afaefbb0a)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, p8000, 0, 0, p8k, p8k, p8k_state, p8k, "EAW electronic Treptow", "P8000 (8bit Board)", MACHINE_NOT_WORKING) -COMP( 1989, p8000_16, p8000, 0, p8k_16, p8k, driver_device, 0, "EAW electronic Treptow", "P8000 (16bit Board)", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/palm.c b/src/mess/drivers/palm.c deleted file mode 100644 index 4d593a0b071..00000000000 --- a/src/mess/drivers/palm.c +++ /dev/null @@ -1,504 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz, R. Belmont -/**************************************************************************** - - drivers/palm.c - Palm (MC68328) emulation - - Driver by MooglyGuy - - Additional bug fixing by R. Belmont - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/mc68328.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "debugger.h" -#include "rendlay.h" - -#define MC68328_TAG "dragonball" - -class palm_state : public driver_device -{ -public: - palm_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_lsi(*this, MC68328_TAG), - m_dac(*this, "dac"), - m_ram(*this, RAM_TAG), - m_io_penx(*this, "PENX"), - m_io_peny(*this, "PENY"), - m_io_penb(*this, "PENB"), - m_io_portd(*this, "PORTD") { } - - required_device m_maincpu; - required_device m_lsi; - required_device m_dac; - required_device m_ram; - //DECLARE_WRITE8_MEMBER(palm_dac_transition); - //DECLARE_WRITE8_MEMBER(palm_port_f_out); - //DECLARE_READ8_MEMBER(palm_port_c_in); - //DECLARE_READ8_MEMBER(palm_port_f_in); - //DECLARE_WRITE16_MEMBER(palm_spim_out); - //DECLARE_READ16_MEMBER(palm_spim_in); - UINT8 m_port_f_latch; - UINT16 m_spim_data; - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(pen_check); - DECLARE_INPUT_CHANGED_MEMBER(button_check); - DECLARE_WRITE8_MEMBER(palm_port_f_out); - DECLARE_READ8_MEMBER(palm_port_c_in); - DECLARE_READ8_MEMBER(palm_port_f_in); - DECLARE_WRITE16_MEMBER(palm_spim_out); - DECLARE_READ16_MEMBER(palm_spim_in); - DECLARE_WRITE8_MEMBER(palm_dac_transition); - DECLARE_WRITE_LINE_MEMBER(palm_spim_exchange); - DECLARE_PALETTE_INIT(palm); - - required_ioport m_io_penx; - required_ioport m_io_peny; - required_ioport m_io_penb; - required_ioport m_io_portd; -}; - -static offs_t palm_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); - - -/*************************************************************************** - MACHINE HARDWARE -***************************************************************************/ - -INPUT_CHANGED_MEMBER(palm_state::pen_check) -{ - UINT8 button = m_io_penb->read(); - - if(button) - m_lsi->set_penirq_line(1); - else - m_lsi->set_penirq_line(0); -} - -INPUT_CHANGED_MEMBER(palm_state::button_check) -{ - UINT8 button_state = m_io_portd->read(); - m_lsi->set_port_d_lines(button_state, (int)(FPTR)param); -} - -WRITE8_MEMBER(palm_state::palm_port_f_out) -{ - m_port_f_latch = data; -} - -READ8_MEMBER(palm_state::palm_port_c_in) -{ - return 0x10; -} - -READ8_MEMBER(palm_state::palm_port_f_in) -{ - return m_port_f_latch; -} - -WRITE16_MEMBER(palm_state::palm_spim_out) -{ - m_spim_data = data; -} - -READ16_MEMBER(palm_state::palm_spim_in) -{ - return m_spim_data; -} - -WRITE_LINE_MEMBER(palm_state::palm_spim_exchange) -{ - UINT8 x = m_io_penx->read(); - UINT8 y = m_io_peny->read(); - - switch (m_port_f_latch & 0x0f) - { - case 0x06: - m_spim_data = (0xff - x) * 2; - break; - - case 0x09: - m_spim_data = (0xff - y) * 2; - break; - } -} - -void palm_state::machine_start() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - space.install_read_bank (0x000000, m_ram->size() - 1, m_ram->size() - 1, 0, "bank1"); - space.install_write_bank(0x000000, m_ram->size() - 1, m_ram->size() - 1, 0, "bank1"); - membank("bank1")->set_base(m_ram->pointer()); - - save_item(NAME(m_port_f_latch)); - save_item(NAME(m_spim_data)); - - if (m_maincpu->debug()) - m_maincpu->debug()->set_dasm_override(palm_dasm_override); -} - -void palm_state::machine_reset() -{ - // Copy boot ROM - UINT8* bios = memregion("bios")->base(); - memset(m_ram->pointer(), 0, m_ram->size()); - memcpy(m_ram->pointer(), bios, 0x20000); - - m_maincpu->reset(); -} - -/* THIS IS PRETTY MUCH TOTALLY WRONG AND DOESN'T REFLECT THE MC68328'S INTERNAL FUNCTIONALITY AT ALL! */ -PALETTE_INIT_MEMBER(palm_state, palm) -{ - palette.set_pen_color(0, 0x7b, 0x8c, 0x5a); - palette.set_pen_color(1, 0x00, 0x00, 0x00); -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START(palm_map, AS_PROGRAM, 16, palm_state) - AM_RANGE(0xc00000, 0xe07fff) AM_ROM AM_REGION("bios", 0) - AM_RANGE(0xfff000, 0xffffff) AM_DEVREADWRITE(MC68328_TAG, mc68328_device, read, write) -ADDRESS_MAP_END - - -/*************************************************************************** - AUDIO HARDWARE -***************************************************************************/ - -WRITE8_MEMBER(palm_state::palm_dac_transition) -{ - m_dac->write_unsigned8(0x7f * data ); -} - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static MACHINE_CONFIG_START( palm, palm_state ) - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", M68000, 32768*506 ) /* 16.580608 MHz */ - MCFG_CPU_PROGRAM_MAP( palm_map) - - MCFG_QUANTUM_TIME( attotime::from_hz(60) ) - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_REFRESH_RATE( 60 ) - MCFG_SCREEN_VBLANK_TIME( ATTOSECONDS_IN_USEC(1260) ) - /* video hardware */ - MCFG_SCREEN_VIDEO_ATTRIBUTES( VIDEO_UPDATE_BEFORE_VBLANK ) - MCFG_SCREEN_SIZE( 160, 220 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 159, 0, 219 ) - MCFG_SCREEN_UPDATE_DEVICE(MC68328_TAG, mc68328_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD( "palette", 2 ) - MCFG_PALETTE_INIT_OWNER(palm_state, palm) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_DEVICE_ADD( MC68328_TAG, MC68328, 0 ) // lsi device - MCFG_MC68328_CPU("maincpu") - MCFG_MC68328_OUT_PORT_F_CB(WRITE8(palm_state, palm_port_f_out)) // Port F Output - MCFG_MC68328_IN_PORT_C_CB(READ8(palm_state, palm_port_c_in)) // Port C Input - MCFG_MC68328_IN_PORT_F_CB(READ8(palm_state, palm_port_f_in)) // Port F Input - MCFG_MC68328_OUT_PWM_CB(WRITE8(palm_state, palm_dac_transition)) - MCFG_MC68328_OUT_SPIM_CB(WRITE16(palm_state, palm_spim_out)) - MCFG_MC68328_IN_SPIM_CB(READ16(palm_state, palm_spim_in)) - MCFG_MC68328_SPIM_XCH_TRIGGER_CB(WRITELINE(palm_state, palm_spim_exchange)) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( palm ) - PORT_START( "PENX" ) - PORT_BIT( 0xff, 0x50, IPT_LIGHTGUN_X ) PORT_NAME("Pen X") PORT_MINMAX(0, 0xa0) PORT_SENSITIVITY(50) PORT_CROSSHAIR(X, 1.0, 0.0, 0) - - PORT_START( "PENY" ) - PORT_BIT( 0xff, 0x50, IPT_LIGHTGUN_Y ) PORT_NAME("Pen Y") PORT_MINMAX(0, 0xa0) PORT_SENSITIVITY(50) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) - - PORT_START( "PENB" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Pen Button") PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, pen_check, NULL) - - PORT_START( "PORTD" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Power") PORT_CODE(KEYCODE_D) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Up") PORT_CODE(KEYCODE_Y) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Down") PORT_CODE(KEYCODE_H) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Button 1") PORT_CODE(KEYCODE_F) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)3) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Button 2") PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)4) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Button 3") PORT_CODE(KEYCODE_J) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)5) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Button 4") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER(DEVICE_SELF, palm_state, button_check, (void*)6) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -#define PALM_68328_BIOS \ - ROM_REGION16_BE( 0x208000, "bios", 0 ) \ - ROM_SYSTEM_BIOS( 0, "1.0e", "Palm OS 1.0 (English)" ) \ - ROMX_LOAD( "palmos10-en.rom", 0x000000, 0x080000, CRC(82030062) SHA1(00d85c6a0588133cc4651555e9605a61fc1901fc), ROM_GROUPWORD | ROM_BIOS(1) ) \ - ROM_SYSTEM_BIOS( 1, "2.0eper", "Palm OS 2.0 Personal (English)" ) \ - ROMX_LOAD( "palmos20-en-pers.rom", 0x000000, 0x100000, CRC(40ea8baa) SHA1(8e26e213de42da1317c375fb1f394bb945b9d178), ROM_GROUPWORD | ROM_BIOS(2) ) \ - ROM_SYSTEM_BIOS( 2, "2.0epro", "Palm OS 2.0 Professional (English)" ) \ - ROMX_LOAD( "palmos20-en-pro.rom", 0x000000, 0x100000, CRC(baa5b36a) SHA1(535bd9548365d300f85f514f318460443a021476), ROM_GROUPWORD | ROM_BIOS(3) ) \ - ROM_SYSTEM_BIOS( 3, "2.0eprod", "Palm OS 2.0 Professional (English, Debug)" ) \ - ROMX_LOAD( "palmis20-en-pro-dbg.rom", 0x000000, 0x100000, CRC(0d1d3a3b) SHA1(f18a80baa306d4d46b490589ee9a2a5091f6081c), ROM_GROUPWORD | ROM_BIOS(4) ) \ - ROM_SYSTEM_BIOS( 4, "3.0e", "Palm OS 3.0 (English)" ) \ - ROMX_LOAD( "palmos30-en.rom", 0x008000, 0x200000, CRC(6f461f3d) SHA1(7fbf592b4dc8c222be510f6cfda21d48ebe22413), ROM_GROUPWORD | ROM_BIOS(5) ) \ - ROM_RELOAD(0x000000, 0x004000) \ - ROM_SYSTEM_BIOS( 5, "3.0ed", "Palm OS 3.0 (English, Debug)" ) \ - ROMX_LOAD( "palmos30-en-dbg.rom", 0x008000, 0x200000, CRC(4deda226) SHA1(1c67d6fee2b6a4acd51cda6ef3490305730357ad), ROM_GROUPWORD | ROM_BIOS(6) ) \ - ROM_RELOAD(0x000000, 0x004000) \ - ROM_SYSTEM_BIOS( 6, "3.0g", "Palm OS 3.0 (German)" ) \ - ROMX_LOAD( "palmos30-de.rom", 0x008000, 0x200000, CRC(b991d6c3) SHA1(73e7539517b0d931e9fa99d6f6914ad46fb857b4), ROM_GROUPWORD | ROM_BIOS(7) ) \ - ROM_RELOAD(0x000000, 0x004000) \ - ROM_SYSTEM_BIOS( 7, "3.0f", "Palm OS 3.0 (French)" ) \ - ROMX_LOAD( "palmos30-fr.rom", 0x008000, 0x200000, CRC(a2a9ff6c) SHA1(7cb119f896017e76e4680510bee96207d9d28e44), ROM_GROUPWORD | ROM_BIOS(8) ) \ - ROM_RELOAD(0x000000, 0x004000) \ - ROM_SYSTEM_BIOS( 8, "3.0s", "Palm OS 3.0 (Spanish)" ) \ - ROMX_LOAD( "palmos30-sp.rom", 0x008000, 0x200000, CRC(63a595be) SHA1(f6e03a2fedf0cbe6228613f50f8e8717e797877d), ROM_GROUPWORD | ROM_BIOS(9) ) \ - ROM_RELOAD(0x000000, 0x004000) \ - ROM_SYSTEM_BIOS( 9, "3.3e", "Palm OS 3.3 (English)" ) \ - ROMX_LOAD( "palmos33-en-iii.rom", 0x008000, 0x200000, CRC(1eae0253) SHA1(e4626f1d33eca8368284d906b2152dcd28b71bbd), ROM_GROUPWORD | ROM_BIOS(10) ) \ - ROM_RELOAD(0x000000, 0x004000) \ - ROM_SYSTEM_BIOS( 10, "3.3f", "Palm OS 3.3 (French)" ) \ - ROMX_LOAD( "palmos33-fr-iii.rom", 0x008000, 0x200000, CRC(d7894f5f) SHA1(c7c90df814d4f97958194e0bc28c595e967a4529), ROM_GROUPWORD | ROM_BIOS(11) ) \ - ROM_RELOAD(0x000000, 0x004000) \ - ROM_SYSTEM_BIOS( 11, "3.3g", "Palm OS 3.3 (German)" ) \ - ROMX_LOAD( "palmos33-de-iii.rom", 0x008000, 0x200000, CRC(a5a99c45) SHA1(209b0154942dab80b56d5e6e68fa20b9eb75f5fe), ROM_GROUPWORD | ROM_BIOS(12) ) \ - ROM_RELOAD(0x000000, 0x004000) - -ROM_START( pilot1k ) - PALM_68328_BIOS - ROM_DEFAULT_BIOS( "1.0e" ) -ROM_END - -ROM_START( pilot5k ) - PALM_68328_BIOS - ROM_DEFAULT_BIOS( "1.0e" ) -ROM_END - -ROM_START( palmpers ) - PALM_68328_BIOS - ROM_DEFAULT_BIOS( "2.0eper" ) -ROM_END - -ROM_START( palmpro ) - PALM_68328_BIOS - ROM_DEFAULT_BIOS( "2.0epro" ) -ROM_END - -ROM_START( palmiii ) - PALM_68328_BIOS - ROM_DEFAULT_BIOS( "3.0e" ) -ROM_END - -ROM_START( palmv ) - ROM_REGION16_BE( 0x208000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "3.1e", "Palm OS 3.1 (English)" ) - ROMX_LOAD( "palmv31-en.rom", 0x008000, 0x200000, CRC(4656b2ae) SHA1(ec66a93441fbccfd8e0c946baa5d79c478c83e85), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 1, "3.1g", "Palm OS 3.1 (German)" ) - ROMX_LOAD( "palmv31-de.rom", 0x008000, 0x200000, CRC(a9631dcf) SHA1(63b44d4d3fc2f2196c96d3b9b95da526df0fac77), ROM_GROUPWORD | ROM_BIOS(2) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 2, "3.1f", "Palm OS 3.1 (French)" ) - ROMX_LOAD( "palmv31-fr.rom", 0x008000, 0x200000, CRC(0d933a1c) SHA1(d0454f1159705d0886f8a68e1b8a5e96d2ca48f6), ROM_GROUPWORD | ROM_BIOS(3) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 3, "3.1s", "Palm OS 3.1 (Spanish)" ) - ROMX_LOAD( "palmv31-sp.rom", 0x008000, 0x200000, CRC(cc46ca1f) SHA1(93bc78ca84d34916d7e122b745adec1068230fcd), ROM_GROUPWORD | ROM_BIOS(4) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 4, "3.1j", "Palm OS 3.1 (Japanese)" ) - ROMX_LOAD( "palmv31-jp.rom", 0x008000, 0x200000, CRC(c786db12) SHA1(4975ff2af76892370c5d4d7d6fa87a84480e79d6), ROM_GROUPWORD | ROM_BIOS(5) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 5, "3.1e2", "Palm OS 3.1 (English) v2" ) - ROMX_LOAD( "palmv31-en-2.rom", 0x008000, 0x200000, CRC(caced2bd) SHA1(95970080601f72a77a4c338203ed8809fab17abf), ROM_GROUPWORD | ROM_BIOS(6) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_DEFAULT_BIOS( "3.1e2" ) -ROM_END - -ROM_START( palmvx ) - ROM_REGION16_BE( 0x208000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "3.3e", "Palm OS 3.3 (English)" ) - ROMX_LOAD( "palmvx33-en.rom", 0x000000, 0x200000, CRC(3fc0cc6d) SHA1(6873d5fa99ac372f9587c769940c9b3ac1745a0a), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "4.0e", "Palm OS 4.0 (English)" ) - ROMX_LOAD( "palmvx40-en.rom", 0x000000, 0x200000, CRC(488e4638) SHA1(10a10fc8617743ebd5df19c1e99ca040ac1da4f5), ROM_GROUPWORD | ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "4.1e", "Palm OS 4.1 (English)" ) - ROMX_LOAD( "palmvx41-en.rom", 0x000000, 0x200000, CRC(e59f4dff) SHA1(5e3000db318eeb8cd1f4d9729d0c9ebca560fa4a), ROM_GROUPWORD | ROM_BIOS(3) ) - ROM_DEFAULT_BIOS( "4.1e" ) -ROM_END - -ROM_START( palmiiic ) - ROM_REGION16_BE( 0x208000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "3.5eb", "Palm OS 3.5 (English) beta" ) - ROMX_LOAD( "palmiiic350-en-beta.rom", 0x008000, 0x200000, CRC(d58521a4) SHA1(508742ea1e078737666abd4283cf5e6985401c9e), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 1, "3.5c", "Palm OS 3.5 (Chinese)" ) - ROMX_LOAD( "palmiiic350-ch.rom", 0x008000, 0x200000, CRC(a9779f3a) SHA1(1541102cd5234665233072afe8f0e052134a5334), ROM_GROUPWORD | ROM_BIOS(2) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 2, "4.0e", "Palm OS 4.0 (English)" ) - ROMX_LOAD( "palmiiic40-en.rom", 0x008000, 0x200000, CRC(6b2a5ad2) SHA1(54321dcaedcc80de57a819cfd599d8d1b2e26eeb), ROM_GROUPWORD | ROM_BIOS(3) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_DEFAULT_BIOS( "4.0e" ) -ROM_END - -ROM_START( palmm100 ) - ROM_REGION16_BE( 0x208000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "3.51e", "Palm OS 3.5.1 (English)" ) - ROMX_LOAD( "palmm100-351-en.rom", 0x008000, 0x200000, CRC(ae8dda60) SHA1(c46248d6f05cb2f4337985610cedfbdc12ac47cf), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_DEFAULT_BIOS( "3.51e" ) -ROM_END - -ROM_START( palmm130 ) - ROM_REGION16_BE( 0x408000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "4.0e", "Palm OS 4.0 (English)" ) - ROMX_LOAD( "palmm130-40-en.rom", 0x008000, 0x400000, CRC(58046b7e) SHA1(986057010d62d5881fba4dede2aba0d4d5008b16), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_DEFAULT_BIOS( "4.0e" ) -ROM_END - -ROM_START( palmm505 ) - ROM_REGION16_BE( 0x408000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "4.0e", "Palm OS 4.0 (English)" ) - ROMX_LOAD( "palmos40-en-m505.rom", 0x008000, 0x400000, CRC(822a4679) SHA1(a4f5e9f7edb1926647ea07969200c5c5e1521bdf), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 1, "4.1e", "Palm OS 4.1 (English)" ) - ROMX_LOAD( "palmos41-en-m505.rom", 0x008000, 0x400000, CRC(d248202a) SHA1(65e1bd08b244c589b4cd10fe573e0376aba90e5f), ROM_GROUPWORD | ROM_BIOS(2) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_DEFAULT_BIOS( "4.1e" ) -ROM_END - -ROM_START( palmm515 ) - ROM_REGION16_BE( 0x408000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "4.1e", "Palm OS 4.1 (English)" ) - ROMX_LOAD( "palmos41-en-m515.rom", 0x008000, 0x400000, CRC(6e143436) SHA1(a0767ea26cc493a3f687525d173903fef89f1acb), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_DEFAULT_BIOS( "4.0e" ) -ROM_END - -ROM_START( visor ) - ROM_REGION16_BE( 0x208000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "3.52e", "Palm OS 3.5.2 (English)" ) - ROMX_LOAD( "visor-352-en.rom", 0x008000, 0x200000, CRC(c9e55271) SHA1(749e9142f4480114c5e0d7f21ea354df7273ac5b), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_DEFAULT_BIOS( "3.52e" ) -ROM_END - -ROM_START( spt1500 ) - ROM_REGION16_BE( 0x208000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "4.1pim", "Version 4.1 (pim)" ) - ROMX_LOAD( "spt1500v41-pim.rom", 0x008000, 0x200000, CRC(29e50eaf) SHA1(3e920887bdf74f8f83935977b02f22d5217723eb), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 1, "4.1pimn", "Version 4.1 (pimnoft)" ) - ROMX_LOAD( "spt1500v41-pimnoft.rom", 0x008000, 0x200000, CRC(4b44f284) SHA1(4412e946444706628b94d2303b02580817e1d370), ROM_GROUPWORD | ROM_BIOS(2) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 2, "4.1nopimn", "Version 4.1 (nopimnoft)" ) - ROMX_LOAD( "spt1500v41-nopimnoft.rom",0x008000, 0x200000, CRC(4ba19190) SHA1(d713c1390b82eb4e5fbb39aa10433757c5c49e02), ROM_GROUPWORD | ROM_BIOS(3) ) - ROM_RELOAD(0x000000, 0x004000) -ROM_END - -ROM_START( spt1700 ) - ROM_REGION16_BE( 0x208000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "1.03pim", "Version 1.03 (pim)" ) - ROMX_LOAD( "spt1700v103-pim.rom", 0x008000, 0x200000, CRC(9df4ee50) SHA1(243a19796f15219cbd73e116f7dfb236b3d238cd), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) -ROM_END - -ROM_START( spt1740 ) - ROM_REGION16_BE( 0x208000, "bios", 0 ) - ROM_SYSTEM_BIOS( 0, "1.03pim", "Version 1.03 (pim)" ) - ROMX_LOAD( "spt1740v103-pim.rom", 0x008000, 0x200000, CRC(c29f341c) SHA1(b56d7f8a0c15b1105972e24ed52c846b5e27b195), ROM_GROUPWORD | ROM_BIOS(1) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 1, "1.03pimn", "Version 1.03 (pimnoft)" ) - ROMX_LOAD( "spt1740v103-pimnoft.rom", 0x008000, 0x200000, CRC(b2d49d5c) SHA1(c133dc021b6797cdb93b666c5b315b00b5bb0917), ROM_GROUPWORD | ROM_BIOS(2) ) - ROM_RELOAD(0x000000, 0x004000) - ROM_SYSTEM_BIOS( 2, "1.03nopim", "Version 1.03 (nopim)" ) - ROMX_LOAD( "spt1740v103-nopim.rom", 0x008000, 0x200000, CRC(8ea7e652) SHA1(2a4b5d6a426e627b3cb82c47109cfe2497eba29a), ROM_GROUPWORD | ROM_BIOS(3) ) - ROM_RELOAD(0x000000, 0x004000) -ROM_END - -static MACHINE_CONFIG_DERIVED( pilot1k, palm ) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("512K,1M,2M,4M,8M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pilot5k, palm ) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_EXTRA_OPTIONS("1M,2M,4M,8M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( palmpro, palm ) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1M") - MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( palmiii, palm ) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("4M,8M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( palmv, palm ) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_RAM_EXTRA_OPTIONS("4M,8M") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( palmvx, palm ) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8M") -MACHINE_CONFIG_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1996, pilot1k, 0, 0, pilot1k, palm, driver_device, 0, "U.S. Robotics", "Pilot 1000", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) -COMP( 1996, pilot5k, pilot1k, 0, pilot5k, palm, driver_device, 0, "U.S. Robotics", "Pilot 5000", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) -COMP( 1997, palmpers, pilot1k, 0, pilot5k, palm, driver_device, 0, "U.S. Robotics", "Palm Pilot Personal", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) -COMP( 1997, palmpro, pilot1k, 0, palmpro, palm, driver_device, 0, "U.S. Robotics", "Palm Pilot Pro", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) -COMP( 1998, palmiii, pilot1k, 0, palmiii, palm, driver_device, 0, "3Com", "Palm III", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) -COMP( 1998, palmiiic, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm IIIc", MACHINE_NOT_WORKING ) -COMP( 2000, palmm100, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm m100", MACHINE_NOT_WORKING ) -COMP( 2000, palmm130, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm m130", MACHINE_NOT_WORKING ) -COMP( 2001, palmm505, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm m505", MACHINE_NOT_WORKING ) -COMP( 2001, palmm515, pilot1k, 0, palmiii, palm, driver_device, 0, "Palm Inc", "Palm m515", MACHINE_NOT_WORKING ) -COMP( 1999, palmv, pilot1k, 0, palmv, palm, driver_device, 0, "3Com", "Palm V", MACHINE_NOT_WORKING ) -COMP( 1999, palmvx, pilot1k, 0, palmvx, palm, driver_device, 0, "Palm Inc", "Palm Vx", MACHINE_NOT_WORKING ) -COMP( 2001, visor, pilot1k, 0, palmvx, palm, driver_device, 0, "Handspring", "Visor Edge", MACHINE_NOT_WORKING ) -COMP( 19??, spt1500, pilot1k, 0, palmvx, palm, driver_device, 0, "Symbol", "SPT 1500", MACHINE_NOT_WORKING ) -COMP( 19??, spt1700, pilot1k, 0, palmvx, palm, driver_device, 0, "Symbol", "SPT 1700", MACHINE_NOT_WORKING ) -COMP( 19??, spt1740, pilot1k, 0, palmvx, palm, driver_device, 0, "Symbol", "SPT 1740", MACHINE_NOT_WORKING ) - -#include "palm_dbg.inc" diff --git a/src/mess/drivers/palm_dbg.inc b/src/mess/drivers/palm_dbg.inc deleted file mode 100644 index d02f6117574..00000000000 --- a/src/mess/drivers/palm_dbg.inc +++ /dev/null @@ -1,1194 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz, R. Belmont -static const char *lookup_trap(UINT16 opcode) -{ - static const struct - { - const char *name; - UINT16 trap; - } traps[] = - { - { "sysTrapMemInit", 0xA000 }, - { "sysTrapMemInitHeapTable", 0xA001 }, - { "sysTrapMemStoreInit", 0xA002 }, - { "sysTrapMemCardFormat", 0xA003 }, - { "sysTrapMemCardInfo", 0xA004 }, - { "sysTrapMemStoreInfo", 0xA005 }, - { "sysTrapMemStoreSetInfo", 0xA006 }, - { "sysTrapMemNumHeaps", 0xA007 }, - { "sysTrapMemNumRAMHeaps", 0xA008 }, - { "sysTrapMemHeapID", 0xA009 }, - { "sysTrapMemHeapPtr", 0xA00A }, - { "sysTrapMemHeapFreeBytes", 0xA00B }, - { "sysTrapMemHeapSize", 0xA00C }, - { "sysTrapMemHeapFlags", 0xA00D }, - { "sysTrapMemHeapCompact", 0xA00E }, - { "sysTrapMemHeapInit", 0xA00F }, - { "sysTrapMemHeapFreeByOwnerID", 0xA010 }, - { "sysTrapMemChunkNew", 0xA011 }, - { "sysTrapMemChunkFree", 0xA012 }, - { "sysTrapMemPtrNew", 0xA013 }, - { "sysTrapMemPtrRecoverHandle", 0xA014 }, - { "sysTrapMemPtrFlags", 0xA015 }, - { "sysTrapMemPtrSize", 0xA016 }, - { "sysTrapMemPtrOwner", 0xA017 }, - { "sysTrapMemPtrHeapID", 0xA018 }, - { "sysTrapMemPtrCardNo", 0xA019 }, - { "sysTrapMemPtrToLocalID", 0xA01A }, - { "sysTrapMemPtrSetOwner", 0xA01B }, - { "sysTrapMemPtrResize", 0xA01C }, - { "sysTrapMemPtrResetLock", 0xA01D }, - { "sysTrapMemHandleNew", 0xA01E }, - { "sysTrapMemHandleLockCount", 0xA01F }, - { "sysTrapMemHandleToLocalID", 0xA020 }, - { "sysTrapMemHandleLock", 0xA021 }, - { "sysTrapMemHandleUnlock", 0xA022 }, - { "sysTrapMemLocalIDToGlobal", 0xA023 }, - { "sysTrapMemLocalIDKind", 0xA024 }, - { "sysTrapMemLocalIDToPtr", 0xA025 }, - { "sysTrapMemMove", 0xA026 }, - { "sysTrapMemSet", 0xA027 }, - { "sysTrapMemStoreSearch", 0xA028 }, - { "sysTrapSysReserved10Trap1", 0xA029 }, - { "sysTrapMemKernelInit", 0xA02A }, - { "sysTrapMemHandleFree", 0xA02B }, - { "sysTrapMemHandleFlags", 0xA02C }, - { "sysTrapMemHandleSize", 0xA02D }, - { "sysTrapMemHandleOwner", 0xA02E }, - { "sysTrapMemHandleHeapID", 0xA02F }, - { "sysTrapMemHandleDataStorage", 0xA030 }, - { "sysTrapMemHandleCardNo", 0xA031 }, - { "sysTrapMemHandleSetOwner", 0xA032 }, - { "sysTrapMemHandleResize", 0xA033 }, - { "sysTrapMemHandleResetLock", 0xA034 }, - { "sysTrapMemPtrUnlock", 0xA035 }, - { "sysTrapMemLocalIDToLockedPtr", 0xA036 }, - { "sysTrapMemSetDebugMode", 0xA037 }, - { "sysTrapMemHeapScramble", 0xA038 }, - { "sysTrapMemHeapCheck", 0xA039 }, - { "sysTrapMemNumCards", 0xA03A }, - { "sysTrapMemDebugMode", 0xA03B }, - { "sysTrapMemSemaphoreReserve", 0xA03C }, - { "sysTrapMemSemaphoreRelease", 0xA03D }, - { "sysTrapMemHeapDynamic", 0xA03E }, - { "sysTrapMemNVParams", 0xA03F }, - { "sysTrapDmInit", 0xA040 }, - { "sysTrapDmCreateDatabase", 0xA041 }, - { "sysTrapDmDeleteDatabase", 0xA042 }, - { "sysTrapDmNumDatabases", 0xA043 }, - { "sysTrapDmGetDatabase", 0xA044 }, - { "sysTrapDmFindDatabase", 0xA045 }, - { "sysTrapDmDatabaseInfo", 0xA046 }, - { "sysTrapDmSetDatabaseInfo", 0xA047 }, - { "sysTrapDmDatabaseSize", 0xA048 }, - { "sysTrapDmOpenDatabase", 0xA049 }, - { "sysTrapDmCloseDatabase", 0xA04A }, - { "sysTrapDmNextOpenDatabase", 0xA04B }, - { "sysTrapDmOpenDatabaseInfo", 0xA04C }, - { "sysTrapDmResetRecordStates", 0xA04D }, - { "sysTrapDmGetLastErr", 0xA04E }, - { "sysTrapDmNumRecords", 0xA04F }, - { "sysTrapDmRecordInfo", 0xA050 }, - { "sysTrapDmSetRecordInfo", 0xA051 }, - { "sysTrapDmAttachRecord", 0xA052 }, - { "sysTrapDmDetachRecord", 0xA053 }, - { "sysTrapDmMoveRecord", 0xA054 }, - { "sysTrapDmNewRecord", 0xA055 }, - { "sysTrapDmRemoveRecord", 0xA056 }, - { "sysTrapDmDeleteRecord", 0xA057 }, - { "sysTrapDmArchiveRecord", 0xA058 }, - { "sysTrapDmNewHandle", 0xA059 }, - { "sysTrapDmRemoveSecretRecords", 0xA05A }, - { "sysTrapDmQueryRecord", 0xA05B }, - { "sysTrapDmGetRecord", 0xA05C }, - { "sysTrapDmResizeRecord", 0xA05D }, - { "sysTrapDmReleaseRecord", 0xA05E }, - { "sysTrapDmGetResource", 0xA05F }, - { "sysTrapDmGet1Resource", 0xA060 }, - { "sysTrapDmReleaseResource", 0xA061 }, - { "sysTrapDmResizeResource", 0xA062 }, - { "sysTrapDmNextOpenResDatabase", 0xA063 }, - { "sysTrapDmFindResourceType", 0xA064 }, - { "sysTrapDmFindResource", 0xA065 }, - { "sysTrapDmSearchResource", 0xA066 }, - { "sysTrapDmNumResources", 0xA067 }, - { "sysTrapDmResourceInfo", 0xA068 }, - { "sysTrapDmSetResourceInfo", 0xA069 }, - { "sysTrapDmAttachResource", 0xA06A }, - { "sysTrapDmDetachResource", 0xA06B }, - { "sysTrapDmNewResource", 0xA06C }, - { "sysTrapDmRemoveResource", 0xA06D }, - { "sysTrapDmGetResourceIndex", 0xA06E }, - { "sysTrapDmQuickSort", 0xA06F }, - { "sysTrapDmQueryNextInCategory", 0xA070 }, - { "sysTrapDmNumRecordsInCategory", 0xA071 }, - { "sysTrapDmPositionInCategory", 0xA072 }, - { "sysTrapDmSeekRecordInCategory", 0xA073 }, - { "sysTrapDmMoveCategory", 0xA074 }, - { "sysTrapDmOpenDatabaseByTypeCreator", 0xA075 }, - { "sysTrapDmWrite", 0xA076 }, - { "sysTrapDmStrCopy", 0xA077 }, - { "sysTrapDmGetNextDatabaseByTypeCreator", 0xA078 }, - { "sysTrapDmWriteCheck", 0xA079 }, - { "sysTrapDmMoveOpenDBContext", 0xA07A }, - { "sysTrapDmFindRecordByID", 0xA07B }, - { "sysTrapDmGetAppInfoID", 0xA07C }, - { "sysTrapDmFindSortPositionV10", 0xA07D }, - { "sysTrapDmSet", 0xA07E }, - { "sysTrapDmCreateDatabaseFromImage", 0xA07F }, - { "sysTrapDbgSrcMessage", 0xA080 }, - { "sysTrapDbgMessage", 0xA081 }, - { "sysTrapDbgGetMessage", 0xA082 }, - { "sysTrapDbgCommSettings", 0xA083 }, - { "sysTrapErrDisplayFileLineMsg", 0xA084 }, - { "sysTrapErrSetJump", 0xA085 }, - { "sysTrapErrLongJump", 0xA086 }, - { "sysTrapErrThrow", 0xA087 }, - { "sysTrapErrExceptionList", 0xA088 }, - { "sysTrapSysBroadcastActionCode", 0xA089 }, - { "sysTrapSysUnimplemented", 0xA08A }, - { "sysTrapSysColdBoot", 0xA08B }, - { "sysTrapSysReset", 0xA08C }, - { "sysTrapSysDoze", 0xA08D }, - { "sysTrapSysAppLaunch", 0xA08E }, - { "sysTrapSysAppStartup", 0xA08F }, - { "sysTrapSysAppExit", 0xA090 }, - { "sysTrapSysSetA5", 0xA091 }, - { "sysTrapSysSetTrapAddress", 0xA092 }, - { "sysTrapSysGetTrapAddress", 0xA093 }, - { "sysTrapSysTranslateKernelErr", 0xA094 }, - { "sysTrapSysSemaphoreCreate", 0xA095 }, - { "sysTrapSysSemaphoreDelete", 0xA096 }, - { "sysTrapSysSemaphoreWait", 0xA097 }, - { "sysTrapSysSemaphoreSignal", 0xA098 }, - { "sysTrapSysTimerCreate", 0xA099 }, - { "sysTrapSysTimerWrite", 0xA09A }, - { "sysTrapSysTaskCreate", 0xA09B }, - { "sysTrapSysTaskDelete", 0xA09C }, - { "sysTrapSysTaskTrigger", 0xA09D }, - { "sysTrapSysTaskID", 0xA09E }, - { "sysTrapSysTaskUserInfoPtr", 0xA09F }, - { "sysTrapSysTaskDelay", 0xA0A0 }, - { "sysTrapSysTaskSetTermProc", 0xA0A1 }, - { "sysTrapSysUILaunch", 0xA0A2 }, - { "sysTrapSysNewOwnerID", 0xA0A3 }, - { "sysTrapSysSemaphoreSet", 0xA0A4 }, - { "sysTrapSysDisableInts", 0xA0A5 }, - { "sysTrapSysRestoreStatus", 0xA0A6 }, - { "sysTrapSysUIAppSwitch", 0xA0A7 }, - { "sysTrapSysCurAppInfoPV20", 0xA0A8 }, - { "sysTrapSysHandleEvent", 0xA0A9 }, - { "sysTrapSysInit", 0xA0AA }, - { "sysTrapSysQSort", 0xA0AB }, - { "sysTrapSysCurAppDatabase", 0xA0AC }, - { "sysTrapSysFatalAlert", 0xA0AD }, - { "sysTrapSysResSemaphoreCreate", 0xA0AE }, - { "sysTrapSysResSemaphoreDelete", 0xA0AF }, - { "sysTrapSysResSemaphoreReserve", 0xA0B0 }, - { "sysTrapSysResSemaphoreRelease", 0xA0B1 }, - { "sysTrapSysSleep", 0xA0B2 }, - { "sysTrapSysKeyboardDialogV10", 0xA0B3 }, - { "sysTrapSysAppLauncherDialog", 0xA0B4 }, - { "sysTrapSysSetPerformance", 0xA0B5 }, - { "sysTrapSysBatteryInfoV20", 0xA0B6 }, - { "sysTrapSysLibInstall", 0xA0B7 }, - { "sysTrapSysLibRemove", 0xA0B8 }, - { "sysTrapSysLibTblEntry", 0xA0B9 }, - { "sysTrapSysLibFind", 0xA0BA }, - { "sysTrapSysBatteryDialog", 0xA0BB }, - { "sysTrapSysCopyStringResource", 0xA0BC }, - { "sysTrapSysKernelInfo", 0xA0BD }, - { "sysTrapSysLaunchConsole", 0xA0BE }, - { "sysTrapSysTimerDelete", 0xA0BF }, - { "sysTrapSysSetAutoOffTime", 0xA0C0 }, - { "sysTrapSysFormPointerArrayToStrings", 0xA0C1 }, - { "sysTrapSysRandom", 0xA0C2 }, - { "sysTrapSysTaskSwitching", 0xA0C3 }, - { "sysTrapSysTimerRead", 0xA0C4 }, - { "sysTrapStrCopy", 0xA0C5 }, - { "sysTrapStrCat", 0xA0C6 }, - { "sysTrapStrLen", 0xA0C7 }, - { "sysTrapStrCompare", 0xA0C8 }, - { "sysTrapStrIToA", 0xA0C9 }, - { "sysTrapStrCaselessCompare", 0xA0CA }, - { "sysTrapStrIToH", 0xA0CB }, - { "sysTrapStrChr", 0xA0CC }, - { "sysTrapStrStr", 0xA0CD }, - { "sysTrapStrAToI", 0xA0CE }, - { "sysTrapStrToLower", 0xA0CF }, - { "sysTrapSerReceiveISP", 0xA0D0 }, - { "sysTrapSlkOpen", 0xA0D1 }, - { "sysTrapSlkClose", 0xA0D2 }, - { "sysTrapSlkOpenSocket", 0xA0D3 }, - { "sysTrapSlkCloseSocket", 0xA0D4 }, - { "sysTrapSlkSocketRefNum", 0xA0D5 }, - { "sysTrapSlkSocketSetTimeout", 0xA0D6 }, - { "sysTrapSlkFlushSocket", 0xA0D7 }, - { "sysTrapSlkSetSocketListener", 0xA0D8 }, - { "sysTrapSlkSendPacket", 0xA0D9 }, - { "sysTrapSlkReceivePacket", 0xA0DA }, - { "sysTrapSlkSysPktDefaultResponse", 0xA0DB }, - { "sysTrapSlkProcessRPC", 0xA0DC }, - { "sysTrapConPutS", 0xA0DD }, - { "sysTrapConGetS", 0xA0DE }, - { "sysTrapFplInit", 0xA0DF }, - { "sysTrapFplFree", 0xA0E0 }, - { "sysTrapFplFToA", 0xA0E1 }, - { "sysTrapFplAToF", 0xA0E2 }, - { "sysTrapFplBase10Info", 0xA0E3 }, - { "sysTrapFplLongToFloat", 0xA0E4 }, - { "sysTrapFplFloatToLong", 0xA0E5 }, - { "sysTrapFplFloatToULong", 0xA0E6 }, - { "sysTrapFplMul", 0xA0E7 }, - { "sysTrapFplAdd", 0xA0E8 }, - { "sysTrapFplSub", 0xA0E9 }, - { "sysTrapFplDiv", 0xA0EA }, - { "sysTrapWinScreenInit", 0xA0EB }, - { "sysTrapScrCopyRectangle", 0xA0EC }, - { "sysTrapScrDrawChars", 0xA0ED }, - { "sysTrapScrLineRoutine", 0xA0EE }, - { "sysTrapScrRectangleRoutine", 0xA0EF }, - { "sysTrapScrScreenInfo", 0xA0F0 }, - { "sysTrapScrDrawNotify", 0xA0F1 }, - { "sysTrapScrSendUpdateArea", 0xA0F2 }, - { "sysTrapScrCompressScanLine", 0xA0F3 }, - { "sysTrapScrDeCompressScanLine", 0xA0F4 }, - { "sysTrapTimGetSeconds", 0xA0F5 }, - { "sysTrapTimSetSeconds", 0xA0F6 }, - { "sysTrapTimGetTicks", 0xA0F7 }, - { "sysTrapTimInit", 0xA0F8 }, - { "sysTrapTimSetAlarm", 0xA0F9 }, - { "sysTrapTimGetAlarm", 0xA0FA }, - { "sysTrapTimHandleInterrupt", 0xA0FB }, - { "sysTrapTimSecondsToDateTime", 0xA0FC }, - { "sysTrapTimDateTimeToSeconds", 0xA0FD }, - { "sysTrapTimAdjust", 0xA0FE }, - { "sysTrapTimSleep", 0xA0FF }, - { "sysTrapTimWake", 0xA100 }, - { "sysTrapCategoryCreateListV10", 0xA101 }, - { "sysTrapCategoryFreeListV10", 0xA102 }, - { "sysTrapCategoryFind", 0xA103 }, - { "sysTrapCategoryGetName", 0xA104 }, - { "sysTrapCategoryEditV10", 0xA105 }, - { "sysTrapCategorySelectV10", 0xA106 }, - { "sysTrapCategoryGetNext", 0xA107 }, - { "sysTrapCategorySetTriggerLabel", 0xA108 }, - { "sysTrapCategoryTruncateName", 0xA109 }, - { "sysTrapClipboardAddItem", 0xA10A }, - { "sysTrapClipboardCheckIfItemExist", 0xA10B }, - { "sysTrapClipboardGetItem", 0xA10C }, - { "sysTrapCtlDrawControl", 0xA10D }, - { "sysTrapCtlEraseControl", 0xA10E }, - { "sysTrapCtlHideControl", 0xA10F }, - { "sysTrapCtlShowControl", 0xA110 }, - { "sysTrapCtlGetValue", 0xA111 }, - { "sysTrapCtlSetValue", 0xA112 }, - { "sysTrapCtlGetLabel", 0xA113 }, - { "sysTrapCtlSetLabel", 0xA114 }, - { "sysTrapCtlHandleEvent", 0xA115 }, - { "sysTrapCtlHitControl", 0xA116 }, - { "sysTrapCtlSetEnabled", 0xA117 }, - { "sysTrapCtlSetUsable", 0xA118 }, - { "sysTrapCtlEnabled", 0xA119 }, - { "sysTrapEvtInitialize", 0xA11A }, - { "sysTrapEvtAddEventToQueue", 0xA11B }, - { "sysTrapEvtCopyEvent", 0xA11C }, - { "sysTrapEvtGetEvent", 0xA11D }, - { "sysTrapEvtGetPen", 0xA11E }, - { "sysTrapEvtSysInit", 0xA11F }, - { "sysTrapEvtGetSysEvent", 0xA120 }, - { "sysTrapEvtProcessSoftKeyStroke", 0xA121 }, - { "sysTrapEvtGetPenBtnList", 0xA122 }, - { "sysTrapEvtSetPenQueuePtr", 0xA123 }, - { "sysTrapEvtPenQueueSize", 0xA124 }, - { "sysTrapEvtFlushPenQueue", 0xA125 }, - { "sysTrapEvtEnqueuePenPoint", 0xA126 }, - { "sysTrapEvtDequeuePenStrokeInfo", 0xA127 }, - { "sysTrapEvtDequeuePenPoint", 0xA128 }, - { "sysTrapEvtFlushNextPenStroke", 0xA129 }, - { "sysTrapEvtSetKeyQueuePtr", 0xA12A }, - { "sysTrapEvtKeyQueueSize", 0xA12B }, - { "sysTrapEvtFlushKeyQueue", 0xA12C }, - { "sysTrapEvtEnqueueKey", 0xA12D }, - { "sysTrapEvtDequeueKeyEvent", 0xA12E }, - { "sysTrapEvtWakeup", 0xA12F }, - { "sysTrapEvtResetAutoOffTimer", 0xA130 }, - { "sysTrapEvtKeyQueueEmpty", 0xA131 }, - { "sysTrapEvtEnableGraffiti", 0xA132 }, - { "sysTrapFldCopy", 0xA133 }, - { "sysTrapFldCut", 0xA134 }, - { "sysTrapFldDrawField", 0xA135 }, - { "sysTrapFldEraseField", 0xA136 }, - { "sysTrapFldFreeMemory", 0xA137 }, - { "sysTrapFldGetBounds", 0xA138 }, - { "sysTrapFldGetTextPtr", 0xA139 }, - { "sysTrapFldGetSelection", 0xA13A }, - { "sysTrapFldHandleEvent", 0xA13B }, - { "sysTrapFldPaste", 0xA13C }, - { "sysTrapFldRecalculateField", 0xA13D }, - { "sysTrapFldSetBounds", 0xA13E }, - { "sysTrapFldSetText", 0xA13F }, - { "sysTrapFldGetFont", 0xA140 }, - { "sysTrapFldSetFont", 0xA141 }, - { "sysTrapFldSetSelection", 0xA142 }, - { "sysTrapFldGrabFocus", 0xA143 }, - { "sysTrapFldReleaseFocus", 0xA144 }, - { "sysTrapFldGetInsPtPosition", 0xA145 }, - { "sysTrapFldSetInsPtPosition", 0xA146 }, - { "sysTrapFldSetScrollPosition", 0xA147 }, - { "sysTrapFldGetScrollPosition", 0xA148 }, - { "sysTrapFldGetTextHeight", 0xA149 }, - { "sysTrapFldGetTextAllocatedSize", 0xA14A }, - { "sysTrapFldGetTextLength", 0xA14B }, - { "sysTrapFldScrollField", 0xA14C }, - { "sysTrapFldScrollable", 0xA14D }, - { "sysTrapFldGetVisibleLines", 0xA14E }, - { "sysTrapFldGetAttributes", 0xA14F }, - { "sysTrapFldSetAttributes", 0xA150 }, - { "sysTrapFldSendChangeNotification", 0xA151 }, - { "sysTrapFldCalcFieldHeight", 0xA152 }, - { "sysTrapFldGetTextHandle", 0xA153 }, - { "sysTrapFldCompactText", 0xA154 }, - { "sysTrapFldDirty", 0xA155 }, - { "sysTrapFldWordWrap", 0xA156 }, - { "sysTrapFldSetTextAllocatedSize", 0xA157 }, - { "sysTrapFldSetTextHandle", 0xA158 }, - { "sysTrapFldSetTextPtr", 0xA159 }, - { "sysTrapFldGetMaxChars", 0xA15A }, - { "sysTrapFldSetMaxChars", 0xA15B }, - { "sysTrapFldSetUsable", 0xA15C }, - { "sysTrapFldInsert", 0xA15D }, - { "sysTrapFldDelete", 0xA15E }, - { "sysTrapFldUndo", 0xA15F }, - { "sysTrapFldSetDirty", 0xA160 }, - { "sysTrapFldSendHeightChangeNotification", 0xA161 }, - { "sysTrapFldMakeFullyVisible", 0xA162 }, - { "sysTrapFntGetFont", 0xA163 }, - { "sysTrapFntSetFont", 0xA164 }, - { "sysTrapFntGetFontPtr", 0xA165 }, - { "sysTrapFntBaseLine", 0xA166 }, - { "sysTrapFntCharHeight", 0xA167 }, - { "sysTrapFntLineHeight", 0xA168 }, - { "sysTrapFntAverageCharWidth", 0xA169 }, - { "sysTrapFntCharWidth", 0xA16A }, - { "sysTrapFntCharsWidth", 0xA16B }, - { "sysTrapFntDescenderHeight", 0xA16C }, - { "sysTrapFntCharsInWidth", 0xA16D }, - { "sysTrapFntLineWidth", 0xA16E }, - { "sysTrapFrmInitForm", 0xA16F }, - { "sysTrapFrmDeleteForm", 0xA170 }, - { "sysTrapFrmDrawForm", 0xA171 }, - { "sysTrapFrmEraseForm", 0xA172 }, - { "sysTrapFrmGetActiveForm", 0xA173 }, - { "sysTrapFrmSetActiveForm", 0xA174 }, - { "sysTrapFrmGetActiveFormID", 0xA175 }, - { "sysTrapFrmGetUserModifiedState", 0xA176 }, - { "sysTrapFrmSetNotUserModified", 0xA177 }, - { "sysTrapFrmGetFocus", 0xA178 }, - { "sysTrapFrmSetFocus", 0xA179 }, - { "sysTrapFrmHandleEvent", 0xA17A }, - { "sysTrapFrmGetFormBounds", 0xA17B }, - { "sysTrapFrmGetWindowHandle", 0xA17C }, - { "sysTrapFrmGetFormId", 0xA17D }, - { "sysTrapFrmGetFormPtr", 0xA17E }, - { "sysTrapFrmGetNumberOfObjects", 0xA17F }, - { "sysTrapFrmGetObjectIndex", 0xA180 }, - { "sysTrapFrmGetObjectId", 0xA181 }, - { "sysTrapFrmGetObjectType", 0xA182 }, - { "sysTrapFrmGetObjectPtr", 0xA183 }, - { "sysTrapFrmHideObject", 0xA184 }, - { "sysTrapFrmShowObject", 0xA185 }, - { "sysTrapFrmGetObjectPosition", 0xA186 }, - { "sysTrapFrmSetObjectPosition", 0xA187 }, - { "sysTrapFrmGetControlValue", 0xA188 }, - { "sysTrapFrmSetControlValue", 0xA189 }, - { "sysTrapFrmGetControlGroupSelection", 0xA18A }, - { "sysTrapFrmSetControlGroupSelection", 0xA18B }, - { "sysTrapFrmCopyLabel", 0xA18C }, - { "sysTrapFrmSetLabel", 0xA18D }, - { "sysTrapFrmGetLabel", 0xA18E }, - { "sysTrapFrmSetCategoryLabel", 0xA18F }, - { "sysTrapFrmGetTitle", 0xA190 }, - { "sysTrapFrmSetTitle", 0xA191 }, - { "sysTrapFrmAlert", 0xA192 }, - { "sysTrapFrmDoDialog", 0xA193 }, - { "sysTrapFrmCustomAlert", 0xA194 }, - { "sysTrapFrmHelp", 0xA195 }, - { "sysTrapFrmUpdateScrollers", 0xA196 }, - { "sysTrapFrmGetFirstForm", 0xA197 }, - { "sysTrapFrmVisible", 0xA198 }, - { "sysTrapFrmGetObjectBounds", 0xA199 }, - { "sysTrapFrmCopyTitle", 0xA19A }, - { "sysTrapFrmGotoForm", 0xA19B }, - { "sysTrapFrmPopupForm", 0xA19C }, - { "sysTrapFrmUpdateForm", 0xA19D }, - { "sysTrapFrmReturnToForm", 0xA19E }, - { "sysTrapFrmSetEventHandler", 0xA19F }, - { "sysTrapFrmDispatchEvent", 0xA1A0 }, - { "sysTrapFrmCloseAllForms", 0xA1A1 }, - { "sysTrapFrmSaveAllForms", 0xA1A2 }, - { "sysTrapFrmGetGadgetData", 0xA1A3 }, - { "sysTrapFrmSetGadgetData", 0xA1A4 }, - { "sysTrapFrmSetCategoryTrigger", 0xA1A5 }, - { "sysTrapUIInitialize", 0xA1A6 }, - { "sysTrapUIReset", 0xA1A7 }, - { "sysTrapInsPtInitialize", 0xA1A8 }, - { "sysTrapInsPtSetLocation", 0xA1A9 }, - { "sysTrapInsPtGetLocation", 0xA1AA }, - { "sysTrapInsPtEnable", 0xA1AB }, - { "sysTrapInsPtEnabled", 0xA1AC }, - { "sysTrapInsPtSetHeight", 0xA1AD }, - { "sysTrapInsPtGetHeight", 0xA1AE }, - { "sysTrapInsPtCheckBlink", 0xA1AF }, - { "sysTrapLstSetDrawFunction", 0xA1B0 }, - { "sysTrapLstDrawList", 0xA1B1 }, - { "sysTrapLstEraseList", 0xA1B2 }, - { "sysTrapLstGetSelection", 0xA1B3 }, - { "sysTrapLstGetSelectionText", 0xA1B4 }, - { "sysTrapLstHandleEvent", 0xA1B5 }, - { "sysTrapLstSetHeight", 0xA1B6 }, - { "sysTrapLstSetSelection", 0xA1B7 }, - { "sysTrapLstSetListChoices", 0xA1B8 }, - { "sysTrapLstMakeItemVisible", 0xA1B9 }, - { "sysTrapLstGetNumberOfItems", 0xA1BA }, - { "sysTrapLstPopupList", 0xA1BB }, - { "sysTrapLstSetPosition", 0xA1BC }, - { "sysTrapMenuInit", 0xA1BD }, - { "sysTrapMenuDispose", 0xA1BE }, - { "sysTrapMenuHandleEvent", 0xA1BF }, - { "sysTrapMenuDrawMenu", 0xA1C0 }, - { "sysTrapMenuEraseStatus", 0xA1C1 }, - { "sysTrapMenuGetActiveMenu", 0xA1C2 }, - { "sysTrapMenuSetActiveMenu", 0xA1C3 }, - { "sysTrapRctSetRectangle", 0xA1C4 }, - { "sysTrapRctCopyRectangle", 0xA1C5 }, - { "sysTrapRctInsetRectangle", 0xA1C6 }, - { "sysTrapRctOffsetRectangle", 0xA1C7 }, - { "sysTrapRctPtInRectangle", 0xA1C8 }, - { "sysTrapRctGetIntersection", 0xA1C9 }, - { "sysTrapTblDrawTable", 0xA1CA }, - { "sysTrapTblEraseTable", 0xA1CB }, - { "sysTrapTblHandleEvent", 0xA1CC }, - { "sysTrapTblGetItemBounds", 0xA1CD }, - { "sysTrapTblSelectItem", 0xA1CE }, - { "sysTrapTblGetItemInt", 0xA1CF }, - { "sysTrapTblSetItemInt", 0xA1D0 }, - { "sysTrapTblSetItemStyle", 0xA1D1 }, - { "sysTrapTblUnhighlightSelection", 0xA1D2 }, - { "sysTrapTblSetRowUsable", 0xA1D3 }, - { "sysTrapTblGetNumberOfRows", 0xA1D4 }, - { "sysTrapTblSetCustomDrawProcedure", 0xA1D5 }, - { "sysTrapTblSetRowSelectable", 0xA1D6 }, - { "sysTrapTblRowSelectable", 0xA1D7 }, - { "sysTrapTblSetLoadDataProcedure", 0xA1D8 }, - { "sysTrapTblSetSaveDataProcedure", 0xA1D9 }, - { "sysTrapTblGetBounds", 0xA1DA }, - { "sysTrapTblSetRowHeight", 0xA1DB }, - { "sysTrapTblGetColumnWidth", 0xA1DC }, - { "sysTrapTblGetRowID", 0xA1DD }, - { "sysTrapTblSetRowID", 0xA1DE }, - { "sysTrapTblMarkRowInvalid", 0xA1DF }, - { "sysTrapTblMarkTableInvalid", 0xA1E0 }, - { "sysTrapTblGetSelection", 0xA1E1 }, - { "sysTrapTblInsertRow", 0xA1E2 }, - { "sysTrapTblRemoveRow", 0xA1E3 }, - { "sysTrapTblRowInvalid", 0xA1E4 }, - { "sysTrapTblRedrawTable", 0xA1E5 }, - { "sysTrapTblRowUsable", 0xA1E6 }, - { "sysTrapTblReleaseFocus", 0xA1E7 }, - { "sysTrapTblEditing", 0xA1E8 }, - { "sysTrapTblGetCurrentField", 0xA1E9 }, - { "sysTrapTblSetColumnUsable", 0xA1EA }, - { "sysTrapTblGetRowHeight", 0xA1EB }, - { "sysTrapTblSetColumnWidth", 0xA1EC }, - { "sysTrapTblGrabFocus", 0xA1ED }, - { "sysTrapTblSetItemPtr", 0xA1EE }, - { "sysTrapTblFindRowID", 0xA1EF }, - { "sysTrapTblGetLastUsableRow", 0xA1F0 }, - { "sysTrapTblGetColumnSpacing", 0xA1F1 }, - { "sysTrapTblFindRowData", 0xA1F2 }, - { "sysTrapTblGetRowData", 0xA1F3 }, - { "sysTrapTblSetRowData", 0xA1F4 }, - { "sysTrapTblSetColumnSpacing", 0xA1F5 }, - { "sysTrapWinCreateWindow", 0xA1F6 }, - { "sysTrapWinCreateOffscreenWindow", 0xA1F7 }, - { "sysTrapWinDeleteWindow", 0xA1F8 }, - { "sysTrapWinInitializeWindow", 0xA1F9 }, - { "sysTrapWinAddWindow", 0xA1FA }, - { "sysTrapWinRemoveWindow", 0xA1FB }, - { "sysTrapWinSetActiveWindow", 0xA1FC }, - { "sysTrapWinSetDrawWindow", 0xA1FD }, - { "sysTrapWinGetDrawWindow", 0xA1FE }, - { "sysTrapWinGetActiveWindow", 0xA1FF }, - { "sysTrapWinGetDisplayWindow", 0xA200 }, - { "sysTrapWinGetFirstWindow", 0xA201 }, - { "sysTrapWinEnableWindow", 0xA202 }, - { "sysTrapWinDisableWindow", 0xA203 }, - { "sysTrapWinGetWindowFrameRect", 0xA204 }, - { "sysTrapWinDrawWindowFrame", 0xA205 }, - { "sysTrapWinEraseWindow", 0xA206 }, - { "sysTrapWinSaveBits", 0xA207 }, - { "sysTrapWinRestoreBits", 0xA208 }, - { "sysTrapWinCopyRectangle", 0xA209 }, - { "sysTrapWinScrollRectangle", 0xA20A }, - { "sysTrapWinGetDisplayExtent", 0xA20B }, - { "sysTrapWinGetWindowExtent", 0xA20C }, - { "sysTrapWinDisplayToWindowPt", 0xA20D }, - { "sysTrapWinWindowToDisplayPt", 0xA20E }, - { "sysTrapWinGetClip", 0xA20F }, - { "sysTrapWinSetClip", 0xA210 }, - { "sysTrapWinResetClip", 0xA211 }, - { "sysTrapWinClipRectangle", 0xA212 }, - { "sysTrapWinDrawLine", 0xA213 }, - { "sysTrapWinDrawGrayLine", 0xA214 }, - { "sysTrapWinEraseLine", 0xA215 }, - { "sysTrapWinInvertLine", 0xA216 }, - { "sysTrapWinFillLine", 0xA217 }, - { "sysTrapWinDrawRectangle", 0xA218 }, - { "sysTrapWinEraseRectangle", 0xA219 }, - { "sysTrapWinInvertRectangle", 0xA21A }, - { "sysTrapWinDrawRectangleFrame", 0xA21B }, - { "sysTrapWinDrawGrayRectangleFrame", 0xA21C }, - { "sysTrapWinEraseRectangleFrame", 0xA21D }, - { "sysTrapWinInvertRectangleFrame", 0xA21E }, - { "sysTrapWinGetFramesRectangle", 0xA21F }, - { "sysTrapWinDrawChars", 0xA220 }, - { "sysTrapWinEraseChars", 0xA221 }, - { "sysTrapWinInvertChars", 0xA222 }, - { "sysTrapWinGetPattern", 0xA223 }, - { "sysTrapWinSetPattern", 0xA224 }, - { "sysTrapWinSetUnderlineMode", 0xA225 }, - { "sysTrapWinDrawBitmap", 0xA226 }, - { "sysTrapWinModal", 0xA227 }, - { "sysTrapWinGetDrawWindowBounds", 0xA228 }, - { "sysTrapWinFillRectangle", 0xA229 }, - { "sysTrapWinDrawInvertedChars", 0xA22A }, - { "sysTrapPrefOpenPreferenceDBV10", 0xA22B }, - { "sysTrapPrefGetPreferences", 0xA22C }, - { "sysTrapPrefSetPreferences", 0xA22D }, - { "sysTrapPrefGetAppPreferencesV10", 0xA22E }, - { "sysTrapPrefSetAppPreferencesV10", 0xA22F }, - { "sysTrapSndInit", 0xA230 }, - { "sysTrapSndSetDefaultVolume", 0xA231 }, - { "sysTrapSndGetDefaultVolume", 0xA232 }, - { "sysTrapSndDoCmd", 0xA233 }, - { "sysTrapSndPlaySystemSound", 0xA234 }, - { "sysTrapAlmInit", 0xA235 }, - { "sysTrapAlmCancelAll", 0xA236 }, - { "sysTrapAlmAlarmCallback", 0xA237 }, - { "sysTrapAlmSetAlarm", 0xA238 }, - { "sysTrapAlmGetAlarm", 0xA239 }, - { "sysTrapAlmDisplayAlarm", 0xA23A }, - { "sysTrapAlmEnableNotification", 0xA23B }, - { "sysTrapHwrGetRAMMapping", 0xA23C }, - { "sysTrapHwrMemWritable", 0xA23D }, - { "sysTrapHwrMemReadable", 0xA23E }, - { "sysTrapHwrDoze", 0xA23F }, - { "sysTrapHwrSleep", 0xA240 }, - { "sysTrapHwrWake", 0xA241 }, - { "sysTrapHwrSetSystemClock", 0xA242 }, - { "sysTrapHwrSetCPUDutyCycle", 0xA243 }, - { "sysTrapHwrDisplayInit", 0xA244 }, - { "sysTrapHwrDisplaySleep", 0xA245 }, - { "sysTrapHwrTimerInit", 0xA246 }, - { "sysTrapHwrCursorV33", 0xA247 }, - { "sysTrapHwrBatteryLevel", 0xA248 }, - { "sysTrapHwrDelay", 0xA249 }, - { "sysTrapHwrEnableDataWrites", 0xA24A }, - { "sysTrapHwrDisableDataWrites", 0xA24B }, - { "sysTrapHwrLCDBaseAddrV33", 0xA24C }, - { "sysTrapHwrDisplayDrawBootScreen", 0xA24D }, - { "sysTrapHwrTimerSleep", 0xA24E }, - { "sysTrapHwrTimerWake", 0xA24F }, - { "sysTrapHwrDisplayWake", 0xA250 }, - { "sysTrapHwrIRQ1Handler", 0xA251 }, - { "sysTrapHwrIRQ2Handler", 0xA252 }, - { "sysTrapHwrIRQ3Handler", 0xA253 }, - { "sysTrapHwrIRQ4Handler", 0xA254 }, - { "sysTrapHwrIRQ5Handler", 0xA255 }, - { "sysTrapHwrIRQ6Handler", 0xA256 }, - { "sysTrapHwrDockSignals", 0xA257 }, - { "sysTrapHwrPluggedIn", 0xA258 }, - { "sysTrapCrc16CalcBlock", 0xA259 }, - { "sysTrapSelectDayV10", 0xA25A }, - { "sysTrapSelectTimeV33", 0xA25B }, - { "sysTrapDayDrawDaySelector", 0xA25C }, - { "sysTrapDayHandleEvent", 0xA25D }, - { "sysTrapDayDrawDays", 0xA25E }, - { "sysTrapDayOfWeek", 0xA25F }, - { "sysTrapDaysInMonth", 0xA260 }, - { "sysTrapDayOfMonth", 0xA261 }, - { "sysTrapDateDaysToDate", 0xA262 }, - { "sysTrapDateToDays", 0xA263 }, - { "sysTrapDateAdjust", 0xA264 }, - { "sysTrapDateSecondsToDate", 0xA265 }, - { "sysTrapDateToAscii", 0xA266 }, - { "sysTrapDateToDOWDMFormat", 0xA267 }, - { "sysTrapTimeToAscii", 0xA268 }, - { "sysTrapFind", 0xA269 }, - { "sysTrapFindStrInStr", 0xA26A }, - { "sysTrapFindSaveMatch", 0xA26B }, - { "sysTrapFindGetLineBounds", 0xA26C }, - { "sysTrapFindDrawHeader", 0xA26D }, - { "sysTrapPenOpen", 0xA26E }, - { "sysTrapPenClose", 0xA26F }, - { "sysTrapPenGetRawPen", 0xA270 }, - { "sysTrapPenCalibrate", 0xA271 }, - { "sysTrapPenRawToScreen", 0xA272 }, - { "sysTrapPenScreenToRaw", 0xA273 }, - { "sysTrapPenResetCalibration", 0xA274 }, - { "sysTrapPenSleep", 0xA275 }, - { "sysTrapPenWake", 0xA276 }, - { "sysTrapResLoadForm", 0xA277 }, - { "sysTrapResLoadMenu", 0xA278 }, - { "sysTrapFtrInit", 0xA279 }, - { "sysTrapFtrUnregister", 0xA27A }, - { "sysTrapFtrGet", 0xA27B }, - { "sysTrapFtrSet", 0xA27C }, - { "sysTrapFtrGetByIndex", 0xA27D }, - { "sysTrapGrfInit", 0xA27E }, - { "sysTrapGrfFree", 0xA27F }, - { "sysTrapGrfGetState", 0xA280 }, - { "sysTrapGrfSetState", 0xA281 }, - { "sysTrapGrfFlushPoints", 0xA282 }, - { "sysTrapGrfAddPoint", 0xA283 }, - { "sysTrapGrfInitState", 0xA284 }, - { "sysTrapGrfCleanState", 0xA285 }, - { "sysTrapGrfMatch", 0xA286 }, - { "sysTrapGrfGetMacro", 0xA287 }, - { "sysTrapGrfFilterPoints", 0xA288 }, - { "sysTrapGrfGetNumPoints", 0xA289 }, - { "sysTrapGrfGetPoint", 0xA28A }, - { "sysTrapGrfFindBranch", 0xA28B }, - { "sysTrapGrfMatchGlyph", 0xA28C }, - { "sysTrapGrfGetGlyphMapping", 0xA28D }, - { "sysTrapGrfGetMacroName", 0xA28E }, - { "sysTrapGrfDeleteMacro", 0xA28F }, - { "sysTrapGrfAddMacro", 0xA290 }, - { "sysTrapGrfGetAndExpandMacro", 0xA291 }, - { "sysTrapGrfProcessStroke", 0xA292 }, - { "sysTrapGrfFieldChange", 0xA293 }, - { "sysTrapGetCharSortValue", 0xA294 }, - { "sysTrapGetCharAttr", 0xA295 }, - { "sysTrapGetCharCaselessValue", 0xA296 }, - { "sysTrapPwdExists", 0xA297 }, - { "sysTrapPwdVerify", 0xA298 }, - { "sysTrapPwdSet", 0xA299 }, - { "sysTrapPwdRemove", 0xA29A }, - { "sysTrapGsiInitialize", 0xA29B }, - { "sysTrapGsiSetLocation", 0xA29C }, - { "sysTrapGsiEnable", 0xA29D }, - { "sysTrapGsiEnabled", 0xA29E }, - { "sysTrapGsiSetShiftState", 0xA29F }, - { "sysTrapKeyInit", 0xA2A0 }, - { "sysTrapKeyHandleInterrupt", 0xA2A1 }, - { "sysTrapKeyCurrentState", 0xA2A2 }, - { "sysTrapKeyResetDoubleTap", 0xA2A3 }, - { "sysTrapKeyRates", 0xA2A4 }, - { "sysTrapKeySleep", 0xA2A5 }, - { "sysTrapKeyWake", 0xA2A6 }, - { "sysTrapDlkControl", 0xA2A7 }, - { "sysTrapDlkStartServer", 0xA2A8 }, - { "sysTrapDlkGetSyncInfo", 0xA2A9 }, - { "sysTrapDlkSetLogEntry", 0xA2AA }, - { "sysTrapIntlDispatch", 0xA2AB }, - { "sysTrapSysLibLoad", 0xA2AC }, - { "sysTrapSndPlaySmf", 0xA2AD }, - { "sysTrapSndCreateMidiList", 0xA2AE }, - { "sysTrapAbtShowAbout", 0xA2AF }, - { "sysTrapMdmDial", 0xA2B0 }, - { "sysTrapMdmHangUp", 0xA2B1 }, - { "sysTrapDmSearchRecord", 0xA2B2 }, - { "sysTrapSysInsertionSort", 0xA2B3 }, - { "sysTrapDmInsertionSort", 0xA2B4 }, - { "sysTrapLstSetTopItem", 0xA2B5 }, - { "sysTrapSclSetScrollBar", 0xA2B6 }, - { "sysTrapSclDrawScrollBar", 0xA2B7 }, - { "sysTrapSclHandleEvent", 0xA2B8 }, - { "sysTrapSysMailboxCreate", 0xA2B9 }, - { "sysTrapSysMailboxDelete", 0xA2BA }, - { "sysTrapSysMailboxFlush", 0xA2BB }, - { "sysTrapSysMailboxSend", 0xA2BC }, - { "sysTrapSysMailboxWait", 0xA2BD }, - { "sysTrapSysTaskWait", 0xA2BE }, - { "sysTrapSysTaskWake", 0xA2BF }, - { "sysTrapSysTaskWaitClr", 0xA2C0 }, - { "sysTrapSysTaskSuspend", 0xA2C1 }, - { "sysTrapSysTaskResume", 0xA2C2 }, - { "sysTrapCategoryCreateList", 0xA2C3 }, - { "sysTrapCategoryFreeList", 0xA2C4 }, - { "sysTrapCategoryEditV20", 0xA2C5 }, - { "sysTrapCategorySelect", 0xA2C6 }, - { "sysTrapDmDeleteCategory", 0xA2C7 }, - { "sysTrapSysEvGroupCreate", 0xA2C8 }, - { "sysTrapSysEvGroupSignal", 0xA2C9 }, - { "sysTrapSysEvGroupRead", 0xA2CA }, - { "sysTrapSysEvGroupWait", 0xA2CB }, - { "sysTrapEvtEventAvail", 0xA2CC }, - { "sysTrapEvtSysEventAvail", 0xA2CD }, - { "sysTrapStrNCopy", 0xA2CE }, - { "sysTrapKeySetMask", 0xA2CF }, - { "sysTrapSelectDay", 0xA2D0 }, - { "sysTrapPrefGetPreference", 0xA2D1 }, - { "sysTrapPrefSetPreference", 0xA2D2 }, - { "sysTrapPrefGetAppPreferences", 0xA2D3 }, - { "sysTrapPrefSetAppPreferences", 0xA2D4 }, - { "sysTrapFrmPointInTitle", 0xA2D5 }, - { "sysTrapStrNCat", 0xA2D6 }, - { "sysTrapMemCmp", 0xA2D7 }, - { "sysTrapTblSetColumnEditIndicator", 0xA2D8 }, - { "sysTrapFntWordWrap", 0xA2D9 }, - { "sysTrapFldGetScrollValues", 0xA2DA }, - { "sysTrapSysCreateDataBaseList", 0xA2DB }, - { "sysTrapSysCreatePanelList", 0xA2DC }, - { "sysTrapDlkDispatchRequest", 0xA2DD }, - { "sysTrapStrPrintF", 0xA2DE }, - { "sysTrapStrVPrintF", 0xA2DF }, - { "sysTrapPrefOpenPreferenceDB", 0xA2E0 }, - { "sysTrapSysGraffitiReferenceDialog", 0xA2E1 }, - { "sysTrapSysKeyboardDialog", 0xA2E2 }, - { "sysTrapFntWordWrapReverseNLines", 0xA2E3 }, - { "sysTrapFntGetScrollValues", 0xA2E4 }, - { "sysTrapTblSetRowStaticHeight", 0xA2E5 }, - { "sysTrapTblHasScrollBar", 0xA2E6 }, - { "sysTrapSclGetScrollBar", 0xA2E7 }, - { "sysTrapFldGetNumberOfBlankLines", 0xA2E8 }, - { "sysTrapSysTicksPerSecond", 0xA2E9 }, - { "sysTrapHwrBacklightV33", 0xA2EA }, - { "sysTrapDmDatabaseProtect", 0xA2EB }, - { "sysTrapTblSetBounds", 0xA2EC }, - { "sysTrapStrNCompare", 0xA2ED }, - { "sysTrapStrNCaselessCompare", 0xA2EE }, - { "sysTrapPhoneNumberLookup", 0xA2EF }, - { "sysTrapFrmSetMenu", 0xA2F0 }, - { "sysTrapEncDigestMD5", 0xA2F1 }, - { "sysTrapDmFindSortPosition", 0xA2F2 }, - { "sysTrapSysBinarySearch", 0xA2F3 }, - { "sysTrapSysErrString", 0xA2F4 }, - { "sysTrapSysStringByIndex", 0xA2F5 }, - { "sysTrapEvtAddUniqueEventToQueue", 0xA2F6 }, - { "sysTrapStrLocalizeNumber", 0xA2F7 }, - { "sysTrapStrDelocalizeNumber", 0xA2F8 }, - { "sysTrapLocGetNumberSeparators", 0xA2F9 }, - { "sysTrapMenuSetActiveMenuRscID", 0xA2FA }, - { "sysTrapLstScrollList", 0xA2FB }, - { "sysTrapCategoryInitialize", 0xA2FC }, - { "sysTrapEncDigestMD4", 0xA2FD }, - { "sysTrapEncDES", 0xA2FE }, - { "sysTrapLstGetVisibleItems", 0xA2FF }, - { "sysTrapWinSetBounds", 0xA300 }, - { "sysTrapCategorySetName", 0xA301 }, - { "sysTrapFldSetInsertionPoint", 0xA302 }, - { "sysTrapFrmSetObjectBounds", 0xA303 }, - { "sysTrapWinSetColors", 0xA304 }, - { "sysTrapFlpDispatch", 0xA305 }, - { "sysTrapFlpEmDispatch", 0xA306 }, - { "sysTrapExgInit", 0xA307 }, - { "sysTrapExgConnect", 0xA308 }, - { "sysTrapExgPut", 0xA309 }, - { "sysTrapExgGet", 0xA30A }, - { "sysTrapExgAccept", 0xA30B }, - { "sysTrapExgDisconnect", 0xA30C }, - { "sysTrapExgSend", 0xA30D }, - { "sysTrapExgReceive", 0xA30E }, - { "sysTrapExgRegisterData", 0xA30F }, - { "sysTrapExgNotifyReceiveV35", 0xA310 }, - { "sysTrapSysReserved30Trap2", 0xA311 }, - { "sysTrapPrgStartDialogV31", 0xA312 }, - { "sysTrapPrgStopDialog", 0xA313 }, - { "sysTrapPrgUpdateDialog", 0xA314 }, - { "sysTrapPrgHandleEvent", 0xA315 }, - { "sysTrapImcReadFieldNoSemicolon", 0xA316 }, - { "sysTrapImcReadFieldQuotablePrintable", 0xA317 }, - { "sysTrapImcReadPropertyParameter", 0xA318 }, - { "sysTrapImcSkipAllPropertyParameters", 0xA319 }, - { "sysTrapImcReadWhiteSpace", 0xA31A }, - { "sysTrapImcWriteQuotedPrintable", 0xA31B }, - { "sysTrapImcWriteNoSemicolon", 0xA31C }, - { "sysTrapImcStringIsAscii", 0xA31D }, - { "sysTrapTblGetItemFont", 0xA31E }, - { "sysTrapTblSetItemFont", 0xA31F }, - { "sysTrapFontSelect", 0xA320 }, - { "sysTrapFntDefineFont", 0xA321 }, - { "sysTrapCategoryEdit", 0xA322 }, - { "sysTrapSysGetOSVersionString", 0xA323 }, - { "sysTrapSysBatteryInfo", 0xA324 }, - { "sysTrapSysUIBusy", 0xA325 }, - { "sysTrapWinValidateHandle", 0xA326 }, - { "sysTrapFrmValidatePtr", 0xA327 }, - { "sysTrapCtlValidatePointer", 0xA328 }, - { "sysTrapWinMoveWindowAddr", 0xA329 }, - { "sysTrapFrmAddSpaceForObject", 0xA32A }, - { "sysTrapFrmNewForm", 0xA32B }, - { "sysTrapCtlNewControl", 0xA32C }, - { "sysTrapFldNewField", 0xA32D }, - { "sysTrapLstNewList", 0xA32E }, - { "sysTrapFrmNewLabel", 0xA32F }, - { "sysTrapFrmNewBitmap", 0xA330 }, - { "sysTrapFrmNewGadget", 0xA331 }, - { "sysTrapFileOpen", 0xA332 }, - { "sysTrapFileClose", 0xA333 }, - { "sysTrapFileDelete", 0xA334 }, - { "sysTrapFileReadLow", 0xA335 }, - { "sysTrapFileWrite", 0xA336 }, - { "sysTrapFileSeek", 0xA337 }, - { "sysTrapFileTell", 0xA338 }, - { "sysTrapFileTruncate", 0xA339 }, - { "sysTrapFileControl", 0xA33A }, - { "sysTrapFrmActiveState", 0xA33B }, - { "sysTrapSysGetAppInfo", 0xA33C }, - { "sysTrapSysGetStackInfo", 0xA33D }, - { "sysTrapWinScreenMode", 0xA33E }, - { "sysTrapHwrLCDGetDepthV33", 0xA33F }, - { "sysTrapHwrGetROMToken", 0xA340 }, - { "sysTrapDbgControl", 0xA341 }, - { "sysTrapExgDBRead", 0xA342 }, - { "sysTrapExgDBWrite", 0xA343 }, - { "sysTrapHostControl", 0xA344 }, - { "sysTrapFrmRemoveObject", 0xA345 }, - { "sysTrapSysReserved30Trap1", 0xA346 }, - { "sysTrapExpansionDispatch", 0xA347 }, - { "sysTrapFileSystemDispatch", 0xA348 }, - { "sysTrapOEMDispatch", 0xA349 }, - { "sysTrapHwrLCDContrastV33", 0xA34A }, - { "sysTrapSysLCDContrast", 0xA34B }, - { "sysTrapUIContrastAdjust", 0xA34C }, - { "sysTrapHwrDockStatus", 0xA34D }, - { "sysTrapFntWidthToOffset", 0xA34E }, - { "sysTrapSelectOneTime", 0xA34F }, - { "sysTrapWinDrawChar", 0xA350 }, - { "sysTrapWinDrawTruncChars", 0xA351 }, - { "sysTrapSysNotifyInit", 0xA352 }, - { "sysTrapSysNotifyRegister", 0xA353 }, - { "sysTrapSysNotifyUnregister", 0xA354 }, - { "sysTrapSysNotifyBroadcast", 0xA355 }, - { "sysTrapSysNotifyBroadcastDeferred", 0xA356 }, - { "sysTrapSysNotifyDatabaseAdded", 0xA357 }, - { "sysTrapSysNotifyDatabaseRemoved", 0xA358 }, - { "sysTrapSysWantEvent", 0xA359 }, - { "sysTrapFtrPtrNew", 0xA35A }, - { "sysTrapFtrPtrFree", 0xA35B }, - { "sysTrapFtrPtrResize", 0xA35C }, - { "sysTrapSysReserved31Trap1", 0xA35D }, - { "sysTrapHwrNVPrefSet", 0xA35E }, - { "sysTrapHwrNVPrefGet", 0xA35F }, - { "sysTrapFlashInit", 0xA360 }, - { "sysTrapFlashCompress", 0xA361 }, - { "sysTrapFlashErase", 0xA362 }, - { "sysTrapFlashProgram", 0xA363 }, - { "sysTrapAlmTimeChange", 0xA364 }, - { "sysTrapErrAlertCustom", 0xA365 }, - { "sysTrapPrgStartDialog", 0xA366 }, - { "sysTrapSerialDispatch", 0xA367 }, - { "sysTrapHwrBattery", 0xA368 }, - { "sysTrapDmGetDatabaseLockState", 0xA369 }, - { "sysTrapCncGetProfileList", 0xA36A }, - { "sysTrapCncGetProfileInfo", 0xA36B }, - { "sysTrapCncAddProfile", 0xA36C }, - { "sysTrapCncDeleteProfile", 0xA36D }, - { "sysTrapSndPlaySmfResource", 0xA36E }, - { "sysTrapMemPtrDataStorage", 0xA36F }, - { "sysTrapClipboardAppendItem", 0xA370 }, - { "sysTrapWiCmdV32", 0xA371 }, - { "sysTrapHwrDisplayAttributes", 0xA372 }, - { "sysTrapHwrDisplayDoze", 0xA373 }, - { "sysTrapHwrDisplayPalette", 0xA374 }, - { "sysTrapBltFindIndexes", 0xA375 }, - { "sysTrapBmpGetBits", 0xA376 }, - { "sysTrapBltCopyRectangle", 0xA377 }, - { "sysTrapBltDrawChars", 0xA378 }, - { "sysTrapBltLineRoutine", 0xA379 }, - { "sysTrapBltRectangleRoutine", 0xA37A }, - { "sysTrapScrCompress", 0xA37B }, - { "sysTrapScrDecompress", 0xA37C }, - { "sysTrapSysLCDBrightness", 0xA37D }, - { "sysTrapWinPaintChar", 0xA37E }, - { "sysTrapWinPaintChars", 0xA37F }, - { "sysTrapWinPaintBitmap", 0xA380 }, - { "sysTrapWinGetPixel", 0xA381 }, - { "sysTrapWinPaintPixel", 0xA382 }, - { "sysTrapWinDrawPixel", 0xA383 }, - { "sysTrapWinErasePixel", 0xA384 }, - { "sysTrapWinInvertPixel", 0xA385 }, - { "sysTrapWinPaintPixels", 0xA386 }, - { "sysTrapWinPaintLines", 0xA387 }, - { "sysTrapWinPaintLine", 0xA388 }, - { "sysTrapWinPaintRectangle", 0xA389 }, - { "sysTrapWinPaintRectangleFrame", 0xA38A }, - { "sysTrapWinPaintPolygon", 0xA38B }, - { "sysTrapWinDrawPolygon", 0xA38C }, - { "sysTrapWinErasePolygon", 0xA38D }, - { "sysTrapWinInvertPolygon", 0xA38E }, - { "sysTrapWinFillPolygon", 0xA38F }, - { "sysTrapWinPaintArc", 0xA390 }, - { "sysTrapWinDrawArc", 0xA391 }, - { "sysTrapWinEraseArc", 0xA392 }, - { "sysTrapWinInvertArc", 0xA393 }, - { "sysTrapWinFillArc", 0xA394 }, - { "sysTrapWinPushDrawState", 0xA395 }, - { "sysTrapWinPopDrawState", 0xA396 }, - { "sysTrapWinSetDrawMode", 0xA397 }, - { "sysTrapWinSetForeColor", 0xA398 }, - { "sysTrapWinSetBackColor", 0xA399 }, - { "sysTrapWinSetTextColor", 0xA39A }, - { "sysTrapWinGetPatternType", 0xA39B }, - { "sysTrapWinSetPatternType", 0xA39C }, - { "sysTrapWinPalette", 0xA39D }, - { "sysTrapWinRGBToIndex", 0xA39E }, - { "sysTrapWinIndexToRGB", 0xA39F }, - { "sysTrapWinScreenLock", 0xA3A0 }, - { "sysTrapWinScreenUnlock", 0xA3A1 }, - { "sysTrapWinGetBitmap", 0xA3A2 }, - { "sysTrapUIColorInit", 0xA3A3 }, - { "sysTrapUIColorGetTableEntryIndex", 0xA3A4 }, - { "sysTrapUIColorGetTableEntryRGB", 0xA3A5 }, - { "sysTrapUIColorSetTableEntry", 0xA3A6 }, - { "sysTrapUIColorPushTable", 0xA3A7 }, - { "sysTrapUIColorPopTable", 0xA3A8 }, - { "sysTrapCtlNewGraphicControl", 0xA3A9 }, - { "sysTrapTblGetItemPtr", 0xA3AA }, - { "sysTrapUIBrightnessAdjust", 0xA3AB }, - { "sysTrapUIPickColor", 0xA3AC }, - { "sysTrapEvtSetAutoOffTimer", 0xA3AD }, - { "sysTrapTsmDispatch", 0xA3AE }, - { "sysTrapOmDispatch", 0xA3AF }, - { "sysTrapDmOpenDBNoOverlay", 0xA3B0 }, - { "sysTrapDmOpenDBWithLocale", 0xA3B1 }, - { "sysTrapResLoadConstant", 0xA3B2 }, - { "sysTrapHwrPreDebugInit", 0xA3B3 }, - { "sysTrapHwrResetNMI", 0xA3B4 }, - { "sysTrapHwrResetPWM", 0xA3B5 }, - { "sysTrapKeyBootKeys", 0xA3B6 }, - { "sysTrapDbgSerDrvOpen", 0xA3B7 }, - { "sysTrapDbgSerDrvClose", 0xA3B8 }, - { "sysTrapDbgSerDrvControl", 0xA3B9 }, - { "sysTrapDbgSerDrvStatus", 0xA3BA }, - { "sysTrapDbgSerDrvWriteChar", 0xA3BB }, - { "sysTrapDbgSerDrvReadChar", 0xA3BC }, - { "sysTrapHwrPostDebugInit", 0xA3BD }, - { "sysTrapHwrIdentifyFeatures", 0xA3BE }, - { "sysTrapHwrModelSpecificInit", 0xA3BF }, - { "sysTrapHwrModelInitStage2", 0xA3C0 }, - { "sysTrapHwrInterruptsInit", 0xA3C1 }, - { "sysTrapHwrSoundOn", 0xA3C2 }, - { "sysTrapHwrSoundOff", 0xA3C3 }, - { "sysTrapSysKernelClockTick", 0xA3C4 }, - { "sysTrapMenuEraseMenu", 0xA3C5 }, - { "sysTrapSelectTime", 0xA3C6 }, - { "sysTrapMenuCmdBarAddButton", 0xA3C7 }, - { "sysTrapMenuCmdBarGetButtonData", 0xA3C8 }, - { "sysTrapMenuCmdBarDisplay", 0xA3C9 }, - { "sysTrapHwrGetSilkscreenID", 0xA3CA }, - { "sysTrapEvtGetSilkscreenAreaList", 0xA3CB }, - { "sysTrapSysFatalAlertInit", 0xA3CC }, - { "sysTrapDateTemplateToAscii", 0xA3CD }, - { "sysTrapSecVerifyPW", 0xA3CE }, - { "sysTrapSecSelectViewStatus", 0xA3CF }, - { "sysTrapTblSetColumnMasked", 0xA3D0 }, - { "sysTrapTblSetRowMasked", 0xA3D1 }, - { "sysTrapTblRowMasked", 0xA3D2 }, - { "sysTrapFrmCustomResponseAlert", 0xA3D3 }, - { "sysTrapFrmNewGsi", 0xA3D4 }, - { "sysTrapMenuShowItem", 0xA3D5 }, - { "sysTrapMenuHideItem", 0xA3D6 }, - { "sysTrapMenuAddItem", 0xA3D7 }, - { "sysTrapFrmSetGadgetHandler", 0xA3D8 }, - { "sysTrapCtlSetGraphics", 0xA3D9 }, - { "sysTrapCtlGetSliderValues", 0xA3DA }, - { "sysTrapCtlSetSliderValues", 0xA3DB }, - { "sysTrapCtlNewSliderControl", 0xA3DC }, - { "sysTrapBmpCreate", 0xA3DD }, - { "sysTrapBmpDelete", 0xA3DE }, - { "sysTrapBmpCompress", 0xA3DF }, - { "sysTrapBmpGetColortable", 0xA3E0 }, - { "sysTrapBmpSize", 0xA3E1 }, - { "sysTrapBmpBitsSize", 0xA3E2 }, - { "sysTrapBmpColortableSize", 0xA3E3 }, - { "sysTrapWinCreateBitmapWindow", 0xA3E4 }, - { "sysTrapEvtSetNullEventTick", 0xA3E5 }, - { "sysTrapExgDoDialog", 0xA3E6 }, - { "sysTrapSysUICleanup", 0xA3E7 }, - { "sysTrapWinSetForeColorRGB", 0xA3E8 }, - { "sysTrapWinSetBackColorRGB", 0xA3E9 }, - { "sysTrapWinSetTextColorRGB", 0xA3EA }, - { "sysTrapWinGetPixelRGB", 0xA3EB }, - { "sysTrapHighDensityDispatch", 0xA3EC }, - { "sysTrapSysReserved40Trap2", 0xA3ED }, - { "sysTrapSysReserved40Trap3", 0xA3EE }, - { "sysTrapSysReserved40Trap4", 0xA3EF }, - { "sysTrapCncMgrDispatch", 0xA3F0 }, - { "sysTrapSysNotifyBroadcastFromInterrupt", 0xA3F1 }, - { "sysTrapEvtWakeupWithoutNilEvent", 0xA3F2 }, - { "sysTrapStrCompareAscii", 0xA3F3 }, - { "sysTrapAccessorDispatch", 0xA3F4 }, - { "sysTrapBltGetPixel", 0xA3F5 }, - { "sysTrapBltPaintPixel", 0xA3F6 }, - { "sysTrapScrScreenInit", 0xA3F7 }, - { "sysTrapScrUpdateScreenBitmap", 0xA3F8 }, - { "sysTrapScrPalette", 0xA3F9 }, - { "sysTrapScrGetColortable", 0xA3FA }, - { "sysTrapScrGetGrayPat", 0xA3FB }, - { "sysTrapScrScreenLock", 0xA3FC }, - { "sysTrapScrScreenUnlock", 0xA3FD }, - { "sysTrapFntPrvGetFontList", 0xA3FE }, - { "sysTrapExgRegisterDatatype", 0xA3FF }, - { "sysTrapExgNotifyReceive", 0xA400 }, - { "sysTrapExgNotifyGoto", 0xA401 }, - { "sysTrapExgRequest", 0xA402 }, - { "sysTrapExgSetDefaultApplication", 0xA403 }, - { "sysTrapExgGetDefaultApplication", 0xA404 }, - { "sysTrapExgGetTargetApplication", 0xA405 }, - { "sysTrapExgGetRegisteredApplications", 0xA406 }, - { "sysTrapExgGetRegisteredTypes", 0xA407 }, - { "sysTrapExgNotifyPreview", 0xA408 }, - { "sysTrapExgControl", 0xA409 }, - { "sysTrapLmDispatch", 0xA40A }, - { "sysTrapMemGetRomNVParams", 0xA40B }, - { "sysTrapFntWCharWidth", 0xA40C }, - { "sysTrapDmFindDatabaseWithTypeCreator", 0xA40D }, - { "sysTrapSelectTimeZone", 0xA40E }, - { "sysTrapTimeZoneToAscii", 0xA40F }, - { "sysTrapStrNCompareAscii", 0xA410 }, - { "sysTrapTimTimeZoneToUTC", 0xA411 }, - { "sysTrapTimUTCToTimeZone", 0xA412 }, - { "sysTrapPhoneNumberLookupCustom", 0xA413 }, - { "sysTrapHwrDebugSelect", 0xA414 }, - { "sysTrapBltRoundedRectangle", 0xA415 }, - { "sysTrapBltRoundedRectangleFill", 0xA416 }, - { "sysTrapWinPrvInitCanvas", 0xA417 }, - { "sysTrapHwrCalcDynamicHeapSize", 0xA418 }, - { "sysTrapHwrDebuggerEnter", 0xA419 }, - { "sysTrapHwrDebuggerExit", 0xA41A }, - { "sysTrapLstGetTopItem", 0xA41B }, - { "sysTrapHwrModelInitStage3", 0xA41C }, - { "sysTrapAttnIndicatorAllow", 0xA41D }, - { "sysTrapAttnIndicatorAllowed", 0xA41E }, - { "sysTrapAttnIndicatorEnable", 0xA41F }, - { "sysTrapAttnIndicatorEnabled", 0xA420 }, - { "sysTrapAttnIndicatorSetBlinkPattern", 0xA421 }, - { "sysTrapAttnIndicatorGetBlinkPattern", 0xA422 }, - { "sysTrapAttnIndicatorTicksTillNextBlink", 0xA423 }, - { "sysTrapAttnIndicatorCheckBlink", 0xA424 }, - { "sysTrapAttnInitialize", 0xA425 }, - { "sysTrapAttnGetAttention", 0xA426 }, - { "sysTrapAttnUpdate", 0xA427 }, - { "sysTrapAttnForgetIt", 0xA428 }, - { "sysTrapAttnGetCounts", 0xA429 }, - { "sysTrapAttnListOpen", 0xA42A }, - { "sysTrapAttnHandleEvent", 0xA42B }, - { "sysTrapAttnEffectOfEvent", 0xA42C }, - { "sysTrapAttnIterate", 0xA42D }, - { "sysTrapAttnDoSpecialEffects", 0xA42E }, - { "sysTrapAttnDoEmergencySpecialEffects", 0xA42F }, - { "sysTrapAttnAllowClose", 0xA430 }, - { "sysTrapAttnReopen", 0xA431 }, - { "sysTrapAttnEnableNotification", 0xA432 }, - { "sysTrapHwrLEDAttributes", 0xA433 }, - { "sysTrapHwrVibrateAttributes", 0xA434 }, - { "sysTrapSecGetPwdHint", 0xA435 }, - { "sysTrapSecSetPwdHint", 0xA436 }, - { "sysTrapHwrFlashWrite", 0xA437 }, - { "sysTrapKeyboardStatusNew", 0xA438 }, - { "sysTrapKeyboardStatusFree", 0xA439 }, - { "sysTrapKbdSetLayout", 0xA43A }, - { "sysTrapKbdGetLayout", 0xA43B }, - { "sysTrapKbdSetPosition", 0xA43C }, - { "sysTrapKbdGetPosition", 0xA43D }, - { "sysTrapKbdSetShiftState", 0xA43E }, - { "sysTrapKbdGetShiftState", 0xA43F }, - { "sysTrapKbdDraw", 0xA440 }, - { "sysTrapKbdErase", 0xA441 }, - { "sysTrapKbdHandleEvent", 0xA442 }, - { "sysTrapOEMDispatch2", 0xA443 }, - { "sysTrapHwrCustom", 0xA444 }, - { "sysTrapFrmGetActiveField", 0xA445 }, - { "sysTrapSndPlaySmfIrregardless", 0xA446 }, - { "sysTrapSndPlaySmfResourceIrregardless", 0xA447 }, - { "sysTrapSndInterruptSmfIrregardless", 0xA448 }, - { "sysTrapUdaMgrDispatch", 0xA449 }, - { "sysTrapPalmPrivate1", 0xA44A }, - { "sysTrapPalmPrivate2", 0xA44B }, - { "sysTrapPalmPrivate3", 0xA44C }, - { "sysTrapPalmPrivate4", 0xA44D }, - { "sysTrapBmpGetDimensions", 0xA44E }, - { "sysTrapBmpGetBitDepth", 0xA44F }, - { "sysTrapBmpGetNextBitmap", 0xA450 }, - { "sysTrapTblGetNumberOfColumns", 0xA451 }, - { "sysTrapTblGetTopRow", 0xA452 }, - { "sysTrapTblSetSelection", 0xA453 }, - { "sysTrapFrmGetObjectIndexFromPtr", 0xA454 }, - { "sysTrapBmpGetSizes", 0xA455 }, - { "sysTrapWinGetBounds", 0xA456 }, - { "sysTrapBltPaintPixels", 0xA457 }, - { "sysTrapFldSetMaxVisibleLines", 0xA458 }, - { "sysTrapScrDefaultPaletteState", 0xA459 }, - { "sysTrapPceNativeCall", 0xA45A }, - { "sysTrapSndStreamCreate", 0xA45B }, - { "sysTrapSndStreamDelete", 0xA45C }, - { "sysTrapSndStreamStart", 0xA45D }, - { "sysTrapSndStreamPause", 0xA45E }, - { "sysTrapSndStreamStop", 0xA45F }, - { "sysTrapSndStreamSetVolume", 0xA460 }, - { "sysTrapSndStreamGetVolume", 0xA461 }, - { "sysTrapSndPlayResource", 0xA462 }, - { "sysTrapSndStreamSetPan", 0xA463 }, - { "sysTrapSndStreamGetPan", 0xA464 }, - { "sysTrapMultimediaDispatch", 0xA465 }, - { "sysTrapSndStreamCreateExtended", 0xa466 }, - { "sysTrapSndStreamDeviceControl", 0xa467 }, - { "sysTrapBmpCreateVersion3", 0xA468 }, - { "sysTrapECFixedMul", 0xA469 }, - { "sysTrapECFixedDiv", 0xA46A }, - { "sysTrapHALDrawGetSupportedDensity", 0xA46B }, - { "sysTrapHALRedrawInputArea", 0xA46C }, - { "sysTrapGrfBeginStroke", 0xA46D }, - { "sysTrapBmpPrvConvertBitmap", 0xA46E }, - { "sysTrapSysReservedTrap5", 0xA46F }, - { "sysTrapPinsDispatch", 0xA470 }, - { "sysTrapSysReservedTrap1", 0xA471 }, - { "sysTrapSysReservedTrap2", 0xA472 }, - { "sysTrapSysReservedTrap3", 0xA473 }, - { "sysTrapSysReservedTrap4", 0xA474 }, - { "sysTrapLastTrapNumber", 0xA475 } - }; - - int i; - - for (i = 0; i < ARRAY_LENGTH(traps); i++) - { - if (traps[i].trap == opcode) - return traps[i].name; - } - return NULL; -} - -static offs_t palm_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) -{ - UINT16 opcode; - unsigned result = 0; - const char *trap; - - opcode = *((UINT16 *) oprom); - opcode = ((opcode >> 8) & 0x00ff) | ((opcode << 8) & 0xff00); - if (opcode == 0x4E4F) - { - UINT16 callnum = *((UINT16 *) (oprom + 2)); - callnum = ((callnum >> 8) & 0x00ff) | ((callnum << 8) & 0xff00); - trap = lookup_trap(callnum); - result = 2; - if (trap) - { - strcpy(buffer, trap); - } - else - { - sprintf(buffer, "trap #$f"); - } - } - else if ((opcode & 0xF000) == 0xA000) - { - sprintf(buffer, "Call Index: %04x", opcode); - result = 2; - } - return result; -} diff --git a/src/mess/drivers/palmz22.c b/src/mess/drivers/palmz22.c deleted file mode 100644 index 7228d55d288..00000000000 --- a/src/mess/drivers/palmz22.c +++ /dev/null @@ -1,338 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/******************************************************************************* - - Palm Z22 - - (C) 2011 Tim Schuerewegen - -*******************************************************************************/ - -/* - -Hardware ... - -Samsung OCEAN-L-20 (SoC) -Samsung K9F5608U0D-JIB0 (NAND) -Samsung K4S2816321-UL75 (RAM) - -The following reads are harmless ... - -'maincpu' (3060017C): (GPIO) 56000080 -> 00010020 -'maincpu' (30600960): unmapped program memory read from A0000000 & FFFFFFFF -'maincpu' (30600960): unmapped program memory read from A0000020 & FFFFFFFF -'maincpu' (30600960): unmapped program memory read from A0000040 & FFFFFFFF -... -'maincpu' (306411D4): (GPIO) 56000000 -> 005E03FF -'maincpu' (306411E0): (GPIO) 56000004 -> 0041F000 -'maincpu' (30641258): (GPIO) 56000010 -> 00000015 -'maincpu' (30641264): (GPIO) 56000010 -> 00000005 -'maincpu' (306412C4): (GPIO) 56000040 -> 00155400 -'maincpu' (306412D0): (GPIO) 56000040 -> 00155000 -'maincpu' (306412DC): (GPIO) 56000044 -> 00000442 -'maincpu' (306412F0): (GPIO) 56000000 -> 005E03FF -'maincpu' (306412FC): (GPIO) 56000000 -> 001E03FF -'maincpu' (30641308): (GPIO) 56000004 -> 0041F000 -'maincpu' (30641320): (GPIO) 56000010 -> 00000025 -'maincpu' (30641330): (GPIO) 56000010 -> 00000024 - -The following reads are NOT harmless ... - -'maincpu' (3060022C): (GPIO) 56000044 -> 00000400 ... bits 2..1 is tested - -if bits 2..1 = 0 then - 'maincpu' (30600240): (GPIO) 56000040 <- 00154400 - 'maincpu' (3060024C): (GPIO) 56000044 <- 00000000 - 'maincpu' (30600258): (GPIO) 56000048 <- 000007A0 -else - 'maincpu' (30600268): (GPIO) 56000040 <- 00155400 - 'maincpu' (30600274): (GPIO) 56000044 <- 00000440 - 'maincpu' (30600280): (GPIO) 56000048 <- 000007E6 -end - -'maincpu' (3060004C): (GPIO) 56000054 -> 000000FF -'maincpu' (30600060): (GPIO) 56000054 -> 000000FF -'maincpu' (30600074): (GPIO) 56000054 -> 000000FF -'maincpu' (30600088): (GPIO) 56000054 -> 000000FF -'maincpu' (3060009C): (GPIO) 56000054 -> 000000FF -'maincpu' (306000B0): (GPIO) 56000054 -> 000000FF -'maincpu' (306000C4): (GPIO) 56000054 -> 000000FF -'maincpu' (306000D8): (GPIO) 56000054 -> 000000FF ... check if keys are pressed? (8 bits) - -'maincpu' (3064116C): unmapped program memory read from 4D000068 & FFFFFFFF ... should read 0 or else stuck in a loop? - -*/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "machine/s3c2410.h" -#include "machine/smartmed.h" -#include "rendlay.h" - -#define PALM_Z22_BATTERY_LEVEL 75 - -#define VERBOSE_LEVEL ( 0 ) - -class palmz22_state : public driver_device -{ -public: - palmz22_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_s3c2410(*this, "s3c2410") - { } - - required_device m_maincpu; - - required_device m_s3c2410; - nand_device *m_nand; - - UINT32 m_port[8]; - DECLARE_DRIVER_INIT(palmz22); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_INPUT_CHANGED_MEMBER(palmz22_input_changed); - inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); - DECLARE_WRITE8_MEMBER( s3c2410_nand_command_w ); - DECLARE_WRITE8_MEMBER( s3c2410_nand_address_w ); - DECLARE_READ8_MEMBER( s3c2410_nand_data_r ); - DECLARE_WRITE8_MEMBER( s3c2410_nand_data_w ); - DECLARE_READ32_MEMBER(s3c2410_gpio_port_r); - DECLARE_WRITE32_MEMBER(s3c2410_gpio_port_w); - DECLARE_READ32_MEMBER(s3c2410_core_pin_r); - DECLARE_READ32_MEMBER(s3c2410_adc_data_r ); - -}; - - -inline void palmz22_state::verboselog(int n_level, const char *s_fmt, ...) -{ - if (VERBOSE_LEVEL >= n_level) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt); - vsprintf( buf, s_fmt, v); - va_end( v); - logerror( "%s: %s", machine().describe_context(), buf); - } -} - -/*************************************************************************** - MACHINE HARDWARE -***************************************************************************/ - -// NAND - -WRITE8_MEMBER( palmz22_state::s3c2410_nand_command_w ) -{ - verboselog(9, "s3c2410_nand_command_w %02X\n", data); - m_nand->command_w(data); -} - -WRITE8_MEMBER( palmz22_state::s3c2410_nand_address_w ) -{ - verboselog(9, "s3c2410_nand_address_w %02X\n", data); - m_nand->address_w(data); -} - -READ8_MEMBER( palmz22_state::s3c2410_nand_data_r ) -{ - UINT8 data = m_nand->data_r(); - verboselog(9, "s3c2410_nand_data_r %02X\n", data); - return data; -} - -WRITE8_MEMBER( palmz22_state::s3c2410_nand_data_w ) -{ - verboselog(9, "s3c2410_nand_data_w %02X\n", data); - m_nand->data_w(data); -} - -/* -READ8_MEMBER( palmz22_state::s3c2410_nand_busy_r ) -{ - UINT8 data = m_nand->is_busy(); - verboselog(9, "s3c2410_nand_busy_r %02X\n", data); - return data; -} -*/ - -// GPIO - -READ32_MEMBER(palmz22_state::s3c2410_gpio_port_r) -{ - UINT32 data = m_port[offset]; - switch (offset) - { - case S3C2410_GPIO_PORT_E : - { - data = (data & ~(3 << 1)) | (0 << 1); // bits 2..1 = LCD related? (0 = clear 4D000010 bit 3, 1 = clear 560000000 bit 22) - //data = 0x1F4; - } - break; - case S3C2410_GPIO_PORT_F : - { - data = (data & ~0xFF) | (ioport( "PORT-F")->read() & 0xFF); - } - break; - case S3C2410_GPIO_PORT_G : - { - data = (data & ~(1 << 1)) | (0 << 1); // bit 1 | 'maincpu' (200B56C0): (GPIO) 56000064 -> 00000000 - data = (data & ~(1 << 2)) | (0 << 2); // bit 2 | 'maincpu' (200B3EC4): (GPIO) 56000064 -> 00000000 - } - break; - } - return data; -} - -WRITE32_MEMBER(palmz22_state::s3c2410_gpio_port_w) -{ - m_port[offset] = data; -} - -// CORE - -/* - -OM[1:0] = 00b : Enable NAND flash controller auto boot mode - -NAND flash memory page size should be 512Bytes. - -NCON : NAND flash memory address step selection -0 : 3 Step addressing -1 : 4 Step addressing - -*/ - -READ32_MEMBER(palmz22_state::s3c2410_core_pin_r) -{ - int data = 0; - switch (offset) - { - case S3C2410_CORE_PIN_NCON : data = 0; break; - case S3C2410_CORE_PIN_OM0 : data = 0; break; - case S3C2410_CORE_PIN_OM1 : data = 0; break; - } - return data; -} - -// ADC - -READ32_MEMBER(palmz22_state::s3c2410_adc_data_r ) -{ - UINT32 data = 0; - switch (offset) - { - case 0 + 0 : data = 0x2EE + (PALM_Z22_BATTERY_LEVEL * 0xFF / 100); break; - case 0 + 1 : data = 0; break; - case 2 + 0 : data = ioport( "PENX")->read(); break; - case 2 + 1 : data = 0x3FF - ioport( "PENY")->read(); break; - } - verboselog(5, "s3c2410_adc_data_r %08X\n", data); - return data; -} - -// INPUT - -INPUT_CHANGED_MEMBER(palmz22_state::palmz22_input_changed) -{ - if (param == 0) - { - m_s3c2410->s3c2410_touch_screen( (newval & 0x01) ? 1 : 0); - } - else - { - m_s3c2410->s3c2410_request_eint( (FPTR)param - 1); - } -} - -// MACHINE - -void palmz22_state::machine_start() -{ - m_nand = machine().device("nand"); - m_nand->set_data_ptr( memregion("nand")->base()); -} - -void palmz22_state::machine_reset() -{ - m_maincpu->reset(); - memset( m_port, 0, sizeof( m_port)); -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( palmz22_map, AS_PROGRAM, 32, palmz22_state ) - AM_RANGE(0x30000000, 0x31ffffff) AM_RAM -ADDRESS_MAP_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -DRIVER_INIT_MEMBER(palmz22_state,palmz22) -{ -} - -static MACHINE_CONFIG_START( palmz22, palmz22_state ) - MCFG_CPU_ADD("maincpu", ARM920T, 266000000) - MCFG_CPU_PROGRAM_MAP(palmz22_map) - - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(160, 160) - MCFG_SCREEN_VISIBLE_AREA(0, 160 - 1, 0, 160 - 1) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_SCREEN_UPDATE_DEVICE("s3c2410", s3c2410_device, screen_update) - - MCFG_DEVICE_ADD("s3c2410", S3C2410, 12000000) - MCFG_S3C2410_PALETTE("palette") - MCFG_S3C2410_CORE_PIN_R_CB(READ32(palmz22_state, s3c2410_core_pin_r)) - MCFG_S3C2410_GPIO_PORT_R_CB(READ32(palmz22_state, s3c2410_gpio_port_r)) - MCFG_S3C2410_GPIO_PORT_W_CB(WRITE32(palmz22_state, s3c2410_gpio_port_w)) - MCFG_S3C2410_ADC_DATA_R_CB(READ32(palmz22_state, s3c2410_adc_data_r)) - MCFG_S3C2410_NAND_COMMAND_W_CB(WRITE8(palmz22_state, s3c2410_nand_command_w)) - MCFG_S3C2410_NAND_ADDRESS_W_CB(WRITE8(palmz22_state, s3c2410_nand_address_w)) - MCFG_S3C2410_NAND_DATA_R_CB(READ8(palmz22_state, s3c2410_nand_data_r)) - MCFG_S3C2410_NAND_DATA_W_CB(WRITE8(palmz22_state, s3c2410_nand_data_w)) - - MCFG_DEVICE_ADD("nand", NAND, 0) - MCFG_NAND_TYPE(NAND_CHIP_K9F5608U0D_J) - MCFG_NAND_RNB_CALLBACK(DEVWRITELINE("s3c2410", s3c2410_device, frnb_w)) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( palmz22 ) - PORT_START( "PENB" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Pen Button") PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)0) PORT_PLAYER(2) - PORT_START( "PENX" ) - PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_X ) PORT_NAME("Pen X") PORT_SENSITIVITY(50) PORT_CROSSHAIR(X, 1, 0, 0) PORT_KEYDELTA(30) PORT_PLAYER(2) - PORT_START( "PENY" ) - PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_Y ) PORT_NAME("Pen Y") PORT_SENSITIVITY(50) PORT_CROSSHAIR(Y, 1, 0, 0) PORT_KEYDELTA(30) PORT_PLAYER(2) - PORT_START( "PORT-F" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) PORT_NAME("Power") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) PORT_NAME("Contacts") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) PORT_NAME("Calendar") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) PORT_NAME("Center") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, palmz22_state, palmz22_input_changed, (void *)1) -INPUT_PORTS_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -ROM_START( palmz22 ) - ROM_REGION( 0x2100000, "nand", 0 ) - ROM_LOAD( "palmz22.bin", 0, 0x2100000, CRC(6d0320b3) SHA1(99297975fdad44faf69cc6eaf0fa2560d5579a4d) ) -ROM_END - -COMP(2005, palmz22, 0, 0, palmz22, palmz22, palmz22_state, palmz22, "Palm", "Palm Z22", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/partner.c b/src/mess/drivers/partner.c deleted file mode 100644 index 942b7ddc9ec..00000000000 --- a/src/mess/drivers/partner.c +++ /dev/null @@ -1,242 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Partner driver by Miodrag Milanovic - - 09/06/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/wave.h" -#include "machine/i8255.h" -#include "imagedev/cassette.h" -#include "formats/smx_dsk.h" -#include "formats/rk_cas.h" -#include "includes/radio86.h" -#include "machine/ram.h" -#include "includes/partner.h" - -/* Address maps */ -static ADDRESS_MAP_START(partner_mem, AS_PROGRAM, 8, partner_state ) - AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("bank1") - AM_RANGE( 0x0800, 0x3fff ) AM_RAMBANK("bank2") - AM_RANGE( 0x4000, 0x5fff ) AM_RAMBANK("bank3") - AM_RANGE( 0x6000, 0x7fff ) AM_RAMBANK("bank4") - AM_RANGE( 0x8000, 0x9fff ) AM_RAMBANK("bank5") - AM_RANGE( 0xa000, 0xb7ff ) AM_RAMBANK("bank6") - AM_RANGE( 0xb800, 0xbfff ) AM_RAMBANK("bank7") - AM_RANGE( 0xc000, 0xc7ff ) AM_RAMBANK("bank8") - AM_RANGE( 0xc800, 0xcfff ) AM_RAMBANK("bank9") - AM_RANGE( 0xd000, 0xd7ff ) AM_RAMBANK("bank10") - AM_RANGE( 0xd800, 0xd8ff ) AM_DEVREADWRITE("i8275", i8275_device, read, write) // video - AM_RANGE( 0xd900, 0xd9ff ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE( 0xda00, 0xdaff ) AM_WRITE(partner_mem_page_w) - AM_RANGE( 0xdb00, 0xdbff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xdc00, 0xddff ) AM_RAMBANK("bank11") - AM_RANGE( 0xde00, 0xdeff ) AM_WRITE(partner_win_memory_page_w) - AM_RANGE( 0xe000, 0xe7ff ) AM_RAMBANK("bank12") - AM_RANGE( 0xe800, 0xffff ) AM_RAMBANK("bank13") -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( partner ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(' ') PORT_CHAR('@') // without shift, this should be a Russian character, but we don't have yet these characters... - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) // Apparently in partner is Shift to switch between Latin and Russian Keyboard! - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/* Machine driver */ -FLOPPY_FORMATS_MEMBER( partner_state::floppy_formats ) - FLOPPY_SMX_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( partner_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -/* F4 Character Displayer */ -static const gfx_layout partner_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 512, /* 512 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( partner ) - GFXDECODE_ENTRY( "gfx1", 0x0000, partner_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( partner, partner_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, XTAL_16MHz / 9) - MCFG_CPU_PROGRAM_MAP(partner_mem) - - MCFG_MACHINE_RESET_OVERRIDE(partner_state, partner ) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) - - MCFG_DEVICE_ADD("i8275", I8275, XTAL_16MHz / 12) - MCFG_I8275_CHARACTER_WIDTH(6) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(partner_state, display_pixels) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma8257",i8257_device, dreq2_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(78*6, 30*10) - MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", partner) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(partner_state,radio86) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(partner_state, hrq_w)) - MCFG_I8257_IN_MEMR_CB(READ8(radio86_state, memory_read_byte)) - MCFG_I8257_OUT_MEMW_CB(WRITE8(radio86_state, memory_write_byte)) - MCFG_I8257_IN_IOR_0_CB(DEVREAD8("wd1793", fd1793_t, data_r)) - MCFG_I8257_OUT_IOW_0_CB(DEVWRITE8("wd1793", fd1793_t, data_w)) - MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("i8275", i8275_device, dack_w)) - MCFG_I8257_REVERSE_RW_MODE(1) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rkp_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("partner_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","partner_cass") - - MCFG_FD1793_ADD("wd1793", XTAL_16MHz / 16) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma8257", i8257_device, dreq0_w)) - MCFG_FLOPPY_DRIVE_ADD("wd1793:0", partner_floppies, "525qd", partner_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1793:1", partner_floppies, "525qd", partner_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list","partner_flop") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( partner ) - ROM_REGION( 0x1A000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "partner.rom", 0x10000, 0x2000, CRC(be1eaa10) SHA1(f9658d8055bf434240ec020d7892ea98cb5cbb76)) - ROM_LOAD( "basic.rom", 0x12000, 0x2000, CRC(1e9be0ec) SHA1(2c431f487cffddaac8413efddfc0527ad595f03b)) - ROM_LOAD( "mcpg.rom", 0x14000, 0x0800, CRC(3401225c) SHA1(6c252393ee73ed1a53d3e583547d86ab6718a533)) - ROM_LOAD( "fdd.rom", 0x16000, 0x0800, CRC(8ca350b5) SHA1(76fc92298726fb2840f4c19d7edc860d1ed86356)) - ROM_LOAD( "font.rom", 0x18000, 0x2000, CRC(dc4f1723) SHA1(6b8d5efb403cf0aeb3fd3197a0529d23c8e2f93c)) - ROM_REGION(0x2000, "gfx1",0) - ROM_LOAD ("partner.fnt", 0x0000, 0x2000, CRC(2705f726) SHA1(3d7b33901ef098a405d7ddad924ba9677f6a9b15)) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, partner, radio86, 0, partner, partner, partner_state,partner, "SAM SKB VM", "Partner-01.01", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/paso1600.c b/src/mess/drivers/paso1600.c deleted file mode 100644 index 91fa7f170ae..00000000000 --- a/src/mess/drivers/paso1600.c +++ /dev/null @@ -1,350 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Toshiba Pasopia 1600 - - TODO: - - charset ROM is WRONG! (needs a 8x16 or even a 16x16 one) - - identify fdc type (needs a working floppy image) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "video/mc6845.h" -#include "machine/pic8259.h" -#include "machine/am9517a.h" - - -class paso1600_state : public driver_device -{ -public: - paso1600_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pic(*this, "pic8259"), - m_dma(*this, "8237dma"), - m_crtc(*this, "crtc"), - m_p_vram(*this, "vram"), - m_p_gvram(*this, "gvram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - required_device m_maincpu; - required_device m_pic; - required_device m_dma; - required_device m_crtc; - DECLARE_READ8_MEMBER(paso1600_pcg_r); - DECLARE_WRITE8_MEMBER(paso1600_pcg_w); - DECLARE_WRITE8_MEMBER(paso1600_6845_address_w); - DECLARE_WRITE8_MEMBER(paso1600_6845_data_w); - DECLARE_READ8_MEMBER(paso1600_6845_data_r); - DECLARE_READ8_MEMBER(paso1600_6845_status_r); - DECLARE_READ8_MEMBER(test_r); - DECLARE_READ8_MEMBER(key_r); - DECLARE_WRITE8_MEMBER(key_w); - DECLARE_READ16_MEMBER(test_hi_r); - DECLARE_WRITE_LINE_MEMBER(paso1600_set_int_line); - UINT8 m_crtc_vreg[0x100],m_crtc_index; - UINT8 *m_p_chargen; - UINT8 *m_p_pcg; - required_shared_ptr m_p_vram; - required_shared_ptr m_p_gvram; - required_device m_gfxdecode; - required_device m_palette; - struct{ - UINT8 portb; - }m_keyb; - DECLARE_READ8_MEMBER(pc_dma_read_byte); - DECLARE_WRITE8_MEMBER(pc_dma_write_byte); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_paso1600(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - IRQ_CALLBACK_MEMBER(paso1600_irq_callback); -}; - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - - -void paso1600_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); - m_p_pcg = memregion("pcg")->base(); -} - -UINT32 paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - int xi,yi; - #if 0 - UINT32 count; - static int test_x; - - if(machine().input().code_pressed(KEYCODE_Z)) - test_x++; - - if(machine().input().code_pressed(KEYCODE_X)) - test_x--; - - popmessage("%d",test_x); - - count = 0; - - for(y=0;y<475;y++) - { - count &= 0xffff; - - for(x=0;x> xi) & 1; - - if(y < 475 && x*16+xi < 640) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(pen); - } - - count++; - } - } - #endif - -// popmessage("%d %d %d",mc6845_h_display,mc6845_v_display,mc6845_tile_height); - - for(y=0;y> 8; - int pen; - - for(yi=0;yi<19;yi++) - { - for(xi=0;xi<8;xi++) - { - pen = (m_p_chargen[tile*8+(yi >> 1)] >> (7-xi) & 1) ? color : -1; - - if(yi & 0x10) - pen = -1; - - if(pen != -1) - if(y*19 < 475 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*19+yi, x*8+xi) = m_palette->pen(pen); - } - } - } - } - - /* quick and dirty way to do the cursor */ - if(0) - for(yi=0;yipen(7); - } - } - } - - return 0; -} - -READ8_MEMBER( paso1600_state::paso1600_pcg_r ) -{ - return m_p_pcg[offset]; -} - -WRITE8_MEMBER( paso1600_state::paso1600_pcg_w ) -{ - m_p_pcg[offset] = data; - m_gfxdecode->gfx(0)->mark_dirty(offset >> 3); -} - -WRITE8_MEMBER( paso1600_state::paso1600_6845_address_w ) -{ - m_crtc_index = data; - m_crtc->address_w(space, offset, data); -} - -WRITE8_MEMBER( paso1600_state::paso1600_6845_data_w ) -{ - m_crtc_vreg[m_crtc_index] = data; - m_crtc->register_w(space, offset, data); -} - -READ8_MEMBER( paso1600_state::paso1600_6845_data_r ) -{ - return m_crtc->register_r(space, offset); -} - -READ8_MEMBER( paso1600_state::paso1600_6845_status_r ) -{ - return m_crtc->status_r(space, offset); -} - -READ8_MEMBER( paso1600_state::key_r ) -{ - switch(offset) - { - case 3: - if(m_keyb.portb == 1) - return 0; - } - - return 0xff; -} - -WRITE8_MEMBER( paso1600_state::key_w ) -{ - switch(offset) - { - case 3: m_keyb.portb = data; break; - } -} - -READ16_MEMBER( paso1600_state::test_hi_r ) -{ - return 0xffff; -} - -static ADDRESS_MAP_START(paso1600_map, AS_PROGRAM, 16, paso1600_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0x7ffff) AM_RAM - AM_RANGE(0xb0000,0xb0fff) AM_RAM AM_SHARE("vram") // tvram - AM_RANGE(0xbfff0,0xbffff) AM_READWRITE8(paso1600_pcg_r,paso1600_pcg_w,0xffff) - AM_RANGE(0xc0000,0xdffff) AM_RAM AM_SHARE("gvram")// gvram - AM_RANGE(0xe0000,0xeffff) AM_ROM AM_REGION("kanji",0)// kanji rom, banked via port 0x93 - AM_RANGE(0xfe000,0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(paso1600_io, AS_IO, 16, paso1600_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0x0000,0x000f) AM_DEVREADWRITE8("8237dma", am9517a_device, read, write, 0xffff) - AM_RANGE(0x0010,0x0011) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff) // i8259 - AM_RANGE(0x001a,0x001b) AM_READ(test_hi_r) // causes RAM error otherwise? - AM_RANGE(0x0030,0x0033) AM_READWRITE8(key_r,key_w,0xffff) //UART keyboard? - AM_RANGE(0x0048,0x0049) AM_READ(test_hi_r) - AM_RANGE(0x0090,0x0091) AM_READWRITE8(paso1600_6845_status_r,paso1600_6845_address_w,0x00ff) - AM_RANGE(0x0090,0x0091) AM_READWRITE8(paso1600_6845_data_r,paso1600_6845_data_w,0xff00) -// AM_RANGE(0x00d8,0x00df) //fdc, unknown type -// other undefined ports: 18, 1C, 92 -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( paso1600 ) -INPUT_PORTS_END - -static const gfx_layout paso1600_charlayout = -{ - 8, 8, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP8(0,1) }, - { STEP8(0,8) }, - 8*8 -}; - -static GFXDECODE_START( paso1600 ) - GFXDECODE_ENTRY( "pcg", 0x0000, paso1600_charlayout, 0, 4 ) - GFXDECODE_ENTRY( "chargen", 0x0000, paso1600_charlayout, 0, 4 ) -GFXDECODE_END - - -void paso1600_state::machine_start() -{ -} - - -void paso1600_state::machine_reset() -{ -} - -READ8_MEMBER(paso1600_state::pc_dma_read_byte) -{ - //offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) - // & 0xFF0000; - - return space.read_byte(offset); -} - - -WRITE8_MEMBER(paso1600_state::pc_dma_write_byte) -{ - //offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) - // & 0xFF0000; - - space.write_byte(offset, data); -} - -static MACHINE_CONFIG_START( paso1600, paso1600_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 16000000/2) - MCFG_CPU_PROGRAM_MAP(paso1600_map) - MCFG_CPU_IO_MAP(paso1600_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(paso1600_state, screen_update_paso1600) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", paso1600) - MCFG_PALETTE_ADD("palette", 8) -// MCFG_PALETTE_INIT(black_and_white) - - /* Devices */ - MCFG_MC6845_ADD("crtc", H46505, "screen", 16000000/4) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), GND, NULL ) - - MCFG_DEVICE_ADD("8237dma", AM9517A, 16000000/4) - MCFG_I8237_IN_MEMR_CB(READ8(paso1600_state, pc_dma_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(paso1600_state, pc_dma_write_byte)) -MACHINE_CONFIG_END - -ROM_START( paso1600 ) - ROM_REGION16_LE(0x2000,"ipl", 0) - ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(cee4ebb7) SHA1(c23b30f8dc51f96c1c00e28aab61e77b50d261f0)) - - ROM_REGION(0x2000,"pcg", ROMREGION_ERASE00) - - ROM_REGION( 0x800, "chargen", ROMREGION_ERASEFF ) - ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(a91c45a9) SHA1(a472adf791b9bac3dfa6437662e1a9e94a88b412)) //stolen from pasopia7 - - ROM_REGION( 0x20000, "kanji", ROMREGION_ERASEFF ) - ROM_LOAD( "kanji.rom", 0x0000, 0x20000, NO_DUMP) - -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP ( 198?,paso1600, 0, 0, paso1600, paso1600, driver_device, 0, "Toshiba", "Pasopia 1600" , MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mess/drivers/pasogo.c b/src/mess/drivers/pasogo.c deleted file mode 100644 index 14bb688d280..00000000000 --- a/src/mess/drivers/pasogo.c +++ /dev/null @@ -1,576 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - -Pasogo Handheld Console -Koei 1996 - -This is a handheld console made by Koei in 1996. All of the games available on -this console are variations of the game 'Go' - - -Main PCB Layout ---------------- -PT-GMAIN01D -|--------------|------------|| -|POWER VOL | || -| LM2937*| CART || -|CE-0702 | SLOT || -| | CN1 || -| |MC14071B* || -| | || -| PIEZO_SPKR |------------|| -|CN5 74HC04* | -| X2 | -| |-------| CN4| -| |VADEM | | -| |VG230 | | -| | | HM514800* | -| | | CN3| -| |-------| HM514800* | -|CN2* X1 | -|----------------------------| -Notes: (all ICs shown) - - VG230 - Vadem VG230 single-chip PC platform. Contains 16 MHz NEC uPD70116H V30HL CPU - (which is a high-speed low-power 8086 variation), IBM PC/XT-compatible core - logic, LCD controller (CGA/AT&T640x400), keyboard matrix scanner, dual PCMCIA - 2.1 card controller, EMS 4.0 hardware support for up to 64MB, built-in timer - PIC/DMA/UART/RTC controllers. The clock input is 32.2200MHz. An internal divider - creates a 16.11MHz clock for the V30HL CPU. - HM514800 - Hitachi HM514800 512k x8-bit DRAM - MC14071 - Motorola MC14071 Quad 2-input OR gate - 74HC04 - 74HC04 Hex inverter - LM2937 - Texas Instruments LM2937ES-5 voltage regulator (Max 26V input, 5V output at 500mA) - CE-0702 - TDK CE-0702 DC-DC converter for LCD in SIP9 package (5V input, -24V output at 25mA) - POWER - 9V DC power input from AC/DC adapter - VOL - Volume pot - CN5 - 5 pin connector for 4-way control pad (up/down/left/right/ground) - CN4 - 5 pin connector for on/off switch and 2 buttons - CN3 - 2 pin power input from 6x AA-battery compartment (input voltage is 9V DC) - CN2 - Flat cable connector for video out to LCD panel. When the LCD is powered on the pixels - are blue. The LCD panel PCB has part number 97-44264-8 LMG6912RPFC LMG6910RPGR - and contains the following parts..... - Matsushita 53008HEB-8 - Sanyo LA6324N quad operational amplifier - Hitachi BD66285BFC LCD controller IC (x3) - Hitachi BD66284BFC LCD controller IC (x4) - The LCD flat cable has several wires but 2 of them have frequencies which measure - 69.9161Hz and 16.7798kHz. These are assumed to be VSync and HSync - CN1 - Cart slot - X1 - Marked 322. Measures 32.21732MHz so this is a common 32.22MHz OSC. - X2 - No markings. Measures 32.768kHz and used for the RTC - * - These parts are on the other side of the PCB - - -Carts ------ -All of the carts are identical. Most have only one surface mounted mask ROM. Either a -MX23C8100 (8M) or YRM0442 (4M). Some are populated with additional parts including a 62256 -32kx8 SRAM, a 3v coin battery and a MM1081N reset chip plus a few resistors/capacitors and -a transistor. All parts are surface mounted. - -PT-GMEM01B -PT-GMEM01C -|---------------| -|-- CR2016 | -|-- MM1081 | -|-- | -|-- | -|-- 62256 | -|-- | -|-- | -|-- MX23C8100| -|-- or YRM0442 | -|---------------| -Notes: - Carts containing just one mask ROM are KS-1002, KS-1003, KS1004 and KS-1009 - Carts containing RAM, battery and reset chip are KS-1001 and KS1010 - Carts KS-1005, KS-1006, KS-1007 and KS-1008 probably exist but are unknown. - -=========================================================================================== - - PeT mess@utanet.at march 2008 - -although it is very related to standard pc hardware, it is different enough -to make the standard pc driver one level more complex, so own driver - -TODO: -- Make a separate device of the Vadem VG230 core (it is also used in the HP - OmniGo 100 and 120). - -******************************************************************************/ - -#include "emu.h" -#include "cpu/nec/nec.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "machine/bankdev.h" -#include "includes/genpc.h" - - -/* - rtc interrupt irq 2 - */ - - -class pasogo_state : public driver_device -{ -public: - pasogo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_cart(*this, "cartslot") - , m_ems(*this, "ems") - , m_vram(*this, "vram") - , m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_cart; - required_device m_ems; - required_shared_ptr m_vram; - required_device m_palette; - - DECLARE_READ16_MEMBER(ems_r); - DECLARE_WRITE16_MEMBER(ems_w); - DECLARE_READ16_MEMBER(emsram_r); - DECLARE_WRITE16_MEMBER(emsram_w); - DECLARE_READ8_MEMBER(vg230_io_r); - DECLARE_WRITE8_MEMBER(vg230_io_w); - - struct - { - UINT8 index; - UINT8 data[0x100]; - struct { - UINT16 data; - } bios_timer; // 1.19 MHz tclk signal - struct { - int seconds, minutes, hours, days; - int alarm_seconds, alarm_minutes, alarm_hours, alarm_days; - - int onehertz_interrupt_on; - int onehertz_interrupt_request; - int alarm_interrupt_on; - int alarm_interrupt_request; - } rtc; - struct { - int write_protected; - } pmu; - } m_vg230; - - void machine_reset(); - void machine_start(); - - UINT32 screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(pasogo_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(vg230_timer); - DECLARE_INPUT_CHANGED_MEMBER(contrast); - - memory_region *m_cart_rom; - UINT8 m_ems_index; - UINT16 m_ems_bank[28]; -}; - - -TIMER_DEVICE_CALLBACK_MEMBER(pasogo_state::vg230_timer) -{ - m_vg230.rtc.seconds += 1; - if (m_vg230.rtc.seconds >= 60) - { - m_vg230.rtc.seconds = 0; - m_vg230.rtc.minutes += 1; - if (m_vg230.rtc.minutes >= 60) - { - m_vg230.rtc.minutes = 0; - m_vg230.rtc.hours += 1; - if (m_vg230.rtc.hours >= 24) - { - m_vg230.rtc.hours = 0; - m_vg230.rtc.days = (m_vg230.rtc.days + 1) & 0xfff; - } - } - } - - if (m_vg230.rtc.seconds == m_vg230.rtc.alarm_seconds - && m_vg230.rtc.minutes == m_vg230.rtc.alarm_minutes - && m_vg230.rtc.hours == m_vg230.rtc.alarm_hours - && (m_vg230.rtc.days & 0x1f) == m_vg230.rtc.alarm_hours) - { - // generate alarm - } -} - -void pasogo_state::machine_start() -{ - system_time systime; - - memset(&m_vg230, 0, sizeof(m_vg230)); - m_vg230.pmu.write_protected = TRUE; - machine().base_datetime(systime); - - m_vg230.rtc.seconds = systime.local_time.second; - m_vg230.rtc.minutes = systime.local_time.minute; - m_vg230.rtc.hours = systime.local_time.hour; - m_vg230.rtc.days = 0; - - m_vg230.bios_timer.data=0x7200; // HACK -} - -READ8_MEMBER( pasogo_state::vg230_io_r ) -{ - int log = TRUE; - UINT8 data = 0; - - m_vg230.bios_timer.data += 0x100; //HACK - if (offset&1) - { - data = m_vg230.data[m_vg230.index]; - switch (m_vg230.index) - { - case 0x09: - break; - - case 0x0a: - if (m_vg230.data[9] & 1) - data=ioport("JOY")->read(); - else - data = 0xff; - break; - - case 0x30: - data = m_vg230.bios_timer.data & 0xff; - break; - - case 0x31: - data = m_vg230.bios_timer.data >> 8; - log = FALSE; - break; - - case 0x70: - data = m_vg230.rtc.seconds; - log = FALSE; - break; - - case 0x71: - data = m_vg230.rtc.minutes; - log = FALSE; - break; - - case 0x72: - data = m_vg230.rtc.hours; - log = FALSE; - break; - - case 0x73: - data = m_vg230.rtc.days; - break; - - case 0x74: - data = m_vg230.rtc.days >> 8; - break; - - case 0x79: - /*rtc status*/ - log = FALSE; - break; - - case 0x7a: - data &= ~3; - if (m_vg230.rtc.alarm_interrupt_request) - data |= 1<<1; - if (m_vg230.rtc.onehertz_interrupt_request) - data |= 1<<0; - break; - - case 0xc1: - data &= ~1; - if (m_vg230.pmu.write_protected) - data |= 1; - m_vg230.pmu.write_protected = FALSE; - log = FALSE; - break; - } - - if (log) - logerror("%.5x vg230 %02x read %.2x\n",(int) m_maincpu->pc(), m_vg230.index, data); - // data=machine.root_device().memregion("maincpu")->base()[0x4000+offset]; - } - else - data = m_vg230.index; - - return data; -} - - -WRITE8_MEMBER( pasogo_state::vg230_io_w ) -{ - int log = TRUE; - - if (offset & 1) - { - // machine.root_device().memregion("maincpu")->base()[0x4000+offset]=data; - m_vg230.data[m_vg230.index] = data; - switch (m_vg230.index) - { - case 0x09: - break; - - case 0x70: - m_vg230.rtc.seconds = data & 0x3f; - break; - - case 0x71: - m_vg230.rtc.minutes = data & 0x3f; - break; - - case 0x72: - m_vg230.rtc.hours = data & 0x1f; - break; - - case 0x73: - m_vg230.rtc.days = (m_vg230.rtc.days & ~0xff) | data; - break; - - case 0x74: - m_vg230.rtc.days = (m_vg230.rtc.days & 0xff) | ((data & 0xf) << 8); - break; - - case 0x75: - m_vg230.rtc.alarm_seconds = data & 0x3f; - break; - - case 0x76: - m_vg230.rtc.alarm_minutes = data & 0x3f; - break; - - case 0x77: - m_vg230.rtc.alarm_hours = data & 0x1f; - break; - - case 0x78: - m_vg230.rtc.days = data & 0x1f; - break; - - case 0x79: - m_vg230.rtc.onehertz_interrupt_on = data & 1; - m_vg230.rtc.alarm_interrupt_on = data & 2; - log = FALSE; - break; - - case 0x7a: - if (data & 2) - { - m_vg230.rtc.alarm_interrupt_request = FALSE; - m_vg230.rtc.onehertz_interrupt_request = FALSE; /* update interrupt */ - } - break; - } - - if (log) - logerror("%.5x vg230 %02x write %.2x\n", (int)m_maincpu->pc(), m_vg230.index, data); - } - else - m_vg230.index = data; -} - - -READ16_MEMBER( pasogo_state::ems_r ) -{ - UINT8 data = 0; - UINT8 index; - - switch (offset) - { - case 0: - data = m_ems_index; - break; - - case 1: - index = (m_ems_index >> 2) & 0x1f; - data = m_ems_bank[index]; - break; - } - return data; -} - - -WRITE16_MEMBER( pasogo_state::ems_w ) -{ - UINT8 index; - - switch (offset) - { - case 0: - m_ems_index = data; - break; - - case 1: - index = (m_ems_index >> 2) & 0x1f; - if((index & ~1) == 10) - { - logerror("EMS mapping of CGA framebuffer\n"); - break; - } - else if(index >= 28) - { - logerror("EMS index out of range\n"); - break; - } - COMBINE_DATA(&m_ems_bank[index]); - break; - } -} - -READ16_MEMBER( pasogo_state::emsram_r ) -{ - m_ems->set_bank(m_ems_bank[(offset >> 13) & 0x1f] & 0x7fff); - return m_ems->read16(space, offset & 0x1fff, mem_mask); -} - -WRITE16_MEMBER( pasogo_state::emsram_w ) -{ - m_ems->set_bank(m_ems_bank[(offset >> 13) & 0x1f] & 0x7fff); - m_ems->write16(space, offset & 0x1fff, data, mem_mask); -} - -static ADDRESS_MAP_START(emsbank_map, AS_PROGRAM, 16, pasogo_state) - AM_RANGE(0x04080000, 0x040fffff) AM_RAM - AM_RANGE(0x08000000, 0x080fffff) AM_ROMBANK("bank27") - AM_RANGE(0x10000000, 0x1000ffff) AM_RAM // cart ram? -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pasogo_mem, AS_PROGRAM, 16, pasogo_state) - AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") - AM_RANGE(0xb8000, 0xbffff) AM_RAM AM_SHARE("vram") - AM_RANGE(0x80000, 0xeffff) AM_READWRITE(emsram_r, emsram_w) - AM_RANGE(0xf0000, 0xfffff) AM_ROMBANK("bank27") -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(pasogo_io, AS_IO, 16, pasogo_state) - AM_RANGE(0x0026, 0x0027) AM_READWRITE8(vg230_io_r, vg230_io_w, 0xffff) - AM_RANGE(0x006c, 0x006f) AM_READWRITE(ems_r, ems_w) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( pasogo ) - PORT_START("JOY") -// PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("select") -// PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("start") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("O") /*?*/ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("X") /*?*/ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("a") PORT_CODE(KEYCODE_A) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("b") PORT_CODE(KEYCODE_B) - PORT_START("COLOR") - PORT_CONFNAME(0x01, 0x01, "Contrast") PORT_CHANGED_MEMBER(DEVICE_SELF, pasogo_state, contrast, 0) - PORT_CONFSETTING(0x00, "Actual") - PORT_CONFSETTING(0x01, "Enhanced") -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER(pasogo_state::contrast) -{ - if(newval) - { - m_palette->set_pen_color(0, rgb_t(80, 130, 130)); - m_palette->set_pen_color(1, rgb_t(40, 60, 140)); - } - else - { - m_palette->set_pen_color(0, rgb_t(100, 110, 100)); - m_palette->set_pen_color(1, rgb_t(90, 80, 110)); - } -} - -UINT32 pasogo_state::screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *vram = (UINT8 *)m_vram.target(); - int x, y; - for (y=0; y<240; y++) - { - for (x=0; x<(320/8); x++) - { - int a = (y & 3) * 0x2000; - UINT8 d1 = vram[a + (y >> 2) * 80 + x]; - UINT16 *line = &bitmap.pix16(y, x << 3); - *line++ = ((d1 >> 7) & 1); - *line++ = ((d1 >> 6) & 1); - *line++ = ((d1 >> 5) & 1); - *line++ = ((d1 >> 4) & 1); - *line++ = ((d1 >> 3) & 1); - *line++ = ((d1 >> 2) & 1); - *line++ = ((d1 >> 1) & 1); - *line++ = ((d1 >> 0) & 1); - } - } - return 0; -} - -INTERRUPT_GEN_MEMBER(pasogo_state::pasogo_interrupt) -{ -// m_maincpu->set_input_line(UPD7810_INTFE1, PULSE_LINE); -} - -void pasogo_state::machine_reset() -{ - std::string region_tag; - ioport_port *color = ioport("COLOR"); - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - if (!m_cart_rom) // this should never happen, since we make carts mandatory! - m_cart_rom = memregion("maincpu"); - - membank("bank27")->set_base(m_cart_rom->base()); - m_ems_index = 0; - memset(m_ems_bank, 0, sizeof(m_ems_bank)); - contrast(*color->first_field(), NULL, 0, color->read()); -} - -static MACHINE_CONFIG_START( pasogo, pasogo_state ) - - MCFG_CPU_ADD("maincpu", V30, XTAL_32_22MHz/2) - MCFG_CPU_PROGRAM_MAP(pasogo_mem) - MCFG_CPU_IO_MAP(pasogo_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pasogo_state, pasogo_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_DEVICE_ADD("ems", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(emsbank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - - // It's a CGA device right so lets use isa_cga! Well, not so much. - // The carts use vg230 specific registers and mostly ignore the mc6845. - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(pasogo_state, screen_update_pasogo) - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 2) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pasogo_cart") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_MANDATORY - - MCFG_SOFTWARE_LIST_ADD("cart_list","pasogo") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("vg230_timer", pasogo_state, vg230_timer, attotime::from_hz(1)) -MACHINE_CONFIG_END - -ROM_START( pasogo ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) -ROM_END - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -CONS( 1996, pasogo, 0, 0, pasogo, pasogo, driver_device, 0, "KOEI", "PasoGo", MACHINE_NO_SOUND|MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/pasopia.c b/src/mess/drivers/pasopia.c deleted file mode 100644 index 03a27a2d2fb..00000000000 --- a/src/mess/drivers/pasopia.c +++ /dev/null @@ -1,359 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Toshiba Pasopia - - TODO: - - machine emulation needs merging with Pasopia 7 (video emulation is - completely different tho) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "video/mc6845.h" -#include "includes/pasopia.h" - -class pasopia_state : public driver_device -{ -public: - pasopia_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ppi0(*this, "ppi8255_0"), - m_ppi1(*this, "ppi8255_1"), - m_ppi2(*this, "ppi8255_2"), - m_ctc(*this, "z80ctc"), - m_pio(*this, "z80pio"), - m_crtc(*this, "crtc"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_ppi0; - required_device m_ppi1; - required_device m_ppi2; - required_device m_ctc; - required_device m_pio; - required_device m_crtc; - required_device m_palette; - - DECLARE_READ8_MEMBER(pasopia_romram_r); - DECLARE_WRITE8_MEMBER(pasopia_ram_w); - DECLARE_WRITE8_MEMBER(pasopia_ctrl_w); - DECLARE_WRITE8_MEMBER(vram_addr_lo_w); - DECLARE_WRITE8_MEMBER(vram_latch_w); - DECLARE_READ8_MEMBER(vram_latch_r); - DECLARE_READ8_MEMBER(portb_1_r); - DECLARE_WRITE8_MEMBER(vram_addr_hi_w); - DECLARE_WRITE8_MEMBER(screen_mode_w); - DECLARE_READ8_MEMBER(rombank_r); - DECLARE_READ8_MEMBER(testa_r); - DECLARE_READ8_MEMBER(testb_r); - DECLARE_WRITE_LINE_MEMBER(testa_w); - DECLARE_WRITE_LINE_MEMBER(testb_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(mux_r); - DECLARE_READ8_MEMBER(keyb_r); - DECLARE_WRITE8_MEMBER(mux_w); - MC6845_UPDATE_ROW(crtc_update_row); - - UINT8 m_hblank; - UINT16 m_vram_addr; - UINT8 m_vram_latch; - UINT8 m_attr_latch; -// UINT8 m_gfx_mode; - UINT8 m_mux_data; - bool m_video_wl; - bool m_ram_bank; - UINT8 *m_p_vram; - DECLARE_DRIVER_INIT(pasopia); - TIMER_CALLBACK_MEMBER(pio_timer); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); -}; - -// needed to scan the keyboard, as the pio emulation doesn't do it. -TIMER_CALLBACK_MEMBER(pasopia_state::pio_timer) -{ - m_pio->port_b_write(keyb_r(generic_space(),0,0xff)); -} - -void pasopia_state::video_start() -{ -} - -MC6845_UPDATE_ROW( pasopia_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 *m_p_chargen = memregion("chargen")->base(); - UINT8 chr,gfx,fg=7,bg=0; // colours need to be determined - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - UINT8 inv=0; - if (x == cursor_x) inv=0xff; - mem = (ma + x) & 0xfff; - chr = m_p_vram[mem]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | ra] ^ inv; - - /* Display a scanline of a character */ - *p++ = palette[BIT(gfx, 7) ? fg : bg]; - *p++ = palette[BIT(gfx, 6) ? fg : bg]; - *p++ = palette[BIT(gfx, 5) ? fg : bg]; - *p++ = palette[BIT(gfx, 4) ? fg : bg]; - *p++ = palette[BIT(gfx, 3) ? fg : bg]; - *p++ = palette[BIT(gfx, 2) ? fg : bg]; - *p++ = palette[BIT(gfx, 1) ? fg : bg]; - *p++ = palette[BIT(gfx, 0) ? fg : bg]; - } -} - -WRITE8_MEMBER( pasopia_state::pasopia_ctrl_w ) -{ - m_ram_bank = BIT(data, 1); - membank("bank1")->set_entry(m_ram_bank); -} - -static ADDRESS_MAP_START(pasopia_map, AS_PROGRAM, 8, pasopia_state) - AM_RANGE(0x0000,0x7fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") - AM_RANGE(0x8000,0xffff) AM_RAM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(pasopia_io, AS_IO, 8, pasopia_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00,0x03) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) - AM_RANGE(0x08,0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE(0x10,0x10) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0x11,0x11) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) -// 0x18 - 0x1b pac2 -// 0x1c - 0x1f something - AM_RANGE(0x20,0x23) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) - AM_RANGE(0x28,0x2b) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0x30,0x33) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) -// 0x38 printer - AM_RANGE(0x3c,0x3c) AM_WRITE(pasopia_ctrl_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pasopia ) - PASOPIA_KEYBOARD -INPUT_PORTS_END - -void pasopia_state::machine_start() -{ - m_p_vram = memregion("vram")->base(); - m_hblank = 0; - membank("bank1")->set_entry(0); - membank("bank2")->set_entry(0); -} - -void pasopia_state::machine_reset() -{ -} - -WRITE8_MEMBER( pasopia_state::vram_addr_lo_w ) -{ - m_vram_addr = (m_vram_addr & 0x3f00) | data; -} - -WRITE8_MEMBER( pasopia_state::vram_latch_w ) -{ - m_vram_latch = data; -} - -READ8_MEMBER( pasopia_state::vram_latch_r ) -{ - return m_p_vram[m_vram_addr]; -} - -READ8_MEMBER( pasopia_state::portb_1_r ) -{ - /* - x--- ---- attribute latch - -x-- ---- hblank - --x- ---- vblank - ---x ---- LCD system mode, active low - */ - UINT8 grph_latch,lcd_mode; - - m_hblank ^= 0x40; //TODO - grph_latch = (m_p_vram[m_vram_addr | 0x4000] & 0x80); - lcd_mode = 0x10; - - return m_hblank | lcd_mode | grph_latch; //bit 4: LCD mode -} - - -WRITE8_MEMBER( pasopia_state::vram_addr_hi_w ) -{ - m_attr_latch = (data & 0x80) | (m_attr_latch & 0x7f); - if ( BIT(data, 6) && !m_video_wl ) - { - m_p_vram[m_vram_addr] = m_vram_latch; - m_p_vram[m_vram_addr | 0x4000] = m_attr_latch; - } - - m_video_wl = BIT(data, 6); - m_vram_addr = (m_vram_addr & 0xff) | ((data & 0x3f) << 8); -} - -WRITE8_MEMBER( pasopia_state::screen_mode_w ) -{ - //m_gfx_mode = (data & 0xe0) >> 5; unused variable - m_attr_latch = (m_attr_latch & 0x80) | (data & 7); - printf("Screen Mode=%02x\n",data); -} - -READ8_MEMBER( pasopia_state::rombank_r ) -{ - return (m_ram_bank) ? 4 : 0; -} - -READ8_MEMBER( pasopia_state::mux_r ) -{ - return m_mux_data; -} - -READ8_MEMBER( pasopia_state::keyb_r ) -{ - const char *const keynames[3][4] = { { "KEY0", "KEY1", "KEY2", "KEY3" }, - { "KEY4", "KEY5", "KEY6", "KEY7" }, - { "KEY8", "KEY9", "KEYA", "KEYB" } }; - int i,j; - UINT8 res; - - res = 0; - for(j=0;j<3;j++) - { - if(m_mux_data & 0x10 << j) - { - for(i=0;i<4;i++) - { - if(m_mux_data & 1 << i) - res |= ioport(keynames[j][i])->read(); - } - } - } - - return res ^ 0xff; -} - -WRITE8_MEMBER( pasopia_state::mux_w ) -{ - m_mux_data = data; -} - -static const gfx_layout p7_chars_8x8 = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( pasopia ) - GFXDECODE_ENTRY( "chargen", 0x0000, p7_chars_8x8, 0, 4 ) -GFXDECODE_END - -static const z80_daisy_config pasopia_daisy[] = -{ - { "z80ctc" }, - { "z80pio" }, -// { "upd765" }, /* TODO */ - { NULL } -}; - - - -DRIVER_INIT_MEMBER(pasopia_state,pasopia) -{ -/* -We preset all banks here, so that bankswitching will incur no speed penalty. -0000 indicates ROMs, 10000 indicates RAM. -*/ - UINT8 *p_ram = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 2, &p_ram[0x00000], 0x10000); - membank("bank2")->configure_entry(0, &p_ram[0x10000]); - - machine().scheduler().timer_pulse(attotime::from_hz(500), timer_expired_delegate(FUNC(pasopia_state::pio_timer),this)); -} - -static MACHINE_CONFIG_START( pasopia, pasopia_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(pasopia_map) - MCFG_CPU_IO_MAP(pasopia_io) - MCFG_CPU_CONFIG(pasopia_daisy) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", h46505_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pasopia) - MCFG_PALETTE_ADD("palette", 8) - - /* Devices */ - MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_4MHz/4) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(pasopia_state, crtc_update_row) - - MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia_state, vram_addr_lo_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pasopia_state, vram_latch_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pasopia_state, vram_latch_r)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia_state, screen_mode_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pasopia_state, portb_1_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pasopia_state, vram_addr_hi_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) - MCFG_I8255_IN_PORTC_CB(READ8(pasopia_state, rombank_r)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg2)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(pasopia_state, mux_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(pasopia_state, mux_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(pasopia_state, keyb_r)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pasopia ) - ROM_REGION( 0x18000, "maincpu", 0 ) - ROM_LOAD( "tbasic.rom", 0x0000, 0x8000, CRC(f53774ff) SHA1(bbec45a3bad8d184505cc6fe1f6e2e60a7fb53f2)) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(a91c45a9) SHA1(a472adf791b9bac3dfa6437662e1a9e94a88b412)) //stolen from pasopia7 - - ROM_REGION( 0x8000, "vram", ROMREGION_ERASE00 ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, pasopia, 0, 0, pasopia, pasopia, pasopia_state, pasopia, "Toshiba", "Pasopia", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/pasopia7.c b/src/mess/drivers/pasopia7.c deleted file mode 100644 index 926b4401a1a..00000000000 --- a/src/mess/drivers/pasopia7.c +++ /dev/null @@ -1,1066 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/************************************************************************************************** - - Toshiba Pasopia 7 (c) 1983 Toshiba - - preliminary driver by Angelo Salese - - TODO: - - floppy support (but floppy images are unobtainable at current time) - - cassette device; - - beeper - - LCD version has gfx bugs, it must use a different ROM charset for instance (apparently a 8 x 4 - one, 40/80 x 8 tilemap); - - Reading fdc has been commented out, until the code can be modified to - work with new upd765 (was causing a hang at boot). - -***************************************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80ctc.h" -#include "machine/i8255.h" -#include "machine/z80pio.h" -#include "machine/upd765.h" -#include "sound/sn76496.h" -#include "video/mc6845.h" -#include "rendlay.h" -#include "includes/pasopia.h" - -class pasopia7_state : public driver_device -{ -public: - pasopia7_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ppi0(*this, "ppi8255_0"), - m_ppi1(*this, "ppi8255_1"), - m_ppi2(*this, "ppi8255_2"), - m_ctc(*this, "z80ctc"), - m_pio(*this, "z80pio"), - m_crtc(*this, "crtc"), - m_fdc(*this, "fdc"), - m_floppy(*this, "fdc:0:525hd"), - m_sn1(*this, "sn1"), - m_sn2(*this, "sn2"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_ppi0; - required_device m_ppi1; - required_device m_ppi2; - required_device m_ctc; - required_device m_pio; - required_device m_crtc; - required_device m_fdc; - required_device m_floppy; - required_device m_sn1; - required_device m_sn2; - required_device m_palette; - - DECLARE_READ8_MEMBER(vram_r); - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_WRITE8_MEMBER(pasopia7_memory_ctrl_w); - DECLARE_WRITE8_MEMBER(pac2_w); - DECLARE_READ8_MEMBER(pac2_r); - DECLARE_WRITE8_MEMBER(ram_bank_w); - DECLARE_WRITE8_MEMBER(pasopia7_6845_w); - DECLARE_READ8_MEMBER(pasopia7_io_r); - DECLARE_WRITE8_MEMBER(pasopia7_io_w); - DECLARE_READ8_MEMBER(pasopia7_fdc_r); - DECLARE_WRITE8_MEMBER(pasopia7_fdc_w); - DECLARE_READ8_MEMBER(mux_r); - DECLARE_READ8_MEMBER(keyb_r); - DECLARE_WRITE8_MEMBER(mux_w); - DECLARE_READ8_MEMBER(crtc_portb_r); - DECLARE_WRITE8_MEMBER(screen_mode_w); - DECLARE_WRITE8_MEMBER(plane_reg_w); - DECLARE_WRITE8_MEMBER(video_attr_w); - DECLARE_WRITE8_MEMBER(video_misc_w); - DECLARE_WRITE8_MEMBER(nmi_mask_w); - DECLARE_READ8_MEMBER(unk_r); - DECLARE_READ8_MEMBER(nmi_reg_r); - DECLARE_WRITE8_MEMBER(nmi_reg_w); - DECLARE_READ8_MEMBER(nmi_porta_r); - DECLARE_READ8_MEMBER(nmi_portb_r); - UINT8 m_vram_sel; - UINT8 m_mio_sel; - UINT8 *m_p7_pal; - UINT8 m_bank_reg; - UINT16 m_cursor_addr; - UINT8 m_cursor_blink; - UINT8 m_cursor_raster; - UINT8 m_plane_reg; - UINT8 m_attr_data; - UINT8 m_attr_wrap; - UINT8 m_attr_latch; - UINT8 m_pal_sel; - UINT8 m_x_width; - UINT8 m_gfx_mode; - UINT8 m_nmi_mask; - UINT8 m_nmi_enable_reg; - UINT8 m_nmi_trap; - UINT8 m_nmi_reset; - UINT16 m_pac2_index[2]; - UINT32 m_kanji_index; - UINT8 m_pac2_bank_select; - UINT8 m_screen_type; - int m_addr_latch; - void pasopia_nmi_trap(); - UINT8 m_mux_data; - DECLARE_DRIVER_INIT(p7_lcd); - DECLARE_DRIVER_INIT(p7_raster); - virtual void machine_reset(); - DECLARE_VIDEO_START(pasopia7); - DECLARE_PALETTE_INIT(p7_lcd); - UINT32 screen_update_pasopia7(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void fdc_irq(bool state); - TIMER_CALLBACK_MEMBER(pio_timer); - void draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width); - void draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width); - void draw_mixed_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width); -}; - -#define VDP_CLOCK XTAL_3_579545MHz/4 -#define LCD_CLOCK VDP_CLOCK/10 - -// needed to scan the keyboard, as the pio emulation doesn't do it. -TIMER_CALLBACK_MEMBER(pasopia7_state::pio_timer) -{ - m_pio->port_b_write(keyb_r(generic_space(),0,0xff)); -} - -VIDEO_START_MEMBER(pasopia7_state,pasopia7) -{ - m_p7_pal = auto_alloc_array(machine(), UINT8, 0x10); -} - -void pasopia7_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) -{ - UINT8 *vram = memregion("vram")->base(); - int x,y,xi,yi; - int count; - - for(yi=0;yi<8;yi++) - { - count = yi; - for(y=0;y<200;y+=8) - { - for(x=0;x<8*width;x+=8) - { - for(xi=0;xi<8;xi++) - { - int pen_b,pen_r,pen_g,color; - - pen_b = (vram[count+0x0000]>>(7-xi)) & 1; - pen_r = (vram[count+0x4000]>>(7-xi)) & 1; - pen_g = 0;//(p7_vram[count+0x8000]>>(7-xi)) & 1; - - color = pen_g<<2 | pen_r<<1 | pen_b<<0; - - bitmap.pix16(y+yi, x+xi) = m_palette->pen(color); - } - count+=8; - } - } - } -} - -void pasopia7_state::draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) -{ - UINT8 *vram = memregion("vram")->base(); - UINT8 *gfx_data = memregion("font")->base(); - int x,y,xi,yi; - int count; - - count = 0x0000; - - for(y=0;y<25;y++) - { - for(x=0;x>(7-xi)) & 1) ? color : 0; - - bitmap.pix16(y*8+yi, x*8+xi) = m_palette->pen(pen); - } - } - - // draw cursor - if(m_cursor_addr*8 == count) - { - int xc,yc,cursor_on; - - cursor_on = 0; - switch(m_cursor_raster & 0x60) - { - case 0x00: cursor_on = 1; break; //always on - case 0x20: cursor_on = 0; break; //always off - case 0x40: if(machine().first_screen()->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink - case 0x60: if(machine().first_screen()->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink - } - - if(cursor_on) - { - for(yc=0;yc<(8-(m_cursor_raster & 7));yc++) - { - for(xc=0;xc<8;xc++) - { - bitmap.pix16(y*8-yc+7, x*8+xc) = m_palette->pen(7); - } - } - } - } - count+=8; - } - } -} - -void pasopia7_state::draw_mixed_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) -{ - UINT8 *vram = memregion("vram")->base(); - UINT8 *gfx_data = memregion("font")->base(); - int x,y,xi,yi; - int count; - - count = 0x0000; - - for(y=0;y<25;y++) - { - for(x=0;x>(7-xi)) & 1; - pen_r = (vram[count+yi+0x4000]>>(7-xi)) & 1; - pen_g = (vram[count+yi+0x8000]>>(7-xi)) & 1; - - pen = pen_g<<2 | pen_r<<1 | pen_b<<0; - - bitmap.pix16(y*8+yi, x*8+xi) = m_palette->pen(pen); - } - } - else - { - int color = attr & 7; - - for(xi=0;xi<8;xi++) - { - int pen; - pen = ((gfx_data[tile*8+yi]>>(7-xi)) & 1) ? color : 0; - - bitmap.pix16(y*8+yi, x*8+xi) = m_palette->pen(pen); - } - } - } - - // draw cursor - if(m_cursor_addr*8 == count) - { - int xc,yc,cursor_on; - - cursor_on = 0; - switch(m_cursor_raster & 0x60) - { - case 0x00: cursor_on = 1; break; //always on - case 0x20: cursor_on = 0; break; //always off - case 0x40: if(machine().first_screen()->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink - case 0x60: if(machine().first_screen()->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink - } - - if(cursor_on) - { - for(yc=0;yc<(8-(m_cursor_raster & 7));yc++) - { - for(xc=0;xc<8;xc++) - { - bitmap.pix16(y*8-yc+7, x*8+xc) = m_palette->pen(7); - } - } - } - } - - count+=8; - } - } -} - -UINT32 pasopia7_state::screen_update_pasopia7(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int width; - - bitmap.fill(m_palette->pen(0), cliprect); - - width = m_x_width ? 80 : 40; - - if(m_gfx_mode) - draw_mixed_screen(bitmap,cliprect,width); - else - { - draw_cg4_screen(bitmap,cliprect,width); - draw_tv_screen(bitmap,cliprect,width); - } - - return 0; -} - -READ8_MEMBER( pasopia7_state::vram_r ) -{ - UINT8 *vram = memregion("vram")->base(); - UINT8 res; - - if (m_vram_sel == 0) - { - UINT8 *work_ram = memregion("maincpu")->base(); - - return work_ram[offset+0x8000]; - } - - if (m_pal_sel && (m_plane_reg & 0x70) == 0x00) - return m_p7_pal[offset & 0xf]; - - res = 0xff; - - if ((m_plane_reg & 0x11) == 0x11) - res &= vram[offset | 0x0000]; - if ((m_plane_reg & 0x22) == 0x22) - res &= vram[offset | 0x4000]; - if ((m_plane_reg & 0x44) == 0x44) - { - res &= vram[offset | 0x8000]; - m_attr_latch = vram[offset | 0xc000] & 0x87; - } - - return res; -} - -WRITE8_MEMBER( pasopia7_state::vram_w ) -{ - UINT8 *vram = memregion("vram")->base(); - - if (m_vram_sel) - { - if (m_pal_sel && (m_plane_reg & 0x70) == 0x00) - { - m_p7_pal[offset & 0xf] = data & 0xf; - return; - } - - if (m_plane_reg & 0x10) - vram[(offset & 0x3fff) | 0x0000] = (m_plane_reg & 1) ? data : 0xff; - if (m_plane_reg & 0x20) - vram[(offset & 0x3fff) | 0x4000] = (m_plane_reg & 2) ? data : 0xff; - if (m_plane_reg & 0x40) - { - vram[(offset & 0x3fff) | 0x8000] = (m_plane_reg & 4) ? data : 0xff; - m_attr_latch = m_attr_wrap ? m_attr_latch : m_attr_data; - vram[(offset & 0x3fff) | 0xc000] = m_attr_latch; - } - } - else - { - UINT8 *work_ram = memregion("maincpu")->base(); - - work_ram[offset+0x8000] = data; - } -} - -WRITE8_MEMBER( pasopia7_state::pasopia7_memory_ctrl_w ) -{ - UINT8 *work_ram = memregion("maincpu")->base(); - UINT8 *basic = memregion("basic")->base(); - - switch(data & 3) - { - case 0: - case 3: //select Basic ROM - membank("bank1")->set_base(basic + 0x00000); - membank("bank2")->set_base(basic + 0x04000); - break; - case 1: //select Basic ROM + BIOS ROM - membank("bank1")->set_base(basic + 0x00000); - membank("bank2")->set_base(work_ram + 0x10000); - break; - case 2: //select Work RAM - membank("bank1")->set_base(work_ram + 0x00000); - membank("bank2")->set_base(work_ram + 0x04000); - break; - } - - m_bank_reg = data & 3; - m_vram_sel = data & 4; - m_mio_sel = data & 8; - - // bank4 is always RAM - -// printf("%02x\n",m_vram_sel); -} - -#if 0 -READ8_MEMBER( pasopia7_state::fdc_r ) -{ - return machine().rand(); -} -#endif - - -WRITE8_MEMBER( pasopia7_state::pac2_w ) -{ - /* - select register: - 4 = ram1; - 3 = ram2; - 2 = kanji ROM; - 1 = joy; - anything else is nop - */ - - if(m_pac2_bank_select == 3 || m_pac2_bank_select == 4) - { - switch(offset) - { - case 0: m_pac2_index[(m_pac2_bank_select-3) & 1] = (m_pac2_index[(m_pac2_bank_select-3) & 1] & 0x7f00) | (data & 0xff); break; - case 1: m_pac2_index[(m_pac2_bank_select-3) & 1] = (m_pac2_index[(m_pac2_bank_select-3) & 1] & 0xff) | ((data & 0x7f) << 8); break; - case 2: // PAC2 RAM write - { - UINT8 *pac2_ram; - - pac2_ram = memregion(((m_pac2_bank_select-3) & 1) ? "rampac2" : "rampac1")->base(); - - pac2_ram[m_pac2_index[(m_pac2_bank_select-3) & 1]] = data; - } - } - } - else if(m_pac2_bank_select == 2) // kanji ROM - { - switch(offset) - { - case 0: m_kanji_index = (m_kanji_index & 0x1ff00) | ((data & 0xff) << 0); break; - case 1: m_kanji_index = (m_kanji_index & 0x100ff) | ((data & 0xff) << 8); break; - case 2: m_kanji_index = (m_kanji_index & 0x0ffff) | ((data & 0x01) << 16); break; - } - } - - if(offset == 3) - { - if(data & 0x80) - { - // ... - } - else - m_pac2_bank_select = data & 7; - } -} - -READ8_MEMBER( pasopia7_state::pac2_r ) -{ - if(offset == 2) - { - if(m_pac2_bank_select == 3 || m_pac2_bank_select == 4) - { - UINT8 *pac2_ram; - - pac2_ram = memregion(((m_pac2_bank_select-3) & 1) ? "rampac2" : "rampac1")->base(); - - return pac2_ram[m_pac2_index[(m_pac2_bank_select-3) & 1]]; - } - else if(m_pac2_bank_select == 2) - { - UINT8 *kanji_rom = memregion("kanji")->base(); - - return kanji_rom[m_kanji_index]; - } - else - { - printf("%02x\n",m_pac2_bank_select); - } - } - - return 0xff; -} - -/* writes always occurs to the RAM banks, even if the ROMs are selected. */ -WRITE8_MEMBER( pasopia7_state::ram_bank_w ) -{ - UINT8 *work_ram = memregion("maincpu")->base(); - - work_ram[offset] = data; -} - -WRITE8_MEMBER( pasopia7_state::pasopia7_6845_w ) -{ - if(offset == 0) - { - m_addr_latch = data; - m_crtc->address_w(space, offset, data); - } - else - { - /* FIXME: this should be inside the MC6845 core! */ - if(m_addr_latch == 0x0a) - m_cursor_raster = data; - if(m_addr_latch == 0x0e) - m_cursor_addr = ((data<<8) & 0x3f00) | (m_cursor_addr & 0xff); - else if(m_addr_latch == 0x0f) - m_cursor_addr = (m_cursor_addr & 0x3f00) | (data & 0xff); - - m_crtc->register_w(space, offset, data); - - /* double pump the pixel clock if we are in 640 x 200 mode */ - if(m_screen_type == 1) // raster - m_crtc->set_clock( (m_x_width) ? VDP_CLOCK*2 : VDP_CLOCK); - else // lcd - m_crtc->set_clock( (m_x_width) ? LCD_CLOCK*2 : LCD_CLOCK); - } -} - -void pasopia7_state::pasopia_nmi_trap() -{ - if(m_nmi_enable_reg) - { - m_nmi_trap |= 2; - - if(m_nmi_mask == 0) - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - } -} - -READ8_MEMBER( pasopia7_state::pasopia7_fdc_r ) -{ - switch(offset) - { - case 4: return m_fdc->msr_r(space, 0, 0xff); - case 5: return m_fdc->fifo_r(space, 0, 0xff); - //case 6: bit 7 interrupt bit - } - - return 0xff; -} - -WRITE8_MEMBER( pasopia7_state::pasopia7_fdc_w ) -{ - switch(offset) - { - case 0: m_fdc->tc_w(false); break; - case 2: m_fdc->tc_w(true); break; - case 5: m_fdc->fifo_w(space, 0, data, 0xff); break; - case 6: - if(data & 0x80) - m_fdc->reset(); - /* TODO */ - m_floppy->mon_w(data & 0x40 ? CLEAR_LINE : ASSERT_LINE); - break; - } -} - - -READ8_MEMBER( pasopia7_state::pasopia7_io_r ) -{ - UINT16 io_port; - - if(m_mio_sel) - { - address_space &ram_space = m_maincpu->space(AS_PROGRAM); - - m_mio_sel = 0; - //printf("%08x\n",offset); - //return 0x0d; // hack: this is used for reading the keyboard data, we can fake it a little ... (modify fda4) - return ram_space.read_byte(offset); - } - - io_port = offset & 0xff; //trim down to 8-bit bus - - if(io_port >= 0x08 && io_port <= 0x0b) - return m_ppi0->read(space, io_port & 3); - else - if(io_port >= 0x0c && io_port <= 0x0f) - return m_ppi1->read(space, io_port & 3); -// else if(io_port == 0x10 || io_port == 0x11) { M6845 read } - else - if(io_port >= 0x18 && io_port <= 0x1b) - return pac2_r(space, io_port & 3); - else - if(io_port >= 0x20 && io_port <= 0x23) - { - pasopia_nmi_trap(); - return m_ppi2->read(space, io_port & 3); - } - else - if(io_port >= 0x28 && io_port <= 0x2b) - return m_ctc->read(space,io_port & 3); - else - if(io_port >= 0x30 && io_port <= 0x33) - return m_pio->read(space, io_port & 3); -// else if(io_port == 0x3a) { SN1 } -// else if(io_port == 0x3b) { SN2 } -// else if(io_port == 0x3c) { bankswitch } - else -// if(io_port >= 0xe0 && io_port <= 0xe6) -// return pasopia7_fdc_r(space, offset & 7); -// else - { - logerror("(PC=%06x) Read i/o address %02x\n",m_maincpu->pc(),io_port); - } - - return 0xff; -} - -WRITE8_MEMBER( pasopia7_state::pasopia7_io_w ) -{ - UINT16 io_port; - - if(m_mio_sel) - { - address_space &ram_space = m_maincpu->space(AS_PROGRAM); - m_mio_sel = 0; - ram_space.write_byte(offset, data); - return; - } - - io_port = offset & 0xff; //trim down to 8-bit bus - - if(io_port >= 0x08 && io_port <= 0x0b) - m_ppi0->write(space, io_port & 3, data); - else - if(io_port >= 0x0c && io_port <= 0x0f) - m_ppi1->write(space, io_port & 3, data); - else - if(io_port >= 0x10 && io_port <= 0x11) - pasopia7_6845_w(space, io_port-0x10, data); - else - if(io_port >= 0x18 && io_port <= 0x1b) - pac2_w(space, io_port & 3, data); - else - if(io_port >= 0x20 && io_port <= 0x23) - { - m_ppi2->write(space, io_port & 3, data); - pasopia_nmi_trap(); - } - else - if(io_port >= 0x28 && io_port <= 0x2b) - m_ctc->write(space, io_port & 3, data); - else - if(io_port >= 0x30 && io_port <= 0x33) - m_pio->write(space, io_port & 3, data); - else - if(io_port == 0x3a) - m_sn1->write(space, 0, data); - else - if(io_port == 0x3b) - m_sn2->write(space, 0, data); - else - if(io_port == 0x3c) - pasopia7_memory_ctrl_w(space,0, data); - else - if(io_port >= 0xe0 && io_port <= 0xe6) - pasopia7_fdc_w(space, offset & 7, data); - else - { - logerror("(PC=%06x) Write i/o address %02x = %02x\n",m_maincpu->pc(),offset,data); - } -} - -static ADDRESS_MAP_START(pasopia7_mem, AS_PROGRAM, 8, pasopia7_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x7fff ) AM_WRITE( ram_bank_w ) - AM_RANGE( 0x0000, 0x3fff ) AM_ROMBANK("bank1") - AM_RANGE( 0x4000, 0x7fff ) AM_ROMBANK("bank2") - AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(vram_r, vram_w ) - AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pasopia7_io, AS_IO, 8, pasopia7_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xffff) AM_READWRITE( pasopia7_io_r, pasopia7_io_w ) -ADDRESS_MAP_END - -/* TODO: where are SPACE and RETURN keys? */ -static INPUT_PORTS_START( pasopia7 ) - PASOPIA_KEYBOARD -INPUT_PORTS_END - -static const gfx_layout p7_chars_8x8 = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static const gfx_layout p7_chars_16x16 = -{ - 16,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, - 16*16 -}; - -static GFXDECODE_START( pasopia7 ) - GFXDECODE_ENTRY( "font", 0x00000, p7_chars_8x8, 0, 0x10 ) - GFXDECODE_ENTRY( "kanji", 0x00000, p7_chars_16x16, 0, 0x10 ) -GFXDECODE_END - -READ8_MEMBER( pasopia7_state::mux_r ) -{ - return m_mux_data; -} - -READ8_MEMBER( pasopia7_state::keyb_r ) -{ - const char *const keynames[3][4] = { { "KEY0", "KEY1", "KEY2", "KEY3" }, - { "KEY4", "KEY5", "KEY6", "KEY7" }, - { "KEY8", "KEY9", "KEYA", "KEYB" } }; - int i,j; - UINT8 res; - - res = 0; - for(j=0;j<3;j++) - { - if(m_mux_data & 0x10 << j) - { - for(i=0;i<4;i++) - { - if(m_mux_data & 1 << i) - res |= ioport(keynames[j][i])->read(); - } - } - } - - return res ^ 0xff; -} - -WRITE8_MEMBER( pasopia7_state::mux_w ) -{ - m_mux_data = data; -} - -static const z80_daisy_config p7_daisy[] = -{ - { "z80ctc" }, - { "z80pio" }, -// { "fdc" }, /* TODO */ - { NULL } -}; - -READ8_MEMBER( pasopia7_state::crtc_portb_r ) -{ - // --x- ---- vsync bit - // ---x ---- hardcoded bit, defines if the system screen is raster (1) or LCD (0) - // ---- x--- disp bit - UINT8 vdisp = (machine().first_screen()->vpos() < (m_screen_type ? 200 : 28)) ? 0x08 : 0x00; //TODO: check LCD vpos trigger - UINT8 vsync = vdisp ? 0x00 : 0x20; - - return 0x40 | (m_attr_latch & 0x87) | vsync | vdisp | (m_screen_type << 4); -} - -WRITE8_MEMBER( pasopia7_state::screen_mode_w ) -{ - if(data & 0x5f) - printf("GFX MODE %02x\n",data); - - m_x_width = data & 0x20; - m_gfx_mode = data & 0x80; - -// printf("%02x\n",m_gfx_mode); -} - -WRITE8_MEMBER( pasopia7_state::plane_reg_w ) -{ - //if(data & 0x11) - //printf("PLANE %02x\n",data); - m_plane_reg = data; -} - -WRITE8_MEMBER( pasopia7_state::video_attr_w ) -{ - //printf("VIDEO ATTR %02x | TEXT_PAGE %02x\n",data & 0xf,data & 0x70); - m_attr_data = (data & 0x7) | ((data & 0x8)<<4); -} - -//#include "debugger.h" - -WRITE8_MEMBER( pasopia7_state::video_misc_w ) -{ - /* - --x- ---- blinking - ---x ---- attribute wrap - ---- x--- pal disable - ---- xx-- palette selector (both bits enables this, odd hook-up) - */ -// if(data & 2) -// { -// printf("VIDEO MISC %02x\n",data); -// debugger_break(device->machine()); -// } - m_cursor_blink = data & 0x20; - m_attr_wrap = data & 0x10; -// m_pal_sel = data & 0x02; -} - -WRITE8_MEMBER( pasopia7_state::nmi_mask_w ) -{ - /* - --x- ---- (related to the data rec) - ---x ---- data rec out - ---- --x- sound off - ---- ---x reset NMI & trap - */ -// printf("SYSTEM MISC %02x\n",data); - - if(data & 1) - { - m_nmi_reset &= ~4; - m_nmi_trap &= ~2; - //m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); //guess - } - -} - -/* TODO: investigate on these. */ -READ8_MEMBER( pasopia7_state::unk_r ) -{ - return 0xff;//machine().rand(); -} - -READ8_MEMBER( pasopia7_state::nmi_reg_r ) -{ - //printf("C\n"); - return 0xfc | m_bank_reg;//machine().rand(); -} - -WRITE8_MEMBER( pasopia7_state::nmi_reg_w ) -{ - /* - x--- ---- NMI mask - -x-- ---- NMI enable trap on PPI8255 2 r/w - */ - m_nmi_mask = data & 0x80; - m_nmi_enable_reg = data & 0x40; -} - -READ8_MEMBER( pasopia7_state::nmi_porta_r ) -{ - return 0xff; -} - -READ8_MEMBER( pasopia7_state::nmi_portb_r ) -{ - return 0xf9 | m_nmi_trap | m_nmi_reset; -} - -void pasopia7_state::machine_reset() -{ - UINT8 *bios = memregion("maincpu")->base(); - - membank("bank1")->set_base(bios + 0x10000); - membank("bank2")->set_base(bios + 0x10000); -// membank("bank3")->set_base(bios + 0x10000); -// membank("bank4")->set_base(bios + 0x10000); - - m_nmi_reset |= 4; -} - -/* TODO: palette values are mostly likely to be wrong in there */ -PALETTE_INIT_MEMBER(pasopia7_state,p7_lcd) -{ - int i; - - palette.set_pen_color(0, 0xa0, 0xa8, 0xa0); - - for( i = 1; i < 8; i++) - palette.set_pen_color(i, 0x30, 0x38, 0x10); -} - -void pasopia7_state::fdc_irq(bool state) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); -} - -static SLOT_INTERFACE_START( pasopia7_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( p7_base, pasopia7_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(pasopia7_mem) - MCFG_CPU_IO_MAP(pasopia7_io) - MCFG_CPU_CONFIG(p7_daisy) - - - /* Audio */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("sn1", SN76489A, 1996800) // unknown clock / divider - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_SOUND_ADD("sn2", SN76489A, 1996800) // unknown clock / divider - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg2)) // beep interface - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(pasopia7_state, mux_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(pasopia7_state, mux_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(pasopia7_state, keyb_r)) - - MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pasopia7_state, unk_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia7_state, screen_mode_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pasopia7_state, crtc_portb_r)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia7_state, plane_reg_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pasopia7_state, video_attr_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pasopia7_state, video_misc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pasopia7_state, nmi_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pasopia7_state, nmi_mask_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pasopia7_state, nmi_portb_r)) - MCFG_I8255_IN_PORTC_CB(READ8(pasopia7_state, nmi_reg_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pasopia7_state, nmi_reg_w)) - - MCFG_UPD765A_ADD("fdc", true, true) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", pasopia7_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", pasopia7_floppies, "525hd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( p7_raster, p7_base ) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 32-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_VIDEO_START_OVERRIDE(pasopia7_state,pasopia7) - MCFG_SCREEN_UPDATE_DRIVER(pasopia7_state, screen_update_pasopia7) - MCFG_PALETTE_ADD_3BIT_BRG("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pasopia7 ) - - MCFG_MC6845_ADD("crtc", H46505, "screen", VDP_CLOCK) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( p7_lcd, p7_base ) - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_VIDEO_START_OVERRIDE(pasopia7_state,pasopia7) - MCFG_SCREEN_UPDATE_DRIVER(pasopia7_state, screen_update_pasopia7) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(pasopia7_state,p7_lcd) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pasopia7 ) - - MCFG_MC6845_ADD("crtc", H46505, "screen", LCD_CLOCK) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_DEFAULT_LAYOUT( layout_lcd ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pasopia7 ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bios.rom", 0x10000, 0x4000, CRC(b8111407) SHA1(ac93ae62db4c67de815f45de98c79cfa1313857d)) - - ROM_REGION( 0x8000, "basic", ROMREGION_ERASEFF ) - ROM_LOAD( "basic.rom", 0x0000, 0x8000, CRC(8a58fab6) SHA1(5e1a91dfb293bca5cf145b0a0c63217f04003ed1)) - - ROM_REGION( 0x800, "font", ROMREGION_ERASEFF ) - ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(a91c45a9) SHA1(a472adf791b9bac3dfa6437662e1a9e94a88b412)) - - ROM_REGION( 0x20000, "kanji", ROMREGION_ERASEFF ) - ROM_LOAD( "kanji.rom", 0x0000, 0x20000, CRC(6109e308) SHA1(5c21cf1f241ef1fa0b41009ea41e81771729785f)) - - ROM_REGION( 0x8000, "rampac1", ROMREGION_ERASEFF ) -// ROM_LOAD( "rampac1.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) - - ROM_REGION( 0x8000, "rampac2", ROMREGION_ERASEFF ) -// ROM_LOAD( "rampac2.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) - - ROM_REGION( 0x10000, "vram", ROMREGION_ERASE00 ) -ROM_END - -/* using an identical ROMset from now, but the screen type is different */ -ROM_START( pasopia7lcd ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bios.rom", 0x10000, 0x4000, CRC(b8111407) SHA1(ac93ae62db4c67de815f45de98c79cfa1313857d)) - - ROM_REGION( 0x8000, "basic", ROMREGION_ERASEFF ) - ROM_LOAD( "basic.rom", 0x0000, 0x8000, CRC(8a58fab6) SHA1(5e1a91dfb293bca5cf145b0a0c63217f04003ed1)) - - ROM_REGION( 0x800, "font", ROMREGION_ERASEFF ) - ROM_LOAD( "font.rom", 0x0000, 0x0800, BAD_DUMP CRC(a91c45a9) SHA1(a472adf791b9bac3dfa6437662e1a9e94a88b412)) - - ROM_REGION( 0x20000, "kanji", ROMREGION_ERASEFF ) - ROM_LOAD( "kanji.rom", 0x0000, 0x20000, CRC(6109e308) SHA1(5c21cf1f241ef1fa0b41009ea41e81771729785f)) - - ROM_REGION( 0x8000, "rampac1", ROMREGION_ERASEFF ) -// ROM_LOAD( "rampac1.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) - - ROM_REGION( 0x8000, "rampac2", ROMREGION_ERASEFF ) -// ROM_LOAD( "rampac2.bin", 0x0000, 0x8000, CRC(0e4f09bd) SHA1(4088906d57e4f6085a75b249a6139a0e2eb531a1) ) - - ROM_REGION( 0x10000, "vram", ROMREGION_ERASE00 ) -ROM_END - - -DRIVER_INIT_MEMBER(pasopia7_state,p7_raster) -{ - m_screen_type = 1; - machine().scheduler().timer_pulse(attotime::from_hz(500), timer_expired_delegate(FUNC(pasopia7_state::pio_timer),this)); -} - -DRIVER_INIT_MEMBER(pasopia7_state,p7_lcd) -{ - m_screen_type = 0; - machine().scheduler().timer_pulse(attotime::from_hz(500), timer_expired_delegate(FUNC(pasopia7_state::pio_timer),this)); -} - - -/* Driver */ - -COMP( 1983, pasopia7, 0, 0, p7_raster, pasopia7, pasopia7_state, p7_raster, "Toshiba", "Pasopia 7 (Raster)", MACHINE_NOT_WORKING ) -COMP( 1983, pasopia7lcd, pasopia7, 0, p7_lcd, pasopia7, pasopia7_state, p7_lcd, "Toshiba", "Pasopia 7 (LCD)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/pb1000.c b/src/mess/drivers/pb1000.c deleted file mode 100644 index 44cbb6f0d73..00000000000 --- a/src/mess/drivers/pb1000.c +++ /dev/null @@ -1,571 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Casio PB-1000 / PB-2000c driver - - Driver by Sandro Ronco - - TODO: - - improve the pb2000c gate array emulation - - i/o port - - Known issues: - - the second memory card is not recognized by the HW - - More info: - http://www.itkp.uni-bonn.de/~wichmann/pb1000-wrobel.html - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/hd61700/hd61700.h" -#include "video/hd44352.h" -#include "machine/nvram.h" -#include "sound/beep.h" -#include "rendlay.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class pb1000_state : public driver_device -{ -public: - pb1000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_beeper(*this, "beeper"), - m_hd44352(*this, "hd44352"), - m_card1(*this, "cardslot1"), - m_card2(*this, "cardslot2") - { } - - required_device m_maincpu; - required_device m_beeper; - required_device m_hd44352; - optional_device m_card1; - optional_device m_card2; - - emu_timer *m_kb_timer; - UINT8 m_kb_matrix; - UINT8 m_gatearray[2]; - - memory_region *m_rom_reg; - memory_region *m_card1_reg; - memory_region *m_card2_reg; - - virtual void machine_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE16_MEMBER( gatearray_w ); - DECLARE_WRITE8_MEMBER( lcd_control ); - DECLARE_READ8_MEMBER( lcd_data_r ); - DECLARE_WRITE8_MEMBER( lcd_data_w ); - DECLARE_READ16_MEMBER( pb1000_kb_r ); - DECLARE_READ16_MEMBER( pb2000c_kb_r ); - DECLARE_WRITE8_MEMBER( kb_matrix_w ); - DECLARE_READ8_MEMBER( pb1000_port_r ); - DECLARE_READ8_MEMBER( pb2000c_port_r ); - DECLARE_WRITE8_MEMBER( port_w ); - UINT16 read_touchscreen(UINT8 line); - DECLARE_PALETTE_INIT(pb1000); - TIMER_CALLBACK_MEMBER(keyboard_timer); -}; - -static ADDRESS_MAP_START(pb1000_mem, AS_PROGRAM, 16, pb1000_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE( 0x00000, 0x00bff ) AM_ROM - //AM_RANGE( 0x00c00, 0x00c0f ) AM_NOP //I/O - AM_RANGE( 0x06000, 0x07fff ) AM_RAM AM_SHARE("nvram1") - AM_RANGE( 0x08000, 0x0ffff ) AM_ROMBANK("bank1") - AM_RANGE( 0x18000, 0x1ffff ) AM_RAM AM_SHARE("nvram2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pb2000c_mem, AS_PROGRAM, 16, pb1000_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE( 0x00000, 0x00bff ) AM_ROM - //AM_RANGE( 0x00c00, 0x00c0f ) AM_NOP //I/O - AM_RANGE( 0x00c10, 0x00c11 ) AM_WRITE(gatearray_w) - AM_RANGE( 0x00000, 0x0ffff ) AM_ROMBANK("bank1") - AM_RANGE( 0x10000, 0x1ffff ) AM_RAM AM_SHARE("nvram1") - AM_RANGE( 0x20000, 0x27fff ) AM_DEVREAD("cardslot1", generic_slot_device, read16_rom) - AM_RANGE( 0x28000, 0x2ffff ) AM_RAM AM_SHARE("nvram2") -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( pb1000 ) - PORT_START("KO1") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_7_PAD) - PORT_START("KO2") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("IN") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEMO IN") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('"') PORT_CHAR('!') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("$") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('$') PORT_CHAR('#') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("&") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('&') PORT_CHAR('%') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('\'') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('<') - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('>') - PORT_START("KO3") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OUT") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEMO") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_START("KO4") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CALC") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAL") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_START("KO5") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MENU") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_START("KO6") - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LCKEY") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CONTR") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(')') PORT_CHAR(']') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW ALL") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_DEL) - PORT_START("KO7") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('^') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('}') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_PGUP) PORT_CHAR('(') PORT_CHAR('[') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('\'') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('_') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('@') - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENG") PORT_CODE(KEYCODE_F6) - PORT_START("KO8") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') PORT_CHAR('{') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\\') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('~') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('|') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_START("KO9") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_START("KO10") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ANS") PORT_CODE(KEYCODE_END) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_5_PAD) - PORT_START("KO11") - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("KO12") - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_LALT) - PORT_START("NULL") - PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED) - - //touchscreen - PORT_START("POSX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_CROSSHAIR(X, 1, 0, 0) PORT_SENSITIVITY(20) PORT_KEYDELTA(0) - PORT_START("POSY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_CROSSHAIR(Y, 1, 0, 0) PORT_SENSITIVITY(120) PORT_KEYDELTA(0) - PORT_START("TOUCH") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Touchscreen") -INPUT_PORTS_END - -static INPUT_PORTS_START( pb2000c ) - PORT_START("KO1") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_7_PAD) - PORT_START("KO2") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_START("KO3") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_START("KO4") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_START("KO5") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("|") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEMO") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_START("KO6") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("IN") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OUT") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_START("KO7") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CALC") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ETC") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SS") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ANS") PORT_CODE(KEYCODE_END) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_BACKSLASH2) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_START("KO8") - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW ALL") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_START("KO9") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_START("KO10") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MENU") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAL") PORT_CODE(KEYCODE_F9) - PORT_START("KO11") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_START("KO12") - PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("NULL") - PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -PALETTE_INIT_MEMBER(pb1000_state, pb1000) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - - -static const gfx_layout pb1000_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - { 0, 1, 2, 3, 4, 5, 6, 7}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( pb1000 ) - GFXDECODE_ENTRY( "hd44352", 0x0000, pb1000_charlayout, 0, 1 ) -GFXDECODE_END - -WRITE16_MEMBER( pb1000_state::gatearray_w ) -{ - m_gatearray[offset] = data&0xff; - - if (m_gatearray[0] && m_card1 && m_card1_reg) - membank("bank1")->set_base(m_card1_reg->base()); - else if (m_gatearray[1] && m_card2 && m_card2_reg) - membank("bank1")->set_base(m_card2_reg->base()); - else - membank("bank1")->set_base(m_rom_reg->base()); -} - -WRITE8_MEMBER( pb1000_state::lcd_control ) -{ - m_hd44352->control_write(data); -} - - -READ8_MEMBER( pb1000_state::lcd_data_r ) -{ - return m_hd44352->data_read(); -} - - -WRITE8_MEMBER( pb1000_state::lcd_data_w ) -{ - m_hd44352->data_write(data); -} - - -UINT16 pb1000_state::read_touchscreen(UINT8 line) -{ - UINT8 x = ioport("POSX")->read()/0x40; - UINT8 y = ioport("POSY")->read()/0x40; - - if (ioport("TOUCH")->read()) - { - if (x == line-7) - return (0x1000<read(); - data |= read_touchscreen(line); - } - - } - else - { - data = ioport(bitnames[m_kb_matrix & 0x0f])->read(); - data |= read_touchscreen(m_kb_matrix & 0x0f); - } - - return data; -} - -READ16_MEMBER( pb1000_state::pb2000c_kb_r ) -{ - static const char *const bitnames[] = {"NULL", "KO1", "KO2", "KO3", "KO4", "KO5", "KO6", "KO7", "KO8", "KO9", "KO10", "KO11", "KO12", "NULL", "NULL", "NULL"}; - UINT16 data = 0; - - if ((m_kb_matrix & 0x0f) == 0x0d) - { - //Read all the input lines - for (int line = 1; line <= 12; line++) - { - data |= ioport(bitnames[line])->read(); - } - - } - else - { - data = ioport(bitnames[m_kb_matrix & 0x0f])->read(); - } - - return data; -} - -WRITE8_MEMBER( pb1000_state::kb_matrix_w ) -{ - if (data & 0x80) - { - if ((m_kb_matrix & 0x80) != (data & 0x80)) - m_kb_timer->adjust(attotime::never, 0, attotime::never); - } - else - { - if ((m_kb_matrix & 0x40) != (data & 0x40)) - { - if (data & 0x40) - m_kb_timer->adjust(attotime::from_hz(32), 0, attotime::from_hz(32)); - else - m_kb_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); - } - } - - m_kb_matrix = data; -} - -READ8_MEMBER( pb1000_state::pb1000_port_r ) -{ - //TODO - return 0x00; -} - -READ8_MEMBER( pb1000_state::pb2000c_port_r ) -{ - //TODO - return 0xfc; -} - -WRITE8_MEMBER( pb1000_state::port_w ) -{ - m_beeper->set_state((BIT(data,7) ^ BIT(data,6))); - //printf("%x\n", data); -} - - -TIMER_CALLBACK_MEMBER(pb1000_state::keyboard_timer) -{ - m_maincpu->set_input_line(HD61700_KEY_INT, ASSERT_LINE); - m_maincpu->set_input_line(HD61700_KEY_INT, CLEAR_LINE); -} - -void pb1000_state::machine_start() -{ - std::string region_tag; - m_rom_reg = memregion("rom"); - if (m_card1) - m_card1_reg = memregion(region_tag.assign(m_card1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - if (m_card2) - m_card2_reg = memregion(region_tag.assign(m_card2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - membank("bank1")->set_base(m_rom_reg->base()); - - m_kb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pb1000_state::keyboard_timer),this)); - m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192)); -} - -static MACHINE_CONFIG_START( pb1000, pb1000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD61700, 910000) - MCFG_CPU_PROGRAM_MAP(pb1000_mem) - MCFG_HD61700_LCD_CTRL_CB(WRITE8(pb1000_state, lcd_control)) - MCFG_HD61700_LCD_READ_CB(READ8(pb1000_state, lcd_data_r)) - MCFG_HD61700_LCD_WRITE_CB(WRITE8(pb1000_state, lcd_data_w)) - MCFG_HD61700_KB_READ_CB(READ16(pb1000_state, pb1000_kb_r)) - MCFG_HD61700_KB_WRITE_CB(WRITE8(pb1000_state, kb_matrix_w)) - MCFG_HD61700_PORT_READ_CB(READ8(pb1000_state, pb1000_port_r)) - MCFG_HD61700_PORT_WRITE_CB(WRITE8(pb1000_state, port_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44352", hd44352_device, screen_update) - MCFG_SCREEN_SIZE(192, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 192-1, 0, 32-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pb1000_state, pb1000) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pb1000 ) - - MCFG_DEVICE_ADD("hd44352", HD44352, 910000) - MCFG_HD44352_ON_CB(INPUTLINE("maincpu", HD61700_ON_INT)) - - MCFG_NVRAM_ADD_0FILL("nvram1") - MCFG_NVRAM_ADD_0FILL("nvram2") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pb2000c, pb1000 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pb2000c_mem) - MCFG_HD61700_KB_READ_CB(READ16(pb1000_state, pb2000c_kb_r)) - MCFG_HD61700_PORT_READ_CB(READ8(pb1000_state, pb2000c_port_r)) - - MCFG_GENERIC_CARTSLOT_ADD("cardslot1", generic_plain_slot, "pb2000c_card") - MCFG_GENERIC_CARTSLOT_ADD("cardslot2", generic_plain_slot, "pb2000c_card") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("card_list", "pb2000c") -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( pb1000 ) - ROM_REGION( 0x30000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hd61700.bin", 0x0000, 0x1800, CRC(b28c21a3) SHA1(be7ea62a15ff0c612f6efb2c95e6c2a11a738423)) - - ROM_REGION( 0x10000, "rom", ROMREGION_ERASE ) - ROM_SYSTEM_BIOS(0, "basic", "BASIC") - ROMX_LOAD( "pb1000.bin", 0x0000, 0x8000, CRC(8127a090) SHA1(067c1c2e7efb5249e95afa7805bb98543b30b630), ROM_BIOS(1) | ROM_SKIP(1)) - ROM_SYSTEM_BIOS(1, "basicj", "BASIC Jap") - ROMX_LOAD( "pb1000j.bin", 0x0000, 0x8000, CRC(14a0df57) SHA1(ab47bb54eb2a24dcd9d2663462e9272d974fa7da), ROM_BIOS(2) | ROM_SKIP(1)) - - ROM_REGION( 0x0800, "hd44352", 0 ) - ROM_LOAD( "charset.bin", 0x0000, 0x0800, CRC(7f144716) SHA1(a02f1ecc6dc0ac55b94f00931d8f5cb6b9ffb7b4)) -ROM_END - - -ROM_START( pb2000c ) - ROM_REGION( 0x1800, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hd61700.bin", 0x0000, 0x1800, CRC(25f9540c) SHA1(ecf98efadbdd4d1a74bc183eaf23f7113f2a12b1)) - - ROM_REGION( 0x20000, "rom", ROMREGION_ERASE ) - ROMX_LOAD( "pb2000c.bin", 0x0000, 0x10000, CRC(41933631) SHA1(70b654dc375b647afa042baf8b0a139e7fa604e8), ROM_SKIP(1)) - - ROM_REGION( 0x0800, "hd44352", 0 ) - ROM_LOAD( "charset.bin", 0x0000, 0x0800, CRC(7f144716) SHA1(a02f1ecc6dc0ac55b94f00931d8f5cb6b9ffb7b4)) -ROM_END - - -ROM_START( ai1000 ) - ROM_REGION( 0x1800, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hd61700.bin", 0x0000, 0x1800, CRC(25f9540c) SHA1(ecf98efadbdd4d1a74bc183eaf23f7113f2a12b1)) - - ROM_REGION( 0x20000, "rom", ROMREGION_ERASE ) - ROMX_LOAD( "ai1000.bin", 0x0000, 0x10000, CRC(72aa3ee3) SHA1(ed1d0bc470902ea73bc4588147a589b1793afb40), ROM_SKIP(1)) - - ROM_REGION( 0x0800, "hd44352", 0 ) - ROM_LOAD( "charset.bin", 0x0000, 0x0800, CRC(7f144716) SHA1(a02f1ecc6dc0ac55b94f00931d8f5cb6b9ffb7b4)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, pb1000 , 0, 0, pb1000 , pb1000 , driver_device, 0, "Casio", "PB-1000", MACHINE_NOT_WORKING) -COMP( 1989, pb2000c, 0, 0, pb2000c, pb2000c, driver_device, 0, "Casio", "PB-2000c", MACHINE_NOT_WORKING) -COMP( 1989, ai1000, pb2000c, 0, pb2000c, pb2000c, driver_device, 0, "Casio", "AI-1000", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/pc.c b/src/mess/drivers/pc.c deleted file mode 100644 index e362880ef0c..00000000000 --- a/src/mess/drivers/pc.c +++ /dev/null @@ -1,475 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Miodrag Milanovic -/*************************************************************************** - - drivers/pc.c - -Driver file for IBM PC, IBM PC XT, and related machines. - - PC-XT memory map - - 00000-9FFFF RAM - A0000-AFFFF NOP or videoram EGA/VGA - B0000-B7FFF videoram MDA, page #0 - B8000-BFFFF videoram CGA and/or MDA page #1, T1T mapped RAM - C0000-C7FFF NOP or ROM EGA/VGA - C8000-C9FFF ROM XT HDC #1 - CA000-CBFFF ROM XT HDC #2 - D0000-EFFFF NOP or 'adapter RAM' - F0000-FDFFF NOP or ROM Basic + other Extensions - FE000-FFFFF ROM - -IBM5550 -======= -Information can be found at http://homepage3.nifty.com/ibm5550/index-e.html -It's an heavily modified IBM PC-XT machine, with a completely different -video HW too. - -***************************************************************************/ - -#include "emu.h" - -#include "cpu/i86/i86.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "bus/pc_kbd/keyboards.h" -#include "includes/genpc.h" - -class pc_state : public driver_device -{ -public: - pc_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - required_device m_maincpu; - - DECLARE_READ8_MEMBER(unk_r); - - DECLARE_DRIVER_INIT(bondwell); - - DECLARE_INPUT_CHANGED_MEMBER(pc_turbo_callback); - - double m_turbo_off_speed; -}; - -static ADDRESS_MAP_START( pc8_map, AS_PROGRAM, 8, pc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( zenith_map, AS_PROGRAM, 8, pc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xf7fff) AM_RAM - AM_RANGE(0xf8000, 0xfffff) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( pc16_map, AS_PROGRAM, 16, pc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xbffff) AM_NOP - AM_RANGE(0xc0000, 0xc7fff) AM_ROM - AM_RANGE(0xc8000, 0xcffff) AM_ROM - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ibm5550_map, AS_PROGRAM, 16, pc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xeffff) AM_RAM - AM_RANGE(0xfc000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pc8_io, AS_IO, 8, pc_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pc16_io, AS_IO, 16, pc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0070, 0x007f) AM_RAM // needed for Poisk-2 -ADDRESS_MAP_END - -READ8_MEMBER(pc_state::unk_r) -{ - return 0; -} - -static ADDRESS_MAP_START(ibm5550_io, AS_IO, 16, pc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00a0, 0x00a1) AM_READ8(unk_r, 0x00ff ) -ADDRESS_MAP_END - -INPUT_CHANGED_MEMBER(pc_state::pc_turbo_callback) -{ - m_maincpu->set_clock_scale((newval & 2) ? 1 : m_turbo_off_speed); -} - -DRIVER_INIT_MEMBER(pc_state,bondwell) -{ - m_turbo_off_speed = 4.77/12; -} - -static INPUT_PORTS_START( pccga ) - PORT_START("DSW1") /* IN2 */ - PORT_DIPNAME( 0x80, 0x80, "COM1: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x40, "COM2: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x00, "COM3: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x10, 0x00, "COM4: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x04, 0x00, "LPT2: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x02, 0x00, "LPT3: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x01, 0x00, "Game port enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) - - PORT_START("DSW2") /* IN3 */ - PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) - PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ - PORT_BIT( 0x01, 0x01, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( bondwell ) - PORT_INCLUDE(pccga) - - PORT_MODIFY("DSW2") /* IN3 */ - PORT_DIPNAME( 0x02, 0x02, "Turbo Switch" ) PORT_CHANGED_MEMBER(DEVICE_SELF, pc_state, pc_turbo_callback, 0) - PORT_DIPSETTING( 0x00, "Off (4.77 MHz)" ) - PORT_DIPSETTING( 0x02, "On (12 MHz)" ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START( pccga ) - DEVICE_INPUT_DEFAULTS("DSW0", 0x30, 0x20) -DEVICE_INPUT_DEFAULTS_END - -#define MCFG_CPU_PC(mem, port, type, clock) \ - MCFG_CPU_ADD("maincpu", type, clock) \ - MCFG_CPU_PROGRAM_MAP(mem##_map) \ - MCFG_CPU_IO_MAP(port##_io) \ - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - -static MACHINE_CONFIG_START( pccga, pc_state ) - /* basic machine hardware */ - MCFG_CPU_PC(pc8, pc8, I8088, 4772720) /* 4,77 MHz */ - - MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(pccga) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - -static DEVICE_INPUT_DEFAULTS_START( iskr3104 ) - DEVICE_INPUT_DEFAULTS("DSW0", 0x30, 0x00) -DEVICE_INPUT_DEFAULTS_END - -static MACHINE_CONFIG_START( iskr3104, pc_state ) - /* basic machine hardware */ - MCFG_CPU_PC(pc16, pc16, I8086, 4772720) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(iskr3104) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "ega", false) - MCFG_SLOT_OPTION_DEFAULT_BIOS("ega", "iskr3104") - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( poisk2, pc_state ) - /* basic machine hardware */ - MCFG_CPU_PC(pc16, pc16, I8086, 4772720) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(pccga) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga_poisk2", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( zenith, pc_state ) - /* basic machine hardware */ - MCFG_CPU_PC(zenith, pc8, I8088, XTAL_14_31818MHz/3) /* 4,77 MHz */ - - MCFG_IBM5150_MOTHERBOARD_ADD("mb", "maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(pccga) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ibm5550, pc_state ) - /* basic machine hardware */ - MCFG_CPU_PC(ibm5550, ibm5550, I8086, 8000000) - - MCFG_IBM5160_MOTHERBOARD_ADD("mb", "maincpu") - MCFG_DEVICE_INPUT_DEFAULTS(pccga) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "fdc_xt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "lpt", false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "com", false) - - /* keyboard */ - MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED(bondwell, pccga) - MCFG_DEVICE_REMOVE("maincpu") - MCFG_CPU_PC(pc8, pc8, I8088, 4772720) // turbo? -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED(mk88, poisk2) - MCFG_DEVICE_MODIFY("isa1") - MCFG_SLOT_DEFAULT_OPTION("cga_ec1841") -MACHINE_CONFIG_END - -ROM_START( bw230 ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD("bondwell.bin", 0xfe000, 0x2000, CRC(d435a405) SHA1(a57c705d1144c7b61940b6f5c05d785c272fc9bb)) -ROM_END - -ROM_START( zdsupers ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_SYSTEM_BIOS( 0, "v31d", "v3.1d" ) - ROMX_LOAD( "z184m v3.1d.10d", 0xf8000, 0x8000, CRC(44012c3b) SHA1(f2f28979798874386ca8ba3dd3ead24ae7c2aeb4), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v29e", "v2.9e" ) - ROMX_LOAD( "z184m v2.9e.10d", 0xf8000, 0x8000, CRC(de2f200b) SHA1(ad5ce601669a82351e412fc6c1c70c47779a1e55), ROM_BIOS(2)) -ROM_END - - -ROM_START( dgone ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD( "dgone.bin", 0xf8000, 0x08000, CRC(2c38c86e) SHA1(c0f85a000d1d13cd354965689e925d677822549e)) -ROM_END - -ROM_START( ssam88s ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD( "samsung_samtron_88s_vers_2.0a.bin", 0xf8000, 0x08000, CRC(d1252a91) SHA1(469d15b6ecd7b70234975dc12c6bda4212a66652)) -ROM_END - -ROM_START( mk88 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_DEFAULT_BIOS("v392") - ROM_SYSTEM_BIOS(0, "v290", "v2.90") - ROMX_LOAD( "mk88m.bin", 0xfc000, 0x2000, CRC(09c9da3b) SHA1(d1e7ad23b5f5b3576ad128c1198294129754f39f), ROM_BIOS(1)) - ROMX_LOAD( "mk88b.bin", 0xfe000, 0x2000, CRC(8a922476) SHA1(c19c3644ab92fd12e13f32b410cd26e3c844a03b), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v391", "v3.91") - ROMX_LOAD( "mkm.bin", 0xfc000, 0x2000, CRC(65f979e8) SHA1(13e85be9bc8ceb5ab9e559e7d0089e26fbbb84fc), ROM_BIOS(2)) - ROMX_LOAD( "mkb.bin", 0xfe000, 0x2000, CRC(830a0447) SHA1(11bc200fdbcfbbe335f4c282020750c0b5ca4167), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v392", "v3.92") - ROMX_LOAD( "m88.bin", 0xfc000, 0x2000, CRC(fe1b4e36) SHA1(fcb420af0ff09a7d43fcb9b7d0b0233a2071c159), ROM_BIOS(3)) - ROMX_LOAD( "b88.bin", 0xfe000, 0x2000, CRC(58a418df) SHA1(216398d4e4302ee7efcc2c8f9ff9d8a1161229ea), ROM_BIOS(3)) -ROM_END - -ROM_START( iskr3104 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROMX_LOAD( "198.bin", 0xfc000, 0x2000, CRC(bcfd8e41) SHA1(e21ddf78839aa51fa5feb23f511ff5e2da31b433),ROM_SKIP(1)) - ROMX_LOAD( "199.bin", 0xfc001, 0x2000, CRC(2da5fe79) SHA1(14d5dccc141a0b3367f7f8a7188306fdf03c2b6c),ROM_SKIP(1)) - // EGA card from Iskra-3104 - //ROMX_LOAD( "143-03.bin", 0xc0001, 0x2000, CRC(d0706345) SHA1(e04bb40d944426a4ae2e3a614d3f4953d7132ede),ROM_SKIP(1)) - //ROMX_LOAD( "143-02.bin", 0xc0000, 0x2000, CRC(c8c18ebb) SHA1(fd6dac76d43ab8b582e70f1d5cc931d679036fb9),ROM_SKIP(1)) -ROM_END - -ROM_START( poisk2 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "v20", "v2.0") - ROMX_LOAD( "b_p2_20h.rf4", 0xfc001, 0x2000, CRC(d53189b7) SHA1(ace40f1a40642b51fe5d2874acef81e48768b23b), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "b_p2_20l.rf4", 0xfc000, 0x2000, CRC(2d61fcc9) SHA1(11873c8741ba37d6c2fe1f482296aece514b7618), ROM_SKIP(1) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v21", "v2.1") - ROMX_LOAD( "b_p2_21h.rf4", 0xfc001, 0x2000, CRC(22197297) SHA1(506c7e63027f734d62ef537f484024548546011f), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "b_p2_21l.rf4", 0xfc000, 0x2000, CRC(0eb2ea7f) SHA1(67bb5fec53ebfa2a5cad2a3d3d595678d6023024), ROM_SKIP(1) | ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v24", "v2.4") - ROMX_LOAD( "b_p2_24h.rf4", 0xfc001, 0x2000, CRC(ea842c9e) SHA1(dcdbf27374149dae0ef76d410cc6c615d9b99372), ROM_SKIP(1) | ROM_BIOS(3)) - ROMX_LOAD( "b_p2_24l.rf4", 0xfc000, 0x2000, CRC(02f21250) SHA1(f0b133fb4470bddf2f7bf59688cf68198ed8ce55), ROM_SKIP(1) | ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v21d", "v2.1d") - ROMX_LOAD( "opp2_1h.rf4", 0xfc001, 0x2000, CRC(b7cd7f4f) SHA1(ac473822fb44d7b898d628732cf0a27fcb4d26d6), ROM_SKIP(1) | ROM_BIOS(4)) - ROMX_LOAD( "opp2_1l.rf4", 0xfc000, 0x2000, CRC(1971dca3) SHA1(ecd61cc7952af834d8abc11db372c3e70775489d), ROM_SKIP(1) | ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v22d", "v2.2d") - ROMX_LOAD( "opp2_2h.rf4", 0xfc001, 0x2000, CRC(b9e3a5cc) SHA1(0a28afbff612471ee81d69a98789e75253c57a30), ROM_SKIP(1) | ROM_BIOS(5)) - ROMX_LOAD( "opp2_2l.rf4", 0xfc000, 0x2000, CRC(6877aad6) SHA1(1d0031d044beb4f9f321e3c8fdedf57467958900), ROM_SKIP(1) | ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "v23d", "v2.3d") - ROMX_LOAD( "opp2_3h.rf4", 0xfc001, 0x2000, CRC(ac7d4f06) SHA1(858d6e084a38814280b3e29fb54971f4f532e484), ROM_SKIP(1) | ROM_BIOS(6)) - ROMX_LOAD( "opp2_3l.rf4", 0xfc000, 0x2000, CRC(3c877ea1) SHA1(0753168659653538311c0ad1df851cbbdba426f4), ROM_SKIP(1) | ROM_BIOS(6)) -ROM_END - -ROM_START( mc1702 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_LOAD16_BYTE( "2764_2_(573rf4).rom", 0xfc000, 0x2000, CRC(34a0c8fb) SHA1(88dc247f2e417c2848a2fd3e9b52258ad22a2c07)) - ROM_LOAD16_BYTE( "2764_3_(573rf4).rom", 0xfc001, 0x2000, CRC(68ab212b) SHA1(f3313f77392877d28ce290ffa3432f0a32fc4619)) - ROM_LOAD( "ba1m_(573rf5).rom", 0x0000, 0x0800, CRC(08d938e8) SHA1(957b6c691dbef75c1c735e8e4e81669d056971e4)) -ROM_END - -ROM_START( ibm5550 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROM_LOAD( "ipl5550.rom", 0xfc000, 0x4000, CRC(40cf34c9) SHA1(d41f77fdfa787b0e97ed311e1c084b8699a5b197)) -ROM_END - -ROM_START( pc7000 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - ROMX_LOAD( "mitsubishi-m5l27128k-1.bin", 0xf8000, 0x4000, CRC(9683957f) SHA1(4569eab6d88eb1bba0d553d1358e593c326978aa), ROM_SKIP(1)) - ROMX_LOAD( "mitsubishi-m5l27128k-2.bin", 0xf8001, 0x4000, CRC(99b229a4) SHA1(5800c8bafed26873d8cfcc79a05f93a780a31c91), ROM_SKIP(1)) -ROM_END - -ROM_START( olivm15 ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD( "oliv_m15.bin",0xfc000, 0x04000, CRC(bf2ef795) SHA1(02d497131f5ca2c78f2accd38ab0eab6813e3ebf)) -ROM_END - -ROM_START( sx16 ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD( "tmm27128ad.bin",0xfc000, 0x4000, CRC(f8543362) SHA1(fef625e260ca89ba02174584bdc12db609f0780e)) -ROM_END - -ROM_START( compc1 ) - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD("380270-01.bin", 0xfc000, 0x4000, BAD_DUMP CRC(75135d37) SHA1(177283642240fee191ba2d87e1d0c2a377c78ccb)) - ROM_REGION(0x8000, "gfx1", 0) - ROM_LOAD("pc1_char.bin", 0x0000, 0x8000, CRC(4773a945) SHA1(bcc38abecc75d3f641d42987cb0d2ed71d71bc4c)) -ROM_END - -// Note: Commodore PC20-III, PC10-III and COLT share the same BIOS -ROM_START( pc10iii ) - ROM_REGION(0x100000, "maincpu", 0) - ROM_DEFAULT_BIOS("v441") - ROM_SYSTEM_BIOS(0, "v435", "v4.35") - ROMX_LOAD("318085-01.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v436", "v4.36") - ROMX_LOAD("318085-02.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v436c", "v4.36c") - ROMX_LOAD("318085-04.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v438", "v4.38") - ROMX_LOAD("318085-05.u201", 0xf8000, 0x8000, CRC(ae9e6a31) SHA1(853ee251cf230818c407a8d13ef060a21c90a8c1), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v439", "v4.39") - ROMX_LOAD("318085-06.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "v440", "v4.40") - ROMX_LOAD("318085-07.u201", 0xf8000, 0x8000, NO_DUMP, ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "v441", "v4.41") - ROMX_LOAD("318085-08.u201", 0xf8000, 0x8000, CRC(7e228dc8) SHA1(958dfdd637bd31c01b949fac729d6973a7e630bc), ROM_BIOS(7)) - ROM_REGION(0x8000, "gfx1", 0) - ROM_LOAD("318086-02.u607", 0x0000, 0x8000, CRC(b406651c) SHA1(856f58353391a74a06ebb8ec9f8333d7d69e5fd6)) - //ROM_LOAD("5788005.u33", 0x00000, 0x2000, BAD_DUMP CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* temp so you can read the text */ -ROM_END - -ROM_START( mbc16 ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD( "mbc16.bin", 0xfc000, 0x4000, CRC(f3e0934a) SHA1(e4b91c3d395be0414e20f23ad4919b8ac52639b2)) - ROM_REGION(0x2000,"gfx1", 0) - //ATI Graphics Solution SR (graphics card, need to make it ISA card) - ROM_LOAD( "atigssr.bin", 0x0000, 0x2000, CRC(aca81498) SHA1(0d84c89487ee7a6ac4c9e73fdb30c5fd8aa595f8)) -ROM_END - -ROM_START( ataripc3 ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD( "c101701-004 308.u61",0xf8000, 0x8000, CRC(929a2443) SHA1(8e98f3c9180c55b1f5521727779c016083d27960)) - - ROM_REGION(0x8000,"gfx1", 0) - ROM_LOAD("5788005.u33", 0x00000, 0x2000, BAD_DUMP CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) // not the real character ROM - - ROM_REGION(0x8000,"plds", 0) - ROM_LOAD( "c101681 6ffb.u60",0x000, 0x100, NO_DUMP ) // PAL20L10NC -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1984, dgone, ibm5150, 0, pccga, pccga, driver_device, 0, "Data General", "Data General/One" , MACHINE_NOT_WORKING)/* CGA, 2x 3.5" disk drives */ -COMP( 1985, bw230, ibm5150, 0, bondwell, bondwell, pc_state, bondwell, "Bondwell Holding", "BW230 (PRO28 Series)", 0 ) -COMP( 1984, compc1, ibm5150, 0, pccga, pccga, driver_device, 0, "Commodore Business Machines", "Commodore PC-1" , MACHINE_NOT_WORKING) -COMP( 1987, pc10iii, ibm5150, 0, pccga, pccga, driver_device, 0, "Commodore Business Machines", "Commodore PC-10 III" , MACHINE_NOT_WORKING) - -COMP( 1992, iskr3104, ibm5150, 0, iskr3104, pccga, driver_device, 0, "Schetmash", "Iskra 3104", MACHINE_NOT_WORKING) -COMP( 1989, mk88, ibm5150, 0, mk88, pccga, driver_device, 0, "", "MK-88", MACHINE_NOT_WORKING) -COMP( 1991, poisk2, ibm5150, 0, poisk2, pccga, driver_device, 0, "", "Poisk-2", MACHINE_NOT_WORKING) -COMP( 1990, mc1702, ibm5150, 0, pccga, pccga, driver_device, 0, "", "Elektronika MC-1702", MACHINE_NOT_WORKING) - -COMP( 1987, zdsupers, ibm5150, 0, zenith, pccga, driver_device, 0, "Zenith Data Systems", "SuperSport", 0) - -COMP( 198?, olivm15, ibm5150, 0, pccga, pccga, driver_device, 0, "Olivetti", "M15", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // is this a pc clone or not? - -COMP( 1983, ibm5550, ibm5150, 0, ibm5550, pccga, driver_device, 0, "International Business Machines", "IBM 5550", MACHINE_NOT_WORKING) - -COMP( 1985, pc7000, ibm5150, 0, pccga, pccga, driver_device, 0, "Sharp", "PC-7000", MACHINE_NOT_WORKING) - -COMP( 1988, sx16, ibm5150, 0, pccga, pccga, driver_device, 0, "Sanyo", "SX-16", MACHINE_NOT_WORKING) -COMP( 198?, mbc16, ibm5150, 0, pccga, pccga, driver_device, 0, "Sanyo", "MBC-16" , MACHINE_NOT_WORKING) - -COMP( 198?, ataripc3, ibm5150, 0, pccga, pccga, driver_device, 0, "Atari", "PC-3" , MACHINE_NOT_WORKING) -COMP( 1989, ssam88s, ibm5150, 0, pccga, pccga, driver_device, 0, "Samsung", "Samtron 88S" , MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/pc100.c b/src/mess/drivers/pc100.c deleted file mode 100644 index 5c23a8f1934..00000000000 --- a/src/mess/drivers/pc100.c +++ /dev/null @@ -1,520 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-100 - - preliminary driver by Angelo Salese - Thanks to Carl for the i8259 tip; - - TODO: - - floppy support (no images available right now); - - i8259 works in edge triggering mode, kludged to work somehow. - - Notes: - - First two POST checks are for the irqs, first one checks the timer irq: - F8209: B8 FB 00 mov ax,0FBh - F820C: E6 02 out 2h,al - F820E: B9 00 00 mov cx,0h - F8211: FB sti - F8212: 0A E4 or ah,ah <- irq fires here - F8214: E1 FC loopz 0F8212h - F8216: FA cli - F8217: 0A E9 or ch,cl - F8219: 74 15 je 0F8230h - - Second one is for the vblank irq timing: - F8238: 8B D3 mov dx,bx - F823A: 8B D9 mov bx,cx - F823C: CF iret - F824D: E4 02 in al,2h - F824F: 8A E0 mov ah,al - F8251: B0 EF mov al,0EFh - F8253: E6 02 out 2h,al - F8255: BB 00 00 mov bx,0h - F8258: BA 00 00 mov dx,0h - F825B: B9 20 4E mov cx,4E20h - F825E: FB sti - F825F: E2 FE loop 0F825Fh ;calculates the vblank here - F8261: FA cli - F8262: 8A C4 mov al,ah - F8264: E6 02 out 2h,al - F8266: 2B D3 sub dx,bx - F8268: 81 FA 58 1B cmp dx,1B58h - F826C: 78 06 js 0F8274h ;error if DX is smaller than 0x1b58 - F826E: 81 FA 40 1F cmp dx,1F40h - F8272: 78 0A js 0F827Eh ;error if DX is greater than 0x1f40 - F8274: B1 05 mov cl,5h - F8276: E8 CB 03 call 0F8644h - F8279: E8 79 FF call 0F81F5h - F827C: EB FE jmp 0F827Ch - F827E: B0 FF mov al,0FFh - fwiw with current timings, we get DX=0x1f09, enough for passing the test; - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "imagedev/flopdrv.h" -#include "formats/mfi_dsk.h" -#include "formats/d88_dsk.h" -#include "machine/i8255.h" -#include "machine/pic8259.h" -#include "machine/upd765.h" -#include "machine/msm58321.h" -#include "sound/beep.h" - -class pc100_state : public driver_device -{ -public: - pc100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_beeper(*this, "beeper"), - m_rtc(*this, "rtc"), - m_palette(*this, "palette"), - m_kanji_rom(*this, "kanji"), - m_vram(*this, "vram"), - m_rtc_portc(0) - { - } - - required_device m_maincpu; - required_device m_beeper; - required_device m_rtc; - required_device m_palette; - required_region_ptr m_kanji_rom; - required_region_ptr m_vram; - - DECLARE_READ16_MEMBER(pc100_vram_r); - DECLARE_WRITE16_MEMBER(pc100_vram_w); - DECLARE_READ16_MEMBER(pc100_kanji_r); - DECLARE_WRITE16_MEMBER(pc100_kanji_w); - DECLARE_READ8_MEMBER(pc100_key_r); - DECLARE_WRITE8_MEMBER(pc100_output_w); - DECLARE_WRITE8_MEMBER(pc100_tc_w); - DECLARE_READ8_MEMBER(pc100_shift_r); - DECLARE_WRITE8_MEMBER(pc100_shift_w); - DECLARE_READ8_MEMBER(pc100_vs_vreg_r); - DECLARE_WRITE8_MEMBER(pc100_vs_vreg_w); - DECLARE_WRITE8_MEMBER(pc100_crtc_addr_w); - DECLARE_WRITE8_MEMBER(pc100_crtc_data_w); - DECLARE_WRITE8_MEMBER(lower_mask_w); - DECLARE_WRITE8_MEMBER(upper_mask_w); - DECLARE_WRITE8_MEMBER(crtc_bank_w); - DECLARE_WRITE8_MEMBER(rtc_porta_w); - DECLARE_READ8_MEMBER(rtc_portc_r); - DECLARE_WRITE8_MEMBER(rtc_portc_w); - UINT16 m_kanji_addr; - UINT8 m_timer_mode; - - UINT8 m_bank_r,m_bank_w; - - struct{ - UINT8 shift; - UINT16 mask; - UINT16 vstart; - UINT8 addr; - UINT8 reg[8]; - }m_crtc; - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_pc100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(pc100_vblank_irq); - TIMER_DEVICE_CALLBACK_MEMBER(pc100_600hz_irq); - TIMER_DEVICE_CALLBACK_MEMBER(pc100_100hz_irq); - TIMER_DEVICE_CALLBACK_MEMBER(pc100_50hz_irq); - TIMER_DEVICE_CALLBACK_MEMBER(pc100_10hz_irq); - - - WRITE_LINE_MEMBER(rtc_portc_0_w) { m_rtc_portc = (m_rtc_portc & ~(1 << 0)) | ((state & 1) << 0); } - WRITE_LINE_MEMBER(rtc_portc_1_w) { m_rtc_portc = (m_rtc_portc & ~(1 << 1)) | ((state & 1) << 1); } - WRITE_LINE_MEMBER(rtc_portc_2_w) { m_rtc_portc = (m_rtc_portc & ~(1 << 2)) | ((state & 1) << 2); } - WRITE_LINE_MEMBER(rtc_portc_3_w) { m_rtc_portc = (m_rtc_portc & ~(1 << 3)) | ((state & 1) << 3); } - UINT8 m_rtc_portc; -}; - -void pc100_state::video_start() -{ -} - -UINT32 pc100_state::screen_update_pc100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - int count; - int xi; - int dot; - int pen[4],pen_i; - - count = ((m_crtc.vstart + 0x20) * 0x40); - - for(y=0;y<512;y++) - { - count &= 0xffff; - - for(x=0;x<1024/16;x++) - { - for(xi=0;xi<16;xi++) - { - for(pen_i=0;pen_i<4;pen_i++) - pen[pen_i] = (m_vram[count+pen_i*0x10000] >> xi) & 1; - - dot = 0; - for(pen_i=0;pen_i<4;pen_i++) - dot |= pen[pen_i]<pen(dot); - } - - count++; - } - } - - return 0; -} - -READ16_MEMBER( pc100_state::pc100_vram_r ) -{ - return m_vram[offset+m_bank_r*0x10000]; -} - -WRITE16_MEMBER( pc100_state::pc100_vram_w ) -{ - UINT16 old_vram; - int i; - - for(i=0;i<4;i++) - { - if((m_bank_w >> i) & 1) - { - old_vram = m_vram[offset+i*0x10000]; - COMBINE_DATA(&m_vram[offset+i*0x10000]); - m_vram[offset+i*0x10000] = ((m_vram[offset+i*0x10000]|(m_vram[offset+i*0x10000]<<16)) >> m_crtc.shift); - if(ACCESSING_BITS_0_15) - m_vram[offset+i*0x10000] = (m_vram[offset+i*0x10000] & ~m_crtc.mask) | (old_vram & m_crtc.mask); - else if(ACCESSING_BITS_8_15) - m_vram[offset+i*0x10000] = (m_vram[offset+i*0x10000] & ((~m_crtc.mask) & 0xff00)) | (old_vram & (m_crtc.mask|0xff)); - else if(ACCESSING_BITS_0_7) - m_vram[offset+i*0x10000] = (m_vram[offset+i*0x10000] & ((~m_crtc.mask) & 0xff)) | (old_vram & (m_crtc.mask|0xff00)); - - } - } -} - -static ADDRESS_MAP_START(pc100_map, AS_PROGRAM, 16, pc100_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0xbffff) AM_RAM // work ram - AM_RANGE(0xc0000,0xdffff) AM_READWRITE(pc100_vram_r,pc100_vram_w) // vram, blitter based! - AM_RANGE(0xf8000,0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -READ16_MEMBER( pc100_state::pc100_kanji_r ) -{ - return m_kanji_rom[m_kanji_addr]; -} - - -WRITE16_MEMBER( pc100_state::pc100_kanji_w ) -{ - COMBINE_DATA(&m_kanji_addr); -} - -READ8_MEMBER( pc100_state::pc100_key_r ) -{ - if(offset) - return ioport("DSW")->read(); // bit 5: horizontal/vertical monitor dsw - - return 0; -} - -WRITE8_MEMBER( pc100_state::pc100_output_w ) -{ - if(offset == 0) - { - m_timer_mode = (data & 0x18) >> 3; - m_beeper->set_state(((data & 0x40) >> 6) ^ 1); - printf("%02x\n",data & 0xc0); - } -} - -WRITE8_MEMBER( pc100_state::pc100_tc_w ) -{ - machine().device("upd765")->tc_w(data & 0x40); -} - -READ8_MEMBER( pc100_state::pc100_shift_r ) -{ - return m_crtc.shift; -} - -WRITE8_MEMBER( pc100_state::pc100_shift_w ) -{ - m_crtc.shift = data & 0xf; -} - -READ8_MEMBER( pc100_state::pc100_vs_vreg_r ) -{ - if(offset) - return m_crtc.vstart >> 8; - - return m_crtc.vstart & 0xff; -} - -WRITE8_MEMBER( pc100_state::pc100_vs_vreg_w ) -{ - if(offset) - m_crtc.vstart = (m_crtc.vstart & 0xff) | (data << 8); - else - m_crtc.vstart = (m_crtc.vstart & 0xff00) | (data & 0xff); -} - -WRITE8_MEMBER( pc100_state::pc100_crtc_addr_w ) -{ - m_crtc.addr = data & 7; -} - -WRITE8_MEMBER( pc100_state::pc100_crtc_data_w ) -{ - m_crtc.reg[m_crtc.addr] = data; - printf("%02x %02x\n",m_crtc.addr,data); -} - - -/* everything is 8-bit bus wide */ -static ADDRESS_MAP_START(pc100_io, AS_IO, 16, pc100_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) // i8259 -// AM_RANGE(0x04, 0x07) i8237? - AM_RANGE(0x08, 0x0b) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff ) // upd765 - AM_RANGE(0x10, 0x17) AM_DEVREADWRITE8("ppi8255_1", i8255_device, read, write,0x00ff) // i8255 #1 - AM_RANGE(0x18, 0x1f) AM_DEVREADWRITE8("ppi8255_2", i8255_device, read, write,0x00ff) // i8255 #2 - AM_RANGE(0x20, 0x23) AM_READ8(pc100_key_r,0x00ff) //i/o, keyboard, mouse - AM_RANGE(0x22, 0x23) AM_WRITE8(pc100_output_w,0x00ff) //i/o, keyboard, mouse - AM_RANGE(0x24, 0x25) AM_WRITE8(pc100_tc_w,0x00ff) //i/o, keyboard, mouse -// AM_RANGE(0x28, 0x2b) i8251 - AM_RANGE(0x30, 0x31) AM_READWRITE8(pc100_shift_r,pc100_shift_w,0x00ff) // crtc shift - AM_RANGE(0x38, 0x39) AM_WRITE8(pc100_crtc_addr_w,0x00ff) //crtc address reg - AM_RANGE(0x3a, 0x3b) AM_WRITE8(pc100_crtc_data_w,0x00ff) //crtc data reg - AM_RANGE(0x3c, 0x3f) AM_READWRITE8(pc100_vs_vreg_r,pc100_vs_vreg_w,0x00ff) //crtc vertical start position - AM_RANGE(0x40, 0x5f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") -// AM_RANGE(0x60, 0x61) crtc command (16-bit wide) - AM_RANGE(0x80, 0x81) AM_READWRITE(pc100_kanji_r,pc100_kanji_w) - AM_RANGE(0x82, 0x83) AM_WRITENOP //kanji-related? - AM_RANGE(0x84, 0x87) AM_WRITENOP //kanji "strobe" signal 0/1 -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( pc100 ) - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x01, "DSW" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Monitor" ) - PORT_DIPSETTING( 0x20, "Horizontal" ) - PORT_DIPSETTING( 0x00, "Vertical" ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -static const gfx_layout kanji_layout = -{ - 16, 16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8 }, - { STEP16(0,16) }, - 16*16 -}; - -static GFXDECODE_START( pc100 ) - GFXDECODE_ENTRY( "kanji", 0x0000, kanji_layout, 8, 1 ) -GFXDECODE_END - -/* TODO: untested */ -WRITE8_MEMBER( pc100_state::rtc_porta_w ) -{ -/* - ---- -x-- chip select - ---- --x- read - ---- ---x write -*/ - - m_rtc->write_w((data >> 0) & 1); - m_rtc->read_w((data >> 1) & 1); - m_rtc->cs1_w((data >> 2) & 1); -} - -WRITE8_MEMBER( pc100_state::rtc_portc_w ) -{ - m_rtc->d0_w((data >> 0) & 1); - m_rtc->d1_w((data >> 1) & 1); - m_rtc->d2_w((data >> 2) & 1); - m_rtc->d3_w((data >> 3) & 1); -} - -READ8_MEMBER( pc100_state::rtc_portc_r ) -{ - return m_rtc_portc; -} - -WRITE8_MEMBER( pc100_state::lower_mask_w ) -{ - m_crtc.mask = (m_crtc.mask & 0xff00) | data; -} - -WRITE8_MEMBER( pc100_state::upper_mask_w ) -{ - m_crtc.mask = (m_crtc.mask & 0xff) | (data << 8); -} - -WRITE8_MEMBER( pc100_state::crtc_bank_w ) -{ - m_bank_w = data & 0xf; - m_bank_r = (data & 0x30) >> 4; -} - -void pc100_state::machine_start() -{ -} - -void pc100_state::machine_reset() -{ - m_beeper->set_frequency(2400); - m_beeper->set_state(0); -} - -INTERRUPT_GEN_MEMBER(pc100_state::pc100_vblank_irq) -{ - machine().device("pic8259")->ir4_w(0); - machine().device("pic8259")->ir4_w(1); -} - -TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_600hz_irq) -{ - if(m_timer_mode == 0) - { - machine().device("pic8259")->ir2_w(0); - machine().device("pic8259")->ir2_w(1); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_100hz_irq) -{ - if(m_timer_mode == 1) - { - machine().device("pic8259")->ir2_w(0); - machine().device("pic8259")->ir2_w(1); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_50hz_irq) -{ - if(m_timer_mode == 2) - { - machine().device("pic8259")->ir2_w(0); - machine().device("pic8259")->ir2_w(1); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_10hz_irq) -{ - if(m_timer_mode == 3) - { - machine().device("pic8259")->ir2_w(0); - machine().device("pic8259")->ir2_w(1); - } -} - -static SLOT_INTERFACE_START( pc100_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -#define MASTER_CLOCK 6988800 - -static MACHINE_CONFIG_START( pc100, pc100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, MASTER_CLOCK) - MCFG_CPU_PROGRAM_MAP(pc100_map) - MCFG_CPU_IO_MAP(pc100_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc100_state, pc100_vblank_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("600hz", pc100_state, pc100_600hz_irq, attotime::from_hz(MASTER_CLOCK/600)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("100hz", pc100_state, pc100_100hz_irq, attotime::from_hz(MASTER_CLOCK/100)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("50hz", pc100_state, pc100_50hz_irq, attotime::from_hz(MASTER_CLOCK/50)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("10hz", pc100_state, pc100_10hz_irq, attotime::from_hz(MASTER_CLOCK/10)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pc100_state, rtc_porta_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pc100_state, rtc_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc100_state, rtc_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pc100_state, lower_mask_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pc100_state, upper_mask_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc100_state, crtc_bank_w)) - - MCFG_PIC8259_ADD( "pic8259", INPUTLINE("maincpu", 0), GND, NULL ) - - MCFG_UPD765A_ADD("upd765", true, true) - - MCFG_DEVICE_ADD("rtc", MSM58321, XTAL_32_768kHz) - MCFG_MSM58321_D0_HANDLER(WRITELINE(pc100_state, rtc_portc_0_w)) - MCFG_MSM58321_D1_HANDLER(WRITELINE(pc100_state, rtc_portc_1_w)) - MCFG_MSM58321_D2_HANDLER(WRITELINE(pc100_state, rtc_portc_2_w)) - MCFG_MSM58321_D3_HANDLER(WRITELINE(pc100_state, rtc_portc_3_w)) - - MCFG_FLOPPY_DRIVE_ADD("upd765:0", pc100_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", pc100_floppies, "525hd", floppy_image_device::default_floppy_formats) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - /* TODO: Unknown Pixel Clock and CRTC is dynamic */ - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK*4, 1024, 0, 768, 264*2, 0, 512) - MCFG_SCREEN_UPDATE_DRIVER(pc100_state, screen_update_pc100) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc100) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_FORMAT(xxxxxxxBBBGGGRRR) - - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pc100 ) - ROM_REGION16_LE( 0x8000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x8000, CRC(fd54a80e) SHA1(605a1b598e623ba2908a14a82454b9d32ea3c331)) - - ROM_REGION16_LE( 0x20000, "kanji", ROMREGION_ERASEFF ) - ROM_LOAD( "kanji.rom", 0x0000, 0x20000, BAD_DUMP CRC(29298591) SHA1(d10174553ceea556fc53fc4e685d939524a4f64b)) - - ROM_REGION16_LE( 0x20000*4, "vram", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, pc100, 0, 0, pc100, pc100, driver_device, 0, "NEC", "PC-100", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/pc1500.c b/src/mess/drivers/pc1500.c deleted file mode 100644 index 6f91939c9c5..00000000000 --- a/src/mess/drivers/pc1500.c +++ /dev/null @@ -1,298 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Sharp pocket computers 1500 - - Driver by Sandro Ronco - - More info: - http://www.pc1500.com/ - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/lh5801/lh5801.h" -#include "machine/lh5810.h" -#include "machine/upd1990a.h" -#include "pc1500.lh" - - -class pc1500_state : public driver_device -{ -public: - pc1500_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_rtc(*this, "upd1990a"), - m_lcd_data(*this, "lcd_data"), - m_keyboard(*this, "KEY"), - m_io_on(*this, "ON") { } - - required_device m_maincpu; - required_device m_rtc; - - required_shared_ptr m_lcd_data; - required_ioport_array<8> m_keyboard; - required_ioport m_io_on; - - UINT8 m_kb_matrix; - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( kb_matrix_w ); - DECLARE_READ8_MEMBER( port_a_r ); - DECLARE_READ8_MEMBER( port_b_r ); - DECLARE_WRITE8_MEMBER( port_c_w ); - - DECLARE_READ8_MEMBER( pc1500_kb_r ); - DECLARE_PALETTE_INIT(pc1500); -}; - -static ADDRESS_MAP_START( pc1500_mem , AS_PROGRAM, 8, pc1500_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x3fff) AM_ROM //module ROM/RAM - AM_RANGE( 0x4000, 0x47ff) AM_RAM //user RAM - AM_RANGE( 0x4800, 0x6fff) AM_RAM //expansion RAM - AM_RANGE( 0x7000, 0x71ff) AM_RAM AM_MIRROR(0x0600) AM_SHARE("lcd_data") - AM_RANGE( 0x7800, 0x7bff) AM_RAM AM_REGION("maincpu", 0x7800) AM_MIRROR(0x0400) - AM_RANGE( 0xa000, 0xbfff) AM_ROM //expansion ROM - AM_RANGE( 0xc000, 0xffff) AM_ROM //system ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1500_mem_io , AS_IO, 8, pc1500_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0xf000, 0xf00f) AM_DEVREADWRITE("lh5810", lh5810_device, data_r, data_w) -ADDRESS_MAP_END - -READ8_MEMBER( pc1500_state::pc1500_kb_r ) -{ - UINT8 data = 0xff; - - if (!started()) return 0; - - for (int i = 0; i < 8; i++) - { - if (!BIT(m_kb_matrix, i)) - data &= m_keyboard[i]->read(); - } - - return data; -} - -UINT32 pc1500_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0, cliprect); - - for (int p=0; p<=1; p++) - for (int a=0; a<0x4e; a++) - { - UINT8 data = m_lcd_data[a + (p<<8)]; - for (int b=0; b<8; b++) - { - if(b<4) - bitmap.pix16(b + 4 * (BIT( a, 0)), (a>>1) + 0x00 + 0x27*p) = BIT(data, b); - else - bitmap.pix16(b - 4 * (BIT(~a, 0)), (a>>1) + 0x4e + 0x27*p) = BIT(data, b); - } - } - - output_set_value("BUSY", BIT(m_lcd_data[0x4e], 0)); - output_set_value("SHIFT", BIT(m_lcd_data[0x4e], 1)); - output_set_value("SML", BIT(m_lcd_data[0x4e], 2)); - output_set_value("SMALL", BIT(m_lcd_data[0x4e], 3)); - output_set_value("III", BIT(m_lcd_data[0x4e], 4)); - output_set_value("II", BIT(m_lcd_data[0x4e], 5)); - output_set_value("I", BIT(m_lcd_data[0x4e], 6)); - output_set_value("DEF", BIT(m_lcd_data[0x4e], 7)); - output_set_value("DE", BIT(m_lcd_data[0x4f], 0)); - output_set_value("G", BIT(m_lcd_data[0x4f], 1)); - output_set_value("RAD", BIT(m_lcd_data[0x4f], 2)); - output_set_value("RESERVE", BIT(m_lcd_data[0x4f], 4)); - output_set_value("PRO", BIT(m_lcd_data[0x4f], 5)); - output_set_value("RUN", BIT(m_lcd_data[0x4f], 6)); - - return 0; -} - -void pc1500_state::machine_reset() -{ - m_kb_matrix = 0xff; - m_rtc->cs_w(1); -} - -static INPUT_PORTS_START( pc1500 ) - - PORT_START("ON") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) - - PORT_START("KEY.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - - PORT_START("KEY.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_X) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ST") PORT_CODE(KEYCODE_F8) - - PORT_START("KEY.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - - PORT_START("KEY.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - - PORT_START("KEY.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RCL") PORT_CODE(KEYCODE_F7) - - PORT_START("KEY.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) - - PORT_START("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SML") PORT_CODE(KEYCODE_PGDN) - - PORT_START("KEY.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) -INPUT_PORTS_END - - -WRITE8_MEMBER( pc1500_state::kb_matrix_w ) -{ - m_kb_matrix = data; -} - -WRITE8_MEMBER( pc1500_state::port_c_w ) -{ - m_rtc->data_in_w(BIT(data, 0)); - m_rtc->stb_w(BIT(data, 1)); - m_rtc->clk_w(BIT(data, 2)); - m_rtc->oe_w(BIT(data, 3)); - m_rtc->c0_w(BIT(data, 3)); - m_rtc->c1_w(BIT(data, 4)); - m_rtc->c2_w(BIT(data, 5)); -} - -READ8_MEMBER( pc1500_state::port_b_r ) -{ - /* - x--- ---- ON/Break key - -xx- ---- upd1990ac - ---x ---- GND - ---- x--- Japan: GND, export: VCC - ---- -x-- cassette in - ---- --xx connector - */ - UINT8 data = 0; - - data |= 0x08; - - data |= (m_rtc->tp_r()<<5); - data |= (m_rtc->data_out_r()<<6); - data |= (m_io_on->read()<<7); - - return data; -} - -READ8_MEMBER( pc1500_state::port_a_r ) -{ - return 0xff; -} - -PALETTE_INIT_MEMBER(pc1500_state, pc1500) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static MACHINE_CONFIG_START( pc1500, pc1500_state ) - MCFG_CPU_ADD("maincpu", LH5801, 1300000) //1.3 MHz - MCFG_CPU_PROGRAM_MAP( pc1500_mem ) - MCFG_CPU_IO_MAP( pc1500_mem_io ) - MCFG_LH5801_IN(READ8(pc1500_state,pc1500_kb_r)) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_UPDATE_DRIVER(pc1500_state, screen_update) - MCFG_SCREEN_SIZE(156, 8) - MCFG_SCREEN_VISIBLE_AREA(0, 156-1, 0, 7-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_pc1500) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pc1500_state, pc1500) - - MCFG_DEVICE_ADD("lh5810", LH5810, 0) - MCFG_LH5810_PORTA_R_CB(READ8(pc1500_state, port_a_r)) - MCFG_LH5810_PORTA_W_CB(WRITE8(pc1500_state, kb_matrix_w)) - MCFG_LH5810_PORTB_R_CB(READ8(pc1500_state, port_b_r)) - MCFG_LH5810_PORTC_W_CB(WRITE8(pc1500_state, port_c_w)) - MCFG_LH5810_OUT_INT_CB(INPUTLINE("maincpu", LH5801_LINE_MI)) - - MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL) -MACHINE_CONFIG_END - - -ROM_START( pc1500 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "sys1500.rom", 0xc000, 0x4000, CRC(d480b50d) SHA1(4bf748ba4d7c2b7cd7da7f3fdefcdd2e4cd41c4e)) - ROM_REGION( 0x10000, "ce150", ROMREGION_ERASEFF ) - ROM_LOAD( "ce-150.rom", 0x0000, 0x2000, CRC(8fa1df6d) SHA1(a3aa02a641a46c27c0d4c0dc025b0dbe9b5b79c8)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 198?, pc1500, 0, 0, pc1500, pc1500, driver_device, 0, "Sharp", "Pocket Computer 1500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/pc1512.c b/src/mess/drivers/pc1512.c deleted file mode 100644 index 3c8ba9d2bb9..00000000000 --- a/src/mess/drivers/pc1512.c +++ /dev/null @@ -1,1514 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Amstrad PC1512 - - http://www.seasip.info/AmstradXT - http://stason.org/TULARC/pc/hard-drives-hdd/tandon/TM262-21MB-5-25-HH-MFM-ST506.html - -*/ - -/* - - TODO: - - - adjust mouse speed - - pc1512 V3 VDU check fails - - Amstrad SM2400 internal modem - - Amstrad RP4 diagnostic ISA card (PC1512) - - Amstrad RP5-2 diagnostic ISA card (PC1640) - - 40291/8908 B ROM on PC1640 HD30 controller card - -*/ - -/* -HARD DISC INSTALLATION INSTRUCTIONS - -Applies to both ten and twenty megabyte versions. - -1. Turn on machine -2. Insert disc 1 (the red disc) and press a key. -3. Type fdisk (RETURN) -4. At each prompt press the RETURN key (another three times). -5. The A> will now appear so now type format c:/s (RETURN). -6. Now push the Y key (RETURN). -7. The hard disc will now begin to format, if you have a 10Mb machine then it will count up to 305 - cylinders. If you have a 20 Mb machine then 610 cylinders will be counted. -8. Once this is done, take out disc 1 and insert disc 5 (the maroon disc). -9. Now type config(RETURN). This procedure will copy all five discs (order 5,1,2,3,4) onto the hard disc. - Once finished the screen will show some information about the size of the disc and the number of files and - directories present. -10. To now use the hard disc remove the floppy disc from the drive and store in a safe place with the other - four discs then restart the computer by pushing Alt Ctrl and Del. -11. After a short while the AMSTRAD PC info will come up and tell you when the machine was last used - and then after a little longer the screen will clear and will display this message, - -F1=DOSPLUS.SYS -F2=DOS.SYS - -Select operating system: - -If you choose F1 then DOS Plus and GEM will be booted, or if you press F2 then MS-DOS will be booted. -*/ - -/* -HARD DISC INSTALLATION ON PC1640 - -PC1640 hard disc comes ready installed with the necessary software. That is discs 1 to 4 that are -supplied ready with the machine. - -Howevere in the case of a disc failure it may be necessary to reinstall the supplied software. - -This is done in the following way: -1. Put disc one into drive A: and boot up the system -2. Put disc four into drive A: and type CD\SUPPLEME and press return. -3. Type HDFORMAT and press return. -4. Answer YES to the screen prompt. -5. When HDFORMAT is completed remove disc four and replace with disc one. -6. Type CD\ and press return. -7. Type FDISC and press return. -8. Press return key every time you are asked a question. -9. With disc one still in drive A: type FORMAT C:/S and press return. -10. When formatting is finished replace disc one with disc four. -11. Type CD\SUPPLEME and press return. -12. Type CONFIG and press return. - -After typing CONFIG the machine will proceed to copy the four system discs to the hard disc. -After copying each disc you will be prompted to insert the next disc. -You do not noeed to know in which order to insert the discs because the machine will tell you which disc is -needed next. - -The system is now installed and should be tested by rebooting the machine. - -It should be noted that if the hard disc is ok but the software has been corrupted or deleted you can -reinstall the software without reformatting. -This is done by following steps 11 and 12. -*/ - -#include "includes/pc1512.h" -#include "bus/rs232/rs232.h" -#include "bus/isa/ega.h" - - - -//************************************************************************** -// SYSTEM STATUS REGISTER -//************************************************************************** - -//------------------------------------------------- -// system_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_state::system_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0: - if (BIT(m_port61, 7)) - { - /* - - bit description - - 0 1 - 1 8087 NDP installed - 2 1 - 3 1 - 4 DDM0 - 5 DDM1 - 6 second floppy disk drive installed - 7 0 - - */ - - data = m_status1; - } - else - { - data = m_kbd; - m_kb_bits = 0; - m_kb->data_w(1); - m_pic->ir1_w(CLEAR_LINE); - } - break; - - case 1: - data = m_port61; - break; - - case 2: - /* - - bit description - - 0 RAM0 / RAM4 - 1 RAM1 - 2 RAM2 - 3 RAM3 - 4 undefined - 5 8253 PIT OUT2 output - 6 external parity error (I/OCHCK from expansion bus) - 7 on-board system RAM parity error - - */ - - if (BIT(m_port61, 2)) - data = m_status2 & 0x0f; - else - data = m_status2 >> 4; - - data |= m_pit2 << 5; - break; - } - - return data; -} - - -//------------------------------------------------- -// system_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_state::system_w ) -{ - switch (offset) - { - case 1: - /* - - bit description - - 0 8253 GATE 2 (speaker modulate) - 1 speaker drive - 2 enable port C LSB / disable MSB - 3 undefined - 4 disable parity checking of on-board RAM - 5 prevent external parity errors from causing NMI - 6 enable incoming Keyboard Clock - 7 enable Status-1/Disable Keyboard Code on Port A - - */ - - m_port61 = data; - - m_pit->write_gate2(BIT(data, 0)); - - m_speaker_drive = BIT(data, 1); - update_speaker(); - - m_kb->clock_w(BIT(data, 6)); - break; - - case 4: - /* - - bit description - - 0 - 1 PA1 - 8087 NDP installed - 2 - 3 - 4 PA4 - DDM0 - 5 PA5 - DDM1 - 6 PA6 - Second Floppy disk drive installed - 7 - - */ - - if (BIT(data, 7)) - m_status1 = data ^ 0x8d; - else - m_status1 = data; - break; - - case 5: - /* - - bit description - - 0 PC0 (LSB) - RAM0 - 1 PC1 (LSB) - RAM1 - 2 PC2 (LSB) - RAM2 - 3 PC3 (LSB) - RAM3 - 4 PC0 (MSB) - RAM4 - 5 PC1 (MSB) - Undefined - 6 PC2 (MSB) - Undefined - 7 PC3 (MSB) - Undefined - - */ - - m_status2 = data; - break; - - case 6: - machine_reset(); - break; - } -} - - - -//************************************************************************** -// MOUSE -//************************************************************************** - -//------------------------------------------------- -// mouse_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_state::mouse_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0: - data = m_mouse_x; - break; - - case 2: - data = m_mouse_y; - break; - } - - return data; -} - - -//------------------------------------------------- -// mouse_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_state::mouse_w ) -{ - switch (offset) - { - case 0: - m_mouse_x = 0; - break; - - case 2: - m_mouse_y = 0; - break; - } -} - - - -//************************************************************************** -// DIRECT MEMORY ACCESS -//************************************************************************** - -//------------------------------------------------- -// dma_page_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_state::dma_page_w ) -{ - /* - - bit description - - 0 Address bit A16 - 1 Address bit A17 - 2 Address bit A18 - 3 Address bit A19 - 4 - 5 - 6 - 7 - - */ - - switch (offset) - { - case 1: - m_dma_page[2] = data & 0x0f; - break; - - case 2: - m_dma_page[3] = data & 0x0f; - break; - - case 3: - m_dma_page[0] = m_dma_page[1] = data & 0x0f; - break; - } -} - - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// nmi_mask_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_state::nmi_mask_w ) -{ - m_nmi_enable = BIT(data, 7); -} - - - -//************************************************************************** -// PRINTER -//************************************************************************** - -//------------------------------------------------- -// printer_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_state::printer_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0: - data = m_printer_data; - break; - - case 1: - /* - - bit description - - 0 LK1 fitted - 1 LK2 fitted - 2 LK3 fitted - 3 printer error - 4 printer selected - 5 paper out - 6 printer acknowledge - 7 printer busy - - */ - - data |= m_lk->read() & 0x07; - - data |= m_centronics_fault << 3; - data |= m_centronics_select << 4; - data |= m_centronics_perror << 5; - data |= m_centronics_ack << 6; - data |= m_centronics_busy << 7; - break; - - case 2: - /* - - bit description - - 0 Data Strobe - 1 Select Auto Feed - 2 Reset Printer - 3 Select Printer - 4 Enable Int on ACK - 5 1 - 6 - 7 - - */ - - data = m_printer_control | 0x20; - break; - } - - return data; -} - - -//------------------------------------------------- -// printer_r - -//------------------------------------------------- - -READ8_MEMBER( pc1640_state::printer_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 2: - /* - - bit description - - 0 Data Strobe - 1 Select Auto Feed - 2 Reset Printer - 3 Select Printer - 4 Enable Int on ACK - 5 OPT - 6 SW6 - 7 SW7 - - */ - - /* - Bit D5 is the option (OPT) bit and can return one of three different pieces of - information. Although not documented as such on the PC1512, Bit D5 was always a - "1", however on the PC1640 it will always be a zero if immediately prior to the - read of channel 037Ah the software performs an I/O read of an I/O channel - implemented on the PC1512 main board, having address line A7 high (for example, - the CGA channels). This is a simple test for software to detect whether it is - running on a PC1512 or a PC1640. A PC1512 will give a 1, whereas a PC1640 will - give a 0. - - In addition to being a test of machine type the OPT bit, D5, can also reflect - the state of either SW9 or SW10. The OPT bit will reflect the state of switch - SW9 by an I/O read operation to an I/O channel not implemented on the main - board and having address lines A14 and A7 both low (for example channel 0278h) - immediately prior to the reading of channel 037Ah. The OPT bit is set to the - state of switch SW10 by an I/O read operation to an I/O channel not implemented - on the main board having address lines A14 high and A7 low (for example channel - 4278h). Software testing OPT bit should disable interrupts before the initial - (dummy) channel read and the I/O read of channel 037A in order to avoid - additional (interrupt based) I/O operations between the setting and the testing - of the information read back in the OPT bit. For switches SW9 and SW10, a logic - "1" is returned when the switch is on the "on" position and a logic "0" if the - switch is in the "off" position. - */ - data = m_printer_control; - data |= m_opt << 5; - data |= (m_sw->read() & 0x60) << 1; - break; - - default: - data = pc1512_state::printer_r(space, offset); - break; - } - - return data; -} - - -//------------------------------------------------- -// printer_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_state::printer_w ) -{ - switch (offset) - { - case 0: - m_printer_data = data; - m_cent_data_out->write(space, 0, data); - break; - - case 2: - /* - - bit description - - 0 Data Strobe - 1 Select Auto Feed - 2 Reset Printer - 3 Select Printer - 4 Enable Int on ACK - 5 - 6 - 7 - - */ - - m_printer_control = data & 0x1f; - - m_centronics->write_strobe(BIT(data, 0)); - m_centronics->write_autofd(BIT(data, 1)); - m_centronics->write_init(BIT(data, 2)); - - m_ack_int_enable = BIT(data, 4); - update_ack(); - break; - } -} - - -//************************************************************************** -// PC1640 I/O ACCESS -//************************************************************************** - -//------------------------------------------------- -// io_r - -//------------------------------------------------- - -READ8_MEMBER( pc1640_state::io_r ) -{ - UINT8 data = 0; - offs_t addr = offset & 0x3ff; - bool decoded = false; - - if ( addr <= 0x00f) { data = m_dmac->read(space, offset & 0x0f); decoded = true; } - else if (addr >= 0x020 && addr <= 0x021) { data = m_pic->read(space, offset & 0x01); decoded = true; } - else if (addr >= 0x040 && addr <= 0x043) { data = m_pit->read(space, offset & 0x03); decoded = true; } - else if (addr >= 0x060 && addr <= 0x06f) { data = system_r(space, offset & 0x0f); decoded = true; } - else if (addr >= 0x070 && addr <= 0x073) { data = m_rtc->read(space, offset & 0x01); decoded = true; } - else if (addr >= 0x078 && addr <= 0x07f) { data = mouse_r(space, offset & 0x07); decoded = true; } - else if (addr >= 0x378 && addr <= 0x37b) { data = printer_r(space, offset & 0x03); decoded = true; } - else if (addr >= 0x3b0 && addr <= 0x3df) { decoded = true; } - else if (addr >= 0x3f4 && addr <= 0x3f4) { data = m_fdc->fdc->msr_r(space, offset & 0x01); decoded = true; } - else if (addr >= 0x3f5 && addr <= 0x3f5) { data = m_fdc->fdc->fifo_r(space, offset & 0x01); decoded = true; } - else if (addr >= 0x3f8 && addr <= 0x3ff) { data = m_uart->ins8250_r(space, offset & 0x07); decoded = true; } - - if (decoded) - { - if (BIT(offset, 7)) - { - m_opt = 0; - //logerror("OPT 0\n"); - } - } - else if (!BIT(offset, 7)) - { - UINT16 sw = m_sw->read(); - - if (!BIT(offset, 14)) - { - m_opt = BIT(sw, 8); - logerror("OPT SW9 %u\n", m_opt); - } - else - { - m_opt = BIT(sw, 9); - logerror("OPT SW10 %u\n", m_opt); - } - } - - return data; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( pc1512_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( pc1512_mem, AS_PROGRAM, 16, pc1512_state ) - AM_RANGE(0x00000, 0x9ffff) AM_RAM - AM_RANGE(0xb8000, 0xbbfff) AM_READWRITE8(video_ram_r, video_ram_w, 0xffff) - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( pc1512_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( pc1512_io, AS_IO, 16, pc1512_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3ff) - AM_RANGE(0x000, 0x00f) AM_DEVREADWRITE8(I8237A5_TAG, am9517a_device, read, write, 0xffff) - AM_RANGE(0x020, 0x021) AM_DEVREADWRITE8(I8259A2_TAG, pic8259_device, read, write, 0xffff) - AM_RANGE(0x040, 0x043) AM_DEVREADWRITE8(I8253_TAG, pit8253_device, read, write, 0xffff) - AM_RANGE(0x060, 0x06f) AM_READWRITE8(system_r, system_w, 0xffff) - AM_RANGE(0x070, 0x071) AM_MIRROR(0x02) AM_DEVREADWRITE8(MC146818_TAG, mc146818_device, read, write, 0xffff) - AM_RANGE(0x078, 0x07f) AM_READWRITE8(mouse_r, mouse_w, 0xffff) - AM_RANGE(0x080, 0x083) AM_WRITE8(dma_page_w, 0xffff) - AM_RANGE(0x0a0, 0x0a1) AM_WRITE8(nmi_mask_w, 0xff00) - AM_RANGE(0x378, 0x37b) AM_READWRITE8(printer_r, printer_w, 0xffff) - AM_RANGE(0x3d0, 0x3df) AM_READWRITE8(vdu_r, vdu_w, 0xffff) - AM_RANGE(0x3f0, 0x3f7) AM_DEVICE8(PC_FDC_XT_TAG, pc_fdc_xt_device, map, 0xffff) - AM_RANGE(0x3f8, 0x3ff) AM_DEVREADWRITE8(INS8250_TAG, ins8250_device, ins8250_r, ins8250_w, 0xffff) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( pc1640_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( pc1640_mem, AS_PROGRAM, 16, pc1640_state ) - AM_RANGE(0x00000, 0x9ffff) AM_RAM - AM_RANGE(0xf0000, 0xf3fff) AM_MIRROR(0xc000) AM_ROM AM_REGION(I8086_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( pc1640_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( pc1640_io, AS_IO, 16, pc1640_state ) - AM_RANGE(0x0000, 0xffff) AM_READ8(io_r, 0xffff) - - AM_RANGE(0x000, 0x00f) AM_DEVWRITE8(I8237A5_TAG, am9517a_device, write, 0xffff) - AM_RANGE(0x020, 0x021) AM_DEVWRITE8(I8259A2_TAG, pic8259_device, write, 0xffff) - AM_RANGE(0x040, 0x043) AM_DEVWRITE8(I8253_TAG, pit8253_device, write, 0xffff) - AM_RANGE(0x060, 0x06f) AM_WRITE8(system_w, 0xffff) - AM_RANGE(0x070, 0x071) AM_MIRROR(0x02) AM_DEVWRITE8(MC146818_TAG, mc146818_device, write, 0xffff) - AM_RANGE(0x078, 0x07f) AM_WRITE8(mouse_w, 0xffff) - AM_RANGE(0x080, 0x083) AM_WRITE8(dma_page_w, 0xffff) - AM_RANGE(0x0a0, 0x0a1) AM_WRITE8(nmi_mask_w, 0xff00) - AM_RANGE(0x378, 0x37b) AM_WRITE8(printer_w, 0xffff) - AM_RANGE(0x3f2, 0x3f3) AM_DEVWRITE8(PC_FDC_XT_TAG, pc_fdc_xt_device, dor_w, 0x00ff) - AM_RANGE(0x3f4, 0x3f5) AM_DEVWRITE8(PC_FDC_XT_TAG ":upd765", upd765_family_device, fifo_w, 0xff00) - AM_RANGE(0x3f8, 0x3ff) AM_DEVWRITE8(INS8250_TAG, ins8250_device, ins8250_w, 0xffff) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_CHANGED_MEMBER( mouse_button_1_changed ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( pc1512_state::mouse_button_1_changed ) -{ - m_kb->m1_w(newval); -} - - -//------------------------------------------------- -// INPUT_CHANGED_MEMBER( mouse_button_2_changed ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( pc1512_state::mouse_button_2_changed ) -{ - m_kb->m2_w(newval); -} - - -//------------------------------------------------- -// INPUT_CHANGED_MEMBER( mouse_x_changed ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( pc1512_state::mouse_x_changed ) -{ - if (newval > oldval) - m_mouse_x++; - else - m_mouse_x--; -} - - -//------------------------------------------------- -// INPUT_CHANGED_MEMBER( mouse_y_changed ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( pc1512_state::mouse_y_changed ) -{ - if (newval > oldval) - m_mouse_y--; - else - m_mouse_y++; -} - - -//------------------------------------------------- -// INPUT_PORTS( mouse ) -//------------------------------------------------- - -static INPUT_PORTS_START( mouse ) - PORT_START("MOUSEB") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("Left Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF, pc1512_state, mouse_button_1_changed, 0) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("Right Mouse Button") PORT_CODE(MOUSECODE_BUTTON2) PORT_CHANGED_MEMBER(DEVICE_SELF, pc1512_state, mouse_button_2_changed, 0) - - PORT_START("MOUSEX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, pc1512_state, mouse_x_changed, 0) - - PORT_START("MOUSEY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, pc1512_state, mouse_y_changed, 0) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( pc1512 ) -//------------------------------------------------- - -static INPUT_PORTS_START( pc1512 ) - PORT_INCLUDE( mouse ) - - PORT_START("LK") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Language ) ) - PORT_DIPSETTING( 0x07, DEF_STR( English ) ) - PORT_DIPSETTING( 0x06, DEF_STR( German ) ) - PORT_DIPSETTING( 0x05, DEF_STR( French ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Spanish ) ) - PORT_DIPSETTING( 0x03, "Danish" ) - PORT_DIPSETTING( 0x02, "Swedish" ) - PORT_DIPSETTING( 0x01, DEF_STR( Italian ) ) - PORT_DIPSETTING( 0x00, "Diagnostic Mode" ) - PORT_DIPNAME( 0x08, 0x08, "Memory Size") - PORT_DIPSETTING( 0x08, "512 KB" ) - PORT_DIPSETTING( 0x00, "640 KB" ) - PORT_DIPNAME( 0x10, 0x10, "ROM Size") - PORT_DIPSETTING( 0x10, "16 KB" ) - PORT_DIPSETTING( 0x00, "32 KB" ) - PORT_DIPNAME( 0x60, 0x60, "Character Set") - PORT_DIPSETTING( 0x60, "Default (Codepage 437)" ) - PORT_DIPSETTING( 0x40, "Portugese (Codepage 865)" ) - PORT_DIPSETTING( 0x20, "Norwegian (Codepage 860)" ) - PORT_DIPSETTING( 0x00, "Greek") - PORT_DIPNAME( 0x80, 0x80, "Floppy Ready Line") - PORT_DIPSETTING( 0x80, "Connected" ) - PORT_DIPSETTING( 0x00, "Not connected" ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( pc1640 ) -//------------------------------------------------- - -static INPUT_PORTS_START( pc1640 ) - PORT_INCLUDE( mouse ) - - PORT_START("LK") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Language ) ) - PORT_DIPSETTING( 0x07, DEF_STR( English ) ) - PORT_DIPSETTING( 0x06, DEF_STR( German ) ) - PORT_DIPSETTING( 0x05, DEF_STR( French ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Spanish ) ) - PORT_DIPSETTING( 0x03, "Danish" ) - PORT_DIPSETTING( 0x02, "Swedish" ) - PORT_DIPSETTING( 0x01, DEF_STR( Italian ) ) - PORT_DIPSETTING( 0x00, "Diagnostic Mode" ) - - PORT_START("SW") - PORT_DIPNAME( 0x0f, 0x09, "Initial Display Mode" ) PORT_DIPLOCATION("SW:1,2,3,4") PORT_CONDITION("SW", 0x200, EQUALS, 0x200) - PORT_DIPSETTING( 0x0b, "Internal MD, External CGA80" ) - PORT_DIPSETTING( 0x0a, "Internal MD, External CGA40" ) - PORT_DIPSETTING( 0x09, "Internal ECD350, External MDA/HERC" ) - PORT_DIPSETTING( 0x08, "Internal ECD200, External MDA/HERC" ) - PORT_DIPSETTING( 0x07, "Internal CD80, External MDA/HERC" ) - PORT_DIPSETTING( 0x06, "Internal CD40, External MDA/HERC" ) - PORT_DIPSETTING( 0x05, "External CGA80, Internal MD" ) - PORT_DIPSETTING( 0x04, "External CGA40, Internal MD" ) - PORT_DIPSETTING( 0x03, "External MDA/HERC, Internal ECD350" ) - PORT_DIPSETTING( 0x02, "External MDA/HERC, Internal ECD200" ) - PORT_DIPSETTING( 0x01, "External MDA/HERC, Internal CD80" ) - PORT_DIPSETTING( 0x00, "External MDA/HERC, Internal CD40" ) - PORT_DIPNAME( 0x10, 0x10, "MC6845 Mode" ) PORT_DIPLOCATION("SW:5") PORT_CONDITION("SW", 0x200, EQUALS, 0x200) - PORT_DIPSETTING( 0x10, "EGA" ) - PORT_DIPSETTING( 0x00, "CGA/MDA/HERC" ) - PORT_DIPNAME( 0x60, 0x00, "Font" ) PORT_DIPLOCATION("SW:6,7") PORT_CONDITION("SW", 0x300, EQUALS, 0x300) - PORT_DIPSETTING( 0x00, DEF_STR( English ) ) - PORT_DIPSETTING( 0x60, "Danish" ) - PORT_DIPSETTING( 0x40, "Portuguese" ) - PORT_DIPSETTING( 0x20, "Greek" ) - PORT_DIPNAME( 0x60, 0x60, "Default Display Mode" ) PORT_DIPLOCATION("SW:6,7") PORT_CONDITION("SW", 0x200, EQUALS, 0x000) - PORT_DIPSETTING( 0x60, "External EGA" ) - PORT_DIPSETTING( 0x40, "External CGA in 40 Column Mode" ) - PORT_DIPSETTING( 0x20, "External CGA in 80 Column Mode" ) - PORT_DIPSETTING( 0x00, "External Monochrome Adapter" ) - PORT_DIPNAME( 0x80, 0x00, "Monitor" ) PORT_DIPLOCATION("SW:8") PORT_CONDITION("SW", 0x200, EQUALS, 0x200) - PORT_DIPSETTING( 0x80, "CD (Standard RGB)" ) - PORT_DIPSETTING( 0x00, "ECD (Enhanced RGB)" ) - PORT_DIPNAME( 0x100, 0x100, "Foreign Fonts" ) PORT_DIPLOCATION("SW:9") PORT_CONDITION("SW", 0x200, EQUALS, 0x200) - PORT_DIPSETTING( 0x100, "Enabled" ) - PORT_DIPSETTING( 0x000, "Disabled" ) - PORT_DIPNAME( 0x200, 0x200, "Internal Graphics Adapter" ) PORT_DIPLOCATION("SW:10") - PORT_DIPSETTING( 0x200, "Enabled" ) - PORT_DIPSETTING( 0x000, "Disabled" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// PC1512_KEYBOARD_INTERFACE( kb_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( pc1512_state::kbdata_w ) -{ - m_kbdata = state; -} - -WRITE_LINE_MEMBER( pc1512_state::kbclk_w ) -{ - if (!BIT(m_port61, 7) && m_kbclk && !state) - { - m_kbd <<= 1; - m_kbd |= m_kbdata; - m_kb_bits++; - - if (m_kb_bits == 8) - { - m_kb->data_w(0); - m_pic->ir1_w(ASSERT_LINE); - } - } - - m_kbclk = state; -} - - -//------------------------------------------------- -// I8237_INTERFACE( dmac_intf ) -//------------------------------------------------- - -void pc1512_state::update_fdc_tc() -{ - if (m_nden) - m_fdc->tc_w(m_neop); - else - m_fdc->tc_w(false); -} - -WRITE_LINE_MEMBER( pc1512_state::hrq_w ) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - m_dmac->hack_w(state); -} - -WRITE_LINE_MEMBER( pc1512_state::eop_w ) -{ - if (m_dma_channel == 2) - { - m_neop = !state; - update_fdc_tc(); - } -} - -READ8_MEMBER( pc1512_state::memr_r ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - offs_t page_offset = m_dma_page[m_dma_channel] << 16; - - return program.read_byte(page_offset + offset); -} - -WRITE8_MEMBER( pc1512_state::memw_w ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - offs_t page_offset = m_dma_page[m_dma_channel] << 16; - - program.write_byte(page_offset + offset, data); -} - -READ8_MEMBER( pc1512_state::ior1_r ) -{ - return m_bus->dack_r(1); -} - -READ8_MEMBER( pc1512_state::ior2_r ) -{ - if (m_nden) - return m_fdc->dma_r(); - else - return m_bus->dack_r(2); -} - -READ8_MEMBER( pc1512_state::ior3_r ) -{ - return m_bus->dack_r(3); -} - -WRITE8_MEMBER( pc1512_state::iow0_w ) -{ - m_dreq0 = 0; - m_dmac->dreq0_w(m_dreq0); -} - -WRITE8_MEMBER( pc1512_state::iow1_w ) -{ - m_bus->dack_w(1, data); -} - -WRITE8_MEMBER( pc1512_state::iow2_w ) -{ - if (m_nden) - m_fdc->dma_w(data); - else - m_bus->dack_w(2, data); -} - -WRITE8_MEMBER( pc1512_state::iow3_w ) -{ - m_bus->dack_w(3, data); -} - -WRITE_LINE_MEMBER( pc1512_state::dack0_w ) -{ - if (!state) m_dma_channel = 0; -} - -WRITE_LINE_MEMBER( pc1512_state::dack1_w ) -{ - if (!state) m_dma_channel = 1; -} - -WRITE_LINE_MEMBER( pc1512_state::dack2_w ) -{ - if (!state) m_dma_channel = 2; -} - -WRITE_LINE_MEMBER( pc1512_state::dack3_w ) -{ - if (!state) m_dma_channel = 3; -} - -//------------------------------------------------- -// pit8253_config pit_intf -//------------------------------------------------- - -void pc1512_state::update_speaker() -{ - m_speaker->level_w(m_speaker_drive & m_pit2); -} - -WRITE_LINE_MEMBER( pc1512_state::pit1_w ) -{ - if (!m_pit1 && state && !m_dreq0) - { - m_dreq0 = 1; - m_dmac->dreq0_w(m_dreq0); - } - - m_pit1 = state; -} - -WRITE_LINE_MEMBER( pc1512_state::pit2_w ) -{ - m_pit2 = state; - update_speaker(); -} - -//------------------------------------------------- -// upd765_interface fdc_intf -//------------------------------------------------- - -void pc1512_state::update_fdc_int() -{ - if (m_nden) - m_pic->ir6_w(m_dint); - else - m_pic->ir6_w(CLEAR_LINE); -} - -void pc1512_state::update_fdc_drq() -{ - if (m_nden) - m_dmac->dreq2_w(m_ddrq); - else - m_dmac->dreq2_w(0); -} - -WRITE_LINE_MEMBER( pc1512_state::fdc_int_w ) -{ - m_dint = state; - update_fdc_int(); -} - -WRITE_LINE_MEMBER( pc1512_state::fdc_drq_w ) -{ - m_ddrq = state; - update_fdc_drq(); -} - -//------------------------------------------------- -// centronics_interface centronics_intf -//------------------------------------------------- - -void pc1512_state::update_ack() -{ - if (m_ack_int_enable) - m_pic->ir7_w(m_centronics_ack); - else - m_pic->ir7_w(CLEAR_LINE); -} - -WRITE_LINE_MEMBER( pc1512_state::write_centronics_ack ) -{ - m_centronics_ack = state; - update_ack(); -} - -WRITE_LINE_MEMBER( pc1512_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( pc1512_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -WRITE_LINE_MEMBER( pc1512_state::write_centronics_select ) -{ - m_centronics_select = state; -} - -WRITE_LINE_MEMBER( pc1512_state::write_centronics_fault ) -{ - m_centronics_fault = state; -} - - -//------------------------------------------------- -// isa8bus_interface isabus_intf -//------------------------------------------------- - -SLOT_INTERFACE_START( pc1640_isa8_cards ) - SLOT_INTERFACE_INTERNAL("iga", ISA8_PC1640_IGA) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( pc1512_state::floppy_formats ) - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( pc1512_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) // Tandon TM65-2L -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( pc1512 ) -//------------------------------------------------- - -void pc1512_state::machine_start() -{ - // set RAM size - size_t ram_size = m_ram->size(); - - if (ram_size < 640 * 1024) - { - address_space &program = m_maincpu->space(AS_PROGRAM); - program.unmap_readwrite(ram_size, 0x9ffff); - } - - // state saving - save_item(NAME(m_pit1)); - save_item(NAME(m_pit2)); - save_item(NAME(m_status1)); - save_item(NAME(m_status2)); - save_item(NAME(m_port61)); - save_item(NAME(m_nmi_enable)); - save_item(NAME(m_kbd)); - save_item(NAME(m_kb_bits)); - save_item(NAME(m_kbclk)); - save_item(NAME(m_kbdata)); - save_item(NAME(m_mouse_x)); - save_item(NAME(m_mouse_y)); - save_item(NAME(m_dma_page)); - save_item(NAME(m_dma_channel)); - save_item(NAME(m_dreq0)); - save_item(NAME(m_nden)); - save_item(NAME(m_dint)); - save_item(NAME(m_ddrq)); - save_item(NAME(m_neop)); - save_item(NAME(m_ack_int_enable)); - save_item(NAME(m_centronics_ack)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_perror)); - save_item(NAME(m_centronics_select)); - save_item(NAME(m_centronics_fault)); - save_item(NAME(m_printer_data)); - save_item(NAME(m_printer_control)); - save_item(NAME(m_toggle)); - save_item(NAME(m_lpen)); - save_item(NAME(m_blink)); - save_item(NAME(m_cursor)); - save_item(NAME(m_blink_ctr)); - save_item(NAME(m_vdu_mode)); - save_item(NAME(m_vdu_color)); - save_item(NAME(m_vdu_plane)); - save_item(NAME(m_vdu_rdsel)); - save_item(NAME(m_vdu_border)); - save_item(NAME(m_speaker_drive)); -} - - -void pc1512_state::machine_reset() -{ - m_nmi_enable = 0; - m_toggle = 0; - m_kb_bits = 0; - m_pit2 = 1; - - m_lpen = 0; - m_blink = 0; - m_cursor = 0; - m_blink_ctr = 0; - m_vdu_mode = 0; - m_vdu_color = 0; - m_vdu_rdsel = 0; - m_vdu_plane = 0x0f; - m_vdu_border = 0; - - m_kb->clock_w(0); -} - - -//------------------------------------------------- -// MACHINE_START( pc1640 ) -//------------------------------------------------- - -void pc1640_state::machine_start() -{ - // state saving - save_item(NAME(m_pit1)); - save_item(NAME(m_pit2)); - save_item(NAME(m_status1)); - save_item(NAME(m_status2)); - save_item(NAME(m_port61)); - save_item(NAME(m_nmi_enable)); - save_item(NAME(m_kbd)); - save_item(NAME(m_kb_bits)); - save_item(NAME(m_kbclk)); - save_item(NAME(m_kbdata)); - save_item(NAME(m_mouse_x)); - save_item(NAME(m_mouse_y)); - save_item(NAME(m_dma_page)); - save_item(NAME(m_dma_channel)); - save_item(NAME(m_dreq0)); - save_item(NAME(m_nden)); - save_item(NAME(m_dint)); - save_item(NAME(m_ddrq)); - save_item(NAME(m_neop)); - save_item(NAME(m_ack_int_enable)); - save_item(NAME(m_centronics_ack)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_perror)); - save_item(NAME(m_centronics_select)); - save_item(NAME(m_centronics_fault)); - save_item(NAME(m_printer_data)); - save_item(NAME(m_printer_control)); - save_item(NAME(m_speaker_drive)); - save_item(NAME(m_opt)); -} - - -void pc1640_state::machine_reset() -{ - m_nmi_enable = 0; - m_kb_bits = 0; - m_kb->clock_w(0); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( pc1512 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pc1512, pc1512_state ) - MCFG_CPU_ADD(I8086_TAG, I8086, XTAL_24MHz/3) - MCFG_CPU_PROGRAM_MAP(pc1512_mem) - MCFG_CPU_IO_MAP(pc1512_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A2_TAG, pic8259_device, inta_cb) - - // video - MCFG_FRAGMENT_ADD(pc1512_video) - - // sound - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - // devices - MCFG_DEVICE_ADD(PC1512_KEYBOARD_TAG, PC1512_KEYBOARD, 0) - MCFG_PC1512_KEYBOARD_CLOCK_CALLBACK(WRITELINE(pc1512_state, kbclk_w)) - MCFG_PC1512_KEYBOARD_DATA_CALLBACK(WRITELINE(pc1512_state, kbdata_w)) - MCFG_DEVICE_ADD(I8237A5_TAG, AM9517A, XTAL_24MHz/6) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(pc1512_state, hrq_w)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(pc1512_state, eop_w)) - MCFG_I8237_IN_MEMR_CB(READ8(pc1512_state, memr_r)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(pc1512_state, memw_w)) - MCFG_I8237_IN_IOR_1_CB(READ8(pc1512_state, ior1_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(pc1512_state, ior2_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(pc1512_state, ior3_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc1512_state, iow0_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(pc1512_state, iow1_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(pc1512_state, iow2_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(pc1512_state, iow3_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(pc1512_state, dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(pc1512_state, dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(pc1512_state, dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(pc1512_state, dack3_w)) - MCFG_PIC8259_ADD(I8259A2_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL) - - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_28_63636MHz/24) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_28_63636MHz/24) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(pc1512_state, pit1_w)) - MCFG_PIT8253_CLK2(XTAL_28_63636MHz/24) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(pc1512_state, pit2_w)) - - MCFG_MC146818_ADD(MC146818_TAG, XTAL_32_768kHz) - MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) - MCFG_PC_FDC_XT_ADD(PC_FDC_XT_TAG) - MCFG_PC_FDC_INTRQ_CALLBACK(WRITELINE(pc1512_state, fdc_int_w)) - MCFG_PC_FDC_DRQ_CALLBACK(WRITELINE(pc1512_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(PC_FDC_XT_TAG ":0", pc1512_floppies, "525dd", pc1512_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(PC_FDC_XT_TAG ":1", pc1512_floppies, NULL, pc1512_state::floppy_formats) - MCFG_DEVICE_ADD(INS8250_TAG, INS8250, XTAL_1_8432MHz) - MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_INS8250_OUT_INT_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pc1512_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pc1512_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(pc1512_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(pc1512_state, write_centronics_select)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(pc1512_state, write_centronics_fault)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, dsr_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, ri_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, cts_w)) - - // ISA8 bus - MCFG_DEVICE_ADD(ISA_BUS_TAG, ISA8, 0) - MCFG_ISA8_CPU(":" I8086_TAG) - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir7_w)) - MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq3_w)) - MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa1", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa2", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa3", pc_isa8_cards, NULL, false) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_EXTRA_OPTIONS("544K,576K,608K,640K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "pc1512") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pc1512dd ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pc1512dd, pc1512 ) - MCFG_DEVICE_MODIFY(PC_FDC_XT_TAG ":1") - MCFG_SLOT_DEFAULT_OPTION("525dd") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pc1512hd ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pc1512hd, pc1512 ) - MCFG_DEVICE_MODIFY("isa1") - MCFG_SLOT_DEFAULT_OPTION("wdxt_gen") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pc1640 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pc1640, pc1640_state ) - MCFG_CPU_ADD(I8086_TAG, I8086, XTAL_24MHz/3) - MCFG_CPU_PROGRAM_MAP(pc1640_mem) - MCFG_CPU_IO_MAP(pc1640_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A2_TAG, pic8259_device, inta_cb) - - // sound - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - // devices - MCFG_DEVICE_ADD(PC1512_KEYBOARD_TAG, PC1512_KEYBOARD, 0) - MCFG_PC1512_KEYBOARD_CLOCK_CALLBACK(WRITELINE(pc1512_state, kbclk_w)) - MCFG_PC1512_KEYBOARD_DATA_CALLBACK(WRITELINE(pc1512_state, kbdata_w)) - MCFG_DEVICE_ADD(I8237A5_TAG, AM9517A, XTAL_24MHz/6) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(pc1512_state, hrq_w)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(pc1512_state, eop_w)) - MCFG_I8237_IN_MEMR_CB(READ8(pc1512_state, memr_r)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(pc1512_state, memw_w)) - MCFG_I8237_IN_IOR_1_CB(READ8(pc1512_state, ior1_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(pc1512_state, ior2_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(pc1512_state, ior3_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc1512_state, iow0_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(pc1512_state, iow1_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(pc1512_state, iow2_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(pc1512_state, iow3_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(pc1512_state, dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(pc1512_state, dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(pc1512_state, dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(pc1512_state, dack3_w)) - MCFG_PIC8259_ADD(I8259A2_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL) - - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_28_63636MHz/24) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_28_63636MHz/24) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(pc1512_state, pit1_w)) - MCFG_PIT8253_CLK2(XTAL_28_63636MHz/24) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(pc1512_state, pit2_w)) - - MCFG_MC146818_ADD(MC146818_TAG, XTAL_32_768kHz) - MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) - MCFG_PC_FDC_XT_ADD(PC_FDC_XT_TAG) - MCFG_PC_FDC_INTRQ_CALLBACK(WRITELINE(pc1512_state, fdc_int_w)) - MCFG_PC_FDC_DRQ_CALLBACK(WRITELINE(pc1512_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(PC_FDC_XT_TAG ":0", pc1512_floppies, "525dd", pc1512_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(PC_FDC_XT_TAG ":1", pc1512_floppies, NULL, pc1512_state::floppy_formats) - MCFG_DEVICE_ADD(INS8250_TAG, INS8250, XTAL_1_8432MHz) - MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_INS8250_OUT_INT_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) - - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pc1512_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pc1512_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(pc1512_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(pc1512_state, write_centronics_select)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(pc1512_state, write_centronics_fault)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, dsr_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, ri_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(INS8250_TAG, ins8250_uart_device, cts_w)) - - // ISA8 bus - MCFG_DEVICE_ADD(ISA_BUS_TAG, ISA8, 0) - MCFG_ISA8_CPU(":" I8086_TAG) - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir2_w)) - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir7_w)) - MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE(I8237A5_TAG, am9517a_device, dreq3_w)) - MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa1", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa2", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa3", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa4", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISA_BUS_TAG, "isa5", pc1640_isa8_cards, "iga", false) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "pc1640") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pc1640dd ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pc1640dd, pc1640 ) - MCFG_DEVICE_MODIFY(PC_FDC_XT_TAG ":1") - MCFG_SLOT_DEFAULT_OPTION("525dd") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pc1640hd ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pc1640hd, pc1640 ) - MCFG_DEVICE_MODIFY("isa1") - MCFG_SLOT_DEFAULT_OPTION("wdxt_gen") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( pc1512 ) -//------------------------------------------------- - -ROM_START( pc1512 ) - ROM_REGION16_LE( 0x4000, I8086_TAG, 0) - ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) - ROMX_LOAD( "40044.ic132", 0x0000, 0x2000, CRC(f72f1582) SHA1(7781d4717917262805d514b331ba113b1e05a247), ROM_SKIP(1) | ROM_BIOS(1) ) - ROMX_LOAD( "40043.ic129", 0x0001, 0x2000, CRC(668fcc94) SHA1(74002f5cc542df442eec9e2e7a18db3598d8c482), ROM_SKIP(1) | ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) - ROMX_LOAD( "40044v2.ic132", 0x0000, 0x2000, CRC(1aec54fa) SHA1(b12fd73cfc35a240ed6da4dcc4b6c9910be611e0), ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD( "40043v2.ic129", 0x0001, 0x2000, CRC(d2d4d2de) SHA1(c376fd1ad23025081ae16c7949e88eea7f56e1bb), ROM_SKIP(1) | ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v3", "Version 3" ) - ROMX_LOAD( "40044-2.ic132", 0x0000, 0x2000, CRC(ea527e6e) SHA1(b77fa44767a71a0b321a88bb0a394f1125b7c220), ROM_SKIP(1) | ROM_BIOS(3) ) - ROMX_LOAD( "40043-2.ic129", 0x0001, 0x2000, CRC(532c3854) SHA1(18a17b710f9eb079d9d7216d07807030f904ceda), ROM_SKIP(1) | ROM_BIOS(3) ) - - ROM_REGION( 0x2000, AMS40041_TAG, 0 ) - ROMX_LOAD( "40045.ic127", 0x0000, 0x2000, CRC(dd5e030f) SHA1(7d858bbb2e8d6143aa67ab712edf5f753c2788a7), ROM_BIOS(1) ) - ROMX_LOAD( "40078.ic127", 0x0000, 0x2000, CRC(ae9c0d04) SHA1(bc8dc4dcedeea5bc1c04986b1f105ad93cb2ebcd), ROM_BIOS(2) ) - ROMX_LOAD( "40078.ic127", 0x0000, 0x2000, CRC(ae9c0d04) SHA1(bc8dc4dcedeea5bc1c04986b1f105ad93cb2ebcd), ROM_BIOS(3) ) -ROM_END - -#define rom_pc1512dd rom_pc1512 -#define rom_pc1512hd10 rom_pc1512 -#define rom_pc1512hd20 rom_pc1512 - - -//------------------------------------------------- -// ROM( pc1640 ) -//------------------------------------------------- - -ROM_START( pc1640 ) - ROM_REGION16_LE( 0x4000, I8086_TAG, 0) - ROM_SYSTEM_BIOS( 0, "8809", "Week 9/1988" ) - ROMX_LOAD( "40044-1 8809.ic132", 0x0000, 0x2000, CRC(f1c074f3) SHA1(a055ea7e933d137623c22fe24004e870653c7952), ROM_SKIP(1) | ROM_BIOS(1) ) // 8809 B - ROMX_LOAD( "40043-1 8809.ic129", 0x0001, 0x2000, CRC(e40a1513) SHA1(447eff2057e682e51b1c7593cb6fad0e53879fa8), ROM_SKIP(1) | ROM_BIOS(1) ) // 8809 B - ROM_SYSTEM_BIOS( 1, "8738", "Week 38/1987" ) - ROMX_LOAD( "40044 8738.ic132", 0x0000, 0x2000, CRC(43832ea7) SHA1(eea4a8836f966940a88c88de6c5cc14852545f7d), ROM_SKIP(1) | ROM_BIOS(2) ) // 8738 D F - ROMX_LOAD( "40043 8738.ic129", 0x0001, 0x2000, CRC(768498f9) SHA1(ac48cb892417d7998d604f3b79756140c554f476), ROM_SKIP(1) | ROM_BIOS(2) ) // 8738 D F - ROM_SYSTEM_BIOS( 2, "88xx", "Week ?/1988" ) - ROMX_LOAD( "40044 88xx.ic132", 0x0000, 0x2000, CRC(6090f782) SHA1(e21ae524d5b4d00696d293dbd4fe4d7bca22e277), ROM_SKIP(1) | ROM_BIOS(3) ) - ROMX_LOAD( "40043 88xx.ic129", 0x0001, 0x2000, CRC(9219d0aa) SHA1(dde1a46c8f83e413d7070f1356fc91b9f595a8b6), ROM_SKIP(1) | ROM_BIOS(3) ) -ROM_END - -#define rom_pc1640dd rom_pc1640 -#define rom_pc1640hd20 rom_pc1640 -#define rom_pc1640hd30 rom_pc1640 - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1986, pc1512, 0, 0, pc1512, pc1512, driver_device, 0, "Amstrad plc", "PC1512 SD", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, pc1512dd, pc1512, 0, pc1512dd, pc1512, driver_device, 0, "Amstrad plc", "PC1512 DD", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, pc1512hd10, pc1512, 0, pc1512hd, pc1512, driver_device, 0, "Amstrad plc", "PC1512 HD10", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, pc1512hd20, pc1512, 0, pc1512hd, pc1512, driver_device, 0, "Amstrad plc", "PC1512 HD20", MACHINE_SUPPORTS_SAVE ) -COMP( 1987, pc1640, 0, 0, pc1640, pc1640, driver_device, 0, "Amstrad plc", "PC1640 SD", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -COMP( 1987, pc1640dd, pc1640, 0, pc1640dd, pc1640, driver_device, 0, "Amstrad plc", "PC1640 DD", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -COMP( 1987, pc1640hd20, pc1640, 0, pc1640hd, pc1640, driver_device, 0, "Amstrad plc", "PC1640 HD20", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -COMP( 1987, pc1640hd30, pc1640, 0, pc1640hd, pc1640, driver_device, 0, "Amstrad plc", "PC1640 HD30", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/pc2000.c b/src/mess/drivers/pc2000.c deleted file mode 100644 index e52336577f0..00000000000 --- a/src/mess/drivers/pc2000.c +++ /dev/null @@ -1,1031 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - VTech PreComputer 1000 / 2000 - - 04/12/2009 Skeleton driver. - - TODO: - - fix MisterX LCD - - MisterX bankswitch - - dump the chargen - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/hd44780.h" -#include "video/sed1520.h" -#include "sound/beep.h" -#include "rendlay.h" -#include "gl3000s.lh" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class pc2000_state : public driver_device -{ -public: - pc2000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_lcdc(*this, "hd44780"), - m_beep(*this, "beeper"), - m_cart(*this, "cartslot"), - m_bank0(*this, "bank0"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2") - { } - - required_device m_maincpu; - optional_device m_lcdc; - required_device m_beep; - required_device m_cart; - optional_memory_bank m_bank0; - required_memory_bank m_bank1; - optional_memory_bank m_bank2; - - UINT8 m_mux_data; - UINT8 m_beep_state; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( key_matrix_r ); - DECLARE_WRITE8_MEMBER( key_matrix_w ); - DECLARE_WRITE8_MEMBER( rombank0_w ); - DECLARE_WRITE8_MEMBER( rombank1_w ); - DECLARE_WRITE8_MEMBER( rombank2_w ); - DECLARE_READ8_MEMBER( beep_r ); - DECLARE_WRITE8_MEMBER( beep_w ); - DECLARE_PALETTE_INIT(pc2000); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pc2000_cart); -}; - -class gl3000s_state : public pc2000_state -{ -public: - gl3000s_state(const machine_config &mconfig, device_type type, const char *tag) - : pc2000_state(mconfig, type, tag), - m_lcdc_r(*this, "sed1520_r"), - m_lcdc_l(*this, "sed1520_l") - { } - - required_device m_lcdc_r; - required_device m_lcdc_l; - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - -class gl4004_state : public pc2000_state -{ -public: - gl4004_state(const machine_config &mconfig, device_type type, const char *tag) - : pc2000_state(mconfig, type, tag) - { } - - virtual void machine_start(); -}; - -class pc1000_state : public pc2000_state -{ -public: - pc1000_state(const machine_config &mconfig, device_type type, const char *tag) - : pc2000_state(mconfig, type, tag) - { } - - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( kb_r ); - DECLARE_READ8_MEMBER( lcdc_data_r ); - DECLARE_WRITE8_MEMBER( lcdc_data_w ); - DECLARE_READ8_MEMBER( lcdc_control_r ); - DECLARE_WRITE8_MEMBER( lcdc_control_w ); -}; - - -/* TODO: put a breakpoint at 1625 and test the inputs, writes at dce4 are the scancode values */ -READ8_MEMBER( pc2000_state::key_matrix_r ) -{ - static const char *const bitnames[2][8] = - { - {"IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7"}, - {"IN8", "IN9", "INA", "INB", "INC", "IND", "INE", "INF"} - }; - - UINT8 data = 0xff; - - for (int line=0; line<8; line++) - if (m_mux_data & (1<read(); - - return data; -} - -WRITE8_MEMBER( pc2000_state::key_matrix_w ) -{ - m_mux_data = data; -} - -WRITE8_MEMBER( pc2000_state::rombank0_w ) -{ - m_bank0->set_entry(data & 0x1f); -} - -WRITE8_MEMBER( pc2000_state::rombank1_w ) -{ - m_bank1->set_entry(data & 0x1f); -} - -WRITE8_MEMBER( pc2000_state::rombank2_w ) -{ - if (data & 0x80) - m_bank2->set_entry(data & 0x8f); //cartridge - else - m_bank2->set_entry(data & 0x1f); -} - -READ8_MEMBER( pc2000_state::beep_r ) -{ - return m_beep_state; -} - -WRITE8_MEMBER( pc2000_state::beep_w ) -{ - m_beep->set_state(BIT(data, 3)); - m_beep_state = data; -} - -static ADDRESS_MAP_START(pc2000_mem, AS_PROGRAM, 8, pc2000_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank0") - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") //0x8000 - 0xbfff tests a cartridge, header is 0x55 0xaa 0x59 0x45, if it succeeds a jump at 0x8004 occurs - AM_RANGE(0xc000, 0xdfff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc2000_io , AS_IO, 8, pc2000_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(rombank0_w) - AM_RANGE(0x01, 0x01) AM_WRITE(rombank1_w) - AM_RANGE(0x03, 0x03) AM_WRITE(rombank2_w) - AM_RANGE(0x0a, 0x0b) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) - AM_RANGE(0x10, 0x11) AM_READWRITE(key_matrix_r, key_matrix_w) - AM_RANGE(0x12, 0x12) AM_READWRITE(beep_r, beep_w) -ADDRESS_MAP_END - - -UINT32 gl3000s_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0); - m_lcdc_l->screen_update(screen, bitmap, cliprect); - m_lcdc_r->screen_update(screen, bitmap, cliprect); - return 0; -} - -int gl3000s_sed1520_screen_update(device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *vram, int start_line, int adc, int start_x) -{ - for (int y=0; y<2; y++) - { - int row_pos = 0; - for (int x=0; x<61; x++) - { - int addr = (y + (start_line >> 3)) * 80 + row_pos; - for (int yi=0; yi<8; yi++) - { - int px = start_x - (adc ? (80 - x) : x); - int py = 8 + y*8 + yi; - - if (cliprect.contains(px, py)) - bitmap.pix16(py, px) = (vram[addr % 0x140] >> yi) & 1; - } - - row_pos++; - } - } - return 0; -} - -SED1520_UPDATE_CB(gl3000s_screen_update_right) -{ - return gl3000s_sed1520_screen_update(device, bitmap, cliprect, vram, start_line, adc, 119); -} - -SED1520_UPDATE_CB(gl3000s_screen_update_left) -{ - UINT8 sec[3]; - UINT8 points[2][3]; - memset(sec, 0, sizeof(sec)); - memset(points, 0, sizeof(points)); - - for (int y=0; y<2; y++) - for (int x=59; x<85; x++) - { - UINT8 data = vram[(y*0x50 + x) % 0x140]; - int dpos = (x - 74) / 2; - - for (int yi=0; yi<8; yi++) - { - int state = (data >> yi) & 1; - - if (y == 0 && (x == 74 || x == 76 || x == 78) && yi == 7) sec[dpos] |= (state << 0); - else if (y == 0 && (x == 74 || x == 76 || x == 78) && yi == 0) sec[dpos] |= (state << 2); - else if (y == 0 && (x == 75 || x == 77 || x == 79) && yi == 7) sec[dpos] |= (state << 5); - else if (y == 0 && (x == 75 || x == 77 || x == 79) && yi == 0) sec[dpos] |= (state << 4); - else if (y == 0 && (x == 75 || x == 77 || x == 79) && yi == 1) sec[dpos] |= (state << 3); - else if (y == 1 && (x == 74 || x == 76 || x == 78) && yi == 7) sec[dpos] |= (state << 1); - else if (y == 1 && (x == 75 || x == 77 || x == 79) && yi == 7) sec[dpos] |= (state << 6); - - else if ((x == 74 || x == 76 || x == 78) && yi == 3) points[y][dpos] |= (state << 0); - else if ((x == 74 || x == 76 || x == 78) && yi == 4) points[y][dpos] |= (state << 1); - else if ((x == 74 || x == 76 || x == 78) && yi == 5) points[y][dpos] |= (state << 2); - else if ((x == 75 || x == 77 || x == 79) && yi == 3) points[y][dpos] |= (state << 5); - else if ((x == 75 || x == 77 || x == 79) && yi == 4) points[y][dpos] |= (state << 6); - else if ((x == 75 || x == 77 || x == 79) && yi == 5) points[y][dpos] |= (state << 4); - else if ((x == 75 || x == 77 || x == 79) && yi == 6) points[y][dpos] |= (state << 3); - - else if (y == 1 && x >= 65 && x <= 68 && yi == 7) output_set_indexed_value("LEV", x - 64, state); - else if (x >= 59 && x <= 60 && yi == 7) output_set_indexed_value("TRY", x - 58 + (y ? 0 : 1), state); - else if (y == 1 && x >= 61 && x <= 64 && yi == 7) output_set_indexed_value("TICK", x - 59, state); - else if (y == 0 && x >= 61 && x <= 64 && yi == 7) output_set_indexed_value("TICK", 62 - x + (x >= 63 ? 8 : 0), state); - - else if (x < 74 && yi < 7) - { - int cx = x - 59; - bitmap.pix16(yi, (y ? 0 : 89) + (16 - (cx + cx / 5))) = state; - } - } - } - - for(int i=0; i<3; i++) - { - output_set_indexed_value("TIME", i, sec[i]); - output_set_indexed_value("P1", i, points[1][i]); - output_set_indexed_value("P2", i, points[0][i]); - } - - return gl3000s_sed1520_screen_update(device, bitmap, cliprect, vram, start_line, adc, 58); -} - - -static ADDRESS_MAP_START( gl3000s_io , AS_IO, 8, gl3000s_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x01, 0x01) AM_WRITE(rombank1_w) - AM_RANGE(0x03, 0x03) AM_WRITE(rombank2_w) - AM_RANGE(0x08, 0x09) AM_DEVREADWRITE("sed1520_r", sed1520_device, read, write) - AM_RANGE(0x0a, 0x0b) AM_DEVREADWRITE("sed1520_l", sed1520_device, read, write) - AM_RANGE(0x10, 0x11) AM_READWRITE(key_matrix_r, key_matrix_w) -ADDRESS_MAP_END - -READ8_MEMBER( pc1000_state::kb_r ) -{ - static const char *const bitnames[9] = - { - "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7", "IN8" - }; - - UINT8 data = 0xff; - - for (int line=0; line<9; line++) - if (!(offset & (1<read(); - - return data; -} - -READ8_MEMBER( pc1000_state::lcdc_data_r ) -{ - //logerror("lcdc data r\n"); - return m_lcdc->data_read(space, 0)>>4; -} - -WRITE8_MEMBER( pc1000_state::lcdc_data_w ) -{ - //popmessage("%s", (char*)m_maincpu->space(AS_PROGRAM).get_read_ptr(0x4290)); - - //logerror("lcdc data w %x\n", data); - m_lcdc->data_write(space, 0, data<<4); -} - -READ8_MEMBER( pc1000_state::lcdc_control_r ) -{ - //logerror("lcdc control r\n"); - return m_lcdc->control_read(space, 0)>>4; -} - -WRITE8_MEMBER( pc1000_state::lcdc_control_w ) -{ - //logerror("lcdc control w %x\n", data); - m_lcdc->control_write(space, 0, data<<4); -} - -static HD44780_PIXEL_UPDATE(pc1000_pixel_update) -{ - UINT8 layout[] = { 0x00, 0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48, 0x47, 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37 }; - //UINT8 layout[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49 }; - - for(int i=0; i<20; i++) - if (pos == layout[i]) - { - bitmap.pix16(line*9 + y, i*6 + x) = state; - break; - } -} - -static ADDRESS_MAP_START(pc1000_mem, AS_PROGRAM, 8, pc1000_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("bios", 0x00000) - AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x8000, 0xbfff) AM_DEVREAD("cartslot", generic_slot_device, read_rom) //0x8000 - 0xbfff tests a cartridge, header is 0x55 0xaa 0x33, if it succeeds a jump at 0x8010 occurs - AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1000_io , AS_IO, 8, pc1000_state) - AM_RANGE(0x0000, 0x01ff) AM_READ(kb_r) - AM_RANGE(0x4000, 0x4000) AM_MIRROR(0xfe) AM_READWRITE(lcdc_control_r, lcdc_control_w) - AM_RANGE(0x4100, 0x4100) AM_MIRROR(0xfe) AM_READWRITE(lcdc_data_r, lcdc_data_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pc2000 ) - PORT_START("IN0") - PORT_DIPNAME( 0x01, 0x01, "IN0" ) //0x83 - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("IN1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("IN2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("IN3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - - PORT_START("IN4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - - PORT_START("IN5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - - PORT_START("IN6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - - PORT_START("IN7") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("IN8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Scramble") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Guess Rork") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Missing Letter") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Letter Hunt") PORT_CODE(KEYCODE_F4) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("IN9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Letter Zapper") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Letter Switch") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sentence Jumble") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Grammar Challenge") PORT_CODE(KEYCODE_F8) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Plurals") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Past Tense") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Synonyms") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Antonyms") PORT_CODE(KEYCODE_F12) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INB") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Basic Math") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Advanced Math") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Math Riddles") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Number Challenge") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INC") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ecology") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("History") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Geography") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Super Power") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("IND") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Typing Game") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alpha Jumble") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Word Flash") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sign Search") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INE") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PC2000 Basic") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Spell Checker") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Calculator") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Load Cartridge") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INF") - PORT_DIPNAME( 0x01, 0x01, "INF" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(DEF_STR( Level_Select )) PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Players") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc1000 ) - PORT_START("IN0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SCHREIBMASCHINENKURS") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COMPUTER-UBUNGEN") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALLGEMEINWISSEN") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MATHE") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GESCHICHTE") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GEOGRAPHIE") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NATURWISSENSCHAFTEN") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPIELE") PORT_CODE(KEYCODE_F8) - - PORT_START("IN1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KASSETTE") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("AUS") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ELEKRONIK-RECHNER") PORT_CODE(KEYCODE_F10) - - PORT_START("IN2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb6") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa4") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xbc") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - - PORT_START("IN3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - - PORT_START("IN4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - - PORT_START("IN5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - - PORT_START("IN6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("IN7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) - - PORT_START("IN8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( gl3000s ) - PORT_START("IN0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Einstellen Antwort") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - - PORT_START("IN1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Hilfe") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - - PORT_START("IN2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Druck Symbol") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_START("IN3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("\xc3\x84") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) - - PORT_START("IN4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - - PORT_START("IN5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("\xc3\x9f") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("\xc3\x96") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - - PORT_START("IN6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("\xc3\x9c") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - - PORT_START("IN7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - - PORT_START("IN8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Off") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BASIC") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Logische Folgen") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bruch / Dezimalrechnen") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Addition") - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("IN9") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Textverarbeitung") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Buchstabenschl" "\xc3\xbc" "ssel") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Bruch / Prozentrechnen") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Subtraktion") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INA") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Taschenrechner") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Gleitpfeile") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Algebra") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Multiplikation") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INB") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ZusatzKassette") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stufe") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Spieler") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Zeichensuche") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Division") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INC") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Pr" "\xc3\xa4" "teritum") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Synonyme") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tipp Dich Fit") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Super Schlau-Quiz") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("IND") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Silbentrennung") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Knifflige Grammatik") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Textaufgaben") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Geographie-Quiz") PORT_CODE(KEYCODE_F9) - PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INE") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Wortr" "\xc3\xa4" "tsel") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Verdrehte S" "\xc3\xa4" "tze") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Blitz-S" "\xc3\xa4" "tze") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Geschichte-Quiz") PORT_CODE(KEYCODE_F5) - PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("INF") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Verr" "\xc3\xbc" "ckte R" "\xc3\xa4" "tsel") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Wortarten") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Wortschlange") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Naturwissenschaften-Quiz") PORT_CODE(KEYCODE_F1) - PORT_BIT(0xe1, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -void pc2000_state::machine_start() -{ - std::string region_tag; - UINT8 *bios = memregion("bios")->base(); - UINT8 *cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(); - if (!cart) - cart = memregion("bios")->base(); - - m_bank0->configure_entries(0, 0x10, bios, 0x4000); - m_bank1->configure_entries(0, 0x10, bios, 0x4000); - m_bank2->configure_entries(0, 0x10, bios, 0x4000); - m_bank2->configure_entries(0x80, 0x10, cart, 0x4000); -} - -void gl4004_state::machine_start() -{ - std::string region_tag; - UINT8 *bios = memregion("bios")->base(); - UINT8 *cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(); - if (!cart) - cart = memregion("bios")->base(); - - m_bank0->configure_entries(0, 0x20, bios, 0x4000); - m_bank1->configure_entries(0, 0x20, bios, 0x4000); - m_bank2->configure_entries(0, 0x20, bios, 0x4000); - m_bank2->configure_entries(0x80, 0x10, cart, 0x4000); -} - -void pc2000_state::machine_reset() -{ - //set the initial bank - m_bank0->set_entry(0); - m_bank1->set_entry(0); - m_bank2->set_entry(0); -} - -void pc1000_state::machine_start() -{ - UINT8 *bios = memregion("bios")->base(); - m_bank1->configure_entries(0, 0x08, bios, 0x4000); -} - -void pc1000_state::machine_reset() -{ - m_bank1->set_entry(0); -} - -PALETTE_INIT_MEMBER(pc2000_state, pc2000) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static const gfx_layout hd44780_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( pc2000 ) - GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, hd44780_charlayout, 0, 1 ) -GFXDECODE_END - - -DEVICE_IMAGE_LOAD_MEMBER( pc2000_state, pc2000_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - // we always allocate a 0x40000 region, even if most carts span only 0x20000, - // because the bankswitch code accesses up to 16 x 16K banks... - m_cart->rom_alloc(0x40000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -static MACHINE_CONFIG_START( pc2000, pc2000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) /* probably not accurate */ - MCFG_CPU_PROGRAM_MAP(pc2000_mem) - MCFG_CPU_IO_MAP(pc2000_io) - MCFG_CPU_PERIODIC_INT_DRIVER(pc2000_state, irq0_line_hold, 50) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_SIZE(120, 18) //2x20 chars - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pc2000_state, pc2000) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc2000) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 20) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "genius_cart") - MCFG_GENERIC_LOAD(pc2000_state, pc2000_cart) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( gl2000, pc2000 ) - MCFG_SOFTWARE_LIST_ADD("cart_list", "gl2000") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") -MACHINE_CONFIG_END - -static HD44780_PIXEL_UPDATE(gl4000_pixel_update) -{ - if (pos < 40) - { - static const UINT8 gl4000_display_layout[] = - { - 0x00, 0x01, 0x02, 0x03, 0x28, 0x29, 0x2a, 0x2b, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, - 0x14, 0x15, 0x16, 0x17, 0x3c, 0x3d, 0x3e, 0x3f, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x40, 0x41, 0x42, 0x43, - 0x44, 0x45, 0x46, 0x47, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f - }; - - UINT8 char_pos = gl4000_display_layout[line*40 + pos]; - bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; - } -} - -static MACHINE_CONFIG_DERIVED_CLASS( gl3000s, pc2000, gl3000s_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(gl3000s_io) - - MCFG_DEVICE_REMOVE("hd44780") - MCFG_SED1520_ADD("sed1520_l", gl3000s_screen_update_left) // left panel is 59 pixels (0-58) - MCFG_SED1520_ADD("sed1520_r", gl3000s_screen_update_right) // right panel is 61 pixels (59-119) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(120, 24) - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 24-1) - MCFG_SCREEN_UPDATE_DRIVER( gl3000s_state, screen_update ) - - MCFG_DEFAULT_LAYOUT(layout_gl3000s) - - MCFG_DEVICE_REMOVE("gfxdecode") - - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( gl4000, pc2000, gl4004_state ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(120, 36) // 4x20 chars - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 36-1) - - MCFG_DEVICE_MODIFY("hd44780") - MCFG_HD44780_LCD_SIZE(4, 20) - MCFG_HD44780_PIXEL_UPDATE_CB(gl4000_pixel_update) - - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( misterx, pc2000, pc1000_state ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pc1000_mem) - MCFG_CPU_IO_MAP(pc1000_io) - MCFG_CPU_PERIODIC_INT_DRIVER(pc1000_state, irq0_line_hold, 10) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(120, 9) //1x20 chars - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 9-1) - - MCFG_DEVICE_MODIFY("hd44780") - MCFG_HD44780_LCD_SIZE(1, 20) - MCFG_HD44780_PIXEL_UPDATE_CB(pc1000_pixel_update) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "misterx") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pc2000 ) - ROM_REGION( 0x40000, "bios", 0 ) - ROM_LOAD( "lh532hee_9344_d.u4", 0x000000, 0x040000, CRC(0b03bf33) SHA1(cb344b94b14975c685041d3e669f386e8a21909f)) -ROM_END - -ROM_START( gl2000 ) - ROM_REGION( 0x40000, "bios", 0 ) - ROM_LOAD( "lh532hez_9416_d.bin", 0x000000, 0x040000, CRC(532f219e) SHA1(4044f0cf098087af4cc9d1b2a80c3c9ec06f154e)) -ROM_END - -ROM_START( gl2000c ) - ROM_REGION( 0x40000, "bios", 0 ) - ROM_LOAD( "27-5491-00", 0x000000, 0x020000, CRC(cbb9fe90) SHA1(a2a7a8afb027fe764a5998e3b35e87f291c24df1)) -ROM_END - -ROM_START( gl2000p ) - ROM_REGION( 0x40000, "bios", 0 ) - ROM_LOAD( "27-5615-00_9534_d.bin", 0x000000, 0x040000, CRC(481c1000) SHA1(da6f60e5bb25145ec5239310296bedaabeeaee28)) -ROM_END - -ROM_START( gl3000s ) - ROM_REGION(0x40000, "bios", 0) - ROM_LOAD( "27-5713-00", 0x000000, 0x040000, CRC(18b113e0) SHA1(27a12893c38068efa35a99fa97a260dbfbd497e3) ) -ROM_END - -ROM_START( gl4000 ) - ROM_REGION(0x80000, "bios", 0) - ROM_LOAD( "27-5480-00", 0x000000, 0x040000, CRC(8de047d3) SHA1(bb1d869954773bb7b8b51caa54531015d6b751ec) ) -ROM_END - -ROM_START( gl4004 ) - ROM_REGION(0x80000, "bios", 0) - ROM_LOAD( "27-5762-00.u2", 0x000000, 0x080000, CRC(fb242f0f) SHA1(aae1beeb94873e29920726ad35475641d9f1e94e) ) -ROM_END - -ROM_START( gl5000 ) - ROM_REGION(0x80000, "bios", 0) - ROM_LOAD( "27-5912-00.u1", 0x000000, 0x080000, CRC(9fe4c04a) SHA1(823d1d46e49e21f921260296874bc3ee5f718a5f) ) -ROM_END - -ROM_START( gl5005x ) - ROM_REGION(0x200000, "bios", 0) - ROM_LOAD( "27-6426-00.u1", 0x000000, 0x200000, CRC(adde3581) SHA1(80f2bde7c5c339534614f24a9ca6ea362ee2f816) ) -ROM_END - -ROM_START( glpn ) - ROM_REGION( 0x200000, "bios", 0 ) - ROM_LOAD( "27-5755-01.u1", 0x00000, 0x80000, CRC(dc28346b) SHA1(148fe664bef5b2f68c6702c74462802b76900ca0) ) -ROM_END - -ROM_START( gmtt ) - ROM_REGION(0x100000, "bios", 0) - ROM_LOAD( "27-6154-00.u4", 0x000000, 0x100000, CRC(e908262d) SHA1(a7964c9f9d304b6b2cce61822e8c6151b50388be) ) -ROM_END - -ROM_START( gbs5505x ) - ROM_REGION(0x200000, "bios", 0) - ROM_LOAD( "27-7006-00.u5", 0x000000, 0x200000, CRC(28af3ca7) SHA1(5df7063c7327263c23d5ac2aac3aa66f7e0821c5) ) -ROM_END - -ROM_START( gln ) // not Z80 code - ROM_REGION( 0x80000, "bios", 0 ) - ROM_LOAD( "27-5308-00_9524_d.bin", 0x000000, 0x080000, CRC(d1b994ee) SHA1(b5cf0810df0676712e4f30e279cc46c19b4277dd)) -ROM_END - -ROM_START( pc1000 ) - ROM_REGION( 0x20000, "bios", 0 ) - ROM_LOAD( "27-00780-002-002.u4", 0x000000, 0x020000, CRC(705170ae) SHA1(825ce0ff2c7d0a7b1e2577d1465a37f7e8da383b)) -ROM_END - -ROM_START( misterx ) - ROM_REGION( 0x20000, "bios", 0 ) - ROM_LOAD( "27-00882-001.bin", 0x000000, 0x020000, CRC(30e0dc94) SHA1(2f4675746a41399b3d9e3e8001a9b4a0dcc5b620)) -ROM_END - -ROM_START( lexipcm ) - ROM_REGION( 0x200000, "bios", 0 ) - ROM_LOAD( "epoxy.u3", 0x00000, 0x100000, CRC(0a410790) SHA1(be04d5f74208a2f3b200daed75e04e966f64b545) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, pc1000, 0, 0, misterx, pc1000, driver_device, 0, "Video Technology", "PreComputer 1000", MACHINE_NOT_WORKING) -COMP( 1988, misterx, 0, 0, misterx, pc1000, driver_device, 0, "Video Technology / Yeno", "MisterX", MACHINE_NOT_WORKING) -COMP( 1993, pc2000, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "PreComputer 2000", MACHINE_NOT_WORKING) -COMP( 1993, gl2000, 0, 0, gl2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 2000", MACHINE_NOT_WORKING) -COMP( 1994, gl2000c, gl2000, 0, gl2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 2000 Compact", MACHINE_NOT_WORKING) -COMP( 1995, gl2000p, gl2000, 0, gl2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 2000 Plus", MACHINE_NOT_WORKING) -COMP( 1996, gl3000s, 0, 0, gl3000s, gl3000s,driver_device, 0, "Video Technology", "Genius Leader 3000S (Germany)", MACHINE_NOT_WORKING) -COMP( 1994, gl4000, 0, 0, gl4000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 4000 Quadro (Germany)", MACHINE_NOT_WORKING) -COMP( 1996, gl4004, 0, 0, gl4000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 4004 Quadro L (Germany)", MACHINE_NOT_WORKING) -COMP( 1997, gl5000, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 5000 (Germany)", MACHINE_IS_SKELETON) -COMP( 1997, gl5005x, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader 5005X (Germany)", MACHINE_IS_SKELETON) -COMP( 1997, glpn, 0, 0, gl4000, pc2000, driver_device, 0, "Video Technology", "Genius Leader Power Notebook (Germany)", MACHINE_IS_SKELETON) -COMP( 1998, gmtt , 0, 0, gl4000, pc2000, driver_device, 0, "Video Technology", "Genius Master Table Top (Germany)", MACHINE_IS_SKELETON) -COMP( 2001, gbs5505x, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "Genius BrainStation 5505X (Germany)", MACHINE_IS_SKELETON) -COMP( 1993, gln, 0, 0, pc2000, pc2000, driver_device, 0, "Video Technology", "Genius Leader Notebook", MACHINE_IS_SKELETON) -COMP( 1999, lexipcm, 0, 0, pc2000, pc2000, driver_device, 0, "Lexibook", "LexiPC Mega 2000 (Germany)", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/pc4.c b/src/mess/drivers/pc4.c deleted file mode 100644 index 014feebe6cb..00000000000 --- a/src/mess/drivers/pc4.c +++ /dev/null @@ -1,250 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - VTech Laser PC4 - - Driver by Sandro Ronco - - I found no documentations about this, if you have documentation or schematic - please let me know. - - Notes: - - the LCD controller seems similar to a HD44780, but with more ddram and - uses the bit 0 and 2 of the "Function Set" (0x2?) that are unused in - the specifications of the HD44780 datasheet. - - INT and NMI interrupt lines cause "LOW BATTERY" signal - - chargen are taken from other driver, a real dump is required - - More info: - http://www.8bit-micro.com/laser.htm - http://www.euskalnet.net/ingepal/images/Vtech_Laser_PC4_1988.jpg - http://www.oldcomputermuseum.com/laser_pc4.html - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/rp5c01.h" -#include "rendlay.h" -#include "includes/pc4.h" - - -READ8_MEMBER( pc4_state::kb_r ) -{ - UINT8 data = 0xff; - - for (int line=0; line<8; line++) - { - if (!(offset & (1<read(); - } - } - - return data; -} - -WRITE8_MEMBER( pc4_state::bank_w ) -{ - //printf("set bank %x\n", data); - m_rombank->set_entry(data&0x07); -} - -WRITE8_MEMBER( pc4_state::beep_w ) -{ - m_beep->set_state(data&0x40); -} - -static ADDRESS_MAP_START(pc4_mem, AS_PROGRAM, 8, pc4_state) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("rombank") - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pc4_io, AS_IO, 8, pc4_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("rtc", rp5c01_device, read, write) - AM_RANGE(0x1000, 0x1000) AM_WRITE(beep_w) - AM_RANGE(0x1fff, 0x1fff) AM_WRITE(bank_w) - - AM_RANGE(0x3000, 0x3000) AM_WRITE(lcd_control_w) - AM_RANGE(0x3001, 0x3001) AM_WRITE(lcd_data_w) - AM_RANGE(0x3002, 0x3002) AM_READ(lcd_control_r) - AM_RANGE(0x3003, 0x3003) AM_READ(lcd_data_r) - AM_RANGE(0x3005, 0x3005) AM_WRITE(lcd_offset_w) - - //keyboard read, offset used as matrix - AM_RANGE(0x5000, 0x50ff) AM_READ(kb_r) -ADDRESS_MAP_END - -static INPUT_PORTS_START( pc4 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('/') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('?') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLOck") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_UNUSED -INPUT_PORTS_END - -PALETTE_INIT_MEMBER(pc4_state, pc4) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static const gfx_layout pc4_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( pc4 ) - GFXDECODE_ENTRY( "charset", 0x0000, pc4_charlayout, 0, 1 ) -GFXDECODE_END - -void pc4_state::machine_start() -{ - static const char *const bitnames[] = {"LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7"}; - UINT8* rom_base = (UINT8 *)memregion("maincpu")->base(); - - m_rombank->configure_entries(0, 8, rom_base, 0x4000); - m_rombank->set_entry(0); - - m_busy_timer = timer_alloc(BUSY_TIMER); - m_blink_timer = timer_alloc(BLINKING_TIMER); - m_blink_timer->adjust(attotime::from_msec(409), 0, attotime::from_msec(409)); - - for (int i=0; i<8; i++) - { - io_port[i] = ioport(bitnames[i]); - } - - m_ac = 0; - m_ac_mode = 0; - m_data_bus_flag = 0; - m_cursor_pos = 0; - m_display_on = 0; - m_cursor_on = 0; - m_shift_on = 0; - m_blink_on = 0; - m_direction = 1; - m_disp_shift = 0; - m_blink = 0; -} - -static MACHINE_CONFIG_START( pc4, pc4_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(pc4_mem) - MCFG_CPU_IO_MAP(pc4_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(72) - MCFG_SCREEN_UPDATE_DRIVER(pc4_state, screen_update) - MCFG_SCREEN_SIZE(240, 36) - MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 36-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pc4_state, pc4) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc4) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) -MACHINE_CONFIG_END - -ROM_START( pc4 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "laser pc4 v4.14a.u2", 0x00000, 0x20000, CRC(f8dabf5d) SHA1(6988517b3ccb42df2b8d6e1517ff04b24458d146) ) - ROM_REGION( 0x0860, "charset", ROMREGION_ERASE ) - ROM_LOAD( "44780a00.bin", 0x0000, 0x0860, BAD_DUMP CRC(3a89024c) SHA1(5a87b68422a916d1b37b5be1f7ad0b3fb3af5a8d)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1990, pc4, 0, 0, pc4, pc4, driver_device, 0, "Laser Computer", "Laser PC4", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pc6001.c b/src/mess/drivers/pc6001.c deleted file mode 100644 index aadd261c5b0..00000000000 --- a/src/mess/drivers/pc6001.c +++ /dev/null @@ -1,2476 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/******************************************************************************************************************************************************* - - PC-6001 series (c) 1981 NEC - - driver by Angelo Salese - - TODO: - - Hook up tape loading, images that are floating around the net are already - ADC'ed, so they should be easy to implement (but not exactly faithful) - - cassette handling requires a decap of the MCU. It could be possible to - do some tight synch between the master CPU and a code simulation,but I think - it's not worth the effort... - - Identify and hook-up the FDC device, apparently PC-6001 and PC-6601 doesn't even use the same thing; - - PC-6601: mon r-0 type games doesn't seem to work at all on this system? - - PC-6001SR: get it to boot, also implement MK-2 compatibility mode (it changes the memory map to behave like the older versions) - - Currently rewriting the video part without the MC6847 for two reasons: - A) the later models have a custom video chip in the place of the MC6847, - so this implementation will be used in the end. - B) It's easier to me to see what the attribute vram does since I don't - have any docs atm. - - TODO (game specific): - - (several AX* games, namely Galaxy Mission Part 1/2 and others): inputs doesn't work - - AX6 - Demo: When AY-based speech talks, other emus emulates the screen drawing to be a solid green (plain PC-6001) or solid white (Mk2 version), - but, according to an original video reference that I've seen, that screen should actually some kind of weird garbage on it ... - - AX6 - Powered Knight: doesn't work too well, according to the asm code it asks the player to press either 'B' or 'C' then a number but - nothing is shown on screen, other emus behaves the same, bad dump? - - Dawn Patrol (cart): presumably too slow; - (Mk2 mode 5 games) - - 3D Golf Simulation Super Version: gameplay / inputs seems broken - - American Truck: Screen is offset at the loading screen, loading bug? - - Castle Excellent: copyright text drawing is quite bogus, scans text in vertical instead of horizontal? - - Dezeni Land (ALL versions) / Hurry Fox 1/2: asks you to "load something", can't do it with current cassette kludge, also, for Dezeni Land(s) keyboard irqs - doesn't seem to work too well with halt opcode execution? - - Dezeni Land 1/4: dies after loading of main program - - Dezeni Land 2: dies at the "load something" screen with presumably wrong stack opcodes - - (MyCom BASIC games with multiple files): most of them refuses to run ... how to load them? - - Grobda: when "get ready" speech plays, screen should be full white but instead it's all black, same issue as AX-6 Demo? - - Pac-Man / Tiny Xevious 2: gameplay is too fast - - Salad no Kunino Tomato-Hime: can't start a play - - Space Harrier: inputs doesn't work properly - - The Black Onyx: dies when it attempts to save the character, that obviously means saving on the tape - - Yakyukyo / Punchball Mario: waits for an irq, check which one; - -======================================================================================================================================================== - - PC-6001 (1981-09): - - * CPU: Z80A @ 4 MHz - * ROM: 16KB + 4KB (chargen) - no kanji - * RAM: 16KB, it can be expanded to 32KB - * Text Mode: 32x16 and 2 colors - * Graphic Modes: 64x48 (9 colors), 128x192 (4 colors), 256x192 (2 colors) - * Sound: BEEP + PSG - Optional Voice Synth Cart - * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, - HOME/CLR key, INS key, DEL key, GRAPH key, Japanese syllabary - key, page key, STOP key, and cursor key (4 directions) - * 1 cartslot, optional floppy drive, optional serial 232 port, 2 - joystick ports - - - PC-6001 mkII (1983-07): - - * CPU: Z80A @ 4 MHz - * ROM: 32KB + 16KB (chargen) + 32KB (kanji) + 16KB (Voice Synth) - * RAM: 64KB - * Text Mode: same as PC-6001 with N60-BASIC; 40x20 and 15 colors with - N60M-BASIC - * Graphic Modes: same as PC-6001 with N60-BASIC; 80x40 (15 colors), - 160x200 (15 colors), 320x200 (4 colors) with N60M-BASIC - * Sound: BEEP + PSG - * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, - HOME/CLR key, INS key, DEL key, CAPS key, GRAPH key, Japanese - syllabary key, page key, mode key, STOP key, and cursor key (4 - directions) - * 1 cartslot, floppy drive, optional serial 232 port, 2 joystick ports - - - PC-6001 mkIISR (1984-12): - - * CPU: Z80A @ 3.58 MHz - * ROM: 64KB + 16KB (chargen) + 32KB (kanji) + 32KB (Voice Synth) - * RAM: 64KB - * Text Mode: same as PC-6001/PC-6001mkII with N60-BASIC; 40x20, 40x25, - 80x20, 80x25 and 15 colors with N66SR-BASIC - * Graphic Modes: same as PC-6001/PC-6001mkII with N60-BASIC; 80x40 (15 colors), - 320x200 (15 colors), 640x200 (15 colors) with N66SR-BASIC - * Sound: BEEP + PSG + FM - * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, - HOME/CLR key, INS key, DEL key, CAPS key, GRAPH key, Japanese - syllabary key, page key, mode key, STOP key, and cursor key (4 - directions) - * 1 cartslot, floppy drive, optional serial 232 port, 2 joystick ports - - - info from http://www.geocities.jp/retro_zzz/machines/nec/6001/spc60.html - -================================================================================== - -PC-6001 irq table: -irq vector 0x00: writes 0x00 to [$fa19] ;(unused) -irq vector 0x02: (A = 0, B = 0) tests ppi port c, does something with ay ports (plus more?) ;keyboard data ready, no kanji lock, no caps lock -irq vector 0x04: ;uart irq -irq vector 0x06: operates with $fa28, $fa2e, $fd1b ;timer irq -irq vector 0x08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19] ;tape data ready -irq vector 0x0a: writes 0x00 to [$fa19] ;(unused) -irq vector 0x0c: writes 0x00 to [$fa19] ;(unused) -irq vector 0x0e: same as 2, (A = 0x03, B = 0x00) ;keyboard data ready, unknown type -irq vector 0x10: same as 2, (A = 0x03, B = 0x00) ;(unused) -irq vector 0x12: writes 0x10 to [$fa19] ;end of tape reached -irq vector 0x14: same as 2, (A = 0x00, B = 0x01) ;kanji lock enabled -irq vector 0x16: tests ppi port c, writes the result to $feca. ;joystick -irq vector 0x18: ;TVR (?) -irq vector 0x1a: ;Date -irq vector 0x1c: ;(unused) -irq vector 0x1e: ;(unused) -irq vector 0x20: ;voice -irq vector 0x22: ;VRTC (?) -irq vector 0x24: ;(unused) -irq vector 0x26: ;(unused) - - -*******************************************************************************************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "video/mc6847.h" -#include "sound/ay8910.h" -#include "sound/upd7752.h" -#include "sound/wave.h" - -#include "imagedev/cassette.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "formats/p6001_cas.h" - - -class pc6001_state : public driver_device -{ -public: - pc6001_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_ppi(*this, "ppi8255"), - m_ram(*this, "ram"), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_cas_hack(*this, "cas_hack"), - m_cart(*this, "cartslot"), - m_region_maincpu(*this, "maincpu"), - m_region_gfx1(*this, "gfx1"), - m_io_mode4_dsw(*this, "MODE4_DSW"), - m_io_p1(*this, "P1"), - m_io_p2(*this, "P2"), - m_io_key1(*this, "key1"), - m_io_key2(*this, "key2"), - m_io_key3(*this, "key3"), - m_io_key_modifiers(*this, "key_modifiers"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_bank5(*this, "bank5"), - m_bank6(*this, "bank6"), - m_bank7(*this, "bank7"), - m_bank8(*this, "bank8"), - m_palette(*this, "palette") { } - - required_device m_ppi; - - optional_shared_ptr m_ram; - UINT8 *m_video_ram; - UINT8 m_irq_vector; - UINT8 m_cas_switch; - UINT8 m_sys_latch; - UINT8 m_timer_irq_mask; - UINT32 m_cas_offset; - UINT32 m_cas_maxsize; - emu_timer *m_timer_irq_timer; - UINT16 m_timer_hz_div; - UINT8 m_ex_vram_bank; - UINT8 m_bgcol_bank; - UINT8 m_exgfx_text_mode; - UINT8 m_exgfx_bitmap_mode; - UINT8 m_exgfx_2bpp_mode; - UINT8 m_bank_r0; - UINT8 m_bank_r1; - UINT8 m_gfx_bank_on; - UINT8 m_bank_w; - UINT8 m_bank_opt; - UINT8 m_timer_irq_mask2; - UINT8 m_timer_irq_vector; - UINT32 m_cgrom_bank_addr; - UINT8 m_sr_video_mode; - UINT8 m_port_c_8255; - UINT8 m_cur_keycode; - UINT8 m_sr_bank_r[8]; - UINT8 m_sr_bank_w[8]; - UINT8 m_kludge; - UINT32 m_old_key1; - UINT32 m_old_key2; - UINT32 m_old_key3; - DECLARE_WRITE8_MEMBER(pc6001_system_latch_w); - DECLARE_READ8_MEMBER(nec_ppi8255_r); - DECLARE_WRITE8_MEMBER(nec_ppi8255_w); - DECLARE_WRITE8_MEMBER(pc6001m2_bank_r0_w); - DECLARE_WRITE8_MEMBER(pc6001m2_bank_r1_w); - DECLARE_WRITE8_MEMBER(pc6001m2_bank_w0_w); - DECLARE_WRITE8_MEMBER(pc6001m2_opt_bank_w); - DECLARE_WRITE8_MEMBER(work_ram0_w); - DECLARE_WRITE8_MEMBER(work_ram1_w); - DECLARE_WRITE8_MEMBER(work_ram2_w); - DECLARE_WRITE8_MEMBER(work_ram3_w); - DECLARE_WRITE8_MEMBER(work_ram4_w); - DECLARE_WRITE8_MEMBER(work_ram5_w); - DECLARE_WRITE8_MEMBER(work_ram6_w); - DECLARE_WRITE8_MEMBER(work_ram7_w); - DECLARE_WRITE8_MEMBER(necmk2_ppi8255_w); - DECLARE_WRITE8_MEMBER(pc6001m2_system_latch_w); - DECLARE_WRITE8_MEMBER(pc6001m2_vram_bank_w); - DECLARE_WRITE8_MEMBER(pc6001m2_col_bank_w); - DECLARE_WRITE8_MEMBER(pc6001m2_0xf3_w); - DECLARE_WRITE8_MEMBER(pc6001m2_timer_adj_w); - DECLARE_WRITE8_MEMBER(pc6001m2_timer_irqv_w); - DECLARE_READ8_MEMBER(pc6001m2_bank_r0_r); - DECLARE_READ8_MEMBER(pc6001m2_bank_r1_r); - DECLARE_READ8_MEMBER(pc6001m2_bank_w0_r); - DECLARE_READ8_MEMBER(pc6601_fdc_r); - DECLARE_WRITE8_MEMBER(pc6601_fdc_w); - DECLARE_READ8_MEMBER(pc6001sr_bank_rn_r); - DECLARE_WRITE8_MEMBER(pc6001sr_bank_rn_w); - DECLARE_READ8_MEMBER(pc6001sr_bank_wn_r); - DECLARE_WRITE8_MEMBER(pc6001sr_bank_wn_w); - DECLARE_WRITE8_MEMBER(sr_work_ram0_w); - DECLARE_WRITE8_MEMBER(sr_work_ram1_w); - DECLARE_WRITE8_MEMBER(sr_work_ram2_w); - DECLARE_WRITE8_MEMBER(sr_work_ram3_w); - DECLARE_WRITE8_MEMBER(sr_work_ram4_w); - DECLARE_WRITE8_MEMBER(sr_work_ram5_w); - DECLARE_WRITE8_MEMBER(sr_work_ram6_w); - DECLARE_WRITE8_MEMBER(sr_work_ram7_w); - DECLARE_WRITE8_MEMBER(pc6001sr_mode_w); - DECLARE_WRITE8_MEMBER(pc6001sr_vram_bank_w); - DECLARE_WRITE8_MEMBER(pc6001sr_system_latch_w); - DECLARE_WRITE8_MEMBER(necsr_ppi8255_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(pc6001); - DECLARE_MACHINE_RESET(pc6001m2); - DECLARE_PALETTE_INIT(pc6001m2); - DECLARE_MACHINE_RESET(pc6001sr); - UINT32 screen_update_pc6001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_pc6001m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(pc6001_interrupt); - INTERRUPT_GEN_MEMBER(pc6001sr_interrupt); - TIMER_CALLBACK_MEMBER(audio_callback); - TIMER_DEVICE_CALLBACK_MEMBER(cassette_callback); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); - DECLARE_READ8_MEMBER(pc6001_8255_porta_r); - DECLARE_WRITE8_MEMBER(pc6001_8255_porta_w); - DECLARE_READ8_MEMBER(pc6001_8255_portb_r); - DECLARE_WRITE8_MEMBER(pc6001_8255_portb_w); - DECLARE_WRITE8_MEMBER(pc6001_8255_portc_w); - DECLARE_READ8_MEMBER(pc6001_8255_portc_r); - IRQ_CALLBACK_MEMBER(pc6001_irq_callback); -protected: - required_device m_maincpu; - optional_device m_cassette; - optional_device m_cas_hack; - required_device m_cart; - required_memory_region m_region_maincpu; - required_memory_region m_region_gfx1; - required_ioport m_io_mode4_dsw; - required_ioport m_io_p1; - required_ioport m_io_p2; - required_ioport m_io_key1; - required_ioport m_io_key2; - required_ioport m_io_key3; - required_ioport m_io_key_modifiers; - required_memory_bank m_bank1; - optional_memory_bank m_bank2; - optional_memory_bank m_bank3; - optional_memory_bank m_bank4; - optional_memory_bank m_bank5; - optional_memory_bank m_bank6; - optional_memory_bank m_bank7; - optional_memory_bank m_bank8; - required_device m_palette; - - memory_region *m_cart_rom; - - void draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr); - void draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr); - void draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr); - void draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr,int has_mc6847); - void draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr,int has_mc6847); - void pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &cliprect, int has_mc6847); - UINT8 check_joy_press(); - UINT8 check_keyboard_press(); - void vram_bank_change(UINT8 vram_bank); - ATTR_CONST UINT8 pc6001_get_attributes(UINT8 c,int scanline, int pos); - const UINT8 *pc6001_get_video_ram(int scanline); - UINT8 pc6001_get_char_rom(UINT8 ch, int line); -}; - - -/* PC6001mk2 specific */ -/* PC6001SR specific */ - -#define IRQ_LOG (0) - -void pc6001_state::video_start() -{ - #if 0 - m6847_config cfg; - - memset(&cfg, 0, sizeof(cfg)); - cfg.type = M6847_VERSION_M6847T1_NTSC; - cfg.get_attributes = pc6001_get_attributes; - cfg.get_video_ram = pc6001_get_video_ram; - cfg.get_char_rom = pc6001_get_char_rom; - m6847_init(machine(), &cfg); - #endif - m_video_ram = auto_alloc_array(machine(), UINT8, 0x4000); -} - -/* this is known as gfx mode 4 */ -void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr) -{ - int x,y,xi; - int fgcol,color; - int col_setting; - static const UINT8 pen_gattr[4][4] = { - { 0, 1, 6, 2 }, //Red / Blue - { 0, 6, 1, 2 }, //Blue / Red - { 0, 5, 2, 2 }, //Pink / Green - { 0, 2, 5, 2 }, //Green / Pink - }; - static const UINT8 pen_wattr[4][4] = { - { 0, 1, 6, 7 }, //Red / Blue - { 0, 6, 1, 7 }, //Blue / Red - { 0, 5, 2, 7 }, //Pink / Green - { 0, 2, 5, 7 }, //Green / Pink - }; - col_setting = m_io_mode4_dsw->read() & 7; - - if((attr & 0x0c) != 0x0c) - popmessage("Mode 4 vram attr != 0x0c, contact MESSdev"); - - for(y=0;y<192;y++) - { - for(x=0;x<32;x++) - { - int tile = m_video_ram[(x+(y*32))+0x200]; - - if(col_setting == 0x00) //monochrome - { - for(xi=0;xi<8;xi++) - { - fgcol = (attr & 2) ? 7 : 2; - - color = ((tile)>>(7-xi) & 1) ? fgcol : 0; - - bitmap.pix16((y+24), (x*8+xi)+32) = m_palette->pen(color); - } - } - else - { - for(xi=0;xi<4;xi++) - { - fgcol = ((tile)>>(6-(xi*2)) & 3); - - color = (attr & 2) ? (pen_wattr[col_setting-1][fgcol]) : (pen_gattr[col_setting-1][fgcol]); - - bitmap.pix16((y+24), ((x*8+xi*2)+0)+32) = m_palette->pen(color); - bitmap.pix16((y+24), ((x*8+xi*2)+1)+32) = m_palette->pen(color); - } - } - } - } -} - -void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr) -{ - int color,x,y,xi,yi; - - int shrink_x = 2*4; - int shrink_y = (attr & 8) ? 1 : 2; - int w = (shrink_x == 8) ? 32 : 16; - int col_bank = ((attr & 2)<<1); - - if(attr & 4) - { - for(y=0;y<(192/shrink_y);y++) - { - for(x=0;x>1; - color = ((tile >> i) & 3)+8; - color+= col_bank; - - bitmap.pix16(((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - } - } - } - } - } - else /* TODO: clean this up */ - { - for(y=0;y<(192/shrink_y);y+=3) - { - for(x=0;x>1; - color = ((tile >> i) & 3)+8; - color+= col_bank; - - bitmap.pix16((((y+0)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - bitmap.pix16((((y+1)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - bitmap.pix16((((y+2)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - } - } - } - } - } -} - -void pc6001_state::draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr) -{ - int color,pen,xi,yi; - - if(attr & 0x10) //2x2 squares on a single cell - pen = (tile & 0x70)>>4; - else //2x3 - pen = (tile & 0xc0) >> 6 | (attr & 2)<<1; - - for(yi=0;yi<12;yi++) - { - for(xi=0;xi<8;xi++) - { - int i; - i = (xi & 4)>>2; //x-axis - if(attr & 0x10) //2x2 - { - i+= (yi >= 6) ? 2 : 0; //y-axis - } - else //2x3 - { - i+= (yi & 4)>>1; //y-axis 1 - i+= (yi & 8)>>1; //y-axis 2 - } - - color = ((tile >> i) & 1) ? pen+8 : 0; - - bitmap.pix16(((y*12+(11-yi))+24), (x*8+(7-xi))+32) = m_palette->pen(color); - } - } -} - -void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr,int has_mc6847) -{ - int xi,yi,pen,fgcol,color; - UINT8 *gfx_data = m_region_gfx1->base(); - - for(yi=0;yi<12;yi++) - { - for(xi=0;xi<8;xi++) - { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - - if(has_mc6847) - { - fgcol = (attr & 2) ? 0x12 : 0x10; - - if(attr & 1) - color = pen ? (fgcol+0) : (fgcol+1); - else - color = pen ? (fgcol+1) : (fgcol+0); - - } - else - { - fgcol = (attr & 2) ? 2 : 7; - - if(attr & 1) - color = pen ? 0 : fgcol; - else - color = pen ? fgcol : 0; - } - - bitmap.pix16(((y*12+yi)+24), (x*8+xi)+32) = m_palette->pen(color); - } - } -} - -void pc6001_state::draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr,int has_mc6847) -{ - int x,y,color; - - for(y=0;y<240;y++) - { - for(x=0;x<320;x++) - { - if(!has_mc6847) //mk2 border color is always black - color = 0; - else if((attr & 0x90) == 0x80) //2bpp - color = ((attr & 2)<<1) + 8; - else if((attr & 0x90) == 0x90) //1bpp - color = (attr & 2) ? 7 : 2; - else - color = 0; //FIXME: other modes not yet checked - - bitmap.pix16(y, x) = m_palette->pen(color); - } - } -} - -void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &cliprect, int has_mc6847) -{ - int x,y; - int tile,attr; - - attr = m_video_ram[0]; - - draw_border(bitmap,cliprect,attr,has_mc6847); - - if(attr & 0x80) // gfx mode - { - if(attr & 0x10) // 256x192x1 mode (FIXME: might be a different trigger) - { - draw_gfx_mode4(bitmap,cliprect,attr); - } - else // 128x192x2 mode - { - draw_bitmap_2bpp(bitmap,cliprect,attr); - } - } - else // text mode - { - for(y=0;y<16;y++) - { - for(x=0;x<32;x++) - { - tile = m_video_ram[(x+(y*32))+0x200]; - attr = m_video_ram[(x+(y*32)) & 0x1ff]; - - if(attr & 0x40) - { - draw_tile_3bpp(bitmap,cliprect,x,y,tile,attr); - } - else - { - draw_tile_text(bitmap,cliprect,x,y,tile,attr,has_mc6847); - } - } - } - } -} - -UINT32 pc6001_state::screen_update_pc6001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - pc6001_screen_draw(bitmap,cliprect,1); - - return 0; -} - -UINT32 pc6001_state::screen_update_pc6001m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,tile,attr; - - /* note: bitmap mode have priority over everything else, check American Truck */ - if(m_exgfx_bitmap_mode) - { - int count,color,i; - - count = 0; - - for(y=0;y<200;y++) - { - for(x=0;x<160;x+=4) - { - for(i=0;i<4;i++) - { - int pen[2]; -#if 0 - /* palette reference: */ - static const UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05, - 0x02, 0x06, 0x03, 0x07, - 0x08, 0x0c, 0x09, 0x0d, - 0x0a, 0x0e, 0x0b, 0x0f }; - - color |= pal_num[(pen[0] & 3) | ((pen[1] & 3) << 2)]; -#endif - - pen[0] = m_video_ram[count+0x0000] >> (6-i*2) & 3; - pen[1] = m_video_ram[count+0x2000] >> (6-i*2) & 3; - - color = 0x10; - color |= ((pen[0] & 1) << 2); - color |= ((pen[0] & 2) >> 1); - color |= ((pen[1] & 1) << 1); - color |= ((pen[1] & 2) << 2); - - if (cliprect.contains((x+i)*2+0, y)) - bitmap.pix16(y, (x+i)*2+0) = m_palette->pen(color); - if (cliprect.contains((x+i)*2+1, y)) - bitmap.pix16(y, (x+i)*2+1) = m_palette->pen(color); - } - - count++; - } - } - } - else if(m_exgfx_2bpp_mode) - { - int count,color,i; - - count = 0; - - for(y=0;y<200;y++) - { - for(x=0;x<320;x+=8) - { - for(i=0;i<8;i++) - { - int pen[2]; -#if 0 - /* palette reference: */ - static const UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05 }; - - color |= pal_num[(pen[0] & 1) | ((pen[1] & 1) << 1)]; -#endif - - pen[0] = m_video_ram[count+0x0000] >> (7-i) & 1; - pen[1] = m_video_ram[count+0x2000] >> (7-i) & 1; - - if(m_bgcol_bank & 4) //PC-6001 emulation mode - { - color = 0x08; - color |= (pen[0]) | (pen[1]<<1); - color |= (m_bgcol_bank & 1) << 2; - } - else //Mk-2 mode - { - color = 0x10; - color |= ((pen[0] & 1) << 2); - color |= ((pen[1] & 1) >> 0); - color |= ((m_bgcol_bank & 1) << 1); - color |= ((m_bgcol_bank & 2) << 2); - } - - if (cliprect.contains(x+i, y)) - bitmap.pix16(y, (x+i)) = m_palette->pen(color); - } - - count++; - } - } - - } - else if(m_exgfx_text_mode) - { - int xi,yi,pen,fgcol,bgcol,color; - UINT8 *gfx_data = m_region_gfx1->base(); - - for(y=0;y<20;y++) - { - for(x=0;x<40;x++) - { - /* - exgfx attr format: - x--- ---- rom bank select - -xxx ---- bg color - ---- xxxx fg color - Note that the exgfx banks a different gfx ROM - */ - tile = m_video_ram[(x+(y*40))+0x400] + 0x200; - attr = m_video_ram[(x+(y*40)) & 0x3ff]; - tile+= ((attr & 0x80) << 1); - - for(yi=0;yi<12;yi++) - { - for(xi=0;xi<8;xi++) - { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - - fgcol = (attr & 0x0f) + 0x10; - bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); - - color = pen ? fgcol : bgcol; - - if (cliprect.contains(x*8+xi, y*12+yi)) - bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); - } - } - } - } - } - else - { - attr = m_video_ram[0]; - pc6001_screen_draw(bitmap,cliprect,0); - } - - return 0; -} - -UINT32 pc6001_state::screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,tile,attr; - int xi,yi,pen,fgcol,bgcol,color; - UINT8 *gfx_data = m_region_gfx1->base(); - - - if(m_sr_video_mode & 8) // text mode - { - for(y=0;y<20;y++) - { - for(x=0;x<40;x++) - { - tile = m_video_ram[(x+(y*40))*2+0]; - attr = m_video_ram[(x+(y*40))*2+1]; - tile+= ((attr & 0x80) << 1); - - for(yi=0;yi<12;yi++) - { - for(xi=0;xi<8;xi++) - { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - - fgcol = (attr & 0x0f) + 0x10; - bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); - - color = pen ? fgcol : bgcol; - - if (cliprect.contains(x*8+xi, y*12+yi)) - bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); - } - } - } - } - } - else //4bpp bitmap mode (TODO) - { - int count; - - count = 0; - - for(y=0;y<200;y+=2) - { - for(x=0;x<320;x+=4) - { - color = m_video_ram[count] & 0x0f; - - if (cliprect.contains(x+0, y+0)) - bitmap.pix16((y+0), (x+0)) = m_palette->pen(color+0x10); - - color = (m_video_ram[count] & 0xf0) >> 4; - - if (cliprect.contains(x+1, y+0)) - bitmap.pix16((y+0), (x+1)) = m_palette->pen(color+0x10); - - color = m_video_ram[count+1] & 0x0f; - - if (cliprect.contains(x+2, y+0)) - bitmap.pix16((y+0), (x+2)) = m_palette->pen(color+0x10); - - color = (m_video_ram[count+1] & 0xf0) >> 4; - - if (cliprect.contains(x+3, y+0)) - bitmap.pix16((y+0), (x+3)) = m_palette->pen(color+0x10); - - color = m_video_ram[count+2] & 0x0f; - - if (cliprect.contains(x+0, y+1)) - bitmap.pix16((y+1), (x+0)) = m_palette->pen(color+0x10); - - color = (m_video_ram[count+2] & 0xf0) >> 4; - - if (cliprect.contains(x+1, y+1)) - bitmap.pix16((y+1), (x+1)) = m_palette->pen(color+0x10); - - color = m_video_ram[count+3] & 0x0f; - - if (cliprect.contains(x+2, y+1)) - bitmap.pix16((y+1), (x+2)) = m_palette->pen(color+0x10); - - color = (m_video_ram[count+3] & 0xf0) >> 4; - - if (cliprect.contains(x+3, y+1)) - bitmap.pix16((y+1), (x+3)) = m_palette->pen(color+0x10); - - - count+=4; - } - } - } - - return 0; -} - -WRITE8_MEMBER(pc6001_state::pc6001_system_latch_w) -{ - static const UINT16 startaddr[] = {0xC000, 0xE000, 0x8000, 0xA000 }; - - m_video_ram = m_ram + startaddr[(data >> 1) & 0x03] - 0x8000; - - if((!(m_sys_latch & 8)) && data & 0x8) //PLAY tape cmd - { - m_cas_switch = 1; - //m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - //m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); - } - if((m_sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd - { - m_cas_switch = 0; - //m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - //m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - //m_irq_vector = 0x00; - //m_maincpu->set_input_line(0, ASSERT_LINE); - } - - m_sys_latch = data; - m_timer_irq_mask = data & 1; - //printf("%02x\n",data); -} - -#if 0 -ATTR_CONST pc6001_state::UINT8 pc6001_get_attributes(UINT8 c,int scanline, int pos) -{ - UINT8 result = 0x00; - UINT8 val = m_video_ram [(scanline / 12) * 0x20 + pos]; - - if (val & 0x01) { - result |= M6847_INV; - } - if (val & 0x40) - result |= M6847_AG | M6847_GM1; //TODO - - result |= M6847_INTEXT; // always use external ROM - return result; -} - -const pc6001_state::UINT8 *pc6001_get_video_ram(int scanline) -{ - return m_video_ram +0x0200+ (scanline / 12) * 0x20; -} - -UINT8 pc6001_state::pc6001_get_char_rom(UINT8 ch, int line) -{ - UINT8 *gfx = m_region_gfx1->base(); - return gfx[ch*16+line]; -} -#endif - - -READ8_MEMBER(pc6001_state::nec_ppi8255_r) -{ - if (offset==2) - return m_port_c_8255; - else if(offset==0) - { - UINT8 res; - res = m_cur_keycode; - //m_cur_keycode = 0; - return res; - } - - return m_ppi->read(space, offset); -} - -WRITE8_MEMBER(pc6001_state::nec_ppi8255_w) -{ - if (offset==3) - { - if(data & 1) - m_port_c_8255 |= 1<<((data>>1)&0x07); - else - m_port_c_8255 &= ~(1<<((data>>1)&0x07)); - - switch(data) { - case 0x08: m_port_c_8255 |= 0x88; break; - case 0x09: m_port_c_8255 &= 0xf7; break; - case 0x0c: m_port_c_8255 |= 0x28; break; - case 0x0d: m_port_c_8255 &= 0xf7; break; - default: break; - } - - m_port_c_8255 |= 0xa8; - - { - //printf("%02x\n",data); - - if ((data & 0x0f) == 0x05 && m_cart_rom) - m_bank1->set_base(m_cart_rom->base() + 0x2000); - if ((data & 0x0f) == 0x04) - m_bank1->set_base(m_region_gfx1->base()); - } - } - m_ppi->write(space,offset,data); -} - -static ADDRESS_MAP_START(pc6001_map, AS_PROGRAM, 8, pc6001_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP - //AM_RANGE(0x4000, 0x5fff) // mapped by the cartslot - AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc6001_io , AS_IO, 8, pc6001_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_READWRITE(nec_ppi8255_r, nec_ppi8255_w) - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, data_w) - AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_device, data_r) - AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_WRITENOP - AM_RANGE(0xb0, 0xb0) AM_MIRROR(0x0f) AM_WRITE(pc6001_system_latch_w) - AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x0c) AM_NOP // disk device -ADDRESS_MAP_END - -/* - ROM_REGION( 0x28000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "basicrom.62", 0x10000, 0x8000, CRC(950ac401) SHA1(fbf195ba74a3b0f80b5a756befc96c61c2094182) ) - ROM_LOAD( "voicerom.62", 0x18000, 0x4000, CRC(49b4f917) SHA1(1a2d18f52ef19dc93da3d65f19d3abbd585628af) ) - ROM_LOAD( "cgrom60.62", 0x1c000, 0x2000, CRC(81eb5d95) SHA1(53d8ae9599306ff23bf95208d2f6cc8fed3fc39f) ) - ROM_LOAD( "cgrom60m.62", 0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) - ROM_LOAD( "kanjirom.62", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) -*/ - -#define BASICROM(_v_) \ - 0x10000+0x2000*_v_ -#define VOICEROM(_v_) \ - 0x18000+0x2000*_v_ -#define TVROM(_v_) \ - 0x1c000+0x2000*_v_ -#define KANJIROM(_v_) \ - 0x20000+0x2000*_v_ -#define WRAM(_v_) \ - 0x28000+0x2000*_v_ -#define EXWRAM(_v_) \ - 0x38000+0x2000*_v_ -#define EXROM(_v_) \ - 0x48000+0x2000*_v_ -#define INVALID(_v_) \ - 0x4c000+0x2000*_v_ -/* FIXME: some comments aren't right */ -static const UINT32 banksw_table_r0[0x10*4][4] = { - /* 0 */ - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: - { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 - { TVROM(0), TVROM(1), VOICEROM(0), VOICEROM(1) }, //0x02: tv rom 0 & 1 / voice rom 0 & 1 - { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 - { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 - { TVROM(1), BASICROM(1), VOICEROM(0), BASICROM(3) }, //0x05: tv rom 1 & basic rom 1 / voice rom 0 & basic 3 - { BASICROM(0), TVROM(2), BASICROM(2), VOICEROM(1) }, //0x06: basic rom 0 & tv rom 2 / basic rom 2 & voice 1 - { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 - { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 - { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 - { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 - { EXROM(0), TVROM(2), EXROM(0), VOICEROM(1) }, //0x0b: ex rom 0 & tv rom 2 / ex rom 0 & voice 1 - { TVROM(1), EXROM(0), VOICEROM(0), EXROM(0) }, //0x0c: tv rom 1 & ex rom 0 / voice rom 0 & ex rom 0 - { WRAM(0), WRAM(1), WRAM(2), WRAM(3) }, //0x0d: ram 0 & 1 / ram 2 & 3 - { EXWRAM(0), EXWRAM(1), EXWRAM(2), EXWRAM(3) }, //0x0e: exram 0 & 1 / exram 2 & 3 - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: - /* 1 */ - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: - { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 - { KANJIROM(0), KANJIROM(1), KANJIROM(0), KANJIROM(1) }, //0x02: tv rom 0 & 1 / voice rom 0 & 1 - { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 - { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 - { KANJIROM(0), BASICROM(1), KANJIROM(0), BASICROM(3) }, //0x05: tv rom 1 & basic rom 1 / voice rom 0 & basic 3 - { BASICROM(0), KANJIROM(1), BASICROM(2), KANJIROM(1) }, //0x06: basic rom 0 & tv rom 2 / basic rom 2 & voice 1 - { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 - { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 - { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 - { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 - { EXROM(0), KANJIROM(1), EXROM(0), KANJIROM(1) }, //0x0b: ex rom 0 & tv rom 2 / ex rom 0 & voice 1 - { KANJIROM(0), EXROM(0), KANJIROM(0), EXROM(0) }, //0x0c: tv rom 1 & ex rom 0 / voice rom 0 & ex rom 0 - { WRAM(0), WRAM(1), WRAM(2), WRAM(3) }, //0x0d: ram 0 & 1 / ram 2 & 3 - { EXWRAM(0), EXWRAM(1), EXWRAM(2), EXWRAM(3) }, //0x0e: exram 0 & 1 / exram 2 & 3 - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: - /* 2 */ - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: - { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 - { TVROM(0), TVROM(1), VOICEROM(0), VOICEROM(1) }, //0x02: tv rom 0 & 1 / voice rom 0 & 1 - { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 - { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 - { TVROM(1), BASICROM(1), VOICEROM(0), BASICROM(3) }, //0x05: tv rom 1 & basic rom 1 / voice rom 0 & basic 3 - { BASICROM(0), TVROM(2), BASICROM(2), VOICEROM(1) }, //0x06: basic rom 0 & tv rom 2 / basic rom 2 & voice 1 - { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 - { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 - { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 - { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 - { EXROM(0), TVROM(2), EXROM(0), VOICEROM(1) }, //0x0b: ex rom 0 & tv rom 2 / ex rom 0 & voice 1 - { TVROM(1), EXROM(0), VOICEROM(0), EXROM(0) }, //0x0c: tv rom 1 & ex rom 0 / voice rom 0 & ex rom 0 - { WRAM(0), WRAM(1), WRAM(2), WRAM(3) }, //0x0d: ram 0 & 1 / ram 2 & 3 - { EXWRAM(0), EXWRAM(1), EXWRAM(2), EXWRAM(3) }, //0x0e: exram 0 & 1 / exram 2 & 3 - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: - /* 3 */ - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: - { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 - { KANJIROM(2), KANJIROM(3), KANJIROM(2), KANJIROM(3) }, //0x02: tv rom 0 & 1 / voice rom 0 & 1 - { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 - { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 - { KANJIROM(2), BASICROM(1), KANJIROM(2), BASICROM(3) }, //0x05: tv rom 1 & basic rom 1 / voice rom 0 & basic 3 - { BASICROM(0), KANJIROM(3), BASICROM(2), KANJIROM(3) }, //0x06: basic rom 0 & tv rom 2 / basic rom 2 & voice 1 - { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 - { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 - { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 - { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 - { EXROM(0), KANJIROM(3), EXROM(0), KANJIROM(3) }, //0x0b: ex rom 0 & tv rom 2 / ex rom 0 & voice 1 - { KANJIROM(2), EXROM(0), KANJIROM(2), EXROM(0) }, //0x0c: tv rom 1 & ex rom 0 / voice rom 0 & ex rom 0 - { WRAM(0), WRAM(1), WRAM(2), WRAM(3) }, //0x0d: ram 0 & 1 / ram 2 & 3 - { EXWRAM(0), EXWRAM(1), EXWRAM(2), EXWRAM(3) }, //0x0e: exram 0 & 1 / exram 2 & 3 - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) } //0x0f: -}; - -static const UINT32 banksw_table_r1[0x10*4][4] = { - /* 0 */ - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: - { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 - { VOICEROM(0), VOICEROM(1), VOICEROM(0), VOICEROM(1) }, //0x02: voice rom 0 & 1 / voice rom 0 & 1 - { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 - { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 - { VOICEROM(0), BASICROM(1), VOICEROM(0), BASICROM(3) }, //0x05: voice rom 0 & basic rom 1 / voice rom 0 & basic 3 - { BASICROM(0), VOICEROM(1), BASICROM(2), VOICEROM(1) }, //0x06: basic rom 0 & voice rom 1 / basic rom 2 & voice 1 - { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 - { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 - { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 - { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 - { EXROM(0), VOICEROM(1), EXROM(0), VOICEROM(1) }, //0x0b: ex rom 0 & voice rom 1 / ex rom 0 & voice 1 - { VOICEROM(0), EXROM(0), VOICEROM(0), EXROM(0) }, //0x0c: voice rom 1 & ex rom 0 / voice rom 0 & ex rom 0 - { WRAM(4), WRAM(5), WRAM(6), WRAM(7) }, //0x0d: ram 4 & 5 / ram 6 & 7 - { EXWRAM(4), EXWRAM(5), EXWRAM(6), EXWRAM(7) }, //0x0e: exram 4 & 5 / exram 6 & 7 - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: - /* 1 */ - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: - { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 - { KANJIROM(0), KANJIROM(1), KANJIROM(0), KANJIROM(1) }, //0x02: kanji rom 0 & 1 / kanji rom 0 & 1 - { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 - { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 - { KANJIROM(0), BASICROM(1), KANJIROM(0), BASICROM(3) }, //0x05: voice rom 0 & basic rom 1 / voice rom 0 & basic 3 - { BASICROM(0), KANJIROM(1), BASICROM(2), KANJIROM(1) }, //0x06: basic rom 0 & voice rom 1 / basic rom 2 & voice 1 - { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 - { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 - { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 - { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 - { EXROM(0), KANJIROM(1), EXROM(0), KANJIROM(1) }, //0x0b: ex rom 0 & voice rom 1 / ex rom 0 & voice 1 - { KANJIROM(0), EXROM(0), KANJIROM(0), EXROM(0) }, //0x0c: voice rom 1 & ex rom 0 / voice rom 0 & ex rom 0 - { WRAM(4), WRAM(5), WRAM(6), WRAM(7) }, //0x0d: ram 4 & 5 / ram 6 & 7 - { EXWRAM(4), EXWRAM(5), EXWRAM(6), EXWRAM(7) }, //0x0e: exram 4 & 5 / exram 6 & 7 - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: - /* 2 */ - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: - { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 - { VOICEROM(0), VOICEROM(1), VOICEROM(0), VOICEROM(1) }, //0x02: voice rom 0 & 1 / voice rom 0 & 1 - { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 - { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 - { VOICEROM(0), BASICROM(1), VOICEROM(0), BASICROM(3) }, //0x05: voice rom 0 & basic rom 1 / voice rom 0 & basic 3 - { BASICROM(0), VOICEROM(1), BASICROM(2), VOICEROM(1) }, //0x06: basic rom 0 & voice rom 1 / basic rom 2 & voice 1 - { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 - { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 - { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 - { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 - { EXROM(0), VOICEROM(1), EXROM(0), VOICEROM(1) }, //0x0b: ex rom 0 & voice rom 1 / ex rom 0 & voice 1 - { VOICEROM(0), EXROM(0), VOICEROM(0), EXROM(0) }, //0x0c: voice rom 1 & ex rom 0 / voice rom 0 & ex rom 0 - { WRAM(4), WRAM(5), WRAM(6), WRAM(7) }, //0x0d: ram 4 & 5 / ram 6 & 7 - { EXWRAM(4), EXWRAM(5), EXWRAM(6), EXWRAM(7) }, //0x0e: exram 4 & 5 / exram 6 & 7 - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x0f: - /* 3 */ - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) }, //0x00: - { BASICROM(0), BASICROM(1), BASICROM(2), BASICROM(3) }, //0x01: basic rom 0 & 1 / basic rom 2 & 3 - { KANJIROM(2), KANJIROM(3), KANJIROM(2), KANJIROM(3) }, //0x02: kanji rom 0 & 1 / kanji rom 0 & 1 - { EXROM(1), EXROM(1), EXROM(1), EXROM(1) }, //0x03: ex rom 1 & 1 / ex rom 1 & 1 - { EXROM(0), EXROM(0), EXROM(0), EXROM(0) }, //0x04: ex rom 0 & 0 / ex rom 0 & 0 - { KANJIROM(2), BASICROM(1), KANJIROM(2), BASICROM(3) }, //0x05: voice rom 0 & basic rom 1 / voice rom 0 & basic 3 - { BASICROM(0), KANJIROM(3), BASICROM(2), KANJIROM(3) }, //0x06: basic rom 0 & voice rom 1 / basic rom 2 & voice 1 - { EXROM(0), EXROM(1), EXROM(0), EXROM(1) }, //0x07: ex rom 0 & ex rom 1 / ex rom 0 & ex rom 1 - { EXROM(1), EXROM(0), EXROM(1), EXROM(0) }, //0x08: ex rom 1 & ex rom 0 / ex rom 1 & ex rom 0 - { EXROM(1), BASICROM(1), EXROM(1), BASICROM(3) }, //0x09: ex rom 1 & basic rom 1 / ex rom 1 & basic 3 - { BASICROM(0), EXROM(1), BASICROM(2), EXROM(1) }, //0x0a: basic rom 0 & ex rom 1 / basic rom 2 & ex rom 1 - { EXROM(0), KANJIROM(3), EXROM(0), KANJIROM(3) }, //0x0b: ex rom 0 & voice rom 1 / ex rom 0 & voice 1 - { KANJIROM(2), EXROM(0), KANJIROM(2), EXROM(0) }, //0x0c: voice rom 1 & ex rom 0 / voice rom 0 & ex rom 0 - { WRAM(4), WRAM(5), WRAM(6), WRAM(7) }, //0x0d: ram 4 & 5 / ram 6 & 7 - { EXWRAM(4), EXWRAM(5), EXWRAM(6), EXWRAM(7) }, //0x0e: exram 4 & 5 / exram 6 & 7 - { INVALID(0), INVALID(0), INVALID(0), INVALID(0) } //0x0f: -}; - -WRITE8_MEMBER(pc6001_state::pc6001m2_bank_r0_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - UINT8 *gfx_data = m_region_gfx1->base(); - -// bankaddress = 0x10000 + (0x4000 * ((data & 0x40)>>6)); -// membank(1)->set_base(&ROM[bankaddress]); - - m_bank_r0 = data; - -// printf("%02x BANK | %02x\n",data,m_bank_opt); - m_bank1->set_base(&ROM[banksw_table_r0[(data & 0xf)+(m_bank_opt*0x10)][0]]); - m_bank2->set_base(&ROM[banksw_table_r0[(data & 0xf)+(m_bank_opt*0x10)][1]]); - m_bank3->set_base(&ROM[banksw_table_r0[((data & 0xf0)>>4)+(m_bank_opt*0x10)][2]]); - if(!m_gfx_bank_on) - m_bank4->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); - else - m_bank4->set_base(&gfx_data[m_cgrom_bank_addr]); -} - -WRITE8_MEMBER(pc6001_state::pc6001m2_bank_r1_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - -// bankaddress = 0x10000 + (0x4000 * ((data & 0x40)>>6)); -// membank(1)->set_base(&ROM[bankaddress]); - - m_bank_r1 = data; - -// printf("%02x BANK\n",data); - m_bank5->set_base(&ROM[banksw_table_r1[(data & 0xf)+(m_bank_opt*0x10)][0]]); - m_bank6->set_base(&ROM[banksw_table_r1[(data & 0xf)+(m_bank_opt*0x10)][1]]); - m_bank7->set_base(&ROM[banksw_table_r1[((data & 0xf0)>>4)+(m_bank_opt*0x10)][2]]); - m_bank8->set_base(&ROM[banksw_table_r1[((data & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); -} - -WRITE8_MEMBER(pc6001_state::pc6001m2_bank_w0_w) -{ - m_bank_w = data; -} - -WRITE8_MEMBER(pc6001_state::pc6001m2_opt_bank_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - UINT8 *gfx_data = m_region_gfx1->base(); - - /* - 0 - TVROM / VOICE ROM - 1 - KANJI ROM bank 0 - 2 - KANJI ROM bank 1 - 3 - TVROM / VOICE ROM - */ - m_bank_opt = data & 3; - - m_bank1->set_base(&ROM[banksw_table_r0[(m_bank_r0 & 0xf)+(m_bank_opt*0x10)][0]]); - m_bank2->set_base(&ROM[banksw_table_r0[(m_bank_r0 & 0xf)+(m_bank_opt*0x10)][1]]); - m_bank3->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][2]]); - if(!m_gfx_bank_on) - m_bank4->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); - else - m_bank4->set_base(&gfx_data[m_cgrom_bank_addr]); - m_bank4->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); - m_bank5->set_base(&ROM[banksw_table_r1[(m_bank_r1 & 0xf)+(m_bank_opt*0x10)][0]]); - m_bank6->set_base(&ROM[banksw_table_r1[(m_bank_r1 & 0xf)+(m_bank_opt*0x10)][1]]); - m_bank7->set_base(&ROM[banksw_table_r1[((m_bank_r1 & 0xf0)>>4)+(m_bank_opt*0x10)][2]]); - m_bank8->set_base(&ROM[banksw_table_r1[((m_bank_r1 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); - -} - -WRITE8_MEMBER(pc6001_state::work_ram0_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - ROM[offset+((m_bank_w & 0x01) ? WRAM(0) : EXWRAM(0))] = data; -} - -WRITE8_MEMBER(pc6001_state::work_ram1_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - ROM[offset+((m_bank_w & 0x01) ? WRAM(1) : EXWRAM(1))] = data; -} - -WRITE8_MEMBER(pc6001_state::work_ram2_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - ROM[offset+((m_bank_w & 0x04) ? WRAM(2) : EXWRAM(2))] = data; -} - -WRITE8_MEMBER(pc6001_state::work_ram3_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - ROM[offset+((m_bank_w & 0x04) ? WRAM(3) : EXWRAM(3))] = data; -} - -WRITE8_MEMBER(pc6001_state::work_ram4_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - ROM[offset+((m_bank_w & 0x10) ? WRAM(4) : EXWRAM(4))] = data; -} - -WRITE8_MEMBER(pc6001_state::work_ram5_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - ROM[offset+((m_bank_w & 0x10) ? WRAM(5) : EXWRAM(5))] = data; -} - -WRITE8_MEMBER(pc6001_state::work_ram6_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - ROM[offset+((m_bank_w & 0x40) ? WRAM(6) : EXWRAM(6))] = data; -} - -WRITE8_MEMBER(pc6001_state::work_ram7_w) -{ - UINT8 *ROM = m_region_maincpu->base(); - ROM[offset+((m_bank_w & 0x40) ? WRAM(7) : EXWRAM(7))] = data; -} - - -WRITE8_MEMBER(pc6001_state::necmk2_ppi8255_w) -{ - if (offset==3) - { - if(data & 1) - m_port_c_8255 |= 1<<((data>>1)&0x07); - else - m_port_c_8255 &= ~(1<<((data>>1)&0x07)); - - switch(data) { - case 0x08: m_port_c_8255 |= 0x88; break; - case 0x09: m_port_c_8255 &= 0xf7; break; - case 0x0c: m_port_c_8255 |= 0x28; break; - case 0x0d: m_port_c_8255 &= 0xf7; break; - default: break; - } - - m_port_c_8255 |= 0xa8; - - { - UINT8 *ROM = m_region_maincpu->base(); - UINT8 *gfx_data = m_region_gfx1->base(); - - //printf("%02x\n",data); - - if((data & 0x0f) == 0x05) - { - m_gfx_bank_on = 0; - m_bank4->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]); - } - if((data & 0x0f) == 0x04) - { - m_gfx_bank_on = 1; - m_bank4->set_base(&gfx_data[m_cgrom_bank_addr]); - } - } - } - m_ppi->write(space,offset,data); -} - -void pc6001_state::vram_bank_change(UINT8 vram_bank) -{ - UINT8 *work_ram = m_region_maincpu->base(); - -// popmessage("%02x",vram_bank); - - switch(vram_bank & 0x66) - { - case 0x00: m_video_ram = work_ram + 0x8000 + 0x28000; break; //4 color mode - case 0x02: m_video_ram = work_ram + 0xc000 + 0x28000; break; - case 0x04: m_video_ram = work_ram + 0x8000 + 0x28000; break; - case 0x06: m_video_ram = work_ram + 0xc000 + 0x28000; break; - case 0x20: m_video_ram = work_ram + 0xc000 + 0x28000; break; //4 color mode - case 0x22: m_video_ram = work_ram + 0xe000 + 0x28000; break; - case 0x24: m_video_ram = work_ram + 0xc000 + 0x28000; break; - case 0x26: m_video_ram = work_ram + 0xe000 + 0x28000; break; - case 0x40: m_video_ram = work_ram + 0x0000 + 0x28000; break; //4 color mode - case 0x42: m_video_ram = work_ram + 0x8000 + 0x28000; break; - case 0x44: m_video_ram = work_ram + 0x0000 + 0x28000; break; - case 0x46: m_video_ram = work_ram + 0x8000 + 0x28000; break; - case 0x60: m_video_ram = work_ram + 0x4000 + 0x28000; break; //4 color mode - case 0x62: m_video_ram = work_ram + 0xa000 + 0x28000; break; - case 0x64: m_video_ram = work_ram + 0x4000 + 0x28000; break; - case 0x66: m_video_ram = work_ram + 0xa000 + 0x28000; break; - } -} - -WRITE8_MEMBER(pc6001_state::pc6001m2_system_latch_w) -{ - if((!(m_sys_latch & 8)) && data & 0x8) //PLAY tape cmd - { - m_cas_switch = 1; - //m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - //m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); - } - if((m_sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd - { - m_cas_switch = 0; - //m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - //m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - //m_irq_vector = 0x00; - //m_maincpu->set_input_line(0, ASSERT_LINE); - } - - m_sys_latch = data; - - m_timer_irq_mask = data & 1; - vram_bank_change((m_ex_vram_bank & 0x06) | ((m_sys_latch & 0x06) << 4)); - - //printf("%02x B0\n",data); -} - - -WRITE8_MEMBER(pc6001_state::pc6001m2_vram_bank_w) -{ - //static const UINT32 startaddr[] = {WRAM(6), WRAM(6), WRAM(0), WRAM(4) }; - - m_ex_vram_bank = data; - vram_bank_change((m_ex_vram_bank & 0x06) | ((m_sys_latch & 0x06) << 4)); - - m_exgfx_text_mode = ((data & 2) == 0); - m_cgrom_bank_addr = (data & 2) ? 0x0000 : 0x2000; - - m_exgfx_bitmap_mode = (data & 8); - m_exgfx_2bpp_mode = ((data & 6) == 0); - - { - /* Apparently bitmap modes changes the screen res to 320 x 200 */ - { - rectangle visarea = machine().first_screen()->visible_area(); - int y_height; - - y_height = (m_exgfx_bitmap_mode || m_exgfx_2bpp_mode) ? 200 : 240; - - visarea.set(0, (320) - 1, 0, (y_height) - 1); - - machine().first_screen()->configure(320, 240, visarea, machine().first_screen()->frame_period().attoseconds()); - } - } - -// popmessage("%02x",data); - -// m_video_ram = work_ram + startaddr[(data >> 1) & 0x03]; -} - -WRITE8_MEMBER(pc6001_state::pc6001m2_col_bank_w) -{ - m_bgcol_bank = (data & 7); -} - - -WRITE8_MEMBER(pc6001_state::pc6001m2_0xf3_w) -{ - /* - x--- ---- M1 (?) wait setting - -x-- ---- ROM wait setting - --x- ---- RAM wait setting - ---x ---- custom irq 2 address output - ---- x--- custom irq 1 address output - ---- -x-- timer irq mask 2 (mirror?) - ---- --x- custom irq 2 mask - ---- ---x custom irq 1 mask - */ - m_timer_irq_mask2 = data & 4; -} - -TIMER_CALLBACK_MEMBER(pc6001_state::audio_callback) -{ - if(m_cas_switch == 0 && ((m_timer_irq_mask == 0) || (m_timer_irq_mask2 == 0))) - { - if(IRQ_LOG) printf("Timer IRQ called %02x\n",m_timer_irq_vector); - m_irq_vector = m_timer_irq_vector; - m_maincpu->set_input_line(0, ASSERT_LINE); - } -} - - -WRITE8_MEMBER(pc6001_state::pc6001m2_timer_adj_w) -{ - m_timer_hz_div = data; - attotime period = attotime::from_hz((487.5*4)/(m_timer_hz_div+1)); - m_timer_irq_timer->adjust(period, 0, period); -} - -WRITE8_MEMBER(pc6001_state::pc6001m2_timer_irqv_w) -{ - m_timer_irq_vector = data; -} - -READ8_MEMBER(pc6001_state::pc6001m2_bank_r0_r) -{ - return m_bank_r0; -} - -READ8_MEMBER(pc6001_state::pc6001m2_bank_r1_r) -{ - return m_bank_r1; -} - -READ8_MEMBER(pc6001_state::pc6001m2_bank_w0_r) -{ - return m_bank_w; -} - -static ADDRESS_MAP_START(pc6001m2_map, AS_PROGRAM, 8, pc6001_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1") AM_WRITE(work_ram0_w) - AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank2") AM_WRITE(work_ram1_w) - AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3") AM_WRITE(work_ram2_w) - AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4") AM_WRITE(work_ram3_w) - AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank5") AM_WRITE(work_ram4_w) - AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank6") AM_WRITE(work_ram5_w) - AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank7") AM_WRITE(work_ram6_w) - AM_RANGE(0xe000, 0xffff) AM_ROMBANK("bank8") AM_WRITE(work_ram7_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc6001m2_io , AS_IO, 8, pc6001_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - - AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_READWRITE(nec_ppi8255_r, necmk2_ppi8255_w) - - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, data_w) - AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_device, data_r) - AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_NOP - - AM_RANGE(0xb0, 0xb0) AM_MIRROR(0x0f) AM_WRITE(pc6001m2_system_latch_w) - - AM_RANGE(0xc0, 0xc0) AM_WRITE(pc6001m2_col_bank_w) - AM_RANGE(0xc1, 0xc1) AM_WRITE(pc6001m2_vram_bank_w) - AM_RANGE(0xc2, 0xc2) AM_WRITE(pc6001m2_opt_bank_w) - - AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x0c) AM_NOP // disk device - - AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) - - AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) - AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) - AM_RANGE(0xf2, 0xf2) AM_READWRITE(pc6001m2_bank_w0_r,pc6001m2_bank_w0_w) - AM_RANGE(0xf3, 0xf3) AM_WRITE(pc6001m2_0xf3_w) -// AM_RANGE(0xf4 -// AM_RANGE(0xf5 - AM_RANGE(0xf6, 0xf6) AM_WRITE(pc6001m2_timer_adj_w) - AM_RANGE(0xf7, 0xf7) AM_WRITE(pc6001m2_timer_irqv_w) -ADDRESS_MAP_END - -/* disk device placeholder (TODO: identify & hook-up this) */ -READ8_MEMBER(pc6001_state::pc6601_fdc_r) -{ - return machine().rand(); -} - -WRITE8_MEMBER(pc6001_state::pc6601_fdc_w) -{ -} - -static ADDRESS_MAP_START( pc6601_io , AS_IO, 8, pc6001_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - - AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_READWRITE(nec_ppi8255_r, necmk2_ppi8255_w) - - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, data_w) - AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_device, data_r) - AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_NOP - - AM_RANGE(0xb0, 0xb0) AM_WRITE(pc6001m2_system_latch_w) - /* these are disk related */ -// AM_RANGE(0xb1 -// AM_RANGE(0xb2 -// AM_RANGE(0xb3 - - AM_RANGE(0xc0, 0xc0) AM_WRITE(pc6001m2_col_bank_w) - AM_RANGE(0xc1, 0xc1) AM_WRITE(pc6001m2_vram_bank_w) - AM_RANGE(0xc2, 0xc2) AM_WRITE(pc6001m2_opt_bank_w) - - AM_RANGE(0xd0, 0xdf) AM_READWRITE(pc6601_fdc_r,pc6601_fdc_w) // disk device - - AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) - - AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) - AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) - AM_RANGE(0xf2, 0xf2) AM_READWRITE(pc6001m2_bank_w0_r,pc6001m2_bank_w0_w) - AM_RANGE(0xf3, 0xf3) AM_WRITE(pc6001m2_0xf3_w) -// AM_RANGE(0xf4 -// AM_RANGE(0xf5 - AM_RANGE(0xf6, 0xf6) AM_WRITE(pc6001m2_timer_adj_w) - AM_RANGE(0xf7, 0xf7) AM_WRITE(pc6001m2_timer_irqv_w) -ADDRESS_MAP_END - -/* PC-6001 SR */ - -#define SR_SYSROM_1(_v_) \ - 0x10000+(0x1000*_v_) -#define SR_SYSROM_2(_v_) \ - 0x20000+(0x1000*_v_) -#define SR_CGROM1(_v_) \ - 0x30000+(0x1000*_v_) -#define SR_EXROM0(_v_) \ - 0x40000+(0x1000*_v_) -#define SR_EXROM1(_v_) \ - 0x50000+(0x1000*_v_) -#define SR_EXRAM0(_v_) \ - 0x60000+(0x1000*_v_) -#define SR_WRAM0(_v_) \ - 0x70000+(0x1000*_v_) -#define SR_NULL(_v_) \ - 0x80000+(0x1000*_v_) -READ8_MEMBER(pc6001_state::pc6001sr_bank_rn_r) -{ - return m_sr_bank_r[offset]; -} - -WRITE8_MEMBER(pc6001_state::pc6001sr_bank_rn_w) -{ - memory_bank *bank[8] = { m_bank1, m_bank2, m_bank3, m_bank4, m_bank5, m_bank6, m_bank7, m_bank8 }; - UINT8 *ROM = m_region_maincpu->base(); - UINT8 bank_num; - - m_sr_bank_r[offset] = data; - bank_num = data & 0x0f; - - switch(data & 0xf0) - { - case 0xf0: bank[offset]->set_base(&ROM[SR_SYSROM_1(bank_num)]); break; - case 0xe0: bank[offset]->set_base(&ROM[SR_SYSROM_2(bank_num)]); break; - case 0xd0: bank[offset]->set_base(&ROM[SR_CGROM1(bank_num)]); break; - case 0xc0: bank[offset]->set_base(&ROM[SR_EXROM0(bank_num)]); break; - case 0xb0: bank[offset]->set_base(&ROM[SR_EXROM1(bank_num)]); break; - case 0x20: bank[offset]->set_base(&ROM[SR_EXRAM0(bank_num)]); break; - case 0x00: bank[offset]->set_base(&ROM[SR_WRAM0(bank_num)]); break; - default: bank[offset]->set_base(&ROM[SR_NULL(bank_num)]); break; - } -} - -READ8_MEMBER(pc6001_state::pc6001sr_bank_wn_r) -{ - return m_sr_bank_w[offset]; -} - -WRITE8_MEMBER(pc6001_state::pc6001sr_bank_wn_w) -{ - m_sr_bank_w[offset] = data; -} - -#define SR_WRAM_BANK_W(_v_) \ -{ \ - UINT8 *ROM = m_region_maincpu->base(); \ - UINT8 bank_num; \ - bank_num = m_sr_bank_w[_v_] & 0x0f; \ - if((m_sr_bank_w[_v_] & 0xf0) != 0x20) \ - ROM[offset+(SR_WRAM0(bank_num))] = data; \ - else \ - ROM[offset+(SR_EXRAM0(bank_num))] = data; \ -} -WRITE8_MEMBER(pc6001_state::sr_work_ram0_w){ SR_WRAM_BANK_W(0); } -WRITE8_MEMBER(pc6001_state::sr_work_ram1_w){ SR_WRAM_BANK_W(1); } -WRITE8_MEMBER(pc6001_state::sr_work_ram2_w){ SR_WRAM_BANK_W(2); } -WRITE8_MEMBER(pc6001_state::sr_work_ram3_w){ SR_WRAM_BANK_W(3); } -WRITE8_MEMBER(pc6001_state::sr_work_ram4_w){ SR_WRAM_BANK_W(4); } -WRITE8_MEMBER(pc6001_state::sr_work_ram5_w){ SR_WRAM_BANK_W(5); } -WRITE8_MEMBER(pc6001_state::sr_work_ram6_w){ SR_WRAM_BANK_W(6); } -WRITE8_MEMBER(pc6001_state::sr_work_ram7_w){ SR_WRAM_BANK_W(7); } - -WRITE8_MEMBER(pc6001_state::pc6001sr_mode_w) -{ - m_sr_video_mode = data; - - if(data & 1) - assert("PC-6001SR in Mk-2 compatibility mode not yet supported!\n"); -} - -WRITE8_MEMBER(pc6001_state::pc6001sr_vram_bank_w) -{ - UINT8 *work_ram = m_region_maincpu->base(); - - m_video_ram = work_ram + 0x70000 + ((data & 0x0f)*0x1000); -} - -WRITE8_MEMBER(pc6001_state::pc6001sr_system_latch_w) -{ - if((!(m_sys_latch & 8)) && data & 0x8) //PLAY tape cmd - { - m_cas_switch = 1; - //m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - //m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); - } - if((m_sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd - { - m_cas_switch = 0; - //m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - //m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - //m_irq_vector = 0x00; - //m_maincpu->set_input_line(0, ASSERT_LINE); - } - - m_sys_latch = data; - - m_timer_irq_mask = data & 1; - //vram_bank_change((m_ex_vram_bank & 0x06) | ((m_sys_latch & 0x06) << 4)); - - //printf("%02x B0\n",data); -} - -WRITE8_MEMBER(pc6001_state::necsr_ppi8255_w) -{ - if (offset==3) - { - if(data & 1) - m_port_c_8255 |= 1<<((data>>1)&0x07); - else - m_port_c_8255 &= ~(1<<((data>>1)&0x07)); - - switch(data) { - case 0x08: m_port_c_8255 |= 0x88; break; - case 0x09: m_port_c_8255 &= 0xf7; break; - case 0x0c: m_port_c_8255 |= 0x28; break; - case 0x0d: m_port_c_8255 &= 0xf7; break; - default: break; - } - - m_port_c_8255 |= 0xa8; - - if(0) - { - //printf("%02x\n",data); - - if ((data & 0x0f) == 0x05 && m_cart_rom) - m_bank1->set_base(m_cart_rom->base() + 0x2000); - if ((data & 0x0f) == 0x04) - m_bank1->set_base(m_region_gfx1->base()); - } - } - m_ppi->write(space,offset,data); -} - - -static ADDRESS_MAP_START(pc6001sr_map, AS_PROGRAM, 8, pc6001_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1") AM_WRITE(sr_work_ram0_w) - AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank2") AM_WRITE(sr_work_ram1_w) - AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3") AM_WRITE(sr_work_ram2_w) - AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4") AM_WRITE(sr_work_ram3_w) - AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank5") AM_WRITE(sr_work_ram4_w) - AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank6") AM_WRITE(sr_work_ram5_w) - AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank7") AM_WRITE(sr_work_ram6_w) - AM_RANGE(0xe000, 0xffff) AM_ROMBANK("bank8") AM_WRITE(sr_work_ram7_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc6001sr_io , AS_IO, 8, pc6001_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x60, 0x67) AM_READWRITE(pc6001sr_bank_rn_r,pc6001sr_bank_rn_w) - AM_RANGE(0x68, 0x6f) AM_READWRITE(pc6001sr_bank_wn_r,pc6001sr_bank_wn_w) - AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - - AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_READWRITE(nec_ppi8255_r, necsr_ppi8255_w) - - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_device, data_w) - AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_device, data_r) - AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_NOP - - AM_RANGE(0xb0, 0xb0) AM_WRITE(pc6001sr_system_latch_w) - /* these are disk related */ -// AM_RANGE(0xb1 -// AM_RANGE(0xb2 -// AM_RANGE(0xb3 - -// AM_RANGE(0xc0, 0xc0) AM_WRITE(pc6001m2_col_bank_w) -// AM_RANGE(0xc1, 0xc1) AM_WRITE(pc6001m2_vram_bank_w) -// AM_RANGE(0xc2, 0xc2) AM_WRITE(pc6001m2_opt_bank_w) - - AM_RANGE(0xc8, 0xc8) AM_WRITE(pc6001sr_mode_w) - AM_RANGE(0xc9, 0xc9) AM_WRITE(pc6001sr_vram_bank_w) - - AM_RANGE(0xd0, 0xdf) AM_READWRITE(pc6601_fdc_r,pc6601_fdc_w) // disk device - - AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) - -// AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) -// AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) -// AM_RANGE(0xf2, 0xf2) AM_READWRITE(pc6001m2_bank_w0_r,pc6001m2_bank_w0_w) - AM_RANGE(0xf3, 0xf3) AM_WRITE(pc6001m2_0xf3_w) -// AM_RANGE(0xf4 -// AM_RANGE(0xf5 - AM_RANGE(0xf6, 0xf6) AM_WRITE(pc6001m2_timer_adj_w) - AM_RANGE(0xf7, 0xf7) AM_WRITE(pc6001m2_timer_irqv_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pc6001 ) - PORT_START("MODE4_DSW") //TODO: is this really a DSW? bit arrangement is also unknown if so. - PORT_DIPNAME( 0x07, 0x00, "Mode 4 GFX colors" ) - PORT_DIPSETTING( 0x00, "Monochrome" ) - PORT_DIPSETTING( 0x01, "Red/Blue" ) - PORT_DIPSETTING( 0x02, "Blue/Red" ) - PORT_DIPSETTING( 0x03, "Pink/Green" ) - PORT_DIPSETTING( 0x04, "Green/Pink" ) - //5-6-7 is presumably invalid - - /* TODO: these two are unchecked */ - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("key1") //0x00-0x1f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x01 soh - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x02 stx - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x03 etx - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x04 etx - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x05 eot - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x06 enq - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x07 ack - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0a - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0b lf - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0c vt - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e cr - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f so - - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x10 si - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x11 dle - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x12 dc1 - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x13 dc2 - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x14 dc3 - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x15 dc4 - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x16 nak - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x17 syn - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x18 etb - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x19 cancel - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1a em - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1b sub - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1d fs - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1e gs - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1f us - - PORT_START("key2") //0x20-0x3f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') //0x2c - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') //0x2e - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') //0x2f - - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3a : - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3b ; - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3c < - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? - - PORT_START("key3") //0x40-0x5f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") - - PORT_START("key_modifiers") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_ESC) -INPUT_PORTS_END - -INTERRUPT_GEN_MEMBER(pc6001_state::pc6001_interrupt) -{ - m_cur_keycode = check_joy_press(); - if(IRQ_LOG) printf("Stick IRQ called 0x16\n"); - m_irq_vector = 0x16; - device.execute().set_input_line(0, ASSERT_LINE); -} - -INTERRUPT_GEN_MEMBER(pc6001_state::pc6001sr_interrupt) -{ - m_kludge^= 1; - - m_cur_keycode = check_joy_press(); - if(IRQ_LOG) printf("VRTC IRQ called 0x16\n"); - m_irq_vector = (m_kludge) ? 0x22 : 0x16; - device.execute().set_input_line(0, ASSERT_LINE); -} - -IRQ_CALLBACK_MEMBER(pc6001_state::pc6001_irq_callback) -{ - device.execute().set_input_line(0, CLEAR_LINE); - return m_irq_vector; -} - -READ8_MEMBER(pc6001_state::pc6001_8255_porta_r) -{ - return 0; -} - -WRITE8_MEMBER(pc6001_state::pc6001_8255_porta_w) -{ -// if(data != 0x06) -// printf("pc6001_8255_porta_w %02x\n",data); -} - -READ8_MEMBER(pc6001_state::pc6001_8255_portb_r) -{ - return 0; -} - -WRITE8_MEMBER(pc6001_state::pc6001_8255_portb_w) -{ - //printf("pc6001_8255_portb_w %02x\n",data); -} - -WRITE8_MEMBER(pc6001_state::pc6001_8255_portc_w) -{ - //printf("pc6001_8255_portc_w %02x\n",data); -} - -READ8_MEMBER(pc6001_state::pc6001_8255_portc_r) -{ - return 0x88; -} - -UINT8 pc6001_state::check_keyboard_press() -{ - ioport_port *ports[3] = { m_io_key1, m_io_key2, m_io_key3 }; - int i,port_i,scancode; - UINT8 shift_pressed,caps_lock; - scancode = 0; - - shift_pressed = (m_io_key_modifiers->read() & 2)>>1; - caps_lock = (m_io_key_modifiers->read() & 8)>>3; - - for(port_i=0;port_i<3;port_i++) - { - for(i=0;i<32;i++) - { - if((ports[port_i]->read()>>i) & 1) - { - if((shift_pressed != caps_lock) && scancode >= 0x41 && scancode <= 0x5f) - scancode+=0x20; - - if(shift_pressed && scancode >= 0x31 && scancode <= 0x39) - scancode-=0x10; - - if(shift_pressed && scancode == 0x30) // '0' / '=' - scancode = 0x3d; - - if(shift_pressed && scancode == 0x2c) // ',' / ';' - scancode = 0x3b; - - if(shift_pressed && scancode == 0x2f) // '/' / '?' - scancode = 0x3f; - - if(shift_pressed && scancode == 0x2e) // '.' / ':' - scancode = 0x3a; - - return scancode; - } - scancode++; - } - } - - return 0; -} - -UINT8 pc6001_state::check_joy_press() -{ - UINT8 p1_key = m_io_p1->read() ^ 0xff; - UINT8 shift_key = m_io_key_modifiers->read() & 0x02; - UINT8 space_key = m_io_key2->read() & 0x01; - UINT8 joy_press; - - /* - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - */ - - joy_press = 0; - - switch(p1_key & 0xf) - { - case 0x01: joy_press = 0x04; break; //up - case 0x02: joy_press = 0x08; break; //down - case 0x04: joy_press = 0x20; break; - case 0x05: joy_press = 0x24; break; //up-left - case 0x06: joy_press = 0x28; break; //down-left - case 0x08: joy_press = 0x10; break; //right - case 0x09: joy_press = 0x14; break; //up-right - case 0x0a: joy_press = 0x18; break; //down-right - } - - if(p1_key & 0x10 || space_key) { joy_press |= 0x80; } //button 1 (space) - if(p1_key & 0x20 || shift_key) { joy_press |= 0x01; } //button 2 (shift) - - return joy_press; -} - -TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::cassette_callback) -{ - if(m_cas_switch == 1) - { - #if 0 - static UINT8 cas_data_i = 0x80,cas_data_poll; - //m_cur_keycode = gfx_data[m_cas_offset++]; - if(m_cassette->input() > 0.03) - cas_data_poll|= cas_data_i; - else - cas_data_poll&=~cas_data_i; - if(cas_data_i == 1) - { - m_cur_keycode = cas_data_poll; - cas_data_i = 0x80; - /* data ready, poll irq */ - m_irq_vector = 0x08; - m_maincpu->set_input_line(0, ASSERT_LINE); - } - else - cas_data_i>>=1; - #else - address_space &space = m_maincpu->space(AS_PROGRAM); - m_cur_keycode = m_cas_hack->read_rom(space, m_cas_offset++); - popmessage("%04x %04x", m_cas_offset, m_cas_maxsize); - if(m_cas_offset > m_cas_maxsize) - { - m_cas_offset = 0; - m_cas_switch = 0; - if(IRQ_LOG) printf("Tape-E IRQ 0x12\n"); - m_irq_vector = 0x12; - m_maincpu->set_input_line(0, ASSERT_LINE); - } - else - { - if(IRQ_LOG) printf("Tape-D IRQ 0x08\n"); - m_irq_vector = 0x08; - m_maincpu->set_input_line(0, ASSERT_LINE); - } - #endif - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::keyboard_callback) -{ - UINT32 key1 = m_io_key1->read(); - UINT32 key2 = m_io_key2->read(); - UINT32 key3 = m_io_key3->read(); -// UINT8 p1_key = m_io_p1->read(); - - if(m_cas_switch == 0) - { - if((key1 != m_old_key1) || (key2 != m_old_key2) || (key3 != m_old_key3)) - { - m_cur_keycode = check_keyboard_press(); - if(IRQ_LOG) printf("KEY IRQ 0x02\n"); - m_irq_vector = 0x02; - m_maincpu->set_input_line(0, ASSERT_LINE); - m_old_key1 = key1; - m_old_key2 = key2; - m_old_key3 = key3; - } - #if 0 - else /* joypad polling */ - { - m_cur_keycode = check_joy_press(); - if(m_cur_keycode) - { - m_irq_vector = 0x16; - m_maincpu->set_input_line(0, ASSERT_LINE); - } - } - #endif - } -} - -void pc6001_state::machine_start() -{ - m_timer_hz_div = 3; - { - attotime period = attotime::from_hz((487.5*4)/(m_timer_hz_div+1)); - m_timer_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc6001_state::audio_callback),this)); - m_timer_irq_timer->adjust(period, 0, period); - } -} - -void pc6001_state::machine_reset() -{ - m_video_ram = m_region_maincpu->base() + 0xc000; - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - m_port_c_8255=0; - - m_cas_switch = 0; - m_cas_offset = 0; - m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; - m_timer_irq_mask = 1; - m_timer_irq_mask2 = 1; - m_timer_irq_vector = 0x06; // actually vector is fixed in plain PC-6001 - m_timer_hz_div = 3; -} - -MACHINE_RESET_MEMBER(pc6001_state,pc6001m2) -{ - m_video_ram = m_region_maincpu->base() + 0xc000 + 0x28000; - - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - // hackish way to simplify bankswitch handling - if (m_cart_rom) - memcpy(m_region_maincpu->base() + 0x48000, m_cart_rom->base(), 0x4000); - - m_port_c_8255=0; - - m_cas_switch = 0; - m_cas_offset = 0; - m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; - - /* set default bankswitch */ - { - UINT8 *ROM = m_region_maincpu->base(); - m_bank_r0 = 0x71; - m_bank1->set_base(&ROM[BASICROM(0)]); - m_bank2->set_base(&ROM[BASICROM(1)]); - m_bank3->set_base(&ROM[EXROM(0)]); - m_bank4->set_base(&ROM[EXROM(1)]); - m_bank_r1 = 0xdd; - m_bank5->set_base(&ROM[WRAM(4)]); - m_bank6->set_base(&ROM[WRAM(5)]); - m_bank7->set_base(&ROM[WRAM(6)]); - m_bank8->set_base(&ROM[WRAM(7)]); - m_bank_opt = 0x02; //tv rom - m_bank_w = 0x50; //enable write to work ram 4,5,6,7 - m_gfx_bank_on = 0; - } - - m_timer_irq_mask = 1; - m_timer_irq_mask2 = 1; - m_timer_irq_vector = 0x06; -} - -MACHINE_RESET_MEMBER(pc6001_state,pc6001sr) -{ - m_video_ram = m_region_maincpu->base() + 0x70000; - - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - // should this be mirrored into the EXROM regions? hard to tell without an actual cart dump... - - m_port_c_8255=0; - - m_cas_switch = 0; - m_cas_offset = 0; - m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0; - - /* set default bankswitch */ - { - UINT8 *ROM = m_region_maincpu->base(); - m_sr_bank_r[0] = 0xf8; m_bank1->set_base(&ROM[SR_SYSROM_1(0x08)]); - m_sr_bank_r[1] = 0xfa; m_bank2->set_base(&ROM[SR_SYSROM_1(0x0a)]); - m_sr_bank_r[2] = 0xb0; m_bank3->set_base(&ROM[SR_EXROM1(0x00)]); - m_sr_bank_r[3] = 0xc0; m_bank4->set_base(&ROM[SR_EXROM0(0x00)]); - m_sr_bank_r[4] = 0x08; m_bank5->set_base(&ROM[SR_WRAM0(0x08)]); - m_sr_bank_r[5] = 0x0a; m_bank6->set_base(&ROM[SR_WRAM0(0x0a)]); - m_sr_bank_r[6] = 0x0c; m_bank7->set_base(&ROM[SR_WRAM0(0x0c)]); - m_sr_bank_r[7] = 0x0e; m_bank8->set_base(&ROM[SR_WRAM0(0x0e)]); -// m_bank_opt = 0x02; //tv rom - - /* enable default work RAM writes */ - m_sr_bank_w[0] = 0x00; - m_sr_bank_w[1] = 0x02; - m_sr_bank_w[2] = 0x04; - m_sr_bank_w[3] = 0x06; - m_sr_bank_w[4] = 0x08; - m_sr_bank_w[5] = 0x0a; - m_sr_bank_w[6] = 0x0c; - m_sr_bank_w[7] = 0x0e; - - m_gfx_bank_on = 0; - } - - m_timer_irq_mask = 1; - m_timer_irq_mask2 = 1; - m_timer_irq_vector = 0x06; -} - -static const rgb_t defcolors[] = -{ - rgb_t(0x07, 0xff, 0x00), /* GREEN */ - rgb_t(0xff, 0xff, 0x00), /* YELLOW */ - rgb_t(0x3b, 0x08, 0xff), /* BLUE */ - rgb_t(0xcc, 0x00, 0x3b), /* RED */ - rgb_t(0xff, 0xff, 0xff), /* BUFF */ - rgb_t(0x07, 0xe3, 0x99), /* CYAN */ - rgb_t(0xff, 0x1c, 0xff), /* MAGENTA */ - rgb_t(0xff, 0x81, 0x00), /* ORANGE */ - - /* MC6847 specific */ - rgb_t(0x00, 0x7c, 0x00), /* ALPHANUMERIC DARK GREEN */ - rgb_t(0x07, 0xff, 0x00), /* ALPHANUMERIC BRIGHT GREEN */ - rgb_t(0x91, 0x00, 0x00), /* ALPHANUMERIC DARK ORANGE */ - rgb_t(0xff, 0x81, 0x00) /* ALPHANUMERIC BRIGHT ORANGE */ -}; - -static const rgb_t mk2_defcolors[] = -{ - rgb_t(0x00, 0x00, 0x00), /* BLACK */ - rgb_t(0xff, 0xaf, 0x00), /* ORANGE */ - rgb_t(0x00, 0xff, 0xaf), /* tone of GREEN */ - rgb_t(0xaf, 0xff, 0x00), /* tone of GREEN */ - rgb_t(0xaf, 0x00, 0xff), /* VIOLET */ - rgb_t(0xff, 0x00, 0xaf), /* SCARLET */ - rgb_t(0x00, 0xaf, 0xff), /* LIGHT BLUE */ - rgb_t(0xaf, 0xaf, 0xaf), /* GRAY */ - rgb_t(0x00, 0x00, 0x00), /* BLACK */ - rgb_t(0xff, 0x00, 0x00), /* RED */ - rgb_t(0x00, 0xff, 0x00), /* GREEN */ - rgb_t(0xff, 0xff, 0x00), /* YELLOW */ - rgb_t(0x00, 0x00, 0xff), /* BLUE */ - rgb_t(0xff, 0x00, 0xff), /* PINK */ - rgb_t(0x00, 0xff, 0xff), /* CYAN */ - rgb_t(0xff, 0xff, 0xff) /* WHITE */ -}; - -PALETTE_INIT_MEMBER(pc6001_state, pc6001) -{ - int i; - - for(i=0;i<8+4;i++) - palette.set_pen_color(i+8,defcolors[i]); -} - -PALETTE_INIT_MEMBER(pc6001_state,pc6001m2) -{ - int i; - - for(i=0;i<8;i++) - palette.set_pen_color(i+8,defcolors[i]); - - for(i=0x10;i<0x20;i++) - palette.set_pen_color(i,mk2_defcolors[i-0x10]); -} - -#if 0 -static const cassette_interface pc6001_cassette_interface = -{ - pc6001_cassette_formats, - NULL, - (cassette_state)(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED), - NULL -}; -#endif - -static const gfx_layout char_layout = -{ - 8, 16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 -}; - - -static const gfx_layout kanji_layout = -{ - 16, 16, - RGN_FRAC(1,2), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7, - 0+RGN_FRAC(1,2), 1+RGN_FRAC(1,2), 2+RGN_FRAC(1,2), 3+RGN_FRAC(1,2), 4+RGN_FRAC(1,2), 5+RGN_FRAC(1,2), 6+RGN_FRAC(1,2), 7+RGN_FRAC(1,2) }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 -}; - -static GFXDECODE_START( pc6001m2 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, char_layout, 2, 1 ) - GFXDECODE_ENTRY( "gfx2", 0x0000, kanji_layout, 2, 1 ) -GFXDECODE_END - -#define PC6001_MAIN_CLOCK 7987200 - -static MACHINE_CONFIG_START( pc6001, pc6001_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, PC6001_MAIN_CLOCK / 2) // ~4 Mhz - MCFG_CPU_PROGRAM_MAP(pc6001_map) - MCFG_CPU_IO_MAP(pc6001_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc6001_state, pc6001_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pc6001_state,pc6001_irq_callback) - -// MCFG_CPU_ADD("subcpu", I8049, 7987200) - - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc6001m2) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DRIVER(pc6001_state, screen_update_pc6001) - MCFG_SCREEN_SIZE(320, 25+192+26) - MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16+4) - MCFG_PALETTE_INIT_OWNER(pc6001_state, pc6001) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pc6001_state, pc6001_8255_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pc6001_state, pc6001_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pc6001_state, pc6001_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pc6001_state, pc6001_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pc6001_state, pc6001_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc6001_state, pc6001_8255_portc_w)) - - /* uart */ - MCFG_DEVICE_ADD("uart", I8251, 0) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pc6001_cart") - -// MCFG_CASSETTE_ADD("cassette", pc6001_cassette_interface) - MCFG_GENERIC_CARTSLOT_ADD("cas_hack", generic_plain_slot, "pc6001_cass") - MCFG_GENERIC_EXTENSIONS("cas,p6") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8910", AY8910, PC6001_MAIN_CLOCK/4) - MCFG_AY8910_PORT_A_READ_CB(IOPORT("P1")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("P2")) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -// MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* TODO: accurate timing on this */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", pc6001_state, keyboard_callback, attotime::from_hz(250)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", pc6001_state, cassette_callback, attotime::from_hz(1200/12)) -MACHINE_CONFIG_END - - - -static MACHINE_CONFIG_DERIVED( pc6001m2, pc6001 ) - - MCFG_MACHINE_RESET_OVERRIDE(pc6001_state,pc6001m2) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(pc6001_state, screen_update_pc6001m2) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(16+16) - MCFG_PALETTE_INIT_OWNER(pc6001_state,pc6001m2) - - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pc6001m2_map) - MCFG_CPU_IO_MAP(pc6001m2_io) - - MCFG_GFXDECODE_MODIFY("gfxdecode", pc6001m2) - - MCFG_SOUND_ADD("upd7752", UPD7752, PC6001_MAIN_CLOCK/4) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc6601, pc6001m2 ) - - /* basic machine hardware */ - MCFG_CPU_REPLACE("maincpu", Z80, PC6001_MAIN_CLOCK / 2) - MCFG_CPU_PROGRAM_MAP(pc6001m2_map) - MCFG_CPU_IO_MAP(pc6601_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc6001_state, pc6001_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pc6001_state,pc6001_irq_callback) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc6001sr, pc6001m2 ) - - MCFG_MACHINE_RESET_OVERRIDE(pc6001_state,pc6001sr) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(pc6001_state, screen_update_pc6001sr) - - /* basic machine hardware */ - MCFG_CPU_REPLACE("maincpu", Z80, XTAL_3_579545MHz) //*Yes*, PC-6001 SR Z80 CPU is actually slower than older models - MCFG_CPU_PROGRAM_MAP(pc6001sr_map) - MCFG_CPU_IO_MAP(pc6001sr_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc6001_state, pc6001sr_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pc6001_state,pc6001_irq_callback) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pc6001 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "basicrom.60", 0x0000, 0x4000, CRC(54c03109) SHA1(c622fefda3cdc2b87a270138f24c05828b5c41d2) ) - - ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) - ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "cgrom60.60", 0x0000, 0x1000, CRC(b0142d32) SHA1(9570495b10af5b1785802681be94b0ea216a1e26) ) - ROM_RELOAD( 0x1000, 0x1000 ) - - ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( pc6001a ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "basicrom.60a", 0x0000, 0x4000, CRC(fa8e88d9) SHA1(c82e30050a837e5c8ffec3e0c8e3702447ffd69c) ) - - ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) - ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x1000, "gfx1", 0 ) - ROM_LOAD( "cgrom60.60a", 0x0000, 0x1000, CRC(49c21d08) SHA1(9454d6e2066abcbd051bad9a29a5ca27b12ec897) ) - - ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( pc6001mk2 ) - ROM_REGION( 0x50000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "basicrom.62", 0x10000, 0x8000, CRC(950ac401) SHA1(fbf195ba74a3b0f80b5a756befc96c61c2094182) ) - ROM_LOAD( "voicerom.62", 0x18000, 0x4000, CRC(49b4f917) SHA1(1a2d18f52ef19dc93da3d65f19d3abbd585628af) ) - ROM_LOAD( "cgrom60.62", 0x1c000, 0x2000, CRC(81eb5d95) SHA1(53d8ae9599306ff23bf95208d2f6cc8fed3fc39f) ) - ROM_LOAD( "cgrom60m.62", 0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) - ROM_LOAD( "kanjirom.62", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) - // work ram 0x28000,0x10000 - // extended work ram 0x38000,0x10000 - // exrom 0x48000, 0x4000 - // 0x4c000, 0x4000 - - ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) - ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x4000, "gfx1", 0 ) - ROM_COPY( "maincpu", 0x1c000, 0x00000, 0x4000 ) - - ROM_REGION( 0x8000, "gfx2", 0 ) - ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 ) -ROM_END - -ROM_START( pc6601 ) /* Variant of pc6001m2 */ - ROM_REGION( 0x50000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "basicrom.66", 0x10000, 0x8000, CRC(c0b01772) SHA1(9240bb6b97fe06f5f07b5d65541c4d2f8758cc2a) ) - ROM_LOAD( "voicerom.66", 0x18000, 0x4000, CRC(91d078c1) SHA1(6a93bd7723ef67f461394530a9feee57c8caf7b7) ) - ROM_LOAD( "cgrom60.66", 0x1c000, 0x2000, CRC(d2434f29) SHA1(a56d76f5cbdbcdb8759abe601eab68f01b0a8fe8) ) - ROM_LOAD( "cgrom66.66", 0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) ) - ROM_LOAD( "kanjirom.66", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) ) - // exrom 0x48000, 0x4000 - - ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) - ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x4000, "gfx1", 0 ) - ROM_COPY( "maincpu", 0x1c000, 0x00000, 0x4000 ) - - ROM_REGION( 0x8000, "gfx2", 0 ) - ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 ) -ROM_END - -ROM_START( pc6001sr ) - ROM_REGION( 0x90000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "systemrom1.64", 0x10000, 0x10000, CRC(b6fc2db2) SHA1(dd48b1eee60aa34780f153359f5da7f590f8dff4) ) - ROM_LOAD( "systemrom2.64", 0x20000, 0x10000, CRC(55a62a1d) SHA1(3a19855d290fd4ac04e6066fe4a80ecd81dc8dd7) ) -// cgrom 1 0x30000, 0x10000 -// exrom 0 0x40000, 0x10000 -// exrom 1 0x50000, 0x10000 -// exram 0 0x60000, 0x10000 -// work ram 0 0x70000, 0x10000 -// 0x80000, 0x10000 - - ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) - ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x4000, "gfx1", 0 ) - ROM_LOAD( "cgrom68.64", 0x0000, 0x4000, CRC(73bc3256) SHA1(5f80d62a95331dc39b2fb448a380fd10083947eb) ) - - ROM_REGION( 0x8000, "gfx2", 0 ) - ROM_COPY( "maincpu", 0x28000, 0x00000, 0x8000 ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, pc6001, 0, 0, pc6001, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6001 (Japan)", MACHINE_NOT_WORKING ) -COMP( 1981, pc6001a, pc6001, 0, pc6001, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6001A (US)", MACHINE_NOT_WORKING ) // This version is also known as the NEC Trek -COMP( 1983, pc6001mk2,pc6001, 0, pc6001m2, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6001mkII (Japan)", MACHINE_NOT_WORKING ) -COMP( 1983, pc6601, pc6001, 0, pc6601, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6601 (Japan)", MACHINE_NOT_WORKING ) -COMP( 1984, pc6001sr, pc6001, 0, pc6001sr, pc6001, driver_device, 0, "Nippon Electronic Company", "PC-6001mkIISR (Japan)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pc8001.c b/src/mess/drivers/pc8001.c deleted file mode 100644 index fd95aa724b6..00000000000 --- a/src/mess/drivers/pc8001.c +++ /dev/null @@ -1,601 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - http://www2.odn.ne.jp/~haf09260/Pc80/EnrPc.htm - http://home1.catvmics.ne.jp/~kanemoto/n80/inside.html - http://www.geocities.jp/retro_zzz/machines/nec/8001/index.html - -*/ - -/* - - TODO: - - - uPD3301 attributes - - PCG1000 - - Intel 8251 - - cassette - - floppy - - PC-8011 - - PC-8021 - - PC-8031 - -*/ - -#include "includes/pc8001.h" - -/* Read/Write Handlers */ - -WRITE8_MEMBER( pc8001_state::port10_w ) -{ - /* - - bit description - - 0 RTC C0 - 1 RTC C1 - 2 RTC C2 - 3 RTC DATA IN - 4 - 5 - 6 - 7 - - */ - - // RTC - m_rtc->c0_w(BIT(data, 0)); - m_rtc->c1_w(BIT(data, 1)); - m_rtc->c2_w(BIT(data, 2)); - m_rtc->data_in_w(BIT(data, 3)); - - // centronics - m_cent_data_out->write(space, 0, data); -} - -WRITE8_MEMBER( pc8001_state::port30_w ) -{ - /* - - bit description - - 0 characters per line (0=40, 1=80) - 1 color mode (0=color, 1=B&W) - 2 CMT CHIN - 3 CMT MOTOR (1=on) - 4 CMT BS1 - 5 CMT BS2 - 6 unused - 7 unused - - */ - - /* characters per line */ - m_width80 = BIT(data, 0); - - /* color mode */ - m_color = BIT(data, 1); - - /* cassette motor */ - m_cassette->change_state(BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - -WRITE8_MEMBER( pc8001mk2_state::port31_w ) -{ - /* - - bit description - - 0 expansion ROM (0=expansion, 1=N80) - 1 memory mode (0=ROM, 1=RAM) - 2 color mode (0=attribute, 1=B&W) - 3 graphics enable - 4 resolution (0=640x200, 1=320x200) - 5 background color - 6 background color - 7 background color - - */ -} - -WRITE_LINE_MEMBER( pc8001_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( pc8001_state::write_centronics_ack ) -{ - m_centronics_ack = state; -} - -READ8_MEMBER( pc8001_state::port40_r ) -{ - /* - - bit description - - 0 BUSY - 1 ACK - 2 CMT CDIN - 3 EXP /EXTON - 4 RTC DATA OUT - 5 VRTC - 6 - 7 - - */ - - UINT8 data = 0x08; - - data |= m_centronics_busy; - data |= m_centronics_ack << 1; - data |= m_rtc->data_out_r() << 4; - data |= m_crtc->vrtc_r() << 5; - - return data; -} - -WRITE8_MEMBER( pc8001_state::port40_w ) -{ - /* - - bit description - - 0 STROBE - 1 RTC STB - 2 RTC CLK - 3 CRT /CLDS CLK - 4 - 5 SPEAKER - 6 - 7 - - */ - - m_centronics->write_strobe(BIT(data, 0)); - - m_rtc->clk_w(BIT(data, 2)); - m_rtc->stb_w(BIT(data, 1)); - - m_speaker->level_w(BIT(data, 5)); -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( pc8001_mem, AS_PROGRAM, 8, pc8001_state ) - AM_RANGE(0x0000, 0x5fff) AM_RAMBANK("bank1") - AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank3") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8001_io, AS_IO, 8, pc8001_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_READ_PORT("Y0") - AM_RANGE(0x01, 0x01) AM_READ_PORT("Y1") - AM_RANGE(0x02, 0x02) AM_READ_PORT("Y2") - AM_RANGE(0x03, 0x03) AM_READ_PORT("Y3") - AM_RANGE(0x04, 0x04) AM_READ_PORT("Y4") - AM_RANGE(0x05, 0x05) AM_READ_PORT("Y5") - AM_RANGE(0x06, 0x06) AM_READ_PORT("Y6") - AM_RANGE(0x07, 0x07) AM_READ_PORT("Y7") - AM_RANGE(0x08, 0x08) AM_READ_PORT("Y8") - AM_RANGE(0x09, 0x09) AM_READ_PORT("Y9") - AM_RANGE(0x10, 0x10) AM_MIRROR(0x0f) AM_WRITE(port10_w) - AM_RANGE(0x20, 0x20) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x21, 0x21) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x30, 0x30) AM_MIRROR(0x0f) AM_WRITE(port30_w) - AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READWRITE(port40_r, port40_w) - AM_RANGE(0x50, 0x51) AM_DEVREADWRITE(UPD3301_TAG, upd3301_device, read, write) - AM_RANGE(0x60, 0x68) AM_DEVREADWRITE(I8257_TAG, i8257_device, read, write) -// AM_RANGE(0x70, 0x7f) unused -// AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext0_w) -// AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext1_w) -// AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext2_w) -// AM_RANGE(0xb0, 0xb0) AM_READ(pc8011_gpio8_r) -// AM_RANGE(0xb1, 0xb1) AM_WRITE(pc8011_gpio8_w) -// AM_RANGE(0xb2, 0xb2) AM_READ(pc8011_gpio4_r) -// AM_RANGE(0xb3, 0xb3) AM_WRITE(pc8011_gpio4_w) -// AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(PC8011_CH1_I8251_TAG, i8251_device, data_r, data_w) -// AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE(PC8011_CH1_I8251_TAG, i8251_device, status_r, control_w) -// AM_RANGE(0xc2, 0xc2) AM_DEVREADWRITE(PC8011_CH2_I8251_TAG, i8251_device, data_r, data_w) -// AM_RANGE(0xc3, 0xc3) AM_DEVREADWRITE(PC8011_CH2_I8251_TAG, i8251_device, status_r, control_w) -// AM_RANGE(0xc8, 0xc8) RS-232 output enable? -// AM_RANGE(0xca, 0xca) RS-232 output disable? -// AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE(PC8011_IEEE488_I8255A_TAG, i8255_device, read, write) -// AM_RANGE(0xd8, 0xd8) AM_READ(pc8011_ieee488_control_signal_input_r) -// AM_RANGE(0xda, 0xda) AM_READ(pc8011_ieee488_bus_address_mode_r) -// AM_RANGE(0xdc, 0xdc) AM_WRITE(pc8011_ieee488_nrfd_w) -// AM_RANGE(0xde, 0xde) AM_WRITE(pc8011_ieee488_bus_mode_control_w) -// AM_RANGE(0xe0, 0xe3) AM_WRITE(expansion_storage_mode_w) -// AM_RANGE(0xe4, 0xe4) AM_MIRROR(0x01) AM_WRITE(irq_level_w) -// AM_RANGE(0xe6, 0xe6) AM_WRITE(irq_mask_w) -// AM_RANGE(0xe7, 0xe7) AM_WRITE(pc8012_memory_mode_w) -// AM_RANGE(0xe8, 0xfb) unused - AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8001mk2_mem, AS_PROGRAM, 8, pc8001mk2_state ) - AM_RANGE(0x0000, 0x5fff) AM_RAMBANK("bank1") - AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8001mk2_io, AS_IO, 8, pc8001mk2_state ) - AM_IMPORT_FROM(pc8001_io) - AM_RANGE(0x30, 0x30) AM_WRITE(port30_w) - AM_RANGE(0x31, 0x31) AM_WRITE(port31_w) -// AM_RANGE(0x5c, 0x5c) AM_WRITE(gram_on_w) -// AM_RANGE(0x5f, 0x5f) AM_WRITE(gram_off_w) -// AM_RANGE(0xe8, 0xe8) kanji_address_lo_w, kanji_data_lo_r -// AM_RANGE(0xe9, 0xe9) kanji_address_hi_w, kanji_data_hi_r -// AM_RANGE(0xea, 0xea) kanji_readout_start_w -// AM_RANGE(0xeb, 0xeb) kanji_readout_end_w -// AM_RANGE(0xf3, 0xf3) DMA type disk unit interface selection port -// AM_RANGE(0xf4, 0xf4) DMA type 8 inch control -// AM_RANGE(0xf5, 0xf5) DMA type 8 inch margin control -// AM_RANGE(0xf6, 0xf6) DMA type 8 inch FDC status -// AM_RANGE(0xf7, 0xf7) DMA type 8 inch FDC data register -// AM_RANGE(0xf8, 0xf8) DMA type 5 inch control -// AM_RANGE(0xf9, 0xf9) DMA type 5 inch margin control -// AM_RANGE(0xfa, 0xfa) DMA type 5 inch FDC status -// AM_RANGE(0xfb, 0xfb) DMA type 5 inch FDC data register -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( pc8001 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_PGUP) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_PGDN) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA5') PORT_CHAR('|') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(" _") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0) PORT_CHAR('_') - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Kana") PORT_CODE(KEYCODE_LCONTROL) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("DSW1") -INPUT_PORTS_END - -/* uPD3301 Interface */ - -static const rgb_t PALETTE_PC8001[] = -{ - rgb_t::black, - rgb_t(0x00, 0x00, 0xff), - rgb_t(0xff, 0x00, 0x00), - rgb_t(0xff, 0x00, 0xff), - rgb_t(0x00, 0xff, 0x00), - rgb_t(0x00, 0xff, 0xff), - rgb_t(0xff, 0xff, 0x00), - rgb_t::white -}; - -UPD3301_DRAW_CHARACTER_MEMBER( pc8001_state::pc8001_display_pixels ) -{ - UINT8 data = m_char_rom->base()[(cc << 3) | lc]; - int i; - - if (lc >= 8) return; - if (csr) data = 0xff; - - if (m_width80) - { - for (i = 0; i < 8; i++) - { - int color = BIT(data, 7) ^ rvv; - - bitmap.pix32(y, (sx * 8) + i) = PALETTE_PC8001[color ? 7 : 0]; - - data <<= 1; - } - } - else - { - if (sx % 2) return; - - for (i = 0; i < 8; i++) - { - int color = BIT(data, 7) ^ rvv; - - bitmap.pix32(y, (sx/2 * 16) + (i * 2)) = PALETTE_PC8001[color ? 7 : 0]; - bitmap.pix32(y, (sx/2 * 16) + (i * 2) + 1) = PALETTE_PC8001[color ? 7 : 0]; - - data <<= 1; - } - } -} - -/* 8257 Interface */ - -WRITE_LINE_MEMBER( pc8001_state::hrq_w ) -{ - /* HACK - this should be connected to the BUSREQ line of Z80 */ - m_maincpu->set_input_line(INPUT_LINE_HALT, state); - - /* HACK - this should be connected to the BUSACK line of Z80 */ - m_dma->hlda_w(state); -} - -READ8_MEMBER( pc8001_state::dma_mem_r ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - return program.read_byte(offset); -} - -/* Machine Initialization */ - -void pc8001_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* initialize RTC */ - m_rtc->cs_w(1); - m_rtc->oe_w(1); - - /* initialize DMA */ - m_dma->ready_w(1); - - /* setup memory banking */ - UINT8 *ram = m_ram->pointer(); - - membank("bank1")->configure_entry(1, m_rom->base()); - program.install_read_bank(0x0000, 0x5fff, "bank1"); - program.unmap_write(0x0000, 0x5fff); - - switch (m_ram->size()) - { - case 16*1024: - membank("bank3")->configure_entry(0, ram); - program.unmap_readwrite(0x6000, 0xbfff); - program.unmap_readwrite(0x8000, 0xbfff); - program.install_readwrite_bank(0xc000, 0xffff, "bank3"); - break; - - case 32*1024: - membank("bank3")->configure_entry(0, ram); - program.unmap_readwrite(0x6000, 0xbfff); - program.install_readwrite_bank(0x8000, 0xffff, "bank3"); - break; - - case 64*1024: - membank("bank1")->configure_entry(0, ram); - membank("bank2")->configure_entry(0, ram + 0x6000); - membank("bank3")->configure_entry(0, ram + 0x8000); - program.install_readwrite_bank(0x0000, 0x5fff, "bank1"); - program.install_readwrite_bank(0x6000, 0xbfff, "bank2"); - program.install_readwrite_bank(0x8000, 0xffff, "bank3"); - membank("bank2")->set_entry(0); - break; - } - - membank("bank1")->set_entry(1); - membank("bank3")->set_entry(0); - - /* register for state saving */ - save_item(NAME(m_width80)); - save_item(NAME(m_color)); -} - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( pc8001, pc8001_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(pc8001_mem) - MCFG_CPU_IO_MAP(pc8001_io) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DEVICE(UPD3301_TAG, upd3301_device, screen_update) - MCFG_SCREEN_SIZE(640, 220) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - - MCFG_DEVICE_ADD(I8257_TAG, I8257, 4000000) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(pc8001_state, hrq_w)) - MCFG_I8257_IN_MEMR_CB(READ8(pc8001_state, dma_mem_r)) - MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8(UPD3301_TAG, upd3301_device, dack_w)) - - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) - - MCFG_DEVICE_ADD(UPD3301_TAG, UPD3301, 14318180) - MCFG_UPD3301_CHARACTER_WIDTH(8) - MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(pc8001_state, pc8001_display_pixels) - MCFG_UPD3301_VRTC_CALLBACK(DEVWRITELINE(I8257_TAG, i8257_device, dreq2_w)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pc8001_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pc8001_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K,64K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pc8001mk2, pc8001mk2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(pc8001mk2_mem) - MCFG_CPU_IO_MAP(pc8001mk2_io) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DEVICE(UPD3301_TAG, upd3301_device, screen_update) - MCFG_SCREEN_SIZE(640, 220) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - - MCFG_DEVICE_ADD(I8257_TAG, I8257, 4000000) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(pc8001_state, hrq_w)) - MCFG_I8257_IN_MEMR_CB(READ8(pc8001_state, dma_mem_r)) - MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8(UPD3301_TAG, upd3301_device, dack_w)) - - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) - - MCFG_DEVICE_ADD(UPD3301_TAG, UPD3301, 14318180) - MCFG_UPD3301_CHARACTER_WIDTH(8) - MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(pc8001_state, pc8001_display_pixels) - MCFG_UPD3301_VRTC_CALLBACK(DEVWRITELINE(I8257_TAG, i8257_device, dreq2_w)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( pc8001 ) - ROM_REGION( 0x6000, Z80_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "v101", "N-BASIC v1.01" ) - ROMX_LOAD( "n80v101.rom", 0x00000, 0x6000, CRC(a2cc9f22) SHA1(6d2d838de7fea20ddf6601660d0525d5b17bf8a3), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v102", "N-BASIC v1.02" ) - ROMX_LOAD( "n80v102.rom", 0x00000, 0x6000, CRC(ed01ca3f) SHA1(b34a98941499d5baf79e7c0e5578b81dbede4a58), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v110", "N-BASIC v1.10" ) - ROMX_LOAD( "n80v110.rom", 0x00000, 0x6000, CRC(1e02d93f) SHA1(4603cdb7a3833e7feb257b29d8052c872369e713), ROM_BIOS(3) ) - - ROM_REGION( 0x800, UPD3301_TAG, 0) - ROM_LOAD( "font.rom", 0x000, 0x800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) ) -ROM_END - -ROM_START( pc8001mk2 ) - ROM_REGION( 0x8000, Z80_TAG, 0 ) - ROM_LOAD( "n80_2.rom", 0x00000, 0x8000, CRC(03cce7b6) SHA1(c12d34e42021110930fed45a8af98db52136f1fb) ) - - ROM_REGION( 0x800, UPD3301_TAG, 0) - ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) ) - - ROM_REGION( 0x20000, "kanji", 0) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, pc8001, 0, 0, pc8001, pc8001, driver_device, 0, "Nippon Electronic Company", "PC-8001", MACHINE_NOT_WORKING ) -COMP( 1983, pc8001mk2, pc8001, 0, pc8001mk2, pc8001, driver_device, 0, "Nippon Electronic Company", "PC-8001mkII", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pc8401a.c b/src/mess/drivers/pc8401a.c deleted file mode 100644 index 0f5ccc2a0c0..00000000000 --- a/src/mess/drivers/pc8401a.c +++ /dev/null @@ -1,677 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "includes/pc8401a.h" - -/* - - NEC PC-8401A-LS "Starlet" - NEC PC-8500 "Studley" - - TODO: - - - keyboard interrupt - - RTC TP pulse - - disassembler for NEC uPD70008C (RST mnemonics are different from Z80) - - clock does not advance in menu - - mirror e800-ffff to 6800-7fff - - soft power on/off - - NVRAM - - 8251 USART - - 8255 ports - - MC6845 palette - - MC6845 chargen ROM - - MC6845 screen update - - - peripherals - * PC-8431A Dual Floppy Drive - * PC-8441A CRT / Disk Interface - * PC-8461A 1200 Baud Modem - * PC-8407A 128KB RAM Expansion - * PC-8508A ROM/RAM Cartridge - - - Use the 600 baud save rate (PIP CAS2:=A: this is more reliable than the 1200 baud (PIP CAS:=A: rate. - -*/ - -#include "bus/rs232/rs232.h" - -/* Fake Keyboard */ - -void pc8401a_state::scan_keyboard() -{ - int strobe = 0; - - /* scan keyboard */ - for (int row = 0; row < 10; row++) - { - UINT8 data = m_io_y[row]->read(); - - if (data != 0xff) - { - strobe = 1; - m_key_latch = data; - } - } - - if (!m_key_strobe && strobe) - { - /* trigger interrupt */ - m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0x28); - logerror("INTERRUPT\n"); - } - - if (strobe) m_key_strobe = strobe; -} - -TIMER_DEVICE_CALLBACK_MEMBER(pc8401a_state::pc8401a_keyboard_tick) -{ - scan_keyboard(); -} - -/* Read/Write Handlers */ - -void pc8401a_state::bankswitch(UINT8 data) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - int rombank = data & 0x03; - int ram0000 = (data >> 2) & 0x03; - int ram8000 = (data >> 4) & 0x03; - - switch (ram0000) - { - case 0: /* ROM 0000H to 7FFFH */ - if (rombank < 3) - { - /* internal ROM */ - program.install_read_bank(0x0000, 0x7fff, "bank1"); - program.unmap_write(0x0000, 0x7fff); - membank("bank1")->set_entry(rombank); - } - else if (m_cart_rom) - { - /* ROM cartridge */ - program.install_read_bank(0x0000, 0x7fff, "bank1"); - program.unmap_write(0x0000, 0x7fff); - membank("bank1")->set_entry(6); - } - else - program.unmap_readwrite(0x0000, 0x7fff); - //logerror("0x0000-0x7fff = ROM %u\n", rombank); - break; - - case 1: /* RAM 0000H to 7FFFH */ - program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); - membank("bank1")->set_entry(4); - //logerror("0x0000-0x7fff = RAM 0-7fff\n"); - break; - - case 2: /* RAM 8000H to FFFFH */ - program.install_readwrite_bank(0x0000, 0x7fff, "bank1"); - membank("bank1")->set_entry(5); - //logerror("0x0000-0x7fff = RAM 8000-ffff\n"); - break; - - case 3: /* invalid */ - logerror("0x0000-0x7fff = invalid\n"); - break; - } - - switch (ram8000) - { - case 0: /* cell addresses 0000H to 3FFFH */ - program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); - membank("bank3")->set_entry(0); - //logerror("0x8000-0xbfff = RAM 0-3fff\n"); - break; - - case 1: /* cell addresses 4000H to 7FFFH */ - program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); - membank("bank3")->set_entry(1); - //logerror("0x8000-0xbfff = RAM 4000-7fff\n"); - break; - - case 2: /* cell addresses 8000H to BFFFH */ - program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); - membank("bank3")->set_entry(2); - //logerror("0x8000-0xbfff = RAM 8000-bfff\n"); - break; - - case 3: /* RAM cartridge */ - if (m_ram->size() > 64) - { - program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); - membank("bank3")->set_entry(3); // TODO or 4 - } - else - { - program.unmap_readwrite(0x8000, 0xbfff); - } - //logerror("0x8000-0xbfff = RAM cartridge\n"); - break; - } - - if (BIT(data, 6)) - { - /* CRT video RAM */ - program.install_readwrite_bank(0xc000, 0xdfff, "bank4"); - program.unmap_readwrite(0xe000, 0xe7ff); - membank("bank4")->set_entry(1); - //logerror("0xc000-0xdfff = video RAM\n"); - } - else - { - /* RAM */ - program.install_readwrite_bank(0xc000, 0xe7ff, "bank4"); - membank("bank4")->set_entry(0); - //logerror("0xc000-0e7fff = RAM c000-e7fff\n"); - } -} - -WRITE8_MEMBER( pc8401a_state::mmr_w ) -{ - /* - - bit description - - 0 ROM section bit 0 - 1 ROM section bit 1 - 2 mapping for CPU addresses 0000H to 7FFFH bit 0 - 3 mapping for CPU addresses 0000H to 7FFFH bit 1 - 4 mapping for CPU addresses 8000H to BFFFH bit 0 - 5 mapping for CPU addresses 8000H to BFFFH bit 1 - 6 mapping for CPU addresses C000H to E7FFH - 7 - - */ - - if (data != m_mmr) - { - bankswitch(data); - } - - m_mmr = data; -} - -READ8_MEMBER( pc8401a_state::mmr_r ) -{ - return m_mmr; -} - -READ8_MEMBER( pc8401a_state::rtc_r ) -{ - /* - - bit description - - 0 RTC TP? - 1 RTC DATA OUT - 2 ? - 3 - 4 - 5 - 6 - 7 - - */ - - return (m_rtc->data_out_r() << 1) | (m_rtc->tp_r() << 2); -} - -WRITE8_MEMBER( pc8401a_state::rtc_cmd_w ) -{ - /* - - bit description - - 0 RTC C0 - 1 RTC C1 - 2 RTC C2 - 3 RTC DATA IN? - 4 - 5 - 6 - 7 - - */ - - m_rtc->c0_w(BIT(data, 0)); - m_rtc->c1_w(BIT(data, 1)); - m_rtc->c2_w(BIT(data, 2)); - m_rtc->data_in_w(BIT(data, 3)); -} - -WRITE8_MEMBER( pc8401a_state::rtc_ctrl_w ) -{ - /* - - bit description - - 0 RTC OE or CS? - 1 RTC STB - 2 RTC CLK - 3 - 4 - 5 - 6 - 7 - - */ - - m_rtc->oe_w(BIT(data, 0)); - m_rtc->stb_w(BIT(data, 1)); - m_rtc->clk_w(BIT(data, 2)); -} - -READ8_MEMBER( pc8401a_state::io_rom_data_r ) -{ - //logerror("I/O ROM read from %05x\n", m_io_addr); - return m_io_cart->read_rom(space, m_io_addr); -} - -WRITE8_MEMBER( pc8401a_state::io_rom_addr_w ) -{ - switch (offset) - { - case 0: /* A17..A16 */ - m_io_addr = ((data & 0x03) << 16) | (m_io_addr & 0xffff); - break; - - case 1: /* A15..A8 */ - m_io_addr = (m_io_addr & 0x300ff) | (data << 8); - break; - - case 2: /* A7..A0 */ - m_io_addr = (m_io_addr & 0x3ff00) | data; - break; - - case 3: - /* the same data is written here as to 0xb2, maybe this latches the address value? */ - break; - } -} - -READ8_MEMBER( pc8401a_state::port70_r ) -{ - /* - - bit description - - 0 key pressed - 1 - 2 - 3 - 4 must be 1 or CPU goes to HALT - 5 - 6 - 7 - - */ - - return 0x10 | m_key_strobe; -} - -READ8_MEMBER( pc8401a_state::port71_r ) -{ - return m_key_latch; -} - -WRITE8_MEMBER( pc8401a_state::port70_w ) -{ - m_key_strobe = 0; -} - -WRITE8_MEMBER( pc8401a_state::port71_w ) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); - - m_key_latch = data; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( pc8401a_mem, AS_PROGRAM, 8, pc8401a_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank1") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xe7ff) AM_RAMBANK("bank4") - AM_RANGE(0xe800, 0xffff) AM_RAMBANK("bank5") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8401a_io, AS_IO, 8, pc8401a_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8500_io, AS_IO, 8, pc8401a_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ_PORT("Y.0") - AM_RANGE(0x01, 0x01) AM_READ_PORT("Y.1") - AM_RANGE(0x02, 0x02) AM_READ_PORT("Y.2") - AM_RANGE(0x03, 0x03) AM_READ_PORT("Y.3") - AM_RANGE(0x04, 0x04) AM_READ_PORT("Y.4") - AM_RANGE(0x05, 0x05) AM_READ_PORT("Y.5") - AM_RANGE(0x06, 0x06) AM_READ_PORT("Y.6") - AM_RANGE(0x07, 0x07) AM_READ_PORT("Y.7") - AM_RANGE(0x08, 0x08) AM_READ_PORT("Y.8") - AM_RANGE(0x09, 0x09) AM_READ_PORT("Y.9") - AM_RANGE(0x10, 0x10) AM_WRITE(rtc_cmd_w) - AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x21, 0x21) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x30, 0x30) AM_READWRITE(mmr_r, mmr_w) -// AM_RANGE(0x31, 0x31) - AM_RANGE(0x40, 0x40) AM_READWRITE(rtc_r, rtc_ctrl_w) -// AM_RANGE(0x41, 0x41) -// AM_RANGE(0x50, 0x51) - AM_RANGE(0x60, 0x60) AM_DEVREADWRITE(SED1330_TAG, sed1330_device, status_r, data_w) - AM_RANGE(0x61, 0x61) AM_DEVREADWRITE(SED1330_TAG, sed1330_device, data_r, command_w) - AM_RANGE(0x70, 0x70) AM_READWRITE(port70_r, port70_w) - AM_RANGE(0x71, 0x71) AM_READWRITE(port71_r, port71_w) -// AM_RANGE(0x80, 0x80) modem status, set to 0xff to boot -// AM_RANGE(0x8b, 0x8b) -// AM_RANGE(0x90, 0x93) -// AM_RANGE(0xa0, 0xa1) - AM_RANGE(0x98, 0x98) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) - AM_RANGE(0x99, 0x99) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r, register_w) - AM_RANGE(0xb0, 0xb3) AM_WRITE(io_rom_addr_w) - AM_RANGE(0xb3, 0xb3) AM_READ(io_rom_data_r) -// AM_RANGE(0xc8, 0xc8) - AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( pc8401a ) - PORT_START("Y.0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP")// PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y.1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y.2") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - - PORT_START("Y.3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - - PORT_START("Y.4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('*') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("Y.5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('*') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('*') - - PORT_START("Y.6") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('*') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ? - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - - PORT_START("Y.7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^I - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^C - - PORT_START("Y.8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y.9") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) -INPUT_PORTS_END - -/* Machine Initialization */ - -void pc8401a_state::machine_start() -{ - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - /* initialize RTC */ - m_rtc->cs_w(1); - - /* allocate CRT video RAM */ - m_crt_ram.allocate(PC8401A_CRT_VIDEORAM_SIZE); - - UINT8 *ram = m_ram->pointer(); - - /* set up A0/A1 memory banking */ - membank("bank1")->configure_entries(0, 4, m_rom->base(), 0x8000); - membank("bank1")->configure_entries(4, 2, ram, 0x8000); - if (m_cart_rom) - membank("bank1")->configure_entries(6, 1, m_cart_rom->base(), 0x8000); - membank("bank1")->set_entry(0); - - /* set up A2 memory banking */ - membank("bank3")->configure_entries(0, 5, ram, 0x4000); - membank("bank3")->set_entry(0); - - /* set up A3 memory banking */ - membank("bank4")->configure_entry(0, ram + 0xc000); - membank("bank4")->configure_entry(1, m_crt_ram); - membank("bank4")->set_entry(0); - - /* set up A4 memory banking */ - membank("bank5")->configure_entry(0, ram + 0xe800); - membank("bank5")->set_entry(0); - - /* bank switch */ - bankswitch(0); - - /* register for state saving */ - save_item(NAME(m_mmr)); - save_item(NAME(m_io_addr)); -} - -READ8_MEMBER( pc8401a_state::ppi_pc_r ) -{ - /* - - bit signal description - - PC0 - PC1 - PC2 - PC3 - PC4 PC-8431A DAV data valid - PC5 PC-8431A RFD ready for data - PC6 PC-8431A DAC data accepted - PC7 PC-8431A ATN attention - - */ - - return 0; -} - -WRITE8_MEMBER( pc8401a_state::ppi_pc_w ) -{ - /* - - bit signal description - - PC0 - PC1 - PC2 - PC3 - PC4 PC-8431A DAV data valid - PC5 PC-8431A RFD ready for data - PC6 PC-8431A DAC data accepted - PC7 PC-8431A ATN attention - - */ -} - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( pc8401a, pc8401a_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) // NEC uPD70008C - MCFG_CPU_PROGRAM_MAP(pc8401a_mem) - MCFG_CPU_IO_MAP(pc8401a_io) - - /* fake keyboard */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", pc8401a_state, pc8401a_keyboard_tick, attotime::from_hz(64)) - - /* devices */ - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_IN_PORTC_CB(READ8(pc8401a_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc8401a_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - - /* video hardware */ - MCFG_FRAGMENT_ADD(pc8401a_video) - - /* option ROM cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* I/O ROM cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("96K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pc8500, pc8500_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) // NEC uPD70008C - MCFG_CPU_PROGRAM_MAP(pc8401a_mem) - MCFG_CPU_IO_MAP(pc8500_io) - - /* fake keyboard */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", pc8401a_state, pc8401a_keyboard_tick, attotime::from_hz(64)) - - /* devices */ - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_IN_PORTC_CB(READ8(pc8401a_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc8401a_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - - /* video hardware */ - MCFG_FRAGMENT_ADD(pc8500_video) - - /* option ROM cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* I/O ROM cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("96K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( pc8401a ) - ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF ) - ROM_LOAD( "pc8401a.bin", 0x0000, 0x18000, NO_DUMP ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP ) -ROM_END - -ROM_START( pc8500 ) - ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF ) - ROM_LOAD( "pc8500.bin", 0x0000, 0x10000, CRC(c2749ef0) SHA1(f766afce9fda9ec84ed5b39ebec334806798afb3) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1984, pc8401a, 0, 0, pc8401a, pc8401a, driver_device, 0, "Nippon Electronic Company", "PC-8401A-LS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -//COMP( 1984, pc8401bd, pc8401a,0, pc8401a, pc8401a, driver_device, 0, "Nippon Electronic Company", "PC-8401BD", MACHINE_NOT_WORKING) -COMP( 1985, pc8500, 0, 0, pc8500, pc8401a, driver_device, 0, "Nippon Electronic Company", "PC-8500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/pc8801.c b/src/mess/drivers/pc8801.c deleted file mode 100644 index 9d2a6e58c99..00000000000 --- a/src/mess/drivers/pc8801.c +++ /dev/null @@ -1,2971 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/************************************************************************************************************************************* - - PC-8801 (c) 1981 NEC - - driver by Angelo Salese, original MESS PC-88SR driver by ??? - - TODO: - - implement proper i8214 routing, also add irq latch mechanism; - - Fix up Floppy Terminal Count 0 / 1 writes properly, Castle Excellent (and presumably other games) is very picky about it. - - - add differences between various models; - - implement proper upd3301 / i8257 support; - - fix "jumps" in mouse support pointer (noticeable in Balance of Power); - - Add limits for extend work RAM; - - What happens to the palette contents when the analog/digital palette mode changes? - - waitstates; - - dipswitches needs to be controlled; - - below notes states that plain PC-8801 doesn't have a disk CPU, but the BIOS clearly checks the floppy ports. Wrong info? - - clean-ups, banking and video in particular (i.e. hook-ups with memory region should go away and device models should be used instead) - - per-game specific TODO: - - 100yen Soft 8 Revival Special: tight loop with vblank bit, but vblank irq takes too much time to execute its code; - - 177: gameplay is too fast (parent pc8801 only); - - 1942: missing sound, enables a masked irq; - - Acro Jet: hangs waiting for an irq (floppy issue); - - Arcus: doesn't surpass Wolf Team logo; - - Advanced Fantasian: garbage during gameplay (floppy?) - - American Success: reads the light pen? - - Attacker: resets after a bunch of animation frames; - - Balance of Power: uses the SIO port for something ... - - Belloncho Shintai Kensa: hangs - - Bishoujo Baseball Gakuen: checks ym2608 after intro screen; - - The Black Onyx: writes a katakana msg: "sono kata ha koko ni orimasen" then doesn't show up anything. (Needs user disk?) - - Boukenshatachi: dies after the intro. - - Campaign Ban Daisenryaku 2: Hangs at title screen? - - Carigraph: inputs doesn't work? - - Can Can Bunny: bitmap artifacts on intro, caused by a fancy usage of the attribute vram; - - Can Can Bunny: no sound (regression); - - Can Can Bunny Superior: black screen during the intro - - Chou Bishoujo Densetsu CROQUIS: accesses ports 0xa0-0xa3 and 0xc2-0xc3 - - Combat: mono gfx mode enabled, but I don't see any noticeable quirk? - - Cranston Manor (actually N88-Basic demo): no sound - - Datenshi Kyouko: gfx garbage on the right edge? - - Final Crisis: sound stuck with OPNA? - - Fire Hawk: tries to r/w the opn ports (probably crashed due to floppy?) - - Game Music Library: "Disk I/O error on 3040", starting from Sorcerian item - - Gaudi - Barcelona no Kaze: fails PCM loading - - GeGeGe no Kitarou: title screen text/bitmap contrast is pretty ugly (BTANB?); - - Grobda: palette is ugly (parent pc8801 only); - - Makaimura: after losing a life the game doesn't work properly anymore, copy protection? - - Music Collection Vol. 2 - Final Fantasy Tokushuu: sound irq dies pretty soon - - N-BASIC: cursor doesn't show up; - - The Return of Ishtar: z80 exception after entering the name. - - Star Cruiser: bad kanji data? - - Star Cruiser: reads at i/o 0x8e? - - Wanderers from Ys: user data disk looks screwed? It loads with everything as maximum as per now ... - - WerDragon: no BGMs - - Xevious: game is too fast (parent pc8801 only) - - list of games/apps that crashes due of floppy issues (* -> denotes games fixed with current floppy code, # -> regressed with current floppy code): - * Agni no Ishi - * Amazoness no Hihou (takes invalid data from floppy) - - American Truck / American Truck SR (polls read deleted data command) - * Ankokujou - * Ao No Sekizou (fdc CPU irq doesn't fire anymore) - * Arcus - * Attacker - - Autumn Park (BASIC error) - * Battle Gorilla - * Belloncho Shintai Kensa - - Bishoujo Noriko Part I (writes to FDC CPU ROM then expects some strict values, taken from floppy image) - * Blassty (attempts to read at 0x801b) - - Bokosuka Wars (polls read ID command) - * Boukenshatachi - * Can Can Bunny Superior - - Carmine - - Castle Excellent (sets sector 0xf4? Jumps to 0xa100 and it shouldn't) (REGRESSED with current floppy code) - - Card Game Pro 8.8k Plus Unit 1 (prints Disk i/o error 135 in vram, not visible for whatever reason) - - Championship Lode Runner (fdc CPU irq doesn't fire anymore) - - Change Vol. 1 (stops at PCM loading) - - Chikyuu Boueigun (disk i/o error during "ESDF SYSTEM LOADING") (REGRESSED with current floppy code) - * Chikyuu Senshi Rayieza (fdc CPU crashes) - - Choplifter - - Columns (code at 0x28c8, copy protection) - - Corridor ("THIS SYSTEM NOT KOEI SYSTEM" printed on screen) (REGRESSED with current floppy code) - # Craze (returns to basic after logo pops up, tries to self-modify program data via the window offset?) - * Crimson - * Crimson 3 - * Cuby Panic (copy protection routine at 0x911A) - - Daidasso (prints "BOOT dekimasen" on screen -> can't boot) - - Daikoukai Jidai (YSHELL.COM error) - - Databox (app) - - Day Dream ("Bad drive number at 570") - - Demons Ring - * Dennou Tsuushin - - Door Door MK-2 (sets up TC in the middle of execution phase read then wants status bit 6 to be low PC=0x7050 of fdc cpu) - * Dragon Slayer - The Legend of Heroes 2 - - Dungeon Buster - * El Dorado Denki - * Elevator Action - - Emerald Densetsu (dies after few seconds of intro) - - Emerald Dragon (it seems to miss a timer) - - Emmy - - Explosion (fails to load ADPCM data?) - * F15 Strike Eagle - - F2 Grand Prix ("Boot dekimasen") - # Fangs - The Saga of Wolf Blood (Crashes at the first random battle) - - Fantasian - * Final Zone - # Final Zone (demo) (REGRESSION: asserts at MESS boot) - - Fruit Panic - - FSD Sample Ongaku Shuu Vol. 1-7 - - Gaia no Kiba (Disk I/O error at 150) - - Gaiflame - - Gambler Jiko Chuushin ha - - Gambler Jiko Chuushin ha 2 - - Gambler Jiko Chuushin ha 3 - - Gambler Jiko Chuushin ha 3 (demo) - - Gambler Jiko Chuushin ha Mahjong Puzzle Collection - - Gambler Jiko Chuushin ha Mahjong Puzzle Collection (demo) - * Game Music Library - * Gaudi - Barcelona no Kaze (bad Wolfteam logo then black screen) - - GC-clusterz Music Disk Vol. 1-7 - * Genji - * Gokuraku Tengoku - - Grodius 3 (might not be floppy) - - Gun Ship (at gameplay) - (Hacker) - - - Harakiri - - Kaseijin (app) (code snippet is empty at some point) - - Lamia: fails to create an user disk (after character creation) -> disk write error - * MakaiMura (attempts to r/w the sio ports, but it's clearly crashed) - * Mugen Senshi Valis (at Telenet logo, it also appears to have a nasty copy protection when taking a specific item (untested)) - - Mr. Pro Yakyuu - - Panorama Toh - - PC-8034 (app) - - PC-8037SR (app) - - P1 (app) - - Pattern Editor 88 (app) - - Super Shunbo II (app) (Load error) - - Super TII (app) - * The Return of Ishtar - - Tobira wo Akete (random crashes in parent pc8801 only) - - list of games that doesn't like i8214_irq_level == 5 in sound irq - - 100yen Disk 2 / Jumper 2: Sound BGM dies pretty soon; - - Alpha (demo): stuck note in title screen, doesn't seem to go further; - - Ayumi: black screen after new game / load game screen; - - Brunette: No sound, eventually hangs at gameplay; - - Digital Devil Story Megami Tensei: hangs at gameplay (sound irq issue) - - Double Face: hangs at logo (sound irq issue) - - games that needs to NOT have write-protect floppies (BTANBs): - - Balance of Power - - Blue Moon Story: moans with a kanji msg; - - Mahjong Clinic Zoukangou - - Tobira wo Akete (hangs at title screen) - - games that needs to HAVE write-protect floppies (BTANBs): - - 100 Yen Disk 7: (doesn't boot in V2 mode) - - other BTANBs - - Attack Hirokochan: returns to BASIC after an initial animation, needs BASIC V1: - - Jark (needs PC-8801MC) - - Kuronekosou Souzoku Satsujin Jiken: "Illegal function call in 105", needs BASIC V1; - - Notes: - - BIOS disk ROM defines what kind of floppies you could load: - * with 0x0800 ROM size you can load 2d floppies only; - * with 0x2000 ROM size you can load 2d and 2hd floppies; - - Later models have palette bugs with some games (Alphos, Tokyo Nampa Street). - This is because you have to set up the V1 / V2 DIP-SW to V1 for those games (it's the BIOS that sets up to analog and never changes back otherwise). - - Password for "AY-1: Fortress Solomon" is "123" then press enter, any other key pressed makes it to fail the check (you must soft reset the machine) - - Pressing Home in Dennou Gakuen during gameplay makes it to show a fake DASM screen. That's supposed to be a panic button and it's also in the - sequels (with different screens); - - Bankswitch Notes: - - 0x31 - graphic banking - - 0x32 - misc banking - - 0x5c / 0x5f - VRAM banking - - 0x70 - window offset (banking) - - 0x71 - extra ROM banking - - 0x78 - window offset (banking) increment (+ 0x100) - - 0xe2 / 0xe3 - extra RAM banking - - 0xf0 / 0xf1 = kanji banking - -====================================================================================================================================== - - PC-88xx Models (and similar machines like PC-80xx and PC-98DO) - - Model | release | CPU | BIOS components | | - | | clock | N-BASIC | N88-BASIC | N88-BASIC Enh | Sound | CD | Dict | Disk | Notes - ================================================================================================================================== - PC-8001 | 1979-03 | z80A @ 4 | X | - | - | - | - | - | - | - PC-8001A | ?? | z80A @ 4 | X | - | - | - | - | - | - | (U) - PC-8801 | 1981-11 | z80A @ 4 | X | X | - | - | - | - | - | (KO) - PC-8801A | ?? | z80A @ 4 | X | X | - | - | - | - | - | (U) - PC-8001 mkII | 1983-03 | z80A @ 4 | X | - | - | - | - | - | - | (GE),(KO) - PC-8001 mkIIA | ?? | z80A @ 4 | X | - | - | - | - | - | - | (U),(GE) - PC-8801 mkII | 1983-11 | z80A @ 4 | X | X | - | - | - | - | (FDM) | (K1) - PC-8001 mkII SR | 1985-01 | z80A @ 4 | X | - | - | - | - | - | - | (GE),(NE),(KO) - PC-8801 mkII SR | 1985-03 | z80A @ 4 | X | X | X | X | - | - | (FDM) | (K1) - PC-8801 mkII TR | 1985-10 | z80A @ 4 | X | X | X | X | - | - | (FD2) | (K1) - PC-8801 mkII FR | 1985-11 | z80A @ 4 | X | X | X | X | - | - | (FDM) | (K1) - PC-8801 mkII MR | 1985-11 | z80A @ 4 | X | X | X | X | - | - | (FDH) | (K2) - PC-8801 FH | 1986-11 | z80H @ 4/8 | X | X | X | X | - | - | (FDM) | (K2) - PC-8801 MH | 1986-11 | z80H @ 4/8 | X | X | X | X | - | - | (FDH) | (K2) - PC-88 VA | 1987-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FDH) | (K2) - PC-8801 FA | 1987-11 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) - PC-8801 MA | 1987-11 | z80H @ 4/8 | X | X | X | X | - | X | (FDH) | (K2) - PC-88 VA2 | 1988-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FDH) | (K2) - PC-88 VA3 | 1988-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FD3) | (K2) - PC-8801 FE | 1988-10 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) - PC-8801 MA2 | 1988-10 | z80H @ 4/8 | X | X | X | X | - | X | (FDH) | (K2) - PC-98 DO | 1989-06 | z80H @ 8 | X | X | X | X | - | - | (FDH) | (KE) - PC-8801 FE2 | 1989-10 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) - PC-8801 MC | 1989-11 | z80H @ 4/8 | X | X | X | X | X | X | (FDH) | (K2) - PC-98 DO+ | 1990-10 | z80H @ 8 | X | X | X | X | - | - | (FDH) | (KE) - - info for PC-98 DO & DO+ refers to their 88-mode - - Disk Drive options: - (FDM): there exist three model of this computer: Model 10 (base model, only optional floppy drive), Model 20 - (1 floppy drive for 5.25" 2D disks) and Model 30 (2 floppy drive for 5.25" 2D disks) - (FD2): 2 floppy drive for 5.25" 2D disks - (FDH): 2 floppy drive for both 5.25" 2D disks and 5.25" HD disks - (FD3): 2 floppy drive for both 5.25" 2D disks and 5.25" HD disks + 1 floppy drive for 3.5" 2TD disks - - Notes: - (U): US version - (GE): Graphic Expansion for PC-8001 - (NE): N-BASIC Expansion for PC-8001 (similar to N88-BASIC Expansion for PC-88xx) - (KO): Optional Kanji ROM - (K1): Kanji 1st Level ROM - (K2): Kanji 2nd Level ROM - (KE): Kanji Enhanced ROM - - Memory mounting locations: - * N-BASIC 0x0000 - 0x5fff, N-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff - * N-BASIC 0x0000 - 0x5fff, N-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff - * N88-BASIC 0x0000 - 0x7fff, N88-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff - * Sound BIOS: 0x6000 - 0x7fff - * CD-ROM BIOS: 0x0000 - 0x7fff - * Dictionary: 0xc000 - 0xffff (32 Banks) - - info from http://www.geocities.jp/retro_zzz/machines/nec/cmn_roms.html - also, refer to http://www.geocities.jp/retro_zzz/machines/nec/cmn_vers.html for - info about BASIC revisions in the various models (BASIC V2 is the BASIC - Expansion, if I unerstood correctly) - -*************************************************************************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8255.h" -#include "machine/upd1990a.h" -#include "machine/upd765.h" -#include "machine/i8214.h" -#include "machine/i8251.h" -#include "sound/2203intf.h" -#include "sound/2608intf.h" -#include "sound/beep.h" -//#include "includes/pc8801.h" - -//#define USE_PROPER_I8214 - - -#define IRQ_DEBUG (0) -#define IRQ_LOG(x) do { if (IRQ_DEBUG) printf x; } while (0) - -#define MASTER_CLOCK XTAL_4MHz -/* TODO: clocks of this */ -#define PIXEL_CLOCK_15KHz XTAL_14_31818MHz -#define PIXEL_CLOCK_24KHz XTAL_21_4772MHz - -#define I8214_TAG "i8214" -#define UPD1990A_TAG "upd1990a" -#define I8251_TAG "i8251" - -struct crtc_t -{ - UINT8 cmd,param_count,cursor_on,status,irq_mask; - UINT8 param[8][5]; - UINT8 inverse; -}; - -struct mouse_t -{ - UINT8 phase; - UINT8 x,y; - attotime time; -}; - -class pc8801_state : public driver_device -{ -public: - pc8801_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_fdccpu(*this, "fdccpu"), - m_pic(*this, I8214_TAG), - m_rtc(*this, UPD1990A_TAG), - m_cassette(*this, "cassette"), - m_beeper(*this, "beeper"), - m_opna(*this, "opna"), - m_opn(*this, "opn"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_fdccpu; - optional_device m_pic; - required_device m_rtc; - required_device m_cassette; - required_device m_beeper; - required_device m_opna; - required_device m_opn; - required_device m_palette; - - UINT8 *m_work_ram; - UINT8 *m_hi_work_ram; - UINT8 *m_ext_work_ram; - UINT8 *m_gvram; - UINT8 *m_n80rom; - UINT8 *m_n88rom; - UINT8 *m_kanji_rom; - UINT8 *m_cg_rom; - - UINT8 m_i8255_0_pc; - UINT8 m_i8255_1_pc; - UINT8 m_fdc_irq_opcode; - UINT8 m_ext_rom_bank; - UINT8 m_gfx_ctrl; - UINT8 m_vram_sel; - UINT8 m_misc_ctrl; - UINT8 m_device_ctrl_data; - UINT8 m_window_offset_bank; - UINT8 m_layer_mask; - UINT16 m_dma_counter[4]; - UINT16 m_dma_address[4]; - UINT8 m_alu_reg[3]; - UINT8 m_dmac_mode; - UINT8 m_alu_ctrl1; - UINT8 m_alu_ctrl2; - UINT8 m_extram_mode; - UINT8 m_extram_bank; - UINT8 m_txt_width; - UINT8 m_txt_color; -#ifdef USE_PROPER_I8214 - UINT8 m_timer_irq_mask; - UINT8 m_vblank_irq_mask; - UINT8 m_sound_irq_mask; - UINT8 m_int_state; -#else - UINT8 m_i8214_irq_level; - UINT8 m_vrtc_irq_mask; - UINT8 m_vrtc_irq_latch; - UINT8 m_timer_irq_mask; - UINT8 m_timer_irq_latch; - UINT8 m_sound_irq_mask; - UINT8 m_sound_irq_latch; - UINT8 m_sound_irq_pending; -#endif - UINT8 m_has_clock_speed; - UINT8 m_clock_setting; - UINT8 m_baudrate_val; - UINT8 m_has_dictionary; - UINT8 m_dic_ctrl; - UINT8 m_dic_bank; - UINT8 m_has_cdrom; - UINT8 m_cdrom_reg[0x10]; - crtc_t m_crtc; - mouse_t m_mouse; - struct { UINT8 r, g, b; } m_palram[8]; - UINT8 m_dmac_ff; - UINT32 m_knj_addr[2]; - UINT32 m_extram_size; - UINT8 m_has_opna; - - DECLARE_READ8_MEMBER(pc8801_alu_r); - DECLARE_WRITE8_MEMBER(pc8801_alu_w); - DECLARE_READ8_MEMBER(pc8801_wram_r); - DECLARE_WRITE8_MEMBER(pc8801_wram_w); - DECLARE_READ8_MEMBER(pc8801_ext_wram_r); - DECLARE_WRITE8_MEMBER(pc8801_ext_wram_w); - DECLARE_READ8_MEMBER(pc8801_nbasic_rom_r); - DECLARE_READ8_MEMBER(pc8801_n88basic_rom_r); - DECLARE_READ8_MEMBER(pc8801_gvram_r); - DECLARE_WRITE8_MEMBER(pc8801_gvram_w); - DECLARE_READ8_MEMBER(pc8801_high_wram_r); - DECLARE_WRITE8_MEMBER(pc8801_high_wram_w); - DECLARE_READ8_MEMBER(pc8801ma_dic_r); - DECLARE_READ8_MEMBER(pc8801_cdbios_rom_r); - DECLARE_READ8_MEMBER(pc8801_mem_r); - DECLARE_WRITE8_MEMBER(pc8801_mem_w); - DECLARE_READ8_MEMBER(pc8801_ctrl_r); - DECLARE_WRITE8_MEMBER(pc8801_ctrl_w); - DECLARE_READ8_MEMBER(pc8801_ext_rom_bank_r); - DECLARE_WRITE8_MEMBER(pc8801_ext_rom_bank_w); - DECLARE_WRITE8_MEMBER(pc8801_gfx_ctrl_w); - DECLARE_READ8_MEMBER(pc8801_vram_select_r); - DECLARE_WRITE8_MEMBER(pc8801_vram_select_w); - DECLARE_WRITE8_MEMBER(i8214_irq_level_w); - DECLARE_WRITE8_MEMBER(i8214_irq_mask_w); - DECLARE_WRITE8_MEMBER(pc8801_irq_level_w); - DECLARE_WRITE8_MEMBER(pc8801_irq_mask_w); - DECLARE_READ8_MEMBER(pc8801_window_bank_r); - DECLARE_WRITE8_MEMBER(pc8801_window_bank_w); - DECLARE_WRITE8_MEMBER(pc8801_window_bank_inc_w); - DECLARE_READ8_MEMBER(pc8801_misc_ctrl_r); - DECLARE_WRITE8_MEMBER(pc8801_misc_ctrl_w); - DECLARE_WRITE8_MEMBER(pc8801_bgpal_w); - DECLARE_WRITE8_MEMBER(pc8801_palram_w); - DECLARE_WRITE8_MEMBER(pc8801_layer_masking_w); - DECLARE_READ8_MEMBER(pc8801_crtc_param_r); - DECLARE_WRITE8_MEMBER(pc88_crtc_param_w); - DECLARE_READ8_MEMBER(pc8801_crtc_status_r); - DECLARE_WRITE8_MEMBER(pc88_crtc_cmd_w); - DECLARE_READ8_MEMBER(pc8801_dmac_r); - DECLARE_WRITE8_MEMBER(pc8801_dmac_w); - DECLARE_READ8_MEMBER(pc8801_dmac_status_r); - DECLARE_WRITE8_MEMBER(pc8801_dmac_mode_w); - DECLARE_READ8_MEMBER(pc8801_extram_mode_r); - DECLARE_WRITE8_MEMBER(pc8801_extram_mode_w); - DECLARE_READ8_MEMBER(pc8801_extram_bank_r); - DECLARE_WRITE8_MEMBER(pc8801_extram_bank_w); - DECLARE_WRITE8_MEMBER(pc8801_alu_ctrl1_w); - DECLARE_WRITE8_MEMBER(pc8801_alu_ctrl2_w); - DECLARE_WRITE8_MEMBER(pc8801_pcg8100_w); - DECLARE_WRITE8_MEMBER(pc8801_txt_cmt_ctrl_w); - DECLARE_READ8_MEMBER(pc8801_kanji_r); - DECLARE_WRITE8_MEMBER(pc8801_kanji_w); - DECLARE_READ8_MEMBER(pc8801_kanji_lv2_r); - DECLARE_WRITE8_MEMBER(pc8801_kanji_lv2_w); - DECLARE_WRITE8_MEMBER(pc8801_dic_bank_w); - DECLARE_WRITE8_MEMBER(pc8801_dic_ctrl_w); - DECLARE_READ8_MEMBER(pc8801_cdrom_r); - DECLARE_WRITE8_MEMBER(pc8801_cdrom_w); - DECLARE_READ8_MEMBER(pc8801_cpuclock_r); - DECLARE_READ8_MEMBER(pc8801_baudrate_r); - DECLARE_WRITE8_MEMBER(pc8801_baudrate_w); - DECLARE_WRITE8_MEMBER(pc8801_rtc_w); - DECLARE_WRITE8_MEMBER(upd765_mc_w); - DECLARE_READ8_MEMBER(upd765_tc_r); - DECLARE_WRITE8_MEMBER(fdc_irq_vector_w); - DECLARE_WRITE8_MEMBER(fdc_drive_mode_w); - DECLARE_WRITE_LINE_MEMBER(txdata_callback); - DECLARE_WRITE_LINE_MEMBER(rxrdy_w); - DECLARE_READ8_MEMBER(pc8801_sound_board_r); - DECLARE_WRITE8_MEMBER(pc8801_sound_board_w); - DECLARE_READ8_MEMBER(pc8801_opna_r); - DECLARE_WRITE8_MEMBER(pc8801_opna_w); - DECLARE_READ8_MEMBER(pc8801_unk_r); - DECLARE_WRITE8_MEMBER(pc8801_unk_w); - - UINT8 pc8801_pixel_clock(void); - void pc8801_dynamic_res_change(void); - void draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect); - void draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect); - UINT8 calc_cursor_pos(int x,int y,int yi); - UINT8 extract_text_attribute(UINT32 address,int x, UINT8 width, UINT8 &non_special); - void pc8801_draw_char(bitmap_ind16 &bitmap,int x,int y,int pal,UINT8 gfx_mode,UINT8 reverse,UINT8 secret, - UINT8 blink,UINT8 upper,UINT8 lower,int y_size,int width, UINT8 non_special); - void draw_text(bitmap_ind16 &bitmap,int y_size, UINT8 width); - void fdc_irq_w(bool state); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_PALETTE_INIT(pc8801); -protected: - - virtual void video_start(); - virtual void machine_start(); - virtual void machine_reset(); -public: - DECLARE_MACHINE_RESET(pc8801_clock_speed); - DECLARE_MACHINE_RESET(pc8801_dic); - DECLARE_MACHINE_RESET(pc8801_cdrom); - INTERRUPT_GEN_MEMBER(pc8801_vrtc_irq); - TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero); - TIMER_DEVICE_CALLBACK_MEMBER(pc8801_rtc_irq); - DECLARE_READ8_MEMBER(cpu_8255_c_r); - DECLARE_WRITE8_MEMBER(cpu_8255_c_w); - DECLARE_READ8_MEMBER(fdc_8255_c_r); - DECLARE_WRITE8_MEMBER(fdc_8255_c_w); - DECLARE_WRITE_LINE_MEMBER(pic_int_w); - DECLARE_WRITE_LINE_MEMBER(pic_enlg_w); - DECLARE_READ8_MEMBER(opn_porta_r); - DECLARE_READ8_MEMBER(opn_portb_r); - IRQ_CALLBACK_MEMBER(pc8801_irq_callback); - void pc8801_raise_irq(UINT8 irq,UINT8 state); - DECLARE_WRITE_LINE_MEMBER(pc8801_sound_irq); -}; - - -/* -CRTC command params: -0. CRTC reset - -[0] *--- ---- -[0] -xxx xxxx screen columns (+2) - -[1] xx-- ---- blink speed (in frame unit) (+1, << 3) -[1] --xx xxxx screen lines (+1) - -[2] x--- ---- "skip line" -[2] -x-- ---- cursor style (reverse on / underscore off) -[2] --x- ---- cursor blink on/off -[2] ---x xxxx lines per character (+1) - -[3] xxx- ---- Vertical Retrace (+1) -[3] ---x xxxx Horizontal Retrace (+2) - -[4] x--- ---- attribute not separate flag -[4] -x-- ---- attribute color flag -[4] --x- ---- attribute not special flag (invalidates next register) -[4] ---x xxxx attribute size (+1) -*/ - -#define screen_width ((m_crtc.param[0][0] & 0x7f) + 2) * 8 - -#define blink_speed ((((m_crtc.param[0][1] & 0xc0) >> 6) + 1) << 3) -#define screen_height ((m_crtc.param[0][1] & 0x3f) + 1) - -#define lines_per_char ((m_crtc.param[0][2] & 0x1f) + 1) - -#define vretrace (((m_crtc.param[0][3] & 0xe0) >> 5) + 1) -#define hretrace ((m_crtc.param[0][3] & 0x1f) + 2) * 8 - -#define text_color_flag ((m_crtc.param[0][4] & 0xe0) == 0x40) -//#define monitor_24KHz ((m_gfx_ctrl & 0x19) == 0x08) /* TODO: this is most likely to be WRONG */ - -void pc8801_state::video_start() -{ -} - -void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) -{ - int x,y,xi; - UINT32 count; - UINT16 y_size; - UINT16 y_double; - - count = 0; - - y_double = (pc8801_pixel_clock()); - y_size = (y_double+1) * 200; - - for(y=0;y> (7-xi)) & 1) << 0; - pen |= ((m_gvram[count+0x4000] >> (7-xi)) & 1) << 1; - pen |= ((m_gvram[count+0x8000] >> (7-xi)) & 1) << 2; - - if(y_double) - { - if(cliprect.contains(x+xi, y+0)) - bitmap.pix16(y+0, x+xi) = m_palette->pen(pen & 7); - - if(cliprect.contains(x+xi, y+1)) - bitmap.pix16(y+1, x+xi) = m_palette->pen(pen & 7); - } - else - { - if(cliprect.contains(x+xi, y+0)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen & 7); - } - } - - count++; - } - } -} - -void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) -{ - int x,y,xi; - UINT32 count; - UINT8 color; - UINT8 is_cursor; - - count = 0; - color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; - is_cursor = 0; - - for(y=0;y<200;y++) - { - for(x=0;x<640;x+=8) - { - if(!(m_gfx_ctrl & 1)) - is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); - - for(xi=0;xi<8;xi++) - { - int pen; - - pen = ((m_gvram[count+0x0000] >> (7-xi)) & 1); - if(is_cursor) - pen^=1; - - if((m_gfx_ctrl & 1)) - { - if(cliprect.contains(x+xi, y*2+0)) - bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen ? color : 0); - - if(cliprect.contains(x+xi, y*2+1)) - bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen ? color : 0); - } - else - { - if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen ? color : 0); - } - } - - count++; - } - } - - if(!(m_gfx_ctrl & 1)) // 400 lines - { - count = 0; - - for(y=200;y<400;y++) - { - for(x=0;x<640;x+=8) - { - if(!(m_gfx_ctrl & 1)) - is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); - - for(xi=0;xi<8;xi++) - { - int pen; - - pen = ((m_gvram[count+0x4000] >> (7-xi)) & 1); - if(is_cursor) - pen^=1; - - if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen ? 7 : 0); - } - - count++; - } - } - } -} - -UINT8 pc8801_state::calc_cursor_pos(int x,int y,int yi) -{ - if(!(m_crtc.cursor_on)) // don't bother if cursor is off - return 0; - - if(x == m_crtc.param[4][0] && y == m_crtc.param[4][1]) /* check if position matches */ - { - /* don't pass through if we are using underscore */ - if((!(m_crtc.param[0][2] & 0x40)) && yi != 7) - return 0; - - /* finally check if blinking is currently active high */ - if(!(m_crtc.param[0][2] & 0x20)) - return 1; - - if(((machine().first_screen()->frame_number() / blink_speed) & 1) == 0) - return 1; - - return 0; - } - - return 0; -} - - - -UINT8 pc8801_state::extract_text_attribute(UINT32 address,int x, UINT8 width, UINT8 &non_special) -{ - UINT8 *vram = m_work_ram; - int i; - int fifo_size; - int offset; - - non_special = 0; - if(m_crtc.param[0][4] & 0x80) - { - popmessage("Using non-separate mode for text tilemap, contact MESSdev"); - return 0; - } - - fifo_size = (m_crtc.param[0][4] & 0x20) ? 0 : ((m_crtc.param[0][4] & 0x1f) + 1); - - if(fifo_size == 0) - { - non_special = 1; - return (text_color_flag) ? 0xe8 : 0; - } - - /* TODO: correct or hack-ish? Certainly having 0 as a attribute X is weird in any case. */ - offset = (vram[address] == 0) ? 2 : 0; - - for(i=0;ivisible_area().contains(res_x, res_y)) - continue; - - if(gfx_mode) - { - UINT8 mask; - - mask = (xi & 4) ? 0x10 : 0x01; - mask <<= ((yi & (0x6 << y_double)) >> (1+y_double)); - color = (tile & mask) ? pal : -1; - } - else - { - UINT8 char_data; - UINT8 blink_mask; - - blink_mask = 0; - if(blink && ((machine().first_screen()->frame_number() / blink_speed) & 3) == 1) - blink_mask = 1; - - if(yi >= (1 << (y_double+3)) || secret || blink_mask) - char_data = 0; - else - char_data = (m_cg_rom[tile*8+(yi >> y_double)] >> (7-xi)) & 1; - - if(yi == 0 && upper) - char_data = 1; - - if(yi == y_height && lower) - char_data = 1; - - if(is_cursor) - char_data^=1; - - if(reverse) - char_data^=1; - - color = char_data ? pal : -1; - } - - if(color != -1) - { - bitmap.pix16(res_y, res_x) = m_palette->pen(color); - if(width) - { - if(!machine().first_screen()->visible_area().contains(res_x+1, res_y)) - continue; - - bitmap.pix16(res_y, res_x+1) = m_palette->pen(color); - } - } - } - } - } -} - -void pc8801_state::draw_text(bitmap_ind16 &bitmap,int y_size, UINT8 width) -{ - int x,y; - UINT8 attr; - UINT8 reverse; - UINT8 gfx_mode; - UINT8 secret; - UINT8 upper; - UINT8 lower; - UINT8 blink; - int pal; - UINT8 non_special; - - for(y=0;y> 5); - gfx_mode = (attr & 0x10) >> 4; - reverse = 0; - secret = 0; - upper = 0; - lower = 0; - blink = 0; - pal|=8; //text pal bank - } - else // monochrome - { - pal = 7; /* TODO: Bishoujo Baseball Gakuen Pasoket logo wants this to be black somehow ... */ - gfx_mode = (attr & 0x80) >> 7; - reverse = (attr & 4) >> 2; - secret = (attr & 1); - upper = (attr & 0x10) >> 4; - lower = (attr & 0x20) >> 5; - blink = (attr & 2) >> 1; - pal|=8; //text pal bank - reverse ^= m_crtc.inverse; - - if(attr & 0x80) - popmessage("Warning: mono gfx mode enabled, contact MESSdev"); - - } - - pc8801_draw_char(bitmap,x,y,pal,gfx_mode,reverse,secret,blink,upper,lower,y_size,!width,non_special); - } - } -} - -UINT32 pc8801_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(m_palette->pen(0), cliprect); - -// popmessage("%04x %04x %02x",m_dma_address[2],m_dma_counter[2],m_dmac_mode); - - if(m_gfx_ctrl & 8) - { - if(m_gfx_ctrl & 0x10) - draw_bitmap_3bpp(bitmap,cliprect); - else - draw_bitmap_1bpp(bitmap,cliprect); - } - - //popmessage("%02x %02x %02x %02x %02x",state->m_layer_mask,state->m_dmac_mode,state->m_crtc.status,state->m_crtc.irq_mask,state->m_gfx_ctrl); - - if(!(m_layer_mask & 1) && m_dmac_mode & 4 && m_crtc.status & 0x10 && m_crtc.irq_mask == 3) - { - //popmessage("%02x %02x",m_crtc.param[0][0],m_crtc.param[0][4]); - - draw_text(bitmap,screen_height,m_txt_width); - } - - return 0; -} - -READ8_MEMBER(pc8801_state::pc8801_alu_r) -{ - int i; - UINT8 b,r,g; - - /* store data to ALU regs */ - for(i=0;i<3;i++) - m_alu_reg[i] = m_gvram[i*0x4000 + offset]; - - b = m_gvram[offset + 0x0000]; - r = m_gvram[offset + 0x4000]; - g = m_gvram[offset + 0x8000]; - if(!(m_alu_ctrl2 & 1)) { b^=0xff; } - if(!(m_alu_ctrl2 & 2)) { r^=0xff; } - if(!(m_alu_ctrl2 & 4)) { g^=0xff; } - - return b & r & g; -} - -WRITE8_MEMBER(pc8801_state::pc8801_alu_w) -{ - int i; - - switch(m_alu_ctrl2 & 0x30) // alu write mode - { - case 0x00: //logic operation - { - UINT8 logic_op; - - for(i=0;i<3;i++) - { - logic_op = (m_alu_ctrl1 & (0x11 << i)) >> i; - - switch(logic_op) - { - case 0x00: { m_gvram[i*0x4000 + offset] &= ~data; } break; - case 0x01: { m_gvram[i*0x4000 + offset] |= data; } break; - case 0x10: { m_gvram[i*0x4000 + offset] ^= data; } break; - case 0x11: break; // NOP - } - } - } - break; - - case 0x10: // restore data from ALU regs - { - for(i=0;i<3;i++) - m_gvram[i*0x4000 + offset] = m_alu_reg[i]; - } - break; - - case 0x20: // swap ALU reg 1 into R GVRAM - m_gvram[0x0000 + offset] = m_alu_reg[1]; - break; - - case 0x30: // swap ALU reg 0 into B GVRAM - m_gvram[0x4000 + offset] = m_alu_reg[0]; - break; - } -} - - -READ8_MEMBER(pc8801_state::pc8801_wram_r) -{ - return m_work_ram[offset]; -} - -WRITE8_MEMBER(pc8801_state::pc8801_wram_w) -{ - m_work_ram[offset] = data; -} - -READ8_MEMBER(pc8801_state::pc8801_ext_wram_r) -{ - if(offset < m_extram_size) - return m_ext_work_ram[offset]; - - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_ext_wram_w) -{ - if(offset < m_extram_size) - m_ext_work_ram[offset] = data; -} - -READ8_MEMBER(pc8801_state::pc8801_nbasic_rom_r) -{ - return m_n80rom[offset]; -} - -READ8_MEMBER(pc8801_state::pc8801_n88basic_rom_r) -{ - return m_n88rom[offset]; -} - -READ8_MEMBER(pc8801_state::pc8801_gvram_r) -{ - return m_gvram[offset]; -} - -WRITE8_MEMBER(pc8801_state::pc8801_gvram_w) -{ - m_gvram[offset] = data; -} - -READ8_MEMBER(pc8801_state::pc8801_high_wram_r) -{ - return m_hi_work_ram[offset]; -} - -WRITE8_MEMBER(pc8801_state::pc8801_high_wram_w) -{ - m_hi_work_ram[offset] = data; -} - -READ8_MEMBER(pc8801_state::pc8801ma_dic_r) -{ - UINT8 *dic_rom = memregion("dictionary")->base(); - - return dic_rom[offset]; -} - -READ8_MEMBER(pc8801_state::pc8801_cdbios_rom_r) -{ - UINT8 *cdrom_bios = memregion("cdrom")->base(); - - return cdrom_bios[offset]; -} - -READ8_MEMBER(pc8801_state::pc8801_mem_r) -{ - if(offset <= 0x7fff) - { - if(m_extram_mode & 1) - return pc8801_ext_wram_r(space,offset | (m_extram_bank * 0x8000)); - - if(m_gfx_ctrl & 2) - return pc8801_wram_r(space,offset); - - if(m_has_cdrom && m_cdrom_reg[9] & 0x10) - return pc8801_cdbios_rom_r(space,(offset & 0x7fff) | ((m_gfx_ctrl & 4) ? 0x8000 : 0x0000)); - - if(m_gfx_ctrl & 4) - return pc8801_nbasic_rom_r(space,offset); - - if(offset >= 0x6000 && offset <= 0x7fff && ((m_ext_rom_bank & 1) == 0)) - return pc8801_n88basic_rom_r(space,0x8000 + (offset & 0x1fff) + (0x2000 * (m_misc_ctrl & 3))); - - return pc8801_n88basic_rom_r(space,offset); - } - else if(offset >= 0x8000 && offset <= 0x83ff) // work RAM window - { - UINT32 window_offset; - - if(m_gfx_ctrl & 6) //wram read select or n basic select banks this as normal wram - return pc8801_wram_r(space,offset); - - window_offset = (offset & 0x3ff) + (m_window_offset_bank << 8); - - if(((window_offset & 0xf000) == 0xf000) && (m_misc_ctrl & 0x10)) - printf("Read from 0xf000 - 0xffff window offset\n"); //accessed by Castle Excellent, no noticeable quirk - - if(((window_offset & 0xf000) == 0xf000) && (m_misc_ctrl & 0x10)) - return pc8801_high_wram_r(space,window_offset & 0xfff); - - return pc8801_wram_r(space,window_offset); - } - else if(offset >= 0x8400 && offset <= 0xbfff) - { - return pc8801_wram_r(space,offset); - } - else if(offset >= 0xc000 && offset <= 0xffff) - { - if(m_has_dictionary && m_dic_ctrl) - return pc8801ma_dic_r(space,(offset & 0x3fff) + ((m_dic_bank & 0x1f) * 0x4000)); - - if(m_misc_ctrl & 0x40) - { - if(!space.debugger_access()) - m_vram_sel = 3; - - if(m_alu_ctrl2 & 0x80) - return pc8801_alu_r(space,offset & 0x3fff); - } - - if(m_vram_sel == 3) - { - if(offset >= 0xf000 && offset <= 0xffff && (m_misc_ctrl & 0x10)) - return pc8801_high_wram_r(space,offset & 0xfff); - - return pc8801_wram_r(space,offset); - } - - return pc8801_gvram_r(space,(offset & 0x3fff) + (0x4000 * m_vram_sel)); - } - - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_mem_w) -{ - if(offset <= 0x7fff) - { - if(m_extram_mode & 0x10) - pc8801_ext_wram_w(space,offset | (m_extram_bank * 0x8000),data); - else - pc8801_wram_w(space,offset,data); - - return; - } - else if(offset >= 0x8000 && offset <= 0x83ff) - { - if(m_gfx_ctrl & 6) //wram read select or n basic select banks this as normal wram - pc8801_wram_w(space,offset,data); - else - { - UINT32 window_offset; - - window_offset = (offset & 0x3ff) + (m_window_offset_bank << 8); - - if(((window_offset & 0xf000) == 0xf000) && (m_misc_ctrl & 0x10)) - printf("Write to 0xf000 - 0xffff window offset\n"); //accessed by Castle Excellent, no noticeable quirk - - if(((window_offset & 0xf000) == 0xf000) && (m_misc_ctrl & 0x10)) - pc8801_high_wram_w(space,window_offset & 0xfff,data); - else - pc8801_wram_w(space,window_offset,data); - } - - return; - } - else if(offset >= 0x8400 && offset <= 0xbfff) - { - pc8801_wram_w(space,offset,data); - return; - } - else if(offset >= 0xc000 && offset <= 0xffff) - { - if(m_misc_ctrl & 0x40) - { - if(!space.debugger_access()) - m_vram_sel = 3; - - if(m_alu_ctrl2 & 0x80) - { - pc8801_alu_w(space,offset & 0x3fff,data); - return; - } - } - - if(m_vram_sel == 3) - { - if(offset >= 0xf000 && offset <= 0xffff && (m_misc_ctrl & 0x10)) - { - pc8801_high_wram_w(space,offset & 0xfff,data); - return; - } - - pc8801_wram_w(space,offset,data); - return; - } - - pc8801_gvram_w(space,(offset & 0x3fff) + (0x4000 * m_vram_sel),data); - return; - } -} - -static ADDRESS_MAP_START( pc8801_mem, AS_PROGRAM, 8, pc8801_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(pc8801_mem_r,pc8801_mem_w) -ADDRESS_MAP_END - -READ8_MEMBER(pc8801_state::pc8801_ctrl_r) -{ - /* - 11-- ---- - --x- ---- vrtc - ---x ---- calendar CDO - ---- x--- fdc auto-boot DIP-SW - ---- -x-- (RS-232C related) - ---- --x- monitor refresh rate DIP-SW - ---- ---x (pbsy?) - */ - return ioport("CTRL")->read(); -} - -WRITE8_MEMBER(pc8801_state::pc8801_ctrl_w) -{ - /* - x--- ---- SING (buzzer mask?) - -x-- ---- mouse latch (JOP1, routes on OPN sound port A) - --x- ---- beeper - ---x ---- ghs mode - ---- x--- crtc i/f sync mode - ---- -x-- upd1990a clock bit - ---- --x- upd1990a strobe bit - ---- ---x printer strobe - */ - - m_rtc->stb_w((data & 2) >> 1); - m_rtc->clk_w((data & 4) >> 2); - - if(((m_device_ctrl_data & 0x20) == 0x00) && ((data & 0x20) == 0x20)) - m_beeper->set_state(1); - - if(((m_device_ctrl_data & 0x20) == 0x20) && ((data & 0x20) == 0x00)) - m_beeper->set_state(0); - - if((m_device_ctrl_data & 0x40) != (data & 0x40)) - { - attotime new_time = machine().time(); - - if(m_mouse.phase == 0) - { - m_mouse.x = ioport("MOUSEX")->read(); - m_mouse.y = ioport("MOUSEY")->read(); - } - - if(data & 0x40 && (new_time - m_mouse.time) > attotime::from_hz(900)) - { - m_mouse.phase = 0; - } - else - { - m_mouse.phase++; - m_mouse.phase &= 3; - } - - m_mouse.time = machine().time(); - } - - /* TODO: is SING a buzzer mask? Bastard Special relies on this ... */ - if(m_device_ctrl_data & 0x80) - m_beeper->set_state(0); - - m_device_ctrl_data = data; -} - -READ8_MEMBER(pc8801_state::pc8801_ext_rom_bank_r) -{ - return m_ext_rom_bank; -} - -WRITE8_MEMBER(pc8801_state::pc8801_ext_rom_bank_w) -{ - m_ext_rom_bank = data; -} - -UINT8 pc8801_state::pc8801_pixel_clock(void) -{ - int ysize = machine().first_screen()->height(); /* TODO: correct condition*/ - - return (ysize >= 400); -} - -void pc8801_state::pc8801_dynamic_res_change(void) -{ - rectangle visarea; - int xsize,ysize,xvis,yvis; - attoseconds_t refresh;; - - /* bail out if screen params aren't valid */ - if(!m_crtc.param[0][0] || !m_crtc.param[0][1] || !m_crtc.param[0][2] || !m_crtc.param[0][3]) - return; - - xvis = screen_width; - yvis = screen_height * lines_per_char; - xsize = screen_width + hretrace; - ysize = screen_height * lines_per_char + vretrace * lines_per_char; - -// popmessage("H %d V %d (%d x %d) HR %d VR %d (%d %d)\n",xvis,yvis,screen_height,lines_per_char,hretrace,vretrace, xsize,ysize); - - visarea.set(0, xvis - 1, 0, yvis - 1); - if(pc8801_pixel_clock()) - refresh = HZ_TO_ATTOSECONDS(PIXEL_CLOCK_24KHz) * (xsize) * ysize; - else - refresh = HZ_TO_ATTOSECONDS(PIXEL_CLOCK_15KHz) * (xsize) * ysize; - - machine().first_screen()->configure(xsize, ysize, visarea, refresh); -} - -WRITE8_MEMBER(pc8801_state::pc8801_gfx_ctrl_w) -{ - /* - --x- ---- ??? - ---x ---- graphic color yes (1) / no (0) - ---- x--- graphic display yes (1) / no (0) - ---- -x-- Basic N (1) / N88 (0) - ---- --x- RAM select yes (1) / no (0) - ---- ---x VRAM 200 lines (1) / 400 lines (0) in 1bpp mode - */ - - m_gfx_ctrl = data; - - pc8801_dynamic_res_change(); -} - -READ8_MEMBER(pc8801_state::pc8801_vram_select_r) -{ - return 0xf8 | ((m_vram_sel == 3) ? 0 : (1 << m_vram_sel)); -} - -WRITE8_MEMBER(pc8801_state::pc8801_vram_select_w) -{ - m_vram_sel = offset & 3; -} - -#ifdef USE_PROPER_I8214 - -WRITE8_MEMBER(pc8801_state::i8214_irq_level_w) -{ - if(data & 8) - m_pic->b_w(7); - else - m_pic->b_w(data & 0x07); -} - -WRITE8_MEMBER(pc8801_state::i8214_irq_mask_w) -{ - m_timer_irq_mask = data & 1; - m_vblank_irq_mask = data & 2; -} - - -#else -WRITE8_MEMBER(pc8801_state::pc8801_irq_level_w) -{ - if(data & 8) - m_i8214_irq_level = 7; - else - m_i8214_irq_level = data & 7; - -// IRQ_LOG(("%02x LV\n",m_i8214_irq_level)); -} - - -WRITE8_MEMBER(pc8801_state::pc8801_irq_mask_w) -{ - m_timer_irq_mask = data & 1; - m_vrtc_irq_mask = data & 2; - - if(m_timer_irq_mask == 0) - m_timer_irq_latch = 0; - - if(m_vrtc_irq_mask == 0) - m_vrtc_irq_latch = 0; - - if(m_timer_irq_latch == 0 && m_vrtc_irq_latch == 0 && m_sound_irq_latch == 0) - m_maincpu->set_input_line(0,CLEAR_LINE); - -// IRQ_LOG(("%02x MASK (%02x %02x)\n",data,m_timer_irq_latch,m_vrtc_irq_latch)); - - //if(data & 4) - // printf("IRQ mask %02x\n",data); -} -#endif - -READ8_MEMBER(pc8801_state::pc8801_window_bank_r) -{ - return m_window_offset_bank; -} - -WRITE8_MEMBER(pc8801_state::pc8801_window_bank_w) -{ - m_window_offset_bank = data; -} - -WRITE8_MEMBER(pc8801_state::pc8801_window_bank_inc_w) -{ - m_window_offset_bank++; - m_window_offset_bank&=0xff; -} - -READ8_MEMBER(pc8801_state::pc8801_misc_ctrl_r) -{ - return m_misc_ctrl; -} - -WRITE8_MEMBER(pc8801_state::pc8801_misc_ctrl_w) -{ - /* - x--- ---- sound irq mask, active low - --x- ---- analog (1) / digital (0) palette select - */ - - m_misc_ctrl = data; - - #ifdef USE_PROPER_I8214 - m_sound_irq_mask = ((data & 0x80) == 0); - #else - m_sound_irq_mask = ((data & 0x80) == 0); - - if(m_sound_irq_mask == 0) - m_sound_irq_latch = 0; - - if(m_timer_irq_latch == 0 && m_vrtc_irq_latch == 0 && m_sound_irq_latch == 0) - m_maincpu->set_input_line(0,CLEAR_LINE); - - if(m_sound_irq_mask && m_sound_irq_pending) - { - m_maincpu->set_input_line(0,HOLD_LINE); - m_sound_irq_latch = 1; - m_sound_irq_pending = 0; - } - - #endif -} - -WRITE8_MEMBER(pc8801_state::pc8801_bgpal_w) -{ - if(data) - printf("BG Pal %02x\n",data); -} - -WRITE8_MEMBER(pc8801_state::pc8801_palram_w) -{ - if(m_misc_ctrl & 0x20) //analog palette - { - if((data & 0x40) == 0) - { - m_palram[offset].b = data & 0x7; - m_palram[offset].r = (data & 0x38) >> 3; - } - else - { - m_palram[offset].g = data & 0x7; - } - } - else //digital palette - { - m_palram[offset].b = data & 1 ? 7 : 0; - m_palram[offset].r = data & 2 ? 7 : 0; - m_palram[offset].g = data & 4 ? 7 : 0; - } - - m_palette->set_pen_color(offset, pal3bit(m_palram[offset].r), pal3bit(m_palram[offset].g), pal3bit(m_palram[offset].b)); -} - -WRITE8_MEMBER(pc8801_state::pc8801_layer_masking_w) -{ - /* - ---- x--- green gvram masked flag - ---- -x-- red gvram masked flag - ---- --x- blue gvram masked flag - ---- ---x text vram masked - */ - - m_layer_mask = data; -} - -READ8_MEMBER(pc8801_state::pc8801_crtc_param_r) -{ - printf("CRTC param reading\n"); - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc88_crtc_param_w) -{ - if(m_crtc.param_count < 5) - { - m_crtc.param[m_crtc.cmd][m_crtc.param_count] = data; - if(m_crtc.cmd == 0) - pc8801_dynamic_res_change(); - - m_crtc.param_count++; - } -} - -READ8_MEMBER(pc8801_state::pc8801_crtc_status_r) -{ - /* - ---x ---- video enable - ---- x--- DMA is running - ---- -x-- special control character IRQ - ---- --x- indication end IRQ - ---- ---x light pen input - */ - - return m_crtc.status; -} - -#if 0 -static const char *const crtc_command[] = -{ - "Reset / Stop Display", // 0 - "Start Display", // 1 - "Set IRQ MASK", // 2 - "Read Light Pen", // 3 - "Load Cursor Position", // 4 - "Reset IRQ", // 5 - "Reset Counters", // 6 - "Read Status" // 7 -}; -#endif - -WRITE8_MEMBER(pc8801_state::pc88_crtc_cmd_w) -{ - m_crtc.cmd = (data & 0xe0) >> 5; - m_crtc.param_count = 0; - - switch(m_crtc.cmd) - { - case 0: // reset CRTC - m_crtc.status &= (~0x16); - break; - case 1: // start display - m_crtc.status |= 0x10; - m_crtc.status &= (~0x08); - m_crtc.inverse = data & 1; - - if(data & 1) /* Ink Pot uses it, but I want another test case before removing this log */ - printf("CRTC inverse mode ON\n"); - break; - case 2: // set irq mask - m_crtc.irq_mask = data & 3; - break; - case 3: // read light pen - m_crtc.status &= (~0x01); - break; - case 4: // load cursor position ON/OFF - m_crtc.cursor_on = data & 1; - break; - case 5: // reset IRQ - case 6: // reset counters - m_crtc.status &= (~0x06); - break; - } - - //if((data >> 5) != 4) - // printf("CRTC cmd %s polled %02x\n",crtc_command[data >> 5],data & 0x1f); -} - -READ8_MEMBER(pc8801_state::pc8801_dmac_r) -{ - printf("DMAC R %08x\n",offset); - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_dmac_w) -{ - if(offset & 1) - m_dma_counter[offset >> 1] = (m_dmac_ff) ? (m_dma_counter[offset >> 1]&0xff)|(data<<8) : (m_dma_counter[offset >> 1]&0xff00)|(data&0xff); - else - m_dma_address[offset >> 1] = (m_dmac_ff) ? (m_dma_address[offset >> 1]&0xff)|(data<<8) : (m_dma_address[offset >> 1]&0xff00)|(data&0xff); - - m_dmac_ff ^= 1; -} - -READ8_MEMBER(pc8801_state::pc8801_dmac_status_r) -{ - printf("DMAC R STATUS\n"); - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_dmac_mode_w) -{ - m_dmac_mode = data; - m_dmac_ff = 0; - - if(data != 0xe4 && data != 0xa0 && data != 0xc4 && data != 0x80 && data != 0x00) - printf("%02x DMAC mode\n",data); -} - -READ8_MEMBER(pc8801_state::pc8801_extram_mode_r) -{ - return (m_extram_mode ^ 0x11) | 0xee; -} - -WRITE8_MEMBER(pc8801_state::pc8801_extram_mode_w) -{ - /* - ---x ---- Write EXT RAM access at 0x0000 - 0x7fff - ---- ---x Read EXT RAM access at 0x0000 - 0x7fff - */ - - m_extram_mode = data & 0x11; -} - -READ8_MEMBER(pc8801_state::pc8801_extram_bank_r) -{ - return m_extram_bank; -} - -WRITE8_MEMBER(pc8801_state::pc8801_extram_bank_w) -{ - m_extram_bank = data; -} - -WRITE8_MEMBER(pc8801_state::pc8801_alu_ctrl1_w) -{ - m_alu_ctrl1 = data; -} - -WRITE8_MEMBER(pc8801_state::pc8801_alu_ctrl2_w) -{ - m_alu_ctrl2 = data; -} - -WRITE8_MEMBER(pc8801_state::pc8801_pcg8100_w) -{ - if(data) - printf("Write to PCG-8100 %02x %02x\n",offset,data); -} - -WRITE8_MEMBER(pc8801_state::pc8801_txt_cmt_ctrl_w) -{ - /* bits 2 to 5 are cmt related */ - - m_txt_width = data & 1; - m_txt_color = data & 2; - - m_cassette->change_state(BIT(data,3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - - -READ8_MEMBER(pc8801_state::pc8801_kanji_r) -{ - if((offset & 2) == 0) - return m_kanji_rom[m_knj_addr[0]*2+((offset & 1) ^ 1)]; - - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_kanji_w) -{ - if((offset & 2) == 0) - m_knj_addr[0] = ((offset & 1) == 0) ? ((m_knj_addr[0]&0xff00)|(data&0xff)) : ((m_knj_addr[0]&0x00ff)|(data<<8)); -} - -READ8_MEMBER(pc8801_state::pc8801_kanji_lv2_r) -{ - if((offset & 2) == 0) - return m_kanji_rom[m_knj_addr[1]*2+((offset & 1) ^ 1)]; - - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_kanji_lv2_w) -{ - if((offset & 2) == 0) - m_knj_addr[1] = ((offset & 1) == 0) ? ((m_knj_addr[1]&0xff00)|(data&0xff)) : ((m_knj_addr[1]&0x00ff)|(data<<8)); -} - -WRITE8_MEMBER(pc8801_state::pc8801_dic_bank_w) -{ - printf("JISHO BANK = %02x\n",data); - if(m_has_dictionary) - m_dic_bank = data & 0x1f; -} - -WRITE8_MEMBER(pc8801_state::pc8801_dic_ctrl_w) -{ - printf("JISHO CTRL = %02x\n",data); - if(m_has_dictionary) - m_dic_ctrl = (data ^ 1) & 1; -} - -READ8_MEMBER(pc8801_state::pc8801_cdrom_r) -{ - //printf("CD-ROM read [%02x]\n",offset); - - //if(m_has_cdrom) - // return m_cdrom_reg[offset]; - - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_cdrom_w) -{ - /* - [9] ---x ---- CD-ROM BIOS bank - ---- ---x CD-ROM E-ROM bank (?) - */ - //printf("CD-ROM write %02x -> [%02x]\n",data,offset); - - if(m_has_cdrom) - m_cdrom_reg[offset] = data; -} - -READ8_MEMBER(pc8801_state::pc8801_cpuclock_r) -{ - if(m_has_clock_speed) - return 0x10 | m_clock_setting; - - return 0xff; -} - -READ8_MEMBER(pc8801_state::pc8801_baudrate_r) -{ - if(m_has_clock_speed) - return 0xf0 | m_baudrate_val; - - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_baudrate_w) -{ - if(m_has_clock_speed) - m_baudrate_val = data & 0xf; -} - -WRITE8_MEMBER(pc8801_state::pc8801_rtc_w) -{ - m_rtc->c0_w((data & 1) >> 0); - m_rtc->c1_w((data & 2) >> 1); - m_rtc->c2_w((data & 4) >> 2); - m_rtc->data_in_w((data & 8) >> 3); - - /* TODO: remaining bits */ -} - -READ8_MEMBER(pc8801_state::pc8801_sound_board_r) -{ - if(m_has_opna) - return m_opna->read(space, offset); - - return (offset & 2) ? 0xff : m_opn->read(space, offset); -} - -WRITE8_MEMBER(pc8801_state::pc8801_sound_board_w) -{ - if(m_has_opna) - m_opna->write(space, offset,data); - else if((offset & 2) == 0) - m_opn->write(space, offset, data); -} - -READ8_MEMBER(pc8801_state::pc8801_opna_r) -{ - if(m_has_opna && (offset & 2) == 0) - return m_opna->read(space, (offset & 1) | ((offset & 4) >> 1)); - - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_opna_w) -{ - if(m_has_opna && (offset & 2) == 0) - m_opna->write(space, (offset & 1) | ((offset & 4) >> 1),data); - else if(m_has_opna && offset == 2) - { - m_sound_irq_mask = ((data & 0x80) == 0); - - if(m_sound_irq_mask == 0) - m_sound_irq_latch = 0; - - if(m_timer_irq_latch == 0 && m_vrtc_irq_latch == 0 && m_sound_irq_latch == 0) - m_maincpu->set_input_line(0,CLEAR_LINE); - - if(m_sound_irq_mask && m_sound_irq_pending) - { - m_maincpu->set_input_line(0,HOLD_LINE); - m_sound_irq_latch = 1; - m_sound_irq_pending = 0; - } - } -} - -READ8_MEMBER(pc8801_state::pc8801_unk_r) -{ - printf("Read port 0x33\n"); - return 0xff; -} - -WRITE8_MEMBER(pc8801_state::pc8801_unk_w) -{ - printf("Write port 0x33\n"); -} - -static ADDRESS_MAP_START( pc8801_io, AS_IO, 8, pc8801_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_READ_PORT("KEY0") - AM_RANGE(0x01, 0x01) AM_READ_PORT("KEY1") - AM_RANGE(0x02, 0x02) AM_READ_PORT("KEY2") - AM_RANGE(0x03, 0x03) AM_READ_PORT("KEY3") - AM_RANGE(0x04, 0x04) AM_READ_PORT("KEY4") - AM_RANGE(0x05, 0x05) AM_READ_PORT("KEY5") - AM_RANGE(0x06, 0x06) AM_READ_PORT("KEY6") - AM_RANGE(0x07, 0x07) AM_READ_PORT("KEY7") - AM_RANGE(0x08, 0x08) AM_READ_PORT("KEY8") - AM_RANGE(0x09, 0x09) AM_READ_PORT("KEY9") - AM_RANGE(0x0a, 0x0a) AM_READ_PORT("KEY10") - AM_RANGE(0x0b, 0x0b) AM_READ_PORT("KEY11") - AM_RANGE(0x0c, 0x0c) AM_READ_PORT("KEY12") - AM_RANGE(0x0d, 0x0d) AM_READ_PORT("KEY13") - AM_RANGE(0x0e, 0x0e) AM_READ_PORT("KEY14") - AM_RANGE(0x0f, 0x0f) AM_READ_PORT("KEY15") - AM_RANGE(0x00, 0x02) AM_WRITE(pc8801_pcg8100_w) - AM_RANGE(0x10, 0x10) AM_WRITE(pc8801_rtc_w) - AM_RANGE(0x20, 0x20) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) /* RS-232C and CMT */ - AM_RANGE(0x21, 0x21) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x30, 0x30) AM_READ_PORT("DSW1") AM_WRITE(pc8801_txt_cmt_ctrl_w) - AM_RANGE(0x31, 0x31) AM_READ_PORT("DSW2") AM_WRITE(pc8801_gfx_ctrl_w) - AM_RANGE(0x32, 0x32) AM_READWRITE(pc8801_misc_ctrl_r, pc8801_misc_ctrl_w) - AM_RANGE(0x33, 0x33) AM_READWRITE(pc8801_unk_r,pc8801_unk_w) - AM_RANGE(0x34, 0x34) AM_WRITE(pc8801_alu_ctrl1_w) - AM_RANGE(0x35, 0x35) AM_WRITE(pc8801_alu_ctrl2_w) - AM_RANGE(0x40, 0x40) AM_READWRITE(pc8801_ctrl_r, pc8801_ctrl_w) - AM_RANGE(0x44, 0x47) AM_READWRITE(pc8801_sound_board_r,pc8801_sound_board_w) /* OPN / OPNA ports */ - AM_RANGE(0x50, 0x50) AM_READWRITE(pc8801_crtc_param_r, pc88_crtc_param_w) - AM_RANGE(0x51, 0x51) AM_READWRITE(pc8801_crtc_status_r, pc88_crtc_cmd_w) - AM_RANGE(0x52, 0x52) AM_WRITE(pc8801_bgpal_w) - AM_RANGE(0x53, 0x53) AM_WRITE(pc8801_layer_masking_w) - AM_RANGE(0x54, 0x5b) AM_WRITE(pc8801_palram_w) - AM_RANGE(0x5c, 0x5c) AM_READ(pc8801_vram_select_r) - AM_RANGE(0x5c, 0x5f) AM_WRITE(pc8801_vram_select_w) - AM_RANGE(0x60, 0x67) AM_READWRITE(pc8801_dmac_r,pc8801_dmac_w) - AM_RANGE(0x68, 0x68) AM_READWRITE(pc8801_dmac_status_r,pc8801_dmac_mode_w) - AM_RANGE(0x6e, 0x6e) AM_READ(pc8801_cpuclock_r) - AM_RANGE(0x6f, 0x6f) AM_READWRITE(pc8801_baudrate_r,pc8801_baudrate_w) - AM_RANGE(0x70, 0x70) AM_READWRITE(pc8801_window_bank_r, pc8801_window_bank_w) - AM_RANGE(0x71, 0x71) AM_READWRITE(pc8801_ext_rom_bank_r, pc8801_ext_rom_bank_w) - AM_RANGE(0x78, 0x78) AM_WRITE(pc8801_window_bank_inc_w) - AM_RANGE(0x90, 0x9f) AM_READWRITE(pc8801_cdrom_r,pc8801_cdrom_w) -// AM_RANGE(0xa0, 0xa3) AM_NOP /* music & network */ - AM_RANGE(0xa8, 0xad) AM_READWRITE(pc8801_opna_r,pc8801_opna_w) /* second sound board */ -// AM_RANGE(0xb4, 0xb5) AM_NOP /* Video art board */ -// AM_RANGE(0xc1, 0xc1) AM_NOP /* (unknown) */ -// AM_RANGE(0xc2, 0xcf) AM_NOP /* music */ -// AM_RANGE(0xd0, 0xd7) AM_NOP /* music & GP-IB */ -// AM_RANGE(0xd8, 0xd8) AM_NOP /* GP-IB */ -// AM_RANGE(0xdc, 0xdf) AM_NOP /* MODEM */ - AM_RANGE(0xe2, 0xe2) AM_READWRITE(pc8801_extram_mode_r,pc8801_extram_mode_w) /* expand RAM mode */ - AM_RANGE(0xe3, 0xe3) AM_READWRITE(pc8801_extram_bank_r,pc8801_extram_bank_w) /* expand RAM bank */ -#ifdef USE_PROPER_I8214 - AM_RANGE(0xe4, 0xe4) AM_WRITE(i8214_irq_level_w) - AM_RANGE(0xe6, 0xe6) AM_WRITE(i8214_irq_mask_w) -#else - AM_RANGE(0xe4, 0xe4) AM_WRITE(pc8801_irq_level_w) - AM_RANGE(0xe6, 0xe6) AM_WRITE(pc8801_irq_mask_w) -#endif -// AM_RANGE(0xe7, 0xe7) AM_NOP /* Arcus writes here, almost likely to be a mirror of above */ - AM_RANGE(0xe8, 0xeb) AM_READWRITE(pc8801_kanji_r, pc8801_kanji_w) - AM_RANGE(0xec, 0xef) AM_READWRITE(pc8801_kanji_lv2_r, pc8801_kanji_lv2_w) - AM_RANGE(0xf0, 0xf0) AM_WRITE(pc8801_dic_bank_w) - AM_RANGE(0xf1, 0xf1) AM_WRITE(pc8801_dic_ctrl_w) -// AM_RANGE(0xf3, 0xf3) AM_NOP /* DMA floppy (unknown) */ -// AM_RANGE(0xf4, 0xf7) AM_NOP /* DMA 5'floppy (may be not released) */ -// AM_RANGE(0xf8, 0xfb) AM_NOP /* DMA 8'floppy (unknown) */ - AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("d8255_master", i8255_device, read, write) -ADDRESS_MAP_END - -READ8_MEMBER(pc8801_state::cpu_8255_c_r) -{ -// machine().scheduler().synchronize(); // force resync - - return m_i8255_1_pc >> 4; -} - -WRITE8_MEMBER(pc8801_state::cpu_8255_c_w) -{ -// machine().scheduler().synchronize(); // force resync - - m_i8255_0_pc = data; -} - - -READ8_MEMBER(pc8801_state::fdc_8255_c_r) -{ -// machine().scheduler().synchronize(); // force resync - - return m_i8255_0_pc >> 4; -} - -WRITE8_MEMBER(pc8801_state::fdc_8255_c_w) -{ -// machine().scheduler().synchronize(); // force resync - - m_i8255_1_pc = data; -} - -static ADDRESS_MAP_START( pc8801fdc_mem, AS_PROGRAM, 8, pc8801_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_RAM -ADDRESS_MAP_END - -TIMER_CALLBACK_MEMBER(pc8801_state::pc8801fd_upd765_tc_to_zero) -{ - //printf("0\n"); - machine().device("upd765")->tc_w(false); -} - -WRITE8_MEMBER(pc8801_state::upd765_mc_w) -{ - machine().device("upd765:0")->get_device()->mon_w(!(data & 1)); - machine().device("upd765:1")->get_device()->mon_w(!(data & 2)); -} - -READ8_MEMBER(pc8801_state::upd765_tc_r) -{ - //printf("%04x 1\n",m_fdccpu->pc()); - - machine().device("upd765")->tc_w(true); - //TODO: I'm not convinced that this works correctly with current hook-up ... 1000 usec is needed by Aploon, a bigger value breaks Alpha. - //OTOH, 50 seems more than enough for the new upd... - machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(pc8801_state::pc8801fd_upd765_tc_to_zero),this)); - return 0xff; // value is meaningless -} - -WRITE8_MEMBER(pc8801_state::fdc_irq_vector_w) -{ - popmessage("Write to FDC IRQ vector I/O %02x, contact MESSdev\n",data); - m_fdc_irq_opcode = data; -} - -WRITE8_MEMBER(pc8801_state::fdc_drive_mode_w) -{ - logerror("FDC drive mode %02x\n", data); - machine().device("upd765:0")->get_device()->set_rpm(data & 0x01 ? 360 : 300); - machine().device("upd765:1")->get_device()->set_rpm(data & 0x02 ? 360 : 300); - - machine().device("upd765")->set_rate(data & 0x20 ? 500000 : 250000); -} - -static ADDRESS_MAP_START( pc8801fdc_io, AS_IO, 8, pc8801_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf0, 0xf0) AM_WRITE(fdc_irq_vector_w) // Interrupt Opcode Port - AM_RANGE(0xf4, 0xf4) AM_WRITE(fdc_drive_mode_w) // Drive mode, 2d, 2dd, 2hd - AM_RANGE(0xf7, 0xf7) AM_WRITENOP // printer port output - AM_RANGE(0xf8, 0xf8) AM_READWRITE(upd765_tc_r,upd765_mc_w) // (R) Terminal Count Port (W) Motor Control Port - AM_RANGE(0xfa, 0xfb) AM_DEVICE("upd765", upd765a_device, map ) - AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("d8255_slave", i8255_device, read, write) -ADDRESS_MAP_END - -/* Input Ports */ - -/* 2008-05 FP: -Small note about the strange default mapping of function keys: -the top line of keys in PC8801 keyboard is as follows -[STOP][COPY] [F1][F2][F3][F4][F5] [ROLL UP][ROLL DOWN] -Therefore, in Full Emulation mode, "F1" goes to 'F3' and so on - -Also, the Keypad has 16 keys, making impossible to map it in a satisfactory -way to a PC keypad. Therefore, default settings for these keys in Full -Emulation are currently based on the effect of the key rather than on -their real position - -About natural keyboards: currently, -- "Keypad =" and "Keypad ," are not mapped -- "Stop" is mapped to 'Pause' -- "Copy" is mapped to 'Print Screen' -- "Kana" is mapped to 'F6' -- "Grph" is mapped to 'F7' -- "Roll Up" and "Roll Down" are mapped to 'Page Up' and 'Page Down' -- "Help" is mapped to 'F8' - */ - -static INPUT_PORTS_START( pc8001 ) - PORT_START("KEY0") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - - PORT_START("KEY1") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_PGUP) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_PGDN) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - - PORT_START("KEY2") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("KEY3") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("KEY4") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START("KEY5") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA5') PORT_CHAR('|') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - - PORT_START("KEY6") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("KEY7") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(" _") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0) PORT_CHAR('_') - - PORT_START("KEY8") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Kana") PORT_CODE(KEYCODE_LCONTROL) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("KEY9") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("KEY10") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - - PORT_START("KEY11") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY12") /* port 0x0c */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY13") /* port 0x0d */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY14") /* port 0x0e */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY15") /* port 0x0f */ - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x00, "BASIC" ) - PORT_DIPSETTING( 0x01, "N88-BASIC" ) - PORT_DIPSETTING( 0x00, "N-BASIC" ) - PORT_DIPNAME( 0x02, 0x02, "Terminal mode" ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "Text width" ) - PORT_DIPSETTING( 0x04, "40 chars/line" ) - PORT_DIPSETTING( 0x00, "80 chars/line" ) - PORT_DIPNAME( 0x08, 0x00, "Text height" ) - PORT_DIPSETTING( 0x08, "20 lines/screen" ) - PORT_DIPSETTING( 0x00, "25 lines/screen" ) - PORT_DIPNAME( 0x10, 0x10, "Enable S parameter" ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, "Enable DEL code" ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Memory wait" ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Disable CMD SING" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, "Parity generate" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, "Parity type" ) - PORT_DIPSETTING( 0x00, "Even" ) - PORT_DIPSETTING( 0x02, "Odd" ) - PORT_DIPNAME( 0x04, 0x00, "Serial character length" ) - PORT_DIPSETTING( 0x04, "7 bits/char" ) - PORT_DIPSETTING( 0x00, "8 bits/char" ) - PORT_DIPNAME( 0x08, 0x08, "Stop bit length" ) - PORT_DIPSETTING( 0x08, "1" ) - PORT_DIPSETTING( 0x00, "2" ) - PORT_DIPNAME( 0x10, 0x10, "Enable X parameter" ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Duplex" ) - PORT_DIPSETTING( 0x20, "Half" ) - PORT_DIPSETTING( 0x00, "Full" ) - PORT_DIPNAME( 0xc0, 0x40, "Basic mode" ) - PORT_DIPSETTING( 0x80, "N88-BASIC (V1L)" ) - PORT_DIPSETTING( 0xc0, "N88-BASIC (V1H)" ) - PORT_DIPSETTING( 0x40, "N88-BASIC (V2)" ) -// PORT_DIPSETTING( 0x00, "N88-BASIC (V2)" ) - - PORT_START("CTRL") - PORT_DIPNAME( 0x02, 0x02, "Monitor Type" ) - PORT_DIPSETTING( 0x02, "15 KHz" ) - PORT_DIPSETTING( 0x00, "24 KHz" ) - PORT_DIPNAME( 0x08, 0x00, "Auto-boot floppy at start-up" ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_device, data_out_r) - PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_CUSTOM ) PORT_VBLANK("screen") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("CFG") /* EXSWITCH */ - #if 0 // reference only, afaik there isn't a thing like this ... - PORT_DIPNAME( 0x0f, 0x08, "Serial speed" ) - PORT_DIPSETTING( 0x01, "75bps" ) - PORT_DIPSETTING( 0x02, "150bps" ) - PORT_DIPSETTING( 0x03, "300bps" ) - PORT_DIPSETTING( 0x04, "600bps" ) - PORT_DIPSETTING( 0x05, "1200bps" ) - PORT_DIPSETTING( 0x06, "2400bps" ) - PORT_DIPSETTING( 0x07, "4800bps" ) - PORT_DIPSETTING( 0x08, "9600bps" ) - PORT_DIPSETTING( 0x09, "19200bps" ) - #endif - PORT_DIPNAME( 0x40, 0x40, "Speed mode" ) - PORT_DIPSETTING( 0x00, "Slow" ) - PORT_DIPSETTING( 0x40, DEF_STR( High ) ) - PORT_DIPNAME( 0x80, 0x80, "Main CPU clock" ) - PORT_DIPSETTING( 0x80, "4MHz" ) - PORT_DIPSETTING( 0x00, "8MHz" ) - - PORT_START("OPN_PA") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPN_PB") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Mouse Button 1") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Mouse Button 2") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02) - PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("MOUSEX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_RESET PORT_REVERSE PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02) - - PORT_START("MOUSEY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_RESET PORT_REVERSE PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02) - - PORT_START("MEM") - PORT_CONFNAME( 0x0f, 0x0a, "Extension memory" ) - PORT_CONFSETTING( 0x00, DEF_STR( None ) ) - PORT_CONFSETTING( 0x01, "32KB (PC-8012-02 x 1)" ) - PORT_CONFSETTING( 0x02, "64KB (PC-8012-02 x 2)" ) - PORT_CONFSETTING( 0x03, "128KB (PC-8012-02 x 4)" ) - PORT_CONFSETTING( 0x04, "128KB (PC-8801-02N x 1)" ) - PORT_CONFSETTING( 0x05, "256KB (PC-8801-02N x 2)" ) - PORT_CONFSETTING( 0x06, "512KB (PC-8801-02N x 4)" ) - PORT_CONFSETTING( 0x07, "1M (PIO-8234H-1M x 1)" ) - PORT_CONFSETTING( 0x08, "2M (PIO-8234H-2M x 1)" ) - PORT_CONFSETTING( 0x09, "4M (PIO-8234H-2M x 2)" ) - PORT_CONFSETTING( 0x0a, "8M (PIO-8234H-2M x 4)" ) - PORT_CONFSETTING( 0x0b, "1.1M (PIO-8234H-1M x 1 + PC-8801-02N x 1)" ) - PORT_CONFSETTING( 0x0c, "2.1M (PIO-8234H-2M x 1 + PC-8801-02N x 1)" ) - PORT_CONFSETTING( 0x0d, "4.1M (PIO-8234H-2M x 2 + PC-8801-02N x 1)" ) - - PORT_START("BOARD_CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Sound Board" ) /* TODO: is it possible to have BOTH sound chips in there? */ - PORT_CONFSETTING( 0x00, "OPN (YM2203)" ) - PORT_CONFSETTING( 0x01, "OPNA (YM2608)" ) - PORT_CONFNAME( 0x02, 0x00, "Port 1 Connection" ) - PORT_CONFSETTING( 0x00, "Joystick" ) - PORT_CONFSETTING( 0x02, "Mouse" ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc88sr ) - PORT_INCLUDE( pc8001 ) - - PORT_MODIFY("DSW1") - PORT_DIPNAME( 0x01, 0x01, "BASIC" ) - PORT_DIPSETTING( 0x01, "N88-BASIC" ) - PORT_DIPSETTING( 0x00, "N-BASIC" ) -INPUT_PORTS_END - -/* Graphics Layouts */ - -static const gfx_layout char_layout = -{ - 8, 8, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP8(0,1) }, - { STEP8(0,8) }, - 8*8 -}; - -static const gfx_layout kanji_layout = -{ - 16, 16, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP16(0,1) }, - { STEP16(0,16) }, - 16*16 -}; - -/* debugging only */ -static GFXDECODE_START( pc8801 ) - GFXDECODE_ENTRY( "cgrom", 0, char_layout, 0, 8 ) - GFXDECODE_ENTRY( "kanji", 0, kanji_layout, 0, 8 ) -GFXDECODE_END - -/* Floppy Configuration */ - -static SLOT_INTERFACE_START( pc88_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -#if 0 -/* Cassette Configuration */ - -static const cassette_interface pc88_cassette_interface = -{ - cassette_default_formats, // we need T88 format support! - NULL, - (cassette_state)(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED), - "pc8801_cass" -}; -#endif - -#ifdef USE_PROPER_I8214 -void pc8801_state::pc8801_raise_irq(UINT8 irq,UINT8 state) -{ - if(state) - { - drvm_int_state |= irq; - - drvm_pic->r_w(~irq); - - m_maincpu->set_input_line(0,ASSERT_LINE); - } - else - { - //drvm_int_state &= ~irq; - - //m_maincpu->set_input_line(0,CLEAR_LINE); - } -} - -WRITE_LINE_MEMBER(pc8801_state::pic_int_w) -{ - device_t *device = m_maincpu; -// if (state == ASSERT_LINE) -// { -// } -} - -WRITE_LINE_MEMBER(pc8801_state::pic_enlg_w) -{ - device_t *device = m_maincpu; - //if (state == CLEAR_LINE) - //{ - //} -} - -static I8214_INTERFACE( pic_intf ) -{ - DEVCB_DRIVER_LINE_MEMBER(pc8801_state,pic_int_w), - DEVCB_DRIVER_LINE_MEMBER(pc8801_state,pic_enlg_w) -}; - -IRQ_CALLBACK_MEMBER(pc8801_state::pc8801_irq_callback) -{ - UINT8 vector = (7 - m_pic->a_r()); - - m_int_state &= ~(1<set_input_line(0,CLEAR_LINE); - - return vector << 1; -} - -WRITE_LINE_MEMBER(pc8801_state::pc8801_sound_irq) -{ - if(m_sound_irq_mask && state) - pc8801_raise_irq(machine(),1<<(4),1); -} - -/* -TIMER_DEVICE_CALLBACK_MEMBER(pc8801_state::pc8801_rtc_irq) -{ - if(m_timer_irq_mask) - pc8801_raise_irq(machine(),1<<(2),1); -} -*/ - -INTERRUPT_GEN_MEMBER(pc8801_state::pc8801_vrtc_irq) -{ - if(m_vblank_irq_mask) - pc8801_raise_irq(machine(),1<<(1),1); -} - -#else - -#include "debugger.h" - -IRQ_CALLBACK_MEMBER(pc8801_state::pc8801_irq_callback) -{ - if(m_sound_irq_latch) - { - m_sound_irq_latch = 0; - return 4*2; - } - else if(m_vrtc_irq_latch) - { - m_vrtc_irq_latch = 0; - return 1*2; - } - else if(m_timer_irq_latch) - { - m_timer_irq_latch = 0; - return 2*2; - } - - printf("IRQ triggered but no vector on the bus! %02x %02x %02x %02x\n",m_i8214_irq_level,m_sound_irq_latch,m_vrtc_irq_latch,m_timer_irq_latch); - debugger_break(machine()); - - return 4*2; //TODO: mustn't happen -} - -WRITE_LINE_MEMBER(pc8801_state::pc8801_sound_irq) -{ -// printf("%02x %02x %02x\n",m_sound_irq_mask,m_i8214_irq_level,state); - /* TODO: correct i8214 irq level? */ - if(state) - { - if(m_sound_irq_mask) - { - m_sound_irq_latch = 1; - m_sound_irq_pending = 0; - //IRQ_LOG(("sound\n")); - m_maincpu->set_input_line(0,HOLD_LINE); - } - else - m_sound_irq_pending = 1; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(pc8801_state::pc8801_rtc_irq) -{ - if(m_timer_irq_mask && m_i8214_irq_level >= 3) - { - m_timer_irq_latch = 1; - //IRQ_LOG(("timer\n")); - m_maincpu->set_input_line(0,HOLD_LINE); - } -} - -INTERRUPT_GEN_MEMBER(pc8801_state::pc8801_vrtc_irq) -{ - if(m_vrtc_irq_mask && m_i8214_irq_level >= 2) - { - m_vrtc_irq_latch = 1; - //IRQ_LOG(("vrtc\n")); - m_maincpu->set_input_line(0,HOLD_LINE); - } -} -#endif - -void pc8801_state::machine_start() -{ - machine().device("upd765:0")->get_device()->set_rpm(300); - machine().device("upd765:1")->get_device()->set_rpm(300); - machine().device("upd765")->set_rate(250000); - - m_rtc->cs_w(1); - m_rtc->oe_w(1); - - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_hi_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x1000); - m_ext_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x8000*0x100); - m_gvram = auto_alloc_array_clear(machine(), UINT8, 0xc000); - m_n80rom = memregion("n80rom")->base(); - m_n88rom = memregion("n88rom")->base(); - m_kanji_rom = memregion("kanji")->base(); - m_cg_rom = memregion("cgrom")->base(); - - save_pointer(NAME(m_work_ram), 0x10000); - save_pointer(NAME(m_hi_work_ram), 0x1000); - save_pointer(NAME(m_ext_work_ram), 0x8000*0x100); - save_pointer(NAME(m_gvram), 0xc000); -} - -void pc8801_state::machine_reset() -{ - #define kB 1024 - #define MB 1024*1024 - const UINT32 extram_type[] = { 0*kB, 32*kB,64*kB,128*kB,128*kB,256*kB,512*kB,1*MB,2*MB,4*MB,8*MB,1*MB+128*kB,2*MB+128*kB,4*MB+128*kB, 0*kB, 0*kB }; - #undef kB - #undef MB - - m_ext_rom_bank = 0xff; - m_gfx_ctrl = 0x31; - m_window_offset_bank = 0x80; - m_misc_ctrl = 0x80; - m_layer_mask = 0x00; - m_vram_sel = 3; - -// pc8801_dynamic_res_change(machine()); - - m_fdc_irq_opcode = 0; //TODO: copied from PC-88VA, could be wrong here ... should be 0x7f ld a,a in the latter case - m_mouse.phase = 0; - - m_fdccpu->set_input_line_vector(0, 0); - - { - m_txt_color = 2; - } - - { - int i; - - for(i=0;i<3;i++) - m_alu_reg[i] = 0x00; - } - - { - m_crtc.param_count = 0; - m_crtc.cmd = 0; - m_crtc.status = 0; - } - - m_beeper->set_frequency(2400); - m_beeper->set_state(0); - - #ifdef USE_PROPER_I8214 - { - /* initialize I8214 */ - m_pic->etlg_w(1); - m_pic->inte_w(1); - } - #else - { - m_vrtc_irq_mask = 0; - m_vrtc_irq_latch = 0; - m_timer_irq_mask = 0; - m_timer_irq_latch = 0; - m_sound_irq_mask = 0; - m_sound_irq_latch = 0; - m_i8214_irq_level = 0; - m_sound_irq_pending = 0; - } - #endif - - { - m_dma_address[2] = 0xf300; - } - - { - m_extram_bank = 0; - m_extram_mode = 0; - } - - { - int i; - - for(i=0;i<0x10;i++) //text + bitmap - m_palette->set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); - } - - m_has_clock_speed = 0; - m_has_dictionary = 0; - m_has_cdrom = 0; - - m_extram_size = extram_type[ioport("MEM")->read() & 0x0f]; - m_has_opna = ioport("BOARD_CONFIG")->read() & 1; -} - -MACHINE_RESET_MEMBER(pc8801_state,pc8801_clock_speed) -{ - pc8801_state::machine_reset(); - m_has_clock_speed = 1; - m_clock_setting = ioport("CFG")->read() & 0x80; - - m_maincpu->set_unscaled_clock(m_clock_setting ? XTAL_4MHz : XTAL_8MHz); - m_fdccpu->set_unscaled_clock(m_clock_setting ? XTAL_4MHz : XTAL_8MHz); // correct? - m_baudrate_val = 0; -} - -MACHINE_RESET_MEMBER(pc8801_state,pc8801_dic) -{ - MACHINE_RESET_CALL_MEMBER( pc8801_clock_speed ); - m_has_dictionary = 1; - m_dic_bank = 0; - m_dic_ctrl = 0; -} - -MACHINE_RESET_MEMBER(pc8801_state,pc8801_cdrom) -{ - MACHINE_RESET_CALL_MEMBER( pc8801_dic ); - m_has_cdrom = 1; - - { - int i; - - for(i=0;i<0x10;i++) - m_cdrom_reg[i] = 0; - } -} - -PALETTE_INIT_MEMBER(pc8801_state, pc8801) -{ - int i; - - for(i=0;i<0x10;i++) //text + bitmap - palette.set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); -} - -/* YM2203 Interface */ - -READ8_MEMBER(pc8801_state::opn_porta_r) -{ - if(ioport("BOARD_CONFIG")->read() & 2) - { - UINT8 shift,res; - - shift = (m_mouse.phase & 1) ? 0 : 4; - res = (m_mouse.phase & 2) ? m_mouse.y : m_mouse.x; - -// printf("%d\n",m_mouse.phase); - - return ((res >> shift) & 0x0f) | 0xf0; - } - - return ioport("OPN_PA")->read(); -} -READ8_MEMBER(pc8801_state::opn_portb_r){ return ioport("OPN_PB")->read(); } - -/* Cassette Configuration */ -WRITE_LINE_MEMBER( pc8801_state::txdata_callback ) -{ - //m_cass->output( (state) ? 0.8 : -0.8); -} - -WRITE_LINE_MEMBER( pc8801_state::rxrdy_w ) -{ - // ... -} - -static MACHINE_CONFIG_START( pc8801, pc8801_state ) - /* main CPU */ - MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK) /* 4 MHz */ - MCFG_CPU_PROGRAM_MAP(pc8801_mem) - MCFG_CPU_IO_MAP(pc8801_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc8801_state, pc8801_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pc8801_state,pc8801_irq_callback) - - /* sub CPU(5 inch floppy drive) */ - MCFG_CPU_ADD("fdccpu", Z80, MASTER_CLOCK) /* 4 MHz */ - MCFG_CPU_PROGRAM_MAP(pc8801fdc_mem) - MCFG_CPU_IO_MAP(pc8801fdc_io) - - //MCFG_QUANTUM_TIME(attotime::from_hz(300000)) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - MCFG_DEVICE_ADD("d8255_master", I8255, 0) - MCFG_I8255_IN_PORTA_CB(DEVREAD8("d8255_slave", i8255_device, pb_r)) - MCFG_I8255_IN_PORTB_CB(DEVREAD8("d8255_slave", i8255_device, pa_r)) - MCFG_I8255_IN_PORTC_CB(READ8(pc8801_state, cpu_8255_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc8801_state, cpu_8255_c_w)) - - MCFG_DEVICE_ADD("d8255_slave", I8255, 0) - MCFG_I8255_IN_PORTA_CB(DEVREAD8("d8255_master", i8255_device, pb_r)) - MCFG_I8255_IN_PORTB_CB(DEVREAD8("d8255_master", i8255_device, pa_r)) - MCFG_I8255_IN_PORTC_CB(READ8(pc8801_state, fdc_8255_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc8801_state, fdc_8255_c_w)) - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE("fdccpu", INPUT_LINE_IRQ0)) - - #ifdef USE_PROPER_I8214 - MCFG_I8214_ADD(I8214_TAG, MASTER_CLOCK, pic_intf) - #endif - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) - //MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_SOFTWARE_LIST_ADD("tape_list","pc8801_cass") - - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(pc8801_state, txdata_callback)) - MCFG_I8251_RTS_HANDLER(WRITELINE(pc8801_state, rxrdy_w)) - - MCFG_FLOPPY_DRIVE_ADD("upd765:0", pc88_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", pc88_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("disk_list","pc8801_flop") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK_24KHz,848,0,640,448,0,400) - MCFG_SCREEN_UPDATE_DRIVER(pc8801_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc8801 ) - MCFG_PALETTE_ADD("palette", 0x10) - MCFG_PALETTE_INIT_OWNER(pc8801_state, pc8801) - -// MCFG_VIDEO_START_OVERRIDE(pc8801_state,pc8801) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opn", YM2203, MASTER_CLOCK) - MCFG_YM2203_IRQ_HANDLER(WRITELINE(pc8801_state, pc8801_sound_irq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(pc8801_state, opn_porta_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(pc8801_state, opn_portb_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOUND_ADD("opna", YM2608, MASTER_CLOCK*2) - MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc8801_state, pc8801_sound_irq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(pc8801_state, opn_porta_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(pc8801_state, opn_portb_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("rtc_timer", pc8801_state, pc8801_rtc_irq, attotime::from_hz(600)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc8801fh, pc8801 ) - MCFG_MACHINE_RESET_OVERRIDE(pc8801_state, pc8801_clock_speed ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc8801ma, pc8801 ) - MCFG_MACHINE_RESET_OVERRIDE(pc8801_state, pc8801_dic ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc8801mc, pc8801 ) - MCFG_MACHINE_RESET_OVERRIDE(pc8801_state, pc8801_cdrom ) -MACHINE_CONFIG_END - - -/* TODO: clean this up */ -#define PC8801_MEM_LOAD \ - ROM_REGION( 0x100000, "opna", ROMREGION_ERASE00 ) - - -ROM_START( pc8801 ) - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.2 - ROM_LOAD( "n80.rom", 0x0000, 0x8000, CRC(5cb8b584) SHA1(063609dd518c124a4fc9ba35d1bae35771666a34) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 1.0 - ROM_LOAD( "n88.rom", 0x0000, 0x8000, CRC(ffd68be0) SHA1(3518193b8207bdebf22c1380c2db8c554baff329) ) - ROM_LOAD( "n88_0.rom", 0x8000, 0x2000, CRC(61984bab) SHA1(d1ae642aed4f0584eeb81ff50180db694e5101d4) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "disk.rom", 0x0000, 0x0800, CRC(2158d307) SHA1(bb7103a0818850a039c67ff666a31ce49a8d516f) ) - - ROM_REGION( 0x40000, "kanji", ROMREGION_ERASEFF) - ROM_LOAD_OPTIONAL( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) ) -ROM_END - -/* The dump only included "maincpu". Other roms arbitrariely taken from PC-8801 & PC-8801 MkIISR (there should be -at least 1 Kanji ROM). */ -ROM_START( pc8801mk2 ) - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.4 - ROM_LOAD( "m2_n80.rom", 0x0000, 0x8000, CRC(91d84b1a) SHA1(d8a1abb0df75936b3fc9d226ccdb664a9070ffb1) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) //1.3 - ROM_LOAD( "m2_n88.rom", 0x0000, 0x8000, CRC(f35169eb) SHA1(ef1f067f819781d9fb2713836d195866f0f81501) ) - ROM_LOAD( "m2_n88_0.rom", 0x8000, 0x2000, CRC(5eb7a8d0) SHA1(95a70af83b0637a5a0f05e31fb0452bb2cb68055) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "disk.rom", 0x0000, 0x0800, CRC(2158d307) SHA1(bb7103a0818850a039c67ff666a31ce49a8d516f) ) - - ROM_REGION( 0x40000, "kanji", ROMREGION_ERASEFF) - ROM_LOAD_OPTIONAL( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x800 ) -ROM_END - -ROM_START( pc8801mk2sr ) - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.5 - ROM_LOAD( "mk2sr_n80.rom", 0x0000, 0x8000, CRC(27e1857d) SHA1(5b922ed9de07d2a729bdf1da7b57c50ddf08809a) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.0 - ROM_LOAD( "mk2sr_n88.rom", 0x0000, 0x8000, CRC(a0fc0473) SHA1(3b31fc68fa7f47b21c1a1cb027b86b9e87afbfff) ) - ROM_LOAD( "mk2sr_n88_0.rom", 0x8000, 0x2000, CRC(710a63ec) SHA1(d239c26ad7ac5efac6e947b0e9549b1534aa970d) ) - ROM_LOAD( "n88_1.rom", 0xa000, 0x2000, CRC(c0bd2aa6) SHA1(8528eef7946edf6501a6ccb1f416b60c64efac7c) ) - ROM_LOAD( "n88_2.rom", 0xc000, 0x2000, CRC(af2b6efa) SHA1(b7c8bcea219b77d9cc3ee0efafe343cc307425d1) ) - ROM_LOAD( "n88_3.rom", 0xe000, 0x2000, CRC(7713c519) SHA1(efce0b51cab9f0da6cf68507757f1245a2867a72) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "disk.rom", 0x0000, 0x0800, CRC(2158d307) SHA1(bb7103a0818850a039c67ff666a31ce49a8d516f) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x40000, "kanji", 0) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - ROM_LOAD( "kanji2.rom", 0x20000, 0x20000, CRC(154803cc) SHA1(7e6591cd465cbb35d6d3446c5a83b46d30fafe95) ) // it should not be here - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x800 ) -ROM_END - -ROM_START( pc8801mk2fr ) - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.5 - ROM_LOAD( "m2fr_n80.rom", 0x0000, 0x8000, CRC(27e1857d) SHA1(5b922ed9de07d2a729bdf1da7b57c50ddf08809a) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.1 - ROM_LOAD( "m2fr_n88.rom", 0x0000, 0x8000, CRC(b9daf1aa) SHA1(696a480232bcf8c827c7aeea8329db5c44420d2a) ) - ROM_LOAD( "m2fr_n88_0.rom", 0x8000, 0x2000, CRC(710a63ec) SHA1(d239c26ad7ac5efac6e947b0e9549b1534aa970d) ) - ROM_LOAD( "m2fr_n88_1.rom", 0xa000, 0x2000, CRC(e3e78a37) SHA1(85ecd287fe72b56e54c8b01ea7492ca4a69a7470) ) - ROM_LOAD( "m2fr_n88_2.rom", 0xc000, 0x2000, CRC(98c3a7b2) SHA1(fc4980762d3caa56964d0ae583424756f511d186) ) - ROM_LOAD( "m2fr_n88_3.rom", 0xe000, 0x2000, CRC(0ca08abd) SHA1(a5a42d0b7caa84c3bc6e337c9f37874d82f9c14b) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "m2fr_disk.rom", 0x0000, 0x0800, CRC(2163b304) SHA1(80da2dee49d4307f00895a129a5cfeff00cf5321) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x40000, "kanji", 0) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x800 ) -ROM_END - -ROM_START( pc8801mk2mr ) - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8 - ROM_LOAD( "m2mr_n80.rom", 0x0000, 0x8000, CRC(f074b515) SHA1(ebe9cf4cf57f1602c887f609a728267f8d953dce) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.2 - ROM_LOAD( "m2mr_n88.rom", 0x0000, 0x8000, CRC(69caa38e) SHA1(3c64090237152ee77c76e04d6f36bad7297bea93) ) - ROM_LOAD( "m2mr_n88_0.rom", 0x8000, 0x2000, CRC(710a63ec) SHA1(d239c26ad7ac5efac6e947b0e9549b1534aa970d) ) - ROM_LOAD( "m2mr_n88_1.rom", 0xa000, 0x2000, CRC(e3e78a37) SHA1(85ecd287fe72b56e54c8b01ea7492ca4a69a7470) ) - ROM_LOAD( "m2mr_n88_2.rom", 0xc000, 0x2000, CRC(11176e0b) SHA1(f13f14f3d62df61498a23f7eb624e1a646caea45) ) - ROM_LOAD( "m2mr_n88_3.rom", 0xe000, 0x2000, CRC(0ca08abd) SHA1(a5a42d0b7caa84c3bc6e337c9f37874d82f9c14b) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "m2mr_disk.rom", 0x0000, 0x2000, CRC(2447516b) SHA1(1492116f15c426f9796dc2bb6fcccf2656c0ca75) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x40000, "kanji", 0) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - ROM_LOAD( "m2mr_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x800 ) -ROM_END - -ROM_START( pc8801mh ) - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8, but different BIOS code? - ROM_LOAD( "mh_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 - ROM_LOAD( "mh_n88.rom", 0x0000, 0x8000, CRC(64c5d162) SHA1(3e0aac76fb5d7edc99df26fa9f365fd991742a5d) ) - ROM_LOAD( "mh_n88_0.rom", 0x8000, 0x2000, CRC(deb384fb) SHA1(5f38cafa8aab16338038c82267800446fd082e79) ) - ROM_LOAD( "mh_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) - ROM_LOAD( "mh_n88_2.rom", 0xc000, 0x2000, CRC(6aa6b6d8) SHA1(2a077ab444a4fd1470cafb06fd3a0f45420c39cc) ) - ROM_LOAD( "mh_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "mh_disk.rom", 0x0000, 0x2000, CRC(a222ecf0) SHA1(79e9c0786a14142f7a83690bf41fb4f60c5c1004) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x40000, "kanji", 0) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - ROM_LOAD( "mh_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) -ROM_END - -ROM_START( pc8801fa ) - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8, but different BIOS code? - ROM_LOAD( "fa_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 but different BIOS code? - ROM_LOAD( "fa_n88.rom", 0x0000, 0x8000, CRC(73573432) SHA1(9b1346d44044eeea921c4cce69b5dc49dbc0b7e9) ) - ROM_LOAD( "fa_n88_0.rom", 0x8000, 0x2000, CRC(a72697d7) SHA1(5aedbc5916d67ef28767a2b942864765eea81bb8) ) - ROM_LOAD( "fa_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) - ROM_LOAD( "fa_n88_2.rom", 0xc000, 0x2000, CRC(6aee9a4e) SHA1(e94278682ef9e9bbb82201f72c50382748dcea2a) ) - ROM_LOAD( "fa_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "fa_disk.rom", 0x0000, 0x0800, CRC(2163b304) SHA1(80da2dee49d4307f00895a129a5cfeff00cf5321) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x40000, "kanji", 0 ) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - ROM_LOAD( "fa_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) -ROM_END - -ROM_START( pc8801ma ) // newer floppy BIOS and Jisyo (dictionary) ROM - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8, but different BIOS code? - ROM_LOAD( "ma_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 but different BIOS code? - ROM_LOAD( "ma_n88.rom", 0x0000, 0x8000, CRC(73573432) SHA1(9b1346d44044eeea921c4cce69b5dc49dbc0b7e9) ) - ROM_LOAD( "ma_n88_0.rom", 0x8000, 0x2000, CRC(a72697d7) SHA1(5aedbc5916d67ef28767a2b942864765eea81bb8) ) - ROM_LOAD( "ma_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) - ROM_LOAD( "ma_n88_2.rom", 0xc000, 0x2000, CRC(6aee9a4e) SHA1(e94278682ef9e9bbb82201f72c50382748dcea2a) ) - ROM_LOAD( "ma_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "ma_disk.rom", 0x0000, 0x2000, CRC(a222ecf0) SHA1(79e9c0786a14142f7a83690bf41fb4f60c5c1004) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x40000, "kanji", 0 ) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - ROM_LOAD( "ma_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) - - /* 32 banks, to be loaded at 0xc000 - 0xffff */ - ROM_REGION( 0x80000, "dictionary", 0 ) - ROM_LOAD( "ma_jisyo.rom", 0x00000, 0x80000, CRC(a6108f4d) SHA1(3665db538598abb45d9dfe636423e6728a812b12) ) -ROM_END - -ROM_START( pc8801ma2 ) - PC8801_MEM_LOAD - - ROM_REGION( 0x8000, "n80rom", ROMREGION_ERASEFF ) // 1.8 - ROM_LOAD( "ma2_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 (2.31?) - ROM_LOAD( "ma2_n88.rom", 0x0000, 0x8000, CRC(ae1a6ebc) SHA1(e53d628638f663099234e07837ffb1b0f86d480d) ) - ROM_LOAD( "ma2_n88_0.rom", 0x8000, 0x2000, CRC(a72697d7) SHA1(5aedbc5916d67ef28767a2b942864765eea81bb8) ) - ROM_LOAD( "ma2_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) - ROM_LOAD( "ma2_n88_2.rom", 0xc000, 0x2000, CRC(1d6277b6) SHA1(dd9c3e50169b75bb707ef648f20d352e6a8bcfe4) ) - ROM_LOAD( "ma2_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "ma2_disk.rom", 0x0000, 0x2000, CRC(a222ecf0) SHA1(79e9c0786a14142f7a83690bf41fb4f60c5c1004) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x40000, "kanji", 0) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - ROM_LOAD( "ma2_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) - - ROM_REGION( 0x80000, "dictionary", 0 ) - ROM_LOAD( "ma2_jisyo.rom", 0x00000, 0x80000, CRC(856459af) SHA1(06241085fc1d62d4b2968ad9cdbdadc1e7d7990a) ) -ROM_END - -ROM_START( pc8801mc ) - PC8801_MEM_LOAD - - ROM_REGION( 0x08000, "n80rom", ROMREGION_ERASEFF ) // 1.8 - ROM_LOAD( "mc_n80.rom", 0x0000, 0x8000, CRC(8a2a1e17) SHA1(06dae1db384aa29d81c5b6ed587877e7128fcb35) ) - - ROM_REGION( 0x10000, "n88rom", ROMREGION_ERASEFF ) // 2.3 (2.33?) - ROM_LOAD( "mc_n88.rom", 0x0000, 0x8000, CRC(356d5719) SHA1(5d9ba80d593a5119f52aae1ccd61a1457b4a89a1) ) - ROM_LOAD( "mc_n88_0.rom", 0x8000, 0x2000, CRC(a72697d7) SHA1(5aedbc5916d67ef28767a2b942864765eea81bb8) ) - ROM_LOAD( "mc_n88_1.rom", 0xa000, 0x2000, CRC(7ad5d943) SHA1(4ae4d37409ff99411a623da9f6a44192170a854e) ) - ROM_LOAD( "mc_n88_2.rom", 0xc000, 0x2000, CRC(1d6277b6) SHA1(dd9c3e50169b75bb707ef648f20d352e6a8bcfe4) ) - ROM_LOAD( "mc_n88_3.rom", 0xe000, 0x2000, CRC(692cbcd8) SHA1(af452aed79b072c4d17985830b7c5dca64d4b412) ) - - ROM_REGION( 0x10000, "fdccpu", 0) - ROM_LOAD( "mc_disk.rom", 0x0000, 0x2000, CRC(a222ecf0) SHA1(79e9c0786a14142f7a83690bf41fb4f60c5c1004) ) - - ROM_REGION( 0x10000, "cdrom", 0 ) - ROM_LOAD( "cdbios.rom", 0x0000, 0x10000, CRC(5c230221) SHA1(6394a8a23f44ea35fcfc3e974cf940bc8f84d62a) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x40000, "kanji", 0 ) - ROM_LOAD( "kanji1.rom", 0x00000, 0x20000, CRC(6178bd43) SHA1(82e11a177af6a5091dd67f50a2f4bafda84d6556) ) - ROM_LOAD( "mc_kanji2.rom", 0x20000, 0x20000, CRC(376eb677) SHA1(bcf96584e2ba362218b813be51ea21573d1a2a78) ) - - ROM_REGION( 0x800, "cgrom", 0) - ROM_COPY( "kanji", 0x1000, 0x0000, 0x0800 ) - - ROM_REGION( 0x80000, "dictionary", 0 ) - ROM_LOAD( "mc_jisyo.rom", 0x00000, 0x80000, CRC(bd6eb062) SHA1(deef0cc2a9734ba891a6d6c022aa70ffc66f783e) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ - -COMP( 1981, pc8801, 0, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801", MACHINE_NOT_WORKING ) -COMP( 1983, pc8801mk2, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkII", MACHINE_NOT_WORKING ) -COMP( 1985, pc8801mk2sr, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkIISR", MACHINE_NOT_WORKING ) -//COMP( 1985, pc8801mk2tr, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkIITR", MACHINE_NOT_WORKING ) -COMP( 1985, pc8801mk2fr, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkIIFR", MACHINE_NOT_WORKING ) -COMP( 1985, pc8801mk2mr, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801mkIIMR", MACHINE_NOT_WORKING ) - -//COMP( 1986, pc8801fh, 0, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801FH", MACHINE_NOT_WORKING ) -COMP( 1986, pc8801mh, pc8801, 0, pc8801fh, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801MH", MACHINE_NOT_WORKING ) -COMP( 1987, pc8801fa, pc8801, 0, pc8801fh, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801FA", MACHINE_NOT_WORKING ) -COMP( 1987, pc8801ma, pc8801, 0, pc8801ma, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801MA", MACHINE_NOT_WORKING ) -//COMP( 1988, pc8801fe, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801FE", MACHINE_NOT_WORKING ) -COMP( 1988, pc8801ma2, pc8801, 0, pc8801ma, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801MA2", MACHINE_NOT_WORKING ) -//COMP( 1989, pc8801fe2, pc8801, 0, pc8801, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801FE2", MACHINE_NOT_WORKING ) -COMP( 1989, pc8801mc, pc8801, 0, pc8801mc, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-8801MC", MACHINE_NOT_WORKING ) - -//COMP( 1989, pc98do, 0, 0, pc88va, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-98DO", MACHINE_NOT_WORKING ) -//COMP( 1990, pc98dop, 0, 0, pc88va, pc88sr, driver_device, 0, "Nippon Electronic Company", "PC-98DO+", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pc88va.c b/src/mess/drivers/pc88va.c deleted file mode 100644 index 8999e56b864..00000000000 --- a/src/mess/drivers/pc88va.c +++ /dev/null @@ -1,1919 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/******************************************************************************************** - - PC-88VA (c) 1987 NEC - - A follow up of the regular PC-8801. It can also run PC-8801 software in compatible mode - - preliminary driver by Angelo Salese - Special thanks to Fujix for his documentation translation help - - TODO: - - Does this system have one or two CPUs? I'm prone to think that the V30 does all the job - and then enters into z80 compatible mode for PC-8801 emulation. - - What exact kind of garbage happens if you try to enable both direct and palette color - modes to a graphic layer? - - What is exactly supposed to be a "bus slot"? - - fdc "intelligent mode" has 0x7f as irq vector ... 0x7f is ld a,a and it IS NOT correctly - hooked up by the current z80 core - - PC-88VA stock version has two bogus opcodes. One is at 0xf0b15, another at 0xf0b31. - Making a patch for the latter makes the system to jump into a "DIP-Switch" display. - - unemulated upd71071 demand mode. - - Fix floppy motor hook-up; - -********************************************************************************************/ - -#include "emu.h" -#include "cpu/nec/nec.h" -#include "cpu/z80/z80.h" -#include "debug/debugcpu.h" -#include "machine/i8255.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/upd765.h" -#include "sound/2203intf.h" -#include "formats/xdf_dsk.h" -//#include "machine/upd71071.h" -#include "machine/am9517a.h" - - -/* Note: for the time being, just disable FDC CPU, it's for PC-8801 compatibility mode anyway ... */ -#define TEST_SUBFDC 0 - -struct tsp_t -{ - UINT16 tvram_vreg_offset; - UINT16 attr_offset; - UINT16 spr_offset; - UINT8 disp_on; - UINT8 spr_on; - UINT8 pitch; - UINT8 line_height; - UINT8 h_line_pos; - UINT8 blink; - UINT16 cur_pos_x,cur_pos_y; - UINT8 curn; - UINT8 curn_blink; -}; - - -class pc88va_state : public driver_device -{ -public: - enum - { - TIMER_PC8801FD_UPD765_TC_TO_ZERO, - TIMER_T3_MOUSE_CALLBACK, - TIMER_PC88VA_FDC_TIMER, - TIMER_PC88VA_FDC_MOTOR_START_0, - TIMER_PC88VA_FDC_MOTOR_START_1 - }; - - pc88va_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_fdc(*this, "upd765"), - m_dmac(*this, "dmac"), - m_palram(*this, "palram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - required_device m_maincpu; - required_device m_fdc; - required_device m_dmac; - required_shared_ptr m_palram; - UINT16 m_bank_reg; - UINT16 m_screen_ctrl_reg; - UINT8 m_timer3_io_reg; - emu_timer *m_t3_mouse_timer; - tsp_t m_tsp; - UINT16 m_video_pri_reg[2]; - UINT8 m_backupram_wp; - UINT8 m_cmd; - UINT8 m_buf_size; - UINT8 m_buf_index; - UINT8 m_buf_ram[16]; - UINT8 m_portc_test; - UINT8 m_fdc_motor_status[2]; - - /* floppy state */ - UINT8 m_i8255_0_pc; - UINT8 m_i8255_1_pc; - UINT8 m_fdc_mode; - UINT8 m_fdc_irq_opcode; - DECLARE_READ16_MEMBER(sys_mem_r); - DECLARE_WRITE16_MEMBER(sys_mem_w); - DECLARE_READ8_MEMBER(idp_status_r); - DECLARE_WRITE8_MEMBER(idp_command_w); - DECLARE_WRITE8_MEMBER(idp_param_w); - DECLARE_WRITE16_MEMBER(palette_ram_w); - DECLARE_READ16_MEMBER(sys_port4_r); - DECLARE_READ16_MEMBER(bios_bank_r); - DECLARE_WRITE16_MEMBER(bios_bank_w); - DECLARE_READ8_MEMBER(rom_bank_r); - DECLARE_READ8_MEMBER(key_r); - DECLARE_WRITE16_MEMBER(backupram_wp_1_w); - DECLARE_WRITE16_MEMBER(backupram_wp_0_w); - DECLARE_READ8_MEMBER(hdd_status_r); - #if TEST_SUBFDC - DECLARE_READ8_MEMBER(upd765_tc_r); - DECLARE_WRITE8_MEMBER(upd765_mc_w); - #else - DECLARE_READ8_MEMBER(no_subfdc_r); - #endif - DECLARE_READ8_MEMBER(pc88va_fdc_r); - DECLARE_WRITE8_MEMBER(pc88va_fdc_w); - DECLARE_READ16_MEMBER(sysop_r); - DECLARE_READ16_MEMBER(screen_ctrl_r); - DECLARE_WRITE16_MEMBER(screen_ctrl_w); - DECLARE_WRITE8_MEMBER(timer3_ctrl_reg_w); - DECLARE_WRITE16_MEMBER(video_pri_w); - DECLARE_READ8_MEMBER(backupram_dsw_r); - DECLARE_WRITE8_MEMBER(sys_port1_w); - DECLARE_WRITE8_MEMBER(fdc_irq_vector_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_pc88va(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(pc88va_vrtc_irq); - DECLARE_READ8_MEMBER(cpu_8255_c_r); - DECLARE_WRITE8_MEMBER(cpu_8255_c_w); - DECLARE_READ8_MEMBER(fdc_8255_c_r); - DECLARE_WRITE8_MEMBER(fdc_8255_c_w); - DECLARE_READ8_MEMBER(r232_ctrl_porta_r); - DECLARE_READ8_MEMBER(r232_ctrl_portb_r); - DECLARE_READ8_MEMBER(r232_ctrl_portc_r); - DECLARE_WRITE8_MEMBER(r232_ctrl_porta_w); - DECLARE_WRITE8_MEMBER(r232_ctrl_portb_w); - DECLARE_WRITE8_MEMBER(r232_ctrl_portc_w); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE_LINE_MEMBER(pc88va_pit_out0_changed); -// DECLARE_WRITE_LINE_MEMBER(pc88va_upd765_interrupt); - UINT8 m_fdc_ctrl_2; - TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero); - TIMER_CALLBACK_MEMBER(t3_mouse_callback); - TIMER_CALLBACK_MEMBER(pc88va_fdc_timer); - TIMER_CALLBACK_MEMBER(pc88va_fdc_motor_start_0); - TIMER_CALLBACK_MEMBER(pc88va_fdc_motor_start_1); -// UINT16 m_fdc_dma_r(); -// void m_fdc_dma_w(UINT16 data); - DECLARE_WRITE_LINE_MEMBER(pc88va_hlda_w); - DECLARE_WRITE_LINE_MEMBER(pc88va_tc_w); - DECLARE_READ8_MEMBER(fdc_dma_r); - DECLARE_WRITE8_MEMBER(fdc_dma_w); -DECLARE_READ8_MEMBER(dma_memr_cb); -DECLARE_WRITE8_MEMBER(dma_memw_cb); - - DECLARE_WRITE_LINE_MEMBER(fdc_irq); - DECLARE_WRITE_LINE_MEMBER(fdc_drq); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - void pc88va_fdc_update_ready(floppy_image_device *, int); - void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 calc_kanji_rom_addr(UINT8 jis1,UINT8 jis2,int x,int y); - void draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect); - void tsp_sprite_enable(UINT32 spr_offset, UINT8 sw_bit); - void execute_sync_cmd(); - void execute_dspon_cmd(); - void execute_dspdef_cmd(); - void execute_curdef_cmd(); - void execute_actscr_cmd(); - void execute_curs_cmd(); - void execute_emul_cmd(); - void execute_spron_cmd(); - void execute_sprsw_cmd(); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - required_device m_gfxdecode; - required_device m_palette; -}; - - - -void pc88va_state::video_start() -{ -} - -void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT16 *tvram = (UINT16 *)(memregion("tvram")->base()); - int offs,i; - - offs = m_tsp.spr_offset; - for(i=0;i<(0x100);i+=(8)) - { - int xp,yp,sw,md,xsize,ysize,spda,fg_col,bc; - int x_i,y_i,x_s; - int spr_count; - int pen; - - ysize = (tvram[(offs + i + 0) / 2] & 0xfc00) >> 10; - sw = (tvram[(offs + i + 0) / 2] & 0x200) >> 9; - yp = (tvram[(offs + i + 0) / 2] & 0x1ff); - xsize = (tvram[(offs + i + 2) / 2] & 0xf800) >> 11; - md = (tvram[(offs + i + 2) / 2] & 0x400) >> 10; - xp = (tvram[(offs + i + 2) / 2] & 0x3ff); - spda = (tvram[(offs + i + 4) / 2] & 0xffff); - fg_col = (tvram[(offs + i + 6) / 2] & 0xf0) >> 4; - bc = (tvram[(offs + i + 6) / 2] & 0x08) >> 3; - - if(!sw) - continue; - - if(yp & 0x100) - { - yp &= 0xff; - yp = 0x100 - yp; - } - - if(0) // uhm, makes more sense without the sign? - if(xp & 0x200) - { - xp &= 0x1ff; - xp = 0x200 - xp; - } - - if(md) // 1bpp mode - { - xsize = (xsize + 1) * 32; - ysize = (ysize + 1) * 4; - - if(!(spda & 0x8000)) // correct? - spda *= 2; - - spr_count = 0; - - for(y_i=0;y_i> (15-x_s)) & 1; - - pen = pen & 1 ? fg_col : (bc) ? 8 : -1; - - if(pen != -1) //transparent pen - bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); - } - spr_count+=2; - } - } - } - else // 4bpp mode (UNTESTED) - { - xsize = (xsize + 1) * 8; - ysize = (ysize + 1) * 4; - - if(!(spda & 0x8000)) // correct? - spda *= 2; - - spr_count = 0; - - for(y_i=0;y_i> (16-(x_s*8)) & 0xf; - - //if(bc != -1) //transparent pen - bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); - } - spr_count+=2; - } - } - } - } -} - -/* TODO: this is either a result of an hand-crafted ROM or the JIS stuff is really attribute related ... */ -UINT32 pc88va_state::calc_kanji_rom_addr(UINT8 jis1,UINT8 jis2,int x,int y) -{ - if(jis1 < 0x30) - return ((jis2 & 0x60) << 8) + ((jis1 & 0x07) << 10) + ((jis2 & 0x1f) << 5); - else if(jis1 >= 0x30 && jis1 < 0x3f) - return ((jis2 & 0x60) << 10) + ((jis1 & 0x0f) << 10) + ((jis2 & 0x1f) << 5); - else if(jis1 >= 0x40 && jis1 < 0x50) - return 0x4000 + ((jis2 & 0x60) << 10) + ((jis1 & 0x0f) << 10) + ((jis2 & 0x1f) << 5); - else if(x == 0 && y == 0 && jis1 != 0) // debug stuff, to be nuked in the end - printf("%02x\n",jis1); - - return 0; -} - -void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT8 *tvram = memregion("tvram")->base(); - UINT8 *kanji = memregion("kanji")->base(); - int xi,yi; - int x,y; - int res_x,res_y; - UINT16 lr_half_gfx; - UINT8 jis1,jis2; - UINT32 count; - UINT32 tile_num; - UINT16 attr; - UINT8 attr_mode; - UINT8 fg_col,bg_col,secret,reverse; - //UINT8 blink,dwidc,dwid,uline,hline; - UINT8 screen_fg_col,screen_bg_col; - - count = (tvram[m_tsp.tvram_vreg_offset+0] | tvram[m_tsp.tvram_vreg_offset+1] << 8); - - attr_mode = tvram[m_tsp.tvram_vreg_offset+0xa] & 0x1f; - /* Note: bug in docs has the following two reversed */ - screen_fg_col = (tvram[m_tsp.tvram_vreg_offset+0xb] & 0xf0) >> 4; - screen_bg_col = tvram[m_tsp.tvram_vreg_offset+0xb] & 0x0f; - - for(y=0;y<13;y++) - { - for(x=0;x<80;x++) - { - jis1 = (tvram[count+0] & 0x7f) + 0x20; - jis2 = tvram[count+1] & 0x7f; - lr_half_gfx = ((tvram[count+1] & 0x80) >> 7); - - tile_num = calc_kanji_rom_addr(jis1,jis2,x,y); - - attr = (tvram[count+m_tsp.attr_offset] & 0x00ff); - - fg_col = bg_col = reverse = secret = 0; //blink = dwidc = dwid = uline = hline = 0; - - switch(attr_mode) - { - /* - xxxx ---- foreground color - ---- xxxx background color - */ - case 0: - fg_col = (attr & 0xf0) >> 4; - bg_col = (attr & 0x0f) >> 0; - break; - /* - xxxx ---- foreground color - ---- x--- horizontal line - ---- -x-- reverse - ---- --x- blink - ---- ---x secret (hide text) - background color is defined by screen control table values - */ - case 1: - fg_col = (attr & 0xf0) >> 4; - bg_col = screen_bg_col; - //hline = (attr & 0x08) >> 3; - reverse = (attr & 0x04) >> 2; - //blink = (attr & 0x02) >> 1; - secret = (attr & 0x01) >> 0; - break; - /* - x--- ---- dwidc - -x-- ---- dwid - --x- ---- uline - ---x ---- hline - ---- -x-- reverse - ---- --x- blink - ---- ---x secret (hide text) - background and foreground colors are defined by screen control table values - */ - case 2: - fg_col = screen_fg_col; - bg_col = screen_bg_col; - //dwidc = (attr & 0x80) >> 7; - //dwid = (attr & 0x40) >> 6; - //uline = (attr & 0x20) >> 5; - //hline = (attr & 0x10) >> 4; - reverse = (attr & 0x04) >> 2; - //blink = (attr & 0x02) >> 1; - secret = (attr & 0x01) >> 0; - break; - /* - ---- x--- mixes between mode 0 and 2 - - xxxx 1--- foreground color - ---- 1xxx background color - 2) - x--- 0--- dwidc - -x-- 0--- dwid - --x- 0--- uline - ---x 0--- hline - ---- 0x-- reverse - ---- 0-x- blink - ---- 0--x secret (hide text) - background and foreground colors are defined by screen control table values - */ - case 3: - { - if(attr & 0x8) - { - fg_col = (attr & 0xf0) >> 4; - bg_col = (attr & 0x07) >> 0; - } - else - { - fg_col = screen_fg_col; - bg_col = screen_bg_col; - //dwidc = (attr & 0x80) >> 7; - //dwid = (attr & 0x40) >> 6; - //uline = (attr & 0x20) >> 5; - //hline = (attr & 0x10) >> 4; - reverse = (attr & 0x04) >> 2; - //blink = (attr & 0x02) >> 1; - secret = (attr & 0x01) >> 0; - } - } - break; - /* - x--- ---- blink - -xxx ---- background color - ---- xxxx foreground color - */ - case 4: - fg_col = (attr & 0x0f) >> 0; - bg_col = (attr & 0x70) >> 4; - //blink = (attr & 0x80) >> 7; - break; - /* - x--- ---- blink - -xxx ---- background color - ---- xxxx foreground color - hline is enabled if foreground color is 1 or 9 - */ - case 5: - fg_col = (attr & 0x0f) >> 0; - bg_col = (attr & 0x70) >> 4; - //blink = (attr & 0x80) >> 7; - //if((fg_col & 7) == 1) - //hline = 1; - break; - default: - popmessage("Illegal text tilemap attribute mode %02x, contact MESSdev",attr_mode); - return; - } - - for(yi=0;yi<16;yi++) - { - for(xi=0;xi<8;xi++) - { - int pen; - - res_x = x*8+xi; - res_y = y*16+yi; - - if(!cliprect.contains(res_x, res_y)) - continue; - - pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1; - - if(reverse) - pen = pen & 1 ? bg_col : fg_col; - else - pen = pen & 1 ? fg_col : bg_col; - - if(secret) { pen = 0; } //hide text - - if(pen != -1) //transparent - bitmap.pix32(res_y, res_x) = m_palette->pen(pen); - } - } - - count+=2; - count&=0xffff; - } - } -} - -UINT32 pc88va_state::screen_update_pc88va(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT8 pri,cur_pri_lv; - UINT32 screen_pri; - bitmap.fill(0, cliprect); - - if(m_tsp.disp_on == 0) // don't bother if we are under DSPOFF command - return 0; - - /* - m_video_pri_reg[0] - xxxx ---- ---- ---- priority 3 - ---- xxxx ---- ---- priority 2 - ---- ---- xxxx ---- priority 1 - ---- ---- ---- xxxx priority 0 - m_video_pri_reg[1] - ---- ---- xxxx ---- priority 5 - ---- ---- ---- xxxx priority 4 - - Note that orthogonality level is actually REVERSED than the level number it indicates, so we have to play a little with the data for an easier usage ... - */ - - screen_pri = (m_video_pri_reg[1] & 0x00f0) >> 4; // priority 5 - screen_pri|= (m_video_pri_reg[1] & 0x000f) << 4; // priority 4 - screen_pri|= (m_video_pri_reg[0] & 0xf000) >> 4; // priority 3 - screen_pri|= (m_video_pri_reg[0] & 0x0f00) << 4; // priority 2 - screen_pri|= (m_video_pri_reg[0] & 0x00f0) << 12; // priority 1 - screen_pri|= (m_video_pri_reg[0] & 0x000f) << 20; // priority 0 - - for(pri=0;pri<6;pri++) - { - cur_pri_lv = (screen_pri >> (pri*4)) & 0xf; - - if(cur_pri_lv & 8) // enable layer - { - if(pri <= 1) // (direct color mode, priority 5 and 4) - { - // 8 = graphic 0 - // 9 = graphic 1 - } - else - { - switch(cur_pri_lv & 3) // (palette color mode) - { - case 0: draw_text(bitmap,cliprect); break; - case 1: if(m_tsp.spr_on) { draw_sprites(bitmap,cliprect); } break; - case 2: /* A = graphic 0 */ break; - case 3: /* B = graphic 1 */ break; - } - } - } - } - - return 0; -} - -void pc88va_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_PC8801FD_UPD765_TC_TO_ZERO: - pc8801fd_upd765_tc_to_zero(ptr, param); - break; - case TIMER_T3_MOUSE_CALLBACK: - t3_mouse_callback(ptr, param); - break; - case TIMER_PC88VA_FDC_TIMER: - pc88va_fdc_timer(ptr, param); - break; - case TIMER_PC88VA_FDC_MOTOR_START_0: - pc88va_fdc_motor_start_0(ptr, param); - break; - case TIMER_PC88VA_FDC_MOTOR_START_1: - pc88va_fdc_motor_start_1(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in pc88va_state::device_timer"); - } -} - -READ16_MEMBER(pc88va_state::sys_mem_r) -{ - switch((m_bank_reg & 0xf00) >> 8) - { - case 0: // select bus slot - return 0xffff; - case 1: // TVRAM - { - UINT16 *tvram = (UINT16 *)(memregion("tvram")->base()); - - if(((offset*2) & 0x30000) == 0) - return tvram[offset]; - - return 0xffff; - } - case 4: - { - UINT16 *gvram = (UINT16 *)(memregion("gvram")->base()); - - return gvram[offset]; - } - case 8: // kanji ROM - case 9: - { - UINT16 *knj_ram = (UINT16 *)(memregion("kanji")->base()); - UINT32 knj_offset; - - knj_offset = (offset + (((m_bank_reg & 0x100) >> 8)*0x20000)); - - /* 0x00000 - 0x3ffff Kanji ROM 1*/ - /* 0x40000 - 0x4ffff Kanji ROM 2*/ - /* 0x50000 - 0x53fff Backup RAM */ - /* anything else is a NOP (I presume?) */ - - return knj_ram[knj_offset]; - } - case 0xc: // Dictionary ROM - case 0xd: - { - UINT16 *dic_rom = (UINT16 *)(memregion("dictionary")->base()); - UINT32 dic_offset; - - dic_offset = (offset + (((m_bank_reg & 0x100) >> 8)*0x20000)); - - return dic_rom[dic_offset]; - } - } - - return 0xffff; -} - -WRITE16_MEMBER(pc88va_state::sys_mem_w) -{ - switch((m_bank_reg & 0xf00) >> 8) - { - case 0: // select bus slot - break; - case 1: // TVRAM - { - UINT16 *tvram = (UINT16 *)(memregion("tvram")->base()); - - if(((offset*2) & 0x30000) == 0) - COMBINE_DATA(&tvram[offset]); - } - break; - case 4: // TVRAM - { - UINT16 *gvram = (UINT16 *)(memregion("gvram")->base()); - - COMBINE_DATA(&gvram[offset]); - } - break; - case 8: // kanji ROM, backup RAM at 0xb0000 - 0xb3fff - case 9: - { - UINT16 *knj_ram = (UINT16 *)(memregion("kanji")->base()); - UINT32 knj_offset; - - knj_offset = ((offset) + (((m_bank_reg & 0x100) >> 8)*0x20000)); - - if(knj_offset >= 0x50000/2 && knj_offset <= 0x53fff/2) // TODO: there's an area that can be write protected - { - COMBINE_DATA(&knj_ram[knj_offset]); - m_gfxdecode->gfx(0)->mark_dirty((knj_offset * 2) / 8); - m_gfxdecode->gfx(1)->mark_dirty((knj_offset * 2) / 32); - } - } - break; - case 0xc: // Dictionary ROM - case 0xd: - { - // NOP? - } - break; - } -} - -static ADDRESS_MAP_START( pc88va_map, AS_PROGRAM, 16, pc88va_state ) - AM_RANGE(0x00000, 0x7ffff) AM_RAM -// AM_RANGE(0x80000, 0x9ffff) AM_RAM // EMM - AM_RANGE(0xa0000, 0xdffff) AM_READWRITE(sys_mem_r,sys_mem_w) - AM_RANGE(0xe0000, 0xeffff) AM_ROMBANK("rom00_bank") - AM_RANGE(0xf0000, 0xfffff) AM_ROMBANK("rom10_bank") -ADDRESS_MAP_END - -/* IDP = NEC uPD72022 */ -READ8_MEMBER(pc88va_state::idp_status_r) -{ -/* - x--- ---- LP Light-pen signal detection (with VA use failure) - -x-- ---- VB Vertical elimination period - --x- ---- SC Sprite control (sprite over/collision) - ---x ---- ER Error occurrence - ---- x--- In the midst of execution of EMEN emulation development - ---- -x-- In the midst of BUSY command execution - ---- --x- OBF output data buffer full - ---- ---x IBF input data buffer full (command/parameter commonness) -*/ - return 0x00; -} - - -#define SYNC 0x10 -#define DSPON 0x12 -#define DSPOFF 0x13 -#define DSPDEF 0x14 -#define CURDEF 0x15 -#define ACTSCR 0x16 -#define CURS 0x1e -#define EMUL 0x8c -#define EXIT 0x88 -#define SPRON 0x82 -#define SPROFF 0x83 -#define SPRSW 0x85 -#define SPROV 0x81 - -WRITE8_MEMBER(pc88va_state::idp_command_w) -{ - switch(data) - { - /* 0x10 - SYNC: sets CRTC values */ - case SYNC: m_cmd = SYNC; m_buf_size = 14; m_buf_index = 0; break; - - /* 0x12 - DSPON: set DiSPlay ON and set up tvram table vreg */ - case DSPON: m_cmd = DSPON; m_buf_size = 3; m_buf_index = 0; break; - - /* 0x13 - DSPOFF: set DiSPlay OFF */ - case DSPOFF: m_cmd = DSPOFF; m_tsp.disp_on = 0; break; - - /* 0x14 - DSPDEF: set DiSPlay DEFinitions */ - case DSPDEF: m_cmd = DSPDEF; m_buf_size = 6; m_buf_index = 0; break; - - /* 0x15 - CURDEF: set CURsor DEFinition */ - case CURDEF: m_cmd = CURDEF; m_buf_size = 1; m_buf_index = 0; break; - - /* 0x16 - ACTSCR: ??? */ - case ACTSCR: m_cmd = ACTSCR; m_buf_size = 1; m_buf_index = 0; break; - - /* 0x15 - CURS: set CURSor position */ - case CURS: m_cmd = CURS; m_buf_size = 4; m_buf_index = 0; break; - - /* 0x8c - EMUL: set 3301 EMULation */ - case EMUL: m_cmd = EMUL; m_buf_size = 4; m_buf_index = 0; break; - - /* 0x88 - EXIT: ??? */ - case EXIT: m_cmd = EXIT; break; - - /* 0x82 - SPRON: set SPRite ON */ - case SPRON: m_cmd = SPRON; m_buf_size = 3; m_buf_index = 0; break; - - /* 0x83 - SPROFF: set SPRite OFF */ - case SPROFF: m_cmd = SPROFF; m_tsp.spr_on = 0; break; - - /* 0x85 - SPRSW: ??? */ - case SPRSW: m_cmd = SPRSW; m_buf_size = 1; m_buf_index = 0; break; - - /* 0x81 - SPROV: set SPRite OVerflow information */ - /* - -x-- ---- Sprite Over flag - --x- ---- Sprite Collision flag - ---x xxxx First sprite that caused Sprite Over event - */ - case SPROV: m_cmd = SPROV; /* TODO: where it returns the info? */ break; - - /* TODO: 0x89 shouldn't trigger, should be one of the above commands */ - /* Update: actually 0x89 is mask command */ - default: m_cmd = 0x00; printf("PC=%05x: Unknown IDP %02x cmd set\n",space.device().safe_pc(),data); break; - } -} - -void pc88va_state::tsp_sprite_enable(UINT32 spr_offset, UINT8 sw_bit) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.write_word(spr_offset, space.read_word(spr_offset) & ~0x200); - space.write_word(spr_offset, space.read_word(spr_offset) | (sw_bit & 0x200)); -} - -/* TODO: very preliminary, needs something showable first */ -void pc88va_state::execute_sync_cmd() -{ - /* - ???? ???? [0] - unknown - ???? ???? [1] - unknown - --xx xxxx [2] - h blank start - --xx xxxx [3] - h border start - xxxx xxxx [4] - h visible area - --xx xxxx [5] - h border end - --xx xxxx [6] - h blank end - --xx xxxx [7] - h sync - --xx xxxx [8] - v blank start - --xx xxxx [9] - v border start - xxxx xxxx [A] - v visible area - -x-- ---- [B] - v visible area (bit 9) - --xx xxxx [C] - v border end - --xx xxxx [D] - v blank end - --xx xxxx [E] - v sync - */ - rectangle visarea; - attoseconds_t refresh; - UINT16 x_vis_area,y_vis_area; - - //printf("V blank start: %d\n",(sync_cmd[0x8])); - //printf("V border start: %d\n",(sync_cmd[0x9])); - //printf("V Visible Area: %d\n",(sync_cmd[0xa])|((sync_cmd[0xb] & 0x40)<<2)); - //printf("V border end: %d\n",(sync_cmd[0xc])); - //printf("V blank end: %d\n",(sync_cmd[0xd])); - - x_vis_area = m_buf_ram[4] * 4; - y_vis_area = (m_buf_ram[0xa])|((m_buf_ram[0xb] & 0x40)<<2); - - visarea.set(0, x_vis_area - 1, 0, y_vis_area - 1); - - //if(y_vis_area == 400) - // refresh = HZ_TO_ATTOSECONDS(24800) * x_vis_area * y_vis_area; //24.8 KHz - //else - // refresh = HZ_TO_ATTOSECONDS(15730) * x_vis_area * y_vis_area; //15.73 KHz - - refresh = HZ_TO_ATTOSECONDS(60); - - machine().first_screen()->configure(640, 480, visarea, refresh); -} - -void pc88va_state::execute_dspon_cmd() -{ - /* - [0] text table offset (hi word) - [1] unknown - [2] unknown - */ - m_tsp.tvram_vreg_offset = m_buf_ram[0] << 8; - m_tsp.disp_on = 1; -} - -void pc88va_state::execute_dspdef_cmd() -{ - /* - [0] attr offset (lo word) - [1] attr offset (hi word) - [2] pitch (character code interval x 16, i.e. 0x20 = 2 bytes - [3] line height - [4] hline vertical position - [5] blink number - */ - m_tsp.attr_offset = m_buf_ram[0] | m_buf_ram[1] << 8; - m_tsp.pitch = (m_buf_ram[2] & 0xf0) >> 4; - m_tsp.line_height = m_buf_ram[3] + 1; - m_tsp.h_line_pos = m_buf_ram[4]; - m_tsp.blink = (m_buf_ram[5] & 0xf8) >> 3; -} - -void pc88va_state::execute_curdef_cmd() -{ - /* - xxxx x--- [0] Sprite Cursor number (sprite RAM entry) - ---- --x- [0] show cursor bit (actively modifies the spriteram entry) - ---- ---x [0] Blink Enable - */ - - /* TODO: needs basic sprite emulation */ - m_tsp.curn = (m_buf_ram[0] & 0xf8); - m_tsp.curn_blink = (m_buf_ram[0] & 1); - - tsp_sprite_enable(0xa0000 + m_tsp.spr_offset + m_tsp.curn, (m_buf_ram[0] & 2) << 8); -} - -void pc88va_state::execute_actscr_cmd() -{ - /* - This command assigns a strip where the cursor is located. - xxxx xxxx [0] strip ID * 32 (???) - */ - - /* TODO: no idea about this command */ - //printf("ACTSCR: %02x\n",m_buf_ram[0]); -} - -void pc88va_state::execute_curs_cmd() -{ - /* - [0] Cursor Position Y (lo word) - [1] Cursor Position Y (hi word) - [2] Cursor Position X (lo word) - [3] Cursor Position X (hi word) - */ - - m_tsp.cur_pos_y = m_buf_ram[0] | m_buf_ram[1] << 8; - m_tsp.cur_pos_x = m_buf_ram[2] | m_buf_ram[3] << 8; -} - -void pc88va_state::execute_emul_cmd() -{ - /* - [0] Emulate target strip ID x 32 - [1] The number of chars - [2] The number of attributes - [3] The number of lines - */ - - // TODO: this starts 3301 video emulation - //popmessage("Warning: TSP executes EMUL command, contact MESSdev"); -} - -void pc88va_state::execute_spron_cmd() -{ - /* - [0] Sprite Table Offset (hi word) - [1] (unknown / reserved) - xxxx x--- [2] HSPN: Maximum number of sprites in one raster (num + 1) for Sprite Over - ---- --x- [2] MG: all sprites are 2x zoomed vertically when 1 - ---- ---x [2] GR: 1 to enable the group collision detection - */ - m_tsp.spr_offset = m_buf_ram[0] << 8; - m_tsp.spr_on = 1; - printf("SPR TABLE %02x %02x %02x\n",m_buf_ram[0],m_buf_ram[1],m_buf_ram[2]); -} - -void pc88va_state::execute_sprsw_cmd() -{ - /* - Toggle an individual sprite in the sprite ram entry - [0] xxxx x--- target sprite number - [0] ---- --x- sprite off/on switch - */ - - tsp_sprite_enable(0xa0000 + m_tsp.spr_offset + (m_buf_ram[0] & 0xf8), (m_buf_ram[0] & 2) << 8); -} - -WRITE8_MEMBER(pc88va_state::idp_param_w) -{ - if(m_cmd == DSPOFF || m_cmd == EXIT || m_cmd == SPROFF || m_cmd == SPROV) // no param commands - return; - - m_buf_ram[m_buf_index] = data; - m_buf_index++; - - if(m_buf_index >= m_buf_size) - { - m_buf_index = 0; - switch(m_cmd) - { - case SYNC: execute_sync_cmd(); break; - case DSPON: execute_dspon_cmd(); break; - case DSPDEF: execute_dspdef_cmd(); break; - case CURDEF: execute_curdef_cmd(); break; - case ACTSCR: execute_actscr_cmd(); break; - case CURS: execute_curs_cmd(); break; - case EMUL: execute_emul_cmd(); break; - case SPRON: execute_spron_cmd(); break; - case SPRSW: execute_sprsw_cmd(); break; - - default: - //printf("%02x\n",data); - break; - } - } -} - -WRITE16_MEMBER(pc88va_state::palette_ram_w) -{ - int r,g,b; - COMBINE_DATA(&m_palram[offset]); - - b = (m_palram[offset] & 0x001e) >> 1; - r = (m_palram[offset] & 0x03c0) >> 6; - g = (m_palram[offset] & 0x7800) >> 11; - - m_palette->set_pen_color(offset,pal4bit(r),pal4bit(g),pal4bit(b)); -} - -READ16_MEMBER(pc88va_state::sys_port4_r) -{ - UINT8 vrtc,sw1; - vrtc = (machine().first_screen()->vpos() < 200) ? 0x20 : 0x00; // vblank - - sw1 = (ioport("DSW")->read() & 1) ? 2 : 0; - - return vrtc | sw1 | 0xc0; -} - -READ16_MEMBER(pc88va_state::bios_bank_r) -{ - return m_bank_reg; -} - -WRITE16_MEMBER(pc88va_state::bios_bank_w) -{ - /* - -x-- ---- ---- ---- SMM (compatibility mode) - ---x ---- ---- ---- GMSP (VRAM drawing Mode) - ---- xxxx ---- ---- SMBC (0xa0000 - 0xdffff RAM bank) - ---- ---- xxxx ---- RBC1 (0xf0000 - 0xfffff ROM bank) - ---- ---- ---- xxxx RBC0 (0xe0000 - 0xeffff ROM bank) - */ - if ((mem_mask&0xffff) == 0xffff) - m_bank_reg = data; - else if ((mem_mask & 0xffff) == 0xff00) - m_bank_reg = (data & 0xff00) | (m_bank_reg & 0x00ff); - else if ((mem_mask & 0xffff) == 0x00ff) - m_bank_reg = (data & 0x00ff) | (m_bank_reg & 0xff00); - - - /* RBC1 */ - { - UINT8 *ROM10 = memregion("rom10")->base(); - - if((m_bank_reg & 0xe0) == 0x00) - membank("rom10_bank")->set_base(&ROM10[(m_bank_reg & 0x10) ? 0x10000 : 0x00000]); - } - - /* RBC0 */ - { - UINT8 *ROM00 = memregion("rom00")->base(); - - membank("rom00_bank")->set_base(&ROM00[(m_bank_reg & 0xf)*0x10000]); // TODO: docs says that only 0 - 5 are used, dunno why ... - } -} - -READ8_MEMBER(pc88va_state::rom_bank_r) -{ - return 0xff; // bit 7 low is va91 rom bank status -} - -READ8_MEMBER(pc88va_state::key_r) -{ - // note row D bit 2 does something at POST ... some kind of test mode? - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", - "KEY4", "KEY5", "KEY6", "KEY7", - "KEY8", "KEY9", "KEYA", "KEYB", - "KEYC", "KEYD", "KEYE", "KEYF" }; - - return ioport(keynames[offset])->read(); -} - -WRITE16_MEMBER(pc88va_state::backupram_wp_1_w) -{ - m_backupram_wp = 1; -} - -WRITE16_MEMBER(pc88va_state::backupram_wp_0_w) -{ - m_backupram_wp = 0; -} - -READ8_MEMBER(pc88va_state::hdd_status_r) -{ - return 0x20; -} - -READ8_MEMBER(pc88va_state::pc88va_fdc_r) -{ - printf("%08x\n",offset); - - switch(offset*2) - { - case 0x00: return 0; // FDC mode register - case 0x02: return 0; // FDC control port 0 - case 0x04: return 0; // FDC control port 1 - /* ---x ---- RDY: (0) Busy (1) Ready */ - case 0x06: // FDC control port 2 - return 0; - } - - return 0xff; -} - -TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_timer) -{ - if(m_fdc_ctrl_2 & 4) // XTMASK - { - machine().device( "pic8259_slave")->ir3_w(0); - machine().device( "pic8259_slave")->ir3_w(1); - } -} - -TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_motor_start_0) -{ - machine().device("upd765:0")->get_device()->mon_w(0); - m_fdc_motor_status[0] = 1; -} - -TIMER_CALLBACK_MEMBER(pc88va_state::pc88va_fdc_motor_start_1) -{ - machine().device("upd765:1")->get_device()->mon_w(0); - m_fdc_motor_status[1] = 1; -} - -void pc88va_state::pc88va_fdc_update_ready(floppy_image_device *, int) -{ - bool ready = m_fdc_ctrl_2 & 0x40; - - floppy_image_device *floppy; - floppy = machine().device("upd765:0")->get_device(); - if(floppy && ready) - ready = floppy->ready_r(); - floppy = machine().device("upd765:1")->get_device(); - if(floppy && ready) - ready = floppy->ready_r(); - - m_fdc->ready_w(ready); -} - -WRITE8_MEMBER(pc88va_state::pc88va_fdc_w) -{ - printf("%08x %02x\n",offset<<1,data); - switch(offset<<1) - { - /* - ---- ---x MODE: FDC op mode (0) Intelligent (1) DMA - */ - case 0x00: // FDC mode register - m_fdc_mode = data & 1; - #if TEST_SUBFDC - m_fdccpu->set_input_line(INPUT_LINE_HALT, (m_fdc_mode) ? ASSERT_LINE : CLEAR_LINE); - #endif - break; - /* - --x- ---- CLK: FDC clock selection (0) 4.8MHz (1) 8 MHz - ---x ---- DS1: Prohibition of the drive selection of FDC (0) Permission (1) Prohibition - ---- xx-- TD1/TD0: Drive 1/0 track density (0) 48 TPI (1) 96 TPI - ---- --xx RV1/RV0: Drive 1/0 mode selection (0) 2D and 2DD mode (1) 2HD mode - */ - case 0x02: // FDC control port 0 - machine().device("upd765:0")->get_device()->set_rpm(data & 0x01 ? 360 : 300); - machine().device("upd765:1")->get_device()->set_rpm(data & 0x02 ? 360 : 300); - - machine().device("upd765")->set_rate(data & 0x20 ? 500000 : 250000); - break; - /* - ---- x--- PCM: ? - ---- --xx M1/M0: Drive 1/0 motor control (0) NOP (1) Change motor status - */ - case 0x04: - if(data & 1) - { - machine().device("upd765:0")->get_device()->mon_w(1); - if(m_fdc_motor_status[0] == 0) - timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_0); - else - m_fdc_motor_status[0] = 0; - } - - if(data & 2) - { - machine().device("upd765:1")->get_device()->mon_w(1); - if(m_fdc_motor_status[1] == 0) - timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_1); - else - m_fdc_motor_status[1] = 0; - } - - break; - /* - x--- ---- FDCRST: FDC Reset - -xx- ---- FDCFRY FRYCEN: FDC force ready control - ---x ---- DMAE: DMA Enable (0) Prohibit DMA (1) Enable DMA - ---- -x-- XTMASK: FDC timer IRQ mask (0) Disable (1) Enable - ---- ---x TTRG: FDC timer trigger (0) FDC timer clearing (1) FDC timer start - */ - case 0x06: - //printf("%02x\n",data); - if(data & 1) - timer_set(attotime::from_msec(100), TIMER_PC88VA_FDC_TIMER); - - if((m_fdc_ctrl_2 & 0x10) != (data & 0x10)) - m_dmac->dreq2_w(1); - - if(data & 0x80) // correct? - machine().device("upd765")->reset(); - - m_fdc_ctrl_2 = data; - - pc88va_fdc_update_ready(NULL, 0); - - break; // FDC control port 2 - } -} - - -READ16_MEMBER(pc88va_state::sysop_r) -{ - UINT8 sys_op; - - sys_op = ioport("SYSOP_SW")->read() & 3; - - return 0xfffc | sys_op; // docs says all the other bits are high -} - -READ16_MEMBER(pc88va_state::screen_ctrl_r) -{ - return m_screen_ctrl_reg; -} - -WRITE16_MEMBER(pc88va_state::screen_ctrl_w) -{ - m_screen_ctrl_reg = data; -} - -TIMER_CALLBACK_MEMBER(pc88va_state::t3_mouse_callback) -{ - if(m_timer3_io_reg & 0x80) - { - machine().device("pic8259_slave")->ir5_w(0); - machine().device("pic8259_slave")->ir5_w(1); - m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3))); - } -} - -WRITE8_MEMBER(pc88va_state::timer3_ctrl_reg_w) -{ - /* - x--- ---- MINTEN (TCU irq enable) - ---- --xx general purpose timer 3 interval (120, 60, 30, 15) - */ - m_timer3_io_reg = data; - - if(data & 0x80) - m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3))); - else - { - machine().device("pic8259_slave")->ir5_w(0); - m_t3_mouse_timer->adjust(attotime::never); - } -} - -WRITE16_MEMBER(pc88va_state::video_pri_w) -{ - COMBINE_DATA(&m_video_pri_reg[offset]); -} - -READ8_MEMBER(pc88va_state::backupram_dsw_r) -{ - UINT16 *knj_ram = (UINT16 *)(memregion("kanji")->base()); - - if(offset == 0) - return knj_ram[(0x50000 + 0x1fc2) / 2] & 0xff; - - return knj_ram[(0x50000 + 0x1fc6) / 2] & 0xff; -} - -WRITE8_MEMBER(pc88va_state::sys_port1_w) -{ - // ... -} - -#if !TEST_SUBFDC -READ8_MEMBER(pc88va_state::no_subfdc_r) -{ - return machine().rand(); -} -#endif - -static ADDRESS_MAP_START( pc88va_io_map, AS_IO, 16, pc88va_state ) - AM_RANGE(0x0000, 0x000f) AM_READ8(key_r,0xffff) // Keyboard ROW reading -// AM_RANGE(0x0010, 0x0010) Printer / Calendar Clock Interface - AM_RANGE(0x0020, 0x0021) AM_NOP // RS-232C - AM_RANGE(0x0030, 0x0031) AM_READWRITE8(backupram_dsw_r,sys_port1_w,0xffff) // 0x30 (R) DSW1 (W) Text Control Port 0 / 0x31 (R) DSW2 (W) System Port 1 -// AM_RANGE(0x0032, 0x0032) (R) ? (W) System Port 2 -// AM_RANGE(0x0034, 0x0034) GVRAM Control Port 1 -// AM_RANGE(0x0035, 0x0035) GVRAM Control Port 2 - AM_RANGE(0x0040, 0x0041) AM_READ(sys_port4_r) // (R) System Port 4 (W) System port 3 (strobe port) - AM_RANGE(0x0044, 0x0045) AM_MIRROR(0x0002) AM_DEVREADWRITE8("ym", ym2203_device, read, write, 0xffff) -// AM_RANGE(0x005c, 0x005c) (R) GVRAM status -// AM_RANGE(0x005c, 0x005f) (W) GVRAM selection -// AM_RANGE(0x0070, 0x0070) ? (*) -// AM_RANGE(0x0071, 0x0071) Expansion ROM select (*) -// AM_RANGE(0x0078, 0x0078) Memory offset increment (*) -// AM_RANGE(0x0080, 0x0081) HDD related - AM_RANGE(0x0082, 0x0083) AM_READ8(hdd_status_r,0x00ff)// HDD control, byte access 7-0 -// AM_RANGE(0x00bc, 0x00bf) d8255 1 -// AM_RANGE(0x00e2, 0x00e3) Expansion RAM selection (*) -// AM_RANGE(0x00e4, 0x00e4) 8214 IRQ control (*) -// AM_RANGE(0x00e6, 0x00e6) 8214 IRQ mask (*) -// AM_RANGE(0x00e8, 0x00e9) ? (*) -// AM_RANGE(0x00ec, 0x00ed) ? (*) - #if TEST_SUBFDC - AM_RANGE(0x00fc, 0x00ff) AM_DEVREADWRITE8("d8255_2", i8255_device, read, write, 0xffff) // d8255 2, FDD - #else - AM_RANGE(0x00fc, 0x00ff) AM_READ8(no_subfdc_r,0xffff) AM_WRITENOP - #endif - - AM_RANGE(0x0100, 0x0101) AM_READWRITE(screen_ctrl_r,screen_ctrl_w) // Screen Control Register -// AM_RANGE(0x0102, 0x0103) Graphic Screen Control Register - AM_RANGE(0x0106, 0x0109) AM_WRITE(video_pri_w) // Palette Control Register (priority) / Direct Color Control Register (priority) -// AM_RANGE(0x010a, 0x010b) Picture Mask Mode Register -// AM_RANGE(0x010c, 0x010d) Color Palette Mode Register -// AM_RANGE(0x010e, 0x010f) Backdrop Color Register -// AM_RANGE(0x0110, 0x0111) Color Code/Plain Mask Register -// AM_RANGE(0x0124, 0x0125) ? (related to Transparent Color of Graphic Screen 0) -// AM_RANGE(0x0126, 0x0127) ? (related to Transparent Color of Graphic Screen 1) -// AM_RANGE(0x012e, 0x012f) ? (related to Transparent Color of Text/Sprite) -// AM_RANGE(0x0130, 0x0137) Picture Mask Parameter - AM_RANGE(0x0142, 0x0143) AM_READWRITE8(idp_status_r,idp_command_w,0x00ff) //Text Controller (IDP) - (R) Status (W) command - AM_RANGE(0x0146, 0x0147) AM_WRITE8(idp_param_w,0x00ff) //Text Controller (IDP) - (R/W) Parameter -// AM_RANGE(0x0148, 0x0149) Text control port 1 -// AM_RANGE(0x014c, 0x014f) ? CG Port - AM_RANGE(0x0150, 0x0151) AM_READ(sysop_r) // System Operational Mode - AM_RANGE(0x0152, 0x0153) AM_READWRITE(bios_bank_r,bios_bank_w) // Memory Map Register -// AM_RANGE(0x0154, 0x0155) Refresh Register (wait states) - AM_RANGE(0x0156, 0x0157) AM_READ8(rom_bank_r,0x00ff) // ROM bank status -// AM_RANGE(0x0158, 0x0159) Interruption Mode Modification -// AM_RANGE(0x015c, 0x015f) NMI mask port (strobe port) - AM_RANGE(0x0160, 0x016f) AM_DEVREADWRITE8("dmac", am9517a_device, read, write, 0xffff) // DMA Controller - AM_RANGE(0x0184, 0x0187) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x0188, 0x018b) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff) // ICU, also controls 8214 emulation -// AM_RANGE(0x0190, 0x0191) System Port 5 -// AM_RANGE(0x0196, 0x0197) Keyboard sub CPU command port - AM_RANGE(0x0198, 0x0199) AM_WRITE(backupram_wp_1_w) //Backup RAM write inhibit - AM_RANGE(0x019a, 0x019b) AM_WRITE(backupram_wp_0_w) //Backup RAM write permission - AM_RANGE(0x01a0, 0x01a7) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0x00ff)// vTCU (timer counter unit) - AM_RANGE(0x01a8, 0x01a9) AM_WRITE8(timer3_ctrl_reg_w,0x00ff) // General-purpose timer 3 control port - AM_RANGE(0x01b0, 0x01b7) AM_READWRITE8(pc88va_fdc_r,pc88va_fdc_w,0x00ff)// FDC related (765) - AM_RANGE(0x01b8, 0x01bb) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff) -// AM_RANGE(0x01c0, 0x01c1) ? - AM_RANGE(0x01c6, 0x01c7) AM_WRITENOP // ??? - AM_RANGE(0x01c8, 0x01cf) AM_DEVREADWRITE8("d8255_3", i8255_device, read, write,0xff00) //i8255 3 (byte access) -// AM_RANGE(0x01d0, 0x01d1) Expansion RAM bank selection - AM_RANGE(0x0200, 0x021f) AM_RAM // Frame buffer 0 control parameter - AM_RANGE(0x0220, 0x023f) AM_RAM // Frame buffer 1 control parameter - AM_RANGE(0x0240, 0x025f) AM_RAM // Frame buffer 2 control parameter - AM_RANGE(0x0260, 0x027f) AM_RAM // Frame buffer 3 control parameter - AM_RANGE(0x0300, 0x033f) AM_RAM_WRITE(palette_ram_w) AM_SHARE("palram") // Palette RAM (xBBBBxRRRRxGGGG format) - -// AM_RANGE(0x0500, 0x05ff) GVRAM -// AM_RANGE(0x1000, 0xfeff) user area (???) - AM_RANGE(0xff00, 0xffff) AM_NOP // CPU internal use -ADDRESS_MAP_END -// (*) are specific N88 V1 / V2 ports - -TIMER_CALLBACK_MEMBER(pc88va_state::pc8801fd_upd765_tc_to_zero) -{ - machine().device("upd765")->tc_w(false); -} - -/* FDC subsytem CPU */ -#if TEST_SUBFDC -static ADDRESS_MAP_START( pc88va_z80_map, AS_PROGRAM, 8, pc88va_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_RAM -ADDRESS_MAP_END - -READ8_MEMBER(pc88va_state::upd765_tc_r) -{ - machine().device("upd765")->tc_w(true); - timer_set(attotime::from_usec(50), TIMER_PC8801FD_UPD765_TC_TO_ZERO); - return 0; -} - -WRITE8_MEMBER(pc88va_state::fdc_irq_vector_w) -{ - m_fdc_irq_opcode = data; -} - -WRITE8_MEMBER(pc88va_state::upd765_mc_w) -{ - machine().device("upd765:0")->get_device()->mon_w(!(data & 1)); - machine().device("upd765:1")->get_device()->mon_w(!(data & 2)); -} - -static ADDRESS_MAP_START( pc88va_z80_io_map, AS_IO, 8, pc88va_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf0, 0xf0) AM_WRITE(fdc_irq_vector_w) // Interrupt Opcode Port -// AM_RANGE(0xf4, 0xf4) // Drive Control Port - AM_RANGE(0xf8, 0xf8) AM_READWRITE(upd765_tc_r,upd765_mc_w) // (R) Terminal Count Port (W) Motor Control Port - AM_RANGE(0xfa, 0xfb) AM_DEVICE("upd765", upd765a_device, map ) - AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("d8255_2s", i8255_device, read, write) -ADDRESS_MAP_END -#endif - -/* TODO: active low or active high? */ -static INPUT_PORTS_START( pc88va ) - PORT_START("KEY0") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - - PORT_START("KEY1") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("= (PAD)") // PORT_CODE(KEYCODE_EQUAL_PAD) PORT_CHAR(UCHAR_MAMEKEY(EQUAL_PAD)) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", (PAD)") // PORT_CODE(KEYCODE_EQUAL_PAD) PORT_CHAR(UCHAR_MAMEKEY(EQUAL_PAD)) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". (PAD)") // PORT_CODE(KEYCODE_EQUAL_PAD) PORT_CHAR(UCHAR_MAMEKEY(EQUAL_PAD)) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RETURN (PAD)") //PORT_CODE(KEYCODE_RETURN_PAD) PORT_CHAR(UCHAR_MAMEKEY(RETURN_PAD)) - - PORT_START("KEY2") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@") // PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("KEY3") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("KEY4") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START("KEY5") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("\xC2\xA5") /* Yen */ - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^") - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") - - PORT_START("KEY6") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("KEY7") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(": *") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("; +") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", <") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(". >") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ ?") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ ?") //PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("KEY8") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CLR") // PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) /* Up */ - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) /* Right */ - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("INSDEL") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - - PORT_START("KEY9") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("STOP") // PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1 (mirror)") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2 (mirror)") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3 (mirror)") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4 (mirror)") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5 (mirror)") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SPACES") // PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - - PORT_START("KEYA") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) /* Down */ - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) /* Left */ - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("HELP") // PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("COPY") // PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("- (mirror)") // PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") // PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - - PORT_START("KEYB") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_PGUP) /* Roll Up */ - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_PGDN) /* Roll Down */ - PORT_BIT(0xfc,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYC") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - - PORT_START("KEYD") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) // Conversion? - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) // Decision? - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - - /* TODO: I don't understand the meaning of several of these */ - PORT_START("KEYE") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) - PORT_BIT(0xc0,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("KEYF") - PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED) - - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x01, "CRT Mode" ) - PORT_DIPSETTING( 0x01, "15.7 KHz" ) - PORT_DIPSETTING( 0x00, "24.8 KHz" ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("SPEED_SW") - PORT_DIPNAME( 0x01, 0x01, "Speed Mode" ) - PORT_DIPSETTING( 0x01, "H Mode" ) - PORT_DIPSETTING( 0x00, "S Mode" ) - - PORT_START("SYSOP_SW") - PORT_DIPNAME( 0x03, 0x01, "System Operational Mode" ) -// PORT_DIPSETTING( 0x00, "Reserved" ) - PORT_DIPSETTING( 0x01, "N88 V2 Mode" ) - PORT_DIPSETTING( 0x02, "N88 V1 Mode" ) -// PORT_DIPSETTING( 0x03, "???" ) -INPUT_PORTS_END - -static const gfx_layout pc88va_chars_8x8 = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static const gfx_layout pc88va_chars_16x16 = -{ - 16,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, - 16*16 -}; - -/* decoded for debugging purpose, this will be nuked in the end... */ -static GFXDECODE_START( pc88va ) - GFXDECODE_ENTRY( "kanji", 0x00000, pc88va_chars_8x8, 0, 1 ) - GFXDECODE_ENTRY( "kanji", 0x00000, pc88va_chars_16x16, 0, 1 ) -GFXDECODE_END - -READ8_MEMBER(pc88va_state::cpu_8255_c_r) -{ - return m_i8255_1_pc >> 4; -} - -WRITE8_MEMBER(pc88va_state::cpu_8255_c_w) -{ - m_i8255_0_pc = data; -} - -READ8_MEMBER(pc88va_state::fdc_8255_c_r) -{ - return m_i8255_0_pc >> 4; -} - -WRITE8_MEMBER(pc88va_state::fdc_8255_c_w) -{ - m_i8255_1_pc = data; -} - -READ8_MEMBER(pc88va_state::r232_ctrl_porta_r) -{ - UINT8 sw5, sw4, sw3, sw2,speed_sw; - - speed_sw = (ioport("SPEED_SW")->read() & 1) ? 0x20 : 0x00; - sw5 = (ioport("DSW")->read() & 0x10); - sw4 = (ioport("DSW")->read() & 0x08); - sw3 = (ioport("DSW")->read() & 0x04); - sw2 = (ioport("DSW")->read() & 0x02); - - return 0xc1 | sw5 | sw4 | sw3 | sw2 | speed_sw; -} - -READ8_MEMBER(pc88va_state::r232_ctrl_portb_r) -{ - UINT8 xsw1; - - xsw1 = (ioport("DSW")->read() & 1) ? 0 : 8; - - return 0xf7 | xsw1; -} - -READ8_MEMBER(pc88va_state::r232_ctrl_portc_r) -{ - return 0xff; -} - -WRITE8_MEMBER(pc88va_state::r232_ctrl_porta_w) -{ - // ... -} - -WRITE8_MEMBER(pc88va_state::r232_ctrl_portb_w) -{ - // ... -} - -WRITE8_MEMBER(pc88va_state::r232_ctrl_portc_w) -{ - // ... -} - -READ8_MEMBER(pc88va_state::get_slave_ack) -{ - if (offset==7) { // IRQ = 7 - return machine().device( "pic8259_slave")->acknowledge(); - } - return 0x00; -} - -void pc88va_state::machine_start() -{ - m_t3_mouse_timer = timer_alloc(TIMER_T3_MOUSE_CALLBACK); - m_t3_mouse_timer->adjust(attotime::never); - floppy_image_device *floppy; - floppy = machine().device("upd765:0")->get_device(); - if(floppy) - floppy->setup_ready_cb(floppy_image_device::ready_cb(FUNC(pc88va_state::pc88va_fdc_update_ready), this)); - - floppy = machine().device("upd765:1")->get_device(); - if(floppy) - floppy->setup_ready_cb(floppy_image_device::ready_cb(FUNC(pc88va_state::pc88va_fdc_update_ready), this)); - - machine().device("upd765:0")->get_device()->set_rpm(300); - machine().device("upd765:1")->get_device()->set_rpm(300); - machine().device("upd765")->set_rate(250000); -} - -void pc88va_state::machine_reset() -{ - UINT8 *ROM00 = memregion("rom00")->base(); - UINT8 *ROM10 = memregion("rom10")->base(); - - membank("rom10_bank")->set_base(&ROM10[0x00000]); - membank("rom00_bank")->set_base(&ROM00[0x00000]); - - m_bank_reg = 0x4100; - m_backupram_wp = 1; - - /* default palette */ - { - UINT8 i; - for(i=0;i<32;i++) - m_palette->set_pen_color(i,pal1bit((i & 2) >> 1),pal1bit((i & 4) >> 2),pal1bit(i & 1)); - } - - m_tsp.tvram_vreg_offset = 0; - - m_fdc_mode = 0; - m_fdc_irq_opcode = 0x00; //0x7f ld a,a ! - - #if TEST_SUBFDC - m_fdccpu->set_input_line_vector(0, 0); - #endif - - m_fdc_motor_status[0] = 0; - m_fdc_motor_status[1] = 0; -} - -INTERRUPT_GEN_MEMBER(pc88va_state::pc88va_vrtc_irq) -{ - machine().device("pic8259_master")->ir2_w(0); - machine().device("pic8259_master")->ir2_w(1); -} - -WRITE_LINE_MEMBER(pc88va_state::pc88va_pit_out0_changed) -{ - if(state) - { - machine().device("pic8259_master")->ir0_w(0); - machine().device("pic8259_master")->ir0_w(1); - } -} - -WRITE_LINE_MEMBER( pc88va_state::fdc_drq ) -{ - printf("%02x DRQ\n",state); - m_dmac->dreq2_w(state); -} - -WRITE_LINE_MEMBER( pc88va_state::fdc_irq ) -{ - if(m_fdc_mode && state) - { - //printf("%d\n",state); - machine().device( "pic8259_slave")->ir3_w(0); - machine().device( "pic8259_slave")->ir3_w(1); - } - #if TEST_SUBFDC - else - m_fdccpu->set_input_line(0, HOLD_LINE); - #endif -} - -WRITE_LINE_MEMBER(pc88va_state::pc88va_hlda_w) -{ -// m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - m_dmac->hack_w(state); - -// printf("%02x HLDA\n",state); -} - -WRITE_LINE_MEMBER( pc88va_state::pc88va_tc_w ) -{ - /* floppy terminal count */ - m_fdc->tc_w(state); - -// printf("TC %02x\n",state); -} - - -READ8_MEMBER(pc88va_state::fdc_dma_r) -{ - printf("R DMA\n"); - return m_fdc->dma_r(); -} - -WRITE8_MEMBER(pc88va_state::fdc_dma_w) -{ - printf("W DMA %08x\n",data); - m_fdc->dma_w(data); -} - -FLOPPY_FORMATS_MEMBER( pc88va_state::floppy_formats ) - FLOPPY_XDF_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( pc88va_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -READ8_MEMBER(pc88va_state::dma_memr_cb) -{ -printf("%08x\n",offset); - return 0; -} - -WRITE8_MEMBER(pc88va_state::dma_memw_cb) -{ -printf("%08x %02x\n",offset,data); -} - - -static MACHINE_CONFIG_START( pc88va, pc88va_state ) - - MCFG_CPU_ADD("maincpu", V30, 8000000) /* 8 MHz */ - MCFG_CPU_PROGRAM_MAP(pc88va_map) - MCFG_CPU_IO_MAP(pc88va_io_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc88va_state, pc88va_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - -#if TEST_SUBFDC - MCFG_CPU_ADD("fdccpu", Z80, 8000000) /* 8 MHz */ - MCFG_CPU_PROGRAM_MAP(pc88va_z80_map) - MCFG_CPU_IO_MAP(pc88va_z80_io_map) - - MCFG_QUANTUM_PERFECT_CPU("maincpu") -#endif - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(pc88va_state, screen_update_pc88va) - - MCFG_PALETTE_ADD("palette", 32) -// MCFG_PALETTE_INIT_OWNER(pc88va_state, pc8801 ) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc88va ) - - MCFG_DEVICE_ADD("d8255_2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(DEVREAD8("d8255_2s", i8255_device, pb_r)) - MCFG_I8255_IN_PORTB_CB(DEVREAD8("d8255_2s", i8255_device, pa_r)) - MCFG_I8255_IN_PORTC_CB(READ8(pc88va_state, cpu_8255_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc88va_state, cpu_8255_c_w)) - - MCFG_DEVICE_ADD("d8255_3", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pc88va_state, r232_ctrl_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pc88va_state, r232_ctrl_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pc88va_state, r232_ctrl_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pc88va_state, r232_ctrl_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pc88va_state, r232_ctrl_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc88va_state, r232_ctrl_portc_w)) - - MCFG_DEVICE_ADD("d8255_2s", I8255, 0) - MCFG_I8255_IN_PORTA_CB(DEVREAD8("d8255_2", i8255_device, pb_r)) - MCFG_I8255_IN_PORTB_CB(DEVREAD8("d8255_2", i8255_device, pa_r)) - MCFG_I8255_IN_PORTC_CB(READ8(pc88va_state, fdc_8255_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc88va_state, fdc_8255_c_w)) - - MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(pc88va_state,get_slave_ack) ) - - MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL ) - - MCFG_DEVICE_ADD("dmac", AM9517A, 8000000) /* ch2 is FDC, ch0/3 are "user". ch1 is unused */ - MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(pc88va_state, pc88va_hlda_w)) - MCFG_AM9517A_OUT_EOP_CB(WRITELINE(pc88va_state, pc88va_tc_w)) - MCFG_AM9517A_IN_IOR_2_CB(READ8(pc88va_state, fdc_dma_r)) - MCFG_AM9517A_OUT_IOW_2_CB(WRITE8(pc88va_state, fdc_dma_w)) - MCFG_AM9517A_IN_MEMR_CB(READ8(pc88va_state, dma_memr_cb)) - MCFG_AM9517A_OUT_MEMW_CB(WRITE8(pc88va_state, dma_memw_cb)) - - MCFG_UPD765A_ADD("upd765", false, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pc88va_state, fdc_irq)) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pc88va_state, fdc_drq)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", pc88va_floppies, "525hd", pc88va_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", pc88va_floppies, "525hd", pc88va_state::floppy_formats) - MCFG_SOFTWARE_LIST_ADD("disk_list","pc88va") - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(8000000) /* general purpose timer 1 */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(pc88va_state, pc88va_pit_out0_changed)) - MCFG_PIT8253_CLK1(8000000) /* BEEP frequency setting */ - MCFG_PIT8253_CLK2(8000000) /* RS232C baud rate setting */ - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ym", YM2203, 3993600) //unknown clock / divider - MCFG_SOUND_ROUTE(0, "mono", 0.25) - MCFG_SOUND_ROUTE(1, "mono", 0.25) - MCFG_SOUND_ROUTE(2, "mono", 0.50) - MCFG_SOUND_ROUTE(3, "mono", 0.50) -MACHINE_CONFIG_END - - -ROM_START( pc88va2 ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x100000, "fdccpu", ROMREGION_ERASEFF ) - ROM_LOAD( "vasubsys.rom", 0x0000, 0x2000, CRC(08962850) SHA1(a9375aa480f85e1422a0e1385acb0ea170c5c2e0) ) - - ROM_REGION( 0x100000, "rom00", ROMREGION_ERASEFF ) // 0xe0000 - 0xeffff - ROM_LOAD( "varom00_va2.rom", 0x00000, 0x80000, CRC(98c9959a) SHA1(bcaea28c58816602ca1e8290f534360f1ca03fe8) ) - ROM_LOAD( "varom08_va2.rom", 0x80000, 0x20000, CRC(eef6d4a0) SHA1(47e5f89f8b0ce18ff8d5d7b7aef8ca0a2a8e3345) ) - - ROM_REGION( 0x20000, "rom10", 0 ) // 0xf0000 - 0xfffff - ROM_LOAD( "varom1_va2.rom", 0x00000, 0x20000, CRC(7e767f00) SHA1(dd4f4521bfbb068f15ab3bcdb8d47c7d82b9d1d4) ) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x80000, "kanji", ROMREGION_ERASEFF ) - ROM_LOAD( "vafont_va2.rom", 0x00000, 0x50000, BAD_DUMP CRC(b40d34e4) SHA1(a0227d1fbc2da5db4b46d8d2c7e7a9ac2d91379f) ) // should be splitted - - ROM_REGION( 0x80000, "dictionary", 0 ) - ROM_LOAD( "vadic_va2.rom", 0x00000, 0x80000, CRC(a6108f4d) SHA1(3665db538598abb45d9dfe636423e6728a812b12) ) - - ROM_REGION( 0x10000, "tvram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x40000, "gvram", ROMREGION_ERASE00 ) -ROM_END - -ROM_START( pc88va ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x100000, "fdccpu", ROMREGION_ERASEFF ) - ROM_LOAD( "vasubsys.rom", 0x0000, 0x2000, CRC(08962850) SHA1(a9375aa480f85e1422a0e1385acb0ea170c5c2e0) ) - - ROM_REGION( 0x100000, "rom00", ROMREGION_ERASEFF ) // 0xe0000 - 0xeffff - ROM_LOAD( "varom00.rom", 0x00000, 0x80000, CRC(8a853b00) SHA1(1266ba969959ff25433ecc900a2caced26ef1a9e)) - ROM_LOAD( "varom08.rom", 0x80000, 0x20000, CRC(154803cc) SHA1(7e6591cd465cbb35d6d3446c5a83b46d30fafe95)) - - ROM_REGION( 0x20000, "rom10", 0 ) // 0xf0000 - 0xfffff - ROM_LOAD( "varom1.rom", 0x00000, 0x20000, CRC(0783b16a) SHA1(54536dc03238b4668c8bb76337efade001ec7826)) - - /* No idea of the proper size: it has never been dumped */ - ROM_REGION( 0x2000, "audiocpu", 0) - ROM_LOAD( "soundbios.rom", 0x0000, 0x2000, NO_DUMP ) - - ROM_REGION( 0x80000, "kanji", ROMREGION_ERASEFF ) - ROM_LOAD( "vafont.rom", 0x0000, 0x50000, BAD_DUMP CRC(faf7c466) SHA1(196b3d5b7407cb4f286ffe5c1e34ebb1f6905a8c)) // should be splitted - - ROM_REGION( 0x80000, "dictionary", 0 ) - ROM_LOAD( "vadic.rom", 0x0000, 0x80000, CRC(f913c605) SHA1(5ba1f3578d0aaacdaf7194a80e6d520c81ae55fb)) - - ROM_REGION( 0x10000, "tvram", ROMREGION_ERASE00 ) - - ROM_REGION( 0x40000, "gvram", ROMREGION_ERASE00 ) -ROM_END - - - - -COMP( 1987, pc88va, 0, 0, pc88va, pc88va, driver_device, 0, "Nippon Electronic Company", "PC-88VA", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1988, pc88va2, pc88va, 0, pc88va, pc88va, driver_device, 0, "Nippon Electronic Company", "PC-88VA2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -//COMP( 1988, pc88va3, pc88va, 0, pc88va, pc88va, driver_device, 0, "Nippon Electronic Company", "PC-88VA3", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c deleted file mode 100644 index 739cbe37a10..00000000000 --- a/src/mess/drivers/pc9801.c +++ /dev/null @@ -1,3886 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese,Carl -/*************************************************************************************************** - - PC-9801 (c) 1981 NEC - - driver by Angelo Salese - - TODO: - - proper 8251 uart hook-up on keyboard - - SASI /SCSI support; - - Write a PC80S31K device (also used on PC-8801 and PC-88VA, it's the FDC + Z80 sub-system); - - Finish DIP-Switches support - - text scrolling - - GRCG+ - - rewrite using slot devices - - some later SWs put "Invalid command byte 05" (Absolutely Mahjong on Epson logo) - - investigate on POR bit - - test 2dd more - - TODO (PC-9801RS): - - extra features; - - keyboard shift doesn't seem to disable properly; - - clean-up duplicate code; - - TODO (PC-9821): - - fix CPU for some clones; - - "cache error" - - undumped IDE ROM, kludged to work - - Compatibility is untested; - - TODO: (PC-486MU) - - Tries to read port C of i8255_sys (-> 0x35) at boot without setting up the control - port. This causes a jump to invalid program area; - - Dies on ARTIC check; - - Presumably one ROM is undumped? - - TODO: (PC-9821AP) - - No way to exit the initial loop. Code looks broken/bad dump? - - floppy issues TODO (certain fail) - - Unsupported disk types: *.nfd, *.fdd, *.nhd - - 46 Okunen Monogatari - The Shinkaron - - AD&D Champions of Krynn - - AI Shougi (asserts upon loading, 3'5 image?) - - Aki no Tsukasa no Fushigi no Kabe (works in PC-9801RS only) - - Aoki Ookami no Shiroki Mejika - Gengis Khan - - Arcshu - - Arcus 2 - - Art Jigsaw - - Atlantia (disk swap?) - - Azusa 108 Jimusho - - Bacta 2 - - BattleTech (disk swap?) - - Bay City Elegy (disk swap?) - - Beast (keeps reading command sense) - - Beast 2 - - Bells Avenue (disk swap?) - - Bible Master 2 (at new game loading) - - Birdy World - - - Bokosuka Wars - - Jangou 2: floppy fails to load after the title screen; - - List of per-game TODO: - - 38 Man Kilo no Kokuu: doesn't seem possible to skip the intro? - - 4D Boxing: inputs are unresponsive - - A Ressha de Ikou 2: missing text (PC-9801RS only); - - Absolutely Mahjong: Transitions are too fast. - - Agumix Selects!: needs GDC = 5 MHz, interlace doesn't work properly; - - Alice no Yakata: doesn't set bitmap interlace properly, can't do disk swaps via the File Manager; - - Anniversary - Memories of Summer: thinks that a button is pressed; - - Another Genesis: fails loading; - - Apple Club 1: how to pass an hand? - - Arctic: keyboard doesn't work? - - Arcus 3: moans with a JP message "not enough memory (needs 640kb to start)"; - - Armored Flagship Atragon: needs HDD install - - Arquephos: needs extra sound board(s)? - - Asoko no Koufuku: black screen with BGM, waits at 0x225f6; - - Band-Kun: (how to run this without installing?) - - Battle Chess: wants some dip-switches to be on in DSW4, too slow during IA thinking? - - Bishoujo Audition: Moans with a "(program) ended. remove the floppy disk and turn off the poewr." - - Bishoujo Hunter ZX: Doesn't color cycle at intro (seems stuck?), doesn't clear text selection at new game screen; - - Bishoujo Shanshinkan: has white rectangles all over the place; - - Bishoujo Tsuushin: hangs with a beep while writing some intro text; - - - Bomber Quest: beeps when speech is supposed to be played (0->1 to i/o port 0xfe8e?) - - Deflektor: no sound, moans about a DIP-sw during loading, very slow on non-pc9801rs machines; - - Dragon Buster: slight issue with window masking; - - Far Side Moon: doesn't detect sound board (tied to 0x00ec ports) - - Jan Borg Suzume: gets stuck at a pic8259 read; - - Karateka: no sound? - - Lovely Horror: Doesn't show kanji, tries to read it thru the 0xa9 port; - - Madou Monogatari 1/2/3: doesn't display bitmap gfxs during gameplay; - - Quarth: title screen is broken after first attract play; - - Princess Maker 2: mouse is buggy; - - Princess Maker 2: screen transitions are very ugly (btanb?) - - Puyo Puyo: beeps out when it's supposed to play samples, Not supposed to use ADPCM, is it a PIT issue? - - Puzznic: trips illegal irq 0x41 (?), prints an error on screen. (PC-9801RS only, writes an 1 to 0x69d2f for whatever reason, almost surely a btanb) - - Runner's High: wrong double height on the title screen; - - Sokoban Perfect: hangs at title screen, after loading the menu; - - Sorcerian, Twilight Zone 3: Fails initial booting, issue with 2dd irq? - - The Incredible Machine: hangs at main menu (YM mis-fires irq?) - - Uchiyama Aki no Chou Bangai: keyboard irq is fussy (sometimes it doesn't register a key press); - - Uno: has minor EGC gfx bugs; - - Windows 2: EGC drawing issue (byte wide writes?) - - per-game TODO (PC-9821): - - Battle Skin Panic: gfx bugs at the Gainax logo, it crashes after it; - - Policenauts: EMS error at boot; - - Notes: - - Animahjong V3 makes advantage of the possibility of installing 2 sound boards, where SFX and BGMs are played on separate chips. - - Apple Club 1/2 needs data disks to load properly; - - Beast Lord: needs a titan.fnt, in MS-DOS - - To deprotect BASIC modules set 0xcd7 in ram to 0 - -======================================================================================== - - This series features a huge number of models released between 1982 and 1997. They - were not IBM PC-compatible, but they had similar hardware (and software: in the - 1990s, they run MS Windows as OS) - - Models: - - | CPU | RAM | Drives | CBus| Release | - PC-9801 | 8086 @ 5 | 128 KB | - | 6 | 1982/10 | - PC-9801F1 | 8086-2 @ 5/8 | 128 KB | 5"2DDx1 | 4 | 1983/10 | - PC-9801F2 | 8086-2 @ 5/8 | 128 KB | 5"2DDx2 | 4 | 1983/10 | - PC-9801E | 8086-2 @ 5/8 | 128 KB | - | 6 | 1983/11 | - PC-9801F3 | 8086-2 @ 5/8 | 256 KB | 5"2DDx1, 10M SASI HDD | 2 | 1984/10 | - PC-9801M2 | 8086-2 @ 5/8 | 256 KB | 5"2HDx2 | 4 | 1984/11 | - PC-9801M3 | 8086-2 @ 5/8 | 256 KB | 5"2HDx1, 20M SASI HDD | 3 | 1985/02 | - PC-9801U2 | V30 @ 8 | 128 KB | 3.5"2HDx2 | 2 | 1985/05 | - PC-98XA1 | 80286 @ 8 | 512 KB | - | 6 | 1985/05 | - PC-98XA2 | 80286 @ 8 | 512 KB | 5"2DD/2HDx2 | 6 | 1985/05 | - PC-98XA3 | 80286 @ 8 | 512 KB | 5"2DD/2HDx1, 20M SASI HDD | 6 | 1985/05 | - PC-9801VF2 | V30 @ 8 | 384 KB | 5"2DDx2 | 4 | 1985/07 | - PC-9801VM0 | V30 @ 8/10 | 384 KB | - | 4 | 1985/07 | - PC-9801VM2 | V30 @ 8/10 | 384 KB | 5"2DD/2HDx2 | 4 | 1985/07 | - PC-9801VM4 | V30 @ 8/10 | 384 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1985/10 | - PC-98XA11 | 80286 @ 8 | 512 KB | - | 6 | 1986/05 | - PC-98XA21 | 80286 @ 8 | 512 KB | 5"2DD/2HDx2 | 6 | 1986/05 | - PC-98XA31 | 80286 @ 8 | 512 KB | 5"2DD/2HDx1, 20M SASI HDD | 6 | 1986/05 | - PC-9801UV2 | V30 @ 8/10 | 384 KB | 3.5"2DD/2HDx2 | 2 | 1986/05 | - PC-98LT1 | V50 @ 8 | 384 KB | 3.5"2DD/2HDx1 | 0 | 1986/11 | - PC-98LT2 | V50 @ 8 | 384 KB | 3.5"2DD/2HDx1 | 0 | 1986/11 | - PC-9801VM21 | V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 4 | 1986/11 | - PC-9801VX0 | 80286 @ 8 & V30 @ 8/10 | 640 KB | - | 4 | 1986/11 | - PC-9801VX2 | 80286 @ 8 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 4 | 1986/11 | - PC-9801VX4 | 80286 @ 8 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1986/11 | - PC-9801VX4/WN | 80286 @ 8 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1986/11 | - PC-98XL1 | 80286 @ 8 & V30 @ 8/10 | 1152 KB | - | 4 | 1986/12 | - PC-98XL2 | 80286 @ 8 & V30 @ 8/10 | 1152 KB | 5"2DD/2HDx2 | 4 | 1986/12 | - PC-98XL4 | 80286 @ 8 & V30 @ 8/10 | 1152 KB | 5"2DD/2HDx1, 20M SASI HDD | 4 | 1986/12 | - PC-9801VX01 | 80286-10 @ 8/10 & V30 @ 8/10 | 640 KB | - | 4 | 1987/06 | - PC-9801VX21 | 80286-10 @ 8/10 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 4 | 1987/06 | - PC-9801VX41 | 80286-10 @ 8/10 & V30 @ 8/10 | 640 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1987/06 | - PC-9801UV21 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1987/06 | - PC-98XL^2 | i386DX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1987/10 | - PC-98LT11 | V50 @ 8 | 640 KB | 3.5"2DD/2HDx1 | 0 | 1987/10 | - PC-98LT21 | V50 @ 8 | 640 KB | 3.5"2DD/2HDx1 | 0 | 1987/10 | - PC-9801UX21 | 80286-10 @ 10 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 3 | 1987/10 | - PC-9801UX41 | 80286-10 @ 10 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 20M SASI HDD | 3 | 1987/10 | - PC-9801LV21 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 0 | 1988/03 | - PC-9801CV21 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1988/03 | - PC-9801UV11 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1988/03 | - PC-9801RA2 | i386DX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1988/07 | - PC-9801RA5 | i386DX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1988/07 | - PC-9801RX2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1988/07 | - PC-9801RX4 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1988/07 | - PC-98LT22 | V50 @ 8 | 640 KB | 3.5"2DD/2HDx1 | 0 | 1988/11 | - PC-98LS2 | i386SX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 0 | 1988/11 | - PC-98LS5 | i386SX-16 @ 16 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 0 | 1988/11 | - PC-9801VM11 | V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 4 | 1988/11 | - PC-9801LV22 | V30 @ 8/10 | 640 KB | 3.5"2DD/2HDx2 | 0 | 1989/01 | - PC-98RL2 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1989/02 | - PC-98RL5 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1989/02 | - PC-9801EX2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 3 | 1989/04 | - PC-9801EX4 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 20M SASI HDD | 3 | 1989/04 | - PC-9801ES2 | i386SX-16 @ 16 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2 | 3 | 1989/04 | - PC-9801ES5 | i386SX-16 @ 16 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 3 | 1989/04 | - PC-9801LX2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 0 | 1989/04 | - PC-9801LX4 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 20M SASI HDD | 0 | 1989/04 | - PC-9801LX5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 0 | 1989/06 | - PC-98DO | V30 @ 8/10 | 640 KB | 5"2DD/2HDx2 | 1 | 1989/06 | - PC-9801LX5C | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 0 | 1989/06 | - PC-9801RX21 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1989/10 | - PC-9801RX51 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1989/10 | - PC-9801RA21 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1989/11 | - PC-9801RA51 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1989/11 | - PC-9801RS21 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1989/11 | - PC-9801RS51 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1989/11 | - PC-9801N | V30 @ 10 | 640 KB | 3.5"2DD/2HDx1 | 0 | 1989/11 | - PC-9801TW2 | i386SX-20 @ 20 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1990/02 | - PC-9801TW5 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1990/02 | - PC-9801TS5 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1990/06 | - PC-9801NS | i386SX-12 @ 12 | 1.6 MB | 3.5"2DD/2HDx1 | 0 | 1990/06 | - PC-9801TF5 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1990/07 | - PC-9801NS-20 | i386SX-12 @ 12 | 1.6 MB | 3.5"2DD/2HDx1, 20M SASI HDD | 0 | 1990/09 | - PC-98RL21 | i386DX-20 @ 20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1990/09 | - PC-98RL51 | i386DX-20 @ 20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx1, 40M SASI HDD | 4 | 1990/09 | - PC-98DO+ | V33A @ 8/16 | 640 KB | 5"2DD/2HDx2 | 1 | 1990/10 | - PC-9801DX2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1990/11 | - PC-9801DX/U2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 4 | 1990/11 | - PC-9801DX5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1990/11 | - PC-9801DX/U5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 4 | 1990/11 | - PC-9801NV | V30HL @ 8/16 | 1.6 MB | 3.5"2DD/2HDx1 | 0 | 1990/11 | - PC-9801DS2 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 5"2DD/2HDx2 | 4 | 1991/01 | - PC-9801DS/U2 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 4 | 1991/01 | - PC-9801DS5 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1991/01 | - PC-9801DS/U5 | i386SX-16 @ 16 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 4 | 1991/01 | - PC-9801DA2 | i386DX-20 @ 16/20 & V30 @ 8 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1991/01 | - PC-9801DA/U2 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2 | 4 | 1991/01 | - PC-9801DA5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 40M SASI HDD | 4 | 1991/01 | - PC-9801DA/U5 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 4 | 1991/01 | - PC-9801DA7 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 5"2DD/2HDx2, 100M SCSI HDD | 4 | 1991/02 | - PC-9801DA/U7 | 80286-12 @ 10/12 & V30 @ 8 | 640 KB | 3.5"2DD/2HDx2, 100M SCSI HDD | 4 | 1991/02 | - PC-9801UF | V30 @ 8/16 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1991/02 | - PC-9801UR | V30 @ 8/16 | 640 KB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 2 | 1991/02 | - PC-9801UR/20 | V30 @ 8/16 | 640 KB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 20M SASI HDD | 2 | 1991/02 | - PC-9801NS/E | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1991/06 | - PC-9801NS/E20 | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 20M SASI HDD | 0 | 1991/06 | - PC-9801NS/E40 | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1991/06 | - PC-9801TW7 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 100M SCSI HDD | 2 | 1991/07 | - PC-9801TF51 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1991/07 | - PC-9801TF71 | i386SX-20 @ 20 & V30 @ 8 | 1.6 MB | 3.5"2DD/2HDx2, 100M SCSI HDD | 2 | 1991/07 | - PC-9801NC | i386SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1991/10 | - PC-9801NC40 | i386SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1991/10 | - PC-9801CS2 | i386SX-16 @ 16 | 640 KB | 3.5"2DD/2HDx2 | 2 | 1991/10 | - PC-9801CS5 | i386SX-16 @ 16 | 640 KB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1991/10 | - PC-9801CS5/W | i386SX-16 @ 16 | 3.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1991/11 | - PC-98GS1 | i386SX-20 @ 20 & V30 @ 8 | 2.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 3 | 1991/11 | - PC-98GS2 | i386SX-20 @ 20 & V30 @ 8 | 2.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD, 1xCD-ROM | 3 | 1991/11 | - PC-9801FA2 | i486SX-16 @ 16 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1992/01 | - PC-9801FA/U2 | i486SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2 | 4 | 1992/01 | - PC-9801FA5 | i486SX-16 @ 16 | 1.6 MB | 5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/01 | - PC-9801FA/U5 | i486SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/01 | - PC-9801FA7 | i486SX-16 @ 16 | 1.6 MB | 5"2DD/2HDx2, 100M SCSI HDD | 4 | 1992/01 | - PC-9801FA/U7 | i486SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2, 100M SCSI HDD | 4 | 1992/01 | - PC-9801FS2 | i386SX-20 @ 16/20 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1992/05 | - PC-9801FS/U2 | i386SX-20 @ 16/20 | 1.6 MB | 3.5"2DD/2HDx2 | 4 | 1992/05 | - PC-9801FS5 | i386SX-20 @ 16/20 | 1.6 MB | 5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/05 | - PC-9801FS/U5 | i386SX-20 @ 16/20 | 1.6 MB | 3.5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/05 | - PC-9801FS7 | i386SX-20 @ 16/20 | 1.6 MB | 5"2DD/2HDx2, 100M SCSI HDD | 4 | 1992/01 | - PC-9801FS/U7 | i386SX-20 @ 16/20 | 1.6 MB | 3.5"2DD/2HDx2, 100M SCSI HDD | 4 | 1992/01 | - PC-9801NS/T | i386SL(98) @ 20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1992/01 | - PC-9801NS/T40 | i386SL(98) @ 20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1992/01 | - PC-9801NS/T80 | i386SL(98) @ 20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 80M SASI HDD | 0 | 1992/01 | - PC-9801NL | V30H @ 8/16 | 640 KB | 1.25 MB RAM Disk | 0 | 1992/01 | - PC-9801FX2 | i386SX-12 @ 10/12 | 1.6 MB | 5"2DD/2HDx2 | 4 | 1992/05 | - PC-9801FX/U2 | i386SX-12 @ 10/12 | 1.6 MB | 3.5"2DD/2HDx2 | 4 | 1992/05 | - PC-9801FX5 | i386SX-12 @ 10/12 | 1.6 MB | 5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/05 | - PC-9801FX/U5 | i386SX-12 @ 10/12 | 1.6 MB | 3.5"2DD/2HDx2, 40M SCSI HDD | 4 | 1992/05 | - PC-9801US | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2 | 2 | 1992/07 | - PC-9801US40 | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2, 40M SASI HDD | 2 | 1992/07 | - PC-9801US80 | i386SX-16 @ 16 | 1.6 MB | 3.5"2DD/2HDx2, 80M SASI HDD | 2 | 1992/07 | - PC-9801NS/L | i386SX-20 @ 10/20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1992/07 | - PC-9801NS/L40 | i386SX-20 @ 10/20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1992/07 | - PC-9801NA | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1992/11 | - PC-9801NA40 | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1992/11 | - PC-9801NA120 | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 120M SASI HDD | 0 | 1992/11 | - PC-9801NA/C | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1992/11 | - PC-9801NA40/C | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 40M SASI HDD | 0 | 1992/11 | - PC-9801NA120/C | i486SX-20 @ 20 | 2.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk, 120M SASI HDD | 0 | 1992/11 | - PC-9801NS/R | i486SX(J) @ 20 | 1.6 MB | 3.5"2DD/2HDx1 (3mode), 1.25MB RAM Disk | 0 | 1993/01 | - PC-9801NS/R40 | i486SX(J) @ 20 | 1.6 MB | 3.5"2DD/2HDx1 (3mode), 1.25MB RAM Disk, 40M SASI HDD | 0 | 1993/01 | - PC-9801NS/R120 | i486SX(J) @ 20 | 1.6 MB | 3.5"2DD/2HDx1 (3mode), 1.25MB RAM Disk, 120M SASI HDD | 0 | 1993/01 | - PC-9801BA/U2 | i486DX2-40 @ 40 | 1.6 MB | 3.5"2DD/2HDx2 | 3 | 1993/01 | - PC-9801BA/U6 | i486DX2-40 @ 40 | 3.6 MB | 3.5"2DD/2HDx1, 40M SASI HDD | 3 | 1993/01 | - PC-9801BA/M2 | i486DX2-40 @ 40 | 1.6 MB | 5"2DD/2HDx2 | 3 | 1993/01 | - PC-9801BX/U2 | i486SX-20 @ 20 | 1.6 MB | 3.5"2DD/2HDx2 | 3 | 1993/01 | - PC-9801BX/U6 | i486SX-20 @ 20 | 3.6 MB | 3.5"2DD/2HDx1, 40M SASI HDD | 3 | 1993/01 | - PC-9801BX/M2 | i486SX-20 @ 20 | 1.6 MB | 5"2DD/2HDx2 | 3 | 1993/01 | - PC-9801NX/C | i486SX(J) @ 20 | 1.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1993/07 | - PC-9801NX/C120 | i486SX(J) @ 20 | 3.6 MB | 3.5"2DD/2HDx1, 1.25MB RAM Disk | 0 | 1993/07 | - PC-9801P40/D | i486SX(J) @ 20 | 5.6 MB | 40MB IDE HDD | 0 | 1993/07 | - PC-9801P80/W | i486SX(J) @ 20 | 7.6 MB | 80MB IDE HDD | 0 | 1993/07 | - PC-9801P80/P | i486SX(J) @ 20 | 7.6 MB | 80MB IDE HDD | 0 | 1993/07 | - PC-9801BA2/U2 | i486DX2-66 @ 66 | 3.6 MB | 3.5"2DD/2HDx2 | 3 | 1993/11 | - PC-9801BA2/U7 | i486DX2-66 @ 66 | 3.6 MB | 3.5"2DD/2HDx1, 120MB IDE HDD | 3 | 1993/11 | - PC-9801BA2/M2 | i486DX2-66 @ 66 | 3.6 MB | 5"2DD/2HDx2 | 3 | 1993/11 | - PC-9801BS2/U2 | i486SX-33 @ 33 | 3.6 MB | 3.5"2DD/2HDx2 | 3 | 1993/11 | - PC-9801BS2/U7 | i486SX-33 @ 33 | 3.6 MB | 3.5"2DD/2HDx1, 120MB IDE HDD | 3 | 1993/11 | - PC-9801BS2/M2 | i486SX-33 @ 33 | 3.6 MB | 5"2DD/2HDx2 | 3 | 1993/11 | - PC-9801BX2/U2 | i486SX-25 @ 25 | 1.8 MB | 3.5"2DD/2HDx2 | 3 | 1993/11 | - PC-9801BX2/U7 | i486SX-25 @ 25 | 3.6 MB | 3.5"2DD/2HDx1, 120MB IDE HDD | 3 | 1993/11 | - PC-9801BX2/M2 | i486SX-25 @ 25 | 1.8 MB | 5"2DD/2HDx2 | 3 | 1993/11 | - PC-9801BA3/U2 | i486DX-66 @ 66 | 3.6 MB | 3.5"2DD/2HDx2 | 3 | 1995/01 | - PC-9801BA3/U2/W | i486DX-66 @ 66 | 7.6 MB | 3.5"2DD/2HDx2, 210MB IDE HDD | 3 | 1995/01 | - PC-9801BX3/U2 | i486SX-33 @ 33 | 1.6 MB | 3.5"2DD/2HDx2 | 3 | 1995/01 | - PC-9801BX3/U2/W | i486SX-33 @ 33 | 5.6 MB | 3.5"2DD/2HDx2, 210MB IDE HDD | 3 | 1995/01 | - PC-9801BX4/U2 | AMD/i 486DX2-66 @ 66 | 2 MB | 3.5"2DD/2HDx2 | 3 | 1995/07 | - PC-9801BX4/U2/C | AMD/i 486DX2-66 @ 66 | 2 MB | 3.5"2DD/2HDx2, 2xCD-ROM | 3 | 1995/07 | - PC-9801BX4/U2-P | Pentium ODP @ 66 | 2 MB | 3.5"2DD/2HDx2 | 3 | 1995/09 | - PC-9801BX4/U2/C-P | Pentium ODP @ 66 | 2 MB | 3.5"2DD/2HDx2, 2xCD-ROM | 3 | 1995/09 | - - For more info (e.g. optional hardware), see http://www.geocities.jp/retro_zzz/machines/nec/9801/mdl98cpu.html - - - PC-9821 Series - - PC-9821 (1992) - aka 98MULTi, desktop computer, 386 based - PC-9821A series (1993->1994) - aka 98MATE A, desktop computers, 486 based - PC-9821B series (1993) - aka 98MATE B, desktop computers, 486 based - PC-9821C series (1993->1996) - aka 98MULTi CanBe, desktop & tower computers, various CPU - PC-9821Es (1994) - aka 98FINE, desktop computer with integrated LCD, successor of the PC-98T - PC-9821X series (1994->1995) - aka 98MATE X, desktop computers, Pentium based - PC-9821V series (1995) - aka 98MATE Valuestar, desktop computers, Pentium based - PC-9821S series (1995->2996) - aka 98Pro, tower computers, PentiumPro based - PC-9821R series (1996->2000) - aka 98MATE R, desktop & tower & server computers, various CPU - PC-9821C200 (1997) - aka CEREB, desktop computer, Pentium MMX based - PC-9821 Ne/Ns/Np/Nm (1993->1995) - aka 98NOTE, laptops, 486 based - PC-9821 Na/Nb/Nw (1995->1997) - aka 98NOTE Lavie, laptops, Pentium based - PC-9821 Lt/Ld (1995) - aka 98NOTE Light, laptops, 486 based - PC-9821 La/Ls (1995->1997) - aka 98NOTE Aile, laptops, Pentium based - -==== - -Documentation notes (for unemulated stuff, courtesy of T. Kodaka and T. Kono): - -IDE: -(r/w) -0x430: IDE drive switch -0x432: IDE drive switch -0x435: - - (ISA correlated i/o) ----------------------------------------------------------- -0x0640 |WORD|R/W|Data Register |01F0h -0x0642 |BYTE| R |Error Register |01F1h -0x0642 |BYTE| W |Write Precomp Register |01F1h -0x0644 |BYTE|R/W|Sector Count |01F2h -0x0646 |BYTE|R/W|Sector Number |01F3h -0x0648 |BYTE|R/W|Cylinder Low |01F4h -0x064A |BYTE|R/W|Cylinder High |01F5h -0x064C |BYTE|R/W|SDH Register |01F6h -0x064E |BYTE| R |Status Register |01F7h -0x064E |BYTE| W |Command Register |01F7h -0x074C |BYTE| R |Alternate Status Register |03F6h -0x074C |BYTE| W |Digital Output Register |03F6h -0x074E |BYTE| R |Digital Input Register |03F7h - -Video F/F (i/o 0x68): -KAC mode (video ff = 5) is basically how the kanji ROM could be accessed, 1=thru the CG window ports, 0=thru the kanji -window RAM at 0xa4***. -My guess is that the system locks up or doesn't have any data if the wrong port is being accessed. - -Ext Video F/F (i/o 0x6a): -0000 011x enables EGC -0000 111x enables PC-98GS -0010 000x enables multicolor (a.k.a. 256 colors mode) -0010 001x enables 65'536 colors -0010 010x 64k color palette related (?) -0010 011x full screen reverse (?) -0010 100x text and gfxs synthesis (?) -0010 101x 256 color palette registers fast write (?) -0010 110x 256 color overscan (?) -0100 000x (0) CRT (1) Plasma/LCD -0100 001x text and gfxs right shifted one dot (undocumented behaviour) -0100 010x hi-res mode in PC-9821 -0110 000x EEGC mode -0110 001x VRAM config (0) plain (1) packed -0110 011x AGDC mode -0110 100x 480 lines -0110 110x VRAM bitmap orientation (0) MSB left-to-right LSB (1) LSB left-to-right MSB -1000 001x CHR GDC clock (0) 2,5 MHz (1) 5 MHz -1000 010x BMP GDC clock -1000 111x related to GFX accelerator cards (like Vision864) -1100 010x chart GDC operating mode (?) -(everything else is undocumented / unknown) - -Keyboard TX commands: -0xfa ACK -0xfc NACK -0x95 ----- --xx extension key settings (00 normal 11 Win and App Keys enabled) -0x96 identification codes -0x9c --xx- ---- key delay (11 = 1000 ms, 10 = 500 ms, 01 = 500 ms, 00 = 250 ms) ----x xxxx repeat rate (slow 11111 -> 00001 fast) -0x9d keyboard LED settings -0x9f keyboard ID - -****************************************************************************************************/ - -#include "emu.h" - -#include "cpu/i86/i86.h" -#include "cpu/nec/nec.h" -#include "cpu/i86/i286.h" -#include "cpu/i386/i386.h" - -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/am9517a.h" -#include "machine/pic8259.h" -#include "machine/upd765.h" -#include "machine/upd1990a.h" -#include "machine/i8251.h" - -#include "bus/scsi/pc9801_sasi.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsihd.h" -#include "machine/buffer.h" -#include "machine/latch.h" - -#include "sound/beep.h" -#include "sound/speaker.h" -#include "sound/2608intf.h" - -#include "video/upd7220.h" - -#include "machine/ram.h" - -#include "formats/pc98_dsk.h" -#include "formats/pc98fdi_dsk.h" -#include "formats/fdd_dsk.h" -#include "formats/dcp_dsk.h" -#include "formats/dip_dsk.h" -#include "formats/nfd_dsk.h" - -#include "machine/pc9801_26.h" -#include "machine/pc9801_86.h" -#include "machine/pc9801_118.h" -#include "machine/pc9801_cbus.h" -#include "machine/pc9801_kbd.h" - -#include "machine/idectrl.h" -#include "machine/idehd.h" - -#include "debugger.h" - -#define UPD1990A_TAG "upd1990a" -#define UPD8251_TAG "upd8251" -#define SASIBUS_TAG "sasi" - -class pc9801_state : public driver_device -{ -public: - pc9801_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dmac(*this, "i8237"), - m_pit8253(*this, "pit8253"), - m_pic1(*this, "pic8259_master"), - m_pic2(*this, "pic8259_slave"), - m_fdc_2hd(*this, "upd765_2hd"), - m_fdc_2dd(*this, "upd765_2dd"), - m_rtc(*this, UPD1990A_TAG), - m_keyb(*this, "keyb"), - m_sio(*this, UPD8251_TAG), - m_hgdc1(*this, "upd7220_chr"), - m_hgdc2(*this, "upd7220_btm"), - m_sasibus(*this, SASIBUS_TAG), - m_sasi_data_out(*this, "sasi_data_out"), - m_sasi_data_in(*this, "sasi_data_in"), - m_sasi_ctrl_in(*this, "sasi_ctrl_in"), - m_ide(*this, "ide"), - m_video_ram_1(*this, "video_ram_1"), - m_video_ram_2(*this, "video_ram_2"), - m_ext_gvram(*this, "ext_gvram"), - m_beeper(*this, "beeper"), - m_ram(*this, RAM_TAG), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_screen(*this, "screen") - { - } - - required_device m_maincpu; - required_device m_dmac; - required_device m_pit8253; - required_device m_pic1; - required_device m_pic2; - required_device m_fdc_2hd; - optional_device m_fdc_2dd; - required_device m_rtc; - required_device m_keyb; - required_device m_sio; - required_device m_hgdc1; - required_device m_hgdc2; - optional_device m_sasibus; - optional_device m_sasi_data_out; - optional_device m_sasi_data_in; - optional_device m_sasi_ctrl_in; - optional_device m_ide; - required_shared_ptr m_video_ram_1; - required_shared_ptr m_video_ram_2; - optional_shared_ptr m_ext_gvram; - required_device m_beeper; - optional_device m_ram; - required_device m_gfxdecode; - required_device m_palette; - required_device m_screen; - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - enum - { - TIMER_VBIRQ - }; - - emu_timer *m_vbirq; - UINT8 *m_ipl_rom; - UINT8 *m_char_rom; - UINT8 *m_kanji_rom; - - UINT8 m_dma_offset[4]; - int m_dack; - - UINT8 m_video_ff[8],m_gfx_ff; - UINT8 m_txt_scroll_reg[8]; - UINT8 m_pal_clut[4]; - - UINT16 *m_tvram; - - UINT16 m_font_addr; - UINT8 m_font_line; - UINT16 m_font_lr; - - UINT8 m_keyb_press; - - UINT8 m_fdc_2dd_ctrl,m_fdc_2hd_ctrl; - UINT8 m_nmi_ff; - - UINT8 m_vram_bank; - UINT8 m_vram_disp; - - /* PC9801RS specific */ - UINT8 m_gate_a20; //A20 line - UINT8 m_nmi_enable; - UINT8 m_access_ctrl; // DMA related - UINT8 m_rom_bank; - UINT8 m_fdc_ctrl; - UINT8 m_ex_video_ff[128]; - struct { - UINT8 pal_entry; - UINT8 r[16],g[16],b[16]; - }m_analog16; - struct { - UINT8 pal_entry; - UINT8 r[0x100],g[0x100],b[0x100]; - }m_analog256; - struct { - UINT8 mode; - UINT8 tile[4], tile_index; - }m_grcg; - - struct { - UINT16 regs[8]; - UINT16 pat[4]; - UINT16 src[4]; - INT16 count; - UINT16 leftover[4]; - bool first; - bool init; - } m_egc; - - /* PC9821 specific */ - UINT8 m_sdip[24], m_sdip_bank; - UINT8 m_pc9821_window_bank; - UINT8 m_ext2_ff; - UINT8 m_sys_type; - - DECLARE_WRITE_LINE_MEMBER( write_uart_clock ); - DECLARE_WRITE8_MEMBER(rtc_dmapg_w); - DECLARE_WRITE8_MEMBER(nmi_ctrl_w); - DECLARE_WRITE8_MEMBER(vrtc_clear_w); - DECLARE_WRITE8_MEMBER(pc9801_video_ff_w); - DECLARE_READ8_MEMBER(txt_scrl_r); - DECLARE_WRITE8_MEMBER(txt_scrl_w); - DECLARE_READ8_MEMBER(grcg_r); - DECLARE_WRITE8_MEMBER(grcg_w); - DECLARE_WRITE16_MEMBER(egc_w); - DECLARE_READ8_MEMBER(pc9801_a0_r); - DECLARE_WRITE8_MEMBER(pc9801_a0_w); - DECLARE_READ8_MEMBER(pc9801_fdc_2hd_r); - DECLARE_WRITE8_MEMBER(pc9801_fdc_2hd_w); - DECLARE_READ8_MEMBER(pc9801_fdc_2dd_r); - DECLARE_WRITE8_MEMBER(pc9801_fdc_2dd_w); - DECLARE_READ16_MEMBER(tvram_r); - DECLARE_WRITE16_MEMBER(tvram_w); - DECLARE_READ8_MEMBER(gvram_r); - DECLARE_WRITE8_MEMBER(gvram_w); - DECLARE_WRITE8_MEMBER(pc9801rs_mouse_freq_w); - DECLARE_CUSTOM_INPUT_MEMBER(system_type_r); - DECLARE_READ16_MEMBER(grcg_gvram_r); - DECLARE_WRITE16_MEMBER(grcg_gvram_w); - DECLARE_READ16_MEMBER(grcg_gvram0_r); - DECLARE_WRITE16_MEMBER(grcg_gvram0_w); - DECLARE_READ16_MEMBER(upd7220_grcg_r); - DECLARE_WRITE16_MEMBER(upd7220_grcg_w); - void egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask); - UINT16 egc_blit_r(UINT32 offset, UINT16 mem_mask); - UINT32 pc9801_286_a20(bool state); - - DECLARE_READ8_MEMBER(ide_hack_r); - DECLARE_WRITE8_MEMBER(sasi_data_w); - DECLARE_READ8_MEMBER(sasi_data_r); - DECLARE_WRITE_LINE_MEMBER(write_sasi_io); - DECLARE_WRITE_LINE_MEMBER(write_sasi_req); - DECLARE_READ8_MEMBER(sasi_status_r); - DECLARE_WRITE8_MEMBER(sasi_ctrl_w); - - UINT8 m_sasi_data; - int m_sasi_data_enable; - UINT8 m_sasi_ctrl; - - DECLARE_READ8_MEMBER(pc9801rs_ipl_r); - DECLARE_READ8_MEMBER(pc9801rs_knjram_r); - DECLARE_WRITE8_MEMBER(pc9801rs_knjram_w); - DECLARE_WRITE8_MEMBER(pc9801rs_bank_w); - DECLARE_READ8_MEMBER(a20_ctrl_r); - DECLARE_WRITE8_MEMBER(a20_ctrl_w); - DECLARE_READ8_MEMBER(pc9810rs_fdc_ctrl_r); - DECLARE_WRITE8_MEMBER(pc9810rs_fdc_ctrl_w); - DECLARE_READ8_MEMBER(pc9801rs_2hd_r); - DECLARE_WRITE8_MEMBER(pc9801rs_2hd_w); -// DECLARE_READ8_MEMBER(pc9801rs_2dd_r); -// DECLARE_WRITE8_MEMBER(pc9801rs_2dd_w); - DECLARE_WRITE8_MEMBER(pc9801rs_video_ff_w); - DECLARE_WRITE8_MEMBER(pc9801rs_a0_w); - DECLARE_WRITE8_MEMBER(pc9821_video_ff_w); - DECLARE_READ8_MEMBER(pc9821_a0_r); - DECLARE_WRITE8_MEMBER(pc9821_a0_w); - DECLARE_READ8_MEMBER(pc9801rs_access_ctrl_r); - DECLARE_WRITE8_MEMBER(pc9801rs_access_ctrl_w); - DECLARE_WRITE8_MEMBER(pc9801rs_nmi_w); - DECLARE_READ8_MEMBER(pc9801rs_midi_r); -// DECLARE_READ8_MEMBER(winram_r); -// DECLARE_WRITE8_MEMBER(winram_w); -// DECLARE_READ8_MEMBER(pc9801_ext_opna_r); -// DECLARE_WRITE8_MEMBER(pc9801_ext_opna_w); - DECLARE_READ8_MEMBER(pic_r); - DECLARE_WRITE8_MEMBER(pic_w); - - DECLARE_READ8_MEMBER(sdip_0_r); - DECLARE_READ8_MEMBER(sdip_1_r); - DECLARE_READ8_MEMBER(sdip_2_r); - DECLARE_READ8_MEMBER(sdip_3_r); - DECLARE_READ8_MEMBER(sdip_4_r); - DECLARE_READ8_MEMBER(sdip_5_r); - DECLARE_READ8_MEMBER(sdip_6_r); - DECLARE_READ8_MEMBER(sdip_7_r); - DECLARE_READ8_MEMBER(sdip_8_r); - DECLARE_READ8_MEMBER(sdip_9_r); - DECLARE_READ8_MEMBER(sdip_a_r); - DECLARE_READ8_MEMBER(sdip_b_r); - - DECLARE_WRITE8_MEMBER(sdip_0_w); - DECLARE_WRITE8_MEMBER(sdip_1_w); - DECLARE_WRITE8_MEMBER(sdip_2_w); - DECLARE_WRITE8_MEMBER(sdip_3_w); - DECLARE_WRITE8_MEMBER(sdip_4_w); - DECLARE_WRITE8_MEMBER(sdip_5_w); - DECLARE_WRITE8_MEMBER(sdip_6_w); - DECLARE_WRITE8_MEMBER(sdip_7_w); - DECLARE_WRITE8_MEMBER(sdip_8_w); - DECLARE_WRITE8_MEMBER(sdip_9_w); - DECLARE_WRITE8_MEMBER(sdip_a_w); - DECLARE_WRITE8_MEMBER(sdip_b_w); - - DECLARE_READ8_MEMBER(pc9821_window_bank_r); - DECLARE_WRITE8_MEMBER(pc9821_window_bank_w); - DECLARE_READ16_MEMBER(pc9821_timestamp_r); - DECLARE_READ8_MEMBER(pc9821_ext2_video_ff_r); - DECLARE_WRITE8_MEMBER(pc9821_ext2_video_ff_w); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); - UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); - -private: - UINT8 m_sdip_read(UINT16 port, UINT8 sdip_offset); - void m_sdip_write(UINT16 port, UINT8 sdip_offset,UINT8 data); - UINT16 egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst); - UINT16 egc_shift(int plane, UINT16 val); -public: - DECLARE_MACHINE_START(pc9801_common); - DECLARE_MACHINE_START(pc9801f); - DECLARE_MACHINE_START(pc9801rs); - DECLARE_MACHINE_START(pc9801bx2); - DECLARE_MACHINE_START(pc9821); - DECLARE_MACHINE_START(pc9821ap2); - DECLARE_MACHINE_RESET(pc9801_common); - DECLARE_MACHINE_RESET(pc9801f); - DECLARE_MACHINE_RESET(pc9801rs); - DECLARE_MACHINE_RESET(pc9821); - - DECLARE_PALETTE_INIT(pc9801); - INTERRUPT_GEN_MEMBER(pc9801_vrtc_irq); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); - DECLARE_WRITE_LINE_MEMBER(tc_w); - DECLARE_READ8_MEMBER(dma_read_byte); - DECLARE_WRITE8_MEMBER(dma_write_byte); - DECLARE_WRITE_LINE_MEMBER(dack0_w); - DECLARE_WRITE_LINE_MEMBER(dack1_w); - DECLARE_WRITE_LINE_MEMBER(dack2_w); - DECLARE_WRITE_LINE_MEMBER(dack3_w); - DECLARE_WRITE8_MEMBER(ppi_sys_portc_w); - - DECLARE_WRITE_LINE_MEMBER(fdc_2dd_irq); - DECLARE_WRITE_LINE_MEMBER(pc9801rs_fdc_irq); - DECLARE_WRITE_LINE_MEMBER(pc9801rs_fdc_drq); - - DECLARE_READ8_MEMBER(ppi_mouse_porta_r); - DECLARE_WRITE8_MEMBER(ppi_mouse_porta_w); - DECLARE_WRITE8_MEMBER(ppi_mouse_portb_w); - DECLARE_WRITE8_MEMBER(ppi_mouse_portc_w); - struct{ - UINT8 control; - UINT8 lx; - UINT8 ly; - UINT8 freq_reg; - UINT8 freq_index; - }m_mouse; - TIMER_DEVICE_CALLBACK_MEMBER( mouse_irq_cb ); - - DECLARE_DRIVER_INIT(pc9801_kanji); - inline void set_dma_channel(int channel, int state); - virtual void device_reset_after_children(); -}; - - - -#define ATTRSEL_REG 0 -#define WIDTH40_REG 2 -#define FONTSEL_REG 3 -#define INTERLACE_REG 4 -#define MEMSW_REG 6 -#define DISPLAY_REG 7 - -#define ANALOG_16_MODE 0 -#define ANALOG_256_MODE 0x10 - -void pc9801_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_VBIRQ: - m_pic1->ir2_w(0); - } -} - -void pc9801_state::video_start() -{ - m_tvram = auto_alloc_array(machine(), UINT16, 0x2000); - - // find memory regions - m_char_rom = memregion("chargen")->base(); - m_kanji_rom = memregion("kanji")->base(); -} - -UINT32 pc9801_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(m_palette->black_pen(), cliprect); - - /* graphics */ - m_hgdc2->screen_update(screen, bitmap, cliprect); - m_hgdc1->screen_update(screen, bitmap, cliprect); - return 0; -} - -UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi; - int res_x,res_y; - UINT8 pen; - UINT8 interlace_on; - UINT8 colors16_mode; - - if(m_video_ff[DISPLAY_REG] == 0) //screen is off - return; - -// popmessage("%02x %d",m_video_ff[INTERLACE_REG],machine().first_screen()->visible_area().max_y + 1); -// interlace_on = ((machine().first_screen()->visible_area().max_y + 1) >= 400) ? 1 : 0; - interlace_on = m_video_ff[INTERLACE_REG]; - colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8; - - if(m_ex_video_ff[ANALOG_256_MODE]) - { - for(xi=0;xi<16;xi++) - { - res_x = x + xi; - res_y = y; - - if(!m_screen->visible_area().contains(res_x, res_y*2+0)) - return; - - pen = m_ext_gvram[((address*16+xi)+(m_vram_disp*0x40000)) >> 1]; - - bitmap.pix32(res_y*2+0, res_x) = palette[pen + 0x20]; - if(m_screen->visible_area().contains(res_x, res_y*2+1)) - bitmap.pix32(res_y*2+1, res_x) = palette[pen + 0x20]; - } - } - else - { - for(xi=0;xi<16;xi++) - { - res_x = x + xi; - res_y = y; - - pen = ((m_video_ram_2[((address & 0x7fff) + (0x08000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 1 : 0; - pen|= ((m_video_ram_2[((address & 0x7fff) + (0x10000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 2 : 0; - pen|= ((m_video_ram_2[((address & 0x7fff) + (0x18000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 4 : 0; - if(m_ex_video_ff[ANALOG_16_MODE]) - pen|= ((m_video_ram_2[((address & 0x7fff) + (0) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 8 : 0; - - if(interlace_on) - { - if(m_screen->visible_area().contains(res_x, res_y*2+0)) - bitmap.pix32(res_y*2+0, res_x) = palette[pen + colors16_mode]; - /* TODO: it looks like that PC-98xx can only display even lines ... */ - if(m_screen->visible_area().contains(res_x, res_y*2+1)) - bitmap.pix32(res_y*2+1, res_x) = palette[pen + colors16_mode]; - } - else - bitmap.pix32(res_y, res_x) = palette[pen + colors16_mode]; - } - } -} - -UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,yi; - int x; - UINT8 char_size; -// UINT8 interlace_on; - UINT16 tile; - UINT8 kanji_lr; - UINT8 kanji_sel; - UINT8 x_step; - - if(m_video_ff[DISPLAY_REG] == 0) //screen is off - return; - -// interlace_on = m_video_ff[INTERLACE_REG]; - char_size = m_video_ff[FONTSEL_REG] ? 16 : 8; - tile = 0; - - for(x=0;x> 8; - if(knj_tile) - { - /* Note: bit 7 doesn't really count, if a kanji is enabled then the successive tile is always the second part of it. - Trusted with Alice no Yakata, Animahjong V3, Aki no Tsukasa no Fushigi no Kabe, Apros ... - */ - //kanji_lr = (knj_tile & 0x80) >> 7; - //kanji_lr |= (tile & 0x80) >> 7; // Tokimeki Sports Gal 3 - tile &= 0x7f; - tile <<= 8; - tile |= (knj_tile & 0x7f); - kanji_sel = 1; - if((tile & 0x7c00) == 0x0800) // 8x16 charset selector - x_step = 1; - else - x_step = 2; -// kanji_lr = 0; - } - else - x_step = 1; - - - - for(kanji_lr=0;kanji_lr> 5; - - for(yi=0;yivisible_area().contains(res_x, res_y)) - continue; - - tile_data = 0; - - if(!secret) - { - /* TODO: priority */ - if(gfx_mode) - { - int gfx_bit; - tile_data = 0; - - /* - gfx strip mode: - - number refers to the bit number in the tile data. - This mode is identical to the one seen in PC-8801 - 00004444 - 11115555 - 22226666 - 33337777 - */ - - gfx_bit = (xi & 4); - gfx_bit+= (yi & (2 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); - gfx_bit+= (yi & (4 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); - - tile_data = ((tile >> gfx_bit) & 1) ? 0xff : 0x00; - } - else if(kanji_sel) - tile_data = (m_kanji_rom[tile*0x20+yi*2+kanji_lr]); - else - tile_data = (m_char_rom[tile*char_size+m_video_ff[FONTSEL_REG]*0x800+yi]); - } - - if(reverse) { tile_data^=0xff; } - if(u_line && yi == 7) { tile_data = 0xff; } - if(v_line) { tile_data|=8; } - - /* TODO: proper blink rate for these two */ - if(cursor_on && cursor_addr == tile_addr && m_screen->frame_number() & 0x10) - tile_data^=0xff; - - if(blink && m_screen->frame_number() & 0x10) - tile_data^=0xff; - - if(yi >= char_size) - pen = -1; - else - pen = (tile_data >> (7-xi) & 1) ? color : -1; - - if(pen != -1) - bitmap.pix32(res_y, res_x) = palette[pen]; - - if(m_video_ff[WIDTH40_REG]) - { - if(!m_screen->visible_area().contains(res_x+1, res_y)) - continue; - - if(pen != -1) - bitmap.pix32(res_y, res_x+1) = palette[pen]; - } - } - } - } - } -} - - -WRITE8_MEMBER(pc9801_state::rtc_dmapg_w) -{ - if((offset & 1) == 0) - { - if(offset == 0) - { - m_rtc->c0_w((data & 0x01) >> 0); - m_rtc->c1_w((data & 0x02) >> 1); - m_rtc->c2_w((data & 0x04) >> 2); - m_rtc->stb_w((data & 0x08) >> 3); - m_rtc->clk_w((data & 0x10) >> 4); - m_rtc->data_in_w(((data & 0x20) >> 5)); - if(data & 0xc0) - logerror("RTC write to undefined bits %02x\n",data & 0xc0); - } - else - logerror("Write to undefined port [%02x] <- %02x\n",offset+0x20,data); - } - else // odd - { -// logerror("Write to DMA bank register %d %02x\n",((offset >> 1)+1) & 3,data); - m_dma_offset[((offset >> 1)+1) & 3] = data & 0x0f; - } -} - -WRITE8_MEMBER(pc9801_state::nmi_ctrl_w) -{ - m_nmi_ff = (offset & 2) >> 1; -} - -WRITE8_MEMBER(pc9801_state::vrtc_clear_w) -{ - m_pic1->ir2_w(0); -} - -WRITE8_MEMBER(pc9801_state::pc9801_video_ff_w) -{ - /* - TODO: this is my best bet so far. Register 4 is annoying, the pattern seems to be: - Write to video FF register Graphic -> 00 - Write to video FF register 200 lines -> 0x - Write to video FF register 200 lines -> 00 - - where x is the current mode. - */ - switch((data & 0x0e) >> 1) - { - case 1: - m_gfx_ff = 1; - if(data & 1) - logerror("Graphic f/f actually enabled!\n"); - break; - case 4: - if(m_gfx_ff) - { - m_video_ff[(data & 0x0e) >> 1] = data &1; - m_gfx_ff = 0; - } - break; - default: m_video_ff[(data & 0x0e) >> 1] = data & 1; break; - } - - if(0) - { - static const char *const video_ff_regnames[] = - { - "Attribute Select", // 0 - "Graphic", // 1 - "Column", // 2 - "Font Select", // 3 - "200 lines", // 4 - "KAC?", // 5 - "Memory Switch", // 6 - "Display ON" // 7 - }; - - logerror("Write to video FF register %s -> %02x\n",video_ff_regnames[(data & 0x0e) >> 1],data & 1); - } -} - - -READ8_MEMBER(pc9801_state::txt_scrl_r) -{ - //logerror("Read to display register [%02x]\n",offset+0x70); - /* TODO: ok? */ - return m_txt_scroll_reg[offset >> 1]; -} - -WRITE8_MEMBER(pc9801_state::txt_scrl_w) -{ - //logerror("Write to display register [%02x] %02x\n",offset+0x70,data); - m_txt_scroll_reg[offset >> 1] = data; - - //popmessage("%02x %02x %02x %02x",m_txt_scroll_reg[0],m_txt_scroll_reg[1],m_txt_scroll_reg[2],m_txt_scroll_reg[3]); -} - -READ8_MEMBER(pc9801_state::pc9801_a0_r) -{ - if((offset & 1) == 0) - { - switch(offset & 0xe) - { - case 0x00: - case 0x02: - return m_hgdc2->read(space, (offset & 2) >> 1); - /* TODO: double check these two */ - case 0x04: - return m_vram_disp & 1; - case 0x06: - return m_vram_bank & 1; - /* bitmap palette clut read */ - case 0x08: - case 0x0a: - case 0x0c: - case 0x0e: - return m_pal_clut[(offset & 0x6) >> 1]; - } - - return 0xff; //code unreachable - } - else // odd - { - switch((offset & 0xe) + 1) - { - case 0x09://cg window font read - { - UINT32 pcg_offset; - - pcg_offset = (m_font_addr & 0x7f7f) << 5; - pcg_offset|= m_font_line; - pcg_offset|= m_font_lr; - - return m_kanji_rom[pcg_offset]; - } - } - - logerror("Read to undefined port [%02x]\n",offset+0xa0); - return 0xff; - } -} - -WRITE8_MEMBER(pc9801_state::pc9801_a0_w) -{ - if((offset & 1) == 0) - { - switch(offset & 0xe) - { - case 0x00: - case 0x02: - m_hgdc2->write(space, (offset & 2) >> 1,data); - return; - case 0x04: - m_vram_disp = data & 1; - return; - case 0x06: - m_vram_bank = data & 1; - return; - /* bitmap palette clut write */ - case 0x08: - case 0x0a: - case 0x0c: - case 0x0e: - { - UINT8 pal_entry; - - m_pal_clut[(offset & 0x6) >> 1] = data; - - /* can't be more twisted I presume ... :-/ */ - pal_entry = (((offset & 4) >> 1) | ((offset & 2) << 1)) >> 1; - pal_entry ^= 3; - - m_palette->set_pen_color((pal_entry)|4|8, pal1bit((data & 0x2) >> 1), pal1bit((data & 4) >> 2), pal1bit((data & 1) >> 0)); - m_palette->set_pen_color((pal_entry)|8, pal1bit((data & 0x20) >> 5), pal1bit((data & 0x40) >> 6), pal1bit((data & 0x10) >> 4)); - return; - } - default: - logerror("Write to undefined port [%02x] <- %02x\n",offset+0xa0,data); - return; - } - } - else // odd - { - switch((offset & 0xe) + 1) - { - case 0x01: - m_font_addr = (data & 0xff) | (m_font_addr & 0x7f00); - return; - case 0x03: - m_font_addr = ((data & 0x7f) << 8) | (m_font_addr & 0xff); - return; - case 0x05: - //logerror("%02x\n",data); - m_font_line = ((data & 0x0f) << 1); - m_font_lr = ((data & 0x20) >> 5) ^ 1; - return; - case 0x09: //cg window font write - { - UINT32 pcg_offset; - - pcg_offset = m_font_addr << 5; - pcg_offset|= m_font_line; - pcg_offset|= m_font_lr; - //logerror("%04x %02x %02x %08x\n",m_font_addr,m_font_line,m_font_lr,pcg_offset); - if((m_font_addr & 0xff00) == 0x5600 || (m_font_addr & 0xff00) == 0x5700) - { - m_kanji_rom[pcg_offset] = data; - m_gfxdecode->gfx(2)->mark_dirty(pcg_offset >> 5); - } - return; - } - } - - //logerror("Write to undefined port [%02x) <- %02x\n",offset+0xa0,data); - } -} - -DECLARE_WRITE_LINE_MEMBER(pc9801_state::write_uart_clock) -{ - m_sio->write_txc(state); - m_sio->write_rxc(state); -} - -READ8_MEMBER(pc9801_state::pc9801_fdc_2hd_r) -{ - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: return m_fdc_2hd->msr_r(space, 0, 0xff); - case 2: return m_fdc_2hd->fifo_r(space, 0, 0xff); - case 4: return 0x5f; //unknown port meaning - } - } - else - { - switch((offset & 6) + 1) - { - case 1: return m_sio->data_r(space, 0); - case 3: return m_sio->status_r(space, 0); - } - logerror("Read to undefined port [%02x]\n",offset+0x90); - return 0xff; - } - - return 0xff; -} - -WRITE8_MEMBER(pc9801_state::pc9801_fdc_2hd_w) -{ - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: logerror("Write to undefined port [%02x] <- %02x\n",offset+0x90,data); return; - case 2: m_fdc_2hd->fifo_w(space, 0, data, 0xff); return; - case 4: - //logerror("%02x ctrl\n",data); - if(((m_fdc_2hd_ctrl & 0x80) == 0) && (data & 0x80)) - m_fdc_2hd->soft_reset(); - - m_fdc_2hd_ctrl = data; - - if(data & 0x40) - { - m_fdc_2hd->set_ready_line_connected(0); - m_fdc_2hd->ready_w(0); - } - else - m_fdc_2hd->set_ready_line_connected(1); - - // TODO: is the motor control bit really inverted relative to the other fdcs? - m_fdc_2hd->subdevice("0")->get_device()->mon_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); - m_fdc_2hd->subdevice("1")->get_device()->mon_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); - break; - } - } - else - { - switch((offset & 6) + 1) - { - case 1: m_sio->data_w(space, 0, data); return; - case 3: m_sio->control_w(space, 0, data); return; - } - logerror("Write to undefined port [%02x] <- %02x\n",offset+0x90,data); - } -} - - -READ8_MEMBER(pc9801_state::pc9801_fdc_2dd_r) -{ - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: return m_fdc_2dd->msr_r(space, 0, 0xff); - case 2: return m_fdc_2dd->fifo_r(space, 0, 0xff); - case 4: - { - int ret = (!m_fdc_2dd->subdevice("0")->get_device()->ready_r()) ? 0x10 : 0; - ret |= (m_fdc_2dd->subdevice("1")->get_device()->ready_r()) ? 0x10 : 0; - return ret | 0x40; //unknown port meaning, might be 0x70 - } - } - } - else - { - logerror("Read to undefined port [%02x]\n",offset+0xc8); - return 0xff; - } - - return 0xff; -} - -WRITE8_MEMBER(pc9801_state::pc9801_fdc_2dd_w) -{ - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: logerror("Write to undefined port [%02x] <- %02x\n",offset+0xc8,data); return; - case 2: m_fdc_2dd->fifo_w(space, 0, data, 0xff); return; - case 4: - logerror("%02x ctrl\n",data); - if(((m_fdc_2dd_ctrl & 0x80) == 0) && (data & 0x80)) - m_fdc_2dd->soft_reset(); - - m_fdc_2dd_ctrl = data; - m_fdc_2dd->subdevice("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); - m_fdc_2dd->subdevice("1")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); - break; - } - } - else - { - logerror("Write to undefined port [%02x] <- %02x\n",offset+0xc8,data); - } -} - - -/* TODO: banking? */ -READ16_MEMBER(pc9801_state::tvram_r) -{ - UINT16 res; - - if((offset & 0x1000) && (mem_mask == 0xff00)) - return 0xffff; - - res = m_tvram[offset]; - - return res; -} - -WRITE16_MEMBER(pc9801_state::tvram_w) -{ - if(offset < (0x3fe2>>1) || m_video_ff[MEMSW_REG]) - COMBINE_DATA(&m_tvram[offset]); - - COMBINE_DATA(&m_video_ram_1[offset]); //TODO: check me -} - -/* +0x8000 is trusted (bank 0 is actually used by 16 colors mode) */ -READ8_MEMBER(pc9801_state::gvram_r) -{ - return BITSWAP8(m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] >> ((offset & 1) << 3),0,1,2,3,4,5,6,7); -} - -WRITE8_MEMBER(pc9801_state::gvram_w) -{ - UINT16 ram = m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000]; - int mask = (offset & 1) << 3; - data = BITSWAP8(data,0,1,2,3,4,5,6,7); - m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] = (ram & (0xff00 >> mask)) | (data << mask); -} - -UINT16 pc9801_state::egc_shift(int plane, UINT16 val) -{ - int src_off = m_egc.regs[6] & 0xf, dst_off = (m_egc.regs[6] >> 4) & 0xf; - int left = src_off - dst_off, right = dst_off - src_off; - UINT16 out; - if(m_egc.regs[6] & 0x1000) - { - if(right >= 0) - { - out = (val >> right) | m_egc.leftover[plane]; - m_egc.leftover[plane] = val << (16 - right); - } - else - { - out = (val >> (16 - left)) | m_egc.leftover[plane]; - m_egc.leftover[plane] = val << left; - } - } - else - { - if(right >= 0) - { - out = (val << right) | m_egc.leftover[plane]; - m_egc.leftover[plane] = val >> (16 - right); - } - else - { - out = (val << (16 - left)) | m_egc.leftover[plane]; - m_egc.leftover[plane] = val >> left; - } - } - return out; -} - -UINT16 pc9801_state::egc_do_partial_op(int plane, UINT16 src, UINT16 pat, UINT16 dst) -{ - UINT16 out = 0; - - for(int i = 7; i >= 0; i--) - { - if(BIT(m_egc.regs[2], i)) - out |= src & pat & dst; - pat = ~pat; - dst = (!(i & 1)) ? ~dst : dst; - src = (i == 4) ? ~src : src; - } - return out; -} - -void pc9801_state::egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask) -{ - UINT16 mask = m_egc.regs[4] & mem_mask, out = 0; - bool dir = !(m_egc.regs[6] & 0x1000); - int dst_off = (m_egc.regs[6] >> 4) & 0xf, src_off = m_egc.regs[6] & 0xf; - offset &= 0x13fff; - - if(!m_egc.init && (src_off > dst_off)) - { - if(BIT(m_egc.regs[2], 10)) - { - m_egc.leftover[0] = 0; - egc_shift(0, data); - // leftover[0] is inited above, set others to same - m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = m_egc.leftover[0]; - } - m_egc.init = true; - return; - } - - // mask off the bits before the start - if(m_egc.first) - { - mask &= dir ? ~((1 << dst_off) - 1) : ((1 << (16 - dst_off)) - 1); - if(BIT(m_egc.regs[2], 10) && !m_egc.init) - m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0; - } - - // mask off the bits past the end of the blit - if(m_egc.count < 16) - { - UINT16 end_mask = dir ? ((1 << m_egc.count) - 1) : ~((1 << (16 - m_egc.count)) - 1); - // if the blit is less than 16 bits, adjust the masks - if(m_egc.first) - { - if(dir) - end_mask <<= dst_off; - else - end_mask >>= dst_off; - } - mask &= end_mask; - } - - for(int i = 0; i < 4; i++) - { - if(!BIT(m_egc.regs[0], i)) - { - UINT16 src = m_egc.src[i] & mem_mask, pat = m_egc.pat[i]; - if(BIT(m_egc.regs[2], 10)) - src = egc_shift(i, data); - - if((m_egc.regs[2] & 0x300) == 0x200) - pat = m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)]; - - switch((m_egc.regs[2] >> 11) & 3) - { - case 0: - out = data; - break; - case 1: - if(mem_mask == 0x00ff) - src = src | src << 8; - else if(mem_mask == 0xff00) - src = src | src >> 8; - - out = egc_do_partial_op(i, src, pat, m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)]); - break; - case 2: - out = pat; - break; - case 3: - logerror("Invalid EGC blit operation\n"); - return; - } - - m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)] &= ~mask; - m_video_ram_2[offset + (((i + 1) & 3) * 0x4000)] |= out & mask; - } - } - if(mem_mask != 0xffff) - { - if(m_egc.first) - m_egc.count -= 8 - (dst_off & 7); - else - m_egc.count -= 8; - } - else - { - if(m_egc.first) - m_egc.count -= 16 - dst_off; - else - m_egc.count -= 16; - } - - m_egc.first = false; - - if(m_egc.count <= 0) - { - m_egc.first = true; - m_egc.init = false; - m_egc.count = (m_egc.regs[7] & 0xfff) + 1; - } -} - -UINT16 pc9801_state::egc_blit_r(UINT32 offset, UINT16 mem_mask) -{ - UINT32 plane_off = offset & 0x13fff; - if((m_egc.regs[2] & 0x300) == 0x100) - { - m_egc.pat[0] = m_video_ram_2[plane_off + 0x4000]; - m_egc.pat[1] = m_video_ram_2[plane_off + (0x4000 * 2)]; - m_egc.pat[2] = m_video_ram_2[plane_off + (0x4000 * 3)]; - m_egc.pat[3] = m_video_ram_2[plane_off]; - } - if(m_egc.first && !m_egc.init) - { - m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0; - m_egc.init = true; - } - for(int i = 0; i < 4; i++) - m_egc.src[i] = egc_shift(i, m_video_ram_2[plane_off + (((i + 1) & 3) * 0x4000)]); - - if(BIT(m_egc.regs[2], 13)) - return m_video_ram_2[offset]; - else - return m_egc.src[(m_egc.regs[1] >> 8) & 3]; -} - -READ16_MEMBER(pc9801_state::upd7220_grcg_r) -{ - UINT16 res = 0; - - if(!(m_grcg.mode & 0x80) || space.debugger_access()) - res = m_video_ram_2[offset]; - else if(m_ex_video_ff[2]) - res = egc_blit_r(offset, mem_mask); - else if(!(m_grcg.mode & 0x40)) - { - int i; - - offset &= 0x13fff; - res = 0; - for(i=0;i<4;i++) - { - if((m_grcg.mode & (1 << i)) == 0) - { - res |= m_video_ram_2[offset | (((i + 1) & 3) * 0x4000)] ^ (m_grcg.tile[i] | m_grcg.tile[i] << 8); - } - } - - res ^= 0xffff; - } - - return res; -} - -WRITE16_MEMBER(pc9801_state::upd7220_grcg_w) -{ - if(!(m_grcg.mode & 0x80)) - COMBINE_DATA(&m_video_ram_2[offset]); - else if(m_ex_video_ff[2]) - egc_blit_w(offset, data, mem_mask); - else - { - int i; - UINT8 *vram = (UINT8 *)m_video_ram_2.target(); - offset = (offset << 1) & 0x27fff; - - if(m_grcg.mode & 0x40) // RMW - { - for(i=0;i<4;i++) - { - if((m_grcg.mode & (1 << i)) == 0) - { - if(mem_mask & 0xff) - { - vram[offset | (((i + 1) & 3) * 0x8000)] &= ~(data >> 0); - vram[offset | (((i + 1) & 3) * 0x8000)] |= m_grcg.tile[i] & (data >> 0); - } - if(mem_mask & 0xff00) - { - vram[offset | (((i + 1) & 3) * 0x8000) | 1] &= ~(data >> 8); - vram[offset | (((i + 1) & 3) * 0x8000) | 1] |= m_grcg.tile[i] & (data >> 8); - } - } - } - } - else // TDW - { - for(i=0;i<4;i++) - { - if((m_grcg.mode & (1 << i)) == 0) - { - if(mem_mask & 0xff) - vram[offset | (((i + 1) & 3) * 0x8000)] = m_grcg.tile[i]; - if(mem_mask & 0xff00) - vram[offset | (((i + 1) & 3) * 0x8000) | 1] = m_grcg.tile[i]; - } - } - } - } -} - -READ8_MEMBER(pc9801_state::ide_hack_r) -{ - address_space &ram = m_maincpu->space(AS_PROGRAM); - // this makes the ide driver not do 512 to 256 byte sector translation, the 9821 looks for bit 6 of offset 0xac403 of the kanji ram to set this, the rs unknown - ram.write_byte(0x457, ram.read_byte(0x457) | 0xc0); - return 0xff; -} - -READ8_MEMBER( pc9801_state::sasi_data_r ) -{ - UINT8 data = m_sasi_data_in->read(); - - if(m_sasi_ctrl_in->read() & 0x80) - m_sasibus->write_ack(1); - return data; -} - -WRITE8_MEMBER( pc9801_state::sasi_data_w ) -{ - m_sasi_data = data; - - if (m_sasi_data_enable) - { - m_sasi_data_out->write(m_sasi_data); - if(m_sasi_ctrl_in->read() & 0x80) - m_sasibus->write_ack(1); - } -} - -WRITE_LINE_MEMBER( pc9801_state::write_sasi_io ) -{ - m_sasi_ctrl_in->write_bit2(state); - - m_sasi_data_enable = !state; - - if (m_sasi_data_enable) - { - m_sasi_data_out->write(m_sasi_data); - } - else - { - m_sasi_data_out->write(0); - } - if((m_sasi_ctrl_in->read() & 0x9C) == 0x8C) - m_pic2->ir1_w(m_sasi_ctrl & 1); - else - m_pic2->ir1_w(0); -} - -WRITE_LINE_MEMBER( pc9801_state::write_sasi_req ) -{ - m_sasi_ctrl_in->write_bit7(state); - - if (!state) - m_sasibus->write_ack(0); - - if((m_sasi_ctrl_in->read() & 0x9C) == 0x8C) - m_pic2->ir1_w(m_sasi_ctrl & 1); - else - m_pic2->ir1_w(0); - - m_dmac->dreq0_w(!(state && !(m_sasi_ctrl_in->read() & 8) && (m_sasi_ctrl & 2))); -} - - -READ8_MEMBER( pc9801_state::sasi_status_r ) -{ - UINT8 res = 0; - - if(m_sasi_ctrl & 0x40) // read status - { - /* - x--- ---- REQ - -x-- ---- ACK - --x- ---- BSY - ---x ---- MSG - ---- x--- CD - ---- -x-- IO - ---- ---x INT? - */ - res |= m_sasi_ctrl_in->read(); - } - else // read drive info - { -/* - xx-- ---- unknown but tested - --xx x--- SASI-1 media type - ---- -xxx SASI-2 media type -*/ - //res |= 7 << 3; // read mediatype SASI-1 - //res |= 7; // read mediatype SASI-2 - } - return res; -} - -WRITE8_MEMBER( pc9801_state::sasi_ctrl_w ) -{ - /* - x--- ---- channel enable - -x-- ---- read switch - --x- ---- sel - ---- x--- reset line - ---- --x- dma enable - ---- ---x irq enable - */ - - m_sasibus->write_sel(BIT(data, 5)); - - if(m_sasi_ctrl & 8 && ((data & 8) == 0)) // 1 -> 0 transition - { - m_sasibus->write_rst(1); -// m_timer_rst->adjust(attotime::from_nsec(100)); - } - else - m_sasibus->write_rst(0); // TODO - - m_sasi_ctrl = data; - -// m_sasibus->write_sel(BIT(data, 0)); -} - -static ADDRESS_MAP_START( pc9801_map, AS_PROGRAM, 16, pc9801_state ) - AM_RANGE(0x00000, 0x9ffff) AM_RAM //work RAM - AM_RANGE(0xa0000, 0xa3fff) AM_READWRITE(tvram_r,tvram_w) //TVRAM - AM_RANGE(0xa8000, 0xbffff) AM_READWRITE8(gvram_r,gvram_w,0xffff) //bitmap VRAM - AM_RANGE(0xcc000, 0xcdfff) AM_ROM AM_REGION("sound_bios",0) //sound BIOS - AM_RANGE(0xd6000, 0xd6fff) AM_ROM AM_REGION("fdc_bios_2dd",0) //floppy BIOS 2dd - AM_RANGE(0xd7000, 0xd7fff) AM_ROM AM_REGION("fdc_bios_2hd",0) //floppy BIOS 2hd - AM_RANGE(0xe8000, 0xfffff) AM_ROM AM_REGION("ipl",0) -ADDRESS_MAP_END - -/* first device is even offsets, second one is odd offsets */ -static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("i8237", am9517a_device, read, write, 0xff00) - AM_RANGE(0x0000, 0x000f) AM_READWRITE8(pic_r, pic_w, 0x00ff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA - AM_RANGE(0x0020, 0x0027) AM_WRITE8(rtc_dmapg_w,0xffff) // RTC / DMA registers (LS244) - AM_RANGE(0x0030, 0x0037) AM_DEVREADWRITE8("ppi8255_sys", i8255_device, read, write, 0xff00) //i8251 RS232c / i8255 system port - AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255_prn", i8255_device, read, write, 0x00ff) - AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("keyb", pc9801_kbd_device, rx_r, tx_w, 0xff00) //i8255 printer port / i8251 keyboard - AM_RANGE(0x0050, 0x0057) AM_DEVREADWRITE8("ppi8255_fdd", i8255_device, read, write, 0xff00) - AM_RANGE(0x0050, 0x0053) AM_WRITE8(nmi_ctrl_w,0x00ff) // NMI FF / i8255 floppy port (2d?) - AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("upd7220_chr", upd7220_device, read, write, 0x00ff) //upd7220 character ports / - AM_RANGE(0x0064, 0x0065) AM_WRITE8(vrtc_clear_w,0x00ff) - AM_RANGE(0x0068, 0x0069) AM_WRITE8(pc9801_video_ff_w,0x00ff) //mode FF / -// AM_RANGE(0x006c, 0x006f) border color / - AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00) - AM_RANGE(0x0070, 0x007b) AM_READWRITE8(txt_scrl_r,txt_scrl_w,0x00ff) //display registers / i8253 pit - AM_RANGE(0x0080, 0x0081) AM_READWRITE8(sasi_data_r, sasi_data_w, 0x00ff) - AM_RANGE(0x0082, 0x0083) AM_READWRITE8(sasi_status_r, sasi_ctrl_w,0x00ff) - AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801_fdc_2hd_r,pc9801_fdc_2hd_w,0xffff) //upd765a 2hd / cmt - AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,pc9801_a0_w,0xffff) //upd7220 bitmap ports / display registers - AM_RANGE(0x00c8, 0x00cd) AM_READWRITE8(pc9801_fdc_2dd_r,pc9801_fdc_2dd_w,0xffff) //upd765a 2dd / -// AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,pc9801_opn_w,0xffff) //ym2203 opn / - AM_RANGE(0x7fd8, 0x7fdf) AM_DEVREADWRITE8("ppi8255_mouse", i8255_device, read, write, 0xff00) -ADDRESS_MAP_END - -/************************************* - * - * PC-9801RS specific handlers (IA-32) - * - ************************************/ - -READ8_MEMBER(pc9801_state::pc9801rs_ipl_r) { return m_ipl_rom[(offset & 0x1ffff)+(m_rom_bank*0x20000)]; } - -/* TODO: it's possible that the offset calculation is actually linear. */ -/* TODO: having this non-linear makes the system to boot in BASIC for PC-9821. Perhaps it stores settings? How to change these? */ -READ8_MEMBER(pc9801_state::pc9801rs_knjram_r) -{ - UINT32 pcg_offset; - - pcg_offset = m_font_addr << 5; - pcg_offset|= offset & 0x1e; - pcg_offset|= m_font_lr; - - if(!(m_font_addr & 0xff)) - { - int char_size = m_video_ff[FONTSEL_REG]; - return m_char_rom[(m_font_addr >> 8) * (8 << char_size) + (char_size * 0x800) + ((offset >> 1) & 0xf)]; - } - - /* TODO: investigate on this difference */ - if((m_font_addr & 0xff00) == 0x5600 || (m_font_addr & 0xff00) == 0x5700) - return m_kanji_rom[pcg_offset]; - - pcg_offset = m_font_addr << 5; - pcg_offset|= offset & 0x1f; -// pcg_offset|= m_font_lr; - - return m_kanji_rom[pcg_offset]; -} - -WRITE8_MEMBER(pc9801_state::pc9801rs_knjram_w) -{ - UINT32 pcg_offset; - - pcg_offset = m_font_addr << 5; - pcg_offset|= offset & 0x1e; - pcg_offset|= m_font_lr; - - if((m_font_addr & 0xff00) == 0x5600 || (m_font_addr & 0xff00) == 0x5700) - { - m_kanji_rom[pcg_offset] = data; - m_gfxdecode->gfx(2)->mark_dirty(pcg_offset >> 5); - } -} - -/* FF-based */ -WRITE8_MEMBER(pc9801_state::pc9801rs_bank_w) -{ - if(offset == 1) - { - if((data & 0xf0) == 0x00 || (data & 0xf0) == 0x10) - { - if((data & 0xed) == 0x00) - { - m_rom_bank = (data & 2) >> 1; - return; - } - } - - logerror("Unknown EMS ROM setting %02x\n",data); - } - if(offset == 3) - { - if((data & 0xf0) == 0x20) - m_vram_bank = (data & 2) >> 1; - else - { - logerror("Unknown EMS RAM setting %02x\n",data); - } - } -} - -READ8_MEMBER(pc9801_state::a20_ctrl_r) -{ - if(offset == 0x01) - return (m_gate_a20 ^ 1) | 0xfe; - else if(offset == 0x03) - return (m_gate_a20 ^ 1) | (m_nmi_enable << 1); - - return 0x00; -} - -WRITE8_MEMBER(pc9801_state::a20_ctrl_w) -{ - if(offset == 0x00) - { - UINT8 por; - /* reset POR bit, TODO: is there any other way? */ - por = machine().device("ppi8255_sys")->read(space, 2) & ~0x20; - machine().device("ppi8255_sys")->write(space, 2,por); - m_maincpu->set_input_line(INPUT_LINE_A20, 0); - m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - m_gate_a20 = 0; - } - - if(offset == 0x01) - m_gate_a20 = 1; - - if(offset == 0x03) - { - if(data == 0x02) - m_gate_a20 = 1; - else if(data == 0x03) - m_gate_a20 = 0; - } - m_maincpu->set_input_line(INPUT_LINE_A20, m_gate_a20); -} - -READ8_MEMBER(pc9801_state::grcg_r) -{ - if(offset == 6) - { - logerror("GRCG mode R\n"); - return 0xff; - } - else if(offset == 7) - { - logerror("GRCG tile R\n"); - return 0xff; - } - return txt_scrl_r(space,offset); -} - -WRITE8_MEMBER(pc9801_state::grcg_w) -{ - if(offset == 6) - { -// logerror("%02x GRCG MODE\n",data); - m_grcg.mode = data; - m_grcg.tile_index = 0; - return; - } - else if(offset == 7) - { -// logerror("%02x GRCG TILE %02x\n",data,m_grcg.tile_index); - m_grcg.tile[m_grcg.tile_index] = BITSWAP8(data,0,1,2,3,4,5,6,7); - m_grcg.tile_index ++; - m_grcg.tile_index &= 3; - return; - } - - txt_scrl_w(space,offset,data); -} - -WRITE16_MEMBER(pc9801_state::egc_w) -{ - if(!m_ex_video_ff[2]) - return; - - if(!(m_egc.regs[1] & 0x6000) || (offset != 4)) // why? - COMBINE_DATA(&m_egc.regs[offset]); - switch(offset) - { - case 1: - case 3: - case 5: - { - UINT8 color = 0; - switch((m_egc.regs[1] >> 13) & 3) - { - case 1: - //back color - color = m_egc.regs[5]; - break; - case 2: - //fore color - color = m_egc.regs[3]; - break; - default: - return; - } - m_egc.pat[0] = (color & 1) ? 0xffff : 0; - m_egc.pat[1] = (color & 2) ? 0xffff : 0; - m_egc.pat[2] = (color & 4) ? 0xffff : 0; - m_egc.pat[3] = (color & 8) ? 0xffff : 0; - break; - } - case 6: - case 7: - m_egc.count = (m_egc.regs[7] & 0xfff) + 1; - m_egc.first = true; - m_egc.init = false; - break; - } -} - -READ8_MEMBER(pc9801_state::pc9810rs_fdc_ctrl_r) -{ - return (m_fdc_ctrl & 3) | 0xf0 | 8 | 4; -} - -WRITE8_MEMBER(pc9801_state::pc9810rs_fdc_ctrl_w) -{ - /* - ---- x--- ready line? - ---- --x- select type (1) 2hd (0) 2dd - ---- ---x select irq - */ - - m_fdc_2hd->subdevice("0")->get_device()->set_rpm(data & 0x02 ? 360 : 300); - m_fdc_2hd->subdevice("1")->get_device()->set_rpm(data & 0x02 ? 360 : 300); - - m_fdc_2hd->set_rate(data & 0x02 ? 500000 : 250000); - - m_fdc_ctrl = data; - //if(data & 0xfc) - // logerror("FDC ctrl called with %02x\n",data); -} - -READ8_MEMBER(pc9801_state::pc9801rs_2hd_r) -{ - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: return m_fdc_2hd->msr_r(space, 0, 0xff); - case 2: return m_fdc_2hd->fifo_r(space, 0, 0xff); - case 4: return 0x44; //2hd flag - } - } - - logerror("Read to undefined port [%02x]\n",offset+0x90); - - return 0xff; -} - -WRITE8_MEMBER(pc9801_state::pc9801rs_2hd_w) -{ - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 2: m_fdc_2hd->fifo_w(space, 0, data, 0xff); return; - case 4: - if(data & 0x80) - m_fdc_2hd->soft_reset(); - - if(data & 0x40) - { - m_fdc_2hd->set_ready_line_connected(0); - m_fdc_2hd->ready_w(0); - } - else - m_fdc_2hd->set_ready_line_connected(1); - - //TODO: verify - if(!(m_fdc_ctrl & 4)) - { - m_fdc_2hd->subdevice("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); - m_fdc_2hd->subdevice("1")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); - } - return; - } - } - - logerror("Write to undefined port [%02x] %02x\n",offset+0x90,data); -} - -#if 0 -READ8_MEMBER(pc9801_state::pc9801rs_2dd_r) -{ -// if(m_fdc_ctrl & 1) -// return 0xff; - - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: return machine().device("upd765_2hd")->msr_r(space, 0, 0xff); - case 2: return machine().device("upd765_2hd")->fifo_r(space, 0, 0xff); - case 4: return 0x44; //2dd flag - } - } - - logerror("Read to undefined port [%02x]\n",offset+0x90); - - return 0xff; -} - -WRITE8_MEMBER(pc9801_state::pc9801rs_2dd_w) -{ -// if(m_fdc_ctrl & 1) -// return; - - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 2: machine().device("upd765_2hd")->fifo_w(space, 0, data, 0xff); return; - case 4: logerror("%02x 2DD FDC ctrl\n",data); return; - } - } - - logerror("Write to undefined port [%02x] %02x\n",offset+0x90,data); -} -#endif - -WRITE8_MEMBER(pc9801_state::pc9801rs_video_ff_w) -{ - if(offset == 1) - { - if((data & 0xf0) == 0) /* disable any PC-9821 specific HW regs */ - m_ex_video_ff[(data & 0xfe) >> 1] = data & 1; - - if(0) - { - static const char *const ex_video_ff_regnames[] = - { - "16 colors mode", // 0 - "", // 1 - "EGC related", // 2 - "" // 3 - }; - - logerror("Write to extended video FF register %s -> %02x\n",ex_video_ff_regnames[(data & 0x06) >> 1],data & 1); - } - //else - // logerror("Write to extended video FF register %02x\n",data); - - return; - } - - pc9801_video_ff_w(space,offset,data); -} - -WRITE8_MEMBER(pc9801_state::pc9801rs_a0_w) -{ - if((offset & 1) == 0 && offset & 8 && m_ex_video_ff[ANALOG_16_MODE]) - { - switch(offset) - { - case 0x08: m_analog16.pal_entry = data & 0xf; break; - case 0x0a: m_analog16.g[m_analog16.pal_entry] = data & 0xf; break; - case 0x0c: m_analog16.r[m_analog16.pal_entry] = data & 0xf; break; - case 0x0e: m_analog16.b[m_analog16.pal_entry] = data & 0xf; break; - } - - m_palette->set_pen_color((m_analog16.pal_entry)+0x10, - pal4bit(m_analog16.r[m_analog16.pal_entry]), - pal4bit(m_analog16.g[m_analog16.pal_entry]), - pal4bit(m_analog16.b[m_analog16.pal_entry])); - return; - } - - pc9801_a0_w(space,offset,data); -} - -READ8_MEMBER( pc9801_state::pc9801rs_access_ctrl_r ) -{ - if(offset == 1) - return m_access_ctrl; - - return 0xff; -} - -WRITE8_MEMBER( pc9801_state::pc9801rs_access_ctrl_w ) -{ - if(offset == 1) - m_access_ctrl = data; -} - -WRITE8_MEMBER( pc9801_state::pc9801rs_mouse_freq_w ) -{ - /* TODO: bit 3 used */ - if(offset == 3) - { - m_mouse.freq_reg = data & 3; - m_mouse.freq_index = 0; - } -} - - -WRITE8_MEMBER( pc9801_state::pc9801rs_nmi_w ) -{ - if(offset == 0) - m_nmi_enable = 0; - - if(offset == 2) - m_nmi_enable = 1; -} - -READ8_MEMBER( pc9801_state::pc9801rs_midi_r ) -{ - /* unconnect, needed by Amaranth KH to boot */ - return 0xff; -} - -READ8_MEMBER(pc9801_state::pic_r) -{ - return ((offset >= 4) ? m_pic2 : m_pic1)->read(space, offset & 3); -} - -WRITE8_MEMBER(pc9801_state::pic_w) -{ - ((offset >= 4) ? m_pic2 : m_pic1)->write(space, offset & 3, data); -} - -READ16_MEMBER(pc9801_state::grcg_gvram_r) -{ - UINT16 ret = upd7220_grcg_r(space, (offset + 0x4000) | (m_vram_bank << 16), mem_mask); - return BITSWAP16(ret,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); -} - -WRITE16_MEMBER(pc9801_state::grcg_gvram_w) -{ - data = BITSWAP16(data,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); - upd7220_grcg_w(space, (offset + 0x4000) | (m_vram_bank << 16), data, mem_mask); -} - -READ16_MEMBER(pc9801_state::grcg_gvram0_r) -{ - UINT16 ret = upd7220_grcg_r(space, offset | (m_vram_bank << 16), mem_mask); - return BITSWAP16(ret,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); -} - -WRITE16_MEMBER(pc9801_state::grcg_gvram0_w) -{ - data = BITSWAP16(data,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); - upd7220_grcg_w(space, offset | (m_vram_bank << 16), data, mem_mask); -} - -static ADDRESS_MAP_START( pc9801ux_map, AS_PROGRAM, 16, pc9801_state ) - AM_RANGE(0x000000, 0x09ffff) AM_RAMBANK("wram") - AM_RANGE(0x0a0000, 0x0a3fff) AM_READWRITE(tvram_r, tvram_w) - AM_RANGE(0x0a4000, 0x0a4fff) AM_READWRITE8(pc9801rs_knjram_r, pc9801rs_knjram_w, 0xffff) - AM_RANGE(0x0a8000, 0x0bffff) AM_READWRITE(grcg_gvram_r, grcg_gvram_w) - AM_RANGE(0x0e0000, 0x0e7fff) AM_READWRITE(grcg_gvram0_r,grcg_gvram0_w) - AM_RANGE(0x0e0000, 0x0fffff) AM_READ8(pc9801rs_ipl_r, 0xffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc9801ux_io, AS_IO, 16, pc9801_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0050, 0x0057) AM_NOP // 2dd ppi? - AM_RANGE(0x005c, 0x005f) AM_READ(pc9821_timestamp_r) AM_WRITENOP // artic - AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9801rs_video_ff_w,0x00ff) //mode FF / - AM_RANGE(0x0070, 0x007f) AM_READWRITE8(grcg_r, grcg_w, 0x00ff) //display registers "GRCG" / i8253 pit - AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffff) - AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r, pc9801rs_a0_w, 0xffff) //upd7220 bitmap ports / display registers - AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffff) - AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffff) - AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(a20_ctrl_r, a20_ctrl_w, 0x00ff) - AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffff) - AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffff) //ROM/RAM bank - AM_RANGE(0x04a0, 0x04af) AM_WRITE(egc_w) - AM_RANGE(0x3fd8, 0x3fdf) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00) -// AM_RANGE(0xa460, 0xa463) AM_READWRITE8(pc9801_ext_opna_r, pc9801_ext_opna_w, 0xffff) - AM_IMPORT_FROM(pc9801_io) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc9801rs_map, AS_PROGRAM, 16, pc9801_state ) -// AM_RANGE(0x0d8000, 0x0d9fff) AM_ROM AM_REGION("ide",0) - AM_RANGE(0x0da000, 0x0dbfff) AM_RAM // ide ram - AM_RANGE(0xee0000, 0xefffff) AM_READ8(pc9801rs_ipl_r, 0xffff) - AM_RANGE(0xfe0000, 0xffffff) AM_READ8(pc9801rs_ipl_r, 0xffff) - AM_IMPORT_FROM(pc9801ux_map) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc9801rs_io, AS_IO, 16, pc9801_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0050, 0x0053) AM_WRITE8(pc9801rs_nmi_w, 0xffff) - AM_RANGE(0x0430, 0x0433) AM_READ8(ide_hack_r, 0x00ff) - AM_RANGE(0x0640, 0x064f) AM_DEVREADWRITE("ide", ata_interface_device, read_cs0, write_cs0) - AM_RANGE(0x0740, 0x074f) AM_DEVREADWRITE("ide", ata_interface_device, read_cs1, write_cs1) - AM_RANGE(0xbfd8, 0xbfdf) AM_WRITE8(pc9801rs_mouse_freq_w, 0xffff) - AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(pc9801rs_midi_r, 0xffff) - AM_IMPORT_FROM(pc9801ux_io) -ADDRESS_MAP_END - -/************************************* - * - * PC-9821 specific handlers - * - ************************************/ - -WRITE8_MEMBER(pc9801_state::pc9821_video_ff_w) -{ - if(offset == 1) - { - m_ex_video_ff[(data & 0xfe) >> 1] = data & 1; - - //if((data & 0xfe) == 0x20) - // logerror("%02x\n",data & 1); - } - - /* Intentional fall-through */ - pc9801rs_video_ff_w(space,offset,data); -} - -READ8_MEMBER(pc9801_state::pc9821_a0_r) -{ - if((offset & 1) == 0 && offset & 8) - { - if(m_ex_video_ff[ANALOG_256_MODE]) - { - logerror("256 color mode [%02x] R\n",offset); - return 0; - } - else if(m_ex_video_ff[ANALOG_16_MODE]) //16 color mode, readback possible there - { - UINT8 res = 0; - - switch(offset) - { - case 0x08: res = m_analog16.pal_entry & 0xf; break; - case 0x0a: res = m_analog16.g[m_analog16.pal_entry] & 0xf; break; - case 0x0c: res = m_analog16.r[m_analog16.pal_entry] & 0xf; break; - case 0x0e: res = m_analog16.b[m_analog16.pal_entry] & 0xf; break; - } - - return res; - } - } - - return pc9801_a0_r(space,offset); -} - -WRITE8_MEMBER(pc9801_state::pc9821_a0_w) -{ - if((offset & 1) == 0 && offset & 8 && m_ex_video_ff[ANALOG_256_MODE]) - { - switch(offset) - { - case 0x08: m_analog256.pal_entry = data & 0xff; break; - case 0x0a: m_analog256.g[m_analog256.pal_entry] = data & 0xff; break; - case 0x0c: m_analog256.r[m_analog256.pal_entry] = data & 0xff; break; - case 0x0e: m_analog256.b[m_analog256.pal_entry] = data & 0xff; break; - } - - m_palette->set_pen_color((m_analog256.pal_entry)+0x20, - m_analog256.r[m_analog256.pal_entry], - m_analog256.g[m_analog256.pal_entry], - m_analog256.b[m_analog256.pal_entry]); - return; - } - - pc9801rs_a0_w(space,offset,data); -} - -READ8_MEMBER(pc9801_state::pc9821_window_bank_r) -{ - if(offset == 1) - return m_pc9821_window_bank & 0xfe; - - return 0xff; -} - -WRITE8_MEMBER(pc9801_state::pc9821_window_bank_w) -{ - if(offset == 1) - m_pc9821_window_bank = data & 0xfe; - else - logerror("PC-9821 $f0000 window bank %02x\n",data); -} - -UINT8 pc9801_state::m_sdip_read(UINT16 port, UINT8 sdip_offset) -{ - if(port == 2) - return m_sdip[sdip_offset]; - - logerror("Warning: read from unknown SDIP area %02x %04x\n",port,0x841c + port + (sdip_offset % 12)*0x100); - return 0xff; -} - -void pc9801_state::m_sdip_write(UINT16 port, UINT8 sdip_offset,UINT8 data) -{ - if(port == 2) - { - m_sdip[sdip_offset] = data; - return; - } - - logerror("Warning: write from unknown SDIP area %02x %04x %02x\n",port,0x841c + port + (sdip_offset % 12)*0x100,data); -} - -READ8_MEMBER(pc9801_state::sdip_0_r) { return m_sdip_read(offset, 0+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_1_r) { return m_sdip_read(offset, 1+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_2_r) { return m_sdip_read(offset, 2+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_3_r) { return m_sdip_read(offset, 3+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_4_r) { return m_sdip_read(offset, 4+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_5_r) { return m_sdip_read(offset, 5+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_6_r) { return m_sdip_read(offset, 6+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_7_r) { return m_sdip_read(offset, 7+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_8_r) { return m_sdip_read(offset, 8+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_9_r) { return m_sdip_read(offset, 9+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_a_r) { return m_sdip_read(offset, 10+m_sdip_bank*12); } -READ8_MEMBER(pc9801_state::sdip_b_r) { return m_sdip_read(offset, 11+m_sdip_bank*12); } - -WRITE8_MEMBER(pc9801_state::sdip_0_w) { m_sdip_write(offset,0+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_1_w) { m_sdip_write(offset,1+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_2_w) { m_sdip_write(offset,2+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_3_w) { m_sdip_write(offset,3+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_4_w) { m_sdip_write(offset,4+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_5_w) { m_sdip_write(offset,5+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_6_w) { m_sdip_write(offset,6+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_7_w) { m_sdip_write(offset,7+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_8_w) { m_sdip_write(offset,8+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_9_w) { m_sdip_write(offset,9+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_a_w) { m_sdip_write(offset,10+m_sdip_bank*12,data); } -WRITE8_MEMBER(pc9801_state::sdip_b_w) -{ - if(offset == 3) - m_sdip_bank = (data & 0x40) >> 6; - - if(offset == 2) - m_sdip_write(offset,11+m_sdip_bank*12,data); - - if((offset & 2) == 0) - logerror("SDIP area B write %02x %02x\n",offset,data); -} - -READ16_MEMBER(pc9801_state::pc9821_timestamp_r) -{ - return (m_maincpu->total_cycles() >> (16 * offset)); -} - -/* basically a read-back of various registers */ -READ8_MEMBER(pc9801_state::pc9821_ext2_video_ff_r) -{ - UINT8 res; - - res = 0; - - switch(m_ext2_ff) - { - case 3: res = m_video_ff[DISPLAY_REG]; break; // display reg - default: - logerror("PC-9821: read ext2 f/f with value %02x\n",m_ext2_ff); - } - - return res; -} - -WRITE8_MEMBER(pc9801_state::pc9821_ext2_video_ff_w) -{ - m_ext2_ff = data; -} - -/*READ8_MEMBER(pc9801_state::winram_r) -{ - offset = (offset & 0x1ffff) | (m_pc9821_window_bank & 0xfe) * 0x10000; - return -} - - -WRITE8_MEMBER(pc9801_state::winram_w) -{ - offset = (offset & 0x1ffff) | (m_pc9821_window_bank & 0xfe) * 0x10000; -}*/ - -static ADDRESS_MAP_START( pc9821_map, AS_PROGRAM, 32, pc9801_state ) - AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("wram") - //AM_RANGE(0x00080000, 0x0009ffff) AM_READWRITE8(winram_r, winram_w, 0xffffffff) - AM_RANGE(0x000a0000, 0x000a3fff) AM_READWRITE16(tvram_r, tvram_w, 0xffffffff) - AM_RANGE(0x000a4000, 0x000a4fff) AM_READWRITE8(pc9801rs_knjram_r, pc9801rs_knjram_w, 0xffffffff) - AM_RANGE(0x000a8000, 0x000bffff) AM_READWRITE16(grcg_gvram_r, grcg_gvram_w, 0xffffffff) - AM_RANGE(0x000cc000, 0x000cdfff) AM_ROM AM_REGION("sound_bios",0) //sound BIOS -// AM_RANGE(0x000d8000, 0x000d9fff) AM_ROM AM_REGION("ide",0) - AM_RANGE(0x000da000, 0x000dbfff) AM_RAM // ide ram - AM_RANGE(0x000e0000, 0x000e7fff) AM_READWRITE16(grcg_gvram0_r,grcg_gvram0_w, 0xffffffff) - AM_RANGE(0x000e0000, 0x000fffff) AM_READ8(pc9801rs_ipl_r, 0xffffffff) - AM_RANGE(0x00f00000, 0x00f9ffff) AM_RAM AM_SHARE("ext_gvram") - AM_RANGE(0xffee0000, 0xffefffff) AM_READ8(pc9801rs_ipl_r, 0xffffffff) - AM_RANGE(0xfffe0000, 0xffffffff) AM_READ8(pc9801rs_ipl_r, 0xffffffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) -// ADDRESS_MAP_UNMAP_HIGH // TODO: a read to somewhere makes this to fail at POST - AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("i8237", am9517a_device, read, write, 0xff00ff00) - AM_RANGE(0x0000, 0x000f) AM_READWRITE8(pic_r, pic_w, 0x00ff00ff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA - AM_RANGE(0x0020, 0x0027) AM_WRITE8(rtc_dmapg_w, 0xffffffff) // RTC / DMA registers (LS244) - AM_RANGE(0x0030, 0x0037) AM_DEVREADWRITE8("ppi8255_sys", i8255_device, read, write, 0xff00ff00) //i8251 RS232c / i8255 system port - AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255_prn", i8255_device, read, write, 0x00ff00ff) - AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("keyb", pc9801_kbd_device, rx_r, tx_w, 0xff00ff00) //i8255 printer port / i8251 keyboard - AM_RANGE(0x0050, 0x0053) AM_WRITE8(pc9801rs_nmi_w, 0xffffffff) - AM_RANGE(0x005c, 0x005f) AM_READ16(pc9821_timestamp_r,0xffffffff) AM_WRITENOP // artic - AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("upd7220_chr", upd7220_device, read, write, 0x00ff00ff) //upd7220 character ports / - AM_RANGE(0x0064, 0x0067) AM_WRITE8(vrtc_clear_w, 0x000000ff) - AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9821_video_ff_w, 0x00ff00ff) //mode FF / - AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00ff00) - AM_RANGE(0x0070, 0x007f) AM_READWRITE8(grcg_r, grcg_w, 0x00ff00ff) //display registers "GRCG" / i8253 pit - AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffffffff) - AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9821_a0_r, pc9821_a0_w, 0xffffffff) //upd7220 bitmap ports / display registers -// AM_RANGE(0x00b0, 0x00b3) PC9861k (serial port?) -// AM_RANGE(0x00b9, 0x00b9) PC9861k -// AM_RANGE(0x00bb, 0x00bb) PC9861k - AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffffffff) - AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffffffff) -// AM_RANGE(0x00d8, 0x00df) AMD98 (sound?) board - AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(a20_ctrl_r, a20_ctrl_w, 0x00ff00ff) -// AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffffffff) //ym2203 opn / -// AM_RANGE(0x018c, 0x018f) YM2203 OPN extended ports / - AM_RANGE(0x0430, 0x0433) AM_READ8(ide_hack_r, 0x000000ff) - AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffffffff) -// AM_RANGE(0x043d, 0x043d) ROM/RAM bank (NEC) - AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffffffff) //ROM/RAM bank (EPSON) - AM_RANGE(0x0460, 0x0463) AM_READWRITE8(pc9821_window_bank_r,pc9821_window_bank_w, 0xffffffff) - AM_RANGE(0x04a0, 0x04af) AM_WRITE16(egc_w, 0xffffffff) -// AM_RANGE(0x04be, 0x04be) FDC "RPM" register - AM_RANGE(0x0640, 0x064f) AM_DEVREADWRITE16("ide", ata_interface_device, read_cs0, write_cs0, 0xffffffff) - AM_RANGE(0x0740, 0x074f) AM_DEVREADWRITE16("ide", ata_interface_device, read_cs1, write_cs1, 0xffffffff) -// AM_RANGE(0x08e0, 0x08ea) / EMM SIO registers - AM_RANGE(0x09a0, 0x09a3) AM_READWRITE8(pc9821_ext2_video_ff_r, pc9821_ext2_video_ff_w, 0x000000ff) // GDC extended register r/w -// AM_RANGE(0x09a8, 0x09a8) GDC 31KHz register r/w -// AM_RANGE(0x0c07, 0x0c07) EPSON register w -// AM_RANGE(0x0c03, 0x0c03) EPSON register 0 r -// AM_RANGE(0x0c13, 0x0c14) EPSON register 1 r -// AM_RANGE(0x0c24, 0x0c24) cs4231 PCM board register control -// AM_RANGE(0x0c2b, 0x0c2b) cs4231 PCM board low byte control -// AM_RANGE(0x0c2d, 0x0c2d) cs4231 PCM board hi byte control -// AM_RANGE(0x0cc0, 0x0cc7) SCSI interface / -// AM_RANGE(0x0cfc, 0x0cff) PCI bus - AM_RANGE(0x3fd8, 0x3fdf) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00ff00) // / pit mirror ports - AM_RANGE(0x7fd8, 0x7fdf) AM_DEVREADWRITE8("ppi8255_mouse", i8255_device, read, write, 0xff00ff00) - AM_RANGE(0x841c, 0x841f) AM_READWRITE8(sdip_0_r,sdip_0_w,0xffffffff) - AM_RANGE(0x851c, 0x851f) AM_READWRITE8(sdip_1_r,sdip_1_w,0xffffffff) - AM_RANGE(0x861c, 0x861f) AM_READWRITE8(sdip_2_r,sdip_2_w,0xffffffff) - AM_RANGE(0x871c, 0x871f) AM_READWRITE8(sdip_3_r,sdip_3_w,0xffffffff) - AM_RANGE(0x881c, 0x881f) AM_READWRITE8(sdip_4_r,sdip_4_w,0xffffffff) - AM_RANGE(0x891c, 0x891f) AM_READWRITE8(sdip_5_r,sdip_5_w,0xffffffff) - AM_RANGE(0x8a1c, 0x8a1f) AM_READWRITE8(sdip_6_r,sdip_6_w,0xffffffff) - AM_RANGE(0x8b1c, 0x8b1f) AM_READWRITE8(sdip_7_r,sdip_7_w,0xffffffff) - AM_RANGE(0x8c1c, 0x8c1f) AM_READWRITE8(sdip_8_r,sdip_8_w,0xffffffff) - AM_RANGE(0x8d1c, 0x8d1f) AM_READWRITE8(sdip_9_r,sdip_9_w,0xffffffff) - AM_RANGE(0x8e1c, 0x8e1f) AM_READWRITE8(sdip_a_r,sdip_a_w,0xffffffff) - AM_RANGE(0x8f1c, 0x8f1f) AM_READWRITE8(sdip_b_r,sdip_b_w,0xffffffff) -// AM_RANGE(0xa460, 0xa463) AM_READWRITE8(pc9801_ext_opna_r, pc9801_ext_opna_w, 0xffffffff) -// AM_RANGE(0xa460, 0xa46f) cs4231 PCM extended port / -// AM_RANGE(0xbfdb, 0xbfdb) mouse timing port -// AM_RANGE(0xc0d0, 0xc0d3) MIDI port, option 0 / -// AM_RANGE(0xc4d0, 0xc4d3) MIDI port, option 1 / -// AM_RANGE(0xc8d0, 0xc8d3) MIDI port, option 2 / -// AM_RANGE(0xccd0, 0xccd3) MIDI port, option 3 / -// AM_RANGE(0xd0d0, 0xd0d3) MIDI port, option 4 / -// AM_RANGE(0xd4d0, 0xd4d3) MIDI port, option 5 / -// AM_RANGE(0xd8d0, 0xd8d3) MIDI port, option 6 / -// AM_RANGE(0xdcd0, 0xdcd3) MIDI port, option 7 / - AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(pc9801rs_midi_r, 0xffffffff) // MIDI port, option 8 / -// AM_RANGE(0xe4d0, 0xe4d3) MIDI port, option 9 / -// AM_RANGE(0xe8d0, 0xe8d3) MIDI port, option A / -// AM_RANGE(0xecd0, 0xecd3) MIDI port, option B / -// AM_RANGE(0xf0d0, 0xf0d3) MIDI port, option C / -// AM_RANGE(0xf4d0, 0xf4d3) MIDI port, option D / -// AM_RANGE(0xf8d0, 0xf8d3) MIDI port, option E / -// AM_RANGE(0xfcd0, 0xfcd3) MIDI port, option F / -ADDRESS_MAP_END - -static ADDRESS_MAP_START( upd7220_1_map, AS_0, 16, pc9801_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram_1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( upd7220_2_map, AS_0, 16, pc9801_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram_2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( upd7220_grcg_2_map, AS_0, 16, pc9801_state ) - AM_RANGE(0x00000, 0x3ffff) AM_READWRITE(upd7220_grcg_r, upd7220_grcg_w) AM_SHARE("video_ram_2") -ADDRESS_MAP_END - -CUSTOM_INPUT_MEMBER(pc9801_state::system_type_r) -{ -// System Type (0x00 stock PC-9801, 0xc0 PC-9801U / PC-98LT, PC-98HA, 0x80 others) - return m_sys_type; -} - -static INPUT_PORTS_START( pc9801 ) - PORT_START("DSW1") - PORT_BIT(0x0001, IP_ACTIVE_HIGH,IPT_SPECIAL) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_device, data_out_r) - PORT_DIPNAME( 0x0002, 0x0000, "DSW1" ) // error beep if OFF - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, "Display Type" ) PORT_DIPLOCATION("SW2:1") - PORT_DIPSETTING( 0x0000, "Normal Display" ) - PORT_DIPSETTING( 0x0008, "Hi-Res Display" ) - PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - - PORT_START("DSW5") - PORT_DIPNAME( 0x01, 0x00, "DSW5" ) // goes into basic with this off, PC-9801VF / PC-9801U setting - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) // V30 / V33 - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) // printer busy - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) // 8 / 4096 - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) // LCD display - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) //system clock = 5 MHz (0) / 8 MHz (1) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pc9801_state, system_type_r, NULL) - - PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, "System Specification" ) PORT_DIPLOCATION("SW1:1") //jumps to daa00 if off, presumably some card booting - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "Terminal Mode" ) PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "Text width" ) PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x04, "40 chars/line" ) - PORT_DIPSETTING( 0x00, "80 chars/line" ) - PORT_DIPNAME( 0x08, 0x00, "Text height" ) PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x08, "20 lines/screen" ) - PORT_DIPSETTING( 0x00, "25 lines/screen" ) - PORT_DIPNAME( 0x10, 0x00, "Memory Switch Init" ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) //Fix memory switch condition - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) //Initialize Memory Switch with the system default - PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW1:6" ) - PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW1:7" ) - PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW1:8" ) - - PORT_START("DSW3") - PORT_DIPNAME( 0x01, 0x01, "DSW3" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("DSW4") - PORT_DIPNAME( 0x01, 0x01, "DSW4" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("MOUSE_X") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_RESET PORT_SENSITIVITY(30) PORT_KEYDELTA(30) - - PORT_START("MOUSE_Y") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_RESET PORT_SENSITIVITY(30) PORT_KEYDELTA(30) - - PORT_START("MOUSE_B") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_CODE(MOUSECODE_BUTTON3) PORT_NAME("Mouse Middle Button") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Right Button") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Left Button") - - PORT_START("ROM_LOAD") - PORT_CONFNAME( 0x01, 0x01, "Load floppy 2hd BIOS" ) - PORT_CONFSETTING( 0x00, DEF_STR( Yes ) ) - PORT_CONFSETTING( 0x01, DEF_STR( No ) ) - PORT_CONFNAME( 0x02, 0x02, "Load floppy 2dd BIOS" ) - PORT_CONFSETTING( 0x00, DEF_STR( Yes ) ) - PORT_CONFSETTING( 0x02, DEF_STR( No ) ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc9801rs ) - PORT_INCLUDE( pc9801 ) - - PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x80, 0x80, "GDC clock" ) PORT_DIPLOCATION("SW1:8") // DSW 2-8 - PORT_DIPSETTING( 0x80, "2.5 MHz" ) - PORT_DIPSETTING( 0x00, "5 MHz" ) - - PORT_MODIFY("DSW4") - PORT_DIPNAME( 0x04, 0x00, "CPU Type" ) PORT_DIPLOCATION("SW4:8") // DSW 3-8 - PORT_DIPSETTING( 0x04, "V30" ) - PORT_DIPSETTING( 0x00, "I386" ) - - PORT_MODIFY("DSW5") - PORT_DIPNAME( 0x08, 0x00, "Graphic Function" ) // DSW 1-8 - PORT_DIPSETTING( 0x08, "Basic (8 Colors)" ) - PORT_DIPSETTING( 0x00, "Expanded (16/4096 Colors)" ) - - PORT_MODIFY("ROM_LOAD") - PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_CONFNAME( 0x04, 0x04, "Load IDE BIOS" ) - PORT_CONFSETTING( 0x00, DEF_STR( Yes ) ) - PORT_CONFSETTING( 0x04, DEF_STR( No ) ) - -// PORT_START("SOUND_CONFIG") -// PORT_CONFNAME( 0x01, 0x00, "Sound Type" ) -// PORT_CONFSETTING( 0x00, "YM2203 (OPN)" ) -// PORT_CONFSETTING( 0x01, "YM2608 (OPNA)" ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc9821 ) - PORT_INCLUDE( pc9801rs ) - - PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x01, 0x00, "S-Dip SW Init" ) PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_MODIFY("DSW3") - PORT_DIPNAME( 0x40, 0x40, "Conventional RAM size" ) PORT_DIPLOCATION("SW3:7") - PORT_DIPSETTING( 0x40, "640 KB" ) - PORT_DIPSETTING( 0x00, "512 KB" ) -INPUT_PORTS_END - -static const gfx_layout charset_8x8 = -{ - 8,8, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static const gfx_layout charset_8x16 = -{ - 8,16, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 -}; - -static const gfx_layout charset_16x16 = -{ - 16,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP16(0,1) }, - { STEP16(0,16) }, - 16*16 -}; - -static GFXDECODE_START( pc9801 ) - GFXDECODE_ENTRY( "chargen", 0x00000, charset_8x8, 0x000, 0x01 ) - GFXDECODE_ENTRY( "chargen", 0x00800, charset_8x16, 0x000, 0x01 ) - GFXDECODE_ENTRY( "kanji", 0x00000, charset_16x16, 0x000, 0x01 ) - GFXDECODE_ENTRY( "raw_kanji", 0x00000, charset_16x16, 0x000, 0x01 ) - GFXDECODE_ENTRY( "new_chargen",0, charset_16x16, 0x000, 0x01 ) -GFXDECODE_END - -/**************************************** -* -* I8259 PIC interface -* -****************************************/ - -/* -irq assignment (PC-9801F): - -8259 master: -ir0 PIT -ir1 keyboard -ir2 vblank -ir3 -ir4 rs-232c -ir5 -ir6 -ir7 slave irq - -8259 slave: -ir0 printer -ir1 IDE? -ir2 2dd floppy irq -ir3 2hd floppy irq -ir4 opn -ir5 mouse -ir6 -ir7 -*/ - - -READ8_MEMBER(pc9801_state::get_slave_ack) -{ - if (offset==7) { // IRQ = 7 - return m_pic2->acknowledge(); - } - return 0x00; -} - -/**************************************** -* -* I8253 PIT interface -* -****************************************/ - -/* basically, PC-98xx series has two xtals. - My guess is that both are on the PCB, and they clocks the various system components. - PC-9801RS needs X1 for the pit, otherwise Uchiyama Aki no Chou Bangai has sound pitch bugs - PC-9821 definitely needs X2, otherwise there's a timer error at POST. Unless it needs a different clock anyway ... - */ -#define MAIN_CLOCK_X1 XTAL_1_9968MHz -#define MAIN_CLOCK_X2 XTAL_2_4576MHz - -/**************************************** -* -* I8237 DMA interface -* -****************************************/ - -WRITE_LINE_MEMBER(pc9801_state::dma_hrq_changed) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - m_dmac->hack_w(state); - -// logerror("%02x HLDA\n",state); -} - -WRITE_LINE_MEMBER(pc9801_state::tc_w ) -{ - /* floppy terminal count */ - m_fdc_2hd->tc_w(state); - if(m_fdc_2dd) - m_fdc_2dd->tc_w(state); - -// logerror("TC %02x\n",state); -} - -READ8_MEMBER(pc9801_state::dma_read_byte) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - offs_t addr = (m_dma_offset[m_dack] << 16) | offset; - -// logerror("%08x\n",addr); - - return program.read_byte(addr); -} - - -WRITE8_MEMBER(pc9801_state::dma_write_byte) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - offs_t addr = (m_dma_offset[m_dack] << 16) | offset; - -// logerror("%08x %02x\n",addr,data); - - program.write_byte(addr, data); -} - -void pc9801_state::set_dma_channel(int channel, int state) -{ - if (!state) m_dack = channel; -} - -WRITE_LINE_MEMBER(pc9801_state::dack0_w){ /*logerror("%02x 0\n",state);*/ set_dma_channel(0, state); } -WRITE_LINE_MEMBER(pc9801_state::dack1_w){ /*logerror("%02x 1\n",state);*/ set_dma_channel(1, state); } -WRITE_LINE_MEMBER(pc9801_state::dack2_w){ /*logerror("%02x 2\n",state);*/ set_dma_channel(2, state); } -WRITE_LINE_MEMBER(pc9801_state::dack3_w){ /*logerror("%02x 3\n",state);*/ set_dma_channel(3, state); } - -/* -ch1 cs-4231a -ch2 FDC -ch3 SCSI -*/ - -/**************************************** -* -* PPI interfaces -* -****************************************/ - -WRITE8_MEMBER(pc9801_state::ppi_sys_portc_w) -{ - m_beeper->set_state(!(data & 0x08)); -} - -READ8_MEMBER(pc9801_state::ppi_mouse_porta_r) -{ - UINT8 res; - UINT8 isporthi; - const char *const mousenames[] = { "MOUSE_X", "MOUSE_Y" }; - - res = ioport("MOUSE_B")->read() & 0xf0; - isporthi = ((m_mouse.control & 0x20) >> 5)*4; - - if((m_mouse.control & 0x80) == 0) - res |= ioport(mousenames[(m_mouse.control & 0x40) >> 6])->read() >> (isporthi) & 0xf; - else - { - if(m_mouse.control & 0x40) - res |= (m_mouse.ly >> isporthi) & 0xf; - else - res |= (m_mouse.lx >> isporthi) & 0xf; - } - -// logerror("A\n"); - return res; -} - -WRITE8_MEMBER(pc9801_state::ppi_mouse_porta_w) -{ -// logerror("A %02x\n",data); -} - -WRITE8_MEMBER(pc9801_state::ppi_mouse_portb_w) -{ -// logerror("B %02x\n",data); -} - -WRITE8_MEMBER(pc9801_state::ppi_mouse_portc_w) -{ - if((m_mouse.control & 0x80) == 0 && data & 0x80) - { - m_mouse.lx = ioport("MOUSE_X")->read(); - m_mouse.ly = ioport("MOUSE_Y")->read(); - } - - m_mouse.control = data; -} - -/**************************************** -* -* UPD765 interface -* -****************************************/ - -static SLOT_INTERFACE_START( pc9801_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) - SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START( pc9801_cbus ) -// PC-9801-14 - SLOT_INTERFACE( "pc9801_26", PC9801_26 ) - SLOT_INTERFACE( "pc9801_86", PC9801_86 ) -// PC-9801-86 -// PC-9801-26 + PC-9801-86 (?) -// PC-9801-86 + Chibi-Oto - SLOT_INTERFACE( "pc9801_118", PC9801_118 ) -// Speak Board -// Spark Board -// AMD-98 (AmuseMent boarD) -SLOT_INTERFACE_END - -// Jast Sound, could be put independently - -WRITE_LINE_MEMBER( pc9801_state::fdc_2dd_irq ) -{ - logerror("IRQ 2DD %d\n",state); - - if(m_fdc_2dd_ctrl & 8) - { - m_pic2->ir2_w(state); - } -} - -WRITE_LINE_MEMBER( pc9801_state::pc9801rs_fdc_irq ) -{ - /* 0xffaf8 */ - - //logerror("%02x %d\n",m_fdc_ctrl,state); - - if(m_fdc_ctrl & 1) - m_pic2->ir3_w(state); - else - m_pic2->ir2_w(state); -} - -WRITE_LINE_MEMBER( pc9801_state::pc9801rs_fdc_drq ) -{ - if(m_fdc_ctrl & 1) - m_dmac->dreq2_w(state ^ 1); - else - m_dmac->dreq3_w(state ^ 1); -} - -UINT32 pc9801_state::pc9801_286_a20(bool state) -{ - return (state ? 0xffffff : 0x0fffff); -} - -/**************************************** -* -* Init emulation status -* -****************************************/ - -// -PALETTE_INIT_MEMBER(pc9801_state,pc9801) -{ - int i; - - for(i=0;i<8;i++) - palette.set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); - for(i=8;ics_w(1); - m_rtc->oe_w(1); - - m_ipl_rom = memregion("ipl")->base(); - m_vbirq = timer_alloc(TIMER_VBIRQ); - - save_item(NAME(m_sasi_data)); - save_item(NAME(m_sasi_data_enable)); - save_item(NAME(m_sasi_ctrl)); -} - -MACHINE_START_MEMBER(pc9801_state,pc9801f) -{ - MACHINE_START_CALL_MEMBER(pc9801_common); - - m_fdc_2hd->set_rate(500000); - m_fdc_2dd->set_rate(250000); - m_sys_type = 0x00 >> 6; -} - -MACHINE_START_MEMBER(pc9801_state,pc9801rs) -{ - MACHINE_START_CALL_MEMBER(pc9801_common); - - int ram_size = m_ram->size() - 0xa0000; - - address_space& space = m_maincpu->space(AS_PROGRAM); - membank("wram")->set_base(m_ram->pointer()); - if(ram_size) - { - space.install_read_bank(0x100000, 0x100000 + ram_size - 1, "ext_wram"); - space.install_write_bank(0x100000, 0x100000 + ram_size - 1, "ext_wram"); - membank("ext_wram")->set_base(m_ram->pointer() + 0xa0000); - } - - m_sys_type = 0x80 >> 6; -} - -MACHINE_START_MEMBER(pc9801_state,pc9801bx2) -{ - MACHINE_START_CALL_MEMBER(pc9801rs); - - save_pointer(NAME(m_sdip), 24); -} - - -MACHINE_START_MEMBER(pc9801_state,pc9821) -{ - MACHINE_START_CALL_MEMBER(pc9801rs); - - save_pointer(NAME(m_sdip), 24); -} - -MACHINE_START_MEMBER(pc9801_state,pc9821ap2) -{ - MACHINE_START_CALL_MEMBER(pc9821); - - // ... -} - -MACHINE_RESET_MEMBER(pc9801_state,pc9801_common) -{ - memset(m_tvram, 0, sizeof(UINT16) * 0x2000); - /* this looks like to be some kind of backup ram, system will boot with green colors otherwise */ - { - int i; - static const UINT8 default_memsw_data[0x10] = - { - 0xe1, 0x48, 0xe1, 0x05, 0xe1, 0x04, 0xe1, 0x00, 0xe1, 0x01, 0xe1, 0x00, 0xe1, 0x00, 0xe1, 0x6e -// 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff - }; - - for(i=0;i<0x10;i++) - m_tvram[(0x3fe0>>1)+i] = default_memsw_data[i]; - } - - m_beeper->set_frequency(2400); - m_beeper->set_state(0); - - m_nmi_ff = 0; - m_mouse.control = 0xff; - m_mouse.freq_reg = 0; - m_mouse.freq_index = 0; - memset(&m_egc, 0, sizeof(m_egc)); -} - -MACHINE_RESET_MEMBER(pc9801_state,pc9801f) -{ - MACHINE_RESET_CALL_MEMBER(pc9801_common); - - UINT8 op_mode; - UINT8 *ROM; - UINT8 *PRG = memregion("fdc_data")->base(); - int i; - - ROM = memregion("fdc_bios_2dd")->base(); - op_mode = (ioport("ROM_LOAD")->read() & 2) >> 1; - - for(i=0;i<0x1000;i++) - ROM[i] = PRG[i+op_mode*0x8000]; - - ROM = memregion("fdc_bios_2hd")->base(); - op_mode = ioport("ROM_LOAD")->read() & 1; - - for(i=0;i<0x1000;i++) - ROM[i] = PRG[i+op_mode*0x8000+0x10000]; -} - -MACHINE_RESET_MEMBER(pc9801_state,pc9801rs) -{ - MACHINE_RESET_CALL_MEMBER(pc9801_common); - - m_gate_a20 = 0; - m_rom_bank = 0; - m_fdc_ctrl = 3; - m_access_ctrl = 0; - m_keyb_press = 0xff; // temp kludge, for PC-9821 booting -// m_has_opna = ioport("SOUND_CONFIG")->read() & 1; - m_maincpu->set_input_line(INPUT_LINE_A20, m_gate_a20); - - if(!(ioport("ROM_LOAD")->read() & 4)) - m_maincpu->space(AS_PROGRAM).install_rom(0xd8000, 0xd9fff, memregion("ide")->base()); - else - m_maincpu->space(AS_PROGRAM).install_rom(0xd8000, 0xd9fff, memregion("ide")->base() + 0x2000); -} - -MACHINE_RESET_MEMBER(pc9801_state,pc9821) -{ - MACHINE_RESET_CALL_MEMBER(pc9801rs); - - m_pc9821_window_bank = 0x08; -} - -void pc9801_state::device_reset_after_children() -{ - driver_device::device_reset_after_children(); - ata_mass_storage_device *ide0 = machine().device("ide:0:hdd"); - if(ide0) - ide0->identify_device_buffer()[47] = 0; -} - -INTERRUPT_GEN_MEMBER(pc9801_state::pc9801_vrtc_irq) -{ - m_pic1->ir2_w(1); - m_vbirq->adjust(m_screen->time_until_vblank_end()); -} - - -FLOPPY_FORMATS_MEMBER( pc9801_state::floppy_formats ) - FLOPPY_PC98_FORMAT, - FLOPPY_PC98FDI_FORMAT, - FLOPPY_FDD_FORMAT, - FLOPPY_DCP_FORMAT, - FLOPPY_DIP_FORMAT, - FLOPPY_NFD_FORMAT -FLOPPY_FORMATS_END - -TIMER_DEVICE_CALLBACK_MEMBER( pc9801_state::mouse_irq_cb ) -{ - if((m_mouse.control & 0x10) == 0) - { - m_mouse.freq_index ++; - -// logerror("%02x\n",m_mouse.freq_index); - if(m_mouse.freq_index > m_mouse.freq_reg) - { -// logerror("irq %02x\n",m_mouse.freq_reg); - m_mouse.freq_index = 0; - m_pic2->ir5_w(0); - m_pic2->ir5_w(1); - } - } -} - -static MACHINE_CONFIG_FRAGMENT( pc9801_keyboard ) - MCFG_DEVICE_ADD("keyb", PC9801_KBD, 53) - MCFG_PC9801_KBD_IRQ_CALLBACK(DEVWRITELINE("pic8259_master", pic8259_device, ir1_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( pc9801_mouse ) - MCFG_DEVICE_ADD("ppi8255_mouse", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pc9801_state, ppi_mouse_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pc9801_state, ppi_mouse_porta_w)) - MCFG_I8255_IN_PORTB_CB(IOPORT("DSW3")) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pc9801_state, ppi_mouse_portb_w)) - MCFG_I8255_IN_PORTC_CB(IOPORT("DSW4")) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc9801_state, ppi_mouse_portc_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("mouse_timer", pc9801_state, mouse_irq_cb, attotime::from_hz(120)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( pc9801_cbus ) - MCFG_PC9801CBUS_SLOT_ADD("cbus0", pc9801_cbus, "pc9801_26") - MCFG_PC9801CBUS_SLOT_ADD("cbus1", pc9801_cbus, NULL) -// TODO: six max slots -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( pc9801_sasi ) - MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0) - MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in") - MCFG_SCSI_IO_HANDLER(WRITELINE(pc9801_state, write_sasi_io)) // bit2 - MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) - MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) - MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit5)) - MCFG_SCSI_ACK_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit6)) - MCFG_SCSI_REQ_HANDLER(WRITELINE(pc9801_state, write_sasi_req)) - - MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", PC9801_SASI, SCSI_ID_0) - - MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG) - MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0) - MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0) - - MCFG_DEVICE_MODIFY("i8237") - MCFG_I8237_IN_IOR_0_CB(READ8(pc9801_state, sasi_data_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc9801_state, sasi_data_w)) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_FRAGMENT( pc9801_ide ) - MCFG_ATA_INTERFACE_ADD("ide", ata_devices, "hdd", NULL, false) - MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir1_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( pc9801_common ) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(MAIN_CLOCK_X1) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259_master", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(MAIN_CLOCK_X1) /* Memory Refresh */ - MCFG_PIT8253_CLK2(MAIN_CLOCK_X1) /* RS-232c */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(pc9801_state, write_uart_clock)) - - MCFG_DEVICE_ADD("i8237", AM9517A, 5000000) // unknown clock, TODO: check channels 0 - 1 - MCFG_I8237_OUT_HREQ_CB(WRITELINE(pc9801_state, dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(pc9801_state, tc_w)) - MCFG_I8237_IN_MEMR_CB(READ8(pc9801_state, dma_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(pc9801_state, dma_write_byte)) - MCFG_I8237_IN_IOR_2_CB(DEVREAD8("upd765_2hd", upd765a_device, mdma_r)) - MCFG_I8237_OUT_IOW_2_CB(DEVWRITE8("upd765_2hd", upd765a_device, mdma_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(pc9801_state, dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(pc9801_state, dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(pc9801_state, dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(pc9801_state, dack3_w)) - MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(pc9801_state,get_slave_ack) ) - MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL ) // TODO: Check ir7_w - - MCFG_DEVICE_ADD("ppi8255_sys", I8255, 0) - MCFG_I8255_IN_PORTA_CB(IOPORT("DSW2")) - MCFG_I8255_IN_PORTB_CB(IOPORT("DSW1")) - MCFG_I8255_IN_PORTC_CB(CONSTANT(0xa0)) // 0x80 cpu triple fault reset flag? - MCFG_I8255_OUT_PORTC_CB(WRITE8(pc9801_state, ppi_sys_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_prn", I8255, 0) - /* TODO: check this one */ - MCFG_I8255_IN_PORTB_CB(IOPORT("DSW5")) - - MCFG_FRAGMENT_ADD(pc9801_keyboard) - MCFG_FRAGMENT_ADD(pc9801_mouse) - MCFG_FRAGMENT_ADD(pc9801_cbus) - - MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) - - MCFG_UPD765A_ADD("upd765_2hd", true, true) - MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("pic8259_slave", pic8259_device, ir3_w)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("i8237", am9517a_device, dreq2_w)) MCFG_DEVCB_INVERT - MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", pc9801_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", pc9801_state::floppy_formats) - - MCFG_DEVICE_ADD("ppi8255_fdd", I8255, 0) - MCFG_I8255_IN_PORTA_CB(CONSTANT(0xff)) - MCFG_I8255_IN_PORTB_CB(CONSTANT(0xff)) //upd765_status_r(machine().device("upd765_2dd"),space, 0); - MCFG_I8255_IN_PORTC_CB(CONSTANT(0xff)) //upd765_data_r(machine().device("upd765_2dd"),space, 0); - //MCFG_I8255_OUT_PORTC_CB(WRITE8(pc9801_state, ppi_fdd_portc_w)) //upd765_data_w(machine().device("upd765_2dd"),space, 0,data); - - MCFG_SOFTWARE_LIST_ADD("disk_list","pc98") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DRIVER(pc9801_state, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - - MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2) - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map) - MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text) - MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w)) - - MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2) - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels) - - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc9801) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pc9801, pc9801_state ) - MCFG_CPU_ADD("maincpu", I8086, 5000000) //unknown clock - MCFG_CPU_PROGRAM_MAP(pc9801_map) - MCFG_CPU_IO_MAP(pc9801_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_FRAGMENT_ADD(pc9801_common) - - MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801f) - MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9801f) -#if 0 - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("256K,384K,512K,640K") -#endif - - MCFG_UPD765A_ADD("upd765_2dd", false, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pc9801_state, fdc_2dd_irq)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("i8237", am9517a_device, dreq3_w)) MCFG_DEVCB_INVERT - MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:0", pc9801_floppies, "525dd", pc9801_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:1", pc9801_floppies, "525dd", pc9801_state::floppy_formats) - - MCFG_FRAGMENT_ADD(pc9801_sasi) - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) - - MCFG_DEVICE_MODIFY("i8237") - MCFG_I8237_IN_IOR_3_CB(DEVREAD8("upd765_2dd", upd765a_device, mdma_r)) - MCFG_I8237_OUT_IOW_3_CB(DEVWRITE8("upd765_2dd", upd765a_device, mdma_w)) - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc9801vm, pc9801 ) - MCFG_CPU_REPLACE("maincpu",V30,10000000) - MCFG_CPU_PROGRAM_MAP(pc9801ux_map) - MCFG_CPU_IO_MAP(pc9801ux_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) - - MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801_common) - MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9801_common) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pc9801rs, pc9801_state ) - MCFG_CPU_ADD("maincpu", I386SX, MAIN_CLOCK_X1*8) // unknown clock. - MCFG_CPU_PROGRAM_MAP(pc9801rs_map) - MCFG_CPU_IO_MAP(pc9801rs_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_FRAGMENT_ADD(pc9801_common) - - MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801rs) - MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9801rs) - - MCFG_DEVICE_MODIFY("i8237") - MCFG_DEVICE_CLOCK(MAIN_CLOCK_X1*8); // unknown clock - - MCFG_FRAGMENT_ADD(pc9801_ide) - MCFG_UPD4990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1664K") - MCFG_RAM_EXTRA_OPTIONS("640K,3712K,7808K") - - MCFG_DEVICE_MODIFY("upd7220_btm") - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_grcg_2_map) - - MCFG_PALETTE_ADD("palette", 16+16) - MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc9801ux, pc9801rs ) - MCFG_CPU_REPLACE("maincpu",I80286,10000000) - MCFG_CPU_PROGRAM_MAP(pc9801ux_map) - MCFG_CPU_IO_MAP(pc9801ux_io) - MCFG_80286_A20(pc9801_state, pc9801_286_a20) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) -// MCFG_DEVICE_MODIFY("i8237", AM9157A, 10000000) // unknown clock -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc9801bx2, pc9801rs ) - MCFG_CPU_REPLACE("maincpu",I486,25000000) - MCFG_CPU_PROGRAM_MAP(pc9821_map) - MCFG_CPU_IO_MAP(pc9821_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801bx2) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc9821, pc9801rs ) - MCFG_CPU_REPLACE("maincpu", I486, 16000000) // unknown clock - MCFG_CPU_PROGRAM_MAP(pc9821_map) - MCFG_CPU_IO_MAP(pc9821_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_DEVICE_MODIFY("pit8253") - MCFG_PIT8253_CLK0(MAIN_CLOCK_X2) - MCFG_PIT8253_CLK1(MAIN_CLOCK_X2) - MCFG_PIT8253_CLK2(MAIN_CLOCK_X2) - - MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9821) - MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9821) - - MCFG_DEVICE_MODIFY("i8237") - MCFG_DEVICE_CLOCK(16000000); // unknown clock - - MCFG_DEVICE_REMOVE("palette") - MCFG_PALETTE_ADD("palette", 16+16+256) - MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc9821ap2, pc9821) - MCFG_CPU_REPLACE("maincpu", I486, 66666667) // unknown clock - MCFG_CPU_PROGRAM_MAP(pc9821_map) - MCFG_CPU_IO_MAP(pc9821_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9821ap2) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc9821v20, pc9821 ) - MCFG_CPU_REPLACE("maincpu",PENTIUM,32000000) /* TODO: clock */ - MCFG_CPU_PROGRAM_MAP(pc9821_map) - MCFG_CPU_IO_MAP(pc9821_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) -MACHINE_CONFIG_END - -/* took from "raw" memory dump, uncomment ROM_FILL if you want to play with it */ -#define LOAD_IDE_ROM \ - ROM_REGION( 0x4000, "ide", ROMREGION_ERASEVAL(0xcb) ) \ - ROM_LOAD( "d8000.rom", 0x0000, 0x2000, BAD_DUMP CRC(5dda57cc) SHA1(d0dead41c5b763008a4d777aedddce651eb6dcbb) ) \ - ROM_IGNORE( 0x2000 ) \ - ROM_IGNORE( 0x2000 ) \ - ROM_IGNORE( 0x2000 ) - -// all of these are half size :/ -#define LOAD_KANJI_ROMS \ - ROM_REGION( 0x80000, "raw_kanji", ROMREGION_ERASEFF ) \ - ROM_LOAD16_BYTE( "24256c-x01.bin", 0x00000, 0x4000, BAD_DUMP CRC(28ec1375) SHA1(9d8e98e703ce0f483df17c79f7e841c5c5cd1692) ) \ - ROM_CONTINUE( 0x20000, 0x4000 ) \ - ROM_LOAD16_BYTE( "24256c-x02.bin", 0x00001, 0x4000, BAD_DUMP CRC(90985158) SHA1(78fb106131a3f4eb054e87e00fe4f41193416d65) ) \ - ROM_CONTINUE( 0x20001, 0x4000 ) \ - ROM_LOAD16_BYTE( "24256c-x03.bin", 0x40000, 0x4000, BAD_DUMP CRC(d4893543) SHA1(eb8c1bee0f694e1e0c145a24152222d4e444e86f) ) \ - ROM_CONTINUE( 0x60000, 0x4000 ) \ - ROM_LOAD16_BYTE( "24256c-x04.bin", 0x40001, 0x4000, BAD_DUMP CRC(5dec0fc2) SHA1(41000da14d0805ed0801b31eb60623552e50e41c) ) \ - ROM_CONTINUE( 0x60001, 0x4000 ) \ - ROM_REGION( 0x100000, "kanji", ROMREGION_ERASEFF ) \ - ROM_REGION( 0x80000, "new_chargen", ROMREGION_ERASEFF ) -/* -F - 8086 5 -*/ - -ROM_START( pc9801f ) - ROM_REGION( 0x18000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "urm01-02.bin", 0x00000, 0x4000, CRC(cde04615) SHA1(8f6fb587c0522af7a8131b45d13f8ae8fc60e8cd) ) - ROM_LOAD16_BYTE( "urm02-02.bin", 0x00001, 0x4000, CRC(9e39b8d1) SHA1(df1f3467050a41537cb9d071e4034f0506f07eda) ) - ROM_LOAD16_BYTE( "urm03-02.bin", 0x08000, 0x4000, CRC(95e79064) SHA1(c27d96949fad82aeb26e316200c15a4891e1063f) ) - ROM_LOAD16_BYTE( "urm04-02.bin", 0x08001, 0x4000, CRC(e4855a53) SHA1(223f66482c77409706cfc64c214cec7237c364e9) ) - ROM_LOAD16_BYTE( "urm05-02.bin", 0x10000, 0x4000, CRC(ffefec65) SHA1(106e0d920e857e59da12225a489ca2756ca405c1) ) - ROM_LOAD16_BYTE( "urm06-02.bin", 0x10001, 0x4000, CRC(1147760b) SHA1(4e0299091dfd53ac7988d40c5a6775a10389faac) ) - - ROM_REGION( 0x4000, "sound_bios", ROMREGION_ERASEFF ) /* FM board*/ - ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) - - ROM_REGION( 0x1000, "fdc_bios_2dd", ROMREGION_ERASEFF ) - - ROM_REGION( 0x1000, "fdc_bios_2hd", ROMREGION_ERASEFF ) - - ROM_REGION( 0x20000, "fdc_data", ROMREGION_ERASEFF ) // 2dd fdc bios, presumably bad size (should be 0x800 for each rom) - ROM_LOAD16_BYTE( "urf01-01.bin", 0x00000, 0x4000, BAD_DUMP CRC(2f5ae147) SHA1(69eb264d520a8fc826310b4fce3c8323867520ee) ) - ROM_LOAD16_BYTE( "urf02-01.bin", 0x00001, 0x4000, BAD_DUMP CRC(62a86928) SHA1(4160a6db096dbeff18e50cbee98f5d5c1a29e2d1) ) - ROM_LOAD( "2hdif.rom", 0x10000, 0x1000, BAD_DUMP CRC(9652011b) SHA1(b607707d74b5a7d3ba211825de31a8f32aec8146) ) // needs dumping from a board - - ROM_REGION( 0x800, "kbd_mcu", ROMREGION_ERASEFF) - ROM_LOAD( "mcu.bin", 0x0000, 0x0800, NO_DUMP ) //connected through a i8251 UART, needs decapping - - /* note: ROM names of following two might be swapped */ - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "d23128c-17.bin", 0x00000, 0x00800, BAD_DUMP CRC(eea57180) SHA1(4aa037c684b72ad4521212928137d3369174eb1e) ) //original is a bad dump, this is taken from i386 model - ROM_LOAD("hn613128pac8.bin",0x00800, 0x01000, BAD_DUMP CRC(b5a15b5c) SHA1(e5f071edb72a5e9a8b8b1c23cf94a74d24cb648e) ) //bad dump, 8x16 charset? (it's on the kanji board) - - LOAD_KANJI_ROMS -ROM_END - -/* -UX - 80286 10 + V30 8 -*/ - -ROM_START( pc9801ux ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf_ux.rom", 0x18000, 0x08000, CRC(c7942563) SHA1(61bb210d64c7264be939b11df1e9cd14ffeee3c9) ) - ROM_LOAD( "bios_ux.rom", 0x28000, 0x18000, BAD_DUMP CRC(97375ca2) SHA1(bfe458f671d90692104d0640730972ca8dc0a100) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_ux.rom", 0x0000, 0x4000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_ux.rom", 0x000000, 0x046800, BAD_DUMP CRC(19a76eeb) SHA1(96a006e8515157a624599c2b53a581ae0dd560fd) ) - - LOAD_KANJI_ROMS -// LOAD_IDE_ROM -ROM_END - -/* -RX - 80286 12 (no V30?) - -The bios is from a 386 model not an RX -*/ - -ROM_START( pc9801rx ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf_rs.rom", 0x18000, 0x08000, BAD_DUMP CRC(c1815325) SHA1(a2fb11c000ed7c976520622cfb7940ed6ddc904e) ) - ROM_LOAD( "bios_rx.rom", 0x28000, 0x018000, BAD_DUMP CRC(0a682b93) SHA1(76a7360502fa0296ea93b4c537174610a834d367) ) - // fix csum - ROM_FILL(0x3fffe, 1, 0x0d) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_rx.rom", 0x000000, 0x004000, CRC(fe9f57f2) SHA1(d5dbc4fea3b8367024d363f5351baecd6adcd8ef) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_rx.rom", 0x000000, 0x046800, CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -RS - 386SX 16 - -(note: might be a different model!) -*/ - -ROM_START( pc9801rs ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf_rs.rom", 0x18000, 0x08000, CRC(c1815325) SHA1(a2fb11c000ed7c976520622cfb7940ed6ddc904e) ) - ROM_LOAD( "bios_rs.rom", 0x28000, 0x18000, BAD_DUMP CRC(315d2703) SHA1(4f208d1dbb68373080d23bff5636bb6b71eb7565) ) - - /* following is an emulator memory dump, should be checked and nuked */ - ROM_REGION( 0x100000, "memory", 0 ) - ROM_LOAD( "00000.rom", 0x00000, 0x8000, CRC(6e299128) SHA1(d0e7d016c005cdce53ea5ecac01c6f883b752b80) ) - ROM_LOAD( "c0000.rom", 0xc0000, 0x8000, CRC(1b43eabd) SHA1(ca711c69165e1fa5be72993b9a7870ef6d485249) ) // 0xff everywhere - ROM_LOAD( "c8000.rom", 0xc8000, 0x8000, CRC(f2a262b0) SHA1(fe97d2068d18bbb7425d9774e2e56982df2aa1fb) ) - ROM_LOAD( "d0000.rom", 0xd0000, 0x8000, CRC(1b43eabd) SHA1(ca711c69165e1fa5be72993b9a7870ef6d485249) ) // 0xff everywhere - ROM_LOAD( "e8000.rom", 0xe8000, 0x8000, CRC(4e32081e) SHA1(e23571273b7cad01aa116cb7414c5115a1093f85) ) // contains n-88 basic (86) v2.0 - ROM_LOAD( "f0000.rom", 0xf0000, 0x8000, CRC(4da85a6c) SHA1(18dccfaf6329387c0c64cc4c91b32c25cde8bd5a) ) - ROM_LOAD( "f8000.rom", 0xf8000, 0x8000, CRC(2b1e45b1) SHA1(1fec35f17d96b2e2359e3c71670575ad9ff5007e) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_rs.rom", 0x00000, 0x46800, BAD_DUMP CRC(da370e7a) SHA1(584d0c7fde8c7eac1f76dc5e242102261a878c5e) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -BX2/U2 - 486SX - (should be 33, but "dumper" note says it's 25 MHz) - -Yet another franken-dump done with a lame program, shrug - -*/ - -ROM_START( pc9801bx2 ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "pc98bank0.bin", 0x00000, 0x08000, BAD_DUMP CRC(bfd100cc) SHA1(cf8e6a5679cca7761481abef0ba4b35ead39efdb) ) - ROM_LOAD( "pc98bank1.bin", 0x00000, 0x08000, BAD_DUMP CRC(d0562af8) SHA1(2c4fd27eb598f4b8a00f3e86941ba27007d58e47) ) - ROM_LOAD( "pc98bank2.bin", 0x00000, 0x08000, BAD_DUMP CRC(12818a14) SHA1(9c31e8ac85d78fa779d6bbc2095557065294ec09) ) - ROM_LOAD( "pc98bank3.bin", 0x00000, 0x08000, BAD_DUMP CRC(d0bda44e) SHA1(c1022a3b2be4d2a1e43914df9e4605254e5f99d5) ) - ROM_LOAD( "pc98bank4.bin", 0x18000, 0x08000, BAD_DUMP CRC(be8092f4) SHA1(12c8a166b8c6ebbef85568b67e1f098562883365) ) - ROM_LOAD( "pc98bank5.bin", 0x00000, 0x08000, BAD_DUMP CRC(4e32081e) SHA1(e23571273b7cad01aa116cb7414c5115a1093f85) ) - ROM_LOAD( "pc98bank6.bin", 0x00000, 0x08000, BAD_DUMP CRC(f878c160) SHA1(cad47f09075ffe4f7b51bb937c9f716c709d4596) ) - ROM_LOAD( "pc98bank7.bin", 0x00000, 0x08000, BAD_DUMP CRC(1bd6537b) SHA1(ff9ee1c976a12b87851635ce8991ac4ad607675b) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_rs.rom", 0x00000, 0x46800, BAD_DUMP CRC(da370e7a) SHA1(584d0c7fde8c7eac1f76dc5e242102261a878c5e) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -VM - V30 8/10 - -TODO: this ISN'T a real VM model! -*/ - -ROM_START( pc9801vm ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf_ux.rom", 0x18000, 0x08000, BAD_DUMP CRC(c7942563) SHA1(61bb210d64c7264be939b11df1e9cd14ffeee3c9) ) - ROM_LOAD( "bios_vm.rom", 0x28000, 0x018000, CRC(2e2d7cee) SHA1(159549f845dc70bf61955f9469d2281a0131b47f) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_vm.rom", 0x000000, 0x004000, CRC(fe9f57f2) SHA1(d5dbc4fea3b8367024d363f5351baecd6adcd8ef) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_vm.rom", 0x000000, 0x046800, BAD_DUMP CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff) ) - - LOAD_KANJI_ROMS -// LOAD_IDE_ROM -ROM_END - -/* -98MATE A - 80486SX 25 - -(note: might be a different model!) -*/ - -ROM_START( pc9821 ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf.rom", 0x18000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) - ROM_LOAD( "bios.rom", 0x28000, 0x18000, BAD_DUMP CRC(34a19a59) SHA1(2e92346727b0355bc1ec9a7ded1b444a4917f2b9) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font.rom", 0x00000, 0x46800, BAD_DUMP CRC(a61c0649) SHA1(554b87377d176830d21bd03964dc71f8e98676b1) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -As - 80486DX 33 -*/ - -ROM_START( pc9821as ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf.rom", 0x18000, 0x08000, BAD_DUMP CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) - ROM_LOAD( "bios_as.rom", 0x28000, 0x018000, BAD_DUMP CRC(0a682b93) SHA1(76a7360502fa0296ea93b4c537174610a834d367) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_as.rom", 0x000000, 0x004000, CRC(fe9f57f2) SHA1(d5dbc4fea3b8367024d363f5351baecd6adcd8ef) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_as.rom", 0x000000, 0x046800, BAD_DUMP CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -PC-9821AP2/U8W -80486DX2 66MHz -DOS 5.0, Windows 3.1 -5.6MB RAM, up to 73.6MB -340MB HD -Expansion slot C-BUS4 (4) -Graphics controller S3 86C928 -*/ - -ROM_START( pc9821ap2 ) - ROM_REGION( 0x80000, "biosrom", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS("phd0104") - ROM_SYSTEM_BIOS(0, "phd0104", "PHD0104") - ROMX_LOAD( "phd0104.rom", 0x000000, 0x80000, CRC(da73b372) SHA1(2c15b63a0869b81ef7f04972dbb0975f4e77d384), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "phd0102", "PHD0102") - ROMX_LOAD( "phd0102.rom", 0x000000, 0x80000, CRC(3036774c) SHA1(59856a348f156adf5eca06326f967aca54ff871c), ROM_BIOS(2) ) - - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) // TODO: identify ROM banks - ROM_COPY( "biosrom", 0x20000, 0x18000, 0x08000 ) - ROM_COPY( "biosrom", 0x30000, 0x28000, 0x18000 ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font.rom", 0x00000, 0x46800, BAD_DUMP CRC(a61c0649) SHA1(554b87377d176830d21bd03964dc71f8e98676b1) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - - -/* -98NOTE - i486SX 33 -*/ - -ROM_START( pc9821ne ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf.rom", 0x18000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) - ROM_LOAD( "bios_ne.rom", 0x28000, 0x18000, BAD_DUMP CRC(2ae070c4) SHA1(d7963942042bfd84ed5fc9b7ba8f1c327c094172) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_ne.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_ne.rom", 0x00000, 0x46800, BAD_DUMP CRC(fb213757) SHA1(61525826d62fb6e99377b23812faefa291d78c2e) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -Epson PC-486MU - 486 based, unknown clock -*/ - -ROM_START( pc486mu ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "bios_486mu.rom", 0x08000, 0x18000, BAD_DUMP CRC(57b5d701) SHA1(15029800842e93e07615b0fd91fb9f2bfe3e3c24)) - ROM_RELOAD( 0x28000, 0x18000 ) // missing rom? - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_486mu.rom", 0x0000, 0x4000, CRC(6cdfa793) SHA1(4b8250f9b9db66548b79f961d61010558d6d6e1c)) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_486mu.rom", 0x0000, 0x46800, CRC(456d9fc7) SHA1(78ba9960f135372825ab7244b5e4e73a810002ff)) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -98MULTi Ce2 - 80486SX 25 -*/ - -ROM_START( pc9821ce2 ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf_ce2.rom", 0x18000, 0x08000, CRC(273e9e88) SHA1(9bca7d5116788776ed0f297bccb4dfc485379b41) ) - ROM_LOAD( "bios_ce2.rom", 0x28000, 0x018000, BAD_DUMP CRC(76affd90) SHA1(910fae6763c0cd59b3957b6cde479c72e21f33c1) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_ce2.rom", 0x000000, 0x004000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_ce2.rom", 0x000000, 0x046800, CRC(d1c2702a) SHA1(e7781e9d35b6511d12631641d029ad2ba3f7daef) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -98MATE X - 486/Pentium based -*/ - -ROM_START( pc9821xs ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf.rom", 0x18000, 0x08000, BAD_DUMP CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) - ROM_LOAD( "bios_xs.rom", 0x28000, 0x018000, BAD_DUMP CRC(0a682b93) SHA1(76a7360502fa0296ea93b4c537174610a834d367) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_xs.rom", 0x000000, 0x004000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_xs.rom", 0x000000, 0x046800, BAD_DUMP CRC(c9a77d8f) SHA1(deb8563712eb2a634a157289838b95098ba0c7f2) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - - -/* -98MATE VALUESTAR - Pentium based -*/ - -ROM_START( pc9821v13 ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf.rom", 0x18000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) - ROM_LOAD( "bios_v13.rom", 0x28000, 0x18000, BAD_DUMP CRC(0a682b93) SHA1(76a7360502fa0296ea93b4c537174610a834d367) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_v13.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_a.rom", 0x00000, 0x46800, BAD_DUMP CRC(c9a77d8f) SHA1(deb8563712eb2a634a157289838b95098ba0c7f2) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - -/* -98MATE VALUESTAR - Pentium based -*/ - -ROM_START( pc9821v20 ) - ROM_REGION( 0x60000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "itf_v20.rom", 0x38000, 0x08000, CRC(10e52302) SHA1(f95b8648e3f5a23e507a9fbda8ab2e317d8e5151) ) - ROM_LOAD( "bios_v20.rom", 0x08000, 0x018000, BAD_DUMP CRC(d5d1f13b) SHA1(bf44b5f4e138e036f1b848d6616fbd41b5549764) ) - - ROM_REGION( 0x10000, "sound_bios", 0 ) - ROM_LOAD( "sound_v20.rom", 0x000000, 0x004000, CRC(80eabfde) SHA1(e09c54152c8093e1724842c711aed6417169db23) ) - - ROM_REGION( 0x80000, "chargen", 0 ) - ROM_LOAD( "font_v20.rom", 0x000000, 0x046800, BAD_DUMP CRC(6244c4c0) SHA1(9513cac321e89b4edb067b30e9ecb1adae7e7be7) ) - - LOAD_KANJI_ROMS - LOAD_IDE_ROM -ROM_END - - - -DRIVER_INIT_MEMBER(pc9801_state,pc9801_kanji) -{ - #define copy_kanji_strip(_dst,_src,_fill_type) \ - for(i=_dst,k=_src;i<_dst+0x20;i++,k++) \ - { \ - for(j=0;j<0x20;j++) \ - kanji[j+(i << 5)] = _fill_type ? new_chargen[j+(k << 5)] : 0; \ - } - UINT32 i,j,k; - UINT32 pcg_tile; - UINT8 *kanji = memregion("kanji")->base(); - UINT8 *raw_kanji = memregion("raw_kanji")->base(); - UINT8 *new_chargen = memregion("new_chargen")->base(); - UINT8 *chargen = memregion("chargen")->base(); - - /* Convert the ROM bitswap here from the original structure */ - /* TODO: kanji bitswap should be completely wrong, will check it out once that a dump is remade. */ - for(i=0;i<0x80000/0x20;i++) - { - for(j=0;j<0x20;j++) - { - pcg_tile = BITSWAP16(i,15,14,13,12,11,7,6,5,10,9,8,4,3,2,1,0) << 5; - kanji[j+(i << 5)] = raw_kanji[j+pcg_tile]; - } - } - - /* convert charset into even/odd structure */ - for(i=0;i<0x80000/0x20;i++) - { - for(j=0;j<0x10;j++) - { - new_chargen[j*2+(i << 5)] = chargen[j+(i<<5)]; - new_chargen[j*2+(i << 5)+1] = chargen[j+(i<<5)+0x10]; - } - } - - /* now copy the data from the fake roms into our kanji struct */ - copy_kanji_strip(0x0800, -1,0); copy_kanji_strip(0x0820, -1,0); copy_kanji_strip(0x0840, -1,0); copy_kanji_strip(0x0860, -1,0); - copy_kanji_strip(0x0900, -1,0); copy_kanji_strip(0x0920,0x3c0,1); copy_kanji_strip(0x0940,0x3e0,1); copy_kanji_strip(0x0960,0x400,1); - copy_kanji_strip(0x0a00, -1,0); copy_kanji_strip(0x0a20,0x420,1); copy_kanji_strip(0x0a40,0x440,1); copy_kanji_strip(0x0a60,0x460,1); - copy_kanji_strip(0x0b00, -1,0); copy_kanji_strip(0x0b20,0x480,1); copy_kanji_strip(0x0b40,0x4a0,1); copy_kanji_strip(0x0b60,0x4c0,1); - copy_kanji_strip(0x0c00, -1,0); copy_kanji_strip(0x0c20,0x4e0,1); copy_kanji_strip(0x0c40,0x500,1); copy_kanji_strip(0x0c60,0x520,1); - copy_kanji_strip(0x0d00, -1,0); copy_kanji_strip(0x0d20,0x540,1); copy_kanji_strip(0x0d40,0x560,1); copy_kanji_strip(0x0d60,0x580,1); - copy_kanji_strip(0x0e00, -1,0); copy_kanji_strip(0x0e20, -1,0); copy_kanji_strip(0x0e40, -1,0); copy_kanji_strip(0x0e60, -1,0); - copy_kanji_strip(0x0f00, -1,0); copy_kanji_strip(0x0f20, -1,0); copy_kanji_strip(0x0f40, -1,0); copy_kanji_strip(0x0f60, -1,0); - { - int src_1,dst_1; - - for(src_1=0x1000,dst_1=0x660;src_1<0x8000;src_1+=0x100,dst_1+=0x60) - { - copy_kanji_strip(src_1, -1,0); - copy_kanji_strip(src_1+0x20,dst_1+0x00,1); - copy_kanji_strip(src_1+0x40,dst_1+0x20,1); - copy_kanji_strip(src_1+0x60,dst_1+0x40,1); - } - } - #undef copy_kanji_strip -} - -/* Genuine dumps */ -COMP( 1983, pc9801f, 0, 0, pc9801, pc9801, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801F", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) - -/* TODO: ANYTHING below there needs REDUMPING! */ -COMP( 1989, pc9801rs, 0 ,0, pc9801rs, pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801RS", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) //TODO: not sure about the exact model -COMP( 1985, pc9801vm, pc9801ux,0, pc9801vm, pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801VM", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1987, pc9801ux, 0 ,0, pc9801ux, pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801UX", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1988, pc9801rx, pc9801rs,0, pc9801rs, pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801RX", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1993, pc9801bx2, pc9801rs,0, pc9801bx2,pc9801rs, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9801BX2/U2", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1994, pc9821, 0, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) //TODO: not sure about the exact model -COMP( 1993, pc9821as, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE A)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1993, pc9821ap2, pc9821, 0, pc9821ap2,pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821AP2/U8W (98MATE A)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1994, pc9821xs, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE Xs)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1994, pc9821ce2, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MULTi Ce2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1994, pc9821ne, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98NOTE)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1994, pc486mu, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Epson", "PC-486MU", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1998, pc9821v13, pc9821, 0, pc9821, pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE VALUESTAR 13)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) -COMP( 1998, pc9821v20, pc9821, 0, pc9821v20,pc9821, pc9801_state, pc9801_kanji, "Nippon Electronic Company", "PC-9821 (98MATE VALUESTAR 20)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/pcd.c b/src/mess/drivers/pcd.c deleted file mode 100644 index 727efdb102a..00000000000 --- a/src/mess/drivers/pcd.c +++ /dev/null @@ -1,603 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best, Carl -/*************************************************************************** - - Siemens PC-D - - For PC-X HDD should have 306,4,9 chs at 1024Bps or 18 at 512Bps - -***************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i186.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "machine/pic8259.h" -#include "machine/mc2661.h" -#include "machine/wd_fdc.h" -#include "machine/mc146818.h" -#include "machine/pcd_kbd.h" -#include "video/pcd.h" -#include "sound/speaker.h" -#include "formats/pc_dsk.h" -#include "bus/scsi/omti5100.h" -#include "bus/rs232/rs232.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class pcd_state : public driver_device -{ -public: - pcd_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pic1(*this, "pic1"), - m_pic2(*this, "pic2"), - m_speaker(*this, "speaker"), - m_fdc(*this, "fdc"), - m_rtc(*this, "rtc"), - m_scsi(*this, "scsi"), - m_scsi_data_out(*this, "scsi_data_out"), - m_scsi_data_in(*this, "scsi_data_in"), - m_ram(*this, "ram"), - m_req_hack(NULL) - { } - - DECLARE_READ8_MEMBER( irq_callback ); - TIMER_DEVICE_CALLBACK_MEMBER( timer0_tick ); - DECLARE_WRITE_LINE_MEMBER( i186_timer1_w ); - - DECLARE_READ8_MEMBER( nmi_io_r ); - DECLARE_WRITE8_MEMBER( nmi_io_w ); - DECLARE_READ8_MEMBER( rtc_r ); - DECLARE_WRITE8_MEMBER( rtc_w ); - DECLARE_READ8_MEMBER( stat_r ); - DECLARE_WRITE8_MEMBER( stat_w ); - DECLARE_READ8_MEMBER( led_r ); - DECLARE_WRITE8_MEMBER( led_w ); - DECLARE_READ16_MEMBER( dskctl_r ); - DECLARE_WRITE16_MEMBER( dskctl_w ); - - DECLARE_READ8_MEMBER( scsi_r ); - DECLARE_WRITE8_MEMBER( scsi_w ); - DECLARE_READ16_MEMBER( mmu_r ); - DECLARE_WRITE16_MEMBER( mmu_w ); - DECLARE_READ16_MEMBER( mem_r ); - DECLARE_WRITE16_MEMBER( mem_w ); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - DECLARE_WRITE_LINE_MEMBER(write_scsi_bsy); - DECLARE_WRITE_LINE_MEMBER(write_scsi_cd); - DECLARE_WRITE_LINE_MEMBER(write_scsi_io); - DECLARE_WRITE_LINE_MEMBER(write_scsi_msg); - DECLARE_WRITE_LINE_MEMBER(write_scsi_req); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - required_device m_maincpu; - required_device m_pic1; - required_device m_pic2; - required_device m_speaker; - required_device m_fdc; - required_device m_rtc; - required_device m_scsi; - required_device m_scsi_data_out; - required_device m_scsi_data_in; - required_device m_ram; - UINT8 m_stat, m_led; - int m_msg, m_bsy, m_io, m_cd, m_req, m_rst; - emu_timer *m_req_hack; - UINT16 m_dskctl; - struct { - UINT16 ctl; - UINT16 regs[1024]; - int type; - bool sc; - } m_mmu; - - void check_scsi_irq(); -}; - - -//************************************************************************** -// MACHINE EMULATION -//************************************************************************** - -void pcd_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - // TODO: remove this hack - if(m_req) - m_maincpu->drq0_w(1); -} - -void pcd_state::machine_start() -{ - m_req_hack = timer_alloc(); - save_item(NAME(m_mmu.ctl)); - save_item(NAME(m_mmu.regs)); -} - -void pcd_state::machine_reset() -{ - m_stat = 0; - m_led = 0; - m_dskctl = 0; - m_rst = 0; - m_mmu.ctl = 0; - m_mmu.sc = false; - if(ioport("mmu")) - m_mmu.type = ioport("mmu")->read(); - else - m_mmu.type = 0; -} - -READ8_MEMBER( pcd_state::irq_callback ) -{ - return (offset ? m_pic2 : m_pic1)->acknowledge(); -} - -TIMER_DEVICE_CALLBACK_MEMBER( pcd_state::timer0_tick ) -{ - m_maincpu->tmrin0_w(0); - m_maincpu->tmrin0_w(1); -} - -WRITE_LINE_MEMBER( pcd_state::i186_timer1_w ) -{ - if(m_dskctl & 0x20) - m_speaker->level_w(state); -} - -READ8_MEMBER( pcd_state::nmi_io_r ) -{ - if(space.debugger_access()) - return 0; - logerror("%s: unmapped %s %04x\n", machine().describe_context(), space.name(), offset); - m_stat |= 8; - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - return 0; -} - -WRITE8_MEMBER( pcd_state::nmi_io_w ) -{ - if(space.debugger_access()) - return; - logerror("%s: unmapped %s %04x\n", machine().describe_context(), space.name(), offset); - m_stat |= 8; - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -READ8_MEMBER( pcd_state::rtc_r ) -{ - m_rtc->write(space, 0, offset); - return m_rtc->read(space, 1); -} - -WRITE8_MEMBER( pcd_state::rtc_w ) -{ - m_rtc->write(space, 0, offset); - m_rtc->write(space, 1, data); -} - -READ8_MEMBER( pcd_state::stat_r ) -{ - return m_stat; -} - -WRITE8_MEMBER( pcd_state::stat_w ) -{ - m_stat &= ~data; -} - -READ16_MEMBER( pcd_state::dskctl_r ) -{ - return m_dskctl; -} - -WRITE16_MEMBER( pcd_state::dskctl_w ) -{ - floppy_image_device *floppy0 = m_fdc->subdevice("0")->get_device(); - floppy_image_device *floppy1 = m_fdc->subdevice("1")->get_device(); - - COMBINE_DATA(&m_dskctl); - - if((m_dskctl & 1) && floppy0) - m_fdc->set_floppy(floppy0); - if((m_dskctl & 2) && floppy1) - m_fdc->set_floppy(floppy1); - - if(floppy0) - { - floppy0->mon_w(!(m_dskctl & 4)); - floppy0->ss_w((m_dskctl & 8) != 0); - } - if(floppy1) - { - floppy1->mon_w(!(m_dskctl & 4)); - floppy1->ss_w((m_dskctl & 8) != 0); - } - m_fdc->dden_w((m_dskctl & 0x10) ? 1 : 0); -} - -READ8_MEMBER( pcd_state::led_r ) -{ - // DIPs? - // 0x01 no mmu - // 0x10 enter monitor after post - // 0x20 enter monitor before post - return 0x01; -} - -WRITE8_MEMBER( pcd_state::led_w ) -{ - for(int i = 0; i < 6; i++) - logerror("%c", (data & (1 << i)) ? '-' : '*'); - logerror("\n"); - m_led = data; -} - -READ16_MEMBER( pcd_state::mmu_r ) -{ - UINT16 data = m_mmu.regs[((m_mmu.ctl & 0x1f) << 5) | ((offset >> 2) & 0x1f)]; - //logerror("%s: mmu read %04x %04x\n", machine().describe_context(), (offset << 1) + 0x8000, data); - if(!offset) - return m_mmu.ctl; - else if((offset >= 0x200) && (offset < 0x300) && !(offset & 3)) - return (data << 4) | (data >> 12) | (m_mmu.sc && (offset == 0x200) ? 0xc0 : 0); - else if(offset == 0x400) - { - m_mmu.sc = false; - m_pic1->ir0_w(CLEAR_LINE); - } - return 0; -} - -WRITE16_MEMBER( pcd_state::mmu_w ) -{ - //logerror("%s: mmu write %04x %04x\n", machine().describe_context(), (offset << 1) + 0x8000, data); - if(!offset) - m_mmu.ctl = data; - else if((offset >= 0x200) && (offset < 0x300) && !(offset & 3)) - m_mmu.regs[((m_mmu.ctl & 0x1f) << 5) | ((offset >> 2) & 0x1f)] = (data >> 4) | (data << 12); - else if(offset == 0x400) - { - m_mmu.sc = true; - m_pic1->ir0_w(ASSERT_LINE); - } -} - -READ8_MEMBER(pcd_state::scsi_r) -{ - UINT8 ret = 0; - - switch(offset) - { - case 0: - case 2: - ret = m_scsi_data_in->read(); - m_scsi->write_ack(1); - if(!offset) - m_maincpu->drq0_w(0); - break; - - case 1: - ret = (m_cd << 7) | (m_req << 5) | (m_bsy << 4); - break; - } - - return ret; -} - -WRITE8_MEMBER(pcd_state::scsi_w) -{ - switch(offset) - { - case 0: - m_scsi_data_out->write(data); - m_scsi->write_ack(1); - m_maincpu->drq0_w(0); - break; - case 1: - if(data & 4) - { - m_rst = 1; - m_scsi->write_rst(1); - break; - } - if(m_rst) - { - m_rst = 0; - m_scsi->write_rst(0); - break; - } - - if(!m_bsy) - { - m_scsi_data_out->write(0); - m_scsi->write_sel(1); - } - break; - } -} - -void pcd_state::check_scsi_irq() -{ - m_pic1->ir5_w(m_io && m_cd && m_req); -} - -WRITE_LINE_MEMBER(pcd_state::write_scsi_bsy) -{ - m_bsy = state ? 1 : 0; - m_scsi->write_sel(0); -} -WRITE_LINE_MEMBER(pcd_state::write_scsi_cd) -{ - m_cd = state ? 1 : 0; - check_scsi_irq(); -} -WRITE_LINE_MEMBER(pcd_state::write_scsi_io) -{ - m_io = state ? 1 : 0; - if(state) - m_scsi_data_out->write(0); - check_scsi_irq(); -} -WRITE_LINE_MEMBER(pcd_state::write_scsi_msg) -{ - m_msg = state ? 1 : 0; -} - -WRITE_LINE_MEMBER(pcd_state::write_scsi_req) -{ - m_req = state ? 1 : 0; - if(state) - { - if(!m_cd) - { - m_maincpu->drq0_w(1); - m_req_hack->adjust(attotime::from_msec(10)); // poke the dmac - } - else if(m_msg) - { - m_scsi_data_in->read(); - m_scsi->write_ack(1); - } - } - else - { - if(m_req_hack) // this might be called before machine_start - m_req_hack->adjust(attotime::never); - m_scsi->write_ack(0); - } - check_scsi_irq(); -} - -WRITE16_MEMBER(pcd_state::mem_w) -{ - UINT16 *ram = (UINT16 *)m_ram->pointer(); - if((m_mmu.ctl & 0x20) && m_mmu.type) - { - UINT16 reg; - if(m_mmu.type == 2) - reg = m_mmu.regs[((offset >> 10) & 0xff) | ((m_mmu.ctl & 0x18) << 5)]; - else - reg = m_mmu.regs[((offset >> 10) & 0x7f) | ((m_mmu.ctl & 0x1c) << 5)]; - if(!reg && !space.debugger_access()) - { - offset <<= 1; - logerror("%s: Null mmu entry %06x\n", machine().describe_context(), offset); - nmi_io_w(space, offset, data, mem_mask); - return; - } - offset = ((reg << 3) & 0x7fc00) | (offset & 0x3ff); - } - COMBINE_DATA(&ram[offset]); -} - -READ16_MEMBER(pcd_state::mem_r) -{ - UINT16 *ram = (UINT16 *)m_ram->pointer(); - if((m_mmu.ctl & 0x20) && m_mmu.type) - { - UINT16 reg; - if(m_mmu.type == 2) - reg = m_mmu.regs[((offset >> 10) & 0xff) | ((m_mmu.ctl & 0x18) << 5)]; - else - reg = m_mmu.regs[((offset >> 10) & 0x7f) | ((m_mmu.ctl & 0x1c) << 5)]; - if(!reg && !space.debugger_access()) - { - offset <<= 1; - logerror("%s: Null mmu entry %06x\n", machine().describe_context(), offset); - return nmi_io_r(space, offset, mem_mask); - } - offset = ((reg << 3) & 0x7fc00) | (offset & 0x3ff); - } - return ram[offset]; -} - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -static ADDRESS_MAP_START( pcd_map, AS_PROGRAM, 16, pcd_state ) - AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(mem_r, mem_w) - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("bios", 0) - AM_RANGE(0x00000, 0xfffff) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pcd_io, AS_IO, 16, pcd_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xefff) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xffff) - AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE8("pic1", pic8259_device, read, write, 0xffff) - AM_RANGE(0xf820, 0xf821) AM_DEVREADWRITE8("pic2", pic8259_device, read, write, 0xffff) - AM_RANGE(0xf840, 0xf841) AM_READWRITE8(stat_r, stat_w, 0x00ff) - AM_RANGE(0xf840, 0xf841) AM_READWRITE8(led_r, led_w, 0xff00) - AM_RANGE(0xf880, 0xf8bf) AM_READWRITE8(rtc_r, rtc_w, 0xffff) - AM_RANGE(0xf900, 0xf903) AM_DEVREADWRITE8("fdc", wd2793_t, read, write, 0xffff) - AM_RANGE(0xf904, 0xf905) AM_READWRITE(dskctl_r, dskctl_w) - AM_RANGE(0xf940, 0xf943) AM_READWRITE8(scsi_r, scsi_w, 0xffff) - AM_RANGE(0xf980, 0xf9bf) AM_DEVICE("video", pcdx_video_device, map) - AM_RANGE(0xf9c0, 0xf9c3) AM_DEVREADWRITE8("usart1",mc2661_device,read,write,0xffff) // UARTs - AM_RANGE(0xf9d0, 0xf9d3) AM_DEVREADWRITE8("usart2",mc2661_device,read,write,0xffff) - AM_RANGE(0xf9e0, 0xf9e3) AM_DEVREADWRITE8("usart3",mc2661_device,read,write,0xffff) -// AM_RANGE(0xfa00, 0xfa7f) // pcs4-n (peripheral chip select) - AM_RANGE(0xfb00, 0xffff) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pcx_io, AS_IO, 16, pcd_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x8000, 0x8fff) AM_READWRITE(mmu_r, mmu_w) - AM_RANGE(0xfb00, 0xfb01) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xff00) - AM_IMPORT_FROM(pcd_io) -ADDRESS_MAP_END - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static SLOT_INTERFACE_START( pcd_floppies ) - SLOT_INTERFACE("55f", TEAC_FD_55F) // 80 tracks - SLOT_INTERFACE("55g", TEAC_FD_55G) // 77 tracks -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( pcd_state::floppy_formats ) - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -static INPUT_PORTS_START(pcx) - PORT_START("mmu") - PORT_CONFNAME(0x03, 0x00, "MMU Type") - PORT_CONFSETTING(0x00, "None") - PORT_CONFSETTING(0x01, "SINIX 1.0") - PORT_CONFSETTING(0x02, "SINIX 1.2") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( pcd, pcd_state ) - MCFG_CPU_ADD("maincpu", I80186, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(pcd_map) - MCFG_CPU_IO_MAP(pcd_io) - MCFG_80186_TMROUT1_HANDLER(WRITELINE(pcd_state, i186_timer1_w)) - MCFG_80186_IRQ_SLAVE_ACK(READ8(pcd_state, irq_callback)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer0_tick", pcd_state, timer0_tick, attotime::from_hz(XTAL_16MHz / 24)) // adjusted to pass post - - MCFG_PIC8259_ADD("pic1", DEVWRITELINE("maincpu", i80186_cpu_device, int0_w), VCC, NULL) - MCFG_PIC8259_ADD("pic2", DEVWRITELINE("maincpu", i80186_cpu_device, int1_w), VCC, NULL) - - MCFG_DEVICE_ADD("video", PCD_VIDEO, 0) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1M") - - // nvram - MCFG_NVRAM_ADD_1FILL("nvram") - - // floppy disk controller - MCFG_WD2793_ADD("fdc", XTAL_16MHz / 8) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pic1", pic8259_device, ir6_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq1_w)) - MCFG_WD_FDC_ENMF_CALLBACK(GND) - - // floppy drives - MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcd_floppies, "55f", pcd_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", pcd_floppies, "55f", pcd_state::floppy_formats) - - // usart - MCFG_DEVICE_ADD("usart1", MC2661, XTAL_4_9152MHz) - MCFG_MC2661_RXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir3_w)) - MCFG_MC2661_TXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir3_w)) - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("rs232_1", rs232_port_device, write_txd)) - MCFG_DEVICE_ADD("usart2", MC2661, XTAL_4_9152MHz) - MCFG_MC2661_RXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir2_w)) - //MCFG_MC2661_TXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir2_w)) // this gets stuck high causing the keyboard to not work - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("keyboard", pcd_keyboard_device, t0_w)) - MCFG_DEVICE_ADD("usart3", MC2661, XTAL_4_9152MHz) - MCFG_MC2661_RXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir4_w)) - MCFG_MC2661_TXRDY_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir4_w)) - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("rs232_2", rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD("rs232_1", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("usart1", mc2661_device, rx_w)) - MCFG_RS232_PORT_ADD("rs232_2", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("usart3", mc2661_device, rx_w)) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - // rtc - MCFG_MC146818_ADD("rtc", XTAL_32_768kHz) - MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir7_w)) - MCFG_MC146818_BINARY(true) - MCFG_MC146818_EPOCH(1900) - MCFG_MC146818_24_12(true) - - MCFG_DEVICE_ADD("keyboard", PCD_KEYBOARD, 0) - MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE("usart2", mc2661_device, rx_w)) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") - MCFG_SCSI_MSG_HANDLER(WRITELINE(pcd_state, write_scsi_msg)) - MCFG_SCSI_BSY_HANDLER(WRITELINE(pcd_state, write_scsi_bsy)) - MCFG_SCSI_IO_HANDLER(WRITELINE(pcd_state, write_scsi_io)) - MCFG_SCSI_CD_HANDLER(WRITELINE(pcd_state, write_scsi_cd)) - MCFG_SCSI_REQ_HANDLER(WRITELINE(pcd_state, write_scsi_req)) - - MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", "scsi") - MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) - MCFG_SCSIDEV_ADD("scsi:1", "harddisk", OMTI5100, SCSI_ID_0) -MACHINE_CONFIG_END - -MACHINE_CONFIG_DERIVED(pcx, pcd) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(pcx_io) - - MCFG_DEVICE_REPLACE("video", PCX_VIDEO, 0) - MCFG_PCX_VIDEO_TXD_HANDLER(DEVWRITELINE("keyboard", pcd_keyboard_device, t0_w)) - - MCFG_DEVICE_MODIFY("keyboard") - MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE("video", pcx_video_device, rx_w)) - - MCFG_DEVICE_MODIFY("usart2") - MCFG_MC2661_TXD_HANDLER(NULL) -MACHINE_CONFIG_END - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( pcd ) - ROM_REGION(0x4000, "bios", 0) - ROM_SYSTEM_BIOS(0, "v2", "V2 GS") // from mainboard SYBAC S26361-D359 V2 GS - ROMX_LOAD("s26361-d359.d42", 0x0001, 0x2000, CRC(e20244dd) SHA1(0ebc5ddb93baacd9106f1917380de58aac64fe73), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD("s26361-d359.d43", 0x0000, 0x2000, CRC(e03db2ec) SHA1(fcae8b0c9e7543706817b0a53872826633361fda), ROM_SKIP(1) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v3", "V3 GS4") // from mainboard SYBAC S26361-D359 V3 GS4 - ROMX_LOAD("361d0359.d42", 0x0001, 0x2000, CRC(5b4461e4) SHA1(db6756aeabb2e6d3921dc7571a5bed3497b964bf), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("361d0359.d43", 0x0000, 0x2000, CRC(71c3189d) SHA1(e8dd6c632bfc833074d3a833ea7f59bb5460f313), ROM_SKIP(1) | ROM_BIOS(2)) -ROM_END - -ROM_START( pcx ) - ROM_REGION(0x4000, "bios", 0) - ROM_SYSTEM_BIOS(0, "v2", "V2 GS") // from mainboard SYBAC S26361-D359 V2 GS - ROMX_LOAD("s26361-d359.d42", 0x0001, 0x2000, CRC(e20244dd) SHA1(0ebc5ddb93baacd9106f1917380de58aac64fe73), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD("s26361-d359.d43", 0x0000, 0x2000, CRC(e03db2ec) SHA1(fcae8b0c9e7543706817b0a53872826633361fda), ROM_SKIP(1) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v3", "V3 GS4") // from mainboard SYBAC S26361-D359 V3 GS4 - ROMX_LOAD("361d0359.d42", 0x0001, 0x2000, CRC(5b4461e4) SHA1(db6756aeabb2e6d3921dc7571a5bed3497b964bf), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD("361d0359.d43", 0x0000, 0x2000, CRC(71c3189d) SHA1(e8dd6c632bfc833074d3a833ea7f59bb5460f313), ROM_SKIP(1) | ROM_BIOS(2)) -ROM_END - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -COMP( 1984, pcd, 0, 0, pcd, 0, driver_device, 0, "Siemens", "PC-D", MACHINE_NOT_WORKING ) -COMP( 1984, pcx, pcd, 0, pcx, pcx, driver_device, 0, "Siemens", "PC-X", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pce.c b/src/mess/drivers/pce.c deleted file mode 100644 index 9153ec14c0b..00000000000 --- a/src/mess/drivers/pce.c +++ /dev/null @@ -1,429 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Charles MacDonald, Wilbert Pol, Angelo Salese -/**************************************************************************** - - PC-Engine / Turbo Grafx 16 driver - by Charles Mac Donald - E-Mail: cgfm2@hooked.net - - Thanks to David Shadoff and Brian McPhail for help with the driver. - -****************************************************************************/ - -/********************************************************************** - To-Do List: -- convert h6280-based drivers to internal memory map for the I/O region -- test sprite collision and overflow interrupts -- sprite precaching -- rewrite the base renderer loop -- Add CD support -- Add 6 button joystick support -- Add 263 line mode -- Sprite DMA should use vdc VRAM functions -- properly implement the pixel clocks instead of the simple scaling we do now - -Banking -======= - -Normally address spacebanks 00-F6 are assigned to regular HuCard ROM space. There -are a couple of special situations: - -Street Fighter II: - - address space banks 40-7F switchable by writing to 1FF0-1FF3 - 1FF0 - select rom banks 40-7F - 1FF1 - select rom banks 80-BF - 1FF2 - select rom banks C0-FF - 1FF3 - select rom banks 100-13F - -Populous: - - address space banks 40-43 contains 32KB RAM - -CDRom units: - - address space banks 80-87 contains 64KB RAM - -Super System Card: - - address space banks 68-7F contains 192KB RAM - -**********************************************************************/ - -/********************************************************************** - Known Bugs -*********************************************************************** -- Benkei Gaiden: hangs after a few Sunsoft logo spins. -- Busou Keiji Cyber Cross: hangs on attract mode -- Cadash: After choosing character and name, the game starts and the display 'jiggles' like tracking if off a VCR -- Fighting Run: has color and sprite issues during gameplay; -- Hisou Kihei - Xserd: black screen; -**********************************************************************/ - -#include "emu.h" -#include "cpu/h6280/h6280.h" -#include "includes/pce.h" -#include "bus/pce/pce_rom.h" -#include "sound/c6280.h" -#include "sound/cdda.h" -#include "sound/msm5205.h" -#include "video/huc6270.h" -#include "video/huc6202.h" - -/* todo: alternate forms of input (multitap, mouse, etc.) */ -static INPUT_PORTS_START( pce ) - - PORT_START("JOY_P.0") - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P1 Run") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - - PORT_START("JOY_P.1") - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P2 Run") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - - PORT_START("JOY_P.2") - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P3 Select") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P3 Run") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - - PORT_START("JOY_P.3") - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P4 Select") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P4 Run") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - - PORT_START("JOY_P.4") - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P5 Select") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P5 Run") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - - PORT_START("JOY6B_P.0") - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P1 Run") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Button III") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Button IV") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Button V") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Button VI") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) - PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - - PORT_START("JOY6B_P.1") /* Player 2 controls */ - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P2 Run") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Button III") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Button IV") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Button V") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Button VI") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) - PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - - PORT_START("JOY6B_P.2") /* Player 3 controls */ - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P3 Select") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P3 Run") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P3 Button III") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P3 Button IV") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P3 Button V") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) - PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - - PORT_START("JOY6B_P.3") /* Player 4 controls */ - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P4 Select") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P4 Run") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P3 Button III") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P3 Button IV") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P3 Button V") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) - PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - - PORT_START("JOY6B_P.4") /* Player 5 controls */ - /* II is left of I on the original pad so we map them in reverse order */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P5 Select") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("P5 Run") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P5 Button III") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P5 Button IV") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P5 Button V") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P5 Button VI") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) - PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - - PORT_START("JOY_TYPE") - PORT_CONFNAME(0x0003,0x0000,"Joystick Type Player 1") - PORT_CONFSETTING( 0x0000,"2-buttons" ) -// PORT_CONFSETTING( 0x0001,"3-buttons" ) - PORT_CONFSETTING( 0x0002,"6-buttons" ) -// PORT_CONFSETTING( 0x0003,"Mouse" ) - PORT_CONFNAME(0x000c,0x0000,"Joystick Type Player 2") - PORT_CONFSETTING( 0x0000,"2-buttons" ) -// PORT_CONFSETTING( 0x0004,"3-buttons" ) - PORT_CONFSETTING( 0x0008,"6-buttons" ) -// PORT_CONFSETTING( 0x000c,"Mouse" ) - PORT_CONFNAME(0x0030,0x0000,"Joystick Type Player 3") - PORT_CONFSETTING( 0x0000,"2-buttons" ) -// PORT_CONFSETTING( 0x0010,"3-buttons" ) - PORT_CONFSETTING( 0x0020,"6-buttons" ) -// PORT_CONFSETTING( 0x0030,"Mouse" ) - PORT_CONFNAME(0x00c0,0x0000,"Joystick Type Player 4") - PORT_CONFSETTING( 0x0000,"2-buttons" ) -// PORT_CONFSETTING( 0x0040,"3-buttons" ) - PORT_CONFSETTING( 0x0080,"6-buttons" ) -// PORT_CONFSETTING( 0x00c0,"Mouse" ) - PORT_CONFNAME(0x0300,0x0000,"Joystick Type Player 5") - PORT_CONFSETTING( 0x0000,"2-buttons" ) -// PORT_CONFSETTING( 0x0100,"3-buttons" ) - PORT_CONFSETTING( 0x0200,"6-buttons" ) -// PORT_CONFSETTING( 0x0300,"Mouse" ) - - PORT_START("A_CARD") - PORT_CONFNAME( 0x01, 0x01, "Arcade Card" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) -INPUT_PORTS_END - - - -static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8, pce_state ) - AM_RANGE( 0x000000, 0x0FFFFF) AM_DEVREADWRITE("cartslot", pce_cart_slot_device, read_cart, write_cart) - AM_RANGE( 0x100000, 0x10FFFF) AM_RAM AM_SHARE("cd_ram") - AM_RANGE( 0x110000, 0x1EDFFF) AM_NOP - AM_RANGE( 0x1EE000, 0x1EE7FF) AM_DEVREADWRITE("pce_cd", pce_cd_device, bram_r, bram_w) - AM_RANGE( 0x1EE800, 0x1EFFFF) AM_NOP - AM_RANGE( 0x1F0000, 0x1F1FFF) AM_RAM AM_MIRROR(0x6000) AM_SHARE("user_ram") - AM_RANGE( 0x1FE000, 0x1FE3FF) AM_DEVREADWRITE( "huc6270", huc6270_device, read, write ) - AM_RANGE( 0x1FE400, 0x1FE7FF) AM_DEVREADWRITE( "huc6260", huc6260_device, read, write ) - AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE( C6280_TAG, c6280_device, c6280_r, c6280_w ) - AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_DEVREADWRITE( "maincpu", h6280_device, timer_r, timer_w ) - AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( mess_pce_joystick_r, mess_pce_joystick_w ) - AM_RANGE( 0x1FF400, 0x1FF7FF) AM_DEVREADWRITE( "maincpu", h6280_device, irq_status_r, irq_status_w ) - AM_RANGE( 0x1FF800, 0x1FFBFF) AM_READWRITE( pce_cd_intf_r, pce_cd_intf_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pce_io , AS_IO, 8, pce_state ) - AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6270", huc6270_device, read, write ) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( sgx_mem , AS_PROGRAM, 8, pce_state ) - AM_RANGE( 0x000000, 0x0FFFFF) AM_DEVREADWRITE("cartslot", pce_cart_slot_device, read_cart, write_cart) - AM_RANGE( 0x100000, 0x10FFFF) AM_RAM AM_SHARE("cd_ram") - AM_RANGE( 0x110000, 0x1EDFFF) AM_NOP - AM_RANGE( 0x1EE000, 0x1EE7FF) AM_DEVREADWRITE("pce_cd", pce_cd_device, bram_r, bram_w) - AM_RANGE( 0x1EE800, 0x1EFFFF) AM_NOP - AM_RANGE( 0x1F0000, 0x1F7FFF) AM_RAM AM_SHARE("user_ram") - AM_RANGE( 0x1FE000, 0x1FE007) AM_DEVREADWRITE( "huc6270_0", huc6270_device, read, write ) AM_MIRROR(0x03E0) - AM_RANGE( 0x1FE008, 0x1FE00F) AM_DEVREADWRITE( "huc6202", huc6202_device, read, write ) AM_MIRROR(0x03E0) - AM_RANGE( 0x1FE010, 0x1FE017) AM_DEVREADWRITE( "huc6270_1", huc6270_device, read, write ) AM_MIRROR(0x03E0) - AM_RANGE( 0x1FE400, 0x1FE7FF) AM_DEVREADWRITE( "huc6260", huc6260_device, read, write ) - AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE(C6280_TAG, c6280_device, c6280_r, c6280_w ) - AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_DEVREADWRITE("maincpu", h6280_device, timer_r, timer_w ) - AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE(mess_pce_joystick_r, mess_pce_joystick_w ) - AM_RANGE( 0x1FF400, 0x1FF7FF) AM_DEVREADWRITE("maincpu", h6280_device, irq_status_r, irq_status_w ) - AM_RANGE( 0x1FF800, 0x1FFBFF) AM_READWRITE(pce_cd_intf_r, pce_cd_intf_w ) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( sgx_io , AS_IO, 8, pce_state ) - AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6202", huc6202_device, io_read, io_write ) -ADDRESS_MAP_END - - -UINT32 pce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_huc6260->video_update( bitmap, cliprect ); - return 0; -} - - -WRITE_LINE_MEMBER(pce_state::pce_irq_changed) -{ - m_maincpu->set_input_line(0, state); -} - - -static SLOT_INTERFACE_START(pce_cart) - SLOT_INTERFACE_INTERNAL("rom", PCE_ROM_STD) - SLOT_INTERFACE_INTERNAL("cdsys3u", PCE_ROM_CDSYS3) - SLOT_INTERFACE_INTERNAL("cdsys3j", PCE_ROM_CDSYS3) - SLOT_INTERFACE_INTERNAL("populous", PCE_ROM_POPULOUS) - SLOT_INTERFACE_INTERNAL("sf2", PCE_ROM_SF2) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( pce_common, pce_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", H6280, MAIN_CLOCK/3) - MCFG_CPU_PROGRAM_MAP(pce_mem) - MCFG_CPU_IO_MAP(pce_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(pce_state, pce ) - MCFG_MACHINE_RESET_OVERRIDE(pce_state, mess_pce ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, HUC6260_WPF, 64, 64 + 1024 + 64, HUC6260_LPF, 18, 18 + 242) - MCFG_SCREEN_UPDATE_DRIVER( pce_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") - - MCFG_DEVICE_ADD( "huc6260", HUC6260, MAIN_CLOCK ) - MCFG_HUC6260_NEXT_PIXEL_DATA_CB(DEVREAD16("huc6270", huc6270_device, next_pixel)) - MCFG_HUC6260_TIME_TIL_NEXT_EVENT_CB(DEVREAD16("huc6270", huc6270_device, time_until_next_event)) - MCFG_HUC6260_VSYNC_CHANGED_CB(DEVWRITELINE("huc6270", huc6270_device, vsync_changed)) - MCFG_HUC6260_HSYNC_CHANGED_CB(DEVWRITELINE("huc6270", huc6270_device, hsync_changed)) - - MCFG_DEVICE_ADD( "huc6270", HUC6270, 0 ) - MCFG_HUC6270_VRAM_SIZE(0x10000) - MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed)) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6) - MCFG_C6280_CPU("maincpu") - MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) - MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) - - MCFG_PCE_CD_ADD("pce_cd") - - MCFG_SOFTWARE_LIST_ADD("cd_list","pcecd") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( pce, pce_common ) - MCFG_PCE_CARTRIDGE_ADD("cartslot", pce_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","pce") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( tg16, pce_common ) - MCFG_TG16_CARTRIDGE_ADD("cartslot", pce_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","tg16") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( sgx, pce_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", H6280, MAIN_CLOCK/3) - MCFG_CPU_PROGRAM_MAP(sgx_mem) - MCFG_CPU_IO_MAP(sgx_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(pce_state, pce ) - MCFG_MACHINE_RESET_OVERRIDE(pce_state, mess_pce ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, HUC6260_WPF, 64, 64 + 1024 + 64, HUC6260_LPF, 18, 18 + 242) - MCFG_SCREEN_UPDATE_DRIVER( pce_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") - - MCFG_DEVICE_ADD( "huc6260", HUC6260, MAIN_CLOCK ) - MCFG_HUC6260_NEXT_PIXEL_DATA_CB(DEVREAD16("huc6202", huc6202_device, next_pixel)) - MCFG_HUC6260_TIME_TIL_NEXT_EVENT_CB(DEVREAD16("huc6202", huc6202_device, time_until_next_event)) - MCFG_HUC6260_VSYNC_CHANGED_CB(DEVWRITELINE("huc6202", huc6202_device, vsync_changed)) - MCFG_HUC6260_HSYNC_CHANGED_CB(DEVWRITELINE("huc6202", huc6202_device, hsync_changed)) - MCFG_DEVICE_ADD( "huc6270_0", HUC6270, 0 ) - MCFG_HUC6270_VRAM_SIZE(0x10000) - MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed)) - MCFG_DEVICE_ADD( "huc6270_1", HUC6270, 0 ) - MCFG_HUC6270_VRAM_SIZE(0x10000) - MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed)) - MCFG_DEVICE_ADD( "huc6202", HUC6202, 0 ) - MCFG_HUC6202_NEXT_PIXEL_0_CB(DEVREAD16("huc6270_0", huc6270_device, next_pixel)) - MCFG_HUC6202_TIME_TIL_NEXT_EVENT_0_CB(DEVREAD16("huc6270_0", huc6270_device, time_until_next_event)) - MCFG_HUC6202_VSYNC_CHANGED_0_CB(DEVWRITELINE("huc6270_0", huc6270_device, vsync_changed)) - MCFG_HUC6202_HSYNC_CHANGED_0_CB(DEVWRITELINE("huc6270_0", huc6270_device, hsync_changed)) - MCFG_HUC6202_READ_0_CB(DEVREAD8("huc6270_0", huc6270_device, read)) - MCFG_HUC6202_WRITE_0_CB(DEVWRITE8("huc6270_0", huc6270_device, write)) - MCFG_HUC6202_NEXT_PIXEL_1_CB(DEVREAD16("huc6270_1", huc6270_device, next_pixel)) - MCFG_HUC6202_TIME_TIL_NEXT_EVENT_1_CB(DEVREAD16("huc6270_1", huc6270_device, time_until_next_event)) - MCFG_HUC6202_VSYNC_CHANGED_1_CB(DEVWRITELINE("huc6270_1", huc6270_device, vsync_changed)) - MCFG_HUC6202_HSYNC_CHANGED_1_CB(DEVWRITELINE("huc6270_1", huc6270_device, hsync_changed)) - MCFG_HUC6202_READ_1_CB(DEVREAD8("huc6270_1", huc6270_device, read)) - MCFG_HUC6202_WRITE_1_CB(DEVWRITE8("huc6270_1", huc6270_device, write)) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6) - MCFG_C6280_CPU("maincpu") - MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) - - MCFG_PCE_CARTRIDGE_ADD("cartslot", pce_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","sgx") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("pce_list","pce") - - MCFG_PCE_CD_ADD("pce_cd") - - MCFG_SOFTWARE_LIST_ADD("cd_list","pcecd") -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( pce ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) -ROM_END - -#define rom_tg16 rom_pce -#define rom_sgx rom_pce - -CONS( 1987, pce, 0, 0, pce, pce, pce_state, mess_pce, "Nippon Electronic Company", "PC Engine", MACHINE_IMPERFECT_SOUND) -CONS( 1989, tg16, pce, 0, tg16, pce, pce_state, tg16, "Nippon Electronic Company", "TurboGrafx 16", MACHINE_IMPERFECT_SOUND) -CONS( 1989, sgx, pce, 0, sgx, pce, pce_state, sgx, "Nippon Electronic Company", "SuperGrafx", MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/pce220.c b/src/mess/drivers/pce220.c deleted file mode 100644 index 3edaa42e745..00000000000 --- a/src/mess/drivers/pce220.c +++ /dev/null @@ -1,1049 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Sandro Ronco -/*************************************************************************** - - Sharp PC-E220 - - preliminary driver by Angelo Salese - improvements by Sandro Ronco - - Notes: - - NVRAM works only if the machine is turned off (with OFF key) before closing MESS - - TODO: - - ON key doesn't work. - - Fix the PC-G850V keyboard, that sometimes is too slow. - - LCD contrast. - - Add an artwork for the LCD symbols. - - Add other models that have a similar hardware. - - More info: - http://wwwhomes.uni-bielefeld.de/achim/pc-e220.html - http://www.akiyan.com/pc-g850_technical_data (in Japanese) - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "sound/beep.h" -#include "machine/pce220_ser.h" -#include "machine/nvram.h" -#include "rendlay.h" - -// Interrupt flags -#define IRQ_FLAG_KEY 0x01 -#define IRQ_FLAG_ON 0x02 -#define IRQ_FLAG_TIMER 0x04 - -class pce220_state : public driver_device -{ -public: - pce220_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_beep(*this, "beeper"), - m_serial(*this, PCE220SERIAL_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_beep; - required_device m_serial; - - // HD61202 LCD controller - UINT8 m_lcd_index_row; - UINT8 m_lcd_index_col; - UINT8 m_lcd_start_line; - UINT8 m_lcd_on; - - //basic machine - UINT8 m_bank_num; - UINT8 m_irq_mask; - UINT8 m_irq_flag; - UINT8 m_timer_status; - UINT16 m_kb_matrix; - UINT8 *m_vram; - - UINT8 m_port15; - UINT8 m_port18; - - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER( lcd_status_r ); - DECLARE_WRITE8_MEMBER( lcd_control_w ); - DECLARE_READ8_MEMBER( lcd_data_r ); - DECLARE_WRITE8_MEMBER( lcd_data_w ); - DECLARE_READ8_MEMBER( rom_bank_r ); - DECLARE_WRITE8_MEMBER( rom_bank_w ); - DECLARE_WRITE8_MEMBER( ram_bank_w ); - DECLARE_READ8_MEMBER( timer_r ); - DECLARE_WRITE8_MEMBER( timer_w ); - DECLARE_WRITE8_MEMBER( boot_bank_w ); - DECLARE_READ8_MEMBER( port15_r ); - DECLARE_WRITE8_MEMBER( port15_w ); - DECLARE_READ8_MEMBER( port18_r ); - DECLARE_WRITE8_MEMBER( port18_w ); - DECLARE_READ8_MEMBER( port1f_r ); - DECLARE_WRITE8_MEMBER( kb_matrix_w ); - DECLARE_READ8_MEMBER( kb_r ); - DECLARE_READ8_MEMBER( irq_status_r ); - DECLARE_WRITE8_MEMBER( irq_ack_w ); - DECLARE_WRITE8_MEMBER( irq_mask_w ); - DECLARE_PALETTE_INIT(pce220); - DECLARE_INPUT_CHANGED_MEMBER(kb_irq); - DECLARE_INPUT_CHANGED_MEMBER(on_irq); - TIMER_DEVICE_CALLBACK_MEMBER(pce220_timer_callback); -}; - -class pcg850v_state : public pce220_state -{ -public: - pcg850v_state(const machine_config &mconfig, device_type type, const char *tag) - : pce220_state(mconfig, type, tag) - { } - - UINT8 m_g850v_bank_num; - UINT8 m_lcd_effects; - UINT8 m_lcd_contrast; - UINT8 m_lcd_read_mode; - - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER( g850v_bank_r ); - DECLARE_WRITE8_MEMBER( g850v_bank_w ); - DECLARE_READ8_MEMBER( g850v_lcd_status_r ); - DECLARE_WRITE8_MEMBER( g850v_lcd_control_w ); - DECLARE_READ8_MEMBER( g850v_lcd_data_r ); - DECLARE_WRITE8_MEMBER( g850v_lcd_data_w ); -}; - -UINT32 pce220_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 lcd_symbols[4]; - - if (m_lcd_on) - { - for (int y = 0; y < 4; y++) - { - int row_pos = 0; - - for (int x = 0; x < 12; x++) - { - for (int xi = 0; xi < 5; xi++) - { - for (int yi = 0; yi < 8; yi++) - { - //first 12 columns - int panel1_addr = ((m_lcd_start_line>>3) + y)*0x40 + row_pos; - bitmap.pix16(y*8 + yi, x*6 + xi) = (m_vram[panel1_addr & 0x1ff] >> yi) & 1; - - //last 12 columns - int panel2_addr = ((m_lcd_start_line>>3) + y + 4)*0x40 + (59-row_pos); - bitmap.pix16(y*8 + yi, (x+12)*6 + xi) = (m_vram[panel2_addr & 0x1ff] >> yi) & 1; - } - - row_pos++; - } - } - } - - lcd_symbols[0] = m_vram[((m_lcd_start_line>>3)*0x40 + 0x03c) & 0x1ff]; - lcd_symbols[1] = m_vram[((m_lcd_start_line>>3)*0x40 + 0x0fc) & 0x1ff]; - lcd_symbols[2] = m_vram[((m_lcd_start_line>>3)*0x40 + 0x13c) & 0x1ff]; - lcd_symbols[3] = m_vram[((m_lcd_start_line>>3)*0x40 + 0x1fc) & 0x1ff]; - } - else - { - bitmap.fill(0, cliprect); - memset(lcd_symbols, 0, sizeof(lcd_symbols)); - } - - output_set_value("BUSY" , (lcd_symbols[0] & 0x01) ? 1 : 0); - output_set_value("CAPS" , (lcd_symbols[0] & 0x02) ? 1 : 0); - output_set_value("KANA" , (lcd_symbols[0] & 0x04) ? 1 : 0); - output_set_value("SYO" , (lcd_symbols[0] & 0x08) ? 1 : 0); - output_set_value("2ndF" , (lcd_symbols[0] & 0x10) ? 1 : 0); - output_set_value("TEXT" , (lcd_symbols[1] & 0x08) ? 1 : 0); - output_set_value("CASL" , (lcd_symbols[1] & 0x10) ? 1 : 0); - output_set_value("PRO" , (lcd_symbols[1] & 0x20) ? 1 : 0); - output_set_value("RUN" , (lcd_symbols[1] & 0x40) ? 1 : 0); - output_set_value("BATT" , (lcd_symbols[2] & 0x01) ? 1 : 0); - output_set_value("E" , (lcd_symbols[2] & 0x02) ? 1 : 0); - output_set_value("M" , (lcd_symbols[2] & 0x04) ? 1 : 0); - output_set_value("CONST", (lcd_symbols[2] & 0x08) ? 1 : 0); - output_set_value("RAD" , (lcd_symbols[2] & 0x10) ? 1 : 0); - output_set_value("G" , (lcd_symbols[2] & 0x20) ? 1 : 0); - output_set_value("DE" , (lcd_symbols[2] & 0x40) ? 1 : 0); - output_set_value("STAT" , (lcd_symbols[3] & 0x20) ? 1 : 0); - output_set_value("PRINT", (lcd_symbols[3] & 0x40) ? 1 : 0); - - return 0; -} - -UINT32 pcg850v_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 lcd_symbols[6]; - int color0 = 0; - int color1 = 1; - - if (m_lcd_on) - { - switch (m_lcd_effects) - { - case 0x01: //mirror effect - //TODO - break; - case 0x05: //black mask effect - color0 = color1 = 1; - break; - case 0x07: //reverse effect - color0 = 1; - color1 = 0; - break; - case 0x08: //contrast effect - //TODO: use the max contrast value - break; - case 0x0e: //white mask effect - color0 = color1 = 0; - break; - } - - for (int y = 0; y < 6; y++) - { - int row_pos = 0; - - for (int x = 0; x < 24; x++) - { - for (int xi = 0; xi < 6; xi++) - { - for (int yi = 0; yi < 8; yi++) - { - int addr = ((m_lcd_start_line>>3) + y)*0x100 + row_pos; - bitmap.pix16(y*8 + yi, x*6 + xi) = ((m_vram[addr & 0x7ff] >> yi) & 1 ) ? color1 : color0; - } - - row_pos++; - } - } - } - - lcd_symbols[0] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x090) & 0x7ff]; - lcd_symbols[1] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x190) & 0x7ff]; - lcd_symbols[2] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x290) & 0x7ff]; - lcd_symbols[3] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x390) & 0x7ff]; - lcd_symbols[4] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x490) & 0x7ff]; - lcd_symbols[5] = m_vram[((m_lcd_start_line>>3)*0x100 + 0x590) & 0x7ff]; - } - else - { - bitmap.fill(0, cliprect); - memset(lcd_symbols, 0, sizeof(lcd_symbols)); - } - - output_set_value("RUN" , (lcd_symbols[0] & 0x02) ? 1 : 0); - output_set_value("PRO" , (lcd_symbols[0] & 0x08) ? 1 : 0); - output_set_value("TEXT" , (lcd_symbols[0] & 0x40) ? 1 : 0); - output_set_value("CASL" , (lcd_symbols[1] & 0x08) ? 1 : 0); - output_set_value("STAT" , (lcd_symbols[2] & 0x01) ? 1 : 0); - output_set_value("2ndF" , (lcd_symbols[2] & 0x20) ? 1 : 0); - output_set_value("M" , (lcd_symbols[2] & 0x80) ? 1 : 0); - output_set_value("CAPS" , (lcd_symbols[3] & 0x04) ? 1 : 0); - output_set_value("KANA" , (lcd_symbols[3] & 0x80) ? 1 : 0); - output_set_value("SYO" , (lcd_symbols[4] & 0x02) ? 1 : 0); - output_set_value("DE" , (lcd_symbols[4] & 0x10) ? 1 : 0); - output_set_value("G" , (lcd_symbols[4] & 0x40) ? 1 : 0); - output_set_value("RAD" , (lcd_symbols[5] & 0x01) ? 1 : 0); - output_set_value("CONST", (lcd_symbols[5] & 0x04) ? 1 : 0); - output_set_value("PRINT", (lcd_symbols[5] & 0x10) ? 1 : 0); - output_set_value("BUSY" , (lcd_symbols[5] & 0x40) ? 1 : 0); - output_set_value("BATT" , (lcd_symbols[5] & 0x80) ? 1 : 0); - - return 0; -} - -READ8_MEMBER( pce220_state::lcd_status_r ) -{ - /* - x--- ---- Busy (not emulated) - --x- ---- LCD on/off - ---x ---- Reset - */ - UINT8 data = 0; - - data &= (m_lcd_on<<5); - - return data; -} - -WRITE8_MEMBER( pce220_state::lcd_control_w ) -{ - if((data & 0xfe) == 0x3e) //Display on/off - m_lcd_on = data & 0x01; - if((data & 0xb8) == 0xb8) //Set page - m_lcd_index_row = data & 0x07; - if((data & 0xc0) == 0x40) //Set address - m_lcd_index_col = data & 0x3f; - if((data & 0xc0) == 0xc0) //Set display start line - m_lcd_start_line = data & 0x3f; -} - -READ8_MEMBER( pce220_state::lcd_data_r ) -{ - return m_vram[(m_lcd_index_row*0x40 + m_lcd_index_col - 1) & 0x1ff]; -} - -WRITE8_MEMBER( pce220_state::lcd_data_w ) -{ - m_vram[(m_lcd_index_row*0x40 + m_lcd_index_col) & 0x1ff] = data; - - m_lcd_index_col++; -} - -READ8_MEMBER( pce220_state::rom_bank_r ) -{ - return m_bank_num; -} - -WRITE8_MEMBER( pce220_state::rom_bank_w ) -{ - UINT8 bank4 = data & 0x07; // bits 0,1,2 - UINT8 bank3 = (data & 0x70) >> 4; // bits 4,5,6 - - m_bank_num = data; - - membank("bank3")->set_entry(bank3); - membank("bank4")->set_entry(bank4); -} - -WRITE8_MEMBER( pce220_state::ram_bank_w ) -{ - UINT8 bank = BIT(data,2); - - membank("bank1")->set_entry(bank); - membank("bank2")->set_entry(bank); -} - -READ8_MEMBER( pce220_state::timer_r ) -{ - return m_timer_status; -} - -WRITE8_MEMBER( pce220_state::timer_w ) -{ - m_timer_status = data & 1; -} - -WRITE8_MEMBER( pce220_state::boot_bank_w ) -{ - // set to 1 after boot for restore the ram in the first bank - if (data & 0x01) - { - address_space &space_prg = m_maincpu->space(AS_PROGRAM); - space_prg.install_write_bank(0x0000, 0x3fff, "bank1"); - membank("bank1")->set_entry(0); - } -} - -READ8_MEMBER( pce220_state::port15_r ) -{ - /* - x--- ---- XIN input enabled - ---- ---0 - */ - return m_port15; -} - -WRITE8_MEMBER( pce220_state::port15_w ) -{ - m_serial->enable_interface(BIT(data, 7)); - - m_port15 = data; -} - -READ8_MEMBER( pce220_state::port18_r ) -{ - /* - x--- ---- XOUT/TXD - ---- --x- DOUT - ---- ---x BUSY/CTS - */ - - return m_port18; -} - -WRITE8_MEMBER( pce220_state::port18_w ) -{ - m_beep->set_state(BIT(data, 7)); - - m_serial->out_busy(BIT(data, 0)); - m_serial->out_dout(BIT(data, 1)); - m_serial->out_xout(BIT(data, 7)); - - m_port18 = data; -} - -READ8_MEMBER( pce220_state::port1f_r ) -{ - /* - x--- ---- ON - resp. break key status (?) - ---- -x-- XIN/RXD - ---- --x- ACK/RTS - ---- ---x DIN - */ - - UINT8 data = 0; - - data |= m_serial->in_din()<<0; - data |= m_serial->in_ack()<<1; - data |= m_serial->in_xin()<<2; - - data |= ioport("ON")->read()<<7; - - return data; -} - -WRITE8_MEMBER( pce220_state::kb_matrix_w ) -{ - switch(offset) - { - case 0: - m_kb_matrix = (m_kb_matrix & 0x300) | data; - break; - case 1: - m_kb_matrix = (m_kb_matrix & 0xff) | ((data&0x03)<<8); - break; - } -} - -READ8_MEMBER( pce220_state::kb_r ) -{ - UINT8 data = 0x00; - - if (m_kb_matrix & 0x01) - data |= ioport("LINE0")->read(); - if (m_kb_matrix & 0x02) - data |= ioport("LINE1")->read(); - if (m_kb_matrix & 0x04) - data |= ioport("LINE2")->read(); - if (m_kb_matrix & 0x08) - data |= ioport("LINE3")->read(); - if (m_kb_matrix & 0x10) - data |= ioport("LINE4")->read(); - if (m_kb_matrix & 0x20) - data |= ioport("LINE5")->read(); - if (m_kb_matrix & 0x40) - data |= ioport("LINE6")->read(); - if (m_kb_matrix & 0x80) - data |= ioport("LINE7")->read(); - if (m_kb_matrix & 0x100) - data |= ioport("LINE8")->read(); - if (m_kb_matrix & 0x200) - data |= ioport("LINE9")->read(); - - return data; -} - -READ8_MEMBER( pce220_state::irq_status_r ) -{ - /* - ---- -x-- timer - ---- --x- ON-Key - ---- ---x keyboard - */ - return m_irq_flag; -} - -WRITE8_MEMBER( pce220_state::irq_ack_w ) -{ - m_irq_flag &= ~data; -} - -WRITE8_MEMBER( pce220_state::irq_mask_w ) -{ - m_irq_mask = data; -} - -READ8_MEMBER( pcg850v_state::g850v_bank_r ) -{ - return m_g850v_bank_num; -} - -WRITE8_MEMBER( pcg850v_state::g850v_bank_w ) -{ - address_space &space_prg = m_maincpu->space(AS_PROGRAM); - - if (data < 0x16) - { - space_prg.install_read_bank(0xc000, 0xffff, "bank4"); - membank("bank4")->set_entry(data); - } - else - { - space_prg.unmap_read(0xc000, 0xffff); - } - - m_g850v_bank_num = data; -} - -READ8_MEMBER( pcg850v_state::g850v_lcd_status_r ) -{ - /* - x--- ---- Busy (not emulated) - --x- ---- LCD on/off - */ - UINT8 data = 0; - - data &= (m_lcd_on<<5); - - return data; -} - -WRITE8_MEMBER( pcg850v_state::g850v_lcd_control_w ) -{ - if ((data & 0xf0) == 0x00) // LCD column LSB - { - m_lcd_index_col = (m_lcd_index_col & 0xf0) | (data & 0x0f); - } - else if ((data & 0xf0) == 0x10) // LCD column MSB - { - m_lcd_index_col = (m_lcd_index_col & 0x0f) | ((data<<4) & 0xf0); - } - else if ((data & 0xf0) == 0x20) // LCD on/off - { - m_lcd_on = BIT(data, 0); - } - else if ((data & 0xc0) == 0x40) // display start line - { - m_lcd_start_line = data & 0x3f; - } - else if ((data & 0xe0) == 0x80) // contrast level - { - m_lcd_contrast = data; - } - else if ((data & 0xf0) == 0xa0) // display effects - { - m_lcd_effects = data & 0x0f; - } - else if ((data & 0xf0) == 0xb0) // set row - { - m_lcd_index_row = data & 0x07; - } - else if ((data & 0xf0) == 0xe0) // display controls - { - if (BIT(data, 1)) - m_lcd_contrast = 0; - - m_lcd_read_mode = BIT(data, 2); - } - else - { - logerror( "PC-G850V: Unknown LCD command 0x%02x\n", data ); - } -} - -READ8_MEMBER( pcg850v_state::g850v_lcd_data_r ) -{ - UINT8 data = m_vram[(m_lcd_index_row*0x100 + m_lcd_index_col - 1) & 0x7ff]; - - if (m_lcd_read_mode == 1) - m_lcd_index_col++; - - return data; -} - -WRITE8_MEMBER( pcg850v_state::g850v_lcd_data_w ) -{ - m_vram[(m_lcd_index_row*0x100 + m_lcd_index_col) & 0x7ff] = data; - - m_lcd_index_col++; -} - - -static ADDRESS_MAP_START(pce220_mem, AS_PROGRAM, 8, pce220_state) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pce220_io , AS_IO, 8, pce220_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x10, 0x10) AM_READ(kb_r) - AM_RANGE(0x11, 0x12) AM_WRITE(kb_matrix_w) - AM_RANGE(0x13, 0x13) AM_READ_PORT("SHIFT") - AM_RANGE(0x14, 0x14) AM_READWRITE(timer_r, timer_w) - AM_RANGE(0x15, 0x15) AM_READWRITE(port15_r, port15_w) - AM_RANGE(0x16, 0x16) AM_READWRITE(irq_status_r, irq_ack_w) - AM_RANGE(0x17, 0x17) AM_WRITE(irq_mask_w) - AM_RANGE(0x18, 0x18) AM_READWRITE(port18_r, port18_w) - AM_RANGE(0x19, 0x19) AM_READWRITE(rom_bank_r, rom_bank_w) - AM_RANGE(0x1a, 0x1a) AM_WRITE(boot_bank_w) - AM_RANGE(0x1b, 0x1b) AM_WRITE(ram_bank_w) - AM_RANGE(0x1c, 0x1c) AM_WRITENOP //peripheral reset - AM_RANGE(0x1d, 0x1d) AM_READ_PORT("BATTERY") - AM_RANGE(0x1e, 0x1e) AM_WRITENOP //??? - AM_RANGE(0x1f, 0x1f) AM_READ(port1f_r) - AM_RANGE(0x58, 0x58) AM_WRITE(lcd_control_w) - AM_RANGE(0x59, 0x59) AM_READ(lcd_status_r) - AM_RANGE(0x5a, 0x5a) AM_WRITE(lcd_data_w) - AM_RANGE(0x5b, 0x5b) AM_READ(lcd_data_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pcg850v_io , AS_IO, 8, pcg850v_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x10, 0x10) AM_READ(kb_r) - AM_RANGE(0x11, 0x12) AM_WRITE(kb_matrix_w) - AM_RANGE(0x13, 0x13) AM_READ_PORT("SHIFT") - AM_RANGE(0x14, 0x14) AM_READWRITE(timer_r, timer_w) - AM_RANGE(0x15, 0x15) AM_READWRITE(port15_r, port15_w) - AM_RANGE(0x16, 0x16) AM_READWRITE(irq_status_r, irq_ack_w) - AM_RANGE(0x17, 0x17) AM_WRITE(irq_mask_w) - AM_RANGE(0x18, 0x18) AM_READWRITE(port18_r, port18_w) - AM_RANGE(0x19, 0x19) AM_READWRITE(rom_bank_r, rom_bank_w) - AM_RANGE(0x1a, 0x1a) AM_WRITE(boot_bank_w) - AM_RANGE(0x1b, 0x1b) AM_WRITE(ram_bank_w) - AM_RANGE(0x1c, 0x1c) AM_WRITENOP //peripheral reset - AM_RANGE(0x1d, 0x1d) AM_READ_PORT("BATTERY") - AM_RANGE(0x1e, 0x1e) AM_WRITENOP //??? - AM_RANGE(0x1f, 0x1f) AM_READ(port1f_r) - AM_RANGE(0x40, 0x40) AM_READWRITE(g850v_lcd_status_r, g850v_lcd_control_w) - AM_RANGE(0x41, 0x41) AM_READWRITE(g850v_lcd_data_r, g850v_lcd_data_w) - AM_RANGE(0x69, 0x69) AM_READWRITE(g850v_bank_r, g850v_bank_w) -ADDRESS_MAP_END - -INPUT_CHANGED_MEMBER(pce220_state::kb_irq) -{ - if (m_irq_mask & IRQ_FLAG_KEY) - { - m_maincpu->set_input_line(0, newval ? ASSERT_LINE : CLEAR_LINE ); - - m_irq_flag = (m_irq_flag & 0xfe) | (newval & 0x01); - } -} - -INPUT_CHANGED_MEMBER(pce220_state::on_irq) -{ - if (m_irq_mask & IRQ_FLAG_ON) - { - m_maincpu->set_input_line(0, newval ? ASSERT_LINE : CLEAR_LINE ); - - m_irq_flag = (m_irq_flag & 0xfd) | ((newval & 0x01)<<1); - } -} - -/* Input ports */ -static INPUT_PORTS_START( pce220 ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) - PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x01, "Low Battery" ) - - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Q') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('W') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('E') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('R') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('T') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Y') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('U') PORT_CHAR('\'') - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('A') PORT_CHAR('[') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('S') PORT_CHAR(']') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('D') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('F') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('G') PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('H') PORT_CHAR('|') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('J') PORT_CHAR('`') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('K') PORT_CHAR('_') - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('X') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(',') PORT_CHAR('?') - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("CAL") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("BAS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("CAPS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("ANS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_NAME("TAB") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("SPACE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(' ') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("DOWN") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("UP") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("LEFT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("RIGHT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("CONS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('.') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("+/-") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("RET") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(13) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('L') PORT_CHAR('=') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DEL") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('1') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('2') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('3') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('-') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("M+") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('I') PORT_CHAR('<') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('O') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('4') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('5') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('6') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('*') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("RM") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('P') PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("BS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("n!") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('7') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('8') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('9') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('/') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(')') - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("hyp") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("DEG") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("y^x") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('^') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("sqrt") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("x^2") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('(') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("1/x") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("MDF") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_NAME("2nd") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("sin") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("cos") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("ln") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("log") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("tan") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("FSE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("CCE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_START("SHIFT") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Shift") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("ON") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("ON") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, on_irq, NULL ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pcg850v ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) - PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x01, "Low Battery" ) - - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Q') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('W') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('E') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('R') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('T') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Y') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('U') PORT_CHAR('\'') - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('A') PORT_CHAR('[') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('S') PORT_CHAR(']') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('D') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('F') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('H') PORT_CHAR('|') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('J') PORT_CHAR('`') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('K') PORT_CHAR('_') - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('X') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(',') PORT_CHAR('?') - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("BAS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("TEXT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("CAPS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("KANA") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_NAME("TAB") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("SPACE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(' ') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("DOWN") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("UP") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("LEFT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("RIGHT") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("CONS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('.') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("=") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("RET") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(13) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('L') PORT_CHAR('=') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("DEL") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('1') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('2') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('3') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('-') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("M+") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('I') PORT_CHAR('<') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('O') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('4') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('5') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('6') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('*') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("RM") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('P') PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("BS") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("pi") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('7') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('8') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('9') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('/') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(')') - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("nPr") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("DEG") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("SQR") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("SQU") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("x^y") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('^') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR('(') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("1/x") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("MDF") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_NAME("2nd") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("sin") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("cos") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("ln") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("log") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_NAME("tan") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("FSE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("CCE") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) - PORT_START("SHIFT") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Shift") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, kb_irq, NULL ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("ON") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("ON") PORT_CHANGED_MEMBER(DEVICE_SELF, pce220_state, on_irq, NULL ) -INPUT_PORTS_END - -void pce220_state::machine_start() -{ - UINT8 *rom = memregion("user1")->base(); - UINT8 *ram = m_ram->pointer(); - - membank("bank1")->configure_entries(0, 2, ram + 0x0000, 0x8000); - membank("bank2")->configure_entries(0, 2, ram + 0x4000, 0x8000); - membank("bank3")->configure_entries(0, 8, rom, 0x4000); - membank("bank4")->configure_entries(0, 8, rom, 0x4000); - - m_vram = (UINT8*)memregion("lcd_vram")->base(); - - machine().device("nvram")->set_base(ram, m_ram->size()); -} - -void pcg850v_state::machine_start() -{ - UINT8 *rom = memregion("user1")->base(); - UINT8 *ram = m_ram->pointer(); - - membank("bank1")->configure_entries(0, 2, ram + 0x0000, 0x8000); - membank("bank2")->configure_entries(0, 2, ram + 0x4000, 0x8000); - membank("bank3")->configure_entries(0, 22, rom, 0x4000); - membank("bank4")->configure_entries(0, 22, rom, 0x4000); - - m_vram = (UINT8*)memregion("lcd_vram")->base(); - machine().device("nvram")->set_base(ram, m_ram->size()); -} - -void pce220_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - space.unmap_write(0x0000, 0x3fff); - - // install the boot code into the first bank - membank("bank1")->set_base(memregion("user1")->base() + 0x0000); - - m_lcd_index_row = 0; - m_lcd_index_col = 0; - m_lcd_start_line = 0; - m_lcd_on = 0; - m_bank_num = 0; - m_irq_mask = 0; - m_irq_flag = 0; - m_timer_status = 0; - m_kb_matrix = 0; -} - -void pcg850v_state::machine_reset() -{ - pce220_state::machine_reset(); - - m_g850v_bank_num = 0; - m_lcd_effects = 0; - m_lcd_contrast = 0; - m_lcd_read_mode = 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(pce220_state::pce220_timer_callback) -{ - m_timer_status = !m_timer_status; - - if (m_irq_mask & IRQ_FLAG_TIMER) - { - m_maincpu->set_input_line(0, HOLD_LINE ); - - m_irq_flag = (m_irq_flag & 0xfb) | (m_timer_status<<2); - } -} - -PALETTE_INIT_MEMBER(pce220_state,pce220) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - - -static MACHINE_CONFIG_START( pce220, pce220_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, 3072000 ) // CMOS-SC7852 - MCFG_CPU_PROGRAM_MAP(pce220_mem) - MCFG_CPU_IO_MAP(pce220_io) - - /* video hardware */ - // 4 lines x 24 characters, resp. 144 x 32 pixel - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(pce220_state, screen_update) - MCFG_SCREEN_SIZE(24*6, 4*8) - MCFG_SCREEN_VISIBLE_AREA(0, 24*6-1, 0, 4*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pce220_state,pce220) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468)) - - MCFG_NVRAM_ADD_0FILL("nvram") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") // 32K internal + 32K external card - - MCFG_PCE220_SERIAL_ADD(PCE220SERIAL_TAG) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pcg850v, pcg850v_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz ) // CMOS-SC7852 - MCFG_CPU_PROGRAM_MAP(pce220_mem) - MCFG_CPU_IO_MAP(pcg850v_io) - - /* video hardware */ - // 6 lines x 24 characters, resp. 144 x 48 pixel - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(pcg850v_state, screen_update) - MCFG_SCREEN_SIZE(144, 48) - MCFG_SCREEN_VISIBLE_AREA(0, 144-1, 0, 48-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pce220_state,pce220) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468)) - - MCFG_NVRAM_ADD_0FILL("nvram") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") // 32K internal + 32K external card - - MCFG_PCE220_SERIAL_ADD(PCE220SERIAL_TAG) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pce220 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v1", "v 0.1") - ROM_SYSTEM_BIOS( 1, "v2", "v 0.2") - ROM_LOAD( "bank0.bin", 0x0000, 0x4000, CRC(1fa94d11) SHA1(24c54347dbb1423388360a359aa09db47d2057b7)) - ROM_LOAD( "bank1.bin", 0x4000, 0x4000, CRC(0f9864b0) SHA1(6b7301c96f1a865e1931d82872a1ed5d1f80644e)) - ROM_LOAD( "bank2.bin", 0x8000, 0x4000, CRC(1625e958) SHA1(090440600d461aa7efe4adbf6e975aa802aabeec)) - ROM_LOAD( "bank3.bin", 0xc000, 0x4000, CRC(ed9a57f8) SHA1(58087dc64103786a40325c0a1e04bd88bfd6da57)) - ROM_LOAD( "bank4.bin", 0x10000, 0x4000, CRC(e37665ae) SHA1(85f5c84f69f79e7ac83b30397b2a1d9629f9eafa)) - ROMX_LOAD( "bank5.bin", 0x14000, 0x4000, CRC(6b116e7a) SHA1(b29f5a070e846541bddc88b5ee9862cc36b88eee),ROM_BIOS(2)) - ROMX_LOAD( "bank5_0.1.bin", 0x14000, 0x4000, CRC(13c26eb4) SHA1(b9cd0efd6b195653b9610e20ad8aab541824a689),ROM_BIOS(1)) - ROMX_LOAD( "bank6.bin", 0x18000, 0x4000, CRC(4fbfbd18) SHA1(e5aab1df172dcb94aa90e7d898eacfc61157ff15),ROM_BIOS(2)) - ROMX_LOAD( "bank6_0.1.bin", 0x18000, 0x4000, CRC(e2cda7a6) SHA1(01b1796d9485fde6994cb5afbe97514b54cfbb3a),ROM_BIOS(1)) - ROMX_LOAD( "bank7.bin", 0x1c000, 0x4000, CRC(5e98b5b6) SHA1(f22d74d6a24f5929efaf2983caabd33859232a94),ROM_BIOS(2)) - ROMX_LOAD( "bank7_0.1.bin", 0x1c000, 0x4000, CRC(d8e821b2) SHA1(18245a75529d2f496cdbdc28cdf40def157b20c0),ROM_BIOS(1)) - - ROM_REGION( 0x200, "lcd_vram", ROMREGION_ERASE00) //HD61202 internal RAM (4096 bits) -ROM_END - -ROM_START( pcg850v ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x58000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "rom00.bin", 0x00000, 0x4000, CRC(c41a7a3e) SHA1(8b85d07e6f2fa048f8a958c261ab3344df750bd2)) - ROM_LOAD( "rom01.bin", 0x04000, 0x4000, CRC(45cafcaf) SHA1(e6142ac2ddb50c90bf1afd03ee2d2741abde8b76)) - ROM_LOAD( "rom02.bin", 0x08000, 0x4000, CRC(c81a804e) SHA1(322b9c6ca5cb7bc41a55c7874838e601ef50644e)) - ROM_LOAD( "rom03.bin", 0x0c000, 0x4000, CRC(9301e937) SHA1(b152186577abf86a7fb535cd63985f2a67e154b9)) - ROM_LOAD( "rom04.bin", 0x10000, 0x4000, CRC(6bf11755) SHA1(fe7458758d26fabfcca34e791fe2425104830b7b)) - ROM_LOAD( "rom05.bin", 0x14000, 0x4000, CRC(8a808f5e) SHA1(448caf0cc30de483d876c31785c8bb27305860b8)) - ROM_LOAD( "rom06.bin", 0x18000, 0x4000, CRC(3902f135) SHA1(40fbd51718a830e3f374843990522e29508376fd)) - ROM_LOAD( "rom07.bin", 0x1c000, 0x4000, CRC(618a7be8) SHA1(5f16e47eeeb9c153bb95c6d6e3af276576b8274e)) - ROM_LOAD( "rom08.bin", 0x20000, 0x4000, CRC(bf05b34d) SHA1(8556d64ddd89191c9dc048280e384f9146d81a16)) - ROM_LOAD( "rom09.bin", 0x24000, 0x4000, CRC(b75dbd0a) SHA1(ca149134a819fa52591ae1733270f8b3c811a18a)) - ROM_LOAD( "rom0a.bin", 0x28000, 0x4000, CRC(e7c5ec8f) SHA1(70cac20d4f01b5b2fdd76837659bc4947a1ebd21)) - ROM_LOAD( "rom0b.bin", 0x2c000, 0x4000, CRC(bdc4f889) SHA1(154d6223e8e750fcbffdb069215fee9492685747)) - ROM_LOAD( "rom0c.bin", 0x30000, 0x4000, CRC(6ef5560a) SHA1(5b2ad8e36354f448fe01acba1d2f69630de345a7)) - ROM_LOAD( "rom0d.bin", 0x34000, 0x4000, CRC(4295a44e) SHA1(0f8dfc759ed17f2b0acc1dc4912e881b1f0f65aa)) - ROM_LOAD( "rom0e.bin", 0x38000, 0x4000, CRC(0c8212e1) SHA1(8145728d87ea5a5e29c0e98c3d2d4278b1070359)) - ROM_LOAD( "rom0f.bin", 0x3c000, 0x4000, CRC(33c30dba) SHA1(296fb6fa3921822c3458acde0962c3a25cb19a1e)) - ROM_LOAD( "rom10.bin", 0x40000, 0x4000, CRC(553a0926) SHA1(2149827f9a2eb879756b3da609e17fc5b1c9bd78)) - ROM_LOAD( "rom11.bin", 0x44000, 0x4000, CRC(385a128d) SHA1(eda1192a75e4cfb50c0ac058f230a84cbfe67d51)) - ROM_LOAD( "rom12.bin", 0x48000, 0x4000, CRC(cd12dfca) SHA1(50a5defdeb4da9b2eac196816559056fc55e1dca)) - ROM_LOAD( "rom13.bin", 0x4c000, 0x4000, CRC(9bca873b) SHA1(4ce43553fb15c0ca866e9582a3ef8dc22a2795b4)) - ROM_LOAD( "rom14.bin", 0x50000, 0x4000, CRC(a2938c40) SHA1(d2c24401eea5e56268ef6eadcc612c8bbaa3342a)) - ROM_LOAD( "rom15.bin", 0x54000, 0x4000, CRC(53a0bf0a) SHA1(bf27baeaf208628fbe3c959d623cc08de21cf9f8)) - - ROM_REGION( 0x1000, "lcd_vram", ROMREGION_ERASE00) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1991, pce220, 0, 0, pce220, pce220, driver_device, 0, "Sharp", "PC-E220", MACHINE_NOT_WORKING ) -COMP( 2001, pcg850v, 0, 0, pcg850v, pcg850v, driver_device, 0, "Sharp", "PC-G850V", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pcfx.c b/src/mess/drivers/pcfx.c deleted file mode 100644 index d2faa292087..00000000000 --- a/src/mess/drivers/pcfx.c +++ /dev/null @@ -1,531 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - pcfx.c - - Driver file to handle emulation of the NEC PC-FX. - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/v810/v810.h" -#include "video/huc6261.h" -#include "video/huc6270.h" -#include "video/huc6272.h" - -struct pcfx_pad_t -{ - UINT8 ctrl[2]; - UINT8 status[2]; - UINT32 latch[2]; -}; - -class pcfx_state : public driver_device -{ -public: - enum - { - TIMER_PAD_FUNC - }; - - pcfx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_huc6261(*this, "huc6261") { } - - required_device m_maincpu; - required_device m_huc6261; - - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - // Interrupt controller (component unknown) - UINT16 m_irq_mask; - UINT16 m_irq_pending; - UINT8 m_irq_priority[8]; - - pcfx_pad_t m_pad; - - DECLARE_READ16_MEMBER( irq_read ); - DECLARE_WRITE16_MEMBER( irq_write ); - DECLARE_READ16_MEMBER( pad_r ); - DECLARE_WRITE16_MEMBER( pad_w ); - DECLARE_READ8_MEMBER( extio_r ); - DECLARE_WRITE8_MEMBER( extio_w ); - - inline void check_irqs(); - inline void set_irq_line(int line, int state); - DECLARE_WRITE_LINE_MEMBER( irq8_w ); - DECLARE_WRITE_LINE_MEMBER( irq9_w ); - DECLARE_WRITE_LINE_MEMBER( irq10_w ); - DECLARE_WRITE_LINE_MEMBER( irq11_w ); - DECLARE_WRITE_LINE_MEMBER( irq12_w ); - DECLARE_WRITE_LINE_MEMBER( irq13_w ); - DECLARE_WRITE_LINE_MEMBER( irq14_w ); - DECLARE_WRITE_LINE_MEMBER( irq15_w ); - TIMER_CALLBACK_MEMBER(pad_func); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -READ8_MEMBER(pcfx_state::extio_r) -{ - address_space &io_space = m_maincpu->space(AS_IO); - - return io_space.read_byte(offset); -} - -WRITE8_MEMBER(pcfx_state::extio_w) -{ - address_space &io_space = m_maincpu->space(AS_IO); - - io_space.write_byte(offset, data); -} - -static ADDRESS_MAP_START( pcfx_mem, AS_PROGRAM, 32, pcfx_state ) - AM_RANGE( 0x00000000, 0x001FFFFF ) AM_RAM /* RAM */ -// AM_RANGE( 0x80000000, 0x807FFFFF ) AM_READWRITE8(extio_r,extio_w,0xffffffff) /* EXTIO */ - AM_RANGE( 0xE0000000, 0xE7FFFFFF ) AM_NOP /* BackUp RAM */ - AM_RANGE( 0xE8000000, 0xE9FFFFFF ) AM_NOP /* Extended BackUp RAM */ - AM_RANGE( 0xF8000000, 0xF8000007 ) AM_NOP /* PIO */ - AM_RANGE( 0xFFF00000, 0xFFFFFFFF ) AM_ROMBANK("bank1") /* ROM */ -ADDRESS_MAP_END - -READ16_MEMBER( pcfx_state::pad_r ) -{ - UINT16 res; - UINT8 port_type = ((offset<<1) & 0x80) >> 7; - - if(((offset<<1) & 0x40) == 0) - { - // status - /* - ---- x--- - ---- ---x incoming data state (0=available) - */ - res = m_pad.status[port_type]; - //printf("STATUS %d\n",port_type); - } - else - { - // received data - //printf("RX %d\n",port_type); - res = m_pad.latch[port_type] >> (((offset<<1) & 2) ? 16 : 0); - - if(((offset<<1) & 0x02) == 0) - { - m_pad.status[port_type] &= ~8; // clear latch on LSB read according to docs - set_irq_line(11, 0); - } - } - - return res; -} - -void pcfx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_PAD_FUNC: - pad_func(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in pcfx_state::device_timer"); - } -} - -TIMER_CALLBACK_MEMBER(pcfx_state::pad_func) -{ - const char *const padnames[] = { "P1", "P2" }; - - m_pad.latch[param] = ioport(padnames[param])->read(); - m_pad.status[param] |= 8; - m_pad.ctrl[param] &= ~1; // ack TX line - // TODO: pad IRQ - set_irq_line(11, 1); -} - -WRITE16_MEMBER( pcfx_state::pad_w ) -{ - UINT8 port_type = ((offset<<1) & 0x80) >> 7; - - if(((offset<<1) & 0x40) == 0) - { - // control - /* - ---- -x-- receiver enable - ---- --x- enable multi-tap - ---- ---x enable send (0->1 transition) - */ - if(data & 1 && (!(m_pad.ctrl[port_type] & 1))) - { - timer_set(attotime::from_msec(1), TIMER_PAD_FUNC, port_type); // TODO: time - } - - m_pad.ctrl[port_type] = data & 7; - //printf("%04x CONTROL %d\n",data,port_type); - } - else - { - // transmitted data - //printf("%04x TX %d\n",data,port_type); - } -} - - -static ADDRESS_MAP_START( pcfx_io, AS_IO, 32, pcfx_state ) - AM_RANGE( 0x00000000, 0x000000FF ) AM_READWRITE16(pad_r, pad_w, 0xffffffff) /* PAD */ - AM_RANGE( 0x00000100, 0x000001FF ) AM_NOP /* HuC6230 */ - AM_RANGE( 0x00000200, 0x000002FF ) AM_NOP /* HuC6271 */ - AM_RANGE( 0x00000300, 0x000003FF ) AM_DEVREADWRITE16( "huc6261", huc6261_device, read, write, 0xffff ) /* HuC6261 */ - AM_RANGE( 0x00000400, 0x000004FF ) AM_DEVREADWRITE8( "huc6270_a", huc6270_device, read, write, 0xffff ) /* HuC6270-A */ - AM_RANGE( 0x00000500, 0x000005FF ) AM_DEVREADWRITE8( "huc6270_b", huc6270_device, read, write, 0xffff ) /* HuC6270-B */ - AM_RANGE( 0x00000600, 0x000006FF ) AM_DEVREADWRITE( "huc6272", huc6272_device, read, write ) /* HuC6272 */ - AM_RANGE( 0x00000C80, 0x00000C83 ) AM_NOP - AM_RANGE( 0x00000E00, 0x00000EFF ) AM_READWRITE16( irq_read, irq_write, 0xffff ) /* Interrupt controller */ - AM_RANGE( 0x00000F00, 0x00000FFF ) AM_NOP -// AM_RANGE( 0x00600000, 0x006FFFFF ) AM_READ(scsi_ctrl_r) - AM_RANGE( 0x00780000, 0x007FFFFF ) AM_ROM AM_REGION("scsi_rom", 0 ) - AM_RANGE( 0x80500000, 0x805000FF ) AM_NOP /* HuC6273 */ -ADDRESS_MAP_END - - -static INPUT_PORTS_START( pcfx ) - /* - xxxx ---- ---- ---- ID (0xf = 6 button pad, 0xe = tap, 0xd = ?) - */ - PORT_START("P1") - PORT_BIT( 0xf0000000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ID - PORT_DIPNAME( 0x01000000, 0x01000000, "1" ) - PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x02000000, 0x02000000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x04000000, 0x04000000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x08000000, 0x08000000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x010000, 0x010000, "2" ) - PORT_DIPSETTING( 0x010000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x020000, 0x020000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x020000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x040000, 0x040000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x040000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x080000, 0x080000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x080000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x100000, 0x100000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x100000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x200000, 0x200000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x200000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x400000, 0x400000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x400000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x800000, 0x800000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x800000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, "3" ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) // * - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) // * - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1) PORT_NAME("RUN button") - PORT_DIPNAME( 0x01, 0x01, "4" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("P2") - PORT_BIT( 0xf0000000, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0fffffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) -INPUT_PORTS_END - - -READ16_MEMBER( pcfx_state::irq_read ) -{ - UINT16 data = 0; - - switch( offset ) - { - // Interrupts pending - // Same bit order as mask - case 0x00/4: - data = m_irq_pending; - break; - - // Interrupt mask - case 0x40/4: - data = m_irq_mask; - break; - - // Interrupt priority 0 - case 0x80/4: - data = m_irq_priority[4] | ( m_irq_priority[5] << 3 ) | ( m_irq_priority[6] << 6 ) | ( m_irq_priority[7] << 9 ); - break; - - // Interrupt priority 1 - case 0xC0/4: - data = m_irq_priority[0] | ( m_irq_priority[1] << 3 ) | ( m_irq_priority[2] << 6 ) | ( m_irq_priority[3] << 9 ); - break; - } - - return data; -} - - -WRITE16_MEMBER( pcfx_state::irq_write ) -{ - switch( offset ) - { - // Interrupts pending - case 0x00/4: - logerror("irq_write: Attempt to write to irq pending register\n"); - break; - - // Interrupt mask - // --------x------- Mask interrupt level 8 (Unknown) - // ---------x------ Mask interrupt level 9 (Timer) - // ----------x----- Mask interrupt level 10 (Unknown) - // -----------x---- Mask interrupt level 11 (Pad) - // ------------x--- Mask interrupt level 12 (HuC6270-A) - // -------------x-- Mask interrupt level 13 (HuC6272) - // --------------x- Mask interrupt level 14 (HuC6270-B) - // ---------------x Mask interrupt level 15 (HuC6273) - // 0 - allow, 1 - ignore interrupt - case 0x40/4: - m_irq_mask = data; - check_irqs(); - break; - - // Interrupt priority 0 - // ----xxx--------- Priority level interrupt 12 - // -------xxx------ Priority level interrupt 13 - // ----------xxx--- Priority level interrupt 14 - // -------------xxx Priority level interrupt 15 - case 0x80/4: - m_irq_priority[7] = ( data >> 0 ) & 0x07; - m_irq_priority[6] = ( data >> 3 ) & 0x07; - m_irq_priority[5] = ( data >> 6 ) & 0x07; - m_irq_priority[4] = ( data >> 9 ) & 0x07; - check_irqs(); - break; - - // Interrupt priority 1 - // ----xxx--------- Priority level interrupt 8 - // -------xxx------ Priority level interrupt 9 - // ----------xxx--- Priority level interrupt 10 - // -------------xxx Priority level interrupt 11 - case 0xC0/4: - m_irq_priority[3] = ( data >> 0 ) & 0x07; - m_irq_priority[2] = ( data >> 3 ) & 0x07; - m_irq_priority[1] = ( data >> 6 ) & 0x07; - m_irq_priority[0] = ( data >> 9 ) & 0x07; - check_irqs(); - break; - } -} - - -inline void pcfx_state::check_irqs() -{ - UINT16 active_irqs = m_irq_pending & ~m_irq_mask; - int highest_prio = -1; - - for ( int i = 0; i < 8; i++ ) - { - if ( active_irqs & 0x80 ) - { - if ( m_irq_priority[i] >= highest_prio ) - { - highest_prio = m_irq_priority[i]; - } - } - active_irqs <<= 1; - } - - if ( highest_prio >= 0 ) - { - m_maincpu->set_input_line(8 + highest_prio, ASSERT_LINE ); - } - else - { - m_maincpu->set_input_line(0, CLEAR_LINE ); - } -} - - -inline void pcfx_state::set_irq_line(int line, int state) -{ - if ( state ) - { -//printf("Setting irq line %d\n", line); - m_irq_pending |= ( 1 << ( 15 - line ) ); - } - else - { -//printf("Clearing irq line %d\n", line); - m_irq_pending &= ~( 1 << ( 15 - line ) ); - } - check_irqs(); -} - -WRITE_LINE_MEMBER( pcfx_state::irq8_w ) -{ - set_irq_line(8, state); -} - -WRITE_LINE_MEMBER( pcfx_state::irq9_w ) -{ - set_irq_line(9, state); -} - -WRITE_LINE_MEMBER( pcfx_state::irq10_w ) -{ - set_irq_line(10, state); -} - -WRITE_LINE_MEMBER( pcfx_state::irq11_w ) -{ - set_irq_line(11, state); -} - -WRITE_LINE_MEMBER( pcfx_state::irq12_w ) -{ - set_irq_line(12, state); -} - -WRITE_LINE_MEMBER( pcfx_state::irq13_w ) -{ - set_irq_line(13, state); -} - -WRITE_LINE_MEMBER( pcfx_state::irq14_w ) -{ - set_irq_line(14, state); -} - -WRITE_LINE_MEMBER( pcfx_state::irq15_w ) -{ - set_irq_line(15, state); -} - - -void pcfx_state::machine_reset() -{ - membank( "bank1" )->set_base( memregion("user1")->base() ); - - m_irq_mask = 0xFF; - m_irq_pending = 0; -} - - -UINT32 pcfx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_huc6261->video_update( bitmap, cliprect ); - return 0; -} - - -static MACHINE_CONFIG_START( pcfx, pcfx_state ) - MCFG_CPU_ADD( "maincpu", V810, XTAL_21_4772MHz ) - MCFG_CPU_PROGRAM_MAP( pcfx_mem) - MCFG_CPU_IO_MAP( pcfx_io) - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_UPDATE_DRIVER(pcfx_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_21_4772MHz, HUC6261_WPF, 64, 64 + 1024 + 64, HUC6261_LPF, 18, 18 + 242) - - MCFG_DEVICE_ADD( "huc6270_a", HUC6270, 0 ) - MCFG_HUC6270_VRAM_SIZE(0x20000) - MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq12_w)) - - MCFG_DEVICE_ADD( "huc6270_b", HUC6270, 0 ) - MCFG_HUC6270_VRAM_SIZE(0x20000) - MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq14_w)) - - MCFG_DEVICE_ADD("huc6261", HUC6261, XTAL_21_4772MHz) - MCFG_HUC6261_VDC1("huc6270_a") - MCFG_HUC6261_VDC2("huc6270_b") - - MCFG_HUC6272_ADD( "huc6272", XTAL_21_4772MHz ) -MACHINE_CONFIG_END - - -ROM_START( pcfx ) - ROM_REGION( 0x100000, "user1", 0 ) - ROM_SYSTEM_BIOS( 0, "v100", "BIOS v1.00 - 2 Sep 1994" ) - ROMX_LOAD( "pcfxbios.bin", 0x000000, 0x100000, CRC(76ffb97a) SHA1(1a77fd83e337f906aecab27a1604db064cf10074), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v101", "BIOS v1.01 - 5 Dec 1994" ) - ROMX_LOAD( "pcfxv101.bin", 0x000000, 0x100000, CRC(236102c9) SHA1(8b662f7548078be52a871565e19511ccca28c5c8), ROM_BIOS(2) ) - - ROM_REGION( 0x80000, "scsi_rom", 0 ) - ROM_LOAD( "fx-scsi.rom", 0x00000, 0x80000, CRC(f3e60e5e) SHA1(65482a23ac5c10a6095aee1db5824cca54ead6e5) ) -ROM_END - - -ROM_START( pcfxga ) - ROM_REGION( 0x100000, "user1", 0 ) - ROM_LOAD( "pcfxga.rom", 0x000000, 0x100000, CRC(41c3776b) SHA1(a9372202a5db302064c994fcda9b24d29bb1b41c) ) - - ROM_REGION( 0x80000, "scsi_rom", ROMREGION_ERASEFF ) -ROM_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1994, pcfx, 0, 0, pcfx, pcfx, driver_device, 0, "Nippon Electronic Company", "PC-FX", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -CONS( 199?, pcfxga, pcfx, 0, pcfx, pcfx, driver_device, 0, "Nippon Electronic Company", "PC-FX/GA (PC ISA Card)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/pcm.c b/src/mess/drivers/pcm.c deleted file mode 100644 index ee4024b4b02..00000000000 --- a/src/mess/drivers/pcm.c +++ /dev/null @@ -1,330 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - PC/M by Miodrag Milanovic - - http://www.li-pro.net/pcm.phtml (in German) - - 12/05/2009 Preliminary driver. - - 14/02/2011 Added keyboard (from terminal). - - Commands: - 1 select memory bank 1 - 2 select memory bank 2 - B - C start cp/m from the inbuilt CCP - D Debugger - Fx Format disk A or B - G Jump to address - I List files on tape - L filename.typ Load file from tape - R read from disk - S filename aaaa / bbbb save a file to tape - V verify - W write to disk - X - Z set tape baud (1200, 2400, 3600 (default), 4800) - filename start running this .COM file - - Therefore if you enter random input, it will lock up while trying to - load up a file of that name. Filenames on disk and tape are of the - standard 8.3 format. You must specify an extension. - - Here is an example of starting the debugger, executing a command in - it, then exiting back to the monitor. - - D - U - E - - In practice, the I and R commands produce an error, while all disk - commands are directed to tape. The F command lists the files on a - tape. - - ToDo: - - Add bankswitching - - Add NMI generator - - Find out if there really is any floppy-disk feature - the schematic - has no mention of it. - - Add the 6 LEDs. - -****************************************************************************/ - -#include "emu.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "machine/k7659kb.h" - - -class pcm_state : public driver_device -{ -public: - pcm_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pio_s(*this, "z80pio_s"), - m_pio_u(*this, "z80pio_u"), - m_sio(*this, "z80sio"), - m_ctc_s(*this, "z80ctc_s"), - m_ctc_u(*this, "z80ctc_u"), - m_speaker(*this, "speaker"), - m_cass(*this, "cassette"), - m_p_videoram(*this, "videoram"){ } - - required_device m_maincpu; - required_device m_pio_s; - required_device m_pio_u; - required_device m_sio; - required_device m_ctc_s; - required_device m_ctc_u; - required_device m_speaker; - required_device m_cass; - DECLARE_READ8_MEMBER( pcm_85_r ); - DECLARE_WRITE_LINE_MEMBER( pcm_82_w ); - DECLARE_WRITE8_MEMBER( pcm_85_w ); - UINT8 *m_p_chargen; - bool m_cone; - required_shared_ptr m_p_videoram; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -private: - UINT8 m_85; -}; - - -WRITE_LINE_MEMBER( pcm_state::pcm_82_w ) -{ - if (state) - { - m_cone ^= 1; - m_speaker->level_w(m_cone); - } -} - - -/* PIO connections as far as i could decipher - -PortA is input and connects to the keyboard -PortB is mostly output and connects to a series of LEDs, - but also carries the cassette control & data lines. - -A0-A6 ascii codes from the keyboard -A7 strobe, high while a key is pressed -B0 power indicator LED -B1 Run/Stop LED -B2 Sound on/off LED -B3 n/c -B4 High=Save, Low=Load LED -B5 Motor On LED -B6 Save data -B7 Load data -There is also a HALT LED, connected directly to the processor. -*/ - - -READ8_MEMBER( pcm_state::pcm_85_r ) -{ - UINT8 data = m_85 & 0x7f; - - if ((m_cass)->input() > 0.03) - data |= 0x80; - - return data; -} - -WRITE8_MEMBER( pcm_state::pcm_85_w ) -{ - if (BIT(data, 5)) - m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - else - m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - - m_cass->output( BIT(data, 6) ? -1.0 : +1.0); - m_85 = data; -} - - - -static ADDRESS_MAP_START(pcm_mem, AS_PROGRAM, 8, pcm_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x1fff ) AM_ROM // ROM - AM_RANGE( 0x2000, 0xf7ff ) AM_RAM // RAM - AM_RANGE( 0xf800, 0xffff ) AM_RAM AM_SHARE("videoram") // Video RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pcm_io, AS_IO, 8, pcm_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80ctc_s", z80ctc_device, read, write) // system CTC - AM_RANGE(0x84, 0x87) AM_DEVREADWRITE("z80pio_s", z80pio_device, read, write) // system PIO - AM_RANGE(0x88, 0x8B) AM_DEVREADWRITE("z80sio", z80sio0_device, cd_ba_r, cd_ba_w) // SIO - AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE("z80ctc_u", z80ctc_device, read, write) // user CTC - AM_RANGE(0x90, 0x93) AM_DEVREADWRITE("z80pio_u", z80pio_device, read, write) // user PIO - //AM_RANGE(0x94, 0x97) // bank select - //AM_RANGE(0x98, 0x9B) // NMI generator - //AM_RANGE(0x9C, 0x9F) // io ports available to the user - // disk controller? -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pcm ) -INPUT_PORTS_END - -void pcm_state::machine_reset() -{ -} - -void pcm_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 pcm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0x400,x; - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x++) - { - chr = m_p_videoram[x]; - - gfx = m_p_chargen[(chr<<3) | ra]; - - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} - - -static const z80_daisy_config pcm_daisy_chain[] = -{ - { "z80ctc_s" }, /* System ctc */ - { "z80pio_s" }, /* System pio */ - { "z80sio" }, /* sio */ - { "z80pio_u" }, /* User pio */ - { "z80ctc_u" }, /* User ctc */ - { NULL } -}; - - -/* F4 Character Displayer */ -static const gfx_layout pcm_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( pcm ) - GFXDECODE_ENTRY( "chargen", 0x0000, pcm_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( pcm, pcm_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_10MHz /4) - MCFG_CPU_PROGRAM_MAP(pcm_mem) - MCFG_CPU_IO_MAP(pcm_io) - MCFG_CPU_CONFIG(pcm_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(pcm_state, screen_update) - MCFG_SCREEN_SIZE(64*8, 16*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pcm) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* Sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_K7659_KEYBOARD_ADD() - MCFG_CASSETTE_ADD("cassette") - - MCFG_DEVICE_ADD("z80pio_u", Z80PIO, XTAL_10MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80pio_s", Z80PIO, XTAL_10MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(DEVREAD8(K7659_KEYBOARD_TAG, k7659_keyboard_device, read)) - MCFG_Z80PIO_IN_PB_CB(READ8(pcm_state, pcm_85_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(pcm_state, pcm_85_w)) - - MCFG_Z80SIO0_ADD("z80sio", 4800, 0, 0, 0, 0) // clocks come from the system ctc - - MCFG_DEVICE_ADD("z80ctc_u", Z80CTC, XTAL_10MHz /4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80ctc_s", Z80CTC, XTAL_10MHz /4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - // ZC0 : SIO channel A clock - // ZC1 : SIO channel B clock - MCFG_Z80CTC_ZC2_CB(WRITELINE(pcm_state, pcm_82_w)) // speaker -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pcm ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v202", "Version 2.02" ) - ROMX_LOAD( "bios_v202.d14", 0x0000, 0x0800, CRC(27c24892) SHA1(a97bf9ef075de91330dc0c7cfd3bb6c7a88bb585), ROM_BIOS(1)) - ROMX_LOAD( "bios_v202.d15", 0x0800, 0x0800, CRC(e9cedc70) SHA1(913c526283d9289d0cb2157985bb48193df7aa16), ROM_BIOS(1)) - ROMX_LOAD( "bios_v202.d16", 0x1000, 0x0800, CRC(abe12001) SHA1(d8f0db6b141736d7715d588384fa49ab386bcc55), ROM_BIOS(1)) - ROMX_LOAD( "bios_v202.d17", 0x1800, 0x0800, CRC(2d48d1cc) SHA1(36a825140124dbe10d267fdf28b3eacec6f6d556), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v210", "Version 2.10" ) - ROMX_LOAD( "bios_v210.d14", 0x0000, 0x0800, CRC(45923112) SHA1(dde922533ebd0f6ac06d25b9786830ee3c7178b9), ROM_BIOS(2)) - ROMX_LOAD( "bios_v210.d15", 0x0800, 0x0800, CRC(e9cedc70) SHA1(913c526283d9289d0cb2157985bb48193df7aa16), ROM_BIOS(2)) - ROMX_LOAD( "bios_v210.d16", 0x1000, 0x0800, CRC(ee9ed77b) SHA1(12ea18e3e280f2a0657ff11c7bcdd658d325235c), ROM_BIOS(2)) - ROMX_LOAD( "bios_v210.d17", 0x1800, 0x0800, CRC(2d48d1cc) SHA1(36a825140124dbe10d267fdf28b3eacec6f6d556), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v330", "Version 3.30" ) - ROMX_LOAD( "bios_v330.d14", 0x0000, 0x0800, CRC(9bbfee10) SHA1(895002f2f4c711278f1e2d0e2a987e2d31472e4f), ROM_BIOS(3)) - ROMX_LOAD( "bios_v330.d15", 0x0800, 0x0800, CRC(4f8d5b40) SHA1(440b0be4cf45a5d450f9eb7684ceb809450585dc), ROM_BIOS(3)) - ROMX_LOAD( "bios_v330.d16", 0x1000, 0x0800, CRC(93fd0d91) SHA1(c8f1bbb63eca3c93560622581ecbb588716aeb91), ROM_BIOS(3)) - ROMX_LOAD( "bios_v330.d17", 0x1800, 0x0800, CRC(d8c7ce33) SHA1(9030d9a73ef1c12a31ac2cb9a593fb2a5097f24d), ROM_BIOS(3)) - - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD( "charrom.d113", 0x0000, 0x0800, CRC(5684b3c3) SHA1(418054aa70a0fd120611e32059eb2051d3b82b5a)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, pcm, 0, 0, pcm, pcm, driver_device, 0, "Mugler/Mathes", "PC/M", 0) diff --git a/src/mess/drivers/pcw.c b/src/mess/drivers/pcw.c deleted file mode 100644 index 9af7f2fccd6..00000000000 --- a/src/mess/drivers/pcw.c +++ /dev/null @@ -1,1403 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/****************************************************************************** - - pcw.c - system driver - - Kevin Thacker [MESS driver] - - Thankyou to Jacob Nevins, Richard Fairhurst and Cliff Lawson, - for their documentation that I used for the development of this - driver. - - PCW came in 4 forms. - PCW8256, PCW8512, PCW9256, PCW9512 - - These systems were nicknamed "Joyce", apparently after a secretary who worked at - Amstrad plc. - - These machines were designed for wordprocessing and other business applications. - - The computer came with Locoscript (wordprocessor by Locomotive Software Ltd), - and CP/M+ (3.1). - - The original PCW8256 system came with a keyboard, green-screen monitor - (which had 2 3" 80 track, double sided disc drives mounted vertically in it), - and a dedicated printer. The other systems had different design but shared the - same hardware. - - Since it was primarily designed as a wordprocessor, there were not many games - written. - Some of the games available: - - Head Over Heels - - Infocom adventures (Hitchhikers Guide to the Galaxy etc) - - However, it can use the CP/M OS, there is a large variety of CPM software that will - run on it!!!!!!!!!!!!!! - - Later systems had: - - black/white monitor, - - dedicated printer was removed, and support for any printer was added - - 3" internal drive replaced by a 3.5" drive - - All the logic for the system, except the FDC was found in a Amstrad designed custom - chip. - - In the original PCW8256, there was no boot-rom. A boot-program was stored in the printer - chip, and this was activated when the PCW was first switched on. AFAIK there are no - dumps of this program, so I have written my own replacement. - - The boot-program performs a simple task: Load sector 0, track 0 to &f000 in ram, and execute - &f010. - - From here CP/M is booted, and the appropiate programs can be run. - - The hardware: - - Z80 CPU running at 3.4 MHz - - UPD765 FDC - - mono display - - beep (a fixed Hz tone which can be turned on/off) - - 720x256 (PAL) bitmapped display, 720x200 (NTSC) bitmapped display - - Amstrad CPC6128 style keyboard - - If there are special roms for any of the PCW series I would be interested in them - so I can implement the driver properly. - - From comp.sys.amstrad.8bit FAQ: - - "Amstrad made the following PCW systems : - - - 1) PCW8256 - - 2) PCW8512 - - 3) PCW9512 - - 4) PCW9512+ - - 5) PcW10 - - 6) PcW16 - - 1 had 180K drives, 2 had a 180K A drive and a 720K B drive, 3 had only - 720K drives. All subsequent models had 3.5" disks using CP/M format at - 720K until 6 when it switched to 1.44MB in MS-DOS format. The + of - model 4 was that it had a "real" parallel interface so could be sold - with an external printer such as the Canon BJ10. The PcW10 wasn't - really anything more than 4 in a more modern looking case. - - The PcW16 is a radical digression who's sole "raison d'etre" was to - make a true WYSIWYG product but this meant a change in the screen and - processor (to 16MHz) etc. which meant that it could not be kept - compatible with the previous models (though documents ARE compatible)" - - - TODO: - - Printer hardware emulation (8256 etc) - - Parallel port emulation (9512, 9512+, 10) - - emulation of serial hardware - - emulation of other hardware...? - ******************************************************************************/ -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/i8243.h" -// upd765 interface -#include "machine/upd765.h" -// pcw video hardware -#include "includes/pcw.h" -// pcw/pcw16 beeper -#include "sound/beep.h" -#include "machine/ram.h" - -#include "pcw.lh" - -#define VERBOSE 1 -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -static const UINT8 half_step_table[4] = { 0x01, 0x02, 0x04, 0x08 }; -static const UINT8 full_step_table[4] = { 0x03, 0x06, 0x0c, 0x09 }; - -void pcw_state::pcw_update_interrupt_counter() -{ - /* never increments past 15! */ - if (m_interrupt_counter==0x0f) - return; - - /* increment count */ - m_interrupt_counter++; -} - - -// set/reset INT and NMI lines -void pcw_state::pcw_update_irqs() -{ - // set NMI line, remains set until FDC interrupt type is changed - if(m_nmi_flag != 0) - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - else - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - - // set IRQ line, timer pulses IRQ line, all other devices hold it as necessary - if(m_fdc_interrupt_code == 1 && (m_system_status & 0x20)) - { - m_maincpu->set_input_line(0, ASSERT_LINE); - return; - } - - if(m_timer_irq_flag != 0) - { - m_maincpu->set_input_line(0, ASSERT_LINE); - return; - } - - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -TIMER_CALLBACK_MEMBER(pcw_state::pcw_timer_pulse) -{ - m_timer_irq_flag = 0; - pcw_update_irqs(); -} - -/* callback for 1/300ths of a second interrupt */ -TIMER_DEVICE_CALLBACK_MEMBER(pcw_state::pcw_timer_interrupt) -{ - pcw_update_interrupt_counter(); - - m_timer_irq_flag = 1; - pcw_update_irqs(); - machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(pcw_state::pcw_timer_pulse),this)); -} - -/* PCW uses UPD765 in NON-DMA mode. FDC Ints are connected to /INT or - * /NMI depending on choice (see system control below) - * fdc interrupt callback. set/clear fdc int */ -WRITE_LINE_MEMBER( pcw_state::pcw_fdc_interrupt ) -{ - if (!state) - m_system_status &= ~(1<<5); - else - { - m_system_status |= (1<<5); - if(m_fdc_interrupt_code == 0) // NMI is held until interrupt type is changed - m_nmi_flag = 1; - } -} - - -/* Memory is banked in 16k blocks. - - The upper 16 bytes of block 3, contains the keyboard - state. This is updated by the hardware. - - block 3 could be paged into any bank, and this explains the - setup of the memory below. -*/ -static ADDRESS_MAP_START(pcw_map, AS_PROGRAM, 8, pcw_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank5") - AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank6") - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank7") - AM_RANGE(0xc000, 0xffff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank8") -ADDRESS_MAP_END - - -/* Keyboard is read by the MCU and sent as serial data to the gate array ASIC */ -READ8_MEMBER(pcw_state::pcw_keyboard_r) -{ - static const char *const keynames[] = { - "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", - "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15" - }; - - return ioport(keynames[offset])->read(); -} - -READ8_MEMBER(pcw_state::pcw_keyboard_data_r) -{ - return m_mcu_keyboard_data[offset]; -} - -/* ----------------------------------------------------------------------- - * PCW Banking - * ----------------------------------------------------------------------- */ - -void pcw_state::pcw_update_read_memory_block(int block, int bank) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - char block_name[10]; - - sprintf(block_name,"bank%d",block+1); - /* bank 3? */ - if (bank == 3) - { - /* when upper 16 bytes are accessed use keyboard read - handler */ - space.install_read_handler( - block * 0x04000 + 0x3ff0, block * 0x04000 + 0x3fff, read8_delegate(FUNC(pcw_state::pcw_keyboard_data_r),this)); -// LOG(("MEM: read block %i -> bank %i\n",block,bank)); - } - else - { - /* restore bank handler across entire block */ - space.install_read_bank(block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff,block_name); -// LOG(("MEM: read block %i -> bank %i\n",block,bank)); - } - membank(block_name)->set_base(m_ram->pointer() + ((bank * 0x4000) % m_ram->size())); -} - - - -void pcw_state::pcw_update_write_memory_block(int block, int bank) -{ - char block_name[10]; - - sprintf(block_name,"bank%d",block+5); - membank(block_name)->set_base(m_ram->pointer() + ((bank * 0x4000) % m_ram->size())); -// LOG(("MEM: write block %i -> bank %i\n",block,bank)); -} - - -/* ----------------------------------------------------------------------- */ - -/* &F4 O b7-b4: when set, force memory reads to access the same bank as -writes for &C000, &0000, &8000, and &4000 respectively */ - -void pcw_state::pcw_update_mem(int block, int data) -{ - /* expansion ram select. - if block is 0-7, selects internal ram instead for read/write - */ - if (data & 0x080) - { - int bank; - - /* same bank for reading and writing */ - bank = data & 0x7f; - - pcw_update_read_memory_block(block, bank); - pcw_update_write_memory_block(block, bank); - } - else - { - /* specify a different bank for reading and writing */ - int write_bank; - int read_bank; - int mask=0; - - switch (block) - { - case 0: - { - mask = (1<<6); - } - break; - - case 1: - { - mask = (1<<4); - } - break; - - case 2: - { - mask = (1<<5); - } - break; - - case 3: - { - mask = (1<<7); - } - break; - } - - if (m_bank_force & mask) - { - read_bank = data & 0x07; - } - else - { - read_bank = (data>>4) & 0x07; - } - - pcw_update_read_memory_block(block, read_bank); - - write_bank = data & 0x07; - pcw_update_write_memory_block(block, write_bank); - } - - /* if boot is active, page in fake ROM */ -/* if ((m_boot) && (block==0)) - { - unsigned char *FakeROM; - - FakeROM = &memregion("maincpu")->base()[0x010000]; - - membank("bank1")->set_base(FakeROM); - }*/ -} - -/* from Jacob Nevins docs */ -int pcw_state::pcw_get_sys_status() -{ - return - m_interrupt_counter - | (m_screen->vblank() ? 0x40 : 0x00) - | (ioport("EXTRA")->read() & 0x010) - | (m_system_status & 0x20); -} - -READ8_MEMBER(pcw_state::pcw_interrupt_counter_r) -{ - int data; - - /* from Jacob Nevins docs */ - - /* get data */ - data = pcw_get_sys_status(); - /* clear int counter */ - m_interrupt_counter = 0; - /* check interrupts */ - pcw_update_irqs(); - /* return data */ - //LOG(("SYS: IRQ counter read, returning %02x\n",data)); - return data; -} - - -WRITE8_MEMBER(pcw_state::pcw_bank_select_w) -{ - //LOG(("BANK: %2x %x\n",offset, data)); - m_banks[offset] = data; - - pcw_update_mem(offset, data); -// popmessage("RAM Banks: %02x %02x %02x %02x Lock:%02x",m_banks[0],m_banks[1],m_banks[2],m_banks[3],m_bank_force); -} - -WRITE8_MEMBER(pcw_state::pcw_bank_force_selection_w) -{ - m_bank_force = data; - - pcw_update_mem(0, m_banks[0]); - pcw_update_mem(1, m_banks[1]); - pcw_update_mem(2, m_banks[2]); - pcw_update_mem(3, m_banks[3]); -} - - -WRITE8_MEMBER(pcw_state::pcw_roller_ram_addr_w) -{ - /* - Address of roller RAM. b7-5: bank (0-7). b4-1: address / 512. */ - - m_roller_ram_addr = (((data>>5) & 0x07)<<14) | - ((data & 0x01f)<<9); - LOG(("Roller-RAM: Address set to 0x%05x\n",m_roller_ram_addr)); -} - -WRITE8_MEMBER(pcw_state::pcw_pointer_table_top_scan_w) -{ - m_roller_ram_offset = data; - LOG(("Roller-RAM: offset set to 0x%05x\n",m_roller_ram_offset)); -} - -WRITE8_MEMBER(pcw_state::pcw_vdu_video_control_register_w) -{ - m_vdu_video_control_register = data; - LOG(("Roller-RAM: control reg set to 0x%02x\n",data)); -} - -WRITE8_MEMBER(pcw_state::pcw_system_control_w) -{ - upd765a_device *fdc = machine().device("upd765"); - LOG(("SYSTEM CONTROL: %d\n",data)); - - switch (data) - { - /* end bootstrap */ - case 0: - { - m_boot = 0; - pcw_update_mem(0, m_banks[0]); - } - break; - - /* reboot */ - case 1: - { - m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - popmessage("SYS: Reboot"); - } - break; - - /* connect fdc interrupt to nmi */ - case 2: - { - int fdc_previous_interrupt_code = m_fdc_interrupt_code; - - m_fdc_interrupt_code = 0; - - /* previously connected to INT? */ - if (fdc_previous_interrupt_code == 1) - { - /* yes */ - - pcw_update_irqs(); - } - - } - break; - - - /* connect fdc interrupt to interrupt */ - case 3: - { - int fdc_previous_interrupt_code = m_fdc_interrupt_code; - - /* connect to INT */ - m_fdc_interrupt_code = 1; - - /* previously connected to NMI? */ - if (fdc_previous_interrupt_code == 0) - { - /* yes */ - - /* clear nmi interrupt */ - m_nmi_flag = 0; - } - - /* re-issue interrupt */ - pcw_update_irqs(); - } - break; - - - /* connect fdc interrupt to neither */ - case 4: - { - int fdc_previous_interrupt_code = m_fdc_interrupt_code; - - m_fdc_interrupt_code = 2; - - /* previously connected to NMI or INT? */ - if ((fdc_previous_interrupt_code == 0) || (fdc_previous_interrupt_code == 1)) - { - /* yes */ - - /* Clear NMI */ - m_nmi_flag = 0; - } - pcw_update_irqs(); - - } - break; - - /* set fdc terminal count */ - case 5: - { - fdc->tc_w(true); - } - break; - - /* clear fdc terminal count */ - case 6: - { - fdc->tc_w(false); - } - break; - - /* screen on */ - case 7: - { - } - break; - - /* screen off */ - case 8: - { - } - break; - - /* disc motor on */ - case 9: - { - floppy_image_device *floppy; - floppy = machine().device(":upd765:0")->get_device(); - if(floppy) - floppy->mon_w(0); - floppy = machine().device(":upd765:1")->get_device(); - if(floppy) - floppy->mon_w(0); - } - break; - - /* disc motor off */ - case 10: - { - floppy_image_device *floppy; - floppy = machine().device(":upd765:0")->get_device(); - if(floppy) - floppy->mon_w(1); - floppy = machine().device(":upd765:1")->get_device(); - if(floppy) - floppy->mon_w(1); - } - break; - - /* beep on */ - case 11: - { - m_beeper->set_state(1); - } - break; - - /* beep off */ - case 12: - { - m_beeper->set_state(0); - } - break; - - } -} - -READ8_MEMBER(pcw_state::pcw_system_status_r) -{ - /* from Jacob Nevins docs */ - UINT8 ret = pcw_get_sys_status(); - - return ret; -} - -/* read from expansion hardware - additional hardware not part of -the PCW custom ASIC */ -READ8_MEMBER(pcw_state::pcw_expansion_r) -{ - logerror("pcw expansion r: %04x\n",offset+0x080); - - switch (offset+0x080) - { - case 0x0e0: - { - /* spectravideo joystick */ - if (ioport("EXTRA")->read() & 0x020) - { - return ioport("SPECTRAVIDEO")->read(); - } - else - { - return 0x0ff; - } - } - - case 0x09f: - { - /* kempston joystick */ - return ioport("KEMPSTON")->read(); - } - - case 0x0e1: - case 0x0e3: - { - return 0x7f; - } - - case 0x085: - { - return 0x0fe; - } - - case 0x087: - { - return 0x0ff; - } - - } - - /* result from floating bus/no peripherial at this port */ - return 0x0ff; -} - -/* write to expansion hardware - additional hardware not part of -the PCW custom ASIC */ -WRITE8_MEMBER(pcw_state::pcw_expansion_w) -{ - logerror("pcw expansion w: %04x %02x\n",offset+0x080, data); -} - -void pcw_state::pcw_printer_fire_pins(UINT16 pins) -{ - int x,line; - INT32 feed = (m_paper_feed / 2); - - for(x=feed+PCW_PRINTER_HEIGHT-16;xpix16(line, m_printer_headpos) = (UINT16)(pins & 0x01); - pins >>= 1; - } -// if(m_printer_headpos < PCW_PRINTER_WIDTH) -// m_printer_headpos++; -} - -WRITE8_MEMBER(pcw_state::pcw_printer_data_w) -{ - m_printer_data = data; - machine().device("printer_mcu")->upi41_master_w(space,0,data); - logerror("PRN [0xFC]: Sent command %02x\n",data); -} - -WRITE8_MEMBER(pcw_state::pcw_printer_command_w) -{ - m_printer_command = data; - machine().device("printer_mcu")->upi41_master_w(space,1,data); - logerror("PRN [0xFD]: Sent command %02x\n",data); -} - -// print error type -// should return 0xF8 if there are no errors -// 0 = underrun -// 1 = printer controller RAM fault -// 3 = bad command -// 5 = print error -// anything else = no printer -READ8_MEMBER(pcw_state::pcw_printer_data_r) -{ - return machine().device("printer_mcu")->upi41_master_r(space,0); -} - -// printer status -// bit 7 - bail bar in -// bit 6 - not currently executing a command -// bit 5 - printer RAM is full -// bit 4 - print head is not at left margin -// bit 3 - sheet feeder is present -// bit 2 - paper is present -// bit 1 - busy -// bit 0 - controller fault -READ8_MEMBER(pcw_state::pcw_printer_status_r) -{ - return machine().device("printer_mcu")->upi41_master_r(space,1); -} - -/* MCU handlers */ -/* I/O ports: (likely to be completely wrong...) - * (write) - * all are active low - * P1: pins 0-7 - * P2 bit 0: pin 8 - * P2 bit 1: serial shift/store clock - * P2 bit 2: serial shift store data - * P2 bit 3: serial shift/store strobe - * P2 bit 4: print head motor - * P2 bit 5: paper feed motor - * P2 bit 6: fire pins - * (read) - * P2 bit 7: bail bar status (0 if out) - * T0: Paper sensor (?) - * T1: Print head location (1 if not at left margin) - */ -TIMER_CALLBACK_MEMBER(pcw_state::pcw_stepper_callback) -{ - //popmessage("PRN: P2 bits %s %s %s\nSerial: %02x\nHeadpos: %i",m_printer_p2 & 0x40 ? " " : "6",m_printer_p2 & 0x20 ? " " : "5",m_printer_p2 & 0x10 ? " " : "4",m_printer_shift_output,m_printer_headpos); - if((m_printer_p2 & 0x10) == 0) // print head motor active - { - UINT8 stepper_state = (m_printer_shift_output >> 4) & 0x0f; - if(stepper_state == full_step_table[(m_head_motor_state + 1) & 0x03]) - { - m_printer_headpos += 2; - m_head_motor_state++; - logerror("Printer head moved forward by 2 to %i\n",m_printer_headpos); - } - if(stepper_state == half_step_table[(m_head_motor_state + 1) & 0x03]) - { - m_printer_headpos += 1; - m_head_motor_state++; - logerror("Printer head moved forward by 1 to %i\n",m_printer_headpos); - } - if(stepper_state == full_step_table[(m_head_motor_state - 1) & 0x03]) - { - m_printer_headpos -= 2; - m_head_motor_state--; - logerror("Printer head moved back by 2 to %i\n",m_printer_headpos); - } - if(stepper_state == half_step_table[(m_head_motor_state - 1) & 0x03]) - { - m_printer_headpos -= 1; - m_head_motor_state--; - logerror("Printer head moved back by 1 to %i\n",m_printer_headpos); - } - if(m_printer_headpos < 0) - m_printer_headpos = 0; - if(m_printer_headpos > PCW_PRINTER_WIDTH) - m_printer_headpos = PCW_PRINTER_WIDTH; - m_head_motor_state &= 0x03; - m_printer_p2 |= 0x10; - } - if((m_printer_p2 & 0x20) == 0) // line feed motor active - { - UINT8 stepper_state = m_printer_shift_output & 0x0f; - if(stepper_state == full_step_table[(m_linefeed_motor_state + 1) & 0x03]) - { - m_paper_feed++; - if(m_paper_feed > PCW_PRINTER_HEIGHT*2) - m_paper_feed = 0; - m_linefeed_motor_state++; - } - if(stepper_state == half_step_table[(m_linefeed_motor_state + 1) & 0x03]) - { - m_paper_feed++; - if(m_paper_feed > PCW_PRINTER_HEIGHT*2) - m_paper_feed = 0; - m_linefeed_motor_state++; - } - m_linefeed_motor_state &= 0x03; - m_printer_p2 |= 0x20; - } -} - -TIMER_CALLBACK_MEMBER(pcw_state::pcw_pins_callback) -{ - pcw_printer_fire_pins(m_printer_pins); - m_printer_p2 |= 0x40; -} - -READ8_MEMBER(pcw_state::mcu_printer_p1_r) -{ -// logerror("PRN: MCU reading data from P1\n"); - return m_printer_pins & 0x00ff; -} - -WRITE8_MEMBER(pcw_state::mcu_printer_p1_w) -{ - m_printer_pins = (m_printer_pins & 0x0100) | data; - //popmessage("PRN: Print head position = %i",m_printer_headpos); - logerror("PRN: MCU writing %02x to P1 [%03x/%03x]\n",data,m_printer_pins,~m_printer_pins & 0x1ff); -} - -READ8_MEMBER(pcw_state::mcu_printer_p2_r) -{ - UINT8 ret = 0x00; -// logerror("PRN: MCU reading data from P2\n"); - ret |= 0x80; // make sure bail bar is in - ret |= (m_printer_p2 & 0x70); - ret |= (m_printer_pins & 0x100) ? 0x01 : 0x00; // ninth pin - ret |= 0x0e; - return ret; -} - -WRITE8_MEMBER(pcw_state::mcu_printer_p2_w) -{ - //logerror("PRN: MCU writing %02x to P2\n",data); - m_printer_p2 = data & 0x70; - - // handle shift/store - m_printer_serial = data & 0x04; // data - if((data & 0x02) != 0) // clock - { - m_printer_shift <<= 1; - if(m_printer_serial == 0) - m_printer_shift &= ~0x01; - else - m_printer_shift |= 0x01; - } - if((data & 0x08) != 0) // strobe - { - logerror("Strobe active [%02x]\n",m_printer_shift); - m_printer_shift_output = m_printer_shift; - m_prn_stepper->adjust(PERIOD_OF_555_MONOSTABLE(22000,0.00000001)); - } - - if(data & 0x40) - m_prn_pins->adjust(PERIOD_OF_555_MONOSTABLE(22000,0.0000000068)); - - if(data & 0x01) - m_printer_pins |= 0x0100; - else - m_printer_pins &= ~0x0100; - m_printer_p2_prev = data; -} - -// Paper sensor -READ8_MEMBER(pcw_state::mcu_printer_t1_r) -{ - return 1; -} - -// Print head location (0 if at left margin, otherwise 1) -READ8_MEMBER(pcw_state::mcu_printer_t0_r) -{ - if(m_printer_headpos == 0) - return 0; - else - return 1; -} - -/* - * Keyboard MCU (i8048) - * P1 = keyboard scan row select (low 8 bits) - * P2 = bits 7-4: keyboard scan row select (high 4 bits) - * bit 1: keyboard serial clock - * bit 0: keyboard serial data - */ -void pcw_state::mcu_transmit_serial(UINT8 bit) -{ - int seq; - - /* Keyboard data is sent in serial from the MCU through the keyboard port, to the ASIC - Sends a string of 12-bit sequences, first 4 bits are the RAM location (from &3ff0), - then 8 bits for the data to be written there. */ - seq = m_mcu_transmit_count % 12; - if(seq < 4) - { - if(bit == 0) - m_mcu_selected &= ~(8 >> seq); - else - m_mcu_selected |= (8 >> seq); - } - else - { - seq -= 4; - if(bit == 0) - m_mcu_buffer &= ~(128 >> seq); - else - m_mcu_buffer |= (128 >> seq); - } - m_mcu_transmit_count++; - if(m_mcu_transmit_count >= 12) - { - m_mcu_keyboard_data[m_mcu_selected] = m_mcu_buffer; - m_mcu_transmit_count = 0; - } -} - -READ8_MEMBER(pcw_state::mcu_kb_scan_r) -{ - return m_kb_scan_row & 0xff; -} - -WRITE8_MEMBER(pcw_state::mcu_kb_scan_w) -{ - m_kb_scan_row = (m_kb_scan_row & 0xff00) | data; -} - -READ8_MEMBER(pcw_state::mcu_kb_scan_high_r) -{ - return (m_kb_scan_row & 0xff00) >> 8; -} - -WRITE8_MEMBER(pcw_state::mcu_kb_scan_high_w) -{ - if((m_mcu_prev & 0x02) && !(data & 0x02)) // bit is transmitted on high-to-low clock transition - { - mcu_transmit_serial(data & 0x01); - m_mcu_transmit_reset_seq = 0; - } - - if((m_mcu_prev & 0x01) != (data & 0x01)) // two high->low transitions on the data pin signals the beginning of a new transfer - { - m_mcu_transmit_reset_seq++; - if(m_mcu_transmit_reset_seq > 3) - m_mcu_transmit_count = 0; - } - - m_kb_scan_row = (m_kb_scan_row & 0x00ff) | ((data & 0xff) << 8); - m_mcu_prev = data; -} - -READ8_MEMBER(pcw_state::mcu_kb_data_r) -{ - UINT16 scan_bits = ((m_kb_scan_row & 0xf000) >> 4) | (m_kb_scan_row & 0xff); - int x; - - for(x=0;x<12;x++) - { - if(!(scan_bits & 1)) - return pcw_keyboard_r(space,x); - else - scan_bits >>= 1; - } - return 0xff; -} - -READ8_MEMBER(pcw_state::mcu_kb_t1_r) -{ - return 1; -} - -READ8_MEMBER(pcw_state::mcu_kb_t0_r) -{ - return 0; -} - -/* TODO: Implement parallel port! */ -READ8_MEMBER(pcw_state::pcw9512_parallel_r) -{ - if (offset==1) - { - return 0xff^0x020; - } - - logerror("pcw9512 parallel r: offs: %04x\n", (int) offset); - return 0x00; -} - -/* TODO: Implement parallel port! */ -WRITE8_MEMBER(pcw_state::pcw9512_parallel_w) -{ - logerror("pcw9512 parallel w: offs: %04x data: %02x\n",offset,data); -} - -static ADDRESS_MAP_START(pcw_io, AS_IO, 8, pcw_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x000, 0x001) AM_MIRROR(0x7e) AM_DEVICE("upd765", upd765a_device, map) - AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r, pcw_expansion_w) - AM_RANGE(0x0f0, 0x0f3) AM_WRITE( pcw_bank_select_w) - AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) - AM_RANGE(0x0f5, 0x0f5) AM_WRITE( pcw_roller_ram_addr_w) - AM_RANGE(0x0f6, 0x0f6) AM_WRITE( pcw_pointer_table_top_scan_w) - AM_RANGE(0x0f7, 0x0f7) AM_WRITE( pcw_vdu_video_control_register_w) - AM_RANGE(0x0f8, 0x0f8) AM_READWRITE(pcw_system_status_r, pcw_system_control_w) - AM_RANGE(0x0fc, 0x0fc) AM_READWRITE(pcw_printer_data_r, pcw_printer_data_w) - AM_RANGE(0x0fd, 0x0fd) AM_READWRITE(pcw_printer_status_r, pcw_printer_command_w) -ADDRESS_MAP_END - - - -static ADDRESS_MAP_START(pcw9512_io, AS_IO, 8, pcw_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x000, 0x001) AM_MIRROR(0x7e) AM_DEVICE("upd765", upd765a_device, map) - AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r, pcw_expansion_w) - AM_RANGE(0x0f0, 0x0f3) AM_WRITE( pcw_bank_select_w) - AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) - AM_RANGE(0x0f5, 0x0f5) AM_WRITE( pcw_roller_ram_addr_w) - AM_RANGE(0x0f6, 0x0f6) AM_WRITE( pcw_pointer_table_top_scan_w) - AM_RANGE(0x0f7, 0x0f7) AM_WRITE( pcw_vdu_video_control_register_w) - AM_RANGE(0x0f8, 0x0f8) AM_READWRITE(pcw_system_status_r, pcw_system_control_w) - AM_RANGE(0x0fc, 0x0fd) AM_READWRITE(pcw9512_parallel_r, pcw9512_parallel_w) -ADDRESS_MAP_END - -/* i8041 MCU */ -static ADDRESS_MAP_START(pcw_printer_io, AS_IO, 8, pcw_state ) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu_printer_p2_r,mcu_printer_p2_w) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(mcu_printer_p1_r, mcu_printer_p1_w) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(mcu_printer_t1_r) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(mcu_printer_t0_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pcw_keyboard_io, AS_IO, 8, pcw_state ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(mcu_kb_scan_r,mcu_kb_scan_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu_kb_scan_high_r,mcu_kb_scan_high_w) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(mcu_kb_t1_r) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(mcu_kb_t0_r) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(mcu_kb_data_r) -ADDRESS_MAP_END - - -TIMER_CALLBACK_MEMBER(pcw_state::setup_beep) -{ - m_beeper->set_state(0); - m_beeper->set_frequency(3750); -} - - -void pcw_state::machine_start() -{ - m_fdc_interrupt_code = 2; -} - -void pcw_state::machine_reset() -{ - UINT8* code = memregion("printer_mcu")->base(); - int x; - /* ram paging is actually undefined at power-on */ - - m_bank_force = 0xf0; // banks are locked for CPC-style paging - Batman expects this - - m_banks[0] = 0x80; - m_banks[1] = 0x81; - m_banks[2] = 0x82; - m_banks[3] = 0x83; - - pcw_update_mem(0, m_banks[0]); - pcw_update_mem(1, m_banks[1]); - pcw_update_mem(2, m_banks[2]); - pcw_update_mem(3, m_banks[3]); - - m_boot = 0; // System starts up in bootstrap mode, disabled until it's possible to emulate it. - - /* copy boot code into RAM - yes, it's skipping a step */ - memset(m_ram->pointer(),0x00,m_ram->size()); - for(x=0;x<256;x++) - m_ram->pointer()[x+2] = code[x+0x300]; - - /* and hack our way past the MCU side of the boot process */ - code[0x01] = 0x40; - - m_printer_status = 0xff; - m_printer_command = 0xff; - m_printer_data = 0x00; - m_printer_headpos = 0x00; // bring printer head to left margin - m_printer_shift = 0; - m_printer_shift_output = 0; -} - -DRIVER_INIT_MEMBER(pcw_state,pcw) -{ - m_maincpu->set_input_line_vector(0, 0x0ff); - - /* lower 4 bits are interrupt counter */ - m_system_status = 0x000; - m_system_status &= ~((1<<6) | (1<<5) | (1<<4)); - - m_interrupt_counter = 0; - - m_roller_ram_offset = 0; - - /* timer interrupt */ - machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(pcw_state::setup_beep),this)); - - m_prn_stepper = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_stepper_callback),this)); - m_prn_pins = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_pins_callback),this)); -} - - -/* -b7: k2 k1 [+] . , space V X Z del< alt -b6: k3 k5 1/2 / M N B C lock k. -b5: k6 k4 shift ; K J F D A enter -b4: k9 k8 k7 ?? L H G S tab f8 -b3: paste copy # P I Y T W Q [-] -b2: f2 cut return [ O U R E stop can -b1: k0 ptr ] - 9 7 5 3 2 extra -b0: f4 exit del> = 0 8 6 4 1 f6 - &3FF0 &3FF1 &3FF2 &3FF3 &3FF4 &3FF5 &3FF6 &3FF7 &3FF8 &3FF9 &3FFA - -2008-05 FP: -Small note about atural keyboard: currently, -- "Paste" is mapped to 'F9' -- "Exit" is mapped to 'F10' -- "Ptr" is mapped to 'Print Screen' -- "Cut" is mapped to 'F11' -- "Copy" is mapped to 'F12' -- "Stop" is mapped to 'Esc' -- [+] is mapped to 'Page Up' -- [-] is mapped to 'Page Down' -- "Extra" is mapped to 'Home' -- "Can" is mapped to 'Insert' -*/ - -static INPUT_PORTS_START(pcw) - /* keyboard "ports". These are poked automatically into the PCW address space */ - - PORT_START("LINE0") /* 0x03ff0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F4") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F2") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Paste") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - - PORT_START("LINE1") /* 0x03ff1 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Exit") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ptr") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cut") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("LINE2") /* 0x03ff2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL>") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('#') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, 0xff, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[+]") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) // 1st key on the left from 'Spacebar' - - PORT_START("LINE3") /* 0x03ff3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\xA7') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - - PORT_START("LINE4") /* 0x03ff4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - - PORT_START("LINE5") /* 0x03ff5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE6") /* 0x03ff6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("LINE7") /* 0x03ff7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("LINE8") /* 0x03ff8 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("LINE9") /* 0x03ff9 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F6") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Extra") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Can") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[-]") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) // 1st key on the right from 'Spacebar' - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7 F8") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL<") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_START("LINE10") /* 0x03ffa */ - PORT_BIT(0x07f,0x7f, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - - /* at this point the following reflect the above key combinations but in a incomplete - way. No details available at this time */ - PORT_START("LINE11") /* 0x03ffb */ - PORT_BIT(0xff, 0xff, IPT_UNUSED) - - PORT_START("LINE12") /* 0x03ffc */ - PORT_BIT(0xff, 0xff, IPT_UNUSED) - - /* 2008-05 FP: not sure if this key is correct, "Caps Lock" is already mapped above. - For now, I let it with no default mapping. */ - PORT_START("LINE13") /* 0x03ffd */ - PORT_BIT(0xff, 0xff, IPT_UNUSED) -// PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") //PORT_CODE(KEYCODE_CAPSLOCK) -// PORT_BIT(0x80, 0xff, IPT_UNUSED) - - PORT_START("LINE14") /* 0x03ffe */ - PORT_BIT ( 0xff, 0xff, IPT_UNUSED ) - - PORT_START("LINE15") /* 0x03fff */ - PORT_BIT ( 0xff, 0xff, IPT_UNUSED ) - - /* from here on are the pretend dipswitches for machine config etc */ - PORT_START("EXTRA") - /* frame rate option */ - PORT_DIPNAME( 0x10, 0x010, "50/60Hz Frame Rate Option") - PORT_DIPSETTING( 0x00, "60Hz") - PORT_DIPSETTING( 0x10, "50Hz" ) - /* spectravideo joystick enabled */ - PORT_DIPNAME( 0x20, 0x020, "Spectravideo Joystick Enabled") - PORT_DIPSETTING( 0x00, DEF_STR(No)) - PORT_DIPSETTING( 0x20, DEF_STR(Yes) ) - - /* Spectravideo joystick */ - /* bit 7: 0 - 6: 1 - 5: 1 - 4: 1 if in E position - 3: 1 if N - 2: 1 if W - 1: 1 if fire pressed - 0: 1 if S - */ - - PORT_START("SPECTRAVIDEO") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_BUTTON1) - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) - PORT_BIT(0x020, 0x020, IPT_UNUSED) - PORT_BIT(0x040, 0x040, IPT_UNUSED) - PORT_BIT(0x080, 0x00, IPT_UNUSED) - - /* Kempston joystick */ - PORT_START("KEMPSTON") - PORT_BIT( 0xff, 0x00, IPT_UNUSED) -INPUT_PORTS_END - -static SLOT_INTERFACE_START( pcw_floppies ) - SLOT_INTERFACE( "3dsdd", FLOPPY_3_DSDD ) -SLOT_INTERFACE_END - -/* PCW8256, PCW8512, PCW9256 */ -static MACHINE_CONFIG_START( pcw, pcw_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 4000000) /* clock supplied to chip, but in reality it is 3.4 MHz */ - MCFG_CPU_PROGRAM_MAP(pcw_map) - MCFG_CPU_IO_MAP(pcw_io) - - MCFG_CPU_ADD("printer_mcu", I8041, 11000000) // 11MHz - MCFG_CPU_IO_MAP(pcw_printer_io) - - MCFG_CPU_ADD("keyboard_mcu", I8048, 5000000) // 5MHz - MCFG_CPU_IO_MAP(pcw_keyboard_io) - -// MCFG_QUANTUM_TIME(attotime::from_hz(50)) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(PCW_SCREEN_WIDTH, PCW_SCREEN_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, PCW_SCREEN_WIDTH-1, 0, PCW_SCREEN_HEIGHT-1) - MCFG_SCREEN_UPDATE_DRIVER(pcw_state, screen_update_pcw) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", PCW_NUM_COLOURS) - MCFG_PALETTE_INIT_OWNER(pcw_state, pcw) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pcw_state, pcw_fdc_interrupt)) - - MCFG_FLOPPY_DRIVE_ADD("upd765:0", pcw_floppies, "3dsdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", pcw_floppies, "3dsdd", floppy_image_device::default_floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("disk_list","pcw") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("pcw_timer", pcw_state, pcw_timer_interrupt, attotime::from_hz(300)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pcw8256, pcw ) - MCFG_SCREEN_ADD("printer",RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE( PCW_PRINTER_WIDTH, PCW_PRINTER_HEIGHT ) - MCFG_SCREEN_VISIBLE_AREA(0, PCW_PRINTER_WIDTH-1, 0, PCW_PRINTER_HEIGHT-1) - MCFG_SCREEN_UPDATE_DRIVER(pcw_state, screen_update_pcw_printer) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT( layout_pcw ) - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pcw8512, pcw ) - MCFG_SCREEN_ADD("printer",RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE( PCW_PRINTER_WIDTH, PCW_PRINTER_HEIGHT ) - MCFG_SCREEN_VISIBLE_AREA(0, PCW_PRINTER_WIDTH-1, 0, PCW_PRINTER_HEIGHT-1) - MCFG_SCREEN_UPDATE_DRIVER(pcw_state, screen_update_pcw_printer) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT( layout_pcw ) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") -MACHINE_CONFIG_END - -/* PCW9512, PCW9512+, PCW10 */ -static MACHINE_CONFIG_DERIVED( pcw9512, pcw ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_IO_MAP(pcw9512_io) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(pcw8256) - ROM_REGION(0x10000,"maincpu",0) - ROM_FILL(0x0000,0x10000,0x00) \ - ROM_REGION(0x400,"printer_mcu",0) // i8041 9-pin dot-matrix - ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) - ROM_REGION(0x400,"keyboard_mcu",0) // i8048 - ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) -ROM_END - -ROM_START(pcw8512) - ROM_REGION(0x10000,"maincpu",0) - ROM_FILL(0x0000,0x10000,0x00) \ - ROM_REGION(0x400,"printer_mcu",0) // i8041 9-pin dot-matrix - ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) - ROM_REGION(0x400,"keyboard_mcu",0) // i8048 - ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) -ROM_END - -ROM_START(pcw9256) - ROM_REGION(0x10000,"maincpu",0) - ROM_FILL(0x0000,0x10000,0x00) \ - ROM_REGION(0x2000,"printer_mcu",0) // i8041 9-pin dot-matrix - ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) - ROM_REGION(0x400,"keyboard_mcu",0) // i8048 - ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) -ROM_END - -ROM_START(pcw9512) - ROM_REGION(0x10000,"maincpu",0) - ROM_FILL(0x0000,0x10000,0x00) \ - ROM_REGION(0x2000,"printer_mcu",0) // i8041 daisywheel (schematics say i8039?) - ROM_LOAD("40103.ic109", 0, 0x2000, CRC(a64d450a) SHA1(ebbf0ef19d39912c1c127c748514dd299915f88b)) - ROM_REGION(0x400,"keyboard_mcu",0) // i8048 - ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) -ROM_END - -ROM_START(pcw10) - ROM_REGION(0x10000,"maincpu",0) - ROM_FILL(0x0000,0x10000,0x00) \ - ROM_REGION(0x2000,"printer_mcu",0) // i8041 9-pin dot matrix - ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) - ROM_REGION(0x400,"keyboard_mcu",0) // i8048 - ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) -ROM_END - - -/* these are all variants on the pcw design */ -/* major difference is memory configuration and drive type */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1985, pcw8256, 0, 0, pcw8256, pcw, pcw_state, pcw, "Amstrad plc", "PCW8256", MACHINE_NOT_WORKING) -COMP( 1985, pcw8512, pcw8256, 0, pcw8512, pcw, pcw_state, pcw, "Amstrad plc", "PCW8512", MACHINE_NOT_WORKING) -COMP( 1987, pcw9256, pcw8256, 0, pcw8256, pcw, pcw_state, pcw, "Amstrad plc", "PCW9256", MACHINE_NOT_WORKING) -COMP( 1987, pcw9512, pcw8256, 0, pcw9512, pcw, pcw_state, pcw, "Amstrad plc", "PCW9512 (+)", MACHINE_NOT_WORKING) -COMP( 1993, pcw10, pcw8256, 0, pcw8512, pcw, pcw_state, pcw, "Amstrad plc", "PCW10", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/pcw16.c b/src/mess/drivers/pcw16.c deleted file mode 100644 index 109624be06c..00000000000 --- a/src/mess/drivers/pcw16.c +++ /dev/null @@ -1,1094 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/****************************************************************************** - - pcw16.c - system driver - - Kevin Thacker [MESS driver] - - Thankyou to: - - - Cliff Lawson @ Amstrad plc for his documentation (Anne ASIC documentation), - and extensive help. - (web.ukonline.co.uk/cliff.lawson/) - (www.amstrad.com) - - John Elliot for his help and tips - (he's written a CP/M implementation for the PCW16) - (www.seasip.deomon.co.uk) - - and others who offered their help (Richard Fairhurst, Richard Wildey) - - Hardware: - - 2mb dram max, - - 2mb flash-file memory max (in 2 1mb chips), - - 16MHz Z80 (core combined in Anne ASIC), - - Anne ASIC (keyboard interface, video (colours), dram/flash/rom paging, - real time clock, "glue" logic for Super I/O) - - Winbond Super I/O chip (PC type hardware - FDC, Serial, LPT, Hard-drive) - - PC/AT keyboard - some keys are coloured to identify special functions, but - these are the same as normal PC keys - - PC Serial Mouse - uses Mouse System Mouse protocol - - PC 1.44MB Floppy drive - - Primary Purpose: - - built as a successor to the PCW8526/PCW9512 series - - wordprocessor system (also contains spreadsheet and other office applications) - - 16MHz processor used so proportional fonts and enhanced wordprocessing features - are possible, true WYSIWYG wordprocessing. - - flash-file can store documents. - - To Do: - - reduce memory usage so it is more MESSD friendly - - different configurations - - implement configuration register - - extract game-port hardware from pc driver - used in any PCW16 progs? - - extract hard-drive code from PC driver and use in this driver - - implement printer - - .. anything else that requires implementing - - Info: - - to use this driver you need a OS rescue disc. - (HINT: This also contains the boot-rom) - - the OS will be installed from the OS rescue disc into the Flash-ROM - - Uses "MEMCARD" dir to hold flash-file data. - To use the power button, flick the dip switch off/on - - From comp.sys.amstrad.8bit FAQ: - - "Amstrad made the following PCW systems : - - - 1) PCW8256 - - 2) PCW8512 - - 3) PCW9512 - - 4) PCW9512+ - - 5) PcW10 - - 6) PcW16 - - 1 had 180K drives, 2 had a 180K A drive and a 720K B drive, 3 had only - 720K drives. All subsequent models had 3.5" disks using CP/M format at - 720K until 6 when it switched to 1.44MB in MS-DOS format. The + of - model 4 was that it had a "real" parallel interface so could be sold - with an external printer such as the Canon BJ10. The PcW10 wasn't - really anything more than 4 in a more modern looking case. - - The PcW16 is a radical digression who's sole "raison d'etre" was to - make a true WYSIWYG product but this meant a change in the screen and - processor (to 16MHz) etc. which meant that it could not be kept - compatible with the previous models (though documents ARE compatible)" - - -TODO: -- Verfiy uart model. - - - ******************************************************************************/ -/* PeT 19.October 2000 - added/changed printer support - not working reliable, seams to expect parallelport in epp/ecp mode - epp/ecp modes in parallel port not supported yet - so ui disabled */ - -#include "includes/pcw16.h" -#include "bus/rs232/rs232.h" -#include "bus/rs232/ser_mouse.h" - -// interrupt counter -/* controls which bank of 2mb address space is paged into memory */ - -// output of 4-bit port from Anne ASIC -// code defining which INT fdc is connected to -// interrupt bits -// bit 7: ?? -// bit 6: fdc -// bit 5: ?? -// bit 3,4; Serial -// bit 2: Vsync state -// bit 1: keyboard int -// bit 0: Display ints - -// debugging - write ram as seen by cpu -void pcw16_state::pcw16_refresh_ints() -{ - /* any bits set excluding vsync */ - if ((m_system_status & (~0x04))!=0) - { - m_maincpu->set_input_line(0, HOLD_LINE); - } - else - { - m_maincpu->set_input_line(0, CLEAR_LINE); - } -} - - -TIMER_DEVICE_CALLBACK_MEMBER(pcw16_state::pcw16_timer_callback) -{ - /* do not increment past 15 */ - if (m_interrupt_counter!=15) - { - m_interrupt_counter++; - /* display int */ - m_system_status |= (1<<0); - } - - if (m_interrupt_counter!=0) - { - pcw16_refresh_ints(); - } -} - -static ADDRESS_MAP_START(pcw16_map, AS_PROGRAM, 8, pcw16_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(pcw16_mem_r, pcw16_mem_w) -ADDRESS_MAP_END - - -WRITE8_MEMBER(pcw16_state::pcw16_palette_w) -{ - m_colour_palette[offset & 0x0f] = data & 31; -} - -UINT8 pcw16_state::read_bank_data(UINT8 type, UINT16 offset) -{ - if(type & 0x80) // DRAM - { - return m_ram->pointer()[((type & 0x7f)*0x4000) + offset]; - } - else // ROM / Flash - { - if(type < 4) - { - return m_region_rom->base()[((type & 0x03)*0x4000)+offset+0x10000]; - } - if(type < 0x40) // first flash - { - return m_flash0->read(((type & 0x3f)*0x4000)+offset); - } - else // second flash - { - return m_flash1->read(((type & 0x3f)*0x4000)+offset); - } - } -} - -void pcw16_state::write_bank_data(UINT8 type, UINT16 offset, UINT8 data) -{ - if(type & 0x80) // DRAM - { - m_ram->pointer()[((type & 0x7f)*0x4000) + offset] = data; - } - else // ROM / Flash - { - if(type < 4) - return; // first four sectors are write protected - if(type < 0x40) // first flash - { - m_flash0->write(((type & 0x3f)*0x4000)+offset,data); - } - else // second flash - { - m_flash1->write(((type & 0x3f)*0x4000)+offset,data); - } - } -} - -UINT8 pcw16_state::pcw16_read_mem(UINT8 bank, UINT16 offset) -{ - switch(bank) - { - case 0: - return read_bank_data(m_banks[bank],offset); - case 1: - return read_bank_data(m_banks[bank],offset); - case 2: - return read_bank_data(m_banks[bank],offset); - case 3: - return read_bank_data(m_banks[bank],offset); - } - return 0xff; -} - -void pcw16_state::pcw16_write_mem(UINT8 bank, UINT16 offset, UINT8 data) -{ - switch(bank) - { - case 0: - write_bank_data(m_banks[bank],offset,data); - break; - case 1: - write_bank_data(m_banks[bank],offset,data); - break; - case 2: - write_bank_data(m_banks[bank],offset,data); - break; - case 3: - write_bank_data(m_banks[bank],offset,data); - break; - } -} - -READ8_MEMBER(pcw16_state::pcw16_mem_r) -{ - if(offset < 0x4000) - return pcw16_read_mem(0,offset); - if(offset >= 0x4000 && offset < 0x8000) - return pcw16_read_mem(1,offset-0x4000); - if(offset >= 0x8000 && offset < 0xc000) - return pcw16_read_mem(2,offset-0x8000); - if(offset >= 0xc000 && offset < 0x10000) - return pcw16_read_mem(3,offset-0xc000); - - return 0xff; -} - -WRITE8_MEMBER(pcw16_state::pcw16_mem_w) -{ - if(offset < 0x4000) - pcw16_write_mem(0,offset,data); - if(offset >= 0x4000 && offset < 0x8000) - pcw16_write_mem(1,offset-0x4000,data); - if(offset >= 0x8000 && offset < 0xc000) - pcw16_write_mem(2,offset-0x8000,data); - if(offset >= 0xc000 && offset < 0x10000) - pcw16_write_mem(3,offset-0xc000,data); -} - -READ8_MEMBER(pcw16_state::pcw16_bankhw_r) -{ -// logerror("bank r: %d \n", offset); - - return m_banks[offset]; -} - -WRITE8_MEMBER(pcw16_state::pcw16_bankhw_w) -{ - //logerror("bank w: %d block: %02x\n", offset, data); - - m_banks[offset] = data; -} - -WRITE8_MEMBER(pcw16_state::pcw16_video_control_w) -{ - //logerror("video control w: %02x\n", data); - - m_video_control = data; -} - -/* PCW16 KEYBOARD */ - -//unsigned char pcw16_keyboard_status; - - - -#define PCW16_KEYBOARD_PARITY_MASK (1<<7) -#define PCW16_KEYBOARD_STOP_BIT_MASK (1<<6) -#define PCW16_KEYBOARD_START_BIT_MASK (1<<5) -#define PCW16_KEYBOARD_BUSY_STATUS (1<<4) -#define PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK (1<<1) -#define PCW16_KEYBOARD_TRANSMIT_MODE (1<<0) - -#define PCW16_KEYBOARD_RESET_INTERFACE (1<<2) - -#define PCW16_KEYBOARD_DATA (1<<1) -#define PCW16_KEYBOARD_CLOCK (1<<0) - -/* parity table. Used to set parity bit in keyboard status register */ - -void pcw16_state::pcw16_keyboard_init() -{ - int i; - int b; - - /* if sum of all bits in the byte is even, then the data - has even parity, otherwise it has odd parity */ - for (i=0; i<256; i++) - { - int data; - int sum; - - sum = 0; - data = i; - - for (b=0; b<8; b++) - { - sum+=data & 0x01; - - data = data>>1; - } - - m_keyboard_parity_table[i] = sum & 0x01; - } - - - /* clear int */ - pcw16_keyboard_int(0); - /* reset state */ - m_keyboard_state = 0; - /* reset ready for transmit */ - pcw16_keyboard_reset(); -} - -void pcw16_state::pcw16_keyboard_refresh_outputs() -{ - /* generate output bits */ - m_keyboard_bits_output = m_keyboard_bits; - - /* force clock low? */ - if (m_keyboard_state & PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK) - { - m_keyboard_bits_output &= ~PCW16_KEYBOARD_CLOCK; - } -} - -void pcw16_state::pcw16_keyboard_set_clock_state(int state) -{ - m_keyboard_bits &= ~PCW16_KEYBOARD_CLOCK; - - if (state) - { - m_keyboard_bits |= PCW16_KEYBOARD_CLOCK; - } - - pcw16_keyboard_refresh_outputs(); -} - -void pcw16_state::pcw16_keyboard_int(int state) -{ - m_system_status &= ~(1<<1); - - if (state) - { - m_system_status |= (1<<1); - } - - pcw16_refresh_ints(); -} - -void pcw16_state::pcw16_keyboard_reset() -{ - /* clock set to high */ - pcw16_keyboard_set_clock_state(1); -} - -/* interfaces to a pc-at keyboard */ -READ8_MEMBER(pcw16_state::pcw16_keyboard_data_shift_r) -{ - //logerror("keyboard data shift r: %02x\n", m_keyboard_data_shift); - m_keyboard_state &= ~(PCW16_KEYBOARD_BUSY_STATUS); - - pcw16_keyboard_int(0); - /* reset for reception */ - pcw16_keyboard_reset(); - - /* read byte */ - return m_keyboard_data_shift; -} - -/* if force keyboard clock is low it is safe to send */ -int pcw16_state::pcw16_keyboard_can_transmit() -{ - /* clock is not forced low */ - /* and not busy - i.e. not already sent a char */ - return ((m_keyboard_bits_output & PCW16_KEYBOARD_CLOCK)!=0); -} - -#ifdef UNUSED_FUNCTION -/* issue a begin byte transfer */ -void ::pcw16_begin_byte_transfer(void) -{ -} -#endif - -/* signal a code has been received */ -void pcw16_state::pcw16_keyboard_signal_byte_received(int data) -{ - /* clear clock */ - pcw16_keyboard_set_clock_state(0); - - /* set code in shift register */ - m_keyboard_data_shift = data; - /* busy */ - m_keyboard_state |= PCW16_KEYBOARD_BUSY_STATUS; - - /* initialise start, stop and parity bits */ - m_keyboard_state &= ~PCW16_KEYBOARD_START_BIT_MASK; - m_keyboard_state |=PCW16_KEYBOARD_STOP_BIT_MASK; - - /* "Keyboard data has odd parity, so the parity bit in the - status register should only be set when the shift register - data itself has even parity. */ - - m_keyboard_state &= ~PCW16_KEYBOARD_PARITY_MASK; - - /* if data has even parity, set parity bit */ - if ((m_keyboard_parity_table[data])==0) - m_keyboard_state |= PCW16_KEYBOARD_PARITY_MASK; - - pcw16_keyboard_int(1); -} - - -WRITE8_MEMBER(pcw16_state::pcw16_keyboard_data_shift_w) -{ - //logerror("Keyboard Data Shift: %02x\n", data); - /* writing to shift register clears parity */ - /* writing to shift register clears start bit */ - m_keyboard_state &= ~( - PCW16_KEYBOARD_PARITY_MASK | - PCW16_KEYBOARD_START_BIT_MASK); - - /* writing to shift register sets stop bit */ - m_keyboard_state |= PCW16_KEYBOARD_STOP_BIT_MASK; - - m_keyboard_data_shift = data; - -} - -READ8_MEMBER(pcw16_state::pcw16_keyboard_status_r) -{ - /* bit 2,3 are bits 8 and 9 of vdu pointer */ - return (m_keyboard_state & - (PCW16_KEYBOARD_PARITY_MASK | - PCW16_KEYBOARD_STOP_BIT_MASK | - PCW16_KEYBOARD_START_BIT_MASK | - PCW16_KEYBOARD_BUSY_STATUS | - PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK | - PCW16_KEYBOARD_TRANSMIT_MODE)); -} - -WRITE8_MEMBER(pcw16_state::pcw16_keyboard_control_w) -{ - //logerror("Keyboard control w: %02x\n",data); - - m_keyboard_previous_state = m_keyboard_state; - - /* if set, set parity */ - if (data & 0x080) - { - m_keyboard_state |= PCW16_KEYBOARD_PARITY_MASK; - } - - /* clear read/write bits */ - m_keyboard_state &= - ~(PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK | - PCW16_KEYBOARD_TRANSMIT_MODE); - /* set read/write bits from data */ - m_keyboard_state |= (data & 0x03); - - if (data & PCW16_KEYBOARD_RESET_INTERFACE) - { - pcw16_keyboard_reset(); - } - - if (data & PCW16_KEYBOARD_TRANSMIT_MODE) - { - /* force clock changed */ - if (((m_keyboard_state^m_keyboard_previous_state) & PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK)!=0) - { - /* just cleared? */ - if ((m_keyboard_state & PCW16_KEYBOARD_FORCE_KEYBOARD_CLOCK)==0) - { - /* write */ - /* busy */ - m_keyboard_state |= PCW16_KEYBOARD_BUSY_STATUS; - /* keyboard takes data */ - m_keyboard->write(space, 0, m_keyboard_data_shift); - /* set clock low - no furthur transmissions */ - pcw16_keyboard_set_clock_state(0); - /* set int */ - pcw16_keyboard_int(1); - } - } - - - } - - if (((m_keyboard_state^m_keyboard_previous_state) & PCW16_KEYBOARD_TRANSMIT_MODE)!=0) - { - if ((m_keyboard_state & PCW16_KEYBOARD_TRANSMIT_MODE)==0) - { - if ((m_system_status & (1<<1))!=0) - { - pcw16_keyboard_int(0); - } - } - } - - pcw16_keyboard_refresh_outputs(); -} - - -WRITE_LINE_MEMBER(pcw16_state::pcw16_keyboard_callback) -{ - if(!state) - return; - - if (pcw16_keyboard_can_transmit()) - { - int data; - - data = m_keyboard->read(machine().driver_data()->generic_space(), 0); - - if (data) - { -// if (data==4) -// { -// pcw16_dump_cpu_ram(); -// } - - pcw16_keyboard_signal_byte_received(data); - } - } -} - - -static const int rtc_days_in_each_month[]= -{ - 31,/* jan */ - 28, /* feb */ - 31, /* march */ - 30, /* april */ - 31, /* may */ - 30, /* june */ - 31, /* july */ - 31, /* august */ - 30, /* september */ - 31, /* october */ - 30, /* november */ - 31 /* december */ -}; - -static const int rtc_days_in_february[] = -{ - 29, 28, 28, 28 -}; - -void pcw16_state::rtc_setup_max_days() -{ - /* february? */ - if (m_rtc_months == 2) - { - /* low two bits of year select number of days in february */ - m_rtc_days_max = rtc_days_in_february[m_rtc_years & 0x03]; - } - else - { - m_rtc_days_max = (unsigned char)rtc_days_in_each_month[m_rtc_months]; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(pcw16_state::rtc_timer_callback) -{ - int fraction_of_second; - - /* halt counter? */ - if ((m_rtc_control & 0x01)!=0) - { - /* no */ - - /* increment 256th's of a second register */ - fraction_of_second = m_rtc_256ths_seconds+1; - /* add bit 8 = overflow */ - m_rtc_seconds+=(fraction_of_second>>8); - /* ensure counter is in range 0-255 */ - m_rtc_256ths_seconds = fraction_of_second & 0x0ff; - } - - if (m_rtc_seconds>59) - { - m_rtc_seconds = 0; - - m_rtc_minutes++; - - if (m_rtc_minutes>59) - { - m_rtc_minutes = 0; - - m_rtc_hours++; - - if (m_rtc_hours>23) - { - m_rtc_hours = 0; - - m_rtc_days++; - - if (m_rtc_days > m_rtc_days_max) - { - m_rtc_days = 1; - - m_rtc_months++; - - if (m_rtc_months>12) - { - m_rtc_months = 1; - - /* 7 bit year counter */ - m_rtc_years = (m_rtc_years + 1) & 0x07f; - - } - - rtc_setup_max_days(); - } - - } - - - } - } -} - -READ8_MEMBER(pcw16_state::rtc_year_invalid_r) -{ - /* year in lower 7 bits. RTC Invalid status is m_rtc_control bit 0 - inverted */ - return (m_rtc_years & 0x07f) | (((m_rtc_control & 0x01)<<7)^0x080); -} - -READ8_MEMBER(pcw16_state::rtc_month_r) -{ - return m_rtc_months; -} - -READ8_MEMBER(pcw16_state::rtc_days_r) -{ - return m_rtc_days; -} - -READ8_MEMBER(pcw16_state::rtc_hours_r) -{ - return m_rtc_hours; -} - -READ8_MEMBER(pcw16_state::rtc_minutes_r) -{ - return m_rtc_minutes; -} - -READ8_MEMBER(pcw16_state::rtc_seconds_r) -{ - return m_rtc_seconds; -} - -READ8_MEMBER(pcw16_state::rtc_256ths_seconds_r) -{ - return m_rtc_256ths_seconds; -} - -WRITE8_MEMBER(pcw16_state::rtc_control_w) -{ - /* write control */ - m_rtc_control = data; -} - -WRITE8_MEMBER(pcw16_state::rtc_seconds_w) -{ - /* TODO: Writing register could cause next to increment! */ - m_rtc_seconds = data; -} - -WRITE8_MEMBER(pcw16_state::rtc_minutes_w) -{ - /* TODO: Writing register could cause next to increment! */ - m_rtc_minutes = data; -} - -WRITE8_MEMBER(pcw16_state::rtc_hours_w) -{ - /* TODO: Writing register could cause next to increment! */ - m_rtc_hours = data; -} - -WRITE8_MEMBER(pcw16_state::rtc_days_w) -{ - /* TODO: Writing register could cause next to increment! */ - m_rtc_days = data; -} - -WRITE8_MEMBER(pcw16_state::rtc_month_w) -{ - /* TODO: Writing register could cause next to increment! */ - m_rtc_months = data; - - rtc_setup_max_days(); -} - - -WRITE8_MEMBER(pcw16_state::rtc_year_w) -{ - /* TODO: Writing register could cause next to increment! */ - m_rtc_hours = data; - - rtc_setup_max_days(); -} - - -void pcw16_state::trigger_fdc_int() -{ - int state; - - state = m_system_status & (1<<6); - - switch (m_fdc_int_code) - { - /* nmi */ - case 0: - { - /* I'm assuming that the nmi is edge triggered */ - /* a interrupt from the fdc will cause a change in line state, and - the nmi will be triggered, but when the state changes because the int - is cleared this will not cause another nmi */ - /* I'll emulate it like this to be sure */ - - if (state!=m_previous_fdc_int_state) - { - if (state) - { - /* I'll pulse it because if I used hold-line I'm not sure - it would clear - to be checked */ - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } - } - } - break; - - /* attach fdc to int */ - case 1: - { - pcw16_refresh_ints(); - } - break; - - /* do not interrupt */ - default: - break; - } - - m_previous_fdc_int_state = state; -} - -READ8_MEMBER(pcw16_state::pcw16_system_status_r) -{ -// logerror("system status r: \n"); - - return m_system_status | (m_io_extra->read() & 0x04); -} - -READ8_MEMBER(pcw16_state::pcw16_timer_interrupt_counter_r) -{ - int data; - - data = m_interrupt_counter; - - m_interrupt_counter = 0; - /* clear display int */ - m_system_status &= ~(1<<0); - - pcw16_refresh_ints(); - - return data; -} - - -WRITE8_MEMBER(pcw16_state::pcw16_system_control_w) -{ - //logerror("0x0f8: function: %d\n",data); - - /* lower 4 bits define function code */ - switch (data & 0x0f) - { - /* no effect */ - case 0x00: - case 0x09: - case 0x0a: - case 0x0d: - case 0x0e: - break; - - /* system reset */ - case 0x01: - break; - - /* connect IRQ6 input to /NMI */ - case 0x02: - { - m_fdc_int_code = 0; - } - break; - - /* connect IRQ6 input to /INT */ - case 0x03: - { - m_fdc_int_code = 1; - } - break; - - /* dis-connect IRQ6 input from /NMI and /INT */ - case 0x04: - { - m_fdc_int_code = 2; - } - break; - - /* set terminal count */ - case 0x05: - { - m_fdc->tc_w(true); - } - break; - - /* clear terminal count */ - case 0x06: - { - m_fdc->tc_w(false); - } - break; - - /* bleeper on */ - case 0x0b: - { - m_beeper->set_state(1); - } - break; - - /* bleeper off */ - case 0x0c: - { - m_beeper->set_state(0); - } - break; - - /* drive video outputs */ - case 0x07: - { - } - break; - - /* float video outputs */ - case 0x08: - { - } - break; - - /* set 4-bit output port to value X */ - case 0x0f: - { - /* bit 7 - ?? */ - /* bit 6 - ?? */ - /* bit 5 - green/red led (1==green)*/ - /* bit 4 - monitor on/off (1==on) */ - - m_4_bit_port = data>>4; - - - } - break; - } -} - -WRITE_LINE_MEMBER( pcw16_state::fdc_interrupt ) -{ - /* IRQ6 */ - /* bit 6 of PCW16 system status indicates floppy ints */ - if (state) - m_system_status |= (1<<6); - else - m_system_status &= ~(1<<6); - - trigger_fdc_int(); -} - - -WRITE_LINE_MEMBER(pcw16_state::pcw16_com_interrupt_1) -{ - m_system_status &= ~(1 << 4); - - if ( state ) { - m_system_status |= (1 << 4); - } - - pcw16_refresh_ints(); -} - - -WRITE_LINE_MEMBER(pcw16_state::pcw16_com_interrupt_2) -{ - m_system_status &= ~(1 << 3); - - if ( state ) { - m_system_status |= (1 << 3); - } - - pcw16_refresh_ints(); -} - -FLOPPY_FORMATS_MEMBER( pcw16_state::floppy_formats ) - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( pcw16_floppies ) - SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) -SLOT_INTERFACE_END - - -static ADDRESS_MAP_START(pcw16_io, AS_IO, 8, pcw16_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - /* super i/o chip */ - AM_RANGE(0x018, 0x01f) AM_DEVICE("fdc", pc_fdc_superio_device, map) - AM_RANGE(0x020, 0x027) AM_DEVREADWRITE("ns16550_1", ns16550_device, ins8250_r, ins8250_w) - AM_RANGE(0x028, 0x02f) AM_DEVREADWRITE("ns16550_2", ns16550_device, ins8250_r, ins8250_w) - AM_RANGE(0x038, 0x03a) AM_DEVREADWRITE("lpt", pc_lpt_device, read, write) - /* anne asic */ - AM_RANGE(0x0e0, 0x0ef) AM_WRITE(pcw16_palette_w) - AM_RANGE(0x0f0, 0x0f3) AM_READWRITE(pcw16_bankhw_r, pcw16_bankhw_w) - AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw16_keyboard_data_shift_r, pcw16_keyboard_data_shift_w) - AM_RANGE(0x0f5, 0x0f5) AM_READWRITE(pcw16_keyboard_status_r, pcw16_keyboard_control_w) - AM_RANGE(0x0f7, 0x0f7) AM_READWRITE(pcw16_timer_interrupt_counter_r, pcw16_video_control_w) - AM_RANGE(0x0f8, 0x0f8) AM_READWRITE(pcw16_system_status_r, pcw16_system_control_w) - AM_RANGE(0x0f9, 0x0f9) AM_READWRITE(rtc_256ths_seconds_r, rtc_control_w) - AM_RANGE(0x0fa, 0x0fa) AM_READWRITE(rtc_seconds_r, rtc_seconds_w) - AM_RANGE(0x0fb, 0x0fb) AM_READWRITE(rtc_minutes_r, rtc_minutes_w) - AM_RANGE(0x0fc, 0x0fc) AM_READWRITE(rtc_hours_r, rtc_hours_w) - AM_RANGE(0x0fd, 0x0fd) AM_READWRITE(rtc_days_r, rtc_days_w) - AM_RANGE(0x0fe, 0x0fe) AM_READWRITE(rtc_month_r, rtc_month_w) - AM_RANGE(0x0ff, 0x0ff) AM_READWRITE(rtc_year_invalid_r, rtc_year_w) -ADDRESS_MAP_END - - -void pcw16_state::machine_reset() -{ - /* initialise defaults */ - m_fdc_int_code = 2; - /* clear terminal count */ - m_fdc->tc_w(false); - /* select first rom page */ - m_banks[0] = 0; -// pcw16_update_memory(machine); - - /* temp rtc setup */ - m_rtc_seconds = 0; - m_rtc_minutes = 0; - m_rtc_hours = 0; - m_rtc_days_max = 0; - m_rtc_days = 1; - m_rtc_months = 1; - m_rtc_years = 0; - m_rtc_control = 1; - m_rtc_256ths_seconds = 0; - - pcw16_keyboard_init(); - m_uart2->ri_w(0); -} - - -void pcw16_state::machine_start() -{ - m_system_status = 0; - m_interrupt_counter = 0; - - m_beeper->set_state(0); - m_beeper->set_frequency(3750); -} - -static INPUT_PORTS_START(pcw16) - PORT_START("EXTRA") - /* vblank */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") - /* power switch - default is on */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Power Switch/Suspend") PORT_WRITE_LINE_DEVICE_MEMBER("ns16550_2", ins8250_uart_device, ri_w) PORT_TOGGLE - - PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ -INPUT_PORTS_END - -static SLOT_INTERFACE_START(pcw16_com) - SLOT_INTERFACE("msystems_mouse", MSYSTEM_SERIAL_MOUSE) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( pcw16, pcw16_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 16000000) - MCFG_CPU_PROGRAM_MAP(pcw16_map) - MCFG_CPU_IO_MAP(pcw16_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - - MCFG_DEVICE_ADD( "ns16550_1", NS16550, XTAL_1_8432MHz ) /* TODO: Verify uart model */ - MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport1", rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport1", rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport1", rs232_port_device, write_rts)) - MCFG_INS8250_OUT_INT_CB(WRITELINE(pcw16_state, pcw16_com_interrupt_1)) - MCFG_RS232_PORT_ADD( "serport1", pcw16_com, "msystems_mouse" ) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, dsr_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, ri_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ns16550_1", ins8250_uart_device, cts_w)) - - MCFG_DEVICE_ADD( "ns16550_2", NS16550, XTAL_1_8432MHz ) /* TODO: Verify uart model */ - MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport2", rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport2", rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport2", rs232_port_device, write_rts)) - MCFG_INS8250_OUT_INT_CB(WRITELINE(pcw16_state, pcw16_com_interrupt_2)) - MCFG_RS232_PORT_ADD( "serport2", pcw16_com, NULL ) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("ns16550_2", ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("ns16550_2", ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ns16550_2", ins8250_uart_device, dsr_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ns16550_2", ins8250_uart_device, cts_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(PCW16_SCREEN_WIDTH, PCW16_SCREEN_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, PCW16_SCREEN_WIDTH-1, 0, PCW16_SCREEN_HEIGHT-1) - MCFG_SCREEN_UPDATE_DRIVER(pcw16_state, screen_update_pcw16) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", PCW16_NUM_COLOURS) - MCFG_PALETTE_INIT_OWNER(pcw16_state, pcw16) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* printer */ - MCFG_DEVICE_ADD("lpt", PC_LPT, 0) - MCFG_PC_LPT_IRQ_HANDLER(INPUTLINE("maincpu", 0)) - - MCFG_PC_FDC_SUPERIO_ADD("fdc") - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(pcw16_state, fdc_interrupt)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcw16_floppies, "35hd", pcw16_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", pcw16_floppies, "35hd", pcw16_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("disk_list","pcw16") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2M") - MCFG_INTEL_E28F008SA_ADD("flash0") - MCFG_INTEL_E28F008SA_ADD("flash1") - - MCFG_AT_KEYB_ADD("at_keyboard", 3, WRITELINE(pcw16_state, pcw16_keyboard_callback)) - - /* video ints */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("video_timer", pcw16_state, pcw16_timer_callback, attotime::from_usec(5830)) - /* rtc timer */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("rtc_timer", pcw16_state, rtc_timer_callback, attotime::from_hz(256)) -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* the lower 64k of the flash-file memory is write protected. This contains the boot - rom. The boot rom is also on the OS rescue disc. Handy! */ -ROM_START(pcw16) - ROM_REGION((0x010000+524288), "maincpu",0) - ROM_LOAD("pcw045.sys",0x10000, 524288, CRC(c642f498) SHA1(8a5c05de92e7b2c5acdfb038217503ad363285b5)) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1995, pcw16, 0, 0, pcw16, pcw16, driver_device, 0, "Amstrad plc", "PcW16", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pda600.c b/src/mess/drivers/pda600.c deleted file mode 100644 index a3e8f3d453e..00000000000 --- a/src/mess/drivers/pda600.c +++ /dev/null @@ -1,238 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Amstrad PenPad PDA 600 - - 05/11/2009 Skeleton driver. - - Hardware info: - U1: CPU - Z8S180 - Enhanced Z80 CPU - 1 MB MMU - 2 DMAs - 2 UARTs (up to 512 Kbps) - Two 16-Bit Timers - Clock Serial I/O - - U2: ROM - contains OS (binary and disassembled source) - apparently compatible to 27C1001 (128K*8) - - U3: RAM - 128K RAM, static - U4: RTC - U5: Amstrad ASIC (unknown functionality ) - U6, U7, U8, U9: Multiplexer - quad channel dual multiplexer - U11: RAM - 32K RAM, static - U12: LCD Controller - U21: 5V StepUp converter voltage converter - U27: OA quad operational amplifier - U30: RS232 Driver - U31: Amstrad ASIC - U32: FlipFlop Octal D-Flip-Flop - U33: RAM - 32K RAM, static - U35: Tone Dialer - generates DTMF frequencies - U36: unknown - U37: Nand - Dual Quad-Input Nand - U43: Bus Buffer - Octal Bus Buffer - - Connectors: - LCD - Digitizer - Serial - PCMCIA - - Additional info: - Two Z8 for power management and character recognition - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z180/z180.h" -#include "machine/nvram.h" -#include "machine/hd64610.h" -#include "rendlay.h" - - -class pda600_state : public driver_device -{ -public: - pda600_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - {} - - required_device m_maincpu; - - virtual void video_start(); - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - UINT8 * m_video_ram; -}; - - -static ADDRESS_MAP_START(pda600_mem, AS_PROGRAM, 8, pda600_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x1ffff) AM_ROM - //AM_RANGE(0x20000, 0x9ffff) AM_RAM // PCMCIA Card - AM_RANGE(0xa0000, 0xa7fff) AM_RAM AM_REGION("videoram", 0) - AM_RANGE(0xe0000, 0xfffff) AM_RAM AM_REGION("mainram", 0) AM_SHARE("nvram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pda600_io, AS_IO, 8, pda600_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x3f) AM_NOP /* Z180 internal registers */ - //AM_RANGE(0x40, 0x7f) AM_NOP /* Z180 internal registers */ - AM_RANGE(0x80, 0x8f) AM_DEVREADWRITE("rtc", hd64610_device, read, write) - //AM_RANGE(0xC0, 0xC1) AM_NOP /* LCD */ -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pda600 ) -INPUT_PORTS_END - - -void pda600_state::machine_reset() -{ - // the PDA600 soon after start waits for something from the Z180 CSIO, I do not know exactly for what - // the CSIO is used and for now I forced the CNTR End-Flag bit to 1 for allow the emulation to continue. - m_maincpu->set_state_int(Z180_CNTR, m_maincpu->state_int(Z180_CNTR) | 0x80); -} - -void pda600_state::video_start() -{ - m_video_ram = memregion("videoram")->base(); -} - -UINT32 pda600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int y=0; y<320; y++) - for (int x=0; x<30; x++) - { - UINT8 data = m_video_ram[y*30 + x]; - - for (int px=0; px<8; px++) - { - bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); - data <<= 1; - } - } - - return 0; -} - -static const gfx_layout pda600_charlayout_8 = -{ - 8, 8, - 49, - 1, - { 0 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static const gfx_layout pda600_charlayout_13 = -{ - 8, 13, - 123, - 1, - { 0 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12 }, - 8*13 -}; - -static const gfx_layout pda600_charlayout_13a = -{ - 8, 13, - 132, - 1, - { 0 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12 }, - 8*13 -}; - -static const gfx_layout pda600_charlayout_19 = -{ - 8, 19, - 32, - 1, - { 0 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12, 8*13, 8*14, 8*15, 8*16, 8*17, 8*18 }, - 8*19 -}; - -static const gfx_layout pda600_charlayout_19a = -{ - 8, 19, - 11, - 1, - { 0 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12, 8*13, 8*14, 8*15, 8*16, 8*17, 8*18 }, - 8*19 -}; - -static GFXDECODE_START( pda600 ) - GFXDECODE_ENTRY( "maincpu", 0x45cd, pda600_charlayout_19, 0, 1 ) - GFXDECODE_ENTRY( "maincpu", 0x4892, pda600_charlayout_19a, 0, 1 ) - GFXDECODE_ENTRY( "maincpu", 0x4d73, pda600_charlayout_8, 0, 1 ) - GFXDECODE_ENTRY( "maincpu", 0x5b8f, pda600_charlayout_13, 0, 1 ) - GFXDECODE_ENTRY( "maincpu", 0x61d3, pda600_charlayout_13a, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( pda600, pda600_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z180, XTAL_14_31818MHz) - MCFG_CPU_PROGRAM_MAP(pda600_mem) - MCFG_CPU_IO_MAP(pda600_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(240, 320) - MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 320-1) - MCFG_SCREEN_UPDATE_DRIVER( pda600_state, screen_update ) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pda600) - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - // NVRAM needs to be filled with random data to fail the checksum and be initialized correctly - MCFG_NVRAM_ADD_RANDOM_FILL("nvram") - - MCFG_DEVICE_ADD("rtc", HD64610, XTAL_32_768kHz) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pda600 ) - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "pdarom.bin", 0x00000, 0x20000, CRC(f793a6c5) SHA1(ab14b0fdcedb927c66357368a2bfff605ba758fb)) - - // 128KB RAM - ROM_REGION( 0x20000, "mainram", ROMREGION_ERASE ) - - // 32KB Video RAM - ROM_REGION( 0x8000, "videoram", ROMREGION_ERASE ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1993, pda600, 0, 0, pda600, pda600, driver_device, 0, "Amstrad plc", "PenPad PDA 600", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/pdp1.c b/src/mess/drivers/pdp1.c deleted file mode 100644 index f3827cf61b1..00000000000 --- a/src/mess/drivers/pdp1.c +++ /dev/null @@ -1,1979 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - -Driver for a PDP1 emulator. - - Digital Equipment Corporation - Brian Silverman (original Java Source) - Vadim Gerasimov (original Java Source) - Chris Salomon (MESS driver) - Raphael Nabet (MESS driver) - -Initially, this was a conversion of a JAVA emulator -(although code has been edited extensively ever since). -I have tried contacting the author, but heard as yet nothing of him, -so I don't know if it all right with him, but after all -> he did -release the source, so hopefully everything will be fine (no his -name is not Marat). - -Note: naturally I have no PDP1, I have never seen one, nor have I any -programs for it. - -The first supported program was: - -SPACEWAR! - -The first Videogame EVER! - -When I saw the java emulator, running that game I was quite intrigued to -include a driver for MESS. -I think the historical value of SPACEWAR! is enormous. - -Two other programs are supported: Munching squares and LISP. - -Added Debugging and Disassembler... - - -Also: -ftp://minnie.cs.adfa.oz.au/pub/PDP-11/Sims/Supnik_2.3/software/lispswre.tar.gz -Is a packet which includes the original LISP as source and -binary form plus a macro assembler for PDP1 programs. - -For more documentation look at the source for the driver, -and the cpu/pdp1/pdp1.c file (information about the whereabouts of information -and the java source). - - -To load and play a game: -- Load a .rim file into the first tape reader -- Hold down Left Control, and press Enter. Let go. -- The lights will flash while the paper tape is being read. -- At the end, the game will start. - - - -*/ - -#include "emu.h" -#include "cpu/pdp1/pdp1.h" -#include "includes/pdp1.h" -#include "video/crt.h" - -/* - * - * The loading storing OS... is not emulated (I haven't a clue where to - * get programs for the machine) - * - */ - - -static ADDRESS_MAP_START(pdp1_map, AS_PROGRAM, 32, pdp1_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM -ADDRESS_MAP_END - -static INPUT_PORTS_START( pdp1 ) - PORT_START("SPACEWAR") /* 0: spacewar controllers */ - PORT_BIT( ROTATE_LEFT_PLAYER1, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("Spin Left Player 1") PORT_CODE(KEYCODE_A) PORT_CODE(JOYCODE_X_LEFT_SWITCH) - PORT_BIT( ROTATE_RIGHT_PLAYER1, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("Spin Right Player 1") PORT_CODE(KEYCODE_S) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) - PORT_BIT( THRUST_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Thrust Player 1") PORT_CODE(KEYCODE_D) PORT_CODE(JOYCODE_BUTTON1) - PORT_BIT( FIRE_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Fire Player 1") PORT_CODE(KEYCODE_F) PORT_CODE(JOYCODE_BUTTON2) - PORT_BIT( ROTATE_LEFT_PLAYER2, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("Spin Left Player 2") PORT_CODE(KEYCODE_LEFT) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_PLAYER(2) - PORT_BIT( ROTATE_RIGHT_PLAYER2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("Spin Right Player 2") PORT_CODE(KEYCODE_RIGHT) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_PLAYER(2) - PORT_BIT( THRUST_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Thrust Player 2") PORT_CODE(KEYCODE_UP) PORT_CODE(JOYCODE_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( FIRE_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Fire Player 2") PORT_CODE(KEYCODE_DOWN) PORT_CODE(JOYCODE_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( HSPACE_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Hyperspace Player 1") PORT_CODE(KEYCODE_Z) PORT_CODE(JOYCODE_BUTTON3) - PORT_BIT( HSPACE_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Hyperspace Player 2") PORT_CODE(KEYCODE_SLASH) PORT_CODE(JOYCODE_BUTTON3 ) PORT_PLAYER(2) - - PORT_START("CSW") /* 1: various pdp1 operator control panel switches */ - PORT_BIT(pdp1_control, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(pdp1_extend, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("extend") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(pdp1_start_nobrk, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("start (sequence break disabled)") PORT_CODE(KEYCODE_U) - PORT_BIT(pdp1_start_brk, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("start (sequence break enabled)") PORT_CODE(KEYCODE_I) - PORT_BIT(pdp1_stop, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop") PORT_CODE(KEYCODE_O) - PORT_BIT(pdp1_continue, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("continue") PORT_CODE(KEYCODE_P) - PORT_BIT(pdp1_examine, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("examine") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(pdp1_deposit, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("deposit") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(pdp1_read_in, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("read in") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(pdp1_reader, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("reader") - PORT_BIT(pdp1_tape_feed, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("tape feed") - PORT_BIT(pdp1_single_step, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("single step") PORT_CODE(KEYCODE_STOP) - PORT_BIT(pdp1_single_inst, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("single inst") PORT_CODE(KEYCODE_SLASH) - - PORT_START("SENSE") /* 2: operator control panel sense switches */ - PORT_DIPNAME( 040, 000, "Sense Switch 1") PORT_CODE(KEYCODE_1_PAD) - PORT_DIPSETTING( 000, DEF_STR( Off ) ) - PORT_DIPSETTING( 040, DEF_STR( On ) ) - PORT_DIPNAME( 020, 000, "Sense Switch 2") PORT_CODE(KEYCODE_2_PAD) - PORT_DIPSETTING( 000, DEF_STR( Off ) ) - PORT_DIPSETTING( 020, DEF_STR( On ) ) - PORT_DIPNAME( 010, 000, "Sense Switch 3") PORT_CODE(KEYCODE_3_PAD) - PORT_DIPSETTING( 000, DEF_STR( Off ) ) - PORT_DIPSETTING( 010, DEF_STR( On ) ) - PORT_DIPNAME( 004, 000, "Sense Switch 4") PORT_CODE(KEYCODE_4_PAD) - PORT_DIPSETTING( 000, DEF_STR( Off ) ) - PORT_DIPSETTING( 004, DEF_STR( On ) ) - PORT_DIPNAME( 002, 002, "Sense Switch 5") PORT_CODE(KEYCODE_5_PAD) - PORT_DIPSETTING( 000, DEF_STR( Off ) ) - PORT_DIPSETTING( 002, DEF_STR( On ) ) - PORT_DIPNAME( 001, 000, "Sense Switch 6") PORT_CODE(KEYCODE_6_PAD) - PORT_DIPSETTING( 000, DEF_STR( Off ) ) - PORT_DIPSETTING( 001, DEF_STR( On ) ) - - PORT_START("TSTADD") /* 3: operator control panel test address switches */ - PORT_BIT( 0100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 3") PORT_CODE(KEYCODE_1) - PORT_BIT( 0040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 4") PORT_CODE(KEYCODE_2) - PORT_BIT( 0020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 5") PORT_CODE(KEYCODE_3) - PORT_BIT( 0010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 6") PORT_CODE(KEYCODE_4) - PORT_BIT( 0004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 7") PORT_CODE(KEYCODE_5) - PORT_BIT( 0002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 8") PORT_CODE(KEYCODE_6) - PORT_BIT( 0001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 9") PORT_CODE(KEYCODE_7) - PORT_BIT( 0000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 10") PORT_CODE(KEYCODE_8) - PORT_BIT( 0000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 11") PORT_CODE(KEYCODE_9) - PORT_BIT( 0000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 12") PORT_CODE(KEYCODE_0) - PORT_BIT( 0000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 13") PORT_CODE(KEYCODE_MINUS) - PORT_BIT( 0000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 14") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT( 0000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 15") PORT_CODE(KEYCODE_Q) - PORT_BIT( 0000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 16") PORT_CODE(KEYCODE_W) - PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 17") PORT_CODE(KEYCODE_E) - PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 18") PORT_CODE(KEYCODE_R) - - PORT_START("TWDMSB") /* 4: operator control panel test word switches MSB */ - PORT_BIT( 0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 1") PORT_CODE(KEYCODE_A) - PORT_BIT( 0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 2") PORT_CODE(KEYCODE_S) - - PORT_START("TWDLSB") /* 5: operator control panel test word switches LSB */ - PORT_BIT( 0100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 3") PORT_CODE(KEYCODE_D) - PORT_BIT( 0040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 4") PORT_CODE(KEYCODE_F) - PORT_BIT( 0020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 5") PORT_CODE(KEYCODE_G) - PORT_BIT( 0010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 6") PORT_CODE(KEYCODE_H) - PORT_BIT( 0004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 7") PORT_CODE(KEYCODE_J) - PORT_BIT( 0002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 8") PORT_CODE(KEYCODE_K) - PORT_BIT( 0001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 9") PORT_CODE(KEYCODE_L) - PORT_BIT( 0000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 10") PORT_CODE(KEYCODE_COLON) - PORT_BIT( 0000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 11") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT( 0000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 12") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT( 0000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 13") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 14") PORT_CODE(KEYCODE_X) - PORT_BIT( 0000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 15") PORT_CODE(KEYCODE_C) - PORT_BIT( 0000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 16") PORT_CODE(KEYCODE_V) - PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 17") PORT_CODE(KEYCODE_B) - PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 18") PORT_CODE(KEYCODE_N) - - /* - Note that I can see 2 additional keys whose purpose is unknown to me. - The caps look like "MAR REL" for the leftmost one and "MAR SET" for - rightmost one: maybe they were used to set the margin (I don't have the - manual for the typewriter). */ - - PORT_START("TWR.0") /* 6: typewriter codes 00-17 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(Space)") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 \"") PORT_CODE(KEYCODE_1) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 '") PORT_CODE(KEYCODE_2) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 ~") PORT_CODE(KEYCODE_3) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 (implies)") PORT_CODE(KEYCODE_4) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 (or)") PORT_CODE(KEYCODE_5) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 (and)") PORT_CODE(KEYCODE_6) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 <") PORT_CODE(KEYCODE_7) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 >") PORT_CODE(KEYCODE_8) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (up arrow)") PORT_CODE(KEYCODE_9) - - PORT_START("TWR.1") /* 7: typewriter codes 20-37 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 (right arrow)") PORT_CODE(KEYCODE_0) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", =") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab Key") PORT_CODE(KEYCODE_TAB) - - PORT_START("TWR.2") /* 8: typewriter codes 40-57 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(non-spacing middle dot) _") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") ]") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(non-spacing overstrike) |") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( [") PORT_CODE(KEYCODE_MINUS) - - PORT_START("TWR.3") /* 9: typewriter codes 60-77 */ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lower Case") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (multiply)") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upper case") PORT_CODE(KEYCODE_RSHIFT) - /* hack to support my macintosh which does not differentiate the Right Shift key */ - /* PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upper case") PORT_CODE(KEYCODE_CAPSLOCK) */ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) - - PORT_START("CFG") /* 10: pseudo-input port with config */ - PORT_DIPNAME( 0x0003, 0x0002, "RAM size") - PORT_DIPSETTING( 0x0000, "4kw" ) - PORT_DIPSETTING( 0x0001, "32kw") - PORT_DIPSETTING( 0x0002, "64kw") - PORT_DIPNAME( 0x0004, 0x0000, "Hardware multiply") - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0000, "Hardware divide") - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0000, "Type 20 sequence break system") - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0000, "Type 32 light pen") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) - - PORT_START("LIGHTPEN") /* 11: pseudo-input port with lightpen status */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("select larger light pen tip") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("select smaller light pen tip") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("light pen down") - - PORT_START("LIGHTX") /* 12: lightpen - X AXIS */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_RESET - - PORT_START("LIGHTY") /* 13: lightpen - Y AXIS */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_RESET -INPUT_PORTS_END - - -static const gfx_layout fontlayout = -{ - 6, 8, /* 6*8 characters */ - pdp1_charnum, /* 96+4 characters */ - 1, /* 1 bit per pixel */ - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ -}; - - -/* - The static palette only includes the pens for the control panel and - the typewriter, as the CRT palette is generated dynamically. - - The CRT palette defines various levels of intensity between white and - black. Grey levels follow an exponential law, so that decrementing the - color index periodically will simulate the remanence of a cathode ray tube. -*/ -static const UINT8 pdp1_colors[] = -{ - 0x00,0x00,0x00, /* black */ - 0xFF,0xFF,0xFF, /* white */ - 0x00,0xFF,0x00, /* green */ - 0x00,0x40,0x00, /* dark green */ - 0xFF,0x00,0x00, /* red */ - 0x80,0x80,0x80 /* light gray */ -}; - -static const UINT8 pdp1_palette[] = -{ - pen_panel_bg, pen_panel_caption, - pen_typewriter_bg, pen_black, - pen_typewriter_bg, pen_red -}; - -static const UINT8 total_colors_needed = pen_crt_num_levels + sizeof(pdp1_colors) / 3; - -static GFXDECODE_START( pdp1 ) - GFXDECODE_ENTRY( "gfx1", 0, fontlayout, pen_crt_num_levels + sizeof(pdp1_colors) / 3, 3 ) -GFXDECODE_END - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(pdp1_state, pdp1) -{ - /* rgb components for the two color emissions */ - const double r1 = .1, g1 = .1, b1 = .924, r2 = .7, g2 = .7, b2 = .076; - /* half period in seconds for the two color emissions */ - const double half_period_1 = .05, half_period_2 = .20; - /* refresh period in seconds */ - const double update_period = 1./refresh_rate; - double decay_1, decay_2; - double cur_level_1, cur_level_2; - UINT8 i, r, g, b; - - /* initialize CRT palette */ - - /* compute the decay factor per refresh frame */ - decay_1 = pow(.5, update_period / half_period_1); - decay_2 = pow(.5, update_period / half_period_2); - - cur_level_1 = cur_level_2 = 255.; /* start with maximum level */ - - for (i=pen_crt_max_intensity; i>0; i--) - { - /* compute the current color */ - r = (int) ((r1*cur_level_1 + r2*cur_level_2) + .5); - g = (int) ((g1*cur_level_1 + g2*cur_level_2) + .5); - b = (int) ((b1*cur_level_1 + b2*cur_level_2) + .5); - /* write color in palette */ - m_palette->set_indirect_color(i, rgb_t(r, g, b)); - /* apply decay for next iteration */ - cur_level_1 *= decay_1; - cur_level_2 *= decay_2; - } - - m_palette->set_indirect_color(0, rgb_t(0, 0, 0)); - - /* load static palette */ - for ( i = 0; i < 6; i++ ) - { - r = pdp1_colors[i*3]; g = pdp1_colors[i*3+1]; b = pdp1_colors[i*3+2]; - m_palette->set_indirect_color(pen_crt_num_levels + i, rgb_t(r, g, b)); - } - - /* copy colortable to palette */ - for( i = 0; i < total_colors_needed; i++ ) - m_palette->set_pen_indirect(i, i); - - /* set up palette for text */ - for( i = 0; i < 6; i++ ) - m_palette->set_pen_indirect(total_colors_needed + i, pdp1_palette[i]); -} - - -/* - pdp1 machine code - - includes emulation for I/O devices (with the IOT opcode) and control panel functions - - TODO: - * typewriter out should overwrite the typewriter buffer - * improve emulation of the internals of tape reader? - * improve puncher timing? -*/ - - -/* This flag makes the emulated pdp-1 trigger a sequence break request when a character has been -typed on the typewriter keyboard. It is useful in order to test sequence break, but we need -to emulate a connection box in which we can connect each wire to any interrupt line. Also, -we need to determine the exact relationship between the status register and the sequence break -system (both standard and type 20). */ -#define USE_SBS 0 - -#define LOG_IOT 0 -#define LOG_IOT_EXTRA 0 - -/* IOT completion may take much more than the 5us instruction time. A possible programming -error would be to execute an IOT before the last IOT of the same kind is over: such a thing -would confuse the targeted IO device, which might ignore the latter IOT, execute either -or both IOT incompletely, or screw up completely. I insist that such an error can be caused -by a pdp-1 programming error, even if there is no emulator error. */ -#define LOG_IOT_OVERLAP 0 - -static void pdp1_tape_read_binary(device_t *device); -static void pdp1_io_sc_callback(device_t *device); - -static void iot_rpa(device_t *device, int op2, int nac, int mb, int *io, int ac); -static void iot_rpb(device_t *device, int op2, int nac, int mb, int *io, int ac); -static void iot_rrb(device_t *device, int op2, int nac, int mb, int *io, int ac); -static void iot_ppa(device_t *device, int op2, int nac, int mb, int *io, int ac); -static void iot_ppb(device_t *device, int op2, int nac, int mb, int *io, int ac); - -static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac); -static void iot_tyi(device_t *device, int op2, int nac, int mb, int *io, int ac); - -static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac); - -static void iot_dia(device_t *device, int op2, int nac, int mb, int *io, int ac); -static void iot_dba(device_t *device, int op2, int nac, int mb, int *io, int ac); -static void iot_dcc(device_t *device, int op2, int nac, int mb, int *io, int ac); -static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac); - -static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac); - -static void iot_cks(device_t *device, int op2, int nac, int mb, int *io, int ac); - - -/* - devices which are known to generate a completion pulse (source: maintenance manual 9-??, - and 9-20, 9-21): - emulated: - * perforated tape reader - * perforated tape punch - * typewriter output - * CRT display - unemulated: - * card punch (pac: 43) - * line printer (lpr, lsp, but NOT lfb) - - This list should probably include additional optional devices (card reader comes to mind). -*/ - -/* IO status word */ - -/* defines for io_status bits */ -enum -{ - io_st_pen = 0400000, /* light pen: light has hit the pen */ - io_st_ptr = 0200000, /* perforated tape reader: reader buffer full */ - io_st_tyo = 0100000, /* typewriter out: device ready */ - io_st_tyi = 0040000, /* typewriter in: new character in buffer */ - io_st_ptp = 0020000 /* perforated tape punch: device ready */ -}; - - - - - - - -/* crt display timer */ - -/* light pen config */ - - - -#define PARALLEL_DRUM_WORD_TIME attotime::from_nsec(8500) -#define PARALLEL_DRUM_ROTATION_TIME attotime::from_nsec(8500*4096) - - -static pdp1_reset_param_t pdp1_reset_param = -{ - { /* external iot handlers. NULL means that the iot is unimplemented, unless there are - parentheses around the iot name, in which case the iot is internal to the cpu core. */ - /* I put a ? when the source is the handbook, since a) I have used the maintenance manual - as the primary source (as it goes more into details) b) the handbook and the maintenance - manual occasionnally contradict each other. */ - /* dia, dba, dcc, dra are documented in MIT PDP-1 COMPUTER MODIFICATION - BULLETIN no. 2 (drumInstrWriteup.bin/drumInstrWriteup.txt), and are - similar to IOT documented in Parallel Drum Type 23 Instruction Manual. */ - /* (iot) rpa rpb tyo tyi ppa ppb dpy */ - NULL, iot_rpa, iot_rpb, iot_tyo, iot_tyi, iot_ppa, iot_ppb, iot_dpy, - /* spacewar */ - NULL, iot_011, NULL, NULL, NULL, NULL, NULL, NULL, - /* lag glf?/jsp? gpl?/gpr?/gcf? */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* rrb rcb? rcc? cks mcs mes mel */ - iot_rrb, NULL, NULL, iot_cks, NULL, NULL, NULL, NULL, - /* cad? rac? rbc? pac lpr/lfb/lsp swc/sci/sdf?/shr? scv? */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* (dsc) (asc) (isb) (cac) (lsm) (esm) (cbs) */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* icv? dia dba dcc dra mri|rlc? mrf/inr?/ccr? */ - NULL, iot_dia, iot_dba, iot_dcc, iot_dra, NULL, NULL, NULL, - /* mcb|dur? mwc|mtf? mrc|sfc?... msm|cgo? (eem/lem) mic muf */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - }, - pdp1_tape_read_binary, - pdp1_io_sc_callback, - 0, /* extend mode support defined in input ports and pdp1_init_machine */ - 0, /* hardware multiply/divide support defined in input ports and pdp1_init_machine */ - 0 /* type 20 sequence break system support defined in input ports and pdp1_init_machine */ -}; - -void pdp1_state::machine_reset() -{ - int cfg = m_cfg->read(); - - pdp1_reset_param.extend_support = (cfg >> pdp1_config_extend_bit) & pdp1_config_extend_mask; - pdp1_reset_param.hw_mul_div = (cfg >> pdp1_config_hw_mul_div_bit) & pdp1_config_hw_mul_div_mask; - pdp1_reset_param.type_20_sbs = (cfg >> pdp1_config_type_20_sbs_bit) & pdp1_config_type_20_sbs_mask; - - /* reset device state */ - m_tape_reader.rcl = m_tape_reader.rc = 0; - m_io_status = io_st_tyo | io_st_ptp; - m_lightpen.active = m_lightpen.down = 0; - m_lightpen.x = m_lightpen.y = 0; - m_lightpen.radius = 10; /* ??? */ - pdp1_update_lightpen_state(&m_lightpen); -} - - -void pdp1_state::pdp1_machine_stop() -{ - /* the core will take care of freeing the timers, BUT we must set the variables - to NULL if we don't want to risk confusing the tape image init function */ - m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.tyo_timer = m_dpy_timer = NULL; -} - - -/* - driver init function - - Set up the pdp1_memory pointer, and generate font data. -*/ -void pdp1_state::machine_start() -{ - UINT8 *dst; - - static const unsigned char fontdata6x8[pdp1_fontdata_size] = - { /* ASCII characters */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, - 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00, - 0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08, - 0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00, - 0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00, - 0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00, - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00, - 0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00, - 0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, - 0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00, - 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00, - 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60, - 0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, - 0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, - 0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, - 0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, - 0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, - 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00, - 0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, - 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, - 0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08, - 0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00, - 0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00, - 0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00, - 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00, - 0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc, - 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, - 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00, - 0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, - 0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, - 0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00, - 0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00, - 0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, - 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, - 0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, - 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00, - 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00, - 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, - 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, - 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00, - - /* non-spacing middle dot */ - 0x00, - 0x00, - 0x00, - 0x20, - 0x00, - 0x00, - 0x00, - 0x00, - /* non-spacing overstrike */ - 0x00, - 0x00, - 0x00, - 0x00, - 0xfc, - 0x00, - 0x00, - 0x00, - /* implies */ - 0x00, - 0x00, - 0x70, - 0x08, - 0x08, - 0x08, - 0x70, - 0x00, - /* or */ - 0x88, - 0x88, - 0x88, - 0x50, - 0x50, - 0x50, - 0x20, - 0x00, - /* and */ - 0x20, - 0x50, - 0x50, - 0x50, - 0x88, - 0x88, - 0x88, - 0x00, - /* up arrow */ - 0x20, - 0x70, - 0xa8, - 0x20, - 0x20, - 0x20, - 0x20, - 0x00, - /* right arrow */ - 0x00, - 0x20, - 0x10, - 0xf8, - 0x10, - 0x20, - 0x00, - 0x00, - /* multiply */ - 0x00, - 0x88, - 0x50, - 0x20, - 0x50, - 0x88, - 0x00, - 0x00, - }; - - /* set up our font */ - dst = memregion("gfx1")->base(); - memcpy(dst, fontdata6x8, pdp1_fontdata_size); - - machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_state::pdp1_machine_stop),this)); - - m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::reader_callback),this)); - m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::puncher_callback),this)); - m_typewriter.tyo_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::tyo_callback),this)); - m_dpy_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::dpy_callback),this)); - m_tape_reader.timer->adjust(attotime::zero, 0, attotime::from_hz(2500)); - m_tape_reader.timer->enable(0); -} - - -/* - perforated tape handling -*/ - -class pdp1_readtape_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - pdp1_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 0; } - virtual bool is_creatable() const { return 0; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "tap,rim"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type PDP1_READTAPE = &device_creator; - -pdp1_readtape_image_device::pdp1_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PDP1_READTAPE, "PDP1 Tape Reader", tag, owner, clock, "pdp1_readtape_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -class pdp1_punchtape_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - pdp1_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } - - virtual bool is_readable() const { return 0; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "tap,rim"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type PDP1_PUNCHTAPE = &device_creator; - -pdp1_punchtape_image_device::pdp1_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PDP1_PUNCHTAPE, "PDP1 Tape Puncher", tag, owner, clock, "pdp1_punchtape_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - - -class pdp1_printer_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - pdp1_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_PRINTER; } - - virtual bool is_readable() const { return 0; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "typ"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type PDP1_PRINTER = &device_creator; - -pdp1_printer_image_device::pdp1_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PDP1_PRINTER, "PDP1 Typewriter", tag, owner, clock, "pdp1_printer_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -class pdp1_cylinder_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - pdp1_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_CYLINDER; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "drm"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type PDP1_CYLINDER = &device_creator; - -pdp1_cylinder_image_device::pdp1_cylinder_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PDP1_CYLINDER, "PDP1 Cylinder", tag, owner, clock, "pdp1_cylinder_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -/* - Open a perforated tape image -*/ -bool pdp1_readtape_image_device::call_load() -{ - pdp1_state *state = machine().driver_data(); - - /* reader unit */ - state->m_tape_reader.fd = this; - - /* start motor */ - state->m_tape_reader.motor_on = 1; - - /* restart reader IO when necessary */ - /* note that this function may be called before pdp1_init_machine, therefore - before state->m_tape_reader.timer is allocated. It does not matter, as the clutch is never - down at power-up, but we must not call timer_enable with a NULL parameter! */ - - if (state->m_tape_reader.timer) - { - if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl) - { - state->m_tape_reader.timer->enable(1); - } - else - { - state->m_tape_reader.timer->enable(0); - } - } - - return IMAGE_INIT_PASS; -} - -void pdp1_readtape_image_device::call_unload() -{ - pdp1_state *state = machine().driver_data(); - - /* reader unit */ - state->m_tape_reader.fd = NULL; - - /* stop motor */ - state->m_tape_reader.motor_on = 0; - - if (state->m_tape_reader.timer) - state->m_tape_reader.timer->enable(0); -} - -/* - Read a byte from perforated tape -*/ -int pdp1_state::tape_read(UINT8 *reply) -{ - if (m_tape_reader.fd && (m_tape_reader.fd->fread(reply, 1) == 1)) - return 0; /* unit OK */ - else - return 1; /* unit not ready */ -} - - -/* - common code for tape read commands (RPA, RPB, and read-in mode) -*/ -void pdp1_state::begin_tape_read( int binary, int nac) -{ - m_tape_reader.rb = 0; - m_tape_reader.rcl = 1; - m_tape_reader.rc = (binary) ? 1 : 3; - m_tape_reader.rby = (binary) ? 1 : 0; - m_tape_reader.rcp = nac; - - if (LOG_IOT_OVERLAP) - { - if (m_tape_reader.timer->enable(0)) - logerror("Error: overlapped perforated tape reads (Read-in mode, RPA/RPB instruction)\n"); - } - /* set up delay if tape is advancing */ - if (m_tape_reader.motor_on && m_tape_reader.rcl) - { - /* delay is approximately 1/400s */ - m_tape_reader.timer->enable(1); - } - else - { - m_tape_reader.timer->enable(0); - } -} - -/* - timer callback to simulate reader IO -*/ -TIMER_CALLBACK_MEMBER(pdp1_state::reader_callback) -{ - int not_ready; - UINT8 data; - - if (m_tape_reader.rc) - { - not_ready = tape_read(& data); - if (not_ready) - { - m_tape_reader.motor_on = 0; /* let us stop the motor */ - } - else - { - if ((! m_tape_reader.rby) || (data & 0200)) - { - m_tape_reader.rb |= (m_tape_reader.rby) ? (data & 077) : data; - - if (m_tape_reader.rc != 3) - { - m_tape_reader.rb <<= 6; - } - - m_tape_reader.rc = (m_tape_reader.rc+1) & 3; - - if (m_tape_reader.rc == 0) - { /* IO complete */ - m_tape_reader.rcl = 0; - if (m_tape_reader.rcp) - { - m_maincpu->set_state_int(PDP1_IO, m_tape_reader.rb); /* transfer reader buffer to IO */ - m_maincpu->set_state_int(PDP1_IOS,1); - } - else - m_io_status |= io_st_ptr; - } - } - } - } - - if (m_tape_reader.motor_on && m_tape_reader.rcl) - { - m_tape_reader.timer->enable(1); - } - else - { - m_tape_reader.timer->enable(0); - } -} - -/* - Initiate read of a 18-bit word in binary format from tape (used in read-in mode) -*/ -void pdp1_tape_read_binary(device_t *device) -{ - pdp1_state *state = device->machine().driver_data(); - state->begin_tape_read(1, 1); -} - -/* - perforated tape reader iot callbacks -*/ - -/* - rpa iot callback - - op2: iot command operation (equivalent to mb & 077) - nac: nead a completion pulse - mb: contents of the MB register - io: pointer on the IO register - ac: contents of the AC register -*/ -/* - * Read Perforated Tape, Alphanumeric - * rpa Address 0001 - * - * This instruction reads one line of tape (all eight Channels) and transfers the resulting 8-bit code to - * the Reader Buffer. If bits 5 and 6 of the rpa function are both zero (720001), the contents of the - * Reader Buffer must be transferred to the IO Register by executing the rrb instruction. When the Reader - * Buffer has information ready to be transferred to the IO Register, Status Register Bit 1 is set to - * one. If bits 5 and 6 are different (730001 or 724001) the 8-bit code read from tape is automatically - * transferred to the IO Register via the Reader Buffer and appears as follows: - * - * IO Bits 10 11 12 13 14 15 16 17 - * TAPE CHANNELS 8 7 6 5 4 3 2 1 - */ -static void iot_rpa(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - if (LOG_IOT_EXTRA) - logerror("Warning, RPA instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - - state->begin_tape_read(0, nac); -} - -/* - rpb iot callback -*/ -/* - * Read Perforated Tape, Binary rpb - * Address 0002 - * - * The instruction reads three lines of tape (six Channels per line) and assembles - * the resulting 18-bit word in the Reader Buffer. For a line to be recognized by - * this instruction Channel 8 must be punched (lines with Channel 8 not punched will - * be skipped over). Channel 7 is ignored. The instruction sub 5137, for example, - * appears on tape and is assembled by rpb as follows: - * - * Channel 8 7 6 5 4 | 3 2 1 - * Line 1 X X | X - * Line 2 X X X | X - * Line 3 X X X | X X X - * Reader Buffer 100 010 101 001 011 111 - * - * (Vertical dashed line indicates sprocket holes and the symbols "X" indicate holes - * punched in tape). - * - * If bits 5 and 6 of the rpb instruction are both zero (720002), the contents of - * the Reader Buffer must be transferred to the IO Register by executing - * a rrb instruction. When the Reader Buffer has information ready to be transferred - * to the IO Register, Status Register Bit 1 is set to one. If bits 5 and 6 are - * different (730002 or 724002) the 18-bit word read from tape is automatically - * transferred to the IO Register via the Reader Buffer. - */ -static void iot_rpb(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - if (LOG_IOT_EXTRA) - logerror("Warning, RPB instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - - state->begin_tape_read(1, nac); -} - -/* - rrb iot callback -*/ -static void iot_rrb(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - if (LOG_IOT_EXTRA) - logerror("RRB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - - *io = state->m_tape_reader.rb; - state->m_io_status &= ~io_st_ptr; -} - - -bool pdp1_punchtape_image_device::call_load() -{ - pdp1_state *state = machine().driver_data(); - - /* punch unit */ - state->m_tape_puncher.fd = this; - - return IMAGE_INIT_PASS; -} - -void pdp1_punchtape_image_device::call_unload() -{ - pdp1_state *state = machine().driver_data(); - - /* punch unit */ - state->m_tape_puncher.fd = NULL; -} - -/* - Write a byte to perforated tape -*/ -void pdp1_state::tape_write(UINT8 data) -{ - if (m_tape_puncher.fd) - m_tape_puncher.fd->fwrite(& data, 1); -} - -/* - timer callback to generate punch completion pulse -*/ -TIMER_CALLBACK_MEMBER(pdp1_state::puncher_callback) -{ - int nac = param; - m_io_status |= io_st_ptp; - if (nac) - { - m_maincpu->set_state_int(PDP1_IOS,1); - } -} - -/* - perforated tape punch iot callbacks -*/ - -/* - ppa iot callback -*/ -/* - * Punch Perforated Tape, Alphanumeric - * ppa Address 0005 - * - * For each In-Out Transfer instruction one line of tape is punched. In-Out Register - * Bit 17 conditions Hole 1. Bit 16 conditions Hole 2, etc. Bit 10 conditions Hole 8 - */ -static void iot_ppa(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - if (LOG_IOT_EXTRA) - logerror("PPA instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - - state->tape_write(*io & 0377); - state->m_io_status &= ~io_st_ptp; - /* delay is approximately 1/63.3 second */ - if (LOG_IOT_OVERLAP) - { - if (state->m_tape_puncher.timer->enable(0)) - logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - } - - state->m_tape_puncher.timer->adjust(attotime::from_usec(15800), nac); -} - -/* - ppb iot callback -*/ -/* - * Punch Perforated Tape, Binary - * ppb Addres 0006 - * - * For each In-Out Transfer instruction one line of tape is punched. In-Out Register - * Bit 5 conditions Hole 1. Bit 4 conditions Hole 2, etc. Bit 0 conditions Hole 6. - * Hole 7 is left blank. Hole 8 is always punched in this mode. - */ -static void iot_ppb(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - if (LOG_IOT_EXTRA) - logerror("PPB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - - state->tape_write((*io >> 12) | 0200); - state->m_io_status &= ~io_st_ptp; - /* delay is approximately 1/63.3 second */ - if (LOG_IOT_OVERLAP) - { - if (state->m_tape_puncher.timer->enable(0)) - logerror("Error: overlapped PPA/PPB instructions: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - } - state->m_tape_puncher.timer->adjust(attotime::from_usec(15800), nac); -} - - -/* - Typewriter handling - - The alphanumeric on-line typewriter is a standard device on pdp-1: it - can both handle keyboard input and print output text. -*/ - -/* - Open a file for typewriter output -*/ -bool pdp1_printer_image_device::call_load() -{ - pdp1_state *state = machine().driver_data(); - /* open file */ - state->m_typewriter.fd = this; - - state->m_io_status |= io_st_tyo; - - return IMAGE_INIT_PASS; -} - -void pdp1_printer_image_device::call_unload() -{ - pdp1_state *state = machine().driver_data(); - state->m_typewriter.fd = NULL; -} - -/* - Write a character to typewriter -*/ -void pdp1_state::typewriter_out(UINT8 data) -{ - if (LOG_IOT_EXTRA) - logerror("typewriter output %o\n", data); - - pdp1_typewriter_drawchar(data); - if (m_typewriter.fd) -#if 1 - m_typewriter.fd->fwrite(& data, 1); -#else - { - static const char ascii_table[2][64] = - { /* n-s = non-spacing */ - { /* lower case */ - ' ', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', '*', '*', - '*', '*', '*', '*', - '0', '/', 's', 't', - 'u', 'v', 'w', 'x', - 'y', 'z', '*', ',', - '*',/*black*/ '*',/*red*/ '*',/*Tab*/ '*', - '\200',/*n-s middle dot*/'j', 'k', 'l', - 'm', 'n', 'o', 'p', - 'q', 'r', '*', '*', - '-', ')', '\201',/*n-s overstrike*/'(', - '*', 'a', 'b', 'c', - 'd', 'e', 'f', 'g', - 'h', 'i', '*',/*Lower Case*/ '.', - '*',/*Upper Case*/ '*',/*Backspace*/ '*', '*'/*Carriage Return*/ - }, - { /* upper case */ - ' ', '"', '\'', '~', - '\202',/*implies*/ '\203',/*or*/ '\204',/*and*/ '<', - '>', '\205',/*up arrow*/ '*', '*', - '*', '*', '*', '*', - '\206',/*right arrow*/'?', 'S', 'T', - 'U', 'V', 'W', 'X', - 'Y', 'Z', '*', '=', - '*',/*black*/ '*',/*red*/ '\t',/*Tab*/ '*', - '_',/*n-s???*/ 'J', 'K', 'L', - 'M', 'N', 'O', 'P', - 'Q', 'R', '*', '*', - '+', ']', '|',/*n-s???*/ '[', - '*', 'A', 'B', 'C', - 'D', 'E', 'F', 'G', - 'H', 'I', '*',/*Lower Case*/ '\207',/*multiply*/ - '*',/*Upper Case*/ '\b',/*Backspace*/ '*', '*'/*Carriage Return*/ - } - }; - - data &= 0x3f; - - switch (data) - { - case 034: - /* Black: ignore */ - //color = color_typewriter_black; - { - static const char black[5] = { '\033', '[', '3', '0', 'm' }; - image_fwrite(m_typewriter.fd, black, sizeof(black)); - } - break; - - case 035: - /* Red: ignore */ - //color = color_typewriter_red; - { - static const char red[5] = { '\033', '[', '3', '1', 'm' }; - image_fwrite(m_typewriter.fd, red, sizeof(red)); - } - break; - - case 072: - /* Lower case */ - m_case_shift = 0; - break; - - case 074: - /* Upper case */ - m_case_shift = 1; - break; - - case 077: - /* Carriage Return */ - { - static const char line_end[2] = { '\r', '\n' }; - image_fwrite(m_typewriter.fd, line_end, sizeof(line_end)); - } - break; - - default: - /* Any printable character... */ - - if ((data != 040) && (data != 056)) /* 040 and 056 are non-spacing characters: don't try to print right now */ - /* print character (lookup ASCII equivalent in table) */ - image_fwrite(m_typewriter.fd, & ascii_table[m_case_shift][data], 1); - - break; - } - } -#endif -} - -/* - timer callback to generate typewriter completion pulse -*/ -TIMER_CALLBACK_MEMBER(pdp1_state::tyo_callback) -{ - int nac = param; - m_io_status |= io_st_tyo; - if (nac) - { - m_maincpu->set_state_int(PDP1_IOS,1); - } -} - -/* - tyo iot callback -*/ -static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - int ch, delay; - - if (LOG_IOT_EXTRA) - logerror("Warning, TYO instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - - ch = (*io) & 077; - - state->typewriter_out(ch); - state->m_io_status &= ~io_st_tyo; - - /* compute completion delay (source: maintenance manual 9-12, 9-13 and 9-14) */ - switch (ch) - { - case 072: /* lower-case */ - case 074: /* upper-case */ - case 034: /* black */ - case 035: /* red */ - delay = 175; /* approximately 175ms (?) */ - break; - - case 077: /* carriage return */ - delay = 205; /* approximately 205ms (?) */ - break; - - default: - delay = 105; /* approximately 105ms */ - break; - } - if (LOG_IOT_OVERLAP) - { - if (state->m_typewriter.tyo_timer->enable(0)) - logerror("Error: overlapped TYO instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - } - - state->m_typewriter.tyo_timer->adjust(attotime::from_msec(delay), nac); -} - -/* - tyi iot callback -*/ -/* When a typewriter key is struck, the code for the struck key is placed in the - * typewriter buffer, Program Flag 1 is set, and the type-in status bit is set to - * one. A program designed to accept typed-in data would periodically check - * Program Flag 1, and if found to be set, an In-Out Transfer Instruction with - * address 4 could be executed for the information to be transferred to the - * In-Out Register. This In-Out Transfer should not use the optional in-out wait. - * The information contained in the typewriter buffer is then transferred to the - * right six bits of the In-Out Register. The tyi instruction automatically - * clears the In-Out Register before transferring the information and also clears - * the type-in status bit. - */ -static void iot_tyi(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - if (LOG_IOT_EXTRA) - logerror("Warning, TYI instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - - *io = state->m_typewriter.tb; - if (! (state->m_io_status & io_st_tyi)) - *io |= 0100; - else - { - state->m_io_status &= ~io_st_tyi; - if (USE_SBS) - state->m_maincpu->set_input_line_and_vector(0, CLEAR_LINE, 0); /* interrupt it, baby */ - } -} - - -/* - * PRECISION CRT DISPLAY (TYPE 30) - * - * This sixteen-inch cathode ray tube display is intended to be used as an on-line output device for the - * PDP-1. It is useful for high speed presentation of graphs, diagrams, drawings, and alphanumerical - * information. The unit is solid state, self-powered and completely buffered. It has magnetic focus and - * deflection. - * - * Display characteristics are as follows: - * - * Random point plotting - * Accuracy of points +/-3 per cent of raster size - * Raster size 9.25 by 9.25 inches - * 1024 by 1024 addressable locations - * Fixed origin at center of CRT - * Ones complement binary arithmetic - * Plots 20,000 points per second - * - * Resolution is such that 512 points along each axis are discernable on the face of the tube. - * - * One instruction is added to the PDP-1 with the installation of this display: - * - * Display One Point On CRT - * dpy Address 0007 - * - * This instruction clears the light pen status bit and displays one point using bits 0 through 9 of the - * AC to represent the (signed) X coordinate of the point and bits 0 through 9 of the IO as the (signed) - * Y coordinate. - * - * Many variations of the Type 30 Display are available. Some of these include hardware for line and - * curve generation. - */ - - -/* - timer callback to generate crt completion pulse -*/ -TIMER_CALLBACK_MEMBER(pdp1_state::dpy_callback) -{ - m_maincpu->set_state_int(PDP1_IOS,1); -} - - -/* - dpy iot callback - - Light on one pixel on CRT -*/ -static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - int x; - int y; - - - x = ((ac+0400000) & 0777777) >> 8; - y = (((*io)+0400000) & 0777777) >> 8; - state->pdp1_plot(x, y); - - /* light pen 32 support */ - state->m_io_status &= ~io_st_pen; - - if (state->m_lightpen.down && ((x-state->m_lightpen.x)*(x-state->m_lightpen.x)+(y-state->m_lightpen.y)*(y-state->m_lightpen.y) < state->m_lightpen.radius*state->m_lightpen.radius)) - { - state->m_io_status |= io_st_pen; - - state->m_maincpu->set_state_int(PDP1_PF3, 1); - } - - if (nac) - { - /* 50us delay */ - if (LOG_IOT_OVERLAP) - { - /* note that overlap detection is incomplete: it will only work if both DPY - instructions require a completion pulse */ - if (state->m_dpy_timer->enable(0)) - logerror("Error: overlapped DPY instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - } - state->m_dpy_timer->adjust(attotime::from_usec(50)); - } -} - - - -/* - MIT parallel drum (variant of type 23) -*/ - -void pdp1_state::parallel_drum_set_il(int il) -{ - attotime il_phase; - - m_parallel_drum.il = il; - - il_phase = ((PARALLEL_DRUM_WORD_TIME * il) - m_parallel_drum.rotation_timer->elapsed()); - if (il_phase < attotime::zero) - il_phase = il_phase + PARALLEL_DRUM_ROTATION_TIME; - m_parallel_drum.il_timer->adjust(il_phase, 0, PARALLEL_DRUM_ROTATION_TIME); -} - -#ifdef UNUSED_FUNCTION -TIMER_CALLBACK_MEMBER(pdp1_state::il_timer_callback) -{ - if (m_parallel_drum.dba) - { - /* set break request and status bit 5 */ - /* ... */ - } -} - -void pdp1_state::parallel_drum_init(pdp1_state *state) -{ - m_parallel_drum.rotation_timer = machine().scheduler().timer_alloc(); - m_parallel_drum.rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME); - - m_parallel_drum.il_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::il_timer_callback),this)); - parallel_drum_set_il(0); -} -#endif - -/* - Open a file for drum -*/ -bool pdp1_cylinder_image_device::call_load() -{ - pdp1_state *state = machine().driver_data(); - /* open file */ - state->m_parallel_drum.fd = this; - - return IMAGE_INIT_PASS; -} - -void pdp1_cylinder_image_device::call_unload() -{ - pdp1_state *state = machine().driver_data(); - state->m_parallel_drum.fd = NULL; -} - -static void iot_dia(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - state->m_parallel_drum.wfb = ((*io) & 0370000) >> 12; - state->parallel_drum_set_il((*io) & 0007777); - - state->m_parallel_drum.dba = 0; /* right? */ -} - -static void iot_dba(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - state->m_parallel_drum.wfb = ((*io) & 0370000) >> 12; - state->parallel_drum_set_il((*io) & 0007777); - - state->m_parallel_drum.dba = 1; -} - -/* - Read a word from drum -*/ -UINT32 pdp1_state::drum_read(int field, int position) -{ - int offset = (field*4096+position)*3; - UINT8 buf[3]; - - if (m_parallel_drum.fd && (!m_parallel_drum.fd->fseek(offset, SEEK_SET)) && (m_parallel_drum.fd->fread( buf, 3) == 3)) - return ((buf[0] << 16) | (buf[1] << 8) | buf[2]) & 0777777; - - return 0; -} - -/* - Write a word to drum -*/ -void pdp1_state::drum_write(int field, int position, UINT32 data) -{ - int offset = (field*4096+position)*3; - UINT8 buf[3]; - - if (m_parallel_drum.fd) - { - buf[0] = data >> 16; - buf[1] = data >> 8; - buf[2] = data; - - m_parallel_drum.fd->fseek(offset, SEEK_SET); - m_parallel_drum.fd->fwrite( buf, 3); - } -} - -static void iot_dcc(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - attotime delay; - int dc; - - state->m_parallel_drum.rfb = ((*io) & 0370000) >> 12; - state->m_parallel_drum.wc = - ((*io) & 0007777); - - state->m_parallel_drum.wcl = ac & 0177777/*0007777???*/; - - state->m_parallel_drum.dba = 0; /* right? */ - /* clear status bit 5... */ - - /* do transfer */ - delay = state->m_parallel_drum.il_timer->remaining(); - dc = state->m_parallel_drum.il; - do - { - if ((state->m_parallel_drum.wfb >= 1) && (state->m_parallel_drum.wfb <= 22)) - { - state->drum_write(state->m_parallel_drum.wfb-1, dc, (signed)state->m_maincpu->space(AS_PROGRAM).read_dword(state->m_parallel_drum.wcl<<2)); - } - - if ((state->m_parallel_drum.rfb >= 1) && (state->m_parallel_drum.rfb <= 22)) - { - state->m_maincpu->space(AS_PROGRAM).write_dword(state->m_parallel_drum.wcl<<2, state->drum_read(state->m_parallel_drum.rfb-1, dc)); - } - - state->m_parallel_drum.wc = (state->m_parallel_drum.wc+1) & 07777; - state->m_parallel_drum.wcl = (state->m_parallel_drum.wcl+1) & 0177777/*0007777???*/; - dc = (dc+1) & 07777; - if (state->m_parallel_drum.wc) - delay = delay + PARALLEL_DRUM_WORD_TIME; - } while (state->m_parallel_drum.wc); - state->m_maincpu->adjust_icount(-state->m_maincpu->attotime_to_cycles(delay)); - /* if no error, skip */ - state->m_maincpu->set_state_int(PDP1_PC, state->m_maincpu->state_int(PDP1_PC)+1); -} - -static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - (*io) = (state->m_parallel_drum.rotation_timer->elapsed() * - (ATTOSECONDS_PER_SECOND / (PARALLEL_DRUM_WORD_TIME.as_attoseconds()))).seconds() & 0007777; - - /* set parity error and timing error... */ -} - - - -/* - iot 11 callback - - Read state of Spacewar! controllers - - Not documented, except a few comments in the Spacewar! source code: - it should leave the control word in the io as follows. - high order 4 bits, rotate ccw, rotate cw, (both mean hyperspace) - fire rocket, and fire torpedo. low order 4 bits, same for - other ship. routine is entered by jsp cwg. -*/ -static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - int key_state = device->machine().driver_data()->read_spacewar(); - int reply; - - - reply = 0; - - if (key_state & ROTATE_RIGHT_PLAYER2) - reply |= 0400000; - if (key_state & ROTATE_LEFT_PLAYER2) - reply |= 0200000; - if (key_state & THRUST_PLAYER2) - reply |= 0100000; - if (key_state & FIRE_PLAYER2) - reply |= 0040000; - if (key_state & HSPACE_PLAYER2) - reply |= 0600000; - - if (key_state & ROTATE_RIGHT_PLAYER1) - reply |= 010; - if (key_state & ROTATE_LEFT_PLAYER1) - reply |= 004; - if (key_state & THRUST_PLAYER1) - reply |= 002; - if (key_state & FIRE_PLAYER1) - reply |= 001; - if (key_state & HSPACE_PLAYER1) - reply |= 014; - - *io = reply; -} - - -/* - cks iot callback - - check IO status -*/ -static void iot_cks(device_t *device, int op2, int nac, int mb, int *io, int ac) -{ - pdp1_state *state = device->machine().driver_data(); - if (LOG_IOT_EXTRA) - logerror("CKS instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - - *io = state->m_io_status; -} - - -/* - callback which is called when Start Clear is pulsed - - IO devices should reset -*/ -void pdp1_io_sc_callback(device_t *device) -{ - pdp1_state *state = device->machine().driver_data(); - state->m_tape_reader.rcl = state->m_tape_reader.rc = 0; - if (state->m_tape_reader.timer) - state->m_tape_reader.timer->enable(0); - - if (state->m_tape_puncher.timer) - state->m_tape_puncher.timer->enable(0); - - if (state->m_typewriter.tyo_timer) - state->m_typewriter.tyo_timer->enable(0); - - if (state->m_dpy_timer) - state->m_dpy_timer->enable(0); - - state->m_io_status = io_st_tyo | io_st_ptp; -} - - -/* - typewriter keyboard handler -*/ -void pdp1_state::pdp1_keyboard() -{ - int i; - int j; - - int typewriter_keys[4]; - - int typewriter_transitions; - - - for (i=0; i<4; i++) - { - typewriter_keys[i] = m_twr[i]->read(); - } - - for (i=0; i<4; i++) - { - typewriter_transitions = typewriter_keys[i] & (~ m_old_typewriter_keys[i]); - if (typewriter_transitions) - { - for (j=0; (((typewriter_transitions >> j) & 1) == 0) /*&& (j<16)*/; j++) - ; - m_typewriter.tb = (i << 4) + j; - m_io_status |= io_st_tyi; - #if USE_SBS - m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0); /* interrupt it, baby */ - #endif - m_maincpu->set_state_int(PDP1_PF1, 1); - pdp1_typewriter_drawchar(m_typewriter.tb); /* we want to echo input */ - break; - } - } - - for (i=0; i<4; i++) - m_old_typewriter_keys[i] = typewriter_keys[i]; -} - -void pdp1_state::pdp1_lightpen() -{ - int x_delta, y_delta; - int current_state = m_io_lightpen->read(); - - m_lightpen.active = (m_cfg->read() >> pdp1_config_lightpen_bit) & pdp1_config_lightpen_mask; - - /* update pen down state */ - m_lightpen.down = m_lightpen.active && (current_state & pdp1_lightpen_down); - - /* update size of pen tip hole */ - if ((current_state & ~m_old_lightpen) & pdp1_lightpen_smaller) - { - m_lightpen.radius --; - if (m_lightpen.radius < 0) - m_lightpen.radius = 0; - } - if ((current_state & ~m_old_lightpen) & pdp1_lightpen_larger) - { - m_lightpen.radius ++; - if (m_lightpen.radius > 32) - m_lightpen.radius = 32; - } - - m_old_lightpen = current_state; - - /* update pen position */ - x_delta = m_lightx->read(); - y_delta = m_lighty->read(); - - if (x_delta >= 0x80) - x_delta -= 0x100; - if (y_delta >= 0x80) - y_delta -= 256; - - m_lightpen.x += x_delta; - m_lightpen.y += y_delta; - - if (m_lightpen.x < 0) - m_lightpen.x = 0; - if (m_lightpen.x > 1023) - m_lightpen.x = 1023; - if (m_lightpen.y < 0) - m_lightpen.y = 0; - if (m_lightpen.y > 1023) - m_lightpen.y = 1023; - - pdp1_update_lightpen_state(&m_lightpen); -} - -/* - Not a real interrupt - just handle keyboard input -*/ -INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) -{ - int control_keys; - int tw_keys; - int ta_keys; - - int control_transitions; - int tw_transitions; - int ta_transitions; - - - m_maincpu->set_state_int(PDP1_SS, m_sense->read()); - - /* read new state of control keys */ - control_keys = m_csw->read(); - - if (control_keys & pdp1_control) - { - /* compute transitions */ - control_transitions = control_keys & (~ m_old_control_keys); - - if (control_transitions & pdp1_extend) - { - m_maincpu->set_state_int(PDP1_EXTEND_SW, ! m_maincpu->state_int(PDP1_EXTEND_SW)); - } - if (control_transitions & pdp1_start_nobrk) - { - m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ - m_maincpu->set_state_int(PDP1_EXD, m_maincpu->state_int(PDP1_EXTEND_SW)); - m_maincpu->set_state_int(PDP1_SBM, (UINT64)0); - m_maincpu->set_state_int(PDP1_OV, (UINT64)0); - m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_TA)); - m_maincpu->set_state_int(PDP1_RUN, 1); - } - if (control_transitions & pdp1_start_brk) - { - m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ - m_maincpu->set_state_int(PDP1_EXD, m_maincpu->state_int(PDP1_EXTEND_SW)); - m_maincpu->set_state_int(PDP1_SBM, 1); - m_maincpu->set_state_int(PDP1_OV, (UINT64)0); - m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_TA)); - m_maincpu->set_state_int(PDP1_RUN, 1); - } - if (control_transitions & pdp1_stop) - { - m_maincpu->set_state_int(PDP1_RUN, (UINT64)0); - m_maincpu->set_state_int(PDP1_RIM, (UINT64)0); /* bug : we stop after reading an even-numbered word - (i.e. data), whereas a real pdp-1 stops after reading - an odd-numbered word (i.e. dio instruciton) */ - } - if (control_transitions & pdp1_continue) - { - m_maincpu->set_state_int(PDP1_RUN, 1); - } - if (control_transitions & pdp1_examine) - { - m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ - m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_TA)); - m_maincpu->set_state_int(PDP1_MA, m_maincpu->state_int(PDP1_PC)); - m_maincpu->set_state_int(PDP1_IR, LAC); /* this instruction is actually executed */ - - m_maincpu->set_state_int(PDP1_MB, (signed)m_maincpu->space(AS_PROGRAM).read_dword(PDP1_MA<<2)); - m_maincpu->set_state_int(PDP1_AC, m_maincpu->state_int(PDP1_MB)); - } - if (control_transitions & pdp1_deposit) - { - m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ - m_maincpu->set_state_int(PDP1_PC, m_maincpu->state_int(PDP1_TA)); - m_maincpu->set_state_int(PDP1_MA, m_maincpu->state_int(PDP1_PC)); - m_maincpu->set_state_int(PDP1_AC, m_maincpu->state_int(PDP1_TW)); - m_maincpu->set_state_int(PDP1_IR, DAC); /* this instruction is actually executed */ - - m_maincpu->set_state_int(PDP1_MB, m_maincpu->state_int(PDP1_AC)); - m_maincpu->space(AS_PROGRAM).write_dword(m_maincpu->state_int(PDP1_MA)<<2, m_maincpu->state_int(PDP1_MB)); - } - if (control_transitions & pdp1_read_in) - { /* set cpu to read instructions from perforated tape */ - m_maincpu->pulse_start_clear(); /* pulse Start Clear line */ - m_maincpu->set_state_int(PDP1_PC, ( m_maincpu->state_int(PDP1_TA) & 0170000) - | (m_maincpu->state_int(PDP1_PC) & 0007777)); /* transfer ETA to EPC */ - /*m_maincpu->set_state_int(PDP1_MA, m_maincpu->state_int(PDP1_PC));*/ - m_maincpu->set_state_int(PDP1_EXD, m_maincpu->state_int(PDP1_EXTEND_SW)); - m_maincpu->set_state_int(PDP1_OV, (UINT64)0); /* right??? */ - m_maincpu->set_state_int(PDP1_RUN, (UINT64)0); - m_maincpu->set_state_int(PDP1_RIM, 1); - } - if (control_transitions & pdp1_reader) - { - } - if (control_transitions & pdp1_tape_feed) - { - } - if (control_transitions & pdp1_single_step) - { - m_maincpu->set_state_int(PDP1_SNGL_STEP, ! m_maincpu->state_int(PDP1_SNGL_STEP)); - } - if (control_transitions & pdp1_single_inst) - { - m_maincpu->set_state_int(PDP1_SNGL_INST, ! m_maincpu->state_int(PDP1_SNGL_INST)); - } - - /* remember new state of control keys */ - m_old_control_keys = control_keys; - - - /* handle test word keys */ - tw_keys = (m_twdmsb->read() << 16) | m_twdlsb->read(); - - /* compute transitions */ - tw_transitions = tw_keys & (~ m_old_tw_keys); - - if (tw_transitions) - m_maincpu->set_state_int(PDP1_TW, m_maincpu->state_int(PDP1_TW) ^ tw_transitions); - - /* remember new state of test word keys */ - m_old_tw_keys = tw_keys; - - - /* handle address keys */ - ta_keys = m_tstadd->read(); - - /* compute transitions */ - ta_transitions = ta_keys & (~ m_old_ta_keys); - - if (ta_transitions) - m_maincpu->set_state_int(PDP1_TA, m_maincpu->state_int(PDP1_TA) ^ ta_transitions); - - /* remember new state of test word keys */ - m_old_ta_keys = ta_keys; - - } - else - { - m_old_control_keys = 0; - m_old_tw_keys = 0; - m_old_ta_keys = 0; - - pdp1_keyboard(); - } - - pdp1_lightpen(); -} - - -static MACHINE_CONFIG_START( pdp1, pdp1_state ) - - /* basic machine hardware */ - /* PDP1 CPU @ 200 kHz (no master clock, but the instruction and memory rate is 200 kHz) */ - MCFG_CPU_ADD("maincpu", PDP1, 1000000/*the CPU core uses microsecond counts*/) - MCFG_CPU_CONFIG(pdp1_reset_param) - MCFG_CPU_PROGRAM_MAP(pdp1_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pdp1_state, pdp1_interrupt) /* dummy interrupt: handles input */ - - /* video hardware (includes the control panel and typewriter output) */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(refresh_rate) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(virtual_width, virtual_height) - MCFG_SCREEN_VISIBLE_AREA(0, virtual_width-1, 0, virtual_height-1) - MCFG_SCREEN_UPDATE_DRIVER(pdp1_state, screen_update_pdp1) - MCFG_SCREEN_VBLANK_DRIVER(pdp1_state, screen_eof_pdp1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEVICE_ADD("crt", CRT, 0) - MCFG_CRT_NUM_LEVELS(pen_crt_num_levels) - MCFG_CRT_OFFSETS(crt_window_offset_x, crt_window_offset_y) - MCFG_CRT_SIZE(crt_window_width, crt_window_height) - - MCFG_DEVICE_ADD("readt", PDP1_READTAPE, 0) - MCFG_DEVICE_ADD("punch", PDP1_PUNCHTAPE, 0) - MCFG_DEVICE_ADD("typewriter", PDP1_PRINTER, 0) - MCFG_DEVICE_ADD("drum", PDP1_CYLINDER, 0) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pdp1) - MCFG_PALETTE_ADD("palette", total_colors_needed + sizeof(pdp1_palette)) - MCFG_PALETTE_INDIRECT_ENTRIES(total_colors_needed) - MCFG_PALETTE_INIT_OWNER(pdp1_state, pdp1) -MACHINE_CONFIG_END - -/* - pdp1 can address up to 65336 18 bit words when extended (4096 otherwise). -*/ -ROM_START(pdp1) - ROM_REGION(pdp1_fontdata_size, "gfx1", ROMREGION_ERASEFF) - /* space filled with our font */ -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1961, pdp1, 0, 0, pdp1, pdp1, driver_device, 0, "Digital Equipment Corporation", "PDP-1" , MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/pdp11.c b/src/mess/drivers/pdp11.c deleted file mode 100644 index 8aa53ba3f47..00000000000 --- a/src/mess/drivers/pdp11.c +++ /dev/null @@ -1,470 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - PDP-11 - - Unibus models - ================== - PDP-11/20 and PDP-11/15 ? The original, non-microprogrammed processor; - designed by Jim O'Loughlin. Floating point was supported by - peripheral options using various data formats. - PDP-11/35 and PDP-11/40 ? A microprogrammed successor to the PDP-11/20; - the design team was led by Jim O'Loughlin. - PDP-11/45, PDP-11/50, and PDP-11/55 ? A much faster microprogrammed processor - that could use up to 256 kB of semiconductor memory instead of or in - addition to core memory. First model to support an optional FP11 - floating-point coprocessor, which established the format used in - later models. - PDP-11/70 ? The 11/45 architecture expanded to allow 4 MB of physical memory - segregated onto a private memory bus, 2 kB of cache memory, and much - faster I/O devices connected via the Massbus.[9] - PDP-11/05 and PDP-11/10 ? A cost-reduced successor to the PDP-11/20. - PDP-11/34 and PDP-11/04 ? Cost-reduced follow-on products to the 11/35 - and 11/05; the PDP-11/34 concept was created by Bob Armstrong. - The 11/34 supported up to 256 kB of Unibus memory. The PDP-11/34a - supported a fast floating-point option, and the 11/34c supported a - cache memory option. - PDP-11/60 ? A PDP-11 with user-writable microcontrol store; this was - designed by another team led by Jim O'Loughlin. - PDP-11/44 ? Replacement for the 11/45 and 11/70 that supported optional cache - memory and floating-point processor, and included a sophisticated serial - console interface and support for 4 MB of physical memory. The design - team was managed by John Sofio. - PDP-11/24 ? First VLSI PDP-11 for Unibus, using the "Fonz-11" (F11) chip set - with a Unibus adapter. - PDP-11/84 ? Using the VLSI "Jaws-11" (J11) chip set with a Unibus adapter. - PDP-11/94 ? J11-based, faster than 11/84. - - Q-bus models - ============== - PDP-11/03 (also known as the LSI-11/03) ? The first LSI PDP-11, this system - used a chipset from Western Digital and supported 60 kB of memory. - PDP-11/23 ? Second generation of LSI (F-11). Early units supported - only 248 kB of memory. - PDP-11/23+/MicroPDP-11/23 ? Improved 11/23 with more functions on the - (larger) processor card. - MicroPDP-11/73 ? The third generation LSI-11, this system used the - faster "Jaws-11" (J-11) chip set and supported up to 4 MB of memory. - MicroPDP-11/53 ? Slower 11/73 with on-board memory. - MicroPDP-11/83 ? Faster 11/73 with PMI (private memory interconnect). - MicroPDP-11/93 ? Faster 11/83; final DEC Q-Bus PDP-11 model. - KXJ11 - QBUS card (M7616) with PDP-11 based peripheral processor and - DMA controller. Based on a J11 CPU equipped with 512 kB of RAM, - 64 kB of ROM, and parallel and serial interfaces. - Mentec M100 ? Mentec redesign of the 11/93, with J-11 chipset at 19.66 MHz, - four on-board serial ports, 1-4 MB of on-board memory, and optional FPU. - Mentec M11 ? Processor upgrade board; microcode implementation of PDP-11 - instruction set by Mentec, using the TI 8832 ALU and TI 8818 - microsequencer from Texas Instruments. - Mentec M1 ? Processor upgrade board; microcode implementation of - PDP-11 instruction set by Mentec, using Atmel 0.35 ?m ASIC.[10] - Quickware QED-993 ? High performance PDP-11/93 processor upgrade board. - DECserver 500 and 550 LAT terminal servers DSRVS-BA using the KDJ11-SB chipset - - All PDP-11's execept the first one (11/15 and 11/20) are microprogrammed. - - 23/02/2009 Skeleton driver. - - Memory Map (converted from the annoying octal format from the manuals): - 0x0000 - 0x00ff: irq vectors - 0xe000: ROM - 0xff68: "high speed reader and punch device status and buffer register" - 0xff70 - 0xff7e: "teletype keyboard and punch device status and buffer register" - PDP-11 internal registers: - 0xff80 - 0xffbf: "reserved for expansion of processor registers" - 0xffc0: R0 - 0xffc2: R1 - 0xffc4: R2 - 0xffc6: R3 - 0xffc8: R4 - 0xffca: R5 - 0xffcc: R6 / SP - 0xffce: R7 / PC - 0xfffe: PSW - - SMS-1000: - Claims to be 100% compatible with DEC PDP-11. Added as a skeleton. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/t11/t11.h" -#include "machine/terminal.h" -#include "machine/rx01.h" - -#define TERMINAL_TAG "terminal" - -class pdp11_state : public driver_device -{ -public: - pdp11_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ16_MEMBER( teletype_ctrl_r ); - DECLARE_WRITE16_MEMBER( teletype_ctrl_w ); - DECLARE_WRITE8_MEMBER( kbd_put ); - UINT8 m_teletype_data; - UINT16 m_teletype_status; - virtual void machine_reset(); - DECLARE_MACHINE_RESET(pdp11ub2); - DECLARE_MACHINE_RESET(pdp11qb); - void load9312prom(UINT8 *desc, UINT8 *src, int size); -}; - -READ16_MEMBER(pdp11_state::teletype_ctrl_r) -{ - UINT16 res = 0; - - switch(offset) - { - /* - keyboard - ---- x--- ---- ---- busy bit - ---- ---- x--- ---- ready bit (set on character receive, clear on buffer read) - ---- ---- -x-- ---- irq enable - ---- ---- ---- ---x reader enable (?) - */ - case 0: res = m_teletype_status; break; // reader status register (tks) - case 1: m_teletype_status &= ~0x80; res = m_teletype_data; break;// reader buffer register (tkb) - /* - printer - ---- ---- x--- ---- ready bit - ---- ---- -x-- ---- irq enable - ---- ---- ---- -x-- maintenance - */ - case 2: res = 0x80; break; // punch status register (tps) - case 3: res = 0; break; // punch buffer register (tpb) - } - - return res; -} - -WRITE16_MEMBER(pdp11_state::teletype_ctrl_w) -{ - switch(offset) - { - case 3: - m_terminal->write(space, 0, data); - break; - } -} - -static ADDRESS_MAP_START(pdp11_mem, AS_PROGRAM, 16, pdp11_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xdfff ) AM_RAM // RAM - AM_RANGE( 0xea00, 0xfeff ) AM_ROM - AM_RANGE( 0xff70, 0xff77 ) AM_READWRITE(teletype_ctrl_r,teletype_ctrl_w) - - AM_RANGE( 0xfe78, 0xfe7b ) AM_DEVREADWRITE("rx01", rx01_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pdp11qb_mem, AS_PROGRAM, 16, pdp11_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xe9ff ) AM_RAM // RAM - AM_RANGE( 0xea00, 0xefff ) AM_ROM - AM_RANGE( 0xf000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -#define M9312_PORT_CONFSETTING \ -PORT_CONFSETTING ( 0x00, "'DL' BOOT prom for RL11 controller") \ -PORT_CONFSETTING ( 0x01, "'DM' BOOT prom for RK06/07 controller") \ -PORT_CONFSETTING ( 0x02, "'DX' BOOT prom for RX01 compatible controller") \ -PORT_CONFSETTING ( 0x03, "'DP/DB' BOOT prom for RP02/03,RP04/5/6 RM02/3 controller") \ -PORT_CONFSETTING ( 0x04, "'DK/DT' BOOT prom for RK03/05,TU55/56 controllers") \ -PORT_CONFSETTING ( 0x05, "'MM' BOOT prom for TU16/E16 TM02/3 controllers") \ -PORT_CONFSETTING ( 0x06, "'MT' BOOT prom for TU10/TS03 controller") \ -PORT_CONFSETTING ( 0x07, "'DS' BOOT prom for RS03/RS04 controller") \ -PORT_CONFSETTING ( 0x08, "'PR/TT' BOOT prom for PC05,LO SPD RDR controllers") \ -PORT_CONFSETTING ( 0x09, "'CT' BOOT prom for TA11/TU60 controller") \ -PORT_CONFSETTING ( 0x0a, "'RS' BOOT prom for RS11, RS64 controller") \ -PORT_CONFSETTING ( 0x0b, "'CR' BOOT prom for CR11 card reader") \ -PORT_CONFSETTING ( 0x0c, "'MS' BOOT prom for TS11/TS04/TU80 compatible controller") \ -PORT_CONFSETTING ( 0x0d, "'DD' BOOT prom for TU58 DECtapeII serial tape controller") \ -PORT_CONFSETTING ( 0x0e, "'DU' BOOT prom for MSCP compatible controller") \ -PORT_CONFSETTING ( 0x0f, "'XX' Unknown 1/3") \ -PORT_CONFSETTING ( 0x10, "'XX' Unknown 2/3") \ -PORT_CONFSETTING ( 0x11, "'XX' Unknown 3/3") \ -PORT_CONFSETTING ( 0x12, "'DY' BOOT prom for RX02 compatible controller") \ -PORT_CONFSETTING ( 0x13, "'XM' DECNET 1/3 (DECnet DDCMP DMC11/DMR11)") \ -PORT_CONFSETTING ( 0x14, "'XM' DECNET 2/3 (DECnet DDCMP DMC11/DMR11)") \ -PORT_CONFSETTING ( 0x15, "'XM' DECNET 3/3 (DECnet DDCMP DMC11/DMR11)") \ -PORT_CONFSETTING ( 0x16, "'XU' DECNET 1/3 (DECnet DDCMP DU11)") \ -PORT_CONFSETTING ( 0x17, "'XU' DECNET 2/3 (DECnet DDCMP DU11)") \ -PORT_CONFSETTING ( 0x18, "'XU' DECNET 3/3 (DECnet DDCMP DU11)") \ -PORT_CONFSETTING ( 0x19, "'XW' DECNET 1/3 (DECnet DDCMP DUP11)") \ -PORT_CONFSETTING ( 0x1a, "'XW' DECNET 2/3 (DECnet DDCMP DUP11)") \ -PORT_CONFSETTING ( 0x1b, "'XW' DECNET 3/3 (DECnet DDCMP DUP11)") \ -PORT_CONFSETTING ( 0x1c, "'XL' DECNET 1/3 (DECnet DDCMP DL11-E)") \ -PORT_CONFSETTING ( 0x1d, "'XL' DECNET 2/3 (DECnet DDCMP DL11-E)") \ -PORT_CONFSETTING ( 0x1e, "'XL' DECNET 3/3 (DECnet DDCMP DL11-E)") \ -PORT_CONFSETTING ( 0x1f, "'XE' DEUNA DECnet Ethernet") \ -PORT_CONFSETTING ( 0x20, "'MU' TMSCP tapes, including TK50, TU81") -/* Input ports */ -static INPUT_PORTS_START( pdp11 ) - PORT_START("S1") - PORT_DIPNAME( 0x01, 0x01, "S1-1" ) - PORT_DIPSETTING( 0x00, "Direct boot" ) - PORT_DIPSETTING( 0x01, "Console mode" ) - PORT_DIPNAME( 0x02, 0x02, "S1-2 Boot") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_START("S1_2") - PORT_DIPNAME( 0x80, 0x00, "S1-3" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, "S1-4" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, "S1-5" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, "S1-6" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "S1-7" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "S1-8" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, "S1-9" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x01, 0x00, "S1-10" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_START( "CONSPROM" ) - PORT_CONFNAME ( 0x01, 0, "Console PROM" ) - PORT_CONFSETTING ( 0x00, "11/04/05/34/35/40/45/50/55" ) - PORT_CONFSETTING ( 0x01, "11/60-70" ) - PORT_START( "DEVPROM1" ) - PORT_CONFNAME ( 0x2f, 0x02, "Device 1 PROM" ) - M9312_PORT_CONFSETTING - PORT_START( "DEVPROM2" ) - PORT_CONFNAME ( 0x2f, 0x00, "Device 2 PROM" ) - M9312_PORT_CONFSETTING - PORT_START( "DEVPROM3" ) - PORT_CONFNAME ( 0x2f, 0x0d, "Device 3 PROM" ) - M9312_PORT_CONFSETTING - PORT_START( "DEVPROM4" ) - PORT_CONFNAME ( 0x2f, 0x04, "Device 4 PROM" ) - M9312_PORT_CONFSETTING -INPUT_PORTS_END - - -void pdp11_state::machine_reset() -{ - // Load M9301-YA - UINT8* user1 = memregion("user1")->base(); - UINT8* maincpu = memregion("maincpu")->base(); - int i; - - for(i=0;i<0x100;i++) { - UINT8 nib1 = user1[i+0x000] ^ 0x00; - UINT8 nib2 = user1[i+0x200] ^ 0x01; - UINT8 nib3 = user1[i+0x400] ^ 0x0f; - UINT8 nib4 = user1[i+0x600] ^ 0x0e; - - maincpu[0xea00 + i*2 + 1] = (nib1 << 4) + nib2; - maincpu[0xea00 + i*2 + 0] = (nib3 << 4) + nib4; - } - for(i=0x100;i<0x200;i++) { - UINT8 nib1 = user1[i+0x000] ^ 0x00; - UINT8 nib2 = user1[i+0x200] ^ 0x01; - UINT8 nib3 = user1[i+0x400] ^ 0x0f; - UINT8 nib4 = user1[i+0x600] ^ 0x0e; - - maincpu[0xf600 + (i-0x100)*2 + 1] = (nib1 << 4) + nib2; - maincpu[0xf600 + (i-0x100)*2 + 0] = (nib3 << 4) + nib4; - } -} - -void pdp11_state::load9312prom(UINT8 *desc, UINT8 *src, int size) -{ - // 3 2 1 8 - // 7 6 5 4 - // ~11 ~10 9 0 - // 15 14 13 ~12 - for(int i=0;ibase() + ioport("CONSPROM")->read() * 0x0400; - UINT8* maincpu = memregion("maincpu")->base(); - - //0165000 - load9312prom(maincpu + 0165000,user1,0x100); - - UINT8 s1 = ioport("S1")->read(); - - if (s1 & 0x02) { // if boot enabled - UINT16 addr = 0173000; - if (s1 & 1) { - addr = 0165000; - } - addr += ioport("S1_2")->read() * 2; - m_maincpu->set_state_int(T11_PC, addr); - } - - //0173000 - load9312prom(maincpu + 0173000,memregion("devproms")->base() + ioport("DEVPROM1")->read() * 0x0200,0x080); - //0173200 - load9312prom(maincpu + 0173200,memregion("devproms")->base() + ioport("DEVPROM2")->read() * 0x0200,0x080); - //0173400 - load9312prom(maincpu + 0173400,memregion("devproms")->base() + ioport("DEVPROM3")->read() * 0x0200,0x080); - //0173600 - load9312prom(maincpu + 0173600,memregion("devproms")->base() + ioport("DEVPROM4")->read() * 0x0200,0x080); - -} - -MACHINE_RESET_MEMBER(pdp11_state,pdp11qb) -{ - m_maincpu->set_state_int(T11_PC, 0xea00); -} - - -WRITE8_MEMBER( pdp11_state::kbd_put ) -{ - m_teletype_data = data; - m_teletype_status |= 0x80; -} - -static MACHINE_CONFIG_START( pdp11, pdp11_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) // Need proper CPU here - MCFG_T11_INITIAL_MODE(6 << 13) - MCFG_CPU_PROGRAM_MAP(pdp11_mem) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(pdp11_state, kbd_put)) - - MCFG_RX01_ADD("rx01") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pdp11ub2, pdp11 ) - MCFG_MACHINE_RESET_OVERRIDE(pdp11_state,pdp11ub2) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pdp11qb, pdp11 ) - MCFG_MACHINE_RESET_OVERRIDE(pdp11_state,pdp11qb) - - MCFG_CPU_MODIFY("maincpu") - MCFG_T11_INITIAL_MODE(0 << 13) - MCFG_CPU_PROGRAM_MAP(pdp11qb_mem) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pdp11ub ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x1000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "23-034a9.bin", 0x0000, 0x0200, CRC(01c5d78d) SHA1(b447c67bfd5134c142240a919f23a949e1953fb2)) - ROM_LOAD( "23-035a9.bin", 0x0200, 0x0200, CRC(c456df6c) SHA1(188c8ece6a2d67911016f55dd22b698a40aff515)) - ROM_LOAD( "23-036a9.bin", 0x0400, 0x0200, CRC(208ff511) SHA1(27198a1110319b70674a72fd03a798dfa2c2109a)) - ROM_LOAD( "23-037a9.bin", 0x0600, 0x0200, CRC(d248b282) SHA1(ea638de6bde8342654d3e62b7810aa041e111913)) -ROM_END - -ROM_START( pdp11ub2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x800, "consproms", ROMREGION_ERASEFF ) - ROM_LOAD( "23-248f1.bin", 0x0000, 0x0400, CRC(ecda1a6d) SHA1(b2bf770dda349fdd469235871564280baf06301d)) // M9312 11/04/05/34/35/40/45/50/55 Console/Diagnostic PROM - ROM_LOAD( "23-616f1.bin", 0x0400, 0x0400, CRC(a3dfb5aa) SHA1(7f06c624ae3fbb49535258b8722b5a3c548da3ba)) // M9312 11/60-70 Diagnostic/Console ROM - ROM_REGION( 0x4200, "devproms", ROMREGION_ERASEFF ) - ROM_LOAD( "23-751a9.bin", 0x0000, 0x0200, CRC(15bebc6a) SHA1(a621c5b1cebebbb110ee646a8c36ee4c606e269b)) // M9312 'DL' BOOT prom for RL11 controller - ROM_LOAD( "23-752a9.bin", 0x0200, 0x0200, CRC(6cf1f859) SHA1(7c876eda2f0d74d6f5d876256c28dbd56c405ca7)) // M9312 'DM' BOOT prom for RK06/07 controller - ROM_LOAD( "23-753a9.bin", 0x0400, 0x0200, CRC(f4c4b40c) SHA1(a0bdb922c722d439f35ba8149a8f657ffcc8fb54)) // M9312 'DX' BOOT prom for RX01 compatible controller - ROM_LOAD( "23-755a9.bin", 0x0600, 0x0200, CRC(ed06b35c) SHA1(d972c6a743d73ce9244d2bcfdd40eea2bb22e717)) // M9312 'DP/DB' BOOT prom for RP02/03,RP04/5/6 RM02/3 controller - ROM_LOAD( "23-756a9.bin", 0x0800, 0x0200, CRC(12271ab2) SHA1(f0ff42a8fd839dd75d6c1a25cc82d0933fd09dbc)) // M9312 'DK/DT' BOOT prom for RK03/05,TU55/56 controllers - ROM_LOAD( "23-757a9.bin", 0x0a00, 0x0200, CRC(af251aab) SHA1(4d760ec3f6ff5f4e2cafcb44b275183872b69cb6)) // M9312 'MM' BOOT prom for TU16/E16 TM02/3 controllers - ROM_LOAD( "23-758a9.bin", 0x0c00, 0x0200, CRC(b71e8878) SHA1(f45c47c702c94a70c36732c12173ce60d0be1a11)) // M9312 'MT' BOOT prom for TU10/TS03 controller - ROM_LOAD( "23-759a9.bin", 0x0e00, 0x0200, CRC(29a93448) SHA1(0b549170c6a3f49c1587adb6cc691786111c0dd3)) // M9312 'DS' BOOT prom for RS03/RS04 controller - ROM_LOAD( "23-760a9.bin", 0x1000, 0x0200, CRC(ea093648) SHA1(3875a0147c43db1a5a381bbe85937a5628e6220c)) // M9312 'PR/TT' BOOT prom for PC05,LO SPD RDR controllers - ROM_LOAD( "23-761a9.bin", 0x1200, 0x0200, CRC(4310ebe8) SHA1(a3144f96819ea57acfac5de5e19961294e7d4ad9)) // M9312 'CT' BOOT prom for TA11/TU60 controller - ROM_LOAD( "23-762a9.bin", 0x1400, 0x0200, NO_DUMP) // M9312 'RS' BOOT prom for RS11, RS64 controller - ROM_LOAD( "23-763a9.bin", 0x1600, 0x0200, NO_DUMP) // M9312 'CR' BOOT prom for CR11 card reader - ROM_LOAD( "23-764a9.bin", 0x1800, 0x0200, CRC(7c8b7ed4) SHA1(ba0c9f03027eb3dafcc0936e877637d3c9947f94)) // M9312 'MS' BOOT prom for TS11/TS04/TU80 compatible controller - ROM_LOAD( "23-765a9.bin", 0x1a00, 0x0200, CRC(702dfeb2) SHA1(0d37bdd3846de4b104b8968a0e83ed81abd7f9ae)) // M9312 'DD' BOOT prom for TU58 DECtapeII serial tape controller - ROM_LOAD( "23-767a9.bin", 0x1c00, 0x0200, CRC(4b94e3fa) SHA1(3cf92c2f64f95e8cc3abb8af2526cc65ce53ca8a)) // M9312 'DU' BOOT prom for MSCP compatible controller (UDA50/RA50/RC25/RAxx) - ROM_LOAD( "23-786a9.bin", 0x1e00, 0x0200, CRC(a5326664) SHA1(238f97fc5b2b540948ea1e27a4cd1dcf18255b21)) // M9312 'XX' Unknown 1/3 - ROM_LOAD( "23-787a9.bin", 0x2000, 0x0200, CRC(025debf9) SHA1(8ea2faf2e2d78be0ad2f77e61bae0dfb9c3b4b01)) // M9312 'XX' Unknown 2/3 - ROM_LOAD( "23-788a9.bin", 0x2200, 0x0200, CRC(3c7ed364) SHA1(519ffac2e4878490128e754a0473502c767a94e2)) // M9312 'XX' Unknown 3/3 - ROM_LOAD( "23-811a9.bin", 0x2400, 0x0200, CRC(9aa8499a) SHA1(11b040e0908d7492dcc450cbb72d76633dd687ca)) // M9312 'DY' BOOT prom for RX02 compatible controller - ROM_LOAD( "23-862a9.bin", 0x2600, 0x0200, CRC(38dbd994) SHA1(c5db671e6b70f3b4d345a02b46e0ea7566160d04)) // M9312 'XM' DECNET 1/3 (DECnet DDCMP DMC11/DMR11) - ROM_LOAD( "23-863a9.bin", 0x2800, 0x0200, CRC(bbef2f41) SHA1(f472b7a8bd4c0a49dc3ec38f886755910f73fe66)) // M9312 'XM' DECNET 2/3 (DECnet DDCMP DMC11/DMR11) - ROM_LOAD( "23-864a9.bin", 0x2a00, 0x0200, CRC(85cc17dc) SHA1(371dbd3c672fe4b1819762c3082c4217a7597547)) // M9312 'XM' DECNET 3/3 (DECnet DDCMP DMC11/DMR11) - ROM_LOAD( "23-865a9.bin", 0x2c00, 0x0200, NO_DUMP) // M9312 'XU' DECNET 1/3 (DECnet DDCMP DU11) - ROM_LOAD( "23-866a9.bin", 0x2e00, 0x0200, NO_DUMP) // M9312 'XU' DECNET 2/3 (DECnet DDCMP DU11) - ROM_LOAD( "23-867a9.bin", 0x3000, 0x0200, NO_DUMP) // M9312 'XU' DECNET 3/3 (DECnet DDCMP DU11) - ROM_LOAD( "23-868a9.bin", 0x3200, 0x0200, NO_DUMP) // M9312 'XW' DECNET 1/3 (DECnet DDCMP DUP11) - ROM_LOAD( "23-869a9.bin", 0x3400, 0x0200, NO_DUMP) // M9312 'XW' DECNET 2/3 (DECnet DDCMP DUP11) - ROM_LOAD( "23-870a9.bin", 0x3600, 0x0200, NO_DUMP) // M9312 'XW' DECNET 3/3 (DECnet DDCMP DUP11) - ROM_LOAD( "23-926a9.bin", 0x3800, 0x0200, NO_DUMP) // M9312 'XL' DECNET 1/3 (DECnet DDCMP DL11-E) - ROM_LOAD( "23-927a9.bin", 0x3a00, 0x0200, NO_DUMP) // M9312 'XL' DECNET 2/3 (DECnet DDCMP DL11-E) - ROM_LOAD( "23-928a9.bin", 0x3c00, 0x0200, NO_DUMP) // M9312 'XL' DECNET 3/3 (DECnet DDCMP DL11-E) - ROM_LOAD( "23-e22a9.bin", 0x3e00, 0x0200, NO_DUMP) // M9312 'XE' DEUNA DECnet Ethernet - ROM_LOAD( "23-e39a9.bin", 0x4000, 0x0200, CRC(4b94e3fa) SHA1(3cf92c2f64f95e8cc3abb8af2526cc65ce53ca8a)) // M9312 'MU' TMSCP tapes, including TK50, TU81 - -ROM_END - -ROM_START( pdp11qb ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "m7195fa.1", 0xc000, 0x2000, CRC(0fa58752) SHA1(4bcd006790a60f2998ee8377ac5e2c18ef330930)) - ROM_LOAD16_BYTE( "m7195fa.2", 0xc001, 0x2000, CRC(15b6f60c) SHA1(80dd4f8ca3c27babb5e75111b04241596a07c53a)) -ROM_END - -ROM_START( sms1000 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "21251000u", 0x00000, 0x008000, CRC(68db0afc) SHA1(577124bc64f6ddc9771e11b483120a175bfcf8c5) ) - ROM_LOAD( "21251001u", 0x00000, 0x010000, CRC(eec3ccbb) SHA1(69eedb2c3bffe0a2988b1c066df1fea195618087) ) - ROM_LOAD( "21251002u", 0x00000, 0x000800, CRC(66ca0eaf) SHA1(8141f64f81d9954169bcff6c79fd9f85e91f98e0) ) - ROM_LOAD( "2123001", 0x00000, 0x000800, CRC(7eb10e9b) SHA1(521ce8b8a79075c30ad92d810141c725d26fc50e) ) - ROM_LOAD( "2115001.jed", 0x00000, 0x000b19, CRC(02170f78) SHA1(afe50d165b39bff1cadae4290344341376729fda) ) - // no idea how large these undumped proms are - ROM_LOAD( "2096001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2097002", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "20982000f", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "20982001f", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2099002b", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2108001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2109001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2110001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2111001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2116001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2117001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2118001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2119001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2120001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2121001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2122001", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2124008", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2124009", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2124010", 0x1f000, 0x000100, NO_DUMP ) - ROM_LOAD( "2127001b", 0x1f000, 0x000100, NO_DUMP ) // has 3 of these -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( ????, pdp11ub, 0, 0, pdp11, pdp11, driver_device, 0, "Digital Equipment Corporation", "PDP-11 [Unibus](M9301-YA)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( ????, pdp11ub2, pdp11ub, 0, pdp11ub2, pdp11, driver_device, 0, "Digital Equipment Corporation", "PDP-11 [Unibus](M9312)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( ????, pdp11qb, pdp11ub, 0, pdp11qb, pdp11, driver_device, 0, "Digital Equipment Corporation", "PDP-11 [Q-BUS] (M7195 - MXV11)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1987, sms1000, pdp11ub, 0, pdp11qb, pdp11, driver_device, 0, "Scientific Micro Systems", "SMS-1000", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/pecom.c b/src/mess/drivers/pecom.c deleted file mode 100644 index 7bb5ad07aec..00000000000 --- a/src/mess/drivers/pecom.c +++ /dev/null @@ -1,217 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Pecom driver by Miodrag Milanovic - - 08/11/2008 Preliminary driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "sound/cdp1869.h" -#include "sound/wave.h" -#include "machine/ram.h" -#include "includes/pecom.h" - -/* Address maps */ -static ADDRESS_MAP_START(pecom64_mem, AS_PROGRAM, 8, pecom_state ) - AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x4000, 0x7fff ) AM_RAMBANK("bank2") - AM_RANGE( 0x8000, 0xbfff ) AM_ROM // ROM 1 - AM_RANGE( 0xc000, 0xf3ff ) AM_ROM // ROM 2 - AM_RANGE( 0xf000, 0xf7ff ) AM_RAMBANK("bank3") // CDP1869 / ROM - AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank4") // CDP1869 / ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pecom64_io, AS_IO, 8, pecom_state ) - AM_RANGE(0x01, 0x01) AM_WRITE(pecom_bank_w) - AM_RANGE(0x03, 0x03) AM_READ(pecom_keyboard_r) - AM_RANGE(0x03, 0x07) AM_WRITE(pecom_cdp1869_w) -ADDRESS_MAP_END - -/* Input ports */ -/* Pecom 64 keyboard layout is as follows - - 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 BREAK - - DEL Q W E R T Y U I O P ESC - - CAPS A S D F G H J K L RETURN - - CTRL ,< Z X C V B N M :* /? LF - - SHIFT .> Down Left SPACEBAR Right Up ;+ =- - -Being keys distributed on four lines, it makes a bit difficult to accurately remap them -on modern keyboards. Hence, we move by default Up/Down/Left/Right to Cursor Keys and -use LEft/Right Ctrl/Alt keys for the remaining keys. Due to the unnatural emulated keyboard -mappings, this is another situation where natural keyboard comes very handy! */ - -INPUT_CHANGED_MEMBER(pecom_state::ef_w) -{ - m_cdp1802->set_input_line((int)(FPTR)param, newval); -} - -static INPUT_PORTS_START( pecom ) - PORT_START("LINE0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_COLON) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_SLASH) - - PORT_START("LINE1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // Actually this is again / ? - same key connected as on SLASH - - PORT_START("LINE2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("LINE3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START("LINE4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START("LINE5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("LINE7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_CHAR(';') PORT_CHAR('+') - - PORT_START("LINE8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('=') PORT_CHAR('-') - - PORT_START("LINE9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - - PORT_START("LINE11") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - - PORT_START("LINE12") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - - PORT_START("LINE13") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - - PORT_START("LINE14") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - - PORT_START("LINE15") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - - PORT_START("LINE16") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - - PORT_START("LINE17") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("LINE18") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - - PORT_START("LINE19") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - - PORT_START("LINE20") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - - PORT_START("LINE21") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - - PORT_START("LINE22") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - - PORT_START("LINE23") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Sh") PORT_CODE(KEYCODE_DOWN) // sh up - - PORT_START("LINE24") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Dj") PORT_CODE(KEYCODE_LEFT) // dj left - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cj") PORT_CODE(KEYCODE_RIGHT) // cj right - - PORT_START("LINE25") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ch") PORT_CODE(KEYCODE_UP) //ch up - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - - PORT_START("CNT") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) PORT_CHANGED_MEMBER(DEVICE_SELF, pecom_state, ef_w, (void*)COSMAC_INPUT_LINE_EF1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, pecom_state, ef_w, (void*)COSMAC_INPUT_LINE_EF3) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, pecom_state, ef_w, (void*)COSMAC_INPUT_LINE_EF4) -INPUT_PORTS_END - -/* Machine driver */ -static MACHINE_CONFIG_START( pecom64, pecom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, CDP1869_DOT_CLK_PAL/3) - MCFG_CPU_PROGRAM_MAP(pecom64_mem) - MCFG_CPU_IO_MAP(pecom64_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(pecom_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(pecom_state, ef2_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(pecom_state, q_w)) - MCFG_COSMAC_SC_CALLBACK(WRITE8(pecom_state, sc_w)) - - // sound and video hardware - MCFG_FRAGMENT_ADD(pecom_video) - - // devices - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("pecom_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","pecom_cass") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pecom32 ) - ROM_REGION( 0x10000, CDP1802_TAG, ROMREGION_ERASEFF ) - ROM_LOAD( "090786.bin", 0x8000, 0x4000, CRC(b3b1ea23) SHA1(de69f22568161ced801973345fa39d6d207b9e8c) ) -ROM_END - -ROM_START( pecom64 ) - ROM_REGION( 0x10000, CDP1802_TAG, ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "ver4", "version 4") - ROMX_LOAD( "rom_1_g_24.02.88_l.bin", 0x8000, 0x4000, CRC(9a433b47) SHA1(dadb8c399e0a25a2693e10e42a2d7fc2ea9ad427), ROM_BIOS(1) ) - ROMX_LOAD( "rom_2_g_24.02.88_d.bin", 0xc000, 0x4000, CRC(2116cadc) SHA1(03f11055cd221d438a40a41874af8fba0fa116d9), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "ver1", "version 1") - ROMX_LOAD( "170887-rom1.bin", 0x8000, 0x4000, CRC(43710fb4) SHA1(f84f75061c9ac3e34af93141ecabd3c955881aa2), ROM_BIOS(2) ) - ROMX_LOAD( "170887-rom2.bin", 0xc000, 0x4000, CRC(d0d34f08) SHA1(7baab17d1e68771b8dcef97d0fffc655beabef28), ROM_BIOS(2) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, pecom32, 0, 0, pecom64, pecom, driver_device, 0, "Ei Nis", "Pecom 32", 0) -COMP( 1987, pecom64, pecom32, 0, pecom64, pecom, driver_device, 0, "Ei Nis", "Pecom 64", 0) diff --git a/src/mess/drivers/pegasus.c b/src/mess/drivers/pegasus.c deleted file mode 100644 index 47f09b1f0ac..00000000000 --- a/src/mess/drivers/pegasus.c +++ /dev/null @@ -1,581 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Aamber Pegasus computer (New Zealand) - - http://web.mac.com/lord_philip/aamber_pegasus/Aamber_Pegasus.html - - Each copy of the monitor rom was made for an individual machine. - The early bios versions checked that it was running on that - particular computer. - - This computer has no sound. - - The usual way of loading a new rom was to plug it into the board. - We have replaced this with cartslots, to save having to recompile - whenever a new rom is found. Single rom programs will usually work in - any slot (if it is going to work at all). A working rom will appear - in the menu. Press the first letter to run it. - - If a machine language program is loaded via cassette, do it in the - Monitor (L command), when loaded press Enter, and it will be in the - menu. - - Basic cassettes are loaded in the usual way, that is, start Basic, - type LOAD, press Enter. When done, RUN or LIST as needed. - - The Aamber Pegasus uses a MCM66710P, which is functionally - equivalent to the MCM6571. - - Note that datasheet is incorrect for the number "9". - The first byte is really 0x3E rather than 0x3F, confirmed on real - hardware. - - TO DO: - - Work on the other non-working programs - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/6821pia.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - - -class pegasus_state : public driver_device -{ -public: - pegasus_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_cass(*this, "cassette") - , m_pia_s(*this, "pia_s") - , m_pia_u(*this, "pia_u") - , m_exp_00(*this, "exp00") - , m_exp_01(*this, "exp01") - , m_exp_02(*this, "exp02") - , m_exp_0c(*this, "exp0c") - , m_exp_0d(*this, "exp0d") - , m_p_videoram(*this, "videoram") - , m_io_keyboard(*this, "KEY") - { } - - DECLARE_READ8_MEMBER(pegasus_keyboard_r); - DECLARE_READ8_MEMBER(pegasus_protection_r); - DECLARE_READ8_MEMBER(pegasus_pcg_r); - DECLARE_WRITE8_MEMBER(pegasus_controls_w); - DECLARE_WRITE8_MEMBER(pegasus_keyboard_w); - DECLARE_WRITE8_MEMBER(pegasus_pcg_w); - DECLARE_READ_LINE_MEMBER(pegasus_keyboard_irq); - DECLARE_READ_LINE_MEMBER(pegasus_cassette_r); - DECLARE_WRITE_LINE_MEMBER(pegasus_cassette_w); - DECLARE_WRITE_LINE_MEMBER(pegasus_firq_clr); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DRIVER_INIT(pegasus); - TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq); - int load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp00_load) { return load_cart(image, m_exp_00, "0000"); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp01_load) { return load_cart(image, m_exp_01, "1000"); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp02_load) { return load_cart(image, m_exp_02, "2000"); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp0c_load) { return load_cart(image, m_exp_0c, "c000"); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp0d_load) { return load_cart(image, m_exp_0d, "d000"); } -private: - UINT8 m_kbd_row; - bool m_kbd_irq; - UINT8 *m_p_pcgram; - const UINT8 *m_p_chargen; - UINT8 m_control_bits; - virtual void machine_reset(); - virtual void machine_start(); - virtual void video_start(); - void pegasus_decrypt_rom(UINT8 *ROM); - required_device m_maincpu; - required_device m_cass; - required_device m_pia_s; - required_device m_pia_u; - required_device m_exp_00; - required_device m_exp_01; - required_device m_exp_02; - required_device m_exp_0c; - required_device m_exp_0d; - required_shared_ptr m_p_videoram; - required_ioport_array<8> m_io_keyboard; -}; - -TIMER_DEVICE_CALLBACK_MEMBER(pegasus_state::pegasus_firq) -{ - m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); -} - -WRITE_LINE_MEMBER( pegasus_state::pegasus_firq_clr ) -{ - m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); -} - -READ8_MEMBER( pegasus_state::pegasus_keyboard_r ) -{ - UINT8 i,data = 0xff; - for (i = 0; i < 8; i++) - if (!BIT(m_kbd_row, i)) data &= m_io_keyboard[i]->read(); - - m_kbd_irq = (data == 0xff) ? 1 : 0; - if BIT(m_control_bits, 3) - data<<=4; - return data; -} - -WRITE8_MEMBER( pegasus_state::pegasus_keyboard_w ) -{ - m_kbd_row = data; -} - -WRITE8_MEMBER( pegasus_state::pegasus_controls_w ) -{ -/* d0,d2 - not emulated - d0 - Blank - Video blanking - d1 - Char - select character rom or ram - d2 - Page - enables writing to video ram - d3 - Asc - Select which half of the keyboard to read -*/ - - m_control_bits = data; -} - -READ_LINE_MEMBER( pegasus_state::pegasus_keyboard_irq ) -{ - return m_kbd_irq; -} - -READ_LINE_MEMBER( pegasus_state::pegasus_cassette_r ) -{ - return m_cass->input(); -} - -WRITE_LINE_MEMBER( pegasus_state::pegasus_cassette_w ) -{ - m_cass->output(state ? 1 : -1); -} - -READ8_MEMBER( pegasus_state::pegasus_pcg_r ) -{ - UINT8 code = m_p_videoram[offset] & 0x7f; - return m_p_pcgram[(code << 4) | (~m_kbd_row & 15)]; -} - -WRITE8_MEMBER( pegasus_state::pegasus_pcg_w ) -{ -// if BIT(m_control_bits, 1) - { - UINT8 code = m_p_videoram[offset] & 0x7f; - m_p_pcgram[(code << 4) | (~m_kbd_row & 15)] = data; - } -} - -/* Must return the A register except when it is doing a rom search */ -READ8_MEMBER( pegasus_state::pegasus_protection_r ) -{ - UINT8 data = m_maincpu->state_int(M6809_A); - if (data == 0x20) data = 0xff; - return data; -} - -static ADDRESS_MAP_START(pegasus_mem, AS_PROGRAM, 8, pegasus_state) - ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0x0000, 0x2fff) // mapped by the cartslots 1-3 - AM_RANGE(0xb000, 0xbdff) AM_RAM - AM_RANGE(0xbe00, 0xbfff) AM_RAM AM_SHARE("videoram") - //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslots 4-5 - AM_RANGE(0xe000, 0xe1ff) AM_READ(pegasus_protection_r) - AM_RANGE(0xe200, 0xe3ff) AM_READWRITE(pegasus_pcg_r,pegasus_pcg_w) - AM_RANGE(0xe400, 0xe403) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pia_u", pia6821_device, read, write) - AM_RANGE(0xe600, 0xe603) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pia_s", pia6821_device, read, write) - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pegasusm_mem, AS_PROGRAM, 8, pegasus_state) - ADDRESS_MAP_UNMAP_HIGH - AM_IMPORT_FROM(pegasus_mem) - AM_RANGE(0x5000, 0xafff) AM_RAM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pegasus ) - PORT_START("KEY.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BackSpace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(8) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(20) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(13) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(16) - - PORT_START("KEY.1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ ]") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) PORT_CHAR(127) PORT_CHAR('_') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(9) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(11) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(15) - - PORT_START("KEY.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(10) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(21) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(7) - - PORT_START("KEY.3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(20) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // outputs a space - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ShiftR") PORT_NAME("ShiftR") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(8) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(25) - - PORT_START("KEY.4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(18) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(23) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // outputs a space - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(3) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(6) - - PORT_START("KEY.5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(5) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(17) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // REPEAT key which is disconnected - outputs a space - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LineFeed") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(10) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(4) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(14) - - PORT_START("KEY.6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(22) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(24) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BlankL") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(16) - - PORT_START("KEY.7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(19) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CapsLock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(19) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ShiftL") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BlankR") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(21) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(26) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("{ }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('{') PORT_CHAR('}') -INPUT_PORTS_END - -void pegasus_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -static const UINT8 mcm6571a_shift[] = -{ - 0,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0, - 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0, - 1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0 -}; - - -UINT32 pegasus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,inv; - UINT16 sy=0,ma=0,x; - bool pcg_mode = BIT(m_control_bits, 1); - - for(y = 0; y < 16; y++ ) - { - for(ra = 0; ra < 16; ra++ ) - { - UINT16 *p = &bitmap.pix16(sy++); - - for(x = ma; x < ma + 32; x++ ) - { - inv = 0xff; - chr = m_p_videoram[x]; - - if (BIT(chr, 7)) - { - inv = 0; - chr &= 0x7f; - } - - if (pcg_mode) - { - gfx = m_p_pcgram[(chr << 4) | ra] ^ inv; - } - else - if (mcm6571a_shift[chr]) - { - if (ra < 3) - gfx = inv; - else - gfx = m_p_chargen[(chr<<4) | (ra-3) ] ^ inv; - } - else - { - if (ra < 10) - gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; - else - gfx = inv; - } - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=32; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout pegasus_charlayout = -{ - 8, 16, /* text = 7 x 9, pcg = 8 x 16 */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( pegasus ) - GFXDECODE_ENTRY( "chargen", 0x0000, pegasus_charlayout, 0, 1 ) - GFXDECODE_ENTRY( "pcg", 0x0000, pegasus_charlayout, 0, 1 ) -GFXDECODE_END - - -// An encrypted single rom starts with 02, decrypted with 20. -// The 2nd and 3rd part of a multi-rom set will have no obvious byte, -// so we check the first 4 bytes for a signature, and decrypt if found. -void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM) -{ - bool doit = FALSE; - UINT8 b; - UINT16 j; - dynamic_buffer temp_copy; - temp_copy.resize(0x1000); - - if (ROM[0] == 0x02) doit = TRUE; - if (ROM[0] == 0x1e && ROM[1] == 0xfa && ROM[2] == 0x60 && ROM[3] == 0x71) doit = TRUE; // xbasic 2nd rom - if (ROM[0] == 0x72 && ROM[1] == 0x62 && ROM[2] == 0xc6 && ROM[3] == 0x36) doit = TRUE; // xbasic 3rd rom - if (ROM[0] == 0xf0 && ROM[1] == 0x40 && ROM[2] == 0xce && ROM[3] == 0x80) doit = TRUE; // forth 2nd rom (both sets) - if (ROM[0] == 0x80 && ROM[1] == 0x06 && ROM[2] == 0x68 && ROM[3] == 0x14) doit = TRUE; // pascal 2nd rom - - if (doit) - { - for (int i = 0; i < 0x1000; i++) - { - b = ROM[i]; - j = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7); - b = BITSWAP8(b, 3, 2, 1, 0, 7, 6, 5, 4); - temp_copy[j & 0xfff] = b; - } - memcpy(ROM, &temp_copy[0], 0x1000); - } -} - -int pegasus_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag) -{ - UINT32 size = slot->common_get_size(reg_tag); - bool any_socket = false; - - if (size > 0x1000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - if (image.software_entry() != NULL && size == 0) - { - // we might be loading a cart compatible with all sockets! - // so try to get region "rom" - size = slot->common_get_size("rom"); - any_socket = true; - - if (size == 0) - { - std::string errmsg; - strprintf(errmsg,"Attempted to load a file that does not work in this socket.\nPlease check \"Usage\" field in the software list for the correct socket(s) to use."); - image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); - return IMAGE_INIT_FAIL; - } - } - - slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // we alloc 0x1000 also for smaller roms! - slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag); - - // raw images have to be decrypted (in particular the ones from softlist) - pegasus_decrypt_rom(slot->get_rom_base()); - - return IMAGE_INIT_PASS; -} - -void pegasus_state::machine_start() -{ - m_p_pcgram = memregion("pcg")->base(); - - if (m_exp_00->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_00)); - if (m_exp_01->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_01)); - if (m_exp_02->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x2fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_02)); - if (m_exp_0c->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_0c)); - if (m_exp_0d->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_0d)); -} - -void pegasus_state::machine_reset() -{ - m_kbd_row = 0; - m_kbd_irq = 1; - m_control_bits = 0; -} - -DRIVER_INIT_MEMBER(pegasus_state, pegasus) -{ - // decrypt monitor - UINT8 *base = memregion("maincpu")->base() + 0xf000; - pegasus_decrypt_rom(base); -} - -static MACHINE_CONFIG_START( pegasus, pegasus_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809E, XTAL_4MHz) // actually a 6809C - 4MHZ clock coming in, 1MHZ internally - MCFG_CPU_PROGRAM_MAP(pegasus_mem) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("pegasus_firq", pegasus_state, pegasus_firq, attotime::from_hz(400)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(pegasus_state, screen_update) - MCFG_SCREEN_SIZE(32*8, 16*16) - MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 16*16-1) - MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pegasus) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD("pia_s", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(pegasus_state, pegasus_keyboard_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(pegasus_state, pegasus_cassette_r)) - MCFG_PIA_READCB1_HANDLER(READLINE(pegasus_state, pegasus_keyboard_irq)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(pegasus_state, pegasus_keyboard_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(pegasus_state, pegasus_controls_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(pegasus_state, pegasus_cassette_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(pegasus_state, pegasus_firq_clr)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - - MCFG_DEVICE_ADD("pia_u", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - - MCFG_GENERIC_SOCKET_ADD("exp00", generic_plain_slot, "pegasus_cart") - MCFG_GENERIC_LOAD(pegasus_state, exp00_load) - - MCFG_GENERIC_SOCKET_ADD("exp01", generic_plain_slot, "pegasus_cart") - MCFG_GENERIC_LOAD(pegasus_state, exp01_load) - - MCFG_GENERIC_SOCKET_ADD("exp02", generic_plain_slot, "pegasus_cart") - MCFG_GENERIC_LOAD(pegasus_state, exp02_load) - - MCFG_GENERIC_SOCKET_ADD("exp0c", generic_plain_slot, "pegasus_cart") - MCFG_GENERIC_LOAD(pegasus_state, exp0c_load) - - MCFG_GENERIC_SOCKET_ADD("exp0d", generic_plain_slot, "pegasus_cart") - MCFG_GENERIC_LOAD(pegasus_state, exp0d_load) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED|CASSETTE_MOTOR_ENABLED) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "pegasus_cart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pegasusm, pegasus ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP(pegasusm_mem) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( pegasus ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "11r2674", "Monitor 1.1 r2674") - ROMX_LOAD( "mon11_2674.bin", 0xf000, 0x1000, CRC(1640ff7e) SHA1(8199643749fb40fb8be05e9f311c75620ca939b1), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "10r2569", "Monitor 1.0 r2569") - ROMX_LOAD( "mon10_2569.bin", 0xf000, 0x1000, CRC(910fc930) SHA1(a4f6bbe5def0268cc49ee7045616a39017dd8052), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "11r2569", "Monitor 1.1 r2569") - ROMX_LOAD( "mon11_2569.bin", 0xf000, 0x1000, CRC(07b92002) SHA1(3c434601120870c888944ecd9ade5186432ddbc2), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "11r2669", "Monitor 1.1 r2669") - ROMX_LOAD( "mon11_2669.bin", 0xf000, 0x1000, CRC(f3ee23c8) SHA1(3ac96935668f5e53799c90db5140393c2ef9ce36), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS(4, "22r2856", "Monitor 2.2 r2856") - ROMX_LOAD( "mon22_2856.bin", 0xf000, 0x1000, CRC(5f5f688a) SHA1(3719eecc347e158dd027ea7aa8a068cdafc00d9b), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS(5, "22br2856", "Monitor 2.2B r2856") - ROMX_LOAD( "mon22b_2856.bin", 0xf000, 0x1000, CRC(a47b0308) SHA1(f215e51aa8df6aed99c10f3df6a3589cb9f63d46), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS(6, "23r2601", "Monitor 2.3 r2601") - ROMX_LOAD( "mon23_2601.bin", 0xf000, 0x1000, CRC(0e024222) SHA1(9950cba08996931b9d5a3368b44c7309638b4e08), ROM_BIOS(7) ) - ROM_SYSTEM_BIOS(7, "23ar2569", "Monitor 2.3A r2569") - ROMX_LOAD( "mon23a_2569.bin", 0xf000, 0x1000, CRC(248e62c9) SHA1(adbde27e69b38b29ff89bacf28d0240a8e5d90f3), ROM_BIOS(8) ) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "6571.bin", 0x0000, 0x0800, CRC(5a25144b) SHA1(7b9fee0c8ef2605b85d12b6d9fe8feb82418c63a) ) - - ROM_REGION( 0x800, "pcg", ROMREGION_ERASEFF ) -ROM_END - -#define rom_pegasusm rom_pegasus - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, pegasus, 0, 0, pegasus, pegasus, pegasus_state, pegasus, "Technosys", "Aamber Pegasus", MACHINE_NO_SOUND_HW ) -COMP( 1981, pegasusm, pegasus, 0, pegasusm, pegasus, pegasus_state, pegasus, "Technosys", "Aamber Pegasus with RAM expansion unit", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/pencil2.c b/src/mess/drivers/pencil2.c deleted file mode 100644 index bde1c817f9c..00000000000 --- a/src/mess/drivers/pencil2.c +++ /dev/null @@ -1,348 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Hanimex Pencil II - Manufactured by Soundic, Hong Kong. - - 2012-11-06 [Robbbert] - - Computer kindly donated for MESS by Ian Farquhar. - - Accessories: - - PEN-216 : 16k RAM expansion - - PEN-264 : 64k RAM expansion - - PEN-511 : Data Cassette Recorder - - ??? : Printer - - ??? : Floppy Disk Drive (5.25) - - ??? : Floppy Disk Controller - - ??? : RS-232C Serial Interface - - ??? : Coleco Adapter* - - PEN-8xx : Various software on Cassette or Floppy Disk - - ??? : Game Controller (joystick and 14 buttons) - - PEN-7xx : Various software in Cartridge format - - PEN-430 : Modem - - PEN-902 : Computer power supply - - PEN-962 : Monitor cable - - * The cart slot is the same as that found on the Colecovision console. By plugging the - Coleco Adapter into the expansion slot, Colecovision cartridges can be plugged into the - cart slot and played. - -Information found by looking inside the computer ------------------------------------------------- -Main Board PEN-002 11-50332-10 - -J1 Expansion slot -J2 Cart slot -J3 Memory expansion slot -J4 Printer slot -J5,J6 Joystick ports - -XTAL 10.738 MHz - -Output is to a TV on Australian Channel 1. - -U1 uPD780C-1 (Z80A) -U2 Video chip with heatsink stuck on top, TMS9929 -U3 SN76489AN -U4 2764 bios rom -U5 uPD4016C-2 (assumed to be equivalent of 6116 2K x 8bit static RAM) -U6 74LS04 -U7 74LS74A -U8-10 74LS138 -U11 74LS00 -U12 74LS273 -U13 74LS74A -U14-21 TMM416P-3 (4116-3 16k x 1bit dynamic RAM) -U22 74LS05 -U23-24 SN74LS541 - - -SD-BASIC usage: -All commands must be in uppercase, which is the default at boot. -The 'capslock' is done by pressing Shift and Esc together, and the -cursor will change to a checkerboard pattern. - - -MEMORY MAP -0000-1FFF bios rom -2000-5FFF available for expansion -6000-7FFF static RAM (2K mirrored) -8000-FFFF cart slot - -The 16k dynamic RAM holds the BASIC program and the video/gfx etc -but is banked out of view of a BASIC program. - - -ToDo: -- Joysticks (no info) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/tms9928a.h" -#include "sound/sn76496.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class pencil2_state : public driver_device -{ -public: - pencil2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_centronics(*this, "centronics") - , m_cass(*this, "cassette") - , m_cart(*this, "cartslot") - {} - - DECLARE_WRITE8_MEMBER(port10_w); - DECLARE_WRITE8_MEMBER(port30_w); - DECLARE_WRITE8_MEMBER(port80_w); - DECLARE_WRITE8_MEMBER(portc0_w); - DECLARE_READ8_MEMBER(porte2_r); - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_CUSTOM_INPUT_MEMBER(printer_ready_r); - DECLARE_CUSTOM_INPUT_MEMBER(printer_ack_r); -private: - virtual void machine_start(); - int m_centronics_busy; - int m_centronics_ack; - bool m_cass_state; - required_device m_maincpu; - required_device m_centronics; - required_device m_cass; - required_device m_cart; -}; - -static ADDRESS_MAP_START(pencil2_mem, AS_PROGRAM, 8, pencil2_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x5fff) AM_WRITENOP // stop error log filling up - AM_RANGE(0x6000, 0x67ff) AM_MIRROR(0x1800) AM_RAM - //AM_RANGE(0x8000, 0xffff) // mapped by the cartslot -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pencil2_io, AS_IO, 8, pencil2_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x0f) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x10, 0x1f) AM_WRITE(port10_w) - AM_RANGE(0x30, 0x3f) AM_WRITE(port30_w) - AM_RANGE(0x80, 0x9f) AM_WRITE(port80_w) - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) - AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) - AM_RANGE(0xc0, 0xdf) AM_WRITE(portc0_w) - AM_RANGE(0xe0, 0xff) AM_DEVWRITE("sn76489a", sn76489a_device, write) - AM_RANGE(0xe0, 0xe0) AM_READ_PORT("E0") - AM_RANGE(0xe1, 0xe1) AM_READ_PORT("E1") - AM_RANGE(0xe2, 0xe2) AM_READ(porte2_r) - AM_RANGE(0xe3, 0xe3) AM_READ_PORT("E3") - AM_RANGE(0xe4, 0xe4) AM_READ_PORT("E4") - AM_RANGE(0xe6, 0xe6) AM_READ_PORT("E6") - AM_RANGE(0xe8, 0xe8) AM_READ_PORT("E8") - AM_RANGE(0xea, 0xea) AM_READ_PORT("EA") - AM_RANGE(0xf0, 0xf0) AM_READ_PORT("F0") - AM_RANGE(0xf2, 0xf2) AM_READ_PORT("F2") -ADDRESS_MAP_END - -READ8_MEMBER( pencil2_state::porte2_r) -{ - return (m_cass->input() > 0.1) ? 0xff : 0x7f; -} - -WRITE8_MEMBER( pencil2_state::port10_w ) -{ - m_centronics->write_strobe(BIT(data, 0)); -} - -WRITE8_MEMBER( pencil2_state::port30_w ) -{ - m_cass_state ^= 1; - m_cass->output( m_cass_state ? -1.0 : +1.0); -} - -WRITE8_MEMBER( pencil2_state::port80_w ) -{ -} - -WRITE8_MEMBER( pencil2_state::portc0_w ) -{ -} - -WRITE_LINE_MEMBER( pencil2_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -CUSTOM_INPUT_MEMBER( pencil2_state::printer_ready_r ) -{ - return m_centronics_busy; -} - -WRITE_LINE_MEMBER( pencil2_state::write_centronics_ack ) -{ - m_centronics_ack = state; -} - -CUSTOM_INPUT_MEMBER( pencil2_state::printer_ack_r ) -{ - return m_centronics_ack; -} - - -/* Input ports */ -static INPUT_PORTS_START( pencil2 ) - PORT_START("E0") - // port_custom MUST be ACTIVE_HIGH to work - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pencil2_state, printer_ready_r, " ") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_END) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pencil2_state, printer_ack_r, " ") - - PORT_START("E1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR('@') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('>') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("E3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("E4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("E6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("E8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR('/') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR('?') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("EA") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("F0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("F2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -void pencil2_state::machine_start() -{ - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -static MACHINE_CONFIG_START( pencil2, pencil2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_10_738635MHz/3) - MCFG_CPU_PROGRAM_MAP(pencil2_mem) - MCFG_CPU_IO_MAP(pencil2_io) - - /* video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("sn76489a", SN76489A, XTAL_10_738635MHz/3) // guess - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pencil2_cart") - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pencil2_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pencil2_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "pencil2") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pencil2 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "mt.u4", 0x0000, 0x2000, CRC(338d7b59) SHA1(2f89985ac06971e00210ff992bf1e30a296d10e7) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, pencil2, 0, 0, pencil2, pencil2, driver_device, 0, "Hanimex", "Pencil II", 0 ) diff --git a/src/mess/drivers/pentagon.c b/src/mess/drivers/pentagon.c deleted file mode 100644 index 61265e75ab4..00000000000 --- a/src/mess/drivers/pentagon.c +++ /dev/null @@ -1,354 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, MetalliC -#include "emu.h" -#include "includes/spectrum.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/ay8910.h" -#include "sound/speaker.h" -#include "formats/tzx_cas.h" -#include "machine/beta.h" -#include "machine/ram.h" - -class pentagon_state : public spectrum_state -{ -public: - enum - { - TIMER_IRQ_ON, - TIMER_IRQ_OFF - }; - pentagon_state(const machine_config &mconfig, device_type type, const char *tag) - : spectrum_state(mconfig, type, tag) - , m_bank1(*this, "bank1") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - , m_bank4(*this, "bank4") - , m_beta(*this, BETA_DISK_TAG) - { } - - DECLARE_DIRECT_UPDATE_MEMBER(pentagon_direct); - DECLARE_WRITE8_MEMBER(pentagon_port_7ffd_w); - DECLARE_WRITE8_MEMBER(pentagon_scr_w); - DECLARE_WRITE8_MEMBER(pentagon_scr2_w); - DECLARE_MACHINE_RESET(pentagon); - INTERRUPT_GEN_MEMBER(pentagon_interrupt); - TIMER_CALLBACK_MEMBER(irq_on); - TIMER_CALLBACK_MEMBER(irq_off); -protected: - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_device m_beta; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -private: - UINT8 *m_p_ram; - void pentagon_update_memory(); -}; - -DIRECT_UPDATE_MEMBER(pentagon_state::pentagon_direct) -{ - UINT16 pc = m_maincpu->pcbase(); - - if (m_beta->started() && m_beta->is_active() && (pc >= 0x4000)) - { - m_ROMSelection = BIT(m_port_7ffd_data, 4); - m_beta->disable(); - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); - } - else - if (((pc & 0xff00) == 0x3d00) && (m_ROMSelection==1)) - { - m_ROMSelection = 3; - if (m_beta->started()) - m_beta->enable(); - } - - if (address<=0x3fff) - { - if (m_ROMSelection == 3) - { - if (m_beta->started()) - { - direct.explicit_configure(0x0000, 0x3fff, 0x3fff, memregion("beta:beta")->base()); - m_bank1->set_base(memregion("beta:beta")->base()); - } - } - else - { - direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x10000 + (m_ROMSelection<<14)]); - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); - } - return ~0; - } - - return address; -} - -void pentagon_state::pentagon_update_memory() -{ - UINT8 *messram = m_ram->pointer(); - - m_screen_location = messram + ((m_port_7ffd_data & 8) ? (7<<14) : (5<<14)); - - if (strcmp(machine().system().name, "pent1024") != 0) - { - m_bank4->set_base(messram + ((m_port_7ffd_data & 0x07) * 0x4000)); - } - else - { - // currently 512Kb ram expansion supported - m_bank4->set_base(messram + (((m_port_7ffd_data & 0x07) | ((m_port_7ffd_data & 0xc0) >> 3)) * 0x4000)); - } - - if (m_beta->started() && m_beta->is_active() && !( m_port_7ffd_data & 0x10 ) ) - { - /* GLUK */ - if (strcmp(machine().system().name, "pent1024")==0) - m_ROMSelection = 2; - else - m_ROMSelection = BIT(m_port_7ffd_data, 4); - } - else - /* ROM switching */ - m_ROMSelection = BIT(m_port_7ffd_data, 4); - - /* rom 0 is 128K rom, rom 1 is 48 BASIC */ - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); -} - -WRITE8_MEMBER(pentagon_state::pentagon_port_7ffd_w) -{ - /* disable paging */ - if (m_port_7ffd_data & 0x20) - return; - - if ((m_port_7ffd_data ^ data) & 0x08) - spectrum_UpdateScreenBitmap(); - - /* store new state */ - m_port_7ffd_data = data; - - /* update memory */ - pentagon_update_memory(); -} - -WRITE8_MEMBER(pentagon_state::pentagon_scr_w) -{ - spectrum_UpdateScreenBitmap(); - - *((UINT8*)m_bank2->base() + offset) = data; -} - -WRITE8_MEMBER(pentagon_state::pentagon_scr2_w) -{ - if ((m_port_7ffd_data & 0x0f) == 0x0f || (m_port_7ffd_data & 0x0f) == 5) - spectrum_UpdateScreenBitmap(); - - *((UINT8*)m_bank4->base() + offset) = data; -} - -void pentagon_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_IRQ_ON: - irq_on(ptr, param); - break; - case TIMER_IRQ_OFF: - irq_off(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in pentagon_state::device_timer"); - } -} - -TIMER_CALLBACK_MEMBER(pentagon_state::irq_on) -{ - m_maincpu->set_input_line(0, HOLD_LINE); - timer_set(attotime::from_ticks(32, XTAL_14MHz / 4), TIMER_IRQ_OFF, 0); -} - -TIMER_CALLBACK_MEMBER(pentagon_state::irq_off) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -INTERRUPT_GEN_MEMBER(pentagon_state::pentagon_interrupt) -{ - timer_set(attotime::from_ticks(179, XTAL_14MHz / 4), TIMER_IRQ_ON, 0); -} -static ADDRESS_MAP_START (pentagon_io, AS_IO, 8, pentagon_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0000) AM_WRITE(pentagon_port_7ffd_w) AM_MIRROR(0x7ffd) // (A15 | A1) == 0 - AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, status_r, command_w) AM_MIRROR(0xff00) - AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, track_r, track_w) AM_MIRROR(0xff00) - AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, sector_r, sector_w) AM_MIRROR(0xff00) - AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, data_r, data_w) AM_MIRROR(0xff00) - AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) - AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, state_r, param_w) AM_MIRROR(0xff00) - AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3ffd) - AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd) -ADDRESS_MAP_END - -MACHINE_RESET_MEMBER(pentagon_state,pentagon) -{ - UINT8 *messram = m_ram->pointer(); - address_space &space = m_maincpu->space(AS_PROGRAM); - m_p_ram = memregion("maincpu")->base(); - - space.install_read_bank(0x0000, 0x3fff, "bank1"); - space.unmap_write(0x0000, 0x3fff); - - space.install_write_handler(0x4000, 0x5aff, write8_delegate(FUNC(pentagon_state::pentagon_scr_w), this)); - space.install_write_handler(0xc000, 0xdaff, write8_delegate(FUNC(pentagon_state::pentagon_scr2_w), this)); - - if (m_beta->started()) - { - if (strcmp(machine().system().name, "pent1024")==0) - m_beta->enable(); - } - space.set_direct_update_handler(direct_update_delegate(FUNC(pentagon_state::pentagon_direct), this)); - - memset(messram,0,128*1024); - - /* Bank 5 is always in 0x4000 - 0x7fff */ - m_bank2->set_base(messram + (5<<14)); - - /* Bank 2 is always in 0x8000 - 0xbfff */ - m_bank3->set_base(messram + (2<<14)); - - m_port_7ffd_data = 0; - m_port_1ffd_data = -1; - pentagon_update_memory(); -} - -/* F4 Character Displayer */ -static const gfx_layout spectrum_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 96, /* 96 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( pentagon ) - GFXDECODE_ENTRY( "maincpu", 0x17d00, spectrum_charlayout, 0, 8 ) -GFXDECODE_END - - - -static MACHINE_CONFIG_DERIVED_CLASS( pentagon, spectrum_128, pentagon_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(XTAL_14MHz / 4) - MCFG_CPU_IO_MAP(pentagon_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pentagon_state, pentagon_interrupt) - MCFG_MACHINE_RESET_OVERRIDE(pentagon_state, pentagon ) - - MCFG_SCREEN_MODIFY("screen") - //MCFG_SCREEN_RAW_PARAMS(XTAL_14MHz / 2, 448, 0, 352, 320, 0, 304) - MCFG_SCREEN_RAW_PARAMS(XTAL_14MHz / 2, 448, 0, 352, 320, 0, 287) - - MCFG_BETA_DISK_ADD(BETA_DISK_TAG) - MCFG_GFXDECODE_MODIFY("gfxdecode", pentagon) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_REPLACE("ay8912", AY8912, XTAL_14MHz / 8) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "lspeaker", 0.25) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) - MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) - - MCFG_SOFTWARE_LIST_ADD("cass_list_pen","pentagon_cass") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pent1024, pentagon) - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1024K") -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(pentagon) - ROM_REGION(0x01c000, "maincpu", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "v1", "Pentagon 128K") - ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(1)) - ROMX_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "Pentagon 128K 93") - ROMX_LOAD("128tr93.rom",0x010000, 0x4000, CRC(08ad241c) SHA1(16daba547c644ef01ce76d2686ccfbff72e13dbe), ROM_BIOS(2)) - ROMX_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v3", "Pentagon 128K (joined)") - ROMX_LOAD( "pentagon.rom", 0x010000, 0x8000, CRC(aa1ce4bd) SHA1(a584272f21dc82c14b7d4f1ed440e23a976e71f0), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v4", "Pentagon 128K Spanish") - ROMX_LOAD( "pent-es.rom", 0x010000, 0x8000, CRC(34d04bae) SHA1(6782c8c0ee77c40d6d3170a254894dae44ddc93e), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v5", "Pentagon 128K SOS89R Monitor") - ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(5)) - ROMX_LOAD( "sos89r.rom",0x014000, 0x4000, CRC(09c9e7e1) SHA1(29c567921abd377d2f9c088352c392a5a0858651), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "v6", "Pentagon 128K 1990 Monitor") - ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(6)) - ROMX_LOAD( "basic90.rom",0x014000, 0x4000, CRC(a41575ba) SHA1(44c5de86e765172b0af154fe3934643ce40bf378), ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "v7", "Pentagon 128K RaK(c) 1991 Monitor") - ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(7)) - ROMX_LOAD( "sos48.rom", 0x014000, 0x4000, CRC(ceb4005d) SHA1(d56c01ea7abdca178efb2b1c6b2866a9a38274ee), ROM_BIOS(7)) - ROM_SYSTEM_BIOS(7, "v8", "Pentagon 128K Dynaelectronics 1989") - ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(8)) - ROMX_LOAD( "m48a.rom", 0x014000, 0x4000, CRC(a3b4def6) SHA1(7ad59ca373876d452b0cf0ed5edb0e93c3176f1a), ROM_BIOS(8)) - ROM_SYSTEM_BIOS(8, "v9", "ZXVGS v0.22 by Yarek") - ROMX_LOAD( "zxvgs-22-0.rom", 0x010000, 0x4000, CRC(63041c61) SHA1(f6718097d939afa8881b4436741a5a23d7e93d78), ROM_BIOS(9)) - ROMX_LOAD( "zxvgs-22-1.rom", 0x014000, 0x4000, CRC(f3736047) SHA1(f3739bf460a57e3f10e8dfb1e7120842938d27ea), ROM_BIOS(9)) - ROM_SYSTEM_BIOS(9, "v10", "ZXVGS v0.29 by Yarek") - ROMX_LOAD( "zxvg-29-0.rom", 0x010000, 0x4000, CRC(3b66f433) SHA1(d21df9e7f1ee99d8b38c2e6a32727aac0f1d5dc6), ROM_BIOS(10)) - ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(10)) - ROM_SYSTEM_BIOS(10, "v11", "ZXVGS v0.30 by Yarek") - ROMX_LOAD( "zxvg-30-0.rom", 0x010000, 0x4000, CRC(533e0f26) SHA1(b5f157c5d0da414ec77e445fdc40b78450129709), ROM_BIOS(11)) - ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(11)) - ROM_SYSTEM_BIOS(11, "v12", "ZXVGS v0.31 by Yarek") - ROMX_LOAD( "zxvg-31-0.rom", 0x010000, 0x4000, CRC(76f43500) SHA1(1c7cd52894847668418876d55b93b213d89d92ee), ROM_BIOS(12)) - ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(12)) - ROM_SYSTEM_BIOS(12, "v13", "ZXVGS v0.35 by Yarek") - ROMX_LOAD( "zxvg-35-0.rom", 0x010000, 0x4000, CRC(5cc8b3b1) SHA1(6c6d0ef1b65d7dc4f607d17204488264575ce48c), ROM_BIOS(13)) - ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(13)) - ROM_SYSTEM_BIOS(13, "v14", "NeOS 512") - ROMX_LOAD("neos_512.rom", 0x010000, 0x4000, CRC(1657fa43) SHA1(647545f06257bce9b1919fcb86b2a49a21c851a7), ROM_BIOS(14)) - ROMX_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(14)) -ROM_END - -ROM_START(pent1024) - ROM_REGION(0x01c000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca)) - ROM_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa)) - ROM_SYSTEM_BIOS(0, "v1", "Gluk 6.3r") - ROMX_LOAD( "gluk63r.rom",0x018000, 0x4000, CRC(ca321d79) SHA1(015eb96dafb273d4f4512c467e9b43c305fd1bc4), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "Gluk 5.2i") - ROMX_LOAD( "gluk52i.rom", 0x018000, 0x4000, CRC(fe44b86a) SHA1(9099d8a0f99a818849ca67ae1a8d3e7eacf06e65), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v3", "Gluk 5.3") - ROMX_LOAD( "gluk53.rom", 0x018000, 0x4000, CRC(479515ef) SHA1(ed656cd4faa36de2e31b38102bcbd8cee12e7976), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v4", "Gluk 5.4") - ROMX_LOAD( "gluk54r.rom", 0x018000, 0x4000, CRC(f4c1e975) SHA1(7e9e116750e1398572695b9cf8a120e47066256e), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v5", "Gluk 5.5r") - ROMX_LOAD( "gluk55r.rom", 0x018000, 0x4000, CRC(3658c1ee) SHA1(4a5c8ca1e090cfb0168796f0d695310fa5c955d3), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "v6", "Gluk 5.5rr") - ROMX_LOAD( "gluk55rr.rom",0x018000, 0x4000, CRC(6b60b818) SHA1(9d606275d17770c9341b33b43f40aee227078827), ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "v7", "Gluk 6.0r") - ROMX_LOAD( "gluk60r.rom", 0x018000, 0x4000, CRC(d114a032) SHA1(5db3462ce7a51b473a3a7056e67c11a62cc1cc2a), ROM_BIOS(7)) - ROM_SYSTEM_BIOS(7, "v8", "Gluk 6.0-1r") - ROMX_LOAD( "gluk601r.rom", 0x018000, 0x4000, CRC(daf6310b) SHA1(b8945168d4d136b731b33ec4758f8510c47fb8c4), ROM_BIOS(8)) - ROM_SYSTEM_BIOS(8, "v9", "Gluk 5.1") - ROMX_LOAD( "gluk51.rom", 0x018000, 0x4000, CRC(ea8c760b) SHA1(adaab28066ca46fbcdcf084c3b53d5a1b82d94a9), ROM_BIOS(9)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1989, pentagon, spec128, 0, pentagon, spec_plus, driver_device, 0, "", "Pentagon", 0) -COMP( 19??, pent1024, spec128, 0, pent1024, spec_plus, driver_device, 0, "", "Pentagon 1024", 0) diff --git a/src/mess/drivers/peoplepc.c b/src/mess/drivers/peoplepc.c deleted file mode 100644 index ce6041841d4..00000000000 --- a/src/mess/drivers/peoplepc.c +++ /dev/null @@ -1,302 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "machine/i8257.h" -#include "machine/upd765.h" -#include "video/mc6845.h" -#include "bus/rs232/rs232.h" -#include "bus/rs232/keyboard.h" - -class peoplepc_state : public driver_device -{ -public: - peoplepc_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette"), - m_pic_1(*this, "pic8259_1"), - m_8251key(*this, "i8251_0"), - m_8251ser(*this, "i8251_1"), - m_fdc(*this, "upd765"), - m_flop0(*this, "upd765:0"), - m_flop1(*this, "upd765:1"), - m_dmac(*this, "i8257"), - m_gfxdecode(*this, "gfxdecode"), - m_gvram(*this, "gvram"), - m_cvram(*this, "cvram"), - m_charram(4*1024) - { } - required_device m_maincpu; - required_device m_palette; - required_device m_pic_1; - required_device m_8251key; - required_device m_8251ser; - required_device m_fdc; - required_device m_flop0; - required_device m_flop1; - required_device m_dmac; - required_device m_gfxdecode; - required_shared_ptr m_gvram; - required_shared_ptr m_cvram; - dynamic_buffer m_charram; - - MC6845_UPDATE_ROW(update_row); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE16_MEMBER(charram_w); - DECLARE_WRITE_LINE_MEMBER(tty_clock_tick_w); - DECLARE_WRITE_LINE_MEMBER(kbd_clock_tick_w); - DECLARE_WRITE8_MEMBER(dmapg_w); - DECLARE_WRITE_LINE_MEMBER(tc_w); - DECLARE_WRITE_LINE_MEMBER(hrq_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - int floppy_load(floppy_image_device *dev); - void floppy_unload(floppy_image_device *dev); - - UINT8 m_dma0pg; -protected: - virtual void machine_start(); - virtual void machine_reset(); -}; - -static const gfx_layout peoplepc_charlayout = -{ - 8, 19, /* 8 x 19 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0}, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8, 16*8, 17*8, 18*8 }, - 8*32 -}; - -MC6845_UPDATE_ROW(peoplepc_state::update_row) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i, j; - - for(i = 0; i < x_count; i++) - { - if(0) - { - UINT16 offset = ((ma | (ra << 1)) << 4) + i; - UINT8 data = m_gvram[offset] >> (offset & 1 ? 8 : 0); - - for(j = 8; j >= 0; j--) - bitmap.pix32(y, (i * 8) + j) = palette[( data & 1 << j ) ? 1 : 0]; - } - else - { - UINT8 data = m_charram[(m_cvram[(ma + i) & 0x3fff] & 0x7f) * 32 + ra]; - for(j = 0; j < 8; j++) - bitmap.pix32(y, (i * 8) + j) = palette[(data & (1 << j)) ? 1 : 0]; - } - } -} - -READ8_MEMBER(peoplepc_state::get_slave_ack) -{ - if (offset == 7) - return m_pic_1->acknowledge(); - - return 0x00; -} - -WRITE16_MEMBER(peoplepc_state::charram_w) -{ - m_charram[offset] = data; - m_gfxdecode->gfx(0)->mark_dirty(offset/16); -} - -WRITE_LINE_MEMBER(peoplepc_state::tty_clock_tick_w) -{ - m_8251ser->write_txc(state); - m_8251ser->write_rxc(state); -} - -WRITE_LINE_MEMBER(peoplepc_state::kbd_clock_tick_w) -{ - m_8251key->write_txc(state); - m_8251key->write_rxc(state); -} - -WRITE8_MEMBER(peoplepc_state::dmapg_w) -{ - m_dma0pg = data; -} - -WRITE_LINE_MEMBER(peoplepc_state::tc_w) -{ - m_fdc->tc_w(state); -} - -WRITE_LINE_MEMBER(peoplepc_state::hrq_w) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state); - m_dmac->hlda_w(state); -} - -READ8_MEMBER(peoplepc_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset | (m_dma0pg << 16)); -} - -WRITE8_MEMBER(peoplepc_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - prog_space.write_byte(offset | (m_dma0pg << 16), data); -} - -int peoplepc_state::floppy_load(floppy_image_device *dev) -{ - dev->mon_w(0); - return IMAGE_INIT_PASS; -} - -void peoplepc_state::floppy_unload(floppy_image_device *dev) -{ - dev->mon_w(1); -} - -void peoplepc_state::machine_reset() -{ - m_flop0->get_device()->mon_w(!m_flop0->get_device()->exists()); - m_flop1->get_device()->mon_w(!m_flop1->get_device()->exists()); -} - -void peoplepc_state::machine_start() -{ - m_gfxdecode->set_gfx(0, global_alloc(gfx_element(machine().device("palette"), peoplepc_charlayout, &m_charram[0], 0, 1, 0))); - m_dma0pg = 0; - - // FIXME: cheat as there no docs about how or obvious ports that set to control the motor - m_flop0->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(peoplepc_state::floppy_load), this)); - m_flop0->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(peoplepc_state::floppy_unload), this)); - m_flop1->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(peoplepc_state::floppy_load), this)); - m_flop1->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(peoplepc_state::floppy_unload), this)); -} - -static ADDRESS_MAP_START( peoplepc_map, AS_PROGRAM, 16, peoplepc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x7ffff) AM_RAM - AM_RANGE(0xc0000, 0xdffff) AM_RAM AM_SHARE("gvram") - AM_RANGE(0xe0000, 0xe3fff) AM_RAM AM_SHARE("cvram") - AM_RANGE(0xe4000, 0xe5fff) AM_WRITE(charram_w) - AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(peoplepc_io, AS_IO, 16, peoplepc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0014, 0x0017) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x0018, 0x001b) AM_DEVREADWRITE8("pic8259_0", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x0020, 0x0031) AM_DEVREADWRITE8("i8257", i8257_device, read, write, 0x00ff) - AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0x00ff) - AM_RANGE(0x0048, 0x004f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0x00ff) - AM_RANGE(0x0054, 0x0055) AM_DEVREADWRITE8("i8251_0", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0x0056, 0x0057) AM_DEVREADWRITE8("i8251_0", i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0x005c, 0x005d) AM_DEVREADWRITE8("i8251_1", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0x005e, 0x005f) AM_DEVREADWRITE8("i8251_1", i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0x0064, 0x0067) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff) - AM_RANGE(0x006c, 0x006d) AM_DEVWRITE8("h46505", mc6845_device, address_w, 0x00ff) - AM_RANGE(0x006e, 0x006f) AM_DEVREADWRITE8("h46505", mc6845_device, register_r, register_w, 0x00ff) - AM_RANGE(0x0070, 0x0071) AM_WRITE8(dmapg_w, 0x00ff) -ADDRESS_MAP_END - -static SLOT_INTERFACE_START( peoplepc_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( peoplepc_state::floppy_formats ) - FLOPPY_IMD_FORMAT -FLOPPY_FORMATS_END - -SLOT_INTERFACE_START( peoplepc_keyboard_devices ) - SLOT_INTERFACE("keyboard", SERIAL_KEYBOARD) -SLOT_INTERFACE_END - -static DEVICE_INPUT_DEFAULTS_START(keyboard) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_1200 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -static MACHINE_CONFIG_START( olypeopl, peoplepc_state) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, XTAL_14_7456MHz/3) - MCFG_CPU_PROGRAM_MAP(peoplepc_map) - MCFG_CPU_IO_MAP(peoplepc_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_0", pic8259_device, inta_cb) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_14_7456MHz/6) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(peoplepc_state, kbd_clock_tick_w)) - MCFG_PIT8253_CLK1(XTAL_14_7456MHz/6) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(peoplepc_state, tty_clock_tick_w)) - MCFG_PIT8253_CLK2(XTAL_14_7456MHz/6) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic8259_0", pic8259_device, ir0_w)) - - MCFG_PIC8259_ADD("pic8259_0", INPUTLINE("maincpu", 0), VCC, READ8(peoplepc_state, get_slave_ack)) - MCFG_PIC8259_ADD("pic8259_1", DEVWRITELINE("pic8259_0", pic8259_device, ir7_w), GND, NULL) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_22MHz,640,0,640,475,0,475) - MCFG_SCREEN_UPDATE_DEVICE( "h46505", mc6845_device, screen_update ) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_MC6845_ADD("h46505", H46505, "screen", XTAL_22MHz/8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(peoplepc_state, update_row) - - MCFG_DEVICE_ADD("i8257", I8257, XTAL_14_7456MHz/3) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(peoplepc_state, hrq_w)) - MCFG_I8257_OUT_TC_CB(WRITELINE(peoplepc_state, tc_w)) - MCFG_I8257_IN_MEMR_CB(READ8(peoplepc_state, memory_read_byte)) - MCFG_I8257_OUT_MEMW_CB(WRITE8(peoplepc_state, memory_write_byte)) - MCFG_I8257_IN_IOR_0_CB(DEVREAD8("upd765", upd765a_device, mdma_r)) - MCFG_I8257_OUT_IOW_0_CB(DEVWRITE8("upd765", upd765a_device, mdma_w)) - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE("pic8259_0", pic8259_device, ir2_w)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("i8257", i8257_device, dreq0_w)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", peoplepc_floppies, "525qd", peoplepc_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", peoplepc_floppies, "525qd", peoplepc_state::floppy_formats) - - MCFG_DEVICE_ADD("i8251_0", I8251, 0) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259_1", pic8259_device, ir1_w)) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("kbd", rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD("kbd", peoplepc_keyboard_devices, "keyboard") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251_0", i8251_device, write_rxd)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("keyboard", keyboard) - - MCFG_DEVICE_ADD("i8251_1", I8251, 0) -MACHINE_CONFIG_END - -ROM_START( olypeopl ) - ROM_REGION(0x2000,"maincpu", 0) - ROM_SYSTEM_BIOS(0, "hd", "HD ROM") - ROMX_LOAD( "u01271c0.bin", 0x00000, 0x1000, CRC(8e0ef114) SHA1(774bab0a3e29853e9f6b951cf73082063ea61e6d), ROM_SKIP(1)|ROM_BIOS(1)) - ROMX_LOAD( "u01271d0.bin", 0x00001, 0x1000, CRC(e2419bf9) SHA1(d88381f8709c91e2adba08f378e29bd0d19ee5ae), ROM_SKIP(1)|ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "2fd", "2 FD ROM") - ROMX_LOAD( "u01277f3.bin", 0x00000, 0x1000, CRC(428ff135) SHA1(ec11f0e43455570c40f5dc4b84f8420da5939368), ROM_SKIP(1)|ROM_BIOS(2)) - ROMX_LOAD( "u01277g3.bin", 0x00001, 0x1000, CRC(3295691c) SHA1(7d7ade62117d11656b8dd86cf0703127616d55bc), ROM_SKIP(1)|ROM_BIOS(2)) -ROM_END - -COMP( 198?, olypeopl, 0, 0, olypeopl, 0, driver_device, 0, "Olympia", "People PC", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mess/drivers/pes.c b/src/mess/drivers/pes.c deleted file mode 100644 index f80cb743f21..00000000000 --- a/src/mess/drivers/pes.c +++ /dev/null @@ -1,285 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/****************************************************************************** -* -* Pacific Educational Systems 'PES' Speech box -* Part number VPU-1 V1 -* By Kevin 'kevtris' Horton and Jonathan Gevaryahu AKA Lord Nightmare -* -* RE work done by Kevin Horton and Jonathan Gevaryahu -* -* DONE: -* compiles correctly -* rom loads correctly -* interface with tms5220 is done -* rts and cts bits are stored in struct -* serial is attached to terminal -* -* TODO: -* serial receive clear should happen after delay of one cpu cycle, not ASSERT and then CLEAR immediately after -* figure out how to attach serial to external socket -* -*********************************************************************** -This is almost as simple as hardware gets from the digital side: -Hardware consists of: -10.245Mhz xtal -80c31 cpu/mcu -27c64 rom (holds less than 256 bytes of code) -unpopulated 6164 sram, which isn't used -TSP5220C speech chip (aka tms5220c) -mc145406 RS232 driver/receiver (+-24v to 0-5v converter for serial i/o) -74hc573b1 octal tri-state D-latch (part of bus interface for ROM) -74hc74b1 dual d-flipflop with set/reset, positive edge trigger (?) -74hc02b1 quad 2-input NOR gate (wired up to decode address 0, and data 0 and 1 to produce /RS and /WS) -mc14520b dual 4-bit binary up counter (used as a chopper for the analog filter) -Big messy analog section to allow voice output to be filtered extensively by a 4th order filter - -Address map: -80C31 ADDR: - 0000-1FFF: ROM - 2000-3FFF: open bus (would be ram) - 4000-ffff: open bus -80C31 IO: - 00 W: d0 and d1 are the /RS and /WS bits - port 1.x: tms5220 bus - port 2.x: unused - port 3.0: RxD serial receive - port 3.1: TxD serial send - port 3.2: read, from /INT on tms5220c - port 3.3: read, from /READY on tms5220c - port 3.4: read, from the serial RTS line - port 3.5: read/write, to the serial CTS line, inverted (effectively /CTS) - port 3.6: write, /WR (general) and /WE (pin 27) for unpopulated 6164 SRAM - port 3.7: write, /RD (general) and /OE (pin 22) for unpopulated 6164 SRAM - -*/ -#define CPU_CLOCK XTAL_10_245MHz - -#undef DEBUG_FIFO -#undef DEBUG_SERIAL_CB -#undef DEBUG_PORTS - -/* Core includes */ -#include "emu.h" -#include "includes/pes.h" -#include "cpu/mcs51/mcs51.h" -#include "sound/tms5220.h" - -/* Devices */ -WRITE8_MEMBER(pes_state::pes_kbd_input) -{ -#ifdef DEBUG_FIFO - fprintf(stderr,"keyboard input: %c, ", data); -#endif - // if fifo is full (head ptr = tail ptr-1), do not increment the head ptr and do not store the data - if (((m_infifo_tail_ptr-1)&0x1F) == m_infifo_head_ptr) - { - logerror("infifo was full, write ignored!\n"); -#ifdef DEBUG_FIFO - fprintf(stderr,"infifo was full, write ignored!\n"); -#endif - return; - } - m_infifo[m_infifo_head_ptr] = data; - m_infifo_head_ptr++; - m_infifo_head_ptr&=0x1F; -#ifdef DEBUG_FIFO - fprintf(stderr,"kb input fifo fullness: %d\n",(m_infifo_head_ptr-m_infifo_tail_ptr)&0x1F); -#endif - // todo: following two should be set so clear happens after one cpu cycle - m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); - m_maincpu->set_input_line(MCS51_RX_LINE, CLEAR_LINE); -} - -/* Helper Functions */ -READ8_MEMBER( pes_state::data_to_i8031) -{ - UINT8 data; - data = m_infifo[m_infifo_tail_ptr]; - // if fifo is empty (tail ptr == head ptr), do not increment the tail ptr, otherwise do. - if (m_infifo_tail_ptr != m_infifo_head_ptr) m_infifo_tail_ptr++; - m_infifo_tail_ptr&=0x1F; -#ifdef DEBUG_SERIAL_CB - fprintf(stderr,"callback: input to i8031/pes from pc/terminal: %02X\n",data); -#endif - return data; -} - -WRITE8_MEMBER(pes_state::data_from_i8031) -{ - m_terminal->write(space,0,data); -#ifdef DEBUG_SERIAL_CB - fprintf(stderr,"callback: output from i8031/pes to pc/terminal: %02X\n",data); -#endif -} - -/* Port Handlers */ -WRITE8_MEMBER( pes_state::rsws_w ) -{ - m_wsstate = data&0x1; // /ws is bit 0 - m_rsstate = (data&0x2)>>1; // /rs is bit 1 -#ifdef DEBUG_PORTS - logerror("port0 write: RSWS states updated: /RS: %d, /WS: %d\n", m_rsstate, m_wsstate); -#endif - m_speech->rsq_w(m_rsstate); - m_speech->wsq_w(m_wsstate); -} - -WRITE8_MEMBER( pes_state::port1_w ) -{ -#ifdef DEBUG_PORTS - logerror("port1 write: tms5220 data written: %02X\n", data); -#endif - m_speech->data_w(space, 0, data); - -} - -READ8_MEMBER( pes_state::port1_r ) -{ - UINT8 data = 0xFF; - data = m_speech->status_r(space, 0); -#ifdef DEBUG_PORTS - logerror("port1 read: tms5220 data read: 0x%02X\n", data); -#endif - return data; -} - -/*#define P3_RXD (((state->m_port3_data)&(1<<0))>>0) -#define P3_TXD (((state->m_port3_data)&(1<<1))>>1) -#define P3_INT (((state->m_port3_data)&(1<<2))>>2) -#define P3_RDY (((state->m_port3_data)&(1<<3))>>3) -#define P3_RTS (((state->m_port3_data)&(1<<4))>>4) -#define P3_CTS (((state->m_port3_data)&(1<<5))>>5) -#define P3_WR (((state->m_port3_data)&(1<<6))>>6) -#define P3_RD (((state->m_port3_data)&(1<<7))>>7) -*/ -WRITE8_MEMBER( pes_state::port3_w ) -{ - m_port3_state = data; -#ifdef DEBUG_PORTS - logerror("port3 write: control data written: %02X; ", data); - logerror("RXD: %d; ", BIT(data,0)); - logerror("TXD: %d; ", BIT(data,1)); - logerror("/INT: %d; ", BIT(data,2)); - logerror("/RDY: %d; ", BIT(data,3)); - logerror("RTS: %d; ", BIT(data,4)); - logerror("CTS: %d; ", BIT(data,5)); - logerror("WR: %d; ", BIT(data,6)); - logerror("RD: %d;\n", BIT(data,7)); -#endif - // todo: poke serial handler here somehow? -} - -READ8_MEMBER( pes_state::port3_r ) -{ - UINT8 data = m_port3_state & 0xE3; // return last written state with rts, /rdy and /int masked out - // check rts state; if virtual fifo is nonzero, rts is set, otherwise it is cleared - if (m_infifo_tail_ptr != m_infifo_head_ptr) - { - data |= 0x10; // set RTS bit - } - data |= (m_speech->intq_r()<<2); - data |= (m_speech->readyq_r()<<3); -#ifdef DEBUG_PORTS - logerror("port3 read: returning 0x%02X: ", data); - logerror("RXD: %d; ", BIT(data,0)); - logerror("TXD: %d; ", BIT(data,1)); - logerror("/INT: %d; ", BIT(data,2)); - logerror("/RDY: %d; ", BIT(data,3)); - logerror("RTS: %d; ", BIT(data,4)); - logerror("CTS: %d; ", BIT(data,5)); - logerror("WR: %d; ", BIT(data,6)); - logerror("RD: %d;\n", BIT(data,7)); -#endif - return data; -} - - -/* Reset */ -void pes_state::machine_reset() -{ - // clear fifos (TODO: memset would work better here...) - int i; - for (i=0; i<32; i++) m_infifo[i] = 0; - m_infifo_tail_ptr = m_infifo_head_ptr = 0; - m_wsstate = 1; - m_rsstate = 1; - - m_port3_state = 0; // reset the openbus state of port 3 - //m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // this causes debugger to fail badly if included - machine().device("tms5220")->reset(); // reset the 5220 -} - -/****************************************************************************** - Driver Init and Timer Callbacks -******************************************************************************/ -/*static TIMER_CALLBACK_MEMBER(pes_state::serial_read_cb ) -{ - timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ); -}*/ - -DRIVER_INIT_MEMBER(pes_state,pes) -{ - m_maincpu->i8051_set_serial_tx_callback(write8_delegate(FUNC(pes_state::data_from_i8031),this)); - m_maincpu->i8051_set_serial_rx_callback(read8_delegate(FUNC(pes_state::data_to_i8031),this)); -} - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(i80c31_mem, AS_PROGRAM, 8, pes_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM /* 27C64 ROM */ - // AM_RANGE(0x2000, 0x3fff) AM_RAM /* 6164 8k SRAM, not populated */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, pes_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0, 0x0) AM_WRITE(rsws_w) /* /WS(0) and /RS(1) */ - AM_RANGE(0x1, 0x1) AM_READWRITE(port1_r, port1_w) /* tms5220 reads and writes */ - AM_RANGE(0x3, 0x3) AM_READWRITE(port3_r, port3_w) /* writes and reads from port 3, see top of file */ -ADDRESS_MAP_END - -/****************************************************************************** - Input Ports -******************************************************************************/ -static INPUT_PORTS_START( pes ) -INPUT_PORTS_END - -/****************************************************************************** - Machine Drivers -******************************************************************************/ -static MACHINE_CONFIG_START( pes, pes_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80C31, CPU_CLOCK) - MCFG_CPU_PROGRAM_MAP(i80c31_mem) - MCFG_CPU_IO_MAP(i80c31_io) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("tms5220", TMS5220C, 720000) /* 720Khz clock, 10khz output */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(pes_state, pes_kbd_input)) -MACHINE_CONFIG_END - -/****************************************************************************** - ROM Definitions -******************************************************************************/ -ROM_START( pes ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_DEFAULT_BIOS("kevbios") - ROM_SYSTEM_BIOS( 0, "orig", "PES box with original firmware v2.5") - ROMX_LOAD( "vpu_2-5.bin", 0x0000, 0x2000, CRC(b27cfdf7) SHA1(c52acf9c080823de5ef26ac55abe168ad53a7d38), ROM_BIOS(1)) // original firmware, rather buggy, 4800bps serial, buggy RTS/CTS flow control, no buffer - ROM_SYSTEM_BIOS( 1, "kevbios", "PES box with kevtris' rewritten firmware") - ROMX_LOAD( "pes.bin", 0x0000, 0x2000, CRC(22c1c4ec) SHA1(042e139cd0cf6ffafcd88904f1636c6fa1b38f25), ROM_BIOS(2)) // rewritten firmware by kevtris, 4800bps serial, RTS/CTS plus XON/XOFF flow control, 64 byte buffer -ROM_END - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, pes, 0, 0, pes, pes, pes_state, pes, "Pacific Educational Systems", "VPU-01 Speech box", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pet.c b/src/mess/drivers/pet.c deleted file mode 100644 index f8bb9a06933..00000000000 --- a/src/mess/drivers/pet.c +++ /dev/null @@ -1,2620 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -http://www.6502.org/users/andre/petindex/boards.html - -Static Board (PET 2001) ------------------------ - -Four variations based on type of RAM(6550 or 2114) and ROM(6540 or 2316B). -4K or 8K static RAM (selected by jumper). -40 column display -A video interrupt interferes with disk drive operation. -Display timing not compatible with Basic 4.0. -ROM sockets: A2 2K character ROM sockets: A2 2K character - (2316B) H1 C000-CFFF (6540) H1 C000-C7FF - H2 D000-DFFF H2 D000-D7FF - H3 E000-E7FF H3 E000-E7FF - H4 F000-FFFF H4 F000-F7FF - H5 C000-CFFF H5 C800-CFFF - H6 D000-DFFF H6 D800-DFFF - H7 F000-FFFF H7 F800-FFFF - - - IEEE user tape #2 - +------####-####--##-+ - ! # - ! # - ! # exp - ! # bus - ! # - ! # 2000 Series - ! ! circa 1977/78 Max RAM - 8k - ! (2k) ROMS ! [w/daughter board exp to 32k shown] - ! F F E D D C C ! - ! 8 0 0 8 0 8 0 ! - ! ! -tape # RAM MEMORY ! - #1 # ! - +--------------------+ - - -Dynamic Board (PET/CBM 2001-N/2001-B/4000) ------------------------------------------- - -4K, 8K, 16K or 32K dynamic RAM (selected by jumper). -40 column display -Can run all versions of 40 column Basic (Basic 1 must be copied to 4K ROMs) -Can be jumpered to replace the older board. -ROM sockets: UD3 9000-9FFF - UD4 A000-AFFF - UD5 B000-BFFF - UD6 C000-CFFF - UD7 D000-DFFF - UD8 E000-E7FF - UD9 F000-FFFF - UF10 2K character - - - IEEE user tape #1 - +------####-####--##-+ - ! #! - ! #! - ! #! exp - ! ROMS #! bus - ! F E D C B A 9 #! - ! #! 3000, 4000 Series - ! ! (3000 series is European version) - ! ! circa 1979/80 Max RAM - 32k - ! ! - ! ! - ! ! -tape # RAM MEMORY ! - #2 # ! - +--------------------+ - - -80 Column Board (CBM 8000) --------------------------- - -16K or 32K RAM (selected by jumper). -Uses CTRC to generate 80 column display. -Can only run the 80 column version of Basic 4.0. -Not compatible with older boards. -ROM sockets: UA3 2K or 4K character - UD6 F000-FFFF - UD7 E000-E7FF - UD8 D000-DFFF - UD9 C000-CFFF - UD10 B000-BFFF - UD11 A000-AFFF - UD12 9000-9FFF - -The layout is the same of the one used in Universal Boards below. - - -Universal Board (CBM 8000/PET 4000-12) --------------------------------------- - -This is an 80 column board with jumpers for different configurations. -16K or 32K RAM (selected by jumper). -Uses CTRC to generate 40 or 80 column display (selected by jumpers). -Can only run Basic 4.0 versions that support the CRTC. -Can be jumpered to replace all older boards. -ROM sockets: UA3 2K or 4K character - UD6 F000-FFFF - UD7 E000-E7FF - UD8 D000-DFFF - UD9 C000-CFFF - UD10 B000-BFFF - UD11 A000-AFFF - UD12 9000-9FFF - - - IEEE user tape #1 - +------####-####--##-+ - ! # # tape - ! # # #2 - ! R exp bus # ! - ! A #! - ! M 9 #! - ! A #! 4000, 8000 Series - ! M R B ! circa 1981 Max RAM - 32k* - ! E O C ! [8296 layout not shown] - ! M M D ! - ! O S E ! - ! R F ! - ! Y ! - ! spkr! - +--------------------+ -*/ - -/* - - TODO: - - - accurate video timing for non-CRTC models - - High Speed Graphics board - - keyboard layouts - - Swedish - - German - - SuperPET - - 6809 - - OS/9 MMU - - 8296 - - PLA dumps - - high resolution graphics - - Malvern Particle Sizer OEM variant - -*/ - -#include "includes/pet.h" -#include "bus/ieee488/c2040.h" -#include "machine/cbm_snqk.h" - - - -static void cbm_pet_quick_sethiaddress( address_space &space, UINT16 hiaddress ) -{ - space.write_byte(0x2e, hiaddress & 0xff); - space.write_byte(0x2c, hiaddress & 0xff); - space.write_byte(0x2a, hiaddress & 0xff); - space.write_byte(0x2f, hiaddress >> 8); - space.write_byte(0x2d, hiaddress >> 8); - space.write_byte(0x2b, hiaddress >> 8); -} - -QUICKLOAD_LOAD_MEMBER( pet_state, cbm_pet ) -{ - return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_pet_quick_sethiaddress); -} - - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// check_interrupts - -//------------------------------------------------- - -void pet_state::check_interrupts() -{ - int irq = m_via_irq || m_pia1a_irq || m_pia1b_irq || m_pia2a_irq || m_pia2b_irq || m_exp_irq; - - m_maincpu->set_input_line(M6502_IRQ_LINE, irq); - m_exp->irq_w(irq); -} - - -//------------------------------------------------- -// update_speaker - -//------------------------------------------------- - -void pet_state::update_speaker() -{ - if (m_speaker) - { - int level = m_via_cb2 && m_pia1_pa7; - - m_speaker->level_w(level); - } -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( pet_state::read ) -{ - int sel = offset >> 12; - int norom = m_exp->norom_r(space, offset, sel); - UINT8 data = 0; - - data = m_exp->read(space, offset, data, sel); - - switch (sel) - { - case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7: - if (offset < m_ram->size()) - { - data = m_ram->pointer()[offset]; - } - break; - - case SEL8: - data = m_video_ram[offset & (m_video_ram_size - 1)]; - break; - - case SEL9: - if (norom) - { - if (m_cart_9000 && m_cart_9000->exists()) - data = m_cart_9000->read_rom(space, offset & 0xfff); - else - data = m_rom->base()[offset - 0x9000]; - } - break; - - case SELA: - if (norom) - { - if (m_cart_a000 && m_cart_a000->exists()) - data = m_cart_a000->read_rom(space, offset & 0xfff); - else - data = m_rom->base()[offset - 0x9000]; - } - break; - - case SELB: - if (norom) - { - if (m_cart_b000 && m_cart_b000->exists()) - data = m_cart_b000->read_rom(space, offset & 0xfff); - else - data = m_rom->base()[offset - 0x9000]; - } - break; - - case SELC: case SELD: case SELF: - if (norom) - { - data = m_rom->base()[offset - 0x9000]; - } - break; - - case SELE: - if (BIT(offset, 11)) - { - data = 0xff; - - if (BIT(offset, 4)) - { - data &= m_pia1->read(space, offset & 0x03); - } - if (BIT(offset, 5)) - { - data &= m_pia2->read(space, offset & 0x03); - } - if (BIT(offset, 6)) - { - data &= m_via->read(space, offset & 0x0f); - } - if (m_crtc && BIT(offset, 7) && BIT(offset, 0)) - { - data &= m_crtc->register_r(space, 0); - } - } - else if (norom) - { - data = m_rom->base()[offset - 0x9000]; - } - break; - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( pet_state::write ) -{ - int sel = offset >> 12; - - m_exp->write(space, offset, data, sel); - - switch (sel) - { - case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7: - if (offset < m_ram->size()) - { - m_ram->pointer()[offset] = data; - } - break; - - case SEL8: - m_video_ram[offset & (m_video_ram_size - 1)] = data; - break; - - case SELE: - if (BIT(offset, 11)) - { - if (BIT(offset, 4)) - { - m_pia1->write(space, offset & 0x03, data); - } - if (BIT(offset, 5)) - { - m_pia2->write(space, offset & 0x03, data); - } - if (BIT(offset, 6)) - { - m_via->write(space, offset & 0x0f, data); - } - if (m_crtc && BIT(offset, 7)) - { - if (BIT(offset, 0)) - { - m_crtc->register_w(space, 0, data); - } - else - { - m_crtc->address_w(space, 0, data); - } - } - } - break; - } -} - -//------------------------------------------------- -// read_pla1 - -//------------------------------------------------- - -void cbm8296_state::read_pla1(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, - int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1) -{ - UINT32 input = (offset & 0xff00) | phi2 << 7 | brw << 6 | noscreen << 5 | noio << 4 | ramsela << 3 | ramsel9 << 2 | ramon << 1 | norom; - UINT32 data = m_pla1->read(input); - - cswff = BIT(data, 0); - cs9 = BIT(data, 1); - csa = BIT(data, 2); - csio = BIT(data, 3); - cse = BIT(data, 4); - cskb = BIT(data, 5); - fa12 = BIT(data, 6); - casena1 = BIT(data, 7); -} - -void cbm8296_state::read_pla1_eprom(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, - int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1) -{ - // PLA-EPROM adapter by Joachim Nemetz (Jogi) - - UINT32 input = (offset & 0xff00) | phi2 << 7 | brw << 6 | noscreen << 5 | noio << 4 | ramsela << 3 | ramsel9 << 2 | ramon << 1 | norom; - input = BITSWAP16(input,13,8,9,7,12,14,11,10,6,5,4,3,2,1,0,15); - - UINT8 data = m_ue6_rom->base()[input]; - data = BITSWAP8(data,7,0,1,2,3,4,5,6); - - cswff = BIT(data, 0); - cs9 = BIT(data, 1); - csa = BIT(data, 2); - csio = BIT(data, 3); - cse = BIT(data, 4); - cskb = BIT(data, 5); - fa12 = BIT(data, 6); - casena1 = BIT(data, 7); -} - - -//------------------------------------------------- -// read_pla2 - -//------------------------------------------------- - -void cbm8296_state::read_pla2(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15) -{ - UINT32 input = BITSWAP8(m_cr, 0,1,2,3,4,5,6,7) << 8 | ((offset >> 8) & 0xf8) | brw << 2 | phi2 << 1 | casena1; - UINT32 data = m_pla2->read(input); - - endra = BIT(data, 4); - noscreen = BIT(data, 5); - casena2 = BIT(data, 6); - fa15 = BIT(data, 7); -} - -void cbm8296_state::read_pla2_eprom(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15) -{ - // PLA-EPROM adapter by Joachim Nemetz (Jogi) - - UINT32 input = BITSWAP8(m_cr, 0,1,2,3,4,5,6,7) << 8 | ((offset >> 8) & 0xf8) | brw << 2 | phi2 << 1 | casena1; - input = BITSWAP16(input,13,8,9,7,12,14,11,10,6,5,4,3,2,1,0,15); - - UINT8 data = m_ue5_rom->base()[input]; - data = BITSWAP8(data,7,0,1,2,3,4,5,6); - - endra = BIT(data, 4); - noscreen = BIT(data, 5); - casena2 = BIT(data, 6); - fa15 = BIT(data, 7); -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( cbm8296_state::read ) -{ - int norom = m_exp->norom_r(space, offset, offset >> 12) && !BIT(m_cr, 7); - int phi2 = 1, brw = 1, noscreen = 1, noio = BIT(m_cr, 6); - int ramsela = BIT(m_via_pa, 0), ramsel9 = BIT(m_via_pa, 1), ramon = BIT(m_via_pa, 2); - int cswff = 1, cs9 = 1, csa = 1, csio = 1, cse = 1, cskb = 1, fa12 = 1, fa15 = 1, casena1 = 1, casena2 = 1, endra = 1; - - read_pla1_eprom(offset, phi2, brw, noscreen, noio, ramsela, ramsel9, ramon, norom, - cswff, cs9, csa, csio, cse, cskb, fa12, casena1); - - read_pla2_eprom(offset, phi2, brw, casena1, endra, noscreen, casena2, fa15); - - read_pla1_eprom(offset, phi2, brw, noscreen, noio, ramsela, ramsel9, ramon, norom, - cswff, cs9, csa, csio, cse, cskb, fa12, casena1); - - //logerror("%s read %04x : norom %u noio %u ramsela %u ramsel9 %u ramon %u / cswff %u cs9 %u csa %u csio %u cse %u cskb %u fa12 %u casena1 %u endra %u noscreen %u casena2 %u fa15 %u\n",machine().describe_context(),offset,norom,noio,ramsela,ramsel9,ramon,cswff,cs9,csa,csio,cse,cskb,fa12,casena1,endra,noscreen,casena2,fa15); - - UINT8 data = 0; - - offs_t drma = fa15 << 15 | (offset & 0x7e00) | BIT(offset, 0) << 8 | (offset & 0x1fe) >> 1; - - if (!endra && !casena1) - { - data = m_ram->pointer()[drma]; - } - if (casena2) - { - data = m_ram->pointer()[0x10000 | drma]; - } - if (!cs9) - { - if (m_cart_9000 && m_cart_9000->exists()) - data = m_cart_9000->read_rom(space, offset & 0xfff); - else - data = m_rom->base()[offset & 0xfff]; - } - if (!csa) - { - if (m_cart_a000 && m_cart_a000->exists()) - data = m_cart_a000->read_rom(space, offset & 0xfff); - else - data = m_rom->base()[0x1000 | (offset & 0xfff)]; - } - if (!cse) - { - data = m_editor_rom->base()[offset & 0xfff]; - } - if (!cskb) - { - data = m_basic_rom->base()[(offset & 0x2fff) | fa12 << 12]; - } - if (!csio) - { - data = 0xff; - - if (BIT(offset, 4)) - { - data &= m_pia1->read(space, offset & 0x03); - } - if (BIT(offset, 5)) - { - data &= m_pia2->read(space, offset & 0x03); - } - if (BIT(offset, 6)) - { - data &= m_via->read(space, offset & 0x0f); - } - if (BIT(offset, 7) && BIT(offset, 0)) - { - data &= m_crtc->register_r(space, 0); - } - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( cbm8296_state::write ) -{ - int norom = m_exp->norom_r(space, offset, offset >> 12) && !BIT(m_cr, 7); - int phi2 = 1, brw = 0, noscreen = 1, noio = BIT(m_cr, 6); - int ramsela = BIT(m_via_pa, 0), ramsel9 = BIT(m_via_pa, 1), ramon = BIT(m_via_pa, 2); - int cswff = 1, cs9 = 1, csa = 1, csio = 1, cse = 1, cskb = 1, fa12 = 1, fa15 = 1, casena1 = 1, casena2 = 1, endra = 1; - - read_pla1_eprom(offset, phi2, brw, noscreen, noio, ramsela, ramsel9, ramon, norom, - cswff, cs9, csa, csio, cse, cskb, fa12, casena1); - - read_pla2_eprom(offset, phi2, brw, casena1, endra, noscreen, casena2, fa15); - - read_pla1_eprom(offset, phi2, brw, noscreen, noio, ramsela, ramsel9, ramon, norom, - cswff, cs9, csa, csio, cse, cskb, fa12, casena1); - - //logerror("%s write %04x : norom %u noio %u ramsela %u ramsel9 %u ramon %u / cswff %u cs9 %u csa %u csio %u cse %u cskb %u fa12 %u casena1 %u endra %u noscreen %u casena2 %u fa15 %u\n",machine().describe_context(),offset,norom,noio,ramsela,ramsel9,ramon,cswff,cs9,csa,csio,cse,cskb,fa12,casena1,endra,noscreen,casena2,fa15); - - offs_t drma = fa15 << 15 | (offset & 0x7e00) | BIT(offset, 0) << 8 | (offset & 0x1fe) >> 1; - - if (!endra && !casena1) - { - m_ram->pointer()[drma] = data; - } - if (casena2) - { - m_ram->pointer()[0x10000 | drma] = data; - } - if (!csio) - { - if (BIT(offset, 4)) - { - m_pia1->write(space, offset & 0x03, data); - } - if (BIT(offset, 5)) - { - m_pia2->write(space, offset & 0x03, data); - } - if (BIT(offset, 6)) - { - m_via->write(space, offset & 0x0f, data); - } - if (BIT(offset, 7)) - { - if (BIT(offset, 0)) - { - m_crtc->register_w(space, 0, data); - } - else - { - m_crtc->address_w(space, 0, data); - } - } - } - if (cswff && ((offset & 0xff) == 0xf0)) - { - m_cr = data; - } -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( pet2001_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( pet2001_mem, AS_PROGRAM, 8, pet_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( cbm8296_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( cbm8296_mem, AS_PROGRAM, 8, cbm8296_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( pet ) -//------------------------------------------------- - -static INPUT_PORTS_START( pet ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr Screen") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x2190) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('#') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('!') - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('\\') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('$') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('"') - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR(0x03C0) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR(';') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START( "ROW8" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) - - PORT_START( "ROW9" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('=') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('<') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('[') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Rvs Off") PORT_CODE(KEYCODE_TAB) - - PORT_START( "LOCK" ) - PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( petb ) -//------------------------------------------------- - -INPUT_PORTS_START( petb ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_DEL) PORT_CHAR('^') - - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Repeat") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START( "ROW8" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr Screen") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Rvs Off") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START( "ROW9" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_END) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) - - PORT_START( "LOCK" ) - PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( petb_de ) -//------------------------------------------------- - -INPUT_PORTS_START( petb_de ) - PORT_INCLUDE( petb ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( petb_fr ) -//------------------------------------------------- - -INPUT_PORTS_START( petb_fr ) - PORT_INCLUDE( petb ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( petb_se ) -//------------------------------------------------- - -INPUT_PORTS_START( petb_se ) - PORT_INCLUDE( petb ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -WRITE_LINE_MEMBER( pet_state::via_irq_w ) -{ - m_via_irq = state; - - check_interrupts(); -} - -WRITE8_MEMBER( pet_state::via_pa_w ) -{ - m_user->write_c((data>>0)&1); - m_user->write_d((data>>1)&1); - m_user->write_e((data>>2)&1); - m_user->write_f((data>>3)&1); - m_user->write_h((data>>4)&1); - m_user->write_j((data>>5)&1); - m_user->write_k((data>>6)&1); - m_user->write_l((data>>7)&1); - - m_via_pa = data; -} - -READ8_MEMBER( pet_state::via_pb_r ) -{ - /* - - bit description - - PB0 _NDAC IN - PB1 - PB2 - PB3 - PB4 - PB5 SYNC IN - PB6 _NRFD IN - PB7 _DAV IN - - */ - - UINT8 data = 0; - - // video sync - data |= (m_crtc ? m_crtc->vsync_r() : m_sync) << 5; - - // IEEE-488 - data |= m_ieee->ndac_r(); - data |= m_ieee->nrfd_r() << 6; - data |= m_ieee->dav_r() << 7; - - return data; -} - -WRITE8_MEMBER( pet_state::via_pb_w ) -{ - /* - - bit description - - PB0 - PB1 _NRFD OUT - PB2 _ATN OUT - PB3 CASS WRITE - PB4 #2 CASS MOTOR - PB5 - PB6 - PB7 - - */ - - // IEEE-488 - m_ieee->nrfd_w(BIT(data, 1)); - m_ieee->atn_w(BIT(data, 2)); - - // cassette - m_cassette->write(BIT(data, 3)); - m_cassette2->write(BIT(data, 3)); - m_cassette2->motor_w(BIT(data, 4)); -} - -WRITE_LINE_MEMBER( pet_state::via_ca2_w ) -{ - m_graphic = state; -} - -WRITE_LINE_MEMBER( pet_state::via_cb2_w ) -{ - m_via_cb2 = state; - update_speaker(); - - m_user->write_m(state); -} - - -WRITE_LINE_MEMBER( pet_state::pia1_irqa_w ) -{ - m_pia1a_irq = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( pet_state::pia1_irqb_w ) -{ - m_pia1b_irq = state; - - check_interrupts(); -} - -READ8_MEMBER( pet_state::pia1_pa_r ) -{ - /* - - bit description - - PA0 KEY A - PA1 KEY B - PA2 KEY C - PA3 KEY D - PA4 #1 CASS SWITCH - PA5 #2 CASS SWITCH - PA6 _EOI IN - PA7 DIAG JUMPER - - */ - - UINT8 data = 0; - - // keyboard - data |= m_key; - - // cassette - data |= m_cassette->sense_r() << 4; - data |= m_cassette2->sense_r() << 5; - - // IEEE-488 - data |= m_ieee->eoi_r() << 6; - - // diagnostic jumper - data |= (m_user_diag && m_exp->diag_r()) << 7; - - return data; -} - -WRITE8_MEMBER( pet_state::pia1_pa_w ) -{ - /* - - bit description - - PA0 KEY A - PA1 KEY B - PA2 KEY C - PA3 KEY D - PA4 - PA5 - PA6 - PA7 SPEAKER - - */ - - // keyboard - m_key = data & 0x0f; - - // speaker - m_pia1_pa7 = BIT(data, 7); - update_speaker(); -} - -READ8_MEMBER( pet_state::pia1_pb_r ) -{ - UINT8 data = 0xff; - - switch (m_key) - { - case 0: data &= m_row0->read(); break; - case 1: data &= m_row1->read(); break; - case 2: data &= m_row2->read(); break; - case 3: data &= m_row3->read(); break; - case 4: data &= m_row4->read(); break; - case 5: data &= m_row5->read(); break; - case 6: data &= m_row6->read(); break; - case 7: data &= m_row7->read(); break; - case 8: data &= m_row8->read() & m_lock->read(); break; - case 9: data &= m_row9->read(); break; - } - - return data; -} - -READ8_MEMBER( pet2001b_state::pia1_pb_r ) -{ - UINT8 data = 0xff; - - switch (m_key) - { - case 0: data &= m_row0->read(); break; - case 1: data &= m_row1->read(); break; - case 2: data &= m_row2->read(); break; - case 3: data &= m_row3->read(); break; - case 4: data &= m_row4->read(); break; - case 5: data &= m_row5->read(); break; - case 6: data &= m_row6->read() & m_lock->read(); break; - case 7: data &= m_row7->read(); break; - case 8: data &= m_row8->read(); break; - case 9: data &= m_row9->read(); break; - } - - return data; -} - -WRITE_LINE_MEMBER( pet_state::pia1_ca2_w ) -{ - m_ieee->eoi_w(state); - - m_blanktv = state; -} - - -WRITE_LINE_MEMBER( pet_state::pia2_irqa_w ) -{ - m_pia2a_irq = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( pet_state::pia2_irqb_w ) -{ - m_pia2b_irq = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( pet_state::user_diag_w ) -{ - m_user_diag = state; -} - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -//------------------------------------------------- -// TIMER_DEVICE_CALLBACK( sync_tick ) -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER( pet_state::sync_tick ) -{ - m_sync = !m_sync; - - m_pia1->cb1_w(m_sync); -} - - -//------------------------------------------------- -// SCREEN_UPDATE( pet2001 ) -//------------------------------------------------- - -UINT32 pet_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const pen_t *pen = m_palette->pens(); - - for (int y = 0; y < 200; y++) - { - for (int sx = 0; sx < 40; sx++) - { - int sy = y / 8; - offs_t video_addr = (sy * 40) + sx; - UINT8 lsd = m_video_ram[video_addr]; - - int ra = y & 0x07; - offs_t char_addr = (m_graphic << 10) | ((lsd & 0x7f) << 3) | ra; - UINT8 data = m_char_rom->base()[char_addr]; - - for (int x = 0; x < 8; x++, data <<= 1) - { - int color = (BIT(data, 7) ^ BIT(lsd, 7)) && m_blanktv; - bitmap.pix32(y, (sx * 8) + x) = pen[color]; - } - } - } - - return 0; -} - - -//------------------------------------------------- -// MC6845 PET80 -//------------------------------------------------- - -MC6845_BEGIN_UPDATE( pet_state::pet_begin_update ) -{ - bitmap.fill(rgb_t::black); -} - -MC6845_UPDATE_ROW( pet80_state::pet80_update_row ) -{ - int x = 0; - int char_rom_mask = m_char_rom->bytes() - 1; - const pen_t *pen = m_palette->pens(); - hbp = 80; - - for (int column = 0; column < x_count; column++) - { - UINT8 lsd = 0, data = 0; - UINT8 rra = ra & 0x07; - int no_row = !(BIT(ra, 3) || BIT(ra, 4)); - int invert = BIT(ma, 12); - int chr_option = BIT(ma, 13); - - // even character - - lsd = m_video_ram[((ma + column) << 1) & 0x7ff]; - - offs_t char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; - data = m_char_rom->base()[char_addr & char_rom_mask]; - - for (int bit = 0; bit < 8; bit++, data <<= 1) - { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; - } - - // odd character - - lsd = m_video_ram[(((ma + column) << 1) + 1) & 0x7ff]; - - char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; - data = m_char_rom->base()[char_addr & char_rom_mask]; - - for (int bit = 0; bit < 8; bit++, data <<= 1) - { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; - } - } -} - - -//------------------------------------------------- -// MC6845 PET40 -//------------------------------------------------- - -MC6845_UPDATE_ROW( pet_state::pet40_update_row ) -{ - int x = 0; - int char_rom_mask = m_char_rom->bytes() - 1; - const pen_t *pen = m_palette->pens(); - hbp = 41; - - for (int column = 0; column < x_count; column++) - { - UINT8 lsd = 0, data = 0; - UINT8 rra = ra & 0x07; - int no_row = !(BIT(ra, 3) || BIT(ra, 4)); - int invert = BIT(ma, 12); - int chr_option = BIT(ma, 13); - - lsd = m_video_ram[(ma + column) & 0x3ff]; - - offs_t char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; - data = m_char_rom->base()[char_addr & char_rom_mask]; - - for (int bit = 0; bit < 8; bit++, data <<= 1) - { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; - } - } -} - - -//------------------------------------------------- -// MC6845 CBM8296 -//------------------------------------------------- - -MC6845_UPDATE_ROW( pet80_state::cbm8296_update_row ) -{ - int x = 0; - int char_rom_mask = m_char_rom->bytes() - 1; - const pen_t *pen = m_palette->pens(); - - for (int column = 0; column < x_count; column++) - { - UINT8 lsd = 0, data = 0; - UINT8 rra = ra & 0x07; - int no_row = !BIT(ra, 3); - int ra4 = BIT(ra, 4); - int chr_option = BIT(ma, 13); - offs_t vma = (ma + column) & 0x1fff; - offs_t drma = 0x8000 | ra4 << 14 | ((vma & 0xf00) << 1) | (vma & 0xff); - - // even character - - lsd = m_ram->pointer()[drma]; - - offs_t char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; - data = m_char_rom->base()[char_addr & char_rom_mask]; - - for (int bit = 0; bit < 8; bit++, data <<= 1) - { - int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; - } - - // odd character - - lsd = m_ram->pointer()[drma | 0x100]; - - char_addr = (chr_option << 11) | (m_graphic << 10) | ((lsd & 0x7f) << 3) | rra; - data = m_char_rom->base()[char_addr & char_rom_mask]; - - for (int bit = 0; bit < 8; bit++, data <<= 1) - { - int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; - } - } -} - - -//------------------------------------------------- -// SLOT_INTERFACE( cbm8296d_ieee488_devices ) -//------------------------------------------------- - -SLOT_INTERFACE_START( cbm8296d_ieee488_devices ) - SLOT_INTERFACE("c8250lp", C8250LP) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( pet ) -//------------------------------------------------- - -MACHINE_START_MEMBER( pet_state, pet ) -{ - // allocate memory - m_video_ram.allocate(m_video_ram_size); - - // initialize memory - UINT8 data = 0xff; - - for (offs_t offset = 0; offset < m_ram->size(); offset++) - { - m_ram->pointer()[offset] = data; - if (!(offset % 64)) data ^= 0xff; - } - - data = 0xff; - - for (offs_t offset = 0; offset < m_video_ram_size; offset++) - { - m_video_ram[offset] = data; - if (!(offset % 64)) data ^= 0xff; - } - - // state saving - save_item(NAME(m_key)); - save_item(NAME(m_sync)); - save_item(NAME(m_graphic)); - save_item(NAME(m_blanktv)); - save_item(NAME(m_via_irq)); - save_item(NAME(m_pia1a_irq)); - save_item(NAME(m_pia1b_irq)); - save_item(NAME(m_pia2a_irq)); - save_item(NAME(m_pia2b_irq)); - save_item(NAME(m_exp_irq)); - save_item(NAME(m_user_diag)); -} - - -//------------------------------------------------- -// MACHINE_START( pet2001 ) -//------------------------------------------------- - -MACHINE_START_MEMBER( pet_state, pet2001 ) -{ - m_video_ram_size = 0x400; - - MACHINE_START_CALL_MEMBER(pet); -} - - -MACHINE_RESET_MEMBER( pet_state, pet ) -{ - m_maincpu->reset(); - - m_via->reset(); - m_pia1->reset(); - m_pia2->reset(); - - m_exp->reset(); - - m_ieee->ren_w(0); -} - - -//------------------------------------------------- -// MACHINE_START( pet40 ) -//------------------------------------------------- - -MACHINE_START_MEMBER( pet_state, pet40 ) -{ - m_video_ram_size = 0x400; - - MACHINE_START_CALL_MEMBER(pet); -} - - -MACHINE_RESET_MEMBER( pet_state, pet40 ) -{ - MACHINE_RESET_CALL_MEMBER(pet); - - m_crtc->reset(); -} - - -//------------------------------------------------- -// MACHINE_START( pet80 ) -//------------------------------------------------- - -MACHINE_START_MEMBER( pet80_state, pet80 ) -{ - m_video_ram_size = 0x800; - - MACHINE_START_CALL_MEMBER(pet); -} - - -MACHINE_RESET_MEMBER( pet80_state, pet80 ) -{ - MACHINE_RESET_CALL_MEMBER(pet); - - m_crtc->reset(); -} - - -//------------------------------------------------- -// MACHINE_START( cbm8296 ) -//------------------------------------------------- - -MACHINE_START_MEMBER( cbm8296_state, cbm8296 ) -{ - MACHINE_START_CALL_MEMBER(pet80); - - // state saving - save_item(NAME(m_cr)); - save_item(NAME(m_via_pa)); -} - - -MACHINE_RESET_MEMBER( cbm8296_state, cbm8296 ) -{ - MACHINE_RESET_CALL_MEMBER(pet80); - - m_cr = 0; - m_via_pa = 0xff; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( 4k ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( 4k ) - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("8K,16K,32K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( 8k ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( 8k ) - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_RAM_EXTRA_OPTIONS("16K,32K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( 8k ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( 16k ) - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( 8k ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( 32k ) - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pet, pet_state ) - MCFG_MACHINE_START_OVERRIDE(pet_state, pet2001) - MCFG_MACHINE_RESET_OVERRIDE(pet_state, pet) - - // basic machine hardware - MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_8MHz/8) - MCFG_CPU_PROGRAM_MAP(pet2001_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) - MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(120)) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - // devices - MCFG_DEVICE_ADD(M6522_TAG, VIA6522, XTAL_8MHz/8) - MCFG_VIA6522_READPB_HANDLER(READ8(pet_state, via_pb_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(pet_state, via_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(pet_state, via_pb_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(pet_state, via_ca2_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(pet_state, via_cb2_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(pet_state, via_irq_w)) - - MCFG_DEVICE_ADD(M6520_1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(pet_state, pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(pet_state, pia1_pb_r)) - MCFG_PIA_READCA1_HANDLER(DEVREADLINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, read)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(pet_state, pia1_pa_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(pet_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, motor_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(pet_state, pia1_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(pet_state, pia1_irqb_w)) - - MCFG_DEVICE_ADD(M6520_2_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) - MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) - MCFG_PIA_CA2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(pet_state, pia2_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(pet_state, pia2_irqb_w)) - - MCFG_CBM_IEEE488_ADD("c4040") - MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, cb1_w)) - MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, ca1_w)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c2n", DEVWRITELINE(M6520_1_TAG, pia6821_device, ca1_w)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, cbm_datassette_devices, NULL, DEVWRITELINE(M6522_TAG, via6522_device, write_cb1)) - MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_8MHz/8, pet_expansion_cards, NULL) - MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(READ8(pet_state, read), WRITE8(pet_state, write)) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, pet_user_port_cards, NULL) - MCFG_PET_USER_PORT_5_HANDLER(WRITELINE(pet_state, user_diag_w)) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1)) - MCFG_PET_USER_PORT_C_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa0)) - MCFG_PET_USER_PORT_D_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa1)) - MCFG_PET_USER_PORT_E_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa2)) - MCFG_PET_USER_PORT_F_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa3)) - MCFG_PET_USER_PORT_H_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa4)) - MCFG_PET_USER_PORT_J_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa5)) - MCFG_PET_USER_PORT_K_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa6)) - MCFG_PET_USER_PORT_L_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa7)) - MCFG_PET_USER_PORT_M_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_cb2)) - - MCFG_QUICKLOAD_ADD("quickload", pet_state, cbm_pet, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - // software lists - MCFG_SOFTWARE_LIST_ADD("cass_list", "pet_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "pet_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "pet_hdd") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet2001, pet ) - MCFG_FRAGMENT_ADD(4k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet20018 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet20018, pet ) - MCFG_FRAGMENT_ADD(8k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001n ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet2001n, pet ) - MCFG_GENERIC_CARTSLOT_ADD("cart_9000", generic_linear_slot, "pet_9000_rom") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_GENERIC_CARTSLOT_ADD("cart_a000", generic_linear_slot, "pet_a000_rom") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_GENERIC_CARTSLOT_ADD("cart_b000", generic_linear_slot, "pet_b000_rom") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_SOFTWARE_LIST_ADD("rom_list", "pet_rom") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001n8 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet2001n8, pet2001n ) - MCFG_FRAGMENT_ADD(8k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001n16 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet2001n16, pet2001n ) - MCFG_FRAGMENT_ADD(16k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001n32 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet2001n32, pet2001n ) - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm3000 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm3000, pet2001n ) - // video hardware - MCFG_SCREEN_MODIFY(SCREEN_TAG) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) - MCFG_DEVICE_REMOVE("sync_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(100)) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm3008 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm3008, cbm3000 ) - MCFG_FRAGMENT_ADD(8k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm3016 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm3016, cbm3000 ) - MCFG_FRAGMENT_ADD(16k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm3032 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm3032, cbm3000 ) - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001b ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( pet2001b, pet2001n, pet2001b_state ) - MCFG_DEVICE_MODIFY(M6520_1_TAG) - MCFG_PIA_READPB_HANDLER(READ8(pet2001b_state, pia1_pb_r)) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001b8 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet2001b8, pet2001b ) - MCFG_FRAGMENT_ADD(8k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001b16 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet2001b16, pet2001b ) - MCFG_FRAGMENT_ADD(16k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet2001b32 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet2001b32, pet2001b ) - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm3032b ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm3032b, pet2001b ) - // video hardware - MCFG_SCREEN_MODIFY(SCREEN_TAG) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) - MCFG_DEVICE_REMOVE("sync_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(100)) - - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet4000 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet4000, pet2001n ) - MCFG_DEVICE_REMOVE("cart_b000") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet4016 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet4016, pet4000 ) - // RAM not upgradeable - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet4032 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet4032, pet4000 ) - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet4032f ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet4032f, pet4000 ) - MCFG_MACHINE_START_OVERRIDE(pet_state, pet40) - MCFG_MACHINE_RESET_OVERRIDE(pet_state, pet40) - - // video hardware - MCFG_SCREEN_MODIFY(SCREEN_TAG) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(320, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 250 - 1) - MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) - MCFG_DEVICE_REMOVE("sync_timer") - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_BEGIN_UPDATE_CB(pet_state, pet_begin_update) - MCFG_MC6845_UPDATE_ROW_CB(pet_state, pet40_update_row) - MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(M6520_1_TAG, pia6821_device, cb1_w)) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm4000 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm4000, pet2001n ) - // video hardware - MCFG_SCREEN_MODIFY(SCREEN_TAG) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) - MCFG_DEVICE_REMOVE("sync_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(100)) - - MCFG_DEVICE_REMOVE("cart_b000") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm4016 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm4016, cbm4000 ) - // RAM not upgradeable - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm4032 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm4032, cbm4000 ) - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm4032f ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm4032f, cbm4000 ) - MCFG_MACHINE_START_OVERRIDE(pet_state, pet40) - MCFG_MACHINE_RESET_OVERRIDE(pet_state, pet40) - - // video hardware - MCFG_SCREEN_MODIFY(SCREEN_TAG) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(320, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 250 - 1) - MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) - MCFG_DEVICE_REMOVE("sync_timer") - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_BEGIN_UPDATE_CB(pet_state, pet_begin_update) - MCFG_MC6845_UPDATE_ROW_CB(pet_state, pet40_update_row) - MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(M6520_1_TAG, pia6821_device, cb1_w)) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet4000b ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet4000b, pet2001b ) - MCFG_DEVICE_REMOVE("cart_b000") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet4032b ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet4032b, pet4000b ) - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm4000b ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm4000b, pet2001b ) - // video hardware - MCFG_SCREEN_MODIFY(SCREEN_TAG) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DRIVER(pet_state, screen_update) - MCFG_DEVICE_REMOVE("sync_timer") - MCFG_TIMER_DRIVER_ADD_PERIODIC("sync_timer", pet_state, sync_tick, attotime::from_hz(100)) - - MCFG_DEVICE_REMOVE("cart_b000") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm4032b ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm4032b, cbm4000b ) - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet80 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( pet80, pet80_state ) - MCFG_MACHINE_START_OVERRIDE(pet80_state, pet80) - MCFG_MACHINE_RESET_OVERRIDE(pet80_state, pet80) - - // basic machine hardware - MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/16) - MCFG_CPU_PROGRAM_MAP(pet2001_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(640, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 250 - 1) - MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(2*8) - MCFG_MC6845_BEGIN_UPDATE_CB(pet_state, pet_begin_update) - MCFG_MC6845_UPDATE_ROW_CB(pet80_state, pet80_update_row) - MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(M6520_1_TAG, pia6821_device, cb1_w)) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_DEVICE_ADD(M6522_TAG, VIA6522, XTAL_16MHz/16) - MCFG_VIA6522_READPB_HANDLER(READ8(pet_state, via_pb_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(pet_state, via_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(pet_state, via_pb_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(pet_state, via_ca2_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(pet_state, via_cb2_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(pet_state, via_irq_w)) - - MCFG_DEVICE_ADD(M6520_1_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(pet_state, pia1_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(pet_state, pia1_pb_r)) - MCFG_PIA_READCA1_HANDLER(DEVREADLINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, read)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(pet_state, pia1_pa_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(pet_state, pia1_ca2_w)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, motor_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(pet_state, pia1_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(pet_state, pia1_irqb_w)) - - MCFG_DEVICE_ADD(M6520_2_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) - MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) - MCFG_PIA_CA2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, ndac_w)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE(IEEE488_TAG, ieee488_device, dav_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(pet_state, pia2_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(pet_state, pia2_irqb_w)) - - MCFG_CBM_IEEE488_ADD("c8050") - MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, cb1_w)) - MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(M6520_2_TAG, pia6821_device, ca1_w)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c2n", DEVWRITELINE(M6520_1_TAG, pia6821_device, ca1_w)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, cbm_datassette_devices, NULL, DEVWRITELINE(M6522_TAG, via6522_device, write_cb1)) - MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, pet_expansion_cards, NULL) - MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(READ8(pet_state, read), WRITE8(pet_state, write)) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, pet_user_port_cards, NULL) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1)) - MCFG_PET_USER_PORT_C_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa0)) - MCFG_PET_USER_PORT_D_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa1)) - MCFG_PET_USER_PORT_E_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa2)) - MCFG_PET_USER_PORT_F_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa3)) - MCFG_PET_USER_PORT_H_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa4)) - MCFG_PET_USER_PORT_J_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa5)) - MCFG_PET_USER_PORT_K_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa6)) - MCFG_PET_USER_PORT_L_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_pa7)) - MCFG_PET_USER_PORT_M_HANDLER(DEVWRITELINE(M6522_TAG, via6522_device, write_cb2)) - - MCFG_QUICKLOAD_ADD("quickload", pet_state, cbm_pet, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - MCFG_GENERIC_CARTSLOT_ADD("cart_9000", generic_linear_slot, "pet_9000_rom") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_GENERIC_CARTSLOT_ADD("cart_a000", generic_linear_slot, "pet_a000_rom") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - // software lists - MCFG_SOFTWARE_LIST_ADD("cass_list", "pet_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "pet_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "pet_hdd") - MCFG_SOFTWARE_LIST_ADD("rom_list", "pet_rom") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pet8032 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pet8032, pet80 ) - MCFG_FRAGMENT_ADD(32k) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( superpet ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( superpet, pet8032, superpet_state ) - MCFG_DEVICE_REMOVE(PET_EXPANSION_SLOT_TAG) - MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, pet_expansion_cards, "superpet") - MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(READ8(pet_state, read), WRITE8(pet_state, write)) - - MCFG_SOFTWARE_LIST_ADD("flop_list2", "superpet_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm8096 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( cbm8096, pet80, cbm8096_state ) - MCFG_DEVICE_REMOVE(PET_EXPANSION_SLOT_TAG) - MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, pet_expansion_cards, "64k") - MCFG_PET_EXPANSION_SLOT_DMA_CALLBACKS(READ8(pet_state, read), WRITE8(pet_state, write)) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("96K") - - MCFG_SOFTWARE_LIST_ADD("flop_list2", "cbm8096_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm8296 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( cbm8296, pet80, cbm8296_state ) - MCFG_MACHINE_START_OVERRIDE(cbm8296_state, cbm8296) - MCFG_MACHINE_RESET_OVERRIDE(cbm8296_state, cbm8296) - - MCFG_CPU_MODIFY(M6502_TAG) - MCFG_CPU_PROGRAM_MAP(cbm8296_mem) - - MCFG_PLS100_ADD(PLA1_TAG) - MCFG_PLS100_ADD(PLA2_TAG) - - MCFG_DEVICE_REMOVE(MC6845_TAG) - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(2*8) - MCFG_MC6845_UPDATE_ROW_CB(pet80_state, cbm8296_update_row) - MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(M6520_1_TAG, pia6821_device, cb1_w)) - - MCFG_DEVICE_MODIFY("ieee8") - MCFG_SLOT_DEFAULT_OPTION("c8250") - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - - MCFG_SOFTWARE_LIST_ADD("flop_list2", "cbm8296_flop") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( cbm8296d ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( cbm8296d, cbm8296 ) - MCFG_DEVICE_MODIFY("ieee8") - MCFG_DEVICE_SLOT_INTERFACE(cbm8296d_ieee488_devices, "c8250lp", false) -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( pet2001 ) -//------------------------------------------------- - -ROM_START( pet2001 ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_DEFAULT_BIOS( "basic1r" ) - ROM_SYSTEM_BIOS( 0, "basic1o", "Original" ) - ROMX_LOAD( "901447-01.h1", 0x3000, 0x0800, CRC(a055e33a) SHA1(831db40324113ee996c434d38b4add3fd1f820bd), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "basic1r", "Revised" ) - ROMX_LOAD( "901447-09.h1", 0x3000, 0x0800, CRC(03cf16d0) SHA1(1330580c0614d3556a389da4649488ba04a60908), ROM_BIOS(2) ) - ROM_LOAD( "901447-02.h5", 0x3800, 0x0800, CRC(69fd8a8f) SHA1(70c0f4fa67a70995b168668c957c3fcf2c8641bd) ) - ROM_LOAD( "901447-03.h2", 0x4000, 0x0800, CRC(d349f2d4) SHA1(4bf2c20c51a63d213886957485ebef336bb803d0) ) - ROM_LOAD( "901447-04.h6", 0x4800, 0x0800, CRC(850544eb) SHA1(d293972d529023d8fd1f493149e4777b5c253a69) ) - ROM_LOAD( "901447-05.h3", 0x5000, 0x0800, CRC(9e1c5cea) SHA1(f02f5fb492ba93dbbd390f24c10f7a832dec432a) ) - ROM_LOAD( "901447-06.h4", 0x6000, 0x0800, CRC(661a814a) SHA1(960717282878e7de893d87242ddf9d1512be162e) ) - ROM_LOAD( "901447-07.h7", 0x6800, 0x0800, CRC(c4f47ad1) SHA1(d440f2510bc52e20c3d6bc8b9ded9cea7f462a9c) ) - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-08.a2", 0x000, 0x800, CRC(54f32f45) SHA1(3e067cc621e4beafca2b90cb8f6dba975df2855b) ) -ROM_END - -#define rom_pet20018 rom_pet2001 - - -//------------------------------------------------- -// ROM( pet2001n ) -//------------------------------------------------- - -ROM_START( pet2001n ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-01.ud6", 0x3000, 0x1000, CRC(63a7fe4a) SHA1(3622111f486d0e137022523657394befa92bde44) ) // BASIC 2 - ROM_LOAD( "901465-02.ud7", 0x4000, 0x1000, CRC(ae4cb035) SHA1(1bc0ebf27c9bb62ad71bca40313e874234cab6ac) ) // BASIC 2 - ROM_LOAD( "901447-24.ud8", 0x5000, 0x0800, CRC(e459ab32) SHA1(5e5502ce32f5a7e387d65efe058916282041e54b) ) // Screen Editor (40 columns, no CRTC, Normal Keyb) - ROM_LOAD( "901465-03.ud9", 0x6000, 0x1000, CRC(f02238e2) SHA1(38742bdf449f629bcba6276ef24d3daeb7da6e84) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - -#define rom_pet2001n16 rom_pet2001n -#define rom_pet2001n32 rom_pet2001n -#define rom_cbm3008 rom_pet2001n -#define rom_cbm3016 rom_pet2001n -#define rom_cbm3032 rom_pet2001n - - -//------------------------------------------------- -// ROM( pet2001b ) -//------------------------------------------------- - -ROM_START( pet2001b ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-01.ud6", 0x3000, 0x1000, CRC(63a7fe4a) SHA1(3622111f486d0e137022523657394befa92bde44) ) // BASIC 2 - ROM_LOAD( "901465-02.ud7", 0x4000, 0x1000, CRC(ae4cb035) SHA1(1bc0ebf27c9bb62ad71bca40313e874234cab6ac) ) // BASIC 2 - ROM_LOAD( "901474-01.ud8", 0x5000, 0x0800, CRC(05db957e) SHA1(174ace3a8c0348cd21d39cc864e2adc58b0101a9) ) // Screen Editor (40 columns, no CRTC, Business Keyb) - ROM_LOAD( "901465-03.ud9", 0x6000, 0x1000, CRC(f02238e2) SHA1(38742bdf449f629bcba6276ef24d3daeb7da6e84) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - -#define rom_pet2001b16 rom_pet2001b -#define rom_pet2001b32 rom_pet2001b -#define rom_cbm3032b rom_pet2001b - - -//------------------------------------------------- -// ROM( pet4016 ) -//------------------------------------------------- - -ROM_START( pet4016 ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_DEFAULT_BIOS( "basic4r" ) - ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) - ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) - ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 - ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901447-29.ud8", 0x5000, 0x0800, CRC(e5714d4c) SHA1(e88f56e5c54b0e8d8d4e8cb39a4647c803c1f51c) ) // Screen Editor (40 columns, no CRTC, Normal Keyb) - ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - -#define rom_pet4032 rom_pet4016 - - -//------------------------------------------------- -// ROM( pet4032f ) -//------------------------------------------------- - -ROM_START( pet4032f ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_DEFAULT_BIOS( "basic4r" ) - ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) - ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) - ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 - ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901499-01.ud7", 0x5000, 0x0800, CRC(5f85bdf8) SHA1(8cbf086c1ce4dfb2a2fe24c47476dfb878493dee) ) // Screen Editor (40 columns, CRTC 60Hz, Normal Keyb?) - ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - - -//------------------------------------------------- -// ROM( cbm4016 ) -//------------------------------------------------- - -ROM_START( cbm4016 ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_DEFAULT_BIOS( "basic4r" ) - ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) - ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) - ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 - ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901447-29.ud8", 0x5000, 0x0800, CRC(e5714d4c) SHA1(e88f56e5c54b0e8d8d4e8cb39a4647c803c1f51c) ) // Screen Editor (40 columns, no CRTC, Normal Keyb) - ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - -#define rom_cbm4032 rom_cbm4016 - - -//------------------------------------------------- -// ROM( cbm4032f ) -//------------------------------------------------- - -ROM_START( cbm4032f ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_DEFAULT_BIOS( "basic4r" ) - ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) - ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) - ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 - ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901498-01.ud7", 0x5000, 0x0800, CRC(3370e359) SHA1(05af284c914d53a52987b5f602466de75765f650) ) // Screen Editor (40 columns, CRTC 50Hz, Normal Keyb?) - ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - - -//------------------------------------------------- -// ROM( pet4032b ) -//------------------------------------------------- - -ROM_START( pet4032b ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_DEFAULT_BIOS( "basic4r" ) - ROM_SYSTEM_BIOS( 0, "basic4", "Original" ) - ROMX_LOAD( "901465-19.ud5", 0x2000, 0x1000, CRC(3a5f5721) SHA1(bc2b7c99495fea3eda950ee9e3d6cabe448a452b), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "basic4r", "Revised" ) - ROMX_LOAD( "901465-23.ud5", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc), ROM_BIOS(2) ) // BASIC 4 - ROM_LOAD( "901465-20.ud6", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud7", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901474-02.ud8", 0x5000, 0x0800, CRC(75ff4af7) SHA1(0ca5c4e8f532f914cb0bf86ea9900f20f0a655ce) ) // Screen Editor (40 columns, no CRTC, Business Keyb) - ROM_LOAD( "901465-22.ud9", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.uf10", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - -#define rom_cbm4032b rom_pet4032b - - -//------------------------------------------------- -// ROM( pet8032 ) -//------------------------------------------------- - -ROM_START( pet8032 ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 - ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901474-03.ud7", 0x5000, 0x0800, CRC(5674dd5e) SHA1(c605fa343fd77c73cbe1e0e9567e2f014f6e7e30) ) // Screen Editor (80 columns, CRTC 60Hz, Business Keyb) - ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.ua3", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - - -//------------------------------------------------- -// ROM( cbm8032 ) -//------------------------------------------------- - -ROM_START( cbm8032 ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 - ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901474-04.ud7", 0x5000, 0x0800, CRC(abb000e7) SHA1(66887061b6c4ebef7d6efb90af9afd5e2c3b08ba) ) // Screen Editor (80 columns, CRTC 50Hz, Business Keyb) - ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.ua3", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator -ROM_END - -#define rom_cbm8096 rom_cbm8032 - - -//------------------------------------------------- -// ROM( cbm8032_de ) -//------------------------------------------------- - -ROM_START( cbm8032_de ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 - ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "german.bin", 0x5000, 0x0800, CRC(1c1e597d) SHA1(7ac75ed73832847623c9f4f197fe7fb1a73bb41c) ) - ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "chargen.de", 0x0000, 0x800, CRC(3bb8cb87) SHA1(a4f0df13473d7f9cd31fd62cfcab11318e2fb1dc) ) -ROM_END - - -//------------------------------------------------- -// ROM( cbm8032_fr ) -//------------------------------------------------- - -ROM_START( cbm8032_fr ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 - ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "8032_editor_80c_fr_a1ab.ud7", 0x5000, 0x1000, CRC(4d3d9918) SHA1(eedac298a201a28ad86a5939b569a46f9f12c16f) ) - ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "8032_chargen_80c_fr_b9c1.ua3", 0x0000, 0x1000, CRC(d7424620) SHA1(e74c0eabb921d4a34032b57a7ee61ce61ec8a10c) ) -ROM_END - - -//------------------------------------------------- -// ROM( cbm8032_se ) -//------------------------------------------------- - -ROM_START( cbm8032_se ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 - ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "8000-ud7, screen-04.ud7", 0x5000, 0x0800, CRC(75901dd7) SHA1(2ead0d83255a344a42bb786428353ca48d446d03) ) - ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-14.ua3", 0x0000, 0x800, CRC(48c77d29) SHA1(aa7c8ff844d16ec05e2b32acc586c58d9e35388c) ) // Character Generator -ROM_END - - -//------------------------------------------------- -// ROM( superpet ) -//------------------------------------------------- - -ROM_START( superpet ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 - ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901474-04.ud7", 0x5000, 0x0800, CRC(abb000e7) SHA1(66887061b6c4ebef7d6efb90af9afd5e2c3b08ba) ) // Screen Editor (80 columns, CRTC 50Hz, Business Keyb) - ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901640-01.ua3", 0x0000, 0x1000, CRC(ee8229c4) SHA1(bf346f11595a3e65e55d6aeeaa2c0cec807b66c7) ) -ROM_END - -#define rom_mmf9000 rom_superpet - - -//------------------------------------------------- -// ROM( mmf9000_se ) -//------------------------------------------------- - -ROM_START( mmf9000_se ) - ROM_REGION( 0x7000, M6502_TAG, 0 ) - ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 - ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 - ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "8000-ud7, screen-04.ud7", 0x5000, 0x0800, CRC(75901dd7) SHA1(2ead0d83255a344a42bb786428353ca48d446d03) ) - ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901640-01 skand.gen.ua3", 0x0000, 0x1000, CRC(da1cd630) SHA1(35f472114ff001259bdbae073ae041b0759e32cb) ) -ROM_END - - -//------------------------------------------------- -// ROM( cbm8296 ) -//------------------------------------------------- - -ROM_START( cbm8296 ) - ROM_REGION( 0x2000, M6502_TAG, ROMREGION_ERASE00 ) - - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 - - ROM_REGION( 0x1000, "editor", 0 ) - ROM_LOAD( "8296.ue8", 0x000, 0x800, CRC(a3475de6) SHA1(b715db83fd26458dfd254bef5c4aae636753f7f5) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901447-10.uc5", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator - - ROM_REGION( 0x20, "prom", 0 ) - ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing - - ROM_REGION( 0x10000, "ue5_eprom", 0 ) - ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) - - ROM_REGION( 0x10000, "ue6_eprom", 0 ) - ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 - - ROM_REGION( 0xf5, PLA2_TAG, 0 ) - ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 -ROM_END - - -//------------------------------------------------- -// ROM( cbm8296ed ) -//------------------------------------------------- - -ROM_START( cbm8296ed ) - ROM_REGION( 0x2000, M6502_TAG, 0 ) - ROM_LOAD( "oracle.ue10", 0x0000, 0x1000, CRC(1ee9485d) SHA1(f876933087c9633b0fafff4d1dc198017f250267) ) // Oracle 3.03 - ROM_LOAD( "paperclip.ue9", 0x1000, 0x1000, CRC(8fb11d4b) SHA1(1c0f883cd3b8ded42ec00d83f7e7f0887f91fec0) ) // Paperclip 2.84 - - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 - - ROM_REGION( 0x1000, "editor", 0 ) - ROM_LOAD( "execudesk.ue8", 0x0000, 0x1000, CRC(bef0eaa1) SHA1(7ea63a2d651f516e96b8725195c13542ea495ebd) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901447-10.uc5", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator - - ROM_REGION( 0x20, "prom", 0 ) - ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing - - ROM_REGION( 0x10000, "ue5_eprom", 0 ) - ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) - - ROM_REGION( 0x10000, "ue6_eprom", 0 ) - ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 - - ROM_REGION( 0xf5, PLA2_TAG, 0 ) - ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 -ROM_END - - -//------------------------------------------------- -// ROM( cbm8296d ) -//------------------------------------------------- - -ROM_START( cbm8296d ) - ROM_REGION( 0x2000, M6502_TAG, ROMREGION_ERASE00 ) - - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 - - ROM_REGION( 0x1000, "editor", 0 ) - ROM_LOAD( "324243-01.ue8", 0x0000, 0x1000, CRC(4000e833) SHA1(dafbdf8ba0a1fe7d7b9586ffbfc9e5390c0fcf6f) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901447-10.uc5", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator - - ROM_REGION( 0x20, "prom", 0 ) - ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing - - ROM_REGION( 0x10000, "ue5_eprom", 0 ) - ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) - - ROM_REGION( 0x10000, "ue6_eprom", 0 ) - ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 - - ROM_REGION( 0xf5, PLA2_TAG, 0 ) - ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 -ROM_END - - -//------------------------------------------------- -// ROM( cbm8296d_de ) -//------------------------------------------------- - -ROM_START( cbm8296d_de ) - ROM_REGION( 0x2000, M6502_TAG, ROMREGION_ERASE00 ) - - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 - - ROM_REGION( 0x1000, "editor", 0 ) - ROM_LOAD( "324243-04.ue8", 0x0000, 0x1000, CRC(3fe48897) SHA1(c218ff3168514f1d5e7822ae1b1ac3e161523b33) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "324242-10.uc5", 0x0000, 0x1000, CRC(a5632a0f) SHA1(9616f7f18757cccefb702a945f954b644d5b17d1) ) - - ROM_REGION( 0x20, "prom", 0 ) - ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing - - ROM_REGION( 0x10000, "ue5_eprom", 0 ) - ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) - - ROM_REGION( 0x10000, "ue6_eprom", 0 ) - ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 - - ROM_REGION( 0xf5, PLA2_TAG, 0 ) - ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 -ROM_END - - -//------------------------------------------------- -// ROM( cbm8296gd ) -//------------------------------------------------- - -ROM_START( cbm8296gd ) - ROM_REGION( 0x2000, M6502_TAG, 0 ) - ROM_LOAD( "324992-02.ue10", 0x0000, 0x1000, CRC(2bac5baf) SHA1(03aa866e4bc4e38e95983a6a82ba925e710bede8) ) // HiRes Emulator - ROM_LOAD( "324993-02.ue9", 0x1000, 0x1000, CRC(57444531) SHA1(74aa39888a6bc95762de767fce883203daca0d34) ) // HiRes BASIC - - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) // BASIC 4 - - ROM_REGION( 0x1000, "editor", 0 ) - ROM_LOAD( "324243-01.ue8", 0x0000, 0x1000, CRC(4000e833) SHA1(dafbdf8ba0a1fe7d7b9586ffbfc9e5390c0fcf6f) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901447-10.uc5", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator - - ROM_REGION( 0x20, "prom", 0 ) - ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) // video/RAM timing - - ROM_REGION( 0x10000, "ue5_eprom", 0 ) - ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) - - ROM_REGION( 0x10000, "ue6_eprom", 0 ) - ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 - - ROM_REGION( 0xf5, PLA2_TAG, 0 ) - ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 -ROM_END - - -//------------------------------------------------- -// ROM( cbm8296dgv_de ) -//------------------------------------------------- - -ROM_START( cbm8296dgv_de ) // SER.NO.WG 8947 - ROM_REGION( 0x2000, M6502_TAG, 0 ) - ROM_LOAD( "io gv.ue9", 0x1000, 0x1000, CRC(7adf50a0) SHA1(4f7abc5286e51f34cde98238410274715e766b31) ) // I/O MASTER (C)1982 J.PFEIFER - - ROM_REGION( 0x4000, "basic", 0 ) - ROM_LOAD( "324746-01.ue7", 0x0000, 0x4000, CRC(03a25bb4) SHA1(e3e1431969bf317c885e47f3790e0bcbdf61fe77) ) - - ROM_REGION( 0x1000, "editor", 0 ) - ROM_LOAD( "ue8gv.ue8", 0x0000, 0x1000, CRC(8ad1fca9) SHA1(3c939092e51549696754c308b2a09f47c5d4d277) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "ua3gv.uc5", 0x000, 0x1000, CRC(d8035dc4) SHA1(cdf520a7dabf1b18aed15455b1dbefac15ff91f3) ) - - ROM_REGION( 0x20, "prom", 0 ) - ROM_LOAD( "74s288.uc2", 0x00, 0x20, CRC(06030665) SHA1(19dc91ca49ecc20e66c646ba480d2c3bc70a62e6) ) - - ROM_REGION( 0x10000, "ue5_eprom", 0 ) - ROM_LOAD( "ue5.bin", 0x00000, 0x10000, CRC(f70b7b37) SHA1(fe0fbb0fa71775f3780134aa11dac5b761526148) ) - - ROM_REGION( 0x10000, "ue6_eprom", 0 ) - ROM_LOAD( "ue6.bin", 0x00000, 0x10000, CRC(36952256) SHA1(e94d3e744a6aaff553bf260f25da0286436265d1) ) - - ROM_REGION( 0xf5, PLA1_TAG, 0 ) - ROM_LOAD( "324744-01.ue6", 0x00, 0xf5, NO_DUMP ) // 8700-009 - - ROM_REGION( 0xf5, PLA2_TAG, 0 ) - ROM_LOAD( "324745-01.ue5", 0x00, 0xf5, NO_DUMP ) // 8700-008 -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1977, pet2001, 0, 0, pet2001, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-4", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1977, pet20018, pet2001, 0, pet20018, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-8", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, pet2001n, 0, 0, pet2001n8, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-N8", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, pet2001n16, pet2001n, 0, pet2001n16, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-N16", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, pet2001n32, pet2001n, 0, pet2001n32, pet, driver_device, 0, "Commodore Business Machines", "PET 2001-N32", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, cbm3008, pet2001n, 0, cbm3008, pet, driver_device, 0, "Commodore Business Machines", "CBM 3008", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, cbm3016, pet2001n, 0, cbm3016, pet, driver_device, 0, "Commodore Business Machines", "CBM 3016", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, cbm3032, pet2001n, 0, cbm3032, pet, driver_device, 0, "Commodore Business Machines", "CBM 3032", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, pet2001b, 0, 0, pet2001b8, petb, driver_device, 0, "Commodore Business Machines", "PET 2001-B8", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, pet2001b16, pet2001b, 0, pet2001b16, petb, driver_device, 0, "Commodore Business Machines", "PET 2001-B16", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, pet2001b32, pet2001b, 0, pet2001b32, petb, driver_device, 0, "Commodore Business Machines", "PET 2001-B32", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, cbm3032b, pet2001b, 0, cbm3032b, petb, driver_device, 0, "Commodore Business Machines", "CBM 3032B", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1980, pet4016, 0, 0, pet4016, pet, driver_device, 0, "Commodore Business Machines", "PET 4016", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1980, pet4032, pet4016, 0, pet4032, pet, driver_device, 0, "Commodore Business Machines", "PET 4032", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1980, pet4032f, pet4016, 0, pet4032f, pet, driver_device, 0, "Commodore Business Machines", "PET 4032 (Fat 40)", MACHINE_SUPPORTS_SAVE ) -COMP( 1980, cbm4016, pet4016, 0, cbm4016, pet, driver_device, 0, "Commodore Business Machines", "CBM 4016", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1980, cbm4032, pet4016, 0, cbm4032, pet, driver_device, 0, "Commodore Business Machines", "CBM 4032", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1980, cbm4032f, pet4016, 0, cbm4032f, pet, driver_device, 0, "Commodore Business Machines", "CBM 4032 (Fat 40)", MACHINE_SUPPORTS_SAVE ) -COMP( 1980, pet4032b, 0, 0, pet4032b, petb, driver_device, 0, "Commodore Business Machines", "PET 4032B", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1980, cbm4032b, pet4032b, 0, cbm4032b, petb, driver_device, 0, "Commodore Business Machines", "CBM 4032B", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1980, pet8032, 0, 0, pet8032, petb, driver_device, 0, "Commodore Business Machines", "PET 8032", MACHINE_SUPPORTS_SAVE ) -COMP( 1981, cbm8032, pet8032, 0, pet8032, petb, driver_device, 0, "Commodore Business Machines", "CBM 8032", MACHINE_SUPPORTS_SAVE ) -COMP( 1981, cbm8032_de, pet8032, 0, pet8032, petb_de, driver_device, 0, "Commodore Business Machines", "CBM 8032 (Germany)", MACHINE_SUPPORTS_SAVE ) -COMP( 1981, cbm8032_fr, pet8032, 0, pet8032, petb_fr, driver_device, 0, "Commodore Business Machines", "CBM 8032 (France)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1981, cbm8032_se, pet8032, 0, pet8032, petb_se, driver_device, 0, "Commodore Business Machines", "CBM 8032 (Sweden/Finland)", MACHINE_SUPPORTS_SAVE ) -COMP( 1981, superpet, pet8032, 0, superpet, petb, driver_device, 0, "Commodore Business Machines", "SuperPET SP-9000", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1981, mmf9000, pet8032, 0, superpet, petb, driver_device, 0, "Commodore Business Machines", "MicroMainFrame 9000", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1981, mmf9000_se, pet8032, 0, superpet, petb_se, driver_device, 0, "Commodore Business Machines", "MicroMainFrame 9000 (Sweden/Finland)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1981, cbm8096, pet8032, 0, cbm8096, petb, driver_device, 0, "Commodore Business Machines", "CBM 8096", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, cbm8296, 0, 0, cbm8296, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, cbm8296ed, cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296 ExecuDesk", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, cbm8296d, cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296-D", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, cbm8296d_de,cbm8296, 0, cbm8296d, petb_de, driver_device, 0, "Commodore Business Machines", "CBM 8296-D (Germany)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, cbm8296gd, cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296GD", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, cbm8296dgv_de,cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296-D GV? (Germany)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/phc25.c b/src/mess/drivers/phc25.c deleted file mode 100644 index 861f8589201..00000000000 --- a/src/mess/drivers/phc25.c +++ /dev/null @@ -1,384 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Robbbert -/*************************************************************************** - - Sanyo PHC-25 - - - http://www.geocities.jp/sanyo_phc_25/ - http://www.phc25.com/ - - Z80 @ 4 MHz - MC6847 video - 3x 8KB bios ROM - 1x 4KB chargen ROM - 16KB RAM - 6KB video RAM - - LOCK key (CAPSLOCK) selects upper-case/lower-case on international version - (phc25), and selects hiragana/upper-case on Japanese version (phc25j). - - - - TODO: - - - sound isn't working - - screen attribute bit 7 is unknown - - - -10 SCREEN3,1,1:COLOR,,1:CLS -20 X1=INT(RND(1)*256):Y1=INT(RND(1)*192):X2=INT(RND(1)*256):Y2=INT(RND(1)*192):C=INT(RND(1)*4)+1:LINE(X1,Y1)-(X2,Y2),C:GOTO 20 -RUN - - -10 SCREEN2,1,1:CLS:FORX=0TO8:LINE(X*24,0)-(X*24+16,191),X,BF:NEXT -RUN - -*****************************************************************************/ - -#include "includes/phc25.h" - -/* Read/Write Handlers */ - -READ8_MEMBER( phc25_state::port40_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 vertical sync - 5 cassette read - 6 centronics busy - 7 horizontal sync - - */ - - UINT8 data = 0; - - /* vertical sync */ - data |= !m_vdg->fs_r() << 4; - - /* cassette read */ - data |= ((m_cassette)->input() < +0.3) << 5; - - /* centronics busy */ - data |= m_centronics_busy << 6; - - /* horizontal sync */ - data |= !m_vdg->hs_r() << 7; - - return data; -} - -WRITE8_MEMBER( phc25_state::port40_w ) -{ - /* - - bit description - - 0 cassette output - 1 cassette motor - 2 LED in the LOCK button (on = capslock) - 3 centronics strobe - 4 - 5 MC6847 GM0 - 6 MC6847 CSS - 7 MC6847 A/G - - */ - - /* cassette output */ - m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); - - /* cassette motor */ - m_cassette->change_state(BIT(data,1) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - - /* centronics strobe */ - m_centronics->write_strobe(BIT(data, 3)); - - /* MC6847 */ - m_vdg->gm0_w(BIT(data, 5)); - m_vdg->css_w(BIT(data, 6)); - m_vdg->ag_w(BIT(data, 7)); - m_port40 = data; -} - -WRITE_LINE_MEMBER( phc25_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( phc25_mem, AS_PROGRAM, 8, phc25_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x5fff) AM_ROM AM_REGION(Z80_TAG, 0) - AM_RANGE(0x6000, 0x77ff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0xc000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( phc25_io, AS_IO, 8, phc25_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x40, 0x40) AM_READWRITE(port40_r, port40_w) - AM_RANGE(0x80, 0x80) AM_READ_PORT("KEY0") - AM_RANGE(0x81, 0x81) AM_READ_PORT("KEY1") - AM_RANGE(0x82, 0x82) AM_READ_PORT("KEY2") - AM_RANGE(0x83, 0x83) AM_READ_PORT("KEY3") - AM_RANGE(0x84, 0x84) AM_READ_PORT("KEY4") - AM_RANGE(0x85, 0x85) AM_READ_PORT("KEY5") - AM_RANGE(0x86, 0x86) AM_READ_PORT("KEY6") - AM_RANGE(0x87, 0x87) AM_READ_PORT("KEY7") - AM_RANGE(0x88, 0x88) AM_READ_PORT("KEY8") - AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(AY8910_TAG, ay8910_device, data_r, data_w) - AM_RANGE(0xc1, 0xc1) AM_DEVWRITE(AY8910_TAG, ay8910_device, address_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( phc25 ) - PORT_START("KEY0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) // unlabeled key - - PORT_START("KEY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("KEY2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("KEY4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("KEY8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("JOY0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( phc25j ) - PORT_INCLUDE( phc25 ) -INPUT_PORTS_END - -/* Video */ - -READ8_MEMBER( phc25_state::video_ram_r ) -{ - if BIT(m_port40, 7) // graphics - { - return m_video_ram[offset]; - } - else // text - { - offset &= 0x7ff; - m_vdg->inv_w(BIT(m_video_ram[offset | 0x800], 0)); // cursor attribute - m_vdg->as_w(BIT(m_video_ram[offset | 0x800], 1)); // screen2 lores attribute - m_vdg->css_w(BIT(m_video_ram[offset | 0x800], 2)); // css attribute - // bit 7 is set for all text (not spaces), meaning is unknown - return m_video_ram[offset]; - } -} - -MC6847_GET_CHARROM_MEMBER(phc25_state::pal_char_rom_r) -{ - return m_char_rom[((ch - 2) * 12) + line + 4]; -} - -// irq is inverted in emulation, so we need this trampoline -WRITE_LINE_MEMBER( phc25_state::irq_w ) -{ - m_maincpu->set_input_line(0, state ? CLEAR_LINE : ASSERT_LINE); -} - -MC6847_GET_CHARROM_MEMBER(phc25_state::ntsc_char_rom_r) -{ - return m_char_rom[(ch * 16) + line]; -} - -void phc25_state::video_start() -{ - /* find memory regions */ - m_char_rom = memregion(Z80_TAG)->base() + 0x5000; - m_port40 = 0; -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( phc25, phc25_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(phc25_mem) - MCFG_CPU_IO_MAP(phc25_io) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(AY8910_TAG, AY8910, 1996750) - MCFG_AY8910_PORT_A_READ_CB(IOPORT("JOY0")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("JOY1")) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) - - /* devices */ - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(phc25_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(phc25_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pal, phc25 ) - /* video hardware */ - MCFG_SCREEN_MC6847_PAL_ADD(SCREEN_TAG, MC6847_TAG) - - MCFG_DEVICE_ADD(MC6847_TAG, MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(phc25_state, irq_w)) - MCFG_MC6847_INPUT_CALLBACK(READ8(phc25_state, video_ram_r)) - MCFG_MC6847_CHARROM_CALLBACK(phc25_state, pal_char_rom_r) - MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM2 | MC6847_MODE_GM1 | MC6847_MODE_INTEXT) - // other lines not connected -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ntsc, phc25 ) - /* video hardware */ - MCFG_SCREEN_MC6847_NTSC_ADD(SCREEN_TAG, MC6847_TAG) - - MCFG_DEVICE_ADD(MC6847_TAG, MC6847_NTSC, XTAL_3_579545MHz) - MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(phc25_state, irq_w)) - MCFG_MC6847_INPUT_CALLBACK(READ8(phc25_state, video_ram_r)) - MCFG_MC6847_CHARROM_CALLBACK(phc25_state, ntsc_char_rom_r) - MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM2 | MC6847_MODE_GM1 | MC6847_MODE_INTEXT) - // other lines not connected -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( phc25 ) - ROM_REGION( 0x6000, Z80_TAG, 0 ) - ROM_LOAD( "phc25rom.0", 0x0000, 0x2000, CRC(fa28336b) SHA1(582376bee455e124de24ba4ac02326c8a592fa5a)) - ROM_LOAD( "phc25rom.1", 0x2000, 0x2000, CRC(38fd578b) SHA1(dc3db78c0cdc89f1605200d39535be65a4091705)) - ROM_LOAD( "phc25rom.2", 0x4000, 0x2000, CRC(54392b27) SHA1(1587827fe9438780b50164727ce3fdea1b98078a)) -ROM_END - -ROM_START( phc25j ) - ROM_REGION( 0x6000, Z80_TAG, 0 ) - ROM_LOAD( "phc25-11.0", 0x0000, 0x2000, CRC(287e83b0) SHA1(9fe960a8245f28efc04defeeeaceb1e5ec6793b8)) - ROM_LOAD( "phc25-11.1", 0x2000, 0x2000, CRC(6223f945) SHA1(5d44b883b6264cb5d2e21b2269308630c62e0e56)) - ROM_LOAD( "phc25-11.2", 0x4000, 0x2000, CRC(da859ae4) SHA1(6121e85947921e434d0157c378de3d81537f6b9f)) - //ROM_LOAD( "022 00aa.ic", 0x0000, 0x2000, NO_DUMP ) - //ROM_LOAD( "022 01aa.ic", 0x2000, 0x2000, NO_DUMP ) - //ROM_LOAD( "022 02aa.ic", 0x4000, 0x2000, NO_DUMP ) - //ROM_REGION( 0x1000, "chargen", 0 ) - //ROM_LOAD( "022 04a.ic", 0x0000, 0x1000, NO_DUMP ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, phc25, 0, 0, pal, phc25, driver_device, 0, "Sanyo", "PHC-25 (Europe)", MACHINE_NO_SOUND ) -COMP( 1983, phc25j, phc25, 0, ntsc, phc25j, driver_device, 0, "Sanyo", "PHC-25 (Japan)", MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/phunsy.c b/src/mess/drivers/phunsy.c deleted file mode 100644 index 20ba34c3f49..00000000000 --- a/src/mess/drivers/phunsy.c +++ /dev/null @@ -1,398 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - PHUNSY (Philipse Universal System) - - 2010-11-04 Skeleton driver. - 2012-05-24 Cassette added. - 2014-01-13 Quickload added. - - http://www.tubedata.info/phunsy/index.html - - Baud Rate ~ 6000 baud - W command to save data, eg 800-8FFW - R command to read data, eg 1100R to load the file at 1100, - or R to load the file where it came from. - The tape must already be playing the leader when you press the Enter - key, or it errors immediately. - - Rom banking (in U bank): - 0U: RAM - 1U: MDCR program - 2U: Disassembler - 3U: Label handler - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/s2650/s2650.h" -#include "machine/keyboard.h" -#include "sound/speaker.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "imagedev/snapquik.h" - - -#define LOG 1 - -#define KEYBOARD_TAG "keyboard" - -class phunsy_state : public driver_device -{ -public: - phunsy_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cass(*this, "cassette"), - m_p_videoram(*this, "videoram") - { - } - - DECLARE_DRIVER_INIT(phunsy); - DECLARE_READ8_MEMBER( phunsy_data_r ); - DECLARE_WRITE8_MEMBER( phunsy_ctrl_w ); - DECLARE_WRITE8_MEMBER( phunsy_data_w ); - DECLARE_WRITE8_MEMBER( kbd_put ); - DECLARE_READ8_MEMBER(cass_r); - DECLARE_WRITE_LINE_MEMBER(cass_w); - DECLARE_QUICKLOAD_LOAD_MEMBER(phunsy); - DECLARE_PALETTE_INIT(phunsy); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -private: - const UINT8 *m_p_chargen; - UINT8 m_data_out; - UINT8 m_keyboard_input; - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; - required_device m_speaker; - required_device m_cass; - required_shared_ptr m_p_videoram; -}; - - -WRITE_LINE_MEMBER( phunsy_state::cass_w ) -{ - m_cass->output(state ? -1.0 : +1.0); -} - -READ8_MEMBER( phunsy_state::cass_r ) -{ - return (m_cass->input() > 0.03) ? 0 : 1; -} - -static ADDRESS_MAP_START( phunsy_mem, AS_PROGRAM, 8, phunsy_state ) - AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0x0800, 0x0fff) AM_RAM - AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE("videoram") // Video RAM - AM_RANGE(0x1800, 0x1fff) AM_READ_BANK("bankru") AM_WRITE_BANK("bankwu") // Banked RAM/ROM - AM_RANGE(0x2000, 0x3fff) AM_RAM - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bankq") // Banked RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( phunsy_io, AS_IO, 8, phunsy_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( S2650_CTRL_PORT, S2650_CTRL_PORT ) AM_WRITE( phunsy_ctrl_w ) - AM_RANGE( S2650_DATA_PORT,S2650_DATA_PORT) AM_READWRITE( phunsy_data_r, phunsy_data_w ) - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) -ADDRESS_MAP_END - - -WRITE8_MEMBER( phunsy_state::phunsy_ctrl_w ) -{ - if (LOG) - logerror("%s: phunsy_ctrl_w %02x\n", machine().describe_context(), data); - - // Q-bank - membank("bankq")->set_entry(data & 15); - - // U-bank - data >>= 4; - - if (data < 4) - membank("bankru")->set_entry(data); -} - - -WRITE8_MEMBER( phunsy_state::phunsy_data_w ) -{ - if (LOG) - logerror("%s: phunsy_data_w %02x\n", machine().describe_context(), data); - - m_data_out = data; - - /* b0 - TTY out */ - /* b1 - select MDCR / keyboard */ - /* b2 - Clear keyboard strobe signal */ - if ( data & 0x04 ) - { - m_keyboard_input |= 0x80; - } - - /* b3 - speaker output (manual says it is bit 1)*/ - m_speaker->level_w(BIT(data, 1)); - - /* b4 - -REV MDCR output */ - /* b5 - -FWD MDCR output */ - /* b6 - -WCD MDCR output */ - /* b7 - WDA MDCR output */ -} - - -READ8_MEMBER( phunsy_state::phunsy_data_r ) -{ - UINT8 data = 0xff; - - //if (LOG) - //logerror("%s: phunsy_data_r\n", machine().describe_context()); - - if ( m_data_out & 0x02 ) - { - /* MDCR selected */ - /* b0 - TTY input */ - /* b1 - SK1 switch input */ - /* b2 - SK2 switch input */ - /* b3 - -WEN MDCR input */ - /* b4 - -CIP MDCR input */ - /* b5 - -BET MDCR input */ - /* b6 - RDA MDCR input */ - /* b7 - RDC MDCR input */ - data = 0xFF; - } - else - { - /* Keyboard selected */ - /* b0-b6 - ASCII code from keyboard */ - /* b7 - strobe signal */ - data = m_keyboard_input; - } - - return data; -} - - -/* Input ports */ -static INPUT_PORTS_START( phunsy ) -INPUT_PORTS_END - - -WRITE8_MEMBER( phunsy_state::kbd_put ) -{ - if (data) - m_keyboard_input = data; -} - - -void phunsy_state::machine_reset() -{ - membank("bankru")->set_entry(0); // point at ram - membank("bankq" )->set_base( memregion("ram_4000")->base() ); - m_keyboard_input = 0xFF; - m_data_out = 0; -} - - -PALETTE_INIT_MEMBER(phunsy_state, phunsy) -{ - for ( int i = 0; i < 8; i++ ) - { - int j = ( i << 5 ) | ( i << 2 ) | ( i >> 1 ); - - palette.set_pen_color( i, j, j, j ); - } -} - - -void phunsy_state::video_start() -{ - m_p_chargen = memregion( "chargen" )->base(); -} - - -UINT32 phunsy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,col; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 32; y++) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma+64; x++) - { - chr = m_p_videoram[x]; - - if (BIT(chr, 7)) - { - /* Graphics mode */ - gfx = 0; - col = ( chr >> 4 ) & 7; - if ( (BIT(chr, 0) && (!BIT(ra, 2))) || (BIT(chr, 2) && (BIT(ra, 2))) ) - gfx = 0x38; - if ( (BIT(chr, 1) && (!BIT(ra, 2))) || (BIT(chr, 3) && (BIT(ra, 2))) ) - gfx |= 7; - } - else - { - /* ASCII mode */ - gfx = m_p_chargen[(chr<<3) | ra]; - col = 7; - } - - /* Display a scanline of a character (6 pixels) */ - *p++ = BIT( gfx, 5 ) ? col : 0; - *p++ = BIT( gfx, 4 ) ? col : 0; - *p++ = BIT( gfx, 3 ) ? col : 0; - *p++ = BIT( gfx, 2 ) ? col : 0; - *p++ = BIT( gfx, 1 ) ? col : 0; - *p++ = BIT( gfx, 0 ) ? col : 0; - } - } - ma+=64; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout phunsy_charlayout = -{ - 5, 7, /* 6 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 3, 4, 5, 6, 7 }, - /* y offsets */ - { 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( phunsy ) - GFXDECODE_ENTRY( "chargen", 0x0000, phunsy_charlayout, 1, 3 ) -GFXDECODE_END - -// quickloads can start from various addresses, and the files have no header. -QUICKLOAD_LOAD_MEMBER( phunsy_state, phunsy ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT16 i; - UINT16 quick_addr = 0x1800; - dynamic_buffer quick_data; - int result = IMAGE_INIT_FAIL; - int quick_length = image.length(); - if (quick_length > 0x4000) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); - image.message(" File too long"); - } - else - { - quick_data.resize(quick_length); - membank("bankru")->set_entry(0); // point at ram - - UINT16 exec_addr = quick_addr + 2; - - for (i = 0; i < quick_length; i++) - space.write_byte(i+quick_addr, quick_data[i]); - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); - - // Start the quickload - m_maincpu->set_state_int(S2650_R0, exec_addr>>8); - m_maincpu->set_state_int(S2650_R1, 0x08); - m_maincpu->set_state_int(S2650_R2, 0xe0); - m_maincpu->set_state_int(S2650_R3, 0x83); - m_maincpu->set_state_int(S2650_PC, exec_addr); - - result = IMAGE_INIT_PASS; - } - - return result; -} - -DRIVER_INIT_MEMBER( phunsy_state, phunsy ) -{ - UINT8 *main = memregion("maincpu")->base(); - UINT8 *roms = memregion("roms")->base(); - UINT8 *ram = memregion("ram_4000")->base(); - - membank("bankru")->configure_entry(0, &main[0x1800]); - membank("bankwu")->configure_entry(0, &main[0x1800]); - membank("bankru")->configure_entries(1, 3, &roms[0x800], 0x800); - membank("bankq")->configure_entries(0, 16, &ram[0], 0x4000); - - membank("bankru")->set_entry(0); // point at ram - membank("bankwu")->set_entry(0); // always write to ram - membank("bankq")->set_entry(0); -} - -static MACHINE_CONFIG_START( phunsy, phunsy_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(phunsy_mem) - MCFG_CPU_IO_MAP(phunsy_io) - MCFG_S2650_FLAG_HANDLER(WRITELINE(phunsy_state, cass_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - /* Display (page 12 of pdf) - - 8Mhz clock - - 64 6 pixel characters on a line. - - 16us not active, 48us active: ( 64 * 6 ) * 60 / 48 => 480 pixels wide - - 313 line display of which 256 are displayed. - */ - MCFG_SCREEN_RAW_PARAMS(XTAL_8MHz, 480, 0, 64*6, 313, 0, 256) - MCFG_SCREEN_UPDATE_DRIVER(phunsy_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", phunsy) - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(phunsy_state, phunsy) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(phunsy_state, kbd_put)) - MCFG_CASSETTE_ADD( "cassette" ) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", phunsy_state, phunsy, "bin", 2) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( phunsy ) - ROM_REGION( 0x4000, "maincpu", ROMREGION_ERASE00 ) - - ROM_REGION( 0x2000, "roms", 0 ) - ROM_LOAD( "phunsy_bios.bin", 0x0000, 0x0800, CRC(a789e82e) SHA1(b1c130ab2b3c139fd16ddc5dc7bdcaf7a9957d02)) - ROM_LOAD( "pdcr.bin", 0x0800, 0x0800, CRC(74bf9d0a) SHA1(8d2f673615215947f033571f1221c6aa99c537e9)) - ROM_LOAD( "dass.bin", 0x1000, 0x0800, CRC(13380140) SHA1(a999201cb414abbf1e10a7fcc1789e3e000a5ef1)) - ROM_LOAD( "labhnd.bin", 0x1800, 0x0800, CRC(1d5a106b) SHA1(a20d09e32e21cf14db8254cbdd1d691556b473f0)) - - ROM_REGION( 0x0400, "chargen", 0 ) - ROM_LOAD( "ph_char1.bin", 0x0200, 0x0100, CRC(a7e567fc) SHA1(b18aae0a2d4f92f5a7e22640719bbc4652f3f4ee)) - ROM_CONTINUE(0x0100, 0x0100) - ROM_LOAD( "ph_char2.bin", 0x0000, 0x0100, CRC(3d5786d3) SHA1(8cf87d83be0b5e4becfa9fd6e05b01250a2feb3b)) - ROM_CONTINUE(0x0300, 0x0100) - - /* 16 x 16KB RAM banks */ - ROM_REGION( 0x40000, "ram_4000", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, phunsy, 0, 0, phunsy, phunsy, phunsy_state, phunsy, "J.F.P. Philipse", "PHUNSY", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pimps.c b/src/mess/drivers/pimps.c deleted file mode 100644 index 633aa870ac0..00000000000 --- a/src/mess/drivers/pimps.c +++ /dev/null @@ -1,114 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - P.I.M.P.S. (Personal Interactive MicroProcessor System) - - 06/12/2009 Skeleton driver. - -Commands: -A Assemble Code -D Dump Memory -E Enter the Text Editor -F Full Duplex Host Operation -G Go To -H Half Duplex Host Operation -M Memory -P Port -S Substitute -T Transparent Mode -U Usart Parameters for Host -V Virtual Memory - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class pimps_state : public driver_device -{ -public: - pimps_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_terminal(*this, TERMINAL_TAG), - m_maincpu(*this, "maincpu") - { - } - - DECLARE_READ8_MEMBER(term_status_r); - DECLARE_READ8_MEMBER(term_r); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_term_data; - virtual void machine_reset(); - - required_device m_terminal; - required_device m_maincpu; -}; - - -// should be 8251 UART - - -READ8_MEMBER( pimps_state::term_status_r ) -{ - return (m_term_data) ? 3 : 1; -} - -READ8_MEMBER( pimps_state::term_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -static ADDRESS_MAP_START(pimps_mem, AS_PROGRAM, 8, pimps_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xefff) AM_RAM - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pimps_io, AS_IO, 8, pimps_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xf0, 0xf0) AM_READ(term_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0xf1, 0xf1) AM_READ(term_status_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pimps ) -INPUT_PORTS_END - - -void pimps_state::machine_reset() -{ - m_term_data = 0; -} - -WRITE8_MEMBER( pimps_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( pimps, pimps_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8085A, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(pimps_mem) - MCFG_CPU_IO_MAP(pimps_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(pimps_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pimps ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "pimps.bin", 0xf000, 0x1000, CRC(5da1898f) SHA1(d20e31d0981a1f54c83186dbdfcf4280e49970d0)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 197?, pimps, 0, 0, pimps, pimps, driver_device, 0, "Henry Colford", "P.I.M.P.S.", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/pipbug.c b/src/mess/drivers/pipbug.c deleted file mode 100644 index c6050fb81cf..00000000000 --- a/src/mess/drivers/pipbug.c +++ /dev/null @@ -1,182 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - PIPBUG - - 08/04/2010 Skeleton driver. - 16/05/2012 Connected to serial terminal.. working - - All input must be in uppercase. - - Commands: - A - See and alter memory - B - Set breakpoint (2 permitted) - C - Clear breakpoint - D - Dump memory to paper tape - G - Go to address, run - L - Load memory from paper tape - S - See and alter registers - - PIPBUG isn't a computer; it is a the name of the bios used - in a number of small 2650-based computers from 1976 to 1978. - Examples include Baby 2650, Eurocard 2650, etc., plus Signetics - own PC1001, PC1500, and KT9500 systems. PIPBUG was written by Signetics. - - The sole means of communication is via a serial terminal. - PIPBUG uses the SENSE and FLAG pins as serial lines, thus - there is no need for a UART. The baud rate is 110. - - The Baby 2650 (featured in Electronics Australia magazine in - March 1977) has 256 bytes of RAM. - - The terminal is expected to have a papertape device attached, and - use it to save and load programs. PIPBUG still thinks it is talking - to the terminal, when in fact the data is flowing to the papertape - reader and punch. - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/s2650/s2650.h" -#include "machine/terminal.h" -#include "imagedev/snapquik.h" - - -class pipbug_state : public driver_device -{ -public: - pipbug_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_rs232(*this, "rs232"), - m_maincpu(*this, "maincpu") - { - } - - DECLARE_WRITE8_MEMBER(pipbug_ctrl_w); - required_device m_rs232; - required_device m_maincpu; - DECLARE_QUICKLOAD_LOAD_MEMBER( pipbug ); -}; - -WRITE8_MEMBER( pipbug_state::pipbug_ctrl_w ) -{ -// 0x80 is written here - not connected in the baby 2650 -} - -static ADDRESS_MAP_START(pipbug_mem, AS_PROGRAM, 8, pipbug_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x03ff) AM_ROM - AM_RANGE( 0x0400, 0x7fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pipbug_io, AS_IO, 8, pipbug_state) -// ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_WRITE(pipbug_ctrl_w) - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READNOP // this has to return zero or the parameter to write_sense is ignored -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pipbug ) -INPUT_PORTS_END - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_110 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_110 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -QUICKLOAD_LOAD_MEMBER( pipbug_state, pipbug ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int i; - int quick_addr = 0x440; - int exec_addr; - int quick_length; - dynamic_buffer quick_data; - int read_; - int result = IMAGE_INIT_FAIL; - - quick_length = image.length(); - if (quick_length < 0x0444) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); - image.message(" File too short"); - } - else if (quick_length > 0x8000) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); - image.message(" File too long"); - } - else - { - quick_data.resize(quick_length); - read_ = image.fread( &quick_data[0], quick_length); - if (read_ != quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); - image.message(" Cannot read the file"); - } - else if (quick_data[0] != 0xc4) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); - image.message(" Invalid header"); - } - else - { - exec_addr = quick_data[1] * 256 + quick_data[2]; - - if (exec_addr >= quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); - image.message(" Exec address beyond end of file"); - } - else - { - for (i = quick_addr; i < read_; i++) - space.write_byte(i, quick_data[i]); - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); - - // Start the quickload - m_maincpu->set_state_int(S2650_PC, exec_addr); - - result = IMAGE_INIT_PASS; - } - } - } - - return result; -} - -static MACHINE_CONFIG_START( pipbug, pipbug_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(pipbug_mem) - MCFG_CPU_IO_MAP(pipbug_io) - MCFG_S2650_FLAG_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - - /* video hardware */ - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("maincpu", s2650_device, write_sense)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", pipbug_state, pipbug, "pgm", 1) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( pipbug ) - ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "pipbug.rom", 0x0000, 0x0400, CRC(f242b93e) SHA1(f82857cc882e6b5fc9f00b20b375988024f413ff)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, pipbug, 0, 0, pipbug, pipbug, driver_device, 0, "Signetics", "PIPBUG", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/pitagjr.c b/src/mess/drivers/pitagjr.c deleted file mode 100644 index 79f3b5b1957..00000000000 --- a/src/mess/drivers/pitagjr.c +++ /dev/null @@ -1,232 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Roberto Fresca -/*************************************************************************************** - - Product name: Pitagorin Junior. - Brand: VTech. - Type: First steps (4-6 years old) laptop. - Language: Spanish. - Description: 23 didactic games with voice and sounds for 1 or 2 players. - (simple maths operations, spell, hang man, letters, numbers, etc) - - Docs by Roberto Fresca. - - *************************************************************************************** - - Games / Activities ... - - ORDER TITLE TRANSLATION - -----+---------------------------+---------------------- - 01 - La letra perdida. The missing letter. - 02 - Deletrear. Spell. - 03 - Plurales. Plurals. - 04 - Verbos. Verbs. - 05 - El Ahorcado. Hangman. - 06 - Revoltijo de letras. Messed letters. - 07 - La palabra escondida. The hidden word. - 08 - Trueque de letras. Swapped letters. - 09 - La letra intrusa. The intruder letter. - 10 - Matematicas (+,-,x,/). Mathematics (+,-,x,/). - 11 - Aprendiendo los numeros. Learning the numbers. - 12 - Redondeando cifras. Rounding numbers. - 13 - Encuentra el signo. Find the sign. - 14 - Calculadora. Calculator. - 15 - Tres en raya. Three in a raw. - 16 - El juego de los puntos. The dot's game. - 17 - El juego del squash. The squash game. - 18 - El juego del arquero. The archer game. - 19 - Dibujos animados. Animated cartoons. - 20 - El compositor. The composer. - - *************************************************************************************** - - What's inside.... - - PCB silkscreened '9817' - etched on copper '35-19122-2' & '703013-C' - - 1x Unknown CPU inside an epoxy blob (more than 100 connections) @ U? (covered with the blob). - 1x VTech LH532HJT mask ROM (originary from Sharp) also silkscreened '9811D' @ U3. - 1x Texas Instruments 84C91HT (CSM10150AN) speech synth with 8-bit microprocessor @ U2. - 1x SN74HC00N @ U5. - 1x SN74HC244N @ U4. - - 1x Unknown oscillator (XTAL1). - 1x Unknown trimpot on an r/c oscillator (XTAL2). - - 1x 32 contacts (single side) expansion port. - 1x 3 contacts (unknown) connector. - 1x 17 contacts Keyboard (KEY1) connector. - 1x 3 contacts (CONT) connector. - - - PCB layout: - .......CONNECTORS........ - .------------------------------------------------------------------------------------. - | .-----------------. ooo ooooooooooooooooo ooo 9817 |.---. - | | THIS SECTOR | unk KEY1 CONT .-------. / =| - | | | | | / =| - | | IS POPULATED | | VTECH | | E =| - | | | .-----------. | | | X =| - | | WITH A LOT | | SN74HC00N | (84C91) | LH532 | | P P =| - | | | '-----------' .----------. | HJT | | A O =| - | | OF... | U5 |CSM10150AN| | | | N R =| - | | | '----------'.---. | 9811D | | S T =| - | | RESISTORS, | U2 | / | | | | I =| - | | | U4 '---' | | | O =| - | | CAPACITORS, | .--. XTAL 2 '-------' | N =| - | | | |SN| ____ U3 \ =| - | | AND | |74| / \ \ =| - | | | |HC| 35-19122-2 | BLOB | |'---' - | | TRANSISTORS | |24| 703013-C \____/ .----. | - | | | |4N| U? '----' | - | '-----------------' '--' XTAL 1 | - '------------------------------------------------------------------------------------' - - - Expansion Port: - - CONNECTOR CONNECTOR - --------- --------- - 01 ----> Vcc 17 ----> LH532HJT (pin 09) - 02 ----> Vcc 18 ----> LH532HJT (pin 25) - 03 ----> GND 19 ----> LH532HJT (pin 10) - 04 ----> ??? 20 ----> LH532HJT (pin 23) - 05 ----> LH532HJT (pin 03) 21 ----> LH532HJT (pin 11) - 06 ----> LH532HJT (pin 02) 22 ----> LH532HJT (pin 21) - 07 ----> LH532HJT (pin 04) 23 ----> LH532HJT (pin 12) - 08 ----> LH532HJT (pin 30) 24 ----> LH532HJT (pin 20) - 09 ----> LH532HJT (pin 05) 25 ----> LH532HJT (pin 13) - 10 ----> LH532HJT (pin 29) 26 ----> LH532HJT (pin 19) - 11 ----> LH532HJT (pin 06) 27 ----> LH532HJT (pin 14) - 12 ----> LH532HJT (pin 28) 28 ----> LH532HJT (pin 18) - 13 ----> LH532HJT (pin 07) 29 ----> LH532HJT (pin 15) - 14 ----> LH532HJT (pin 27) 30 ----> LH532HJT (pin 17) - 15 ----> LH532HJT (pin 08) 31 ----> GND - 16 ----> LH532HJT (pin 26) 32 ----> GND - - - U3 - VTech LH532HJT (9811D) 2Mb mask ROM. - Seems to be 27C020 pin compatible. - - .----v----. - VCC --|01 32|-- VCC - --|02 31|-- - --|03 30|-- - --|04 29|-- - --|05 28|-- - --|06 27|-- - --|07 26|-- - --|08 25|-- - --|09 24|-- - --|10 23|-- - --|11 22|-- - --|12 21|-- - --|13 20|-- - --|14 19|-- - --|15 18|-- - GND --|16 17|-- - '---------' - - - U2 - Texas Instruments 84C91HT (CSM10150AN). - - Speech Generator with 8-bit microprocessor, 8K ROM, 112 bytes RAM. - Maximum Clock Frequency = 9.6 MHz. - Package = DIP16 - Technology = CMOS - - .---v---. - --|01 16|-- - --|02 15|-- - --|03 14|-- - --|04 13|-- - GND --|05 12|-- VCC - --|06 11|-- - --|07 10|-- GND - --|08 09|-- - '-------' - - ***************************************************************************************/ - - -#include "emu.h" -#include "cpu/m6805/m6805.h" -#include "rendlay.h" - -class pitagjr_state : public driver_device -{ -public: - pitagjr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_rombank(*this, "rombank") - { } - - required_device m_maincpu; - required_memory_bank m_rombank; - - virtual void machine_start(); - DECLARE_PALETTE_INIT(pitagjr); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - - -static ADDRESS_MAP_START(pitajr_mem, AS_PROGRAM, 8, pitagjr_state) - AM_RANGE(0x0000, 0x00ff) AM_RAM - AM_RANGE(0x1000, 0x1fff) AM_ROM // boot ROM ??? - AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("rombank") -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( pitajr ) -INPUT_PORTS_END - -void pitagjr_state::machine_start() -{ - m_rombank->configure_entries(0, 0x20, memregion("maincpu")->base(), 0x2000); - m_rombank->set_entry(1); -} - -PALETTE_INIT_MEMBER(pitagjr_state, pitagjr) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -UINT32 pitagjr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( pitajr, pitagjr_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD63705, XTAL_2MHz) // probably a m6805-based MCU with internal boot ROM - MCFG_CPU_PROGRAM_MAP(pitajr_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(pitagjr_state, screen_update) - MCFG_SCREEN_SIZE( 200, 100 ) // FIXME - MCFG_SCREEN_VISIBLE_AREA( 0, 200-1, 0, 100-1 ) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pitagjr_state, pitagjr) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( pitagjr ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "lh532hjt_9811d.u3", 0x00000, 0x40000, CRC(23878b45) SHA1(8f3c41c10cfde9d76763c3a8701ec6616db4ab40) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 199?, pitagjr, 0, 0, pitajr, pitajr, driver_device, 0, "VTech", "Pitagorin Junior", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/pk8000.c b/src/mess/drivers/pk8000.c deleted file mode 100644 index ca833cf9f8e..00000000000 --- a/src/mess/drivers/pk8000.c +++ /dev/null @@ -1,413 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - PK-8000 - - 18/07/2009 Mostly working driver - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "imagedev/cassette.h" -#include "formats/fmsx_cas.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "includes/pk8000.h" -#include "machine/ram.h" - - -class pk8000_state : public pk8000_base_state -{ -public: - pk8000_state(const machine_config &mconfig, device_type type, const char *tag) - : pk8000_base_state(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_cassette(*this, "cassette") - , m_ram(*this, RAM_TAG) - , m_speaker(*this, "speaker") - , m_region_maincpu(*this, "maincpu") - , m_bank1(*this, "bank1") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - , m_bank4(*this, "bank4") - , m_bank5(*this, "bank5") - , m_bank6(*this, "bank6") - , m_bank7(*this, "bank7") - , m_bank8(*this, "bank8") - , m_io_joy1(*this, "JOY1") - , m_io_joy2(*this, "JOY2") - { } - - UINT8 m_keyboard_line; - DECLARE_READ8_MEMBER(pk8000_joy_1_r); - DECLARE_READ8_MEMBER(pk8000_joy_2_r); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_pk8000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(pk8000_interrupt); - DECLARE_WRITE8_MEMBER(pk8000_80_porta_w); - DECLARE_READ8_MEMBER(pk8000_80_portb_r); - DECLARE_WRITE8_MEMBER(pk8000_80_portc_w); - - IRQ_CALLBACK_MEMBER(pk8000_irq_callback); - -protected: - required_device m_maincpu; - required_device m_cassette; - required_device m_ram; - required_device m_speaker; - required_memory_region m_region_maincpu; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_memory_bank m_bank5; - required_memory_bank m_bank6; - required_memory_bank m_bank7; - required_memory_bank m_bank8; - required_ioport m_io_joy1; - required_ioport m_io_joy2; - ioport_port *m_io_port[10]; - - void pk8000_set_bank(UINT8 data); -}; - - - -void pk8000_state::pk8000_set_bank(UINT8 data) -{ - UINT8 *rom = m_region_maincpu->base(); - UINT8 *ram = m_ram->pointer(); - UINT8 block1 = data & 3; - UINT8 block2 = (data >> 2) & 3; - UINT8 block3 = (data >> 4) & 3; - UINT8 block4 = (data >> 6) & 3; - - switch(block1) { - case 0: - m_bank1->set_base(rom + 0x10000); - m_bank5->set_base(ram); - break; - case 1: break; - case 2: break; - case 3: - m_bank1->set_base(ram); - m_bank5->set_base(ram); - break; - } - - switch(block2) { - case 0: - m_bank2->set_base(rom + 0x14000); - m_bank6->set_base(ram + 0x4000); - break; - case 1: break; - case 2: break; - case 3: - m_bank2->set_base(ram + 0x4000); - m_bank6->set_base(ram + 0x4000); - break; - } - switch(block3) { - case 0: - m_bank3->set_base(rom + 0x18000); - m_bank7->set_base(ram + 0x8000); - break; - case 1: break; - case 2: break; - case 3: - m_bank3->set_base(ram + 0x8000); - m_bank7->set_base(ram + 0x8000); - break; - } - switch(block4) { - case 0: - m_bank4->set_base(rom + 0x1c000); - m_bank8->set_base(ram + 0xc000); - break; - case 1: break; - case 2: break; - case 3: - m_bank4->set_base(ram + 0xc000); - m_bank8->set_base(ram + 0xc000); - break; - } -} -WRITE8_MEMBER(pk8000_state::pk8000_80_porta_w) -{ - pk8000_set_bank(data); -} - -READ8_MEMBER(pk8000_state::pk8000_80_portb_r) -{ - if(m_keyboard_line>9) { - return 0xff; - } - return m_io_port[m_keyboard_line]->read(); -} - -WRITE8_MEMBER(pk8000_state::pk8000_80_portc_w) -{ - m_keyboard_line = data & 0x0f; - - m_speaker->level_w(BIT(data, 7)); - - m_cassette->change_state((BIT(data, 4)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_cassette->output((BIT(data, 6)) ? +1.0 : 0.0); -} - -READ8_MEMBER(pk8000_state::pk8000_joy_1_r) -{ - UINT8 retVal = (m_cassette->input() > 0.0038 ? 0x80 : 0); - retVal |= m_io_joy1->read() & 0x7f; - return retVal; -} -READ8_MEMBER(pk8000_state::pk8000_joy_2_r) -{ - UINT8 retVal = (m_cassette->input() > 0.0038 ? 0x80 : 0); - retVal |= m_io_joy2->read() & 0x7f; - return retVal; -} - -static ADDRESS_MAP_START(pk8000_mem, AS_PROGRAM, 8, pk8000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x3fff ) AM_READ_BANK("bank1") AM_WRITE_BANK("bank5") - AM_RANGE( 0x4000, 0x7fff ) AM_READ_BANK("bank2") AM_WRITE_BANK("bank6") - AM_RANGE( 0x8000, 0xbfff ) AM_READ_BANK("bank3") AM_WRITE_BANK("bank7") - AM_RANGE( 0xc000, 0xffff ) AM_READ_BANK("bank4") AM_WRITE_BANK("bank8") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pk8000_io , AS_IO, 8, pk8000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE(0x84, 0x87) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) - AM_RANGE(0x88, 0x88) AM_READWRITE(pk8000_video_color_r,pk8000_video_color_w) - AM_RANGE(0x8c, 0x8c) AM_READ(pk8000_joy_1_r) - AM_RANGE(0x8d, 0x8d) AM_READ(pk8000_joy_2_r) - AM_RANGE(0x90, 0x90) AM_READWRITE(pk8000_text_start_r,pk8000_text_start_w) - AM_RANGE(0x91, 0x91) AM_READWRITE(pk8000_chargen_start_r,pk8000_chargen_start_w) - AM_RANGE(0x92, 0x92) AM_READWRITE(pk8000_video_start_r,pk8000_video_start_w) - AM_RANGE(0x93, 0x93) AM_READWRITE(pk8000_color_start_r,pk8000_color_start_w) - AM_RANGE(0xa0, 0xbf) AM_READWRITE(pk8000_color_r,pk8000_color_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pk8000 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("|") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rg") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Upr") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graf") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alf") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("???") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("VSh") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sel") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Probel") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cls") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up-Left") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down-Right") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Begin") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End page") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Begin page") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("JOY1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("JOY2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -INTERRUPT_GEN_MEMBER(pk8000_state::pk8000_interrupt) -{ - device.execute().set_input_line(0, HOLD_LINE); -} - -IRQ_CALLBACK_MEMBER(pk8000_state::pk8000_irq_callback) -{ - return 0xff; -} - - -void pk8000_state::machine_start() -{ - static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; - - for ( int i = 0; i < 10; i++ ) - { - m_io_port[i] = ioport(keynames[i]); - } -} - -void pk8000_state::machine_reset() -{ - pk8000_set_bank(0); -} - -void pk8000_state::video_start() -{ -} - -UINT32 pk8000_state::screen_update_pk8000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return pk8000_video_update(screen, bitmap, cliprect, m_ram->pointer()); -} - -static MACHINE_CONFIG_START( pk8000, pk8000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, 1780000) - MCFG_CPU_PROGRAM_MAP(pk8000_mem) - MCFG_CPU_IO_MAP(pk8000_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pk8000_state, pk8000_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(pk8000_state,pk8000_irq_callback) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256+32, 192+32) - MCFG_SCREEN_VISIBLE_AREA(0, 256+32-1, 0, 192+32-1) - MCFG_SCREEN_UPDATE_DRIVER(pk8000_state, screen_update_pk8000) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(pk8000_base_state, pk8000) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pk8000_state, pk8000_80_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pk8000_state, pk8000_80_portb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pk8000_state, pk8000_80_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pk8000_base_state, pk8000_84_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pk8000_base_state, pk8000_84_porta_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pk8000_base_state,pk8000_84_portc_w)) - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(fmsx_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( vesta ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "vesta.rom", 0x10000, 0x4000, CRC(fbf7e2cc) SHA1(4bc5873066124bd926c3c6aa2fd1a062c87af339)) -ROM_END - -ROM_START( hobby ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hobby.rom", 0x10000, 0x4000, CRC(a25b4b2c) SHA1(0d86e6e4be8d1aa389bfa9dd79e3604a356729f7)) -ROM_END - -ROM_START( pk8002 ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "pk8002.rom", 0x10000, 0x4000, CRC(07b9ae71) SHA1(2137a41cc095c7aba58b7b109fce63f30a4568b2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, vesta, 0, 0, pk8000, pk8000, driver_device, 0, "BP EVM", "PK8000 Vesta", 0) -COMP( 1987, hobby, vesta, 0, pk8000, pk8000, driver_device, 0, "BP EVM", "PK8000 Sura/Hobby", 0) -COMP( 1987, pk8002, vesta, 0, pk8000, pk8000, driver_device, 0, "", "PK8002 Elf", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/pk8020.c b/src/mess/drivers/pk8020.c deleted file mode 100644 index 1b8e83ef527..00000000000 --- a/src/mess/drivers/pk8020.c +++ /dev/null @@ -1,292 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - PK-8020 driver by Miodrag Milanovic - based on work of Sergey Erokhin from pk8020.narod.ru - - 18/07/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "imagedev/flopdrv.h" -#include "formats/pk8020_dsk.h" -#include "includes/pk8020.h" -#include "machine/ram.h" - -/* Address maps */ -static ADDRESS_MAP_START(pk8020_mem, AS_PROGRAM, 8, pk8020_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pk8020_io , AS_IO, 8, pk8020_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pk8020 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_EQUALS) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STRN") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("IZ") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VZ") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_START("LINE7") - // All keys in this line are reversed logic - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alf") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Graf") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Prf") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Sel") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upr") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("OO") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("LINE10") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("LINE11") - PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("LINE12") - PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("LINE13") - PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("LINE14") - PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("LINE15") - PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - - -/* F4 Character Displayer */ -static const gfx_layout pk8020_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 512, /* 512 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( pk8020 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, pk8020_charlayout, 0, 4 ) -GFXDECODE_END - - -FLOPPY_FORMATS_MEMBER( pk8020_state::floppy_formats ) - FLOPPY_PK8020_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( pk8020_floppies ) - SLOT_INTERFACE("qd", FLOPPY_525_QD) -SLOT_INTERFACE_END - - -/* Machine driver */ -static MACHINE_CONFIG_START( pk8020, pk8020_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, XTAL_20MHz / 8) - MCFG_CPU_PROGRAM_MAP(pk8020_mem) - MCFG_CPU_IO_MAP(pk8020_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pk8020_state, pk8020_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(pk8020_state, screen_update_pk8020) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pk8020) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(pk8020_state, pk8020) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pk8020_state, pk8020_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pk8020_state, pk8020_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pk8020_state, pk8020_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pk8020_state, pk8020_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pk8020_state, pk8020_2_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_3", I8255, 0) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_20MHz / 10) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(pk8020_state,pk8020_pit_out0)) - MCFG_PIT8253_CLK1(XTAL_20MHz / 10) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(pk8020_state,pk8020_pit_out1)) - MCFG_PIT8253_CLK2((XTAL_20MHz / 8) / 164) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir5_w)) - - MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) - MCFG_DEVICE_ADD("rs232", I8251, 0) - MCFG_DEVICE_ADD("lan", I8251, 0) - - MCFG_FD1793_ADD("wd1793", XTAL_20MHz / 20) - - MCFG_FLOPPY_DRIVE_ADD("wd1793:0", pk8020_floppies, "qd", pk8020_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1793:1", pk8020_floppies, "qd", pk8020_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1793:2", pk8020_floppies, "qd", pk8020_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1793:3", pk8020_floppies, "qd", pk8020_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "korvet_flop") - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("258K") //64 + 4*48 + 2 - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( korvet ) - ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS("v11") - ROM_SYSTEM_BIOS(0, "v11", "v1.1") - ROMX_LOAD( "korvet11.rom", 0x10000, 0x6000, CRC(81bdc2af) SHA1(c3484c3f1f3d252475979283c073286b8661d2b9), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v20", "v2.0") - ROMX_LOAD( "korvet20.rom", 0x10000, 0x6000, CRC(d6c36a45) SHA1(dba67e63457251814ad5c0fe6bb6d584eea5c7d2), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "cpm", "cpm") - ROMX_LOAD( "cpm.rom", 0x10000, 0x4000, CRC(7a38d7f6) SHA1(fec6623291a38990b003e818683cd5edfb494c36), ROM_BIOS(3)) - ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "korvet2.fnt", 0x0000, 0x2000, CRC(fb1cd3d4) SHA1(58f1d6e393253b1e8b497ce0880b6eff6d85b42a)) -ROM_END - -ROM_START( neiva ) - ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "neiva_d22.bin", 0x10000, 0x2000, CRC(9cc28f67) SHA1(68f390e846e1290df68419d522088d5325682945)) - ROM_LOAD( "neiva_d23.bin", 0x12000, 0x2000, CRC(31b53dc4) SHA1(607f2a2d8b1de469125c6c02b9ffc65649b753a2)) - ROM_LOAD( "neiva_d24.bin", 0x14000, 0x2000, CRC(d05c80df) SHA1(1ec2fa9983be5579abff7247fc9b98fe50661bd9)) - ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "neiva_d21.bin", 0x0000, 0x2000, CRC(fb1cd3d4) SHA1(58f1d6e393253b1e8b497ce0880b6eff6d85b42a)) -ROM_END - -ROM_START( kontur ) - ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v1", "v1") - ROMX_LOAD( "kontur.rom", 0x10000, 0x2000, CRC(92cd441e) SHA1(9a0f9079256cefc6169ae4ba2114841d1f380480), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "v2") - ROMX_LOAD( "kontur2.rom", 0x10000, 0x2000, CRC(5256d101) SHA1(22022a3c6882dbc5ea28d7815f00c182bbaef9e1), ROM_BIOS(2)) - ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "kontur.fnt", 0x0000, 0x2000, CRC(14d33790) SHA1(6d5fcb214805c5fc44ef98a97219158ff7826ac0)) -ROM_END - -ROM_START( bk8t ) - ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "kor1.bin", 0x10000, 0x2000, CRC(f1e16ddc) SHA1(e3a10c9ce3f333928eb0d5f9b84e159e41fae6ca)) - ROM_LOAD( "kor2.bin", 0x12000, 0x2000, CRC(d4431d97) SHA1(08f79785846369d410a4183f0d60b856d6d70199)) - ROM_LOAD( "kor3.bin", 0x14000, 0x2000, CRC(74781903) SHA1(caaa638afe80eb83fc30b07dd6d1e40b66ddc6d1)) - ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "kor4.bin", 0x0000, 0x2000, CRC(d164bada) SHA1(c334e50fd31b1f42c7668b89772487971a6875cb)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, korvet, 0, 0, pk8020, pk8020, driver_device, 0, "", "PK8020 Korvet", 0) -COMP( 1987, neiva, korvet, 0, pk8020, pk8020, driver_device, 0, "", "PK8020 Neiva", 0) -COMP( 1987, kontur, korvet, 0, pk8020, pk8020, driver_device, 0, "", "PK8020 Kontur", 0) -COMP( 1987, bk8t, korvet, 0, pk8020, pk8020, driver_device, 0, "", "BK-8T", 0) diff --git a/src/mess/drivers/plan80.c b/src/mess/drivers/plan80.c deleted file mode 100644 index b0a75765ce8..00000000000 --- a/src/mess/drivers/plan80.c +++ /dev/null @@ -1,265 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Plan-80 - - 06/12/2009 Skeleton driver. - - Summary of Monitor commands: - - D - dump memory - F - fill memory - G - go (execute program at address) - I - in from a port and display - M - move? - O - out to a port - S - edit memory - - ToDo: - - fix autorepeat on the keyboard - - Add missing devices - - Picture of unit shows graphics, possibly a PCG - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" - - -class plan80_state : public driver_device -{ -public: - enum - { - TIMER_BOOT - }; - - plan80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_p_videoram(*this, "p_videoram") - { } - - required_device m_maincpu; - DECLARE_READ8_MEMBER(plan80_04_r); - DECLARE_WRITE8_MEMBER(plan80_09_w); - required_shared_ptr m_p_videoram; - const UINT8* m_p_chargen; - UINT8 m_kbd_row; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DRIVER_INIT(plan80); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -READ8_MEMBER( plan80_state::plan80_04_r ) -{ - UINT8 data = 0xff; - - if (m_kbd_row == 0xfe) - data = ioport("LINE0")->read(); - else - if (m_kbd_row == 0xfd) - data = ioport("LINE1")->read(); - else - if (m_kbd_row == 0xfb) - data = ioport("LINE2")->read(); - else - if (m_kbd_row == 0xf7) - data = ioport("LINE3")->read(); - else - if (m_kbd_row == 0xef) - data = ioport("LINE4")->read(); - - return data; -} - -WRITE8_MEMBER( plan80_state::plan80_09_w ) -{ - m_kbd_row = data; -} - - -static ADDRESS_MAP_START(plan80_mem, AS_PROGRAM, 8, plan80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") - AM_RANGE(0x0800, 0xefff) AM_RAM - AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("p_videoram") - AM_RANGE(0xf800, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(plan80_io, AS_IO, 8, plan80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x04, 0x04) AM_READ(plan80_04_r) - AM_RANGE(0x09, 0x09) AM_WRITE(plan80_09_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( plan80 ) // Keyboard was worked out by trial & error;'F' keys produce foreign symbols - PORT_START("LINE0") /* FE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A -") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('-') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q ! 1") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('!') PORT_CHAR('1') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F-shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P ?? 0") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('0') - PORT_START("LINE1") /* FD */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Numbers") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X /") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('/') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D =") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('=') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E # 3") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('#') PORT_CHAR('3') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M .") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('.') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K [") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('[') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I ( 8") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('(') PORT_CHAR('8') - PORT_START("LINE2") /* FB */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V ;") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR(';') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G _") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('_') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T % 5") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('%') PORT_CHAR('5') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ?") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H <") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('<') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y & 6") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('&') PORT_CHAR('6') - PORT_START("LINE3") /* F7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C :") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F ^") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R $ 4") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('$') PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N ,") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(',') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J >") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U \' 7") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('\'') PORT_CHAR('7') - PORT_START("LINE4") /* EF */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z *") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S +") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W \" 2") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('\"') PORT_CHAR('2') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L ]") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR(']') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O ) 9") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR(')') PORT_CHAR('9') -INPUT_PORTS_END - - -void plan80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BOOT: - /* after the first 4 bytes have been read from ROM, switch the ram back in */ - membank("boot")->set_entry(0); - break; - default: - assert_always(FALSE, "Unknown id in plan80_state::device_timer"); - } -} - -void plan80_state::machine_reset() -{ - membank("boot")->set_entry(1); - timer_set(attotime::from_usec(10), TIMER_BOOT); -} - -DRIVER_INIT_MEMBER(plan80_state,plan80) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf800); -} - -void plan80_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 plan80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 32; y++) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma+48; x++) - { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr << 3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - } - } - ma+=64; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout plan80_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( plan80 ) - GFXDECODE_ENTRY( "chargen", 0x0000, plan80_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( plan80, plan80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, 2048000) - MCFG_CPU_PROGRAM_MAP(plan80_mem) - MCFG_CPU_IO_MAP(plan80_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(plan80_state, screen_update) - MCFG_SCREEN_SIZE(48*6, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 48*6-1, 0, 32*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", plan80) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( plan80 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "pl80mon.bin", 0xf800, 0x0800, CRC(433fb685) SHA1(43d53c35544d3a197ab71b6089328d104535cfa5)) - - ROM_REGION( 0x10000, "spare", 0 ) - ROM_LOAD_OPTIONAL( "pl80mod.bin", 0xf000, 0x0800, CRC(6bdd7136) SHA1(721eab193c33c9330e0817616d3d2b601285fe50)) - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD( "pl80gzn.bin", 0x0000, 0x0800, CRC(b4ddbdb6) SHA1(31bf9cf0f2ed53f48dda29ea830f74cea7b9b9b2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, plan80, 0, 0, plan80, plan80, plan80_state, plan80, "Tesla Eltos", "Plan-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/plus4.c b/src/mess/drivers/plus4.c deleted file mode 100644 index 03924846402..00000000000 --- a/src/mess/drivers/plus4.c +++ /dev/null @@ -1,1129 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - TODO: - - - c16 function ROM test fails - - clean up TED - - dump PLA - - T6721 speech chip - -*/ - -#include "includes/plus4.h" -#include "machine/cbm_snqk.h" -#include "sound/t6721a.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define BA15 BIT(offset, 15) -#define BA14 BIT(offset, 14) -#define BA13 BIT(offset, 13) -#define BA12 BIT(offset, 12) -#define BA11 BIT(offset, 11) -#define BA10 BIT(offset, 10) -#define BA9 BIT(offset, 9) -#define BA8 BIT(offset, 8) -#define BA7 BIT(offset, 7) -#define BA6 BIT(offset, 6) -#define BA5 BIT(offset, 5) -#define BA4 BIT(offset, 4) - - - -QUICKLOAD_LOAD_MEMBER( plus4_state, cbm_c16 ) -{ - return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress); -} - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// check_interrupts - -//------------------------------------------------- - -void plus4_state::check_interrupts() -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_ted_irq || m_acia_irq || m_exp_irq); -} - - - -//************************************************************************** -// MEMORY MANAGEMENT -//************************************************************************** - -void plus4_state::bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal) -{ - UINT16 i = ras << 15 | BA10 << 14 | BA11 << 13 | BA13 << 12 | BA9 << 11 | BA8 << 10 | BA14 << 9 | mux << 8 | BA12 << 7 | BA7 << 6 | BA6 << 5 | BA5 << 4 | BA4 << 3 | BA15 << 2 | phi0 << 1 | 1; -/* UINT8 data = m_pla->read(i); - - *scs = BIT(data, 0); - *phi2 = BIT(data, 1); - *user = BIT(data, 2); - *_6551 = BIT(data, 3); - *addr_clk = BIT(data, 4); - *keyport = BIT(data, 5); - *kernal = BIT(data, 6); - *f7 = BIT(data, 7);*/ - - // the following code is on loan from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/plus4/pla.c until we get the PLA dumped - - #define I(b) (!!((i) & (1 << b))) - - #define I0_F7 I(0) - #define PHI0 I(1) - #define A15 I(2) - #define A4 I(3) - #define A5 I(4) - #define A6 I(5) - #define A7 I(6) - #define A12 I(7) - #define MUX I(8) - #define A14 I(9) - #define A8 I(10) - #define A9 I(11) - #define A13 I(12) - #define A11 I(13) - #define A10 I(14) - #define RAS_ I(15) - - /* unused_ 0 when 0111 011x 1001 011x */ - #define F0 RAS_ || !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ - !A12 || A7 || A6 || !A5 || A4 || !A15 || !PHI0 - /* PHI2 1 when 0xxx xxxx xxxx xx11 */ - #define F1 !RAS_ && PHI0 && I0_F7 - /* USER_ 0 when 0111 011x 1000 1111 */ - #define F2 RAS_ || !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ - !A12 || A7 || A6 || A5 || !A4 || !A15 || !PHI0 || !I0_F7 - /* 6551_ 0 when x111 011x 1000 011x */ - #define F3 !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ - !A12 || A7 || A6 || A5 || A4 || !A15 || !PHI0 - /* ADDR_CLK 0 when 1111 011x 1110 1111 */ - #define F4 RAS_ || !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ - !A12 || !A7 || !A6 || A5 || !A4 || !A15 || !PHI0 || !I0_F7 - /* KEYPORT_ 0 when 0111 011x 1001 1111 */ - #define F5 RAS_ || !A10 || !A11 || !A13 || A9 || !A8 || !A14 || \ - !A12 || A7 || A6 || !A5 || !A4 || !A15 || !PHI0 || !I0_F7 - /* KERNAL_ 1 when x111 001x 1xxx x1xx */ - #define F6 A10 && A11 && A13 && !A9 && !A8 && A14 && \ - A12 && A15 - /* I0_F7 1 when xxxx xxx1 xxxx xxxx or - when 0xxx xxxx xxxx xx11 */ - #define F7 MUX || (F1) - - *scs = F0; - *phi2 = F1; - *user = F2; - *_6551 = F3; - *addr_clk = F4; - *keyport = F5; - *kernal = F6; -} - - -//------------------------------------------------- -// read_memory - -//------------------------------------------------- - -UINT8 plus4_state::read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal) -{ - int cs0 = 1, cs1 = 1, c1l = 1, c1h = 1, c2l = 1, c2h = 1; - UINT8 data = m_ted->read(space, offset, cs0, cs1); - - //logerror("offset %04x user %u 6551 %u addr_clk %u keyport %u kernal %u cs0 %u cs1 %u\n", offset,user,_6551,addr_clk,keyport,kernal,cs0,cs1); - - if (!scs && m_vslsi) - { - data = m_vslsi->read(space, offset & 0x03); - } - else if (!user) - { - if (m_spi_user) - { - data = m_spi_user->read(space, 0); - } - - data &= ~0x04; - data |= m_cassette->sense_r() << 2; - } - else if (!_6551 && m_acia) - { - data = m_acia->read(space, offset & 0x03); - } - else if (!keyport) - { - data = m_spi_kb->read(space, 0); - } - else if (!cs0) - { - switch (m_addr & 0x03) - { - case CS0_BASIC: - data = m_kernal->base()[offset & 0x7fff]; - break; - - case CS0_FUNCTION_LO: - if (m_function != NULL) - { - data = m_function->base()[offset & 0x7fff]; - } - break; - - case CS0_C1_LOW: - c1l = 0; - break; - - case CS0_C2_LOW: - c2l = 0; - - if (m_c2 != NULL) - { - data = m_c2->base()[offset & 0x7fff]; - } - break; - } - } - else if (!cs1) - { - if (kernal) - { - data = m_kernal->base()[offset & 0x7fff]; - } - else - { - switch ((m_addr >> 2) & 0x03) - { - case CS1_KERNAL: - data = m_kernal->base()[offset & 0x7fff]; - break; - - case CS1_FUNCTION_HI: - if (m_function != NULL) - { - data = m_function->base()[offset & 0x7fff]; - } - break; - - case CS1_C1_HIGH: - c1h = 0; - break; - - case CS1_C2_HIGH: - c2h = 0; - - if (m_c2 != NULL) - { - data = m_c2->base()[offset & 0x7fff]; - } - break; - } - } - } - else if (offset < 0xfd00 || offset >= 0xff20) - { - data = m_ram->pointer()[offset & m_ram->mask()]; - } - - return m_exp->cd_r(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h); -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( plus4_state::read ) -{ - int phi0 = 1, mux = 0, ras = 0, ba = 1; - int scs, phi2, user, _6551, addr_clk, keyport, kernal; - - bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal); - - return read_memory(space, offset, ba, scs, phi2, user, _6551, addr_clk, keyport, kernal); -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( plus4_state::write ) -{ - int scs, phi2, user, _6551, addr_clk, keyport, kernal; - int phi0 = 1, mux = 0, ras = 0, ba = 1; - int cs0 = 1, cs1 = 1, c1l = 1, c1h = 1, c2l = 1, c2h = 1; - - bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal); - - m_ted->write(space, offset, data, cs0, cs1); - - //logerror("write offset %04x data %02x user %u 6551 %u addr_clk %u keyport %u kernal %u cs0 %u cs1 %u\n", offset,data,user,_6551,addr_clk,keyport,kernal,cs0,cs1); - - if (!scs && m_vslsi) - { - m_vslsi->write(space, offset & 0x03, data); - } - else if (!user && m_spi_user) - { - m_spi_user->write(space, 0, data); - } - else if (!_6551 && m_acia) - { - m_acia->write(space, offset & 0x03, data); - } - else if (!addr_clk) - { - m_addr = offset & 0x0f; - } - else if (!keyport) - { - m_spi_kb->write(space, 0, data); - } - else if (offset < 0xfd00 || offset >= 0xff20) - { - m_ram->pointer()[offset & m_ram->mask()] = data; - } - - m_exp->cd_w(space, offset, data, ba, cs0, c1l, c1h, cs1, c2l, c2h); -} - - -//------------------------------------------------- -// ted_videoram_r - -//------------------------------------------------- - -READ8_MEMBER( plus4_state::ted_videoram_r ) -{ - int phi0 = 1, mux = 0, ras = 1, ba = 0; - int scs, phi2, user, _6551, addr_clk, keyport, kernal; - - bankswitch(offset, phi0, mux, ras, &scs, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal); - - return read_memory(space, offset, ba, scs, phi2, user, _6551, addr_clk, keyport, kernal); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( plus4_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( plus4_mem, AS_PROGRAM, 8, plus4_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( ted_videoram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ted_videoram_map, AS_0, 8, plus4_state ) - AM_RANGE(0x0000, 0xffff) AM_READ(ted_videoram_r) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( plus4 ) -//------------------------------------------------- - -static INPUT_PORTS_START( plus4 ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP f7") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0xA3) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left & Right)") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 \xE2\x86\x91") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(0x2191) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= Pi \xE2\x86\x90") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('=') PORT_CHAR(0x03C0) PORT_CHAR(0x2190) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clear") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START( "LOCK" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( c16 ) -//------------------------------------------------- - -static INPUT_PORTS_START( c16 ) - PORT_INCLUDE( plus4 ) - - PORT_MODIFY( "ROW0" ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(0xA3) - - PORT_MODIFY( "ROW5" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_MODIFY( "ROW6" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= Pi \xE2\x86\x90") PORT_CODE(KEYCODE_PGDN) PORT_CHAR('=') PORT_CHAR(0x03C0) PORT_CHAR(0x2190) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// M6510_INTERFACE( cpu_intf ) -//------------------------------------------------- - -READ8_MEMBER( plus4_state::cpu_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 CST RD - 5 - 6 IEC CLK IN - 7 IEC DATA IN, CST SENSE - - */ - - UINT8 data = 0x2f; - - // cassette read - data |= m_cassette->read() << 4; - - // serial clock - data |= m_iec->clk_r() << 6; - - // serial data, cassette sense - data |= (m_iec->data_r() && m_cassette->sense_r()) << 7; - - return data; -} - -READ8_MEMBER( c16_state::cpu_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 CST RD - 5 - 6 IEC CLK IN - 7 IEC DATA IN - - */ - - UINT8 data = 0; - - // cassette read - data |= m_cassette->read() << 4; - - // serial clock - data |= m_iec->clk_r() << 6; - - // serial data - data |= m_iec->data_r() << 7; - - return data; -} - -WRITE8_MEMBER( plus4_state::cpu_w ) -{ - /* - - bit description - - 0 IEC DATA - 1 IEC CLK, CST WR - 2 IEC ATN - 3 CST MTR - 4 - 5 - 6 (CST WR) - 7 - - */ - - //logerror("%s cpu write %02x\n", machine().describe_context(), data); - - // serial data - m_iec->data_w(!BIT(data, 0)); - - // serial clock - m_iec->clk_w(!BIT(data, 1)); - - // serial attention - m_iec->atn_w(!BIT(data, 2)); - - // cassette motor - m_cassette->motor_w(BIT(data, 3)); - - // cassette write - m_cassette->write(!BIT(data, 1)); -} - - -//------------------------------------------------- -// ted7360_interface ted_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( plus4_state::ted_irq_w ) -{ - m_ted_irq = state; - - check_interrupts(); -} - -READ8_MEMBER( plus4_state::ted_k_r ) -{ - /* - - bit description - - 0 JOY A0, JOY B0 - 1 JOY A1, JOY B1 - 2 JOY A2, JOY B2 - 3 JOY A3, JOY B3 - 4 - 5 - 6 BTN A - 7 BTN B - - */ - - UINT8 data = 0xff; - - // joystick - if (!BIT(offset, 2)) - { - UINT8 joy_a = m_joy1->joy_r(); - - data &= (0xf0 | (joy_a & 0x0f)); - data &= ~(!BIT(joy_a, 5) << 6); - } - - if (!BIT(offset, 1)) - { - UINT8 joy_b = m_joy2->joy_r(); - - data &= (0xf0 | (joy_b & 0x0f)); - data &= ~(!BIT(joy_b, 5) << 7); - } - - // keyboard - if (!BIT(m_kb, 7)) data &= m_row7->read(); - if (!BIT(m_kb, 6)) data &= m_row6->read(); - if (!BIT(m_kb, 5)) data &= m_row5->read(); - if (!BIT(m_kb, 4)) data &= m_row4->read(); - if (!BIT(m_kb, 3)) data &= m_row3->read(); - if (!BIT(m_kb, 2)) data &= m_row2->read(); - if (!BIT(m_kb, 1)) data &= m_row1->read() & m_lock->read(); - if (!BIT(m_kb, 0)) data &= m_row0->read(); - - return data; -} - - - -//------------------------------------------------- -// MOS6551_INTERFACE( acia_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( plus4_state::acia_irq_w ) -{ - m_acia_irq = state; - - check_interrupts(); -} - - -//------------------------------------------------- -// PLUS4_EXPANSION_INTERFACE( expansion_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( plus4_state::exp_irq_w ) -{ - m_exp_irq = state; - - check_interrupts(); -} - - -//------------------------------------------------- -// SLOT_INTERFACE( cbm_datassette_devices ) -//------------------------------------------------- - -SLOT_INTERFACE_START( plus4_datassette_devices ) - SLOT_INTERFACE("c1531", C1531) - SLOT_INTERFACE("diag264", DIAG264_CASSETTE_LOOPBACK) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( plus4 ) -//------------------------------------------------- - -void plus4_state::machine_start() -{ - // initialize memory - UINT8 data = 0xff; - - for (offs_t offset = 0; offset < m_ram->size(); offset++) - { - m_ram->pointer()[offset] = data; - if (!(offset % 64)) data ^= 0xff; - } - - // state saving - save_item(NAME(m_addr)); - save_item(NAME(m_ted_irq)); - save_item(NAME(m_acia_irq)); - save_item(NAME(m_exp_irq)); - save_item(NAME(m_kb)); - - if (m_acia) - { - m_acia->write_cts(0); - } - - m_spi_kb->write_p0(1); - m_spi_kb->write_p1(1); - m_spi_kb->write_p2(1); - m_spi_kb->write_p3(1); - m_spi_kb->write_p4(1); - m_spi_kb->write_p5(1); - m_spi_kb->write_p6(1); - m_spi_kb->write_p7(1); -} - - -void plus4_state::machine_reset() -{ - m_maincpu->reset(); - - m_iec->reset(); - - if (m_acia) - { - m_acia->reset(); - } - - m_exp->reset(); - - if (m_user) - { - m_user->write_3(0); - m_user->write_3(1); - } - - m_addr = 0; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( plus4 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( plus4, plus4_state ) - // basic machine hardware - MCFG_CPU_ADD(MOS7501_TAG, M7501, 0) - MCFG_CPU_PROGRAM_MAP(plus4_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_M7501_PORT_CALLBACKS(READ8(plus4_state, cpu_r), WRITE8(plus4_state, cpu_w)) - MCFG_M7501_PORT_PULLS(0x00, 0xc0) - MCFG_QUANTUM_PERFECT_CPU(MOS7501_TAG) - - // video and sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_MOS7360_ADD(MOS7360_TAG, SCREEN_TAG, MOS7501_TAG, 0, ted_videoram_map, WRITELINE(plus4_state, ted_irq_w), READ8(plus4_state, ted_k_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_PLS100_ADD(PLA_TAG) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, plus4_user_port_cards, NULL) - MCFG_PET_USER_PORT_4_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p2)) // cassette sense - MCFG_PET_USER_PORT_5_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p3)) - MCFG_PET_USER_PORT_6_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p4)) - MCFG_PET_USER_PORT_7_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p5)) - MCFG_PET_USER_PORT_8_HANDLER(DEVWRITELINE(MOS6551_TAG, mos6551_device, write_rxc)) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p0)) - MCFG_PET_USER_PORT_C_HANDLER(DEVWRITELINE(MOS6551_TAG, mos6551_device, write_rxd)) - MCFG_PET_USER_PORT_F_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p7)) - MCFG_PET_USER_PORT_H_HANDLER(DEVWRITELINE(MOS6551_TAG, mos6551_device, write_dcd)) MCFG_DEVCB_XOR(1) // TODO: add missing pull up before inverter - MCFG_PET_USER_PORT_J_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p6)) - MCFG_PET_USER_PORT_K_HANDLER(DEVWRITELINE(MOS6529_USER_TAG, mos6529_device, write_p1)) - MCFG_PET_USER_PORT_L_HANDLER(DEVWRITELINE(MOS6551_TAG, mos6551_device, write_dsr)) MCFG_DEVCB_XOR(1) // TODO: add missing pull up before inverter - - MCFG_DEVICE_ADD(MOS6551_TAG, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_RXC_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_8)) - MCFG_MOS6551_RTS_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_d)) MCFG_DEVCB_XOR(1) - MCFG_MOS6551_DTR_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_e)) MCFG_DEVCB_XOR(1) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_m)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(plus4_state, acia_irq_w)) - - MCFG_DEVICE_ADD(MOS6529_USER_TAG, MOS6529, 0) - MCFG_MOS6529_P0_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_b)) - MCFG_MOS6529_P1_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_k)) - MCFG_MOS6529_P2_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) - MCFG_MOS6529_P3_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) - MCFG_MOS6529_P4_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_6)) - MCFG_MOS6529_P5_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_7)) - MCFG_MOS6529_P6_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_j)) - MCFG_MOS6529_P7_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_f)) - - MCFG_DEVICE_ADD(MOS6529_KB_TAG, MOS6529, 0) - MCFG_MOS6529_P0_HANDLER(WRITELINE(plus4_state, write_kb0)) - MCFG_MOS6529_P1_HANDLER(WRITELINE(plus4_state, write_kb1)) - MCFG_MOS6529_P2_HANDLER(WRITELINE(plus4_state, write_kb2)) - MCFG_MOS6529_P3_HANDLER(WRITELINE(plus4_state, write_kb3)) - MCFG_MOS6529_P4_HANDLER(WRITELINE(plus4_state, write_kb4)) - MCFG_MOS6529_P5_HANDLER(WRITELINE(plus4_state, write_kb5)) - MCFG_MOS6529_P6_HANDLER(WRITELINE(plus4_state, write_kb6)) - MCFG_MOS6529_P7_HANDLER(WRITELINE(plus4_state, write_kb7)) - - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, plus4_datassette_devices, "c1531", NULL) - - MCFG_CBM_IEC_ADD("c1541") - MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_9)) - - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") - MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, plus4_expansion_cards, NULL) - MCFG_PLUS4_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(plus4_state, exp_irq_w)) - MCFG_PLUS4_EXPANSION_SLOT_CD_INPUT_CALLBACK(READ8(plus4_state, read)) - MCFG_PLUS4_EXPANSION_SLOT_CD_OUTPUT_CALLBACK(WRITE8(plus4_state, write)) - MCFG_PLUS4_EXPANSION_SLOT_AEC_CALLBACK(INPUTLINE(MOS7501_TAG, INPUT_LINE_HALT)) - - MCFG_QUICKLOAD_ADD("quickload", plus4_state, cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( plus4p ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( plus4p, plus4, c16_state ) - MCFG_DEVICE_MODIFY(MOS7501_TAG) - MCFG_DEVICE_CLOCK(XTAL_17_73447MHz/20) - - MCFG_DEVICE_MODIFY(MOS7360_TAG) - MCFG_DEVICE_CLOCK(XTAL_17_73447MHz/5) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list", "plus4_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "plus4_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "plus4_flop") - MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") - MCFG_SOFTWARE_LIST_FILTER("cass_list", "PAL") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( plus4n ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( plus4n, plus4, c16_state ) - MCFG_DEVICE_MODIFY(MOS7501_TAG) - MCFG_DEVICE_CLOCK(XTAL_14_31818MHz/16) - - MCFG_DEVICE_MODIFY(MOS7360_TAG) - MCFG_DEVICE_CLOCK(XTAL_14_31818MHz/4) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list", "plus4_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "plus4_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "plus4_flop") - MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("cass_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( c16n ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( c16n, plus4n, c16_state ) - MCFG_CPU_MODIFY(MOS7501_TAG) - MCFG_M7501_PORT_CALLBACKS(READ8(c16_state, cpu_r), WRITE8(plus4_state, cpu_w)) - MCFG_M7501_PORT_PULLS(0x00, 0xc0) - - MCFG_DEVICE_REMOVE(MOS6551_TAG) - MCFG_DEVICE_REMOVE(MOS6529_USER_TAG) - MCFG_DEVICE_REMOVE(PET_USER_PORT_TAG) - - MCFG_DEVICE_MODIFY(CBM_IEC_TAG) - MCFG_CBM_IEC_BUS_ATN_CALLBACK(NULL) - - MCFG_DEVICE_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("64K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( c16p ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED_CLASS( c16p, plus4p, c16_state ) - MCFG_CPU_MODIFY(MOS7501_TAG) - MCFG_M7501_PORT_CALLBACKS(READ8(c16_state, cpu_r), WRITE8(plus4_state, cpu_w)) - MCFG_M7501_PORT_PULLS(0x00, 0xc0) - - MCFG_DEVICE_REMOVE(MOS6551_TAG) - MCFG_DEVICE_REMOVE(MOS6529_USER_TAG) - MCFG_DEVICE_REMOVE(PET_USER_PORT_TAG) - - MCFG_DEVICE_MODIFY(CBM_IEC_TAG) - MCFG_CBM_IEC_BUS_ATN_CALLBACK(NULL) - - MCFG_DEVICE_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("64K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( c232 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( c232, c16p ) - MCFG_DEVICE_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( v364 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( v364, plus4n ) - MCFG_SOUND_ADD(T6721A_TAG, T6721A, XTAL_640kHz) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_MOS8706_ADD(MOS8706_TAG, XTAL_14_31818MHz/16) -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( c264 ) -//------------------------------------------------- - -ROM_START( c264 ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_LOAD( "basic-264.bin", 0x0000, 0x4000, CRC(6a2fc8e3) SHA1(473fce23afa07000cdca899fbcffd6961b36a8a0) ) - ROM_LOAD( "kernal-264.bin", 0x4000, 0x4000, CRC(8f32abe7) SHA1(d481faf5fcbb331878dc7851c642d04f26a32873) ) - - ROM_REGION( 0x8000, "function", ROMREGION_ERASE00 ) - // TODO: add cart slots to mount EPROMs here - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02", 0x00, 0xf5, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( c232 ) -//------------------------------------------------- - -ROM_START( c232 ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_LOAD( "318006-01.u4", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) - ROM_LOAD( "318004-01.u5", 0x4000, 0x4000, CRC(dbdc3319) SHA1(3c77caf72914c1c0a0875b3a7f6935cd30c54201) ) - - ROM_REGION( 0x8000, "function", ROMREGION_ERASE00 ) - // TODO: add cart slots to mount EPROMs here - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02.u7", 0x00, 0xf5, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( v364 ) -//------------------------------------------------- - -ROM_START( v364 ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_LOAD( "318006-01", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) - ROM_LOAD( "kern364p", 0x4000, 0x4000, CRC(84fd4f7a) SHA1(b9a5b5dacd57ca117ef0b3af29e91998bf4d7e5f) ) - - ROM_REGION( 0x8000, "function", 0 ) - ROM_LOAD( "317053-01", 0x0000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) - ROM_LOAD( "317054-01", 0x4000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) - - ROM_REGION( 0x8000, "c2", 0 ) - ROM_LOAD( "spk3cc4.bin", 0x0000, 0x4000, CRC(5227c2ee) SHA1(59af401cbb2194f689898271c6e8aafa28a7af11) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02", 0x00, 0xf5, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( plus4 ) -//------------------------------------------------- - -ROM_START( plus4 ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_DEFAULT_BIOS("r5") - ROM_SYSTEM_BIOS( 0, "r4", "Revision 4" ) - ROMX_LOAD( "318005-04.u24", 0x4000, 0x4000, CRC(799a633d) SHA1(5df52c693387c0e2b5d682613a3b5a65477311cf), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r5", "Revision 5" ) - ROMX_LOAD( "318005-05.u24", 0x4000, 0x4000, CRC(70295038) SHA1(a3d9e5be091b98de39a046ab167fb7632d053682), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "jiffydos", "JiffyDOS v6.01" ) - ROMX_LOAD( "jiffydos plus4.u24", 0x0000, 0x8000, CRC(818d3f45) SHA1(9bc1b1c3da9ca642deae717905f990d8e36e6c3b), ROM_BIOS(3) ) // first half contains R5 kernal - - ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) - - ROM_REGION( 0x8000, "function", 0 ) - ROM_LOAD( "317053-01.u25", 0x0000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) - ROM_LOAD( "317054-01.u26", 0x4000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02.u19", 0x00, 0xf5, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( plus4p ) -//------------------------------------------------- - -ROM_START( plus4p ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) - - ROM_DEFAULT_BIOS("r5") - ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) - ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) - ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) - ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) - - ROM_REGION( 0x8000, "function", 0 ) - ROM_LOAD( "317053-01.u25", 0x0000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) - ROM_LOAD( "317054-01.u26", 0x4000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02.u19", 0x00, 0xf5, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( c16 ) -//------------------------------------------------- - -ROM_START( c16 ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_DEFAULT_BIOS("r5") - ROM_SYSTEM_BIOS( 0, "r4", "Revision 4" ) - ROMX_LOAD( "318005-04.u24", 0x4000, 0x4000, CRC(799a633d) SHA1(5df52c693387c0e2b5d682613a3b5a65477311cf), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r5", "Revision 5" ) - ROMX_LOAD( "318005-05.u24", 0x4000, 0x4000, CRC(70295038) SHA1(a3d9e5be091b98de39a046ab167fb7632d053682), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "jiffydos", "JiffyDOS v6.01" ) - ROMX_LOAD( "jiffydos plus4.u24", 0x0000, 0x8000, CRC(818d3f45) SHA1(9bc1b1c3da9ca642deae717905f990d8e36e6c3b), ROM_BIOS(3) ) // first half contains R5 kernal - - ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02.u19", 0x00, 0xf5, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( c16p ) -//------------------------------------------------- - -ROM_START( c16p ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) - - ROM_DEFAULT_BIOS("r5") - ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) - ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) - ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) - ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02.u16", 0x00, 0xf5, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( c16_hu ) -//------------------------------------------------- - -ROM_START( c16_hu ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) - - ROM_DEFAULT_BIOS("r2") - ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) - ROMX_LOAD( "318030-01.u4", 0x4000, 0x4000, NO_DUMP, ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) - ROMX_LOAD( "318030-02.u4", 0x4000, 0x4000, CRC(775f60c5) SHA1(20cf3c4bf6c54ef09799af41887218933f2e27ee), ROM_BIOS(2) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02.u16", 0x00, 0xf5, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( c116 ) -//------------------------------------------------- - -ROM_START( c116 ) - ROM_REGION( 0x8000, "kernal", 0 ) - ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) - - ROM_DEFAULT_BIOS("r5") - ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) - ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) - ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) - ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) - - ROM_REGION( 0xf5, PLA_TAG, 0 ) - ROM_LOAD( "251641-02.u101", 0x00, 0xf5, NO_DUMP ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1984, c264, 0, 0, plus4n, plus4, driver_device, 0, "Commodore Business Machines", "Commodore 264 (Prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -COMP( 1984, c232, c264, 0, c232, plus4, driver_device, 0, "Commodore Business Machines", "Commodore 232 (Prototype)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, v364, c264, 0, v364, plus4, driver_device, 0, "Commodore Business Machines", "Commodore V364 (Prototype)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, plus4, c264, 0, plus4n, plus4, driver_device, 0, "Commodore Business Machines", "Plus/4 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, plus4p, c264, 0, plus4p, plus4, driver_device, 0, "Commodore Business Machines", "Plus/4 (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, c16, c264, 0, c16n, c16, driver_device, 0, "Commodore Business Machines", "Commodore 16 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, c16p, c264, 0, c16p, c16, driver_device, 0, "Commodore Business Machines", "Commodore 16 (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, c16_hu, c264, 0, c16p, c16, driver_device, 0, "Commodore Business Machines", "Commodore 16 (Hungary)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, c116, c264, 0, c16p, c16, driver_device, 0, "Commodore Business Machines", "Commodore 116", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/pm68k.c b/src/mess/drivers/pm68k.c deleted file mode 100644 index 8aac2f9f853..00000000000 --- a/src/mess/drivers/pm68k.c +++ /dev/null @@ -1,104 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Callan PM68K Unix mainframe. - -2013-09-04 Skeleton driver - -Status: Boots into monitor, some commands work, some freeze. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class pm68k_state : public driver_device -{ -public: - pm68k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_base(*this, "rambase"), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ16_MEMBER(keyin_r); - DECLARE_READ16_MEMBER(status_r); -private: - UINT8 m_term_data; - virtual void machine_reset(); - required_shared_ptr m_p_base; - required_device m_maincpu; - required_device m_terminal; -}; - -READ16_MEMBER( pm68k_state::keyin_r ) -{ - UINT16 ret = m_term_data; - m_term_data = 0; - return ret << 8; -} - -READ16_MEMBER( pm68k_state::status_r ) -{ - return (m_term_data) ? 0x500 : 0x400; -} - - -static ADDRESS_MAP_START(pm68k_mem, AS_PROGRAM, 16, pm68k_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xffffff) - AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_SHARE("rambase") - AM_RANGE(0x200000, 0x205fff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x600000, 0x600001) AM_READ(keyin_r) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0xff00) - AM_RANGE(0x600002, 0x600003) AM_READ(status_r) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( pm68k ) -INPUT_PORTS_END - - -void pm68k_state::machine_reset() -{ - UINT8* ROM = memregion("maincpu")->base(); - memcpy(m_p_base, ROM, 8); - m_maincpu->reset(); -} - -WRITE8_MEMBER( pm68k_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( pm68k, pm68k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 8000000) - MCFG_CPU_PROGRAM_MAP(pm68k_mem) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(pm68k_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pm68k ) - ROM_REGION16_BE(0x6000, "maincpu", 0) - ROM_LOAD16_BYTE("u103", 0x00000, 0x1000, CRC(86d32d6c) SHA1(ce9c54b62c64c37ae9106fb06b8a2b2152d1ddf6) ) - ROM_LOAD16_BYTE("u101", 0x00001, 0x1000, CRC(66607e54) SHA1(06f380fdeba13dc3aee826dd166f4bd3031febb9) ) - ROM_LOAD16_BYTE("u104", 0x02000, 0x2000, CRC(ccd2ba4d) SHA1(5cdcf875e136aa9af5f150e0102cd209c496885e) ) - ROM_LOAD16_BYTE("u102", 0x02001, 0x2000, CRC(48182abd) SHA1(a6e4fb62c5f04cb397c6c3294723ec1f7bc3b680) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, pm68k, 0, 0, pm68k, pm68k, driver_device, 0, "Callan Data Systems", "PM68K", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/pmd85.c b/src/mess/drivers/pmd85.c deleted file mode 100644 index ce1189c9592..00000000000 --- a/src/mess/drivers/pmd85.c +++ /dev/null @@ -1,813 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/******************************************************************************* - -PMD-85 driver by Krzysztof Strzecha - -What's new: ------------ - -27.06.2004 Mato crash fixed. -21.05.2004 V.24 / Tape switch added. V.24 is not emulated. -25.04.2004 PMD-85.1 tape emulation with support for .pmd format files added. -19.04.2004 Verified PMD-85.1 and PMD-85.2 monitor roms and replaced with - unmodified ones. - Memory system cleanups. -03.04.2004 PMD-85.3 and Mato (PMD-85.2 clone) drivers. - Preliminary and not working tape support. - Reset key fixed. PMD-85.1 fixed. -15.03.2004 Added drivers for: PMD-85.2, PMD-85.2A, PMD-85.2B and Didaktik - Alfa (PMD-85.1 clone). Keyboard finished. Natural keyboard added. - Memory system rewritten. I/O system rewritten. Support for Basic - ROM module added. Video emulation rewritten. -30.11.2002 Memory mapping improved. -06.07.2002 Preliminary driver. - -Notes on emulation status and to do list: ------------------------------------------ - -1. V.24. -2. Tape emulation for other machines than PMD-85.1. -3. Flash video attribute. -4. External interfaces connectors (K2-K5). -5. Speaker. -6. Verify PMD-85.2A, PMD-85.3, Didaktik Alfa and Mato monitor roms. -7. Verify all Basic roms. -8. 8251 in Didaktik Alfa. -9. Colors (if any). -10. PMD-85, Didaktik Alfa 2 and Didaktik Beta (ROMs and documentation needed). -11. FDD interface (ROMs and disk images needed). -12. "Duch & Pampuch" Mato game displays scores with incorrect characters. - -PMD-85 technical information -============================ - -Memory map: ------------ - - PMD-85.1, PMD-85.2 - ------------------ - - start-up map (cleared by the first I/O write operation done by the CPU): - 0000-0fff ROM mirror #1 - 1000-1fff not mapped - 2000-2fff ROM mirror #2 - 3000-3fff not mapped - 4000-7fff Video RAM mirror #1 - 8000-8fff ROM - 9000-9fff not mapped - a000-afff ROM mirror #3 - b000-bfff not mapped - c000-ffff Video RAM - - normal map: - 0000-7fff RAM - 8000-8fff ROM - 9000-9fff not mapped - a000-afff ROM mirror #1 - b000-bfff not mapped - c000-ffff Video RAM - - Didaktik Alfa (PMD-85.1 clone) - ------------------------------ - - start-up map (cleared by the first I/O write operation done by the CPU): - 0000-0fff ROM mirror - 1000-33ff BASIC mirror - 3400-3fff not mapped - 4000-7fff Video RAM mirror - 8000-8fff ROM - 9000-b3ff BASIC - b400-bfff not mapped - c000-ffff Video RAM - - normal map: - 0000-7fff RAM - 8000-8fff ROM - 9000-b3ff BASIC - b400-bfff not mapped - c000-ffff Video RAM - - PMD-85.2A, PMD-85.2B - -------------------- - - start-up map (cleared by the first I/O write operation done by the CPU): - 0000-0fff ROM mirror #1 - 1000-1fff RAM #2 mirror - 2000-2fff ROM mirror #2 - 3000-3fff RAM #3 mirror - 4000-7fff Video RAM mirror #1 - 8000-8fff ROM - 9000-9fff RAM #2 - a000-afff ROM mirror #3 - b000-bfff RAM #3 - c000-ffff Video RAM - - normal map: - 0000-7fff RAM #1 - 8000-8fff ROM - 9000-9fff RAM #2 - a000-afff ROM mirror #1 - b000-bfff RAM #3 - c000-ffff Video RAM - - PMD-85.3 - -------- - - start-up map (cleared by the first I/O write operation done by the CPU): - 0000-1fff ROM mirror #1 read, RAM write - 2000-3fff ROM mirror #2 read, RAM write - 4000-5fff ROM mirror #3 read, RAM write - 6000-7fff ROM mirror #4 read, RAM write - 8000-9fff ROM mirror #5 read, RAM write - a000-bfff ROM mirror #6 read, RAM write - c000-dfff ROM mirror #7 read, Video RAM #1 write - e000-ffff ROM, Video RAM #2 write - - normal map: - 0000-bfff RAM - c000-dfff Video RAM #1 - e000-ffff Video RAM #2 / ROM read, Video RAM #2 write - - Mato - ---- - - start-up map (cleared by the first I/O write operation done by the CPU): - 0000-3fff ROM mirror #1 - 4000-7fff Video RAM mirror #1 - 8000-bfff ROM - c000-ffff Video RAM - - normal map: - 0000-7fff RAM - 8000-bfff ROM - c000-ffff Video RAM - -I/O ports ---------- - - I/O board - --------- - 1xxx11aa external interfaces connector (K2) - - 0xxx11aa I/O board interfaces - 000111aa 8251 (casette recorder, V24) - 010011aa 8255 (GPIO/0, GPIO/1) - 010111aa 8253 - 011111aa 8255 (IMS-2) - I/O board is not supported by Mato. - - Motherboard - ----------- - 1xxx01aa 8255 (keyboard, speaker, LEDs) - PMD-85.3 memory banking - Mato cassette recorder - - ROM Module - ---------- - 1xxx10aa 8255 (ROM reading) - ROM module is not supported by Didaktik Alfa and Mato. - - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "includes/pmd85.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/i8251.h" -#include "formats/pmd_cas.h" -#include "machine/ram.h" - - -//************************************************************************** -// VIDEO EMULATION -//************************************************************************** - -UINT32 pmd85_state::screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int y = 0; y < 256; y++) - { - // address of current line in PMD-85 video memory - UINT8 *line = m_ram->pointer() + 0xc000 + 0x40 * y; - - for (int x = 0; x < 288/6; x++) - { - int pen = BIT(line[x], 7) ? 1 : 2; - - bitmap.pix16(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; - bitmap.pix16(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; - bitmap.pix16(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; - bitmap.pix16(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; - bitmap.pix16(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; - bitmap.pix16(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; - } - - } - - return 0; -} - - -/* I/O ports */ - -static ADDRESS_MAP_START( pmd85_io_map, AS_IO, 8, pmd85_state ) - AM_RANGE( 0x00, 0xff) AM_READWRITE(pmd85_io_r, pmd85_io_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mato_io_map, AS_IO, 8, pmd85_state ) - AM_RANGE( 0x00, 0xff) AM_READWRITE(mato_io_r, mato_io_w ) -ADDRESS_MAP_END - -/* memory w/r functions */ - -static ADDRESS_MAP_START( pmd85_mem , AS_PROGRAM, 8, pmd85_state ) - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") - AM_RANGE(0x1000, 0x1fff) AM_RAMBANK("bank2") - AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") - AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank5") - AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bank6") - AM_RANGE(0x9000, 0x9fff) AM_NOP - AM_RANGE(0xa000, 0xafff) AM_READ_BANK("bank7") - AM_RANGE(0xb000, 0xbfff) AM_NOP - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank8") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pmd852a_mem , AS_PROGRAM, 8, pmd85_state ) - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") - AM_RANGE(0x1000, 0x1fff) AM_RAMBANK("bank2") - AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") - AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank5") - AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bank6") - AM_RANGE(0x9000, 0x9fff) AM_RAMBANK("bank7") - AM_RANGE(0xa000, 0xafff) AM_READ_BANK("bank8") - AM_RANGE(0xb000, 0xbfff) AM_RAMBANK("bank9") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank10") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pmd853_mem , AS_PROGRAM, 8, pmd85_state ) - AM_RANGE(0x0000, 0x1fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank9") - AM_RANGE(0x2000, 0x3fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank10") - AM_RANGE(0x4000, 0x5fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank11") - AM_RANGE(0x6000, 0x7fff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank12") - AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank13") - AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank14") - AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank7") AM_WRITE_BANK("bank15") - AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank16") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( alfa_mem , AS_PROGRAM, 8, pmd85_state ) - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") - AM_RANGE(0x1000, 0x33ff) AM_RAMBANK("bank2") - AM_RANGE(0x3400, 0x3fff) AM_RAMBANK("bank3") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank4") - AM_RANGE(0x8000, 0x8fff) AM_READ_BANK("bank5") - AM_RANGE(0x9000, 0xb3ff) AM_READ_BANK("bank6") - AM_RANGE(0xb400, 0xbfff) AM_NOP - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank7") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mato_mem , AS_PROGRAM, 8, pmd85_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( c2717_mem , AS_PROGRAM, 8, pmd85_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -/* keyboard input */ - -static INPUT_PORTS_START( pmd85 ) - PORT_START("KEY0") /* port 0x00 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K0") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY1") /* port 0x01 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY2") /* port 0x02 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY3") /* port 0x03 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY4") /* port 0x04 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY5") /* port 0x05 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY6") /* port 0x06 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY7") /* port 0x07 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY8") /* port 0x08 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY9") /* port 0x09 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY10") /* port 0x0a */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY11") /* port 0x0b */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('{') PORT_CHAR('}') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR(']') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY12") /* port 0x0c */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("WRK") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS PTL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<-") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<-") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY13") /* port 0x0d */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C-D") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("^\\") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("END") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL1") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY14") /* port 0x0e */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RCL") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("->") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("->|") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL2") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("KEY15") /* port 0x0f */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("RESET") /* port 0x10 */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_CHANGED_MEMBER(DEVICE_SELF, pmd85_state, pmd85_reset, 0) - - PORT_START("DSW0") /* port 0x11 */ - PORT_CONFNAME( 0x01, 0x00, "Basic ROM Module" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - PORT_CONFNAME( 0x02, 0x00, "Tape/V.24" ) - PORT_CONFSETTING( 0x00, "Tape" ) - PORT_CONFSETTING( 0x02, "V.24" ) -INPUT_PORTS_END - - -static INPUT_PORTS_START( alfa ) - PORT_INCLUDE( pmd85 ) - - PORT_MODIFY( "DSW0" ) - PORT_BIT( 0x01, 0x00, IPT_UNUSED ) -INPUT_PORTS_END - - -static INPUT_PORTS_START (mato) - PORT_START("KEY0") /* port 0x00 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("KEY1") /* port 0x01 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("KEY2") /* port 0x02 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("KEY3") /* port 0x03 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("KEY4") /* port 0x04 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('_') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("KEY5") /* port 0x05 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("KEY6") /* port 0x06 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("KEY7") /* port 0x07 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_START("KEY8") /* port 0x08 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Continue") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("RESET") /* port 0x09 */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_CHANGED_MEMBER(DEVICE_SELF, pmd85_state, pmd85_reset, 0) -INPUT_PORTS_END - - - -static const struct CassetteOptions pmd85_cassette_options = -{ - 1, /* channels */ - 16, /* bits per sample */ - 7200 /* sample frequency */ -}; - -/* machine definition */ -static MACHINE_CONFIG_START( pmd85, pmd85_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2000000) /* 2.048MHz ??? */ - MCFG_CPU_PROGRAM_MAP(pmd85_mem) - MCFG_CPU_IO_MAP(pmd85_io_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - -/******************************************************************************* - - I/O board 8253 - -------------- - - Timer 0: - OUT0 - external interfaces connector (K2) - CLK0 - external interfaces connector (K2) - GATE0 - external interfaces connector (K2), default = 1 - Timer 1: - OUT1 - external interfaces connector (K2), i8251 (for V24 only) - CLK1 - hardwired to 2 MHz system clock - GATE1 - external interfaces connector (K2), default = 1 - Timer 2: - OUT2 - unused - CLK2 - hardwired to 1HZ signal generator - GATE2 - hardwired to 5V, default = 1 - -*******************************************************************************/ - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_CLK2(1) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_SIZE(288, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 288-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(pmd85_state, screen_update_pmd85) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* cassette */ - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(pmd85_cassette_formats) - MCFG_CASSETTE_CREATE_OPTS(&pmd85_cassette_options) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("pmd85_cass") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list", "pmd85_cass") - - /* uart */ - MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(pmd85_state, write_cas_tx)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pmd851, pmd85 ) - - MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_0_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_0_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_0_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_0_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_0_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_0_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_1_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_1_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_1_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_1_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_1_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_1_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_2_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_2_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_2_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_2_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_2_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_2_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_3", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_3_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_3_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_3_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_3_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_3_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_3_portc_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pmd852a, pmd851 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pmd852a_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pmd853, pmd851 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pmd853_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( alfa, pmd85 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(alfa_mem) - - MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_0_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_0_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_0_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_0_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_0_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_0_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_1_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_1_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_1_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_1_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_1_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_1_portc_w)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_2_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_2_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, pmd85_ppi_2_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_2_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, pmd85_ppi_2_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, pmd85_ppi_2_portc_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mato, pmd85 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(mato_mem) - MCFG_CPU_IO_MAP(mato_io_map) - - MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pmd85_state, pmd85_ppi_0_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pmd85_state, pmd85_ppi_0_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pmd85_state, mato_ppi_0_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pmd85_state, pmd85_ppi_0_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pmd85_state, mato_ppi_0_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pmd85_state, mato_ppi_0_portc_w)) - - /* no uart */ - MCFG_DEVICE_REMOVE("uart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( c2717, pmd851 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(c2717_mem) -MACHINE_CONFIG_END - - -ROM_START(pmd851) - ROM_REGION(0x11000,"maincpu",0) - ROM_LOAD("pmd85-1.bin", 0x10000, 0x1000, CRC(ef50b416) SHA1(afa3ec0d03228adc5287a4cba905ce7ad0497dff)) - ROM_REGION(0x2400,"user1",0) - ROM_LOAD_OPTIONAL("pmd85-1.bas", 0x0000, 0x2400, CRC(4fc37d45) SHA1(3bd0f92f37a3f2ee539916dc75508bda37433a72)) -ROM_END - -ROM_START(pmd852) - ROM_REGION(0x11000,"maincpu",0) - ROM_LOAD("pmd85-2.bin", 0x10000, 0x1000, CRC(d4786f63) SHA1(6facdf37bb012714244b012a0c4bd715a956e42b)) - ROM_REGION(0x2400,"user1",0) - ROM_LOAD_OPTIONAL("pmd85-2.bas", 0x0000, 0x2400, CRC(fc4a3ebf) SHA1(3bfc0e9a5cd5187da573b5d539d7246358125a88)) -ROM_END - -ROM_START(pmd852a) - ROM_REGION(0x11000,"maincpu",0) - ROM_LOAD("pmd85-2a.bin", 0x10000, 0x1000, CRC(5a9a961b) SHA1(7363341596367d08b9a98767c6585ce18dfd03af)) - ROM_REGION(0x2400,"user1",0) - ROM_LOAD_OPTIONAL("pmd85-2a.bas", 0x0000, 0x2400, CRC(6ff379ad) SHA1(edcaf2420cac9771596ead5c86c41116b228eca3)) -ROM_END - -ROM_START(pmd852b) - ROM_REGION(0x11000,"maincpu",0) - ROM_LOAD("pmd85-2a.bin", 0x10000, 0x1000, CRC(5a9a961b) SHA1(7363341596367d08b9a98767c6585ce18dfd03af)) - ROM_REGION(0x2400,"user1",0) - ROM_LOAD_OPTIONAL("pmd85-2a.bas", 0x0000, 0x2400, CRC(6ff379ad) SHA1(edcaf2420cac9771596ead5c86c41116b228eca3)) -ROM_END - -ROM_START(pmd853) - ROM_REGION(0x12000,"maincpu",0) - ROM_LOAD("pmd85-3.bin", 0x10000, 0x2000, CRC(83e22c47) SHA1(5f131e27ae3ec8907adbe5cd228c67d131066084)) - ROM_REGION(0x2800,"user1",0) - ROM_LOAD_OPTIONAL("pmd85-3.bas", 0x0000, 0x2800, CRC(1e30e91d) SHA1(d086040abf4c0a7e5da8cf4db7d1668a1d9309a4)) -ROM_END - -ROM_START(alfa) - ROM_REGION(0x13400,"maincpu",0) - ROM_LOAD("alfa.bin", 0x10000, 0x1000, CRC(e425eedb) SHA1(db93b5de1e16b5ae71be08feb083a2ac15759495)) - ROM_LOAD("alfa.bas", 0x11000, 0x2400, CRC(9a73bfd2) SHA1(74314d989846f64e715f64deb84cb177fa62f4a9)) -ROM_END - -ROM_START(mato) - ROM_REGION(0x14000,"maincpu",0) - ROM_SYSTEM_BIOS(0, "default", "BASIC") - ROMX_LOAD("mato.bin", 0x10000, 0x4000, CRC(574110a6) SHA1(4ff2cd4b07a1a700c55f92e5b381c04f758fb461), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "ru", "Russian") - ROMX_LOAD("mato-ru.rom", 0x10000, 0x4000, CRC(44b68be4) SHA1(0d9ea9a9380e2af011a2f0b64c534dd0eb0a1fac), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "lan", "BASIC LAN") - ROMX_LOAD("mato-lan.rom", 0x10000, 0x4000, CRC(422cddde) SHA1(2a3dacf8e3e7637109c9d267f589a00881e9a5f4), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "games", "Games v1") - ROMX_LOAD("matoh.bin", 0x10000, 0x4000, CRC(ca25880d) SHA1(38ce0b6a26d48a09fdf96863c3eaf3705aca2590), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "gamesen", "Games v2 EN") - ROMX_LOAD("matogmen.rom", 0x10000, 0x4000, CRC(47e039c8) SHA1(6cc73a6b58921b33691d2751dee28428456eb222), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "gamessk", "Games v2 SK") - ROMX_LOAD("matogmsk.rom", 0x10000, 0x4000, CRC(d0c9b1e7) SHA1(9e7289d971a957bf161c317e5fa76db3289ee23c), ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "games3", "Games v3") - ROMX_LOAD("matogm3.rom", 0x10000, 0x4000, CRC(9352f2c1) SHA1(b3e45c56d2800c69a0bb02febda6fa715f1afbc3), ROM_BIOS(7)) -ROM_END - -ROM_START(c2717) - ROM_REGION(0x14000,"maincpu",0) - ROM_LOAD("c2717.rom", 0x10000, 0x4000, CRC(da1703b1) SHA1(9fb93e6cae8b551064c7175bf3b4e3113429ce73)) -ROM_END - -ROM_START(c2717pmd) - ROM_REGION(0x14000,"maincpu",0) - ROM_LOAD( "c2717-pmd32.rom", 0x10000, 0x4000, CRC(cbdd323c) SHA1(ee9fea11be8bd4f945c583b0ae5684269906d0ce)) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1985, pmd851, 0, 0, pmd851, pmd85, pmd85_state, pmd851, "Tesla", "PMD-85.1" , 0) -COMP( 1985, pmd852, pmd851, 0, pmd851, pmd85, pmd85_state, pmd851, "Tesla", "PMD-85.2" , 0) -COMP( 1985, pmd852a, pmd851, 0, pmd852a, pmd85, pmd85_state, pmd852a, "Tesla", "PMD-85.2A" , 0) -COMP( 1985, pmd852b, pmd851, 0, pmd852a, pmd85, pmd85_state, pmd852a, "Tesla", "PMD-85.2B" , 0) -COMP( 1988, pmd853, pmd851, 0, pmd853, pmd85, pmd85_state, pmd853, "Tesla", "PMD-85.3" , 0) -COMP( 1986, alfa, pmd851, 0, alfa, alfa, pmd85_state, alfa, "Didaktik Skalica", "Didaktik Alfa" , 0) -COMP( 1985, mato, pmd851, 0, mato, mato, pmd85_state, mato, "Statny", "Mato" , 0) -COMP( 1989, c2717, pmd851, 0, c2717, pmd85, pmd85_state, c2717, "Zbrojovka Brno", "Consul 2717" , 0) -COMP( 1989, c2717pmd,pmd851, 0, c2717, pmd85, pmd85_state, c2717, "Zbrojovka Brno", "Consul 2717 (with PMD-32)" , MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/pmi80.c b/src/mess/drivers/pmi80.c deleted file mode 100644 index 8c41f5cd083..00000000000 --- a/src/mess/drivers/pmi80.c +++ /dev/null @@ -1,175 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Tesla PMI-80 - - 12/05/2009 Skeleton driver. - 20/06/2011 Made mostly working [Robbbert] - - -ToDo: -- cassette -- keyboard to be finished -- artwork - - -Notes: -- Keyboard consists of 16 black hex keys, and 9 blue function keys -- The hex keys are 0 through 9, A through F on our keyboard -- The function keys are mostly not worked out although I've guessed a few -- The function key labels are RE, I, EX, R, BR, M, L, S, = -- The letter M shows as an inverted U in the display -- Turn it on, it says ''PMI -80'' -- Press any key, it shows a ? at the left -- Press the function key corresponding to what you want to do -- Press the numbers to select an address or whatever -- For example, press M then enter an address, press =, enter data, - press = to increment to next address or to scan through them. -- As for the rest, no idea -- In the layout, there is a 10th digit. It is disabled but if you - enable it (by renaming 'digitx' to 'digit9'), it will display - things. Perhaps it connected to discrete LEDs or output lines. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "pmi80.lh" - -class pmi80_state : public driver_device -{ -public: - pmi80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_ledready(0) - , m_maincpu(*this, "maincpu") - { } - - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(keyboard_w); - DECLARE_WRITE8_MEMBER(leds_w); -private: - UINT8 m_keyrow; - bool m_ledready; - virtual void machine_reset(); - required_device m_maincpu; -}; - - -READ8_MEMBER( pmi80_state::keyboard_r) -{ - char kbdrow[6]; - sprintf(kbdrow,"%X",m_keyrow); - return ioport(kbdrow)->read(); -} - -WRITE8_MEMBER( pmi80_state::keyboard_w ) -{ - m_keyrow = data; - m_ledready = TRUE; -} - -WRITE8_MEMBER( pmi80_state::leds_w ) -{ - if (m_ledready) - { - m_ledready = FALSE; - output_set_digit_value(m_keyrow^0xff, data^0xff); - } -} - -static ADDRESS_MAP_START(pmi80_mem, AS_PROGRAM, 8, pmi80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x03ff ) AM_ROM - AM_RANGE( 0x0400, 0x1fff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pmi80_io, AS_IO, 8, pmi80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf8, 0xf8) AM_WRITE(leds_w) - AM_RANGE(0xfa, 0xfa) AM_READWRITE(keyboard_r,keyboard_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pmi80 ) - PORT_START("F6") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) // does nothing - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_Q) // unknown - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) // same as '2' - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("F7") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("F8") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_W) // unknown - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("F9") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_R) // unknown - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B BC") PORT_CODE(KEYCODE_B) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 HL") PORT_CODE(KEYCODE_9) - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("FA") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) // memory mode - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("FB") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BR") PORT_CODE(KEYCODE_B) // b mode? - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DE") PORT_CODE(KEYCODE_D) - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("FC") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_T) // unknown - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_Y) // unknown - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EX") PORT_CODE(KEYCODE_G) // Go? - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("FD") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) // Load tape? - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A AF") PORT_CODE(KEYCODE_A) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 SP") PORT_CODE(KEYCODE_8) - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("FE") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) // Save tape? - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("FF") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_U) // unknown - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x8F, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -void pmi80_state::machine_reset() -{ -} - - -static MACHINE_CONFIG_START( pmi80, pmi80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(pmi80_mem) - MCFG_CPU_IO_MAP(pmi80_io) - - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_pmi80) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pmi80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "pmi80_monitor.rom", 0x0000, 0x0400, CRC(b93f4407) SHA1(43153441070ed0572f33d2815635eb7bae878e38)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, pmi80, 0, 0, pmi80, pmi80, driver_device, 0, "Tesla", "PMI-80", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/pocketc.c b/src/mess/drivers/pocketc.c deleted file mode 100644 index 4a2dd453bc9..00000000000 --- a/src/mess/drivers/pocketc.c +++ /dev/null @@ -1,988 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - sharp pocket computers - pc1401/pc1403 - PeT mess@utanet.at May 2000 -******************************************************************************/ - -#include "emu.h" -#include "cpu/sc61860/sc61860.h" - -#include "includes/pocketc.h" -#include "includes/pc1401.h" -#include "includes/pc1251.h" -#include "includes/pc1350.h" -#include "includes/pc1403.h" -#include "machine/ram.h" - -/* pc1430 no peek poke operations! */ - -/* pc1280?? */ - -/* pc126x - port - 1 ? - 2 +6v - 3 gnd - 4 f0 - 5 f1 - 6 load - 7 save - 8 ib7 - 9 ib6 - 10 ib5 - 11 ib4 */ - -/* pc1350 other keyboard, - f2 instead f0 at port - port - 1 ? - 2 +6v - 3 gnd - 4 f2 - 5 f1 - 6 load - 7 save - 8 ib7 - 9 ib6 - 10 ib5 - 11 ib4 -*/ - -/* similar computers - pc1260/1261 - pc1402/1403 - pc1421 */ -/* pc140x - a,b0..b5 keyboard matrix - b0 off key - c0 display on - c1 counter reset - c2 cpu halt - c3 computer off - c4 beeper frequency (1 4kHz, 0 2kHz), or (c5=0) membran pos1/pos2 - c5 beeper on - c6 beeper steuerung - - port - 1 ? - 2 +6v - 3 gnd - 4 f0 - 5 f1 - 6 load - 7 save - 8 ib7 - 9 ib6 - 10 ? - 11 ? -*/ - -/* special keys - red c-ce and reset; warm boot, program NOT lost*/ - -static ADDRESS_MAP_START( pc1401_mem , AS_PROGRAM, 8, pc1401_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x3800, 0x47ff) AM_RAM - AM_RANGE( 0x6000, 0x67ff) AM_READWRITE(pc1401_lcd_read, pc1401_lcd_write ) AM_MIRROR(0x1000) - AM_RANGE( 0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1402_mem , AS_PROGRAM, 8, pc1401_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x2000, 0x47ff) AM_RAM - AM_RANGE( 0x6000, 0x67ff) AM_READWRITE(pc1401_lcd_read, pc1401_lcd_write ) AM_MIRROR(0x1000) - AM_RANGE( 0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1250_mem , AS_PROGRAM, 8, pc1251_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x4000, 0x7fff) AM_ROM - AM_RANGE( 0xc000, 0xc7ff) AM_RAM // 2KB RAM - AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1251_mem , AS_PROGRAM, 8, pc1251_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x4000, 0x7fff) AM_ROM - AM_RANGE( 0xb800, 0xc7ff) AM_RAM // 4KB RAM - AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1255_mem , AS_PROGRAM, 8, pc1251_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x4000, 0x7fff) AM_ROM - AM_RANGE( 0xa000, 0xc7ff) AM_RAM // 10KB RAM - AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1260_mem , AS_PROGRAM, 8, pc1251_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x2000, 0x20ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) - //AM_RANGE( 0x2800, 0x28ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) - AM_RANGE( 0x5800, 0x67ff) AM_RAM // 4KB RAM - AM_RANGE( 0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1261_mem , AS_PROGRAM, 8, pc1251_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x2000, 0x20ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) - //AM_RANGE( 0x2800, 0x28ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) - AM_RANGE( 0x4000, 0x67ff) AM_RAM // 10KB RAM - AM_RANGE( 0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( pc1350_mem , AS_PROGRAM, 8, pc1350_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x7000, 0x7eff) AM_READWRITE(pc1350_lcd_read, pc1350_lcd_write ) - AM_RANGE( 0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1403_mem , AS_PROGRAM, 8, pc1403_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x3000, 0x30bf) AM_READWRITE(pc1403_lcd_read, pc1403_lcd_write ) - AM_RANGE( 0x3800, 0x3fff) AM_READWRITE(pc1403_asic_read, pc1403_asic_write ) - AM_RANGE( 0x4000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE( 0xe000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1403h_mem , AS_PROGRAM, 8, pc1403_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x3000, 0x30bf) AM_READWRITE(pc1403_lcd_read, pc1403_lcd_write ) - AM_RANGE( 0x3800, 0x3fff) AM_READWRITE(pc1403_asic_read, pc1403_asic_write ) - AM_RANGE( 0x4000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE( 0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -#if 0 -static ADDRESS_MAP_START( pc1421_readmem , AS_PROGRAM, 8, pc1403_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x3800, 0x47ff) AM_RAM - AM_RANGE( 0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc1421_writemem , AS_PROGRAM, 8, pc1403_state ) - AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x2000, 0x37ff) AM_RAM - AM_RANGE( 0x3800, 0x47ff) AM_RAM - AM_RANGE( 0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END -#endif - - -/* 2008-05 FP: the following input ports are based on the way ports are read, but I would like - to have confirmation from technical docs before considering these correct. - If they need to be changed, you must also update the clickable artwork. -*/ - -static INPUT_PORTS_START( pc1401 ) - PORT_START("KEY0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+/- y'") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 Sy") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 a") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 Sx") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAL") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q !") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A INPUT") PORT_CODE(KEYCODE_A) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z PRINT") PORT_CODE(KEYCODE_Z) - - PORT_START("KEY1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". DRG") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 sigmay") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 b") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 sigmax") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BASIC") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W \"") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S IF") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X USING") PORT_CODE(KEYCODE_X) - - PORT_START("KEY2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ ^") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- >") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* <") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D THEN") PORT_CODE(KEYCODE_D) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C GOSUB") PORT_CODE(KEYCODE_C) - - PORT_START("KEY3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") n!") PORT_CODE(KEYCODE_9) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( ->xy") PORT_CODE(KEYCODE_8) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sqr tri% D") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sqrt 3root C") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("y^x xROOTy B") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXP Pi A") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X->M Sum y Sum y^2") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_ENTER_PAD) - - PORT_START("KEY4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("chnge STAT") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1/x ->r theta") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG 10^x F") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN e^x E") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("->DEG ->D.MS") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("->HEX ->DEC") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M+ DATA CD") - - PORT_START("KEY5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C-CE CA") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F<>E TAB") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN TAN^-1") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS COS^-1") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN SIN^-1") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HYP ARCHYP") - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RM (x,y)") - - PORT_START("KEY6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 y mean") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 r") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 x mean") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F GOTO") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V RETURN") PORT_CODE(KEYCODE_V) - - PORT_START("KEY7") - PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", RUN") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P ;") PORT_CODE(KEYCODE_P) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T %") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G FOR") PORT_CODE(KEYCODE_G) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B DIM") PORT_CODE(KEYCODE_B) - - PORT_START("KEY8") - PORT_BIT(0x07, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O :") PORT_CODE(KEYCODE_O) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("left DEL") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H TO") PORT_CODE(KEYCODE_H) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N END") PORT_CODE(KEYCODE_N) - - PORT_START("KEY9") - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("right INS") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U ?") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J STEP") PORT_CODE(KEYCODE_J) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M CSAVE") PORT_CODE(KEYCODE_M) - - PORT_START("KEY10") - PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I @") PORT_CODE(KEYCODE_I) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K NEXT") PORT_CODE(KEYCODE_K) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPC CLOAD") PORT_CODE(KEYCODE_SPACE) - - PORT_START("KEY11") - PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L LIST") PORT_CODE(KEYCODE_L) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER N<>NP") PORT_CODE(KEYCODE_ENTER) - - PORT_START("KEY12") - PORT_BIT(0x7f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 x'") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("EXTRA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK ON") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) - PORT_DIPNAME( 0x04, 0x00, "Power") - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("DSW0") - PORT_DIPNAME( 0x07, 0x01, "Contrast") - PORT_DIPSETTING( 0x00, "0/Low" ) - PORT_DIPSETTING( 0x01, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x04, "4" ) - PORT_DIPSETTING( 0x05, "5" ) - PORT_DIPSETTING( 0x06, "6" ) - PORT_DIPSETTING( 0x07, "7/High" ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc1403 ) - PORT_START("KEY0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 y mean") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 Sy") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 sigmay") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X->M Sum y Sum y^2") - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("KEY1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 x mean") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 Sx") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 sigmax") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* <") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RM (x,y)") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SML") PORT_CODE(KEYCODE_CAPSLOCK) - - PORT_START("KEY2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 r") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 a") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 b") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- >") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M+ DATA CD") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q !") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A INPUT") PORT_CODE(KEYCODE_A) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z PRINT") PORT_CODE(KEYCODE_Z) - - PORT_START("KEY3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 x'") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+/- y'") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". DRG") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ ^") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W \"") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S IF") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X USING") PORT_CODE(KEYCODE_X) - - PORT_START("KEY4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HYP ARCHYP") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN SIN^-1") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS COS^-1") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN TAN^-1") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* toggles indicator 3c bit 0 japan? */ - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D THEN") PORT_CODE(KEYCODE_D) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C GOSUB") PORT_CODE(KEYCODE_C) - - PORT_START("KEY5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("->HEX ->DEC") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("->DEG ->D.MS") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN e^x E") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG 10^x F") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* tilde? */ - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F GOTO") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V RETURN") PORT_CODE(KEYCODE_V) - - PORT_START("KEY6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXP Pi A") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("y^x xROOTy B") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sqrt 3root C") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("sqr tri% D") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* yen? */ - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T %") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G FOR") PORT_CODE(KEYCODE_G) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B DIM") PORT_CODE(KEYCODE_B) - - PORT_START("KEY7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C-CE CA") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("chnge STAT") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F<>E TAB") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H TO") PORT_CODE(KEYCODE_H) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N END") PORT_CODE(KEYCODE_N) - - PORT_START("KEY8") - PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") n!") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1/x ->r theta") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U ?") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J STEP") PORT_CODE(KEYCODE_J) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M CSAVE") PORT_CODE(KEYCODE_M) - - PORT_START("KEY9") - PORT_BIT(0x07, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( ->x y") PORT_CODE(KEYCODE_8) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left DEL") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I @") PORT_CODE(KEYCODE_I) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K NEXT") PORT_CODE(KEYCODE_K) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPC CLOAD") PORT_CODE(KEYCODE_SPACE) - - PORT_START("KEY10") - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right INS") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O :") PORT_CODE(KEYCODE_O) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L LIST") PORT_CODE(KEYCODE_L) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER N<>NP") PORT_CODE(KEYCODE_ENTER) - - PORT_START("KEY11") - PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P ;") PORT_CODE(KEYCODE_P) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", RUN") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BASIC") PORT_CODE(KEYCODE_F2) - - PORT_START("KEY12") - PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* shift lock */ - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAL") PORT_CODE(KEYCODE_F1) - - PORT_START("KEY13") - PORT_BIT(0x7f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_DIPNAME( 0x80, 0x00, "Power") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("EXTRA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK ON") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) - - PORT_START("DSW0") - // normally no contrast control! - PORT_DIPNAME( 0x07, 0x01, "Contrast") - PORT_DIPSETTING( 0x00, "0/Low" ) - PORT_DIPSETTING( 0x01, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x04, "4" ) - PORT_DIPSETTING( 0x05, "5" ) - PORT_DIPSETTING( 0x06, "6" ) - PORT_DIPSETTING( 0x07, "7/High" ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc1251 ) - PORT_START("KEY0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- >") PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CL CA") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* <") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ^") PORT_CODE(KEYCODE_SLASH) PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN (") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - - PORT_START("KEY1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ Exp") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 @") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W \"") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - - PORT_START("KEY2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". SquareRoot") PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q !") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - - PORT_START("KEY3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP )") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - - PORT_START("KEY4") - PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P ;") PORT_CODE(KEYCODE_P) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT DEL") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T %") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - - PORT_START("KEY5") - PORT_BIT(0x07, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O ,") PORT_CODE(KEYCODE_O) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT INS") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - - PORT_START("KEY6") - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* down? */ - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U ?") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - - PORT_START("KEY7") - PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I :") PORT_CODE(KEYCODE_I) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(" SPC") PORT_CODE(KEYCODE_SPACE) - - PORT_START("KEY8") - PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER N<>NP") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) - - PORT_START("KEY9") - PORT_BIT(0x7f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 Pi") PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) - - PORT_START("EXTRA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK ON") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) - - PORT_START("MODE") - PORT_DIPNAME( 0x07, 0x00, "Mode") - PORT_DIPSETTING( 0x04, DEF_STR(Off) ) - PORT_DIPSETTING( 0x00, "On/RUN" ) - PORT_DIPSETTING( 0x02, "On/PRO" ) - PORT_DIPSETTING( 0x01, "On/RSV" ) - - PORT_START("DSW0") - PORT_DIPNAME( 0x07, 0x01, "Contrast") - PORT_DIPSETTING( 0x00, "0/Low" ) - PORT_DIPSETTING( 0x01, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x04, "4" ) - PORT_DIPSETTING( 0x05, "5" ) - PORT_DIPSETTING( 0x06, "6" ) - PORT_DIPSETTING( 0x07, "7/High" ) -INPUT_PORTS_END - -static INPUT_PORTS_START( pc1350 ) - PORT_START("KEY0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") >") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SML") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEF") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) /* are both Shifts connected here? or is Left Shift missing */ - - PORT_START("KEY1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( <") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- ^") PORT_CODE(KEYCODE_MINUS) PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q !") PORT_CODE(KEYCODE_Q) - - PORT_START("KEY2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W \"") PORT_CODE(KEYCODE_W) - - PORT_START("KEY3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E #") PORT_CODE(KEYCODE_E) - - PORT_START("KEY4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) - - PORT_START("KEY5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T %") PORT_CODE(KEYCODE_T) - - PORT_START("KEY6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* 1 ?*/ - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) - - PORT_START("KEY7") - PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* 2 ?*/ - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U ?") PORT_CODE(KEYCODE_U) - - PORT_START("KEY8") - PORT_BIT(0x07, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS CA") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I Pi") PORT_CODE(KEYCODE_I) - - PORT_START("KEY9") - PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER P<->NP") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O Squareroot") PORT_CODE(KEYCODE_O) - - PORT_START("KEY10") - PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P Alpha") PORT_CODE(KEYCODE_P) - - PORT_START("KEY11") - PORT_DIPNAME( 0xc0, 0x00, "Power") - PORT_DIPSETTING( 0xc0, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("EXTRA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK ON") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) // temporarily here, but not read... - - PORT_START("DSW0") - PORT_DIPNAME( 0x07, 0x07, "Contrast") - PORT_DIPSETTING( 0x00, "0/Low" ) - PORT_DIPSETTING( 0x01, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x04, "4" ) - PORT_DIPSETTING( 0x05, "5" ) - PORT_DIPSETTING( 0x06, "6" ) - PORT_DIPSETTING( 0x07, "7/High" ) -INPUT_PORTS_END - - -static const gfx_layout pc1401_charlayout = -{ - 2,21, - 128, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0,0 }, /* no bitplanes; 1 bit per pixel */ - /* x offsets */ - { 0,0 }, - /* y offsets */ - { - 7, 7, 7, - 6, 6, 6, - 5, 5, 5, - 4, 4, 4, - 3, 3, 3, - 2, 2, 2, - 1, 1, 1 - }, - 1*8 -}; - -static const gfx_layout pc1251_charlayout = -{ - 3,21, - 128, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0, }, /* no bitplanes; 1 bit per pixel */ - /* x offsets */ - { 0,0,0 }, - /* y offsets */ - { - 7, 7, 7, - 6, 6, 6, - 5, 5, 5, - 4, 4, 4, - 3, 3, 3, - 2, 2, 2, - 1, 1, 1 - }, - 1*8 -}; - -static GFXDECODE_START( pc1401 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, pc1401_charlayout, 0, 8 ) -GFXDECODE_END - -static GFXDECODE_START( pc1251 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, pc1251_charlayout, 0, 8 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( pocketc, pocketc_state) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_NVRAM_ADD_0FILL("cpu_nvram") - MCFG_NVRAM_ADD_0FILL("ram_nvram") - - /* - aim: show sharp with keyboard - resolution depends on the dots of the lcd - (lcd dot displayed as 2x3 pixel) - it seems to have 3/4 ratio in the real pc1401 */ - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(20) /* very early and slow lcd */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(594, 273) - MCFG_SCREEN_VISIBLE_AREA(0, 594-1, 0, 273-1) -// MCFG_SCREEN_SIZE(640, 273) -// MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 273-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc1401 ) - MCFG_PALETTE_ADD("palette", 8*2) - MCFG_PALETTE_INDIRECT_ENTRIES(6) - MCFG_PALETTE_INIT_OWNER( pocketc_state, pocketc ) - - /* sound hardware */ - /*MCFG_SOUND_ADD("dac", DAC, pocketc_sound_interface)*/ -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( pc1401, pocketc, pc1401_state ) - MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ - MCFG_CPU_PROGRAM_MAP(pc1401_mem) - MCFG_SC61860_READ_RESET_HANDLER(READLINE(pc1401_state,pc1401_reset)) - MCFG_SC61860_READ_BRK_HANDLER(READLINE(pc1401_state,pc1401_brk)) - MCFG_SC61860_READ_X_HANDLER(NULL) - MCFG_SC61860_READ_A_HANDLER(READ8(pc1401_state,pc1401_ina)) - MCFG_SC61860_WRITE_A_HANDLER(WRITE8(pc1401_state,pc1401_outa)) - MCFG_SC61860_READ_B_HANDLER(READ8(pc1401_state,pc1401_inb)) - MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1401_state,pc1401_outb)) - MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1401_state,pc1401_outc)) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(pc1401_state, screen_update_pc1401) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc1402, pc1401 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( pc1402_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( pc1250, pocketc, pc1251_state ) - MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ - MCFG_CPU_PROGRAM_MAP( pc1250_mem) - MCFG_SC61860_READ_RESET_HANDLER(NULL) - MCFG_SC61860_READ_BRK_HANDLER(READLINE(pc1251_state,pc1251_brk)) - MCFG_SC61860_READ_X_HANDLER(NULL) - MCFG_SC61860_READ_A_HANDLER(READ8(pc1251_state,pc1251_ina)) - MCFG_SC61860_WRITE_A_HANDLER(WRITE8(pc1251_state,pc1251_outa)) - MCFG_SC61860_READ_B_HANDLER(READ8(pc1251_state,pc1251_inb)) - MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1251_state,pc1251_outb)) - MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1251_state,pc1251_outc)) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(608, 300) - MCFG_SCREEN_VISIBLE_AREA(0, 608-1, 0, 300-1) - MCFG_SCREEN_UPDATE_DRIVER(pc1251_state, screen_update_pc1251) - MCFG_GFXDECODE_MODIFY("gfxdecode", pc1251 ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc1251, pc1250 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( pc1251_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc1255, pc1250 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( pc1255_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc1260, pc1250 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( pc1260_mem) - - MCFG_MACHINE_START_OVERRIDE(pc1251_state, pc1260 ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc1261, pc1260 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( pc1261_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( pc1350, pocketc, pc1350_state ) - MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ - MCFG_CPU_PROGRAM_MAP( pc1350_mem) - MCFG_SC61860_READ_RESET_HANDLER(NULL) - MCFG_SC61860_READ_BRK_HANDLER(READLINE(pc1350_state,pc1350_brk)) - MCFG_SC61860_READ_X_HANDLER(NULL) - MCFG_SC61860_READ_A_HANDLER(READ8(pc1350_state,pc1350_ina)) - MCFG_SC61860_WRITE_A_HANDLER(WRITE8(pc1350_state,pc1350_outa)) - MCFG_SC61860_READ_B_HANDLER(READ8(pc1350_state,pc1350_inb)) - MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1350_state,pc1350_outb)) - MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1350_state,pc1350_outc)) - - /* - aim: show sharp with keyboard - resolution depends on the dots of the lcd - (lcd dot displayed as 2x2 pixel) */ - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(640, 252) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 252-1) - MCFG_SCREEN_UPDATE_DRIVER(pc1350_state, screen_update_pc1350) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("12K,20K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( pc1403, pocketc, pc1403_state ) - MCFG_CPU_ADD( "maincpu", SC61860, 256000 ) - MCFG_CPU_PROGRAM_MAP( pc1403_mem) - MCFG_SC61860_READ_RESET_HANDLER(NULL) - MCFG_SC61860_READ_BRK_HANDLER(READLINE(pc1403_state,pc1403_brk)) - MCFG_SC61860_READ_X_HANDLER(NULL) - MCFG_SC61860_READ_A_HANDLER(READ8(pc1403_state,pc1403_ina)) - MCFG_SC61860_WRITE_A_HANDLER(WRITE8(pc1403_state,pc1403_outa)) - MCFG_SC61860_READ_B_HANDLER(NULL) - MCFG_SC61860_WRITE_B_HANDLER(NULL) - MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1403_state,pc1403_outc)) - - /* - aim: show sharp with keyboard - resolution depends on the dots of the lcd - (lcd dot displayed as 2x2 pixel) */ - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(848, 320) - MCFG_SCREEN_VISIBLE_AREA(0, 848-1, 0, 320-1) -// MCFG_SCREEN_SIZE(848, 361) -// MCFG_SCREEN_VISIBLE_AREA(0, 848-1, 0, 361-1) - MCFG_SCREEN_UPDATE_DRIVER(pc1403_state, screen_update_pc1403) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc1403h, pc1403 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( pc1403h_mem) -MACHINE_CONFIG_END - - -ROM_START(pc1401) - ROM_REGION(0x10000,"maincpu",0) - /* SC61860A08 5H 13LD cpu with integrated rom*/ - ROM_LOAD("sc61860.a08", 0x0000, 0x2000, CRC(44bee438) SHA1(c5106bc8d848be1b49494ace30a26eeb1cc5e504)) -/* 5S1 SC613256 D30 - or SC43536LD 5G 13 (LCD chip?) */ - ROM_LOAD("sc613256.d30", 0x8000, 0x8000, CRC(69b9d587) SHA1(fa0602e7dfee548546f801fb4cca7d73da2d8f18)) - ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) -ROM_END - -#define rom_pc1402 rom_pc1401 - -ROM_START(pc1245) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD( "cpu1245.rom", 0x0000, 0x2000, CRC(e0964069) SHA1(293c57b233d55944b308191fd72ecff81979cda7)) - ROM_LOAD( "bas1245.rom", 0x4000, 0x4000, CRC(f6253a0d) SHA1(bcac9b4f5a88eb952e81b3ee28f922c06bace18e)) - ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) -ROM_END - -ROM_START(pc1250) - ROM_REGION(0x10000,"maincpu",0) - /* sc61860a13 6c 13 ld */ - ROM_LOAD("cpu1250.rom", 0x0000, 0x2000, CRC(f7287aca) SHA1(19bfa778e3e05ea06bdca15cd9dfbba9b971340e)) - ROM_LOAD("bas1250.rom", 0x4000, 0x4000, CRC(93ecb629) SHA1(0fe0ad419053ee7814600b0be320dd2e8eb2ec92)) - ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) -ROM_END - -#define rom_pc1251 rom_pc1250 -#define rom_pc1255 rom_pc1250 -#define rom_trs80pc3 rom_pc1250 - - -ROM_START(pc1260) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD( "cpu1260.rom", 0x0000, 0x2000, CRC(f46d23d3) SHA1(e00c9194570048185ec8358732adeba151c56b33)) - ROM_LOAD( "bas1260.rom", 0x8000, 0x8000, CRC(6c7e017d) SHA1(e2ae717438cea59416b0670e2a53989c147fb362)) - ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) -ROM_END - -#define rom_pc1261 rom_pc1260 - -ROM_START(pc1350) - ROM_REGION(0x10000,"maincpu",0) - /* sc61860a13 6c 13 ld */ - ROM_LOAD("cpu.rom", 0x0000, 0x2000, CRC(79a924bc) SHA1(2eaef0d53d85863ca70a41c8e1eddc5915136b99)) - ROM_LOAD("basic.rom", 0x8000, 0x8000, CRC(158b28e2) SHA1(b63b37dd510b3c4d9f16d224f87ae2efb3bcc51f)) - ROM_REGION(0x100,"gfx1",ROMREGION_ERASEFF) -ROM_END - -ROM_START( pc1360 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "cpu-1360.rom", 0x0000, 0x2000, CRC(8fc9bf75) SHA1(f803cfecb8179f47031901c4d5bd546ac93118b1)) - ROM_REGION(0x20000,"user1",0) - ROM_LOAD( "b0-1360.rom", 0x00000, 0x4000, CRC(afe1d3d6) SHA1(7178fd30dcc7f2777f0539897ef7245832f26152)) - ROM_LOAD( "b1-1360.rom", 0x04000, 0x4000, CRC(83f7e4dd) SHA1(ae6d133fdb586df8660dd9315c1fdf80b7b8dd57)) - ROM_LOAD( "b2-1360.rom", 0x08000, 0x4000, CRC(007cf5a6) SHA1(311d3ceaaed61479bdb00d8ade358fd6a99da170)) - ROM_LOAD( "b3-1360.rom", 0x0c000, 0x4000, CRC(4170849f) SHA1(70eeaa29c008131137bd28e4e957694cdf312413)) - ROM_LOAD( "b4-1360.rom", 0x10000, 0x4000, CRC(0d311e21) SHA1(55987b7b00ddc666db30f35cbf23500b49e7ff09)) - ROM_LOAD( "b5-1360.rom", 0x14000, 0x4000, CRC(f945f3f7) SHA1(26116d8277212e14bddb64c531f134fbb5c86f9e)) - ROM_LOAD( "b6-1360.rom", 0x18000, 0x4000, CRC(ae823112) SHA1(9ab458e70752cacfd5d3ed36a8e89f96c63a6f50)) - ROM_LOAD( "b7-1360.rom", 0x1c000, 0x4000, CRC(ba7384b6) SHA1(95396d506f1d71e66c3ae2d47ffb4b6d10b31401)) - ROM_REGION(0x100,"gfx1",ROMREGION_ERASEFF) -ROM_END - -ROM_START(pc1403) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("introm.bin", 0x0000, 0x2000, CRC(588c500b) SHA1(2fed9ebede27e20a8ee4b4b03b9f8cd7808ada5c)) - ROM_REGION(0x10000,"user1",0) - ROM_LOAD("extrom08.bin", 0x0000, 0x4000, CRC(1fa65140) SHA1(f22a9f114486f69733fc43dfec26fb210643aeff)) - ROM_LOAD("extrom09.bin", 0x4000, 0x4000, CRC(4a7da6ab) SHA1(b50fe8a4ca821244c119147b3ff04cee0fd6ad5c)) - ROM_LOAD("extrom0a.bin", 0x8000, 0x4000, CRC(9925174f) SHA1(793a79142cd170ed7ac3f7ecb1b6e6f92c8fa4e0)) - ROM_LOAD("extrom0b.bin", 0xc000, 0x4000, CRC(fa5df9ec) SHA1(6ff62c215f510a3a652d61823f54cd4018d6a771)) - ROM_REGION(0x100,"gfx1",ROMREGION_ERASEFF) -ROM_END - -#define rom_pc1403h rom_pc1403 - -// disk drive support -#define io_pc1403 io_pc1401 -#define io_pc1403h io_pc1403 - -/* ROM definition */ -ROM_START( pc1450 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "cpu-1450.rom", 0x0000, 0x2000, CRC(dead7be5) SHA1(f55ba8cb823eb16b514032e96d2068d028964c1f)) - ROM_LOAD( "bas-1450.rom", 0x8000, 0x8000, CRC(d207cae9) SHA1(a88ef79bc38ea264165f800e4e386050d4d461b2)) - ROM_REGION(0x100,"gfx1",ROMREGION_ERASEFF) -ROM_END - -/* YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME */ - -/* cpu sc43177, sc43178 (4bit!) - pc 1211 - clone tandy trs80 pocket computer - pc1246/pc1247 -*/ - -/* cpu lh5801 - pc1500 - clone tandy pc2 look into drivers/pc1500.c - pc1600 -*/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -/* cpu sc61860 */ -COMP( 1982, pc1245, 0, 0, pc1250, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1245", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1982, pc1250, 0, 0, pc1250, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1250", MACHINE_NO_SOUND) -COMP( 1982, pc1251, pc1250, 0, pc1251, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1251", MACHINE_NO_SOUND) -COMP( 1982, pc1255, pc1250, 0, pc1255, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1255", MACHINE_NO_SOUND) -COMP( 1983, trs80pc3, pc1250, 0, pc1251, pc1251, pc1251_state, pc1251, "Tandy Radio Shack", "TRS-80 Pocket Computer PC-3", MACHINE_NO_SOUND) - -COMP( 1982, pc1260, 0, 0, pc1260, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1260", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1982, pc1261, pc1260, 0, pc1261, pc1251, pc1251_state, pc1251, "Sharp", "Pocket Computer 1261/1262", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) - -/* pc1261/pc1262 */ -COMP( 1984, pc1350, 0, 0, pc1350, pc1350, driver_device, 0, "Sharp", "Pocket Computer 1350", MACHINE_NO_SOUND ) -COMP( 198?, pc1450, 0, 0, pc1350, pc1350, driver_device, 0, "Sharp", "Pocket Computer 1450", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) - -COMP( 1983, pc1401, 0, 0, pc1401, pc1401, pc1401_state, pc1401, "Sharp", "Pocket Computer 1401", MACHINE_NO_SOUND) -COMP( 1984, pc1402, pc1401, 0, pc1402, pc1401, pc1401_state, pc1401, "Sharp", "Pocket Computer 1402", MACHINE_NO_SOUND) -COMP( 198?, pc1360, pc1401, 0, pc1401, pc1401, pc1401_state, pc1401, "Sharp", "Pocket Computer 1360", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) - -/* 72kb rom, 32kb ram, cpu? pc1360 */ -COMP( 1986, pc1403, 0, 0, pc1403, pc1403, pc1403_state, pc1403, "Sharp", "Pocket Computer 1403", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 198?, pc1403h, pc1403, 0, pc1403h,pc1403, pc1403_state, pc1403, "Sharp", "Pocket Computer 1403H", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/pockstat.c b/src/mess/drivers/pockstat.c deleted file mode 100644 index f276a1e7c8f..00000000000 --- a/src/mess/drivers/pockstat.c +++ /dev/null @@ -1,1017 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - Sony PocketStation - - 05/2009 Skeleton driver written. - 11/2009 Initial bring-up commenced by Harmony. - 11/2009 Playable state achieved by Harmony. - - PocketStation games were dowloaded from PS1 games into flash RAM after - the unit had been inserted in the memory card slot, and so this should - be emulated alongside the PS1. However, as many flash dumps exist, it - is possible to emulate the PocketStation in the meantime. - - CPU: ARM7T (32 bit RISC Processor) - Memory: 2Kbytes of SRAM, 128Kbytes of FlashROM - Graphics: 32x32 monochrome LCD - Sound: 1 12-bit PCM channel - Input: 5 input buttons, 1 reset button - Infrared communication: Bi-directional and uni-directional comms - Other: 1 LED indicator - - Info available at: - * http://exophase.devzero.co.uk/ps_info.txt - * http://members.at.infoseek.co.jp/DrHell/pocket/index.html - - Currently, a handful of games run, but some die due to odd hardware - issues. - -To start a game: -- Wait for the set-date screen to appear -- Press down arrow -- set date with arrows (optional) -- Press Ctrl, wait a sec, press ctrl, press right arrow, game starts - -It doesn't save the date so you have to go through this procedure every time. - -If you do nothing for about 20 secs, it turns itself off (screen goes white). - -****************************************************************************/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "cpu/arm7/arm7core.h" -#include "sound/dac.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define MAX_PS_TIMERS 3 - -struct ps_ftlb_regs_t -{ - UINT32 control; - UINT32 stat; - UINT32 valid; - UINT32 wait1; - UINT32 wait2; - UINT32 entry[16]; - UINT32 serial; -}; - -struct ps_intc_regs_t -{ - UINT32 hold; - UINT32 status; - UINT32 enable; - UINT32 mask; -}; - -struct ps_timer_t -{ - UINT32 period; - UINT32 count; - UINT32 control; - emu_timer *timer; -}; - -struct ps_timer_regs_t -{ - ps_timer_t timer[MAX_PS_TIMERS]; -}; - -struct ps_clock_regs_t -{ - UINT32 mode; - UINT32 control; -}; - -#define PS_CLOCK_STEADY 0x10 - -struct ps_rtc_regs_t -{ - UINT32 mode; - UINT32 control; - UINT32 time; - UINT32 date; - emu_timer *timer; -}; - - - -class pockstat_state : public driver_device -{ -public: - pockstat_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_lcd_buffer(*this, "lcd_buffer"), - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac"), - m_cart(*this, "cartslot") - { } - - required_shared_ptr m_lcd_buffer; - required_device m_maincpu; - required_device m_dac; - required_device m_cart; - memory_region *m_cart_rom; - - ps_ftlb_regs_t m_ftlb_regs; - ps_intc_regs_t m_intc_regs; - ps_timer_regs_t m_timer_regs; - ps_clock_regs_t m_clock_regs; - ps_rtc_regs_t m_rtc_regs; - UINT32 m_lcd_control; - INT32 m_ps_flash_write_enable_count; - INT32 m_ps_flash_write_count; - DECLARE_READ32_MEMBER(ps_ftlb_r); - DECLARE_WRITE32_MEMBER(ps_ftlb_w); - DECLARE_READ32_MEMBER(ps_intc_r); - DECLARE_WRITE32_MEMBER(ps_intc_w); - DECLARE_READ32_MEMBER(ps_timer_r); - DECLARE_WRITE32_MEMBER(ps_timer_w); - DECLARE_READ32_MEMBER(ps_clock_r); - DECLARE_WRITE32_MEMBER(ps_clock_w); - DECLARE_READ32_MEMBER(ps_rtc_r); - DECLARE_WRITE32_MEMBER(ps_rtc_w); - DECLARE_READ32_MEMBER(ps_lcd_r); - DECLARE_WRITE32_MEMBER(ps_lcd_w); - DECLARE_READ32_MEMBER(ps_rombank_r); - DECLARE_READ32_MEMBER(ps_flash_r); - DECLARE_WRITE32_MEMBER(ps_flash_w); - DECLARE_READ32_MEMBER(ps_audio_r); - DECLARE_WRITE32_MEMBER(ps_audio_w); - DECLARE_WRITE32_MEMBER(ps_dac_w); - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update_pockstat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_INPUT_CHANGED_MEMBER(input_update); - TIMER_CALLBACK_MEMBER(timer_tick); - TIMER_CALLBACK_MEMBER(rtc_tick); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( pockstat_flash ); - inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); - UINT32 ps_intc_get_interrupt_line(UINT32 line); - void ps_intc_set_interrupt_line(UINT32 line, int state); - void ps_timer_start(int index); -}; - - -#define DEFAULT_CLOCK 2000000 - -static const int CPU_FREQ[16] = -{ - 0x00f800, - 0x01f000, - 0x03e000, - 0x07c000, - 0x0f8000, - 0x1e8000, - 0x3d0000, - 0x7a0000, - 0x7a0000, - 0x7a0000, - 0x7a0000, - 0x7a0000, - 0x7a0000, - 0x7a0000, - 0x7a0000, - 0x7a0000 -}; - -#define VERBOSE_LEVEL (0) - -#define ENABLE_VERBOSE_LOG (0) - -inline void ATTR_PRINTF(3,4) pockstat_state::verboselog( int n_level, const char *s_fmt, ... ) -{ -#if ENABLE_VERBOSE_LOG - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%s: %s", machine().describe_context(), buf ); - } -#endif -} - -#define PS_INT_BTN_ACTION 0x00000001 // "Action button" -#define PS_INT_BTN_RIGHT 0x00000002 // "Right button" -#define PS_INT_BTN_LEFT 0x00000004 // "Left button" -#define PS_INT_BTN_DOWN 0x00000008 // "Down button" -#define PS_INT_BTN_UP 0x00000010 // "Up button" -#define PS_INT_UNKNOWN 0x00000020 // "Unknown" -#define PS_INT_COM 0x00000040 // "COM" ??? -#define PS_INT_TIMER0 0x00000080 // "Timer 0" -#define PS_INT_TIMER1 0x00000100 // "Timer 1" -#define PS_INT_RTC 0x00000200 // "RTC" -#define PS_INT_BATTERY 0x00000400 // "Battery Monitor" -#define PS_INT_IOP 0x00000800 // "IOP" -#define PS_INT_IRDA 0x00001000 // "IrDA" -#define PS_INT_TIMER2 0x00002000 // "Timer 2" -#define PS_INT_IRQ_MASK 0x00001fbf -#define PS_INT_FIQ_MASK 0x00002040 -#define PS_INT_STATUS_MASK 0x0000021f - -READ32_MEMBER(pockstat_state::ps_ftlb_r) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_ftlb_r: FlashROM TLB Control = %08x & %08x\n", m_ftlb_regs.control, mem_mask ); - return m_ftlb_regs.control | 1; // ??? - case 0x0004/4: - verboselog(0, "ps_ftlb_r: Unknown (F_STAT) = %08x & %08x\n", m_ftlb_regs.stat, mem_mask ); - return m_ftlb_regs.stat; - case 0x0008/4: - verboselog(0, "ps_ftlb_r: FlashROM TLB Valid Tag = %08x & %08x\n", m_ftlb_regs.valid, mem_mask ); - return m_ftlb_regs.valid; - case 0x000c/4: - verboselog(0, "ps_ftlb_r: Unknown (F_WAIT1) = %08x & %08x\n", m_ftlb_regs.wait1, mem_mask ); - return m_ftlb_regs.wait1; - case 0x0010/4: - verboselog(0, "ps_ftlb_r: Unknown (F_WAIT2) = %08x & %08x\n", m_ftlb_regs.wait2 | 0x04, mem_mask ); - return m_ftlb_regs.wait2 | 0x04; - case 0x0100/4: - case 0x0104/4: - case 0x0108/4: - case 0x010c/4: - case 0x0110/4: - case 0x0114/4: - case 0x0118/4: - case 0x011c/4: - case 0x0120/4: - case 0x0124/4: - case 0x0128/4: - case 0x012c/4: - case 0x0130/4: - case 0x0134/4: - case 0x0138/4: - case 0x013c/4: - verboselog(0, "ps_ftlb_r: FlashROM TLB Entry %d = %08x & %08x\n", offset - 0x100/4, m_ftlb_regs.entry[offset - 0x100/4], mem_mask ); - return m_ftlb_regs.entry[offset - 0x100/4]; - case 0x0300/4: - verboselog(0, "ps_ftlb_r: Unknown (F_SN) = %08x & %08x\n", m_ftlb_regs.serial, mem_mask ); - return m_ftlb_regs.serial; - default: - verboselog(0, "ps_ftlb_r: Unknown Register %08x & %08x\n", 0x06000000 + (offset << 2), mem_mask ); - break; - } - return 0; -} - -WRITE32_MEMBER(pockstat_state::ps_ftlb_w) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_ftlb_w: FlashROM TLB Control = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_ftlb_regs.control); - break; - case 0x0004/4: - verboselog(0, "ps_ftlb_w: Unknown (F_STAT) = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_ftlb_regs.stat); - break; - case 0x0008/4: - verboselog(0, "ps_ftlb_w: FlashROM TLB Valid Tag = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_ftlb_regs.valid); - break; - case 0x000c/4: - verboselog(0, "ps_ftlb_w: Unknown (F_WAIT1) = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_ftlb_regs.wait1); - break; - case 0x0010/4: - verboselog(0, "ps_ftlb_w: Unknown (F_WAIT2) = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_ftlb_regs.wait2); - break; - case 0x0100/4: - case 0x0104/4: - case 0x0108/4: - case 0x010c/4: - case 0x0110/4: - case 0x0114/4: - case 0x0118/4: - case 0x011c/4: - case 0x0120/4: - case 0x0124/4: - case 0x0128/4: - case 0x012c/4: - case 0x0130/4: - case 0x0134/4: - case 0x0138/4: - case 0x013c/4: - verboselog(0, "ps_ftlb_w: FlashROM TLB Entry %d = %08x & %08x\n", offset - 0x100/4, data, mem_mask ); - COMBINE_DATA(&m_ftlb_regs.entry[offset - 0x100/4]); - break; - case 0x0300/4: - verboselog(0, "ps_ftlb_w: Unknown (F_SN) = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_ftlb_regs.serial); - break; - default: - verboselog(0, "ps_ftlb_w: Unknown Register %08x = %08x & %08x\n", 0x06000000 + (offset << 2), data, mem_mask ); - break; - } -} - -UINT32 pockstat_state::ps_intc_get_interrupt_line(UINT32 line) -{ - return m_intc_regs.status & line; -} - -void pockstat_state::ps_intc_set_interrupt_line(UINT32 line, int state) -{ - //printf( "%08x %d %08x %08x %08x\n", line, state, drvm_intc_regs.hold, drvm_intc_regs.status, drvm_intc_regs.enable ); - if(line) - { - if(state) - { - m_intc_regs.status |= line & PS_INT_STATUS_MASK; - m_intc_regs.hold |= line &~ PS_INT_STATUS_MASK; - //printf( " Setting %08x, status = %08x, hold = %08x\n", line, m_intc_regs.status, m_intc_regs.hold ); - } - else - { - m_intc_regs.status &= ~line; - m_intc_regs.hold &= ~line; - //printf( "Clearing %08x, status = %08x, hold = %08x\n", line, m_intc_regs.status, m_intc_regs.hold ); - } - } - if(m_intc_regs.hold & m_intc_regs.enable & PS_INT_IRQ_MASK) - { - m_maincpu->set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); - } - else - { - m_maincpu->set_input_line(ARM7_IRQ_LINE, CLEAR_LINE); - } - if(m_intc_regs.hold & m_intc_regs.enable & PS_INT_FIQ_MASK) - { - m_maincpu->set_input_line(ARM7_FIRQ_LINE, ASSERT_LINE); - } - else - { - m_maincpu->set_input_line(ARM7_FIRQ_LINE, CLEAR_LINE); - } -} - -READ32_MEMBER(pockstat_state::ps_intc_r) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_intc_r: Held Interrupt = %08x & %08x\n", m_intc_regs.hold, mem_mask ); - return m_intc_regs.hold; - case 0x0004/4: - verboselog(0, "ps_intc_r: Interrupt Status = %08x & %08x\n", m_intc_regs.status, mem_mask ); - return m_intc_regs.status; - case 0x0008/4: - verboselog(0, "ps_intc_r: Interrupt Enable = %08x & %08x\n", m_intc_regs.enable, mem_mask ); - return m_intc_regs.enable; - case 0x000c/4: - verboselog(0, "ps_intc_r: Interrupt Mask (Invalid Read) = %08x & %08x\n", 0, mem_mask ); - return 0; - case 0x0010/4: - verboselog(0, "ps_intc_r: Interrupt Acknowledge (Invalid Read) = %08x & %08x\n", 0, mem_mask ); - return 0; - default: - verboselog(0, "ps_intc_r: Unknown Register %08x & %08x\n", 0x0a000000 + (offset << 2), mem_mask ); - break; - } - return 0; -} - -WRITE32_MEMBER(pockstat_state::ps_intc_w) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_intc_w: Held Interrupt (Invalid Write) = %08x & %08x\n", data, mem_mask ); - break; - case 0x0004/4: - verboselog(0, "ps_intc_w: Interrupt Status (Invalid Write) = %08x & %08x\n", data, mem_mask ); - break; - case 0x0008/4: - verboselog(0, "ps_intc_w: Interrupt Enable = %08x & %08x\n", data, mem_mask ); - m_intc_regs.enable |= data; - //COMBINE_DATA(&m_intc_regs.enable); - //m_intc_regs.status &= m_intc_regs.enable; - //m_intc_regs.hold &= m_intc_regs.enable; - ps_intc_set_interrupt_line(0, 0); - break; - case 0x000c/4: - verboselog(0, "ps_intc_w: Interrupt Mask = %08x & %08x\n", data, mem_mask ); - m_intc_regs.enable &= ~data; - COMBINE_DATA(&m_intc_regs.mask); - //m_intc_regs.status &= m_intc_regs.enable; - //m_intc_regs.hold &= m_intc_regs.enable; - ps_intc_set_interrupt_line(0, 0); - break; - case 0x0010/4: - verboselog(0, "ps_intc_w: Interrupt Acknowledge = %08x & %08x\n", data, mem_mask ); - m_intc_regs.hold &= ~data; - m_intc_regs.status &= ~data; - ps_intc_set_interrupt_line(0, 0); - //COMBINE_DATA(&m_intc_regs.acknowledge); - break; - default: - verboselog(0, "ps_intc_w: Unknown Register %08x = %08x & %08x\n", 0x0a000000 + (offset << 2), data, mem_mask ); - break; - } -} - -TIMER_CALLBACK_MEMBER(pockstat_state::timer_tick) -{ - ps_intc_set_interrupt_line(param == 2 ? PS_INT_TIMER2 : (param == 1 ? PS_INT_TIMER1 : PS_INT_TIMER0), 1); - //printf( "Timer %d is calling back\n", param ); - m_timer_regs.timer[param].count = m_timer_regs.timer[param].period; - ps_timer_start(param); -} - -void pockstat_state::ps_timer_start(int index) -{ - int divisor = 1; - attotime period; - switch(m_timer_regs.timer[index].control & 3) - { - case 0: - case 3: - divisor = 1; - break; - case 1: - divisor = 16; - break; - case 2: - divisor = 256; - break; - } - period = attotime::from_hz(CPU_FREQ[m_clock_regs.mode & 0x0f] / 2) * divisor; - period = period * m_timer_regs.timer[index].count; - m_timer_regs.timer[index].timer->adjust(period, index); -} - -READ32_MEMBER(pockstat_state::ps_timer_r) -{ - switch(offset) - { - case 0x0000/4: - case 0x0010/4: - case 0x0020/4: - verboselog(0, "ps_timer_r: Timer %d Period = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].period, mem_mask ); - return m_timer_regs.timer[offset / (0x10/4)].period; - case 0x0004/4: - case 0x0014/4: - case 0x0024/4: - verboselog(0, "ps_timer_r: Timer %d Count = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].count, mem_mask ); - if(m_timer_regs.timer[offset / (0x10/4)].control & 4) - { - m_timer_regs.timer[offset / (0x10/4)].count--; - if(m_timer_regs.timer[offset / (0x10/4)].count > m_timer_regs.timer[offset / (0x10/4)].period) - { - m_timer_regs.timer[offset / (0x10/4)].count = m_timer_regs.timer[offset / (0x10/4)].period; - } - return --m_timer_regs.timer[offset / (0x10/4)].count; - } - return m_timer_regs.timer[offset / (0x10/4)].count; - case 0x0008/4: - case 0x0018/4: - case 0x0028/4: - verboselog(0, "ps_timer_r: Timer %d Control = %08x & %08x\n", offset / (0x10/4), m_timer_regs.timer[offset / (0x10/4)].control, mem_mask ); - return m_timer_regs.timer[offset / (0x10/4)].control; - default: - verboselog(0, "ps_timer_r: Unknown Register %08x & %08x\n", 0x0a800000 + (offset << 2), mem_mask ); - break; - } - return 0; -} - -WRITE32_MEMBER(pockstat_state::ps_timer_w) -{ - switch(offset) - { - case 0x0000/4: - case 0x0010/4: - case 0x0020/4: - verboselog(0, "ps_timer_w: Timer %d Period = %08x & %08x\n", offset / (0x10/4), data, mem_mask ); - COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].period); - break; - case 0x0004/4: - case 0x0014/4: - case 0x0024/4: - verboselog(0, "ps_timer_w: Timer %d Count = %08x & %08x\n", offset / (0x10/4), data, mem_mask ); - COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].count); - break; - case 0x0008/4: - case 0x0018/4: - case 0x0028/4: - verboselog(0, "ps_timer_w: Timer %d Control = %08x & %08x\n", offset / (0x10/4), data, mem_mask ); - COMBINE_DATA(&m_timer_regs.timer[offset / (0x10/4)].control); - if(m_timer_regs.timer[offset / (0x10/4)].control & 4) - { - ps_timer_start(offset / (0x10/4)); - } - else - { - m_timer_regs.timer[offset / (0x10/4)].timer->adjust(attotime::never, offset / (0x10/4)); - } - break; - default: - verboselog(0, "ps_timer_w: Unknown Register %08x = %08x & %08x\n", 0x0a800000 + (offset << 2), data, mem_mask ); - break; - } -} - -READ32_MEMBER(pockstat_state::ps_clock_r) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_clock_r: Clock Mode = %08x & %08x\n", m_clock_regs.mode | 0x10, mem_mask ); - return m_clock_regs.mode | PS_CLOCK_STEADY; - case 0x0004/4: - verboselog(0, "ps_clock_r: Clock Control = %08x & %08x\n", m_clock_regs.control, mem_mask ); - return m_clock_regs.control; - default: - verboselog(0, "ps_clock_r: Unknown Register %08x & %08x\n", 0x0b000000 + (offset << 2), mem_mask ); - break; - } - return 0; -} - -WRITE32_MEMBER(pockstat_state::ps_clock_w) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_clock_w: Clock Mode = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_clock_regs.mode); - m_maincpu->set_unscaled_clock(CPU_FREQ[m_clock_regs.mode & 0x0f]); - break; - case 0x0004/4: - verboselog(0, "ps_clock_w: Clock Control = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_clock_regs.control); - break; - default: - verboselog(0, "ps_clock_w: Unknown Register %08x = %08x & %08x\n", 0x0b000000 + (offset << 2), data, mem_mask ); - break; - } -} - -TIMER_CALLBACK_MEMBER(pockstat_state::rtc_tick) -{ - //printf( "RTC is calling back\n" ); - ps_intc_set_interrupt_line(PS_INT_RTC, ps_intc_get_interrupt_line(PS_INT_RTC) ? 0 : 1); - if(!(m_rtc_regs.mode & 1)) - { - m_rtc_regs.time++; - if((m_rtc_regs.time & 0x0000000f) == 0x0000000a) - { - m_rtc_regs.time &= 0xfffffff0; - m_rtc_regs.time += 0x00000010; - if((m_rtc_regs.time & 0x000000ff) == 0x00000060) - { - m_rtc_regs.time &= 0xffffff00; - m_rtc_regs.time += 0x00000100; - if((m_rtc_regs.time & 0x00000f00) == 0x00000a00) - { - m_rtc_regs.time &= 0xfffff0ff; - m_rtc_regs.time += 0x00001000; - if((m_rtc_regs.time & 0x0000ff00) == 0x00006000) - { - m_rtc_regs.time &= 0xffff00ff; - m_rtc_regs.time += 0x00010000; - if((m_rtc_regs.time & 0x00ff0000) == 0x00240000) - { - m_rtc_regs.time &= 0xff00ffff; - m_rtc_regs.time += 0x01000000; - if((m_rtc_regs.time & 0x0f000000) == 0x08000000) - { - m_rtc_regs.time &= 0xf0ffffff; - m_rtc_regs.time |= 0x01000000; - } - } - else if((m_rtc_regs.time & 0x000f0000) == 0x000a0000) - { - m_rtc_regs.time &= 0xfff0ffff; - m_rtc_regs.time += 0x00100000; - } - } - } - } - } - } - m_rtc_regs.timer->adjust(attotime::from_hz(1)); -} - -READ32_MEMBER(pockstat_state::ps_rtc_r) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_rtc_r: RTC Mode = %08x & %08x\n", m_rtc_regs.mode, mem_mask ); - return m_rtc_regs.mode; - case 0x0004/4: - verboselog(0, "ps_rtc_r: RTC Control = %08x & %08x\n", m_rtc_regs.control, mem_mask ); - return m_rtc_regs.control; - case 0x0008/4: - verboselog(0, "ps_rtc_r: RTC Time = %08x & %08x\n", m_rtc_regs.time, mem_mask ); - return m_rtc_regs.time; - case 0x000c/4: - verboselog(0, "ps_rtc_r: RTC Date = %08x & %08x\n", m_rtc_regs.date, mem_mask ); - return m_rtc_regs.date; - default: - verboselog(0, "ps_rtc_r: Unknown Register %08x & %08x\n", 0x0b800000 + (offset << 2), mem_mask ); - break; - } - return 0; -} - -WRITE32_MEMBER(pockstat_state::ps_rtc_w) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_rtc_w: RTC Mode = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_rtc_regs.mode); - break; - case 0x0004/4: - verboselog(0, "ps_rtc_w: RTC Control = %08x & %08x\n", data, mem_mask ); - if(m_rtc_regs.control == 1 && data == 1) - { - switch(m_rtc_regs.mode >> 1) - { - case 0: // Seconds - m_rtc_regs.time += 0x00000001; - if((m_rtc_regs.time & 0x0000000f) == 0x0000000a) - { - m_rtc_regs.time &= 0xfffffff0; - m_rtc_regs.time += 0x00000010; - if((m_rtc_regs.time & 0x000000ff) == 0x00000060) - { - m_rtc_regs.time &= 0xffffff00; - } - } - break; - case 1: // Minutes - m_rtc_regs.time += 0x00000100; - if((m_rtc_regs.time & 0x00000f00) == 0x00000a00) - { - m_rtc_regs.time &= 0xfffff0ff; - m_rtc_regs.time += 0x00001000; - if((m_rtc_regs.time & 0x0000ff00) == 0x00006000) - { - m_rtc_regs.time &= 0xffff00ff; - } - } - break; - case 2: // Hours - m_rtc_regs.time += 0x00010000; - if((m_rtc_regs.time & 0x00ff0000) == 0x00240000) - { - m_rtc_regs.time &= 0xff00ffff; - } - else if((m_rtc_regs.time & 0x000f0000) == 0x000a0000) - { - m_rtc_regs.time &= 0xfff0ffff; - m_rtc_regs.time += 0x00100000; - } - break; - case 3: // Day of the week - m_rtc_regs.time += 0x01000000; - if((m_rtc_regs.time & 0x0f000000) == 0x08000000) - { - m_rtc_regs.time &= 0xf0ffffff; - m_rtc_regs.time |= 0x01000000; - } - break; - case 4: // Day - m_rtc_regs.date += 0x00000001; - if((m_rtc_regs.date & 0x000000ff) == 0x00000032) - { - m_rtc_regs.date &= 0xffffff00; - } - else if((m_rtc_regs.date & 0x0000000f) == 0x0000000a) - { - m_rtc_regs.date &= 0xfffffff0; - m_rtc_regs.date += 0x00000010; - } - break; - case 5: // Month - m_rtc_regs.date += 0x00000100; - if((m_rtc_regs.date & 0x0000ff00) == 0x00001300) - { - m_rtc_regs.date &= 0xffffff00; - m_rtc_regs.date |= 0x00000001; - } - else if((m_rtc_regs.date & 0x00000f00) == 0x00000a00) - { - m_rtc_regs.date &= 0xfffff0ff; - m_rtc_regs.date += 0x00001000; - } - break; - case 6: // Year (LSB) - m_rtc_regs.date += 0x00010000; - if((m_rtc_regs.date & 0x000f0000) == 0x000a0000) - { - m_rtc_regs.date &= 0xfff0ffff; - m_rtc_regs.date += 0x00100000; - if((m_rtc_regs.date & 0x00f00000) == 0x00a00000) - { - m_rtc_regs.date &= 0xff00ffff; - } - } - break; - case 7: // Year (MSB) - break; - } - m_rtc_regs.control = 0; - } - else if(m_rtc_regs.control == 0) - { - COMBINE_DATA(&m_rtc_regs.control); - } - break; - default: - verboselog(0, "ps_rtc_w: Unknown Register %08x = %08x & %08x\n", 0x0b800000 + (offset << 2), data, mem_mask ); - break; - } -} - - -READ32_MEMBER(pockstat_state::ps_lcd_r) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_lcd_r: LCD Control = %08x & %08x\n", m_lcd_control | 0x100, mem_mask ); - return m_lcd_control; - default: - verboselog(0, "ps_lcd_r: Unknown Register %08x & %08x\n", 0x0d000000 + (offset << 2), mem_mask ); - break; - } - return 0; -} - -WRITE32_MEMBER(pockstat_state::ps_lcd_w) -{ - switch(offset) - { - case 0x0000/4: - verboselog(0, "ps_lcd_w: LCD Control = %08x & %08x\n", data, mem_mask ); - COMBINE_DATA(&m_lcd_control); - break; - default: - verboselog(0, "ps_lcd_w: Unknown Register %08x = %08x & %08x\n", 0x0d000000 + (offset << 2), data, mem_mask ); - break; - } -} - -INPUT_CHANGED_MEMBER(pockstat_state::input_update) -{ - UINT32 buttons = ioport("BUTTONS")->read(); - - ps_intc_set_interrupt_line(PS_INT_BTN_ACTION, (buttons & 1) ? 1 : 0); - ps_intc_set_interrupt_line(PS_INT_BTN_RIGHT, (buttons & 2) ? 1 : 0); - ps_intc_set_interrupt_line(PS_INT_BTN_LEFT, (buttons & 4) ? 1 : 0); - ps_intc_set_interrupt_line(PS_INT_BTN_DOWN, (buttons & 8) ? 1 : 0); - ps_intc_set_interrupt_line(PS_INT_BTN_UP, (buttons & 16) ? 1 : 0); -} - -READ32_MEMBER(pockstat_state::ps_rombank_r) -{ - INT32 bank = (offset >> 11) & 0x0f; - for (int index = 0; index < 32; index++) - { - if (m_ftlb_regs.valid & (1 << index)) - { - if (m_ftlb_regs.entry[index] == bank) - { - //printf( "Address %08x is assigned to %08x in entry %d\n", 0x02000000 + (offset << 2), index * 0x2000 + ((offset << 2) & 0x1fff), index ); - return m_cart->read32_rom(space, index * (0x2000/4) + (offset & (0x1fff/4)), mem_mask); - } - } - } - return m_cart->read32_rom(space, offset & 0x7fff, mem_mask); -} - - -// Horrible hack, probably wrong -WRITE32_MEMBER(pockstat_state::ps_flash_w) -{ - if(offset == (0x55a8/4)) - { - m_ps_flash_write_enable_count++; - return; - } - if(offset == (0x2a54/4)) - { - m_ps_flash_write_enable_count++; - return; - } - if(m_ps_flash_write_enable_count == 3) - { - m_ps_flash_write_enable_count = 0; - m_ps_flash_write_count = 0x40; - return; - } - if(m_ps_flash_write_count) - { - m_ps_flash_write_count--; - COMBINE_DATA(&((UINT32*)(m_cart_rom->base()))[offset]); - } -} - -READ32_MEMBER(pockstat_state::ps_flash_r) -{ - return m_cart->read32_rom(space, offset, mem_mask); -} - -READ32_MEMBER(pockstat_state::ps_audio_r) -{ - verboselog(0, "ps_audio_r: Unknown Read: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), 0x10, mem_mask); - return 0; -} - -WRITE32_MEMBER(pockstat_state::ps_audio_w) -{ - verboselog(0, "ps_audio_w: Unknown Write: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), data, mem_mask); -} - -WRITE32_MEMBER(pockstat_state::ps_dac_w) -{ - m_dac->write_unsigned16((UINT16)((data + 0x8000) & 0x0000ffff)); -} - -static ADDRESS_MAP_START(pockstat_mem, AS_PROGRAM, 32, pockstat_state ) - AM_RANGE(0x00000000, 0x000007ff) AM_RAM - AM_RANGE(0x02000000, 0x02ffffff) AM_READ(ps_rombank_r) - AM_RANGE(0x04000000, 0x04003fff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x06000000, 0x06000307) AM_READWRITE(ps_ftlb_r, ps_ftlb_w) - AM_RANGE(0x08000000, 0x0801ffff) AM_READWRITE(ps_flash_r, ps_flash_w) - AM_RANGE(0x0a000000, 0x0a000013) AM_READWRITE(ps_intc_r, ps_intc_w) - AM_RANGE(0x0a800000, 0x0a80002b) AM_READWRITE(ps_timer_r, ps_timer_w) - AM_RANGE(0x0b000000, 0x0b000007) AM_READWRITE(ps_clock_r, ps_clock_w) - AM_RANGE(0x0b800000, 0x0b80000f) AM_READWRITE(ps_rtc_r, ps_rtc_w) - AM_RANGE(0x0d000000, 0x0d000003) AM_READWRITE(ps_lcd_r, ps_lcd_w) - AM_RANGE(0x0d000100, 0x0d00017f) AM_RAM AM_SHARE("lcd_buffer") - AM_RANGE(0x0d80000c, 0x0d80000f) AM_READWRITE(ps_audio_r, ps_audio_w) - AM_RANGE(0x0d800014, 0x0d800017) AM_WRITE(ps_dac_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pockstat ) - PORT_START("BUTTONS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Action Button") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("Left") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("Down") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("Up") PORT_CHANGED_MEMBER(DEVICE_SELF, pockstat_state, input_update, 0) - PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -void pockstat_state::machine_start() -{ - int index = 0; - for (index = 0; index < 3; index++) - { - m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::timer_tick),this)); - m_timer_regs.timer[index].timer->adjust(attotime::never, index); - } - - m_rtc_regs.time = 0x01000000; - m_rtc_regs.date = 0x19990101; - - m_rtc_regs.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::rtc_tick),this)); - m_rtc_regs.timer->adjust(attotime::from_hz(1), index); - - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - save_item(NAME(m_ftlb_regs.control)); - save_item(NAME(m_ftlb_regs.stat)); - save_item(NAME(m_ftlb_regs.valid)); - save_item(NAME(m_ftlb_regs.wait1)); - save_item(NAME(m_ftlb_regs.wait2)); - save_item(NAME(m_ftlb_regs.entry)); - - save_item(NAME(m_intc_regs.hold)); - save_item(NAME(m_intc_regs.status)); - save_item(NAME(m_intc_regs.enable)); - save_item(NAME(m_intc_regs.mask)); - - save_item(NAME(m_timer_regs.timer[0].period)); - save_item(NAME(m_timer_regs.timer[0].count)); - save_item(NAME(m_timer_regs.timer[0].control)); - save_item(NAME(m_timer_regs.timer[1].period)); - save_item(NAME(m_timer_regs.timer[1].count)); - save_item(NAME(m_timer_regs.timer[1].control)); - save_item(NAME(m_timer_regs.timer[2].period)); - save_item(NAME(m_timer_regs.timer[2].count)); - save_item(NAME(m_timer_regs.timer[2].control)); - - save_item(NAME(m_clock_regs.mode)); - save_item(NAME(m_clock_regs.control)); - - save_item(NAME(m_rtc_regs.mode)); - save_item(NAME(m_rtc_regs.control)); - save_item(NAME(m_rtc_regs.time)); - save_item(NAME(m_rtc_regs.date)); - - save_item(NAME(m_ps_flash_write_enable_count)); - save_item(NAME(m_ps_flash_write_count)); - - save_item(NAME(m_lcd_control)); -} - -void pockstat_state::machine_reset() -{ - m_maincpu->set_state_int(ARM7_R15, 0x4000000); - - m_ps_flash_write_enable_count = 0; - m_ps_flash_write_count = 0; -} - -UINT32 pockstat_state::screen_update_pockstat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - for (int y = 0; y < 32; y++) - { - UINT32 *scanline = &bitmap.pix32(y); - for (int x = 0; x < 32; x++) - { - if (m_lcd_control != 0) // Hack - { - if (m_lcd_buffer[y] & (1 << x)) - scanline[x] = 0x00000000; - else - scanline[x] = 0x00ffffff; - } - else - scanline[x] = 0x00ffffff; - } - } - return 0; -} - -DEVICE_IMAGE_LOAD_MEMBER( pockstat_state, pockstat_flash ) -{ - static const char *gme_id = "123-456-STD"; - char cart_id[0xf40]; - UINT32 size = image.length(); - - if (size != 0x20f40) - return IMAGE_INIT_FAIL; - - image.fread(cart_id, 0xf40); - - for (int i = 0; i < strlen(gme_id); i++) - { - if (cart_id[i] != gme_id[i]) - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(0x20000, GENERIC_ROM32_WIDTH, ENDIANNESS_LITTLE); - image.fread(m_cart->get_rom_base(), 0x20000); - - return IMAGE_INIT_PASS; -} - -static MACHINE_CONFIG_START( pockstat, pockstat_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", ARM7, DEFAULT_CLOCK) - MCFG_CPU_PROGRAM_MAP(pockstat_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(32, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 32-1, 0, 32-1) - MCFG_SCREEN_UPDATE_DRIVER(pockstat_state, screen_update_pockstat) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pockstat_cart") - MCFG_GENERIC_EXTENSIONS("gme") - MCFG_GENERIC_WIDTH(GENERIC_ROM32_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_LITTLE) - MCFG_GENERIC_LOAD(pockstat_state, pockstat_flash) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pockstat ) - ROM_REGION( 0x4000, "maincpu", 0 ) - ROM_LOAD( "kernel.bin", 0x0000, 0x4000, CRC(5fb47dd8) SHA1(6ae880493ddde880827d1e9f08e9cb2c38f9f2ec) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1999, pockstat, 0, 0, pockstat, pockstat, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PocketStation", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/poisk1.c b/src/mess/drivers/poisk1.c deleted file mode 100644 index fce63ee23ac..00000000000 --- a/src/mess/drivers/poisk1.c +++ /dev/null @@ -1,314 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - drivers/poisk1.c - - Driver file for Poisk-1 - -***************************************************************************/ - -#include "emu.h" - -#include "includes/poisk1.h" -#include "machine/kb_poisk1.h" - -#include "cpu/i86/i86.h" - -#define CGA_PALETTE_SETS 83 -/* one for colour, one for mono, 81 for colour composite */ - -#define VERBOSE_DBG 0 - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - -/* - * onboard devices: - */ - -// Timer. Poisk-1 uses single XTAL for everything? -- check - -WRITE_LINE_MEMBER( p1_state::p1_speaker_set_spkrdata ) -{ - m_p1_spkrdata = state ? 1 : 0; - m_speaker->level_w(m_p1_spkrdata & m_p1_input); -} - -WRITE_LINE_MEMBER( p1_state::p1_pit8253_out2_changed ) -{ - m_p1_input = state ? 1 : 0; - m_speaker->level_w(m_p1_spkrdata & m_p1_input); -} - -// Keyboard (via PPI) - -WRITE8_MEMBER(p1_state::p1_ppi_porta_w) -{ - m_kbpoll_mask = data; - DBG_LOG(2,"p1_ppi_porta_w",("( %02X -> %02X )\n", data, m_kbpoll_mask)); -} - -READ8_MEMBER(p1_state::p1_ppi_porta_r) -{ - UINT8 ret; - - ret = m_kbpoll_mask; - DBG_LOG(1,"p1_ppi_porta_r",("= %02X\n", ret)); - return ret; -} - -READ8_MEMBER(p1_state::p1_ppi_portb_r) -{ - UINT16 key = 0xffff; - UINT8 ret = 0; - - if (m_kbpoll_mask & 0x01) { key &= ioport("Y1")->read(); } - if (m_kbpoll_mask & 0x02) { key &= ioport("Y2")->read(); } - if (m_kbpoll_mask & 0x04) { key &= ioport("Y3")->read(); } - if (m_kbpoll_mask & 0x08) { key &= ioport("Y4")->read(); } - if (m_kbpoll_mask & 0x10) { key &= ioport("Y5")->read(); } - if (m_kbpoll_mask & 0x20) { key &= ioport("Y6")->read(); } - if (m_kbpoll_mask & 0x40) { key &= ioport("Y7")->read(); } - if (m_kbpoll_mask & 0x80) { key &= ioport("Y8")->read(); } - ret = key & 0xff; -// DBG_LOG(1,"p1_ppi_portb_r",("= %02X\n", ret)); - return ret; -} - -READ8_MEMBER(p1_state::p1_ppi_portc_r) -{ - UINT16 key = 0xffff; - UINT8 ret = 0; - - if (m_kbpoll_mask & 0x01) { key &= ioport("Y1")->read(); } - if (m_kbpoll_mask & 0x02) { key &= ioport("Y2")->read(); } - if (m_kbpoll_mask & 0x04) { key &= ioport("Y3")->read(); } - if (m_kbpoll_mask & 0x08) { key &= ioport("Y4")->read(); } - if (m_kbpoll_mask & 0x10) { key &= ioport("Y5")->read(); } - if (m_kbpoll_mask & 0x20) { key &= ioport("Y6")->read(); } - if (m_kbpoll_mask & 0x40) { key &= ioport("Y7")->read(); } - if (m_kbpoll_mask & 0x80) { key &= ioport("Y8")->read(); } - ret = (key >> 8) & 0xff; - DBG_LOG(2,"p1_ppi_portc_r",("= %02X\n", ret)); - return ret; -} - -// XXX - -READ8_MEMBER(p1_state::p1_ppi2_portc_r) -{ - int data = 0xff; - double tap_val = m_cassette->input(); - - data = ( data & ~0x10 ) | ( tap_val < 0 ? 0x10 : 0x00 ); - - DBG_LOG(2,"p1_ppi_portc_r",("= %02X (tap_val %f) at %s\n", - data, tap_val, machine().describe_context())); - return data; -} - -WRITE8_MEMBER(p1_state::p1_ppi2_portb_w) -{ - m_pit8253->write_gate2(BIT(data, 0)); - p1_speaker_set_spkrdata( data & 0x02 ); -} - -READ8_MEMBER(p1_state::p1_ppi_r) -{ -// DBG_LOG(1,"p1ppi",("R %.2x\n", 0x60+offset)); - switch (offset) { - case 0: - return m_ppi8255n1->read(space, 0); - case 9: - case 10: - case 11: - return m_ppi8255n1->read(space, offset - 8); - case 8: - return m_ppi8255n2->read(space, 0); - case 1: - case 2: - case 3: - return m_ppi8255n2->read(space, offset); - default: - DBG_LOG(1,"p1ppi",("R %.2x (unimp)\n", 0x60+offset)); - return 0xff; - } -} - -WRITE8_MEMBER(p1_state::p1_ppi_w) -{ -// DBG_LOG(1,"p1ppi",("W %.2x $%02x\n", 0x60+offset, data)); - switch (offset) { - case 0: - return m_ppi8255n1->write(space, 0, data); - case 9: - case 10: - case 11: - return m_ppi8255n1->write(space, offset - 8, data); - case 8: - return m_ppi8255n2->write(space, 0, data); - case 1: - case 2: - case 3: - return m_ppi8255n2->write(space, offset, data); - default: - DBG_LOG(1,"p1ppi",("W %.2x $%02x (unimp)\n", 0x60+offset, data)); - return; - } -} - -/********************************************************** - * - * NMI handling - * - **********************************************************/ - -DRIVER_INIT_MEMBER( p1_state, poisk1 ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - DBG_LOG(0,"init",("driver_init()\n")); - - program.unmap_readwrite(0, 0x7ffff); - program.install_readwrite_bank(0, m_ram->size()-1, "bank10"); - membank( "bank10" )->set_base( m_ram->pointer() ); -} - -MACHINE_START_MEMBER( p1_state, poisk1 ) -{ - DBG_LOG(0,"init",("machine_start()\n")); -} - -MACHINE_RESET_MEMBER( p1_state, poisk1 ) -{ - DBG_LOG(0,"init",("machine_reset()\n")); - - m_kbpoll_mask = 0; -} - -/* - * macros - */ - -static ADDRESS_MAP_START( poisk1_map, AS_PROGRAM, 8, p1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x7ffff) AM_RAM - AM_RANGE(0xc0000, 0xc1fff) AM_ROM - AM_RANGE(0xc0000, 0xfbfff) AM_NOP - AM_RANGE(0xfc000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( poisk1_io, AS_IO, 8, p1_state ) - AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write) - AM_RANGE(0x0028, 0x002B) AM_READWRITE(p1_trap_r, p1_trap_w) - AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - // can't use regular AM_DEVREADWRITE, because THIS IS SPARTA! - // 1st PPI occupies ports 60, 69, 6A and 6B; 2nd PPI -- 68, 61, 62 and 63. - AM_RANGE(0x0060, 0x006F) AM_READWRITE(p1_ppi_r, p1_ppi_w) - AM_RANGE(0x03D0, 0x03DF) AM_READWRITE(p1_cga_r, p1_cga_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( poisk1 ) - PORT_INCLUDE( poisk1_keyboard_v91 ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( poisk1, p1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8088, 5000000) - MCFG_CPU_PROGRAM_MAP(poisk1_map) - MCFG_CPU_IO_MAP(poisk1_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - MCFG_MACHINE_START_OVERRIDE( p1_state, poisk1 ) - MCFG_MACHINE_RESET_OVERRIDE( p1_state, poisk1 ) - - MCFG_DEVICE_ADD( "pit8253", PIT8253 ,0) - MCFG_PIT8253_CLK0(XTAL_15MHz/12) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_15MHz/12) /* keyboard poll -- XXX edge or level triggered? */ - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir6_w)) - MCFG_PIT8253_CLK2(XTAL_15MHz/12) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(p1_state, p1_pit8253_out2_changed)) - - MCFG_PIC8259_ADD( "pic8259", INPUTLINE(":maincpu", 0), VCC, NULL ) - - MCFG_DEVICE_ADD("ppi8255n1", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(p1_state, p1_ppi_porta_r)) /*60H*/ - MCFG_I8255_OUT_PORTA_CB(WRITE8(p1_state, p1_ppi_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(p1_state, p1_ppi_portb_r)) /*69H*/ - MCFG_I8255_IN_PORTC_CB(READ8(p1_state, p1_ppi_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(p1_state, p1_ppi_portc_w)) /*6AH*/ - - MCFG_DEVICE_ADD("ppi8255n2", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(p1_state, p1_ppi2_porta_w)) /*68H*/ - MCFG_I8255_OUT_PORTB_CB(WRITE8(p1_state, p1_ppi2_portb_w)) /*61H*/ - MCFG_I8255_IN_PORTC_CB(READ8(p1_state, p1_ppi2_portc_r)) /*62H*/ - - MCFG_DEVICE_ADD("isa", ISA8, 0) - MCFG_ISA8_CPU(":maincpu") - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("pic8259", pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) - MCFG_ISA8_SLOT_ADD("isa", "isa1", p1_isa8_cards, "fdc", false) - MCFG_ISA8_SLOT_ADD("isa", "isa2", p1_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("isa", "isa3", p1_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("isa", "isa4", p1_isa8_cards, NULL, false) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "speaker", SPEAKER_SOUND, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_RAW_PARAMS( XTAL_15MHz, 912,0,640, 262,0,200 ) - MCFG_SCREEN_UPDATE_DRIVER( p1_state, screen_update ) - - /* XXX verify palette */ - MCFG_PALETTE_ADD("palette", CGA_PALETTE_SETS * 16 ) - MCFG_PALETTE_INIT_OWNER(p1_state, p1) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") -MACHINE_CONFIG_END - -ROM_START( poisk1 ) - ROM_REGION16_LE(0x100000,"maincpu", 0) - - ROM_DEFAULT_BIOS("v91") - ROM_SYSTEM_BIOS(0, "v89", "1989") - ROMX_LOAD( "biosp1s.rf4", 0xfe000, 0x2000, CRC(1a85f671) SHA1(f0e59b2c4d92164abca55a96a58071ce869ff988), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v91", "1991") - ROMX_LOAD( "poisk_1991.bin", 0xfe000, 0x2000, CRC(d61c56fd) SHA1(de202e1f7422d585a1385a002a4fcf9d756236e5), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v91r2", "1991r2") - ROMX_LOAD( "p_bios_nm.bin", 0xfe000, 0x2000, CRC(84430b4f) SHA1(3e477962be3cea09662cb2e3ad9966ad01c7455d), ROM_BIOS(3)) - - // 0xc0000, sets 80x25 text and loops asking for 'Boot from hard disk (Y or N)?' - ROM_LOAD( "boot_net.rf4", 0x00000, 0x2000, CRC(316c2030) SHA1(d043325596455772252e465b85321f1b5c529d0b)) // NET BIOS - // 0xc0000, accesses ports 0x90..0x97 - ROM_LOAD( "pois_net.bin", 0x00000, 0x2000, CRC(cf9dd80a) SHA1(566bcb40c0cb2c8bfd5b485f0db689fdeaca3e86)) // ??? BIOS - - ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00) - ROM_LOAD( "poisk.cga", 0x0000, 0x0800, CRC(f6eb39f0) SHA1(0b788d8d7a8e92cc612d044abcb2523ad964c200)) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1989, poisk1, ibm5150, 0, poisk1, poisk1, p1_state, poisk1, "Electronmash", "Poisk-1", 0) diff --git a/src/mess/drivers/pokemini.c b/src/mess/drivers/pokemini.c deleted file mode 100644 index 65c63fabe0b..00000000000 --- a/src/mess/drivers/pokemini.c +++ /dev/null @@ -1,1798 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/******************************************************************** - -Driver file to handle emulation of the Nintendo Pokemon Mini handheld -by Wilbert Pol. - -The LCD is likely to be a SSD1828 LCD. - -********************************************************************/ - -#include "emu.h" -#include "sound/speaker.h" -#include "machine/i2cmem.h" -#include "cpu/minx/minx.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "rendlay.h" - - -struct PRC -{ - UINT8 colors_inverted; - UINT8 background_enabled; - UINT8 sprites_enabled; - UINT8 copy_enabled; - UINT8 map_size; - UINT8 map_size_x; - UINT8 frame_count; - UINT8 max_frame_count; - UINT32 bg_tiles; - UINT32 spr_tiles; - UINT8 count; - emu_timer *count_timer; -}; - - -struct TIMERS -{ - emu_timer *seconds_timer; - emu_timer *hz256_timer; - emu_timer *timer1; /* Timer 1 low or 16bit */ - emu_timer *timer1_hi; /* Timer 1 hi */ - emu_timer *timer2; /* Timer 2 low or 16bit */ - emu_timer *timer2_hi; /* Timer 2 high */ - emu_timer *timer3; /* Timer 3 low or 16bit */ - emu_timer *timer3_hi; /* Timer 3 high */ -}; - - -class pokemini_state : public driver_device -{ -public: - pokemini_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_p_ram(*this, "p_ram"), - m_speaker(*this, "speaker"), - m_i2cmem(*this, "i2cmem"), - m_cart(*this, "cartslot"), - m_inputs(*this, "INPUTS") - { } - - UINT8 m_pm_reg[0x100]; - PRC m_prc; - TIMERS m_timers; - bitmap_ind16 m_bitmap; - virtual void video_start(); - virtual void machine_start(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_PALETTE_INIT(pokemini); - DECLARE_WRITE8_MEMBER(hwreg_w); - DECLARE_READ8_MEMBER(hwreg_r); - DECLARE_READ8_MEMBER(rom_r); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pokemini_cart); - -protected: - enum - { - TIMER_SECONDS, - TIMER_256HZ, - TIMER_1, - TIMER_1_HI, - TIMER_2, - TIMER_2_HI, - TIMER_3, - TIMER_3_HI, - TIMER_PRC - }; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - required_device m_maincpu; - required_shared_ptr m_p_ram; - required_device m_speaker; - required_device m_i2cmem; - required_device m_cart; - required_ioport m_inputs; - - void check_irqs(); - void update_sound(); - void seconds_timer_callback(); - void timer_256hz_callback(); - void timer1_callback(); - void timer1_hi_callback(); - void timer2_callback(); - void timer2_hi_callback(); - void timer3_callback(); - void timer3_hi_callback(); - void prc_counter_callback(); - -}; - - -READ8_MEMBER( pokemini_state::rom_r ) -{ - offset += 0x2100; - return m_cart->read_rom(space, offset & 0x1fffff); -} - -static ADDRESS_MAP_START( pokemini_mem_map, AS_PROGRAM, 8, pokemini_state ) - AM_RANGE( 0x000000, 0x000fff ) AM_ROM /* bios */ - AM_RANGE( 0x001000, 0x001fff ) AM_RAM AM_SHARE("p_ram") /* VRAM/RAM */ - AM_RANGE( 0x002000, 0x0020ff ) AM_READWRITE(hwreg_r, hwreg_w) /* hardware registers */ - AM_RANGE( 0x002100, 0x1fffff ) AM_READ(rom_r) /* cartridge area */ -ADDRESS_MAP_END - - -static INPUT_PORTS_START( pokemini ) - PORT_START("INPUTS") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button A") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button B") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Button C") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1) PORT_NAME("Power") -INPUT_PORTS_END - - -PALETTE_INIT_MEMBER(pokemini_state, pokemini) -{ - palette.set_pen_color(0, rgb_t(0xff, 0xfb, 0x87)); - palette.set_pen_color(1, rgb_t(0xb1, 0xae, 0x4e)); - palette.set_pen_color(2, rgb_t(0x84, 0x80, 0x4e)); - palette.set_pen_color(3, rgb_t(0x4e, 0x4e, 0x4e)); -} - - -void pokemini_state::check_irqs() -{ - int irq_set[4] = { 1, 0, 0, 0 }; - int prio, vector; - - /* Check IRQ $03-$04 */ - prio = ( m_pm_reg[0x20] >> 6 ) & 0x03; - if ( ! irq_set[prio] ) - { - if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x40 ) - irq_set[prio] = 0x04; - - if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x80 ) - irq_set[prio] = 0x03; - } - - /* Check IRQ $05-$06 */ - prio = ( m_pm_reg[0x20] >> 4 ) & 0x03; - if ( ! irq_set[prio] ) - { - if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x10 ) - irq_set[prio] = 0x06; - - if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x20 ) - irq_set[prio] = 0x05; - } - - /* Check IRQ $07-$08 */ - prio = ( m_pm_reg[0x20] >> 2 ) & 0x03; - if ( ! irq_set[prio] ) - { - if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x04 ) - irq_set[prio] = 0x08; - - if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x08 ) - irq_set[prio] = 0x07; - } - - /* Check IRQ $09-$0A */ - prio = ( m_pm_reg[0x20] >> 0 ) & 0x03; - if ( ! irq_set[prio] ) - { - if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x01 ) - irq_set[prio] = 0x0A; - - if ( m_pm_reg[0x23] & m_pm_reg[0x27] & 0x02 ) - irq_set[prio] = 0x09; - } - - /* Check IRQ $0B-$0E */ - prio = ( m_pm_reg[0x21] >> 6 ) & 0x03; - if ( ! irq_set[prio] ) - { - if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x04 ) - irq_set[prio] = 0x0E; - - if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x08 ) - irq_set[prio] = 0x0D; - - if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x10 ) - irq_set[prio] = 0x0C; - - if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x20 ) - irq_set[prio] = 0x0B; - } - - /* Check IRQ $0F-$10 */ - prio = ( m_pm_reg[0x22] >> 0 ) & 0x03; - if ( ! irq_set[prio] ) - { - if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x40 ) - irq_set[prio] = 0x10; - - if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x80 ) - irq_set[prio] = 0x0F; - } - - /* Check IRQ $13-$14 */ - prio = ( m_pm_reg[0x21] >> 4 ) & 0x03; - if ( ! irq_set[prio] ) - { - if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x01 ) - irq_set[prio] = 0x14; - - if ( m_pm_reg[0x24] & m_pm_reg[0x28] & 0x02 ) - irq_set[prio] = 0x13; - } - - /* Check IRQ $15-$1C */ - prio = ( m_pm_reg[0x21] >> 2 ) & 0x03; - if ( ! irq_set[prio] ) - { - if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x01 ) - irq_set[prio] = 0x1C; - - if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x02 ) - irq_set[prio] = 0x1B; - - if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x04 ) - irq_set[prio] = 0x1A; - - if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x08 ) - irq_set[prio] = 0x19; - - if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x10 ) - irq_set[prio] = 0x18; - - if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x20 ) - irq_set[prio] = 0x17; - - if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x40 ) - irq_set[prio] = 0x16; - - if ( m_pm_reg[0x25] & m_pm_reg[0x29] & 0x80 ) - irq_set[prio] = 0x15; - } - - /* Check IRQ $1D-$1F */ - prio = ( m_pm_reg[0x21] >> 0 ) & 0x03; - if ( ! irq_set[prio] && ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x07 ) ) - { - if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x01 ) - irq_set[prio] = 0x1F; - - if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x02 ) - irq_set[prio] = 0x1E; - - if ( m_pm_reg[0x26] & m_pm_reg[0x2A] & 0x04 ) - irq_set[prio] = 0x1D; - } - - /* Determine vector */ - vector = 0; - if ( irq_set[1] ) - vector = irq_set[1]; - if ( irq_set[2] ) - vector = irq_set[2]; - if ( irq_set[3] ) - vector = irq_set[3]; - - if ( vector ) - { - //logerror("Triggering IRQ with vector %02x\n", vector ); - /* Trigger interrupt and set vector */ - m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, vector ); - } - else - { - m_maincpu->set_input_line(0, CLEAR_LINE ); - } -} - - -void pokemini_state::update_sound() -{ - /* Check if sound should be muted */ - if ( m_pm_reg[0x70] & 0x03 ) - { - m_speaker->level_w(0); - } - else - { - ///static const int levels[4] = { 0, 1, 1, 2 }; - int level; /// silence clang warning/// = levels[ m_pm_reg[0x71] & 0x03 ]; - -// if ( ( ( m_pm_reg[0x48] & 0x80 ) && ( m_pm_reg[0x4E] | ( m_pm_reg[0x4F] << 8 ) ) > ( m_pm_reg[0x4C] | ( m_pm_reg[0x4D] << 8 ) ) ) -// || ( ( m_pm_reg[0x48] & 0x80 ) && m_pm_reg[0x4F] > m_pm_reg[0x4D] ) ) -// { - level = 0; -// } - - m_speaker->level_w(level); - } -} - - -void pokemini_state::seconds_timer_callback() -{ - if ( m_pm_reg[0x08] & 0x01 ) - { - m_pm_reg[0x09] += 1; - if ( ! m_pm_reg[0x09] ) - { - m_pm_reg[0x0A] += 1; - if ( ! m_pm_reg[0x0A] ) - { - m_pm_reg[0x0B] += 1; - } - } - } -} - - -void pokemini_state::timer_256hz_callback() -{ - if ( m_pm_reg[0x40] & 0x01 ) - { - m_pm_reg[0x41] += 1; - /* Check if the 32Hz IRQ should be triggered */ - if ( ! ( m_pm_reg[0x41] & 0x07 ) ) - { - m_pm_reg[0x28] |= 0x20; - - /* Check if the 8Hz IRQ should be triggered */ - if ( ! ( m_pm_reg[0x41] & 0x1F ) ) - { - m_pm_reg[0x28] |= 0x10; - - /* Check if the 2Hz IRQ should be triggered */ - if ( ! ( m_pm_reg[0x41] & 0x7F ) ) - { - m_pm_reg[0x28] |= 0x08; - - /* Check if the 1Hz IRQ should be triggered */ - if ( ! m_pm_reg[0x41] ) - { - m_pm_reg[0x28] |= 0x04; - } - } - } - - check_irqs(); - } - } -} - - -void pokemini_state::timer1_callback() -{ - m_pm_reg[0x36] -= 1; - /* Check for underflow of timer */ - if ( m_pm_reg[0x36] == 0xFF ) - { - /* Check if timer1 is running in 16bit mode */ - if ( m_pm_reg[0x30] & 0x80 ) - { - m_pm_reg[0x37] -= 1; - if ( m_pm_reg[0x37] == 0xFF ) - { - m_pm_reg[0x27] |= 0x08; - check_irqs(); - m_pm_reg[0x36] = m_pm_reg[0x32]; - m_pm_reg[0x37] = m_pm_reg[0x33]; - } - } - else - { - m_pm_reg[0x27] |= 0x04; - check_irqs(); - m_pm_reg[0x36] = m_pm_reg[0x32]; - } - } -} - - -void pokemini_state::timer1_hi_callback() -{ - m_pm_reg[0x37] -= 1; - /* Check for underflow of timer */ - if ( m_pm_reg[0x37] == 0xFF ) - { - m_pm_reg[0x27] |= 0x08; - check_irqs(); - m_pm_reg[0x37] = m_pm_reg[0x33]; - } -} - - -void pokemini_state::timer2_callback() -{ - m_pm_reg[0x3E] -= 1; - /* Check for underflow of timer */ - if ( m_pm_reg[0x3E] == 0xFF ) - { - /* Check if timer2 is running in 16bit mode */ - if ( m_pm_reg[0x38] & 0x80 ) - { - m_pm_reg[0x3F] -= 1; - if ( m_pm_reg[0x3F] == 0xFF ) - { - m_pm_reg[0x27] |= 0x20; - check_irqs(); - m_pm_reg[0x3E] = m_pm_reg[0x3A]; - m_pm_reg[0x3F] = m_pm_reg[0x3B]; - } - } - else - { - m_pm_reg[0x27] |= 0x10; - check_irqs(); - m_pm_reg[0x3E] = m_pm_reg[0x3A]; - } - } -} - - -void pokemini_state::timer2_hi_callback() -{ - m_pm_reg[0x3F] -= 1; - /* Check for underfow of timer */ - if ( m_pm_reg[0x3F] == 0xFF ) - { - m_pm_reg[0x27] |= 0x20; - check_irqs(); - m_pm_reg[0x3F] = m_pm_reg[0x3B]; - } -} - - -void pokemini_state::timer3_callback() -{ - m_pm_reg[0x4E] -= 1; - /* Check for underflow of timer */ - if ( m_pm_reg[0x4E] == 0xFF ) - { - /* Check if timer3 is running in 16bit mode */ - if ( m_pm_reg[0x48] & 0x80 ) - { - m_pm_reg[0x4F] -= 1; - if ( m_pm_reg[0x4F] == 0xFF ) - { - m_pm_reg[0x27] |= 0x02; - check_irqs(); - m_pm_reg[0x4E] = m_pm_reg[0x4A]; - m_pm_reg[0x4F] = m_pm_reg[0x4B]; - } - } - else - { - m_pm_reg[0x4E] = m_pm_reg[0x4A]; - } - } - - if ( m_pm_reg[0x48] & 0x80 ) - { - if ( ( m_pm_reg[0x4E] == m_pm_reg[0x4C] ) && ( m_pm_reg[0x4F] == m_pm_reg[0x4D] ) ) - { - m_pm_reg[0x27] |= 0x01; - check_irqs(); - } - update_sound(); - } -} - - -void pokemini_state::timer3_hi_callback() -{ - m_pm_reg[0x4F] -= 1; - /* Check for underflow of timer */ - if ( m_pm_reg[0x4F] == 0xFF ) - { - m_pm_reg[0x27] |= 0x02; - check_irqs(); - m_pm_reg[0x4F] = m_pm_reg[0x4B]; - } - - if ( ! ( m_pm_reg[0x48] & 0x80 ) ) - { - if( m_pm_reg[0x4F] == m_pm_reg[0x4D] ) - { - m_pm_reg[0x27] |= 0x01; - check_irqs(); - } - update_sound(); - } -} - - -WRITE8_MEMBER(pokemini_state::hwreg_w) -{ - static const int timer_to_cycles_fast[8] = { 2, 8, 32, 64, 128, 256, 1024, 4096 }; - static const int timer_to_cycles_slow[8] = { 128, 256, 512, 1024, 2048, 4096, 8192, 16384 }; - - //logerror( "%0X: Write to hardware address: %02X, %02X\n", space.device() .safe_pc( ), offset, data ); - - switch( offset ) - { - case 0x00: /* start-up contrast - Bit 0-1 R/W Must be 1(?) - Bit 2-7 R/W Start up contrast (doesn't affect contrast until after reboot) - */ - case 0x01: /* CPU related? - Bit 0-7 R/W Unknown - */ - case 0x02: /* CPU related? - Bit 0-7 R/W Unknown - */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); - break; - case 0x08: /* Seconds-timer control - Bit 0 R/W Timer enable - Bit 1 W Timer reset - Bit 2-7 Unused - */ - if ( data & 0x02 ) - { - m_pm_reg[0x09] = 0x00; - m_pm_reg[0x0A] = 0x00; - m_pm_reg[0x0B] = 0x00; - data &= ~0x02; - } - break; - case 0x09: /* Seconds-timer (low), read only - Bit 0-7 R Seconds timer bit 0-7 - */ - return; - case 0x0A: /* Seconds-timer (mid), read only - Bit 0-7 R Seconds timer bit 8-15 - */ - return; - case 0x0B: /* Seconds-timer (high), read only - Bit 0-7 R Seconds timer bit 16-23 - */ - return; - case 0x10: /* Low power detector - Bit 0-4 R/W Unknown - Bit 5 R Battery status: 0 - battery OK, 1 - battery low - Bit 6-7 Unused - */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); - break; - case 0x18: /* Timer 1 pre-scale + enable - Bit 0-2 R/W low timer 1 prescaler select - 000 - 2 or 128 cycles - 001 - 8 or 256 cycles - 010 - 32 or 512 cycles - 011 - 64 or 1024 cycles - 100 - 128 or 2048 cycles - 101 - 256 or 4096 cycles - 110 - 1024 or 8192 cycles - 111 - 4096 or 16384 cycles - Bit 3 R/W Enable low counting - Bit 4-6 R/W high timer 1 prescaler select - Bit 7 R/W Enable high counting - */ - /* Check for prescaler change for the low counter */ - if ( ( data & 0x07 ) != ( m_pm_reg[0x18] & 0x07 ) ) - { - int index = data & 0x07; - int cycles = ( m_pm_reg[0x19] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer1->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - } - - /* Check for prescaler change for the high counter */ - if ( ( data & 0x70 ) != ( m_pm_reg[0x18] & 0x70 ) ) - { - int index = ( data >> 4 ) & 0x07; - int cycles = ( m_pm_reg[0x19] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer1_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - } - - /* Check if timer1 low should be enabled */ - if ( ( data & 0x08 ) && ( m_pm_reg[0x30] & 0x04 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x01 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x01 ) ) ) ) - { - m_timers.timer1->enable( 1 ); - } - else - { - m_timers.timer1->enable( 0 ); - } - - /* Check if timer1 high should be enabled */ - if ( ( data & 0x80 ) && ( m_pm_reg[0x31] & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) ) ) - { - m_timers.timer1_hi->enable( 1 ); - } - else - { - m_timers.timer1_hi->enable( 0 ); - } - break; - case 0x19: /* Timers 1 speed - Bit 0 R/W Select slow timer for timer 1 lo - Bit 1 R/W Select slow timer for timer 1 hi - Bit 2-3 Unused - Bit 4 R/W Enable slow timers - Bit 5 R/W Enable fast timers - Bit 6-7 Unused - */ - /* Check for prescaler change for the high counter */ - if ( ( data & 0x01 ) != ( m_pm_reg[0x19] & 0x01 ) ) - { - int index = m_pm_reg[0x18] & 0x07; - int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer1->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - } - - /* Check for prescaler change for the low counter */ - if ( ( data & 0x02 ) != ( m_pm_reg[0x19] & 0x02 ) ) - { - int index = ( m_pm_reg[0x18] >> 4 ) & 0x07; - int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer1_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - } - - { - int timer1_enable = 0, timer1_hi_enable = 0; - int timer2_enable = 0, timer2_hi_enable = 0; - int timer3_enable = 0, timer3_hi_enable = 0; - - /* Check which fast timers should be enabled */ - if ( data & 0x20 ) - { - if ( ( m_pm_reg[0x18] & 0x08 ) && ( m_pm_reg[0x30] & 0x04 ) && ! ( data & 0x01 ) ) - timer1_enable = 1; - - if ( ( m_pm_reg[0x18] & 0x80 ) && ( m_pm_reg[0x31] & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) && ! ( data & 0x02 ) ) - timer1_hi_enable = 1; - - if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) && ! ( m_pm_reg[0x1B] & 0x01 ) ) - timer2_enable = 1; - - if ( ( m_pm_reg[0x1A] & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) - timer2_hi_enable = 1; - - if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) && ! ( m_pm_reg[0x1D] & 0x01 ) ) - timer3_enable = 1; - - if ( ( m_pm_reg[0x1C] & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) - timer3_hi_enable = 1; - } - - /* Check which slow timers should be enabled */ - if ( data & 0x10 ) - { - if ( ( m_pm_reg[0x18] & 0x08 ) && ( data & 0x01 ) ) - timer1_enable = 1; - - if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x1B] & 0x01 ) ) - timer2_enable = 1; - - if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x1D] & 0x01 ) ) - timer3_enable = 1; - } - m_timers.timer1->enable( timer1_enable ); - m_timers.timer1_hi->enable( timer1_hi_enable ); - m_timers.timer2->enable( timer2_enable ); - m_timers.timer2_hi->enable( timer2_hi_enable ); - m_timers.timer3->enable( timer3_enable ); - m_timers.timer3_hi->enable( timer3_hi_enable ); - } - break; - case 0x1A: /* Timer 2 pre-scale + enable - Bit 0-2 R/W low timer 2 prescaler select - 000 - 2 or 128 cycles - 001 - 8 or 256 cycles - 010 - 32 or 512 cycles - 011 - 64 or 1024 cycles - 100 - 128 or 2048 cycles - 101 - 256 or 4096 cycles - 110 - 1024 or 8192 cycles - 111 - 4096 or 16384 cycles - Bit 3 R/W Enable low counting - Bit 4-6 R/W high timer 2 prescaler select - Bit 7 R/W Enable high counting - */ - /* Check for prescaler change for the low counter */ - if ( ( data & 0x07 ) != ( m_pm_reg[0x1A] & 0x07 ) ) - { - int index = data & 0x07; - int cycles = ( m_pm_reg[0x1B] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer2->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - } - - /* Check for prescaler change for the high counter */ - if ( ( data & 0x70 ) != ( m_pm_reg[0x1A] & 0x70 ) ) - { - int index = ( data >> 4 ) & 0x07; - int cycles = ( m_pm_reg[0x1B] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer2_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - } - - /* Check if timer2 low should be enabled */ - if ( ( data & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x01 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x01 ) ) ) ) - { - m_timers.timer2->enable( 1 ); - } - else - { - m_timers.timer2->enable( 0 ); - } - - /* Check if timer2 high should be enabled */ - if ( ( data & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) ) ) - { - m_timers.timer2_hi->enable( 1 ); - } - else - { - m_timers.timer2_hi->enable( 0 ); - } - break; - case 0x1B: /* Timer 2 speeds - Bit 0 R/W Select slow timer for timer 2 lo - Bit 1 R/W Select slow timer for timer 2 hi - */ - /* Check for prescaler change for the high counter */ - if ( ( data & 0x01 ) != ( m_pm_reg[0x1B] & 0x01 ) ) - { - int index = m_pm_reg[0x1A] & 0x07; - int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer2->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - - if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) ) - { - m_timers.timer2->enable( 1 ); - } - else - { - m_timers.timer2->enable( 0 ); - } - } - - /* Check for prescaler change for the low counter */ - if ( ( data & 0x02 ) != ( m_pm_reg[0x1B] & 0x02 ) ) - { - int index = ( m_pm_reg[0x1A] >> 4 ) & 0x07; - int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer2_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - - if ( ( m_pm_reg[0x1A] & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) ) - { - m_timers.timer2_hi->enable( 1 ); - } - else - { - m_timers.timer2_hi->enable( 0 ); - } - } - break; - case 0x1C: /* Timer 3 pre-scale + enable - Bit 0-2 R/W low timer 3 prescaler select - 000 - 2 or 128 cycles - 001 - 8 or 256 cycles - 010 - 32 or 512 cycles - 011 - 64 or 1024 cycles - 100 - 128 or 2048 cycles - 101 - 256 or 4096 cycles - 110 - 1024 or 8192 cycles - 111 - 4096 or 16384 cycles - Bit 3 R/W Enable low counting - Bit 4-6 R/W high timer 3 prescaler select - Bit 7 R/W Enable high counting - */ - /* Check for prescaler change for the low counter */ - if ( ( data & 0x07 ) != ( m_pm_reg[0x1C] & 0x07 ) ) - { - int index = data & 0x07; - int cycles = ( m_pm_reg[0x1D] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer3->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - } - - /* Check for prescaler change for the high counter */ - if ( ( data & 0x70 ) != ( m_pm_reg[0x1C] & 0x70 ) ) - { - int index = ( data >> 4 ) & 0x07; - int cycles = ( m_pm_reg[0x1D] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer3_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - } - - /* Check if timer2 low should be enabled */ - if ( ( data & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x01 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x01 ) ) ) ) - { - m_timers.timer3->enable( 1 ); - } - else - { - m_timers.timer3->enable( 0 ); - } - - /* Check if timer2 high should be enabled */ - if ( ( data & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) ) ) - { - m_timers.timer3_hi->enable( 1 ); - } - else - { - m_timers.timer3_hi->enable( 0 ); - } - break; - case 0x1D: /* Timer 3 speeds - Bit 0 R/W Select slow timer for timer 3 lo - Bit 1 R/W Select slow timer for timer 3 hi - */ - /* Check for prescaler change for the high counter */ - if ( ( data & 0x01 ) != ( m_pm_reg[0x1D] & 0x01 ) ) - { - int index = m_pm_reg[0x1C] & 0x07; - int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer3->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - - if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) ) - { - m_timers.timer3->enable( 1 ); - } - else - { - m_timers.timer3->enable( 0 ); - } - } - - /* Check for prescaler change for the low counter */ - if ( ( data & 0x02 ) != ( m_pm_reg[0x1D] & 0x02 ) ) - { - int index = ( m_pm_reg[0x1C] >> 4 ) & 0x07; - int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index]; - - m_timers.timer3_hi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(cycles)); - - if ( ( m_pm_reg[0x1C] & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) ) - { - m_timers.timer3_hi->enable( 1 ); - } - else - { - m_timers.timer3_hi->enable( 0 ); - } - } - break; - case 0x20: /* Event #1-#8 priority - Bit 0-1 R/W Timer 3 overflow Interrupt #7-#8 - Bit 2-3 R/W Timer 1 overflow Interrupt #5-#6 - Bit 4-5 R/W Timer 2 overflow Interrupt #3-#4 - Bit 6-7 R/W VDraw/VBlank trigger Interrupt #1-#2 - */ - m_pm_reg[0x20] = data; - check_irqs(); - break; - case 0x21: /* Event #15-#22 priority - Bit 0-1 R/W Unknown - Bit 2-3 R/W All keypad interrupts - Interrupt #15-#22 - Bit 4-7 R/W Unknown - */ - m_pm_reg[0x21] = data; - check_irqs(); - break; - case 0x22: /* Event #9-#14 priority - Bit 0-1 R/W All #9 - #14 events - Interrupt #9-#14 - Bit 2-7 Unused - */ - m_pm_reg[0x22] = data; - check_irqs(); - break; - case 0x23: /* Event #1-#8 enable - Bit 0 R/W Timer 3 overflow (mirror) - Enable Interrupt #8 - Bit 1 R/W Timer 3 overflow - Enable Interrupt #7 - Bit 2 R/W Not called... - Enable Interrupt #6 - Bit 3 R/W Timer 1 overflow - Enable Interrupt #5 - Bit 4 R/W Not called... - Enable Interrupt #4 - Bit 5 R/W Timer 2 overflow - Enable Interrupt #3 - Bit 6 R/W V-Draw trigger - Enable Interrupt #2 - Bit 7 R/W V-Blank trigger - Enable Interrupt #1 - */ - m_pm_reg[0x23] = data; - check_irqs(); - break; - case 0x24: /* Event #9-#12 enable - Bit 0-5 R/W Unknown - Bit 6-7 Unused - */ - m_pm_reg[0x24] = data; - check_irqs(); - break; - case 0x25: /* Event #15-#22 enable - Bit 0 R/W Press key "A" event - Enable interrupt #22 - Bit 1 R/W Press key "B" event - Enable interrupt #21 - Bit 2 R/W Press key "C" event - Enable interrupt #20 - Bit 3 R/W Press D-pad up key event - Enable interrupt #19 - Bit 4 R/W Press D-pad down key event - Enable interrupt #18 - Bit 5 R/W Press D-pad left key event - Enable interrupt #17 - Bit 6 R/W Press D-pad right key event - Enable interrupt #16 - Bit 7 R/W Press power button event - Enable interrupt #15 - */ - m_pm_reg[0x25] = data; - check_irqs(); - break; - case 0x26: /* Event #13-#14 enable - Bit 0-2 R/W Unknown - Bit 3 Unused - Bit 4-5 R/W Unknown - Bit 6 R/W Shock detector trigger - Enable interrupt #14 - Bit 7 R/W IR receiver - low to high trigger - Enable interrupt #13 - */ - m_pm_reg[0x26] = data; - check_irqs(); - break; - case 0x27: /* Interrupt active flag #1-#8 - Bit 0 Timer 3 overflow (mirror) / Clear interrupt #8 - Bit 1 Timer 3 overflow / Clear interrupt #7 - Bit 2 Not called ... / Clear interrupt #6 - Bit 3 Timer 1 overflow / Clear interrupt #5 - Bit 4 Not called ... / Clear interrupt #4 - Bit 5 Timer 2 overflow / Clear interrupt #3 - Bit 6 VDraw trigger / Clear interrupt #2 - Bit 7 VBlank trigger / Clear interrupt #1 - */ - m_pm_reg[0x27] &= ~data; - check_irqs(); - return; - case 0x28: /* Interrupt active flag #9-#12 - Bit 0-1 Unknown - Bit 2 Unknown / Clear interrupt #12 - Bit 3 Unknown / Clear interrupt #11 - Bit 4 Unknown / Clear interrupt #10 - Bit 5 Unknown / Clear interrupt #9 - Bit 6-7 Unknown - */ - m_pm_reg[0x28] &= ~data; - check_irqs(); - return; - case 0x29: /* Interrupt active flag #15-#22 - Bit 0 Press key "A" event / Clear interrupt #22 - Bit 1 Press key "B" event / Clear interrupt #21 - Bit 2 Press key "C" event / Clear interrupt #20 - Bit 3 Press D-pad up key event / Clear interrupt #19 - Bit 4 Press D-pad down key event / Clear interrupt #18 - Bit 5 Press D-pad left key event / Clear interrupt #17 - Bit 6 Press D-pad right key event / Clear interrupt #16 - Bit 7 Press power button event / Clear interrupt #15 - */ - m_pm_reg[0x29] &= ~data; - check_irqs(); - return; - case 0x2A: /* Interrupt active flag #13-#14 - Bit 0-5 Unknown - Bit 6 Shock detector trigger / Clear interrupt #14 - Bit 7 Unknown / Clear interrupt #13 - */ - m_pm_reg[0x2A] &= ~data; - check_irqs(); - return; - case 0x30: /* Timer 1 control 1 - Bit 0 R/W Unknown - Bit 1 W Reset low counter - Bit 2 R/W Enable high counter - Bit 3 R/W Unknown - Bit 4-6 Unused - Bit 7 R/W Enable 16bit mode - */ - if ( data & 0x02 ) - { - m_pm_reg[0x36] = m_pm_reg[0x32]; - data &= ~0x02; - } - - if ( ( data & 0x04 ) && ( m_pm_reg[0x18] & 0x08 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x01 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x01 ) ) ) ) - { - m_timers.timer1->enable( 1 ); - } - else - { - m_timers.timer1->enable( 0 ); - } - - if ( ( m_pm_reg[0x31] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x18] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) ) ) - { - m_timers.timer1_hi->enable( 1 ); - } - else - { - m_timers.timer1_hi->enable( 0 ); - } - break; - case 0x31: /* Timer 1 control 2 - Bit 0 R/W Unknown - Bit 1 W Reset hi counter - Bit 2 R/W Enable high counter - Bit 3 R/W Unknown - Bit 4-7 Unused - */ - if ( data & 0x02 ) - { - m_pm_reg[0x37] = m_pm_reg[0x33]; - data &= ~0x02; - } - - if ( ( data & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) && ( m_pm_reg[0x18] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) ) ) - { - m_timers.timer1_hi->enable( 1 ); - } - else - { - m_timers.timer1_hi->enable( 0 ); - } - break; - case 0x32: /* Timer 1 preset value (low) - Bit 0-7 R/W Timer 1 preset value bit 0-7 - */ - break; - case 0x33: /* Timer 1 preset value (high) - Bit 0-7 R/W Timer 1 preset value bit 8-15 - */ - break; - case 0x34: /* Timer 1 sound-pivot (low, unused) - */ - case 0x35: /* Timer 1 sound-pivot (high, unused) - */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); - break; - case 0x36: /* Timer 1 counter (low), read only - */ - return; - case 0x37: /* Timer 1 counter (high), read only - */ - return; - case 0x38: /* Timer 2 control 1 - Bit 0 R/W Unknown - Bit 1 W Reset low counter - Bit 2 R/W Enable high counter - Bit 3 R/W Unknown - Bit 4-6 Unused - Bit 7 R/W Enable 16bit mode - */ - if ( data & 0x02 ) - { - m_pm_reg[0x3E] = m_pm_reg[0x3A]; - data &= ~0x02; - } - - if ( ( data & 0x04 ) && ( m_pm_reg[0x1A] & 0x08 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1A] & 0x01 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1A] & 0x01 ) ) ) ) - { - m_timers.timer2->enable( 1 ); - } - else - { - m_timers.timer2->enable( 0 ); - } - if ( ( m_pm_reg[0x39] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x1A] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) ) ) - { - m_timers.timer2_hi->enable( 1 ); - } - else - { - m_timers.timer2_hi->enable( 0 ); - } - break; - case 0x39: /* Timer 2 control 2 - Bit 0 R/W Unknown - Bit 1 W Reset hi counter - Bit 2 R/W Enable high counter - Bit 3 R/W Unknown - Bit 4-7 Unused - */ - if ( data & 0x02 ) - { - m_pm_reg[0x3F] = m_pm_reg[0x3A]; - data &= ~0x02; - } - - if ( ( data & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && ( m_pm_reg[0x1A] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) ) ) - { - m_timers.timer2_hi->enable( 1 ); - } - else - { - m_timers.timer2_hi->enable( 0 ); - } - break; - case 0x3A: /* Timer 2 preset value (low) - Bit 0-7 R/W Timer 2 preset value bit 0-7 - */ - break; - case 0x3B: /* Timer 2 preset value (high) - Bit 0-7 R/W Timer 2 preset value bit 8-15 - */ - break; - case 0x3C: /* Timer 2 sound-pivot (low, unused) - */ - case 0x3D: /* Timer 2 sound-pivot (high, unused) - */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); - break; - case 0x3E: /* Timer 2 counter (low), read only - Bit 0-7 R/W Timer 2 counter value bit 0-7 - */ - return; - case 0x3F: /* Timer 2 counter (high), read only - Bit 0-7 R/W Timer 2 counter value bit 8-15 - */ - return; - case 0x40: /* 256Hz timer control - Bit 0 R/W Enable Timer - Bit 1 W Reset Timer - Bit 2-7 Unused - */ - if ( data & 0x02 ) - { - m_pm_reg[0x41] = 0; - data &= ~0x02; - } - break; - case 0x41: /* 256Hz timer counter - Bit 0-7 R 256Hz timer counter - */ - return; - case 0x48: /* Timer 3 control 1 - Bit 0 R/W Unknown - Bit 1 W Reset low counter - Bit 2 R/W Enable high counter - Bit 3 R/W Unknown - Bit 4-6 Unused - Bit 7 R/W Enable 16bit mode - */ - if ( data & 0x02 ) - { - m_pm_reg[0x4E] = m_pm_reg[0x4A]; - data &= ~0x02; - } - - if ( ( data & 0x04 ) && ( m_pm_reg[0x1C] & 0x08 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x01 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x01 ) ) ) ) - { - m_timers.timer3->enable( 1 ); - } - else - { - m_timers.timer3->enable( 0 ); - } - if ( ( m_pm_reg[0x49] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x1C] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) ) ) - { - m_timers.timer3_hi->enable( 1 ); - } - else - { - m_timers.timer3_hi->enable( 0 ); - } - m_pm_reg[0x48] = data; - update_sound(); - break; - case 0x49: /* Timer 3 control 2 - Bit 0 R/W Unknown - Bit 1 W Reset hi counter - Bit 2 R/W Enable high counter - Bit 3 R/W Unknown - Bit 4-7 Unused - */ - if ( data & 0x02 ) - { - m_pm_reg[0x4F] = m_pm_reg[0x4B]; - data &= ~0x02; - } - - if ( ( data & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && ( m_pm_reg[0x1C] & 0x80 ) && - ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) || - ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) ) ) - { - m_timers.timer3_hi->enable( 1 ); - } - else - { - m_timers.timer3_hi->enable( 0 ); - } - m_pm_reg[0x49] = data; - update_sound(); - break; - case 0x4A: /* Timer 3 preset value (low) - Bit 0-7 R/W Timer 3 preset value bit 0-7 - */ - m_pm_reg[0x4A] = data; - update_sound(); - break; - case 0x4B: /* Timer 3 preset value (high) - Bit 0-7 R/W Timer 3 preset value bit 8-15 - */ - m_pm_reg[0x4B] = data; - update_sound(); - break; - case 0x4C: /* Timer 3 sound-pivot (low) - Bit 0-7 R/W Timer 3 sound-pivot value bit 0-7 - */ - m_pm_reg[0x4C] = data; - update_sound(); - break; - case 0x4D: /* Timer 3 sound-pivot (high) - Bit 0-7 R/W Timer 3 sound-pivot value bit 8-15 - - Sound-pivot location: - Pulse-Width of 0% = 0x0000 - Pulse-Width of 50% = Half of preset-value - Pulse-Width of 100% = Same as preset-value - */ - m_pm_reg[0x4D] = data; - update_sound(); - break; - case 0x4E: /* Timer 3 counter (low), read only - Bit 0-7 R/W Timer 3 counter value bit 0-7 - */ - return; - case 0x4F: /* Timer 3 counter (high), read only - Bit 0-7 R/W Timer 3 counter value bit 8-15 - */ - return; - case 0x52: /* Keypad status - Bit 0 R Key "A" - Bit 1 R Key "B" - Bit 2 R Key "C" - Bit 3 R D-pad up - Bit 4 R D-pad down - Bit 5 R D-pad left - Bit 6 R D-pad right - Bit 7 R Power button - */ - return; - case 0x60: /* I/O peripheral circuit select - Bit 0 R/W Unknown - bit 1 R/W IR receive / transmit - Bit 2 R/W EEPROM / RTC data - Bit 3 R/W EEPROM / RTC clock - Bit 4 R/W Rumble controller - Bit 5 R/W IR enable/disable - Bit 6 R/W Unknown - Bit 7 R/W Unknown - */ - break; - case 0x61: /* I/O peripheral status control - Bit 0 R/W IR received bit (if device not selected: 0) - Bit 1 R/W IR transmit (if device not selected: 0) - Bit 2 R/W EEPROM / RTC data (if device not selected: 1) - Bit 3 R/W EEPROM / RTC clock (if device not selected: 0) - Bit 4 R/W Rumble on/off (if device not selected: 0) - Bit 5 R/W IR disable (receive & transmit) (if device not selected: 1) - Bit 6 Always 1 - Bit 7 R/W IR received bit (mirror, if device not selected: 0) - */ - if ( m_pm_reg[0x60] & 0x04 ) - m_i2cmem->write_sda( ( data & 0x04 ) ? 1 : 0 ); - - if ( m_pm_reg[0x60] & 0x08 ) - m_i2cmem->write_scl( ( data & 0x08 ) ? 1 : 0 ); - break; - case 0x70: /* Sound related */ - m_pm_reg[0x70] = data; - update_sound(); - break; - case 0x71: /* Sound volume - Bit 0-1 R/W Sound volume - 00 - 0% - 01 - 50% - 10 - 50% - 11 - 100% - Bit 2 R/W Always set to 0 - Bit 3-7 Unused - */ - m_pm_reg[0x71] = data; - update_sound(); - break; - case 0x80: /* LCD control - Bit 0 R/W Invert colors; 0 - normal, 1 - inverted - Bit 1 R/W Enable rendering of background - Bit 2 R/W Enable rendering of sprites - Bit 3 R/W Enable copy to LCD ram - Bit 4-5 R/W Map size - 00 - 12x16 - 01 - 16x12 - 10 - 24x8 - 11 - 24x8 (prohibited code) - Bit 6-7 Unused - */ - m_prc.colors_inverted = ( data & 0x01 ) ? 1 : 0; - m_prc.background_enabled = ( data & 0x02 ) ? 1 : 0; - m_prc.sprites_enabled = ( data & 0x04 ) ? 1 : 0; - m_prc.copy_enabled = ( data & 0x08 ) ? 1 : 0; - m_prc.map_size = ( data >> 4 ) & 0x03; - switch( m_prc.map_size ) - { - case 0: - m_prc.map_size_x = 12; break; - case 1: - m_prc.map_size_x = 16; break; - case 2: - case 3: - m_prc.map_size_x = 24; break; - } - break; - case 0x81: /* LCD render refresh rate - Bit 0 R/W Unknown - Bit 1-3 R/W LCD refresh rate divider - 000 - 60Hz / 3 = 20Hz (0 - 2) - 001 - 60Hz / 6 = 10Hz (0 - 5) - 010 - 60Hz / 9 = 6,6Hz (0 - 8) - 011 - 60Hz / 12 = 5Hz (0 - B) - 100 - 60Hz / 2 = 30Hz (0 - 1) - 101 - 60Hz / 4 = 15Hz (0 - 3) - 110 - 60Hz / 6 = 10Hz (0 - 5) - 111 - 60Hz / 8 = 7,5Hz (0 - 7) - Bit 4-7 R Divider position, when overflow the LCD is updated - */ - switch ( data & 0x0E ) - { - case 0x00: m_prc.max_frame_count = 3; break; - case 0x02: m_prc.max_frame_count = 6; break; - case 0x04: m_prc.max_frame_count = 9; break; - case 0x06: m_prc.max_frame_count = 12; break; - case 0x08: m_prc.max_frame_count = 2; break; - case 0x0A: m_prc.max_frame_count = 4; break; - case 0x0C: m_prc.max_frame_count = 6; break; - case 0x0E: m_prc.max_frame_count = 8; break; - } - break; - case 0x82: /* BG tile data memory offset (low) - Bit 0-2 Always "0" - Bit 3-7 R/W BG tile data memory offset bit 3-7 - */ - data &= 0xF8; - m_prc.bg_tiles = ( m_prc.bg_tiles & 0xFFFF00 ) | data; - break; - case 0x83: /* BG tile data memory offset (mid) - Bit 0-7 R/W BG tile data memory offset bit 8-15 - */ - m_prc.bg_tiles = ( m_prc.bg_tiles & 0xFF00FF ) | ( data << 8 ); - break; - case 0x84: /* BG tile data memory offset (high) - Bit 0-4 R/W BG tile data memory offset bit 16-20 - Bit 5-7 Unused - */ - data &= 0x1F; - m_prc.bg_tiles = ( m_prc.bg_tiles & 0x00FFFF ) | ( data << 16 ); - break; - case 0x85: /* BG vertical move - Bit 0-6 R/W Move the background up, move range: - Map size 0: 0x00 to 0x40 - Map size 1: 0x00 to 0x20 - Map size 2: move ignored - Bit 7 Unused - */ - case 0x86: /* BG horizontal move - Bit 0-6 R/W Move the background left, move range: - Map size 0: move ignored - Map size 1: 0x00 to 0x20 - Map size 2: 0x00 to 0x60 - Bit 7 Unused - */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); - break; - case 0x87: /* Sprite tile data memory offset (low) - Bit 0-5 Always "0" - Bit 6-7 R/W Sprite tile data memory offset bit 6-7 - */ - data &= 0xC0; - m_prc.spr_tiles = ( m_prc.spr_tiles & 0xFFFF00 ) | data; - break; - case 0x88: /* Sprite tile data memory offset (med) - Bit 0-7 R/W Sprite tile data memory offset bit 8-15 - */ - m_prc.spr_tiles = ( m_prc.spr_tiles & 0xFF00FF ) | ( data << 8 ); - break; - case 0x89: /* Sprite tile data memory offset (high) - Bit 0-4 R/W Sprite tile data memory offset bit 16-20 - Bit 5-7 Unused - */ - data &= 0x1F; - m_prc.spr_tiles = ( m_prc.spr_tiles & 0x00FFFF ) | ( data << 16 ); - break; - case 0x8A: /* LCD status - Bit 0 R Unknown - Bit 1 R Unknown - Bit 2 R Unknown - Bit 3 R Unknown - Bit 4 R LCD during V-Sync / Rendering circuitry active or not ( 1 = not active) - Bit 5 R Unknown - Bit 6-7 Unused - */ - case 0xFE: /* Direct LCD control / data - Bit 0-7 R/W Direct LCD command or data - */ -// lcd_command_w( data ); - break; - case 0xFF: /* Direct LCD data - Bit 0-7 R/W Direct LCD data - */ -// lcd_data_w( data ); - break; - default: - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", m_maincpu->pc(), offset, data ); - break; - } - m_pm_reg[offset] = data; -} - -READ8_MEMBER(pokemini_state::hwreg_r) -{ - UINT8 data = m_pm_reg[offset]; - - switch( offset ) - { - case 0x52: return m_inputs->read(); - case 0x61: - if ( ! ( m_pm_reg[0x60] & 0x04 ) ) - { - data = ( data & ~ 0x04 ) | ( m_i2cmem->read_sda() ? 0x04 : 0x00 ); - } - - if ( ! ( m_pm_reg[0x60] & 0x08 ) ) - { - data &= ~0x08; - } - break; - case 0x81: return ( m_pm_reg[offset] & 0x0F ) | ( m_prc.frame_count << 4 ); - case 0x8A: return m_prc.count; - } - return data; -} - -DEVICE_IMAGE_LOAD_MEMBER( pokemini_state, pokemini_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - /* Verify that the image is big enough */ - if (size <= 0x2100) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM image: ROM image is too small"); - return IMAGE_INIT_FAIL; - } - - /* Verify that the image is not too big */ - if (size > 0x1fffff) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM image: ROM image is too big"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - -void pokemini_state::prc_counter_callback() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - m_prc.count++; - - /* Check for overflow */ - if ( m_prc.count >= 0x42 ) - { - m_prc.count = 0; - m_prc.frame_count++; - } - else - { - if ( m_prc.count == 0x18 && m_prc.frame_count >= m_prc.max_frame_count ) - { - m_prc.frame_count = 0; - - /* Check if the background should be drawn */ - if ( m_prc.background_enabled ) - { - int x, y; - for ( y = 0; y < 8; y++ ) { - for ( x = 0; x < 12; x++ ) { - UINT8 tile = m_p_ram[ 0x360 + ( y * m_prc.map_size_x ) + x ]; - int i; - for( i = 0; i < 8; i++ ) { - m_p_ram[ ( y * 96 ) + ( x * 8 ) + i ] = space.read_byte( m_prc.bg_tiles + ( tile * 8 ) + i ); - } - } - } - } - - /* Check if the sprites should be drawn */ - if ( m_prc.sprites_enabled ) - { - UINT16 spr; - - for ( spr = 0x35C; spr >= 0x300; spr -= 4 ) - { - int spr_x = ( m_p_ram[ spr + 0 ] & 0x7F ) - 16; - int spr_y = ( m_p_ram[ spr + 1 ] & 0x7F ) - 16; - UINT8 spr_tile = m_p_ram[ spr + 2 ]; - UINT8 spr_flag = m_p_ram[ spr + 3 ]; - - if ( spr_flag & 0x08 ) - { - UINT16 gfx, mask; - UINT32 spr_base = m_prc.spr_tiles + spr_tile * 64; - int i, j; - - for ( i = 0; i < 16; i++ ) - { - if ( spr_x + i >= 0 && spr_x + i < 96 ) - { - int rel_x = ( spr_flag & 0x01 ) ? 15 - i : i; - UINT32 s = spr_base + ( ( rel_x & 0x08 ) << 2 ) + ( rel_x & 0x07 ); - - mask = ~ ( space.read_byte( s ) | ( space.read_byte( s + 8 ) << 8 ) ); - gfx = space.read_byte( s + 16 ) | ( space.read_byte( s + 24 ) << 8 ); - - /* Are the colors inverted? */ - if ( spr_flag & 0x04 ) - { - gfx = ~gfx; - } - - for ( j = 0; j < 16; j++ ) - { - if ( spr_y + j >= 0 && spr_y + j < 64 ) - { - UINT16 ram_addr = ( ( ( spr_y + j ) >> 3 ) * 96 ) + spr_x + i; - - if ( spr_flag & 0x02 ) - { - if ( mask & 0x8000 ) - { - m_p_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); - if ( gfx & 0x8000 ) - { - m_p_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); - } - } - mask <<= 1; - gfx <<= 1; - } - else - { - if ( mask & 0x0001 ) - { - m_p_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); - if ( gfx & 0x0001 ) - { - m_p_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); - } - } - mask >>= 1; - gfx >>= 1; - } - } - } - } - } - } - } - } - - /* Set PRC Render interrupt */ - m_pm_reg[0x27] |= 0x40; - check_irqs(); - - /* Check if the rendered data should be copied to the LCD */ - if ( m_prc.copy_enabled ) - { - int x, y; - - for( y = 0; y < 64; y += 8 ) { - for( x = 0; x < 96; x++ ) { - UINT8 data = m_p_ram[ ( y * 12 ) + x ]; - - m_bitmap.pix16(y + 0, x) = ( data & 0x01 ) ? 3 : 0; - m_bitmap.pix16(y + 1, x) = ( data & 0x02 ) ? 3 : 0; - m_bitmap.pix16(y + 2, x) = ( data & 0x04 ) ? 3 : 0; - m_bitmap.pix16(y + 3, x) = ( data & 0x08 ) ? 3 : 0; - m_bitmap.pix16(y + 4, x) = ( data & 0x10 ) ? 3 : 0; - m_bitmap.pix16(y + 5, x) = ( data & 0x20 ) ? 3 : 0; - m_bitmap.pix16(y + 6, x) = ( data & 0x40 ) ? 3 : 0; - m_bitmap.pix16(y + 7, x) = ( data & 0x80 ) ? 3 : 0; - } - } - - /* Set PRC Copy interrupt */ - m_pm_reg[0x27] |= 0x80; - check_irqs(); - } - } - - /* Set possible input irqs */ - m_pm_reg[0x29] |= ~ m_inputs->read(); - } -} - - -void pokemini_state::machine_start() -{ - /* Clear internal structures */ - memset( &m_prc, 0, sizeof(m_prc) ); - memset( &m_timers, 0, sizeof(m_timers) ); - memset( m_pm_reg, 0, sizeof(m_pm_reg) ); - - /* Set up timers */ - m_timers.seconds_timer = timer_alloc(TIMER_SECONDS); - m_timers.seconds_timer->adjust(attotime::zero, 0, attotime::from_seconds(1)); - - m_timers.hz256_timer = timer_alloc(TIMER_256HZ); - m_timers.hz256_timer->adjust(attotime::zero, 0, attotime::from_hz(256)); - - m_timers.timer1 = timer_alloc(TIMER_1); - m_timers.timer1_hi = timer_alloc(TIMER_1_HI); - m_timers.timer2 = timer_alloc(TIMER_2); - m_timers.timer2_hi = timer_alloc(TIMER_2_HI); - m_timers.timer3 = timer_alloc(TIMER_3); - m_timers.timer3_hi = timer_alloc(TIMER_3_HI); - - /* Set up the PRC */ - m_prc.max_frame_count = 2; - m_prc.count_timer = timer_alloc(TIMER_PRC); - m_prc.count_timer->adjust( attotime::zero, 0, m_maincpu->cycles_to_attotime(55640 / 65) ); -} - - -void pokemini_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_SECONDS: - seconds_timer_callback(); - break; - - case TIMER_256HZ: - timer_256hz_callback(); - break; - - case TIMER_1: - timer1_callback(); - break; - - case TIMER_1_HI: - timer1_hi_callback(); - break; - - case TIMER_2: - timer2_callback(); - break; - - case TIMER_2_HI: - timer2_hi_callback(); - break; - - case TIMER_3: - timer3_callback(); - break; - - case TIMER_3_HI: - timer3_hi_callback(); - break; - - case TIMER_PRC: - prc_counter_callback(); - break; - } -} - - -static const INT16 speaker_levels[] = {-32768, 0, 32767}; - -void pokemini_state::video_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); -} - - -UINT32 pokemini_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - - -static MACHINE_CONFIG_START( pokemini, pokemini_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", MINX, 4000000) - MCFG_CPU_PROGRAM_MAP(pokemini_mem_map) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_I2CMEM_ADD("i2cmem") - MCFG_I2CMEM_DATA_SIZE(0x2000) - - /* This still needs to be improved to actually match the hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_UPDATE_DRIVER(pokemini_state, screen_update) - MCFG_SCREEN_SIZE( 96, 64 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 95, 0, 63 ) - MCFG_SCREEN_REFRESH_RATE( 72 ) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(pokemini_state, pokemini) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(3, speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pokemini_cart") - MCFG_GENERIC_EXTENSIONS("bin,min") - MCFG_GENERIC_LOAD(pokemini_state, pokemini_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "pokemini") -MACHINE_CONFIG_END - -ROM_START( pokemini ) - ROM_REGION( 0x200000, "maincpu", 0 ) - ROM_LOAD( "bios.min", 0x0000, 0x1000, CRC(aed3c14d) SHA1(daad4113713ed776fbd47727762bca81ba74915f) ) -ROM_END - - -CONS( 2001, pokemini, 0, 0, pokemini, pokemini, driver_device, 0, "Nintendo", "Pokemon Mini", MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/poly.c b/src/mess/drivers/poly.c deleted file mode 100644 index 0ae7749316b..00000000000 --- a/src/mess/drivers/poly.c +++ /dev/null @@ -1,229 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Poly/Proteus (New Zealand) - - 10/07/2011 Skeleton driver. - - http://www.cs.otago.ac.nz/homepages/andrew/poly/Poly.htm - - Andrew has supplied the roms for -bios 1 - - It uses a 6809 for all main functions. There is a Z80 for CP/M, but all - of the roms are 6809 code. - - The keyboard controller is one of those custom XR devices. - Will use the terminal keyboard instead. - - With bios 1, after entering your userid and password, you get a black - screen. This is normal, because it joins to a network which isn't there. - - ToDo: - - Almost Everything! - - Connect up the device ports & lines - - Find out about graphics mode and how it is selected - - Fix Keyboard so that the Enter key tells BASIC to do something - - Find out how to make 2nd teletext screen to display - - Banking - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "cpu/z80/z80.h" -#include "machine/6821pia.h" -#include "machine/6840ptm.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "machine/mc6854.h" -#include "video/saa5050.h" -#include "machine/keyboard.h" -#include "sound/speaker.h" - -#define KEYBOARD_TAG "keyboard" - -class poly_state : public driver_device -{ -public: - poly_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pia0(*this, "pia0"), - m_pia1(*this, "pia1"), - m_acia(*this, "acia"), - m_ptm(*this, "ptm"), - m_speaker(*this, "speaker"), - m_videoram(*this, "videoram") - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(pia1_b_in); - DECLARE_READ8_MEMBER(videoram_r); - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - DECLARE_WRITE8_MEMBER( ptm_o2_callback ); - DECLARE_WRITE8_MEMBER( ptm_o3_callback ); - -protected: - virtual void machine_reset(); - -private: - required_device m_maincpu; - required_device m_pia0; - required_device m_pia1; - required_device m_acia; - required_device m_ptm; - required_device m_speaker; - required_shared_ptr m_videoram; - UINT8 m_term_data; -}; - - -static ADDRESS_MAP_START(poly_mem, AS_PROGRAM, 8, poly_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000,0x9fff) AM_RAM - AM_RANGE(0xa000,0xcfff) AM_ROM - AM_RANGE(0xd000,0xdfff) AM_RAM - AM_RANGE(0xe000,0xe003) AM_DEVREADWRITE("pia0", pia6821_device, read, write) //video control PIA 6821 - AM_RANGE(0xe004,0xe004) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) - AM_RANGE(0xe005,0xe005) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) - //AM_RANGE(0xe006, 0xe006) // baud rate controller (0=9600,2=4800,4=2400,6=1200,8=600,A=300) - AM_RANGE(0xe00c,0xe00f) AM_DEVREADWRITE("pia1", pia6821_device, read, write) //keyboard PIA 6821 - AM_RANGE(0xe020,0xe027) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) //timer 6840 - AM_RANGE(0xe030,0xe037) AM_DEVREADWRITE("adlc", mc6854_device, read, write) //Data Link Controller 6854 - AM_RANGE(0xe040,0xe040) AM_NOP //Set protect flip-flop after 1 E-cycle - AM_RANGE(0xe050,0xe05f) AM_RAM //Dynamic Address Translater (arranges memory banks) - // AM_RANGE(0xe060,0xe060) Select Map 1 - // AM_RANGE(0xe070,0xe070) Select Map 2 - AM_RANGE(0xe800,0xebbf) AM_RAM AM_SHARE("videoram") - AM_RANGE(0xebc0,0xebff) AM_RAM - AM_RANGE(0xec00,0xefbf) AM_RAM // screen 2 AM_SHARE("videoram") - AM_RANGE(0xefc0,0xefff) AM_RAM - AM_RANGE(0xf000,0xffff) AM_ROM -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( poly ) -INPUT_PORTS_END - - -void poly_state::machine_reset() -{ -} - -READ8_MEMBER( poly_state::pia1_b_in ) -{ -// return ascii key value, bit 7 is the strobe value - UINT8 data = m_term_data; - m_term_data &= 0x7f; - return data; -} - -READ8_MEMBER( poly_state::videoram_r ) -{ - return m_videoram[offset]; -} - -WRITE8_MEMBER( poly_state::kbd_put ) -{ - m_term_data = data | 0x80; - - m_pia1->cb1_w(1); - m_pia1->cb1_w(0); -} - -WRITE_LINE_MEMBER( poly_state::write_acia_clock ) -{ - m_acia->write_txc(state); - m_acia->write_rxc(state); -} - -WRITE8_MEMBER( poly_state::ptm_o2_callback ) -{ - m_ptm->set_c1(data); -} - -WRITE8_MEMBER( poly_state::ptm_o3_callback ) -{ - m_speaker->level_w(data); -} - -static MACHINE_CONFIG_START( poly, poly_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809E, XTAL_12MHz / 3) // 12.0576MHz - MCFG_CPU_PROGRAM_MAP(poly_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(40 * 12, 24 * 20) - MCFG_SCREEN_VISIBLE_AREA(0, 40 * 12 - 1, 0, 24 * 20 - 1) - MCFG_SCREEN_UPDATE_DEVICE("saa5050", saa5050_device, screen_update) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000) - MCFG_SAA5050_D_CALLBACK(READ8(poly_state, videoram_r)) - MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) - - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(poly_state, pia1_b_in)) - // CB1 kbd strobe - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - - MCFG_DEVICE_ADD("ptm", PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(XTAL_12MHz / 3) - MCFG_PTM6840_EXTERNAL_CLOCKS(0, 0, 0) - MCFG_PTM6840_OUT1_CB(WRITE8(poly_state, ptm_o2_callback)) - MCFG_PTM6840_OUT2_CB(WRITE8(poly_state, ptm_o3_callback)) - MCFG_PTM6840_IRQ_CB(INPUTLINE("maincpu", M6809_IRQ_LINE)) - - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - //MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - //MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - //MCFG_DEVICE_ADD("acia_clock", CLOCK, 1) - //MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(poly_state, write_acia_clock)) - - MCFG_DEVICE_ADD("adlc", MC6854, 0) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(poly_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( poly1 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS(0, "bios0", "Standalone") - ROMX_LOAD( "v3bas1.bin", 0xa000, 0x1000, CRC(2c5276cb) SHA1(897cb9c2456ddb0f316a8c3b8aa56706056cc1dd), ROM_BIOS(1) ) - ROMX_LOAD( "v3bas2.bin", 0xb000, 0x1000, CRC(30f99447) SHA1(a26170113a968ccd8df7db1b0f256a2198054037), ROM_BIOS(1) ) - ROMX_LOAD( "v3bas3.bin", 0xc000, 0x1000, CRC(89ea5b27) SHA1(e37a61d3dd78fb40bc43c70af9714ce3f75fd895), ROM_BIOS(1) ) - ROMX_LOAD( "v3bas4.bin", 0x9000, 0x1000, CRC(c16c1209) SHA1(42f3b0bce32aafab14bc0500fb13bd456730875c), ROM_BIOS(1) ) - // boot rom - ROMX_LOAD( "plrt16v3e9.bin", 0xf000, 0x1000, CRC(453c10a0) SHA1(edfbc3d83710539c01093e89fe1b47dfe1e68acd), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS(1, "bios1", "Terminal") - // supplied by Andrew Trotman, author of Poly1 emulator (PolyROM v3.4) - ROMX_LOAD( "v2bas1.bin", 0xa000, 0x1000, CRC(f8c5adc4) SHA1(b1a16d7d996909185495b15a52afa697324e1f8d), ROM_BIOS(2) ) - ROMX_LOAD( "v2bas2.bin", 0xb000, 0x1000, CRC(a2b0fa4d) SHA1(05ab723eb2e2b09325380a1a72da5ade401847d1), ROM_BIOS(2) ) - ROMX_LOAD( "v2bas3.bin", 0xc000, 0x1000, CRC(04a58be5) SHA1(729fa02c76783213e40bb179e60c09d4b439ab90), ROM_BIOS(2) ) - ROMX_LOAD( "v2bas4.bin", 0x9000, 0x1000, CRC(328fe790) SHA1(43dca92092b27627603d3588f91cf9eca24ed29f), ROM_BIOS(2) ) - ROMX_LOAD( "slrt14_00f9.bin", 0xf000, 0x1000, CRC(6559a2ce) SHA1(7c38f449ca122342732123b56992ed0c446406c2), ROM_BIOS(2) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, poly1, 0, 0, poly, poly, driver_device, 0, "Polycorp", "Poly-1 Educational Computer", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/poly88.c b/src/mess/drivers/poly88.c deleted file mode 100644 index 79905bc2eea..00000000000 --- a/src/mess/drivers/poly88.c +++ /dev/null @@ -1,230 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Poly-88 driver by Miodrag Milanovic - - 18/05/2009 Initial implementation - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "includes/poly88.h" - -static ADDRESS_MAP_START(poly88_mem, AS_PROGRAM, 8, poly88_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x03ff) AM_ROM // Monitor ROM - AM_RANGE(0x0400, 0x0bff) AM_ROM // ROM Expansion - AM_RANGE(0x0c00, 0x0dff) AM_RAM AM_MIRROR(0x200) // System RAM (mirrored) - AM_RANGE(0x1000, 0x1fff) AM_ROM // System Expansion area - AM_RANGE(0x2000, 0x3fff) AM_RAM // Minimal user RAM area - AM_RANGE(0x4000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("video_ram") // Video RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( poly88_io, AS_IO, 8, poly88_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x04, 0x04) AM_WRITE(poly88_baud_rate_w) - AM_RANGE(0x08, 0x08) AM_WRITE(poly88_intr_w) - AM_RANGE(0xf8, 0xf8) AM_READ(poly88_keyboard_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(poly8813_mem, AS_PROGRAM, 8, poly88_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x03ff) AM_ROM // Monitor ROM - AM_RANGE(0x0400, 0x0bff) AM_ROM // Disk System ROM - AM_RANGE(0x0c00, 0x0fff) AM_RAM // System RAM - AM_RANGE(0x1800, 0x1bff) AM_RAM AM_SHARE("video_ram") // Video RAM - AM_RANGE(0x2000, 0xffff) AM_RAM // RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( poly8813_io, AS_IO, 8, poly88_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( poly88 ) - PORT_START("LINEC") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_END) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL")PORT_CODE(KEYCODE_BACKSPACE) - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) -INPUT_PORTS_END - -static const struct CassetteOptions poly88_cassette_options = -{ - 1, /* channels */ - 16, /* bits per sample */ - 7200 /* sample frequency */ -}; - -/* F4 Character Displayer */ -static const gfx_layout poly88_charlayout = -{ - 8, 16, /* text = 7 x 9 */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( poly88 ) - GFXDECODE_ENTRY( "chargen", 0x0000, poly88_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( poly88, poly88_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, 1853000) - MCFG_CPU_PROGRAM_MAP(poly88_mem) - MCFG_CPU_IO_MAP(poly88_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", poly88_state, poly88_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(poly88_state,poly88_irq_callback) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*10, 16*15) - MCFG_SCREEN_VISIBLE_AREA(0, 64*10-1, 0, 16*15-1) - MCFG_SCREEN_UPDATE_DRIVER(poly88_state, screen_update_poly88) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", poly88) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_CREATE_OPTS(&poly88_cassette_options) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) - - /* uart */ - MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(poly88_state,write_cas_tx)) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(poly88_state,poly88_usart_rxready)) - - /* snapshot */ - MCFG_SNAPSHOT_ADD("snapshot", poly88_state, poly88, "img", 0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( poly8813, poly88 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(poly8813_mem) - MCFG_CPU_IO_MAP(poly8813_io) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( poly88 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "polymon4.bin", 0x0000, 0x0400, CRC(0baa1a4c) SHA1(c6cf4b89bdde200813d34aab08150d5f3025ce33)) - ROM_LOAD( "tbasic_1.rom", 0x0400, 0x0400, CRC(ec22740e) SHA1(bc606c58ef5f046200bdf402eda66ec070464306)) - ROM_LOAD( "tbasic_2.rom", 0x0800, 0x0400, CRC(f2619232) SHA1(eb6fb0356d2fb153111cfddf39eab10253cb4c53)) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "6571.bin", 0x0000, 0x0800, CRC(5a25144b) SHA1(7b9fee0c8ef2605b85d12b6d9fe8feb82418c63a) ) -ROM_END - -ROM_START( poly8813 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "poly8813-1.bin", 0x0000, 0x0400, CRC(7fd980a0) SHA1(a71d5999deb4323a11db1c0ea0dcb1dacfaf47ef)) - ROM_LOAD( "poly8813-2.rom", 0x0400, 0x0400, CRC(1ad7c06c) SHA1(c96b8f03c184de58dbdcee18d297dbccf2d77176)) - ROM_LOAD( "poly8813-3.rom", 0x0800, 0x0400, CRC(3df57e5b) SHA1(5b0c4febfc7515fc07e63dcb21d0ab32bc6a2e46)) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "6571.bin", 0x0000, 0x0800, CRC(5a25144b) SHA1(7b9fee0c8ef2605b85d12b6d9fe8feb82418c63a) ) -ROM_END -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1976, poly88, 0, 0, poly88, poly88, poly88_state, poly88, "PolyMorphic Systems", "Poly-88", 0) -COMP( 1977, poly8813,poly88,0, poly8813, poly88, poly88_state, poly88, "PolyMorphic Systems", "Poly-8813",MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/poly880.c b/src/mess/drivers/poly880.c deleted file mode 100644 index 26917bcd25e..00000000000 --- a/src/mess/drivers/poly880.c +++ /dev/null @@ -1,288 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Poly-Computer 880 - - 12/05/2009 Skeleton driver. - - http://www.kc85-museum.de/books/poly880/index.html - -After starting this driver, the screen may be blank. Press F2 until -something appears (most likely 'Go'). Then it can be used, or pasted to. - -To see it say POLY-880, start the system, press F2, F1, F2. - -Pasting: - 0-F : as is - EXEC : ^ - BACK : V - MEM : - - GO : X - -Test Paste: - -4000^11^22^33^44^55^66^77^88^99^-4000 - Now press up-arrow to confirm the data has been entered. - -****************************************************************************/ - -#include "includes/poly880.h" -#include "poly880.lh" - -/* - - TODO: - - - SEND/SCON - - MCYCL (activate single stepping) - - CYCL (single step) - - layout LEDs (address bus, data bus, command bus, MCYCL) - - RAM expansion - -*/ - -/* Read/Write Handlers */ - -void poly880_state::update_display() -{ - int i; - - for (i = 0; i < 8; i++) - { - if (BIT(m_digit, i)) output_set_digit_value(7 - i, m_segment); - } -} - -WRITE8_MEMBER( poly880_state::cldig_w ) -{ - m_digit = data; - - update_display(); -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( poly880_mem, AS_PROGRAM, 8, poly880_state ) - AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_ROM - AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_ROM - AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_ROM - AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_ROM - AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x3c00) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( poly880_io, AS_IO, 8, poly880_state ) - ADDRESS_MAP_GLOBAL_MASK(0xaf) - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(Z80PIO1_TAG, z80pio_device, read_alt, write_alt) - AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(Z80PIO2_TAG, z80pio_device, read_alt, write_alt) - AM_RANGE(0x88, 0x8b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(cldig_w) -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( poly880_state::trigger_reset ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER( poly880_state::trigger_nmi ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - -static INPUT_PORTS_START( poly880 ) - PORT_START("KI1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EXEC") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACK") PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FCT") PORT_CODE(KEYCODE_T) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STEP") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_M) PORT_CHAR('-') - - PORT_START("KI2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - - PORT_START("KI3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RES") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, poly880_state, trigger_reset, 0) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MON") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF, poly880_state, trigger_nmi, 0) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MCYCL") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CYCL") PORT_CODE(KEYCODE_F4) -INPUT_PORTS_END - -/* Z80-CTC Interface */ - -WRITE_LINE_MEMBER( poly880_state::ctc_z0_w ) -{ - // SEND -} - -WRITE_LINE_MEMBER( poly880_state::ctc_z1_w ) -{ -} - -/* Z80-PIO Interface */ - -WRITE8_MEMBER( poly880_state::pio1_pa_w ) -{ - /* - - bit signal description - - PA0 SD0 segment E - PA1 SD1 segment D - PA2 SD2 segment C - PA3 SD3 segment P - PA4 SD4 segment G - PA5 SD5 segment A - PA6 SD6 segment F - PA7 SD7 segment B - - */ - - m_segment = BITSWAP8(data, 3, 4, 6, 0, 1, 2, 7, 5); - - update_display(); -} - -READ8_MEMBER( poly880_state::pio1_pb_r ) -{ - /* - - bit signal description - - PB0 TTY - PB1 MIN tape input - PB2 MOUT tape output - PB3 - PB4 KI1 key row 1 input - PB5 KI2 key row 2 input - PB6 SCON - PB7 KI3 key row 3 input - - */ - - UINT8 data = 0xf0 | ((m_cassette->input() < +0.0) << 1); - int i; - - for (i = 0; i < 8; i++) - { - if (BIT(m_digit, i)) - { - if (!BIT(m_ki1->read(), i)) data &= ~0x10; - if (!BIT(m_ki2->read(), i)) data &= ~0x20; - if (!BIT(m_ki3->read(), i)) data &= ~0x80; - } - } - - return data; -} - -WRITE8_MEMBER( poly880_state::pio1_pb_w ) -{ - /* - - bit signal description - - PB0 TTY teletype serial output - PB1 MIN - PB2 MOUT tape output - PB3 - PB4 KI1 key row 1 input - PB5 KI2 key row 2 input - PB6 SCON - PB7 KI3 key row 3 input - - */ - - /* tape output */ - m_cassette->output( BIT(data, 2) ? +1.0 : -1.0); -} - -#if 0 -/* Z80 Daisy Chain */ - -static const z80_daisy_config poly880_daisy_chain[] = -{ - { Z80PIO1_TAG }, - { Z80PIO2_TAG }, - { Z80CTC_TAG }, - { NULL } -}; -#endif - -/* Machine Initialization */ - -void poly880_state::machine_start() -{ - /* register for state saving */ - save_item(NAME(m_digit)); - save_item(NAME(m_segment)); -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( poly880, poly880_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_7_3728MHz/8) - MCFG_CPU_PROGRAM_MAP(poly880_mem) - MCFG_CPU_IO_MAP(poly880_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_poly880 ) - - /* devices */ - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_7_3728MHz/16) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(poly880_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(poly880_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) - - MCFG_DEVICE_ADD(Z80PIO1_TAG, Z80PIO, XTAL_7_3728MHz/16) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(poly880_state, pio1_pa_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(poly880_state, pio1_pb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(poly880_state, pio1_pb_w)) - - MCFG_DEVICE_ADD(Z80PIO2_TAG, Z80PIO, XTAL_7_3728MHz/16) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( poly880 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "poly880.i5", 0x0000, 0x0400, CRC(b1c571e8) SHA1(85bfe53d39d6690e79999a1e1240789497e72db0) ) - ROM_LOAD( "poly880.i6", 0x1000, 0x0400, CRC(9efddf5b) SHA1(6ffa2f80b2c6f8ec9e22834f739c82f9754272b8) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, poly880, 0, 0, poly880, poly880, driver_device, 0, "VEB Polytechnik", "Poly-Computer 880", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/portfoli.c b/src/mess/drivers/portfoli.c deleted file mode 100644 index 1cbbc30fc57..00000000000 --- a/src/mess/drivers/portfoli.c +++ /dev/null @@ -1,929 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Atari Portfolio - - http://portfolio.wz.cz/ - http://www.pofowiki.de/doku.php - http://www.best-electronics-ca.com/portfoli.htm - http://www.atari-portfolio.co.uk/pfnews/pf9.txt - - - Undumped Atari cartridges: - - Utility-Card HPC-701 - Finance-Card HPC-702 - Science-Card HPC-703 - File Manager / Tutorial HPC-704 - PowerBASIC HPC-705 - Instant Spell HPC-709 - Hyperlist HPC-713 - Bridge Baron HPC-724 - Wine Companion HPC-725 - Diet / Cholesterol Counter HPC-726 - Astrologer HPC-728 - Stock Tracker HPC-729 - Chess HPC-750 - - - Undumped 3rd party cartridges: - - Adcalc AAC-1000 - Alpha Paging Interface SAMpage - Business Contacts and Information Manager BCIM - Checkwriter - Colossal Cave Adventure - Drug Interactions - Dynapulse 200M-A - Form Letters - FORTH programming system UTIL - FX-3 DUAT Flight Software - FX-4 Flight Planner - Graphics Screens - Marine Device Interface CM380 UMPIRE - Message Mover (Mac) MSG-PKG6 - Message Mover (PC) MSG-PKG5 - Micro Hedge - Micro-Roentgen Radiation Monitor RM-60 - Patient Management - PBase - PDD2 Utilities - Pharmaceuticals - Physician's Reference I - PIPELINE Fuel Management - REACT - Stocks Games - Terminal+ - Timekeeper - TIMEPAC-5 - -*/ - -/* - - TODO: - - - expansion port slot interface - - clock is running too fast - - create chargen ROM from tech manual - - memory error interrupt vector - - i/o port 8051 - - screen contrast - - system tick frequency selection (1 or 128 Hz) - - speaker - - credit card memory (A:/B:) - - software list - -*/ - -#include "includes/portfoli.h" -#include "bus/rs232/rs232.h" -#include "rendlay.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -enum -{ - INT_TICK = 0, - INT_KEYBOARD, - INT_ERROR, - INT_EXTERNAL -}; - -enum -{ - PID_COMMCARD = 0x00, - PID_SERIAL, - PID_PARALLEL, - PID_PRINTER, - PID_MODEM, - PID_NONE = 0xff -}; - -static const UINT8 INTERRUPT_VECTOR[] = { 0x08, 0x09, 0x00 }; - - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// check_interrupt - check interrupt status -//------------------------------------------------- - -void portfolio_state::check_interrupt() -{ - int level = (m_ip & m_ie) ? ASSERT_LINE : CLEAR_LINE; - - m_maincpu->set_input_line(INPUT_LINE_INT0, level); -} - - -//------------------------------------------------- -// trigger_interrupt - trigger interrupt request -//------------------------------------------------- - -void portfolio_state::trigger_interrupt(int level) -{ - // set interrupt pending bit - m_ip |= 1 << level; - - check_interrupt(); -} - - -//------------------------------------------------- -// irq_status_r - interrupt status read -//------------------------------------------------- - -READ8_MEMBER( portfolio_state::irq_status_r ) -{ - return m_ip; -} - - -//------------------------------------------------- -// irq_mask_w - interrupt enable mask -//------------------------------------------------- - -WRITE8_MEMBER( portfolio_state::irq_mask_w ) -{ - m_ie = data; - //logerror("IE %02x\n", data); - - check_interrupt(); -} - - -//------------------------------------------------- -// sivr_w - serial interrupt vector register -//------------------------------------------------- - -WRITE8_MEMBER( portfolio_state::sivr_w ) -{ - m_sivr = data; - //logerror("SIVR %02x\n", data); -} - - -//------------------------------------------------- -// IRQ_CALLBACK_MEMBER( portfolio_int_ack ) -//------------------------------------------------- - -IRQ_CALLBACK_MEMBER(portfolio_state::portfolio_int_ack) -{ - UINT8 vector = m_sivr; - - for (int i = 0; i < 4; i++) - { - if (BIT(m_ip, i)) - { - // clear interrupt pending bit - m_ip &= ~(1 << i); - - if (i == 3) - vector = m_sivr; - else - vector = INTERRUPT_VECTOR[i]; - - break; - } - } - - check_interrupt(); - - return vector; -} - - - -//************************************************************************** -// KEYBOARD -//************************************************************************** - -//------------------------------------------------- -// scan_keyboard - scan keyboard -//------------------------------------------------- - -void portfolio_state::scan_keyboard() -{ - UINT8 keycode = 0xff; - - UINT8 keydata[8] = { m_y0->read(), m_y1->read(), m_y2->read(), m_y3->read(), - m_y4->read(), m_y5->read(), m_y6->read(), m_y7->read() }; - - for (int row = 0; row < 8; row++) - { - UINT8 data = keydata[row]; - - if (data != 0xff) - { - for (int col = 0; col < 8; col++) - { - if (!BIT(data, col)) - { - keycode = (row * 8) + col; - } - } - } - } - - if (keycode != 0xff) - { - // key pressed - if (keycode != m_keylatch) - { - m_keylatch = keycode; - - trigger_interrupt(INT_KEYBOARD); - } - } - else - { - // key released - if (m_keylatch != 0xff) - { - m_keylatch |= 0x80; - - trigger_interrupt(INT_KEYBOARD); - } - } -} - - -//------------------------------------------------- -// TIMER_DEVICE_CALLBACK_MEMBER( keyboard_tick ) -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::keyboard_tick) -{ - scan_keyboard(); -} - - -//------------------------------------------------- -// keyboard_r - keyboard scan code register -//------------------------------------------------- - -READ8_MEMBER( portfolio_state::keyboard_r ) -{ - return m_keylatch; -} - - - -//************************************************************************** -// INTERNAL SPEAKER -//************************************************************************** - -//------------------------------------------------- -// speaker_w - internal speaker output -//------------------------------------------------- - -WRITE8_MEMBER( portfolio_state::speaker_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 speaker level - - */ - - m_speaker->level_w(!BIT(data, 7)); - - //logerror("SPEAKER %02x\n", data); -} - - - -//************************************************************************** -// POWER MANAGEMENT -//************************************************************************** - -//------------------------------------------------- -// power_w - power management -//------------------------------------------------- - -WRITE8_MEMBER( portfolio_state::power_w ) -{ - /* - - bit description - - 0 - 1 1=power off - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - //logerror("POWER %02x\n", data); -} - - -//------------------------------------------------- -// battery_r - battery status -//------------------------------------------------- - -READ8_MEMBER( portfolio_state::battery_r ) -{ - /* - - bit signal description - - 0 - 1 - 2 - 3 - 4 - 5 PDET 1=peripheral connected - 6 BATD? 0=battery low - 7 1=cold boot - - */ - - UINT8 data = 0; - - /* peripheral detect */ - data |= (m_pid != PID_NONE) << 5; - - /* battery status */ - data |= BIT(m_battery->read(), 0) << 6; - - return data; -} - - -//------------------------------------------------- -// unknown_w - ? -//------------------------------------------------- - -WRITE8_MEMBER( portfolio_state::unknown_w ) -{ - //logerror("UNKNOWN %02x\n", data); -} - - - -//************************************************************************** -// SYSTEM TIMERS -//************************************************************************** - -//------------------------------------------------- -// TIMER_DEVICE_CALLBACK_MEMBER( system_tick ) -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::system_tick) -{ - trigger_interrupt(INT_TICK); -} - - -//------------------------------------------------- -// TIMER_DEVICE_CALLBACK_MEMBER( counter_tick ) -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::counter_tick) -{ - m_counter++; -} - - -//------------------------------------------------- -// counter_r - counter register read -//------------------------------------------------- - -READ8_MEMBER( portfolio_state::counter_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0: - data = m_counter & 0xff; - break; - - case 1: - data = m_counter >> 1; - break; - } - - return data; -} - - -//------------------------------------------------- -// counter_w - counter register write -//------------------------------------------------- - -WRITE8_MEMBER( portfolio_state::counter_w ) -{ - switch (offset) - { - case 0: - m_counter = (m_counter & 0xff00) | data; - break; - - case 1: - m_counter = (data << 8) | (m_counter & 0xff); - break; - } -} - - - -//************************************************************************** -// EXPANSION -//************************************************************************** - -//------------------------------------------------- -// ncc1_w - credit card memory select -//------------------------------------------------- - -WRITE8_MEMBER( portfolio_state::ncc1_w ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - if (BIT(data, 0)) - { - // system ROM - program.install_rom(0xc0000, 0xdffff, m_rom); - } - else - { - // credit card memory - program.unmap_readwrite(0xc0000, 0xdffff); - } - - //logerror("NCC %02x\n", data); -} - - -//------------------------------------------------- -// pid_r - peripheral identification -//------------------------------------------------- - -READ8_MEMBER( portfolio_state::pid_r ) -{ - /* - - PID peripheral - - 00 communication card - 01 serial port - 02 parallel port - 03 printer peripheral - 04 modem - 05-3f reserved - 40-7f user peripherals - 80 file-transfer interface - 81-ff reserved - - */ - - return m_pid; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( portfolio_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( portfolio_mem, AS_PROGRAM, 8, portfolio_state ) - AM_RANGE(0x00000, 0x1efff) AM_RAM AM_SHARE("nvram1") - AM_RANGE(0x1f000, 0x9efff) AM_RAM // expansion - AM_RANGE(0xb0000, 0xb0fff) AM_MIRROR(0xf000) AM_RAM AM_SHARE("nvram2") // video RAM - AM_RANGE(0xc0000, 0xdffff) AM_ROM AM_REGION(M80C88A_TAG, 0) // or credit card memory - AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION(M80C88A_TAG, 0x20000) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( portfolio_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( portfolio_io, AS_IO, 8, portfolio_state ) - AM_RANGE(0x8000, 0x8000) AM_READ(keyboard_r) - AM_RANGE(0x8010, 0x8010) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, data_r, data_w) - AM_RANGE(0x8011, 0x8011) AM_DEVREADWRITE(HD61830_TAG, hd61830_device, status_r, control_w) - AM_RANGE(0x8020, 0x8020) AM_WRITE(speaker_w) - AM_RANGE(0x8030, 0x8030) AM_WRITE(power_w) - AM_RANGE(0x8040, 0x8041) AM_READWRITE(counter_r, counter_w) - AM_RANGE(0x8050, 0x8050) AM_READWRITE(irq_status_r, irq_mask_w) - AM_RANGE(0x8051, 0x8051) AM_READWRITE(battery_r, unknown_w) - AM_RANGE(0x8060, 0x8060) AM_RAM AM_SHARE("contrast") -// AM_RANGE(0x8070, 0x8077) AM_DEVREADWRITE(M82C50A_TAG, ins8250_device, ins8250_r, ins8250_w) // Serial Interface -// AM_RANGE(0x8078, 0x807b) AM_DEVREADWRITE(M82C55A_TAG, i8255_device, read, write) // Parallel Interface - AM_RANGE(0x807c, 0x807c) AM_WRITE(ncc1_w) - AM_RANGE(0x807f, 0x807f) AM_READWRITE(pid_r, sivr_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( portfolio ) -//------------------------------------------------- - -static INPUT_PORTS_START( portfolio ) - PORT_START("Y0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Atari") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - - PORT_START("Y1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - - PORT_START("Y2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - - PORT_START("Y3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('"') PORT_CHAR('`') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("Y4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - - PORT_START("Y5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('8') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("Y6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fn") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("Y7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) - PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x00, "Low Battery" ) - - PORT_START("PERIPHERAL") - PORT_CONFNAME( 0xff, PID_NONE, "Peripheral" ) - PORT_CONFSETTING( PID_NONE, DEF_STR( None ) ) - PORT_CONFSETTING( PID_PARALLEL, "Intelligent Parallel Interface (HPC-101)" ) - PORT_CONFSETTING( PID_SERIAL, "Serial Interface (HPC-102)" ) -INPUT_PORTS_END - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -PALETTE_INIT_MEMBER(portfolio_state, portfolio) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - - -//------------------------------------------------- -// HD61830_INTERFACE( lcdc_intf ) -//------------------------------------------------- - -READ8_MEMBER( portfolio_state::hd61830_rd_r ) -{ - UINT16 address = ((offset & 0xff) << 3) | ((offset >> 12) & 0x07); - UINT8 data = m_char_rom[address]; - - return data; -} - - -//------------------------------------------------- -// gfx_layout charlayout -//------------------------------------------------- - -static const gfx_layout charlayout = -{ - 6, 8, - 256, - 1, - { 0 }, - { 7, 6, 5, 4, 3, 2 }, - { STEP8(0,8) }, - 8*8 -}; - - -//------------------------------------------------- -// GFXDECODE( portfolio ) -//------------------------------------------------- - -static GFXDECODE_START( portfolio ) - GFXDECODE_ENTRY( HD61830_TAG, 0, charlayout, 0, 2 ) -GFXDECODE_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// ins8250_interface i8250_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( portfolio_state::i8250_intrpt_w ) -{ - if (state) - trigger_interrupt(INT_EXTERNAL); -} - -//************************************************************************** -// IMAGE LOADING -//************************************************************************** - -//------------------------------------------------- -// DEVICE_IMAGE_LOAD( portfolio_cart ) -//------------------------------------------------- - -DEVICE_IMAGE_LOAD_MEMBER( portfolio_state, portfolio_cart ) -{ - return IMAGE_INIT_FAIL; -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// machine_start -//------------------------------------------------- - -void portfolio_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* memory expansions */ - switch (m_ram->size()) - { - case 128 * 1024: - program.unmap_readwrite(0x1f000, 0x9efff); - break; - - case 384 * 1024: - program.unmap_readwrite(0x5f000, 0x9efff); - break; - } - - /* set initial values */ - m_keylatch = 0xff; - m_sivr = 0x2a; - m_pid = 0xff; - - /* register for state saving */ - save_item(NAME(m_ip)); - save_item(NAME(m_ie)); - save_item(NAME(m_sivr)); - save_item(NAME(m_counter)); - save_item(NAME(m_keylatch)); - save_pointer(NAME(m_contrast.target()), m_contrast.bytes()); - save_item(NAME(m_pid)); -} - - -//------------------------------------------------- -// machine_reset -//------------------------------------------------- - -void portfolio_state::machine_reset() -{ - address_space &io = m_maincpu->space(AS_IO); - - // peripherals - m_pid = ioport("PERIPHERAL")->read(); - - io.unmap_readwrite(0x8070, 0x807b); - io.unmap_readwrite(0x807d, 0x807e); - - switch (m_pid) - { - case PID_SERIAL: - io.install_readwrite_handler(0x8070, 0x8077, READ8_DEVICE_DELEGATE(m_uart, ins8250_device, ins8250_r), WRITE8_DEVICE_DELEGATE(m_uart, ins8250_device, ins8250_w)); - break; - - case PID_PARALLEL: - io.install_readwrite_handler(0x8078, 0x807b, READ8_DEVICE_DELEGATE(m_ppi, i8255_device, read), WRITE8_DEVICE_DELEGATE(m_ppi, i8255_device, write)); - break; - } -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( portfolio ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( portfolio, portfolio_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M80C88A_TAG, I8088, XTAL_4_9152MHz) - MCFG_CPU_PROGRAM_MAP(portfolio_mem) - MCFG_CPU_IO_MAP(portfolio_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(portfolio_state,portfolio_int_ack) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(72) - MCFG_SCREEN_UPDATE_DEVICE(HD61830_TAG, hd61830_device, screen_update) - MCFG_SCREEN_SIZE(240, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(portfolio_state, portfolio) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", portfolio) - - MCFG_DEVICE_ADD(HD61830_TAG, HD61830, XTAL_4_9152MHz/2/2) - MCFG_HD61830_RD_CALLBACK(READ8(portfolio_state, hd61830_rd_r)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD(M82C55A_TAG, I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_ctrl_out", output_latch_device, write)) - MCFG_I8255_IN_PORTC_CB(DEVREAD8("cent_status_in", input_buffer_device, read)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) - MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit3)) - MCFG_CENTRONICS_SELECT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1)) - MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit0)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0) - MCFG_OUTPUT_LATCH_BIT0_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_autofd)) - MCFG_OUTPUT_LATCH_BIT2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_init)) - MCFG_OUTPUT_LATCH_BIT3_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_select_in)) - - MCFG_DEVICE_ADD(M82C50A_TAG, INS8250, XTAL_1_8432MHz) // should be INS8250A - MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_INS8250_OUT_INT_CB(WRITELINE(portfolio_state, i8250_intrpt_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("counter", portfolio_state, counter_tick, attotime::from_hz(XTAL_32_768kHz/16384)) - MCFG_TIMER_DRIVER_ADD_PERIODIC(TIMER_TICK_TAG, portfolio_state, system_tick, attotime::from_hz(XTAL_32_768kHz/32768)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, dsr_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, ri_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(M82C50A_TAG, ins8250_uart_device, cts_w)) - - /* fake keyboard */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", portfolio_state, keyboard_tick, attotime::from_usec(2500)) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "portfolio_cart") - MCFG_GENERIC_LOAD(portfolio_state, portfolio_cart) - - /* memory card */ -/* MCFG_MEMCARD_ADD("memcard_a") - MCFG_MEMCARD_EXTENSION_LIST("bin") - MCFG_MEMCARD_LOAD(portfolio_memcard) - MCFG_MEMCARD_SIZE_OPTIONS("32K,64K,128K") - - MCFG_MEMCARD_ADD("memcard_b") - MCFG_MEMCARD_EXTENSION_LIST("bin") - MCFG_MEMCARD_LOAD(portfolio_memcard) - MCFG_MEMCARD_SIZE_OPTIONS("32K,64K,128K")*/ - - /* software lists */ -// MCFG_SOFTWARE_LIST_ADD("cart_list", "pofo") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("384K,640K") - - MCFG_NVRAM_ADD_RANDOM_FILL("nvram1") - MCFG_NVRAM_ADD_RANDOM_FILL("nvram2") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( pofo ) -//------------------------------------------------- - -ROM_START( pofo ) - ROM_REGION( 0x40000, M80C88A_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "dip1072", "DIP DOS 1.072" ) - ROMX_LOAD( "rom b.u4", 0x00000, 0x20000, BAD_DUMP CRC(c9852766) SHA1(c74430281bc717bd36fd9b5baec1cc0f4489fe82), ROM_BIOS(1) ) // dumped with debug.com - ROMX_LOAD( "rom a.u3", 0x20000, 0x20000, BAD_DUMP CRC(b8fb730d) SHA1(1b9d82b824cab830256d34912a643a7d048cd401), ROM_BIOS(1) ) // dumped with debug.com - - ROM_REGION( 0x800, HD61830_TAG, 0 ) - ROM_LOAD( "hd61830 external character generator", 0x000, 0x800, BAD_DUMP CRC(747a1db3) SHA1(a4b29678fdb43791a8ce4c1ec778f3231bb422c5) ) // typed in from manual -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, pofo, 0, 0, portfolio, portfolio, driver_device, 0, "Atari", "Portfolio", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/pp01.c b/src/mess/drivers/pp01.c deleted file mode 100644 index 3ebde2d08ce..00000000000 --- a/src/mess/drivers/pp01.c +++ /dev/null @@ -1,276 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - PP-01 driver by Miodrag Milanovic - - 08/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "includes/pp01.h" - - -/* Address maps */ -static ADDRESS_MAP_START(pp01_mem, AS_PROGRAM, 8, pp01_state ) - AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("bank1") - AM_RANGE(0x1000, 0x1fff) AM_RAMBANK("bank2") - AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3") - AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4") - AM_RANGE(0x4000, 0x4fff) AM_RAMBANK("bank5") - AM_RANGE(0x5000, 0x5fff) AM_RAMBANK("bank6") - AM_RANGE(0x6000, 0x6fff) AM_RAMBANK("bank7") - AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank8") - AM_RANGE(0x8000, 0x8fff) AM_RAMBANK("bank9") - AM_RANGE(0x9000, 0x9fff) AM_RAMBANK("bank10") - AM_RANGE(0xa000, 0xafff) AM_RAMBANK("bank11") - AM_RANGE(0xb000, 0xbfff) AM_RAMBANK("bank12") - AM_RANGE(0xc000, 0xcfff) AM_RAMBANK("bank13") - AM_RANGE(0xd000, 0xdfff) AM_RAMBANK("bank14") - AM_RANGE(0xe000, 0xefff) AM_RAMBANK("bank15") - AM_RANGE(0xf000, 0xffff) AM_RAMBANK("bank16") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pp01_io, AS_IO, 8, pp01_state ) - AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // system - //AM_RANGE(0xc4, 0xc7) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // user - AM_RANGE(0xc8, 0xc8) AM_MIRROR(2) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0xc9, 0xc9) AM_MIRROR(2) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0xcc, 0xcf) AM_WRITE(pp01_video_write_mode_w) - AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE(0xe0, 0xef) AM_MIRROR(0x10) AM_READWRITE(pp01_mem_block_r, pp01_mem_block_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pp01 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F13") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F14") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete line") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINEA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINEB") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINEC") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num *") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINED") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINEE") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num /") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINEF") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINEALL") - PORT_BIT(0x3F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) -INPUT_PORTS_END - -/* Machine driver */ -static MACHINE_CONFIG_START( pp01, pp01_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(pp01_mem) - MCFG_CPU_IO_MAP(pp01_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(pp01_state, screen_update_pp01) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(pp01_state, pp01) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - //MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - //MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_DEVICE_ADD("uart", I8251, 0) - // when rts and dtr are both high, the uart is being used for cassette operations - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(0) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(pp01_state,pp01_pit_out0)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(pp01_state,pp01_pit_out1)) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pit8253", pit8253_device, write_clk0)) - - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(pp01_state, pp01_8255_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pp01_state, pp01_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(pp01_state, pp01_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pp01_state, pp01_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pp01_state, pp01_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pp01_state, pp01_8255_portc_w)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( pp01 ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - - ROM_LOAD( "ep01.rom", 0x14000, 0x0400, CRC(e48e440f) SHA1(aaae41f0bf163f254e28f6e4d9f6010b349e0c45)) - ROM_LOAD( "ep02.rom", 0x14400, 0x0400, CRC(b9314867) SHA1(220e2a686c6624574e8ea7f6012030c8378a8be6)) - ROM_LOAD( "ep03.rom", 0x14800, 0x0400, CRC(47b91d49) SHA1(51445e24d1c375e798c5ed7b48cb1c7b5e01603a)) - ROM_LOAD( "ep04.rom", 0x14c00, 0x0400, CRC(cc890123) SHA1(7110f301453d925da0d3f29c2ba4eacd5ff8583d)) - ROM_LOAD( "ep05.rom", 0x15000, 0x0400, CRC(b36e2071) SHA1(7c7b2c410f4039980627196575109426bb7bab35)) - ROM_LOAD( "ep06.rom", 0x15400, 0x0400, CRC(3f74efb3) SHA1(77d055eb53ba9b4b14eb2bb8d71f93095b846bb5)) - ROM_LOAD( "ep07.rom", 0x15800, 0x0400, CRC(1dd0bc29) SHA1(109bc3f24a76884d2581f75edc532917cb7ea155)) - ROM_LOAD( "ep08.rom", 0x15c00, 0x0400, CRC(607b710a) SHA1(c5ac7da31204c54d6892d6b708d0291d71963581)) - ROM_LOAD( "ep09.rom", 0x16000, 0x0400, CRC(07f773d1) SHA1(a6cf454318ef0a564a86e669b751e414b12c12d1)) - ROM_LOAD( "ep10.rom", 0x16400, 0x0400, CRC(7793d84b) SHA1(d16ad3db36c8cec68713082ee60324219d3d5032)) - ROM_LOAD( "ep11.rom", 0x16800, 0x0400, CRC(d1b98b5e) SHA1(5526af6317667d707ae413916242cd1bac821373)) - ROM_LOAD( "ep12.rom", 0x16c00, 0x0400, CRC(03c45326) SHA1(f9157ab86cdf1d111bcf19c24e4d7250705be965)) - ROM_LOAD( "ep13.rom", 0x17000, 0x0400, CRC(51769d6c) SHA1(76d6e91cf32b1eb94b9c0ded02e5057ed7ff7d72)) - ROM_LOAD( "ep14.rom", 0x17400, 0x0400, CRC(5d48cefb) SHA1(9b8599dabaf7297ec800fa9a122ad7e3b7b30e8b)) - ROM_LOAD( "ep15.rom", 0x17800, 0x0400, CRC(f44bfe36) SHA1(0ab3c4f061dff6f779685409b07343d0a839fdae)) - ROM_LOAD( "ep16.rom", 0x17c00, 0x0400, CRC(f39c230d) SHA1(9789cedef5655bcb82561f387cc1a6cf48287d78)) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, pp01, 0, 0, pp01, pp01, driver_device, 0, "ZVT", "PP-01", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/prestige.c b/src/mess/drivers/prestige.c deleted file mode 100644 index 18049ff3952..00000000000 --- a/src/mess/drivers/prestige.c +++ /dev/null @@ -1,893 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/* - -VTech PreComputer Prestige Elite - -PCB Layout ----------- - -|-------------------------------------------| -| |-------CN1-------| CN2 | -| | -| CN3 | -| | -|CN10 | -|CN9 RAM --| -|CN8 | -| | -| Z80 ROM | -| 04010 CN4 | -|CN7 | -|CN6 | -| |------CN5------| --| -|-------------------------------------------| - -Notes: - All IC's shown. - - ROM - VTech LH5S8R14, labeled "1998 27-6020-02" (dumped as 1Mx8) - Z80 - Z80 family SOC? - RAM - LG Semicon GM76C256CLLFW55 32Kx8 Static RAM - 04010 - ? - CN1 - Centronics connector - CN2 - mouse connector - CN3 - LCD ribbon cable - CN4 - expansion connector - CN5 - keyboard ribbon cable - CN6 - speaker wire - CN7 - volume wire - CN8 - ? wire - CN9 - power wire - CN10 - NVRAM battery wire -*/ - -/* - - Undumped cartridges: - - 80-1410 Super Science - 80-1533 Famous Things & Places - 80-0989 Bible Knowledge - 80-1001 Fantasy Trivia - 80-1002 General Knowledge II - 80-1003 Sports History - 80-2314 Familiar Faces - 80-2315 Historical Happenings - 80-2333 Arts, Entertainment & More - 80-2334 Customs & Cultures - 80-1531 32K RAM Memory Expansion Cartridge - 80-12051 Space Scholar - 80-12053 Frenzy of Facts - 80-12052 Spreadsheet Success - -*/ - -/* - - TODO: - - - identify unknown chips (maybe related to the sound??) - - better IRQ timing - - the mouse is too slow and sometime freezes - - finish to decode the memory banking - - sound - - cartridges - -*/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "rendlay.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class prestige_state : public driver_device -{ -public: - prestige_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_cart(*this, "cartslot"), - m_keyboard(*this, "KEY"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_bank5(*this, "bank5") - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_cart; - required_ioport_array<16> m_keyboard; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_memory_bank m_bank5; - - UINT8 m_bank[7]; - UINT8 m_kb_matrix; - UINT8 m_irq_counter; - UINT8 m_mousex; - UINT8 m_mousey; - UINT8 *m_vram; - struct - { - UINT16 addr1; - UINT16 addr2; - UINT8 lcd_w; - UINT8 lcd_h; - UINT8 fb_width; - UINT8 split_pos; - } m_lcdc; - - virtual void machine_start(); - UINT32 screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_1bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_2bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - memory_region *m_cart_rom; - - DECLARE_READ8_MEMBER( bankswitch_r ); - DECLARE_WRITE8_MEMBER( bankswitch_w ); - DECLARE_READ8_MEMBER( kb_r ); - DECLARE_WRITE8_MEMBER( kb_w ); - DECLARE_READ8_MEMBER( mouse_r ); - DECLARE_WRITE8_MEMBER( mouse_w ); - DECLARE_WRITE8_MEMBER( lcdc_w ); - DECLARE_PALETTE_INIT(prestige); - DECLARE_PALETTE_INIT(glcolor); - TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); - IRQ_CALLBACK_MEMBER(prestige_int_ack); -}; - - -READ8_MEMBER( prestige_state::bankswitch_r ) -{ - return m_bank[offset]; -} - -WRITE8_MEMBER( prestige_state::bankswitch_w ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - switch (offset) - { - case 0: - m_bank1->set_entry(data & 0x3f); - break; - - case 1: - if (!(m_bank[5] & 0x01) && (m_bank[5] & 0x02) && m_cart->exists()) - m_bank2->set_entry(0x40 + (data & 0x1f)); - else - m_bank2->set_entry(data & 0x3f); - break; - - case 2: - if (!(m_bank[5] & 0x01) && (m_bank[5] & 0x04) && m_cart->exists()) - m_bank3->set_entry(0x40 + (data & 0x1f)); - else - m_bank3->set_entry(data & 0x3f); - break; - - case 3: - m_bank4->set_entry(data & 0x03); - break; - - case 4: - m_bank5->set_entry(data & 0x03); - break; - - case 5: - if (m_bank[5] == data) - break; - - if (data & 0x20) - { - program.install_ram(0x8000, 0xbfff, m_vram); - } - else if (ioport("CART_TYPE")->read() == 0x01) - { - //cartridge memory is writable - if (data & 0x02) - program.install_readwrite_bank(0x4000, 0x7fff, "bank2"); - else - program.unmap_write(0x4000, 0x7fff); - - if (data & 0x04) - program.install_readwrite_bank(0x8000, 0xbfff, "bank3"); - else - program.unmap_write(0x8000, 0xbfff); - } - else - { - //cartridge memory is read-only - program.unmap_write(0x4000, 0xbfff); - program.install_read_bank(0x8000, 0xbfff, "bank3"); - } - break; - case 6: - break; - } - - m_bank[offset] = data; -} - -READ8_MEMBER( prestige_state::kb_r ) -{ - UINT8 data = 0xff; - - for (int line=0; line<8; line++) - if (!(m_kb_matrix & (1<read(); - - return data; -} - -WRITE8_MEMBER( prestige_state::kb_w ) -{ - m_kb_matrix = data; -} - -READ8_MEMBER( prestige_state::mouse_r ) -{ - INT16 data = 0; - - switch( offset ) - { - case 0: //x-axis - data = (ioport("MOUSEX")->read() - m_mousex); - break; - case 1: //y-axis - data = (ioport("MOUSEY")->read() - m_mousey); - break; - } - - data = MIN(data, +127); - data = MAX(data, -127); - - return 0x80 + data; -} - -WRITE8_MEMBER( prestige_state::mouse_w ) -{ - switch( offset ) - { - case 0: //x-axis - m_mousex = ioport("MOUSEX")->read(); - break; - case 1: //y-axis - m_mousey = ioport("MOUSEY")->read(); - break; - } -} - -WRITE8_MEMBER( prestige_state::lcdc_w ) -{ - switch(offset) - { - case 0x02: - m_lcdc.lcd_w = data; - break; - case 0x04: - m_lcdc.lcd_h = data; - break; - case 0x06: - m_lcdc.addr1 = (m_lcdc.addr1 & 0xff00) | data; - break; - case 0x07: - m_lcdc.addr1 = (m_lcdc.addr1 & 0x00ff) | (data << 8); - break; - case 0x08: - m_lcdc.addr2 = (m_lcdc.addr2 & 0xff00) | data; - break; - case 0x09: - m_lcdc.addr2 = (m_lcdc.addr2 & 0x00ff) | (data << 8); - break; - case 0x0a: - m_lcdc.split_pos = data; - break; - case 0x0d: - m_lcdc.fb_width = data; - break; - default: - logerror("Unknown LCDC reg write %x = %x\n", offset, data); - } -} - - -static ADDRESS_MAP_START(prestige_mem, AS_PROGRAM, 8, prestige_state) - AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank3") - AM_RANGE(0xc000, 0xdfff) AM_RAMBANK("bank4") - AM_RANGE(0xe000, 0xffff) AM_RAMBANK("bank5") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( prestige_io , AS_IO, 8, prestige_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x04, 0x05) AM_READWRITE(mouse_r, mouse_w) - AM_RANGE(0x30, 0x3f) AM_WRITE(lcdc_w) - AM_RANGE(0x40, 0x40) AM_WRITE(kb_w) - AM_RANGE(0x41, 0x42) AM_READ(kb_r) - AM_RANGE(0x50, 0x56) AM_READWRITE(bankswitch_r, bankswitch_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( glcolor_io , AS_IO, 8, prestige_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x30, 0x3f) AM_WRITE(lcdc_w) - AM_RANGE(0x40, 0x40) AM_WRITE(kb_w) - AM_RANGE(0x41, 0x42) AM_READ(kb_r) - AM_RANGE(0x50, 0x56) AM_READWRITE(bankswitch_r, bankswitch_w) -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( prestige ) - PORT_START("CART_TYPE") - PORT_CONFNAME( 0x01, 0x00, "Cartridge Type" ) - PORT_CONFSETTING( 0x00, "ROM" ) - PORT_CONFSETTING( 0x01, "RAM" ) - - PORT_START("MOUSEX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(2) - - PORT_START("MOUSEY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(2) - - PORT_START("KEY.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xca\xbb") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - - PORT_START("KEY.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - - PORT_START("KEY.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Up (KB)") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - - PORT_START("KEY.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Left (KB)") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc2\xa1") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - - PORT_START("KEY.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Right (KB)") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) - - PORT_START("KEY.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Down (KB)") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb1") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_PGUP) - - PORT_START("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Symbol") PORT_CODE(KEYCODE_PGDN) - - PORT_START("KEY.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Answer") PORT_CODE(KEYCODE_END) - - PORT_START("KEY.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Word Games") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Player") PORT_CODE(KEYCODE_F2) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mathematics") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Level") PORT_CODE(KEYCODE_F4) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.10") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Trivia") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cartridge") PORT_CODE(KEYCODE_F6) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.11") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Logic Games") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Business Basics") PORT_CODE(KEYCODE_F8) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.12") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.13") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.14") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left mouse button (KB)") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KEY.15") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right mouse button (KB)") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) - -INPUT_PORTS_END - -INPUT_PORTS_START( glcolor ) - PORT_START("CART_TYPE") - PORT_CONFNAME( 0x01, 0x00, "Cartridge Type" ) - PORT_CONFSETTING( 0x00, "ROM" ) - PORT_CONFSETTING( 0x01, "RAM" ) - - PORT_START("KEY.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - - PORT_START("KEY.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("Help") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00df) PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - - PORT_START("KEY.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("KEY.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("KEY.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("Spieler 1") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("KEY.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("Spielers") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("Stufe") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("Symbols") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - - PORT_START("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Button 1") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("Button 2") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Button 3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Button 4") - - PORT_START("KEY.7") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) - - PORT_START("KEY.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Backspace") PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) - - PORT_START("KEY.9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) - - PORT_START("KEY.10") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) - - PORT_START("KEY.11") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN) - - PORT_START("KEY.12") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("Spieler 2") - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) - - PORT_START("KEY.13") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN) - - PORT_START("KEY.14") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) - - PORT_START("KEY.15") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) - -INPUT_PORTS_END - -INPUT_PORTS_START( glmcolor ) - PORT_INCLUDE(glcolor) - - PORT_MODIFY("KEY.14") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 2") - - PORT_START("MOUSEX") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) - - PORT_START("MOUSEY") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) -INPUT_PORTS_END - - -IRQ_CALLBACK_MEMBER(prestige_state::prestige_int_ack) -{ - UINT32 vector; - - m_maincpu->set_input_line(0, CLEAR_LINE); - - if (m_irq_counter == 0x04) - { - m_irq_counter = 0; - vector = 0x0020; - } - else - { - m_irq_counter++; - vector = 0x0030; - } - - return (0xcd<<16) | vector; -} - -void prestige_state::machine_start() -{ - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - UINT8 *rom = memregion("maincpu")->base(); - UINT8 *cart = m_cart_rom->base(); - UINT8 *ram = m_ram->pointer(); - memset(ram, 0x00, m_ram->size()); - - m_bank1->configure_entries(0, 64, rom, 0x4000); - m_bank1->configure_entries(64,32, cart, 0x4000); - m_bank2->configure_entries(0, 64, rom, 0x4000); - m_bank2->configure_entries(64,32, cart, 0x4000); - m_bank3->configure_entries(0, 64, rom, 0x4000); - m_bank3->configure_entries(64,32, cart, 0x4000); - m_bank4->configure_entries(0, 4, ram, 0x2000); - m_bank5->configure_entries(0, 4, ram, 0x2000); - - m_bank1->set_entry(0); - m_bank2->set_entry(0); - m_bank3->set_entry(0); - m_bank4->set_entry(0); - m_bank5->set_entry(0); - - //pointer to the videoram - m_vram = ram; -} - -PALETTE_INIT_MEMBER(prestige_state, prestige) -{ - palette.set_pen_color(0, rgb_t(39, 108, 51)); - palette.set_pen_color(1, rgb_t(16, 37, 84)); -} - -PALETTE_INIT_MEMBER(prestige_state, glcolor) -{ - palette.set_pen_color(0, rgb_t(0x3f,0xbf,0x3f)); - palette.set_pen_color(1, rgb_t(0xff,0x3f,0x5f)); - palette.set_pen_color(2, rgb_t(0x1f,0x1f,0x3f)); - palette.set_pen_color(3, rgb_t(0xff,0xdf,0x1f)); -} - -UINT32 prestige_state::screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int width = m_lcdc.fb_width + m_lcdc.lcd_w + 1; - - for (int y = 0; y <= m_lcdc.lcd_h; y++) - { - int line_start; - if (y <= m_lcdc.split_pos) - line_start = m_lcdc.addr1 + y * width; - else - line_start = m_lcdc.addr2 + (y - m_lcdc.split_pos - 1) * width; - - for (int sx = 0; sx <= m_lcdc.lcd_w; sx++) - { - UINT8 data = m_vram[(line_start + sx) & 0x1fff]; - - for (int x = 0; x < 8 / bpp; x++) - { - int pix = 0; - for (int b=0; bset_input_line(0, ASSERT_LINE); -} - -static MACHINE_CONFIG_START( prestige_base, prestige_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz) // Z84C008 - MCFG_CPU_PROGRAM_MAP(prestige_mem) - MCFG_CPU_IO_MAP(prestige_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(prestige_state,prestige_int_ack) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", prestige_state, irq_timer, attotime::from_msec(10)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(prestige_state, screen_update_1bpp) - MCFG_SCREEN_SIZE( 240, 100 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 240-1, 0, 100-1 ) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT( layout_lcd ) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(prestige_state, prestige) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "genius_cart") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("64K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( glcolor, prestige_base ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(glcolor_io) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(prestige_state, screen_update_2bpp) - MCFG_SCREEN_SIZE( 160, 80 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 160-1, 0, 80-1 ) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(4) - MCFG_PALETTE_INIT_OWNER(prestige_state, glcolor) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "glcolor") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( glmcolor, glcolor ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(prestige_io) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( prestige, prestige_base ) - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl6000sl_cart", "gl6000sl") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( gl6000sl, prestige_base ) - MCFG_SOFTWARE_LIST_ADD("cart_list", "gl6000sl") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( gl7007sl, prestige_base ) - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl6000sl_cart", "gl6000sl") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( gjmovie, prestige_base ) - MCFG_SOFTWARE_LIST_ADD("cart_list", "gjmovie") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( gl6000sl ) - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD( "27-5894-01", 0x000000, 0x080000, CRC(7336231c) SHA1(35a1f739994b5c8fb67a7f76d423e50d8154e9ea) ) -ROM_END - -ROM_START( gl7007sl ) - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD( "27-6060-00", 0x000000, 0x100000, CRC(06b2a595) SHA1(654d00e55ee43627ff947d72676c8e48e0518123) ) -ROM_END - -ROM_START( prestige ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-6020-02.u2", 0x00000, 0x100000, CRC(6bb6db14) SHA1(5d51fc3fd799e7f01ee99c453f9005fb07747b1e) ) -ROM_END - -ROM_START( gwnf ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-6372-00.bin", 0x00000, 0x100000, CRC(1bb574bd) SHA1(04234a33405782e8641883ebd6dee46a24e014d5) ) -ROM_END - -ROM_START( glcolor ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-5488-00.u5", 0x00000, 0x080000, CRC(e6cf7702) SHA1(ce40418a7777b331bf8c4c881d51732aeb384582) ) -ROM_END - -ROM_START( glscolor ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-5488-00.u5", 0x00000, 0x080000, CRC(e6cf7702) SHA1(ce40418a7777b331bf8c4c881d51732aeb384582) ) // identical to 'Genius Leader Color' -ROM_END - -ROM_START( glmcolor ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-5673-00.u6", 0x00000, 0x100000, CRC(c4245392) SHA1(bb651aaf11b75f4155c0a0106de9394018110cc7) ) -ROM_END - -ROM_START( gj4000 ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-05886-000-000.u4", 0x000000, 0x40000, CRC(5f6db95b) SHA1(fe683154e33a82ea38696096616d11e850e0c7a3)) -ROM_END - -ROM_START( gj5000 ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-6019-01.u2", 0x000000, 0x80000, CRC(946e5b7d) SHA1(80963d6ad80d49e54c8996bfc77ac135c4935be5)) -ROM_END - -ROM_START( gjmovie ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "lh532hlk.bin", 0x000000, 0x40000, CRC(2e64c296) SHA1(604034f902e20851cb9af60964031a508ceef83e)) -ROM_END - -ROM_START( gjrstar ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-5740-00.u1", 0x000000, 0x40000, CRC(ff3dc3bb) SHA1(bc16dfc1e12b0008456c700c431c8df6263b671f)) -ROM_END - -ROM_START( gjrstar2 ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "27-5740-00.u1", 0x000000, 0x40000, CRC(ff3dc3bb) SHA1(bc16dfc1e12b0008456c700c431c8df6263b671f)) // identical to 'Genius Junior Redstar' -ROM_END - -ROM_START( gjrstar3 ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "54-06056-000-000.u3", 0x000000, 0x040000, CRC(72522179) SHA1(ede9491713ad018012cf925a519bcafe126f1ad3)) -ROM_END - -ROM_START( gl6600cx ) - ROM_REGION( 0x200000, "maincpu", 0 ) - ROM_LOAD( "54-06400-00.u1", 0x000000, 0x200000, CRC(b05cd075) SHA1(b1d9eb02ca56350eb9e89518db89c0a2a845ebd8)) -ROM_END - -ROM_START( gkidabc ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD("27-5730-00.bin", 0x00000, 0x20000, CRC(64664708) SHA1(74212c2dec1caa41dbc933b50f857904a8ac623b)) -ROM_END - -ROM_START( cars2lap ) - ROM_REGION( 0x200000, "maincpu", 0 ) - ROM_LOAD("n25s16.u6", 0x00000, 0x200000, CRC(ec1ba96e) SHA1(51b8844ae77adf20f74f268d380d268c9ce19785)) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1994, glcolor, 0, 0, glcolor, glcolor, driver_device, 0, "VTech", "Genius Leader Color (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1994, glscolor, glcolor, 0, glcolor, glcolor, driver_device, 0, "VTech", "Genius Leader Super Color (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1996, glmcolor, 0, 0, glmcolor, glmcolor, driver_device, 0, "VTech", "Genius Leader Magic Color (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1997, gl6000sl, 0, 0, gl6000sl, prestige, driver_device, 0, "VTech", "Genius Leader 6000SL (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1998, gl7007sl, 0, 0, gl7007sl, prestige, driver_device, 0, "VTech", "Genius Leader 7007SL (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1998, prestige, 0, 0, prestige, prestige, driver_device, 0, "VTech", "PreComputer Prestige Elite", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1999, gwnf, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Winner Notebook Fun (Germany)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) - - -// these systems need to be moved into a separate driver -COMP( 1996, gj4000, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior 4000 (Germany)", MACHINE_IS_SKELETON) -COMP( 1996, gkidabc, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius KID ABC Fan (Germany)", MACHINE_IS_SKELETON) -COMP( 1993, gjmovie, 0, 0, gjmovie, prestige, driver_device, 0, "VTech", "Genius Junior Movie (Germany)", MACHINE_IS_SKELETON) -COMP( 1996, gjrstar, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior Redstar(Germany)", MACHINE_IS_SKELETON) -COMP( 1996, gjrstar2, gjrstar, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior Redstar 2 (Germany)", MACHINE_IS_SKELETON) -COMP( 1998, gjrstar3, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior Redstar 3 (Germany)", MACHINE_IS_SKELETON) -COMP( 1998, gj5000, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Junior 5000 (Germany)", MACHINE_IS_SKELETON) -COMP( 2012, cars2lap, 0, 0, prestige, prestige, driver_device, 0, "VTech", "CARS 2 Laptop (Germany)", MACHINE_IS_SKELETON) - - -// gl6600cx use a NSC1028 system-on-a-chip designed by National Semiconductor specifically for VTech -// http://web.archive.org/web/19991127134657/http://www.national.com/news/item/0,1735,425,00.html -COMP( 1999, gl6600cx, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Leader 6600CX (Germany)", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/primo.c b/src/mess/drivers/primo.c deleted file mode 100644 index 65e40039316..00000000000 --- a/src/mess/drivers/primo.c +++ /dev/null @@ -1,382 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/******************************************************************************* - -Primo driver by Krzysztof Strzecha - -What's new: ------------ -2009.07.19 - Removed hacked and duplicated ROMs (Krzysztof Strzecha) -2008.08.31 - Added new ROMs including B32 and B48 [Miodrag Milanovic] -2005.05.19 - Primo B-32 and B-48 testdrivers added. -2005.05.15 - EPROM+RAM expansion. - Support for .pp files improved. - Some cleanups. -2005.05.12 - Memory fixed for A-48 model what make it fully working. - Fixed address of second video memory area. - -To do: - 1. Disk - 2. V.24 / tape control - 3. CDOS autoboot - 4. Joystick - 5. Printer - 6. .PRI format - -Primo variants: - A-32 - 16kB RAM + 16KB ROM - A-48 - 32kB RAM + 16KB ROM - A-64 - 48kB RAM + 16KB ROM - B-32 - 16kB RAM + 16KB ROM - B-48 - 32kB RAM + 16KB ROM - B-64 - 48kB RAM + 16KB ROM - -CPU: - U880D (DDR clone of Z80), 2.5 MHz - -Memory map: - A-32, B-32 - 0000-3fff ROM - 4000-7fff RAM - 8000-bfff not mapped - c000-ffff not mapped - - A-48, B-48 - 0000-3fff ROM - 4000-7fff RAM - 8000-bfff RAM - c000-ffff not mapped - - A-64, B-64 - 0000-3fff ROM - 4000-7fff RAM - 8000-bfff RAM - c000-ffff RAM - -I/O Ports: - Write: - 00h-3fh - bit 7 - NMI - 0 - disable - 1 - enable - bit 6 - joystick register shift - bit 5 - V.24 (2) / tape control - bit 4 - speaker - bit 3 - display page - 0 - secondary - 1 - primary - bit 2 - V.24 (1) / tape control - bit 1 - cassette output - bit 0 / - 00 - -110mV - 01 - 0V - 10 - 0V - 11 - 110mV - 40h-ffh (B models only) - bit 7 - not used - bit 6 - not used - bit 5 - SCLK - bit 4 - SDATA - bit 3 - not used - bit 2 - SRQ - bit 1 - ATN - bit 0 - not used - Read: - 00h-3fh - bit 7 - not used - bit 6 - not used - bit 5 - VBLANK - bit 4 - I4 - bit 3 - I3 - bit 2 - cassette input - bit 1 - reset - bit 0 - keyboard input - 40h-ffh (B models only) - bit 7 - not used - bit 6 - not used - bit 5 - SCLK - bit 4 - SDATA - bit 3 - SRQ - bit 2 - joystick 2 - bit 1 - ATN - bit 0 - joystick 1 - -Interrupts: - NMI - 20ms (50HZ), can be disbled/enabled by I/O write - -*******************************************************************************/ - -#include "emu.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "includes/primo.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "formats/primoptp.h" -#include "bus/cbmiec/cbmiec.h" - -static ADDRESS_MAP_START( primoa_port, AS_IO, 8, primo_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x00, 0x3f ) AM_READWRITE(primo_be_1_r, primo_ki_1_w ) - AM_RANGE( 0xfd, 0xfd ) AM_WRITE(primo_FD_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( primob_port, AS_IO, 8, primo_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x00, 0x3f ) AM_READWRITE(primo_be_1_r, primo_ki_1_w ) - AM_RANGE( 0x40, 0x7f ) AM_READWRITE(primo_be_2_r, primo_ki_2_w ) - AM_RANGE( 0xfd, 0xfd ) AM_WRITE(primo_FD_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( primo32_mem, AS_PROGRAM, 8, primo_state ) - AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x4000, 0x7fff ) AM_RAM AM_MIRROR ( 0x8000 ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( primo48_mem, AS_PROGRAM, 8, primo_state ) - AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x4000, 0x7fff ) AM_RAM - AM_RANGE( 0x8000, 0xbfff ) AM_RAM AM_MIRROR ( 0x4000 ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( primo64_mem, AS_PROGRAM, 8, primo_state ) - AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x4000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static INPUT_PORTS_START( primo ) - PORT_START( "IN0" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UPPER") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTR") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START( "IN1" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - - PORT_START( "IN2" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR('>') PORT_CHAR('<') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('|') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - - PORT_START( "IN3" ) - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("?") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('\'') - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA3") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CLS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x80\x9A") PORT_CODE(KEYCODE_COLON) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA2") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA0") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x80\x9D") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BRK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START( "RESET" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "CPU_CLOCK" ) - PORT_CONFNAME(0x01, 0x00, "CPU clock" ) - PORT_CONFSETTING( 0x00, "2.50 MHz" ) - PORT_CONFSETTING( 0x01, "3.75 MHz" ) - - PORT_START( "MEMORY_EXPANSION" ) - PORT_CONFNAME(0x01, 0x00, "EPROM+RAM Expansion" ) - PORT_CONFSETTING( 0x00, DEF_STR( On ) ) - PORT_CONFSETTING( 0x01, DEF_STR( Off ) ) -INPUT_PORTS_END - -static const struct CassetteOptions primo_cassette_options = { - 1, /* channels */ - 16, /* bits per sample */ - 22050 /* sample frequency */ -}; - -static MACHINE_CONFIG_START( primoa32, primo_state ) - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", Z80, 2500000 ) - MCFG_CPU_PROGRAM_MAP( primo32_mem) - MCFG_CPU_IO_MAP( primoa_port) - MCFG_CPU_VBLANK_INT_DRIVER("screen", primo_state, primo_vblank_interrupt) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE( 50 ) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE( 256, 192 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 256-1, 0, 192-1 ) - MCFG_SCREEN_UPDATE_DRIVER(primo_state, screen_update_primo) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* snapshot/quickload */ - MCFG_SNAPSHOT_ADD("snapshot", primo_state, primo, "pss", 0) - MCFG_QUICKLOAD_ADD("quickload", primo_state, primo, "pp", 0) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(primo_ptp_format) - MCFG_CASSETTE_CREATE_OPTS(&primo_cassette_options) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) - - /* floppy from serial bus */ - MCFG_CBM_IEC_ADD(NULL) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_plain_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_plain_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( primoa48, primoa32 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(primo48_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( primoa64, primoa32 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(primo64_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( primob32, primoa32 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(primob_port) - - MCFG_MACHINE_RESET_OVERRIDE(primo_state, primob) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( primob48, primoa48 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(primob_port) - - MCFG_MACHINE_RESET_OVERRIDE(primo_state, primob) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( primob64, primoa64 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(primob_port) - - MCFG_MACHINE_RESET_OVERRIDE(primo_state, primob) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( primoc64, primoa64 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(primob_port) - - MCFG_MACHINE_RESET_OVERRIDE(primo_state, primob) -MACHINE_CONFIG_END - -ROM_START( primoa32 ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "a32_1.rom", 0x10000, 0x1000, CRC(4e91c1a4) SHA1(bf6e41b6b36a2556a50065e9acfd8cd57968f039) ) - ROM_LOAD( "a32_2.rom", 0x11000, 0x1000, CRC(81a8a0fb) SHA1(df75bd7774969cabb062e50da6004f2efbde489e) ) - ROM_LOAD( "a32_3.rom", 0x12000, 0x1000, CRC(a97de2f5) SHA1(743c76121f5b9e1eab35c8c00797311f58da5243) ) - ROM_LOAD( "a32_4.rom", 0x13000, 0x1000, CRC(70f84bc8) SHA1(9ae1c06531edf20c14ba47e78c0747dd2a92612a) ) -ROM_END - -ROM_START( primoa48 ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "a48_1.rom", 0x10000, 0x1000, CRC(7de6ad6f) SHA1(f2fd6fac4f9bc57c646efe40281758bb7c3f56e1) ) - ROM_LOAD( "a48_2.rom", 0x11000, 0x1000, CRC(81a8a0fb) SHA1(df75bd7774969cabb062e50da6004f2efbde489e) ) - ROM_LOAD( "a48_3.rom", 0x12000, 0x1000, CRC(a97de2f5) SHA1(743c76121f5b9e1eab35c8c00797311f58da5243) ) - ROM_LOAD( "a48_4.rom", 0x13000, 0x1000, CRC(e4d0c452) SHA1(4a98ff7502f1236445250d6b4e1c34850734350e) ) -ROM_END - -ROM_START( primoa64 ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "ver1", "ver 1") - ROM_LOAD( "a64_1.rom", 0x10000, 0x1000, CRC(6a7a9b9b) SHA1(e9ce16f90d9a799a26a9cef09d9ee6a6d7749484) ) - ROM_LOAD( "a64_2.rom", 0x11000, 0x1000, CRC(81a8a0fb) SHA1(df75bd7774969cabb062e50da6004f2efbde489e) ) - ROM_LOAD( "a64_3.rom", 0x12000, 0x1000, CRC(a97de2f5) SHA1(743c76121f5b9e1eab35c8c00797311f58da5243) ) - ROM_LOAD( "a64_4.rom", 0x13000, 0x1000, CRC(e4d0c452) SHA1(4a98ff7502f1236445250d6b4e1c34850734350e) ) -ROM_END - -ROM_START( primob32 ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "b32.rom", 0x10000, 0x4000, CRC(f594d2bb) SHA1(b74961dba008a1a6f15a22ddbd1b89acd7e286c2) ) -ROM_END - -ROM_START( primob48 ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "b48.rom", 0x10000, 0x4000, CRC(df3d2a57) SHA1(ab9413aa9d7749d30a486da00bc8c6d178a2172c) ) -ROM_END - -ROM_START( primob64 ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "standart", "Standart") - ROMX_LOAD( "b64.rom", 0x10000, 0x4000, CRC(cea28188) SHA1(a77e42e97402e601b78ab3751eac1e85d0bbb4a0), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "cdos", "CDOS") - ROMX_LOAD( "b64cdos.rom", 0x10000, 0x4000, CRC(73305e4d) SHA1(c090c3430cdf19eed8363377b981e1c21a4ed169), ROM_BIOS(2) ) -ROM_END - -ROM_START( primoc64 ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "c64_1.rom", 0x10000, 0x1000, CRC(c22290ea) SHA1(af5c73f6d0f7a987c4f082a5cb69e3f016127d57) ) - ROM_LOAD( "c64_2.rom", 0x11000, 0x1000, CRC(0756b56e) SHA1(589dbdb7c43ca7ca29ed1e56e080adf8c069e407) ) - ROM_LOAD( "c64_3.rom", 0x12000, 0x1000, CRC(fc56e0af) SHA1(b547fd270d3413400bc800f5b7ea9153b7a59bff) ) - ROM_LOAD( "c64_4.rom", 0x13000, 0x1000, CRC(3770e3e6) SHA1(792cc71d8f89eb447f94aded5afc70d626a26030) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP ( 1984, primoa32, 0, 0, primoa32, primo, primo_state, primo32, "Microkey", "Primo A-32" , 0) -COMP ( 1984, primoa48, primoa32, 0, primoa48, primo, primo_state, primo48, "Microkey", "Primo A-48" , 0) -COMP ( 1984, primoa64, primoa32, 0, primoa64, primo, primo_state, primo64, "Microkey", "Primo A-64" , 0) -COMP ( 1984, primob32, primoa32, 0, primob32, primo, primo_state, primo32, "Microkey", "Primo B-32" , 0) -COMP ( 1984, primob48, primoa32, 0, primob48, primo, primo_state, primo48, "Microkey", "Primo B-48" , 0) -COMP ( 1984, primob64, primoa32, 0, primob64, primo, primo_state, primo64, "Microkey", "Primo B-64" , 0) -COMP ( 1984, primoc64, primoa32, 0, primoc64, primo, primo_state, primo64, "Microkey", "Primo C-64" , MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/pro80.c b/src/mess/drivers/pro80.c deleted file mode 100644 index 051a6da3a34..00000000000 --- a/src/mess/drivers/pro80.c +++ /dev/null @@ -1,171 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco, Robbbert -/*************************************************************************** - - Protec Pro-80 - - 06/12/2009 Skeleton driver. - - TODO: - - Cassette load/save - - Use messram for optional ram - - Fix Step command (don't works due of missing interrupt emulation) - -The unit has a PIO, ports 40-43, but it was for expansion only. - -The cassette used 2 bits for input, plus a D flipflop and a 74LS221 oneshot. - - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "pro80.lh" - -class pro80_state : public driver_device -{ -public: - pro80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cass(*this, "cassette") - { } - - required_device m_maincpu; - required_device m_cass; - void machine_reset(); - - DECLARE_WRITE8_MEMBER( digit_w ); - DECLARE_WRITE8_MEMBER( segment_w ); - DECLARE_READ8_MEMBER( kp_r ); - - UINT8 m_digit_sel; -}; - - -WRITE8_MEMBER( pro80_state::digit_w ) -{ - // --xx xxxx digit select - // -x-- ---- cassette out - // x--- ---- ??? - m_digit_sel = data & 0x3f; -} - -WRITE8_MEMBER( pro80_state::segment_w ) -{ - if (m_digit_sel) - { - if (!BIT(m_digit_sel, 0)) output_set_digit_value(0, data); - if (!BIT(m_digit_sel, 1)) output_set_digit_value(1, data); - if (!BIT(m_digit_sel, 2)) output_set_digit_value(2, data); - if (!BIT(m_digit_sel, 3)) output_set_digit_value(3, data); - if (!BIT(m_digit_sel, 4)) output_set_digit_value(4, data); - if (!BIT(m_digit_sel, 5)) output_set_digit_value(5, data); - m_cass->output( BIT(data, 6) ? -1.0 : +1.0); - - m_digit_sel = 0; - } -} - -READ8_MEMBER( pro80_state::kp_r ) -{ - UINT8 data = 0x0f; - - if (!BIT(m_digit_sel, 0)) data &= ioport("LINE0")->read(); - if (!BIT(m_digit_sel, 1)) data &= ioport("LINE1")->read(); - if (!BIT(m_digit_sel, 2)) data &= ioport("LINE2")->read(); - if (!BIT(m_digit_sel, 3)) data &= ioport("LINE3")->read(); - if (!BIT(m_digit_sel, 4)) data &= ioport("LINE4")->read(); - if (!BIT(m_digit_sel, 5)) data &= ioport("LINE5")->read(); - - // cassette-in bits go here - bit 4 = sync bit, bit 5 = data bit - return data; -} - -static ADDRESS_MAP_START( pro80_mem, AS_PROGRAM, 8, pro80_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x03ff) AM_ROM - AM_RANGE(0x1000, 0x13ff) AM_RAM - AM_RANGE(0x1400, 0x17ff) AM_RAM // 2nd RAM is optional -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pro80_io, AS_IO, 8, pro80_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - //AM_RANGE(0x40, 0x43) Z80PIO - AM_RANGE(0x44, 0x47) AM_READ(kp_r) - AM_RANGE(0x48, 0x4b) AM_WRITE(digit_w) - AM_RANGE(0x4c, 0x4f) AM_WRITE(segment_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pro80 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CR") PORT_CODE(KEYCODE_L) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CW") PORT_CODE(KEYCODE_W) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("SSt") PORT_CODE(KEYCODE_S) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Res") PORT_CODE(KEYCODE_EQUALS) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("NEx") PORT_CODE(KEYCODE_N) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("REx") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("MEx") PORT_CODE(KEYCODE_M) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("7 [IY]") PORT_CODE(KEYCODE_7) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("6 [IX]") PORT_CODE(KEYCODE_6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("5 [PC]") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("9 [H]") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("4 [SP]") PORT_CODE(KEYCODE_4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("8 [L]") PORT_CODE(KEYCODE_8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_C) -INPUT_PORTS_END - -void pro80_state::machine_reset() -{ - m_digit_sel = 0; -} - -static MACHINE_CONFIG_START( pro80, pro80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(pro80_mem) - MCFG_CPU_IO_MAP(pro80_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_pro80) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pro80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // This rom dump is taken out of manual for this machine - ROM_LOAD( "pro80.bin", 0x0000, 0x0400, CRC(1bf6e0a5) SHA1(eb45816337e08ed8c30b589fc24960dc98b94db2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, pro80, 0, 0, pro80, pro80, driver_device, 0, "Protec", "Pro-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/prof180x.c b/src/mess/drivers/prof180x.c deleted file mode 100644 index 7668ef88445..00000000000 --- a/src/mess/drivers/prof180x.c +++ /dev/null @@ -1,329 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - PROF-180X - - 07/07/2009 Skeleton driver. - -****************************************************************************/ - -/* - - TODO: - - - HD64180 CPU (DMA, MMU, SIO, etc) (Z80180 like) - - memory banking - - keyboard - - floppy - - floppy motor off timer - - floppy index callback - - RTC - -*/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "bus/centronics/ctronics.h" -#include "machine/upd765.h" -#include "includes/prof180x.h" - -UINT32 prof180x_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - -READ8_MEMBER( prof180x_state::read ) -{ - UINT8 data = 0; - - if (offset < 0x40000) - { - } - else - { - } -/* - switch ((m_mm1 << 1) | m_mm0) - { - case 0: - // bank0_r = EPROM, bank0_w = RAM, bank1 = RAM - break; - - case 1: - // bank0_r = RAM, bank0_w = RAM, bank1 = RAM - break; - - case 2: - // bank0_r = UNMAP, bank0_w = UNMAP, bank1 = RAM - break; - - case 3: - // bank0_r = RAM, bank0_w = RAM, bank1 = UNMAP - break; - } -*/ - return data; -} - -WRITE8_MEMBER( prof180x_state::write ) -{ - if (offset < 0x40000) - { - } - else - { - } -} - -void prof180x_state::ls259_w(int flag, int value) -{ - switch (flag) - { - case 0: // C0 - m_c0 = value; - break; - - case 1: // C1 - m_c1 = value; - break; - - case 2: // C2 - m_c2 = value; - break; - - case 3: // MINI - break; - - case 4: // MM0 - m_mm0 = value; - break; - - case 5: // RTC - break; - - case 6: // PEPS - break; - - case 7: // MM1 - m_mm1 = value; - break; - } -} - -WRITE8_MEMBER( prof180x_state::flr_w ) -{ - /* - - bit description - - 0 VAL - 1 FLG0 - 2 FLG1 - 3 FLG2 - 4 - 5 - 6 - 7 - - */ - - int val = BIT(data, 0); - int flg = (data >> 1) & 0x07; - - ls259_w(flg, val); -} - -READ8_MEMBER( prof180x_state::status0_r ) -{ - /* - - bit description - - 0 BUSY - 1 - 2 - 3 - 4 B-E - 5 IDX - 6 - 7 MOT - - */ - - return 0; -} - -READ8_MEMBER( prof180x_state::status1_r ) -{ - /* - - bit description - - 0 FREE - 1 - 2 - 3 - 4 J18 - 5 J19 - 6 - 7 TDO - - */ - - return 0; -} - -READ8_MEMBER( prof180x_state::status_r ) -{ - return BIT(offset, 8) ? status1_r(space, offset) : status0_r(space, offset); -} - -/* Address Maps */ - -static ADDRESS_MAP_START( prof180x_mem, AS_PROGRAM, 8, prof180x_state ) - AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( prof180x_io , AS_IO, 8, prof180x_state ) - AM_RANGE(0x08, 0x08) AM_MIRROR(0xff00) AM_WRITE(flr_w) - AM_RANGE(0x09, 0x09) AM_MASK(0xff00) AM_READ(status_r) - AM_RANGE(0x0a, 0x0a) AM_MIRROR(0xff00) AM_DEVREADWRITE(FDC9268_TAG, upd765a_device, mdma_r, mdma_w) - AM_RANGE(0x0b, 0x0b) AM_MIRROR(0xff00) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x0c, 0x0d) AM_MIRROR(0xff00) AM_DEVICE(FDC9268_TAG, upd765a_device, map) -ADDRESS_MAP_END - -/* Input ports */ - -static INPUT_PORTS_START( prof180x ) -INPUT_PORTS_END - -/* Video */ - -static SLOT_INTERFACE_START( prof180x_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -/* -static RTC8583_INTERFACE( rtc_intf ) -{ - DEVCB_CPU_INPUT_LINE(HD64180_TAG, INPUT_LINE_INT2) -}; -*/ - -void prof180x_state::machine_start() -{ - // register for state saving - save_item(NAME(m_c0)); - save_item(NAME(m_c1)); - save_item(NAME(m_c2)); - save_item(NAME(m_mm0)); - save_item(NAME(m_mm1)); -} - -void prof180x_state::machine_reset() -{ - for (int i = 0; i < 8; i++) - { - ls259_w(i, 0); - } -} - -static MACHINE_CONFIG_START( prof180x, prof180x_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(HD64180_TAG, Z80, XTAL_9_216MHz) - MCFG_CPU_PROGRAM_MAP(prof180x_mem) - MCFG_CPU_IO_MAP(prof180x_io) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(prof180x_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - - /* devices */ - MCFG_UPD765A_ADD(FDC9268_TAG, false, true) - MCFG_FLOPPY_DRIVE_ADD(FDC9268_TAG ":0", prof180x_floppies, "35dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC9268_TAG ":1", prof180x_floppies, "35dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC9268_TAG ":2", prof180x_floppies, "35dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC9268_TAG ":3", prof180x_floppies, "35dd", floppy_image_device::default_floppy_formats) - - //MCFG_RTC8583_ADD(MK3835_TAG, rtc_intf) - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("256K,512K") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("flop_list", "prof180") -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( prof180x ) - ROM_REGION( 0x10000, HD64180_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "pmon13", "pmon v1.3" ) - ROMX_LOAD( "pmon1_3.z16", 0x00000, 0x04000, CRC(32986688) SHA1(a6229d7e66ef699722ca3d41179fe3f1b75185d4), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "pmon14", "pmon v1.4" ) - ROMX_LOAD( "pmon1_4.z16", 0x00000, 0x04000, CRC(ed03f49f) SHA1(e016f9e0b89ab64c6203e2e46501d0b09f74ee9b), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "pmon15", "pmon v1.5" ) - ROMX_LOAD( "pmon1_5.z16", 0x00000, 0x04000, CRC(f43d185c) SHA1(a7a219b3d48c74602b3116cfcd34e44d6e7bc423), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "pmon", "pmon" ) - ROMX_LOAD( "pmon.z16", 0x00000, 0x04000, CRC(4f3732d7) SHA1(7dc27262db4e0c8f109470253b9364a216909f2c), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "eboot1", "eboot1" ) - ROMX_LOAD( "eboot1.z16", 0x00000, 0x08000, CRC(7a164b3c) SHA1(69367804b5cbc0633e3d7bbbcc256c2c8c9e7aca), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "eboot2", "eboot2" ) - ROMX_LOAD( "eboot2.z16", 0x00000, 0x08000, CRC(0c2d4301) SHA1(f1a4f457e287b19e14d8ccdbc0383f183d8a3efe), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS( 6, "epmon1", "epmon1" ) - ROMX_LOAD( "epmon1.z16", 0x00000, 0x10000, CRC(27aabfb4) SHA1(41adf038c474596dbf7d387a1a7f33ed86aa7869), ROM_BIOS(7) ) - ROM_SYSTEM_BIOS( 7, "epmon2", "epmon2" ) - ROMX_LOAD( "epmon2.z16", 0x00000, 0x10000, CRC(3b8a7b59) SHA1(33741f0725e3eaa21c6881c712579b3c1fd30607), ROM_BIOS(8) ) - ROM_SYSTEM_BIOS( 8, "epmon3", "epmon3" ) - ROMX_LOAD( "epmon3.z16", 0x00000, 0x10000, CRC(51313af1) SHA1(60c293171a1c7cb9a5ff6d681e61894f44fddbd1), ROM_BIOS(9) ) - - ROM_REGION( 0x157, "plds", 0 ) - ROM_LOAD( "pal14l8.z10", 0x000, 0x157, NO_DUMP ) -ROM_END - -ROM_START( prof181x ) - ROM_REGION( 0x10000, HD64180_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "pmon13", "pmon v1.3" ) - ROMX_LOAD( "pmon1_3.u13", 0x00000, 0x04000, CRC(32986688) SHA1(a6229d7e66ef699722ca3d41179fe3f1b75185d4), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "pmon14", "pmon v1.4" ) - ROMX_LOAD( "pmon1_4.u13", 0x00000, 0x04000, CRC(ed03f49f) SHA1(e016f9e0b89ab64c6203e2e46501d0b09f74ee9b), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "pmon15", "pmon v1.5" ) - ROMX_LOAD( "pmon1_5.u13", 0x00000, 0x04000, CRC(f43d185c) SHA1(a7a219b3d48c74602b3116cfcd34e44d6e7bc423), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "pmon", "pmon" ) - ROMX_LOAD( "pmon.u13", 0x00000, 0x04000, CRC(4f3732d7) SHA1(7dc27262db4e0c8f109470253b9364a216909f2c), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "eboot1", "eboot1" ) - ROMX_LOAD( "eboot1.u13", 0x00000, 0x08000, CRC(7a164b3c) SHA1(69367804b5cbc0633e3d7bbbcc256c2c8c9e7aca), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "eboot2", "eboot2" ) - ROMX_LOAD( "eboot2.u13", 0x00000, 0x08000, CRC(0c2d4301) SHA1(f1a4f457e287b19e14d8ccdbc0383f183d8a3efe), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS( 6, "epmon1", "epmon1" ) - ROMX_LOAD( "epmon1.u13", 0x00000, 0x10000, CRC(27aabfb4) SHA1(41adf038c474596dbf7d387a1a7f33ed86aa7869), ROM_BIOS(7) ) - ROM_SYSTEM_BIOS( 7, "epmon2", "epmon2" ) - ROMX_LOAD( "epmon2.u13", 0x00000, 0x10000, CRC(3b8a7b59) SHA1(33741f0725e3eaa21c6881c712579b3c1fd30607), ROM_BIOS(8) ) - ROM_SYSTEM_BIOS( 8, "epmon3", "epmon3" ) - ROMX_LOAD( "epmon3.u13", 0x00000, 0x10000, CRC(51313af1) SHA1(60c293171a1c7cb9a5ff6d681e61894f44fddbd1), ROM_BIOS(9) ) - - ROM_REGION( 0x157, "plds", 0 ) // converted from JED files - ROM_LOAD( "pal20v8.u14", 0x000, 0x157, CRC(46da52b0) SHA1(c11362223c0d5c57c6ef970e66d674b89d8e7784) ) - ROM_LOAD( "pal20v8.u15", 0x000, 0x157, CRC(19fef936) SHA1(579ad23ee3c0b1c64c584383f9c8085c6ce3d094) ) - ROM_LOAD( "pal20v8.u19", 0x000, 0x157, CRC(69348c3b) SHA1(6eb8432660eb9b639a95b1973a54dab8b99f10ef) ) - ROM_LOAD( "pal20v8.u21", 0x000, 0x157, CRC(6df4e281) SHA1(602fa4637cd9356acc31b2adfb3a084fd5a0bfcb) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, prof180x, 0, 0, prof180x, prof180x, driver_device, 0, "Conitec Datensysteme", "PROF-180X", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1992, prof181x, prof180x,0, prof180x, prof180x, driver_device, 0, "Conitec Datensysteme", "PROF-181X", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/prof80.c b/src/mess/drivers/prof80.c deleted file mode 100644 index c8e21f4d8fc..00000000000 --- a/src/mess/drivers/prof80.c +++ /dev/null @@ -1,566 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - PROF-80 (Prozessor RAM-Floppy Kontroller) - GRIP-1/2/3/4/5 (Grafik-Interface-Prozessor) - UNIO-1 (?) - - http://www.prof80.de/ - http://oldcomputers.dyndns.org/public/pub/rechner/conitec/info.html - -*/ - -/* - - TODO: - - - floppy Err on A: Select - - NE555 timeout is 10x too high - - grip31 does not work - - UNIO card (Z80-STI, Z80-SIO, 2x centronics) - - GRIP-COLOR (192kB color RAM) - - GRIP-5 (HD6345, 256KB RAM) - - XR color card - -*/ - -#include "includes/prof80.h" - - - -//************************************************************************** -// PERIPHERALS -//************************************************************************** - -//------------------------------------------------- -// motor - -//------------------------------------------------- - -void prof80_state::motor(int mon) -{ - if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(mon); - if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(mon); - - m_motor = mon; -} - - -//------------------------------------------------- -// ls259_w - -//------------------------------------------------- - -void prof80_state::ls259_w(int fa, int sa, int fb, int sb) -{ - switch (sa) - { - case 0: // C0/TDI - m_rtc->data_in_w(fa); - m_rtc->c0_w(fa); - m_c0 = fa; - break; - - case 1: // C1 - m_rtc->c1_w(fa); - m_c1 = fa; - break; - - case 2: // C2 - m_rtc->c2_w(fa); - m_c2 = fa; - break; - - case 3: // READY - if (m_ready != fa) - { - m_fdc->set_ready_line_connected(!fa); - m_fdc->ready_w(!fa); - m_ready = fa; - } - break; - - case 4: // TCK - m_rtc->clk_w(fa); - break; - - case 5: // IN USE - //m_floppy->inuse_w(fa); - break; - - case 6: // _MOTOR - if (fa) - { - // trigger floppy motor off NE555 timer - int t = 110 * RES_M(10) * CAP_U(6.8); // t = 1.1 * R8 * C6 - - timer_set(attotime::from_msec(t), TIMER_ID_MOTOR); - } - else - { - // turn on floppy motor - motor(0); - - // reset floppy motor off NE555 timer - timer_set(attotime::never, TIMER_ID_MOTOR); - } - break; - - case 7: // SELECT - if (m_select != fa) - { - //m_fdc->set_select_lines_connected(fa); - m_select = fa; - } - break; - } - - switch (sb) - { - case 0: // RESF - if (fb) m_fdc->soft_reset(); - break; - - case 1: // MINI - break; - - case 2: // _RTS - m_rs232a->write_rts(fb); - break; - - case 3: // TX - m_rs232a->write_txd(fb); - break; - - case 4: // _MSTOP - if (!fb) - { - // turn off floppy motor - motor(1); - - // reset floppy motor off NE555 timer - timer_set(attotime::never, TIMER_ID_MOTOR); - } - break; - - case 5: // TXP - m_rs232b->write_txd(fb); - break; - - case 6: // TSTB - m_rtc->stb_w(fb); - break; - - case 7: // MME - m_mmu->mme_w(fb); - break; - } -} - - -//------------------------------------------------- -// flr_w - -//------------------------------------------------- - -WRITE8_MEMBER( prof80_state::flr_w ) -{ - /* - - bit description - - 0 FB - 1 SB0 - 2 SB1 - 3 SB2 - 4 SA0 - 5 SA1 - 6 SA2 - 7 FA - - */ - - int fa = BIT(data, 7); - int sa = (data >> 4) & 0x07; - - int fb = BIT(data, 0); - int sb = (data >> 1) & 0x07; - - ls259_w(fa, sa, fb, sb); -} - - -//------------------------------------------------- -// status_r - -//------------------------------------------------- - -READ8_MEMBER( prof80_state::status_r ) -{ - /* - - bit signal description - - 0 _RX - 1 - 2 - 3 - 4 CTS - 5 _INDEX - 6 - 7 CTSP - - */ - - UINT8 data = 0; - - // serial receive - data |= !m_rs232a->rxd_r(); - - // clear to send - data |= m_rs232a->cts_r() << 4; - data |= m_rs232b->cts_r() << 7; - - // floppy index - data |= (m_floppy0->get_device() ? m_floppy0->get_device()->idx_r() : m_floppy1->get_device() ? m_floppy1->get_device()->idx_r() : 1) << 5; - - return data; -} - - -//------------------------------------------------- -// status2_r - -//------------------------------------------------- - -READ8_MEMBER( prof80_state::status2_r ) -{ - /* - - bit signal description - - 0 _MOTOR floppy motor (0=on, 1=off) - 1 - 2 - 3 - 4 JS4 - 5 JS5 - 6 - 7 _TDO - - */ - - UINT8 data = 0; - int js4 = 0, js5 = 0; - - // floppy motor - data |= m_motor; - - // JS4 - switch (m_j4->read()) - { - case 0: js4 = 0; break; - case 1: js4 = 1; break; - case 2: js4 = !m_c0; break; - case 3: js4 = !m_c1; break; - case 4: js4 = !m_c2; break; - } - - data |= js4 << 4; - - // JS5 - switch (m_j5->read()) - { - case 0: js5 = 0; break; - case 1: js5 = 1; break; - case 2: js5 = !m_c0; break; - case 3: js5 = !m_c1; break; - case 4: js5 = !m_c2; break; - } - - data |= js5 << 4; - - // RTC data - data |= !m_rtc->data_out_r() << 7; - - return data; -} - -// UNIO -/* -WRITE8_MEMBER( prof80_state::unio_ctrl_w ) -{ -// int flag = BIT(data, 0); - int flad = (data >> 1) & 0x07; - - switch (flad) - { - case 0: // CG1 - case 1: // CG2 - case 2: // _STB1 - case 3: // _STB2 - case 4: // _INIT - case 5: // JSO0 - case 6: // JSO1 - case 7: // JSO2 - break; - } -} -*/ - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( prof80_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( prof80_mem, AS_PROGRAM, 8, prof80_state ) - AM_RANGE(0x0000, 0xffff) AM_DEVICE(MMU_TAG, prof80_mmu_device, z80_program_map) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( prof80_mmu ) -//------------------------------------------------- - -static ADDRESS_MAP_START( prof80_mmu, AS_PROGRAM, 8, prof80_state ) - AM_RANGE(0x40000, 0x5ffff) AM_RAM - AM_RANGE(0xc0000, 0xdffff) AM_RAM - AM_RANGE(0xf0000, 0xf1fff) AM_MIRROR(0xe000) AM_ROM AM_REGION(Z80_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( prof80_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( prof80_io, AS_IO, 8, prof80_state ) - AM_RANGE(0x00, 0xd7) AM_MIRROR(0xff00) AM_DEVREADWRITE(ECBBUS_TAG, ecbbus_device, io_r, io_w) -// AM_RANGE(0x80, 0x8f) AM_MIRROR(0xff00) AM_DEVREADWRITE(UNIO_Z80STI_TAG, z80sti_device, read, write) -// AM_RANGE(0x94, 0x95) AM_MIRROR(0xff00) AM_DEVREADWRITE_LEGACY(UNIO_Z80SIO_TAG, z80sio_d_r, z80sio_d_w) -// AM_RANGE(0x96, 0x97) AM_MIRROR(0xff00) AM_DEVREADWRITE_LEGACY(UNIO_Z80SIO_TAG, z80sio_c_r, z80sio_c_w) -// AM_RANGE(0x9e, 0x9e) AM_MIRROR(0xff00) AM_WRITE(unio_ctrl_w) -// AM_RANGE(0x9c, 0x9c) AM_MIRROR(0xff00) AM_DEVWRITE(UNIO_CENTRONICS1_TAG, centronics_device, write) -// AM_RANGE(0x9d, 0x9d) AM_MIRROR(0xff00) AM_DEVWRITE(UNIO_CENTRONICS1_TAG, centronics_device, write) -// AM_RANGE(0xc0, 0xc0) AM_MIRROR(0xff00) AM_READ(gripc_r) -// AM_RANGE(0xc1, 0xc1) AM_MIRROR(0xff00) AM_READWRITE(gripd_r, gripd_w) - AM_RANGE(0xd8, 0xd8) AM_MIRROR(0xff00) AM_WRITE(flr_w) - AM_RANGE(0xda, 0xda) AM_MIRROR(0xff00) AM_READ(status_r) - AM_RANGE(0xdb, 0xdb) AM_MIRROR(0xff00) AM_READ(status2_r) - AM_RANGE(0xdc, 0xdd) AM_MIRROR(0xff00) AM_DEVICE(UPD765_TAG, upd765a_device, map) - AM_RANGE(0xde, 0xde) AM_MIRROR(0xff01) AM_MASK(0xff00) AM_DEVWRITE(MMU_TAG, prof80_mmu_device, par_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( prof80 ) -//------------------------------------------------- - -static INPUT_PORTS_START( prof80 ) - PORT_START("J1") - PORT_CONFNAME( 0x01, 0x00, "J1 RDY/HDLD") - PORT_CONFSETTING( 0x00, "HDLD" ) - PORT_CONFSETTING( 0x01, "READY" ) - - PORT_START("J2") - PORT_CONFNAME( 0x01, 0x01, "J2 RDY/DCHG") - PORT_CONFSETTING( 0x00, "DCHG" ) - PORT_CONFSETTING( 0x01, "READY" ) - - PORT_START("J3") - PORT_CONFNAME( 0x01, 0x00, "J3 Port Address") - PORT_CONFSETTING( 0x00, "D8-DF" ) - PORT_CONFSETTING( 0x01, "E8-EF" ) - - PORT_START("J4") - PORT_CONFNAME( 0x07, 0x00, "J4 Console") - PORT_CONFSETTING( 0x00, "GRIP-1" ) - PORT_CONFSETTING( 0x01, "V24 DUPLEX" ) - PORT_CONFSETTING( 0x02, "USER1" ) - PORT_CONFSETTING( 0x03, "USER2" ) - PORT_CONFSETTING( 0x04, "CP/M" ) - - PORT_START("J5") - PORT_CONFNAME( 0x07, 0x00, "J5 Baud") - PORT_CONFSETTING( 0x00, "9600" ) - PORT_CONFSETTING( 0x01, "4800" ) - PORT_CONFSETTING( 0x02, "2400" ) - PORT_CONFSETTING( 0x03, "1200" ) - PORT_CONFSETTING( 0x04, "300" ) - - PORT_START("J6") - PORT_CONFNAME( 0x01, 0x01, "J6 Interrupt") - PORT_CONFSETTING( 0x00, "Serial" ) - PORT_CONFSETTING( 0x01, "ECB" ) - - PORT_START("J7") - PORT_CONFNAME( 0x01, 0x01, "J7 DMA MMU") - PORT_CONFSETTING( 0x00, "PROF" ) - PORT_CONFSETTING( 0x01, "DMA Card" ) - - PORT_START("J8") - PORT_CONFNAME( 0x01, 0x01, "J8 Active Mode") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - - PORT_START("J9") - PORT_CONFNAME( 0x01, 0x00, "J9 EPROM Type") - PORT_CONFSETTING( 0x00, "2732/2764" ) - PORT_CONFSETTING( 0x01, "27128" ) - - PORT_START("J10") - PORT_CONFNAME( 0x03, 0x00, "J10 Wait States") - PORT_CONFSETTING( 0x00, "On all memory accesses" ) - PORT_CONFSETTING( 0x01, "On internal memory accesses" ) - PORT_CONFSETTING( 0x02, DEF_STR( None ) ) - - PORT_START("L1") - PORT_CONFNAME( 0x01, 0x00, "L1 Write Polarity") - PORT_CONFSETTING( 0x00, "Inverted" ) - PORT_CONFSETTING( 0x01, "Normal" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// upd765_interface fdc_intf -//------------------------------------------------- - -static SLOT_INTERFACE_START( prof80_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void prof80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_ID_MOTOR: - motor(1); - break; - } -} - - -//------------------------------------------------- -// MACHINE_START( prof80 ) -//------------------------------------------------- - -void prof80_state::machine_start() -{ - // initialize RTC - m_rtc->cs_w(1); - m_rtc->oe_w(1); - - // register for state saving - save_item(NAME(m_c0)); - save_item(NAME(m_c1)); - save_item(NAME(m_c2)); - save_item(NAME(m_motor)); - save_item(NAME(m_ready)); - save_item(NAME(m_select)); -} - - -void prof80_state::machine_reset() -{ - int i; - - for (i = 0; i < 8; i++) - { - ls259_w(0, i, 0, i); - } -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( prof80 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( prof80, prof80_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_6MHz) - MCFG_CPU_PROGRAM_MAP(prof80_mem) - MCFG_CPU_IO_MAP(prof80_io) - - // devices - MCFG_PROF80_MMU_ADD(MMU_TAG, prof80_mmu) - MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) - MCFG_UPD765A_ADD(UPD765_TAG, true, true) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", prof80_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", prof80_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", prof80_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":3", prof80_floppies, NULL, floppy_image_device::default_floppy_formats) - - // ECB bus - MCFG_ECBBUS_ADD() - MCFG_ECBBUS_SLOT_ADD(1, "ecb_1", ecbbus_cards, "grip21") - MCFG_ECBBUS_SLOT_ADD(2, "ecb_2", ecbbus_cards, NULL) - MCFG_ECBBUS_SLOT_ADD(3, "ecb_3", ecbbus_cards, NULL) - MCFG_ECBBUS_SLOT_ADD(4, "ecb_4", ecbbus_cards, NULL) - MCFG_ECBBUS_SLOT_ADD(5, "ecb_5", ecbbus_cards, NULL) - - // V24 - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "prof80") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( prof80 ) -//------------------------------------------------- - -ROM_START( prof80 ) - ROM_REGION( 0x2000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "v17" ) - ROM_SYSTEM_BIOS( 0, "v15", "v1.5" ) - ROMX_LOAD( "prof80v15.z7", 0x0000, 0x2000, CRC(8f74134c) SHA1(83f9dcdbbe1a2f50006b41d406364f4d580daa1f), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v16", "v1.6" ) - ROMX_LOAD( "prof80v16.z7", 0x0000, 0x2000, CRC(7d3927b3) SHA1(bcc15fd04dbf1d6640115be595255c7b9d2a7281), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v17", "v1.7" ) - ROMX_LOAD( "prof80v17.z7", 0x0000, 0x2000, CRC(53305ff4) SHA1(3ea209093ac5ac8a5db618a47d75b705965cdf44), ROM_BIOS(3) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1984, prof80, 0, 0, prof80, prof80, driver_device, 0, "Conitec Datensysteme", "PROF-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/psion.c b/src/mess/drivers/psion.c deleted file mode 100644 index 741df4c3585..00000000000 --- a/src/mess/drivers/psion.c +++ /dev/null @@ -1,796 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Psion Organiser II series - - Driver by Sandro Ronco - - TODO: - - dump CGROM of the HD44780 - - emulate other devices in slot C(Comms Link, printer) - - Note: - - 4 lines display has an custom LCD controller derived from an HD66780 - - NVRAM works only if the machine is turned off (with OFF menu) before closing MESS - - More info: - http://archive.psion2.org/org2/techref/index.htm - -****************************************************************************/ - - -#include "emu.h" -#include "includes/psion.h" -#include "rendlay.h" - -TIMER_DEVICE_CALLBACK_MEMBER(psion_state::nmi_timer) -{ - if (m_enable_nmi) - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -UINT8 psion_state::kb_read() -{ - static const char *const bitnames[] = {"K1", "K2", "K3", "K4", "K5", "K6", "K7"}; - UINT8 line, data = 0x7c; - - if (m_kb_counter) - { - for (line = 0; line < 7; line++) - if (m_kb_counter == (0x7f & ~(1 << line))) - data = machine().root_device().ioport(bitnames[line])->read(); - } - else - { - //Read all the input lines - for (line = 0; line < 7; line++) - data &= machine().root_device().ioport(bitnames[line])->read(); - } - - return data & 0x7c; -} - -void psion_state::update_banks() -{ - if (m_ram_bank < m_ram_bank_count && m_ram_bank_count) - membank("rambank")->set_entry(m_ram_bank); - - if (m_rom_bank < m_rom_bank_count && m_rom_bank_count) - membank("rombank")->set_entry(m_rom_bank); -} - -WRITE8_MEMBER( psion_state::hd63701_int_reg_w ) -{ - switch (offset) - { - case 0x01: - m_port2_ddr = data; - break; - case 0x03: - /* datapack i/o data bus */ - m_pack1->data_w(data & m_port2_ddr); - m_pack2->data_w(data & m_port2_ddr); - break; - case 0x08: - m_tcsr_value = data; - break; - case 0x15: - /* read-only */ - break; - case 0x16: - m_port6_ddr = data; - break; - case 0x17: - /* - datapack control lines - x--- ---- slot on/off - -x-- ---- slot 3 - --x- ---- slot 2 - ---x ---- slot 1 - ---- x--- output enable - ---- -x-- program line - ---- --x- reset line - ---- ---x clock line - */ - m_port6 = (data & m_port6_ddr) | (m_port6 & ~m_port6_ddr); - - m_pack1->control_w((m_port6 & 0x8f) | (m_port6 & 0x10)); - m_pack2->control_w((m_port6 & 0x8f) | ((m_port6 & 0x20) >> 1)); - break; - } - - m_maincpu->m6801_io_w(space, offset, data); -} - -READ8_MEMBER( psion_state::hd63701_int_reg_r ) -{ - switch (offset) - { - case 0x03: - /* datapack i/o data bus */ - return (m_pack1->data_r() | m_pack2->data_r()) & (~m_port2_ddr); - case 0x14: - return (m_maincpu->m6801_io_r(space, offset)&0x7f) | (m_stby_pwr<<7); - case 0x15: - /* - x--- ---- ON key active high - -xxx xx-- keys matrix active low - ---- --x- pulse - ---- ---x battery status - */ - return kb_read() | ioport("BATTERY")->read() | ioport("ON")->read() | (m_kb_counter == 0x7ff)<<1 | m_pulse<<1; - case 0x17: - /* datapack control lines */ - return (m_pack1->control_r() | (m_pack2->control_r() & 0x8f)) | ((m_pack2->control_r() & 0x10)<<1); - case 0x08: - m_maincpu->m6801_io_w(space, offset, m_tcsr_value); - default: - return m_maincpu->m6801_io_r(space, offset); - } -} - -/* Read/Write common */ -void psion_state::io_rw(address_space &space, UINT16 offset) -{ - if (space.debugger_access()) - return; - - switch (offset & 0xffc0) - { - case 0xc0: - /* switch off, CPU goes into standby mode */ - m_enable_nmi = 0; - m_stby_pwr = 1; - m_maincpu->suspend(SUSPEND_REASON_HALT, 1); - break; - case 0x100: - m_pulse = 1; - break; - case 0x140: - m_pulse = 0; - break; - case 0x200: - m_kb_counter = 0; - break; - case 0x180: - m_beep->set_state(1); - break; - case 0x1c0: - m_beep->set_state(0); - break; - case 0x240: - if (offset == 0x260 && (m_rom_bank_count || m_ram_bank_count)) - { - m_ram_bank=0; - m_rom_bank=0; - update_banks(); - } - else - m_kb_counter++; - break; - case 0x280: - if (offset == 0x2a0 && m_ram_bank_count) - { - m_ram_bank++; - update_banks(); - } - else - m_enable_nmi = 1; - break; - case 0x2c0: - if (offset == 0x2e0 && m_rom_bank_count) - { - m_rom_bank++; - update_banks(); - } - else - m_enable_nmi = 0; - break; - } -} - -WRITE8_MEMBER( psion_state::io_w ) -{ - switch (offset & 0x0ffc0) - { - case 0x80: - m_lcdc->write(space, offset & 0x01, data); - break; - default: - io_rw(space, offset); - } -} - -READ8_MEMBER( psion_state::io_r ) -{ - switch (offset & 0xffc0) - { - case 0x80: - return m_lcdc->read(space, offset & 0x01); - default: - io_rw(space, offset); - } - - return 0; -} - -INPUT_CHANGED_MEMBER(psion_state::psion_on) -{ - /* reset the CPU for resume from standby */ - if (m_maincpu->suspended(SUSPEND_REASON_HALT)) - m_maincpu->reset(); -} - -READ8_MEMBER( psion1_state::reset_kb_counter_r ) -{ - m_kb_counter = 0; - return 0; -} - -READ8_MEMBER( psion1_state::inc_kb_counter_r ) -{ - m_kb_counter++; - return 0; -} - -READ8_MEMBER( psion1_state::switchoff_r ) -{ - if (!m_stby_pwr) - { - m_stby_pwr = 1; - m_maincpu->reset(); - } - return 0; -} - -static ADDRESS_MAP_START(psion1_mem, AS_PROGRAM, 8, psion1_state) - AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) - AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") - AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x07fe) AM_DEVREADWRITE("hd44780", hd44780_device, control_read, control_write) - AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x07fe) AM_DEVREADWRITE("hd44780", hd44780_device, data_read, data_write) - AM_RANGE(0x2800, 0x2800) AM_READ(reset_kb_counter_r) - AM_RANGE(0x2e00, 0x2e00) AM_READ(switchoff_r) - AM_RANGE(0x3000, 0x3000) AM_READ(inc_kb_counter_r) - AM_RANGE(0x4000, 0x47ff) AM_RAM AM_SHARE("ram") - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(psioncm_mem, AS_PROGRAM, 8, psion_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) - AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") - AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) - AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(psionla_mem, AS_PROGRAM, 8, psion_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) - AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") - AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) - AM_RANGE(0x0400, 0x5fff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(psionp350_mem, AS_PROGRAM, 8, psion_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) - AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") - AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) - AM_RANGE(0x0400, 0x3fff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("rambank") - AM_RANGE(0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(psionlam_mem, AS_PROGRAM, 8, psion_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) - AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") - AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) - AM_RANGE(0x0400, 0x7fff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("rombank") - AM_RANGE(0xc000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(psionlz_mem, AS_PROGRAM, 8, psion_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_int_reg_r, hd63701_int_reg_w) - AM_RANGE(0x0040, 0x00ff) AM_RAM AM_SHARE("sys_register") - AM_RANGE(0x0100, 0x03ff) AM_READWRITE(io_r, io_w) - AM_RANGE(0x0400, 0x3fff) AM_RAM AM_SHARE("ram") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("rambank") - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("rombank") - AM_RANGE(0xc000, 0xffff) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( psion ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) - PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x01, "Low Battery" ) - - PORT_START("ON") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/CLEAR") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, psion_state, psion_on, 0) - - PORT_START("K1") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up [CAP]") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down [NUM]") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - - PORT_START("K2") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S [;]") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M [,]") PORT_CODE(KEYCODE_M) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G [=]") PORT_CODE(KEYCODE_G) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A [<]") PORT_CODE(KEYCODE_A) - - PORT_START("K3") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T [:]") PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N [$]") PORT_CODE(KEYCODE_N) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H [\"]") PORT_CODE(KEYCODE_H) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B [>]") PORT_CODE(KEYCODE_B) - - PORT_START("K4") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y [0]") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U [1]") PORT_CODE(KEYCODE_U) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O [4]") PORT_CODE(KEYCODE_O) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I [7]") PORT_CODE(KEYCODE_I) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C [(]") PORT_CODE(KEYCODE_C) - - PORT_START("K5") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W [3]") PORT_CODE(KEYCODE_W) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q [6]") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K [9]") PORT_CODE(KEYCODE_K) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E [%]") PORT_CODE(KEYCODE_E) - - PORT_START("K6") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X [+]") PORT_CODE(KEYCODE_X) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R [-]") PORT_CODE(KEYCODE_R) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L [*]") PORT_CODE(KEYCODE_L) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F [/]") PORT_CODE(KEYCODE_F) - - PORT_START("K7") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z [.]") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V [2]") PORT_CODE(KEYCODE_V) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P [5]") PORT_CODE(KEYCODE_P) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J [8]") PORT_CODE(KEYCODE_J) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D [)]") PORT_CODE(KEYCODE_D) -INPUT_PORTS_END - -INPUT_PORTS_START( psion1 ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) - PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x01, "Low Battery" ) - - PORT_START("ON") - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/CLEAR") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, psion_state, psion_on, 0) - - PORT_START("K1") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down [NUM]") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up [CAP]") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_EQUALS) - - PORT_START("K2") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S [;]") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M [,]") PORT_CODE(KEYCODE_M) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G [=]") PORT_CODE(KEYCODE_G) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A [<]") PORT_CODE(KEYCODE_A) - - PORT_START("K3") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y [0]") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T [:]") PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N [$]") PORT_CODE(KEYCODE_N) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H [\"]") PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B [>]") PORT_CODE(KEYCODE_B) - - PORT_START("K4") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z [.]") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U [1]") PORT_CODE(KEYCODE_U) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O [4]") PORT_CODE(KEYCODE_O) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I [7]") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C [(]") PORT_CODE(KEYCODE_C) - - PORT_START("K5") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W [3]") PORT_CODE(KEYCODE_W) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q [6]") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K [9]") PORT_CODE(KEYCODE_K) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E [%]") PORT_CODE(KEYCODE_E) - - PORT_START("K6") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X [+]") PORT_CODE(KEYCODE_X) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R [-]") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L [*]") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F [/]") PORT_CODE(KEYCODE_F) - - PORT_START("K7") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V [2]") PORT_CODE(KEYCODE_V) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P [5]") PORT_CODE(KEYCODE_P) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J [8]") PORT_CODE(KEYCODE_J) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D [)]") PORT_CODE(KEYCODE_D) -INPUT_PORTS_END - - -void psion_state::nvram_init(nvram_device &nvram, void *data, size_t size) -{ - //cold start (by default is 1=warm start) - m_stby_pwr = 0; -} - - -void psion_state::machine_start() -{ - if (!strcmp(machine().system().name, "psionlam")) - { - m_rom_bank_count = 3; - m_ram_bank_count = 0; - } - else if (!strncmp(machine().system().name, "psionlz", 7)) - { - m_rom_bank_count = 3; - m_ram_bank_count = 3; - } - else if (!strcmp(machine().system().name, "psionp464")) - { - m_rom_bank_count = 3; - m_ram_bank_count = 9; - } - else if (!strncmp(machine().system().name, "psionp", 6)) - { - m_rom_bank_count = 0; - m_ram_bank_count = 5; - } - else - { - m_rom_bank_count = 0; - m_ram_bank_count = 0; - } - - if (m_rom_bank_count) - { - UINT8* rom_base = (UINT8 *)memregion("maincpu")->base(); - - membank("rombank")->configure_entry(0, rom_base + 0x8000); - membank("rombank")->configure_entries(1, m_rom_bank_count-1, rom_base + 0x10000, 0x4000); - membank("rombank")->set_entry(0); - } - - if (m_ram_bank_count) - { - m_paged_ram = auto_alloc_array(machine(), UINT8, m_ram_bank_count * 0x4000); - memset(m_paged_ram, 0, sizeof(UINT8) * (m_ram_bank_count * 0x4000)); - membank("rambank")->configure_entries(0, m_ram_bank_count, m_paged_ram, 0x4000); - membank("rambank")->set_entry(0); - } - - m_nvram1->set_base(m_sys_register, 0xc0); - m_nvram2->set_base(m_ram, m_ram.bytes()); - if (m_nvram3) - m_nvram3->set_base(m_paged_ram, m_ram_bank_count * 0x4000); - - save_item(NAME(m_kb_counter)); - save_item(NAME(m_enable_nmi)); - save_item(NAME(m_tcsr_value)); - save_item(NAME(m_stby_pwr)); - save_item(NAME(m_pulse)); - save_item(NAME(m_rom_bank)); - save_item(NAME(m_ram_bank)); - save_item(NAME(m_port2_ddr)); - save_item(NAME(m_port2)); - save_item(NAME(m_port6_ddr)); - save_item(NAME(m_port6)); - save_pointer(NAME(m_paged_ram), m_ram_bank_count * 0x4000); -} - -void psion_state::machine_reset() -{ - m_enable_nmi=0; - m_kb_counter=0; - m_ram_bank=0; - m_rom_bank=0; - m_pulse=0; - - if (m_rom_bank_count || m_ram_bank_count) - update_banks(); -} - -void psion1_state::machine_reset() -{ - psion_state::machine_reset(); - m_enable_nmi = 1; -} - -HD44780_PIXEL_UPDATE(psion_state::lz_pixel_update) -{ - if (pos < 40) - { - static const UINT8 psion_display_layout[] = - { - 0x00, 0x01, 0x02, 0x03, 0x28, 0x29, 0x2a, 0x2b, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, - 0x14, 0x15, 0x16, 0x17, 0x3c, 0x3d, 0x3e, 0x3f, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x40, 0x41, 0x42, 0x43, - 0x44, 0x45, 0x46, 0x47, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f - }; - - UINT8 char_pos = psion_display_layout[line*40 + pos]; - bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; - } -} - -HD44780_PIXEL_UPDATE(psion1_state::psion1_pixel_update) -{ - if (pos < 8 && line < 2) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; -} - -PALETTE_INIT_MEMBER(psion_state, psion) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static const gfx_layout psion_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( psion ) - GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, psion_charlayout, 0, 1 ) -GFXDECODE_END - -/* basic configuration for 2 lines display */ -static MACHINE_CONFIG_START( psion_2lines, psion_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD63701, 980000) // should be HD6303 at 0.98MHz - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_SIZE(6*16, 9*2) - MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(psion_state, psion) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", psion) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 16) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram1", psion_state, nvram_init) // sys_regs - MCFG_NVRAM_ADD_0FILL("nvram2") // RAM - - MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", psion_state, nmi_timer, attotime::from_seconds(1)) - - /* Datapack */ - MCFG_PSION_DATAPACK_ADD("pack1") - MCFG_PSION_DATAPACK_ADD("pack2") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("pack_list", "psion2") -MACHINE_CONFIG_END - -/* basic configuration for 4 lines display */ -static MACHINE_CONFIG_DERIVED( psion_4lines, psion_2lines ) - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(6*20, 9*4) - MCFG_SCREEN_VISIBLE_AREA(0, 6*20-1, 0, 9*4-1) - - MCFG_DEVICE_MODIFY("hd44780") - MCFG_HD44780_LCD_SIZE(4, 20) - MCFG_HD44780_PIXEL_UPDATE_CB(psion_state::lz_pixel_update) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( psion1, psion_2lines, psion1_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(psion1_mem) - - MCFG_DEVICE_MODIFY("nmi_timer") - MCFG_TIMER_START_DELAY(attotime::from_seconds(1)) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(6*16, 1*8) - MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 8*1-1) - - MCFG_DEVICE_MODIFY("hd44780") - MCFG_HD44780_LCD_SIZE(1, 16) - MCFG_HD44780_PIXEL_UPDATE_CB(psion1_state::psion1_pixel_update) - - /* Software lists */ - MCFG_SOFTWARE_LIST_REMOVE("pack_list") - MCFG_SOFTWARE_LIST_ADD("pack_list", "psion1") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( psioncm, psion_2lines ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(psioncm_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( psionla, psion_2lines ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(psionla_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( psionlam, psion_2lines ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(psionlam_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( psionp350, psion_2lines ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(psionp350_mem) - - MCFG_NVRAM_ADD_0FILL("nvram3") // paged RAM -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( psionlz, psion_4lines ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(psionlz_mem) - - MCFG_NVRAM_ADD_0FILL("nvram3") // paged RAM -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( psion1 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v1", "Organiser I") - ROMX_LOAD( "psion1.rom", 0xf000, 0x1000, CRC(7e2609c1) SHA1(a3320ea8ac3ab9e0039ee16f7c571731adde5869), ROM_BIOS(1)) -ROM_END - -ROM_START( psioncm ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v24", "CM v2.4") - ROMX_LOAD( "24-cm.dat", 0x8000, 0x8000, CRC(f6798394) SHA1(736997f0db9a9ee50d6785636bdc3f8ff1c33c66), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v26", "CM v2.6") - ROMX_LOAD( "26-cm.rom", 0x8000, 0x8000, CRC(21b7c94c) SHA1(e0a3168c96a3f0b37b8698e86574e40597fe3c62), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v33", "CM v3.3") - ROMX_LOAD( "33-cm.rom", 0x8000, 0x8000, CRC(5c10b167) SHA1(6deea00fe648bddae1d61a22858023bc80277ea0), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v33f","CM v3.3 French") - ROMX_LOAD( "33-cmf.rom", 0x8000, 0x8000, CRC(4d626ce2) SHA1(82b96f11a0abfc1931b6022b84733d975ad7ab2b), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v36f","CM v3.6 French") - ROMX_LOAD( "36-cmf.rom", 0x8000, 0x8000, CRC(beabe0f5) SHA1(a5ef3bb92190a257cb0e94d58b2c23935436edeb), ROM_BIOS(5)) -ROM_END - -ROM_START( psionxp ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v26", "XP v2.6") - ROMX_LOAD( "26-xp.rom", 0x8000, 0x8000, CRC(a81db40f) SHA1(af72d94ccee1fa1dade8776bdbd39920665a68b7), ROM_BIOS(1) ) -ROM_END - -ROM_START( psionla ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v33", "LA v3.3") - ROMX_LOAD( "33-la.dat", 0x8000, 0x8000, CRC(02668ed4) SHA1(e5d4ee6b1cde310a2970ffcc6f29a0ce09b08c46), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v34g", "LA v3.4 German") - ROMX_LOAD( "34-lag.rom", 0x8000, 0x8000, CRC(13a92c4b) SHA1(dab8bd6a41a5fd509c5ad4b0b0ab80d14f2c421a), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v36", "LA v3.6") - ROMX_LOAD( "36-la.rom", 0x8000, 0x8000, CRC(7442c7f6) SHA1(94f15bd06bd750be70fa4a4ab588237c5a703f65), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v30", "LA v3.0") - ROMX_LOAD( "30-lahp.rom", 0x8000, 0x8000, CRC(50192528) SHA1(c556d53f70bf5ecae756b2ebfc6d954912316bbe), ROM_BIOS(4)) -ROM_END - -ROM_START( psionp200 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v33", "POS200a v3.3") - ROMX_LOAD( "33-p200a.rom", 0x8000, 0x8000, CRC(91e94998) SHA1(e9e8106eb9283d20452697859894aa407cc07bd1), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v36", "POS200 v3.6") - ROMX_LOAD( "36-p200.rom", 0x8000, 0x8000, CRC(4569ef5b) SHA1(8c275474cc6e3f50156f0b6e32121cadd14ea8be), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v36a", "POS200a v3.6") - ROMX_LOAD( "36-p200a.rom", 0x8000, 0x8000, CRC(36cceeb7) SHA1(57069812c5a16babfff91dc7d7e0842e5dc68652), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v36b", "POS250 v3.6") - ROMX_LOAD( "36-p250.rom", 0x8000, 0x8000, CRC(235cc76a) SHA1(3229cdff4b049a1fbf9a758ce3abf3fdc9b547c9), ROM_BIOS(4)) -ROM_END - -ROM_START( psionp350 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v36", "POS350 v3.6") - ROMX_LOAD( "36-p350.dat", 0x8000, 0x8000, CRC(3a371a74) SHA1(9167210b2c0c3bd196afc08ca44ab23e4e62635e), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v38", "POS350 v3.8") - ROMX_LOAD( "38-p350.dat", 0x8000, 0x8000, CRC(1b8b082f) SHA1(a3e875a59860e344f304a831148a7980f28eaa4a), ROM_BIOS(2)) -ROM_END - -ROM_START( psionlam ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v37", "LA v3.7") - ROMX_LOAD( "37-lam.dat", 0x8000, 0x10000, CRC(7ee3a1bc) SHA1(c7fbd6c8e47c9b7d5f636e9f56e911b363d6796b), ROM_BIOS(1)) -ROM_END - -ROM_START( psionlz64 ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v44", "LZ64 v4.4") - ROMX_LOAD( "44-lz64.dat", 0x8000, 0x10000, CRC(aa487913) SHA1(5a44390f63fc8c1bc94299ab2eb291bc3a5b989a), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v46si", "LZ64 v4.6 Spanish / Italian") - ROMX_LOAD( "46-lz64i.rom", 0x8000, 0x10000, CRC(c96c7e65) SHA1(1b4af43657bbd3ecd92f370762bde166047b85e2), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v43", "LZ64 v4.3") - ROMX_LOAD( "43-lz64.rom", 0x8000, 0x10000, CRC(57e7a372) SHA1(46c2da1cfe991c0c1f2486e4aa28388767937ddd), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v46a", "LZ64 v4.6a") - ROMX_LOAD( "46a-lz64.rom", 0x8000, 0x10000, CRC(9b0d5a7a) SHA1(f1cdd6ef43cd65ef18e148deca0500f0c1ad2f80), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v46b", "LZ64 v4.6b") - ROMX_LOAD( "46b-lz64.rom", 0x8000, 0x10000, CRC(8d1101e2) SHA1(eddd0c3a2881667a1485b0d66f82f8c7792995c2), ROM_BIOS(5)) - - ROM_REGION( 0x1000, "hd44780", 0 ) - ROM_LOAD( "psion_lz_charset.bin", 0x0000, 0x1000, BAD_DUMP CRC(44bff6f6) SHA1(aef544548b783d608a7d55456f6c46f421a11ed7)) -ROM_END - -ROM_START( psionlz64s ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v46", "LZ64 v4.6") - ROMX_LOAD( "46-lz64s.dat", 0x8000, 0x10000, CRC(328d9772) SHA1(7f9e2d591d59ecfb0822d7067c2fe59542ea16dd), ROM_BIOS(1)) - - ROM_REGION( 0x1000, "hd44780", 0 ) - ROM_LOAD( "psion_lz_charset.bin", 0x0000, 0x1000, BAD_DUMP CRC(44bff6f6) SHA1(aef544548b783d608a7d55456f6c46f421a11ed7)) -ROM_END - -ROM_START( psionlz ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v46", "LZ v4.6") - ROMX_LOAD( "46-lz.dat", 0x8000, 0x10000, CRC(22715f48) SHA1(cf460c81cadb53eddb7afd8dadecbe8c38ea3fc2), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v42", "LZ v4.2") - ROMX_LOAD( "42-lz.rom", 0x8000, 0x10000, CRC(f2d6ad47) SHA1(ee8315ae872463068d805c6e0b71f62ae8eb65be), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v44", "LZ v4.4") - ROMX_LOAD( "44-lz.rom", 0x8000, 0x10000, CRC(4a0a990b) SHA1(dde0ba69a4a7f02b610ad6bd69a8b8552b060223), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v45", "LZ v4.5") - ROMX_LOAD( "45-lz.rom", 0x8000, 0x10000, CRC(f95d8f39) SHA1(cb64152c2418bf730c89999d1b13c1d1ada1f082), ROM_BIOS(4)) - - ROM_REGION( 0x1000, "hd44780", 0 ) - ROM_LOAD( "psion_lz_charset.bin", 0x0000, 0x1000, BAD_DUMP CRC(44bff6f6) SHA1(aef544548b783d608a7d55456f6c46f421a11ed7)) -ROM_END - -ROM_START( psionp464 ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v46", "POS464 v4.6") - ROMX_LOAD( "46-p464.dat", 0x8000, 0x10000, CRC(672a0945) SHA1(d2a6e3fe1019d1bd7ae4725e33a0b9973f8cd7d8), ROM_BIOS(1)) - - ROM_REGION( 0x1000, "hd44780", 0 ) - ROM_LOAD( "psion_lz_charset.bin", 0x0000, 0x1000, BAD_DUMP CRC(44bff6f6) SHA1(aef544548b783d608a7d55456f6c46f421a11ed7)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, psion1, 0, 0, psion1, psion1,driver_device, 0, "Psion", "Organiser I", MACHINE_NOT_WORKING) -COMP( 1986, psioncm, 0, 0, psioncm, psion, driver_device, 0, "Psion", "Organiser II CM", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1986, psionla, psioncm, 0, psionla, psion, driver_device, 0, "Psion", "Organiser II LA", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1986, psionxp, psioncm, 0, psionla, psion, driver_device, 0, "Psion", "Organiser II XP", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1986, psionp200, psioncm, 0, psionp350, psion, driver_device, 0, "Psion", "Organiser II P200", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1986, psionp350, psioncm, 0, psionp350, psion, driver_device, 0, "Psion", "Organiser II P350", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1986, psionlam, psioncm, 0, psionlam, psion, driver_device, 0, "Psion", "Organiser II LAM", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1989, psionlz, 0, 0, psionlz, psion, driver_device, 0, "Psion", "Organiser II LZ", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1989, psionlz64, psionlz, 0, psionlz, psion, driver_device, 0, "Psion", "Organiser II LZ64", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1989, psionlz64s, psionlz, 0, psionlz, psion, driver_device, 0, "Psion", "Organiser II LZ64S", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) -COMP( 1989, psionp464, psionlz, 0, psionlz, psion, driver_device, 0, "Psion", "Organiser II P464", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) diff --git a/src/mess/drivers/psx.c b/src/mess/drivers/psx.c deleted file mode 100644 index 17f3d904a93..00000000000 --- a/src/mess/drivers/psx.c +++ /dev/null @@ -1,307 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:smf, pSXAuthor, R. Belmont -/*************************************************************************** - - Sony Playstaion - =============== - Preliminary driver by smf - Additional development by pSXAuthor and R. Belmont - -***************************************************************************/ - -#include "emu.h" -#include "cpu/psx/psx.h" -#include "cpu/m6805/m6805.h" -#include "video/psx.h" -#include "imagedev/snapquik.h" -#include "imagedev/chd_cd.h" -#include "sound/spu.h" -#include "debugger.h" -#include "machine/psxcd.h" -#include "bus/psx/ctlrport.h" - -#define PSXCD_TAG "psxcd" - -class psx1_state : public driver_device -{ -public: - psx1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_ram(*this, "maincpu:ram") - { - } - - UINT8 *m_exe_buffer; - int m_exe_size; - int m_cd_param_p; - int m_cd_result_p; - int m_cd_result_c; - int m_cd_result_ready; - int m_cd_reset; - UINT8 m_cd_stat; - UINT8 m_cd_io_status; - UINT8 m_cd_param[8]; - UINT8 m_cd_result[8]; - DECLARE_MACHINE_RESET(psx); - inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); - void cd_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); - void cd_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); - required_device m_maincpu; - required_device m_ram; -}; - - -#define VERBOSE_LEVEL ( 0 ) - -inline void ATTR_PRINTF(3,4) psx1_state::verboselog( int n_level, const char *s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%s: %s", machine().describe_context(), buf ); - } -} - - -void psx1_state::cd_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) -{ - UINT8 *psxram = (UINT8 *) p_n_psxram; - psxcd_device *psxcd = machine().device(PSXCD_TAG); - psxcd->start_dma(psxram + n_address, n_size*4); -} - -void psx1_state::cd_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) -{ - printf("cd_dma_write?!: addr %x, size %x\n", n_address, n_size); -} - -static ADDRESS_MAP_START( psx_map, AS_PROGRAM, 32, psx1_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( subcpu_map, AS_PROGRAM, 8, psx1_state ) - AM_RANGE(0x0000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( psj, psx1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", CXD8530CQ, XTAL_67_7376MHz ) - MCFG_CPU_PROGRAM_MAP( psx_map ) - - MCFG_RAM_MODIFY("maincpu:ram") - MCFG_RAM_DEFAULT_SIZE("2M") - - MCFG_DEVICE_ADD("controllers", PSXCONTROLLERPORTS, 0) - MCFG_PSX_CONTROLLER_PORTS_RXD_HANDLER(DEVWRITELINE("maincpu:sio0", psxsio0_device, write_rxd)) - MCFG_PSX_CONTROLLER_PORTS_DSR_HANDLER(DEVWRITELINE("maincpu:sio0", psxsio0_device, write_dsr)) - MCFG_PSX_CTRL_PORT_ADD("port1", psx_controllers, "digital_pad") - MCFG_PSX_CTRL_PORT_ADD("port2", psx_controllers, "digital_pad") - - MCFG_DEVICE_MODIFY("maincpu:sio0") - MCFG_PSX_SIO_DTR_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_dtr)) - MCFG_PSX_SIO_SCK_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_sck)) - MCFG_PSX_SIO_TXD_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_txd)) - - /* video hardware */ - MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0x100000, XTAL_53_693175MHz ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 ) - MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) - MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) - - MCFG_SOFTWARE_LIST_ADD("cd_list","psx") - - MCFG_DEVICE_MODIFY( "maincpu" ) - MCFG_PSX_CD_READ_HANDLER( DEVREAD8( PSXCD_TAG, psxcd_device, read ) ) - MCFG_PSX_CD_WRITE_HANDLER( DEVWRITE8( PSXCD_TAG, psxcd_device, write ) ) - - MCFG_PSXCD_ADD(PSXCD_TAG, "cdrom") - MCFG_PSXCD_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin2)) - MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 3, psx_dma_read_delegate( FUNC( psx1_state::cd_dma_read ), (psx1_state *) owner ) ) - MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 3, psx_dma_write_delegate( FUNC( psx1_state::cd_dma_write ), (psx1_state *) owner ) ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( psu, psj ) - MCFG_CPU_ADD( "subcpu", HD63705, 4166667 ) // MC68HC05G6 - MCFG_CPU_PROGRAM_MAP( subcpu_map ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pse, psx1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", CXD8530AQ, XTAL_67_7376MHz ) - MCFG_CPU_PROGRAM_MAP( psx_map) - - MCFG_RAM_MODIFY("maincpu:ram") - MCFG_RAM_DEFAULT_SIZE("2M") - - MCFG_DEVICE_ADD("controllers", PSXCONTROLLERPORTS, 0) - MCFG_PSX_CONTROLLER_PORTS_RXD_HANDLER(DEVWRITELINE("maincpu:sio0", psxsio0_device, write_rxd)) - MCFG_PSX_CONTROLLER_PORTS_DSR_HANDLER(DEVWRITELINE("maincpu:sio0", psxsio0_device, write_dsr)) - MCFG_PSX_CTRL_PORT_ADD("port1", psx_controllers, "digital_pad") - MCFG_PSX_CTRL_PORT_ADD("port2", psx_controllers, "digital_pad") - - MCFG_DEVICE_MODIFY("maincpu:sio0") - MCFG_PSX_SIO_DTR_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_dtr)) - MCFG_PSX_SIO_SCK_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_sck)) - MCFG_PSX_SIO_TXD_HANDLER(DEVWRITELINE("^controllers", psxcontrollerports_device, write_txd)) - - /* video hardware */ - /* TODO: visible area and refresh rate */ - MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0x100000, XTAL_53_693175MHz ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 ) - MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 ) - MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 ) - - MCFG_SOFTWARE_LIST_ADD("cd_list","psx") - - MCFG_DEVICE_MODIFY( "maincpu" ) - MCFG_PSX_CD_READ_HANDLER( DEVREAD8( PSXCD_TAG, psxcd_device, read ) ) - MCFG_PSX_CD_WRITE_HANDLER( DEVWRITE8( PSXCD_TAG, psxcd_device, write ) ) - - MCFG_PSXCD_ADD(PSXCD_TAG, "cdrom") - MCFG_PSXCD_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin2)) - MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 3, psx_dma_read_delegate( FUNC( psx1_state::cd_dma_read ), (psx1_state *) owner ) ) - MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 3, psx_dma_write_delegate( FUNC( psx1_state::cd_dma_write ), (psx1_state *) owner ) ) -MACHINE_CONFIG_END - -ROM_START( psj ) - ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) - - ROM_SYSTEM_BIOS( 0, "1.0j", "SCPH-1000/DTL-H1000" ) // 22091994 - ROMX_LOAD( "ps-10j.bin", 0x000000, 0x080000, CRC(3b601fc8) SHA1(343883a7b555646da8cee54aadd2795b6e7dd070), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "1.1j", "SCPH-3000/DTL-H1000H (Version 1.1 01/22/95)" ) // 22091994 - ROMX_LOAD( "ps-11j.bin", 0x000000, 0x080000, CRC(3539def6) SHA1(b06f4a861f74270be819aa2a07db8d0563a7cc4e), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS( 2, "2.1j", "SCPH-3500 (Version 2.1 07/17/95 J)" ) // 22091994 - ROMX_LOAD( "ps-21j.bin", 0x000000, 0x080000, CRC(bc190209) SHA1(e38466a4ba8005fba7e9e3c7b9efeba7205bee3f), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS( 3, "2.2j", "SCPH-5000/DTL-H1200/DTL-H3000 (Version 2.2 12/04/95 J)" ) // 04121995 -/* ROMX_LOAD( "ps-22j.bad", 0x000000, 0x080000, BAD_DUMP CRC(8c93a399) SHA1(e340db2696274dda5fdc25e434a914db71e8b02b), ROM_BIOS(4) ) */ - ROMX_LOAD( "ps-22j.bin", 0x000000, 0x080000, CRC(24fc7e17) SHA1(ffa7f9a7fb19d773a0c3985a541c8e5623d2c30d), ROM_BIOS(4) ) - - ROM_SYSTEM_BIOS( 4, "2.2d", "DTL-H1100 (Version 2.2 03/06/96 D)" ) // 04121995 - ROMX_LOAD( "ps-22d.bin", 0x000000, 0x080000, CRC(decb22f5) SHA1(73107d468fc7cb1d2c5b18b269715dd889ecef06), ROM_BIOS(5) ) - - ROM_SYSTEM_BIOS( 5, "3.0j", "SCPH-5500 (Version 3.0 09/09/96 J)" ) // 04121995 - ROMX_LOAD( "ps-30j.bin", 0x000000, 0x080000, CRC(ff3eeb8c) SHA1(b05def971d8ec59f346f2d9ac21fb742e3eb6917), ROM_BIOS(6) ) - - ROM_SYSTEM_BIOS( 6, "4.0j", "SCPH-7000/SCPH-7500/SCPH-9000 (Version 4.0 08/18/97 J)" ) // 29051997 - ROMX_LOAD( "ps-40j.bin", 0x000000, 0x080000, CRC(ec541cd0) SHA1(77b10118d21ac7ffa9b35f9c4fd814da240eb3e9), ROM_BIOS(7) ) - - ROM_SYSTEM_BIOS( 7, "4.1a", "SCPH-7000W (Version 4.1 11/14/97 A)" ) // 04121995 - ROMX_LOAD( "ps-41a(w).bin", 0x000000, 0x080000, CRC(b7c43dad) SHA1(1b0dbdb23da9dc0776aac58d0755dc80fea20975), ROM_BIOS(8) ) - - ROM_SYSTEM_BIOS( 8, "4.3j", "SCPH-100 (Version 4.3 03/11/00 J)" ) // 04121995 - ROMX_LOAD( "psone-43j.bin", 0x000000, 0x080000, CRC(f2af798b) SHA1(339a48f4fcf63e10b5b867b8c93cfd40945faf6c), ROM_BIOS(9) ) -ROM_END - -ROM_START( psu ) - ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) - - ROM_SYSTEM_BIOS( 0, "2.0a", "DTL-H1001 (Version 2.0 05/07/95 A)" ) // 22091994 - ROMX_LOAD( "ps-20a.bin", 0x000000, 0x080000, CRC(55847d8c) SHA1(649895efd79d14790eabb362e94eb0622093dfb9), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "2.1a", "DTL-H1101 (Version 2.1 07/17/95 A)" ) // 22091994 - ROMX_LOAD( "ps-21a.bin", 0x000000, 0x080000, CRC(aff00f2f) SHA1(ca7af30b50d9756cbd764640126c454cff658479), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS( 2, "2.2a", "SCPH-1001/DTL-H1201/DTL-H3001 (Version 2.2 12/04/95 A)" ) // 04121995 - ROMX_LOAD( "ps-22a.bin", 0x000000, 0x080000, CRC(37157331) SHA1(10155d8d6e6e832d6ea66db9bc098321fb5e8ebf), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS( 3, "3.0a", "SCPH-5501/SCPH-5503/SCPH-7003 (Version 3.0 11/18/96 A)" ) // 04121995 - ROMX_LOAD( "ps-30a.bin", 0x000000, 0x080000, CRC(8d8cb7e4) SHA1(0555c6fae8906f3f09baf5988f00e55f88e9f30b), ROM_BIOS(4) ) - - ROM_SYSTEM_BIOS( 4, "4.1a", "SCPH-7001/SCPH-7501/SCPH-7503/SCPH-9001/SCPH-9003/SCPH-9903 (Version 4.1 12/16/97 A)" ) // 04121995 - ROMX_LOAD( "ps-41a.bin", 0x000000, 0x080000, CRC(502224b6) SHA1(14df4f6c1e367ce097c11deae21566b4fe5647a9), ROM_BIOS(5) ) - - ROM_SYSTEM_BIOS( 5, "4.5a", "SCPH-101 (Version 4.5 05/25/00 A)" ) // 04121995 - ROMX_LOAD( "psone-45a.bin", 0x000000, 0x080000, CRC(171bdcec) SHA1(dcffe16bd90a723499ad46c641424981338d8378), ROM_BIOS(6) ) - - ROM_REGION( 0x10000, "subcpu", 0 ) - ROM_LOAD( "ram.ic304", 0x000000, 0x000400, CRC(e9fefc8b) SHA1(7ab4a498216fb9a3fca9daf6ad21b4553126e74f) ) - ROM_FILL( 0x0400, 0x0c00, 0xff ) - ROM_LOAD( "scea.ic304", 0x001000, 0x004000, CRC(82729934) SHA1(7d5f52eb9df1243dcdab32cb763a9eb6a22706d7) ) - ROM_FILL( 0x5000, 0xae00, 0xff ) - ROM_LOAD( "test.ic304", 0x00fe00, 0x000200, CRC(3b2f8041) SHA1(d7127cb4a9b5efe9deffab3b72ab4451cb30675b) ) -ROM_END - -ROM_START( pse ) - ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) - - ROM_SYSTEM_BIOS( 0, "2.0e", "DTL-H1002/SCPH-1002 (Version 2.0 05/10/95 E)" ) // 22091994 - ROMX_LOAD( "ps-20e.bin", 0x000000, 0x080000, CRC(9bb87c4b) SHA1(20b98f3d80f11cbf5a7bfd0779b0e63760ecc62c), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "2.1e", "SCPH-1002/DTL-H1102 (Version 2.1 07/17/95 E)" ) // 22091994 - ROMX_LOAD( "ps-21e.bin", 0x000000, 0x080000, CRC(86c30531) SHA1(76cf6b1b2a7c571a6ad07f2bac0db6cd8f71e2cc), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS( 2, "2.2e", "SCPH-1002/DTL-H1202/DTL-H3002 (Version 2.2 12/04/95 E)" ) // 04121995 - ROMX_LOAD( "ps-22e.bin", 0x000000, 0x080000, CRC(1e26792f) SHA1(b6a11579caef3875504fcf3831b8e3922746df2c), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS( 3, "3.0e", "SCPH-5502/SCPH-5552 (Version 3.0 01/06/97 E)" ) // 04121995 -/* ROMX_LOAD( "ps-30e.bad", 0x000000, 0x080000, BAD_DUMP CRC(4d9e7c86) SHA1(f8de9325fc36fcfa4b29124d291c9251094f2e54), ROM_BIOS(4) ) */ - ROMX_LOAD( "ps-30e.bin", 0x000000, 0x080000, CRC(d786f0b9) SHA1(f6bc2d1f5eb6593de7d089c425ac681d6fffd3f0), ROM_BIOS(4) ) - - ROM_SYSTEM_BIOS( 4, "4.1e", "SCPH-7002/SCPH-7502/SCPH-9002 (Version 4.1 12/16/97 E)" ) // 04121995 - ROMX_LOAD( "ps-41e.bin", 0x000000, 0x080000, CRC(318178bf) SHA1(8d5de56a79954f29e9006929ba3fed9b6a418c1d), ROM_BIOS(5) ) - - ROM_SYSTEM_BIOS( 5, "4.4e", "SCPH-102 (Version 4.4 03/24/00 E)" ) // 04121995 - ROMX_LOAD( "psone-44e.bin", 0x000000, 0x080000, CRC(0bad7ea9) SHA1(beb0ac693c0dc26daf5665b3314db81480fa5c7c), ROM_BIOS(6) ) - - ROM_SYSTEM_BIOS( 6, "4.5e", "SCPH-102 (Version 4.5 05/25/00 E)" ) // 04121995 - ROMX_LOAD( "psone-45e.bin", 0x000000, 0x080000, CRC(76b880e5) SHA1(dbc7339e5d85827c095764fc077b41f78fd2ecae), ROM_BIOS(7) ) -ROM_END - -ROM_START( psa ) - ROM_REGION32_LE( 0x080000, "maincpu:rom", 0 ) - - ROM_SYSTEM_BIOS( 0, "3.0a", "SCPH-5501/SCPH-5503/SCPH-7003 (Version 3.0 11/18/96 A)" ) // 04121995 - ROMX_LOAD( "ps-30a.bin", 0x000000, 0x080000, CRC(8d8cb7e4) SHA1(0555c6fae8906f3f09baf5988f00e55f88e9f30b), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "4.1a", "SCPH-7001/SCPH-7501/SCPH-7503/SCPH-9001/SCPH-9003/SCPH-9903 (Version 4.1 12/16/97 A)" ) // 04121995 - ROMX_LOAD( "ps-41a.bin", 0x000000, 0x080000, CRC(502224b6) SHA1(14df4f6c1e367ce097c11deae21566b4fe5647a9), ROM_BIOS(2) ) -ROM_END - -/* -The version number & release date is stored in ascii text at the end of every bios, except for scph1000. -There is also a BCD encoded date at offset 0x100, but this is set to 22091994 for versions prior to 2.2 -and 04121995 for all versions from 2.2 ( except Version 4.0J which is 29051997 ). - -Consoles not dumped: - -DTL-H1001H -SCPH-5001 -SCPH-5002 (this is not mentioned in SCPH-102B.pdf so it's likely it doesn't exist) -SCPH-5003 -SCPH-103 - -Holes in version numbers: - -Version 2.0 J -Version 4.1 J (SCPH7000W uses 4.1 A) -Version 4.2 J -Version 4.4 J -Version 4.5 J -Version 4.0 A -Version 4.2 A -Version 4.3 A -Version 4.4 A -Version 4.0 E -Version 4.2 E -Version 4.3 E - -*/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1994, psj, 0, 0, psj, 0, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PlayStation (Japan)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 1995, pse, psj, 0, pse, 0, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PlayStation (Europe)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 1995, psu, psj, 0, psu, 0, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PlayStation (USA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 1995, psa, psj, 0, psj, 0, driver_device, 0, "Sony Computer Entertainment Inc", "Sony PlayStation (Asia-Pacific)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/pt68k4.c b/src/mess/drivers/pt68k4.c deleted file mode 100644 index 4a24667e873..00000000000 --- a/src/mess/drivers/pt68k4.c +++ /dev/null @@ -1,491 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert, R. Belmont -/*************************************************************************** - - Peripheral Technology PT68K2/PT68K4 family - - 2011-01-03 Skeleton driver. - 2013-09-30 Connected to a terminal - 2014-01-03 Connect real DUARTs, FDC, and TimeKeeper. Settings now save properly, floppies can be read. - 2014-01-19 ISA bus and compatible cards, PC keyboard support, speaker support - 2014-09-20 Add PT68K2, add save states, we have a working SK*DOS disk! - -This has the appearance of a PC, including pc power supply, slots, etc -on a conventional pc-like motherboard and case. - -Some pics: http://www.wormfood.net/old_computers/ - -Source code and manuals for the HUMBUG BIOS and SK*DOS are at: -http://www.users.cloud9.net/~stark/sources.html - -Usage: - Start up and press Enter as prompted. Type he to see a command list, or fd to boot from the - first floppy drive. - - The stock NVRAM configures PT68k2 for 2 DSDD 5.25" drives, and PT68k4 for 2 DSHD 5.25" drives. - -Chips: - 68230 Parallel Interface/Timer @ FE0081 - 68681 DUART/Timer (x2) @ FE0001 and FE0041 - WD37C65 FDC (PC FDC compatible, even mapped as an ISA device) - MK48T02 TimeKeeper @ odd bytes from FF0001 to FF0FFF. even bytes in that range are a standard SRAM chip which is not backed up. - Keyboard at FE01C1 (status/IRQ clear)/FE01C3 (AT scan codes) - WD1002 HDD controller @ FE0141-FE014F. "Monk" BIOS also supports an 8-bit ISA IDE card. - -Video: ISA MDA or CGA/EGA/VGA-style boards - ISA memory is C00001-DFFFFF odd bytes only. So the MDA B0000 framebuffer becames (B0000*2) + C00001 = D60001. - ISA I/O is at FA0001-FBFFFF odd bytes only, and the mapping is similar. - - HUMBUG BIOS tests MDA and CGA VRAM to determine existence, falls back to serial console if neither exists. If both exist, MDA is used. - VRAM is every other byte for ISA cards. (Only 8 bit cards are supported). - - OP3 on DUART1 drives a speaker. - IP2 on DUART1 signals if a new keyboard scan code is available. - -IRQs: - 2: 68230 PIT - 4: DUART2 - 5: DUART1 - 6: PC FDC IRQ - -TODO: 68230 device - This system and SK*DOS don't like our ISA WDXT-GEN emulation so HDD installs are not currently possible. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/mc68681.h" -#include "machine/timekpr.h" -#include "machine/wd_fdc.h" -#include "machine/pc_fdc.h" -#include "formats/imd_dsk.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "bus/pc_kbd/pc_kbdc.h" -#include "bus/pc_kbd/keyboards.h" -#include "sound/speaker.h" - -#define M68K_TAG "maincpu" -#define DUART1_TAG "duart1" -#define DUART2_TAG "duart2" -#define TIMEKEEPER_TAG "timekpr" -#define ISABUS_TAG "isa" -#define KBDC_TAG "pc_kbdc" -#define SPEAKER_TAG "speaker" -#define WDFDC_TAG "wdfdc" - -class pt68k4_state : public driver_device -{ -public: - pt68k4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_p_base(*this, "rambase") - , m_maincpu(*this, M68K_TAG) - , m_duart1(*this, DUART1_TAG) - , m_duart2(*this, DUART2_TAG) - , m_isa(*this, ISABUS_TAG) - , m_speaker(*this, SPEAKER_TAG) - , m_wdfdc(*this, WDFDC_TAG) - { } - - DECLARE_READ8_MEMBER(hiram_r); - DECLARE_WRITE8_MEMBER(hiram_w); - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(keyboard_w); - - DECLARE_READ8_MEMBER(pia_stub_r); - DECLARE_WRITE8_MEMBER(duart1_out); - - DECLARE_WRITE8_MEMBER(fdc_select_w); - - DECLARE_WRITE_LINE_MEMBER(duart1_irq); - DECLARE_WRITE_LINE_MEMBER(duart2_irq); - - DECLARE_WRITE_LINE_MEMBER(irq5_w); - - DECLARE_WRITE_LINE_MEMBER(keyboard_clock_w); - DECLARE_WRITE_LINE_MEMBER(keyboard_data_w); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - -private: - virtual void machine_start(); - virtual void machine_reset(); - required_shared_ptr m_p_base; - required_device m_maincpu; - required_device m_duart1; - required_device m_duart2; - required_device m_isa; - required_device m_speaker; - optional_device m_wdfdc; - - void irq5_update(); - - UINT8 m_hiram[0x800]; - - bool m_kclk; - UINT8 m_kdata; - UINT8 m_scancode; - UINT8 m_kbdflag; - int m_kbit; - int m_lastdrive; - bool m_irq5_duart1, m_irq5_isa; -}; - -FLOPPY_FORMATS_MEMBER( pt68k4_state::floppy_formats ) - FLOPPY_IMD_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( pt68k_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -// XT keyboard interface - done in TTL instead of an 804x -WRITE_LINE_MEMBER(pt68k4_state::keyboard_clock_w) -{ -// printf("KCLK: %d\n", state ? 1 : 0); - - // rising edge? - if ((state == ASSERT_LINE) && (!m_kclk)) - { - if (m_kbit >= 1 && m_kbit <= 8) - { - m_scancode >>= 1; - m_scancode |= m_kdata; - } - - // stop bit? - if (m_kbit == 9) - { -// printf("scancode %02x\n", m_scancode); - m_kbit = 0; - m_kbdflag = 0x80; - m_duart1->ip2_w(CLEAR_LINE); - } - else - { - m_kbit++; - } - } - - m_kclk = (state == ASSERT_LINE) ? true : false; -} - -WRITE_LINE_MEMBER(pt68k4_state::keyboard_data_w) -{ -// printf("KDATA: %d\n", state ? 1 : 0); - m_kdata = (state == ASSERT_LINE) ? 0x80 : 0x00; -} - -WRITE8_MEMBER(pt68k4_state::duart1_out) -{ - m_speaker->level_w((data >> 3) & 1); -} - -READ8_MEMBER(pt68k4_state::pia_stub_r) -{ - return 0; -} - -WRITE8_MEMBER(pt68k4_state::fdc_select_w) -{ - floppy_connector *con = machine().device(WDFDC_TAG":0"); - floppy_connector *con2 = machine().device(WDFDC_TAG":1"); - floppy_image_device *floppy = con ? con->get_device() : 0; - floppy_image_device *floppy2 = con2 ? con2->get_device() : 0; - int drive = data & 3; - - if (drive != m_lastdrive) - { - switch (drive) - { - case 0: - m_wdfdc->set_floppy(floppy); - break; - - case 1: - m_wdfdc->set_floppy(floppy2); - break; - - default: - m_wdfdc->set_floppy(NULL); - break; - } - - m_lastdrive = drive; - } - - switch (drive) - { - case 0: - floppy->ss_w((data & 0x40) ? 1 : 0); - break; - - case 1: - floppy2->ss_w((data & 0x40) ? 1 : 0); - break; - - default: - break; - } -} - -static ADDRESS_MAP_START(pt68k2_mem, AS_PROGRAM, 16, pt68k4_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("rambase") // 1MB RAM - AM_RANGE(0xf80000, 0xf8ffff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0xc00000, 0xdfffff) AM_DEVREADWRITE8(ISABUS_TAG, isa8_device, prog_r, prog_w, 0x00ff) - AM_RANGE(0xfa0000, 0xfbffff) AM_DEVREADWRITE8(ISABUS_TAG, isa8_device, io_r, io_w, 0x00ff) - AM_RANGE(0xfe0000, 0xfe001f) AM_DEVREADWRITE8(DUART1_TAG, mc68681_device, read, write, 0x00ff) - AM_RANGE(0xfe0040, 0xfe005f) AM_DEVREADWRITE8(DUART2_TAG, mc68681_device, read, write, 0x00ff) - AM_RANGE(0xfe0080, 0xfe00bf) AM_READ8(pia_stub_r, 0x00ff) - AM_RANGE(0xfe00c0, 0xfe00ff) AM_WRITE8(fdc_select_w, 0x00ff) - AM_RANGE(0xfe0100, 0xfe013f) AM_DEVREADWRITE8(WDFDC_TAG, wd1772_t, read, write, 0x00ff) - AM_RANGE(0xfe01c0, 0xfe01c3) AM_READWRITE8(keyboard_r, keyboard_w, 0x00ff) - AM_RANGE(0xff0000, 0xff0fff) AM_READWRITE8(hiram_r, hiram_w, 0xff00) - AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE8(TIMEKEEPER_TAG, timekeeper_device, read, write, 0x00ff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pt68k4_mem, AS_PROGRAM, 16, pt68k4_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("rambase") // 1MB RAM (OS9 needs more) - AM_RANGE(0xf80000, 0xf8ffff) AM_ROM AM_REGION("roms", 0) - AM_RANGE(0xc00000, 0xdfffff) AM_DEVREADWRITE8(ISABUS_TAG, isa8_device, prog_r, prog_w, 0x00ff) - AM_RANGE(0xfa0000, 0xfbffff) AM_DEVREADWRITE8(ISABUS_TAG, isa8_device, io_r, io_w, 0x00ff) - AM_RANGE(0xfe0000, 0xfe001f) AM_DEVREADWRITE8(DUART1_TAG, mc68681_device, read, write, 0x00ff) - AM_RANGE(0xfe0040, 0xfe005f) AM_DEVREADWRITE8(DUART2_TAG, mc68681_device, read, write, 0x00ff) - AM_RANGE(0xfe01c0, 0xfe01c3) AM_READWRITE8(keyboard_r, keyboard_w, 0x00ff) - AM_RANGE(0xff0000, 0xff0fff) AM_READWRITE8(hiram_r, hiram_w, 0xff00) - AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE8(TIMEKEEPER_TAG, timekeeper_device, read, write, 0x00ff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pt68k4 ) -INPUT_PORTS_END - -/* built in keyboard: offset 0 reads 0x80 if key ready, 0 if not. If key ready, offset 1 reads scancode. Read or write to offs 0 clears key ready */ -READ8_MEMBER(pt68k4_state::keyboard_r) -{ - if (offset == 0) - { - UINT8 rv = m_kbdflag; - - m_kbdflag = 0; - m_duart1->ip2_w(ASSERT_LINE); - - return rv; - } - - return m_scancode; -} - -WRITE8_MEMBER(pt68k4_state::keyboard_w) -{ - m_kbdflag = 0; - m_duart1->ip2_w(ASSERT_LINE); -} - -READ8_MEMBER(pt68k4_state::hiram_r) -{ - return m_hiram[offset]; -} - -WRITE8_MEMBER(pt68k4_state::hiram_w) -{ - m_hiram[offset] = data; -} - -void pt68k4_state::machine_start() -{ - save_item(NAME(m_hiram)); - save_item(NAME(m_kclk)); - save_item(NAME(m_kdata)); - save_item(NAME(m_scancode)); - save_item(NAME(m_kbdflag)); - save_item(NAME(m_kbit)); - save_item(NAME(m_lastdrive)); - save_item(NAME(m_irq5_duart1)); - save_item(NAME(m_irq5_isa)); -} - -void pt68k4_state::machine_reset() -{ - UINT8* user1 = memregion("roms")->base(); - memcpy((UINT8*)m_p_base.target(), user1, 8); - - m_maincpu->reset(); - - m_kclk = true; - m_kbit = 0; - m_scancode = 0; - m_kbdflag = 0; - m_irq5_duart1 = CLEAR_LINE; - m_irq5_isa = CLEAR_LINE; - - // set line to asserted (no key code ready) - m_duart1->ip2_w(ASSERT_LINE); - - if (m_wdfdc) - { - floppy_connector *con = machine().device(WDFDC_TAG":0"); - floppy_image_device *floppy = con ? con->get_device() : 0; - - m_wdfdc->set_floppy(floppy); - floppy->ss_w(0); - - m_lastdrive = 0; - } -} - -void pt68k4_state::irq5_update() -{ - if ((m_irq5_duart1) || (m_irq5_isa)) - { - m_maincpu->set_input_line(M68K_IRQ_5, ASSERT_LINE); - } - else - { - m_maincpu->set_input_line(M68K_IRQ_5, CLEAR_LINE); - } -} - -WRITE_LINE_MEMBER(pt68k4_state::duart1_irq) -{ - m_irq5_duart1 = state; - irq5_update(); -} - -WRITE_LINE_MEMBER(pt68k4_state::irq5_w) -{ - m_irq5_isa = state; - irq5_update(); -} - -WRITE_LINE_MEMBER(pt68k4_state::duart2_irq) -{ - m_maincpu->set_input_line(M68K_IRQ_4, state); -} - -// these are cards supported by the HUMBUG and Monk BIOSes -SLOT_INTERFACE_START( pt68k4_isa8_cards ) - SLOT_INTERFACE("mda", ISA8_MDA) - SLOT_INTERFACE("cga", ISA8_CGA) - SLOT_INTERFACE("ega", ISA8_EGA) // Monk only - SLOT_INTERFACE("vga", ISA8_VGA) // Monk only - SLOT_INTERFACE("fdc_at", ISA8_FDC_AT) - SLOT_INTERFACE("wdxt_gen", ISA8_WDXT_GEN) - SLOT_INTERFACE("lpt", ISA8_LPT) - SLOT_INTERFACE("xtide", ISA8_XTIDE) // Monk only -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( pt68k2, pt68k4_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M68K_TAG, M68000, XTAL_16MHz/2) // 68k2 came in 8, 10, and 12 MHz versions - MCFG_CPU_PROGRAM_MAP(pt68k2_mem) - - MCFG_MC68681_ADD("duart1", XTAL_3_6864MHz) - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(pt68k4_state, duart1_irq)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(pt68k4_state, duart1_out)) - - MCFG_MC68681_ADD("duart2", XTAL_3_6864MHz) - - MCFG_DEVICE_ADD(KBDC_TAG, PC_KBDC, 0) - MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(pt68k4_state, keyboard_clock_w)) - MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE(pt68k4_state, keyboard_data_w)) - MCFG_PC_KBDC_SLOT_ADD(KBDC_TAG, "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - - MCFG_M48T02_ADD(TIMEKEEPER_TAG) - - MCFG_WD1772_ADD(WDFDC_TAG, XTAL_16MHz / 2) - MCFG_FLOPPY_DRIVE_ADD(WDFDC_TAG":0", pt68k_floppies, "525dd", pt68k4_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WDFDC_TAG":1", pt68k_floppies, "525dd", pt68k4_state::floppy_formats) - - MCFG_DEVICE_ADD(ISABUS_TAG, ISA8, 0) - MCFG_ISA8_CPU(":" M68K_TAG) - MCFG_ISA8_BUS_CUSTOM_SPACES() - MCFG_ISA_OUT_IRQ5_CB(WRITELINE(pt68k4_state, irq5_w)) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa1", pt68k4_isa8_cards, "cga", false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa2", pt68k4_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa3", pt68k4_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa4", pt68k4_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa5", pt68k4_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa6", pt68k4_isa8_cards, NULL, false) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOFTWARE_LIST_ADD("flop525_list", "pt68k2") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( pt68k4, pt68k4_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(M68K_TAG, M68000, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(pt68k4_mem) - - // add the DUARTS. first one has the console on channel A at 19200. - MCFG_MC68681_ADD("duart1", XTAL_16MHz / 4) - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(pt68k4_state, duart1_irq)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(pt68k4_state, duart1_out)) - - MCFG_MC68681_ADD("duart2", XTAL_16MHz / 4) - - MCFG_DEVICE_ADD(KBDC_TAG, PC_KBDC, 0) - MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(pt68k4_state, keyboard_clock_w)) - MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE(pt68k4_state, keyboard_data_w)) - MCFG_PC_KBDC_SLOT_ADD(KBDC_TAG, "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83) - - MCFG_M48T02_ADD(TIMEKEEPER_TAG) - - MCFG_DEVICE_ADD(ISABUS_TAG, ISA8, 0) - MCFG_ISA8_CPU(":" M68K_TAG) - MCFG_ISA8_BUS_CUSTOM_SPACES() - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa1", pt68k4_isa8_cards, "fdc_at", false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa2", pt68k4_isa8_cards, "cga", false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa3", pt68k4_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa4", pt68k4_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa5", pt68k4_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa6", pt68k4_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD(ISABUS_TAG, "isa7", pt68k4_isa8_cards, NULL, false) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOFTWARE_LIST_ADD("flop525_list", "pt68k2") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pt68k2 ) - ROM_REGION16_BE( 0x10000, "roms", 0 ) - ROM_LOAD16_BYTE( "hum_u20.bin", 0x000000, 0x008000, CRC(69db483a) SHA1(9dfea73e4d7deef7c66a27cca92eb7c9ff767215) ) - ROM_LOAD16_BYTE( "hum_u27.bin", 0x000001, 0x008000, CRC(54441b06) SHA1(0e2d63b1cd01f88f37fc4859c11c252c4fea220b) ) - - ROM_REGION(0x800, TIMEKEEPER_TAG, 0) - ROM_LOAD( "u21_ds1220.bin", 0x000000, 0x000800, CRC(7a6b75ce) SHA1(07663860aa6cc21aed04a568ff9c05bc75d62e4f) ) -ROM_END - -ROM_START( pt68k4 ) - ROM_REGION16_BE( 0x10000, "roms", 0 ) - ROM_SYSTEM_BIOS( 0, "humbug", "Humbug" ) - ROMX_LOAD( "humpta40.bin", 0x0000, 0x8000, CRC(af67ff64) SHA1(da9fa31338c6847bb0e66118679b1ec01f6dc30b), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "humpta41.bin", 0x0001, 0x8000, CRC(a8b16e27) SHA1(218802f6e20d14cff736bb7423f06ce2f66e074c), ROM_SKIP(1) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "monk", "Monk" ) - ROMX_LOAD( "monk_0.bin", 0x0000, 0x8000, CRC(420d6a4b) SHA1(fca8c53c9c3c8ebd09370499cf34f4cc75ed9463), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "monk_1.bin", 0x0001, 0x8000, CRC(fc495e82) SHA1(f7b720d87db4d72a23e6c42d2cdd03216db04b60), ROM_SKIP(1) | ROM_BIOS(2)) - - ROM_REGION(0x800, TIMEKEEPER_TAG, 0) - ROM_LOAD( "u21_ds1220_k4.bin", 0x000000, 0x000800, CRC(753472e6) SHA1(58dc8bcc86191e4a4429fe6a9b4fdd7788abb0cd) ) - - ROM_REGION( 0x0900, "proms", 0 ) - ROM_LOAD_OPTIONAL( "20l8.u71", 0x0000, 0x000149, CRC(77365121) SHA1(5ecf490ead119966a5c097d90740acde60462ab0) ) - ROM_LOAD_OPTIONAL( "16l8.u53", 0x0200, 0x000109, CRC(cb6a9984) SHA1(45b9b14e7b45cda6f0edfcbb9895b6a14eacb852) ) - ROM_LOAD_OPTIONAL( "22v10.u40", 0x0400, 0x0002e1, CRC(24df92e4) SHA1(c183113956bb0db132b6f37b239ca0bb7fac2d82) ) - ROM_LOAD_OPTIONAL( "16l8.u11", 0x0700, 0x000109, CRC(397a1363) SHA1(aca2a02e1bf1f7cdb9b0ca24ebecb0b01ae472e8) ) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, pt68k2, 0, 0, pt68k2, pt68k4, driver_device, 0, "Peripheral Technology", "PT68K2", MACHINE_SUPPORTS_SAVE ) -COMP( 1990, pt68k4, 0, 0, pt68k4, pt68k4, driver_device, 0, "Peripheral Technology", "PT68K4", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/ptcsol.c b/src/mess/drivers/ptcsol.c deleted file mode 100644 index bf3afcb02fd..00000000000 --- a/src/mess/drivers/ptcsol.c +++ /dev/null @@ -1,796 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Processor Technology Corp. SOL-20 - - 07/2009 Skeleton driver. - - Info from: http://www.sol20.org/ - - Note that the SOLOS dump comes from the Solace emu. Confirmed as ok. - - The roms DPMON and CONSOL are widely available on the net as ENT files, - which can be loaded into memory with the Paste option, then exported to - binary files with the debugger. They are working, however the ENT files - do not indicate the values of unused rom space. Therefore they are marked - as BAD_DUMP. - - Note that the CONSOL rom is basically a dumb terminal program and doesn't - do anything useful unless the MODE key (whatever that is) is pressed. - - CUTER is a relocatable cassette-based alternative to SOLOS. According - to the manual, it should work if the sense switches are set to on. But, - it continuously reads port 00 and does nothing. - - Need original dumps of all roms. - - The character roms are built by a script from the Solace source, then the - characters moved back to the original 7x9 matrix positions, as shown in - the manual. Although they look exactly the same, I've marked them as - BAD_DUMP until properly verified. - - Other roms needed: - - Dump of U18 in the keyboard - - Hardware variants (ever shipped?): - - SOL-10, i.e. a stripped down version without expansion backplane and - numeric keypad - - SOL-PC, i.e. the single board version, basically it consisted of the - SOL-20 board only - - Similarity to Exidy Sorcerer: - - Some hardware is the same design (parallel ports, serial ports, 2 - tape players, the cassette circuits) - - The cassette format is totally identical, in fact tapes from one - machine can be loaded on the other natively. They won't run of course. - - Sorcerer monitor commands are almost identical to the SOLOS ones. - example: to change tape speed to 300 baud: - SE T=1 (sorcerer) SE TA 1 (SOLOS) - Most other commands are identical. The EN command (enter bytes into - memory) is rather primitive in SOLOS, better on Sorcerer. - - Sol20 has "personality modules" where you could plug a new OS into - a special socket on the motherboard. Sorcerer improved upon this by - being the first computer to use cartridges. - - Some circuits are completely different... the video and keyboard are - notable examples, while the addresses of ram and bios on the basic - machines is another major difference. - - ToDo: - - connect up half/full duplex dipswitch function - - connect up the remaining functions of port FE - - keyboard (using terminal keyboard for now) - - optional floppy disk support and CP/M - - parallel i/o and handshake lines - - connect serial i/o to something - - support for loading the various file formats - - File Formats: - - Most files are simple ascii which can be loaded via the Paste handler. - These are ASC, ENT, BAS, ROM, BS5 and ECB. Most files require that the - correct version of BASIC be loaded first. Paste works, but it is very - very slow. Perhaps we need something faster such as what Solace has. - - SVT (Solace Virtual Tape) files are a representation of a cassette, - usually holding about 4 games, just like a multifile tape. This format - is partially supported. - - HEX files appear to be the standard Intel format, and can be loaded - by Solace. - - The remaining formats (OPN, PL, PRN, SMU, SOL, ASM and LIB) appear - at first glance to be more specialised, and probably not worth being - supported. - - System Setup (to play games etc). - - In the Dipswitches (not the Configuration), turn cursor flashing OFF. - - Loading via wav files works, so load a tape image in the file manager - - In UPPER CASE, enter XE press enter, cassette will load. - - At the end, the program will start by itself. - - When it says use 2,4,6,8 keys, you can use the keyboard arrow keys. - - Monitor Commands: - - TE - ? - - DU - dump memory - - EN - modify memory - - EX - Go (execute) - - CU - ? - - SE - Set parameters (eg tape speed) - - SA - Save - - GE - Load - - XE - Load and run - - CA - List the files on a tape - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/keyboard.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "machine/ay31015.h" -#include "formats/sol_cas.h" - - -struct cass_data_t { - struct { - int length; /* time cassette level is at input.level */ - int level; /* cassette level */ - int bit; /* bit being read */ - } input; - struct { - int length; /* time cassette level is at output.level */ - int level; /* cassette level */ - int bit; /* bit to output */ - } output; -}; - -#define KEYBOARD_TAG "keyboard" - -class sol20_state : public driver_device -{ -public: - enum - { - TIMER_SOL20_CASSETTE_TC, - TIMER_SOL20_BOOT - }; - - sol20_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_cass1(*this, "cassette") - , m_cass2(*this, "cassette2") - , m_uart(*this, "uart") - , m_uart_s(*this, "uart_s") - , m_p_videoram(*this, "videoram") - , m_iop_arrows(*this, "ARROWS") - , m_iop_config(*this, "CONFIG") - , m_iop_s1(*this, "S1") - , m_iop_s2(*this, "S2") - , m_iop_s3(*this, "S3") - , m_iop_s4(*this, "S4") - , m_cassette1(*this, "cassette") - , m_cassette2(*this, "cassette2") - { } - - DECLARE_READ8_MEMBER( sol20_f8_r ); - DECLARE_READ8_MEMBER( sol20_f9_r ); - DECLARE_READ8_MEMBER( sol20_fa_r ); - DECLARE_READ8_MEMBER( sol20_fb_r ); - DECLARE_READ8_MEMBER( sol20_fc_r ); - DECLARE_READ8_MEMBER( sol20_fd_r ); - DECLARE_WRITE8_MEMBER( sol20_f8_w ); - DECLARE_WRITE8_MEMBER( sol20_f9_w ); - DECLARE_WRITE8_MEMBER( sol20_fa_w ); - DECLARE_WRITE8_MEMBER( sol20_fb_w ); - DECLARE_WRITE8_MEMBER( sol20_fd_w ); - DECLARE_WRITE8_MEMBER( sol20_fe_w ); - DECLARE_WRITE8_MEMBER( kbd_put ); - DECLARE_DRIVER_INIT(sol20); - TIMER_CALLBACK_MEMBER(sol20_cassette_tc); - TIMER_CALLBACK_MEMBER(sol20_boot); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -private: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - UINT8 m_sol20_fa; - virtual void machine_reset(); - virtual void machine_start(); - virtual void video_start(); - UINT8 m_sol20_fc; - UINT8 m_sol20_fe; - const UINT8 *m_p_chargen; - UINT8 m_framecnt; - cass_data_t m_cass_data; - emu_timer *m_cassette_timer; - cassette_image_device *cassette_device_image(); - required_device m_maincpu; - required_device m_cass1; - required_device m_cass2; - required_device m_uart; - required_device m_uart_s; - required_shared_ptr m_p_videoram; - required_ioport m_iop_arrows; - required_ioport m_iop_config; - required_ioport m_iop_s1; - required_ioport m_iop_s2; - required_ioport m_iop_s3; - required_ioport m_iop_s4; - required_device m_cassette1; - required_device m_cassette2; -}; - - -/* timer to read cassette waveforms */ - - -cassette_image_device *sol20_state::cassette_device_image() -{ - if (m_sol20_fa & 0x40) - return m_cassette2; - else - return m_cassette1; -} - - -void sol20_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_SOL20_CASSETTE_TC: - sol20_cassette_tc(ptr, param); - break; - case TIMER_SOL20_BOOT: - sol20_boot(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in sol20_state::device_timer"); - } -} - - -// identical to sorcerer -TIMER_CALLBACK_MEMBER(sol20_state::sol20_cassette_tc) -{ - UINT8 cass_ws = 0; - switch (m_sol20_fa & 0x20) - { - case 0x20: /* Cassette 300 baud */ - - /* loading a tape - this is basically the same as the super80. - We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */ - - m_cass_data.input.length++; - - cass_ws = ((cassette_device_image())->input() > +0.02) ? 1 : 0; - - if (cass_ws != m_cass_data.input.level) - { - m_cass_data.input.level = cass_ws; - m_cass_data.input.bit = ((m_cass_data.input.length < 0x6) || (m_cass_data.input.length > 0x20)) ? 1 : 0; - m_cass_data.input.length = 0; - m_uart->set_input_pin(AY31015_SI, m_cass_data.input.bit); - } - - /* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies. - Synchronisation of the frequency pulses to the uart is extremely important. */ - - m_cass_data.output.length++; - if (!(m_cass_data.output.length & 0x1f)) - { - cass_ws = m_uart->get_output_pin(AY31015_SO); - if (cass_ws != m_cass_data.output.bit) - { - m_cass_data.output.bit = cass_ws; - m_cass_data.output.length = 0; - } - } - - if (!(m_cass_data.output.length & 3)) - { - if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 4))) - { - m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit - cassette_device_image()->output(m_cass_data.output.level ? -1.0 : +1.0); - } - } - return; - - case 0x00: /* Cassette 1200 baud */ - /* loading a tape */ - m_cass_data.input.length++; - - cass_ws = ((cassette_device_image())->input() > +0.02) ? 1 : 0; - - if (cass_ws != m_cass_data.input.level || m_cass_data.input.length == 10) - { - m_cass_data.input.bit = ((m_cass_data.input.length < 10) || (m_cass_data.input.length > 0x20)) ? 1 : 0; - if ( cass_ws != m_cass_data.input.level ) - { - m_cass_data.input.length = 0; - m_cass_data.input.level = cass_ws; - } - m_uart->set_input_pin(AY31015_SI, m_cass_data.input.bit); - } - - /* saving a tape - convert the serial stream from the uart, into 600 and 1200 Hz frequencies. */ - - m_cass_data.output.length++; - if (!(m_cass_data.output.length & 7)) - { - cass_ws = m_uart->get_output_pin(AY31015_SO); - if (cass_ws != m_cass_data.output.bit) - { - m_cass_data.output.bit = cass_ws; - m_cass_data.output.length = 0; - } - } - - if (!(m_cass_data.output.length & 7)) - { - if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 8))) - { - m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit - cassette_device_image()->output(m_cass_data.output.level ? -1.0 : +1.0); - } - } - return; - } -} - -READ8_MEMBER( sol20_state::sol20_f8_r ) -{ -// d7 - TMBT; d6 - DAV; d5 - CTS; d4 - OE; d3 - PE; d2 - FE; d1 - DSR; d0 - CD - /* set unemulated bits (CTS/DSR/CD) high */ - UINT8 data = 0x23; - - m_uart_s->set_input_pin(AY31015_SWE, 0); - data |= m_uart_s->get_output_pin(AY31015_TBMT) ? 0x80 : 0; - data |= m_uart_s->get_output_pin(AY31015_DAV ) ? 0x40 : 0; - data |= m_uart_s->get_output_pin(AY31015_OR ) ? 0x10 : 0; - data |= m_uart_s->get_output_pin(AY31015_PE ) ? 0x08 : 0; - data |= m_uart_s->get_output_pin(AY31015_FE ) ? 0x04 : 0; - m_uart_s->set_input_pin(AY31015_SWE, 1); - - return data; -} - -READ8_MEMBER( sol20_state::sol20_f9_r) -{ - UINT8 data = m_uart_s->get_received_data(); - m_uart_s->set_input_pin(AY31015_RDAV, 0); - m_uart_s->set_input_pin(AY31015_RDAV, 1); - return data; -} - -READ8_MEMBER( sol20_state::sol20_fa_r ) -{ - /* set unused bits high */ - UINT8 data = 0x26; - - m_uart->set_input_pin(AY31015_SWE, 0); - data |= m_uart->get_output_pin(AY31015_TBMT) ? 0x80 : 0; - data |= m_uart->get_output_pin(AY31015_DAV ) ? 0x40 : 0; - data |= m_uart->get_output_pin(AY31015_OR ) ? 0x10 : 0; - data |= m_uart->get_output_pin(AY31015_FE ) ? 0x08 : 0; - m_uart->set_input_pin(AY31015_SWE, 1); - - bool arrowkey = m_iop_arrows->read() ? 0 : 1; - bool keydown = m_sol20_fa & 1; - - return data | (arrowkey & keydown); -} - -READ8_MEMBER( sol20_state::sol20_fb_r) -{ - UINT8 data = m_uart->get_received_data(); - m_uart->set_input_pin(AY31015_RDAV, 0); - m_uart->set_input_pin(AY31015_RDAV, 1); - return data; -} - -READ8_MEMBER( sol20_state::sol20_fc_r ) -{ - UINT8 data = m_iop_arrows->read(); - if (BIT(data, 0)) return 0x32; - if (BIT(data, 1)) return 0x34; - if (BIT(data, 2)) return 0x36; - if (BIT(data, 3)) return 0x38; - - m_sol20_fa |= 1; - return m_sol20_fc; -} - -READ8_MEMBER( sol20_state::sol20_fd_r ) -{ -// Return a byte from parallel interface - return 0; -} - -WRITE8_MEMBER( sol20_state::sol20_f8_w ) -{ -// The only function seems to be to send RTS from bit 4 -} - -WRITE8_MEMBER( sol20_state::sol20_f9_w ) -{ - m_uart_s->set_transmit_data(data); -} - -WRITE8_MEMBER( sol20_state::sol20_fa_w ) -{ - m_sol20_fa &= 1; - m_sol20_fa |= (data & 0xf0); - - /* cassette 1 motor */ - m_cass1->change_state( - (BIT(data,7)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - /* cassette 2 motor */ - m_cass2->change_state( - (BIT(data,6)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - if (data & 0xc0) - m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(19200)); - else - m_cassette_timer->adjust(attotime::zero); - - // bit 5 baud rate */ - m_uart->set_receiver_clock((BIT(data, 5)) ? 4800.0 : 19200.0); - m_uart->set_transmitter_clock((BIT(data, 5)) ? 4800.0 : 19200.0); -} - -WRITE8_MEMBER( sol20_state::sol20_fb_w ) -{ - m_uart->set_transmit_data(data); -} - -WRITE8_MEMBER( sol20_state::sol20_fd_w ) -{ -// Output a byte to parallel interface -} - -WRITE8_MEMBER( sol20_state::sol20_fe_w ) -{ - m_sol20_fe = data; -} - -static ADDRESS_MAP_START( sol20_mem, AS_PROGRAM, 8, sol20_state) - AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") - AM_RANGE(0X0800, 0Xbfff) AM_RAM // optional s100 ram - AM_RANGE(0xc000, 0xc7ff) AM_ROM - AM_RANGE(0Xc800, 0Xcbff) AM_RAM // system ram - AM_RANGE(0Xcc00, 0Xcfff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0Xd000, 0Xffff) AM_RAM // optional s100 ram -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sol20_io, AS_IO, 8, sol20_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf8, 0xf8) AM_READWRITE(sol20_f8_r,sol20_f8_w) - AM_RANGE(0xf9, 0xf9) AM_READWRITE(sol20_f9_r,sol20_f9_w) - AM_RANGE(0xfa, 0xfa) AM_READWRITE(sol20_fa_r,sol20_fa_w) - AM_RANGE(0xfb, 0xfb) AM_READWRITE(sol20_fb_r,sol20_fb_w) - AM_RANGE(0xfc, 0xfc) AM_READ(sol20_fc_r) - AM_RANGE(0xfd, 0xfd) AM_READWRITE(sol20_fd_r,sol20_fd_w) - AM_RANGE(0xfe, 0xfe) AM_WRITE(sol20_fe_w) - AM_RANGE(0xff, 0xff) AM_READ_PORT("S2") -/* AM_RANGE(0xf8, 0xf8) serial status in (bit 6=data av, bit 7=tmbe) - AM_RANGE(0xf9, 0xf9) serial data in, out - AM_RANGE(0xfa, 0xfa) general status in (bit 0=keyb data av, bit 1=parin data av, bit 2=parout ready) - AM_RANGE(0xfb, 0xfb) tape - AM_RANGE(0xfc, 0xfc) keyboard data in - AM_RANGE(0xfd, 0xfd) parallel data in, out - AM_RANGE(0xfe, 0xfe) scroll register - AM_RANGE(0xff, 0xff) sense switches */ -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sol20 ) - PORT_START("ARROWS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) - PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("S1") - PORT_DIPNAME( 0x04, 0x00, "Ctrl Chars") - PORT_DIPSETTING( 0x04, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x08, 0x00, "Polarity") - PORT_DIPSETTING( 0x00, DEF_STR( Normal )) - PORT_DIPSETTING( 0x08, "Inverse") - PORT_DIPNAME( 0x30, 0x10, "Cursor Type") - PORT_DIPSETTING( 0x10, "Blinking") - PORT_DIPSETTING( 0x20, "Solid") - PORT_DIPSETTING( 0x30, DEF_STR(None)) - - PORT_START("S2") // Sense Switches - PORT_DIPNAME( 0x01, 0x01, "FF bit 0") - PORT_DIPSETTING( 0x01, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x02, 0x02, "FF bit 1") - PORT_DIPSETTING( 0x02, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x04, 0x04, "FF bit 2") - PORT_DIPSETTING( 0x04, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x08, 0x08, "FF bit 3") - PORT_DIPSETTING( 0x08, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x10, 0x10, "FF bit 4") - PORT_DIPSETTING( 0x10, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x20, 0x20, "FF bit 5") - PORT_DIPSETTING( 0x20, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x40, 0x40, "FF bit 6") - PORT_DIPSETTING( 0x40, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x80, 0x80, "FF bit 7") - PORT_DIPSETTING( 0x80, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - - PORT_START("S3") - PORT_DIPNAME( 0xff, 0x08, "Baud Rate") - PORT_DIPSETTING( 0x01, "75") - PORT_DIPSETTING( 0x02, "110") - PORT_DIPSETTING( 0x04, "180") - PORT_DIPSETTING( 0x08, "300") - PORT_DIPSETTING( 0x10, "600") - PORT_DIPSETTING( 0x20, "1200") - PORT_DIPSETTING( 0x40, "2400") - PORT_DIPSETTING( 0x80, "4800/9600") - - PORT_START("S4") - PORT_DIPNAME( 0x11, 0x10, "Parity") - PORT_DIPSETTING( 0x00, "Even") - PORT_DIPSETTING( 0x01, "Odd") - PORT_DIPSETTING( 0x10, DEF_STR(None)) - PORT_DIPNAME( 0x06, 0x06, "Data Bits") - PORT_DIPSETTING( 0x00, "5") - PORT_DIPSETTING( 0x02, "6") - PORT_DIPSETTING( 0x04, "7") - PORT_DIPSETTING( 0x06, "8") - PORT_DIPNAME( 0x08, 0x08, "Stop Bits") - PORT_DIPSETTING( 0x00, "1") - PORT_DIPSETTING( 0x08, "2") - PORT_DIPNAME( 0x20, 0x00, "Duplex") - PORT_DIPSETTING( 0x00, "Half") - PORT_DIPSETTING( 0x20, "Full") - - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "High Baud Rate") // jumper on the board - PORT_CONFSETTING( 0x00, "4800") - PORT_CONFSETTING( 0x01, "9600") - PORT_CONFNAME( 0x02, 0x00, "Character Rom") - PORT_CONFSETTING( 0x00, "6574") - PORT_CONFSETTING( 0x02, "6575") -INPUT_PORTS_END - - -/* after the first 4 bytes have been read from ROM, switch the ram back in */ -TIMER_CALLBACK_MEMBER(sol20_state::sol20_boot) -{ - membank("boot")->set_entry(0); -} - -void sol20_state::machine_start() -{ - m_cassette_timer = timer_alloc(TIMER_SOL20_CASSETTE_TC); -} - -void sol20_state::machine_reset() -{ - UINT8 data = 0, s_count = 0; - int s_clock; - const UINT16 s_bauds[8]={ 75, 110, 180, 300, 600, 1200, 2400, 4800 }; - m_sol20_fe=0; - m_sol20_fa=1; - - // set hard-wired uart pins - m_uart->set_input_pin(AY31015_CS, 0); - m_uart->set_input_pin(AY31015_NB1, 1); - m_uart->set_input_pin(AY31015_NB2, 1); - m_uart->set_input_pin(AY31015_TSB, 1); - m_uart->set_input_pin(AY31015_EPS, 1); - m_uart->set_input_pin(AY31015_NP, 1); - m_uart->set_input_pin(AY31015_CS, 1); - - // set switched uart pins - data = m_iop_s4->read(); - m_uart_s->set_input_pin(AY31015_CS, 0); - m_uart_s->set_input_pin(AY31015_NB1, BIT(data, 1)); - m_uart_s->set_input_pin(AY31015_NB2, BIT(data, 2)); - m_uart_s->set_input_pin(AY31015_TSB, BIT(data, 3)); - m_uart_s->set_input_pin(AY31015_EPS, BIT(data, 0)); - m_uart_s->set_input_pin(AY31015_NP, BIT(data, 4)); - m_uart_s->set_input_pin(AY31015_CS, 1); - - // set rs232 baud rate - data = m_iop_s3->read(); - - if (data > 1) - do - { - s_count++; - data >>= 1; - } - while (!(data & 1) && (s_count < 7)); // find which switch is used - - if ( (s_count == 7) & BIT(m_iop_config->read(), 0) ) // if highest, look at jumper - s_clock = 9600 << 4; - else - s_clock = s_bauds[s_count] << 4; - - // these lines could be commented out for now if you want better performance - m_uart_s->set_receiver_clock(s_clock); - m_uart_s->set_transmitter_clock(s_clock); - - // boot-bank - membank("boot")->set_entry(1); - timer_set(attotime::from_usec(9), TIMER_SOL20_BOOT); -} - -DRIVER_INIT_MEMBER(sol20_state,sol20) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); -} - -void sol20_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -// Visible screen is 64 x 16, with start position controlled by scroll register. -// Each character is 9 pixels wide (blank ones at the right) and 13 lines deep. -// Note on blinking characters: -// any character with bit 7 set will blink. With DPMON, do DA C000 C2FF to see what happens - UINT16 which = (m_iop_config->read() & 2) << 10; - UINT8 s1 = m_iop_s1->read(); - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma,x,inv; - UINT8 polarity = (s1 & 8) ? 0xff : 0; - - bool cursor_inv = false; - if (((s1 & 0x30) == 0x20) || (((s1 & 0x30) == 0x10) && (m_framecnt & 0x08))) - cursor_inv = true; - - m_framecnt++; - - ma = m_sol20_fe << 6; // scroll register - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 13; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x++) - { - inv = polarity; - chr = m_p_videoram[x & 0x3ff]; - - // cursor - if (BIT(chr, 7) & cursor_inv) - inv ^= 0xff; - - chr &= 0x7f; - - if ((ra == 0) || ((s1 & 4) && (chr < 0x20))) - gfx = inv; - else - if ((chr==0x2C) || (chr==0x3B) || (chr==0x67) || (chr==0x6A) || (chr==0x70) || (chr==0x71) || (chr==0x79)) - { - if (ra < 4) - gfx = inv; - else - gfx = m_p_chargen[which | (chr<<4) | (ra-4) ] ^ inv; - } - else - { - if (ra < 10) - gfx = m_p_chargen[which | (chr<<4) | (ra-1) ] ^ inv; - else - gfx = inv; - } - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - *p++ = BIT(inv, 0); - } - } - ma+=64; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout sol20_charlayout = -{ - 7, 9, /* 7 x 9 characters */ - 128*2, /* 128 characters per rom */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( sol20 ) - GFXDECODE_ENTRY( "chargen", 0x0000, sol20_charlayout, 0, 1 ) -GFXDECODE_END - -WRITE8_MEMBER( sol20_state::kbd_put ) -{ - if (data) - { - m_sol20_fa &= 0xfe; - m_sol20_fc = data; - } -} - -static MACHINE_CONFIG_START( sol20, sol20_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_14_31818MHz/7) - MCFG_CPU_PROGRAM_MAP(sol20_mem) - MCFG_CPU_IO_MAP(sol20_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(sol20_state, screen_update) - MCFG_SCREEN_SIZE(576, 208) - MCFG_SCREEN_VISIBLE_AREA(0, 575, 0, 207) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", sol20) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // cass1 speaker - MCFG_SOUND_WAVE_ADD(WAVE2_TAG, "cassette2") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // cass2 speaker - - // devices - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(sol20_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("sol20_cass") - - MCFG_CASSETTE_ADD("cassette2") - MCFG_CASSETTE_FORMATS(sol20_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("sol20_cass") - - MCFG_DEVICE_ADD("uart", AY31015, 0) - MCFG_AY31015_TX_CLOCK(4800.0) - MCFG_AY31015_RX_CLOCK(4800.0) - MCFG_DEVICE_ADD("uart_s", AY31015, 0) - MCFG_AY31015_TX_CLOCK(4800.0) - MCFG_AY31015_RX_CLOCK(4800.0) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(sol20_state, kbd_put)) - - MCFG_SOFTWARE_LIST_ADD("cass_list", "sol20_cass") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sol20 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS(0, "solos", "SOLOS") - ROMX_LOAD( "solos.bin", 0xc000, 0x0800, CRC(4d0af383) SHA1(ac4510c3380ed4a31ccf4f538af3cb66b76701ef), ROM_BIOS(1) ) // from solace emu - ROM_SYSTEM_BIOS(1, "dpmon", "DPMON") - ROMX_LOAD( "dpmon.bin", 0xc000, 0x0800, BAD_DUMP CRC(2a84f099) SHA1(60ff6e38082c50afcf0f40707ef65668a411008b), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "consol", "CONSOL") - ROMX_LOAD( "consol.bin", 0xc000, 0x0400, BAD_DUMP CRC(80bf6d85) SHA1(84b81c60bb08a3a5435ec1be56a67aa695bce099), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "solos2", "Solos Patched") - ROMX_LOAD( "solos2.bin", 0xc000, 0x0800, CRC(7776cc7d) SHA1(c4739a9ea7e8146ce7ae3305ed526b6045efa9d6), ROM_BIOS(4) ) // from Nama - ROM_SYSTEM_BIOS(4, "bootload", "BOOTLOAD") - ROMX_LOAD( "bootload.bin", 0xc000, 0x0800, BAD_DUMP CRC(4261ac71) SHA1(4752408ac85d88857e8e9171c7f42bd623c9271e), ROM_BIOS(5) ) // from Nama -// This one doesn't work - ROM_SYSTEM_BIOS(5, "cuter", "CUTER") - ROMX_LOAD( "cuter.bin", 0xc000, 0x0800, BAD_DUMP CRC(39cca901) SHA1(33725d6da63e295552ee13f0a735d33aee8f0d17), ROM_BIOS(6) ) // from Nama - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "6574.bin", 0x0000, 0x0800, BAD_DUMP CRC(fd75df4f) SHA1(4d09aae2f933478532b7d3d1a2dee7123d9828ca) ) - ROM_LOAD( "6575.bin", 0x0800, 0x0800, BAD_DUMP CRC(cfdb76c2) SHA1(ab00798161d13f07bee3cf0e0070a2f0a805591f) ) -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1976, sol20, 0, 0, sol20, sol20, sol20_state, sol20, "Processor Technology Corporation", "SOL-20", 0 ) diff --git a/src/mess/drivers/pulsar.c b/src/mess/drivers/pulsar.c deleted file mode 100644 index b44cc9c8e6a..00000000000 --- a/src/mess/drivers/pulsar.c +++ /dev/null @@ -1,263 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Pulsar Little Big Board - -2013-12-29 Skeleton driver. - -Chips: Z80A @4MHz, Z80DART, FD1797-02, 8255A-5, AY-5-8116, MSM5832. -Crystals: 4 MHz, 5.0688 MHz, 32768. - -This is a complete CP/M single-board computer. You needed to supply your own -power supply and serial terminal. - -The terminal must be set for 9600 baud, 7 bits, even parity, 1 stop bit. - - -ToDo: -- Need software - - -Monitor Commands: -B - Boot from disk -D - Dump memory -F - Fill memory -G - Go -I - In port -L - Load bootstrap from drive A to 0x80 -M - Modify memory -O - Out port -P - choose which rs232 channel for the console -T - Test memory -V - Move memory -X - Test off-board memory banks - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80dart.h" -#include "machine/msm5832.h" -#include "machine/i8255.h" -#include "machine/com8116.h" -#include "machine/wd_fdc.h" - - -class pulsar_state : public driver_device -{ -public: - pulsar_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dart(*this, "z80dart"), - m_brg(*this, "brg"), - m_fdc (*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_rtc(*this, "rtc") - { - } - - DECLARE_DRIVER_INIT(pulsar); - DECLARE_MACHINE_RESET(pulsar); - TIMER_CALLBACK_MEMBER(pulsar_reset); - DECLARE_WRITE8_MEMBER(baud_w); - DECLARE_WRITE_LINE_MEMBER(fr_w); - DECLARE_WRITE_LINE_MEMBER(ft_w); - DECLARE_WRITE8_MEMBER(ppi_pa_w); - DECLARE_WRITE8_MEMBER(ppi_pb_w); - DECLARE_WRITE8_MEMBER(ppi_pc_w); - DECLARE_READ8_MEMBER(ppi_pc_r); - -private: - floppy_image_device *m_floppy; - required_device m_maincpu; - required_device m_dart; - required_device m_brg; - required_device m_fdc; - required_device m_floppy0; - required_device m_rtc; -}; - -static ADDRESS_MAP_START(pulsar_mem, AS_PROGRAM, 8, pulsar_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x0800, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_READ_BANK("bankr1") AM_WRITE_BANK("bankw1") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pulsar_io, AS_IO, 8, pulsar_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xc0, 0xc3) AM_MIRROR(0x0c) AM_DEVREADWRITE("z80dart", z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x0c) AM_DEVREADWRITE("fdc", fd1797_t, read, write) - AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("ppi", i8255_device, read, write) - AM_RANGE(0xf0, 0xff) AM_WRITE(baud_w) -ADDRESS_MAP_END - -// Schematic has the labels for FT and FR the wrong way around, -// the pin numbers are correct. -WRITE_LINE_MEMBER( pulsar_state::fr_w ) -{ - m_dart->rxca_w(state); - m_dart->txca_w(state); -} - -WRITE_LINE_MEMBER( pulsar_state::ft_w ) -{ - m_dart->rxcb_w(state); - m_dart->txcb_w(state); -} - -WRITE8_MEMBER( pulsar_state::baud_w ) -{ - m_brg->str_w(data & 0x0f); - m_brg->stt_w(data >> 4); -} - -/* after the first 4 bytes have been read from ROM, switch the ram back in */ -TIMER_CALLBACK_MEMBER( pulsar_state::pulsar_reset) -{ - membank("bankr0")->set_entry(1); -} - -static const z80_daisy_config daisy_chain_intf[] = -{ - { "z80dart" }, - { NULL } -}; - -/* -d0..d3 Drive select 0-3 (we only emulate 1 drive) -d4 Side select 0=side0 -d5 /DDEN -d6 /DSK_WAITEN (don't know what this is, not emulated) -d7 XMEMEX line (for external memory, not emulated) -*/ -WRITE8_MEMBER( pulsar_state::ppi_pa_w ) -{ - m_floppy = NULL; - if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); - m_fdc->set_floppy(m_floppy); - m_fdc->dden_w(BIT(data, 5)); -} - -/* -d0..d3 RTC address -d4 RTC read line (inverted in emulation) -d5 RTC write line (inverted in emulation) -d6 RTC hold line -d7 Allow 64k of ram -*/ -WRITE8_MEMBER( pulsar_state::ppi_pb_w ) -{ - m_rtc->address_w(data & 0x0f); - m_rtc->read_w(!BIT(data, 4)); - m_rtc->write_w(!BIT(data, 5)); - m_rtc->hold_w(BIT(data, 6)); - membank("bankr1")->set_entry(BIT(data, 7)); -} - -/* -d0..d3 Data lines to rtc -d7 /2 SIDES (assumed to be side select) -*/ -WRITE8_MEMBER( pulsar_state::ppi_pc_w ) -{ - m_rtc->data_w(space, 0, data & 15); - if (m_floppy) - m_floppy->ss_w(BIT(data, 7)); -} - -READ8_MEMBER( pulsar_state::ppi_pc_r ) -{ - return m_rtc->data_r(space, 0); -} - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -static SLOT_INTERFACE_START( pulsar_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -/* Input ports */ -static INPUT_PORTS_START( pulsar ) -INPUT_PORTS_END - -MACHINE_RESET_MEMBER( pulsar_state, pulsar ) -{ - machine().scheduler().timer_set(attotime::from_usec(3), timer_expired_delegate(FUNC(pulsar_state::pulsar_reset),this)); - membank("bankr0")->set_entry(0); // point at rom - membank("bankw0")->set_entry(0); // always write to ram - membank("bankr1")->set_entry(1); // point at rom - membank("bankw1")->set_entry(0); // always write to ram - m_rtc->cs_w(1); // always enabled -} - -DRIVER_INIT_MEMBER( pulsar_state, pulsar ) -{ - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(1, &main[0x0000]); - membank("bankr0")->configure_entry(0, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); - - membank("bankr1")->configure_entry(0, &main[0xf800]); - membank("bankr1")->configure_entry(1, &main[0x10000]); - membank("bankw1")->configure_entry(0, &main[0xf800]); -} - -static MACHINE_CONFIG_START( pulsar, pulsar_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(pulsar_mem) - MCFG_CPU_IO_MAP(pulsar_io) - MCFG_CPU_CONFIG(daisy_chain_intf) - MCFG_MACHINE_RESET_OVERRIDE(pulsar_state, pulsar) - - /* Devices */ - MCFG_DEVICE_ADD("ppi", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(pulsar_state, ppi_pa_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(pulsar_state, ppi_pb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(pulsar_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(pulsar_state, ppi_pc_w)) - - MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) - - MCFG_Z80DART_ADD("z80dart", XTAL_4MHz, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80dart", z80dart_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("z80dart", z80dart_device, ctsa_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(pulsar_state, fr_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE(pulsar_state, ft_w)) - - MCFG_FD1797_ADD("fdc", XTAL_4MHz / 2) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "525dd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pulsarlb ) - ROM_REGION( 0x10800, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mp7a.bin", 0x10000, 0x800, CRC(726b8a19) SHA1(43b2af84d5622c1f67584c501b730acf002a6113) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, pulsarlb, 0, 0, pulsar, pulsar, pulsar_state, pulsar, "Pulsar", "Little Big Board", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/pv1000.c b/src/mess/drivers/pv1000.c deleted file mode 100644 index 7ba26775c81..00000000000 --- a/src/mess/drivers/pv1000.c +++ /dev/null @@ -1,482 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - Driver for Casio PV-1000 - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -// PV-1000 Sound device - -class pv1000_sound_device : public device_t, - public device_sound_interface -{ -public: - pv1000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_WRITE8_MEMBER(voice_w); - -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -private: - - // internal state - struct - { - UINT32 count; - UINT16 period; - UINT8 val; - } m_voice[4]; - - sound_stream *m_sh_channel; -}; - -extern const device_type PV1000; - -const device_type PV1000 = &device_creator; - -pv1000_sound_device::pv1000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PV1000, "NEC D65010G031", tag, owner, clock, "pv1000_sound", __FILE__), - device_sound_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void pv1000_sound_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pv1000_sound_device::device_start() -{ - m_sh_channel = machine().sound().stream_alloc(*this, 0, 1, clock() / 1024); - - save_item(NAME(m_voice[0].count)); - save_item(NAME(m_voice[0].period)); - save_item(NAME(m_voice[0].val)); - save_item(NAME(m_voice[1].count)); - save_item(NAME(m_voice[1].period)); - save_item(NAME(m_voice[1].val)); - save_item(NAME(m_voice[2].count)); - save_item(NAME(m_voice[2].period)); - save_item(NAME(m_voice[2].val)); - // are these ever used? - save_item(NAME(m_voice[3].count)); - save_item(NAME(m_voice[3].period)); - save_item(NAME(m_voice[3].val)); -} - -WRITE8_MEMBER(pv1000_sound_device::voice_w) -{ - offset &= 0x03; - m_voice[offset].period = data; -} - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - - -/* - plgDavid's audio implementation/analysis notes: - - Sound appears to be 3 50/50 pulse voices made by cutting the main clock by 1024, - then by the value of the 6bit period registers. - This creates a surprisingly accurate pitch range. - - Note: the register periods are inverted. - */ - -void pv1000_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) -{ - stream_sample_t *buffer = outputs[0]; - - while (samples > 0) - { - *buffer=0; - - for (int i = 0; i < 3; i++) - { - UINT32 per = (0x3f - (m_voice[i].period & 0x3f)); - - if (per != 0) //OFF! - *buffer += m_voice[i].val * 8192; - - m_voice[i].count++; - - if (m_voice[i].count >= per) - { - m_voice[i].count = 0; - m_voice[i].val = !m_voice[i].val; - } - } - - buffer++; - samples--; - } -} - - -// PV-1000 System - - -class pv1000_state : public driver_device -{ -public: - pv1000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_sound(*this, "pv1000_sound"), - m_cart(*this, "cartslot"), - m_p_videoram(*this, "p_videoram"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") - { } - - DECLARE_WRITE8_MEMBER(io_w); - DECLARE_READ8_MEMBER(io_r); - DECLARE_WRITE8_MEMBER(gfxram_w); - UINT8 m_io_regs[8]; - UINT8 m_fd_data; - - emu_timer *m_irq_on_timer; - emu_timer *m_irq_off_timer; - UINT8 m_pcg_bank; - UINT8 m_force_pattern; - UINT8 m_fd_buffer_flag; - UINT8 m_border_col; - - UINT8 * m_gfxram; - void pv1000_postload(); - - required_device m_maincpu; - required_device m_sound; - required_device m_cart; - required_shared_ptr m_p_videoram; - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update_pv1000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(d65010_irq_on_cb); - TIMER_CALLBACK_MEMBER(d65010_irq_off_cb); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( pv1000_cart ); - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; -}; - - -static ADDRESS_MAP_START( pv1000, AS_PROGRAM, 8, pv1000_state ) - //AM_RANGE(0x0000, 0x7fff) // mapped by the cartslot - AM_RANGE(0xb800, 0xbbff) AM_RAM AM_SHARE("p_videoram") - AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(gfxram_w) AM_REGION("gfxram", 0) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( pv1000_io, AS_IO, 8, pv1000_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf8, 0xff) AM_READWRITE(io_r, io_w) -ADDRESS_MAP_END - - -WRITE8_MEMBER( pv1000_state::gfxram_w ) -{ - UINT8 *gfxram = memregion( "gfxram" )->base(); - - gfxram[ offset ] = data; - m_gfxdecode->gfx(1)->mark_dirty(offset/32); -} - - -WRITE8_MEMBER( pv1000_state::io_w ) -{ - switch (offset) - { - case 0x00: - case 0x01: - case 0x02: - //logerror("io_w offset=%02x, data=%02x (%03d)\n", offset, data , data); - m_sound->voice_w(space, offset, data); - break; - - case 0x03: - //currently unknown use - break; - - case 0x05: - m_fd_data = 0xf; - break; -// case 0x06 VRAM + PCG location, always fixed at 0xb8xx - case 0x07: - /* ---- -xxx unknown, border color? */ - m_pcg_bank = (data & 0x20) >> 5; - m_force_pattern = ((data & 0x10) >> 4); /* Dig Dug relies on this */ - m_border_col = data & 7; - break; - } - - m_io_regs[offset] = data; -} - - -READ8_MEMBER( pv1000_state::io_r ) -{ - UINT8 data = m_io_regs[offset]; - -// logerror("io_r offset=%02x\n", offset ); - - switch ( offset ) - { - case 0x04: - /* Bit 1 = 1 => Data is available in port FD */ - /* Bit 0 = 1 => Buffer at port FD is empty */ - data = 0; - data = m_fd_buffer_flag & 1; - data |= m_fd_data ? 2 : 0; - m_fd_buffer_flag &= ~1; - break; - case 0x05: - static const char *const joynames[] = { "IN0", "IN1", "IN2", "IN3" }; - - data = 0; - - for (int i = 0; i < 4; i++) - { - if (m_io_regs[5] & 1 << i) - { - data |= ioport(joynames[i])->read(); - m_fd_data &= ~(1 << i); - } - } - - //m_fd_data = 0; - break; - } - - return data; -} - - -static INPUT_PORTS_START( pv1000 ) - PORT_START( "IN0" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(2) - - PORT_START( "IN1" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY - - PORT_START( "IN2" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY - - PORT_START( "IN3" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) -INPUT_PORTS_END - - -DEVICE_IMAGE_LOAD_MEMBER( pv1000_state, pv1000_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size != 0x2000 && size != 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - -UINT32 pv1000_state::screen_update_pv1000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y; - - bitmap.fill(m_border_col); // TODO: might be either black or colored by this register - - for ( y = 0; y < 24; y++ ) - { - for ( x = 2; x < 30; x++ ) // left-right most columns are definitely masked by the border color - { - UINT16 tile = m_p_videoram[ y * 32 + x ]; - - if ( tile < 0xe0 || m_force_pattern ) - { - tile += ( m_pcg_bank << 8); - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*8 ); - } - else - { - tile -= 0xe0; - m_gfxdecode->gfx(1)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*8 ); - } - } - } - - return 0; -} - - - -/* Interrupt is triggering 16 times during vblank. */ -/* we have chosen to trigger on scanlines 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255 */ -TIMER_CALLBACK_MEMBER(pv1000_state::d65010_irq_on_cb) -{ - int vpos = m_screen->vpos(); - int next_vpos = vpos + 4; - - if(vpos == 195) - m_fd_buffer_flag |= 1; /* TODO: exact timing of this */ - - /* Set IRQ line and schedule release of IRQ line */ - m_maincpu->set_input_line(0, ASSERT_LINE ); - m_irq_off_timer->adjust( m_screen->time_until_pos(vpos, 380/2 ) ); - - /* Schedule next IRQ trigger */ - if ( vpos >= 255 ) - { - next_vpos = 195; - } - m_irq_on_timer->adjust( m_screen->time_until_pos(next_vpos, 0 ) ); -} - - -TIMER_CALLBACK_MEMBER(pv1000_state::d65010_irq_off_cb) -{ - m_maincpu->set_input_line(0, CLEAR_LINE ); -} - - -void pv1000_state::pv1000_postload() -{ - // restore GFX ram - for (int i = 0; i < 0x400; i++) - gfxram_w(m_maincpu->space(AS_PROGRAM), i, m_gfxram[i]); -} - -void pv1000_state::machine_start() -{ - m_irq_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_on_cb),this)); - m_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_off_cb),this)); - - m_gfxram = memregion("gfxram")->base(); - save_pointer(NAME(m_gfxram), 0x400); - - if (m_cart->exists()) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x7fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - // FIXME: this is needed for gfx decoding, but there is probably a cleaner solution! - std::string region_tag; - memcpy(memregion("gfxrom")->base(), memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str())->base(), m_cart->get_rom_size()); - } - - save_item(NAME(m_io_regs)); - save_item(NAME(m_fd_data)); - save_item(NAME(m_pcg_bank)); - save_item(NAME(m_force_pattern)); - save_item(NAME(m_fd_buffer_flag)); - save_item(NAME(m_border_col)); - - machine().save().register_postload(save_prepost_delegate(FUNC(pv1000_state::pv1000_postload), this)); -} - - -void pv1000_state::machine_reset() -{ - m_io_regs[5] = 0; - m_fd_data = 0; - m_irq_on_timer->adjust(m_screen->time_until_pos(195, 0)); - m_irq_off_timer->adjust(attotime::never); -} - - -static const gfx_layout pv1000_3bpp_gfx = -{ - 8, 8, /* 8x8 characters */ - RGN_FRAC(1,1), - 3, - { 0, 8*8, 16*8 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8*4 -}; - - -static GFXDECODE_START( pv1000 ) - GFXDECODE_ENTRY( "gfxrom", 8, pv1000_3bpp_gfx, 0, 8 ) - GFXDECODE_ENTRY( "gfxram", 8, pv1000_3bpp_gfx, 0, 8 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( pv1000, pv1000_state ) - - MCFG_CPU_ADD( "maincpu", Z80, 17897725/5 ) - MCFG_CPU_PROGRAM_MAP( pv1000 ) - MCFG_CPU_IO_MAP( pv1000_io ) - - - /* D65010G031 - Video & sound chip */ - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_RAW_PARAMS( 17897725/3, 380, 0, 256, 262, 0, 192 ) - MCFG_SCREEN_UPDATE_DRIVER(pv1000_state, screen_update_pv1000) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_3BIT_BGR("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pv1000 ) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD( "pv1000_sound", PV1000, 17897725 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - /* Cartridge slot */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "pv1000_cart") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(pv1000_state, pv1000_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","pv1000") -MACHINE_CONFIG_END - - -ROM_START( pv1000 ) - ROM_REGION( 0x4000, "gfxrom", ROMREGION_ERASE00 ) - ROM_REGION( 0x400, "gfxram", ROMREGION_ERASE00 ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1983, pv1000, 0, 0, pv1000, pv1000, driver_device, 0, "Casio", "PV-1000", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/pv2000.c b/src/mess/drivers/pv2000.c deleted file mode 100644 index a0084f36143..00000000000 --- a/src/mess/drivers/pv2000.c +++ /dev/null @@ -1,428 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/* - -CASIO PV-2000 - -(preliminary work by anondumper) -Thanks for the loaner (Ianoid) - -NOTE: -The PCB has printed names of components, not ICXY, etc -but: "hn613128pc64.bin" - -SEE -http://hou4gong1.mo-blog.jp/.shared/image.html?/photos/uncategorized/pv_2000_k1.jpg -http://hou4gong1.mo-blog.jp/.shared/image.html?/photos/uncategorized/pv_2000_14.jpg -http://hou4gong1.mo-blog.jp/.shared/image.html?/photos/uncategorized/pv_2000_15.jpg - -Keyboard inputs are partially supported. Keys missing from the input ports: -- GAME - no beep in basic - is this really a key? - -Todo: -- Add joystick support -- Cassette support - -Also See: -http://www2.odn.ne.jp/~haf09260/Pv2000/EnrPV.htm -For BIOS CRC confirmation -*/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/sn76496.h" -#include "sound/wave.h" -#include "video/tms9928a.h" -#include "imagedev/cassette.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class pv2000_state : public driver_device -{ -public: - pv2000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cass(*this, "cassette"), - m_cart(*this, "cartslot"), - m_last_state(0) - { } - - required_device m_maincpu; - required_device m_cass; - required_device m_cart; - DECLARE_WRITE8_MEMBER(cass_conf_w); - DECLARE_WRITE8_MEMBER(keys_w); - DECLARE_READ8_MEMBER(keys_hi_r); - DECLARE_READ8_MEMBER(keys_lo_r); - DECLARE_READ8_MEMBER(keys_mod_r); - DECLARE_WRITE_LINE_MEMBER(pv2000_vdp_interrupt); - DECLARE_READ8_MEMBER(cass_in); - DECLARE_WRITE8_MEMBER(cass_out); - bool m_last_state; - UINT8 m_key_pressed; - UINT8 m_keyb_column; - UINT8 m_cass_conf; - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pv2000_cart); -}; - - -WRITE8_MEMBER( pv2000_state::cass_conf_w ) -{ - logerror( "%s: cass_conf_w %02x\n", machine().describe_context(), data ); - - m_cass_conf = data & 0x0f; - - if ( m_cass_conf & 0x01 ) - m_cass->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - else - m_cass->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); -} - - -WRITE8_MEMBER( pv2000_state::keys_w ) -{ - logerror( "%s: keys_w %02x\n", machine().describe_context(), data ); - - m_keyb_column = data & 0x0f; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); -} - - -READ8_MEMBER( pv2000_state::keys_hi_r ) -{ - UINT8 data = 0; - char kbdrow[6]; - - switch ( m_keyb_column ) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - sprintf(kbdrow,"IN%d",m_keyb_column); - data = ioport( kbdrow )->read() >> 4; - } - - return data; -} - - -READ8_MEMBER( pv2000_state::keys_lo_r ) -{ - UINT8 data = 0; - char kbdrow[6]; - - logerror("%s: pv2000_keys_r\n", machine().describe_context() ); - - switch ( m_keyb_column ) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - sprintf(kbdrow,"IN%d",m_keyb_column); - data = ioport( kbdrow )->read() & 0x0f; - } - - return 0xf0 | data; -} - - -READ8_MEMBER( pv2000_state::keys_mod_r ) -{ - return 0xf0 | ioport( "MOD" )->read(); -} - -READ8_MEMBER( pv2000_state::cass_in ) -{ - // from what i can tell, - // 0 = data in - // 1 = must be high - // 2 = must be low - // bits 1 & 2 are checked while reading and writing tapes - // Press STOP key (F1) to cancel LOAD or SAVE - - return 2 | ((m_cass->input() > +0.03) ? 1 : 0); -} - -WRITE8_MEMBER( pv2000_state::cass_out ) -{ - // it outputs 8-bit values here which are not the bytes in the file - // result is not readable - - m_cass->output( BIT(data, 0) ? -1.0 : +1.0); -} - - -/* Memory Maps */ - -static ADDRESS_MAP_START( pv2000_map, AS_PROGRAM, 8, pv2000_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - - AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) - AM_RANGE(0x4001, 0x4001) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) - - AM_RANGE(0x7000, 0x7fff) AM_RAM - //AM_RANGE(0x8000, 0xbfff) ext ram? - //AM_RANGE(0xc000, 0xffff) // mapped by the cartslot -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( pv2000_io_map, AS_IO, 8, pv2000_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - - //theres also printer and tape I/O (TODO) - AM_RANGE(0x00, 0x00) AM_WRITE(cass_conf_w) - - //keyboard/joystick - AM_RANGE(0x10, 0x10) AM_READ(keys_hi_r) - AM_RANGE(0x20, 0x20) AM_READWRITE(keys_lo_r, keys_w) - - //sn76489a - AM_RANGE(0x40, 0x40) AM_READ(keys_mod_r) AM_DEVWRITE("sn76489a", sn76489a_device, write) - - /* Cassette input. Gets hit a lot after a GLOAD command */ - AM_RANGE(0x60, 0x60) AM_READWRITE(cass_in,cass_out) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( pv2000 ) - PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - - PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - - PORT_START("IN3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Hiragana") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - - PORT_START("IN4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Yen") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN4_1") /* Game?? DEL / MODE / STOP ??, no beep in basic, START in galaga */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN4_2") /* DEL / MODE / STOP ??, no beep in basic, SELECT in galaga */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_START("IN5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CRSR Up+Left") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CRSR Down+Left") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CRSR Down+Right") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CRSR Up+Right") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - - PORT_START("IN6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN6_2") /* Unknown ??, no beep in basic */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN6_3") /* Unknown ??, no beep in basic */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - - PORT_START("IN7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN7_2") /* Unknown ??, no beep in basic */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN7_3") /* Unknown ??, no beep in basic */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("IN8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_NAME("Attack 0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_NAME("Attack 1") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN8_2") /* Unknown ?, no beep in basic */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN8_3") /* Unknown ?, no beep in basic */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Mode") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("IN8_7") /* Unknown ?, no beep in basic */ - - PORT_START("IN9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("Stop") - - PORT_START("MOD") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_NAME("Color") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_NAME("Func") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - -INPUT_PORTS_END - - -WRITE_LINE_MEMBER( pv2000_state::pv2000_vdp_interrupt ) -{ - // only if it goes up - if (state && !m_last_state) - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - - m_last_state = state; - - /* Check if irq triggering from keyboard presses is enabled */ - if ( m_keyb_column == 0x0f ) - { - /* Check if a key is pressed */ - UINT8 key_pressed; - - key_pressed = ioport( "IN0" )->read() - | ioport( "IN1" )->read() - | ioport( "IN2" )->read() - | ioport( "IN3" )->read() - | ioport( "IN4" )->read() - | ioport( "IN5" )->read() - | ioport( "IN6" )->read() - | ioport( "IN7" )->read() - | ioport( "IN8" )->read(); - - if ( key_pressed && m_key_pressed != key_pressed ) - m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); - - m_key_pressed = key_pressed; - } -} - - - -/* Machine Initialization */ - -void pv2000_state::machine_start() -{ - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -void pv2000_state::machine_reset() -{ - m_last_state = 0; - m_key_pressed = 0; - m_keyb_column = 0; - - m_maincpu->set_input_line_vector(INPUT_LINE_IRQ0, 0xff); - memset(&memregion("maincpu")->base()[0x7000], 0xff, 0x1000); // initialize RAM -} - -DEVICE_IMAGE_LOAD_MEMBER( pv2000_state, pv2000_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size != 0x2000 && size != 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -/* Machine Drivers */ -static MACHINE_CONFIG_START( pv2000, pv2000_state ) - - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, XTAL_7_15909MHz/2) // 3.579545 MHz - MCFG_CPU_PROGRAM_MAP(pv2000_map) - MCFG_CPU_IO_MAP(pv2000_io_map) - - // video hardware - MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(pv2000_state, pv2000_vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("sn76489a", SN76489A, XTAL_7_15909MHz/2) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pv2000_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom,col") - MCFG_GENERIC_LOAD(pv2000_state, pv2000_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","pv2000") -MACHINE_CONFIG_END - - - -/* ROMs */ -ROM_START (pv2000) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "hn613128pc64.bin", 0x0000, 0x4000, CRC(8f31f297) SHA1(94b5f54dd7bce321e377fdaaf592acd3870cf621) ) -ROM_END - - -/* System Drivers */ - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -CONS( 1983, pv2000, 0, 0, pv2000, pv2000, driver_device, 0, "Casio", "PV-2000", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pv9234.c b/src/mess/drivers/pv9234.c deleted file mode 100644 index 339492d7874..00000000000 --- a/src/mess/drivers/pv9234.c +++ /dev/null @@ -1,170 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - -PowerVu D9234 STB (c) 1997 Scientific Atlanta - -20-mar-2010 skeleton driver - -http://www.vetrun.net/forums/showthread.php?t=395 -http://colibri.net63.net/powervu.htm -http://www.growl.de/d9234/ - -Google 'powervu 9234' for plenty more info. - -Meant for payTV providers to decrypt signals from the satellite and pump -them out on a local cable network. The powervu encryption is very secure. - -There is a menu system, and with the right equipment, many secrets can -be found! - -****************************************************************************/ - -#include "emu.h" -#include "cpu/arm7/arm7.h" - - -class pv9234_state : public driver_device -{ -public: - pv9234_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_ram(*this, "p_ram"), - m_maincpu(*this, "maincpu") { } - - DECLARE_WRITE32_MEMBER(debug_w); - DECLARE_WRITE32_MEMBER(debug1_w); - DECLARE_WRITE32_MEMBER(debug2_w); - required_shared_ptr m_p_ram; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_pv9234(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -/* -This is the serial output to a terminal, used for debugging. -The boot process goes something like this: - -Start - -Config: 0x00001080 (Max Config: 00003C80) -MV 00000004.00000003 -DL Avail -IOP Com. O.K. 00000004 -Check CRC ... -CRC O.K. -Launch App -************** -* Ver 2.05 * -************** -Compiled by: FURLANO -Date & time: Nov 3 1997, 15:34:29 -All printing enabled. Press space bar to toggle on/off. -Time stamping enabled. Press 't' to turn on/off. -Press 'o' to toggle printing of MPEG Xport error messages. -*/ -WRITE32_MEMBER( pv9234_state::debug_w ) -{ - if (data) - { - printf("%02x %c\n",data,data); // this prints 'Start' to the console. - logerror("debug=%02x %c\n",data,data); - } -} - -WRITE32_MEMBER( pv9234_state::debug1_w ) -{ - UINT8 i,j; - if (data) - { - for (i = 0; i < 4; i++) - { - j = (data & 0xff000000) >> 24; - data <<= 8; -// printf("%c",j); // this prints 'OFF' to the console. - logerror("debug1=%02x %c\n",j,j); - } -// printf("\n"); - } -} - -WRITE32_MEMBER( pv9234_state::debug2_w ) -{ - if (data) - logerror("debug2=%02x\n",data); // ignore the huge amount of zeroes here -} - -static ADDRESS_MAP_START(pv9234_map, AS_PROGRAM, 32, pv9234_state) - // AM_RANGE(0x00000000, 0x00000033) AM_WRITE something - // AM_RANGE(0x00000044, 0x00000047) AM_WRITE something - // AM_RANGE(0x00000060, 0x0000006b) AM_WRITE something - // AM_RANGE(0x00007000, 0x00007003) AM_WRITE something - // AM_RANGE(0x00008000, 0x00008003) AM_WRITE something - AM_RANGE(0x00008014, 0x00008017) AM_WRITE(debug1_w) - // AM_RANGE(0x00008020, 0x00008027) AM_WRITE something - AM_RANGE(0x000080c0, 0x000080c3) AM_WRITE(debug2_w) - AM_RANGE(0x000080cc, 0x000080cf) AM_WRITE(debug_w) - // AM_RANGE(0x000080d0, 0x000080d3) AM_WRITE something - AM_RANGE(0x0003e000, 0x0003efff) AM_RAM AM_SHARE("p_ram") - AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_REGION("maincpu",0) //FLASH ROM! - AM_RANGE(0x00080000, 0x00087fff) AM_MIRROR(0x78000) AM_RAM AM_SHARE("share1")//mirror is a guess, writes a prg at 0xc0200 then it jumps at b0200 (!) - AM_RANGE(0xe0000000, 0xe0007fff) AM_MIRROR(0x0fff8000) AM_RAM AM_SHARE("share1") - AM_RANGE(0xffffff00, 0xffffffff) AM_RAM //i/o? stack ram? -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( pv9234 ) -INPUT_PORTS_END - - -void pv9234_state::machine_reset() -{ - int i; - - for(i=0;i<0x1000/4;i++) - m_p_ram[i] = 0; -} - -void pv9234_state::video_start() -{ -} - -UINT32 pv9234_state::screen_update_pv9234(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( pv9234, pv9234_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", ARM7, 4915000) //probably a more powerful clone. - MCFG_CPU_PROGRAM_MAP(pv9234_map) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(pv9234_state, screen_update_pv9234) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pv9234 ) - ROM_REGION32_LE( 0x80000, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD16_BYTE( "u19.bin", 0x00000, 0x20000, CRC(1e06b0c8) SHA1(f8047f7127919e73675375578bb9fcc0eed2178e)) - ROM_LOAD16_BYTE( "u18.bin", 0x00001, 0x20000, CRC(924487dd) SHA1(fb1d7c9a813ded8c820589fa85ae72265a0427c7)) - ROM_LOAD16_BYTE( "u17.bin", 0x40000, 0x20000, CRC(cac03650) SHA1(edd8aec6fed886d47de39ed4e127de0a93250a45)) - ROM_LOAD16_BYTE( "u16.bin", 0x40001, 0x20000, CRC(bd07d545) SHA1(90a63af4ee82b0f7d0ed5f0e09569377f22dd98c)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -SYST( 1997, pv9234, 0, 0, pv9234, pv9234, driver_device, 0, "Scientific Atlanta", "PowerVu D9234", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/pve500.c b/src/mess/drivers/pve500.c deleted file mode 100644 index 9bc202d51e1..00000000000 --- a/src/mess/drivers/pve500.c +++ /dev/null @@ -1,441 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders: Felipe Sanches -/*************************************************************************** - - SONY PVE-500 Editing Control Unit - "A/B roll edit controller for professional video editing applications" - - Driver by Felipe Correa da Silva Sanches - Technical info at https://www.garoa.net.br/wiki/PVE-500 - - Notes: - One can induce the self-diagnose by booting the device holding LEARN and P2-RESET buttons togheter - With the default keyboard map, this can be done by holding keys L and S while pressing F3. - (Don't forget to unlock the keyboard by using the UI TOGGLE key) - - This self-diagnose routine displays the value C817, which is the checksum value of the subcpu ROM - and afterwards it displays the following message: - - SELFdIAG Error___ _F3 F3_CtC3c - - which means it detected an error in the CTC circuitry (it means we're emulating it wrong!) - F3 is the coordinate of the subcpu EPROM chip in the PCB. - - According to the service manual, this error code means: "ICF3 CTC CH-3 counter operation failure (No interruption)" - - Known issues: - There's still an annoying blinking in the 7-seg display. - - Changelog: - - 2014 SEP 01 [Felipe Sanches]: - * hooked-up MB8421 device (dual-port SRAM) - - 2014 JUN 24 [Felipe Sanches]: - * figured out the multiplexing signals for the 7-seg display - - 2014 JUN 23 [Felipe Sanches]: - * hooked-up the RS422 ports - - 2014 JAN 14 [Felipe Sanches]: - * Initial driver skeleton -*/ - -#define LOG_7SEG_DISPLAY_SIGNALS 0 -#define DEBUGGING_INDUCE_SELFDIAGNOSE 0 - -#include "emu.h" -#include "cpu/z80/tmpz84c015.h" -#include "cpu/mb88xx/mb88xx.h" -#include "sound/beep.h" -#include "bus/rs232/rs232.h" /* actually meant to be RS422 ports */ -#include "pve500.lh" -#include "machine/mb8421.h" -#include "machine/eepromser.h" - -#define IO_EXPANDER_PORTA 0 -#define IO_EXPANDER_PORTB 1 -#define IO_EXPANDER_PORTC 2 -#define IO_EXPANDER_PORTD 3 -#define IO_EXPANDER_PORTE 4 - -class pve500_state : public driver_device -{ -public: - pve500_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_subcpu(*this, "subcpu") - , m_eeprom(*this, "eeprom") - , m_buzzer(*this, "buzzer") - { } - - DECLARE_WRITE_LINE_MEMBER(mb8421_intl); - DECLARE_WRITE_LINE_MEMBER(mb8421_intr); - DECLARE_WRITE_LINE_MEMBER(GPI_w); - DECLARE_WRITE_LINE_MEMBER(external_monitor_w); - - DECLARE_WRITE8_MEMBER(io_expander_w); - DECLARE_READ8_MEMBER(io_expander_r); - DECLARE_WRITE8_MEMBER(eeprom_w); - DECLARE_READ8_MEMBER(eeprom_r); - DECLARE_DRIVER_INIT(pve500); -private: - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_subcpu; - required_device m_eeprom; - required_device m_buzzer; - UINT8 io_SEL, io_LD, io_LE, io_SC, io_KY; -}; - -WRITE_LINE_MEMBER( pve500_state::GPI_w ) -{ - /* TODO: Implement-me */ -} - -WRITE_LINE_MEMBER( pve500_state::external_monitor_w ) -{ - /* TODO: Implement-me */ -} - -static const z80_daisy_config maincpu_daisy_chain[] = -{ - TMPZ84C015_DAISY_INTERNAL, - { "external_ctc" }, - { "external_sio" }, - { NULL } -}; - - -static ADDRESS_MAP_START(maincpu_io, AS_IO, 8, pve500_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("external_sio", z80sio0_device, cd_ba_r, cd_ba_w) - AM_RANGE(0x08, 0x0B) AM_DEVREADWRITE("external_ctc", z80ctc_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(maincpu_prg, AS_PROGRAM, 8, pve500_state) - AM_RANGE (0x0000, 0xBFFF) AM_ROM // ICB7: 48kbytes EPROM - AM_RANGE (0xC000, 0xDFFF) AM_RAM // ICD6: 8kbytes of RAM - AM_RANGE (0xE000, 0xE7FF) AM_MIRROR(0x1800) AM_DEVREADWRITE("mb8421", mb8421_device, left_r, left_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(subcpu_io, AS_IO, 8, pve500_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(subcpu_prg, AS_PROGRAM, 8, pve500_state) - AM_RANGE (0x0000, 0x7FFF) AM_ROM // ICG5: 32kbytes EPROM - AM_RANGE (0x8000, 0xBFFF) AM_MIRROR(0x3FF8) AM_READWRITE(io_expander_r, io_expander_w) // ICG3: I/O Expander - AM_RANGE (0xC000, 0xC7FF) AM_MIRROR(0x3800) AM_DEVREADWRITE("mb8421", mb8421_device, right_r, right_w) -ADDRESS_MAP_END - -DRIVER_INIT_MEMBER( pve500_state, pve500 ) -{ -} - -static INPUT_PORTS_START( pve500 ) - PORT_START("SCAN0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRANS") PORT_CODE(KEYCODE_5) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A/B") PORT_CODE(KEYCODE_4) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FROM TO") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) - - PORT_START("SCAN1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALL STOP") PORT_CODE(KEYCODE_M) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LAST EDIT") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AUDIO SPLIT") PORT_CODE(KEYCODE_T) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A2") PORT_CODE(KEYCODE_9) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ASMBL") PORT_CODE(KEYCODE_6) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_7) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_8) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) - - PORT_START("SCAN2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RVW/JUMP") PORT_CODE(KEYCODE_N) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AUTO EDIT") PORT_CODE(KEYCODE_B) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PREVIEW") PORT_CODE(KEYCODE_V) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-FF") PORT_CODE(KEYCODE_R) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-REW") PORT_CODE(KEYCODE_E) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-STILL") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-PLAY") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) - - PORT_START("SCAN3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-OUT") PORT_CODE(KEYCODE_K) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-IN") PORT_CODE(KEYCODE_J) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GO TO") PORT_CODE(KEYCODE_H) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-OUT") PORT_CODE(KEYCODE_G) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P-IN") PORT_CODE(KEYCODE_F) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRIM+") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRIM-") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) - - PORT_START("SCAN4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-FF") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-REW") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-STILL") PORT_CODE(KEYCODE_P) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-PLAY") PORT_CODE(KEYCODE_O) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EDIT") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REC") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTRY") PORT_CODE(KEYCODE_SPACE) - - PORT_START("SCAN5") - PORT_DIPNAME( 0x03, 0x02, "R-EDIT REF" ) - PORT_DIPSETTING( 0x02, "TC" ) - PORT_DIPSETTING( 0x00, "RTC" ) - PORT_DIPSETTING( 0x01, "CTL" ) - - PORT_DIPNAME( 0x0C, 0x08, "P2-EDIT REF" ) - PORT_DIPSETTING( 0x08, "TC" ) - PORT_DIPSETTING( 0x00, "RTC" ) - PORT_DIPSETTING( 0x04, "CTL" ) - - PORT_DIPNAME( 0x30, 0x20, "P1-EDIT REF" ) - PORT_DIPSETTING( 0x20, "TC" ) - PORT_DIPSETTING( 0x00, "RTC" ) - PORT_DIPSETTING( 0x10, "CTL" ) - - PORT_START("SCAN6") - PORT_DIPNAME( 0x03, 0x02, "SYNCHRO" ) - PORT_DIPSETTING( 0x02, "ON/CF" ) - PORT_DIPSETTING( 0x00, "ON" ) - PORT_DIPSETTING( 0x01, "OFF" ) - - PORT_DIPNAME( 0x0C, 0x08, "PREROLL" ) - PORT_DIPSETTING( 0x08, "7" ) - PORT_DIPSETTING( 0x00, "5" ) - PORT_DIPSETTING( 0x04, "3" ) - - PORT_START("SCAN7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TOTAL") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEARN") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRANS-1F") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRANS-10F") PORT_CODE(KEYCODE_X) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRANS-100F") PORT_CODE(KEYCODE_C) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R-RESET") PORT_CODE(KEYCODE_A) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P2-RESET") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1-RESET") PORT_CODE(KEYCODE_D) -INPUT_PORTS_END - -void pve500_state::machine_start() -{ - io_LD = 0; - io_SC = 0; - io_LE = 0; - io_SEL = 0; - io_KY = 0; -} - -void pve500_state::machine_reset() -{ - /* Setup beep */ - m_buzzer->set_state(0); - m_buzzer->set_frequency(3750); //CLK2 coming out of IC D4 (frequency divider circuitry) -} - -WRITE_LINE_MEMBER(pve500_state::mb8421_intl) -{ - // shared ram interrupt request from subcpu side - m_maincpu->trg1(state); -} - -WRITE_LINE_MEMBER(pve500_state::mb8421_intr) -{ - // shared ram interrupt request from maincpu side - m_subcpu->trg1(state); -} - -READ8_MEMBER(pve500_state::eeprom_r) -{ - return (m_eeprom->ready_read() << 1) | m_eeprom->do_read(); -} - -WRITE8_MEMBER(pve500_state::eeprom_w) -{ - m_eeprom->di_write( (data & (1 << 2)) ? ASSERT_LINE : CLEAR_LINE); - m_eeprom->clk_write( (data & (1 << 3)) ? ASSERT_LINE : CLEAR_LINE); - m_eeprom->cs_write( (data & (1 << 4)) ? ASSERT_LINE : CLEAR_LINE); -} - -READ8_MEMBER(pve500_state::io_expander_r) -{ -// printf("READ IO_EXPANDER_PORT%c\n", 'A'+offset); - switch (offset){ - case IO_EXPANDER_PORTA: - return io_SC; - case IO_EXPANDER_PORTB: - return io_LE; - case IO_EXPANDER_PORTC: - io_KY = 0x00; - if (!BIT(io_SC, 0)) io_KY |= ioport("SCAN0")->read(); - if (!BIT(io_SC, 1)) io_KY |= ioport("SCAN1")->read(); - if (!BIT(io_SC, 2)) io_KY |= ioport("SCAN2")->read(); - if (!BIT(io_SC, 3)) io_KY |= ioport("SCAN3")->read(); - if (!BIT(io_SC, 4)) io_KY |= ioport("SCAN4")->read(); - if (!BIT(io_SC, 5)) io_KY |= ioport("SCAN5")->read(); - if (!BIT(io_SC, 6)) io_KY |= ioport("SCAN6")->read(); - if (!BIT(io_SC, 7)) io_KY |= ioport("SCAN7")->read(); -#if DEBUGGING_INDUCE_SELFDIAGNOSE - io_KY = 0x42; //according to procedure described in the service manual -#endif - return io_KY; - case IO_EXPANDER_PORTD: - return io_LD; - case IO_EXPANDER_PORTE: - return io_SEL & 0x0F; //This is a 4bit port. - default: - return 0; - } -} - -WRITE8_MEMBER(pve500_state::io_expander_w) -{ - static int LD_data[4]; - int swap[4] = {2,1,0,3}; - switch (offset){ - case IO_EXPANDER_PORTA: -#if LOG_7SEG_DISPLAY_SIGNALS -printf("io_expander_w: PORTA (io_SC=%02X)\n", data); -#endif - io_SC = data; - - for (int j=0; j<8; j++){ - if (!BIT(io_SC,j)){ - for (int i=0; i<4; i++) - output_set_digit_value(8*swap[i] + j, LD_data[i]); - } - } - break; - case IO_EXPANDER_PORTB: -#if LOG_7SEG_DISPLAY_SIGNALS - printf("io_expander_w: PORTB (io_LE=%02X)\n", data); -#endif - io_LE = data; - break; - case IO_EXPANDER_PORTC: -#if LOG_7SEG_DISPLAY_SIGNALS - printf("io_expander_w: PORTC (io_KY=%02X)\n", data); -#endif - io_KY = data; - break; - case IO_EXPANDER_PORTD: -#if LOG_7SEG_DISPLAY_SIGNALS - printf("io_expander_w: PORTD (io_LD=%02X)\n", data); -#endif - io_LD = data; - break; - case IO_EXPANDER_PORTE: -#if LOG_7SEG_DISPLAY_SIGNALS - printf("io_expander_w PORTE (io_SEL=%02X)\n", data); -#endif - io_SEL = data; - for (int i=0; i<4; i++){ - if (BIT(io_SEL, i)){ - LD_data[i] = 0x7F & BITSWAP8(io_LD ^ 0xFF, 7, 0, 1, 2, 3, 4, 5, 6); - } - } - break; - default: - break; - } -} - -static MACHINE_CONFIG_START( pve500, pve500_state ) - /* Main CPU */ - MCFG_CPU_ADD("maincpu", TMPZ84C015, XTAL_12MHz / 2) /* TMPZ84C015BF-6 */ - MCFG_CPU_PROGRAM_MAP(maincpu_prg) - MCFG_CPU_IO_MAP(maincpu_io) - MCFG_CPU_CONFIG(maincpu_daisy_chain) - MCFG_TMPZ84C015_OUT_DTRA_CB(WRITELINE(pve500_state, GPI_w)) - MCFG_TMPZ84C015_OUT_DTRB_CB(DEVWRITELINE("buzzer", beep_device, set_state)) - MCFG_TMPZ84C015_OUT_TXDA_CB(DEVWRITELINE("recorder", rs232_port_device, write_txd)) - MCFG_TMPZ84C015_OUT_TXDB_CB(DEVWRITELINE("player1", rs232_port_device, write_txd)) - - MCFG_DEVICE_ADD("external_ctc", Z80CTC, XTAL_12MHz / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_Z80SIO0_ADD("external_sio", XTAL_12MHz / 2, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("player2", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("edl_inout", rs232_port_device, write_txd)) - - /* Secondary CPU */ - MCFG_CPU_ADD("subcpu", TMPZ84C015, XTAL_12MHz / 2) /* TMPZ84C015BF-6 */ - MCFG_CPU_PROGRAM_MAP(subcpu_prg) - MCFG_CPU_IO_MAP(subcpu_io) - MCFG_TMPZ84C015_OUT_DTRB_CB(WRITELINE(pve500_state, external_monitor_w)) - MCFG_TMPZ84C015_OUT_TXDA_CB(DEVWRITELINE("switcher", rs232_port_device, write_txd)) - MCFG_TMPZ84C015_OUT_TXDB_CB(DEVWRITELINE("serial_mixer", rs232_port_device, write_txd)) - - // PIO callbacks - MCFG_TMPZ84C015_IN_PA_CB(READ8(pve500_state, eeprom_r)) - MCFG_TMPZ84C015_OUT_PA_CB(WRITE8(pve500_state, eeprom_w)) - - /* Search Dial MCUs */ - MCFG_CPU_ADD("dial_mcu_left", MB88201, XTAL_4MHz) /* PLAYER DIAL MCU */ - MCFG_CPU_ADD("dial_mcu_right", MB88201, XTAL_4MHz) /* RECORDER DIAL MCU */ - - /* Serial EEPROM (128 bytes, 8-bit data organization) */ - /* The EEPROM stores the setup data */ - MCFG_EEPROM_SERIAL_MSM16911_8BIT_ADD("eeprom") - - /* FIX-ME: These are actually RS422 ports (except EDL IN/OUT which is indeed an RS232 port)*/ - MCFG_RS232_PORT_ADD("recorder", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("maincpu", tmpz84c015_device, rxa_w)) - - MCFG_RS232_PORT_ADD("player1", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("maincpu", tmpz84c015_device, rxb_w)) - - MCFG_RS232_PORT_ADD("player2", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("external_sio", z80dart_device, rxa_w)) - - MCFG_RS232_PORT_ADD("edl_inout", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("external_sio", z80dart_device, rxb_w)) - - MCFG_RS232_PORT_ADD("switcher", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("subcpu", tmpz84c015_device, rxa_w)) - - MCFG_RS232_PORT_ADD("serial_mixer", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("subcpu", tmpz84c015_device, rxb_w)) - - /* ICF5: 2kbytes of RAM shared between the two CPUs (dual-port RAM)*/ - MCFG_DEVICE_ADD("mb8421", MB8421, 0) - MCFG_MB8421_INTL_HANDLER(WRITELINE(pve500_state, mb8421_intl)) - MCFG_MB8421_INTR_HANDLER(WRITELINE(pve500_state, mb8421_intr)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_pve500) - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("buzzer", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05) - -MACHINE_CONFIG_END - -ROM_START( pve500 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("pve500.icb7", 0x00000, 0x10000, CRC(1036709c) SHA1(207d6fcad5c2f081a138184060ce7bd02736965b) ) //48kbyte main-cpu program + 16kbyte of unreachable memory - - ROM_REGION( 0x8000, "subcpu", 0 ) - ROM_LOAD("pve500.icg5", 0x00000, 0x8000, CRC(28cca60a) SHA1(308d70062653769250327ede7a4e1a8a76fc9ab9) ) //32kbyte sub-cpu program - - ROM_REGION( 0x200, "dial_mcu_left", 0 ) /* PLAYER DIAL MCU */ - ROM_LOAD( "pve500.icd3", 0x0000, 0x0200, NO_DUMP ) - - ROM_REGION( 0x200, "dial_mcu_right", 0 ) /* RECORDER DIAL MCU */ - ROM_LOAD( "pve500.icc3", 0x0000, 0x0200, NO_DUMP ) - - ROM_REGION( 0x80, "eeprom", 0 ) /* The EEPROM stores the setup data */ - ROM_LOAD( "pve500.ice3", 0x0000, 0x080, NO_DUMP ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1995, pve500, 0, 0, pve500, pve500, pve500_state, pve500, "SONY", "PVE-500", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS) diff --git a/src/mess/drivers/px4.c b/src/mess/drivers/px4.c deleted file mode 100644 index 7a07a87e46a..00000000000 --- a/src/mess/drivers/px4.c +++ /dev/null @@ -1,1590 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Epson PX-4 - - Note: We are missing a dump of the slave 7508 CPU that controls - the keyboard and some other things. - -***************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "bus/epson_sio/epson_sio.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "sound/speaker.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "coreutil.h" -#include "px4.lh" - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -#define VERBOSE 1 - - -//************************************************************************** -// MACROS -//************************************************************************** - -#define ART_TX_ENABLED (BIT(m_artcr, 0)) -#define ART_RX_ENABLED (BIT(m_artcr, 2)) -#define ART_BREAK (BIT(m_artcr, 3)) - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class px4_state : public driver_device, public device_serial_interface -{ -public: - px4_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - device_serial_interface(mconfig, *this), - m_z80(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_nvram(*this, "nvram"), - m_centronics(*this, "centronics"), - m_ext_cas(*this, "extcas"), - m_ext_cas_timer(*this, "extcas_timer"), - m_speaker(*this, "speaker"), - m_sio(*this, "sio"), - m_rs232(*this, "rs232"), - m_caps1(*this, "capsule1"), m_caps2(*this, "capsule2"), - m_caps1_rom(NULL), m_caps2_rom(NULL), - m_ctrl1(0), m_icrb(0), m_bankr(0), - m_isr(0), m_ier(0), m_str(0), m_sior(0xbf), - m_frc_value(0), m_frc_latch(0), - m_vadr(0), m_yoff(0), - m_receive_timer(NULL), m_transmit_timer(NULL), - m_artdir(0xff), m_artdor(0xff), m_artsr(0), m_artcr(0), - m_swr(0), - m_one_sec_int_enabled(true), m_alarm_int_enabled(true), m_key_int_enabled(true), - m_key_status(0), m_interrupt_status(0), - m_time(), m_clock_state(0), - m_ear_last_state(0), - m_sio_pin(0), m_serial_rx(0), m_rs232_dcd(0), m_rs232_cts(0), - m_centronics_busy(0), m_centronics_perror(0) - { } - - DECLARE_DRIVER_INIT( px4 ); - - DECLARE_PALETTE_INIT( px4 ); - UINT32 screen_update_px4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( icrlc_r ); - DECLARE_WRITE8_MEMBER( ctrl1_w ); - DECLARE_READ8_MEMBER( icrhc_r ); - DECLARE_WRITE8_MEMBER( cmdr_w ); - DECLARE_READ8_MEMBER( icrlb_r ); - DECLARE_WRITE8_MEMBER( ctrl2_w ); - DECLARE_READ8_MEMBER( icrhb_r ); - DECLARE_READ8_MEMBER( isr_r ); - DECLARE_WRITE8_MEMBER( ier_w ); - DECLARE_READ8_MEMBER( str_r ); - DECLARE_WRITE8_MEMBER( bankr_w ); - DECLARE_READ8_MEMBER( sior_r ); - DECLARE_WRITE8_MEMBER( sior_w ); - DECLARE_WRITE8_MEMBER( vadr_w ); - DECLARE_WRITE8_MEMBER( yoff_w ); - DECLARE_WRITE8_MEMBER( fr_w ); - DECLARE_WRITE8_MEMBER( spur_w ); - DECLARE_READ8_MEMBER( ctgif_r ); - DECLARE_WRITE8_MEMBER( ctgif_w ); - DECLARE_READ8_MEMBER( artdir_r ); - DECLARE_WRITE8_MEMBER( artdor_w ); - DECLARE_READ8_MEMBER( artsr_r ); - DECLARE_WRITE8_MEMBER( artmr_w ); - DECLARE_READ8_MEMBER( iostr_r ); - DECLARE_WRITE8_MEMBER( artcr_w ); - DECLARE_WRITE8_MEMBER( swr_w ); - DECLARE_WRITE8_MEMBER( ioctlr_w ); - - DECLARE_INPUT_CHANGED_MEMBER( key_callback ); - - TIMER_DEVICE_CALLBACK_MEMBER( ext_cassette_read ); - TIMER_DEVICE_CALLBACK_MEMBER( frc_tick ); - TIMER_DEVICE_CALLBACK_MEMBER( upd7508_1sec_callback ); - - // serial - DECLARE_WRITE_LINE_MEMBER( sio_rx_w ); - DECLARE_WRITE_LINE_MEMBER( sio_pin_w ); - DECLARE_WRITE_LINE_MEMBER( rs232_rx_w ); - DECLARE_WRITE_LINE_MEMBER( rs232_dcd_w ); - DECLARE_WRITE_LINE_MEMBER( rs232_dsr_w ); - DECLARE_WRITE_LINE_MEMBER( rs232_cts_w ); - TIMER_CALLBACK_MEMBER( transmit_data ); - TIMER_CALLBACK_MEMBER( receive_data ); - - // centronics - DECLARE_WRITE_LINE_MEMBER( centronics_busy_w ) { m_centronics_busy = state; } - DECLARE_WRITE_LINE_MEMBER( centronics_perror_w ) { m_centronics_perror = state; } - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - // device_serial_interface overrides - virtual void tra_callback(); - virtual void tra_complete(); - virtual void rcv_callback(); - virtual void rcv_complete(); - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - // z80 interrupt sources - enum - { - INT0_7508 = 0x01, - INT1_ART = 0x02, - INT2_ICF = 0x04, - INT3_OVF = 0x08, - INT4_EXT = 0x10 - }; - - // 7508 interrupt sources - enum - { - UPD7508_INT_ALARM = 0x02, - UPD7508_INT_POWER_FAIL = 0x04, - UPD7508_INT_7508_RESET = 0x08, - UPD7508_INT_Z80_RESET = 0x10, - UPD7508_INT_ONE_SECOND = 0x20 - }; - - // art (asynchronous receiver transmitter) - enum - { - ART_TXRDY = 0x01, // output buffer empty - ART_RXRDY = 0x02, // data byte received - ART_TXEMPTY = 0x04, // transmit buffer empty - ART_PE = 0x08, // parity error - ART_OE = 0x10, // overrun error - ART_FE = 0x20 // framing error - }; - - void gapnit_interrupt(); - - DECLARE_WRITE_LINE_MEMBER( serial_rx_w ); - void txd_w(int data); - - void install_rom_capsule(address_space &space, int size, memory_region *mem); - - // internal devices - required_device m_z80; - required_device m_ram; - required_device m_nvram; - required_device m_centronics; - required_device m_ext_cas; - required_device m_ext_cas_timer; - required_device m_speaker; - required_device m_sio; - required_device m_rs232; - required_device m_caps1; - required_device m_caps2; - - memory_region *m_caps1_rom; - memory_region *m_caps2_rom; - - // gapnit register - UINT8 m_ctrl1; - UINT16 m_icrb; - UINT8 m_bankr; - UINT8 m_isr; - UINT8 m_ier; - UINT8 m_str; - UINT8 m_sior; - - // gapnit internal - UINT16 m_frc_value; - UINT16 m_frc_latch; - - // gapndi register - UINT8 m_vadr; - UINT8 m_yoff; - - // gapnio - emu_timer *m_receive_timer; - emu_timer *m_transmit_timer; - UINT8 m_artdir; - UINT8 m_artdor; - UINT8 m_artsr; - UINT8 m_artcr; - UINT8 m_swr; - - // 7508 internal - bool m_one_sec_int_enabled; - bool m_alarm_int_enabled; - bool m_key_int_enabled; - - UINT8 m_key_status; - UINT8 m_interrupt_status; - - system_time m_time; - int m_clock_state; - - // external cassette/barcode reader - int m_ear_last_state; - - // serial - int m_sio_pin; - int m_serial_rx; - int m_rs232_dcd; - int m_rs232_cts; - - // centronics - int m_centronics_busy; - int m_centronics_perror; -}; - -class px4p_state : public px4_state -{ -public: - px4p_state(const machine_config &mconfig, device_type type, const char *tag) : - px4_state(mconfig, type, tag), - m_rdnvram(*this, "rdnvram"), - m_rdsocket(*this, "ramdisk_socket"), - m_ramdisk_address(0), - m_ramdisk(NULL) - { } - - DECLARE_DRIVER_INIT( px4p ); - - DECLARE_PALETTE_INIT( px4p ); - - DECLARE_WRITE8_MEMBER( ramdisk_address_w ); - DECLARE_READ8_MEMBER( ramdisk_data_r ); - DECLARE_WRITE8_MEMBER( ramdisk_data_w ); - DECLARE_READ8_MEMBER( ramdisk_control_r ); - -protected: - // driver_device overrides - virtual void machine_start(); - -private: - required_device m_rdnvram; - required_device m_rdsocket; - - offs_t m_ramdisk_address; - UINT8 *m_ramdisk; -}; - - -//************************************************************************** -// GAPNIT -//************************************************************************** - -// process interrupts -void px4_state::gapnit_interrupt() -{ - // any interrupts enabled and pending? - if (m_ier & m_isr & INT0_7508) - { - m_isr &= ~INT0_7508; - m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf0); - } - else if (m_ier & m_isr & INT1_ART) - m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf2); - else if (m_ier & m_isr & INT2_ICF) - m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf4); - else if (m_ier & m_isr & INT3_OVF) - m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf6); - else if (m_ier & m_isr & INT4_EXT) - m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf8); - else - m_z80->set_input_line(0, CLEAR_LINE); -} - -// external cassette or barcode reader input -TIMER_DEVICE_CALLBACK_MEMBER( px4_state::ext_cassette_read ) -{ - UINT8 result; - int trigger = 0; - - // sample input state - result = (m_ext_cas->input() > 0) ? 1 : 0; - - // detect transition - switch ((m_ctrl1 >> 1) & 0x03) - { - case 0: // trigger inhibit - trigger = 0; - break; - case 1: // falling edge trigger - trigger = m_ear_last_state == 1 && result == 0; - break; - case 2: // rising edge trigger - trigger = m_ear_last_state == 0 && result == 1; - break; - case 3: // rising/falling edge trigger - trigger = m_ear_last_state != result; - break; - } - - // generate an interrupt if we need to trigger - if (trigger) - { - m_icrb = m_frc_value; - m_isr |= INT2_ICF; - gapnit_interrupt(); - } - - // save last state - m_ear_last_state = result; -} - -// free running counter -TIMER_DEVICE_CALLBACK_MEMBER( px4_state::frc_tick ) -{ - m_frc_value++; - - if (m_frc_value == 0) - { - m_isr |= INT3_OVF; - gapnit_interrupt(); - } -} - -// input capture register low command trigger -READ8_MEMBER( px4_state::icrlc_r ) -{ - if (VERBOSE) - logerror("%s: icrlc_r\n", machine().describe_context()); - - // latch value - m_frc_latch = m_frc_value; - - return m_frc_latch & 0xff; -} - -// control register 1 -WRITE8_MEMBER( px4_state::ctrl1_w ) -{ - const int rcv_rates[] = { 110, 150, 300, 600, 1200, 2400, 4800, 9600, 75, 1200, 19200, 38400, 200 }; - const int tra_rates[] = { 110, 150, 300, 600, 1200, 2400, 4800, 9600, 1200, 75, 19200, 38400, 200 }; - - if (VERBOSE) - logerror("%s: ctrl1_w (0x%02x)\n", machine().describe_context(), data); - - // baudrate generator - int baud = data >> 4; - - if (baud <= 12) - { - if (VERBOSE) - logerror("rcv baud = %d, tra baud = %d\n", rcv_rates[baud], tra_rates[baud]); - - set_rcv_rate(rcv_rates[baud]); - set_tra_rate(tra_rates[baud]); - } - - m_ctrl1 = data; -} - -// input capture register high command trigger -READ8_MEMBER( px4_state::icrhc_r ) -{ - if (VERBOSE) - logerror("%s: icrhc_r\n", machine().describe_context()); - - return (m_frc_latch >> 8) & 0xff; -} - -// command register -WRITE8_MEMBER( px4_state::cmdr_w ) -{ - if (0) - logerror("%s: cmdr_w (0x%02x)\n", machine().describe_context(), data); - - // clear overflow interrupt? - if (BIT(data, 2)) - { - m_isr &= ~INT3_OVF; - gapnit_interrupt(); - } -} - -// input capture register low barcode trigger -READ8_MEMBER( px4_state::icrlb_r ) -{ - if (VERBOSE) - logerror("%s: icrlb_r\n", machine().describe_context()); - - return m_icrb & 0xff; -} - -// control register 2 -WRITE8_MEMBER( px4_state::ctrl2_w ) -{ - if (VERBOSE) - logerror("%s: ctrl2_w (0x%02x)\n", machine().describe_context(), data); - - // bit 0, MIC, cassette output - m_ext_cas->output( BIT(data, 0) ? -1.0 : +1.0); - - // bit 1, RMT, cassette motor - if (BIT(data, 1)) - { - m_ext_cas->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_ext_cas_timer->adjust(attotime::zero, 0, attotime::from_hz(44100)); - } - else - { - m_ext_cas->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_ext_cas_timer->adjust(attotime::zero); - } -} - -// input capture register high barcode trigger -READ8_MEMBER( px4_state::icrhb_r ) -{ - if (VERBOSE) - logerror("%s: icrhb_r\n", machine().describe_context()); - - // clear icf interrupt - m_isr &= ~INT2_ICF; - gapnit_interrupt(); - - return (m_icrb >> 8) & 0xff; -} - -// interrupt status register -READ8_MEMBER( px4_state::isr_r ) -{ - if (VERBOSE) - logerror("%s: isr_r\n", machine().describe_context()); - - return m_isr; -} - -// interrupt enable register -WRITE8_MEMBER( px4_state::ier_w ) -{ - if (0) - logerror("%s: ier_w (0x%02x)\n", machine().describe_context(), data); - - m_ier = data; - gapnit_interrupt(); -} - -// status register -READ8_MEMBER( px4_state::str_r ) -{ - UINT8 data = 0; - - if (0) - logerror("%s: str_r\n", machine().describe_context()); - - data |= (m_ext_cas)->input() > 0 ? 1 : 0; - data |= 1 << 1; // BCRD, barcode reader input - data |= 1 << 2; // RDY signal from 7805 - data |= 1 << 3; // RDYSIO, enable access to the 7805 - data |= m_bankr & 0xf0; // bit 4-7, BANK - memory bank - - return data; -} - -// helper function to map rom capsules -void px4_state::install_rom_capsule(address_space &space, int size, memory_region *mem) -{ - // ram, part 1 - space.install_ram(0x0000, 0xdfff - size, 0, 0, m_ram->pointer()); - - // actual rom data, part 1 - if (mem) - space.install_rom(0xe000 - size, 0xffff, 0, 0, mem->base() + (size - 0x2000)); - - // rom data, part 2 - if (mem && size != 0x2000) - space.install_rom(0x10000 - size, 0xdfff, 0, 0, mem->base()); - - // ram, continued - space.install_ram(0xe000, 0xffff, 0, 0, m_ram->pointer() + 0xe000); -} - -// bank register -WRITE8_MEMBER( px4_state::bankr_w ) -{ - address_space &space_program = m_z80->space(AS_PROGRAM); - - if (0) - logerror("%s: bankr_w (0x%02x)\n", machine().describe_context(), data); - - m_bankr = data; - - // bank switch - switch (data >> 4) - { - case 0x00: - // system bank - space_program.install_rom(0x0000, 0x7fff, 0, 0, memregion("os")->base()); - space_program.install_ram(0x8000, 0xffff, 0, 0, m_ram->pointer() + 0x8000); - break; - - case 0x04: - // memory - space_program.install_ram(0x0000, 0xffff, 0, 0, m_ram->pointer()); - break; - - case 0x08: install_rom_capsule(space_program, 0x2000, m_caps1_rom); break; - case 0x09: install_rom_capsule(space_program, 0x4000, m_caps1_rom); break; - case 0x0a: install_rom_capsule(space_program, 0x8000, m_caps1_rom); break; - case 0x0c: install_rom_capsule(space_program, 0x2000, m_caps2_rom); break; - case 0x0d: install_rom_capsule(space_program, 0x4000, m_caps2_rom); break; - case 0x0e: install_rom_capsule(space_program, 0x8000, m_caps2_rom); break; - - default: - if (VERBOSE) - logerror("invalid bank switch value: 0x%02x\n", data >> 4); - break; - } -} - -// serial io register -READ8_MEMBER( px4_state::sior_r ) -{ - if (0) - logerror("%s: sior_r 0x%02x\n", machine().describe_context(), m_sior); - - // reading clock? - if (m_clock_state > 0) - { - switch (m_clock_state++) - { - case 1: m_sior = (dec_2_bcd(m_time.local_time.year) >> 4) & 0xf; break; - case 2: m_sior = dec_2_bcd(m_time.local_time.year) & 0xf; break; - case 3: m_sior = dec_2_bcd(m_time.local_time.month + 1); break; - case 4: m_sior = dec_2_bcd(m_time.local_time.mday); break; - case 5: m_sior = dec_2_bcd(m_time.local_time.hour); break; - case 6: m_sior = dec_2_bcd(m_time.local_time.minute); break; - case 7: m_sior = dec_2_bcd(m_time.local_time.second); break; - case 8: m_sior = dec_2_bcd(m_time.local_time.weekday); break; - } - - // done? - if (m_clock_state == 9) - m_clock_state = 0; - } - - return m_sior; -} - -// serial io register -WRITE8_MEMBER( px4_state::sior_w ) -{ - if (0) - logerror("%s: sior_w (0x%02x)\n", machine().describe_context(), data); - - // writing clock? - if (m_clock_state > 0) - { - time_t time = m_time.time; - struct tm *t = localtime(&time); - - switch (m_clock_state++) - { - case 1: - { - int year = dec_2_bcd(m_time.local_time.year); - year = (year & 0xff0f) | ((data & 0xf) << 4); - t->tm_year = bcd_2_dec(year) - 1900; - } - break; - case 2: - { - int year = dec_2_bcd(m_time.local_time.year); - year = (year & 0xfff0) | (data & 0xf); - t->tm_year = bcd_2_dec(year) - 1900; - } - break; - case 3: t->tm_mon = bcd_2_dec(data & 0x7f) - 1; break; - case 4: t->tm_mday = bcd_2_dec(data & 0x7f); break; - case 5: t->tm_hour = bcd_2_dec(data & 0x7f); break; - case 6: t->tm_min = bcd_2_dec(data & 0x7f); break; - case 7: t->tm_sec = bcd_2_dec(data & 0x7f); break; - case 8: t->tm_wday = bcd_2_dec(data & 0x7f); break; - } - - // update - m_time.set(mktime(t)); - - // done? - if (m_clock_state == 9) - m_clock_state = 0; - } - else - { - m_sior = data; - - switch (data) - { - case 0x01: - if (VERBOSE) - logerror("7508 cmd: Power OFF\n"); - - break; - - case 0x02: - if (VERBOSE) - logerror("7508 cmd: Read Status\n"); - - if (m_interrupt_status != 0) - { - if (VERBOSE) - logerror("> 7508 has interrupts pending: 0x%02x\n", m_interrupt_status); - - // signal the interrupt(s) - m_sior = 0xc1 | m_interrupt_status; - m_interrupt_status = 0x00; - } - else if (m_key_status != 0xff) - { - m_sior = m_key_status; - m_key_status = 0xff; - } - else - { - // nothing happened - m_sior = 0xbf; - } - - break; - - case 0x03: if (VERBOSE) logerror("7508 cmd: KB Reset\n"); break; - case 0x04: if (VERBOSE) logerror("7508 cmd: KB Repeat Timer 1 Set\n"); break; - case 0x14: if (VERBOSE) logerror("7508 cmd: KB Repeat Timer 2 Set\n"); break; - case 0x24: if (VERBOSE) logerror("7508 cmd: KB Repeat Timer 1 Read\n"); break; - case 0x34: if (VERBOSE) logerror("7508 cmd: KB Repeat Timer 2 Read\n"); break; - case 0x05: if (VERBOSE) logerror("7508 cmd: KB Repeat OFF\n"); break; - case 0x15: if (VERBOSE) logerror("7508 cmd: KB Repeat ON\n"); break; - - case 0x06: - if (VERBOSE) - logerror("7508 cmd: KB Interrupt OFF\n"); - - m_key_int_enabled = false; - break; - - case 0x16: - if (VERBOSE) - logerror("7508 cmd: KB Interrupt ON\n"); - - m_key_int_enabled = true; - break; - - case 0x07: - if (VERBOSE) - logerror("7508 cmd: Clock Read\n"); - - m_clock_state = 1; - break; - - case 0x17: - if (VERBOSE) - logerror("7508 cmd: Clock Write\n"); - - m_clock_state = 1; - break; - - case 0x08: - if (VERBOSE) - logerror("7508 cmd: Power Switch Read\n"); - - // indicate that the power switch is in the "ON" position - m_sior = 0x01; - break; - - case 0x09: if (VERBOSE) logerror("7508 cmd: Alarm Read\n"); break; - case 0x19: if (VERBOSE) logerror("7508 cmd: Alarm Set\n"); break; - case 0x29: if (VERBOSE) logerror("7508 cmd: Alarm OFF\n"); break; - case 0x39: if (VERBOSE) logerror("7508 cmd: Alarm ON\n"); break; - - case 0x0a: - if (VERBOSE) - logerror("7508 cmd: DIP Switch Read\n"); - m_sior = ioport("dips")->read(); - break; - - case 0x0b: if (VERBOSE) logerror("7508 cmd: Stop Key Interrupt disable\n"); break; - case 0x1b: if (VERBOSE) logerror("7508 cmd: Stop Key Interrupt enable\n"); break; - case 0x0c: if (VERBOSE) logerror("7508 cmd: 7 chr. Buffer\n"); break; - case 0x1c: if (VERBOSE) logerror("7508 cmd: 1 chr. Buffer\n"); break; - - case 0x0d: - if (VERBOSE) - logerror("7508 cmd: 1 sec. Interrupt OFF\n"); - - m_one_sec_int_enabled = false; - break; - - case 0x1d: - if (VERBOSE) - logerror("7508 cmd: 1 sec. Interrupt ON\n"); - - m_one_sec_int_enabled = true; - break; - - case 0x0e: - if (VERBOSE) - logerror("7508 cmd: KB Clear\n"); - - m_sior = 0xbf; - break; - - case 0x0f: if (VERBOSE) logerror("7508 cmd: System Reset\n"); break; - } - } -} - - -//************************************************************************** -// GAPNDL -//************************************************************************** - -// vram start address register -WRITE8_MEMBER( px4_state::vadr_w ) -{ - if (VERBOSE) - logerror("%s: vadr_w (0x%02x)\n", machine().describe_context(), data); - - m_vadr = data; -} - -// y offset register -WRITE8_MEMBER( px4_state::yoff_w ) -{ - if (VERBOSE) - logerror("%s: yoff_w (0x%02x)\n", machine().describe_context(), data); - - m_yoff = data; -} - -// frame register -WRITE8_MEMBER( px4_state::fr_w ) -{ - if (VERBOSE) - logerror("%s: fr_w (0x%02x)\n", machine().describe_context(), data); -} - -// speed-up register -WRITE8_MEMBER( px4_state::spur_w ) -{ - if (VERBOSE) - logerror("%s: spur_w (0x%02x)\n", machine().describe_context(), data); -} - - -//************************************************************************** -// GAPNIO -//************************************************************************** - -WRITE_LINE_MEMBER( px4_state::serial_rx_w ) -{ - m_serial_rx = state; - device_serial_interface::rx_w(state); -} - -WRITE_LINE_MEMBER( px4_state::sio_rx_w ) -{ - if (!BIT(m_swr, 3) && BIT(m_swr, 2)) - serial_rx_w(state); -} - -WRITE_LINE_MEMBER( px4_state::sio_pin_w ) -{ - m_sio_pin = state; -} - -WRITE_LINE_MEMBER( px4_state::rs232_rx_w ) -{ - if (BIT(m_swr, 3)) - serial_rx_w(state); -} - -WRITE_LINE_MEMBER( px4_state::rs232_dcd_w ) -{ - m_rs232_dcd = state; -} - -WRITE_LINE_MEMBER( px4_state::rs232_dsr_w ) -{ - m_artsr |= !state << 7; -} - -WRITE_LINE_MEMBER( px4_state::rs232_cts_w ) -{ - m_rs232_cts = state; -} - -void px4_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - device_serial_interface::device_timer(timer, id, param, ptr); -} - -void px4_state::tra_callback() -{ - if (ART_TX_ENABLED) - { - if (ART_BREAK) - txd_w(0); // transmit break - else - txd_w(transmit_register_get_data_bit()); // transmit data - } - else - txd_w(1); // transmit mark -} - -void px4_state::tra_complete() -{ - if (m_artsr & ART_TXRDY) - { - // no more bytes, buffer now empty - m_artsr |= ART_TXEMPTY; - } - else - { - // transfer next byte - transmit_register_setup(m_artdor); - m_artsr |= ART_TXRDY; - } -} - -void px4_state::rcv_callback() -{ - if (ART_RX_ENABLED) - receive_register_update_bit(m_serial_rx); // receive data -} - -void px4_state::rcv_complete() -{ - receive_register_extract(); - m_artdir = get_received_char(); - - // TODO: verify parity and framing - - // overrun? - if (m_artsr & ART_RXRDY) - m_artsr |= ART_OE; - - // set ready and signal interrupt - m_artsr |= ART_RXRDY; - m_isr |= INT1_ART; - gapnit_interrupt(); -} - -// helper function to write to selected serial port -void px4_state::txd_w(int data) -{ - if (BIT(m_swr, 2)) - // to sio - m_sio->tx_w(data); - else - if (BIT(m_swr, 3)) - // to rs232 - m_rs232->write_txd(data); - // else to cartridge -} - -// cartridge interface -READ8_MEMBER( px4_state::ctgif_r ) -{ - if (VERBOSE) - logerror("%s: ctgif_r @ 0x%02x\n", machine().describe_context(), offset); - - return 0x00; -} - -// cartridge interface -WRITE8_MEMBER( px4_state::ctgif_w ) -{ - if (VERBOSE) - logerror("%s: ctgif_w (0x%02x @ 0x%02x)\n", machine().describe_context(), data, offset); -} - -// art data input register -READ8_MEMBER( px4_state::artdir_r ) -{ - if (VERBOSE) - logerror("%s: artdir_r (%02x)\n", machine().describe_context(), m_artdir); - - // clear ready - m_artsr &= ~ART_RXRDY; - - // clear interrupt - m_isr &= ~INT1_ART; - gapnit_interrupt(); - - return m_artdir; -} - -// art data output register -WRITE8_MEMBER( px4_state::artdor_w ) -{ - if (VERBOSE) - logerror("%s: artdor_w (0x%02x)\n", machine().describe_context(), data); - - m_artdor = data; - - // new data to transmit? - if (ART_TX_ENABLED && is_transmit_register_empty()) - { - transmit_register_setup(m_artdor); - m_artsr &= ~ART_TXEMPTY; - } - else - { - // clear ready - m_artsr &= ~ART_TXRDY; - } -} - -// art status register -READ8_MEMBER( px4_state::artsr_r ) -{ - if (0) - logerror("%s: artsr_r (%02x)\n", machine().describe_context(), m_artsr); - - return m_artsr; -} - -// art mode register -WRITE8_MEMBER( px4_state::artmr_w ) -{ - int data_bit_count = BIT(data, 2) ? 8 : 7; - parity_t parity = BIT(data, 4) ? (BIT(data, 5) ? PARITY_EVEN : PARITY_ODD) : PARITY_NONE; - stop_bits_t stop_bits = BIT(data, 7) ? STOP_BITS_2 : STOP_BITS_1; - - if (VERBOSE) - logerror("%s: serial frame setup: %d-%s-%d\n", tag(), data_bit_count, device_serial_interface::parity_tostring(parity), stop_bits); - - set_data_frame(1, data_bit_count, parity, stop_bits); -} - -// io status register -READ8_MEMBER( px4_state::iostr_r ) -{ - UINT8 data = 0; - - // centronics status - data |= m_centronics_busy << 0; - data |= m_centronics_perror << 1; - - // sio status - data |= !m_sio_pin << 2; - - // serial data - data |= m_serial_rx << 3; - - // rs232 status - data |= !m_rs232_dcd << 4; - data |= !m_rs232_cts << 5; - - data |= 1 << 6; // bit 6, csel, cartridge option select signal - data |= 0 << 7; // bit 7, caud - audio input from cartridge - - if (0) - logerror("%s: iostr_r: rx = %d, dcd = %d, cts = %d\n", machine().describe_context(), BIT(data, 3), BIT(data, 4), BIT(data, 5)); - - return data; -} - -// art command register -WRITE8_MEMBER( px4_state::artcr_w ) -{ - if (VERBOSE) - logerror("%s: artcr_w (0x%02x)\n", machine().describe_context(), data); - - m_artcr = data; - - // error reset - if (BIT(data, 4)) - m_artsr &= ~(ART_PE | ART_OE | ART_FE); - - // rs232 - m_rs232->write_dtr(!BIT(data, 1)); - m_rs232->write_rts(!BIT(data, 5)); -} - -// switch register -WRITE8_MEMBER( px4_state::swr_w ) -{ - if (VERBOSE) - { - const char *cart_mode[] = { "hs", "io", "db", "ot" }; - const char *ser_mode[] = { "cart sio / cart sio", "sio / sio", "rs232 / rs232", "rs232 / sio" }; - logerror("%s: px4_swr_w: cartridge mode: %s, serial mode: %s, audio: %s\n", machine().describe_context(), - cart_mode[data & 0x03], ser_mode[(data >> 2) & 0x03], BIT(data, 4) ? "on" : "off"); - } - - m_swr = data; -} - -// io control register -WRITE8_MEMBER( px4_state::ioctlr_w ) -{ - if (VERBOSE) - logerror("%s: ioctlr_w (0x%02x)\n", machine().describe_context(), data); - - m_centronics->write_strobe(!BIT(data, 0)); - m_centronics->write_init(BIT(data, 1)); - - m_sio->pout_w(BIT(data, 2)); - - // bit 3, cartridge reset - - output_set_value("led_0", BIT(data, 4)); // caps lock - output_set_value("led_1", BIT(data, 5)); // num lock - output_set_value("led_2", BIT(data, 6)); // "led 2" - - m_speaker->level_w(BIT(data, 7)); -} - - -//************************************************************************** -// 7508 RELATED -//************************************************************************** - -TIMER_DEVICE_CALLBACK_MEMBER( px4_state::upd7508_1sec_callback ) -{ - // adjust interrupt status - m_interrupt_status |= UPD7508_INT_ONE_SECOND; - - // are interrupts enabled? - if (m_one_sec_int_enabled) - { - m_isr |= INT0_7508; - gapnit_interrupt(); - } - - // update clock - m_time.set(m_time.time + 1); -} - -INPUT_CHANGED_MEMBER( px4_state::key_callback ) -{ - UINT32 oldvalue = oldval * field.mask(), newvalue = newval * field.mask(); - UINT32 delta = oldvalue ^ newvalue; - int i, scancode = 0xff, down = 0; - - for (i = 0; i < 32; i++) - { - if (delta & (1 << i)) - { - down = (newvalue & (1 << i)) ? 0x10 : 0x00; - scancode = (FPTR)param * 32 + i; - - // control keys - if ((scancode & 0xa0) == 0xa0) - scancode |= down; - - if (VERBOSE) - logerror("upd7508: key callback, key=0x%02x\n", scancode); - - break; - } - } - - if (down || (scancode & 0xa0) == 0xa0) - { - m_key_status = scancode; - - if (m_key_int_enabled) - { - if (VERBOSE) - logerror("upd7508: key interrupt\n"); - - m_isr |= INT0_7508; - gapnit_interrupt(); - } - } -} - - -//************************************************************************** -// EXTERNAL RAM-DISK -//************************************************************************** - -WRITE8_MEMBER( px4p_state::ramdisk_address_w ) -{ - switch (offset) - { - case 0x00: m_ramdisk_address = (m_ramdisk_address & 0xffff00) | ((data & 0xff) << 0); break; - case 0x01: m_ramdisk_address = (m_ramdisk_address & 0xff00ff) | ((data & 0xff) << 8); break; - case 0x02: m_ramdisk_address = (m_ramdisk_address & 0x00ffff) | ((data & 0x07) << 16); break; - } -} - -READ8_MEMBER( px4p_state::ramdisk_data_r ) -{ - UINT8 ret = 0xff; - - if (m_ramdisk_address < 0x20000) - { - // read from ram - ret = m_ramdisk[m_ramdisk_address]; - } - else if (m_ramdisk_address < 0x40000) - { - // read from rom - ret = m_rdsocket->read_rom(space, m_ramdisk_address); - } - - m_ramdisk_address = (m_ramdisk_address & 0xffff00) | ((m_ramdisk_address & 0xff) + 1); - - return ret; -} - -WRITE8_MEMBER( px4p_state::ramdisk_data_w ) -{ - if (m_ramdisk_address < 0x20000) - m_ramdisk[m_ramdisk_address] = data; - - m_ramdisk_address = (m_ramdisk_address & 0xffff00) | ((m_ramdisk_address & 0xff) + 1); -} - -READ8_MEMBER( px4p_state::ramdisk_control_r ) -{ - // bit 7 determines the presence of a ram-disk - return 0x7f; -} - -//************************************************************************** -// VIDEO EMULATION -//************************************************************************** - -UINT32 px4_state::screen_update_px4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // display enabled? - if (BIT(m_yoff, 7)) - { - int y, x; - - // get vram start address - UINT8 *vram = &m_ram->pointer()[(m_vadr & 0xf8) << 8]; - - for (y = 0; y < 64; y++) - { - // adjust against y-offset - UINT8 row = (y - (m_yoff & 0x3f)) & 0x3f; - - for (x = 0; x < 240/8; x++) - { - bitmap.pix16(row, x * 8 + 0) = BIT(*vram, 7); - bitmap.pix16(row, x * 8 + 1) = BIT(*vram, 6); - bitmap.pix16(row, x * 8 + 2) = BIT(*vram, 5); - bitmap.pix16(row, x * 8 + 3) = BIT(*vram, 4); - bitmap.pix16(row, x * 8 + 4) = BIT(*vram, 3); - bitmap.pix16(row, x * 8 + 5) = BIT(*vram, 2); - bitmap.pix16(row, x * 8 + 6) = BIT(*vram, 1); - bitmap.pix16(row, x * 8 + 7) = BIT(*vram, 0); - - vram++; - } - - // skip the last 2 unused bytes - vram += 2; - } - } - else - { - // display is disabled, draw an empty screen - bitmap.fill(0, cliprect); - } - - return 0; -} - - -//************************************************************************** -// DRIVER INIT -//************************************************************************** - -DRIVER_INIT_MEMBER( px4_state, px4 ) -{ - // map os rom and last half of memory - membank("bank1")->set_base(memregion("os")->base()); - membank("bank2")->set_base(m_ram->pointer() + 0x8000); -} - -DRIVER_INIT_MEMBER( px4p_state, px4p ) -{ - DRIVER_INIT_CALL(px4); - - // reserve memory for external ram-disk - m_ramdisk = auto_alloc_array(machine(), UINT8, 0x20000); -} - -void px4_state::machine_start() -{ - std::string region_tag; - m_caps1_rom = memregion(region_tag.assign(m_caps1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - m_caps2_rom = memregion(region_tag.assign(m_caps2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - m_nvram->set_base(m_ram->pointer(), 0x10000); - - // initialize clock - machine().base_datetime(m_time); -} - -void px4_state::machine_reset() -{ - m_artsr = ART_TXRDY | ART_TXEMPTY | (!m_rs232->dsr_r() << 7); - receive_register_reset(); - transmit_register_reset(); -} - -void px4p_state::machine_start() -{ - px4_state::machine_start(); - m_rdnvram->set_base(m_ramdisk, 0x20000); -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -static ADDRESS_MAP_START( px4_mem, AS_PROGRAM, 8, px4_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( px4_io, AS_IO, 8, px4_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // gapnit, 0x00-0x07 - AM_RANGE(0x00, 0x00) AM_READWRITE( icrlc_r, ctrl1_w ) - AM_RANGE(0x01, 0x01) AM_READWRITE( icrhc_r, cmdr_w ) - AM_RANGE(0x02, 0x02) AM_READWRITE( icrlb_r, ctrl2_w ) - AM_RANGE(0x03, 0x03) AM_READ( icrhb_r ) - AM_RANGE(0x04, 0x04) AM_READWRITE( isr_r, ier_w ) - AM_RANGE(0x05, 0x05) AM_READWRITE( str_r, bankr_w ) - AM_RANGE(0x06, 0x06) AM_READWRITE( sior_r, sior_w ) - AM_RANGE(0x07, 0x07) AM_NOP - // gapndl, 0x08-0x0f - AM_RANGE(0x08, 0x08) AM_WRITE( vadr_w ) - AM_RANGE(0x09, 0x09) AM_WRITE( yoff_w ) - AM_RANGE(0x0a, 0x0a) AM_WRITE( fr_w ) - AM_RANGE(0x0b, 0x0b) AM_WRITE( spur_w ) - AM_RANGE(0x0c, 0x0f) AM_NOP - // gapnio, 0x10-0x1f - AM_RANGE(0x10, 0x13) AM_READWRITE( ctgif_r, ctgif_w ) - AM_RANGE(0x14, 0x14) AM_READWRITE( artdir_r, artdor_w ) - AM_RANGE(0x15, 0x15) AM_READWRITE( artsr_r, artmr_w ) - AM_RANGE(0x16, 0x16) AM_READWRITE( iostr_r, artcr_w ) - AM_RANGE(0x17, 0x17) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x18, 0x18) AM_WRITE( swr_w ) - AM_RANGE(0x19, 0x19) AM_WRITE( ioctlr_w ) - AM_RANGE(0x1a, 0x1f) AM_NOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START( px4p_io, AS_IO, 8, px4p_state ) - AM_IMPORT_FROM(px4_io) - AM_RANGE(0x90, 0x92) AM_WRITE(ramdisk_address_w ) - AM_RANGE(0x93, 0x93) AM_READWRITE(ramdisk_data_r, ramdisk_data_w ) - AM_RANGE(0x94, 0x94) AM_READ(ramdisk_control_r) -ADDRESS_MAP_END - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -/* The PX-4 has an exchangeable keyboard. Available is a standard ASCII - * keyboard and an "item" keyboard, as well as regional variants for - * UK, France, Germany, Denmark, Sweden, Norway, Italy and Spain. - */ - -// configuration dip switch found on the rom capsule board -static INPUT_PORTS_START( px4_dips ) - PORT_START("dips") - - PORT_DIPNAME(0x0f, 0x0f, "Character set") - PORT_DIPLOCATION("PX-4:8,7,6,5") - PORT_DIPSETTING(0x0f, "ASCII") - PORT_DIPSETTING(0x0e, "France") - PORT_DIPSETTING(0x0d, "Germany") - PORT_DIPSETTING(0x0c, "England") - PORT_DIPSETTING(0x0b, "Denmark") - PORT_DIPSETTING(0x0a, "Sweden") - PORT_DIPSETTING(0x09, "Italy") - PORT_DIPSETTING(0x08, "Spain") - PORT_DIPSETTING(0x07, DEF_STR(Japan)) - PORT_DIPSETTING(0x06, "Norway") - - PORT_DIPNAME(0x30, 0x30, "LST device") - PORT_DIPLOCATION("PX-4:4,3") - PORT_DIPSETTING(0x00, "SIO") - PORT_DIPSETTING(0x10, "Cartridge printer") - PORT_DIPSETTING(0x20, "RS-232C") - PORT_DIPSETTING(0x30, "Centronics printer") - - // available for user applications - PORT_DIPNAME(0x40, 0x40, "Not used") - PORT_DIPLOCATION("PX-4:2") - PORT_DIPSETTING(0x40, "Enable") - PORT_DIPSETTING(0x00, "Disable") - - // this is automatically selected by the os, the switch has no effect - PORT_DIPNAME(0x80, 0x00, "Keyboard type") - PORT_DIPLOCATION("PX-4:1") - PORT_DIPSETTING(0x80, "Item keyboard") - PORT_DIPSETTING(0x00, "Standard keyboard") -INPUT_PORTS_END - -// US ASCII keyboard -static INPUT_PORTS_START( px4_h450a ) - PORT_INCLUDE(px4_dips) - - PORT_START("keyboard_0") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // 00 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) // 01 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_NAME("Help") // 02 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("PF1") // 03 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_NAME("PF2") // 04 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_NAME("PF3") // 05 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_NAME("PF4") // 06 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_NAME("PF5") // 07 - PORT_BIT(0x0000ff00, IP_ACTIVE_HIGH, IPT_UNUSED) // 08-0f - PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) PORT_NAME("Stop") // 10 - PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') // 11 - PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') // 12 - PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // 13 - PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // 14 - PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // 15 - PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') // 16 - PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)0) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') // 17 - PORT_BIT(0xff000000, IP_ACTIVE_HIGH, IPT_UNUSED) // 18-1f - - PORT_START("keyboard_1") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // 20 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // 21 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // 22 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // 23 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // 24 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // 25 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // 26 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // 27 - PORT_BIT(0x0000ff00, IP_ACTIVE_HIGH, IPT_UNUSED) // 28-2f - PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // 30 - PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // 31 - PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // 32 - PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // 33 - PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // 34 - PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // 35 - PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // 36 - PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)1) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') // 37 - PORT_BIT(0xff000000, IP_ACTIVE_HIGH, IPT_UNUSED) // 38-3f - - PORT_START("keyboard_2") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // 40 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // 41 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // 42 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') // 43 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') // 44 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // 45 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_F9) PORT_CHAR('[') PORT_CHAR('{') // 46 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_F10) PORT_CHAR(']') PORT_CHAR('}') // 47 - PORT_BIT(0x0000ff00, IP_ACTIVE_HIGH, IPT_UNUSED) // 48-4f - PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') // 50 - PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') // 51 - PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') // 52 - PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') // 53 - PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') // 54 - PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // 55 - PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // 56 - PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)2) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') // 57 - PORT_BIT(0xff000000, IP_ACTIVE_HIGH, IPT_UNUSED) // 58-5f - - PORT_START("keyboard_3") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // 60 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // 61 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR(96) // 62 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // 63 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // 64 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // 65 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // 66 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // 67 - PORT_BIT(0x0000ff00, IP_ACTIVE_HIGH, IPT_UNUSED) // 48-4f - PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') // 70 - PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // 71 - PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') // 72 - PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // 73 - PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // 74 - PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // 75 - PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // 76 - PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)3) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // 77 - PORT_BIT(0xff000000, IP_ACTIVE_HIGH, IPT_UNUSED) // 58-5f - - PORT_START("keyboard_4") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)4) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) // 80 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)4) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(12) // 81 - PORT_BIT(0xfffffffc, IP_ACTIVE_HIGH, IPT_UNUSED) // 82-9f - - PORT_START("keyboard_5") - PORT_BIT(0x00000003, IP_ACTIVE_HIGH, IPT_UNUSED) // a0-a1 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) // a2 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // a3 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // a4 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_RALT) PORT_NAME("Graph") // a5 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // a6 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, px4_state, key_callback, (void *)5) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // a7 - PORT_BIT(0xffffff00, IP_ACTIVE_HIGH, IPT_UNUSED) // a8-bf /* b2-b7 are the 'make' codes for the above keys */ -INPUT_PORTS_END - -#if 0 - -/* item keyboard */ -static INPUT_PORTS_START( px4_h421a ) - PORT_INCLUDE(px4_dips) -INPUT_PORTS_END - -#endif - -//************************************************************************** -// PALETTE -//************************************************************************** - -PALETTE_INIT_MEMBER( px4_state, px4 ) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -PALETTE_INIT_MEMBER( px4p_state, px4p ) -{ - palette.set_pen_color(0, rgb_t(149, 157, 130)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static MACHINE_CONFIG_START( px4, px4_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, XTAL_7_3728MHz / 2) // uPD70008 - MCFG_CPU_PROGRAM_MAP(px4_mem) - MCFG_CPU_IO_MAP(px4_io) - - // video hardware - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(72) - MCFG_SCREEN_SIZE(240, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 63) - MCFG_SCREEN_UPDATE_DRIVER(px4_state, screen_update_px4) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_px4) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(px4_state, px4) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("one_sec", px4_state, upd7508_1sec_callback, attotime::from_seconds(1)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("frc", px4_state, frc_tick, attotime::from_hz(XTAL_7_3728MHz / 2 / 6)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64k") - MCFG_NVRAM_ADD_NO_FILL("nvram") - - // centronics printer - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(px4_state, centronics_busy_w)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(px4_state, centronics_perror_w)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - // external cassette - MCFG_CASSETTE_ADD("extcas") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) - - MCFG_TIMER_DRIVER_ADD("extcas_timer", px4_state, ext_cassette_read) - - // sio port - MCFG_EPSON_SIO_ADD("sio", NULL) - MCFG_EPSON_SIO_RX(WRITELINE(px4_state, sio_rx_w)) - MCFG_EPSON_SIO_PIN(WRITELINE(px4_state, sio_pin_w)) - - // rs232 port - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(WRITELINE(px4_state, rs232_rx_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE(px4_state, rs232_dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE(px4_state, rs232_dsr_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE(px4_state, rs232_cts_w)) - - // rom capsules - MCFG_GENERIC_CARTSLOT_ADD("capsule1", generic_plain_slot, "px4_cart") - MCFG_GENERIC_CARTSLOT_ADD("capsule2", generic_plain_slot, "px4_cart") - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list", "px4_cart") - MCFG_SOFTWARE_LIST_ADD("epson_cpm_list", "epson_cpm") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( px4p, px4, px4p_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(px4p_io) - - MCFG_NVRAM_ADD_0FILL("rdnvram") - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(px4p_state, px4p) - - MCFG_GENERIC_CARTSLOT_ADD("ramdisk_socket", generic_plain_slot, "px4_cart") -MACHINE_CONFIG_END - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -// Note: We are missing "Kana OS V1.0" and "Kana OS V2.0" (Japanese version) - -ROM_START( px4 ) - ROM_REGION(0x8000, "os", 0) - ROM_SYSTEM_BIOS(0, "default", "PX-4 OS ROM") - ROMX_LOAD("m25122aa_po_px4.10c", 0x0000, 0x8000, CRC(62d60dc6) SHA1(3d32ec79a317de7c84c378302e95f48d56505502), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "ramtest", "PX-4/PX-8 DRAM Test Ver. 1.0") - ROMX_LOAD("ramtest.10c", 0x0000, 0x8000, CRC(f8aced5f) SHA1(a5a2f398e602aa349c3636d6659dd0c7eaba07fb), ROM_BIOS(2)) - - ROM_REGION(0x1000, "slave", 0) - ROM_LOAD("upd7508.bin", 0x0000, 0x1000, NO_DUMP) -ROM_END - -ROM_START( px4p ) - ROM_REGION(0x8000, "os", 0) - ROM_SYSTEM_BIOS(0, "default", "PX-4+ OS ROM") - ROMX_LOAD("b0_pxa.10c", 0x0000, 0x8000, CRC(d74b9ef5) SHA1(baceee076c12f5a16f7a26000e9bc395d021c455), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "ramtest", "PX-4/PX-8 DRAM Test Ver. 1.0") - ROMX_LOAD("ramtest.10c", 0x0000, 0x8000, CRC(f8aced5f) SHA1(a5a2f398e602aa349c3636d6659dd0c7eaba07fb), ROM_BIOS(2)) - - ROM_REGION(0x1000, "slave", 0) - ROM_LOAD("upd7508.bin", 0x0000, 0x1000, NO_DUMP) -ROM_END - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1985, px4, 0, 0, px4, px4_h450a, px4_state, px4, "Epson", "PX-4", 0 ) -COMP( 1985, px4p, px4, 0, px4p, px4_h450a, px4p_state, px4p, "Epson", "PX-4+", 0 ) diff --git a/src/mess/drivers/px8.c b/src/mess/drivers/px8.c deleted file mode 100644 index 9557c46c2a9..00000000000 --- a/src/mess/drivers/px8.c +++ /dev/null @@ -1,838 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Curt Coder,Dirk Best -/*************************************************************************** - - Epson PX-8 - - 12/05/2009 Skeleton driver. - - Seems to be a CP/M computer. - -***************************************************************************/ - -/* - - TODO: - - - dumps of the internal ROMs - - uPD7508 CPU core - - keyboard - - cassette - - display - - jumpers - - ROM capsule - - uPD7001 - - RAM disk (64K/128K RAM, Z80, 4K ROM) - - modem (82C55) - - Multi-Unit (60K RAM, ROM capsule, modem, 82C55) - - attach PF-10s - -*/ - -#include "includes/px8.h" -#include "px8.lh" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define XTAL_CR1 XTAL_9_8304MHz -#define XTAL_CR2 XTAL_32_768kHz - -/* interrupt sources */ -#define INT0_7508 0x01 -#define INT1_SERIAL 0x02 -#define INT2_RS232 0x04 -#define INT3_BARCODE 0x08 -#define INT4_FRC 0x10 -#define INT5_OPTION 0x20 - -enum -{ - GAH40M_CTLR1 = 0, - GAH40M_CMDR, - GAH40M_CTLR2, - GAH40M_IER = 4 -}; - -enum -{ - GAH40M_ICRL_C = 0, - GAH40M_ICRH_C, - GAH40M_ICRL_B, - GAH40M_ICRH_B, - GAH40M_ISR, - GAH40M_STR, - GAH40M_SIOR, - GAH40M_IVR -}; - -/*************************************************************************** - READ/WRITE HANDLERS -***************************************************************************/ - -/*------------------------------------------------- - bankswitch - memory bankswitching --------------------------------------------------*/ - -void px8_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - UINT8 *ipl_rom = memregion(UPD70008_TAG)->base(); - - if (!m_bank0) - { - /* IPL ROM */ - program.install_rom(0x0000, 0x7fff, ipl_rom); - } - else - { - if (m_bk2) - { - /* D-RAM (L) */ - program.install_ram(0x0000, 0x7fff, ram); - } - else - { - /* OPTION ROM (L) */ - program.unmap_readwrite(0x0000, 0x7fff); - } - } - - if (m_bk2) - { - /* D-RAM (H) */ - program.install_ram(0x8000, 0xffff, ram + 0x8000); - } - else - { - /* OPTION ROM (H) */ - program.unmap_readwrite(0x8000, 0xffff); - } -} - -/*------------------------------------------------- - gah40m_r - GAH40M read --------------------------------------------------*/ - -READ8_MEMBER( px8_state::gah40m_r ) -{ - switch (offset) - { - case GAH40M_ICRL_C: - /* - - bit signal description - - 0 ICR0 - 1 ICR1 - 2 ICR2 - 3 ICR3 - 4 ICR4 - 5 ICR5 - 6 ICR6 - 7 ICR7 - - */ - break; - - case GAH40M_ICRH_C: - /* - - bit signal description - - 0 ICR8 - 1 ICR9 - 2 ICR10 - 3 ICR11 - 4 ICR12 - 5 ICR13 - 6 ICR14 - 7 ICR15 - - */ - break; - - case GAH40M_ICRL_B: - /* - - bit signal description - - 0 ICR0 - 1 ICR1 - 2 ICR2 - 3 ICR3 - 4 ICR4 - 5 ICR5 - 6 ICR6 - 7 ICR7 - - */ - break; - - case GAH40M_ICRH_B: - /* - - bit signal description - - 0 ICR8 - 1 ICR9 - 2 ICR10 - 3 ICR11 - 4 ICR12 - 5 ICR13 - 6 ICR14 - 7 ICR15 - - */ - break; - - case GAH40M_ISR: - /* - - bit signal description - - 0 INT0 7508 interrupt (INT 7508) - 1 INT1 82C51 interrupt (INT 82C51) - 2 INT2 6303 interrupt (INT 6303) - 3 INT3 input capture flag timer (CF) - 4 INT4 overflow flag timer (OVF) - 5 INT5 external interrupt (INTEXT) - 6 - 7 - - */ - break; - - case GAH40M_STR: - /* - - bit signal description - - 0 _BANK0 - 1 BRDT barcode reader data timer - 2 RDY ready (SIO) - 3 RDYSIO SIO ready (SIO) - 4 - 5 - 6 - 7 - - */ - break; - - case GAH40M_SIOR: - /* - - bit signal description - - 0 SIO0 - 1 SIO1 - 2 SIO2 - 3 SIO3 - 4 SIO4 - 5 SIO5 - 6 SIO6 - 7 SIO7 - - */ - break; - - case GAH40M_IVR: - /* - - bit description - - 0 0 - 1 vect 1 - 2 vect 2 - 3 vect 3 - 4 1 - 5 1 - 6 1 - 7 1 - - */ - break; - } - - return 0xff; -} - -/*------------------------------------------------- - gah40m_w - GAH40M write --------------------------------------------------*/ - -WRITE8_MEMBER( px8_state::gah40m_w ) -{ - switch (offset) - { - case GAH40M_CTLR1: - /* - - bit signal description - - 0 _BANK0 bank switching - 1 BCK0 barcode mode select 0 timer (down) - 2 BCK1 barcode mode select 1 timer (up) - 3 SWBCD barcode reader switch timer - 4 BRG0 bad rate generator select 0 timer - 5 BRG1 bad rate generator select 1 timer - 6 BRG2 bad rate generator select 2 timer - 7 BRG3 bad rate generator select 3 timer - - */ - - m_bank0 = BIT(data, 0); - bankswitch(); - break; - - case GAH40M_CMDR: - /* - - bit description - - 0 set RDYSIOFF (pulse) - 1 reset RDYSIOFF (pulse) - 2 reset OVF (pulse) - 3 - 4 - 5 - 6 - 7 - - */ - break; - - case GAH40M_CTLR2: - /* - - bit signal description - - 0 LED0 LED - 1 LED1 LED - 2 LED2 LED - 3 SWRS RS-232C switch - 4 INHRS inhibit RS-232C - 5 AUX external auxiliary output - 6 - 7 - - */ - - output_set_value("led_0", BIT(data, 0)); - output_set_value("led_1", BIT(data, 1)); - output_set_value("led_2", BIT(data, 2)); - break; - - case GAH40M_IER: - /* - - bit signal description - - 0 IER0 INT 7508 enable - 1 IER1 INT 82C51 enable - 2 IER2 INT 6303 enable - 3 IER3 INTICF enable - 4 IER4 INTOVF enable - 5 IER5 INTEXT enable - 6 - 7 - - */ - - m_ier = data; - break; - - case GAH40M_SIOR: - /* - - bit signal description - - 0 SIO0 - 1 SIO1 - 2 SIO2 - 3 SIO3 - 4 SIO4 - 5 SIO5 - 6 SIO6 - 7 SIO7 - - */ - - m_sio = data; - break; - } -} - -/*------------------------------------------------- - gah40s_r - GAH40S read --------------------------------------------------*/ - -READ8_MEMBER( px8_state::gah40s_r ) -{ - UINT8 data = 0xff; - - switch (offset) - { - case 0: /* counter (upper byte) input */ - data = (m_cnt >> 8) & 0x1f; - break; - - case 1: /* counter (lower byte) */ - data = m_cnt & 0xff; - break; - - case 3: /* P-ROM read data */ - data = m_prd; - break; - } - - return data; -} - -/*------------------------------------------------- - gah40s_w - GAH40S write --------------------------------------------------*/ - -WRITE8_MEMBER( px8_state::gah40s_w ) -{ - switch (offset) - { - case 0: /* counter reset */ - m_cnt = 0; - break; - - case 1: /* command register */ - /* - - bit signal description - - 0 SW PR PROM power switch - 1 SW MCT microcassette power switch - 2 MTA microcassette drive motor control signal A - 3 MTB microcassette drive motor control signal B - 4 MTC microcassette drive motor control signal C - 5 - 6 _FAST - 7 _STOP CNT - - */ - - m_swpr = BIT(data, 0); - break; - - case 2: /* P-ROM address (upper 8 byte) */ - m_pra = (data << 8) | (m_pra & 0xff); - m_prd = 0; // TODO read prom! - break; - - case 3: /* P-ROM address (lower 8 byte) */ - m_pra = (m_pra & 0xff00) | data; - m_prd = 0; // TODO read prom! - break; - } -} - -/*------------------------------------------------- - gah40s_ier_w - interrupt enable register write --------------------------------------------------*/ - -WRITE8_MEMBER( px8_state::gah40s_ier_w ) -{ - m_ier = data; -} - -/*------------------------------------------------- - krtn_read - read keyboard return --------------------------------------------------*/ - -UINT8 px8_state::krtn_read() -{ - UINT8 data = 0xff; - - switch (m_ksc) - { - case 0: data = ioport("KSC0")->read(); break; - case 1: data = ioport("KSC1")->read(); break; - case 2: data = ioport("KSC2")->read(); break; - case 3: data = ioport("KSC3")->read(); break; - case 4: data = ioport("KSC4")->read(); break; - case 5: data = ioport("KSC5")->read(); break; - case 6: data = ioport("KSC6")->read(); break; - case 7: data = ioport("KSC7")->read(); break; - case 8: data = ioport("KSC8")->read(); break; - case 9: data = ioport("SW4")->read(); break; - } - - return data; -} - -/*------------------------------------------------- - krtn_0_3_r - keyboard return 0..3 read --------------------------------------------------*/ - -READ8_MEMBER( px8_state::krtn_0_3_r ) -{ - return krtn_read() & 0x0f; -} - -/*------------------------------------------------- - krtn_4_7_r - keyboard return 4..7 read --------------------------------------------------*/ - -READ8_MEMBER( px8_state::krtn_4_7_r ) -{ - return krtn_read() >> 4; -} - -/*------------------------------------------------- - ksc_w - keyboard scan write --------------------------------------------------*/ - -WRITE8_MEMBER( px8_state::ksc_w ) -{ - m_ksc = data; -} - -/*************************************************************************** - MEMORY MAPS -***************************************************************************/ - -/*------------------------------------------------- - ADDRESS_MAP( px8_mem ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( px8_mem, AS_PROGRAM, 8, px8_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_RAMBANK("bank0") - AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank1") -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( px8_io ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( px8_io, AS_IO, 8, px8_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x0f) - AM_RANGE(0x00, 0x07) AM_READWRITE(gah40m_r, gah40m_w) - AM_RANGE(0x0c, 0x0c) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x0d, 0x0d) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) -// AM_RANGE(0x0e, 0x0e) AM_DEVREADWRITE(SED1320_TAG, sed1330_device, status_r, data_w) -// AM_RANGE(0x0f, 0x0f) AM_DEVREADWRITE(SED1320_TAG, sed1330_device, data_r, command_w) -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( px8_slave_mem ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( px8_slave_mem, AS_PROGRAM, 8, px8_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0020, 0x0023) AM_READWRITE(gah40s_r, gah40s_w) -// AM_RANGE(0x0024, 0x0027) AM_DEVREADWRITE_LEGACY(SED1320_TAG, ) - AM_RANGE(0x0028, 0x0028) AM_WRITE(gah40s_ier_w) - AM_RANGE(0x8000, 0x97ff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0x9800, 0xefff) AM_NOP - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6303_TAG, 0) /* internal mask rom */ -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( px8_slave_io ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( px8_slave_io, AS_IO, 8, px8_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(M6801_PORT1, M6801_PORT1) - AM_RANGE(M6801_PORT2, M6801_PORT2) - AM_RANGE(M6801_PORT3, M6801_PORT3) - AM_RANGE(M6801_PORT4, M6801_PORT4) -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( px8_sub_io ) --------------------------------------------------*/ -#ifdef UNUSED_CODE -static ADDRESS_MAP_START( px8_sub_io, AS_IO, 8, px8_state ) -// AM_RANGE(0x00, 0x00) AM_READWRITE() - AM_RANGE(0x01, 0x01) AM_READ(krtn_0_3_r) -// AM_RANGE(0x02, 0x02) AM_WRITE() - AM_RANGE(0x03, 0x03) AM_WRITE(ksc_w) -// AM_RANGE(0x04, 0x04) AM_WRITE() - AM_RANGE(0x05, 0x05) AM_READ(krtn_4_7_r) -// AM_RANGE(0x06, 0x06) AM_READ() -// AM_RANGE(0x07, 0x07) AM_WRITE() -ADDRESS_MAP_END -#endif -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( px8 ) - PORT_START("KSC0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SCRN INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NUM GRPH") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - - PORT_START("KSC1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF1") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF2") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF3") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PF5") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("KSC2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("KSC3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - - PORT_START("KSC4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - - PORT_START("KSC5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("KSC6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - - PORT_START("KSC7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR(96) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - - PORT_START("KSC8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("SW4") - PORT_DIPNAME( 0xef, 0x2f, "Character Set" ) PORT_DIPLOCATION("SW4:1,2,3,4,6,7,8") - PORT_DIPSETTING( 0x2f, "ASCII" ) - PORT_DIPSETTING( 0x2e, DEF_STR( French ) ) - PORT_DIPSETTING( 0x2d, DEF_STR( German ) ) - PORT_DIPSETTING( 0x2c, DEF_STR( English ) ) - PORT_DIPSETTING( 0x2b, "Danish" ) - PORT_DIPSETTING( 0x2a, "Swedish" ) - PORT_DIPSETTING( 0x26, "Norwegian" ) - PORT_DIPSETTING( 0x29, "Italy" ) - PORT_DIPSETTING( 0x28, "Spain" ) - PORT_DIPSETTING( 0x60, "HASCI" ) - PORT_DIPSETTING( 0x21, "Japanese (Japanese)" ) - PORT_DIPSETTING( 0x00, "Japanese (JIS)" ) - PORT_DIPSETTING( 0x01, "Japanese (touch 16)" ) - PORT_DIPNAME( 0x10, 0x00, "RAM disk check" ) PORT_DIPLOCATION("SW4:5") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) -INPUT_PORTS_END - -/*************************************************************************** - VIDEO -***************************************************************************/ - -PALETTE_INIT_MEMBER(px8_state, px8) -{ - palette.set_pen_color(0, 0xa5, 0xad, 0xa5); - palette.set_pen_color(1, 0x31, 0x39, 0x10); -} - -UINT32 px8_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -/*------------------------------------------------- - gfx_layout px8_charlayout --------------------------------------------------*/ - -static const gfx_layout px8_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -/*------------------------------------------------- - GFXDECODE( px8 ) --------------------------------------------------*/ - -static GFXDECODE_START( px8 ) - GFXDECODE_ENTRY( SED1320_TAG, 0x0000, px8_charlayout, 0, 1 ) -GFXDECODE_END - -/*************************************************************************** - MACHINE INITIALIZATION -***************************************************************************/ - -/*------------------------------------------------- - MACHINE_START( px8 ) --------------------------------------------------*/ - -void px8_state::machine_start() -{ - /* register for state saving */ - save_item(NAME(m_ier)); - save_item(NAME(m_isr)); - save_item(NAME(m_bank0)); - save_item(NAME(m_bk2)); - save_item(NAME(m_sio)); - save_item(NAME(m_ksc)); -} - -void px8_state::machine_reset() -{ - m_bank0 = 0; - m_bk2 = 1; - - bankswitch(); -} - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static MACHINE_CONFIG_START( px8, px8_state ) - /* main cpu (uPD70008) */ - MCFG_CPU_ADD(UPD70008_TAG, Z80, XTAL_CR1 / 4) /* 2.45 MHz */ - MCFG_CPU_PROGRAM_MAP(px8_mem) - MCFG_CPU_IO_MAP(px8_io) - - /* slave cpu (HD6303) */ - MCFG_CPU_ADD(HD6303_TAG, M6803, XTAL_CR1 / 4) /* 614 kHz */ - MCFG_CPU_PROGRAM_MAP(px8_slave_mem) - MCFG_CPU_IO_MAP(px8_slave_io) - MCFG_DEVICE_DISABLE() - - /* sub CPU (uPD7508) */ -// MCFG_CPU_ADD(UPD7508_TAG, UPD7508, 200000) /* 200 kHz */ -// MCFG_CPU_IO_MAP(px8_sub_io) -// MCFG_DEVICE_DISABLE() - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_px8) - - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(72) - MCFG_SCREEN_UPDATE_DRIVER(px8_state, screen_update) - MCFG_SCREEN_SIZE(480, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 479, 0, 63) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", px8) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(px8_state, px8) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(0, "mono", 0.25) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("capsule1", generic_plain_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_GENERIC_CARTSLOT_ADD("capsule2", generic_plain_slot, NULL) - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* devices */ - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // software - MCFG_SOFTWARE_LIST_ADD("epson_cpm_list", "epson_cpm") -MACHINE_CONFIG_END - -/*************************************************************************** - ROMS -***************************************************************************/ - -ROM_START( px8 ) - ROM_REGION( 0x10000, UPD70008_TAG, 0 ) - ROM_DEFAULT_BIOS("052884") - ROM_SYSTEM_BIOS( 0, "091383", "9/13/83" ) - ROMX_LOAD( "m25030aa.2a", 0x0000, 0x8000, CRC(bd3e4938) SHA1(5bd48abd2a563a1ae31ff137280f40c8f756e969), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "052884", "5/28/84" ) - ROMX_LOAD( "px060688.2a", 0x0000, 0x8000, CRC(44308bdf) SHA1(5c4545fcf1af9931b4699436294d9b6298052a7b), ROM_BIOS(2) ) - - ROM_REGION( 0x0800, SED1320_TAG, 0 ) - ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(5b52edbd) SHA1(38197edf301bb2843bea040536af545f76b3d44f) ) - - ROM_REGION( 0x1000, HD6303_TAG, 0 ) - ROM_LOAD( "hd6303 slave cpu internal rom.13d", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x1000, UPD7508_TAG, 0 ) - ROM_LOAD( "upd7508 sub cpu internal rom.2e", 0x0000, 0x1000, NO_DUMP ) -ROM_END - -/*************************************************************************** - SYSTEM DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, px8, 0, 0, px8, px8, driver_device, 0, "Epson", "PX-8", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pyl601.c b/src/mess/drivers/pyl601.c deleted file mode 100644 index 3073d635e20..00000000000 --- a/src/mess/drivers/pyl601.c +++ /dev/null @@ -1,622 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Pyldin-601 - - 12/05/2009 Skeleton driver. - 22/04/2012 Added sound, fixed keyboard, marked as working [Robbbert] - - ToDo? - - PYL601 - command 'MODE80' does nothing - - - PYL601a - most software looks odd (unplayable) because of the - different design of the screen. - - PYL601A - command 'MODE40' doesn't go to 40-columns, instead - there is a space between each letter. - - - The BASIC - - to get back to dos, enter SYSTEM - - It has its own internal monitor: MON to enter, Q to exit. - - - -':maincpu' (F013): unmapped program memory write to E628 = 00 & FF -':maincpu' (FCBC): unmapped program memory write to E636 = 00 & FF -':maincpu' (FCBC): unmapped program memory write to E637 = 00 & FF -':maincpu' (FCC2): unmapped program memory write to E634 = 07 & FF -':maincpu' (FCC2): unmapped program memory write to E635 = FF & FF -':maincpu' (FCC7): unmapped program memory write to E637 = 34 & FF -':maincpu' (FCCC): unmapped program memory write to E637 = 3C & FF -':maincpu' (FCCF): unmapped program memory write to E636 = 3C & FF -':maincpu' (FCD3): unmapped program memory read from E634 & FF - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "video/mc6845.h" -#include "sound/speaker.h" -#include "formats/pyldin_dsk.h" -#include "machine/upd765.h" -#include "machine/ram.h" - - -class pyl601_state : public driver_device -{ -public: - pyl601_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_speaker(*this, "speaker"), - m_fdc(*this, "upd765"), - m_ram(*this, RAM_TAG), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") { } - - UINT8 m_rom_page; - UINT32 m_vdisk_addr; - UINT8 m_key_code; - UINT8 m_keyboard_clk; - UINT8 m_video_mode; - UINT8 m_tick50_mark; - UINT8 m_floppy_ctrl; - DECLARE_READ8_MEMBER(rom_page_r); - DECLARE_WRITE8_MEMBER(rom_page_w); - DECLARE_WRITE8_MEMBER(vdisk_page_w); - DECLARE_WRITE8_MEMBER(vdisk_h_w); - DECLARE_WRITE8_MEMBER(vdisk_l_w); - DECLARE_WRITE8_MEMBER(vdisk_data_w); - DECLARE_READ8_MEMBER(vdisk_data_r); - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_READ8_MEMBER(keycheck_r); - DECLARE_WRITE8_MEMBER(video_mode_w); - DECLARE_READ8_MEMBER(video_mode_r); - DECLARE_READ8_MEMBER(timer_r); - DECLARE_WRITE8_MEMBER(speaker_w); - DECLARE_WRITE8_MEMBER(led_w); - DECLARE_WRITE8_MEMBER(floppy_w); - DECLARE_READ8_MEMBER(floppy_r); - MC6845_UPDATE_ROW(pyl601_update_row); - MC6845_UPDATE_ROW(pyl601a_update_row); - UINT8 selectedline(UINT16 data); - required_device m_speaker; - required_device m_fdc; - required_device m_ram; - DECLARE_DRIVER_INIT(pyl601); - virtual void machine_reset(); - virtual void video_start(); - INTERRUPT_GEN_MEMBER(pyl601_interrupt); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - required_device m_maincpu; - required_device m_palette; -}; - - - -READ8_MEMBER(pyl601_state::rom_page_r) -{ - return m_rom_page; -} - -WRITE8_MEMBER(pyl601_state::rom_page_w) -{ - m_rom_page = data; - if (data & 8) - { - int chip = (data >> 4) % 5; - int page = data & 7; - membank("bank2")->set_base(memregion("romdisk")->base() + chip*0x10000 + page * 0x2000); - } - else - { - membank("bank2")->set_base(m_ram->pointer() + 0xc000); - } -} - - -WRITE8_MEMBER(pyl601_state::vdisk_page_w) -{ - m_vdisk_addr = (m_vdisk_addr & 0x0ffff) | ((data & 0x0f)<<16); -} - -WRITE8_MEMBER(pyl601_state::vdisk_h_w) -{ - m_vdisk_addr = (m_vdisk_addr & 0xf00ff) | (data<<8); -} - -WRITE8_MEMBER(pyl601_state::vdisk_l_w) -{ - m_vdisk_addr = (m_vdisk_addr & 0xfff00) | data; -} - -WRITE8_MEMBER(pyl601_state::vdisk_data_w) -{ - m_ram->pointer()[0x10000 + (m_vdisk_addr & 0x7ffff)] = data; - m_vdisk_addr++; - m_vdisk_addr&=0x7ffff; -} - -READ8_MEMBER(pyl601_state::vdisk_data_r) -{ - UINT8 retVal = m_ram->pointer()[0x10000 + (m_vdisk_addr & 0x7ffff)]; - m_vdisk_addr++; - m_vdisk_addr &= 0x7ffff; - return retVal; -} - -UINT8 pyl601_state::selectedline(UINT16 data) -{ - UINT8 i; - for(i = 0; i < 16; i++) - if (BIT(data, i)) - return i; - - return 0; -} - -READ8_MEMBER(pyl601_state::keyboard_r) -{ - UINT8 ret = m_key_code; - m_key_code = 0xff; - return ret; -} - -READ8_MEMBER(pyl601_state::keycheck_r) -{ - UINT8 retVal = 0x3f; - UINT8 *keyboard = memregion("keyboard")->base(); - UINT16 row1 = ioport("ROW1")->read(); - UINT16 row2 = ioport("ROW2")->read(); - UINT16 row3 = ioport("ROW3")->read(); - UINT16 row4 = ioport("ROW4")->read(); - UINT16 row5 = ioport("ROW5")->read(); - UINT16 all = row1 | row2 | row3 | row4 | row5; - UINT16 addr = ioport("MODIFIERS")->read(); - if (all) - { - addr |= selectedline(all) << 2; - - addr |= ((row5 == 0x00) ? 1 : 0) << 6; - addr |= ((row4 == 0x00) ? 1 : 0) << 7; - addr |= ((row3 == 0x00) ? 1 : 0) << 8; - addr |= ((row2 == 0x00) ? 1 : 0) << 9; - addr |= ((row1 == 0x00) ? 1 : 0) << 10; - - m_key_code = keyboard[addr]; - m_keyboard_clk = ~m_keyboard_clk; - - if (m_keyboard_clk) - retVal |= 0x80; - } - return retVal; -} - - -WRITE8_MEMBER(pyl601_state::video_mode_w) -{ - m_video_mode = data; -} - -READ8_MEMBER(pyl601_state::video_mode_r) -{ - return m_video_mode; -} - -READ8_MEMBER(pyl601_state::timer_r) -{ - UINT8 retVal= m_tick50_mark | 0x37; - m_tick50_mark = 0; - return retVal; -} - -WRITE8_MEMBER(pyl601_state::speaker_w) -{ - m_speaker->level_w(BIT(data, 3)); -} - -WRITE8_MEMBER(pyl601_state::led_w) -{ -// UINT8 caps_led = BIT(data,4); -} - -WRITE8_MEMBER(pyl601_state::floppy_w) -{ - // bit 0 is reset (if zero) - // bit 1 is TC state - // bit 2 is drive selected - // bit 3 is motor state - - if (BIT(data,0)==0) - //reset - m_fdc->reset(); - - floppy_image_device *floppy = machine().device(BIT(data,2) ? "upd765:1" : "upd765:0")->get_device(); - if(floppy) - floppy->mon_w(!BIT(data, 3)); - - m_fdc->tc_w(BIT(data, 1)); - - m_floppy_ctrl = data; -} - -READ8_MEMBER(pyl601_state::floppy_r) -{ - return m_floppy_ctrl; -} - -static ADDRESS_MAP_START(pyl601_mem, AS_PROGRAM, 8, pyl601_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xbfff ) AM_RAMBANK("bank1") - AM_RANGE( 0xc000, 0xdfff ) AM_RAMBANK("bank2") - AM_RANGE( 0xe000, 0xe5ff ) AM_RAMBANK("bank3") - AM_RANGE( 0xe600, 0xe600 ) AM_MIRROR(4) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE( 0xe601, 0xe601 ) AM_MIRROR(4) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE( 0xe628, 0xe628 ) AM_READ(keyboard_r) - AM_RANGE( 0xe629, 0xe629 ) AM_READWRITE(video_mode_r,video_mode_w) - AM_RANGE( 0xe62a, 0xe62a ) AM_READWRITE(keycheck_r,led_w) - AM_RANGE( 0xe62b, 0xe62b ) AM_READWRITE(timer_r,speaker_w) - AM_RANGE( 0xe62d, 0xe62d ) AM_READ(video_mode_r) - AM_RANGE( 0xe62e, 0xe62e ) AM_READWRITE(keycheck_r,led_w) - AM_RANGE( 0xe680, 0xe680 ) AM_WRITE(vdisk_page_w) - AM_RANGE( 0xe681, 0xe681 ) AM_WRITE(vdisk_h_w) - AM_RANGE( 0xe682, 0xe682 ) AM_WRITE(vdisk_l_w) - AM_RANGE( 0xe683, 0xe683 ) AM_READWRITE(vdisk_data_r,vdisk_data_w) - AM_RANGE( 0xe6c0, 0xe6c0 ) AM_READWRITE(floppy_r, floppy_w) - AM_RANGE( 0xe6d0, 0xe6d1 ) AM_DEVICE("upd765", upd765a_device, map) - AM_RANGE( 0xe6f0, 0xe6f0 ) AM_READWRITE(rom_page_r, rom_page_w) - AM_RANGE( 0xe700, 0xefff ) AM_RAMBANK("bank4") - AM_RANGE( 0xf000, 0xffff ) AM_READ_BANK("bank5") AM_WRITE_BANK("bank6") -ADDRESS_MAP_END - -/* Input ports */ -/* A small note about natural keyboard mode: Ctrl is mapped to PGUP and the 'Lat/Cyr' key is mapped to PGDOWN */ -static INPUT_PORTS_START( pyl601 ) - PORT_START("ROW1") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Lat/Cyr") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("ROW2") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') // it should be the 4th key at right of 'L' - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW3") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - - PORT_START("ROW4") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW5") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F15)) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F14)) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F13)) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("MODIFIERS") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) -INPUT_PORTS_END - -void pyl601_state::machine_reset() -{ - UINT8 *ram = m_ram->pointer(); - m_key_code = 0xff; - membank("bank1")->set_base(ram + 0x0000); - membank("bank2")->set_base(ram + 0xc000); - membank("bank3")->set_base(ram + 0xe000); - membank("bank4")->set_base(ram + 0xe700); - membank("bank5")->set_base(memregion("maincpu")->base() + 0xf000); - membank("bank6")->set_base(ram + 0xf000); - - m_maincpu->reset(); -} - -void pyl601_state::video_start() -{ -} - -MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 *charrom = memregion("chargen")->base(); - - int column, bit, i; - UINT8 data; - if (BIT(m_video_mode, 5) == 0) - { - for (column = 0; column < x_count; column++) - { - UINT8 code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; - code = ((code << 1) | (code >> 7)) & 0xff; - if (column == cursor_x-2) - data = 0xff; - else - data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff]; - - for (bit = 0; bit < 8; bit++) - { - int x = (column * 8) + bit; - - bitmap.pix32(y, x) = palette[BIT(data, 7)]; - - data <<= 1; - } - } - } - else - { - for (i = 0; i < x_count; i++) - { - data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; - for (bit = 0; bit < 8; bit++) - { - bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; - data <<= 1; - } - } - } -} - -MC6845_UPDATE_ROW( pyl601_state::pyl601a_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 *charrom = memregion("chargen")->base(); - - int column, bit, i; - UINT8 data; - if (BIT(m_video_mode, 5) == 0) - { - for (column = 0; column < x_count; column++) - { - UINT8 code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; - data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; - if (column == cursor_x) - data = 0xff; - - for (bit = 0; bit < 8; bit++) - { - int x = (column * 8) + bit; - - bitmap.pix32(y, x) = palette[BIT(data, 7)]; - - data <<= 1; - } - } - } - else - { - for (i = 0; i < x_count; i++) - { - data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; - for (bit = 0; bit < 8; bit++) - { - bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; - data <<= 1; - } - } - } -} - - - -DRIVER_INIT_MEMBER(pyl601_state,pyl601) -{ - memset(m_ram->pointer(), 0, 64 * 1024); -} - -INTERRUPT_GEN_MEMBER(pyl601_state::pyl601_interrupt) -{ - m_tick50_mark = 0x80; - device.execute().set_input_line(0, HOLD_LINE); -} - -FLOPPY_FORMATS_MEMBER( pyl601_state::floppy_formats ) - FLOPPY_PYLDIN_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( pyl601_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -/* F4 Character Displayer */ -static const gfx_layout pyl601_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout pyl601a_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( pyl601 ) - GFXDECODE_ENTRY( "chargen", 0x0000, pyl601_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( pyl601a ) - GFXDECODE_ENTRY( "chargen", 0x0000, pyl601a_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( pyl601, pyl601_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6800, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(pyl601_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pyl601_state, pyl601_interrupt) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pyl601) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_2MHz) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) /* ? */ - MCFG_MC6845_UPDATE_ROW_CB(pyl601_state, pyl601_update_row) - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", pyl601_floppies, "525hd", pyl601_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", pyl601_floppies, "525hd", pyl601_state::floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","pyl601") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("576K") // 64 + 512 -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pyl601a, pyl601 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK( XTAL_2MHz) - - MCFG_GFXDECODE_MODIFY("gfxdecode", pyl601a) - - MCFG_DEVICE_REMOVE("crtc") - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_2MHz) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) /* ? */ - MCFG_MC6845_UPDATE_ROW_CB(pyl601_state, pyl601a_update_row) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( pyl601 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bios.rom", 0xf000, 0x1000, CRC(41fe4c4b) SHA1(d8ca92aea0eb283e8d7779cb976bcdfa03e81aea)) - - ROM_REGION(0x0800, "chargen", 0) - ROM_LOAD( "video.rom", 0x0000, 0x0800, CRC(1c23ba43) SHA1(eb1cfc139858abd0aedbbf3d523f8ba55d27a11d)) - - ROM_REGION(0x50000, "romdisk", ROMREGION_ERASEFF) - ROM_LOAD( "rom0.rom", 0x00000, 0x10000, CRC(60103920) SHA1(ee5b4ee5b513c4a0204da751e53d63b8c6c0aab9)) - ROM_LOAD( "rom1.rom", 0x10000, 0x10000, CRC(cb4a9b22) SHA1(dd09e4ba35b8d1a6f60e6e262aaf2f156367e385)) - ROM_LOAD( "rom2.rom", 0x20000, 0x08000, CRC(0b7684bf) SHA1(c02ad1f2a6f484cd9d178d8b060c21c0d4e53442)) - ROM_COPY("romdisk", 0x20000, 0x28000, 0x08000) - ROM_LOAD( "rom3.rom", 0x30000, 0x08000, CRC(e4a86dfa) SHA1(96e6bb9ffd66f81fca63bf7491fbba81c4ff1fd2)) - ROM_COPY("romdisk", 0x30000, 0x38000, 0x08000) - ROM_LOAD( "rom4.rom", 0x40000, 0x08000, CRC(d88ac21d) SHA1(022db11fdcf8db81ce9efd9cd9fa50ebca88e79e)) - ROM_COPY("romdisk", 0x40000, 0x48000, 0x08000) - - ROM_REGION(0x0800, "keyboard", 0) - ROM_LOAD( "keyboard.rom", 0x0000, 0x0800, CRC(41fbe5ca) SHA1(875adaef53bc37e92ad0b6b6ee3d8fd28344d358)) -ROM_END - -ROM_START( pyl601a ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bios_a.rom", 0xf000, 0x1000, CRC(e018b11e) SHA1(884d59abd5fa5af1295d1b5a53693facc7945b63)) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "video_a.rom", 0x0000,0x1000, CRC(00fa4077) SHA1(d39d15969a08bdb768d08bea4ec9a9cb498232fd)) - - ROM_REGION(0x50000, "romdisk", ROMREGION_ERASEFF) - ROM_LOAD( "rom0.rom", 0x00000, 0x10000, CRC(60103920) SHA1(ee5b4ee5b513c4a0204da751e53d63b8c6c0aab9)) - ROM_LOAD( "rom1.rom", 0x10000, 0x10000, CRC(cb4a9b22) SHA1(dd09e4ba35b8d1a6f60e6e262aaf2f156367e385)) - ROM_LOAD( "rom2.rom", 0x20000, 0x08000, CRC(0b7684bf) SHA1(c02ad1f2a6f484cd9d178d8b060c21c0d4e53442)) - ROM_COPY("romdisk", 0x20000, 0x28000, 0x08000) - ROM_LOAD( "rom3.rom", 0x30000, 0x08000, CRC(e4a86dfa) SHA1(96e6bb9ffd66f81fca63bf7491fbba81c4ff1fd2)) - ROM_COPY("romdisk", 0x30000, 0x38000, 0x08000) - ROM_LOAD( "rom4.rom", 0x40000, 0x08000, CRC(d88ac21d) SHA1(022db11fdcf8db81ce9efd9cd9fa50ebca88e79e)) - ROM_COPY("romdisk", 0x40000, 0x48000, 0x08000) - - ROM_REGION(0x0800, "keyboard", 0) - ROM_LOAD( "keyboard.rom", 0x0000, 0x0800, CRC(41fbe5ca) SHA1(875adaef53bc37e92ad0b6b6ee3d8fd28344d358)) -ROM_END -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, pyl601, 0, 0, pyl601, pyl601, pyl601_state, pyl601, "Mikroelektronika", "Pyldin-601", 0 ) -COMP( 1989, pyl601a, pyl601, 0, pyl601a, pyl601, pyl601_state, pyl601, "Mikroelektronika", "Pyldin-601A", 0 ) diff --git a/src/mess/drivers/ql.c b/src/mess/drivers/ql.c deleted file mode 100644 index e8749cb6695..00000000000 --- a/src/mess/drivers/ql.c +++ /dev/null @@ -1,1152 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Phill Harvey-Smith -/* - - Sinclair QL - - MESS Driver by Curt Coder - -*/ - -/* - - TODO: - - - microdrive - - ZX8301 memory access slowdown - - use resnet.h to create palette - - Tyche bios is broken - - several disk interfaces (720K/1.44MB/3.2MB) - - Gold Card (68000 @ 16MHz, 2MB RAM) - - Super Gold Card (68020 @ 24MHz, 4MB RAM) - - QLToolkit II ROM - - GST 68kOS ROM - - natural keyboard SHIFT does not work, it causes characters to be skipped altogether - - get modified Danish version to boot (e.g. MD_DESEL was patched to jump to 0x1cd5e) - - ICL One Per Desk / British Telecom Merlin Tonto / Telecom Australia Computerphone / Mega OPD (US) - - OPD: 68008P8 @ 7.5MHz, ZX8301 @ 12MHz, CDP65C51E1 @ 1.8432MHz, 128K RAM, 2K NVRAM, 128K ROM (4x32), 16K speech ROM, ADM7910 modem, TMS5220 speech, 2x100K microdrives, RTC 1/1/1970, 1xRS-423 - - Sandy Q-XT 640 (original motherboard, Super QBoard 512KB, Centronics, Super Toolkit II, FDC, 1 or 2 3.5" 1MB drives, 3 expansion slots) - - CST Thor PC 1F (720K 3.5") - - CST Thor PC 2F (2x 720k 3.5") - - CST Thor PC 2FW (20MB Winchester + 720K 3.5") - - CST Thor 20 (68020) - - CST Thor 21 (68020+68881) - - CST Thor XVI CF (Workstation, 68000 @ 8 MHz, M6802, 68682 DUART) - - CST Thor XVI IF (Single Floppy) - - CST Thor XVI FF (Dual Floppy) - - CST Thor XVI W20F (20MB Winchester, 1 Floppy) - - CST Thor XVI W20FF (20MB Winchester, 2 Floppies) - - CST Thor XVI W40F (40MB Winchester, 1 Floppy) - - CST Thor XVI W40FF (40MB Winchester, 2 Floppies) - - - 2011-02-22, P.Harvey-Smith, - Implemented Miracle Trump Card disk and ram interface. - - The trump card has some interesting memory mapping and re-mapping during initialisation which goes like this - - On reset the card ram is mapped into the entire $40000-$fffff area, this is the official 512K expansion ram area - plus the area set aside for addon card roms. The trump card onboard rom is also mapped in at $10000-$17fff. - - The main bios then performs a series of loops that initialise and size the ram, this will find either - 0K, 256K, 512K or 768K of expansion ram depending on how many banks of ram are populated. - - After the ram test, the main bios looks for the signature longword of a cartridge rom at $0c000, this read - triggers the Trump Card to also map it's rom in at $c0000-$c7fff, the first addon rom area. If a cartridge - rom is found it is first initialised. - - The main bios goes on to search the addon card rom area from $c0000 by searching for the signature word for - an addon rom at $c0000 and upwards in 16K steps (there is a bug in JM and before that means they only find - the first addon, but this does not matter). - - The main bios finds the trump card addon rom at $c0000, and calls it's initialisation routine at $c011e, this - contains a jump instruction to jump to $10124 (in the lower mapped copy of the trumpcard rom). - - The first memory access in the $10000-$17fff range triggers the trumcard to page out the rom at $c0000, and - page the ram back in. Once it arrives at this state the ram will remain paged in until the next reset. - - I have implemented this with a pair of read handlers at $0c000-$0cfff and $10000-$17fff which do the apropreate - re-map of the upper area and then remove themselves from the address map and return it to simple rom handlers. - - On the Trump card the above is implemented with a pair of 16L8 PAL chips, the logic of these was decoded with - the assistance of Malcolm Lear, without who's help working all this out would have been a much harder process. - -*/ - -#include "includes/ql.h" - - - -//************************************************************************** -// ADDRESS DECODING -//************************************************************************** - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( ql_state::read ) -{ - UINT8 data = 0; - int cart_romoeh = 0; - int exp_romoeh = 0; - - if (offset < 0xc000) - { - data = m_rom->base()[offset]; - } - if (offset >= 0xc000 && offset < 0x10000) - { - cart_romoeh = 1; - } - if (offset >= 0x18000 && offset <= 0x18003) - { - data = m_zx8302->rtc_r(space, offset & 0x03); - } - if (offset == 0x18020) - { - data = m_zx8302->status_r(space, 0); - } - if (offset == 0x18021) - { - data = m_zx8302->irq_status_r(space, 0); - } - if (offset >= 0x18022 && offset <= 0x18023) - { - data = m_zx8302->mdv_track_r(space, offset & 0x01); - } - if (offset >= 0x20000 && offset < 0x40000) - { - data = m_zx8301->data_r(space, offset & 0x1ffff); - } - if (offset >= 0xc0000) - { - exp_romoeh = 1; - } - if (m_qimi_enabled) - { - data = m_qimi->read(space, offset, data); - } - - m_cart->romoeh_w(cart_romoeh); - data = m_cart->read(space, offset & 0x7fff, data); - m_cart->romoeh_w(0); - - m_exp->romoeh_w(exp_romoeh); - data = m_exp->read(space, offset, data); - m_exp->romoeh_w(0); - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( ql_state::write ) -{ - if (offset >= 0x18000 && offset <= 0x18001) - { - m_zx8302->rtc_w(space, offset & 0x01, data); - } - if (offset == 0x18002) - { - m_zx8302->control_w(space, 0, data); - } - if (offset == 0x18003) - { - m_zx8302->ipc_command_w(space, 0, data); - } - if (offset == 0x18020) - { - m_zx8302->mdv_control_w(space, 0, data); - } - if (offset == 0x18021) - { - m_zx8302->irq_acknowledge_w(space, 0, data); - } - if (offset == 0x18022) - { - m_zx8302->data_w(space, 0, data); - } - if (offset == 0x18063) - { - m_zx8301->control_w(space, 0, data); - } - if (offset >= 0x20000 && offset < 0x40000) - { - m_zx8301->data_w(space, offset & 0x1ffff, data); - } - if (m_qimi_enabled) - { - m_qimi->write(space, offset, data); - } - - m_cart->romoeh_w(0); - m_cart->write(space, offset & 0x7fff, data); - - m_exp->romoeh_w(0); - m_exp->write(space, offset, data); -} - - - -//************************************************************************** -// INTELLIGENT PERIPHERAL CONTROLLER -//************************************************************************** - -//------------------------------------------------- -// ipc_w - -//------------------------------------------------- - -WRITE8_MEMBER( ql_state::ipc_w ) -{ - m_zx8302->comctl_w(0); - m_zx8302->comctl_w(1); -} - - -//------------------------------------------------- -// ipc_port1_w - -//------------------------------------------------- - -WRITE8_MEMBER( ql_state::ipc_port1_w ) -{ - /* - - bit description - - 0 Keyboard column output (KBO0) - 1 Keyboard column output (KBO1) - 2 Keyboard column output (KBO2) - 3 Keyboard column output (KBO3) - 4 Keyboard column output (KBO4) - 5 Keyboard column output (KBO5) - 6 Keyboard column output (KBO6) - 7 Keyboard column output (KBO7) - - */ - - m_keylatch = data; -} - - -//------------------------------------------------- -// ipc_port2_r - -//------------------------------------------------- - -READ8_MEMBER( ql_state::ipc_port2_r ) -{ - /* - - bit description - - 0 Serial data input (SER2 RxD, SER1 TxD) - 1 - 2 - 3 - 4 - 5 - 6 - 7 ZX8302 serial link input/output (COMDATA) - - */ - - UINT8 data = 0; - - // SER2 serial data input - data |= m_ser2->rxd_r(); - - // COMDATA - data |= m_comdata_to_ipc << 7; - - return data; -} - - -//------------------------------------------------- -// ipc_port2_w - -//------------------------------------------------- - -WRITE8_MEMBER( ql_state::ipc_port2_w ) -{ - /* - - bit description - - 0 - 1 Speaker output - 2 Interrupt output (IPL0-2) - 3 Interrupt output (IPL1) - 4 Serial Clear-to-Send output (SER1 CTS) - 5 Serial Data Terminal Ready output (SER2 DTR) - 6 - 7 ZX8302 serial link input/output (COMDATA) - - */ - - // speaker - m_speaker->level_w(BIT(data, 1)); - - // interrupts - int ipl = (BIT(data, 2) << 1) | BIT(data, 3); - - if (ipl != m_ipl) - { - switch (ipl) - { - case 0: m_maincpu->set_input_line(M68K_IRQ_7, ASSERT_LINE); break; - case 1: m_maincpu->set_input_line(M68K_IRQ_5, ASSERT_LINE); break; // CTRL-ALT-7 pressed - case 2: m_maincpu->set_input_line(M68K_IRQ_2, ASSERT_LINE); break; - case 3: m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); break; - } - - m_ipl = ipl; - } - - // TODO SER1 clear to send - - // SER2 data terminal ready - m_ser2->write_dtr(!BIT(data, 5)); - - // COMDATA - m_zx8302->comdata_w(BIT(data, 7)); -} - - -//------------------------------------------------- -// ipc_t1_r - -//------------------------------------------------- - -READ8_MEMBER( ql_state::ipc_t1_r ) -{ - return m_baudx4; -} - - -//------------------------------------------------- -// ipc_bus_r - -//------------------------------------------------- - -READ8_MEMBER( ql_state::ipc_bus_r ) -{ - /* - - bit description - - 0 Keyboard row input (KBI0) - 1 Keyboard row input (KBI1) - 2 Keyboard row input (KBI2) - 3 Keyboard row input (KBI3) - 4 Keyboard row input (KBI4) - 5 Keyboard row input (KBI5) - 6 Keyboard row input (KBI6) - 7 Keyboard row input (KBI7) - - */ - - UINT8 data = 0; - - if (BIT(m_keylatch, 0)) data |= m_y0->read() | m_joy0->read(); - if (BIT(m_keylatch, 1)) data |= m_y1->read() | m_joy1->read(); - if (BIT(m_keylatch, 2)) data |= m_y2->read(); - if (BIT(m_keylatch, 3)) data |= m_y3->read(); - if (BIT(m_keylatch, 4)) data |= m_y4->read(); - if (BIT(m_keylatch, 5)) data |= m_y5->read(); - if (BIT(m_keylatch, 6)) data |= m_y6->read(); - if (BIT(m_keylatch, 7)) data |= m_y7->read(); - - return data; -} - - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( ql_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ql_mem, AS_PROGRAM, 8, ql_state ) - AM_RANGE(0x000000, 0x0fffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( ipc_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( ipc_io, AS_IO, 8, ql_state ) - AM_RANGE(0x00, 0x7f) AM_WRITE(ipc_w) - AM_RANGE(0x27, 0x28) AM_READNOP // IPC reads these to set P0 (bus) to Hi-Z mode - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(ipc_port1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(ipc_port2_r, ipc_port2_w) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(ipc_t1_r) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(ipc_bus_r) AM_WRITENOP -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( ql ) -//------------------------------------------------- - -static INPUT_PORTS_START( ql ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_NAME("F4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("F1") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_NAME("F2") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_NAME("F3") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_NAME("F5") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC @") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHAR('\x1b') PORT_CHAR('@') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("\xc2\xa3 ~") PORT_CHAR(0xa3) PORT_CHAR('~') // ? ~ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TABULATE") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CODE(KEYCODE_RALT) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("JOY0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )PORT_PLAYER(1) PORT_8WAY PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("JOY1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )PORT_PLAYER(2) PORT_8WAY PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_SPACE) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY PORT_CODE(KEYCODE_DOWN) - - PORT_START("config") - PORT_CONFNAME( 0x01, 0x00, "QL Internal Mouse Interface (QIMI)") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( ql_es ) -//------------------------------------------------- - -static INPUT_PORTS_START( ql_es ) - PORT_INCLUDE(ql) - - PORT_MODIFY("Y1") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("] \xc3\x9c") PORT_CHAR(']') PORT_CHAR(0xfc) PORT_CHAR(0xdc) - - PORT_MODIFY("Y2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('`') PORT_CHAR('^') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('!') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ \xc3\x87") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('[') PORT_CHAR(0xe7) PORT_CHAR(0xc7) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(':') - - PORT_MODIFY("Y3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x91") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0xf1) PORT_CHAR(0xd1) - - PORT_MODIFY("Y4") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 \xc2\xa1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR(0xa1) - - PORT_MODIFY("Y6") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \xc2\xbf") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(0xbf) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('/') - - PORT_MODIFY("Y7") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( ql_de ) -//------------------------------------------------- - -static INPUT_PORTS_START( ql_de ) - PORT_INCLUDE(ql) - - PORT_MODIFY("Y0") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - - PORT_MODIFY("Y1") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') - - PORT_MODIFY("Y2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('^') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x84") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xe4) PORT_CHAR(0xc4) - - PORT_MODIFY("Y3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x9c") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0xfc) PORT_CHAR(0xdc) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('#') PORT_CHAR('\'') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x96") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0xf6) PORT_CHAR(0xd6) - - PORT_MODIFY("Y4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 \xc2\xa3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xa7) - - PORT_MODIFY("Y5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\x9f ?") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0xdf) PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_MODIFY("Y6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - - PORT_MODIFY("Y7") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( ql_it ) -//------------------------------------------------- - -static INPUT_PORTS_START( ql_it ) - PORT_INCLUDE(ql) - - PORT_MODIFY("Y0") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \xc3\xa8") PORT_CODE(KEYCODE_7) PORT_CHAR('?') PORT_CHAR('7') - - PORT_MODIFY("Y1") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') - - PORT_MODIFY("Y2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('$') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* \xc2\xa7") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('*') PORT_CHAR(0xa7) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xb9 %") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0xf9) PORT_CHAR('%') - - PORT_MODIFY("Y3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xac =") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0xec) PORT_CHAR('=') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('+') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_MODIFY("Y4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('#') PORT_CHAR('1') - - PORT_MODIFY("Y5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa7 9") PORT_CODE(KEYCODE_9) PORT_CHAR(0xe7) PORT_CHAR('9') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR('\\') - - PORT_MODIFY("Y6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('^') PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa9 2") PORT_CODE(KEYCODE_2) PORT_CHAR(0xe9) PORT_CHAR('2') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('_') PORT_CHAR('6') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa0 0") PORT_CODE(KEYCODE_0) PORT_CHAR(0xe0) PORT_CHAR('0') - - PORT_MODIFY("Y7") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xb2 !") PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0xf2) PORT_CHAR('!') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('.') -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( ql_fr ) -//------------------------------------------------- - -static INPUT_PORTS_START( ql_fr ) - PORT_INCLUDE(ql) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( ql_se ) -//------------------------------------------------- - -static INPUT_PORTS_START( ql_se ) - PORT_INCLUDE(ql) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( ql_dk ) -//------------------------------------------------- - -static INPUT_PORTS_START( ql_dk ) - PORT_INCLUDE(ql) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// ZX8302_INTERFACE( ql_zx8302_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( ql_state::ql_baudx4_w ) -{ - m_baudx4 = state; -} - -// CPU to IPC -WRITE_LINE_MEMBER( ql_state::ql_comdata_w ) -{ - m_comdata_to_ipc = state; -} - -WRITE_LINE_MEMBER( ql_state::zx8302_mdselck_w ) -{ - m_mdv2->clk_w(state); - m_mdv1->clk_w(state); -} - -WRITE_LINE_MEMBER( ql_state::zx8302_mdrdw_w ) -{ - m_mdv1->read_write_w(state); - m_mdv2->read_write_w(state); -} - -WRITE_LINE_MEMBER( ql_state::zx8302_erase_w ) -{ - m_mdv1->erase_w(state); - m_mdv2->erase_w(state); -} - -WRITE_LINE_MEMBER( ql_state::zx8302_raw1_w ) -{ - m_mdv1->data1_w(state); - m_mdv2->data1_w(state); -} - -READ_LINE_MEMBER( ql_state::zx8302_raw1_r ) -{ - return m_mdv1->data1_r() | m_mdv2->data1_r(); -} - -WRITE_LINE_MEMBER( ql_state::zx8302_raw2_w ) -{ - m_mdv1->data2_w(state); - m_mdv2->data2_w(state); -} - -READ_LINE_MEMBER( ql_state::zx8302_raw2_r ) -{ - return m_mdv1->data2_r() | m_mdv2->data2_r(); -} - -void ql_state::update_interrupt() -{ - m_zx8302->extint_w(m_extintl || m_qimi_extint); -} - -WRITE_LINE_MEMBER( ql_state::exp_extintl_w ) -{ - m_extintl = state; - update_interrupt(); -} - -WRITE_LINE_MEMBER( ql_state::qimi_extintl_w ) -{ - if (m_qimi_enabled) - { - m_qimi_extint = state; - update_interrupt(); - } -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -void ql_state::machine_start() -{ - // register for state saving - save_item(NAME(m_keylatch)); - save_item(NAME(m_ipl)); - save_item(NAME(m_comdata_to_ipc)); - save_item(NAME(m_baudx4)); -} - -void ql_state::machine_reset() -{ - // QIMI - m_qimi_enabled = (m_config->read() & 0x01) ? true : false; -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( ql ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( ql, ql_state ) - // basic machine hardware - MCFG_CPU_ADD(M68008_TAG, M68008, X1/2) - MCFG_CPU_PROGRAM_MAP(ql_mem) - - MCFG_CPU_ADD(I8749_TAG, I8749, X4) - MCFG_CPU_IO_MAP(ipc_io) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50.08) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_UPDATE_DEVICE(ZX8301_TAG, zx8301_device, screen_update) - MCFG_SCREEN_SIZE(960, 312) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_DEVICE_ADD(ZX8301_TAG, ZX8301, X1) - MCFG_ZX8301_CPU(M68008_TAG) - MCFG_ZX8301_VSYNC_CALLBACK(DEVWRITELINE(ZX8302_TAG, zx8302_device, vsync_w)) - - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - - MCFG_DEVICE_ADD(ZX8302_TAG, ZX8302, X1) - MCFG_ZX8302_RTC_CLOCK(X2) - MCFG_ZX8302_OUT_IPL1L_CB(INPUTLINE(M68008_TAG, M68K_IRQ_2)) - MCFG_ZX8302_OUT_BAUDX4_CB(WRITELINE(ql_state, ql_baudx4_w)) - MCFG_ZX8302_OUT_COMDATA_CB(WRITELINE(ql_state, ql_comdata_w)) - // TXD1 - MCFG_ZX8302_OUT_TXD2_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - // NETOUT - MCFG_ZX8302_OUT_MDSELCK_CB(WRITELINE(ql_state, zx8302_mdselck_w)) - MCFG_ZX8302_OUT_MDSELD_CB(DEVWRITELINE(MDV_1, microdrive_image_device, comms_in_w)) - MCFG_ZX8302_OUT_MDRDW_CB(WRITELINE(ql_state, zx8302_mdrdw_w)) - MCFG_ZX8302_OUT_ERASE_CB(WRITELINE(ql_state, zx8302_erase_w)) - MCFG_ZX8302_OUT_RAW1_CB(WRITELINE(ql_state, zx8302_raw1_w)) - MCFG_ZX8302_IN_RAW1_CB(READLINE(ql_state, zx8302_raw1_r)) - MCFG_ZX8302_OUT_RAW2_CB(WRITELINE(ql_state, zx8302_raw2_w)) - MCFG_ZX8302_IN_RAW2_CB(READLINE(ql_state, zx8302_raw2_r)) - - MCFG_MICRODRIVE_ADD(MDV_1) - MCFG_MICRODRIVE_COMMS_OUT_CALLBACK(DEVWRITELINE(MDV_2, microdrive_image_device, comms_in_w)) - MCFG_MICRODRIVE_ADD(MDV_2) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) // wired as DCE - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) // wired as DTE - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(ZX8302_TAG, zx8302_device, write_cts2)) - - MCFG_QL_EXPANSION_SLOT_ADD("exp", ql_expansion_cards, NULL) - //MCFG_QL_EXPANSION_SLOT_IPL0L_CALLBACK() - //MCFG_QL_EXPANSION_SLOT_IPL1L_CALLBACK() - //MCFG_QL_EXPANSION_SLOT_BERRL_CALLBACK() - MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(WRITELINE(ql_state, exp_extintl_w)) - - MCFG_QL_ROM_CARTRIDGE_SLOT_ADD("rom", ql_rom_cartridge_cards, NULL) - - MCFG_DEVICE_ADD(QIMI_TAG, QIMI, 0) - MCFG_QIMI_EXTINT_CALLBACK(WRITELINE(ql_state, qimi_extintl_w)) - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list", "ql_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "ql_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "ql_flop") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( ql_ntsc ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( ql_ntsc, ql ) - // video hardware - MCFG_SCREEN_MODIFY(SCREEN_TAG) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(960, 262) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( opd ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( opd, ql ) - // internal ram - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("256K") -MACHINE_CONFIG_END - - -/* -//------------------------------------------------- -// MACHINE_CONFIG( megaopd ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( megaopd, ql ) - // internal ram - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") -MACHINE_CONFIG_END -*/ - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( ql ) -//------------------------------------------------- - -ROM_START( ql ) - ROM_REGION( 0x10000, M68008_TAG, 0 ) - ROM_DEFAULT_BIOS("js") - ROM_SYSTEM_BIOS( 0, "fb", "v1.00 (FB)" ) - ROMX_LOAD( "fb.ic33", 0x0000, 0x8000, NO_DUMP, ROM_BIOS(1) ) - ROMX_LOAD( "fb.ic34", 0x8000, 0x4000, NO_DUMP, ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "pm", "v1.01 (PM)" ) - ROMX_LOAD( "pm.ic33", 0x0000, 0x8000, NO_DUMP, ROM_BIOS(2) ) - ROMX_LOAD( "pm.ic34", 0x8000, 0x4000, NO_DUMP, ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "ah", "v1.02 (AH)" ) - ROMX_LOAD( "ah.ic33.1", 0x0000, 0x4000, BAD_DUMP CRC(a9b4d2df) SHA1(142d6f01a9621aff5e0ad678bd3cbf5cde0db801), ROM_BIOS(3) ) - ROMX_LOAD( "ah.ic33.2", 0x4000, 0x4000, BAD_DUMP CRC(36488e4e) SHA1(ff6f597b30ea03ce480a3d6728fd1d858da34d6a), ROM_BIOS(3) ) - ROMX_LOAD( "ah.ic34", 0x8000, 0x4000, BAD_DUMP CRC(61259d4c) SHA1(bdd10d111e7ba488551a27c8d3b2743917ff1307), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "jm", "v1.03 (JM)" ) - ROMX_LOAD( "ql.jm 0000.ic33", 0x0000, 0x8000, CRC(1f8e840a) SHA1(7929e716dfe88318bbe99e34f47d039957fe3cc0), ROM_BIOS(4) ) - ROMX_LOAD( "ql.jm 8000.ic34", 0x8000, 0x4000, CRC(9168a2e9) SHA1(1e7c47a59fc40bd96dfefc2f4d86827c15f0199e), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "tb", "v1.0? (TB)" ) - ROMX_LOAD( "tb.ic33", 0x0000, 0x8000, BAD_DUMP CRC(1c86d688) SHA1(7df8028e6671afc4ebd5f65bf6c2d6019181f239), ROM_BIOS(5) ) - ROMX_LOAD( "tb.ic34", 0x8000, 0x4000, BAD_DUMP CRC(de7f9669) SHA1(9d6bc0b794541a4cec2203256ae92c7e68d1011d), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "js", "v1.10 (JS)" ) - ROMX_LOAD( "ql.js 0000.ic33", 0x0000, 0x8000, CRC(1bbad3b8) SHA1(59fd4372771a630967ee102760f4652904d7d5fa), ROM_BIOS(6) ) - ROMX_LOAD( "ql.js 8000.ic34", 0x8000, 0x4000, CRC(c970800e) SHA1(b8c9203026a7de6a44bd0942ec9343e8b222cb41), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS( 6, "tyche", "v2.05 (Tyche)" ) - ROMX_LOAD( "tyche.rom", 0x0000, 0x010000, CRC(8724b495) SHA1(5f33a1bc3f23fd09c31844b65bc3aca7616f180a), ROM_BIOS(7) ) - ROM_SYSTEM_BIOS( 7, "min189", "Minerva v1.89" ) - ROMX_LOAD( "minerva.rom", 0x0000, 0x00c000, BAD_DUMP CRC(930befe3) SHA1(84a99c4df13b97f90baf1ec8cb6c2e52e3e1bb4d), ROM_BIOS(8) ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) - - ROM_REGION( 0x4000, "printer", 0 ) // original Sinclair QL printer (based on Seikosha SP-1000 / SP-800QL, with custom QL font) - ROM_LOAD( "bql010-sqpp", 0x0000, 0x4000, CRC(07834797) SHA1(ba94bdad2303a263008b6ea744669a19938d9998) ) -ROM_END - - -//------------------------------------------------- -// ROM( ql_us ) -//------------------------------------------------- - -ROM_START( ql_us ) - ROM_REGION( 0xc000, M68008_TAG, 0 ) - ROM_LOAD( "jsu.ic33", 0x0000, 0x8000, BAD_DUMP CRC(e397f49f) SHA1(c06f92eabaf3e6dd298c51cb7f7535d8ef0ef9c5) ) - ROM_LOAD( "jsu.ic34", 0x8000, 0x4000, BAD_DUMP CRC(3debbacc) SHA1(9fbc3e42ec463fa42f9c535d63780ff53a9313ec) ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( ql_es ) -//------------------------------------------------- - -ROM_START( ql_es ) - ROM_REGION( 0xc000, M68008_TAG, 0 ) - ROM_LOAD( "mge.ic33", 0x0000, 0x8000, BAD_DUMP CRC(d5293bde) SHA1(bf5af7e53a472d4e9871f182210787d601db0634) ) - ROM_LOAD( "mge.ic34", 0x8000, 0x4000, BAD_DUMP CRC(a694f8d7) SHA1(bd2868656008de85d7c191598588017ae8aa3339) ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( ql_fr ) -//------------------------------------------------- - -ROM_START( ql_fr ) - ROM_REGION( 0xc000, M68008_TAG, 0 ) - ROM_LOAD( "mgf.ic33", 0x0000, 0x8000, NO_DUMP ) - ROM_LOAD( "mgf.ic34", 0x8000, 0x4000, NO_DUMP ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( ql_de ) -//------------------------------------------------- - -ROM_START( ql_de ) - ROM_REGION( 0xc000, M68008_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "mg", "v1.10 (MG)" ) - ROMX_LOAD( "mgg.ic33", 0x0000, 0x8000, BAD_DUMP CRC(b4e468fd) SHA1(cd02a3cd79af90d48b65077d0571efc2f12f146e), ROM_BIOS(1) ) - ROMX_LOAD( "mgg.ic34", 0x8000, 0x4000, BAD_DUMP CRC(54959d40) SHA1(ffc0be9649f26019d7be82925c18dc699259877f), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "mf", "v1.14 (MF)" ) - ROMX_LOAD( "mf.ic33", 0x0000, 0x8000, BAD_DUMP CRC(49c40563) SHA1(d3bcd0614cf9b52e9d7fc2832e11463e5030476b), ROM_BIOS(2) ) - ROMX_LOAD( "mf.ic34", 0x8000, 0x4000, BAD_DUMP CRC(5974616b) SHA1(c3603768c08535c25f077eed02fb80128aff13d9), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "ultramg", "Ultrasoft" ) - ROMX_LOAD( "ultramg.rom", 0x0000, 0x00c000, BAD_DUMP CRC(ad12463b) SHA1(0561b3bc7ce090f3101b2142ee957c18c250eefa), ROM_BIOS(3) ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( ql_it ) -//------------------------------------------------- - -ROM_START( ql_it ) - ROM_REGION( 0xc000, M68008_TAG, 0 ) - ROM_LOAD( "mgi.ic33", 0x0000, 0x8000, BAD_DUMP CRC(d5293bde) SHA1(bf5af7e53a472d4e9871f182210787d601db0634) ) - ROM_LOAD( "mgi.ic34", 0x8000, 0x4000, BAD_DUMP CRC(a2fdfb83) SHA1(162b1052737500f3c13497cdf0f813ba006bdae9) ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( ql_se ) -//------------------------------------------------- - -ROM_START( ql_se ) - ROM_REGION( 0xc000, M68008_TAG, 0 ) - ROM_LOAD( "mgs.ic33", 0x0000, 0x8000, NO_DUMP ) - ROM_LOAD( "mgs.ic34", 0x8000, 0x4000, NO_DUMP ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( ql_gr ) -//------------------------------------------------- - -ROM_START( ql_gr ) - ROM_REGION( 0xc000, M68008_TAG, 0 ) - ROM_LOAD( "efp.ic33", 0x0000, 0x8000, BAD_DUMP CRC(eb181641) SHA1(43c1e0215cf540cbbda240b1048910ff55681059) ) - ROM_LOAD( "efp.ic34", 0x8000, 0x4000, BAD_DUMP CRC(4c3b34b7) SHA1(f9dc571d2d4f68520b306ecc7516acaeea69ec0d) ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( ql_dk ) -//------------------------------------------------- - -ROM_START( ql_dk ) - ROM_REGION( 0xc000, M68008_TAG, 0 ) - ROM_LOAD( "mgd.ic33", 0x0000, 0x8000, BAD_DUMP CRC(f57755eb) SHA1(dc57939ffb8741e17967a1d2479c339750ec7ff6) ) - ROM_LOAD( "mgd.ic34", 0x8000, 0x4000, BAD_DUMP CRC(1892465a) SHA1(0ff3046b5276da6639d3fe79b22ae25cc265d540) ) - - ROM_REGION( 0x4000, "extra", 0 ) - ROM_LOAD( "extra.rom", 0x0000, 0x4000, NO_DUMP ) // located at 0x1c000 in M68008 memory map - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x400, "plds", 0 ) - ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// ROM( tonto ) -//------------------------------------------------- - -ROM_START( tonto ) - ROM_REGION( 0x20000, M68008_TAG, 0 ) - ROM_LOAD( "xbaa02.ic4", 0x000000, 0x008000, CRC(86e7915b) SHA1(a4d8369052eaea93d2174cfd3b14e6cf777f54b4) ) - ROM_LOAD( "xbab03.ic5", 0x008000, 0x008000, CRC(97ef393c) SHA1(450c708e8dfbd42d939a9af6a72ef2a33a3dd3b5) ) - ROM_LOAD( "xbac02.ic6", 0x010000, 0x008000, CRC(a7950897) SHA1(7cd4d6e33a350420a9ebd5c1b32708c29cb20799) ) - ROM_LOAD( "xbad02.ic7", 0x018000, 0x008000, CRC(69d59443) SHA1(cdf28b1b4fca00e8cb79930a1963955af2925618) ) - - ROM_REGION( 0x800, I8749_TAG, 0 ) - ROM_LOAD( "ipc8049.ic24", 0x000, 0x800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) - - ROM_REGION( 0x10000, I8051_TAG, 0 ) - ROM_LOAD( "8051-1.rom", 0x000000, 0x010000, NO_DUMP ) - - ROM_REGION( 0x10000, "tms5220", 0 ) - ROM_LOAD( "tms5220.rom", 0x000000, 0x004000, NO_DUMP ) - - ROM_REGION( 0x400000, "rompack", 0 ) - ROM_LOAD( "xbak02.ic6", 0x000000, 0x008000, CRC(3d61e84e) SHA1(7d0a473b0ed3e3ae3cd6d3fb43cb7a70a550d1d9) ) - ROM_LOAD( "xbaf01.ic7", 0x008000, 0x008000, CRC(c5724357) SHA1(6e765f8e85d2312c31e4b09c9a6645ab3d166e65) ) - ROM_LOAD( "xbag01.ic8", 0x010000, 0x008000, CRC(9af3bcbf) SHA1(9a848926f2bf6f632ab198a8bb03a8ee83ea0e5d) ) - ROM_LOAD( "qcaw02.ic9", 0x018000, 0x008000, CRC(1091a789) SHA1(33881b2a818cbaf610a0746fde4acfef5c91338f) ) - ROM_LOAD( "qcax02.ic10", 0x020000, 0x008000, CRC(396f13d9) SHA1(b2deb5db4565ff7224730c2f3245fbf9df84d728) ) -ROM_END - - -#if 0 -//------------------------------------------------- -// ROM( megaopd ) -//------------------------------------------------- - -ROM_START( megaopd ) - ROM_REGION( 0x20000, M68008_TAG, 0 ) - ROM_LOAD( "bios-1.rom", 0x000000, 0x008000, NO_DUMP ) - ROM_LOAD( "bios-2.rom", 0x008000, 0x008000, NO_DUMP ) - ROM_LOAD( "bios-3.rom", 0x010000, 0x008000, NO_DUMP ) - ROM_LOAD( "bios-4.rom", 0x018000, 0x008000, NO_DUMP ) - - ROM_REGION( 0x10000, I8051_TAG, 0 ) - ROM_LOAD( "8051-1.rom", 0x000000, 0x010000, NO_DUMP ) - - ROM_REGION( 0x10000, "tms5220", 0 ) - ROM_LOAD( "tms5220.rom", 0x000000, 0x004000, NO_DUMP ) - - ROM_REGION( 0x400000, "rompack", 0 ) - ROM_LOAD( "rompack-1.rom", 0x000000, 0x008000, NO_DUMP ) - ROM_LOAD( "rompack-2.rom", 0x008000, 0x008000, NO_DUMP ) - ROM_LOAD( "rompack-3.rom", 0x010000, 0x008000, NO_DUMP ) - ROM_LOAD( "rompack-4.rom", 0x018000, 0x008000, NO_DUMP ) - ROM_LOAD( "rompack-5.rom", 0x020000, 0x008000, NO_DUMP ) -ROM_END -#endif - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1984, ql, 0, 0, ql, ql, driver_device, 0, "Sinclair Research Ltd", "QL (UK)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, ql_us, ql, 0, ql_ntsc, ql, driver_device, 0, "Sinclair Research Ltd", "QL (USA)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, ql_es, ql, 0, ql, ql_es, driver_device, 0, "Sinclair Research Ltd", "QL (Spain)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, ql_fr, ql, 0, ql, ql_fr, driver_device, 0, "Sinclair Research Ltd", "QL (France)", MACHINE_NOT_WORKING ) -COMP( 1985, ql_de, ql, 0, ql, ql_de, driver_device, 0, "Sinclair Research Ltd", "QL (Germany)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, ql_it, ql, 0, ql, ql_it, driver_device, 0, "Sinclair Research Ltd", "QL (Italy)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, ql_se, ql, 0, ql, ql_se, driver_device, 0, "Sinclair Research Ltd", "QL (Sweden)", MACHINE_NOT_WORKING ) -COMP( 1985, ql_dk, ql, 0, ql, ql_dk, driver_device, 0, "Sinclair Research Ltd", "QL (Denmark)", MACHINE_NOT_WORKING ) -COMP( 1985, ql_gr, ql, 0, ql, ql, driver_device, 0, "Sinclair Research Ltd", "QL (Greece)", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, tonto, 0, 0, opd, ql, driver_device, 0, "British Telecom Business Systems", "Merlin M1800 Tonto", MACHINE_NOT_WORKING ) -//COMP( 1986, megaopd,tonto, 0, megaopd, ql, driver_device, 0, "International Computer Limited", "MegaOPD (USA)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/qtsbc.c b/src/mess/drivers/qtsbc.c deleted file mode 100644 index a79b75fd8ad..00000000000 --- a/src/mess/drivers/qtsbc.c +++ /dev/null @@ -1,101 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - QT Computer Systems SBC +2/4 - - 11/12/2009 Skeleton driver. - - It expects a rom or similar at E377-up, so currently it crashes. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class qtsbc_state : public driver_device -{ -public: - qtsbc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_p_ram(*this, "p_ram") - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER( qtsbc_06_r ); - DECLARE_READ8_MEMBER( qtsbc_43_r ); - DECLARE_WRITE8_MEMBER( kbd_put ); - required_shared_ptr m_p_ram; - UINT8 m_term_data; - virtual void machine_reset(); -}; - - -READ8_MEMBER( qtsbc_state::qtsbc_06_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( qtsbc_state::qtsbc_43_r ) -{ - return 0; -} - -static ADDRESS_MAP_START(qtsbc_mem, AS_PROGRAM, 8, qtsbc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xffff ) AM_RAM AM_SHARE("p_ram") AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( qtsbc_io, AS_IO, 8, qtsbc_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x06, 0x06) AM_READ(qtsbc_06_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x43, 0x43) AM_READ(qtsbc_43_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( qtsbc ) -INPUT_PORTS_END - - -void qtsbc_state::machine_reset() -{ - UINT8* bios = memregion("maincpu")->base()+0x10000; - memcpy(m_p_ram, bios, 0x800); -} - -WRITE8_MEMBER( qtsbc_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( qtsbc, qtsbc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) // Mostek MK3880 - MCFG_CPU_PROGRAM_MAP(qtsbc_mem) - MCFG_CPU_IO_MAP(qtsbc_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(qtsbc_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( qtsbc ) - ROM_REGION( 0x10800, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "qtsbc.bin", 0x10000, 0x0800, CRC(823fd942) SHA1(64c4f74dd069ae4d43d301f5e279185f32a1efa0)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, qtsbc, 0, 0, qtsbc, qtsbc, driver_device, 0, "Computer Systems Inc.", "QT SBC +2/4", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/qx10.c b/src/mess/drivers/qx10.c deleted file mode 100644 index c69fe705e72..00000000000 --- a/src/mess/drivers/qx10.c +++ /dev/null @@ -1,787 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mariusz Wojcieszek, Angelo Salese -/*************************************************************************** - - QX-10 - - Preliminary driver by Mariusz Wojcieszek - - Status: - Driver boots and load CP/M from floppy image. Needs upd7220 for gfx - - Done: - - preliminary memory map - - floppy (upd765) - - DMA - - Interrupts (pic8295) - - banking: - - 0x1c = 0 - AM_RANGE(0x0000,0x1fff) ROM - AM_RANGE(0x2000,0xdfff) NOP - AM_RANGE(0xe000,0xffff) RAM - - 0x1c = 1 0x20 = 1 - AM_RANGE(0x0000,0x7fff) RAM (0x18 selects bank) - AM_RANGE(0x8000,0x87ff) CMOS - AM_RANGE(0x8800,0xdfff) NOP or previous bank? - AM_RANGE(0xe000,0xffff) RAM - - 0x1c = 1 0x20 = 0 - AM_RANGE(0x0000,0xdfff) RAM (0x18 selects bank) - AM_RANGE(0xe000,0xffff) RAM -****************************************************************************/ - - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/z80dart.h" -#include "machine/mc146818.h" -#include "machine/i8255.h" -#include "machine/am9517a.h" -#include "video/upd7220.h" -#include "machine/upd765.h" -#include "machine/ram.h" -#include "machine/qx10kbd.h" - -#define MAIN_CLK 15974400 - -#define RS232_TAG "rs232" - -/* - Driver data -*/ - -class qx10_state : public driver_device -{ -public: - qx10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_pit_1(*this, "pit8253_1"), - m_pit_2(*this, "pit8253_2"), - m_pic_m(*this, "pic8259_master"), - m_pic_s(*this, "pic8259_slave"), - m_scc(*this, "upd7201"), - m_ppi(*this, "i8255"), - m_dma_1(*this, "8237dma_1"), - m_dma_2(*this, "8237dma_2"), - m_fdc(*this, "upd765"), - m_hgdc(*this, "upd7220"), - m_rtc(*this, "rtc"), - m_kbd(*this, "kbd"), - m_vram_bank(0), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") - { - } - - required_device m_pit_1; - required_device m_pit_2; - required_device m_pic_m; - required_device m_pic_s; - required_device m_scc; - required_device m_ppi; - required_device m_dma_1; - required_device m_dma_2; - required_device m_fdc; - required_device m_hgdc; - required_device m_rtc; - required_device m_kbd; - UINT8 m_vram_bank; - //required_shared_ptr m_video_ram; - UINT16 *m_video_ram; - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - - void update_memory_mapping(); - - DECLARE_WRITE8_MEMBER( qx10_18_w ); - DECLARE_WRITE8_MEMBER( prom_sel_w ); - DECLARE_WRITE8_MEMBER( cmos_sel_w ); - DECLARE_WRITE_LINE_MEMBER( qx10_upd765_interrupt ); - DECLARE_READ8_MEMBER( fdc_dma_r ); - DECLARE_WRITE8_MEMBER( fdc_dma_w ); - DECLARE_WRITE8_MEMBER( fdd_motor_w ); - DECLARE_READ8_MEMBER( qx10_30_r ); - DECLARE_READ8_MEMBER( gdc_dack_r ); - DECLARE_WRITE8_MEMBER( gdc_dack_w ); - DECLARE_WRITE_LINE_MEMBER( tc_w ); - DECLARE_READ8_MEMBER( mc146818_r ); - DECLARE_WRITE8_MEMBER( mc146818_w ); - DECLARE_READ8_MEMBER( get_slave_ack ); - DECLARE_READ8_MEMBER( vram_bank_r ); - DECLARE_WRITE8_MEMBER( vram_bank_w ); - DECLARE_READ16_MEMBER( vram_r ); - DECLARE_WRITE16_MEMBER( vram_w ); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_WRITE_LINE_MEMBER(keyboard_clk); - DECLARE_WRITE_LINE_MEMBER(keyboard_irq); - - UINT8 *m_char_rom; - - /* FDD */ - int m_fdcint; - int m_fdcmotor; - int m_fdcready; - - /* memory */ - int m_membank; - int m_memprom; - int m_memcmos; - UINT8 m_cmosram[0x800]; - - UINT8 m_color_mode; - - struct{ - UINT8 rx; - }m_rs232c; - - DECLARE_PALETTE_INIT(qx10); - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); - DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); - required_device m_maincpu; - required_device m_ram; - required_device m_palette; - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); - UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); -}; - -UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,gfx[3]; - UINT8 pen; - - if(m_color_mode) - { - gfx[0] = m_video_ram[((address) + 0x00000) >> 1]; - gfx[1] = m_video_ram[((address) + 0x20000) >> 1]; - gfx[2] = m_video_ram[((address) + 0x40000) >> 1]; - } - else - { - gfx[0] = m_video_ram[(address) >> 1]; - gfx[1] = 0; - gfx[2] = 0; - } - - for(xi=0;xi<16;xi++) - { - pen = ((gfx[0] >> xi) & 1) ? 1 : 0; - pen|= ((gfx[1] >> xi) & 1) ? 2 : 0; - pen|= ((gfx[2] >> xi) & 1) ? 4 : 0; - - bitmap.pix32(y, x + xi) = palette[pen]; - } -} - -UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int x; - int xi,yi; - int tile; - int attr; - UINT8 color; - UINT8 tile_data; - UINT8 pen; - - for( x = 0; x < pitch; x++ ) - { - tile = m_video_ram[((addr+x)*2) >> 1] & 0xff; - attr = m_video_ram[((addr+x)*2) >> 1] >> 8; - - color = (m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */ - - for( yi = 0; yi < lr; yi++) - { - tile_data = (m_char_rom[tile*16+yi]); - - if(attr & 8) - tile_data^=0xff; - - if(cursor_on && cursor_addr == addr+x) //TODO - tile_data^=0xff; - - if(attr & 0x80 && machine().first_screen()->frame_number() & 0x10) //TODO: check for blinking interval - tile_data=0; - - for( xi = 0; xi < 8; xi++) - { - int res_x,res_y; - - res_x = x * 8 + xi; - res_y = y + yi; - - if(!machine().first_screen()->visible_area().contains(res_x, res_y)) - continue; - - if(yi >= 16) - pen = 0; - else - pen = ((tile_data >> xi) & 1) ? color : 0; - - if(pen) - bitmap.pix32(res_y, res_x) = palette[pen]; - } - } - } -} - -UINT32 qx10_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) -{ - bitmap.fill(m_palette->black_pen(), cliprect); - - m_hgdc->screen_update(screen, bitmap, cliprect); - - return 0; -} - -/* - Memory -*/ -void qx10_state::update_memory_mapping() -{ - int drambank = 0; - - if (m_membank & 1) - { - drambank = 0; - } - else if (m_membank & 2) - { - drambank = 1; - } - else if (m_membank & 4) - { - drambank = 2; - } - else if (m_membank & 8) - { - drambank = 3; - } - - if (!m_memprom) - { - membank("bank1")->set_base(memregion("maincpu")->base()); - } - else - { - membank("bank1")->set_base(m_ram->pointer() + drambank*64*1024); - } - if (m_memcmos) - { - membank("bank2")->set_base(m_cmosram); - } - else - { - membank("bank2")->set_base(m_ram->pointer() + drambank*64*1024 + 32*1024); - } -} - -READ8_MEMBER( qx10_state::fdc_dma_r ) -{ - return m_fdc->dma_r(); -} - -WRITE8_MEMBER( qx10_state::fdc_dma_w ) -{ - m_fdc->dma_w(data); -} - - -WRITE8_MEMBER( qx10_state::qx10_18_w ) -{ - m_membank = (data >> 4) & 0x0f; - update_memory_mapping(); -} - -WRITE8_MEMBER( qx10_state::prom_sel_w ) -{ - m_memprom = data & 1; - update_memory_mapping(); -} - -WRITE8_MEMBER( qx10_state::cmos_sel_w ) -{ - m_memcmos = data & 1; - update_memory_mapping(); -} - -/* - FDD -*/ - -static SLOT_INTERFACE_START( qx10_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER( qx10_state::qx10_upd765_interrupt ) -{ - m_fdcint = state; - - //logerror("Interrupt from upd765: %d\n", state); - // signal interrupt - m_pic_m->ir6_w(state); -} - -WRITE8_MEMBER( qx10_state::fdd_motor_w ) -{ - m_fdcmotor = 1; - - machine().device("upd765:0")->get_device()->mon_w(false); - // motor off controlled by clock -} - -READ8_MEMBER( qx10_state::qx10_30_r ) -{ - floppy_image_device *floppy1,*floppy2; - - floppy1 = machine().device("upd765:0")->get_device(); - floppy2 = machine().device("upd765:1")->get_device(); - - return m_fdcint | - /*m_fdcmotor*/ 0 << 1 | - ((floppy1 != NULL) || (floppy2 != NULL) ? 1 : 0) << 3 | - m_membank << 4; -} - -/* - DMA8237 -*/ -WRITE_LINE_MEMBER(qx10_state::dma_hrq_changed) -{ - /* Assert HLDA */ - m_dma_1->hack_w(state); -} - -READ8_MEMBER( qx10_state::gdc_dack_r ) -{ - logerror("GDC DACK read\n"); - return 0; -} - -WRITE8_MEMBER( qx10_state::gdc_dack_w ) -{ - logerror("GDC DACK write %02x\n", data); -} - -WRITE_LINE_MEMBER( qx10_state::tc_w ) -{ - /* floppy terminal count */ - m_fdc->tc_w(!state); -} - -/* - 8237 DMA (Master) - Channel 1: Floppy disk - Channel 2: GDC - Channel 3: Option slots -*/ -READ8_MEMBER(qx10_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(qx10_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.write_byte(offset, data); -} - -/* - 8237 DMA (Slave) - Channel 1: Option slots #1 - Channel 2: Option slots #2 - Channel 3: Option slots #3 - Channel 4: Option slots #4 -*/ - -/* - MC146818 -*/ - -WRITE8_MEMBER(qx10_state::mc146818_w) -{ - m_rtc->write(space, !offset, data); -} - -READ8_MEMBER(qx10_state::mc146818_r) -{ - return m_rtc->read(space, !offset); -} - -WRITE_LINE_MEMBER(qx10_state::keyboard_irq) -{ - m_scc->m1_r(); // always set - m_pic_m->ir4_w(state); -} - -WRITE_LINE_MEMBER(qx10_state::keyboard_clk) -{ - // clock keyboard too - m_scc->rxca_w(state); - m_scc->txca_w(state); -} - -/* - Master PIC8259 - IR0 Power down detection interrupt - IR1 Software timer #1 interrupt - IR2 External interrupt INTF1 - IR3 External interrupt INTF2 - IR4 Keyboard/RS232 interrupt - IR5 CRT/lightpen interrupt - IR6 Floppy controller interrupt - IR7 Slave cascade -*/ - -READ8_MEMBER( qx10_state::get_slave_ack ) -{ - if (offset==7) { // IRQ = 7 - return m_pic_s->acknowledge(); - } - return 0x00; -} - - -/* - Slave PIC8259 - IR0 Printer interrupt - IR1 External interrupt #1 - IR2 Calendar clock interrupt - IR3 External interrupt #2 - IR4 External interrupt #3 - IR5 Software timer #2 interrupt - IR6 External interrupt #4 - IR7 External interrupt #5 - -*/ - -READ8_MEMBER( qx10_state::vram_bank_r ) -{ - return m_vram_bank; -} - -WRITE8_MEMBER( qx10_state::vram_bank_w ) -{ - if(m_color_mode) - { - m_vram_bank = data & 7; - if(data != 1 && data != 2 && data != 4) - printf("%02x\n",data); - } -} - -static ADDRESS_MAP_START(qx10_mem, AS_PROGRAM, 8, qx10_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x7fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x8000, 0xdfff ) AM_RAMBANK("bank2") - AM_RANGE( 0xe000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( qx10_io , AS_IO, 8, qx10_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253_1", pit8253_device, read, write) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("pit8253_2", pit8253_device, read, write) - AM_RANGE(0x08, 0x09) AM_DEVREADWRITE("pic8259_master", pic8259_device, read, write) - AM_RANGE(0x0c, 0x0d) AM_DEVREADWRITE("pic8259_slave", pic8259_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("upd7201", z80dart_device, cd_ba_r, cd_ba_w) - AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("i8255", i8255_device, read, write) - AM_RANGE(0x18, 0x1b) AM_READ_PORT("DSW") AM_WRITE(qx10_18_w) - AM_RANGE(0x1c, 0x1f) AM_WRITE(prom_sel_w) - AM_RANGE(0x20, 0x23) AM_WRITE(cmos_sel_w) - AM_RANGE(0x2c, 0x2c) AM_READ_PORT("CONFIG") - AM_RANGE(0x2d, 0x2d) AM_READWRITE(vram_bank_r,vram_bank_w) - AM_RANGE(0x30, 0x33) AM_READWRITE(qx10_30_r, fdd_motor_w) - AM_RANGE(0x34, 0x35) AM_DEVICE("upd765", upd765a_device, map) - AM_RANGE(0x38, 0x39) AM_DEVREADWRITE("upd7220", upd7220_device, read, write) -// AM_RANGE(0x3a, 0x3a) GDC zoom -// AM_RANGE(0x3b, 0x3b) GDC light pen req - AM_RANGE(0x3c, 0x3d) AM_READWRITE(mc146818_r, mc146818_w) - AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("8237dma_1", am9517a_device, read, write) - AM_RANGE(0x50, 0x5f) AM_DEVREADWRITE("8237dma_2", am9517a_device, read, write) -// AM_RANGE(0xfc, 0xfd) Multi-Font comms -ADDRESS_MAP_END - -/* Input ports */ -/* TODO: shift break */ -/*INPUT_CHANGED_MEMBER(qx10_state::key_stroke) -{ - if(newval && !oldval) - { - m_keyb.rx = (UINT8)(FPTR)(param) & 0x7f; - m_pic_m->ir4_w(1); - } - - if(oldval && !newval) - m_keyb.rx = 0; -}*/ - -static INPUT_PORTS_START( qx10 ) - /* TODO: All of those have unknown meaning */ - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x00, "DSW" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) //CMOS related - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("CONFIG") - PORT_CONFNAME( 0x03, 0x02, "Video Board" ) - PORT_CONFSETTING( 0x02, "Monochrome" ) - PORT_CONFSETTING( 0x01, "Color" ) - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -void qx10_state::machine_start() -{ -} - -void qx10_state::machine_reset() -{ - m_dma_1->dreq0_w(1); - - m_memprom = 0; - m_memcmos = 0; - m_membank = 0; - update_memory_mapping(); - - { - int i; - - /* TODO: is there a bit that sets this up? */ - m_color_mode = ioport("CONFIG")->read() & 1; - - if(m_color_mode) //color - { - for ( i = 0; i < 8; i++ ) - m_palette->set_pen_color(i, pal1bit((i >> 2) & 1), pal1bit((i >> 1) & 1), pal1bit((i >> 0) & 1)); - } - else //monochrome - { - for ( i = 0; i < 8; i++ ) - m_palette->set_pen_color(i, pal1bit(0), pal1bit(0), pal1bit(0)); - - m_palette->set_pen_color(1, 0x00, 0x9f, 0x00); - m_palette->set_pen_color(2, 0x00, 0xff, 0x00); - m_vram_bank = 0; - } - } -} - -/* F4 Character Displayer */ -static const gfx_layout qx10_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - RGN_FRAC(1,1), /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( qx10 ) - GFXDECODE_ENTRY( "chargen", 0x0000, qx10_charlayout, 1, 1 ) -GFXDECODE_END - -void qx10_state::video_start() -{ - // allocate memory - m_video_ram = auto_alloc_array_clear(machine(), UINT16, 0x30000); - - // find memory regions - m_char_rom = memregion("chargen")->base(); -} - -PALETTE_INIT_MEMBER(qx10_state, qx10) -{ - // ... -} - -READ16_MEMBER( qx10_state::vram_r ) -{ - int bank = 0; - - if (m_vram_bank & 1) { bank = 0; } // B - else if(m_vram_bank & 2) { bank = 1; } // G - else if(m_vram_bank & 4) { bank = 2; } // R - - return m_video_ram[offset + (0x20000 * bank)]; -} - -WRITE16_MEMBER( qx10_state::vram_w ) -{ - int bank = 0; - - if (m_vram_bank & 1) { bank = 0; } // B - else if(m_vram_bank & 2) { bank = 1; } // G - else if(m_vram_bank & 4) { bank = 2; } // R - - COMBINE_DATA(&m_video_ram[offset + (0x20000 * bank)]); -} - -static ADDRESS_MAP_START( upd7220_map, AS_0, 16, qx10_state ) - AM_RANGE(0x00000, 0x5ffff) AM_READWRITE(vram_r,vram_w) -ADDRESS_MAP_END - -static SLOT_INTERFACE_START(keyboard) - SLOT_INTERFACE("qx10", QX10_KEYBOARD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( qx10, qx10_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, MAIN_CLK / 4) - MCFG_CPU_PROGRAM_MAP(qx10_mem) - MCFG_CPU_IO_MAP(qx10_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(qx10_state, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", qx10) - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(qx10_state, qx10) - - /* Devices */ - -/* - Timer 0 - Counter CLK Gate OUT Operation - 0 Keyboard clock (1200bps) Memory register D0 Speaker timer Speaker timer (100ms) - 1 Keyboard clock (1200bps) +5V 8259A (10E) IR5 Software timer - 2 Clock 1,9668MHz Memory register D7 8259 (12E) IR1 Software timer -*/ - - MCFG_DEVICE_ADD("pit8253_1", PIT8253, 0) - MCFG_PIT8253_CLK0(1200) - MCFG_PIT8253_CLK1(1200) - MCFG_PIT8253_CLK2(MAIN_CLK / 8) - -/* - Timer 1 - Counter CLK Gate OUT Operation - 0 Clock 1,9668MHz +5V Speaker frequency 1kHz - 1 Clock 1,9668MHz +5V Keyboard clock 1200bps (Clock / 1664) - 2 Clock 1,9668MHz +5V RS-232C baud rate 9600bps (Clock / 208) -*/ - MCFG_DEVICE_ADD("pit8253_2", PIT8253, 0) - MCFG_PIT8253_CLK0(MAIN_CLK / 8) - MCFG_PIT8253_CLK1(MAIN_CLK / 8) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(qx10_state, keyboard_clk)) - MCFG_PIT8253_CLK2(MAIN_CLK / 8) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("upd7201", z80dart_device, rxtxcb_w)) - - MCFG_PIC8259_ADD("pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(qx10_state, get_slave_ack)) - MCFG_PIC8259_ADD("pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL) - - MCFG_UPD7201_ADD("upd7201", MAIN_CLK/4, 0, 0, 0, 0) // channel b clock set by pit2 channel 2 - // Channel A: Keyboard - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("kbd", rs232_port_device, write_txd)) - // Channel B: RS232 - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(WRITELINE(qx10_state, keyboard_irq)) - - MCFG_DEVICE_ADD("8237dma_1", AM9517A, MAIN_CLK/4) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(qx10_state, dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(qx10_state, tc_w)) - MCFG_I8237_IN_MEMR_CB(READ8(qx10_state, memory_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(qx10_state, memory_write_byte)) - MCFG_I8237_IN_IOR_0_CB(READ8(qx10_state, fdc_dma_r)) - MCFG_I8237_IN_IOR_1_CB(READ8(qx10_state, gdc_dack_r)) - //MCFG_I8237_IN_IOR_2_CB(DEVREAD8("upd7220", upd7220_device, dack_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(qx10_state, fdc_dma_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(qx10_state, gdc_dack_w)) - //MCFG_I8237_OUT_IOW_2_CB(DEVWRITE8("upd7220", upd7220_device, dack_w)) - MCFG_DEVICE_ADD("8237dma_2", AM9517A, MAIN_CLK/4) - - MCFG_DEVICE_ADD("i8255", I8255, 0) - - MCFG_DEVICE_ADD("upd7220", UPD7220, MAIN_CLK/6) // unk clock - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(qx10_state, hgdc_display_pixels) - MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(qx10_state, hgdc_draw_text) - MCFG_VIDEO_SET_SCREEN("screen") - - MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz ) - MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir2_w)) - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(qx10_state, qx10_upd765_interrupt)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("8237dma_1", am9517a_device, dreq0_w)) MCFG_DEVCB_INVERT - MCFG_FLOPPY_DRIVE_ADD("upd765:0", qx10_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", qx10_floppies, "525dd", floppy_image_device::default_floppy_formats) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, rxb_w)) - - MCFG_RS232_PORT_ADD("kbd", keyboard, "qx10") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd7201", z80dart_device, rxa_w)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "qx10_flop") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( qx10 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v006", "v0.06") - ROMX_LOAD( "ipl006.bin", 0x0000, 0x0800, CRC(3155056a) SHA1(67cc0ae5055d472aa42eb40cddff6da69ffc6553), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v003", "v0.03") - ROMX_LOAD( "ipl003.bin", 0x0000, 0x0800, CRC(3cbc4008) SHA1(cc8c7d1aa0cca8f9753d40698b2dc6802fd5f890), ROM_BIOS(2)) - - /* This is probably the i8039 program ROM for the Q10MF Multifont card, and the actual font ROMs are missing (6 * HM43128) */ - /* The first part of this rom looks like code for an embedded controller? - From 0300 on, is a keyboard lookup table */ - ROM_REGION( 0x0800, "i8039", 0 ) - ROM_LOAD( "m12020a.3e", 0x0000, 0x0800, CRC(fa27f333) SHA1(73d27084ca7b002d5f370220d8da6623a6e82132)) - - ROM_REGION( 0x1000, "chargen", 0 ) -// ROM_LOAD( "qge.2e", 0x0000, 0x0800, BAD_DUMP CRC(ed93cb81) SHA1(579e68bde3f4184ded7d89b72c6936824f48d10b)) //this one contains special characters only - ROM_LOAD( "qge.2e", 0x0000, 0x1000, BAD_DUMP CRC(eb31a2d5) SHA1(6dc581bf2854a07ae93b23b6dfc9c7abd3c0569e)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, qx10, 0, 0, qx10, qx10, driver_device, 0, "Epson", "QX-10", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/radio86.c b/src/mess/drivers/radio86.c deleted file mode 100644 index c1b08bed357..00000000000 --- a/src/mess/drivers/radio86.c +++ /dev/null @@ -1,561 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Radio-86RK driver by Miodrag Milanovic - - 15/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/wave.h" -#include "machine/i8255.h" -#include "imagedev/cassette.h" -#include "formats/rk_cas.h" -#include "includes/radio86.h" - -/* Address maps */ -static ADDRESS_MAP_START(radio86_mem, AS_PROGRAM, 8, radio86_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM - AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) - //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) - AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video - AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( radio86_io , AS_IO, 8, radio86_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00, 0xff ) AM_READWRITE(radio_io_r,radio_io_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( rk7007_io , AS_IO, 8, radio86_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x80, 0x83 ) AM_DEVREADWRITE("ms7007", i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(radio86rom_mem, AS_PROGRAM, 8, radio86_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM - AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) - AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) - AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video - AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(radio86ram_mem, AS_PROGRAM, 8, radio86_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x1000, 0xdfff ) AM_RAM // RAM - AM_RANGE( 0xe000, 0xe7ff ) AM_ROM // System ROM page 2 - AM_RANGE( 0xe800, 0xf5ff ) AM_RAM // RAM - AM_RANGE( 0xf700, 0xf703 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) - AM_RANGE( 0xf780, 0xf7bf ) AM_DEVREADWRITE("i8275", i8275_device, read, write) // video - AM_RANGE( 0xf684, 0xf687 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) - AM_RANGE( 0xf688, 0xf688 ) AM_WRITE(radio86_pagesel ) - AM_RANGE( 0xf800, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM page 1 -ADDRESS_MAP_END - -static ADDRESS_MAP_START(radio86_16_mem, AS_PROGRAM, 8, radio86_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x1000, 0x3fff ) AM_RAM // RAM - AM_RANGE( 0x4000, 0x7fff ) AM_READ(radio_cpu_state_r) - AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) - //AM_RANGE( 0xa000, 0xa003 ) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write) AM_MIRROR(0x1ffc) - AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video - AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(mikron2_mem, AS_PROGRAM, 8, radio86_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM - AM_RANGE( 0xc000, 0xc003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x00fc) - //AM_RANGE( 0xc100, 0xc103 ) AM_DEVREADWRITE_LEGACY("ppi8255_2", i8255a_r, i8255a_w) AM_MIRROR(0x00fc) - AM_RANGE( 0xc200, 0xc201 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x00fe) // video - AM_RANGE( 0xc300, 0xc3ff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(impuls03_mem, AS_PROGRAM, 8, radio86_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x1000, 0x7fff ) AM_RAM // RAM - AM_RANGE( 0x8000, 0x8003 ) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_MIRROR(0x1ffc) - AM_RANGE( 0xa000, 0xbfff ) AM_ROM // Basic ROM - AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE("i8275", i8275_device, read, write) AM_MIRROR(0x1ffe) // video - AM_RANGE( 0xe000, 0xffff ) AM_DEVWRITE("dma8257", i8257_device, write) // DMA - AM_RANGE( 0xf000, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( radio86 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) -INPUT_PORTS_END - -INPUT_PORTS_START( ms7007 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(' ') PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR(')') PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('\'') PORT_CHAR('7') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('(') PORT_CHAR('8') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('\xA4') PORT_CHAR('4') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('"') PORT_CHAR('2') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('#') PORT_CHAR('3') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('%') PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('&') PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("LINE8") - PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("CLINE0") - PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - - PORT_START("CLINE1") - PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR('+') - - PORT_START("CLINE2") - PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - - PORT_START("CLINE3") - PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("CLINE4") - PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - - PORT_START("CLINE5") - PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - - PORT_START("CLINE6") - PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - - PORT_START("CLINE7") - PORT_BIT(0x1F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) -INPUT_PORTS_END - -/* F4 Character Displayer */ -static const gfx_layout radio86_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( radio86 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, radio86_charlayout, 0, 1 ) -GFXDECODE_END - - -/* Machine driver */ -static MACHINE_CONFIG_START( radio86, radio86_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_16MHz / 9) - MCFG_CPU_PROGRAM_MAP(radio86_mem) - MCFG_CPU_IO_MAP(radio86_io) - MCFG_MACHINE_RESET_OVERRIDE(radio86_state, radio86 ) - - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, radio86_8255_portc_r2)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) - - MCFG_DEVICE_ADD("i8275", I8275, XTAL_16MHz / 12) - MCFG_I8275_CHARACTER_WIDTH(6) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(radio86_state, display_pixels) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma8257",i8257_device, dreq2_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(78*6, 30*10) - MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", radio86) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(radio86_state,radio86) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(radio86_state, hrq_w)) - MCFG_I8257_IN_MEMR_CB(READ8(radio86_state, memory_read_byte)) - MCFG_I8257_OUT_MEMW_CB(WRITE8(radio86_state, memory_write_byte)) - MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("i8275", i8275_device, dack_w)) - MCFG_I8257_REVERSE_RW_MODE(1) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rkr_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("radio86_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "radio86_cass") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( radio16, radio86 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(radio86_16_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( radiorom, radio86 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(radio86rom_mem) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(radio86_state, radio86rom_romdisk_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(radio86_state, radio86_romdisk_portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_romdisk_portc_w)) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "radio86_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_SOFTWARE_LIST_ADD("cart_list", "radio86_cart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( radioram, radio86 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(radio86ram_mem) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(radio86_state, radio86ram_romdisk_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(radio86_state, radio86_romdisk_portb_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_romdisk_portc_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( rk7007, radio86 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(rk7007_io) - - MCFG_DEVICE_ADD("ms7007", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, rk7007_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( rk700716, radio16 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(rk7007_io) - - MCFG_DEVICE_ADD("ms7007", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(radio86_state, radio86_8255_porta_w2)) - MCFG_I8255_IN_PORTB_CB(READ8(radio86_state, radio86_8255_portb_r2)) - MCFG_I8255_IN_PORTC_CB(READ8(radio86_state, rk7007_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(radio86_state, radio86_8255_portc_w2)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mikron2, radio86 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(mikron2_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( impuls03, radio86 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(impuls03_mem) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( radio86 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bios.rom", 0xf800, 0x0800, CRC(bf1ceea5) SHA1(8f3d472203e550e9854dd79e1f44628635581ed0)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( radio4k ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bios4k.rom", 0xf000, 0x1000, CRC(2ac9d864) SHA1(296716c6cddc9dd31d500ba421aa807c45757cfd)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( spektr01 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "spektr001.rom", 0xf800, 0x0800, CRC(5a38e6d5) SHA1(799c3bbe2a9f08f3aba55379cc093329048350ff)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( radio16 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "rk86.16k", 0xf800, 0x0800, CRC(fd8a4caf) SHA1(90d6af571049a7c8748eac03541e921eac3f70c5)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( radiorom ) - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "32k", "32 KB rom disk") - ROMX_LOAD( "radiorom.rom", 0xf800, 0x0800, CRC(b5cdeab7) SHA1(1c80d72082f2fb2190b575726cb82d86ae0ee7d8), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "64k", "64 KB rom disk") - ROMX_LOAD( "radiorom.64", 0xf800, 0x0800, CRC(5250b927) SHA1(e885e0f5b2325190b38a4c92b20a8b4fa78fbd8f), ROM_BIOS(2)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( radioram ) - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "r86-1.bin", 0xf800, 0x0800, CRC(7e7ab7cb) SHA1(fedb00b6b8fbe1167faba3e4611b483f800e6934)) - ROM_LOAD( "r86-2.bin", 0xe000, 0x0800, CRC(955f0616) SHA1(d2b9f960558bdcb60074091fc79d1ad56c313586)) - ROM_LOAD( "romdisk.bin", 0x10000, 0x10000, CRC(43c0279b) SHA1(bc1dfd9bdbce39460616e2158f5d96279d0af3cf)) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( rk7007 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ms7007.rom", 0xf800, 0x0800, CRC(002811dc) SHA1(4529eb72198c49af77fbcd7833bcd06a1cf9b1ac)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( rk700716 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ms7007.16k", 0xf800, 0x0800, CRC(5268d7b6) SHA1(efd69d8456b8cf8b37f33237153c659725608528)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( mikron2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mikron2.bin", 0xf800, 0x0800, CRC(2cd79bb4) SHA1(501df47e65aaa8f4ce27751bc2a7e7089e2e888c)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END - -ROM_START( kr03 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "kr03-dd17.rf2", 0xf800, 0x0800, CRC(ac2e24d5) SHA1(a1317a261bfd55b3b37109b14d1391308dee04de)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("kr03-dd12.rf2", 0x0000, 0x0800, CRC(085f4259) SHA1(11c5829b072a00961ad936c26559fb63bf2dc896)) -ROM_END - -ROM_START( impuls03 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "imp03bas.rom", 0xa000, 0x2000, CRC(b13b2de4) SHA1(9af8c49d72ca257bc34cad3c62e530730929702e)) - ROM_LOAD( "imp03mon.rom", 0xf800, 0x0800, CRC(8c591ce4) SHA1(8e8e9cba6b3123d74218b92f4b4210606ba53376)) - ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) - ROM_REGION(0x0800, "gfx1",0) - ROM_LOAD ("radio86.fnt", 0x0000, 0x0400, CRC(7666bd5e) SHA1(8652787603bee9b4da204745e3b2aa07a4783dfc)) -ROM_END -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, radio86, 0, 0, radio86, radio86, radio86_state, radio86, "", "Radio-86RK", 0) -COMP( 1986, radio16, radio86, 0, radio16, radio86, radio86_state, radio86, "", "Radio-86RK (16K RAM)", 0) -COMP( 1986, kr03, radio86, 0, radio86, radio86, radio86_state, radio86, "Elektronika", "KR-03", 0) -COMP( 1986, radio4k, radio86, 0, radio86, radio86, radio86_state, radio86, "", "Radio-86RK (4K ROM)", 0) -COMP( 1986, radiorom, radio86, 0, radiorom, radio86, radio86_state, radio86, "", "Radio-86RK (ROM-Disk)", 0) -COMP( 1986, radioram, radio86, 0, radioram, radio86, radio86_state, radioram, "", "Radio-86RK (ROM/RAM Disk)", 0) -COMP( 1986, spektr01, radio86, 0, radio86, radio86, radio86_state, radio86, "", "Spektr-001", 0) -COMP( 1986, rk7007, radio86, 0, rk7007, ms7007, radio86_state, radio86, "", "Radio-86RK (MS7007)", 0) -COMP( 1986, rk700716, radio86, 0, rk700716, ms7007, radio86_state, radio86, "", "Radio-86RK (MS7007 16K RAM)", 0) -COMP( 1986, mikron2, radio86, 0, mikron2, radio86, radio86_state, radio86, "", "Mikron-2", 0) -COMP( 1986, impuls03, radio86, 0, impuls03, radio86, radio86_state, radio86, "", "Impuls-03", 0) diff --git a/src/mess/drivers/rainbow.c b/src/mess/drivers/rainbow.c deleted file mode 100644 index aab93ed3d0f..00000000000 --- a/src/mess/drivers/rainbow.c +++ /dev/null @@ -1,2465 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Miodrag Milanovic,Karl-Ludwig Deisenhofer -/*************************************************************************************************** -DEC Rainbow 100 - -Driver-in-progress by R. Belmont and Miodrag Milanovic. -Portions (2013 - 2015) by Karl-Ludwig Deisenhofer (Floppy, ClikClok RTC, NVRAM, DIPs, hard disk). - -STATE AS OF APRIL 2015 ----------------------- -Driver is based entirely on the DEC-100 'B' variant (DEC-190 and DEC-100 A models are treated as clones). -While this is OK for the compatible -190, it doesn't do justice to ancient '100 A' hardware. -RBCONVERT.ZIP has details on how model 'A' differs from version B. - -Issues with this driver: - -(1) Keyboard emulation incomplete (fatal; inhibits the system from booting with ERROR 50). - -Serial ports do not work, so serial communication failure (ERROR 60) and ERROR 40 (serial -printer interface) result. Unfortunately the BIOS tests all three serial interfaces in line. - -(2) while DOS 3 and UCSD systems (fort_sys, pas_sys) + diag disks boot, CPM 2.x and DOS 2.x die -in secondary boot loader with a RESTORE (seek track 0) when track 2 sector 1 should be loaded. - -Writing files to floppy is next to impossible on both CPM 1.x and DOS 3 (these two OS boot -with keyboard workarounds enabled). File deletion works, so few bytes pass. - -(3) heavy system interaction stalls the driver. Start one of the torture tests on the diag.disk -and see what happens (system interaction, Z80, about any test except the video / CRT tests). - -(4) arbitration chip (E11; in 100-A schematics or E13 in -B) should be dumped. -It is a 6308 OTP ROM (2048 bit, 256 x 8) used as a lookup table (LUT) with the address pins (A) -used as inputs and the data pins (D) as output. - -Plays a role in DMA access to lower memory (limited to 64 K; Extended communication option only). -Arbiter is also involved in refresh and shared memory contention (affects Z80/8088 CPU cycles). - -=> INPUTS on E13 (PC-100 B): - -SH5 RF SH REQ H -> Pin 19 (A7) shared memory request / refresh ? - 1K -> +5 V -> Pin 18 (A6) < UNUSED > -SH 2 BDL ACK (L) -> Pin 17 (A5) BUNDLE OPTION: IRQ acknowledged -SH 2 NONSHRCYC H -> Pin 5 (A4) unshared memory cycle is in progress -SH 2 PRECHARGE H -> Pin 4 (A3) -SH 2 SHMUX 88 ENB -> Pin 3 (A2) shared memory -SH2 DO REFRESH H -> Pin 2 (A1) indicates that extended memory must be refreshed -> on J6 as (L) -SH10 BDL REQ (L) -> Pin 1 (A0) BUNDLE OPTION wishes to use shared memory - - -UPGRADES WORTH EMULATING: -- SHOULD BE IMPLEMENTED AS SLOT DEVICES (for now, DIP settings affect 'system_parameter_r' only and are disabled): - -* Color graphics option (uses NEC upd7220 GDC). REFERENCE: Programmer's Reference: AA-AE36A-TV. -Either 384 x 240 x 16 or 800 x 240 x 4 colors (out of 4096). 8 ? 64 K video RAM. Pallette limited to 4 colors on 100-A. -Graphics output is independent from monochrome output. - -* Extended communication option (occupies BUNDLE_OPTION 1 + 2) REFERENCE: AA-V172A-TV + Addendum AV-Y890A-TV. -Two ports, a high-speed RS-422 half-duplex interface (port A) + lower-speed RS-423 full/half-duplex interface -with modem control (port B). A 5 Mhz. 8237 DMA controller transfers data into and out of shared memory (not: optional RAM). - -Uses SHRAM, SHMA, BDL SH WR L, NONSHARED CYCLE. Implementation requires DMA and arbitration logic (dump of E11/E13 ?). -Can't be added if RD51 hard disk controller present (J4 + J5). For programming info see NEWCOM1.DOC (-> RBETECDOC.ZIP). - - -* ( NO DUMP YET ) PC character set. Enhances Code Blue emulation. Simple CHARACTER ROM replacement? - -* ( NO DUMP YET ) TCS / Technical Character Set ('$95 from DEC, for Rainbow 100, 100B, 100+ ; separate docs available') - Source: price list of a DEC reseller. Possibly identical to http://vt100.net/charsets/technical.html - -* 8087 Numerical Data Coprocessor daughterboard. REFERENCE: EK-PCNDP-IN-PRE -Daughterboard, to be plugged into the expansion port where the memory expansion card usually sits (J6). -If a memory adapter board is present, it has to be plugged into a connector atop the 8087 copro board. -The 8088 is put into the CPU socket on the coprocessor board. -SOFTWARE: MATH test on 'Design Maturity Diagnostics'; AutoCad, TurboPascal and Fortran. - -* Suitable Solutions TURBOW286: 12 Mhz, 68-pin, low power AMD N80L286-12 and WAYLAND/EDSUN EL286-88-10-B ( 80286 to 8088 Processor Signal Converter ) -plus DC 7174 or DT 7174 (barely readable). Add-on card, replaces main 8088 cpu (via ribbon cable). Patched V5.03 BOOT ROM labeled 'TBSS1.3 - 3ED4'. - -* NEC_V20 (requires modded BOOT ROM because of - at least 2 - hard coded timing loops): -100A: 100B/100+: 100B+ ALTERNATE RECOMMENDATION (fixes RAM size auto-detection problems when V20 is in place. -Tested on a 30+ year old live machine. Your mileage may vary) - -Location Data Location Data Loc.|Data -.... .. .... .. ------------------ 00C6 46 [ increases 'wait for Z80' from approx. 27,5 ms (old value 40) to 30,5 ms ] -.... .. .... .. ------------------ 0303 00 [ disable CHECKSUM ] -043F 64 072F 64 <-----------------> 072F 73 [ increases minimum cycle time from 2600 (64) to 3000 ms (73) ] -067D 20 0B36 20 <-----------------> 0B36 20 [ USE A VALUE OF 20 FOR THE NEC - as in the initial patch! CHANGES CAUSE VFR-ERROR 10 ] -1FFE 2B 3FFE 1B (BIOS CHECKSUM) -1FFF 70 3FFF 88 (BIOS CHECKSUM) - --------------------------------------------------------------- -Meaning of Diagnostics LEDs (from PC100ESV1.PDF found, e.g., -on ftp://ftp.update.uu.se/pub/rainbow/doc/rainbow-docs/ - -Internal Diagnostic Messages F -Msg Message Lights Display A -No. * = on o = off T -..........................................- = on or off A -..........................................1 2 3 4 5 6 7 L --------------------------------------------------------------- -.1 Main Board (Video) o * * o * o * Yes -.2 Main Board* (unsolicited interrupt) * * * * o * o Yes -.3 Drive A or B (index) o o * o o * * -.4 Drive A or B (motor) * * o o o * * -.5 Drive A or B (seek) o * o o o * * -.6 Drive A or B (read) * o o o o * * -.7 Drive A or B (restore) o * * o o * * -.8 Drive A or B (step) * o * o o * * -.9 System Load incomplete+ (System Load) o o o o o o o -10 Main Board (video, vfr) * * * o * o * Yes -11 System Load incomplete+ (Boot Load) o o o o o o o -12 Drive A or B (not ready) o o o o o * * -13 Keyboard * * o * o * o Yes -14 Main Board (nvm data) * * * * o * * -15 (no msg. 15 in that table) -16 Interrupts off* * * * o o o o Cond. -17 Main Board (video RAM) * * * o * * o Yes -18 Main Board (Z80 crc) * * * * o o * Yes -19 Main Board RAM (0-64K) - - - * * o * Yes -20 Main Board (unsolicited int., Z80) * * * o o o * Yes -21 Drive Not Ready+ o o o o o o o -22 Remove Card or Diskette o * * o o o * -23 Non-System Diskette+ o o o o o o o -24 new memory size = nnnK o o o o o o o -25 Set Up Defaults stored o o o o o o o -26 Main Board (RAM arbitration) * * * o * o o Yes -27 Main Board (RAM option) - - - * * o o -28 RX50 controller board * * * o o * * -29 Main Board* (Z80 response) * * * * o o o -30 Main Board (ROM crc, ROM 0) * * * * * * * Yes -31 Main Board (ROM crc, ROM 1) * * * * * * o Yes -- Main Board (ROM crc, ROM 2) * * * o * * * Yes -33 Main Board (contention) o o o o o * o Yes -40 Main Board (printer port) * o * * o * o -50 Main Board (keyboard port) o o * * o * o Yes -60 Main Board (comm port) o * * * o * o --------------------------------------------------------------- -* These errors can occur at any time because the circuits -are monitored constantly -+ These messages may occur during power-up if auto boot is -selected - -PCB layout -========== - -DEC-100 model B -= part no.70-19974-02 according to document EK-RB100-TM_001 - -PCB # 5416206 / 5016205-01C1: - -7-6-5-4 |3-2-1 -DIAGNOSTIC-LEDs |J3 | |J2 | |J1 | -|------|----8088|Z80-|--|VIDEO|-|PRINTER|-|SERIAL|----| -| 2 x 64 K |/KBD.| !!!!!| -| R A M NEC D7201C |P|!W90!| -| |O|!!!!!| -| [W6] ROM 1 INTEL 8088 |W| | -| (23-020e5-00) |E| | -| |R| | -| ...J5.. BOOT ROM 0 ...J4... =J8 | -| (23-022e5-00) | -| ...J6... | -| [W5] | -| | -| INTEL 8251A ZILOG Z 80A | -| [W18] | -| A 4x 74 LS 244 | -| M S [W15] | -| 9 - DEC-DC011 74 LS 245 | -| 1 R [W14] | -| 2 A [W13] | -| 8 M CHARGEN.- | -| ROM (4K) ...J7... | ...J9 = RX50 | -| | -|-------------PCB# 5416206 / 5016205-01C1-------------| - -CONNECTORS ("J"): - ...J5... ...J4... both: RD51 controller (hard disk) - ...J5... ...J4... both: EXTENDED COMM. controller - - ...J6... is the MEMORY OPTION connector (52 pin) - ...J7... is the GRAPHICS OPTION connector (40 pin) - ...J9... RX50 FLOPPY CONTROLLER (40 pin; REQUIRED) - -JUMPERS (labeled "W"): - W5 + W6 are out when 16K x 8 EPROMS are used -/ W5 + W6 installed => 32 K x 8 EPROMs (pin 27 = A14) - -W13, W14, W15, W18 = for manufacturing tests. -=> W13 - W15 affect diagnostic read register (port $0a) -=> W18 pulls DSR to ground and affects 8251A - port $11 (bit 7) - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! DO NOT SHORT JUMPER / CONNECTOR [W90] ON LIVE HARDWARE !! -!! !! -!! WARNING: CIRCUIT DAMAGE could occur if this jumper is !! -!! set by end users. See PDF document AA-V523A-TV. !! -!! !! -!! W90 connects to pin 2 (Voltage Bias on PWR connector J8)!! -!! and is designed FOR ===> FACTORY TESTS OF THE PSU <=== !! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -WIRE CONNECTORS - SEEN ON SCHEMATICS - NOT PRESENT ON DEC-100 B (-A only?): -W16 pulls J2 printer port pin 1 to GND when set (chassis to logical GND). -W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND). -****************************************************************************/ - -// --------------------------------------------------------------------------- -// WORKAROUNDS: -// (1) FORCE LOGO: - not valid for 100-A ROM - -//#define FORCE_RAINBOW_B_LOGO - -// (2) KEYBOARD_WORKAROUND : also requires FORCE...LOGO (and preliminary headers) -//#define KEYBOARD_WORKAROUND -//#define KBD_DELAY 8 // (debounce delay) -// --------------------------------------------------------------------------- - - -// Define standard and maximum RAM sizes (A, then B model): -//#define BOARD_RAM 0x0ffff // 64 K base RAM (100-A) -//#define END_OF_RAM 0xcffff // very last byte (100-A) DO NOT CHANGE. - -// DEC-100-B probes until a 'flaky' area is found (BOOT ROM around F400:0E04). -// It is no longer possible to key in the RAM size from within the 100-B BIOS. -#define BOARD_RAM 0x1ffff // 128 K base RAM (100-B) -#define END_OF_RAM 0xdffff // very last byte (100-B) DO NOT CHANGE. - -// ---------------------------------------------------------------------------------------------- -#include "emu.h" -#include "cpu/i86/i86.h" -#include "cpu/z80/z80.h" -#include "video/vtvideo.h" - -#include "machine/wd_fdc.h" -#include "formats/rx50_dsk.h" -#include "formats/pc_dsk.h" // PC Formats (TESTING) -#include "imagedev/flopdrv.h" - -#include "imagedev/harddriv.h" -#include "machine/wd2010.h" - -#include "machine/i8251.h" -#include "machine/clock.h" -#include "machine/dec_lk201.h" -#include "machine/nvram.h" - -#include "machine/ds1315.h" - -#include "rainbow.lh" // BEZEL - LAYOUT with LEDs for diag 1-7, keyboard 8-11 and floppy 20-23 - -#define LK201_TAG "lk201" -#define FD1793_TAG "fd1793x" - -#define INVALID_DRIVE 255 -#define MAX_FLOPPIES 4 - -class rainbow_state : public driver_device -{ -public: - rainbow_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - -#ifdef KEYBOARD_WORKAROUND -#include "./m_kbd1.c" -#endif - - - m_inp1(*this, "W13"), - m_inp2(*this, "W14"), - m_inp3(*this, "W15"), - m_inp4(*this, "W18"), - m_inp5(*this, "HARD DISK PRESENT"), // DO NOT CHANGE ORDER (also: COMMUNICATION EXTENSION) - m_inp6(*this, "FLOPPY CONTROLLER"), // DO NOT CHANGE ORDER - m_inp7(*this, "GRAPHICS OPTION"), // DO NOT CHANGE ORDER - m_inp8(*this, "MEMORY PRESENT"), // DO NOT CHANGE ORDER - m_inp9(*this, "MONITOR TYPE"), - m_inp10(*this, "J17"), - m_inp11(*this, "CLIKCLOK"), - m_inp12(*this, "WATCHDOG"), - - m_crtc(*this, "vt100_video"), - m_i8088(*this, "maincpu"), - m_z80(*this, "subcpu"), - m_fdc(*this, FD1793_TAG), - - m_hdc(*this, "hdc"), - - m_kbd8251(*this, "kbdser"), - m_lk201(*this, LK201_TAG), - m_p_ram(*this, "p_ram"), - - m_p_vol_ram(*this, "vol_ram"), - m_p_nvram(*this, "nvram"), - - m_shared(*this, "sh_ram"), - - m_rtc(*this, "rtc") - { - } - - DECLARE_READ8_MEMBER(read_video_ram_r); - DECLARE_WRITE_LINE_MEMBER(clear_video_interrupt); - //DECLARE_WRITE8_MEMBER(hd_status_10C_w); // MHFU DISABLE REGISTER (W) - - DECLARE_READ8_MEMBER(diagnostic_r); - DECLARE_WRITE8_MEMBER(diagnostic_w); - - DECLARE_READ8_MEMBER(comm_control_r); - DECLARE_WRITE8_MEMBER(comm_control_w); - - DECLARE_READ8_MEMBER(share_z80_r); - DECLARE_WRITE8_MEMBER(share_z80_w); - - // 'RD51' MFM CONTROLLER (WD1010) ************************************* - DECLARE_READ8_MEMBER(hd_status_60_r); // TRI STATE DATA PORT (R/W) - DECLARE_WRITE8_MEMBER(hd_status_60_w); - - DECLARE_READ8_MEMBER(hd_status_68_r); // EXTRA REGISTER 0x68 (R/W 8088) - DECLARE_WRITE8_MEMBER(hd_status_68_w); - - DECLARE_READ8_MEMBER(hd_status_69_r); // EXTRA REGISTER 0x69 (R/- 8088) - - DECLARE_WRITE_LINE_MEMBER(bundle_irq); - DECLARE_WRITE_LINE_MEMBER(hdc_bdrq); // BUFFER DATA REQUEST (FROM WD) - DECLARE_WRITE_LINE_MEMBER(hdc_bcr); // BUFFER COUNTER RESET (FROM WD) - - DECLARE_WRITE_LINE_MEMBER(hdc_step); - DECLARE_WRITE_LINE_MEMBER(hdc_direction); - - DECLARE_WRITE_LINE_MEMBER(hdc_read_sector); - DECLARE_WRITE_LINE_MEMBER(hdc_write_sector); - - DECLARE_READ_LINE_MEMBER(hdc_drive_ready); - DECLARE_READ_LINE_MEMBER(hdc_write_fault); - - DECLARE_READ8_MEMBER(i8088_latch_r); - DECLARE_WRITE8_MEMBER(i8088_latch_w); - DECLARE_READ8_MEMBER(z80_latch_r); - DECLARE_WRITE8_MEMBER(z80_latch_w); - - DECLARE_WRITE8_MEMBER(z80_diskdiag_read_w); - DECLARE_WRITE8_MEMBER(z80_diskdiag_write_w); - - DECLARE_READ8_MEMBER(z80_generalstat_r); - - DECLARE_READ8_MEMBER(z80_diskstatus_r); - DECLARE_WRITE8_MEMBER(z80_diskcontrol_w); - - DECLARE_READ8_MEMBER(system_parameter_r); - - DECLARE_WRITE_LINE_MEMBER(kbd_tx); - DECLARE_WRITE_LINE_MEMBER(kbd_rxready_w); - DECLARE_WRITE_LINE_MEMBER(kbd_txready_w); - - DECLARE_WRITE_LINE_MEMBER(irq_hi_w); - - DECLARE_READ8_MEMBER(rtc_reset); - DECLARE_READ8_MEMBER(rtc_enable); - DECLARE_READ8_MEMBER(rtc_r); - - DECLARE_READ8_MEMBER(rtc_reset2); - DECLARE_READ8_MEMBER(rtc_enable2); - DECLARE_READ8_MEMBER(rtc_r2); - - DECLARE_READ8_MEMBER(rtc_w); - - -#ifdef KEYBOARD_WORKAROUND -#include "./port9x_Ax.c" -#endif - UINT32 screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); - - DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); - TIMER_DEVICE_CALLBACK_MEMBER(motor_tick); - - DECLARE_FLOPPY_FORMATS(floppy_formats); -protected: - virtual void machine_start(); - -private: - enum - { // LOWEST PRIORITY - // Mnemonic - - - - - - TYPE ADDRESS - Source - // [1][0] [1][0] <= Depends on DTR(L) output of keyboard PUSART (on Rainbow-100 B) - IRQ_8088_MAILBOX = 0, // 27/A7 9C/29C - [built-in] Interrupt from Z80A - IRQ_8088_KBD, // 26/A6 98/298 - [built-in] KEYBOARD Interrupt - 8251A - IRQ_BDL_INTR_L, // 25/A5 94/294 - [ext. BUNDLE OPTION] Hard disk or Extended communication IRQ (no DMA) - // IRQ_COMM_PTR_INTR_L, // 24/A4 90/290 - [built-in 7201] Communication/Printer interrupt - // IRQ_DMAC_INTR_L, // 23/A3 8C/28C - [ext. COMM.BOARD only] - external DMA Controller (8237) interrupt - // IRQ_GRF_INTR_L, // 22/A2 88/288 - [ext. COLOR GRAPHICS] - // IRQ_BDL_INTR_1L, // 21/A1 84/284 - [ext. COMM.BOARD only] - IRQ_8088_VBL, // 20/A0 80/280 - [built-in DC012] - VERT INTR L (= schematics) - IRQ_8088_NMI // 02/02 08/08 - [external MEMORY EXTENSION] - PARITY ERROR L - }; // HIGHEST PRIORITY - - -#ifdef KEYBOARD_WORKAROUND -#include "./m_kbd2.c" -#endif - - required_ioport m_inp1; - required_ioport m_inp2; - required_ioport m_inp3; - required_ioport m_inp4; - required_ioport m_inp5; - required_ioport m_inp6; - required_ioport m_inp7; - required_ioport m_inp8; - required_ioport m_inp9; - required_ioport m_inp10; - required_ioport m_inp11; - required_ioport m_inp12; - required_device m_crtc; - required_device m_i8088; - required_device m_z80; - - required_device m_fdc; - optional_device m_hdc; - - required_device m_kbd8251; - required_device m_lk201; - required_shared_ptr m_p_ram; - required_shared_ptr m_p_vol_ram; - required_shared_ptr m_p_nvram; - required_shared_ptr m_shared; - - optional_device m_rtc; - - void raise_8088_irq(int ref); - void lower_8088_irq(int ref); - - void update_8088_irqs(); - - void update_bundle_irq(); // RD51 or COMM.OPTION! - int do_write_sector(); - void hdc_buffer_counter_reset(); - void hdc_reset(); - - hard_disk_file *rainbow_hdc_file(int ref); - - bool m_SCREEN_BLANK; - - int INT88, INTZ80; - - bool m_zflip; // Z80 alternate memory map with A15 inverted - bool m_z80_halted; - int m_z80_diskcontrol; // retains values needed for status register - - bool m_kbd_tx_ready, m_kbd_rx_ready; - int m_KBD; - - int m_beep_counter; - int MOTOR_DISABLE_counter; - - int COLD_BOOT; - UINT8 m_diagnostic; - - UINT8 m_z80_private[0x800]; // Z80 private 2K - UINT8 m_z80_mailbox, m_8088_mailbox; - - void update_kbd_irq(); - virtual void machine_reset(); - - int m_unit; - floppy_image_device *m_floppy; - - int m_irq_high; - UINT32 m_irq_mask; - - int m_bdl_irq; - int m_hdc_buf_offset; - - bool m_hdc_index_latch; - bool m_hdc_step_latch; - int m_hdc_direction; - bool m_hdc_track0; - bool m_hdc_write_gate; - - bool m_hdc_drive_ready; - bool m_hdc_write_fault; - - UINT8 m_hdc_buffer[2048]; -}; - -// initially only RX50IMG_FORMAT, FLOPPY_TD0_FORMAT, (IMD + PC : TESTING !!) -FLOPPY_FORMATS_MEMBER(rainbow_state::floppy_formats) -FLOPPY_RX50IMG_FORMAT, -FLOPPY_TD0_FORMAT, -FLOPPY_IMD_FORMAT, -FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -// initially only : SLOT_INTERFACE("525qd", FLOPPY_525_SSQD) -static SLOT_INTERFACE_START(rainbow_floppies) -SLOT_INTERFACE("525qd0", FLOPPY_525_SSQD) -SLOT_INTERFACE("525qd1", FLOPPY_525_SSQD) -SLOT_INTERFACE("525qd2", FLOPPY_525_SSQD) -SLOT_INTERFACE("525qd3", FLOPPY_525_SSQD) -SLOT_INTERFACE_END -// testing: SLOT_INTERFACE("35ssdd", FLOPPY_35_SSDD) - -void rainbow_state::machine_start() -{ - MOTOR_DISABLE_counter = 2; // soon resets drv.LEDs - COLD_BOOT = 1; - - m_SCREEN_BLANK = false; - - save_item(NAME(m_z80_private)); - save_item(NAME(m_z80_mailbox)); - save_item(NAME(m_8088_mailbox)); - save_item(NAME(m_zflip)); - save_item(NAME(m_kbd_tx_ready)); - save_item(NAME(m_kbd_rx_ready)); - save_item(NAME(m_irq_high)); - save_item(NAME(m_irq_mask)); - -#ifdef FORCE_RAINBOW_B_LOGO - UINT8 *rom = memregion("maincpu")->base(); - - rom[0xf4000 + 0x364a] = 2 + 8; // 2 :set ; 4 : reset, 8 : set for 0xf4363 ( 0363 WAIT_FOR_BIT3__loc_35E ) - - rom[0xf4000 + 0x0363] = 0x90; - rom[0xf4000 + 0x0364] = 0x90; - - // If bit 2 = 1 (Efff9), then a keyboard powerup is necessary (=> will lock up in current state) - rom[0xf4000 + 0x3638] = 0x80; // OR instead of TEST - rom[0xf4000 + 0x3639] = 0x0f; // OR instead of TEST - rom[0xf4000 + 0x363a] = 0x08; // 04 => 08 - - rom[0xf4000 + 0x363b] = 0xeb; // COND => JMPS - - if (rom[0xf4174] == 0x75) - { - rom[0xf4174] = 0xeb; // jmps RAINBOW100_LOGO__loc_33D - rom[0xf4175] = 0x08; - } - - if (rom[0xf4000 + 0x3ffc] == 0x31) // 100-B - rom[0xf4384] = 0xeb; // JMPS => BOOT80 - - if (rom[0xf4000 + 0x3ffc] == 0x35) // v5.05 - rom[0xf437b] = 0xeb; - - //TEST-DEBUG: always reset NVM to defaults (!) - //rom[0x3d6c] = 0x90; - //rom[0x3d6d] = 0x90; -#endif - -#ifdef KEYBOARD_WORKAROUND -#include "./rainbow_keyboard0.c" -#endif -} - -static ADDRESS_MAP_START(rainbow8088_map, AS_PROGRAM, 8, rainbow_state) -ADDRESS_MAP_UNMAP_HIGH -AM_RANGE(0x00000, 0x0ffff) AM_RAM AM_SHARE("sh_ram") -AM_RANGE(0x10000, END_OF_RAM) AM_RAM - -// There is a 2212 (256 x 4 bit) NVRAM from 0xed000 to 0xed0ff (*) -// shadowed at $ec000 - $ecfff and from $ed100 - $edfff. - -// (*) ED000 - ED0FF is the area the DEC-100-B BIOS accesses and checks - -// - Specs say that the CPU has direct access to volatile RAM only. -// So NVRAM is hidden and loads & saves are triggered within the -// 'diagnostic_w' handler (similar to real hardware). - -// - Address bits 8-12 are ignored (-> AM_MIRROR). -AM_RANGE(0xed000, 0xed0ff) AM_RAM AM_SHARE("vol_ram") AM_MIRROR(0x1f00) -AM_RANGE(0xed100, 0xed1ff) AM_RAM AM_SHARE("nvram") - -AM_RANGE(0xee000, 0xeffff) AM_RAM AM_SHARE("p_ram") -AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(rainbow8088_io, AS_IO, 8, rainbow_state) -ADDRESS_MAP_UNMAP_HIGH -//ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_GLOBAL_MASK(0x1ff) -AM_RANGE(0x00, 0x00) AM_READWRITE(i8088_latch_r, i8088_latch_w) - -// 0x02 Communication status / control register (8088) -AM_RANGE(0x02, 0x02) AM_READWRITE(comm_control_r, comm_control_w) - -AM_RANGE(0x04, 0x04) AM_DEVWRITE("vt100_video", rainbow_video_device, dc011_w) - -// TODO: unmapped [06] : Communication bit rates (see page 21 of PC 100 SPEC) - -AM_RANGE(0x08, 0x08) AM_READ(system_parameter_r) - -AM_RANGE(0x0a, 0x0a) AM_READWRITE(diagnostic_r, diagnostic_w) - -AM_RANGE(0x0c, 0x0c) AM_DEVWRITE("vt100_video", rainbow_video_device, dc012_w) - -// TODO: unmapped [0e] : PRINTER BIT RATE REGISTER (WO) - -AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("kbdser", i8251_device, data_r, data_w) -AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("kbdser", i8251_device, status_r, control_w) - -// =========================================================== -// There are 4 select lines for Option Select 1 to 4 -// Option Select ------------------- Bundle Option Present -// 1 2 3 4: BDL PRES (L): -// X X o o Communication Option----- X -// o X o o RD51 hard disk controller X --------- (X = SELECT) -// =========================================================== -// 0x20 -> 0x2f ***** EXTENDED COMM. OPTION / Option Select 1. -// See boot rom @1EA6: 0x27 (<- RESET EXTENDED COMM OPTION ) -// =========================================================== -// 0x30 -> 0x3f ***** Option Select 3 -// =========================================================== -// 0x40 COMMUNICATIONS DATA REGISTER (MPSC) -// 0x41 PRINTER DATA REGISTER (MPSC) -// 0x42 COMMUNICATIONS CONTROL / STATUS REGISTER (MPSC) -// 0x43 PRINTER CONTROL / STATUS REGISTER (MPSC) -// =========================================================== -// 0x50 - 0x57 ***** COLOR GRAPHICS OPTION: -// 50h Graphics option software reset. Any write to this -// port also resynchronizes the read/modify/write memory -// cycles of the Graphics Option to those of the GDC (*) -// * see boot ROM @1EB4/8 -// 51h Data written to this port is loaded into the area -// selected by the previous write to port 53h. - -// 52h Data written to this port is loaded into the Write Buffer. - -// 53h Data written to this port provides address selection -// for indirect addressing (see Indirect Register). - -// 54h Data written to this port is loaded into the low-order -// byte of the Write Mask. - -// 55h Data written to this port is loaded into the high-order -// byte of the Write Mask. - -// 56h Data written to this port is loaded into the GDC's FIFO -// Buffer and flagged as a parameter. -// =========================================================== -// 0x60 -> 0x6f ***** EXTENDED COMM. OPTION / Option Select 2. -// =========================================================== -// 0x60 -> 0x6f ***** RD51 HD. CONTROLLER / Option Select 2. -AM_RANGE(0x60, 0x67) AM_DEVREADWRITE("hdc", wd2010_device, read, write) -AM_RANGE(0x68, 0x68) AM_READWRITE(hd_status_68_r, hd_status_68_w) -AM_RANGE(0x69, 0x69) AM_READ(hd_status_69_r) -// =========================================================== -// THE RD51 CONTROLLER: -// - WD1010AL - 00 (WDC '83) -// + 2 K x 8 SRAM (SY2128-4 or Japan 8328) 21-17872-01 -// + 74(L)Sxxx glue logic (drive/head select, buffers etc.) -// + 10 Mhz Quartz (/2) -// SERVICE JUMPERS (not to be removed for normal operation): -// JUMPER "W1" : bridge between 10 Mhz master clock and board -// JUMPER "W2" : bridges SYNC within Read Data Circuit -// JUMPER "W3" : bridges 'drive read data' (from hard disk) -// Later RD51 boards (> '83 week 28 ?) have no jumpers at all. -// =========================================================== -// DEC RD TYPE (MByte) CYL ---- HEADS ---- MODEL (typical) -// DEC RD50 (5 Mbyte): 153 cyl. 4 heads -- ST506 -// DEC RD51(10 Mbyte); 306 cyl. 4 heads -- ST412 -// DEC RD31(20 Mbyte); 615 cyl. 4 heads -- ST225 -// DEC RD52(32 Mbyte); 512 cyl. 8 heads -- Q540 [!] -// DEC RD32(40 Mbyte); 820 cyl. 6 heads -- ST251 [!] -// DEC RD53(67 Mbyte); 1024 cyl.8 heads -- 1325 [!] -// [!] More than 4 heads. Prepare with WUTIL and / or DSKPREP. - -// SIZE RESTRICTIONS -// * HARDWARE: -// WD1010 controller has a built-in limit of 8 heads / 1024 cylinders. -// * BOOT LOADERS: -// - the DEC boot loader (and FDISK from DOS 3.10) initially allowed a maximum hard disc size of 20 MB. -// - the custom boot loader that comes with 'WUTIL 3.2' allows 117 MB and 8 surfaces. -// * SOFTWARE: -// - MS-DOS 2 allows a maximum partition size of 16 MB (sizes > 15 MB are incompatible to DOS 3) -// [ no more than 4 partitions of 8 MB size on one hard disk possible ] -// - MS-DOS 3 - and Concurrent CPM - have a global 32 MB (1024 cylinder) limit -// - a CP/M-86-80 partition can have up to 8 MB (all CP/M partitions together must not exceed 10 MB) -// =========================================================== -// 0x70 -> 0x7f ***** Option Select 4 -// =========================================================== -// 0x10c -AM_RANGE(0x10c, 0x10c) AM_DEVWRITE("vt100_video", rainbow_video_device, dc012_w) - - -#ifdef KEYBOARD_WORKAROUND -#include "./am_range_9x_Ax.c" -#endif - -ADDRESS_MAP_END - -static ADDRESS_MAP_START(rainbowz80_mem, AS_PROGRAM, 8, rainbow_state) -ADDRESS_MAP_UNMAP_HIGH -AM_RANGE(0x0000, 0xffff) AM_READWRITE(share_z80_r, share_z80_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(rainbowz80_io, AS_IO, 8, rainbow_state) -ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_GLOBAL_MASK(0xff) -AM_RANGE(0x00, 0x00) AM_READWRITE(z80_latch_r, z80_latch_w) -AM_RANGE(0x20, 0x20) AM_READWRITE(z80_generalstat_r, z80_diskdiag_read_w) // read to port 0x20 used by MS-DOS 2.x diskette loader. -AM_RANGE(0x21, 0x21) AM_READWRITE(z80_generalstat_r, z80_diskdiag_write_w) -AM_RANGE(0x40, 0x40) AM_READWRITE(z80_diskstatus_r, z80_diskcontrol_w) -AM_RANGE(0x60, 0x63) AM_DEVREADWRITE(FD1793_TAG, fd1793_t, read, write) - -// Z80 I/O shadow area > $80 -AM_RANGE(0x80, 0x80) AM_READWRITE(z80_latch_r, z80_latch_w) -AM_RANGE(0xA0, 0xA0) AM_READWRITE(z80_generalstat_r, z80_diskdiag_read_w) // read to port 0x20 used by MS-DOS 2.x diskette loader. -AM_RANGE(0xA1, 0xA1) AM_READWRITE(z80_generalstat_r, z80_diskdiag_write_w) -AM_RANGE(0xC0, 0xC0) AM_READWRITE(z80_diskstatus_r, z80_diskcontrol_w) -AM_RANGE(0xE0, 0xE3) AM_DEVREADWRITE(FD1793_TAG, fd1793_t, read, write) -ADDRESS_MAP_END - -/* Input ports */ - -/* DIP switches */ -static INPUT_PORTS_START(rainbow100b_in) - -#ifdef KEYBOARD_WORKAROUND -#include "./rainbow_ipt.c" -#endif -PORT_START("MONITOR TYPE") -PORT_DIPNAME(0x03, 0x03, "MONOCHROME MONITOR") -PORT_DIPSETTING(0x01, "WHITE") -PORT_DIPSETTING(0x02, "GREEN") -PORT_DIPSETTING(0x03, "AMBER") - -// MEMORY, FLOPPY, BUNDLE, GRAPHICS affect 'system_parameter_r': -PORT_START("MEMORY PRESENT") -PORT_DIPNAME(0xF0000, 0x20000, "MEMORY PRESENT") -PORT_DIPSETTING(0x10000, "64 K (MINIMUM ON 100-A)") // see BOARD_RAM -PORT_DIPSETTING(0x20000, "128 K (MINIMUM ON 100-B)") -PORT_DIPSETTING(0x30000, "192 K (w. MEMORY OPTION)") -PORT_DIPSETTING(0x40000, "256 K (w. MEMORY OPTION)") -PORT_DIPSETTING(0x50000, "320 K (100-B MEMORY OPTION)") -PORT_DIPSETTING(0x60000, "384 K (100-B MEMORY OPTION)") -PORT_DIPSETTING(0x70000, "448 K (100-B MEMORY OPTION)") -PORT_DIPSETTING(0x80000, "512 K (100-B MEMORY OPTION)") -PORT_DIPSETTING(0x90000, "576 K (100-B MEMORY OPTION)") -PORT_DIPSETTING(0xA0000, "640 K (100-B MEMORY OPTION)") -PORT_DIPSETTING(0xB0000, "704 K (100-B MEMORY OPTION)") -PORT_DIPSETTING(0xC0000, "768 K (100-B MEMORY OPTION)") -PORT_DIPSETTING(0xD0000, "832 K (100-B MEMORY OPTION)") // see END_OF_RAM -PORT_DIPSETTING(0xE0000, "896 K (100-B MAX. MEMORY)") - -PORT_START("FLOPPY CONTROLLER") // floppy controller is not optional -PORT_DIPNAME(0x01, 0x01, "FLOPPY CONTROLLER") PORT_TOGGLE -PORT_DIPSETTING(0x01, DEF_STR(On)) - -// EXT.COMM.card -or- RD51 HD. controller (marketed later). -PORT_START("HARD DISK PRESENT") // BUNDLE_OPTION -PORT_DIPNAME(0x01, 0x00, "HARD DISK PRESENT") PORT_TOGGLE -PORT_DIPSETTING(0x00, DEF_STR(Off)) -PORT_DIPSETTING(0x01, DEF_STR(On)) - -PORT_START("CLIKCLOK") // DS1315 RTC -PORT_DIPNAME(0x01, 0x00, "REAL TIME CLOCK (CLIKCLOK)") PORT_TOGGLE -PORT_DIPSETTING(0x00, DEF_STR(Off)) -PORT_DIPSETTING(0x01, DEF_STR(On)) - -PORT_START("GRAPHICS OPTION") // NEC COLOR GRAPHICS not implemented yet -PORT_DIPNAME(0x00, 0x00, "GRAPHICS OPTION") PORT_TOGGLE -PORT_DIPSETTING(0x00, DEF_STR(Off)) -PORT_DIPSETTING(0x01, DEF_STR(On)) - -// W13 - W18 are used for factory tests and affect the boot process - -PORT_START("W13") -PORT_DIPNAME(0x02, 0x02, "W13 (FACTORY TEST A, LEAVE OFF)") PORT_TOGGLE -PORT_DIPSETTING(0x02, DEF_STR(Off)) -PORT_DIPSETTING(0x00, DEF_STR(On)) - -PORT_START("W14") -PORT_DIPNAME(0x04, 0x04, "W14 (FACTORY TEST B, LEAVE OFF)") PORT_TOGGLE -PORT_DIPSETTING(0x04, DEF_STR(Off)) -PORT_DIPSETTING(0x00, DEF_STR(On)) -PORT_START("W15") -PORT_DIPNAME(0x08, 0x08, "W15 (FACTORY TEST C, LEAVE OFF)") PORT_TOGGLE -PORT_DIPSETTING(0x08, DEF_STR(Off)) -PORT_DIPSETTING(0x00, DEF_STR(On)) - -PORT_START("W18") // DSR = 1 when switch is OFF - see i8251.c -PORT_DIPNAME(0x01, 0x00, "W18 (FACTORY TEST D, LEAVE OFF) (8251A: DSR)") PORT_TOGGLE -PORT_DIPSETTING(0x00, DEF_STR(Off)) -PORT_DIPSETTING(0x01, DEF_STR(On)) -PORT_WRITE_LINE_DEVICE_MEMBER("kbdser", i8251_device, write_dsr) - -// J17 jumper on FDC controller board shifts drive select (experimental) - -PORT_START("J17") -PORT_DIPNAME(0x02, 0x00, "J17 DRIVE SELECT (A => C and B => D)") PORT_TOGGLE -PORT_DIPSETTING(0x00, DEF_STR(Off)) -PORT_DIPSETTING(0x02, DEF_STR(On)) - -PORT_START("WATCHDOG") -PORT_DIPNAME(0x01, 0x01, "WATCHDOG ENABLED (MHFU)") PORT_TOGGLE -PORT_DIPSETTING(0x00, DEF_STR(Off)) -PORT_DIPSETTING(0x01, DEF_STR(On)) - -INPUT_PORTS_END - -void rainbow_state::machine_reset() -{ - /* configure RAM */ - address_space &program = machine().device("maincpu")->space(AS_PROGRAM); - if (m_inp8->read() < END_OF_RAM) - { - program.unmap_readwrite(m_inp8->read(), END_OF_RAM); - } - // BIOS can't handle soft resets (would trigger ERROR 16). - // As a fallback, execute a hard reboot! - if (COLD_BOOT == 2) - { // FIXME: ask for confirmation (via UI ?) - device().machine().schedule_hard_reset(); - } - - /* ***************************************************************************************************************** - Suitable Solutions ClikClok (one of the more compatible battery backed real time clocks) - - DESCRIPTION: plugs into NVRAM chip socket on a 100-A and into one of the (EP)ROM sockets on the 100-B - ............ (there is a socket on the ClikClok for the NVRAM / EPROM chip). - - DS1315 phantom clock. No address space needed (-> IRQs must be disabled to block ROM accesses during reads). - - DRIVERS: 'rbclik.zip' DOS and CP/M binaries plus source from DEC employee; Reads & displays times. Y2K READY. - + 'newclk.arc' (Suitable Solutions; sets time and date; uses FE000 and up). 2 digit year here. - - TODO: obtain hardware / check address decoders. Access logic here is derived from Vincent Esser's source. - *****************************************************************************************************************/ - - // * Reset RTC to a defined state * - #define RTC_RESET 0xFC104 // read $FC104 or mirror $FE104 - program.install_read_handler(RTC_RESET, RTC_RESET, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_reset), this)); - program.install_read_handler(RTC_RESET + 0x2000, RTC_RESET + 0x2000, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_reset2), this)); - - // A magic pattern enables reads or writes (-> RTC_WRITE_DATA_0 / RTC_WRITE_DATA_1) - // 64 bits read from two alternating addresses (see DS1315.C) - #define RTC_PATTERN_0 0xFC100 // MIRROR: FE100 - #define RTC_PATTERN_1 0xFC101 // MIRROR: FE101 - program.install_read_handler(RTC_PATTERN_0, RTC_PATTERN_1, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_enable), this)); - program.install_read_handler(RTC_PATTERN_0 + 0x2000, RTC_PATTERN_1 + 0x2000, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_enable2), this)); - - // * Read actual time/date from ClikClok * - #define RTC_READ_DATA 0xFC004 // Single byte - delivers one bit (if RTC enabled). MIRROR: FE004 - program.install_read_handler(RTC_READ_DATA, RTC_READ_DATA, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_r), this)); - program.install_read_handler(RTC_READ_DATA + 0x2000, RTC_READ_DATA + 0x2000, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_r2), this)); - - // * Secretly transmit data to RTC (set time / date) * Works only if magic pattern enabled RTC. Look ma, no writes! - #define RTC_WRITE_DATA_0 0xFE000 - #define RTC_WRITE_DATA_1 0xFE001 - program.install_read_handler(RTC_WRITE_DATA_0, RTC_WRITE_DATA_1, 0, 0, read8_delegate(FUNC(rainbow_state::rtc_w), this)); - - m_rtc->chip_reset(); - // *********************************** / DS1315 'PHANTOM CLOCK' IMPLEMENTATION FOR 'DEC-100-B' *************************************** - - - if (COLD_BOOT == 1) - { - COLD_BOOT = 2; - m_crtc->MHFU(-100); // reset MHFU counter - } - - // *********** HARD DISK CONTROLLER... - if (m_inp5->read() == 0x01) // ...PRESENT? - { - // Install 8088 read / write handler - address_space &io = machine().device("maincpu")->space(AS_IO); - io.unmap_readwrite(0x60, 0x60); - io.install_read_handler(0x60, 0x60, read8_delegate(FUNC(rainbow_state::hd_status_60_r), this)); - io.install_write_handler(0x60, 0x60, write8_delegate(FUNC(rainbow_state::hd_status_60_w), this)); - - hdc_reset(); - m_hdc_drive_ready = true; - m_hdc_write_fault = false; - - hard_disk_file *local_hard_disk; - local_hard_disk = rainbow_hdc_file(0); // one hard disk for now. - - output_set_value("led1", 0); - if (local_hard_disk) - { - hard_disk_info *info; - if ( (info = hard_disk_get_info(local_hard_disk)) ) - { - output_set_value("led1", 1); - - UINT32 max_sector = (info->cylinders) * (info->heads) * (info->sectors); - printf("\n%u MB HARD DISK: HEADS (1..8 OK) = %d / CYL. (151..1024 OK) = %d / SPT. (16 OK) = %d / SECTOR_BYTES (128..1024 OK) = %d\n", max_sector * 512 / 1000000, - info->heads, info->cylinders, info->sectors, info->sectorbytes); - } - } - } - - // *********** FLOPPY DISK CONTROLLER - m_unit = INVALID_DRIVE; - m_fdc->reset(); - m_fdc->set_floppy(NULL); - m_fdc->dden_w(0); - - m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_z80_halted = true; - m_zflip = true; - - INTZ80 = false; - INT88 = false; - - m_kbd_tx_ready = m_kbd_rx_ready = false; - m_kbd8251->write_cts(1); - m_KBD = 0; - - m_irq_high = 0; - - // RESET ALL LEDs - output_set_value("led1", 1); - output_set_value("led2", 1); - output_set_value("led3", 1); - output_set_value("led4", 1); - output_set_value("led5", 1); - output_set_value("led6", 1); - output_set_value("led7", 1); - - // GREEN KEYBOARD LEDs (1 = on, 0 = off): - output_set_value("led_wait", 0); // led8 - output_set_value("led_compose", 0); // led9 - output_set_value("led_lock", 0); // led10 - output_set_value("led_hold", 0); // led11 - - m_irq_mask = 0; -} - -#ifdef KEYBOARD_WORKAROUND -#include "./rainbow_keyboard2.c" -#endif - -UINT32 rainbow_state::screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -/* - // Suppress display when accessing floppy (switch to 'smooth scroll' when working with DOS, please)! - if (MOTOR_DISABLE_counter) // IF motor running... - { - if (m_p_vol_ram[0x84] == 0x00) // IF jump scroll - return 0; - } -*/ - m_crtc->palette_select(m_inp9->read()); - - if (m_SCREEN_BLANK) - m_crtc->video_blanking(bitmap, cliprect); - else - m_crtc->video_update(bitmap, cliprect); - return 0; -} - -// Interrupt handling and arbitration. See 3.1.3.8 OF PC-100 spec. -void rainbow_state::update_8088_irqs() -{ - static const int vectors[] = { 0x27, 0x26, 0x25, 0x20 }; - - if (m_irq_mask != 0) - { - for (int i = 0; i < IRQ_8088_NMI; i++) - { - if (m_irq_mask & (1 << i)) - { - m_i8088->set_input_line_and_vector(INPUT_LINE_INT0, ASSERT_LINE, vectors[i] | m_irq_high); - break; - } - } - } - else - { - m_i8088->set_input_line(INPUT_LINE_INT0, CLEAR_LINE); - } -} - -void rainbow_state::raise_8088_irq(int ref) -{ - m_irq_mask |= (1 << ref); - update_8088_irqs(); -} - -void rainbow_state::lower_8088_irq(int ref) -{ - m_irq_mask &= ~(1 << ref); - update_8088_irqs(); -} - -// Only Z80 * private SRAM * is wait state free -// (= fast enough to allow proper I/O to the floppy) - -// Shared memory is contended by refresh, concurrent -// 8088 accesses and arbitration logic (DMA). -READ8_MEMBER(rainbow_state::share_z80_r) -{ - if (m_zflip) - { - if (offset < 0x8000) - { - return m_shared[offset + 0x8000]; - } - else if (offset < 0x8800) - { - return m_z80_private[offset & 0x7ff]; // SRAM - } - - return m_shared[offset ^ 0x8000]; - } - else - { - if (offset < 0x800) - { - return m_z80_private[offset]; // SRAM - } - - return m_shared[offset]; - } -} - -WRITE8_MEMBER(rainbow_state::share_z80_w) -{ - if (m_zflip) - { - if (offset < 0x8000) - { - m_shared[offset + 0x8000] = data; - return; // [!] - } - else if (offset < 0x8800) - { - m_z80_private[offset & 0x7ff] = data; // SRAM - return; // [!] - } - - m_shared[offset ^ 0x8000] = data; - } - else - { - if (offset < 0x800) - m_z80_private[offset] = data; // SRAM - else - m_shared[offset] = data; - } - return; -} - - -// ------------------------ClikClok (for model B; DS1315) --------------------------------- -#define RTC_RESET_MACRO m_rtc->chip_reset(); \ - UINT8 *rom = memregion("maincpu")->base(); - -#define RTC_ENABLE_MACRO \ - if (m_inp11->read() == 0x01) \ - { \ - if (offset & 1) \ - m_rtc->read_1(space, 0); \ - else \ - m_rtc->read_0(space, 0); \ - } \ - UINT8 *rom = memregion("maincpu")->base(); - -#define RTC_READ_MACRO \ - if (m_rtc->chip_enable() && (m_inp11->read() == 0x01)) \ - return (m_rtc->read_data(space, 0) & 0x01); \ - UINT8 *rom = memregion("maincpu")->base(); - -// *********** RTC RESET ************** -READ8_MEMBER(rainbow_state::rtc_reset) -{ - RTC_RESET_MACRO - return rom[RTC_RESET]; -} - -READ8_MEMBER(rainbow_state::rtc_reset2) -{ - RTC_RESET_MACRO - return rom[RTC_RESET + 0x2000]; -} - -// *********** RTC ENABLE ************** -READ8_MEMBER(rainbow_state::rtc_enable) -{ - RTC_ENABLE_MACRO - return rom[RTC_PATTERN_0 + offset]; -} - -READ8_MEMBER(rainbow_state::rtc_enable2) -{ - RTC_ENABLE_MACRO - return rom[RTC_PATTERN_0 + offset + 0x2000]; -} - -// ** READ single bit from RTC (or ROM) ** -READ8_MEMBER(rainbow_state::rtc_r) -{ - RTC_READ_MACRO - return rom[RTC_READ_DATA]; -} - -READ8_MEMBER(rainbow_state::rtc_r2) -{ - RTC_READ_MACRO - return rom[RTC_READ_DATA + 0x2000]; -} - -// Transfer data to DS1315 (read operation; data in offset): -// (always return ROM char to prevent potential IRQ issues) -READ8_MEMBER(rainbow_state::rtc_w) -{ - if (m_rtc->chip_enable() && (m_inp11->read() == 0x01)) - m_rtc->write_data(space, offset & 0x01); - - UINT8 *rom = memregion("maincpu")->base(); - return rom[RTC_WRITE_DATA_0 + offset]; -} -// ------------------------/ ClikClok (for model B; DS1315) --------------------------------- - - -// ---------------------------- RD51 HARD DISK CONTROLLER ---------------------------------- -static const int SECTOR_SIZES[4] = { 256, 512, 1024, 128 }; - -#define RD51_MAX_HEAD 8 -#define RD51_MAX_CYLINDER 1024 -#define RD51_SECTORS_PER_TRACK 16 - -void rainbow_state::hdc_reset() -{ -// printf(">> HARD DISC CONTROLLER RESET <<\n"); - logerror(">> HARD DISC CONTROLLER RESET <<\n"); - - m_hdc->reset(); // NEW HDC - - m_bdl_irq = 0; - update_bundle_irq(); // reset INTRQ - - m_hdc_buf_offset = 0; - m_hdc_direction = 0; - - m_hdc->buffer_ready(false); - m_hdc_write_gate = false; - - m_hdc_step_latch = false; - m_hdc_index_latch = false; - - m_hdc_track0 = true; // set true to avoid stepping -} - -// Return 'hard_disk_file' object for harddisk 1 (fixed). -// < NULL if geometry is insane or other errors occured > -hard_disk_file *(rainbow_state::rainbow_hdc_file(int drv)) -{ - m_hdc_drive_ready = false; - - if (m_inp5->read() != 0x01) // ...PRESENT? - return NULL; - - if (drv != 0) - return NULL; - - harddisk_image_device *img = NULL; - img = dynamic_cast(machine().device(subtag("harddisk1").c_str())); - - if (!img) - return NULL; - - if (!img->exists()) - return NULL; - - hard_disk_file *file = img->get_hard_disk_file(); - hard_disk_info *info = hard_disk_get_info(file); - - // ALWAYS 16 SECTORS / TRACK. - // CYLINDERS: 151 (~ 5 MB) to 1024 (max. cylinders on WD1010 controller) - if (((info->sectors == RD51_SECTORS_PER_TRACK)) && - ((info->heads >= 1) && (info->heads <= RD51_MAX_HEAD)) && // HEADS WITHIN 1...8 - ((info->cylinders > 150) && (info->cylinders <= RD51_MAX_CYLINDER)) - ) - { - m_hdc_drive_ready = true; - return file; // HAS SANE GEOMETRY - } - else - { - UINT32 max_sector = info->cylinders * info->heads * info->sectors; - printf("%u MB HARD DISK: HEADS (1..8 OK) = %d / CYL. (151..1024 OK) = %d / SPT. (16 OK) = %d / SECTOR_BYTES (128..1024 OK) = %d\n", max_sector * 512 / 1000000, - info->heads, info->cylinders, info->sectors, info->sectorbytes); - - printf("\n <<< === REJECTED = (SANITY CHECK FAILED) === >>> \n"); - return NULL; - } -} - -// LBA sector from CHS -static UINT32 get_and_print_lbasector(hard_disk_info *info, UINT16 cylinder, UINT8 head, UINT8 sector_number) -{ - if (info == NULL) - return 0; - - // LBA_ADDRESS = (C * HEADS + H) * NUMBER_SECTORS + (S - 1) - UINT32 lbasector = (double)cylinder * info->heads; // LBA : ( x 4 ) - lbasector += head; - lbasector *= info->sectors; // LBA : ( x 16 ) - lbasector += (sector_number - 1); // + (sector number - 1) - - logerror(" CYLINDER %u - HEAD %u - SECTOR NUMBER %u (LBA-SECTOR %u) ", cylinder, head, sector_number, lbasector); - return lbasector; -} - -// READ SECTOR (on BCS 1 -> 0 transition) -WRITE_LINE_MEMBER(rainbow_state::hdc_read_sector) -{ - static int last_state; - int read_status = 1; - - if (!m_hdc_write_gate) // do not read when WRITE GATE is on - { - UINT8 SDH = (m_hdc->read(space(AS_PROGRAM), 0x06)); - int drv = (SDH & (8 + 16)) >> 3; // get DRIVE from SDH register - - if ( (state == 0) && (last_state == 1) && (drv == 0) ) - { - read_status = 2; - - logerror("\nTRYING TO READ"); - output_set_value("led1", 0); - - int hi = (m_hdc->read(space(AS_PROGRAM), 0x05)) & 0x07; - UINT16 cylinder = (m_hdc->read(space(AS_PROGRAM), 0x04)) | (hi << 8); - UINT8 sector_number = m_hdc->read(space(AS_PROGRAM), 0x03); - - hard_disk_file *local_hard_disk; - local_hard_disk = rainbow_hdc_file(0); // one hard disk for now. - - if (local_hard_disk) - { - read_status = 3; - - hard_disk_info *info; - if ( (info = hard_disk_get_info(local_hard_disk)) ) - { - read_status = 4; - output_set_value("led1", 1); - - // Pointer to info + C + H + S - UINT32 lbasector = get_and_print_lbasector(info, cylinder, SDH & 0x07, sector_number); - - if ((cylinder <= info->cylinders) && // filter invalid ranges - (SECTOR_SIZES[(SDH >> 5) & 0x03] == info->sectorbytes) // may not vary in image! - ) - { - read_status = 5; - if( hard_disk_read(local_hard_disk, lbasector, m_hdc_buffer) ) // accepts LBA sector (UINT32) ! - { - read_status = 0; - logerror("...success!\n"); - } - } - } - m_hdc_buf_offset = 0; - m_hdc->buffer_ready(true); - } // if valid (..) - - if (read_status != 0) - { - logerror("...** READ FAILED WITH STATUS %u ** (CYLINDER %u - HEAD %u - SECTOR # %u - SECTOR_SIZE %u ) ***\n", - read_status, cylinder, SDH & 0x07, sector_number, SECTOR_SIZES[(SDH >> 5) & 0x03] - ) ; - } - - } // (on BCS 1 -> 0) - - } // do not read when WRITE GATE is on - - last_state = state; -} - - -// WRITE SECTOR -// ...IF WRITE_GATE (WG) TRANSITS FROM 1 -> 0 - -// NO PROVISIONS for sector sizes != 512 or MULTIPLE DRIVES (> 0) !!! -WRITE_LINE_MEMBER(rainbow_state::hdc_write_sector) -{ - int success = 0; - static int wg_last; - - if (state == 0) - m_hdc_write_gate = false; - else - m_hdc_write_gate = true; - - int drv = ((m_hdc->read(space(AS_PROGRAM), 0x06)) & (8 + 16)) >> 3; // get DRIVE from SDH register - - if (((state == 0) && (wg_last == 1)) // Check correct state transition and DRIVE 0 .... - && (drv == 0) - ) - { - output_set_value("led1", 0); // (1 = OFF ) =HARD DISK ACTIVITY = - MOTOR_DISABLE_counter = 20; - - if (rainbow_hdc_file(0) != NULL) - { - success = do_write_sector(); - if (success < 88) - logerror("! SECTOR WRITE (or FORMAT) FAULT ! ERROR CODE %i.\n", success); - - m_hdc_buf_offset = 0; - m_hdc->buffer_ready(false); - } - - // CHD WRITE FAILURES or UNMOUNTED HARDDSIK TRIGGER A PERMANENT ERROR. - if (success < 50) - m_hdc_write_fault = true; // reset only by HDC RESET! - } - - wg_last = state; // remember state -} - - -// Initiated by 'hdc_write_sector' (below) -// - in turn invoked by a WG: 1 -> 0 transit. -// STATUS CODES: -// 0 = DEFAULT ERROR (no HARD DISK FILE ?) -// 10 = CHD WRITE FAILURE (?) - -// 50 = SANITY CHECK FAILED (cylinder limit / <> 512 sectors?) - -// 88 = (LOW LEVEL) WRITE/FORMAT (sector_count != 1 IGNORED) -// 99 = SUCCESS : SECTOR WRITTEN - -// * RELIES * ON THE FACT THAT THERE WILL BE NO MULTI SECTOR TRANSFERS (!) -int rainbow_state::do_write_sector() -{ - int feedback = 0; // no error - output_set_value("led1", 0); // ON - - hard_disk_file *local_hard_disk; - local_hard_disk = rainbow_hdc_file(0); // one hard disk for now. - - if (local_hard_disk) - { - hard_disk_info *info; - if ( (info = hard_disk_get_info(local_hard_disk)) ) - { - feedback = 10; - logerror("\n* TRYING TO WRITE * "); - output_set_value("led1", 1); // OFF - - UINT8 SDH = (m_hdc->read(space(AS_PROGRAM), 0x06)); - - int hi = (m_hdc->read(space(AS_PROGRAM), 0x05)) & 0x07; - UINT16 cylinder = (m_hdc->read(space(AS_PROGRAM), 0x04)) | (hi << 8); - - int sector_number = m_hdc->read(space(AS_PROGRAM), 0x03); - int sector_count = m_hdc->read(space(AS_PROGRAM), 0x02); // (1 = single sector) - - if (!((cylinder <= info->cylinders) && // filter invalid cylinders - (SECTOR_SIZES[(SDH >> 5) & 0x03] == info->sectorbytes) // 512, may not vary - )) - { - logerror("...*** SANITY CHECK FAILED (CYLINDER %u vs. info->cylinders %u - - SECTOR_SIZE %u vs. info->sectorbytes %u) ***\n", - cylinder, info->cylinders, SECTOR_SIZES[(SDH >> 5) & 0x03], info->sectorbytes - ); - return 50; - } - // Pointer to info + C + H + S - UINT32 lbasector = get_and_print_lbasector(info, cylinder, SDH & 0x07, sector_number); - - if (sector_count != 1) // ignore all SECTOR_COUNTS != 1 - { - logerror(" - ** IGNORED (SECTOR_COUNT !=1) **\n"); - return 88; // BAIL OUT - } - - if (hard_disk_write(local_hard_disk, lbasector, m_hdc_buffer)) // accepts LBA sector (UINT32) ! - { - logerror("...success! ****\n"); - feedback = 99; - } - else - { - logerror("...FAILURE **** \n"); - } - - } // IF 'info' not NULL - } // IF hard disk present - - return feedback; -} - - - -READ8_MEMBER(rainbow_state::hd_status_60_r) -{ - int data = m_hdc_buffer[m_hdc_buf_offset]; - //logerror("HARD DISK DISK BUFFER: READ offset %04x | data = %02x\n", m_hdc_buf_offset, data); // ! DO NOT CHANGE ORDER ! - - m_hdc_buf_offset = (m_hdc_buf_offset + 1); - if (m_hdc_buf_offset >= 1024) // 1 K enforced by controller - { - m_hdc_buf_offset = 0; - m_hdc->buffer_ready(true); - } - return data; -} - -WRITE8_MEMBER(rainbow_state::hd_status_60_w) -{ - //logerror("HARD DISK BUFFER: WRITE offset %04x | data = %02x\n", m_hdc_buf_offset, data); - - m_hdc_buffer[m_hdc_buf_offset] = data; - m_hdc_buf_offset = (m_hdc_buf_offset + 1); - - if (m_hdc_buf_offset >= 1024) // 1 K enforced by controller - { - m_hdc_buf_offset = 0; - m_hdc->buffer_ready(true); - } -} - - -// Secondary Command / Status Registers(68H) is... -// (A) a write - only register for commands -// (B) a read - only register for status signals -// Holds the status of the following signals: -// - 3 hard-wired controller module identification bits. -// - signals from the WD1010 chip, -// - disk drive(latched status signals) -READ8_MEMBER(rainbow_state::hd_status_68_r) -{ - // (*) Bits 5-7 : HARD WIRED IDENTIFICATION BITS, bits 5+7 = 1 and bit 6 = 0 (= 101 f?r RD51 module) - int data = 0xe0; // 111 gives DRIVE NOT READY (when W is pressed on boot screen) - if ((m_inp5->read() == 0x01) && (rainbow_hdc_file(0) != NULL)) - data = 0xa0; // A0 : OK, DRIVE IS READY (!) - - int my_offset = 0x07; - int stat = m_hdc->read(space, my_offset); - logerror("(x68) WD1010 register %04x (STATUS) read, result : %04x\n", my_offset, stat); - - // NOTE: SEEK COMPLETE IS CURRENTLY HARD WIRED / NOT FULLY EMULATED - - // Bit 4 : SEEK COMPLETE: This status bit indicates that the disk drive positioned the R/W heads over the desired track on the disk surface. - - // (ALT.TEXT): "Seek Complete - When this signal from the disk drive goes low(0), it indicates that the R /W heads settled on the correct track. - // Writing is inhibited until this signal goes low(0). Seek complete is high(1) during normal seek operation. - if (stat & 16) // SEEK COMPLETE (bit 4)? - data |= 16; - - // Bit 3 : DIRECTION : This bit indicates the direction the read/write heads in the disk - // drive will move when the WD1010 chip issues step pulse(s). When high(1), the R / W heads will move toward the spindle. - // When low (0), the heads will move away from the spindle, towards track O. - if (m_hdc_direction) - data |= 8; - - // Bit 2 : LATCHED STEP PULSE: This status bit from the step pulse latch indicates if the WD1010 - // chip issued a step pulse since the last time the 8088 processor cleared the step pulse latch. - if (m_hdc_step_latch) - data |= 4; - - // Bit 1 : LATCHED INDEX : This status bit from the index latch indicates if the disk drive - // encountered an index mark since the last time the 8088 processor cleared the index latch. - if (m_hdc_index_latch) - data |= 2; - - // Bit 0 : CTRL BUSY : indicates that the WD 1010 chip is accessing the sector buffer. When this bit is set, - // the 8088 cannot access the WD 1010 registers. - if (stat & 128) // BUSY (bit 7)? - data |= 1; - - return data; -} - - -// 68 (WRITE): Secondary Command Registers (68H) - - ERKL?RUNG: "write-only register for commands" -// - see TABLE 4.8 (4-24) -WRITE8_MEMBER(rainbow_state::hd_status_68_w) -{ - // Bit 4-7 : --- not used / reserved - - // Bit 3 : CLEAR STEP LATCH : This bit BAD<3>H clears out the step pulse latch. The step pulse - //latch is set every time the WD1010 chip issues a step pulse.The output of the step pulse latch is sent to the secondary status register. - if (data & 0x08) - m_hdc_step_latch = false; - - // Bit 2 : CLEAR INDEX LATCH : This bit BAD<2>H clears out the index latch. The index latch is - //set when the disk drive senses the index position on the disk.The index latch output is sent to the secondary status register. - if (data & 0x04) - m_hdc_index_latch = false; - - // * Bit 1 : SOFTWARE INITIALIZE: The BADH bit sets this bit. This bit, when set, initializes the - // controller. The controller cannot be accessed for 7 microseconds(us) after the 8088 issues the software initialize. - if (data & 0x02) - hdc_reset(); - - // * Bit 0 : SET BUFFER READY : READ SECTOR command: this bit, when set, tells the WDI010 chip that the sector buffer was emptied which would then end the - // command. WRITE SECTOR / FORMAT CMD: bit tells the WD1010 that the sector buffer now contains valid data for transfer to the disk drive. - - // * SET BY BIOS: 2 : (WD1010 IRQ based transfer operation?) @ 0810 - // 1 : see @ 088D after 'READ_SECTOR_OK' - if (data & 0x01) - { - logerror(">> HARD DISC * SET BUFFER READY * <<\n"); - - output_set_value("led1", 0); // 1 = OFF (One of the CPU LEDs as DRIVE LED) = HARD DISK ACTIVITY = - MOTOR_DISABLE_counter = 20; - - m_hdc->buffer_ready(true); - } -} - - -/* -/ READ ONLY REGISTER (HEX 69) - -The drive status register at I/O address 69H is a read-only register -that monitors the status of control and error signals to/from the disk drive. - -0 Drive Select - high (1) indicates that the controller module is selecting the drive. - -1-3 Head Select - These 3 bits are the binary head address of the R/W head -selected for the current read/write operation. The RD51 drive has 4 heads. - -4 Write Gate - The WDlOI0 chip asserts this bit high (1) to inform the 8088 of -data being written on the disk. Signal also enables write current in disk drive. - -5 Drive Write Fault - The disk drive asserts this bit high (1) to indicate that a condition -exists at the drive that may cause improper writing on the disk. -Inhibits further writing until the error is corrected (.. until RESET?) [Bavarese] - -6 Drive Ready - When the disk drive together with SEEK COMPLETE asserts this -bit high (1), it indicates that the drive is ready to read, write, or -seek. When this bit is low (0), all reading, writing, and seeking are -inhibited. - -7 Track 0 - The disk drive sets this bit high (1) when the R/W heads are -positioned over cylinder 0 (the data track furthest away from the spindle). -*/ -READ8_MEMBER(rainbow_state::hd_status_69_r) -{ - int HS = m_hdc->read(space, 0x06) & (1 + 2 + 4); // SDH bits 0-2 = HEAD # - logerror("(x69 READ) %i = HEAD SELECT WD1010\n", HS); - - UINT8 data = (HS << 1); - - // DRIVE SELECT: 2 bits in SDH register of WDx010 could address 4 drives. - // External circuit supports 1 drive here (DRIVE 0 selected or deselected) - int DRV = ((m_hdc->read(space, 0x06) >> 3) & 0x01); // 0x03 gives error R6 with DIAG.DISK - if (DRV == 0) - { - logerror("(x69 READ) %i = _DRIVE # 0_ SELECT! \n", DRV); - data |= 1; - } - - if (m_hdc_write_gate) // WRITE GATE (cached here) - data |= 16; - - if (m_hdc_write_fault) - data |= 32; - - if (m_hdc_drive_ready) - data |= 64; - - // Fake TRACK 0 signal (normally FROM DRIVE) - m_hdc_track0 = false; // Set a default - - int stat1 = m_hdc->read(space, 0x04); // CYL LO - int stat2 = m_hdc->read(space, 0x05); // CYL HI - if ((stat1 == 0) && (stat2 == 0)) - m_hdc_track0 = true; - - if (m_hdc_track0) - { - data |= 128; - logerror("(x69 READ) TRACK 00 detected\n"); - } - - return data; -} - -// TREAT SIGNALS FROM / TO CONTROLLER -WRITE_LINE_MEMBER(rainbow_state::hdc_step) -{ - m_hdc_step_latch = true; - - output_set_value("led1", 0); // 1 = OFF (One of the CPU LEDs as DRIVE LED) = HARD DISK ACTIVITY = - MOTOR_DISABLE_counter = 20; -} - -WRITE_LINE_MEMBER(rainbow_state::hdc_direction) -{ - m_hdc_direction = state; // (0 = OUT) -} - -READ_LINE_MEMBER(rainbow_state::hdc_drive_ready) -{ - return m_hdc_drive_ready; -} - -READ_LINE_MEMBER(rainbow_state::hdc_write_fault) -{ - return m_hdc_write_fault; -} - -// Buffer counter reset when BCR goes from 0 -> 1 -WRITE_LINE_MEMBER(rainbow_state::hdc_bcr) -{ - static int bcr_state; - if ((bcr_state == 0) && (state == 1)) - hdc_buffer_counter_reset(); - bcr_state = state; -} - -void rainbow_state::hdc_buffer_counter_reset() -{ - m_hdc->buffer_ready(false); - m_hdc_buf_offset = 0; -} - -// DATA REQUEST - When high (..) initiates data transfers -// to or from the sector buffer. On a READ, this signal -// goes high AFTER the sector buffer is filled. - -// On a WRITE / FORMAT command, signal goes high when the WD1010 -// chip is READY TO ACCESS the information in the sector buffer. -WRITE_LINE_MEMBER(rainbow_state::hdc_bdrq) -{ - static int old_state; - - logerror("BDRQ - BUFFER DATA REQUEST OBTAINED: %u\n", state); - if ((state == 1) && (old_state == 0)) - { - hdc_buffer_counter_reset(); - - m_bdl_irq = state; - update_bundle_irq(); // TRIGGER AN INTERRUPT - } - old_state = state; -} -// ---------------------------- / RD51 HARD DISK CONTROLLER ---------------------------------- - - -// IRQ service for both RD51 and COMM. OPTION -void rainbow_state::update_bundle_irq() -{ - if (m_bdl_irq == 0) - { - lower_8088_irq(IRQ_BDL_INTR_L); - - if (m_inp5->read() == 0x01) - hdc_buffer_counter_reset(); - } - else - { - raise_8088_irq(IRQ_BDL_INTR_L); - } -} - -WRITE_LINE_MEMBER(rainbow_state::bundle_irq) -{ - m_bdl_irq = state; - update_bundle_irq(); -} - - - -READ8_MEMBER(rainbow_state::system_parameter_r) -{ -#ifdef FORCE_RAINBOW_B_LOGO - - // WORKAROUND: Initialize NVRAM + VOLATILE RAM with DEFAULTS + correct RAM SIZE ! - int test = (m_inp8->read() >> 16) - 2; // 0 = 128 K (!) - if (test >= 0) - { - m_p_vol_ram[0xdb] = test; - m_p_nvram[0xdb] = test; - } - - // NVRAM @ 0x89 : AUTO RPT(0 = OFF 1 = ON) - m_p_nvram[0x89] = 0; // AUTO REPEAT ON (1 would be DETRIMENTAL TO "SET-UP" (80/132 + 50/60 Hz) with KEYBOARD_WORKAROUND (!) -#endif - - - /* Info about option boards is in bits 0 - 3: - SYSTEM PARAMETER INFORMATION: see AA-P308A-TV page 92 section 14.0 - Bundle card (1) | Floppy (2) | Graphics (4) | Memory option (8) - 0 1 2 3 4 5 6 7 - B F G M - (bit SET means NOT present; 4-7 reserved ) - - B : no separation between the 2 available 'bundle cards' (HD controller / COMM.OPTION) ? - - M : old RAM extension (128 / 192 K ?) detected with OPTION_PRESENT bit, newer models 'by presence'. - BIOS uses a seperate IRQ vector for RAM board detection (at least on a 100-B). - */ - return (((m_inp5->read() == 1) ? 0 : 1) | - ((m_inp6->read() == 1) ? 0 : 2) | - ((m_inp7->read() == 1) ? 0 : 4) | - ((m_inp8->read() > BOARD_RAM) ? 0 : 8) - // 16 | 32 | 64 | 128 // to be verified. - ); -} - -READ8_MEMBER(rainbow_state::comm_control_r) -{ - /* [02] COMMUNICATIONS STATUS REGISTER - PAGE 154 (**** READ **** ) - Used to read status of SERIAL port, IRQ line of each CPU, and MHFU logic enable signal. - - // What the specs says on how MHFU detection is disabled: - // 1. by first disabling interrupts with CLI - // 2. by writing 0x00 to port 0x10C (handled by a 8088 write handler) - // MHFU is re-enabled by writing to 0x0c (or 'automatically after STI') <-- when under BIOS control ? - */ - int data = 0; - if (COLD_BOOT == 2) - data = 0; // During boot phase 2, never enable MHFU (prevents errors). - else - { - data = m_crtc->MHFU(1); - } - return (((data) ? 0x00 : 0x20) | // // (L) status of MHFU flag => bit pos.5 - ((INT88) ? 0x00 : 0x40) | // (L) - ((INTZ80) ? 0x00 : 0x80) // (L) - ); -} - -WRITE8_MEMBER(rainbow_state::comm_control_w) -{ - /* Communication control register of -COMM- port (when written): - - 8088 LEDs: - 5 7 6 4 <- BIT POSITION - D6 -D5-D4-D3 <- INTERNAL LED NUMBER (DEC PDF) - -4--5--6--7- <- NUMBERS EMBOSSED ON BACK OF PLASTIC HOUSING (see error chart) - */ - output_set_value("led4", BIT(data, 5)); // LED "D6" - output_set_value("led5", BIT(data, 7)); // LED "D5" - output_set_value("led6", BIT(data, 6)); // LED "D4" - output_set_value("led7", BIT(data, 4)); // LED "D3" - - // printf("%02x to COMM.CONTROL REGISTER\n", data); -} - - - -// 8088 writes to port 0x00 (interrupts Z80) -// See page 133 (4-34) -WRITE8_MEMBER(rainbow_state::i8088_latch_w) -{ - // printf("%02x to Z80 mailbox\n", data); - - // The interrupt vector address(F7H) placed on the bus is hardwired into the Z80A interrupt vector encoder. - // The F7H interrupt vector address causes the Z80A processor to perform an RST 30 instruction in - // interrupt mode 0 - m_z80->set_input_line_and_vector(0, ASSERT_LINE, 0xf7); - m_z80_mailbox = data; - - INTZ80 = true; // -} - -// Z80 reads port 0x00 -// See page 134 (4-35) -READ8_MEMBER(rainbow_state::z80_latch_r) -{ - // printf("Read %02x from Z80 mailbox\n", m_z80_mailbox); - m_z80->set_input_line(0, CLEAR_LINE); - - INTZ80 = false; - return m_z80_mailbox; -} - -// Z80 writes to port 0x00 (interrupts 8088) -// See page 134 (4-35) -WRITE8_MEMBER(rainbow_state::z80_latch_w) -{ - // printf("%02x to 8088 mailbox\n", data); - raise_8088_irq(IRQ_8088_MAILBOX); - m_8088_mailbox = data; - - INT88 = true; -} - -// 8088 reads port 0x00. See page 133 (4-34) -READ8_MEMBER(rainbow_state::i8088_latch_r) -{ - // printf("Read %02x from 8088 mailbox\n", m_8088_mailbox); - lower_8088_irq(IRQ_8088_MAILBOX); - - INT88 = false; - return m_8088_mailbox; -} - -// (Z80) : WRITE to 0x20 -WRITE8_MEMBER(rainbow_state::z80_diskdiag_read_w) -{ - m_zflip = true; -} - -// (Z80) : PORT 21H * WRITE * -WRITE8_MEMBER(rainbow_state::z80_diskdiag_write_w) -{ - /* Z80 LEDs: - 4 5 6 <- bit # - D11 D10 -D9 <- INTERNAL LED NUMBER (see PDF) - -1 --2-- 3 <- NUMBERS EMBOSSED ON BACK OF PLASTIC HOUSING (see error chart) - */ - output_set_value("led1", BIT(data, 4)); // LED "D11" - output_set_value("led2", BIT(data, 5)); // LED "D10" - output_set_value("led3", BIT(data, 6)); // LED "D9" - - m_zflip = false; -} - -// (Z80) : PORT 21H _READ_ -READ8_MEMBER(rainbow_state::z80_generalstat_r) -{ - /* - General / diag.status register Z80 / see page 157 (table 4-18). - ---- BITS FROM RX50 CONTROLLER CARD: - D7 : STEP L : reflects status of STEP signal _FROM FDC_ - (when this 2us output pulse is low, the stepper will move into DIR) - D6 : WRITE GATE L :reflects status of WRITE GATE signal _FROM FDC_ - (asserted low before data can be written on the diskette) - D5 : TR00: reflects status of TRACK 0 signal (= 1) * from the disk drive * - D4 : DIR L: reflects status of DIRECTION signal * FROM FDC * to disk - (when low, the head will step towards the center) - D3 : READY L: reflects status of READY L signal * from the disk drive * - (low active, asserts when disk is inserted and door is closed) - ---- BITS BELOW FROM MAINBOARD: - D2 : INT88 L: (bit reads the INT88 bit sent by Z80 to interrupt 8088) - D1 : INTZ80 L: (bit reads the INTZ80 bit sent by 8088 to interrupt Z80) - D0 : ZFLIP L: (read from the diagnostic control register of Z80A) - */ - static int last_track; - - int track = 0; - int fdc_step = 0; - int fdc_ready = 0; - int tk00 = 0; - int fdc_write_gate = 0; - int last_dir = 0; - - printf("\nFLOPPY %02d - ", m_unit); // TEST-DEBUG - - // Attempt to block invalid accesses - if (m_unit != INVALID_DRIVE) - { - track = m_fdc->track_r(space, 0); - if (track != last_track) - fdc_step = 1; // calculate STEP (sic) - last_track = track; - - if (!m_floppy->ready_r()) // weird (see wd_fdc) - fdc_ready = 1; - - if (fdc_ready) - fdc_write_gate = 1; // * FAKE * WRITE GATE ! - - // "valid only when drive is selected" ! - if (!m_floppy->trk00_r()) // weird (see wd_fdc) - tk00 = 1; - - if (last_track > track) - last_dir = 1; // correct? - else - last_dir = 0; - - if (fdc_ready == 1) - printf(" RDY:1 "); // TEST-DEBUG - else - printf(" RDY:0 "); // TEST-DEBUG - - if (fdc_step == 1) - printf(" STP:1 "); // TEST-DEBUG - else - printf(" STP:0 "); // TEST-DEBUG - - if (tk00 == 0) - printf(" TK00=0 "); // TEST-DEBUG - else - printf(" TK00=1 "); // TEST-DEBUG - - } - - int data = ( - ((fdc_step) ? 0x00 : 0x80) | - ((fdc_write_gate) ? 0x00 : 0x40) | - ((tk00) ? 0x20 : 0x00) | // ***** ALL LOW ACTIVE - EXCEPT tk00 : - ((last_dir) ? 0x00 : 0x10) | - ((fdc_ready) ? 0x00 : 0x08) | - ((INT88) ? 0x00 : 0x04) | - ((INTZ80) ? 0x00 : 0x02) | - ((m_zflip) ? 0x00 : 0x01) - ); - - return data; -} - - - -// (Z80) : PORT 40H _READ_ -// 40H diskette status Register **** READ ONLY *** ( 4-60 of TM100.pdf ) -READ8_MEMBER(rainbow_state::z80_diskstatus_r) -{ - int track = 0; - - // AND 00111011 - return what was WRITTEN to D5-D3, D1, D0 previously - // (except D7,D6,D2) - int data = m_z80_diskcontrol & 0x3b; - - // -DOES NOT WORK HERE- Attempt to block invalid accesses - if (m_unit != INVALID_DRIVE) - { - // D7: DRQ: reflects status of DATA REQUEST signal from FDC. - // '1' indicates that FDC has read data OR requires new write data. - data |= m_fdc->drq_r() ? 0x80 : 0x00; - - // D6: IRQ: indicates INTERRUPT REQUEST signal from FDC. Indicates that a - // status bit has changed. Set to 1 at the completion of any - // command (.. see page 207 or 5-25). - data |= m_fdc->intrq_r() ? 0x40 : 0x00; - - // D5: SIDE 0H: status of side select signal at J2 + J3 of RX50 controller. - // For 1 sided drives, this bit will always read low (0). - - // D4: MOTOR 1 ON L: 0 = indicates MOTOR 1 ON bit is set in drive control reg. - // D3: MOTOR 0 ON L: 0 = indicates MOTOR 0 ON bit is set in drive " - - track = m_fdc->track_r(space, 0); - - // Print HEX track number - static UINT8 bcd2hex[] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71 }; - // 0...9 ,A (0x77), b (0x7c), C (0x39) , d (0x5e), E (0x79), F (0x71) - output_set_digit_value(0, bcd2hex[(track >> 4) & 0x0f]); - output_set_digit_value(1, bcd2hex[(track - ((track >> 4) << 4)) & 0x0f]); - } - - // D2: TG43 L : 0 = INDICATES TRACK > 43 SIGNAL FROM FDC TO DISK DRIVE. - if (track > 43) - data = data & (255 - 4); - else - data = data | 4; - - // D1: DS1 H: reflect status of bits 0 and 1 form disk.control reg. - // D0: DS0 H: " - return data; -} - -// (Z80) : PORT 40H * WRITE * -// NOTE: routine will accept invalid drive letters... -WRITE8_MEMBER(rainbow_state::z80_diskcontrol_w) -{ - int selected_drive = INVALID_DRIVE; - static const char *names[] = { FD1793_TAG ":0", FD1793_TAG ":1", FD1793_TAG ":2", FD1793_TAG ":3" }; - - int drive = 0; - if (m_inp10->read() && ((data & 3) < 2)) - drive = (data & 1) + 2; - else - drive = data & 3; - - floppy_connector *con = NULL; - if (drive < MAX_FLOPPIES) - con = machine().device(names[drive]); - - if (con) - { - m_floppy = con->get_device(); - if (m_floppy) - selected_drive = drive; - //printf("%i <- SELECTED DRIVE...\n", m_unit); - } - - if (selected_drive == INVALID_DRIVE) - { - printf("(m_unit = %i) ** SELECTED DRIVE ** INVALID. (selected drive = %i)\n", m_unit, selected_drive); - m_unit = INVALID_DRIVE; - m_floppy = NULL; - } - - if (m_floppy != NULL) - { - m_fdc->set_floppy(m_floppy); // Sets new _image device_ - if (!m_floppy->exists()) - { - m_floppy = NULL; - printf("(m_unit = %i) SELECTED IMAGE *** DOES NOT EXIST *** (selected drive = %i)\n", m_unit, selected_drive); - selected_drive = INVALID_DRIVE; - //m_unit = INVALID_DRIVE; - } - else - { - m_floppy->ss_w((data & 20) ? 1 : 0); // RX50 board in Rainbow has 'side select' - m_floppy->set_rpm(300.); - } - } - - output_set_value("driveled0", (selected_drive == 0) ? 1 : 0); - output_set_value("driveled1", (selected_drive == 1) ? 1 : 0); - - output_set_value("driveled2", (selected_drive == 2) ? 1 : 0); - output_set_value("driveled3", (selected_drive == 3) ? 1 : 0); - - if (selected_drive < 4) - { - m_unit = selected_drive; - - if (MOTOR_DISABLE_counter == 0) // "one shot" - MOTOR_DISABLE_counter = 20; - - // FORCE_READY = 0 : assert DRIVE READY on FDC (diagnostic override; USED BY BIOS!) - bool force_ready = ((data & 4) == 0) ? true : false; - m_fdc->set_force_ready(force_ready); - } - - int enable_start = 0; - int disable_start = 2; // set defaults - - if (m_unit == INVALID_DRIVE) - { - printf("\n**** INVALID DRIVE ****"); - data = (data & (255 - 3)) | m_unit; - - data = data & (255 - 8); // MOTOR 0 OFF - data = data & (255 - 16); // MOTOR 1 OFF - } - else - { - data = (data & (255 - 3)) | m_unit; - - if (m_unit < 2) - { - data = data | 8; // MOTOR 0 (for A or B) - } - else - { - data = data | 16; // MOTOR 1 (for C or D) - enable_start = 2; - disable_start = 4; - } - - // RX-50 has head A and head B (1 for each of the 2 disk slots in a RX-50). - // Assume the other one is switched off - - for (int f_num = 0; f_num < MAX_FLOPPIES; f_num++) - { - floppy_connector *con = machine().device(names[f_num]); - floppy_image_device *tmp_floppy = con->get_device(); - - tmp_floppy->mon_w(ASSERT_LINE); - if ((f_num >= enable_start) && (f_num < disable_start)) - tmp_floppy->mon_w(CLEAR_LINE); // enable - } - - } - - m_z80_diskcontrol = data; -} -// --------- END OF Z80 -------------------- - -READ8_MEMBER(rainbow_state::read_video_ram_r) -{ - return m_p_ram[offset]; -} - - -// ************************************************** -// VIDEO INTERRUPT HANDLING -// ************************************************** - -INTERRUPT_GEN_MEMBER(rainbow_state::vblank_irq) -{ - raise_8088_irq(IRQ_8088_VBL); - m_crtc->notify_vblank(true); -} - - -WRITE_LINE_MEMBER(rainbow_state::clear_video_interrupt) -{ - lower_8088_irq(IRQ_8088_VBL); - m_crtc->notify_vblank(false); -} - -// Reflects bits from 'diagnostic_w', except test jumpers -READ8_MEMBER(rainbow_state::diagnostic_r) // 8088 (port 0A READ). Fig.4-29 + table 4-15 -{ - return ((m_diagnostic & (0xf1)) | // MASK 0xf1 = 11110001 - (m_inp1->read() | - m_inp2->read() | - m_inp3->read() - ) - ); -} - - -WRITE8_MEMBER(rainbow_state::diagnostic_w) // 8088 (port 0A WRITTEN). Fig.4-28 + table 4-15 -{ - // printf("%02x to diag port (PC=%x)\n", data, space.device().safe_pc()); - m_SCREEN_BLANK = (data & 2) ? false : true; - - // ZRESET (high at powerup) - if (!(data & 1)) - { - m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_z80_halted = true; - } - - if ((data & 1) && (m_z80_halted)) - { - m_zflip = true; - m_z80_halted = false; - - m_z80->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_z80->reset(); - } - - if ((m_diagnostic & 1) && !(data & 1)) - { - printf("\nFDC ** RESET **"); - m_fdc->reset(); - } - - if (!(m_diagnostic & 1) && (data & 1)) - { - printf("\nFDC RESTORE"); - m_fdc->soft_reset(); // See formatter description p.197 or 5-13 - } - - // MISSING BITS (* not vital for normal operation, see diag.disk) - - // BIT 2: GRF VID SEL (0 = system module; 1 = graphics option) - // BIT 3: PARITY TEST (1 = enables parity test on memory option board) - // * BIT 4: DIAG LOOPBACK (0 at power-up; 1 directs RX50 and DC12 output to printer port) - // * BIT 5: PORT LOOPBACK (1 enables loopback for COMM, PRINTER, KEYBOARD ports) - - /* 2.1.7.3 DIAGNOSTIC LOOPBACK Maintenance Bit - The DIAGNOSTIC LOOPBACK bit is a - maintenance bit that is cleared on power - up.This bit, when set to 1, - allows the floppy data separator and the serial video output to be tested - through the use of the printer port. The following table shows how signals are routed. - - DIAGNOSTIC LOOPBACK = 0 DIAGNOSTIC LOOPBACK = 1 SIGNAL INPUT - SIGNAL SOURCE SIGNAL SOURCE TO - FROM FROM - PRT RDATA(J2) VIDEO OUT PRT RXD(7201) - PRT RXTXC 500 KHZ PRT RXTXC(7201) - MASTER CLK 250 KHZ VIDEO CLK(DCO11) - FLOPPY RAW DATA PRT TXD(7201) FLOPPY DATA SEPARATOR - - During Diagnostic Loopback, the - TEST input of the 8088 is connected to the - interrupt output of the MPSC.Thus, using the 8088's WAIT instruction in a - polled I / O loop, the diagnostic firmware will be able to keep up with the - 500 Kb data rate on the MPSC. - */ - if (data & 16) - { - printf("\nWARNING: UNEMULATED DIAG LOOPBACK (directs RX50 and DC12 output to printer port) ****"); - } - - if (data & 32) - { - /* BIT 5: PORT LOOPBACK (1 enables loopback for COMM, PRINTER, KEYBOARD ports) - 2.1.7.2. of AA-V523A-TV (PDF Mar83) says how the signals are routed: - port_loopback_0 | port_loopback_1 SIGNAL INPUT TO - COMM RCV DATA.......COMM TXD..........COMM_RXD - PRT RCV DATA.......KBD TXD...........PRT RDATA - KBD RCV DATA.......PRT TXD...........KBD RXD - */ - printf("\nWARNING: UNEMULATED PORT LOOPBACK (COMM, PRINTER, KEYBOARD ports) ****"); - } - - // BIT 6: Transfer data from volatile memory to NVM (PROGRAM: 1 => 0 BIT 6) - if (!(data & 0x40) && (m_diagnostic & 0x40)) - memcpy(m_p_nvram, m_p_vol_ram, 256); - - // BIT 7: Transfer data from NVM to volatile memory (RECALL 0 => 1 BIT 7) - if ((data & 0x80) && !(m_diagnostic & 0x80)) - memcpy(m_p_vol_ram, m_p_nvram, 256); - - m_diagnostic = data; -} - - -// KEYBOARD -void rainbow_state::update_kbd_irq() -{ -#ifndef KEYBOARD_WORKAROUND - if ((m_kbd_rx_ready) || (m_kbd_tx_ready)) - { - raise_8088_irq(IRQ_8088_KBD); - } - else - { - lower_8088_irq(IRQ_8088_KBD); - } -#endif -} - -WRITE_LINE_MEMBER(rainbow_state::kbd_tx) -{ - // printf("%02x to keyboard\n", state); - m_lk201->rx_w(state); -} - -WRITE_LINE_MEMBER(rainbow_state::kbd_rxready_w) -{ - // printf("rxready %d\n", state); - m_kbd_rx_ready = (state == 1) ? true : false; - update_kbd_irq(); -} - -WRITE_LINE_MEMBER(rainbow_state::kbd_txready_w) -{ - // printf("8251 txready %d\n", state); - m_kbd_tx_ready = (state == 1) ? true : false; - update_kbd_irq(); -} - -WRITE_LINE_MEMBER(rainbow_state::write_keyboard_clock) -{ - m_kbd8251->write_txc(state); - m_kbd8251->write_rxc(state); -} - -TIMER_DEVICE_CALLBACK_MEMBER(rainbow_state::motor_tick) -{ - m_hdc_index_latch = true; // HDC drive index signal (not working ?) - - if (MOTOR_DISABLE_counter) - MOTOR_DISABLE_counter--; - - if (MOTOR_DISABLE_counter < 2) - { - output_set_value("driveled0", 0); // DRIVE 0 (A) - output_set_value("driveled1", 0); // DRIVE 1 (B) - output_set_value("driveled2", 0); // DRIVE 2 (C) - output_set_value("driveled3", 0); // DRIVE 3 (D) - - output_set_value("led1", 1); // 1 = OFF (One of the CPU LEDs as DRIVE LED) - } - - if (m_crtc->MHFU(1)) // MHFU * flag * enabled ? - { - int data = m_crtc->MHFU(-1); // increment MHFU, return new value - - // MHFU gets active if the 8088 has not acknowledged a video processor interrupt within approx. 108 milliseconds. - // Timer reset by 2 sources : the VERT INT L from the DC012, or the MHFU ENB L from the enable flip - flop. - - if ( data > 480 ) // longer than needed. Better than an instant "INTERRUPT 16" - { - for (int i = 0; i < 9; i++) - printf("\nWATCHDOG TRIPPED *** NOW RESET MACHINE ***\n"); - - m_crtc->MHFU(-100); // -100 : Enable MHFU flag - - if (m_inp12->read() == 0x01) // DIP for watchdog set? - { - COLD_BOOT = 0; // massive foulup (no recovery) - device().machine().schedule_soft_reset(); // FFFF:0 - } - } - } - - if (m_beep_counter > 0) - m_beep_counter--; -} - -// on 100-B, DTR from the keyboard 8051 controls bit 7 of IRQ vectors -WRITE_LINE_MEMBER(rainbow_state::irq_hi_w) -{ - m_irq_high = (state == ASSERT_LINE) ? 0x80 : 0; - //logerror("%i = m_irq_high\n", m_irq_high); -} - -/* F4 Character Displayer */ -static const gfx_layout rainbow_charlayout = -{ - 8, 10, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 15 * 8, 0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, 8 * 8 }, - 8 * 16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START(rainbow) -GFXDECODE_ENTRY("chargen", 0x0000, rainbow_charlayout, 0, 1) -GFXDECODE_END - - -static MACHINE_CONFIG_START(rainbow, rainbow_state) -MCFG_DEFAULT_LAYOUT(layout_rainbow) - -/* basic machine hardware */ -MCFG_CPU_ADD("maincpu", I8088, XTAL_24_0734MHz / 5) -MCFG_CPU_PROGRAM_MAP(rainbow8088_map) -MCFG_CPU_IO_MAP(rainbow8088_io) -MCFG_CPU_VBLANK_INT_DRIVER("screen", rainbow_state, vblank_irq) - -MCFG_CPU_ADD("subcpu", Z80, XTAL_24_0734MHz / 6) -MCFG_CPU_PROGRAM_MAP(rainbowz80_mem) -MCFG_CPU_IO_MAP(rainbowz80_io) - -/* video hardware */ -MCFG_SCREEN_ADD("screen", RASTER) -MCFG_SCREEN_REFRESH_RATE(60) -MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ -MCFG_SCREEN_SIZE(132 * 10, 49 * 10) -MCFG_SCREEN_VISIBLE_AREA(0, 80 * 10 - 1, 0, 48 * 10 - 1) -MCFG_SCREEN_UPDATE_DRIVER(rainbow_state, screen_update_rainbow) -MCFG_SCREEN_PALETTE("vt100_video:palette") -MCFG_GFXDECODE_ADD("gfxdecode", "vt100_video:palette", rainbow) - -MCFG_DEVICE_ADD("vt100_video", RAINBOW_VIDEO, 0) -MCFG_VT_SET_SCREEN("screen") -MCFG_VT_CHARGEN("chargen") -MCFG_VT_VIDEO_RAM_CALLBACK(READ8(rainbow_state, read_video_ram_r)) -MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(rainbow_state, clear_video_interrupt)) - -MCFG_FD1793_ADD(FD1793_TAG, XTAL_24_0734MHz / 24) // no separate 1 Mhz quartz -//MCFG_WD_FDC_FORCE_READY -MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":0", rainbow_floppies, "525qd0", rainbow_state::floppy_formats) -MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":1", rainbow_floppies, "525qd1", rainbow_state::floppy_formats) -MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":2", rainbow_floppies, "525qd2", rainbow_state::floppy_formats) -MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":3", rainbow_floppies, "525qd3", rainbow_state::floppy_formats) -MCFG_SOFTWARE_LIST_ADD("flop_list", "rainbow") - - -/// ********************************* HARD DISK CONTROLLER ***************************************** -MCFG_DEVICE_ADD("hdc", WD2010, 5000000) // 10 Mhz quartz on controller (divided by 2 for WCLK) -MCFG_WD2010_OUT_INTRQ_CB(WRITELINE(rainbow_state, bundle_irq)) // FIRST IRQ SOURCE (OR'ed with DRQ) -MCFG_WD2010_OUT_BDRQ_CB(WRITELINE(rainbow_state, hdc_bdrq)) // BUFFER DATA REQUEST - -// SIGNALS -FROM- WD CONTROLLER: -MCFG_WD2010_OUT_BCS_CB(WRITELINE(rainbow_state, hdc_read_sector)) // Problem: OUT_BCS_CB = WRITE8 ... (!) -MCFG_WD2010_OUT_BCR_CB(WRITELINE(rainbow_state, hdc_bcr)) // BUFFER COUNTER RESET (pulses) - -MCFG_WD2010_OUT_WG_CB(WRITELINE(rainbow_state, hdc_write_sector)) // WRITE GATE -MCFG_WD2010_OUT_STEP_CB(WRITELINE(rainbow_state, hdc_step)) // STEP PULSE -MCFG_WD2010_OUT_DIRIN_CB(WRITELINE(rainbow_state, hdc_direction)) - -MCFG_WD2010_IN_WF_CB(READLINE(rainbow_state, hdc_write_fault)) // WRITE FAULT (set to GND if not serviced) - -MCFG_WD2010_IN_DRDY_CB(READLINE(rainbow_state, hdc_drive_ready)) // DRIVE_READY (set to VCC if not serviced) -MCFG_WD2010_IN_SC_CB(VCC) // SEEK COMPLETE (set to VCC if not serviced) - -// CURRENTLY NOT EVALUATED WITHIN 'WD2010': -MCFG_WD2010_IN_TK000_CB(VCC) -MCFG_WD2010_IN_INDEX_CB(VCC) - -MCFG_HARDDISK_ADD("harddisk1") -/// ******************************** / HARD DISK CONTROLLER **************************************** - -MCFG_DS1315_ADD("rtc") // DS1315 (ClikClok for DEC-100 B) * OPTIONAL * - -MCFG_DEVICE_ADD("kbdser", I8251, 0) -MCFG_I8251_TXD_HANDLER(WRITELINE(rainbow_state, kbd_tx)) -MCFG_I8251_DTR_HANDLER(WRITELINE(rainbow_state, irq_hi_w)) -MCFG_I8251_RXRDY_HANDLER(WRITELINE(rainbow_state, kbd_rxready_w)) -MCFG_I8251_TXRDY_HANDLER(WRITELINE(rainbow_state, kbd_txready_w)) - -MCFG_DEVICE_ADD(LK201_TAG, LK201, 0) -MCFG_LK201_TX_HANDLER(DEVWRITELINE("kbdser", i8251_device, write_rxd)) - -MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4800 * 16) // 8251 is set to /16 on the clock input -MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(rainbow_state, write_keyboard_clock)) - -MCFG_TIMER_DRIVER_ADD_PERIODIC("motor", rainbow_state, motor_tick, attotime::from_hz(60)) - -MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - -//---------------------------------------------------------------------------------------- -// 'Rainbow 100-A' (system module 70-19974-00, PSU H7842-A) -// - first generation hardware (introduced May '82) with ROM 04.03.11 -// - inability to boot from hard disc (mind the inadequate PSU) -//---------------------------------------------------------------------------------------- -// AVAILABLE RAM: 64 K on board (versus 128 K on model 'B'). - -// Two compatible memory expansions were sold by DEC: -// (PCIXX-AA) : 64 K (usable on either Rainbow 100-A or 100-B) * -// (PCIXX-AB) : 192 K ( " ) * -// Totals to 256 K on a 100-A, while the RAM limit appears to be 832 K. - -// * DEC changed the way signals are handled on J6 (memory connector) later: -// "Whether a PC100-A or PC100-B memory module is installed on the PC100-B system module -// affects the functions the signals on 5 pins (29, 30, 32, 43, and 47) of the J6 connector -// will perform." (from 'EK-RB100_TM_001 Addendum for PC100-A_PC100-B Dec.84' page 120). -//---------------------------------------------------------------------------------------- -// KNOWN DIFFERENCES TO 100-B: -// - cannot control bit 7 of IRQ vector (prevents DOS > 2.01 from booting on unmodified hardware) -// - 4 color palette with graphics option (instead of 16 colors on later models) -// - smaller ROMs (3 x 2764) with fewer routines (no documented way to beep...) -// - socketed NVRAM chip: X2212D 8238AES -ROM_START(rainbow100a) -ROM_REGION(0x100000, "maincpu", 0) - -ROM_LOAD("23-176e4-00.bin", 0xFA000, 0x2000, NO_DUMP) // ROM (FA000-FBFFF) (E89) 8 K -ROM_LOAD("23-177e4-00.bin", 0xFC000, 0x2000, NO_DUMP) // ROM (FC000-FDFFF) (E90) 8 K - -// SOCKETED LANGUAGE ROM (E91) with 1 single localization per ROM - -ROM_LOAD("23-092e4-00.bin", 0xFE000, 0x2000, NO_DUMP) // ROM (FE000-FFFFF) (E91) 8 K - English (?) -// See also MP-01491-00 - PC100A FIELD MAINTENANCE SET. Appendix A of EK-RB100 Rainbow -// Technical Manual Addendum f.100A and 100B (Dec.84) lists 15 localizations / part numbers - -ROM_REGION(0x1000, "chargen", 0) // [E98] 2732 (4 K) EPROM -ROM_LOAD("23-020e3-00.bin", 0x0000, 0x1000, CRC(1685e452) SHA1(bc299ff1cb74afcededf1a7beb9001188fdcf02f)) -ROM_END - -//---------------------------------------------------------------------------------------- -// ROM definition for 100-B (system module 70-19974-02, PSU H7842-D) -// Built until ~ May 1986 (from MP-01491-00) -// - 32 K ROM (version 5.03) -// - 128 K base and 896 K max. mem. -ROM_START(rainbow) -ROM_REGION(0x100000, "maincpu", 0) - -// Note that the 'Field Maintenance Print Set 1984' also lists alternate revision 'A1' with -// 23-063e3-00 (for chargen) and '23-074e5-00' / '23-073e5-00' for E5-01 / E5-02. - -// Part numbers 22E5, 20E5 and 37E3 verified to match revision "B" (FCC ID : A0994Q - PC100 - B). - -// BOOT ROM -ROM_LOAD("23-022e5-00.bin", 0xf0000, 0x4000, CRC(9d1332b4) SHA1(736306d2a36bd44f95a39b36ebbab211cc8fea6e)) -ROM_RELOAD(0xf4000, 0x4000) - -// LANGUAGE ROM -ROM_LOAD("23-020e5-00.bin", 0xf8000, 0x4000, CRC(8638712f) SHA1(8269b0d95dc6efbe67d500dac3999df4838625d8)) // German, French, English -//ROM_LOAD( "23-015e5-00.bin", 0xf8000, 0x4000, NO_DUMP) // Dutch, French, English -//ROM_LOAD( "23-016e5-00.bin", 0xf8000, 0x4000, NO_DUMP) // Finish, Swedish, English -//ROM_LOAD( "23-017e5-00.bin", 0xf8000, 0x4000, NO_DUMP) // Danish, Norwegian, English -//ROM_LOAD( "23-018e5-00.bin", 0xf8000, 0x4000, NO_DUMP) // Spanish, Italian, English -ROM_RELOAD(0xfc000, 0x4000) - -// CHARACTER GENERATOR (E3-03) -ROM_REGION(0x1000, "chargen", 0) -ROM_LOAD("23-037e3.bin", 0x0000, 0x1000, CRC(1685e452) SHA1(bc299ff1cb74afcededf1a7beb9001188fdcf02f)) -ROM_END - -//---------------------------------------------------------------------------------------- -// 'Rainbow 190 B' (announced March 1985) is identical to 100-B, with alternate ROM v5.05. -// According to an article in Wall Street Journal it came with a 10 MB HD and 640 K RAM. - -// All programs not dependent on specific ROM addresses should work. A first glance: -// - jump tables (F4000-F40083 and FC000-FC004D) were not extended -// - absolute addresses of some internal routines have changed (affects BOOT 2.x / 3.x dual boot) - -// A Readme from January 1985 mentions 'recent ROM changes for MASS 11' (a VAX word processor). -// It is *likely* that the sole differences between 5.05 and 5.03 affect terminal emulation. - -// FIXME: ROM names are * made up *. -// Someone who knows the DEC naming conventions should correct them - -ROM_START(rainbow190) -ROM_REGION(0x100000, "maincpu", 0) -ROM_LOAD("dec190rom0.bin", 0xf0000, 0x4000, CRC(fac191d2) SHA1(4aff5b1e031d3b5eafc568b23e68235270bb34de)) -ROM_RELOAD(0xf4000, 0x4000) -ROM_LOAD("dec190rom1.bin", 0xf8000, 0x4000, CRC(5ce59632) SHA1(d29793f7014c57a4e7cb77bbf6e84f9113635ed2)) - -ROM_RELOAD(0xfc000, 0x4000) -ROM_REGION(0x1000, "chargen", 0) -ROM_LOAD("chargen.bin", 0x0000, 0x1000, CRC(1685e452) SHA1(bc299ff1cb74afcededf1a7beb9001188fdcf02f)) -ROM_END -//---------------------------------------------------------------------------------------- - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP(1982, rainbow100a, rainbow, 0, rainbow, rainbow100b_in, driver_device, 0, "Digital Equipment Corporation", "Rainbow 100-A", MACHINE_IS_SKELETON) -COMP(1983, rainbow, 0, 0, rainbow, rainbow100b_in, driver_device, 0, "Digital Equipment Corporation", "Rainbow 100-B", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_COLORS) -COMP(1985, rainbow190, rainbow, 0, rainbow, rainbow100b_in, driver_device, 0, "Digital Equipment Corporation", "Rainbow 190-B", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_COLORS) diff --git a/src/mess/drivers/rambo.c b/src/mess/drivers/rambo.c deleted file mode 100644 index a1fcf25b781..00000000000 --- a/src/mess/drivers/rambo.c +++ /dev/null @@ -1,227 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Felipe Sanches -/* - RAMBo (RepRap Arduino-compatible Mother Board) by UltiMachine - for controlling desktop 3d printers - http://reprap.org/wiki/Rambo - - driver by Felipe Correa da Silva Sanches - - This driver is based on the schematics of the version 1.1b: - http://reprap.org/mediawiki/images/7/75/Rambo1-1-schematic.png - - 3d printers currently supported by this driver: - * Metam??quina 2 - - 3d printers known to use this board: - * TODO: list them all here -*/ - -#include "emu.h" -#include "cpu/avr8/avr8.h" - -#define MASTER_CLOCK 16000000 - -#define LOG_PORTS 0 - -/****************************************************\ -* I/O devices * -\****************************************************/ - -class rambo_state : public driver_device -{ -public: - rambo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { - } - - UINT8 m_port_a; - UINT8 m_port_b; - UINT8 m_port_c; - UINT8 m_port_d; - UINT8 m_port_e; - UINT8 m_port_f; - UINT8 m_port_g; - UINT8 m_port_h; - UINT8 m_port_j; - UINT8 m_port_k; - UINT8 m_port_l; - required_device m_maincpu; - - DECLARE_READ8_MEMBER(port_r); - DECLARE_WRITE8_MEMBER(port_w); - - DECLARE_DRIVER_INIT(rambo); - virtual void machine_start(); - virtual void machine_reset(); -}; - -void rambo_state::machine_start() -{ -} - -READ8_MEMBER(rambo_state::port_r) -{ - switch( offset ) - { - case AVR8_IO_PORTA: - { -#if LOG_PORTS - printf("[%08X] Port A READ \n", m_maincpu->m_shifted_pc); -#endif - return m_port_a; - } - default: - break; - } - return 0; -} - -WRITE8_MEMBER(rambo_state::port_w) -{ - switch( offset ) - { - case AVR8_IO_PORTA: - { - if (data == m_port_a) break; - -#if LOG_PORTS - UINT8 old_port_a = m_port_a; - UINT8 changed = data ^ old_port_a; -#endif - m_port_a = data; - break; - } - default: - break; - } -} - -/****************************************************\ -* Address maps * -\****************************************************/ - -static ADDRESS_MAP_START( rambo_prg_map, AS_PROGRAM, 8, rambo_state ) - AM_RANGE(0x0000, 0x1FFFF) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( rambo_data_map, AS_DATA, 8, rambo_state ) - AM_RANGE(0x0200, 0x21FF) AM_RAM /* ATMEGA2560 Internal SRAM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( rambo_io_map, AS_IO, 8, rambo_state ) - AM_RANGE(AVR8_IO_PORTA, AVR8_IO_PORTL) AM_READWRITE( port_r, port_w ) -ADDRESS_MAP_END - -/****************************************************\ -* Machine definition * -\****************************************************/ - -DRIVER_INIT_MEMBER(rambo_state, rambo) -{ -} - -void rambo_state::machine_reset() -{ - m_port_a = 0; - m_port_b = 0; - m_port_c = 0; - m_port_d = 0; - m_port_e = 0; - m_port_f = 0; - m_port_g = 0; - m_port_h = 0; - m_port_j = 0; - m_port_k = 0; - m_port_l = 0; -} - -static MACHINE_CONFIG_START( rambo, rambo_state ) - - MCFG_CPU_ADD("maincpu", ATMEGA2560, MASTER_CLOCK) - MCFG_CPU_PROGRAM_MAP(rambo_prg_map) - MCFG_CPU_DATA_MAP(rambo_data_map) - MCFG_CPU_IO_MAP(rambo_io_map) - - MCFG_CPU_AVR8_EEPROM("eeprom") - MCFG_CPU_AVR8_LFUSE(0xFF) - MCFG_CPU_AVR8_HFUSE(0xDA) - MCFG_CPU_AVR8_EFUSE(0xF4) - MCFG_CPU_AVR8_LOCK(0x0F) - - /*TODO: Add an ATMEGA32U2 for USB-Serial communications */ - /*TODO: Emulate the AD5206 digipot */ - /*TODO: Emulate the A4982 stepper motor drivers and instantiate 5 of these here - for controlling the X, Y, Z, E1 (and optionally E2) motors */ - /*TODO: Simulate the heating elements */ - /*TODO: Implement the thermistor measurements */ -MACHINE_CONFIG_END - -ROM_START( metamaq2 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_DEFAULT_BIOS("20131015") - - ROM_SYSTEM_BIOS( 0, "20130619", "June 19th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_06_19) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-06-19.bin", 0x0000, 0x1000e, CRC(4279b178) SHA1(e4d3c9d6421287c980639c2df32d07b754adc8fc), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "20130624", "June 24th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_RC2_RAMBo_rev10e_2013_06_24) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-06-24_mm2rc2_rambo_rev10e.bin", 0x0000, 0xcebc, CRC(82400a3c) SHA1(0781ce29406ce69b63edb93d776b9c081bed841e), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS( 2, "20130625", "June 25th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_06_25) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-06-25.bin", 0x0000, 0x10076, CRC(e7e4db38) SHA1(0c307bb0a0ee4e9d38253936e7030d0efb3c1845), ROM_BIOS(3)) - - ROM_SYSTEM_BIOS( 3, "20130709", "July 9th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_07_09) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-07-09.bin", 0x0000, 0x10078, CRC(9a45509f) SHA1(3a2e6516b45cc0ea1aef039335b02208847aaebf), ROM_BIOS(4)) - - ROM_SYSTEM_BIOS( 4, "20130712", "July 12th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_07_12) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-07-12.bin", 0x0000, 0x10184, CRC(9aeac87c) SHA1(c1441096553c214c12a34da87fa42cc3f0eaf74d), ROM_BIOS(5)) - - ROM_SYSTEM_BIOS( 5, "20130717", "July 17th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_07_17) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-07-17.bin", 0x0000, 0x10180, CRC(7c053ed0) SHA1(7abeabcbfdb411b6e681e2d0c9398c40b142f76b), ROM_BIOS(6)) - - ROM_SYSTEM_BIOS( 6, "20130806", "August 6th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_08_06) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-08-06.bin", 0x0000, 0x1017e, CRC(6aaf5a14) SHA1(93cebee8ab9eda9d81e70504b407268a198577f0), ROM_BIOS(7)) - - ROM_SYSTEM_BIOS( 7, "20130809", "August 9th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_08_09) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-08-09.bin", 0x0000, 0x1018a, CRC(ee53a011) SHA1(666d09fe69220a172528fe8d1c358e3ddaaa743a), ROM_BIOS(8)) - - ROM_SYSTEM_BIOS( 8, "20130822", "August 22nd, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_08_22) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-08-22.bin", 0x0000, 0x1018a, CRC(70a5a3c9) SHA1(20e52ea7bf40e71020b815b9fb6385d880677927), ROM_BIOS(9)) - - ROM_SYSTEM_BIOS( 9, "20130913", "September 13th, 2013" ) - /* source code for this one is unavailable as it was an unreleased internal development build */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-09-13-devel.bin", 0x0000, 0x101bc, CRC(5e7c7933) SHA1(5b9bfe919daf705ad7a9a2de3cf4c51e3338ec47), ROM_BIOS(10)) - - ROM_SYSTEM_BIOS( 10, "20130920", "September 20th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_09_20) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-09-20.bin", 0x0000, 0x10384, CRC(48378e58) SHA1(513f0a0c65219875cc467420cc091e3489b58919), ROM_BIOS(11)) - - ROM_SYSTEM_BIOS( 11, "20131015", "October 15th, 2013" ) - /* SOURCE(https://github.com/Metamaquina/Repetier-Firmware/tree/MM2_2013_10_15) */ - ROMX_LOAD("repetier-fw-metamaquina2-2013-10-15.bin", 0x0000, 0x102c8, CRC(520134bd) SHA1(dfe2251aad06972f237eb4920ce14ccb32da5af0), ROM_BIOS(12)) - - /*Arduino MEGA bootloader */ - /* This is marked as a BAD_DUMP because we're not sure this is the bootloader we're actually using. - This is inherited from the Replicator 1 driver. - A proper dump would be good. - Also, it is not clear whether there's any difference in the bootloader - between the ATMEGA1280 and the ATMEGA2560 MCUs */ - ROM_LOAD( "atmegaboot_168_atmega1280.bin", 0x1f000, 0x0f16, BAD_DUMP CRC(c041f8db) SHA1(d995ebf360a264cccacec65f6dc0c2257a3a9224) ) - - /* on-die 4kbyte eeprom */ - ROM_REGION( 0x1000, "eeprom", ROMREGION_ERASEFF ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP(2012, metamaq2, 0, 0, rambo, 0, rambo_state, rambo, "Metamaquina", "Metamaquina 2 desktop 3d printer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/ravens.c b/src/mess/drivers/ravens.c deleted file mode 100644 index e122ab12f72..00000000000 --- a/src/mess/drivers/ravens.c +++ /dev/null @@ -1,388 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Ravensburger Selbstbaucomputer - -This is a project described in "Ravensburger" magazine. You had to make -the entire thing (including the circuit boards) yourself. - -http://petersieg.bplaced.com/?2650_Computer:2650_Selbstbaucomputer - - 2013-04-23 Skeleton driver. - - -No instructions, no schematics - it's all guesswork. - -The cassette saves a noise but it returns a bad load. - - -Version 0.9 ------------ -Hardware: - 0000-07FF ROM "MON1" - 0800-1FFF RAM (3x HM6116) - 24 pushbuttons and 6-digit LED display on front panel. - Other buttons and switches on the main board. - -The few photos show the CPU and a number of ordinary 74LSxxx chips. -There is a XTAL of unknown frequency. - -The buttons are labelled CMD, RUN, GOTO, RST, F, MON, PC, NXT but at -this time not all buttons are identified. - -What is known: -- Press NXT to read memory. Press NXT again to read the next address. -- Press PC and it says PCxxxx -- Press CMD, it says CND=, you can choose one of these: --- A displays value of a register. Press A again to see more registers. --- B sets a breakpoint --- C clears a breakpoint --- D dumps blocks to tape --- E examine tape file --- F fetch (load) from tape - -Quickload: Load the program then press Y. There are 6 that work and - 6 that do nothing. - -ToDo: -- Cassette - -Version V2.0 ------------- -This used a terminal interface with a few non-standard control codes. -The pushbuttons and LEDs appear to have been done away with. - -Commands (must be in uppercase): -A Examine memory; press C to alter memory -B Set breakpoint? -C View breakpoint? -D Dump to screen and tape (at the same time) -E Execute -I ? -L Load -R ? -V Verify? - -ToDo: -- Cassette - -****************************************************************************/ - -#include "emu.h" -#include "cpu/s2650/s2650.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "machine/terminal.h" -#include "sound/wave.h" -#include "ravens.lh" - -#define TERMINAL_TAG "terminal" - -class ravens_state : public driver_device -{ -public: - ravens_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_cass(*this, "cassette") - { - } - - DECLARE_READ8_MEMBER(port07_r); - DECLARE_READ8_MEMBER(port17_r); - DECLARE_WRITE8_MEMBER(port1b_w); - DECLARE_WRITE8_MEMBER(port1c_w); - DECLARE_WRITE8_MEMBER(display_w); - DECLARE_WRITE8_MEMBER(leds_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_MACHINE_RESET(ravens2); - DECLARE_READ8_MEMBER(cass_r); - DECLARE_WRITE_LINE_MEMBER(cass_w); - DECLARE_QUICKLOAD_LOAD_MEMBER( ravens ); - UINT8 m_term_char; - UINT8 m_term_data; - required_device m_maincpu; - optional_device m_terminal; - required_device m_cass; -}; - -WRITE_LINE_MEMBER( ravens_state::cass_w ) -{ - m_cass->output(state ? -1.0 : +1.0); -} - -READ8_MEMBER( ravens_state::cass_r ) -{ - return (m_cass->input() > 0.03) ? 1 : 0; -} - -WRITE8_MEMBER( ravens_state::display_w ) -{ - output_set_digit_value(offset, data); -} - -WRITE8_MEMBER( ravens_state::leds_w ) -{ - char ledname[8]; - for (int i = 0; i < 8; i++) - { - sprintf(ledname,"led%d",i); - output_set_value(ledname, !BIT(data, i)); - } -} - -READ8_MEMBER( ravens_state::port07_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0x80; - return ret; -} - -READ8_MEMBER( ravens_state::port17_r ) -{ - UINT8 keyin, i; - - keyin = ioport("X0")->read(); - if (keyin != 0xff) - for (i = 0; i < 8; i++) - if BIT(~keyin, i) - return i | 0x80; - - keyin = ioport("X1")->read(); - if (keyin != 0xff) - for (i = 0; i < 8; i++) - if BIT(~keyin, i) - return i | 0x88; - - keyin = ioport("X2")->read(); - if (!BIT(keyin, 0)) - m_maincpu->reset(); - if (keyin != 0xff) - for (i = 0; i < 8; i++) - if BIT(~keyin, i) - return (i<<4) | 0x80; - - return 0; -} - -WRITE8_MEMBER( ravens_state::port1b_w ) -{ - if (BIT(data, 7)) - return; - else - if ((data == 0x08 && m_term_char == 0x20)) - data = 0x0c; // FormFeed - else - if ((data == 0x0a && m_term_char == 0x20)) - data = 0x0a; // LineFeed - else - if ((data == 0x01 && m_term_char == 0xc2)) - data = 0x0d; // CarriageReturn - else - data = m_term_char; - - m_terminal->write(space, 0, data); -} - -WRITE8_MEMBER( ravens_state::port1c_w ) -{ - m_term_char = data; -} - -MACHINE_RESET_MEMBER( ravens_state, ravens2 ) -{ - m_term_data = 0x80; - output_set_digit_value(6, 0); -} - - -static ADDRESS_MAP_START( ravens_mem, AS_PROGRAM, 8, ravens_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff) AM_ROM - AM_RANGE( 0x0800, 0x1fff) AM_RAM - AM_RANGE( 0x2000, 0x7FFF) AM_RAM // for quickload, optional -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ravens_io, AS_IO, 8, ravens_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x09, 0x09) AM_WRITE(leds_w) // LED output port - AM_RANGE(0x10, 0x15) AM_WRITE(display_w) // 6-led display - AM_RANGE(0x17, 0x17) AM_READ(port17_r) // pushbuttons - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ravens2_io, AS_IO, 8, ravens_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x07, 0x07) AM_READ(port07_r) - AM_RANGE(0x1b, 0x1b) AM_WRITE(port1b_w) - AM_RANGE(0x1c, 0x1c) AM_WRITE(port1c_w) - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(cass_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ravens ) - PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("???") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("???") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CMD") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("???") PORT_CODE(KEYCODE_O) PORT_CHAR('O') -INPUT_PORTS_END - -WRITE8_MEMBER( ravens_state::kbd_put ) -{ - if (data > 0x60) data -= 0x20; // fold to uppercase - m_term_data = data; -} - -QUICKLOAD_LOAD_MEMBER( ravens_state, ravens ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int i; - int quick_addr = 0x900; - int exec_addr; - int quick_length; - dynamic_buffer quick_data; - int read_; - int result = IMAGE_INIT_FAIL; - - quick_length = image.length(); - if (quick_length < 0x0900) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); - image.message(" File too short"); - } - else if (quick_length > 0x8000) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); - image.message(" File too long"); - } - else - { - quick_data.resize(quick_length); - read_ = image.fread( &quick_data[0], quick_length); - if (read_ != quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); - image.message(" Cannot read the file"); - } - else if (quick_data[0] != 0xc6) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); - image.message(" Invalid header"); - } - else - { - exec_addr = quick_data[2] * 256 + quick_data[3]; - - if (exec_addr >= quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); - image.message(" Exec address beyond end of file"); - } - else - { - for (i = quick_addr; i < read_; i++) - space.write_byte(i, quick_data[i]); - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); - - // Start the quickload - m_maincpu->set_state_int(S2650_PC, exec_addr); - - result = IMAGE_INIT_PASS; - } - } - } - - return result; -} - -static MACHINE_CONFIG_START( ravens, ravens_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) // frequency is unknown - MCFG_CPU_PROGRAM_MAP(ravens_mem) - MCFG_CPU_IO_MAP(ravens_io) - MCFG_S2650_FLAG_HANDLER(WRITELINE(ravens_state, cass_w)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_ravens) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", ravens_state, ravens, "pgm", 1) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ravens2, ravens_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",S2650, XTAL_1MHz) // frequency is unknown - MCFG_CPU_PROGRAM_MAP(ravens_mem) - MCFG_CPU_IO_MAP(ravens2_io) - MCFG_S2650_FLAG_HANDLER(WRITELINE(ravens_state, cass_w)) - - MCFG_MACHINE_RESET_OVERRIDE(ravens_state, ravens2) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ravens_state, kbd_put)) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", ravens_state, ravens, "pgm", 1) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ravens ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "v1.0", "V1.0" ) - ROMX_LOAD( "mon_v1.0.bin", 0x0000, 0x0800, CRC(785eb1ad) SHA1(c316b8ac32ab6aa37746af37b9f81a23367fedd8), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v0.9", "V0.9" ) - ROMX_LOAD( "mon_v0_9.bin", 0x0000, 0x07b5, CRC(2f9b9178) SHA1(ec2ebbc80ee9ff2502c1409ab4f99127032ed724), ROM_BIOS(2)) -ROM_END - -ROM_START( ravens2 ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "mon_v2.0.bin", 0x0000, 0x0800, CRC(bcd47c58) SHA1(f261a3f128fbedbf59a8b5480758fff4d7f76de1)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, ravens, 0, 0, ravens, ravens, driver_device, 0, "Joseph Glagla and Dieter Feiler", "Ravensburger Selbstbaucomputer V0.9", MACHINE_NO_SOUND_HW ) -COMP( 1985, ravens2, ravens, 0, ravens2, ravens, driver_device, 0, "Joseph Glagla and Dieter Feiler", "Ravensburger Selbstbaucomputer V2.0", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/rc759.c b/src/mess/drivers/rc759.c deleted file mode 100644 index aa69efb9dd2..00000000000 --- a/src/mess/drivers/rc759.c +++ /dev/null @@ -1,617 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Regnecentralen RC759 Piccoline - - Status: Error 32 (cassette data error) - -***************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i186.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "machine/mm58167.h" -#include "machine/pic8259.h" -#include "machine/i8255.h" -#include "video/i82730.h" -#include "sound/speaker.h" -#include "sound/sn76496.h" -#include "machine/keyboard.h" -#include "bus/centronics/ctronics.h" -#include "machine/wd_fdc.h" -#include "imagedev/cassette.h" -#include "bus/isbx/isbx.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class rc759_state : public driver_device -{ -public: - rc759_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pic(*this, "pic"), - m_nvram(*this, "nvram"), - m_ppi(*this, "ppi"), - m_txt(*this, "txt"), - m_cas(*this, "cas"), - m_isbx(*this, "isbx"), - m_speaker(*this, "speaker"), - m_snd(*this, "snd"), - m_rtc(*this, "rtc"), - m_centronics(*this, "centronics"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_vram(*this, "vram"), - m_config(*this, "config"), - m_cas_enabled(0), m_cas_data(0), - m_drq_source(0), - m_nvram_bank(0), - m_gfx_mode(0), - m_keyboard_enable(0), m_keyboard_key(0x00), - m_centronics_strobe(0), m_centronics_init(0), m_centronics_select_in(0), m_centronics_busy(0), - m_centronics_ack(0), m_centronics_fault(0), m_centronics_perror(0), m_centronics_select(0), - m_centronics_data(0xff) - { } - - DECLARE_WRITE8_MEMBER(keyb_put); - DECLARE_READ8_MEMBER(keyboard_r); - - DECLARE_WRITE8_MEMBER(floppy_control_w); - DECLARE_READ8_MEMBER(floppy_ack_r); - DECLARE_WRITE8_MEMBER(floppy_reserve_w); - DECLARE_WRITE8_MEMBER(floppy_release_w); - - DECLARE_READ8_MEMBER(ppi_porta_r); - DECLARE_READ8_MEMBER(ppi_portb_r); - DECLARE_WRITE8_MEMBER(ppi_portc_w); - - DECLARE_WRITE_LINE_MEMBER(centronics_busy_w); - DECLARE_WRITE_LINE_MEMBER(centronics_ack_w); - DECLARE_WRITE_LINE_MEMBER(centronics_fault_w); - DECLARE_WRITE_LINE_MEMBER(centronics_perror_w); - DECLARE_WRITE_LINE_MEMBER(centronics_select_w); - - DECLARE_READ8_MEMBER(centronics_data_r); - DECLARE_WRITE8_MEMBER(centronics_data_w); - DECLARE_READ8_MEMBER(centronics_control_r); - DECLARE_WRITE8_MEMBER(centronics_control_w); - - I82730_UPDATE_ROW(txt_update_row); - DECLARE_WRITE16_MEMBER(txt_ca_w); - DECLARE_WRITE16_MEMBER(txt_irst_w); - DECLARE_READ8_MEMBER(palette_r); - DECLARE_WRITE8_MEMBER(palette_w); - - DECLARE_WRITE_LINE_MEMBER(i186_timer0_w); - DECLARE_WRITE_LINE_MEMBER(i186_timer1_w); - - void nvram_init(nvram_device &nvram, void *data, size_t size); - DECLARE_READ8_MEMBER(nvram_r); - DECLARE_WRITE8_MEMBER(nvram_w); - DECLARE_READ8_MEMBER(rtc_r); - DECLARE_WRITE8_MEMBER(rtc_w); - DECLARE_READ8_MEMBER(irq_callback); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - -private: - required_device m_maincpu; - required_device m_pic; - required_device m_nvram; - required_device m_ppi; - required_device m_txt; - required_device m_cas; - required_device m_isbx; - required_device m_speaker; - required_device m_snd; - required_device m_rtc; - required_device m_centronics; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_shared_ptr m_vram; - required_ioport m_config; - - std::vector m_nvram_mem; - - int m_cas_enabled; - int m_cas_data; - int m_drq_source; - int m_nvram_bank; - int m_gfx_mode; - int m_keyboard_enable; - UINT8 m_keyboard_key; - - int m_centronics_strobe; - int m_centronics_init; - int m_centronics_select_in; - int m_centronics_busy; - int m_centronics_ack; - int m_centronics_fault; - int m_centronics_perror; - int m_centronics_select; - UINT8 m_centronics_data; -}; - - -//************************************************************************** -// I/O -//************************************************************************** - -WRITE8_MEMBER( rc759_state::keyb_put ) -{ - m_keyboard_key = data; - m_pic->ir1_w(1); -} - -READ8_MEMBER( rc759_state::keyboard_r ) -{ - logerror("keyboard_r\n"); - - m_pic->ir1_w(0); - - if (m_keyboard_enable) - return m_keyboard_key; - else - return 0x00; -} - -READ8_MEMBER( rc759_state::ppi_porta_r ) -{ - UINT8 data = 0; - - data |= m_cas_enabled ? m_cas_data : (m_cas->input() > 0 ? 1 : 0); - data |= m_isbx->mpst_r() << 1; - data |= m_isbx->opt0_r() << 2; - data |= m_isbx->opt1_r() << 3; - data |= 1 << 4; // mem ident0 - data |= 1 << 5; // mem ident1 (both 1 = 256k installed) - data |= 1 << 6; // dpc connect (0 = external floppy/printer installed) - data |= 1 << 7; // not used - - return data; -} - -READ8_MEMBER( rc759_state::ppi_portb_r ) -{ - UINT8 data = 0; - - data |= 1 << 0; // 0 = micronet controller installed - data |= 1 << 1; // rtc type, mm58167/cdp1879 - data |= m_snd->ready_r() << 2; - data |= 1 << 3; // not used - data |= 1 << 4; // not used - data |= m_config->read(); // monitor type and frequency - data |= 1 << 7; // 0 = enable remote hardware debug (using an isbx351 module) - - return data; -} - -WRITE8_MEMBER( rc759_state::ppi_portc_w ) -{ - m_cas_enabled = BIT(data, 0); - m_cas->change_state(BIT(data, 1) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_drq_source = (data >> 2) & 0x03; - m_nvram_bank = (data >> 4) & 0x03; - m_gfx_mode = BIT(data, 6); - m_keyboard_enable = BIT(data, 7); - - logerror("ppi_portc_w: cas_enabled: %d, cas_motor: %d, drq_source: %d, nvram_bank: %d, gfx_mode: %d, keyb_enable: %d\n", - m_cas_enabled, BIT(data, 1), m_drq_source, m_nvram_bank, m_gfx_mode, m_keyboard_enable); -} - -WRITE_LINE_MEMBER( rc759_state::centronics_busy_w ) -{ - m_centronics_busy = state; - m_pic->ir6_w(state); -} - -WRITE_LINE_MEMBER( rc759_state::centronics_ack_w ) -{ - m_centronics_ack = state; -} - -WRITE_LINE_MEMBER( rc759_state::centronics_fault_w ) -{ - m_centronics_fault = state; -} - -WRITE_LINE_MEMBER( rc759_state::centronics_perror_w ) -{ - m_centronics_perror = state; -} - -WRITE_LINE_MEMBER( rc759_state::centronics_select_w ) -{ - m_centronics_select = state; -} - -READ8_MEMBER( rc759_state::centronics_data_r ) -{ - return m_centronics_data; -} - -WRITE8_MEMBER( rc759_state::centronics_data_w ) -{ - m_centronics_data = data; - - m_centronics->write_data0(BIT(data, 0)); - m_centronics->write_data1(BIT(data, 1)); - m_centronics->write_data2(BIT(data, 2)); - m_centronics->write_data3(BIT(data, 3)); - m_centronics->write_data4(BIT(data, 4)); - m_centronics->write_data5(BIT(data, 5)); - m_centronics->write_data6(BIT(data, 6)); - m_centronics->write_data7(BIT(data, 7)); -} - -READ8_MEMBER( rc759_state::centronics_control_r ) -{ - UINT8 data = 0; - - data |= m_centronics_busy << 0; - data |= m_centronics_ack << 1; - data |= m_centronics_fault << 2; - data |= m_centronics_perror << 3; - data |= m_centronics_select << 4; - data |= !m_centronics_strobe << 5; - data |= !m_centronics_init << 6; - data |= !m_centronics_select_in << 7; - - return data; -} - -WRITE8_MEMBER( rc759_state::centronics_control_w ) -{ - logerror("centronics_control_w: %02x\n", data); - - m_centronics_strobe = BIT(data, 0); - m_centronics_init = BIT(data, 2); - m_centronics_select_in = BIT(data, 4); - - m_centronics->write_strobe(m_centronics_strobe); - m_centronics->write_autofd(BIT(data, 1)); - m_centronics->write_init(m_centronics_init); - m_centronics->write_select_in(m_centronics_select_in); -} - -WRITE8_MEMBER( rc759_state::floppy_control_w ) -{ - logerror("floppy_control_w: %02x\n", data); - - switch (BIT(data, 0)) - { - case 0: m_fdc->set_floppy(m_floppy0->get_device()); break; - case 1: m_fdc->set_floppy(m_floppy1->get_device()); break; - } - - if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(!BIT(data, 1)); - if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(!BIT(data, 2)); - - // bit 3, enable precomp - // bit 4, precomp 125/250 nsec - - m_fdc->dden_w(BIT(data, 5)); - m_fdc->set_unscaled_clock(BIT(data, 6) ? 2000000 : 1000000); - m_fdc->set_force_ready(BIT(data, 7)); -} - -READ8_MEMBER( rc759_state::floppy_ack_r ) -{ - logerror("floppy_ack_r\n"); - return 0xff; -} - -WRITE8_MEMBER( rc759_state::floppy_reserve_w ) -{ - logerror("floppy_reserve_w: %02x\n", data); -} - -WRITE8_MEMBER( rc759_state::floppy_release_w ) -{ - logerror("floppy_release_w: %02x\n", data); -} - - -//************************************************************************** -// VIDEO EMULATION -//************************************************************************** - -I82730_UPDATE_ROW( rc759_state::txt_update_row ) -{ - for (int i = 0; i < x_count; i++) - { - UINT16 gfx = m_vram[(data[i] & 0x3ff) << 4 | lc]; - - // pretty crude detection if char sizes have been initialized, need something better - if ((gfx & 0xff) == 0) - continue; - - // figure out char width - int width; - for (width = 0; width < 16; width++) - if (BIT(gfx, width) == 0) - break; - - width = 15 - width; - - for (int p = 0; p < width; p++) - bitmap.pix32(y, i * width + p) = BIT(gfx, 15 - p) ? rgb_t::white : rgb_t::black; - } -} - -WRITE16_MEMBER( rc759_state::txt_ca_w ) -{ - m_txt->ca_w(1); - m_txt->ca_w(0); -} - -WRITE16_MEMBER( rc759_state::txt_irst_w ) -{ - m_txt->irst_w(1); - m_txt->irst_w(0); -} - -READ8_MEMBER( rc759_state::palette_r ) -{ - logerror("palette_r(%02x)\n", offset); - return 0xff; -} - -WRITE8_MEMBER( rc759_state::palette_w ) -{ - logerror("palette_w(%02x): %02x\n", offset, data); -} - - -//************************************************************************** -// SOUND/RTC -//************************************************************************** - -READ8_MEMBER( rc759_state::rtc_r ) -{ - logerror("rtc_r(%02x)\n", offset); - return 0xff; -} - -WRITE8_MEMBER( rc759_state::rtc_w ) -{ - logerror("rtc_w(%02x): %02x\n", offset, data); -} - - -//************************************************************************** -// MACHINE EMULATION -//************************************************************************** - -WRITE_LINE_MEMBER( rc759_state::i186_timer0_w ) -{ - if (m_cas_enabled) - { - m_cas_data = state; - m_cas->output(state ? -1.0 : 1.0); - } -} - -WRITE_LINE_MEMBER( rc759_state::i186_timer1_w ) -{ - m_speaker->level_w(state); -} - -// 256x4 nvram is bank-switched using ppi port c, bit 4 and 5 -void rc759_state::nvram_init(nvram_device &nvram, void *data, size_t size) -{ - memset(data, 0x00, size); - memset(data, 0xaa, 1); -} - -READ8_MEMBER( rc759_state::nvram_r ) -{ - offs_t addr = (m_nvram_bank << 6) | offset; - - logerror("nvram_r(%02x)\n", addr); - - if (addr & 1) - return (m_nvram_mem[addr >> 1] & 0xf0) >> 4; - else - return (m_nvram_mem[addr >> 1] & 0x0f) >> 0; -} - -WRITE8_MEMBER( rc759_state::nvram_w ) -{ - offs_t addr = (m_nvram_bank << 6) | offset; - - logerror("nvram_w(%02x): %02x\n", addr, data); - - if (addr & 1) - m_nvram_mem[addr >> 1] = ((data << 4) & 0xf0) | (m_nvram_mem[addr >> 1] & 0x0f); - else - m_nvram_mem[addr >> 1] = (m_nvram_mem[addr >> 1] & 0xf0) | (data & 0x0f); -} - -READ8_MEMBER( rc759_state::irq_callback ) -{ - return m_pic->acknowledge(); -} - -void rc759_state::machine_start() -{ - m_nvram_mem.resize(256 / 2); - m_nvram->set_base(&m_nvram_mem[0], 256 / 2); -} - -void rc759_state::machine_reset() -{ -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -static ADDRESS_MAP_START( rc759_map, AS_PROGRAM, 16, rc759_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM - AM_RANGE(0xd8000, 0xdffff) AM_MIRROR(0x08000) AM_RAM AM_SHARE("vram") - AM_RANGE(0xf8000, 0xfffff) AM_MIRROR(0x10000) AM_ROM AM_REGION("bios", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( rc759_io, AS_IO, 16, rc759_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000, 0x003) AM_MIRROR(0x0c) AM_DEVREADWRITE8("pic", pic8259_device, read, write, 0x00ff) - AM_RANGE(0x020, 0x021) AM_READ8(keyboard_r, 0x00ff) - AM_RANGE(0x056, 0x057) AM_NOP // in reality, access to sound and rtc is a bit more involved - AM_RANGE(0x05a, 0x05b) AM_DEVWRITE8("snd", sn76489a_device, write, 0x00ff) - AM_RANGE(0x05c, 0x05d) AM_READWRITE8(rtc_r, rtc_w, 0x00ff) -// AM_RANGE(0x060, 0x06f) AM_WRITE8(crt_control_w, 0x00ff) - AM_RANGE(0x070, 0x077) AM_MIRROR(0x08) AM_DEVREADWRITE8("ppi", i8255_device, read, write, 0x00ff) - AM_RANGE(0x080, 0x0ff) AM_READWRITE8(nvram_r, nvram_w, 0x00ff) -// AM_RANGE(0x100, 0x101) net - AM_RANGE(0x180, 0x1bf) AM_READWRITE8(palette_r, palette_w, 0x00ff) - AM_RANGE(0x230, 0x231) AM_WRITE(txt_irst_w) - AM_RANGE(0x240, 0x241) AM_WRITE(txt_ca_w) - AM_RANGE(0x250, 0x251) AM_READWRITE8(centronics_data_r, centronics_data_w, 0x00ff) - AM_RANGE(0x260, 0x261) AM_READWRITE8(centronics_control_r, centronics_control_w, 0x00ff) - AM_RANGE(0x280, 0x287) AM_DEVREADWRITE8("fdc", wd2797_t, read, write, 0x00ff) - AM_RANGE(0x288, 0x289) AM_WRITE8(floppy_control_w, 0x00ff) -// AM_RANGE(0x28a, 0x28b) external printer data -// AM_RANGE(0x28d, 0x28d) external printer control - AM_RANGE(0x28e, 0x28f) AM_READWRITE8(floppy_ack_r, floppy_reserve_w, 0x00ff) - AM_RANGE(0x290, 0x291) AM_WRITE8(floppy_release_w, 0x00ff) -// AM_RANGE(0x292, 0x293) AM_READWRITE8(printer_ack_r, printer_reserve_w, 0x00ff) -// AM_RANGE(0x294, 0x295) AM_WRITE8(printer_release_w, 0x00ff) - AM_RANGE(0x300, 0x30f) AM_DEVREADWRITE8("isbx", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) - AM_RANGE(0x310, 0x31f) AM_DEVREADWRITE8("isbx", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) -// AM_RANGE(0x320, 0x321) isbx dma ack -// AM_RANGE(0x330, 0x331) isbx tc -ADDRESS_MAP_END - - -//************************************************************************** -// INPUTS -//************************************************************************** - -static INPUT_PORTS_START( rc759 ) - PORT_START("config") - PORT_CONFNAME(0x20, 0x00, "Monitor Type") - PORT_CONFSETTING(0x00, "Color") - PORT_CONFSETTING(0x20, "Monochrome") - PORT_CONFNAME(0x40, 0x00, "Monitor Frequency") - PORT_CONFSETTING(0x00, "15 kHz") - PORT_CONFSETTING(0x40, "22 kHz") -INPUT_PORTS_END - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static SLOT_INTERFACE_START( rc759_floppies ) - SLOT_INTERFACE("hd", FLOPPY_525_HD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( rc759, rc759_state ) - MCFG_CPU_ADD("maincpu", I80186, 6000000) - MCFG_CPU_PROGRAM_MAP(rc759_map) - MCFG_CPU_IO_MAP(rc759_io) - MCFG_80186_IRQ_SLAVE_ACK(READ8(rc759_state, irq_callback)) - MCFG_80186_TMROUT0_HANDLER(WRITELINE(rc759_state, i186_timer0_w)) - MCFG_80186_TMROUT1_HANDLER(WRITELINE(rc759_state, i186_timer1_w)) - - // interrupt controller - MCFG_PIC8259_ADD("pic", DEVWRITELINE("maincpu", i80186_cpu_device, int0_w), VCC, NULL) - - // nvram - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", rc759_state, nvram_init) - - // ppi - MCFG_DEVICE_ADD("ppi", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(rc759_state, ppi_porta_r)) - MCFG_I8255_IN_PORTB_CB(READ8(rc759_state, ppi_portb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(rc759_state, ppi_portc_w)) - - // rtc - MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz) - MCFG_MM58167_IRQ_CALLBACK(DEVWRITELINE("pic", pic8259_device, ir3_w)) - - // video - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(1250000 * 16, 896, 96, 816, 377, 4, 364) // 22 kHz setting - MCFG_SCREEN_UPDATE_DEVICE("txt", i82730_device, screen_update) - - MCFG_I82730_ADD("txt", "maincpu", 1250000) - MCFG_VIDEO_SET_SCREEN("screen") - MCFG_I82730_UPDATE_ROW_CB(rc759_state, txt_update_row) - MCFG_I82730_SINT_HANDLER(DEVWRITELINE("pic", pic8259_device, ir4_w)) - - // keyboard - MCFG_DEVICE_ADD("keyb", GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(rc759_state, keyb_put)) - - // cassette - MCFG_CASSETTE_ADD("cas") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - // sound - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("snd", SN76489A, XTAL_20MHz / 10) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - // internal centronics - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(rc759_state, centronics_busy_w)) - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(rc759_state, centronics_ack_w)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(rc759_state, centronics_fault_w)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(rc759_state, centronics_perror_w)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(rc759_state, centronics_select_w)) - - // isbx slot - MCFG_ISBX_SLOT_ADD("isbx", 0, isbx_cards, NULL) - MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int1_w)) - MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int3_w)) - MCFG_ISBX_SLOT_MDRQT_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq0_w)) - - // floppy disk controller - MCFG_WD2797_ADD("fdc", 1000000) -// MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("pic", pic8259_device, ir0_w)) -// MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq1_w)) - - // floppy drives - MCFG_FLOPPY_DRIVE_ADD("fdc:0", rc759_floppies, "hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", rc759_floppies, "hd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( rc759 ) - ROM_REGION(0x8000, "bios", 0) - ROM_SYSTEM_BIOS(0, "1-21", "1? Version 2.1") - ROMX_LOAD("rc759-1-2.1.rom", 0x0000, 0x8000, CRC(3a777d56) SHA1(a8592d61d5e1f92651a6f5e41c4ba14c9b6cc39b), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "1-51", "1? Version 5.1") - ROMX_LOAD("rc759-1-5.1.rom", 0x0000, 0x8000, CRC(e1d53845) SHA1(902dc5ce28efd26b4f9c631933e197c2c187a7f1), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "2-40", "2? Version 4.0") - ROMX_LOAD("rc759-2-4.0.rom", 0x0000, 0x8000, CRC(d3cb752a) SHA1(f50afe5dfa1b33a36a665d32d57c8c41d6685005), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "2-51", "2? Version 5.1") - ROMX_LOAD("rc759-2-5.1.rom", 0x0000, 0x8000, CRC(00a31948) SHA1(23c4473c641606a56473791773270411d1019248), ROM_BIOS(4)) -ROM_END - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -COMP( 1984, rc759, 0, 0, rc759, rc759, driver_device, 0, "Regnecentralen", "RC759 Piccoline", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/rd110.c b/src/mess/drivers/rd110.c deleted file mode 100644 index 2be9e6d7c11..00000000000 --- a/src/mess/drivers/rd110.c +++ /dev/null @@ -1,278 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert, Jonathan Gevaryahu -/************************************************************************************************* - - Roland D-110 driver - - Driver by Olivier Galibert and Jonathan Gevaryahu - - The Roland D-110 is an expander (synthesizer without the keyboard) - from 1988. Internally it's very similar to a mt32, with a better - LCD screen (16x2) and more control buttons. More importantly, it - has more sound rom, a battery-backed ram and a port for memory - cards allowing to load and save new sounds. - - After the first boot, the ram needs to be reinitialized to factory - default values. Press Write/Copy (I) while resetting then - validate with Enter (K). -*/ - -#include "emu.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "video/msm6222b.h" -#include "cpu/mcs96/i8x9x.h" - -static INPUT_PORTS_START( d110 ) - PORT_START("SC0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Write/Copy") PORT_CODE(KEYCODE_I) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Number +") PORT_CODE(KEYCODE_U) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bank +") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Group +") PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part +") PORT_CODE(KEYCODE_R) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Timbre") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Patch") PORT_CODE(KEYCODE_W) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Exit") PORT_CODE(KEYCODE_Q) - - PORT_START("SC1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Enter") PORT_CODE(KEYCODE_K) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Number -") PORT_CODE(KEYCODE_J) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bank -") PORT_CODE(KEYCODE_H) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Group -") PORT_CODE(KEYCODE_G) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part -") PORT_CODE(KEYCODE_F) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("System") PORT_CODE(KEYCODE_D) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Edit") PORT_CODE(KEYCODE_A) -INPUT_PORTS_END - -class d110_state : public driver_device -{ -public: - required_device cpu; - required_device ram; - required_device rams; - required_device memc; - required_device memcs; - required_device lcd; - required_device midi_timer; - - d110_state(const machine_config &mconfig, device_type type, const char *tag); - - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(d110); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE8_MEMBER(bank_w); - DECLARE_WRITE8_MEMBER(so_w); - DECLARE_WRITE16_MEMBER(midi_w); - - DECLARE_READ8_MEMBER(lcd_ctrl_r); - DECLARE_WRITE8_MEMBER(lcd_ctrl_w); - DECLARE_WRITE8_MEMBER(lcd_data_w); - DECLARE_READ16_MEMBER(port0_r); - - TIMER_DEVICE_CALLBACK_MEMBER(midi_timer_cb); - TIMER_DEVICE_CALLBACK_MEMBER(samples_timer_cb); - -private: - UINT8 lcd_data_buffer[256]; - int lcd_data_buffer_pos; - UINT8 midi; - int midi_pos; - UINT8 port0; - required_device m_maincpu; -}; - -d110_state::d110_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - cpu(*this, "maincpu"), - ram(*this, "ram"), - rams(*this, "rams"), - memc(*this, "memc"), - memcs(*this, "memcs"), - lcd(*this, "lcd"), - midi_timer(*this, "midi_timer") -, - m_maincpu(*this, "maincpu") { -} - - -UINT32 d110_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0); - const UINT8 *data = lcd->render(); - for(int l=0; l<2; l++) - for(int c=0; c<20; c++) - for(int y=0; y<8; y++) { - UINT8 v = data[c*16 + l*40*16 + y]; - for(int x=0; x<5; x++) - bitmap.pix16(y+9*l, c*6+x) = v & (0x10 >> x) ? 1 : 0; - } - return 0; -} - -void d110_state::machine_start() -{ - rams->set_base(ram->pointer(), 32768); - memcs->set_base(memc->pointer(), 32768); - - membank("bank")->configure_entries(0x00, 4, memregion("maincpu")->base(), 0x4000); - membank("bank")->configure_entries(0x10, 2, ram->pointer(), 0x4000); - membank("bank")->configure_entries(0x20, 8, memregion("presets")->base(), 0x4000); - membank("bank")->configure_entries(0x30, 2, memc->pointer(), 0x4000); - membank("fixed")->set_base(ram->pointer()); - - lcd_data_buffer_pos = 0; -} - -void d110_state::machine_reset() -{ - // midi_timer->adjust(attotime::from_hz(1)); - midi_pos = 0; - port0 = 0x80; // battery ok -} - -WRITE8_MEMBER(d110_state::lcd_ctrl_w) -{ - lcd->control_w(data); - for(int i=0; i != lcd_data_buffer_pos; i++) - lcd->data_w(lcd_data_buffer[i]); - lcd_data_buffer_pos = 0; -} - -READ8_MEMBER(d110_state::lcd_ctrl_r) -{ - // Busy flag in the msm622b is bit 7, while the software expects it in bit 0... - return lcd->control_r() >> 7; -} - -WRITE8_MEMBER(d110_state::lcd_data_w) -{ - if(lcd_data_buffer_pos == sizeof(lcd_data_buffer)) { - logerror("Warning: lcd data buffer overflow (%04x)\n", cpu->pc()); - return; - } - lcd_data_buffer[lcd_data_buffer_pos++] = data; -} - -WRITE8_MEMBER(d110_state::bank_w) -{ - membank("bank")->set_entry(data); -} - -WRITE16_MEMBER(d110_state::midi_w) -{ - logerror("midi_out %02x\n", data); - midi = data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(d110_state::midi_timer_cb) -{ - const static UINT8 midi_data[3] = { 0x91, 0x40, 0x7f }; - midi = midi_data[midi_pos++]; - logerror("midi_in %02x\n", midi); - cpu->serial_w(midi); - if(midi_pos < sizeof(midi_data)) - midi_timer->adjust(attotime::from_hz(1250)); -} - -READ16_MEMBER(d110_state::port0_r) -{ - return port0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(d110_state::samples_timer_cb) -{ - port0 ^= 0x10; -} - -WRITE8_MEMBER(d110_state::so_w) -{ - // bit 0 = led - // bit 1-2 = reverb program a13/a14 - // bit 3 = R. SW. to ananlog board - // bit 5 = boss 8Mhz clock, handled internally - // logerror("so: rw=%d bank=%d led=%d\n", (data >> 3) & 1, (data >> 1) & 3, data & 1); -} - -PALETTE_INIT_MEMBER(d110_state, d110) -{ - palette.set_pen_color(0, rgb_t(0, 255, 0)); - palette.set_pen_color(1, rgb_t(0, 0, 0)); -} - -static ADDRESS_MAP_START( d110_map, AS_PROGRAM, 8, d110_state ) - AM_RANGE(0x0100, 0x0100) AM_WRITE(bank_w) - AM_RANGE(0x0200, 0x0200) AM_WRITE(so_w) - AM_RANGE(0x021a, 0x021a) AM_READ_PORT("SC0") AM_WRITENOP - AM_RANGE(0x021c, 0x021c) AM_READ_PORT("SC1") - AM_RANGE(0x0300, 0x0300) AM_WRITE(lcd_data_w) - AM_RANGE(0x0380, 0x0380) AM_READWRITE(lcd_ctrl_r, lcd_ctrl_w) - AM_RANGE(0x1000, 0x7fff) AM_ROM AM_REGION("maincpu", 0x1000) - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("fixed") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( d110_io, AS_IO, 16, d110_state ) - AM_RANGE(i8x9x_device::SERIAL, i8x9x_device::SERIAL) AM_WRITE(midi_w) - AM_RANGE(i8x9x_device::P0, i8x9x_device::P0) AM_READ(port0_r) -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( d110, d110_state ) - MCFG_CPU_ADD( "maincpu", P8098, XTAL_12MHz ) - MCFG_CPU_PROGRAM_MAP( d110_map ) - MCFG_CPU_IO_MAP( d110_io ) - -// Battery-backed main ram - MCFG_RAM_ADD( "ram" ) - MCFG_RAM_DEFAULT_SIZE( "32K" ) - MCFG_NVRAM_ADD_0FILL( "rams" ) - - -// Shall become a proper memcard device someday - MCFG_RAM_ADD( "memc" ) - MCFG_RAM_DEFAULT_SIZE( "32K" ) - MCFG_NVRAM_ADD_0FILL( "memcs" ) - - MCFG_SCREEN_ADD( "screen", LCD ) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DRIVER(d110_state, screen_update) -// MCFG_SCREEN_SIZE(20*6-1, 2*9-1) - MCFG_SCREEN_SIZE(16*6-1, (16*6-1)*3/4) - MCFG_SCREEN_VISIBLE_AREA(0, 16*6-2, 0, (16*6-1)*3/4-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(d110_state, d110) - - MCFG_MSM6222B_01_ADD( "lcd" ) - - MCFG_TIMER_DRIVER_ADD( "midi_timer", d110_state, midi_timer_cb ) - - MCFG_TIMER_DRIVER_ADD_PERIODIC( "samples_timer", d110_state, samples_timer_cb, attotime::from_hz(32000*2) ) -MACHINE_CONFIG_END - -ROM_START( d110 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_DEFAULT_BIOS( "110" ) - - ROM_SYSTEM_BIOS( 0, "106", "Firmware 1.06" ) - ROMX_LOAD( "d-110.v1.06.ic19.bin", 0, 0x8000, CRC(3dd5b6e9) SHA1(73b155fb0a8adc2362e73cb0803dafba9ccfb508), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "110", "Firmware 1.10" ) - ROMX_LOAD( "d-110.v1.10.ic19.bin", 0, 0x8000, CRC(3ae68187) SHA1(28635510f30d6c1fb88e00da03e5b4e045c380cb), ROM_BIOS(2) ) - - ROM_REGION( 0x20000, "presets", 0 ) - ROM_LOAD( "r15179873-lh5310-97.ic12.bin", 0, 0x20000, CRC(580a8f9e) SHA1(05587a0542b01625dcde37de5bb339880e47eb93) ) - - ROM_REGION( 0x100000, "la32", 0 ) - ROM_LOAD( "r15179878.ic7.bin", 0, 0x80000, CRC(e117e6ab) SHA1(6760d14900161b8715c2bfd4ebe997877087c90c) ) - ROM_LOAD( "r15179880.ic8.bin", 0x80000, 0x80000, CRC(b329f945) SHA1(9c59f50518a070461b2ec6cb4e43ee7cc1e905b6) ) - - ROM_REGION( 0x8000, "boss", 0 ) - ROM_LOAD( "r15179879.ic6.bin", 0, 0x8000, CRC(5d34174e) SHA1(17bd2887711c5c5458aba6d3be5972b2096eb450) ) -ROM_END - -CONS( 1988, d110, 0, 0, d110, d110, driver_device, 0, "Roland", "D110", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/replicator.c b/src/mess/drivers/replicator.c deleted file mode 100644 index 340d422c682..00000000000 --- a/src/mess/drivers/replicator.c +++ /dev/null @@ -1,751 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Felipe Sanches -/* - Replicator 1 desktop 3d printer - - driver by Felipe Correa da Silva Sanches - -Changelog: - - 2013 DEC 28 [Felipe Sanches]: - * LCD now works. We can see the firmware boot screen :-) - - 2013 DEC 24 [Felipe Sanches]: - * declaration of internal EEPROM - - 2013 DEC 18 [Felipe Sanches]: - * Initial driver skeleton - -*/ - -// TODO: -// * figure out what's wrong with the keypad inputs (interface seems to be blocked in the first screen) -// * fix avr8 timer/counter #0 (toggle OC0B) and #5 (overflow interrupt "Microsecond timer") so that we get the buzzer to work -// * figure-out correct size of internal EEPROM -// * emulate an SD Card -// * implement avr8 WDR (watchdog reset) opcode - -#include "emu.h" -#include "cpu/avr8/avr8.h" -#include "video/hd44780.h" -#include "rendlay.h" -#include "debugger.h" -#include "sound/dac.h" - -#define MASTER_CLOCK 16000000 - -#define LOG_PORTS 0 - -//Port A bits: -//Bit 0 unused -//Bit 1 unused -#define A_AXIS_DIR (1 << 2) -#define A_AXIS_STEP (1 << 3) -#define A_AXIS_EN (1 << 4) -#define A_AXIS_POT (1 << 5) -#define B_AXIS_DIR (1 << 6) -#define B_AXIS_STEP (1 << 7) - -//Port B bits: -#define SD_CS (1 << 0) -#define SCK_1280 (1 << 1) -#define MOSI_1280 (1 << 2) -#define MISO_1280 (1 << 3) -#define EX2_PWR_CHECK (1 << 4) -#define EX2_HEAT (1 << 5) -#define EX2_FAN (1 << 6) -#define BLINK (1 << 7) - -//Port C bits: -#define EX2_1280 (1 << 0) -#define EX1_1280 (1 << 1) -#define LCD_CLK (1 << 2) -#define LCD_DATA (1 << 3) -#define LCD_STROBE (1 << 4) -#define RLED (1 << 5) -#define GLED (1 << 6) -#define DETECT (1 << 7) - -//Port D bits: -#define PORTD_SCL (1 << 0) -#define PORTD_SDA (1 << 1) -#define EX_RX_1280 (1 << 2) -#define EX_TX_1280 (1 << 3) -//Bit 4 unused -//Bit 5 unused -//Bit 6 unused -//Bit 7 unused - -//Port E bits: -#define RX_1280 (1 << 0) -#define TX_1280 (1 << 1) -#define THERMO_SCK (1 << 2) -#define THERMO_CS1 (1 << 3) -#define THERMO_CS2 (1 << 4) -#define THERMO_DO (1 << 5) -//Bit 6 unused -//Bit 7 unused - -//Port F bits: -#define X_AXIS_DIR (1 << 0) -#define X_AXIS_STEP (1 << 1) -#define X_AXIS_EN (1 << 2) -#define X_AXIS_POT (1 << 3) -#define Y_AXIS_DIR (1 << 4) -#define Y_AXIS_STEP (1 << 5) -#define Y_AXIS_EN (1 << 6) -#define Y_AXIS_POT (1 << 7) - -//Port G bits: -#define EX4_1280 (1 << 0) -#define EX3_1280 (1 << 1) -#define B_AXIS_EN (1 << 2) -//Bit 3 unused -#define CUTOFF_SR_CHECK (1 << 4) -#define BUZZ (1 << 5) -//Bit 6 unused -//Bit 7 unused - -//Port H bits: -#define CUTOFF_TEST (1 << 0) -#define CUTOFF_RESET (1 << 1) -#define EX1_PWR_CHECK (1 << 2) -#define EX1_HEAT (1 << 3) -#define EX1_FAN (1 << 4) -#define SD_WP (1 << 5) -#define SD_CD (1 << 6) -//Bit 7 unused - -//Port J bits: -#define BUTTON_CENTER (1 << 0) -#define BUTTON_RIGHT (1 << 1) -#define BUTTON_LEFT (1 << 2) -#define BUTTON_DOWN (1 << 3) -#define BUTTON_UP (1 << 4) -#define POTS_SCL (1 << 5) -#define B_AXIS_POT (1 << 6) -//Bit 7 unused - -//Port K bits: -#define Z_AXIS_DIR (1 << 0) -#define Z_AXIS_STEP (1 << 1) -#define Z_AXIS_EN (1 << 2) -#define Z_AXIS_POT (1 << 3) -#define EX7_1280 (1 << 4) -#define EX6_1280 (1 << 5) -#define EX5_1280 (1 << 6) -#define HBP_THERM (1 << 7) - -//Port L bits: -#define X_MIN (1 << 0) -#define X_MAX (1 << 1) -#define Y_MIN (1 << 2) -#define Y_MAX (1 << 3) -#define HBP (1 << 4) -#define EXTRA_FET (1 << 5) -#define Z_MIN (1 << 6) -#define Z_MAX (1 << 7) - -/****************************************************\ -* I/O devices * -\****************************************************/ - -class replicator_state : public driver_device -{ -public: - replicator_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_lcdc(*this, "hd44780"), - m_dac(*this, "dac") - { - } - - virtual void machine_start(); - - UINT8 m_port_a; - UINT8 m_port_b; - UINT8 m_port_c; - UINT8 m_port_d; - UINT8 m_port_e; - UINT8 m_port_f; - UINT8 m_port_g; - UINT8 m_port_h; - UINT8 m_port_j; - UINT8 m_port_k; - UINT8 m_port_l; - - UINT8 shift_register_value; - - required_device m_maincpu; - required_device m_lcdc; - required_device m_dac; - - DECLARE_READ8_MEMBER(port_r); - DECLARE_WRITE8_MEMBER(port_w); - DECLARE_DRIVER_INIT(replicator); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(replicator); -}; - -void replicator_state::machine_start() -{ -} - -READ8_MEMBER(replicator_state::port_r) -{ - switch( offset ) - { - case AVR8_IO_PORTA: - { -#if LOG_PORTS - printf("[%08X] Port A READ (A-axis signals + B-axis STEP&DIR)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - case AVR8_IO_PORTB: - { -#if LOG_PORTS - printf("[%08X] Port B READ (SD-CS; 1280-MISO/MOSI/SCK; EX2-FAN/HEAT/PWR-CHECK; BLINK)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - case AVR8_IO_PORTC: - { -#if LOG_PORTS - printf("[%08X] Port C READ (1280-EX1/EX2; LCD-signals; R&G-LED; DETECT)\n", m_maincpu->m_shifted_pc); -#endif - return DETECT; //indicated that the Interface board is present. - } - case AVR8_IO_PORTD: - { -#if LOG_PORTS - printf("[%08X] Port D READ (SDA/SCL; 1280-EX-TX/RX)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - case AVR8_IO_PORTE: - { -#if LOG_PORTS - printf("[%08X] Port E READ (1280-TX/RX; THERMO-signals)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - case AVR8_IO_PORTF: - { -#if LOG_PORTS - printf("[%08X] Port F READ (X-axis & Y-axis signals)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - case AVR8_IO_PORTG: - { -#if LOG_PORTS - printf("[%08X] Port G READ (BUZZ; Cutoff-sr-check; B-axis EN; 1280-EX3/EX4)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - case AVR8_IO_PORTH: - { -#if LOG_PORTS - printf("[%08X] Port H READ (cuttoff-text/reset; EX1-FAN/HEAT/PWR-CHECK; SD-CD/SD-WP)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - case AVR8_IO_PORTJ: - { -#if LOG_PORTS - printf("[%08X] Port J READ (Interface buttons; POTS-SCL; B-axis-POT)\n", m_maincpu->m_shifted_pc); -#endif - return ioport("keypad")->read(); - } - case AVR8_IO_PORTK: - { -#if LOG_PORTS - printf("[%08X] Port K READ (Z-axis signals; HBP-THERM; 1280-EX5/6/7)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - case AVR8_IO_PORTL: - { -#if LOG_PORTS - printf("[%08X] Port L READ (HBP; EXTRA-FET; X-MIN/MAX; Y-MIN/MAX; Z-MIN/MAX)\n", m_maincpu->m_shifted_pc); -#endif - return 0x00; - } - } - return 0; -} - -WRITE8_MEMBER(replicator_state::port_w) -{ - switch( offset ) - { - case AVR8_IO_PORTA: - { - if (data == m_port_a) break; - -#if LOG_PORTS - UINT8 old_port_a = m_port_a; - UINT8 changed = data ^ old_port_a; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - if(changed & A_AXIS_DIR) printf("[A] A_AXIS_DIR: %s\n", data & A_AXIS_DIR ? "HIGH" : "LOW"); - if(changed & A_AXIS_STEP) printf("[A] A_AXIS_STEP: %s\n", data & A_AXIS_STEP ? "HIGH" : "LOW"); - if(changed & A_AXIS_EN) printf("[A] A_AXIS_EN: %s\n", data & A_AXIS_EN ? "HIGH" : "LOW"); - if(changed & A_AXIS_POT) printf("[A] A_AXIS_POT: %s\n", data & A_AXIS_POT ? "HIGH" : "LOW"); - if(changed & B_AXIS_DIR) printf("[A] B_AXIS_DIR: %s\n", data & B_AXIS_DIR ? "HIGH" : "LOW"); - if(changed & B_AXIS_STEP) printf("[A] B_AXIS_STEP: %s\n", data & B_AXIS_STEP ? "HIGH" : "LOW"); -#endif - - m_port_a = data; - break; - } - case AVR8_IO_PORTB: - { - if (data == m_port_b) break; - -#if LOG_PORTS - UINT8 old_port_b = m_port_b; - UINT8 changed = data ^ old_port_b; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - if(changed & SD_CS) printf("[B] SD Card Chip Select: %s\n", data & SD_CS ? "HIGH" : "LOW"); - if(changed & SCK_1280) printf("[B] 1280-SCK: %s\n", data & SCK_1280 ? "HIGH" : "LOW"); - if(changed & MOSI_1280) printf("[B] 1280-MOSI: %s\n", data & MOSI_1280 ? "HIGH" : "LOW"); - if(changed & MISO_1280) printf("[B] 1280-MISO: %s\n", data & MISO_1280 ? "HIGH" : "LOW"); - if(changed & EX2_PWR_CHECK) printf("[B] EX2-PWR-CHECK: %s\n", data & EX2_PWR_CHECK ? "HIGH" : "LOW"); - if(changed & EX2_HEAT) printf("[B] EX2_HEAT: %s\n", data & EX2_HEAT ? "HIGH" : "LOW"); - if(changed & EX2_FAN) printf("[B] EX2_FAN: %s\n", data & EX2_FAN ? "HIGH" : "LOW"); - if(changed & BLINK) printf("[B] BLINK: %s\n", data & BLINK ? "HIGH" : "LOW"); -#endif - - m_port_b = data; - break; - } - case AVR8_IO_PORTC: - { - if (data == m_port_c) break; - - UINT8 old_port_c = m_port_c; - UINT8 changed = data ^ old_port_c; -#if LOG_PORTS - printf("[%08X] ", m_maincpu->m_shifted_pc); - if(changed & EX2_1280) printf("[C] EX2_1280: %s\n", data & EX2_1280 ? "HIGH" : "LOW"); - if(changed & EX1_1280) printf("[C] EX1_1280: %s\n", data & EX1_1280 ? "HIGH" : "LOW"); - if(changed & LCD_CLK) printf("[C] LCD_CLK: %s\n", data & LCD_CLK ? "HIGH" : "LOW"); - if(changed & LCD_DATA) printf("[C] LCD_DATA: %s\n", data & LCD_DATA ? "HIGH" : "LOW"); - if(changed & LCD_STROBE) printf("[C] LCD_STROBE: %s\n", data & LCD_STROBE ? "HIGH" : "LOW"); - if(changed & RLED) printf("[C] RLED: %s\n", data & RLED ? "HIGH" : "LOW"); - if(changed & GLED) printf("[C] GLED: %s\n", data & GLED ? "HIGH" : "LOW"); - if(changed & DETECT) printf("[C] DETECT: %s\n", data & DETECT ? "HIGH" : "LOW"); -#endif - - if (changed & LCD_CLK){ - /* The LCD is interfaced by an 8-bit shift register (74HC4094). */ - if (data & LCD_CLK){//CLK positive edge - shift_register_value = (shift_register_value << 1) | ((data & LCD_DATA) >> 3); - //printf("[%08X] ", m_maincpu->m_shifted_pc); - //printf("[C] LCD CLK positive edge. shift_register=0x%02X\n", shift_register_value); - } - } - - if(changed & LCD_STROBE){ - if (data & LCD_STROBE){ //STROBE positive edge - bool RS = (shift_register_value >> 1) & 1; - bool RW = (shift_register_value >> 2) & 1; - bool enable = (shift_register_value >> 3) & 1; - UINT8 lcd_data = shift_register_value & 0xF0; - - if (enable && RW==0){ - if (RS==0){ - m_lcdc->control_write(space, 0, lcd_data); - } else { - m_lcdc->data_write(space, 0, lcd_data); - } - } - } - } - m_port_c = data; - - break; - } - case AVR8_IO_PORTD: - { - if (data == m_port_d) break; - -#if LOG_PORTS - UINT8 old_port_d = m_port_d; - UINT8 changed = data ^ old_port_d; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - if(changed & PORTD_SCL) printf("[D] PORTD_SCL: %s\n", data & PORTD_SCL ? "HIGH" : "LOW"); - if(changed & PORTD_SDA) printf("[D] PORTD_SDA: %s\n", data & PORTD_SDA ? "HIGH" : "LOW"); - if(changed & EX_RX_1280) printf("[D] EX_RX_1280: %s\n", data & EX_RX_1280 ? "HIGH" : "LOW"); - if(changed & EX_TX_1280) printf("[D] EX_TX_1280: %s\n", data & EX_TX_1280 ? "HIGH" : "LOW"); -#endif - - m_port_d = data; - break; - } - case AVR8_IO_PORTE: - { - if (data == m_port_e) break; - -#if LOG_PORTS - UINT8 old_port_e = m_port_e; - UINT8 changed = data ^ old_port_e; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - if(changed & RX_1280) printf("[E] 1280-RX: %s\n", data & RX_1280 ? "HIGH" : "LOW"); - if(changed & TX_1280) printf("[E] 1280-TX: %s\n", data & TX_1280 ? "HIGH" : "LOW"); - if(changed & THERMO_SCK) printf("[E] THERMO-SCK: %s\n", data & THERMO_SCK ? "HIGH" : "LOW"); - if(changed & THERMO_CS1) printf("[E] THERMO-CS1: %s\n", data & THERMO_CS1 ? "HIGH" : "LOW"); - if(changed & THERMO_CS2) printf("[E] THERMO-CS2: %s\n", data & THERMO_CS2 ? "HIGH" : "LOW"); - if(changed & THERMO_DO) printf("[E] THERMO-DO: %s\n", data & THERMO_DO ? "HIGH" : "LOW"); -#endif - - m_port_e = data; - break; - } - case AVR8_IO_PORTF: - { - if (data == m_port_f) break; - -#if LOG_PORTS - UINT8 old_port_f = m_port_f; - UINT8 changed = data ^ old_port_f; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - if(changed & X_AXIS_DIR) printf("[F] X_AXIS_DIR: %s\n", data & X_AXIS_DIR ? "HIGH" : "LOW"); - if(changed & X_AXIS_STEP) printf("[F] X_AXIS_STEP: %s\n", data & X_AXIS_STEP ? "HIGH" : "LOW"); - if(changed & X_AXIS_EN) printf("[F] X_AXIS_EN: %s\n", data & X_AXIS_EN ? "HIGH" : "LOW"); - if(changed & X_AXIS_POT) printf("[F] X_AXIS_POT: %s\n", data & X_AXIS_POT ? "HIGH" : "LOW"); - if(changed & Y_AXIS_DIR) printf("[F] Y_AXIS_DIR: %s\n", data & Y_AXIS_DIR ? "HIGH" : "LOW"); - if(changed & Y_AXIS_STEP) printf("[F] Y_AXIS_STEP: %s\n", data & Y_AXIS_STEP ? "HIGH" : "LOW"); - if(changed & Y_AXIS_EN) printf("[F] Y_AXIS_EN: %s\n", data & Y_AXIS_EN ? "HIGH" : "LOW"); - if(changed & Y_AXIS_POT) printf("[F] Y_AXIS_POT: %s\n", data & Y_AXIS_POT ? "HIGH" : "LOW"); -#endif - - m_port_f = data; - break; - } - case AVR8_IO_PORTG: - { - if (data == m_port_g) break; - - UINT8 old_port_g = m_port_g; - UINT8 changed = data ^ old_port_g; - -#if LOG_PORTS - printf("[%08X] ", m_maincpu->m_shifted_pc); - if(changed & EX4_1280) printf("[G] EX4_1280: %s\n", data & EX4_1280 ? "HIGH" : "LOW"); - if(changed & EX3_1280) printf("[G] EX3_1280: %s\n", data & EX3_1280 ? "HIGH" : "LOW"); - if(changed & B_AXIS_EN) printf("[G] B_AXIS_EN: %s\n", data & B_AXIS_EN ? "HIGH" : "LOW"); - if(changed & CUTOFF_SR_CHECK) printf("[G] CUTOFF_SR_CHECK: %s\n", data & CUTOFF_SR_CHECK ? "HIGH" : "LOW"); - if(changed & BUZZ) printf("[G] BUZZ: %s\n", data & BUZZ ? "HIGH" : "LOW"); -#endif - - if(changed & BUZZ){ - /* FIX-ME: What is the largest sample value allowed? - I'm using 0x3F based on what I see in src/mess/drivers/craft.c - But as the method is called "write_unsigned8", I guess we could have samples with values up to 0xFF, right? - Anyway... With the 0x3F value we'll get a sound that is not so loud, which may be less annoying... :-) - */ - UINT8 audio_sample = (data & BUZZ) ? 0x3F : 0; - m_dac->write_unsigned8(audio_sample << 1); - } - - m_port_g = data; - break; - } - case AVR8_IO_PORTH: - { - if (data == m_port_h) break; - -#if LOG_PORTS - UINT8 old_port_h = m_port_h; - UINT8 changed = data ^ old_port_h; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - if(changed & CUTOFF_TEST) printf("[H] CUTOFF_TEST: %s\n", data & CUTOFF_TEST ? "HIGH" : "LOW"); - if(changed & CUTOFF_RESET) printf("[H] CUTOFF_RESET: %s\n", data & CUTOFF_RESET ? "HIGH" : "LOW"); - if(changed & EX1_PWR_CHECK) printf("[H] EX1_PWR_CHECK: %s\n", data & EX1_PWR_CHECK ? "HIGH" : "LOW"); - if(changed & EX1_HEAT) printf("[H] EX1_HEAT: %s\n", data & EX1_HEAT ? "HIGH" : "LOW"); - if(changed & EX1_FAN) printf("[H] EX1_FAN: %s\n", data & EX1_FAN ? "HIGH" : "LOW"); - if(changed & SD_WP) printf("[H] SD_WP: %s\n", data & SD_WP ? "HIGH" : "LOW"); - if(changed & SD_CD) printf("[H] SD_CD: %s\n", data & SD_CD ? "HIGH" : "LOW"); -#endif - - m_port_h = data; - break; - } - case AVR8_IO_PORTJ: - { - if (data == m_port_j) break; - -#if LOG_PORTS - UINT8 old_port_j = m_port_j; - UINT8 changed = data ^ old_port_j; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - - if(changed & BUTTON_CENTER) printf("[J] BUTTON_CENTER: %s\n", data & BUTTON_CENTER ? "HIGH" : "LOW"); - if(changed & BUTTON_RIGHT) printf("[J] BUTTON_RIGHT: %s\n", data & BUTTON_RIGHT ? "HIGH" : "LOW"); - if(changed & BUTTON_LEFT) printf("[J] BUTTON_LEFT: %s\n", data & BUTTON_LEFT ? "HIGH" : "LOW"); - if(changed & BUTTON_DOWN) printf("[J] BUTTON_DOWN: %s\n", data & BUTTON_DOWN ? "HIGH" : "LOW"); - if(changed & BUTTON_UP) printf("[J] BUTTON_UP: %s\n", data & BUTTON_UP ? "HIGH" : "LOW"); - if(changed & POTS_SCL) printf("[J] POTS_SCL: %s\n", data & POTS_SCL ? "HIGH" : "LOW"); - if(changed & B_AXIS_POT) printf("[J] B_AXIS_POT: %s\n", data & B_AXIS_POT ? "HIGH" : "LOW"); -#endif - - m_port_j = data; - break; - } - case AVR8_IO_PORTK: - { - if (data == m_port_k) break; - -#if LOG_PORTS - UINT8 old_port_k = m_port_k; - UINT8 changed = data ^ old_port_k; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - - if(changed & Z_AXIS_DIR) printf("[K] Z_AXIS_DIR: %s\n", data & Z_AXIS_DIR ? "HIGH" : "LOW"); - if(changed & Z_AXIS_STEP) printf("[K] Z_AXIS_STEP: %s\n", data & Z_AXIS_STEP ? "HIGH" : "LOW"); - if(changed & Z_AXIS_EN) printf("[K] Z_AXIS_EN: %s\n", data & Z_AXIS_EN ? "HIGH" : "LOW"); - if(changed & Z_AXIS_POT) printf("[K] Z_AXIS_POT: %s\n", data & Z_AXIS_POT ? "HIGH" : "LOW"); - if(changed & EX7_1280) printf("[K] EX7_1280: %s\n", data & EX7_1280 ? "HIGH" : "LOW"); - if(changed & EX6_1280) printf("[K] EX6_1280: %s\n", data & EX6_1280 ? "HIGH" : "LOW"); - if(changed & EX5_1280) printf("[K] EX5_1280: %s\n", data & EX5_1280 ? "HIGH" : "LOW"); - if(changed & HBP_THERM) printf("[K] HBP_THERM: %s\n", data & HBP_THERM ? "HIGH" : "LOW"); -#endif - - m_port_k = data; - break; - } - case AVR8_IO_PORTL: - { - if (data == m_port_l) break; - -#if LOG_PORTS - UINT8 old_port_l = m_port_l; - UINT8 changed = data ^ old_port_l; - - printf("[%08X] ", m_maincpu->m_shifted_pc); - - if(changed & X_MIN) printf("[L] X_MIN: %s\n", data & X_MIN ? "HIGH" : "LOW"); - if(changed & X_MAX) printf("[L] X_MAX: %s\n", data & X_MAX ? "HIGH" : "LOW"); - if(changed & Y_MIN) printf("[L] Y_MIN: %s\n", data & Y_MIN ? "HIGH" : "LOW"); - if(changed & Y_MAX) printf("[L] Y_MAX: %s\n", data & Y_MAX ? "HIGH" : "LOW"); - if(changed & HBP) printf("[L] HBP: %s\n", data & HBP ? "HIGH" : "LOW"); - if(changed & EXTRA_FET) printf("[L] EXTRA_FET: %s\n", data & EXTRA_FET ? "HIGH" : "LOW"); - if(changed & Z_MIN) printf("[L] Z_MIN: %s\n", data & Z_MIN ? "HIGH" : "LOW"); - if(changed & Z_MAX) printf("[L] Z_MAX: %s\n", data & Z_MAX ? "HIGH" : "LOW"); -#endif - - m_port_l = data; - break; - } - } -} - -/****************************************************\ -* Address maps * -\****************************************************/ - -static ADDRESS_MAP_START( replicator_prg_map, AS_PROGRAM, 8, replicator_state ) - AM_RANGE(0x0000, 0x1FFFF) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( replicator_data_map, AS_DATA, 8, replicator_state ) - AM_RANGE(0x0200, 0x21FF) AM_RAM /* ATMEGA1280 Internal SRAM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( replicator_io_map, AS_IO, 8, replicator_state ) - AM_RANGE(AVR8_IO_PORTA, AVR8_IO_PORTL) AM_READWRITE( port_r, port_w ) -ADDRESS_MAP_END - -/****************************************************\ -* Input ports * -\****************************************************/ - -static INPUT_PORTS_START( replicator ) - PORT_START("keypad") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CENTER") PORT_CODE(KEYCODE_M) - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_D) - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_A) - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_S) - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_W) -INPUT_PORTS_END - -/****************************************************\ -* Machine definition * -\****************************************************/ - -DRIVER_INIT_MEMBER(replicator_state, replicator) -{ -} - -void replicator_state::machine_reset() -{ - shift_register_value = 0; - m_port_a = 0; - m_port_b = 0; - m_port_c = 0; - m_port_d = 0; - m_port_e = 0; - m_port_f = 0; - m_port_g = 0; - m_port_h = 0; - m_port_j = 0; - m_port_k = 0; - m_port_l = 0; -} - -PALETTE_INIT_MEMBER(replicator_state, replicator) -{ -//These colors were picked with the color picker in Inkscape, based on a photo of the LCD used in the Replicator 1 3d printer: - palette.set_pen_color(0, rgb_t(0xCA, 0xE7, 0xEB)); - palette.set_pen_color(1, rgb_t(0x78, 0xAB, 0xA8)); -} - -static const gfx_layout hd44780_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( replicator ) - GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, hd44780_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( replicator, replicator_state ) - - MCFG_CPU_ADD("maincpu", ATMEGA1280, MASTER_CLOCK) - MCFG_CPU_PROGRAM_MAP(replicator_prg_map) - MCFG_CPU_DATA_MAP(replicator_data_map) - MCFG_CPU_IO_MAP(replicator_io_map) - - MCFG_CPU_AVR8_EEPROM("eeprom") - MCFG_CPU_AVR8_LFUSE(0xFF) - MCFG_CPU_AVR8_HFUSE(0xDA) - MCFG_CPU_AVR8_EFUSE(0xF4) - MCFG_CPU_AVR8_LOCK(0x0F) - - /*TODO: Add an ATMEGA8U2 for USB-Serial communications */ - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_SIZE(120, 18*2) //4x20 chars - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18*2-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(replicator_state, replicator) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", replicator) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(4, 20) - - /* sound hardware */ - /* A piezo is connected to the PORT G bit 5 (OC0B pin driven by Timer/Counter #4) */ - MCFG_SPEAKER_STANDARD_MONO("buzzer") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(0, "buzzer", 1.00) - -MACHINE_CONFIG_END - -ROM_START( replica1 ) - ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_DEFAULT_BIOS("v750") - - /* Version 5.1 release: - - Initial firmware release - */ - ROM_SYSTEM_BIOS( 0, "v51", "V 5.1" ) - ROMX_LOAD("mighty-mb40-v5.1.bin", 0x0000, 0x10b90, CRC(20d65cd1) SHA1(da18c3eb5a29a6bc1eecd92eaae6063fe29d0305), ROM_BIOS(1)) - - /* Version 5.2 release: - - Nozzle Tolerance added to EEPROM - - Updated onboard menus - - X,Y calibration tool added - */ - ROM_SYSTEM_BIOS( 1, "v52", "V 5.2" ) - ROMX_LOAD("mighty-mb40-v5.2.bin", 0x0000, 0x126c4, CRC(555e47cf) SHA1(9d24a3dbeddce16669bb4d29c3366220ddf15d2a), ROM_BIOS(2)) - - /* Version 5.5 release: - - Acceleration added to motor motion - - Digipot updates - */ - ROM_SYSTEM_BIOS( 2, "v55", "V 5.5" ) - ROMX_LOAD("mighty-mb40-v5.5.bin", 0x0000, 0x1a420, CRC(9327d7e4) SHA1(d734ba2bda12f50ec3ac0035ab11591909d9edde), ROM_BIOS(3)) - - /* Version 6.2.0 release: - - Bug fix release to firmware 6.0 - - Addresses wavy print issue above 1cm - - Left extruder prints with makerware. - */ - ROM_SYSTEM_BIOS( 3, "v620", "V 6.2.0" ) - ROMX_LOAD("mighty_one_v6.2.0.bin", 0x0000, 0x1cf54, CRC(00df6f48) SHA1(db05afc2e1ebc104fb04753634a911187e396556), ROM_BIOS(4)) - - /* Version 7.0.0 release: - - Major upgrade to Stepper Motor Smoothness (via Sailfish team) - - X3G format introduced - - Heaters default to leaving 'preheat' on more of the time - */ - ROM_SYSTEM_BIOS( 4, "v700", "V 7.0.0" ) - ROMX_LOAD("mighty_one_v7.0.0.bin", 0x0000, 0x1cb52, CRC(aa2a5fcf) SHA1(934e642b0b2d007689249680bad03c9255ae016a), ROM_BIOS(5)) - - /* Version 7.2.0 release: - - Removes support for S3G files - - X3G is the recognized format - - Minor bug fixes - */ - ROM_SYSTEM_BIOS( 5, "v720", "V 7.2.0" ) - ROMX_LOAD("mighty_one_v7.2.0.bin", 0x0000, 0x1cb80, CRC(5e546706) SHA1(ed4aaf7522d5a5beea7eb69bf2c85d7a89f8f188), ROM_BIOS(6)) - - /* Version 7.3.0 release: - - Pause at Z Height - - Elapsed time displays during prints - - Minor bug fixes - */ - ROM_SYSTEM_BIOS( 6, "v730", "V 7.3.0" ) - ROMX_LOAD("mighty_one_v7.3.0.bin", 0x0000, 0x1d738, CRC(71811ff5) SHA1(6728ea600ab3ff4b589adca90b0d700d9b70bd18), ROM_BIOS(7)) - - /* Version 7.4.0 (bugfix) release: - - Fixes issues with Z Pause and elapsed print time - */ - ROM_SYSTEM_BIOS( 7, "v740", "V 7.4.0" ) - ROMX_LOAD("mighty_one_v7.4.0.bin", 0x0000, 0x1b9e2, CRC(97b05a27) SHA1(76ca2c9c1db2e006e501c3177a8a1aa693dda0f9), ROM_BIOS(8)) - - /* Version 7.5.0 (bugfix) release: - - Fixes issue with Heat Hold - */ - ROM_SYSTEM_BIOS( 8, "v750", "V 7.5.0" ) - ROMX_LOAD("mighty_one_v7.5.0.bin", 0x0000, 0x1b9c4, CRC(169d6709) SHA1(62b5aacd1bc46969042aea7a50531ec467a4ff1f), ROM_BIOS(9)) - - /* Sailfish firmware image - Metam??quina experimental build v7.5.0 */ - ROM_SYSTEM_BIOS( 9, "v750mm", "V 7.5.0 - Metam??quina" ) - ROMX_LOAD("mighty_one_v7.5.0.mm.bin", 0x0000, 0x1ef9a, CRC(0d36d9e7) SHA1(a53899775b4c4eea87b6903758ebb75f06710a69), ROM_BIOS(10)) - - - /*Arduino MEGA bootloader */ - ROM_LOAD( "atmegaboot_168_atmega1280.bin", 0x1f000, 0x0f16, CRC(c041f8db) SHA1(d995ebf360a264cccacec65f6dc0c2257a3a9224) ) - - /* on-die 4kbyte eeprom */ - ROM_REGION( 0x1000, "eeprom", ROMREGION_ERASEFF ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP(2012, replica1, 0, 0, replicator, replicator, replicator_state, replicator, "Makerbot", "Replicator 1 desktop 3d printer", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/rex6000.c b/src/mess/drivers/rex6000.c deleted file mode 100644 index ee428f58fc1..00000000000 --- a/src/mess/drivers/rex6000.c +++ /dev/null @@ -1,722 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Xircom / Intel REX 6000 - - Driver by Sandro Ronco - - Known REX 6000 banks: - 0x0000 - 0x00ff first flash chip - 0x0600 - 0x06ff second flash chip - 0x1000 - 0x1003 32KB RAM - - Known DataSlim 2 banks: - 0x0000 - 0x00ff first flash chip - 0x0b00 - 0x0bff second flash chip - 0x1000 - 0x1003 32KB RAM - - TODO: - - deleting all Memos causes an error - - alarm doesn't work - - alarm sound and keyclick - - NVRAM and warm start (without the pen calibration) - - serial I/O - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/rp5c01.h" -#include "machine/ram.h" -#include "machine/intelfsh.h" -#include "imagedev/snapquik.h" -#include "sound/beep.h" -#include "rendlay.h" - -#define MAKE_BANK(lo, hi) ((lo) | ((hi)<<8)) - -//irq flag/mask bits -#define IRQ_FLAG_KEYCHANGE 0x01 -#define IRQ_FLAG_ALARM 0x02 -#define IRQ_FLAG_SERIAL 0x04 -#define IRQ_FLAG_1HZ 0x10 -#define IRQ_FLAG_IRQ2 0x20 -#define IRQ_FLAG_IRQ1 0x40 -#define IRQ_FLAG_EVENT 0x80 - -//memory bank types -#define BANK_FLASH0_B0 0x00 -#define BANK_FLASH0_B1 0x01 -#define BANK_FLASH1_B0 0x02 -#define BANK_FLASH1_B1 0x03 -#define BANK_RAM 0x10 -#define BANK_UNKNOWN 0xff - -#define TC8521_TAG "rtc" - -class rex6000_state : public driver_device -{ -public: - rex6000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_beep(*this, "beeper") - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_beep; - fujitsu_29dl16x_device *m_flash[4]; - - UINT8 m_bank[4]; - UINT8 m_beep_io[5]; - UINT8 m_lcd_base[2]; - UINT8 m_touchscreen[0x10]; - UINT8 m_lcd_enabled; - UINT8 m_lcd_cmd; - UINT8 *m_ram_base; - - UINT8 m_irq_mask; - UINT8 m_irq_flag; - UINT8 m_port6; - UINT8 m_beep_mode; - - struct - { - UINT8 type; - UINT16 page; - } m_banks[2]; - - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( bankswitch_r ); - DECLARE_WRITE8_MEMBER( bankswitch_w ); - DECLARE_READ8_MEMBER( lcd_base_r ); - DECLARE_WRITE8_MEMBER( lcd_base_w ); - DECLARE_READ8_MEMBER( beep_r ); - DECLARE_WRITE8_MEMBER( beep_w ); - DECLARE_READ8_MEMBER( lcd_io_r ); - DECLARE_WRITE8_MEMBER( lcd_io_w ); - DECLARE_READ8_MEMBER( irq_r ); - DECLARE_WRITE8_MEMBER( irq_w ); - DECLARE_READ8_MEMBER( touchscreen_r ); - DECLARE_WRITE8_MEMBER( touchscreen_w ); - DECLARE_WRITE_LINE_MEMBER( alarm_irq ); - - DECLARE_READ8_MEMBER( flash_0x0000_r ); - DECLARE_WRITE8_MEMBER( flash_0x0000_w ); - DECLARE_READ8_MEMBER( flash_0x8000_r ); - DECLARE_WRITE8_MEMBER( flash_0x8000_w ); - DECLARE_READ8_MEMBER( flash_0xa000_r ); - DECLARE_WRITE8_MEMBER( flash_0xa000_w ); - - UINT8 identify_bank_type(UINT32 bank); - DECLARE_PALETTE_INIT(rex6000); - DECLARE_INPUT_CHANGED_MEMBER(trigger_irq); - TIMER_DEVICE_CALLBACK_MEMBER(irq_timer1); - TIMER_DEVICE_CALLBACK_MEMBER(irq_timer2); - TIMER_DEVICE_CALLBACK_MEMBER(sec_timer); - DECLARE_QUICKLOAD_LOAD_MEMBER(rex6000); -}; - - -UINT8 rex6000_state::identify_bank_type(UINT32 bank) -{ - if (bank < 0x080) - { - return BANK_FLASH0_B0; - } - else if (bank >= 0x080 && bank < 0x100) - { - return BANK_FLASH0_B1; - } - else if ((bank >= 0xb00 && bank < 0xb80) || (bank >= 0x600 && bank < 0x680)) - { - return BANK_FLASH1_B0; - } - else if ((bank >= 0xb80 && bank < 0xc00) || (bank >= 0x680 && bank < 0x700)) - { - return BANK_FLASH1_B1; - } - else if (bank >= 0x1000 && bank < 0x1004) - { - return BANK_RAM; - } - else - { - //logerror("%04x: unkonwn memory bank %x\n", m_maincpu->pc(), bank); - return BANK_UNKNOWN; - } -} - -READ8_MEMBER( rex6000_state::bankswitch_r ) -{ - return m_bank[offset]; -} - -WRITE8_MEMBER( rex6000_state::bankswitch_w ) -{ - address_space& program = m_maincpu->space(AS_PROGRAM); - - m_bank[offset&3] = data; - - switch (offset) - { - case 0: //bank 1 low - case 1: //bank 1 high - { - //bank 1 start at 0x8000 - m_banks[0].page = (MAKE_BANK(m_bank[0], m_bank[1]&0x0f) + 4); - m_banks[0].type = identify_bank_type(m_banks[0].page); - - if (m_banks[0].type != BANK_UNKNOWN) - { - program.install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this)); - } - else - { - program.unmap_readwrite(0x8000, 0x9fff); - } - - break; - } - case 2: //bank 2 low - case 3: //bank 2 high - { - m_banks[1].page = MAKE_BANK(m_bank[2], m_bank[3]&0x1f); - m_banks[1].type = identify_bank_type(m_banks[1].page); - - if (m_banks[1].type == BANK_RAM) - { - program.install_ram(0xa000, 0xbfff, m_ram_base + ((m_banks[1].page & 0x03)<<13)); - } - else if (m_banks[1].type != BANK_UNKNOWN) - { - program.install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this)); - } - else - { - program.unmap_readwrite(0xa000, 0xbfff); - } - - break; - } - } -} - -READ8_MEMBER( rex6000_state::beep_r ) -{ - return m_beep_io[offset]; -} - -WRITE8_MEMBER( rex6000_state::beep_w ) -{ - m_beep_io[offset] = data; - - switch (offset) - { - case 0: //alarm mode control - /* - ---- ---x beep off - ---- --x- continuous beep - ---- -x-- continuous alarm 1 - ---- x--- continuous alarm 2 - ---x ---- continuous alarm 3 - --x- ---- single very short beep (keyclick) - -x-- ---- single alarm - x--- ---- single short beep - */ - //TODO: the beeper frequency and length in alarm mode need to be measured - break; - case 1: //tone mode control - if (m_beep_mode) - { - m_beep->set_state(BIT(data, 0)); - - //the beeper frequency is update only if the bit 1 is set - if (BIT(data, 1)) - m_beep->set_frequency(16384 / (((m_beep_io[2] | (m_beep_io[3]<<8)) & 0x0fff) + 2)); - } - break; - case 4: //select alarm/tone mode - if (m_beep_mode != BIT(data, 0)) - m_beep->set_state(0); //turned off when mode changes - - m_beep_mode = BIT(data, 0); - break; - } -} - -READ8_MEMBER( rex6000_state::lcd_base_r ) -{ - return m_lcd_base[offset]; -} - -WRITE8_MEMBER( rex6000_state::lcd_base_w ) -{ - m_lcd_base[offset&1] = data; -} - -READ8_MEMBER( rex6000_state::lcd_io_r ) -{ - return (offset == 0) ? m_lcd_enabled : m_lcd_cmd; -} - -WRITE8_MEMBER( rex6000_state::lcd_io_w ) -{ - switch (offset) - { - case 0: - m_lcd_enabled = data; - break; - case 1: - m_lcd_cmd = data; - break; - } -} - -READ8_MEMBER( rex6000_state::irq_r ) -{ - switch (offset) - { - case 0: //irq flag - /* - ---- ---x input port - ---- --x- alarm - ---- -x-- serial - ---- x--- ?? - ---x ---- 1Hz timer - --x- ---- 32Hz timer - -x-- ---- 4096Hz timer - x--- ---- special events - */ - return m_irq_flag; - - case 1: - return m_port6; - - case 2: //irq mask - return m_irq_mask; - - default: - return 0; - } -} - -WRITE8_MEMBER( rex6000_state::irq_w ) -{ - switch (offset) - { - case 0: //irq flag - m_irq_flag = data; - break; - case 1: //clear irq flag - m_port6 = data; - m_irq_flag &= (~data); - break; - case 2: //irq mask - m_irq_mask = data; - break; - } -} - -READ8_MEMBER( rex6000_state::touchscreen_r ) -{ - UINT16 x = ioport("PENX")->read(); - UINT16 y = ioport("PENY")->read(); - UINT16 battery = ioport("BATTERY")->read(); - - switch (offset) - { - case 0x08: - return ((ioport("INPUT")->read() & 0x40) ? 0x20 : 0x00) | 0X10; - case 0x09: - if (m_touchscreen[4] & 0x80) - return (battery>>0) & 0xff; - else - return (y>>0) & 0xff; - case 0x0a: - if (m_touchscreen[4] & 0x80) - return (battery>>8) & 0xff; - else - return (y>>8) & 0xff; - case 0x0b: - return (x>>0) & 0xff; - case 0x0c: - return (x>>8) & 0xff; - } - - return m_touchscreen[offset&0x0f]; -} - -WRITE8_MEMBER( rex6000_state::touchscreen_w ) -{ - m_touchscreen[offset&0x0f] = data; -} - -READ8_MEMBER( rex6000_state::flash_0x0000_r ) -{ - return m_flash[0]->read(offset); -} - -WRITE8_MEMBER( rex6000_state::flash_0x0000_w ) -{ - m_flash[0]->write(offset, data); -} - -READ8_MEMBER( rex6000_state::flash_0x8000_r ) -{ - return m_flash[m_banks[0].type]->read(((m_banks[0].page & 0x7f)<<13) | offset); -} - -WRITE8_MEMBER( rex6000_state::flash_0x8000_w ) -{ - m_flash[m_banks[0].type]->write(((m_banks[0].page & 0x7f)<<13) | offset, data); -} - -READ8_MEMBER( rex6000_state::flash_0xa000_r ) -{ - return m_flash[m_banks[1].type]->read(((m_banks[1].page & 0x7f)<<13) | offset); -} - -WRITE8_MEMBER( rex6000_state::flash_0xa000_w ) -{ - m_flash[m_banks[1].type]->write(((m_banks[1].page & 0x7f)<<13) | offset, data); -} - - -static ADDRESS_MAP_START(rex6000_mem, AS_PROGRAM, 8, rex6000_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x7fff ) AM_READWRITE(flash_0x0000_r, flash_0x0000_w) - AM_RANGE( 0x8000, 0x9fff ) AM_READWRITE(flash_0x8000_r, flash_0x8000_w) - AM_RANGE( 0xa000, 0xbfff ) AM_READWRITE(flash_0xa000_r, flash_0xa000_w) - AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("ram") //system RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( rex6000_io, AS_IO, 8, rex6000_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x01, 0x04 ) AM_READWRITE(bankswitch_r, bankswitch_w) - AM_RANGE( 0x05, 0x07 ) AM_READWRITE(irq_r, irq_w) - AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("INPUT") - AM_RANGE( 0x15, 0x19 ) AM_READWRITE(beep_r, beep_w) - AM_RANGE( 0x22, 0x23 ) AM_READWRITE(lcd_base_r, lcd_base_w) - AM_RANGE( 0x30, 0x3f ) AM_DEVREADWRITE(TC8521_TAG, rp5c01_device, read, write) - AM_RANGE( 0x40, 0x47 ) AM_MIRROR(0x08) AM_NOP //SIO - AM_RANGE( 0x50, 0x51 ) AM_READWRITE(lcd_io_r, lcd_io_w) - AM_RANGE( 0x60, 0x6f ) AM_READWRITE(touchscreen_r, touchscreen_w) - //AM_RANGE( 0x00, 0xff ) AM_RAM -ADDRESS_MAP_END - -INPUT_CHANGED_MEMBER(rex6000_state::trigger_irq) -{ - if (!(m_irq_mask & IRQ_FLAG_KEYCHANGE)) - { - m_irq_flag |= IRQ_FLAG_KEYCHANGE; - - m_maincpu->set_input_line(0, HOLD_LINE); - } -} - -/* Input ports */ -INPUT_PORTS_START( rex6000 ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x03ff, 0x03ff, "Battery Status" ) - PORT_CONFSETTING( 0x03ff, "Good" ) - PORT_CONFSETTING( 0x0000, "Poor" ) - - PORT_START("INPUT") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Select") PORT_CODE(KEYCODE_SPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Up") PORT_CODE(KEYCODE_PGUP) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Down") PORT_CODE(KEYCODE_PGDN) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Pen") PORT_CODE(KEYCODE_ENTER) PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF, rex6000_state, trigger_irq, 0) - - PORT_START("PENX") - PORT_BIT(0x3ff, 0x00, IPT_LIGHTGUN_X) PORT_NAME("Pen X") PORT_CROSSHAIR(X, 1, 0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_INVERT - - PORT_START("PENY") - PORT_BIT(0x3ff, 0x00, IPT_LIGHTGUN_Y) PORT_NAME("Pen Y") PORT_CROSSHAIR(Y, 1, 0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_INVERT -INPUT_PORTS_END - -void rex6000_state::machine_start() -{ - m_flash[0] = machine().device("flash0a"); - m_flash[1] = machine().device("flash0b"); - m_flash[2] = machine().device("flash1a"); - m_flash[3] = machine().device("flash1b"); - - m_ram_base = m_ram->pointer(); - membank("ram")->set_base(m_ram_base + 0x4000); -} -void rex6000_state::machine_reset() -{ - address_space& program = m_maincpu->space(AS_PROGRAM); - - program.install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this)); - program.install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this)); - - m_banks[0].type = 0x04; - m_banks[0].type = 0; - m_banks[1].type = 0x00; - m_banks[1].type = 0; - - memset(m_ram_base, 0, m_ram->size()); - memset(m_bank, 0, sizeof(m_bank)); - memset(m_beep_io, 0, sizeof(m_beep_io)); - memset(m_lcd_base, 0, sizeof(m_lcd_base)); - memset(m_touchscreen, 0, sizeof(m_touchscreen)); - m_lcd_enabled = 0; - m_lcd_cmd = 0; - m_irq_mask = 0; - m_irq_flag = 0; - m_port6 = 0; - m_beep_mode = 0; -} - -UINT32 rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]&0x1f); - UINT8 mem_type = identify_bank_type(lcd_bank); - - if (m_lcd_enabled && mem_type != BANK_UNKNOWN) - { - for (int y=0; y<120; y++) - for (int x=0; x<30; x++) - { - UINT8 data = 0; - - if (mem_type == BANK_RAM) - { - data = (m_ram_base + ((lcd_bank & 0x03)<<13))[y*30 + x]; - } - else - { - data = m_flash[mem_type]->space(0).read_byte(((lcd_bank & 0x7f)<<13) | (y*30 + x)); - } - - - for (int b=0; b<8; b++) - { - bitmap.pix16(y, (x * 8) + b) = BIT(data, 7); - data <<= 1; - } - } - } - else - { - bitmap.fill(0, cliprect); - } - - return 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::irq_timer1) -{ - if (!(m_irq_mask & IRQ_FLAG_IRQ2)) - { - m_irq_flag |= IRQ_FLAG_IRQ2; - - m_maincpu->set_input_line(0, HOLD_LINE); - } - -} - -TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::irq_timer2) -{ - if (!(m_irq_mask & IRQ_FLAG_IRQ1)) - { - m_irq_flag |= IRQ_FLAG_IRQ1; - - m_maincpu->set_input_line(0, HOLD_LINE); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::sec_timer) -{ - if (!(m_irq_mask & IRQ_FLAG_1HZ)) - { - m_irq_flag |= IRQ_FLAG_1HZ; - - m_maincpu->set_input_line(0, HOLD_LINE); - } -} - -WRITE_LINE_MEMBER( rex6000_state::alarm_irq ) -{ - if (!(m_irq_mask & IRQ_FLAG_ALARM) && state) - { - m_irq_flag |= IRQ_FLAG_ALARM; - m_maincpu->set_input_line(0, HOLD_LINE); - } -} - - -PALETTE_INIT_MEMBER(rex6000_state, rex6000) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -QUICKLOAD_LOAD_MEMBER( rex6000_state,rex6000) -{ - static const char magic[] = "ApplicationName:Addin"; - address_space& flash = machine().device("flash0b")->memory().space(0); - UINT32 img_start = 0; - - dynamic_buffer data(image.length()); - image.fread(&data[0], image.length()); - - if(strncmp((const char*)&data[0], magic, 21)) - return IMAGE_INIT_FAIL; - - img_start = strlen((const char*)&data[0]) + 5; - img_start += 0xa0; //skip the icon (40x32 pixel) - - for (UINT32 i=0; i m_maincpu; - required_device m_palette; - DECLARE_READ32_MEMBER(a7000_iomd_r); - DECLARE_WRITE32_MEMBER(a7000_iomd_w); - DECLARE_WRITE32_MEMBER(a7000_vidc20_w); - - UINT8 m_vidc20_pal_index; - UINT16 m_vidc20_horz_reg[0x10]; - UINT16 m_vidc20_vert_reg[0x10]; - UINT8 m_vidc20_bpp_mode; - emu_timer *m_flyback_timer; - UINT16 m_timer_in[2]; - UINT16 m_timer_out[2]; - int m_timer_counter[2]; - emu_timer *m_IOMD_timer[2]; - UINT8 m_IRQ_status_A; - UINT8 m_IRQ_mask_A; - UINT8 m_IOMD_IO_ctrl; - UINT8 m_IOMD_keyb_ctrl; - UINT16 m_io_id; - UINT8 m_viddma_status; - UINT32 m_viddma_addr_start; - UINT32 m_viddma_addr_end; - UINT8 m_t0readinc; - UINT8 m_t1readinc; - void fire_iomd_timer(int timer); - void viddma_transfer_start(); - void vidc20_dynamic_screen_change(); - virtual void machine_reset(); - virtual void machine_start(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(IOMD_timer0_callback); - TIMER_CALLBACK_MEMBER(IOMD_timer1_callback); - TIMER_CALLBACK_MEMBER(flyback_timer_callback); -}; - - -/* - * - * VIDC20 chip emulation - * - */ - - -static const char *const vidc20_regnames[] = -{ - "Video Palette", // 0 - "Video Palette Address", // 1 - "RESERVED", // 2 - "LCD offset", // 3 - "Border Colour", // 4 - "Cursor Palette Logical Colour 1", // 5 - "Cursor Palette Logical Colour 2", // 6 - "Cursor Palette Logical Colour 3", // 7 - "Horizontal", // 8 - "Vertical", // 9 - "Stereo Image", // A - "Sound", // B - "External", // C - "Frequency Synthesis", // D - "Control", // E - "Data Control" // F -}; - -#if 0 -static const char *const vidc20_horz_regnames[] = -{ - "Horizontal Cycle", // 0x80 HCR - "Horizontal Sync Width", // 0x81 HSWR - "Horizontal Border Start", // 0x82 HBSR - "Horizontal Display Start", // 0x83 HDSR - "Horizontal Display End", // 0x84 HDER - "Horizontal Border End", // 0x85 HBER - "Horizontal Cursor Start", // 0x86 HCSR - "Horizontal Interlace", // 0x87 HIR - "Horizontal Counter TEST", // 0x88 - "Horizontal ", // 0x89 - "Horizontal ", // 0x8a - "Horizontal ", // 0x8b - "Horizontal All TEST", // 0x8c - "Horizontal ", // 0x8d - "Horizontal ", // 0x8e - "Horizontal " // 0x8f -}; -#endif - -#define HCR 0 -#define HSWR 1 -#define HBSR 2 -#define HDSR 3 -#define HDER 4 -#define HBER 5 -#define HCSR 6 -#define HIR 7 - -#if 0 -static const char *const vidc20_vert_regnames[] = -{ - "Vertical Cycle", // 0x90 VCR - "Vertical Sync Width", // 0x91 VSWR - "Vertical Border Start", // 0x92 VBSR - "Vertical Display Start", // 0x93 VDSR - "Vertical Display End", // 0x94 VDER - "Vertical Border End", // 0x95 VBER - "Vertical Cursor Start", // 0x96 VCSR - "Vertical Cursor End", // 0x97 VCER - "Vertical Counter TEST", // 0x98 - "Horizontal ", // 0x99 - "Vertical Counter Increment TEST", // 0x9a - "Horizontal ", // 0x9b - "Vertical All TEST", // 0x9c - "Horizontal ", // 0x9d - "Horizontal ", // 0x9e - "Horizontal " // 0x9f -}; -#endif - -#define VCR 0 -#define VSWR 1 -#define VBSR 2 -#define VDSR 3 -#define VDER 4 -#define VBER 5 -#define VCSR 6 -#define VCER 7 - -void riscpc_state::vidc20_dynamic_screen_change() -{ - /* sanity checks - first pass */ - /* - total cycles + border start/end - */ - if(m_vidc20_horz_reg[HCR] && m_vidc20_horz_reg[HBSR] && m_vidc20_horz_reg[HBER] && - m_vidc20_vert_reg[VCR] && m_vidc20_vert_reg[VBSR] && m_vidc20_vert_reg[VBER]) - { - /* sanity checks - second pass */ - /* - total cycles > border end > border start - */ - if((m_vidc20_horz_reg[HCR] > m_vidc20_horz_reg[HBER]) && - (m_vidc20_horz_reg[HBER] > m_vidc20_horz_reg[HBSR]) && - (m_vidc20_vert_reg[VCR] > m_vidc20_vert_reg[VBER]) && - (m_vidc20_vert_reg[VBER] > m_vidc20_vert_reg[VBSR])) - { - /* finally ready to change the resolution */ - int hblank_period,vblank_period; - rectangle visarea = machine().first_screen()->visible_area(); - hblank_period = (m_vidc20_horz_reg[HCR] & 0x3ffc); - vblank_period = (m_vidc20_vert_reg[VCR] & 0x3fff); - /* note that we use the border registers as the visible area */ - visarea.min_x = (m_vidc20_horz_reg[HBSR] & 0x3ffe); - visarea.max_x = (m_vidc20_horz_reg[HBER] & 0x3ffe)-1; - visarea.min_y = (m_vidc20_vert_reg[VBSR] & 0x1fff); - visarea.max_y = (m_vidc20_vert_reg[VBER] & 0x1fff)-1; - - machine().first_screen()->configure(hblank_period, vblank_period, visarea, machine().first_screen()->frame_period().attoseconds() ); - logerror("VIDC20: successfully changed the screen to:\n Display Size = %d x %d\n Border Size %d x %d\n Cycle Period %d x %d\n", - (m_vidc20_horz_reg[HDER]-m_vidc20_horz_reg[HDSR]),(m_vidc20_vert_reg[VDER]-m_vidc20_vert_reg[VDSR]), - (m_vidc20_horz_reg[HBER]-m_vidc20_horz_reg[HBSR]),(m_vidc20_vert_reg[VBER]-m_vidc20_vert_reg[VBSR]), - hblank_period,vblank_period); - } - } -} - -WRITE32_MEMBER( riscpc_state::a7000_vidc20_w ) -{ - int r,g,b,cursor_index,horz_reg,vert_reg,reg = data >> 28; - - switch(reg) - { - case 0: // Video Palette - r = (data & 0x0000ff) >> 0; - g = (data & 0x00ff00) >> 8; - b = (data & 0xff0000) >> 16; - - m_palette->set_pen_color(m_vidc20_pal_index & 0xff,r,g,b); - - /* auto-increment & wrap-around */ - m_vidc20_pal_index++; - m_vidc20_pal_index &= 0xff; - break; - - case 1: // Video Palette Address - - // according to RPCEmu, these mustn't be set - if (data & 0x0fffff00) - return; - - m_vidc20_pal_index = data & 0xff; - break; - - case 4: // Border Color - r = (data & 0x0000ff) >> 0; - g = (data & 0x00ff00) >> 8; - b = (data & 0xff0000) >> 16; - - m_palette->set_pen_color(0x100,r,g,b); - break; - case 5: // Cursor Palette Logical Colour n - case 6: - case 7: - cursor_index = 0x100 + reg - 4; // 0x101,0x102 and 0x103 (plus 0x100 of above, 2bpp) - - r = (data & 0x0000ff) >> 0; - g = (data & 0x00ff00) >> 8; - b = (data & 0xff0000) >> 16; - - m_palette->set_pen_color(cursor_index,r,g,b); - break; - case 8: // Horizontal - horz_reg = (data >> 24) & 0xf; - m_vidc20_horz_reg[horz_reg] = data & 0x3fff; - if(horz_reg == 0 || horz_reg == 2 || horz_reg == 5) - vidc20_dynamic_screen_change(); - - // logerror("VIDC20: %s Register write = %08x (%d)\n",vidc20_horz_regnames[horz_reg],val,val); - break; - case 9: // Vertical - vert_reg = (data >> 24) & 0xf; - m_vidc20_vert_reg[vert_reg] = data & 0x1fff; - if(vert_reg == 0 || vert_reg == 2 || vert_reg == 5) - vidc20_dynamic_screen_change(); - - if(vert_reg == 4) - { - if(m_vidc20_vert_reg[VDER] != 0) - m_flyback_timer->adjust(machine().first_screen()->time_until_pos(m_vidc20_vert_reg[VDER])); - else - m_flyback_timer->adjust(attotime::never); - } - - // logerror("VIDC20: %s Register write = %08x (%d)\n",vidc20_vert_regnames[vert_reg],val,val); - - break; - case 0x0e: // Control - m_vidc20_bpp_mode = (data & 0xe0) >> 5; - break; - default: logerror("VIDC20: %s Register write = %08x\n",vidc20_regnames[reg],data & 0xfffffff); - } -} - -UINT32 riscpc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int x_size,y_size,x_start,y_start; - int x,y,xi; - UINT32 count; - UINT8 *vram = memregion("vram")->base(); - - bitmap.fill(m_palette->pen(0x100), cliprect); - - x_size = (m_vidc20_horz_reg[HDER]-m_vidc20_horz_reg[HDSR]); - y_size = (m_vidc20_vert_reg[VDER]-m_vidc20_vert_reg[VDSR]); - x_start = m_vidc20_horz_reg[HDSR]; - y_start = m_vidc20_vert_reg[VDSR]; - - /* check if display is enabled */ - if(x_size <= 0 || y_size <= 0) - return 0; - -// popmessage("%d",m_vidc20_bpp_mode); - - count = 0; - - switch(m_vidc20_bpp_mode) - { - case 0: /* 1 bpp */ - { - for(y=0;ypen((vram[count]>>(xi))&1); - - count++; - } - } - } - break; - case 1: /* 2 bpp */ - { - for(y=0;ypen((vram[count]>>(xi*2))&3); - - count++; - } - } - } - break; - case 2: /* 4 bpp */ - { - for(y=0;ypen((vram[count]>>(xi*4))&0xf); - - count++; - } - } - } - break; - case 3: /* 8 bpp */ - { - for(y=0;ypen((vram[count])&0xff); - - count++; - } - } - } - break; - case 4: /* 16 bpp */ - { - for(y=0;y> 4; - b = (pen & 0x0f00) >> 8; - r = (r << 4) | (r & 0xf); - g = (g << 4) | (g & 0xf); - b = (b << 4) | (b & 0xf); - - bitmap.pix32(y+y_start, x+x_start) = b | g << 8 | r << 16; - - count+=2; - } - } - } - break; - case 6: /* 32 bpp */ - { - for(y=0;y> 8; - b = (pen & 0xff0000) >> 16; - - bitmap.pix32(y+y_start, x+x_start) = b | g << 8 | r << 16; - - count+=4; - } - } - } - break; - default: - //fatalerror("VIDC20 %08x BPP mode not supported\n",m_vidc20_bpp_mode); - break; - } - - return 0; -} - -/* -* -* IOMD / ARM7500 / ARM7500FE chip emulation -* -*/ - -/* TODO: some of these registers are actually ARM7500 specific */ -static const char *const iomd_regnames[] = -{ - "I/O Control", // 0x000 IOCR - "Keyboard Data", // 0x004 KBDDAT - "Keyboard Control", // 0x008 KBDCR - "General Purpose I/O Lines", // 0x00c IOLINES - "IRQA Status", // 0x010 IRQSTA - "IRQA Request/clear", // 0x014 IRQRQA - "IRQA Mask", // 0x018 IRQMSKA - "Enter SUSPEND Mode", // 0x01c SUSMODE - "IRQB Status", // 0x020 IRQSTB - "IRQB Request/clear", // 0x024 IRQRQB - "IRQB Mask", // 0x028 IRQMSKB - "Enter STOP Mode", // 0x02c STOPMODE - "FIQ Status", // 0x030 FIQST - "FIQ Request/clear", // 0x034 FIQRQ - "FIQ Mask", // 0x038 FIQMSK - "Clock divider control", // 0x03c CLKCTL - "Timer 0 Low Bits", // 0x040 T0LOW - "Timer 0 High Bits", // 0x044 T0HIGH - "Timer 0 Go Command", // 0x048 T0GO - "Timer 0 Latch Command", // 0x04c T0LATCH - "Timer 1 Low Bits", // 0x050 T1LOW - "Timer 1 High Bits", // 0x054 T1HIGH - "Timer 1 Go Command", // 0x058 T1GO - "Timer 1 Latch Command", // 0x05c T1LATCH - "IRQC Status", // 0x060 IRQSTC - "IRQC Request/clear", // 0x064 IRQRQC - "IRQC Mask", // 0x068 IRQMSKC - "LCD and IIS Control Bits", // 0x06c VIDIMUX - "IRQD Status", // 0x070 IRQSTD - "IRQD Request/clear", // 0x074 IRQRQD - "IRQD Mask", // 0x078 IRQMSKD - "", // 0x07c - "ROM Control Bank 0", // 0x080 ROMCR0 - "ROM Control Bank 1", // 0x084 ROMCR1 - "DRAM Control (IOMD)", // 0x088 DRAMCR - "VRAM and Refresh Control", // 0x08c VREFCR - "Flyback Line Size", // 0x090 FSIZE - "Chip ID no. Low Byte", // 0x094 ID0 - "Chip ID no. High Byte", // 0x098 ID1 - "Chip Version Number", // 0x09c VERSION - "Mouse X Position", // 0x0a0 MOUSEX - "Mouse Y Position", // 0x0a4 MOUSEY - "Mouse Data", // 0x0a8 MSEDAT - "Mouse Control", // 0x0ac MSECR - "", // 0x0b0 - "", // 0x0b4 - "", // 0x0b8 - "", // 0x0bc - "DACK Timing Control", // 0x0c0 DMATCR - "I/O Timing Control", // 0x0c4 IOTCR - "Expansion Card Timing", // 0x0c8 ECTCR - "DMA External Control", // 0x0cc DMAEXT (IOMD) / ASTCR (ARM7500) - "DRAM Width Control", // 0x0d0 DRAMWID - "Force CAS/RAS Lines Low", // 0x0d4 SELFREF - "", // 0x0d8 - "", // 0x0dc - "A to D IRQ Control", // 0x0e0 ATODICR - "A to D IRQ Status", // 0x0e4 ATODCC - "A to D IRQ Converter Control", // 0x0e8 ATODICR - "A to D IRQ Counter 1", // 0x0ec ATODCNT1 - "A to D IRQ Counter 2", // 0x0f0 ATODCNT2 - "A to D IRQ Counter 3", // 0x0f4 ATODCNT3 - "A to D IRQ Counter 4", // 0x0f8 ATODCNT4 - "", // 0x0fc - "I/O DMA 0 CurA", // 0x100 IO0CURA - "I/O DMA 0 EndA", // 0x104 IO0ENDA - "I/O DMA 0 CurB", // 0x108 IO0CURB - "I/O DMA 0 EndB", // 0x10c IO0ENDB - "I/O DMA 0 Control", // 0x110 IO0CR - "I/O DMA 0 Status", // 0x114 IO0ST - "", // 0x118 - "", // 0x11c - "I/O DMA 1 CurA", // 0x120 IO1CURA - "I/O DMA 1 EndA", // 0x124 IO1ENDA - "I/O DMA 1 CurB", // 0x128 IO1CURB - "I/O DMA 1 EndB", // 0x12c IO1ENDB - "I/O DMA 1 Control", // 0x130 IO1CR - "I/O DMA 1 Status", // 0x134 IO1ST - "", // 0x138 - "", // 0x13c - "I/O DMA 2 CurA", // 0x140 IO2CURA - "I/O DMA 2 EndA", // 0x144 IO2ENDA - "I/O DMA 2 CurB", // 0x148 IO2CURB - "I/O DMA 2 EndB", // 0x14c IO2ENDB - "I/O DMA 2 Control", // 0x150 IO2CR - "I/O DMA 2 Status", // 0x154 IO2ST - "", // 0x158 - "", // 0x15c - "I/O DMA 3 CurA", // 0x160 IO3CURA - "I/O DMA 3 EndA", // 0x164 IO3ENDA - "I/O DMA 3 CurB", // 0x168 IO3CURB - "I/O DMA 3 EndB", // 0x16c IO3ENDB - "I/O DMA 3 Control", // 0x170 IO3CR - "I/O DMA 3 Status", // 0x174 IO3ST - "", // 0x178 - "", // 0x17c - "Sound DMA 0 CurA", // 0x180 SD0CURA - "Sound DMA 0 EndA", // 0x184 SD0ENDA - "Sound DMA 0 CurB", // 0x188 SD0CURB - "Sound DMA 0 EndB", // 0x18c SD0ENDB - "Sound DMA 0 Control", // 0x190 SD0CR - "Sound DMA 0 Status", // 0x194 SD0ST - "", // 0x198 - "", // 0x19c - "Sound DMA 1 CurA", // 0x1a0 SD1CURA - "Sound DMA 1 EndA", // 0x1a4 SD1ENDA - "Sound DMA 1 CurB", // 0x1a8 SD1CURB - "Sound DMA 1 EndB", // 0x1ac SD1ENDB - "Sound DMA 1 Control", // 0x1b0 SD1CR - "Sound DMA 1 Status", // 0x1b4 SD1ST - "", // 0x1b8 - "", // 0x1bc - "Cursor DMA Current", // 0x1c0 CURSCUR - "Cursor DMA Init", // 0x1c4 CURSINIT - "Duplex LCD Current B", // 0x1c8 VIDCURB - "", // 0x1cc - "Video DMA Current", // 0x1d0 VIDCUR - "Video DMA End", // 0x1d4 VIDEND - "Video DMA Start", // 0x1d8 VIDSTART - "Video DMA Init", // 0x1dc VIDINIT - "Video DMA Control", // 0x1e0 VIDCR - "", // 0x1e4 - "Duplex LCD Init B", // 0x1e8 VIDINITB - "", // 0x1ec - "DMA IRQ Status", // 0x1f0 DMAST - "DMA IRQ Request", // 0x1f4 DMARQ - "DMA IRQ Mask", // 0x1f8 DMAMSK - "" // 0x1fc -}; - -#define IOMD_IOCR 0x000/4 -#define IOMD_KBDDAT 0x004/4 -#define IOMD_KBDCR 0x008/4 - -#define IOMD_IRQSTA 0x010/4 -#define IOMD_IRQRQA 0x014/4 -#define IOMD_IRQMSKA 0x018/4 - -#define IOMD_T0LOW 0x040/4 -#define IOMD_T0HIGH 0x044/4 -#define IOMD_T0GO 0x048/4 -#define IOMD_T0LATCH 0x04c/4 - -#define IOMD_T1LOW 0x050/4 -#define IOMD_T1HIGH 0x054/4 -#define IOMD_T1GO 0x058/4 -#define IOMD_T1LATCH 0x05c/4 - -#define IOMD_ID0 0x094/4 -#define IOMD_ID1 0x098/4 -#define IOMD_VERSION 0x09c/4 - -#define IOMD_VIDCUR 0x1d0/4 -#define IOMD_VIDEND 0x1d4/4 -#define IOMD_VIDSTART 0x1d8/4 -#define IOMD_VIDINIT 0x1dc/4 -#define IOMD_VIDCR 0x1e0/4 - - - -void riscpc_state::fire_iomd_timer(int timer) -{ - int timer_count = m_timer_counter[timer]; - int val = timer_count / 2; // correct? - - if(val==0) - m_IOMD_timer[timer]->adjust(attotime::never); - else - m_IOMD_timer[timer]->adjust(attotime::from_usec(val), 0, attotime::from_usec(val)); -} - -TIMER_CALLBACK_MEMBER(riscpc_state::IOMD_timer0_callback) -{ - m_IRQ_status_A|=0x20; - if(m_IRQ_mask_A&0x20) - { - generic_pulse_irq_line(m_maincpu, ARM7_IRQ_LINE,1); - } -} - -TIMER_CALLBACK_MEMBER(riscpc_state::IOMD_timer1_callback) -{ - m_IRQ_status_A|=0x40; - if(m_IRQ_mask_A&0x40) - { - generic_pulse_irq_line(m_maincpu, ARM7_IRQ_LINE,1); - } -} - -TIMER_CALLBACK_MEMBER(riscpc_state::flyback_timer_callback) -{ - m_IRQ_status_A|=0x08; - if(m_IRQ_mask_A&0x08) - { - generic_pulse_irq_line(m_maincpu, ARM7_IRQ_LINE,1); - } - - m_flyback_timer->adjust(machine().first_screen()->time_until_pos(m_vidc20_vert_reg[VDER])); -} - -void riscpc_state::viddma_transfer_start() -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT32 src = m_viddma_addr_start; - UINT32 dst = 0; - UINT32 size = m_viddma_addr_end; - UINT32 dma_index; - UINT8 *vram = memregion("vram")->base(); - - /* TODO: this should actually be a qword transfer */ - for(dma_index = 0;dma_index < size;dma_index++) - { - vram[dst] = mem.read_byte(src); - - src++; - dst++; - } -} - -READ32_MEMBER( riscpc_state::a7000_iomd_r ) -{ -// if(offset != IOMD_KBDCR) -// logerror("IOMD: %s Register (%04x) read\n",iomd_regnames[offset & (0x1ff >> 2)],offset*4); - - - switch(offset) - { - case IOMD_IOCR: - { - UINT8 flyback; - int vert_pos; - - vert_pos = machine().first_screen()->vpos(); - flyback = (vert_pos <= m_vidc20_vert_reg[VDSR] || vert_pos >= m_vidc20_vert_reg[VDER]) ? 0x80 : 0x00; - - return m_IOMD_IO_ctrl | 0x34 | flyback; - } - case IOMD_KBDCR: return m_IOMD_keyb_ctrl | 0x80; //IOMD Keyb status - - /* - 1--- ---- always high - -x-- ---- Timer 1 - --x- ---- Timer 0 - ---x ---- Power On Reset - ---- x--- Flyback - ---- -x-- nINT1 - ---- --0- always low - ---- ---x INT2 - */ - case IOMD_IRQSTA: return (m_IRQ_status_A & ~2) | 0x80; - case IOMD_IRQRQA: return (m_IRQ_status_A & m_IRQ_mask_A) | 0x80; - case IOMD_IRQMSKA: return m_IRQ_mask_A; - - case IOMD_T0LOW: return m_timer_out[0] & 0xff; - case IOMD_T0HIGH: return (m_timer_out[0] >> 8) & 0xff; - - case IOMD_T1LOW: return m_timer_out[1] & 0xff; - case IOMD_T1HIGH: return (m_timer_out[1] >> 8) & 0xff; - - case IOMD_ID0: return m_io_id & 0xff; // IOMD ID low - case IOMD_ID1: return (m_io_id >> 8) & 0xff; // IOMD ID high - case IOMD_VERSION: return 0; - - case IOMD_VIDEND: return m_viddma_addr_end & 0x00fffff8; //bits 31:24 undefined - case IOMD_VIDSTART: return m_viddma_addr_start & 0x1ffffff8; //bits 31, 30, 29 undefined - case IOMD_VIDCR: return (m_viddma_status & 0xa0) | 0x50; //bit 6 = DRAM mode, bit 4 = QWORD transfer - - default: logerror("IOMD: %s Register (%04x) read\n",iomd_regnames[offset & (0x1ff >> 2)],offset*4); break; - } - - return 0; -} - -WRITE32_MEMBER( riscpc_state::a7000_iomd_w ) -{ -// logerror("IOMD: %s Register (%04x) write = %08x\n",iomd_regnames[offset & (0x1ff >> 2)],offset*4,data); - - switch(offset) - { - case IOMD_IOCR: m_IOMD_IO_ctrl = data & ~0xf4; break; - - case IOMD_KBDCR: - m_IOMD_keyb_ctrl = data & ~0xf4; - //keyboard_ctrl_write(data & 0x08); - break; - - case IOMD_IRQRQA: m_IRQ_status_A &= ~data; break; - case IOMD_IRQMSKA: m_IRQ_mask_A = (data & ~2) | 0x80; break; - - case IOMD_T0LOW: m_timer_in[0] = (m_timer_in[0] & 0xff00) | (data & 0xff); break; - case IOMD_T0HIGH: m_timer_in[0] = (m_timer_in[0] & 0x00ff) | ((data & 0xff) << 8); break; - case IOMD_T0GO: - m_timer_counter[0] = m_timer_in[0]; - fire_iomd_timer(0); - break; - case IOMD_T0LATCH: - { - m_t0readinc^=1; - m_timer_out[0] = m_timer_counter[0]; - if(m_t0readinc) - { - m_timer_counter[0]--; - if(m_timer_counter[0] < 0) - m_timer_counter[0]+= m_timer_in[0]; - } - } - break; - - case IOMD_T1LOW: m_timer_in[1] = (m_timer_in[1] & 0xff00) | (data & 0xff); break; - case IOMD_T1HIGH: m_timer_in[1] = (m_timer_in[1] & 0x00ff) | ((data & 0xff) << 8); break; - case IOMD_T1GO: - m_timer_counter[1] = m_timer_in[1]; - fire_iomd_timer(1); - break; - case IOMD_T1LATCH: - { - m_t1readinc^=1; - m_timer_out[1] = m_timer_counter[1]; - if(m_t1readinc) - { - m_timer_counter[1]--; - if(m_timer_counter[1] < 0) - m_timer_counter[1]+= m_timer_in[1]; - } - } - break; - - case IOMD_VIDEND: m_viddma_addr_end = data & 0x00fffff8; //bits 31:24 unused - case IOMD_VIDSTART: m_viddma_addr_start = data & 0x1ffffff8; //bits 31, 30, 29 unused - case IOMD_VIDCR: - m_viddma_status = data & 0xa0; if(data & 0x20) { viddma_transfer_start(); } - break; - - - default: logerror("IOMD: %s Register (%04x) write = %08x\n",iomd_regnames[offset & (0x1ff >> 2)],offset*4,data); - } -} - -static ADDRESS_MAP_START( a7000_mem, AS_PROGRAM, 32, riscpc_state) - AM_RANGE(0x00000000, 0x003fffff) AM_MIRROR(0x00800000) AM_ROM AM_REGION("user1", 0) -// AM_RANGE(0x01000000, 0x01ffffff) AM_NOP //expansion ROM -// AM_RANGE(0x02000000, 0x02ffffff) AM_RAM //VRAM -// I/O 03000000 - 033fffff -// AM_RANGE(0x03010000, 0x03011fff) //Super IO -// AM_RANGE(0x03012000, 0x03029fff) //FDC -// AM_RANGE(0x0302b000, 0x0302bfff) //Network podule -// AM_RANGE(0x03040000, 0x0304ffff) //podule space 0,1,2,3 -// AM_RANGE(0x03070000, 0x0307ffff) //podule space 4,5,6,7 - AM_RANGE(0x03200000, 0x032001ff) AM_READWRITE(a7000_iomd_r,a7000_iomd_w) //IOMD Registers //mirrored at 0x03000000-0x1ff? -// AM_RANGE(0x03310000, 0x03310003) //Mouse Buttons - - AM_RANGE(0x03400000, 0x037fffff) AM_WRITE(a7000_vidc20_w) -// AM_RANGE(0x08000000, 0x08ffffff) AM_MIRROR(0x07000000) //EASI space - AM_RANGE(0x10000000, 0x13ffffff) AM_RAM //SIMM 0 bank 0 - AM_RANGE(0x14000000, 0x17ffffff) AM_RAM //SIMM 0 bank 1 -// AM_RANGE(0x18000000, 0x18ffffff) AM_MIRROR(0x03000000) AM_RAM //SIMM 1 bank 0 -// AM_RANGE(0x1c000000, 0x1cffffff) AM_MIRROR(0x03000000) AM_RAM //SIMM 1 bank 1 -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( a7000 ) -INPUT_PORTS_END - -void riscpc_state::machine_start() -{ - m_IOMD_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(riscpc_state::IOMD_timer0_callback),this)); - m_IOMD_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(riscpc_state::IOMD_timer1_callback),this)); - m_flyback_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(riscpc_state::flyback_timer_callback),this)); - - m_io_id = 0xd4e7; -} - -void riscpc_state::machine_reset() -{ - m_IOMD_IO_ctrl = 0x0b | 0x34; //bit 0,1 and 3 set high on reset plus 2,4,5 always high -// m_IRQ_status_A = 0x10; // set POR bit ON - m_IRQ_mask_A = 0x00; - - m_IOMD_keyb_ctrl = 0x00; - - m_IOMD_timer[0]->adjust( attotime::never); - m_IOMD_timer[1]->adjust( attotime::never); - m_flyback_timer->adjust( attotime::never); -} - -static MACHINE_CONFIG_START( rpc600, riscpc_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD( "maincpu", ARM7, XTAL_30MHz ) // ARM610 - MCFG_CPU_PROGRAM_MAP(a7000_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1900, 1080) //max available size - MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) - MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) - MCFG_PALETTE_ADD("palette", 0x200) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( rpc700, riscpc_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD( "maincpu", ARM7, XTAL_40MHz ) // ARM710 - MCFG_CPU_PROGRAM_MAP(a7000_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1900, 1080) //max available size - MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) - MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) - MCFG_PALETTE_ADD("palette", 0x200) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( a7000, riscpc_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD( "maincpu", ARM7, XTAL_32MHz ) // ARM7500 - MCFG_CPU_PROGRAM_MAP(a7000_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1900, 1080) //max available size - MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) - MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) - MCFG_PALETTE_ADD("palette", 0x200) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( a7000p, a7000 ) - MCFG_CPU_MODIFY("maincpu") // ARM7500FE - MCFG_CPU_CLOCK(XTAL_48MHz) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( sarpc, riscpc_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD( "maincpu", ARM7, 202000000 ) // StrongARM - MCFG_CPU_PROGRAM_MAP(a7000_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1900, 1080) //max available size - MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) - MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) - MCFG_PALETTE_ADD("palette", 0x200) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( sarpc_j233, riscpc_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD( "maincpu", ARM7, 233000000 ) // StrongARM - MCFG_CPU_PROGRAM_MAP(a7000_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(1900, 1080) //max available size - MCFG_SCREEN_VISIBLE_AREA(0, 1900-1, 0, 1080-1) - MCFG_SCREEN_UPDATE_DRIVER(riscpc_state, screen_update) - MCFG_PALETTE_ADD("palette", 0x200) -MACHINE_CONFIG_END - -ROM_START(rpc600) - ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) - // Version 3.50 - ROM_SYSTEM_BIOS( 0, "350", "RiscOS 3.50" ) - ROMX_LOAD( "0277,521-01.bin", 0x000000, 0x100000, CRC(8ba4444e) SHA1(1b31d7a6e924bef0e0056c3a00a3fed95e55b175), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD( "0277,522-01.bin", 0x000002, 0x100000, CRC(2bc95c9f) SHA1(f8c6e2a1deb4fda48aac2e9fa21b9e01955331cf), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) -ROM_END - -ROM_START(rpc700) - ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) - // Version 3.60 - ROM_SYSTEM_BIOS( 0, "360", "RiscOS 3.60" ) - ROMX_LOAD( "1203,101-01.bin", 0x000000, 0x200000, CRC(2eeded56) SHA1(7217f942cdac55033b9a8eec4a89faa2dd63cd68), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD( "1203,102-01.bin", 0x000002, 0x200000, CRC(6db87d21) SHA1(428403ed31682041f1e3d114ea02a688d24b7d94), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) -ROM_END - -ROM_START(a7000) - ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) - // Version 3.60 - ROM_SYSTEM_BIOS( 0, "360", "RiscOS 3.60" ) - ROMX_LOAD( "1203,101-01.bin", 0x000000, 0x200000, CRC(2eeded56) SHA1(7217f942cdac55033b9a8eec4a89faa2dd63cd68), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD( "1203,102-01.bin", 0x000002, 0x200000, CRC(6db87d21) SHA1(428403ed31682041f1e3d114ea02a688d24b7d94), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) -ROM_END - -ROM_START(a7000p) - ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) - // Version 3.71 - ROM_SYSTEM_BIOS( 0, "371", "RiscOS 3.71" ) - ROMX_LOAD( "1203,261-01.bin", 0x000000, 0x200000, CRC(8e3c570a) SHA1(ffccb52fa8e165d3f64545caae1c349c604386e9), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD( "1203,262-01.bin", 0x000002, 0x200000, CRC(cf4615b4) SHA1(c340f29aeda3557ebd34419fcb28559fc9b620f8), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - // Version 4.02 - ROM_SYSTEM_BIOS( 1, "402", "RiscOS 4.02" ) - ROMX_LOAD( "riscos402_1.bin", 0x000000, 0x200000, CRC(4c32f7e2) SHA1(d290e29a4de7be9eb36cbafbb2dc99b1c4ce7f72), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(2)) - ROMX_LOAD( "riscos402_2.bin", 0x000002, 0x200000, CRC(7292b790) SHA1(67f999c1ccf5419e0a142b7e07f809e13dfed425), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(2)) - // Version 4.39 - ROM_SYSTEM_BIOS( 2, "439", "RiscOS 4.39" ) - ROMX_LOAD( "riscos439_1.bin", 0x000000, 0x200000, CRC(dab94cb8) SHA1(a81fb7f1a8117f85e82764675445092d769aa9af), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(3)) - ROMX_LOAD( "riscos439_2.bin", 0x000002, 0x200000, CRC(22e6a5d4) SHA1(b73b73c87824045130840a19ce16fa12e388c039), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(3)) - ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) -ROM_END - -ROM_START(sarpc) - ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) - // Version 3.70 - ROM_SYSTEM_BIOS( 0, "370", "RiscOS 3.70" ) - ROMX_LOAD( "1203,191-01.bin", 0x000000, 0x200000, NO_DUMP, ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD( "1203,192-01.bin", 0x000002, 0x200000, NO_DUMP, ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) -ROM_END - -ROM_START(sarpc_j233) - ROM_REGION( 0x800000, "user1", ROMREGION_ERASEFF ) - // Version 3.71 - ROM_SYSTEM_BIOS( 0, "371", "RiscOS 3.71" ) - ROMX_LOAD( "1203,261-01.bin", 0x000000, 0x200000, CRC(8e3c570a) SHA1(ffccb52fa8e165d3f64545caae1c349c604386e9), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROMX_LOAD( "1203,262-01.bin", 0x000002, 0x200000, CRC(cf4615b4) SHA1(c340f29aeda3557ebd34419fcb28559fc9b620f8), ROM_GROUPWORD | ROM_SKIP(2) | ROM_BIOS(1)) - ROM_REGION( 0x800000, "vram", ROMREGION_ERASE00 ) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1994, rpc600, 0, 0, rpc600, a7000, driver_device, 0, "Acorn", "Risc PC 600", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1994, rpc700, rpc600, 0, rpc700, a7000, driver_device, 0, "Acorn", "Risc PC 700", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1995, a7000, rpc600, 0, a7000, a7000, driver_device, 0, "Acorn", "Archimedes A7000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1997, a7000p, rpc600, 0, a7000p, a7000, driver_device, 0, "Acorn", "Archimedes A7000+", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1997, sarpc, rpc600, 0, sarpc, a7000, driver_device, 0, "Acorn", "StrongARM Risc PC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1997, sarpc_j233, rpc600, 0, sarpc_j233, a7000, driver_device, 0, "Acorn", "J233 StrongARM Risc PC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/rm380z.c b/src/mess/drivers/rm380z.c deleted file mode 100644 index 659ec0dbe31..00000000000 --- a/src/mess/drivers/rm380z.c +++ /dev/null @@ -1,179 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol,Gabriele D'Antona -/* - -Research Machines 380Z (aka "RML 380Z" or "RM 380Z") -Microcomputer produced by Research Machines Limited, Oxford, UK -1978-1985 -MESS driver by Wilbert Pol and friol (dantonag (at) gmail.com) -Driver started on 22/12/2011 - -=== - -Memory map from sevice manual: - -PAGE SEL bit in PORT0 set to 0: - - 0000-3BFF - CPU RAM row 1 (15KB!) - 3C00-7BFF - CPU RAM row 2 (16KB) - 7C00-BBFF - Add-on RAM row 1 or HRG RAM (16KB) - BC00-DFFF - Add-on RAM row 2 (9KB!) - E000-EFFF - ROM (COS) - F000-F5FF - VDU and HRG Video RAM - F600-F9FF - ROM (monitor extension) - FA00-FAFF - Reserved, RAM? - FB00-FBFF - Memory-mapped ports (FBFC-FBFF) - FC00-FFFF - RAM - -PAGE SEL bit in PORT0 set to 1: - 0000-0FFF - ROM (COS mirror from E000) - 1B00-1BFF - Memory-mapped ports (1BFC-1BFF) - 1C00-1DFF - ROM - 4000-7FFF - CPU RAM row 1 (16KB!, this RAM normally appears at 0000) - 8000-BFFF - ??? - C000-DFFF - ??? - E000-EFFF - ROM (COS) - F000-F5FF - VDU and HRG Video RAM - F600-F9FF - ROM (monitor extension) - FA00-FAFF - Reserved, RAM? - FB00-FBFF - Memory-mapped ports (FBFC-FBFF) - FC00-FFFF - RAM - -Video resolution (not confirmed): -80x24 - 6 pixels wide (5 + spacing), 10 pixels high (9 + spacing) = 480x240 -Video input clock is 16MHz - -According to the manuals, VDU-1 chargen is Texas 74LS262. - -=== - -Notes on COS 4.0 disassembly: - -- routine at 0xe438 is called at startup in COS 4.0 and it sets the RST vectors in RAM -- routine at 0xe487 finds "top" of system RAM and stores it in 0x0006 and 0x000E -- 0xeca0 - outputs a string (null terminated) to screen (?) -- 0xff18 - does char output to screen (char in A?) - -=== - -TODO: - -- Properly implement "backwards" or "last 4 lines" scrolling -- Properly implement dimming and graphic chars (>0x80) -- Understand why any write to disk command fails with "bad sector" -- Understand why ctrl-U (blinking cursor) in COS 4.0 stops keyboard input from working -- Get a reliable ROM dump and charset ROM dump - - -Attempt to register save state entry after state registration is closed! -Module timer tag static_vblank_timer name m_param -Attempt to register save state entry after state registration is closed! -Module timer tag static_vblank_timer name m_enabled -Attempt to register save state entry after state registration is closed! -Module timer tag static_vblank_timer name m_period.attoseconds -Attempt to register save state entry after state registration is closed! -Module timer tag static_vblank_timer name m_period.seconds -Attempt to register save state entry after state registration is closed! -Module timer tag static_vblank_timer name m_start.attoseconds -Attempt to register save state entry after state registration is closed! -Module timer tag static_vblank_timer name m_start.seconds -Attempt to register save state entry after state registration is closed! -Module timer tag static_vblank_timer name m_expire.attoseconds -Attempt to register save state entry after state registration is closed! -Module timer tag static_vblank_timer name m_expire.seconds -':maincpu' (E48B): unmapped program memory write to E000 = C1 & FF -':maincpu' (E48E): unmapped program memory write to E000 = 3E & FF - -*/ - - -#include "includes/rm380z.h" - -#define KEYBOARD_TAG "keyboard" - -static ADDRESS_MAP_START(rm380z_mem, AS_PROGRAM, 8, rm380z_state) - AM_RANGE( 0xe000, 0xefff ) AM_ROM AM_REGION(RM380Z_MAINCPU_TAG, 0) - AM_RANGE( 0xf000, 0xf5ff ) AM_READWRITE(videoram_read,videoram_write) - AM_RANGE( 0xf600, 0xf9ff ) AM_ROM AM_REGION(RM380Z_MAINCPU_TAG, 0x1000) /* Extra ROM space for COS4.0 */ - AM_RANGE( 0xfa00, 0xfaff ) AM_RAM - AM_RANGE( 0xfb00, 0xfbff ) AM_READWRITE( port_read, port_write ) - AM_RANGE( 0xfc00, 0xffff ) AM_READWRITE(hiram_read,hiram_write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( rm380z_io , AS_IO, 8, rm380z_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0xbf) AM_READWRITE(rm380z_portlow_r, rm380z_portlow_w) - AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("wd1771", fd1771_t, read, write) - AM_RANGE(0xc4, 0xc4) AM_WRITE(disk_0_control) - AM_RANGE(0xc5, 0xff) AM_READWRITE(rm380z_porthi_r, rm380z_porthi_w) -ADDRESS_MAP_END - -INPUT_PORTS_START( rm380z ) -// PORT_START("additional_chars") -// PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CODE(KEYCODE_ESC) -INPUT_PORTS_END - -// -// -// - -static SLOT_INTERFACE_START( rm380z_floppies ) - SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) -SLOT_INTERFACE_END - -UINT32 rm380z_state::screen_update_rm380z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - update_screen(bitmap); - return 0; -} - -static MACHINE_CONFIG_START( rm380z, rm380z_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(RM380Z_MAINCPU_TAG, Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(rm380z_mem) - MCFG_CPU_IO_MAP(rm380z_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - // according to videos and pictures of the real hardware, chars are spaced of at least 1 pixel - // and there is at least 1 pixel between each row of characters - MCFG_SCREEN_SIZE((RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1)), (RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))) - MCFG_SCREEN_VISIBLE_AREA(0, (RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1))-1, 0, (RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))-1) - MCFG_SCREEN_UPDATE_DRIVER(rm380z_state, screen_update_rm380z) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* RAM configurations */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("56K") - - /* floppy disk */ - MCFG_FD1771_ADD("wd1771", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("wd1771:0", rm380z_floppies, "sssd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1771:1", rm380z_floppies, "sssd", floppy_image_device::default_floppy_formats) - - /* keyboard */ - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(rm380z_state, keyboard_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( rm380z ) - ROM_REGION( 0x10000, RM380Z_MAINCPU_TAG, 0 ) -// ROM_LOAD( "cos34e-m.bin", 0x0000, 0x1000, CRC(20e2ddf4) SHA1(3177b28793d5a348c94fd0ae6393d74e2e9a8662)) - // I'm not sure of how those roms have been dumped. I don't know if those are good dumps or not. - ROM_LOAD( "cos40b-m.bin", 0x0000, 0x1000, BAD_DUMP CRC(1f0b3a5c) SHA1(0b29cb2a3b7eaa3770b34f08c4fd42844f42700f)) - ROM_LOAD( "cos40b-m_f600-f9ff.bin", 0x1000, 0x400, BAD_DUMP CRC(e3397d9d) SHA1(490a0c834b0da392daf782edc7d51ca8f0668b1a)) - ROM_LOAD( "cos40b-m_1c00-1dff.bin", 0x1400, 0x200, BAD_DUMP CRC(0f759f44) SHA1(9689c1c1faa62c56def999cbedbbb0c8d928dcff)) - // chargen ROM is undumped, afaik - ROM_REGION( 0x1680, "chargen", 0 ) - ROM_LOAD( "ch3.raw", 0x0000, 0x1680, BAD_DUMP CRC(c223622b) SHA1(185ef24896419d7ff46f71a760ac217de3811684)) -ROM_END - -/* Driver */ - -COMP(1978, rm380z, 0, 0, rm380z, rm380z, driver_device, 0, "Research Machines", "RM-380Z", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/rmnimbus.c b/src/mess/drivers/rmnimbus.c deleted file mode 100644 index 94a34ff7b6f..00000000000 --- a/src/mess/drivers/rmnimbus.c +++ /dev/null @@ -1,225 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phill Harvey-Smith, Carl -/* - drivers/rmnimbus.c - - Research machines Nimbus. - - 2009-11-14, P.Harvey-Smith. - -*/ - -#include "includes/rmnimbus.h" -#include "cpu/mcs51/mcs51.h" -#include "imagedev/flopdrv.h" -#include "formats/pc_dsk.h" -#include "bus/scsi/scsihd.h" -#include "bus/scsi/s1410.h" -#include "bus/scsi/acb4070.h" -#include "bus/isa/fdc.h" -#include "bus/rs232/rs232.h" -#include "machine/rmnkbd.h" - -static SLOT_INTERFACE_START(rmnimbus_floppies) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(keyboard) - SLOT_INTERFACE("rmnkbd", RMNIMBUS_KEYBOARD) -SLOT_INTERFACE_END - -static ADDRESS_MAP_START(nimbus_mem, AS_PROGRAM, 16, rmnimbus_state ) - AM_RANGE( 0x00000, 0x1FFFF ) AM_RAMBANK(RAM_BANK00_TAG) - AM_RANGE( 0x20000, 0x3FFFF ) AM_RAMBANK(RAM_BANK01_TAG) - AM_RANGE( 0x40000, 0x5FFFF ) AM_RAMBANK(RAM_BANK02_TAG) - AM_RANGE( 0x60000, 0x7FFFF ) AM_RAMBANK(RAM_BANK03_TAG) - AM_RANGE( 0x80000, 0x9FFFF ) AM_RAMBANK(RAM_BANK04_TAG) - AM_RANGE( 0xA0000, 0xBFFFF ) AM_RAMBANK(RAM_BANK05_TAG) - AM_RANGE( 0xC0000, 0xDFFFF ) AM_RAMBANK(RAM_BANK06_TAG) - AM_RANGE( 0xE0000, 0xEFFFF ) AM_RAMBANK(RAM_BANK07_TAG) - AM_RANGE( 0xF0000, 0xFFFFF ) AM_ROM AM_REGION(MAINCPU_TAG, 0x0f0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(nimbus_io, AS_IO, 16, rmnimbus_state ) - AM_RANGE( 0x0000, 0x0031) AM_READWRITE(nimbus_video_io_r, nimbus_video_io_w) - AM_RANGE( 0x0080, 0x0081) AM_READWRITE8(nimbus_mcu_r, nimbus_mcu_w, 0x00FF) - AM_RANGE( 0x0092, 0x0093) AM_READWRITE8(nimbus_iou_r, nimbus_iou_w, 0x00FF) - AM_RANGE( 0x00A4, 0x00A5) AM_READWRITE8(nimbus_mouse_js_r, nimbus_mouse_js_w, 0x00FF) - AM_RANGE( 0X00c0, 0X00cf) AM_READWRITE8(nimbus_pc8031_r, nimbus_pc8031_w, 0x00FF) - AM_RANGE( 0X00e0, 0X00ef) AM_DEVREADWRITE8(AY8910_TAG, ay8910_device, data_r, address_data_w, 0x00FF) - AM_RANGE( 0x00f0, 0x00f7) AM_DEVREADWRITE8(Z80SIO_TAG, z80sio2_device, cd_ba_r, cd_ba_w, 0x00ff) - AM_RANGE( 0x0400, 0x0401) AM_WRITE8(fdc_ctl_w, 0x00ff) - AM_RANGE( 0x0408, 0x040f) AM_DEVREADWRITE8(FDC_TAG, wd2793_t, read, write, 0x00ff) - AM_RANGE( 0x0410, 0x041f) AM_READWRITE8(scsi_r, scsi_w, 0x00ff) - AM_RANGE( 0x0480, 0x049f) AM_DEVREADWRITE8(VIA_TAG, via6522_device, read, write, 0x00FF) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( nimbus ) - PORT_START("config") - PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device") - PORT_CONFSETTING( 0x00, "Mouse" ) - PORT_CONFSETTING( 0x01, DEF_STR( Joystick ) ) - - PORT_START(JOYSTICK0_TAG) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY // XB - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY // XA - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY // YA - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY // YB - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - - PORT_START(MOUSE_BUTTON_TAG) /* Mouse buttons */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1) - - PORT_START(MOUSEX_TAG) /* Mouse - X AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START(MOUSEY_TAG) /* Mouse - Y AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - -INPUT_PORTS_END - -static ADDRESS_MAP_START(nimbus_iocpu_mem, AS_PROGRAM, 8, rmnimbus_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( nimbus_iocpu_io , AS_IO, 8, rmnimbus_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x000FF) AM_READWRITE(nimbus_pc8031_iou_r, nimbus_pc8031_iou_w) - AM_RANGE(0x20000, 0x20004) AM_READWRITE(nimbus_pc8031_port_r, nimbus_pc8031_port_w) -ADDRESS_MAP_END - -static const UINT16 def_config[16] = -{ - 0x0280, 0x017F, 0xE824, 0x8129, - 0x0329, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x8893, 0x2025, 0xB9E6 -}; - -static MACHINE_CONFIG_START( nimbus, rmnimbus_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(MAINCPU_TAG, I80186, 16000000) // the cpu is a 10Mhz part but the serial clocks are wrong unless it runs at 8Mhz - MCFG_CPU_PROGRAM_MAP(nimbus_mem) - MCFG_CPU_IO_MAP(nimbus_io) - MCFG_80186_IRQ_SLAVE_ACK(READ8(rmnimbus_state, cascade_callback)) - MCFG_80186_TMROUT0_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxca_w)) - MCFG_80186_TMROUT1_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) - - MCFG_CPU_ADD(IOCPU_TAG, I8031, 11059200) - MCFG_CPU_PROGRAM_MAP(nimbus_iocpu_mem) - MCFG_CPU_IO_MAP(nimbus_iocpu_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( XTAL_4_433619MHz*2,650,0,640,260,0,250) - MCFG_SCREEN_UPDATE_DRIVER(rmnimbus_state, screen_update_nimbus) - //MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - - /* Backing storage */ - MCFG_WD2793_ADD(FDC_TAG, 1000000) - MCFG_WD_FDC_FORCE_READY - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(rmnimbus_state,nimbus_fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(rmnimbus_state,nimbus_fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":0", rmnimbus_floppies, "35dd", isa8_fdc_device::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC_TAG":1", rmnimbus_floppies, "35dd", isa8_fdc_device::floppy_formats) - - MCFG_DEVICE_ADD(SCSIBUS_TAG, SCSI_PORT, 0) - MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") - MCFG_SCSI_MSG_HANDLER(WRITELINE(rmnimbus_state, write_scsi_msg)) - MCFG_SCSI_BSY_HANDLER(WRITELINE(rmnimbus_state, write_scsi_bsy)) - MCFG_SCSI_IO_HANDLER(WRITELINE(rmnimbus_state, write_scsi_io)) - MCFG_SCSI_CD_HANDLER(WRITELINE(rmnimbus_state, write_scsi_cd)) - MCFG_SCSI_REQ_HANDLER(WRITELINE(rmnimbus_state, write_scsi_req)) - - MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) - MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1) - MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE3, "harddisk", ACB4070, SCSI_ID_2) - MCFG_SCSIDEV_ADD(SCSIBUS_TAG ":" SCSI_PORT_DEVICE4, "harddisk", S1410, SCSI_ID_3) - - MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SCSIBUS_TAG) - MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) - - MCFG_DEVICE_ADD("scsi_ctrl_out", OUTPUT_LATCH, 0) - MCFG_OUTPUT_LATCH_BIT0_HANDLER(DEVWRITELINE(SCSIBUS_TAG, SCSI_PORT_DEVICE, write_rst)) - MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE(SCSIBUS_TAG, SCSI_PORT_DEVICE, write_sel)) - MCFG_OUTPUT_LATCH_BIT2_HANDLER(WRITELINE(rmnimbus_state, write_scsi_iena)) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1536K") - MCFG_RAM_EXTRA_OPTIONS("128K,256K,384K,512K,640K,1024K") - - /* Peripheral chips */ - MCFG_Z80SIO2_ADD(Z80SIO_TAG, 4000000, 0, 0, 0, 0) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(WRITELINE(rmnimbus_state, sio_interrupt)) - - MCFG_RS232_PORT_ADD("rs232a", keyboard, "rmnkbd") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) - - MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, dcdb_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rib_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, ctsb_w)) - - MCFG_EEPROM_SERIAL_93C06_ADD(ER59256_TAG) - MCFG_EEPROM_DATA(def_config,sizeof(def_config)) - - MCFG_DEVICE_ADD(VIA_TAG, VIA6522, 1000000) - MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(rmnimbus_state,nimbus_via_write_portb)) - MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(MAINCPU_TAG, i80186_cpu_device, int3_w)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(VIA_TAG, via6522_device, write_ca1)) MCFG_DEVCB_INVERT - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO(MONO_TAG) - MCFG_SOUND_ADD(AY8910_TAG, AY8910, 2000000) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(rmnimbus_state, nimbus_sound_ay8910_porta_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(rmnimbus_state, nimbus_sound_ay8910_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,MONO_TAG, 0.75) - - MCFG_SOUND_ADD(MSM5205_TAG, MSM5205, 384000) - MCFG_MSM5205_VCLK_CB(WRITELINE(rmnimbus_state, nimbus_msm5205_vck)) /* VCK function */ - MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* 8 kHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, MONO_TAG, 0.75) - - /* Software list */ - MCFG_SOFTWARE_LIST_ADD("disk_list","nimbus") -MACHINE_CONFIG_END - - -ROM_START( nimbus ) - ROM_REGION( 0x100000, MAINCPU_TAG, 0 ) - - ROM_SYSTEM_BIOS(0, "v131a", "Nimbus BIOS v1.31a (1986-06-18)") - ROMX_LOAD("sys1-1.31a-16128-1986-06-18.rom", 0xf0001, 0x8000, CRC(6416eb05) SHA1(1b640163a7efbc24381c7b24976a8609c066959b),ROM_SKIP(1) | ROM_BIOS(1) ) - ROMX_LOAD("sys2-1.31a-16129-1986-06-18.rom", 0xf0000, 0x8000, CRC(b224359d) SHA1(456bbe37afcd4429cca76ba2d6bd534dfda3fc9c),ROM_SKIP(1) | ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS(1, "v132f", "Nimbus BIOS v1.32f (1989-10-20)") - ROMX_LOAD("sys-1-1.32f-22779-1989-10-20.rom", 0xf0001, 0x8000, CRC(786c31e8) SHA1(da7f828f7f96087518bea1a3d89fee59b283b4ba),ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD("sys-2-1.32f-22779-1989-10-20.rom", 0xf0000, 0x8000, CRC(0be3db64) SHA1(af806405ec6fbc20385705f90d5059a47de17b08),ROM_SKIP(1) | ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS(2, "v140d", "Nimbus BIOS v1.40d (1990-xx-xx)") - ROMX_LOAD("sys-1-1.40d.rom", 0xf0001, 0x8000, CRC(b8d3dc0b) SHA1(82e0dcdc6c7a83339af68d6cb61211fcb14bed88),ROM_SKIP(1) | ROM_BIOS(3) ) - ROMX_LOAD("sys-2-1.40d.rom", 0xf0000, 0x8000, CRC(b0826b0b) SHA1(3baa369a0e7ef138ca29aae0ee8a89ab670a02b9),ROM_SKIP(1) | ROM_BIOS(3) ) - - ROM_REGION( 0x4000, IOCPU_TAG, 0 ) - ROM_LOAD("hexec-v1.02u-13488-1985-10-29.rom", 0x0000, 0x1000, CRC(75c6adfd) SHA1(0f11e0b7386c6368d20e1fc7a6196d670f924825)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, nimbus, 0, 0, nimbus, nimbus, driver_device, 0, "Research Machines", "Nimbus", 0) diff --git a/src/mess/drivers/rmt32.c b/src/mess/drivers/rmt32.c deleted file mode 100644 index 9579adc778c..00000000000 --- a/src/mess/drivers/rmt32.c +++ /dev/null @@ -1,438 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert,Jonathan Gevaryahu -/************************************************************************************************* - - Roland MT-32/CM32L driver - - Driver by Olivier Galibert and Jonathan Gevaryahu - - The Roland MT32 is an expander (synthesizer without the keyboard) - from 1987. It had a small 20-char LCD display and 10 control - buttons (part 1-5, rhythm, sound/sound group, volume/master - volume), a rotating knob and a midi message led. It uses a weird - kind of synthesis called "Linear Additive". - - The CM32L versions is a simpler/smaller version without the lcd, - buttons or knob but keeping the led. It also has a different - firmware and more partials rom, adding "game sounds". "CM" means - "Computer Music". - - The LAPC-I (I as in Intel) is a ISA board variant of the CM32L - with a MPU-401 frontend added to communicate with the synth. All - the roms are identical with the CM32L. - - Some special tricks: - - pressing 3+V (Part 3 + Volume) at boot time starts the test mode - - - predding 4+R+M (Part 4 + Rhythm + Master Volume) at boot time - shows the firmware version - - - the CM32L drives the lcd as if it was there and looks at the - buttons at boot time for test mode and firmware version - - - -Roland MT-32 rev00 pcb (early 1.0.7 and all earlier firmware, with ic26 and ic27 socketed): - -PCB Layout ----------- - -MT-32 MAIN BOARD ASSY 79377310 00 -|---------------------------------|------------------------|-----------| -| JK1 JK2 IR3M03 | JK3 |JK4 SW1 | -| | | | -|5218 072D 5218 072D |------------------------| | -| IR3M03 PC910 74HC04 | -| | -|072D 4051 | -| ROM.IC21 |----| | -| M5238 | | | -| ROM.IC26 6264 | | | -| |---------| 74LS05 74HC27 ROM.IC22 | | 12MHz| -| | PCM54HP | 74HC00 6264 | | | -| |---------| |8095| | -| |------| | | | -| | | ROM.IC27 6264 | | | -| 4416 4416 | *2 | | | | -| | | 6264 |----| | -| 4416 4416 | | | -| |------| |-----| | -| |-------| | | | -| ROM.IC13 | | 32.768kHz | *1 | | -| | *3 | 74HC04 | | | -| CN1 CN2 |-------| CN3 CN4 74HC02 74HC00 |-----| CN5| -|----------------------------------------------------------------------| -Notes: (All IC's listed for completeness) - 8095 - Intel C8095-90 16-Bit Microcontroller, Clock Input 12.000MHz (DIP48) - 6264 - Hitachi HM6264ALSP-15 8K x8 SRAM (DIP28) - 4416 - Mitsubishi M5M4416P-12 16K x4 DRAM (DIP18) - PC910 - Sharp PC910 Opto-Isolator (DIP8) - IR3M03 - Sharp IR3M03A (DIP8) - 072D - New Japan Radio Co., Ltd JRC072D Dual J-FET Input Operational Amplifier (DIP8) - 5218 - Mitsubishi 5218 Operational Amplifier (DIP8) - M5238 - Mitsubishi M5238 LCD Display Controller (SIP8) - CN1 - 6 Pin Connector - CN2 - 6 Pin Connector - CN3 - 2 Pin Connector - CN4 - 3 Pin Connector - CN5 - 10 Pin Connector - SW1 - Power On/Off Switch - JK1 - 1/4" Stereo Jack - JK2 - 1/4" Stereo Jack - JK3 - MIDI In, MIDI Out and Midi Thru DIN5 Jacks - JK4 - Mini 1/8th" Power Input Jack - *1 - R15229865 HG61H15B59F (QFP80, stamped 'Roland') - *2 - R15229851 MB87136A LA32 (PGA144?, stamped 'Roland') - *3 - R15229863 HG61H20R36F (QFP100, stamped 'BOSS') - PCM54HP- Burr-Brown PCM54HP 16-Bit Monolithic Digital-to-Analog Converter (DIP28) - & Various logic ICs - 4051, 74HC27, 74HC00, 74HC02, 74HC04, 74LS05 - - ROMs - Filename Device Type - ------------------------------------------------------------------------ - ROM.IC26.106 Mitsubishi M5M27C256 (labeled 1.0.6) read as 27C256 - ROM.IC27.106 Mitsubishi M5M27C256 (labeled 1.0.6) read as 27C256 - ROM.IC13.200 Mitsubishi M5M27C128 (labeled 2.0.0) read as 27C128 - ROM.IC21 Toshiba TC532000P (-7471) read as TC572000 - ROM.IC22 Toshiba TC532000P (-7472) read as TC572000 - - - -Newer version - -PCB Layout ----------- - -MT-32 MAIN BOARD ASSY 79377310 01 -|---------------------------------|------------------------|-----------| -| JK1 JK2 IR3M03 | JK3 |JK4 SW1 | -| | | | -|5218 072D 5218 072D |------------------------| | -| IR3M03 PC910 74HC04 | -| | -|072D 4051 | -| ROM.IC37 |----| | -| M5238 | | | -| ROM.IC26 4364 | | | -| |---------| 74LS05 74HC27 | | 12MHz| -| | PCM54HP | 74HC00 4364 | | | -| |---------| |8095| | -| | | | -| |-----|ROM.IC27 4364 | | | -| 81416 81416 | | | | | -| | *2 | 4364 |----| | -| 81416 81416 | | | -| |-----| |-----| | -| |-------| | | | -| ROM.IC13 | | 32.768kHz | *1 | | -| | *3 | 74HC04 | | | -| CN1 CN2 |-------| CN3 CN4 74HC02 74HC00 |-----| CN5| -|----------------------------------------------------------------------| -Notes: (All IC's listed for completeness) - 8095 - Intel C8095-90 16-Bit Microcontroller, Clock Input 12.000MHz (DIP48) - 4364 - NEC D4364CX-15L 8K x8 SRAM (DIP28) - 81416 - Fujitsu MB81416 16K x4 DRAM (DIP18) - PC910 - Sharp PC910 Opto-Isolator (DIP8) - IR3M03 - Sharp IR3M03A (DIP8) - 072D - New Japan Radio Co., Ltd JRC072D Dual J-FET Input Operational Amplifier (DIP8) - 5218 - Mitsubishi 5218 Operational Amplifier (DIP8) - M5238 - Mitsubishi M5238 LCD Display Controller (SIP8) - CN1 - 6 Pin Connector - CN2 - 6 Pin Connector - CN3 - 2 Pin Connector - CN4 - 3 Pin Connector - CN5 - 10 Pin Connector - SW1 - Power On/Off Switch - JK1 - 1/4" Stereo Jack - JK2 - 1/4" Stereo Jack - JK3 - MIDI In, MIDI Out and Midi Thru DIN5 Jacks - JK4 - Mini 1/8th" Power Input Jack - *1 - R15229865 HG61H15B59F (QFP80, stamped 'Roland') - *2 - R15229896 LA32 (QFP100, stamped 'Roland') - *3 - R15229863 HG61H20R36F (QFP100, stamped 'BOSS') - PCM54HP- Burr-Brown PCM54HP 16-Bit Monolithic Digital-to-Analog Converter (DIP28) - & Various logic ICs - 4051, 74HC27, 74HC00, 74HC02, 74HC04, 74LS05 - - ROMs - Filename Device Type - ---------------------------------------------------- - ROM.IC26 Hitachi HN623258PH26 read as 27C256 - ROM.IC27 Hitachi HN623258PH26 read as 27C256 - ROM.IC13 Hitachi HN623257PC21 read as 27C256 - ROM.IC37 Toshiba TC534000P read as TC574000 -*/ - -#include "emu.h" -#include "machine/ram.h" -#include "video/sed1200.h" -#include "cpu/mcs96/i8x9x.h" - -static INPUT_PORTS_START( mt32 ) - PORT_START("SC0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Sound group") PORT_CODE(KEYCODE_G) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Volume") PORT_CODE(KEYCODE_V) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("SC1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Rhythm") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Sound") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Master volume") PORT_CODE(KEYCODE_M) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("A7") - PORT_BIT(0x03ff, 0x0000, IPT_DIAL) PORT_NAME("Knob") PORT_SENSITIVITY(50) PORT_KEYDELTA(8) PORT_CODE_DEC(KEYCODE_DOWN) PORT_CODE_INC(KEYCODE_UP) -INPUT_PORTS_END - -class mt32_state : public driver_device -{ -public: - required_device cpu; - required_device ram; - optional_device lcd; - required_device midi_timer; - - mt32_state(const machine_config &mconfig, device_type type, const char *tag); - - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(mt32); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE8_MEMBER(bank_w); - DECLARE_WRITE8_MEMBER(so_w); - DECLARE_WRITE16_MEMBER(midi_w); - - DECLARE_READ8_MEMBER(lcd_ctrl_r); - DECLARE_WRITE8_MEMBER(lcd_ctrl_w); - DECLARE_WRITE8_MEMBER(lcd_data_w); - DECLARE_READ16_MEMBER(port0_r); - - TIMER_DEVICE_CALLBACK_MEMBER(midi_timer_cb); - TIMER_DEVICE_CALLBACK_MEMBER(samples_timer_cb); - -private: - UINT8 lcd_data_buffer[256]; - int lcd_data_buffer_pos; - UINT8 midi; - int midi_pos; - UINT8 port0; - required_device m_maincpu; -}; - -mt32_state::mt32_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - cpu(*this, "maincpu"), - ram(*this, "ram"), - lcd(*this, "lcd"), - midi_timer(*this, "midi_timer") -, - m_maincpu(*this, "maincpu") { -} - - -UINT32 mt32_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0); - const UINT8 *data = lcd->render(); - for(int c=0; c<20; c++) - for(int y=0; y<8; y++) { - UINT8 v = data[c*8+y]; - for(int x=0; x<5; x++) - bitmap.pix16(y == 7 ? 8 : y, c*6+x) = v & (0x10 >> x) ? 1 : 0; - } - return 0; -} - -void mt32_state::machine_start() -{ - membank("bank")->configure_entries(0, 4, memregion("maincpu")->base(), 0x4000); - membank("bank")->configure_entries(0x10, 2, ram->pointer(), 0x4000); // 0x10 doesn't seem used though, but that ram is accessible at c000+ - membank("fixed")->set_base(ram->pointer()); - - lcd_data_buffer_pos = 0; -} - -void mt32_state::machine_reset() -{ - midi_timer->adjust(attotime::from_hz(1)); - midi_pos = 0; - port0 = 0; -} - -WRITE8_MEMBER(mt32_state::lcd_ctrl_w) -{ - lcd->control_w(data); - for(int i=0; i != lcd_data_buffer_pos; i++) - lcd->data_w(lcd_data_buffer[i]); - lcd_data_buffer_pos = 0; -} - -READ8_MEMBER(mt32_state::lcd_ctrl_r) -{ - return lcd->control_r(); -} - -WRITE8_MEMBER(mt32_state::lcd_data_w) -{ - lcd_data_buffer[lcd_data_buffer_pos++] = data; -} - -WRITE8_MEMBER(mt32_state::bank_w) -{ - membank("bank")->set_entry(data); -} - -WRITE16_MEMBER(mt32_state::midi_w) -{ - logerror("midi_out %02x\n", data); - midi = data; -} - -TIMER_DEVICE_CALLBACK_MEMBER(mt32_state::midi_timer_cb) -{ - const static UINT8 midi_data[3] = { 0x91, 0x40, 0x7f }; - midi = midi_data[midi_pos++]; - logerror("midi_in %02x\n", midi); - cpu->serial_w(midi); - if(midi_pos < sizeof(midi_data)) - midi_timer->adjust(attotime::from_hz(1250)); -} - -READ16_MEMBER(mt32_state::port0_r) -{ - return port0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(mt32_state::samples_timer_cb) -{ - port0 ^= 0x10; -} - -WRITE8_MEMBER(mt32_state::so_w) -{ - // bit 0 = led - // bit 1-2 = reverb program a13/a14 - // bit 3-4 = nc - // bit 5 = boss x1 - // bit 6 = lcd cs, also handled internally by the gate array - // bit 7 = lcd clk, also handled internally by the gate array - // logerror("so: x1=%d bank=%d led=%d\n", (data >> 5) & 1, (data >> 1) & 3, data & 1); -} - -PALETTE_INIT_MEMBER(mt32_state, mt32) -{ - palette.set_pen_color(0, rgb_t(0, 0, 0)); - palette.set_pen_color(1, rgb_t(0, 255, 0)); -} - -static ADDRESS_MAP_START( mt32_map, AS_PROGRAM, 8, mt32_state ) - AM_RANGE(0x0100, 0x0100) AM_WRITE(bank_w) - AM_RANGE(0x0200, 0x0200) AM_WRITE(so_w) - AM_RANGE(0x021a, 0x021a) AM_READ_PORT("SC0") - AM_RANGE(0x021c, 0x021c) AM_READ_PORT("SC1") - AM_RANGE(0x0300, 0x0300) AM_WRITE(lcd_data_w) - AM_RANGE(0x0380, 0x0380) AM_READWRITE(lcd_ctrl_r, lcd_ctrl_w) - AM_RANGE(0x1000, 0x7fff) AM_ROM AM_REGION("maincpu", 0x1000) - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("fixed") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mt32_io, AS_IO, 16, mt32_state ) - AM_RANGE(i8x9x_device::A7, i8x9x_device::A7) AM_READ_PORT("A7") - AM_RANGE(i8x9x_device::SERIAL, i8x9x_device::SERIAL) AM_WRITE(midi_w) - AM_RANGE(i8x9x_device::P0, i8x9x_device::P0) AM_READ(port0_r) -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( mt32, mt32_state ) - MCFG_CPU_ADD( "maincpu", P8098, XTAL_12MHz ) - MCFG_CPU_PROGRAM_MAP( mt32_map ) - MCFG_CPU_IO_MAP( mt32_io ) - - MCFG_RAM_ADD( "ram" ) - MCFG_RAM_DEFAULT_SIZE( "32K" ) - - MCFG_SCREEN_ADD( "screen", LCD ) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DRIVER(mt32_state, screen_update) -// MCFG_SCREEN_SIZE(20*6-1, 9) - MCFG_SCREEN_SIZE(20*6-1, (20*6-1)*3/4) - MCFG_SCREEN_VISIBLE_AREA(0, 20*6-2, 0, (20*6-1)*3/4-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(mt32_state, mt32) - - MCFG_SED1200D0A_ADD( "lcd" ) - - MCFG_TIMER_DRIVER_ADD( "midi_timer", mt32_state, midi_timer_cb ) - - MCFG_TIMER_DRIVER_ADD_PERIODIC( "samples_timer", mt32_state, samples_timer_cb, attotime::from_hz(32000*2) ) -MACHINE_CONFIG_END - -ROM_START( mt32 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_DEFAULT_BIOS( "107" ) - - ROM_SYSTEM_BIOS( 0, "104", "Firmware 1.0.4" ) - ROMX_LOAD( "mt32_1.0.4.ic27.bin", 0, 0x8000, CRC(a93b65f2) SHA1(9cd4858014c4e8a9dff96053f784bfaac1092a2e), ROM_BIOS(1)|ROM_SKIP(1) ) - ROMX_LOAD( "mt32_1.0.4.ic26.bin", 1, 0x8000, CRC(b5ee2192) SHA1(fe8db469b5bfeb37edb269fd47e3ce6d91014652), ROM_BIOS(1)|ROM_SKIP(1) ) - - ROM_SYSTEM_BIOS( 1, "105", "Firmware 1.0.5" ) - ROMX_LOAD( "mt32_1.0.5.ic27.bin", 0, 0x8000, CRC(3281216c) SHA1(57a09d80d2f7ca5b9734edbe9645e6e700f83701), ROM_BIOS(2)|ROM_SKIP(1) ) - ROMX_LOAD( "mt32_1.0.5.ic26.bin", 1, 0x8000, CRC(e06d8020) SHA1(52e3c6666db9ef962591a8ee99be0cde17f3a6b6), ROM_BIOS(2)|ROM_SKIP(1) ) - - ROM_SYSTEM_BIOS( 2, "106", "Firmware 1.0.6" ) - ROMX_LOAD( "mt32_1.0.6.ic27.bin", 0, 0x8000, CRC(29369ae1) SHA1(cc83bf23cee533097fb4c7e2c116e43b50ebacc8), ROM_BIOS(3)|ROM_SKIP(1) ) - ROMX_LOAD( "mt32_1.0.6.ic26.bin", 1, 0x8000, CRC(4d495d98) SHA1(bf4f15666bc46679579498386704893b630c1171), ROM_BIOS(3)|ROM_SKIP(1) ) - - ROM_SYSTEM_BIOS( 3, "107", "Firmware 1.0.7" ) - ROMX_LOAD( "mt32_1.0.7.ic27.bin", 0, 0x8000, CRC(67fd8968) SHA1(13f06b38f0d9e0fc050b6503ab777bb938603260), ROM_BIOS(4)|ROM_SKIP(1) ) - ROMX_LOAD( "mt32_1.0.7.ic26.bin", 1, 0x8000, CRC(60f45882) SHA1(c55e165487d71fa88bd8c5e9c083bc456c1a89aa), ROM_BIOS(4)|ROM_SKIP(1) ) - - ROM_SYSTEM_BIOS( 4, "br", "Blue Ridge enhanced firmware" ) - ROMX_LOAD( "blue_ridge__mt32b.bin", 1, 0x8000, CRC(5816476f) SHA1(e0934320d7cbb5edfaa29e0d01ae835ef620085b), ROM_BIOS(5)|ROM_SKIP(1) ) - ROMX_LOAD( "blue_ridge__mt32a.bin", 0, 0x8000, CRC(d75fc3d9) SHA1(11a6ae5d8b6ee328b371af7f1e40b82125aa6b4d), ROM_BIOS(5)|ROM_SKIP(1) ) - - ROM_SYSTEM_BIOS( 5, "m9", "M9 enhanced firmware" ) - ROMX_LOAD( "a__m-9.27c256.ic27.bin", 0, 0x8000, CRC(c078ab00) SHA1(381e4208c0211a9a24a3a1b06a36760a1940ea6b), ROM_BIOS(6)|ROM_SKIP(1) ) - ROMX_LOAD( "b__m-9.27c256.ic26.bin", 1, 0x8000, CRC(e9c439c4) SHA1(36fece02eddd84230a7cf32f931c94dd14adbf2c), ROM_BIOS(6)|ROM_SKIP(1) ) - -// We need a bios-like selection for these too - ROM_REGION( 0x80000, "la32", 0 ) - ROM_LOAD16_BYTE( "r15179844.ic21.bin", 0, 0x40000, CRC(dd9deac3) SHA1(3a1e19b0cd4036623fd1d1d11f5f25995585962b) ) - ROM_LOAD16_BYTE( "r15179845.ic22.bin", 1, 0x40000, CRC(4ee6506c) SHA1(2cadb99d21a6a4a6f5b61b6218d16e9b43f61d01) ) - - ROM_LOAD( "r15449121.ic37.bin", 0, 0x80000, CRC(573e31cc) SHA1(f6b1eebc4b2d200ec6d3d21d51325d5b48c60252) ) - - - ROM_REGION( 0x8000, "boss", 0 ) - ROM_LOAD( "r15179857.ic13.bin", 0, 0x8000, CRC(cb219d85) SHA1(c2933cb7ad86e51904aa1c3bc12fa234e73a337f) ) -ROM_END - -ROM_START( cm32l ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_DEFAULT_BIOS( "102" ) - - ROM_SYSTEM_BIOS( 0, "100", "Firmware 1.00" ) - ROMX_LOAD( "lapc-i.v1.0.0.ic3.bin", 0, 0x10000, CRC(ee62022f) SHA1(73683d585cd6948cc19547942ca0e14a0319456d), ROM_BIOS(1) ) - - ROM_SYSTEM_BIOS( 1, "102", "Firmware 1.02" ) - ROMX_LOAD( "cm32l_control.rom", 0, 0x10000, CRC(b998047e) SHA1(a439fbb390da38cada95a7cbb1d6ca199cd66ef8), ROM_BIOS(2) ) - - ROM_REGION( 0x100000, "la32", 0 ) -// We need a bios-like selection for these too - ROM_LOAD( "r15179945.ic8.bin", 0, 0x80000, CRC(8e9ea06e) SHA1(3ad889fde5db5b6437cbc2eb6e305312fec3df93) ) - ROM_LOAD( "r15449121.ic9.bin", 0x80000, 0x80000, CRC(0d81f53c) SHA1(7cc7bf1d1f27b6fc5fbb75c5d6a9458703275b28) ) - - ROM_LOAD( "cm32l_pcm.rom", 0, 0x100000, CRC(04204baa) SHA1(f2a10225b0c191a10fbf068f1320c91b35c1c3f2) ) - - ROM_REGION( 0x8000, "boss", 0 ) - ROM_LOAD( "r15179917.ic19.bin", 0, 0x8000, CRC(236c87a6) SHA1(e1c03905c46e962d1deb15eeed92eb61b42bba4a) ) -ROM_END - -CONS( 1987, mt32, 0, 0, mt32, mt32, driver_device, 0, "Roland", "MT32", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) -CONS( 1989, cm32l, 0, 0, mt32, mt32, driver_device, 0, "Roland", "CM32L", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/rsc55.c b/src/mess/drivers/rsc55.c deleted file mode 100644 index 4d53cea0f17..00000000000 --- a/src/mess/drivers/rsc55.c +++ /dev/null @@ -1,83 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/************************************************************************************************* - - Roland Sound Canvas SC-55 - - Skeleton by R. Belmont - - Reference and LCD photo: http://www.synthman.com/roland/Roland_SC-55.html - http://en.wikipedia.org/wiki/Roland_SCC-1 - - The Roland SC55 is an expander (synthesizer without the keyboard) - from 1991. It has 24 voice polyphony, is 16 part multitimbral, and - outputs 16-bit stereo samples at 32 kHz. The synthesis engine uses a - combination of Roland's LA and straight PCM playback. - - The front panel includes the power switch, a headphone jack with volume knob, - a second MIDI IN port, a large LCD, ALL and MUTE buttons, and a group of up/down - buttons for Part, Level, Reverb, Key Shift, Instrument, Pan, Chorus, and MIDI Channel. - - The SCC-1 is an ISA board variant of the SC55 with a MPU-401 frontend added to - communicate with the synth. - - Main PCB: - - 20.0 MHz crystal - Roland R15239147 HG62E11B23FS 1L1 Japan - Roland R15199778 6435328A97F 1M1 R Japan - Roland R15239148 24201F002 9148EAI Japan - Roland R15209363 LH532H6D 9152 D - R15239176 BU3910F - HM62256ALFP-12T 32K by 8-bit RAM - 65256BLFP-12T 32K by 8-bit high-speed pseudo-static RAM - MB89251A - Serial data transceiver - - LCD controller (on front panel board) is a Toshiba T7934. -*/ - -#include "emu.h" -#include "machine/ram.h" -#include "cpu/mcs96/i8x9x.h" - -static INPUT_PORTS_START( sc55 ) -INPUT_PORTS_END - -class sc55_state : public driver_device -{ -public: - required_device m_maincpu; - - sc55_state(const machine_config &mconfig, device_type type, const char *tag); -}; - -sc55_state::sc55_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") -{ -} - -static ADDRESS_MAP_START( sc55_map, AS_PROGRAM, 8, sc55_state ) - AM_RANGE(0x1000, 0x3fff) AM_ROM AM_REGION("maincpu", 0x1000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sc55_io, AS_IO, 16, sc55_state ) -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( sc55, sc55_state ) - MCFG_CPU_ADD( "maincpu", P8098, XTAL_20MHz ) // probably not? - MCFG_CPU_PROGRAM_MAP( sc55_map ) - MCFG_CPU_IO_MAP( sc55_io ) -MACHINE_CONFIG_END - -ROM_START( sc55 ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "roland_r15209363.ic23", 0x000000, 0x040000, CRC(2dc58549) SHA1(9c17f85e784dc1549ac1f98d457b353393331f6b) ) - - ROM_REGION( 0x300000, "la", 0 ) - ROM_LOAD( "roland-gss.a_r15209276.ic28", 0x000000, 0x100000, CRC(1ac774d3) SHA1(8cc3c0d7ec0993df81d4ca1970e01a4b0d8d3775) ) - ROM_LOAD( "roland-gss.b_r15209277.ic27", 0x100000, 0x100000, CRC(8dcc592a) SHA1(80e6eb130c18c09955551563f78906163c55cc11) ) - ROM_LOAD( "roland-gss.c_r15209281.ic26", 0x200000, 0x100000, CRC(e21ebc04) SHA1(7454b817778179806f3f9d1985b3a2ef67ace76f) ) -ROM_END - -CONS( 1991, sc55, 0, 0, sc55, sc55, driver_device, 0, "Roland", "Sound Canvas SC-55", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/rt1715.c b/src/mess/drivers/rt1715.c deleted file mode 100644 index 30b2a2e43cb..00000000000 --- a/src/mess/drivers/rt1715.c +++ /dev/null @@ -1,377 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Robotron PC-1715 - - 10/06/2008 Preliminary driver. - - - Notes: - - - keyboard connected to sio channel a - - sio channel a clock output connected to ctc trigger 0 - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/z80pio.h" -#include "machine/z80dma.h" -#include "machine/ram.h" -#include "video/i8275.h" - - -class rt1715_state : public driver_device -{ -public: - rt1715_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG) { } - - int m_led1_val; - int m_led2_val; - DECLARE_WRITE8_MEMBER(rt1715_floppy_enable); - DECLARE_READ8_MEMBER(k7658_led1_r); - DECLARE_READ8_MEMBER(k7658_led2_r); - DECLARE_READ8_MEMBER(k7658_data_r); - DECLARE_WRITE8_MEMBER(k7658_data_w); - DECLARE_WRITE8_MEMBER(rt1715_rom_disable); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(rt1715); - I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); - required_device m_maincpu; - required_device m_ram; -}; - - -/*************************************************************************** - FLOPPY -***************************************************************************/ - -WRITE8_MEMBER(rt1715_state::rt1715_floppy_enable) -{ - logerror("%s: rt1715_floppy_enable %02x\n", machine().describe_context(), data); -} - - -/*************************************************************************** - KEYBOARD -***************************************************************************/ - -/* si/so led */ -READ8_MEMBER(rt1715_state::k7658_led1_r) -{ - m_led1_val ^= 1; - logerror("%s: k7658_led1_r %02x\n", machine().describe_context(), m_led1_val); - return 0xff; -} - -/* caps led */ -READ8_MEMBER(rt1715_state::k7658_led2_r) -{ - m_led2_val ^= 1; - logerror("%s: k7658_led2_r %02x\n", machine().describe_context(), m_led2_val); - return 0xff; -} - -/* read key state */ -READ8_MEMBER(rt1715_state::k7658_data_r) -{ - UINT8 result = 0xff; - - if (BIT(offset, 0)) result &= ioport("row_00")->read(); - if (BIT(offset, 1)) result &= ioport("row_10")->read(); - if (BIT(offset, 2)) result &= ioport("row_20")->read(); - if (BIT(offset, 3)) result &= ioport("row_30")->read(); - if (BIT(offset, 4)) result &= ioport("row_40")->read(); - if (BIT(offset, 5)) result &= ioport("row_50")->read(); - if (BIT(offset, 6)) result &= ioport("row_60")->read(); - if (BIT(offset, 7)) result &= ioport("row_70")->read(); - if (BIT(offset, 8)) result &= ioport("row_08")->read(); - if (BIT(offset, 9)) result &= ioport("row_18")->read(); - if (BIT(offset, 10)) result &= ioport("row_28")->read(); - if (BIT(offset, 11)) result &= ioport("row_38")->read(); - if (BIT(offset, 12)) result &= ioport("row_48")->read(); - - return result; -} - -/* serial output on D0 */ -WRITE8_MEMBER(rt1715_state::k7658_data_w) -{ - logerror("%s: k7658_data_w %02x\n", machine().describe_context(), BIT(data, 0)); -} - - -/*************************************************************************** - MEMORY HANDLING -***************************************************************************/ - -void rt1715_state::machine_start() -{ - membank("bank2")->set_base(m_ram->pointer() + 0x0800); - membank("bank3")->set_base(m_ram->pointer()); -} - -void rt1715_state::machine_reset() -{ - /* on reset, enable ROM */ - membank("bank1")->set_base(memregion("ipl")->base()); -} - -WRITE8_MEMBER(rt1715_state::rt1715_rom_disable) -{ - logerror("%s: rt1715_set_bank %02x\n", machine().describe_context(), data); - - /* disable ROM, enable RAM */ - membank("bank1")->set_base(m_ram->pointer()); -} - -/*************************************************************************** - VIDEO EMULATION -***************************************************************************/ - -I8275_DRAW_CHARACTER_MEMBER( rt1715_state::crtc_display_pixels ) -{ -} - -/* F4 Character Displayer */ -static const gfx_layout rt1715_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*128, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8, 8*128*8, 9*128*8, 10*128*8, 11*128*8, 12*128*8, 13*128*8, 14*128*8, 15*128*8 }, - 8 /* every char takes 1 x 16 bytes */ -}; - -static GFXDECODE_START( rt1715 ) - GFXDECODE_ENTRY("gfx", 0x0000, rt1715_charlayout, 0, 1) - GFXDECODE_ENTRY("gfx", 0x0800, rt1715_charlayout, 0, 1) -GFXDECODE_END - - -/*************************************************************************** - PALETTE -***************************************************************************/ - -PALETTE_INIT_MEMBER(rt1715_state, rt1715) -{ - palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); /* black */ - palette.set_pen_color(1, rgb_t(0x00, 0x7f, 0x00)); /* low intensity */ - palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); /* high intensitiy */ -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( rt1715_mem, AS_PROGRAM, 8, rt1715_state ) - AM_RANGE(0x0000, 0x07ff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank3") - AM_RANGE(0x0800, 0xffff) AM_RAMBANK("bank2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( rt1715_io, AS_IO, 8, rt1715_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("a71", z80pio_device, read_alt, write_alt) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("a72", z80pio_device, read_alt, write_alt) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("a30", z80ctc_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("a29", z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x18, 0x19) AM_DEVREADWRITE("a26", i8275_device, read, write) - AM_RANGE(0x20, 0x20) AM_WRITE(rt1715_floppy_enable) - AM_RANGE(0x28, 0x28) AM_WRITE(rt1715_rom_disable) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( k7658_mem, AS_PROGRAM, 8, rt1715_state ) - AM_RANGE(0x0000, 0xffff) AM_WRITE(k7658_data_w) - AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0xf800) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( k7658_io, AS_IO, 8, rt1715_state ) - AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x8000) AM_READ(k7658_led1_r) - AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x8000) AM_READ(k7658_led2_r) - AM_RANGE(0x8000, 0x9fff) AM_READ(k7658_data_r) -ADDRESS_MAP_END - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( k7658 ) - PORT_START("row_00") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_10") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_20") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_30") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_40") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_50") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_60") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_70") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_08") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_18") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_28") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_38") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_48") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -/* priority unknown */ -static const z80_daisy_config rt1715_daisy_chain[] = -{ - { "a71" }, - { "a72" }, - { "a30" }, - { "a29" }, - { NULL } -}; - -static MACHINE_CONFIG_START( rt1715, rt1715_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_2_4576MHz) - MCFG_CPU_PROGRAM_MAP(rt1715_mem) - MCFG_CPU_IO_MAP(rt1715_io) - MCFG_CPU_CONFIG(rt1715_daisy_chain) - - - /* keyboard */ - MCFG_CPU_ADD("keyboard", Z80, 683000) - MCFG_CPU_PROGRAM_MAP(k7658_mem) - MCFG_CPU_IO_MAP(k7658_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DEVICE("a26", i8275_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(78*6, 30*10) - MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", rt1715) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(rt1715_state, rt1715) - - MCFG_DEVICE_ADD("a26", I8275, XTAL_2_4576MHz) - MCFG_I8275_CHARACTER_WIDTH(8) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(rt1715_state, crtc_display_pixels) - - MCFG_DEVICE_ADD("a30", Z80CTC, XTAL_10MHz/4 /* ? */) - - MCFG_Z80SIO0_ADD("a29", XTAL_10MHz/4 /* ? */, 0, 0, 0, 0) - - /* floppy */ - MCFG_DEVICE_ADD("a71", Z80PIO, XTAL_10MHz/4 /* ? */) - MCFG_DEVICE_ADD("a72", Z80PIO, XTAL_10MHz/4 /* ? */) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( rt1715w, rt1715 ) -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( rt1715 ) - ROM_REGION(0x0800, "ipl", 0) - ROM_LOAD("s500.a25.3", 0x0000, 0x0800, NO_DUMP) // CCITT 90e7 - ROM_LOAD("s501.a25.3", 0x0000, 0x0800, NO_DUMP) // CCITT 68da - ROM_LOAD("s502.a25.3", 0x0000, 0x0800, CRC(7b6302e1) SHA1(e8f61763ff8841078a1939aa5e85a17f2af42163)) - - ROM_REGION(0x1000, "gfx", 0) - ROM_LOAD("s619.a25.2", 0x0000, 0x0800, CRC(98647763) SHA1(93fba51ed26392ec3eff1037886576fa12443fe5)) - ROM_LOAD("s602.a25.1", 0x0800, 0x0800, NO_DUMP) // CCITT fd67 - - ROM_REGION(0x0800, "keyboard", 0) - ROM_LOAD("s600.ic8", 0x0000, 0x0800, CRC(b7070122) SHA1(687056b822086ef0eee1e9b27e5b031bdbcade61)) - - ROM_REGION(0x0800, "floppy", 0) - ROM_LOAD("068.a8.2", 0x0000, 0x0400, CRC(5306d57b) SHA1(a12d025717b039a8a760eb9961365402f1f501f5)) // "read rom" - ROM_LOAD("069.a8.1", 0x0400, 0x0400, CRC(319fa72c) SHA1(5f26af1e36339a934760a63e5975e9db09abeaaf)) // "write rom" -ROM_END - -ROM_START( rt1715lc ) - ROM_REGION(0x0800, "ipl", 0) - ROM_LOAD("s500.a25.3", 0x0000, 0x0800, NO_DUMP) // CCITT 90e7 - ROM_LOAD("s501.a25.3", 0x0000, 0x0800, NO_DUMP) // CCITT 68da - ROM_LOAD("s502.a25.3", 0x0000, 0x0800, CRC(7b6302e1) SHA1(e8f61763ff8841078a1939aa5e85a17f2af42163)) - - ROM_REGION(0x1000, "gfx", 0) - ROM_LOAD("s643.a25.2", 0x0000, 0x0800, CRC(ea37f0e6) SHA1(357760974d944b9782734504b9820771e7e37645)) - ROM_LOAD("s605.a25.1", 0x0800, 0x0800, CRC(38062024) SHA1(798f62d4adeb7098b7dcbfe6caf28302853ee97d)) - - ROM_REGION(0x0800, "keyboard", 0) - ROM_LOAD("s642.ic8", 0x0000, 0x0800, NO_DUMP) // CCITT 962e - - ROM_REGION(0x0800, "floppy", 0) - ROM_LOAD("068.a8.2", 0x0000, 0x0400, CRC(5306d57b) SHA1(a12d025717b039a8a760eb9961365402f1f501f5)) // "read rom" - ROM_LOAD("069.a8.1", 0x0400, 0x0400, CRC(319fa72c) SHA1(5f26af1e36339a934760a63e5975e9db09abeaaf)) // "write rom" -ROM_END - -ROM_START( rt1715w ) - ROM_REGION(0x0800, "ipl", 0) - ROM_LOAD("s550.bin", 0x0000, 0x0800, CRC(0a96c754) SHA1(4d9ad5b877353d91ba355044d2847e1d621e2b01)) - - // loaded from floppy on startup - ROM_REGION(0x1000, "gfx", ROMREGION_ERASEFF) - - ROM_REGION(0x0800, "keyboard", 0) - ROM_LOAD("s600.ic8", 0x0000, 0x0800, CRC(b7070122) SHA1(687056b822086ef0eee1e9b27e5b031bdbcade61)) - - ROM_REGION(0x0100, "prom", 0) - ROM_LOAD("287.bin", 0x0000, 0x0100, CRC(8508360c) SHA1(d262a8c3cf2d284c67f23b853e0d59ae5cc1d4c8)) // /CAS decoder prom, 74S287 -ROM_END - - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, rt1715, 0, 0, rt1715, k7658, driver_device, 0, "Robotron", "Robotron PC-1715", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1986, rt1715lc, rt1715, 0, rt1715, k7658, driver_device, 0, "Robotron", "Robotron PC-1715 (latin/cyrillic)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1986, rt1715w, rt1715, 0, rt1715w, k7658, driver_device, 0, "Robotron", "Robotron PC-1715W", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/rvoice.c b/src/mess/drivers/rvoice.c deleted file mode 100644 index a91fa959943..00000000000 --- a/src/mess/drivers/rvoice.c +++ /dev/null @@ -1,405 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu, Kevin Horton -/****************************************************************************** -* -* Bare bones Realvoice PC driver -* By Jonathan Gevaryahu AKA Lord Nightmare -* Binary supplied by Kevin 'kevtris' Horton -* - -******************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "machine/mos6551.h" -//#include "dectalk.lh" // hack to avoid screenless system crash -#include "machine/terminal.h" - -/* Defines */ - -#define TERMINAL_TAG "terminal" - -/* Components */ - -struct hd63701y0_t -{ - UINT8 data[8]; - UINT8 P1DDR; - UINT8 P2DDR; - UINT8 PORT1; - UINT8 PORT2; - UINT8 P3DDR; - UINT8 P4DDR; - UINT8 PORT3; - UINT8 PORT4; - UINT8 TCSR1; - UINT8 FRCH; - UINT8 FRCL; - UINT8 OCR1H; - UINT8 OCR1L; - UINT8 ICRH; - UINT8 ICRL; - UINT8 TCSR2; - UINT8 RMCR; - UINT8 TRCSR1; - UINT8 RDR; - UINT8 TDR; - UINT8 RP5CR; - UINT8 PORT5; - UINT8 P6DDR; - UINT8 PORT6; - UINT8 PORT7; - UINT8 OCR2H; - UINT8 OCR2L; - UINT8 TCSR3; - UINT8 TCONR; - UINT8 T2CNT; - UINT8 TRCSR2; - UINT8 TSTREG; - UINT8 P5DDR; - UINT8 P6CSR; -}; - -struct rvoicepc_t -{ - UINT8 data[8]; - UINT8 port1; - UINT8 port2; - UINT8 port3; - UINT8 port4; - UINT8 port5; - UINT8 port6; - UINT8 port7; -}; - -class rvoice_state : public driver_device -{ -public: - rvoice_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - hd63701y0_t m_hd63701y0; - rvoicepc_t m_rvoicepc; - DECLARE_READ8_MEMBER(main_hd63701_internal_registers_r); - DECLARE_WRITE8_MEMBER(main_hd63701_internal_registers_w); - DECLARE_DRIVER_INIT(rvoicepc); - virtual void machine_reset(); - DECLARE_WRITE8_MEMBER(null_kbd_put); - required_device m_maincpu; -}; - - -/* Devices */ - -DRIVER_INIT_MEMBER(rvoice_state,rvoicepc) -{ -} - -void rvoice_state::machine_reset() -{ - /* following is from datasheet at http://datasheets.chipdb.org/Hitachi/63701/HD63701Y0.pdf */ - m_hd63701y0.P1DDR = 0xFE; // port 1 ddr, W - m_hd63701y0.P2DDR = 0x00; // port 2 ddr, W - m_hd63701y0.PORT1 = 0x00; // port 1, R/W - m_hd63701y0.PORT2 = 0x00; // port 2, R/W - m_hd63701y0.P3DDR = 0xFE; // port 3 ddr, W - m_hd63701y0.P4DDR = 0x00; // port 4 ddr, W - m_hd63701y0.PORT3 = 0x00; // port 3, R/W - m_hd63701y0.PORT4 = 0x00; // port 4, R/W - m_hd63701y0.TCSR1 = 0x00; // timer control/status, R/W - m_hd63701y0.FRCH = 0x00; - m_hd63701y0.FRCL = 0x00; - m_hd63701y0.OCR1H = 0xFF; - m_hd63701y0.OCR1L = 0xFF; - m_hd63701y0.ICRH = 0x00; - m_hd63701y0.ICRL = 0x00; - m_hd63701y0.TCSR2 = 0x10; - m_hd63701y0.RMCR = 0xC0; - m_hd63701y0.TRCSR1 = 0x20; - m_hd63701y0.RDR = 0x00; // Receive Data Reg, R - m_hd63701y0.TDR = 0x00; // Transmit Data Reg, W - m_hd63701y0.RP5CR = 0x78; // or 0xF8; Ram/Port5 Control Reg, R/W - m_hd63701y0.PORT5 = 0x00; // port 5, R/W - m_hd63701y0.P6DDR = 0x00; // port 6 ddr, W - m_hd63701y0.PORT6 = 0x00; // port 6, R/W - m_hd63701y0.PORT7 = 0x00; // port 7, R/W - m_hd63701y0.OCR2H = 0xFF; - m_hd63701y0.OCR2L = 0xFF; - m_hd63701y0.TCSR3 = 0x20; - m_hd63701y0.TCONR = 0xFF; - m_hd63701y0.T2CNT = 0x00; - m_hd63701y0.TRCSR2 = 0x28; - m_hd63701y0.TSTREG = 0x00; - m_hd63701y0.P5DDR = 0x00; // port 5 ddr, W - m_hd63701y0.P6CSR = 0x00; -} - -READ8_MEMBER(rvoice_state::main_hd63701_internal_registers_r) -{ - UINT8 data = 0; - logerror("main hd637B01Y0: %04x: read from 0x%02X: ", space.device().safe_pc(), offset); - switch(offset) - { - case 0x00: // Port 1 DDR - case 0x01: // Port 2 DDR - case 0x04: // Port 3 DDR - case 0x05: // Port 4 DDR - case 0x13: // TxD Register - case 0x16: // Port 6 DDR - case 0x1C: // Time Constant Register - case 0x20: // Port 5 DDR - logerror("a write only register! returning 0\n"); - data = 0; - return data; - case 0x02: // Port 1 - logerror("Port 1\n"); - data = m_hd63701y0.PORT1; - break; - case 0x03: // Port 2 - logerror("Port 2\n"); - data = m_hd63701y0.PORT1; - break; - case 0x06: // Port 3 - logerror("Port 3\n"); - data = m_hd63701y0.PORT3; - break; - case 0x07: // Port 4 - logerror("Port 4\n"); - data = m_hd63701y0.PORT4; - break; - case 0x08: // Timer Control/Status Register 1 - logerror("Timer Control/Status Register 1\n"); - data = m_hd63701y0.TCSR1; - break; - case 0x09: // Free Running Counter (MSB) - logerror("Free Running Counter (MSB)\n"); - data = m_hd63701y0.FRCH; - break; - case 0x0A: // Free Running Counter (LSB) - logerror("Free Running Counter (LSB)\n"); - data = m_hd63701y0.FRCL; - break; - // B C (D E) - case 0x0F: // Timer Control/Status Register 2 - logerror("Timer Control/Status Register 2\n"); - data = m_hd63701y0.TCSR2; - break; - // 10 11 (12) - - case 0x14: // RAM/Port 5 Control Register - logerror("RAM/Port 5 Control Register\n"); - data = m_hd63701y0.RP5CR; - break; - case 0x15: // Port 5 - logerror("Port 5\n"); - data = m_hd63701y0.PORT5; - break; - case 0x17: // Port 6 - logerror("Port 6\n"); - data = m_hd63701y0.PORT6; - break; - case 0x18: // Port 7 - logerror("Port 7\n"); - data = m_hd63701y0.PORT7; - break; - // 19 1a 1b 1c 1d 1e 1f - case 0x21: // Port 6 Control/Status Register - logerror("Port 6 Control/Status Register\n"); - data = m_hd63701y0.P6CSR; - break; - default: - logerror("\n"); - data = 0; - break; - } - logerror("returning %02X\n", data); - return data; -} - - -WRITE8_MEMBER(rvoice_state::main_hd63701_internal_registers_w) -{ - logerror("main hd637B01Y0: %04x: write to 0x%02X: ", space.device().safe_pc(), offset); - switch(offset) - { - case 0x00: // Port 1 DDR - logerror("Port 1 DDR of %02X\n", data); - m_hd63701y0.P1DDR = data; - m_rvoicepc.port1 = (m_hd63701y0.PORT1 & m_hd63701y0.P1DDR); - break; - case 0x01: // Port 2 DDR - logerror("Port 2 DDR of %02X\n", data); - m_hd63701y0.P2DDR = data; - m_rvoicepc.port2 = (m_hd63701y0.PORT2 & m_hd63701y0.P2DDR); - break; - case 0x02: // Port 1 - logerror("Port 1 of %02X\n", data); - m_hd63701y0.PORT1 = data; - m_rvoicepc.port1 = (m_hd63701y0.PORT1 & m_hd63701y0.P1DDR); - break; - case 0x03: // Port 2 - logerror("Port 2 of %02X\n", data); - m_hd63701y0.PORT2 = data; - m_rvoicepc.port2 = (m_hd63701y0.PORT2 & m_hd63701y0.P2DDR); - break; - case 0x04: // Port 3 DDR - logerror("Port 3 DDR of %02X\n", data); - m_hd63701y0.P3DDR = data; - m_rvoicepc.port3 = (m_hd63701y0.PORT3 & m_hd63701y0.P3DDR); - break; - case 0x05: // Port 4 DDR - logerror("Port 4 DDR of %02X\n", data); - m_hd63701y0.P4DDR = data; - m_rvoicepc.port4 = (m_hd63701y0.PORT4 & m_hd63701y0.P4DDR); - break; - case 0x06: // Port 3 - logerror("Port 3 of %02X\n", data); - m_hd63701y0.PORT3 = data; - m_rvoicepc.port3 = (m_hd63701y0.PORT3 & m_hd63701y0.P3DDR); - break; - case 0x07: // Port 4 - logerror("Port 4 of %02X\n", data); - m_hd63701y0.PORT4 = data; - m_rvoicepc.port4 = (m_hd63701y0.PORT4 & m_hd63701y0.P4DDR); - break; - case 0x08: // Timer Control/Status Register 1 - logerror("Timer Control/Status Register 1 of %02X\n", data); - m_hd63701y0.TCSR1 = data; - break; - case 0x09: // Free Running Counter (MSB) - logerror("Free Running Counter (MSB) of %02X\n", data); - m_hd63701y0.FRCH = data; - break; - case 0x0A: // Free Running Counter (LSB) - logerror("Free Running Counter (LSB) of %02X\n", data); - m_hd63701y0.FRCL = data; - break; - // B C (D E) - case 0x0F: // Timer Control/Status Register 2 - logerror("Timer Control/Status Register 2 of %02X\n", data); - m_hd63701y0.TCSR2 = data; - break; - // 10 11 (12) - case 0x13: // TxD Register - logerror("TxD Register of %02X\n", data); - m_hd63701y0.TDR = data; - break; - case 0x14: // RAM/Port 5 Control Register - logerror("RAM/Port 5 Control Register of %02X\n", data); - m_hd63701y0.RP5CR = data; - break; - case 0x15: // Port 5 - logerror("Port 5 of %02X\n", data); - m_hd63701y0.PORT5 = data; - m_rvoicepc.port5 = (m_hd63701y0.PORT5 & m_hd63701y0.P5DDR); - break; - case 0x16: // Port 6 DDR - logerror("Port 6 DDR of %02X\n", data); - m_hd63701y0.P6DDR = data; - m_rvoicepc.port6 = (m_hd63701y0.PORT6 & m_hd63701y0.P6DDR); - break; - case 0x17: // Port 6 - logerror("Port 6 of %02X\n", data); - m_hd63701y0.PORT6 = data; - m_rvoicepc.port6 = (m_hd63701y0.PORT6 & m_hd63701y0.P6DDR); - break; - case 0x18: // Port 7 - logerror("Port 7 of %02X\n", data); - m_hd63701y0.PORT7 = data; - m_rvoicepc.port7 = data; - break; - // 19 1a 1b 1c 1d 1e 1f - case 0x20: // Port 5 DDR - logerror("Port 5 DDR of %02X\n", data); - m_hd63701y0.P5DDR = data; - m_rvoicepc.port5 = (m_hd63701y0.PORT5 & m_hd63701y0.P5DDR); - break; - case 0x21: // Port 6 Control/Status Register - logerror("Port 6 Control/Status Register of %02X\n", data); - m_hd63701y0.P6CSR = data; - break; - default: - logerror("with data of %02X\n", data); - break; - } -} - - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(hd63701_main_mem, AS_PROGRAM, 8, rvoice_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0027) AM_READWRITE(main_hd63701_internal_registers_r, main_hd63701_internal_registers_w) // INTERNAL REGS - AM_RANGE(0x0040, 0x013f) AM_RAM // INTERNAL RAM (overlaps acia) - AM_RANGE(0x0060, 0x007f) AM_DEVREADWRITE("acia65c51", mos6551_device, read, write) // ACIA 65C51 - AM_RANGE(0x2000, 0x7fff) AM_RAM // EXTERNAL SRAM - AM_RANGE(0x8000, 0xffff) AM_ROM // 27512 EPROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(hd63701_main_io, AS_IO, 8, rvoice_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - - -/****************************************************************************** - Input Ports -******************************************************************************/ -static INPUT_PORTS_START( rvoicepc ) -INPUT_PORTS_END - -/****************************************************************************** - Machine Drivers -******************************************************************************/ -WRITE8_MEMBER(rvoice_state::null_kbd_put) -{ -} - -static MACHINE_CONFIG_START( rvoicepc, rvoice_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD63701, XTAL_7_3728MHz) - MCFG_CPU_PROGRAM_MAP(hd63701_main_mem) - MCFG_CPU_IO_MAP(hd63701_main_io) - - //MCFG_CPU_ADD("playercpu", HD63701, XTAL_7_3728MHz) // not dumped yet - //MCFG_CPU_PROGRAM_MAP(hd63701_slave_mem) - //MCFG_CPU_IO_MAP(hd63701_slave_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("acia65c51", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - - /* video hardware */ - //MCFG_DEFAULT_LAYOUT(layout_dectalk) // hack to avoid screenless system crash - - /* sound hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(rvoice_state, null_kbd_put)) - -MACHINE_CONFIG_END - - - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -ROM_START(rvoicepc) - - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("rv_pc.bin", 0x08000, 0x08000, CRC(4001cd5f) SHA1(d973c6e19e493eedd4f7216bc530ddb0b6c4921e)) - ROM_CONTINUE(0x8000, 0x8000) // first half of 27c512 rom is blank due to stupid address decoder circuit - -ROM_END - - - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1988?, rvoicepc, 0, 0, rvoicepc, rvoicepc, rvoice_state, rvoicepc, "Adaptive Communication Systems", "Realvoice PC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/rx78.c b/src/mess/drivers/rx78.c deleted file mode 100644 index be2f20e388b..00000000000 --- a/src/mess/drivers/rx78.c +++ /dev/null @@ -1,513 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Robbbert -/************************************************************************************************************ - - Gundam RX-78 (c) 1983 Bandai - - driver by Angelo Salese & Robbbert. - - TODO: - - implement printer - - Notes: - - BS-BASIC v1.0 have a graphic bug with the RX-78 logo, it doesn't set the read bank so all of the color - info minus plane 1 is lost when the screen scrolls vertically. Almost certainly a btanb. - - To stop a cmt load, press STOP + SHIFT keys - -============================================================================================================== - Summary of Monitor commands. - - The monitor is entered at bootup. The prompt is the * character. This is followed by a command - letter (upper case). Some commands require hex parameters. You must enter all 4 characters of - these. No spaces allowed except where shown. - - While in BASIC, you may enter the monitor by using the MON command. After you have finished, - you can return to BASIC by entering the command *J2005. - - - Tape commands: - *L Load a tape - *V Verify a tape - *S Save a block of memory to tape. You are asked for a filename (blank is allowed), the start address, - the end address, and the Jump address (where it should begin execution) - - - Memory commands: - *Dnnnn nnnn Displays a hex dump in the address range entered - *Mnnnn Allows you to examine and modify memory. Enter to skip to next, period (.) to quit. - *Jnnnn Transfer execution (Jump) to a program in memory at the specified address - - - Other: - *R This is a block transfer load from a mystery parallel device, using ports E0 and E1, - using handshaking similar to a centronics printer. The incoming file is loaded into - memory and it appears that the operator is not provided any information of what happened. - -*************************************************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/sn76496.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "machine/ram.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class rx78_state : public driver_device -{ -public: - rx78_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cass(*this, "cassette"), - m_cart(*this, "cartslot"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") - { } - - DECLARE_READ8_MEMBER( key_r ); - DECLARE_READ8_MEMBER( rx78_f0_r ); - DECLARE_READ8_MEMBER( rx78_vram_r ); - DECLARE_WRITE8_MEMBER( rx78_f0_w ); - DECLARE_WRITE8_MEMBER( rx78_vram_w ); - DECLARE_WRITE8_MEMBER( vram_read_bank_w ); - DECLARE_WRITE8_MEMBER( vram_write_bank_w ); - DECLARE_WRITE8_MEMBER( key_w ); - DECLARE_WRITE8_MEMBER( vdp_reg_w ); - DECLARE_WRITE8_MEMBER( vdp_bg_reg_w ); - DECLARE_WRITE8_MEMBER( vdp_pri_mask_w ); - UINT8 m_vram_read_bank; - UINT8 m_vram_write_bank; - UINT8 m_pal_reg[7]; - UINT8 m_pri_mask; - UINT8 m_key_mux; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DRIVER_INIT(rx78); - required_device m_maincpu; - required_device m_cass; - required_device m_cart; - required_device m_ram; - required_device m_palette; - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( rx78_cart ); -}; - - -#define MASTER_CLOCK XTAL_28_63636MHz - - -WRITE8_MEMBER( rx78_state::rx78_f0_w ) -{ - m_cass->output(BIT(data, 0) ? -1.0 : +1.0); -} - -READ8_MEMBER( rx78_state::rx78_f0_r ) -{ - return (m_cass->input() > 0.03); -} - - -void rx78_state::video_start() -{ -} - -UINT32 rx78_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *vram = memregion("vram")->base(); - int x,y,count; - - bitmap.fill(16, cliprect); - - count = 0x2c0; //first 0x2bf bytes aren't used for bitmap drawing apparently - - for(y=0;y<184;y++) - { - for(x=0;x<192;x+=8) - { - int color,pen[3],i; - - for (i = 0; i < 8; i++) - { - /* bg color */ - pen[0] = (m_pri_mask & 0x08) ? (vram[count + 0x6000] >> (i)) : 0x00; - pen[1] = (m_pri_mask & 0x10) ? (vram[count + 0x8000] >> (i)) : 0x00; - pen[2] = (m_pri_mask & 0x20) ? (vram[count + 0xa000] >> (i)) : 0x00; - - color = ((pen[0] & 1) << 0); - color |= ((pen[1] & 1) << 1); - color |= ((pen[2] & 1) << 2); - - if(color) - bitmap.pix16(y, x+i) = color; - - /* fg color */ - pen[0] = (m_pri_mask & 0x01) ? (vram[count + 0x0000] >> (i)) : 0x00; - pen[1] = (m_pri_mask & 0x02) ? (vram[count + 0x2000] >> (i)) : 0x00; - pen[2] = (m_pri_mask & 0x04) ? (vram[count + 0x4000] >> (i)) : 0x00; - - color = ((pen[0] & 1) << 0); - color |= ((pen[1] & 1) << 1); - color |= ((pen[2] & 1) << 2); - - if(color) - bitmap.pix16(y, x+i) = color; - } - count++; - } - } - - return 0; -} - - -READ8_MEMBER( rx78_state::key_r ) -{ - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", - "KEY4", "KEY5", "KEY6", "KEY7", - "KEY8", "JOY1P_0","JOY1P_1","JOY1P_2", - "JOY2P_0", "JOY2P_1", "JOY2P_2", "UNUSED" }; - - if(m_key_mux == 0x30) //status read - { - int res,i; - - res = 0; - for(i=0;i<15;i++) - res |= ioport(keynames[i])->read(); - - return res; - } - - if(m_key_mux >= 1 && m_key_mux <= 15) - return ioport(keynames[m_key_mux - 1])->read(); - - return 0; -} - -WRITE8_MEMBER( rx78_state::key_w ) -{ - m_key_mux = data; -} - -READ8_MEMBER( rx78_state::rx78_vram_r ) -{ - UINT8 *vram = memregion("vram")->base(); - - if(m_vram_read_bank == 0 || m_vram_read_bank > 6) - return 0xff; - - return vram[offset + ((m_vram_read_bank - 1) * 0x2000)]; -} - -WRITE8_MEMBER( rx78_state::rx78_vram_w ) -{ - UINT8 *vram = memregion("vram")->base(); - - if(m_vram_write_bank & 0x01) { vram[offset + 0 * 0x2000] = data; } - if(m_vram_write_bank & 0x02) { vram[offset + 1 * 0x2000] = data; } - if(m_vram_write_bank & 0x04) { vram[offset + 2 * 0x2000] = data; } - if(m_vram_write_bank & 0x08) { vram[offset + 3 * 0x2000] = data; } - if(m_vram_write_bank & 0x10) { vram[offset + 4 * 0x2000] = data; } - if(m_vram_write_bank & 0x20) { vram[offset + 5 * 0x2000] = data; } -} - -WRITE8_MEMBER( rx78_state::vram_read_bank_w ) -{ - m_vram_read_bank = data; -} - -WRITE8_MEMBER( rx78_state::vram_write_bank_w ) -{ - m_vram_write_bank = data; -} - -WRITE8_MEMBER( rx78_state::vdp_reg_w ) -{ - UINT8 r,g,b,res,i; - - m_pal_reg[offset] = data; - - for(i=0;i<16;i++) - { - res = ((i & 1) ? m_pal_reg[0 + (i & 8 ? 3 : 0)] : 0) | ((i & 2) ? m_pal_reg[1 + (i & 8 ? 3 : 0)] : 0) | ((i & 4) ? m_pal_reg[2 + (i & 8 ? 3 : 0)] : 0); - if(res & m_pal_reg[6]) //color mask, TODO: check this - res &= m_pal_reg[6]; - - r = (res & 0x11) == 0x11 ? 0xff : ((res & 0x11) == 0x01 ? 0x7f : 0x00); - g = (res & 0x22) == 0x22 ? 0xff : ((res & 0x22) == 0x02 ? 0x7f : 0x00); - b = (res & 0x44) == 0x44 ? 0xff : ((res & 0x44) == 0x04 ? 0x7f : 0x00); - - m_palette->set_pen_color(i, rgb_t(r,g,b)); - } -} - -WRITE8_MEMBER( rx78_state::vdp_bg_reg_w ) -{ - int r,g,b; - - r = (data & 0x11) == 0x11 ? 0xff : ((data & 0x11) == 0x01 ? 0x7f : 0x00); - g = (data & 0x22) == 0x22 ? 0xff : ((data & 0x22) == 0x02 ? 0x7f : 0x00); - b = (data & 0x44) == 0x44 ? 0xff : ((data & 0x44) == 0x04 ? 0x7f : 0x00); - - m_palette->set_pen_color(0x10, rgb_t(r,g,b)); -} - -WRITE8_MEMBER( rx78_state::vdp_pri_mask_w ) -{ - m_pri_mask = data; -} - - -static ADDRESS_MAP_START(rx78_mem, AS_PROGRAM, 8, rx78_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM - //AM_RANGE(0x2000, 0x5fff) // mapped by the cartslot - AM_RANGE(0x6000, 0xafff) AM_RAM //ext RAM - AM_RANGE(0xb000, 0xebff) AM_RAM - AM_RANGE(0xec00, 0xffff) AM_READWRITE(rx78_vram_r, rx78_vram_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(rx78_io, AS_IO, 8, rx78_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -// AM_RANGE(0xe2, 0xe2) AM_READNOP AM_WRITENOP //printer -// AM_RANGE(0xe3, 0xe3) AM_WRITENOP //printer - AM_RANGE(0xf0, 0xf0) AM_READWRITE(rx78_f0_r,rx78_f0_w) //cmt - AM_RANGE(0xf1, 0xf1) AM_WRITE(vram_read_bank_w) - AM_RANGE(0xf2, 0xf2) AM_WRITE(vram_write_bank_w) - AM_RANGE(0xf4, 0xf4) AM_READWRITE(key_r,key_w) //keyboard - AM_RANGE(0xf5, 0xfb) AM_WRITE(vdp_reg_w) //vdp - AM_RANGE(0xfc, 0xfc) AM_WRITE(vdp_bg_reg_w) //vdp - AM_RANGE(0xfe, 0xfe) AM_WRITE(vdp_pri_mask_w) - AM_RANGE(0xff, 0xff) AM_DEVWRITE("sn1", sn76489a_device, write) //psg -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( rx78 ) - PORT_START("KEY0") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("KEY1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("KEY2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - - PORT_START("KEY3") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("KEY4") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - - PORT_START("KEY5") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up Down Arrow") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right Left Arrow") PORT_CODE(KEYCODE_PGDN) - - PORT_START("KEY6") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME / CLR") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_UNUSED ) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INST / DEL") PORT_CODE(KEYCODE_BACKSPACE) - - PORT_START("KEY7") - PORT_BIT(0x07,IP_ACTIVE_HIGH,IPT_UNUSED ) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_UNUSED ) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_UNUSED ) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - - PORT_START("KEY8") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) //kana shift? - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED ) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0xf8,IP_ACTIVE_HIGH,IPT_UNUSED ) - - PORT_START("JOY1P_0") - PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Up Left") PORT_PLAYER(1) - PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) - - PORT_START("JOY1P_1") - PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Down Left") PORT_PLAYER(1) - PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Up Right") PORT_PLAYER(1) - PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("JOY1P_2") - PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Down Right") PORT_PLAYER(1) - PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) - - PORT_START("JOY2P_0") - PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Up Left") PORT_PLAYER(2) - PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) - - PORT_START("JOY2P_1") - PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Down Left") PORT_PLAYER(2) - PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Up Right") PORT_PLAYER(2) - PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("JOY2P_2") - PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Down Right") PORT_PLAYER(2) - PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) - - PORT_START("UNUSED") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -void rx78_state::machine_reset() -{ - address_space &prg = m_maincpu->space(AS_PROGRAM); - if (m_cart->exists()) - prg.install_read_handler(0x2000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -DEVICE_IMAGE_LOAD_MEMBER( rx78_state, rx78_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size != 0x2000 && size != 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -/* F4 Character Displayer */ -static const gfx_layout rx78_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 187, /* 187 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( rx78 ) - GFXDECODE_ENTRY( "maincpu", 0x1a27, rx78_charlayout, 0, 8 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( rx78, rx78_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, MASTER_CLOCK/7) // unknown divider - MCFG_CPU_PROGRAM_MAP(rx78_mem) - MCFG_CPU_IO_MAP(rx78_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", rx78_state, irq0_line_hold) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(rx78_state, screen_update) - MCFG_SCREEN_SIZE(192, 184) - MCFG_SCREEN_VISIBLE_AREA(0, 192-1, 0, 184-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16+1) //+1 for the background color - MCFG_GFXDECODE_ADD("gfxdecode", "palette", rx78) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "rx78_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(rx78_state, rx78_cart) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32k") - MCFG_RAM_EXTRA_OPTIONS("16k") - - MCFG_CASSETTE_ADD( "cassette" ) - - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_ADD("sn1", SN76489A, XTAL_28_63636MHz/8) // unknown divider - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","rx78") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( rx78 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(a194ea53) SHA1(ba39e73e6eb7cbb8906fff1f81a98964cd62af0d)) - - ROM_REGION( 6 * 0x2000, "vram", ROMREGION_ERASE00 ) -ROM_END - -DRIVER_INIT_MEMBER(rx78_state,rx78) -{ - UINT32 ram_size = m_ram->size(); - address_space &prg = m_maincpu->space(AS_PROGRAM); - - if (ram_size == 0x4000) - prg.unmap_readwrite(0x6000, 0xafff); -} - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, rx78, 0, 0, rx78, rx78, rx78_state, rx78, "Bandai", "Gundam RX-78", 0) diff --git a/src/mess/drivers/sacstate.c b/src/mess/drivers/sacstate.c deleted file mode 100644 index ac86d563934..00000000000 --- a/src/mess/drivers/sacstate.c +++ /dev/null @@ -1,158 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - SacState 8008 - - 23/02/2009 Skeleton driver. - -http://www.digibarn.com/stories/bill-pentz-story/index.html - -The year is listed as '1972/73'. - -All input to be in lowercase. -The weird characters that show on screen are various escape sequences. -These are different depending on the terminal type chosen. The codes -need to be understood and emulated before this system makes sense. - -Known Monitor commands: (from the disassembly) -! write buffer to AD000 -* set RAM036 flag -+ increment AD000 by 1 -+n increment AD000 by n -- decrement AD000 by 1 --n decrement AD000 by n -: clear RAM036 flag -= display AD000 -=nnn set AD000 to nnn -@ fill buffer with 026 - -unknown commands: / & d e l r s t u z \ ^ | ~ - -Other input will either result in '!' message, or halt. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8008/i8008.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class sacstate_state : public driver_device -{ -public: - sacstate_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(port00_r); - DECLARE_READ8_MEMBER(port01_r); - DECLARE_READ8_MEMBER(port04_r); - DECLARE_WRITE8_MEMBER(port08_w); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_term_data; - UINT8 m_val; - virtual void machine_reset(); -}; - -READ8_MEMBER( sacstate_state::port01_r ) -{ - UINT8 ret = m_val; - if (m_term_data) - ret |= 0x04; // data in - return ret; -} - -READ8_MEMBER( sacstate_state::port00_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( sacstate_state::port04_r ) -{ - logerror("unknown_r\n"); - return 0; -} - -WRITE8_MEMBER( sacstate_state::port08_w ) -{ - if (data == 0x40) - m_val = 0x40; - else - if (data == 0x04) - m_val = 0; -} - -static ADDRESS_MAP_START(sacstate_mem, AS_PROGRAM, 8, sacstate_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000,0x7ff) AM_ROM - AM_RANGE(0x800,0xfff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sacstate_io, AS_IO, 8, sacstate_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00,0x00) AM_READ(port00_r) - AM_RANGE(0x01,0x01) AM_READ(port01_r) - AM_RANGE(0x04,0x04) AM_READ(port04_r) - AM_RANGE(0x08,0x08) AM_WRITE(port08_w) - AM_RANGE(0x16,0x16) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x17,0x1f) AM_WRITENOP -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sacstate ) - PORT_START("CONFIG") - PORT_CONFNAME( 0x08, 0x08, "Terminal Type") // no idea of actual terminal types - PORT_CONFSETTING( 0x00, "A") - PORT_CONFSETTING( 0x08, "B") -INPUT_PORTS_END - -WRITE8_MEMBER( sacstate_state::kbd_put ) -{ - m_term_data = data; -} - -void sacstate_state::machine_reset() -{ - m_term_data = 0; - m_val = ioport("CONFIG")->read(); -} - -static MACHINE_CONFIG_START( sacstate, sacstate_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8008, 800000) - MCFG_CPU_PROGRAM_MAP(sacstate_mem) - MCFG_CPU_IO_MAP(sacstate_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(sacstate_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sacstate ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "sacst1.bin", 0x0700, 0x0100, CRC(ba020160) SHA1(6337cdf65583808768664653c937e50040aec6d4)) - ROM_LOAD( "sacst2.bin", 0x0600, 0x0100, CRC(26f3e505) SHA1(3526060dbd1bf885c2e686bc9a6082387630952a)) - ROM_LOAD( "sacst3.bin", 0x0500, 0x0100, CRC(965b3474) SHA1(6d9142e68d375fb000fd6ea48369d0801274ded6)) - ROM_LOAD( "sacst4.bin", 0x0400, 0x0100, CRC(3cd3e169) SHA1(75a99e8e4dbd6e054209a4979bb498f37e962697)) - ROM_LOAD( "sacst5.bin", 0x0300, 0x0100, CRC(30619454) SHA1(cb498880bec27c9adc44dc1267858555000452c6)) - ROM_LOAD( "sacst6.bin", 0x0200, 0x0100, CRC(a4cd2ff6) SHA1(3f4da5510c0778eb770c96c01f91f5cb7f5285fa)) - ROM_LOAD( "sacst7.bin", 0x0100, 0x0100, CRC(33971d8b) SHA1(9e0bbeef6a6a15107f270e8b285300284ee7f63f)) - ROM_LOAD( "sacst8.bin", 0x0000, 0x0100, CRC(931252ef) SHA1(e06ea6947f432f0a4ce944de74978d929920fb53)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1973, sacstate, 0, 0, sacstate, sacstate, driver_device, 0, "SacState", "SacState 8008", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/sage2.c b/src/mess/drivers/sage2.c deleted file mode 100644 index 6ba6993a153..00000000000 --- a/src/mess/drivers/sage2.c +++ /dev/null @@ -1,569 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Sage II - - For memory map look at : - http://www.thebattles.net/sage/img/SDT.pdf (pages 14-) - - - 06/12/2009 Skeleton driver. - -****************************************************************************/ - -/* - - TODO: - - - floppy loading - - TMS9914 IEEE-488 controller - - board 2 (4x 2651 USART) - - Winchester controller - -*/ - -#include "includes/sage2.h" -#include "bus/rs232/rs232.h" - - -//************************************************************************** -// MEMORY MANAGEMENT UNIT -//************************************************************************** - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( sage2_state::read ) -{ - UINT8 data = 0xff; - - if (m_reset || (offset >= 0xfe0000 && offset < 0xff4000)) - { - data = m_rom[offset & 0x1fff]; - } - else if (offset < 0x080000) - { - data = m_ram->pointer()[offset]; - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( sage2_state::write ) -{ - if (offset < 0x080000) - { - m_ram->pointer()[offset] = data; - } -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( sage2_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( sage2_mem, AS_PROGRAM, 16, sage2_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0xfeffff) AM_READWRITE8(read, write, 0xffff) - AM_RANGE(0xffc000, 0xffc007) AM_DEVREADWRITE8(I8253_1_TAG, pit8253_device, read, write, 0x00ff) - AM_RANGE(0xffc010, 0xffc01f) AM_NOP //AM_DEVREADWRITE8(TMS9914_TAG, tms9914_device, read, write, 0x00ff) - AM_RANGE(0xffc020, 0xffc027) AM_DEVREADWRITE8(I8255A_0_TAG, i8255_device, read, write, 0x00ff) // i8255, DIPs + Floppy ctrl port - AM_RANGE(0xffc030, 0xffc031) AM_DEVREADWRITE8(I8251_1_TAG, i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0xffc032, 0xffc033) AM_DEVREADWRITE8(I8251_1_TAG, i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0xffc040, 0xffc043) AM_DEVREADWRITE8(I8259_TAG, pic8259_device, read, write, 0x00ff) - AM_RANGE(0xffc050, 0xffc053) AM_DEVICE8(UPD765_TAG, upd765a_device, map, 0x00ff) - AM_RANGE(0xffc060, 0xffc067) AM_DEVREADWRITE8(I8255A_1_TAG, i8255_device, read, write, 0x00ff) // i8255, Printer - AM_RANGE(0xffc070, 0xffc071) AM_DEVREADWRITE8(I8251_0_TAG, i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0xffc072, 0xffc073) AM_DEVREADWRITE8(I8251_0_TAG, i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0xffc080, 0xffc087) AM_MIRROR(0x78) AM_DEVREADWRITE8(I8253_0_TAG, pit8253_device, read, write, 0x00ff) -// AM_RANGE(0xffc400, 0xffc407) AM_DEVREADWRITE8(S2651_0_TAG, s2651_device, read, write, 0x00ff) -// AM_RANGE(0xffc440, 0xffc447) AM_DEVREADWRITE8(S2651_1_TAG, s2651_device, read, write, 0x00ff) -// AM_RANGE(0xffc480, 0xffc487) AM_DEVREADWRITE8(S2651_2_TAG, s2651_device, read, write, 0x00ff) -// AM_RANGE(0xffc4c0, 0xffc4c7) AM_DEVREADWRITE8(S2651_3_TAG, s2651_device, read, write, 0x00ff) -// AM_RANGE(0xffc500, 0xffc7ff) // Winchester drive ports -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( sage2 ) -//------------------------------------------------- - -static INPUT_PORTS_START( sage2 ) - PORT_START("J7") - PORT_DIPNAME( 0x07, 0x07, "Terminal Baud Rate" ) PORT_DIPLOCATION("J7:1,2,3") - PORT_DIPSETTING( 0x07, "19200" ) - PORT_DIPSETTING( 0x06, "9600" ) - PORT_DIPSETTING( 0x05, "4800" ) - PORT_DIPSETTING( 0x04, "2400" ) - PORT_DIPSETTING( 0x03, "1200" ) - PORT_DIPSETTING( 0x02, "600" ) - PORT_DIPSETTING( 0x01, "300" ) - PORT_DIPSETTING( 0x00, "Reserved (19200)" ) - PORT_DIPNAME( 0x08, 0x08, "Parity Control" ) PORT_DIPLOCATION("J7:4") - PORT_DIPSETTING( 0x08, "Even Parity" ) - PORT_DIPSETTING( 0x00, "Disabled" ) - PORT_DIPNAME( 0x30, 0x20, "Boot Device" ) PORT_DIPLOCATION("J7:5,6") - PORT_DIPSETTING( 0x30, "Debugger" ) - PORT_DIPSETTING( 0x20, "Floppy Drive 0" ) - PORT_DIPSETTING( 0x10, "Winchester" ) - PORT_DIPSETTING( 0x00, "Reserved (Debugger)" ) - PORT_DIPNAME( 0x40, 0x40, "Floppy Configuration" ) PORT_DIPLOCATION("J7:7") - PORT_DIPSETTING( 0x40, "96 TPI" ) - PORT_DIPSETTING( 0x00, "48 TPI" ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Service_Mode ) ) PORT_DIPLOCATION("J7:8") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("J6") - PORT_DIPNAME( 0x1f, 0x07, "IEEE-488 Bus Address" ) PORT_DIPLOCATION("J6:1,2,3,4,5") - PORT_DIPSETTING( 0x00, "0" ) - PORT_DIPSETTING( 0x01, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x04, "4" ) - PORT_DIPSETTING( 0x05, "5" ) - PORT_DIPSETTING( 0x06, "6" ) - PORT_DIPSETTING( 0x07, "7" ) - PORT_DIPSETTING( 0x08, "8" ) - PORT_DIPSETTING( 0x09, "9" ) - PORT_DIPSETTING( 0x0a, "10" ) - PORT_DIPSETTING( 0x0b, "11" ) - PORT_DIPSETTING( 0x0c, "12" ) - PORT_DIPSETTING( 0x0d, "13" ) - PORT_DIPSETTING( 0x0e, "14" ) - PORT_DIPSETTING( 0x0f, "15" ) - PORT_DIPSETTING( 0x10, "16" ) - PORT_DIPSETTING( 0x11, "17" ) - PORT_DIPSETTING( 0x12, "18" ) - PORT_DIPSETTING( 0x13, "19" ) - PORT_DIPSETTING( 0x14, "20" ) - PORT_DIPSETTING( 0x15, "21" ) - PORT_DIPSETTING( 0x16, "22" ) - PORT_DIPSETTING( 0x17, "23" ) - PORT_DIPSETTING( 0x18, "24" ) - PORT_DIPSETTING( 0x19, "25" ) - PORT_DIPSETTING( 0x1a, "26" ) - PORT_DIPSETTING( 0x1b, "27" ) - PORT_DIPSETTING( 0x1c, "28" ) - PORT_DIPSETTING( 0x1d, "29" ) - PORT_DIPSETTING( 0x1e, "30" ) - PORT_DIPSETTING( 0x1f, "31" ) - PORT_DIPNAME( 0x20, 0x00, "IEEE-488 TALK" ) PORT_DIPLOCATION("J6:6") - PORT_DIPSETTING( 0x00, "Disabled" ) - PORT_DIPSETTING( 0x20, "Enabled" ) - PORT_DIPNAME( 0x40, 0x00, "IEEE-488 LISTEN" ) PORT_DIPLOCATION("J6:7") - PORT_DIPSETTING( 0x00, "Disabled" ) - PORT_DIPSETTING( 0x40, "Enabled" ) - PORT_DIPNAME( 0x80, 0x00, "IEEE-488 Consecutive Addresses" ) PORT_DIPLOCATION("J6:8") - PORT_DIPSETTING( 0x00, "1" ) - PORT_DIPSETTING( 0x80, "2" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// I8255A INTERFACE( ppi0_intf ) -//------------------------------------------------- - -/* - - IR0 U74 OUT2 - IR1 RX2I+ - IR2 TX1I+ - IR3 TX2I+ - IR4 MI- - IR5 CNI+ - IR6 U74 OUT0 - IR7 SI+ - -*/ - - -//------------------------------------------------- -// I8255A INTERFACE( ppi0_intf ) -//------------------------------------------------- - -WRITE8_MEMBER( sage2_state::ppi0_pc_w ) -{ - /* - - bit signal - - PC0 TC+ - PC1 RDY+ - PC2 FDIE+ - PC3 SL0- - PC4 SL1- - PC5 MOT- - PC6 PCRMP- - PC7 FRES+ - - */ - - // floppy terminal count - m_fdc->tc_w(BIT(data, 0)); - - // floppy ready - m_fdc->ready_w(BIT(data, 1)); - - // floppy interrupt enable - m_fdie = BIT(data, 2); - update_fdc_int(); - - // drive select - m_floppy = NULL; - - if (!BIT(data, 3)) m_floppy = m_floppy0->get_device(); - if (!BIT(data, 4)) m_floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(m_floppy); - - // floppy motor - if (m_floppy) m_floppy->mon_w(BIT(data, 5)); - - // FDC reset - if(BIT(data, 7)) m_fdc->reset(); -} - - -//------------------------------------------------- -// I8255A INTERFACE( ppi1_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER(sage2_state::write_centronics_ack) -{ - if (!state) - { - m_pic->ir5_w(ASSERT_LINE); - } -} - -WRITE_LINE_MEMBER(sage2_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER(sage2_state::write_centronics_perror) -{ - m_centronics_perror = state; -} - -WRITE_LINE_MEMBER(sage2_state::write_centronics_select) -{ - m_centronics_select = state; -} - -WRITE_LINE_MEMBER(sage2_state::write_centronics_fault) -{ - m_centronics_fault = state; -} - -READ8_MEMBER( sage2_state::ppi1_pb_r ) -{ - /* - - bit signal - - PB0 FDI+ - PB1 WP+ - PB2 RG- - PB3 CD- - PB4 BUSY - PB5 PAPER - PB6 SEL - PB7 FAULT- - - */ - - UINT8 data = 0; - - // floppy interrupt - data = m_fdc->get_irq(); - - // floppy write protected - data = (m_floppy ? m_floppy->wpt_r() : 1) << 1; - - // RS-232 ring indicator - - // RS-232 carrier detect - - // centronics - data |= m_centronics_busy << 4; - data |= m_centronics_perror << 5; - data |= m_centronics_select << 6; - data |= m_centronics_fault << 7; - - return data; -} - -WRITE8_MEMBER( sage2_state::ppi1_pc_w ) -{ - /* - - bit signal - - PC0 PRES- - PC1 U8 SC+ - PC2 SI+ - PC3 LEDR+ - PC4 STROBE- - PC5 PRIME- - PC6 U38 CL- - PC7 RMI- - - */ - - if (!BIT(data, 0)) - { - // clear parity error interrupt - m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); - } - - // s? interrupt - m_pic->ir7_w(BIT(data, 2)); - - // processor LED - output_set_led_value(0, BIT(data, 3)); - - // centronics - m_centronics->write_strobe(BIT(data, 4)); - m_centronics->write_init(BIT(data, 5)); - - if (!BIT(data, 6)) - { - // clear ACK interrupt - m_pic->ir5_w(CLEAR_LINE); - } - - if (!BIT(data, 7)) - { - // clear modem interrupt - m_pic->ir4_w(CLEAR_LINE); - } -} - -WRITE_LINE_MEMBER( sage2_state::br1_w ) -{ - m_usart0->write_txc(state); - m_usart0->write_rxc(state); -} - -WRITE_LINE_MEMBER( sage2_state::br2_w ) -{ - m_usart1->write_txc(state); - m_usart1->write_rxc(state); -} - -//------------------------------------------------- -// upd765_interface fdc_intf -//------------------------------------------------- - -static SLOT_INTERFACE_START( sage2_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Mitsubishi M4859 -SLOT_INTERFACE_END - -void sage2_state::update_fdc_int() -{ - m_maincpu->set_input_line(M68K_IRQ_6, m_fdie && m_fdc_int); -} - -WRITE_LINE_MEMBER( sage2_state::fdc_irq ) -{ - m_fdc_int = state; - update_fdc_int(); -} - - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_19200 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_19200 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( sage2 ) -//------------------------------------------------- - -void sage2_state::machine_start() -{ - // find memory regions - m_rom = memregion(M68000_TAG)->base(); -} - - -void sage2_state::machine_reset() -{ - m_reset = 1; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( sage2 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( sage2, sage2_state ) - // basic machine hardware - MCFG_CPU_ADD(M68000_TAG, M68000, XTAL_16MHz/2) - MCFG_CPU_PROGRAM_MAP(sage2_mem) - - // devices - MCFG_PIC8259_ADD(I8259_TAG, INPUTLINE(M68000_TAG, M68K_IRQ_1), VCC, NULL) - - MCFG_DEVICE_ADD(I8255A_0_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(IOPORT("J7")) - MCFG_I8255_IN_PORTB_CB(IOPORT("J6")) - MCFG_I8255_OUT_PORTC_CB(WRITE8(sage2_state, ppi0_pc_w)) - - MCFG_DEVICE_ADD(I8255A_1_TAG, I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_IN_PORTB_CB(READ8(sage2_state, ppi1_pb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(sage2_state, ppi1_pc_w)) - - MCFG_DEVICE_ADD(I8253_0_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(0) // from U75 OUT0 - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir6_w)) - MCFG_PIT8253_CLK1(XTAL_16MHz/2/125) - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE(I8253_0_TAG, pit8253_device, write_clk2)) - MCFG_PIT8253_CLK2(0) // from OUT2 - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir0_w)) - - MCFG_DEVICE_ADD(I8253_1_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_16MHz/2/125) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8253_0_TAG, pit8253_device, write_clk0)) - MCFG_PIT8253_CLK1(XTAL_16MHz/2/13) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(sage2_state, br1_w)) - MCFG_PIT8253_CLK2(XTAL_16MHz/2/13) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(sage2_state, br2_w)) - - MCFG_DEVICE_ADD(I8251_0_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(M68000_TAG, m68000_base_device, write_irq5)) - MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir2_w)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_0_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_0_TAG, i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_DEVICE_ADD(I8251_1_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir1_w)) - MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir3_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_1_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_1_TAG, i8251_device, write_dsr)) - - MCFG_UPD765A_ADD(UPD765_TAG, false, false) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(sage2_state, fdc_irq)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(sage2_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(sage2_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(sage2_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(sage2_state, write_centronics_select)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(sage2_state, write_centronics_fault)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", sage2_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", sage2_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_IEEE488_BUS_ADD() - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "sage2") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( sage2 ) -//------------------------------------------------- - -ROM_START( sage2 ) - ROM_REGION( 0x2000, M68000_TAG, 0 ) - ROM_LOAD16_BYTE( "sage2.u18", 0x0000, 0x1000, CRC(ca9b312d) SHA1(99436a6d166aa5280c3b2d28355c4d20528fe48c) ) - ROM_LOAD16_BYTE( "sage2.u17", 0x0001, 0x1000, CRC(27e25045) SHA1(041cd9d4617473d089f31f18cbb375046c3b61bb) ) -ROM_END - - - -//************************************************************************** -// DRIVER INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// DRIVER_INIT( sage2 ) -//------------------------------------------------- - -DIRECT_UPDATE_MEMBER(sage2_state::sage2_direct_update_handler) -{ - if (m_reset && address >= 0xfe0000) - { - m_reset = 0; - } - - return address; -} - -DRIVER_INIT_MEMBER(sage2_state,sage2) -{ - address_space &program = machine().device(M68000_TAG)->space(AS_PROGRAM); - program.set_direct_update_handler(direct_update_delegate(FUNC(sage2_state::sage2_direct_update_handler), this)); -} - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1982, sage2, 0, 0, sage2, sage2, sage2_state, sage2, "Sage Technology", "Sage II", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/samcoupe.c b/src/mess/drivers/samcoupe.c deleted file mode 100644 index e6262e1d0ff..00000000000 --- a/src/mess/drivers/samcoupe.c +++ /dev/null @@ -1,620 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Lee Hammerton, Dirk Best -/*************************************************************************** - - Miles Gordon Technology SAM Coupe - - Notes: - ------ - - Beware - the early ROMs are very buggy, and tend to go mad once BASIC - starts paging. ROM 10 (version 1.0) requires the CALL after F9 or BOOT - because the ROM loads the bootstrap but fails to execute it. The address - depends on the RAM size: - - On a 256K SAM: CALL 229385 - Or on a 512K (or larger) machine: CALL 491529 - - - Todo: - ----- - - - Attribute read - - Better timing - - Harddisk interfaces - -***************************************************************************/ - -/* core includes */ -#include "emu.h" -#include "includes/samcoupe.h" -# -/* components */ -#include "cpu/z80/z80.h" -#include "sound/saa1099.h" - -/* devices */ -#include "formats/tzx_cas.h" -#include "formats/coupedsk.h" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define SAMCOUPE_XTAL_X1 XTAL_24MHz -#define SAMCOUPE_XTAL_X2 XTAL_4_433619MHz - - -/*************************************************************************** - TIMERS -***************************************************************************/ - -void samcoupe_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_IRQ_OFF: - irq_off(ptr, param); - break; - case TIMER_MOUSE_RESET: - samcoupe_mouse_reset(ptr, param); - break; - case TIMER_VIDEO_UPDATE: - sam_video_update_callback(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in samcoupe_state::device_timer"); - } -} - -/*************************************************************************** - I/O PORTS -***************************************************************************/ - -READ8_MEMBER(samcoupe_state::samcoupe_disk_r) -{ - /* drive and side is encoded into bit 5 and 3 */ - floppy_connector *con = (BIT(offset, 4) ? m_wd1772_1 : m_wd1772_0); - floppy_image_device *floppy = con ? con->get_device() : 0; - - if(floppy) - floppy->ss_w(BIT(offset, 2)); - m_fdc->set_floppy(floppy); - - /* bit 1 and 2 select the controller register */ - switch (offset & 0x03) - { - case 0: return m_fdc->status_r(); - case 1: return m_fdc->track_r(); - case 2: return m_fdc->sector_r(); - case 3: return m_fdc->data_r(); - } - - return 0xff; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_disk_w) -{ - /* drive and side is encoded into bit 5 and 3 */ - floppy_connector *con = (BIT(offset, 4) ? m_wd1772_1 : m_wd1772_0); - floppy_image_device *floppy = con ? con->get_device() : 0; - - if(floppy) - floppy->ss_w(BIT(offset, 2)); - m_fdc->set_floppy(floppy); - - /* bit 1 and 2 select the controller register */ - switch (offset & 0x03) - { - case 0: m_fdc->cmd_w(data); break; - case 1: m_fdc->track_w(data); break; - case 2: m_fdc->sector_w(data); break; - case 3: m_fdc->data_w(data); break; - } -} - -READ8_MEMBER(samcoupe_state::samcoupe_pen_r) -{ - screen_device *scr = machine().first_screen(); - UINT8 data; - - if (offset & 0x100) - { - int vpos = scr->vpos(); - - /* return the current screen line or 192 for the border area */ - if (vpos < SAM_BORDER_TOP || vpos >= SAM_BORDER_TOP + SAM_SCREEN_HEIGHT) - data = 192; - else - data = vpos - SAM_BORDER_TOP; - } - else - { - /* horizontal position is encoded into bits 3 to 8 */ - data = scr->hpos() & 0xfc; - } - - return data; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_clut_w) -{ - m_clut[(offset >> 8) & 0x0f] = data & 0x7f; -} - -READ8_MEMBER(samcoupe_state::samcoupe_status_r) -{ - UINT8 data = 0xe0; - - /* bit 5-7, keyboard input */ - if (!BIT(offset, 8)) data &= m_keyboard_row_fe->read() & 0xe0; - if (!BIT(offset, 9)) data &= m_keyboard_row_fd->read() & 0xe0; - if (!BIT(offset, 10)) data &= m_keyboard_row_fb->read() & 0xe0; - if (!BIT(offset, 11)) data &= m_keyboard_row_f7->read() & 0xe0; - if (!BIT(offset, 12)) data &= m_keyboard_row_ef->read() & 0xe0; - if (!BIT(offset, 13)) data &= m_keyboard_row_df->read() & 0xe0; - if (!BIT(offset, 14)) data &= m_keyboard_row_bf->read() & 0xe0; - if (!BIT(offset, 15)) data &= m_keyboard_row_7f->read() & 0xe0; - - /* bit 0-4, interrupt source */ - data |= m_status; - - return data; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_line_int_w) -{ - m_line_int = data; -} - -READ8_MEMBER(samcoupe_state::samcoupe_lmpr_r) -{ - return m_lmpr; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_lmpr_w) -{ - address_space &space_program = m_maincpu->space(AS_PROGRAM); - - m_lmpr = data; - samcoupe_update_memory(space_program); -} - -READ8_MEMBER(samcoupe_state::samcoupe_hmpr_r) -{ - return m_hmpr; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_hmpr_w) -{ - address_space &space_program = m_maincpu->space(AS_PROGRAM); - - m_hmpr = data; - samcoupe_update_memory(space_program); -} - -READ8_MEMBER(samcoupe_state::samcoupe_vmpr_r) -{ - return m_vmpr; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_vmpr_w) -{ - address_space &space_program = m_maincpu->space(AS_PROGRAM); - - m_vmpr = data; - samcoupe_update_memory(space_program); -} - -READ8_MEMBER(samcoupe_state::samcoupe_midi_r) -{ - logerror("%s: read from midi port\n", machine().describe_context()); - return 0xff; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_midi_w) -{ - logerror("%s: write to midi port: 0x%02x\n", machine().describe_context(), data); -} - -READ8_MEMBER(samcoupe_state::samcoupe_keyboard_r) -{ - UINT8 data = 0x1f; - - /* bit 0-4, keyboard input */ - if (!BIT(offset, 8)) data &= m_keyboard_row_fe->read() & 0x1f; - if (!BIT(offset, 9)) data &= m_keyboard_row_fd->read() & 0x1f; - if (!BIT(offset, 10)) data &= m_keyboard_row_fb->read() & 0x1f; - if (!BIT(offset, 11)) data &= m_keyboard_row_f7->read() & 0x1f; - if (!BIT(offset, 12)) data &= m_keyboard_row_ef->read() & 0x1f; - if (!BIT(offset, 13)) data &= m_keyboard_row_df->read() & 0x1f; - if (!BIT(offset, 14)) data &= m_keyboard_row_bf->read() & 0x1f; - if (!BIT(offset, 15)) data &= m_keyboard_row_7f->read() & 0x1f; - - if (offset == 0xff00) - { - data &= m_keyboard_row_ff->read() & 0x1f; - - /* if no key has been pressed, return the mouse state */ - if (data == 0x1f) - data = samcoupe_mouse_r(); - } - - /* bit 5, lightpen strobe */ - data |= 1 << 5; - - /* bit 6, cassette input */ - data |= (m_cassette->input() > 0 ? 1 : 0) << 6; - - /* bit 7, external memory */ - data |= 1 << 7; - - return data; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_border_w) -{ - m_border = data; - - /* bit 3, cassette output */ - m_cassette->output( BIT(data, 3) ? -1.0 : +1.0); - - /* bit 4, beep */ - m_speaker->level_w(BIT(data, 4)); -} - -READ8_MEMBER(samcoupe_state::samcoupe_attributes_r) -{ - return m_attribute; -} - -WRITE_LINE_MEMBER(samcoupe_state::write_lpt1_busy) -{ - m_lpt1_busy = state; -} - -READ8_MEMBER(samcoupe_state::samcoupe_lpt1_busy_r) -{ - return m_lpt1_busy; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_lpt1_strobe_w) -{ - m_lpt1->write_strobe(data & 1); -} - -DECLARE_WRITE_LINE_MEMBER(samcoupe_state::write_lpt2_busy) -{ - m_lpt2_busy = state; -} - -READ8_MEMBER(samcoupe_state::samcoupe_lpt2_busy_r) -{ - return m_lpt2_busy; -} - -WRITE8_MEMBER(samcoupe_state::samcoupe_lpt2_strobe_w) -{ - m_lpt2->write_strobe(data & 1); -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( samcoupe_mem, AS_PROGRAM, 8, samcoupe_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAM AM_READWRITE(sam_bank1_r, sam_bank1_w) // AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAM AM_READWRITE(sam_bank2_r, sam_bank2_w) // AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_RAM AM_READWRITE(sam_bank3_r, sam_bank3_w) // AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAM AM_READWRITE(sam_bank4_r, sam_bank4_w) // AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( samcoupe_io, AS_IO, 8, samcoupe_state ) - AM_RANGE(0x0080, 0x0081) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_WRITE(samcoupe_ext_mem_w) - AM_RANGE(0x00e0, 0x00e7) AM_MIRROR(0xff10) AM_MASK(0xffff) AM_READWRITE(samcoupe_disk_r, samcoupe_disk_w) - AM_RANGE(0x00e8, 0x00e8) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVWRITE("lpt1_data_out", output_latch_device, write) - AM_RANGE(0x00e9, 0x00e9) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lpt1_busy_r, samcoupe_lpt1_strobe_w) - AM_RANGE(0x00ea, 0x00ea) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVWRITE("lpt2_data_out", output_latch_device, write) - AM_RANGE(0x00eb, 0x00eb) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lpt2_busy_r, samcoupe_lpt2_strobe_w) - AM_RANGE(0x00f8, 0x00f8) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_pen_r, samcoupe_clut_w) - AM_RANGE(0x00f9, 0x00f9) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_status_r, samcoupe_line_int_w) - AM_RANGE(0x00fa, 0x00fa) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lmpr_r, samcoupe_lmpr_w) - AM_RANGE(0x00fb, 0x00fb) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_hmpr_r, samcoupe_hmpr_w) - AM_RANGE(0x00fc, 0x00fc) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_vmpr_r, samcoupe_vmpr_w) - AM_RANGE(0x00fd, 0x00fd) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_midi_r, samcoupe_midi_w) - AM_RANGE(0x00fe, 0x00fe) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_keyboard_r, samcoupe_border_w) - AM_RANGE(0x00ff, 0x00ff) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READ(samcoupe_attributes_r) - AM_RANGE(0x00ff, 0x00ff) AM_MIRROR(0xfe00) AM_MASK(0xffff) AM_DEVWRITE("saa1099", saa1099_device, data_w) - AM_RANGE(0x01ff, 0x01ff) AM_MIRROR(0xfe00) AM_MASK(0xffff) AM_DEVWRITE("saa1099", saa1099_device, control_w) -ADDRESS_MAP_END - - -/*************************************************************************** - INTERRUPTS -***************************************************************************/ - -TIMER_CALLBACK_MEMBER(samcoupe_state::irq_off) -{ - /* adjust STATUS register */ - m_status |= param; - - /* clear interrupt */ - if ((m_status & 0x1f) == 0x1f) - m_maincpu->set_input_line(0, CLEAR_LINE); - -} - -void samcoupe_state::samcoupe_irq(UINT8 src) -{ - /* assert irq and a timer to set it off again */ - m_maincpu->set_input_line(0, ASSERT_LINE); - timer_set(attotime::from_usec(20), TIMER_IRQ_OFF, src); - - /* adjust STATUS register */ - m_status &= ~src; -} - -INTERRUPT_GEN_MEMBER(samcoupe_state::samcoupe_frame_interrupt) -{ - /* signal frame interrupt */ - samcoupe_irq(SAM_FRAME_INT); -} - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( samcoupe ) - PORT_START("keyboard_row_fe") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('?') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("keyboard_row_fd") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("keyboard_row_fb") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR('<') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR('>') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('[') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(']') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("keyboard_row_f7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - - PORT_START("keyboard_row_ef") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('~') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('/') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_START("keyboard_row_df") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('=') PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('"') PORT_CHAR('\xa9') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(F10)) - - PORT_START("keyboard_row_bf") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('\xa3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR('^') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EDIT") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("keyboard_row_7f") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SYMBOL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INV") PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR('\\') - - PORT_START("keyboard_row_ff") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("mouse_buttons") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_CODE(MOUSECODE_BUTTON3) PORT_NAME("Mouse Button 3") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 2") - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("mouse_x") - PORT_BIT(0xfff, 0x000, IPT_MOUSE_X) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_REVERSE - - PORT_START("mouse_y") - PORT_BIT(0xfff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) - - PORT_START("config") - PORT_CONFNAME(0x01, 0x00, "Real Time Clock") - PORT_CONFSETTING( 0x00, DEF_STR(None)) - PORT_CONFSETTING( 0x01, "SAMBUS") -INPUT_PORTS_END - - -/*************************************************************************** - PALETTE -***************************************************************************/ - -/* - Decode colours for the palette as follows: - - bit 7 6 5 4 3 2 1 0 - nothing G+4 R+4 B+4 ALL+1 G+2 R+2 B+2 - -*/ -PALETTE_INIT_MEMBER(samcoupe_state, samcoupe) -{ - for (int i = 0; i < 128; i++) - { - UINT8 b = BIT(i, 0) * 2 + BIT(i, 4) * 4 + BIT(i, 3); - UINT8 r = BIT(i, 1) * 2 + BIT(i, 5) * 4 + BIT(i, 3); - UINT8 g = BIT(i, 2) * 2 + BIT(i, 6) * 4 + BIT(i, 3); - - r <<= 5; - g <<= 5; - b <<= 5; - - palette.set_pen_color(i, rgb_t(r, g, b)); - } - - palette.palette()->normalize_range(0, 127); -} - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -FLOPPY_FORMATS_MEMBER( samcoupe_state::floppy_formats ) - FLOPPY_MGT_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( samcoupe_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( samcoupe, samcoupe_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, SAMCOUPE_XTAL_X1 / 4) /* 6 MHz */ - MCFG_CPU_PROGRAM_MAP(samcoupe_mem) - MCFG_CPU_IO_MAP(samcoupe_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", samcoupe_state, samcoupe_frame_interrupt) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(SAMCOUPE_XTAL_X1/2, SAM_TOTAL_WIDTH, 0, SAM_BORDER_LEFT + SAM_SCREEN_WIDTH + SAM_BORDER_RIGHT, SAM_TOTAL_HEIGHT, 0, SAM_BORDER_TOP + SAM_SCREEN_HEIGHT + SAM_BORDER_BOTTOM) - MCFG_SCREEN_UPDATE_DRIVER(samcoupe_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 128) - MCFG_PALETTE_INIT_OWNER(samcoupe_state, samcoupe) - - /* devices */ - MCFG_CENTRONICS_ADD("lpt1", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(samcoupe_state, write_lpt1_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("lpt1_data_out", "lpt1") - - MCFG_CENTRONICS_ADD("lpt2", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(samcoupe_state, write_lpt2_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("lpt2_data_out", "lpt2") - - MCFG_DEVICE_ADD("sambus_clock", MSM6242, XTAL_32_768kHz) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(tzx_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("samcoupe_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","samcoupe_cass") - - MCFG_WD1772_ADD("wd1772", SAMCOUPE_XTAL_X1/3) - MCFG_FLOPPY_DRIVE_ADD("wd1772:0", samcoupe_floppies, "35dd", samcoupe_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1772:1", samcoupe_floppies, "35dd", samcoupe_state::floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","samcoupe_flop") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SAA1099_ADD("saa1099", SAMCOUPE_XTAL_X1/3) /* 8 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_EXTRA_OPTIONS("256K,1280K,1536K,2304K,2560K,3328K,3584K,4352K,4608K") -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -/* - The bios is actually 32K. This is the combined version of the two old 16K MESS roms. - It does match the 3.0 one the most, but the first half differs in one byte - and in the second half, the case of the "plc" in the company string differs. -*/ -ROM_START( samcoupe ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "31", "v3.1" ) - ROMX_LOAD( "rom31.z5", 0x0000, 0x8000, CRC(0b7e3585) SHA1(c86601633fb61a8c517f7657aad9af4e6870f2ee), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "30", "v3.0" ) - ROMX_LOAD( "rom30.z5", 0x0000, 0x8000, CRC(e535c25d) SHA1(d390f0be420dfb12b1e54a4f528b5055d7d97e2a), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "25", "v2.5" ) - ROMX_LOAD( "rom25.z5", 0x0000, 0x8000, CRC(ddadd358) SHA1(a25ed85a0f1134ac3a481a3225f24a8bd3a790cf), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "24", "v2.4" ) - ROMX_LOAD( "rom24.z5", 0x0000, 0x8000, CRC(bb23fee4) SHA1(10cd911ba237dd2cf0c2637be1ad6745b7cc89b9), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "21", "v2.1" ) - ROMX_LOAD( "rom21.z5", 0x0000, 0x8000, CRC(f6804b46) SHA1(11dcac5fdea782cdac03b4d0d7ac25d88547eefe), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "20", "v2.0" ) - ROMX_LOAD( "rom20.z5", 0x0000, 0x8000, CRC(eaf32054) SHA1(41736323f0236649f2d5fe111f900def8db93a13), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS( 6, "181", "v1.81" ) - ROMX_LOAD( "rom181.z5", 0x0000, 0x8000, CRC(d25e1de1) SHA1(cb0fa79e4d5f7df0b57ede08ea7ecc9ae152f534), ROM_BIOS(7) ) - ROM_SYSTEM_BIOS( 7, "18", "v1.8" ) - ROMX_LOAD( "rom18.z5", 0x0000, 0x8000, CRC(f626063f) SHA1(485e7d9e9a4f8a70c0f93cd6e69ff12269438829), ROM_BIOS(8) ) - ROM_SYSTEM_BIOS( 8, "14", "v1.4" ) - ROMX_LOAD( "rom14.z5", 0x0000, 0x8000, CRC(08799596) SHA1(b4e596051f2748dee9481ea4af7d15ccddc1e1b5), ROM_BIOS(9) ) - ROM_SYSTEM_BIOS( 9, "13", "v1.3" ) - ROMX_LOAD( "rom13.z5", 0x0000, 0x8000, CRC(2093768c) SHA1(af8d348fd080b18a4cbe9ed69d254be7be330146), ROM_BIOS(10) ) - ROM_SYSTEM_BIOS( 10, "12", "v1.2" ) - ROMX_LOAD( "rom12.z5", 0x0000, 0x8000, CRC(7fe37dd8) SHA1(9339a0c1f72e8512c6f32dec15ab7d6c3bb04151), ROM_BIOS(11) ) - ROM_SYSTEM_BIOS( 11, "10", "v1.0" ) - ROMX_LOAD( "rom10.z5", 0x0000, 0x8000, CRC(3659d31f) SHA1(d3de7bb74e04d5b4dc7477f70de54d540b1bcc07), ROM_BIOS(12) ) - ROM_SYSTEM_BIOS( 12, "04", "v0.4" ) - ROMX_LOAD( "rom04.z5", 0x0000, 0x8000, CRC(f439e84e) SHA1(8bc457a5c764b0bb0aa7008c57f28c30248fc6a4), ROM_BIOS(13) ) - ROM_SYSTEM_BIOS( 13, "01", "v0.1" ) - ROMX_LOAD( "rom01.z5", 0x0000, 0x8000, CRC(c04acfdf) SHA1(8976ed005c14905eec1215f0a5c28aa686a7dda2), ROM_BIOS(14) ) -ROM_END - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, samcoupe, 0, 0, samcoupe, samcoupe, driver_device, 0, "Miles Gordon Technology plc", "SAM Coupe", 0 ) diff --git a/src/mess/drivers/sapi1.c b/src/mess/drivers/sapi1.c deleted file mode 100644 index 732baca6c3e..00000000000 --- a/src/mess/drivers/sapi1.c +++ /dev/null @@ -1,671 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - SAPI-1 driver by Miodrag Milanovic - - 2008-09-09 Preliminary driver. - - 2010-12-07 Added some code to allow sapizps3 to read its rom. - With no available docs, the i/o ports are a guess. The ram - allocation is based on the actions of the various bios roms. - Port 25 is used as a jump vector. in a,(25); ld l,a; jp(hl). - - 2012-04-19 Connected sapizps3 to a terminal. It is trying to - load a 128-byte boot sector from a floppy disk. - Modernised driver. - Connected sapizps2 to ascii keyboard. System is now usable. - According to wikipedia, sapi1 & 2 have cassette facility, - while sapi3 uses 8 inch floppy disk. - -ToDo: -- Add cassette to sapi1 and 2 --- UART on port 12, save and load bytes --- port 11 bit 7 for load, chr available --- port 11 bit 6 for save, tx buffer empty -- sapi3 is trying to read a disk, so there is no response after showing the logo - -Unable to proceed due to no info available (& in English). - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "machine/ram.h" -#include "machine/keyboard.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" -#define KEYBOARD_TAG "keyboard" - -class sapi1_state : public driver_device -{ -public: - sapi1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_bank1(*this, "bank1"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1"), - m_line2(*this, "LINE2"), - m_line3(*this, "LINE3"), - m_line4(*this, "LINE4"), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") - { - } - - optional_shared_ptr m_p_videoram; - DECLARE_READ8_MEMBER(sapi1_keyboard_r); - DECLARE_WRITE8_MEMBER(sapi1_keyboard_w); - DECLARE_READ8_MEMBER(sapi2_keyboard_status_r); - DECLARE_READ8_MEMBER(sapi2_keyboard_data_r); - DECLARE_READ8_MEMBER(sapi3_0c_r); - DECLARE_WRITE8_MEMBER(sapi3_00_w); - DECLARE_READ8_MEMBER(sapi3_25_r); - DECLARE_WRITE8_MEMBER(sapi3_25_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_DRIVER_INIT(sapizps3); - DECLARE_DRIVER_INIT(sapizps3a); - DECLARE_DRIVER_INIT(sapizps3b); - DECLARE_MACHINE_RESET(sapi1); - DECLARE_MACHINE_RESET(sapizps3); - MC6845_UPDATE_ROW(crtc_update_row); - UINT32 screen_update_sapi1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_sapi3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -private: - UINT8 m_term_data; - UINT8 m_keyboard_mask; - UINT8 m_refresh_counter; - UINT8 m_zps3_25; - optional_memory_bank m_bank1; // Only for sapi3 - required_ioport m_line0; - required_ioport m_line1; - required_ioport m_line2; - required_ioport m_line3; - required_ioport m_line4; - required_device m_maincpu; -public: - optional_device m_palette; -}; - -static const UINT8 MHB2501[] = { - 0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @ - 0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A - 0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B - 0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C - 0x1e,0x09,0x09,0x09,0x09,0x09,0x1e,0x00, // D - 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E - 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F - 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G - - 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H - 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I - 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J - 0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00, // K - 0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00, // L - 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M - 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N - 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O - - 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P - 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q - 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R - 0x0e,0x11,0x10,0x0e,0x01,0x11,0x0e,0x00, // S - 0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // T - 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U - 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V - 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W - - 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X - 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y - 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z - 0x1c,0x10,0x10,0x10,0x10,0x10,0x1c,0x00, // [ - 0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00, // backslash - 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ] - 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^ - 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _ - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // - 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // ! - 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // " - 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // # - 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // - 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // % - 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // & - 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // ' - - 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // ( - 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // ) - 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // * - 0x00,0x04,0x04,0x1f,0x04,0x04,0x00,0x00, // + - 0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00, // , - 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // - - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // . - 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // / - - 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0 - 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1 - 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2 - 0x1f,0x01,0x02,0x06,0x01,0x11,0x0e,0x00, // 3 - 0x02,0x06,0x0a,0x12,0x1f,0x02,0x02,0x00, // 4 - 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5 - 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6 - 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7 - - 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8 - 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9 - 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // : - 0x00,0x00,0x04,0x00,0x04,0x04,0x08,0x00, // ; - 0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00, // < - 0x00,0x00,0x1f,0x00,0x1f,0x00,0x00,0x00, // = - 0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00, // > - 0x0e,0x11,0x01,0x02,0x04,0x00,0x04,0x00 // ? -}; - - -/* Address maps */ -static ADDRESS_MAP_START(sapi1_mem, AS_PROGRAM, 8, sapi1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM - AM_RANGE(0x2000, 0x23ff) AM_RAM - AM_RANGE(0x2400, 0x27ff) AM_READWRITE(sapi1_keyboard_r, sapi1_keyboard_w) // PORT 0 - keyboard - //AM_RANGE(0x2800, 0x2bff) AM_NOP // PORT 1 - //AM_RANGE(0x2c00, 0x2fff) AM_NOP // PORT 2 - //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214 - AM_RANGE(0x3800, 0x3fff) AM_RAM AM_SHARE("videoram") // AND-1 (video RAM) - AM_RANGE(0x4000, 0x7fff) AM_RAM // REM-1 -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sapi2_mem, AS_PROGRAM, 8, sapi1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM - AM_RANGE(0x2000, 0x23ff) AM_RAM - AM_RANGE(0x2400, 0x27ff) AM_READ(sapi2_keyboard_status_r) - AM_RANGE(0x2800, 0x28ff) AM_READ(sapi2_keyboard_data_r) - AM_RANGE(0x3800, 0x3fff) AM_RAM AM_SHARE("videoram") // AND-1 (video RAM) - AM_RANGE(0x4000, 0x7fff) AM_RAM // REM-1 -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sapi3_mem, AS_PROGRAM, 8, sapi1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RAMBANK("bank1") - AM_RANGE(0x0800, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sapi3a_mem, AS_PROGRAM, 8, sapi1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RAMBANK("bank1") - AM_RANGE(0x0800, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xfdff) AM_ROM - AM_RANGE(0xfe00, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sapi3b_mem, AS_PROGRAM, 8, sapi1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RAMBANK("bank1") - AM_RANGE(0x0800, 0xafff) AM_RAM - AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0xb800, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sapi3_io, AS_IO, 8, sapi1_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(sapi3_00_w) - AM_RANGE(0x25, 0x25) AM_READWRITE(sapi3_25_r,sapi3_25_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sapi3a_io, AS_IO, 8, sapi1_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(sapi3_00_w) - AM_RANGE(0x12, 0x12) AM_READ(sapi2_keyboard_data_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x25, 0x25) AM_READWRITE(sapi3_25_r,sapi3_25_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sapi3b_io, AS_IO, 8, sapi1_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(sapi3_00_w) - AM_RANGE(0x0c, 0x0c) AM_READ(sapi3_0c_r) - AM_RANGE(0x25, 0x25) AM_READWRITE(sapi3_25_r,sapi3_25_w) - AM_RANGE(0xe0, 0xe0) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0xe1, 0xe1) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sapi1 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('~') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR(';') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('/') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(',') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('-') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR(':') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('<') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('"') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('.') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('@') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('>') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('?') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') -INPUT_PORTS_END - - - -/************************************** - - Video - -**************************************/ - -UINT32 sapi1_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bool val; - UINT16 addr,xpos; - UINT8 chr,attr,ra,x,y,b; - - for(y = 0; y < 24; y++ ) - { - addr = y*64; - xpos = 0; - for(x = 0; x < 40; x++ ) - { - chr = m_p_videoram[addr + x]; - attr = (chr >> 6) & 3; - chr &= 0x3f; - for(ra = 0; ra < 9; ra++ ) - { - for(b = 0; b < 6; b++ ) - { - val = 0; - - if (ra==8) - { - if (attr==2) - val = BIT(m_refresh_counter, 5); - } - else - { - val = BIT(MHB2501[(chr<<3) | ra], 5-b); - if (attr==1) - val = BIT(m_refresh_counter, 5) ? val : 0; - } - - if(attr==3) - { - bitmap.pix16(y*9+ra, xpos+2*b ) = val; - bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; - } - else - { - bitmap.pix16(y*9+ra, xpos+b ) = val; - } - } - } - xpos+= (attr==3) ? 12 : 6; - if (xpos>=6*40) break; - } - } - m_refresh_counter++; - return 0; -} - -// The attributes seem to be different on this one, they need to be understood, so disabled for now -UINT32 sapi1_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bool val; - UINT16 addr,xpos; - UINT8 chr,attr,ra,x,y,b; - - for(y = 0; y < 20; y++ ) - { - addr = y*64; - xpos = 0; - for(x = 0; x < 40; x++ ) - { - chr = m_p_videoram[addr + x]; - attr = 0;//(chr >> 6) & 3; - if (chr > 0x3f) - chr &= 0x1f; - - for(ra = 0; ra < 9; ra++ ) - { - for(b = 0; b < 6; b++ ) - { - val = 0; - - if (ra==8) - { - if (attr==2) - val = BIT(m_refresh_counter, 5); - } - else - { - val = BIT(MHB2501[(chr<<3) | ra], 5-b); - if (attr==1) - val = BIT(m_refresh_counter, 5) ? val : 0; - } - - if(attr==3) - { - bitmap.pix16(y*9+ra, xpos+2*b ) = val; - bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; - } - else - { - bitmap.pix16(y*9+ra, xpos+b ) = val; - } - } - } - xpos+= (attr==3) ? 12 : 6; - if (xpos>=6*40) break; - } - } - m_refresh_counter++; - return 0; -} - -MC6845_UPDATE_ROW( sapi1_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,inv; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - inv = gfx = 0; - if (x == cursor_x) inv ^= 0xff; - mem = (2*(ma + x)) & 0xfff; - chr = m_p_videoram[mem] & 0x3f; - - if (ra < 8) - gfx = MHB2501[(chr<<3) | ra] ^ inv; - - /* Display a scanline of a character */ - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} - -/************************************** - - Keyboard - -**************************************/ - -READ8_MEMBER( sapi1_state::sapi1_keyboard_r ) -{ - UINT8 key = 0xff; - if (BIT(m_keyboard_mask, 0)) { key &= m_line0->read(); } - if (BIT(m_keyboard_mask, 1)) { key &= m_line1->read(); } - if (BIT(m_keyboard_mask, 2)) { key &= m_line2->read(); } - if (BIT(m_keyboard_mask, 3)) { key &= m_line3->read(); } - if (BIT(m_keyboard_mask, 4)) { key &= m_line4->read(); } - return key; -} - -WRITE8_MEMBER( sapi1_state::sapi1_keyboard_w ) -{ - m_keyboard_mask = (data ^ 0xff ) & 0x1f; -} - -READ8_MEMBER( sapi1_state::sapi2_keyboard_status_r) -{ - return (m_term_data) ? 0 : 1; -} - -READ8_MEMBER( sapi1_state::sapi2_keyboard_data_r) -{ - UINT8 ret = ~m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( sapi1_state::kbd_put ) -{ - m_term_data = data; -} - -/************************************** - - Machine - -**************************************/ - -READ8_MEMBER( sapi1_state::sapi3_0c_r ) -{ - return 0xc0; -} - -/* switch out the rom shadow */ -WRITE8_MEMBER( sapi1_state::sapi3_00_w ) -{ - m_bank1->set_entry(0); -} - -/* to stop execution in random ram */ -READ8_MEMBER( sapi1_state::sapi3_25_r ) -{ - return m_zps3_25; -} - -WRITE8_MEMBER( sapi1_state::sapi3_25_w ) -{ - m_zps3_25 = data & 0xfc; //?? -} - -MACHINE_RESET_MEMBER( sapi1_state, sapi1 ) -{ - m_keyboard_mask = 0; - m_refresh_counter = 0x20; -} - -MACHINE_RESET_MEMBER( sapi1_state, sapizps3 ) -{ - m_keyboard_mask = 0; - m_bank1->set_entry(1); -} - -DRIVER_INIT_MEMBER( sapi1_state, sapizps3 ) -{ - UINT8 *RAM = memregion("maincpu")->base(); - m_bank1->configure_entries(0, 2, &RAM[0x0000], 0x10000); -} - -DRIVER_INIT_MEMBER( sapi1_state, sapizps3a ) -{ - UINT8 *RAM = memregion("maincpu")->base(); - m_bank1->configure_entries(0, 2, &RAM[0x0000], 0xf800); -} - -DRIVER_INIT_MEMBER( sapi1_state, sapizps3b ) -{ - UINT8 *RAM = memregion("maincpu")->base(); - m_bank1->configure_entries(0, 2, &RAM[0x0000], 0x10000); -} - - -/* Machine driver */ -static MACHINE_CONFIG_START( sapi1, sapi1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(sapi1_mem) - MCFG_MACHINE_RESET_OVERRIDE(sapi1_state, sapi1) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(40*6, 24*9) - MCFG_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*9-1) - MCFG_SCREEN_UPDATE_DRIVER(sapi1_state, screen_update_sapi1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sapi2, sapi1 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sapi2_mem) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(sapi1_state, kbd_put)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sapi3, sapi2 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sapi3_mem) - MCFG_CPU_IO_MAP(sapi3_io) - MCFG_MACHINE_RESET_OVERRIDE(sapi1_state, sapizps3 ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(40*6, 20*9) - MCFG_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 20*9-1) - MCFG_SCREEN_UPDATE_DRIVER(sapi1_state, screen_update_sapi3) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sapi3b, sapi3 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sapi3b_mem) - MCFG_CPU_IO_MAP(sapi3b_io) - - MCFG_MC6845_ADD("crtc", MC6845, "screen", 1008000) // guess - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(6) - MCFG_MC6845_UPDATE_ROW_CB(sapi1_state, crtc_update_row) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_SCREEN_NO_PALETTE -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( sapi3a, sapi1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 2000000) - MCFG_CPU_PROGRAM_MAP(sapi3a_mem) - MCFG_CPU_IO_MAP(sapi3a_io) - MCFG_MACHINE_RESET_OVERRIDE(sapi1_state, sapizps3 ) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(sapi1_state, kbd_put)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - - - -/************************************** - - Roms - -**************************************/ - -ROM_START( sapi1 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "mb1", "MB1" ) - ROMX_LOAD( "sapi1.rom", 0x0000, 0x1000, CRC(c6e85b01) SHA1(2a26668249c6161aef7215a1e2b92bfdf6fe3671), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "mb2", "MB2 (ANK-1)" ) - ROMX_LOAD( "mb2_4.bin", 0x0000, 0x1000, CRC(a040b3e0) SHA1(586990a07a96323741679a11ff54ad0023da87bc), ROM_BIOS(2)) -ROM_END - -ROM_START( sapizps2 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "v4", "MIKOS 4" ) - ROMX_LOAD( "36.bin", 0x0000, 0x0800, CRC(a27f340a) SHA1(d07d208fcbe428897336c17197d3e8fb52181f38), ROM_BIOS(1)) - ROMX_LOAD( "37.bin", 0x0800, 0x0800, CRC(30daa708) SHA1(66e990c40788ee25cf6cabd4842a78daf4fcdddd), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v5", "MIKOS 5" ) - ROMX_LOAD( "mikos5_1.bin", 0x0000, 0x0800, CRC(c2a83ca3) SHA1(a3678253d7690c89945e791ea0f8e15b081c9126), ROM_BIOS(2)) - ROMX_LOAD( "mikos5_2.bin", 0x0800, 0x0800, CRC(c4458a04) SHA1(0cc909323f0e6507d95e57ea39e1deb8bd57bf89), ROM_BIOS(2)) - ROMX_LOAD( "mikos5_3.bin", 0x1000, 0x0800, CRC(efb499f3) SHA1(78f0ca3ff10d7af4ae94ab820723296beb035f8f), ROM_BIOS(2)) - ROMX_LOAD( "mikos5_4.bin", 0x1800, 0x0800, CRC(4d90e9be) SHA1(8ec554198697550a49432e8210d43700ef1d6a32), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "mb3", "MB3 (Consul)" ) - ROMX_LOAD( "mb3_1.bin", 0x0000, 0x1000, CRC(be895f88) SHA1(7fc2a92f41d978a9f0ccd0e235ea3c6146adfb6f), ROM_BIOS(3)) -ROM_END - -ROM_START( sapizps3 ) - ROM_REGION( 0x10800, "maincpu", 0 ) - // These 2 bioses use videoram at F800 - ROM_SYSTEM_BIOS( 0, "per", "Perina" ) - ROMX_LOAD( "perina_1988.bin",0x10000, 0x0800, CRC(d71e8d3a) SHA1(9b3a26ea7c2f2c8a1fb10b51c1c880acc9fd806d), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "1zmod", "JPR-1Zmod" ) - ROMX_LOAD( "jpr1zmod.bin", 0x10000, 0x0800, CRC(69a29b07) SHA1(1cd31032954fcd7d10b1586be62db6f7597eb4f2), ROM_BIOS(2)) -ROM_END - -ROM_START( sapizps3a ) - ROM_REGION( 0x10000, "maincpu", 0 ) - // This bios uses a terminal - ROM_LOAD( "jpr1a.bin", 0xf800, 0x0800, CRC(3ed89786) SHA1(dcc8657b4884bfe58d114c539b733b73d038ee30)) -ROM_END - -ROM_START( sapizps3b ) - ROM_REGION( 0x10800, "maincpu", 0 ) - // This bios uses a 6845 - ROM_LOAD( "pkt1.bin", 0x10000, 0x0800, CRC(ed5a2725) SHA1(3383c15f87f976400b8d0f31829e2a95236c4b6c)) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, sapi1, 0, 0, sapi1, sapi1, driver_device, 0, "Tesla", "SAPI-1 ZPS 1", MACHINE_NO_SOUND_HW) -COMP( 1985, sapizps2, sapi1, 0, sapi2, sapi1, driver_device, 0, "Tesla", "SAPI-1 ZPS 2", MACHINE_NO_SOUND_HW) -COMP( 1985, sapizps3, sapi1, 0, sapi3, sapi1, sapi1_state, sapizps3, "Tesla", "SAPI-1 ZPS 3", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1985, sapizps3a,sapi1, 0, sapi3a, sapi1, sapi1_state, sapizps3a, "Tesla", "SAPI-1 ZPS 3 (terminal)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1985, sapizps3b,sapi1, 0, sapi3b, sapi1, sapi1_state, sapizps3b, "Tesla", "SAPI-1 ZPS 3 (6845)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/saturn.c b/src/mess/drivers/saturn.c deleted file mode 100644 index c28e60051f4..00000000000 --- a/src/mess/drivers/saturn.c +++ /dev/null @@ -1,904 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:David Haywood, Angelo Salese, Olivier Galibert, Mariusz Wojcieszek, R. Belmont -/************************************************************************************************** - - Sega Saturn & Sega ST-V (Sega Titan Video) HW (c) 1994 Sega - - Driver by David Haywood, Angelo Salese, Olivier Galibert & Mariusz Wojcieszek - SCSP driver provided by R. Belmont, based on ElSemi's SCSP sound chip emulator - Many thanks to Guru, Fabien, Runik and Charles MacDonald for the help given. - -=================================================================================================== - -Notes: --To enter into an Advanced Test Mode,keep pressed the Test Button (F2) on the start-up. --Memo: Some tests done on the original & working PCB,to be implemented: - -The AD-Stick returns 0x00 or a similar value. - -The Ports E,F & G must return 0xff - -TODO: -(Main issues) -- decap the SH-1, used for CD block (needed especially for Sega Saturn) -- IRQs: some games have some issues with timing accurate IRQs, check/fix all of them. -- The Cart-Dev mode hangs even with the -dev bios,I would like to see what it does on the real HW. -- IC13 games on the dev bios doesn't even load the cartridge / crashes the emulation at start-up, - rom rearrange needed? -- SCU DSP still has its fair share of issues, it also needs to be converted to CPU structure; -- Add the RS232c interface (serial port), needed by fhboxers (accesses some ports in the a-bus dummy range). -- Video emulation is nowhere near perfection. -- Reimplement the idle skip if possible. -- Move SCU device into its respective file; - -test1f diagnostic hacks: -"chash parge error" test 0x6035d04 <- 0x0009 (nop the button check) -"chase line pearg" test 0x6036964 <- 0x0009 (nop the button check again) - -****************************************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/eepromser.h" -#include "cpu/sh2/sh2.h" -#include "cpu/scudsp/scudsp.h" -#include "sound/scsp.h" -#include "sound/cdda.h" -#include "machine/smpc.h" -#include "machine/nvram.h" -#include "includes/stv.h" -#include "imagedev/chd_cd.h" -#include "coreutil.h" - -#include "bus/saturn/sat_slot.h" -#include "bus/saturn/rom.h" -#include "bus/saturn/dram.h" -#include "bus/saturn/bram.h" - - -class sat_console_state : public saturn_state -{ -public: - sat_console_state(const machine_config &mconfig, device_type type, const char *tag) - : saturn_state(mconfig, type, tag) - , m_exp(*this, "exp") - , m_nvram(*this, "nvram") - , m_smpc_nv(*this, "smpc_nv") - { } - - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); - DECLARE_INPUT_CHANGED_MEMBER(nmi_reset); - DECLARE_INPUT_CHANGED_MEMBER(tray_open); - DECLARE_INPUT_CHANGED_MEMBER(tray_close); - - DECLARE_MACHINE_START(saturn); - DECLARE_MACHINE_RESET(saturn); - - DECLARE_READ8_MEMBER(saturn_cart_type_r); - DECLARE_READ32_MEMBER( abus_dummy_r ); - - DECLARE_READ32_MEMBER(saturn_null_ram_r); - DECLARE_WRITE32_MEMBER(saturn_null_ram_w); - - void saturn_init_driver(int rgn); - DECLARE_DRIVER_INIT(saturnus); - DECLARE_DRIVER_INIT(saturneu); - DECLARE_DRIVER_INIT(saturnjp); - - void nvram_init(nvram_device &nvram, void *data, size_t size); - - required_device m_exp; - required_device m_nvram; - required_device m_smpc_nv; // TODO: move this in the base class saturn_state and add it to stv in MAME -}; - - -READ8_MEMBER(sat_console_state::saturn_cart_type_r) -{ - if (m_exp) - return m_exp->get_cart_type(); - else - return 0xff; -} - -/* TODO: Bug! accesses this one, if returning 0 the SH-2 hard-crashes. Might be an actual bug with the CD block. */ -READ32_MEMBER( sat_console_state::abus_dummy_r ) -{ - logerror("A-Bus Dummy access %08x\n",offset*4); - return -1; -} - -static ADDRESS_MAP_START( saturn_mem, AS_PROGRAM, 32, sat_console_state ) - AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_SHARE("share6") AM_WRITENOP // bios - AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE8(saturn_SMPC_r, saturn_SMPC_w,0xffffffff) - AM_RANGE(0x00180000, 0x0018ffff) AM_READWRITE8(saturn_backupram_r, saturn_backupram_w,0xffffffff) AM_SHARE("share1") - AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x20100000) AM_SHARE("workram_l") - AM_RANGE(0x01000000, 0x017fffff) AM_WRITE(saturn_minit_w) - AM_RANGE(0x01800000, 0x01ffffff) AM_WRITE(saturn_sinit_w) -// AM_RANGE(0x02000000, 0x023fffff) AM_ROM // Cartridge area -// AM_RANGE(0x02400000, 0x027fffff) AM_RAM // External Data RAM area -// AM_RANGE(0x04000000, 0x047fffff) AM_RAM // External Battery RAM area - AM_RANGE(0x04fffffc, 0x04ffffff) AM_READ8(saturn_cart_type_r,0x000000ff) - AM_RANGE(0x05000000, 0x057fffff) AM_READ(abus_dummy_r) - AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE(stvcd_r, stvcd_w) - /* Sound */ - AM_RANGE(0x05a00000, 0x05a7ffff) AM_READWRITE16(saturn_soundram_r, saturn_soundram_w,0xffffffff) - AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16("scsp", scsp_device, read, write, 0xffffffff) - /* VDP1 */ - AM_RANGE(0x05c00000, 0x05c7ffff) AM_READWRITE(saturn_vdp1_vram_r, saturn_vdp1_vram_w) - AM_RANGE(0x05c80000, 0x05cbffff) AM_READWRITE(saturn_vdp1_framebuffer0_r, saturn_vdp1_framebuffer0_w) - AM_RANGE(0x05d00000, 0x05d0001f) AM_READWRITE16(saturn_vdp1_regs_r, saturn_vdp1_regs_w,0xffffffff) - AM_RANGE(0x05e00000, 0x05e7ffff) AM_MIRROR(0x80000) AM_READWRITE(saturn_vdp2_vram_r, saturn_vdp2_vram_w) - AM_RANGE(0x05f00000, 0x05f7ffff) AM_READWRITE(saturn_vdp2_cram_r, saturn_vdp2_cram_w) - AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE16(saturn_vdp2_regs_r, saturn_vdp2_regs_w,0xffffffff) - AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(saturn_scu_r, saturn_scu_w) - AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x21f00000) AM_SHARE("workram_h") - AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE("share6") // bios mirror -// AM_RANGE(0x22000000, 0x24ffffff) AM_ROM // Cartridge area mirror - AM_RANGE(0x45000000, 0x46ffffff) AM_WRITENOP - AM_RANGE(0x60000000, 0x600003ff) AM_WRITENOP // cache address array - AM_RANGE(0xc0000000, 0xc0000fff) AM_RAM // cache data array, Dragon Ball Z sprites relies on this -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sound_mem, AS_PROGRAM, 16, sat_console_state ) - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("sound_ram") - AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE("scsp", scsp_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( scudsp_mem, AS_PROGRAM, 32, sat_console_state ) - AM_RANGE(0x00, 0xff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( scudsp_data, AS_DATA, 32, sat_console_state ) - AM_RANGE(0x00, 0xff) AM_RAM -ADDRESS_MAP_END - - -/* keyboard code */ -/* TODO: needs a proper keycode table */ -INPUT_CHANGED_MEMBER(sat_console_state::key_stroke) -{ - if(newval && !oldval) - { - m_keyb.data = ((UINT8)(FPTR)(param) & 0xff); - m_keyb.status |= 8; - } - - if(oldval && !newval) - { - //m_keyb.status &= ~8; - m_keyb.data = 0; - } -} - -/* Note: unused bits must stay high, Bug 2 relies on this. */ -#define SATURN_PAD_P1(_mask_, _val_) \ - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 A") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 C") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 B") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P1 R") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 X") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Y") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Z") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("P1 L") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0007, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) - -#define SATURN_PAD_P2(_mask_, _val_) \ - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 A") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 C") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 B") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P2 R") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 X") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Y") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Z") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("P2 L") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0007, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) - -#define MD_PAD_P1(_mask_, _val_) \ - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 A") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 C") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 B") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P1 Mode") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 X") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Y") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Z") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) //read '1' when direct mode is polled - -#define MD_PAD_P2(_mask_, _val_) \ - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 A") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 C") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 B") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P2 Mode") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 X") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Y") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Z") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) \ - PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("INPUT_TYPE", _mask_, EQUALS, _val_) //read '1' when direct mode is polled - -#define SATURN_KEYBOARD PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x05) - -INPUT_CHANGED_MEMBER(sat_console_state::nmi_reset) -{ - /* TODO: correct? */ - if(!m_NMI_reset) - return; - - /* TODO: NMI doesn't stay held on SH-2 core so we can't use ASSERT_LINE/CLEAR_LINE with that yet */ - if(newval) - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -INPUT_CHANGED_MEMBER(sat_console_state::tray_open) -{ - if(newval) - stvcd_set_tray_open(); -} - -INPUT_CHANGED_MEMBER(sat_console_state::tray_close) -{ - if(newval) - stvcd_set_tray_close(); -} - -static INPUT_PORTS_START( saturn ) - PORT_START("RESET") /* hardwired buttons */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, nmi_reset,0) PORT_NAME("Reset Button") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, tray_open,0) PORT_NAME("Tray Open Button") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, tray_close,0) PORT_NAME("Tray Close") - - PORT_START("JOY1") - SATURN_PAD_P1(0x0f, 0) - - PORT_START("JOY2") - SATURN_PAD_P2(0xf0, 0) - - /* TODO: there's no info about the keycode used on Saturn keyboard, following is trial & error with Game Basic software */ - PORT_START("KEY0") // 0x00 - 0x07 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_UNUSED) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") /*PORT_CODE(KEYCODE_F1)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x01) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x02) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") /*PORT_CODE(KEYCODE_F2)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x03) PORT_PLAYER(1) SATURN_KEYBOARD // RUN - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") /*PORT_CODE(KEYCODE_F3)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x04) PORT_PLAYER(1) SATURN_KEYBOARD // LIST - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") /*PORT_CODE(KEYCODE_F4)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x05) PORT_PLAYER(1) SATURN_KEYBOARD // EDIT - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") /*PORT_CODE(KEYCODE_F5)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x06) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLR SCR") PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x07) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY1") // 0x08 - 0x0f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x08) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6") /*PORT_CODE(KEYCODE_F6)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x09) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F7") /*PORT_CODE(KEYCODE_F7)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F8") /*PORT_CODE(KEYCODE_F8)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0b) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F9") /*PORT_CODE(KEYCODE_F9)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0c) PORT_PLAYER(1) SATURN_KEYBOARD // LIST again - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0d) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0e) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x0f) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY2") // 0x10 - 0x17 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x10) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x11) PORT_PLAYER(1) SATURN_KEYBOARD - /* TODO: break codes! */ - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x12) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA SHIFT") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x13) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(special keys)") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x14) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x15) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x16) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x17) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY3") // 0x18 - 0x1f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x18) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x19) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1b) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1c) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1d) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1e) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x1f) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY4") // 0x20 - 0x27 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x20) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x21) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x22) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x23) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x24) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x25) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x26) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x27) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY5") // 0x28 - 0x2f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-1") /*PORT_CODE(KEYCODE_F) PORT_CHAR('F')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x28) PORT_PLAYER(1) SATURN_KEYBOARD // another F? - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x29) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2b) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2c) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2d) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2e) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x2f) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY6") // 0x30 - 0x37 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x30) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x31) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x32) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x33) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x34) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x35) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x36) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x37) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY7") // 0x38 - 0x3f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x38) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x39) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3b) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3c) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3d) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3e) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x3f) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY8") // 0x40 - 0x47 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x40) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x41) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x42) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x43) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x44) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x45) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x46) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x47) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEY9") // 0x48 - 0x4f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x48) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x49) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4b) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4c) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4d) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- / =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4e) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x4f) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEYA") // 0x50 - 0x57 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x50) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xC2\xA5") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x51) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x52) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x53) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x54) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x55) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x56) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x57) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEYB") // 0x58 - 0x5f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x58) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x59) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5b) PORT_PLAYER(1) SATURN_KEYBOARD // { - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5c) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5d) PORT_PLAYER(1) SATURN_KEYBOARD // } - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5e) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x5f) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEYC") // 0x60 - 0x67 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x60) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x61) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x62) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x63) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x64) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x65) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) /* PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x66) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x67) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEYD") // 0x68 - 0x6f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x68) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x69) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6b) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6c) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6d) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6e) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x6f) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEYE") // 0x70 - 0x77 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x70) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x71) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x72) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x73) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x74) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x75) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x76) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x77) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("KEYF") // 0x78 - 0x7f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x78) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x79) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7b) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7c) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR(0xd)*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7d) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7e) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7f) PORT_PLAYER(1) SATURN_KEYBOARD //SYSTEM CONFIGURATION - - PORT_START("KEYS_1") // special keys - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) /*PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x78) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) /*PORT_CHAR('1')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x79) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) /*PORT_CHAR('2')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7a) PORT_PLAYER(1) SATURN_KEYBOARD - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) /*PORT_CHAR('3')*/ PORT_CHANGED_MEMBER(DEVICE_SELF, sat_console_state, key_stroke, 0x7b) PORT_PLAYER(1) SATURN_KEYBOARD - - PORT_START("MOUSEB1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Pointer Left Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Pointer Right Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Pointer Middle Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Pointer Start Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Mouse Left Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Mouse Right Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Mouse Middle Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P1 Mouse Start Button") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) - - PORT_START("MOUSEX1") - PORT_BIT(0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_NAME("P1 Pointer X") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) - PORT_BIT(0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_NAME("P1 Mouse X") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) - - PORT_START("MOUSEY1") - PORT_BIT(0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_REVERSE PORT_NAME("P1 Pointer Y") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x04) - PORT_BIT(0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_REVERSE PORT_NAME("P1 Mouse Y") PORT_PLAYER(1) PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x08) - - PORT_START("MOUSEB2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Pointer Left Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Pointer Right Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Pointer Middle Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P2 Pointer Start Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Mouse Left Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Mouse Right Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Mouse Middle Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("P2 Mouse Start Button") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) - - PORT_START("MOUSEX2") - PORT_BIT(0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_NAME("P2 Pointer X") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) - PORT_BIT(0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_NAME("P2 Mouse X") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) - - PORT_START("MOUSEY2") - PORT_BIT(0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_REVERSE PORT_NAME("P2 Pointer Y") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x40) - PORT_BIT(0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0xffff) PORT_KEYDELTA(2) PORT_RESET PORT_REVERSE PORT_NAME("P2 Mouse Y") PORT_PLAYER(2) PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x80) - - PORT_START("AN_JOY1") - SATURN_PAD_P1(0x0f, 0x01) // racing device - SATURN_PAD_P1(0x0f, 0x02) // analog controller - - PORT_START("AN_JOY2") - SATURN_PAD_P2(0xf0, 0x10) // racing device - SATURN_PAD_P2(0xf0, 0x20) // analog controller - - PORT_START("AN_X1") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 Racing Stick X") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x01) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 AD Stick X") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x02) - - PORT_START("AN_Y1") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 Racing Stick Y") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x01) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 AD Stick Y") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x02) - - PORT_START("AN_Z1") - PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Z ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 Racing Stick Z") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x01) - PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Z ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(1) PORT_NAME("P1 AD Stick Z") PORT_CONDITION("INPUT_TYPE", 0x0f, EQUALS, 0x02) - - PORT_START("AN_X2") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 Racing Stick X") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x10) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 AD Stick X") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x20) - - PORT_START("AN_Y2") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 Racing Stick Y") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x10) - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 AD Stick Y") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x20) - - PORT_START("AN_Z2") - PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Z ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 Racing Stick Z") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x10) - PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Z ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_PLAYER(2) PORT_NAME("P2 AD Stick Z") PORT_CONDITION("INPUT_TYPE", 0xf0, EQUALS, 0x20) - - PORT_START("MD_JOY1") - MD_PAD_P1(0x0f, 0x06) // MD 3 buttons pad - MD_PAD_P1(0x0f, 0x07) // MD 6 buttons pad - - PORT_START("MD_JOY2") - MD_PAD_P2(0xf0, 0x60) // MD 3 buttons pad - MD_PAD_P2(0xf0, 0x70) // MD 6 buttons pad - - PORT_START("INPUT_TYPE") - PORT_CONFNAME(0x0f,0x00,"Controller Port 1") - PORT_CONFSETTING(0x00,"Digital Device (standard Saturn pad)") - PORT_CONFSETTING(0x01,"Racing Device") /* steering wheel only */ - PORT_CONFSETTING(0x02,"Analog Device") //Nights pad? -// PORT_CONFSETTING(0x03,"Lightgun Device") - PORT_CONFSETTING(0x04,"Trackball") // TODO: according to the docs this ID is labeled "Pointing Device" - PORT_CONFSETTING(0x05,"Keyboard Device") - PORT_CONFSETTING(0x06,"Megadrive 3B Pad") - PORT_CONFSETTING(0x07,"Megadrive 6B Pad") - PORT_CONFSETTING(0x08,"Saturn Mouse") -// PORT_CONFSETTING(0x09,"") - PORT_CONFNAME(0xf0,0x00,"Controller Port 2") - PORT_CONFSETTING(0x00,"Digital Device (standard Saturn pad)") - PORT_CONFSETTING(0x10,"Racing Device") - PORT_CONFSETTING(0x20,"Analog Device") //Nights pad? -// PORT_CONFSETTING(0x30,"Lightgun Device") - PORT_CONFSETTING(0x40,"Pointing Device") -// PORT_CONFSETTING(0x50,"Keyboard Device") - PORT_CONFSETTING(0x60,"Megadrive 3B Pad") - PORT_CONFSETTING(0x70,"Megadrive 6B Pad") - PORT_CONFSETTING(0x80,"Saturn Mouse") - PORT_CONFSETTING(0x90,"") - - PORT_START("fake") - PORT_CONFNAME(0x01,0x00,"Master-Slave Comms") - PORT_CONFSETTING(0x00,"Normal (400 cycles)") - PORT_CONFSETTING(0x01,"One Shot (Hack)") -INPUT_PORTS_END - - -/* TODO: if you change the driver configuration then NVRAM contents gets screwed, needs mods in MAME framework */ -void sat_console_state::nvram_init(nvram_device &nvram, void *data, size_t size) -{ - static const UINT8 init[64] = { - 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', - 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', - 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', - 'B', 'a', 'c', 'k', 'U', 'p', 'R', 'a', 'm', ' ', 'F', 'o', 'r', 'm', 'a', 't', }; - - memset(data, 0x00, size); - memcpy(data, init, sizeof(init)); -} - - -MACHINE_START_MEMBER(sat_console_state, saturn) -{ - system_time systime; - machine().base_datetime(systime); - - machine().device("scsp")->set_ram_base(m_sound_ram); - - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x02400000, 0x027fffff, read32_delegate(FUNC(sat_console_state::saturn_null_ram_r),this), write32_delegate(FUNC(sat_console_state::saturn_null_ram_w),this)); - m_slave->space(AS_PROGRAM).install_readwrite_handler(0x02400000, 0x027fffff, read32_delegate(FUNC(sat_console_state::saturn_null_ram_r),this), write32_delegate(FUNC(sat_console_state::saturn_null_ram_w),this)); - - m_maincpu->space(AS_PROGRAM).nop_readwrite(0x04000000, 0x047fffff); - m_slave->space(AS_PROGRAM).nop_readwrite(0x04000000, 0x047fffff); - - m_nvram->set_base(m_backupram, 0x8000); - m_smpc_nv->set_base(&m_smpc.SMEM, 4); - - if (m_exp) - { - switch (m_exp->get_cart_type()) - { - case 0x21: // Battery RAM cart - case 0x22: - case 0x23: - case 0x24: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x04000000, 0x047fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_bram), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x04000000, 0x047fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_bram), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_read_handler(0x04000000, 0x047fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_bram), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_write_handler(0x04000000, 0x047fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_bram), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x24000000, 0x247fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_bram), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x24000000, 0x247fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_bram), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_read_handler(0x24000000, 0x247fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_bram), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_write_handler(0x24000000, 0x247fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_bram), (sat_cart_slot_device*)m_exp)); - break; - case 0x5a: // Data RAM cart - case 0x5c: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x02400000, 0x025fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram0), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x02400000, 0x025fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram0), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x02600000, 0x027fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram1), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x02600000, 0x027fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram1), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_read_handler(0x02400000, 0x025fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram0), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_write_handler(0x02400000, 0x025fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram0), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_read_handler(0x02600000, 0x027fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram1), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_write_handler(0x02600000, 0x027fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram1), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x22400000, 0x225fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram0), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x22400000, 0x225fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram0), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x22600000, 0x227fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram1), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x22600000, 0x227fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram1), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_read_handler(0x22400000, 0x225fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram0), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_write_handler(0x22400000, 0x225fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram0), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_read_handler(0x22600000, 0x227fffff, read32_delegate(FUNC(sat_cart_slot_device::read_ext_dram1), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_write_handler(0x22600000, 0x227fffff, write32_delegate(FUNC(sat_cart_slot_device::write_ext_dram1), (sat_cart_slot_device*)m_exp)); - break; - case 0xff: // ROM cart + mirror - m_maincpu->space(AS_PROGRAM).install_read_handler(0x02000000, 0x023fffff, read32_delegate(FUNC(sat_cart_slot_device::read_rom), (sat_cart_slot_device*)m_exp)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x22000000, 0x223fffff, read32_delegate(FUNC(sat_cart_slot_device::read_rom), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_read_handler(0x02000000, 0x023fffff, read32_delegate(FUNC(sat_cart_slot_device::read_rom), (sat_cart_slot_device*)m_exp)); - m_slave->space(AS_PROGRAM).install_read_handler(0x22000000, 0x223fffff, read32_delegate(FUNC(sat_cart_slot_device::read_rom), (sat_cart_slot_device*)m_exp)); - break; - } - } - - // save states - save_pointer(NAME(m_scu_regs), 0x100/4); - save_pointer(NAME(m_scsp_regs), 0x1000/2); - save_item(NAME(m_NMI_reset)); - save_item(NAME(m_en_68k)); - save_item(NAME(m_smpc.IOSEL1)); - save_item(NAME(m_smpc.IOSEL2)); - save_item(NAME(m_smpc.EXLE1)); - save_item(NAME(m_smpc.EXLE2)); - save_item(NAME(m_smpc.PDR1)); - save_item(NAME(m_smpc.PDR2)); -// save_item(NAME(m_port_sel)); -// save_item(NAME(mux_data)); - save_item(NAME(m_scsp_last_line)); - save_item(NAME(m_smpc.intback_stage)); - save_item(NAME(m_smpc.pmode)); - save_item(NAME(m_smpc.SR)); - save_item(NAME(m_smpc.SMEM)); - - machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sat_console_state::stvcd_exit), this)); - - m_smpc.rtc_data[0] = DectoBCD(systime.local_time.year /100); - m_smpc.rtc_data[1] = DectoBCD(systime.local_time.year %100); - m_smpc.rtc_data[2] = (systime.local_time.weekday << 4) | (systime.local_time.month+1); - m_smpc.rtc_data[3] = DectoBCD(systime.local_time.mday); - m_smpc.rtc_data[4] = DectoBCD(systime.local_time.hour); - m_smpc.rtc_data[5] = DectoBCD(systime.local_time.minute); - m_smpc.rtc_data[6] = DectoBCD(systime.local_time.second); - - m_stv_rtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sat_console_state::stv_rtc_increment),this)); - - m_audiocpu->set_reset_callback(write_line_delegate(FUNC(sat_console_state::m68k_reset_callback),this)); -} - -/* Die Hard Trilogy tests RAM address 0x25e7ffe bit 2 with Slave during FRT minit irq, in-development tool for breaking execution of it? */ -READ32_MEMBER(sat_console_state::saturn_null_ram_r) -{ - return 0xffffffff; -} - -WRITE32_MEMBER(sat_console_state::saturn_null_ram_w) -{ -} - -MACHINE_RESET_MEMBER(sat_console_state,saturn) -{ - m_scsp_last_line = 0; - - // don't let the slave cpu and the 68k go anywhere - m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_scudsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - - m_smpc.SR = 0x40; // this bit is always on according to docs - - scu_reset(); - - m_en_68k = 0; - m_NMI_reset = 0; - m_smpc.slave_on = 0; - - //memset(stv_m_workram_l, 0, 0x100000); - //memset(stv_m_workram_h, 0, 0x100000); - - m_maincpu->set_unscaled_clock(MASTER_CLOCK_320/2); - m_slave->set_unscaled_clock(MASTER_CLOCK_320/2); - - stvcd_reset(); - - m_vdp2.old_crmd = -1; - m_vdp2.old_tvmd = -1; - - m_stv_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1)); -} - - -static MACHINE_CONFIG_START( saturn, sat_console_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz - MCFG_CPU_PROGRAM_MAP(saturn_mem) - MCFG_SH2_IS_SLAVE(0) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sat_console_state, saturn_scanline, "screen", 0, 1) - - MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz - MCFG_CPU_PROGRAM_MAP(saturn_mem) - MCFG_SH2_IS_SLAVE(1) - MCFG_TIMER_DRIVER_ADD_SCANLINE("slave_scantimer", sat_console_state, saturn_slave_scanline, "screen", 0, 1) - - MCFG_CPU_ADD("audiocpu", M68000, 11289600) //256 x 44100 Hz = 11.2896 MHz - MCFG_CPU_PROGRAM_MAP(sound_mem) - - MCFG_CPU_ADD("scudsp", SCUDSP, MASTER_CLOCK_352/4) // 14 MHz - MCFG_CPU_PROGRAM_MAP(scudsp_mem) - MCFG_CPU_DATA_MAP(scudsp_data) - MCFG_SCUDSP_OUT_IRQ_CB(WRITELINE(saturn_state, scudsp_end_w)) - MCFG_SCUDSP_IN_DMA_CB(READ16(saturn_state, scudsp_dma_r)) - MCFG_SCUDSP_OUT_DMA_CB(WRITE16(saturn_state, scudsp_dma_w)) - -// SH-1 - -// SMPC MCU, running at 4 MHz (+ custom RTC device that runs at 32.768 KHz) - - MCFG_MACHINE_START_OVERRIDE(sat_console_state,saturn) - MCFG_MACHINE_RESET_OVERRIDE(sat_console_state,saturn) - - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", sat_console_state, nvram_init) - MCFG_NVRAM_ADD_0FILL("smpc_nv") // TODO: default for each region (+ move it inside SMPC when converted to device) - - MCFG_TIMER_DRIVER_ADD("sector_timer", sat_console_state, stv_sector_cb) - MCFG_TIMER_DRIVER_ADD("sh1_cmd", sat_console_state, stv_sh1_sim) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_320/8, 427, 0, 320, 263, 0, 224) - MCFG_SCREEN_UPDATE_DRIVER(sat_console_state, screen_update_stv_vdp2) - MCFG_PALETTE_ADD("palette", 2048+(2048*2))//standard palette + extra memory for rgb brightness. - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", stv) - - MCFG_VIDEO_START_OVERRIDE(sat_console_state,stv_vdp2) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_SOUND_ADD("scsp", SCSP, 0) - MCFG_SCSP_IRQ_CB(WRITE8(saturn_state, scsp_irq)) - MCFG_SCSP_MAIN_IRQ_CB(WRITELINE(saturn_state, scsp_to_main_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_SOUND_ADD("cdda", CDDA, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) -MACHINE_CONFIG_END - -static SLOT_INTERFACE_START(saturn_cart) - SLOT_INTERFACE_INTERNAL("rom", SATURN_ROM) - SLOT_INTERFACE_INTERNAL("ram8", SATURN_DRAM_8MB) - SLOT_INTERFACE_INTERNAL("ram32", SATURN_DRAM_32MB) - SLOT_INTERFACE_INTERNAL("bram4", SATURN_BRAM_4MB) - SLOT_INTERFACE_INTERNAL("bram8", SATURN_BRAM_8MB) - SLOT_INTERFACE_INTERNAL("bram16", SATURN_BRAM_16MB) - SLOT_INTERFACE_INTERNAL("bram32", SATURN_BRAM_32MB) -SLOT_INTERFACE_END - - -MACHINE_CONFIG_DERIVED( saturnus, saturn ) - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("sat_cdrom") - MCFG_SOFTWARE_LIST_ADD("cd_list","saturn") - MCFG_SOFTWARE_LIST_FILTER("cd_list","NTSC-U") - - MCFG_SATURN_CARTRIDGE_ADD("exp", saturn_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","sat_cart") - -MACHINE_CONFIG_END - -MACHINE_CONFIG_DERIVED( saturneu, saturn ) - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("sat_cdrom") - MCFG_SOFTWARE_LIST_ADD("cd_list","saturn") - MCFG_SOFTWARE_LIST_FILTER("cd_list","PAL") - - MCFG_SATURN_CARTRIDGE_ADD("exp", saturn_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","sat_cart") - -MACHINE_CONFIG_END - -MACHINE_CONFIG_DERIVED( saturnjp, saturn ) - MCFG_CDROM_ADD( "cdrom" ) - MCFG_CDROM_INTERFACE("sat_cdrom") - MCFG_SOFTWARE_LIST_ADD("cd_list","saturn") - MCFG_SOFTWARE_LIST_FILTER("cd_list","NTSC-J") - - MCFG_SATURN_CARTRIDGE_ADD("exp", saturn_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","sat_cart") - -MACHINE_CONFIG_END - - -void sat_console_state::saturn_init_driver(int rgn) -{ - m_saturn_region = rgn; - m_vdp2.pal = (rgn == 12) ? 1 : 0; - - // set compatible options - m_maincpu->sh2drc_set_options(SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); - m_slave->sh2drc_set_options(SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL); - - m_maincpu->sh2drc_add_fastram(0x00000000, 0x0007ffff, 1, &m_rom[0]); - m_maincpu->sh2drc_add_fastram(0x00200000, 0x002fffff, 0, &m_workram_l[0]); - m_maincpu->sh2drc_add_fastram(0x06000000, 0x060fffff, 0, &m_workram_h[0]); - m_slave->sh2drc_add_fastram(0x00000000, 0x0007ffff, 1, &m_rom[0]); - m_slave->sh2drc_add_fastram(0x00200000, 0x002fffff, 0, &m_workram_l[0]); - m_slave->sh2drc_add_fastram(0x06000000, 0x060fffff, 0, &m_workram_h[0]); - - /* amount of time to boost interleave for on MINIT / SINIT, needed for communication to work */ - m_minit_boost = 400; - m_sinit_boost = 400; - m_minit_boost_timeslice = attotime::zero; - m_sinit_boost_timeslice = attotime::zero; - - m_scu_regs = auto_alloc_array_clear(machine(), UINT32, 0x100/4); - m_scsp_regs = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); - m_backupram = auto_alloc_array_clear(machine(), UINT8, 0x8000); -} - -DRIVER_INIT_MEMBER(sat_console_state,saturnus) -{ - saturn_init_driver(4); -} - -DRIVER_INIT_MEMBER(sat_console_state,saturneu) -{ - saturn_init_driver(12); -} - -DRIVER_INIT_MEMBER(sat_console_state,saturnjp) -{ - saturn_init_driver(1); -} - - -/* Japanese Saturn */ -ROM_START(saturnjp) - ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ - ROM_SYSTEM_BIOS(0, "101", "Japan v1.01 (941228)") - ROMX_LOAD("sega_101.bin", 0x00000000, 0x00080000, CRC(224b752c) SHA1(df94c5b4d47eb3cc404d88b33a8fda237eaf4720), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "1003", "Japan v1.003 (941012)") - ROMX_LOAD("sega1003.bin", 0x00000000, 0x00080000, CRC(b3c63c25) SHA1(7b23b53d62de0f29a23e423d0fe751dfb469c2fa), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "100", "Japan v1.00 (940921)") - ROMX_LOAD("sega_100.bin", 0x00000000, 0x00080000, CRC(2aba43c2) SHA1(2b8cb4f87580683eb4d760e4ed210813d667f0a2), ROM_BIOS(3)) - ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ - ROM_COPY( "maincpu",0,0,0x080000) -ROM_END - -/* Overseas Saturn */ -ROM_START(saturn) - ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ - ROM_SYSTEM_BIOS(0, "101a", "Overseas v1.01a (941115)") - /* Confirmed by ElBarto */ - ROMX_LOAD("mpr-17933.bin", 0x00000000, 0x00080000, CRC(4afcf0fa) SHA1(faa8ea183a6d7bbe5d4e03bb1332519800d3fbc3), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "100a", "Overseas v1.00a (941115)") - ROMX_LOAD("sega_100a.bin", 0x00000000, 0x00080000, CRC(f90f0089) SHA1(3bb41feb82838ab9a35601ac666de5aacfd17a58), ROM_BIOS(2)) - ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ - ROM_COPY( "maincpu",0,0,0x080000) -ROM_END - -ROM_START(saturneu) - ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ - ROM_SYSTEM_BIOS(0, "101a", "Overseas v1.01a (941115)") - /* Confirmed by ElBarto */ - ROMX_LOAD("mpr-17933.bin", 0x00000000, 0x00080000, CRC(4afcf0fa) SHA1(faa8ea183a6d7bbe5d4e03bb1332519800d3fbc3), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "100a", "Overseas v1.00a (941115)") - ROMX_LOAD("sega_100a.bin", 0x00000000, 0x00080000, CRC(f90f0089) SHA1(3bb41feb82838ab9a35601ac666de5aacfd17a58), ROM_BIOS(2)) - ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ - ROM_COPY( "maincpu",0,0,0x080000) -ROM_END - -ROM_START(vsaturn) - ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ - ROM_LOAD("vsaturn.bin", 0x00000000, 0x00080000, CRC(e4d61811) SHA1(4154e11959f3d5639b11d7902b3a393a99fb5776)) - ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ - ROM_COPY( "maincpu",0,0,0x080000) -ROM_END - -ROM_START(hisaturn) - ROM_REGION( 0x480000, "maincpu", ROMREGION_ERASEFF ) /* SH2 code */ - ROM_SYSTEM_BIOS(0, "102", "v1.02 (950519)") - ROMX_LOAD( "mpr-18100.bin", 0x000000, 0x080000, CRC(3408dbf4) SHA1(8a22710e09ce75f39625894366cafe503ed1942d), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "101", "v1.01 (950130)") - ROMX_LOAD("hisaturn.bin", 0x00000000, 0x00080000, CRC(721e1b60) SHA1(49d8493008fa715ca0c94d99817a5439d6f2c796), ROM_BIOS(2)) - ROM_REGION( 0x080000, "slave", 0 ) /* SH2 code */ - ROM_COPY( "maincpu",0,0,0x080000) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1994, saturn, 0, 0, saturnus, saturn, sat_console_state, saturnus, "Sega", "Saturn (USA)", MACHINE_NOT_WORKING ) -CONS( 1994, saturnjp, saturn, 0, saturnjp, saturn, sat_console_state, saturnjp, "Sega", "Saturn (Japan)", MACHINE_NOT_WORKING ) -CONS( 1994, saturneu, saturn, 0, saturneu, saturn, sat_console_state, saturneu, "Sega", "Saturn (PAL)", MACHINE_NOT_WORKING ) -CONS( 1995, vsaturn, saturn, 0, saturnjp, saturn, sat_console_state, saturnjp, "JVC", "V-Saturn", MACHINE_NOT_WORKING ) -CONS( 1995, hisaturn, saturn, 0, saturnjp, saturn, sat_console_state, saturnjp, "Hitachi", "HiSaturn", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/savia84.c b/src/mess/drivers/savia84.c deleted file mode 100644 index 99949af89cd..00000000000 --- a/src/mess/drivers/savia84.c +++ /dev/null @@ -1,201 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Savia 84 - - More data at : - http://www.nostalcomp.cz/pdfka/savia84.pdf - http://www.nostalcomp.cz/savia.php - - 05/02/2011 Skeleton driver. - 11/10/2011 Found a new rom. Working [Robbbert] - - I assume all the LEDs are red ones. The LEDs down the - left side I assume to be bit 0 through 7 in that order. - - Pasting: - 0-F : as is - DA : ^ - AD : - - GO : X - - Here is a test program. Copy the text and Paste into the emulator. - -1800^3E^55^D3^F9^76^XX1800^ - - ToDo: - - Make better artwork - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "savia84.lh" - - -class savia84_state : public driver_device -{ -public: - savia84_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ppi8255(*this, "ppi8255") - { } - - required_device m_maincpu; - required_device m_ppi8255; - DECLARE_READ8_MEMBER(savia84_8255_portc_r); - DECLARE_WRITE8_MEMBER(savia84_8255_porta_w); - DECLARE_WRITE8_MEMBER(savia84_8255_portb_w); - DECLARE_WRITE8_MEMBER(savia84_8255_portc_w); - UINT8 m_kbd; - UINT8 m_segment; - UINT8 m_digit; - UINT8 m_digit_last; - virtual void machine_reset(); -}; - -static ADDRESS_MAP_START( savia84_mem, AS_PROGRAM, 8, savia84_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x7fff) // A15 not connected at the CPU - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x1800, 0x1fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( savia84_io, AS_IO, 8, savia84_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x07) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) // ports F8-FB -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( savia84 ) - PORT_START("X0") - PORT_BIT( 0x9F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_START("X1") - PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - - PORT_START("X2") - PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - - PORT_START("X3") - PORT_BIT( 0x9F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ex") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("X4") - PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BR") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("X5") - PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - - PORT_START("X6") - PORT_BIT( 0x9F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - - PORT_START("X7") - PORT_BIT( 0x9F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - - PORT_START("X8") - PORT_BIT( 0x8F, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') -INPUT_PORTS_END - - -void savia84_state::machine_reset() -{ - m_digit_last = 0; -} - -WRITE8_MEMBER( savia84_state::savia84_8255_porta_w ) // OUT F8 - output segments on the selected digit -{ - m_segment = ~data & 0x7f; - if (m_digit && (m_digit != m_digit_last)) output_set_digit_value(m_digit, m_segment); - m_digit_last = m_digit; -} - -WRITE8_MEMBER( savia84_state::savia84_8255_portb_w ) // OUT F9 - light the 8 leds down the left side -{ - char ledname[8]; - for (int i = 0; i < 8; i++) - { - sprintf(ledname,"led%d",i); - output_set_value(ledname, !BIT(data, i)); - } -} - -WRITE8_MEMBER( savia84_state::savia84_8255_portc_w ) // OUT FA - set keyboard scanning row; set digit to display -{ - m_digit = 0; - m_kbd = data & 15; - if (m_kbd == 0) - m_digit = 1; - else - if ((m_kbd > 1) && (m_kbd < 9)) - m_digit = m_kbd; -} - -READ8_MEMBER( savia84_state::savia84_8255_portc_r ) // IN FA - read keyboard -{ - if (m_kbd < 9) - { - char kbdrow[6]; - sprintf(kbdrow,"X%d",m_kbd); - return ioport(kbdrow)->read(); - } - else - return 0xff; -} - -static MACHINE_CONFIG_START( savia84, savia84_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz / 2) - MCFG_CPU_PROGRAM_MAP(savia84_mem) - MCFG_CPU_IO_MAP(savia84_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_savia84) - - /* Devices */ - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(savia84_state, savia84_8255_porta_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(savia84_state, savia84_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(savia84_state, savia84_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(savia84_state, savia84_8255_portc_w)) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( savia84 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("savia84.bin", 0x0000, 0x0800, CRC(fa8f1fcf) SHA1(b08404469ed988d96c0413416b6a66f3e5b997a3)) - - // Note - the below is a bad dump and does not work - //ROM_LOAD("savia84_1kb.bin", 0x0000, 0x0400, CRC(23a5c15e) SHA1(7e769ed8960d8c591a25cfe4effffcca3077c94b)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, savia84, 0, 0, savia84, savia84, driver_device, 0, "JT Hyan", "Savia 84", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/sbc6510.c b/src/mess/drivers/sbc6510.c deleted file mode 100644 index c345c2e9ede..00000000000 --- a/src/mess/drivers/sbc6510.c +++ /dev/null @@ -1,326 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - SBC6510 from Josip Perusanec - - 18/12/2009 Skeleton driver. - 2012-08-12 Working [Robbbert] - - CPU MOS 6510 (1MHz) - ROM 4KB - RAM 128KB - CIA 6526 - for interrupt gen and scan of keyboard - YM2149/AY-3-8910 - sound + HDD/CF IDE - GAL16V8 - address decoder - ATMEGA8 - gen. of PAL video signal (modified TellyMate) - keyboard of C64 computer used - -Commands: -A - (unknown) -C - (unknown) -E - (unknown) -F - (unknown) -G - (unknown) -L - (unknown) -R - (unknown) -S - (unknown) - -Some commands expect a filename enclosed in double quotes. If the quotes -are not there, it loops forever looking for them. Good example of bad -programming. There is no help and no error messages. - -ToDo: - -- The ATMEGA8 is a CPU with Timer, 4 IO ports, UART, ADC, Watchdog all - built in. This enormously complex device needs to be emulated. It also - contains some (4k?) RAM, of which certain addresses have special meaning. - For example bytes 0 and 1 control the serial video stream of bits. - -- When the system boots, there is a Y in the top corner. This is actually - Esc-Y, which our terminal does not understand. - -- IDE interface. - -- Find out the proper way to use the monitor, there are no instructions - and the slightest mistake can freeze the system. - -- No software to test with. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6510.h" -#include "cpu/avr8/avr8.h" -#include "machine/mos6526.h" -#include "sound/ay8910.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class sbc6510_state : public driver_device -{ -public: - sbc6510_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_videocpu(*this, "videocpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_READ8_MEMBER(a2_r); - DECLARE_WRITE8_MEMBER(a2_w); - DECLARE_READ8_MEMBER(psg_a_r); - DECLARE_READ8_MEMBER(psg_b_r); - DECLARE_WRITE8_MEMBER(key_w); - DECLARE_READ8_MEMBER(key_r); - UINT8 m_term_data; - UINT8 m_key_row; - UINT8 m_2; - virtual void machine_start(); - virtual void machine_reset(); - -protected: - ioport_port *m_io_port[8]; - required_device m_maincpu; - required_device m_videocpu; - required_device m_terminal; -}; - - -static ADDRESS_MAP_START( sbc6510_mem, AS_PROGRAM, 8, sbc6510_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0001) AM_RAM - AM_RANGE(0x0002, 0x0002) AM_READWRITE(a2_r,a2_w) - AM_RANGE(0x0003, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xe00f) AM_MIRROR(0x1f0) AM_DEVREADWRITE("cia6526", mos6526_device, read, write) - AM_RANGE(0xe800, 0xe800) AM_MIRROR(0x1ff) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0xea00, 0xea00) AM_MIRROR(0x1ff) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sbc6510_video_mem, AS_PROGRAM, 8, sbc6510_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sbc6510_video_data, AS_DATA, 8, sbc6510_state ) - AM_RANGE(0x0100, 0x04ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sbc6510_video_io, AS_IO, 8, sbc6510_state ) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sbc6510 ) // cbm keyboard - PORT_START( "X0" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START( "X1" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START( "X2" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START( "X3" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START( "X4" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START( "X5" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - - PORT_START( "X6" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home Clr") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') - - PORT_START( "X7" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START( "X8" ) /* unused */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("MAIN") - PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - - -READ8_MEMBER( sbc6510_state::a2_r ) -{ - return m_2; -} - -WRITE8_MEMBER( sbc6510_state::a2_w ) -{ - m_2 = data; - m_terminal->write(space, 0, data); -} - -void sbc6510_state::machine_start() -{ - char kbdrow[6]; - for ( int i = 0; i < 8; i++ ) - { - sprintf(kbdrow,"X%X",i); - m_io_port[i] = ioport(kbdrow); - } -} - - -void sbc6510_state::machine_reset() -{ -} - -READ8_MEMBER( sbc6510_state::psg_a_r ) -{ - return 0xff; -} - -READ8_MEMBER( sbc6510_state::psg_b_r ) -{ - return 0x7f; -} - -READ8_MEMBER( sbc6510_state::key_r ) -{ - UINT8 data=0; - - for (int i = 0; i < 8; i++) - { - if (!BIT(m_key_row, i)) - { - data |= m_io_port[i]->read(); - } - } - return ~data; -} - -WRITE8_MEMBER( sbc6510_state::key_w ) -{ - m_key_row = data; -} - -static const gfx_layout charset_8x16 = -{ - 8, 9, - 256, - 1, - { 0 }, - { STEP8(0,1) }, - { 0*1024*2, 1*1024*2, 2*1024*2, 3*1024*2, 4*1024*2, 5*1024*2, 6*1024*2, 7*1024*2, 8*1024*2 }, - 8 -}; - - -static GFXDECODE_START( sbc6510 ) - GFXDECODE_ENTRY( "videocpu", 0x1500, charset_8x16, 0, 128 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( sbc6510, sbc6510_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6510, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(sbc6510_mem) - - MCFG_CPU_ADD("videocpu",ATMEGA88, XTAL_16MHz) -// MCFG_DEVICE_DISABLE() // trips SLEEP opcode, needs to be emulated - MCFG_CPU_PROGRAM_MAP(sbc6510_video_mem) - MCFG_CPU_DATA_MAP(sbc6510_video_data) - MCFG_CPU_IO_MAP(sbc6510_video_io) - MCFG_CPU_AVR8_EEPROM("eeprom") - - MCFG_GFXDECODE_ADD("gfxdecode", TERMINAL_TAG":palette", sbc6510) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_1MHz) - // Ports A and B connect to the IDE socket - MCFG_AY8910_PORT_A_READ_CB(READ8(sbc6510_state, psg_a_r)) // port A read - MCFG_AY8910_PORT_B_READ_CB(READ8(sbc6510_state, psg_b_r)) // port B read - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_DEVICE_ADD("cia6526", MOS6526, XTAL_1MHz) - MCFG_MOS6526_TOD(50) - MCFG_MOS6526_IRQ_CALLBACK(INPUTLINE("maincpu", M6510_IRQ_LINE)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(sbc6510_state, key_w)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(sbc6510_state, key_r)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sbc6510 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "sbc6510.rom", 0xf000, 0x1000, CRC(e13a5e62) SHA1(1e7482e9b98b39d0cc456254fbe8fd0981e9377e)) - ROM_REGION( 0x10000, "videocpu", ROMREGION_ERASEFF ) // ATMEGA8 at 16MHz - ROM_LOAD( "video.bin", 0x0000, 0x2000, CRC(809f31ce) SHA1(4639de5f7b8f6c036d74f217ba85e7e897039094)) - ROM_REGION( 0x200, "gal", ROMREGION_ERASEFF ) - ROM_LOAD( "sbc6510.gal", 0x0000, 0x0117, CRC(f78f9927) SHA1(b951163958f5722032826d0d17a07c81dbd5f68e)) - ROM_REGION( 0x2000, "eeprom", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 2009, sbc6510, 0, 0, sbc6510, sbc6510, driver_device, 0, "Josip Perusanec", "SBC6510", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/sbrain.c b/src/mess/drivers/sbrain.c deleted file mode 100644 index 6c760eee0fe..00000000000 --- a/src/mess/drivers/sbrain.c +++ /dev/null @@ -1,376 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/************************************************************************************************************ - -Intertec SuperBrain - -2013-08-19 Skeleton - -Chips: 2x Z80; FD1791; 2x 8251; 8255; BR1941; CRT8002; KR3600; DP8350 -Xtals: 16.0, 10.92, 5.0688 -Disk parameters: 512 bytes x 10 sectors x 35 tracks. 1 and 2-sided disks supported. -Sound: Beeper - -The boot prom is shared between both cpus. This feat is accomplished by holding the sub cpu - in reset, until the main cpu has prepared a few memory locations. The first thing in the rom - is to check these locations, and then program flow splits into 2 sections, one for each cpu. -The main cpu does a busreq to gain access to the sub cpu's 1k static ram. When the sub cpu - responds with busack, then the main cpu switches bank2. In emulation, it isn't actually - necessary to stop the sub cpu because of other handshaking. Our Z80 emulation doesn't - support the busack signal anyway, so we just assume it is granted immediately. - -The schematic in parts is difficult to read. Some assumptions have been made. - -To Do: -- Without a disk in, it should display a message to insert a disk. Doesn't happen. - It thinks a disk is in and tries to execute garbage in the disk buffer instead. -- Port 08 is largely a guess. -- No work done on the keyboard. Should be able to hook up the generic ascii keyboard. -- No software available to try. -- Bug in floppy code means the motor will turn off after a few seconds. It should stay on. -- Video chips need to be emulated (CRT8002 and DP8350), attributes etc. -- After each line of characters, an interrupt should be generated. 25 IRQs per screen. -- Hook the outputs of the baud rate generator to the uarts. -- Probably lots of other stuff. - -*************************************************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/wd_fdc.h" -#include "machine/i8251.h" -#include "machine/i8255.h" -#include "machine/com8116.h" -#include "sound/beep.h" - -class sbrain_state : public driver_device -{ -public: - sbrain_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "subcpu"), - m_beep(*this, "beeper"), - m_brg(*this, "brg"), - m_u0(*this, "uart0"), - m_u1(*this, "uart1"), - m_ppi(*this, "ppi"), - m_fdc (*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_vs(*this, "VS"), - m_bankr0(*this, "bankr0"), - m_bankw0(*this, "bankw0"), - m_bank2(*this, "bank2") {} - -public: - const UINT8 *m_p_chargen; - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; - DECLARE_DRIVER_INIT(sbrain); - DECLARE_MACHINE_RESET(sbrain); - DECLARE_READ8_MEMBER(ppi_pa_r); - DECLARE_WRITE8_MEMBER(ppi_pa_w); - DECLARE_READ8_MEMBER(ppi_pb_r); - DECLARE_WRITE8_MEMBER(ppi_pb_w); - DECLARE_READ8_MEMBER(ppi_pc_r); - DECLARE_WRITE8_MEMBER(ppi_pc_w); - DECLARE_READ8_MEMBER(port08_r); - DECLARE_WRITE8_MEMBER(port08_w); - DECLARE_WRITE8_MEMBER(baud_w); - DECLARE_WRITE_LINE_MEMBER(fr_w); - DECLARE_WRITE_LINE_MEMBER(ft_w); -private: - UINT8 m_porta; - UINT8 m_portb; - UINT8 m_portc; - UINT8 m_port08; - required_device m_maincpu; - required_device m_subcpu; - required_device m_beep; - required_device m_brg; - required_device m_u0; - required_device m_u1; - required_device m_ppi; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_ioport m_vs; - required_memory_bank m_bankr0; - required_memory_bank m_bankw0; - required_memory_bank m_bank2; -}; - -static ADDRESS_MAP_START( sbrain_mem, AS_PROGRAM, 8, sbrain_state ) - AM_RANGE( 0x0000, 0x3fff ) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE( 0x4000, 0x7fff ) AM_RAM - AM_RANGE( 0x8000, 0xbfff ) AM_RAMBANK("bank2") - AM_RANGE( 0xc000, 0xf7ff ) AM_RAM - AM_RANGE( 0xf800, 0xffff ) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sbrain_io, AS_IO, 8, sbrain_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x40) AM_MIRROR(6) AM_DEVREADWRITE("uart0", i8251_device, data_r, data_w) - AM_RANGE(0x41, 0x41) AM_MIRROR(6) AM_DEVREADWRITE("uart0", i8251_device, status_r, control_w) - //AM_RANGE(0x48, 0x4f) chr_int_latch - //AM_RANGE(0x50, 0x57) key_in - AM_RANGE(0x58, 0x58) AM_MIRROR(6) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) - AM_RANGE(0x59, 0x59) AM_MIRROR(6) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) - AM_RANGE(0x60, 0x67) AM_WRITE(baud_w) - AM_RANGE(0x68, 0x6b) AM_MIRROR(4) AM_DEVREADWRITE("ppi", i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sbrain_submem, AS_PROGRAM, 8, sbrain_state ) - AM_RANGE( 0x0000, 0x07ff ) AM_ROM - AM_RANGE( 0x8800, 0x8bff ) AM_RAM AM_REGION("subcpu", 0x8800) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sbrain_subio, AS_IO, 8, sbrain_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r,port08_w) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", fd1791_t, read, write) -ADDRESS_MAP_END - -// bit 0 is wrong, maybe the whole byte is wrong -READ8_MEMBER( sbrain_state::port08_r ) -{ - return m_port08; -} - -/* Misc disk functions -d0 : disk busy? -d1 : SEL A (drive 0?) -d2 : SEL B (drive 1?) -d3 : SEL C -d4 : SEL D -d5 : side select -d6,7 : not used -*/ -WRITE8_MEMBER( sbrain_state::port08_w ) -{ - m_port08 = data | 0xc0; - - floppy_image_device *floppy = NULL; - if (BIT(m_port08, 1)) floppy = m_floppy0->get_device(); - if (BIT(m_port08, 2)) floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->ss_w(BIT(m_port08, 5)); // might need inverting - } - - // refresh motor on, hopefully this will keep them turning - m_floppy0->get_device()->mon_w(0); // motors run all the time - m_floppy1->get_device()->mon_w(0); -} - -WRITE_LINE_MEMBER( sbrain_state::fr_w ) -{ -} - -WRITE_LINE_MEMBER( sbrain_state::ft_w ) -{ -} - -WRITE8_MEMBER( sbrain_state::baud_w ) -{ - m_brg->str_w(data & 0x0f); - m_brg->stt_w(data >> 4); -} - -READ8_MEMBER( sbrain_state::ppi_pa_r ) -{ - return m_porta; -} - -/* Video functions: -d0,1 : 11 = alphanumeric; 10 = external ;other = graphics -d2 : Underline -d3,4 : not used -d5 : strike through -d6 : 1=60hz 0=50hz -d7 : reverse video -*/ -WRITE8_MEMBER( sbrain_state::ppi_pa_w ) -{ - m_porta = data; -} - -/* Inputs -d0 : data ready from keyboard -d1 : key held down -d2 : Vert Blank -d3 : not used -d4 : /capslock -d5 : disk is busy -d6 : Ring Indicator line from main rs232 port, 1=normal, 0=set -d7 : cpu2 /busak line -*/ -READ8_MEMBER( sbrain_state::ppi_pb_r ) -{ - return m_portb | 0x50 | m_vs->read() | (BIT(m_port08, 0) << 5) | ((UINT8)BIT(m_portc, 5) << 7); -} - -WRITE8_MEMBER( sbrain_state::ppi_pb_w ) -{ - m_portb = data & 8; -} - -READ8_MEMBER( sbrain_state::ppi_pc_r ) -{ - return m_portc; -} - -/* System -d0 : 1 = bank 0 disabled -d1 : character blanking -d2 : 1=enable rom, 0=enable ram bank 0 -d3 : cpu2 reset line -d4 : 1=enable ram bank 2, 0=bank 2 uses disk buffer -d5 : cpu2 /busreq line -d6 : beeper -d7 : keyboard, 1=enable comms, 0=reset -*/ -WRITE8_MEMBER( sbrain_state::ppi_pc_w ) -{ - m_portc = data; - m_beep->set_state(BIT(data, 6)); - m_bankr0->set_entry(BIT(data, 2)); - m_bank2->set_entry(BIT(data, 4)); - - m_subcpu->set_input_line(INPUT_LINE_RESET, BIT(data, 3) ? ASSERT_LINE : CLEAR_LINE); -} - -static INPUT_PORTS_START( sbrain ) - /* vblank */ - PORT_START("VS") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") -INPUT_PORTS_END - -DRIVER_INIT_MEMBER( sbrain_state, sbrain ) -{ - UINT8 *main = memregion("maincpu")->base(); - UINT8 *sub = memregion("subcpu")->base(); - - m_bankr0->configure_entry(0, &main[0x0000]); - m_bankr0->configure_entry(1, &sub[0x0000]); - m_bankw0->configure_entry(0, &main[0x0000]); - m_bank2->configure_entry(0, &sub[0x8000]); - m_bank2->configure_entry(1, &main[0x8000]); -} - -static SLOT_INTERFACE_START( sbrain_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -MACHINE_RESET_MEMBER( sbrain_state, sbrain ) -{ - m_beep->set_frequency(800); - m_p_chargen = memregion("chargen")->base(); - m_bankr0->set_entry(1); // point at rom - m_bankw0->set_entry(0); // always write to ram - m_bank2->set_entry(1); // point at maincpu bank - m_subcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // hold subcpu in reset -} - -UINT32 sbrain_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 24; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 80; x++) - { - gfx = 0; - if (ra < 9) - { - chr = m_p_videoram[x+ma]; - - if (chr) gfx = m_p_chargen[(chr<<4) | ra ]; - } - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=80; - } - return 0; -} - -static MACHINE_CONFIG_START( sbrain, sbrain_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(sbrain_mem) - MCFG_CPU_IO_MAP(sbrain_io) - MCFG_MACHINE_RESET_OVERRIDE(sbrain_state, sbrain) - MCFG_CPU_ADD("subcpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(sbrain_submem) - MCFG_CPU_IO_MAP(sbrain_subio) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(sbrain_state, screen_update) - MCFG_SCREEN_SIZE(640, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* Devices */ - MCFG_DEVICE_ADD("ppi", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(sbrain_state, ppi_pa_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(sbrain_state, ppi_pa_w)) - MCFG_I8255_IN_PORTB_CB(READ8(sbrain_state, ppi_pb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(sbrain_state, ppi_pb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(sbrain_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(sbrain_state, ppi_pc_w)) - - MCFG_DEVICE_ADD("uart0", I8251, 0) - - MCFG_DEVICE_ADD("uart1", I8251, 0) - - MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(sbrain_state, fr_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE(sbrain_state, ft_w)) - - MCFG_FD1791_ADD("fdc", XTAL_16MHz / 16) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", sbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", sbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - -ROM_START( sbrain ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x10000, "subcpu", ROMREGION_ERASEFF ) - ROM_LOAD( "superbrain.bin", 0x0000, 0x0800, CRC(b6a2e6a5) SHA1(a646faaecb9ac45ee1a42764628e8971524d5c13) ) - - // Using the chargen from 'c10' for now. - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - -COMP( 1981, sbrain, 0, 0, sbrain, sbrain, sbrain_state, sbrain, "Intertec", "Superbrain", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/sc1.c b/src/mess/drivers/sc1.c deleted file mode 100644 index 18a8d05dda4..00000000000 --- a/src/mess/drivers/sc1.c +++ /dev/null @@ -1,200 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Schachcomputer SC1 - - 12/05/2009 Skeleton driver. - -ToDo: -- speaker -- LEDs -- 7seg sometimes flashes - -Port 80-83 could be a device - -This happens at the start: -'maincpu' (04EF): unmapped i/o memory write to 0081 = 0F & FF -'maincpu' (04F3): unmapped i/o memory write to 0083 = CF & FF -'maincpu' (04F7): unmapped i/o memory write to 0083 = BB & FF -'maincpu' (04FB): unmapped i/o memory write to 0082 = 01 & FF -'maincpu' (0523): unmapped i/o memory write to 00FC = 02 & FF ** -'maincpu' (0523): unmapped i/o memory write to 00FC = 04 & FF ** - -** These two happen for a while (making a tone from a speaker?) - -Then: -'maincpu' (0523): unmapped i/o memory write to 00FC = 00 & FF -'maincpu' (0075): unmapped i/o memory write to 0080 = 02 & FF -'maincpu' (0523): unmapped i/o memory write to 00FC = 20 & FF - -Then this happens continuously: -Port 80 out - 00, 02, FF -Port FC out - 00, 01, 02, 04, 08, 10, 20, 40, 80 (selecting rows?) -Port 80 in - upper byte = 20 thru 26 -Port 82 in - upper byte = 0 thru 7 - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "machine/z80pio.h" -#include "sc1.lh" - - -class sc1_state : public driver_device -{ -public: - sc1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker") - { } - - required_device m_maincpu; - required_device m_speaker; - - DECLARE_WRITE8_MEMBER( matrix_w ); - DECLARE_WRITE8_MEMBER( pio_port_a_w ); - DECLARE_READ8_MEMBER( pio_port_b_r ); - - UINT8 m_matrix; -}; - -/*************************************************************************** - - Display - -***************************************************************************/ - -WRITE8_MEMBER( sc1_state::pio_port_a_w ) -{ - UINT8 digit = BITSWAP8( data,3,4,6,0,1,2,7,5 ); - - if (m_matrix & 0x04) - output_set_digit_value(3, digit & 0x7f); - if (m_matrix & 0x08) - output_set_digit_value(2, digit & 0x7f); - if (m_matrix & 0x10) - output_set_digit_value(1, digit & 0x7f); - if (m_matrix & 0x20) - output_set_digit_value(0, digit & 0x7f); -} - - -/*************************************************************************** - - Keyboard - -***************************************************************************/ - -WRITE8_MEMBER( sc1_state::matrix_w ) -{ - m_matrix = data; -} - -READ8_MEMBER( sc1_state::pio_port_b_r ) -{ - UINT8 data = 0; - - if (m_matrix & 0x01) - data |= ioport("LINE1")->read(); - if (m_matrix & 0x02) - data |= ioport("LINE2")->read(); - if (m_matrix & 0x04) - data |= ioport("LINE3")->read(); - if (m_matrix & 0x08) - data |= ioport("LINE4")->read(); - if (m_matrix & 0x10) - data |= ioport("LINE5")->read(); - if (m_matrix & 0x20) - data |= ioport("LINE6")->read(); - if (m_matrix & 0x40) - data |= ioport("LINE7")->read(); - if (m_matrix & 0x80) - data |= ioport("LINE8")->read(); - - return data; -} - - -static ADDRESS_MAP_START(sc1_mem, AS_PROGRAM, 8, sc1_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_ROM - AM_RANGE( 0x4000, 0x43ff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sc1_io, AS_IO, 8, sc1_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE(0xfc, 0xfc) AM_WRITE(matrix_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sc1 ) - PORT_START("LINE1") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) - - PORT_START("LINE2") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) - - PORT_START("LINE3") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) - - PORT_START("LINE4") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) - - PORT_START("LINE5") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE") PORT_CODE(KEYCODE_DEL) - - PORT_START("LINE6") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) - - PORT_START("LINE7") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_O) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("W/S") PORT_CODE(KEYCODE_W) - - PORT_START("LINE8") - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_M) -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( sc1, sc1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(sc1_mem) - MCFG_CPU_IO_MAP(sc1_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_sc1) - - /* devices */ - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(sc1_state, pio_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(sc1_state, pio_port_b_r)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sc1 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "sc1.rom", 0x0000, 0x1000, CRC(26965b23) SHA1(01568911446eda9f05ec136df53da147b7c6f2bf)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, sc1, 0, 0, sc1, sc1, driver_device, 0, "VEB Mikroelektronik Erfurt", "Schachcomputer SC1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/sc2.c b/src/mess/drivers/sc2.c deleted file mode 100644 index 2eb3455c1f7..00000000000 --- a/src/mess/drivers/sc2.c +++ /dev/null @@ -1,238 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Schachcomputer SC2 - - Note: - The HW is very similar to Fidelity Chess Challenger series (see fidelz80.c) - - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80pio.h" -#include "sound/beep.h" -#include "sc2.lh" - -class sc2_state : public driver_device -{ -public: - sc2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_beep(*this, "beeper") - , - m_maincpu(*this, "maincpu") { } - - required_device m_beep; - DECLARE_READ8_MEMBER(pio_port_a_r); - DECLARE_READ8_MEMBER(pio_port_b_r); - DECLARE_WRITE8_MEMBER(pio_port_a_w); - DECLARE_WRITE8_MEMBER(pio_port_b_w); - DECLARE_READ8_MEMBER(sc2_beep); - UINT8 m_kp_matrix; - UINT8 m_led_7seg_data[4]; - UINT8 m_led_selected; - UINT8 m_digit_data; - UINT8 m_beep_state; - void sc2_update_display(); - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; -}; - -READ8_MEMBER( sc2_state::sc2_beep ) -{ - //if (!space.debugger_access()) - { - m_beep_state = ~m_beep_state; - - m_beep->set_state(m_beep_state); - } - - return 0xff; -} - -static ADDRESS_MAP_START(sc2_mem, AS_PROGRAM, 8, sc2_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_ROM - AM_RANGE( 0x1000, 0x13ff ) AM_RAM - AM_RANGE( 0x2000, 0x33ff ) AM_ROM - AM_RANGE( 0x3c00, 0x3c00 ) AM_READ(sc2_beep) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sc2_io, AS_IO, 8, sc2_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_MIRROR(0xfc) AM_DEVREADWRITE("z80pio", z80pio_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sc2 ) - PORT_START("LINE1") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_UNUSED - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - - PORT_START("LINE2") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) - - PORT_START("LINE3") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) - - PORT_START("LINE4") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_O) -INPUT_PORTS_END - -void sc2_state::machine_start() -{ - save_item(NAME(m_led_7seg_data)); - save_item(NAME(m_kp_matrix)); - save_item(NAME(m_led_selected)); - save_item(NAME(m_digit_data)); - save_item(NAME(m_beep_state)); -} - -void sc2_state::machine_reset() -{ - m_kp_matrix = 0; - m_led_selected = 0; - m_digit_data = 0; - m_beep_state = 0; - memset(m_led_7seg_data, 0, ARRAY_LENGTH(m_led_7seg_data)); -} - -void sc2_state::sc2_update_display() -{ - UINT8 digit_data = BITSWAP8( m_digit_data,7,0,1,2,3,4,5,6 ) & 0x7f; - - if (!BIT(m_led_selected, 0)) - { - output_set_digit_value(0, digit_data); - m_led_7seg_data[0] = digit_data; - - output_set_led_value(0, BIT(m_digit_data, 7)); - } - - if (!BIT(m_led_selected, 1)) - { - output_set_digit_value(1, digit_data); - m_led_7seg_data[1] = digit_data; - - output_set_led_value(1, BIT(m_digit_data, 7)); - } - - if (!BIT(m_led_selected, 2)) - { - output_set_digit_value(2, digit_data); - m_led_7seg_data[2] = digit_data; - } - - if (!BIT(m_led_selected, 3)) - { - output_set_digit_value(3, digit_data); - m_led_7seg_data[3] = digit_data; - } -} - -READ8_MEMBER( sc2_state::pio_port_a_r ) -{ - return m_digit_data; -} - -READ8_MEMBER( sc2_state::pio_port_b_r ) -{ - UINT8 data = m_led_selected & 0x0f; - - if (BIT(m_kp_matrix, 0)) - { - data |= ioport("LINE1")->read(); - } - - if (BIT(m_kp_matrix, 1)) - { - data |= ioport("LINE2")->read(); - } - - if (BIT(m_kp_matrix, 2)) - { - data |= ioport("LINE3")->read(); - } - - if (BIT(m_kp_matrix, 3)) - { - data |= ioport("LINE4")->read(); - } - - return data; -} - -WRITE8_MEMBER( sc2_state::pio_port_a_w ) -{ - m_digit_data = data; -} - -WRITE8_MEMBER( sc2_state::pio_port_b_w ) -{ - if (data != 0xf1 && data != 0xf2 && data != 0xf4 && data != 0xf8) - { - m_led_selected = data; - sc2_update_display(); - } - else - m_kp_matrix = data; -} - -static MACHINE_CONFIG_START( sc2, sc2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(sc2_mem) - MCFG_CPU_IO_MAP(sc2_io) - - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_sc2) - - /* devices */ - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_IN_PA_CB(READ8(sc2_state, pio_port_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(sc2_state, pio_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(sc2_state, pio_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(sc2_state, pio_port_b_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 0.50 ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sc2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bm008.bin", 0x0000, 0x0400, CRC(3023ea82) SHA1(07020d153d802c672c39e1af3c716dbe35e23f08)) - ROM_LOAD( "bm009.bin", 0x0400, 0x0400, CRC(6a34814e) SHA1(e58ae6615297b028db135a48a8f9e186a4220f4f)) - ROM_LOAD( "bm010.bin", 0x0800, 0x0400, CRC(deab0373) SHA1(81c9a7197eef8d9131e47ecd2ec35b943caee54e)) - ROM_LOAD( "bm011.bin", 0x0c00, 0x0400, CRC(c8282339) SHA1(8d6b8861281e967a77609b6d77e80afd47d28ed2)) - ROM_LOAD( "bm012.bin", 0x2000, 0x0400, CRC(2e6a4294) SHA1(7b9bd191c9ec73139a65c3a339ab88e1f3eb5ed2)) - ROM_LOAD( "bm013.bin", 0x2400, 0x0400, CRC(3e02eb42) SHA1(2e4a9a8fd04c202c9518550d7e8cf9bfea394153)) - ROM_LOAD( "bm014.bin", 0x2800, 0x0400, CRC(538d449e) SHA1(c4186995b69e97740e01eaff84a20d49d03d180f)) - ROM_LOAD( "bm015.bin", 0x2c00, 0x0400, CRC(b4991dca) SHA1(6a6cdddf5c4afa24773acf693f58c34b99c8d328)) - ROM_LOAD( "bm016.bin", 0x3000, 0x0400, CRC(4fe0853a) SHA1(c2253e320778b0ea468fb54f26ae83d07f9700e6)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, sc2, 0, 0, sc2, sc2, driver_device, 0, "VEB Mikroelektronik Erfurt", "Schachcomputer SC2", MACHINE_SUPPORTS_SAVE) diff --git a/src/mess/drivers/scorpion.c b/src/mess/drivers/scorpion.c deleted file mode 100644 index 897cd6ff054..00000000000 --- a/src/mess/drivers/scorpion.c +++ /dev/null @@ -1,377 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic - -#include "emu.h" -#include "includes/spectrum.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/ay8910.h" -#include "sound/speaker.h" -#include "formats/tzx_cas.h" -#include "machine/beta.h" -#include "machine/ram.h" - -class scorpion_state : public spectrum_state -{ -public: - scorpion_state(const machine_config &mconfig, device_type type, const char *tag) - : spectrum_state(mconfig, type, tag) - , m_bank1(*this, "bank1") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - , m_bank4(*this, "bank4") - , m_beta(*this, BETA_DISK_TAG) - { } - - DECLARE_DIRECT_UPDATE_MEMBER(scorpion_direct); - DECLARE_WRITE8_MEMBER(scorpion_0000_w); - DECLARE_WRITE8_MEMBER(scorpion_port_7ffd_w); - DECLARE_WRITE8_MEMBER(scorpion_port_1ffd_w); - DECLARE_MACHINE_START(scorpion); - DECLARE_MACHINE_RESET(scorpion); - TIMER_DEVICE_CALLBACK_MEMBER(nmi_check_callback); -protected: - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_device m_beta; -private: - UINT8 *m_p_ram; - void scorpion_update_memory(); - -}; - -/****************************************************************************************************/ -/* Zs Scorpion 256 */ - -/* -port 7ffd. full compatibility with Zx spectrum 128. digits are: - -D0-D2 - number of RAM page to put in C000-FFFF -D3 - switch of address for RAM of screen. 0 - 4000, 1 - c000 -D4 - switch of ROM : 0-zx128, 1-zx48 -D5 - 1 in this bit will block further output in port 7FFD, until reset. -*/ - -/* -port 1ffd - additional port for resources of computer. - -D0 - block of ROM in 0-3fff. when set to 1 - allows read/write page 0 of RAM -D1 - selects ROM expansion. this rom contains main part of service monitor. -D2 - not used -D3 - used for output in RS-232C -D4 - extended RAM. set to 1 - connects RAM page with number 8-15 in - C000-FFFF. number of page is given in gidits D0-D2 of port 7FFD -D5 - signal of strobe for interface centronics. to form the strobe has to be - set to 1. -D6-D7 - not used. ( yet ? ) -*/ - -/* rom 0=zx128, 1=zx48, 2 = service monitor, 3=tr-dos */ - -void scorpion_state::scorpion_update_memory() -{ - UINT8 *messram = m_ram->pointer(); - - m_screen_location = messram + ((m_port_7ffd_data & 8) ? (7<<14) : (5<<14)); - - m_bank4->set_base(messram + (((m_port_7ffd_data & 0x07) | ((m_port_1ffd_data & 0x10)>>1)) * 0x4000)); - - if ((m_port_1ffd_data & 0x01)==0x01) - { - m_ram_0000 = messram+(8<<14); - m_bank1->set_base(messram+(8<<14)); - logerror("RAM\n"); - } - else - { - if ((m_port_1ffd_data & 0x02)==0x02) - m_ROMSelection = 2; - else - m_ROMSelection = BIT(m_port_7ffd_data, 4); - - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); - } -} - -WRITE8_MEMBER(scorpion_state::scorpion_0000_w) -{ - if ( ! m_ram_0000 ) - return; - - if ((m_port_1ffd_data & 0x01)==0x01) - { - if ( ! m_ram_disabled_by_beta ) - m_ram_0000[offset] = data; - } -} - - -DIRECT_UPDATE_MEMBER(scorpion_state::scorpion_direct) -{ - UINT16 pc = m_maincpu->device_t::safe_pcbase(); // works, but... - - m_ram_disabled_by_beta = 0; - if (m_beta->is_active() && (pc >= 0x4000)) - { - m_ROMSelection = BIT(m_port_7ffd_data, 4); - m_beta->disable(); - m_ram_disabled_by_beta = 1; - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); - } - else - if (((pc & 0xff00) == 0x3d00) && (m_ROMSelection==1)) - { - m_ROMSelection = 3; - m_beta->enable(); - } - - if(address<=0x3fff) - { - m_ram_disabled_by_beta = 1; - direct.explicit_configure(0x0000, 0x3fff, 0x3fff, &m_p_ram[0x10000 + (m_ROMSelection<<14)]); - m_bank1->set_base(&m_p_ram[0x10000 + (m_ROMSelection<<14)]); - return ~0; - } - - return address; -} - -TIMER_DEVICE_CALLBACK_MEMBER(scorpion_state::nmi_check_callback) -{ - if ((m_io_nmi->read() & 1)==1) - { - m_port_1ffd_data |= 0x02; - scorpion_update_memory(); - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } -} - -WRITE8_MEMBER(scorpion_state::scorpion_port_7ffd_w) -{ - /* disable paging */ - if (m_port_7ffd_data & 0x20) - return; - - /* store new state */ - m_port_7ffd_data = data; - - /* update memory */ - scorpion_update_memory(); -} - -WRITE8_MEMBER(scorpion_state::scorpion_port_1ffd_w) -{ - m_port_1ffd_data = data; - scorpion_update_memory(); -} - -static ADDRESS_MAP_START (scorpion_io, AS_IO, 8, scorpion_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, status_r, command_w) AM_MIRROR(0xff00) - AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, track_r, track_w) AM_MIRROR(0xff00) - AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, sector_r, sector_w) AM_MIRROR(0xff00) - AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, data_r, data_w) AM_MIRROR(0xff00) - AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) - AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, beta_disk_device, state_r, param_w) AM_MIRROR(0xff00) - AM_RANGE(0x4021, 0x4021) AM_WRITE(scorpion_port_7ffd_w) AM_MIRROR(0x3fdc) - AM_RANGE(0x8021, 0x8021) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3fdc) - AM_RANGE(0xc021, 0xc021) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3fdc) - AM_RANGE(0x0021, 0x0021) AM_WRITE(scorpion_port_1ffd_w) AM_MIRROR(0x3fdc) -ADDRESS_MAP_END - - -MACHINE_RESET_MEMBER(scorpion_state,scorpion) -{ - UINT8 *messram = m_ram->pointer(); - address_space &space = m_maincpu->space(AS_PROGRAM); - m_p_ram = memregion("maincpu")->base(); - - m_ram_0000 = NULL; - space.install_read_bank(0x0000, 0x3fff, "bank1"); - space.install_write_handler(0x0000, 0x3fff, write8_delegate(FUNC(scorpion_state::scorpion_0000_w),this)); - - m_beta->disable(); - space.set_direct_update_handler(direct_update_delegate(FUNC(scorpion_state::scorpion_direct), this)); - - memset(messram,0,256*1024); - - /* Bank 5 is always in 0x4000 - 0x7fff */ - m_bank2->set_base(messram + (5<<14)); - - /* Bank 2 is always in 0x8000 - 0xbfff */ - m_bank3->set_base(messram + (2<<14)); - - m_port_7ffd_data = 0; - m_port_1ffd_data = 0; - scorpion_update_memory(); -} -MACHINE_START_MEMBER(scorpion_state,scorpion) -{ -} - - -/* F4 Character Displayer */ -static const gfx_layout spectrum_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 96, /* 96 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout quorum_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 160, /* 160 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout profi_8_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 224, /* 224 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( scorpion ) - GFXDECODE_ENTRY( "maincpu", 0x17d00, spectrum_charlayout, 0, 8 ) -GFXDECODE_END - -static GFXDECODE_START( profi ) - GFXDECODE_ENTRY( "maincpu", 0x17d00, spectrum_charlayout, 0, 8 ) - GFXDECODE_ENTRY( "maincpu", 0x1abfc, profi_8_charlayout, 0, 8 ) - /* There are more characters after this, that haven't been decoded */ -GFXDECODE_END - -static GFXDECODE_START( quorum ) - GFXDECODE_ENTRY( "maincpu", 0x1fb00, quorum_charlayout, 0, 8 ) -GFXDECODE_END - -static MACHINE_CONFIG_DERIVED_CLASS( scorpion, spectrum_128, scorpion_state ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(scorpion_io) - - MCFG_MACHINE_START_OVERRIDE(scorpion_state, scorpion ) - MCFG_MACHINE_RESET_OVERRIDE(scorpion_state, scorpion ) - MCFG_GFXDECODE_MODIFY("gfxdecode", scorpion) - - MCFG_BETA_DISK_ADD(BETA_DISK_TAG) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", scorpion_state, nmi_check_callback, attotime::from_hz(50)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( profi, scorpion ) - MCFG_GFXDECODE_MODIFY("gfxdecode", profi) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( quorum, scorpion ) - MCFG_GFXDECODE_MODIFY("gfxdecode", quorum) -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(scorpio) - ROM_REGION(0x90000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "v1", "V.2.92") - ROMX_LOAD("scorp0.rom", 0x010000, 0x4000, CRC(0eb40a09) SHA1(477114ff0fe1388e0979df1423602b21248164e5), ROM_BIOS(1)) - ROMX_LOAD("scorp1.rom", 0x014000, 0x4000, CRC(9d513013) SHA1(367b5a102fb663beee8e7930b8c4acc219c1f7b3), ROM_BIOS(1)) - ROMX_LOAD("scorp2.rom", 0x018000, 0x4000, CRC(fd0d3ce1) SHA1(07783ee295274d8ff15d935bfd787c8ac1d54900), ROM_BIOS(1)) - ROMX_LOAD("scorp3.rom", 0x01c000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "V.2.92 joined") - ROMX_LOAD( "scorpion.rom", 0x010000, 0x10000, CRC(fef73c28) SHA1(66cecdadf992d8adb9c66deee929eb56600dc9bc), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v3", "V.2.94") - ROMX_LOAD( "scorp294.rom", 0x010000, 0x10000, CRC(99f57ce1) SHA1(083bb57ad52cc871b92d3e1794fd9790872c3584), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v4", "SMUC V.4.02") - ROMX_LOAD( "scorp402.rom", 0x010000, 0x20000, CRC(9fcf893d) SHA1(0cc7ba60f5cfc36e75bd3a5c90e26b2a1905a970), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v5", "ProfROM V.3.9f") - ROMX_LOAD( "prof_39f.rom", 0x010000, 0x20000, CRC(c55e64da) SHA1(cec7770fe26350f57f6c325a29db78787dc4521e), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "v6", "ProfROM V.4.01") - ROMX_LOAD( "profrom.rom", 0x010000, 0x80000, CRC(b02d89de) SHA1(4cb85341e2a400e0e88869304d80af430266cdd1), ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "v7", "NeOS 256") - ROMX_LOAD("neos_256.rom", 0x010000, 0x4000, CRC(364ae09a) SHA1(bb6db1947415503a6bc48f33c603fb3a0dbb3690), ROM_BIOS(7)) - ROMX_LOAD("scorp1.rom", 0x014000, 0x4000, CRC(9d513013) SHA1(367b5a102fb663beee8e7930b8c4acc219c1f7b3), ROM_BIOS(7)) - ROMX_LOAD("scorp2.rom", 0x018000, 0x4000, CRC(fd0d3ce1) SHA1(07783ee295274d8ff15d935bfd787c8ac1d54900), ROM_BIOS(7)) - ROMX_LOAD("scorp3.rom", 0x01c000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db), ROM_BIOS(7)) - - ROM_REGION(0x01000, "keyboard", 0) - ROM_LOAD( "scrpkey.rom", 0x0000, 0x1000, CRC(e938a510) SHA1(2753993c97ff0fc6cff26ed792929abc1288dc6f)) - - ROM_REGION(0x010000, "gsound", 0) - ROM_LOAD( "gs104.rom", 0x0000, 0x8000, CRC(7a365ba6) SHA1(c865121306eb3a7d811d82fbcc653b4dc1d6fa3d)) - ROM_LOAD( "gs105a.rom", 0x8000, 0x8000, CRC(1cd490c6) SHA1(1ba78923dc7d803e7995c165992e14e4608c2153)) -ROM_END - -ROM_START(profi) - ROM_REGION(0x020000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "v1", "ver 1") - ROMX_LOAD( "profi.rom", 0x010000, 0x10000, CRC(285a0985) SHA1(2b33ab3561e7bc5997da7f0d3a2a906fe7ea960f), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "ver 2") - ROMX_LOAD( "profi_my.rom", 0x010000, 0x10000, CRC(2ffd6cd9) SHA1(1b74a3251358c5f102bb87654f47b02281e15e9c), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v3", "ver 3") - ROMX_LOAD( "profi-p1.rom", 0x010000, 0x10000, CRC(537ddb81) SHA1(00a23e8dc722b248d4f98cb14a600ce7487f2b9c), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "v4", "ver 4") - ROMX_LOAD( "profi_1.rom", 0x010000, 0x10000, CRC(f07fbee8) SHA1(b29c81a94658a4d50274ba953775a49e855534de), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "v5", "T-Rex") - ROMX_LOAD( "profi-p.rom", 0x010000, 0x10000, CRC(314f6b57) SHA1(1507f53ec64dcf5154b5cfce6922f69f70296a53), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "v6", "JV Kramis V0.2") - ROMX_LOAD( "profi32.rom", 0x010000, 0x10000, CRC(77327f52) SHA1(019bd00cc7939741d99b99beac6ae1298652e652), ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "v7", "Power Of Sound Group") - ROMX_LOAD( "profi1k.rom", 0x010000, 0x10000, CRC(a932676f) SHA1(907ac56219f325949a7c2fe8168799d9cdd5ba6c), ROM_BIOS(7)) -ROM_END - -ROM_START(quorum) - ROM_REGION(0x020000, "maincpu", 0) - ROM_LOAD("qu7v42.rom", 0x010000, 0x10000, CRC(e950eee5) SHA1(f8e22672722b0038689c6c8bc4acf5392acc9d8c)) -ROM_END - -ROM_START(bestzx) - ROM_REGION(0x020000, "maincpu", 0) - ROM_LOAD( "bestzx.rom", 0x010000, 0x10000, CRC(fc7936e8) SHA1(0d6378c51b2f08a3e2b4c75e64c76c15ae5dc76d)) -ROM_END - -ROM_START( kay1024 ) - ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "v1", "ver 1") - ROMX_LOAD( "kay98.rom", 0x010000, 0x08000, CRC(7fbf2d43) SHA1(e555f2ed01ecf2231d493bd70a4d79b436e9f10e), ROM_BIOS(1)) - ROMX_LOAD( "trd503.rom", 0x01c000, 0x04000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "Kramis V0.2") - ROMX_LOAD( "kay1024b.rom", 0x010000, 0x10000, CRC(ab99c31e) SHA1(cfa9e6553aea72956fce4f0130c007981d684734), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v3", "Kramis V0.3") - ROMX_LOAD( "kay1024s.rom", 0x010000, 0x10000, CRC(67351caa) SHA1(1d9c0606b380c000ca1dfa33f90a122ecf9df1f1), ROM_BIOS(3)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1994, scorpio, spec128, 0, scorpion, spec_plus, driver_device, 0, "Zonov and Co.", "Scorpion ZS-256", 0 ) -COMP( 1991, profi, spec128, 0, profi, spec_plus, driver_device, 0, "Kondor and Kramis", "Profi", MACHINE_NOT_WORKING ) -COMP( 1998, kay1024, spec128, 0, scorpion, spec_plus, driver_device, 0, "NEMO", "Kay 1024", MACHINE_NOT_WORKING ) -COMP( 19??, quorum, spec128, 0, quorum, spec_plus, driver_device, 0, "", "Quorum", MACHINE_NOT_WORKING ) -COMP( 19??, bestzx, spec128, 0, scorpion, spec_plus, driver_device, 0, "", "BestZX", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/scv.c b/src/mess/drivers/scv.c deleted file mode 100644 index 20101807b25..00000000000 --- a/src/mess/drivers/scv.c +++ /dev/null @@ -1,719 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - Driver for Epoch Super Cassette Vision - -***************************************************************************/ - -#include "emu.h" -#include "cpu/upd7810/upd7810.h" -#include "audio/upd1771.h" -#include "bus/scv/slot.h" -#include "bus/scv/rom.h" - - -class scv_state : public driver_device -{ -public: - scv_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_videoram(*this,"videoram"), - m_maincpu(*this, "maincpu"), - m_upd1771c(*this, "upd1771c"), - m_cart(*this, "cartslot"), - m_pa(*this, "PA"), - m_pc0(*this, "PC0"), - m_charrom(*this, "charrom") { } - - DECLARE_WRITE8_MEMBER(porta_w); - DECLARE_READ8_MEMBER(portb_r); - DECLARE_READ8_MEMBER(portc_r); - DECLARE_WRITE8_MEMBER(portc_w); - DECLARE_WRITE_LINE_MEMBER(upd1771_ack_w); - required_shared_ptr m_videoram; - UINT8 m_porta; - UINT8 m_portc; - emu_timer *m_vb_timer; - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(scv); - UINT32 screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - enum - { - TIMER_VB - }; - - required_device m_maincpu; - required_device m_upd1771c; - required_device m_cart; - required_ioport_array<8> m_pa; - required_ioport m_pc0; - required_memory_region m_charrom; - - ioport_port *m_key[8]; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - void scv_set_banks(); - inline void plot_sprite_part( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 pat, UINT8 col, UINT8 screen_sprite_start_line ); - inline void draw_sprite( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y, UINT8 screen_sprite_start_line ); - inline void draw_text( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 *char_data, UINT8 fg, UINT8 bg ); - inline void draw_semi_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 data, UINT8 fg ); - inline void draw_block_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 col ); -}; - - -static ADDRESS_MAP_START( scv_mem, AS_PROGRAM, 8, scv_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_ROM // BIOS - - AM_RANGE( 0x2000, 0x3403 ) AM_RAM AM_SHARE("videoram") // VRAM + 4 registers - AM_RANGE( 0x3600, 0x3600 ) AM_DEVWRITE("upd1771c", upd1771c_device, write) - - AM_RANGE( 0x8000, 0xff7f ) AM_DEVREADWRITE("cartslot", scv_cart_slot_device, read_cart, write_cart) // cartridge - AM_RANGE( 0xff80, 0xffff ) AM_RAM // upd7801 internal RAM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( scv_io, AS_IO, 8, scv_state ) - AM_RANGE( 0x00, 0x00 ) AM_WRITE(porta_w) - AM_RANGE( 0x01, 0x01 ) AM_READ(portb_r) - AM_RANGE( 0x02, 0x02 ) AM_READWRITE(portc_r, portc_w) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( scv ) - PORT_START( "PA.0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "PA.1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START( "PA.2" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) - - PORT_START( "PA.3" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) - - PORT_START( "PA.4" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) - - PORT_START( "PA.5" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) - - PORT_START( "PA.6" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) - - PORT_START( "PA.7" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Cl") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("En") PORT_CODE(KEYCODE_PLUS_PAD) - - PORT_START( "PC0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_O) -INPUT_PORTS_END - - -WRITE8_MEMBER( scv_state::porta_w ) -{ - m_porta = data; -} - - -READ8_MEMBER( scv_state::portb_r ) -{ - UINT8 data = 0xff; - - for (int i = 0; i < 8; i++) - { - if (!BIT(m_porta, i)) - data &= m_pa[i]->read(); - } - - return data; -} - - -READ8_MEMBER( scv_state::portc_r ) -{ - UINT8 data = m_portc; - - data = (data & 0xfe) | (m_pc0->read() & 0x01); - - return data; -} - - -WRITE8_MEMBER( scv_state::portc_w ) -{ - //logerror("%04x: scv_portc_w: data = 0x%02x\n", m_maincpu->pc(), data ); - m_portc = data; - m_cart->write_bank(space, 0, m_portc); - m_upd1771c->pcm_write(m_portc & 0x08); -} - - -PALETTE_INIT_MEMBER(scv_state, scv) -{ - /* - SCV Epoch-1A chip RGB voltage readouts from paused Bios color test: - - (values in millivolts) - - R G B - 0 29 29 325 - 1 29 27 22 - 2 25 24 510 - 3 337 28 508 - 4 29 515 22 - 5 336 512 329 - 6 26 515 511 - 7 29 337 25 - 8 520 24 22 - 9 517 338 21 - 10 520 25 512 - 11 521 336 333 - 12 518 515 21 - 13 342 336 22 - 14 337 336 330 - 15 516 511 508 - - Only tree 'bins' of values are obviously captured - 25 ish - 330 ish - 520 ish. - - Quamtizing/scaling/rounding between 0 and 255 we thus get: - - */ - palette.set_pen_color( 0, 0, 0, 155); - palette.set_pen_color( 1, 0, 0, 0); - palette.set_pen_color( 2, 0, 0, 255); - palette.set_pen_color( 3, 161, 0, 255); - palette.set_pen_color( 4, 0, 255, 0); - palette.set_pen_color( 5, 160, 255, 157); - palette.set_pen_color( 6, 0, 255, 255); - palette.set_pen_color( 7, 0, 161, 0); - palette.set_pen_color( 8, 255, 0, 0); - palette.set_pen_color( 9, 255, 161, 0); - palette.set_pen_color( 10, 255, 0, 255); - palette.set_pen_color( 11, 255, 160, 159); - palette.set_pen_color( 12, 255, 255, 0); - palette.set_pen_color( 13, 163, 160, 0); - palette.set_pen_color( 14, 161, 160, 157); - palette.set_pen_color( 15, 255, 255, 255); -} - - -void scv_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_VB: - { - int vpos = machine().first_screen()->vpos(); - - switch( vpos ) - { - case 240: - m_maincpu->set_input_line(UPD7810_INTF2, ASSERT_LINE); - break; - case 0: - m_maincpu->set_input_line(UPD7810_INTF2, CLEAR_LINE); - break; - } - - m_vb_timer->adjust(machine().first_screen()->time_until_pos((vpos + 1) % 262, 0)); - } - break; - - default: - assert_always(FALSE, "Unknown id in scv_state::device_timer"); - } -} - - -inline void scv_state::plot_sprite_part( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 pat, UINT8 col, UINT8 screen_sprite_start_line ) -{ - if ( x < 4 ) - { - return; - } - - x -= 4; - - if ( y + 2 >= screen_sprite_start_line ) - { - if ( pat & 0x08 ) - { - bitmap.pix16(y + 2, x ) = col; - } - if ( pat & 0x04 && x < 255 ) - { - bitmap.pix16(y + 2, x + 1 ) = col; - } - if ( pat & 0x02 && x < 254 ) - { - bitmap.pix16(y + 2, x + 2 ) = col; - } - if ( pat & 0x01 && x < 253 ) - { - bitmap.pix16(y + 2, x + 3 ) = col; - } - } -} - - -inline void scv_state::draw_sprite( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y, UINT8 screen_sprite_start_line ) -{ - int j; - - y += clip_y * 2; - for ( j = clip_y * 4; j < 32; j += 4 ) - { - UINT8 pat0 = m_videoram[ tile_idx * 32 + j + 0 ]; - UINT8 pat1 = m_videoram[ tile_idx * 32 + j + 1 ]; - UINT8 pat2 = m_videoram[ tile_idx * 32 + j + 2 ]; - UINT8 pat3 = m_videoram[ tile_idx * 32 + j + 3 ]; - - if ( ( top && j < 16 ) || ( bottom && j >= 16 ) ) - { - if ( left ) - { - plot_sprite_part( bitmap, x , y, pat0 >> 4, col, screen_sprite_start_line ); - plot_sprite_part( bitmap, x + 4, y, pat1 >> 4, col, screen_sprite_start_line ); - } - if ( right ) - { - plot_sprite_part( bitmap, x + 8, y, pat2 >> 4, col, screen_sprite_start_line ); - plot_sprite_part( bitmap, x + 12, y, pat3 >> 4, col, screen_sprite_start_line ); - } - - if ( left ) - { - plot_sprite_part( bitmap, x , y + 1, pat0 & 0x0f, col, screen_sprite_start_line ); - plot_sprite_part( bitmap, x + 4, y + 1, pat1 & 0x0f, col, screen_sprite_start_line ); - } - if ( right ) - { - plot_sprite_part( bitmap, x + 8, y + 1, pat2 & 0x0f, col, screen_sprite_start_line ); - plot_sprite_part( bitmap, x + 12, y + 1, pat3 & 0x0f, col, screen_sprite_start_line ); - } - } - - y += 2; - } -} - - -inline void scv_state::draw_text( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 *char_data, UINT8 fg, UINT8 bg ) -{ - int i; - - for ( i = 0; i < 8; i++ ) - { - UINT8 d = char_data[i]; - - bitmap.pix16(y + i, x + 0 ) = ( d & 0x80 ) ? fg : bg; - bitmap.pix16(y + i, x + 1 ) = ( d & 0x40 ) ? fg : bg; - bitmap.pix16(y + i, x + 2 ) = ( d & 0x20 ) ? fg : bg; - bitmap.pix16(y + i, x + 3 ) = ( d & 0x10 ) ? fg : bg; - bitmap.pix16(y + i, x + 4 ) = ( d & 0x08 ) ? fg : bg; - bitmap.pix16(y + i, x + 5 ) = ( d & 0x04 ) ? fg : bg; - bitmap.pix16(y + i, x + 6 ) = ( d & 0x02 ) ? fg : bg; - bitmap.pix16(y + i, x + 7 ) = ( d & 0x01 ) ? fg : bg; - } - - for ( i = 8; i < 16; i++ ) - { - bitmap.pix16(y + i, x + 0 ) = bg; - bitmap.pix16(y + i, x + 1 ) = bg; - bitmap.pix16(y + i, x + 2 ) = bg; - bitmap.pix16(y + i, x + 3 ) = bg; - bitmap.pix16(y + i, x + 4 ) = bg; - bitmap.pix16(y + i, x + 5 ) = bg; - bitmap.pix16(y + i, x + 6 ) = bg; - bitmap.pix16(y + i, x + 7 ) = bg; - } - -} - - -inline void scv_state::draw_semi_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 data, UINT8 fg ) -{ - int i; - - if ( ! data ) - return; - - for ( i = 0; i < 4; i++ ) - { - bitmap.pix16(y + i, x + 0) = fg; - bitmap.pix16(y + i, x + 1) = fg; - bitmap.pix16(y + i, x + 2) = fg; - bitmap.pix16(y + i, x + 3) = fg; - } -} - - -inline void scv_state::draw_block_graph( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 col ) -{ - int i; - - for ( i = 0; i < 8; i++ ) - { - bitmap.pix16(y + i, x + 0) = col; - bitmap.pix16(y + i, x + 1) = col; - bitmap.pix16(y + i, x + 2) = col; - bitmap.pix16(y + i, x + 3) = col; - bitmap.pix16(y + i, x + 4) = col; - bitmap.pix16(y + i, x + 5) = col; - bitmap.pix16(y + i, x + 6) = col; - bitmap.pix16(y + i, x + 7) = col; - } -} - - -UINT32 scv_state::screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y; - UINT8 fg = m_videoram[0x1403] >> 4; - UINT8 bg = m_videoram[0x1403] & 0x0f; - UINT8 gr_fg = m_videoram[0x1401] >> 4; - UINT8 gr_bg = m_videoram[0x1401] & 0x0f; - int clip_x = ( m_videoram[0x1402] & 0x0f ) * 2; - int clip_y = m_videoram[0x1402] >> 4; - - /* Clear the screen */ - bitmap.fill(gr_bg , cliprect); - - /* Draw background */ - for ( y = 0; y < 16; y++ ) - { - int text_y = 0; - - if ( y < clip_y ) - { - text_y = ( m_videoram[0x1400] & 0x80 ) ? 0 : 1; - } - else - { - text_y = ( m_videoram[0x1400] & 0x80 ) ? 1 : 0; - } - - for ( x = 0; x < 32; x++ ) - { - int text_x = 0; - UINT8 d = m_videoram[ 0x1000 + y * 32 + x ]; - - if ( x < clip_x ) - { - text_x = ( m_videoram[0x1400] & 0x40 ) ? 0 : 1; - } - else - { - text_x = ( m_videoram[0x1400] & 0x40 ) ? 1 : 0; - } - - if ( text_x && text_y ) - { - /* Text mode */ - UINT8 *char_data = m_charrom->base() + ( d & 0x7f ) * 8; - draw_text( bitmap, x * 8, y * 16, char_data, fg, bg ); - } - else - { - switch ( m_videoram[0x1400] & 0x03 ) - { - case 0x01: /* Semi graphics mode */ - draw_semi_graph( bitmap, x * 8 , y * 16 , d & 0x80, gr_fg ); - draw_semi_graph( bitmap, x * 8 + 4, y * 16 , d & 0x40, gr_fg ); - draw_semi_graph( bitmap, x * 8 , y * 16 + 4, d & 0x20, gr_fg ); - draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 4, d & 0x10, gr_fg ); - draw_semi_graph( bitmap, x * 8 , y * 16 + 8, d & 0x08, gr_fg ); - draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 8, d & 0x04, gr_fg ); - draw_semi_graph( bitmap, x * 8 , y * 16 + 12, d & 0x02, gr_fg ); - draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 12, d & 0x01, gr_fg ); - break; - - case 0x03: /* Block graphics mode */ - draw_block_graph( bitmap, x * 8, y * 16 , d >> 4 ); - draw_block_graph( bitmap, x * 8, y * 16 + 8, d & 0x0f ); - break; - - default: /* Otherwise draw nothing? */ - break; - } - } - } - } - - /* Draw sprites if enabled */ - if ( m_videoram[0x1400] & 0x10 ) - { - UINT8 screen_start_sprite_line = ( ( ( m_videoram[0x1400] & 0xf7 ) == 0x17 ) && ( ( m_videoram[0x1402] & 0xef ) == 0x4f ) ) ? 21 + 32 : 0 ; - int i; - - for ( i = 0; i < 128; i++ ) - { - UINT8 spr_y = m_videoram[ 0x1200 + i * 4 ] & 0xfe; - UINT8 y_32 = m_videoram[ 0x1200 + i * 4 ] & 0x01; /* Xx32 sprite */ - UINT8 clip = m_videoram[ 0x1201 + i * 4 ] >> 4; - UINT8 col = m_videoram[ 0x1201 + i * 4 ] & 0x0f; - UINT8 spr_x = m_videoram[ 0x1202 + i * 4 ] & 0xfe; - UINT8 x_32 = m_videoram[ 0x1202 + i * 4 ] & 0x01; /* 32xX sprite */ - UINT8 tile_idx = m_videoram[ 0x1203 + i * 4 ] & 0x7f; - UINT8 half = m_videoram[ 0x1203 + i * 4] & 0x80; - UINT8 left = 1; - UINT8 right = 1; - UINT8 top = 1; - UINT8 bottom = 1; - - if ( !col ) - { - continue; - } - - if ( !spr_y ) - { - continue; - } - - if ( half ) - { - if ( tile_idx & 0x40 ) - { - if ( y_32 ) - { - spr_y -= 8; - top = 0; - bottom = 1; - y_32 = 0; - } - else - { - top = 1; - bottom = 0; - } - } - if ( x_32 ) - { - spr_x -= 8; - left = 0; - right = 1; - x_32 = 0; - } - else - { - left = 1; - right = 0; - } - } - - /* Check if 2 color sprites are enabled */ - if ( ( m_videoram[0x1400] & 0x20 ) && ( i & 0x20 ) ) - { - /* 2 color sprite handling */ - draw_sprite( bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip, screen_start_sprite_line ); - if ( x_32 || y_32 ) - { - static const UINT8 spr_2col_lut0[16] = { 0, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 1, 1 }; - static const UINT8 spr_2col_lut1[16] = { 0, 1, 8, 11, 2, 3, 10, 9, 4, 5, 12, 13, 6, 7, 14, 15 }; - - draw_sprite( bitmap, spr_x, spr_y, tile_idx ^ ( 8 * x_32 + y_32 ), ( i & 0x40 ) ? spr_2col_lut1[col] : spr_2col_lut0[col], left, right, top, bottom, clip, screen_start_sprite_line ); - } - } - else - { - /* regular sprite handling */ - draw_sprite( bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip, screen_start_sprite_line ); - if ( x_32 ) - { - draw_sprite( bitmap, spr_x + 16, spr_y, tile_idx | 8, col, 1, 1, top, bottom, clip, screen_start_sprite_line ); - } - - if ( y_32 ) - { - clip = ( clip & 0x08 ) ? ( clip & 0x07 ) : 0; - draw_sprite( bitmap, spr_x, spr_y + 16, tile_idx | 1, col, left, right, 1, 1, clip, screen_start_sprite_line ); - if ( x_32 ) - { - draw_sprite( bitmap, spr_x + 16, spr_y + 16, tile_idx | 9, col, 1, 1, 1, 1, clip, screen_start_sprite_line ); - } - } - } - } - } - - return 0; -} - - -WRITE_LINE_MEMBER( scv_state::upd1771_ack_w ) -{ - m_maincpu->set_input_line(UPD7810_INTF1, (state) ? ASSERT_LINE : CLEAR_LINE); -} - -void scv_state::machine_start() -{ - m_vb_timer = timer_alloc(TIMER_VB); - - save_item(NAME(m_porta)); - save_item(NAME(m_portc)); - if (m_cart->exists()) - m_cart->save_ram(); - -} - - -void scv_state::machine_reset() -{ - m_vb_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); -} - - -/* F4 Character Displayer */ -static const gfx_layout scv_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( scv ) - GFXDECODE_ENTRY( "charrom", 0x0000, scv_charlayout, 0, 8 ) -GFXDECODE_END - - -static SLOT_INTERFACE_START(scv_cart) - SLOT_INTERFACE_INTERNAL("rom8k", SCV_ROM8K) - SLOT_INTERFACE_INTERNAL("rom16k", SCV_ROM16K) - SLOT_INTERFACE_INTERNAL("rom32k", SCV_ROM32K) - SLOT_INTERFACE_INTERNAL("rom32k_ram", SCV_ROM32K_RAM8K) - SLOT_INTERFACE_INTERNAL("rom64k", SCV_ROM64K) - SLOT_INTERFACE_INTERNAL("rom128k", SCV_ROM128K) - SLOT_INTERFACE_INTERNAL("rom128k_ram", SCV_ROM128K_RAM4K) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( scv, scv_state ) - - MCFG_CPU_ADD( "maincpu", UPD7801, XTAL_4MHz ) - MCFG_CPU_PROGRAM_MAP( scv_mem ) - MCFG_CPU_IO_MAP( scv_io ) - - /* Video chip is EPOCH TV-1 */ - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_RAW_PARAMS( XTAL_14_31818MHz/2, 456, 24, 24+192, 262, 23, 23+222 ) /* TODO: Verify */ - MCFG_SCREEN_UPDATE_DRIVER(scv_state, screen_update_scv) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", scv) - MCFG_PALETTE_ADD( "palette", 16 ) - MCFG_PALETTE_INIT_OWNER(scv_state, scv) - - /* Sound is generated by UPD1771C clocked at XTAL_6MHz */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD( "upd1771c", UPD1771C, XTAL_6MHz ) - MCFG_UPD1771_ACK_HANDLER(WRITELINE(scv_state, upd1771_ack_w)) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - - MCFG_SCV_CARTRIDGE_ADD("cartslot", scv_cart, NULL) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","scv") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( scv_pal, scv ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_CLOCK( 3780000 ) - - /* Video chip is EPOCH TV-1A */ - MCFG_SCREEN_MODIFY( "screen" ) - MCFG_SCREEN_RAW_PARAMS( XTAL_13_4MHz/2, 456, 24, 24+192, 342, 23, 23+222 ) /* TODO: Verify */ -MACHINE_CONFIG_END - - -/* The same bios is used in both the NTSC and PAL versions of the console */ -ROM_START( scv ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "upd7801g.s01", 0, 0x1000, CRC(7ac06182) SHA1(6e89d1227581c76441a53d605f9e324185f1da33) ) - - ROM_REGION( 0x400, "charrom", 0 ) - ROM_LOAD( "epochtv.chr", 0, 0x400, BAD_DUMP CRC(db521533) SHA1(40b4e44838c35191f115437a14f200f052e71509) ) -ROM_END - - -ROM_START( scv_pal ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "upd7801g.s01", 0, 0x1000, CRC(7ac06182) SHA1(6e89d1227581c76441a53d605f9e324185f1da33) ) - - ROM_REGION( 0x400, "charrom", 0 ) - ROM_LOAD( "epochtv.chr", 0, 0x400, BAD_DUMP CRC(db521533) SHA1(40b4e44838c35191f115437a14f200f052e71509) ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1984, scv, 0, 0, scv, scv, driver_device, 0, "Epoch", "Super Cassette Vision", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -CONS( 198?, scv_pal, scv, 0, scv_pal, scv, driver_device, 0, "Yeno", "Super Cassette Vision (PAL)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/sdk80.c b/src/mess/drivers/sdk80.c deleted file mode 100644 index 34fb057518a..00000000000 --- a/src/mess/drivers/sdk80.c +++ /dev/null @@ -1,205 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nigel Barnes,Ryan Holtz -/*************************************************************************** - - Intel SDK-80 - -This is an evaluation kit for the 8080 cpu. - -There is no speaker or storage facility in the standard kit. - -Download the User Manual to get the operating procedures. - -Monitor Commands: -D Display memory contents -G Go to address (execute program at address) -I Insert hex code -M Move blocks of memory -S Substitute memory locations -X Examine registers - -Please note this rom set boots into BASIC, not monitor. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8251.h" -#include "machine/clock.h" -#include "bus/rs232/rs232.h" -//#include "machine/ay31015.h" - -#define I8251A_TAG "usart" -#define I8251A_BAUD_TAG "usart_baud" -#define RS232_TAG "rs232" - -class sdk80_state : public driver_device -{ -public: - sdk80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_usart(*this, I8251A_TAG) - , m_rs232(*this, RS232_TAG) - , m_usart_baud_rate(*this, I8251A_BAUD_TAG) - , m_usart_divide_counter(0) - , m_usart_clock_state(0) - { } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE_LINE_MEMBER( usart_clock_tick ); - -private: - required_device m_maincpu; - required_device m_usart; - required_device m_rs232; - required_ioport m_usart_baud_rate; - - UINT8 m_usart_divide_counter; - UINT8 m_usart_clock_state; -}; - -static ADDRESS_MAP_START(sdk80_mem, AS_PROGRAM, 8, sdk80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x3c00, 0x3fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sdk80_io, AS_IO, 8, sdk80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xec, 0xec) AM_DEVREADWRITE(I8251A_TAG, i8251_device, data_r, data_w) - AM_RANGE(0xed, 0xed) AM_DEVREADWRITE(I8251A_TAG, i8251_device, status_r, control_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( sdk80 ) - PORT_START(I8251A_BAUD_TAG) - PORT_DIPNAME( 0x3f, 0x01, "i8251 Baud Rate" ) - PORT_DIPSETTING( 0x01, "4800") - PORT_DIPSETTING( 0x02, "2400") - PORT_DIPSETTING( 0x04, "1200") - PORT_DIPSETTING( 0x08, "600") - PORT_DIPSETTING( 0x10, "300") - PORT_DIPSETTING( 0x20, "150") - PORT_DIPSETTING( 0x40, "75") -INPUT_PORTS_END - -#if 0 -/* Graphics Output */ -const gfx_layout sdk80_charlayout = -{ - 7, 8, /* character cell is 7 pixels wide by 8 pixels high */ - 64, /* 64 characters in 2513 character generator ROM */ - 1, /* 1 bitplane */ - { 0 }, - /* 5 visible pixels per row, starting at bit 3, with MSB being 0: */ - { 3, 4, 5, 6, 7 }, - /* pixel rows stored from top to bottom: */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8 * 8 /* 8 8-bit pixel rows per character */ -}; - -static GFXDECODE_START( sdk80 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, sdk80_charlayout, 0, 1 ) -GFXDECODE_END -#endif - -UINT32 sdk80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -WRITE_LINE_MEMBER( sdk80_state::usart_clock_tick ) -{ - UINT8 old_counter = m_usart_divide_counter; - m_usart_divide_counter++; - - UINT8 transition = (old_counter ^ m_usart_divide_counter) & m_usart_baud_rate->read(); - if (transition) - { - m_usart->write_txc(m_usart_clock_state); - m_usart->write_rxc(m_usart_clock_state); - m_usart_clock_state ^= 1; - } -} - -static MACHINE_CONFIG_START( sdk80, sdk80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080A, XTAL_18_432MHz/9) - MCFG_CPU_PROGRAM_MAP(sdk80_mem) - MCFG_CPU_IO_MAP(sdk80_io) - - MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "null_modem") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_dsr)) - - MCFG_DEVICE_ADD("usart_clock", CLOCK, XTAL_18_432MHz/60) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sdk80_state, usart_clock_tick)) - - /* video hardware */ - // 96364 crt controller - -// MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(60) - /* Video is blanked for 70 out of 262 scanlines per refresh cycle. - Each scanline is composed of 65 character times, 40 of which - are visible, and each character time is 7 dot times; a dot time - is 2 cycles of the fundamental 14.31818 MHz oscillator. The - total blanking time is about 4450 microseconds. */ -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((int) (70 * 65 * 7 * 2 / 14.31818))) - /* It would be nice if we could implement some sort of display - overscan here. */ -// MCFG_SCREEN_SIZE(40 * 7, 24 * 8) -// MCFG_SCREEN_VISIBLE_AREA(0, 40 * 7 - 1, 0, 24 * 8 - 1) -// MCFG_SCREEN_UPDATE_DRIVER(sdk80_state, screen_update) -// MCFG_SCREEN_PALETTE("palette") - -// MCFG_GFXDECODE_ADD("gfxdecode", "palette", sdk80) - -// MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - // Video board UART -// MCFG_DEVICE_ADD( "hd6402", AY31015, 0 ) -// MCFG_AY31015_TX_CLOCK(( XTAL_16MHz / 16 ) / 256) -// MCFG_AY31015_RX_CLOCK(( XTAL_16MHz / 16 ) / 256) -// MCFG_AY51013_READ_SI_CB(READ8(sdk80_state, nascom1_hd6402_si)) -// MCFG_AY51013_WRITE_SO_CB(WRITE8(sdk80_state, nascom1_hd6402_so)) - - /* Devices */ -// MCFG_DEVICE_ADD("i8279", I8279, 3100000) // based on divider -// MCFG_I8279_OUT_IRQ_CB(INPUTLINE("maincpu", I8085_RST55_LINE)) // irq -// MCFG_I8279_OUT_SL_CB(WRITE8(sdk80_state, scanlines_w)) // scan SL lines -// MCFG_I8279_OUT_DISP_CB(WRITE8(sdk80_state, digit_w)) // display A&B -// MCFG_I8279_IN_RL_CB(READ8(sdk80_state, kbd_r)) // kbd RL lines -// MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key -// MCFG_I8279_IN_CTRL_CB(VCC) - - //MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0) - //MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(sdk80_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sdk80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "basic_blc_1.a14", 0x0000, 0x0400, CRC(b5e75aee) SHA1(6bd1eb9586d72544e8afb4ae43ecedcefa14da33)) - ROM_LOAD( "basic_blc_2.a15", 0x0400, 0x0400, CRC(0a9ad1ed) SHA1(92c47eadcf8b18eeedcccaa3deb9f1518aaceeae)) - ROM_LOAD( "basic_blc_3.a16", 0x0800, 0x0400, CRC(bc898e4b) SHA1(adc000534db0f736a75fbceed360dc220e02c30d)) - ROM_LOAD( "basic_blc_4.a17", 0x0c00, 0x0400, CRC(568e8b6d) SHA1(22960193d3b0ae1b5d876d8c3b3f3b40db01358c)) - - /* 512-byte Signetics 2513 character generator ROM at location D2-D3 */ - ROM_REGION(0x0200, "gfx1",0) - ROM_LOAD("s2513.d2", 0x0000, 0x0200, CRC(a7e567fc) SHA1(b18aae0a2d4f92f5a7e22640719bbc4652f3f4ee)) - - /* 256x4 PROM located on the video board, schematic location P7, to be moved into separate device later */ - ROM_REGION( 0x0120, "proms", 0 ) - ROM_LOAD( "6300__d7.p7", 0x0020, 0x0100, CRC(3eb3a8e4) SHA1(19097b5f60d1030f8b82d9f1d3a241f93e5c75d6) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1975, sdk80, 0, 0, sdk80, sdk80, driver_device, 0, "Intel", "SDK-80", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/sdk85.c b/src/mess/drivers/sdk85.c deleted file mode 100644 index 8438add6efe..00000000000 --- a/src/mess/drivers/sdk85.c +++ /dev/null @@ -1,145 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Intel SDK-85 - - 09/12/2009 Skeleton driver. - - 22/06/2011 Working [Robbbert] - -This is an evaluation kit for the 8085 cpu. - -There is no speaker or storage facility in the standard kit. - -Download the User Manual to get the operating procedures. - -An example is Press SUBST key, enter an address, press NEXT key, enter data, -then press NEXT to increment the address. - -ToDo: -- Artwork - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8279.h" -#include "sdk85.lh" - - -class sdk85_state : public driver_device -{ -public: - sdk85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_WRITE8_MEMBER(scanlines_w); - DECLARE_WRITE8_MEMBER(digit_w); - DECLARE_READ8_MEMBER(kbd_r); - UINT8 m_digit; - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(sdk85_mem, AS_PROGRAM, 8, sdk85_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM // Monitor rom (A14) - AM_RANGE(0x0800, 0x0fff) AM_ROM // Expansion rom (A15) - AM_RANGE(0x1800, 0x1800) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w ) - AM_RANGE(0x1900, 0x1900) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) - //AM_RANGE(0x1800, 0x1fff) AM_RAM // i8279 (A13) - AM_RANGE(0x2000, 0x27ff) AM_RAM // i8155 (A16) - AM_RANGE(0x2800, 0x2fff) AM_RAM // i8155 (A17) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sdk85_io, AS_IO, 8, sdk85_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sdk85 ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXEC") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SUBST") PORT_CODE(KEYCODE_T) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXAM") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SINGLE") PORT_CODE(KEYCODE_U) - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -WRITE8_MEMBER( sdk85_state::scanlines_w ) -{ - m_digit = data; -} - -WRITE8_MEMBER( sdk85_state::digit_w ) -{ - if (m_digit < 6) - output_set_digit_value(m_digit, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4)^0xff); -} - -READ8_MEMBER( sdk85_state::kbd_r ) -{ - UINT8 data = 0xff; - - if (m_digit < 3) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",m_digit); - data = ioport(kbdrow)->read(); - } - return data; -} - -static MACHINE_CONFIG_START( sdk85, sdk85_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8085A, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(sdk85_mem) - MCFG_CPU_IO_MAP(sdk85_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_sdk85) - - /* Devices */ - MCFG_DEVICE_ADD("i8279", I8279, 3100000) // based on divider - MCFG_I8279_OUT_IRQ_CB(INPUTLINE("maincpu", I8085_RST55_LINE)) // irq - MCFG_I8279_OUT_SL_CB(WRITE8(sdk85_state, scanlines_w)) // scan SL lines - MCFG_I8279_OUT_DISP_CB(WRITE8(sdk85_state, digit_w)) // display A&B - MCFG_I8279_IN_RL_CB(READ8(sdk85_state, kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key - MCFG_I8279_IN_CTRL_CB(VCC) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sdk85 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "sdk85.a14", 0x0000, 0x0800, CRC(9d5a983f) SHA1(54e218560fbec009ac3de5cfb64b920241ef2eeb)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, sdk85, 0, 0, sdk85, sdk85, driver_device, 0, "Intel", "SDK-85", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/sdk86.c b/src/mess/drivers/sdk86.c deleted file mode 100644 index c895211950a..00000000000 --- a/src/mess/drivers/sdk86.c +++ /dev/null @@ -1,212 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu, Robbbert -/*************************************************************************** - - Intel SDK-86 - - 12/05/2009 Skeleton driver by Micko - 29/11/2009 Some fleshing out by Lord Nightmare - 22/06/2011 Working [Robbbert] - - TODO: - Add optional 2x 8255A port read/write logging - - - -This is an evaluation kit for the 8086 cpu. - -There is no speaker or storage facility in the standard kit. - -Download the User Manual to get the operating procedures. -The user manual is available from: http://www.bitsavers.org/pdf/intel/8086/9800698A_SDK-86_Users_Man_Apr79.pdf - -ToDo: -- Artwork -- Add INTR and RESET keys - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/i86/i86.h" -#include "machine/clock.h" -#include "machine/i8251.h" -#include "machine/i8279.h" -#include "sdk86.lh" - -#define I8251_TAG "i8251" -#define RS232_TAG "rs232" - - -class sdk86_state : public driver_device -{ -public: - sdk86_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_usart(*this, I8251_TAG) - { - } - - required_device m_maincpu; - required_device m_usart; - - DECLARE_WRITE8_MEMBER(scanlines_w); - DECLARE_WRITE8_MEMBER(digit_w); - DECLARE_READ8_MEMBER(kbd_r); - - DECLARE_WRITE_LINE_MEMBER( write_usart_clock ); - - UINT8 m_digit; -}; - -static ADDRESS_MAP_START(sdk86_mem, AS_PROGRAM, 16, sdk86_state) - AM_RANGE(0x00000, 0x00fff) AM_RAM //2K standard, or 4k (board fully populated) - AM_RANGE(0xfe000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sdk86_io, AS_IO, 16, sdk86_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xfff0, 0xfff1) AM_MIRROR(4) AM_DEVREADWRITE8(I8251_TAG, i8251_device, data_r, data_w, 0xff) - AM_RANGE(0xfff2, 0xfff3) AM_MIRROR(4) AM_DEVREADWRITE8(I8251_TAG, i8251_device, status_r, control_w, 0xff) - AM_RANGE(0xffe8, 0xffe9) AM_MIRROR(4) AM_DEVREADWRITE8("i8279", i8279_device, data_r, data_w, 0xff) - AM_RANGE(0xffea, 0xffeb) AM_MIRROR(4) AM_DEVREADWRITE8("i8279", i8279_device, status_r, cmd_w, 0xff) - // FFF8-FFFF = 2 x 8255A i/o chips. chip 1 uses the odd addresses, chip 2 uses the even addresses. - // ports are A,B,C,control in that order. -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sdk86 ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 EB/AX") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ER/BX") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 GO/CX") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 ST/DX") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 IB/SP") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 OB/BP") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 MV/SI") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 EW/DI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IW/CS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 OW/DS") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A SS") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ES") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C IP") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D FL") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_X) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) - PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -WRITE8_MEMBER( sdk86_state::scanlines_w ) -{ - m_digit = data; -} - -WRITE8_MEMBER( sdk86_state::digit_w ) -{ - if (m_digit < 8) - output_set_digit_value(m_digit, data); -} - -READ8_MEMBER( sdk86_state::kbd_r ) -{ - UINT8 data = 0xff; - - if (m_digit < 3) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",m_digit); - data = ioport(kbdrow)->read(); - } - return data; -} - -WRITE_LINE_MEMBER( sdk86_state::write_usart_clock ) -{ - m_usart->write_txc(state); - m_usart->write_rxc(state); -} - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_4800 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_4800 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) -DEVICE_INPUT_DEFAULTS_END - -static MACHINE_CONFIG_START( sdk86, sdk86_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, XTAL_14_7456MHz/3) /* divided down by i8284 clock generator; jumper selection allows it to be slowed to 2.5MHz, hence changing divider from 3 to 6 */ - MCFG_CPU_PROGRAM_MAP(sdk86_mem) - MCFG_CPU_IO_MAP(sdk86_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_sdk86) - - /* Devices */ - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_cts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_DEVICE_ADD("usart_clock", CLOCK, 307200) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sdk86_state, write_usart_clock)) - - MCFG_DEVICE_ADD("i8279", I8279, 2500000) // based on divider - MCFG_I8279_OUT_SL_CB(WRITE8(sdk86_state, scanlines_w)) // scan SL lines - MCFG_I8279_OUT_DISP_CB(WRITE8(sdk86_state, digit_w)) // display A&B - MCFG_I8279_IN_RL_CB(READ8(sdk86_state, kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(GND) // Shift key - MCFG_I8279_IN_CTRL_CB(GND) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sdk86 ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) // all are Intel D2616 ?eproms with the windows painted over? (factory programmed eproms? this would match the 'i8642' marking on the factory programmed eprom version of the AT keyboard mcu...) - // Note that the rom pairs at FE000-FEFFF and FF000-FFFFF are interchangeable; the ones at FF000-FFFFF are the ones which start on bootup, and the other ones live at FE000-FEFFF and can be switched in by the user. One pair is the Serial RS232 Monitor and the other is the Keypad/front panel monitor. On the SDK-86 I (LN) dumped, the Keypad monitor was primary, but the other SDK-86 I know of has the roms in the opposite arrangement (Serial primary). - // Keypad Monitor Version 1.1 (says "- 86 1.1" on LED display at startup) - ROM_SYSTEM_BIOS( 0, "keypad", "Keypad Monitor" ) - ROMX_LOAD( "0169_102042-001.a27", 0xff000, 0x0800, CRC(3f46311a) SHA1(a97e6861b736f26230b9adbf5cd2576a9f60d626), ROM_SKIP(1) | ROM_BIOS(1) ) /* Label: "iD2616 // T142094WS // (C)INTEL '77 // 0169 // 102042-001" */ - ROMX_LOAD( "0170_102043-001.a30", 0xff001, 0x0800, CRC(65924471) SHA1(5d258695bf585f89179dfa0a113a0eeeabd5ee2b), ROM_SKIP(1) | ROM_BIOS(1) ) /* Label: "iD2616 // T145056WS // (C)INTEL '77 // 0170 // 102043-001" */ - // Serial Monitor Version 1.2 (says " 86 1.2" on LED display at startup, and sends a data prompt over serial) - ROM_SYSTEM_BIOS( 1, "serial", "Serial Monitor" ) - ROMX_LOAD( "0456_104531-001.a36", 0xff000, 0x0800, CRC(f9c4a809) SHA1(aea324c3f52dd393f1eed2b856ba11f050a35b93), ROM_SKIP(1) | ROM_BIOS(2) ) /* Label: "iD2616 // T142099WS // (C)INTEL '77 // 0456 // 104531-001" */ - ROMX_LOAD( "0457_104532-001.a37", 0xff001, 0x0800, CRC(a245ba5c) SHA1(7f67277f866fca5377cb123e9cc405b5fdfe61d3), ROM_SKIP(1) | ROM_BIOS(2) ) /* Label: "iD2616 // T145054WS // (C)INTEL '77 // 0457 // 104532-001" */ - - /* proms: - * dumped 11/21/09 through 11/29/09 by LN - * purposes: (according to sdk-86 user manual from http://www.bitsavers.org/pdf/intel/8086/9800698A_SDK-86_Users_Man_Apr79.pdf) - * A12: main address decoding (selects ram or rom or open bus/offboard, see page 2-7) - * A22: I/O decoding for 8251, 8279 and optional pair of 8255 chips (in the FFE8-FFFF I/O area; see page 2-6) - * A26: ROM address decoding for selecting which of the 4 pairs of roms is active (note that to use the FCxxx and FDxxx pairs requires wiring them into the prototype area, they are not standard; see page 2-5) - * A29: RAM address decoding (see page 2-4) - */ - ROM_REGION(0x1000, "proms", 0 ) // all are Intel D3625A 1kx4 (82s137A equivalent) - ROM_LOAD( "0036_101993-001.a12", 0x0000, 0x0400, CRC(bb7edbfd) SHA1(8847f9815c7cb8695986743199673920a7d4390d)) /* Label: "iD3625A 0036 // 8142 // 101993-001" */ - ROM_LOAD( "0035_101992-001.a22", 0x0400, 0x0400, CRC(76aced0c) SHA1(89fa39473e19d8cb6b65d6430d3d683ae2398fb3)) /* Label: "iD3625A 0035 // 8142 // 101992-001" */ - ROM_LOAD( "0037_101994-001.a26", 0x0800, 0x0400, CRC(d6f33d30) SHA1(41e794bf202266fa57516403e6a80ebbf6c95fdc)) /* Label: "iD3625A 0037 // 8142 // 101994-001" */ - ROM_LOAD( "0038_101995-001.a29", 0x0C00, 0x0400, CRC(3d2c18bc) SHA1(5e1935cd07fef26b2cf3d8fa7612fe0d8e678c06)) /* Label: "iD3625A 0038 // 8142 // 101995-001" */ -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, sdk86, 0, 0, sdk86, sdk86, driver_device, 0, "Intel", "SDK-86", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/seattlecmp.c b/src/mess/drivers/seattlecmp.c deleted file mode 100644 index 4c590f22642..00000000000 --- a/src/mess/drivers/seattlecmp.c +++ /dev/null @@ -1,127 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -Seattle Computer SCP-300F S100 card. It has sockets on the card for -one serial and 2 parallel connections. - -2013-08-14 Skeleton driver. - -When started you must press Enter twice before anything happens. - -All commands must be in UPPER case. - -Known Commands: -B : Boot from disk? -D : Dump memory -E : Edit memory -F : Find -G : Go? -I : Input port -M : Move -O : Output port -R : Display / Modify Registers -S : Search -T : Trace - -Chips on the board: 8259 x2; AM9513; 8251; 2716 ROM (MON-86 V1.5TDD) -There is a 4MHz crystal connected to the 9513. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class seattle_comp_state : public driver_device -{ -public: - seattle_comp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_READ16_MEMBER(read); - DECLARE_WRITE16_MEMBER(write); - DECLARE_WRITE8_MEMBER(kbd_put); -private: - virtual void machine_reset(); - required_device m_maincpu; - required_device m_terminal; - UINT8 m_term_data; - bool m_key_available; -}; - - -static ADDRESS_MAP_START(seattle_mem, AS_PROGRAM, 16, seattle_comp_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0xff7ff) AM_RAM - AM_RANGE(0xff800,0xfffff) AM_ROM AM_REGION("user1", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(seattle_io, AS_IO, 16, seattle_comp_state) - //ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf6,0xf7) AM_READWRITE(read, write) - //AM_RANGE(0xf0, 0xf1) 8259_0 - //AM_RANGE(0xf2, 0xf3) 8259_1 - //AM_RANGE(0xf4, 0xf5) AM9513 - //AM_RANGE(0xf6, 0xf7) 8251 - //AM_RANGE(0xfc, 0xfd) Parallel data, status, serial DCD - //AM_RANGE(0xfe, 0xff) Eprom disable bit, read sense switches (bank of 8 dipswitches) -ADDRESS_MAP_END - -READ16_MEMBER( seattle_comp_state::read ) -{ - UINT16 status = (m_key_available) ? 0x300 : 0x100; - m_key_available = 0; - return m_term_data | status; -} - -WRITE16_MEMBER( seattle_comp_state::write ) -{ - m_terminal->write(space, 0, data&0x7f); -} - -/* Input ports */ -static INPUT_PORTS_START( seattle ) -INPUT_PORTS_END - - -void seattle_comp_state::machine_reset() -{ - m_key_available = 0; - m_term_data = 0; -} - -WRITE8_MEMBER( seattle_comp_state::kbd_put ) -{ - m_term_data = data; - m_key_available = 1; -} - -static MACHINE_CONFIG_START( seattle, seattle_comp_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8086, 4000000) // no idea - MCFG_CPU_PROGRAM_MAP(seattle_mem) - MCFG_CPU_IO_MAP(seattle_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(seattle_comp_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( seattle ) - ROM_REGION( 0x800, "user1", 0 ) - ROM_LOAD( "mon86 v1.5tdd", 0x0000, 0x0800, CRC(7db23169) SHA1(c791b02ca33a4e1f8e95eb541624a59738f378c4)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1986, seattle, 0, 0, seattle, seattle, driver_device, 0, "Seattle Computer", "SCP-300F", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/segapico.c b/src/mess/drivers/segapico.c deleted file mode 100644 index 8cf04bc03a5..00000000000 --- a/src/mess/drivers/segapico.c +++ /dev/null @@ -1,626 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Emmanuel Vadot - -/****************************************** PICO emulation ****************************************/ - -/* todo, make this more independent of the Genesis emulation, it's really only the same CPU + VDP - and doesn't need to be connected to the Genesis at all. - - sound is the 315-5641 / D77591, should be compatible with the 7759? but probably wants us to maintain - an external buffer of at least 0x40 bytes and feed it on a timer in sync with the timer in the chip? - - currently no way to select (or display) the story book area of the games? (will require layout and - external artwork) - -*/ - - -/* - -Pico mainboard (PAL version) - -+---+ +-------------------------------------------------------------------------+ -| | | +-+ | -| | | +--+ |B| +-+ | -| | | |A3| +-+ | | | -| +------------------------------+ +--+ |C| +-| -| | | | | -| GCMK-C2X +-+ | --> PEN -| +-----+ +--+ +-| -| | | |A3| +--------+ | -| | A1 | +--+ | | +---------+ | -| SEGA | | | A2 | |HM53861J | | -| 1994 837-10846 +-----+ | | | | | -| IAC MAIN PAL +--------+ +---------+ | -| MADE IN JAPAN +----+ | -| VA0 +----------+ |XTAL| +--+ -| | SEGA | +---------+ | | | <-- VCC IN -| | 315-5640 | |MC68HC000| |53.2| +--+ -| | 9434 W51 | |FN8-A | +----+ |00 | +----------+ | -| | | | | | | +----+ | SEGA | | -| | | | 2B89N | | | | 315-5313A| | -| | | |S0AH9425A| | A4 | | F1001 | +--| -| +----------+ +---------+ | | | | | | -| | | |9428 LAGG | | --> VIDEO OUT -| | | | | | | -| +----+ +----------+ +--| -| | -| +----------------------------+ | -| ||||||CARTRIDGE CONNECTOR||||| | -| +----------------------------+ | -| | -+------------------------------------------------------------------------------------------------------------+ - -A1 = SEGA / 315-5641 / D77591 / 9442CA010 -A2 = SEGA / 315-5769 U13 / 9451MD020 -A3 = BA10324AF -A4 = MALAYSIA 9336 / 651632DFP-15 / 0000988S -B = 4K16 / HC00 -C = MB3514 / 9325 M36 - - -315-5640 - touchpad controller? -315-5313A - VDP -315-5641 - PCM chip - - -*/ - -/* - Pico Implementation By ElBarto (Emmanuel Vadot, elbarto@megadrive.org) - Still missing the PCM custom chip - Some game will not boot due to this - - Pico Info from Notaz (http://notaz.gp2x.de/docs/picodoc.txt) - - addr acc description --------+-----+------------ -800001 byte Version register. - ?vv? ????, where v can be: - 00 - hardware is for Japan - 01 - European version - 10 - USA version - 11 - ? -800003 byte Buttons, 0 for pressed, 1 for released: - bit 0: UP (white) - bit 1: DOWN (orange) - bit 2: LEFT (blue) - bit 3: RIGHT (green) - bit 4: red button - bit 5: unused? - bit 6: unused? - bit 7: pen button -800005 byte Most significant byte of pen x coordinate. -800007 byte Least significant byte of pen x coordinate. -800009 byte Most significant byte of pen y coordinate. -80000b byte Least significant byte of pen y coordinate. -80000d byte Page register. One bit means one uncovered page sensor. - 00 - storyware closed - 01, 03, 07, 0f, 1f, 3f - pages 1-6 - either page 5 or page 6 is often unused. -800010 word PCM data register. - r/w read returns free bytes left in PCM FIFO buffer - writes write data to buffer. -800012 word PCM control register. - r/w For writes, it has following possible meanings: - ?p?? ???? ???? ?rrr - p - set to enable playback? - r - sample rate / PCM data type? - 0: 8kHz 4bit ADPCM? - 1-7: 16kHz variants? - For reads, if bit 15 is cleared, it means PCM is 'busy' or - something like that, as games sometimes wait for it to become 1. -800019 byte Games write 'S' -80001b byte Games write 'E' -80001d byte Games write 'G' -80001f byte Games write 'A' - -*/ - -#include "emu.h" -#include "includes/md_cons.h" -#include "sound/315-5641.h" - - -#define PICO_PENX 1 -#define PICO_PENY 2 - -class pico_base_state : public md_cons_state -{ -public: - pico_base_state(const machine_config &mconfig, device_type type, const char *tag) - : md_cons_state(mconfig, type, tag), - m_sega_315_5641_pcm(*this, "315_5641"), - m_io_page(*this, "PAGE"), - m_io_pad(*this, "PAD"), - m_io_penx(*this, "PENX"), - m_io_peny(*this, "PENY") - { } - - optional_device m_sega_315_5641_pcm; - - required_ioport m_io_page; - required_ioport m_io_pad; - required_ioport m_io_penx; - required_ioport m_io_peny; - - UINT8 m_page_register; - - UINT16 pico_read_penpos(int pen); - DECLARE_READ16_MEMBER(pico_68k_io_read); - DECLARE_WRITE16_MEMBER(pico_68k_io_write); - DECLARE_WRITE_LINE_MEMBER(sound_cause_irq); - - DECLARE_DRIVER_INIT(pico); - DECLARE_DRIVER_INIT(picou); - DECLARE_DRIVER_INIT(picoj); -}; - -class pico_state : public pico_base_state -{ -public: - pico_state(const machine_config &mconfig, device_type type, const char *tag) - : pico_base_state(mconfig, type, tag), - m_picocart(*this, "picoslot") { } - - required_device m_picocart; - DECLARE_MACHINE_START(pico); -}; - - - -UINT16 pico_base_state::pico_read_penpos(int pen) -{ - UINT16 penpos = 0; - - switch (pen) - { - case PICO_PENX: - penpos = m_io_penx->read(); - penpos |= 0x6; - penpos = penpos * 320 / 255; - penpos += 0x3d; - break; - case PICO_PENY: - penpos = m_io_peny->read(); - penpos |= 0x6; - penpos = penpos * 251 / 255; - penpos += 0x1fc; - break; - } - - return penpos; -} - -READ16_MEMBER(pico_base_state::pico_68k_io_read ) -{ - UINT8 retdata = 0; - - switch (offset) - { - case 0: /* Version register ?XX?????? where XX is 00 for japan, 01 for europe and 10 for USA*/ - retdata = m_version_hi_nibble; - break; - case 1: - retdata = m_io_pad->read(); - break; - - /* - Still notes from notaz for the pen : - - The pen can be used to 'draw' either on the drawing pad or on the storyware - itself. Both storyware and drawing pad are mapped on single virtual plane, where - coordinates range: - - x: 0x03c - 0x17c - y: 0x1fc - 0x2f7 (drawing pad) - 0x2f8 - 0x3f3 (storyware) - */ - case 2: - retdata = pico_read_penpos(PICO_PENX) >> 8; - break; - case 3: - retdata = pico_read_penpos(PICO_PENX) & 0x00ff; - break; - case 4: - retdata = pico_read_penpos(PICO_PENY) >> 8; - break; - case 5: - retdata = pico_read_penpos(PICO_PENY) & 0x00ff; - break; - case 6: - /* Page register : - 00 - storyware closed - 01, 03, 07, 0f, 1f, 3f - pages 1-6 - either page 5 or page 6 is often unused. - */ - { - UINT8 tmp = m_io_page->read(); - if (tmp == 2 && m_page_register != 0x3f) - { - m_page_register <<= 1; - m_page_register |= 1; - } - if (tmp == 1 && m_page_register != 0x00) - m_page_register >>= 1; - retdata = m_page_register; - break; - } - - - - case 8: // toy story 2 checks this for 0x3f (is that 'empty'?) - /* Returns free bytes left in the PCM FIFO buffer */ - retdata = m_sega_315_5641_pcm->get_fifo_space(); - break; - case 9: - /* - For reads, if bit 15 is cleared, it means PCM is 'busy' or - something like that, as games sometimes wait for it to become 1. - */ - // return (m_upd7759->busy_r()^1) << 15; - // The BUSY bit stays 1 as long as some PCM sound is playing. - // SMPS drivers check 800012 [byte] and clear the "prevent music PCM" byte when the READY bit gets set. - // If this is done incorrectly, the voices in Sonic Gameworld (J) are muted by the music's PCM drums. - return m_sega_315_5641_pcm->busy_r() << 15; - - - case 7: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - logerror("pico_68k_io_read %d\n", offset); - - } - - return retdata | retdata << 8; -} - - -WRITE_LINE_MEMBER(pico_base_state::sound_cause_irq) -{ -// printf("sound irq\n"); - /* sega_315_5641_pcm callback */ - m_maincpu->set_input_line(3, HOLD_LINE); -} - -WRITE16_MEMBER(pico_base_state::pico_68k_io_write ) -{ -// printf("pico_68k_io_write %04x %04x %04x\n", offset*2, data, mem_mask); - - switch (offset) - { - case 0x10/2: - if (mem_mask & 0xFF00) - m_sega_315_5641_pcm->port_w(space, 0, (data >> 8) & 0xFF); - if (mem_mask & 0x00FF) - m_sega_315_5641_pcm->port_w(space, 0, (data >> 0) & 0xFF); - break; - case 0x12/2: // guess - // Note about uPD7759 lines: - // reset line: 1 - normal, 1->0 - reset chip, 0 - playback disabled - // start line: 0->1 - start playback - if (mem_mask & 0xFF00) - { - // I assume that: - // value 8000 resets the FIFO? (always used with low reset line) - // value 0800 maps to the uPD7759's reset line (0 = reset, 1 = normal) - // value 4000 maps to the uPD7759's start line (0->1 = start) - m_sega_315_5641_pcm->reset_w((data >> 8) & 0x08); - m_sega_315_5641_pcm->start_w((data >> 8) & 0x40); - if (data & 0x4000) - { - // Somewhere between "Reset Off" and the first sample data, - // we need to send a few commands to make the sample stream work. - // Doing that when rising the "start" line seems to work fine. - m_sega_315_5641_pcm->port_w(space, 0, 0xFF); // "Last Sample" value (must be >= 0x10) - m_sega_315_5641_pcm->port_w(space, 0, 0x00); // Dummy 1 - m_sega_315_5641_pcm->port_w(space, 0, 0x00); // Addr MSB - m_sega_315_5641_pcm->port_w(space, 0, 0x00); // Addr LSB - } - } - - - /*m_sega_315_5641_pcm->reset_w(0); - m_sega_315_5641_pcm->start_w(0); - m_sega_315_5641_pcm->reset_w(1); - m_sega_315_5641_pcm->start_w(1); - - if (mem_mask&0x00ff) m_sega_315_5641_pcm->port_w(space,0,data&0xff); - if (mem_mask&0xff00) m_sega_315_5641_pcm->port_w(space,0,(data>>8)&0xff);*/ - - break; - } -} - -static ADDRESS_MAP_START( pico_mem, AS_PROGRAM, 16, pico_base_state ) - AM_RANGE(0x000000, 0x3fffff) AM_ROM - - AM_RANGE(0x800000, 0x80001f) AM_READWRITE(pico_68k_io_read, pico_68k_io_write) - - AM_RANGE(0xc00000, 0xc0001f) AM_DEVREADWRITE("gen_vdp", sega315_5313_device, vdp_r, vdp_w) - AM_RANGE(0xe00000, 0xe0ffff) AM_RAM AM_MIRROR(0x1f0000) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( pico ) - PORT_START("PAD") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Red Button") - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Pen Button") - - PORT_START("PAGE") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Increment Page") - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Decrement Page") - - PORT_START("PENX") - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_MINMAX(0, 255) PORT_PLAYER(1) PORT_NAME("PEN X") - - PORT_START("PENY") - PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_MINMAX(0,255 ) PORT_PLAYER(1) PORT_NAME("PEN Y") -INPUT_PORTS_END - - -static SLOT_INTERFACE_START(pico_cart) - SLOT_INTERFACE_INTERNAL("rom", MD_STD_ROM) - SLOT_INTERFACE_INTERNAL("rom_sram", MD_ROM_SRAM) // not sure these are needed... - SLOT_INTERFACE_INTERNAL("rom_sramsafe", MD_ROM_SRAM) // not sure these are needed... -SLOT_INTERFACE_END - -MACHINE_START_MEMBER(pico_state,pico) -{ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_picocart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_picocart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_picocart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)m_picocart)); - - m_vdp->stop_timers(); -} - -static MACHINE_CONFIG_START( pico, pico_state ) - MCFG_FRAGMENT_ADD( md_ntsc ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pico_mem) - - MCFG_DEVICE_REMOVE("genesis_snd_z80") - MCFG_DEVICE_REMOVE("ymsnd") - - MCFG_MACHINE_START_OVERRIDE( pico_state, pico ) - MCFG_MACHINE_RESET_OVERRIDE( pico_base_state, ms_megadriv ) - - MCFG_PICO_CARTRIDGE_ADD("picoslot", pico_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","pico") - - MCFG_SOUND_ADD("315_5641", SEGA_315_5641_PCM, UPD7759_STANDARD_CLOCK*2) - MCFG_UPD7759_DRQ_CALLBACK(WRITELINE(pico_state,sound_cause_irq)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.16) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.16) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( picopal, pico_state ) - MCFG_FRAGMENT_ADD( md_pal ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pico_mem) - - MCFG_DEVICE_REMOVE("genesis_snd_z80") - MCFG_DEVICE_REMOVE("ymsnd") - - MCFG_MACHINE_START_OVERRIDE( pico_state, pico ) - MCFG_MACHINE_RESET_OVERRIDE( pico_base_state, ms_megadriv ) - - MCFG_PICO_CARTRIDGE_ADD("picoslot", pico_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","pico") - - MCFG_SOUND_ADD("315_5641", SEGA_315_5641_PCM, UPD7759_STANDARD_CLOCK*2) - MCFG_UPD7759_DRQ_CALLBACK(WRITELINE(pico_state,sound_cause_irq)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.16) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.16) -MACHINE_CONFIG_END - - - -ROM_START( pico ) - ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) - ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) -ROM_END - -ROM_START( picou ) - ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) - ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) -ROM_END - -ROM_START( picoj ) - ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) - ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) -ROM_END - - -DRIVER_INIT_MEMBER(pico_base_state, pico) -{ - DRIVER_INIT_CALL(megadrie); - DRIVER_INIT_CALL(mess_md_common); - - m_version_hi_nibble = 0x60; // Export PAL -} - -DRIVER_INIT_MEMBER(pico_base_state, picou) -{ - DRIVER_INIT_CALL(megadriv); - DRIVER_INIT_CALL(mess_md_common); - - m_version_hi_nibble = 0x40; // Export NTSC -} - -DRIVER_INIT_MEMBER(pico_base_state, picoj) -{ - DRIVER_INIT_CALL(megadrij); - DRIVER_INIT_CALL(mess_md_common); - - m_version_hi_nibble = 0x00; // JPN NTSC -} - - -CONS( 1994, pico, 0, 0, picopal, pico, pico_base_state, pico, "Sega", "Pico (Europe, PAL)", MACHINE_NOT_WORKING) -CONS( 1994, picou, pico, 0, pico, pico, pico_base_state, picou, "Sega", "Pico (USA, NTSC)", MACHINE_NOT_WORKING) -CONS( 1993, picoj, pico, 0, pico, pico, pico_base_state, picoj, "Sega", "Pico (Japan, NTSC)", MACHINE_NOT_WORKING) - -/* - -This looks a lot like a Pico with extra sound hardware... - YMZ263B is the basis of a Sound Blaster Clone - YMF262-M is the OPL3 - -YAMAHA - MIXT BOOK PLAYER COPERA -MMG-1 - - - +-------------+ - | | - |------+ | - | | | - MIDI OUT <-- | | - | | | - |------+ | - | | +------------------------------------------------------------------------------------------------------+ - |------+ | | +--+ | - | | | | |YM| | - MIDI IN <-- | | | |7 | | - | | | | |12| +---------+ | - |------+ +--+ | +------+ |8B| | YAMAHA | | - | |||| | | +--+ | YMZ263B | | - +---------||--+ | +--------+ | | | - || | |YM7 128B| +---------+ +---+ | - || | +--------+ |YMF| | - +---------||----------+ |262| | - | || |-M | | - | || +---+ | - | || | - | || SEGA | - |------+ || 1993 837-9845 COPERA | - | | || MADE IN JAPAN +--| - | | || VA0 | --> PEN - CONTROL <-- | || | | - | | || +--| - | | || | - | | || | - |------+ || +----+ | - | || |XTAL| +------------+ | - | || | | | OKI JAPAN | +----+ - | || +----------+ |53.6| | M54C864-80 | | | - | |||| | SEGA | |93 | +------------+ | | - | +--+ | 315-5639 | | Mhz| | | - | | U11| +----+ +-------------+ | E | - | |9341PD025 | | | | X | - |--+ +----------+ | SEGA | | T | - MIC <-- | +----+ +----+ | 315-5313A | | E | - | | |TC51| |TC51| | FC1001 | | N | - |--+ |832A| |832A| | 9331 AASG | | D | - | |FL-1| |FL-1| | | | E | - | |0 | |0 | | | | D | - | | | | | | | | | - |--+ +----+ +----+ +-------------+ | | - +-- | | C | - | |--+ | O | -S-AUDIO <-| | +-----------+ +-------+ | N | - | |--+ | SEGA | | SEGA | +-----------+ | N | - +-- | | 315-5640 | |315-564| | 3D4 UA | | E | - |--+ | 9333 W26 | |1 | |HD68HC000CP| | C | - | | | |D77591 | |8 | | T | - |--+ | | +-------+ | | | O | - S-VIDEO <-- | | | | | | R | - |--+ | | | | | | - | +-----------+ | JAPAN| | | - | +-----------+ | | - |--+ | | - VCC --> | +----------------------------------------------+ | | - |--+ | CARTRIDGE | +----+ - | | CONNECTOR | | - | +----------------------------------------------+ | - +-----------------------------------------------------------------------------------------------------------------------------------+ - -*/ - - - -class copera_state : public pico_base_state -{ -public: - copera_state(const machine_config &mconfig, device_type type, const char *tag) - : pico_base_state(mconfig, type, tag), - m_picocart(*this, "coperaslot") { } - - required_device m_picocart; - DECLARE_MACHINE_START(copera); -}; - - - -static ADDRESS_MAP_START( copera_mem, AS_PROGRAM, 16, copera_state ) - AM_RANGE(0x000000, 0x3fffff) AM_ROM - - AM_RANGE(0x800000, 0x80001f) AM_READWRITE(pico_68k_io_read, pico_68k_io_write) - - AM_RANGE(0xc00000, 0xc0001f) AM_DEVREADWRITE("gen_vdp", sega315_5313_device, vdp_r, vdp_w) - - AM_RANGE(0xe00000, 0xe0ffff) AM_RAM AM_MIRROR(0x1f0000) -ADDRESS_MAP_END - - - -static SLOT_INTERFACE_START(copera_cart) - SLOT_INTERFACE_INTERNAL("rom", MD_STD_ROM) - SLOT_INTERFACE_INTERNAL("rom_sram", MD_ROM_SRAM) // not sure these are needed... - SLOT_INTERFACE_INTERNAL("rom_sramsafe", MD_ROM_SRAM) // not sure these are needed... -SLOT_INTERFACE_END - -MACHINE_START_MEMBER(copera_state,copera) -{ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_picocart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_picocart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_picocart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)m_picocart)); - - m_sega_315_5641_pcm->reset_w(0); - m_sega_315_5641_pcm->start_w(0); - m_sega_315_5641_pcm->reset_w(1); - m_sega_315_5641_pcm->start_w(1); - -} - -static MACHINE_CONFIG_START( copera, copera_state ) - MCFG_FRAGMENT_ADD( md_ntsc ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(copera_mem) - - MCFG_DEVICE_REMOVE("genesis_snd_z80") - MCFG_DEVICE_REMOVE("ymsnd") - - MCFG_MACHINE_START_OVERRIDE( copera_state, copera ) - MCFG_MACHINE_RESET_OVERRIDE( pico_base_state, ms_megadriv ) - - MCFG_COPERA_CARTRIDGE_ADD("coperaslot", copera_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","copera") - - MCFG_SOUND_ADD("315_5641", SEGA_315_5641_PCM, UPD7759_STANDARD_CLOCK) - MCFG_UPD7759_DRQ_CALLBACK(WRITELINE(copera_state,sound_cause_irq)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.16) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.16) -MACHINE_CONFIG_END - - - -ROM_START( copera ) - ROM_REGION(MD_CPU_REGION_SIZE, "maincpu", ROMREGION_ERASEFF) - ROM_REGION( 0x10000, "soundcpu", ROMREGION_ERASEFF) -ROM_END - -CONS( 1993, copera, 0, 0, copera, pico, pico_base_state, picoj, "Yamaha / Sega", "Yamaha Mixt Book Player Copera", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/segapm.c b/src/mess/drivers/segapm.c deleted file mode 100644 index 34d7488e8b3..00000000000 --- a/src/mess/drivers/segapm.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Sega Picture Magic (codename JANUS) */ -// http://segaretro.org/Sega_Picture_Magic - -// this uses a Sega 32X PCB (not in a 32X case) attached to a stripped down 68k based board rather than a full Genesis / Megadrive -// it is likely the internal SH2 bios roms differ - - -#include "emu.h" -#include "cpu/m68000/m68000.h" - - -class segapm_state : public driver_device -{ -public: - segapm_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - virtual void video_start(); - UINT32 screen_update_segapm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -void segapm_state::video_start() -{ -} - -UINT32 segapm_state::screen_update_segapm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - - -static ADDRESS_MAP_START( segapm_map, AS_PROGRAM, 16, segapm_state ) - AM_RANGE(0x000000, 0x07ffff) AM_ROM - - // A15100 - - AM_RANGE(0xe00000, 0xe7ffff) AM_RAM - -ADDRESS_MAP_END - -static INPUT_PORTS_START( segapm ) -INPUT_PORTS_END - - - - -static MACHINE_CONFIG_START( segapm, segapm_state ) - - MCFG_CPU_ADD("maincpu", M68000, 8000000) // ?? - MCFG_CPU_PROGRAM_MAP(segapm_map) - - // + 2 sh2s on 32x board - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(segapm_state, screen_update_segapm) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 0x200) - MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) -MACHINE_CONFIG_END - - - -ROM_START( segapm ) // was more than one cartridge available? if so softlist them? - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD( "picture magic boot cart (j) [!].bin", 0x00000, 0x80000, CRC(c9ab4e60) SHA1(9c4d4ab3e59c8acde86049a1ba3787aa03b549a3) ) // internal header is GOUSEI HENSYUU - - // todo, sh2 bios roms etc. -ROM_END - -GAME( 1996, segapm, 0, segapm, segapm, driver_device, 0, ROT0, "Sega", "Picture Magic", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/selz80.c b/src/mess/drivers/selz80.c deleted file mode 100644 index 62a2692f574..00000000000 --- a/src/mess/drivers/selz80.c +++ /dev/null @@ -1,202 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - SEL Z80 Trainer (LEHRSYSTEME) - - 31/08/2010 Skeleton driver. - 23/06/2011 Working [Robbbert] - -No diagram has been found. The following is guesswork. - -Test sequence: Press -, enter an address, press = to show contents, press - up/down-arrow to cycle through addresses. - -ToDo: -- Artwork -- Various missing LEDs and switches -- Keys are a guess, need to be confirmed. -- Needs to be tested by a subject-matter expert. - -- Unknown I/O: -'maincpu' (00F2): unmapped i/o memory write to 000C = 00 & FF -'maincpu' (00F8): unmapped i/o memory write to 0010 = FF & FF -'maincpu' (0122): unmapped i/o memory write to 0019 = 91 & FF -'maincpu' (0122): unmapped i/o memory write to 0019 = 40 & FF -'maincpu' (0122): unmapped i/o memory write to 0019 = CE & FF -'maincpu' (0122): unmapped i/o memory write to 0019 = 17 & FF - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8279.h" -#include "selz80.lh" - - -class selz80_state : public driver_device -{ -public: - selz80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_p_ram(*this, "ram") - { } - - DECLARE_WRITE8_MEMBER(scanlines_w); - DECLARE_WRITE8_MEMBER(digit_w); - DECLARE_READ8_MEMBER(kbd_r); - DECLARE_MACHINE_RESET(dagz80); - UINT8 m_digit; - required_device m_maincpu; - optional_shared_ptr m_p_ram; -}; - -static ADDRESS_MAP_START(dagz80_mem, AS_PROGRAM, 8, selz80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("ram") - AM_RANGE(0xe000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(selz80_mem, AS_PROGRAM, 8, selz80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0x1fff) AM_RAM - AM_RANGE(0xa000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(selz80_io, AS_IO, 8, selz80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w ) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( selz80 ) -/* 2 x 16-key pads -RS SS RN MM C(IS) D(FL) E(FL') F -EX BP TW TR 8(IX) 9(IY) A(PC) B(SP) -RL IN - + 4(AF') 5(BC') 6(DE') 7(HL') -RG EN SA SD 0(AF) 1(BC) 2(DE) 3(HL) - */ - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E FL'") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D FL") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C IS") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RN") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SS") PORT_CODE(KEYCODE_R) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RS") PORT_CODE(KEYCODE_T) - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B SP") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A PC") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 IY") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IX") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TR (tape read)") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TW (tape write)") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BP") PORT_CODE(KEYCODE_I) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EX") PORT_CODE(KEYCODE_O) - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 HL'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 DE'") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 BC'") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 AF'") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("IN") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RL") PORT_CODE(KEYCODE_G) - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 HL") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 DE") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 BC") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 AF") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SD") PORT_CODE(KEYCODE_H) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EN") PORT_CODE(KEYCODE_K) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RG") PORT_CODE(KEYCODE_L) -INPUT_PORTS_END - - -MACHINE_RESET_MEMBER(selz80_state, dagz80) -{ - UINT8* rom = memregion("user1")->base(); - UINT16 size = memregion("user1")->bytes(); - memcpy(m_p_ram, rom, size); - m_maincpu->reset(); -} - -WRITE8_MEMBER( selz80_state::scanlines_w ) -{ - m_digit = data; -} - -WRITE8_MEMBER( selz80_state::digit_w ) -{ - output_set_digit_value(m_digit, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4)); -} - -READ8_MEMBER( selz80_state::kbd_r ) -{ - UINT8 data = 0xff; - - if (m_digit < 4) - { - char kbdrow[6]; - sprintf(kbdrow,"X%X",m_digit); - data = ioport(kbdrow)->read(); - } - return data; -} - -static MACHINE_CONFIG_START( selz80, selz80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(selz80_mem) - MCFG_CPU_IO_MAP(selz80_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_selz80) - - /* Devices */ - MCFG_DEVICE_ADD("i8279", I8279, 2500000) // based on divider - MCFG_I8279_OUT_SL_CB(WRITE8(selz80_state, scanlines_w)) // scan SL lines - MCFG_I8279_OUT_DISP_CB(WRITE8(selz80_state, digit_w)) // display A&B - MCFG_I8279_IN_RL_CB(READ8(selz80_state, kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key - MCFG_I8279_IN_CTRL_CB(VCC) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( dagz80, selz80 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(dagz80_mem) - MCFG_MACHINE_RESET_OVERRIDE(selz80_state, dagz80 ) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( selz80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v3.3", "V3.3") - ROMX_LOAD( "z80-trainer.rom", 0x0000, 0x1000, CRC(eed1755f) SHA1(72e6ebfccb0e50034660bc36db1a741932311ce1), ROM_BIOS(1)) // (c)TEL86/V3.3 - ROM_SYSTEM_BIOS(1, "v3.2", "V3.2") - ROMX_LOAD( "moniz80_3.2_04.12.1985.bin", 0x0000, 0x1000, CRC(3a3cf574) SHA1(ba6cd2276ce66f3a4545baf4d396f6c06d51dc38), ROM_BIOS(2)) // (c)SEL85/V3.2 - ROM_LOAD( "term80-a000.bin", 0xa000, 0x2000, CRC(0a58c0a7) SHA1(d1b4b3b2ad0d084175b1ff6966653d8b20025252)) - ROM_LOAD( "term80-e000.bin", 0xe000, 0x2000, CRC(158e08e6) SHA1(f1add43bcf8744a01238fb893ee284872d434db5)) -ROM_END - -ROM_START( dagz80 ) - ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "moni_1.5_15.08.1988.bin", 0x0000, 0x2000, CRC(318aee6e) SHA1(c698fdee401b88e673791aabcba6a9628938a075) ) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS, INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, selz80, 0, 0, selz80, selz80, driver_device, 0, "SEL", "SEL Z80 Trainer", MACHINE_NO_SOUND_HW) -COMP( 1988, dagz80, selz80, 0, dagz80, selz80, driver_device, 0, "DAG", "DAG Z80 Trainer", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/sg1000.c b/src/mess/drivers/sg1000.c deleted file mode 100644 index 4c5c7025d75..00000000000 --- a/src/mess/drivers/sg1000.c +++ /dev/null @@ -1,915 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Sega SG-1000 - -PCB Layout ----------- - -171-5078 (C) SEGA 1983 -171-5046 REV. A (C) SEGA 1983 - -|---------------------------| |----------------------------| -| SW1 CN2 | |------|---------------| | SW2 CN4 | -| |---| CN3 |---| | -| CN1 CN5 | -| | -| 10.738635MHz |------------------------------| 7805 | -| |---| |------------------------------| | -| | | CN6 | -| | 9 | | -| | 9 | LS32 | -| | 1 | |---------| | -| | 8 | | TMM2009 | LS139 | -| | A | |---------| |------------------| | -| | | | Z80 | | -| |---| |------------------| | -| | -| | -| MB8118 MB8118 MB8118 MB8118 SN76489A SW3 | -| MB8118 MB8118 MB8118 MB8118 LS257 LS257 | -|---------------------------------------------------------------------------------------| - -Notes: - All IC's shown. - - Z80 - NEC D780C-1 / Zilog Z8400A (REV.A) Z80A CPU @ 3.579545 - TMS9918A- Texas Instruments TMS9918ANL Video Display Processor @ 10.738635MHz - MB8118 - Fujitsu MB8118-12 16K x 1 Dynamic RAM - TMM2009 - Toshiba TMM2009P-A / TMM2009P-B (REV.A) - SN76489A- Texas Instruments SN76489AN Digital Complex Sound Generator @ 3.579545 - CN1 - player 1 joystick connector - CN2 - RF video connector - CN3 - keyboard connector - CN4 - power connector (+9VDC) - CN5 - player 2 joystick connector - CN6 - cartridge connector - SW1 - TV channel select switch - SW2 - power switch - SW3 - hold switch - -*/ - -/* - - TODO: - - - SC-3000 return instruction referenced by R when reading ports 60-7f,e0-ff - - connect PSG /READY signal to Z80 WAIT - - accurate video timing - - SP-400 serial printer - - SH-400 racing controller - - SF-7000 serial comms - -*/ - - -#include "includes/sg1000.h" -#include "bus/rs232/rs232.h" - - -/*************************************************************************** - READ/WRITE HANDLERS -***************************************************************************/ - -// TODO: not sure if the OMV bios actually detects the presence of a cart, -// or if the cart data simply overwrites the internal bios... -// for the moment let assume the latter! -READ8_MEMBER( sg1000_state::omv_r ) -{ - if (m_cart && m_cart->exists()) - return m_cart->read_cart(space, offset); - else - return m_rom->base()[offset]; -} - -WRITE8_MEMBER( sg1000_state::omv_w ) -{ - if (m_cart && m_cart->exists()) - m_cart->write_cart(space, offset, data); -} - -/*------------------------------------------------- - joysel_r - --------------------------------------------------*/ - -READ8_MEMBER( sg1000_state::joysel_r ) -{ - return 0x80; -} - -/*------------------------------------------------- - ADDRESS_MAP( sg1000_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( sg1000_map, AS_PROGRAM, 8, sg1000_state ) - AM_RANGE(0x0000, 0xbfff) AM_DEVREADWRITE(CARTSLOT_TAG, sega8_cart_slot_device, read_cart, write_cart) - AM_RANGE(0xc000, 0xc3ff) AM_MIRROR(0x3c00) AM_RAM -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( sg1000_io_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( sg1000_io_map, AS_IO, 8, sg1000_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) - AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) - AM_RANGE(0xdc, 0xdc) AM_READ_PORT("PA7") - AM_RANGE(0xdd, 0xdd) AM_READ_PORT("PB7") - AM_RANGE(0xde, 0xde) AM_READ(joysel_r) AM_WRITENOP - AM_RANGE(0xdf, 0xdf) AM_NOP -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( omv_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( omv_map, AS_PROGRAM, 8, sg1000_state ) - AM_RANGE(0x0000, 0xbfff) AM_READWRITE(omv_r, omv_w) - AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3800) AM_RAM -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( omv_io_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( omv_io_map, AS_IO, 8, sg1000_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) - AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x38) AM_READ_PORT("C0") - AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x38) AM_READ_PORT("C1") - AM_RANGE(0xc2, 0xc2) AM_MIRROR(0x38) AM_READ_PORT("C2") - AM_RANGE(0xc3, 0xc3) AM_MIRROR(0x38) AM_READ_PORT("C3") - AM_RANGE(0xc4, 0xc4) AM_MIRROR(0x3a) AM_READ_PORT("C4") - AM_RANGE(0xc5, 0xc5) AM_MIRROR(0x3a) AM_READ_PORT("C5") -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( sc3000_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( sc3000_map, AS_PROGRAM, 8, sg1000_state ) - AM_RANGE(0x0000, 0xbfff) AM_DEVREADWRITE(CARTSLOT_TAG, sega8_cart_slot_device, read_cart, write_cart) - AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3800) AM_RAM -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( sc3000_io_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( sc3000_io_map, AS_IO, 8, sg1000_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) - AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) - AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write) -ADDRESS_MAP_END - -/* This is how the I/O ports are really mapped, but MAME does not support overlapping ranges -static ADDRESS_MAP_START( sc3000_io_map, AS_IO, 8, sg1000_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write) - AM_RANGE(0x00, 0x00) AM_MIRROR(0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) - AM_RANGE(0x01, 0x01) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) - AM_RANGE(0x60, 0x60) AM_MIRROR(0x9f) AM_READ(sc3000_r_r) -ADDRESS_MAP_END -*/ - -/*------------------------------------------------- - ADDRESS_MAP( sf7000_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( sf7000_map, AS_PROGRAM, 8, sf7000_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") - AM_RANGE(0x4000, 0xffff) AM_RAM -ADDRESS_MAP_END - -/*------------------------------------------------- - ADDRESS_MAP( sf7000_io_map ) --------------------------------------------------*/ - -static ADDRESS_MAP_START( sf7000_io_map, AS_IO, 8, sf7000_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write) - AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write) - AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write) - AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_0_TAG, i8255_device, read, write) - AM_RANGE(0xe0, 0xe1) AM_DEVICE(UPD765_TAG, upd765a_device, map) - AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE(UPD9255_1_TAG, i8255_device, read, write) - AM_RANGE(0xe8, 0xe8) AM_DEVREADWRITE(UPD8251_TAG, i8251_device, data_r, data_w) - AM_RANGE(0xe9, 0xe9) AM_DEVREADWRITE(UPD8251_TAG, i8251_device, status_r, control_w) -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/*------------------------------------------------- - INPUT_CHANGED_MEMBER( trigger_nmi ) --------------------------------------------------*/ - -INPUT_CHANGED_MEMBER( sg1000_state::trigger_nmi ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - -/*------------------------------------------------- - INPUT_PORTS( sg1000 ) --------------------------------------------------*/ - -static INPUT_PORTS_START( sg1000 ) - PORT_START("PA7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - - PORT_START("PB7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("NMI") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_P) PORT_CHANGED_MEMBER(DEVICE_SELF, sg1000_state, trigger_nmi, 0) -INPUT_PORTS_END - -/*------------------------------------------------- - INPUT_PORTS( omv ) --------------------------------------------------*/ - -static INPUT_PORTS_START( omv ) - PORT_START("C0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("C1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 #") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 *") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("C2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("C3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("C4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("S-1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("S-2") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - - PORT_START("C5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -/*------------------------------------------------- - INPUT_PORTS( sk1100 ) --------------------------------------------------*/ - -INPUT_PORTS_START( sk1100 ) - PORT_START("PA0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENG DIER'S") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - - PORT_START("PA1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - - PORT_START("PA2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - - PORT_START("PA3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_SMALL_PI) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x03c0) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') - - PORT_START("PA4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - - PORT_START("PA5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PA7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - - PORT_START("PB0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('^') - PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PB5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xa5") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x00a5) - PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNC") PORT_CODE(KEYCODE_TAB) - - PORT_START("PB6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("PB7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - - PORT_START("NMI") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, sg1000_state, trigger_nmi, 0) -INPUT_PORTS_END - -/*------------------------------------------------- - INPUT_PORTS( sc3000 ) --------------------------------------------------*/ - -static INPUT_PORTS_START( sc3000 ) - PORT_INCLUDE( sk1100 ) -INPUT_PORTS_END - -/*------------------------------------------------- - INPUT_PORTS( sf7000 ) --------------------------------------------------*/ - -static INPUT_PORTS_START( sf7000 ) - PORT_INCLUDE( sk1100 ) - - PORT_START("BAUD") - PORT_CONFNAME( 0x07, 0x05, "Baud rate") - PORT_CONFSETTING( 0x00, "9600 baud" ) - PORT_CONFSETTING( 0x01, "4800 baud" ) - PORT_CONFSETTING( 0x02, "2400 baud" ) - PORT_CONFSETTING( 0x03, "1200 baud" ) - PORT_CONFSETTING( 0x04, "600 baud" ) - PORT_CONFSETTING( 0x05, "300 baud" ) -INPUT_PORTS_END - -/*************************************************************************** - DEVICE CONFIGURATION -***************************************************************************/ - -/*------------------------------------------------- - TMS9928a_interface tms9928a_interface --------------------------------------------------*/ - -WRITE_LINE_MEMBER(sg1000_state::sg1000_vdp_interrupt) -{ - m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); -} - -/*------------------------------------------------- - I8255 INTERFACE --------------------------------------------------*/ - -READ8_MEMBER( sc3000_state::ppi_pa_r ) -{ - /* - Signal Description - - PA0 Keyboard input - PA1 Keyboard input - PA2 Keyboard input - PA3 Keyboard input - PA4 Keyboard input - PA5 Keyboard input - PA6 Keyboard input - PA7 Keyboard input - */ - - return m_key_row[m_keylatch]->read(); -} - -READ8_MEMBER( sc3000_state::ppi_pb_r ) -{ - /* - Signal Description - - PB0 Keyboard input - PB1 Keyboard input - PB2 Keyboard input - PB3 Keyboard input - PB4 /CONT input from cartridge terminal B-11 - PB5 FAULT input from printer - PB6 BUSY input from printer - PB7 Cassette tape input - */ - - /* keyboard */ - UINT8 data = m_key_row[m_keylatch + 8]->read(); - - /* cartridge contact */ - data |= 0x10; - - /* printer */ - data |= 0x60; - - /* tape input */ - if (m_cassette->input() > +0.0) data |= 0x80; - - return data; -} - -WRITE8_MEMBER( sc3000_state::ppi_pc_w ) -{ - /* - Signal Description - - PC0 Keyboard raster output - PC1 Keyboard raster output - PC2 Keyboard raster output - PC3 not connected - PC4 Cassette tape output - PC5 DATA to printer - PC6 /RESET to printer - PC7 /FEED to printer - */ - - /* keyboard */ - m_keylatch = data & 0x07; - - /* cassette */ - m_cassette->output( BIT(data, 4) ? +1.0 : -1.0); - - /* TODO printer */ -} - -/*------------------------------------------------- - I8255 INTERFACE --------------------------------------------------*/ - -WRITE_LINE_MEMBER( sf7000_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -READ8_MEMBER( sf7000_state::ppi_pa_r ) -{ - /* - Signal Description - - PA0 INT from FDC - PA1 BUSY from Centronics printer - PA2 INDEX from FDD - PA3 - PA4 - PA5 - PA6 - PA7 - */ - - UINT8 data = 0; - - data |= m_fdc->get_irq() ? 0x01 : 0x00; - data |= m_centronics_busy << 1; - data |= m_floppy0->idx_r() << 2; - - return data; -} - -WRITE8_MEMBER( sf7000_state::ppi_pc_w ) -{ - /* - Signal Description - - PC0 /INUSE signal to FDD - PC1 /MOTOR ON signal to FDD - PC2 TC signal to FDC - PC3 RESET signal to FDC - PC4 not connected - PC5 not connected - PC6 /ROM SEL (switch between IPL ROM and RAM) - PC7 /STROBE to Centronics printer - */ - - if (!BIT(data, 0)) - m_fdc->set_floppy(m_floppy0); - else - m_fdc->set_floppy(NULL); - - /* floppy motor */ - m_floppy0->mon_w(BIT(data, 1)); - - /* FDC terminal count */ - m_fdc->tc_w(BIT(data, 2)); - - /* FDC reset */ - if (BIT(data, 3)) - { - m_fdc->reset(); - } - - /* ROM selection */ - membank("bank1")->set_entry(BIT(data, 6)); - - /* printer strobe */ - m_centronics->write_strobe(BIT(data, 7)); -} - -/*------------------------------------------------- - upd765_interface sf7000_upd765_interface --------------------------------------------------*/ - -FLOPPY_FORMATS_MEMBER( sf7000_state::floppy_formats ) - FLOPPY_SF7000_FORMAT -FLOPPY_FORMATS_END - -/*------------------------------------------------- - floppy_interface sf7000_floppy_interface --------------------------------------------------*/ - -static SLOT_INTERFACE_START( sf7000_floppies ) - SLOT_INTERFACE( "3ssdd", FLOPPY_3_SSDD ) -SLOT_INTERFACE_END - -/*------------------------------------------------- - MACHINE_START( sg1000 ) --------------------------------------------------*/ - -void sg1000_state::machine_start() -{ - if (m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(sega8_cart_slot_device::read_ram),(sega8_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, 0, 0, write8_delegate(FUNC(sega8_cart_slot_device::write_ram),(sega8_cart_slot_device*)m_cart)); - } - - if (m_cart) - m_cart->save_ram(); -} - -/*------------------------------------------------- - MACHINE_START( sc3000 ) --------------------------------------------------*/ - -void sc3000_state::machine_start() -{ - /* toggle light gun crosshair */ - timer_set(attotime::zero, TIMER_LIGHTGUN_TICK); - - // find keyboard rows - m_key_row[0] = m_pa0; - m_key_row[1] = m_pa1; - m_key_row[2] = m_pa2; - m_key_row[3] = m_pa3; - m_key_row[4] = m_pa4; - m_key_row[5] = m_pa5; - m_key_row[6] = m_pa6; - m_key_row[7] = m_pa7; - m_key_row[8] = m_pb0; - m_key_row[9] = m_pb1; - m_key_row[10] = m_pb2; - m_key_row[11] = m_pb3; - m_key_row[12] = m_pb4; - m_key_row[13] = m_pb5; - m_key_row[14] = m_pb6; - m_key_row[15] = m_pb7; - - /* register for state saving */ - save_item(NAME(m_keylatch)); - - if (m_cart && m_cart->exists() && (m_cart->get_type() == SEGA8_BASIC_L3 || m_cart->get_type() == SEGA8_MUSIC_EDITOR - || m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB)) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(sega8_cart_slot_device::read_ram),(sega8_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xc000, 0xffff, 0, 0, write8_delegate(FUNC(sega8_cart_slot_device::write_ram),(sega8_cart_slot_device*)m_cart)); - } - - if (m_cart) - m_cart->save_ram(); -} - - -/*------------------------------------------------- - MACHINE_START( sf7000 ) --------------------------------------------------*/ - -void sf7000_state::machine_start() -{ - sc3000_state::machine_start(); - - save_item(NAME(m_centronics_busy)); - - /* configure memory banking */ - membank("bank1")->configure_entry(0, m_rom->base()); - membank("bank1")->configure_entry(1, m_ram->pointer()); - membank("bank2")->configure_entry(0, m_ram->pointer()); -} - -void sf7000_state::machine_reset() -{ - membank("bank1")->set_entry(0); - membank("bank2")->set_entry(0); -} - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -/*------------------------------------------------- - MACHINE_CONFIG_START( sg1000, sg1000_state ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( sg1000, sg1000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) - MCFG_CPU_PROGRAM_MAP(sg1000_map) - MCFG_CPU_IO_MAP(sg1000_io_map) - - /* video hardware */ - MCFG_DEVICE_ADD( TMS9918A_TAG, TMS9918A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000_state, sg1000_vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TMS9918A_TAG, tms9918a_device, screen_update ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_10_738635MHz/3) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* cartridge */ - MCFG_SG1000_CARTRIDGE_ADD(CARTSLOT_TAG, sg1000_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","sg1000") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_CONFIG_DERIVED( omv, sg1000 ) --------------------------------------------------*/ - -static MACHINE_CONFIG_DERIVED( omv, sg1000 ) - MCFG_CPU_MODIFY(Z80_TAG) - MCFG_CPU_PROGRAM_MAP(omv_map) - MCFG_CPU_IO_MAP(omv_io_map) - - MCFG_DEVICE_REMOVE(CARTSLOT_TAG) - MCFG_OMV_CARTRIDGE_ADD(CARTSLOT_TAG, sg1000_cart, NULL) - - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2K") -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_CONFIG_START( sc3000, sc3000_state ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( sc3000, sc3000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) // LH0080A - MCFG_CPU_PROGRAM_MAP(sc3000_map) - MCFG_CPU_IO_MAP(sc3000_io_map) - - /* video hardware */ - MCFG_DEVICE_ADD( TMS9918A_TAG, TMS9918A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000_state, sg1000_vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TMS9918A_TAG, tms9918a_device, screen_update ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_10_738635MHz/3) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_DEVICE_ADD(UPD9255_TAG, I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(sc3000_state, ppi_pa_r)) - MCFG_I8255_IN_PORTB_CB(READ8(sc3000_state, ppi_pb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(sc3000_state, ppi_pc_w)) - -// MCFG_PRINTER_ADD("sp400") /* serial printer */ - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(sc3000_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("sc3000_cass") - - /* cartridge */ - MCFG_SC3000_CARTRIDGE_ADD(CARTSLOT_TAG, sg1000_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","sg1000") - MCFG_SOFTWARE_LIST_ADD("sc3k_cart_list","sc3000_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list","sc3000_cass") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2K") -MACHINE_CONFIG_END - -/*------------------------------------------------- - MACHINE_CONFIG_START( sf7000, sf7000_state ) --------------------------------------------------*/ - -static MACHINE_CONFIG_START( sf7000, sf7000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) - MCFG_CPU_PROGRAM_MAP(sf7000_map) - MCFG_CPU_IO_MAP(sf7000_io_map) - - /* video hardware */ - MCFG_DEVICE_ADD( TMS9918A_TAG, TMS9918A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000_state, sg1000_vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TMS9918A_TAG, tms9918a_device, screen_update ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_10_738635MHz/3) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_DEVICE_ADD(UPD9255_0_TAG, I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(sc3000_state, ppi_pa_r)) - MCFG_I8255_IN_PORTB_CB(READ8(sc3000_state, ppi_pb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(sc3000_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(UPD9255_1_TAG, I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(sf7000_state, ppi_pa_r)) - MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(sf7000_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UPD8251_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(UPD8251_TAG, i8251_device, write_dsr)) - - MCFG_UPD765A_ADD(UPD765_TAG, false, false) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", sf7000_floppies, "3ssdd", sf7000_state::floppy_formats) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(sc3000_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("sc3000_cass") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("flop_list","sf7000") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -/*************************************************************************** - ROMS -***************************************************************************/ - -ROM_START( sg1000 ) - ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) -ROM_END - -#define rom_sg1000m2 rom_sg1000 - -#define rom_sc3000 rom_sg1000 - -#define rom_sc3000h rom_sg1000 - -ROM_START( sf7000 ) - ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) - ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(d76810b8) SHA1(77339a6db2593aadc638bed77b8e9bed5d9d87e3) ) -ROM_END - -ROM_START( omv1000 ) - ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) - ROM_LOAD( "omvbios.bin", 0x0000, 0x4000, BAD_DUMP CRC(c5a67b95) SHA1(6d7c64dd60dee4a33061d3d3a7c2ed190d895cdb) ) // The BIOS comes from a Multivision FG-2000. It is still unknown if the FG-1000 BIOS differs -ROM_END - -ROM_START( omv2000 ) - ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) - ROM_LOAD( "omvbios.bin", 0x0000, 0x4000, CRC(c5a67b95) SHA1(6d7c64dd60dee4a33061d3d3a7c2ed190d895cdb) ) -ROM_END - -/*************************************************************************** - SYSTEM DRIVERS -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1983, sg1000, 0, 0, sg1000, sg1000, driver_device, 0, "Sega", "SG-1000", MACHINE_SUPPORTS_SAVE ) -CONS( 1984, sg1000m2, sg1000, 0, sc3000, sc3000, driver_device, 0, "Sega", "SG-1000 II", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, sc3000, 0, sg1000, sc3000, sc3000, driver_device, 0, "Sega", "SC-3000", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, sc3000h, sc3000, 0, sc3000, sc3000, driver_device, 0, "Sega", "SC-3000H", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, sf7000, sc3000, 0, sf7000, sf7000, driver_device, 0, "Sega", "SC-3000/Super Control Station SF-7000", MACHINE_SUPPORTS_SAVE ) -CONS( 1984, omv1000, sg1000, 0, omv, omv, driver_device, 0, "Tsukuda Original", "Othello Multivision FG-1000", MACHINE_SUPPORTS_SAVE ) -CONS( 1984, omv2000, sg1000, 0, omv, omv, driver_device, 0, "Tsukuda Original", "Othello Multivision FG-2000", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/sgi_ip2.c b/src/mess/drivers/sgi_ip2.c deleted file mode 100644 index 628ee4e1997..00000000000 --- a/src/mess/drivers/sgi_ip2.c +++ /dev/null @@ -1,517 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/**************************************************************************** - - drivers/sgi_ip2.c - SGI IRIS 3130 skeleton driver with some meat on its bones - - by Harmony - - 0x00000000 - ? RAM (?) - 0x30000000 - 0x30017fff ROM (3x32k) - 0x30800000 - 0x30800000 Mouse Buttons (1) - 0x31000000 - 0x31000001 Mouse Quadrature (2) - 0x32000000 - 0x3200000f DUART0 (serial console on channel B at 19200 baud 8N1, channel A set to 600 baud 8N1 (mouse?)) - 0x32800000 - 0x3280000f DUART1 (printer/modem?) - 0x33000000 - 0x330007ff SRAM (2k) - 0x34000000 - 0x34000000 Clock Control (1) - 0x35000000 - 0x35000000 Clock Data (1) - 0x36000000 - 0x36000000 OS Base (1) - 0x38000000 - 0x38000001 Status Register (2) - 0x39000000 - 0x39000000 Parity control (1) - 0x3a000000 - 0x3a000000 Multibus Protection (1) - 0x3b000000 - 0x3b000003 Page Table Map Base (4) - 0x3c000000 - 0x3c000001 Text/Data Base (2) - 0x3d000000 - 0x3d000001 Text/Data Limit (2) - 0x3e000000 - 0x3e000001 Stack Base (2) - 0x3f000000 - 0x3f000001 Stack Limit (2) - - TODO: - Hook up keyboard - Hook up mouse - Hook up graphics - Hook up mass storage - - Interrupts: - M68K: - 6 - DUART - -****************************************************************************/ - -#include "emu.h" -#include "bus/rs232/rs232.h" -#include "sound/dac.h" -#include "cpu/m68000/m68000.h" -#include "machine/mc146818.h" /* TOD clock */ -#include "machine/mc68681.h" /* DUART0, DUART1 */ -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class sgi_ip2_state : public driver_device -{ -public: - sgi_ip2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_mainram(*this, "mainram"), - m_duarta(*this, "duart68681a"), - m_duartb(*this, "duart68681b"), - m_bss(*this, "bss"), - m_ptmap(*this, "ptmap"), - m_rtc(*this, "rtc") - { - } - - DECLARE_READ8_MEMBER(sgi_ip2_m_but_r); - DECLARE_WRITE8_MEMBER(sgi_ip2_m_but_w); - DECLARE_READ16_MEMBER(sgi_ip2_m_quad_r); - DECLARE_WRITE16_MEMBER(sgi_ip2_m_quad_w); - DECLARE_READ16_MEMBER(sgi_ip2_swtch_r); - DECLARE_READ8_MEMBER(sgi_ip2_clock_ctl_r); - DECLARE_WRITE8_MEMBER(sgi_ip2_clock_ctl_w); - DECLARE_READ8_MEMBER(sgi_ip2_clock_data_r); - DECLARE_WRITE8_MEMBER(sgi_ip2_clock_data_w); - DECLARE_READ8_MEMBER(sgi_ip2_os_base_r); - DECLARE_WRITE8_MEMBER(sgi_ip2_os_base_w); - DECLARE_READ16_MEMBER(sgi_ip2_status_r); - DECLARE_WRITE16_MEMBER(sgi_ip2_status_w); - DECLARE_READ8_MEMBER(sgi_ip2_parctl_r); - DECLARE_WRITE8_MEMBER(sgi_ip2_parctl_w); - DECLARE_READ8_MEMBER(sgi_ip2_mbp_r); - DECLARE_WRITE8_MEMBER(sgi_ip2_mbp_w); - DECLARE_READ32_MEMBER(sgi_ip2_ptmap_r); - DECLARE_WRITE32_MEMBER(sgi_ip2_ptmap_w); - DECLARE_READ16_MEMBER(sgi_ip2_tdbase_r); - DECLARE_WRITE16_MEMBER(sgi_ip2_tdbase_w); - DECLARE_READ16_MEMBER(sgi_ip2_tdlmt_r); - DECLARE_WRITE16_MEMBER(sgi_ip2_tdlmt_w); - DECLARE_READ16_MEMBER(sgi_ip2_stkbase_r); - DECLARE_WRITE16_MEMBER(sgi_ip2_stkbase_w); - DECLARE_READ16_MEMBER(sgi_ip2_stklmt_r); - DECLARE_WRITE16_MEMBER(sgi_ip2_stklmt_w); - DECLARE_DRIVER_INIT(sgi_ip2); - DECLARE_WRITE_LINE_MEMBER(duarta_irq_handler); - DECLARE_WRITE_LINE_MEMBER(duartb_irq_handler); - required_device m_maincpu; -protected: - required_shared_ptr m_mainram; - required_device m_duarta; - required_device m_duartb; - required_shared_ptr m_bss; - required_shared_ptr m_ptmap; - required_device m_rtc; -private: - UINT8 m_mbut; - UINT16 m_mquad; - UINT16 m_tdbase; - UINT16 m_tdlmt; - UINT16 m_stkbase; - UINT16 m_stklmt; - UINT8 m_parctl; - UINT8 m_mbp; - virtual void machine_start(); - virtual void machine_reset(); - inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); -}; - - -#define VERBOSE_LEVEL ( 0 ) - -#define ENABLE_VERBOSE_LOG (0) - -inline void ATTR_PRINTF(3,4) sgi_ip2_state::verboselog( int n_level, const char *s_fmt, ... ) -{ -#if ENABLE_VERBOSE_LOG - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror("%08x: %s", machine().device("maincpu")->safe_pc(), buf); - } -#endif -} - -/*************************************************************************** - MACHINE FUNCTIONS -***************************************************************************/ - -#define MBUT_RIGHT 0x01 /* Right button */ -#define MBUT_MIDDLE 0x02 /* Middle button */ -#define MBUT_LEFT 0x04 /* Left button */ -#define BOARD_REV1 0x60 /* Board revision - #1 */ -#define BOARD_REV2 0x50 /* Board revision - #2 */ - - -READ8_MEMBER(sgi_ip2_state::sgi_ip2_m_but_r) -{ - verboselog(0, "sgi_ip2_m_but_r: %02x\n", m_mbut | BOARD_REV1); - return m_mbut | BOARD_REV1; -} - -WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_m_but_w) -{ - verboselog(0, "sgi_ip2_m_but_w: %02x\n", data); - m_mbut = data; -} - -#define MOUSE_XFIRE 0x01 /* X Quadrature Fired, active low */ -#define MOUSE_XCHANGE 0x02 /* MOUSE_XCHANGE ? x-- : x++ */ -#define MOUSE_YFIRE 0x04 /* Y Quadrature Fired, active low */ -#define MOUSE_YCHANGE 0x08 /* MOUSE_YCHANGE ? y-- : y++ */ - - -READ16_MEMBER(sgi_ip2_state::sgi_ip2_m_quad_r) -{ - verboselog(0, "sgi_ip2_m_quad_r: %04x\n", m_mquad); - return m_mquad; -} - -WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_m_quad_w) -{ - verboselog(0, "sgi_ip2_m_quad_w = %04x & %04x\n", data, mem_mask); - COMBINE_DATA(&m_mquad); -} - -READ16_MEMBER(sgi_ip2_state::sgi_ip2_swtch_r) -{ - verboselog(0, "sgi_ip2_swtch_r: %04x\n", ioport("SWTCH")->read()); - return ioport("SWTCH")->read(); -} - -READ8_MEMBER(sgi_ip2_state::sgi_ip2_clock_ctl_r) -{ - UINT8 ret = m_rtc->read(space, 1); - verboselog(1, "sgi_ip2_clock_ctl_r: %02x\n", ret); - return ret; -} - -WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_clock_ctl_w) -{ - verboselog(1, "sgi_ip2_clock_ctl_w: %02x\n", data); - m_rtc->write(space, 1, data); -} - -READ8_MEMBER(sgi_ip2_state::sgi_ip2_clock_data_r) -{ - UINT8 ret = m_rtc->read(space, 0); - verboselog(1, "sgi_ip2_clock_data_r: %02x\n", ret); - return ret; -} - -WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_clock_data_w) -{ - verboselog(1, "sgi_ip2_clock_data_w: %02x\n", data); - m_rtc->write(space, 0, data); -} - - -READ8_MEMBER(sgi_ip2_state::sgi_ip2_os_base_r) -{ - switch(offset) - { - default: - verboselog(0, "sgi_ip2_os_base_r: Unknown Register %08x\n", 0x36000000 + offset); - break; - } - return 0; -} - -WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_os_base_w) -{ - switch(offset) - { - default: - verboselog(0, "sgi_ip2_os_base_w: Unknown Register %08x = %02x\n", 0x36000000 + offset, data); - break; - } -} - -READ16_MEMBER(sgi_ip2_state::sgi_ip2_status_r) -{ - switch(offset) - { - default: - verboselog(0, "sgi_ip2_status_r: Unknown Register %08x & %04x\n", 0x38000000 + (offset << 1), mem_mask); - break; - } - return 0; -} - -WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_status_w) -{ - switch(offset) - { - default: - verboselog(0, "sgi_ip2_status_w: Unknown Register %08x = %04x & %04x\n", 0x38000000 + (offset << 1), data, mem_mask); - break; - } -} - -#define PAR_UR 0x01 /* Check parity on user-mode reads */ -#define PAR_UW 0x02 /* Check parity on user-mode writes */ -#define PAR_KR 0x04 /* Check parity on kernel-mode reads */ -#define PAR_KW 0x08 /* Check parity on kernel-mode writes */ -#define PAR_DIS0 0x10 /* Disable access to DUART0 and LEDs */ -#define PAR_DIS1 0x20 /* Disable access to DUART1 */ -#define PAR_MBR 0x40 /* Check parity on multibus reads */ -#define PAR_MBW 0x80 /* Check parity on multibus writes */ - - -READ8_MEMBER(sgi_ip2_state::sgi_ip2_parctl_r) -{ - verboselog(0, "sgi_ip2_parctl_r: %02x\n", m_parctl); - return m_parctl; -} - -WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_parctl_w) -{ - verboselog(0, "sgi_ip2_parctl_w: %02x\n", data); - m_parctl = data; -} - -#define MBP_DCACC 0x01 /* Display controller access (I/O page 4) */ -#define MBP_UCACC 0x02 /* Update controller access (I/O page 3) */ -#define MBP_GFACC 0x04 /* Allow GF access (I/O page 1) */ -#define MBP_DMACC 0x08 /* Allow GL2 DMA access (0x8nnnnn - x0bnnnnn) */ -#define MBP_LIOACC 0x10 /* Allow lower I/O access (0x0nnnnn - 0x7nnnnn) */ -#define MBP_HIOACC 0x20 /* Allow upper I/O access (0x8nnnnn - 0xfnnnnn) */ -#define MBP_LMACC 0x40 /* Allow lower memory access (0x0nnnnn - 0x7nnnnn) */ -#define MBP_HMACC 0x80 /* Allow upper memory access (0x8nnnnn - 0xfnnnnn) */ - - -READ8_MEMBER(sgi_ip2_state::sgi_ip2_mbp_r) -{ - verboselog(0, "sgi_ip2_mbp_r: %02x\n", m_mbp); - return m_mbp; -} - -WRITE8_MEMBER(sgi_ip2_state::sgi_ip2_mbp_w) -{ - verboselog(0, "sgi_ip2_mbp_w: %02x\n", data); - m_mbp = data; -} - - -READ32_MEMBER(sgi_ip2_state::sgi_ip2_ptmap_r) -{ - verboselog(0, "sgi_ip2_ptmap_r: %08x = %08x & %08x\n", 0x3b000000 + (offset << 2), m_ptmap[offset], mem_mask); - return m_ptmap[offset]; -} - -WRITE32_MEMBER(sgi_ip2_state::sgi_ip2_ptmap_w) -{ - verboselog(0, "sgi_ip2_ptmap_w: %08x = %08x & %08x\n", 0x3b000000 + (offset << 2), data, mem_mask); - COMBINE_DATA(&m_ptmap[offset]); -} - - -READ16_MEMBER(sgi_ip2_state::sgi_ip2_tdbase_r) -{ - verboselog(0, "sgi_ip2_tdbase_r: %04x\n", m_tdbase); - return m_tdbase; -} - -WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_tdbase_w) -{ - verboselog(0, "sgi_ip2_tdbase_w: %04x & %04x\n", data, mem_mask); - COMBINE_DATA(&m_tdbase); -} - - -READ16_MEMBER(sgi_ip2_state::sgi_ip2_tdlmt_r) -{ - verboselog(0, "sgi_ip2_tdlmt_r: %04x\n", m_tdlmt); - return m_tdlmt; -} - -WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_tdlmt_w) -{ - verboselog(0, "sgi_ip2_tdlmt_w: %04x & %04x\n", data, mem_mask); - COMBINE_DATA(&m_tdlmt); -} - - -READ16_MEMBER(sgi_ip2_state::sgi_ip2_stkbase_r) -{ - verboselog(0, "sgi_ip2_stkbase_r: %04x\n", m_stkbase); - return m_stkbase; -} - -WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_stkbase_w) -{ - verboselog(0, "sgi_ip2_stkbase_w: %04x & %04x\n", data, mem_mask); - COMBINE_DATA(&m_stkbase); -} - - -READ16_MEMBER(sgi_ip2_state::sgi_ip2_stklmt_r) -{ - verboselog(0, "sgi_ip2_stklmt_r: %04x\n", m_stklmt); - return m_stklmt; -} - -WRITE16_MEMBER(sgi_ip2_state::sgi_ip2_stklmt_w) -{ - verboselog(0, "sgi_ip2_stklmt_w: %04x & %04x\n", data, mem_mask); - COMBINE_DATA(&m_stklmt); -} - -void sgi_ip2_state::machine_start() -{ -} - -void sgi_ip2_state::machine_reset() -{ -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - - -static ADDRESS_MAP_START(sgi_ip2_map, AS_PROGRAM, 32, sgi_ip2_state ) - AM_RANGE(0x00000000, 0x00ffffff) AM_RAM AM_SHARE("mainram") - AM_RANGE(0x02100000, 0x0210ffff) AM_RAM AM_SHARE("bss") // ??? I don't understand the need for this... - AM_RANGE(0x30000000, 0x30017fff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x30800000, 0x30800003) AM_READWRITE8(sgi_ip2_m_but_r, sgi_ip2_m_but_w, 0xffffffff) - AM_RANGE(0x31000000, 0x31000003) AM_READWRITE16(sgi_ip2_m_quad_r, sgi_ip2_m_quad_w, 0xffffffff) - AM_RANGE(0x31800000, 0x31800003) AM_READ16(sgi_ip2_swtch_r, 0xffffffff) - AM_RANGE(0x32000000, 0x3200000f) AM_DEVREADWRITE8("duart68681a", mc68681_device, read, write, 0xffffffff) - AM_RANGE(0x32800000, 0x3280000f) AM_DEVREADWRITE8("duart68681b", mc68681_device, read, write, 0xffffffff) - AM_RANGE(0x33000000, 0x330007ff) AM_RAM - AM_RANGE(0x34000000, 0x34000003) AM_READWRITE8(sgi_ip2_clock_ctl_r, sgi_ip2_clock_ctl_w, 0xffffffff) - AM_RANGE(0x35000000, 0x35000003) AM_READWRITE8(sgi_ip2_clock_data_r, sgi_ip2_clock_data_w, 0xffffffff) - AM_RANGE(0x36000000, 0x36000003) AM_READWRITE8(sgi_ip2_os_base_r, sgi_ip2_os_base_w, 0xffffffff) - AM_RANGE(0x38000000, 0x38000003) AM_READWRITE16(sgi_ip2_status_r, sgi_ip2_status_w, 0xffffffff) - AM_RANGE(0x39000000, 0x39000003) AM_READWRITE8(sgi_ip2_parctl_r, sgi_ip2_parctl_w, 0xffffffff) - AM_RANGE(0x3a000000, 0x3a000003) AM_READWRITE8(sgi_ip2_mbp_r, sgi_ip2_mbp_w, 0xffffffff) - AM_RANGE(0x3b000000, 0x3b003fff) AM_READWRITE(sgi_ip2_ptmap_r, sgi_ip2_ptmap_w) AM_SHARE("ptmap") - AM_RANGE(0x3c000000, 0x3c000003) AM_READWRITE16(sgi_ip2_tdbase_r, sgi_ip2_tdbase_w, 0xffffffff) - AM_RANGE(0x3d000000, 0x3d000003) AM_READWRITE16(sgi_ip2_tdlmt_r, sgi_ip2_tdlmt_w, 0xffffffff) - AM_RANGE(0x3e000000, 0x3e000003) AM_READWRITE16(sgi_ip2_stkbase_r, sgi_ip2_stkbase_w, 0xffffffff) - AM_RANGE(0x3f000000, 0x3f000003) AM_READWRITE16(sgi_ip2_stklmt_r, sgi_ip2_stklmt_w, 0xffffffff) -ADDRESS_MAP_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -WRITE_LINE_MEMBER(sgi_ip2_state::duarta_irq_handler) -{ - m_maincpu->set_input_line_and_vector(M68K_IRQ_6, state, M68K_INT_ACK_AUTOVECTOR); -} - -WRITE_LINE_MEMBER(sgi_ip2_state::duartb_irq_handler) -{ - m_maincpu->set_input_line_and_vector(M68K_IRQ_6, state, M68K_INT_ACK_AUTOVECTOR); -} - -static DEVICE_INPUT_DEFAULTS_START( ip2_terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_19200 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_19200 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -static MACHINE_CONFIG_START( sgi_ip2, sgi_ip2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68020, 16000000) - MCFG_CPU_PROGRAM_MAP(sgi_ip2_map) - - MCFG_MC68681_ADD( "duart68681a", XTAL_3_6864MHz ) /* Y3 3.6864MHz Xtal ??? copy-over from dectalk */ - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(sgi_ip2_state, duarta_irq_handler)) - MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - - MCFG_MC68681_ADD( "duart68681b", XTAL_3_6864MHz ) /* Y3 3.6864MHz Xtal ??? copy-over from dectalk */ - MCFG_MC68681_IRQ_CALLBACK(WRITELINE(sgi_ip2_state, duartb_irq_handler)) - - MCFG_MC146818_ADD( "rtc", XTAL_4_194304Mhz ) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duart68681a", mc68681_device, rx_b_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", ip2_terminal) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD( "dac", DAC, 0 ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( sgi_ip2 ) - PORT_START("SWTCH") - PORT_DIPNAME( 0x8000, 0x8000, "Master/Slave" ) - PORT_DIPSETTING( 0x0000, "Slave" ) - PORT_DIPSETTING( 0x8000, "Master" ) - PORT_BIT( 0x6000, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_DIPNAME( 0x1800, 0x1800, "RS232 Console Speed" ) - PORT_DIPSETTING( 0x0000, "9600 Baud" ) - PORT_DIPSETTING( 0x0800, "300 Baud" ) - PORT_DIPSETTING( 0x1000, "1200 Baud" ) - PORT_DIPSETTING( 0x1800, "19200 Baud" ) - PORT_DIPNAME( 0x0700, 0x0000, "Display Setting" ) - PORT_DIPSETTING( 0x0000, "60Hz Non-Interlaced / 60Hz Non-Interlaced" ) - PORT_DIPSETTING( 0x0100, "60Hz Non-Interlaced / 30Hz Interlaced" ) - PORT_DIPSETTING( 0x0200, "60Hz Non-Interlaced / NTSC RS 170A" ) - PORT_DIPSETTING( 0x0300, "60Hz Non-Interlaced / PAL" ) - PORT_DIPSETTING( 0x0400, "30Hz Interlaced / 60Hz Non-Interlaced" ) - PORT_DIPSETTING( 0x0500, "30Hz Interlaced / 30Hz Interlaced" ) - PORT_DIPSETTING( 0x0600, "30Hz Interlaced / NTSC RS 170A" ) - PORT_DIPSETTING( 0x0700, "30Hz Interlaced / PAL" ) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_DIPNAME( 0x0040, 0x0000, "Enable Dual-Head Display" ) - PORT_DIPSETTING( 0x0000, "Use Primary Display" ) - PORT_DIPSETTING( 0x0040, "Use Secondary Display" ) - PORT_DIPNAME( 0x0020, 0x0000, "Verbose Boot" ) - PORT_DIPSETTING( 0x0000, "Be Verbose" ) - PORT_DIPSETTING( 0x0020, "Be Quiet" ) - PORT_DIPNAME( 0x0010, 0x0000, "Auto-Boot" ) - PORT_DIPSETTING( 0x0000, "Enter PROM Monitor" ) - PORT_DIPSETTING( 0x0010, "Auto-Boot" ) - PORT_DIPNAME( 0x000f, 0x0005, "Boot Media" ) - PORT_DIPSETTING( 0x0000, "Hard Disk (IP, SD, MD)" ) - PORT_DIPSETTING( 0x0001, "Cartridge Tape" ) - PORT_DIPSETTING( 0x0002, "Floppy Disk (SF, MF)" ) - PORT_DIPSETTING( 0x0003, "Ethernet using XNS" ) - PORT_DIPSETTING( 0x0005, "Enter PROM Monitor" ) - PORT_DIPSETTING( 0x0006, "Boot from PROM Board" ) - PORT_DIPSETTING( 0x0007, "TCP/UDP Netboot" ) - PORT_DIPSETTING( 0x0009, "Interphase SMD Disk Boot" ) - PORT_DIPSETTING( 0x000a, "Storager Tape Boot (1)" ) - PORT_DIPSETTING( 0x000b, "Storager Tape Boot (2)" ) - PORT_DIPSETTING( 0x000c, "Stoarger Hard Disk Boot" ) - PORT_DIPSETTING( 0x000d, "DSD Tape Boot (1)" ) - PORT_DIPSETTING( 0x000e, "DSD Tape Boot (2)" ) - PORT_DIPSETTING( 0x000f, "DSD Hard Disk Boot" ) - -INPUT_PORTS_END - -DRIVER_INIT_MEMBER(sgi_ip2_state,sgi_ip2) -{ - UINT32 *src = (UINT32*)(memregion("maincpu")->base()); - UINT32 *dst = m_mainram; - memcpy(dst, src, 8); - - m_maincpu->reset(); -} - -/*************************************************************************** - - ROM definition(s) - -***************************************************************************/ - -ROM_START( sgi_ip2 ) - ROM_REGION32_BE(0x18000, "maincpu", 0) - ROM_LOAD( "sgi-ip2-u91.nolabel.od", 0x00000, 0x8000, CRC(32e1f6b5) SHA1(2bd928c3fe2e364b9a38189158e9bad0e5271a59) ) - ROM_LOAD( "sgi-ip2-u92.nolabel.od", 0x08000, 0x8000, CRC(13dbfdb3) SHA1(3361fb62f7a8c429653700bccfc3e937f7508182) ) - ROM_LOAD( "sgi-ip2-u93.ip2.2-008.od", 0x10000, 0x8000, CRC(bf967590) SHA1(1aac48e4f5531a25c5482f64de5cd3c7a9931f11) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1985, sgi_ip2, 0, 0, sgi_ip2, sgi_ip2, sgi_ip2_state, sgi_ip2, "Silicon Graphics Inc", "IRIS 3130 (IP2)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/sgi_ip6.c b/src/mess/drivers/sgi_ip6.c deleted file mode 100644 index c6125c81153..00000000000 --- a/src/mess/drivers/sgi_ip6.c +++ /dev/null @@ -1,269 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/**************************************************************************** - - drivers/sgi_ip6.c - SGI 4D/PI IP6 family skeleton driver - - by Harmony - - 0x1fc00000 - 0x1fc3ffff ROM - - Interrupts: - R2000: - NYI - -****************************************************************************/ - -#include "emu.h" -#include "cpu/mips/r3000.h" - - -struct ip6_regs_t -{ - UINT16 unknown_half_0; - UINT8 unknown_byte_0; - UINT8 unknown_byte_1; -}; - -class sgi_ip6_state : public driver_device -{ -public: - sgi_ip6_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - ip6_regs_t m_ip6_regs; - DECLARE_READ32_MEMBER(ip6_unk1_r); - DECLARE_WRITE32_MEMBER(ip6_unk1_w); - DECLARE_READ32_MEMBER(ip6_unk2_r); - DECLARE_WRITE32_MEMBER(ip6_unk2_w); - DECLARE_READ32_MEMBER(ip6_unk3_r); - DECLARE_WRITE32_MEMBER(ip6_unk3_w); - DECLARE_DRIVER_INIT(sgi_ip6); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_sgi_ip6(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(sgi_ip6_vbl); - inline void ATTR_PRINTF(3,4) verboselog( int n_level, const char *s_fmt, ... ); - required_device m_maincpu; -}; - - -#define VERBOSE_LEVEL ( 0 ) - -#define ENABLE_VERBOSE_LOG (1) - -inline void ATTR_PRINTF(3,4) sgi_ip6_state::verboselog( int n_level, const char *s_fmt, ... ) -{ -#if ENABLE_VERBOSE_LOG - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror("%08x: %s", machine().device("maincpu")->safe_pc(), buf); - } -#endif -} - -/*************************************************************************** - VIDEO HARDWARE -***************************************************************************/ - -void sgi_ip6_state::video_start() -{ -} - -UINT32 sgi_ip6_state::screen_update_sgi_ip6(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -/*************************************************************************** - MACHINE FUNCTIONS -***************************************************************************/ - - -READ32_MEMBER(sgi_ip6_state::ip6_unk1_r) -{ - UINT32 ret = 0; - switch(offset) - { - case 0x0000/4: - if(ACCESSING_BITS_16_31) - { - verboselog(0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask ); - } - if(ACCESSING_BITS_0_15) - { - verboselog(0, "ip6_unk1_r: Unknown Halfword 0: %08x & %08x\n", m_ip6_regs.unknown_half_0, mem_mask ); - ret |= m_ip6_regs.unknown_half_0; - } - break; - default: - verboselog(0, "ip6_unk1_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask ); - break; - } - return ret; -} - -WRITE32_MEMBER(sgi_ip6_state::ip6_unk1_w) -{ - switch(offset) - { - case 0x0000/4: - if(ACCESSING_BITS_16_31) - { - verboselog(0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask ); - } - if(ACCESSING_BITS_0_15) - { - verboselog(0, "ip6_unk1_w: Unknown Halfword 0 = %04x & %04x\n", data & 0x0000ffff, mem_mask & 0x0000ffff ); - m_ip6_regs.unknown_half_0 = data & 0x0000ffff; - } - break; - default: - verboselog(0, "ip6_unk1_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask ); - break; - } -} - -READ32_MEMBER(sgi_ip6_state::ip6_unk2_r) -{ - UINT32 ret = 0; - switch(offset) - { - case 0x0000/4: - if(!ACCESSING_BITS_24_31) - { - verboselog(0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask ); - } - if(ACCESSING_BITS_24_31) - { - verboselog(0, "ip6_unk2_r: Unknown Byte 0 = %02x & %02x\n", m_ip6_regs.unknown_byte_0, mem_mask >> 24 ); - ret |= m_ip6_regs.unknown_byte_0 << 24; - } - break; - default: - verboselog(0, "ip6_unk2_r: Unknown address: %08x & %08x\n", 0x1f880000 + (offset << 2), mem_mask ); - break; - } - return ret; -} - -WRITE32_MEMBER(sgi_ip6_state::ip6_unk2_w) -{ - switch(offset) - { - case 0x0000/4: - if(!ACCESSING_BITS_24_31) - { - verboselog(0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask ); - } - if(ACCESSING_BITS_24_31) - { - verboselog(0, "ip6_unk2_w: Unknown Byte 0 = %02x & %02x\n", data >> 24, mem_mask >> 24 ); - m_ip6_regs.unknown_byte_0 = (data & 0xff000000) >> 24; - } - break; - default: - verboselog(0, "ip6_unk2_w: Unknown address: %08x = %08x & %08x\n", 0x1f880000 + (offset << 2), data, mem_mask ); - break; - } -} - -READ32_MEMBER(sgi_ip6_state::ip6_unk3_r) -{ - UINT32 ret = 0; - if(ACCESSING_BITS_16_23) - { - verboselog(0, "ip6_unk3_r: Unknown Byte 1: %02x & %02x\n", m_ip6_regs.unknown_byte_1, (mem_mask >> 16) & 0x000000ff); - ret |= m_ip6_regs.unknown_byte_1 << 16; - } - else - { - verboselog(0, "ip6_unk3_r: Unknown address: %08x & %08x\n", 0x1fb00000 + (offset << 2), mem_mask ); - } - return ret; -} - -WRITE32_MEMBER(sgi_ip6_state::ip6_unk3_w) -{ - verboselog(0, "ip6_unk3_w: Unknown address: %08x = %08x & %08x\n", 0x1fb00000 + (offset << 2), data, mem_mask ); -} - -INTERRUPT_GEN_MEMBER(sgi_ip6_state::sgi_ip6_vbl) -{ -} - -void sgi_ip6_state::machine_start() -{ -} - -void sgi_ip6_state::machine_reset() -{ - m_ip6_regs.unknown_byte_0 = 0x80; - m_ip6_regs.unknown_byte_1 = 0x80; - m_ip6_regs.unknown_half_0 = 0; -} - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( sgi_ip6_map, AS_PROGRAM, 32, sgi_ip6_state ) - AM_RANGE( 0x1f880000, 0x1f880003 ) AM_READWRITE(ip6_unk1_r, ip6_unk1_w) - AM_RANGE( 0x1fb00000, 0x1fb00003 ) AM_READWRITE(ip6_unk3_r, ip6_unk3_w) - AM_RANGE( 0x1fbc004c, 0x1fbc004f ) AM_READWRITE(ip6_unk2_r, ip6_unk2_w) - AM_RANGE( 0x1fc00000, 0x1fc3ffff ) AM_ROM AM_REGION( "user1", 0 ) -ADDRESS_MAP_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static MACHINE_CONFIG_START( sgi_ip6, sgi_ip6_state ) - MCFG_CPU_ADD( "maincpu", R3041, 20000000 ) // FIXME: Should be R2000 - MCFG_R3000_ENDIANNESS(ENDIANNESS_BIG) - MCFG_CPU_CONFIG( config ) - MCFG_CPU_PROGRAM_MAP( sgi_ip6_map ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", sgi_ip6_state, sgi_ip6_vbl) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE( 60 ) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(sgi_ip6_state, screen_update_sgi_ip6) - - -MACHINE_CONFIG_END - -static INPUT_PORTS_START( sgi_ip6 ) - PORT_START("UNUSED") // unused IN0 - PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -DRIVER_INIT_MEMBER(sgi_ip6_state,sgi_ip6) -{ -} - -/*************************************************************************** - - ROM definition(s) - -***************************************************************************/ - -ROM_START( sgi_ip6 ) - ROM_REGION32_BE( 0x40000, "user1", 0 ) - ROM_LOAD( "4d202031.bin", 0x000000, 0x040000, CRC(065a290a) SHA1(6f5738e79643f94901e6efe3612468d14177f65b) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1988, sgi_ip6, 0, 0, sgi_ip6, sgi_ip6, sgi_ip6_state, sgi_ip6, "Silicon Graphics Inc", "4D/PI (R2000, 20MHz)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/sh4robot.c b/src/mess/drivers/sh4robot.c deleted file mode 100644 index 5ebe20f7530..00000000000 --- a/src/mess/drivers/sh4robot.c +++ /dev/null @@ -1,93 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - SH4 Robot - - http://perso.telecom-paristech.fr/~polti/robot/ - - 27/11/2013 Skeleton driver. - - - 0x0000 0000 - 0x7FFF FFFF : P0 area, cachable - 0x8000 0000 - 0x9FFF FFFF : P1 area, cachable - 0xA000 0000 - 0xBFFF FFFF : P2 area, non-cachable - 0xC000 0000 - 0xDFFF FFFF : P3 area, cachable - 0xE000 0000 - 0xFFFF FFFF : P4 area, non-cachable - - - 0x0000 0000 - 0x03FF FFFF : Area 0 (boot, ROM) - 0x0400 0000 - 0x07FF FFFF : Area 1 (FPGA) - 0x0800 0000 - 0x08FF FFFF : Area 2 (SDRAM 1, 16M) - 0x0C00 0000 - 0x0CFF FFFF : Area 3 (SDRAM 2, 16M) - 0x1000 0000 - 0x13FF FFFF : Area 4 (FPGA) - 0x1400 0000 - 0x17FF FFFF : Area 5 (FPGA) - 0x1800 0000 - 0x1BFF FFFF : Area 6 (FPGA) - 0x1C00 0000 - 0x1FFF FFFF : Area 7 (reserved) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/sh4/sh4.h" - -class sh4robot_state : public driver_device -{ -public: - sh4robot_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") { } - - - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(sh4robot_mem, AS_PROGRAM, 64, sh4robot_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x00000fff) AM_ROM - AM_RANGE(0x08000000, 0x08ffffff) AM_RAM // SDRAM 1 - AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM // SDRAM 2 - AM_RANGE(0xa0000000, 0xa0000fff) AM_ROM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sh4robot_io, AS_IO, 64, sh4robot_state ) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -static INPUT_PORTS_START( sh4robot ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( sh4robot, sh4robot_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SH4LE, 200000000) // SH7750 - MCFG_SH4_MD0(1) - MCFG_SH4_MD1(0) - MCFG_SH4_MD2(1) - MCFG_SH4_MD3(0) - MCFG_SH4_MD4(0) - MCFG_SH4_MD5(1) - MCFG_SH4_MD6(0) - MCFG_SH4_MD7(1) - MCFG_SH4_MD8(0) - MCFG_SH4_CLOCK(200000000) - MCFG_CPU_PROGRAM_MAP(sh4robot_mem) - MCFG_CPU_IO_MAP(sh4robot_io) - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sh4robot ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "bootloader.bin", 0x0000, 0x0882, CRC(d2ea0b7d) SHA1(7dd566c5e325d1ce1156a0bcbd7e10d011e9d35f)) - - // FLASH TC58128AFT - // flash blocks 1 till 199 (1*32*512 till 199*32*512) - //ROM_LOAD( "vmlinux-nand_img_with_oob-2.6.10-v1.0", 0x0000, 0x149be0, CRC(eec69ef5) SHA1(524e26d2c2c28061911f4726646b18596d134736)) - // Root FS at flash blocks from 201 till end (201*32*512) - //ROM_LOAD( "shix-linux-v1.0.yaffs", 0x0000, 0x7e9e40, CRC(7a7fdb04) SHA1(0b761e2d179335398399cb046de4e591157cb72f)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ -COMP( 20??, sh4robot, 0, 0, sh4robot, sh4robot, driver_device, 0, "", "Robot", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/sitcom.c b/src/mess/drivers/sitcom.c deleted file mode 100644 index 4f98a75a42d..00000000000 --- a/src/mess/drivers/sitcom.c +++ /dev/null @@ -1,135 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - SITCOM (known as Sitcom, Sitcom85, Sitcom8085) - - 25/09/2011 Driver [Robbbert] - - http://www.izabella.me.uk/html/sitcom_.html - http://www.sbprojects.com/sitcom/sitcom.htm - - The display consists of a LED connected to SOD, and a pair of - DL1414 intelligent alphanumeric displays. - - The idea of this device is that you write a 8085 program with an - assembler on your PC. You then compile it, and then send it to - the SITCOM via a serial cable. The program then (hopefully) runs - on the SITCOM. With the 8255 expansion, you could wire up input - devices or other hardware for your program to use. - - The SOD LED blinks slowly while waiting; stays on while downloading; - and blinks quickly if an error occurs. - - After a successful download, the ROM is switched out and the RAM - mirrored to the lower 32k. The downloaded program is then executed. - This part is not emulated. - - In MESS, start emulation. After about 10 seconds the display will - scroll sideways with a message and a weblink. There are no input keys. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "video/dl1416.h" -#include "sitcom.lh" - - - -class sitcom_state : public driver_device -{ -public: - sitcom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ds0(*this, "ds0"), - m_ds1(*this, "ds1") - { } - - required_device m_maincpu; - required_device m_ds0; - required_device m_ds1; - DECLARE_WRITE_LINE_MEMBER(sod_led); - DECLARE_READ_LINE_MEMBER(sid_line); - virtual void machine_reset(); - DECLARE_WRITE16_MEMBER(sitcom_update_ds0); - DECLARE_WRITE16_MEMBER(sitcom_update_ds1); -}; - -static ADDRESS_MAP_START( sitcom_mem, AS_PROGRAM, 8, sitcom_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sitcom_io, AS_IO, 8, sitcom_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // AM_RANGE(0x00, 0x1f) 8255 for expansion only - AM_RANGE(0xc0, 0xc3) AM_DEVWRITE("ds0", dl1416_device, data_w) //left display - AM_RANGE(0xe0, 0xe3) AM_DEVWRITE("ds1", dl1416_device, data_w) //right display -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sitcom ) -INPUT_PORTS_END - -void sitcom_state::machine_reset() -{ - m_ds0->ce_w(0); // enable - m_ds0->wr_w(0); - m_ds0->cu_w(1); // no cursor - m_ds1->ce_w(0); - m_ds1->wr_w(0); - m_ds1->cu_w(1); -} - -WRITE16_MEMBER(sitcom_state::sitcom_update_ds0) -{ - output_set_digit_value(offset, data); -} - -WRITE16_MEMBER(sitcom_state::sitcom_update_ds1) -{ - output_set_digit_value(4 + offset, data); -} - -// SID line used as serial input from a pc -READ_LINE_MEMBER( sitcom_state::sid_line ) -{ - return 1; //idle - changing to 0 gives a FR ERROR -} - -WRITE_LINE_MEMBER( sitcom_state::sod_led ) -{ - output_set_value("sod_led", state); -} - -static MACHINE_CONFIG_START( sitcom, sitcom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8085A, XTAL_6_144MHz) // 3.072MHz can be used for an old slow 8085 - MCFG_CPU_PROGRAM_MAP(sitcom_mem) - MCFG_CPU_IO_MAP(sitcom_io) - MCFG_I8085A_SID(READLINE(sitcom_state, sid_line)) - MCFG_I8085A_SOD(WRITELINE(sitcom_state, sod_led)) - - MCFG_DEFAULT_LAYOUT(layout_sitcom) - - /* video hardware */ - MCFG_DEVICE_ADD("ds0", DL1416B, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(sitcom_state, sitcom_update_ds0)) - MCFG_DEVICE_ADD("ds1", DL1416B, 0) - MCFG_DL1416_UPDATE_HANDLER(WRITE16(sitcom_state, sitcom_update_ds1)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sitcom ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "boot8085.bin", 0x0000, 0x06b8, CRC(1b5e3310) SHA1(3323b65f0c10b7ab6bb75ec824e6d5fb643693a8)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 2002, sitcom, 0, 0, sitcom, sitcom, driver_device, 0, "San Bergmans & Izabella Malcolm", "Sitcom", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/slc1.c b/src/mess/drivers/slc1.c deleted file mode 100644 index 14f3631cc8b..00000000000 --- a/src/mess/drivers/slc1.c +++ /dev/null @@ -1,285 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - -2011-JUL-16 SLC1 skeleton driver [Robbbert] -2011-DEC-29 Working [Robbbert] - -http://www.jens-mueller.org/jkcemu/slc1.html - -This computer is both a Z80 trainer, and a chess computer. - The keyboard is different between the two, so - we redefine it for your convenience. - - There is no chess board attached. You supply your own - and you sync the pieces and the computer instructions. - - When started, it is in Chess mode. Press 11111 to switch to - Trainer mode. - -Hardware - 4 Kbytes ROM in the address range 0000-0FFF - 1 Kbyte RAM in the address range 5000-53ff (user area starts at 5100) - 6-digit 7-segment display - Busy LED - Keyboard with 12 keys - -Keys: - 0-7 : hexadecimal numbers - Shift then 0-7 : Hexadecimal 8-F (decimal points will appear) - ADR : enter an address to work with. After the 4 digits are entered, - the data at that address shows, and you can modify the data. - + (inc) : Enter the data into memory, and increment the address by 1. - -Pasting doesn't work, but if it did... - - Pasting: - 0-7 : as is - 8-F : H, then 0-7 - + : ^ - - : H^ - ADR : - - - Test Paste: - [[[[[-510011^22^33^44^55^66^77^H8H8^H9H9^-5100 - Now press up-arrow to confirm the data has been entered. - - - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "slc1.lh" - - -class slc1_state : public driver_device -{ -public: - slc1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker") - { } - - required_device m_maincpu; - required_device m_speaker; - DECLARE_READ8_MEMBER( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - UINT8 m_digit; - bool m_kbd_type; - virtual void machine_reset(); - virtual void machine_start(); -}; - - - - -/*************************************************************************** - - Display - -***************************************************************************/ - -WRITE8_MEMBER( slc1_state::io_w ) -{ - bool segonoff = BIT(data, 7); - bool busyled = BIT(data, 4); - data &= 15; - - if (data < 8) - m_digit = data; - else - if (data < 12) - { - m_speaker->level_w(BIT(data, 1)); - return; - } - else - if (offset == 0x2f07) - return; - - UINT8 segdata = output_get_digit_value(m_digit); - UINT8 segnum = offset & 7; - UINT8 segmask = 1 << segnum; - - if (segonoff) - segdata |= segmask; - else - segdata &= ~segmask; - - output_set_digit_value(m_digit, segdata); - - output_set_value("busyled", busyled); - - if (m_digit == 3) - m_kbd_type = (segdata); -} - - -/*************************************************************************** - - Keyboard - -***************************************************************************/ - -READ8_MEMBER( slc1_state::io_r ) -{ - UINT8 data = 0xff, upper = (offset >> 8) & 7; - - if (m_kbd_type) - { // Trainer - if (upper == 3) - data &= ioport("Y0")->read(); - else - if (upper == 4) - data &= ioport("Y1")->read(); - else - if (upper == 5) - data &= ioport("Y2")->read(); - } - else - { // Chess - if (upper == 3) - data &= ioport("X0")->read(); - else - if (upper == 4) - data &= ioport("X1")->read(); - else - if (upper == 5) - data &= ioport("X2")->read(); - } - - return data; -} - - - -/*************************************************************************** - - Machine - -***************************************************************************/ - -void slc1_state::machine_start() -{ -} - -void slc1_state::machine_reset() -{ -} - - - -/*************************************************************************** - - Address Map - -***************************************************************************/ - -static ADDRESS_MAP_START( slc1_map, AS_PROGRAM, 8, slc1_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x4fff) - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x5000, 0x53ff) AM_RAM AM_MIRROR(0xc00) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( slc1_io, AS_IO, 8, slc1_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_READWRITE(io_r,io_w) -ADDRESS_MAP_END - - -/************************************************************************** - - Keyboard Layout - -***************************************************************************/ - -static INPUT_PORTS_START( slc1 ) -// Chess Keyboard - PORT_START("X0") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4 T") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3 L") PORT_CODE(KEYCODE_3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2 S") PORT_CODE(KEYCODE_2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A1 B") PORT_CODE(KEYCODE_1) PORT_CHAR('[') - - PORT_START("X1") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5 D") PORT_CODE(KEYCODE_5) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6 K") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) - - PORT_START("X2") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("St") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - -// Trainer Keyboard - PORT_START("Y0") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 B") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 A") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 9") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 8") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_START("Y1") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 C INS") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 D DEL") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 E BL") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 F Go") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("Y2") - PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fu DP") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+-1 SS") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Seq BG") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADR BP") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') -INPUT_PORTS_END - - -/*************************************************************************** - - Machine driver - -***************************************************************************/ - -static MACHINE_CONFIG_START( slc1, slc1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 2500000) - MCFG_CPU_PROGRAM_MAP(slc1_map) - MCFG_CPU_IO_MAP(slc1_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_slc1) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver - -***************************************************************************/ - -ROM_START(slc1) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "bios0", "SLC-1") - ROMX_LOAD("slc1_0000.bin", 0x0000, 0x1000, CRC(06d32967) SHA1(f25eac66a4fca9383964d509c671a7ad2e020e7e), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "bios1", "SC-1 v2") - ROMX_LOAD("sc1-v2.bin", 0x0000, 0x1000, CRC(1f122a85) SHA1(d60f89f8b59d04f4cecd6e3ecfe0a24152462a36), ROM_BIOS(2) ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1989, slc1, 0, 0, slc1, slc1, driver_device, 0, "Dr. Dieter Scheuschner", "SLC-1" , 0 ) diff --git a/src/mess/drivers/slicer.c b/src/mess/drivers/slicer.c deleted file mode 100644 index ca322b43001..00000000000 --- a/src/mess/drivers/slicer.c +++ /dev/null @@ -1,143 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl - -// Slicer Computers Slicer 80186 SBC -// The bios makefile refers to a "exe3bin" utility, this can be substituted with FreeDOS exe2bin and the /l=0xf800 option -// which will fixup the relocations - -#include "emu.h" -#include "cpu/i86/i186.h" -#include "machine/wd_fdc.h" -#include "machine/mc68681.h" -#include "bus/rs232/rs232.h" -#include "bus/isa/isa.h" -#include "bus/scsi/scsi.h" - -class slicer_state : public driver_device -{ -public: - slicer_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_fdc(*this, "fdc"), - m_sasi(*this, "sasi") - {} - - required_device m_fdc; - required_device m_sasi; - - DECLARE_WRITE8_MEMBER(sio_out_w); - DECLARE_WRITE8_MEMBER(drive_sel_w); -}; - -WRITE8_MEMBER(slicer_state::sio_out_w) -{ - floppy_image_device *floppy; - int state = (data & 0x80) ? 0 : 1; - char devname[8]; - - for(int i = 0; i < 4; i++) - { - sprintf(devname, "%d", i); - floppy = m_fdc->subdevice(devname)->get_device(); - if(floppy) - floppy->mon_w(state); - } -} - -WRITE8_MEMBER(slicer_state::drive_sel_w) -{ - data &= 1; - switch(offset) - { - case 0: - m_sasi->write_sel(data); - break; - case 1: - m_sasi->write_rst(data); - break; - case 7: - m_fdc->dden_w(data); - break; - - default: - { - floppy_image_device *floppy; - char devname[8]; - unsigned int drive = 3 - (offset - 2); - if((drive > 3) || !data) - break; - - sprintf(devname, "%d", drive); - floppy = m_fdc->subdevice(devname)->get_device(); - m_fdc->set_floppy(floppy); - break; - } - } -} - -static ADDRESS_MAP_START( slicer_map, AS_PROGRAM, 16, slicer_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM // fixed 256k for now - AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION("bios", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( slicer_io, AS_IO, 16, slicer_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x007f) AM_DEVREADWRITE8("fdc", fd1797_t, read, write, 0x00ff) //PCS0 - AM_RANGE(0x0080, 0x00ff) AM_DEVREADWRITE8("sc2681", mc68681_device, read, write, 0x00ff) //PCS1 - AM_RANGE(0x0100, 0x017f) AM_WRITE8(drive_sel_w, 0x00ff) //PCS2 - // TODO: 0x180 sets ack - AM_RANGE(0x0180, 0x0181) AM_DEVREAD8("sasi_data_in", input_buffer_device, read, 0x00ff) AM_DEVWRITE8("sasi_data_out", output_latch_device, write, 0x00ff) //PCS3 - AM_RANGE(0x0180, 0x0181) AM_DEVREAD8("sasi_ctrl_in", input_buffer_device, read, 0xff00) - AM_RANGE(0x0184, 0x0185) AM_DEVREAD8("sasi_data_in", input_buffer_device, read, 0x00ff) AM_DEVWRITE8("sasi_data_out", output_latch_device, write, 0x00ff) - AM_RANGE(0x0184, 0x0185) AM_DEVREAD8("sasi_ctrl_in", input_buffer_device, read, 0xff00) -ADDRESS_MAP_END - -static SLOT_INTERFACE_START( slicer_floppies ) - SLOT_INTERFACE("525dd", FLOPPY_525_DD) - SLOT_INTERFACE("8dsdd", FLOPPY_8_DSDD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( slicer, slicer_state ) - MCFG_CPU_ADD("maincpu", I80186, XTAL_16MHz / 2) - MCFG_CPU_PROGRAM_MAP(slicer_map) - MCFG_CPU_IO_MAP(slicer_io) - - MCFG_MC68681_ADD("sc2681", XTAL_3_6864MHz) - MCFG_MC68681_IRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int0_w)) - MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232_1", rs232_port_device, write_txd)) - MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE("rs232_2", rs232_port_device, write_txd)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(slicer_state, sio_out_w)) - - MCFG_RS232_PORT_ADD("rs232_1", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_a_w)) - MCFG_RS232_PORT_ADD("rs232_2", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_b_w)) - - MCFG_FD1797_ADD("fdc", XTAL_16MHz/2/8) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int1_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, drq0_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", slicer_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", slicer_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", slicer_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", slicer_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD("sasi", SCSI_PORT, 0) - MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in") - MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) - MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) - MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit5)) - MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit6)) - MCFG_SCSI_IO_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit7)) - - MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", "sasi") - MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0) - MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0) -MACHINE_CONFIG_END - -ROM_START( slicer ) - ROM_REGION(0x8001, "bios", 0) - // built from sources, reset.asm adds an extra byte - ROM_LOAD("epbios.bin", 0x0000, 0x8001, CRC(96fe9dd4) SHA1(5fc43454fe7d51f2ae97aef822155dcd28eb7f23)) -ROM_END - -COMP( 1983, slicer, 0, 0, slicer, 0, driver_device, 0, "Slicer Computers", "Slicer", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/sm1800.c b/src/mess/drivers/sm1800.c deleted file mode 100644 index 51e5648273c..00000000000 --- a/src/mess/drivers/sm1800.c +++ /dev/null @@ -1,201 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - SM1800 (original name is CM1800 in cyrilic letters) - - 10/12/2010 Skeleton driver. - - On board hardware : - KR580VM80A central processing unit (i8080) - KR580VG75 programmable CRT video display controller (i8275) - KR580VV55 programmable parallel interface (i8255) - KR580IK51 programmable serial interface/communication controller (i8251) - KR580VV79 programmable peripheral device, keyboard and display controller (i8279) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "video/i8275.h" - - -class sm1800_state : public driver_device -{ -public: - sm1800_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_uart(*this, "i8251"), - m_ppi(*this, "i8255"), - m_crtc(*this, "i8275"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_uart; - required_device m_ppi; - required_device m_crtc; - required_device m_palette; - DECLARE_WRITE8_MEMBER(sm1800_8255_portb_w); - DECLARE_WRITE8_MEMBER(sm1800_8255_portc_w); - DECLARE_READ8_MEMBER(sm1800_8255_porta_r); - DECLARE_READ8_MEMBER(sm1800_8255_portc_r); - UINT8 m_irq_state; - virtual void machine_reset(); - DECLARE_PALETTE_INIT(sm1800); - INTERRUPT_GEN_MEMBER(sm1800_vblank_interrupt); - IRQ_CALLBACK_MEMBER(sm1800_irq_callback); - I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); -}; - -static ADDRESS_MAP_START(sm1800_mem, AS_PROGRAM, 8, sm1800_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff ) AM_ROM - //AM_RANGE( 0x0fb0, 0x0fff ) AM_DEVWRITE("i8275", i8275_device, dack_w) - AM_RANGE( 0x1000, 0x17ff ) AM_RAM // videoram looks like 1080-17FF, normal ascii -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sm1800_io, AS_IO, 8, sm1800_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x3c, 0x3d ) AM_DEVREADWRITE("i8275", i8275_device, read, write) - AM_RANGE( 0x5c, 0x5c) AM_DEVREADWRITE("i8251", i8251_device, data_r, data_w) - AM_RANGE( 0x5d, 0x5d) AM_DEVREADWRITE("i8251", i8251_device, status_r, control_w) - AM_RANGE( 0x6c, 0x6f ) AM_DEVREADWRITE("i8255", i8255_device, read, write) - //AM_RANGE( 0x74, 0x74 ) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w) - //AM_RANGE( 0x75, 0x75 ) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sm1800 ) -INPUT_PORTS_END - -IRQ_CALLBACK_MEMBER(sm1800_state::sm1800_irq_callback) -{ - return 0xff; -} - -void sm1800_state::machine_reset() -{ -} - -INTERRUPT_GEN_MEMBER(sm1800_state::sm1800_vblank_interrupt) -{ - m_maincpu->set_input_line(0, m_irq_state ? HOLD_LINE : CLEAR_LINE); - m_irq_state ^= 1; -} - -I8275_DRAW_CHARACTER_MEMBER( sm1800_state::crtc_display_pixels ) -{ - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 *charmap = memregion("chargen")->base(); - UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; - if (vsp) - pixels = 0; - - if (lten) - pixels = 0xff; - - if (rvv) - pixels ^= 0xff; - - for(i=0;i<8;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; -} - -WRITE8_MEMBER( sm1800_state::sm1800_8255_portb_w ) -{ -} - -WRITE8_MEMBER( sm1800_state::sm1800_8255_portc_w ) -{ -} - -READ8_MEMBER( sm1800_state::sm1800_8255_porta_r ) -{ - return 0xff; -} - -READ8_MEMBER( sm1800_state::sm1800_8255_portc_r ) -{ - return 0; -} - -PALETTE_INIT_MEMBER(sm1800_state, sm1800) -{ - palette.set_pen_color(0, rgb_t::black); // black - palette.set_pen_color(1, 0xa0, 0xa0, 0xa0); // white - palette.set_pen_color(2, rgb_t::white); // highlight -} - - -/* F4 Character Displayer */ -static const gfx_layout sm1800_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( sm1800 ) - GFXDECODE_ENTRY( "chargen", 0x0000, sm1800_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( sm1800, sm1800_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(sm1800_mem) - MCFG_CPU_IO_MAP(sm1800_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", sm1800_state, sm1800_vblank_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(sm1800_state,sm1800_irq_callback) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(sm1800_state, sm1800) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", sm1800) - - /* Devices */ - MCFG_DEVICE_ADD("i8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(sm1800_state, sm1800_8255_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(sm1800_state, sm1800_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(sm1800_state, sm1800_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(sm1800_state, sm1800_8255_portc_w)) - - MCFG_DEVICE_ADD("i8275", I8275, 2000000) - MCFG_I8275_CHARACTER_WIDTH(8) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(sm1800_state, crtc_display_pixels) - - MCFG_DEVICE_ADD("i8251", I8251, 0) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sm1800 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "prog.bin", 0x0000, 0x0800, CRC(55736ad5) SHA1(b77f720f1b64b208dd6a5d4f9c9521d1284028e9)) - - ROM_REGION(0x0800, "chargen", 0) - ROM_LOAD( "font.bin", 0x0000, 0x0800, CRC(28ed9ebc) SHA1(f561136962a06a5dcb5a0436931d29e940155d24)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( ????, sm1800, 0, 0, sm1800, sm1800, driver_device, 0, "", "SM1800", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/smc777.c b/src/mess/drivers/smc777.c deleted file mode 100644 index db6e3ec6f14..00000000000 --- a/src/mess/drivers/smc777.c +++ /dev/null @@ -1,1027 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese -/************************************************************************************* - - SMC-777 (c) 1983 Sony - - driver by Angelo Salese - - TODO: - - no real documentation, the entire driver is just a bunch of educated - guesses ... - - ROM/RAM bankswitch, it apparently happens after one instruction prefetching. - We currently use an hackish implementation until the MAME/MESS framework can - support that ... - - keyboard input is very sluggish; - - cursor stuck in Bird Crash; - - add mc6845 features; - - many other missing features; - -**************************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/sn76496.h" -#include "sound/beep.h" -#include "video/mc6845.h" -#include "machine/wd_fdc.h" -#include "imagedev/flopdrv.h" - -#define MASTER_CLOCK XTAL_4_028MHz - -#define mc6845_h_char_total (m_crtc_vreg[0]+1) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]+1) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - -class smc777_state : public driver_device -{ -public: - smc777_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "crtc"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_beeper(*this, "beeper"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - DECLARE_WRITE8_MEMBER(mc6845_w); - DECLARE_READ8_MEMBER(vram_r); - DECLARE_READ8_MEMBER(attr_r); - DECLARE_READ8_MEMBER(pcg_r); - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_WRITE8_MEMBER(attr_w); - DECLARE_WRITE8_MEMBER(pcg_w); - DECLARE_READ8_MEMBER(fbuf_r); - DECLARE_WRITE8_MEMBER(fbuf_w); - DECLARE_READ8_MEMBER(key_r); - DECLARE_WRITE8_MEMBER(key_w); - DECLARE_WRITE8_MEMBER(border_col_w); - DECLARE_READ8_MEMBER(system_input_r); - DECLARE_WRITE8_MEMBER(system_output_w); - DECLARE_WRITE8_MEMBER(color_mode_w); - DECLARE_WRITE8_MEMBER(ramdac_w); - DECLARE_READ8_MEMBER(display_reg_r); - DECLARE_WRITE8_MEMBER(display_reg_w); - DECLARE_READ8_MEMBER(smc777_mem_r); - DECLARE_WRITE8_MEMBER(smc777_mem_w); - DECLARE_READ8_MEMBER(irq_mask_r); - DECLARE_WRITE8_MEMBER(irq_mask_w); - DECLARE_PALETTE_INIT(smc777); - UINT32 screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); - - DECLARE_READ8_MEMBER(fdc_r); - DECLARE_WRITE8_MEMBER(fdc_w); - DECLARE_READ8_MEMBER(fdc_request_r); - DECLARE_WRITE8_MEMBER(floppy_select_w); - DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - -protected: - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - -private: - required_device m_maincpu; - required_device m_crtc; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_beeper; - required_device m_gfxdecode; - required_device m_palette; - - UINT8 *m_ipl_rom; - UINT8 *m_work_ram; - UINT8 *m_vram; - UINT8 *m_attr; - UINT8 *m_gvram; - UINT8 *m_pcg; - - UINT8 m_keyb_press; - UINT8 m_keyb_press_flag; - UINT8 m_shift_press_flag; - UINT8 m_backdrop_pen; - UINT8 m_display_reg; - UINT8 m_fdc_irq_flag; - UINT8 m_fdc_drq_flag; - UINT8 m_system_data; - struct { UINT8 r,g,b; } m_pal; - UINT8 m_raminh,m_raminh_pending_change; //bankswitch - UINT8 m_raminh_prefetch; - UINT8 m_irq_mask; - UINT8 m_pal_mode; - UINT8 m_keyb_cmd; - UINT8 m_crtc_vreg[0x20]; - UINT8 m_crtc_addr; -}; - - -/* TODO: correct calculation thru mc6845 regs */ -#define CRTC_MIN_X 24*8 -#define CRTC_MIN_Y 4*8 - -void smc777_state::video_start() -{ -} - -UINT32 smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,yi; - UINT16 count; - int x_width; - -// popmessage("%d %d %d %d",mc6845_v_char_total,mc6845_v_total_adj,mc6845_v_display,mc6845_v_sync_pos); - - bitmap.fill(m_palette->pen(m_backdrop_pen), cliprect); - - x_width = ((m_display_reg & 0x80) >> 7); - - count = 0x0000; - - for(yi=0;yi<8;yi++) - { - for(y=0;y<200;y+=8) - { - for(x=0;x<160;x++) - { - UINT16 color; - - color = (m_gvram[count] & 0xf0) >> 4; - /* todo: clean this up! */ - //if(x_width) - { - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = m_palette->pen(color); - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = m_palette->pen(color); - } - //else - //{ - // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+0+CRTC_MIN_X) = m_palette->pen(color); - //} - - color = (m_gvram[count] & 0x0f) >> 0; - //if(x_width) - { - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = m_palette->pen(color); - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = m_palette->pen(color); - } - //else - //{ - // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+1+CRTC_MIN_X) = m_palette->pen(color); - //} - - count++; - - } - } - count+= 0x60; - } - - count = 0x0000; - - for(y=0;y<25;y++) - { - for(x=0;x<80/(x_width+1);x++) - { - /* - -x-- ---- blink - --xx x--- bg color (00 transparent, 01 white, 10 black, 11 complementary to fg color - ---- -xxx fg color - */ - int tile = m_vram[count]; - int color = m_attr[count] & 7; - int bk_color = (m_attr[count] & 0x18) >> 3; - int blink = m_attr[count] & 0x40; - int xi; - int bk_pen; - //int bk_struct[4] = { -1, 0x10, 0x11, (color & 7) ^ 8 }; - - bk_pen = -1; - switch(bk_color & 3) - { - case 0: bk_pen = -1; break; //transparent - case 1: bk_pen = 0x17; break; //white - case 2: bk_pen = 0x10; break; //black - case 3: bk_pen = (color ^ 0xf); break; //complementary - } - - if(blink && machine().first_screen()->frame_number() & 0x10) //blinking, used by Dragon's Alphabet - color = bk_pen; - - for(yi=0;yi<8;yi++) - { - for(xi=0;xi<8;xi++) - { - int pen; - - pen = ((m_pcg[tile*8+yi]>>(7-xi)) & 1) ? (color+m_pal_mode) : bk_pen; - - if (pen != -1) - { - if(x_width) - { - bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+0+CRTC_MIN_X) = m_palette->pen(pen); - bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+1+CRTC_MIN_X) = m_palette->pen(pen); - } - else - bitmap.pix16(y*8+CRTC_MIN_Y+yi, x*8+CRTC_MIN_X+xi) = m_palette->pen(pen); - } - } - } - - // draw cursor - if(mc6845_cursor_addr == count) - { - int xc,yc,cursor_on; - - cursor_on = 0; - switch(mc6845_cursor_y_start & 0x60) - { - case 0x00: cursor_on = 1; break; //always on - case 0x20: cursor_on = 0; break; //always off - case 0x40: if(machine().first_screen()->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink - case 0x60: if(machine().first_screen()->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink - } - - if(cursor_on) - { - for(yc=0;yc<(8-(mc6845_cursor_y_start & 7));yc++) - { - for(xc=0;xc<8;xc++) - { - if(x_width) - { - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+0+CRTC_MIN_X) = m_palette->pen(0x7); - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+1+CRTC_MIN_X) = m_palette->pen(0x7); - } - else - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = m_palette->pen(0x7); - } - } - } - } - - (m_display_reg & 0x80) ? count+=2 : count++; - } - } - - return 0; -} - -WRITE8_MEMBER(smc777_state::mc6845_w) -{ - if(offset == 0) - { - m_crtc_addr = data; - m_crtc->address_w(space, 0,data); - } - else - { - m_crtc_vreg[m_crtc_addr] = data; - m_crtc->register_w(space, 0,data); - } -} - -READ8_MEMBER(smc777_state::vram_r) -{ - UINT16 vram_index; - - vram_index = ((offset & 0x0007) << 8); - vram_index |= ((offset & 0xff00) >> 8); - - return m_vram[vram_index]; -} - -READ8_MEMBER(smc777_state::attr_r) -{ - UINT16 vram_index; - - vram_index = ((offset & 0x0007) << 8); - vram_index |= ((offset & 0xff00) >> 8); - - return m_attr[vram_index]; -} - -READ8_MEMBER(smc777_state::pcg_r) -{ - UINT16 vram_index; - - vram_index = ((offset & 0x0007) << 8); - vram_index |= ((offset & 0xff00) >> 8); - - return m_pcg[vram_index]; -} - -WRITE8_MEMBER(smc777_state::vram_w) -{ - UINT16 vram_index; - - vram_index = ((offset & 0x0007) << 8); - vram_index |= ((offset & 0xff00) >> 8); - - m_vram[vram_index] = data; -} - -WRITE8_MEMBER(smc777_state::attr_w) -{ - UINT16 vram_index; - - vram_index = ((offset & 0x0007) << 8); - vram_index |= ((offset & 0xff00) >> 8); - - m_attr[vram_index] = data; -} - -WRITE8_MEMBER(smc777_state::pcg_w) -{ - UINT16 vram_index; - - vram_index = ((offset & 0x0007) << 8); - vram_index |= ((offset & 0xff00) >> 8); - - m_pcg[vram_index] = data; - - m_gfxdecode->gfx(0)->mark_dirty(vram_index >> 3); -} - -READ8_MEMBER(smc777_state::fbuf_r) -{ - UINT16 vram_index; - - vram_index = ((offset & 0x007f) << 8); - vram_index |= ((offset & 0xff00) >> 8); - - return m_gvram[vram_index]; -} - -WRITE8_MEMBER(smc777_state::fbuf_w) -{ - UINT16 vram_index; - - vram_index = ((offset & 0x00ff) << 8); - vram_index |= ((offset & 0xff00) >> 8); - - m_gvram[vram_index] = data; -} - -READ8_MEMBER( smc777_state::fdc_r ) -{ - return m_fdc->read(space, offset) ^ 0xff; -} - -WRITE8_MEMBER( smc777_state::fdc_w ) -{ - m_fdc->write(space, offset, data ^ 0xff); -} - -READ8_MEMBER( smc777_state::fdc_request_r ) -{ - UINT8 data = 0; - - data |= !m_fdc_drq_flag << 6; - data |= m_fdc_irq_flag << 7; - - return data; -} - -WRITE8_MEMBER( smc777_state::floppy_select_w ) -{ - floppy_image_device *floppy = NULL; - - // ---- xxxx select floppy drive (yes, 15 of them, A to P) - switch (data & 0x01) - { - case 0: floppy = m_floppy0->get_device(); break; - case 1: floppy = m_floppy1->get_device(); break; - } - - m_fdc->set_floppy(floppy); - - // no idea where the motor on signal is - if (floppy) - floppy->mon_w(0); - - if(data & 0xf0) - printf("floppy access %02x\n", data); -} - -WRITE_LINE_MEMBER( smc777_state::fdc_intrq_w ) -{ - m_fdc_irq_flag = state; -} - -WRITE_LINE_MEMBER( smc777_state::fdc_drq_w ) -{ - m_fdc_drq_flag = state; -} - -READ8_MEMBER(smc777_state::key_r) -{ - /* - -x-- ---- shift key - ---- -x-- MCU data ready - ---- ---x handshake bit? - */ - - switch(m_keyb_cmd) - { - case 0x00: //poll keyboard input - { - if(offset == 0) - m_keyb_press_flag = 0; - - return (offset == 0) ? m_keyb_press : ((m_shift_press_flag << 6) | (m_keyb_press_flag << 2) | (m_keyb_press_flag)); - } - default: - { - //if(offset == 1) - // printf("Unknown keyboard command %02x read-back\n",m_keyb_cmd); - - return (offset == 0) ? 0x00 : (machine().rand() & 0x5); - } - } - - // never executed - //return 0x00; -} - -/* TODO: the packet commands strikes me as something I've already seen before, don't remember where however ... */ -WRITE8_MEMBER(smc777_state::key_w) -{ - if(offset == 1) //keyboard command - m_keyb_cmd = data; - else - { - // keyboard command param - } -} - -WRITE8_MEMBER(smc777_state::border_col_w) -{ - if(data & 0xf0) - printf("Special border color enabled %02x\n",data); - - m_backdrop_pen = data & 0xf; -} - - -READ8_MEMBER(smc777_state::system_input_r) -{ - printf("System FF R %02x\n",m_system_data & 0x0f); - - switch(m_system_data & 0x0f) - { - case 0x00: - return ((m_raminh & 1) << 4); //unknown bit, Dragon's Alphabet and Bird Crush relies on this for correct colors - } - - return m_system_data; -} - - - -WRITE8_MEMBER(smc777_state::system_output_w) -{ - /* - ---x 0000 ram inibit signal - ---x 1001 beep - all the rest is unknown at current time - */ - m_system_data = data; - switch(m_system_data & 0x0f) - { - case 0x00: - m_raminh_pending_change = ((data & 0x10) >> 4) ^ 1; - m_raminh_prefetch = (UINT8)(space.device().state().state_int(Z80_R)) & 0x7f; - break; - case 0x02: printf("Interlace %s\n",data & 0x10 ? "on" : "off"); break; - case 0x05: m_beeper->set_state(data & 0x10); break; - default: printf("System FF W %02x\n",data); break; - } -} - -WRITE8_MEMBER(smc777_state::color_mode_w) -{ - switch(data & 0x0f) - { - case 0x06: m_pal_mode = (data & 0x10) ^ 0x10; break; - default: printf("Color FF %02x\n",data); break; - } -} - -WRITE8_MEMBER(smc777_state::ramdac_w) -{ - UINT8 pal_index; - pal_index = (offset & 0xf00) >> 8; - - if(data & 0x0f) - printf("RAMdac used with data bits 0-3 set (%02x)\n",data); - - switch((offset & 0x3000) >> 12) - { - case 0: m_pal.r = (data & 0xf0) >> 4; m_palette->set_pen_color(pal_index, pal4bit(m_pal.r), pal4bit(m_pal.g), pal4bit(m_pal.b)); break; - case 1: m_pal.g = (data & 0xf0) >> 4; m_palette->set_pen_color(pal_index, pal4bit(m_pal.r), pal4bit(m_pal.g), pal4bit(m_pal.b)); break; - case 2: m_pal.b = (data & 0xf0) >> 4; m_palette->set_pen_color(pal_index, pal4bit(m_pal.r), pal4bit(m_pal.g), pal4bit(m_pal.b)); break; - case 3: printf("RAMdac used with gradient index = 3! pal_index = %02x data = %02x\n",pal_index,data); break; - } -} - -READ8_MEMBER(smc777_state::display_reg_r) -{ - return m_display_reg; -} - -/* x */ -WRITE8_MEMBER(smc777_state::display_reg_w) -{ - /* - x--- ---- width 80 / 40 switch (0 = 640 x 200 1 = 320 x 200) - ---- -x-- mode select? - */ - - m_display_reg = data; -} - -READ8_MEMBER(smc777_state::smc777_mem_r) -{ - UINT8 z80_r; - - if(m_raminh_prefetch != 0xff) //do the bankswitch AFTER that the prefetch instruction is executed (FIXME: this is an hackish implementation) - { - z80_r = (UINT8)space.device().state().state_int(Z80_R); - - if(z80_r == ((m_raminh_prefetch+2) & 0x7f)) - { - m_raminh = m_raminh_pending_change; - m_raminh_prefetch = 0xff; - } - } - - if(m_raminh == 1 && ((offset & 0xc000) == 0)) - return m_ipl_rom[offset]; - - return m_work_ram[offset]; -} - -WRITE8_MEMBER(smc777_state::smc777_mem_w) -{ - m_work_ram[offset] = data; -} - -READ8_MEMBER(smc777_state::irq_mask_r) -{ - return m_irq_mask; -} - -WRITE8_MEMBER(smc777_state::irq_mask_w) -{ - if(data & 0xfe) - printf("Irq mask = %02x\n",data & 0xfe); - - m_irq_mask = data & 1; -} - -static ADDRESS_MAP_START( smc777_mem, AS_PROGRAM, 8, smc777_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_READWRITE(smc777_mem_r, smc777_mem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( smc777_io, AS_IO, 8, smc777_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x07) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(vram_r, vram_w) - AM_RANGE(0x08, 0x0f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(attr_r, attr_w) - AM_RANGE(0x10, 0x17) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(pcg_r, pcg_w) - AM_RANGE(0x18, 0x19) AM_MIRROR(0xff00) AM_WRITE(mc6845_w) - AM_RANGE(0x1a, 0x1b) AM_MIRROR(0xff00) AM_READWRITE(key_r, key_w) - AM_RANGE(0x1c, 0x1c) AM_MIRROR(0xff00) AM_READWRITE(system_input_r, system_output_w) -// AM_RANGE(0x1d, 0x1d) system and control read, printer strobe write -// AM_RANGE(0x1e, 0x1f) rs232 irq control - AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_READWRITE(display_reg_r, display_reg_w) - AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_READWRITE(irq_mask_r, irq_mask_w) -// AM_RANGE(0x22, 0x22) printer output data - AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_WRITE(border_col_w) -// AM_RANGE(0x24, 0x24) rtc write address -// AM_RANGE(0x25, 0x25) rtc read -// AM_RANGE(0x26, 0x26) rs232 #1 -// AM_RANGE(0x28, 0x2c) fdc #2 -// AM_RANGE(0x2d, 0x2f) rs232 #2 - AM_RANGE(0x30, 0x33) AM_MIRROR(0xff00) AM_READWRITE(fdc_r, fdc_w) - AM_RANGE(0x34, 0x34) AM_MIRROR(0xff00) AM_READWRITE(fdc_request_r, floppy_select_w) -// AM_RANGE(0x35, 0x37) rs232 #3 -// AM_RANGE(0x38, 0x3b) cache disk unit -// AM_RANGE(0x3c, 0x3d) rgb superimposer -// AM_RANGE(0x40, 0x47) ieee-488 -// AM_RANGE(0x48, 0x4f) hdd (winchester) - AM_RANGE(0x51, 0x51) AM_MIRROR(0xff00) AM_READ_PORT("JOY_1P") AM_WRITE(color_mode_w) - AM_RANGE(0x52, 0x52) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_WRITE(ramdac_w) - AM_RANGE(0x53, 0x53) AM_MIRROR(0xff00) AM_DEVWRITE("sn1", sn76489a_device, write) -// AM_RANGE(0x54, 0x59) vrt controller -// AM_RANGE(0x5a, 0x5b) ram banking -// AM_RANGE(0x70, 0x70) auto-start rom -// AM_RANGE(0x74, 0x74) ieee-488 rom -// AM_RANGE(0x75, 0x75) vrt controller rom -// AM_RANGE(0x7e, 0x7f) kanji rom - AM_RANGE(0x80, 0xff) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(fbuf_r, fbuf_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( smc777 ) - PORT_START("key0") //0x00-0x07 - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - - PORT_START("key1") //0x08-0x0f - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ PAD") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* PAD") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- PAD") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ PAD") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER PAD") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". PAD") PORT_CODE(KEYCODE_DEL_PAD) - - PORT_START("key2") //0x10-0x17 - PORT_BIT (0x01, IP_ACTIVE_HIGH,IPT_UNUSED) // PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT (0x02, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT (0x04, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT (0x08, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT (0x10, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT (0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT (0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT (0x80, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("key3") //0x18-0x1f - PORT_BIT (0x01, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT (0x02, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT (0x04, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT (0x08, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT (0x10, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT (0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT (0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT (0x80, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("key4") //0x20-0x27 - PORT_BIT (0x01, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT (0x02, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT (0x04, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT (0x08, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT (0x10, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT (0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT (0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT (0x80, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("key5") //0x28-0x2f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-1") /* TODO: labels */ - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-1") - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-2") - - PORT_START("key6") //0x30-0x37 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("key7") //0x38-0x3f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /* TODO: labels */ - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") - - PORT_START("key8") //0x40-0x47 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) - PORT_BIT(0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - /* TODO: control inputs */ - - PORT_START("key9") //0x40-0x47 - /* TODO: cursor inputs */ - PORT_BIT(0x01, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CURSOR UP") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x02, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CURSOR DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x04, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CURSOR LEFT") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CURSOR RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x10, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x20, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("END") PORT_CODE(KEYCODE_END) - PORT_BIT(0x40, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PGUP") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x80, IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PGDOWN") PORT_CODE(KEYCODE_PGDN) - - PORT_START("keya") //0x48-0x4f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - - PORT_START("key_mod") - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KANA SHIFT") PORT_CODE(KEYCODE_LALT) - - - #if 0 - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") - #endif - - PORT_START("JOY_1P") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNKNOWN ) //status? -INPUT_PORTS_END - -/* - Keyboard data: - kana lock |= 0x80 - numpad 0 to 9 = 0x30 - 0x39 - / pad = 0x2f - * pad = 0x2a - - pad = 0x2d - + pad = 0x2b - ENTER pad = 0x0d - . pad = 0x2e - enter = 0x0d - space = 0x20 - backspace = 0x08 - CTRL (TAB?) = 0x09 - cursor up = 0x17 - cursor down = 0x1c - cursor left = 0x16 - cursor right = 0x19 - 0 to 9 -> 0x30 to 0x39 - S + 0 = 0x29 - S + 1 = 0x21 - S + 2 = 0x40 - S + 3 = 0x23 - S + 4 = 0x24 - S + 5 = 0x25 - S + 6 = 0x5e - S + 7 = 0x26 - S + 8 = 0x2a - S + 9 = 0x28 - F1 = 0x01 / 0x15 - F2 = 0x02 / 0x18 - F3 = 0x04 / 0x12 - F4 = 0x06 / 0x05 - F5 = 0x0b / 0x03 - ESC = 0x1b - INS = 0x0f - DEL = 0x11 - PG UP = 0x12 - PG DOWN = 0x03 - HOME = 0x14 - END = 0x0e - ' = 0x2d / 0x5f - "P" row 1 ] = 0x5d / 0x7d - "P" row 2 ' / ~ = 0x60 / 0x7e - "L" row 1 ; / : = 0x3b / 0x3a - "L" row 2 = (unused) - "L" row 3 Yen / | = 0x5c / 0x7c - "M" row 1 , / < = 0x2c / 0x3c - "M" row 2 . / > = 0x2e / 0x3e - "M" row 3 / / ? = 0x2f / 0x3f -*/ - -static const UINT8 smc777_keytable[2][0xa0] = -{ - /* normal*/ - { - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* numpad */ - 0x38, 0x39, 0x2f, 0x2a, 0x2d, 0x2b, 0x0d, 0x2e, - 0xff, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* A - G */ - 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* H - O */ - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* P - W */ - 0x78, 0x79, 0x7a, 0x2d, 0x5d, 0x60, 0xff, 0xff, /* X - Z */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0 - 7*/ - 0x38, 0x39, 0x3b, 0x5c, 0x2c, 0x2e, 0x2f, 0xff, /* 8 - 9 */ - 0x0d, 0x20, 0x08, 0x09, 0x1b, 0x0f, 0x11, 0xff, - 0x17, 0x1c, 0x16, 0x19, 0x14, 0x0e, 0x12, 0x03, - 0x01, 0x02, 0x04, 0x06, 0x0b, 0xff, 0xff, 0xff, - - }, - /* shift */ - { - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* numpad */ - 0x38, 0x39, 0x2f, 0x2a, 0x2d, 0x2b, 0x0d, 0x2e, - 0xff, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* H - O */ - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* P - W */ - 0x58, 0x59, 0x5a, 0x5f, 0x7d, 0x7e, 0xff, 0xff, /* X - Z */ - 0x29, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, - 0x2a, 0x28, 0x3a, 0x7c, 0x3c, 0x3e, 0x3f, 0xff, - 0x0d, 0x20, 0x08, 0x09, 0x1b, 0x0f, 0x11, 0xff, - 0x17, 0x1c, 0x16, 0x19, 0x14, 0x0e, 0x12, 0x03, - 0x15, 0x18, 0x12, 0x05, 0x03, 0xff, 0xff, 0xff, /* F1 - F5 */ - } -}; - -TIMER_DEVICE_CALLBACK_MEMBER(smc777_state::keyboard_callback) -{ - static const char *const portnames[11] = { "key0","key1","key2","key3","key4","key5","key6","key7", "key8", "key9", "keya" }; - int i,port_i,scancode; - UINT8 shift_mod = ioport("key_mod")->read() & 1; - UINT8 kana_mod = ioport("key_mod")->read() & 0x10; - scancode = 0; - - for(port_i=0;port_i<11;port_i++) - { - for(i=0;i<8;i++) - { - if((ioport(portnames[port_i])->read()>>i) & 1) - { - m_keyb_press = smc777_keytable[shift_mod & 1][scancode]; - if(kana_mod) { m_keyb_press|=0x80; } - m_keyb_press_flag = 1; - m_shift_press_flag = shift_mod & 1; - return; - } - scancode++; - } - } -} - -static const gfx_layout smc777_charlayout = -{ - 8, 8, - 0x800 / 8, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -void smc777_state::machine_start() -{ - m_ipl_rom = memregion("ipl")->base(); - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_attr = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_gvram = auto_alloc_array_clear(machine(), UINT8, 0x8000); - m_pcg = auto_alloc_array_clear(machine(), UINT8, 0x800); - - save_pointer(NAME(m_work_ram), 0x10000); - save_pointer(NAME(m_vram), 0x800); - save_pointer(NAME(m_attr), 0x800); - save_pointer(NAME(m_gvram), 0x8000); - save_pointer(NAME(m_pcg), 0x800); - - m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, smc777_charlayout, (UINT8 *)m_pcg, 0, 8, 0))); -} - -void smc777_state::machine_reset() -{ - m_raminh = 1; - m_raminh_pending_change = 1; - m_raminh_prefetch = 0xff; - m_pal_mode = 0x10; - - m_beeper->set_frequency(300); //TODO: correct frequency - m_beeper->set_state(0); -} - - -/* set-up SMC-70 mode colors */ -PALETTE_INIT_MEMBER(smc777_state, smc777) -{ - int i; - - for(i=0x10;i<0x18;i++) - { - UINT8 r,g,b; - - r = (i & 4) >> 2; - g = (i & 2) >> 1; - b = (i & 1) >> 0; - - palette.set_pen_color(i, pal1bit(r),pal1bit(g),pal1bit(b)); - palette.set_pen_color(i+8, pal1bit(0),pal1bit(0),pal1bit(0)); - } -} - - -INTERRUPT_GEN_MEMBER(smc777_state::vblank_irq) -{ - if(m_irq_mask) - device.execute().set_input_line(0,HOLD_LINE); -} - - -static SLOT_INTERFACE_START( smc777_floppies ) - SLOT_INTERFACE("ssdd", FLOPPY_35_SSDD) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( smc777, smc777_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, MASTER_CLOCK) - MCFG_CPU_PROGRAM_MAP(smc777_mem) - MCFG_CPU_IO_MAP(smc777_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", smc777_state, vblank_irq) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(0x400, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 660-1, 0, 220-1) //normal 640 x 200 + 20 pixels for border color - MCFG_SCREEN_UPDATE_DRIVER(smc777_state, screen_update_smc777) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 0x20) // 16 + 8 colors (SMC-777 + SMC-70) + 8 empty entries (SMC-70) - MCFG_PALETTE_INIT_OWNER(smc777_state, smc777) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - - MCFG_MC6845_ADD("crtc", H46505, "screen", MASTER_CLOCK/2) /* unknown clock, hand tuned to get ~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - - // floppy controller - MCFG_MB8876_ADD("fdc", XTAL_1MHz) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(smc777_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(smc777_state, fdc_drq_w)) - - // does it really support 16 of them? - MCFG_FLOPPY_DRIVE_ADD("fdc:0", smc777_floppies, "ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", smc777_floppies, "ssdd", floppy_image_device::default_floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "smc777") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("sn1", SN76489A, MASTER_CLOCK) // unknown clock / divider - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", smc777_state, keyboard_callback, attotime::from_hz(240/32)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( smc777 ) - /* shadow ROM */ - ROM_REGION( 0x10000, "ipl", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "1st", "1st rev.") - ROMX_LOAD( "smcrom.dat", 0x0000, 0x4000, CRC(b2520d31) SHA1(3c24b742c38bbaac85c0409652ba36e20f4687a1), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "2nd", "2nd rev.") - ROMX_LOAD( "smcrom.v2", 0x0000, 0x4000, CRC(c1494b8f) SHA1(a7396f5c292f11639ffbf0b909e8473c5aa63518), ROM_BIOS(2)) - - ROM_REGION( 0x800, "mcu", ROMREGION_ERASEFF ) - ROM_LOAD( "i80xx", 0x000, 0x800, NO_DUMP ) // keyboard mcu, needs decapping -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, smc777, 0, 0, smc777, smc777, driver_device, 0, "Sony", "SMC-777", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/sms.c b/src/mess/drivers/sms.c deleted file mode 100644 index f93674b584c..00000000000 --- a/src/mess/drivers/sms.c +++ /dev/null @@ -1,1017 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Charles MacDonald,Mathis Rosenhauer,Brad Oliver,Michael Luong,Fabio Priuli,Enik Land -/****************************************************************************** - Contributors: - - Marat Fayzullin (MG source) - Charles MacDonald - Mathis Rosenhauer - Brad Oliver - Michael Luong - Wilbert Pol - Fabio Priuli - Enik Land - - To do: - - - SIO interface for Game Gear (needs netplay, I guess) - - Support for other DE-9 compatible controllers, like the Mega Drive 6-Button - that has homebrew software support - - Sega SK-1100 keyboard support for Sega Mark III (sg1000m3 driver) - - Link between two Mark III's through keyboard, supported by F-16 Fighting Falcon - - Mark III expansion slot, used by keyboard and FM Sound Unit - - Verify if the SN76489 chip can be disabled on sg1000m3 and sms1krfm consoles - - Rapid button of smsj, sms1krfm and sms1kr consoles - - Software compatibility flags, by region and/or BIOS - - Samsung modem for Gam*Boy Securities Information Service System - - Sega Demo Unit II (kiosk expansion device) - - SMS 8 slot game changer (kiosk expansion device) - - SMS Disk System (floppy disk drive expansion device) - unreleased - - Emulate SRAM cartridges? (for use with Bock's dump tool) - - The Game Gear SIO hardware is not emulated but has some - placeholders in 'machine/sms.c' - - Changes: - Apr 02 - Added raster palette effects for SMS & GG (ML) - - Added sprite collision (ML) - - Added zoomed sprites (ML) - May 02 - Fixed paging bug (ML) - - Fixed sprite and tile priority bug (ML) - - Fixed bug #66 (ML) - - Fixed bug #78 (ML) - - try to implement LCD persistence emulation for GG (ML) - Jun 10, 02 - Added bios emulation (ML) - Jun 12, 02 - Added PAL & NTSC systems (ML) - Jun 25, 02 - Added border emulation (ML) - Jun 27, 02 - Version bits for Game Gear (bits 6 of port 00) (ML) - Nov-Dec, 05 - Numerous cleanups, fixes, updates (WP) - Mar, 07 - More cleanups, fixes, mapper additions, etc (WP) - --------------------------------------------------------------------------------- - -General compatibility issues on real hardware (not emulation bugs): - -- Some ROMs have issues or don't work when running on a console of different - region; -- Many Japanese, Korean and homebrew ROMs don't have the signature required by - BIOSes of consoles sold overseas; -- Paddle games need to detect the system region as Japanese to work with the - Paddle controller; -- Few games of the ones with FM support need to detect the system region as - Japanese to play FM sound; -- The Light Phaser gun doesn't work with the Japanese SMS; -- There are reports about Light Phaser working on the second Korean SMS - version, and a Korean advert shows support on the first version (Gam*Boy I, - although based on Japanese SMS); -- The Korean SMS versions have Japanese-format cartridge slot, but only on the - first (Gam*Boy I) the region is detected as Japanese; -- Some SMS ROMs don't run when are plugged-in to SMS expansion slot, through - the gender adapter; -- Some SMS ROMs don't run or have issues when are plugged-in to a Game Gear, - through the Master Gear adapter; - --------------------------------------------------------------------------------- - -Sega Master System II -Sega 1990 - -This particular version was manufactured between July 1991 and October 1992 -The PCB is stamped '17 AUG 1991' - -PCB Layout ----------- -171-5922A -(C) SEGA 1990 -IC BD M4Jr. PAL -|----------|------|-----------------------| -| POWER_IN |RF_OUT| IC1 IC2 IC3 | -| | | Z80 BIOS 6264 | -| | | IC9 | -| |------| CXA1145 | -| | -| | -|IC8 | -|7805 | -| |---------------| | -| | CART SLOT | | -| |---------------| | -| | -| | -| PAUSE_SW | -| | -| IC6 IC5 IC4 | -| D4168 315-5246 315-5237 | -| | -| IC7 | -| D4168 | -| | -| POWER_SW JOY1 JOY2 53.2034MHz| -|-----------------------------------------| -Notes: (All ICs shown) - IC1 Z80 - Z0840004PSC Z80 CPU (DIP40). Clock input 3.54689MHz (53.2034/15) - IC2 BIOS - 1M 28-pin mask ROM marked MPR-12808 (DIP28) - IC3 6264 - Samsung KM6264 8k x8 SRAM. Some models have NEC D4168 or Sanyo LC3664 which are compatible (DIP28) - IC4 315-5237 - Custom Sega I/O controller IC (DIP48) - Clocks - Pin 43 - master clock input 53.2034MHz from OSC - Pin 41 - 10.6406MHz (53.2034/5) - Pin 42 - 4.43361MHz (53.2034/12) - IC5 315-5246 - Custom Sega Video Display Processor (VDP) (64 pin flat pack) - The VDP also contains a Texas Instruments SN76489 sound chip - Clocks - Pin 33 - 3.54689MHz (53.2034/15) - Pin 34 - 10.6406MHz (53.2034/5) - Pin 35 - 10.6406MHz (53.2034/5) - Pin 39 - 2.66017MHz (53.2034/20) - IC6/IC7 D4168- NEC D4168 8k x8 SRAM (DIP28) - IC8 7805 - Motorola MC7805 voltage regulator (7v to 25v input, 5v output) - IC9 CXA1145 - Sony CXA1145 RGB to composite video encoder IC (DIP24) - POWER_IN - Power input from AC/DC power pack. System requires 9VDC at 500mA. Center pin is negative and - outer barrel is positive. Note this is opposite to regular DC power packs - RF_OUT - RF modulator with RF signal output to TV - POWER_SW - Power on/off switch - PAUSE_SW - Push button used to pause the game - JOY1/JOY2 - Joystick connectors (DB9) - HSync - 15.5565kHz - VSync - 49.7015Hz - - -Cart PCB Examples ------------------ -Note! There are many more types of PCBs & custom chip matching variations. This document -is not meant to provide all details of every type in existence. Some games have been -found on different types of ROM boards with and without bankswitching hardware. - -Type with no bankswitching hardware - -171-5519 \ no visible difference? -171-5519D/ -|------------------| -||----------| | -|| DIP28 | | -||----------| | -|IC1 | -|------------------| -Notes: - DIP28 - 1M mask ROM (DIP28) at location IC1. Actual ROM type is Fujitsu MB831001 - This ROM has a built-in mapper so no bankswitching chip is required. - The CPU uses pin 22 of the ROM to bankswitch it. - Found in.... - Game Name Sega ROM ID - ----------------------------- - World Grand Prix MPR-11074 - Black Belt MPR-10150 - Ghost House MPR-12586 - - -Types with bankswitching hardware - -171-5713D (uses 315-5235) -171-5838 (uses 315-5365) -171-5893 (uses 315-5365) -|------------------| -| | -| |------------| | -| | SDIP42 | | -| |------------| | -| IC1| -||----------| | -|| DIP32 | | -||----------| | -|IC2 | -|------------------| -Notes: - SDIP42 - Custom Sega bankswitch chip at location IC1. There are several different - types of these chips with different 315-xxxx numbers - These include 315-5235 (DIP42), 315-5208 (DIP28) and 315-5365 (DIP42) and possibly others. - DIP32 - 1MBit/2MBit/4MBit mask ROM (DIP32) at location IC2 - Actual ROM type can be 831000, 831001, 832011, 834000, 834011 - Found in.... - Game Name Sega ROM ID Bank Chip - ----------------------------------------- - Spellcaster MPR-12532-T 315-5365 - Altered Beast MPR-12534 315-5235 - Bubble Bobble MPR-14177 315-5365 - -171-5442 (uses 315-5235) -|--------------------------| -| |----------------| | -| | DIP40 | | -| |----------------|IC2 | -| | -| |------------| | -| | SDIP42 | | -| |------------|IC1 | -|----| |----| - | | - |----------------| -Notes: - SDIP42 - Custom Sega bankswitch chip at location IC1. There are several different - types of these chips with different 315-xxxx numbers - These include 315-5235 (DIP42), 315-5208 (DIP28) and 315-5365 (DIP42) and possibly others. - DIP40 - 2MBit/4Mbit 16-bit mask ROM (DIP40) at location IC2 - Found in.... - Game Name Sega ROM ID Bank Chip - ----------------------------------------- - Space Harrier MPR-10410 315-5235 - -Another ROM board 171-5497 used by Monopoly has 315-5235 DIP42 mapper chip, DIP28 mask ROM, a DIP8 chip (unknown), -DIP28 SRAM (likely 8k) and a 3V coin battery. -Yet another type of ROM board with unknown PCB number used by Phantasy Star has 315-5235 DIP42 mapper chip, DIP32 mask -ROM and DIP28 SRAM (likely 8k) and a 3V coin battery. -Unfortunatley the majority of these ROM boards, ROM types and MPR-xxxxx Sega part numbers are undocumented because they -were mostly dumped from the edge connector without being opened. -Some additional info can be found at http://www.smspower.org/Development/Index -Some excellent SMS documentation can be found at http://cgfm2.emuviews.com/sms.php - --------------------------------------------------------------------------------- -SMS Store Unit memory map for the second CPU: - -0000-3FFF - BIOS -4000-47FF - RAM -8000 - System Control Register (R/W) - Reading: - bit7 - ready (0 = ready, 1 = not ready) - bit6 - active timer bit switch (0 = timer 2, 1 = timer 1) - bit5 - unknown - bit4-bit3 - timer 2 length bit switches (10s-25s) - bit2-bit0 - timer 1 length bit switches (30s-135s) - Writing: - bit7-bit4 - led of selected game to set - bit3 - unknown, 1 seems to be written all the time - bit2 - unknown, 1 seems to be written all the time - bit1 - reset signal for sms cpu, 0 = reset low, 1 = reset high - bit0 - which cpu receives interrupt signals, 0 = sms cpu, 1 = controlling cpu -C000 - Card/Cartridge selction register (W) - bit7-bit4 - slot to select - bit3 - slot type (0 = cartridge, 1 = card ?) - bit2-bit0 - unknown -C400 - ???? (used once) -D800 - Selection buttons #1, 1-8 (R) -DC00 - Selection buttons #2, 9-16 (R) - - ******************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/sn76496.h" -#include "sound/2413intf.h" -#include "video/315_5124.h" -#include "includes/sms.h" - -#include "sms1.lh" - -#define MASTER_CLOCK_PAL 53203425 /* 12 * subcarrier freq. (4.43361875MHz) */ - - -static ADDRESS_MAP_START( sms1_mem, AS_PROGRAM, 8, sms_state ) - AM_RANGE(0x0000, 0xbfff) AM_WRITE(write_cart) - AM_RANGE(0x0000, 0x3fff) AM_READ(read_0000) - AM_RANGE(0x4000, 0x7fff) AM_READ(read_4000) - AM_RANGE(0x8000, 0xbfff) AM_READ(read_8000) - AM_RANGE(0xc000, 0xfff7) AM_READWRITE(read_ram, write_ram) - AM_RANGE(0xfff8, 0xfffb) AM_READWRITE(sms_sscope_r, sms_sscope_w) /* 3-D glasses */ - AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w) /* Bankswitch control */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sms_mem, AS_PROGRAM, 8, sms_state ) - AM_RANGE(0x0000, 0xbfff) AM_WRITE(write_cart) - AM_RANGE(0x0000, 0x3fff) AM_READ(read_0000) - AM_RANGE(0x4000, 0x7fff) AM_READ(read_4000) - AM_RANGE(0x8000, 0xbfff) AM_READ(read_8000) - AM_RANGE(0xc000, 0xfff7) AM_READWRITE(read_ram, write_ram) - AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w) /* Bankswitch control */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sms_store_mem, AS_PROGRAM, 8, smssdisp_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM /* BIOS */ - AM_RANGE(0x4000, 0x47ff) AM_RAM /* RAM */ - AM_RANGE(0x6000, 0x7fff) AM_READ(store_cart_peek) - AM_RANGE(0x8000, 0x8000) AM_READ_PORT("DSW") AM_WRITE(sms_store_control_w) /* Control */ - AM_RANGE(0xc000, 0xc000) AM_READWRITE(sms_store_cart_select_r, sms_store_cart_select_w) /* cartridge/card slot selector */ - AM_RANGE(0xd800, 0xd800) AM_READ_PORT("GAMESEL1") /* Game selector port #1 */ - AM_RANGE(0xdc00, 0xdc00) AM_READ_PORT("GAMESEL2") /* Game selector port #2 */ -ADDRESS_MAP_END - -// I/O ports $3E and $3F do not exist on Mark III -static ADDRESS_MAP_START( sg1000m3_io, AS_IO, 8, sms_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, sms_psg_w) - AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write) - AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1e) AM_READ(sms_input_port_dc_r) - AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x1e) AM_READ(sms_input_port_dd_r) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0e) AM_READ(sms_input_port_dc_r) - AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x0e) AM_READ(sms_input_port_dd_r) - AM_RANGE(0xf0, 0xf0) AM_READWRITE(sms_input_port_dc_r, sms_ym2413_register_port_w) - AM_RANGE(0xf1, 0xf1) AM_READWRITE(sms_input_port_dd_r, sms_ym2413_data_port_w) - AM_RANGE(0xf2, 0xf2) AM_READWRITE(sms_audio_control_r, sms_audio_control_w) - AM_RANGE(0xf3, 0xf3) AM_READ(sms_input_port_dd_r) - AM_RANGE(0xf4, 0xf4) AM_MIRROR(0x02) AM_READ(sms_input_port_dc_r) - AM_RANGE(0xf5, 0xf5) AM_MIRROR(0x02) AM_READ(sms_input_port_dd_r) - AM_RANGE(0xf8, 0xf8) AM_MIRROR(0x06) AM_READ(sms_input_port_dc_r) - AM_RANGE(0xf9, 0xf9) AM_MIRROR(0x06) AM_READ(sms_input_port_dd_r) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( sms_io, AS_IO, 8, sms_state ) - AM_IMPORT_FROM(sg1000m3_io) - AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_mem_control_w) - AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_WRITE(sms_io_control_w) -ADDRESS_MAP_END - - -// It seems the Korean versions do some more strict decoding on the I/O -// addresses. -// At least the mirrors for I/O ports $3E/$3F don't seem to exist there. -// Enri's doc ( http://www43.tok2.com/home/cmpslv/Sms/EnrSms.htm ) about -// the Japanese SMS also doesn't mention them. -// Leaving the mirrors breaks the Korean cartridge bublboky. -static ADDRESS_MAP_START( smsj_io, AS_IO, 8, sms_state ) - AM_IMPORT_FROM(sg1000m3_io) - AM_RANGE(0x3e, 0x3e) AM_WRITE(sms_mem_control_w) - AM_RANGE(0x3f, 0x3f) AM_WRITE(sms_io_control_w) -ADDRESS_MAP_END - - -// The first Korean SMS version also seems to lack I/O port $3F. Games execute -// a region detection procedure that, through that port, sets the mode used by -// the TH bits of port $DD and tests their behavior. The region of the first SMS -// version is detected as Japanese (opposite to the second version). However, -// as it supports Light Phaser games, it doesn't have the same behavior of the -// Japanese SMS. If it had the behavior of other SMS versions, the system -// region would be detected as Export, so it probably lacks the port. -static ADDRESS_MAP_START( sms1kr_io, AS_IO, 8, sms_state ) - AM_IMPORT_FROM(sg1000m3_io) - AM_RANGE(0x3e, 0x3e) AM_WRITE(sms_mem_control_w) -ADDRESS_MAP_END - - -// It seems the mirrors for I/O ports $3E/$3F also don't seem to exist on the -// Game Gear. Leaving the mirrors breaks 'gloc' (it freezes after 1st stage). -static ADDRESS_MAP_START( gg_io, AS_IO, 8, sms_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x00) AM_READ(gg_input_port_00_r) - AM_RANGE(0x01, 0x05) AM_READWRITE(gg_sio_r, gg_sio_w) - AM_RANGE(0x06, 0x06) AM_WRITE(gg_psg_stereo_w) - AM_RANGE(0x3e, 0x3e) AM_WRITE(sms_mem_control_w) - AM_RANGE(0x3f, 0x3f) AM_WRITE(sms_io_control_w) - AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, gg_psg_w) - AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write) - AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write) - AM_RANGE(0xc0, 0xc0) AM_READ(sms_input_port_dc_r) - AM_RANGE(0xc1, 0xc1) AM_READ(sms_input_port_dd_r) - AM_RANGE(0xdc, 0xdc) AM_READ(sms_input_port_dc_r) - AM_RANGE(0xdd, 0xdd) AM_READ(sms_input_port_dd_r) -ADDRESS_MAP_END - - -static INPUT_PORTS_START( sms ) - PORT_START("PAUSE") - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_1) -INPUT_PORTS_END - -static INPUT_PORTS_START( sg1000m3 ) - PORT_INCLUDE( sms ) - - PORT_START("SEGASCOPE") - PORT_CONFNAME( 0x01, 0x00, "SegaScope (3-D Glasses)" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - - PORT_START("SSCOPE_BINOCULAR") - PORT_CONFNAME( 0x03, 0x00, "SegaScope - Binocular Hack" ) PORT_CONDITION("SEGASCOPE", 0x01, EQUALS, 0x01) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, "Left Lens" ) - PORT_CONFSETTING( 0x02, "Right Lens" ) - PORT_CONFSETTING( 0x03, "Both Lens" ) - PORT_BIT( 0x03, 0x00, IPT_UNUSED ) PORT_CONDITION("SEGASCOPE", 0x01, EQUALS, 0x00) -INPUT_PORTS_END - -static INPUT_PORTS_START( sms1 ) - PORT_INCLUDE( sg1000m3 ) - - PORT_START("RESET") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Reset Button") -INPUT_PORTS_END - -static INPUT_PORTS_START( smsj ) - PORT_INCLUDE( sg1000m3 ) - - //PORT_START("RAPID") - //PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Rapid Button") /* Not implemented */ -INPUT_PORTS_END - -static INPUT_PORTS_START( smssdisp ) - // For each peripheral port (for controllers or 3-D glasses), there are sets - // of two connectors wired in parallel on the real hardware. This allows to - // have different controllers, like a pad and a Light Phaser, plugged together - // for a player input, what avoids having to re-plug them every time a game is - // changed to another that requires a different controller. Also, this allows - // 3-D games to be properly watched by two persons at same time. - // For now the driver just uses single input ports. - PORT_INCLUDE( sms1 ) - - PORT_START("DSW") - PORT_DIPNAME( 0x07, 0x07, "Timer 1 length" ) - PORT_DIPSETTING( 0x00, "135s" ) - PORT_DIPSETTING( 0x01, "120s" ) - PORT_DIPSETTING( 0x02, "105s" ) - PORT_DIPSETTING( 0x03, "90s" ) - PORT_DIPSETTING( 0x04, "75s" ) - PORT_DIPSETTING( 0x05, "60s" ) - PORT_DIPSETTING( 0x06, "45s" ) - PORT_DIPSETTING( 0x07, "30s" ) - PORT_DIPNAME( 0x18, 0x18, "Timer 2 length" ) - PORT_DIPSETTING( 0x00, "25s" ) - PORT_DIPSETTING( 0x08, "20s" ) - PORT_DIPSETTING( 0x10, "15s" ) - PORT_DIPSETTING( 0x18, "10s" ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPNAME( 0x40, 0x40, "Select Timer" ) - PORT_DIPSETTING( 0x00, "Timer 2" ) - PORT_DIPSETTING( 0x40, "Timer 1" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // READY, must be high - - PORT_START("GAMESEL1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 03") PORT_CODE(KEYCODE_N) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 02") PORT_CODE(KEYCODE_H) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 01") PORT_CODE(KEYCODE_Y) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 00") PORT_CODE(KEYCODE_6) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 07") PORT_CODE(KEYCODE_M) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 06") PORT_CODE(KEYCODE_J) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 05") PORT_CODE(KEYCODE_U) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 04") PORT_CODE(KEYCODE_7) - - PORT_START("GAMESEL2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 11") PORT_CODE(KEYCODE_COMMA) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 10") PORT_CODE(KEYCODE_K) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 09") PORT_CODE(KEYCODE_I) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 08") PORT_CODE(KEYCODE_8) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 15") PORT_CODE(KEYCODE_STOP) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 14") PORT_CODE(KEYCODE_L) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 13") PORT_CODE(KEYCODE_O) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Game 12") PORT_CODE(KEYCODE_9) -INPUT_PORTS_END - -static INPUT_PORTS_START( gg ) - PORT_START("GG_PORT_DC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("START") - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */ - - PORT_START("PERSISTENCE") - PORT_CONFNAME( 0x01, 0x01, "LCD Persistence Hack" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) -INPUT_PORTS_END - - -WRITE_LINE_MEMBER(sms_state::sms_int_callback) -{ - m_maincpu->set_input_line(0, state); -} - - -static MACHINE_CONFIG_START( sms_ntsc_base, sms_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_53_693175MHz/15) - MCFG_CPU_PROGRAM_MAP(sms_mem) - MCFG_CPU_IO_MAP(sms_io) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("segapsg", SEGAPSG, XTAL_53_693175MHz/15) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SMS_CARTRIDGE_ADD("slot", sms_cart, NULL) - - MCFG_SOFTWARE_LIST_ADD("cart_list","sms") - - MCFG_SMS_CONTROL_PORT_ADD(CONTROL1_TAG, sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl1_th_input)) - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) - - MCFG_SMS_CONTROL_PORT_ADD(CONTROL2_TAG, sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) -MACHINE_CONFIG_END - -/* - For SMS drivers, the ratio between CPU and pixel clocks, set through dividers, is 2/3. The - division that sets the pixel clock, in MCFG_SCREEN_RAW_PARAMS(), results in a remainder - that is discarded internally. Due to this rounding, the cycle time and the screen pixel - time, derived from their clocks, do not longer match (inversely) the exact original ratio - of these clocks. The SMS VDP emulation controls some properties (counters/flags) through - screen timing, that the core calculates based on the emulation time. The VDP properties - are read in the CPU timeslice. When a CPU operation that access the VDP is executed, the - elapsed emulation time is also based on how many CPU cycles have elapsed since start of - the current timeslice. Depending on this amount of CPU cycles, when the core divides the - elapsed time by the pixel time, the obtained pixel count may be less than expected. Flubba's - VDPTest ROM relies on exact results. A workaround is to use an additional macro, for each - driver, that resets the refresh rate, and by consequence the pixel time, without discarding - the remainder of the division. If the core is fixed in the future, the MCFG_SCREEN_REFRESH_RATE - lines after each MCFG_SCREEN_RAW_PARAMS call below can be removed. -*/ - -static MACHINE_CONFIG_DERIVED( sms2_ntsc, sms_ntsc_base ) - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ - SEGA315_5124_WIDTH , SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ - SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) - MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms) - - MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0) - MCFG_SEGA315_5246_SET_SCREEN("screen") - MCFG_SEGA315_5246_IS_PAL(false) - MCFG_SEGA315_5246_INT_CB(WRITELINE(sms_state, sms_int_callback)) - MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( sms1_ntsc, sms_ntsc_base ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses - MCFG_CPU_IO_MAP(sms_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ - SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ - SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) - MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) - - MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD - MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ - SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ - SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) - MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) - - MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD - MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ - SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ - SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) - MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) - - MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1) - - MCFG_DEFAULT_LAYOUT(layout_sms1) - - MCFG_VIDEO_START_OVERRIDE(sms_state,sms1) - MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1) - - MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0) - MCFG_SEGA315_5124_SET_SCREEN("screen") - MCFG_SEGA315_5124_IS_PAL(false) - MCFG_SEGA315_5124_INT_CB(WRITELINE(sms_state, sms_int_callback)) - MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) - - // card and expansion slots, not present in Master System II - MCFG_SMS_CARD_ADD("mycard", sms_cart, NULL) - MCFG_SMS_EXPANSION_ADD("exp", sms_expansion_devices, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( sms_sdisp, sms1_ntsc, smssdisp_state ) - - MCFG_DEVICE_MODIFY("sms_vdp") - MCFG_SEGA315_5124_INT_CB(WRITELINE(smssdisp_state, sms_store_int_callback)) - - MCFG_CPU_ADD("control", Z80, XTAL_53_693175MHz/15) - MCFG_CPU_PROGRAM_MAP(sms_store_mem) - /* Both CPUs seem to communicate with the VDP etc? */ - MCFG_CPU_IO_MAP(sms_io) - - MCFG_DEVICE_REMOVE("mycard") - MCFG_DEVICE_REMOVE("exp") - - MCFG_SMS_CARTRIDGE_ADD("slot2", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot3", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot4", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot5", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot6", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot7", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot8", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot9", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot10", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot11", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot12", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot13", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot14", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot15", sms_cart, NULL) - MCFG_SMS_CARTRIDGE_ADD("slot16", sms_cart, NULL) - - MCFG_SMS_CARD_ADD("slot17", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot18", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot19", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot20", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot21", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot22", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot23", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot24", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot25", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot26", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot27", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot28", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot29", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot30", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot31", sms_cart, NULL) - MCFG_SMS_CARD_ADD("slot32", sms_cart, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( sms_pal_base, sms_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_PAL/15) - MCFG_CPU_PROGRAM_MAP(sms_mem) - MCFG_CPU_IO_MAP(sms_io) - - MCFG_QUANTUM_TIME(attotime::from_hz(50)) - - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PAL/15) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_SMS_CARTRIDGE_ADD("slot", sms_cart, NULL) - - MCFG_SOFTWARE_LIST_ADD("cart_list","sms") - - MCFG_SMS_CONTROL_PORT_ADD(CONTROL1_TAG, sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl1_th_input)) - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) - - MCFG_SMS_CONTROL_PORT_ADD(CONTROL2_TAG, sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sms2_pal, sms_pal_base ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \ - SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ - SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) - MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms) - - MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0) - MCFG_SEGA315_5246_SET_SCREEN("screen") - MCFG_SEGA315_5246_IS_PAL(true) - MCFG_SEGA315_5246_INT_CB(WRITELINE(sms_state, sms_int_callback)) - MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sms1_pal, sms_pal_base ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses - MCFG_CPU_IO_MAP(sms_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \ - SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ - SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) - MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) - - MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \ - SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ - SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) - MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) - - MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \ - SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \ - SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) - MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1) - - MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1) - - MCFG_DEFAULT_LAYOUT(layout_sms1) - - MCFG_VIDEO_START_OVERRIDE(sms_state,sms1) - MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1) - - MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0) - MCFG_SEGA315_5124_SET_SCREEN("screen") - MCFG_SEGA315_5124_IS_PAL(true) - MCFG_SEGA315_5124_INT_CB(WRITELINE(sms_state, sms_int_callback)) - MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) - - // card and expansion slots, not present in Master System II - MCFG_SMS_CARD_ADD("mycard", sms_cart, NULL) - MCFG_SMS_EXPANSION_ADD("exp", sms_expansion_devices, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sms1_kr, sms1_ntsc ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(sms1kr_io) - - MCFG_DEVICE_REMOVE("slot") - MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sms1_krfm, sms1_kr ) - MCFG_SOUND_ADD("ym2413", YM2413, XTAL_53_693175MHz/15) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( smsj, sms1_krfm ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(smsj_io) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sg1000m3, smsj ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(sg1000m3_io) - - // Mark III does not have TH connected. - MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL1_TAG) - MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NULL) - MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL2_TAG) - MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sms2_kr, sms2_ntsc ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(smsj_io) - - MCFG_DEVICE_REMOVE("slot") - MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, NULL) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( gamegear, sms_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_53_693175MHz/15) - MCFG_CPU_PROGRAM_MAP(sms_mem) - MCFG_CPU_IO_MAP(gg_io) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, \ - SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 6*8, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 26*8, \ - SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_192_TBORDER_HEIGHT + 3*8, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_192_TBORDER_HEIGHT + 21*8 ) - MCFG_SCREEN_REFRESH_RATE((double) XTAL_53_693175MHz/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC)) - MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_gamegear) - - MCFG_VIDEO_START_OVERRIDE(sms_state,gamegear) - MCFG_VIDEO_RESET_OVERRIDE(sms_state,gamegear) - - MCFG_DEVICE_ADD("sms_vdp", SEGA315_5378, 0) - MCFG_SEGA315_5378_SET_SCREEN("screen") - MCFG_SEGA315_5378_IS_PAL(false) - MCFG_SEGA315_5378_INT_CB(WRITELINE(sms_state, sms_int_callback)) - MCFG_SEGA315_5378_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") - - MCFG_SOUND_ADD("gamegear", GAMEGEAR, XTAL_53_693175MHz/15) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) - - /* cartridge */ - MCFG_GG_CARTRIDGE_ADD("slot", gg_cart, NULL) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "gamegear") - - MCFG_GG_EXT_PORT_ADD("ext", gg_ext_port_devices, NULL) - MCFG_GG_EXT_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, gg_ext_th_input)) - //MCFG_GG_EXT_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) // only for GG-TV mod -MACHINE_CONFIG_END - - -ROM_START(sms1) - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0xff) - - ROM_REGION(0x20000, "user1", 0) - ROM_SYSTEM_BIOS( 0, "bios13", "US/European BIOS v1.3 (1986)" ) - ROMX_LOAD("mpr-10052.rom", 0x0000, 0x2000, CRC(0072ed54) SHA1(c315672807d8ddb8d91443729405c766dd95cae7), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" ) - ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91e93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "hangon", "US/European BIOS v3.4 with Hang On (1988)" ) - ROMX_LOAD("mpr-11458.rom", 0x0000, 0x20000, CRC(8edf7ac6) SHA1(51fd6d7990f62cd9d18c9ecfc62ed7936169107e), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" ) - ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(e79bb689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "v10", "US Master System BIOS v1.0 (prototype)" ) - ROMX_LOAD("v1.0.bin", 0x0000, 0x2000, CRC(72bec693) SHA1(29091ff60ef4c22b1ee17aa21e0e75bac6b36474), ROM_BIOS(5)) - ROM_SYSTEM_BIOS( 5, "proto", "US Master System Prototype BIOS" ) - ROMX_LOAD("m404prot.rom", 0x0000, 0x2000, CRC(1a15dfcc) SHA1(4a06c8e66261611dce0305217c42138b71331701), ROM_BIOS(6)) -ROM_END - -ROM_START(sms) - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0xff) - - ROM_REGION(0x20000, "user1", 0) - ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" ) - ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(cf4a09ea) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1)) /* "SEGA // MPR-12808 W63 // 9114E9004" @ IC2 */ -ROM_END - -ROM_START(smssdisp) - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0x00) - - ROM_REGION(0x4000, "user1", 0) - ROM_FILL(0x0000, 0x4000, 0xff) - - ROM_REGION(0x4000, "control", 0) - ROM_LOAD("smssdisp.rom", 0x0000, 0x4000, CRC(ee2c29ba) SHA1(fc465122134d95363112eb51b9ab71db3576cefd)) -ROM_END - -ROM_START(sms1pal) - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0xff) - - ROM_REGION(0x20000, "user1", 0) - ROM_SYSTEM_BIOS( 0, "bios13", "US/European BIOS v1.3 (1986)" ) - ROMX_LOAD("mpr-10052.rom", 0x0000, 0x2000, CRC(0072ed54) SHA1(c315672807d8ddb8d91443729405c766dd95cae7), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "bios20", "European BIOS v2.0 (198?)" ) - ROMX_LOAD("mpr-10883.rom", 0x0000, 0x2000, CRC(b3d854f8) SHA1(fc7eb9141f38c92bf98d9134816f64b45e811112), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" ) - ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91e93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "hangon", "Sega Master System - US/European BIOS v3.4 with Hang On (1988)" ) - ROMX_LOAD("mpr-11458.rom", 0x0000, 0x20000, CRC(8edf7ac6) SHA1(51fd6d7990f62cd9d18c9ecfc62ed7936169107e), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" ) - ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(e79bb689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(5)) -ROM_END - -ROM_START(smspal) - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0xff) - - ROM_REGION(0x40000, "user1", 0) - ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" ) /* PCB Label: SEGA // IC BD M4Jr. PAL" Master System II with 314-5246 (ZIP) VDP and 314-5237 (DIP48) IO */ - ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(cf4a09ea) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1)) /* "SEGA // MPR-12808 W63 // 9114E9004" @ IC2 */ - ROM_SYSTEM_BIOS( 1, "sonic", "European/Brazilian BIOS with Sonic the Hedgehog (1991)" ) - ROMX_LOAD("sonbios.rom", 0x0000, 0x40000, CRC(81c3476b) SHA1(6aca0e3dffe461ba1cb11a86cd4caf5b97e1b8df), ROM_BIOS(2)) -ROM_END - -ROM_START(sg1000m3) - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0x00) -ROM_END - -ROM_START(smsj) /* PCB Label: "SEGA(R) IC BOARD M4J MAIN // 837-6418"; has "YM2413 // 78 04 71 G" at IC10; Back of pcb has traces marked "171-5541 (C)SEGA 1987 MADE IN JAPAN" - see http://www.smspower.org/Development/JapaneseSMS837-6418 */ - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0xff) - - ROM_REGION(0x4000, "user1", 0) - ROM_SYSTEM_BIOS( 0, "jbios21", "Japanese BIOS v2.1 (1987)" ) - ROMX_LOAD("mpr-11124.ic2", 0x0000, 0x2000, CRC(48d44a13) SHA1(a8c1b39a2e41137835eda6a5de6d46dd9fadbaf2), ROM_BIOS(1)) /* "SONY 7J06 // MPR-11124 // JAPAN 021" @ IC2 */ -ROM_END - -ROM_START(smskr) - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0xff) - - ROM_REGION(0x20000, "user1", 0) - ROM_SYSTEM_BIOS( 0, "akbioskr", "Samsung Gam*Boy II with Alex Kidd in Miracle World (1990)" ) - ROMX_LOAD("akbioskr.rom", 0x000, 0x20000, CRC(9c5bad91) SHA1(2feafd8f1c40fdf1bd5668f8c5c02e5560945b17), ROM_BIOS(1)) -ROM_END - -ROM_START(gamegear) - ROM_REGION(0x4000, "maincpu", 0) - ROM_FILL(0x0000, 0x4000, 0x00) - - ROM_REGION(0x0400, "user1", 0) - ROM_SYSTEM_BIOS( 0, "none", "No BIOS" ) /* gamegear */ - ROM_SYSTEM_BIOS( 1, "majesco", "Majesco BIOS" ) /* gamg */ - ROMX_LOAD("majbios.rom", 0x0000, 0x0400, CRC(0ebea9d4) SHA1(914aa165e3d879f060be77870d345b60cfeb4ede), ROM_BIOS(2)) -ROM_END - -#define rom_gamegeaj rom_gamegear -#define rom_sms1krfm rom_smsj -#define rom_sms1kr rom_smsj - -/*************************************************************************** - - Game driver(s) - - US - - Sega Master System (I) (sms1) - - prototype (M404) bios - 1986 - - without built-in game v1.3 - 1986 - - built-in Hang On/Safari Hunt v2.4 - 1988 - - built-in Hang On v3.4 - 1988 - - built-in Missile Defense 3-D v4.4 - 1988 - - built-in Hang On/Astro Warrior - 19?? - - Sega Master System II (sms) - - built-in Alex Kidd in Miracle World - 1990 - - JP - - Sega SG-1000 Mark III (sg1000m3) - - no bios - 1985 - - Sega Master System (I) (smsj) - - without built-in game v2.1 - 1987 - - KR - - Samsung Gam*Boy (I) - with FM Chip (sms1krfm) - - without built-in game v2.1 - 1989 - - Samsung Gam*Boy (I) (sms1kr) - - without built-in game v2.1 - 19?? - - Samsung Gam*Boy II / Aladdin Boy (smskr) - - built-in Alex Kidd in Miracle World (Korean) - 1991 (GB II) / 1992 (AB) - Note about KR: - - units of Gam*Boy (I) with plug-in AC adaptor have FM and the ones with - built-in AC adaptor do not. - - EU - - Sega Master System (I) (sms1pal) - - without built-in game v1.3 - 1986 - - built-in Hang On/Safari Hunt v2.4 - 1988 - - built-in Hang On v3.4 - 1988 - - built-in Missile Defense 3-D v4.4 - 1988 - - built-in Hang On/Astro Warrior - 19?? - - Sega Master System II (smspal) - - built-in Alex Kidd in Miracle World - 1990 - - built-in Sonic the Hedgehog - 1991 - - BR - - Tec Toy Master System (I) (same as sms1) - - built-in Hang On/Safari Hunt v2.4 - 1989 - - Tec Toy Master System II (same as sms1) - - built-in Alex Kidd in Miracle World - 1991 - - Tec Toy Master System III Compact (same as sms) - - built-in Alex Kidd in Miracle World - 1992 - - built-in Sonic the Hedgehog - 1993 - - built-in World Cup Italia '90 (Super Futebol II) - 1994 - - built-in Hang On/Safari Hunt v2.4 (blue L.Phaser pack) - 1995 - - Tec Toy Master System Super Compact (no driver) - - built-in Alex Kidd in Miracle World - 1993 - - built-in Sonic the Hedgehog - 1993 - - built-in World Cup Italia '90 (Super Futebol II) - 1994 - - Tec Toy Master System Girl (no driver) - - built-in Monica no Castelo do Dragao - 1994 - - built-in Sonic the Hedgehog (T. Monica em O Resgate pack) - 199? - Notes about BR: - - PAL-M has same frequency and line count of NTSC - - Tec Toy later changed its logo twice and its name to Tectoy - - 20XX models (Handy, Collection, Evolution...) likely have SoC hardware - - These are coin-operated machines (stuff for MAME): - - - Sega Game Box 9 - - Sega Mark III Soft Desk 5 - - Sega Mark III Soft Desk 10 - - Sega Shooting Zone - - The SMS Store Display Unit is labeled PD-W UNIT. Pictures found on Internet - show cartridges with a label where a not-for-sale message is written along - the information that it is for use on the Product Display-Working Unit. - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -CONS( 1985, sg1000m3, sms, 0, sg1000m3, sg1000m3, sms_state, sg1000m3, "Sega", "SG-1000 Mark III", MACHINE_SUPPORTS_SAVE ) -CONS( 1986, sms1, sms, 0, sms1_ntsc, sms1, sms_state, sms1, "Sega", "Master System I", MACHINE_SUPPORTS_SAVE ) -CONS( 1986, sms1pal, sms, 0, sms1_pal, sms1, sms_state, sms1, "Sega", "Master System I (PAL)" , MACHINE_SUPPORTS_SAVE ) -CONS( 1986, smssdisp, sms, 0, sms_sdisp, smssdisp, smssdisp_state, smssdisp, "Sega", "Master System Store Display Unit", MACHINE_SUPPORTS_SAVE ) -CONS( 1987, smsj, sms, 0, smsj, smsj, sms_state, smsj, "Sega", "Master System (Japan)", MACHINE_SUPPORTS_SAVE ) -CONS( 1990, sms, 0, 0, sms2_ntsc, sms, sms_state, sms1, "Sega", "Master System II", MACHINE_SUPPORTS_SAVE ) -CONS( 1990, smspal, sms, 0, sms2_pal, sms, sms_state, sms1, "Sega", "Master System II (PAL)", MACHINE_SUPPORTS_SAVE ) -CONS( 1989, sms1krfm, sms, 0, sms1_krfm, smsj, sms_state, sms1krfm, "Samsung", "Gam*Boy I - FM (Korea)", MACHINE_SUPPORTS_SAVE ) -CONS( 19??, sms1kr, sms, 0, sms1_kr, smsj, sms_state, sms1kr, "Samsung", "Gam*Boy I (Korea)", MACHINE_SUPPORTS_SAVE ) -CONS( 1991, smskr, sms, 0, sms2_kr, sms, sms_state, smskr, "Samsung", "Gam*Boy II (Korea)", MACHINE_SUPPORTS_SAVE ) - -CONS( 1991, gamegear, 0, sms, gamegear, gg, sms_state, gamegear, "Sega", "Game Gear (Europe/America)", MACHINE_SUPPORTS_SAVE ) -CONS( 1990, gamegeaj, gamegear, 0, gamegear, gg, sms_state, gamegeaj, "Sega", "Game Gear (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/snes.c b/src/mess/drivers/snes.c deleted file mode 100644 index 0032bfbf997..00000000000 --- a/src/mess/drivers/snes.c +++ /dev/null @@ -1,1396 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, R. Belmont, Anthony Kruize, Fabio Priuli -/*************************************************************************** - - snes.c - - Driver file to handle emulation of the Nintendo Super NES. - - Based on original MESS driver by Lee Hammerton (aka Savoury Snax), - later contributions by - R. Belmont - Anthony Kruize - Angelo Salese - Fabio Priuli - byuu (extensive RE of both SNES and add-on chips) - - - Todo (in no particular order): - - Fix sync between 5A22, SPC700 and PPU - - Fix remaining sound and video bugs - - Fix vertical mosaic effects - - Add support for real CX4 and ST018 CPUs - - Add support for SA-1 and SuperGB add-ons - - Fix superscope support - - Add support for other controllers - -***************************************************************************/ - -#include "emu.h" -#include "audio/snes_snd.h" -#include "cpu/spc700/spc700.h" -#include "includes/snes.h" -#include "machine/snescx4.h" - -#include "bus/snes/snes_slot.h" -#include "bus/snes/snes_carts.h" -#include "bus/snes_ctrl/ctrl.h" - -class snes_console_state : public snes_state -{ -public: - snes_console_state(const machine_config &mconfig, device_type type, const char *tag) - : snes_state(mconfig, type, tag) - , m_ctrl1(*this, "ctrl1") - , m_ctrl2(*this, "ctrl2") - , m_cartslot(*this, "snsslot") - { } - - DECLARE_READ8_MEMBER( snes20_hi_r ); - DECLARE_WRITE8_MEMBER( snes20_hi_w ); - DECLARE_READ8_MEMBER( snes20_lo_r ); - DECLARE_WRITE8_MEMBER( snes20_lo_w ); - DECLARE_READ8_MEMBER( snes21_lo_r ); - DECLARE_WRITE8_MEMBER( snes21_lo_w ); - DECLARE_READ8_MEMBER( snes21_hi_r ); - DECLARE_WRITE8_MEMBER( snes21_hi_w ); - DECLARE_READ8_MEMBER( snessfx_hi_r ); - DECLARE_READ8_MEMBER( snessfx_lo_r ); - DECLARE_WRITE8_MEMBER( snessfx_hi_w ); - DECLARE_WRITE8_MEMBER( snessfx_lo_w ); - DECLARE_READ8_MEMBER( snessa1_hi_r ); - DECLARE_READ8_MEMBER( snessa1_lo_r ); - DECLARE_WRITE8_MEMBER( snessa1_hi_w ); - DECLARE_WRITE8_MEMBER( snessa1_lo_w ); - DECLARE_READ8_MEMBER( snes7110_hi_r ); - DECLARE_READ8_MEMBER( snes7110_lo_r ); - DECLARE_WRITE8_MEMBER( snes7110_hi_w ); - DECLARE_WRITE8_MEMBER( snes7110_lo_w ); - DECLARE_READ8_MEMBER( snessdd1_lo_r ); - DECLARE_WRITE8_MEMBER( snessdd1_lo_w ); - DECLARE_READ8_MEMBER( snessdd1_hi_r ); - DECLARE_WRITE8_MEMBER( snessdd1_hi_w ); - DECLARE_READ8_MEMBER( snesbsx_hi_r ); - DECLARE_WRITE8_MEMBER( snesbsx_hi_w ); - DECLARE_READ8_MEMBER( snesbsx_lo_r ); - DECLARE_WRITE8_MEMBER( snesbsx_lo_w ); - DECLARE_READ8_MEMBER( snessgb_hi_r ); - DECLARE_READ8_MEMBER( snessgb_lo_r ); - DECLARE_WRITE8_MEMBER( snessgb_hi_w ); - DECLARE_WRITE8_MEMBER( snessgb_lo_w ); - DECLARE_READ8_MEMBER( pfest94_hi_r ); - DECLARE_WRITE8_MEMBER( pfest94_hi_w ); - DECLARE_READ8_MEMBER( pfest94_lo_r ); - DECLARE_WRITE8_MEMBER( pfest94_lo_w ); - - DECLARE_READ8_MEMBER( spc_ram_100_r ); - DECLARE_WRITE8_MEMBER( spc_ram_100_w ); - TIMER_CALLBACK_MEMBER( lightgun_tick ); - - // input related - SNESCTRL_ONSCREEN_CB(onscreen_cb); - SNESCTRL_GUNLATCH_CB(gun_latch_cb); - virtual DECLARE_WRITE8_MEMBER(io_read); - virtual UINT8 oldjoy1_read(int latched); - virtual UINT8 oldjoy2_read(int latched); - virtual void write_joy_latch(UINT8 data); - virtual void wrio_write(UINT8 data); - - virtual void machine_start(); - virtual void machine_reset(); - int m_type; - required_device m_ctrl1; - required_device m_ctrl2; - optional_device m_cartslot; -}; - - -/************************************* - * - * Memory handlers - * - *************************************/ - -// SPC access - -READ8_MEMBER(snes_console_state::spc_ram_100_r ) -{ - return m_spc700->spc_ram_r(space, offset + 0x100); -} - -WRITE8_MEMBER(snes_console_state::spc_ram_100_w ) -{ - m_spc700->spc_ram_w(space, offset + 0x100, data); -} - -// Memory access for the various types of carts - -//--------------------------------------------------------------------------------- -// LoROM & LoROM + BSX slot & LoROM + some add-on chips -//--------------------------------------------------------------------------------- - -// In general LoROM games have perfect mirror between 0x00-0x7d and 0x80-0xff -// But BSX+LoROM games use different read handlers (to access ROM beyond 2MB) -// so we use two different set of handlers... - -// Also we have here LoROM + CX4, until the Hitachi CPU is emulated, -// and the LoROM + Seta DSP, because their chip_read/chip_write need global offset - -READ8_MEMBER( snes_console_state::snes20_hi_r ) -{ - UINT16 address = offset & 0xffff; - - // take care of add-on IO - if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) - && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) - return m_cartslot->chip_read(space, offset); - else if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) - && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) - return m_cartslot->chip_read(space, offset); - else if (m_cartslot->get_type() == SNES_CX4 - && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU - return CX4_read((offset & 0xffff) - 0x6000); - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - return snes_r_io(space, address); - else if (address < 0x8000) - return snes_open_bus_r(space, 0); - else - return m_cartslot->read_h(space, offset); - } - else if (offset < 0x700000) - { - if (address < 0x8000) - return snes_open_bus_r(space, 0); - else - return m_cartslot->read_h(space, offset); - } - else - { - if (m_type == SNES_SUFAMITURBO && address >= 0x8000 && offset < 0x740000) - return m_cartslot->read_h(space, offset); - - // here usually there is SRAM mirrored in the whole range, but if ROM is very large then arrives here too (see tokimeki and wizardg4) - if (m_cartslot->m_cart->get_rom_size() > 0x200000 && address >= 0x8000) - return m_cartslot->read_h(space, offset); - else - { - if (m_cartslot->m_cart->get_nvram_size() > 0x8000) - { - // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc. - offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff); - return m_cartslot->read_ram(space, offset); - } - else if (m_cartslot->m_cart->get_nvram_size() > 0) - return m_cartslot->read_ram(space, offset); - else - return snes_open_bus_r(space, 0); - } - } -} - -WRITE8_MEMBER( snes_console_state::snes20_hi_w ) -{ - UINT16 address = offset & 0xffff; - - // take care of add-on IO - if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) - && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) - { m_cartslot->chip_write(space, offset, data); return; } - else if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) - && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) - { m_cartslot->chip_write(space, offset, data); return; } - else if (m_cartslot->get_type() == SNES_CX4 - && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU - { CX4_write(space.machine(), (offset & 0xffff) - 0x6000, data); return; } - else if (m_type == SNES_SUFAMITURBO - && address >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000))) - { m_cartslot->write_h(space, offset, data); return; } - - if (offset < 0x400000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - snes_w_io(space, address, data); - } - else if (offset >= 0x700000 && (m_cartslot->m_cart->get_rom_size() <= 0x200000 || address < 0x8000)) // NVRAM access - { - if (m_cartslot->m_cart->get_nvram_size() > 0x8000) - { - // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc. - offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff); - m_cartslot->write_ram(space, offset, data); - } - else if (m_cartslot->m_cart->get_nvram_size() > 0) - m_cartslot->write_ram(space, offset, data); - } -} - -READ8_MEMBER( snes_console_state::snes20_lo_r ) -{ - UINT16 address = offset & 0xffff; - - // take care of add-on IO - if ((m_cartslot->get_type() == SNES_ST010 /*|| m_cartslot->get_type() == SNES_ST011*/) // why does this break moritash? - && (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000)) - return m_cartslot->chip_read(space, offset); - else if ((m_cartslot->get_type() == SNES_ST010 || m_cartslot->get_type() == SNES_ST011) - && (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000)) - return m_cartslot->chip_read(space, offset); - else if (m_cartslot->get_type() == SNES_CX4 - && (offset < 0x400000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)) // hack until we emulate the real CPU - return CX4_read((offset & 0xffff) - 0x6000); - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - return snes_r_io(space, address); - else if (address < 0x8000) - return snes_open_bus_r(space, 0); - else - return m_cartslot->read_l(space, offset); - } - else if (offset < 0x700000) - { - if (address < 0x8000) - return snes_open_bus_r(space, 0); - else - return m_cartslot->read_l(space, offset); - } - else - { - if (m_type == SNES_SUFAMITURBO && address >= 0x8000 && offset < 0x740000) - return m_cartslot->read_l(space, offset); - - // here usually there is SRAM mirrored in the whole range, but if ROM is very large then arrives here too (see tokimeki and wizardg4) - if (m_cartslot->m_cart->get_rom_size() > 0x200000 && address >= 0x8000) - return m_cartslot->read_l(space, offset); - else - { - if (m_cartslot->m_cart->get_nvram_size() > 0x8000) - { - // In this case, SRAM is mapped in 0x8000 chunks at diff offsets: 0x700000-0x707fff, 0x710000-0x717fff, etc. - offset = ((offset - 0x700000) / 0x10000) * 0x8000 + (offset & 0x7fff); - return m_cartslot->read_ram(space, offset); - } - else if (m_cartslot->m_cart->get_nvram_size() > 0) - return m_cartslot->read_ram(space, offset); - else - return snes_open_bus_r(space, 0); - } - } -} - -WRITE8_MEMBER( snes_console_state::snes20_lo_w ) -{ - if (m_type == SNES_SUFAMITURBO - && (offset & 0xffff) >= 0x8000 && ((offset >= 0x600000 && offset < 0x640000) || (offset >= 0x700000 && offset < 0x740000))) - { m_cartslot->write_l(space, offset, data); return; } - - // other add-on writes matches the hi handler - snes20_hi_w(space, offset, data, 0xff); -} - - -//--------------------------------------------------------------------------------- -// HiROM & HiROM + BSX slot -//--------------------------------------------------------------------------------- - -READ8_MEMBER( snes_console_state::snes21_lo_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000 && address < 0x8000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - return snes_r_io(space, address); - else - { - if (m_type == SNES_BSXHI && m_cartslot->m_cart->get_nvram_size() && offset >= 0x200000) - { - int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; - return m_cartslot->read_ram(space, (offset - 0x6000) & mask); - } - - if (m_cartslot->m_cart->get_nvram_size() && offset >= 0x300000) - { - /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ - /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */ - int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */ - return m_cartslot->read_ram(space, (offset - 0x6000) & mask); - } - else - return snes_open_bus_r(space, 0); - } - } - - // ROM access - return m_cartslot->read_l(space, offset); -} - -WRITE8_MEMBER( snes_console_state::snes21_lo_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000 && address < 0x8000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - snes_w_io(space, address, data); - else - { - if (m_type == SNES_BSXHI && m_cartslot->m_cart->get_nvram_size() && offset >= 0x200000) - { - int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; - m_cartslot->write_ram(space, (offset - 0x6000) & mask, data); - return; - } - if (m_cartslot->m_cart->get_nvram_size() && offset >= 0x300000) - { - /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ - /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */ - int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */ - m_cartslot->write_ram(space, (offset - 0x6000) & mask, data); - } - } - } -} - -READ8_MEMBER( snes_console_state::snes21_hi_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000 && address < 0x8000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - return snes_r_io(space, address); - else - { - if (m_type == SNES_BSXHI && m_cartslot->m_cart->get_nvram_size() && offset >= 0x200000) - { - int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; - return m_cartslot->read_ram(space, (offset - 0x6000) & mask); - } - - if (m_cartslot->m_cart->get_nvram_size() && offset >= 0x300000) - { - /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ - /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */ - int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */ - return m_cartslot->read_ram(space, (offset - 0x6000) & mask); - } - else - return snes_open_bus_r(space, 0); - } - } - - // ROM access - return m_cartslot->read_h(space, offset); -} - -WRITE8_MEMBER( snes_console_state::snes21_hi_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000 && address < 0x8000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - snes_w_io(space, address, data); - else - { - if (m_type == SNES_BSXHI && m_cartslot->m_cart->get_nvram_size() && offset >= 0x200000) - { - int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; - m_cartslot->write_ram(space, (offset - 0x6000) & mask, data); - return; - } - if (m_cartslot->m_cart->get_nvram_size() && offset >= 0x300000) - { - /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */ - /* OTOH Secret of Mana does not work properly if sram is not mirrored on later banks */ - int mask = (m_cartslot->m_cart->get_nvram_size() - 1) & 0x7fff; /* Limit SRAM size to what's actually present */ - m_cartslot->write_ram(space, (offset - 0x6000) & mask, data); - } - } - } -} - -//--------------------------------------------------------------------------------- -// LoROM + SuperFX / GSU -//--------------------------------------------------------------------------------- - -READ8_MEMBER( snes_console_state::snessfx_hi_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - if (address >= 0x3000 && address < 0x3300) - return m_cartslot->chip_read(space, offset); - else - return snes_r_io(space, address); - } - else if (address < 0x8000) - return m_cartslot->read_ram(space, offset & 0x1fff); - else - return m_cartslot->read_h(space, offset); - } - else if (offset < 0x600000) - return m_cartslot->read_h(space, offset); - else - return m_cartslot->read_ram(space, offset); -} - -READ8_MEMBER( snes_console_state::snessfx_lo_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - if (address >= 0x3000 && address < 0x3300) - return m_cartslot->chip_read(space, offset); - else - return snes_r_io(space, address); - } - else if (address < 0x8000) - return m_cartslot->read_ram(space, offset & 0x1fff); - else - return m_cartslot->read_l(space, offset); - } - else if (offset < 0x600000) - return m_cartslot->read_l(space, offset); - else - return m_cartslot->read_ram(space, offset); -} - -WRITE8_MEMBER( snes_console_state::snessfx_hi_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - { - if (address >= 0x3000 && address < 0x3300) - m_cartslot->chip_write(space, offset, data); - else - snes_w_io(space, address, data); - } - else if (address < 0x8000) - m_cartslot->write_ram(space, offset & 0x1fff, data); - } - else if (offset >= 0x600000) - m_cartslot->write_ram(space, offset, data); -} - -WRITE8_MEMBER( snes_console_state::snessfx_lo_w ) -{ - snessfx_hi_w(space, offset, data, 0xff); -} - -//--------------------------------------------------------------------------------- -// LoROM + SA-1 -//--------------------------------------------------------------------------------- - -READ8_MEMBER( snes_console_state::snessa1_hi_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - if (address >= 0x2200 && address < 0x2400) - return m_cartslot->chip_read(space, offset); // SA-1 Regs - else if (address >= 0x3000 && address < 0x3800) - return m_cartslot->chip_read(space, offset); // Internal SA-1 RAM (2K) - else - return snes_r_io(space, address); - } - else if (address < 0x8000) - return m_cartslot->chip_read(space, offset); // SA-1 BWRAM - else - return m_cartslot->read_h(space, offset); - } - else - return m_cartslot->read_h(space, offset); -} - -READ8_MEMBER( snes_console_state::snessa1_lo_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - if (address >= 0x2200 && address < 0x2400) - return m_cartslot->chip_read(space, offset); // SA-1 Regs - else if (address >= 0x3000 && address < 0x3800) - return m_cartslot->chip_read(space, offset); // Internal SA-1 RAM (2K) - else - return snes_r_io(space, address); - } - else if (address < 0x8000) - return m_cartslot->chip_read(space, offset); // SA-1 BWRAM - else - return m_cartslot->read_l(space, offset); - } - else if (offset < 0x500000) - return m_cartslot->chip_read(space, offset); // SA-1 BWRAM (not mirrored above!) - else - return snes_r_io(space, address); // nothing mapped here! -} - -WRITE8_MEMBER( snes_console_state::snessa1_hi_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - { - if (address >= 0x2200 && address < 0x2400) - m_cartslot->chip_write(space, offset, data); // SA-1 Regs - else if (address >= 0x3000 && address < 0x3800) - m_cartslot->chip_write(space, offset, data); // Internal SA-1 RAM (2K) - else - snes_w_io(space, address, data); - } - else if (address < 0x8000) - m_cartslot->chip_write(space, offset, data); // SA-1 BWRAM - } -} - -WRITE8_MEMBER( snes_console_state::snessa1_lo_w ) -{ - if (offset >= 0x400000 && offset < 0x500000) - m_cartslot->chip_write(space, offset, data); // SA-1 BWRAM (not mirrored above!) - else - snessa1_hi_w(space, offset, data, 0xff); -} - -//--------------------------------------------------------------------------------- -// HiROM + SPC-7110 -//--------------------------------------------------------------------------------- - -READ8_MEMBER( snes_console_state::snes7110_hi_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - UINT16 limit = (m_cartslot->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840; - if (address >= 0x4800 && address < limit) - return m_cartslot->chip_read(space, address); - - return snes_r_io(space, address); - } - else if (address < 0x8000) - { - if (offset < 0x10000) - return m_cartslot->read_ram(space, offset); - if (offset >= 0x300000 && offset < 0x310000) - return m_cartslot->read_ram(space, offset); - } - else - return m_cartslot->read_h(space, offset); - } - return m_cartslot->read_h(space, offset); -} - -READ8_MEMBER( snes_console_state::snes7110_lo_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - UINT16 limit = (m_cartslot->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840; - if (address >= 0x4800 && address < limit) - return m_cartslot->chip_read(space, address); - - return snes_r_io(space, address); - } - else if (address < 0x8000) - { - if (offset < 0x10000) - return m_cartslot->read_ram(space, offset); - if (offset >= 0x300000 && offset < 0x310000) - return m_cartslot->read_ram(space, offset); - } - else - return m_cartslot->read_l(space, offset); - } - if (offset >= 0x500000 && offset < 0x510000) - return m_cartslot->chip_read(space, 0x4800); - - return snes_open_bus_r(space, 0); -} - -WRITE8_MEMBER( snes_console_state::snes7110_hi_w ) -{ - snes7110_lo_w(space, offset, data, 0xff); -} - -WRITE8_MEMBER( snes_console_state::snes7110_lo_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - { - UINT16 limit = (m_cartslot->get_type() == SNES_SPC7110_RTC) ? 0x4843 : 0x4840; - if (address >= 0x4800 && address < limit) - { - m_cartslot->chip_write(space, address, data); - return; - } - snes_w_io(space, address, data); - } - else if (address < 0x8000) - { - if (offset < 0x10000) - m_cartslot->write_ram(space, offset, data); - if (offset >= 0x300000 && offset < 0x310000) - m_cartslot->write_ram(space, offset, data); - } - } -} - - -//--------------------------------------------------------------------------------- -// LoROM + S-DD1 -//--------------------------------------------------------------------------------- - -READ8_MEMBER( snes_console_state::snessdd1_lo_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - if (address >= 0x4800 && address < 0x4808) - return m_cartslot->chip_read(space, address); - - return snes_r_io(space, address); - } - else if (address < 0x8000) - return snes_open_bus_r(space, 0); - else - return m_cartslot->read_l(space, offset); - } - else if (offset >= 0x700000 && address < 0x8000 && m_cartslot->m_cart->get_nvram_size()) // NVRAM access - return m_cartslot->read_ram(space, offset); - else // ROM access - return m_cartslot->read_l(space, offset); -} - -READ8_MEMBER( snes_console_state::snessdd1_hi_r ) -{ - if (offset >= 0x400000) - return m_cartslot->read_h(space, offset); - else - return snessdd1_lo_r(space, offset, 0xff); -} - -WRITE8_MEMBER( snes_console_state::snessdd1_lo_w ) -{ - snessdd1_hi_w(space, offset, data, 0xff); -} - -WRITE8_MEMBER( snes_console_state::snessdd1_hi_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - { - if (address >= 0x4300 && address < 0x4380) - { - m_cartslot->chip_write(space, address, data); - // here we don't return, but we let the w_io happen... - } - if (address >= 0x4800 && address < 0x4808) - { - m_cartslot->chip_write(space, address, data); - return; - } - snes_w_io(space, address, data); - } - } - if (offset >= 0x700000 && address < 0x8000 && m_cartslot->m_cart->get_nvram_size()) - return m_cartslot->write_ram(space, offset, data); -} - - -//--------------------------------------------------------------------------------- -// LoROM + BS-X (Base unit) -//--------------------------------------------------------------------------------- - -READ8_MEMBER( snes_console_state::snesbsx_hi_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - if (address >= 0x2188 && address < 0x21a0) - return m_cartslot->chip_read(space, offset); - if (address >= 0x5000) - return m_cartslot->chip_read(space, offset); - return snes_r_io(space, address); - } - else if (address < 0x8000) - { - if (offset >= 0x200000) - return m_cartslot->read_h(space, offset); - else - return snes_open_bus_r(space, 0); - } - else - return m_cartslot->read_h(space, offset); - } - return m_cartslot->read_h(space, offset); -} - -WRITE8_MEMBER( snes_console_state::snesbsx_hi_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - { - if (address >= 0x2188 && address < 0x21a0) - { - m_cartslot->chip_write(space, offset, data); - return; - } - if (address >= 0x5000) - { - m_cartslot->chip_write(space, offset, data); - return; - } - snes_w_io(space, address, data); - } - else if (address < 0x8000) - { - if (offset >= 0x200000) - return m_cartslot->write_l(space, offset, data); - } - else - return m_cartslot->write_l(space, offset, data); - } - return m_cartslot->write_l(space, offset, data); -} - -READ8_MEMBER( snes_console_state::snesbsx_lo_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - { - if (address >= 0x2188 && address < 0x21a0) - return m_cartslot->chip_read(space, offset); - if (address >= 0x5000) - return m_cartslot->chip_read(space, offset); - return snes_r_io(space, address); - } - else if (address < 0x8000) - { - if (offset >= 0x200000) - return m_cartslot->read_l(space, offset); - else - return snes_open_bus_r(space, 0); - } - else - return m_cartslot->read_l(space, offset); - } - return m_cartslot->read_l(space, offset); -} - -WRITE8_MEMBER( snes_console_state::snesbsx_lo_w ) -{ - snesbsx_hi_w(space, offset, data, 0xff); -} - - -//--------------------------------------------------------------------------------- -// LoROM + SuperGB -//--------------------------------------------------------------------------------- - -READ8_MEMBER( snes_console_state::snessgb_hi_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - return snes_r_io(space, address); - else if (address < 0x8000) - return m_cartslot->chip_read(space, offset); - else - return m_cartslot->read_h(space, offset); - } - else if (address >= 0x8000) - return m_cartslot->read_h(space, offset); - - return snes_open_bus_r(space, 0); -} - -READ8_MEMBER( snes_console_state::snessgb_lo_r ) -{ - return snessgb_hi_r(space, offset, 0xff); -} - -WRITE8_MEMBER( snes_console_state::snessgb_hi_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - snes_w_io(space, address, data); - else if (address < 0x8000) - m_cartslot->chip_write(space, offset, data); - } -} - -WRITE8_MEMBER( snes_console_state::snessgb_lo_w ) -{ - snessgb_hi_w(space, offset, data, 0xff); -} - -//--------------------------------------------------------------------------------- -// Powerfest '94 event cart -//--------------------------------------------------------------------------------- - -READ8_MEMBER( snes_console_state::pfest94_hi_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - return snes_r_io(space, address); - else if (address < 0x8000) - { - if (offset < 0x100000) // DSP access - return m_cartslot->chip_read(space, offset); - else if (offset == 0x106000) // menu access - return m_cartslot->chip_read(space, offset + 0x8000); - else if (offset >= 0x300000 && m_cartslot->m_cart->get_nvram_size()) // NVRAM access - return m_cartslot->read_ram(space, offset); - else - return snes_open_bus_r(space, 0); - } - else - return m_cartslot->read_h(space, offset); - } - return m_cartslot->read_h(space, offset); -} - -WRITE8_MEMBER( snes_console_state::pfest94_hi_w ) -{ - UINT16 address = offset & 0xffff; - if (offset < 0x400000) - { - if (address < 0x2000) - space.write_byte(0x7e0000 + address, data); - else if (address < 0x6000) - snes_w_io(space, address, data); - else if (address < 0x8000) - { - if (offset < 0x100000) // DSP access - m_cartslot->chip_write(space, offset, data); - else if (offset == 0x206000) // menu access - m_cartslot->chip_write(space, offset + 0x8000, data); - else if (offset >= 0x300000 && m_cartslot->m_cart->get_nvram_size()) // NVRAM access - m_cartslot->write_ram(space, offset, data); - } - } -} - -READ8_MEMBER( snes_console_state::pfest94_lo_r ) -{ - UINT16 address = offset & 0xffff; - - if (offset < 0x400000) - { - if (address < 0x2000) - return space.read_byte(0x7e0000 + address); - else if (address < 0x6000) - return snes_r_io(space, address); - else if (address < 0x8000) - { - if (offset < 0x100000) // DSP access - return m_cartslot->chip_read(space, offset); - else if (offset == 0x106000) // menu access - return m_cartslot->chip_read(space, offset + 0x8000); - else if (offset >= 0x300000 && m_cartslot->m_cart->get_nvram_size()) // NVRAM access - return m_cartslot->read_ram(space, offset); - else - return snes_open_bus_r(space, 0); - } - else - return m_cartslot->read_l(space, offset); - } - return 0xff; // or open_bus? -} - -WRITE8_MEMBER( snes_console_state::pfest94_lo_w ) -{ - pfest94_hi_w(space, offset, data, 0xff); -} - - -/************************************* - * - * Address maps - * - *************************************/ - -static ADDRESS_MAP_START( snes_map, AS_PROGRAM, 8, snes_console_state ) -// AM_RANGE(0x000000, 0x7dffff) AM_READWRITE(snes20_lo_r, snes20_lo_w) - AM_RANGE(0x7e0000, 0x7fffff) AM_RAM /* 8KB Low RAM, 24KB High RAM, 96KB Expanded RAM */ -// AM_RANGE(0x800000, 0xffffff) AM_READWRITE(snes20_hi_r, snes20_hi_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( spc_map, AS_PROGRAM, 8, snes_console_state ) - AM_RANGE(0x0000, 0x00ef) AM_DEVREADWRITE("spc700", snes_sound_device, spc_ram_r, spc_ram_w) /* lower 32k ram */ - AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE("spc700", snes_sound_device, spc_io_r, spc_io_w) /* spc io */ - AM_RANGE(0x0100, 0xffff) AM_READWRITE(spc_ram_100_r, spc_ram_100_w) -ADDRESS_MAP_END - - -/************************************* - * - * Input ports - * - *************************************/ - -static INPUT_PORTS_START( snes ) - // input devices go through slot options - PORT_START("OPTIONS") - PORT_CONFNAME( 0x01, 0x00, "Hi-Res pixels blurring (TV effect)") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - -#if SNES_LAYER_DEBUG - PORT_START("DEBUG1") - PORT_CONFNAME( 0x03, 0x00, "Select BG1 priority" ) - PORT_CONFSETTING( 0x00, "All" ) - PORT_CONFSETTING( 0x01, "BG1B (lower) only" ) - PORT_CONFSETTING( 0x02, "BG1A (higher) only" ) - PORT_CONFNAME( 0x0c, 0x00, "Select BG2 priority" ) - PORT_CONFSETTING( 0x00, "All" ) - PORT_CONFSETTING( 0x04, "BG2B (lower) only" ) - PORT_CONFSETTING( 0x08, "BG2A (higher) only" ) - PORT_CONFNAME( 0x30, 0x00, "Select BG3 priority" ) - PORT_CONFSETTING( 0x00, "All" ) - PORT_CONFSETTING( 0x10, "BG3B (lower) only" ) - PORT_CONFSETTING( 0x20, "BG3A (higher) only" ) - PORT_CONFNAME( 0xc0, 0x00, "Select BG4 priority" ) - PORT_CONFSETTING( 0x00, "All" ) - PORT_CONFSETTING( 0x40, "BG4B (lower) only" ) - PORT_CONFSETTING( 0x80, "BG4A (higher) only" ) - - PORT_START("DEBUG2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 1") PORT_CODE(KEYCODE_1_PAD) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 2") PORT_CODE(KEYCODE_2_PAD) PORT_TOGGLE - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 3") PORT_CODE(KEYCODE_3_PAD) PORT_TOGGLE - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle BG 4") PORT_CODE(KEYCODE_4_PAD) PORT_TOGGLE - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Objects") PORT_CODE(KEYCODE_5_PAD) PORT_TOGGLE - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Main/Sub") PORT_CODE(KEYCODE_6_PAD) PORT_TOGGLE - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Color Math") PORT_CODE(KEYCODE_7_PAD) PORT_TOGGLE - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Windows") PORT_CODE(KEYCODE_8_PAD) PORT_TOGGLE - - PORT_START("DEBUG3") - PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mosaic") PORT_CODE(KEYCODE_9_PAD) PORT_TOGGLE - PORT_CONFNAME( 0x70, 0x00, "Select OAM priority" ) - PORT_CONFSETTING( 0x00, "All" ) - PORT_CONFSETTING( 0x10, "OAM0 only" ) - PORT_CONFSETTING( 0x20, "OAM1 only" ) - PORT_CONFSETTING( 0x30, "OAM2 only" ) - PORT_CONFSETTING( 0x40, "OAM3 only" ) - PORT_CONFNAME( 0x80, 0x00, "Draw sprite in reverse order" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x80, DEF_STR( On ) ) - - PORT_START("DEBUG4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 0 draw") PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 1 draw") PORT_TOGGLE - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 2 draw") PORT_TOGGLE - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 3 draw") PORT_TOGGLE - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 4 draw") PORT_TOGGLE - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 5 draw") PORT_TOGGLE - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 6 draw") PORT_TOGGLE - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Toggle Mode 7 draw") PORT_TOGGLE -#endif -INPUT_PORTS_END - - -/************************************* - * - * Input callbacks - * - *************************************/ - -WRITE8_MEMBER(snes_console_state::io_read) -{ - // is automatic reading on? if so, read 16bits from oldjoy1/2 - if (SNES_CPU_REG(NMITIMEN) & 1) - { - UINT16 joy1 = 0, joy2 = 0, joy3 = 0, joy4 = 0; - m_ctrl1->port_poll(); - m_ctrl2->port_poll(); - - for (int i = 0; i < 16; i++) - { - joy1 |= ((m_ctrl1->read_pin4() & 1) << (15 - i)); - joy2 |= ((m_ctrl2->read_pin4() & 1) << (15 - i)); - joy3 |= ((m_ctrl1->read_pin5() & 1) << (15 - i)); - joy4 |= ((m_ctrl2->read_pin5() & 1) << (15 - i)); - } - - SNES_CPU_REG(JOY1L) = (joy1 & 0x00ff) >> 0; - SNES_CPU_REG(JOY1H) = (joy1 & 0xff00) >> 8; - SNES_CPU_REG(JOY2L) = (joy2 & 0x00ff) >> 0; - SNES_CPU_REG(JOY2H) = (joy2 & 0xff00) >> 8; - SNES_CPU_REG(JOY3L) = (joy3 & 0x00ff) >> 0; - SNES_CPU_REG(JOY3H) = (joy3 & 0xff00) >> 8; - SNES_CPU_REG(JOY4L) = (joy4 & 0x00ff) >> 0; - SNES_CPU_REG(JOY4H) = (joy4 & 0xff00) >> 8; - } -} - -UINT8 snes_console_state::oldjoy1_read(int latched) -{ - UINT8 ret = 0; - ret |= m_ctrl1->read_pin4(); - ret |= (m_ctrl1->read_pin5() << 1); - return ret; -} - -UINT8 snes_console_state::oldjoy2_read(int latched) -{ - UINT8 ret = 0; - ret |= m_ctrl2->read_pin4(); - ret |= (m_ctrl2->read_pin5() << 1); - return ret; -} - -void snes_console_state::write_joy_latch(UINT8 data) -{ - m_ctrl1->write_strobe(data); - m_ctrl2->write_strobe(data); -} - -void snes_console_state::wrio_write(UINT8 data) -{ - if (!(SNES_CPU_REG(WRIO) & 0x80) && (data & 0x80)) - { - // external latch - m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y()); - } - - m_ctrl1->write_pin6(BIT(data, 6)); - m_ctrl2->write_pin6(BIT(data, 7)); - -} - -SNESCTRL_GUNLATCH_CB(snes_console_state::gun_latch_cb) -{ - // these are the theoretical boundaries - if (x < 0) - x = 0; - if (x > (SNES_SCR_WIDTH - 1)) - x = SNES_SCR_WIDTH - 1; - - if (y < 0) - y = 0; - if (y > (m_ppu->m_beam.last_visible_line - 1)) - y = m_ppu->m_beam.last_visible_line - 1; - -// m_ppu->set_latch_hv(x, y); // it would be more accurate to write twice to WRIO register, first with bit7 = 0 and then with bit7 = 1 - m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y()); -} - -SNESCTRL_ONSCREEN_CB(snes_console_state::onscreen_cb) -{ - // these are the theoretical boundaries, but we currently are always onscreen due to the - // way IPT_LIGHTGUNs work... investigate more on this! - if (x < 0 || x >= SNES_SCR_WIDTH || y < 0 || y >= m_ppu->m_beam.last_visible_line) - return false; - else - return true; -} - - -/************************************* - * - * Machine driver - * - *************************************/ - -void snes_console_state::machine_start() -{ - snes_state::machine_start(); - - if (m_cartslot && m_cartslot->exists()) - { - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes20_lo_r),this), write8_delegate(FUNC(snes_console_state::snes20_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes20_hi_r),this), write8_delegate(FUNC(snes_console_state::snes20_hi_w),this)); - m_maincpu->set_5a22_map(); - - m_type = m_cartslot->get_type(); - - switch (m_type) - { - // LoROM & LoROM + addons - case SNES_MODE20: - case SNES_BSXLO: - case SNES_SUFAMITURBO: - case SNES_CX4: // this still uses the old simulation instead of emulating the CPU - case SNES_ST010: // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w - case SNES_ST011: // this requires two diff kinds of chip access, so we handle it in snes20_lo/hi_r/w - case SNES_ST018: // still unemulated - break; - case SNES_Z80GB: // skeleton support - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessgb_lo_r),this), write8_delegate(FUNC(snes_console_state::snessgb_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessgb_hi_r),this), write8_delegate(FUNC(snes_console_state::snessgb_hi_w),this)); - m_maincpu->set_5a22_map(); - break; - case SNES_SA1: // skeleton support - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessa1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessa1_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessa1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessa1_hi_w),this)); - m_maincpu->set_5a22_map(); - break; - case SNES_DSP: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x208000, 0x20ffff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x208000, 0x20ffff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - break; - case SNES_DSP_2MB: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x600000, 0x607fff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x600000, 0x607fff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - break; - case SNES_DSP4: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x308000, 0x30ffff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x308000, 0x30ffff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - break; - case SNES_OBC1: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - break; - case SNES_SFX: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessfx_lo_r),this), write8_delegate(FUNC(snes_console_state::snessfx_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessfx_hi_r),this), write8_delegate(FUNC(snes_console_state::snessfx_hi_w),this)); - m_maincpu->set_5a22_map(); - break; - case SNES_SDD1: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessdd1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessdd1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_hi_w),this)); - m_maincpu->set_5a22_map(); - break; - case SNES_BSX: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snesbsx_lo_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snesbsx_hi_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_hi_w),this)); - m_maincpu->set_5a22_map(); - break; - // HiROM & HiROM + addons - case SNES_MODE21: - case SNES_BSXHI: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); - m_maincpu->set_5a22_map(); - break; - case SNES_DSP_MODE21: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->set_5a22_map(); - break; - case SNES_SRTC: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->set_5a22_map(); - break; - case SNES_SPC7110: - case SNES_SPC7110_RTC: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes7110_lo_r),this), write8_delegate(FUNC(snes_console_state::snes7110_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes7110_hi_r),this), write8_delegate(FUNC(snes_console_state::snes7110_hi_w),this)); - m_maincpu->set_5a22_map(); - break; - case SNES_PFEST94: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::pfest94_lo_r),this), write8_delegate(FUNC(snes_console_state::pfest94_lo_w),this)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::pfest94_hi_r),this), write8_delegate(FUNC(snes_console_state::pfest94_hi_w),this)); - m_maincpu->set_5a22_map(); - break; - // pirate 'mappers' - case SNES_POKEMON: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x800000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x800000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - break; - case SNES_TEKKEN2: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x8087ff, 0, 0x3f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x8087ff, 0, 0x3f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - break; - case SNES_MCPIR1: - case SNES_MCPIR2: - m_maincpu->space(AS_PROGRAM).install_write_handler(0xffff00, 0xffffff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - break; - case SNES_20COL: - m_maincpu->space(AS_PROGRAM).install_write_handler(0x008000, 0x008fff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); - break; - case SNES_SOULBLAD: - // reads from xxx0-xxx3in range [80-bf] return a fixed sequence of 4bits; reads in range [c0-ff] return open bus - m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x808003, 0, 0x3f7ff0, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0xc00000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes_open_bus_r),this)); - break; - case SNES_BUGS: - case SNES_BANANA: -// m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot)); -// m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot)); -// m_maincpu->set_5a22_map(); - break; - } - m_cartslot->save_ram(); - } -} - -void snes_console_state::machine_reset() -{ - snes_state::machine_reset(); -} - - -static MACHINE_CONFIG_START( snes, snes_console_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", _5A22, MCLK_NTSC) /* 2.68 MHz, also 3.58 MHz */ - MCFG_CPU_PROGRAM_MAP(snes_map) - - MCFG_CPU_ADD("soundcpu", SPC700, 1024000) /* 1.024 MHz */ - MCFG_CPU_PROGRAM_MAP(spc_map) - - //MCFG_QUANTUM_TIME(attotime::from_hz(48000)) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(DOTCLK_NTSC * 2, SNES_HTOTAL * 2, 0, SNES_SCR_WIDTH * 2, SNES_VTOTAL_NTSC, 0, SNES_SCR_HEIGHT_NTSC) - MCFG_SCREEN_UPDATE_DRIVER( snes_state, screen_update ) - - MCFG_DEVICE_ADD("ppu", SNES_PPU, 0) - MCFG_SNES_PPU_OPENBUS_CB(READ8(snes_state, snes_open_bus_r)) - MCFG_VIDEO_SET_SCREEN("screen") - - MCFG_SNES_CONTROL_PORT_ADD("ctrl1", snes_control_port_devices, "joypad") - MCFG_SNESCTRL_ONSCREEN_CB(snes_console_state, onscreen_cb) - MCFG_SNES_CONTROL_PORT_ADD("ctrl2", snes_control_port_devices, "joypad") - MCFG_SNESCTRL_ONSCREEN_CB(snes_console_state, onscreen_cb) - MCFG_SNESCTRL_GUNLATCH_CB(snes_console_state, gun_latch_cb) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("spc700", SNES, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) - - MCFG_SNS_CARTRIDGE_ADD("snsslot", snes_cart, NULL) - MCFG_SOFTWARE_LIST_ADD("cart_list","snes") - MCFG_SOFTWARE_LIST_ADD("bsx_list","snes_bspack") - MCFG_SOFTWARE_LIST_ADD("st_list","snes_strom") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( snespal, snes ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_CLOCK( MCLK_PAL ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_RAW_PARAMS(DOTCLK_PAL, SNES_HTOTAL, 0, SNES_SCR_WIDTH, SNES_VTOTAL_PAL, 0, SNES_SCR_HEIGHT_PAL) -MACHINE_CONFIG_END - - - -/************************************* - * - * ROM definition(s) - * - *************************************/ - -ROM_START( snes ) - ROM_REGION( 0x1000000, "maincpu", ROMREGION_ERASE00 ) - - ROM_REGION( 0x100, "sound_ipl", 0 ) /* IPL ROM */ - ROM_LOAD( "spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) ) /* boot rom */ -ROM_END - -#define rom_snespal rom_snes - -/************************************* - * - * Game driver(s) - * - *************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1989, snes, 0, 0, snes, snes, driver_device, 0, "Nintendo", "Super Nintendo Entertainment System / Super Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -CONS( 1991, snespal, snes, 0, snespal, snes, driver_device, 0, "Nintendo", "Super Nintendo Entertainment System (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/socrates.c b/src/mess/drivers/socrates.c deleted file mode 100644 index ddf88ddc002..00000000000 --- a/src/mess/drivers/socrates.c +++ /dev/null @@ -1,1587 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/****************************************************************************** -* -* V-tech Socrates Driver -* Copyright (C) 2009-2013 Jonathan Gevaryahu AKA Lord Nightmare -* with dumping help from Kevin 'kevtris' Horton -* -* -TODO: - * The speech chip is a Toshiba tc8802AF (which is pin and speech - compatible with the older Toshiba t6803, but adds vsm rom read mode and - apparently does away with the melody mode); the chip is running at - 800khz clock/10khz output with between 1 and 4 t6684F vsm roms - attached; create a sound driver for this! - * fix glitches with keyboard input (double keys still don't work, super painter letter entry still doesn't work) - * hook up hblank (m_hblankstate is inited 0 right now and never changed) - * hook up mouse - * add waitstates for ram access (lack of this causes the system to run - way too fast) - This will require some probing with the LA and the fluke to figure out - how many cycles the waitstates are for for rom/ram/etc access. - * figure out what bit 6 of the status register actually does; is this an - ir mcu flag? - * keyboard IR decoder MCU is HLE'd for now, needs decap and cpu core (it - is rather tms1000 or CIC-like iirc) - - - Socrates Educational Video System - FFFF|----------------| - | RAM (window 1) | - | | - C000|----------------| - | RAM (window 0) | - | | - 8000|----------------| - | ROM (banked) | - | *Cartridge | - 4000|----------------| - | ROM (fixed) | - | | - 0000|----------------| - - * cartridge lives in banks 10 onward, see below - - Banked rom area (4000-7fff) bankswitching - Bankswitching is achieved by writing to I/O port 0 (mirrored on 1-7) - Bank ROM_REGION Contents - 0 0x00000 - 0x03fff System ROM page 0 - 1 0x04000 - 0x07fff System ROM page 1 - 2 0x08000 - 0x0bfff System ROM page 2 - ... etc ... - E 0x38000 - 0x38fff System ROM page E - F 0x3c000 - 0x3ffff System ROM page F - 10 0x40000 - 0x43fff Expansion Cartridge page 0 (cart ROM 0x0000-0x3fff) - 11 0x44000 - 0x47fff Expansion Cartridge page 1 (cart ROM 0x4000-0x7fff) - ... etc ... - - Banked ram area (z80 0x8000-0xbfff window 0 and z80 0xc000-0xffff window 1) - Bankswitching is achieved by writing to I/O port 8 (mirrored to 9-F), only low nybble - byte written: 0b****BBAA - where BB controls ram window 1 and AA controls ram window 0 - hence: - Write [window 0] [window 1] - 0 0x0000-0x3fff 0x0000-0x3fff - 1 0x4000-0x7fff 0x0000-0x3fff - 2 0x8000-0xbfff 0x0000-0x3fff - 3 0xc000-0xffff 0x0000-0x3fff - 4 0x0000-0x3fff 0x4000-0x7fff - 5 0x4000-0x7fff 0x4000-0x7fff - 6 0x8000-0xbfff 0x4000-0x7fff - 7 0xc000-0xffff 0x4000-0x7fff - 8 0x0000-0x3fff 0x8000-0xbfff - 9 0x4000-0x7fff 0x8000-0xbfff - A 0x8000-0xbfff 0x8000-0xbfff - B 0xc000-0xffff 0x8000-0xbfff - C 0x0000-0x3fff 0xc000-0xffff - D 0x4000-0x7fff 0xc000-0xffff - E 0x8000-0xbfff 0xc000-0xffff - F 0xc000-0xffff 0xc000-0xffff - -******************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "cpu/z80/z80.h" -#include "audio/socrates.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -class socrates_state : public driver_device -{ -public: - enum - { - TIMER_CLEAR_SPEECH, - TIMER_CLEAR_IRQ - }; - - socrates_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_sound(*this, "soc_snd"), - m_screen(*this, "screen"), - m_cart(*this, "cartslot"), - m_bios_reg(*this, "maincpu"), - m_vram_reg(*this, "vram") - { } - required_device m_maincpu; - required_device m_sound; - required_device m_screen; - required_device m_cart; - - rgb_t m_palette_val[256]; - - required_memory_region m_bios_reg; - required_memory_region m_vram_reg; - memory_region *m_cart_reg; - - UINT8 m_data[8]; - UINT8 m_rom_bank; - UINT8 m_ram_bank; - UINT16 m_scroll_offset; - UINT8 m_kb_latch_low[2]; - UINT8 m_kb_latch_high[2]; - UINT8 m_kb_latch_mouse; - UINT8 m_kbmcu_rscount; // how many pokes the kbmcu has taken in the last frame - UINT8 m_io40_latch; // what was last written to speech reg (for open bus)? - UINT8 m_hblankstate; // are we in hblank? - UINT8 m_vblankstate; // are we in vblank? - UINT8 m_speech_running; // is speech synth talking? - UINT32 m_speech_address; // address in speech space - UINT8 m_speech_settings; // speech settings (nybble 0: ? externrom ? ?; nybble 1: ? ? ? ?) - UINT8 m_speech_dummy_read; // have we done a dummy read yet? - UINT8 m_speech_load_address_count; // number of times load address has happened - UINT8 m_speech_load_settings_count; // number of times load settings has happened - DECLARE_READ8_MEMBER(socrates_rom_bank_r); - DECLARE_WRITE8_MEMBER(socrates_rom_bank_w); - DECLARE_READ8_MEMBER(socrates_ram_bank_r); - DECLARE_WRITE8_MEMBER(socrates_ram_bank_w); - DECLARE_READ8_MEMBER(read_f3); - DECLARE_WRITE8_MEMBER(kbmcu_strobe); - DECLARE_READ8_MEMBER(status_and_speech); - DECLARE_WRITE8_MEMBER(speech_command); - DECLARE_READ8_MEMBER(socrates_keyboard_low_r); - DECLARE_READ8_MEMBER(socrates_keyboard_high_r); - DECLARE_WRITE8_MEMBER(socrates_keyboard_clear); - DECLARE_WRITE8_MEMBER(reset_speech); - DECLARE_WRITE8_MEMBER(socrates_scroll_w); - DECLARE_WRITE8_MEMBER(socrates_sound_w); - DECLARE_DRIVER_INIT(socrates); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(socrates); - UINT32 screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(assert_irq); - TIMER_CALLBACK_MEMBER(clear_speech_cb); - TIMER_CALLBACK_MEMBER(clear_irq_cb); - void socrates_set_rom_bank(); - void socrates_set_ram_bank(); - void socrates_update_kb(); - void socrates_check_kb_latch(); - rgb_t socrates_create_color(UINT8 color); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -class iqunlim_state : public socrates_state -{ -public: - iqunlim_state(const machine_config &mconfig, device_type type, const char *tag) - : socrates_state(mconfig, type, tag), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4") - { } - - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE8_MEMBER( colors_w ); - DECLARE_READ8_MEMBER( rombank_r ); - DECLARE_WRITE8_MEMBER( rombank_w ); - DECLARE_READ8_MEMBER( rambank_r ); - DECLARE_WRITE8_MEMBER( rambank_w ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_WRITE8_MEMBER( keyboard_clear ); - DECLARE_READ8_MEMBER( video_regs_r ); - DECLARE_WRITE8_MEMBER( video_regs_w ); - DECLARE_READ8_MEMBER( status_r ); - DECLARE_INPUT_CHANGED_MEMBER( send_input ); - -protected: - virtual void machine_start(); - virtual void machine_reset(); - int get_color(int index, int y); - -private: - UINT8 m_rombank[2]; - UINT8 m_rambank; - UINT8 m_colors[8]; - UINT8 m_video_regs[4]; - - struct - { - UINT8 buffer[8]; - int head; - int tail; - } m_kb_queue; -}; - -/* Defines */ - -/* Components */ - -/* Devices */ - -void socrates_state::socrates_set_rom_bank() -{ - if (m_cart_reg && m_rom_bank >= 0x10) - { - int bank = m_rom_bank % (m_cart->get_rom_size() / 0x4000); - membank("bank1")->set_base(m_cart_reg->base() + (bank * 0x4000)); - } - else - membank("bank1")->set_base(m_bios_reg->base() + (m_rom_bank * 0x4000)); -} - -void socrates_state::socrates_set_ram_bank() -{ - membank("bank2")->set_base(m_vram_reg->base() + ( (m_ram_bank & 0x3) * 0x4000)); // window 0 - membank("bank3")->set_base(m_vram_reg->base() + (((m_ram_bank & 0xc) >> 2) * 0x4000)); // window 1 -} - -void socrates_state::socrates_update_kb( ) -{ - static const char *const rownames[] = { "keyboard_40", "keyboard_41", "keyboard_42", "keyboard_43", "keyboard_44" }; - int row, keyvalue, powerof2; - int shift = 0; - // first check that the kb latch[1] is clear; if it isn't, don't touch it! - if ((m_kb_latch_low[1] != 0) || (m_kb_latch_high[1] != 1)) return; - // next check for joypad buttons - keyvalue = ioport("keyboard_jp")->read(); - if (keyvalue != 0) - { - m_kb_latch_low[1] = (keyvalue & 0xFF0)>>4; - m_kb_latch_high[1] = 0x80 | (keyvalue & 0xF); - return; // get out of this function; due to the way key priorities work, we're done here. - } - // next check for mouse movement. - // this isn't written yet, so write me please! - // next check if shift is down - shift = ioport("keyboard_50")->read(); - // find key low and high byte ok keyboard section - for (row = 4; row>=0; row--) - { - keyvalue = ioport(rownames[row])->read(); - if (keyvalue != 0) - { - for (powerof2 = 9; powerof2 >= 0; powerof2--) - { - if ((keyvalue&(1<tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - m_rom_bank = 0xF3; // actually set semi-randomly on real console but we need to initialize it somewhere... - socrates_set_rom_bank(); - m_ram_bank = 0; // the actual console sets it semi randomly on power up, and the bios cleans it up. - socrates_set_ram_bank(); - m_kb_latch_low[0] = 0xFF; - m_kb_latch_high[0] = 0x8F; - m_kb_latch_low[1] = 0x00; - m_kb_latch_high[1] = 0x01; - m_kb_latch_mouse = 0; - m_kbmcu_rscount = 0; - m_io40_latch = 0; - m_hblankstate = 0; - m_vblankstate = 0; - m_speech_running = 0; - m_speech_address = 0; - m_speech_settings = 0; - m_speech_dummy_read = 0; - m_speech_load_address_count = 0; - m_speech_load_settings_count = 0; -} - -void socrates_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_CLEAR_SPEECH: - clear_speech_cb(ptr, param); - break; - case TIMER_CLEAR_IRQ: - clear_irq_cb(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in socrates_state::device_timer"); - } -} - -DRIVER_INIT_MEMBER(socrates_state,socrates) -{ - UINT8 *gfx = memregion("vram")->base(); - - /* fill vram with its init powerup bit pattern, so startup has the checkerboard screen */ - for (int i = 0; i < 0x10000; i++) - gfx[i] = (((i&0x1)?0x00:0xFF)^((i&0x100)?0x00:0xff)); -// init sound channels to both be on lowest pitch and max volume - m_maincpu->set_clock_scale(0.45f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */ -} - -READ8_MEMBER(socrates_state::socrates_rom_bank_r) -{ - return m_rom_bank; -} - -WRITE8_MEMBER(socrates_state::socrates_rom_bank_w) -{ - m_rom_bank = data; - socrates_set_rom_bank(); -} - -READ8_MEMBER(socrates_state::socrates_ram_bank_r) -{ - return m_ram_bank; -} - -WRITE8_MEMBER(socrates_state::socrates_ram_bank_w) -{ - m_ram_bank = data&0xF; - socrates_set_ram_bank(); -} - -READ8_MEMBER(socrates_state::read_f3)// used for read-only i/o ports as mame/mess doesn't have a way to set the unmapped area to read as 0xF3 -{ - return 0xF3; -} - -WRITE8_MEMBER(socrates_state::kbmcu_strobe) // strobe the keyboard MCU -{ - //logerror("0x%04X: kbmcu written with %02X!\n", m_maincpu->pc(), data); //if (m_maincpu->pc() != 0x31D) - // if two writes happen within one frame, reset the keyboard latches - m_kbmcu_rscount++; - if (m_kbmcu_rscount > 1) - { - m_kb_latch_low[0] = 0x00; - m_kb_latch_high[0] = 0x01; - m_kb_latch_low[1] = 0x00; - m_kb_latch_high[1] = 0x01; - m_kb_latch_mouse = 0; - } -} - -READ8_MEMBER(socrates_state::status_and_speech)// read 0x4x, some sort of status reg -{ -// bit 7 - speech status: high when speech is playing, low when it is not (or when speech cart is not present) -// bit 6 - unknown, usually set, may involve the writes to 0x30, possibly some sort of fixed-length timer? -// bit 5 - vblank status, high when not in vblank -// bit 4 - hblank status, high when not in hblank -// bit 3 - speech chip bit 3 -// bit 2 - speech chip bit 2 -// bit 1 - speech chip bit 1 -// bit 0 - speech chip bit 0 -UINT8 *speechromint = memregion("speechint")->base(); -UINT8 *speechromext = memregion("speechext")->base(); - int temp = 0; - temp |= (m_speech_running)?0x80:0; - temp |= 0x40; // unknown, possibly IR mcu busy - temp |= (m_vblankstate)?0:0x20; - temp |= (m_hblankstate)?0:0x10; - switch(m_io40_latch&0xF0) // what was last opcode sent? - { - case 0x60: case 0xE0:// speech status 'read' register - if(m_speech_settings&0x04) // external speech roms (outside of speech ic but still in cart) enabled - { - logerror("reading external speech rom nybble from nybble address %x (byte address %x)\n",m_speech_address, m_speech_address>>1); - temp |= ((speechromext[((m_speech_address>>1)&0xffff)]>>((m_speech_address&1)*4))&0xF); - } - else - { - logerror("reading internal speech rom nybble from nybble address %x (byte address %x)\n",m_speech_address, m_speech_address>>1); - temp |= ((speechromint[((m_speech_address>>1)&0x1fff)]>>((m_speech_address&1)*4))&0xF); - } - if (m_speech_dummy_read == 0) // if we havent done the dummy read yet, do so now - { - m_speech_dummy_read++; - } - else - { - m_speech_address++; - } - break; - default: - temp |= m_io40_latch&0xF; // read open bus - break; - } - logerror("read from i/o 0x4x of %x\n", temp); - return temp; -} - -TIMER_CALLBACK_MEMBER(socrates_state::clear_speech_cb) -{ - m_speech_running = 0; - m_speech_load_address_count = 0; // should this be here or in the write functuon subpart which is speak command? - m_speech_load_settings_count = 0; -} - -WRITE8_MEMBER(socrates_state::speech_command) // write 0x4x -{ - /* - * 76543210 - * |||||||\-- SEL0 - * ||||||\--- SEL1 - * |||||\---- SEL2 - * ||||\----- SEL3 - * |||\------ SEL4 - * ||\------- SEL5 - * |\-------- 64UP (if LOW the chip is in 'dumb' mode and can only play 64 fixed phrases; if HIGH the chip is in 'cpu controlled' mode and commands work) (not 100% sure about this but suspect it is correct) - * \--------- START (in cpu mode must be toggled from low->high for a cpu command to 'take'; in 'dumb' mode must be toggled low->high to start that 'word') - */ - logerror("write to i/o 0x4x of %x\n", data); -/* -// old readback test, probably get rid of this junk: -// 00-0f: readback: 70-7f -// 10-1f: readback: 70-7f -// 20-2f: readback: 70-7f -// 30-3f: readback: 70-7f -// 40-5f: readback: 70-7f -// 50-5f: readback: 70-7f -// 60-6f: readback: ALL 7f -// 70-7f: readback: 50, 71-7f (force vblank?) -// 80-8f: 80 starts speech reads as f0, rest read as 71-7f -// 90-9f: all 70-7f -// a0-af: 70-7f -// b0-bf: 70-7f -// c0-cf: 70-7f -// d0-df: 70-7f -// e0-ef: readback ALL 76 -// f0-ff: 70-7f -*/ -/* The speech chip is a toshiba tc8802, it is NOT a t6803 since the t6803 - does not have the rom read mode, which the socrates definitely uses! */ -/* Commands (tc8802): -SEL 5 4 3 2 1 0 - 0 0 n n n n - ADLD - ADdress LoaD - writes one nybble to the address - of vsm rom selected (internal or external) starting - from the low 4 bits; each subsequent write writes to - the next higher 4 bits; resetting the chip resets - the position - 0 1 n n n n - CNDT - CoNDiTion (aka 'setup') - writes one nybble to the - setting register, starting from the low 4 bits; the - subsequent write will be to the high 4 bits; - resetting the chip will reset the position - - CNDT bits (? are from T6803 datasheet, which could be wrong on the tc8802AF here): - * 76543210 - * |||||||\-- ?bits/frame bit 1 (0 = see bit 2; 1 = 98bits/frame (these may be backwards)) - * ||||||\--- ?melody mode select if high - * |||||\---- speech rom select; 0 is internal 8k mask, 1 is external vsm bus - * ||||\----- ?voiced source select (0 = A; 1 = B) - * |||\------ ?filter stages (0 = lpc-10; 1 = lpc-8) - * ||\------- ?always 0 - * |\-------- ?frame length (0 = 20ms; 1 = 10ms) - * \--------- ?bits/frame bit 2 (if bit 1 is not set: 0 = 56 bits/frame; 1 = 50 bits/frame) - * - 1 0 x x x x - DTRD - DaTa ReaD - reads a nybble from the address as loaded - and increments the address by one nybble. The first - DTRD command after any other commands is a 'dummy - read' which serves to reset the bus direction of the - low 4 SEL lines, identical to the way the TMS5100 - does things. it doesn't affect the bus direction of - the high two SEL lines. - 1 1 0 x x x - START - Starts speech at the address as loaded. - 1 1 1 x x x - RESET - Resets the internal chip state (clears shifters and - counters) and forces speech to end/silence - immediately. -*/ - switch(data&0xF8) - { - case 0x80: case 0x88: case 0x90: case 0x98: case 0xA0: case 0xA8: case 0xB0: case 0xB8: - /* 'dumb' mode speech command: write me: start talking */ - m_speech_running = 1; - timer_set(attotime::from_seconds(4), TIMER_CLEAR_SPEECH); // hack - break; - case 0xC0: case 0xC8: // ADLD: load address to vsm - m_speech_address |= (((int)data&0xF)<<(m_speech_load_address_count*4))<<1; - m_speech_load_address_count++; - logerror("loaded address nybble %X, byte address is currently %5X with %d nybbles loaded\n", data&0xF, m_speech_address>>1, m_speech_load_address_count); - break; - case 0xD0: case 0xD8: // CNDT: load settings - m_speech_settings |= ((data&0xF)<<(m_speech_load_settings_count*4)); - m_speech_load_settings_count++; - break; - case 0xE0: case 0xE8: // DTRD: read byte, handled elsewhere - break; - case 0xF0: // SPEAK - m_speech_running = 1; - timer_set(attotime::from_seconds(4), TIMER_CLEAR_SPEECH); // hack - break; - case 0xF8: // RESET - m_speech_running = 0; - m_speech_address = 0; - m_speech_settings = 0; - m_speech_dummy_read = 0; - m_speech_load_address_count = 0; - m_speech_load_settings_count = 0; - m_io40_latch &= 0x0f; // set last command to 0 to prevent problems - break; - default: // 00 through 70 are packets without the write bit set, ignore them - break; - } - m_io40_latch = data; -} - -READ8_MEMBER(socrates_state::socrates_keyboard_low_r)// keyboard code low -{ - socrates_update_kb(); - socrates_check_kb_latch(); - return m_kb_latch_low[0]; -} - -READ8_MEMBER(socrates_state::socrates_keyboard_high_r)// keyboard code high -{ - socrates_update_kb(); - socrates_check_kb_latch(); - return m_kb_latch_high[0]; -} - -WRITE8_MEMBER(socrates_state::socrates_keyboard_clear)// keyboard latch shift/clear -{ - m_kb_latch_low[0] = m_kb_latch_low[1]; - m_kb_latch_high[0] = m_kb_latch_high[1]; - m_kb_latch_low[1] = 0; - m_kb_latch_high[1] = 1; -} - -WRITE8_MEMBER(socrates_state::reset_speech)// i/o 60: reset speech synth -{ - m_speech_running = 0; - m_speech_address = 0; - m_speech_settings = 0; - m_speech_dummy_read = 0; - m_speech_load_address_count = 0; - m_speech_load_settings_count = 0; - m_io40_latch &= 0x0f; // set last command to 0 to prevent problems -logerror("write to i/o 0x60 of %x\n",data); -} - -/* stuff below belongs in video/nc.c */ - -WRITE8_MEMBER(socrates_state::socrates_scroll_w) -{ - if (offset == 0) - m_scroll_offset = (m_scroll_offset&0x100) | data; - else - m_scroll_offset = (m_scroll_offset&0xFF) | ((data&1)<<8); -} - -/* NTSC-based Palette stuff */ -// max for I and Q -#define M_I 0.5957 -#define M_Q 0.5226 - /* luma amplitudes, measured on scope */ -#define LUMAMAX 1.420 -#define LUMA_COL_0 0.355, 0.139, 0.205, 0, 0.569, 0.355, 0.419, 0.205, 0.502, 0.288, 0.358, 0.142, 0.720, 0.502, 0.571, 0.358, -#define LUMA_COL_COMMON 0.52, 0.52, 0.52, 0.52, 0.734, 0.734, 0.734, 0.734, 0.667, 0.667, 0.667, 0.667, 0.885, 0.885, 0.885, 0.885, -#define LUMA_COL_2 0.574, 0.6565, 0.625, 0.71, 0.792, 0.87, 0.8425, 0.925, 0.724, 0.8055, 0.7825, 0.865, 0.94275, 1.0225, 0.99555, 1.07525, -#define LUMA_COL_5 0.4585, 0.382, 0.4065, 0.337, 0.6715, 0.5975, 0.6205, 0.5465, 0.6075, 0.531, 0.5555, 0.45, 0.8255, 0.7455, 0.774, 0.6985, -#define LUMA_COL_F 0.690, 0.904, 0.830, 1.053, 0.910, 1.120, 1.053, 1.270, 0.840, 1.053, 0.990, 1.202, 1.053, 1.270, 1.202, 1.420 - /* chroma amplitudes, measured on scope */ -#define CHROMAMAX 0.42075 -#define CHROMA_COL_COMMON 0.148, 0.3125, 0.26475, 0.42075, 0.148, 0.3125, 0.26475, 0.42075, 0.148, 0.3125, 0.26475, 0.42075, 0.148, 0.3125, 0.26475, 0.42075, -#define CHROMA_COL_2 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, -#define CHROMA_COL_5 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, -// gamma: this needs to be messed with... may differ on different systems... attach to slider somehow? -#define GAMMA 1.5 - -rgb_t socrates_state::socrates_create_color(UINT8 color) -{ - rgb_t composedcolor; - static const double lumatable[256] = { - LUMA_COL_0 - LUMA_COL_COMMON - LUMA_COL_2 - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_5 - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_COMMON - LUMA_COL_F - }; - static const double chromaintensity[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - CHROMA_COL_COMMON - CHROMA_COL_2 - CHROMA_COL_COMMON - CHROMA_COL_COMMON - CHROMA_COL_5 - CHROMA_COL_COMMON - CHROMA_COL_COMMON - CHROMA_COL_COMMON - CHROMA_COL_COMMON - CHROMA_COL_COMMON - CHROMA_COL_COMMON - CHROMA_COL_COMMON - CHROMA_COL_COMMON - CHROMA_COL_COMMON - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - }; - /* chroma colors and phases: - 0: black-through-grey (0 assumed chroma) - 1: purple (90 chroma seems correct) - 2: light blue/green (210 or 240 chroma, 210 seems slightly closer) - 3: bright blue (150 seems correct) - 4: green (270 seems correct) - 5: red (30 seems correct, does have some blue in it) - 6: orange (0 seems correct, does have some red in it) - 7: yellow/gold (330 is closest but conflicts with color C, hence 315 seems close, and must have its own delay line separate from the other phases which use a standard 12 phase scheme) - 8: blue with a hint of green in it (180 seems correct) - 9: blue-green (210 seems correct) - A: forest green (240 seems correct) - B: yellow-green (300 seems correct) - C: yellow-orange (330 is close but this conflicts with color 7, and is not quite the same; color 7 has more green in it than color C) - D: magenta (60 is closest) - E: blue-purple (more blue than color 1, 120 is closest) - F: grey-through-white (0 assumed chroma) - */ - static const double phaseangle[16] = { 0, 90, 220, 150, 270, 40, 0, 315, 180, 210, 240, 300, 330, 60, 120, 0 }; // note: these are guessed, not measured yet! - int chromaindex = color&0x0F; - int swappedcolor = ((color&0xf0)>>4)|((color&0x0f)<<4); - double finalY, finalI, finalQ, finalR, finalG, finalB; - finalY = (1/LUMAMAX) * lumatable[swappedcolor]; - finalI = (M_I * (cos((phaseangle[chromaindex]/180)*3.141592653589793)))* ((1/CHROMAMAX)*chromaintensity[swappedcolor]); - finalQ = (M_Q * (sin((phaseangle[chromaindex]/180)*3.141592653589793)))* ((1/CHROMAMAX)*chromaintensity[swappedcolor]); - if (finalY > 1) finalY = 1; // clamp luma - /* calculate the R, G and B values here, neato matrix math */ - finalR = (finalY*1)+(finalI*0.9563)+(finalQ*0.6210); - finalG = (finalY*1)+(finalI*-0.2721)+(finalQ*-0.6474); - finalB = (finalY*1)+(finalI*-1.1070)+(finalQ*1.7046); - /* scale/clamp to 0-255 range */ - if (finalR<0) finalR = 0; - if (finalR>1) finalR = 1; - if (finalG<0) finalG = 0; - if (finalG>1) finalG = 1; - if (finalB<0) finalB = 0; - if (finalB>1) finalB = 1; - // gamma correction: 1.0 to GAMMA: - finalR = pow(finalR, 1/GAMMA)*255; - finalG = pow(finalG, 1/GAMMA)*255; - finalB = pow(finalB, 1/GAMMA)*255; -composedcolor = rgb_t((int)finalR,(int)finalG,(int)finalB); -return composedcolor; -} - - -PALETTE_INIT_MEMBER(socrates_state, socrates) -{ - int i; // iterator - for (i = 0; i < 256; i++) - { - m_palette_val[i] = socrates_create_color(i); - } - palette.set_pen_colors(0, m_palette_val, ARRAY_LENGTH(m_palette_val)); -} - -void socrates_state::video_start() -{ - m_scroll_offset = 0; -} - -UINT32 socrates_state::screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - static const UINT8 fixedcolors[8] = - { - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 - }; - UINT8 *videoram = m_vram_reg->base(); - int x, y, colidx, color; - int lineoffset = 0; // if display ever tries to display data at 0xfxxx, offset line displayed by 0x1000 - for (y = 0; y < 228; y++) - { - if ((((y+m_scroll_offset)*128)&0xffff) >= 0xf000) lineoffset = 0x1000; // see comment above - for (x = 0; x < 264; x++) - { - if (x < 256) - { - colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; - if (x&1) colidx >>=4; - colidx &= 0xF; - if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; - else color=fixedcolors[colidx]; - bitmap.pix16(y, x) = color; - } - else - { - colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; - colidx >>=4; - colidx &= 0xF; - if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; - else color=fixedcolors[colidx]; - bitmap.pix16(y, x) = color; - } - } - } - return 0; -} - -/* below belongs in sound/nc.c */ - -WRITE8_MEMBER(socrates_state::socrates_sound_w) -{ - switch(offset) - { - case 0: - m_sound->reg0_w(data); - break; - case 1: - m_sound->reg1_w(data); - break; - case 2: - m_sound->reg2_w(data); - break; - case 3: - m_sound->reg3_w(data); - break; - case 4: case 5: case 6: case 7: default: - m_sound->reg4_w(data); - break; - } -} - - - -//----------------------------------------------------------------------------- -// -// IQ Unlimited -// -//----------------------------------------------------------------------------- - -int iqunlim_state::get_color(int index, int y) -{ - if (index < 8) - return m_colors[index]; - else - return m_vram_reg->u8(0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff)); -} - -UINT32 iqunlim_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_vram_reg->base(); - - // bitmap layer - for (int y=0; y<224; y++) - { - if (y >= m_video_regs[0x03]) break; - for (int x=0; x<128; x++) - { - UINT8 data = videoram[(m_scroll_offset + y) * 0x80 + x]; - - for(int b=0; b<2; b++) - { - bitmap.pix16(y, x*2 + b) = get_color(data & 0x0f, y); - data >>= 4; - } - } - } - - // text layer - bool mode_80 = m_video_regs[0x02] & 0x02; // 80 chars mode - int line_len = mode_80 ? 80 : 40; - for (int y=0; y<28; y++) - { - for (int x=0; x= m_video_regs[0x03]) - { - UINT8 col0 = get_color(0x0e, py); - UINT8 col1 = get_color(0x0f, py); - UINT8 data = 0; - - if (BIT(m_video_regs[0x02],4) && m_video_regs[0x00] == x && m_video_regs[0x01] == ((y - 1) + (0x400 / (mode_80 ? 0x80 : 0x40)))) // cursor position start at 0x8000 - data = 0xff; - else if (y > 0 && y < 26) - data = gfx[cy] ^ (c & 0x80 ? 0xff : 0); - - if (x == 0) bitmap.plot_box(0, py, 8 + line_len*6 + 8, 1, col0); - for (int cx=0; cx<6; cx++) - { - int px = 8 + x*6 + cx; - bitmap.pix16(py, px) = BIT(data, 7) ? col1 : col0; - data <<= 1; - } - } - } - } - } - - return 0; -} - -READ8_MEMBER( iqunlim_state::status_r ) -{ - // ---x ---- main battery status - // --x- ---- backup battery status - - return 0x30; -} - -READ8_MEMBER( iqunlim_state::video_regs_r ) -{ - return m_video_regs[offset]; -} - -WRITE8_MEMBER( iqunlim_state::video_regs_w ) -{ - if (offset == 2 && ((m_video_regs[offset] ^ data) & 0x02)) - { - rectangle visarea = m_screen->visible_area(); - visarea.set(0, (data & 0x02 ? 496 : 256) - 1, 0, 224 - 1); - m_screen->configure(data & 0x02 ? 496 : 256 , 224, visarea, m_screen->frame_period().attoseconds()); - } - - m_video_regs[offset] = data; -} - -void iqunlim_state::machine_start() -{ - std::string region_tag; - m_cart_reg = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - UINT8 *bios = m_bios_reg->base(); - UINT8 *cart = m_cart_reg ? m_cart_reg->base() : m_bios_reg->base(); - UINT8 *ram = m_vram_reg->base(); - - m_bank1->configure_entries(0x00, 0x10, bios, 0x4000); - m_bank1->configure_entries(0x10, 0x10, cart , 0x4000); - m_bank1->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000); - m_bank1->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000); - - m_bank2->configure_entries(0x00, 0x10, bios, 0x4000); - m_bank2->configure_entries(0x10, 0x10, cart , 0x4000); - m_bank2->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000); - m_bank2->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000); - - m_bank3->configure_entries(0x00, 0x08, ram, 0x4000); - m_bank4->configure_entries(0x00, 0x08, ram, 0x4000); -} - -void iqunlim_state::machine_reset() -{ - socrates_state::machine_reset(); - - m_rambank = m_rombank[0] = m_rombank[1] = 0; - memset(m_colors, 0, 8); - memset(m_video_regs, 0, 4); - m_kb_queue.head = m_kb_queue.tail = 0; - - m_bank1->set_entry(0x00); - m_bank2->set_entry(0x00); - m_bank3->set_entry(0x00); - m_bank4->set_entry(0x00); -} - -READ8_MEMBER( iqunlim_state::rombank_r ) -{ - return m_rombank[offset]; -} - -WRITE8_MEMBER( iqunlim_state::rombank_w ) -{ - memory_bank *bank = offset ? m_bank1 : m_bank2; - bank->set_entry(data & 0x3f); - - m_rombank[offset] = data; -} - -READ8_MEMBER( iqunlim_state::rambank_r ) -{ - return m_rambank; -} - -WRITE8_MEMBER( iqunlim_state::rambank_w ) -{ - m_bank3->set_entry(((data>>2) & 0x0c) | ((data>>0) & 0x03)); - m_bank4->set_entry(((data>>4) & 0x0c) | ((data>>2) & 0x03)); - m_rambank = data; -} - -WRITE8_MEMBER( iqunlim_state::colors_w ) -{ - m_colors[offset] = data; -} - - -// IQ Unlimited keyboard MCU simulation - -INPUT_CHANGED_MEMBER( iqunlim_state::send_input ) -{ - UINT8 data = (UINT8)(FPTR)param; - - if (newval) - { - m_kb_queue.buffer[m_kb_queue.tail] = data; - m_kb_queue.tail = (m_kb_queue.tail + 1) % sizeof(m_kb_queue.buffer); - } -} - -WRITE8_MEMBER( iqunlim_state::keyboard_clear ) -{ - if(m_kb_queue.head != m_kb_queue.tail) - m_kb_queue.head = (m_kb_queue.head + 1) % sizeof(m_kb_queue.buffer); -} - -READ8_MEMBER( iqunlim_state::keyboard_r ) -{ - UINT8 data = 0; - - switch(offset) - { - case 0: - if(m_kb_queue.head != m_kb_queue.tail) - data = m_kb_queue.buffer[m_kb_queue.head]; - break; - case 1: - data = (m_kb_queue.head != m_kb_queue.tail ? 0x80 : 0) | (ioport("IN0")->read() & 0x7f); - if (m_screen->vblank()) data |= 0x80; // FIXME - break; - } - - return data; -} - - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(z80_mem, AS_PROGRAM, 8, socrates_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROM /* system rom, bank 0 (fixed) */ - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") /* banked rom space; system rom is banks 0 through F, cartridge rom is banks 10 onward, usually banks 10 through 17. area past the end of the cartridge, and the whole 10-ff area when no cartridge is inserted, reads as 0xF3 */ - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank2") /* banked ram 'window' 0 */ - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank3") /* banked ram 'window' 1 */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(z80_io, AS_IO, 8, socrates_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READWRITE(socrates_rom_bank_r, socrates_rom_bank_w) AM_MIRROR(0x7) /* rom bank select - RW - 8 bits */ - AM_RANGE(0x08, 0x08) AM_READWRITE(socrates_ram_bank_r, socrates_ram_bank_w) AM_MIRROR(0x7) /* ram banks select - RW - 4 low bits; Format: 0b****HHLL where LL controls whether window 0 points at ram area: 0b00: 0x0000-0x3fff; 0b01: 0x4000-0x7fff; 0b10: 0x8000-0xbfff; 0b11: 0xc000-0xffff. HH controls the same thing for window 1 */ - AM_RANGE(0x10, 0x17) AM_READWRITE(read_f3, socrates_sound_w) AM_MIRROR (0x8) /* sound section: - 0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL_21_4772MHz/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions) - 0x11 - W - frequency control for channel 2 (softer channel) - 01=high pitch, ff=low; same equation as above - 0x12 - W - 0b***EVVVV enable, volume control for channel 1 - 0x13 - W - 0b***EVVVV enable, volume control for channel 2 - 0x14-0x17 - 0bE??????? enable, unknown for channel 3; produces well defined dmc waves when bit 7 is set, and one or two other bits - This may be some sort of debug register for serial-dmc banging out some internal rom from the asic, maybe color data? - No writes to ram seem to change the waveforms produced, in my limited testing. - 0x80 produces about a very very quiet 1/8 duty cycle wave at 60hz or so - 0xC0 produces a DMC wave read from an unknown address at around 342hz - 0x - */ - AM_RANGE(0x20, 0x21) AM_READWRITE(read_f3, socrates_scroll_w) AM_MIRROR (0xe) /* graphics section: - 0x20 - W - lsb offset of screen display - 0x21 - W - msb offset of screen display - resulting screen line is one of 512 total offsets on 128-byte boundaries in the whole 64k ram - */ - AM_RANGE(0x30, 0x30) AM_READWRITE(read_f3, kbmcu_strobe) AM_MIRROR (0xf) /* resets the keyboard IR decoder MCU */ - AM_RANGE(0x40, 0x40) AM_READWRITE(status_and_speech, speech_command ) AM_MIRROR(0xf) /* reads status register for vblank/hblank/speech, also reads and writes speech module */ - AM_RANGE(0x50, 0x50) AM_READWRITE(socrates_keyboard_low_r, socrates_keyboard_clear) AM_MIRROR(0xE) /* Keyboard keycode low, latched on keypress, can be unlatched by writing anything here */ - AM_RANGE(0x51, 0x51) AM_READWRITE(socrates_keyboard_high_r, socrates_keyboard_clear) AM_MIRROR(0xE) /* Keyboard keycode high, latched as above, unlatches same as above */ - AM_RANGE(0x60, 0x60) AM_READWRITE(read_f3, reset_speech) AM_MIRROR(0xF) /* reset the speech module, or perhaps fire an NMI? */ - AM_RANGE(0x70, 0xFF) AM_READ(read_f3) // nothing mapped here afaik -ADDRESS_MAP_END - -static ADDRESS_MAP_START(iqunlim_mem, AS_PROGRAM, 8, iqunlim_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( iqunlim_io , AS_IO, 8, iqunlim_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x01) AM_READWRITE(rombank_r, rombank_w) AM_MIRROR(0x06) - AM_RANGE(0x08, 0x08) AM_READWRITE(rambank_r, rambank_w) AM_MIRROR(0x07) - AM_RANGE(0x10, 0x17) AM_WRITE(socrates_sound_w) AM_MIRROR (0x08) - AM_RANGE(0x20, 0x21) AM_WRITE(socrates_scroll_w) AM_MIRROR (0x0e) - AM_RANGE(0x50, 0x51) AM_READWRITE(keyboard_r, keyboard_clear) - AM_RANGE(0x70, 0x73) AM_READWRITE(video_regs_r, video_regs_w) AM_MIRROR (0x0c) - AM_RANGE(0x80, 0x81) AM_WRITENOP // LCD - AM_RANGE(0xb1, 0xb1) AM_WRITENOP - AM_RANGE(0xa0, 0xa0) AM_READ(status_r) AM_MIRROR(0x0f) - AM_RANGE(0xe0, 0xe7) AM_WRITE(colors_w) AM_MIRROR(0x08) -ADDRESS_MAP_END - - - -/****************************************************************************** - Input Ports -******************************************************************************/ - -/* socrates keyboard codes: -keycode low -| keycode high -| | key name -00 01 No key pressed -// pads on the sides of the kb; this acts like a giant bitfield, both dpads/buttons can send data at once -00 81 left dpad right -00 82 left dpad up -00 84 left dpad left -00 88 left dpad down -01 80 right dpad down -02 80 right dpad left -04 80 right dpad up -08 80 right dpad right -10 80 left red button -20 80 right red button -// top row (right to left) -44 82 ENTER -44 83 MENU -44 84 ANSWER -44 85 HELP -44 86 ERASE -44 87 divide_sign -44 88 multiply_sign -44 89 minus_sign -44 80 plus_sign -//second row (right to left) -43 81 0 -43 82 9 -43 83 8 -43 84 7 -43 85 6 -43 86 5 -43 87 4 -43 88 3 -43 89 2 -43 80 1 -// third row (right to left) -42 82 I/La -42 83 H/So -42 84 G/Fa -42 85 F/Mi -42 86 E/Re -42 87 D/Do -42 88 C/Ti. -42 89 B/La. -42 80 A/So. -42 81 hyphen/period -// fourth row (right to left) -41 81 S -41 82 R -41 83 Q/NEW -41 84 P/PLAY -41 85 O/PAUSE -41 86 N/Fa` -41 87 M/Mi` -41 88 L/Re` -41 89 K/Do` -41 80 J/Ti -// fifth row (right to left) -40 82 SPACE -40 83 Z -40 84 Y -40 85 X -40 86 W -40 87 V -40 88 U -40 89 T -50 80 SHIFT -// socrates mouse pad (separate from keyboard) -8x 8y mouse movement -x: down = 1 (small) through 7 (large), up = 8 (small) through F (large) -y: right = 1 (small) through 7 (large), left = 8 (small) through F (large) -90 80 right click -A0 80 left click -B0 80 both buttons click -90 81 right click (mouse movement in queue, will be in regs after next latch clear) -A0 81 left click (mouse movement in queue, will be in regs after next latch clear) -B0 81 both buttons click (mouse movement in queue, will be in regs after next latch clear) -// socrates touch pad -// unknown yet, but probably uses the 60/70/c0/d0/e0/f0 low reg vals -*/ -static INPUT_PORTS_START( socrates ) - - PORT_START("keyboard_jp") // joypad keys - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_NAME("Left D-pad Right") // 00 81 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_NAME("Left D-pad Up") // 00 82 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_NAME("Left D-pad Left") // 00 84 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_NAME("Left D-pad Down") // 00 88 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("Right D-pad Down") // 01 80 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME("Right D-pad Left") // 02 80 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_NAME("Right D-pad Up") // 04 80 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("Right D-pad Right") // 08 80 - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_NAME("Left D-pad Button") // 10 80 - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Right D-pad Button") // 20 80 - PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) - /* alt w/left and right keypad keys swapped - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("Left D-pad Right") // 00 81 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_NAME("Left D-pad Up") // 00 82 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME("Left D-pad Left") // 00 84 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("Left D-pad Down") // 00 88 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_NAME("Right D-pad Down") // 01 80 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_NAME("Right D-pad Left") // 02 80 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_NAME("Right D-pad Up") // 04 80 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_NAME("Right D-pad Right") // 08 80 - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Left D-pad Button") // 10 80 - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_NAME("Right D-pad Button") // 20 80 - PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) - */ - - PORT_START("keyboard_50") // lowest 'row' (technically the shift key is on the 5th row but it has its own keycode) - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("SHIFT") // 5x xx - PORT_BIT(0xfffffffe, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyboard_40") // 5th row - PORT_BIT(0x00000003, IP_ACTIVE_HIGH, IPT_UNUSED) // 40 80 and 40 81 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_NAME("SPACE") // 40 82 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_NAME("Z") // 40 83 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_NAME("Y") // 40 84 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_NAME("X") // 40 85 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_NAME("W") // 40 86 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_NAME("V") // 40 87 - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_NAME("U") // 40 88 - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_NAME("T") // 40 89 - PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyboard_41") // 4th row - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_NAME("J/Ti") // 41 80 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_NAME("S") // 41 81 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_NAME("R") // 41 82 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_NAME("Q/NEW") // 41 83 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_NAME("P/PLAY") // 41 84 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_NAME("O/PAUSE") // 41 85 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_NAME("N/Fa'") // 41 86 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_NAME("M/Mi'") // 41 87 - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_NAME("L/Re'") // 41 88 - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_NAME("K/Do'") // 41 89 - PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyboard_42") // 3rd row - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_NAME("A/So.") // 42 80 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('-') PORT_NAME("-/.") // 42 81 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_NAME("I/La") // 42 82 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_NAME("H/So") // 42 83 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_NAME("G/Fa") // 42 84 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_NAME("F/Mi") // 42 85 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_NAME("E/Re") // 42 86 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_NAME("D/Do") // 42 87 - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_NAME("C/Ti.") // 42 88 - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_NAME("B/La.") // 42 89 - PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyboard_43") // 2nd row - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_NAME("1") // 43 80 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_NAME("0") // 43 81 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9") // 43 82 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_NAME("8") // 43 83 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_NAME("7") // 43 84 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_NAME("6") // 43 85 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_NAME("5") // 43 86 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_NAME("4") // 43 87 - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_NAME("3") // 43 88 - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_NAME("2") // 43 89 - PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("keyboard_44") // 1st row - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_NAME("+") // 44 80 - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_UNUSED) // 44 81 - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_NAME("ENTER") // 44 82 - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("MENU") // 44 83 - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_NAME("ANSWER") // 44 84 - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_NAME("HELP") // 44 85 - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_NAME("ERASE") // 44 86 - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_NAME("/") // 44 87 - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') PORT_NAME("*") // 44 88 - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("-") // 44 89 - PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) - - // mouse goes here -INPUT_PORTS_END - - -static INPUT_PORTS_START( iqunlimz ) - PORT_START( "IN0" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LSHIFT ) PORT_CODE( KEYCODE_RSHIFT ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LCONTROL ) PORT_CODE( KEYCODE_RCONTROL ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_LALT ) PORT_CODE( KEYCODE_RALT ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_CAPSLOCK ) - PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START( "IN1" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_N ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x10 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x11 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x12 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_B ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x13 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_C ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x14 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x15 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_V ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x16 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_X ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x17 ) - - PORT_START( "IN2" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x20 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2_PAD ) PORT_CODE( KEYCODE_DOWN ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x21 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x22 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_DEL_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x23 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x24 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8_PAD ) PORT_CODE( KEYCODE_UP ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x25 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ASTERISK ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x26 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x27 ) - - PORT_START( "IN3" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x30 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x31 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x32 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x33 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F1 ) PORT_NAME( "Help" ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x34 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x35 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSPACE ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x36 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x37 ) - - PORT_START( "IN4" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_H ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x40 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_J ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x41 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_K ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x42 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_G ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x43 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_D ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x44 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x45 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x46 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_S ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x47 ) - - PORT_START( "IN5" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x50 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x51 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x52 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x53 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_EQUALS ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x54 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_O ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x55 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_NUMLOCK ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x56 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_P ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x57 ) - - PORT_START( "IN6" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x60 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_U ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x61 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_I ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x62 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_T ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x63 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_E ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x64 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x65 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_R ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x66 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x67 ) - - PORT_START( "IN7" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x70 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SLASH ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x71 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x72 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_STOP ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x73 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x74 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_L ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x75 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ENTER ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x76 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COLON ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x77 ) - - PORT_START( "IN8" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x80 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x81 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x82 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_5 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x83 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x84 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x85 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x86 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x87 ) - - PORT_START( "IN9" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_4_PAD ) PORT_CODE( KEYCODE_LEFT ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x90 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_3_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x91 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6_PAD ) PORT_CODE( KEYCODE_RIGHT ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x92 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_PLUS_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x93 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x94 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x95 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_MINUS_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x96 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1_PAD ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0x97 ) - - PORT_START( "INA" ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa0 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa1 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa2 ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) // PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa3 ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_F2 ) PORT_NAME("Answer") PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa4 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_ESC ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa5 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_SPACE ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa6 ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE( KEYCODE_TAB ) PORT_CHANGED_MEMBER( DEVICE_SELF, iqunlim_state, send_input, 0xa7 ) -INPUT_PORTS_END - -/****************************************************************************** - Machine Drivers -******************************************************************************/ -TIMER_CALLBACK_MEMBER(socrates_state::clear_irq_cb) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); - m_vblankstate = 0; -} - -INTERRUPT_GEN_MEMBER(socrates_state::assert_irq) -{ - device.execute().set_input_line(0, ASSERT_LINE); - timer_set(downcast(&device)->cycles_to_attotime(44), TIMER_CLEAR_IRQ); -// 44 is a complete and total guess, need to properly measure how many clocks/microseconds the int line is high for. - m_vblankstate = 1; - m_kbmcu_rscount = 0; // clear the mcu poke count -} - -static MACHINE_CONFIG_START( socrates, socrates_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_21_4772MHz/6) /* Toshiba TMPZ84C00AP @ 3.579545 MHz, verified, xtal is divided by 6 */ - MCFG_CPU_PROGRAM_MAP(z80_mem) - MCFG_CPU_IO_MAP(z80_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_CPU_VBLANK_INT_DRIVER("screen", socrates_state, assert_irq) - //MCFG_MACHINE_START_OVERRIDE(socrates_state,socrates) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(264, 228) // technically the screen size is 256x228 but super painter abuses what I suspect is a hardware bug to display repeated pixels of the very last pixel beyond this horizontal space, well into hblank - MCFG_SCREEN_VISIBLE_AREA(0, 263, 0, 219) // the last few rows are usually cut off by the screen bottom but are indeed displayed if you mess with v-hold - MCFG_SCREEN_UPDATE_DRIVER(socrates_state, screen_update_socrates) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_INIT_OWNER(socrates_state, socrates) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256)) // this is correct, as strange as it sounds. - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( socrates_pal, socrates_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_26_601712MHz/6) /* Toshiba TMPZ84C00AP @ 4.433 MHz? /6 or 7 or 8? TODO: verify divider!*/ - MCFG_CPU_PROGRAM_MAP(z80_mem) - MCFG_CPU_IO_MAP(z80_io) - MCFG_QUANTUM_TIME(attotime::from_hz(50)) - MCFG_CPU_VBLANK_INT_DRIVER("screen", socrates_state, assert_irq) - //MCFG_MACHINE_START_OVERRIDE(socrates_state,socrates) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(264, 238) // technically the screen size is 256x228 but super painter abuses what I suspect is a hardware bug to display repeated pixels of the very last pixel beyond this horizontal space, well into hblank - MCFG_SCREEN_VISIBLE_AREA(0, 263, 0, 229) // the last few rows are usually cut off by the screen bottom but are indeed displayed if you mess with v-hold - MCFG_SCREEN_UPDATE_DRIVER(socrates_state, screen_update_socrates) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_INIT_OWNER(socrates_state, socrates) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_26_601712MHz/(512+256)) // TODO: verify divider for pal mode - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates") -MACHINE_CONFIG_END - -/* This doesn't work for some reason. -static MACHINE_CONFIG_DERIVED( socrates_pal, socrates ) - MCFG_CPU_REPLACE("maincpu", Z80, XTAL_26_601712MHz/8) - MCFG_SCREEN_REPLACE("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(264, 256) // technically the screen size is 256x228 but super painter abuses what I suspect is a hardware bug to display repeated pixels of the very last pixel beyond this horizontal space, well into hblank - MCFG_SCREEN_VISIBLE_AREA(0, 263, 0, 256) // the last few rows are usually cut off by the screen bottom but are indeed displayed if you mess with v-hold - MCFG_SCREEN_UPDATE_DRIVER(socrates_state, screen_update_socrates) - MCFG_SOUND_REPLACE("soc_snd", SOCRATES_SOUND, XTAL_26_601712MHz/(512+256)) // this is correct, as strange as it sounds. - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END -*/ - -static MACHINE_CONFIG_START( iqunlimz, iqunlim_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) /* not accurate */ - MCFG_CPU_PROGRAM_MAP(iqunlim_mem) - MCFG_CPU_IO_MAP(iqunlim_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", iqunlim_state, assert_irq) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(iqunlim_state, screen_update) - MCFG_SCREEN_SIZE(256, 224) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 224-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_INIT_OWNER(socrates_state, socrates) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL) -MACHINE_CONFIG_END - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -ROM_START(socrates) - ROM_REGION(0x400000, "maincpu", ROMREGION_ERASEVAL(0xF3)) /* can technically address 4mb of rom via bankswitching; open bus area reads as 0xF3 */ - /* Socrates US NTSC */ - /* all cart roms are 28 pin 23c1000/tc531000 128Kx8 roms */ - /* cart port pinout: - (looking into end of disk-shaped cartridge with label/top side pointing to the right) - A15 -> 19 18 -- VCC - A14 -> 20 17 <- A16 - A13 -> 21 16 <- A12 - A8 -> 22 15 <- A7 - A9 -> 23 14 <- A6 - A11 -> 24 13 <- A5 - A3 -> 25 12 <- A4 - A2 -> 26 11 <- A10 - D7 <- 27 10 <- A1 - D6 <- 28 9 <- A0 - D5 <- 29 8 -> D0 - D4 <- 30 7 -> D1 - D3 <- 31 6 -> D2 - ? ?? 32 5 ?? ? - A17 -> 33 4 ?? ? - ? ?? 34 3 ?? ? - /CE -> 35 2 ?? ? - GND -- 36 1 -- GND - Note that a17 goes to what would be pin 2 on a rom chip if a 32 pin rom were installed, which is not the case. (pins 1, 31 and 32 would be tied to vcc) - It is likely that at least one of the 6 unknown lines is R/W from the z80, and another may be phi1/m1/clock etc to allow for ram to live in cart space - - Cartridge check procedure by socrates is, after screen init and check for speech synth, - bankswitch to bank 0x10 (i.e. first 0x4000 of cart appears at 4000-7fff in z80 space), - do following tests; if any tests fail, jump to 0x0015 (socrates main menu) - * read 0x7ff0(0x3ff0 in cart rom) and compare to 0xAA - * read 0x7ff1(0x3ff1 in cart rom) and compare to 0x55 - * read 0x7ff2(0x3ff2 in cart rom) and compare to 0xE7 - * read 0x7ff3(0x3ff3 in cart rom) and compare to 0x18 - if all tests passed, jump to 0x4000 (0x0000 in cart rom) - */ - ROM_LOAD("27-00817-000-000.u1", 0x00000, 0x40000, CRC(80f5aa20) SHA1(4fd1ff7f78b5dd2582d5de6f30633e4e4f34ca8f)) // Label: "(Vtech) 27-00817-000-000 // (C)1987 VIDEO TECHNOLOGY // 8811 D" - - ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ - - ROM_REGION(0x800, "kbmcu", ROMREGION_ERASEFF) - ROM_LOAD("tmp42c40p1844.u2", 0x000, 0x200, NO_DUMP) /* keyboard IR decoder MCU */ - - /* english speech cart has a green QC sticker */ - ROM_REGION(0x2000, "speechint", ROMREGION_ERASE00) // speech data inside of the speech chip; fill with 00, if no speech cart is present socrates will see this - ROM_LOAD_OPTIONAL("speech_eng_internal.bin", 0x0000, 0x2000, CRC(edc1fb3f) SHA1(78b4631fc3b1c038e14911047f9edd6c4e8bae58)) // 8k on the speech chip itself - - ROM_REGION(0x10000, "speechext", ROMREGION_ERASE00) // speech serial modules outside of the speech chip but still on speech cart - ROM_LOAD_OPTIONAL("speech_eng_vsm1.bin", 0x0000, 0x4000, CRC(888e3ddd) SHA1(33af6a21ba6d826071c9d48557b1c9012752570b)) // 16k in serial rom - ROM_LOAD_OPTIONAL("speech_eng_vsm2.bin", 0x4000, 0x4000, CRC(de4ac89d) SHA1(3dfa853b02df756a9b72def94a39310992ee11c7)) // 16k in serial rom - ROM_LOAD_OPTIONAL("speech_eng_vsm3.bin", 0x8000, 0x4000, CRC(972384aa) SHA1(ffcb1d633ca6bffc7f481ec505da447e5b847f16)) // 16k in serial rom - ROM_FILL(0xC000, 0x4000, 0xff) // last vsm isn't present, FF fill -ROM_END - -ROM_START(socratfc) - ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEVAL(0xF3)) - /* Socrates SAITOUT (French Canadian) NTSC */ - ROM_LOAD("27-00884-001-000.u1", 0x00000, 0x40000, CRC(042d9d21) SHA1(9ffc67b2721683b2536727d0592798fbc4d061cb)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D" - - ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ - - ROM_REGION(0x800, "kbmcu", ROMREGION_ERASEFF) - ROM_LOAD("tmp42c40p1844.u2", 0x000, 0x200, NO_DUMP) /* keyboard IR decoder MCU */ - - ROM_REGION(0x2000, "speechint", ROMREGION_ERASE00) // speech data inside of the speech chip; fill with 00, if no speech cart is present socrates will see this - ROM_LOAD_OPTIONAL("speech_fra_internal.bin", 0x0000, 0x2000, NO_DUMP) - - ROM_REGION(0x10000, "speechext", ROMREGION_ERASE00) // speech serial modules outside of the speech chip but still on speech cart - ROM_LOAD_OPTIONAL("speech_fra_vsm1.bin", 0x0000, 0x4000, NO_DUMP) // 16k in serial rom - ROM_LOAD_OPTIONAL("speech_fra_vsm2.bin", 0x4000, 0x4000, NO_DUMP) // 16k in serial rom - ROM_LOAD_OPTIONAL("speech_fra_vsm3.bin", 0x8000, 0x4000, NO_DUMP) // 16k in serial rom - ROM_FILL(0xC000, 0x4000, 0xff) // last vsm isn't present, FF fill -ROM_END - -ROM_START(profweis) - ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEVAL(0xF3)) - /* Yeno Professor Weiss-Alles (German PAL) */ - ROM_SYSTEM_BIOS(0, "89", "1989") - ROMX_LOAD("lh53216d.u1", 0x00000, 0x40000, CRC(6e801762) SHA1(b80574a3abacf18133dacb9d3a8d9e2916730423), ROM_BIOS(1)) // Label: "(Vtech) LH53216D // (C)1989 VIDEO TECHNOLOGY // 9119 D" - ROM_SYSTEM_BIOS(1, "88", "1988") - ROMX_LOAD("27-00885-001-000.u1", 0x00000, 0x40000, CRC(fcaf8850) SHA1(a99011ee6a1ef63461c00d062278951252f117db), ROM_BIOS(2)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D" - - ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */ - - ROM_REGION(0x800, "kbmcu", ROMREGION_ERASEFF) - ROM_LOAD("tmp42c40p1844.u2", 0x000, 0x200, NO_DUMP) /* keyboard IR decoder MCU */ - - ROM_REGION(0x2000, "speechint", ROMREGION_ERASE00) // speech data inside of the speech chip; fill with 00, if no speech cart is present socrates will see this - ROM_LOAD_OPTIONAL("speech_ger_internal.bin", 0x0000, 0x2000, CRC(5ff0fdc6) SHA1(8ef128561a846762a20e3fe9513a4a22aaadc7f6)) - - ROM_REGION(0x10000, "speechext", ROMREGION_ERASE00) // speech serial modules outside of the speech chip but still on speech cart - ROM_LOAD_OPTIONAL("speech_ger_vsm1.bin", 0x0000, 0x4000, CRC(a979a00b) SHA1(0290844619dbdf336757003aaab3ffd0a75b7ee9)) // 16k in serial rom - ROM_FILL(0x4000, 0xc000, 0xff) // last 3 vsms aren't present, FF fill -ROM_END - -ROM_START( iqunlimz ) - ROM_REGION( 0x80000, "maincpu", 0 ) - ROM_LOAD( "vtech.bin", 0x000000, 0x080000, CRC(f100c8a7) SHA1(6ad2a8accae2dd5c5c46ae953eef33cdd1ea3cf9) ) - - ROM_REGION( 0x20000, "vram", ROMREGION_ERASE ) -ROM_END - - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, socrates, 0, 0, socrates, socrates, socrates_state, socrates, "Video Technology", "Socrates Educational Video System", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) // English NTSC, no title copyright -COMP( 1988, socratfc, socrates, 0, socrates, socrates, socrates_state, socrates, "Video Technology", "Socrates SAITOUT", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) // French Canandian NTSC, 1988 title copyright -COMP( 1988, profweis, socrates, 0, socrates_pal, socrates, socrates_state, socrates, "Video Technology/Yeno", "Professor Weiss-Alles", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) // German PAL, 1988 title copyright -// Yeno Professeur Saitout goes here (french SECAM) -// ? goes here (spanish PAL) - -COMP( 1991, iqunlimz, 0, 0, iqunlimz, iqunlimz, driver_device, 0, "Video Technology", "IQ Unlimited (Z80)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/softbox.c b/src/mess/drivers/softbox.c deleted file mode 100644 index ba2c07688ea..00000000000 --- a/src/mess/drivers/softbox.c +++ /dev/null @@ -1,450 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Mike Naberezny -/* - - SSE SoftBox - - http://mikenaberezny.com/hardware/pet-cbm/sse-softbox-z80-computer/ - - - Standalone vs. PET/CBM Peripheral Mode - -------------------------------------- - - The SoftBox can be used as a standalone computer with an RS-232 terminal, - or as a PET/CBM peripheral. This is an emulation of the standalone mode. - For the peripheral mode, see: src/emu/bus/ieee488/softbox.c. - - - Using the Corvus hard disk - -------------------------- - - The SoftBox distribution disk (softbox-distrib.d80) is configured for - a CBM 8050 as CP/M drives A/B and a 10MB Corvus hard disk as drives C/D. - - Use the CHDMAN utility to create a 10MB hard disk image for the Corvus: - - $ chdman createhd -o /path/to/corvus10mb.chd -chs 358,3,20 -ss 512 - - Start the SoftBox emulator with the floppy and hard disk images mounted: - - $ mess softbox -flop1 /path/to/softbox-distrib.d80 \ - -hard1 /path/to/corvus10mb.chd - - Before the Corvus can be used under CP/M, it must be prepared - by running DIAG.COM and FORMAT.COM. - - DIAG.COM - - Enter "diag" (no arguments) at the CP/M prompt to run the Corvus diagnostics - program. This program will perform the Corvus low-level format. - - Select option 6 (Update Controller Code) at the menu. - Enter "corvb184.fmt" when prompted for the filename. - Enter "y" at the confirmation prompts. - Enter "1" for the Corvus drive number (two prompts). - After formatting is complete, it will return to the menu. - - Select option 3 (Read Controller Code Version #) at the menu. - Enter "1" for the Corvus drive number. - It should report "V18.4AP" and then return to the menu. - - Select option 9 to return to CP/M. - - FORMAT.COM - - Enter "format" (no arguments) at the CP/M prompt to run the SoftBox disk - format program. This program will perform the CP/M filesystem format. - - Enter drive letter "c" at the prompt. - Enter "y" to confirm the format. - After formatting is complete, it will prompt for a drive letter again. - - Enter drive letter "d" at the prompt. - Enter "y" to confirm the format. - After formatting is complete, it will prompt for a drive letter again. - - Press RETURN to return to CP/M. - - STAT.COM - - After all steps are completed, drives C and D should be usable from - CP/M. Each drive is one half of the Corvus 10MB disk. Running the - command "stat c: dsk:" should show 4712 kilobyte drive capacity. - Drive D should show the same information. - - - Using other Corvus hard disk sizes - ---------------------------------- - - The SoftBox supports 5, 10, and 20 MB hard disks. The distribution disk - is configured for 10 MB as explained above. To use other sizes, make - a new image with CHDMAN. See the top of src/emu/machine/corvushd.h - for the parameters for the other drives. - - After the image has been created and the SoftBox emulator started with - it mounted, the SoftBox BIOS needs to be told what size Corvus hard - disk is attached. Use the NEWSYS.COM utility to reconfigure the drive - size. When NEWSYS prompts for a source drive, enter "a" (the drive letter - of the CP/M distribution disk). Use option "d" (Disk drive assignment) - to reconfigure the Corvus size. After the change has been made, use option - "s" (Save new system) to write the configuration to the floppy (drive A) and - option "e" (Execute new system) to restart CP/M with the configuration. - DIAG.COM and FORMAT.COM can then be used to format the hard disk. - -*/ - -#include "includes/softbox.h" -#include "bus/rs232/rs232.h" - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// dbrg_w - baud rate selection -//------------------------------------------------- - -WRITE8_MEMBER( softbox_state::dbrg_w ) -{ - m_dbrg->str_w(data & 0x0f); - m_dbrg->stt_w(data >> 4); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( softbox_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( softbox_mem, AS_PROGRAM, 8, softbox_state ) - AM_RANGE(0x0000, 0xefff) AM_RAM - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(Z80_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( softbox_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( softbox_io, AS_IO, 8, softbox_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x08, 0x08) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x09, 0x09) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x0c, 0x0c) AM_WRITE(dbrg_w) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(I8255_0_TAG, i8255_device, read, write) - AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(I8255_1_TAG, i8255_device, read, write) - AM_RANGE(0x18, 0x18) AM_DEVREADWRITE(CORVUS_HDC_TAG, corvus_hdc_t, read, write) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( softbox ) -//------------------------------------------------- - -static INPUT_PORTS_START( softbox ) - /* An 8-position DIP switch may be installed at SW1. Some - SoftBox units have it and some do not. The switches are - not used by the SoftBox BIOS. */ - PORT_START("SW1") - PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:1" ) - PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) - PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW1:3" ) - PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:4" ) - PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW1:5" ) - PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" ) - PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:7" ) - PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// I8255A 0 Interface -//------------------------------------------------- - -READ8_MEMBER( softbox_state::ppi0_pa_r ) -{ - return m_ieee->dio_r() ^ 0xff; -} - -WRITE8_MEMBER( softbox_state::ppi0_pb_w ) -{ - m_ieee->dio_w(data ^ 0xff); -} - -//------------------------------------------------- -// I8255A 1 Interface -//------------------------------------------------- - -READ8_MEMBER( softbox_state::ppi1_pa_r ) -{ - /* - - bit description - - PA0 ATN - PA1 DAV - PA2 NDAC - PA3 NRFD - PA4 EOI - PA5 SRQ - PA6 REN - PA7 IFC - - */ - - UINT8 data = 0; - - data |= !m_ieee->atn_r(); - data |= !m_ieee->dav_r() << 1; - data |= !m_ieee->ndac_r() << 2; - data |= !m_ieee->nrfd_r() << 3; - data |= !m_ieee->eoi_r() << 4; - data |= !m_ieee->srq_r() << 5; - data |= !m_ieee->ren_r() << 6; - data |= !m_ieee->ifc_r() << 7; - - return data; -} - -WRITE8_MEMBER( softbox_state::ppi1_pb_w ) -{ - /* - - bit description - - PB0 ATN - PB1 DAV - PB2 NDAC - PB3 NRFD - PB4 EOI - PB5 SRQ - PB6 REN - PB7 IFC - - */ - - m_ieee->atn_w(!BIT(data, 0)); - m_ieee->dav_w(!BIT(data, 1)); - m_ieee->ndac_w(!BIT(data, 2)); - m_ieee->nrfd_w(!BIT(data, 3)); - m_ieee->eoi_w(!BIT(data, 4)); - m_ieee->srq_w(!BIT(data, 5)); - m_ieee->ren_w(!BIT(data, 6)); - m_ieee->ifc_w(!BIT(data, 7)); -} - -READ8_MEMBER( softbox_state::ppi1_pc_r ) -{ - /* - - bit description - - PC0 - PC1 - PC2 - PC3 - PC4 Corvus READY - PC5 Corvus DIRC - PC6 - PC7 - - */ - - UINT8 status = m_hdc->status_r(space, 0); - UINT8 data = 0; - - data |= (status & CONTROLLER_BUSY) ? 0 : 0x10; - data |= (status & CONTROLLER_DIRECTION) ? 0 : 0x20; - - return data; -} - -WRITE8_MEMBER( softbox_state::ppi1_pc_w ) -{ - /* - - bit description - - PC0 LED "A" - PC1 LED "B" - PC2 LED "READY" - PC3 - PC4 - PC5 - PC6 - PC7 - - */ - - output_set_led_value(LED_A, !BIT(data, 0)); - output_set_led_value(LED_B, !BIT(data, 1)); - output_set_led_value(LED_READY, !BIT(data, 2)); -} - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( softbox ) -//------------------------------------------------- - -void softbox_state::machine_start() -{ -} - - -//------------------------------------------------- -// device_reset_after_children - device-specific -// reset that must happen after child devices -// have performed their resets -//------------------------------------------------- - -void softbox_state::device_reset_after_children() -{ - /* The Z80 starts at address 0x0000 but the SoftBox has RAM there and - needs to start from the BIOS at 0xf000. The PCB has logic and a - 74S287 PROM that temporarily changes the memory map so that the - IC3 EPROM at 0xf000 is mapped to 0x0000 for the first instruction - fetch only. The instruction normally at 0xf000 is an absolute jump - into the BIOS. On reset, the Z80 will fetch it from 0x0000 and set - its PC, then the normal map will be restored before the next - instruction fetch. Here we just set the PC to 0xf000 after the Z80 - resets, which has the same effect. */ - - m_maincpu->set_state_int(Z80_PC, 0xf000); -} - - -//------------------------------------------------- -// ieee488_ifc - interface clear (reset) -//------------------------------------------------- - -void softbox_state::ieee488_ifc(int state) -{ - if (!m_ifc && state) - { - device_reset(); - } - - m_ifc = state; -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( softbox ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( softbox, softbox_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) - MCFG_CPU_PROGRAM_MAP(softbox_mem) - MCFG_CPU_IO_MAP(softbox_io) - - // devices - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_DEVICE_ADD(I8255_0_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(softbox_state, ppi0_pa_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(softbox_state, ppi0_pb_w)) - MCFG_I8255_IN_PORTC_CB(IOPORT("SW1")) - - MCFG_DEVICE_ADD(I8255_1_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(softbox_state, ppi1_pa_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(softbox_state, ppi1_pb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(softbox_state, ppi1_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(softbox_state, ppi1_pc_w)) - - MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_txc)) - - MCFG_CBM_IEEE488_ADD("c8050") - - MCFG_DEVICE_ADD(CORVUS_HDC_TAG, CORVUS_HDC, 0) - MCFG_HARDDISK_ADD("harddisk1") - MCFG_HARDDISK_INTERFACE("corvus_hdd") - MCFG_HARDDISK_ADD("harddisk2") - MCFG_HARDDISK_INTERFACE("corvus_hdd") - MCFG_HARDDISK_ADD("harddisk3") - MCFG_HARDDISK_INTERFACE("corvus_hdd") - MCFG_HARDDISK_ADD("harddisk4") - MCFG_HARDDISK_INTERFACE("corvus_hdd") - - MCFG_IMI7000_BUS_ADD("imi5000h", NULL, NULL, NULL) - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "softbox") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( softbox ) -//------------------------------------------------- - -ROM_START( softbox ) - ROM_REGION( 0x1000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS("19830609") - ROM_SYSTEM_BIOS( 0, "19810908", "8/9/81" ) - ROMX_LOAD( "375.ic3", 0x000, 0x800, CRC(177580e7) SHA1(af6a97495de825b80cdc9fbf72329d5440826177), ROM_BIOS(1) ) - ROMX_LOAD( "376.ic4", 0x800, 0x800, CRC(edfee5be) SHA1(5662e9071cc622a1c071d89b00272fc6ba122b9a), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "19811027", "27-Oct-81" ) - ROMX_LOAD( "379.ic3", 0x000, 0x800, CRC(7b5a737c) SHA1(2348590884b026b7647f6864af8c9ba1c6f8746b), ROM_BIOS(2) ) - ROMX_LOAD( "380.ic4", 0x800, 0x800, CRC(65a13029) SHA1(46de02e6f04be298047efeb412e00a5714dc21b3), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "19830609", "09-June-1983" ) - ROMX_LOAD( "389.ic3", 0x000, 0x800, CRC(d66e581a) SHA1(2403e25c140c41b0e6d6975d39c9cd9d6f335048), ROM_BIOS(3) ) - ROMX_LOAD( "390.ic4", 0x800, 0x800, CRC(abe6cb30) SHA1(4b26d5db36f828e01268f718799f145d09b449ad), ROM_BIOS(3) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1981, softbox, 0, 0, softbox, softbox, driver_device, 0, "Small Systems Engineering", "SoftBox", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/sorcerer.c b/src/mess/drivers/sorcerer.c deleted file mode 100644 index bff2e0820a2..00000000000 --- a/src/mess/drivers/sorcerer.c +++ /dev/null @@ -1,510 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Robbbert -/****************************************************************************** - - Exidy Sorcerer system driver - - The UART controls rs232 and cassette i/o. The chip is a AY-3-1014A or AY-3-1015. - - - port fc: - ======== - input/output: - uart data - - port fd: - ======== - input: uart status - bit 4: parity error (RPE) - bit 3: framing error (RFE) - bit 2: over-run (RDP) - bit 1: data available (RDA) - bit 0: transmit buffer empty (TPMT) - - output: - bit 4: no parity (NPB) - bit 3: parity type (POE) - bit 2: number of stop bits (NSB) - bit 1: number of bits per char bit 2 (NDB2) - bit 0: number of bits per char bit 1 (NDB1) - - port fe: - ======== - - output: - - bit 7: rs232 enable (1=rs232, 0=cassette) - bit 6: baud rate (1=1200, 0=300) - bit 5: cassette motor 2 - bit 4: cassette motor 1 - bit 3..0: keyboard line select - - input: - bit 7..6: parallel control (not emulated) - 7: must be 1 to read data from parallel port via PARIN - 6: must be 1 to send data out of parallel port via PAROUT - bit 5: vsync - bit 4..0: keyboard line data - - port ff: - ======== - parallel port in/out - - ------------------------------------------------------------------------------------- - - When cassette is selected, it is connected to the uart data input via the cassette - interface hardware. - - The cassette interface hardware converts square-wave pulses into bits which the uart receives. - - 1. the cassette format: "frequency shift" is converted - into the uart data format "non-return to zero" - - 2. on cassette a 1 data bit is stored as a high frequency - and a 0 data bit as a low frequency - - At 1200 baud, a logic 1 is 1 cycle of 1200 Hz and a logic 0 is 1/2 cycle of 600 Hz. - - At 300 baud, a logic 1 is 8 cycles of 2400 Hz and a logic 0 is 4 cycles of 1200 Hz. - - Attenuation is applied to the signal and the square wave edges are rounded. - - A manchester encoder is used. A flip-flop synchronises input - data on the positive-edge of the clock pulse. - - Interestingly the data on cassette is stored in xmodem-checksum. - - - Due to bugs in the hardware and software of a real Sorcerer, the serial - interface misbehaves. - 1. Sorcerer I had a hardware problem causing rs232 idle to be a space (+9v) - instead of mark (-9v). Fixed in Sorcerer II. - 2. When you select a different baud for rs232, it was "remembered" but not - sent to port fe. It only gets sent when motor on was requested. Motor on is - only meaningful in a cassette operation. - 3. The monitor software always resets the device to cassette whenever the - keyboard is scanned, motors altered, or an error occurred. - 4. The above problems make rs232 communication impractical unless you write - your own routines or create a corrected monitor rom. - - Sound: - - External speaker connected to the parallel port. - There was a dac you could make instead, this is supported. - - - Kevin Thacker [MESS driver] - Robbbert [Various corrections and additions over the years] - - ****************************************************************************** - - The CPU clock speed is 2.106 MHz, which was increased to 4.0 MHz on the last production runs. - - The Sorcerer has a bus connection for S100 equipment. This allows the connection - of disk drives, provided that suitable driver/boot software is loaded. - -******************************************************************************* - -Real machines had optional RAM sizes of 8k, 16k, 32k, 48k (officially). -Unofficially, the cart could hold another 8k of static RAM (4x 6116), giving 56k total. - -On the back of the machine is a 50-pin expansion port, which could be hooked to the -expansion unit. - -Also is a 25-pin parallel port, allowing inwards and outwards communication. -It was often hooked to a printer, a joystick, a music card, or a speaker. - -We emulate the printer and the speaker. - -Another 25-pin port provided two-way serial communications. Only two speeds are -available - 300 baud and 1200 baud. There is no handshaking. This protocol is -currently not emulated. - -Other pins on this connector provided for two cassette players. The connections -for cassette unit 1 are duplicated on a set of phono plugs. - -We emulate the use of two cassette units. An option allows you to hear the sound -of the tape during playback. - - -******************************************************************************** - -NOTES (2011-01-09) -1. Converted to MODERN driver as much as possible. -2. Added 2 defines for work that needs doing at some time: -- SORCERER_USING_RS232 - this is for when we can connect a serial interface. -- SORCERER_USING_DISKS - the disk controller I believe most likely to be a - 'Micropolis Floppy Disk System' at 143KB on 13cm disks. - There was a hard-sector system (top of ram = BBFF), - and a soft-sector system (top of RAM = BDFF). You could - use alternate systems (since you could attach a S-100 - unit), so not sure how this could be developed. The - Micropolis seems completely undocumented in the technical - sense. When using the hard-sector system, in the monitor - enter GO BC00 to boot the disk. No idea how in other - disk systems. - - Note that the code within the defines has NOT been - compiled or tested. You are on your own! - - -NOTES (2011-08-08) -1. SORCERER_USING_DISKS removed, replaced with a new driver "sorcererd". - This is disk-enabled, allowing CP/M to run. - To initialise the disk system, you must enter - GO BC00 - after the computer has booted. It is not particularly - stable, so be prepared to cold boot whenever something - goes wrong. - -********************************************************************************/ - -#include "includes/sorcerer.h" - -static ADDRESS_MAP_START( sorcerer_mem, AS_PROGRAM, 8, sorcerer_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") - AM_RANGE(0x0800, 0xbfff) AM_RAM - //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslot - AM_RANGE(0xe000, 0xefff) AM_ROM /* rom pac and bios */ - AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_REGION("maincpu", 0xf000) /* screen ram */ - AM_RANGE(0xf800, 0xfbff) AM_ROM /* char rom */ - AM_RANGE(0xfc00, 0xffff) AM_RAM AM_REGION("maincpu", 0xfc00) /* programmable chars */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sorcererd_mem, AS_PROGRAM, 8, sorcerer_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") - AM_RANGE(0x0800, 0xbbff) AM_RAM - AM_RANGE(0xbc00, 0xbcff) AM_ROM - AM_RANGE(0xbe00, 0xbe03) AM_DEVREADWRITE("fdc", micropolis_device, read, write) - //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslot - AM_RANGE(0xe000, 0xefff) AM_ROM /* rom pac and bios */ - AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_REGION("maincpu", 0xf000) /* screen ram */ - AM_RANGE(0xf800, 0xfbff) AM_ROM /* char rom */ - AM_RANGE(0xfc00, 0xffff) AM_RAM AM_REGION("maincpu", 0xfc00) /* programmable chars */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sorcerer_io, AS_IO, 8, sorcerer_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xfc, 0xfc) AM_READWRITE( sorcerer_fc_r, sorcerer_fc_w ) - AM_RANGE(0xfd, 0xfd) AM_READWRITE( sorcerer_fd_r, sorcerer_fd_w ) - AM_RANGE(0xfe, 0xfe) AM_READWRITE( sorcerer_fe_r, sorcerer_fe_w ) - AM_RANGE(0xff, 0xff) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE(0xff, 0xff) AM_WRITE( sorcerer_ff_w ) -ADDRESS_MAP_END - -static INPUT_PORTS_START(sorcerer) - PORT_START("VS") - /* vblank */ - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_VBLANK("screen") - - /* line 0 */ - PORT_START("X.0") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graphic") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - /* line 1 */ - PORT_START("X.1") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Sel)") PORT_CODE(KEYCODE_F2) PORT_CHAR(27) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Skip") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_F5) PORT_CHAR(12) - /* line 2 */ - PORT_START("X.2") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(0x11) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(0x01) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(0x1a) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(0x18) - /* line 3 */ - PORT_START("X.3") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(0x17) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(0x13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(0x04) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(0x03) - /* line 4 */ - PORT_START("X.4") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(0x05) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(0x12) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(0x06) - /* line 5 */ - PORT_START("X.5") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(0x14) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(0x07) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(0x16) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(0x02) - /* line 6 */ - PORT_START("X.6") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(0x19) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(0x08) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(0x0e) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(0x0d) - /* line 7 */ - PORT_START("X.7") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(0x15) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(0x0a) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(0x09) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(0x0b) - /* line 8 */ - PORT_START("X.8") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(0x0f) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(0x0c) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - /* line 9 */ - PORT_START("X.9") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(0x10) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - /* line 10 */ - PORT_START("X.10") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_F7) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - /* line 11 */ - PORT_START("X.11") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F6) PORT_CHAR(10) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_ Rub") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') PORT_CHAR(8) - /* line 12 */ - PORT_START("X.12") - PORT_BIT(0x10, 0x10, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - /* line 13 */ - PORT_START("X.13") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - /* line 14 */ - PORT_START("X.14") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - /* line 15 */ - PORT_START("X.15") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= (PAD)") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT(0x04, 0x04, IPT_UNUSED) - PORT_BIT(0x02, 0x02, IPT_UNUSED) - PORT_BIT(0x01, 0x01, IPT_UNUSED) - - /* Enhanced options not available on real hardware */ - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x01, DEF_STR(Yes)) - /* hardware connected to printer port */ - PORT_CONFNAME( 0x02, 0x02, "Parallel port" ) - PORT_CONFSETTING( 0x00, "7-bit" ) - PORT_CONFSETTING( 0x02, "8-bit" ) - PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") - PORT_CONFSETTING( 0x08, DEF_STR(On)) - PORT_CONFSETTING( 0x00, DEF_STR(Off)) -INPUT_PORTS_END - -/**************************** F4 CHARACTER DISPLAYER ******************************************************/ - -static const gfx_layout sorcerer_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -/* This will show the 128 characters in the ROM + whatever happens to be in the PCG */ -static GFXDECODE_START( sorcerer ) - GFXDECODE_ENTRY( "maincpu", 0xf800, sorcerer_charlayout, 0, 1 ) -GFXDECODE_END - -void sorcerer_state::video_start() -{ - m_p_videoram = memregion("maincpu")->base()+0xf000; -} - -UINT32 sorcerer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0x80,x; - UINT16 *p; - - for (y = 0; y < 30; y++) - { - for (ra = 0; ra < 8; ra++) - { - p = &bitmap.pix16(sy++); - - for (x = ma; x < ma+64; x++) - { - chr = m_p_videoram[x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_videoram[0x800 | (chr<<3) | ra]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} - - -/**********************************************************************************************************/ - -static const floppy_interface sorcerer_floppy_interface = -{ - FLOPPY_STANDARD_8_SSSD, - LEGACY_FLOPPY_OPTIONS_NAME(sorcerer), - "floppy_8" -}; - - -static MACHINE_CONFIG_START( sorcerer, sorcerer_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 12638000/6) - MCFG_CPU_PROGRAM_MAP(sorcerer_mem) - MCFG_CPU_IO_MAP(sorcerer_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(200)) - MCFG_SCREEN_SIZE(64*8, 30*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(sorcerer_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", sorcerer) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // cass1 speaker - MCFG_SOUND_WAVE_ADD(WAVE2_TAG, "cassette2") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // cass2 speaker - - MCFG_DEVICE_ADD( "uart", AY31015, 0 ) - MCFG_AY31015_TX_CLOCK(4800.0) - MCFG_AY31015_RX_CLOCK(4800.0) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "covox") - - /* The use of the parallel port as a general purpose port is not emulated. - Currently the only use is to read the printer status in the Centronics CENDRV bios routine. */ - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) - - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - /* quickload */ - MCFG_SNAPSHOT_ADD("snapshot", sorcerer_state, sorcerer, "snp", 2) - MCFG_QUICKLOAD_ADD("quickload", sorcerer_state, sorcerer, "bin", 3) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(sorcerer_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("sorcerer_cass") - - MCFG_CASSETTE_ADD( "cassette2" ) - MCFG_CASSETTE_FORMATS(sorcerer_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("sorcerer_cass") - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "sorcerer_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","sorcerer_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list","sorcerer_cass") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") - MCFG_RAM_EXTRA_OPTIONS("8K,16K,32K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sorcererd, sorcerer ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(sorcererd_mem) - - MCFG_MACHINE_START_OVERRIDE(sorcerer_state, sorcererd ) - - MCFG_DEVICE_ADD("fdc", MICROPOLIS, 0) - MCFG_MICROPOLIS_DEFAULT_DRIVE4_TAGS - - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(sorcerer_floppy_interface) - MCFG_SOFTWARE_LIST_ADD("flop_list","sorcerer_flop") -MACHINE_CONFIG_END - - -DRIVER_INIT_MEMBER(sorcerer_state, sorcerer) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000); -} - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ -ROM_START(sorcerer) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("exmo1-1.dat", 0xe000, 0x0800, CRC(ac924f67) SHA1(72fcad6dd1ed5ec0527f967604401284d0e4b6a1) ) /* monitor roms */ - ROM_LOAD("exmo1-2.dat", 0xe800, 0x0800, CRC(ead1d0f6) SHA1(c68bed7344091bca135e427b4793cc7d49ca01be) ) - ROM_LOAD("exchr-1.dat", 0xf800, 0x0400, CRC(4a7e1cdd) SHA1(2bf07a59c506b6e0c01ec721fb7b747b20f5dced) ) /* char rom */ -ROM_END - -ROM_START(sorcererd) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("diskboot.dat",0xbc00, 0x0100, CRC(d82a40d6) SHA1(cd1ef5fb0312cd1640e0853d2442d7d858bc3e3b) ) - ROM_LOAD("exmo1-1.dat", 0xe000, 0x0800, CRC(ac924f67) SHA1(72fcad6dd1ed5ec0527f967604401284d0e4b6a1) ) /* monitor roms */ - ROM_LOAD("exmo1-2.dat", 0xe800, 0x0800, CRC(ead1d0f6) SHA1(c68bed7344091bca135e427b4793cc7d49ca01be) ) - ROM_LOAD("exchr-1.dat", 0xf800, 0x0400, CRC(4a7e1cdd) SHA1(2bf07a59c506b6e0c01ec721fb7b747b20f5dced) ) /* char rom */ - - ROM_REGION( 0x200, "proms", 0 ) - ROM_LOAD_OPTIONAL("bruce.dat", 0x0000, 0x0020, CRC(fae922cb) SHA1(470a86844cfeab0d9282242e03ff1d8a1b2238d1) ) /* video prom */ -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP(1979, sorcerer, 0, 0, sorcerer, sorcerer, sorcerer_state, sorcerer, "Exidy Inc", "Sorcerer", 0 ) -COMP(1979, sorcererd, sorcerer, 0, sorcererd, sorcerer, sorcerer_state, sorcerer, "Exidy Inc", "Sorcerer (with floppy disks)", 0 ) diff --git a/src/mess/drivers/spc1000.c b/src/mess/drivers/spc1000.c deleted file mode 100644 index e69561163c6..00000000000 --- a/src/mess/drivers/spc1000.c +++ /dev/null @@ -1,522 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - -Samsung SPC-1000 driver by Miodrag Milanovic - - 2009-05-10 Preliminary driver. - 2014-02-16 Added cassette, many games are playable - -ToDo: -- Find out if any of the unconnected parts of 6000,4000,4001 are used - - -NOTE: 2014-09-13: added code from someone's modified MESS driver for floppy - disk. Since it is not to our coding standards, it is - commented out with #if 0/#endif and 3 slashes (///). - It is planned to be converted when time permits. The - author is Meeso Kim. - - Hardware details of the fdc: Intelligent device, Z80 CPU, - XTAL_8MHz, PPI 8255, FDC uPD765C, 2 RAM chips, 28 other - small ics. And of course, no schematic. - - -2014-10-11: Replaced above code with MESS-compliant code [Meeso Kim] - -2015-06-19: Added code for the centronics printer port - -IMPORTANT NOTE for tape usage: you *FIRST* press PLAY on the tape drive - (e.g. by pressing F2 in partial emulated keyboard mode) and *THEN* you - type LOAD on the BASIC prompt! - Otherwise, the system turns the tape motor ON but it does not receive any - data from tape, and it turns it OFF before the user can press PLAY. - - -****************************************************************************/ -/* - * SAMSUNG SPC-1000 Series (info from zannylim) - * - * YEAR MODEL MainVideo PRT FDD - * ---- -------------- ------ ----- ------ ------- - * 1982 SPC-1000 S68047 RGB buffer - - * 1983 SPC-1000 S68047 RF-TV buffer - - * 1983 SPC-1100 S68047 RF-TV - - - * 1983 SPC-1000/1100 MC6847 RF-TV direct support - * 1985 SPC-1000A MC6847 RF-TV direct support - * - * 2nd Video Display Processor type 1 : VDP UNIT (TMS9918 + 4KB VRAM) by staticsoft - * 2nd Video Display Processor type 2 : SOFT BOX (TMS9918 + 4KB VRAM with BIOS) by sammi computer - * - * Intelligence FDD : SD-725(2FDD, RS232C), SD-720(1FDD), SD-725A(2FDD), SD-725B(Desktop 2FDD, RS232C) - EPSON TF20 F100 - * External FDD with Expansion slot : KWE-1000 by kyungwoo - * - * Network device : ISAM-1000 by samsung - * - * +---------PRT------RGB----TVRF--+ SPC-1000 - * + + - * + ROM0 + CPU : Z80A (4MHz) - * + ROM1 + RAM : 64KB - * +-------+ ROM2 AY-3-8910 + VRAM : 6KB - * + SPC-1000 + VDG : AMI S68047 with TTL RGB output - * IPL + PSG : AY-3-8910 - * RESET S68047 + - * + Z80A + Include Internal Data-recorder - * + ROM3 + - * + + ROM : 32KB (8KB x 4) - * +---------------------------------------+ - * - * +---------PRT----VIDEO----TVRF--+ SPC-1000 - * + + - * + ROM0 LM1889 + Support RF TV Support, but Removed RGB output - * + ROM1 + - * +-------+ ROM2 AY-3-8910 SPC-1000 + - * + 1100 + - * IPL + - * RESET S68047 + - * + Z80A + - * + ROM3 + - * + + - * +---------------------------------------+ - * - * +----------------VIDEO----TVRF--+ SPC-1100 - * + + - * + ROM0 LM1889 + Removed Printer port - * + ROM1 LM386(5V) + - * +-------+ ROM2 AY-3-8910 SPC-1000 + - * + 1100 + - * IPL + - * RESET S68047 + - * + Z80A + - * + ROM3 + - * + + - * +---------------------------------------+ - * - * +---------PRT----VIDEO----TVRF--+ SPC-1000, SPC-1100 - * + + - * + ROM0 MC1372 + New Video Display Generator : MC6847 - * + ROM1 LM386(5V) + - * +-------+ ROM2 AY-3-8910 + - * + ROM3 SPC-1000/1100 + - * IPL + - * RESET MC6847 + - * + Z80A + - * + + - * + + - * +---------------------------------------+ - * - * +---------PRT----VIDEO----TVRF--+ SPC-1000, SPC-1100 - * + + - * + ROM0 S4 MC1372 + REV PCB No.839291 - * + ROM1 LM386(5V) + - * +-------+ ROM2 AY-3-8910 + Add composite color on/off switch - * + ROM3 SPC-1000/1100 + - * IPL + - * RESET MC6847 + - * + Z80A + - * + + - * + + - * +---------------------------------------+ - * - * +---------PRT----VIDEO----TVRF--+ SPC-1000A - * + + - * + ROM0 S4 MC1372 + Internal Data-recorder with Cassette Audio Player - * + ROM1 LM386(12V) + Add FDD auto detect - * +-------+ ROM2 AY-3-8910 + Remove IPL button - * + SPC-1000A ROM3 + Change DRAM refresh circuit - * IPL + Use 64K DRAM made by Samsung - * + MC6847 + Use TTL IC made by Goldstar - * + Z80A + - * + + - * + + - * +---------------------------------------+ - * - */ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "sound/ay8910.h" -#include "sound/wave.h" -#include "video/mc6847.h" -#include "imagedev/cassette.h" -#include "formats/spc1000_cas.h" -#include "bus/centronics/ctronics.h" - -#include "bus/spc1000/exp.h" -#include "bus/spc1000/fdd.h" -#include "bus/spc1000/vdp.h" - - -class spc1000_state : public driver_device -{ -public: - spc1000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_motor(false) - , m_maincpu(*this, "maincpu") - , m_vdg(*this, "mc6847") - , m_cass(*this, "cassette") - , m_ram(*this, RAM_TAG) - , m_p_videoram(*this, "videoram") - , m_io_kb(*this, "LINE") - , m_io_joy(*this, "JOY") - , m_centronics(*this, "centronics") - {} - - DECLARE_WRITE8_MEMBER(iplk_w); - DECLARE_READ8_MEMBER(iplk_r); - DECLARE_WRITE_LINE_MEMBER(irq_w); - DECLARE_WRITE8_MEMBER(gmode_w); - DECLARE_READ8_MEMBER(gmode_r); - DECLARE_READ8_MEMBER(porta_r); - DECLARE_WRITE_LINE_MEMBER( centronics_busy_w ) { m_centronics_busy = state; } - DECLARE_READ8_MEMBER(mc6847_videoram_r); - DECLARE_WRITE8_MEMBER(cass_w); - DECLARE_READ8_MEMBER(keyboard_r); - MC6847_GET_CHARROM_MEMBER(get_char_rom) - { - return m_p_videoram[0x1000 + (ch & 0x7f) * 16 + line]; - } - -private: - UINT8 m_IPLK; - UINT8 m_GMODE; - UINT16 m_page; - UINT8 *m_work_ram; - bool m_motor; - bool m_centronics_busy; - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_vdg; - required_device m_cass; - required_device m_ram; - required_shared_ptr m_p_videoram; - required_ioport_array<10> m_io_kb; - required_ioport m_io_joy; - required_device m_centronics; -}; - -static ADDRESS_MAP_START(spc1000_mem, AS_PROGRAM, 8, spc1000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") - AM_RANGE(0x8000, 0xffff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4") -ADDRESS_MAP_END - -WRITE8_MEMBER(spc1000_state::iplk_w) -{ - m_IPLK = m_IPLK ? 0 : 1; - membank("bank1")->set_entry(m_IPLK); - membank("bank3")->set_entry(m_IPLK); -} - -READ8_MEMBER(spc1000_state::iplk_r) -{ - m_IPLK = m_IPLK ? 0 : 1; - membank("bank1")->set_entry(m_IPLK); - membank("bank3")->set_entry(m_IPLK); - - return 0; -} - -WRITE8_MEMBER( spc1000_state::cass_w ) -{ - bool m = BIT(data, 1) ? true : false; - m_cass->output(BIT(data, 0) ? -1.0 : 1.0); - if (m && !m_motor) - m_cass->change_state(m_cass->get_state() & CASSETTE_MASK_MOTOR ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_motor = m; - m_centronics->write_strobe(BIT(data, 2) ? true : false); -} - -WRITE8_MEMBER(spc1000_state::gmode_w) -{ - m_GMODE = data; - - // m_GMODE layout: CSS|NA|PS2|PS1|~A/G|GM0|GM1|NA - // [PS2,PS1] is used to set screen 0/1 pages - m_vdg->gm1_w(BIT(data, 1)); - m_vdg->gm0_w(BIT(data, 2)); - m_vdg->ag_w(BIT(data, 3)); - m_vdg->css_w(BIT(data, 7)); - m_page = ((BIT(data, 5) << 1) | BIT(data, 4)) * 0x200; -} - -READ8_MEMBER(spc1000_state::gmode_r) -{ - return m_GMODE; -} - -READ8_MEMBER( spc1000_state::keyboard_r ) -{ - // most games just read kb in $8000-$8009 but a few of them - // (e.g. Toiler Adventure II and Vela) use mirrored addr instead - offset &= 0xf; - - if (offset <= 9) - return m_io_kb[offset]->read(); - else - return 0xff; -} - - -static ADDRESS_MAP_START( spc1000_io , AS_IO, 8, spc1000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x2000, 0x3fff) AM_READWRITE(gmode_r, gmode_w) - AM_RANGE(0x4000, 0x4000) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0x4001, 0x4001) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) - AM_RANGE(0x6000, 0x6000) AM_WRITE(cass_w) - AM_RANGE(0x8000, 0x9fff) AM_READ(keyboard_r) - AM_RANGE(0xa000, 0xa000) AM_READWRITE(iplk_r, iplk_w) - AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE("ext1", spc1000_exp_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( spc1000 ) - PORT_START("LINE.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_RCONTROL) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_PAUSE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x16) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("LINE.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - - PORT_START("LINE.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(0x12) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START("LINE.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - - PORT_START("LINE.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START("LINE.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - - PORT_START("LINE.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("LINE.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - - PORT_START("LINE.9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START) PORT_NAME("IPL") PORT_CODE(KEYCODE_END) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0e) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START("JOY") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) // Button 2? - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) // Cassette related -INPUT_PORTS_END - - -void spc1000_state::machine_start() -{ - UINT8 *mem = memregion("maincpu")->base(); - UINT8 *ram = m_ram->pointer(); - - // configure and intialize banks 1 & 3 (read banks) - membank("bank1")->configure_entry(0, ram); - membank("bank1")->configure_entry(1, mem); - membank("bank3")->configure_entry(0, ram + 0x8000); - membank("bank3")->configure_entry(1, mem); - membank("bank1")->set_entry(1); - membank("bank3")->set_entry(1); - - // intialize banks 2 & 4 (write banks) - membank("bank2")->set_base(ram); - membank("bank4")->set_base(ram + 0x8000); -} - -void spc1000_state::machine_reset() -{ - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_IPLK = 1; - m_motor = false; -} - -READ8_MEMBER(spc1000_state::mc6847_videoram_r) -{ - if (offset == ~0) - return 0xff; - - // m_GMODE layout: CSS|NA|PS2|PS1|~A/G|GM0|GM1|NA - if (!BIT(m_GMODE, 3)) - { // text mode (~A/G set to A) - UINT8 data = m_p_videoram[offset + m_page + 0x800]; - m_vdg->inv_w(BIT(data, 0)); - m_vdg->css_w(BIT(data, 1)); - m_vdg->as_w (BIT(data, 2)); - m_vdg->intext_w(BIT(data, 3)); - return m_p_videoram[offset + m_page]; - } - else - { // graphics mode: uses full 6KB of VRAM - return m_p_videoram[offset]; - } -} - -READ8_MEMBER( spc1000_state::porta_r ) -{ - UINT8 data = 0x3f; - data |= (m_cass->input() > 0.0038) ? 0x80 : 0; - data |= ((m_cass->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED) && ((m_cass->get_state() & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED) ? 0x00 : 0x40; - data &= ~(m_io_joy->read() & 0x3f); - data &= ~((m_centronics_busy == 0)<< 5); - return data; -} - -// irq is inverted in emulation, so we need this trampoline -WRITE_LINE_MEMBER( spc1000_state::irq_w ) -{ - m_maincpu->set_input_line(0, state ? CLEAR_LINE : HOLD_LINE); -} - -//------------------------------------------------- -// address maps -//------------------------------------------------- - -extern SLOT_INTERFACE_START(spc1000_exp) - SLOT_INTERFACE("fdd", SPC1000_FDD_EXP) - SLOT_INTERFACE("vdp", SPC1000_VDP_EXP) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( spc1000, spc1000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(spc1000_mem) - MCFG_CPU_IO_MAP(spc1000_io) - - /* video hardware */ - MCFG_SCREEN_MC6847_NTSC_ADD("screen", "mc6847") - - MCFG_DEVICE_ADD("mc6847", MC6847_NTSC, XTAL_3_579545MHz) - MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(spc1000_state, irq_w)) - MCFG_MC6847_INPUT_CALLBACK(READ8(spc1000_state, mc6847_videoram_r)) - MCFG_MC6847_CHARROM_CALLBACK(spc1000_state, get_char_rom) - MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM2) - // other lines not connected - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_4MHz / 1) - MCFG_AY8910_PORT_A_READ_CB(READ8(spc1000_state, porta_r)) - MCFG_AY8910_PORT_B_WRITE_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_DEVICE_ADD("ext1", SPC1000_EXP_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(spc1000_exp, NULL, false) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(spc1000_state, centronics_busy_w)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(spc1000_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED) - - MCFG_SOFTWARE_LIST_ADD("cass_list", "spc1000_cass") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( spc1000 ) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD("spcall.rom", 0x0000, 0x8000, CRC(19638fc9) SHA1(489f1baa7aebf3c8c660325fb1fd790d84203284)) -ROM_END - -#if 0 -ROM_START( spc1000 ) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD("spcall.rom", 0x0000, 0x8000, CRC(2fbb6eca) SHA1(cc9a076b0f00d54b2aec31f1f558b10f43ef61c8)) - /// more roms to come... -ROM_END -#endif - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, spc1000, 0, 0, spc1000, spc1000, driver_device, 0, "Samsung", "SPC-1000", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/spec128.c b/src/mess/drivers/spec128.c deleted file mode 100644 index 0c5161f65f4..00000000000 --- a/src/mess/drivers/spec128.c +++ /dev/null @@ -1,364 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/*************************************************************************** - - NOTE: ****** Specbusy: press N, R, or E to boot ************* - - - Spectrum/Inves/TK90X etc. memory map: - - CPU: - 0000-3fff ROM - 4000-ffff RAM - - Spectrum 128/+2/+2a/+3 memory map: - - CPU: - 0000-3fff Banked ROM/RAM (banked rom only on 128/+2) - 4000-7fff Banked RAM - 8000-bfff Banked RAM - c000-ffff Banked RAM - - TS2068 memory map: (Can't have both EXROM and DOCK active) - The 8K EXROM can be loaded into multiple pages. - - CPU: - 0000-1fff ROM / EXROM / DOCK (Cartridge) - 2000-3fff ROM / EXROM / DOCK - 4000-5fff \ - 6000-7fff \ - 8000-9fff |- RAM / EXROM / DOCK - a000-bfff | - c000-dfff / - e000-ffff / - - -Interrupts: - -Changes: - -29/1/2000 KT - Implemented initial +3 emulation. -30/1/2000 KT - Improved input port decoding for reading and therefore - correct keyboard handling for Spectrum and +3. -31/1/2000 KT - Implemented buzzer sound for Spectrum and +3. - Implementation copied from Paul Daniel's Jupiter driver. - Fixed screen display problems with dirty chars. - Added support to load .Z80 snapshots. 48k support so far. -13/2/2000 KT - Added Interface II, Kempston, Fuller and Mikrogen - joystick support. -17/2/2000 DJR - Added full key descriptions and Spectrum+ keys. - Fixed Spectrum +3 keyboard problems. -17/2/2000 KT - Added tape loading from WAV/Changed from DAC to generic - speaker code. -18/2/2000 KT - Added tape saving to WAV. -27/2/2000 KT - Took DJR's changes and added my changes. -27/2/2000 KT - Added disk image support to Spectrum +3 driver. -27/2/2000 KT - Added joystick I/O code to the Spectrum +3 I/O handler. -14/3/2000 DJR - Tape handling dipswitch. -26/3/2000 DJR - Snapshot files are now classifed as snapshots not - cartridges. -04/4/2000 DJR - Spectrum 128 / +2 Support. -13/4/2000 DJR - +4 Support (unofficial 48K hack). -13/4/2000 DJR - +2a Support (rom also used in +3 models). -13/4/2000 DJR - TK90X, TK95 and Inves support (48K clones). -21/4/2000 DJR - TS2068 and TC2048 support (TC2048 Supports extra video - modes but doesn't have bank switching or sound chip). -09/5/2000 DJR - Spectrum +2 (France, Spain), +3 (Spain). -17/5/2000 DJR - Dipswitch to enable/disable disk drives on +3 and clones. -27/6/2000 DJR - Changed 128K/+3 port decoding (sound now works in Zub 128K). -06/8/2000 DJR - Fixed +3 Floppy support -10/2/2001 KT - Re-arranged code and split into each model emulated. - Code is split into 48k, 128k, +3, tc2048 and ts2048 - segments. 128k uses some of the functions in 48k, +3 - uses some functions in 128, and tc2048/ts2048 use some - of the functions in 48k. The code has been arranged so - these functions come in some kind of "override" order, - read functions changed to use READ8_HANDLER and write - functions changed to use WRITE8_HANDLER. - Added Scorpion256 preliminary. -18/6/2001 DJR - Added support for Interface 2 cartridges. -xx/xx/2001 KS - TS-2068 sound fixed. - Added support for DOCK cartridges for TS-2068. - Added Spectrum 48k Psycho modified rom driver. - Added UK-2086 driver. -23/12/2001 KS - 48k machines are now able to run code in screen memory. - Programs which keep their code in screen memory - like monitors, tape copiers, decrunchers, etc. - works now. - Fixed problem with interrupt vector set to 0xffff (much - more 128k games works now). - A useful used trick on the Spectrum is to set - interrupt vector to 0xffff (using the table - which contain 0xff's) and put a byte 0x18 hex, - the opcode for JR, at this address. The first - byte of the ROM is a 0xf3 (DI), so the JR will - jump to 0xfff4, where a long JP to the actual - interrupt routine is put. Due to unideal - bankswitching in MAME this JP were to 0001 what - causes Spectrum to reset. Fixing this problem - made much more software runing (i.e. Paperboy). - Corrected frames per second value for 48k and 128k - Sinclair machines. - There are 50.08 frames per second for Spectrum - 48k what gives 69888 cycles for each frame and - 50.021 for Spectrum 128/+2/+2A/+3 what gives - 70908 cycles for each frame. - Remapped some Spectrum+ keys. - Pressing F3 to reset was seting 0xf7 on keyboard - input port. Problem occurred for snapshots of - some programms where it was readed as pressing - key 4 (which is exit in Tapecopy by R. Dannhoefer - for example). - Added support to load .SP snapshots. - Added .BLK tape images support. - .BLK files are identical to .TAP ones, extension - is an only difference. -08/03/2002 KS - #FF port emulation added. - Arkanoid works now, but is not playable due to - completly messed timings. - -Initialisation values used when determining which model is being emulated: - 48K Spectrum doesn't use either port. - 128K/+2 Bank switches with port 7ffd only. - +3/+2a Bank switches with both ports. - -Notes: - 1. No contented memory. - 2. No hi-res colour effects (need contended memory first for accurate timing). - 3. Multiface 1 and Interface 1 not supported. - 4. Horace and the Spiders cartridge doesn't run properly. - 5. Tape images not supported: - .TZX, .SPC, .ITM, .PAN, .TAP(Warajevo), .VOC, .ZXS. - 6. Snapshot images not supported: - .ACH, .PRG, .RAW, .SEM, .SIT, .SNX, .ZX, .ZXS, .ZX82. - 7. 128K emulation is not perfect - the 128K machines crash and hang while - running quite a lot of games. - 8. Disk errors occur on some +3 games. - 9. Video hardware of all machines is timed incorrectly. -10. EXROM and HOME cartridges are not emulated. -11. The TK90X and TK95 roms output 0 to port #df on start up. -12. The purpose of this port is unknown (probably display mode as TS2068) and - thus is not emulated. - -Very detailed infos about the ZX Spectrum +3e can be found at - -http://www.z88forever.org.uk/zxplus3e/ - - -The hc2000 corrupts its memory, especially if you type something, and the -resulting mess can be seen in the F4 viewer display. - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "includes/spectrum.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/ay8910.h" -#include "sound/speaker.h" -#include "formats/tzx_cas.h" -#include "machine/ram.h" - -/****************************************************************************************************/ -/* Spectrum 128 specific functions */ - -WRITE8_MEMBER(spectrum_state::spectrum_128_port_7ffd_w) -{ - /* D0-D2: RAM page located at 0x0c000-0x0ffff */ - /* D3 - Screen select (screen 0 in ram page 5, screen 1 in ram page 7 */ - /* D4 - ROM select - which rom paged into 0x0000-0x03fff */ - /* D5 - Disable paging */ - - /* disable paging? */ - if (m_port_7ffd_data & 0x20) - return; - - if ((m_port_7ffd_data ^ data) & 0x08) - spectrum_UpdateScreenBitmap(); - - /* store new state */ - m_port_7ffd_data = data; - - /* update memory */ - spectrum_128_update_memory(); -} - -void spectrum_state::spectrum_128_update_memory() -{ - UINT8 *messram = m_ram->pointer(); - - /* select ram at 0x0c000-0x0ffff */ - int ram_page = m_port_7ffd_data & 0x07; - unsigned char *ram_data = messram + (ram_page<<14); - membank("bank4")->set_base(ram_data); - - if (BIT(m_port_7ffd_data, 3)) - m_screen_location = messram + (7<<14); - else - m_screen_location = messram + (5<<14); - - if (!m_cart->exists()) - { - /* ROM switching */ - int ROMSelection = BIT(m_port_7ffd_data, 4); - - /* rom 0 is 128K rom, rom 1 is 48 BASIC */ - unsigned char *ChosenROM = memregion("maincpu")->base() + 0x010000 + (ROMSelection << 14); - - membank("bank1")->set_base(ChosenROM); - } -} - -READ8_MEMBER( spectrum_state::spectrum_128_ula_r ) -{ - int vpos = machine().first_screen()->vpos(); - - return vpos<193 ? m_screen_location[0x1800|(vpos&0xf8)<<2]:0xff; -} - -static ADDRESS_MAP_START (spectrum_128_io, AS_IO, 8, spectrum_state ) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) - AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) - AM_RANGE(0x007f, 0x007f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) - AM_RANGE(0x00df, 0x00df) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) - AM_RANGE(0x0000, 0x0000) AM_WRITE(spectrum_128_port_7ffd_w) AM_MIRROR(0x7ffd) // (A15 | A1) == 0, note: reading from this port does write to it by value from data bus - AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3ffd) - AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd) - AM_RANGE(0x0001, 0x0001) AM_READ(spectrum_128_ula_r) AM_MIRROR(0xfffe) -ADDRESS_MAP_END - -static ADDRESS_MAP_START (spectrum_128_mem, AS_PROGRAM, 8, spectrum_state ) - AM_RANGE( 0x0000, 0x3fff) AM_ROMBANK("bank1") // don't use RAMBANK here otherwise programs can erase the ROM(!) - AM_RANGE( 0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE( 0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE( 0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -MACHINE_RESET_MEMBER(spectrum_state,spectrum_128) -{ - UINT8 *messram = m_ram->pointer(); - - memset(messram,0,128*1024); - /* 0x0000-0x3fff always holds ROM */ - - /* Bank 5 is always in 0x4000 - 0x7fff */ - membank("bank2")->set_base(messram + (5<<14)); - - /* Bank 2 is always in 0x8000 - 0xbfff */ - membank("bank3")->set_base(messram + (2<<14)); - - MACHINE_RESET_CALL_MEMBER(spectrum); - - /* set initial ram config */ - m_port_7ffd_data = 0; - m_port_1ffd_data = -1; - spectrum_128_update_memory(); -} - -/* F4 Character Displayer */ -static const gfx_layout spectrum_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 96, /* 96 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( spec128 ) - GFXDECODE_ENTRY( "maincpu", 0x17d00, spectrum_charlayout, 0, 8 ) -GFXDECODE_END - - -MACHINE_CONFIG_DERIVED( spectrum_128, spectrum ) - - MCFG_DEVICE_REMOVE("maincpu") - - MCFG_CPU_ADD("maincpu", Z80, X1_128_SINCLAIR / 5) - MCFG_CPU_PROGRAM_MAP(spectrum_128_mem) - MCFG_CPU_IO_MAP(spectrum_128_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", spectrum_state, spec_interrupt) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, spectrum_128 ) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_RAW_PARAMS(X1_128_SINCLAIR / 2.5f, 456, 0, 352, 311, 0, 296) - - MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum_128 ) - MCFG_GFXDECODE_MODIFY("gfxdecode", spec128) - - /* sound hardware */ - MCFG_SOUND_ADD("ay8912", AY8912, 1773400) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - - -ROM_START(spec128) - ROM_REGION(0x18000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "en", "English" ) - ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(1)) - ROMX_LOAD("zx128_1.rom",0x14000,0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) - ROMX_LOAD("zx128s0.rom",0x10000,0x4000, CRC(453d86b2) SHA1(968937b1c750f0ef6205f01c6db4148da4cca4e3), ROM_BIOS(2)) - ROMX_LOAD("zx128s1.rom",0x14000,0x4000, CRC(6010e796) SHA1(bea3f397cc705eafee995ea629f4a82550562f90), ROM_BIOS(2)) -ROM_END - -ROM_START(specpls2) - ROM_REGION(0x18000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "en", "English" ) - ROMX_LOAD("zxp2_0.rom",0x10000,0x4000, CRC(5d2e8c66) SHA1(72703f9a3e734f3c23ec34c0727aae4ccbef9a91), ROM_BIOS(1)) - ROMX_LOAD("zxp2_1.rom",0x14000,0x4000, CRC(98b1320b) SHA1(de8b0d2d0379cfe7c39322a086ca6da68c7f23cb), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "fr", "French" ) - ROMX_LOAD("plus2fr0.rom",0x10000,0x4000, CRC(c684c535) SHA1(56684c4c85a616e726a50707483b9a42d8e724ed), ROM_BIOS(2)) - ROMX_LOAD("plus2fr1.rom",0x14000,0x4000, CRC(f5e509c5) SHA1(7e398f62689c9d90a36d3a101351ec9987207308), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "sp", "Spanish" ) - ROMX_LOAD("plus2sp0.rom",0x10000,0x4000, CRC(e807d06e) SHA1(8259241b28ff85441f1bedc2bee53445767c51c5), ROM_BIOS(3)) - ROMX_LOAD("plus2sp1.rom",0x14000,0x4000, CRC(41981d4b) SHA1(ec0d5a158842d20601b4fbeaefc6668db979d0e1), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "ao", "ZX Spectrum +2c (Andrew Owen)" ) - ROMX_LOAD("plus2c-0.rom",0x10000,0x4000, CRC(bfddf748) SHA1(3eba870bcb2c5efa906f2ca3febe960fc35d66bb), ROM_BIOS(4)) - ROMX_LOAD("plus2c-1.rom",0x14000,0x4000, CRC(fd8552b6) SHA1(5ffcf79f2154ba2cf42cc1d9cb4be93cb5043e73), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "namco", "ZX Spectrum +2c (Namco)" ) - ROMX_LOAD("pl2namco.rom",0x10000,0x8000, CRC(72a54e75) SHA1(311400157df689450dadc3620f4c4afa960b05ad), ROM_BIOS(5)) -ROM_END - -ROM_START(hc128) - ROM_REGION(0x18000,"maincpu",0) - ROM_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5)) - ROM_LOAD("hc128.rom", 0x14000,0x4000, CRC(0241e960) SHA1(cea0d14391b9e571460a816088a1c00ecb24afa3)) -ROM_END - -ROM_START(hc2000) - ROM_REGION(0x18000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) - ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(1)) - ROMX_LOAD("hc2000.v1", 0x14000,0x4000, CRC(453c1a5a) SHA1(f8139fc38478691cf44944dc83fd6e70b0f002fb), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) - ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(2)) - ROMX_LOAD("hc2000.v2", 0x14000,0x4000, CRC(65d90464) SHA1(5e2096e6460ff2120c8ada97579fdf82c1199c09), ROM_BIOS(2)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1986, spec128, 0, 0, spectrum_128, spec_plus, driver_device, 0, "Sinclair Research Ltd", "ZX Spectrum 128" , 0 ) -COMP( 1986, specpls2, spec128, 0, spectrum_128, spec_plus, driver_device, 0, "Amstrad plc", "ZX Spectrum +2" , 0 ) -COMP( 1991, hc128, spec128, 0, spectrum_128, spec_plus, driver_device, 0, "ICE-Felix", "HC-128" , 0 ) -COMP( 1992, hc2000, spec128, 0, spectrum_128, spec_plus, driver_device, 0, "ICE-Felix", "HC-2000" , MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/special.c b/src/mess/drivers/special.c deleted file mode 100644 index fa5c6943602..00000000000 --- a/src/mess/drivers/special.c +++ /dev/null @@ -1,599 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Specialist driver by Miodrag Milanovic - - 2008-03-15 Preliminary driver. - 2008-03-20 Cassette support - -****************************************************************************/ - - -#include "includes/special.h" - - -/* Address maps */ -static ADDRESS_MAP_START(specialist_mem, AS_PROGRAM, 8, special_state ) - AM_RANGE( 0x0000, 0x2fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x3000, 0x8fff ) AM_RAM // RAM - AM_RANGE( 0x9000, 0xbfff ) AM_RAM AM_SHARE("p_videoram") // Video RAM - AM_RANGE( 0xc000, 0xefff ) AM_ROM // System ROM - AM_RANGE( 0xf800, 0xf803 ) AM_MIRROR(0x7fc) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(specialp_mem, AS_PROGRAM, 8, special_state ) - AM_RANGE( 0x0000, 0x2fff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x3000, 0x7fff ) AM_RAM // RAM - AM_RANGE( 0x8000, 0xbfff ) AM_RAM AM_SHARE("p_videoram") // Video RAM - AM_RANGE( 0xc000, 0xefff ) AM_ROM // System ROM - AM_RANGE( 0xf800, 0xf803 ) AM_MIRROR(0x7fc) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(erik_mem, AS_PROGRAM, 8, special_state ) - AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x4000, 0x8fff ) AM_RAMBANK("bank2") - AM_RANGE( 0x9000, 0xbfff ) AM_RAMBANK("bank3") - AM_RANGE( 0xc000, 0xefff ) AM_RAMBANK("bank4") - AM_RANGE( 0xf000, 0xf7ff ) AM_RAMBANK("bank5") - AM_RANGE( 0xf800, 0xffff ) AM_RAMBANK("bank6") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( erik_io_map, AS_IO, 8, special_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf1, 0xf1) AM_READWRITE(erik_rr_reg_r, erik_rr_reg_w) - AM_RANGE(0xf2, 0xf2) AM_READWRITE(erik_rc_reg_r, erik_rc_reg_w) - AM_RANGE(0xf3, 0xf3) AM_READWRITE(erik_disk_reg_r, erik_disk_reg_w) - AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("fd1793", fd1793_t, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(specimx_mem, AS_PROGRAM, 8, special_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x8fff ) AM_RAMBANK("bank1") - AM_RANGE( 0x9000, 0xbfff ) AM_RAMBANK("bank2") - AM_RANGE( 0xc000, 0xffbf ) AM_RAMBANK("bank3") - AM_RANGE( 0xffc0, 0xffdf ) AM_RAMBANK("bank4") - AM_RANGE( 0xffe0, 0xffe3 ) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) - AM_RANGE( 0xffe4, 0xffe7 ) AM_RAM //external 8255 - AM_RANGE( 0xffe8, 0xffeb ) AM_DEVREADWRITE("fd1793", fd1793_t, read, write) - AM_RANGE( 0xffec, 0xffef ) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) - AM_RANGE( 0xfff0, 0xfff3 ) AM_READWRITE(specimx_disk_ctrl_r, specimx_disk_ctrl_w) - AM_RANGE( 0xfff8, 0xfffb ) AM_READWRITE(specimx_video_color_r,specimx_video_color_w) - AM_RANGE( 0xfffc, 0xffff ) AM_WRITE(specimx_select_bank) -ADDRESS_MAP_END - -/* Input ports */ - -/* Inputs will need to be adapted when/if support for non-latin keys is added to natural keyboard: -these systems have different keys to switch among alphabets! -*/ -static INPUT_PORTS_START( special ) -/* Alt switches between Latin and Cyrillic alphabets */ - PORT_START("LINE0") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("LINE1") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('\\') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - - PORT_START("LINE2") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - - PORT_START("LINE3") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("LINE4") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("LINE5") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("LINE6") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("LINE7") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("LINE8") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("LINE9") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("LINE10") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("LINE11") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lat / Cyr") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("LINE12") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - -static INPUT_PORTS_START( specialp ) - PORT_INCLUDE( special ) - - /* Shift itself switches between Latin and Cyrillic alphabets */ - PORT_MODIFY("LINE0") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') PORT_CHAR('-') - - PORT_MODIFY("LINE11") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) -INPUT_PORTS_END - -static INPUT_PORTS_START( lik ) - PORT_INCLUDE( special ) - - /* 2009-05 FP: Shift + Numbers produces still numbers: does it work differently outside monitor? */ - PORT_MODIFY("LINE0") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_MODIFY("LINE2") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')// PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9')// PORT_CHAR(')') - - PORT_MODIFY("LINE3") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8')// PORT_CHAR('(') - - PORT_MODIFY("LINE4") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7')// PORT_CHAR('\'') - - PORT_MODIFY("LINE5") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6')// PORT_CHAR('&') - - PORT_MODIFY("LINE6") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5')// PORT_CHAR('%') - - PORT_MODIFY("LINE7") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4')// PORT_CHAR('$') - - PORT_MODIFY("LINE8") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3')// PORT_CHAR('#') - - PORT_MODIFY("LINE9") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2')// PORT_CHAR('"') - - PORT_MODIFY("LINE10") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1')// PORT_CHAR('!') -INPUT_PORTS_END - - -static INPUT_PORTS_START( specimx ) -/* Alt switches between Latin and Cyrillic alphabets */ - PORT_START("LINE0") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("LINE1") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("End") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("LINE2") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("LINE3") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("LINE4") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("LINE5") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("LINE6") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("LINE7") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("LINE8") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("LINE9") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("LINE10") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - - PORT_START("LINE11") - PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - PORT_START("LINE12") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - -FLOPPY_FORMATS_MEMBER( special_state::specimx_floppy_formats ) - FLOPPY_SMX_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( specimx_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -/* Machine driver */ -static MACHINE_CONFIG_START( special, special_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(specialist_mem) - MCFG_MACHINE_RESET_OVERRIDE(special_state, special ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(384, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) - MCFG_VIDEO_START_OVERRIDE(special_state,special) - MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_special) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(special_state, specialist_8255_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(special_state, specialist_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(special_state, specialist_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(special_state, specialist_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rks_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("special_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","special_cass") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( specialp, special ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(specialp_mem) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_specialp) - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_VIDEO_START_OVERRIDE(special_state,specialp) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( specialm, special ) - MCFG_DEVICE_REMOVE("ppi8255") - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(special_state, specialist_8255_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(special_state, specialist_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(special_state, specimx_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(special_state, specialist_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( specimx, special ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(specimx_mem) - - MCFG_MACHINE_START_OVERRIDE (special_state, specimx ) - MCFG_MACHINE_RESET_OVERRIDE (special_state, specimx ) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_specimx) - MCFG_VIDEO_START_OVERRIDE(special_state,specimx) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(16) - MCFG_PALETTE_INIT_OWNER(special_state, specimx ) - - /* audio hardware */ - MCFG_SOUND_ADD("custom", SPECIMX_SND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* Devices */ - MCFG_DEVICE_ADD( "pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(2000000) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("custom", specimx_sound_device, set_input_ch0)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("custom", specimx_sound_device, set_input_ch1)) - MCFG_PIT8253_CLK2(2000000) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("custom", specimx_sound_device, set_input_ch2)) - - MCFG_DEVICE_REMOVE("ppi8255") - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(special_state, specialist_8255_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(special_state, specialist_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(special_state, specimx_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(special_state, specialist_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) - - MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(special_state, fdc_drq)) - MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525qd", special_state::specimx_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525qd", special_state::specimx_floppy_formats) - MCFG_SOFTWARE_LIST_ADD("flop_list","special_flop") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( erik, special_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(erik_mem) - MCFG_CPU_IO_MAP(erik_io_map) - MCFG_MACHINE_RESET_OVERRIDE(special_state, erik ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(384, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) - MCFG_VIDEO_START_OVERRIDE(special_state,erik) - MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_erik) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(special_state,erik) - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rks_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("special_cass") - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(special_state, specialist_8255_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(special_state, specialist_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(special_state, specialist_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(special_state, specialist_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(special_state, specialist_8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(special_state, specialist_8255_portc_w)) - - MCFG_FD1793_ADD("fd1793", XTAL_8MHz / 8) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(special_state, fdc_drq)) - MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525qd", special_state::specimx_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525qd", special_state::specimx_floppy_formats) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("192K") - MCFG_RAM_DEFAULT_VALUE(0x00) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( special ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "2nd", "2nd rev.") - ROMX_LOAD( "monitor2_1.rom", 0xc000, 0x0800, CRC(52abde77) SHA1(66ba2ef9eac14a5c0df510224ea25fd5745399cd), ROM_BIOS(1)) - ROMX_LOAD( "monitor2_2.rom", 0xc800, 0x0800, CRC(c425f719) SHA1(1c322591b4e5c8b01b81362c6801aa6fd9fc1492), ROM_BIOS(1)) - ROMX_LOAD( "monitor2_3.rom", 0xd000, 0x0800, CRC(d804aeba) SHA1(1585f354719c25e1f59c7cb8b3a3f5d309a7e8fb), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "2rom", "2nd rev. rom disk") - ROMX_LOAD( "monitor2_1.rom", 0xc000, 0x0800, CRC(52abde77) SHA1(66ba2ef9eac14a5c0df510224ea25fd5745399cd), ROM_BIOS(2)) - ROMX_LOAD( "m2_rom-disk.rom", 0xc800, 0x0800, CRC(7bd3d476) SHA1(232341755ae794f8aab4f6181c8d499a66016af2), ROM_BIOS(2)) - ROMX_LOAD( "monitor2_3.rom", 0xd000, 0x0800, CRC(d804aeba) SHA1(1585f354719c25e1f59c7cb8b3a3f5d309a7e8fb), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "1b", "1st rev. + BASIC") - ROMX_LOAD( "root.rom", 0xc000, 0x0800, CRC(62de741d) SHA1(6c6a29d4340b0b1230c708f9c04ff2ed1c012a76), ROM_BIOS(3)) - ROMX_LOAD( "pzu2.rom", 0xc800, 0x0800, CRC(49937e13) SHA1(872ae5a7c3496d4404cdd577caa2236424016c66), ROM_BIOS(3)) - ROMX_LOAD( "pzu3.rom", 0xd000, 0x0800, CRC(dc817a08) SHA1(8101fe924386f38c10ef929e6dea5a83fcf34600), ROM_BIOS(3)) - ROMX_LOAD( "pzu4.rom", 0xd800, 0x0800, CRC(6793ba23) SHA1(3a27b5dbc6561ea7af5fb30513dc83ec64f1d94c), ROM_BIOS(3)) - ROMX_LOAD( "pzu5.rom", 0xe000, 0x0800, CRC(13a1a0dc) SHA1(3a0818cb8f36c2c5a9b9916669538ad1702a7710), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "1st", "1st rev.") - ROMX_LOAD( "special1.rom", 0xc000, 0x1000, CRC(217414bd) SHA1(345cd1410fbca8f75421d12d1419f27f81cd35d6), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "2col", "2nd rev. color") - ROMX_LOAD( "col_mon2.rom", 0xc000, 0x0800, CRC(8cebb1b5) SHA1(0c912a25220de8c5135e16c443e4796e6bb6f805), ROM_BIOS(5)) - ROMX_LOAD( "monitor2_2.rom", 0xc800, 0x0800, CRC(c425f719) SHA1(1c322591b4e5c8b01b81362c6801aa6fd9fc1492), ROM_BIOS(5)) - ROMX_LOAD( "monitor2_3.rom", 0xd000, 0x0800, CRC(d804aeba) SHA1(1585f354719c25e1f59c7cb8b3a3f5d309a7e8fb), ROM_BIOS(5)) -ROM_END - -ROM_START( specialm ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "pzu1-m.rom", 0xc000, 0x0800, CRC(61e94485) SHA1(dbe212dcd377cb8cd16000516cd4b3b760ce779e)) - ROM_LOAD( "pzu2-m.rom", 0xc800, 0x0800, CRC(83d76815) SHA1(9d139eaa6ca6b241fa9fac94ede72abb56d83674)) - ROM_LOAD( "pzu3-m.rom", 0xd000, 0x0800, CRC(2121ad65) SHA1(b43811d058d818f8c1cee59b405b515f96958656)) - ROM_LOAD( "pzu4-m.rom", 0xd800, 0x0800, CRC(8bf8218e) SHA1(bd1174c384b04a40dfcaa35aa373c5070304f37b)) -ROM_END - -ROM_START( specialp ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "special6.rom", 0xc000, 0x1000, CRC(f0c5a0ac) SHA1(50b53bd7c05117930aa84653a9ea0fc0c6f0f496) ) -ROM_END - -ROM_START( lik ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "1st", "1st rev.") - ROMX_LOAD( "lik.rom", 0xc000, 0x3000, CRC(705bb3a0) SHA1(f90b009ec9d3303bbda228714dd24de057e744b6), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "2nd", "2nd rev.") - ROMX_LOAD( "lik2.rom", 0xc000, 0x3000, CRC(71820e43) SHA1(a85b4fc33b1ea96a1b8fe0c791f1aab8e967bb44), ROM_BIOS(2)) -ROM_END - -ROM_START( specimx ) - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "fos", "ROM FOS") - ROMX_LOAD( "specimx.rom", 0x10000, 0xb800, CRC(db68f9b1) SHA1(c79888449f8a605267ec3e10dcc8e6e6f43b3a95), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "nc", "NC") - ROMX_LOAD( "ncrdy.rom", 0x10000, 0x10000, CRC(5d04c522) SHA1(d7daa7fe14cd8e0c6f87fd6453ec3e94ea2c259f) ,ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "ramfos", "RAMFOS") - ROMX_LOAD( "ramfos.rom", 0x10000, 0x3000, CRC(83e19df4) SHA1(20e5e53eb45729a24c1c7c63e114dbd14e3c4184) ,ROM_BIOS(3)) -ROM_END - -ROM_START( erik ) - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "erik.bin", 0x10000, 0x10000, CRC(6f3208f4) SHA1(41f6e2763ef60d3c7214c98893e580d25346fa2d)) -ROM_END - -ROM_START( pioner ) - // Ukranian clone with 16KB RAM - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "pioner.rf2", 0xc000, 0x0800, CRC(d6250ab2) SHA1(b953517d883c64857e63139fed52436f77d371cb)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, special, 0, 0, special, special, special_state, special, "", "Specialist", 0 ) -COMP( 1985, specialm, special, 0, specialm, special, special_state, special, "", "Specialist M", 0 ) -COMP( 1985, pioner, special, 0, special, special, special_state, special, "", "Pioner", MACHINE_NOT_WORKING ) -COMP( 1985, specialp, special, 0, specialp, specialp, special_state, special, "", "Specialist + hires graph", MACHINE_NOT_WORKING ) -COMP( 1985, lik, special, 0, special, lik, special_state, special, "", "Lik", 0 ) -COMP( 1985, specimx, special, 0, specimx, specimx, driver_device, 0, "", "Specialist MX", 0) -COMP( 1994, erik, special, 0, erik, special, special_state, erik, "", "Erik", 0 ) diff --git a/src/mess/drivers/specpls3.c b/src/mess/drivers/specpls3.c deleted file mode 100644 index 14e428533e6..00000000000 --- a/src/mess/drivers/specpls3.c +++ /dev/null @@ -1,461 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/*************************************************************************** - - NOTE: ****** Specbusy: press N, R, or E to boot ************* - - - Spectrum/Inves/TK90X etc. memory map: - - CPU: - 0000-3fff ROM - 4000-ffff RAM - - Spectrum 128/+2/+2a/+3 memory map: - - CPU: - 0000-3fff Banked ROM/RAM (banked rom only on 128/+2) - 4000-7fff Banked RAM - 8000-bfff Banked RAM - c000-ffff Banked RAM - - TS2068 memory map: (Can't have both EXROM and DOCK active) - The 8K EXROM can be loaded into multiple pages. - - CPU: - 0000-1fff ROM / EXROM / DOCK (Cartridge) - 2000-3fff ROM / EXROM / DOCK - 4000-5fff \ - 6000-7fff \ - 8000-9fff |- RAM / EXROM / DOCK - a000-bfff | - c000-dfff / - e000-ffff / - - -Interrupts: - -Changes: - -29/1/2000 KT - Implemented initial +3 emulation. -30/1/2000 KT - Improved input port decoding for reading and therefore - correct keyboard handling for Spectrum and +3. -31/1/2000 KT - Implemented buzzer sound for Spectrum and +3. - Implementation copied from Paul Daniel's Jupiter driver. - Fixed screen display problems with dirty chars. - Added support to load .Z80 snapshots. 48k support so far. -13/2/2000 KT - Added Interface II, Kempston, Fuller and Mikrogen - joystick support. -17/2/2000 DJR - Added full key descriptions and Spectrum+ keys. - Fixed Spectrum +3 keyboard problems. -17/2/2000 KT - Added tape loading from WAV/Changed from DAC to generic - speaker code. -18/2/2000 KT - Added tape saving to WAV. -27/2/2000 KT - Took DJR's changes and added my changes. -27/2/2000 KT - Added disk image support to Spectrum +3 driver. -27/2/2000 KT - Added joystick I/O code to the Spectrum +3 I/O handler. -14/3/2000 DJR - Tape handling dipswitch. -26/3/2000 DJR - Snapshot files are now classifed as snapshots not - cartridges. -04/4/2000 DJR - Spectrum 128 / +2 Support. -13/4/2000 DJR - +4 Support (unofficial 48K hack). -13/4/2000 DJR - +2a Support (rom also used in +3 models). -13/4/2000 DJR - TK90X, TK95 and Inves support (48K clones). -21/4/2000 DJR - TS2068 and TC2048 support (TC2048 Supports extra video - modes but doesn't have bank switching or sound chip). -09/5/2000 DJR - Spectrum +2 (France, Spain), +3 (Spain). -17/5/2000 DJR - Dipswitch to enable/disable disk drives on +3 and clones. -27/6/2000 DJR - Changed 128K/+3 port decoding (sound now works in Zub 128K). -06/8/2000 DJR - Fixed +3 Floppy support -10/2/2001 KT - Re-arranged code and split into each model emulated. - Code is split into 48k, 128k, +3, tc2048 and ts2048 - segments. 128k uses some of the functions in 48k, +3 - uses some functions in 128, and tc2048/ts2048 use some - of the functions in 48k. The code has been arranged so - these functions come in some kind of "override" order, - read functions changed to use READ8_HANDLER and write - functions changed to use WRITE8_HANDLER. - Added Scorpion256 preliminary. -18/6/2001 DJR - Added support for Interface 2 cartridges. -xx/xx/2001 KS - TS-2068 sound fixed. - Added support for DOCK cartridges for TS-2068. - Added Spectrum 48k Psycho modified rom driver. - Added UK-2086 driver. -23/12/2001 KS - 48k machines are now able to run code in screen memory. - Programs which keep their code in screen memory - like monitors, tape copiers, decrunchers, etc. - works now. - Fixed problem with interrupt vector set to 0xffff (much - more 128k games works now). - A useful used trick on the Spectrum is to set - interrupt vector to 0xffff (using the table - which contain 0xff's) and put a byte 0x18 hex, - the opcode for JR, at this address. The first - byte of the ROM is a 0xf3 (DI), so the JR will - jump to 0xfff4, where a long JP to the actual - interrupt routine is put. Due to unideal - bankswitching in MAME this JP were to 0001 what - causes Spectrum to reset. Fixing this problem - made much more software runing (i.e. Paperboy). - Corrected frames per second value for 48k and 128k - Sinclair machines. - There are 50.08 frames per second for Spectrum - 48k what gives 69888 cycles for each frame and - 50.021 for Spectrum 128/+2/+2A/+3 what gives - 70908 cycles for each frame. - Remaped some Spectrum+ keys. - Presing F3 to reset was seting 0xf7 on keyboard - input port. Problem occurred for snapshots of - some programms where it was readed as pressing - key 4 (which is exit in Tapecopy by R. Dannhoefer - for example). - Added support to load .SP snapshots. - Added .BLK tape images support. - .BLK files are identical to .TAP ones, extension - is an only difference. -08/03/2002 KS - #FF port emulation added. - Arkanoid works now, but is not playable due to - completly messed timings. - -Initialisation values used when determining which model is being emulated: - 48K Spectrum doesn't use either port. - 128K/+2 Bank switches with port 7ffd only. - +3/+2a Bank switches with both ports. - -Notes: - 1. No contented memory. - 2. No hi-res colour effects (need contended memory first for accurate timing). - 3. Multiface 1 and Interface 1 not supported. - 4. Horace and the Spiders cartridge doesn't run properly. - 5. Tape images not supported: - .TZX, .SPC, .ITM, .PAN, .TAP(Warajevo), .VOC, .ZXS. - 6. Snapshot images not supported: - .ACH, .PRG, .RAW, .SEM, .SIT, .SNX, .ZX, .ZXS, .ZX82. - 7. 128K emulation is not perfect - the 128K machines crash and hang while - running quite a lot of games. - 8. Disk errors occur on some +3 games. - 9. Video hardware of all machines is timed incorrectly. -10. EXROM and HOME cartridges are not emulated. -11. The TK90X and TK95 roms output 0 to port #df on start up. -12. The purpose of this port is unknown (probably display mode as TS2068) and - thus is not emulated. - -Very detailed infos about the ZX Spectrum +3e can be found at - -http://www.z88forever.org.uk/zxplus3e/ - -*******************************************************************************/ - -#include "emu.h" -#include "includes/spectrum.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/ay8910.h" -#include "sound/speaker.h" -#include "formats/tzx_cas.h" - -/* +3 hardware */ -#include "machine/ram.h" - - -/****************************************************************************************************/ -/* Spectrum + 3 specific functions */ -/* This driver uses some of the spectrum_128 functions. The +3 is similar to a spectrum 128 -but with a disc drive */ - - -static const int spectrum_plus3_memory_selections[]= -{ - 0,1,2,3, - 4,5,6,7, - 4,5,6,3, - 4,7,6,3 -}; - -WRITE8_MEMBER( spectrum_state::spectrum_plus3_port_3ffd_w ) -{ - if (m_floppy==1) - m_upd765->fifo_w(space, 0, data, 0xff); -} - -READ8_MEMBER( spectrum_state::spectrum_plus3_port_3ffd_r ) -{ - if (m_floppy==0) - return 0xff; - else - return m_upd765->fifo_r(space, 0, 0xff); -} - - -READ8_MEMBER( spectrum_state::spectrum_plus3_port_2ffd_r ) -{ - if (m_floppy==0) - return 0xff; - else - return m_upd765->msr_r(space, 0, 0xff); -} - - -void spectrum_state::spectrum_plus3_update_memory() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *messram = m_ram->pointer(); - - if (m_port_7ffd_data & 8) - { - logerror("+3 SCREEN 1: BLOCK 7\n"); - m_screen_location = messram + (7 << 14); - } - else - { - logerror("+3 SCREEN 0: BLOCK 5\n"); - m_screen_location = messram + (5 << 14); - } - - if ((m_port_1ffd_data & 0x01) == 0) - { - /* select ram at 0x0c000-0x0ffff */ - int ram_page = m_port_7ffd_data & 0x07; - unsigned char *ram_data = messram + (ram_page<<14); - membank("bank4")->set_base(ram_data); - - logerror("RAM at 0xc000: %02x\n", ram_page); - - /* Reset memory between 0x4000 - 0xbfff in case extended paging was being used */ - /* Bank 5 in 0x4000 - 0x7fff */ - membank("bank2")->set_base(messram + (5 << 14)); - - /* Bank 2 in 0x8000 - 0xbfff */ - membank("bank3")->set_base(messram + (2 << 14)); - - if (!m_cart->exists()) - { - /* ROM switching */ - int ROMSelection = BIT(m_port_7ffd_data, 4) | ((m_port_1ffd_data >> 1) & 0x02); - - /* rom 0 is editor, rom 1 is syntax, rom 2 is DOS, rom 3 is 48 BASIC */ - unsigned char *ChosenROM = memregion("maincpu")->base() + 0x010000 + (ROMSelection << 14); - - membank("bank1")->set_base(ChosenROM); - space.unmap_write(0x0000, 0x3fff); - - logerror("rom switch: %02x\n", ROMSelection); - } - } - else - { - /* Extended memory paging */ - int MemorySelection = (m_port_1ffd_data >> 1) & 0x03; - const int *memory_selection = &spectrum_plus3_memory_selections[(MemorySelection << 2)]; - unsigned char *ram_data = messram + (memory_selection[0] << 14); - - membank("bank1")->set_base(ram_data); - /* allow writes to 0x0000-0x03fff */ - space.install_write_bank(0x0000, 0x3fff, "bank1"); - - ram_data = messram + (memory_selection[1] << 14); - membank("bank2")->set_base(ram_data); - - ram_data = messram + (memory_selection[2] << 14); - membank("bank3")->set_base(ram_data); - - ram_data = messram + (memory_selection[3] << 14); - membank("bank4")->set_base(ram_data); - - logerror("extended memory paging: %02x\n", MemorySelection); - } -} - - - -WRITE8_MEMBER( spectrum_state::spectrum_plus3_port_7ffd_w ) -{ - /* D0-D2: RAM page located at 0x0c000-0x0ffff */ - /* D3 - Screen select (screen 0 in ram page 5, screen 1 in ram page 7 */ - /* D4 - ROM select - which rom paged into 0x0000-0x03fff */ - /* D5 - Disable paging */ - - /* disable paging? */ - if (m_port_7ffd_data & 0x20) - return; - - /* store new state */ - m_port_7ffd_data = data; - - /* update memory */ - spectrum_plus3_update_memory(); -} - -WRITE8_MEMBER( spectrum_state::spectrum_plus3_port_1ffd_w ) -{ - /* D0-D1: ROM/RAM paging */ - /* D2: Affects if d0-d1 work on ram/rom */ - /* D3 - Disk motor on/off */ - /* D4 - parallel port strobe */ - - m_upd765_0->get_device()->mon_w(!BIT(data, 3)); - m_upd765_1->get_device()->mon_w(!BIT(data, 3)); - - m_port_1ffd_data = data; - - /* disable paging? */ - if ((m_port_7ffd_data & 0x20)==0) - { - /* no */ - spectrum_plus3_update_memory(); - } -} - -/* ports are not decoded full. -The function decodes the ports appropriately */ -static ADDRESS_MAP_START (spectrum_plus3_io, AS_IO, 8, spectrum_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) - AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) - AM_RANGE(0x4000, 0x4000) AM_WRITE(spectrum_plus3_port_7ffd_w) AM_MIRROR(0x3ffd) - AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_device, data_w) AM_MIRROR(0x3ffd) - AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, address_w) AM_MIRROR(0x3ffd) - AM_RANGE(0x1000, 0x1000) AM_WRITE(spectrum_plus3_port_1ffd_w) AM_MIRROR(0x0ffd) - AM_RANGE(0x2000, 0x2000) AM_READ(spectrum_plus3_port_2ffd_r) AM_MIRROR(0x0ffd) - AM_RANGE(0x3000, 0x3000) AM_READWRITE(spectrum_plus3_port_3ffd_r,spectrum_plus3_port_3ffd_w) AM_MIRROR(0x0ffd) -ADDRESS_MAP_END - -MACHINE_RESET_MEMBER(spectrum_state,spectrum_plus3) -{ - UINT8 *messram = m_ram->pointer(); - memset(messram,0,128*1024); - - MACHINE_RESET_CALL_MEMBER(spectrum); - - /* Initial configuration */ - m_port_7ffd_data = 0; - m_port_1ffd_data = 0; - spectrum_plus3_update_memory(); -} - -DRIVER_INIT_MEMBER(spectrum_state,plus3) -{ - m_floppy = 1; -} - -DRIVER_INIT_MEMBER(spectrum_state,plus2) -{ - m_floppy = 0; -} - -static SLOT_INTERFACE_START( specpls3_floppies ) - SLOT_INTERFACE( "3ssdd", FLOPPY_3_SSDD ) -SLOT_INTERFACE_END - -/* F4 Character Displayer */ -static const gfx_layout spectrum_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 96, /* 96 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( specpls3 ) - GFXDECODE_ENTRY( "maincpu", 0x1fd00, spectrum_charlayout, 0, 8 ) -GFXDECODE_END - - -static MACHINE_CONFIG_DERIVED( spectrum_plus3, spectrum_128 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(spectrum_plus3_io) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(50.01) - MCFG_GFXDECODE_MODIFY("gfxdecode", specpls3) - - MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, spectrum_plus3 ) - - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", specpls3_floppies, "3ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", specpls3_floppies, "3ssdd", floppy_image_device::default_floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list", "specpls3_flop") -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(specpl2a) - ROM_REGION(0x20000,"maincpu",0) - ROM_LOAD("p2a41_0.rom",0x10000,0x4000, CRC(30c9f490) SHA1(62ec15a4af56cd1d206d0bd7011eac7c889a595d)) - ROM_LOAD("p2a41_1.rom",0x14000,0x4000, CRC(a7916b3f) SHA1(1a7812c383a3701e90e88d1da086efb0c033ac72)) - ROM_LOAD("p2a41_2.rom",0x18000,0x4000, CRC(c9a0b748) SHA1(8df145d10ff78f98138682ea15ebccb2874bf759)) - ROM_LOAD("p2a41_3.rom",0x1c000,0x4000, CRC(b88fd6e3) SHA1(be365f331942ec7ec35456b641dac56a0dbfe1f0)) -ROM_END - -ROM_START(specpls3) - ROM_REGION(0x20000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "en", "English v4.0" ) - ROMX_LOAD("pl3-0.rom",0x10000,0x4000, CRC(17373da2) SHA1(e319ed08b4d53a5e421a75ea00ea02039ba6555b), ROM_BIOS(1)) - ROMX_LOAD("pl3-1.rom",0x14000,0x4000, CRC(f1d1d99e) SHA1(c9969fc36095a59787554026a9adc3b87678c794), ROM_BIOS(1)) - ROMX_LOAD("pl3-2.rom",0x18000,0x4000, CRC(3dbf351d) SHA1(22e50c6ba4157a3f6a821bd9937cd26e292775c6), ROM_BIOS(1)) - ROMX_LOAD("pl3-3.rom",0x1c000,0x4000, CRC(04448eaa) SHA1(65f031caa8148a5493afe42c41f4929deab26b4e), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "sp", "Spanish v.40" ) - ROMX_LOAD("plus3sp0.rom",0x10000,0x4000, CRC(1f86147a) SHA1(e9b0a60a1a8def511d59090b945d175bdc646346), ROM_BIOS(2)) - ROMX_LOAD("plus3sp1.rom",0x14000,0x4000, CRC(a8ac4966) SHA1(4e48f196427596c7990c175d135c15a039c274a4), ROM_BIOS(2)) - ROMX_LOAD("plus3sp2.rom",0x18000,0x4000, CRC(f6bb0296) SHA1(09fc005625589ef5992515957ce7a3167dec24b2), ROM_BIOS(2)) - ROMX_LOAD("plus3sp3.rom",0x1c000,0x4000, CRC(f6d25389) SHA1(ec8f644a81e2e9bcb58ace974103ea960361bad2), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "en41", "English v4.1" ) - ROMX_LOAD("plus341.rom",0x10000,0x10000, CRC(be0d9ec4) SHA1(500c0945760abeefcbd08bc22c0d07b14b336cf0), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "4ms", "Customize 3.5\" 4ms" ) - ROMX_LOAD("p3_01_4m.rom",0x10000,0x8000, CRC(ad99380a) SHA1(4e5d114b72d464cefdde0566457f52a3c0c1cae2), ROM_BIOS(4)) - ROMX_LOAD("p3_23_4m.rom",0x18000,0x8000, CRC(07727895) SHA1(752cdd6a083ab9910348995e483541d60bb6372b), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "12ms", "Customize 3.5\" 12ms" ) - ROMX_LOAD("p3_01_cm.rom",0x10000,0x8000, CRC(ad99380a) SHA1(4e5d114b72d464cefdde0566457f52a3c0c1cae2), ROM_BIOS(5)) - ROMX_LOAD("p3_23_cm.rom",0x18000,0x8000, CRC(61f2b50c) SHA1(d062765ceb1f3cd2c94ea51cb737cac7ad6151b4), ROM_BIOS(5)) -ROM_END - -ROM_START(specpl3e) - ROM_REGION(0x20000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "en", "English" ) - ROMX_LOAD("roma-en.rom",0x10000,0x8000, CRC(2d533344) SHA1(5ff2dae32eb745d87e0b54c595d1d20a866f316f), ROM_BIOS(1)) - ROMX_LOAD("romb-en.rom",0x18000,0x8000, CRC(ef8d5d92) SHA1(983aa53aa76e25a3af123c896016bacf6829b72b), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) - ROMX_LOAD("roma-es.rom",0x10000,0x8000, CRC(ba694b4b) SHA1(d15d9e43950483cffc79f1cfa89ecb114a88f6c2), ROM_BIOS(2)) - ROMX_LOAD("romb-es.rom",0x18000,0x8000, CRC(61ed94db) SHA1(935b14c13db75d872de8ad0d591aade0adbbc355), ROM_BIOS(2)) -ROM_END - -ROM_START(sp3e8bit) - ROM_REGION(0x20000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "en", "English" ) - ROMX_LOAD("3e8biten.rom",0x10000,0x10000, CRC(beee3bf6) SHA1(364ec903916282d5401901c5fb0cb93a142038b3), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) - ROMX_LOAD("3e8bites.rom",0x10000,0x10000, CRC(cafe4c35) SHA1(8331d273d29d3e37ec1324053bb050874d2c1434), ROM_BIOS(2)) -ROM_END - -ROM_START(sp3ezcf) - ROM_REGION(0x20000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "en", "English" ) - ROMX_LOAD("3ezcfen.rom",0x10000,0x10000, CRC(43993f11) SHA1(27cbfbe8b5ef9eec6056026fa0b84fe158ba2f45), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) - ROMX_LOAD("3ezcfes.rom",0x10000,0x10000, CRC(1325a0d7) SHA1(521cf47e10f46c8a621c8889ef1f008454c7e10b), ROM_BIOS(2)) -ROM_END - -ROM_START(sp3eata) - ROM_REGION(0x20000,"maincpu",0) - ROM_SYSTEM_BIOS( 0, "en", "English" ) - ROMX_LOAD("3ezxaen.rom",0x10000,0x10000, CRC(dfb676dc) SHA1(37618bc66ae33dbf686be8a92867e4a9144b65dc), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) - ROMX_LOAD("3ezxaes.rom",0x10000,0x10000, CRC(8f0ae91a) SHA1(71693e18b30c90914be58cba26682ca025c924ea), ROM_BIOS(2)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1987, specpl2a, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus2, "Amstrad plc", "ZX Spectrum +2a" , 0 ) -COMP( 1987, specpls3, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3" , 0 ) -COMP( 2000, specpl3e, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3e" , MACHINE_UNOFFICIAL ) -COMP( 2002, sp3e8bit, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3e 8bit IDE" , MACHINE_UNOFFICIAL ) -COMP( 2002, sp3eata, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3e 8bit ZXATASP" , MACHINE_UNOFFICIAL ) -COMP( 2002, sp3ezcf, spec128, 0, spectrum_plus3, spec_plus, spectrum_state, plus3, "Amstrad plc", "ZX Spectrum +3e 8bit ZXCF" , MACHINE_UNOFFICIAL ) diff --git a/src/mess/drivers/spectrum.c b/src/mess/drivers/spectrum.c deleted file mode 100644 index 5803b8a2d52..00000000000 --- a/src/mess/drivers/spectrum.c +++ /dev/null @@ -1,995 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/*************************************************************************** - - NOTE: ****** Specbusy: press N, R, or E to boot ************* - - - Spectrum/Inves/TK90X etc. memory map: - - CPU: - 0000-3fff ROM - 4000-ffff RAM - - Spectrum 128/+2/+2a/+3 memory map: - - CPU: - 0000-3fff Banked ROM/RAM (banked rom only on 128/+2) - 4000-7fff Banked RAM - 8000-bfff Banked RAM - c000-ffff Banked RAM - - TS2068 memory map: (Can't have both EXROM and DOCK active) - The 8K EXROM can be loaded into multiple pages. - - CPU: - 0000-1fff ROM / EXROM / DOCK (Cartridge) - 2000-3fff ROM / EXROM / DOCK - 4000-5fff \ - 6000-7fff \ - 8000-9fff |- RAM / EXROM / DOCK - a000-bfff | - c000-dfff / - e000-ffff / - - -Interrupts: - -Changes: - -29/1/2000 KT - Implemented initial +3 emulation. -30/1/2000 KT - Improved input port decoding for reading and therefore - correct keyboard handling for Spectrum and +3. -31/1/2000 KT - Implemented buzzer sound for Spectrum and +3. - Implementation copied from Paul Daniel's Jupiter driver. - Fixed screen display problems with dirty chars. - Added support to load .Z80 snapshots. 48k support so far. -13/2/2000 KT - Added Interface II, Kempston, Fuller and Mikrogen - joystick support. -17/2/2000 DJR - Added full key descriptions and Spectrum+ keys. - Fixed Spectrum +3 keyboard problems. -17/2/2000 KT - Added tape loading from WAV/Changed from DAC to generic - speaker code. -18/2/2000 KT - Added tape saving to WAV. -27/2/2000 KT - Took DJR's changes and added my changes. -27/2/2000 KT - Added disk image support to Spectrum +3 driver. -27/2/2000 KT - Added joystick I/O code to the Spectrum +3 I/O handler. -14/3/2000 DJR - Tape handling dipswitch. -26/3/2000 DJR - Snapshot files are now classifed as snapshots not - cartridges. -04/4/2000 DJR - Spectrum 128 / +2 Support. -13/4/2000 DJR - +4 Support (unofficial 48K hack). -13/4/2000 DJR - +2a Support (rom also used in +3 models). -13/4/2000 DJR - TK90X, TK95 and Inves support (48K clones). -21/4/2000 DJR - TS2068 and TC2048 support (TC2048 Supports extra video - modes but doesn't have bank switching or sound chip). -09/5/2000 DJR - Spectrum +2 (France, Spain), +3 (Spain). -17/5/2000 DJR - Dipswitch to enable/disable disk drives on +3 and clones. -27/6/2000 DJR - Changed 128K/+3 port decoding (sound now works in Zub 128K). -06/8/2000 DJR - Fixed +3 Floppy support -10/2/2001 KT - Re-arranged code and split into each model emulated. - Code is split into 48k, 128k, +3, tc2048 and ts2048 - segments. 128k uses some of the functions in 48k, +3 - uses some functions in 128, and tc2048/ts2048 use some - of the functions in 48k. The code has been arranged so - these functions come in some kind of "override" order, - read functions changed to use READ8_HANDLER and write - functions changed to use WRITE8_HANDLER. - Added Scorpion256 preliminary. -18/6/2001 DJR - Added support for Interface 2 cartridges. -xx/xx/2001 KS - TS-2068 sound fixed. - Added support for DOCK cartridges for TS-2068. - Added Spectrum 48k Psycho modified rom driver. - Added UK-2086 driver. -23/12/2001 KS - 48k machines are now able to run code in screen memory. - Programs which keep their code in screen memory - like monitors, tape copiers, decrunchers, etc. - works now. - Fixed problem with interrupt vector set to 0xffff (much - more 128k games works now). - A useful used trick on the Spectrum is to set - interrupt vector to 0xffff (using the table - which contain 0xff's) and put a byte 0x18 hex, - the opcode for JR, at this address. The first - byte of the ROM is a 0xf3 (DI), so the JR will - jump to 0xfff4, where a long JP to the actual - interrupt routine is put. Due to unideal - bankswitching in MAME this JP were to 0001 what - causes Spectrum to reset. Fixing this problem - made much more software runing (i.e. Paperboy). - Corrected frames per second value for 48k and 128k - Sincalir machines. - There are 50.08 frames per second for Spectrum - 48k what gives 69888 cycles for each frame and - 50.021 for Spectrum 128/+2/+2A/+3 what gives - 70908 cycles for each frame. - Remaped some Spectrum+ keys. - Presing F3 to reset was seting 0xf7 on keyboard - input port. Problem occurred for snapshots of - some programms where it was readed as pressing - key 4 (which is exit in Tapecopy by R. Dannhoefer - for example). - Added support to load .SP snapshots. - Added .BLK tape images support. - .BLK files are identical to .TAP ones, extension - is an only difference. -08/03/2002 KS - #FF port emulation added. - Arkanoid works now, but is not playable due to - completly messed timings. -25/10/2012 DH - simplified border emulation to be a (manual) partial - update with bitmap - Removed legacy fff4 interrupt hack, modern version of - MAME can handle this just fine - -Initialisation values used when determining which model is being emulated: - 48K Spectrum doesn't use either port. - 128K/+2 Bank switches with port 7ffd only. - +3/+2a Bank switches with both ports. - -TODO: (the best resource for ZX Spectrum HW informations is the http://www.zxdesign.info/ - blog, a project devored to reverse-engineer the ZX Spectrum in h/w). - - 1. No contended memory. The different Spectrum models have different contention timings - Updated info can be found here: http://scratchpad.wikia.com/wiki/Contended_memory - Of course, neither "late timing" contention effects are emulated. - - 2. Russian models (at least Pentagon and Scorpion) reportedly don't have contended memory. - Information about screen timings are here: http://www.worldofspectrum.org/rusfaq/ - - 3. Similarly, contended I/O is not emulated: http://scratchpad.wikia.com/wiki/Contended_IO - - 4. Finally, the Floating Bus implementation is incomplete: http://scratchpad.wikia.com/wiki/Floating_bus - The page hosts a couple of testing programs. - - 5. A NTSC model exists: it's not the Timex, but a plain ZX Spectrum made for the Chilean market: - http://scratchpad.wikia.com/wiki/NTSC_Spectrum - - 6. No hi-res colour effects (need contended memory first for accurate timing). - - 7. Keyboard autorepeat is broken. - - 8. Port decoding on all models needs to be checked and, in case, corrected. - - 9. The actual Issue 2/3 effect is a bit more complicated than implemented: - http://piters.tripod.com/cassport.htm for an explanation/test suite. - -10. Tape formats not supported: - .001, .CSW, .LTP, .PZX, .SPC, .STA, .ITM/.PAN, .TAP(Warajevo), .VOC, .ZXS, .ZXT - -11. Disk formats not supported: - .CPD, .DSK, .FDD, .FDI, .HDF, .IMG, .MDR, .MGT, .SCL, .TRD, .ZXD - -12. 128K emulation is not perfect - the 128K machines crash and hang while - running quite a lot of games. - -13. Disk errors occur on some +3 games. - -14. EXROM and HOME cartridges are not emulated on Timex machines. - -15. The TK90X and TK95 roms output 0 to port #df on start up. The purpose of this port is unknown - (probably display mode as TS2068) and thus is not emulated. - -16. Very detailed infos about the ZX Spectrum +3e can be found at - http://www.worldofspectrum.org/zxplus3e/ - -17. The ZX Spectrum is known to support a huge number of peripherals, daisy-chained through its expansion bus. - In the earlier part of its life cycle, a common configuration consisted of a "docking station"-type - peripheral providing drive controllers (the disk drives were not part of the packages), a game - interface (joystick and/or sound chip) and the ZX Printer (which, if present, must terminate the chain). - - Later, all-in-one peripherals became more common. The following list is just a little part of the huge - catalog of peripherals available to the ZX Spectrum; however these peripherals are both the most successful - and the better documented ones. - - Except when noted, technical and usage manuals are available at http://www.worldofspectrum.org/ - ------------------------- -Mass storage controllers ------------------------- - -ZX Interface 1 - up to 8 Microdrives - 1 RS-232 port - 2 ZX Network ports - http://scratchpad.wikia.com/wiki/ZX_Net - -Opus Discovery - up to 2 Disk drives - 1 Centronics port - 1 Joystick port (Kempston) - -DISCiPLE Interface - up to 2 Disk drives - 1 Centronics port - 2 Joystick ports (RH: Sinclair/Kempston, LH: Sinclair) - 2 ZX Network ports - -Plus D Interface - up to 2 Disk drives - 1 Centronics port - -Rotronics Wafadrive - 2 "Stringy" drives - 1 RS-232 port - 1 Centronics port - -Kempston Disc Interface - up to 4 Disk drives (KDOS) - -Beta 128 Disk Interface - up to 4 Disk drives (TR-DOS) - -Philips Disc ROM - ??? - ----------------- -Game controllers ----------------- - -ZX Interface 2 - 2 Joystick ports (Sinclair) - 1 ROM slot - -Kempston Interface - 1 Joystick port (Kempston) - -Protek/AGF/Cursor Interface - 1 Joystick port (Protek) - -Fuller Box - 1 Joystick port (Fuller) - 1 G1-AY-3-8912 sound chip - the chip is identical to the one present on the 128 model, - but the I/O ports are different: http://scratchpad.wikia.com/wiki/AY-3-8912(a) and - http://scratchpad.wikia.com/wiki/Timex_2000_series#Sound_Chip - -Mikro-Plus Interface - 1 Joystick port (Mikrogen) - 1 ROM slot - http://www.worldofspectrum.org/showmag.cgi?mag=Crash/Issue19/Pages/Crash1900020.jpg - ------------- -Misc devices ------------- - -DK'Tronics Light Pen (identical to TK90X light pen) - -AMX Mouse - Schematics and test software at http://velesoft.speccy.cz/othermouse-cz.htm - -Kempston Mouse - Schematics and test software at http://8bit.yarek.pl/hardware/zx.mouse/ - -Currah uSpeech - Speech synthesis through allophones (SP0256-AL2) - -MGT Messenger - Allows connection between ZX Spectrum and SAM Coup?? - -Soft-ROM - A development system board - http://www.wearmouth.demon.co.uk/softrom.htm - -Multiface 1/128/+3 - The classic snapshot interface for ZX Spectrum, 128 and +3 models, with 8K internal RAM. - -SamRam - A more versatile "Multiface I"-type interface - http://8bit.yarek.pl/upgrade/zx.samram/samram.html - - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/wave.h" -#include "includes/spectrum.h" -#include "formats/tzx_cas.h" -#include "machine/spec_snqk.h" - - -/****************************************************************************************************/ -/* Spectrum 48k functions */ - -/* - bit 7-5: not used - bit 4: Ear output/Speaker - bit 3: MIC/Tape Output - bit 2-0: border colour -*/ - -WRITE8_MEMBER(spectrum_state::spectrum_port_fe_w) -{ - unsigned char Changed; - - Changed = m_port_fe_data^data; - - /* border colour changed? */ - if ((Changed & 0x07)!=0) - { - spectrum_UpdateBorderBitmap(); - } - - if ((Changed & (1<<4))!=0) - { - /* DAC output state */ - m_speaker->level_w(BIT(data, 4)); - } - - if ((Changed & (1<<3))!=0) - { - /* write cassette data */ - m_cassette->output((data & (1<<3)) ? -1.0 : +1.0); - } - - m_port_fe_data = data; -} - - - -/* KT: more accurate keyboard reading */ -/* DJR: Spectrum+ keys added */ -READ8_MEMBER(spectrum_state::spectrum_port_fe_r) -{ - int lines = offset >> 8; - int data = 0xff; - - int cs_extra1 = m_io_plus0 ? m_io_plus0->read() & 0x1f : 0x1f; - int cs_extra2 = m_io_plus1 ? m_io_plus1->read() & 0x1f : 0x1f; - int cs_extra3 = m_io_plus2 ? m_io_plus2->read() & 0x1f : 0x1f; - int ss_extra1 = m_io_plus3 ? m_io_plus3->read() & 0x1f : 0x1f; - int ss_extra2 = m_io_plus4 ? m_io_plus4->read() & 0x1f : 0x1f; - - /* Caps - V */ - if ((lines & 1) == 0) - { - data &= m_io_line0->read(); - /* CAPS for extra keys */ - if (cs_extra1 != 0x1f || cs_extra2 != 0x1f || cs_extra3 != 0x1f) - data &= ~0x01; - } - - /* A - G */ - if ((lines & 2) == 0) - data &= m_io_line1->read(); - - /* Q - T */ - if ((lines & 4) == 0) - data &= m_io_line2->read(); - - /* 1 - 5 */ - if ((lines & 8) == 0) - data &= m_io_line3->read() & cs_extra1; - - /* 6 - 0 */ - if ((lines & 16) == 0) - data &= m_io_line4->read() & cs_extra2; - - /* Y - P */ - if ((lines & 32) == 0) - data &= m_io_line5->read() & ss_extra1; - - /* H - Enter */ - if ((lines & 64) == 0) - data &= m_io_line6->read(); - - /* B - Space */ - if ((lines & 128) == 0) - { - data &= m_io_line7->read() & cs_extra3 & ss_extra2; - /* SYMBOL SHIFT for extra keys */ - if (ss_extra1 != 0x1f || ss_extra2 != 0x1f) - data &= ~0x02; - } - - data |= (0xe0); /* Set bits 5-7 - as reset above */ - - /* cassette input from wav */ - if (m_cassette->input() > 0.0038 ) - { - data &= ~0x40; - } - - /* Issue 2 Spectrums default to having bits 5, 6 & 7 set. - Issue 3 Spectrums default to having bits 5 & 7 set and bit 6 reset. */ - if (m_io_config->read() & 0x80) - data ^= (0x40); - - return data; -} - -/* kempston joystick interface */ -READ8_MEMBER(spectrum_state::spectrum_port_1f_r) -{ - return m_io_kempston->read() & 0x1f; -} - -/* fuller joystick interface */ -READ8_MEMBER(spectrum_state::spectrum_port_7f_r) -{ - return m_io_fuller->read() | (0xff^0x8f); -} - -/* mikrogen joystick interface */ -READ8_MEMBER(spectrum_state::spectrum_port_df_r) -{ - return m_io_mikrogen->read() | (0xff^0x1f); -} - -READ8_MEMBER(spectrum_state::spectrum_port_ula_r) -{ - int vpos = machine().first_screen()->vpos(); - - return vpos<193 ? m_video_ram[(vpos&0xf8)<<2]:0xff; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START (spectrum_mem, AS_PROGRAM, 8, spectrum_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x5aff) AM_RAM AM_SHARE("video_ram") -// AM_RANGE(0x5b00, 0x7fff) AM_RAM -// AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - -/* ports are not decoded full. -The function decodes the ports appropriately */ -static ADDRESS_MAP_START (spectrum_io, AS_IO, 8, spectrum_state ) - AM_RANGE(0x00, 0x00) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) - AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) - AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) - AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) - AM_RANGE(0x01, 0x01) AM_READ(spectrum_port_ula_r) AM_MIRROR(0xfffe) -ADDRESS_MAP_END - -/* Input ports */ - -/****************************************************************************************************/ - -static INPUT_PORTS_START( spec_joys ) - PORT_START("JOY_INTF") - PORT_CONFNAME( 0x0f, 0x01, "Joystick Interface") - PORT_CONFSETTING( 0x00, "None (No Joystick)" ) - PORT_CONFSETTING( 0x01, "Kempston" ) - PORT_CONFSETTING( 0x02, "Fuller" ) - PORT_CONFSETTING( 0x03, "Mikrogen" ) - - PORT_START("KEMPSTON") /* Kempston joystick interface */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right (Kempston)") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left (Kempston)") PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down (Kempston)") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up (Kempston)") PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire (Kempston)") PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x01) - - PORT_START("FULLER") /* Fuller joystick interface */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up (Fuller)") PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down (Fuller)") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left (Fuller)") PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right (Fuller)") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire (Fuller)") PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x02) - - PORT_START("MIKROGEN") /* Mikrogen joystick interface */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up (Mikrogen)") PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down (Mikrogen)") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right (Mikrogen)") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left (Mikrogen)") PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire (Mikrogen)") PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("JOY_INTF", 0x0f, EQUALS, 0x03) -INPUT_PORTS_END - -/* -Spectrum keyboard is quite complicate to emulate. Each key can have 5 or 6 different functions, depending on which input mode we are in: - -------------------------------------------------------------------------------------------------------------------- - Mode | Sequence on Spectrum | Sequence in MESS -------------------------------------------------------------------------------------------------------------------- - KEY Mode | Simply press the key | Simply press the key - CAPS Mode | Press Key + CAPS SHIFT | Press Key + LShift (default mapping) - SYMBOL Mode | Press Key + SYMBOL SHIFT | Press Key + RShift (default mapping) - EXT Mode | Press CAPS + SYMBOL once, | Press LShift + RShift (to enter EXT Mode), - | then press Key | then press Key - EXT+Shift Mode | In EXT Mode, press Key + SHIFT | In EXT Mode, press Key + LShift or Key + RShift - | (no matter if CAPS and SYMBOL) | - BASIC Mode | At BASIC Prompt, press the key | At BASIC Prompt, press the key -------------------------------------------------------------------------------------------------------------------- - -Number Keys are the only keys not having a function in BASIC Mode (hence, they only have 5 functions) - -2009-04: Added natural keyboard support. The commented out PORT_CHARs are not reachable in natural keyboard mode (they are entered -in EXT+Shift Mode on a real Spectrum). -*/ - -/* TO DO: replace PORT_CHAR('\xD7') with an 'empty' PORT_CHAR. I used \xD7 (multiplication sign) just as a placeholder. There should be no -PORT_CHAR for those functions (which have no equivalent on modern keyboards), but something is needed (to correctly have natural support for -a few keys in SYMBOL Mode) and I found no EMPTY PORT_CHAR in MESS */ -INPUT_PORTS_START( spectrum ) - /* PORT_NAME = KEY Mode CAPS Mode SYMBOL Mode EXT Mode EXT+Shift Mode BASIC Mode */ - PORT_START("LINE0") /* 0xFEFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z Z : LN BEEP COPY") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(':') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x X \xC2\xA3 EXP INK CLEAR") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('\xA3') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c C ? LPRINT PAPER CONT") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('?') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v V / LLIST FLASH CLS") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR('/') - - PORT_START("LINE1") /* 0xFDFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a A STOP READ ~ NEW") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')// PORT_CHAR('~') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s S NOT RESTORE | SAVE") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')// PORT_CHAR('|') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d D STEP DATA \\ DIM") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')// PORT_CHAR('\\') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f F TO SGN { FOR") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')// PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g G THEN ABS } GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')// PORT_CHAR('}') - - PORT_START("LINE2") /* 0xFBFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q Q <= SIN ASN PLOT") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w W <> COS ACS DRAW") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e E >= TAN ATN REM") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r R < INT VERIFY RUN") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t T > RND MERGE RAND") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR('>') - - /* interface II uses this port for joystick */ - PORT_START("LINE3") /* 0xF7FE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 EDIT ! BLUE DEF FN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('\xD7') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 CAPS LOCK @ RED FN") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\xD7') PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 TRUE VID # MAGENTA LINE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xD7') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 INV VID $ GREEN OPEN#") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xD7') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 Left % CYAN CLOSE#") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('%') - - /* protek clashes with interface II! uses 5 = left, 6 = down, 7 = up, 8 = right, 0 = fire */ - PORT_START("LINE4") /* 0xEFFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 DEL _ BLACK FORMAT") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(8) PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 GRAPH ) POINT") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('\xD7') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 Right ( CAT") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 Up ' WHITE ERASE") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 Down & YELLOW MOVE") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('&') - - PORT_START("LINE5") /* 0xDFFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p P \" TAB (c) PRINT") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o O ; PEEK OUT POKE") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(';') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i I AT CODE IN INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u U OR CHR$ ] IF") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')// PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y Y AND STR$ [ RETURN") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')// PORT_CHAR('[') - - PORT_START("LINE6") /* 0xBFFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l L = USR ATTR LET") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k K + LEN SCREEN$ LIST") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j J - VAL VAL$ LOAD") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR('-') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h H ^ SQR CIRCLE GOSUB") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR('^') - - PORT_START("LINE7") /* 0x7FFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SYMBOL SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m M . PI INVERSE PAUSE") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR('.') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n N , INKEY$ OVER NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(',') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b B * BIN BRIGHT BORDER") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR('*') - - PORT_START("NMI") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_F12) - - PORT_START("CONFIG") - PORT_CONFNAME( 0x80, 0x00, "Hardware Version" ) - PORT_CONFSETTING( 0x00, "Issue 2" ) - PORT_CONFSETTING( 0x80, "Issue 3" ) - PORT_BIT(0x7f, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_INCLUDE( spec_joys ) -INPUT_PORTS_END - -/* These keys need not to be mapped in natural mode because Spectrum+ supports both these and the Spectrum sequences above. - Hence, we can simply keep using such sequences in natural keyboard emulation */ -INPUT_PORTS_START( spec_plus ) - PORT_INCLUDE( spectrum ) - - PORT_START("PLUS0") /* Spectrum+ Keys (Same as CAPS + 1-5) */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EDIT") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TRUE VID") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INV VID") PORT_CODE(KEYCODE_END) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("PLUS1") /* Spectrum+ Keys (Same as CAPS + 6-0) */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("PLUS2") /* Spectrum+ Keys (Same as CAPS + SPACE and CAPS + SYMBOL) */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_PAUSE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXT MODE") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("PLUS3") /* Spectrum+ Keys (Same as SYMBOL SHIFT + O/P) */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\"") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("PLUS4") /* Spectrum+ Keys (Same as SYMBOL SHIFT + N/M) */ - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0xf3, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -/* Machine initialization */ - -DRIVER_INIT_MEMBER(spectrum_state,spectrum) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - switch (m_ram->size()) - { - case 48*1024: - space.install_ram(0x8000, 0xffff, NULL); // Fall through - case 16*1024: - space.install_ram(0x5b00, 0x7fff, NULL); - } -} - -MACHINE_RESET_MEMBER(spectrum_state,spectrum) -{ - m_port_7ffd_data = -1; - m_port_1ffd_data = -1; - - if (m_cart && m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x3fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -/* F4 Character Displayer */ -static const gfx_layout spectrum_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 96, /* 96 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( spectrum ) - GFXDECODE_ENTRY( "maincpu", 0x3d00, spectrum_charlayout, 0, 8 ) -GFXDECODE_END - -void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt) -{ - m_maincpu->set_input_line(0, HOLD_LINE); - timer_set(attotime::from_ticks(32, m_maincpu->clock()), 0, 0); -} - -DEVICE_IMAGE_LOAD_MEMBER(spectrum_state, spectrum_cart) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size != 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -MACHINE_CONFIG_START( spectrum_common, spectrum_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, X1 / 4) /* This is verified only for the ZX Spectum. Other clones are reported to have different clocks */ - MCFG_CPU_PROGRAM_MAP(spectrum_mem) - MCFG_CPU_IO_MAP(spectrum_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", spectrum_state, spec_interrupt) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, spectrum ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - - MCFG_SCREEN_RAW_PARAMS(X1 / 2, 448, 0, 352, 312, 0, 296) - - MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_spectrum) - MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_spectrum) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(spectrum_state, spectrum ) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", spectrum) - MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_SNAPSHOT_ADD("snapshot", spectrum_state, spectrum, "ach,frz,plusd,prg,sem,sit,sna,snp,snx,sp,z80,zx", 0) - MCFG_QUICKLOAD_ADD("quickload", spectrum_state, spectrum, "raw,scr", 2) // The delay prevents the screen from being cleared by the RAM test at boot - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(tzx_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("spectrum_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "spectrum_cass") - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "spectrum_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(spectrum_state, spectrum_cart) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "spectrum_cart") -MACHINE_CONFIG_END - -MACHINE_CONFIG_DERIVED( spectrum, spectrum_common ) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) // This configuration is verified only for the original ZX Spectrum. - MCFG_RAM_DEFAULT_SIZE("48K") // It's likely, but still to be checked, that many clones were produced only - MCFG_RAM_EXTRA_OPTIONS("16K") // in the 48k configuration, while others have extra memory (80k, 128K, 1024K) - MCFG_RAM_DEFAULT_VALUE(0xff) // available via bankswitching. -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(spectrum) - ROM_REGION(0x10000,"maincpu",0) - ROM_SYSTEM_BIOS(0, "en", "English") - ROMX_LOAD("spectrum.rom", 0x0000, 0x4000, CRC(ddee531f) SHA1(5ea7c2b824672e914525d1d5c419d71b84a426a2), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "sp", "Spanish") - ROMX_LOAD("48e.rom", 0x0000, 0x4000, CRC(f051746e) SHA1(9e535e2e24231ccb65e33d107f6d0ceb23e99477), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "bsrom118", "BusySoft Upgrade v1.18") - ROMX_LOAD("bsrom118.rom", 0x0000, 0x4000, CRC(1511cddb) SHA1(ab3c36daad4325c1d3b907b6dc9a14af483d14ec), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "bsrom140", "BusySoft Upgrade v1.40") - ROMX_LOAD("bsrom140.rom", 0x0000, 0x4000, CRC(07017c6d) SHA1(2ee2dbe6ab96b60d7af1d6cb763b299374c21776), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "groot", "De Groot's Upgrade") - ROMX_LOAD("groot.rom", 0x0000, 0x4000, CRC(abf18c45) SHA1(51165cde68e218512d3145467074bc7e786bf307), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "48turbo", "48 Turbo") - ROMX_LOAD("48turbo.rom", 0x0000, 0x4000, CRC(56189781) SHA1(e62a431b0938af414b7ab8b1349a18b3c4407f70), ROM_BIOS(6)) - ROM_SYSTEM_BIOS(6, "psycho", "Maly's Psycho Upgrade") - ROMX_LOAD("psycho.rom", 0x0000, 0x4000, CRC(cd60b589) SHA1(0853e25857d51dd41b20a6dbc8e80f028c5befaa), ROM_BIOS(7)) - ROM_SYSTEM_BIOS(7, "turbo23", "Turbo 2.3") - ROMX_LOAD("turbo2_3.rom", 0x0000, 0x4000, CRC(fd3b0413) SHA1(84ea64af06adaf05e68abe1d69454b4fc6888505), ROM_BIOS(8)) - ROM_SYSTEM_BIOS(8, "turbo44", "Turbo 4.4") - ROMX_LOAD("turbo4_4.rom", 0x0000, 0x4000, CRC(338b6e87) SHA1(21ad93ffe41a4458704c866cca2754f066f6a560), ROM_BIOS(9)) - ROM_SYSTEM_BIOS(9, "imc", "Ian Collier's Upgrade") - ROMX_LOAD("imc.rom", 0x0000, 0x4000, CRC(d1be99ee) SHA1(dee814271c4d51de257d88128acdb324fb1d1d0d), ROM_BIOS(10)) - ROM_SYSTEM_BIOS(10, "plus4", "ZX Spectrum +4") - ROMX_LOAD("plus4.rom",0x0000,0x4000, CRC(7e0f47cb) SHA1(c103e89ef58e6ade0c01cea0247b332623bd9a30), ROM_BIOS(11)) - ROM_SYSTEM_BIOS(11, "deutsch", "German unofficial (Andrew Owen)") - ROMX_LOAD("deutsch.rom",0x0000,0x4000, CRC(1a9190f4) SHA1(795c20324311dd5a56300e6e4ec49b0a694ac0b3), ROM_BIOS(12)) - ROM_SYSTEM_BIOS(12, "hdt", "HDT-ISO HEX-DEC-TEXT") - ROMX_LOAD("hdt-iso.rom",0x0000,0x4000, CRC(b81c570c) SHA1(2a9745ba3b369a84c4913c98ede66ec87cb8aec1), ROM_BIOS(13)) - ROM_SYSTEM_BIOS(13, "sc", "The Sea Change Minimal ROM V1.78") - ROMX_LOAD("sc01.rom",0x0000,0x4000, CRC(73b4057a) SHA1(c58ff44a28db47400f09ed362ca0527591218136), ROM_BIOS(14)) - ROM_SYSTEM_BIOS(14, "gosh", "GOSH Wonderful ZX Spectrum ROM V1.32") - ROMX_LOAD("gw03.rom",0x0000,0x4000, CRC(5585d7c2) SHA1(a701c3d4b698f7d2be537dc6f79e06e4dbc95929), ROM_BIOS(15)) - ROM_SYSTEM_BIOS(15, "1986es", "1986ES Snapshot") - ROMX_LOAD("1986es.rom",0x0000,0x4000, CRC(9e0fdaaa) SHA1(f9d23f25640c51bcaa63e21ed5dd66bb2d5f63d4), ROM_BIOS(16)) - ROM_SYSTEM_BIOS(16, "jgh", "JGH ROM V0.74 (C) J.G.Harston") - ROMX_LOAD("jgh.rom",0x0000,0x4000, CRC(7224138e) SHA1(d7f02ed66455f1c08ac0c864c7038a92a88ba94a), ROM_BIOS(17)) - ROM_SYSTEM_BIOS(17, "iso22", "ISO ROM V2.2") - ROMX_LOAD("isomoje.rom",0x0000,0x4000, CRC(62ab3640) SHA1(04adbdb1380d6ccd4ab26ddd61b9ccbba462a60f), ROM_BIOS(18)) - ROM_SYSTEM_BIOS(18, "iso8", "ISO ROM 8") - ROMX_LOAD("iso8bm.rom",0x0000,0x4000, CRC(43e9c2fd) SHA1(5752e6f789769475711b91e0a75911fa5232c767), ROM_BIOS(19)) -ROM_END - -ROM_START(specide) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("zxide.rom", 0x0000, 0x4000, CRC(bd48db54) SHA1(54c2aa958902b5395c260770a0b25c7ba5685de9)) -ROM_END - -ROM_START(spec80k) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("80-lec.rom", 0x0000, 0x4000, CRC(5b5c92b1) SHA1(bb7a77d66e95d2e28ebb610e543c065e0d428619)) -ROM_END - -ROM_START(tk90x) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("tk90x.rom",0x0000,0x4000, CRC(3e785f6f) SHA1(9a943a008be13194fb006bddffa7d22d2277813f)) -ROM_END - -ROM_START(tk95) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("tk95.rom",0x0000,0x4000, CRC(17368e07) SHA1(94edc401d43b0e9a9cdc1d35de4b6462dc414ab3)) -ROM_END - -ROM_START(inves) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("inves.rom",0x0000,0x4000, CRC(8ff7a4d1) SHA1(d020440638aff4d39467128413ef795677be9c23)) -ROM_END - -/* Romanian clones */ -ROM_START(hc85) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("hc85.rom",0x0000,0x4000, CRC(3ab60fb5) SHA1(a4189db0bcdf8b39ed782b398828efb408fc4817)) -ROM_END - -ROM_START( hc88 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "hc88.bin", 0x0000, 0x0800, CRC(33be5134) SHA1(b15a6e7085710de8b818e42d329707cb737627e3)) -ROM_END - -ROM_START(hc90) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("hc90.rom",0x0000,0x4000, CRC(78c14d9a) SHA1(25ef81905bed90497a749770170c24632efb2039)) -ROM_END - -ROM_START(hc91) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("hc91.rom",0x0000,0x4000, CRC(8bf53761) SHA1(967d5179ba2823e9c8dd9ddfb0430465aaddb554)) -ROM_END - -ROM_START(cip03) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("cip03.rom",0x0000,0x4000, CRC(c7d0cd3c) SHA1(811055b44fc74076137e2bf8db206b2a70287cc2)) -ROM_END - -ROM_START(cip01) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("cip01.rom",0x0000,0x4000, CRC(0516a329) SHA1(4e3e0c5719a64d3b4fb224db499b4bef7d146917)) -ROM_END - -ROM_START(jet) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("jet.rom",0x0000,0x4000, CRC(e56a7d11) SHA1(e76be9ee71bae6aa1c2ff969276fb599ed68cb50)) -ROM_END - -ROM_START( cobrasp ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v1", "V1") - ROMX_LOAD( "boot64k_v1.bin", 0x0000, 0x0800, CRC(a54aae6d) SHA1(8f5134ce24aea59065ed166ad79e864e17ce812f), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "V2") - ROMX_LOAD( "boot64k_v2.bin", 0x0000, 0x0800, CRC(ee91cc89) SHA1(37dea7fe0734068adf99b91fdcbf3119095c350d), ROM_BIOS(2)) -ROM_END - -ROM_START( cobra80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v1", "V1") - ROMX_LOAD( "boot80k_v1.bin", 0x0000, 0x0800, CRC(f42d2342) SHA1(8aa1b3b056e311674a051ffc6a49af60cae409f3), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "v2", "V2") - ROMX_LOAD( "boot80k_v2.bin", 0x0000, 0x0800, CRC(df6bd954) SHA1(5b858b59e697d0368ea631ead14f5b2aa7954ccd), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "v3", "V3") - ROMX_LOAD( "boot80k_v3.bin", 0x0000, 0x0800, CRC(8580494c) SHA1(91af3f3fa50f2071f8ff081536bdf7e21e9823d9), ROM_BIOS(3)) -ROM_END - -/* Czechoslovakian clones*/ - -/* TODO: need to add memory handling for 80K RAM */ - -ROM_START(dgama87) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("dgama87.rom",0x0000,0x4000, CRC(43104909) SHA1(f62d1f3f35fda467cae468e890995614f6ec2357)) -ROM_END - -ROM_START(dgama88) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("dgama88.rom",0x0000,0x4000, CRC(4ec7e078) SHA1(09a91f85e82efa7f974d1b88c69636a02063d563)) -ROM_END - -ROM_START(dgama89) - ROM_REGION(0x10000,"maincpu",0) - ROM_SYSTEM_BIOS(0, "default", "Original") - ROMX_LOAD("dgama89.rom",0x0000,0x4000, CRC(45c29401) SHA1(8466a9da0169666210ccff5d43376d70bae0ae9b), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "g81", "Gama 81") - ROMX_LOAD("g81.rom",0x0000,0x4000, CRC(c169a63b) SHA1(71652005c2e7a4301caa7e95ae989b69cb5a6a0d), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "iso", "ISO") - ROMX_LOAD("iso.rom",0x0000,0x4000, CRC(2ee3a992) SHA1(2e39995dd032036d33a6dd88a38b750057bca19d), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "isopolak", "ISO Polak") - ROMX_LOAD("isopolak.rom",0x0000,0x4000, CRC(5e3f1f66) SHA1(61713117c944fc6afcb96c647bdba5ad36fd6a4b), ROM_BIOS(4)) -ROM_END - -ROM_START(didakt90) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("didakt90.rom",0x0000,0x4000, CRC(76f2db1e) SHA1(daee355a8ee58bc406873c1dd81eecb6161dd4bd)) -ROM_END - -ROM_START(didakm91) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("didakm91.rom",0x0000,0x4000, CRC(beab69b8) SHA1(71d4d1a05fb936f616bcb05c3a276f79343ecd4d)) -ROM_END - -ROM_START(didakm92) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("didakm92.bin",0x0000,0x4000, CRC(57264d4f) SHA1(23644fe949cbf527747959d07b72db01de378c4c)) -ROM_END - -ROM_START(didaktk) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("didaktk.rom",0x0000,0x4000, CRC(8ec8a625) SHA1(cba35517d33a5c97e3d9110f12a417c6c5cdeca8)) -ROM_END - -ROM_START(didakm93) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("didakm93.rom",0x0000,0x4000, CRC(ec274b1b) SHA1(a3470d8d1a996ee2a1ffff8bd8044da6e907e07e)) -ROM_END - -ROM_START(mistrum) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("mistrum.rom",0x0000,0x4000, CRC(d496103e) SHA1(cca1c5b059dc3a29ca4282e8621e34a65efaa1a3)) -ROM_END - -/* Russian clones */ - -ROM_START(blitzs) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("blitz.rom",0x0000,0x4000, CRC(91e535a8) SHA1(14f09d45dc3803cbdb05c33adb28eb12dbad9dd0)) -ROM_END - -ROM_START(byte) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("byte.rom",0x0000,0x4000, CRC(c13ba473) SHA1(99f40727185abbb2413f218d69df021ae2e99e45)) -ROM_END - -ROM_START(orizon) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("orizon.rom",0x0000,0x4000, CRC(ed4d9787) SHA1(3e8b29862e06be03344393c320a64a109fd9aff5)) -ROM_END - -ROM_START(quorum48) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("quorum48.rom",0x0000,0x4000, CRC(48085b0e) SHA1(8e01581643f7bdfa773f68207a6437911b631e53)) -ROM_END - -ROM_START(magic6) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("magic6.rom",0x0000,0x4000, CRC(cb63ae06) SHA1(533ad1f50534e6bdeec50eb5a9a4976c3d010dc7)) -ROM_END - -ROM_START(compani1) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("compani1.rom",0x0000,0x4000, CRC(bcfa6068) SHA1(40074b55c91a947698598e9d6ac5b8495e8cc840)) -ROM_END - -ROM_START(spektrbk) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("spektr-bk001.rom", 0x0000, 0x4000, CRC(c011eecc) SHA1(35fdc8cd083e50452655997a997873627b131520)) -ROM_END - -ROM_START(zvezda) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD( "2764-near-cpu_red.bin", 0x0000, 0x2000, CRC(a4ae4938) SHA1(ea1763b9dee29381ddcf882fbc4e404ba5366942)) - ROM_LOAD( "2764-far-cpu_blue.bin", 0x2000, 0x2000, CRC(ebab64bc) SHA1(8c98a8b6e927b02cf602c20a1b50838e60f7785b)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1982, spectrum, 0, 0, spectrum, spectrum, spectrum_state, spectrum, "Sinclair Research Ltd", "ZX Spectrum" , 0) -COMP( 1987, spec80k, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "ZX Spectrum 80K" , MACHINE_UNOFFICIAL) -COMP( 1995, specide, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "ZX Spectrum IDE" , MACHINE_UNOFFICIAL) -COMP( 1986, inves, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Investronica", "Inves Spectrum 48K+" , 0) -COMP( 1985, tk90x, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Micro Digital", "TK 90X Color Computer" , 0) -COMP( 1986, tk95, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Micro Digital", "TK 95 Color Computer" , 0) -COMP( 1985, hc85, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ICE-Felix", "HC-85" , 0) -COMP( 1988, hc88, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ICE-Felix", "HC-88" , MACHINE_NOT_WORKING) -COMP( 1990, hc90, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ICE-Felix", "HC-90" , 0) -COMP( 1991, hc91, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "ICE-Felix", "HC-91" , 0) -COMP( 1988, cobrasp, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ITCI", "Cobra (ITCI)" , MACHINE_NOT_WORKING) -COMP( 1988, cobra80, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "ITCI", "Cobra 80K (ITCI)" , MACHINE_NOT_WORKING) -COMP( 1987, cip01, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Electronica", "CIP-01" , 0) // keyboard should be spectrum, but image was not clear -COMP( 1988, cip03, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Electronica", "CIP-03" , 0) // keyboard should be spectrum, but image was not clear -COMP( 1990, jet, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Electromagnetica", "JET" , 0) // keyboard should be spectrum, but image was not clear -COMP( 1987, dgama87, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik Gama 87" , 0) -COMP( 1988, dgama88, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik Gama 88" , 0) -COMP( 1989, dgama89, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik Gama 89" , 0) -COMP( 1990, didakt90, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik 90" , 0) -COMP( 1991, didakm91, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik M 91" , 0) -COMP( 1992, didakm92, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik M 92" , 0) -COMP( 1992, didaktk, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik Kompakt" , 0) -COMP( 1993, didakm93, spectrum, 0, spectrum, spec_plus, spectrum_state, spectrum, "Didaktik Skalica", "Didaktik M 93" , 0) -COMP( 1988, mistrum, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "Amaterske RADIO", "Mistrum" , 0) // keyboard could be spectrum in some models (since it was a build-yourself design) -COMP( 1990, blitzs, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Blic" , 0) // no keyboard images found -COMP( 1990, byte, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Byte" , 0) // no keyboard images found -COMP( 199?, orizon, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Orizon-Micro" , 0) // no keyboard images found -COMP( 1993, quorum48, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Kvorum 48K" , MACHINE_NOT_WORKING) -COMP( 1993, magic6, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Magic 6" , MACHINE_NOT_WORKING) // keyboard should be spectrum, but image was not clear -COMP( 1990, compani1, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Kompanion 1" , 0) // no keyboard images found -COMP( 1990, spektrbk, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Spektr BK-001" , 0) -COMP( 1990, zvezda, spectrum, 0, spectrum, spectrum, spectrum_state, spectrum, "", "Zvezda" , 0) diff --git a/src/mess/drivers/squale.c b/src/mess/drivers/squale.c deleted file mode 100644 index def2dd00257..00000000000 --- a/src/mess/drivers/squale.c +++ /dev/null @@ -1,99 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Apollo 7 Squale - - PCB Ref Qty Manufacturer Ref Description / Datasheet - ============================================================================================ - U1 1 EF6809P 8-BIT MICROPROCESSOR UNIT (MPU) - U2 1 27C32 / 27C64 EPROM - U72,U75 1 EF6821P PERIPHERAL INTERFACE ADAPTER (PIA) - U69 1 EF6850 ASYNCHRONOUS COMMUNICATIONS INTERFACE ADAPTER (ACIA) - U59 1 EF9365P GRAPHIC DISPLAY PROCESSOR (GDP) - U65 1 AY-3-8910A PROGRAMMABLE SOUND GENERATOR - U16,U17,U18,U19, - U20,U21,U22,U23 8 MK4564 65,536 x 1-BIT DYNAMIC RAM - U38,U39,U40,U41, - U42,U43,U44,U45, - U46,U47,U48,U49, - U50,U51,U52,U53 16 TMS4116 16,384-BIT DYNAMIC RAM - U68 1 EFB7510 SINGLE CHIP ASYNCHRONOUS FSK MODEM - - - Memory map - ========== - - Periphiriques Adresses - ========================================================= - EPROM 0xF100-0xFFFF - Extension Port 0xF080-0xF0FF - FREE 0xF070-0xF07F - AY-3-8910A 0xF060-0xF06F - ACIA EF6850 (Modem + K7) 0xF050-0xF05F - Restricted area 0xF04C-0xF04F - PIO EF6821 (Printer + Cartridge) 0xF048-0xF04B - PIO EF6821 (Keyboard) 0xF044-0xF047 - FREE 0xF040-0xF043 - VID_RD2 0xF030-0xF03F - VID_RD1 0xF020-0xF02F - REG1 0xF010-0xF01F - Video Controller EF9365 0xF000-0xF00F - System RAM 0x0000-0xEFFF - - - Notes: - 1) For 8KB versions of the monitor, the bank switching is done via bit 7 of REG1. - 2) VID_RD1 : [7..0] = I0,R0,G0,B0,I1,R1,G1,B1 (I=Intensity,R=Red,G=Green,B=Blue) - 3) VID_RD2 : [7..0] = I2,R2,G2,B2,I3,R3,G3,B3 (I=Intensity,R=Red,G=Green,B=Blue) - 3) REG1 : [7..0] = EPROM Bank,-,Modem,K7,I,R,G,B (I=Intensity,R=Red,V=Green,B=Blue) -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" - -class squale_state : public driver_device -{ -public: - squale_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - -private: - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(squale_mem, AS_PROGRAM, 8, squale_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000,0xefff) AM_RAM - AM_RANGE(0xf100,0xffff) AM_ROM AM_REGION("maincpu", 0x100) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( squale_io, AS_IO, 8, squale_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( squale ) -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( squale, squale_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6809, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(squale_mem) - MCFG_CPU_IO_MAP(squale_io) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( squale ) - ROM_REGION( 0x2000, "maincpu", 0 ) - ROM_LOAD( "sqm2r1.bin", 0x0000, 0x2000, CRC(ed57c707) SHA1(c8bd33a6fb07fe7f881f2605ad867b7e82366bfc) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, squale, 0, 0, squale, squale,driver_device, 0, "Apollo 7", "Squale", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/ssem.c b/src/mess/drivers/ssem.c deleted file mode 100644 index 4f3e96d4abf..00000000000 --- a/src/mess/drivers/ssem.c +++ /dev/null @@ -1,655 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/* - Manchester Small-Scale Experimental Machine (SSEM) - - Driver by MooglyGuy -*/ - - -#include "emu.h" -#include "cpu/ssem/ssem.h" -#include "imagedev/snapquik.h" - -// for now, make buggy GCC/Mingw STFU about I64FMT -#if (defined(__MINGW32__) && (__GNUC__ >= 5)) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wformat" -#pragma GCC diagnostic ignored "-Wformat-extra-args" -#endif - -class ssem_state : public driver_device -{ -public: - ssem_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_store(*this, "store"), - m_screen(*this, "screen") { } - - required_device m_maincpu; - required_shared_ptr m_store; - required_device m_screen; - - UINT8 m_store_line; - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update_ssem(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_INPUT_CHANGED_MEMBER(panel_check); - DECLARE_QUICKLOAD_LOAD_MEMBER(ssem_store); - inline UINT32 reverse(UINT32 v); - void glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...) ATTR_PRINTF(5,6); - void strlower(char *buf); -}; - - - -/****************************************************\ -* General helper functions * -\****************************************************/ - -// The SSEM stores its data, visually, with the leftmost bit corresponding to the least significant bit. -// The de facto snapshot format for other SSEM simulators stores the data physically in that format as well. -// Therefore, in MESS, every 32-bit word has its bits reversed, too, and as a result the values must be -// un-reversed before being used. -inline UINT32 ssem_state::reverse(UINT32 v) -{ - // Taken from http://www.graphics.stanford.edu/~seander/bithacks.html#ReverseParallel - // swap odd and even bits - v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1); - // swap consecutive pairs - v = ((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2); - // swap nibbles ... - v = ((v >> 4) & 0x0F0F0F0F) | ((v & 0x0F0F0F0F) << 4); - // swap bytes - v = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8); - // swap 2-byte long pairs - v = ( v >> 16 ) | ( v << 16); - - return v; -} - -/****************************************************\ -* Address map * -\****************************************************/ - -static ADDRESS_MAP_START( ssem_map, AS_PROGRAM, 8, ssem_state ) - AM_RANGE(0x00, 0x7f) AM_RAM AM_SHARE("store")// Primary store -ADDRESS_MAP_END - -/****************************************************\ -* Input ports and front panel handling * -\****************************************************/ - -enum -{ - // Bit-edit buttons - PANEL_BIT0, PANEL_BIT1, PANEL_BIT2, PANEL_BIT3, PANEL_BIT4, PANEL_BIT5, PANEL_BIT6, PANEL_BIT7, - PANEL_BIT8, PANEL_BIT9, PANEL_BIT10, PANEL_BIT11, PANEL_BIT12, PANEL_BIT13, PANEL_BIT14, PANEL_BIT15, - PANEL_BIT16, PANEL_BIT17, PANEL_BIT18, PANEL_BIT19, PANEL_BIT20, PANEL_BIT21, PANEL_BIT22, PANEL_BIT23, - PANEL_BIT24, PANEL_BIT25, PANEL_BIT26, PANEL_BIT27, PANEL_BIT28, PANEL_BIT29, PANEL_BIT30, PANEL_BIT31, - - // Page up, page down - PANEL_PGUP, PANEL_PGDN, - - // Line up, line down - PANEL_LNUP, PANEL_LNDN, - - // Halt - PANEL_HALT -}; - -INPUT_CHANGED_MEMBER(ssem_state::panel_check) -{ - UINT8 edit0_state = ioport("EDIT0")->read(); - UINT8 edit1_state = ioport("EDIT1")->read(); - UINT8 edit2_state = ioport("EDIT2")->read(); - UINT8 edit3_state = ioport("EDIT3")->read(); - UINT8 misc_state = ioport("MISC")->read(); - - switch( (int)(FPTR)param ) - { - case PANEL_BIT0: - if(edit0_state & 0x01) m_store[(m_store_line << 2) | 0] ^= 0x80; - break; - case PANEL_BIT1: - if(edit0_state & 0x02) m_store[(m_store_line << 2) | 0] ^= 0x40; - break; - case PANEL_BIT2: - if(edit0_state & 0x04) m_store[(m_store_line << 2) | 0] ^= 0x20; - break; - case PANEL_BIT3: - if(edit0_state & 0x08) m_store[(m_store_line << 2) | 0] ^= 0x10; - break; - case PANEL_BIT4: - if(edit0_state & 0x10) m_store[(m_store_line << 2) | 0] ^= 0x08; - break; - case PANEL_BIT5: - if(edit0_state & 0x20) m_store[(m_store_line << 2) | 0] ^= 0x04; - break; - case PANEL_BIT6: - if(edit0_state & 0x40) m_store[(m_store_line << 2) | 0] ^= 0x02; - break; - case PANEL_BIT7: - if(edit0_state & 0x80) m_store[(m_store_line << 2) | 0] ^= 0x01; - break; - case PANEL_BIT8: - if(edit1_state & 0x01) m_store[(m_store_line << 2) | 1] ^= 0x80; - break; - case PANEL_BIT9: - if(edit1_state & 0x02) m_store[(m_store_line << 2) | 1] ^= 0x40; - break; - case PANEL_BIT10: - if(edit1_state & 0x04) m_store[(m_store_line << 2) | 1] ^= 0x20; - break; - case PANEL_BIT11: - if(edit1_state & 0x08) m_store[(m_store_line << 2) | 1] ^= 0x10; - break; - case PANEL_BIT12: - if(edit1_state & 0x10) m_store[(m_store_line << 2) | 1] ^= 0x08; - break; - case PANEL_BIT13: - if(edit1_state & 0x20) m_store[(m_store_line << 2) | 1] ^= 0x04; - break; - case PANEL_BIT14: - if(edit1_state & 0x40) m_store[(m_store_line << 2) | 1] ^= 0x02; - break; - case PANEL_BIT15: - if(edit1_state & 0x80) m_store[(m_store_line << 2) | 1] ^= 0x01; - break; - case PANEL_BIT16: - if(edit2_state & 0x01) m_store[(m_store_line << 2) | 2] ^= 0x80; - break; - case PANEL_BIT17: - if(edit2_state & 0x02) m_store[(m_store_line << 2) | 2] ^= 0x40; - break; - case PANEL_BIT18: - if(edit2_state & 0x04) m_store[(m_store_line << 2) | 2] ^= 0x20; - break; - case PANEL_BIT19: - if(edit2_state & 0x08) m_store[(m_store_line << 2) | 2] ^= 0x10; - break; - case PANEL_BIT20: - if(edit2_state & 0x10) m_store[(m_store_line << 2) | 2] ^= 0x08; - break; - case PANEL_BIT21: - if(edit2_state & 0x20) m_store[(m_store_line << 2) | 2] ^= 0x04; - break; - case PANEL_BIT22: - if(edit2_state & 0x40) m_store[(m_store_line << 2) | 2] ^= 0x02; - break; - case PANEL_BIT23: - if(edit2_state & 0x80) m_store[(m_store_line << 2) | 2] ^= 0x01; - break; - case PANEL_BIT24: - if(edit3_state & 0x01) m_store[(m_store_line << 2) | 3] ^= 0x80; - break; - case PANEL_BIT25: - if(edit3_state & 0x02) m_store[(m_store_line << 2) | 3] ^= 0x40; - break; - case PANEL_BIT26: - if(edit3_state & 0x04) m_store[(m_store_line << 2) | 3] ^= 0x20; - break; - case PANEL_BIT27: - if(edit3_state & 0x08) m_store[(m_store_line << 2) | 3] ^= 0x10; - break; - case PANEL_BIT28: - if(edit3_state & 0x10) m_store[(m_store_line << 2) | 3] ^= 0x08; - break; - case PANEL_BIT29: - if(edit3_state & 0x20) m_store[(m_store_line << 2) | 3] ^= 0x04; - break; - case PANEL_BIT30: - if(edit3_state & 0x40) m_store[(m_store_line << 2) | 3] ^= 0x02; - break; - case PANEL_BIT31: - if(edit3_state & 0x80) m_store[(m_store_line << 2) | 3] ^= 0x01; - break; - case PANEL_LNUP: - if(misc_state & 0x01) - { - m_store_line--; - } - break; - case PANEL_LNDN: - if(misc_state & 0x02) - { - m_store_line++; - } - break; - case PANEL_HALT: - if(misc_state & 0x04) - { - m_maincpu->set_state_int(SSEM_HALT, 1 - m_maincpu->state_int(SSEM_HALT)); - } - break; - } -} - -static INPUT_PORTS_START( ssem ) - PORT_START("EDIT0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 0") PORT_CODE(KEYCODE_1) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT0) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 1") PORT_CODE(KEYCODE_2) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 2") PORT_CODE(KEYCODE_3) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 3") PORT_CODE(KEYCODE_4) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT3) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 4") PORT_CODE(KEYCODE_5) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 5") PORT_CODE(KEYCODE_6) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT5) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 6") PORT_CODE(KEYCODE_7) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT6) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 7") PORT_CODE(KEYCODE_8) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT7) - - PORT_START("EDIT1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 8") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT8) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 9") PORT_CODE(KEYCODE_W) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT9) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 10") PORT_CODE(KEYCODE_E) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT10) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 11") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT11) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 12") PORT_CODE(KEYCODE_T) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT12) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 13") PORT_CODE(KEYCODE_Y) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT13) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 14") PORT_CODE(KEYCODE_U) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT14) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 15") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT15) - - PORT_START("EDIT2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 16") PORT_CODE(KEYCODE_A) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT16) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 17") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT17) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 18") PORT_CODE(KEYCODE_D) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT18) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 19") PORT_CODE(KEYCODE_F) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT19) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 20") PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT20) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 21") PORT_CODE(KEYCODE_H) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT21) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 22") PORT_CODE(KEYCODE_J) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT22) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 23") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT23) - - PORT_START("EDIT3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 24") PORT_CODE(KEYCODE_Z) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT24) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 25") PORT_CODE(KEYCODE_X) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT25) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 26") PORT_CODE(KEYCODE_C) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT26) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 27") PORT_CODE(KEYCODE_V) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT27) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 28") PORT_CODE(KEYCODE_B) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT28) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 29") PORT_CODE(KEYCODE_N) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT29) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 30") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT30) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 31") PORT_CODE(KEYCODE_COMMA) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_BIT31) - - PORT_START("MISC") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Line Up") PORT_CODE(KEYCODE_UP) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_LNUP) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Line Down") PORT_CODE(KEYCODE_DOWN) PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_LNDN) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Halt") PORT_CHANGED_MEMBER(DEVICE_SELF, ssem_state, panel_check, (void*)PANEL_HALT) - PORT_BIT(0xf8, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -/****************************************************\ -* Video hardware * -\****************************************************/ - -static const UINT8 char_glyphs[0x80][8] = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x10, 0x38, 0x10, 0x00, 0x00, 0x00 }, - { 0x38, 0x7c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x00 }, - { 0xff, 0xff, 0xef, 0xc7, 0xef, 0xff, 0xff, 0xff }, - { 0xc7, 0x83, 0x01, 0x01, 0x01, 0x83, 0xc7, 0xff }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00 }, - { 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00 }, - { 0x18, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x18, 0x00 }, - { 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00 }, - { 0x78, 0xcc, 0x78, 0x70, 0xce, 0xcc, 0x7e, 0x00 }, - { 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00 }, - { 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00 }, - { 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00 }, - { 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30 }, - { 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 }, - { 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00 }, - { 0x3c, 0x66, 0x76, 0x7e, 0x6e, 0x66, 0x3c, 0x00 }, - { 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 }, - { 0x3c, 0x66, 0x06, 0x0c, 0x30, 0x60, 0x7e, 0x00 }, - { 0x3c, 0x66, 0x06, 0x0c, 0x06, 0x66, 0x3c, 0x00 }, - { 0x66, 0x66, 0x66, 0x7e, 0x06, 0x06, 0x06, 0x00 }, - { 0x7e, 0x60, 0x7c, 0x06, 0x06, 0x66, 0x3c, 0x00 }, - { 0x3c, 0x66, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00 }, - { 0x7e, 0x66, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x00 }, - { 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00 }, - { 0x3c, 0x66, 0x66, 0x3e, 0x06, 0x66, 0x3c, 0x00 }, - { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00 }, - { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30 }, - { 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00 }, - { 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00 }, - { 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00 }, - { 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00 }, - { 0x3c, 0x66, 0x6e, 0x6e, 0x60, 0x66, 0x3c, 0x00 }, - { 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 }, - { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00 }, - { 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00 }, - { 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00 }, - { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7e, 0x00 }, - { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00 }, - { 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00 }, - { 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 }, - { 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 }, - { 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 }, - { 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00 }, - { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00 }, - { 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00 }, - { 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x00 }, - { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 }, - { 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00 }, - { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x06 }, - { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x00 }, - { 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00 }, - { 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, - { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 }, - { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00 }, - { 0xc6, 0xc6, 0xd6, 0xfe, 0xfe, 0xee, 0xc6, 0x00 }, - { 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00 }, - { 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00 }, - { 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00 }, - { 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00 }, - { 0x80, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00 }, - { 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00 }, - { 0x10, 0x38, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f }, - { 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 }, - { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00 }, - { 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00 }, - { 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00 }, - { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7e, 0x00 }, - { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00 }, - { 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00 }, - { 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 }, - { 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 }, - { 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 }, - { 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00 }, - { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00 }, - { 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00 }, - { 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x00 }, - { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 }, - { 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00 }, - { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x06 }, - { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x00 }, - { 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00 }, - { 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, - { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 }, - { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00 }, - { 0xc6, 0xc6, 0xd6, 0xfe, 0xfe, 0xee, 0xc6, 0x00 }, - { 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00 }, - { 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00 }, - { 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00 }, - { 0x0c, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00 }, - { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 }, - { 0x30, 0x18, 0x18, 0x0c, 0x18, 0x18, 0x30, 0x00 }, - { 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 }, - { 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff }, -}; - -void ssem_state::glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...) -{ - va_list arg_list; - char buf[32768]; - INT32 index = 0; - const rectangle &visarea = m_screen->visible_area(); - - va_start( arg_list, msg ); - vsprintf( buf, msg, arg_list ); - va_end( arg_list ); - - for(index = 0; index < strlen(buf) && index < 32768; index++) - { - UINT8 cur = (UINT8)buf[index]; - if(cur < 0x80) - { - INT32 line = 0; - for(line = 0; line < 8; line++) - { - UINT32 *d = &bitmap.pix32(y + line); - INT32 bit = 0; - for(bit = 0; bit < 8; bit++) - { - if(char_glyphs[cur][line] & (1 << (7 - bit))) - { - d[x+bit] = 0xffffffff; - } - else - { - d[x+bit] = 0; - } - } - } - } - - x += 8; - if(x >= visarea.max_x) - { - x = 0; - y += 8; - if(y >= visarea.max_y) - { - y = 0; - } - } - } -} - -UINT32 ssem_state::screen_update_ssem(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 line = 0; - UINT32 accum = m_maincpu->state_int(SSEM_A); - UINT32 bit = 0; - UINT32 word = 0; - - for(line = 0; line < 32; line++) - { - word = (m_store[(line << 2) | 0] << 24) | - (m_store[(line << 2) | 1] << 16) | - (m_store[(line << 2) | 2] << 8) | - (m_store[(line << 2) | 3] << 0); - for(bit = 0; bit < 32; bit++) - { - if(word & (1 << (31 - bit))) - { - glyph_print(bitmap, bit << 3, line << 3, "%c", line == m_store_line ? 4 : 2); - } - else - { - glyph_print(bitmap, bit << 3, line << 3, "%c", line == m_store_line ? 3 : 1); - } - } - } - - for(bit = 0; bit < 32; bit++) - { - if(accum & (1 << bit)) - { - glyph_print(bitmap, bit << 3, 264, "%c", 2); - } - else - { - glyph_print(bitmap, bit << 3, 264, "%c", 1); - } - } - - word = reverse((m_store[(m_store_line << 2) | 0] << 24) | - (m_store[(m_store_line << 2) | 1] << 16) | - (m_store[(m_store_line << 2) | 2] << 8) | - (m_store[(m_store_line << 2) | 3] << 0)); - glyph_print(bitmap, 0, 272, "LINE:%02d VALUE:%08x HALT:%" I64FMT "d", m_store_line, word, m_maincpu->state_int(SSEM_HALT)); - return 0; -} - -/****************************************************\ -* Image helper functions * -\****************************************************/ - -void ssem_state::strlower(char *buf) -{ - if(buf) - { - int i = 0; - for(i = 0; i < strlen(buf); i++) - { - if(buf[i] >= 'A' && buf[i] <= 'Z') - { - buf[i] |= 0x20; - } - } - } -} - -/****************************************************\ -* Image loading * -\****************************************************/ - -QUICKLOAD_LOAD_MEMBER(ssem_state, ssem_store) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - char image_line[100] = { 0 }; - char token_buf[100] = { 0 }; - int num_lines = 0; - - image.fgets(image_line, 99); - sscanf(image_line, "%d", &num_lines); - - if (num_lines) - { - for (int i = 0; i < num_lines; i++) - { - UINT32 line = 0; - image.fgets(image_line, 99); - - // Isolate and convert 4-digit decimal address - memcpy(token_buf, image_line, 4); - token_buf[4] = '\0'; - sscanf(token_buf, "%04u", &line); - - if (!core_stricmp(image.filetype(), "snp")) - { - UINT32 word = 0; - - // Parse a line such as: 0000:00000110101001000100000100000100 - for (int b = 0; b < 32; b++) - { - if (image_line[5 + b] == '1') - word |= 1 << (31 - b); - } - - space.write_byte((line << 2) + 0, (word >> 24) & 0x000000ff); - space.write_byte((line << 2) + 1, (word >> 16) & 0x000000ff); - space.write_byte((line << 2) + 2, (word >> 8) & 0x000000ff); - space.write_byte((line << 2) + 3, (word >> 0) & 0x000000ff); - } - else if (!core_stricmp(image.filetype(), "asm")) - { - char op_buf[4] = { 0 }; - INT32 value = 0; - UINT32 unsigned_value = 0; - UINT32 word = 0; - - // Isolate the opcode and convert to lower-case - memcpy(op_buf, image_line + 5, 3); - op_buf[3] = '\0'; - strlower(op_buf); - - // Isolate the value - sscanf(image_line + 9, "%d", &value); - unsigned_value = reverse((UINT32)value); - - if (!core_stricmp(op_buf, "num")) - word = unsigned_value; - else if (!core_stricmp(op_buf, "jmp")) - word = 0x00000000 | unsigned_value ; - else if (!core_stricmp(op_buf, "jrp")) - word = 0x00040000 | unsigned_value; - else if (!core_stricmp(op_buf, "ldn")) - word = 0x00020000 | unsigned_value; - else if (!core_stricmp(op_buf, "sto")) - word = 0x00060000 | unsigned_value; - else if (!core_stricmp(op_buf, "sub")) - word = 0x00010000 | unsigned_value; - else if (!core_stricmp(op_buf, "cmp")) - word = 0x00030000 | unsigned_value; - else if (!core_stricmp(op_buf, "stp")) - word = 0x00070000 | unsigned_value; - - space.write_byte((line << 2) + 0, (word >> 24) & 0x000000ff); - space.write_byte((line << 2) + 1, (word >> 16) & 0x000000ff); - space.write_byte((line << 2) + 2, (word >> 8) & 0x000000ff); - space.write_byte((line << 2) + 3, (word >> 0) & 0x000000ff); - } - } - } - - return IMAGE_INIT_PASS; -} - -/****************************************************\ -* Machine definition * -\****************************************************/ - -void ssem_state::machine_start() -{ - save_item(NAME(m_store_line)); -} - -void ssem_state::machine_reset() -{ - m_store_line = 0; -} - -static MACHINE_CONFIG_START( ssem, ssem_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", SSEMCPU, 700) - MCFG_CPU_PROGRAM_MAP(ssem_map) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(256, 280) - MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 279) - MCFG_SCREEN_UPDATE_DRIVER(ssem_state, screen_update_ssem) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", ssem_state, ssem_store, "snp,asm", 1) -MACHINE_CONFIG_END - - -ROM_START( ssem ) - ROM_REGION( 0x80, "maincpu", ROMREGION_ERASE00 ) /* Main Store */ -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP(1948, ssem, 0, 0, ssem, ssem, driver_device, 0, "Manchester University", "Small-Scale Experimental Machine (SSEM), 'Baby'", MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) - -#if (defined(__MINGW32__) && (__GNUC__ >= 5)) -#pragma GCC diagnostic pop -#endif diff --git a/src/mess/drivers/ssystem3.c b/src/mess/drivers/ssystem3.c deleted file mode 100644 index 03240af22b5..00000000000 --- a/src/mess/drivers/ssystem3.c +++ /dev/null @@ -1,337 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - - ssystem3.c - -Driver file to handle emulation of the Chess Champion Super System III / Chess -Champion MK III -by PeT mess@utanet.at November 2000, march 2008 - -Hardware descriptions: -- A 6502 CPU -- A 6522 VIA ($6000?) (PB6 and PB7 are tied) -- 2 x 2114 1kx4 SRAM to provide 1KB of RAM ($0000) -- 2xXXKB ROM (both connected to the same pins!, - look into mess source mess/messroms/rddil24.c for notes) - - signetics 7947e c19081e ss-3-lrom - - signetics 7945e c19082 ss-3-hrom ($d000??) - -optional printer (special serial connection) -optional board display (special serial connection) -internal expansion/cartridge port - (special power saving pack) - - -todo: -not sure about lcd signs and their assignments -not sure about all buttons and switches -playfield displayment currently based on simulation and on screen -not check for audio yet -convert to new artwork system - -needed: -artwork for board display -backup of playfield rom and picture/description of its board -*/ - -#include "emu.h" - -#include "includes/ssystem3.h" -#include "cpu/m6502/m6502.h" -#include "sound/dac.h" - - -// in my opinion own cpu to display lcd field and to handle own buttons -void ssystem3_state::ssystem3_playfield_getfigure(int x, int y, int *figure, int *black) -{ - int d; - if (x&1) - d=m_playfield.u.s.field[y][x/2]&0xf; - else - d=m_playfield.u.s.field[y][x/2]>>4; - - *figure=d&7; - *black=d&8; -} - -void ssystem3_state::ssystem3_playfield_reset() -{ - memset(&m_playfield, 0, sizeof(m_playfield)); - m_playfield.signal=FALSE; - // m_playfield.on=TRUE; //m_configuration->read()&1; -} - -void ssystem3_state::ssystem3_playfield_write(int reset, int signal) -{ - int d=FALSE; - - if (!reset) { - m_playfield.count=0; - m_playfield.bit=0; - m_playfield.started=FALSE; - m_playfield.signal=signal; - m_playfield.time=machine().time(); - } - if (!signal && m_playfield.signal) { - attotime t=machine().time(); - m_playfield.high_time=t - m_playfield.time; - m_playfield.time=t; - - // logerror("%.4x playfield %d lowtime %s hightime %s\n",(int)activecpu_get_pc(), m_playfield.count, - // m_playfield.low_time.as_string(7), m_playfield.high_time.as_string(7) ); - - if (m_playfield.started) { - // 0 twice as long low - // 1 twice as long high - if (m_playfield.low_time > m_playfield.high_time) d=TRUE; - - m_playfield.data&=~(1<<(m_playfield.bit^7)); - if (d) m_playfield.data|=1<<(m_playfield.bit^7); - m_playfield.bit++; - if (m_playfield.bit==8) { - logerror("%.4x playfield wrote %d %02x\n", (int)m_maincpu->pc(), m_playfield.count, m_playfield.data); - m_playfield.u.data[m_playfield.count]=m_playfield.data; - m_playfield.bit=0; - m_playfield.count=(m_playfield.count+1)%ARRAY_LENGTH(m_playfield.u.data); - if (m_playfield.count==0) m_playfield.started=FALSE; - } - } - - } else if (signal && !m_playfield.signal) { - attotime t=machine().time(); - m_playfield.low_time= t - m_playfield.time; - m_playfield.time=t; - m_playfield.started=TRUE; - } - m_playfield.signal=signal; -} - -void ssystem3_state::ssystem3_playfield_read(int *on, int *ready) -{ - *on = !(m_configuration->read() & 1); - // *on=!m_playfield.on; - *ready=FALSE; -} - -WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_a) -{ - m_porta=data; - // logerror("%.4x via port a write %02x\n",(int)activecpu_get_pc(), data); -} - -READ8_MEMBER(ssystem3_state::ssystem3_via_read_a) -{ - UINT8 data=0xff; -#if 1 // time switch - if (!(m_porta&0x10)) data&=m_matrix[0]->read()|0xf1; - if (!(m_porta&0x20)) data&=m_matrix[1]->read()|0xf1; - if (!(m_porta&0x40)) data&=m_matrix[2]->read()|0xf1; - if (!(m_porta&0x80)) data&=m_matrix[3]->read()|0xf1; -#else - if (!(m_porta&0x10)) data&=m_matrix[0]->read()|0xf0; - if (!(m_porta&0x20)) data&=m_matrix[1]->read()|0xf0; - if (!(m_porta&0x40)) data&=m_matrix[2]->read()|0xf0; - if (!(m_porta&0x80)) data&=m_matrix[3]->read()|0xf0; -#endif - if (!(m_porta&1)) { - if (!(m_matrix[0]->read()&1)) data&=~0x10; - if (!(m_matrix[1]->read()&1)) data&=~0x20; - if (!(m_matrix[2]->read()&1)) data&=~0x40; - if (!(m_matrix[3]->read()&1)) data&=~0x80; - } - if (!(m_porta&2)) { - if (!(m_matrix[0]->read()&2)) data&=~0x10; - if (!(m_matrix[1]->read()&2)) data&=~0x20; - if (!(m_matrix[2]->read()&2)) data&=~0x40; - if (!(m_matrix[3]->read()&2)) data&=~0x80; - } - if (!(m_porta&4)) { - if (!(m_matrix[0]->read()&4)) data&=~0x10; - if (!(m_matrix[1]->read()&4)) data&=~0x20; - if (!(m_matrix[2]->read()&4)) data&=~0x40; - if (!(m_matrix[3]->read()&4)) data&=~0x80; - } - if (!(m_porta&8)) { - if (!(m_matrix[0]->read()&8)) data&=~0x10; - if (!(m_matrix[1]->read()&8)) data&=~0x20; - if (!(m_matrix[2]->read()&8)) data&=~0x40; - if (!(m_matrix[3]->read()&8)) data&=~0x80; - } - // logerror("%.4x via port a read %02x\n",(int)activecpu_get_pc(), data); - return data; -} - - -/* - port b - bit 0: output opt device reset? - - hi speed serial 1 (d7d7 transfers 40 bit $2e) - bit 1: output data - bit 2: output clock (hi data is taken) - - bit 3: output opt data read - bit 4: input low opt data available - bit 5: input low opt device available - - - bit 6: input clocks!? - - port a: - bit 7: input low x/$37 2 - bit 6: input low x/$37 3 - bit 5: input low x/$37 4 (else 1) - - */ -READ8_MEMBER(ssystem3_state::ssystem3_via_read_b) -{ - UINT8 data=0xff; - int on, ready; - ssystem3_playfield_read(&on, &ready); - if (!on) data&=~0x20; - if (!ready) data&=~0x10; - return data; -} - -WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_b) -{ - ssystem3_playfield_write(data & 1, data & 8); - ssystem3_lcd_write(data & 4, data & 2); - - // TODO: figure out what this is trying to achieve - UINT8 d = ssystem3_via_read_b(space, 0, mem_mask) & ~0x40; - if (data & 0x80) d |= 0x40; - // d&=~0x8f; - m_via6522_0->write_pb0((d >> 0) & 1); - m_via6522_0->write_pb1((d >> 1) & 1); - m_via6522_0->write_pb2((d >> 2) & 1); - m_via6522_0->write_pb3((d >> 3) & 1); - m_via6522_0->write_pb4((d >> 4) & 1); - m_via6522_0->write_pb5((d >> 5) & 1); - m_via6522_0->write_pb6((d >> 6) & 1); - m_via6522_0->write_pb7((d >> 7) & 1); -} - -DRIVER_INIT_MEMBER(ssystem3_state,ssystem3) -{ - ssystem3_playfield_reset(); - ssystem3_lcd_reset(); -} - -static ADDRESS_MAP_START( ssystem3_map , AS_PROGRAM, 8, ssystem3_state ) - AM_RANGE( 0x0000, 0x03ff) AM_RAM - /* -67-de playfield ($40 means white, $80 black) - */ -// AM_RANGE( 0x4000, 0x40ff) AM_NOP -/* - probably zusatzger??t memory (battery powered ram 256x4? at 0x4000) - $40ff low nibble ram if playfield module (else init with normal playfield) - */ - AM_RANGE( 0x6000, 0x600f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) -#if 1 - AM_RANGE( 0xc000, 0xdfff) AM_ROM - AM_RANGE( 0xf000, 0xffff) AM_ROM -#else - AM_RANGE( 0xc000, 0xffff) AM_ROM -#endif -ADDRESS_MAP_END - -static INPUT_PORTS_START( ssystem3 ) -/* - switches: light(hardware?) sound time power(hardware!) - - new game (hardware?) -*/ - - - PORT_START( "Switches" ) -//PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW GAME") PORT_CODE(KEYCODE_F3) // seems to be direct wired to reset -// PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?CLEAR") PORT_CODE(KEYCODE_F1) -// PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_START( "matrix.0" ) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 C SQ EP") PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER?") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 C BOARD MD") PORT_CODE(KEYCODE_0) - PORT_START( "matrix.1" ) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 F springer zeitvorgabe") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 E laeufer ruecknahme") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CE interrupt") PORT_CODE(KEYCODE_BACKSPACE) - PORT_START( "matrix.2" ) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 G bauer zugvorschlaege") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 D turm #") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 A white") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) - PORT_START( "matrix.3" ) - PORT_DIPNAME( 0x01, 0, "Time") PORT_CODE(KEYCODE_T) PORT_TOGGLE PORT_DIPSETTING( 0, DEF_STR(Off) ) PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 H black") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 C dame #50") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 B koenig FP") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) - PORT_START( "Configuration" ) - PORT_DIPNAME( 0x0001, 0, "Schachbrett") PORT_TOGGLE - PORT_DIPSETTING( 0, DEF_STR( Off ) ) - PORT_DIPSETTING( 1, "angeschlossen" ) -#if 0 - PORT_DIPNAME( 0x0002, 0, "Memory") PORT_TOGGLE - PORT_DIPSETTING( 0, DEF_STR( Off ) ) - PORT_DIPSETTING( 2, "angeschlossen" ) - PORT_DIPNAME( 0x0004, 0, "Drucker") PORT_TOGGLE - PORT_DIPSETTING( 0, DEF_STR( Off ) ) - PORT_DIPSETTING( 4, "angeschlossen" ) -#endif -INPUT_PORTS_END - - - -static MACHINE_CONFIG_START( ssystem3, ssystem3_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 1000000) - MCFG_CPU_PROGRAM_MAP(ssystem3_map) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(LCD_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(728, 437) - MCFG_SCREEN_VISIBLE_AREA(0, 728-1, 0, 437-1) - MCFG_SCREEN_UPDATE_DRIVER(ssystem3_state, screen_update_ssystem3) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 242 + 32768) - MCFG_PALETTE_INIT_OWNER(ssystem3_state, ssystem3) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - /* via */ - MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) - MCFG_VIA6522_READPA_HANDLER(READ8(ssystem3_state,ssystem3_via_read_a)) - MCFG_VIA6522_READPB_HANDLER(READ8(ssystem3_state,ssystem3_via_read_b)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(ssystem3_state,ssystem3_via_write_a)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(ssystem3_state,ssystem3_via_write_b)) -MACHINE_CONFIG_END - - -ROM_START(ssystem3) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("ss3lrom", 0xc000, 0x1000, CRC(9ea46ed3) SHA1(34eef85b356efbea6ddac1d1705b104fc8e2731a) ) -// ROM_RELOAD(0xe000, 0x1000) - ROM_LOAD("ss3hrom", 0xf000, 0x1000, CRC(52741e0b) SHA1(2a7b950f9810c5a14a1b9d5e6b2bd93da621662e) ) - ROM_RELOAD(0xd000, 0x1000) -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1979, ssystem3, 0, 0, ssystem3, ssystem3, ssystem3_state, ssystem3, "NOVAG Industries Ltd", "Chess Champion Super System III", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -//chess champion MK III in germany diff --git a/src/mess/drivers/stratos.c b/src/mess/drivers/stratos.c deleted file mode 100644 index 3ad13837193..00000000000 --- a/src/mess/drivers/stratos.c +++ /dev/null @@ -1,370 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -/*************************************************************************** - - Saitek/Scisys Kasparov Stratos Chess Computer - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m65c02.h" -#include "machine/nvram.h" - -class stratos_state : public driver_device -{ -public: - stratos_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - maincpu(*this, "maincpu"), - nvram(*this, "nvram"), - bank_8000(*this, "bank_8000"), - bank_4000(*this, "bank_4000"), - nvram_bank(*this, "nvram_bank") - { } - - required_device maincpu; - required_device nvram; - required_memory_bank bank_8000; - required_memory_bank bank_4000; - required_memory_bank nvram_bank; - - UINT8 *nvram_data; - UINT8 control, led_latch_control; - UINT32 individual_leds; - UINT8 latch_AH_red, latch_AH_green, latch_18_red, latch_18_green; - - DECLARE_DRIVER_INIT(stratos); - DECLARE_WRITE8_MEMBER(p2000_w); - DECLARE_READ8_MEMBER(p2200_r); - DECLARE_WRITE8_MEMBER(p2200_w); - DECLARE_WRITE8_MEMBER(p2400_w); - DECLARE_READ8_MEMBER(control_r); - DECLARE_WRITE8_MEMBER(control_w); - DECLARE_READ8_MEMBER(lcd_r); - DECLARE_WRITE8_MEMBER(lcd_w); - - TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); - - void show_leds(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void machine_reset(); -}; - -DRIVER_INIT_MEMBER( stratos_state, stratos ) -{ - nvram_data = auto_alloc_array(machine(), UINT8, 0x2000); - nvram->set_base(nvram_data, 0x2000); - - bank_8000 ->configure_entries(0, 4, memregion("roms_8000")->base(), 0x8000); - bank_4000 ->configure_entries(0, 4, memregion("roms_4000")->base(), 0x4000); - nvram_bank->configure_entries(0, 2, nvram_data, 0x1000); -} - -void stratos_state::machine_reset() -{ - control = 0x00; - led_latch_control = 0x00; - individual_leds = 0x00000; - latch_AH_red = 0; - latch_AH_green = 0; - latch_18_red = 0; - latch_18_green = 0; - bank_8000 ->set_entry(0); - bank_4000 ->set_entry(0); - nvram_bank->set_entry(0); -} - -void stratos_state::show_leds() -{ - static const char *led_pos[18] = { - 0, 0, "gPawn", "gKnight", "gBishop", "gRook", "gQueen", "gKing", 0, 0, "rPawn", "rKnight", "rBishop", "rRook", "rQueen", "rKing", 0, 0 - }; - char str_red[64]; - char str_green[64]; - - char *pr = str_red; - char *pg = str_green; - - *pr = *pg = 0; - - for(int i=0; i != 18; i++) - if(individual_leds & (1 << i)) { - const char *pos = led_pos[i]; - if(!pos) - pr += sprintf(pr, " <%d>", i); - else if(pos[0] == 'r') - pr += sprintf(pr, " %s", pos+1); - else - pg += sprintf(pg, " %s", pos+1); - } - - // Obviously slightly incorrect - if(!(led_latch_control & 8)) { - pr += sprintf(pr, " %c%c", 'A' + latch_AH_red, '1' + latch_18_red); - pg += sprintf(pg, " %c%c", 'A' + latch_AH_green, '1' + latch_18_green); - } - - logerror("leds R:%s -- G:%s (%s)\n", str_red, str_green, machine().describe_context()); -} - -TIMER_DEVICE_CALLBACK_MEMBER(stratos_state::irq_timer) -{ - maincpu->set_input_line(M65C02_IRQ_LINE, HOLD_LINE); -} - -UINT32 stratos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - static bool nmi=false; - - if(machine().input().code_pressed(KEYCODE_W)) { - if(!nmi) { - maincpu->set_input_line(M65C02_NMI_LINE, PULSE_LINE); - nmi = true; - } - } else - nmi = false; - - - return 0; -} - -WRITE8_MEMBER(stratos_state::p2000_w) -{ - led_latch_control = data; - - if(!(data & 0x10)) - latch_18_red = data & 7; - if(!(data & 0x20)) - latch_18_green = data & 7; - if(!(data & 0x40)) - latch_AH_red = data & 7; - if(!(data & 0x80)) - latch_AH_green = data & 7; - - show_leds(); -} - -READ8_MEMBER(stratos_state::p2200_r) -{ - logerror("p2200_r (%s)\n", machine().describe_context()); - return machine().rand(); -} - -WRITE8_MEMBER(stratos_state::p2200_w) -{ - logerror("p2200_w %02x -> %02x (%s)\n", data, data^0xff, machine().describe_context()); -} - -WRITE8_MEMBER(stratos_state::p2400_w) -{ - if(control & 0x20) { - individual_leds = individual_leds & 0x100ff; - individual_leds |= (data ^ 0xff) << 8; - if(!(control & 0x04)) - individual_leds |= 0x20000; - } else { - individual_leds = individual_leds & 0x2ff00; - individual_leds |= data ^ 0xff; - if(!(control & 0x04)) - individual_leds |= 0x10000; - } -} - -READ8_MEMBER(stratos_state::control_r) -{ - static int xx = 0; - xx = !xx; - // [d659/d630] - // d64e: - // 2000 = f9 - // 2000 = f7 - // 8fb = (2600) & 20 - - // d625: test device? - // 8fb=00 : (00, 80) (05, 80) (06, 80) - // 8fb=20 : (03, 20) (06, 20) (04, 20) - // { 2000=f9, 2000=f0 | first, test (2600) & second - // -> 3-bit mask - // d518: 0c 0a 10 0e 14 18 0b 08 -> 1b, timing on loop at e788 - // d520: 02cc 035b 0219 0266 01ad 0166 0300 0432 -> 8d7/8 - - - // table at f70e (index on d545 somehow): - // 0c 0d 0e 0f 10 11 01 02 - - // table at d545: - // 00 4800 6800 - // 01 4802 6800 - // 02 4800 6802 - // 03 4801 6800 - // 04 4800 6801 - // 05 4801 6801 - // 06 4c00 6800 - // 07 4800 6c00 - // 08 4800 6c00 - // 09 4c00 6800 - // 0a 4c00 6c00 - // 0b 4c00 6c00 - // 0c 4880 6800 - // 0d 4840 6800 - // 0e 4820 6800 - // 0f 4810 6800 - // 10 4808 6800 - // 11 4804 6800 - // 12 4800 6880 - // 13 4800 6840 - // 14 4800 6820 - // 15 4800 6810 - // 16 4800 6808 - // 17 4800 6804 - // 18 4880 6880 - // 19 4840 6840 - // 1a 4820 6820 - // 1b 4810 6810 - // 1c 4808 6808 - // 1d 4804 6804 - - // Power up led test table - // 1208 Ki Green - // 1308 Qu - // 1408 Ro - // 1508 Bi - // 1608 Kn - // 1708 Pa - // 0727 8 - // 0026 7 - // 0025 6 - // 0024 5 - // 0023 4 - // 0022 3 - // 0021 2 - // 0020 1 - // 0080 A - // 0081 B - // 0082 C - // 0083 D - // 0084 E - // 0085 F - // 0086 G - // 0087 H - // 0008 - - // 0c08 Ki Red - // 0d08 Qu - // 0e08 Ro - // 0f08 Bi - // 1008 Kn - // 1108 Pa - // 0108 - // 0208 - // 0308 - // 0408 - // 0617 8 - // 0016 7 - // 0015 6 - // 0014 5 - // 0013 4 - // 0012 3 - // 0011 2 - // 0010 1 - // 0040 A - // 0041 B - // 0042 C - // 0043 D - // 0044 E - // 0045 F - // 0046 G - // 0047 H - // 0009 - // 00c2 - - // (20) = difficulty level - - logerror("control_r (%s)\n", machine().describe_context()); - return xx ? 0x20 : 0x00; -} - -WRITE8_MEMBER(stratos_state::control_w) -{ - logerror("control_w %02x bank %d (%s)\n", data, data & 3, machine().describe_context()); - - control = data; - bank_8000->set_entry(data & 3); - bank_4000->set_entry(data & 3); - nvram_bank->set_entry((data >> 1) & 1); -} - - -READ8_MEMBER(stratos_state::lcd_r) -{ - return 0x00; -} - -WRITE8_MEMBER(stratos_state::lcd_w) -{ - // 08 0b - 00? - // 04 06 - 05 - // 02 0d - 07 - // 01 00 - 05 - - static UINT8 vals[18]; - static int idx = 0; - if(data == 0) - idx = 0; - if(idx/2 >= 18) - return; - if(idx & 1) - vals[idx/2] = (vals[idx/2] & 0xf0) | (data & 0xf); - else - vals[idx/2] = (data & 0xf) << 4; - - idx++; - if(idx == 18*2) { - logerror("lcd"); - for(int i=0; i<18; i++) - logerror(" %02x", vals[i]); - logerror("\n"); - } -} - -static ADDRESS_MAP_START( stratos_mem, AS_PROGRAM, 8, stratos_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0x2000) AM_WRITE(p2000_w) - AM_RANGE(0x2200, 0x2200) AM_READWRITE(p2200_r, p2200_w) - AM_RANGE(0x2400, 0x2400) AM_WRITE(p2400_w) - AM_RANGE(0x2600, 0x2600) AM_READWRITE(control_r, control_w) - AM_RANGE(0x2800, 0x37ff) AM_RAMBANK("nvram_bank") - AM_RANGE(0x3800, 0x3800) AM_READWRITE(lcd_r, lcd_w) - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank_4000") - AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank_8000") -ADDRESS_MAP_END - -static INPUT_PORTS_START( stratos ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( stratos, stratos_state ) - MCFG_CPU_ADD("maincpu", M65C02, 5670000) - MCFG_CPU_PROGRAM_MAP(stratos_mem) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(240, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 63) - MCFG_SCREEN_UPDATE_DRIVER(stratos_state, screen_update) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq", stratos_state, irq_timer, attotime::from_hz(1000)) - - MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - -ROM_START( stratos ) - ROM_REGION(0x20000, "roms_8000", 0) - ROM_LOAD("w1_728m_u3.u3", 0x0000, 0x8000, CRC(b58a7256) SHA1(75b3a3a65f4ca8d52aa5b17a06319bff59d9014f)) - ROM_LOAD("bw1_918n_u4.u4", 0x8000, 0x8000, CRC(cb0de631) SHA1(f78d40213be21775966cbc832d64acd9b73de632)) - ROM_FILL(0x10000, 0x10000, 0xff) - - ROM_REGION(0x10000, "roms_4000", 0) - ROM_FILL(0x00000, 0x10000, 0xff) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -CONS( 1986, stratos, 0, 0, stratos, stratos, stratos_state, stratos, "Saitek", "Kasparov Stratos Chess Computer", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/studio2.c b/src/mess/drivers/studio2.c deleted file mode 100644 index 46efbaf963b..00000000000 --- a/src/mess/drivers/studio2.c +++ /dev/null @@ -1,759 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -RCA Studio II - -PCB Layout ----------- - -1809746-S1-E - -|----------------------------------------------------------------------------------------------------------| -| |----------------------------| | -| |----------------------------| CA555 7805 | -| SPKR CN1 | -| | -| |-----------| | -| | Output | | -| ROM.4 ROM.3 ROM.2 ROM.1 CDP1822 CDP1822 CDP1822 CDP1822 |TV Module | | -| | | | -| CDP1802 TA10171V1 | | | -| | | | -| | | | -| | | | -| |-----------| | -| | -| CD4042 CD4001 CD4515 | -| | -| CN2 CN3 | -|----------------------------------------------------------------------------------------------------------| - -Notes: - All IC's shown. - - CDP1802 - RCA CDP1802CE Microprocessor - TA10171V1 - RCA TA10171V1 NTSC Video Display Controller (VDC) (= RCA CDP1861) - CDP1822 - RCA CDP1822NCE 256 x4 RAM (= Mitsubishi M58721P) - ROM.x - RCA CDP1831CE 512 x8 MASKROM. All ROMs are marked 'PROGRAM COPYRIGHT (C) RCA CORP. 1977' - CD4001 - 4001 Quad 2-Input NOR Buffered B Series Gate (4000-series CMOS TTL logic IC) - CD4042 - 4042 Quad Clocked D Latch (4000-series CMOS TTL logic IC) - CD4515 - 4515 4-Bit Latched/4-to-16 Line Decoders (4000-series CMOS TTL logic IC) - CA555 - CA555CG General Purpose Single Bipolar Timer (= NE555) - 7805 - Voltage regulator, input 10V-35V, output +5V - SPKR - Loudspeaker, 8 ohms, 0.3 W - CN1 - ROM cartridge connector, 2x22 pins, 0.154" spacing - CN2 - Player A keypad connector, 1x12 pins - CN3 - Player B keypad connector, 1x12 pins -*/ - -/* - -Toshiba Visicom Console (RCA Studio II clone) -Toshiba, 1978 - -PCB Layout Many resistors/caps ----------- 7.5VDC / transistors in this area - \/ /---|-----/ -|------------------------------------------||---|-------| |-----|C|------| -|D235 POT TC4011 CART_SLOT | | | TV Modulator | -|HEATSINK | | | | -| TC4515 TC4049 TC4011 74LS08| | | SW (VHF Ch1) | -|DIODES(x20) 74LS74 74LS73| | | (VHF Ch2) | -|-----------| 3.579545MHz | | - | CDP1802 | POT | |--------------| - |TMM331 | | - | CDP1861 TC5012 TC5012 | - | TC4021 TC4021 | | - | TC5012 \-----/ | - | 2111 2111 2111 74LS74 | - |TC4042 2111 2111 2111 TC4011 | - |-------------------------------------------| -Notes: (all chips shown above) - CDP1802 - RCA CDP1802 CPU (DIP40), clock 1.7897725MHz [3.579545/2] - CDP1861 - RCA CDP1861 Video Controller (DIP24) - VSync - 60.4533Hz \ (measured on pin 6) - HSync - 15.8387kHz / - Clock - 223.721562kHz [3.579545/16] (measured on pin 1) - 2111 - NEC D2111AL-4 256 bytes x4 SRAM (DIP18, x6). Total 1.5k - C - Composite Video Output to TV from TV Modulator - TMM331 - Toshiba TMM331AP 2k x8 MASKROM (DIP24) - Pinout: - TMM331 - |----\/----| - A7 |1 24| VCC - A8 |2 23| D0 - A9 |3 22| D1 - A10 |4 21| D2 - A0 |5 20| D3 - A1 |6 19| D4 - A2 |7 18| D5 - A3 |8 17| D6 - A4 |9 16| D7 - A5 |10 15| E0 (measured LOW) - A6 |11 14| E1 (NC?) - GND |12 13| E2 (measured LOW) - |----------| - - E0 - E2 are Programmable Chip Select Inputs - TMM331 is compatible with AMI S6831A, AMD AM9217, - Intel 2316A/8316A, MOSTEK MK31000, GI RO-3-8316, - NATIONAL/NEC/SYNERTEK 2316A etc - - -Cartridges ----------- - -Inside is a Toshiba TMM331AP ROM, which is pin compatible with the Signetics S6831. -The cartridge to TMM331 pin connections are as follows, with cartridge pin 1 being the leftmost angled contact: - -Pin 1 to ROM pins 12,13 (GND and E2) -Pin 2 to ROM pins 24,15 (VCC and E0) -Pin 3 to ROM pin 23 (D0) -Pin 4 to ROM pin 22 (D1) -Pin 5 to ROM pin 21 (D2) -Pin 6 to ROM pin 20 (D3) -Pin 7 to ROM pin 19 (D4) -Pin 8 to ROM pin 18 (D5) -Pin 9 to ROM pin 17 (D6) -Pin 10 to ROM pin 16 (D7) -Pin 11 to ROM pin 14 (E1) -Pin 12 to ROM pin 11 (A6) -Pin 13 to ROM pin 10 (A5) -Pin 14 to ROM pin 9 (A4) -Pin 15 to ROM pin 8 (A3) -Pin 16 to ROM pin 7 (A2) -Pin 17 to ROM pin 6 (A1) -Pin 18 to ROM pin 5 (A0) -Pin 19 to ROM pin 1 (A7) -Pin 20 to ROM pin 4 (A10) -Pin 21 to ROM pin 3 (A9) -Pin 22 to ROM pin 2 (A8) - -*/ - -/* - -Mustang 9016 Telespiel Computer - -PCB Layout ----------- - -|----------------------------------------------------------------------------------------------------------| -|7805 |----------------------------| CD4069 MC14001 | -| |----------------------------| | -| CN1 | -| | -| ROM.IC13 ROM.IC14 CDP1822 CDP1822 CDP1822 CDP1822 |-----------| | -| | Output | | -| |TV Module? | | -| ROM.IC12 CDP1802 CDP1864 | | | -| CDP1822 | | | -| CD4019 CDP1858 CD4081 CD4069 | | | -| | | | -| CD4515 | | | -| 1.750MHz |-----------| | -| 4.3236MHz | -| | -| | -| | -|----------------------------------------------------------------------------------------------------------| - -Notes: - All IC's shown. - - CDP1802 - RCA CDP1802CE Microprocessor - CDP1864 - RCA CDP1864CE PAL Video Display Controller (VDC) - CDP1822 - RCA CDP1822NCE 256 x4 RAM (= Mitsubishi M58721P) - ROM.ICx - RCA CDP1833 1k x8 MASKROM. All ROMs are marked 'PROGRAM COPYRIGHT (C) RCA CORP. 1978' - CD4019 - 4019 Quad AND-OR Select Gate (4000-series CMOS TTL logic IC) - CDP1858 - RCA CDP1858E Latch/Decoder - 4-bit - CD4081 - 4081 Quad 2-Input AND Buffered B Series Gate (4000-series CMOS TTL logic IC) - CD4069 - 4069 Hex Buffer, Inverter (4000-series CMOS TTL logic IC) - CD4515 - 4515 4-Bit Latched/4-to-16 Line Decoders (4000-series CMOS TTL logic IC) - 7805 - Voltage regulator, input 10V-35V, output +5V - CN1 - ROM cartridge connector, 2x22 pins, 0.154" spacing -*/ - -/* - - TODO: - - - NE555 discrete sound - -*/ - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "sound/beep.h" -#include "sound/cdp1864.h" -#include "sound/discrete.h" -#include "video/cdp1861.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define CDP1802_TAG "ic1" -#define CDP1861_TAG "ic2" -#define CDP1864_TAG "cdp1864" -#define SCREEN_TAG "screen" - -class studio2_state : public driver_device -{ -public: - - studio2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_beeper(*this, "beeper"), - m_vdc(*this, CDP1861_TAG), - m_cart(*this, "cartslot"), - m_clear(*this, "CLEAR"), - m_a(*this, "A"), - m_b(*this, "B"), - m_screen(*this, "screen") - { } - - required_device m_maincpu; - required_device m_beeper; - optional_device m_vdc; - required_device m_cart; - required_ioport m_clear; - required_ioport m_a; - required_ioport m_b; - required_device m_screen; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( cart_400 ); - DECLARE_READ8_MEMBER( cart_a00 ); - DECLARE_READ8_MEMBER( cart_e00 ); - DECLARE_READ8_MEMBER( dispon_r ); - DECLARE_WRITE8_MEMBER( keylatch_w ); - DECLARE_WRITE8_MEMBER( dispon_w ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_READ_LINE_MEMBER( ef4_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_INPUT_CHANGED_MEMBER( reset_w ); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( studio2_cart_load ); - - /* keyboard state */ - UINT8 m_keylatch; - DECLARE_DRIVER_INIT(studio2); -}; - -class visicom_state : public studio2_state -{ -public: - visicom_state(const machine_config &mconfig, device_type type, const char *tag) - : studio2_state(mconfig, type, tag), - m_color0_ram(*this, "color0_ram"), - m_color1_ram(*this, "color1_ram") - { } - - virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - required_shared_ptr m_color0_ram; - required_shared_ptr m_color1_ram; - - DECLARE_WRITE8_MEMBER( dma_w ); -}; - -class mpt02_state : public studio2_state -{ -public: - mpt02_state(const machine_config &mconfig, device_type type, const char *tag) - : studio2_state(mconfig, type, tag), - m_cti(*this, CDP1864_TAG), - m_color_ram(*this, "color_ram") - { } - - required_device m_cti; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( cart_c00 ); - DECLARE_WRITE8_MEMBER( dma_w ); - DECLARE_READ_LINE_MEMBER( rdata_r ); - DECLARE_READ_LINE_MEMBER( bdata_r ); - DECLARE_READ_LINE_MEMBER( gdata_r ); - - /* video state */ - required_shared_ptr m_color_ram; - UINT8 m_color; -}; - - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -#define LOG 0 - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -/* Read/Write Handlers */ - -WRITE8_MEMBER( studio2_state::keylatch_w ) -{ - m_keylatch = data & 0x0f; -} - -READ8_MEMBER( studio2_state::dispon_r ) -{ - m_vdc->disp_on_w(1); - m_vdc->disp_on_w(0); - - return 0xff; -} - -WRITE8_MEMBER( studio2_state::dispon_w ) -{ - m_vdc->disp_on_w(1); - m_vdc->disp_on_w(0); -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( studio2_map, AS_PROGRAM, 8, studio2_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0x09ff) AM_MIRROR(0xf400) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( studio2_io_map, AS_IO, 8, studio2_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x01, 0x01) AM_READ(dispon_r) - AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( visicom_map, AS_PROGRAM, 8, visicom_state ) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0x0fff) AM_DEVREAD("cartslot", generic_slot_device, read_rom) - AM_RANGE(0x1000, 0x10ff) AM_RAM - AM_RANGE(0x1100, 0x11ff) AM_RAM AM_SHARE("color0_ram") - AM_RANGE(0x1300, 0x13ff) AM_RAM AM_SHARE("color1_ram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( visicom_io_map, AS_IO, 8, visicom_state ) - AM_RANGE(0x01, 0x01) AM_WRITE(dispon_w) - AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mpt02_map, AS_PROGRAM, 8, mpt02_state ) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0x09ff) AM_RAM - AM_RANGE(0x0b00, 0x0b3f) AM_RAM AM_SHARE("color_ram") - AM_RANGE(0x0c00, 0x0fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mpt02_io_map, AS_IO, 8, mpt02_state ) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispon_r, step_bgcolor_w) - AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) - AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispoff_r, tone_latch_w) -ADDRESS_MAP_END - -/* Input Ports */ - -INPUT_CHANGED_MEMBER( studio2_state::reset_w ) -{ - if (oldval && !newval) - { - machine_reset(); - } -} - -static INPUT_PORTS_START( studio2 ) - PORT_START("A") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 0") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 1") PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 2") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 3") PORT_CODE(KEYCODE_E) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 4") PORT_CODE(KEYCODE_A) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 5") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 6") PORT_CODE(KEYCODE_D) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 7") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 8") PORT_CODE(KEYCODE_X) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("A 9") PORT_CODE(KEYCODE_C) - - PORT_START("B") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 1") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 2") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 3") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 7") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 8") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("B 9") PORT_CODE(KEYCODE_3_PAD) - - PORT_START("CLEAR") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Clear") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHANGED_MEMBER(DEVICE_SELF, studio2_state, reset_w, 0) -INPUT_PORTS_END - -/* Video */ - -static const rgb_t VISICOM_PALETTE[] = -{ - rgb_t(0x00, 0x40, 0x00), - rgb_t(0xaf, 0xdf, 0xe4), - rgb_t(0xb9, 0xc4, 0x2f), - rgb_t(0xef, 0x45, 0x4a) -}; - -UINT32 visicom_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_vdc->screen_update(screen, bitmap, cliprect); - - m_vdc->m_bitmap.fill(VISICOM_PALETTE[0], cliprect); - - return 0; -} - -READ_LINE_MEMBER( mpt02_state::rdata_r ) -{ - return BIT(m_color, 0); -} - -READ_LINE_MEMBER( mpt02_state::bdata_r ) -{ - return BIT(m_color, 1); -} - -READ_LINE_MEMBER( mpt02_state::gdata_r ) -{ - return BIT(m_color, 2); -} - -/* CDP1802 Configuration */ - -READ_LINE_MEMBER( studio2_state::clear_r ) -{ - return BIT(m_clear->read(), 0); -} - -READ_LINE_MEMBER( studio2_state::ef3_r ) -{ - return BIT(m_a->read(), m_keylatch); -} - -READ_LINE_MEMBER( studio2_state::ef4_r ) -{ - return BIT(m_b->read(), m_keylatch); -} - -WRITE_LINE_MEMBER( studio2_state::q_w ) -{ - m_beeper->set_state(state); -} - -WRITE8_MEMBER( visicom_state::dma_w ) -{ - int sx = m_screen->hpos() + 4; - int y = m_screen->vpos(); - - UINT8 addr = offset & 0xff; - UINT8 color0 = m_color0_ram[addr]; - UINT8 color1 = m_color1_ram[addr]; - - for (int x = 0; x < 8; x++) - { - int color = (BIT(color1, 7) << 1) | BIT(color0, 7); - m_vdc->m_bitmap.pix32(y, sx + x) = VISICOM_PALETTE[color]; - color0 <<= 1; - color1 <<= 1; - } -} - -WRITE8_MEMBER( mpt02_state::dma_w ) -{ - UINT8 addr = ((offset & 0xe0) >> 2) | (offset & 0x07); - - m_color = m_color_ram[addr]; - - m_cti->con_w(0); // HACK - m_cti->dma_w(space, offset, data); -} - -/* Machine Initialization */ - -// trampolines to cartridge -READ8_MEMBER( studio2_state::cart_400 ) { return m_cart->read_rom(space, offset); } -READ8_MEMBER( studio2_state::cart_a00 ) { return m_cart->read_rom(space, offset + 0x600); } -READ8_MEMBER( studio2_state::cart_e00 ) { return m_cart->read_rom(space, offset + 0xa00); } -READ8_MEMBER( mpt02_state::cart_c00 ) { return m_cart->read_rom(space, offset + 0x800); } - -void studio2_state::machine_start() -{ - if (m_cart->exists()) - { - // these have to be installed only if a cart is present, because they partially overlap the built-in game - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0400, 0x07ff, read8_delegate(FUNC(studio2_state::cart_400), this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0a00, 0x0bff, read8_delegate(FUNC(studio2_state::cart_a00), this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0e00, 0x0fff, read8_delegate(FUNC(studio2_state::cart_e00), this)); - } - - // register for state saving - save_item(NAME(m_keylatch)); -} - -void mpt02_state::machine_start() -{ - if (m_cart->exists()) - { - // these have to be installed only if a cart is present, because they partially overlap the built-in game - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0400, 0x07ff, read8_delegate(FUNC(studio2_state::cart_400), this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0c00, 0x0fff, read8_delegate(FUNC(mpt02_state::cart_c00), this)); - } - - // register for state saving - save_item(NAME(m_keylatch)); -} - -void studio2_state::machine_reset() -{ - m_vdc->reset(); -} - -void mpt02_state::machine_reset() -{ - m_cti->reset(); -} - -DEVICE_IMAGE_LOAD_MEMBER( studio2_state, studio2_cart_load ) -{ - UINT32 size; - - // always alloc 3K, even if range $400-$600 is not read by the system (RAM is present there) - m_cart->rom_alloc(0xc00, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - - if (image.software_entry() == NULL) - { - if (!strcmp(image.filetype(), "st2")) - { - UINT8 header[0x100]; - UINT8 catalogue[10], title[32], pages[64]; - UINT8 blocks; - - if (image.length() <= 0x100) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid ROM file"); - return IMAGE_INIT_FAIL; - } - - image.fread(&header, 0x100); - - // validate - if (strncmp((const char *)header, "RCA2", 4)) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not an .ST2 file"); - return IMAGE_INIT_FAIL; - } - - blocks = header[4]; - memcpy(&catalogue, &header[16], 10); - memcpy(&title, &header[32], 32); - memcpy(&pages, &header[64], 64); - - /* read ST2 cartridge into memory */ - for (int block = 0; block < (blocks - 1); block++) - { - if (pages[block] < 4) - logerror("ST2 invalid block %u to %04x\n", block, pages[block] << 8); - else - { - UINT16 offset = (pages[block] << 8) - 0x400; - logerror("ST2 Reading block %u to %04x\n", block, offset); - image.fread(m_cart->get_rom_base() + offset, 0x100); - } - } - - logerror("ST2 Catalogue: %s\n", catalogue); - logerror("ST2 Title: %s\n", title); - } - else - { - size = image.length(); - if (size > 0x400) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - else - image.fread(m_cart->get_rom_base(), size); - } - } - else - { - // Studio II carts might map their data at $400-$7ff, $a00-$bff and $e00-$fff - // MPT-2 carts might map their data at $400-$7ff and $c00-$fff - if (image.get_software_region("rom_400")) - memcpy(m_cart->get_rom_base() + 0x000, image.get_software_region("rom_400"), image.get_software_region_length("rom_400")); - if (image.get_software_region("rom_a00")) - memcpy(m_cart->get_rom_base() + 0x600, image.get_software_region("rom_a00"), image.get_software_region_length("rom_a00")); - if (image.get_software_region("rom_c00")) - memcpy(m_cart->get_rom_base() + 0x800, image.get_software_region("rom_c00"), image.get_software_region_length("rom_c00")); - if (image.get_software_region("rom_e00")) - memcpy(m_cart->get_rom_base() + 0xa00, image.get_software_region("rom_e00"), image.get_software_region_length("rom_e00")); - } - - return IMAGE_INIT_PASS; -} - - -/* Machine Drivers */ - -static MACHINE_CONFIG_FRAGMENT( studio2_cartslot ) - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "studio2_cart") - MCFG_GENERIC_EXTENSIONS("st2,bin,rom") - MCFG_GENERIC_LOAD(studio2_state, studio2_cart_load) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "studio2") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( studio2, studio2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, 1760000) /* the real clock is derived from an oscillator circuit */ - MCFG_CPU_PROGRAM_MAP(studio2_map) - MCFG_CPU_IO_MAP(studio2_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(studio2_state, clear_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(studio2_state, ef3_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(studio2_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(studio2_state, q_w)) - MCFG_COSMAC_DMAW_CALLBACK(DEVWRITE8(CDP1861_TAG, cdp1861_device, dma_w)) - - /* video hardware */ - MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, 1760000) - MCFG_CDP1861_IRQ_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) - MCFG_CDP1861_DMA_OUT_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT)) - MCFG_CDP1861_EFX_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) - MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, 1760000) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_FRAGMENT_ADD( studio2_cartslot ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( visicom, visicom_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_3_579545MHz/2) - MCFG_CPU_PROGRAM_MAP(visicom_map) - MCFG_CPU_IO_MAP(visicom_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(visicom_state, clear_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(visicom_state, ef3_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(visicom_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(visicom_state, q_w)) - MCFG_COSMAC_DMAW_CALLBACK(WRITE8(visicom_state, dma_w)) - - /* video hardware */ - MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, XTAL_3_579545MHz/2) - MCFG_CDP1861_IRQ_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) - MCFG_CDP1861_DMA_OUT_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT)) - MCFG_CDP1861_EFX_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) - MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2) - MCFG_SCREEN_UPDATE_DRIVER(visicom_state, screen_update) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "visicom_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "visicom") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( mpt02, mpt02_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, CDP1864_CLOCK) - MCFG_CPU_PROGRAM_MAP(mpt02_map) - MCFG_CPU_IO_MAP(mpt02_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(mpt02_state, clear_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(mpt02_state, ef3_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(mpt02_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(mpt02_state, q_w)) - MCFG_COSMAC_DMAW_CALLBACK(WRITE8(mpt02_state, dma_w)) - - /* video hardware */ - MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, CDP1864_CLOCK) - MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, CDP1864_CLOCK, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(mpt02_state, rdata_r), READLINE(mpt02_state, bdata_r), READLINE(mpt02_state, gdata_r)) - MCFG_CDP1864_CHROMINANCE(RES_K(4.7), RES_K(8.2), RES_K(4.7), RES_K(22)) - - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_FRAGMENT_ADD( studio2_cartslot ) -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( studio2 ) - ROM_REGION( 0x1000, CDP1802_TAG, 0 ) - ROM_LOAD( "84932.ic11", 0x000, 0x200, CRC(283b7e65) SHA1(4b6d21cde59712ecb5941ff63d8eb161420b0aac) ) - ROM_LOAD( "84933.ic12", 0x200, 0x200, CRC(a396b77c) SHA1(023517f67af61790e6916b6c4dbe2d9dc07ae3ff) ) - ROM_LOAD( "85456.ic13", 0x400, 0x200, CRC(d25cf97f) SHA1(d489f41f1125c76cc8ed9defa82a877ae014ef21) ) - ROM_LOAD( "85457.ic14", 0x600, 0x200, CRC(74aa724f) SHA1(085832f29e0d2a387c75463d66c54fb6c1e9e72c) ) -ROM_END - -ROM_START( visicom ) - ROM_REGION( 0x1000, CDP1802_TAG, 0 ) - ROM_LOAD( "visicom.q003", 0x000, 0x800, CRC(23d22074) SHA1(a0a8be23f70621a2bd8010b1134e8a0019075bf1) ) -ROM_END - -ROM_START( mpt02 ) - ROM_REGION( 0x1000, CDP1802_TAG, 0 ) - ROM_LOAD( "86676.ic13", 0x000, 0x400, CRC(a7d0dd3b) SHA1(e1881ab4d67a5d735dd2c8d7e924e41df6f2aeec) ) - ROM_LOAD( "86677b.ic14", 0x400, 0x400, CRC(82a2d29e) SHA1(37e02089d611db10bad070d89c8801de41521189) ) - ROM_LOAD( "87201.ic12", 0xc00, 0x400, CRC(8006a1e3) SHA1(b67612d98231485fce55d604915abd19b6d64eac) ) -ROM_END - -ROM_START( mpt02h ) - ROM_REGION( 0x1000, CDP1802_TAG, 0 ) - ROM_LOAD( "86676.ic13", 0x000, 0x400, CRC(a7d0dd3b) SHA1(e1881ab4d67a5d735dd2c8d7e924e41df6f2aeec) ) -ROM_END - -#define rom_mtc9016 rom_mpt02 -#define rom_shmc1200 rom_mpt02 -#define rom_cm1200 rom_mpt02 -#define rom_apollo80 rom_mpt02 - -/* Driver Initialization */ - -DRIVER_INIT_MEMBER(studio2_state,studio2) -{ - m_beeper->set_state(0); - m_beeper->set_frequency(300); -} - -/* Game Drivers */ - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -CONS( 1977, studio2, 0, 0, studio2, studio2, studio2_state, studio2, "RCA", "Studio II", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -CONS( 1978, visicom, studio2,0, visicom, studio2, studio2_state, studio2, "Toshiba", "Visicom COM-100 (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -CONS( 1978, mpt02, studio2,0, mpt02, studio2, studio2_state, studio2, "Soundic", "Victory MPT-02 Home TV Programmer (Austria)", MACHINE_SUPPORTS_SAVE ) -CONS( 1978, mpt02h, studio2,0, mpt02, studio2, studio2_state, studio2, "Hanimex", "MPT-02 Jeu TV Programmable (France)", MACHINE_SUPPORTS_SAVE ) -CONS( 1978, mtc9016, studio2,0, mpt02, studio2, studio2_state, studio2, "Mustang", "9016 Telespiel Computer (Germany)", MACHINE_SUPPORTS_SAVE ) -CONS( 1978, shmc1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Sheen", "M1200 Micro Computer (Australia)", MACHINE_SUPPORTS_SAVE ) -CONS( 1978, cm1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Conic", "M-1200 (?)", MACHINE_SUPPORTS_SAVE ) -CONS( 1978, apollo80, studio2,0, mpt02, studio2, studio2_state, studio2, "Academy", "Apollo 80 (Germany)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/sun1.c b/src/mess/drivers/sun1.c deleted file mode 100644 index df26989dbaa..00000000000 --- a/src/mess/drivers/sun1.c +++ /dev/null @@ -1,170 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Sun-1 Models - ------------ - - Sun-1 - - Processor(s): 68000 - Notes: Large black desktop boxes with 17" monitors. - Uses the original Stanford-designed video board - and a parallel microswitch keyboard (type 1) and - parallel mouse (Sun-1). - - 100 - Processor(s): 68000 @ 10MHz - Bus: Multibus, serial - Notes: Uses a design similar to original SUN (Stanford - University Network) CPU. The version 1.5 CPU can - take larger RAMs. - - 100U - Processor(s): 68010 @ 10MHz - CPU: 501-1007 - Bus: Multibus, serial - Notes: "Brain transplant" for 100 series. Replaced CPU - and memory boards with first-generation Sun-2 - CPU and memory boards so original customers - could run SunOS 1.x. Still has parallel kb/mouse - interface so type 1 keyboards and Sun-1 mice - could be connected. - - 170 - Processor(s): 68010? - Bus: Multibus? - Chassis type: rackmount - Notes: Server. Slightly different chassis design than - 2/170's - - - Documentation: - http://www.bitsavers.org/pdf/sun/sun1/800-0345_Sun-1_System_Ref_Man_Jul82.pdf - (page 39,40 of pdf contain memory map) - - 04/12/2009 Skeleton driver. - - 04/04/2011 Modernised, added terminal keyboard. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/z80dart.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class sun1_state : public driver_device -{ -public: - sun1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_p_ram(*this, "p_ram") - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ16_MEMBER(sun1_upd7201_r); - DECLARE_WRITE16_MEMBER(sun1_upd7201_w); - DECLARE_WRITE8_MEMBER(kbd_put); - virtual void machine_reset(); - required_shared_ptr m_p_ram; - UINT8 m_term_data; -}; - - - -// Just hack to show output since upd7201 is not implemented yet - -READ16_MEMBER( sun1_state::sun1_upd7201_r ) -{ - UINT16 ret; - if (offset == 0) - { - ret = m_term_data << 8; - m_term_data = 0; - } - else - ret = 0xfeff | (m_term_data ? 0x100 : 0); - - return ret; -} - -WRITE16_MEMBER( sun1_state::sun1_upd7201_w ) -{ - if (offset == 0) - m_terminal->write(space, 0, data >> 8); -} - -static ADDRESS_MAP_START(sun1_mem, AS_PROGRAM, 16, sun1_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("p_ram") // 512 KB RAM / ROM at boot - AM_RANGE(0x00200000, 0x00203fff) AM_ROM AM_REGION("user1",0) - AM_RANGE(0x00600000, 0x00600007) AM_READWRITE( sun1_upd7201_r, sun1_upd7201_w ) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sun1 ) -INPUT_PORTS_END - - -void sun1_state::machine_reset() -{ - UINT8* user1 = memregion("user1")->base(); - - memcpy((UINT8*)m_p_ram.target(),user1,0x4000); - - m_maincpu->reset(); - m_term_data = 0; -} - - -WRITE8_MEMBER( sun1_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( sun1, sun1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(sun1_mem) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(sun1_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sun1 ) - ROM_REGION( 0x4000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "v10.8.bin", 0x0001, 0x2000, CRC(3528a0f8) SHA1(be437dd93d1a44eccffa6f5e05935119482beab0)) - ROM_LOAD16_BYTE( "v10.0.bin", 0x0000, 0x2000, CRC(1ad4c52a) SHA1(4bc1a19e8f202378d5d7baa8b95319275c040a6d)) - - ROM_REGION( 0x4000, "diag", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "8mhzdiag.8.bin", 0x0001, 0x2000, CRC(808a549e) SHA1(d2aba014a5507c1538f2c1a73e1d2524f28034f4)) - ROM_LOAD16_BYTE( "8mhzdiag.0.bin", 0x0000, 0x2000, CRC(7a92d506) SHA1(5df3800f7083293fc01bb6a7e7538ad425bbebfb)) - - ROM_REGION( 0x10000, "gfx", ROMREGION_ERASEFF ) - ROM_LOAD( "gfxu605.g4.bin", 0x0000, 0x0200, CRC(274b7b3d) SHA1(40d8be2cfcbd03512a05925991bb5030d5d4b5e9)) - ROM_LOAD( "gfxu308.g21.bin", 0x0200, 0x0200, CRC(35a6eed8) SHA1(25cb2dd8e5343cd7927c3045eb4cb96dc9935a37)) - ROM_LOAD( "gfxu108.g20.bin", 0x0400, 0x0200, CRC(ecee335e) SHA1(5f4d32dc918af15872cd6e700a04720caeb6c657)) - ROM_LOAD( "gfxu105.g0.bin", 0x0600, 0x0200, CRC(8e1a24b3) SHA1(dad2821c3a3137ad69e78b6fc29ab582e5d78646)) - ROM_LOAD( "gfxu104.g1.bin", 0x0800, 0x0200, CRC(86f7a483) SHA1(8eb3778f5497741cd4345e81ff1a903c9a63c8bb)) - ROM_LOAD( "gfxu307.g61.bin", 0x0a00, 0x0020, CRC(b190f25d) SHA1(80fbdc843f1eb68a2d3713499f04d99dab88ce83)) - ROM_LOAD( "gfxu107.g60.bin", 0x0a20, 0x0020, CRC(425d3a98) SHA1(9ae4ce3761c2f995d00bed8d752c55224d274062)) - - ROM_REGION( 0x10000, "cpu", ROMREGION_ERASEFF ) - ROM_LOAD( "cpuu503.p2.bin", 0x0000, 0x0200, CRC(12d9a6be) SHA1(fca99f9c5afc630ac67cbd4e5ba4e5242b826848)) - ROM_LOAD( "cpuu602.p1.bin", 0x0200, 0x0020, CRC(ee1e5a14) SHA1(0d3346cb3b647fa2475bd7b4fa36ea6ecfdaf805)) - ROM_LOAD( "cpuu502.p0.bin", 0x0220, 0x0020, CRC(20eb1183) SHA1(9b268792b28d858d6b6a1b6c4148af88a8d6b735)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, sun1, 0, 0, sun1, sun1, driver_device, 0, "Sun Microsystems", "Sun-1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/sun2.c b/src/mess/drivers/sun2.c deleted file mode 100644 index ec1ddabc5d6..00000000000 --- a/src/mess/drivers/sun2.c +++ /dev/null @@ -1,136 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Sun-2 Models - ------------ - - 2/120 - Processor(s): 68010 @ 10MHz - CPU: 501-1007/1051 - Chassis type: deskside - Bus: Multibus (9 slots) - Memory: 7M physical - Notes: First machines in deskside chassis. Serial - microswitch keyboard (type 2), Mouse Systems - optical mouse (Sun-2). - - 2/100U - Processor(s): 68010 @ 10MHz - CPU: 501-1007 - Bus: Multibus - Notes: Upgraded Sun 100. Replaced CPU and memory boards - with first-generation Sun-2 CPU and memory - boards so original customers could run SunOS - 1.x. Still has parallel kb/mouse interface so - type 1 keyboards and Sun-1 mice could be - connected. - - 2/150U - Notes: Apparently also an upgraded Sun-1. - - 2/170 - Chassis type: rackmount - Bus: Multibus (15 slots) - Notes: Rackmount version of 2/120, with more slots. - - 2/50 - Processor(s): 68010 @ 10MHz - CPU: 501-1141/1142/1143/1426/1427/1428 - Chassis type: wide pizza box - Bus: VME (2 slots) - Memory: 7M physical - Notes: The (type 2) keyboard and mouse attach via an - adapter that accepts two modular plugs and - attaches to a DB15 port; later on, units were - apparently shipped with type 3 keyboards. The - CPU boards have a double-width back panel but - are otherwise identical to those in the 2/130 - and 2/160. - - 2/130 - 2/160 - Processor(s): 68010 @ 10MHz - CPU: 501-1144/1145/1146/1429/1430/1431 - Chassis type: deskside - Bus: VME (12 slots) - Memory: 7M physical - Notes: First machine in 12-slot deskside VME chassis. - Has four-fan cooling tray instead of six as in - later machines, which led to cooling problems - with lots of cards. Backplane has only four P2 - memory connectors bussed instead of six as in - later 12-slot backplanes; SCSI passthrough is in - slot 6 instead of 7 as in later 12-slot - backplanes. Upgradeable to a 3/160 by replacing - the CPU board. No information on the differences - between the 2/130 and the 2/160. - - - 25/08/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" - - -class sun2_state : public driver_device -{ -public: - sun2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - , - m_p_ram(*this, "p_ram"){ } - - required_device m_maincpu; - virtual void machine_reset(); - - required_shared_ptr m_p_ram; -}; - -static ADDRESS_MAP_START(sun2_mem, AS_PROGRAM, 16, sun2_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("p_ram") // 8MB - AM_RANGE(0x00ef0000, 0x00ef7fff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sun2 ) -INPUT_PORTS_END - - -void sun2_state::machine_reset() -{ - UINT8* user1 = memregion("user1")->base(); - - memcpy((UINT8*)m_p_ram.target(),user1,0x8000); - - m_maincpu->reset(); -} - - -static MACHINE_CONFIG_START( sun2, sun2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68010, 16670000) - MCFG_CPU_PROGRAM_MAP(sun2_mem) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sun2_120 ) - ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_WORD_SWAP( "sun2-multi-rev-r.bin", 0x0000, 0x8000, CRC(4df0df77) SHA1(4d6bcf09ddc9cc8f5823847b8ea88f98fe4a642e)) -ROM_END - -ROM_START( sun2_50) - ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "250_q_8.rom", 0x0001, 0x4000, CRC(5bfacb5c) SHA1(ec7fb3fb0217b0138ba4748b7c79b8ff0cad896b)) - ROM_LOAD16_BYTE( "250_q_0.rom", 0x0000, 0x4000, CRC(2ee29abe) SHA1(82f52b9f25e92387329581f7c8ba50a171784968)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, sun2_50, 0, 0, sun2, sun2, driver_device, 0, "Sun Microsystems", "Sun 2/50", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1984, sun2_120, 0, 0, sun2, sun2, driver_device, 0, "Sun Microsystems", "Sun 2/120", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/sun3.c b/src/mess/drivers/sun3.c deleted file mode 100644 index 88cb36d8bbf..00000000000 --- a/src/mess/drivers/sun3.c +++ /dev/null @@ -1,977 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, R. Belmont -/*************************************************************************** - - sun3.c: preliminary driver for Sun 3 and Sun 3x models. - - status: 3/80 POSTs, 3/460 needs its unique RTC chip (also used by non-3x Sun 3s). - - TODO: - - Z8530 SCC needs to actually speak serial so we can hook up the mouse and keyboard. - - Improve interrupt controller emulation. - - Figure out how the IOMMU works. - - Intersil 7170 device for 3/460 and 3/480 (they use the same PROMs). - - Sun custom MMU for original Sun 3 models. - - AM7990 LANCE chip support for everyone. - - Figure out how the parallel printer port maps to Centronics and make it so. - - Much more... - - - Sun-3 Models - ------------ - - 3/160 - Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware - contexts, 2 MIPS - CPU: 501-1074/1096/1163/1164/1208 - Chassis type: deskside - Bus: VME, 12 slots - Memory: 16M physical (documented), 256M virtual, 270ns cycle - Notes: First 68020-based Sun machine. Uses the 3004 - "Carrera" CPU, which is used in most other Sun - 3/1xx models and the 3/75. Sun supplied 4M - memory expansion boards; third parties had up to - 32M on one card. SCSI optional. One variant of - the memory card holds a 6U VME SCSI board; there - is also a SCSI board which sits in slot 7 of the - backplane and runs the SCSI bus out the back of - the backplane to the internal disk/tape (slot 6 - in very early backplanes). CPU has two serial - ports, Ethernet, keyboard. Type 3 keyboard plugs - into the CPU; Sun-3 mouse plugs into the - keyboard. Upgradeable to a 3/260 by replacing - CPU and memory boards. - - 3/75 - Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware - contexts, 2 MIPS - CPU: 501-1074/1094/1163/1164 - Chassis type: wide pizza box - Bus: VME, 2 slot - Memory: 16M physical (documented), 256M virtual, 270ns cycle - Notes: Optional SCSI sits on memory expansion board in - second slot. - - 3/140 - Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware - contexts, 2 MIPS - CPU: 501-1074/1094/1163/1164/1208 - Chassis type: deskside - Bus: VME, 3 slots - Memory: 16M physical (documented), 256M virtual, 270ns cycle - - 3/150 - Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware - contexts, 2 MIPS - CPU: 501-1074/1094/1163/1164/1208 - Chassis type: deskside - Bus: VME, 6 slots - Memory: 16M physical (documented), 256M virtual, 270ns cycle - - 3/180 - Processor(s): 68020 @ 16.67MHz, 68881, Sun-3 MMU, 8 hardware - contexts, 2 MIPS - CPU: 501-1074/1094/1163/1164/1208 - Chassis type: rackmount - Bus: VME, 12 slots - Memory: 16M physical (documented), 256M virtual, 270ns cycle - Notes: Rackmount version of 3/160. Upgradeable to a - 3/280 by replacing the CPU and memory boards. - Very early backplanes have the special SCSI - hookup on slot 6 rather than 7. - - 3/110 - Processor(s): 68020 - CPU: 501-1134/1209 - Chassis type: deskside - Bus: VME, 3 slots - Notes: Similar to the "Carerra" CPU, but has 8-bit - color framebuffer (cgfour) on board and uses 1M - RAM chips for 4M on-CPU memory. Code-named - "Prism". - - 3/50 - Processor(s): 68020 @ 15.7MHz, 68881 (socket for - 501-1075/1133/1162, installed for 501-1207), - Sun-3 MMU, 8 hardware contexts, 1.5 MIPS - CPU: 501-1075/1133/1162/1207 - Chassis type: wide pizza box - Bus: none - Memory: 4M physical (documented), 256M virtual, 270ns cycle - Notes: Cycle-stealing monochrome frame buffer. 4M - memory maximum stock, but third-party memory - expansion boards were sold, allowing up to at - least 12M. No bus or P4 connector. Onboard SCSI. - Thin coax or AUI Ethernet. Code-named "Model - 25". - - 3/60 - Processor(s): 68020 @ 20MHz, 68881 (stock), Sun-3 MMU, - 8 hardware contexts, 3 MIPS - CPU: 501-1205/1322/1334/1345 - Chassis type: wide pizza box - Bus: P4 connector (not same as P4 on 3/80) - Memory: 24M physical, 256M virtual, 200ns cycle - Notes: VRAM monochome frame buffer for 501-1205/1334. - Optional color frame buffer (can run mono and - color simultaneously) on P4 connector. Onboard - SCSI. SIMM memory (100ns 1M x 9 SIMMs). High - (1600 * 1100) or low (1152 * 900) resolution - mono selectable by jumper. Thin coax or AUI - Ethernet. Code-named "Ferrari". 4M stock on - 501-1205/1322, 0M stock on 501-1322/1345. - - 3/60LE - Processor(s): 68020 @ 20MHz, 68881 (stock), Sun-3 MMU, - 8 hardware contexts, 3 MIPS - CPU: 501-1378 - Bus: P4 connector (not same as P4 on 3/80) - Memory: 12M physical, 256M virtual, 200ns cycle - Notes: A version of the 3/60 with no onboard - framebuffer and limited to 12M of RAM (4M of - 256K SIMMs and 8M of 1M SIMMs). - - 3/260 - Processor(s): 68020 @ 25MHz, 68881 @ 20MHz (stock), Sun-3 MMU, - 8 hardware contexts, 4 MIPS - CPU: 501-1100/1206 - Chassis type: deskside - Bus: VME, 12 slot - Memory: 64M (documented) physical with ECC, 256M virtual; - 64K write-back cache, direct-mapped, - virtually-indexed and virtually-tagged, with - 16-byte lines; 80ns cycle - Notes: Two serial ports, AUI Ethernet, keyboard, and - video on CPU. Video is mono, high-resolution - only. Sun supplied 8M memory boards. Sun 4/2xx - 32M boards work up to 128M. First Sun with an - off-chip cache. Upgradeable to a 4/260 by - replacing the CPU board. Code-named "Sirius". - - 3/280 - Processor(s): 68020 @ 25MHz, 68881 @ 20MHz (stock), Sun-3 MMU, - 8 hardware contexts, 4 MIPS - CPU: 501-1100/1206 - Chassis type: rackmount - Bus: VME, 12 slot - Memory: 64M (documented) physical with ECC, 256M virtual; - 64K write-back cache, direct-mapped, - virtually-indexed and virtually-tagged, with - 16-byte lines; 80ns cycle - Notes: Rackmount version of the 3/260. Upgradeable to a - 4/280 by replacing the CPU board. Code-named - "Sirius". - - 3/80 - Processor(s): 68030 @ 20MHz, 68882 @ 20MHz, 68030 on-chip - MMU, 3 MIPS, 0.16 MFLOPS - CPU: 501-1401/1650 - Chassis type: square pizza box - Bus: P4 connector (not same as P4 on 3/60) - Memory: 16M or 40M physical, 4G virtual, 100ns cycle - Notes: Similar packaging to SparcStation 1. Parallel - port, SCSI port, AUI Ethernet, 1.44M 3.5" floppy - (720K on early units?). No onboard framebuffer. - Code-named "Hydra". Type-4 keyboard and Sun-4 - mouse, plugged together and into the machine - with a small DIN plug. 1M x 9 30-pin 100ns - SIMMs. Boot ROM versions 3.0.2 and later allow - using 4M SIMMs in some slots for up to 40M (see - Misc Q&A #15). - - 3/460 - Processor(s): 68030 @ 33 MHz, 68882, 68030 on-chip MMU, - 7 MIPS, 0.6 MFLOPS - CPU: 501-1299/1550 - Bus: VME - Memory: 128M physical with ECC, 4G/process virtual, - 64K cache, 80ns cycle - Notes: A 3/260 upgraded with a 3/4xx CPU board. Uses - original 3/2xx memory boards. - - 3/470 - Processor(s): 68030 @ 33 MHz, 68882, 68030 on-chip MMU, - 7 MIPS, 0.6 MFLOPS - CPU: 501-1299/1550 - Chassis type: deskside - Bus: VME - Memory: 128M physical with ECC, 4G/process virtual, - 64K cache, 80ns cycle - Notes: Rare. Code-named "Pegasus". 8M standard, uses - same memory boards as 3/2xx. - - 3/480 - Processor(s): 68030 @ 33 MHz, 68882, 68030 on-chip MMU, - 7 MIPS, 0.6 MFLOPS - CPU: 501-1299/1550 - Chassis type: rackmount - Bus: VME - Memory: 128M physical with ECC, 4G/process virtual, - 64K cache, 80ns cycle - Notes: Rare. Code-named "Pegasus". 8M standard, uses - same memory boards as 3/2xx. - - 3/E - Processor(s): 68020 - CPU: 501-8028 - Bus: VME - Notes: Single-board VME Sun-3, presumably for use as a - controller, not as a workstation. 6U form - factor. Serial and keyboard ports. External RAM, - framebuffer, and SCSI/ethernet boards - available. - - Sun3X notes from NetBSD and Linux: - - RAM_END 0x40000000 - P4DAC 0x50200000 - VIDEO_P4ID 0x50300000 - BW2_ADDR 0x50400000 - ENA_PLANE 0x50600000 - FPA_ADDR 0x5c000000 - IOMMU 0x60000000 - ENABLEREG 0x61000000 - BUSERRREG 0x61000400 - DIAGREG 0x61000800 - IDPROM1 0x61000c00 (3/470) - MEMREG 0x61001000 - INTERREG 0x61001400 - SCC1 0x62000000 (keyboard/mouse) - SCC2 0x62002000 (serial console) - EEPROM 0x64000000 - IDPROM2 0x640007d8 (3/80) - CLOCK2 0x640007f8 (3/80 Mostek 48T02) - CLOCK1 0x64002000 (3/470 Intersil 7170) - INTELETH 0x65000000 - LANCEETH 0x65002000 - EMULEXSCSI 0x66000000 (3/80 5394) - EMULLEXDMA 0x66001000 (3/80) - PCACHETAG 0x68000000 - ECCPARREG 0x6a1e0000 - IOCTAGS 0x6c000000 - IOCFLUSH 0x6d000000 - FDC 0x6e000000 (3/80 Intel 82077) - FDC_CNTRL 0x6e000400 - FDC_VEC 0x6e000800 - PRINTER 0x6f00003c (3/80) - - The Sun3x System Enable Register controls the function of a few - on-board devices and general system operation. It is cleared when - the system is reset. - - 15 0 - +---+---+---+---+---+---+---+---+---+---+---+---+---+---.---.---+ - |BT |FPP|DMA| 0 |VID|RES|FPA|DIA| 0 |CCH|IOC|LBK|DCH| UNUSED | - +---+---+---+---+---+---+---+---+---+---+---+---+---+---.---.---+ - - Where: DCH = debug mode for system cache - LBK = VME loopback - IOC = I/O cache enable - CCH = system cache enable - DIA = diagnostic switch - FPA = enable floating-point accelerator - RES = 0 for hi-res, 1 for low res - VID = enable video display - DMA = enable system DVMA - FPP = enable 68881/2 FPU - BT = 0 for boot state, 1 for normal state - - bad '030 MMU mapping: L fef82000 -> P 00000000 - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/timekpr.h" -#include "machine/8530scc.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsihd.h" -#include "bus/scsi/scsicd.h" -#include "machine/ncr539x.h" -#include "machine/upd765.h" -#include "formats/pc_dsk.h" -#include "formats/mfi_dsk.h" - -#define TIMEKEEPER_TAG "timekpr" -#define SCC1_TAG "scc1" -#define SCC2_TAG "scc2" -#define ESP_TAG "esp" -#define FDC_TAG "fdc" - -class sun3_state : public driver_device -{ -public: - sun3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_scc1(*this, SCC1_TAG), - m_scc2(*this, SCC2_TAG), - m_fdc(*this, FDC_TAG), - m_p_ram(*this, "p_ram"), - m_bw2_vram(*this, "bw2_vram") - { } - - required_device m_maincpu; - required_device m_scc1; - required_device m_scc2; - optional_device m_fdc; - virtual void machine_reset(); - - required_shared_ptr m_p_ram; - optional_shared_ptr m_bw2_vram; - - DECLARE_READ32_MEMBER(enable_r); - DECLARE_WRITE32_MEMBER(enable_w); - DECLARE_READ32_MEMBER(buserr_r); - DECLARE_WRITE32_MEMBER(buserr_w); - DECLARE_READ32_MEMBER(diag_r); - DECLARE_WRITE32_MEMBER(diag_w); - DECLARE_READ32_MEMBER(printer_r); - DECLARE_WRITE32_MEMBER(printer_w); - DECLARE_READ32_MEMBER(iommu_r); - DECLARE_WRITE32_MEMBER(iommu_w); - DECLARE_READ32_MEMBER(irqctrl_r); - DECLARE_WRITE32_MEMBER(irqctrl_w); - DECLARE_READ32_MEMBER(memreg_r); - DECLARE_WRITE32_MEMBER(memreg_w); - DECLARE_READ32_MEMBER(memrerraddr_r); - DECLARE_WRITE32_MEMBER(memrerraddr_w); - DECLARE_READ32_MEMBER(fdc_control_r); - DECLARE_WRITE32_MEMBER(fdc_control_w); - DECLARE_READ32_MEMBER(cause_buserr_r); - DECLARE_WRITE32_MEMBER(cause_buserr_w); - DECLARE_WRITE32_MEMBER(ramwrite_w); - DECLARE_READ32_MEMBER(fpa_r); - DECLARE_READ32_MEMBER(p4id_r); - - DECLARE_READ8_MEMBER(scc1_r); - DECLARE_WRITE8_MEMBER(scc1_w); - DECLARE_READ8_MEMBER(scc2_r); - DECLARE_WRITE8_MEMBER(scc2_w); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - TIMER_DEVICE_CALLBACK_MEMBER(sun380_timer); - - UINT32 bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -private: - UINT32 m_enable, m_buserr, m_diag, m_printer, m_irqctrl, m_memreg, m_memerraddr; - UINT32 m_iommu[0x800]; - bool m_bInBusErr; -}; - -static ADDRESS_MAP_START(sun3_mem, AS_PROGRAM, 32, sun3_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x00ffffff) AM_RAM AM_SHARE("p_ram") // 16MB - AM_RANGE(0x0fef0000, 0x0fefffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sun3_80_mem, AS_PROGRAM, 32, sun3_state) - AM_RANGE(0x00000000, 0x03ffffff) AM_RAM AM_SHARE("p_ram") AM_WRITE(ramwrite_w) - AM_RANGE(0x40000000, 0x40000003) AM_READWRITE(cause_buserr_r, cause_buserr_w) - AM_RANGE(0x50300000, 0x50300003) AM_READ(p4id_r) - AM_RANGE(0x50400000, 0x504fffff) AM_RAM AM_SHARE("bw2_vram") - AM_RANGE(0x60000000, 0x60001fff) AM_READWRITE(iommu_r, iommu_w) - AM_RANGE(0x61000000, 0x61000003) AM_READWRITE(enable_r, enable_w) - AM_RANGE(0x61000400, 0x61000403) AM_READWRITE(buserr_r, buserr_w) - AM_RANGE(0x61000800, 0x61000803) AM_READWRITE(diag_r, diag_w) - AM_RANGE(0x61001000, 0x61001003) AM_READWRITE(memreg_r, memreg_w) - AM_RANGE(0x61001004, 0x61001007) AM_READWRITE(memrerraddr_r, memrerraddr_w) - AM_RANGE(0x61001400, 0x61001403) AM_READWRITE(irqctrl_r, irqctrl_w) - AM_RANGE(0x62000000, 0x6200000f) AM_READWRITE8(scc1_r, scc1_w, 0xff00ff00) - AM_RANGE(0x62002000, 0x6200200f) AM_READWRITE8(scc2_r, scc2_w, 0xff00ff00) - AM_RANGE(0x63000000, 0x6301ffff) AM_ROM AM_REGION("user1",0) - AM_RANGE(0x64000000, 0x640007ff) AM_DEVREADWRITE8(TIMEKEEPER_TAG, timekeeper_device, read, write, 0xffffffff) - AM_RANGE(0x66000000, 0x6600003f) AM_DEVREADWRITE8(ESP_TAG, ncr539x_device, read, write, 0xff000000) - AM_RANGE(0x6e000000, 0x6e000007) AM_DEVICE8(FDC_TAG, n82077aa_device, map, 0xffffffff) - AM_RANGE(0x6e000400, 0x6e000403) AM_READWRITE(fdc_control_r, fdc_control_w) - AM_RANGE(0x6f00003c, 0x6f00003f) AM_READWRITE(printer_r, printer_w) - AM_RANGE(0xfefe0000, 0xfefeffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sun3_460_mem, AS_PROGRAM, 32, sun3_state) - AM_RANGE(0x00000000, 0x03ffffff) AM_RAM AM_SHARE("p_ram") AM_WRITE(ramwrite_w) - AM_RANGE(0x09000000, 0x09000003) AM_READWRITE(cause_buserr_r, cause_buserr_w) - AM_RANGE(0x50300000, 0x50300003) AM_READ(p4id_r) - AM_RANGE(0x50400000, 0x504fffff) AM_RAM AM_SHARE("bw2_vram") - AM_RANGE(0x5c000f14, 0x5c000f17) AM_READ(fpa_r) - AM_RANGE(0x60000000, 0x60001fff) AM_READWRITE(iommu_r, iommu_w) - AM_RANGE(0x61000000, 0x61000003) AM_READWRITE(enable_r, enable_w) - AM_RANGE(0x61000400, 0x61000403) AM_READWRITE(buserr_r, buserr_w) - AM_RANGE(0x61000800, 0x61000803) AM_READWRITE(diag_r, diag_w) - AM_RANGE(0x61001000, 0x61001003) AM_READWRITE(memreg_r, memreg_w) - AM_RANGE(0x61001004, 0x61001007) AM_READWRITE(memrerraddr_r, memrerraddr_w) - AM_RANGE(0x61001400, 0x61001403) AM_READWRITE(irqctrl_r, irqctrl_w) - AM_RANGE(0x62000000, 0x6200000f) AM_READWRITE8(scc1_r, scc1_w, 0xff00ff00) - AM_RANGE(0x62002000, 0x6200200f) AM_READWRITE8(scc2_r, scc2_w, 0xff00ff00) - AM_RANGE(0x63000000, 0x6301ffff) AM_ROM AM_REGION("user1",0) - - AM_RANGE(0x6f00003c, 0x6f00003f) AM_READWRITE(printer_r, printer_w) - AM_RANGE(0xfefe0000, 0xfefeffff) AM_ROM AM_REGION("user1",0) -ADDRESS_MAP_END - -READ32_MEMBER( sun3_state::p4id_r ) -{ - return (1<<24); // 0 = hires bw2 1600x1280, 1 = bw2 1152x900, 0x45 is "Ibis" color, blt 0x68 is "Lego" color -} - -WRITE32_MEMBER( sun3_state::fdc_control_w ) -{ - logerror("FDC write %02x (%08x)\n", data >> 24, space.device().safe_pc()); -} - -READ32_MEMBER( sun3_state::fdc_control_r ) -{ - // Type of floppy present - // 0 = no floppy in drive - // 1 = ed - // 2 = hd - // 3 = dd - - if(m_fdc) { - floppy_image_device *fdev = machine().device(":fdc:0")->get_device(); - if(fdev->exists()) { - UINT32 variant = fdev->get_variant(); - switch(variant) { - case floppy_image::SSSD: - case floppy_image::SSDD: - case floppy_image::DSDD: - return 3 << 24; - - case floppy_image::DSHD: - return 2 << 24; - - case floppy_image::DSED: - return 1 << 24; - } - } - } - - return 0 << 24; -} - -WRITE32_MEMBER(sun3_state::ramwrite_w) -{ - UINT32 *pRAM = (UINT32 *)m_p_ram.target(); - - if (((m_memreg & 0xf0000000) == 0x70000000) && - (m_irqctrl & 0x01000000) && - !(m_bInBusErr)) - { - m_memerraddr = offset<<2; - - // low 4 bits of memreg are the byte lane(s) involved, negative logic - m_memreg |= 0x0f; - switch (mem_mask) - { - case 0xff000000: - m_memreg &= ~0x08; - break; - - case 0x00ff0000: - m_memerraddr += 1; - m_memreg &= ~0x04; - break; - - case 0x0000ff00: - m_memerraddr += 2; - m_memreg &= ~0x02; - break; - - case 0x000000ff: - m_memerraddr += 3; - m_memreg &= ~0x01; - break; - - case 0x0000ffff: - m_memerraddr += 2; - m_memreg &= ~0x03; - break; - - case 0xffff0000: - m_memreg &= ~0x0c; - break; - - case 0xffffffff: // no address adjust, show all 4 lanes as problematic - break; - } - - m_bInBusErr = true; // prevent recursion - m_maincpu->set_input_line_and_vector(M68K_IRQ_7, ASSERT_LINE, 2); - } - - COMBINE_DATA(&pRAM[offset]); -} - -// sun3: 0 = B control, 1 = B data, 2 = A control, 3 = A data -// 8530scc: 0 = B control, 1 = A control, 2 = B data, 3 = A data -READ8_MEMBER(sun3_state::scc1_r) -{ - int regsel = ((offset & 1)<<1) | ((offset & 2) >> 1); - return m_scc1->reg_r(space, regsel); -} - -WRITE8_MEMBER(sun3_state::scc1_w) -{ - int regsel = ((offset & 1)<<1) | ((offset & 2) >> 1); - m_scc1->reg_w(space, regsel, data); -} - -READ8_MEMBER(sun3_state::scc2_r) -{ - int regsel = ((offset & 1)<<1) | ((offset & 2) >> 1); - return m_scc2->reg_r(space, regsel); -} - -WRITE8_MEMBER(sun3_state::scc2_w) -{ - int regsel = ((offset & 1)<<1) | ((offset & 2) >> 1); - m_scc2->reg_w(space, regsel, data); -} - -READ32_MEMBER(sun3_state::enable_r) -{ - return m_enable; -} - -WRITE32_MEMBER(sun3_state::enable_w) -{ -// printf("sun3x: %08x to enable (mask %08x)\n", data, mem_mask); - COMBINE_DATA(&m_enable); -} - -READ32_MEMBER(sun3_state::buserr_r) -{ - UINT32 rv = m_buserr; - m_buserr = 0; - return rv; -} - -WRITE32_MEMBER(sun3_state::buserr_w) -{ -// printf("sun3x: %08x to buserr (mask %08x)\n", data, mem_mask); - COMBINE_DATA(&m_buserr); -} - -READ32_MEMBER(sun3_state::diag_r) -{ - return m_diag; -} - -WRITE32_MEMBER(sun3_state::diag_w) -{ -// printf("sun3x: %08x to diag (mask %08x)\n", data, mem_mask); - COMBINE_DATA(&m_diag); -} - -READ32_MEMBER(sun3_state::printer_r) -{ - return m_printer; -} - -WRITE32_MEMBER(sun3_state::printer_w) -{ -// printf("sun3x: %08x to printer (mask %08x)\n", data, mem_mask); - COMBINE_DATA(&m_printer); -} - -READ32_MEMBER(sun3_state::irqctrl_r) -{ - return m_irqctrl; -} - -WRITE32_MEMBER(sun3_state::irqctrl_w) -{ -// printf("sun3x: %08x to interrupt control (mask %08x)\n", data, mem_mask); - COMBINE_DATA(&m_irqctrl); - - if (data & 0x01000000) - { - if (data & 0x02000000) - { - m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); - } - if (data & 0x04000000) - { - m_maincpu->set_input_line(M68K_IRQ_2, ASSERT_LINE); - } - if (data & 0x08000000) - { - m_maincpu->set_input_line(M68K_IRQ_3, ASSERT_LINE); - } - if (!(data & 0x80000000)) - { - m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); - } - } - else // master enable clear, clear all interrupts - { - m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_5, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_6, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); - } -} - -READ32_MEMBER(sun3_state::memreg_r) -{ - return m_memreg; -} - -WRITE32_MEMBER(sun3_state::memreg_w) -{ -// printf("sun3x: %08x to memory control (mask %08x)\n", data, mem_mask); - COMBINE_DATA(&m_memreg); -} - -READ32_MEMBER(sun3_state::memrerraddr_r) -{ - m_bInBusErr = false; - m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); - return m_memerraddr; -} - -WRITE32_MEMBER(sun3_state::memrerraddr_w) -{ -// printf("sun3x: %08x to memory error address (mask %08x)\n", data, mem_mask); - COMBINE_DATA(&m_memerraddr); -} - -READ32_MEMBER(sun3_state::iommu_r) -{ - return m_iommu[offset]; -} - -// IOMMU entry defs: -// address mask: 0x03ffe000 -// cache inhibit: 0x00000040 -// full block: 0x00000020 -// modified: 0x00000010 -// used: 0x00000008 -// write prot: 0x00000004 -// bad: 0x00000002 -// valid: 0x00000001 -WRITE32_MEMBER(sun3_state::iommu_w) -{ - COMBINE_DATA(&m_iommu[offset]); -} - -READ32_MEMBER(sun3_state::fpa_r) -{ - m_buserr |= 0x04000000; - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - return 0xffffffff; -} - -READ32_MEMBER(sun3_state::cause_buserr_r) -{ - m_buserr |= 0x20000000; - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - return 0xffffffff; -} - -WRITE32_MEMBER(sun3_state::cause_buserr_w) -{ - m_buserr |= 0x20000000; - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(sun3_state::sun380_timer) -{ - if ((m_irqctrl & 0x81000000) == 0x81000000) - { - m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); - m_maincpu->set_input_line(M68K_IRQ_7, ASSERT_LINE); - } -} - -UINT32 sun3_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 *scanline; - int x, y; - UINT8 pixels; - static const UINT32 palette[2] = { 0, 0xffffff }; - UINT8 *m_vram = (UINT8 *)m_bw2_vram.target(); - - for (y = 0; y < 900; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) - { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; - } - } - - return 0; -} - -/* Input ports */ -static INPUT_PORTS_START( sun3 ) -INPUT_PORTS_END - - -void sun3_state::machine_reset() -{ - UINT8* user1 = memregion("user1")->base(); - - memcpy((UINT8*)m_p_ram.target(),user1,0x10000); - - m_maincpu->reset(); - - memset(m_iommu, 0, sizeof(m_iommu)); - - m_enable = 0; - m_buserr = 0; - m_diag = 0; - m_printer = 0; - m_irqctrl = 0; - m_memreg = 0; - m_memerraddr = 0; - m_bInBusErr = false; -} - -FLOPPY_FORMATS_MEMBER( sun3_state::floppy_formats ) - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( sun_floppies ) - SLOT_INTERFACE( "35hd", FLOPPY_35_HD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( sun3, sun3_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68020, 16670000) - MCFG_CPU_PROGRAM_MAP(sun3_mem) - - MCFG_DEVICE_ADD(SCC1_TAG, SCC8530, XTAL_4_9152MHz) - MCFG_DEVICE_ADD(SCC2_TAG, SCC8530, XTAL_4_9152MHz) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( sun3_80, sun3_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68030, 20000000) - MCFG_CPU_PROGRAM_MAP(sun3_80_mem) - - MCFG_M48T02_ADD(TIMEKEEPER_TAG) - - MCFG_DEVICE_ADD(SCC1_TAG, SCC8530, XTAL_4_9152MHz) - MCFG_DEVICE_ADD(SCC2_TAG, SCC8530, XTAL_4_9152MHz) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_6) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_5) - - MCFG_DEVICE_ADD(ESP_TAG, NCR539X, 20000000/2) - MCFG_LEGACY_SCSI_PORT("scsi") - - MCFG_N82077AA_ADD("fdc", n82077aa_device::MODE_PS2) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", sun_floppies, "35hd", sun3_state::floppy_formats) - - // the timekeeper has no interrupt output, so 3/80 includes a dedicated timer circuit - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer", sun3_state, sun380_timer, attotime::from_hz(100)) - - MCFG_SCREEN_ADD("bwtwo", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(sun3_state, bw2_update) - MCFG_SCREEN_SIZE(1152,900) - MCFG_SCREEN_VISIBLE_AREA(0, 1152-1, 0, 900-1) - MCFG_SCREEN_REFRESH_RATE(72) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( sun3_460, sun3_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68030, 33000000) - MCFG_CPU_PROGRAM_MAP(sun3_460_mem) - - MCFG_M48T02_ADD(TIMEKEEPER_TAG) - - MCFG_DEVICE_ADD(SCC1_TAG, SCC8530, XTAL_4_9152MHz) - MCFG_DEVICE_ADD(SCC2_TAG, SCC8530, XTAL_4_9152MHz) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( sun3_50 ) - ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) -/* -Sun 3/50 V1.2 Bootprom -Sun 3/50 V1.4 Bootprom -Sun 3/50 V1.6 Bootprom -Sun 3/50 V1.8 Bootprom (Req. to load SunOS QIC-24 1/4" tapes) -Sun 3/50 V2.0 Bootprom -Sun 3/50 V2.1 Bootprom -Sun 3/50 V2.3 Bootprom -Sun 3/50 V2.5 Bootprom (Req. to load SunOS QIC-24 1/4" tapes from a Sun-2 Shoebox) -Sun 3/50 V2.6 Bootprom -Sun 3/50 V2.7 Bootprom -Sun 3/50 V2.8 Bootprom -*/ - ROM_SYSTEM_BIOS(0, "rev28", "Rev 2.8") - ROMX_LOAD( "sun3_50_v2.8", 0x0000, 0x10000, CRC(1ca6b0e8) SHA1(5773ac1c46399501d29d1758aa342862b03ec472), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "rev27", "Rev 2.7") - ROMX_LOAD( "sun3_50_v2.7", 0x0000, 0x10000, CRC(7c4a9e20) SHA1(6dcd4883a170538050fd0e1f151fae413ec9ea52), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "rev26", "Rev 2.6") - ROMX_LOAD( "sun3_50_v2.6", 0x0000, 0x10000, CRC(08abbb3b) SHA1(6bfb8d5c97d801cd7bb7d564de0e68a48fb807c4), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "rev23", "Rev 2.3") - ROMX_LOAD( "sun3_50_v2.3", 0x0000, 0x10000, CRC(163500b3) SHA1(437c8d539e12d442ca6877566dbbe165d577fcab), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "rev16", "Rev 1.6") - ROMX_LOAD( "sun3_50_v1.6", 0x0000, 0x10000, CRC(8be20826) SHA1(2a4d73fcb7fe0f0c83eb0f4c91d957b7bf88b7ed), ROM_BIOS(5)) -ROM_END - -ROM_START( sun3_60 ) - ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) -/* -Sun 3/60 V1.0 Bootprom -Sun 3/60 V1.3 Bootprom -Sun 3/60 V1.5 Bootprom -Sun 3/60 V1.6 Bootprom (Req. to load SunOS QIC-24 1/4" tapes -Sun 3/60 V1.9 Bootprom -Sun 3/60 V2.8.3 Bootprom -Sun 3/60 V3.0.1 Bootprom -*/ - ROM_SYSTEM_BIOS(0, "rev301", "Rev 3.0.1") - ROMX_LOAD( "sun_3.60v3.0.1", 0x0000, 0x10000, CRC(e55dc1d8) SHA1(6e48414ce2139282e69f57612b20f7d5c475e74c), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "rev283", "Rev 2.8.3") - ROMX_LOAD( "sun_3.60v2.8.3", 0x0000, 0x10000, CRC(de4ec54d) SHA1(e621a9c1a2a7df4975b12fa3a0d7f106383736ef), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "rev19", "Rev 1.9") - ROMX_LOAD( "sun_3.60v1.9", 0x0000, 0x10000, CRC(32b6d3a9) SHA1(307756ba5698611d51059881057f8086956ce895), ROM_BIOS(3)) -ROM_END - -ROM_START( sun3_110 ) - ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) -/* -Sun 3/110 V1.8 Bootprom -Sun 3/110 V2.1 Bootprom -Sun 3/110 V2.3 Bootprom -Sun 3/110 V2.6 Bootprom -Sun 3/110 V2.7 Bootprom -Sun 3/110 V2.8 Bootprom -Sun 3/110 V3.0 Bootprom -*/ - ROM_SYSTEM_BIOS(0, "rev30", "Rev 3.0") - ROMX_LOAD( "sun3_110_v3.0", 0x0000, 0x10000, CRC(a193b26b) SHA1(0f54212ee3a5709f70e921069cca1ddb8c143b1b), ROM_BIOS(1)) -ROM_END - -ROM_START( sun3_150 ) - ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) -/* -Sun 3/1[4,5,6,8]0 V1.3 Bootprom -Sun 3/1[4,5,6,8]0 V1.4 Bootprom -Sun 3/1[4,5,6,8]0 V1.5 Bootprom -Sun 3/1[4,5,6,8]0 V1.8 Bootprom (Req. to load SunOS QIC-24 1/4" tapes) -Sun 3/1[4,5,6,8]0 V2.1 Bootprom -Sun 3/1[4,5,6,8]0 V2.1 Bootprom with Capricot Rimfire 3200/3400 support (b rf(0,0,0) works) -Sun 3/1[4,5,6,8]0 V2.3 Bootprom -Sun 3/1[4,5,6,8]0 V2.6 Bootprom (Req. to load SunOS QIC-24 1/4" tapes from a Sun-2 Shoebox and for Xylogics 7053) -Sun 3/1[4,5,6,8]0 V2.7 Bootprom -Sun 3/1[4,5,6,8]0 V2.8 Bootprom -Sun 3/1[4,5,6,8]0 V2.8.4 Bootprom -Sun 3/1[4,5,6,8]0 V3.0 Bootprom -*/ - ROM_SYSTEM_BIOS(0, "rev30", "Rev 3.0") - ROMX_LOAD( "sun3_160_v3.0", 0x0000, 0x10000, CRC(fee6e4d6) SHA1(440d532e1848298dba0f043de710bb0b001fb675), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "rev284", "Rev 2.8.4") - ROMX_LOAD( "sun3_160_v2.8.4", 0x0000, 0x10000, CRC(3befd013) SHA1(f642bb42200b794e6e32e2fe6c87d5c269c8656d), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "rev23", "Rev 2.3") - ROMX_LOAD( "sun3_160_v2.3", 0x0000, 0x10000, CRC(09585745) SHA1(1de1725dd9e27f5a910989bbb5b51acfbdc1d70b), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "rev21rf", "Rev 2.1 RF") - ROMX_LOAD( "sun3_160_v2.1_rf", 0x0000, 0x10000, CRC(5c7e9271) SHA1(5e4dbb50859a21f9e1d3e4a06c42494d13a9a8eb), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "rev15", "Rev 1.5") - ROMX_LOAD( "sun3_160_v1.5", 0x0000, 0x10000, CRC(06daee37) SHA1(b9873cd48d78ad8e0c85d69966fc20c21cfc99aa), ROM_BIOS(5)) -ROM_END - -ROM_START( sun3_260 ) - ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) -/* -Sun 3/260/280 V1.8 Bootprom -Sun 3/260/280 V2.1 Bootprom ( 2x^G cause system to beep 'till reset) -Sun 3/260/280 V2.3 Bootprom -Sun 3/260/280 V2.6 Bootprom (Req. for Xylogics 7053) -Sun 3/260/280 V2.7 Bootprom -Sun 3/260/280 V2.8 Bootprom -Sun 3/260/280 V2.8.4 Bootprom -Sun 3/260/280 V3.0 Bootprom -*/ - ROM_SYSTEM_BIOS(0, "rev30", "Rev 3.0") - ROMX_LOAD( "sun3_260_v3.0", 0x0000, 0x10000, CRC(f43ed1d3) SHA1(204880436bd087ede136f853610403d75e60bd75), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "rev27", "Rev 2.7") - ROMX_LOAD( "sun3_260_v2.7", 0x0000, 0x10000, CRC(099fcaab) SHA1(4a5233c778676f48103bdd8bab03b4264686b4aa), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "rev26", "Rev 2.6") - ROMX_LOAD( "sun3_260_v2.6", 0x0000, 0x10000, CRC(e8b17951) SHA1(e1fdef42670a349d99b0eca9c50c8566b8bb7c56), ROM_BIOS(3)) -ROM_END - -ROM_START( sun3_e ) - ROM_REGION32_BE( 0x10000, "user1", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "rev28", "Rev 3.2") - ROMX_LOAD( "sun3_e.32", 0x0000, 0x10000, CRC(acedde7e) SHA1(1ab6ec28f4365a613a5e326c34cb37585c3f0ecc), ROM_BIOS(1)) -ROM_END - -ROM_START( sun3_80 ) - ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) -/* -Sun 3/80 V1.0 Bootprom -Sun 3/80 V2.2 Bootprom -Sun 3/80 V2.3 Bootprom -Sun 3/80 V2.9.2 Bootprom -Sun 3/80 V3.0 Bootprom -Sun 3/80 V3.0.2 Bootprom -Sun 3/80 V3.0.3 Bootprom -*/ - ROM_SYSTEM_BIOS(0, "rev303", "Rev 3.0.3") - ROMX_LOAD( "sun3_80_v3.0.3", 0x0000, 0x20000, CRC(8f983115) SHA1(e4be2dcbb29fc5c60ed9d838ab241c634fdd24e5), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "rev302", "Rev 3.0.2") - ROMX_LOAD( "sun3_80_v3.0.2", 0x0000, 0x20000, CRC(c09a3592) SHA1(830187dfe58e65289533717a797d2c42da86ac4e), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "rev30", "Rev 3.0") - ROMX_LOAD( "sun3_80_v3.0", 0x0000, 0x20000, CRC(47e3b012) SHA1(1e045b6f542aaf7808d6567c28a9e734a8c5d815), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "rev292", "Rev 2.9.2") - ROMX_LOAD( "sun3_80_v2.9.2", 0x0000, 0x20000, CRC(32bcf711) SHA1(7ecd4a0d0988c1d1d53fd79ac16c8456ed73ace1), ROM_BIOS(4)) - - // default NVRAM: includes valid settings for console on framebuffer, boot from SCSI disk, Ethernet ID, more - ROM_REGION( 0x800, TIMEKEEPER_TAG, 0 ) - ROM_LOAD( "timekpr_380.bin", 0x000000, 0x000800, CRC(e76f1aae) SHA1(8e7c36e3928887a94a8133e8416ee4126c31edd7) ) -ROM_END - -ROM_START( sun3_460 ) - ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) -/* -Sun 3/460/480 V1.2.3 Bootprom -Sun 3/460/480 V2.9.1 Bootprom (2 Files, one for odd and one for even addresses) -Sun 3/460/480 V2.9.2 Bootprom -Sun 3/460/480 V2.9.3 Bootprom -Sun 3/460/480 V3.0 Bootprom (2 Files, one for odd and one for even addresses) -*/ - ROM_SYSTEM_BIOS(0, "rev30", "Rev 3.0") - ROMX_LOAD( "3_400_l.300", 0x00000, 0x10000, CRC(1312a04b) SHA1(6c3b67ba3567991897a48fe20f589ebbfcf0a35d), ROM_BIOS(1)) - ROMX_LOAD( "3_400_h.300", 0x10000, 0x10000, CRC(8d688672) SHA1(a5593844ce6af6c4f7f39bb653dc8f964b73b095), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "rev291", "Rev 2.9.1") - ROMX_LOAD( "sun3_460_v2.9.1_0", 0x00000, 0x10000, CRC(d62dbf09) SHA1(4a6b5fd7840b44fe93c9058a8973d8dd3c9f7d24), ROM_BIOS(2)) - ROMX_LOAD( "sun3_460_v2.9.1_1", 0x10000, 0x10000, CRC(3b5a5942) SHA1(ed6250e3c07d7cb62d4dd517a8637c8d37e16dc5), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, sun3_50, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/50", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Model 25 -COMP( 198?, sun3_60, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/60", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Ferrari -COMP( 198?, sun3_110, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/110", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Prism -COMP( 198?, sun3_150, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/75/140/150/160/180", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // AKA Carrera -COMP( 198?, sun3_260, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/260/280", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Prism -COMP( 198?, sun3_e, 0, 0, sun3, sun3, driver_device, 0, "Sun Microsystems", "Sun 3/E", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Polaris - -COMP( 198?, sun3_80, 0, 0, sun3_80, sun3, driver_device, 0, "Sun Microsystems", "Sun 3x/80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Hydra -COMP( 198?, sun3_460, 0, 0, sun3_460, sun3, driver_device, 0, "Sun Microsystems", "Sun 3x/460/470/480", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // Pegasus diff --git a/src/mess/drivers/sun4.c b/src/mess/drivers/sun4.c deleted file mode 100644 index 140fddc9307..00000000000 --- a/src/mess/drivers/sun4.c +++ /dev/null @@ -1,595 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Sun-4 Models - ------------ - - 4/260 - Processor(s): SF9010 @ 16.67MHz, Weitek 1164/1165, Sun-4 MMU, - 16 hardware contexts - Speed ratings: 10 MIPS, 1.6 MFLOPS - CPU: 501-1274/1491/1522 - Chassis type: deskside - Bus: VME (12 slot) - Memory: 128M (documented) physical with ECC, 1G/process virtual, - 60ns cycle - Architecture: sun4 - Notes: First SPARC machine. Code-named "Sunrise". Cache - much like Sun-3/2xx, uses same memory boards. - May be upgraded 3/260. - - 4/110 - Processor(s): MB86900 @ 14.28MHz, Weitek 1164/1165, Sun-4 MMU, - 16 hardware contexts - Speed ratings: 7 MIPS - CPU: 501-1199/1237/1462/1463/1464/1465/1512/1513/ - 1514/1515/1516/1517/1656/1657/1658/1659/ - 1660/1661 - Chassis type: deskside - Bus: VME (3 slot), P4 - Memory: 32M physical with parity, 1G/process virtual, - 70ns cycle - Architecture: sun4 - Notes: First desktop-able SPARC. CPU doesn't support - VME busmaster cards (insufficient room on CPU - board for full VME bus interface), so DMA disk - and tape boards won't work with it. Originally - intended as single-board machine, although there - are a few slave-only VME boards (such as the - ALM-2 and second ethernet controller) which work - with it. SIMM memory (static column?). - Code-named "Cobra". CPUs 501-1199/1462/1464/1512/ - 1514/1516/1656/1658/1660 do not have an FPU; - 501-1237/1463/1465/1513/1515/1517/1657/1659/1661 - have an FPU. - - 4/280 - Chassis type: rackmount - Notes: Rackmount version of 4/260. May be upgraded - 3/280. - - 4/150 - Chassis type: deskside - Bus: VME (6 slot) - Notes: See 4/110. - - SPARCstation 1 (4/60) - Processor(s): MB86901A or LSI L64801 @ 20MHz, Weitek 3170, - Sun-4c MMU, 8 hardware contexts - Speed ratings: 12.5 MIPS, 1.4 MFLOPS, 10 SPECmark89 - CPU: 501-1382/1629 - Chassis type: square pizza box - Bus: SBus @ 20MHz (3 slots, slot 3 slave-only) - Memory: 64M physical with synchronous parity, - 512M/process virtual, 50 ns cycle - Cache: 64K write-through, direct-mapped, virtually - indexed, virtually tagged, 16-byte lines - Architecture: sun4c - Notes: Code name "Campus". SIMM memory. 3.5" floppy. - First supported in SunOS 4.0.3c. - - SPARCserver 1 - Notes: SPARCstation 1 without a monitor/framebuffer. - - 4/330 (SPARCstation 330, SPARCserver 330) - Processor(s): CY7C601 @ 25MHz, TI8847, Sun-4 MMU, 16 hardware - contexts - Speed ratings: 16 MIPS, 2.6 MFLOPS, 11.3 SPECmark89 - CPU: 501-1316/1742 - Bus: VME (3 9U slots, 2 each 6U and 3U), P4 - Memory: 56M/72M (documented) physical with synchronous - parity, 1G/process virtual, 40ns cycle - Cache: 128K - Architecture: sun4 - Notes: SIMM memory. Cache similar to 4/2xx but - write-through. Code-named "Stingray". 56M limit - only for early versions of ROM. - - 4/310 - Chassis: deskside - Bus: VME (3 slots), P4 - Notes: See 4/330. - - 4/350 - Chassis: deskside - Bus: VME (6 slots), P4 - Notes: See 4/330. - - 4/360 - Notes: 4/260 upgraded with a 4/3xx CPU and memory boards. - - 4/370 (SPARCstation 370, SPARCserver 370) - Chassis: deskside - Bus: VME (12 slots), P4 - Notes: See 4/330. - - 4/380 - Notes: 4/280 upgraded with a 4/3xx CPU and memory boards.. - - 4/390 (SPARCserver 390) - Chassis: rackmount - Bus: VME (16 slots) - Notes: See 4/330. - - 4/470 (SPARCstation 470, SPARCserver 470) - Processor(s): CY7C601 @ 33MHz, TI8847 (?), 64 MMU hardware - contexts - Speed ratings: 22 MIPS, 3.8 MFLOPS, 17.6 SPECmark89 - CPU: 501-1381/1899 - Chassis: deskside - Bus: VME (12 slots), P4 - Memory: 96M (documented) physical - Cache: 128K - Architecture: sun4 - Notes: Write-back rather than write-through cache, - 3-level rather than 2-level Sun-style MMU. - Code-name "Sunray" (which was also the code name - for the 7C601 CPU). - - 4/490 (SPARCserver 490) - Chassis: rackmount - Bus: VME (16 slots), P4 - Notes: See 4/470. - - SPARCstation SLC (4/20) - Processor(s): MB86901A or LSI L64801 @ 20MHz - Speed ratings: 12.5 MIPS, 1.2 MFLOPS, 8.6 SPECmark89 - CPU: 501-1627/1680/1720/1748 (1776/1777 ?) - Chassis type: monitor - Bus: none - Memory: 16M physical - Cache: 64K write-through, direct-mapped, virtually - indexed, virtually tagged, 16-byte lines - Architecture: sun4c - Notes: Code name "Off-Campus". SIMM memory. No fan. - Built into 17" mono monitor. First supported in - SunOS 4.0.3c. - - SPARCstation IPC (4/40) - Processor(s): MB86901A or LSI L64801 @ 25MHz - Speed ratings: 13.8 SPECint92, 11.1 SPECfp92, 327 - SPECintRate92, 263 SPECfpRate92 - CPU: 501-1689/1835/1870/1974 (1690?) - Chassis type: lunchbox - Bus: SBus @ 25MHz (2 slots) - Memory: 48M physical - Cache: 64K write-through, direct-mapped, virtually - indexed, virtually tagged, 16-byte lines - Architecture: sun4c - Notes: Code name "Phoenix". SIMM memory. Onboard mono - framebuffer. 3.5" floppy. First supported in - SunOS 4.0.3c. - - SPARCstation 1+ (4/65) - Processor(s): LSI L64801 @ 25MHz, Weitek 3172, Sun-4c MMU, - 8 hardware contexts - Speed ratings: 15.8 MIPS, 1.7 MFLOPS, 12 SPECmark89 - CPU: 501-1632 - Chassis type: square pizza box - Bus: SBus @ 25MHz (3 slots, slot 3 slave-only) - Memory: 64M (40M?) physical with synchronous parity, - 512M/process virtual, 50ns cycle - Cache: 64K write-through, direct-mapped, virtually - indexed, virtually tagged, 16-byte lines - Architecture: sun4c - Notes: Code name "Campus B". SIMM memory. 3.5" floppy. - Essentially same as SPARCstation 1, just faster - clock and improved SCSI controller. First - supported in SunOS 4.0.3c. - - SPARCserver 1+ - Notes: SPARCstation 1+ without a monitor/framebuffer. - - SPARCstation 2 (4/75) - Processor(s): CY7C601 @ 40MHz, TI TMS390C601A (602A ?), Sun-4c - MMU, 16 hardware contexts - Speed ratings: 28.5 MIPS, 4.2 MFLOPS, 21.8 SPECint92, 22.8 - SPECfp92, 517 SPECintRate92, 541 SPECfpRate92 - CPU: 501-1638/1744/1858/1859/1912/1926/1989/1995 - Chassis type: square pizza box - Bus: SBus @ 20MHz (3 slots) - Memory: 64M physical on motherboard/128M total - Cache: 64K write-through, direct-mapped, virtually - indexed, virtually tagged, 32-byte lines - Architecture: sun4c - Notes: Code name "Calvin". SIMMs memory. 3.5" floppy. - Case slightly larger and has more ventilation. - (Some models apparently have LSI L64811 @ - 40MHz?) Expansion beyond 64M is possible with a - 32M card which can take a 32M daughterboard - (card blocks SBus slot). First supported in - SunOS 4.1.1. - - SPARCserver 2 - Notes: SPARCstation 2 without a monitor/framebuffer. - - SPARCstation ELC (4/25) - Processor(s): Fujitsu MB86903 or Weitek W8701 @ 33MHz, FPU on - CPU chip, Sun-4c MMU, 8 hardware contexts - Speed ratings: 21 MIPS, 3 MFLOPS, 18.2 SPECint92, 17.9 - SPECfp92, 432 SPECintRate92, 425 SPECfpRate92 - CPU: 501-1861 (1730?) - Chassis type: monitor - Bus: none - Memory: 64M physical - Cache: 64K write-through, direct-mapped, virtually - indexed, virtually tagged, 32-byte lines - Architecture: sun4c - Notes: Code name "Node Warrior". SIMM memory. No fan. - Built into 17" mono monitor. first supported in - SunOS 4.1.1c. - - SPARCstation IPX (4/50) - Processor(s): Fujitsu MB86903 or Weitek W8701 @ 40MHz, FPU on - CPU chip, Sun-4c MMU, 8 hardware contexts - Speed ratings: 28.5 MIPS, 4.2 MFLOPS, 21.8 SPECint92, - 21.5 SPECfp92, 517 SPECintRate92, 510 - SPECfpRate92 - CPU: 501-1780/1810/1959/2044 - Chassis type: lunchbox - Bus: SBus @ 20MHz (2 slots) - Memory: 64M physical - Cache: 64K write-through cache, direct-mapped, - virtually indexed, virtually tagged, 32-byte - lines - Architecture: sun4c - Notes: Code name "Hobbes". SIMM memory. Onboard - GX-accelerated cg6 color framebuffer (not usable - with ECL mono monitors, unlike SBus version). - Picture of Hobbes (from Watterson's "Calvin and - Hobbes" comic strip) silkscreened on - motherboard. 3.5" floppy. First supported in - SunOS 4.1.1 (may require IPX supplement). - - SPARCengine 1 (4/E) - CPU: 501-8035/8058/8064 - Bus: VME (6U form factor), SBus (1 slot) - Notes: Single-board VME SPARCstation 1 (or 1+?), - presumably for use as a controller, not as a - workstation. 8K MMU pages rather than 4K. - External RAM, framebuffer, and SCSI/ethernet - boards available. Code name "Polaris". - - SPARCserver 630MP (4/630) - Processor(s): MBus modules - CPU: 501-1686/2055 - Chassis type: deskside - Bus: VME (3 9U slots, 2 each 6U and 3U), SBus @ 20MHz - (4 slots), MBus (2 slots) - Memory: 640M physical - Architecture: sun4m - Notes: First MBus-based machine. Code name "Galaxy". - SIMM memory. - - SPARCserver 670MP (4/670) - Chassis type: deskside - Bus: VME (12 slots), SBus @ 20MHz (4 slots), MBus (2 - slots) - Notes: Like SPARCserver 630MP. More SBus slots can be - added via VME expansion boards. - - SPARCserver 690MP (4/690) - Chassis type: rackmount - Bus: VME (16 slots), SBus @ 20MHz (4 slots), MBus (2 - slots) - Notes: See SPARCserver 670MP. - - SPARCclassic (SPARCclassic Server)(SPARCstation LC) (4/15) - Processor(s): microSPARC @ 50MHz - Speed ratings: 59.1 MIPS, 4.6 MFLOPS, 26.4 SPECint92, 21.0 - SPECfp92, 626 SPECintRate92, 498 SPECfpRate92 - CPU: 501-2200/2262/2326 - Chassis type: lunchbox - Bus: SBus @ 20MHz (2 slots) - Memory: 96M physical - Architecture: sun4m - Notes: Sun4m architecture, but no MBus (uniprocessor - only). SIMM memory. Shares code name "Sunergy" - with LX. 3.5" floppy. Soldered CPU chip. Onboard - cgthree framebuffer, AMD79C30 8-bit audio chip. - First supported in SunOS 4.1.3c. - - SPARCclassic X (4/10) - CPU: 501-2079/2262/2313 - Notes: Essentially the same as SPARCclassic, but - intended for use as an X terminal (?). - - SPARCstation LX/ZX (4/30) - Processor(s): microSPARC @ 50MHz - Speed ratings: 59.1 MIPS, 4.6 MFLOPS, 26.4 SPECint92, 21.0 - SPECfp92, 626 SPECintRate92, 498 SPECfpRate92 - CPU: 501-2031/2032/2233/2474 - Chassis type: lunchbox - Bus: SBus @ 20MHz (2 slots) - Memory: 96M physical - Architecture: sun4m - Notes: Sun4m architecture, but no MBus (uniprocessor - only). SIMM memory. Shares code name "Sunergy" - with SPARCclassic. Soldered CPU chip. Onboard - cgsix framebuffer, 1M VRAM standard, expandable - to 2M. DBRI 16-bit audio/ISDN chip. First - supported in SunOS 4.1.3c. - - SPARCstation Voyager - Processors(s): microSPARC II @ 60MHz - Speed ratings: 47.5 SPECint92, 40.3 SPECfp92, 1025 - SPECintRate92, 859 SPECfpRate92 - Bus: SBus; PCMCIA type II (2 slots) - Memory: 80M physical - Architecture: sun4m - Notes: Portable (laptop?). 16M standard, two memory - expansion slots for Voyager-specific SIMMs (16M - or 32M). Code-named "Gypsy". 14" 1152x900 mono - or 12" 1024x768 color flat panel displays. DBRI - 16-bit audio/ISDN chip. - - SPARCstation 3 - Notes: Although this model appeared in a few Sun price - lists, it was renamed the SPARCstation 10 before - release. - - SPARCstation 10/xx - Processor(s): MBus modules - Motherboard: 501-1733/2259/2274/2365 (-2274 in model 20 only) - Chassis type: square pizza box - Bus: SBus @ 16.6/20MHz (model 20) or 18/20MHz (other - models) (4 slots); MBus (2 slots) - Memory: 512M physical - Architecture: sun4m - Notes: Code name "Campus-2". 3.5" floppy. SIMM memory. - Some models use double-width MBus modules which - block SBus slots. Also, the inner surface of the - chassis is conductive, so internal disk drives - must be mounted with insulating hardware. - - SPARCserver 10/xx - Notes: SPARCstation 10/xx without monitor/framebuffer. - - SPARCcenter 2000 - Processor(s): MBus modules - Motherboard: 501-1866/2334/2362 - Bus: XDBus * 2 (20 slots); SBus @ 20MHz (4 - slots/motherboard); MBus (2 slots/motherboard) - Memory: 5G physical - Cache: 2M/motherboard - Architecture: sun4d - Notes: Dual XDBus backplane with 20 slots. One board - type that carries dual MBus modules with 2M - cache (1M for each XDBus), 512M memory and 4 - SBus slots. Any combination can be used; memory - is *not* tied to the CPU modules but to an - XDBus. Solaris 2.x releases support an - increasing number of CPUs (up to twenty), due to - tuning efforts in the kernel. First supported in - Solaris 2.2 (SunOS 5.2). Code name "Dragon". - - SPARCserver 1000 - Processor(s): MBus modules - Motherboard: 501-2336 (2338?) - Bus: XDBus; SBus @ 20MHz (3 slots/motherboard); MBus - (2 slots/motherboard) - Memory: 2G physical - Cache: 1M/motherboard - Architecture: sun4d - Notes: Single XDBus design with "curious L-shaped - motherboards". Three SBus slots per motherboard, - 512M, two MBus modules per motherboard. Four - motherboards total, or a disk tray with four 1" - high 3.5" disks. Code name "Scorpion". First - supported in Solaris 2.2 (SunOS 5.2). - - - - 21/11/2011 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" - - -class sun4_state : public driver_device -{ -public: - sun4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(sun4_mem, AS_PROGRAM, 32, sun4_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sun4 ) -INPUT_PORTS_END - - -void sun4_state::machine_reset() -{ -} - - -static MACHINE_CONFIG_START( sun4, sun4_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68020, 16670000) // SPARC32 on real system - MCFG_CPU_PROGRAM_MAP(sun4_mem) -MACHINE_CONFIG_END - -/* -Boot PROM - -Sun-4c Architecture - -SPARCstation SLC (Sun-4/20) - 128K x 8 -U1001 Revision -======================================== -520-2748-01 1.2 Version 3 -520-2748-02 1.3 -520-2748-03 1.3 -520-2748-04 1.4 Version 2 -595-2250-xx Sun-4/20 Boot PROM Kit - -SPARCstation ELC (Sun-4/25) - 256K x 8 -U0806 Revision -======================================== -520-3085-01 -520-3085-02 2.3 Version 95 -520-3085-03 2.4 Version 96 -520-3085-04 2.6 Version 102 (not used) -520-3085-04 2.9 Version 7 - - -SPARCstation IPC (Sun-4/40) - 256K x 8 -U0902 Revision -======================================== -525-1085-01 -525-1085-02 -525-1085-03 1.6 Version 151 -525-1191-01 1.7 Version 3 and 2.4 Version 362 -525-1191-02 1.7 Version 3 and 2.6 Version 411 -525-1191-03 1.7 Version 3 and 2.9 Version 24 - - -SPARCstation IPX (Sun-4/50) - 256K x 8 -U0501 Revision -======================================== -525-1177-01 2.1 Version 66 -525-1177-02 2.2 Version 134 -525-1177-03 2.3 Version 263 -525-1177-04 2.4 Version 347 -525-1177-05 2.6 Version 410 -525-1177-06 2.9 Version 20 - - -SPARCstation 1 (Sun-4/60) - 128K x 8 -U0837 Revision -======================================== -525-1043-01 -525-1043-02 0.1 -525-1043-03 -525-1043-04 1.0 -525-1043-05 1.0 -525-1043-06 1.0 -525-1043-07 1.1 -525-1043-08 1.3 Version 3 -595-1963-xx Sun-4/60 Boot PROM Kit -525-1207-01 2.4 Version 95 -525-1207-02 2.9 Version 9 (2.x is only available from the spare parts price list) -560-1805-xx Sun-4/60 2.4 Boot PROM Kit - - -SPARCstation 1+ (Sun-4/65) - 128K x 8 -U0837 Revision -======================================== -525-1108-01 -525-1108-02 -525-1108-03 1.1 Version 13 -525-1108-04 1.2 -525-1108-05 1.3 Version 4 -525-1208-01 2.4 Version 116 -525-1208-02 2.9 Version 9 (2.x is only available from the spare parts price list) -560-1806-xx Sun-4/65 2.4 Boot PROM Kit - - -SPARCstation 2 (Sun-4/75) - 256K x 8 -U0501 Revision -======================================== -525-1107-01 2.0Beta0 -525-1107-02 2.0Beta1 -525-1107-03 2.0 -525-1107-04 2.0 Version 865 (fails with Weitek Power ?p) -525-1107-05 2.1 Version 931 (fails with Weitek Power ?p) -525-1107-06 2.2 Version 947 -525-1107-07 2.4 Version 990 -525-1107-08 2.4.1 Version 991 -525-1107-09 2.6 Version 1118 -525-1107-10 2.9 Version 16 -595-2249-xx Sun-4/75 Boot PROM Kit - -*/ - -// Sun 4/300, Cypress Semiconductor CY7C601, Texas Instruments 8847 FPU -ROM_START( sun4_300 ) - ROM_REGION32_BE( 0x40000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "1035-09.rom", 0x0000, 0x10000, CRC(4ae2f2ad) SHA1(9c17a80b3ce3efdf18b5eca969f1565ddaad3116)) - ROM_LOAD( "1036-09.rom", 0x0000, 0x10000, CRC(cb3d45a7) SHA1(9d5da09ff87ec52dc99ffabd1003d30811eafdb0)) - ROM_LOAD( "1037-09.rom", 0x0000, 0x10000, CRC(4f005bea) SHA1(db3f6133ea7c497ba440bc797123dde41abea6fd)) - ROM_LOAD( "1038-09.rom", 0x0000, 0x10000, CRC(1e429d31) SHA1(498ce4d34a74ea6e3e369bb7eb9c2b87e12bd080)) - - ROM_REGION( 0x10000, "devices", ROMREGION_ERASEFF ) - // CG3 Color frame buffer (cgthree) - ROM_LOAD( "sunw,501-1415.bin", 0x0000, 0x0800, CRC(d1eb6f4d) SHA1(9bef98b2784b6e70167337bb27cd07952b348b5a)) - - // BW2 frame buffer (bwtwo) - ROM_LOAD( "sunw,501-1561.bin", 0x0800, 0x0800, CRC(e37a3314) SHA1(78761bd2369cb0c58ef1344c697a47d3a659d4bc)) - - // TurboGX 8-Bit Color Frame Buffer - ROM_LOAD( "sunw,501-2325.bin", 0x1000, 0x8000, CRC(bbdc45f8) SHA1(e4a51d78e199cd57f2fcb9d45b25dfae2bd537e4)) -ROM_END - -// SPARCstation IPC (Sun 4/40) -ROM_START( sun4_40 ) - ROM_REGION32_BE( 0x40000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "4.40_v2.9.rom", 0x0000, 0x40000, CRC(532fc20d) SHA1(d86d9e958017b3fecdf510d728a3e46a0ce3281d)) -ROM_END - -// SPARCstation IPX (Sun 4/50) -ROM_START( sun4_50 ) - ROM_REGION32_BE( 0x40000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "ipx-29.rom", 0x0000, 0x40000, CRC(1910aa65) SHA1(7d8832fea8e299b89e6ec7137fcde497673c14f8)) -ROM_END - -// SPARCstation SLC (Sun 4/20) -ROM_START( sun4_20 ) - ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "520-2748-04.rom", 0x0000, 0x20000, CRC(e85b3fd8) SHA1(4cbc088f589375e2d5983f481f7d4261a408702e)) -ROM_END - -// SPARCstation 1 (Sun 4/60) -ROM_START( sun4_60 ) - ROM_REGION32_BE( 0x20000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "ss1v29.rom", 0x0000, 0x20000, CRC(e3f103a9) SHA1(5e95835f1090ea94859bd005757f0e7b5e86181b)) -ROM_END - -// SPARCstation 2 (Sun 4/75) -ROM_START( sun4_75 ) - ROM_REGION32_BE( 0x40000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD( "ss2-29.rom", 0x0000, 0x40000, CRC(d04132b3) SHA1(ef26afafa2800b8e2e5e994b3a76ca17ce1314b1)) -ROM_END - -// SPARCstation 10 (Sun S10) -ROM_START( sun_s10 ) - ROM_REGION32_BE( 0x80000, "user1", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "r225", "Rev 2.2.5") - ROMX_LOAD( "ss10_v2.25.rom", 0x0000, 0x80000, CRC(c7a48fd3) SHA1(db13d85b02f181eb7fce4c38b11996ff64116619), ROM_BIOS(1)) - // SPARCstation 10 and 20 - ROM_SYSTEM_BIOS(1, "r225r", "Rev 2.2.5r") - ROMX_LOAD( "ss10-20_v2.25r.rom", 0x0000, 0x80000, CRC(105ba132) SHA1(58530e88369d1d26ab11475c7884205f2299d255), ROM_BIOS(2)) -ROM_END - -// SPARCstation 20 -ROM_START( sun_s20 ) - ROM_REGION32_BE( 0x80000, "user1", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "r225", "Rev 2.2.5") - ROMX_LOAD( "ss20_v2.25.rom", 0x0000, 0x80000, CRC(b4f5c547) SHA1(ee78312069522094950884d5bcb21f691eb6f31e), ROM_BIOS(1)) - // SPARCstation 10 and 20 - ROM_SYSTEM_BIOS(1, "r225r", "Rev 2.2.5r") - ROMX_LOAD( "ss10-20_v2.25r.rom", 0x0000, 0x80000, CRC(105ba132) SHA1(58530e88369d1d26ab11475c7884205f2299d255), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, sun4_300, 0, 0, sun4, sun4, driver_device, 0, "Sun Microsystems", "Sun 4/3x0", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 198?, sun4_40, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation IPC (Sun 4/40)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 198?, sun4_50, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation IPX (Sun 4/50)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 198?, sun4_20, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation SLC (Sun 4/20)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 198?, sun4_60, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation 1 (Sun 4/60)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 198?, sun4_75, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation 2 (Sun 4/75)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 198?, sun_s10, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation 10 (Sun S10)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 198?, sun_s20, sun4_300,0, sun4, sun4, driver_device, 0, "Sun Microsystems", "SPARCstation 20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/super6.c b/src/mess/drivers/super6.c deleted file mode 100644 index 687598f89f8..00000000000 --- a/src/mess/drivers/super6.c +++ /dev/null @@ -1,573 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - TODO: - - - floppy (cannot be implemented currently since this is another case of halting the cpu mid-instruction) - - interrupts - - DMA - - peripheral interfaces - -*/ - -#include "bus/rs232/rs232.h" -#include "includes/super6.h" - - -//************************************************************************** -// MEMORY BANKING -//************************************************************************** - -//------------------------------------------------- -// bankswitch - -//------------------------------------------------- - -void super6_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - // power on jump - if (!BIT(m_bank0, 6)) { program.install_rom(0x0000, 0x07ff, 0, 0xf800, m_rom); return; } - - // first 64KB of memory - program.install_ram(0x0000, 0xffff, ram); - - // second 64KB of memory - int map = (m_bank1 >> 4) & 0x07; - - switch (map) - { - case 0: - if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000); - if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); - if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000); - if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000); - break; - - case 1: - if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000); - if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); - if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000); - if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x0000); - break; - - case 2: - if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000); - if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); - if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x4000); - if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000); - break; - - case 3: - if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000); - if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); - if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x0000); - if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x4000); - break; - - case 4: - if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0xc000); - if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000); - if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000); - if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000); - break; - } - - // bank 0 overrides - if (BIT(m_bank0, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x0000); - if (BIT(m_bank0, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x4000); - if (BIT(m_bank0, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x8000); - if (BIT(m_bank0, 3)) program.install_ram(0xc000, 0xffff, ram + 0xc000); - - // PROM enabled - if (!BIT(m_bank0, 5)) program.install_rom(0xf000, 0xf7ff, 0, 0x800, m_rom); -} - - -//------------------------------------------------- -// s100_w - S-100 bus extended address A16-A23 -//------------------------------------------------- - -WRITE8_MEMBER( super6_state::s100_w ) -{ - /* - - bit description - - 0 A16 - 1 A17 - 2 A18 - 3 A19 - 4 A20 - 5 A21 - 6 A22 - 7 A23 - - */ - - m_s100 = data; -} - - -//------------------------------------------------- -// bank0_w - on-board memory control port #0 -//------------------------------------------------- - -WRITE8_MEMBER( super6_state::bank0_w ) -{ - /* - - bit description - - 0 memory bank 0 (0000-3fff) - 1 memory bank 1 (4000-7fff) - 2 memory bank 2 (8000-bfff) - 3 memory bank 3 (c000-ffff) - 4 - 5 PROM enabled (0=enabled, 1=disabled) - 6 power on jump reset - 7 parity check enable - - */ - - m_bank0 = data; - - bankswitch(); -} - - -//------------------------------------------------- -// bank1_w - on-board memory control port #1 -//------------------------------------------------- - -WRITE8_MEMBER( super6_state::bank1_w ) -{ - /* - - bit description - - 0 memory bank 4 - 1 memory bank 5 - 2 memory bank 6 - 3 memory bank 7 - 4 map select 0 - 5 map select 1 - 6 map select 2 - 7 - - */ - - m_bank1 = data; - - bankswitch(); -} - - - -//************************************************************************** -// PERIPHERALS -//************************************************************************** - -//------------------------------------------------- -// floppy_r - FDC synchronization/drive/density -//------------------------------------------------- - -READ8_MEMBER( super6_state::fdc_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 FDC INTRQ - - */ - - fatalerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); - - return !m_fdc->intrq_r() << 7; -} - - -//------------------------------------------------- -// floppy_w - FDC synchronization/drive/density -//------------------------------------------------- - -WRITE8_MEMBER( super6_state::fdc_w ) -{ - /* - - bit description - - 0 disk drive select 0 - 1 disk drive select 1 - 2 head select (0=head 1, 1=head 2) - 3 disk density (0=single, 1=double) - 4 size select (0=8", 1=5.25") - 5 - 6 - 7 - - */ - - // disk drive select - floppy_image_device *m_floppy = NULL; - - if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); - if (BIT(data, 1)) m_floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(m_floppy); - if (m_floppy) m_floppy->mon_w(0); - - // head select - if (m_floppy) m_floppy->ss_w(BIT(data, 2)); - - // disk density - m_fdc->dden_w(!BIT(data, 3)); -} - - -//------------------------------------------------- -// baud_w - baud rate -//------------------------------------------------- - -WRITE8_MEMBER( super6_state::baud_w ) -{ - /* - - bit description - - 0 SIO channel A baud bit A - 1 SIO channel A baud bit B - 2 SIO channel A baud bit C - 3 SIO channel A baud bit D - 4 SIO channel B baud bit A - 5 SIO channel B baud bit B - 6 SIO channel B baud bit C - 7 SIO channel B baud bit D - - */ - - m_brg->str_w(data & 0x0f); - m_brg->stt_w(data >> 4); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( super6_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( super6_mem, AS_PROGRAM, 8, super6_state ) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( super6_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( super6_io, AS_IO, 8, super6_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(WD2793_TAG, wd2793_t, read, write) - AM_RANGE(0x10, 0x10) AM_MIRROR(0x03) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) - AM_RANGE(0x14, 0x14) AM_READWRITE(fdc_r, fdc_w) - AM_RANGE(0x15, 0x15) AM_READ_PORT("J7") AM_WRITE(s100_w) - AM_RANGE(0x16, 0x16) AM_WRITE(bank0_w) - AM_RANGE(0x17, 0x17) AM_WRITE(bank1_w) - AM_RANGE(0x18, 0x18) AM_MIRROR(0x03) AM_WRITE(baud_w) -// AM_RANGE(0x40, 0x40) ? -// AM_RANGE(0xe0, 0xe7) HDC? -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( super6 ) -//------------------------------------------------- - -static INPUT_PORTS_START( super6 ) - PORT_START("J7") - PORT_DIPNAME( 0x0f, 0x0f, "SIO Channel A Baud Rate" ) PORT_DIPLOCATION("J7:1,2,3,4") - PORT_DIPSETTING( 0x00, "50" ) - PORT_DIPSETTING( 0x01, "75" ) - PORT_DIPSETTING( 0x02, "110" ) - PORT_DIPSETTING( 0x03, "134.5" ) - PORT_DIPSETTING( 0x04, "150" ) - PORT_DIPSETTING( 0x05, "300" ) - PORT_DIPSETTING( 0x06, "600" ) - PORT_DIPSETTING( 0x07, "1200" ) - PORT_DIPSETTING( 0x08, "1800" ) - PORT_DIPSETTING( 0x09, "2000" ) - PORT_DIPSETTING( 0x0a, "2400" ) - PORT_DIPSETTING( 0x0b, "3600" ) - PORT_DIPSETTING( 0x0c, "4800" ) - PORT_DIPSETTING( 0x0d, "7200" ) - PORT_DIPSETTING( 0x0e, "9600" ) - PORT_DIPSETTING( 0x0f, "19200" ) - PORT_DIPNAME( 0x70, 0x70, "SIO Channel B Baud Rate" ) PORT_DIPLOCATION("J7:5,6,7") - PORT_DIPSETTING( 0x00, "50" ) - PORT_DIPSETTING( 0x10, "75" ) - PORT_DIPSETTING( 0x20, "110" ) - PORT_DIPSETTING( 0x30, "134.5" ) - PORT_DIPSETTING( 0x40, "150" ) - PORT_DIPSETTING( 0x50, "300" ) - PORT_DIPSETTING( 0x60, "600" ) - PORT_DIPSETTING( 0x70, "1200" ) - PORT_DIPNAME( 0x80, 0x00, "Disk Drive Type" ) PORT_DIPLOCATION("J7:8") - PORT_DIPSETTING( 0x80, "Single Sided" ) - PORT_DIPSETTING( 0x00, "Double Sided" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// Z80CTC -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER( super6_state::ctc_tick ) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); -} - -//------------------------------------------------- -// Z80DMA -//------------------------------------------------- - -READ8_MEMBER(super6_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(super6_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - prog_space.write_byte(offset, data); -} - -READ8_MEMBER(super6_state::io_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(super6_state::io_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - prog_space.write_byte(offset, data); -} - -//------------------------------------------------- -// COM8116_INTERFACE( brg_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( super6_state::fr_w ) -{ - m_dart->rxca_w(state); - m_dart->txca_w(state); - - m_ctc->trg1(state); -} - - -//------------------------------------------------- -// floppy_format_type floppy_formats -//------------------------------------------------- - -static SLOT_INTERFACE_START( super6_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER( super6_state::fdc_intrq_w ) -{ - if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); - - m_ctc->trg3(!state); -} - -WRITE_LINE_MEMBER( super6_state::fdc_drq_w ) -{ - if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); - - m_dma->rdy_w(state); -} - - -//------------------------------------------------- -// z80_daisy_config super6_daisy_chain -//------------------------------------------------- - -static const z80_daisy_config super6_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80DART_TAG }, - { Z80PIO_TAG }, - { NULL } -}; - - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_19200 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_19200 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( super6 ) -//------------------------------------------------- - -void super6_state::machine_start() -{ - // state saving - save_item(NAME(m_s100)); - save_item(NAME(m_bank0)); - save_item(NAME(m_bank1)); -} - - -void super6_state::machine_reset() -{ - m_bank0 = m_bank1 = 0; - - bankswitch(); - - UINT8 baud = m_j7->read(); - - m_brg->str_w(baud & 0x0f); - m_brg->stt_w((baud >> 4) & 0x07); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( super6 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( super6, super6_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_24MHz/4) - MCFG_CPU_PROGRAM_MAP(super6_mem) - MCFG_CPU_IO_MAP(super6_io) - MCFG_CPU_CONFIG(super6_daisy_chain) - - // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_24MHz/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", super6_state, ctc_tick, attotime::from_hz(XTAL_24MHz/16)) - - MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_24MHz/6) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg2)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(super6_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(super6_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(super6_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(super6_state, io_write_byte)) - - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_24MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_WD2793_ADD(WD2793_TAG, 1000000) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(super6_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(super6_state, fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":0", super6_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":1", super6_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_24MHz/4, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) - - MCFG_DEVICE_ADD(BR1945_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(super6_state, fr_w)) - MCFG_COM8116_FT_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "super6") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( super6 ) -//------------------------------------------------- - -ROM_START( super6 ) - ROM_REGION( 0x800, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "v36" ) - ROM_SYSTEM_BIOS( 0, "v36", "ADC S6 v3.6" ) - ROMX_LOAD( "adcs6_v3.6.u29", 0x000, 0x800, CRC(386fd22a) SHA1(9c177990aa180ab93be9c4641e92ae934627e661), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v12", "Digitex Monitor v1.2a" ) - ROMX_LOAD( "digitex monitor 1.2a 6oct1983.u29", 0x000, 0x800, CRC(a4c33ce4) SHA1(46dde43ea51d295f2b3202c2d0e1883bde1a8da7), ROM_BIOS(2) ) - - ROM_REGION( 0x800, "plds", 0 ) - ROM_LOAD( "pal16l8.u16", 0x000, 0x800, NO_DUMP ) - ROM_LOAD( "pal16l8.u36", 0x000, 0x800, NO_DUMP ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, super6, 0, 0, super6, super6, driver_device, 0, "Advanced Digital Corporation", "Super Six", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/super80.c b/src/mess/drivers/super80.c deleted file mode 100644 index 2c6b069e4bf..00000000000 --- a/src/mess/drivers/super80.c +++ /dev/null @@ -1,970 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/***************************************************************************** - -Super80.c written by Robbbert, 2005-2010. - -2010-12-19: Added V3.7 bios freshly dumped today. -2014-04-28: Added disk system and did cleanups - -See the MESS sysinfo and wiki for usage -documentation. Below for the most technical bits: - -= Architecture (super80): - - * Z80 @ 2MHz - * 16k, 32k or 48k RAM (0000-BFFF) - * 12k ROM (C000-EFFF) - * 3.5k RAM (F000-FDFF), comes with the "64k ram" modification - * 0.5k RAM (FE00-FFFF) for Chipspeed colour board - -= Architecture (super80v): - - * Z80 @ 2MHz - * 16k, 32k or 48k RAM (0000-BFFF) - * 12k ROM (C000-EFFF) - * 2k Video RAM (F000-F7FF) banked with Colour RAM (modified Chipspeed board) - * 2k PCG RAM (F800-FFFF) banked with Character Generator ROM - -= Super80 ports: - - port $F0: General Purpose output port - Bit 0 - cassette output - Bit 1 - cassette relay control; 0=relay on - Bit 2 - turns screen on and off;0=screen off - Bit 3 - Available for user projects [We will use it for sound] - Bit 4 - Available for user projects - Bit 5 - cassette LED; 0=LED on - Bit 6/7 - not decoded - - port $F1: Video page output port - Bit 0 - not decoded [we will use it for video switching] - Bits 1 to 7 - choose video page to display - Bit 1 controls A9, bit 2 does A10, etc - - port $F2: General purpose input port - Bit 0 - cassette input - Bit 1 - Available for user projects - Bit 2 - Available for user projects - Bit 3 - not decoded - Bit 4 - Switch A [These switches are actual DIP switches on the motherboard] - Bit 5 - Switch B - Bit 6 - Switch C - Bit 7 - Switch D - -= Super80v ports: - - port $10: MC6845 control port - - port $11: MC6845 data port - - port $F0: General Purpose output port - Bit 0 - cassette output - Bit 1 - Cassette relay control; 0=relay on - Bit 2 - Colour banking (0 = Colour Ram, 1 = Video Ram) - Bit 3 - Sound - Bit 4 - PCG banking (0 = PROM, 1 = PCG) - Bit 5 - cassette LED; 0=LED on - Bit 6/7 - not decoded - - port $F2: General purpose input port - same as for Super80. - -= Cassette information: - -The standard cassette system uses sequences of 1200 Hz and 2400 Hz to represent a 0 or a 1 respectivly. -This is identical to the Exidy Sorcerer and the Microbee. Data rates available are 300, 400, 600, and 1200 baud. -The user has to adjust some bytes in memory in order to select a different baud rate. - - BDF8 BDF9 Baud - --------------------- - F8 04 300 - BA 03 400 - 7C 02 600 - 3E 01 1200 - -The enhanced Monitor roms (those not supplied by Dick Smith) have extra commands to change the rates -without the tedium of manually modifying memory. - -When saving, the OS toggles the cassette bit (bit 0 of port F0) at the required frequencies directly. - -When loading, the signal passes through a filter, then into a 4046 PLL (Phase-Locked-Loop) chip. -This acts as a frequency-to-voltage converter. The output of this device is passed to the "+" input -of a LM311 op-amp. The "-" input is connected to a 10-turn trimpot, which is adjusted by the owner -at construction time. It sets the switching midpoint voltage. Voltages above a certain level become -a "1" level at the output, while voltages below become a "0" level. This output in turn connects -to the cassette input bit of port F2. - -The monitor loading routine (at C066 in most monitor roms), waits for a high-to-low transition -(the low is the beginning of the start bit), then waits for half a bit, checks it is still low, -waits for a full bit, then reads the state (this is the first bit), then cycles between waiting -a bit and reading the next, until a full byte has been constructed. Lastly, the stop bit is -checked that it is at a high level. - -This means that we cannot attempt to convert frequency to voltage ourselves, since the OS only -"looks" once a bit. The solution is to use a mame timer running at a high enough rate (40 kHz) -to read the wave state. While the wave state stays constant, a counter is incremented. When the -state changes, the output is set according to how far the counter has progressed. The counter is -then reset ready for the next wave state. The code for this is in the TIMER_CALLBACK. - -A kit was produced by ETI magazine, which plugged into the line from your cassette player earphone -socket. The computer line was plugged into this box instead of the cassette player. The box was -fitted with a speaker and a volume control. You could listen to the tones, to assist with head -alignment, and with debugging. In MESS, a config switch has been provided so that you can turn -this sound on or off as needed. - -= About the 1 MHz / 2 MHz switching: - -The original hardware runs with a 2 MHz clock, but operates in an unusual way. There is no video -processor chip, just a huge bunch of TTL chips. The system spends half the time running the CPU, -and half the time displaying the picture. The timing will activate the BUSREQ line, and the CPU will -finish its current instruction, activate the BUSACK line, and go to sleep. The video circuits will -read the video RAM and show the picture. At the end, the BUSREQ line is released, and processing can -continue. - -The processing time occurs during the black parts of the screen, therefore half the screen will be -black unless you expand the image with the monitor's controls. This method ensures that there will -be no memory contention, and thus, no snow. The processor will run at 2 MHz pulsed at 48.8 Hz, which -is an effective speed of 1 MHz. - -When saving or loading a cassette file, this pulsing would cause the save tone to be modulated with -a loud hum. When loading, the synchronisation to the start bit could be missed, causing errors. -Therefore the screen can be turned off via an output bit. This disables the BUSREQ control, which -in turn prevents screen refresh, and gives the processor a full uninterrupted 2 MHz speed. - -MAME does not emulate BUSREQ or BUSACK. Further, a real system would display a blank screen by not -updating the video. In MAME, the display continues to show. It just doesn't update. - -To obtain accurate timing, the video update routine will toggle the HALT line on alternate frames. -Although physically incorrect, it is the only way to accurately emulate the speed change function. -The video update routine emulates the blank screen by filling it with spaces. - -For the benefit of those who like to experiment, config switches have been provided in MESS to -allow you to leave the screen on at all times, and to always run at 2 MHz if desired. These options -cannot exist in real hardware. - -= Quickload: - -This was not a standard feature. It is a hardware facility I added to my machine when age threatened -to kill off my cassette player and tapes. The tapes were loaded up one last time, and transferred to -a hard drive on a surplus 386 PC, in binary format (NOT a wave file). Special roms were made to allow -loading and saving to the S-100 board and its ports. These ports were plugged into the 386 via cables. -A QBASIC program on the 386 monitored the ports and would save and load files when requested by the -Super-80. This worked (and still works) very well, and is a huge improvement over the cassette, both -speedwise and accuracy-wise. - -The modified rom had the autorun option built in. Autorun was never available for cassettes. - -In MESS, the same file format is used - I can transfer files between MESS and the 386 seamlessly. -MESS has one difference - the program simply appears in memory without the processor being aware -of it. To accomplish autorun therefore requires that the processor pc register be set to the start -address of the program. BASIC programs may need some preprocessing before they can be started. This -is not necessary on a Super-80 or a Microbee, but is needed on any system running Microsoft BASIC, -such as the Exidy Sorcerer or the VZ-200. - -In MESS, quickload is available for all Super80 variants (otherwise you would not have any games -to play). MESS features a config switch so the user can turn autorun on or off as desired. - - -= Start of Day circuit: - -When the computer is turned on or reset, the Z80 will want to start executing at 0000. Since this is -RAM, this is not a good idea. The SOD circuit forcibly disables the RAM and enables the ROMs, so they -will appear to be at 0000. Thus, the computer will boot. - -The Master Reset signal (power-on or Reset button pushed), triggers a flipflop that disables RAM and -causes C000 to FFFF to appear at 0000 to 3FFF. This will be reset (back to normal) when A14 and A15 -are high, and /M1 is active. This particular combination occurs on all ROM variants, when reading the -fifth byte in the ROM. In reality, the switchover can take place any time between the 4th byte until -the computer has booted up. This is because the low RAM does not contain any system areas. - -Since MAME does not emulate /M1, a banking scheme has had to be used. Bank 0 is normal RAM. Bank 1 -points to the ROMs. When a machine reset occurs, bank 1 is switched in. A timer is triggered, and -after 4 bytes are read, bank 0 is selected. The timer is as close as can be to real operation of the -hardware. - - -Super80 disk WD2793, Z80DMA: - -Port(hex) Role Comment ---------- ----- -------- -30 DMA I/O Z80A DMA Controller Command Register -38 WDSTCM WD2793 Command Status -39 WDTRK WD2793 Track Register -3A WDSEC WD2793 Sector Register -3B WDDATA WD2793 Data Register - -3E UFDSTAT FDD and WD2793 Status input - Bit0 INTRQ 1 = WD2793 Interrupt Request - Bit1 DATARQ 1 = Data Ready to Receive or Send - Bit2 MOTOR ON 1 = FDD Motor On - -3F UFDCOM WD2793 Command Register output - Bit0 5/8 1 = 8" Drive Selected - Bit1 ENMF* 0 = 1MHz, 1 = 2MHz (for 8" double density) - Bit2 DR0SEL 1 = Drive 0 (Drive A) selected - Bit3 DR1SEL 1 = Drive 1 (Drive B) selected - Bit4 DR2SEL 1 = Drive 2 (Drive C) selected - Bit5 DR3SEL 1 = Drive 3 (Drive D) selected - Bit6 SIDESEL 0 = Select Disk side 0, 1 = Select Disk side 1 - Bit7 DDEN* 0 = MFM (Double Density), 1 = FM (Single Density) - -ToDo: -- Fix Paste: Shift operates randomly (only super80m is suitable, the others drop characters because - of the horrible inline editor they use) -- Get disk system to work (no disk images available) only connected to super80r atm - - -***********************************************************************************************************/ - -#include "super80.lh" -#include "includes/super80.h" - -#define MASTER_CLOCK (XTAL_12MHz) -#define PIXEL_CLOCK (MASTER_CLOCK/2) -#define HTOTAL (384) -#define HBEND (0) -#define HBSTART (256) -#define VTOTAL (240) -#define VBEND (0) -#define VBSTART (160) - -#define SUPER80V_SCREEN_WIDTH (560) -#define SUPER80V_SCREEN_HEIGHT (300) -#define SUPER80V_DOTS (7) - - -/**************************** MEMORY AND I/O MAPPINGS *****************************************************************/ - -/* A read_byte or write_byte to unmapped memory crashes MESS, and UNMAP doesnt fix it. - This makes the H and E monitor commands show FF */ -READ8_MEMBER( super80_state::super80_read_ff ) { return 0xff; } - -static ADDRESS_MAP_START( super80_map, AS_PROGRAM, 8, super80_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("boot") AM_REGION("maincpu", 0x0000) - AM_RANGE(0x4000, 0xbfff) AM_RAM AM_REGION("maincpu", 0x4000) - AM_RANGE(0xc000, 0xefff) AM_ROM - AM_RANGE(0xf000, 0xffff) AM_READ(super80_read_ff) AM_WRITENOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START( super80m_map, AS_PROGRAM, 8, super80_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("boot") AM_REGION("maincpu", 0x0000) - AM_RANGE(0x4000, 0xbfff) AM_RAM AM_REGION("maincpu", 0x4000) - AM_RANGE(0xc000, 0xefff) AM_ROM - AM_RANGE(0xf000, 0xffff) AM_RAM AM_REGION("maincpu", 0xf000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( super80v_map, AS_PROGRAM, 8, super80_state) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("boot") - AM_RANGE(0x4000, 0xbfff) AM_RAM - AM_RANGE(0xc000, 0xefff) AM_ROM - AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(super80v_low_r, super80v_low_w) - AM_RANGE(0xf800, 0xffff) AM_READWRITE(super80v_high_r, super80v_high_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( super80_io, AS_IO, 8, super80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xdc, 0xdc) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE(0xdc, 0xdc) AM_WRITE(super80_dc_w) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80_f0_w) - AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x14) AM_WRITE(super80_f1_w) - AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x14) AM_READ(super80_f2_r) - AM_RANGE(0xf8, 0xfb) AM_MIRROR(0x04) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( super80e_io, AS_IO, 8, super80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0xbc, 0xbc) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE(0xbc, 0xbc) AM_WRITE(super80_dc_w) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80_f0_w) - AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x14) AM_WRITE(super80_f1_w) - AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x14) AM_READ(super80_f2_r) - AM_RANGE(0xf8, 0xfb) AM_MIRROR(0x04) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( super80r_io, AS_IO, 8, super80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x10, 0x10) AM_WRITE(super80v_10_w) - AM_RANGE(0x11, 0x11) AM_DEVREAD("crtc", mc6845_device, register_r) - AM_RANGE(0x11, 0x11) AM_WRITE(super80v_11_w) - AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("dma", z80dma_device, read, write) - AM_RANGE(0x38, 0x3b) AM_DEVREADWRITE("fdc", wd2793_t, read, write) - AM_RANGE(0x3e, 0x3e) AM_READ(port3e_r) - AM_RANGE(0x3f, 0x3f) AM_WRITE(port3f_w) - AM_RANGE(0xdc, 0xdc) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE(0xdc, 0xdc) AM_WRITE(super80_dc_w) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80r_f0_w) - AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x14) AM_READ(super80_f2_r) - AM_RANGE(0xf8, 0xfb) AM_MIRROR(0x04) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( super80v_io, AS_IO, 8, super80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x10, 0x10) AM_WRITE(super80v_10_w) - AM_RANGE(0x11, 0x11) AM_DEVREAD("crtc", mc6845_device, register_r) - AM_RANGE(0x11, 0x11) AM_WRITE(super80v_11_w) - AM_RANGE(0xdc, 0xdc) AM_DEVREAD("cent_status_in", input_buffer_device, read) - AM_RANGE(0xdc, 0xdc) AM_WRITE(super80_dc_w) - AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80_f0_w) - AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x14) AM_READ(super80_f2_r) - AM_RANGE(0xf8, 0xfb) AM_MIRROR(0x04) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) -ADDRESS_MAP_END - -/**************************** DIPSWITCHES, KEYBOARD, HARDWARE CONFIGURATION ****************************************/ - -static INPUT_PORTS_START( super80 ) - PORT_START("DSW") - PORT_BIT( 0xf, 0xf, IPT_UNUSED ) - PORT_DIPNAME( 0x10, 0x00, "Switch A") PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x10, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x20, 0x20, "Switch B") PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x20, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x40, 0x40, "Switch C") PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x40, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x80, 0x00, "Switch D") PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x80, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - - PORT_START("KEY.0") /* line 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(0x00) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('H') PORT_CHAR(0x08) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('P') PORT_CHAR(0x10) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('X') PORT_CHAR(0x18) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT) - PORT_START("KEY.1") /* line 1 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('A') PORT_CHAR(0x01) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('I') PORT_CHAR(0x09) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('Q') PORT_CHAR(0x11) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('Y') PORT_CHAR(0x19) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("KEY.2") /* line 2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('B') PORT_CHAR(0x02) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('J') PORT_CHAR(0x0a) // port_char 0x0a is hijacked to 0x0d - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('R') PORT_CHAR(0x12) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('Z') PORT_CHAR(0x1a) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Fire)") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_START("KEY.3") /* line 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('C') PORT_CHAR(0x03) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('K') PORT_CHAR(0x0b) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('S') PORT_CHAR(0x13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(0x0a) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_START("KEY.4") /* line 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('D') PORT_CHAR(0x04) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('L') PORT_CHAR(0x0c) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('T') PORT_CHAR(0x14) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |")PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(0x03) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_START("KEY.5") /* line 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('E') PORT_CHAR(0x05) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('M') PORT_CHAR(0x0d) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('U') PORT_CHAR(0x15) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_START("KEY.6") /* line 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('F') PORT_CHAR(0x06) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('N') PORT_CHAR(0x0e) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('V') PORT_CHAR(0x16) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x7f) PORT_CHAR(0x1f) // natural kbd, press ctrl-backspace to DEL - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_START("KEY.7") /* line 7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('G') PORT_CHAR(0x07) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('O') PORT_CHAR(0x0f) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('W') PORT_CHAR(0x17) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(' ') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(0x80) // port_char doesn't work, no equivalent key - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - /* Enhanced options not available on real hardware */ - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x01, DEF_STR(Yes)) - PORT_CONFNAME( 0x02, 0x02, "2 MHz always") - PORT_CONFSETTING( 0x02, DEF_STR(No)) - PORT_CONFSETTING( 0x00, DEF_STR(Yes)) - PORT_CONFNAME( 0x04, 0x04, "Screen on always") - PORT_CONFSETTING( 0x04, DEF_STR(No)) - PORT_CONFSETTING( 0x00, DEF_STR(Yes)) - PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") - PORT_CONFSETTING( 0x08, DEF_STR(On)) - PORT_CONFSETTING( 0x00, DEF_STR(Off)) -INPUT_PORTS_END - -static INPUT_PORTS_START( super80d ) - PORT_START("DSW") - PORT_BIT( 0xf, 0xf, IPT_UNUSED ) - PORT_DIPNAME( 0x10, 0x00, "Switch A") PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x10, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x20, 0x20, "Switch B") PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x20, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x40, 0x40, "Switch C") PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x40, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x80, 0x00, "Switch D") PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x80, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - - PORT_START("KEY.0") /* line 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(0x00) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(0x08) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(0x10) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(0x18) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT) - PORT_START("KEY.1") /* line 1 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(0x01) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(0x09) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(0x11) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(0x19) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("KEY.2") /* line 2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(0x02) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(0x0a) // port_char 0x0a is hijacked to 0x0d - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(0x12) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(0x1a) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Fire)") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_START("KEY.3") /* line 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(0x03) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(0x0b) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(0x13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1b) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(0x0a) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_START("KEY.4") /* line 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(0x04) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(0x0c) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(0x14) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |")PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(0x03) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_START("KEY.5") /* line 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(0x05) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(0x0d) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(0x15) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1d) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Left)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_START("KEY.6") /* line 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(0x06) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(0x0e) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(0x16) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x5f) PORT_CHAR(0x1f) // natural kbd, press ctrl-backspace to DEL - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Down)") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_START("KEY.7") /* line 7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(0x07) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(0x0f) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(0x17) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(' ') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(0x80) // port_char doesn't work, no equivalent key - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Up)") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - /* Enhanced options not available on real hardware */ - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x01, DEF_STR(Yes)) - PORT_CONFNAME( 0x02, 0x02, "2 MHz always") - PORT_CONFSETTING( 0x02, DEF_STR(No)) - PORT_CONFSETTING( 0x00, DEF_STR(Yes)) - PORT_CONFNAME( 0x04, 0x04, "Screen on always") - PORT_CONFSETTING( 0x04, DEF_STR(No)) - PORT_CONFSETTING( 0x00, DEF_STR(Yes)) - PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") - PORT_CONFSETTING( 0x08, DEF_STR(On)) - PORT_CONFSETTING( 0x00, DEF_STR(Off)) -INPUT_PORTS_END - -static INPUT_PORTS_START( super80m ) - PORT_INCLUDE( super80d ) - - PORT_MODIFY("CONFIG") - - /* Enhanced options not available on real hardware */ - PORT_CONFNAME( 0x10, 0x10, "Swap CharGens") - PORT_CONFSETTING( 0x10, DEF_STR(No)) - PORT_CONFSETTING( 0x00, DEF_STR(Yes)) - PORT_CONFNAME( 0x60, 0x40, "Colour") - PORT_CONFSETTING( 0x60, "MonoChrome") - PORT_CONFSETTING( 0x40, "Green") - PORT_CONFSETTING( 0x00, "Composite") - PORT_CONFSETTING( 0x20, "RGB") -INPUT_PORTS_END - -static INPUT_PORTS_START( super80v ) - PORT_INCLUDE( super80m ) - - PORT_MODIFY("CONFIG") - PORT_BIT( 0x16, 0x16, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( super80r ) - PORT_INCLUDE( super80v ) - - PORT_MODIFY("CONFIG") - PORT_BIT( 0x16, 0x16, IPT_UNUSED ) - PORT_CONFNAME( 0x60, 0x40, "Colour") - PORT_CONFSETTING( 0x60, "MonoChrome") - PORT_CONFSETTING( 0x40, "Green") -INPUT_PORTS_END - - -/**************************** F4 CHARACTER DISPLAYER ***********************************************************/ - -static const gfx_layout super80_charlayout = -{ - 8,10, /* 8 x 10 characters */ - 64, /* 64 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8, 1*8, 3*8, 5*8, 7*8, 9*8, 11*8, 13*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static const gfx_layout super80d_charlayout = -{ - 8,10, /* 8 x 10 characters */ - 128, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8, 1*8, 3*8, 5*8, 7*8, 9*8, 11*8, 13*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static const gfx_layout super80e_charlayout = -{ - 8,10, /* 8 x 10 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8, 1*8, 3*8, 5*8, 7*8, 9*8, 11*8, 13*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static const gfx_layout super80v_charlayout = -{ - 8,16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( super80 ) - GFXDECODE_ENTRY( "chargen", 0x0000, super80_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( super80d ) - GFXDECODE_ENTRY( "chargen", 0x0000, super80d_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( super80e ) - GFXDECODE_ENTRY( "chargen", 0x0000, super80e_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( super80m ) - GFXDECODE_ENTRY( "chargen", 0x0000, super80e_charlayout, 0, 8 ) - GFXDECODE_ENTRY( "chargen", 0x1000, super80d_charlayout, 0, 8 ) -GFXDECODE_END - -/* This will show the 128 characters in the ROM + whatever happens to be in the PCG */ -static GFXDECODE_START( super80v ) - GFXDECODE_ENTRY( "maincpu", 0xf000, super80v_charlayout, 0, 8 ) -GFXDECODE_END - - - -/**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/ - - -static const z80_daisy_config super80_daisy_chain[] = -{ - { "z80pio" }, - { NULL } -}; - -//------------------------------------------------- -// Z80DMA -//------------------------------------------------- - -WRITE_LINE_MEMBER( super80_state::busreq_w ) -{ -// since our Z80 has no support for BUSACK, we assume it is granted immediately - m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); - m_maincpu->set_input_line(INPUT_LINE_HALT, state); // do we need this? - m_dma->bai_w(state); // tell dma that bus has been granted -} - -READ8_MEMBER(super80_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(super80_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - prog_space.write_byte(offset, data); -} - -READ8_MEMBER(super80_state::io_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(super80_state::io_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - prog_space.write_byte(offset, data); -} - -static SLOT_INTERFACE_START( super80_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( super80, super80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) /* 2 MHz */ - MCFG_CPU_PROGRAM_MAP(super80_map) - MCFG_CPU_IO_MAP(super80_io) - MCFG_CPU_CONFIG(super80_daisy_chain) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, MASTER_CLOCK/6) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(super80_state, pio_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(super80_state,pio_port_b_r)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(48.8) - MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) - MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", super80) - MCFG_DEFAULT_LAYOUT( layout_super80 ) - MCFG_VIDEO_START_OVERRIDE(super80_state,super80) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", super80_state, super80, "bin", 3) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", super80_state, timer_p, attotime::from_hz(40000)) // cass read - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", super80_state, timer_k, attotime::from_hz(300)) // keyb scan - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_h", super80_state, timer_h, attotime::from_hz(100)) // half-speed -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( super80d, super80 ) - MCFG_GFXDECODE_MODIFY("gfxdecode", super80d) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80d) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( super80e, super80 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(super80e_io) - MCFG_GFXDECODE_MODIFY("gfxdecode", super80e) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80e) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( super80m, super80 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(super80m_map) - - MCFG_GFXDECODE_MODIFY("gfxdecode", super80m) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(32) - MCFG_PALETTE_INIT_OWNER(super80_state,super80m) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80m) - MCFG_SCREEN_VBLANK_DRIVER(super80_state, screen_eof_super80m) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( super80v, super80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) /* 2 MHz */ - MCFG_CPU_PROGRAM_MAP(super80v_map) - MCFG_CPU_IO_MAP(super80v_io) - MCFG_CPU_CONFIG(super80_daisy_chain) - - MCFG_DEVICE_ADD("z80pio", Z80PIO, MASTER_CLOCK/6) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(super80_state, pio_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(super80_state,pio_port_b_r)) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, SUPER80V_SCREEN_WIDTH-1, 0, SUPER80V_SCREEN_HEIGHT-1) - MCFG_SCREEN_UPDATE_DRIVER(super80_state, screen_update_super80v) - MCFG_SCREEN_VBLANK_DRIVER(super80_state, screen_eof_super80m) - - MCFG_PALETTE_ADD("palette", 32) - MCFG_PALETTE_INIT_OWNER(super80_state,super80m) - - MCFG_MC6845_ADD("crtc", MC6845, "screen", MASTER_CLOCK / SUPER80V_DOTS) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(SUPER80V_DOTS) - MCFG_MC6845_UPDATE_ROW_CB(super80_state, crtc_update_row) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", super80v) - MCFG_DEFAULT_LAYOUT( layout_super80 ) - MCFG_VIDEO_START_OVERRIDE(super80_state,super80v) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", super80_state, super80, "bin", 3) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", super80_state, timer_p, attotime::from_hz(40000)) // cass read - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", super80_state, timer_k, attotime::from_hz(300)) // keyb scan -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( super80r, super80v ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(super80r_io) - - MCFG_DEVICE_ADD("dma", Z80DMA, MASTER_CLOCK/6) - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(super80_state, busreq_w)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - //ba0 - not connected - MCFG_Z80DMA_IN_MREQ_CB(READ8(super80_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(super80_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(super80_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(super80_state, io_write_byte)) - - MCFG_WD2793_ADD("fdc", XTAL_2MHz) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", super80_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", super80_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -/**************************** ROMS *****************************************************************/ - -ROM_START( super80 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("super80.u26", 0xc000, 0x1000, CRC(6a6a9664) SHA1(2c4fcd943aa9bf7419d58fbc0e28ffb89ef22e0b) ) - ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) - ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_FILL( 0xf000, 0x1000, 0xff) /* This makes the screen show the FF character when O F1 F0 entered */ - - ROM_REGION(0x0400, "chargen", 0) // 2513 prom - ROM_LOAD("super80.u27", 0x0000, 0x0400, CRC(d1e4b3c6) SHA1(3667b97c6136da4761937958f281609690af4081) ) -ROM_END - -ROM_START( super80d ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "super80d", "V2.2") - ROMX_LOAD("super80d.u26", 0xc000, 0x1000, CRC(cebd2613) SHA1(87b94cc101a5948ce590211c68272e27f4cbe95a), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "super80f", "MDS (original)") - ROMX_LOAD("super80f.u26", 0xc000, 0x1000, CRC(d39775f0) SHA1(b47298ee028924612e9728bb2debd0f47399add7), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "super80g", "MDS (upgraded)") - ROMX_LOAD("super80g.u26", 0xc000, 0x1000, CRC(7386f507) SHA1(69d7627033d62bd4e886ccc136e89f1524d38f47), ROM_BIOS(3)) - ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) - ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_FILL( 0xf000, 0x1000, 0xff) - - ROM_REGION(0x0800, "chargen", 0) // 2716 eprom - ROM_LOAD("super80d.u27", 0x0000, 0x0800, CRC(cb4c81e2) SHA1(8096f21c914fa76df5d23f74b1f7f83bd8645783) ) -ROM_END - -ROM_START( super80e ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("super80e.u26", 0xc000, 0x1000, CRC(bdc668f8) SHA1(3ae30b3cab599fca77d5e461f3ec1acf404caf07) ) - ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) - ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_FILL( 0xf000, 0x1000, 0xff) - - ROM_REGION(0x1000, "chargen", 0) // 2732 eprom - ROM_LOAD("super80e.u27", 0x0000, 0x1000, CRC(ebe763a7) SHA1(ffaa6d6a2c5dacc5a6651514e6707175a32e83e8) ) -ROM_END - -ROM_START( super80m ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "8r0", "8R0") - ROMX_LOAD("s80-8r0.u26", 0xc000, 0x1000, CRC(48d410d8) SHA1(750d984abc013a3344628300288f6d1ba140a95f), ROM_BIOS(1) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(1) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(1) ) -#if 0 - /* Temporary patch to fix crash when lprinting a tab */ - ROM_FILL(0xcc44,1,0x46) - ROM_FILL(0xcc45,1,0xc5) - ROM_FILL(0xcc46,1,0x06) - ROM_FILL(0xcc47,1,0x20) - ROM_FILL(0xcc48,1,0xcd) - ROM_FILL(0xcc49,1,0xc7) - ROM_FILL(0xcc4a,1,0xcb) - ROM_FILL(0xcc4b,1,0xc1) - ROM_FILL(0xcc4c,1,0x10) - ROM_FILL(0xcc4d,1,0xf7) - ROM_FILL(0xcc4e,1,0x00) - ROM_FILL(0xcc4f,1,0x00) -#endif - ROM_SYSTEM_BIOS(1, "v37", "V3.7") - ROMX_LOAD("s80-v37.u26", 0xc000, 0x1000, CRC(46043035) SHA1(1765105df4e4af83d56cafb88e158ed462d4709e), ROM_BIOS(2) ) - ROMX_LOAD("s80-v37.u33", 0xd000, 0x1000, CRC(afb52b15) SHA1(0a2c25834074ce44bf12ac8532b4add492bcf950), ROM_BIOS(2) ) - ROMX_LOAD("s80-v37.u42", 0xe000, 0x1000, CRC(7344b27a) SHA1(f43fc47ddb5c12bffffa63488301cd5eb386cc9a), ROM_BIOS(2) ) - - ROM_SYSTEM_BIOS(2, "8r2", "8R2") - ROMX_LOAD("s80-8r2.u26", 0xc000, 0x1000, CRC(1e166c8c) SHA1(15647614be9300cdd2956da913e83234c36b36a9), ROM_BIOS(3) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(3) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(3) ) - - ROM_SYSTEM_BIOS(3, "8r3", "8R3") - ROMX_LOAD("s80-8r3.u26", 0xc000, 0x1000, CRC(ee7dd90b) SHA1(c53f8eef82e8f943642f6ddfc2cb1bfdc32d25ca), ROM_BIOS(4) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(4) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(4) ) - - ROM_SYSTEM_BIOS(4, "8r4", "8R4") - ROMX_LOAD("s80-8r4.u26", 0xc000, 0x1000, CRC(637d001d) SHA1(f26b5ecc33fd44b05b1f199d79e0f072ec8d0e23), ROM_BIOS(5) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(5) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(5) ) - - ROM_SYSTEM_BIOS(5, "8r5", "8R5") - ROMX_LOAD("s80-8r5.u26", 0xc000, 0x1000, CRC(294f217c) SHA1(f352d54e84e94bf299726dc3af4eb7b2d06d317c), ROM_BIOS(6) ) - ROMX_LOAD("s80-8r0.u33", 0xd000, 0x1000, CRC(9765793e) SHA1(4951b127888c1f3153004cc9fb386099b408f52c), ROM_BIOS(6) ) - ROMX_LOAD("s80-8r0.u42", 0xe000, 0x1000, CRC(5f65d94b) SHA1(fe26b54dec14e1c4911d996c9ebd084a38dcb691), ROM_BIOS(6) ) - - ROM_REGION(0x1800, "chargen", 0) - ROM_LOAD("super80e.u27", 0x0000, 0x1000, CRC(ebe763a7) SHA1(ffaa6d6a2c5dacc5a6651514e6707175a32e83e8) ) - ROM_LOAD("super80d.u27", 0x1000, 0x0800, CRC(cb4c81e2) SHA1(8096f21c914fa76df5d23f74b1f7f83bd8645783) ) -ROM_END - -ROM_START( super80r ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS(0, "super80r", "MCE (original)") - ROMX_LOAD("super80r.u26", 0xc000, 0x1000, CRC(01bb6406) SHA1(8e275ecf5141b93f86e45ff8a735b965ea3e8d44), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "super80s", "MCE (upgraded)") - ROMX_LOAD("super80s.u26", 0xc000, 0x1000, CRC(3e29d307) SHA1(b3f4667633e0a4eb8577e39b5bd22e1f0bfbc0a9), ROM_BIOS(2)) - - ROM_LOAD("super80.u33", 0xd000, 0x1000, CRC(cf8020a8) SHA1(2179a61f80372cd49e122ad3364773451531ae85) ) - ROM_LOAD("super80.u42", 0xe000, 0x1000, CRC(a1c6cb75) SHA1(d644ca3b399c1a8902f365c6095e0bbdcea6733b) ) - ROM_LOAD("s80hmce.ic24", 0xf000, 0x0800, CRC(a6488a1e) SHA1(7ba613d70a37a6b738dcd80c2bb9988ff1f011ef) ) - - ROM_REGION( 0x1000, "videoram", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( super80v ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("s80-v37v.u26", 0xc000, 0x1000, CRC(01e0c0dd) SHA1(ef66af9c44c651c65a21d5bda939ffa100078c08) ) - ROM_LOAD("s80-v37v.u33", 0xd000, 0x1000, CRC(812ad777) SHA1(04f355bea3470a7d9ea23bb2811f6af7d81dc400) ) - ROM_LOAD("s80-v37v.u42", 0xe000, 0x1000, CRC(e02e736e) SHA1(57b0264c805da99234ab5e8e028fca456851a4f9) ) - ROM_LOAD("s80hmce.ic24", 0xf000, 0x0800, CRC(a6488a1e) SHA1(7ba613d70a37a6b738dcd80c2bb9988ff1f011ef) ) - - ROM_REGION( 0x1000, "videoram", ROMREGION_ERASEFF ) - ROM_REGION( 0x1000, "colorram", ROMREGION_ERASEFF ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1981, super80, 0, 0, super80, super80, super80_state, super80, "Dick Smith Electronics", "Super-80 (V1.2)" , 0) -COMP( 1981, super80d, super80, 0, super80d, super80d, super80_state, super80, "Dick Smith Electronics", "Super-80 (V2.2)" , 0) -COMP( 1981, super80e, super80, 0, super80e, super80d, super80_state, super80, "Dick Smith Electronics", "Super-80 (El Graphix 4)" , MACHINE_UNOFFICIAL) -COMP( 1981, super80m, super80, 0, super80m, super80m, super80_state, super80, "Dick Smith Electronics", "Super-80 (with colour)" , MACHINE_UNOFFICIAL) -COMP( 1981, super80r, super80, 0, super80r, super80r, super80_state, super80, "Dick Smith Electronics", "Super-80 (with VDUEB)" , MACHINE_UNOFFICIAL) -COMP( 1981, super80v, super80, 0, super80v, super80v, super80_state, super80, "Dick Smith Electronics", "Super-80 (with enhanced VDUEB)" , MACHINE_UNOFFICIAL) diff --git a/src/mess/drivers/supercon.c b/src/mess/drivers/supercon.c deleted file mode 100644 index 7c286f6b4c2..00000000000 --- a/src/mess/drivers/supercon.c +++ /dev/null @@ -1,811 +0,0 @@ -// license:??? -// copyright-holders:Ralf Schaefer, Robbbert -/****************************************************************************** - Novag SuperConstellation Chess Computer - 2010 R. Schaefer - - - CPU 6502 - Clock 4 MHz - IRQ CLK 600 Hz - - RAM 0x0000, 0x0fff) - ROM 0x2000, 0xffff) - I/O 0x1c00 Unknown - 0x1d00 Unknown - 0x1e00 LED's and buttons - 0x1f00 LED's, buttons and buzzer - - -******************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "sound/beep.h" - - -class supercon_state : public driver_device -{ -public: - supercon_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_beep(*this, "beeper"), - m_b_white(*this, "B_WHITE"), - m_b_black(*this, "B_BLACK"), - m_b_clr(*this, "B_CLR"), - m_status_1(*this, "STATUS_1"), - m_status_2(*this, "STATUS_2"), - m_status_3(*this, "STATUS_3"), - m_status_4(*this, "STATUS_4"), - m_status_5(*this, "STATUS_5"), - m_status_6(*this, "STATUS_6"), - m_status_7(*this, "STATUS_7"), - m_status_8(*this, "STATUS_8"), - m_board_1(*this, "BOARD_1"), - m_board_2(*this, "BOARD_2"), - m_board_3(*this, "BOARD_3"), - m_board_4(*this, "BOARD_4"), - m_board_5(*this, "BOARD_5"), - m_board_6(*this, "BOARD_6"), - m_board_7(*this, "BOARD_7"), - m_board_8(*this, "BOARD_8") { } - - required_device m_maincpu; - required_device m_beep; - DECLARE_READ8_MEMBER(supercon_port1_r); - DECLARE_READ8_MEMBER(supercon_port2_r); - DECLARE_READ8_MEMBER(supercon_port3_r); - DECLARE_READ8_MEMBER(supercon_port4_r); - DECLARE_WRITE8_MEMBER(supercon_port1_w); - DECLARE_WRITE8_MEMBER(supercon_port2_w); - DECLARE_WRITE8_MEMBER(supercon_port3_w); - DECLARE_WRITE8_MEMBER(supercon_port4_w); - static const UINT8 m_border_pieces[12]; - emu_timer* m_timer_update_irq; - emu_timer* m_timer_mouse_click; - int m_emu_started; - int m_moving_piece; - UINT8 m_data_1E00; - UINT8 m_data_1F00; - UINT8 m_LED_18; - UINT8 m_LED_AH; - UINT8 m_LED_ST; - UINT8 *m_last_LED; - UINT8 m_last_LED_value; - int m_led_update; - int m_remove_led_flag; - int m_selecting; - int m_save_key_data; - attotime m_wait_time; - int *m_current_field; - int m_confirm_board_click; - int m_board[64]; - int m_save_board[64]; - void set_board(); - void set_pieces(); - void set_border_pieces(); - void clear_pieces(); - void update_leds(); - virtual void machine_reset(); - DECLARE_DRIVER_INIT(supercon); - virtual void machine_start(); - TIMER_CALLBACK_MEMBER(mouse_click); - TIMER_CALLBACK_MEMBER(update_irq); - TIMER_DEVICE_CALLBACK_MEMBER(update_artwork); - void board_presave(); - void board_postload(); - -protected: - required_ioport m_b_white; - required_ioport m_b_black; - required_ioport m_b_clr; - required_ioport m_status_1; - required_ioport m_status_2; - required_ioport m_status_3; - required_ioport m_status_4; - required_ioport m_status_5; - required_ioport m_status_6; - required_ioport m_status_7; - required_ioport m_status_8; - required_ioport m_board_1; - required_ioport m_board_2; - required_ioport m_board_3; - required_ioport m_board_4; - required_ioport m_board_5; - required_ioport m_board_6; - required_ioport m_board_7; - required_ioport m_board_8; - void mouse_update(); - int get_first_cleared_bit(UINT8 data); - int get_first_bit(UINT8 data); -}; - - -#define VERBOSE 0 -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -enum -{ - EM, /*No piece*/ - BP, - BN, - BB, - BR, - BQ, - BK, - WP, - WN, - WB, - WR, - WQ, - WK -}; - - -#define LED_LINE_AH 0x10 -#define LED_LINE_ST 0x20 -#define LED_LINE_18 0x40 - - -#define MAIN_CLOCK 4000000 /* 4 MHz */ - -#define NOT_VALID 99 - -#define NO_ACTION 0 -#define TAKE 1 -#define SET 2 - -/* artwork board */ - -const UINT8 supercon_state::m_border_pieces[12] = {WK,WQ,WR,WB,WN,WP,BK,BQ,BR,BB,BN,BP}; - -void supercon_state::set_board() -{ - static const int start_board[64] = { - BR, BN, BB, BQ, BK, BB, BN, BR, - BP, BP, BP, BP, BP, BP, BP, BP, - EM, EM, EM, EM, EM, EM, EM, EM, - EM, EM, EM, EM, EM, EM, EM, EM, - EM, EM, EM, EM, EM, EM, EM, EM, - EM, EM, EM, EM, EM, EM, EM, EM, - WP, WP, WP, WP, WP, WP, WP, WP, - WR, WN, WB, WQ, WK, WB, WN, WR }; - - for (UINT8 i=0; i<64; i++) - m_board[i]=start_board[i]; -} - -void supercon_state::set_pieces() -{ - int i; - for (i=0;i<64;i++) - output_set_indexed_value("P", i, m_board[i]); -} - -void supercon_state::set_border_pieces() -{ - UINT8 i; - - for (i=0;i<12;i++) - output_set_indexed_value("Q", i, m_border_pieces[i]); -} - -void supercon_state::clear_pieces() -{ - int i; - for (i=0;i<64;i++) - { - output_set_indexed_value("P", i, EM); - m_board[i]=EM; - } -} - -int supercon_state::get_first_cleared_bit(UINT8 data) -{ - int i; - - for (i = 0; i < 8; i++) - if (!BIT(data, i)) - return i; - - return NOT_VALID; -} - -int supercon_state::get_first_bit(UINT8 data) -{ - int i; - - for (i = 0; i < 8; i++) - if (BIT(data, i)) - return i; - - return NOT_VALID; -} - - -void supercon_state::update_leds() -{ - int i; - - for (i = 0; i < 8; i++) - { - if (BIT(m_LED_18, i)) - output_set_led_value(i + 1, 1); - else - output_set_led_value(i + 1, 0); - - if (BIT(m_LED_AH, i)) - output_set_led_value(i + 9, 1); - else - output_set_led_value(i + 9, 0); - - if (BIT(m_LED_ST, i)) - output_set_led_value(i + 17, 1); - else - output_set_led_value(i + 17, 0); - } -} - -void supercon_state::mouse_update() -{ - UINT8 port_input; // m_left; - int i; - -/* border pieces and moving piece */ - - port_input = m_b_white->read(); - if (port_input) - { - i = get_first_bit(port_input); - m_moving_piece = m_border_pieces[i]; - output_set_value("MOVING", m_moving_piece); - return; - } - - - port_input = m_b_black->read(); - if (port_input) - { - i = get_first_bit(port_input); - m_moving_piece = m_border_pieces[6+i]; - output_set_value("MOVING", m_moving_piece); - return; - } - - - port_input = m_b_clr->read(); - if (port_input) - { - if (m_moving_piece) - { - m_moving_piece=0; - output_set_value("MOVING", m_moving_piece); - return; - } - } -} - -/* Driver initialization */ - -DRIVER_INIT_MEMBER(supercon_state,supercon) -{ - m_LED_18=0; - m_LED_AH=0; - m_LED_ST=0; - - m_wait_time = attotime::from_hz(4); - m_save_key_data = 0xff; - - m_moving_piece=0; -} - -/* Read 1C000 */ - -READ8_MEMBER( supercon_state::supercon_port1_r ) -{ - LOG(("Read from %04x \n",0x1C00)); - return 0xff; -} - -/* Read 1D000 */ - -READ8_MEMBER( supercon_state::supercon_port2_r ) -{ - LOG(("Read from %04x \n",0x1D00)); - return 0xff; -} - -/* Read 1E00 */ - -READ8_MEMBER( supercon_state::supercon_port3_r ) -{ - int i; - UINT8 key_data=0; - - static const char *const status_lines[8] = - { "STATUS_1", "STATUS_2", "STATUS_3", "STATUS_4", "STATUS_5", "STATUS_6", "STATUS_7", "STATUS_8" }; - - LOG(("Read from %04x \n",0x1E00)); - -/* remove last bit (only if it was not already set) */ - - if ( m_data_1F00 & LED_LINE_AH ) - { - if (m_last_LED_value != m_LED_AH) - m_LED_AH=m_LED_AH & ~m_data_1E00; - } - else if ( m_data_1F00 & LED_LINE_ST) - { - if (m_last_LED_value != m_LED_ST) - m_LED_ST=m_LED_ST & ~m_data_1E00; - } - else if ( m_data_1F00 & LED_LINE_18 ) - { - if (m_last_LED_value != m_LED_18) - m_LED_18=m_LED_18 & ~m_data_1E00; - } - - - LOG(("LED_18 from %02x \n",m_LED_18)); - LOG(("LED_AH from %02x \n",m_LED_AH)); - LOG(("LED_ST from %02x \n",m_LED_ST)); - - if (m_led_update) /*No LED Update if Port 1C00,1D00 was read */ - update_leds(); - - m_remove_led_flag=TRUE; - m_led_update=TRUE; - - m_LED_18=0; - m_LED_AH=0; - m_LED_ST=0; - - -/* Start */ - - if (!m_emu_started) - return 0xbf; - else - m_timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(598) ); //HACK adjust timer after start ??? - - -/* Buttons */ - - i=get_first_bit(m_data_1E00); - if (i==NOT_VALID) - return 0xff; - - switch ( i ) - { - case 0: key_data=m_status_1->read(); break; - case 1: key_data=m_status_2->read(); break; - case 2: key_data=m_status_3->read(); break; - case 3: key_data=m_status_4->read(); break; - case 4: key_data=m_status_5->read(); break; - case 5: key_data=m_status_6->read(); break; - case 6: key_data=m_status_7->read(); break; - case 7: key_data=m_status_8->read(); break; - } - - if (key_data != 0xc0) - { - LOG(("%s, key_data: %02x \n",status_lines[i],key_data)); - -/* Button: New Game -> initialize board */ - - if (i==0 && key_data==0x80) - { - set_board(); - set_pieces(); - - m_emu_started=FALSE; - } - -/* Button: Clear Board -> remove all pieces */ - - if (i==3 && key_data==0x80) - clear_pieces(); - - if (key_data != 0xff ) - return key_data; - } - - return 0xc0; -} - -/* Read Port $1F00 */ - -READ8_MEMBER( supercon_state::supercon_port4_r ) -{ - int i_18, i_AH; - UINT8 key_data = 0x00; - - static const char *const board_lines[8] = - { "BOARD_1", "BOARD_2", "BOARD_3", "BOARD_4", "BOARD_5", "BOARD_6", "BOARD_7", "BOARD_8" }; - - LOG(("Read from %04x \n",0x1F00)); - -/* Board buttons */ - - i_18=get_first_bit(m_data_1E00); - if (i_18==NOT_VALID) - return 0xff; - -/* if a button was pressed wait til timer -timer_mouse_click- is fired */ - - if (m_selecting) - return m_save_key_data; - else - { - set_pieces(); - output_set_value("MOVING",m_moving_piece); - } - - switch ( i_18 ) - { - case 0: key_data=m_board_1->read(); break; - case 1: key_data=m_board_2->read(); break; - case 2: key_data=m_board_3->read(); break; - case 3: key_data=m_board_4->read(); break; - case 4: key_data=m_board_5->read(); break; - case 5: key_data=m_board_6->read(); break; - case 6: key_data=m_board_7->read(); break; - case 7: key_data=m_board_8->read(); break; - } - - if (key_data != 0xff) - { - LOG(("%s key_data: %02x \n",board_lines[i_18],key_data)); - -/* Only if valid data */ - - if (key_data) - { -/* Set or remove pieces */ - - i_AH=7-get_first_cleared_bit(key_data); - LOG(("Press -> AH: %d 18: %d Piece: %d\n",i_AH,i_18,m_board[i_18*8 + i_AH]);); - - m_current_field=&m_board[i_18*8 + i_AH]; - - if (m_moving_piece) - { - *m_current_field = m_moving_piece; - m_moving_piece = EM; - } - else - { - m_moving_piece = *m_current_field; - *m_current_field = EM; - } - m_selecting=TRUE; /* Flag is removed in timer -timer_mouse_click- */ - m_save_key_data=key_data; /* return same key_data til flag selecting is removed */ - - m_timer_mouse_click->adjust(m_wait_time, 0); - - return key_data; - } - } - - return 0xff; -} - -/* Write Port $1C00 */ - -WRITE8_MEMBER( supercon_state::supercon_port1_w ) -{ - LOG(("Write from %04x data: %02x\n",0x1C00,data)); - m_led_update=FALSE; -} - -/* Write Port $1D00 */ - -WRITE8_MEMBER( supercon_state::supercon_port2_w ) -{ - LOG(("Write from %04x data: %02x\n",0x1D00,data)); - m_led_update=FALSE; -} - -/* Write Port $1E00 */ - -WRITE8_MEMBER( supercon_state::supercon_port3_w ) -{ - if (data) - LOG(("Write from %04x data: %02x\n",0x1E00,data)); - - if (data) - { - m_data_1E00=data; - -/* Set bits for LED's */ - - if ( m_data_1F00) - { - if (m_data_1F00 & LED_LINE_AH ) - { - m_last_LED = &m_LED_AH; /* save last value */ - m_last_LED_value = *m_last_LED; - - m_LED_AH=m_LED_AH | m_data_1E00; - } - else if (m_data_1F00 & LED_LINE_ST ) - { - m_last_LED = &m_LED_ST; - m_last_LED_value = *m_last_LED; - - m_LED_ST=m_LED_ST | m_data_1E00; - } - else if (m_data_1F00 & LED_LINE_18) - { - m_last_LED = &m_LED_18; - m_last_LED_value = *m_last_LED; - - m_LED_18=m_LED_18 | m_data_1E00; - } - } - } - - // The IRQ handler writes to both 0x1E00 (1x) and 0x1F00 (2x) ports. - // Not 100% sure if this is the correct place for clearing the IRQ - // line. - m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); -} - -/* Write Port $1F00 */ - -WRITE8_MEMBER( supercon_state::supercon_port4_w ) -{ - if (data) - LOG(("Write from %04x data: %02x\n",0x1F00,data)); - - if (data) - m_data_1F00=data; - -/* Bit 7 is set -> Buzzer on */ - - if ( m_data_1F00 & 0x80 ) - { - m_beep->set_state(1); - m_emu_started=TRUE; - } - else - m_beep->set_state(0); -} - -TIMER_CALLBACK_MEMBER(supercon_state::mouse_click) -{ - m_selecting=FALSE; -} - -TIMER_DEVICE_CALLBACK_MEMBER(supercon_state::update_artwork) -{ - mouse_update(); -} - -TIMER_CALLBACK_MEMBER(supercon_state::update_irq) -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); -} - -/* Save state call backs */ - -void supercon_state::board_presave() -{ - for (int i=0;i<64;i++) - { - m_save_board[i] = m_board[i]; - } -} - -void supercon_state::board_postload() -{ - for (int i=0;i<64;i++) - { - m_board[i] = m_save_board[i]; - } - - set_pieces(); -} - -void supercon_state::machine_start() -{ - m_timer_update_irq = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supercon_state::update_irq),this)); - m_timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(1000) ); - m_timer_mouse_click = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supercon_state::mouse_click),this),NULL); - save_item(NAME(m_save_board)); - machine().save().register_postload(save_prepost_delegate(FUNC(supercon_state::board_postload),this)); - machine().save().register_presave(save_prepost_delegate(FUNC(supercon_state::board_presave),this)); -} - -void supercon_state::machine_reset() -{ - set_board(); - set_pieces(); - set_border_pieces(); - - m_emu_started=FALSE; -} - -/* Address maps */ - -static ADDRESS_MAP_START(supercon_mem, AS_PROGRAM, 8, supercon_state) - AM_RANGE( 0x0000, 0x0fff) AM_RAM - AM_RANGE( 0x2000, 0x7fff) AM_ROM - AM_RANGE( 0x8000, 0xffff) AM_ROM - - AM_RANGE( 0x1C00, 0x1C00) AM_WRITE ( supercon_port1_w ) - AM_RANGE( 0x1D00, 0x1D00) AM_WRITE ( supercon_port2_w ) - AM_RANGE( 0x1E00, 0x1E00) AM_WRITE ( supercon_port3_w ) - AM_RANGE( 0x1F00, 0x1F00) AM_WRITE ( supercon_port4_w ) - - AM_RANGE( 0x1C00, 0x1C00) AM_READ ( supercon_port1_r ) - AM_RANGE( 0x1D00, 0x1D00) AM_READ ( supercon_port2_r ) - AM_RANGE( 0x1E00, 0x1E00) AM_READ ( supercon_port3_r ) - AM_RANGE( 0x1F00, 0x1F00) AM_READ ( supercon_port4_r ) -ADDRESS_MAP_END - -/* Input ports */ - -static INPUT_PORTS_START( supercon ) - - PORT_START("BOARD_1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("BOARD_2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("BOARD_3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("BOARD_4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("BOARD_5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("BOARD_6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("BOARD_7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("BOARD_8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("STATUS_1") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("STATUS_2") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("STATUS_3") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("STATUS_4") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("STATUS_5") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("STATUS_6") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("STATUS_7") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("STATUS_8") - PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("B_WHITE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_BLACK") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_CLR") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - -INPUT_PORTS_END - -/* Machine driver */ -static MACHINE_CONFIG_START( supercon, supercon_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6502,MAIN_CLOCK) - MCFG_CPU_PROGRAM_MAP(supercon_mem) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", supercon_state, update_artwork, attotime::from_hz(20)) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START(supercon) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("supercon_low.bin", 0x0000, 0x8000, CRC(b853cf6e) SHA1(1a759072a5023b92c07f1fac01b7a21f7b5b45d0 )) - ROM_LOAD("supercon_high.bin", 0x8000, 0x8000, CRC(c8f82331) SHA1(f7fd039f9a3344db9749931490ded9e9e309cfbe )) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1983, supercon, 0, 0, supercon, supercon, supercon_state, supercon, "Novag", "SuperConstellation", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mess/drivers/superslave.c b/src/mess/drivers/superslave.c deleted file mode 100644 index 440edac81de..00000000000 --- a/src/mess/drivers/superslave.c +++ /dev/null @@ -1,411 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/************************************************************************** - -Monitor commands -Dxxxx,yyyy = Dump memory -Fxxxx,yyyy,zz = Fill memory -Gxxxx = Goto -Ixx = In port -Lxxxx = Load -Mxxxx,yyyy,zzzz = Move x-y to z -Oxx,yy = Out port -- = Edit memory -. = Edit memory - - - TODO: - - - all - -****************************************************************************/ - -#include "includes/superslave.h" - - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( superslave_state::read ) -{ - UINT8 data = 0; - - offs_t boundry = 0xc000 | ((m_memctrl & 0xf0) << 6); - - if ((offset < 0x1000) && BIT(m_cmd, 0)) - { - data = m_rom->base()[offset & 0x7ff]; - } - else if (offset < boundry) - { - if (BIT(m_memctrl, 0)) - { - data = m_ram->pointer()[offset]; - } - else if (BIT(m_memctrl, 1) && (m_ram->size() > 0x10000)) - { - data = m_ram->pointer()[0x10000 | offset]; - } - } - else - { - data = m_ram->pointer()[offset]; - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( superslave_state::write ) -{ - offs_t boundry = 0xc000 | ((m_memctrl & 0xf0) << 6); - - if (offset < boundry) - { - if (BIT(m_memctrl, 0)) - { - m_ram->pointer()[offset] = data; - } - else if (BIT(m_memctrl, 1) && (m_ram->size() > 0x10000)) - { - m_ram->pointer()[0x10000 | offset] = data; - } - } - else - { - m_ram->pointer()[offset] = data; - } -} - - -//------------------------------------------------- -// baud_w - -//------------------------------------------------- - -WRITE8_MEMBER( superslave_state::baud_w ) -{ - m_dbrg->str_w(data & 0x0f); - m_dbrg->stt_w(data >> 4); -} - - -//------------------------------------------------- -// memctrl_w - -//------------------------------------------------- - -WRITE8_MEMBER( superslave_state::memctrl_w ) -{ - /* - - bit description - - 0 Memory bank 0 on - 1 Memory bank 1 on - 2 - 3 - 4 Unswitched memory boundary bit 0 - 5 Unswitched memory boundary bit 1 - 6 Unswitched memory boundary bit 2 - 7 Unswitched memory boundary bit 3 - - */ - - m_memctrl = data; -} - - -//------------------------------------------------- -// status_r - -//------------------------------------------------- - -READ8_MEMBER( superslave_state::status_r) -{ - /* - - bit description - - 0 Sense Switch (0=closed) - 1 Parity error (1=error) - 2 Syncerr (1=error) - 3 Service Request - 4 Data Set Ready 3 - 5 Data Set Ready 2 - 6 Data Set Ready 1 - 7 Data Set Ready 0 - - */ - - UINT8 data = 1; - - // RS-232 - data |= m_rs232d->dsr_r() << 4; - data |= m_rs232c->dsr_r() << 5; - data |= m_rs232b->dsr_r() << 6; - data |= m_rs232a->dsr_r() << 7; - - return data; -} - - -//------------------------------------------------- -// cmd_w - -//------------------------------------------------- - -WRITE8_MEMBER( superslave_state::cmd_w ) -{ - /* - - bit description - - 0 Prom enable (1=enabled) - 1 Clear Parity (1=cleared) - 2 Clear Syncerr (1=cleared) - 3 Service Request - 4 Wait Protocol (0=Wait) - 5 Command bit 5 - 6 Command bit 6 - 7 Command bit 7 - - */ - - m_cmd = data; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( superslave_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( superslave_mem, AS_PROGRAM, 8, superslave_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( superslave_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( superslave_io, AS_IO, 8, superslave_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(Z80DART_0_TAG, z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80DART_1_TAG, z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x10, 0x10) AM_MIRROR(0x03) AM_WRITE(baud_w) - AM_RANGE(0x14, 0x17) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read_alt, write_alt) - AM_RANGE(0x18, 0x1c) AM_DEVREADWRITE(AM9519_TAG, pic8259_device, read, write) - AM_RANGE(0x1d, 0x1d) AM_WRITE(memctrl_w) - AM_RANGE(0x1e, 0x1e) AM_NOP // master communications - AM_RANGE(0x1f, 0x1f) AM_READWRITE(status_r, cmd_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( superslave ) -//------------------------------------------------- - -static INPUT_PORTS_START( superslave ) - PORT_START("SW1") - PORT_DIPNAME( 0x7f, 0x38, "Slave Address" ) PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7") - PORT_DIPSETTING( 0x38, "70H (0)" ) - PORT_DIPSETTING( 0x39, "72H (1)" ) - PORT_DIPSETTING( 0x3a, "74H (2)" ) - PORT_DIPSETTING( 0x3b, "76H (3)" ) - PORT_DIPSETTING( 0x3c, "78H (4)" ) - PORT_DIPSETTING( 0x3d, "7AH (5)" ) - PORT_DIPSETTING( 0x3e, "7CH (6)" ) - PORT_DIPSETTING( 0x3f, "7EH (7)" ) - PORT_DIPSETTING( 0x40, "80H (8)" ) - PORT_DIPSETTING( 0x41, "82H (9)" ) - PORT_DIPSETTING( 0x42, "84H (10)" ) - PORT_DIPSETTING( 0x43, "86H (11)" ) - PORT_DIPSETTING( 0x44, "88H (12)" ) - PORT_DIPSETTING( 0x45, "8AH (13)" ) - PORT_DIPSETTING( 0x46, "8CH (14)" ) - PORT_DIPSETTING( 0x47, "8EH (15)" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// COM8116_INTERFACE( dbrg_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( superslave_state::fr_w ) -{ - m_dart0->rxca_w(state); - m_dart0->txca_w(state); - m_dart1->rxca_w(state); - m_dart1->txca_w(state); -} - -WRITE_LINE_MEMBER( superslave_state::ft_w ) -{ - m_dart0->rxtxcb_w(state); - m_dart1->rxtxcb_w(state); -} - - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - - -//------------------------------------------------- -// z80_daisy_config superslave_daisy_chain -//------------------------------------------------- - -static const z80_daisy_config superslave_daisy_chain[] = -{ - { Z80DART_0_TAG }, - { Z80DART_1_TAG }, - { Z80PIO_TAG }, - { NULL } -}; - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( superslave ) -//------------------------------------------------- - -void superslave_state::machine_start() -{ - // state saving - save_item(NAME(m_memctrl)); - save_item(NAME(m_cmd)); -} - - -void superslave_state::machine_reset() -{ - m_memctrl = 0x01; - m_cmd = 0x01; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( superslave ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( superslave, superslave_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) - MCFG_CPU_PROGRAM_MAP(superslave_mem) - MCFG_CPU_IO_MAP(superslave_io) - MCFG_CPU_CONFIG(superslave_daisy_chain) - - // devices - MCFG_PIC8259_ADD(AM9519_TAG, INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0), VCC, NULL) - - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_8MHz/2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_Z80DART_ADD(Z80DART_0_TAG, XTAL_8MHz/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, ctsa_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, dcdb_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_0_TAG, z80dart_device, ctsb_w)) - - MCFG_Z80DART_ADD(Z80DART_1_TAG, XTAL_8MHz/2, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_C_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_C_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_C_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_D_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_RS232_PORT_ADD(RS232_C_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, dcda_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, ctsa_w)) - - MCFG_RS232_PORT_ADD(RS232_D_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, dcdb_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(Z80DART_1_TAG, z80dart_device, ctsb_w)) - - MCFG_DEVICE_ADD(BR1941_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(superslave_state, fr_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE(superslave_state, ft_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("128K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( superslv ) -//------------------------------------------------- - -ROM_START( superslv ) - ROM_REGION( 0x800, Z80_TAG, 0 ) - ROM_LOAD( "adcs6_slave_v3.2.bin", 0x000, 0x800, CRC(7f39322d) SHA1(2e9621e09378a1bb6fc05317bb58ae7865e52744) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1983, superslv, 0, 0, superslave, superslave, driver_device, 0, "Advanced Digital Corporation", "Super Slave", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/supracan.c b/src/mess/drivers/supracan.c deleted file mode 100644 index baf2a4668f1..00000000000 --- a/src/mess/drivers/supracan.c +++ /dev/null @@ -1,1927 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese,Ryan Holtz -/*************************************************************************** - - - Funtech Super A'Can - ------------------- - - Preliminary driver by Angelo Salese - Improvements by Harmony - - -******************************************************************************* - -INFO: - - The system unit contains a reset button. - - Controllers: - - 4 directional buttons - - A, B, X, Y, buttons - - Start, select buttons - - L, R shoulder buttons - -STATUS: - - The driver is begging for a re-write or at least a split into video/supracan.c. It will happen eventually. - - Sound CPU comms and sound chip are completely unknown. - - There are 6 interrupt sources on the 6502 side, all of which use the IRQ line. - The register at 0x411 is bitmapped to indicate what source(s) are active. - In priority order from most to least important, they are: - - 411 value How acked Notes - 0x40 read reg 0x16 of sound chip likely timer. snd regs 0x16/0x17 are time constant, write 0 to reg 0x9f to start - 0x04 read at 0x405 latch 1? 0xcd is magic value - 0x08 read at 0x404 latch 2? 0xcd is magic value - 0x10 read at 0x409 unknown, dispatched but not used in startup 6502 code - 0x20 read at 0x40a possible periodic like vblank? - 0x80 read reg 0x14 of sound chip depends on reg 0x14 of sound chip & 0x40: if not set writes 0x8f to reg 0x14, - otherwise writes 0x4f to reg 0x14 and performs additional processing - - Known unemulated graphical effects and issues: - - All: Sprite sizing is still imperfect. - - All: Sprites need to be converted to use scanline rendering for proper clipping. - - All: Improperly-emulated 1bpp ROZ mode, used by the Super A'Can BIOS logo. - - All: Unimplemented ROZ scaling tables, used by the Super A'Can BIOS logo and Speedy Dragon intro, among others. - - All: Priorities are largely unknown. - - C.U.G.: Gameplay backgrounds are broken. - - Sango Fighter: Possible missing masking on the upper edges of the screen during gameplay. - - Sango Fighter: Raster effects off by 1 line - - Sango Fighter: Specifies tiles out of range of video ram?? - - Speedy Dragon: Backgrounds are broken (wrong tile bank/region). - - Super Taiwanese Baseball League: Does not boot, uses an unemulated DMA type - - Super Taiwanese Baseball League: Missing window effect applied on tilemaps? - - The Son of Evil: Many graphical issues. - - Visible area, looks like it should be 224 pixels high at most, most games need 8 off the top and 8 off the bottom (or a global scroll) - Sango looks like it needs 16 off the bottom instead - Visible area is almost certainly 224 as Son of Evil has an explicit check in the vblank handler - - - All: are ALL the layers ROZ capable?? - -DEBUG TRICKS: - - baseball game debug trick: - wpset e90020,1f,w - do pc=5ac40 - ... - do pc=5acd4 - wpclear - bp 0269E4 - [ff7be4] <- 0x269ec - bpclear - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "cpu/m6502/m6502.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define SOUNDCPU_BOOT_HACK (1) - -#define DRAW_DEBUG_ROZ (0) - -#define DRAW_DEBUG_UNK_SPRITE (0) - -#define DEBUG_PRIORITY (0) -#define DEBUG_PRIORITY_INDEX (0) // 0-3 - -#define VERBOSE_LEVEL (3) - -#define ENABLE_VERBOSE_LOG (1) - -struct acan_dma_regs_t -{ - UINT32 source[2]; - UINT32 dest[2]; - UINT16 count[2]; - UINT16 control[2]; -}; - -struct acan_sprdma_regs_t -{ - UINT32 src; - UINT16 src_inc; - UINT32 dst; - UINT16 dst_inc; - UINT16 count; - UINT16 control; -}; - -class supracan_state : public driver_device -{ -public: - supracan_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_soundcpu(*this, "soundcpu"), - m_cart(*this, "cartslot"), - m_vram(*this, "vram"), - m_soundram(*this, "soundram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { - m_m6502_reset = 0; - } - - required_device m_maincpu; - required_device m_soundcpu; - required_device m_cart; - - required_shared_ptr m_vram; - required_shared_ptr m_soundram; - - DECLARE_READ16_MEMBER(_68k_soundram_r); - DECLARE_WRITE16_MEMBER(_68k_soundram_w); - DECLARE_READ8_MEMBER(_6502_soundmem_r); - DECLARE_WRITE8_MEMBER(_6502_soundmem_w); - - void dma_w(address_space &space, int offset, UINT16 data, UINT16 mem_mask, int ch); - DECLARE_WRITE16_MEMBER(dma_channel0_w); - DECLARE_WRITE16_MEMBER(dma_channel1_w); - - DECLARE_READ16_MEMBER(sound_r); - DECLARE_WRITE16_MEMBER(sound_w); - DECLARE_READ16_MEMBER(video_r); - DECLARE_WRITE16_MEMBER(video_w); - DECLARE_WRITE16_MEMBER(vram_w); - acan_dma_regs_t m_acan_dma_regs; - acan_sprdma_regs_t m_acan_sprdma_regs; - - UINT16 m_m6502_reset; - UINT8 m_soundlatch; - UINT8 m_soundcpu_irq_src; - UINT8 m_sound_irq_enable_reg; - UINT8 m_sound_irq_source_reg; - UINT8 m_sound_cpu_68k_irq_reg; - - emu_timer *m_video_timer; - emu_timer *m_hbl_timer; - emu_timer *m_line_on_timer; - emu_timer *m_line_off_timer; - - dynamic_buffer m_vram_addr_swapped; - - UINT16 *m_pram; - - UINT16 m_sprite_count; - UINT32 m_sprite_base_addr; - UINT8 m_sprite_flags; - - UINT32 m_tilemap_base_addr[3]; - int m_tilemap_scrollx[3]; - int m_tilemap_scrolly[3]; - UINT16 m_video_flags; - UINT16 m_tilemap_flags[3]; - UINT16 m_tilemap_mode[3]; - UINT16 m_irq_mask; - UINT16 m_hbl_mask; - - UINT32 m_roz_base_addr; - UINT16 m_roz_mode; - UINT32 m_roz_scrollx; - UINT32 m_roz_scrolly; - UINT16 m_roz_tile_bank; - UINT32 m_roz_unk_base0; - UINT32 m_roz_unk_base1; - UINT32 m_roz_unk_base2; - UINT16 m_roz_coeffa; - UINT16 m_roz_coeffb; - UINT16 m_roz_coeffc; - UINT16 m_roz_coeffd; - INT32 m_roz_changed; - INT32 m_roz_cx; - INT32 m_roz_cy; - UINT16 m_unk_1d0; - - UINT16 m_video_regs[256]; - - bool m_hack_68k_to_6502_access; - - tilemap_t *m_tilemap_sizes[4][4]; - bitmap_ind16 m_sprite_final_bitmap; - void write_swapped_byte(int offset, UINT8 byte); - TILE_GET_INFO_MEMBER(get_supracan_tilemap0_tile_info); - TILE_GET_INFO_MEMBER(get_supracan_tilemap1_tile_info); - TILE_GET_INFO_MEMBER(get_supracan_tilemap2_tile_info); - TILE_GET_INFO_MEMBER(get_supracan_roz_tile_info); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(supracan); - UINT32 screen_update_supracan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(supracan_irq); - INTERRUPT_GEN_MEMBER(supracan_sound_irq); - TIMER_CALLBACK_MEMBER(supracan_hbl_callback); - TIMER_CALLBACK_MEMBER(supracan_line_on_callback); - TIMER_CALLBACK_MEMBER(supracan_line_off_callback); - TIMER_CALLBACK_MEMBER(supracan_video_callback); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(supracan_cart); - inline void verboselog(const char *tag, int n_level, const char *s_fmt, ...) ATTR_PRINTF(4,5); - int supracan_tilemap_get_region(int layer); - void supracan_tilemap_get_info_common(int layer, tile_data &tileinfo, int count); - void supracan_tilemap_get_info_roz(int layer, tile_data &tileinfo, int count); - int get_tilemap_dimensions(int &xsize, int &ysize, int layer); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void mark_active_tilemap_all_dirty(int layer); - void supracan_suprnova_draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound/*, int columnscroll, UINT32* scrollram*/, int transmask); - required_device m_gfxdecode; - required_device m_palette; -}; - - - -inline void supracan_state::verboselog(const char *tag, int n_level, const char *s_fmt, ...) -{ -#if ENABLE_VERBOSE_LOG - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%06x: %s: %s", machine().device(tag)->safe_pc(), tag, buf ); - } -#endif -} - -int supracan_state::supracan_tilemap_get_region(int layer) -{ - // HACK!!! - if (layer==2) - { - return 2; - } - - - if (layer==3) - { - // roz layer - - int gfx_mode = (m_roz_mode & 3); - - switch(gfx_mode) - { - case 0: return 4; - case 1: return 2; - case 2: return 1; - case 3: return 0; - } - return 1; - } - else - { - // normal layers - int gfx_mode = (m_tilemap_mode[layer] & 0x7000) >> 12; - - switch(gfx_mode) - { - case 7: return 2; - case 4: return 1; - case 2: return 1; - case 0: return 1; - } - - return 1; - } - -} - -void supracan_state::supracan_tilemap_get_info_common(int layer, tile_data &tileinfo, int count) -{ - UINT16* supracan_vram = m_vram; - - UINT32 base = (m_tilemap_base_addr[layer]); - int gfx_mode = (m_tilemap_mode[layer] & 0x7000) >> 12; - int region = supracan_tilemap_get_region(layer); - - count += base; - - UINT16 tile_bank = 0; - UINT16 palette_bank = 0; - switch(gfx_mode) - { - case 7: - tile_bank = 0x1c00; - palette_bank = 0x00; - break; - - case 6: // gambling lord - tile_bank = 0x0c00; - palette_bank = 0x00; - break; - - case 4: - tile_bank = 0x800; - palette_bank = 0x00; - break; - - case 2: - tile_bank = 0x400; - palette_bank = 0x00; - break; - - case 0: - tile_bank = 0; - palette_bank = 0x00; - break; - - default: - verboselog("maincpu", 0, "Unsupported tilemap mode: %d\n", (m_tilemap_mode[layer] & 0x7000) >> 12); - break; - } - - - if(layer == 2) - { - tile_bank = 0x1000; - } - - int tile = (supracan_vram[count] & 0x03ff) + tile_bank; - int flipxy = (supracan_vram[count] & 0x0c00)>>10; - int palette = ((supracan_vram[count] & 0xf000) >> 12) + palette_bank; - - SET_TILE_INFO_MEMBER(region, tile, palette, TILE_FLIPXY(flipxy)); -} - -// I wonder how different this really is.. my guess, not at all. -void supracan_state::supracan_tilemap_get_info_roz(int layer, tile_data &tileinfo, int count) -{ - UINT16* supracan_vram = m_vram; - - UINT32 base = m_roz_base_addr; - - - int region = 1; - UINT16 tile_bank = 0; - UINT16 palette_bank = 0; - - region = supracan_tilemap_get_region(layer); - - switch(m_roz_mode & 3) //FIXME: fix gfx bpp order - { - case 0: - // hack: case for startup logo - // this isn't understood properly, it's rendering a single 64x64 tile, which for convenience we've rearranged and decoded as 8x8 for the tilemaps - { - int tile = 0x880 + ((count & 7)*2); - // tile += (count & 0x070) >> 2; - - if (count & 0x20) tile ^= 1; - tile |= (count & 0xc0)>>2; - - SET_TILE_INFO_MEMBER(region, tile, 0, 0); - return; - } - - - case 1: - tile_bank = (m_roz_tile_bank & 0xf000) >> 3; - break; - - case 2: - tile_bank = (m_roz_tile_bank & 0xf000) >> 3; - break; - - case 3: - tile_bank = (m_roz_tile_bank & 0xf000) >> 3; - break; - } - - count += base; - - int tile = (supracan_vram[count] & 0x03ff) + tile_bank; - int flipxy = (supracan_vram[count] & 0x0c00)>>10; - int palette = ((supracan_vram[count] & 0xf000) >> 12) + palette_bank; - - SET_TILE_INFO_MEMBER(region, tile, palette, TILE_FLIPXY(flipxy)); -} - - - -TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap0_tile_info) -{ - supracan_tilemap_get_info_common(0, tileinfo, tile_index); -} - -TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap1_tile_info) -{ - supracan_tilemap_get_info_common(1, tileinfo, tile_index); -} - -TILE_GET_INFO_MEMBER(supracan_state::get_supracan_tilemap2_tile_info) -{ - supracan_tilemap_get_info_common(2, tileinfo, tile_index); -} - -TILE_GET_INFO_MEMBER(supracan_state::get_supracan_roz_tile_info) -{ - supracan_tilemap_get_info_roz(3, tileinfo, tile_index); -} - - -void supracan_state::video_start() -{ - m_sprite_final_bitmap.allocate(1024, 1024, BITMAP_FORMAT_IND16); - - m_vram_addr_swapped.resize(0x20000); // hack for 1bpp layer at startup - m_gfxdecode->gfx(4)->set_source(&m_vram_addr_swapped[0]); - m_gfxdecode->gfx(4)->set_xormask(0); - - m_tilemap_sizes[0][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_tilemap_sizes[0][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_tilemap_sizes[0][2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); - m_tilemap_sizes[0][3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); - - m_tilemap_sizes[1][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_tilemap_sizes[1][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_tilemap_sizes[1][2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); - m_tilemap_sizes[1][3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); - - m_tilemap_sizes[2][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_tilemap_sizes[2][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_tilemap_sizes[2][2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); - m_tilemap_sizes[2][3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); - - m_tilemap_sizes[3][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_tilemap_sizes[3][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_tilemap_sizes[3][2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); - m_tilemap_sizes[3][3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_roz_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); -} - -int supracan_state::get_tilemap_dimensions(int &xsize, int &ysize, int layer) -{ - int select; - - xsize = 32; - ysize = 32; - - if (layer==3) select = (m_roz_mode & 0x0f00); - else select = m_tilemap_flags[layer] & 0x0f00; - - switch(select) - { - case 0x600: - xsize = 64; - ysize = 32; - return 1; - - case 0xa00: - xsize = 128; - ysize = 32; - return 2; - - case 0xc00: - xsize = 64; - ysize = 64; - return 3; - - default: - verboselog("maincpu", 0, "Unsupported tilemap size for layer %d: %04x\n", layer, select); - return 0; - } -} - - - - -void supracan_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 *supracan_vram = m_vram; - -// [0] -// -e-- ---- ---- ---- sprite enable? -// ---h hhh- ---- ---- Y size (not always right) -// ---- ---y yyyy yyyy Y position -// [1] -// bbbb ---- ---- ---- Tile bank -// ---- h--- ---- ---- Horizontal flip -// ---- -v-- ---- ---- Vertical flip -// ---- --mm ---- ---- Masking mode -// ---- ---- ---- -www X size -// [2] -// zzzz ---- ---- ---- X scale -// ---- ---x xxxx xxxx X position -// [3] -// d--- ---- ---- ---- Direct Sprite (use details from here, not looked up in vram) -// -ooo oooo oooo oooo Sprite address - - UINT32 skip_count = 0; - UINT32 start_word = (m_sprite_base_addr >> 1) + skip_count * 4; - UINT32 end_word = start_word + (m_sprite_count - skip_count) * 4; - int region = (m_sprite_flags & 1) ? 0 : 1; //8bpp : 4bpp - -// printf("frame\n"); - #define VRAM_MASK (0xffff) - - for(int i = start_word; i < end_word; i += 4) - { - int x = supracan_vram[i+2] & 0x01ff; - int y = supracan_vram[i+0] & 0x01ff; - - int sprite_offset = (supracan_vram[i+3])<< 1; - - int bank = (supracan_vram[i+1] & 0xf000) >> 12; - //int mask = (supracan_vram[i+1] & 0x0300) >> 8; - int sprite_xflip = (supracan_vram[i+1] & 0x0800) >> 11; - int sprite_yflip = (supracan_vram[i+1] & 0x0400) >> 10; - //int xscale = (supracan_vram[i+2] & 0xf000) >> 12; - gfx_element *gfx = m_gfxdecode->gfx(region); - - - - - // wraparound - if (y>=0x180) y-=0x200; - if (x>=0x180) x-=0x200; - - if((supracan_vram[i+0] & 0x4000)) - { - #if 0 - printf("%d (unk %02x) (enable %02x) (unk Y2 %02x, %02x) (y pos %02x) (bank %01x) (flip %01x) (unknown %02x) (x size %02x) (xscale %01x) (unk %01x) (xpos %02x) (code %04x)\n", i, - (supracan_vram[i+0] & 0x8000) >> 15, - (supracan_vram[i+0] & 0x4000) >> 14, - (supracan_vram[i+0] & 0x2000) >> 13, - (supracan_vram[i+0] & 0x1e00) >> 8, - (supracan_vram[i+0] & 0x01ff), - (supracan_vram[i+1] & 0xf000) >> 12, - (supracan_vram[i+1] & 0x0c00) >> 10, - (supracan_vram[i+1] & 0x03f0) >> 4, - (supracan_vram[i+1] & 0x000f), - (supracan_vram[i+2] & 0xf000) >> 12, - (supracan_vram[i+2] & 0x0e00) >> 8, - (supracan_vram[i+2] & 0x01ff) >> 0, - (supracan_vram[i+3] & 0xffff)); - #endif - - - if (supracan_vram[i+3] &0x8000) - { - UINT16 data = supracan_vram[i+3]; - int tile = (bank * 0x200) + (data & 0x03ff); - - int palette = (data & 0xf000) >> 12; // this might not be correct, due to the &0x8000 condition above this would force all single tile sprites to be using palette >=0x8 only - - //printf("sprite data %04x %04x %04x %04x\n", supracan_vram[i+0] , supracan_vram[i+1] , supracan_vram[i+2] ,supracan_vram[i+3] ); - - gfx->transpen(bitmap,cliprect,tile,palette,sprite_xflip,sprite_yflip, - x, - y, - 0); - - } - else - { - int xsize = 1 << (supracan_vram[i+1] & 7); - int ysize = ((supracan_vram[i+0] & 0x1e00) >> 9) + 1; - - // I think the xsize must influence the ysize somehow, there are too many conflicting cases otherwise - // there don't appear to be any special markers in the actual looked up tile data to indicate skip / end of list - - for(int ytile = 0; ytile < ysize; ytile++) - { - for(int xtile = 0; xtile< xsize; xtile++) - { - UINT16 data = supracan_vram[(sprite_offset+ytile*xsize+xtile)&VRAM_MASK]; - int tile = (bank * 0x200) + (data & 0x03ff); - int palette = (data & 0xf000) >> 12; - - int xpos, ypos; - - if (!sprite_yflip) - { - ypos = y + ytile*8; - } - else - { - ypos = y - (ytile+1)*8; - ypos += ysize*8; - } - - if (!sprite_xflip) - { - xpos = x + xtile*8; - } - else - { - xpos = x - (xtile+1)*8; - xpos += xsize*8; - } - - int tile_xflip = sprite_xflip ^ ((data & 0x0800)>>11); - int tile_yflip = sprite_yflip ^ ((data & 0x0400)>>10); - - gfx->transpen(bitmap,cliprect,tile,palette,tile_xflip,tile_yflip,xpos,ypos,0); - } - } - } - -#if 0 - if(xscale == 0) continue; - UINT32 delta = (1 << 17) / xscale; - for(int sy = 0; sy < ysize*8; sy++) - { - UINT16 *src = &sprite_bitmap->pix16(sy); - UINT16 *dst = &bitmap.pix16(y + sy); - UINT32 dx = x << 16; - for(int sx = 0; sx < xsize*8; sx++) - { - dst[dx >> 16] = src[sx]; - dx += delta; - } - } -#endif - - } - } -} - - - -void supracan_state::mark_active_tilemap_all_dirty(int layer) -{ - int xsize = 0; - int ysize = 0; - - int which_tilemap_size; - - which_tilemap_size = get_tilemap_dimensions(xsize, ysize, layer); -// for (int i=0;i<4;i++) -// tilemap_mark_all_tiles_dirty(m_tilemap_sizes[layer][i]); - m_tilemap_sizes[layer][which_tilemap_size]->mark_all_dirty(); -} - - - -/* draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap */ -void supracan_state::supracan_suprnova_draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound/*, int columnscroll, UINT32* scrollram*/, int transmask) -{ - //bitmap_ind16 *destbitmap = bitmap; - bitmap_ind16 &srcbitmap = tmap->pixmap(); - //bitmap_ind16 &srcbitmapflags = tmap->flagsmap(); - const int xmask = srcbitmap.width()-1; - const int ymask = srcbitmap.height()-1; - const int widthshifted = srcbitmap.width() << 16; - const int heightshifted = srcbitmap.height() << 16; - UINT32 cx; - UINT32 cy; - int x; - int sx; - int sy; - int ex; - int ey; - UINT16 *dest; -// UINT8* destflags; -// UINT8 *pri; - //const UINT16 *src; - //const UINT8 *maskptr; - //int destadvance = destbitmap->bpp / 8; - - /* pre-advance based on the cliprect */ - startx += cliprect.min_x * incxx + cliprect.min_y * incyx; - starty += cliprect.min_x * incxy + cliprect.min_y * incyy; - - /* extract start/end points */ - sx = cliprect.min_x; - sy = cliprect.min_y; - ex = cliprect.max_x; - ey = cliprect.max_y; - - { - /* loop over rows */ - while (sy <= ey) - { - /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; - - /* get dest and priority pointers */ - dest = &bitmap.pix16(sy, sx); - //destflags = &bitmapflags->pix8(sy, sx); - - /* loop over columns */ - while (x <= ex) - { - if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. - { - #if 0 - if (columnscroll) - { - int scroll = 0;//scrollram[(cx>>16)&0x3ff]); - - - UINT16 data = &srcbitmap.pix16( - ((cy >> 16) - scroll) & ymask, - (cx >> 16) & xmask)[0]; - - if ((data & transmask)!=0) - dest[0] = data; - - //destflags[0] = &srcbitmapflags.pix8(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask)[0]; - } - else - #endif - { - int scroll = 0;//scrollram[(cy>>16)&0x3ff]); - UINT16 data = srcbitmap.pix16( - (cy >> 16) & ymask, - ((cx >> 16) - scroll) & xmask); - - - if ((data & transmask)!=0) - dest[0] = data; - - //destflags[0] = &srcbitmapflags.pix8((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask)[0]; - } - } - - /* advance in X */ - cx += incxx; - cy += incxy; - x++; - dest++; -// destflags++; -// pri++; - } - - /* advance in Y */ - startx += incyx; - starty += incyy; - sy++; - } - } -} - - -// VIDEO FLAGS ROZ MODE TILEMAP FLAGS -// -// Bit Bit Bit -// 15-9: Unknown 15-13: Priority? 15-13: Priority? -// 8: X ht. (256/320) 12: Unknown 12: Unknown -// 7: Tilemap 0 enable 11-8: Dims 11-8: Dims -// 6: Tilemap 1 enable 7-6: Unknown 7-6: Unknown -// 5: Tilemap 2 enable? 5: Wrap 5: Wrap -// 3: Sprite enable 4-2: Unknown 4-2: Mosaic -// 2: ROZ enable 1-0: Bit Depth 1-0: Bit Depth -// 1-0: Unknown - -// Video Flags ROZ Mode Tilemap 0 Tilemap 1 Tilemap 2 VF Unk0 -// A'Can logo: 120e: 0001 0010 0000 1110 4020: 0100 0000 0010 0000 4620 ---- ---- 0x09 -// Boomzoo Intro: 9a82: 1001 1010 1000 0010 0402: 0000 0100 0000 0010 6400 6400 4400 0x4d -// Boomzoo Title: 9acc: 1001 1010 1100 1100 0402: 0000 0100 0000 0010 6400 6400 4400 0x4d -// C.U.G. Intro: 11c8: 0001 0001 1100 1000 0402: 0000 0100 0000 0010 2400 4400 6400 0x08 -// C.U.G. Title: 11cc: 0001 0001 1100 1100 0602: 0000 0110 0000 0010 2600 4600 ---- 0x08 -// Speedy Dragon Logo: 0388: 0000 0011 1000 1000 4020: 0100 0000 0010 0000 6c20 6c20 2600 0x01 -// Speedy Dragon Title: 038c: 0000 0011 1000 1100 2603: 0010 0110 0000 0011 6c20 2c20 2600 0x01 -// Sango Fighter Intro: 03c8: 0000 0011 1100 1000 ----: ---- ---- ---- ---- 6c20 4620 ---- 0x01 -// Sango Fighter Game: 03ce: 0000 0011 1100 1110 0622: 0000 0110 0010 0010 2620 4620 ---- 0x01 - -UINT32 supracan_state::screen_update_supracan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // treat the sprites as frame-buffered and only update the buffer when drawing scanline 0 - this might not be true! - - if (0) - { - if (cliprect.min_y == 0x00) - { - const rectangle &visarea = screen.visible_area(); - - m_sprite_final_bitmap.fill(0x00, visarea); - bitmap.fill(0x80, visarea); - - draw_sprites( m_sprite_final_bitmap, visarea); - } - } - else - { - m_sprite_final_bitmap.fill(0x00, cliprect); - bitmap.fill(0x80, cliprect); - - draw_sprites(m_sprite_final_bitmap, cliprect); - } - - - - // mix screen - int xsize = 0, ysize = 0; -// int tilemap_num; - int which_tilemap_size; - int priority = 0; - - - for (int pri=7;pri>=0;pri--) - { - for (int layer = 3; layer >=0; layer--) - { - // popmessage("%04x\n",m_video_flags); - int enabled = 0; - - if(m_video_flags & 0x04) - if (layer==3) enabled = 1; - - if(m_video_flags & 0x80) - if (layer==0) enabled = 1; - - if(m_video_flags & 0x40) - if (layer==1) enabled = 1; - - if(m_video_flags & 0x20) - if (layer==2) enabled = 1; - - - if (layer==3) priority = ((m_roz_mode >> 13) & 7); // roz case - else priority = ((m_tilemap_flags[layer] >> 13) & 7); // normal cases - - - if (priority==pri) - { -// tilemap_num = layer; - which_tilemap_size = get_tilemap_dimensions(xsize, ysize, layer); - bitmap_ind16 &src_bitmap = m_tilemap_sizes[layer][which_tilemap_size]->pixmap(); - int gfx_region = supracan_tilemap_get_region(layer); - int transmask = 0xff; - - switch (gfx_region) - { - case 0:transmask = 0xff; break; - case 1:transmask = 0x0f; break; - case 2:transmask = 0x03; break; - case 3:transmask = 0x01; break; - case 4:transmask = 0x01; break; - } - - if (enabled) - { - if (layer != 3) // standard layers, NOT roz - { - int wrap = (m_tilemap_flags[layer] & 0x20); - - int scrollx = m_tilemap_scrollx[layer]; - int scrolly = m_tilemap_scrolly[layer]; - - if (scrollx&0x8000) scrollx-= 0x10000; - if (scrolly&0x8000) scrolly-= 0x10000; - - int mosaic_count = (m_tilemap_flags[layer] & 0x001c) >> 2; - int mosaic_mask = 0xffffffff << mosaic_count; - - int y,x; - // yes, it will draw a single line if you specify a cliprect as such (partial updates...) - - for (y=cliprect.min_y;y<=cliprect.max_y;y++) - { - // these will have to change to ADDR32 etc. once alpha blending is supported - UINT16* screen = &bitmap.pix16(y); - - int actualy = y&mosaic_mask; - - int realy = actualy+scrolly; - - if (!wrap) - if (scrolly+y < 0 || scrolly+y > ((ysize*8)-1)) - continue; - - - UINT16* src = &src_bitmap.pix16((realy)&((ysize*8)-1)); - - for (x=cliprect.min_x;x<=cliprect.max_x;x++) - { - int actualx = x & mosaic_mask; - int realx = actualx+scrollx; - - if (!wrap) - if (scrollx+x < 0 || scrollx+x > ((xsize*8)-1)) - continue; - - UINT16 srcpix = src[(realx)&((xsize*8)-1)]; - - if ((srcpix & transmask) != 0) - screen[x] = srcpix; - } - } - } - else - { - int wrap = m_roz_mode & 0x20; - - int incxx = (m_roz_coeffa); - int incyy = (m_roz_coeffd); - - int incxy = (m_roz_coeffc); - int incyx = (m_roz_coeffb); - - int scrollx = (m_roz_scrollx); - int scrolly = (m_roz_scrolly); - - - - - - - if (incyx & 0x8000) incyx -= 0x10000; - if (incxy & 0x8000) incxy -= 0x10000; - - if (incyy & 0x8000) incyy -= 0x10000; - if (incxx & 0x8000) incxx -= 0x10000; - - //popmessage("%04x %04x\n",m_video_flags, m_roz_mode); - - // roz mode.. - //4020 = enabled speedyd - //6c22 = enabled speedyd - //2c22 = enabled speedyd - //4622 = disabled jttlaugh - //2602 = disabled monopoly - //0402 = disabled (sango title) - // or is it always enabled, and only corrupt because we don't clear ram properly? - // (probably not this register?) - - if (!(m_roz_mode & 0x0200) && (m_roz_mode&0xf000) ) // HACK - Not Trusted, Acan Logo, Speedy Dragon Intro ,Speed Dragon Bonus stage need it. Monopoly and JTT *don't* causes graphical issues - { - // NOT accurate, causes issues when the attract mode loops and the logo is shown the 2nd time in some games - investigate - for (int y=cliprect.min_y;y<=cliprect.max_y;y++) - { - rectangle clip(cliprect.min_x, cliprect.max_x, y, y); - - scrollx = (m_roz_scrollx); - scrolly = (m_roz_scrolly); - incxx = (m_roz_coeffa); - - incxx += m_vram[m_roz_unk_base0/2 + y]; - - scrollx += m_vram[m_roz_unk_base1/2 + y*2] << 16; - scrollx += m_vram[m_roz_unk_base1/2 + y*2 + 1]; - - scrolly += m_vram[m_roz_unk_base2/2 + y*2] << 16; - scrolly += m_vram[m_roz_unk_base2/2 + y*2 + 1]; - - if (incxx & 0x8000) incxx -= 0x10000; - - - if (m_vram[m_roz_unk_base0/2 + y]) // incxx = 0, no draw? - supracan_suprnova_draw_roz(bitmap, clip, m_tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask); - } - } - else - { - supracan_suprnova_draw_roz(bitmap, cliprect, m_tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask); - } - } - } - } - } - } - - - // just draw the sprites on top for now - if(m_video_flags & 0x08) - { - for (int y=cliprect.min_y;y<=cliprect.max_y;y++) - { - UINT16* src = &m_sprite_final_bitmap.pix16(y); - UINT16* dst = &bitmap.pix16(y); - - for (int x=cliprect.min_x;x<=cliprect.max_x;x++) - { - UINT16 dat = src[x]; - if (dat) dst[x] = dat; - } - } - } - - return 0; -} - - -void supracan_state::dma_w(address_space &space, int offset, UINT16 data, UINT16 mem_mask, int ch) -{ - acan_dma_regs_t *acan_dma_regs = &m_acan_dma_regs; - address_space &mem = m_maincpu->space(AS_PROGRAM); - - switch(offset) - { - case 0x00/2: // Source address MSW - verboselog("maincpu", 0, "dma_w: source msw %d: %04x\n", ch, data); - acan_dma_regs->source[ch] &= 0x0000ffff; - acan_dma_regs->source[ch] |= data << 16; - break; - case 0x02/2: // Source address LSW - verboselog("maincpu", 0, "dma_w: source lsw %d: %04x\n", ch, data); - acan_dma_regs->source[ch] &= 0xffff0000; - acan_dma_regs->source[ch] |= data; - break; - case 0x04/2: // Destination address MSW - verboselog("maincpu", 0, "dma_w: dest msw %d: %04x\n", ch, data); - acan_dma_regs->dest[ch] &= 0x0000ffff; - acan_dma_regs->dest[ch] |= data << 16; - break; - case 0x06/2: // Destination address LSW - verboselog("maincpu", 0, "dma_w: dest lsw %d: %04x\n", ch, data); - acan_dma_regs->dest[ch] &= 0xffff0000; - acan_dma_regs->dest[ch] |= data; - break; - case 0x08/2: // Byte count - verboselog("maincpu", 0, "dma_w: count %d: %04x\n", ch, data); - acan_dma_regs->count[ch] = data; - break; - case 0x0a/2: // Control - verboselog("maincpu", 0, "dma_w: control %d: %04x\n", ch, data); - if(data & 0x8800) - { -// if(data & 0x2000) -// acan_dma_regs->source-=2; - logerror("dma_w: Kicking off a DMA from %08x to %08x, %d bytes (%04x)\n", acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1, data); - - for(int i = 0; i <= acan_dma_regs->count[ch]; i++) - { - if(data & 0x1000) - { - mem.write_word(acan_dma_regs->dest[ch], mem.read_word(acan_dma_regs->source[ch])); - acan_dma_regs->dest[ch]+=2; - acan_dma_regs->source[ch]+=2; - if(data & 0x0100) - if((acan_dma_regs->dest[ch] & 0xf) == 0) - acan_dma_regs->dest[ch]-=0x10; - } - else - { - mem.write_byte(acan_dma_regs->dest[ch], mem.read_byte(acan_dma_regs->source[ch])); - acan_dma_regs->dest[ch]++; - acan_dma_regs->source[ch]++; - } - } - } - else if(data != 0x0000) // fake DMA, used by C.U.G. - { - verboselog("maincpu", 0, "dma_w: Unknown DMA kickoff value of %04x (other regs %08x, %08x, %d)\n", data, acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1); - fatalerror("dma_w: Unknown DMA kickoff value of %04x (other regs %08x, %08x, %d)\n",data, acan_dma_regs->source[ch], acan_dma_regs->dest[ch], acan_dma_regs->count[ch] + 1); - } - break; - default: - verboselog("maincpu", 0, "dma_w: Unknown register: %08x = %04x & %04x\n", 0xe90020 + (offset << 1), data, mem_mask); - break; - } -} - -WRITE16_MEMBER( supracan_state::dma_channel0_w ) -{ - dma_w(space, offset, data, mem_mask, 0); -} - -WRITE16_MEMBER( supracan_state::dma_channel1_w ) -{ - dma_w(space, offset, data, mem_mask, 1); -} - - -#if 0 -WRITE16_MEMBER( supracan_state::supracan_pram_w ) -{ - m_pram[offset] &= ~mem_mask; - m_pram[offset] |= data & mem_mask; -} -#endif - -// swap address around so that 64x64 tile can be decoded as 8x8 tiles.. -void supracan_state::write_swapped_byte( int offset, UINT8 byte ) -{ - int swapped_offset = BITSWAP32(offset, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,2,1,0,6,5,4,3); - - m_vram_addr_swapped[swapped_offset] = byte; -} - -WRITE16_MEMBER( supracan_state::vram_w ) -{ - COMBINE_DATA(&m_vram[offset]); - - // hack for 1bpp layer at startup - write_swapped_byte(offset*2, (data & 0xff00)>>8); - write_swapped_byte(offset*2+1, (data & 0x00ff)); - - // mark tiles of each depth as dirty - m_gfxdecode->gfx(0)->mark_dirty((offset*2)/(64)); - m_gfxdecode->gfx(1)->mark_dirty((offset*2)/(32)); - m_gfxdecode->gfx(2)->mark_dirty((offset*2)/(16)); - m_gfxdecode->gfx(3)->mark_dirty((offset*2)/(512)); - m_gfxdecode->gfx(4)->mark_dirty((offset*2)/(8)); - -} - -static ADDRESS_MAP_START( supracan_mem, AS_PROGRAM, 16, supracan_state ) - //AM_RANGE( 0x000000, 0x3fffff ) // mapped by the cartslot - AM_RANGE( 0xe80200, 0xe80201 ) AM_READ_PORT("P1") - AM_RANGE( 0xe80202, 0xe80203 ) AM_READ_PORT("P2") - AM_RANGE( 0xe80208, 0xe80209 ) AM_READ_PORT("P3") - AM_RANGE( 0xe8020c, 0xe8020d ) AM_READ_PORT("P4") - AM_RANGE( 0xe80000, 0xe8ffff ) AM_READWRITE(_68k_soundram_r, _68k_soundram_w) - AM_RANGE( 0xe90000, 0xe9001f ) AM_READWRITE(sound_r, sound_w) - AM_RANGE( 0xe90020, 0xe9002f ) AM_WRITE(dma_channel0_w) - AM_RANGE( 0xe90030, 0xe9003f ) AM_WRITE(dma_channel1_w) - - AM_RANGE( 0xf00000, 0xf001ff ) AM_READWRITE(video_r, video_w) - AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") - AM_RANGE( 0xf40000, 0xf5ffff ) AM_RAM_WRITE(vram_w) AM_SHARE("vram") - AM_RANGE( 0xfc0000, 0xfdffff ) AM_MIRROR(0x30000) AM_RAM /* System work ram */ -ADDRESS_MAP_END - -READ8_MEMBER( supracan_state::_6502_soundmem_r ) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT8 data = m_soundram[offset]; - - switch(offset) - { -#if SOUNDCPU_BOOT_HACK - case 0x300: // HACK to make games think the sound CPU is always reporting 'OK'. - return 0xff; -#endif - - case 0x410: // Sound IRQ enable - data = m_sound_irq_enable_reg; - if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_r: IRQ enable: %04x\n", data); - if(!mem.debugger_access()) - { - if(m_sound_irq_enable_reg & m_sound_irq_source_reg) - { - m_soundcpu->set_input_line(0, ASSERT_LINE); - } - else - { - m_soundcpu->set_input_line(0, CLEAR_LINE); - } - } - break; - case 0x411: // Sound IRQ source - data = m_sound_irq_source_reg; - m_sound_irq_source_reg = 0; - if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: IRQ source: %04x\n", data); - if(!mem.debugger_access()) - { - m_soundcpu->set_input_line(0, CLEAR_LINE); - } - break; - case 0x420: - if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: Sound hardware status? (not yet implemented): %02x\n", 0); - break; - case 0x422: - if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_r: Sound hardware data? (not yet implemented): %02x\n", 0); - break; - case 0x404: - case 0x405: - case 0x409: - case 0x414: - case 0x416: - // Intentional fall-through - default: - if(offset >= 0x300 && offset < 0x500) - { - if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_r: Unknown register %04x\n", offset); - } - break; - } - - return data; -} - -WRITE8_MEMBER( supracan_state::_6502_soundmem_w ) -{ - switch(offset) - { - case 0x407: - if(m_sound_cpu_68k_irq_reg &~ data) - { - verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: sound_cpu_68k_irq_reg: %04x: Triggering M68k IRQ\n", data); - m_maincpu->set_input_line(7, HOLD_LINE); - } - else - { - verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: sound_cpu_68k_irq_reg: %04x\n", data); - } - m_sound_cpu_68k_irq_reg = data; - break; - case 0x410: - m_sound_irq_enable_reg = data; - verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: IRQ enable: %02x\n", data); - break; - case 0x420: - verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_w: Sound hardware reg data? (not yet implemented): %02x\n", data); - break; - case 0x422: - verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 3, "supracan_soundreg_w: Sound hardware reg addr? (not yet implemented): %02x\n", data); - break; - default: - if(offset >= 0x300 && offset < 0x500) - { - verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", 0, "supracan_soundreg_w: Unknown register %04x = %02x\n", offset, data); - } - m_soundram[offset] = data; - break; - } -} - -static ADDRESS_MAP_START( supracan_sound_mem, AS_PROGRAM, 8, supracan_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(_6502_soundmem_r, _6502_soundmem_w) AM_SHARE("soundram") -ADDRESS_MAP_END - -static INPUT_PORTS_START( supracan ) - PORT_START("P1") - PORT_DIPNAME( 0x01, 0x00, "SYSTEM" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Button R") - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Button L") - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Button Y") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Button X") - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Right") - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Left") - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Down") - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("P1 Joypad Up") - PORT_DIPNAME( 0x1000, 0x0000, "SYSTEM" ) - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( On ) ) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START1 ) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Button B") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Button A") - - PORT_START("P2") - PORT_DIPNAME( 0x01, 0x00, "SYSTEM" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Button R") - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Button L") - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Button Y") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Button X") - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Right") - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Left") - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Down") - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_NAME("P2 Joypad Up") - PORT_DIPNAME( 0x1000, 0x0000, "SYSTEM" ) - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( On ) ) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START2 ) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Button B") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Button A") - - PORT_START("P3") - PORT_DIPNAME( 0x01, 0x00, "SYSTEM" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(3) PORT_NAME("P3 Button R") - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(3) PORT_NAME("P3 Button L") - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(3) PORT_NAME("P3 Button Y") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_NAME("P3 Button X") - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Right") - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Left") - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Down") - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_NAME("P3 Joypad Up") - PORT_DIPNAME( 0x1000, 0x0000, "SYSTEM" ) - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( On ) ) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START3 ) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_NAME("P3 Button B") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_NAME("P3 Button A") - - PORT_START("P4") - PORT_DIPNAME( 0x01, 0x00, "SYSTEM" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(4) PORT_NAME("P4 Button R") - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(4) PORT_NAME("P4 Button L") - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(4) PORT_NAME("P4 Button Y") - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_NAME("P4 Button X") - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Right") - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Left") - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Down") - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_NAME("P4 Joypad Up") - PORT_DIPNAME( 0x1000, 0x0000, "SYSTEM" ) - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( On ) ) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_START4 ) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_NAME("P4 Button B") - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 Button A") -INPUT_PORTS_END - -PALETTE_INIT_MEMBER(supracan_state, supracan) -{ - // Used for debugging purposes for now - //#if 0 - int i, r, g, b; - - for( i = 0; i < 32768; i++ ) - { - r = (i & 0x1f) << 3; - g = ((i >> 5) & 0x1f) << 3; - b = ((i >> 10) & 0x1f) << 3; - palette.set_pen_color( i, r, g, b ); - } - //#endif -} - -WRITE16_MEMBER( supracan_state::_68k_soundram_w ) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - m_soundram[offset*2 + 1] = data & 0xff; - m_soundram[offset*2 + 0] = data >> 8; - - if(offset*2 < 0x500 && offset*2 >= 0x300) - { - if(mem_mask & 0xff00) - { - m_hack_68k_to_6502_access = true; - _6502_soundmem_w(mem, offset*2, data >> 8); - m_hack_68k_to_6502_access = false; - } - if(mem_mask & 0x00ff) - { - m_hack_68k_to_6502_access = true; - _6502_soundmem_w(mem, offset*2 + 1, data & 0xff); - m_hack_68k_to_6502_access = false; - } - } -} - -READ16_MEMBER( supracan_state::_68k_soundram_r ) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT16 val = m_soundram[offset*2 + 0] << 8; - val |= m_soundram[offset*2 + 1]; - - if(offset*2 >= 0x300 && offset*2 < 0x500) - { - val = 0; - if(mem_mask & 0xff00) - { - m_hack_68k_to_6502_access = true; - val |= _6502_soundmem_r(mem, offset*2) << 8; - m_hack_68k_to_6502_access = false; - } - if(mem_mask & 0x00ff) - { - m_hack_68k_to_6502_access = true; - val |= _6502_soundmem_r(mem, offset*2 + 1); - m_hack_68k_to_6502_access = false; - } - } - - return val; -} - -READ16_MEMBER( supracan_state::sound_r ) -{ - UINT16 data = 0; - - switch( offset ) - { - default: - verboselog("maincpu", 0, "sound_r: Unknown register: (%08x) & %04x\n", 0xe90000 + (offset << 1), mem_mask); - break; - } - - return data; -} - -WRITE16_MEMBER( supracan_state::sound_w ) -{ - switch ( offset ) - { - case 0x000a/2: /* Sound cpu IRQ request. */ - m_soundcpu->set_input_line(0, ASSERT_LINE); - break; - case 0x001c/2: /* Sound cpu control. Bit 0 tied to sound cpu RESET line */ - if(data & 0x01) - { - if(!m_m6502_reset) - { - /* Reset and enable the sound cpu */ -#if !(SOUNDCPU_BOOT_HACK) - m_soundcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_soundcpu->reset(); -#endif - } - m_m6502_reset = data & 0x01; - } - else - { - /* Halt the sound cpu */ - m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - } - verboselog("maincpu", 0, "sound cpu ctrl: %04x\n", data); - break; - default: - verboselog("maincpu", 0, "sound_w: Unknown register: %08x = %04x & %04x\n", 0xe90000 + (offset << 1), data, mem_mask); - break; - } -} - - -READ16_MEMBER( supracan_state::video_r ) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT16 data = m_video_regs[offset]; - - switch(offset) - { - case 0x00/2: // Video IRQ flags - if(!mem.debugger_access()) - { - //verboselog("maincpu", 0, "read video IRQ flags (%04x)\n", data); - m_maincpu->set_input_line(7, CLEAR_LINE); - } - break; - case 0x02/2: // Current scanline - break; - case 0x08/2: // Unknown (not video flags!) - gambling lord disagrees, it MUST read back what it wrote because it reads it before turning on/off layers and writes it back - //data = 0; - break; - case 0x100/2: - if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_flags[0] (%04x)\n", data); - break; - case 0x106/2: - if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_scrolly[0] (%04x)\n", data); - break; - case 0x120/2: - if(!mem.debugger_access()) verboselog("maincpu", 0, "read tilemap_flags[1] (%04x)\n", data); - break; - default: - if(!mem.debugger_access()) verboselog("maincpu", 0, "video_r: Unknown register: %08x (%04x & %04x)\n", 0xf00000 + (offset << 1), data, mem_mask); - break; - } - - return data; -} - -TIMER_CALLBACK_MEMBER(supracan_state::supracan_hbl_callback) -{ - m_maincpu->set_input_line(3, HOLD_LINE); - - m_hbl_timer->adjust(attotime::never); -} - -TIMER_CALLBACK_MEMBER(supracan_state::supracan_line_on_callback) -{ - m_maincpu->set_input_line(5, HOLD_LINE); - - m_line_on_timer->adjust(attotime::never); -} - -TIMER_CALLBACK_MEMBER(supracan_state::supracan_line_off_callback) -{ - m_maincpu->set_input_line(5, CLEAR_LINE); - - m_line_on_timer->adjust(attotime::never); -} - -TIMER_CALLBACK_MEMBER(supracan_state::supracan_video_callback) -{ - int vpos = machine().first_screen()->vpos(); - - m_video_regs[0] &= ~0x0002; - - switch( vpos ) - { - case 0: - m_video_regs[0] &= 0x7fff; - - // we really need better management of this - mark_active_tilemap_all_dirty(0); - mark_active_tilemap_all_dirty(1); - mark_active_tilemap_all_dirty(2); - mark_active_tilemap_all_dirty(3); - - - break; - - case 224://FIXME: Son of Evil is pretty picky about this one, a timing of 240 makes it to crash - m_video_regs[0] |= 0x8000; - break; - - case 240: - if(m_irq_mask & 1) - { - verboselog("maincpu", 0, "Triggering VBL IRQ\n\n"); - m_maincpu->set_input_line(7, HOLD_LINE); - } - break; - } - - m_video_regs[1] = machine().first_screen()->vpos()-16; // for son of evil, wants vblank active around 224 instead... - - m_hbl_timer->adjust( machine().first_screen()->time_until_pos( vpos, 320 ) ); - m_video_timer->adjust( machine().first_screen()->time_until_pos( ( vpos + 1 ) % 256, 0 ) ); -} - -WRITE16_MEMBER( supracan_state::video_w ) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - acan_sprdma_regs_t *acan_sprdma_regs = &m_acan_sprdma_regs; - int i; - - // if any of this changes we need a partial update (see sango fighters intro) - machine().first_screen()->update_partial(machine().first_screen()->vpos()); - - COMBINE_DATA(&m_video_regs[offset]); - data = m_video_regs[offset]; - - switch(offset) - { - case 0x10/2: // Byte count - verboselog("maincpu", 0, "sprite dma word count: %04x\n", data); - acan_sprdma_regs->count = data; - break; - case 0x12/2: // Destination address MSW - acan_sprdma_regs->dst &= 0x0000ffff; - acan_sprdma_regs->dst |= data << 16; - verboselog("maincpu", 0, "sprite dma dest msw: %04x\n", data); - break; - case 0x14/2: // Destination address LSW - acan_sprdma_regs->dst &= 0xffff0000; - acan_sprdma_regs->dst |= data; - verboselog("maincpu", 0, "sprite dma dest lsw: %04x\n", data); - break; - case 0x16/2: // Source word increment - verboselog("maincpu", 0, "sprite dma dest word inc: %04x\n", data); - acan_sprdma_regs->dst_inc = data; - break; - case 0x18/2: // Source address MSW - acan_sprdma_regs->src &= 0x0000ffff; - acan_sprdma_regs->src |= data << 16; - verboselog("maincpu", 0, "sprite dma src msw: %04x\n", data); - break; - case 0x1a/2: // Source address LSW - verboselog("maincpu", 0, "sprite dma src lsw: %04x\n", data); - acan_sprdma_regs->src &= 0xffff0000; - acan_sprdma_regs->src |= data; - break; - case 0x1c/2: // Source word increment - verboselog("maincpu", 0, "sprite dma src word inc: %04x\n", data); - acan_sprdma_regs->src_inc = data; - break; - case 0x1e/2: - logerror( "video_w: Kicking off a DMA from %08x to %08x, %d bytes (%04x)\n", acan_sprdma_regs->src, acan_sprdma_regs->dst, acan_sprdma_regs->count, data); - - /* TODO: what's 0x2000 and 0x4000 for? */ - if(data & 0x8000) - { - if(data & 0x2000 || data & 0x4000) - { - acan_sprdma_regs->dst |= 0xf40000; - } - - if(data & 0x2000) - { - //acan_sprdma_regs->count <<= 1; - } - - for(i = 0; i <= acan_sprdma_regs->count; i++) - { - if(data & 0x0100) //dma 0x00 fill (or fixed value?) - { - mem.write_word(acan_sprdma_regs->dst, 0); - acan_sprdma_regs->dst+=2 * acan_sprdma_regs->dst_inc; - //memset(supracan_vram,0x00,0x020000); - } - else - { - mem.write_word(acan_sprdma_regs->dst, mem.read_word(acan_sprdma_regs->src)); - acan_sprdma_regs->dst+=2 * acan_sprdma_regs->dst_inc; - acan_sprdma_regs->src+=2 * acan_sprdma_regs->src_inc; - } - } - } - else - { - verboselog("maincpu", 0, "dma_w: Attempting to kick off a DMA without bit 15 set! (%04x)\n", data); - } - break; - case 0x08/2: - { - verboselog("maincpu", 3, "video_flags = %04x\n", data); - m_video_flags = data; - - rectangle visarea = machine().first_screen()->visible_area(); - - visarea.set(0, ((m_video_flags & 0x100) ? 320 : 256) - 1, 8, 232 - 1); - machine().first_screen()->configure(348, 256, visarea, machine().first_screen()->frame_period().attoseconds()); - } - break; - case 0x0a/2: - { - // raster interrupt - verboselog("maincpu", 0, "IRQ Trigger? = %04x\n", data); - if(data & 0x8000) - { - m_line_on_timer->adjust(machine().first_screen()->time_until_pos((data & 0x00ff), 0)); - } - else - { - m_line_on_timer->adjust(attotime::never); - } - } - break; - - case 0x0c/2: - { - verboselog("maincpu", 0, "IRQ De-Trigger? = %04x\n", data); - if(data & 0x8000) - { - m_line_off_timer->adjust(machine().first_screen()->time_until_pos(data & 0x00ff, 0)); - } - else - { - m_line_off_timer->adjust(attotime::never); - } - } - break; - - /* Sprites */ - case 0x20/2: m_sprite_base_addr = data << 2; verboselog("maincpu", 0, "sprite_base_addr = %04x\n", data); break; - case 0x22/2: m_sprite_count = data+1; verboselog("maincpu", 0, "sprite_count = %d\n", data+1); break; - case 0x26/2: m_sprite_flags = data; verboselog("maincpu", 0, "sprite_flags = %04x\n", data); break; - - /* Tilemap 0 */ - case 0x100/2: m_tilemap_flags[0] = data; verboselog("maincpu", 3, "tilemap_flags[0] = %04x\n", data); break; - case 0x104/2: m_tilemap_scrollx[0] = data; verboselog("maincpu", 3, "tilemap_scrollx[0] = %04x\n", data); break; - case 0x106/2: m_tilemap_scrolly[0] = data; verboselog("maincpu", 3, "tilemap_scrolly[0] = %04x\n", data); break; - case 0x108/2: m_tilemap_base_addr[0] = (data) << 1; verboselog("maincpu", 3, "tilemap_base_addr[0] = %05x\n", data << 2); break; - case 0x10a/2: m_tilemap_mode[0] = data; verboselog("maincpu", 3, "tilemap_mode[0] = %04x\n", data); break; - - /* Tilemap 1 */ - case 0x120/2: m_tilemap_flags[1] = data; verboselog("maincpu", 3, "tilemap_flags[1] = %04x\n", data); break; - case 0x124/2: m_tilemap_scrollx[1] = data; verboselog("maincpu", 3, "tilemap_scrollx[1] = %04x\n", data); break; - case 0x126/2: m_tilemap_scrolly[1] = data; verboselog("maincpu", 3, "tilemap_scrolly[1] = %04x\n", data); break; - case 0x128/2: m_tilemap_base_addr[1] = (data) << 1; verboselog("maincpu", 3, "tilemap_base_addr[1] = %05x\n", data << 2); break; - case 0x12a/2: m_tilemap_mode[1] = data; verboselog("maincpu", 3, "tilemap_mode[1] = %04x\n", data); break; - - /* Tilemap 2? */ - case 0x140/2: m_tilemap_flags[2] = data; verboselog("maincpu", 0, "tilemap_flags[2] = %04x\n", data); break; - case 0x144/2: m_tilemap_scrollx[2] = data; verboselog("maincpu", 0, "tilemap_scrollx[2] = %04x\n", data); break; - case 0x146/2: m_tilemap_scrolly[2] = data; verboselog("maincpu", 0, "tilemap_scrolly[2] = %04x\n", data); break; - case 0x148/2: m_tilemap_base_addr[2] = (data) << 1; verboselog("maincpu", 0, "tilemap_base_addr[2] = %05x\n", data << 2); break; - case 0x14a/2: m_tilemap_mode[2] = data; verboselog("maincpu", 0, "tilemap_mode[2] = %04x\n", data); break; - - /* ROZ */ - case 0x180/2: m_roz_mode = data; verboselog("maincpu", 3, "roz_mode = %04x\n", data); break; - case 0x184/2: m_roz_scrollx = (data << 16) | (m_roz_scrollx & 0xffff); m_roz_changed |= 1; verboselog("maincpu", 3, "roz_scrollx = %08x\n", m_roz_scrollx); break; - case 0x186/2: m_roz_scrollx = (data) | (m_roz_scrollx & 0xffff0000); m_roz_changed |= 1; verboselog("maincpu", 3, "roz_scrollx = %08x\n", m_roz_scrollx); break; - case 0x188/2: m_roz_scrolly = (data << 16) | (m_roz_scrolly & 0xffff); m_roz_changed |= 2; verboselog("maincpu", 3, "roz_scrolly = %08x\n", m_roz_scrolly); break; - case 0x18a/2: m_roz_scrolly = (data) | (m_roz_scrolly & 0xffff0000); m_roz_changed |= 2; verboselog("maincpu", 3, "roz_scrolly = %08x\n", m_roz_scrolly); break; - case 0x18c/2: m_roz_coeffa = data; verboselog("maincpu", 3, "roz_coeffa = %04x\n", data); break; - case 0x18e/2: m_roz_coeffb = data; verboselog("maincpu", 3, "roz_coeffb = %04x\n", data); break; - case 0x190/2: m_roz_coeffc = data; verboselog("maincpu", 3, "roz_coeffc = %04x\n", data); break; - case 0x192/2: m_roz_coeffd = data; verboselog("maincpu", 3, "roz_coeffd = %04x\n", data); break; - case 0x194/2: m_roz_base_addr = (data) << 1; verboselog("maincpu", 3, "roz_base_addr = %05x\n", data << 2); break; - case 0x196/2: m_roz_tile_bank = data; verboselog("maincpu", 3, "roz_tile_bank = %04x\n", data); break; //tile bank - case 0x198/2: m_roz_unk_base0 = data << 2; verboselog("maincpu", 3, "roz_unk_base0 = %05x\n", data << 2); break; - case 0x19a/2: m_roz_unk_base1 = data << 2; verboselog("maincpu", 3, "roz_unk_base1 = %05x\n", data << 2); break; - case 0x19e/2: m_roz_unk_base2 = data << 2; verboselog("maincpu", 3, "roz_unk_base2 = %05x\n", data << 2); break; - - case 0x1d0/2: m_unk_1d0 = data; verboselog("maincpu", 3, "unk_1d0 = %04x\n", data); break; - - - - - case 0x1f0/2: //FIXME: this register is mostly not understood - m_irq_mask = data;//(data & 8) ? 0 : 1; -#if 0 - if(!m_irq_mask && !m_hbl_mask) - { - m_maincpu->set_input_line(7, CLEAR_LINE); - } -#endif - verboselog("maincpu", 3, "irq_mask = %04x\n", data); - break; - default: - verboselog("maincpu", 0, "video_w: Unknown register: %08x = %04x & %04x\n", 0xf00000 + (offset << 1), data, mem_mask); - break; - } -// m_video_regs[offset] = data; -} - - -DEVICE_IMAGE_LOAD_MEMBER( supracan_state, supracan_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size > 0x400000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - -void supracan_state::machine_start() -{ - m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_video_callback),this)); - m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_hbl_callback),this)); - m_line_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_line_on_callback),this)); - m_line_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_line_off_callback),this)); - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x000000, 0x3fffff, read16_delegate(FUNC(generic_slot_device::read16_rom),(generic_slot_device*)m_cart)); -} - - -void supracan_state::machine_reset() -{ - m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - - m_video_timer->adjust( machine().first_screen()->time_until_pos( 0, 0 ) ); - m_irq_mask = 0; -} - -/* gfxdecode is retained for reference purposes but not otherwise used by the driver */ -static const gfx_layout supracan_gfx8bpp = -{ - 8,8, - RGN_FRAC(1,1), - 8, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - { STEP8(0,8*8) }, - 8*8*8 -}; - - - -static const gfx_layout supracan_gfx4bpp = -{ - 8,8, - RGN_FRAC(1,1), - 4, - { 0,1,2,3 }, - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 8*32 -}; - -static const gfx_layout supracan_gfx2bpp = -{ - 8,8, - RGN_FRAC(1,1), - 2, - { 0,1 }, - { 0*2, 1*2, 2*2, 3*2, 4*2, 5*2, 6*2, 7*2 }, - { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, - 8*16 -}; - - -static const UINT32 xtexlayout_xoffset[64] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23, - 24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44, - 45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63 }; - -static const UINT32 xtexlayout_yoffset[64] = { 0*64,1*64,2*64,3*64,4*64,5*64,6*64,7*64,8*64, - 9*64,10*64,11*64,12*64,13*64,14*64,15*64, - 16*64,17*64,18*64,19*64,20*64,21*64,22*64,23*64, - 24*64,25*64,26*64,27*64,28*64,29*64,30*64,31*64, - 32*64,33*64,34*64,35*64,36*64,37*64,38*64,39*64, - 40*64,41*64,42*64,43*64,44*64,45*64,46*64,47*64, - 48*64,49*64,50*64,51*64,52*64,53*64,54*64,55*64, - 56*64,57*64,58*64,59*64,60*64,61*64,62*64,63*64 }; -static const gfx_layout supracan_gfx1bpp = -{ - 64,64, - RGN_FRAC(1,1), - 1, - { 0 }, - EXTENDED_XOFFS, - EXTENDED_YOFFS, - 64*64, - xtexlayout_xoffset, - xtexlayout_yoffset -}; - -static const gfx_layout supracan_gfx1bpp_alt = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - - -static GFXDECODE_START( supracan ) - GFXDECODE_RAM( "vram", 0, supracan_gfx8bpp, 0, 1 ) - GFXDECODE_RAM( "vram", 0, supracan_gfx4bpp, 0, 0x10 ) - GFXDECODE_RAM( "vram", 0, supracan_gfx2bpp, 0, 0x40 ) - GFXDECODE_RAM( "vram", 0, supracan_gfx1bpp, 0, 0x80 ) - GFXDECODE_RAM( "vram", 0, supracan_gfx1bpp_alt, 0, 0x80 ) -GFXDECODE_END - -INTERRUPT_GEN_MEMBER(supracan_state::supracan_irq) -{ -#if 0 - - if(m_irq_mask) - { - device.execute().set_input_line(7, HOLD_LINE); - } -#endif -} - -INTERRUPT_GEN_MEMBER(supracan_state::supracan_sound_irq) -{ - m_sound_irq_source_reg |= 0x80; - - if(m_sound_irq_enable_reg & m_sound_irq_source_reg) - { - m_soundcpu->set_input_line(0, ASSERT_LINE); - } - else - { - m_soundcpu->set_input_line(0, CLEAR_LINE); - } -} - -static MACHINE_CONFIG_START( supracan, supracan_state ) - - MCFG_CPU_ADD( "maincpu", M68000, XTAL_10_738635MHz ) /* Correct frequency unknown */ - MCFG_CPU_PROGRAM_MAP( supracan_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", supracan_state, supracan_irq) - - MCFG_CPU_ADD( "soundcpu", M6502, XTAL_3_579545MHz ) /* TODO: Verify actual clock */ - MCFG_CPU_PROGRAM_MAP( supracan_sound_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", supracan_state, supracan_sound_irq) - -#if !(SOUNDCPU_BOOT_HACK) - MCFG_QUANTUM_PERFECT_CPU("maincpu") - MCFG_QUANTUM_PERFECT_CPU("soundcpu") -#endif - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_RAW_PARAMS(XTAL_10_738635MHz/2, 348, 0, 256, 256, 0, 240 ) /* No idea if this is correct */ - MCFG_SCREEN_UPDATE_DRIVER(supracan_state, screen_update_supracan) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD( "palette", 32768 ) - MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_PALETTE_INIT_OWNER(supracan_state, supracan) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", supracan) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "supracan_cart") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG) - MCFG_GENERIC_LOAD(supracan_state, supracan_cart) - - MCFG_SOFTWARE_LIST_ADD("cart_list","supracan") -MACHINE_CONFIG_END - - -ROM_START( supracan ) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1995, supracan, 0, 0, supracan, supracan, driver_device, 0, "Funtech Entertainment", "Super A'Can", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/sv8000.c b/src/mess/drivers/sv8000.c deleted file mode 100644 index 95e5c09dfc5..00000000000 --- a/src/mess/drivers/sv8000.c +++ /dev/null @@ -1,417 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Robbbert -/*************************************************************************** - - Bandai Super Vision 8000 (TV Jack 8000) - driver by Wilbert Pol, Robbbert, ranger_lennier, and Charles McDonald - - 2014/01/07 Skeleton driver. - -The Bandai Super Vision 8000 contains: -- NEC D78C (Z80) -- AY-3-8910 -- AMI S68047P (6847 variant) -- NEC D8255C - -Looking at the code of the cartridges it seems there is: -- 1KB of main system RAM -- 3KB of video RAM - - TODO: - - Check configuration of S68047P pins through 8910 port A against - schematics - - Verify clock - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "sound/ay8910.h" -#include "video/mc6847.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class sv8000_state : public driver_device -{ -public: - sv8000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_s68047p(*this, "s68047p") - , m_cart(*this, "cartslot") - , m_videoram(*this, "videoram") - , m_io_row0(*this, "ROW0") - , m_io_row1(*this, "ROW1") - , m_io_row2(*this, "ROW2") - , m_io_joy(*this, "JOY") - { } - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( cart ); - - DECLARE_READ8_MEMBER( ay_port_a_r ); - DECLARE_READ8_MEMBER( ay_port_b_r ); - DECLARE_WRITE8_MEMBER( ay_port_a_w ); - DECLARE_WRITE8_MEMBER( ay_port_b_w ); - - DECLARE_READ8_MEMBER( i8255_porta_r ); - DECLARE_WRITE8_MEMBER( i8255_porta_w ); - DECLARE_READ8_MEMBER( i8255_portb_r ); - DECLARE_WRITE8_MEMBER( i8255_portb_w ); - DECLARE_READ8_MEMBER( i8255_portc_r ); - DECLARE_WRITE8_MEMBER( i8255_portc_w ); - - DECLARE_READ8_MEMBER( mc6847_videoram_r ); - -private: - virtual void machine_start(); - virtual void machine_reset(); - - required_device m_maincpu; - required_device m_s68047p; - required_device m_cart; - required_shared_ptr m_videoram; - required_ioport m_io_row0; - required_ioport m_io_row1; - required_ioport m_io_row2; - required_ioport m_io_joy; - - UINT8 m_column; - - // graphics signals - UINT8 m_ag; - UINT8 m_gm2; - UINT8 m_gm1; - UINT8 m_gm0; - UINT8 m_as; - UINT8 m_css; - UINT8 m_intext; - UINT8 m_inv; -}; - - -static ADDRESS_MAP_START(sv8000_mem, AS_PROGRAM, 8, sv8000_state) - ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0x0000, 0x0fff) // mapped by the cartslot - AM_RANGE( 0x8000, 0x83ff ) AM_RAM // Work RAM?? - AM_RANGE( 0xc000, 0xcbff ) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(sv8000_io, AS_IO, 8, sv8000_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("i8255", i8255_device, read, write) - AM_RANGE(0xc0, 0xc0) AM_DEVWRITE("ay8910", ay8910_device, data_w) // Not sure yet - AM_RANGE(0xc1, 0xc1) AM_DEVWRITE("ay8910", ay8910_device, address_w) // Not sure yet -ADDRESS_MAP_END - - -/* Input ports */ -// On the main console: -// -// 1 2 3 1 2 3 -// 4 5 6 4 5 6 -// 7 8 9 7 8 9 -// * 0 # * 0 # -// -// Button/dial? POWER RESET Button/dial? -// -static INPUT_PORTS_START( sv8000 ) - PORT_START("ROW0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("Left 1") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Left 4") // Guess - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("Left 7") // Guess - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Left *") // Guess - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Right 1") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Right 4") // Guess - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Right 7") // Guess - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("Right *") // Guess - - PORT_START("ROW1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("Left 2") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("Left 5") // Guess - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("Left 8") // Guess - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("Left 0") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Right 2") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Right 5") // Guess - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Right 8") // Guess - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Right 0") - - PORT_START("ROW2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("Left 3") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("Left 6") // Guess - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("Left 9") // Guess - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("Left #") // Guess - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Right 3") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Right 6") // Guess - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Right 9") // Guess - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Right #") // Guess - - PORT_START("JOY") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME("Left Right") - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME("Left Left") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("Left Down") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("Left Up") - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right Right") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Right Left") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Right Down") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Right Up") -INPUT_PORTS_END - - -void sv8000_state::machine_start() -{ - m_ag = 0; - m_gm2 = 0; - m_gm1 = 0; - m_gm0 = 0; - m_as = 0; - m_css = 0; - m_intext = 0; - m_inv = 0; - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - save_item(NAME(m_column)); - save_item(NAME(m_ag)); - save_item(NAME(m_gm2)); - save_item(NAME(m_gm1)); - save_item(NAME(m_gm0)); - save_item(NAME(m_as)); - save_item(NAME(m_css)); - save_item(NAME(m_intext)); - save_item(NAME(m_inv)); -} - - -void sv8000_state::machine_reset() -{ - m_column = 0xff; -} - - -DEVICE_IMAGE_LOAD_MEMBER( sv8000_state, cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size != 0x1000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Incorrect or not support cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - -READ8_MEMBER( sv8000_state::i8255_porta_r ) -{ - //logerror("i8255_porta_r\n"); - return m_io_joy->read(); -} - - -WRITE8_MEMBER( sv8000_state::i8255_porta_w ) -{ - //logerror("i8255_porta_w: %02X\n", data); -} - - -READ8_MEMBER( sv8000_state::i8255_portb_r ) -{ - UINT8 data = 0xff; - - //logerror("i8255_portb_r\n"); - - if ( ! ( m_column & 0x01 ) ) - { - data &= m_io_row0->read(); - } - if ( ! ( m_column & 0x02 ) ) - { - data &= m_io_row1->read(); - } - if ( ! ( m_column & 0x04 ) ) - { - data &= m_io_row2->read(); - } - return data; -} - - -WRITE8_MEMBER( sv8000_state::i8255_portb_w ) -{ - //logerror("i8255_portb_w: %02X\n", data); -} - - -READ8_MEMBER( sv8000_state::i8255_portc_r ) -{ - //logerror("i8255_portc_r\n"); - return 0xff; -} - - -WRITE8_MEMBER( sv8000_state::i8255_portc_w ) -{ - //logerror("i8255_portc_w: %02X\n", data); - m_column = data; -} - - -READ8_MEMBER( sv8000_state::ay_port_a_r ) -{ - UINT8 data = 0xff; - - //logerror("ay_port_a_r\n"); - return data; -} - - -READ8_MEMBER( sv8000_state::ay_port_b_r ) -{ - UINT8 data = 0xff; - - //logerror("ay_port_b_r\n"); - return data; -} - - -// Possibly connected to S68047P for selecting text/graphics modes -// misvader: -// 0x42 01000010 set on normal text screen -// 0x5A 01011010 set for a 256x192 bit mapped screen 3KB in 6KB mode? -// -// spfire: -// 0x42 01000010 text -// 0x5A 01011010 graphics 3KB in 6KB mode? -// -// othello: -// 0x02 00000010 normal text screen -// 0x58 01011000 graphics 3KB in 6KB mode? -// -// gunprof: -// 0x00 00000000 text -// 0x38 00111000 graphics 3KB mode -// -// pacpac: -// 0x00 00000000 text -// 0x5A 01011010 graphics 3KB in 6KB mode? -// -// submar: -// 0x00 00000000 text -// 0x5A 01011010 graphics 3KB in 6KB mode? -// -// beamgala: -// 0x5A 01011010 graphics 3KB in 6KB mode? -// -WRITE8_MEMBER( sv8000_state::ay_port_a_w ) -{ - //logerror("ay_port_a_w: %02X\n", data); - - // Lacking schematics, these are all wild guesses - // Having bit 1 set makes black display as blue?? - m_ag = BIT(data, 4); - m_gm2 = BIT(data, 6); - m_gm1 = BIT(data, 3); - m_gm0 = BIT(data, 3); - m_css = m_ag; - - m_s68047p->ag_w( m_ag ? ASSERT_LINE : CLEAR_LINE ); - m_s68047p->gm2_w( m_gm2 ? ASSERT_LINE : CLEAR_LINE ); - m_s68047p->gm1_w( m_gm1 ? ASSERT_LINE : CLEAR_LINE ); - m_s68047p->gm0_w( m_gm0 ? ASSERT_LINE : CLEAR_LINE ); - m_s68047p->css_w( m_css ? ASSERT_LINE : CLEAR_LINE ); - m_s68047p->hack_black_becomes_blue( BIT(data, 1) ); -} - - -WRITE8_MEMBER( sv8000_state::ay_port_b_w ) -{ - //logerror("ay_port_b_w: %02X\n", data); -} - -READ8_MEMBER( sv8000_state::mc6847_videoram_r ) -{ - if (offset == ~0) return 0xff; - - if ( m_ag ) - { - if ( m_gm2 ) - { - // 256 x 192 / 6KB - offset = ( ( offset & 0x1fc0 ) >> 1 ) | ( offset & 0x1f ); - return m_videoram[offset % 0xc00]; - } - else - { - // 256 x 96 / 3KB - return m_videoram[offset % 0xc00]; - } - } - - // Standard text - UINT8 data = m_videoram[offset % 0xc00]; - if (!data) data = 0x20; //bodge - - m_s68047p->inv_w( ( data & 0x80 ) ? ASSERT_LINE : CLEAR_LINE ); - - return data; -} - -static MACHINE_CONFIG_START( sv8000, sv8000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_10_738635MHz/3) /* Not verified */ - MCFG_CPU_PROGRAM_MAP(sv8000_mem) - MCFG_CPU_IO_MAP(sv8000_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", sv8000_state, irq0_line_hold) - - MCFG_DEVICE_ADD("i8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(sv8000_state, i8255_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(sv8000_state, i8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(sv8000_state, i8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(sv8000_state, i8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(sv8000_state, i8255_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(sv8000_state, i8255_portc_w)) - - /* video hardware */ - // S68047P - Unknown whether the internal or an external character rom is used - MCFG_DEVICE_ADD("s68047p", S68047, XTAL_10_738635MHz/3 ) // Clock not verified - MCFG_MC6847_INPUT_CALLBACK(READ8(sv8000_state, mc6847_videoram_r)) - - MCFG_SCREEN_MC6847_NTSC_ADD("screen", "s68047p") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay8910", AY8910, XTAL_10_738635MHz/3/2) /* Exact model and clock not verified */ - MCFG_AY8910_PORT_A_READ_CB(READ8(sv8000_state, ay_port_a_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(sv8000_state, ay_port_b_r)) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(sv8000_state, ay_port_a_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(sv8000_state, ay_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "sv8000_cart") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(sv8000_state, cart) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","sv8000") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sv8000 ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1979, sv8000, 0, 0, sv8000, sv8000, driver_device, 0, "Bandai", "Super Vision 8000 (TV Jack 8000)", 0 ) diff --git a/src/mess/drivers/svi318.c b/src/mess/drivers/svi318.c deleted file mode 100644 index 746820d902a..00000000000 --- a/src/mess/drivers/svi318.c +++ /dev/null @@ -1,540 +0,0 @@ -// license:??? -// copyright-holders:Sean Young,Tomas Karlsson -/* -** svi318.c : driver for Spectravideo SVI-318 and SVI-328 -** -** Sean Young, Tomas Karlsson -** -** Information taken from: http://www.samdal.com/sv318.htm -** -** SV-318 : 16KB Video RAM, 16KB RAM -** SV-328 : 16KB Video RAM, 64KB RAM -*/ - -#include "emu.h" -#include "includes/svi318.h" -#include "imagedev/flopdrv.h" -#include "formats/svi_dsk.h" -#include "formats/svi_cas.h" -#include "rendlay.h" - -static ADDRESS_MAP_START( svi318_mem, AS_PROGRAM, 8, svi318_state ) - AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITE(writemem1) - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank2") AM_WRITE(writemem2) - AM_RANGE(0xc000, 0xffff) AM_READ_BANK("bank3") AM_WRITE(writemem3) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( svi328_806_mem, AS_PROGRAM, 8, svi318_state ) - AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITE(writemem1) - AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank2") AM_WRITE(writemem2) - AM_RANGE(0xc000, 0xefff) AM_READ_BANK("bank3") AM_WRITE(writemem3) - AM_RANGE(0xf000, 0xffff) AM_READ_BANK("bank4") AM_WRITE(writemem4) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( svi318_io, AS_IO, 8, svi318_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x38) AM_READWRITE(io_ext_r, io_ext_w ) - AM_RANGE(0x80, 0x80) AM_DEVWRITE("tms9928a", tms9928a_device, vram_write) - AM_RANGE(0x81, 0x81) AM_DEVWRITE("tms9928a", tms9928a_device, register_write) - AM_RANGE(0x84, 0x84) AM_DEVREAD("tms9928a", tms9928a_device, vram_read) - AM_RANGE(0x85, 0x85) AM_DEVREAD("tms9928a", tms9928a_device, register_read) - AM_RANGE(0x88, 0x88) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0x8c, 0x8c) AM_DEVWRITE("ay8910", ay8910_device, data_w) - AM_RANGE(0x90, 0x90) AM_DEVREAD("ay8910", ay8910_device, data_r) - AM_RANGE(0x96, 0x97) AM_WRITE(ppi_w) - AM_RANGE(0x98, 0x9a) AM_DEVREAD("ppi8255", i8255_device, read) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( svi328_806_io, AS_IO, 8, svi318_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x58) AM_READWRITE(io_ext_r, io_ext_w ) - AM_RANGE(0x80, 0x80) AM_DEVWRITE("tms9928a", tms9928a_device, vram_write) - AM_RANGE(0x81, 0x81) AM_DEVWRITE("tms9928a", tms9928a_device, register_write) - AM_RANGE(0x84, 0x84) AM_DEVREAD("tms9928a", tms9928a_device, vram_read) - AM_RANGE(0x85, 0x85) AM_DEVREAD("tms9928a", tms9928a_device, register_read) - AM_RANGE(0x88, 0x88) AM_DEVWRITE("ay8910", ay8910_device, address_w) - AM_RANGE(0x8c, 0x8c) AM_DEVWRITE("ay8910", ay8910_device, data_w) - AM_RANGE(0x90, 0x90) AM_DEVREAD("ay8910", ay8910_device, data_r) - AM_RANGE(0x96, 0x97) AM_WRITE(ppi_w) - AM_RANGE(0x98, 0x9a) AM_DEVREAD("ppi8255", i8255_device, read) -ADDRESS_MAP_END - -/* - Keyboard status table - Bit#:| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - | | | | | | | | | - Line: | | | | | | | | | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 0 | "7" | "6" | "5" | "4" | "3" | "2" | "1" | "0" | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 1 | "/" | "." | "=" | "," | "'" | ":" | "9" | "8" | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 2 | "G" | "F" | "E" | "D" | "C" | "B" | "A" | "-" | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 3 | "O" | "N" | "M" | "L" | "K" | "J" | "I" | "H" | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 4 | "W" | "V" | "U" | "T" | "S" | "R" | "Q" | "P" | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 5 | UP | BS | "]" | "\" | "[" | "Z" | "Y" | "X" | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 6 |LEFT |ENTER|STOP | ESC |RGRAP|LGRAP|CTRL |SHIFT| - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 7 |DOWN | INS | CLS | F5 | F4 | F3 | F2 | F1 | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 8 |RIGHT| |PRINT| SEL |CAPS | DEL | TAB |SPACE| - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 9* | "7" | "6" | "5" | "4" | "3" | "2" | "1" | "0" | - ---------+-----+-----+-----+-----+-----+-----+-----+-----| - 10* | "," | "." | "/" | "*" | "-" | "+" | "9" | "8" | - ---------------------------------------------------------- - * Numcerical keypad (SVI-328 only) - -2008-05 FP: -Small note about natural keyboard: currently, -- "Keypad ," is not mapped -- "Left Grph" and "Right Grph" are mapped to 'Page Up' and 'Page Down' -- "Stop" is mapped to 'End' -- "Select" is mapped to 'F11' -- "CLS/HM" is mapped to 'Home' -TODO: How are multiple keys (Copy, Cut, Paste, CLS/HM) expected to -behave? Do they need multiple mapping in natural keyboard? -*/ - -static INPUT_PORTS_START( svi318 ) - PORT_START("LINE.0") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - - PORT_START("LINE.1") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR(';') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE.2") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("LINE.3") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('0') PORT_CHAR('J') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("LINE.4") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START("LINE.5") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('~') - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("LINE.6") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Grph") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Grph") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("LINE.7") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4 F9") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F10") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLS/HM Copy") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins Paste") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("LINE.8") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Cut") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Select") PORT_CODE(KEYCODE_PAUSE) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Print") PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("LINE.9") - PORT_BIT (0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.10") - PORT_BIT (0xff, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("JOYSTICKS") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - - PORT_START("BUTTONS") - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON1) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) -INPUT_PORTS_END - - -static INPUT_PORTS_START( svi328 ) - - PORT_INCLUDE( svi318 ) - - PORT_MODIFY("LINE.9") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - - PORT_MODIFY("LINE.10") - PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_DEL_PAD) -INPUT_PORTS_END - -WRITE_LINE_MEMBER(svi318_state::vdp_interrupt) -{ - m_maincpu->set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE)); -} - -FLOPPY_FORMATS_MEMBER( svi318_state::floppy_formats ) - FLOPPY_SVI_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( svi_floppies ) - SLOT_INTERFACE("dd", FLOPPY_525_DD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_FRAGMENT( svi318_cartslot ) - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "svi318_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - MCFG_GENERIC_LOAD(svi318_state, svi318_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","svi318_cart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( svi318, svi318_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 3579545) /* 3.579545 MHz */ - MCFG_CPU_PROGRAM_MAP(svi318_mem) - MCFG_CPU_IO_MAP(svi318_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(svi318_state, ppi_port_a_r)) - MCFG_I8255_IN_PORTB_CB(READ8(svi318_state, ppi_port_b_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(svi318_state, ppi_port_c_w)) - - MCFG_DEVICE_ADD("ins8250_0", INS8250, 1000000) - MCFG_INS8250_OUT_INT_CB(WRITELINE(svi318_state, ins8250_interrupt)) - MCFG_DEVICE_ADD("ins8250_1", INS8250, 3072000) - MCFG_INS8250_OUT_INT_CB(WRITELINE(svi318_state, ins8250_interrupt)) - - /* Video hardware */ - MCFG_DEVICE_ADD("tms9928a", TMS9929A, XTAL_10_738635MHz / 2) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(svi318_state, vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_PAL("screen") - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9929a_device, screen_update) - - /* Sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8910", AY8910, 1789773) - MCFG_AY8910_PORT_A_READ_CB(READ8(svi318_state, psg_port_a_r)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(svi318_state, psg_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(svi318_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(svi_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("svi318_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "svi318_cass") - - MCFG_FD1793_ADD("wd179x", XTAL_1MHz) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(svi318_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(svi318_state, fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("wd179x:0", svi_floppies, "dd", svi318_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd179x:1", svi_floppies, "dd", svi318_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("disk_list", "svi318_flop") - - MCFG_FRAGMENT_ADD(svi318_cartslot) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K,96K,160K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( svi318n, svi318 ) - - MCFG_DEVICE_REMOVE("tms9928a") - MCFG_DEVICE_REMOVE("screen") - MCFG_DEVICE_ADD("tms9928a", TMS9928A, XTAL_10_738635MHz / 2) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(svi318_state, vdp_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_NTSC("screen") - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( svi328, svi318 ) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("96K,160K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( svi328n, svi318n ) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("96K,160K") -MACHINE_CONFIG_END - - -/* F4 Character Displayer */ -static const gfx_layout svi328_charlayout = -{ - 8, 8, /* 8 x 16 characters */ - 256, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( svi328 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, svi328_charlayout, 0, 9 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( svi328_806, svi318_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 3579545) /* 3.579545 MHz */ - MCFG_CPU_PROGRAM_MAP(svi328_806_mem) - MCFG_CPU_IO_MAP(svi328_806_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(svi318_state, ppi_port_a_r)) - MCFG_I8255_IN_PORTB_CB(READ8(svi318_state, ppi_port_b_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(svi318_state, ppi_port_c_w)) - - MCFG_DEVICE_ADD("ins8250_0", INS8250, 1000000) - MCFG_INS8250_OUT_INT_CB(WRITELINE(svi318_state, ins8250_interrupt)) - MCFG_DEVICE_ADD("ins8250_1", INS8250, 3072000) - MCFG_INS8250_OUT_INT_CB(WRITELINE(svi318_state, ins8250_interrupt)) - - /* Video hardware */ - MCFG_DEFAULT_LAYOUT(layout_dualhsxs) - - MCFG_DEVICE_ADD("tms9928a", TMS9929A, XTAL_10_738635MHz / 2) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(svi318_state, vdp_interrupt)) - MCFG_TMS9928A_SET_SCREEN("screen") - MCFG_TMS9928A_SCREEN_ADD_PAL("screen") - MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9929a_device, screen_update) - MCFG_PALETTE_ADD("palette", TMS9928A_PALETTE_SIZE + 2) /* 2 additional entries for monochrome svi806 output */ - - MCFG_SCREEN_ADD("svi806", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", svi328) - - MCFG_MC6845_ADD("crtc", MC6845, "svi806", XTAL_12MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) /* ? */ - MCFG_MC6845_UPDATE_ROW_CB(svi318_state, crtc_update_row) - - /* Sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay8910", AY8910, 1789773) - MCFG_AY8910_PORT_A_READ_CB(READ8(svi318_state, psg_port_a_r)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(svi318_state, psg_port_b_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(svi318_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(svi_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("svi318_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "svi318_cass") - - MCFG_FD1793_ADD("wd179x", XTAL_1MHz) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(svi318_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(svi318_state, fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("wd179x:0", svi_floppies, "dd", svi318_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd179x:1", svi_floppies, "dd", svi318_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("disk_list", "svi318_flop") - - MCFG_FRAGMENT_ADD(svi318_cartslot) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("96K,160K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( svi328n_806, svi328_806 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(60) -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( svi318 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS(0, "111", "SV BASIC v1.11") - ROMX_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "110", "SV BASIC v1.1") - ROMX_LOAD("svi110.rom", 0x0000, 0x8000, CRC(709904e9) SHA1(7d8daf52f78371ca2c9443e04827c8e1f98c8f2c), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "100", "SV BASIC v1.0") - ROMX_LOAD("svi100.rom", 0x0000, 0x8000, CRC(98d48655) SHA1(07758272df475e5e06187aa3574241df1b14035b), ROM_BIOS(3)) -ROM_END - -ROM_START( svi318n ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS(0, "111", "SV BASIC v1.11") - ROMX_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "110", "SV BASIC v1.1") - ROMX_LOAD("svi110.rom", 0x0000, 0x8000, CRC(709904e9) SHA1(7d8daf52f78371ca2c9443e04827c8e1f98c8f2c), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "100", "SV BASIC v1.0") - ROMX_LOAD("svi100.rom", 0x0000, 0x8000, CRC(98d48655) SHA1(07758272df475e5e06187aa3574241df1b14035b), ROM_BIOS(3)) -ROM_END - -ROM_START( svi328 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS(0, "111", "SV BASIC v1.11") - ROMX_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "110", "SV BASIC v1.1") - ROMX_LOAD("svi110.rom", 0x0000, 0x8000, CRC(709904e9) SHA1(7d8daf52f78371ca2c9443e04827c8e1f98c8f2c), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "100", "SV BASIC v1.0") - ROMX_LOAD("svi100.rom", 0x0000, 0x8000, CRC(98d48655) SHA1(07758272df475e5e06187aa3574241df1b14035b), ROM_BIOS(3)) -ROM_END - -ROM_START( svi328n ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_SYSTEM_BIOS(0, "111", "SV BASIC v1.11") - ROMX_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "110", "SV BASIC v1.1") - ROMX_LOAD("svi110.rom", 0x0000, 0x8000, CRC(709904e9) SHA1(7d8daf52f78371ca2c9443e04827c8e1f98c8f2c), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "100", "SV BASIC v1.0") - ROMX_LOAD("svi100.rom", 0x0000, 0x8000, CRC(98d48655) SHA1(07758272df475e5e06187aa3574241df1b14035b), ROM_BIOS(3)) -ROM_END - -ROM_START( sv328p80 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89)) - - ROM_REGION( 0x1000, "gfx1", 0 ) - ROM_SYSTEM_BIOS(0, "english", "English Character Set") - ROMX_LOAD("svi806.rom", 0x0000, 0x1000, CRC(850bc232) SHA1(ed45cb0e9bd18a9d7bd74f87e620f016a7ae840f), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "swedish", "Swedish Character Set") - ROMX_LOAD("svi806se.rom", 0x0000, 0x1000, CRC(daea8956) SHA1(3f16d5513ad35692488ae7d864f660e76c6e8ed3), ROM_BIOS(2)) -ROM_END - -ROM_START( sv328n80 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("svi111.rom", 0x0000, 0x8000, CRC(bc433df6) SHA1(10349ce675f6d6d47f0976e39cb7188eba858d89)) - - ROM_REGION( 0x1000, "gfx1", 0 ) - ROM_SYSTEM_BIOS(0, "english", "English Character Set") - ROMX_LOAD("svi806.rom", 0x0000, 0x1000, CRC(850bc232) SHA1(ed45cb0e9bd18a9d7bd74f87e620f016a7ae840f), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "swedish", "Swedish Character Set") - ROMX_LOAD("svi806se.rom", 0x0000, 0x1000, CRC(daea8956) SHA1(3f16d5513ad35692488ae7d864f660e76c6e8ed3), ROM_BIOS(2)) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, svi318, 0, 0, svi318, svi318, svi318_state, svi318, "Spectravideo", "SVI-318 (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, svi318n, svi318, 0, svi318n, svi318, svi318_state, svi318, "Spectravideo", "SVI-318 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, svi328, svi318, 0, svi328, svi328, svi318_state, svi318, "Spectravideo", "SVI-328 (PAL)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, svi328n, svi318, 0, svi328n, svi328, svi318_state, svi318, "Spectravideo", "SVI-328 (NTSC)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, sv328p80, svi318, 0, svi328_806, svi328, svi318_state, svi328_806, "Spectravideo", "SVI-328 (PAL) + SVI-806 80 column card", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, sv328n80, svi318, 0, svi328n_806, svi328, svi318_state, svi328_806, "Spectravideo", "SVI-328 (NTSC) + SVI-806 80 column card", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/svision.c b/src/mess/drivers/svision.c deleted file mode 100644 index 931d4f391d4..00000000000 --- a/src/mess/drivers/svision.c +++ /dev/null @@ -1,606 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - watara supervision handheld - - PeT mess@utanet.at in december 2000 -******************************************************************************/ - -#include "emu.h" -#include "includes/svision.h" - -#include "svision.lh" - -#define MAKE8_RGB32(red3, green3, blue2) ( ( (red3)<<(16+5)) | ( (green3)<<(8+5)) | ( (blue2)<<(0+6)) ) -#define MAKE9_RGB32(red3, green3, blue3) ( ( (red3)<<(16+5)) | ( (green3)<<(8+5)) | ( (blue3)<<(0+5)) ) -#define MAKE12_RGB32(red4, green4, blue4) ( ( (red4)<<(16+4)) | ((green4)<<(8+4)) | ((blue4)<<(0+4)) ) -#define MAKE24_RGB32(red8, green8, blue8) ( (((red8)&0xf8)<<16) | (((green8)&0xf8)<<8) | (((blue8)&0xf8)) ) - - -// in pixel -#define XSIZE (m_reg[0]&~3) -#define XPOS m_reg[2] -#define YPOS m_reg[3] -#define BANK m_reg[0x26] - -TIMER_CALLBACK_MEMBER(svision_state::svision_pet_timer) -{ - switch (m_pet.state) - { - case 0: - if ( m_joy2 ) - { - m_pet.input = m_joy2->read(); - } - /* fall through */ - - case 2: case 4: case 6: case 8: - case 10: case 12: case 14: - m_pet.clock = m_pet.state & 2; - m_pet.data = m_pet.input & 1; - m_pet.input >>= 1; - m_pet.state++; - break; - - case 16+15: - m_pet.state = 0; - break; - - default: - m_pet.state++; - break; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(svision_state::svision_pet_timer_dev) -{ - svision_pet_timer(ptr,param); -} - -void svision_state::svision_irq() -{ - int irq = m_svision.timer_shot && (BANK & 2); - irq = irq || (*m_dma_finished && (BANK & 4)); - - m_maincpu->set_input_line(M65C02_IRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE); -} - -TIMER_CALLBACK_MEMBER(svision_state::svision_timer) -{ - m_svision.timer_shot = TRUE; - m_svision.timer1->enable(FALSE); - svision_irq(); -} - -READ8_MEMBER(svision_state::svision_r) -{ - int data = m_reg[offset]; - switch (offset) - { - case 0x20: - data = m_joy->read(); - break; - - case 0x21: - data &= ~0xf; - data |= m_reg[0x22] & 0xf; - if (m_pet.on) - { - if (!m_pet.clock) - { - data &= ~4; - } - if (!m_pet.data) - { - data &= ~8; - } - } - break; - - case 0x27: - data &= ~3; - if (m_svision.timer_shot) - { - data|=1; - } - if (*m_dma_finished) - { - data|=2; - } - break; - - case 0x24: - m_svision.timer_shot = FALSE; - svision_irq(); - break; - - case 0x25: - *m_dma_finished = FALSE; - svision_irq(); - break; - - default: - logerror("%.6f svision read %04x %02x\n", machine().time().as_double(),offset,data); - break; - } - - return data; -} - -WRITE8_MEMBER(svision_state::svision_w) -{ - int value, delay, bank; - - m_reg[offset] = data; - - switch (offset) - { - case 2: - case 3: - break; - - case 0x26: /* bits 5,6 memory management for a000? */ - logerror("%.6f svision write %04x %02x\n", machine().time().as_double(), offset, data); - bank = ((m_reg[0x26] & 0xe0) >> 5) % (m_cart_rom->bytes() / 0x4000); - m_bank1->set_base(m_cart_rom->base() + (bank * 0x4000)); - svision_irq(); - break; - - case 0x23: /* delta hero irq routine write */ - value = data; - if (!data) - { - value = 0x100; - } - if (BANK & 0x10) - { - delay = 16384; - } - else - { - delay = 256; - } - m_svision.timer1->enable(TRUE); - m_svision.timer1->reset(m_maincpu->cycles_to_attotime(value * delay)); - break; - - case 0x10: case 0x11: case 0x12: case 0x13: - m_sound->soundport_w(0, offset & 3, data); - break; - - case 0x14: case 0x15: case 0x16: case 0x17: - m_sound->soundport_w(1, offset & 3, data); - break; - - case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: - m_sound->sounddma_w(space, offset - 0x18, data); - break; - - case 0x28: case 0x29: case 0x2a: - m_sound->noise_w(space, offset - 0x28, data); - break; - - default: - logerror("%.6f svision write %04x %02x\n", machine().time().as_double(), offset, data); - break; - } -} - -READ8_MEMBER(svision_state::tvlink_r) -{ - switch(offset) - { - default: - if (offset >= 0x800 && offset < 0x840) - { - /* strange effects when modifying palette */ - return svision_r(space, offset); - } - else - { - return svision_r(space, offset); - } - } -} - -WRITE8_MEMBER(svision_state::tvlink_w) -{ - switch (offset) - { - case 0x0e: - m_reg[offset] = data; - m_tvlink.palette_on = data & 1; - if (m_tvlink.palette_on) - { - // hack, normally initialising with palette from ram - m_tvlink.palette[0] = MAKE12_RGB32(163/16,172/16,115/16); // these are the tron colors messured from screenshot - m_tvlink.palette[1] = MAKE12_RGB32(163/16,155/16,153/16); - m_tvlink.palette[2] = MAKE12_RGB32(77/16,125/16,73/16); - m_tvlink.palette[3] = MAKE12_RGB32(59/16,24/16,20/16); - } - else - { - // cleaner to use colors from compile time palette, or compose from "fixed" palette values - m_tvlink.palette[0]=MAKE12_RGB32(0,0,0); - m_tvlink.palette[1]=MAKE12_RGB32(5*16/256,18*16/256,9*16/256); - m_tvlink.palette[2]=MAKE12_RGB32(48*16/256,76*16/256,100*16/256); - m_tvlink.palette[3]=MAKE12_RGB32(190*16/256,190*16/256,190*16/256); - } - break; - default: - svision_w(space, offset,data); - if (offset >= 0x800 && offset < 0x840) - { - UINT16 c; - if (offset == 0x803 && data == 0x07) - { - /* tron hack */ - m_reg[0x0804]=0x00; - m_reg[0x0805]=0x01; - m_reg[0x0806]=0x00; - m_reg[0x0807]=0x00; - } - c = m_reg[0x800] | (m_reg[0x804] << 8); - m_tvlink.palette[0] = MAKE9_RGB32( (c>>0)&7, (c>>3)&7, (c>>6)&7); - c = m_reg[0x801] | (m_reg[0x805] << 8); - m_tvlink.palette[1] = MAKE9_RGB32( (c>>0)&7, (c>>3)&7, (c>>6)&7); - c = m_reg[0x802] | (m_reg[0x806]<<8); - m_tvlink.palette[2]=MAKE9_RGB32( (c>>0)&7, (c>>3)&7, (c>>6)&7); - c = m_reg[0x803] | (m_reg[0x807]<<8); - m_tvlink.palette[3]=MAKE9_RGB32( (c>>0)&7, (c>>3)&7, (c>>6)&7); - /* writes to palette effect video color immediately */ - /* some writes modify other registers, */ - /* encoding therefor not known (rgb8 or rgb9) */ - } - } -} - -static ADDRESS_MAP_START( svision_mem , AS_PROGRAM, 8, svision_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0x3fff) AM_READWRITE(svision_r, svision_w) AM_SHARE("reg") - AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x6000, 0x7fff) AM_NOP - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") - AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank2") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tvlink_mem , AS_PROGRAM, 8, svision_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0x3fff) AM_READWRITE(tvlink_r, tvlink_w) AM_SHARE("reg") - AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x6000, 0x7fff) AM_NOP - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") - AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank2") -ADDRESS_MAP_END - -static INPUT_PORTS_START( svision ) - PORT_START("JOY") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") -INPUT_PORTS_END - -static INPUT_PORTS_START( svisions ) - PORT_START("JOY") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B") PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A") PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select") PORT_PLAYER(1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause") PORT_PLAYER(1) - PORT_START("JOY2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("2nd B") PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("2nd A") PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("2nd Select") PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("2nd Start/Pause") PORT_PLAYER(2) -INPUT_PORTS_END - -/* most games contain their graphics in roms, and have hardware to - draw complete rectangular objects */ - -#define PALETTE_START 0 - -/* palette in red, green, blue triples */ -static const unsigned char svision_palette[] = -{ -#if 0 - /* greens grabbed from a scan of a handheld - * in its best adjustment for contrast - */ - 86, 121, 86, - 81, 115, 90, - 74, 107, 101, - 54, 78, 85 -#else - /* grabbed from chris covell's black white pics */ - 0xe0, 0xe0, 0xe0, - 0xb9, 0xb9, 0xb9, - 0x54, 0x54, 0x54, - 0x12, 0x12, 0x12 -#endif -}; - -/* palette in red, green, blue tribles */ -static const unsigned char svisionp_palette[] = -{ - // pal - 1, 1, 3, - 5, 18, 9, - 48, 76, 100, - 190, 190, 190 -}; - -/* palette in red, green, blue tribles */ -static const unsigned char svisionn_palette[] = -{ - 0, 0, 0, - 188, 242, 244, // darker - 129, 204, 255, - 245, 249, 248 -}; - -PALETTE_INIT_MEMBER(svision_state, svision) -{ - for (int i = 0; i < sizeof(svision_palette) / 3; i++) - palette.set_pen_color(i, svision_palette[i*3], svision_palette[i*3+1], svision_palette[i*3+2]); -} -PALETTE_INIT_MEMBER(svision_state,svisionn) -{ - for (int i = 0; i < sizeof(svisionn_palette) / 3; i++) - palette.set_pen_color(i, svisionn_palette[i*3], svisionn_palette[i*3+1], svisionn_palette[i*3+2]); -} -PALETTE_INIT_MEMBER(svision_state,svisionp) -{ - for (int i = 0; i < sizeof(svisionn_palette) / 3; i++) - palette.set_pen_color(i, svisionp_palette[i*3], svisionp_palette[i*3+1], svisionp_palette[i*3+2]); -} - -UINT32 svision_state::screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, i, j=XPOS/4+YPOS*0x30; - UINT8 *videoram = m_videoram; - - if (BANK&8) - { - for (y=0; y<160; y++) - { - UINT16 *line = &bitmap.pix16(y, 3 - (XPOS & 3)); - for (x=3-(XPOS&3),i=0; x<160+3 && x>6)&3)+PALETTE_START; - line[2]=((b>>4)&3)+PALETTE_START; - line[1]=((b>>2)&3)+PALETTE_START; - line[0]=((b>>0)&3)+PALETTE_START; - line+=4; - } - j += 0x30; - if (j >= 8160) - j = 0; //sssnake - } - } - else - { - bitmap.plot_box(3, 0, 162, 159, PALETTE_START); - } - return 0; -} - -UINT32 svision_state::screen_update_tvlink(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int x, y, i, j = XPOS/4+YPOS*0x30; - UINT8 *videoram = m_videoram; - - if (BANK & 8) - { - for (y = 0; y < 160; y++) - { - UINT32 *line = &bitmap.pix32(y, 3 - (XPOS & 3)); - for (x = 3 - (XPOS & 3), i = 0; x < 160 + 3 && x < XSIZE + 3; x += 4, i++) - { - UINT8 b=videoram[j+i]; - line[3]=m_tvlink.palette[(b>>6)&3]; - line[2]=m_tvlink.palette[(b>>4)&3]; - line[1]=m_tvlink.palette[(b>>2)&3]; - line[0]=m_tvlink.palette[(b>>0)&3]; - line+=4; - } - j += 0x30; - if (j >= 8160) - j = 0; //sssnake - } - } - else - { - bitmap.plot_box(3, 0, 162, 159, m_palette->pen(PALETTE_START)); - } - return 0; -} - -INTERRUPT_GEN_MEMBER(svision_state::svision_frame_int) -{ - if (BANK & 1) - device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); - - m_sound->sound_decrement(); -} - -DRIVER_INIT_MEMBER(svision_state, svision) -{ - m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this)); - m_dma_finished = m_sound->dma_finished(); - m_pet.on = FALSE; -} - -DRIVER_INIT_MEMBER(svision_state, svisions) -{ - m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this)); - m_dma_finished = m_sound->dma_finished(); - m_pet.on = TRUE; - m_pet.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_pet_timer),this)); -} - -DEVICE_IMAGE_LOAD_MEMBER( svision_state, svision_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size > 0x20000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -void svision_state::machine_start() -{ - int num_banks; - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - num_banks = m_cart_rom->bytes() / 0x4000; - - m_bank1 = membank("bank1"); - m_bank2 = membank("bank2"); - // bank1 is set to the first bank - // do not crash if no cart - if (num_banks) - { - m_bank1->set_base(m_cart_rom->base()); - // bank2 is set to the last bank - m_bank2->set_base(m_cart_rom->base() + (num_banks - 1) * 0x4000); - } -} - -void svision_state::machine_reset() -{ - m_svision.timer_shot = FALSE; - *m_dma_finished = FALSE; -} - - -MACHINE_RESET_MEMBER(svision_state,tvlink) -{ - svision_state::machine_reset(); - m_tvlink.palette_on = FALSE; - - memset(m_reg + 0x800, 0xff, 0x40); // normally done from m_tvlink microcontroller - m_reg[0x82a] = 0xdf; - - m_tvlink.palette[0] = MAKE24_RGB32(svisionp_palette[(PALETTE_START+0)*3+0], svisionp_palette[(PALETTE_START+0)*3+1], svisionp_palette[(PALETTE_START+0)*3+2]); - m_tvlink.palette[1] = MAKE24_RGB32(svisionp_palette[(PALETTE_START+1)*3+0], svisionp_palette[(PALETTE_START+1)*3+1], svisionp_palette[(PALETTE_START+1)*3+2]); - m_tvlink.palette[2] = MAKE24_RGB32(svisionp_palette[(PALETTE_START+2)*3+0], svisionp_palette[(PALETTE_START+2)*3+1], svisionp_palette[(PALETTE_START+2)*3+2]); - m_tvlink.palette[3] = MAKE24_RGB32(svisionp_palette[(PALETTE_START+3)*3+0], svisionp_palette[(PALETTE_START+3)*3+1], svisionp_palette[(PALETTE_START+3)*3+2]); -} - -static MACHINE_CONFIG_START( svision, svision_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M65C02, 4000000) /* ? stz used! speed? */ - MCFG_CPU_PROGRAM_MAP(svision_mem) - MCFG_CPU_VBLANK_INT_DRIVER("screen", svision_state, svision_frame_int) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(61) - MCFG_SCREEN_SIZE(3+160+3, 160) - MCFG_SCREEN_VISIBLE_AREA(3+0, 3+160-1, 0, 160-1) - MCFG_SCREEN_UPDATE_DRIVER(svision_state, screen_update_svision) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(svision_palette) * 3) - MCFG_PALETTE_INIT_OWNER(svision_state, svision ) - - MCFG_DEFAULT_LAYOUT(layout_svision) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", SVISION_SND, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - SVISION_SND_IRQ_CB(svision_state, svision_irq) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "svision_cart") - MCFG_GENERIC_EXTENSIONS("bin,ws,sv") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(svision_state, svision_cart) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "svision") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( svisions, svision ) - MCFG_TIMER_DRIVER_ADD_PERIODIC("pet_timer", svision_state, svision_pet_timer_dev, attotime::from_seconds(8)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( svisionp, svision ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(4430000) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(svision_state, svisionp) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( svisionn, svision ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(3560000/*?*/) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(svision_state, svisionn) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tvlinkp, svisionp ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(tvlink_mem) - - MCFG_MACHINE_RESET_OVERRIDE(svision_state, tvlink) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_NO_PALETTE - MCFG_SCREEN_UPDATE_DRIVER(svision_state, screen_update_tvlink) - -MACHINE_CONFIG_END - -ROM_START(svision) - ROM_REGION(0x20000, "maincpu", ROMREGION_ERASE00) -ROM_END - - -#define rom_svisions rom_svision -#define rom_svisionn rom_svision -#define rom_svisionp rom_svision -#define rom_tvlinkp rom_svision - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -// marketed under a ton of firms and names -CONS(1992, svision, 0, 0, svision, svision, svision_state, svision, "Watara", "Super Vision", 0) -// svdual 2 connected via communication port -CONS( 1992, svisions, svision, 0,svisions, svisions, svision_state, svisions, "Watara", "Super Vision (PeT Communication Simulation)", 0 ) - -CONS( 1993, svisionp, svision, 0,svisionp, svision, svision_state, svision, "Watara", "Super Vision (PAL TV Link Colored)", 0 ) -CONS( 1993, svisionn, svision, 0,svisionn, svision, svision_state, svision, "Watara", "Super Vision (NTSC TV Link Colored)", 0 ) -// svtvlink (2 supervisions) -// tvlink (pad supervision simulated) -CONS( 199?, tvlinkp, svision, 0,tvlinkp, svision, svision_state, svision, "Watara", "TV Link PAL", 0 ) diff --git a/src/mess/drivers/svmu.c b/src/mess/drivers/svmu.c deleted file mode 100644 index 1e077c8211f..00000000000 --- a/src/mess/drivers/svmu.c +++ /dev/null @@ -1,358 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Sega Visual Memory Unit - - driver by Sandro Ronco - - TODO: - - add more bios versions - - serial - -****************************************************************************/ - -#include "emu.h" -#include "cpu/lc8670/lc8670.h" -#include "imagedev/snapquik.h" -#include "machine/intelfsh.h" -#include "sound/speaker.h" -#include "svmu.lh" - -#define PIXEL_SIZE 7 -#define PIXEL_DISTANCE 1 - -class svmu_state : public driver_device -{ -public: - svmu_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_flash(*this, "flash"), - m_speaker(*this, "speaker"), - m_bios(*this, "bios") - { } - - required_device m_maincpu; - required_device m_flash; - required_device m_speaker; - required_region_ptr m_bios; - - DECLARE_PALETTE_INIT(svmu); - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER(page_w); - DECLARE_READ8_MEMBER(prog_r); - DECLARE_WRITE8_MEMBER(prog_w); - DECLARE_READ8_MEMBER(p1_r); - DECLARE_WRITE8_MEMBER(p1_w); - DECLARE_READ8_MEMBER(p7_r); - DECLARE_QUICKLOAD_LOAD_MEMBER( svmu ); - -private: - UINT8 m_page; -}; - - -WRITE8_MEMBER(svmu_state::page_w) -{ - m_page = data & 0x03; -} - -READ8_MEMBER(svmu_state::prog_r) -{ - if (m_page == 1) - return m_flash->read(offset); - else if (m_page == 2) - return m_flash->read(0x10000 + offset); - else - return m_bios[offset]; -} - -WRITE8_MEMBER(svmu_state::prog_w) -{ - if (m_page == 1) - m_flash->write(offset, data); - else if (m_page == 2) - m_flash->write(0x10000 + offset, data); -} - -/* - Port 1 - - x--- ---- PWM output - -x-- ---- BUZ - --x- ---- SCK1 - ---x ---- SB1 - ---- x--- SO1 - ---- -x-- SCK0 - ---- --x- SB0 - ---- ---x SO0 - -*/ - -READ8_MEMBER(svmu_state::p1_r) -{ - return 0; -} - -WRITE8_MEMBER(svmu_state::p1_w) -{ - m_speaker->level_w(BIT(data, 7)); -} - - -/* - Port 7 - - ---- x--- ID1 - ---- -x-- ID0 - ---- --x- battery low voltage - ---- ---x 5V detection -*/ - -READ8_MEMBER(svmu_state::p7_r) -{ - return (ioport("BATTERY")->read()<<1); -} - - -static ADDRESS_MAP_START(svmu_mem, AS_PROGRAM, 8, svmu_state) - AM_RANGE( 0x0000, 0xffff ) AM_READWRITE(prog_r, prog_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(svmu_io_mem, AS_IO, 8, svmu_state) - AM_RANGE( LC8670_PORT1, LC8670_PORT1 ) AM_READWRITE(p1_r, p1_w) - AM_RANGE( LC8670_PORT3, LC8670_PORT3 ) AM_READ_PORT("P3") - AM_RANGE( LC8670_PORT7, LC8670_PORT7 ) AM_READ(p7_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( svmu ) - PORT_START( "P3" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button A") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button B") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("MODE") PORT_CODE( KEYCODE_M ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("SLEEP") PORT_CODE( KEYCODE_S ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x01, "Battery" ) - PORT_CONFSETTING( 0x01, "Good" ) - PORT_CONFSETTING( 0x00, "Poor" ) -INPUT_PORTS_END - -void svmu_state::machine_reset() -{ - m_page = 0; -} - -PALETTE_INIT_MEMBER(svmu_state, svmu) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static LC8670_LCD_UPDATE( svmu_lcd_update ) -{ - if (lcd_enabled) - { - for (int y=0; y<32; y++) - for (int x=0; x<6; x++) - { - int gfx = vram[y*6 + x]; - - for (int b=0; b<8; b++) - bitmap.plot_box((x*8 + b) * (PIXEL_SIZE + PIXEL_DISTANCE), y * (PIXEL_SIZE + PIXEL_DISTANCE), PIXEL_SIZE, PIXEL_SIZE, BIT(gfx,7-b)); - } - } - else - { - bitmap.fill(0, cliprect); - } - - output_set_value("file_icon" , lcd_enabled ? BIT(vram[0xc1],6) : 0); - output_set_value("game_icon" , lcd_enabled ? BIT(vram[0xc2],4) : 0); - output_set_value("clock_icon", lcd_enabled ? BIT(vram[0xc3],2) : 0); - output_set_value("flash_icon", lcd_enabled ? BIT(vram[0xc4],0) : 0); - - return 0; -} - - -inline void vmufat_write_byte(UINT8* flash, UINT8 block, offs_t offset, UINT8 data) -{ - flash[(block * 512) + offset] = data; -} - -inline void vmufat_write_word(UINT8* flash, UINT8 block, offs_t offset, UINT16 data) -{ - // 16-bit data are stored in little endian - flash[(block * 512) + offset + 0] = data & 0xff; - flash[(block * 512) + offset + 1] = (data>>8) & 0xff; -} - -QUICKLOAD_LOAD_MEMBER( svmu_state, svmu ) -{ - UINT32 size = image.length(); - UINT8 *flash = (UINT8*)m_flash->space().get_read_ptr(0); - - image.fread(flash, size); - - // verify if image is already a valid VMUFAT file system - bool valid_vmufat = true; - if (size == 0x20000) - { - for (int i=0; i<0x10; i++) - if (flash[255 * 512 + i] != 0x55) - { - valid_vmufat = false; - break; - } - } - else - { - valid_vmufat = false; - } - - if (!valid_vmufat) - { - // more info about the VMUFAT here: http://mc.pp.se/dc/vms/flashmem.html - - //-------------------------------- Formatting -------------------------------- - memset(flash + 241*512, 0, 15*512); // clears the last 15 blocks that contain file system information - - for (int i=0; i<0x10; i++) - vmufat_write_byte(flash, 255, i, 0x55); // first 16 bytes should be 0x55 to indicate a properly formatted card - - vmufat_write_byte(flash, 255, 0x10, 0x00); // custom VMS colour (1 = use custom colours, 0 = standard colour) - vmufat_write_byte(flash, 255, 0x11, 0x00); // VMS colour blue component - vmufat_write_byte(flash, 255, 0x12, 0x00); // VMS colour green component - vmufat_write_byte(flash, 255, 0x13, 0x00); // VMS colour red component - vmufat_write_byte(flash, 255, 0x14, 0x00); // VMS colour alpha component - vmufat_write_byte(flash, 255, 0x30, 0x19); // Century (BCD) - vmufat_write_byte(flash, 255, 0x31, 0x99); // Year (BCD) - vmufat_write_byte(flash, 255, 0x32, 0x01); // Month (BCD) - vmufat_write_byte(flash, 255, 0x33, 0x01); // Day (BCD) - vmufat_write_byte(flash, 255, 0x34, 0x00); // Hour (BCD) - vmufat_write_byte(flash, 255, 0x35, 0x00); // Minute (BCD) - vmufat_write_byte(flash, 255, 0x36, 0x00); // Second (BCD) - vmufat_write_byte(flash, 255, 0x37, 0x00); // Day of week (0 = Monday, 6 = Sunday) - vmufat_write_word(flash, 255, 0x44, 0x00ff); // location of Root - vmufat_write_word(flash, 255, 0x46, 0x00fe); // location of FAT (254) - vmufat_write_word(flash, 255, 0x48, 0x0001); // size of FAT in blocks (1) - vmufat_write_word(flash, 255, 0x4a, 0x00fd); // location of Directory (253) - vmufat_write_word(flash, 255, 0x4c, 0x000d); // size of Directory in blocks (13) - vmufat_write_word(flash, 255, 0x4e, 0x0000); // icon shape for this VMS (0-123) - vmufat_write_word(flash, 255, 0x50, 0x00c8); // number of user blocks (200) - - for (int i=0; i<256; i++) - vmufat_write_word(flash, 254, i<<1, 0xfffc); // marks all blocks as unallocated - - for (int i=253; i>241; --i) - vmufat_write_word(flash, 254, i<<1, i - 1); // marsk all Directory blocks as allocate - - vmufat_write_word(flash, 254, 0x1e2, 0xfffa); // marks last Directory block - vmufat_write_word(flash, 254, 0x1fc, 0xfffa); // marks FAT block as allocated - vmufat_write_word(flash, 254, 0x1fe, 0xfffa); // marks Root block as allocated - - //-------------------------------- Create the vms file -------------------------------- - int vms_blocks = (size / 512) + (size & 0x1ff ? 1 : 0); // number of blocks required for store the vms file - - for (int i=0; i m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(swtpc_status_r); - DECLARE_READ8_MEMBER(swtpc_terminal_r); - DECLARE_READ8_MEMBER(swtpc_tricky_r); - DECLARE_WRITE8_MEMBER(swtpc_terminal_w); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_term_data; - virtual void machine_reset(); -}; - -// bit 0 - ready to receive a character; bit 1 - ready to send a character to the terminal -READ8_MEMBER( swtpc_state::swtpc_status_r ) -{ - return (m_term_data) ? 3 : 0x82; -} - -READ8_MEMBER( swtpc_state::swtpc_terminal_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( swtpc_state::swtpc_tricky_r ) -{ - UINT8 ret = m_term_data; - return ret; -} - -static ADDRESS_MAP_START(swtpc_mem, AS_PROGRAM, 8, swtpc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x8004, 0x8004 ) AM_READ(swtpc_status_r) - AM_RANGE( 0x8005, 0x8005 ) AM_READ(swtpc_terminal_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE( 0x8007, 0x8007 ) AM_READ(swtpc_tricky_r) - AM_RANGE( 0xa000, 0xa07f ) AM_RAM - AM_RANGE( 0xe000, 0xe3ff ) AM_MIRROR(0x1c00) AM_ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( swtpc ) -INPUT_PORTS_END - - -void swtpc_state::machine_reset() -{ -} - -WRITE8_MEMBER( swtpc_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( swtpc, swtpc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6800, XTAL_1MHz) - MCFG_CPU_PROGRAM_MAP(swtpc_mem) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(swtpc_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( swtpc ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "swt", "SWTBUG" ) - ROMX_LOAD( "swtbug.bin", 0xe000, 0x0400, CRC(f9130ef4) SHA1(089b2d2a56ce9526c3e78ce5d49ce368b9eabc0c), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "mik", "MIKBUG" ) - ROMX_LOAD( "mikbug.bin", 0xe000, 0x0400, CRC(e7f4d9d0) SHA1(5ad585218f9c9c70f38b3c74e3ed5dfe0357621c), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1975, swtpc, 0, 0, swtpc, swtpc, driver_device, 0, "Southwest Technical Products Corporation", "SWTPC 6800", MACHINE_NO_SOUND) diff --git a/src/mess/drivers/swtpc09.c b/src/mess/drivers/swtpc09.c deleted file mode 100644 index e1237b55a06..00000000000 --- a/src/mess/drivers/swtpc09.c +++ /dev/null @@ -1,265 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robert Justice -/************************************************************************** - - SWTPC S/09 Mess driver - Robert Justice ,2009-2014 - - Emulates four different fixed combinations of hardware - 1. swtpc09 - MP-09 with SBUG rom, MP-ID, MP-S2, DMF2. - Will boot Flex operating system - 2. swtpc09i - MP-09 with SBUG rom + HDrom, MP-ID, MP-S2, DMF2, PIAIDE. - Will boot Flex operating system - TODO: finish ide part and get this one working. - 3. swtpc09u - MP-09 with UniBUG rom, MP-ID, MP-S2, DMF2. - Will boot UniFlex operating system - 4. swtpc09d3 - MP-09 with UniBUG U3 rom, MP-ID, MP-S2, DMF3. - Will boot UniFlex operating system - TODO: add Harddisk support, DMF3 has WD1000 interface - -***************************************************************************/ - -#include "emu.h" -#include "includes/swtpc09.h" -#include "formats/flex_dsk.h" - - -/************************************************************************** - Address maps - - 56K of RAM from 0x0000 to 0xdfff - 2K of ROM from 0xf800 to 0xffff - - E000 - E003 S2 MC6850 ACIA1 (used for UniFlex console) - E004 - E007 S2 MC6850 ACIA2 (used for Flex console) - E080 - E08F MPID MC6821 PIA - E090 - E09F MPID MC6840 PTM - - F000 - F01F DMF2 MC6844 DMAC - F020 - F023 DMF2 WD1791 FDC - F024 - F03F DMF2 Drive select register - F040 - F041 DMF2 DMA Address register - - F800 - FFFF ROM - FFF0 - FFFF DAT RAM (only for writes) - - - for DMF3 version - F000 - F01F DMF3 MC6844 DMAC - F020 - F023 DMF3 WD1791 FDC - F024 - F024 DMF3 Drive select register - F025 - F025 DMF3 DMA Address register - F040 - F04F DMF3 6522 VIA - -***************************************************************************/ - -/* Address map is dynamically setup when DAT memory is written to */ -/* only ROM from FF00-FFFF and DAT memory at FFF0-FFFF (write only) is guaranteed always*/ - -static ADDRESS_MAP_START(swtpc09_mem, AS_PROGRAM, 8, swtpc09_state) - AM_RANGE(0xff00, 0xffef) AM_ROM - AM_RANGE(0xfff0, 0xffff) AM_ROM AM_WRITE(dat_w) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( swtpc09 ) -INPUT_PORTS_END - -FLOPPY_FORMATS_MEMBER( swtpc09_state::floppy_formats ) - FLOPPY_FLEX_FORMAT -FLOPPY_FORMATS_END - -// todo: implement floppy controller cards as slot devices and do this properly -static SLOT_INTERFACE_START( swtpc09_floppies ) - SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) // flex 40 trks ss sd 5.25 - SLOT_INTERFACE("sssd35", FLOPPY_525_SSSD_35T) // flex 35 trks ss sd 5.25 - SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) // flex 40 trks ss dd 5.25 - SLOT_INTERFACE("dd", FLOPPY_525_DD) // flex 40 trks ds dd 5.25 - SLOT_INTERFACE("8dssd", FLOPPY_8_DSSD) // UNIFlex 8 inch ds sd - SLOT_INTERFACE("8dsdd", FLOPPY_8_DSDD) // UNIFlex 8 inch ds dd - SLOT_INTERFACE("35hd", FLOPPY_35_HD) // flex 1.44mb disk from swtpc emu (emulator only?) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER(swtpc09_state::write_acia_clock) -{ - m_acia->write_txc(state); - m_acia->write_rxc(state); -} - -/*************************************************************************** - Machine definitions -****************************************************************************/ - -/* Machine driver */ -/* MPU09, MPID, MPS2 DMF2 */ -static MACHINE_CONFIG_START( swtpc09, swtpc09_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 1000000) - MCFG_CPU_PROGRAM_MAP(swtpc09_mem) - - /* video hardware */ - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) - - MCFG_DEVICE_ADD("ptm", PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(2000000) - MCFG_PTM6840_EXTERNAL_CLOCKS(50, 0, 50) - MCFG_PTM6840_OUT0_CB(WRITE8(swtpc09_state, ptm_o1_callback)) - MCFG_PTM6840_OUT2_CB(WRITE8(swtpc09_state, ptm_o3_callback)) - MCFG_PTM6840_IRQ_CB(WRITELINE(swtpc09_state, ptm_irq)) - - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_a_r)) - MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_ca1_r)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(swtpc09_state, pia0_irq_a)) - - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(swtpc09_state, acia_interrupt)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) - - MCFG_FD1793_ADD("fdc", XTAL_1MHz) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(swtpc09_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(swtpc09_state, fdc_drq_w)) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) -MACHINE_CONFIG_END - -/* MPU09, MPID, MPS2 DC4 PIAIDE*/ -static MACHINE_CONFIG_START( swtpc09i, swtpc09_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 1000000) - MCFG_CPU_PROGRAM_MAP(swtpc09_mem) - - /* video hardware */ - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) - - MCFG_DEVICE_ADD("ptm", PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(2000000) - MCFG_PTM6840_EXTERNAL_CLOCKS(50, 0, 50) - MCFG_PTM6840_OUT0_CB(WRITE8(swtpc09_state, ptm_o1_callback)) - MCFG_PTM6840_OUT2_CB(WRITE8(swtpc09_state, ptm_o3_callback)) - MCFG_PTM6840_IRQ_CB(WRITELINE(swtpc09_state, ptm_irq)) - - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_a_r)) - MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_ca1_r)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(swtpc09_state, pia0_irq_a)) - - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(swtpc09_state, acia_interrupt)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) - - MCFG_FD1793_ADD("fdc", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - - MCFG_DEVICE_ADD("piaide", PIA6821, 0) - -/* old start to adding ide support, needs major updating */ -/* this is to support an add on card driving IDE from a PIA */ -// MCFG_HARDDISK_ADD("harddisk") -// MCFG_IDE_CONTROLLER_ADD("ide", NULL) -// MCFG_IDE_CONTROLLER_REGIONS("harddisk", NULL) -// MCFG_IDE_CONTROLLER_ADD( "ide", ide_intf, "hdd", NULL, false ) /* FIXME */ bebox -MACHINE_CONFIG_END - - -/* MPU09, MPID, MPS2 DMF3 */ -static MACHINE_CONFIG_START( swtpc09d3, swtpc09_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, 2000000) - MCFG_CPU_PROGRAM_MAP(swtpc09_mem) - - /* video hardware */ - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) - - MCFG_DEVICE_ADD("ptm", PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(2000000) - MCFG_PTM6840_EXTERNAL_CLOCKS(50, 0, 50) - MCFG_PTM6840_OUT0_CB(WRITE8(swtpc09_state, ptm_o1_callback)) - MCFG_PTM6840_OUT2_CB(WRITE8(swtpc09_state, ptm_o3_callback)) - MCFG_PTM6840_IRQ_CB(WRITELINE(swtpc09_state, ptm_irq)) - - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_a_r)) - MCFG_PIA_READPA_HANDLER(READ8(swtpc09_state, pia0_ca1_r)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(swtpc09_state, pia0_irq_a)) - - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(swtpc09_state, acia_interrupt)) - MCFG_ACIA6850_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(swtpc09_state, write_acia_clock)) - - MCFG_FD1793_ADD("fdc", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) - - MCFG_DEVICE_ADD("via", VIA6522, XTAL_4MHz / 4) - MCFG_VIA6522_READPA_HANDLER(READ8(swtpc09_state, dmf3_via_read_porta)) - MCFG_VIA6522_READPB_HANDLER(READ8(swtpc09_state, dmf3_via_read_portb)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(swtpc09_state, dmf3_via_write_porta)) - //MCFG_VIA6522_CA1_HANDLER(WRITELINE(swtpc09_state, dmf3_via_write_ca1)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(swtpc09_state, dmf3_via_irq)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( swtpc09 ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD ( "sbugh1-8.bin", 0xf800, 0x0800, CRC(10a045a7) SHA1(de547b77653951c7424a069520d52c5b0432e98d) ) -ROM_END - -ROM_START( swtpc09i ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD ( "hd-rom.bin", 0xe800, 0x0800, CRC(b898b4d7) SHA1(2806633eda7da4e9a243fc534f15526ee928b6bc) ) - ROM_LOAD ( "sbugh1-8.bin", 0xf800, 0x0800, CRC(10a045a7) SHA1(de547b77653951c7424a069520d52c5b0432e98d) ) -ROM_END - -ROM_START( swtpc09u ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD ( "unibug.bin", 0xf800, 0x0800, CRC(92e1cbf2) SHA1(db00f17ee9accdbfa1775fe0162d3556159b8e70) ) -ROM_END - -ROM_START( swtpc09d3 ) - ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD ( "uos3.bin", 0xf800, 0x0800, CRC(e95eb3e0) SHA1(3e971d3b7e143bc87e4b506e18a8c928c089c25a) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, swtpc09, 0, 0, swtpc09, swtpc09, swtpc09_state, swtpc09, "SWTPC", "swtpc S/09 Sbug", MACHINE_NO_SOUND_HW) -COMP( 1980, swtpc09i, swtpc09, 0, swtpc09i, swtpc09, swtpc09_state, swtpc09i, "SWTPC", "swtpc S/09 Sbug + piaide", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1980, swtpc09u, swtpc09, 0, swtpc09, swtpc09, swtpc09_state, swtpc09u, "SWTPC", "swtpc S/09 UNIBug + DMF2", MACHINE_NO_SOUND_HW) -COMP( 1980, swtpc09d3, swtpc09, 0, swtpc09d3, swtpc09, swtpc09_state, swtpc09d3, "SWTPC", "swtpc S/09 UNIBug + DMF3", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/sym1.c b/src/mess/drivers/sym1.c deleted file mode 100644 index a302da4d0bb..00000000000 --- a/src/mess/drivers/sym1.c +++ /dev/null @@ -1,372 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Synertek Systems Corp. SYM-1 - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "machine/ram.h" -#include "sound/speaker.h" -#include "machine/mos6530n.h" -#include "machine/6522via.h" -#include "machine/74145.h" -#include "sym1.lh" - - -//************************************************************************** -// MACROS/CONSTANTS -//************************************************************************** - -// SYM-1 main (and only) oscillator Y1 -#define SYM1_CLOCK XTAL_1MHz - -#define LED_REFRESH_DELAY attotime::from_usec(70) - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class sym1_state : public driver_device -{ -public: - sym1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_ram_1k(*this, "ram_1k"), - m_ram_2k(*this, "ram_2k"), - m_ram_3k(*this, "ram_3k"), - m_monitor(*this, "monitor"), - m_riot_ram(*this, "riot_ram"), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_ttl74145(*this, "ttl74145"), - m_row0(*this, "ROW-0"), - m_row1(*this, "ROW-1"), - m_row2(*this, "ROW-2"), - m_row3(*this, "ROW-3"), - m_wp(*this, "WP") { } - - required_shared_ptr m_ram_1k; - required_shared_ptr m_ram_2k; - required_shared_ptr m_ram_3k; - required_shared_ptr m_monitor; - required_shared_ptr m_riot_ram; - UINT8 m_riot_port_a; - UINT8 m_riot_port_b; - emu_timer *m_led_update; - DECLARE_DRIVER_INIT(sym1); - virtual void machine_reset(); - TIMER_CALLBACK_MEMBER(led_refresh); - DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_0_w); - DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_1_w); - DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_2_w); - DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_3_w); - DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_4_w); - DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_5_w); - DECLARE_READ8_MEMBER(sym1_riot_a_r); - DECLARE_READ8_MEMBER(sym1_riot_b_r); - DECLARE_WRITE8_MEMBER(sym1_riot_a_w); - DECLARE_WRITE8_MEMBER(sym1_riot_b_w); - DECLARE_WRITE8_MEMBER(sym1_via2_a_w); - -protected: - required_device m_maincpu; - required_device m_ram; - required_device m_ttl74145; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_wp; -}; - - -//************************************************************************** -// KEYBOARD INPUT & LED OUTPUT -//************************************************************************** - -WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_0_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 0); } -WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_1_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 1); } -WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_2_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 2); } -WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_3_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 3); } -WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_4_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 4); } -WRITE_LINE_MEMBER( sym1_state::sym1_74145_output_5_w ) { if (state) m_led_update->adjust(LED_REFRESH_DELAY, 5); } - -TIMER_CALLBACK_MEMBER( sym1_state::led_refresh ) -{ - output_set_digit_value(param, m_riot_port_a); -} - -READ8_MEMBER( sym1_state::sym1_riot_a_r ) -{ - int data = 0x7f; - - // scan keypad rows - if (!(m_riot_port_a & 0x80)) data &= m_row0->read(); - if (!(m_riot_port_b & 0x01)) data &= m_row1->read(); - if (!(m_riot_port_b & 0x02)) data &= m_row2->read(); - if (!(m_riot_port_b & 0x04)) data &= m_row3->read(); - - // determine column - if ( ((m_riot_port_a ^ 0xff) & (m_row0->read() ^ 0xff)) & 0x7f ) - data &= ~0x80; - - return data; -} - -READ8_MEMBER( sym1_state::sym1_riot_b_r ) -{ - int data = 0xff; - - // determine column - if ( ((m_riot_port_a ^ 0xff) & (m_row1->read() ^ 0xff)) & 0x7f ) - data &= ~0x01; - - if ( ((m_riot_port_a ^ 0xff) & (m_row2->read() ^ 0xff)) & 0x3f ) - data &= ~0x02; - - if ( ((m_riot_port_a ^ 0xff) & (m_row3->read() ^ 0xff)) & 0x1f ) - data &= ~0x04; - - data &= ~0x80; // else hangs 8b02 - - return data; -} - -WRITE8_MEMBER( sym1_state::sym1_riot_a_w ) -{ - logerror("%x: riot_a_w 0x%02x\n", m_maincpu->pc(), data); - - // save for later use - m_riot_port_a = data; -} - -WRITE8_MEMBER( sym1_state::sym1_riot_b_w ) -{ - logerror("%x: riot_b_w 0x%02x\n", m_maincpu->pc(), data); - - // save for later use - m_riot_port_b = data; - - // first 4 pins are connected to the 74145 - m_ttl74145->write(data & 0x0f); -} - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -static INPUT_PORTS_START( sym1 ) - PORT_START("ROW-0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 USR 0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 USR 4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 JUMP") PORT_CODE(KEYCODE_8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C CALC") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CR S DBL") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO LD P") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LD 2 LD 1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("ROW-1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 USR 1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 USR 5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 VER") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DEP") PORT_CODE(KEYCODE_D) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG SAV P") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SAV 2 SAV 1") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW-2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 USR 2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 USR 6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A ASCII") PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E EXEC") PORT_CODE(KEYCODE_E) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92 \xE2\x86\x90") PORT_CODE(KEYCODE_RIGHT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM WP") PORT_CODE(KEYCODE_F5) - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW-3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 USR 3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 USR 7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B B MOV") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F FILL") PORT_CODE(KEYCODE_F) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("IN4") /* IN4 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEBUG OFF") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEBUG ON") PORT_CODE(KEYCODE_F7) - - PORT_START("WP") - PORT_DIPNAME(0x01, 0x01, "6532 RAM WP") - PORT_DIPSETTING(0x00, DEF_STR(Off)) - PORT_DIPSETTING(0x01, DEF_STR(On)) - PORT_DIPNAME(0x02, 0x02, "1K RAM WP") - PORT_DIPSETTING(0x00, DEF_STR(Off)) - PORT_DIPSETTING(0x02, DEF_STR(On)) - PORT_DIPNAME(0x04, 0x04, "2K RAM WP") - PORT_DIPSETTING(0x00, DEF_STR(Off)) - PORT_DIPSETTING(0x04, DEF_STR(On)) - PORT_DIPNAME(0x08, 0x08, "3K RAM WP") - PORT_DIPSETTING(0x00, DEF_STR(Off)) - PORT_DIPSETTING(0x08, DEF_STR(On)) -INPUT_PORTS_END - - -//************************************************************************** -// MACHINE EMULATION -//************************************************************************** - -/* - PA0: Write protect R6532 RAM - PA1: Write protect RAM 0x400-0x7ff - PA2: Write protect RAM 0x800-0xbff - PA3: Write protect RAM 0xc00-0xfff - */ -WRITE8_MEMBER( sym1_state::sym1_via2_a_w ) -{ - address_space &cpu0space = m_maincpu->space( AS_PROGRAM ); - - logerror("SYM1 VIA2 W 0x%02x\n", data); - - if ((m_wp->read() & 0x01) && !(data & 0x01)) { - cpu0space.nop_write(0xa600, 0xa67f); - } else { - cpu0space.install_write_bank(0xa600, 0xa67f, "bank5"); - } - if ((m_wp->read() & 0x02) && !(data & 0x02)) { - cpu0space.nop_write(0x0400, 0x07ff); - } else { - cpu0space.install_write_bank(0x0400, 0x07ff, "bank2"); - } - if ((m_wp->read() & 0x04) && !(data & 0x04)) { - cpu0space.nop_write(0x0800, 0x0bff); - } else { - cpu0space.install_write_bank(0x0800, 0x0bff, "bank3"); - } - if ((m_wp->read() & 0x08) && !(data & 0x08)) { - cpu0space.nop_write(0x0c00, 0x0fff); - } else { - cpu0space.install_write_bank(0x0c00, 0x0fff, "bank4"); - } -} - -DRIVER_INIT_MEMBER( sym1_state, sym1 ) -{ - // wipe expansion memory banks that are not installed - if (m_ram->size() < 4*1024) - { - m_maincpu->space(AS_PROGRAM).nop_readwrite(m_ram->size(), 0x0fff); - } - - // allocate a timer to refresh the led display - m_led_update = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sym1_state::led_refresh), this)); -} - -void sym1_state::machine_reset() -{ - // make 0xf800 to 0xffff point to the last half of the monitor ROM - // so that the CPU can find its reset vectors - m_maincpu->space(AS_PROGRAM).install_read_bank(0xf800, 0xffff, "bank1"); - m_maincpu->space(AS_PROGRAM).nop_write(0xf800, 0xffff); - membank("bank1")->set_base(m_monitor + 0x800); - m_maincpu->reset(); -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -static ADDRESS_MAP_START( sym1_map, AS_PROGRAM, 8, sym1_state ) - AM_RANGE(0x0000, 0x03ff) AM_RAM // U12/U13 RAM - AM_RANGE(0x0400, 0x07ff) AM_RAMBANK("bank2") AM_SHARE("ram_1k") - AM_RANGE(0x0800, 0x0bff) AM_RAMBANK("bank3") AM_SHARE("ram_2k") - AM_RANGE(0x0c00, 0x0fff) AM_RAMBANK("bank4") AM_SHARE("ram_3k") - AM_RANGE(0x8000, 0x8fff) AM_ROM AM_SHARE("monitor") // U20 Monitor ROM - AM_RANGE(0xa000, 0xa00f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) // U25 VIA #1 - AM_RANGE(0xa400, 0xa41f) AM_DEVICE("riot", mos6532_t, io_map) // U27 RIOT - AM_RANGE(0xa600, 0xa67f) AM_RAMBANK("bank5") AM_SHARE("riot_ram") // U27 RIOT RAM - AM_RANGE(0xa800, 0xa80f) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) // U28 VIA #2 - AM_RANGE(0xac00, 0xac0f) AM_DEVREADWRITE("via6522_2", via6522_device, read, write) // U29 VIA #3 - AM_RANGE(0xb000, 0xefff) AM_ROM -ADDRESS_MAP_END - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -static MACHINE_CONFIG_START( sym1, sym1_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", M6502, SYM1_CLOCK) - MCFG_CPU_PROGRAM_MAP(sym1_map) - - MCFG_DEFAULT_LAYOUT(layout_sym1) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - // devices - MCFG_DEVICE_ADD("riot", MOS6532n, SYM1_CLOCK) - MCFG_MOS6530n_IN_PA_CB(READ8(sym1_state, sym1_riot_a_r)) - MCFG_MOS6530n_OUT_PA_CB(WRITE8(sym1_state, sym1_riot_a_w)) - MCFG_MOS6530n_IN_PB_CB(READ8(sym1_state, sym1_riot_b_r)) - MCFG_MOS6530n_OUT_PB_CB(WRITE8(sym1_state, sym1_riot_b_w)) - - MCFG_DEVICE_ADD("ttl74145", TTL74145, 0) - MCFG_TTL74145_OUTPUT_LINE_0_CB(WRITELINE(sym1_state, sym1_74145_output_0_w)) - MCFG_TTL74145_OUTPUT_LINE_1_CB(WRITELINE(sym1_state, sym1_74145_output_1_w)) - MCFG_TTL74145_OUTPUT_LINE_2_CB(WRITELINE(sym1_state, sym1_74145_output_2_w)) - MCFG_TTL74145_OUTPUT_LINE_3_CB(WRITELINE(sym1_state, sym1_74145_output_3_w)) - MCFG_TTL74145_OUTPUT_LINE_4_CB(WRITELINE(sym1_state, sym1_74145_output_4_w)) - MCFG_TTL74145_OUTPUT_LINE_5_CB(WRITELINE(sym1_state, sym1_74145_output_5_w)) - MCFG_TTL74145_OUTPUT_LINE_6_CB(DEVWRITELINE("speaker", speaker_sound_device, level_w)) - // lines 7-9 not connected - - MCFG_DEVICE_ADD("via6522_0", VIA6522, 0) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) - - MCFG_DEVICE_ADD("via6522_1", VIA6522, 0) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) - - MCFG_DEVICE_ADD("via6522_2", VIA6522, 0) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(sym1_state, sym1_via2_a_w)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("maincpu", m6502_device, irq_line)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("1K,2K,3K") -MACHINE_CONFIG_END - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( sym1 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "ver10", "Version 1.0") - ROMX_LOAD("symon1_0.bin", 0x8000, 0x1000, CRC(97928583) SHA1(6ac52c54adb7a086d51bc7f6d55dd30ab3a0a331), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "ver11", "Version 1.1") - ROMX_LOAD("symon1_1.bin", 0x8000, 0x1000, CRC(7a4b1e12) SHA1(cebdf815105592658cfb7af262f2101d2aeab786), ROM_BIOS(2)) - ROM_LOAD("rae_b000", 0xb000, 0x1000, CRC(f6429326) SHA1(6f2f10649b54f54217bb35c8c453b5d05434bd86) ) - ROM_LOAD("bas_c000", 0xc000, 0x1000, CRC(c168fe70) SHA1(7447a5e229140cbbde4cf90886966a5d93aa24e1) ) - ROM_LOAD("bas_d000", 0xd000, 0x1000, CRC(8375a978) SHA1(240301bf8bb8ddb99b65a585f17895e1ad872631) ) - ROM_LOAD("rae_e000", 0xe000, 0x1000, CRC(2255444b) SHA1(c7dd812962c2e2edd2faa7055e9cce4e769c0388) ) -ROM_END - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1978, sym1, 0, 0, sym1, sym1, sym1_state, sym1, "Synertek Systems Corp.", "SYM-1/SY-VIM-1", 0 ) diff --git a/src/mess/drivers/sys2900.c b/src/mess/drivers/sys2900.c deleted file mode 100644 index 9f71bb44bbb..00000000000 --- a/src/mess/drivers/sys2900.c +++ /dev/null @@ -1,146 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - System 2900 - - 12/05/2009 Skeleton driver. - - The system contains 4 S100 boards, 2 8" floppies, enormous power supply, - 1/4" thick mother board, 4 RS232 I/F boards, and an Australian made - "Computer Patch Board". - The S100 boards that make up the unit are: - CPU board - Model CPC2810 Rev D - The board has a Z80A CPU, CTC, PIO, DART and SIO. - U16 (24 pin) is missing (boot EPROM?). - It has a lot of jumpers and an 8 way DIP switch. - Memory board - Model HDM2800 Rev B - This contains 18 4164's and a lot of logic. - Again, a lot of jumpers, and several banks of links. - Also contains 2 Motorola chips I cannot identify, - MC3480P (24 pin) and MC3242AP (28 pin). - (I have searched the Motorola site and the Chip - Directory; nothing even close.) - Disk Controller board - Model FDC2800 Rev D - This board is damaged. The small voltage regulators - for +/- 12V have been fried. - Also, 3 sockets are empty - U1 and U38 (16 pin) - appear to be spares, and U10 (14 pin). - 8 port Serial I/O board - Model INO2808 Rev C - Room for 8 8251 USART's. - I have traced out this board and managed to get it - working in another S100 system. - The "Computer Patch Board" seems to provide some sort of watch dog - facility. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - - -class sys2900_state : public driver_device -{ -public: - enum - { - TIMER_BOOT - }; - - sys2900_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_DRIVER_INIT(sys2900); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_sys2900(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -static ADDRESS_MAP_START(sys2900_mem, AS_PROGRAM, 8, sys2900_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("boot") - AM_RANGE( 0x0800, 0xefff ) AM_RAM - AM_RANGE( 0xf000, 0xf7ff ) AM_ROM - AM_RANGE( 0xf800, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(sys2900_io, AS_IO, 8, sys2900_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( sys2900 ) -INPUT_PORTS_END - - -void sys2900_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BOOT: - /* after the first 4 bytes have been read from ROM, switch the ram back in */ - membank("boot")->set_entry(0); - break; - default: - assert_always(FALSE, "Unknown id in sys2900_state::device_timer"); - } -} - -void sys2900_state::machine_reset() -{ - membank("boot")->set_entry(1); - timer_set(attotime::from_usec(5), TIMER_BOOT); -} - -DRIVER_INIT_MEMBER(sys2900_state,sys2900) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf000); -} - -void sys2900_state::video_start() -{ -} - -UINT32 sys2900_state::screen_update_sys2900(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( sys2900, sys2900_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(sys2900_mem) - MCFG_CPU_IO_MAP(sys2900_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(sys2900_state, screen_update_sys2900) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( sys2900 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "104401cpc.bin", 0xf000, 0x0800, CRC(6c8848bc) SHA1(890e0578e5cb0e3433b4b173e5ed71d72a92af26)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, sys2900, 0, 0, sys2900, sys2900, sys2900_state, sys2900, "Systems Group", "System 2900", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/systec.c b/src/mess/drivers/systec.c deleted file mode 100644 index 28848f3e2b9..00000000000 --- a/src/mess/drivers/systec.c +++ /dev/null @@ -1,123 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders: Miodrag Milanovic, Robbbert -/*************************************************************************** - - Systec Z80 - - More data : - http://www.hd64180-cpm.de/html/systecz80.html - - 30/08/2010 Skeleton driver - - Systec Platine 1 - - SYSTEC 155.1L - EPROM 2764 CP/M LOADER 155 / 9600 Baud - Z8400APS CPU - Z8420APS PIO - Z8430APS CTC - Z8470APS DART - - Systec Platine 2 - - SYSTEC 100.3B - MB8877A FDC Controller - FDC9229BT SMC 8608 - Z8410APS DMA - Z8420APS PIO - - MB8877A Compatible FD1793 - - 2011-12-22 connected to a terminal [Robbbert] - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class systec_state : public driver_device -{ -public: - systec_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(systec_c4_r); - DECLARE_READ8_MEMBER(systec_c6_r); - DECLARE_WRITE8_MEMBER( kbd_put ); - UINT8 m_term_data; - virtual void machine_reset(); -}; - -READ8_MEMBER( systec_state::systec_c4_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( systec_state::systec_c6_r ) -{ - return 0x04 | (m_term_data ? 1 : 0); -} - -WRITE8_MEMBER( systec_state::kbd_put ) -{ - m_term_data = data; -} - -static ADDRESS_MAP_START(systec_mem, AS_PROGRAM, 8, systec_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_RAM AM_REGION("maincpu", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(systec_io, AS_IO, 8, systec_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xc4, 0xc4) AM_READ(systec_c4_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0xc6, 0xc6) AM_READ(systec_c6_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( systec ) -INPUT_PORTS_END - -void systec_state::machine_reset() -{ - UINT8 *m_p_maincpu = memregion("maincpu")->base(); - UINT8 *m_p_roms = memregion("roms")->base(); - memcpy(m_p_maincpu, m_p_roms, 0x2000); -} - -static MACHINE_CONFIG_START( systec, systec_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(systec_mem) - MCFG_CPU_IO_MAP(systec_io) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(systec_state, kbd_put)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( systec ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x10000, "roms", 0 ) - ROM_LOAD( "systec.bin", 0x0000, 0x2000, CRC(967108ab) SHA1(a414db032ca7db0f9fdbe22aa68a099a93efb593)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP(19??, systec, 0, 0, systec, systec, driver_device, 0, "Systec", "Systec Z80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/tamag1.c b/src/mess/drivers/tamag1.c deleted file mode 100644 index 7b0a73509a5..00000000000 --- a/src/mess/drivers/tamag1.c +++ /dev/null @@ -1,170 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/*************************************************************************** - - Bandai Tamagotchi generation 1 hardware - * PCB label TMG-M1 - * Seiko Epson E0C6S46 MCU under epoxy - -***************************************************************************/ - -#include "emu.h" -#include "cpu/e0c6200/e0c6s46.h" -#include "sound/speaker.h" - -#include "tama.lh" - - -class tamag1_state : public driver_device -{ -public: - tamag1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker") - { } - - required_device m_maincpu; - required_device m_speaker; - - DECLARE_WRITE8_MEMBER(speaker_w); - - DECLARE_PALETTE_INIT(tama); - DECLARE_INPUT_CHANGED_MEMBER(input_changed); -}; - - -/*************************************************************************** - - Video - -***************************************************************************/ - -static E0C6S46_PIXEL_UPDATE_CB(tama_pixel_update) -{ - // 16 COM(common) pins, 40 SEG(segment) pins from MCU, - // 32x16 LCD screen: - static const int seg2x[0x28] = - { - 0, 1, 2, 3, 4, 5, 6, 7, - 35, 8, 9,10,11,12,13,14, - 15,34,33,32,31,30,29,28, - 27,26,25,24,36,23,22,21, - 20,19,18,17,16,37,38,39 - }; - - int y = com, x = seg2x[seg]; - if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = state; - - // 2 rows of indicators: - // above screen: 0:meal, 1:lamp, 2:play, 3:medicine - // under screen: 4:bath, 5:scales, 6:shout, 7:attention - - // they are on pin SEG8(x=35) + COM0-3, pin SEG28(x=36) + COM12-15 - if (x == 35 && y < 4) - output_set_lamp_value(y, state); - else if (x == 36 && y >= 12) - output_set_lamp_value(y-8, state); - - // output for svg2lay - char buf[0x10]; - sprintf(buf, "%d.%d", y, x); - output_set_value(buf, state); -} - -PALETTE_INIT_MEMBER(tamag1_state, tama) -{ - palette.set_pen_color(0, rgb_t(0xf1, 0xf0, 0xf9)); // background - palette.set_pen_color(1, rgb_t(0x3c, 0x38, 0x38)); // lcd pixel -} - - - -/*************************************************************************** - - I/O - -***************************************************************************/ - -WRITE8_MEMBER(tamag1_state::speaker_w) -{ - // R43: speaker out - m_speaker->level_w(data >> 3 & 1); -} - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -INPUT_CHANGED_MEMBER(tamag1_state::input_changed) -{ - // inputs are hooked up backwards here, because MCU input - // ports are all tied to its interrupt controller - int line = (int)(FPTR)param; - int state = newval ? ASSERT_LINE : CLEAR_LINE; - m_maincpu->set_input_line(line, state); -} - -static INPUT_PORTS_START( tama ) - PORT_START("K0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tamag1_state, input_changed, (void *)E0C6S46_LINE_K00) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tamag1_state, input_changed, (void *)E0C6S46_LINE_K01) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tamag1_state, input_changed, (void *)E0C6S46_LINE_K02) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -static MACHINE_CONFIG_START( tama, tamag1_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", E0C6S46, XTAL_32_768kHz) - MCFG_E0C6S46_PIXEL_UPDATE_CB(tama_pixel_update) - MCFG_E0C6S46_WRITE_R_CB(4, WRITE8(tamag1_state, speaker_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(XTAL_32_768kHz/1024) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(40, 16) - MCFG_SCREEN_VISIBLE_AREA(0, 32-1, 0, 16-1) - MCFG_DEFAULT_LAYOUT(layout_tama) - MCFG_SCREEN_UPDATE_DEVICE("maincpu", e0c6s46_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(tamag1_state, tama) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( tama ) - ROM_REGION( 0x3000, "maincpu", 0 ) - ROM_LOAD( "test.b", 0x0000, 0x3000, CRC(4372220e) SHA1(6e13d015113e16198c0059b9d0c38d7027ae7324) ) // this rom is on the die too, test pin enables it? - ROM_LOAD( "tama.b", 0x0000, 0x3000, CRC(5c864cb1) SHA1(4b4979cf92dc9d2fb6d7295a38f209f3da144f72) ) -ROM_END - - -CONS( 1997, tama, 0, 0, tama, tama, driver_device, 0, "Bandai", "Tamagotchi (USA)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/tandy1t.c b/src/mess/drivers/tandy1t.c deleted file mode 100644 index d770b3f8c72..00000000000 --- a/src/mess/drivers/tandy1t.c +++ /dev/null @@ -1,819 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/* -Tandy 1000 -========== - -Tandy 1000 machines are similar to the IBM 5160s with CGA graphics. Tandy -added some additional graphic capabilities similar, but not equal, to -those added for the IBM PC Jr. - -Tandy 1000 (8088) variations: -1000 128KB-640KB RAM 4.77 MHz v01.00.00, v01.01.00 -1000A/1000HD 128KB-640KB RAM 4.77 MHz v01.01.00 -1000SX/1000AX 384KB-640KB RAM 7.16/4.77 MHz v01.02.00 -1000EX 256KB-640KB RAM 7.16/4.77 MHz v01.02.00 -1000HX 256KB-640KB RAM 7.16/4.77 MHz v02.00.00 - -Tandy 1000 (8086) variations: -1000RL/1000RL-HD 512KB-768KB RAM 9.44/4.77 MHz v02.00.00, v02.00.01 -1000SL/1000PC 384KB-640KB RAM 8.0/4.77 MHz v01.04.00, v01.04.01, v01.04.02, v02.00.01 -1000SL/2 512KB-640KB RAM 8.0/4.77 MHz v01.04.04 - -Tandy 1000 (80286) variations: -1000TX 640KB-768KB RAM 8.0/4.77 MHz v01.03.00 -1000TL 640KB-768KB RAM 8.0/4.77 MHz v01.04.00, v01.04.01, v01.04.02 -1000TL/2 640KB-768KB RAM 8.0/4.77 MHz v02.00.00 -1000TL/3 640KB-768KB RAM 10.0/5.0 MHz v02.00.00 -1000RLX 512KB-1024KB RAM 10.0/5.0 MHz v02.00.00 -1000RLX-HD 1024MB RAM 10.0/5.0 MHz v02.00.00 - -Tandy 1000 (80386) variations: -1000RSX/1000RSX-HD 1M-9M RAM 25.0/8.0 MHz v01.10.00 */ - -#include "emu.h" -#include "includes/genpc.h" -#include "machine/pckeybrd.h" -#include "machine/nvram.h" -#include "machine/pc_fdc.h" -#include "video/pc_t1t.h" -#include "sound/sn76496.h" -#include "cpu/i86/i86.h" -#include "cpu/i86/i286.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" - -class tandy1000_state : public driver_device -{ -public: - tandy1000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_romcs0(*this, "romcs0") - , m_romcs1(*this, "romcs1") - , m_biosbank(*this, "biosbank") - , m_keyboard(*this, "pc_keyboard") - , m_mb(*this, "mb") { } - - required_device m_maincpu; - -// Memory regions for the machines that support rom banking - optional_memory_region m_romcs0; - optional_memory_region m_romcs1; - optional_memory_bank m_biosbank; - - required_device m_keyboard; - required_device m_mb; - - DECLARE_WRITE8_MEMBER ( pc_t1t_p37x_w ); - DECLARE_READ8_MEMBER ( pc_t1t_p37x_r ); - - DECLARE_WRITE8_MEMBER ( tandy1000_pio_w ); - DECLARE_READ8_MEMBER(tandy1000_pio_r); - DECLARE_READ8_MEMBER( tandy1000_bank_r ); - DECLARE_WRITE8_MEMBER( tandy1000_bank_w ); - - int tandy1000_read_eeprom(); - void tandy1000_write_eeprom(UINT8 data); - void tandy1000_set_bios_bank(); - - DECLARE_DRIVER_INIT(t1000hx); - DECLARE_DRIVER_INIT(t1000sl); - - DECLARE_MACHINE_RESET(tandy1000rl); - - struct - { - UINT8 low, high; - } m_eeprom_ee[0x40]; /* only 0 to 4 used in hx, addressing seems to allow this */ - - int m_eeprom_state; - int m_eeprom_clock; - UINT8 m_eeprom_oper; - UINT16 m_eeprom_data; - - UINT8 m_tandy_data[8]; - - UINT8 m_tandy_bios_bank; /* I/O port FFEAh */ - UINT8 m_tandy_ppi_portb, m_tandy_ppi_portc; -}; - -/* tandy 1000 eeprom - hx and later - clock, and data out lines at 0x37c - data in at 0x62 bit 4 (0x10) - - 8x read 16 bit word at x - 30 cx 30 4x 16bit 00 write 16bit at x -*/ - -int tandy1000_state::tandy1000_read_eeprom() -{ - if ((m_eeprom_state>=100)&&(m_eeprom_state<=199)) - return m_eeprom_data&0x8000; - return 1; -} - -void tandy1000_state::tandy1000_write_eeprom(UINT8 data) -{ - if (!m_eeprom_clock && (data&4) ) - { -// logerror("!!!tandy1000 eeprom %.2x %.2x\n",m_eeprom_state, data); - switch (m_eeprom_state) - { - case 0: - if ((data&3)==0) m_eeprom_state++; - break; - case 1: - if ((data&3)==2) m_eeprom_state++; - break; - case 2: - if ((data&3)==3) m_eeprom_state++; - break; - case 3: - m_eeprom_oper=data&1; - m_eeprom_state++; - break; - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - m_eeprom_oper=(m_eeprom_oper<<1)|(data&1); - m_eeprom_state++; - break; - case 10: - m_eeprom_oper=(m_eeprom_oper<<1)|(data&1); - logerror("!!!tandy1000 eeprom %.2x\n",m_eeprom_oper); - if ((m_eeprom_oper&0xc0)==0x80) - { - m_eeprom_state=100; - m_eeprom_data=m_eeprom_ee[m_eeprom_oper&0x3f].low - |(m_eeprom_ee[m_eeprom_oper&0x3f].high<<8); - logerror("!!!tandy1000 eeprom read %.2x,%.4x\n",m_eeprom_oper,m_eeprom_data); - } - else if ((m_eeprom_oper&0xc0)==0x40) - { - m_eeprom_state=200; - } - else - m_eeprom_state=0; - break; - - /* read 16 bit */ - case 100: - m_eeprom_state++; - break; - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - case 108: - case 109: - case 110: - case 111: - case 112: - case 113: - case 114: - case 115: - m_eeprom_data<<=1; - m_eeprom_state++; - break; - case 116: - m_eeprom_data<<=1; - m_eeprom_state=0; - break; - - /* write 16 bit */ - case 200: - case 201: - case 202: - case 203: - case 204: - case 205: - case 206: - case 207: - case 208: - case 209: - case 210: - case 211: - case 212: - case 213: - case 214: - m_eeprom_data=(m_eeprom_data<<1)|(data&1); - m_eeprom_state++; - break; - case 215: - m_eeprom_data=(m_eeprom_data<<1)|(data&1); - logerror("tandy1000 %.2x %.4x written\n",m_eeprom_oper,m_eeprom_data); - m_eeprom_ee[m_eeprom_oper&0x3f].low=m_eeprom_data&0xff; - m_eeprom_ee[m_eeprom_oper&0x3f].high=m_eeprom_data>>8; - m_eeprom_state=0; - break; - } - } - m_eeprom_clock=data&4; -} - -WRITE8_MEMBER( tandy1000_state::pc_t1t_p37x_w ) -{ -// DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", space.device().safe_pc( ),offset, data)); - if (offset!=4) - logerror("T1T_p37x_w %.5x #%d $%02x\n", space.device().safe_pc( ),offset, data); - m_tandy_data[offset]=data; - switch( offset ) - { - case 4: - tandy1000_write_eeprom(data); - break; - } -} - -READ8_MEMBER( tandy1000_state::pc_t1t_p37x_r ) -{ - int data = m_tandy_data[offset]; -// DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", space.device().safe_pc( ), offset, data)); - return data; -} - -/* this is for tandy1000hx - hopefully this works for all x models - must not be a ppi8255 chip - (think custom chip) - port c: - bit 4 input eeprom data in - bit 3 output turbo mode -*/ - -WRITE8_MEMBER( tandy1000_state::tandy1000_pio_w ) -{ - switch (offset) - { - case 1: - m_tandy_ppi_portb = data; - m_mb->m_pit8253->write_gate2(BIT(data, 0)); - m_mb->pc_speaker_set_spkrdata( data & 0x02 ); - // sx enables keyboard from bit 3, others bit 6, hopefully theres no conflict - m_keyboard->enable(data&0x48); - if ( data & 0x80 ) - m_mb->m_pic8259->ir1_w(0); - break; - case 2: - m_tandy_ppi_portc = data; - if (data & 8) - m_maincpu->set_clock_scale(1); - else - m_maincpu->set_clock_scale(4.77/8); - break; - } -} - -READ8_MEMBER(tandy1000_state::tandy1000_pio_r) -{ - int data=0xff; - switch (offset) - { - case 0: - data = m_keyboard->read(space, 0); - break; - case 1: - data=m_tandy_ppi_portb; - break; - case 2: -// if (tandy1000hx) { -// data=m_tandy_ppi_portc; // causes problems (setuphx) - if (!tandy1000_read_eeprom()) data&=~0x10; -// } - break; - } - return data; -} - - -void tandy1000_state::tandy1000_set_bios_bank() -{ - UINT8 *p = NULL; - - assert( m_romcs0 != NULL ); - assert( m_romcs1 != NULL ); - assert( m_biosbank != NULL ); - - if ( m_tandy_bios_bank & 0x10 ) - { - if ( m_tandy_bios_bank & 0x04 ) - { - p = m_romcs0->base() + ( m_tandy_bios_bank & 0x03 ) * 0x10000; - } - else - { - p = m_romcs1->base() + ( m_tandy_bios_bank & 0x03 ) * 0x10000; - } - } - else - { - if ( m_tandy_bios_bank & 0x08 ) - { - p = m_romcs0->base() + ( m_tandy_bios_bank & 0x07 ) * 0x10000; - } - else - { - p = m_romcs1->base() + ( m_tandy_bios_bank & 0x07 ) * 0x10000; - } - } - - m_biosbank->set_base( p ); -} - -MACHINE_RESET_MEMBER(tandy1000_state, tandy1000rl) -{ - m_tandy_bios_bank = 6; - tandy1000_set_bios_bank(); -} - -DRIVER_INIT_MEMBER(tandy1000_state,t1000hx) -{ - machine().device("nvram")->set_base(m_eeprom_ee, sizeof(m_eeprom_ee)); -} - - -DRIVER_INIT_MEMBER(tandy1000_state,t1000sl) -{ - // Fix up memory region (highest address bit flipped??) - UINT8 *rom = memregion("romcs0")->base(); - - for( int i = 0; i < 0x40000; i++ ) - { - UINT8 d = rom[0x40000 + i]; - rom[0x40000 + i] = rom[i]; - rom[i] = d; - } - - DRIVER_INIT_NAME(t1000hx)(); -} - - -READ8_MEMBER( tandy1000_state::tandy1000_bank_r ) -{ - UINT8 data = 0xFF; - - logerror( "%s: tandy1000_bank_r: offset = %x\n", space.machine().describe_context(), offset ); - - switch( offset ) - { - case 0x00: /* FFEA */ - data = m_tandy_bios_bank ^ 0x10; // Bit 4 is read back inverted - break; - } - - return data; -} - - -WRITE8_MEMBER( tandy1000_state::tandy1000_bank_w ) -{ - logerror( "%s: tandy1000_bank_w: offset = %x, data = %02x\n", space.machine().describe_context(), offset, data ); - - switch( offset ) - { - case 0x00: /* FFEA */ - m_tandy_bios_bank = data; - tandy1000_set_bios_bank(); - break; - - // UART clock, joystick, and sound enable - // bit 0 - 0 = Clock divided by 13 - // 1 = Clock divided by 1 - // bit 1 - 0 = Disable joystick - // 1 = Enable joystick - // bit 2 - 0 = Disable Sound Chip - // 1 = Enable Sound Chip - case 0x01: - break; - } -} - -static INPUT_PORTS_START( tandy1t ) - PORT_START("IN0") /* IN0 */ - PORT_BIT ( 0xf0, 0xf0, IPT_UNUSED ) - PORT_BIT ( 0x08, 0x08, IPT_CUSTOM ) PORT_VBLANK("pcvideo_t1000:screen") - PORT_BIT ( 0x07, 0x07, IPT_UNUSED ) - - PORT_START("DSW0") /* IN1 */ - PORT_BIT ( 0xff, 0xff, IPT_UNUSED ) - - PORT_START("DSW1") /* IN2 */ - PORT_DIPNAME( 0x80, 0x80, "COM1: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x40, "COM2: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) - PORT_BIT ( 0x30, 0x00, IPT_UNUSED ) - PORT_DIPNAME( 0x08, 0x08, "LPT1: enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_BIT ( 0x06, 0x00, IPT_UNUSED ) - PORT_DIPNAME( 0x01, 0x00, "Game port enable") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) - - PORT_START("DSW2") /* IN3 */ - PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) - PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */ - PORT_BIT( 0x01, 0x01, IPT_UNUSED ) - - PORT_INCLUDE(pc_keyboard) - - PORT_MODIFY("pc_keyboard_2") - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) /* 29 A9 */ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) /* 2B AB */ - - PORT_MODIFY("pc_keyboard_3") - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE /* Caps Lock 3A BA */ - - PORT_MODIFY("pc_keyboard_4") - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) PORT_TOGGLE /* Num Lock 45 C5 */ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 7 \\") PORT_CODE(KEYCODE_7_PAD) /* Keypad 7 47 C7 */ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 8 ~") PORT_CODE(KEYCODE_8_PAD) /* Keypad 8 48 C8 */ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 9 (PgUp)") PORT_CODE(KEYCODE_9_PAD) /* Keypad 9 (PgUp) 49 C9 */ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) /* 4A CA */ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 4 |") PORT_CODE(KEYCODE_4_PAD) /* Keypad 4 4B CB */ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 6") PORT_CODE(KEYCODE_6_PAD) /* Keypad 6 4D CD */ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /* 4E CE */ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 1 (End)") PORT_CODE(KEYCODE_1_PAD) /* Keypad 1 (End) 4F CF */ - - PORT_MODIFY("pc_keyboard_5") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 2 `") PORT_CODE(KEYCODE_2_PAD) /* Keypad 2 50 D0 */ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 3 (PgDn)") PORT_CODE(KEYCODE_3_PAD) /* Keypad 3 (PgDn) 51 D1 */ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 0") PORT_CODE(KEYCODE_0_PAD) /* Keypad 0 52 D2 */ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP - (Del)") PORT_CODE(KEYCODE_MINUS_PAD) /* - Delete 53 D3 */ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_STOP) /* Break 54 D4 */ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ Insert") PORT_CODE(KEYCODE_PLUS_PAD) /* + Insert 55 D5 */ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_DEL_PAD) /* . 56 D6 */ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* Enter 57 D7 */ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* HOME 58 D8 */ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) /* F11 59 D9 */ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) /* F12 5a Da */ -INPUT_PORTS_END - -static ADDRESS_MAP_START(tandy1000_map, AS_PROGRAM, 8, tandy1000_state ) - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xaffff) AM_RAM - AM_RANGE(0xb0000, 0xb7fff) AM_NOP - AM_RANGE(0xb8000, 0xbffff) AM_DEVREADWRITE("pcvideo_t1000", pcvideo_t1000_device, videoram_r, videoram_w); - AM_RANGE(0xc0000, 0xc7fff) AM_NOP - AM_RANGE(0xc8000, 0xc9fff) AM_ROM - AM_RANGE(0xca000, 0xcffff) AM_NOP - AM_RANGE(0xd0000, 0xeffff) AM_NOP - AM_RANGE(0xf0000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tandy1000_io, AS_IO, 8, tandy1000_state ) - AM_RANGE(0x0060, 0x0063) AM_READWRITE(tandy1000_pio_r, tandy1000_pio_w) - AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", ncr7496_device, write) - AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("pc_joy", pc_joy_device, joy_port_r, joy_port_w) - AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r, pc_t1t_p37x_w) - AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE("pcvideo_t1000", pcvideo_t1000_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tandy1000_16_map, AS_PROGRAM, 16, tandy1000_state ) - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xaffff) AM_RAM - AM_RANGE(0xb0000, 0xb7fff) AM_NOP - AM_RANGE(0xb8000, 0xbffff) AM_DEVREADWRITE8("pcvideo_t1000", pcvideo_t1000_device, videoram_r, videoram_w, 0xffff) - AM_RANGE(0xc0000, 0xc7fff) AM_NOP - AM_RANGE(0xc8000, 0xc9fff) AM_ROM - AM_RANGE(0xca000, 0xcffff) AM_NOP - AM_RANGE(0xe0000, 0xeffff) AM_ROMBANK("biosbank") /* Banked part of the BIOS */ - AM_RANGE(0xf0000, 0xfffff) AM_ROM AM_REGION( "romcs0", 0x70000 ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tandy1000_16_io, AS_IO, 16, tandy1000_state ) - AM_RANGE(0x0060, 0x0063) AM_READWRITE8(tandy1000_pio_r, tandy1000_pio_w, 0xffff) - AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496", ncr7496_device, write, 0xffff) - AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) - AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_t1t_p37x_r, pc_t1t_p37x_w, 0xffff) - AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("pcvideo_t1000", pcvideo_t1000_device, read, write, 0xffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tandy1000_16_bank_io, AS_IO, 16, tandy1000_state ) - AM_IMPORT_FROM(tandy1000_16_io) - AM_RANGE(0xffea, 0xffeb) AM_READWRITE8(tandy1000_bank_r, tandy1000_bank_w, 0xffff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tandy1000_286_map, AS_PROGRAM, 16, tandy1000_state ) - ADDRESS_MAP_GLOBAL_MASK(0x000fffff) - AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK("bank10") - AM_RANGE(0xa0000, 0xaffff) AM_RAM - AM_RANGE(0xb0000, 0xb7fff) AM_NOP - AM_RANGE(0xb8000, 0xbffff) AM_DEVREADWRITE8("pcvideo_t1000", pcvideo_t1000_device, videoram_r, videoram_w, 0xffff) - AM_RANGE(0xc0000, 0xc7fff) AM_NOP - AM_RANGE(0xc8000, 0xc9fff) AM_ROM - AM_RANGE(0xca000, 0xcffff) AM_NOP - AM_RANGE(0xe0000, 0xeffff) AM_NOP - AM_RANGE(0xf8000, 0xfffff) AM_ROM -ADDRESS_MAP_END - -static const gfx_layout t1000_charlayout = -{ - 8, 16, - 256, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0, 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, 24576, 26624, 28672, 30720 }, - 8 -}; - -static MACHINE_CONFIG_FRAGMENT( cfg_fdc_35 ) - MCFG_DEVICE_MODIFY("fdc:0") - MCFG_SLOT_DEFAULT_OPTION("35dd") - MCFG_SLOT_FIXED(true) - - MCFG_DEVICE_REMOVE("fdc:1") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( cfg_fdc_525 ) - MCFG_DEVICE_MODIFY("fdc:0") - MCFG_SLOT_FIXED(true) - - MCFG_DEVICE_REMOVE("fdc:1") -MACHINE_CONFIG_END - -static GFXDECODE_START( t1000 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, t1000_charlayout, 3, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_FRAGMENT(tandy1000_common) - MCFG_PCNOPPI_MOTHERBOARD_ADD("mb", "maincpu") - - /* video hardware */ - MCFG_PCVIDEO_T1000_ADD("pcvideo_t1000") - MCFG_GFXDECODE_ADD("gfxdecode", "pcvideo_t1000:palette", t1000) - - /* sound hardware */ - MCFG_SOUND_ADD("sn76496", NCR7496, XTAL_14_31818MHz/4) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mb:mono", 0.80) - - MCFG_NVRAM_ADD_0FILL("nvram"); - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa_fdc", pc_isa8_cards, "fdc_xt", true) - MCFG_SLOT_OPTION_MACHINE_CONFIG("fdc_xt", cfg_fdc_35) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa_lpt", pc_isa8_cards, "lpt", true) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa_com", pc_isa8_cards, "com", true) - - MCFG_PC_JOY_ADD("pc_joy") - MCFG_PC_KEYB_ADD("pc_keyboard", DEVWRITELINE("mb:pic8259", pic8259_device, ir1_w)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("640K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( t1000hx, tandy1000_state ) - MCFG_CPU_ADD("maincpu", I8088, 8000000) - MCFG_CPU_PROGRAM_MAP(tandy1000_map) - MCFG_CPU_IO_MAP(tandy1000_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_FRAGMENT_ADD(tandy1000_common) - - // plus cards are isa with a nonstandard conntector - MCFG_ISA8_SLOT_ADD("mb:isa", "plus1", pc_isa8_cards, NULL, false) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( t1000sx, t1000hx ) - MCFG_DEVICE_MODIFY("isa_fdc") - MCFG_SLOT_OPTION_MACHINE_CONFIG("fdc_xt", cfg_fdc_525) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, NULL, false) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( t1000_16, tandy1000_state ) - MCFG_CPU_ADD("maincpu", I8086, XTAL_28_63636MHz / 3) - MCFG_CPU_PROGRAM_MAP(tandy1000_16_map) - MCFG_CPU_IO_MAP(tandy1000_16_bank_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_FRAGMENT_ADD(tandy1000_common) - - MCFG_MACHINE_RESET_OVERRIDE(tandy1000_state,tandy1000rl) - -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( t1000_16_8, t1000_16 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_CLOCK( XTAL_24MHz / 3 ) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, NULL, false) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( t1000_286, tandy1000_state ) - MCFG_CPU_ADD("maincpu", I80286, XTAL_28_63636MHz / 2) - MCFG_CPU_PROGRAM_MAP(tandy1000_286_map) - MCFG_CPU_IO_MAP(tandy1000_16_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259", pic8259_device, inta_cb) - - MCFG_FRAGMENT_ADD(tandy1000_common) - - MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, NULL, false) - MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) -MACHINE_CONFIG_END - -#ifdef UNUSED_DEFINITION -ROM_START( t1000 ) - // Schematics displays 2 32KB ROMs at U9 and U10 - ROM_REGION(0x100000,"maincpu", 0) - ROM_SYSTEM_BIOS( 0, "v010000", "v010000" ) - ROMX_LOAD("v010000.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v010100", "v010100" ) - ROMX_LOAD("v010100.f0", 0xf0000, 0x10000, CRC(b6760881) SHA1(8275e4c48ac09cf36685db227434ca438aebe0b9), ROM_BIOS(2)) - - // Part of video array at u76? - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u76", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location -ROM_END - -ROM_START( t1000a ) - ROM_REGION(0x100000,"maincpu", 0) - // partlist says it has 1 128kbyte rom - ROM_LOAD("t1000hx.e0", 0xe0000, 0x10000, CRC(61dbf242) SHA1(555b58d8aa8e0b0839259621c44b832d993beaef)) // not sure about this one - ROM_LOAD("v010100.f0", 0xf0000, 0x10000, CRC(b6760881) SHA1(8275e4c48ac09cf36685db227434ca438aebe0b9)) - - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u25", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location -ROM_END - -ROM_START( t1000ex ) - ROM_REGION(0x100000,"maincpu", 0) - // partlist says it has 1 128kb rom, schematics list a 32k x 8 rom - // "8040328.u17" - ROM_LOAD("t1000hx.e0", 0xe0000, 0x10000, CRC(61dbf242) SHA1(555b58d8aa8e0b0839259621c44b832d993beaef)) // not sure about this one - ROM_LOAD("v010200.f0", 0xf0000, 0x10000, CRC(0e016ecf) SHA1(2f5ac8921b7cba56b02122ef772f5f11bbf6d8a2)) - - // TODO: Add dump of the 8048 at u8 if it ever gets dumped - ROM_REGION(0x400, "kbdc", 0) - ROM_LOAD("8048.u8", 0x000, 0x400, NO_DUMP) - - // Most likely part of big blue at u28 - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u28", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location -ROM_END - -// The T1000SL and T1000SL/2 only differ in amount of RAM installed and BIOS version (SL/2 has v01.04.04) -ROM_START( t1000sl ) - ROM_REGION(0x100000,"maincpu", 0) - - // 8076312.hu1 - most likely v01.04.00 - // 8075312.hu2 - - - // partlist says it has 1 128kbyte rom - ROM_LOAD("t1000hx.e0", 0xe0000, 0x10000, CRC(61dbf242) SHA1(555b58d8aa8e0b0839259621c44b832d993beaef)) // not sure about this one - ROM_SYSTEM_BIOS( 0, "v010400", "v010400" ) - ROMX_LOAD("v010400.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v010401", "v010401" ) - ROMX_LOAD("v010401.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v010402", "v010402" ) - ROMX_LOAD("v010402.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "v020001", "v020001" ) - ROMX_LOAD("v020001.f0", 0xf0000, 0x10000, NO_DUMP, ROM_BIOS(4) ) - - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u25", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) -ROM_END - - -ROM_START( t1000tl ) - ROM_REGIoN(0x100000, "maincpu", ROMREGION_ERASE00) - - ROM_REGION(0x80000, "romcs0", 0) - // These 2 sets most likely have the same contents - // v01.04.00 - // 8076323.u55 - Sharp - 256KB - // 8075323.u57 - Sharp - 256KB - // v01.04.00 - // 8079025.u54 - Hitachi - 256KB - // 8079026.u56 - Hitachi - 256KB - ROM_REGION(0x80000, "romcs1", 0) - - // 2x 128x8 eeprom?? @ u58 and u59 - not mentioned in parts list - - ROM_REGION(0x80, "eeprom", 0) - ROM_LOAD("8040346_9346.u12", xxx ) // 64x16 eeprom - - ROM_REGION(0x08000, "gfx1", 0) - ROM_LOAD("8079027.u24", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) -ROM_END -#endif - -ROM_START( t1000hx ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD("v020000.u12", 0xe0000, 0x20000, CRC(6f3acd80) SHA1(976af8c04c3f6fde14d7047f6521d302bdc2d017)) // TODO: Rom label - - // TODO: Add dump of the 8048 at u9 if it ever gets dumped - ROM_REGION(0x400, "kbdc", 0) - ROM_LOAD("8048.u9", 0x000, 0x400, NO_DUMP) - - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u31", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location, probably internal to "big blue" at u31 -ROM_END - -ROM_START( t1000sx ) - ROM_REGION(0x100000,"maincpu", 0) - ROM_LOAD("8040328.u41", 0xf8000, 0x8000, CRC(4e2b9f0b) SHA1(e79a9ed9e885736e30d9b135557f0e596ce5a70b)) - - // No character rom is listed in the schematics? - // But disabling it results in no text being printed - // Part of bigblue at u30?? - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u30", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location -ROM_END - - -ROM_START( t1000tx ) - ROM_REGION(0x100000,"maincpu", 0) - // There should be 2 32KBx8 ROMs, one for odd at u38, one for even at u39 - // The machine already boots up with just this one rom - ROM_LOAD("t1000tx.bin", 0xf8000, 0x8000, BAD_DUMP CRC(9b34765c) SHA1(0b07e87f6843393f7d4ca4634b832b0c0bec304e)) - - // No character rom is listed in the schematics? - // It is most likely part of the big blue chip at u36 - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u36", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location -ROM_END - - -ROM_START( t1000rl ) - ROM_REGION(0x100000,"maincpu", ROMREGION_ERASE00) - - // bankable ROM regions - ROM_REGION(0x80000, "romcs0", 0) - /* v2.0.0.1 */ - /* Rom is labeled "(C) TANDY CORP. 1990 // 8079073 // LH534G70 JAPAN // 9034 D" */ - ROM_LOAD("8079073.u23", 0x00000, 0x80000, CRC(6fab50f7) SHA1(2ccc02bee4c250dc1b7c17faef2590bc158860b0) ) - ROM_REGION(0x80000, "romcs1", ROMREGION_ERASEFF) - - ROM_REGION(0x08000,"gfx1", 0) - /* Character rom located at U3 w/label "8079027 // NCR // 609-2495004 // F841030 A9025" */ - ROM_LOAD("8079027.u3", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location -ROM_END - - -ROM_START( t1000sl2 ) - ROM_REGION(0x100000,"maincpu", ROMREGION_ERASE00) - - // bankable ROM regions - ROM_REGION(0x80000, "romcs0", 0) - // v01.04.04 BIOS - ROM_LOAD16_BYTE("8079047.hu1", 0x00000, 0x40000, CRC(c773ec0e) SHA1(7deb71f14c2c418400b639d60066ab61b7e9df32)) - ROM_LOAD16_BYTE("8079048.hu2", 0x00001, 0x40000, CRC(0f3e6586) SHA1(10f1a7204f69b82a18bc94a3010c9660aec0c802)) - ROM_REGION(0x80000, "romcs1", ROMREGION_ERASEFF) - - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u25", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) - - ROM_REGION(0x80, "nmc9246n", 0) - ROM_LOAD("seeprom.bin", 0, 0x80, CRC(4fff41df) SHA1(41a7009694550c017996932beade608cff968f4a)) -ROM_END - - -ROM_START( t1000tl2 ) - ROM_REGION(0x100000, "maincpu", 0) - ROM_LOAD( "t10000tl2.bin", 0xf0000, 0x10000, CRC(e288f12c) SHA1(9d54ccf773cd7202c9906323f1b5a68b1b3a3a67)) - - ROM_REGION(0x08000,"gfx1", 0) - ROM_LOAD("8079027.u24", 0x00000, 0x04000, CRC(33d64a11) SHA1(b63da2a656b6c0a8a32f2be8bdcb51aed983a450)) // TODO: Verify location -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -// tandy 1000 -COMP( 1987, t1000hx, ibm5150, 0, t1000hx, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 HX", 0) -COMP( 1987, t1000sx, ibm5150, 0, t1000sx, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 SX", 0) -COMP( 1987, t1000tx, ibm5150, 0, t1000_286, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 TX", 0) -COMP( 1989, t1000rl, ibm5150, 0, t1000_16, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 RL", 0) -COMP( 1989, t1000tl2, ibm5150, 0, t1000_286, tandy1t, tandy1000_state, t1000hx, "Tandy Radio Shack", "Tandy 1000 TL/2", 0) -COMP( 1988, t1000sl2, ibm5150, 0, t1000_16_8, tandy1t, tandy1000_state, t1000sl, "Tandy Radio Shack", "Tandy 1000 SL/2", 0) diff --git a/src/mess/drivers/tandy2k.c b/src/mess/drivers/tandy2k.c deleted file mode 100644 index dc3f8e64352..00000000000 --- a/src/mess/drivers/tandy2k.c +++ /dev/null @@ -1,908 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Tandy 2000 - -****************************************************************************/ - -/* - - TODO: - - - floppy - - HDL is also connected to WP/TS input where TS is used to detect motor status - - 3 second motor off delay timer - - video (video RAM is at memory top - 0x1400, i.e. 0x1ec00) - - keyboard ROM - - hires graphics board - - WD1010 - - hard disk - - mouse - -*/ - -#include "includes/tandy2k.h" -#include "machine/pckeybrd.h" - -#define LOG 1 - -// Read/Write Handlers - -void tandy2k_state::update_drq() -{ - int drq0 = CLEAR_LINE; - int drq1 = CLEAR_LINE; - - for (int i = 0; i < 4; i++) - { - if (BIT(m_dma_mux, 0 + i)) - { - if (BIT(m_dma_mux, 4 + i)) - drq1 |= m_busdmarq[i]; - else - drq0 |= m_busdmarq[i]; - } - } - - m_maincpu->drq0_w(drq0); - m_maincpu->drq1_w(drq1); -} - -void tandy2k_state::dma_request(int line, int state) -{ - m_busdmarq[line] = state; - - update_drq(); -} - -void tandy2k_state::speaker_update() -{ - int level = !(m_spkrdata & m_outspkr); - - m_speaker->level_w(level); -} - -READ8_MEMBER( tandy2k_state::char_ram_r ) -{ - return m_char_ram[offset]; -} - -WRITE8_MEMBER( tandy2k_state::char_ram_w ) -{ - m_char_ram[offset] = data; -} - -READ8_MEMBER( tandy2k_state::videoram_r ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - offs_t addr = (m_vram_base << 15) | (offset << 1); - UINT16 data = program.read_word(addr); - - // character - m_drb0->write(space, 0, data & 0xff); - - // attributes - m_drb1->write(space, 0, data >> 8); - - return data & 0xff; -} - -READ8_MEMBER( tandy2k_state::enable_r ) -{ - /* - - bit signal description - - 0 RS-232 ring indicator - 1 RS-232 carrier detect - 2 - 3 - 4 - 5 - 6 - 7 _ACLOW - - */ - - UINT8 data = 0x80; - - data |= m_rs232->ri_r(); - data |= m_rs232->dcd_r() << 1; - - return data; -} - -WRITE8_MEMBER( tandy2k_state::enable_w ) -{ - /* - - bit signal description - - 0 KBEN keyboard enable - 1 EXTCLK external baud rate clock - 2 SPKRGATE enable periodic speaker output - 3 SPKRDATA direct output to speaker - 4 RFRQGATE enable refresh and baud rate clocks - 5 FDCRESET* reset 8272 - 6 TMRIN0 enable 80186 timer 0 - 7 TMRIN1 enable 80186 timer 1 - - */ - - if (LOG) logerror("ENABLE %02x\n", data); - - // keyboard enable - m_kb->power_w(BIT(data, 0)); - machine().device("pc_keyboard")->enable(BIT(data, 0)); - - // external baud rate clock - m_extclk = BIT(data, 1); - - // speaker gate - m_pit->write_gate0(BIT(data, 2)); - - // speaker data - m_spkrdata = BIT(data, 3); - speaker_update(); - - // refresh and baud rate clocks - m_pit->write_gate1(BIT(data, 4)); - m_pit->write_gate2(BIT(data, 4)); - - // FDC reset - if (!BIT(data, 5)) - { - m_fdc->soft_reset(); - } - - // timer 0 enable - m_maincpu->tmrin0_w(BIT(data, 6)); - - // timer 1 enable - m_maincpu->tmrin1_w(BIT(data, 7)); -} - -WRITE8_MEMBER( tandy2k_state::dma_mux_w ) -{ - /* - - bit description - - 0 DMA channel 0 enable - 1 DMA channel 1 enable - 2 DMA channel 2 enable - 3 DMA channel 3 enable - 4 DMA channel 0 select - 5 DMA channel 1 select - 6 DMA channel 2 select - 7 DMA channel 3 select - - */ - - if (LOG) logerror("DMA MUX %02x\n", data); - - m_dma_mux = data; - - // check for DMA error - int drq0 = 0; - int drq1 = 0; - - for (int ch = 0; ch < 4; ch++) - { - if (BIT(data, ch)) { if (BIT(data, ch + 4)) drq1++; else drq0++; } - } - - int dme = (drq0 > 2) || (drq1 > 2); - - m_pic1->ir6_w(dme); - - update_drq(); -} - -READ8_MEMBER( tandy2k_state::kbint_clr_r ) -{ - if (m_pb_sel == KBDINEN) - { - m_kb->busy_w(1); - m_pic1->ir0_w(CLEAR_LINE); - - return machine().device("pc_keyboard")->read(space, 0); - } - - return 0xff; -} - -READ16_MEMBER( tandy2k_state::vpac_r ) -{ - if (ACCESSING_BITS_0_7) - { - return m_vpac->read(space, offset); - } - else - { - return 0xff00; - } -} - -WRITE16_MEMBER( tandy2k_state::vpac_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_vpac->write(space, offset, data & 0xff); - } - else - { - addr_ctrl_w(space, offset, data >> 8); - } -} - -READ8_MEMBER( tandy2k_state::fldtc_r ) -{ - if (LOG) logerror("FLDTC\n"); - - fldtc_w(space, 0, 0); - - return 0; -} - -WRITE8_MEMBER( tandy2k_state::fldtc_w ) -{ - m_fdc->tc_w(1); - m_fdc->tc_w(false); -} - -WRITE8_MEMBER( tandy2k_state::addr_ctrl_w ) -{ - /* - - bit signal description - - 8 A15 A15 of video access - 9 A16 A16 of video access - 10 A17 A17 of video access - 11 A18 A18 of video access - 12 A19 A19 of video access - 13 CLKSP0 clock speed (0 = 22.4 MHz, 1 = 28 MHz) - 14 CLKCNT dots/char (0 = 10 [800x400], 1 = 8 [640x400]) - 15 VIDOUTS selects the video source for display on monochrome monitor - - */ - - if (LOG) logerror("Address Control %02x\n", data); - - // video access - m_vram_base = data & 0x1f; - - // video clock speed - int clkspd = BIT(data, 5); - int clkcnt = BIT(data, 6); - - if (m_clkspd != clkspd || m_clkcnt != clkcnt) - { - float busdotclk = XTAL_16MHz*28 / (clkspd ? 16 : 20); - float vidcclk = busdotclk / (clkcnt ? 8 : 10); - - m_vpac->set_character_width(clkcnt ? 8 : 10); - m_vpac->set_unscaled_clock(vidcclk); - - m_vac->set_unscaled_clock(busdotclk); - - m_timer_vidldsh->adjust(attotime::from_hz(vidcclk), 0, attotime::from_hz(vidcclk)); - - m_clkspd = clkspd; - m_clkcnt = clkcnt; - } - - // video source select - m_vidouts = BIT(data, 7); -} - -// Memory Maps - -static ADDRESS_MAP_START( tandy2k_mem, AS_PROGRAM, 16, tandy2k_state ) - ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE(0x00000, 0xdffff) AM_RAM - AM_RANGE(0xe0000, 0xf7fff) AM_RAM AM_SHARE("hires_ram") - AM_RANGE(0xf8000, 0xfbfff) AM_READWRITE8(char_ram_r, char_ram_w, 0x00ff) - AM_RANGE(0xfc000, 0xfdfff) AM_MIRROR(0x2000) AM_ROM AM_REGION(I80186_TAG, 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tandy2k_io, AS_IO, 16, tandy2k_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x00001) AM_MIRROR(0x8) AM_READWRITE8(enable_r, enable_w, 0x00ff) - AM_RANGE(0x00002, 0x00003) AM_MIRROR(0x8) AM_WRITE8(dma_mux_w, 0x00ff) - AM_RANGE(0x00004, 0x00005) AM_MIRROR(0x8) AM_READWRITE8(fldtc_r, fldtc_w, 0x00ff) - AM_RANGE(0x00010, 0x00013) AM_MIRROR(0xc) AM_DEVREADWRITE8(I8251A_TAG, i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0x00030, 0x00033) AM_MIRROR(0xc) AM_DEVICE8(I8272A_TAG, i8272a_device, map, 0x00ff) - AM_RANGE(0x00040, 0x00047) AM_MIRROR(0x8) AM_DEVREADWRITE8(I8253_TAG, pit8253_device, read, write, 0x00ff) - AM_RANGE(0x00052, 0x00053) AM_MIRROR(0x8) AM_READ8(kbint_clr_r, 0x00ff) - AM_RANGE(0x00050, 0x00057) AM_MIRROR(0x8) AM_DEVREADWRITE8(I8255A_TAG, i8255_device, read, write, 0x00ff) - AM_RANGE(0x00060, 0x00063) AM_MIRROR(0xc) AM_DEVREADWRITE8(I8259A_0_TAG, pic8259_device, read, write, 0x00ff) - AM_RANGE(0x00070, 0x00073) AM_MIRROR(0xc) AM_DEVREADWRITE8(I8259A_1_TAG, pic8259_device, read, write, 0x00ff) - AM_RANGE(0x00080, 0x00081) AM_MIRROR(0xe) AM_DEVREADWRITE8(I8272A_TAG, i8272a_device, mdma_r, mdma_w, 0x00ff) -// AM_RANGE(0x00100, 0x0017f) AM_DEVREADWRITE8(CRT9007_TAG, crt9007_t, read, write, 0x00ff) AM_WRITE8(addr_ctrl_w, 0xff00) - AM_RANGE(0x00100, 0x0017f) AM_READWRITE(vpac_r, vpac_w) -// AM_RANGE(0x00180, 0x00180) AM_READ8(hires_status_r, 0x00ff) -// AM_RANGE(0x00180, 0x001bf) AM_WRITE(hires_palette_w) -// AM_RANGE(0x001a0, 0x001a0) AM_READ8(hires_plane_w, 0x00ff) -// AM_RANGE(0x0ff00, 0x0ffff) AM_READWRITE(i186_internal_port_r, i186_internal_port_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tandy2k_hd_io, AS_IO, 16, tandy2k_state ) - AM_IMPORT_FROM(tandy2k_io) -// AM_RANGE(0x000e0, 0x000ff) AM_WRITE8(hdc_dack_w, 0x00ff) -// AM_RANGE(0x0026c, 0x0026d) AM_DEVREADWRITE8(WD1010_TAG, wd1010_device, hdc_reset_r, hdc_reset_w, 0x00ff) -// AM_RANGE(0x0026e, 0x0027f) AM_DEVREADWRITE8(WD1010_TAG, wd1010_device, wd1010_r, wd1010_w, 0x00ff) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( vpac_mem, AS_0, 8, tandy2k_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ(videoram_r) -ADDRESS_MAP_END - -// Input Ports - -static INPUT_PORTS_START( tandy2k ) - // defined in machine/tandy2kb.c - PORT_INCLUDE(pc_keyboard) -INPUT_PORTS_END - -// Video - -UINT32 tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const pen_t *pen = m_palette->pens(); - address_space &program = m_maincpu->space(AS_PROGRAM); - - for (int y = 0; y < 400; y++) - { - UINT8 cgra = y % 16; - - for (int sx = 0; sx < 80; sx++) - { - offs_t addr = m_ram->size() - 0x1400 + (((y / 16) * 80) + sx) * 2; - UINT8 vidla = program.read_word(addr); - UINT8 data = m_char_ram[(vidla << 4) | cgra]; - - for (int x = 0; x < 8; x++) - { - int color = BIT(data, 7); - bitmap.pix32(y, (sx * 8) + x) = pen[color]; - data <<= 1; - } - } - } - - return 0; -} - -WRITE_LINE_MEMBER( tandy2k_state::vpac_vlt_w ) -{ - m_drb0->ren_w(state); - m_drb0->clrcnt_w(state); - - m_drb1->ren_w(state); - m_drb1->clrcnt_w(state); -} - -WRITE_LINE_MEMBER( tandy2k_state::vpac_drb_w ) -{ - m_drb0->tog_w(state); - m_drb1->tog_w(state); -} - -WRITE_LINE_MEMBER( tandy2k_state::vpac_wben_w ) -{ - m_drb0->wen1_w(state); - m_drb1->wen1_w(state); -} - -WRITE_LINE_MEMBER( tandy2k_state::vpac_cblank_w ) -{ - m_cblank = state; -} - -WRITE_LINE_MEMBER( tandy2k_state::vpac_slg_w ) -{ - m_slg = state; - - m_vac->slg_w(state); -} - -WRITE_LINE_MEMBER( tandy2k_state::vpac_sld_w ) -{ - m_sld = state; - - m_vac->sld_w(state); -} - -WRITE8_MEMBER( tandy2k_state::vidla_w ) -{ - m_vidla = data; -} - -WRITE8_MEMBER( tandy2k_state::drb_attr_w ) -{ - /* - - bit description - - 0 BLC -> DBLC (delayed 2 CCLKs) - 1 BKC -> DBKC (delayed 2 CCLKs) - 2 CHABL - 3 MS0 - 4 MS1 - 5 BLINK - 6 INT - 7 REVID - - */ - - m_blc = BIT(data, 0); - m_bkc = BIT(data, 1); - m_vac->chabl_w(BIT(data, 2)); - m_vac->ms0_w(BIT(data, 3)); - m_vac->ms1_w(BIT(data, 4)); - m_vac->blink_w(BIT(data, 5)); - m_vac->intin_w(BIT(data, 6)); - m_vac->revid_w(BIT(data, 7)); -} - -CRT9021_DRAW_CHARACTER_MEMBER( tandy2k_state::vac_draw_character ) -{ - const pen_t *pen = m_palette->pens(); - - for (int i = 0; i < 8; i++) - { - int color = BIT(video, 7 - i); - - bitmap.pix32(y, x++) = pen[color]; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER( tandy2k_state::vidldsh_tick ) -{ - m_drb0->rclk_w(0); - m_drb0->wclk_w(0); - m_drb1->rclk_w(0); - m_drb1->wclk_w(0); - m_vac->ld_sh_w(0); - - // 1 busdotclk later - m_vac->blc_w(BIT(m_dblc, 0)); - m_dblc >>= 1; - m_dblc |= m_blc << 2; - - m_vac->bkc_w(BIT(m_dbkc, 0)); - m_dbkc >>= 1; - m_dbkc |= m_bkc << 2; - - m_vac->retbl_w(BIT(m_dblank, 0)); - m_dblank >>= 1; - m_dblank |= m_cblank << 2; - - if (!m_slg) - { - m_cgra >>= 1; - m_cgra |= m_sld << 3; - } - - UINT8 vidd = m_char_ram[(m_vidla << 4) | m_cgra]; - m_vac->write(vidd); - - m_drb0->rclk_w(1); - m_drb0->wclk_w(1); - m_drb1->rclk_w(1); - m_drb1->wclk_w(1); - m_vac->ld_sh_w(1); -} - -// Intel 8251A Interface - -WRITE_LINE_MEMBER( tandy2k_state::rxrdy_w ) -{ - m_rxrdy = state; - m_pic0->ir2_w(m_rxrdy || m_txrdy); -} - -WRITE_LINE_MEMBER( tandy2k_state::txrdy_w ) -{ - m_txrdy = state; - m_pic0->ir2_w(m_rxrdy || m_txrdy); -} - -// Intel 8253 Interface - -WRITE_LINE_MEMBER( tandy2k_state::outspkr_w ) -{ - m_outspkr = state; - speaker_update(); -} - -WRITE_LINE_MEMBER( tandy2k_state::intbrclk_w ) -{ - if (!m_extclk) - { - m_uart->write_txc(state); - m_uart->write_rxc(state); - } -} - -WRITE_LINE_MEMBER( tandy2k_state::rfrqpulse_w ) -{ - // memory refresh counter up -} - -// Intel 8255A Interface - -WRITE_LINE_MEMBER( tandy2k_state::write_centronics_ack ) -{ - m_centronics_ack = state; - m_i8255a->pc6_w(state); -} - -WRITE_LINE_MEMBER( tandy2k_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( tandy2k_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -WRITE_LINE_MEMBER( tandy2k_state::write_centronics_select ) -{ - m_centronics_select = state; -} - -WRITE_LINE_MEMBER( tandy2k_state::write_centronics_fault ) -{ - m_centronics_fault = state; -} - -READ8_MEMBER( tandy2k_state::ppi_pb_r ) -{ - /* - - bit signal description - - 0 LPRIN0 auxiliary input 0 - 1 LPRIN1 auxiliary input 1 - 2 LPRIN2 auxiliary input 2 - 3 _LPRACK acknowledge - 4 _LPRFLT fault - 5 _LPRSEL select - 6 LPRPAEM paper empty - 7 LPRBSY busy - - */ - - UINT8 data = 0; - - switch (m_pb_sel) - { - case LPINEN: - // printer acknowledge - data |= m_centronics_ack << 3; - - // printer fault - data |= m_centronics_fault << 4; - - // printer select - data |= m_centronics_select << 5; - - // paper empty - data |= m_centronics_perror << 6; - - // printer busy - data |= m_centronics_busy << 7; - break; - - case KBDINEN: - // keyboard data - data = m_kbdin; - break; - - case PORTINEN: - // PCB revision - data = 0x03; - break; - } - - return data; -} - -WRITE8_MEMBER( tandy2k_state::ppi_pc_w ) -{ - /* - - bit signal description - - 0 port A direction - 1 port B input select bit 0 - 2 port B input select bit 1 - 3 LPRINT13 interrupt - 4 STROBE IN - 5 INBUFFULL - 6 _LPRACK - 7 _LPRDATSTB - - */ - - // input select - m_pb_sel = (data >> 1) & 0x03; - - // interrupt - m_pic1->ir3_w(BIT(data, 3)); - - // printer strobe - m_centronics->write_strobe(BIT(data, 7)); -} - - -// Intel 8259 Interfaces - -/* - - IR0 MEMINT00 - IR1 TMOINT01 - IR2 SERINT02 - IR3 BUSINT03 - IR4 FLDINT04 - IR5 BUSINT05 - IR6 HDCINT06 - IR7 BUSINT07 - -*/ - -/* - - IR0 KBDINT10 - IR1 VIDINT11 - IR2 RATINT12 - IR3 LPRINT13 - IR4 MCPINT14 - IR5 MEMINT15 - IR6 DMEINT16 - IR7 BUSINT17 - -*/ - -// Intel 8272 Interface - -WRITE_LINE_MEMBER( tandy2k_state::fdc_drq_w ) -{ - dma_request(0, state); -} - -WRITE_LINE_MEMBER( tandy2k_state::fdc_hdl_w ) -{ - m_floppy0->mon_w(!state); - m_floppy1->mon_w(!state); -} - -FLOPPY_FORMATS_MEMBER( tandy2k_state::floppy_formats ) - FLOPPY_TANDY_2000_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( tandy2k_floppies ) - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -// Keyboard - -WRITE_LINE_MEMBER( tandy2k_state::kbdclk_w ) -{ - if (!m_kbdclk && state) - { - m_kbdin >>= 1; - m_kbdin |= m_kb->data_r() << 7; - } - - m_kbdclk = state; -} - -WRITE_LINE_MEMBER( tandy2k_state::kbddat_w ) -{ - if (!m_kbddat && state) - { - m_kb->busy_w(m_kbdclk); - m_pic1->ir0_w(!m_kbdclk); - } - - m_kbddat = state; -} - -READ8_MEMBER( tandy2k_state::irq_callback ) -{ - return (offset ? m_pic1 : m_pic0)->acknowledge(); -} - -// Machine Initialization - -void tandy2k_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - int ram_size = m_ram->size(); - - program.install_ram(0x00000, ram_size - 1, ram); - - m_char_ram.allocate(0x1000); - - // register for state saving - save_item(NAME(m_dma_mux)); - save_item(NAME(m_kbdclk)); - save_item(NAME(m_kbddat)); - save_item(NAME(m_kbdin)); - save_item(NAME(m_extclk)); - save_item(NAME(m_rxrdy)); - save_item(NAME(m_txrdy)); - save_item(NAME(m_pb_sel)); - save_item(NAME(m_vidouts)); - save_item(NAME(m_clkspd)); - save_item(NAME(m_clkcnt)); - save_item(NAME(m_outspkr)); - save_item(NAME(m_spkrdata)); -} - -void tandy2k_state::device_reset_after_children() -{ - machine().device("pc_keyboard")->enable(0); -} - -// Machine Driver - -static MACHINE_CONFIG_START( tandy2k, tandy2k_state ) - // basic machine hardware - MCFG_CPU_ADD(I80186_TAG, I80186, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(tandy2k_mem) - MCFG_CPU_IO_MAP(tandy2k_io) - MCFG_80186_IRQ_SLAVE_ACK(DEVREAD8(DEVICE_SELF, tandy2k_state, irq_callback)) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1) - //MCFG_SCREEN_UPDATE_DEVICE(CRT9021B_TAG, crt9021_t, screen_update) - MCFG_SCREEN_UPDATE_DRIVER(tandy2k_state, screen_update) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_DEVICE_ADD(CRT9007_TAG, CRT9007, XTAL_16MHz*28/20/8) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vpac_mem) - MCFG_CRT9007_CHARACTER_WIDTH(8) - MCFG_CRT9007_INT_CALLBACK(DEVWRITELINE(I8259A_1_TAG, pic8259_device, ir1_w)) - MCFG_CRT9007_VS_CALLBACK(DEVWRITELINE(CRT9021B_TAG, crt9021_t, vsync_w)) - MCFG_CRT9007_VLT_CALLBACK(WRITELINE(tandy2k_state, vpac_vlt_w)) - MCFG_CRT9007_CURS_CALLBACK(DEVWRITELINE(CRT9021B_TAG, crt9021_t, cursor_w)) - MCFG_CRT9007_DRB_CALLBACK(WRITELINE(tandy2k_state, vpac_drb_w)) - MCFG_CRT9007_WBEN_CALLBACK(WRITELINE(tandy2k_state, vpac_wben_w)) - MCFG_CRT9007_CBLANK_CALLBACK(WRITELINE(tandy2k_state, vpac_cblank_w)) - MCFG_CRT9007_SLG_CALLBACK(WRITELINE(tandy2k_state, vpac_slg_w)) - MCFG_CRT9007_SLD_CALLBACK(WRITELINE(tandy2k_state, vpac_sld_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - - MCFG_DEVICE_ADD(CRT9212_0_TAG, CRT9212, 0) - MCFG_CRT9212_WEN2_VCC() - MCFG_CRT9212_DOUT_CALLBACK(WRITE8(tandy2k_state, vidla_w)) - - MCFG_DEVICE_ADD(CRT9212_1_TAG, CRT9212, 0) - MCFG_CRT9212_WEN2_VCC() - MCFG_CRT9212_DOUT_CALLBACK(WRITE8(tandy2k_state, drb_attr_w)) - - MCFG_DEVICE_ADD(CRT9021B_TAG, CRT9021, XTAL_16MHz*28/20) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - - MCFG_TIMER_DRIVER_ADD("vidldsh", tandy2k_state, vidldsh_tick) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_IN_PORTB_CB(READ8(tandy2k_state, ppi_pb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(tandy2k_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(tandy2k_state, rxrdy_w)) - MCFG_I8251_TXRDY_HANDLER(WRITELINE(tandy2k_state, txrdy_w)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_dsr)) - // TODO pin 15 external transmit clock - // TODO pin 17 external receiver clock - - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_16MHz/16) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(tandy2k_state, outspkr_w)) - MCFG_PIT8253_CLK1(XTAL_16MHz/8) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(tandy2k_state, intbrclk_w)) - //MCFG_PIT8253_CLK2(XTAL_16MHz/8) - //MCFG_PIT8253_OUT2_HANDLER(WRITELINE(tandy2k_state, rfrqpulse_w)) - - MCFG_PIC8259_ADD(I8259A_0_TAG, DEVWRITELINE(I80186_TAG, i80186_cpu_device, int0_w), VCC, NULL) - - MCFG_PIC8259_ADD(I8259A_1_TAG, DEVWRITELINE(I80186_TAG, i80186_cpu_device, int1_w), VCC, NULL) - - MCFG_I8272A_ADD(I8272A_TAG, true) - downcast(device)->set_select_lines_connected(true); - MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE(I8259A_0_TAG, pic8259_device, ir4_w)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE(tandy2k_state, fdc_drq_w)) - MCFG_UPD765_HDL_CALLBACK(WRITELINE(tandy2k_state, fdc_hdl_w)) - MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":0", tandy2k_floppies, "525qd", tandy2k_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":1", tandy2k_floppies, "525qd", tandy2k_state::floppy_formats) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(tandy2k_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(tandy2k_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(tandy2k_state, write_centronics_perror)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(tandy2k_state, write_centronics_select)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(tandy2k_state, write_centronics_fault)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_DEVICE_ADD(TANDY2K_KEYBOARD_TAG, TANDY2K_KEYBOARD, 0) - MCFG_TANDY2000_KEYBOARD_CLOCK_CALLBACK(WRITELINE(tandy2k_state, kbdclk_w)) - MCFG_TANDY2000_KEYBOARD_DATA_CALLBACK(WRITELINE(tandy2k_state, kbddat_w)) - - // temporary until the tandy keyboard has a rom dump - MCFG_PC_KEYB_ADD("pc_keyboard", DEVWRITELINE(I8259A_1_TAG, pic8259_device, ir0_w)) - - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "tandy2k") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("256K,384K,512K,640K,768K,896K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tandy2k_hd, tandy2k ) - // basic machine hardware - MCFG_CPU_MODIFY(I80186_TAG) - MCFG_CPU_IO_MAP(tandy2k_hd_io) - - // Tandon TM502 hard disk - MCFG_HARDDISK_ADD("harddisk0") - //MCFG_WD1010_ADD(WD1010_TAG, wd1010_intf) - //MCFG_WD1100_11_ADD(WD1100_11_TAG, wd1100_11_intf) -MACHINE_CONFIG_END - -// ROMs - -ROM_START( tandy2k ) - ROM_REGION( 0x2000, I80186_TAG, 0 ) - ROM_LOAD16_BYTE( "484a00.u48", 0x0000, 0x1000, CRC(a5ee3e90) SHA1(4b1f404a4337c67065dd272d62ff88dcdee5e34b) ) - ROM_LOAD16_BYTE( "474600.u47", 0x0001, 0x1000, CRC(345701c5) SHA1(a775cbfa110b7a88f32834aaa2a9b868cbeed25b) ) - - ROM_REGION( 0x100, "plds", 0 ) - ROM_LOAD( "82s153.u62", 0x000, 0x100, NO_DUMP ) // interrupt/DMA - ROM_LOAD( "82s153.u68", 0x000, 0x100, NO_DUMP ) // video - ROM_LOAD( "82s153.u95", 0x000, 0x100, NO_DUMP ) // memory timing - ROM_LOAD( "pal10l8.u82", 0x000, 0x100, NO_DUMP ) // video - ROM_LOAD( "pal16l8a.u102", 0x000, 0x100, NO_DUMP ) // bus interface - ROM_LOAD( "pal16l8a.u103", 0x000, 0x100, NO_DUMP ) // bus interface - ROM_LOAD( "pal20l8.u103", 0x000, 0x100, NO_DUMP ) // bus interface, alternate - ROM_LOAD( "pal16r6a.u16", 0x000, 0x100, NO_DUMP ) // HDC -ROM_END - -#define rom_tandy2khd rom_tandy2k - -// System Drivers - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, tandy2k, 0, 0, tandy2k, tandy2k, driver_device, 0, "Tandy Radio Shack", "Tandy 2000", MACHINE_NOT_WORKING ) -COMP( 1983, tandy2khd, tandy2k, 0, tandy2k_hd, tandy2k, driver_device, 0, "Tandy Radio Shack", "Tandy 2000HD", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/tavernie.c b/src/mess/drivers/tavernie.c deleted file mode 100644 index c1ea74dc14d..00000000000 --- a/src/mess/drivers/tavernie.c +++ /dev/null @@ -1,401 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders: Robbbert -/*************************************************************************** - - Tavernier CPU09 and IVG09 (Realisez votre ordinateur individuel) - - 2013-12-08 Skeleton driver. - - This system was described in a French computer magazine. - - CPU09 includes 6809, 6821, 6840, 6850, cassette, rs232 - IVG09 includes 6845, another 6821, beeper - IFD09 includes WD1795 - -ToDo: - - Attributes ram - - Graphics - - Character rom is not dumped - - Graphics rom is not dumped - - 3x 7611 proms not dumped - - Fix cassette - - Test FDC - - Need software - -List of commands (must be in UPPERCASE): -A - -B - -C - -D - Dump memory (^X to break) -G - -I - -L - Load cassette -M - -N - -O - -P - Save cassette -Q - -R - Display/Alter Registers -S - -T - -U - -V - -W - -X - 'erreur de chargement dos' -Y - -Z - more scan lines per row (cursor is bigger) - - -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/m6809/m6809.h" -#include "machine/6821pia.h" -#include "machine/6840ptm.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "video/mc6845.h" -#include "machine/keyboard.h" -#include "imagedev/cassette.h" -#include "machine/wd_fdc.h" -#include "sound/wave.h" -#include "sound/beep.h" -#include "tavernie.lh" - -#define KEYBOARD_TAG "keyboard" - -class tavernie_state : public driver_device -{ -public: - tavernie_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_cass(*this, "cassette"), - m_pia_ivg(*this, "pia_ivg"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_beep(*this, "beeper"), - m_maincpu(*this, "maincpu"), - m_acia(*this, "acia"), - m_palette(*this, "palette") - { - } - - DECLARE_READ_LINE_MEMBER(ca1_r); - DECLARE_READ8_MEMBER(pa_r); - DECLARE_WRITE8_MEMBER(pa_w); - DECLARE_WRITE8_MEMBER(pb_w); - DECLARE_WRITE8_MEMBER(pa_ivg_w); - DECLARE_READ8_MEMBER(pb_ivg_r); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE8_MEMBER(ds_w); - DECLARE_MACHINE_RESET(cpu09); - DECLARE_MACHINE_RESET(ivg09); - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - MC6845_UPDATE_ROW(crtc_update_row); - - const UINT8 *m_p_chargen; - optional_shared_ptr m_p_videoram; - -private: - UINT8 m_term_data; - UINT8 m_pa; - required_device m_cass; - optional_device m_pia_ivg; - optional_device m_fdc; - optional_device m_floppy0; - optional_device m_beep; - required_device m_maincpu; - required_device m_acia; -public: - optional_device m_palette; -}; - - -static ADDRESS_MAP_START(cpu09_mem, AS_PROGRAM, 8, tavernie_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x1000, 0x1fff) AM_NOP - AM_RANGE(0xeb00, 0xeb03) AM_DEVREADWRITE("pia", pia6821_device, read, write) - AM_RANGE(0xeb04, 0xeb04) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) - AM_RANGE(0xeb05, 0xeb05) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) - AM_RANGE(0xeb08, 0xeb0f) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) - AM_RANGE(0xec00, 0xefff) AM_RAM // 1Kx8 RAM MK4118 - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("roms", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ivg09_mem, AS_PROGRAM, 8, tavernie_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x1000, 0x1fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x2000, 0x2003) AM_DEVREADWRITE("pia_ivg", pia6821_device, read, write) - AM_RANGE(0x2080, 0x2080) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) - AM_RANGE(0x2081, 0x2081) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("fdc", fd1795_t, read, write) - AM_RANGE(0xe080, 0xe080) AM_WRITE(ds_w) - AM_RANGE(0xeb00, 0xeb03) AM_DEVREADWRITE("pia", pia6821_device, read, write) - AM_RANGE(0xeb04, 0xeb04) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) - AM_RANGE(0xeb05, 0xeb05) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) - AM_RANGE(0xeb08, 0xeb0f) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) - AM_RANGE(0xec00, 0xefff) AM_RAM // 1Kx8 RAM MK4118 - AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("roms", 0) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( cpu09 ) - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x00, "IRQ PTM") PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x01, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x02, 0x00, "IRQ ACIA") PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x02, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x60, 0x40, "Terminal") PORT_DIPLOCATION("SW1:3,4") - PORT_DIPSETTING( 0x00, "110 baud" ) - PORT_DIPSETTING( 0x20, "300 baud" ) - PORT_DIPSETTING( 0x40, "1200 baud" ) - PORT_DIPSETTING( 0x60, "IVG09 (mc6845)" ) -INPUT_PORTS_END - -static INPUT_PORTS_START( ivg09 ) - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x00, "IRQ PTM") PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x01, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x02, 0x00, "IRQ ACIA") PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x02, DEF_STR(Off)) - PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x60, 0x60, "Terminal") PORT_DIPLOCATION("SW1:3,4") - PORT_DIPSETTING( 0x00, "110 baud" ) - PORT_DIPSETTING( 0x20, "300 baud" ) - PORT_DIPSETTING( 0x40, "1200 baud" ) - PORT_DIPSETTING( 0x60, "IVG09 (mc6845)" ) -INPUT_PORTS_END - -MACHINE_RESET_MEMBER( tavernie_state, cpu09) -{ - m_term_data = 0; -} - -MACHINE_RESET_MEMBER( tavernie_state, ivg09) -{ - m_p_chargen = memregion("chargen")->base(); - m_beep->set_frequency(950); /* guess */ - m_beep->set_state(1); - m_term_data = 0; - m_pia_ivg->cb1_w(1); -} - -static SLOT_INTERFACE_START( ifd09_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -// can support 3 drives -WRITE8_MEMBER( tavernie_state::ds_w ) -{ - floppy_image_device *floppy = NULL; - if ((data & 3) == 1) floppy = m_floppy0->get_device(); - //if ((data & 3) == 2) floppy = m_floppy1->get_device(); - //if ((data & 3) == 3) floppy = m_floppy2->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - m_fdc->dden_w(!BIT(data, 2)); - } -} - - -MC6845_UPDATE_ROW( tavernie_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx=0; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - UINT8 inv=0; - if (x == cursor_x) inv=0xff; - mem = (ma + x) & 0xfff; - if (ra > 7) - gfx = inv; // some blank spacing lines - else - { - chr = m_p_videoram[mem]; - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; - } - - /* Display a scanline of a character */ - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} - - -READ8_MEMBER( tavernie_state::pa_r ) -{ - return ioport("DSW")->read() | m_pa; -} - - -/* -d0: A16 -d1: A17 (for 256kb expansion) -d2, d3, d4: to 40-pin port -d5: S3 -d6: S4 -d7: cassout -*/ -WRITE8_MEMBER( tavernie_state::pa_w ) -{ - m_pa = data & 0x9f; - m_cass->output(BIT(data, 7) ? -1.0 : +1.0); -} - -// centronics -WRITE8_MEMBER( tavernie_state::pb_w ) -{ -} - -// cass in -READ_LINE_MEMBER( tavernie_state::ca1_r ) -{ - return (m_cass->input() > +0.01); -} - -READ8_MEMBER( tavernie_state::pb_ivg_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( tavernie_state::pa_ivg_w ) -{ -// bits 0-3 are attribute bits -} - -WRITE8_MEMBER( tavernie_state::kbd_put ) -{ - m_term_data = data; - m_pia_ivg->cb1_w(0); - m_pia_ivg->cb1_w(1); -} - -WRITE_LINE_MEMBER( tavernie_state::write_acia_clock ) -{ - m_acia->write_txc(state); - m_acia->write_rxc(state); -} - -static MACHINE_CONFIG_START( cpu09, tavernie_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M6809E, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(cpu09_mem) - MCFG_MACHINE_RESET_OVERRIDE(tavernie_state, cpu09) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_CASSETTE_ADD( "cassette" ) - - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(tavernie_state, pa_r)) - MCFG_PIA_READCA1_HANDLER(READLINE(tavernie_state, ca1_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(tavernie_state, pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(tavernie_state, pb_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - - MCFG_DEVICE_ADD("ptm", PTM6840, 0) - // all i/o lines connect to the 40-pin expansion connector - MCFG_PTM6840_INTERNAL_CLOCK(XTAL_4MHz / 4) - MCFG_PTM6840_EXTERNAL_CLOCKS(0, 0, 0) - MCFG_PTM6840_OUT1_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_PTM6840_IRQ_CB(INPUTLINE("maincpu", M6809_IRQ_LINE)) - - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(tavernie_state, write_acia_clock)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ivg09, cpu09 ) - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(ivg09_mem) - MCFG_MACHINE_RESET_OVERRIDE(tavernie_state, ivg09) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(80*8, 25*10) - MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*10-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_DEFAULT_LAYOUT(layout_tavernie) - - /* sound hardware */ - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(tavernie_state, kbd_put)) - - MCFG_MC6845_ADD("crtc", MC6845, "screen", 1008000) // unknown clock - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(tavernie_state, crtc_update_row) - - MCFG_DEVICE_ADD("pia_ivg", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(tavernie_state, pb_ivg_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(tavernie_state, pa_ivg_w)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE("beeper", beep_device, set_state)) - - MCFG_FD1795_ADD("fdc", XTAL_8MHz / 8) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", ifd09_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( cpu09 ) - ROM_REGION( 0x1000, "roms", 0 ) - ROM_LOAD( "tavbug.bin", 0x0000, 0x1000, CRC(77945cae) SHA1(d89b577bc0b4e15e9a49a849998681bdc6cf5fbe) ) -ROM_END - -ROM_START( ivg09 ) - ROM_REGION( 0x19f0, "roms", 0 ) - ROM_LOAD( "tavbug.bin", 0x0000, 0x1000, CRC(77945cae) SHA1(d89b577bc0b4e15e9a49a849998681bdc6cf5fbe) ) - // these 2 are not used. Boottav is copied to ram at c100 - ROM_LOAD_OPTIONAL( "promon.bin", 0x1000, 0x0800, CRC(43256bf2) SHA1(e81acb5b659d50d7b019b97ad5d2a8f129da39f6) ) - ROM_LOAD_OPTIONAL( "boottav.bin", 0x1800, 0x01f0, CRC(ae1a858d) SHA1(ab2144a00afd5b75c6dcb15c2c3f9d6910a159ae) ) - - // charrom is missing, using one from 'c10' for now - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, cpu09, 0, 0, cpu09, cpu09, driver_device, 0, "C. Tavernier", "CPU09", MACHINE_NOT_WORKING ) -COMP( 1983, ivg09, cpu09, 0, ivg09, ivg09, driver_device, 0, "C. Tavernier", "CPU09 with IVG09 and IFD09", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/tb303.c b/src/mess/drivers/tb303.c deleted file mode 100644 index 841aa375aed..00000000000 --- a/src/mess/drivers/tb303.c +++ /dev/null @@ -1,312 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/*************************************************************************** - - ** subclass of hh_ucom4_state (includes/hh_ucom4.h, drivers/hh_ucom4.c) ** - - Roland TB-303 Bass Line, 1982, designed by Tadao Kikumoto - * NEC uCOM-43 MCU, labeled D650C 133 - * 3*uPD444C 1024x4 Static CMOS SRAM - * board is packed with discrete components - - TODO: - - still too much to list here - -***************************************************************************/ - -#include "includes/hh_ucom4.h" - -#include "tb303.lh" - - -class tb303_state : public hh_ucom4_state -{ -public: - tb303_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_ucom4_state(mconfig, type, tag), - m_t3_off_timer(*this, "t3_off") - { } - - required_device m_t3_off_timer; - - UINT8 m_ram[0xc00]; - UINT16 m_ram_address; - bool m_ram_ce; - bool m_ram_we; - - DECLARE_WRITE8_MEMBER(ram_w); - DECLARE_READ8_MEMBER(ram_r); - DECLARE_WRITE8_MEMBER(strobe_w); - void refresh_ram(); - - DECLARE_WRITE8_MEMBER(switch_w); - DECLARE_READ8_MEMBER(input_r); - void update_leds(); - - TIMER_DEVICE_CALLBACK_MEMBER(t3_clock); - TIMER_DEVICE_CALLBACK_MEMBER(t3_off); - - virtual void machine_start(); -}; - - -/*************************************************************************** - - Timer/Interrupt - -***************************************************************************/ - -// T2 to MCU CLK: LC circuit, stable sine wave, 2.2us interval -#define TB303_T2_CLOCK_HZ 454545 /* in hz */ - -// T3 to MCU _INT: square wave, 1.8ms interval, short duty cycle -#define TB303_T3_CLOCK attotime::from_usec(1800) -#define TB303_T3_OFF (TB303_T3_CLOCK / 8) - -TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_off) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_clock) -{ - m_maincpu->set_input_line(0, ASSERT_LINE); - m_t3_off_timer->adjust(TB303_T3_OFF); -} - - - -/*************************************************************************** - - I/O - -***************************************************************************/ - -// external ram - -void tb303_state::refresh_ram() -{ - // MCU E2,E3 goes through a 4556 IC(pin 14,13) to one of uPD444 _CE: - // _Q0: N/C, _Q1: IC-5, _Q2: IC-3, _Q3: IC-4 - m_ram_ce = true; - UINT8 hi = 0; - switch (m_port[NEC_UCOM4_PORTE] >> 2 & 3) - { - case 0: m_ram_ce = false; break; - case 1: hi = 0; break; - case 2: hi = 1; break; - case 3: hi = 2; break; - } - - if (m_ram_ce) - { - // _WE must be high(read mode) for address transitions - if (!m_ram_we) - m_ram_address = hi << 10 | (m_port[NEC_UCOM4_PORTE] << 8 & 0x300) | m_port[NEC_UCOM4_PORTF] << 4 | m_port[NEC_UCOM4_PORTD]; - else - m_ram[m_ram_address] = m_port[NEC_UCOM4_PORTC]; - } -} - -WRITE8_MEMBER(tb303_state::ram_w) -{ - // MCU C: RAM data - // MCU D,F,E: RAM address - m_port[offset] = data; - refresh_ram(); - - // MCU D,F01: pitch data - //.. -} - -READ8_MEMBER(tb303_state::ram_r) -{ - // MCU C: RAM data - if (m_ram_ce && !m_ram_we) - return m_ram[m_ram_address]; - else - return 0; -} - -WRITE8_MEMBER(tb303_state::strobe_w) -{ - // MCU I0: RAM _WE - m_ram_we = (data & 1) ? false : true; - refresh_ram(); - - // MCU I1: pitch data latch strobe - // MCU I2: gate signal - - m_port[offset] = data; -} - - -// switch board - -void tb303_state::update_leds() -{ - // 4*4 LED matrix from port G/H: - /* - 0.0 D204 1.0 D211 2.0 D217 3.0 D205 - 0.1 D206 1.1 D213 2.1 D218 3.1 D207 - 0.2 D208 1.2 D215 2.2 D220 3.2 D210 - 0.3 D209 1.3 D216 2.3 D221 3.3 D212 - */ - display_matrix(4, 4, m_port[NEC_UCOM4_PORTG], m_port[NEC_UCOM4_PORTH]); - - // todo: battery led - // todo: 4 more leds(see top-left part) -} - -WRITE8_MEMBER(tb303_state::switch_w) -{ - // MCU G: leds state - // MCU H: input/led mux - if (offset == NEC_UCOM4_PORTH) - m_inp_mux = data = data ^ 0xf; - - m_port[offset] = data; - update_leds(); -} - -READ8_MEMBER(tb303_state::input_r) -{ - // MCU A,B: multiplexed inputs - // if input mux(port H) is 0, port A status buffer & gate is selected (via Q5 NAND) - if (offset == NEC_UCOM4_PORTA && m_inp_mux == 0) - { - // todo.. - return m_inp_matrix[4]->read(); - } - else - return read_inputs(4) >> (offset*4) & 0xf; -} - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -static INPUT_PORTS_START( tb303 ) - PORT_START("IN.0") // H0 port A/B - PORT_CONFNAME( 0x03, 0x03, "Mode" ) - PORT_CONFSETTING( 0x03, "Track Write" ) - PORT_CONFSETTING( 0x02, "Track Play" ) - PORT_CONFSETTING( 0x00, "Pattern Play" ) - PORT_CONFSETTING( 0x01, "Pattern Write" ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("DEL C#") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("INS D#") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("1 C") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("2 D") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("3 E") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_NAME("4 F") - - PORT_START("IN.1") // H1 port A/B - PORT_CONFNAME( 0x07, 0x00, "Track / Patt.Group" ) - PORT_CONFSETTING( 0x00, "1 / I" ) - PORT_CONFSETTING( 0x01, "2 / I" ) - PORT_CONFSETTING( 0x02, "3 / II" ) - PORT_CONFSETTING( 0x03, "4 / II" ) - PORT_CONFSETTING( 0x04, "5 / III" ) - PORT_CONFSETTING( 0x05, "6 / III" ) - PORT_CONFSETTING( 0x06, "7 / IV" ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_NAME("5 G") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_NAME("6 A") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_NAME("7 B") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_NAME("8 C") - - PORT_START("IN.2") // H2 port A/B - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Pattern Clear") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Function") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Pitch Mode") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Time Mode") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_NAME("9 Step") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_NAME("0 3n") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("100 A") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("200 B") - - PORT_START("IN.3") // H3 port B - PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("F#") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("G#") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("A#") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Back") - - PORT_START("IN.4") // H=0 port A - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Run/Stop") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Tap") - PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -void tb303_state::machine_start() -{ - hh_ucom4_state::machine_start(); - - // zerofill - memset(m_ram, 0, sizeof(m_ram)); - m_ram_address = 0; - m_ram_ce = false; - m_ram_we = false; - - // register for savestates - save_item(NAME(m_ram)); - save_item(NAME(m_ram_address)); - save_item(NAME(m_ram_ce)); - save_item(NAME(m_ram_we)); -} - -static MACHINE_CONFIG_START( tb303, tb303_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D650, TB303_T2_CLOCK_HZ) - MCFG_UCOM4_READ_A_CB(READ8(tb303_state, input_r)) - MCFG_UCOM4_READ_B_CB(READ8(tb303_state, input_r)) - MCFG_UCOM4_READ_C_CB(READ8(tb303_state, ram_r)) - MCFG_UCOM4_WRITE_C_CB(WRITE8(tb303_state, ram_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(tb303_state, ram_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(tb303_state, ram_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(tb303_state, ram_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(tb303_state, switch_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(tb303_state, switch_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(tb303_state, strobe_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("t3_clock", tb303_state, t3_clock, TB303_T3_CLOCK) - MCFG_TIMER_START_DELAY(TB303_T3_CLOCK) - MCFG_TIMER_DRIVER_ADD("t3_off", tb303_state, t3_off) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_tb303) - - /* no video! */ - - /* sound hardware */ - // discrete... -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( tb303 ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "d650c-133.ic8", 0x0000, 0x0800, CRC(268a8d8b) SHA1(7a4236b2bc9a5cd4c80c63ca1a193e03becfcb4c) ) -ROM_END - - -CONS( 1982, tb303, 0, 0, tb303, tb303, driver_device, 0, "Roland", "TB-303", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/tdv2324.c b/src/mess/drivers/tdv2324.c deleted file mode 100644 index 62eafe4951a..00000000000 --- a/src/mess/drivers/tdv2324.c +++ /dev/null @@ -1,349 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder,Jonathan Gevaryahu -/* - - Tandberg TDV2324 - - Skeleton driver - By Curt Coder with some work by Lord Nightmare - - Status: - * Main cpu is currently hacked to read i/o port 0xE6 as 0x10; - it then seems to copy code to a ram area then jumps there - (there may be some sort of overlay/banking mess going on to allow full 64kb of ram) - The cpu gets stuck reading i/o port 0x30 in a loop. - - interrupts and sio lines are not hooked up - * Sub cpu does a bunch of unknown i/o accesses and also tries to - sequentially read chunk of address space which it never writes to; - this seems likely to be a shared ram or i/o mapped area especially since it seems - to write to i/o port 0x60 before trying to read there. - - interrupts and sio lines are not hooked up - * Fdc cpu starts, does a rom checksum (which passes) and tests a ram area - - - Board Notes: - Mainboard (pictures P1010036 & P1010038) - *28-pin: D27128, L4267096S,...(eprom, occluded by sticker: "965268 1", character set) - *40-pin: TMS9937NL, DB 336, ENGLAND (VTAC Video Chip) - *40-pin: P8085AH-2, F4265030, C INTEL '80 (cpus, there are 2 of these) - *28-pin: JAPAN 8442, 00009SS0, HN4827128G-25 (eprom, sticker: "962107") - *22-pin: ER3400, GI 8401HHA (EAROM) - * -pin: MOSTEK C 8424, MK3887N-4 (Z80 Serial I/O Controller) - *20-pin: (pal, sticker: "961420 0") - *24-pin: D2716, L3263271, INTEL '77 (eprom, sticker: "962058 1") - *3 tiny 16-pins which look socketed (proms) - *+B8412, DMPAL10L8NC - *PAL... (can't remove the sticker to read the rest since there's electrical components soldered above the chip) - *Am27S21DC, 835IDmm - *AM27S13DC, 8402DM (x2) - *TBP28L22N, GERMANY 406 A (x2) - *PAL16L6CNS, 8406 - - FD/HD Interface Board P/N 962013 Rev14 (pictures P1010031 & P1010033) - *28-pin: TMS, 2764JL-25, GHP8414 (@U15, labeled "962014 // -4-", fdc cpu rom) - *40-pin: MC68B02P, R1H 8340 (fdc cpu) - *40-pin: WDC '79, FD1797PL-02, 8342 16 (fdc chip) - *14-pin: MC4024P, MG 8341 (dual voltage controlled multivibrator) - *24-pin: TMM2016AP-12 (@U14 and @U80, 120ns 2kx8 SRAM) - - Keyboard: - *40-pin: NEC D8035LC (mcs-48 cpu) - *24-pin: NEC D2716 (eprom) - - Main CPU: - - PIT, SIO - - Sub CPU: - - PIC, PIT, VTAC - -*/ -/* -'subcpu' (17CD): unmapped i/o memory write to 23 = 36 & FF -'subcpu' (17D1): unmapped i/o memory write to 23 = 76 & FF -'subcpu' (17D5): unmapped i/o memory write to 23 = B6 & FF -'subcpu' (17DB): unmapped i/o memory write to 20 = 1A & FF -'subcpu' (17DE): unmapped i/o memory write to 20 = 00 & FF -'subcpu' (17E0): unmapped i/o memory write to 3E = 00 & FF -'subcpu' (17E2): unmapped i/o memory write to 3A = 00 & FF -'subcpu' (17E6): unmapped i/o memory write to 30 = 74 & FF -'subcpu' (17EA): unmapped i/o memory write to 31 = 7F & FF -'subcpu' (17EE): unmapped i/o memory write to 32 = 6D & FF -'subcpu' (17F2): unmapped i/o memory write to 33 = 18 & FF -'subcpu' (17F6): unmapped i/o memory write to 34 = 49 & FF -'subcpu' (17FA): unmapped i/o memory write to 35 = 20 & FF -'subcpu' (17FE): unmapped i/o memory write to 36 = 18 & FF -'subcpu' (1801): unmapped i/o memory write to 3C = 00 & FF -'subcpu' (1803): unmapped i/o memory write to 3C = 00 & FF -'subcpu' (1805): unmapped i/o memory write to 3E = 00 & FF -'subcpu' (0884): unmapped i/o memory write to 10 = 97 & FF -'subcpu' (0888): unmapped i/o memory write to 10 = 96 & FF - -'fdccpu' (E004): unmapped program memory read from 3C05 & FF 0011 1100 0000 0101 -'fdccpu' (E007): unmapped program memory read from C000 & FF 1100 0000 0000 0000 -'fdccpu' (E00A): unmapped program memory read from A000 & FF 1010 0000 0000 0000 -'fdccpu' (E012): unmapped program memory write to F000 = D0 & FF 1111 0000 0000 0000 = 1101 0000 -'fdccpu' (E015): unmapped program memory read from 3801 & FF 0011 1000 0000 0001 -'fdccpu' (E018): unmapped program memory read from 3C06 & FF 0011 1100 0000 0110 -'fdccpu' (E01B): unmapped program memory read from 3C04 & FF 0011 1100 0000 0100 - -'fdccpu' (E070): unmapped program memory write to 2101 = 01 & FF -'fdccpu' (E07C): unmapped program memory read from 6000 & FF -'fdccpu' (E07F): unmapped program memory read from 380D & FF -'fdccpu' (E082): unmapped program memory read from 380F & FF -'fdccpu' (E085): unmapped program memory read from 3803 & FF -'fdccpu' (E08B): unmapped program memory write to 6000 = 08 & FF -'fdccpu' (E08E): unmapped program memory write to 8000 = 08 & FF -'fdccpu' (E091): unmapped program memory write to 6000 = 00 & FF -'fdccpu' (E099): unmapped program memory write to F800 = 55 & FF -... -*/ - - - -#include "includes/tdv2324.h" - - -READ8_MEMBER( tdv2324_state::tdv2324_main_io_30 ) -{ - return 0xff; -} - -// Not sure what this is for, i/o read at 0xE6 on maincpu, post fails if it does not return bit 4 set -READ8_MEMBER( tdv2324_state::tdv2324_main_io_e6 ) -{ - return 0x10; // TODO: this should actually return something meaningful, for now is enough to pass early boot test -} - -WRITE8_MEMBER( tdv2324_state::tdv2324_main_io_e2 ) -{ - printf("%c\n", data); -} - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( tdv2324_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( tdv2324_mem, AS_PROGRAM, 8, tdv2324_state ) - AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x0800) AM_ROM AM_REGION(P8085AH_0_TAG, 0) - /* when copying code to 4000 area it runs right off the end of rom; - * I'm not sure if its supposed to mirror or read as open bus */ -// AM_RANGE(0x4000, 0x5fff) AM_RAM // 0x4000 has the boot code copied to it, 5fff and down are the stack -// AM_RANGE(0x6000, 0x6fff) AM_RAM // used by the relocated boot code; shared? - AM_RANGE(0x0800, 0xffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( tdv2324_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( tdv2324_io, AS_IO, 8, tdv2324_state ) - //ADDRESS_MAP_GLOBAL_MASK(0xff) - /* 0x30 is read by main code and if high bit isn't set at some point it will never get anywhere */ - /* e0, e2, e8, ea are written to */ - /* 30, e6 and e2 are readable */ - AM_RANGE(0x30, 0x30) AM_READ(tdv2324_main_io_30) -// AM_RANGE(0xe2, 0xe2) AM_WRITE(tdv2324_main_io_e2) console output - AM_RANGE(0xe6, 0xe6) AM_READ(tdv2324_main_io_e6) -// AM_RANGE(0x, 0x) AM_DEVREADWRITE(P8253_5_0_TAG, pit8253_device, read, write) -// AM_RANGE(0x, 0x) AM_DEVREADWRITE(MK3887N4_TAG, z80dart_device, ba_cd_r, ba_cd_w) -// AM_RANGE(0x, 0x) AM_DEVREADWRITE(P8259A_TAG, pic8259_device, read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( tdv2324_sub_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( tdv2324_sub_mem, AS_PROGRAM, 8, tdv2324_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION(P8085AH_1_TAG, 0) - AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x5000, 0x53ff) AM_RAM // EAROM - AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( tdv2324_sub_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( tdv2324_sub_io, AS_IO, 8, tdv2324_state ) - //ADDRESS_MAP_GLOBAL_MASK(0xff) - /* 20, 23, 30-36, 38, 3a, 3c, 3e, 60, 70 are written to */ - AM_RANGE(0x20, 0x23) AM_DEVREADWRITE(P8253_5_1_TAG, pit8253_device, read, write) - AM_RANGE(0x30, 0x3f) AM_DEVREADWRITE(TMS9937NL_TAG, tms9927_device, read, write) // TODO: this is supposed to be a 9937, which is not quite the same as 9927 -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( tdv2324_fdc_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( tdv2324_fdc_mem, AS_PROGRAM, 8, tdv2324_state ) - // the following two are probably enabled/disabled via the JP2 jumper block next to the fdc cpu - //AM_RANGE(0x0000, 0x001f) AM_RAM // on-6802-die ram (optionally battery backed) - //AM_RANGE(0x0020, 0x007f) AM_RAM // on-6802-die ram - AM_RANGE(0x0000, 0x07ff) AM_RAM // TMM2016AP-12 @ U14, tested with A5,5A pattern - //AM_RANGE(0x1000, 0x17ff) AM_RAM // TMM2016AP-12 @ U80, address is wrong - // the 3xxx area appears to be closely involved in fdc or other i/o - // in particular, reads from 30xx, 38xx, 3Cxx may be actually writes to certain fdc registers with data xx? - // 0x2101 is something writable - // 0x8000 is either a read from reg 0 (status reg) of the FD1797, OR a read from some sort of status from other cpus - // 0x8000 can also be written to - // 0x6000 can also be read from and written to - // Somewhere in here, the FDC chip and the hard disk interface live - AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION(MC68B02P_TAG, 0) // rom "962014 // -4-" @U15 -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( tdv2324 ) -//------------------------------------------------- - -static INPUT_PORTS_START( tdv2324 ) -INPUT_PORTS_END - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -void tdv2324_state::video_start() -{ -} - - -UINT32 tdv2324_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// SLOT_INTERFACE( tdv2324_floppies ) -//------------------------------------------------- - -static SLOT_INTERFACE_START( tdv2324_floppies ) - SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) -SLOT_INTERFACE_END - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( tdv2324 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( tdv2324, tdv2324_state ) - // basic system hardware - MCFG_CPU_ADD(P8085AH_0_TAG, I8085A, 8700000/2) // ??? - MCFG_CPU_PROGRAM_MAP(tdv2324_mem) - MCFG_CPU_IO_MAP(tdv2324_io) - - MCFG_CPU_ADD(P8085AH_1_TAG, I8085A, 8000000/2) // ??? - MCFG_CPU_PROGRAM_MAP(tdv2324_sub_mem) - MCFG_CPU_IO_MAP(tdv2324_sub_io) - - MCFG_CPU_ADD(MC68B02P_TAG, M6802, 8000000/2) // ??? - MCFG_CPU_PROGRAM_MAP(tdv2324_fdc_mem) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DRIVER(tdv2324_state, screen_update) - MCFG_SCREEN_SIZE(800, 400) - MCFG_SCREEN_VISIBLE_AREA(0, 800-1, 0, 400-1) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_DEVICE_ADD(TMS9937NL_TAG, TMS9927, XTAL_25_39836MHz) - MCFG_TMS9927_CHAR_WIDTH(8) - - // devices - MCFG_PIC8259_ADD(P8259A_TAG, NULL, VCC, NULL) - - MCFG_DEVICE_ADD(P8253_5_0_TAG, PIT8253, 0) - - MCFG_DEVICE_ADD(P8253_5_1_TAG, PIT8253, 0) - - MCFG_Z80SIO2_ADD(MK3887N4_TAG, 8000000/2, 0, 0, 0, 0) - - MCFG_FD1797_ADD(FD1797PL02_TAG, 8000000/4) - MCFG_FLOPPY_DRIVE_ADD(FD1797PL02_TAG":0", tdv2324_floppies, "8dsdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1797PL02_TAG":1", tdv2324_floppies, "8dsdd", floppy_image_device::default_floppy_formats) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "tdv2324") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( tdv2324 ) -//------------------------------------------------- - -ROM_START( tdv2324 ) - ROM_REGION( 0x800, P8085AH_0_TAG, 0 ) - ROM_LOAD( "962058-1.21g", 0x000, 0x800, CRC(3771aece) SHA1(36d3f03235f327d6c8682e5c167aed6dddfaa6ec) ) - - ROM_REGION( 0x4000, P8085AH_1_TAG, 0 ) - ROM_LOAD( "962107-1.12c", 0x0000, 0x4000, CRC(29c1a139) SHA1(f55fa9075fdbfa6a3e94e5120270179f754d0ea5) ) - - ROM_REGION( 0x2000, MC68B02P_TAG, 0 ) - ROM_LOAD( "962014-4.13c", 0x0000, 0x2000, CRC(d01c32cd) SHA1(1f00f5f5ff0c035eec6af820b5acb6d0c207b6db) ) - - ROM_REGION( 0x800, "keyboard_8035", 0 ) - ROM_LOAD( "961294-3.u8", 0x000, 0x800, NO_DUMP ) - - ROM_REGION( 0x4000, "chargen", 0 ) - ROM_LOAD( "965268-1.4g", 0x0000, 0x4000, CRC(7222a85f) SHA1(e94074b68d90698734ab1fc38d156407846df47c) ) - - ROM_REGION( 0x200, "proms", 0 ) - ROM_LOAD( "961487-1.3f", 0x0000, 0x0200, NO_DUMP ) - ROM_LOAD( "prom.4f", 0x0000, 0x0200, NO_DUMP ) - ROM_LOAD( "prom.8g", 0x0000, 0x0200, NO_DUMP ) - ROM_LOAD( "prom.10f", 0x0000, 0x0200, NO_DUMP ) - ROM_LOAD( "961420-0.16f", 0x0000, 0x0200, NO_DUMP ) - ROM_LOAD( "962103-0.15g", 0x0000, 0x0200, NO_DUMP ) - - ROM_REGION( 0x200, "plds", 0 ) - ROM_LOAD( "962108-0.2g", 0x0000, 0x0200, NO_DUMP ) - ROM_LOAD( "pal.12d", 0x0000, 0x0200, NO_DUMP ) - ROM_LOAD( "pal.13d", 0x0000, 0x0200, NO_DUMP ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, tdv2324, 0, 0, tdv2324, tdv2324, driver_device, 0, "Tandberg", "TDV 2324", MACHINE_NOT_WORKING|MACHINE_NO_SOUND) diff --git a/src/mess/drivers/tec1.c b/src/mess/drivers/tec1.c deleted file mode 100644 index bfd701676f9..00000000000 --- a/src/mess/drivers/tec1.c +++ /dev/null @@ -1,463 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - TEC-1 driver, written by Robbbert in April, 2009 for MESS. - -The TEC-1 was a single-board "computer" described in Talking Electronics -magazine, issues number 10 and 11. Talking Electronics do not have dates on -their issues, so the date is uncertain, although 1984 seems a reasonable -guess. Talking Electronics operated from Cheltenham, a suburb of Melbourne. - -The hardware is quite simple, consisting of a Z80 cpu, 2x 8212 8-bit latch, -74C923 keyboard scanner, 20 push-button keys, 6-digit LED display, a speaker, -a 2k EPROM and sundry parts. - -The cpu speed could be adjusted by using a potentiometer, the range being -250 kHz to 2MHz. This is a simple method of adjusting a game's difficulty. - -We emulate the original version. Later enhancements included more RAM, speech -synthesis and various attachments, however I have no information on these. - -Pasting: - 0-F : as is - + (inc) : ^ - - (dec) : V - AD : - - GO : X - -Keys: -0 to 9, A to F are on the key of the same name. -AD (input an address) is the '-' key. -+ and - (increment / decrement address) are the up and down-arrow keys. -GO (execute program at current address) is the X key. -SHIFT - later monitor versions utilised an extra shift button. Hold - it down and press another key (use Left Shift). - -Whenever a program listing mentions RESET, do a Soft Reset. - -Each key causes a beep to be heard. You may need to press more than once -to get it to register. - -Inbuilt games - press the following sequence of keys: -- Welcome: RESET D 1 + 0 2 AD 0 2 7 0 GO GO (Paste: D1^02 -0270XX) -- Nim: RESET AD 3 E 0 GO GO (Paste: -3E0XX) -- Invaders: RESET AD 3 2 0 GO GO (Paste: -320XX) -- Luna Lander: RESET AD 4 9 0 GO GO (Paste: -490XX) - -Thanks to Chris Schwartz who dumped his ROM for me way back in the old days. -It's only taken 25 years to get around to emulating it... - - -Differences between tec1 and tecjmon: - -On the tec1 a keypress is indicated by an NMI from the 74C923; but on -the jmon it sets bit 6 of port 3 low instead. The NMI code is simply -a 'retn' in the jmon rom, so we can use the same code. -The jmon includes a cassette interface, a serial input connection, -and an optional LCD, but the games of the tec1 have been removed. - - -ToDo: -- After a Soft Reset, pressing keys can crash the emulation. -- The 74C923 code may need to be revisited to improve keyboard response. - Sometimes have to press a key a few times before it registers. -- The 10ms debounce is not emulated. - - -JMON ToDo: -- Add LCD display (2 rows by 16 characters) - - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "tec1.lh" - - -class tec1_state : public driver_device -{ -public: - tec1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cass(*this, "cassette"), - m_wave(*this, WAVE_TAG), - m_key_pressed(0), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_shift(*this, "SHIFT") - { } - - required_device m_maincpu; - required_device m_speaker; - optional_device m_cass; - optional_device m_wave; - bool m_key_pressed; - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - required_ioport m_io_line3; - required_ioport m_io_shift; - emu_timer *m_kbd_timer; - DECLARE_READ8_MEMBER( tec1_kbd_r ); - DECLARE_READ8_MEMBER( latch_r ); - DECLARE_WRITE8_MEMBER( tec1_digit_w ); - DECLARE_WRITE8_MEMBER( tecjmon_digit_w ); - DECLARE_WRITE8_MEMBER( tec1_segment_w ); - UINT8 m_kbd; - UINT8 m_segment; - UINT8 m_digit; - UINT8 m_kbd_row; - UINT8 m_refresh[6]; - UINT8 tec1_convert_col_to_bin( UINT8 col, UINT8 row ); - virtual void machine_reset(); - virtual void machine_start(); - TIMER_CALLBACK_MEMBER(tec1_kbd_callback); -}; - - - - -/*************************************************************************** - - Display - -***************************************************************************/ - -WRITE8_MEMBER( tec1_state::tec1_segment_w ) -{ -/* d7 segment d - d6 segment e - d5 segment c - d4 segment dot - d3 segment b - d2 segment g - d1 segment f - d0 segment a */ - - m_segment = BITSWAP8(data, 4, 2, 1, 6, 7, 5, 3, 0); -} - -WRITE8_MEMBER( tec1_state::tec1_digit_w ) -{ -/* d7 speaker - d6 not used - d5 data digit 1 - d4 data digit 2 - d3 address digit 1 - d2 address digit 2 - d1 address digit 3 - d0 address digit 4 */ - - m_speaker->level_w(BIT(data, 7)); - - m_digit = data & 0x3f; -} - -WRITE8_MEMBER( tec1_state::tecjmon_digit_w ) -{ -/* d7 speaker & cassout - d6 not used - d5 data digit 1 - d4 data digit 2 - d3 address digit 1 - d2 address digit 2 - d1 address digit 3 - d0 address digit 4 */ - - m_speaker->level_w(BIT(data, 7)); - m_cass->output(BIT(data, 7) ? -1.0 : +1.0); - m_digit = data & 0x3f; -} - - -/*************************************************************************** - - Keyboard - -***************************************************************************/ - -READ8_MEMBER( tec1_state::latch_r ) -{ -// bit 7 - cass in ; bit 6 low = key pressed - UINT8 data = (m_key_pressed) ? 0 : 0x40; - - if (m_cass->input() > 0.03) - data |= 0x80; - - return data; -} - - -READ8_MEMBER( tec1_state::tec1_kbd_r ) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return m_kbd | m_io_shift->read(); -} - -UINT8 tec1_state::tec1_convert_col_to_bin( UINT8 col, UINT8 row ) -{ - UINT8 data = row; - - if (BIT(col, 1)) - data |= 4; - else - if (BIT(col, 2)) - data |= 8; - else - if (BIT(col, 3)) - data |= 12; - else - if (BIT(col, 4)) - data |= 16; - - return data; -} - -TIMER_CALLBACK_MEMBER(tec1_state::tec1_kbd_callback) -{ - UINT8 i; - - // Display the digits. Blank any digits that haven't been refreshed for a while. - // This will fix the problem reported by a user. - for (i = 0; i < 6; i++) - { - if (BIT(m_digit, i)) - { - m_refresh[i] = 1; - output_set_digit_value(i, m_segment); - } - else - if (m_refresh[i] == 0x80) - { - output_set_digit_value(i, 0); - m_refresh[i] = 0; - } - else - if (m_refresh[i]) - m_refresh[i]++; - } - - // 74C923 4 by 5 key encoder. - - /* Look at old row */ - if (m_kbd_row == 0) - i = m_io_line0->read(); - else - if (m_kbd_row == 1) - i = m_io_line1->read(); - else - if (m_kbd_row == 2) - i = m_io_line2->read(); - else - if (m_kbd_row == 3) - i = m_io_line3->read(); - - /* if previous key is still held, bail out */ - if (i) - if (tec1_convert_col_to_bin(i, m_kbd_row) == m_kbd) - return; - - m_kbd_row++; - m_kbd_row &= 3; - - /* Look at a new row */ - if (m_kbd_row == 0) - i = m_io_line0->read(); - else - if (m_kbd_row == 1) - i = m_io_line1->read(); - else - if (m_kbd_row == 2) - i = m_io_line2->read(); - else - if (m_kbd_row == 3) - i = m_io_line3->read(); - - /* see if a key pressed */ - if (i) - { - m_kbd = tec1_convert_col_to_bin(i, m_kbd_row); - m_maincpu->set_input_line(INPUT_LINE_NMI, HOLD_LINE); - m_key_pressed = TRUE; - } - else - m_key_pressed = FALSE; -} - - -/*************************************************************************** - - Machine - -***************************************************************************/ - -void tec1_state::machine_start() -{ - m_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tec1_state::tec1_kbd_callback),this)); - m_kbd_timer->adjust( attotime::zero, 0, attotime::from_hz(500) ); -} - -void tec1_state::machine_reset() -{ - m_kbd = 0; -} - - - -/*************************************************************************** - - Address Map - -***************************************************************************/ - -static ADDRESS_MAP_START( tec1_map, AS_PROGRAM, 8, tec1_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3fff) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0x0fff) AM_RAM // on main board - AM_RANGE(0x1000, 0x3fff) AM_RAM // expansion -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tec1_io, AS_IO, 8, tec1_state ) - ADDRESS_MAP_GLOBAL_MASK(0x07) - AM_RANGE(0x00, 0x00) AM_READ(tec1_kbd_r) - AM_RANGE(0x01, 0x01) AM_WRITE(tec1_digit_w) - AM_RANGE(0x02, 0x02) AM_WRITE(tec1_segment_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( tecjmon_map, AS_PROGRAM, 8, tec1_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3fff) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0x37ff) AM_RAM - AM_RANGE(0x3800, 0x3fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tecjmon_io, AS_IO, 8, tec1_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(tec1_kbd_r) - AM_RANGE(0x01, 0x01) AM_WRITE(tecjmon_digit_w) - AM_RANGE(0x02, 0x02) AM_WRITE(tec1_segment_w) - AM_RANGE(0x03, 0x03) AM_READ(latch_r) - //AM_RANGE(0x04, 0x04) AM_WRITE(lcd_en_w) - //AM_RANGE(0x84, 0x84) AM_WRITE(lcd_2nd_w) -ADDRESS_MAP_END - - -/************************************************************************** - - Keyboard Layout - -***************************************************************************/ - -static INPUT_PORTS_START( tec1 ) - PORT_START("LINE0") /* KEY ROW 0 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - - PORT_START("LINE1") /* KEY ROW 1 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - - PORT_START("LINE2") /* KEY ROW 2 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("LINE3") /* KEY ROW 3 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_START("SHIFT") - PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -/*************************************************************************** - - Machine driver - -***************************************************************************/ - -static MACHINE_CONFIG_START( tec1, tec1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 1000000) /* speed can be varied between 250kHz and 2MHz */ - MCFG_CPU_PROGRAM_MAP(tec1_map) - MCFG_CPU_IO_MAP(tec1_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_tec1) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( tecjmon, tec1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz / 2) - MCFG_CPU_PROGRAM_MAP(tecjmon_map) - MCFG_CPU_IO_MAP(tecjmon_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_tec1) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver - -***************************************************************************/ - -ROM_START(tec1) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS(0, "mon1", "MON1") - ROMX_LOAD("mon1.rom", 0x0000, 0x0800, CRC(b3390c36) SHA1(18aabc68d473206b7fc4e365c6b57a4e218482c3), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "mon1b", "MON1B") - ROMX_LOAD("mon1b.rom", 0x0000, 0x0800, CRC(60daea3c) SHA1(383b7e7f02e91fb18c87eb03c5949e31156771d4), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "mon2", "MON2") - ROMX_LOAD("mon2.rom", 0x0000, 0x0800, CRC(082fd7e7) SHA1(7659add30ca22b15a03d1cbac0892a5c25e47ecd), ROM_BIOS(3)) -ROM_END - -ROM_START(tecjmon) - ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF) - ROM_LOAD("jmon.rom", 0x0000, 0x0800, CRC(202c47a2) SHA1(701588ec5640d633d90d94b2ccd6f65422e19a70) ) - ROM_LOAD("util.rom", 0x3800, 0x0800, CRC(7c19700d) SHA1(dc5b3ade66bb11c54430056966ed99cdd299d82b) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1984, tec1, 0, 0, tec1, tec1, driver_device, 0, "Talking Electronics magazine", "TEC-1" , 0 ) -COMP( 1984, tecjmon, tec1, 0, tecjmon, tec1, driver_device, 0, "Talking Electronics magazine", "TEC-1A with JMON" , 0 ) diff --git a/src/mess/drivers/tecnbras.c b/src/mess/drivers/tecnbras.c deleted file mode 100644 index 5e1b7870e38..00000000000 --- a/src/mess/drivers/tecnbras.c +++ /dev/null @@ -1,133 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders: Felipe Sanches -/*************************************************************************** - - TECNBRAS dot matrix display (70x7 pixels) - Driver by Felipe Correa da Silva Sanches - - The display is composed of 14 blocks of 5x7 LEDs - - These LEDs are driven by several 74xx chips: - * one 74138 - * several 74164 and ULN2003 chips - - Changelog: - - 2014 JUN 23 [Felipe Sanches]: - * Initial driver skeleton - -================ -*/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "tecnbras.lh" - -class tecnbras_state : public driver_device -{ -public: - tecnbras_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - - DECLARE_WRITE8_MEMBER(set_x_position_w); - DECLARE_WRITE8_MEMBER(print_column_w); - -// DECLARE_WRITE8_MEMBER(tecnbras_io_w); -// DECLARE_READ8_MEMBER(tecnbras_io_r); - DECLARE_DRIVER_INIT(tecnbras); -private: - int m_xcoord; - char m_digit[14][7]; - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(i80c31_prg, AS_PROGRAM, 8, tecnbras_state) - AM_RANGE(0x0000, 0x7FFF) AM_ROM - AM_RANGE(0x8000, 0xFFFF) AM_RAM -ADDRESS_MAP_END - -#define DMD_OFFSET 24 //This is a guess. We should verify the real hardware behaviour -static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, tecnbras_state) - AM_RANGE(0x0100+DMD_OFFSET, 0x0145+DMD_OFFSET) AM_WRITE(set_x_position_w) - AM_RANGE(0x06B8, 0x06BC) AM_WRITE(print_column_w) - AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_NOP /*buzzer ?*/ -ADDRESS_MAP_END - -DRIVER_INIT_MEMBER( tecnbras_state, tecnbras ) -{ - m_xcoord = 0; - for (int x=0; x<14; x++){ - for (int y=0; y<7; y++){ - m_digit[x][y] = 0; - } - } -} - -WRITE8_MEMBER(tecnbras_state::set_x_position_w) -{ - m_xcoord = offset; -} - -WRITE8_MEMBER(tecnbras_state::print_column_w) -{ - int x = m_xcoord + offset; - for (int i=0; i<7; i++){ - if((x/5) < ARRAY_LENGTH(m_digit)){ - m_digit[x/5][i] &= ~(1 << (x%5)); - m_digit[x/5][i] |= BIT(data, 7-i) ? (1 << (x%5)) : 0; - output_set_indexed_value("dmd_", (x/5)*7 + i, 0x1F & m_digit[x/5][i]); - } - } -} - -void tecnbras_state::machine_start() -{ -/* - for (int x=0; x<14; x++){ - for (int y=0; y<7; y++){ - output_set_indexed_value("dmd_", x*7 + y, y); - } - } -*/ -} - -void tecnbras_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( tecnbras, tecnbras_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80C31, XTAL_12MHz) /* verified on pcb */ - MCFG_CPU_PROGRAM_MAP(i80c31_prg) - MCFG_CPU_IO_MAP(i80c31_io) - -/* TODO: Add an I2C RTC (Phillips PCF8583P) - pin 6 (SCL): cpu T0/P3.4 (pin 14) - pin 5 (SDA): cpu T1/P3.5 (pin 15) -*/ - -/* - TODO: Add a speaker - CPU P1.0 (pin 1) -*/ - -/* - TODO: Add a communications port to receive commands from the remote control -*/ - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_tecnbras) - -MACHINE_CONFIG_END - -ROM_START( tecnbras ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "tecnbras.u2", 0x0000, 0x8000, CRC(1a1e18fc) SHA1(8907e72f0356a2e2e1097dabac6d6b0b3d717f85) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 200?, tecnbras, 0, 0, tecnbras, 0, tecnbras_state, tecnbras, "Tecnbras", "Dot Matrix Display (70x7 pixels)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/tek405x.c b/src/mess/drivers/tek405x.c deleted file mode 100644 index 767d5399d8d..00000000000 --- a/src/mess/drivers/tek405x.c +++ /dev/null @@ -1,1252 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Tektronix 4051/4052A - - Skeleton driver. - - http://www.electronixandmore.com/articles/teksystem.html - -****************************************************************************/ - -/* - - TODO: - - - bank switch - - keyboard - - video (persistent vector display) - - joystick - - magnetic tape storage (3M 300) - - communications backpack - - 4051E01 ROM expander - -*/ - - -#include "includes/tek405x.h" - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -enum { - LBS_RBC = 0, // ROM Bank Control - LBS_BSOFL, // Bank Switch Overflow (Select Overflow ROMs) - LBS_BSCOM, // Bank Switch Communication (Select Communication ROMs) - LBS_INVALID, - LBS_BS_L, // Bank Switch Left (Select Left ROM Pack) - LBS_BS_R, // Bank Switch Right (Select Right ROM Pack) - LBS_BSX_L, // Bank Switch Expander (Select Left ROM Expander Unit) - LBS_BSX_R // Bank Switch Expander (Select Right ROM Expander Unit) -}; - - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// update_irq - -//------------------------------------------------- - -void tek4051_state::update_irq() -{ - int state = m_kb_pia_irqa | m_kb_pia_irqb | m_x_pia_irqa | m_x_pia_irqb | m_gpib_pia_irqa | m_gpib_pia_irqb | m_com_pia_irqa | m_com_pia_irqb | m_acia_irq; - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); -} - - -//------------------------------------------------- -// update_nmi - -//------------------------------------------------- - -void tek4051_state::update_nmi() -{ - int state = m_y_pia_irqa | m_y_pia_irqb | m_tape_pia_irqa | m_tape_pia_irqb; - - m_maincpu->set_input_line(INPUT_LINE_NMI, state); -} - - - -//************************************************************************** -// KEYBOARD -//************************************************************************** - -//------------------------------------------------- -// scan_keyboard - scan keyboard -//------------------------------------------------- - -void tek4051_state::scan_keyboard() -{ -} - - -//------------------------------------------------- -// TIMER_DEVICE_CALLBACK_MEMBER( keyboard_tick ) -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(tek4051_state::keyboard_tick) -{ - scan_keyboard(); -} - - - -//************************************************************************** -// MEMORY BANKING -//************************************************************************** - -//------------------------------------------------- -// bankswitch - -//------------------------------------------------- - -void tek4051_state::bankswitch(UINT8 data) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - //int d = data & 0x07; - int lbs = (data >> 3) & 0x07; - - switch (lbs) - { - case LBS_RBC: - program.install_rom(0x8800, 0xa7ff, m_rom->base() + 0x800); - break; - - case LBS_BSOFL: - program.install_rom(0x8800, 0xa7ff, m_bsofl_rom->base()); - break; - - case LBS_BSCOM: - program.install_rom(0x8800, 0xa7ff, m_bscom_rom->base()); - break; - - default: - program.unmap_readwrite(0x8800, 0xa7ff); - } -} - - -WRITE8_MEMBER( tek4051_state::lbs_w ) -{ - /* - - bit description - - 0 ROM Expander Slot Address - 1 ROM Expander Slot Address - 2 ROM Expander Slot Address - 3 Bank Switch - 4 Bank Switch - 5 Bank Switch - 6 - 7 - - */ - - logerror("LBS %02x\n", data); - - bankswitch(data); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( tek4051_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( tek4051_mem, AS_PROGRAM, 8, tek4051_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0x7fff) AM_RAM // optional RAM - AM_RANGE(0x8000, 0x877f) AM_ROM AM_REGION(MC6800_TAG, 0) - AM_RANGE(0x878c, 0x878f) AM_DEVREADWRITE(MC6820_Y_TAG, pia6821_device, read, write) - AM_RANGE(0x8794, 0x8797) AM_DEVREADWRITE(MC6820_X_TAG, pia6821_device, read, write) - AM_RANGE(0x8798, 0x879b) AM_DEVREADWRITE(MC6820_TAPE_TAG, pia6821_device, read, write) - AM_RANGE(0x87a8, 0x87ab) AM_DEVREADWRITE(MC6820_KB_TAG, pia6821_device, read, write) - AM_RANGE(0x87b0, 0x87b3) AM_DEVREADWRITE(MC6820_GPIB_TAG, pia6821_device, read, write) - AM_RANGE(0x87c0, 0x87c0) AM_MIRROR(0x03) AM_WRITE(lbs_w) -// AM_RANGE(0x87c0, 0x87c3) AM_DEVREADWRITE(MC6820_COM_TAG, pia6821_device, read, write) -// AM_RANGE(0x87c4, 0x87c4) AM_MIRROR(0x02) AM_DEVREADWRITE(MC6850_TAG, acia6850_device, status_r, control_w) -// AM_RANGE(0x87c5, 0x87c5) AM_MIRROR(0x02) AM_DEVREADWRITE(MC6850_TAG, acia6850_device, data_r, data_w) -// AM_RANGE(0x87c8, 0x87cb) XPC2 -// AM_RANGE(0x87cc, 0x87cf) XPC3 -// AM_RANGE(0x87d0, 0x87d3) XPC4 - AM_RANGE(0x8800, 0xa7ff) AM_ROM AM_REGION(MC6800_TAG, 0x800) - AM_RANGE(0xa800, 0xffff) AM_ROM AM_REGION(MC6800_TAG, 0x2800) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( tek4052_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( tek4052_mem, AS_PROGRAM, 8, tek4052_state ) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( tek4051 ) -//------------------------------------------------- - -static INPUT_PORTS_START( tek4051 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y11") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y12") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y13") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y14") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y15") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TTY LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) -INPUT_PORTS_END - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -void tek4051_state::video_start() -{ -} - - -void tek4052_state::video_start() -{ -} - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -READ8_MEMBER( tek4051_state::x_pia_pa_r ) -{ - /* - - bit description - - PA0 - PA1 - PA2 DRBUSY-0 - PA3 VPULSE-1 - PA4 - PA5 - PA6 - PA7 - - */ - - return 0; -} - -WRITE8_MEMBER( tek4051_state::x_pia_pa_w ) -{ - /* - - bit description - - PA0 X D/A - PA1 X D/A - PA2 - PA3 - PA4 ERASE-0 - PA5 COPY-0 - PA6 VECTOR-0 - PA7 VEN-1 - - */ -} - -WRITE8_MEMBER( tek4051_state::x_pia_pb_w ) -{ - /* - - bit description - - PB0 X D/A - PB1 X D/A - PB2 X D/A - PB3 X D/A - PB4 X D/A - PB5 X D/A - PB6 X D/A - PB7 X D/A - - */ -} - -WRITE_LINE_MEMBER( tek4051_state::adot_w ) -{ -} - -WRITE_LINE_MEMBER( tek4051_state::bufclk_w ) -{ -} - -WRITE_LINE_MEMBER( tek4051_state::x_pia_irqa_w ) -{ - m_x_pia_irqa = state; - update_irq(); -} - -WRITE_LINE_MEMBER( tek4051_state::x_pia_irqb_w ) -{ - m_x_pia_irqb = state; - update_irq(); -} - -READ8_MEMBER( tek4051_state::sa_r ) -{ - /* - - bit description - - PA0 SA0 - PA1 SA1 - PA2 SA2 - PA3 SA3 - PA4 SA4 - PA5 SA5 - PA6 SA6 - PA7 SA7 - - */ - - return 0; -} - -WRITE8_MEMBER( tek4051_state::y_pia_pa_w ) -{ - /* - - bit description - - PA0 Y D/A - PA1 Y D/A - PA2 Y CHAR D/A - PA3 Y CHAR D/A - PA4 Y CHAR D/A - PA5 X CHAR D/A - PA6 X CHAR D/A - PA7 X CHAR D/A - - */ -} - -WRITE8_MEMBER( tek4051_state::sb_w ) -{ - /* - - bit description - - PB0 SB0 - PB1 SB1 - PB2 SB2 - PB3 SB3 - PB4 SB4 - PB5 SB5 - PB6 SB6 - PB7 SB7 - - */ -} - -WRITE_LINE_MEMBER( tek4051_state::sot_w ) -{ -} - -WRITE_LINE_MEMBER( tek4051_state::y_pia_irqa_w ) -{ - m_y_pia_irqa = state; - update_nmi(); -} - -WRITE_LINE_MEMBER( tek4051_state::y_pia_irqb_w ) -{ - m_y_pia_irqb = state; - update_nmi(); -} - - -READ8_MEMBER( tek4051_state::kb_pia_pa_r ) -{ - /* - - bit description - - PA0 KC0-1 - PA1 KC1-1 - PA2 KC2-1 - PA3 KC3-1 - PA4 KC4-1 - PA5 KC5-1 - PA6 KC6-1 - PA7 TTY-0 - - */ - - UINT8 data = 0; - UINT8 special = m_special->read(); - - // keyboard column - data = m_kc; - - // TTY lock - data |= BIT(special, 3) << 7; - - return data; -} - -READ8_MEMBER( tek4051_state::kb_pia_pb_r ) -{ - /* - - bit description - - PB0 SHIFT-0 - PB1 CTRL-0 - PB2 - PB3 LOAD-0 - PB4 - PB5 - PB6 - PB7 - - */ - - UINT8 data = 0; - UINT8 special = m_special->read(); - - // shift - data |= (BIT(special, 0) & BIT(special, 1)); - - // ctrl - data |= BIT(special, 2) << 1; - - return data; -} - -WRITE8_MEMBER( tek4051_state::kb_pia_pb_w ) -{ - /* - - bit description - - PB0 - PB1 - PB2 - PB3 - PB4 EOI-1 - PB5 BREAK-1 - PB6 I/O-1 - PB7 BUSY-1/REN-0/SPEAKER - - */ - - // lamps - output_set_led_value(1, !BIT(data, 5)); - output_set_led_value(2, !BIT(data, 6)); - output_set_led_value(3, !BIT(data, 7)); - - // end or identify - m_gpib->eoi_w(!BIT(data, 4)); - - // speaker - m_speaker->level_w(!BIT(data, 7)); - - // remote enable - m_gpib->ren_w(!BIT(data, 7)); -} - -WRITE_LINE_MEMBER( tek4051_state::kb_halt_w ) -{ -} - -WRITE_LINE_MEMBER( tek4051_state::kb_pia_irqa_w ) -{ - m_kb_pia_irqa = state; - update_irq(); -} - -WRITE_LINE_MEMBER( tek4051_state::kb_pia_irqb_w ) -{ - m_kb_pia_irqb = state; - update_irq(); -} - - -READ8_MEMBER( tek4051_state::tape_pia_pa_r ) -{ - /* - - bit description - - PA0 DELAY OUT-1 - PA1 - PA2 TUTS-1 - PA3 SAFE-1 - PA4 SAFE-1 - PA5 JOYSTICK - PA6 FILFND-1 - PA7 JOYSTICK - - */ - - return 0; -} - -WRITE8_MEMBER( tek4051_state::tape_pia_pa_w ) -{ - /* - - bit description - - PA0 - PA1 LDCLK-1 - PA2 - PA3 - PA4 - PA5 XERR-1 - PA6 - PA7 YERR-1 - - */ -} - -WRITE8_MEMBER( tek4051_state::tape_pia_pb_w ) -{ - /* - - bit description - - PB0 WR-0 - PB1 FAST-1 - PB2 REV-1 - PB3 DRTAPE-0 - PB4 GICG-1 - PB5 FICG-1 - PB6 WENABLE-1 - PB7 FSENABLE-0 - - */ -} - -WRITE_LINE_MEMBER( tek4051_state::tape_pia_irqa_w ) -{ - m_tape_pia_irqa = state; - update_nmi(); -} - -WRITE_LINE_MEMBER( tek4051_state::tape_pia_irqb_w ) -{ - m_tape_pia_irqb = state; - update_nmi(); -} - - -WRITE8_MEMBER( tek4051_state::dio_w ) -{ - /* - - bit description - - PA0 DIO1-1 - PA1 DIO2-1 - PA2 DIO3-1 - PA3 DIO4-1 - PA4 DIO5-1 - PA5 DIO6-1 - PA6 DIO7-1 - PA7 DIO8-1 - - */ - - if (m_talk) - { - m_gpib->dio_w(data); - } -} - -READ8_MEMBER( tek4051_state::gpib_pia_pb_r ) -{ - /* - - bit description - - PB0 - PB1 - PB2 - PB3 - PB4 NRFD - PB5 SRQ-1 - PB6 DAV-1 - PB7 NDAC - - */ - - UINT8 data = 0; - - // service request - data |= m_gpib->srq_r() << 5; - - // data valid - data |= m_gpib->dav_r() << 6; - - if (!m_talk) - { - // not ready for data - data |= m_gpib->nrfd_r() << 4; - - // not data acknowledged - data |= m_gpib->ndac_r() << 7; - } - - return data; -} - -WRITE8_MEMBER( tek4051_state::gpib_pia_pb_w ) -{ - /* - - bit description - - PB0 EOI-1 - PB1 IFC-1 - PB2 - PB3 ATN-0 - PB4 NRFD - PB5 - PB6 - PB7 NDAC - - */ - - // end or identify - m_gpib->eoi_w(!BIT(data, 0)); - - // interface clear - m_gpib->ifc_w(!BIT(data, 1)); - - // attention - m_gpib->atn_w(BIT(data, 3)); - - if (m_talk) - { - // not ready for data - m_gpib->nrfd_w(!BIT(data, 4)); - - // not data acknowledged - m_gpib->ndac_w(!BIT(data, 7)); - } -} - -WRITE_LINE_MEMBER( tek4051_state::talk_w ) -{ - m_talk = state; - - if (!m_talk) - { - m_gpib->dio_w(0xff); - m_gpib->nrfd_w(1); - m_gpib->ndac_w(1); - } -} - -WRITE_LINE_MEMBER( tek4051_state::gpib_pia_irqa_w ) -{ - m_gpib_pia_irqa = state; - update_irq(); -} - -WRITE_LINE_MEMBER( tek4051_state::gpib_pia_irqb_w ) -{ - m_gpib_pia_irqb = state; - update_irq(); -} - - -WRITE8_MEMBER( tek4051_state::com_pia_pa_w ) -{ - /* - - bit description - - PA0 - PA1 - PA2 - PA3 Bank Switch Register - PA4 Bank Switch Register - PA5 Bank Switch Register - PA6 - PA7 - - */ - - bankswitch(data); -} - -READ8_MEMBER( tek4051_state::com_pia_pb_r ) -{ - /* - - bit description - - PB0 SRX - PB1 DTR - PB2 RTS - PB3 - PB4 - PB5 - PB6 - PB7 - - */ - - UINT8 data = 0; - - // data terminal ready - - // request to send - - return data; -} - -WRITE8_MEMBER( tek4051_state::com_pia_pb_w ) -{ - /* - - bit description - - PB0 - PB1 - PB2 - PB3 CTS - PB4 STXA-C - PB5 Baud Rate Select - PB6 Baud Rate Select - PB7 Baud Rate Select - - */ - - // clear to send - - // baud rate select - int osc = BIT(data, 7) ? 28160 : 38400; - int div = 1; - - switch ((data >> 5) & 0x03) - { - case 2: div = 4; break; - case 3: div = 2; break; - } - - m_acia_clock->set_unscaled_clock(osc); - m_acia_clock->set_clock_scale((double) 1 / div); -} - -WRITE_LINE_MEMBER( tek4051_state::com_pia_irqa_w ) -{ - m_com_pia_irqa = state; - update_irq(); -} - -WRITE_LINE_MEMBER( tek4051_state::com_pia_irqb_w ) -{ - m_com_pia_irqb = state; - update_irq(); -} - - -WRITE_LINE_MEMBER( tek4051_state::acia_irq_w ) -{ - m_acia_irq = state; - update_irq(); -} - -WRITE_LINE_MEMBER( tek4051_state::write_acia_clock ) -{ - m_acia->write_txc(state); - m_acia->write_rxc(state); -} - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( tek4051 ) -//------------------------------------------------- - -void tek4051_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - // configure RAM - switch (m_ram->size()) - { - case 8*1024: - program.unmap_readwrite(0x2000, 0x7fff); - break; - - case 16*1024: - program.unmap_readwrite(0x4000, 0x7fff); - break; - - case 24*1024: - program.unmap_readwrite(0x6000, 0x7fff); - break; - } - - // register for state saving -} - - -//------------------------------------------------- -// MACHINE_START( tek4052 ) -//------------------------------------------------- - -void tek4052_state::machine_start() -{ -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( tek4051 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( tek4051, tek4051_state ) - // basic machine hardware - MCFG_CPU_ADD(MC6800_TAG, M6800, XTAL_12_5MHz/15) - MCFG_CPU_PROGRAM_MAP(tek4051_mem) - - // video hardware - MCFG_VECTOR_ADD("vector") - MCFG_SCREEN_ADD(SCREEN_TAG, VECTOR) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_SIZE(1024, 780) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 780-1) - MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", tek4051_state, keyboard_tick, attotime::from_hz(XTAL_12_5MHz/15/4)) - - MCFG_DEVICE_ADD(MC6820_X_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(tek4051_state, x_pia_pa_r)) - // CB1 viewcause - MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, x_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, x_pia_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(tek4051_state, adot_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(tek4051_state, bufclk_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, x_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, x_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_Y_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(tek4051_state, sa_r)) - // CA1 rdbyte - // CB1 mdata - // CB2 fmark - MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, y_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, sb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(tek4051_state, sot_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, y_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, y_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_KB_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(tek4051_state, kb_pia_pa_r)) - MCFG_PIA_READPB_HANDLER(READ8(tek4051_state, kb_pia_pb_r)) - // CA1 key - MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, kb_pia_pb_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(tek4051_state, kb_halt_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, kb_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, kb_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_TAPE_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(tek4051_state, tape_pia_pa_r)) - // CA1 rmark - // CB1 lohole - // CA2 filfnd - // CB2 uphole - MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, tape_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, tape_pia_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, tape_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, tape_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_GPIB_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) - MCFG_PIA_READPB_HANDLER(READ8(tek4051_state, gpib_pia_pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, dio_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, gpib_pia_pb_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(tek4051_state, talk_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, gpib_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, gpib_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6820_COM_TAG, PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(tek4051_state, com_pia_pb_r)) - //CA1 - SRX (RS-232 pin 12) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(tek4051_state, com_pia_pa_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(tek4051_state, com_pia_pb_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(tek4051_state, com_pia_irqa_w)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(tek4051_state, com_pia_irqb_w)) - - MCFG_DEVICE_ADD(MC6850_TAG, ACIA6850, 0) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(tek4051_state, acia_irq_w)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 38400) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(tek4051_state, write_acia_clock)) - - MCFG_IEEE488_BUS_ADD() - MCFG_IEEE488_EOI_CALLBACK(DEVWRITELINE(MC6820_GPIB_TAG, pia6821_device, ca1_w)) - MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(MC6820_GPIB_TAG, pia6821_device, cb1_w)) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_RAM_EXTRA_OPTIONS("16K,24K,32K") - - // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_plain_slot, "tek4050_cart") - MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_plain_slot, "tek4050_cart") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( tek4052 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( tek4052, tek4052_state ) - // basic machine hardware - MCFG_CPU_ADD(AM2901A_TAG, M6800, 1000000) // should be 4x AM2901A + AM2911 - MCFG_CPU_PROGRAM_MAP(tek4052_mem) - - // video hardware - MCFG_VECTOR_ADD("vector") - MCFG_SCREEN_ADD(SCREEN_TAG, VECTOR) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_SIZE(1024, 780) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 780-1) - MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("64K") - - // cartridge - MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_plain_slot, "tek4050_cart") - MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_plain_slot, "tek4050_cart") - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list", "tek4052_cart") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( tek4054 ) -//------------------------------------------------- -/* -static MACHINE_CONFIG_START( tek4054, tek4052_state ) - MCFG_SCREEN_SIZE(4096, 3125) - MCFG_SCREEN_VISIBLE_AREA(0, 4096-1, 0, 3125-1) -MACHINE_CONFIG_END -*/ - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( tek4051 ) -//------------------------------------------------- - -ROM_START( tek4051 ) - ROM_REGION( 0x8000, MC6800_TAG, 0 ) - ROM_LOAD( "156-0659-xx.u585", 0x0000, 0x0800, CRC(0017ba54) SHA1(533bfacb2e698c1df88a00acce6df6a8c536239d) ) // -01 or -02 ? - ROM_LOAD( "156-0660-01.u581", 0x0800, 0x0800, CRC(c4e302e8) SHA1(a0438cbc70ddc1bab000e30c0f835f0948aae969) ) - ROM_LOAD( "156-0661-01.u487", 0x1000, 0x0800, CRC(edb097c8) SHA1(a07b777b6b20de496089730db8097b65b9a8ef31) ) - ROM_LOAD( "156-0662-01.u485", 0x1800, 0x0800, CRC(0a3af548) SHA1(01bcffa7d55b2585348ea96852b4319c6454d19a) ) - ROM_LOAD( "156-0663-01.u481", 0x2000, 0x0800, CRC(f220d24c) SHA1(fb5dc8a617f4b4d5c094c0cbabb9af158c19c2c2) ) - ROM_LOAD( "156-0664-xx.u385", 0x2800, 0x0800, CRC(aa1ae67d) SHA1(8816654c1b0ad0230bf5027f68c2ec1d315ad188) ) // -01 or -02 ? - ROM_LOAD( "156-0665-xx.u381", 0x3000, 0x0800, CRC(90497138) SHA1(2d6bbe169a434581a49fffcab0d2ca18107b67da) ) // -01 or -02 ? - ROM_LOAD( "156-0666-01.u285", 0x3800, 0x0800, CRC(c35ce405) SHA1(10cae122d000fe2886228a178a1a4e4d3ec2c3f5) ) - ROM_LOAD( "156-0667-xx.u595", 0x4000, 0x0800, CRC(e1723a06) SHA1(dde3e64eb6acc77d8e7234235a99ec338cc74717) ) // -01 or -02 ? - ROM_LOAD( "156-0668-xx.u591", 0x4800, 0x0800, CRC(d8b80d7a) SHA1(6c1f00fa2f9ff6ebd84268c2100637ddbdb3bae6) ) // -01 or -02 ? - ROM_LOAD( "156-0669-01.u497", 0x5000, 0x0800, CRC(f760ed39) SHA1(2b30d20d880002ce3950ee7abe40f4e1539208cc) ) - ROM_LOAD( "156-0670-01.u495", 0x5800, 0x0800, CRC(d40a303d) SHA1(111b399f6178e2fe50b1368536f290d4df9883fc) ) - ROM_LOAD( "156-0671-xx.u491", 0x6000, 0x0800, CRC(32060b64) SHA1(af254dc068686fcd7584128258724fd5415ea458) ) // -01 or -02 ? - ROM_LOAD( "156-0672-xx.u395", 0x6800, 0x0800, CRC(93ad68d1) SHA1(8242058bfc89d11cd9ae82d967410714875eface) ) // -01 or -02 ? - ROM_LOAD( "156-0673-xx.u391", 0x7000, 0x0800, CRC(ee1f5d4c) SHA1(a6fb8347a0dfa94268f091fb7ca091c8bfabeabd) ) // -01 or -02 or -03 ? - ROM_LOAD( "156-0674-xx.u295", 0x7800, 0x0800, CRC(50582341) SHA1(1a028176e5d5ca83012e2f75e9daad88cd7d8fc3) ) // -01 or -02 ? - - ROM_REGION( 0x2000, "020_0147_00", 0 ) // Firmware Backpack (020-0147-00) - ROM_LOAD( "156-0747-xx.u101", 0x0000, 0x0800, CRC(9e1facc1) SHA1(7e7a118c3e8c49630f630ee02c3de843dd95d7e1) ) // -00 or -01 ? - ROM_LOAD( "156-0748-xx.u201", 0x0800, 0x0800, CRC(be42bfbf) SHA1(23575b411bd9dcb7d7116628820096e3064ff93b) ) // -00 or -01 ? - - ROM_REGION( 0x2000, "021_0188_00", 0 ) // Communications Backpack (021-0188-00) - ROM_LOAD( "156-0712-00.u101", 0x0000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0712-01.u101", 0x0000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0713-00.u111", 0x0800, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0713-01.u111", 0x0800, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0714-00.u121", 0x1000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0714-01.u121", 0x1000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0715-01.u131", 0x1800, 0x0800, NO_DUMP ) -/* - ROM_REGION( 0x2000, "4051r01", 0 ) // 4051R01 Matrix Functions - ROM_LOAD( "4051r01", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x2000, "4051r05", 0 ) // 4051R05 Binary Program Loader - ROM_LOAD( "156-0856-00.u1", 0x0000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0857-00.u11", 0x0800, 0x0800, NO_DUMP ) - - ROM_REGION( 0x2000, "4051r06", 0 ) // 4051R06 Editor - ROM_LOAD( "4051r06", 0x0000, 0x1000, NO_DUMP ) -*/ -ROM_END - - -//------------------------------------------------- -// ROM( tek4052a ) -//------------------------------------------------- - -ROM_START( tek4052a ) - ROM_REGION( 0x3800, AM2901A_TAG, 0 ) // ALU 670-7705-00 microcode - ROM_LOAD( "160-1689-00.u340", 0x0000, 0x0800, CRC(97ff62d4) SHA1(e25b495fd1b3f8a5bfef5c8f20efacde8366e89c) ) - ROM_LOAD( "160-1688-00.u335", 0x0800, 0x0800, CRC(19033422) SHA1(0f6ea45be5123701940331c4278bcdc5db4f4147) ) - ROM_LOAD( "160-1687-00.u330", 0x1000, 0x0800, CRC(3b2e37dd) SHA1(294b626d0022fbf9bec50680b6b932f21a3cb049) ) - ROM_LOAD( "160-1686-00.u320", 0x1800, 0x0800, CRC(7916cd64) SHA1(d6b3ed783e488667ca203ec605aa27d78261c61b) ) - ROM_LOAD( "160-1695-00.u315", 0x2000, 0x0800, CRC(cdac76a7) SHA1(2a47f34ae63fb7fe96e7c6fc92ca4f629b0e31ec) ) - ROM_LOAD( "160-1694-00.u305", 0x2800, 0x0800, CRC(c33ae212) SHA1(25ed4cc3600391fbc93bb46c92d3f64ca2aca58e) ) - ROM_LOAD( "160-1693-00.u300", 0x3000, 0x0800, CRC(651b7af2) SHA1(7255c682cf74f2e77661d77c8406b36a567eea46) ) - - ROM_REGION( 0x14000, "672_0799_08", 0 ) // Memory Access Sequencer 672-0799-08 - ROM_LOAD16_BYTE( "160-1698-00.u810", 0x00000, 0x2000, CRC(fd0b8bc3) SHA1(ea9caa151295024267a467ba636ad41aa0c517d3) ) - ROM_LOAD16_BYTE( "160-1682-00.u893", 0x00001, 0x2000, CRC(d54104ef) SHA1(b796c320c8f96f6e4b845718bfb62ccb5903f2db) ) - ROM_LOAD16_BYTE( "160-1699-00.u820", 0x04000, 0x2000, CRC(59cc6c2e) SHA1(b6d85cdfaaef360af2a4fc44eae55e512bb08b21) ) - ROM_LOAD16_BYTE( "160-1684-00.u870", 0x04001, 0x2000, CRC(b24cdbaf) SHA1(476032624110bc5c7a7f30d10458e8baffb2f2ff) ) - ROM_LOAD16_BYTE( "160-1700-00.u825", 0x08000, 0x2000, CRC(59f4a4e2) SHA1(81b5f74ec14bb13735382abc123bb9b09dfb7a63) ) - ROM_LOAD16_BYTE( "160-1683-00.u880", 0x08001, 0x2000, CRC(f6bb15d1) SHA1(eca06211876c12236cfeae0417131e8f04728d51) ) - ROM_LOAD16_BYTE( "160-1701-00.u835", 0x0c000, 0x2000, CRC(195988b9) SHA1(995a77963e869f1a461addf58db9ecbf2b9222ba) ) - ROM_LOAD16_BYTE( "160-1691-00.u885", 0x0c001, 0x2000, CRC(0670bf9e) SHA1(a8c39bd7f3f61436296c6bc5f734354371ae8123) ) - ROM_LOAD16_BYTE( "160-1702-00.u845", 0x10000, 0x2000, CRC(013344b1) SHA1(4a79654427e15d0fcedd9519914f6448938ecffd) ) - ROM_LOAD16_BYTE( "160-1685-00.u863", 0x10001, 0x2000, CRC(53ddc8f9) SHA1(431d6f329dedebb54232c623a924d5ecddc5e44e) ) - - ROM_REGION( 0x2000, "020_0147_00", 0 ) // Firmware Backpack (020-0147-00) - ROM_LOAD( "156-0747-xx.u101", 0x0000, 0x0800, CRC(9e1facc1) SHA1(7e7a118c3e8c49630f630ee02c3de843dd95d7e1) ) // -00 or -01 ? - ROM_LOAD( "156-0748-xx.u201", 0x0800, 0x0800, CRC(be42bfbf) SHA1(23575b411bd9dcb7d7116628820096e3064ff93b) ) // -00 or -01 ? - - ROM_REGION( 0x2000, "021_0188_00", 0 ) // Communications Backpack (021-0188-00) - ROM_LOAD( "156-0712-00.u101", 0x0000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0712-01.u101", 0x0000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0713-00.u111", 0x0800, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0713-01.u111", 0x0800, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0714-00.u121", 0x1000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0714-01.u121", 0x1000, 0x0800, NO_DUMP ) - ROM_LOAD( "156-0715-01.u131", 0x1800, 0x0800, NO_DUMP ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1975, tek4051, 0, 0, tek4051, tek4051, driver_device, 0, "Tektronix", "Tektronix 4051", MACHINE_NOT_WORKING ) -COMP( 1978, tek4052a, tek4051, 0, tek4052, tek4051, driver_device, 0, "Tektronix", "Tektronix 4052A", MACHINE_NOT_WORKING ) -//COMP( 1979, tek4054, tek4051, 0, tek4054, tek4054, driver_device, 0, "Tektronix", "Tektronix 4054", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/tek410x.c b/src/mess/drivers/tek410x.c deleted file mode 100644 index df28dd8d8e7..00000000000 --- a/src/mess/drivers/tek410x.c +++ /dev/null @@ -1,148 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Tektronix 4107A/4109A - - Skeleton driver. - -****************************************************************************/ - -/* - - TODO: - - - everything - -*/ - - -#include "emu.h" -#include "cpu/i86/i186.h" - -#define I80188_TAG "i80188" -#define SCREEN_TAG "screen" - -class tek4107a_state : public driver_device -{ -public: - tek4107a_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } - - virtual void machine_start(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); -}; - -/* Memory Maps */ - -static ADDRESS_MAP_START( tek4107a_mem, AS_PROGRAM, 8, tek4107a_state ) - AM_RANGE(0x00000, 0xbffff) AM_RAM - AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION(I80188_TAG, 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tek4107a_io, AS_IO, 8, tek4107a_state ) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( tek4107a ) -INPUT_PORTS_END - -/* Video */ - -void tek4107a_state::video_start() -{ -} - -UINT32 tek4107a_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static const gfx_layout tek4107a_charlayout = -{ - 8, 15, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP8(0,1) }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8 }, - 16*8 -}; - -static GFXDECODE_START( tek4107a ) - GFXDECODE_ENTRY( "chargen", 0x0000, tek4107a_charlayout, 0, 1 ) -GFXDECODE_END - -/* Machine Initialization */ - -void tek4107a_state::machine_start() -{ -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( tek4107a, tek4107a_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(I80188_TAG, I80188, 21000000) - MCFG_CPU_PROGRAM_MAP(tek4107a_mem) - MCFG_CPU_IO_MAP(tek4107a_io) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(tek4107a_state, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - - MCFG_PALETTE_ADD("palette", 64) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tek4107a) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tek4109a, tek4107a ) - /* video hardware */ - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(4096) -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( tek4107a ) - ROM_REGION( 0x40000, I80188_TAG, 0 ) - ROM_LOAD16_BYTE( "160-2379-03.u60", 0x00000, 0x8000, NO_DUMP ) - ROM_LOAD16_BYTE( "160-2380-03.u160", 0x00001, 0x8000, NO_DUMP ) - ROM_LOAD16_BYTE( "160-2377-03.u70", 0x10000, 0x8000, NO_DUMP ) - ROM_LOAD16_BYTE( "160-2378-03.u170", 0x10001, 0x8000, CRC(feac272f) SHA1(f2018dc9bb5bd6840b2843c709cbc24689054dc0) ) - ROM_LOAD16_BYTE( "160-2375-03.u80", 0x20000, 0x8000, NO_DUMP ) - ROM_LOAD16_BYTE( "160-2376-03.u180", 0x20001, 0x8000, CRC(35a44e75) SHA1(278c7f218105ad3473409b16a8d27a0b9f7a859e) ) - ROM_LOAD16_BYTE( "160-2373-03.u90", 0x30000, 0x8000, CRC(d5e89b15) SHA1(d6eb1a0a684348a8194238d641528fb96fb29087) ) - ROM_LOAD16_BYTE( "160-2374-03.u190", 0x30001, 0x8000, CRC(a3fef76e) SHA1(902845c4aa0cbc392b62c726ac746ca62567d91c) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "160-2381 v1.0.u855", 0x0000, 0x1000, CRC(ac7ca279) SHA1(4c9de06d1c346f83eb8d0d09a0eb32c40bd8014c) ) -ROM_END - -ROM_START( tek4109a ) - // another set with 160-32xx-03 v10.5 labels exists: http://picasaweb.google.com/glen.slick/Tektronix4107A#5300179291078507810 - ROM_REGION( 0x40000, I80188_TAG, 0 ) - ROM_LOAD16_BYTE( "160-3283-02 v8.2.u60", 0x00000, 0x8000, CRC(2a821db6) SHA1(b4d8b74bd9fe43885dcdc4efbdd1eebb96e32060) ) - ROM_LOAD16_BYTE( "160-3284-02 v8.2.u160", 0x00001, 0x8000, CRC(ee567b01) SHA1(67b1b0648cfaa28d57473bcc45358ff2bf986acf) ) - ROM_LOAD16_BYTE( "160-3281-02 v8.2.u70", 0x10000, 0x8000, CRC(e2713328) SHA1(b0bb3471539ef24d79b18d0e33bc148ed27d0ec4) ) - ROM_LOAD16_BYTE( "160-3282-02 v8.2.u170", 0x10001, 0x8000, CRC(c109a4f7) SHA1(762019105c1f82200a9c99ccfcfd8ee81d2ac4fe) ) - ROM_LOAD16_BYTE( "160-3279-02 v8.2.u80", 0x20000, 0x8000, CRC(00822078) SHA1(a82e61dafccbaea44e67efaa5940e52ec6d07d7d) ) - ROM_LOAD16_BYTE( "160-3280-02 v8.2.u180", 0x20001, 0x8000, CRC(eec9f70f) SHA1(7b65336219f5fa0d11f8be2b37040b564a53c52f) ) - ROM_LOAD16_BYTE( "160-3277-02 v8.2.u90", 0x30000, 0x8000, CRC(cf6ebc97) SHA1(298db473874c57bf4eec788818179748030a9ad8) ) - ROM_LOAD16_BYTE( "160-3278-02 v8.2.u190", 0x30001, 0x8000, CRC(d6124cd1) SHA1(f826aee5ec07cf5ac369697d93def0259ad225bb) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "160-3087 v1.0.u855", 0x0000, 0x1000, CRC(97479528) SHA1(e9e15f1f64b3b6bd139accd51950bae71fdc2193) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, tek4107a, 0, 0, tek4107a, tek4107a, driver_device, 0, "Tektronix", "Tektronix 4107A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1983, tek4109a, tek4107a, 0, tek4109a, tek4107a, driver_device, 0, "Tektronix", "Tektronix 4109A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/terak.c b/src/mess/drivers/terak.c deleted file mode 100644 index 7ffa92684b6..00000000000 --- a/src/mess/drivers/terak.c +++ /dev/null @@ -1,120 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Terak 8510A - - 23/02/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/t11/t11.h" - -class terak_state : public driver_device -{ -public: - terak_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_READ16_MEMBER(terak_fdc_status_r); - DECLARE_WRITE16_MEMBER(terak_fdc_command_w); - DECLARE_READ16_MEMBER(terak_fdc_data_r); - DECLARE_WRITE16_MEMBER(terak_fdc_data_w); - UINT8 m_unit; - UINT8 m_cmd; - UINT16 m_data; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_terak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - -READ16_MEMBER( terak_state::terak_fdc_status_r ) -{ - logerror("terak_fdc_status_r\n"); - if (m_cmd==3) { - logerror("cmd is 3\n"); - return 0xffff; - } - return 0; -} - -WRITE16_MEMBER( terak_state::terak_fdc_command_w ) -{ - m_unit = (data >> 8) & 0x03; - m_cmd = (data >> 1) & 0x07; - logerror("terak_fdc_command_w %04x [%d %d]\n",data,m_unit,m_cmd); -} - -READ16_MEMBER( terak_state::terak_fdc_data_r ) -{ - logerror("terak_fdc_data_r\n"); - return 0; -} - -WRITE16_MEMBER( terak_state::terak_fdc_data_w ) -{ - logerror("terak_fdc_data_w %04x\n",data); -} - -static ADDRESS_MAP_START(terak_mem, AS_PROGRAM, 16, terak_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xf5ff ) AM_RAM // RAM - - // octal - AM_RANGE( 0173000, 0173177 ) AM_ROM // ROM - AM_RANGE( 0177000, 0177001 ) AM_READWRITE(terak_fdc_status_r,terak_fdc_command_w) - AM_RANGE( 0177002, 0177003 ) AM_READWRITE(terak_fdc_data_r,terak_fdc_data_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( terak ) -INPUT_PORTS_END - - -void terak_state::machine_reset() -{ -} - -void terak_state::video_start() -{ -} - -UINT32 terak_state::screen_update_terak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - -static MACHINE_CONFIG_START( terak, terak_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) - MCFG_T11_INITIAL_MODE(6 << 13) - MCFG_CPU_PROGRAM_MAP(terak_mem) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(terak_state, screen_update_terak) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( terak ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "terak.rom", 0173000, 0x0080, CRC(fd654b8e) SHA1(273a9933b68a290c5aedcd6d69faa7b1d22c0344)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( ????, terak, 0, 0, terak, terak, driver_device, 0, "Terak", "Terak 8510A", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/test_t400.c b/src/mess/drivers/test_t400.c deleted file mode 100644 index b577d3c77a4..00000000000 --- a/src/mess/drivers/test_t400.c +++ /dev/null @@ -1,53 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - T400 uController test suite for COP410/420 series CPUs - - http://opencores.org/project,t400 - -*/ - -#include "emu.h" -#include "cpu/cop400/cop400.h" - -class t400_test_suite_state : public driver_device -{ -public: - t400_test_suite_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_WRITE8_MEMBER( port_l_w ); - required_device m_maincpu; -}; - -WRITE8_MEMBER( t400_test_suite_state::port_l_w ) -{ -// printf("L: %u\n", data); -} - -static MACHINE_CONFIG_START( test_t410, t400_test_suite_state ) - MCFG_CPU_ADD("maincpu", COP410, 1000000) - MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) - MCFG_COP400_WRITE_L_CB(WRITE8(t400_test_suite_state, port_l_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( test_t420, t400_test_suite_state ) - MCFG_CPU_ADD("maincpu", COP420, 1000000) - MCFG_COP400_CONFIG( COP400_CKI_DIVISOR_16, COP400_CKO_OSCILLATOR_OUTPUT, COP400_MICROBUS_ENABLED ) - MCFG_COP400_WRITE_L_CB(WRITE8(t400_test_suite_state, port_l_w)) -MACHINE_CONFIG_END - -ROM_START( test410 ) - ROM_REGION( 0x200, "maincpu", 0 ) - ROM_LOAD( "rom_41x.bin", 0x000, 0x200, NO_DUMP ) -ROM_END - -ROM_START( test420 ) - ROM_REGION( 0x400, "maincpu", 0 ) - ROM_LOAD( "rom_42x.bin", 0x000, 0x400, BAD_DUMP CRC(e4e80001) SHA1(8fdca9d08de1cc83387a7d141f6b254117902442) ) -ROM_END - -COMP( 2008, test410, 0, 0, test_t410, 0, driver_device, 0, "T400 uController project", "T410 test suite", MACHINE_NO_SOUND_HW ) -COMP( 2008, test420, test410, 0, test_t420, 0, driver_device, 0, "T400 uController project", "T420 test suite", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/thomson.c b/src/mess/drivers/thomson.c deleted file mode 100644 index 33112623a19..00000000000 --- a/src/mess/drivers/thomson.c +++ /dev/null @@ -1,2451 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Thomson 8-bit micro-computers. - - A 6809E-based French family of personal computers developed in the 80's. - Despite their rather high price and poor design , they were quite popular - in France, probably due to the government plan "Informatique pour tous" - (Computer Science for Everyone) to put a network of MO5 computers in every - school during 1984-1986. And maybe their very popular light-pen. - - Drivers - - t9000 Thomson T9000 (early TO7 prototype, oct 1980) - - to7 Thomson TO7 (nov 1982) - - to770 Thomson TO7/70 (scarcely enhanced TO7, 1984) - - mo5 Thomson MO5 (entry-game, TO7-incompatible, jun 1984) - - to9 Thomson TO9 (high-end TO7/70 successor, sep 1985) - - mo5e Thomson MO5E (export MO5 version, 1986) - - to8 Thomson TO8 (next generation of TO7/70, sep 1986) - - to9p Thomson TO9+ (improved TO9 with TO8 technology, sep 1986) - - mo6 Thomson MO6 (improved MO5 with TO8 technology, sep 1986) - - mo5nr Thomson MO5NR (network-enhanced MO6, 1986) - - to8d Thomson TO8D (TO8 with integrated floppy, dec 1987) - - pro128 Olivetti Prodest PC 128 (Italian MO6, built by Thomson, 1986) - - We do not consider here the few 16-bit computers built by Thomson - (68000-based Micromega 32, 8088-based Micromega 16 or the TO16: Thomson's own - 8088-based PC). - - You may distinguish three families: - * TO7,TO7/70,TO8,TO8D (family computers) - * TO9,TO9+ (professional desktop look with separate keyboard and monitor) - * MO5,MO5E,MO5NR,MO6 (cheaper, less extensible family) - Computers in both TO families are compatible. Computers in the MO family are - compatible. However, the TO and MO families are incompatible - (different memory-mapping). - - Note that the TO8, TO9+ and MO6 were produced at the same time, using very - similar technologies, but with different cost/feature trade-offs and - different compatibility (MO6 is MO5-compatible, TO9+ is TO9-compatible and - TO8 and TO9+ are TO7-compatible). - Also note that the MO5NR is actually based on MO6 design, not MO5 - (although both MO5NR and MO6 are MO5-compatible) - - Also of interest are the Platini and Hinault versions of the MO5 - (plain MO5 inside, but with custom, signed box-case). - There were several versions of TO7/70 and MO5 with alternate keyboards. - - Thomson stopped producing micro-computers in jan 1990. - -**********************************************************************/ - -/* TODO (roughly in decreasing priority order): - ---- - - - internal, keyboard-attached TO9 mouse port (untested) - - floppy: 2-sided or 4-sided .fd images - - printer post-processing => postscript - - RS232 serial port extensions: CC 90-232, RF 57-932 - - modem, teltel extension: MD 90-120 / MD 90-333 (need controller ROM?) - - IEEE extension - - TV overlay (IN 57-001) (@) - - digitisation extension (DI 90-011) (@) - - barcode reader (@) - - (@) means MESS is lacking support for this kind of device / feature anyway - -*/ - -#include "includes/thomson.h" -#include "bus/rs232/rs232.h" -#include "machine/6821pia.h" -#include "machine/wd_fdc.h" -#include "machine/clock.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/flopdrv.h" -#include "formats/cd90_640_dsk.h" -#include "formats/basicdsk.h" -#include "machine/ram.h" - - -/**************************** common *******************************/ - -/* layout */ -static const char layout_thomson[] = "thomson"; - -#define KEY(pos,name,key) \ - PORT_BIT ( 1<<(pos), IP_ACTIVE_LOW, IPT_KEYBOARD ) \ - PORT_NAME ( name ) \ - PORT_CODE ( KEYCODE_##key ) - -#define PAD(mask,player,name,port,dir,key) \ - PORT_BIT ( mask, IP_ACTIVE_LOW, IPT_##port ) \ - PORT_NAME ( "P" #player " " name ) \ - PORT_CODE( KEYCODE_##key ) \ - PORT_PLAYER ( player ) - - -/* ------------- game port ------------- */ - -/* - Two generations of game port extensions were developped - - - CM 90-112 (model 1) - connect up to two 8-position 1-button game pads - - - SX 90-018 (model 2) - connect either two 8-position 2-button game pads - or a 2-button mouse (not both at the same time!) - - We emulate the SX 90-018 as it is fully compatible with the CM 90-112. - - Notes: - * all extensions are compatible with all Thomson computers. - * the SX 90-018 extension is integrated within the TO8(D) - * the TO9 has its own, different mouse port - * all extensions are based on a Motorola 6821 PIA - * all extensions include a 6-bit sound DAC - * most pre-TO8 software (including TO9) do not recognise the mouse nor the - second button of each pad - * the mouse cannot be used at the same time as the pads: they use the same - 6821 input ports & physical port; we use a config switch to tell MESS - whether pads or a mouse is connected - * the mouse should not be used at the same time as the sound DAC: they use - the same 6821 ports, either as input or output; starting from the TO8, - there is a 'mute' signal to cut the DAC output and avoid producing an - audible buzz whenever the mouse is moved; unfortunately, mute is not - available on the TO7(/70), TO9 and MO5. -*/ - -static INPUT_PORTS_START( thom_game_port ) - -/* joysticks, common to CM 90-112 & SX 90-018 */ - PORT_START ( "game_port_directions" ) - PAD ( 0x01, 1, UTF8_UP, JOYSTICK_UP, UP, UP) - PAD ( 0x02, 1, UTF8_DOWN, JOYSTICK_DOWN, DOWN, DOWN ) - PAD ( 0x04, 1, UTF8_LEFT, JOYSTICK_LEFT, LEFT, LEFT ) - PAD ( 0x08, 1, UTF8_RIGHT, JOYSTICK_RIGHT, RIGHT, RIGHT ) - PAD ( 0x10, 2, UTF8_UP, JOYSTICK_UP, UP, 8_PAD ) - PAD ( 0x20, 2, UTF8_DOWN, JOYSTICK_DOWN, DOWN, 2_PAD ) - PAD ( 0x40, 2, UTF8_LEFT, JOYSTICK_LEFT, LEFT, 4_PAD ) - PAD ( 0x80, 2, UTF8_RIGHT, JOYSTICK_RIGHT, RIGHT, 6_PAD ) - - PORT_START ( "game_port_buttons" ) - PAD ( 0x40, 1, "Action A", BUTTON1, BUTTON1, LCONTROL ) - PAD ( 0x80, 2, "Action A", BUTTON1, BUTTON1, RCONTROL ) - -/* joysticks, SX 90-018 specific */ - PAD ( 0x04, 1, "Action B", BUTTON2, BUTTON2, LALT ) - PAD ( 0x08, 2, "Action B", BUTTON2, BUTTON2, RALT ) - PORT_BIT ( 0x30, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT ( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) /* ? */ - -/* mouse, SX 90-018 specific */ - PORT_START ( "mouse_x" ) - PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_X ) - PORT_NAME ( "Mouse X" ) - PORT_SENSITIVITY ( 150 ) - PORT_PLAYER (1) - - PORT_START ( "mouse_y" ) - PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_Y ) - PORT_NAME ( "Mouse Y" ) - PORT_SENSITIVITY ( 150 ) - PORT_PLAYER (1) - - PORT_START ( "mouse_button" ) - PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_NAME ( "Left Mouse Button" ) - PORT_CODE( MOUSECODE_BUTTON1 ) - PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_NAME ( "Right Mouse Button" ) - -INPUT_PORTS_END - - -/* ------------ lightpen ------------ */ - -static INPUT_PORTS_START( thom_lightpen ) - - PORT_START ( "lightpen_x" ) - PORT_BIT ( 0xffff, THOM_TOTAL_WIDTH/2, IPT_LIGHTGUN_X ) - PORT_NAME ( "Lightpen X" ) - PORT_MINMAX( 0, THOM_TOTAL_WIDTH ) - PORT_SENSITIVITY( 50 ) - PORT_CROSSHAIR(X, 1.0, 0.0, 0) - - PORT_START ( "lightpen_y" ) - PORT_BIT ( 0xffff, THOM_TOTAL_HEIGHT/2, IPT_LIGHTGUN_Y ) - PORT_NAME ( "Lightpen Y" ) - PORT_MINMAX ( 0, THOM_TOTAL_HEIGHT ) - PORT_SENSITIVITY( 50 ) - PORT_CROSSHAIR(Y, 1.0, 0.0, 0) - - PORT_START ( "lightpen_button" ) - PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_NAME ( "Lightpen Button" ) - PORT_CODE( MOUSECODE_BUTTON1 ) - -INPUT_PORTS_END - -/************************** T9000 / TO7 ******************************* - -TO7 (1982) ---- - -First computer by Thomson. -Note that the computer comes with only a minimal BIOS and requires an -external cartridge to be usable. -Most software are distributed on cassette and require the BASIC 1.0 cartridge -to be present (-cart basic.m7), as only it provides the necessary OS -capabilities (e.g., a cassette loader). -To use disks, you will need both a BASIC 1.0 cartridge and a BASIC DOS -boot floppy. - -* chips: - - 1 MHz Motorola 6809E CPU - - 1 Motorola 6821 PIA (+3 for I/O, game, and modem extensions) - - 1 Motorola 6846 timer, I/O, ROM - -* memory: - - 8 KB base user RAM - + 16 KB extended user RAM (EM 90-016) = 24 KB total user RAM emulated - + homebrew 8 KB RAM extension (Theophile magazine 6, sept 1984) - - 6 KB BIOS ROM - - 6-bit x 8 K color RAM + 8-bit x 8 K point RAM, bank switched - - 2 to 8 KB ROM comes with the floppy drive / network controller - -* video: - 320x200 pixels with color constraints (2 colors per horizontal - 8-pixel span), 8-color pixel palette, - 50 Hz (tweaked SECAM) - -* devices: - - AZERTY keyboard, 58-keys, French with accents - - cartridge 16 KB (up to 64 KB using bank-switching), - the MESS cartridge device is named -cart - - cassette 900 bauds (frequency signals: 0=4.5 kHz, 1=6.3 kHz) - the MESS cassette device is named -cass - - 1-bit internal buzzer - - lightpen, with 8-pixel horizontal resolution, 1-pixel vertical - - SX 90-018 game & music extension - . 6-bit DAC sound - . two 8-position 2-button game pads - . 2-button mouse - . based on a Motorola 6821 PIA - - CC 90-232 I/O extension: - . CENTRONICS (printer) - . RS232 (unemulated) - . based on a Motorola 6821 PIA - . NOTE: you cannot use the CENTRONICS and RS232 at the same time - - RF 57-932: RS232 extension, based on a SY 6551 ACIA (unemulated) - - MD 90-120: MODEM, TELETEL extension (unemulated) - . 1 Motorola 6850 ACIA - . 1 Motorola 6821 PIA - . 1 EFB 7513 MODEM FSK V13, full duplex - . PTT-, VELI7Y-, and V23-compatible MODEM (up to 1200 bauds) - . seems to come with an extra ROM - - 5"1/2 floppy drive extension - . CD 90-640 floppy controller, based on a Western Digital 2793 - . DD 90-320 double-density double-sided 5"1/4 floppy - (2 drives considered as 4 simple-face drives: 0/1 for the first drive, - 2/3 for the second drive, 1 and 3 for upper sides, 0 and 2 for lower - sides) - . floppies are 40 tracks/side, 16 sectors/track, 128 or 256 bytes/sector - = from 80 KB one-sided single-density, to 320 KB two-sided double-density - . MESS floppy devices are named -flop0 to -flop3 - - alternate 5"1/2 floppy drive extension - . CD 90-015 floppy controller, based on a HD 46503 S - . UD 90-070 5"1/4 single-sided single density floppy drive - - alternate 3"1/2 floppy drive extension - . CD 90-351 floppy controller, based on a custom Thomson gate-array - . DD 90-352 3"1/2 floppy drives - - alternate QDD floppy drive extension - . CQ 90-028 floppy controller, based on a Motorola 6852 SSDA - . QD 90-028 quickdrive 2"8 (QDD), only one drive, signe side - - speech synthesis extension: based on a Philips / Signetics MEA 8000 - (cannot be used with the MODEM) - - MIDIPAK MIDI extension, uses a EF 6850 ACIA - - NR 07-005: network extension, MC 6854 based, 2 KB ROM & 64 KB RAM - (build by the French Leanord company) - - -T9000 (1980) ------ - -Early TO7 prototype. -The hardware seems to be the exactly same. Only the BIOS is different. -It has some bug that were corrected later for the TO7. -Actually, the two computers are undistinguishable, except for the different -startup screen, and a couple BIOS addresses. -They can run the same software and accept the same devices and extensions. - - -**********************************************************************/ - -/* ------------ address maps ------------ */ - -static ADDRESS_MAP_START ( to7, AS_PROGRAM, 8, thomson_state ) - - AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK ) AM_WRITE(to7_cartridge_w ) /* 4 * 16 KB */ - AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK ) AM_WRITE(to7_vram_w ) - AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 1 * 8 KB */ - AM_RANGE ( 0x8000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 16 or 24 KB (for extension) */ - AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) - AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) - AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE(to7_floppy_r, to7_floppy_w ) - AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_DEVREADWRITE( "to7_io:pia_2", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) - AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) - AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) - AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ - -/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ -/* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ - -/* RAM mapping: - 0x0000 - 0x3fff: 16 KB video RAM (actually 8 K x 8 bits + 8 K x 6 bits) - 0x4000 - 0x5fff: 8 KB base RAM - 0x6000 - 0x9fff: 16 KB extended RAM - 0xa000 - 0xbfff: 8 KB more extended RAM - */ -ADDRESS_MAP_END - - - -/* ------------ ROMS ------------ */ - -/* external floppy controllers */ -#define ROM_FLOPPY( base ) \ - /* no controller */ \ - ROM_FILL( base, 0x800, 0x39 ) \ - /* CD 90-015 (5"1/4) */ \ - ROM_LOAD ( "cd90-015.rom", base+0x800, 0x7c0, \ - CRC(821d34c1) \ - SHA1(31a6bb81baaeec5fc8de457c97264f9dfa92c18b) ) \ - /* CD 90-640 (5"1/4) */ \ - ROM_LOAD ( "cd90-640.rom", base+0x1000, 0x7c0, \ - CRC(5114c0a5) \ - SHA1(5c72566c22d8160ef0c75959e1863a1309bbbe49) ) \ - /* CD 90-351 (3"1/2) */ \ - ROM_LOAD ( "cd-351-0.rom", base+0x1800, 0x7c0, \ - CRC(2c0159fd) \ - SHA1(bab5395ed8bc7c06f9897897f836054e6546e8e8) ) \ - ROM_LOAD ( "cd-351-1.rom", base+0x2000, 0x7c0, \ - CRC(8e58d159) \ - SHA1(dcf992c96e7556b2faee6bacd3f744e56998e6ea) ) \ - ROM_LOAD ( "cd-351-2.rom", base+0x2800, 0x7c0, \ - CRC(c9228b60) \ - SHA1(179e10107d5be91e684069dee80f94847b83201f) ) \ - ROM_LOAD ( "cd-351-3.rom", base+0x3000, 0x7c0, \ - CRC(3ca8e5dc) \ - SHA1(7118636fb5c597c78c2fce17b02aed5e4ba38635) ) \ - /* CQ 90-028 (2"8, aka QDD) */ \ - ROM_LOAD ( "cq90-028.rom", base+0x3800, 0x7c0, \ - CRC(ca4dba3d) \ - SHA1(949c1f777c892da62c242215d79757d61e71e62b) ) - -/* external floppy / network controller: 9 banks */ -#define ROM_FLOPPY5( base ) \ - ROM_FLOPPY( base ) \ - ROM_LOAD ( "nano5.rom", base+0x4000, 0x7c0, \ - CRC(2f756868) \ - SHA1(b5b7cb6d12493d849330b6b5628efd1a83a4bbf5) ) - -#define ROM_FLOPPY7( base ) \ - ROM_FLOPPY( base ) \ - ROM_LOAD ( "nano7.rom", base+0x4000, 0x7c0, \ - CRC(42a1d1a6) \ - SHA1(973209f4baa5e81bf7885c0602949e064bac7862) ) - - -ROM_START ( to7 ) - ROM_REGION ( 0x24800, "maincpu", 0 ) - ROM_LOAD ( "to7.rom", 0xe800, 0x1800, - CRC(0e7826da) - SHA1(23a2f84b03c01d385cc1923c8ece95c43756297a) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) - ROM_FLOPPY7 ( 0x20000 ) -ROM_END - -ROM_START ( t9000 ) - ROM_REGION ( 0x24800, "maincpu", 0 ) - ROM_LOAD ( "t9000.rom", 0xe800, 0x1800, - CRC(daa8cfbf) - SHA1(a5735db1ad4e529804fc46603f838d3f4ccaf5cf) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) - ROM_FLOPPY7 ( 0x20000 ) -ROM_END - - -/* ------------ inputs ------------ */ - -static INPUT_PORTS_START ( to7_config ) - PORT_START ( "config" ) - - PORT_CONFNAME ( 0x01, 0x00, "Game Port" ) - PORT_CONFSETTING ( 0x00, DEF_STR( Joystick ) ) - PORT_CONFSETTING ( 0x01, "Mouse" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START ( to7_vconfig ) - PORT_START ( "vconfig" ) - - PORT_CONFNAME ( 0x03, 0x00, "Border" ) - PORT_CONFSETTING ( 0x00, "Normal (56x47)" ) - PORT_CONFSETTING ( 0x01, "Small (16x16)" ) - PORT_CONFSETTING ( 0x02, DEF_STR ( None ) ) - - PORT_CONFNAME ( 0x0c, 0x08, "Resolution" ) - PORT_CONFSETTING ( 0x00, DEF_STR ( Low ) ) - PORT_CONFSETTING ( 0x04, DEF_STR ( High ) ) - PORT_CONFSETTING ( 0x08, "Auto" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START ( to7_mconfig ) - PORT_START ( "mconfig" ) - - PORT_CONFNAME ( 0x01, 0x01, "E7FE-F port" ) - PORT_CONFSETTING ( 0x00, "Modem (unemulated)" ) - PORT_CONFSETTING ( 0x01, "Speech" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START ( to7_fconfig ) - PORT_START ( "fconfig" ) - - PORT_CONFNAME ( 0x07, 0x03, "Floppy (reset)" ) - PORT_CONFSETTING ( 0x00, DEF_STR ( None ) ) - PORT_CONFSETTING ( 0x01, "CD 90-015 (5\"1/4 SD)" ) - PORT_CONFSETTING ( 0x02, "CD 90-640 (5\"1/4 DD)" ) - PORT_CONFSETTING ( 0x03, "CD 90-351 (3\"1/2)" ) - PORT_CONFSETTING ( 0x04, "CQ 90-028 (2\"8 QDD)" ) - PORT_CONFSETTING ( 0x05, "Network" ) - - PORT_CONFNAME ( 0xf8, 0x08, "Network ID" ) - PORT_CONFSETTING ( 0x00, "0 (Master)" ) - PORT_CONFSETTING ( 0x08, "1" ) - PORT_CONFSETTING ( 0x10, "2" ) - PORT_CONFSETTING ( 0x18, "3" ) - PORT_CONFSETTING ( 0x20, "4" ) - PORT_CONFSETTING ( 0x28, "5" ) - PORT_CONFSETTING ( 0x30, "6" ) - PORT_CONFSETTING ( 0x38, "7" ) - PORT_CONFSETTING ( 0x40, "8" ) - PORT_CONFSETTING ( 0x48, "9" ) - PORT_CONFSETTING ( 0x50, "10" ) - PORT_CONFSETTING ( 0x58, "11" ) - PORT_CONFSETTING ( 0x60, "12" ) - PORT_CONFSETTING ( 0x68, "13" ) - PORT_CONFSETTING ( 0x70, "14" ) - PORT_CONFSETTING ( 0x78, "15" ) - PORT_CONFSETTING ( 0x80, "16" ) - PORT_CONFSETTING ( 0x88, "17" ) - PORT_CONFSETTING ( 0x90, "18" ) - PORT_CONFSETTING ( 0x98, "19" ) - PORT_CONFSETTING ( 0xa0, "20" ) - PORT_CONFSETTING ( 0xa8, "21" ) - PORT_CONFSETTING ( 0xb0, "22" ) - PORT_CONFSETTING ( 0xb8, "23" ) - PORT_CONFSETTING ( 0xc0, "24" ) - PORT_CONFSETTING ( 0xc8, "25" ) - PORT_CONFSETTING ( 0xd0, "26" ) - PORT_CONFSETTING ( 0xd8, "27" ) - PORT_CONFSETTING ( 0xe0, "28" ) - PORT_CONFSETTING ( 0xe8, "29" ) - PORT_CONFSETTING ( 0xf0, "30" ) - PORT_CONFSETTING ( 0xf8, "31" ) - -INPUT_PORTS_END - - -static INPUT_PORTS_START ( to7_keyboard ) - PORT_START ( "keyboard.0" ) - KEY ( 0, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT ( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard.1" ) - KEY ( 0, "W", W ) PORT_CHAR('W') - KEY ( 1, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) - KEY ( 2, "C \303\247", C ) PORT_CHAR('C') - KEY ( 3, "Clear", ESC ) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - KEY ( 4, "Enter", ENTER ) PORT_CHAR(13) - KEY ( 5, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) - KEY ( 7, "Stop", TAB ) PORT_CHAR(27) - PORT_START ( "keyboard.2" ) - KEY ( 0, "X", X ) PORT_CHAR('X') - KEY ( 1, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - KEY ( 2, "V", V ) PORT_CHAR('V') - KEY ( 3, "Q", Q ) PORT_CHAR('Q') - KEY ( 4, "* :", QUOTE ) PORT_CHAR('*') PORT_CHAR(':') - KEY ( 5, "A", A ) PORT_CHAR('A') - KEY ( 6, "+ ;", EQUALS ) PORT_CHAR('+') PORT_CHAR(';') - KEY ( 7, "1 !", 1 ) PORT_CHAR('1') PORT_CHAR('!') - PORT_START ( "keyboard.3" ) - KEY ( 0, "Space Caps-Lock", SPACE ) PORT_CHAR(' ') PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - KEY ( 1, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - KEY ( 2, "B", B ) PORT_CHAR('B') - KEY ( 3, "S", S ) PORT_CHAR('S') - KEY ( 4, "/ ?", SLASH ) PORT_CHAR('/') PORT_CHAR('?') - KEY ( 5, "Z \305\223", Z) PORT_CHAR('Z') - KEY ( 6, "- =", MINUS ) PORT_CHAR('-') PORT_CHAR('=') - KEY ( 7, "2 \" \302\250", 2 ) PORT_CHAR('2') PORT_CHAR('"') - PORT_START ( "keyboard.4" ) - KEY ( 0, "@ \342\206\221", TILDE ) PORT_CHAR('@') - KEY ( 1, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - KEY ( 2, "M", M ) PORT_CHAR('M') - KEY ( 3, "D", D ) PORT_CHAR('D') - KEY ( 4, "P", P ) PORT_CHAR('P') - KEY ( 5, "E", E ) PORT_CHAR('E') - KEY ( 6, "0 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) - KEY ( 7, "3 #", 3 ) PORT_CHAR('3') PORT_CHAR('#') - PORT_START ( "keyboard.5" ) - KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') - KEY ( 1, "Home", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - KEY ( 2, "L", L ) PORT_CHAR('L') - KEY ( 3, "F", F ) PORT_CHAR('F') - KEY ( 4, "O", O ) PORT_CHAR('O') - KEY ( 5, "R", R ) PORT_CHAR('R') - KEY ( 6, "9 )", 9 ) PORT_CHAR('9') PORT_CHAR(')') - KEY ( 7, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') - PORT_START ( "keyboard.6" ) - KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') - KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - KEY ( 2, "K", K ) PORT_CHAR('K') - KEY ( 3, "G", G ) PORT_CHAR('G') - KEY ( 4, "I", I ) PORT_CHAR('I') - KEY ( 5, "T", T ) PORT_CHAR('T') - KEY ( 6, "8 (", 8 ) PORT_CHAR('8') PORT_CHAR('(') - KEY ( 7, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') - PORT_START ( "keyboard.7" ) - KEY ( 0, "N", N ) PORT_CHAR('N') - KEY ( 1, "Delete", DEL ) PORT_CHAR(8) - KEY ( 2, "J \305\222", J ) PORT_CHAR('J') - KEY ( 3, "H \302\250", H ) PORT_CHAR('H') - KEY ( 4, "U", U ) PORT_CHAR('U') - KEY ( 5, "Y", Y ) PORT_CHAR('Y') - KEY ( 6, "7 ' \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') - KEY ( 7, "6 &", 6 ) PORT_CHAR('6') PORT_CHAR('&') - - /* unused */ - PORT_START ( "keyboard.8" ) - PORT_START ( "keyboard.9" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START ( to7 ) - PORT_INCLUDE ( thom_lightpen ) - PORT_INCLUDE ( thom_game_port ) - PORT_INCLUDE ( to7_keyboard ) - PORT_INCLUDE ( to7_config ) - PORT_INCLUDE ( to7_fconfig ) - PORT_INCLUDE ( to7_vconfig ) - PORT_INCLUDE ( to7_mconfig ) -INPUT_PORTS_END - -static INPUT_PORTS_START ( t9000 ) - PORT_INCLUDE ( to7 ) -INPUT_PORTS_END - -WRITE_LINE_MEMBER( thomson_state::fdc_index_0_w ) -{ - thomson_index_callback(machine().device(FLOPPY_0), state); -} - -WRITE_LINE_MEMBER( thomson_state::fdc_index_1_w ) -{ - thomson_index_callback(machine().device(FLOPPY_1), state); -} - -WRITE_LINE_MEMBER( thomson_state::fdc_index_2_w ) -{ - thomson_index_callback(machine().device(FLOPPY_2), state); -} - -WRITE_LINE_MEMBER( thomson_state::fdc_index_3_w ) -{ - thomson_index_callback(machine().device(FLOPPY_3), state); -} - -static const floppy_interface thomson_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(thomson), - NULL -}; - -FLOPPY_FORMATS_MEMBER( thomson_state::cd90_640_formats ) - FLOPPY_CD90_640_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( cd90_640_floppies ) - SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) - SLOT_INTERFACE("sd", FLOPPY_525_SD) - SLOT_INTERFACE("ssdd", FLOPPY_525_SSDD) - SLOT_INTERFACE("dd", FLOPPY_525_DD) -SLOT_INTERFACE_END - - -/* ------------ driver ------------ */ - -static MACHINE_CONFIG_START( to7, thomson_state ) - - MCFG_MACHINE_START_OVERRIDE( thomson_state, to7 ) - MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to7 ) - -/* cpu */ - MCFG_CPU_ADD ( "maincpu", M6809, 1000000 ) - MCFG_CPU_PROGRAM_MAP ( to7) - -/* video */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE ( /*50*/ 1./0.019968 ) - MCFG_SCREEN_SIZE ( THOM_TOTAL_WIDTH * 2, THOM_TOTAL_HEIGHT ) - MCFG_SCREEN_VISIBLE_AREA ( 0, THOM_TOTAL_WIDTH * 2 - 1, - 0, THOM_TOTAL_HEIGHT - 1 ) - MCFG_SCREEN_UPDATE_DRIVER( thomson_state, screen_update_thom ) - MCFG_SCREEN_VBLANK_DRIVER( thomson_state, thom_vblank ) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD ( "palette", 4097 ) /* 12-bit color + transparency */ - MCFG_PALETTE_INIT_OWNER(thomson_state, thom) - MCFG_VIDEO_START_OVERRIDE( thomson_state, thom ) - MCFG_DEFAULT_LAYOUT( layout_thomson ) - -/* sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD ( "buzzer", DAC, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* 1-bit buzzer */ - MCFG_SOUND_ADD ( "dac", DAC, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* 6-bit game extention DAC */ - MCFG_SOUND_ADD ( "speech", DAC, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* speech synthesis */ - -/* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(to7_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - -/* timer */ - MCFG_DEVICE_ADD("mc6846", MC6846, 0) - MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to7_timer_port_out)) - MCFG_MC6846_OUT_CP2_CB(WRITE8(thomson_state, to7_timer_cp2_out)) - MCFG_MC6846_IN_PORT_CB(READ8(thomson_state, to7_timer_port_in)) - MCFG_MC6846_OUT_CTO_CB(WRITE8(thomson_state, to7_timer_tco_out)) - MCFG_MC6846_IRQ_CB(WRITELINE(thomson_state, thom_dev_irq_0)) - -/* speech synthesis */ - MCFG_DEVICE_ADD("mea8000", MEA8000, 0) - MCFG_MEA8000_DAC("speech") - -/* floppy */ - MCFG_DEVICE_ADD("mc6843", MC6843, 0) - - MCFG_WD2793_ADD("wd2793", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("wd2793:0", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) - MCFG_FLOPPY_DRIVE_ADD("wd2793:1", cd90_640_floppies, "dd", thomson_state::cd90_640_formats) - - MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0) - MCFG_DEVICE_CONFIG(thomson_floppy_interface) - MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_0_w)) - MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0) - MCFG_DEVICE_CONFIG(thomson_floppy_interface) - MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_1_w)) - MCFG_DEVICE_ADD(FLOPPY_2, LEGACY_FLOPPY, 0) - MCFG_DEVICE_CONFIG(thomson_floppy_interface) - MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_2_w)) - MCFG_DEVICE_ADD(FLOPPY_3, LEGACY_FLOPPY, 0) - MCFG_DEVICE_CONFIG(thomson_floppy_interface) - MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(thomson_state, fdc_index_3_w)) - -/* network */ - MCFG_DEVICE_ADD( "mc6854", MC6854, 0 ) - MCFG_MC6854_OUT_FRAME_CB(thomson_state, to7_network_got_frame) - - -/* pia */ - MCFG_DEVICE_ADD(THOM_PIA_SYS, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to7_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(thomson_state, to7_sys_portb_in)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to7_sys_portb_out)) - MCFG_PIA_CA2_HANDLER(WRITELINE(thomson_state, to7_set_cassette_motor)) - MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, to7_sys_cb2_out)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(thomson_state, thom_firq_1)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_firq_1)) - - MCFG_DEVICE_ADD(THOM_PIA_GAME, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to7_game_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(thomson_state, to7_game_portb_in)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to7_game_portb_out)) - MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, to7_game_cb2_out)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(thomson_state, thom_irq_1)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) - -/* TODO: CONVERT THIS TO A SLOT DEVICE (RF 57-932) */ - MCFG_DEVICE_ADD("acia", MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL_1_8432MHz) - MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - - /// 2400 7N2 - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dcd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("acia", mos6551_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", mos6551_device, write_cts)) - - -/* TODO: CONVERT THIS TO A SLOT DEVICE (CC 90-232) */ - MCFG_TO7_IO_LINE_ADD("to7_io") - - -/* TODO: CONVERT THIS TO A SLOT DEVICE (MD 90-120) */ - MCFG_DEVICE_ADD(THOM_PIA_MODEM, PIA6821, 0) - - MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(thomson_state, to7_modem_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(thomson_state, to7_modem_cb)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 1200) /* 1200 bauds, might be divided by 16 */ - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(thomson_state, write_acia_clock)) - - -/* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "to7_cart") - MCFG_GENERIC_EXTENSIONS("m7,rom") - MCFG_GENERIC_LOAD(thomson_state, to7_cartridge) - - MCFG_SOFTWARE_LIST_ADD("cart_list","to7_cart") - -/* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("40K") - MCFG_RAM_EXTRA_OPTIONS("24K,48K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( t9000, to7 ) -MACHINE_CONFIG_END - - -COMP ( 1982, to7, 0, 0, to7, to7, driver_device, 0, "Thomson", "TO7", 0 ) - -COMP ( 1980, t9000, to7, 0, t9000, t9000, driver_device, 0, "Thomson", "T9000", 0 ) - - -/***************************** TO7/70 ********************************* - -TO7/70 ( 1984) ------- - -Enhanced TO7. -The TO7/70 supports virtually all TO7 software and most TO7 devices and -extensions (floppy, game, communucation, etc.). -As the TO7, it is only usable with a cartridge, and most software require -the BASIC 1.0 cartridge to be present. -Though, you may also use the more advanced BASIC 128 (-cart basic128.m7): -it allows BASIC programs to access all the memory and the video capabilities, -includes its own DOS (no need for a boot disk), but may not be compatible -with all games. - -It has the following modifications: - -* chips: - - custom logics for video, lightpen, address map has been replaced with an - integrated Gate-Array (Motorola MC 1300 ALS) - -* memory: - - 48 KB user base RAM (16 KB unswitchable + 2 switchable banks of 16 KB) - + 64 KB user extended RAM (EM 97-064, as 4 extra 16 KB banks) - = 112 KB total user RAM emulated - - now 8-bit x 8 K color RAM (instead of 6-bit x 8 K) - -* video: - - 16-color fixed palette instead of 8-color (but same constraints) - - IN 57-001: TV overlay extension, not implemented - (black becomes transparent and shows the TV image) - -* devices: - - lightpen management has changed, it now has 1-pixel horizontal resolution - - keyboard management has changed (but the keys are the same) - - -TO7/70 arabic (198?) -------------- - -TO7/70 with an alternate ROM. -Together with a special (64 KB) BASIC 128 cartridge (-cart basic128a.m7), -it allows typing in arabic. -Use Ctrl+W to switch to arabic, and Ctrl+F to switch back to latin. -In latin mode, Ctrl+U / Ctrl+X to start / stop typing in-line arabic. -In arabic mode, Ctrl+E / Ctrl+X to start / stop typing in-line latin. - -**********************************************************************/ - -static ADDRESS_MAP_START ( to770, AS_PROGRAM, 8, thomson_state ) - - AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE(to7_cartridge_w ) /* 4 * 16 KB */ - AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) - AM_RANGE ( 0x6000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 16 KB */ - AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 6 * 16 KB */ - AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) - AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) - AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE(to7_floppy_r, to7_floppy_w ) - AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_DEVREADWRITE( "to7_io:pia_2", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE(to770_gatearray_r, to770_gatearray_w ) - AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) - AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) - AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) - AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ - -/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ -/* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ - -/* RAM mapping: - 0x00000 - 0x03fff: 16 KB video RAM - 0x04000 - 0x07fff: 16 KB unbanked base RAM - 0x08000 - 0x1ffff: 6 * 16 KB banked extended RAM - */ - -ADDRESS_MAP_END - - - -/* ------------ ROMS ------------ */ - -ROM_START ( to770 ) - ROM_REGION ( 0x24800, "maincpu", 0 ) - ROM_LOAD ( "to770.rom", 0xe800, 0x1800, /* BIOS */ - CRC(89518862) - SHA1(cd34474c0bcc758f6d71c90fbd40cef379d61374) ) - ROM_FLOPPY7 ( 0x20000 ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) -ROM_END - -ROM_START ( to770a ) - ROM_REGION ( 0x24800, "maincpu", 0 ) - ROM_LOAD ( "to770a.rom", 0xe800, 0x1800, - CRC(378ea808) - SHA1(f4575b537dfdb46ff2a0e7cbe8dfe4ba63161b8e) ) - ROM_FLOPPY7 ( 0x20000 ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) -ROM_END - - -/* ------------ inputs ------------ */ - -static INPUT_PORTS_START ( to770 ) - PORT_INCLUDE ( to7 ) - - PORT_MODIFY ( "keyboard.1" ) - KEY ( 2, "C \302\250 \303\247", C ) PORT_CHAR('C') - PORT_MODIFY ( "keyboard.4" ) - KEY ( 6, "0 \140 \303\240", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) - PORT_MODIFY ( "keyboard.5" ) - KEY ( 6, "9 ) \303\247", 9 ) PORT_CHAR('9') PORT_CHAR(')') - PORT_MODIFY ( "keyboard.6" ) - KEY ( 6, "8 ( \303\271", 8 ) PORT_CHAR('8') PORT_CHAR('(') - PORT_MODIFY ( "keyboard.7" ) - KEY ( 6, "7 ' \303\250 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') - KEY ( 7, "6 & \303\251", 6 ) PORT_CHAR('6') PORT_CHAR('&') - -INPUT_PORTS_END - -/* arabic version (QWERTY keyboard) */ -static INPUT_PORTS_START ( to770a ) - PORT_INCLUDE ( to770 ) - - PORT_MODIFY ( "keyboard.1" ) - KEY ( 0, "Z", Z ) PORT_CHAR('Z') - PORT_MODIFY ( "keyboard.2" ) - KEY ( 3, "A", A ) PORT_CHAR('A') - KEY ( 4, "/ ?", QUOTE ) PORT_CHAR('/') PORT_CHAR('?') - KEY ( 5, "Q", Q ) PORT_CHAR('Q') - PORT_MODIFY ( "keyboard.3" ) - KEY ( 4, "* :", SLASH ) PORT_CHAR('*') PORT_CHAR(':') - KEY ( 5, "W", W) PORT_CHAR('W') - PORT_MODIFY ( "keyboard.4" ) - KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') - KEY ( 2, "@ \342\206\221", TILDE ) PORT_CHAR('@') PORT_CHAR('^') - KEY ( 6, "0 \302\243 \302\260 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) - PORT_MODIFY ( "keyboard.5" ) - KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') - KEY ( 6, "9 ) \303\261", 9 ) PORT_CHAR('9') PORT_CHAR(')') - PORT_MODIFY ( "keyboard.6" ) - KEY ( 0, "M", M ) PORT_CHAR('M') - KEY ( 6, "8 ( \303\274", 8 ) PORT_CHAR('8') PORT_CHAR('(') - PORT_MODIFY ( "keyboard.7" ) - KEY ( 6, "7 ' \303\266 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') - KEY ( 7, "6 & \303\244", 6 ) PORT_CHAR('6') PORT_CHAR('&') - -INPUT_PORTS_END - - -/* ------------ driver ------------ */ - -static MACHINE_CONFIG_DERIVED( to770, to7 ) - MCFG_MACHINE_START_OVERRIDE( thomson_state, to770 ) - MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to770 ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP ( to770) - - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to770_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(NULL) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to770_sys_portb_out)) - MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, to770_sys_cb2_out)) - - MCFG_DEVICE_MODIFY("mc6846") - MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to770_timer_port_out)) - - MCFG_DEVICE_REMOVE("cartslot") - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "to770_cart") - MCFG_GENERIC_EXTENSIONS("m7,rom") - MCFG_GENERIC_LOAD(thomson_state, to7_cartridge) - - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list","to770_cart") - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("64K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( to770a, to770 ) -MACHINE_CONFIG_END - -COMP ( 1984, to770, 0, 0, to770, to770, driver_device, 0, "Thomson", "TO7/70", 0 ) - -COMP ( 1984, to770a, to770, 0, to770a, to770a, driver_device, 0, "Thomson", "TO7/70 (Arabic)", 0 ) - - -/************************* MO5 / MO5E ********************************* - -MO5 (1984) ---- - -The MO5 is Thomson's attempt to provide a less costly micro-computer, using -the same technology as the TO7/70. -It has less memory and is less expandable. The MC6846 timer has disappeared. -The BIOS has been throughly rewritten and uses a more compact call scheme. -This, and the fact that the address map has changed, makes the MO5 completely -TO7 software incompatible (except for pure BASIC programs). -Moreover, the MO5 has incompatible cassette and cartridge formats. -Unlike the TO7, the BASIC 1.0 is integrated and the MO5 can be used "as-is". - -* chips: - - 1 MHz Motorola 6809E CPU - - 1 Motorola 6821 PIA (+3 for I/O, game, and modem extensions) - - Motorola 1300 ALS Gate-Array - -* memory: - - 32 KB base user RAM - - 64 KB extended user RAM (4 x 16 KB banks) with the network extension - (no available to BASIC programs) - - 16 KB combined BASIC and BIOS ROM - - 8 KB color RAM + 8 KB point RAM, bank switched - - 2 to 8 KB floppy ROM comes with the floppy drive / network extension - -* video: - - as the TO7/70 but with different color encoding, - 320x200 pixels with color constraints, 16-color fixed palette - - IN 57-001: TV overlay extension (not implemented) - -* devices: - - AZERTY keyboard, 58-keys, slightlty different from the TO7 - . the right SHIFT key has been replaced with a BASIC key - . no caps-lock led - - the famous lightpen is optional - - cassette 1200 bauds (frequency signals: 0=4.5kHz, 1=6.3kHz), - TO7-incompatible - - optional cartridge, up to 64 KB, incompatible with TO7, - masks the integrated BASIC ROM - - game & music, I/O, floppy, network extensions: identical to TO7 - - speech synthesis extension: identical to TO7 - - MIDIPAK MIDI extension: identical to TO7 - -MO5E (1986) ----- - -This is a special MO5 version for the export market (mainly Germany). -Although coming in a different (nicer) case, it is internally similar to -the MO5 and is fully compatible. -Differences include: - - much better keyboard; some are QWERTY instead of AZERTY (we emulate QWERTY) - - a different BIOS and integrated BASIC - - the game extension is integrated - - -**********************************************************************/ - -static ADDRESS_MAP_START ( mo5, AS_PROGRAM, 8, thomson_state ) - - AM_RANGE ( 0x0000, 0x1fff ) AM_READ_BANK ( THOM_VRAM_BANK ) AM_WRITE(to770_vram_w ) - AM_RANGE ( 0x2000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) - AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) - AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE(mo5_ext_w ) - AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xa7d0, 0xa7df ) AM_READWRITE(to7_floppy_r, to7_floppy_w ) - AM_RANGE ( 0xa7e0, 0xa7e3 ) AM_DEVREADWRITE( "to7_io:pia_2", pia6821_device, read_alt, write_alt ) - AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE(mo5_gatearray_r, mo5_gatearray_w ) - AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) - AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) - AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE("mea8000", mea8000_device, read, write) - AM_RANGE ( 0xb000, 0xefff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE(mo5_cartridge_w ) - AM_RANGE ( 0xf000, 0xffff ) AM_ROM /* system bios */ - -/* 0x10000 - 0x1ffff: 16 KB integrated BASIC / 64 KB external cartridge */ -/* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */ - -/* RAM mapping: - 0x00000 - 0x03fff: 16 KB video RAM - 0x04000 - 0x0bfff: 32 KB unbanked base RAM - 0x0c000 - 0x1bfff: 4 * 16 KB bank extended RAM - */ - -ADDRESS_MAP_END - - - -/* ------------ ROMS ------------ */ - -ROM_START ( mo5 ) - ROM_REGION ( 0x24800, "maincpu", 0 ) - ROM_LOAD ( "mo5.rom", 0xf000, 0x1000, - CRC(f0ea9140) - SHA1(36ce2d3df1866ec2fe368c1c28757e2f5401cf44) ) - ROM_LOAD ( "basic5.rom", 0x11000, 0x3000, - CRC(c2c11b9d) - SHA1(512dd40fb45bc2b51a24c84b3723a32bc8e80c06) ) - ROM_FLOPPY5 ( 0x20000 ) -ROM_END - -ROM_START ( mo5e ) - ROM_REGION ( 0x24800, "maincpu", 0 ) - ROM_LOAD ( "mo5e.rom", 0xf000, 0x1000, - CRC(6520213a) - SHA1(f17a7a59baf2819ec80991b34b204795536a5e01) ) - ROM_LOAD ( "basic5e.rom", 0x11000, 0x3000, - CRC(934a72b2) - SHA1(b37e2b1afbfba368c19be87b3bf61dfe6ad8b0bb) ) - ROM_FLOPPY5 ( 0x20000 ) -ROM_END - - -/* ------------ inputs ------------ */ - -static INPUT_PORTS_START ( mo5 ) - PORT_INCLUDE ( to770 ) - - PORT_MODIFY ( "keyboard.0" ) - KEY ( 1, "BASIC", RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT ( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) - -INPUT_PORTS_END - -/* QWERTY version */ -static INPUT_PORTS_START ( mo5e ) - PORT_INCLUDE ( mo5 ) - - PORT_MODIFY ( "keyboard.1" ) - KEY ( 0, "Z", Z ) PORT_CHAR('Z') - PORT_MODIFY ( "keyboard.2" ) - KEY ( 3, "A", A ) PORT_CHAR('A') - KEY ( 5, "Q", Q ) PORT_CHAR('Q') - PORT_MODIFY ( "keyboard.3" ) - KEY ( 5, "W", W) PORT_CHAR('W') - PORT_MODIFY ( "keyboard.4" ) - KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') - KEY ( 2, "@ \342\206\221", TILDE ) PORT_CHAR('@') PORT_CHAR('^') - KEY ( 6, "0 \302\243 \302\260 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) - PORT_MODIFY ( "keyboard.5" ) - KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') - KEY ( 6, "9 ) \303\261", 9 ) PORT_CHAR('9') PORT_CHAR(')') - PORT_MODIFY ( "keyboard.6" ) - KEY ( 0, "M", M ) PORT_CHAR('M') - KEY ( 6, "8 ( \303\274", 8 ) PORT_CHAR('8') PORT_CHAR('(') - PORT_MODIFY ( "keyboard.7" ) - KEY ( 6, "7 ' \303\266 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') - KEY ( 7, "6 & \303\244", 6 ) PORT_CHAR('6') PORT_CHAR('&') - -INPUT_PORTS_END - -/* ------------ driver ------------ */ - -static MACHINE_CONFIG_DERIVED( mo5, to7 ) - MCFG_MACHINE_START_OVERRIDE( thomson_state, mo5 ) - MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo5 ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP ( mo5) - - MCFG_CASSETTE_MODIFY( "cassette" ) - MCFG_CASSETTE_FORMATS(mo5_cassette_formats) - - MCFG_DEVICE_REMOVE( "mc6846" ) - - MCFG_PALETTE_MODIFY( "palette" ) - MCFG_PALETTE_INIT_OWNER(thomson_state, mo5) - - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, mo5_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(thomson_state, mo5_sys_portb_in)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo5_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, mo5_sys_portb_out)) - MCFG_PIA_CA2_HANDLER(WRITELINE(thomson_state, mo5_set_cassette_motor)) - MCFG_PIA_CB2_HANDLER(NULL) - MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) /* WARNING: differs from TO7 ! */ - - MCFG_DEVICE_REMOVE("cartslot") - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart") - MCFG_GENERIC_EXTENSIONS("m5,rom") - MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge) - - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list","mo5_cart") - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("112K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mo5e, mo5 ) -MACHINE_CONFIG_END - - -COMP ( 1984, mo5, 0, 0, mo5, mo5, driver_device, 0, "Thomson", "MO5", 0 ) - -COMP ( 1986, mo5e, mo5, 0, mo5e, mo5e, driver_device, 0, "Thomson", "MO5E", 0 ) - - -/********************************* TO9 ******************************* - -TO9 (1985) ---- - -The TO9 is the successor of the TO7/70. -It is a high-end product: it integrates 96 KB of base RAM, 128 KB of -software in ROM, a floppy drive. It has improved graphics capabilities -(several video modes, a palette of 4096 colors, thanks to the use of -a dedicated video gate-array). -The ROM contains the old BASIC 1.0 for compatibility and the newer BASIC 128. -It has a more professional, desktop look, with a separate keyboard, and an -optional mouse. -It is also quite compatible with the TO7 and TO7/70 (but not the MO5). -However, it also has many problems. The integrated BASIC 128 can only access -128 KB of memory, which forces the 64 KB extension to be managed as a virtual -disk. The early versions of the software ROM has many bugs. The integrated -floppy drive is one-sided. -It was replaced quickly with the improved TO9+. - -* chips: - - 1 MHz Motorola 6809E CPU - - 1 Motorola 6821 PIA (+2 for game, modem extensions) - - 1 Motorola 6846 timer, PIA - - 1 Motorola 6805 + 1 Motorola 6850 (keyboard & mouse control) - - 1 Western Digital 2793 (disk controller) - - 3 gate-arrays (address decoding, system, video) - -* memory: - - 112 KB base RAM - - 64 KB extension RAM (as virtual disk) - - 6 KB BIOS ROM + 2 KB floppy BIOS - - 128 KB software ROM (BASIC 1, BASIC 128, extended BIOS, - DOS and configuration GUI, two software: "Paragraphe" and - "Fiches et dossiers") - - 16 KB video RAM - -* video: - - 8 video modes: - o 320x200, 16 colors with constraints (TO7/70 compatible) - o 320x200, 4 colors without constraints - o 160x200, 16 colors without constraints - o 640x200, 2 colors - o 320x200, 2 colors, two pages - . page one - . page two - . pages overlaid - o 160x200, 2 colors, four pages overlaid - - palette: 16 colors can be chosen among 4096 - -* devices: - - AZERTY keyboard, 81-keys, French with accents, keypad & function keys - - cartridge, up to 64 KB, TO7 compatible - - two-button mouse connected to the keyboard (not working yet) - - lightpen, with 1-pixel vertical and horizontal resolution - - 1-bit internal buzzer - - cassette 900 bauds, TO7 compatible - - integrated parallel CENTRONICS (printer emulated) - - SX 90-018: game extension (identical to the TO7) - - RF 57-932: RS232 extension (identical to the TO7) - - MD 90-120: MODEM extension (identical to the TO7) - - IEEE extension ? (unemulated) - - floppy: - . integrated floppy controller, based on WD2793 - . integrated one-sided double-density 3''1/2 - . external two-sided double-density 3''1/2, 5''1/4 or QDD (extension) - . floppies are TO7 and MO5 compatible - - speech synthesis extension: identical to TO7 - - MIDIPAK MIDI extension: identical to TO7 - -**********************************************************************/ - -static ADDRESS_MAP_START ( to9, AS_PROGRAM, 8, thomson_state ) - - AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK ) AM_WRITE(to9_cartridge_w )/* 4 * 16 KB */ - AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK ) AM_WRITE(to770_vram_w ) - AM_RANGE ( 0x6000, 0x9fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 16 KB */ - AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 10 * 16 KB */ - AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) - AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) - AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE(to9_floppy_r, to9_floppy_w ) - AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE(to9_vreg_r, to9_vreg_w ) - AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE(to9_kbd_r, to9_kbd_w ) - AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE(to9_gatearray_r, to9_gatearray_w ) - AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) -/* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w ) */ - AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) - AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) - AM_RANGE ( 0xe800, 0xffff ) AM_ROM /* system bios */ - -/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ -/* 0x20000 - 0x3ffff: 128 KB internal software ROM */ -/* 0x40000 - 0x447ff: 18 KB external floppy / network ROM controllers */ - -/* RAM mapping: - 0x00000 - 0x03fff: 16 KB video RAM - 0x04000 - 0x07fff: 16 KB unbanked base RAM - 0x08000 - 0x2ffff: 10 * 16 KB banked extended RAM - */ - -ADDRESS_MAP_END - - - -/* ------------ ROMS ------------ */ - -/* NOT WORKING - these bios seem heavily patched (probably to work with specific emulators - that trap some bios calls) - */ - -ROM_START ( to9 ) - ROM_REGION ( 0x44800, "maincpu", 0 ) - ROM_LOAD ( "to9.rom", 0xe000, 0x2000, /* BIOS & floppy controller */ - CRC(f9278bf7) - SHA1(9e99e6ae0285950f007b19161de642a4031fe46e) ) - - /* BASIC & software */ - ROM_LOAD ( "basic9-0.rom", 0x20000, 0x4000, - CRC(c7bac620) - SHA1(4b2a8b30cf437858ce978ba7b0dfa2bbd57eb38a) ) - ROM_LOAD ( "basic9-1.rom", 0x24000, 0x4000, - CRC(ea5f3e43) - SHA1(5e58a29c2d117fcdb1f5e7ca31dbfffa0f9218f2) ) - ROM_LOAD ( "basic9-2.rom", 0x28000, 0x4000, - CRC(0f5581b3) - SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) - ROM_LOAD ( "basic9-3.rom", 0x2c000, 0x4000, - CRC(6b5b19e3) - SHA1(0e832670c185694d9abbcebcc3ad90e94eed585d) ) - ROM_LOAD ( "soft9-0a.rom", 0x30000, 0x4000, - CRC(8cee157e) - SHA1(f32fc39b95890c00571e9f3fbcc2d8e0596fc4a1) ) - ROM_LOAD ( "soft9-1a.rom", 0x34000, 0x4000, - CRC(cf39ac93) - SHA1(b97e6b7389398e5706624973c11ee7ddba323ce1) ) - ROM_LOAD ( "soft9-0b.rom", 0x38000, 0x4000, - CRC(033aee3f) - SHA1(f3604e500329ec0489b05dbab05530322e9463c5) ) - ROM_LOAD ( "soft9-1b.rom", 0x3c000, 0x4000, - CRC(214fe527) - SHA1(0d8e3f1ca347026e906c3d00a0371e8238c44a60) ) - - ROM_FLOPPY7( 0x40000 ) - - ROM_FILL( 0x10000, 0x10000, 0x39 ) -ROM_END - - -/* ------------ inputs ------------ */ - -static INPUT_PORTS_START ( to9_keyboard ) - PORT_START ( "keyboard.0" ) - KEY ( 0, "F2 F7", F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) - KEY ( 1, "_ 6", 6 ) PORT_CHAR('_') PORT_CHAR('6') - KEY ( 2, "Y", Y ) PORT_CHAR('Y') - KEY ( 3, "H \302\250", H ) PORT_CHAR('H') - KEY ( 4, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) - KEY ( 5, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - KEY ( 6, "Home Clear", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - KEY ( 7, "N", N ) PORT_CHAR('N') - PORT_START ( "keyboard.1" ) - KEY ( 0, "F3 F8", F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) - KEY ( 1, "( 5", 5 ) PORT_CHAR('(') PORT_CHAR('5') - KEY ( 2, "T", T ) PORT_CHAR('T') - KEY ( 3, "G", G ) PORT_CHAR('G') - KEY ( 4, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') - KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - KEY ( 6, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - KEY ( 7, "B \302\264", B ) PORT_CHAR('B') - PORT_START ( "keyboard.2" ) - KEY ( 0, "F4 F9", F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) - KEY ( 1, "' 4", 4 ) PORT_CHAR('\'') PORT_CHAR('4') - KEY ( 2, "R", R ) PORT_CHAR('R') - KEY ( 3, "F", F ) PORT_CHAR('F') - KEY ( 4, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) - KEY ( 5, "Keypad 1", 1_PAD ) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - KEY ( 6, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - KEY ( 7, "V", V ) PORT_CHAR('V') - PORT_START ( "keyboard.3" ) - KEY ( 0, "F5 F10", F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) - KEY ( 1, "\" 3", 3 ) PORT_CHAR('"') PORT_CHAR('3') - KEY ( 2, "E", E ) PORT_CHAR('E') - KEY ( 3, "D", D ) PORT_CHAR('D') - KEY ( 4, "Keypad 7", 7_PAD ) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - KEY ( 5, "Keypad 4", 4_PAD ) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - KEY ( 6, "Keypad 0", 0_PAD ) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - KEY ( 7, "C \136", C ) PORT_CHAR('C') - PORT_START ( "keyboard.4" ) - KEY ( 0, "F1 F6", F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - KEY ( 1, "\303\251 2", 2 ) PORT_CHAR( 0xe9 ) PORT_CHAR('2') - KEY ( 2, "Z", Z ) PORT_CHAR('Z') - KEY ( 3, "S", S ) PORT_CHAR('S') - KEY ( 4, "Keypad 8", 8_PAD ) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - KEY ( 5, "Keypad 2", 2_PAD ) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - KEY ( 6, "Keypad .", DEL_PAD ) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - KEY ( 7, "X", X ) PORT_CHAR('X') - PORT_START ( "keyboard.5" ) - KEY ( 0, "# @", TILDE ) PORT_CHAR('#') PORT_CHAR('@') - KEY ( 1, "* 1", 1 ) PORT_CHAR('*') PORT_CHAR('1') - KEY ( 2, "A \140", A ) PORT_CHAR('A') - KEY ( 3, "Q", Q ) PORT_CHAR('Q') - KEY ( 4, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') - KEY ( 5, "Keypad 5", 5_PAD ) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - KEY ( 6, "Keypad 6", 6_PAD ) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - KEY ( 7, "W", W ) PORT_CHAR('W') - PORT_START ( "keyboard.6" ) - KEY ( 0, "Stop", TAB ) PORT_CHAR(27) - KEY ( 1, "\303\250 7", 7 ) PORT_CHAR( 0xe8 ) PORT_CHAR('7') - KEY ( 2, "U", U ) PORT_CHAR('U') - KEY ( 3, "J", J ) PORT_CHAR('J') - KEY ( 4, "Space", SPACE ) PORT_CHAR(' ') - KEY ( 5, "Keypad 9", 9_PAD ) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - KEY ( 6, "Keypad Enter", ENTER_PAD ) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - KEY ( 7, ", ?", COMMA ) PORT_CHAR(',') PORT_CHAR('?') - PORT_START ( "keyboard.7" ) - KEY ( 0, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - KEY ( 1, "! 8", 8 ) PORT_CHAR('!') PORT_CHAR('8') - KEY ( 2, "I", I ) PORT_CHAR('I') - KEY ( 3, "K", K ) PORT_CHAR('K') - KEY ( 4, "$ &", CLOSEBRACE ) PORT_CHAR('$') PORT_CHAR('&') - KEY ( 5, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - KEY ( 6, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') - KEY ( 7, "; .", STOP ) PORT_CHAR(';') PORT_CHAR('.') - PORT_START ( "keyboard.8" ) - KEY ( 0, "Caps-Lock", CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - KEY ( 1, "\303\247 9", 9 ) PORT_CHAR( 0xe7 ) PORT_CHAR('9') - KEY ( 2, "O", O ) PORT_CHAR('O') - KEY ( 3, "L", L ) PORT_CHAR('L') - KEY ( 4, "- \\", BACKSPACE ) PORT_CHAR('-') PORT_CHAR('\\') - KEY ( 5, "\303\271 %", COLON ) PORT_CHAR( 0xf9 ) PORT_CHAR('%') - KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) - KEY ( 7, ": /", SLASH ) PORT_CHAR(':') PORT_CHAR('/') - PORT_START ( "keyboard.9" ) - KEY ( 0, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - KEY ( 1, "\303\240 0", 0 ) PORT_CHAR( 0xe0 ) PORT_CHAR('0') - KEY ( 2, "P", P ) PORT_CHAR('P') - KEY ( 3, "M", M ) PORT_CHAR('M') - KEY ( 4, ") \302\260", MINUS ) PORT_CHAR(')') PORT_CHAR( 0xb0 ) - KEY ( 5, "\342\206\221 \302\250", OPENBRACE ) PORT_CHAR('^') PORT_CHAR( 0xa8 ) - KEY ( 6, "Keypad 3", 3_PAD ) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - KEY ( 7, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') -INPUT_PORTS_END - -static INPUT_PORTS_START ( to9_fconfig ) - PORT_START ( "fconfig" ) - - PORT_CONFNAME ( 0x07, 0x00, "External floppy (reset)" ) - PORT_CONFSETTING ( 0x00, "No external" ) - PORT_CONFSETTING ( 0x01, "CD 90-015 (5\"1/4 SD)" ) - PORT_CONFSETTING ( 0x02, "CD 90-640 (5\"1/4 DD)" ) - PORT_CONFSETTING ( 0x03, "CD 90-351 (3\"1/2)" ) - PORT_CONFSETTING ( 0x04, "CQ 90-028 (2\"8 QDD)" ) - PORT_CONFSETTING ( 0x05, "Network" ) - - PORT_CONFNAME ( 0xf8, 0x08, "Network ID" ) - PORT_CONFSETTING ( 0x00, "0 (Master)" ) - PORT_CONFSETTING ( 0x08, "1" ) - PORT_CONFSETTING ( 0x10, "2" ) - PORT_CONFSETTING ( 0x18, "3" ) - PORT_CONFSETTING ( 0x20, "4" ) - PORT_CONFSETTING ( 0x28, "5" ) - PORT_CONFSETTING ( 0x30, "6" ) - PORT_CONFSETTING ( 0x38, "7" ) - PORT_CONFSETTING ( 0x40, "8" ) - PORT_CONFSETTING ( 0x48, "9" ) - PORT_CONFSETTING ( 0x50, "10" ) - PORT_CONFSETTING ( 0x58, "11" ) - PORT_CONFSETTING ( 0x60, "12" ) - PORT_CONFSETTING ( 0x68, "13" ) - PORT_CONFSETTING ( 0x70, "14" ) - PORT_CONFSETTING ( 0x78, "15" ) - PORT_CONFSETTING ( 0x80, "16" ) - PORT_CONFSETTING ( 0x88, "17" ) - PORT_CONFSETTING ( 0x90, "18" ) - PORT_CONFSETTING ( 0x98, "19" ) - PORT_CONFSETTING ( 0xa0, "20" ) - PORT_CONFSETTING ( 0xa8, "21" ) - PORT_CONFSETTING ( 0xb0, "22" ) - PORT_CONFSETTING ( 0xb8, "23" ) - PORT_CONFSETTING ( 0xc0, "24" ) - PORT_CONFSETTING ( 0xc8, "25" ) - PORT_CONFSETTING ( 0xd0, "26" ) - PORT_CONFSETTING ( 0xd8, "27" ) - PORT_CONFSETTING ( 0xe0, "28" ) - PORT_CONFSETTING ( 0xe8, "29" ) - PORT_CONFSETTING ( 0xf0, "30" ) - PORT_CONFSETTING ( 0xf8, "31" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START ( to9 ) - PORT_INCLUDE ( thom_lightpen ) - PORT_INCLUDE ( thom_game_port ) - PORT_INCLUDE ( to9_keyboard ) - PORT_INCLUDE ( to7_config ) - PORT_INCLUDE ( to9_fconfig ) - PORT_INCLUDE ( to7_vconfig ) - PORT_INCLUDE ( to7_mconfig ) -INPUT_PORTS_END - -/* ------------ driver ------------ */ - -static MACHINE_CONFIG_DERIVED( to9, to7 ) - MCFG_MACHINE_START_OVERRIDE( thomson_state, to9 ) - MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to9 ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP ( to9) - - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to9_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(NULL) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, to9_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to9_sys_portb_out)) - MCFG_PIA_CB2_HANDLER(NULL) - MCFG_PIA_IRQA_HANDLER(NULL) - - MCFG_DEVICE_MODIFY("mc6846") - MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to9_timer_port_out)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("192K") - MCFG_RAM_EXTRA_OPTIONS("128K") -MACHINE_CONFIG_END - - -COMP ( 1985, to9, 0, 0, to9, to9, driver_device, 0, "Thomson", "TO9", MACHINE_IMPERFECT_COLORS ) - - -/******************************** TO8 ******************************** - -TO8 (1986) ---- - -The TO8 was meant to replace the TO7/70 as a home-computer. -It includes and improves on the technology from the TO9 (improved video, -256 KB of RAM fully managed by the new BASIC 512, more integrated gate-array). -It has a more compact Amiga-like look, no separate keyboard, no integrated -floppy drive (although the controller is integrated), no software in ROM, -less extension slots. Also, the game & music extension is now integrated. -It is quite compatible with the TO7 and TO7/70, and with the TO9 to some -extent. -The TO8 was quite popular and became the de-facto gamming computer in the -Thomson family. - -* chips: - - 1 MHz Motorola 6809E CPU - - 2 Motorola 6821 PIAs (system, game, +1 in modem extension) - - 1 Motorola 6846 timer, PIA - - 1 Motorola 6804 (keyboard) - - 2 gate-arrays (system & video, floppy controller) - -* memory: - - 256 KB base RAM - + 256 KB extended RAM (EM 88-256) = 512 KB total RAM emulated - - 16 KB BIOS ROM - - 64 KB software ROM (BASIC 1, BASIC 512, extended BIOS) - - unified memory view via improved bank switching - -* video: - improved wrt TO9: a 9-th video mode, 4 video pages (shared with main RAM) - border color has its 4-th index bit inverted - -* devices: - - same keyboard as T09: AZERTY 81-keys - (but no 6850 controller, the 6804 is directly connected to the 6821 & 6846) - - cartridge, up to 64 KB, TO7 compatible - - two-button serial mouse (TO9-incompatible) - - lightpen, with 1-pixel vertical and horizontal resolution - - two 8-position 2-button game pads (SX 90-018 extension integrated) - - 6-bit DAC sound (NOTE: 1-bit buzzer is gone) - - cassette 900 bauds, TO7 compatible - - integrated parallel CENTRONICS (printer emulated) - - RF 57-932: RS232 extension (identical to the TO7) - - MD 90-120: MODEM extension (identical to the TO7?) - - IEEE extension ? - - floppy: - . integrated floppy controller, based on custom Thomson gate-array - . no integrated drive - . up to two external two-sided double-density 3"1/2, 5"1/4 or QDD drives - . floppies are TO7 and MO5 compatible - - speech synthesis extension: identical to TO7 - - MIDIPAK MIDI extension: identical to TO7 - -TO8D (1987) ----- - -The TO8D is simply a TO8 with an integrated 3"1/2 floppy drive. - -**********************************************************************/ - - -static ADDRESS_MAP_START ( to8, AS_PROGRAM, 8, thomson_state ) - - AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE(to8_cartridge_w ) /* 4 * 16 KB */ - AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) - AM_RANGE ( 0x6000, 0x7fff ) AM_READ_BANK ( TO8_SYS_LO) AM_WRITE(to8_sys_lo_w ) - AM_RANGE ( 0x8000, 0x9fff ) AM_READ_BANK ( TO8_SYS_HI) AM_WRITE(to8_sys_hi_w ) - AM_RANGE ( 0xa000, 0xbfff ) AM_READ_BANK ( TO8_DATA_LO) AM_WRITE(to8_data_lo_w ) - AM_RANGE ( 0xc000, 0xdfff ) AM_READ_BANK ( TO8_DATA_HI) AM_WRITE(to8_data_hi_w ) - AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) /* 2 * 2 KB */ - AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) - AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE(to8_floppy_r, to8_floppy_w ) - AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE(to8_vreg_r, to8_vreg_w ) - AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE(to8_gatearray_r, to8_gatearray_w ) - AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) -/* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w ) */ - AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) - AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) - AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) /* 2 * 6 KB */ - -/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ -/* 0x20000 - 0x2ffff: 64 KB internal software ROM */ -/* 0x30000 - 0x33fff: 16 KB BIOS ROM */ -/* 0x34000 - 0x387ff: 18 KB external floppy / network ROM controllers */ - -/* RAM mapping: 512 KB flat (including video) */ - -ADDRESS_MAP_END - - -/* ------------ ROMS ------------ */ - -ROM_START ( to8 ) - ROM_REGION ( 0x38800, "maincpu", 0 ) - - /* BIOS & floppy */ - ROM_LOAD ( "to8-0.rom", 0x30000, 0x2000, - CRC(3c4a640a) - SHA1(0a4952f0ca002d82ac83755e1f694d56399413b2) ) - ROM_LOAD ( "to8-1.rom", 0x32000, 0x2000, - CRC(cb9bae2d) - SHA1(a4a55a6e2c74bca15951158c5164970e922fc1c1) ) - - /* BASIC */ - ROM_LOAD ( "basic8-0.rom", 0x20000, 0x4000, - CRC(e5a00fb3) - SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) - ROM_LOAD ( "basic8-1.rom", 0x24000, 0x4000, - CRC(4b241e63) - SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) - ROM_LOAD ( "basic8-2.rom", 0x28000, 0x4000, - CRC(0f5581b3) - SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) - ROM_LOAD ( "basic8-3.rom", 0x2c000, 0x4000, - CRC(f552e7e3) - SHA1(3208e0d7d90241a327ed24e4921303f16e167bd5) ) - - ROM_FLOPPY7( 0x34000 ) - - ROM_FILL( 0x10000, 0x10000, 0x39 ) -ROM_END - -ROM_START ( to8d ) - ROM_REGION ( 0x38800, "maincpu", 0 ) - - /* BIOS & floppy */ - ROM_LOAD ( "to8d-0.rom", 0x30000, 0x2000, - CRC(30ea4950) - SHA1(6705100cd337fffb26ce999302b55fb71557b128) ) - ROM_LOAD ( "to8d-1.rom", 0x32000, 0x2000, - CRC(926cf0ca) - SHA1(8521613ac00e04dd94b69e771aeaefbf4fe97bf7) ) - - /* BASIC */ - ROM_LOAD ( "basic8-0.rom", 0x20000, 0x4000, - CRC(e5a00fb3) - SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) - ROM_LOAD ( "basic8-1.rom", 0x24000, 0x4000, - CRC(4b241e63) - SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) - ROM_LOAD ( "basic8-2.rom", 0x28000, 0x4000, - CRC(0f5581b3) - SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) - ROM_LOAD ( "basic8-3.rom", 0x2c000, 0x4000, - CRC(f552e7e3) - SHA1(3208e0d7d90241a327ed24e4921303f16e167bd5) ) - - ROM_FLOPPY7( 0x34000 ) - - ROM_FILL( 0x10000, 0x10000, 0x39 ) -ROM_END - - -/* ------------ inputs ------------ */ - -static INPUT_PORTS_START ( to8_config ) - PORT_START ( "config" ) - - PORT_CONFNAME ( 0x01, 0x00, "Game Port" ) - PORT_CONFSETTING ( 0x00, DEF_STR( Joystick ) ) - PORT_CONFSETTING ( 0x01, "Mouse" ) - - PORT_CONFNAME ( 0x02, 0x00, "Keyboard" ) - PORT_CONFSETTING ( 0x00, "Enabled" ) - PORT_CONFSETTING ( 0x02, "Disabled" ) - -INPUT_PORTS_END - - -static INPUT_PORTS_START ( to8 ) - PORT_INCLUDE ( thom_lightpen ) - PORT_INCLUDE ( thom_game_port ) - PORT_INCLUDE ( to9_keyboard ) - PORT_INCLUDE ( to8_config ) - PORT_INCLUDE ( to9_fconfig ) - PORT_INCLUDE ( to7_vconfig ) - PORT_INCLUDE ( to7_mconfig ) -INPUT_PORTS_END - - -static INPUT_PORTS_START ( to8d ) - PORT_INCLUDE ( to8 ) -INPUT_PORTS_END - -/* ------------ driver ------------ */ - -static MACHINE_CONFIG_DERIVED( to8, to7 ) - MCFG_MACHINE_START_OVERRIDE( thomson_state, to8 ) - MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to8 ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP ( to8) - - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to8_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(NULL) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, to9_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to8_sys_portb_out)) - MCFG_PIA_CB2_HANDLER(NULL) - MCFG_PIA_IRQA_HANDLER(NULL) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) - - MCFG_DEVICE_MODIFY("mc6846") - MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to8_timer_port_out)) - MCFG_MC6846_OUT_CP2_CB(WRITE8(thomson_state, to8_timer_cp2_out)) - MCFG_MC6846_IN_PORT_CB(READ8(thomson_state, to8_timer_port_in)) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") - MCFG_RAM_EXTRA_OPTIONS("256K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( to8d, to8 ) -MACHINE_CONFIG_END - - -COMP ( 1986, to8, 0, 0, to8, to8, driver_device, 0, "Thomson", "TO8", 0 ) - -COMP ( 1987, to8d, to8, 0, to8d, to8d, driver_device, 0, "Thomson", "TO8D", 0 ) - - -/******************************** TO9+ ******************************* - -TO9+ (1986) ----- - -The TO9+ is the direct successor of the T09 as Thomson's high-end -product: desktop look, 512 KB of RAM, integrated floppy drive and -modem. Some software integrated in ROM on the TO9 are now supplied on -floppies. -Internally, the TO9+ is based more on TO8 technology than T09 -(same gate-arrays). -It has enhanced communication capabilities by integrating either the -MODEM or the RS232 extension. -It should be compatible with the TO9 and, to some extent, with the TO7, TO7/70 -and TO8. -It uses the same video gate-array and floppy controller. - -The differences with the TO8 are: - -* chips: - - 1 Motorola 6805 + 1 Motorola 6850 (keyboard) - - 3 Motorola 6821 PIAs (system, game, modem) - -* memory: - - 512 KB RAM (not extendable) - -* devices: - - same keyboard as T08/TO9 (AZERTY 81-keys) but different controller - - RF 57-932: RS232 (identical to the TO7) sometimes integrated - - MD 90-120: MODEM (identical to the TO7?) sometimes integrated - - IEEE extension ? - - floppy: one two-sided double-density 3''1/2 floppy drive is integrated - - RS 52-932 RS232 extension ? - - digitisation extension - -**********************************************************************/ - -static ADDRESS_MAP_START ( to9p, AS_PROGRAM, 8, thomson_state ) - - AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE(to8_cartridge_w ) /* 4 * 16 KB */ - AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) - AM_RANGE ( 0x6000, 0x7fff ) AM_READ_BANK ( TO8_SYS_LO) AM_WRITE(to8_sys_lo_w ) - AM_RANGE ( 0x8000, 0x9fff ) AM_READ_BANK ( TO8_SYS_HI) AM_WRITE(to8_sys_hi_w ) - AM_RANGE ( 0xa000, 0xbfff ) AM_READ_BANK ( TO8_DATA_LO) AM_WRITE(to8_data_lo_w ) - AM_RANGE ( 0xc000, 0xdfff ) AM_READ_BANK ( TO8_DATA_HI) AM_WRITE(to8_data_hi_w ) - AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) /* 2 * 2 KB */ - AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) - AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE(to8_floppy_r, to8_floppy_w ) - AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE(to8_vreg_r, to8_vreg_w ) - AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE(to9_kbd_r, to9_kbd_w ) - AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE(to8_gatearray_r, to8_gatearray_w ) - AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) -/* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w ) */ - AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) - AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE(to7_modem_mea8000_r, to7_modem_mea8000_w ) - AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) /* 2 * 6 KB */ - -/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ -/* 0x20000 - 0x2ffff: 64 KB internal software ROM */ -/* 0x30000 - 0x33fff: 16 KB BIOS ROM */ -/* 0x34000 - 0x387ff: 18 KB external floppy / network ROM controllers */ - -/* RAM mapping: 512 KB flat (including video) */ - -ADDRESS_MAP_END - - -/* ------------ ROMS ------------ */ - -ROM_START ( to9p ) - ROM_REGION ( 0x38800, "maincpu", 0 ) - - /* BIOS & floppy */ - ROM_LOAD ( "to9p-0.rom", 0x30000, 0x2000, - CRC(a2731296) - SHA1(b30e06127d6e99d4ac5a5bb67881df27bbd9a7e5) ) - ROM_LOAD ( "to9p-1.rom", 0x32000, 0x2000, - CRC(c52ce315) - SHA1(7eacbd796e76bc72b872f9700c9b90414899ea0f) ) - - /* BASIC */ - ROM_LOAD ( "basicp-0.rom", 0x20000, 0x4000, - CRC(e5a00fb3) - SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) - ROM_LOAD ( "basicp-1.rom", 0x24000, 0x4000, - CRC(4b241e63) - SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) - ROM_LOAD ( "basicp-2.rom", 0x28000, 0x4000, - CRC(0f5581b3) - SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) - ROM_LOAD ( "basicp-3.rom", 0x2c000, 0x4000, - CRC(ebe9c8d9) - SHA1(b667ad09a1181f65059a2cbb4c95421bc544a334) ) - - ROM_FLOPPY7( 0x34000 ) - - ROM_FILL( 0x10000, 0x10000, 0x39 ) -ROM_END - - -/* ------------ inputs ------------ */ - -static INPUT_PORTS_START ( to9p ) - PORT_INCLUDE ( thom_lightpen ) - PORT_INCLUDE ( thom_game_port ) - PORT_INCLUDE ( to9_keyboard ) - PORT_INCLUDE ( to7_config ) - PORT_INCLUDE ( to9_fconfig ) - PORT_INCLUDE ( to7_vconfig ) - PORT_INCLUDE ( to7_mconfig ) -INPUT_PORTS_END - -/* ------------ driver ------------ */ - -static MACHINE_CONFIG_DERIVED( to9p, to7 ) - MCFG_MACHINE_START_OVERRIDE( thomson_state, to9p ) - MCFG_MACHINE_RESET_OVERRIDE( thomson_state, to9p ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP ( to9p) - - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, to9_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(NULL) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, to9_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, to8_sys_portb_out)) - MCFG_PIA_CB2_HANDLER(NULL) - MCFG_PIA_IRQA_HANDLER(NULL) - MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_firq_1)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) - - MCFG_DEVICE_MODIFY("mc6846") - MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to9p_timer_port_out)) - MCFG_MC6846_OUT_CP2_CB(WRITE8(thomson_state, to8_timer_cp2_out)) - MCFG_MC6846_IN_PORT_CB(READ8(thomson_state, to9p_timer_port_in)) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("512K") -MACHINE_CONFIG_END - -COMP ( 1986, to9p, 0, 0, to9p, to9p, driver_device, 0, "Thomson", "TO9+", 0 ) - - - -/******************************** MO6 ******************************** - -MO6 (1986) ---- - -The MO6 is the (long awaited) successor to the MO5. -It is based on TO8 technology (same system & video gate-array). -However, it is lower-end and cheaper: less memory (128 KB RAM, not -extensible), no floppy controller but an integrated cassette recorder. -The MO6 is MO5 compatible, but not compatible with the TO family. - -* chips: - - 1 MHz Motorola 6809E CPU - - 2 Motorola 6821 PIAs (system, game) - - 1 gate-array (system & video, identical to the TO8) - -* memory: - - 128 KB RAM (not extendable) - - 8 KB BIOS ROM - - 24 KB BASIC 1 ROM - - 32 KB BASIC 128 & extended BIOS ROM - -* video: - all modes from the TO8, but the TO7/70-compatible mode is replaced with - an MO5-compatible one - -* devices: - - AZERTY keyboard, 69 keys, no keyboard controller (scanning is done - periodically by the 6809) - - MO5-compatible cartridge - - two-button mouse (TO8-like) - - optional lightpen - - integrated game port (similar to SX 90-018) - . 6-bit DAC sound - . two 8-position 2-button game pads - . two-button mouse - - integrated cassette reader 1200 bauds (MO5 compatible) and 2400 bauds - - parallel CENTRONICS (printer emulated) - - RF 57-932: RS232 extension (identical to the TO7), or RF 90-932 (???) - - IEEE extension ? - - no integrated controller, but external TO7 floppy controllers & drives - are possible - - speech synthesis extension: identical to TO7 ? - - MIDIPAK MIDI extension: identical to TO7 ? - - -Olivetti Prodest PC 128 (1986) ------------------------ - -Italian version of the MO6, built by Thomson and sold by Olivetti. -Except from the ROM, it is very similar to the MO6. -Do not confuse with the Olivetti Prodest PC 128 Systema (or 128s) which is -based on the Acorn BBC Master Compact. Or with the Olivetti PC 1, which is -a PC XT. - - -**********************************************************************/ - -static ADDRESS_MAP_START ( mo6, AS_PROGRAM, 8, thomson_state ) - - AM_RANGE ( 0x0000, 0x1fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) - AM_RANGE ( 0x2000, 0x3fff ) AM_READ_BANK ( TO8_SYS_LO) AM_WRITE(to8_sys_lo_w ) - AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( TO8_SYS_HI) AM_WRITE(to8_sys_hi_w ) - AM_RANGE ( 0x6000, 0x7fff ) AM_READ_BANK ( TO8_DATA_LO) AM_WRITE(to8_data_lo_w ) - AM_RANGE ( 0x8000, 0x9fff ) AM_READ_BANK ( TO8_DATA_HI) AM_WRITE(to8_data_hi_w ) - AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) - AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE(mo6_ext_w ) - AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE(to7_floppy_r, to7_floppy_w ) - AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE(mo6_vreg_r, mo6_vreg_w ) - AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE(mo6_gatearray_r, mo6_gatearray_w ) - AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) -/* AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w )*/ - AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) - AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE("mea8000", mea8000_device, read, write) - AM_RANGE ( 0xb000, 0xbfff ) AM_ROMBANK ( MO6_CART_LO ) - AM_WRITE ( mo6_cartridge_w ) - AM_RANGE ( 0xc000, 0xefff ) AM_ROMBANK ( MO6_CART_HI ) - AM_WRITE ( mo6_cartridge_w ) - AM_RANGE ( 0xf000, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) - -/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ -/* 0x20000 - 0x2ffff: 64 KB BIOS ROM */ -/* 0x30000 - 0x347ff: 16 KB floppy / network ROM controllers */ - -/* RAM mapping: 128 KB flat (including video) */ - -ADDRESS_MAP_END - - -/* ------------ ROMS ------------ */ - -ROM_START ( mo6 ) - ROM_REGION ( 0x34800, "maincpu", 0 ) - - /* BIOS */ - ROM_LOAD ( "mo6-0.rom", 0x23000, 0x1000, - CRC(0446eef6) - SHA1(b57fcda69c95f0c97c5cb0605d17c49a0c630300) ) - ROM_LOAD ( "mo6-1.rom", 0x27000, 0x1000, - CRC(eb6df8d4) - SHA1(24e2232f582ce04f260acd8e9ec710468a81505c) ) - - /* BASIC */ - ROM_LOAD ( "basic6-0.rom", 0x20000, 0x3000, - CRC(18789833) - SHA1(fccbf69cbc6deba45a767a26cd6454cf0eedfc2b) ) - ROM_LOAD ( "basic6-1.rom", 0x24000, 0x3000, - CRC(c9b4d6f4) - SHA1(47487d2bc4c9a9c09c733bd89c49693c52e262de) ) - ROM_LOAD ( "basic6-2.rom", 0x28000, 0x4000, - CRC(08eac9bb) - SHA1(c0231fdb3bcccbbb10c1f93cc529fc3b96dd3f4d) ) - ROM_LOAD ( "basic6-3.rom", 0x2c000, 0x4000, - CRC(19d66dc4) - SHA1(301b6366269181b74cb5d7ccdf5455b7290ae99b) ) - - ROM_FLOPPY5 ( 0x30000 ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) -ROM_END - -ROM_START ( pro128 ) - ROM_REGION ( 0x34800, "maincpu", 0 ) - - /* BIOS */ - ROM_LOAD ( "pro128-0.rom", 0x23000, 0x1000, - CRC(a8aef291) - SHA1(2685cca841f405a37ef48b0115f90c865ce79d0f) ) - ROM_LOAD ( "pro128-1.rom", 0x27000, 0x1000, - CRC(5b3340ec) - SHA1(269f2eb3e3452014b8d1f0f9e1c63fe56375a863) ) - - /* BASIC */ - ROM_LOAD ( "basico-0.rom", 0x20000, 0x3000, - CRC(98b10d5e) - SHA1(d6b77e694fa85e1114293448e5a64f6e2cf46c22) ) - ROM_LOAD ( "basico-1.rom", 0x24000, 0x3000, - CRC(721d2124) - SHA1(51db1cd03b3891e212a24aa6563b09968930d897) ) - ROM_LOAD ( "basico-2.rom", 0x28000, 0x4000, - CRC(135438ab) - SHA1(617d4e4979842bea2c21ef7f8c50f3b08b15239a) ) - ROM_LOAD ( "basico-3.rom", 0x2c000, 0x4000, - CRC(2c2befa6) - SHA1(3e94e182bacbb55bb07be2af4c76c0b0df47b3bf) ) - - ROM_FLOPPY5 ( 0x30000 ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) -ROM_END - - -/* ------------ inputs ------------ */ - -static INPUT_PORTS_START ( mo6_keyboard ) - - PORT_START ( "keyboard.0" ) - KEY ( 0, "N", N ) PORT_CHAR('N') - KEY ( 1, ", ?", COMMA ) PORT_CHAR(',') PORT_CHAR('?') - KEY ( 2, "; .", STOP ) PORT_CHAR(';') PORT_CHAR('.') - KEY ( 3, "# @", TILDE ) PORT_CHAR('#') PORT_CHAR('@') - KEY ( 4, "Space", SPACE ) PORT_CHAR(' ') - KEY ( 5, "X", X ) PORT_CHAR('X') - KEY ( 6, "W", W ) PORT_CHAR('W') - KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START ( "keyboard.1" ) - KEY ( 0, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - KEY ( 2, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') - KEY ( 3, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - KEY ( 4, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - KEY ( 6, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) - KEY ( 7, "BASIC", RCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_START ( "keyboard.2" ) - KEY ( 0, "J", J ) PORT_CHAR('J') - KEY ( 1, "K", K ) PORT_CHAR('K') - KEY ( 2, "L", L ) PORT_CHAR('L') - KEY ( 3, "M", M ) PORT_CHAR('M') - KEY ( 4, "B \302\264", B ) PORT_CHAR('B') - KEY ( 5, "V", V ) PORT_CHAR('V') - KEY ( 6, "C \136", C ) PORT_CHAR('C') - KEY ( 7, "Caps-Lock", CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_START ( "keyboard.3" ) - KEY ( 0, "H \302\250", H ) PORT_CHAR('H') - KEY ( 1, "G", G ) PORT_CHAR('G') - KEY ( 2, "F", F ) PORT_CHAR('F') - KEY ( 3, "D", D ) PORT_CHAR('D') - KEY ( 4, "S", S ) PORT_CHAR('S') - KEY ( 5, "Q", Q ) PORT_CHAR('Q') - KEY ( 6, "Home Clear", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - KEY ( 7, "F1 F6", F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_START ( "keyboard.4" ) - KEY ( 0, "U", U ) PORT_CHAR('U') - KEY ( 1, "I", I ) PORT_CHAR('I') - KEY ( 2, "O", O ) PORT_CHAR('O') - KEY ( 3, "P", P ) PORT_CHAR('P') - KEY ( 4, ": /", SLASH ) PORT_CHAR(':') PORT_CHAR('/') - KEY ( 5, "$ &", CLOSEBRACE ) PORT_CHAR('$') PORT_CHAR('&') - KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) - KEY ( 7, "F2 F7", F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_START ( "keyboard.5" ) - KEY ( 0, "Y", Y ) PORT_CHAR('Y') - KEY ( 1, "T", T ) PORT_CHAR('T') - KEY ( 2, "R", R ) PORT_CHAR('R') - KEY ( 3, "E", E ) PORT_CHAR('E') - KEY ( 4, "Z", Z ) PORT_CHAR('Z') - KEY ( 5, "A \140", A ) PORT_CHAR('A') - KEY ( 6, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - KEY ( 7, "F3 F8", F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_START ( "keyboard.6" ) - KEY ( 0, "7 \303\250", 7 ) PORT_CHAR('7') PORT_CHAR( 0xe8 ) - KEY ( 1, "8 !", 8 ) PORT_CHAR('8') PORT_CHAR('!') - KEY ( 2, "9 \303\247", 9 ) PORT_CHAR('9') PORT_CHAR( 0xe7 ) - KEY ( 3, "0 \303\240", 0 ) PORT_CHAR('0') PORT_CHAR( 0xe0 ) - KEY ( 4, "- \\", BACKSPACE ) PORT_CHAR('-') PORT_CHAR('\\') - KEY ( 5, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') - KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) - KEY ( 7, "F4 F9", F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_START ( "keyboard.7" ) - KEY ( 0, "6 _", 6 ) PORT_CHAR('6') PORT_CHAR('_') - KEY ( 1, "5 (", 5 ) PORT_CHAR('5') PORT_CHAR('(') - KEY ( 2, "4 '", 4 ) PORT_CHAR('4') PORT_CHAR('\'') - KEY ( 3, "3 \"", 3 ) PORT_CHAR('3') PORT_CHAR('"') - KEY ( 4, "2 \303\251", 2 ) PORT_CHAR('2') PORT_CHAR( 0xe9 ) - KEY ( 5, "1 *", 1 ) PORT_CHAR('1') PORT_CHAR('*') - KEY ( 6, "Stop", TAB ) PORT_CHAR(27) - KEY ( 7, "F5 F10", F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_START ( "keyboard.8" ) - KEY ( 0, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') - KEY ( 1, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') - KEY ( 2, ") \302\260", MINUS ) PORT_CHAR(')') PORT_CHAR( 0xb0 ) - KEY ( 3, "\342\206\221 \302\250", OPENBRACE ) PORT_CHAR('^') PORT_CHAR( 0xa8 ) - KEY ( 4, "\303\271 %", COLON ) PORT_CHAR( 0xf9 ) PORT_CHAR('%') - PORT_BIT ( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - /* unused */ - PORT_START ( "keyboard.9" ) - -INPUT_PORTS_END - -/* QWERTY version */ -static INPUT_PORTS_START ( pro128_keyboard ) - PORT_INCLUDE ( mo6_keyboard ) - - PORT_MODIFY ( "keyboard.0" ) - KEY ( 1, "M", M ) PORT_CHAR('M') - KEY ( 2, ", ;", COMMA ) PORT_CHAR(',') PORT_CHAR(';') - KEY ( 3, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') - KEY ( 6, "Z", Z ) PORT_CHAR('Z') - KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_MODIFY ( "keyboard.1" ) - KEY ( 2, "- _", MINUS ) PORT_CHAR('-') PORT_CHAR('_') - PORT_MODIFY ( "keyboard.2" ) - KEY ( 3, "\303\221", TILDE ) PORT_CHAR( 0xd1 ) - PORT_MODIFY ( "keyboard.3" ) - KEY ( 5, "A \140", A ) PORT_CHAR('A') - PORT_MODIFY ( "keyboard.4" ) - KEY ( 4, ". :", STOP ) PORT_CHAR('.') PORT_CHAR(':') - KEY ( 5, "+ *", BACKSPACE ) PORT_CHAR('+') PORT_CHAR('*') - PORT_MODIFY ( "keyboard.5" ) - KEY ( 4, "W", W ) PORT_CHAR('W') - KEY ( 5, "Q", Q ) PORT_CHAR('Q') - PORT_MODIFY ( "keyboard.6" ) - KEY ( 0, "7 /", 7 ) PORT_CHAR('7') PORT_CHAR('/') - KEY ( 1, "8 (", 8 ) PORT_CHAR('8') PORT_CHAR('(') - KEY ( 2, "9 )", 9 ) PORT_CHAR('9') PORT_CHAR(')') - KEY ( 3, "0 =", 0 ) PORT_CHAR('0') PORT_CHAR('=') - KEY ( 4, "' \302\243", CLOSEBRACE ) PORT_CHAR('\'') PORT_CHAR( 0xa3 ) - KEY ( 5, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') - PORT_MODIFY ( "keyboard.7" ) - KEY ( 0, "6 &", 6 ) PORT_CHAR('6') PORT_CHAR('&') - KEY ( 1, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') - KEY ( 2, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') - KEY ( 3, "3 \302\247", 3 ) PORT_CHAR('3') PORT_CHAR( 0xa7 ) - KEY ( 4, "2 \"", 2 ) PORT_CHAR('2') PORT_CHAR('"') - KEY ( 5, "1 !", 1 ) PORT_CHAR('1') PORT_CHAR('!') - PORT_MODIFY ( "keyboard.8" ) - KEY ( 0, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') - KEY ( 1, "# \342\206\221", EQUALS ) PORT_CHAR('#') PORT_CHAR('^') - KEY ( 2, "\303\247 ?", COLON ) PORT_CHAR( 0xe7 ) PORT_CHAR('?') - KEY ( 3, "\302\277 @", SLASH ) PORT_CHAR( 0xbf ) PORT_CHAR('@') - KEY ( 4, "\302\241 \302\250", OPENBRACE ) PORT_CHAR( 0xa1 ) PORT_CHAR( 0xa8 ) - -INPUT_PORTS_END - - -static INPUT_PORTS_START ( mo6 ) - PORT_INCLUDE ( thom_lightpen ) - PORT_INCLUDE ( thom_game_port ) - PORT_INCLUDE ( mo6_keyboard ) - PORT_INCLUDE ( to7_config ) - PORT_INCLUDE ( to7_fconfig ) - PORT_INCLUDE ( to7_vconfig ) -INPUT_PORTS_END - -static INPUT_PORTS_START ( pro128 ) - PORT_INCLUDE ( thom_lightpen ) - PORT_INCLUDE ( thom_game_port ) - PORT_INCLUDE ( pro128_keyboard ) - PORT_INCLUDE ( to7_config ) - PORT_INCLUDE ( to7_fconfig ) - PORT_INCLUDE ( to7_vconfig ) -INPUT_PORTS_END - - -/* ------------ driver ------------ */ - -static MACHINE_CONFIG_DERIVED( mo6, to7 ) - MCFG_MACHINE_START_OVERRIDE( thomson_state, mo6 ) - MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo6 ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP ( mo6) - - MCFG_CASSETTE_MODIFY( "cassette" ) - MCFG_CASSETTE_FORMATS(mo5_cassette_formats) - - MCFG_DEVICE_REMOVE( "mc6846" ) - - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, mo6_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(thomson_state, mo6_sys_portb_in)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo6_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, mo6_sys_portb_out)) - MCFG_PIA_CA2_HANDLER(WRITELINE(thomson_state, mo5_set_cassette_motor)) - MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, mo6_sys_cb2_out)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) /* differs from TO */ - - MCFG_DEVICE_MODIFY(THOM_PIA_GAME) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo6_game_porta_out)) - MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, mo6_game_cb2_out)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_REMOVE("cartslot") - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart") - MCFG_GENERIC_EXTENSIONS("m5,rom") - MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pro128, mo6 ) -MACHINE_CONFIG_END - -COMP ( 1986, mo6, 0, 0, mo6, mo6, driver_device, 0, "Thomson", "MO6", 0 ) - -COMP ( 1986, pro128, mo6, 0, pro128, pro128, driver_device, 0, "Olivetti / Thomson", "Prodest PC 128", 0 ) - - - - -/****************************** MO5NR ******************************** - -MO5 NR (1986) ------- - -Despite its name, the MO5 NR is much more related to the MO6 than to the MO5. -It can be though as the network-enhanced version of the MO6. -It is both MO5 and MO6 compatible (but not TO-compatible). - -Here are the differences between the MO6 and MO5NR: - -* chips: - - integrated MC 6854 network controller - -* memory: - - extra 2 KB ROM for the integrated network controller, - can be masked by the ROM from the external floppy controller - -* video: identical - -* devices: - - AZERTY keyboard has only 58 keys, and no caps-lock led - - CENTRONICS printer handled differently - - MO5-compatible network (probably identical to NR 07-005 extension) - - extern floppy controller & drive possible, masks the network - -**********************************************************************/ - -static ADDRESS_MAP_START ( mo5nr, AS_PROGRAM, 8, thomson_state ) - - AM_RANGE ( 0x0000, 0x1fff ) AM_READ_BANK ( THOM_VRAM_BANK) AM_WRITE(to770_vram_w ) - AM_RANGE ( 0x2000, 0x3fff ) AM_READ_BANK ( TO8_SYS_LO) AM_WRITE(to8_sys_lo_w ) - AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( TO8_SYS_HI) AM_WRITE(to8_sys_hi_w ) - AM_RANGE ( 0x6000, 0x7fff ) AM_READ_BANK ( TO8_DATA_LO) AM_WRITE(to8_data_lo_w ) - AM_RANGE ( 0x8000, 0x9fff ) AM_READ_BANK ( TO8_DATA_HI) AM_WRITE(to8_data_hi_w ) - AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) - AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE(mo6_ext_w ) - AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE( "pia_1", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE(mo5nr_net_r, mo5nr_net_w ) - AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE(mo6_vreg_r, mo6_vreg_w ) - AM_RANGE ( 0xa7e1, 0xa7e1 ) AM_DEVREAD("cent_data_in", input_buffer_device, read) - AM_RANGE ( 0xa7e1, 0xa7e1 ) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE ( 0xa7e3, 0xa7e3 ) AM_READWRITE(mo5nr_prn_r, mo5nr_prn_w ) - AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE(mo6_gatearray_r, mo6_gatearray_w ) - AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE( "acia", mos6551_device, read, write ) -/* AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE(to9_ieee_r, to9_ieee_w ) */ - AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE(to7_midi_r, to7_midi_w ) - AM_RANGE ( 0xa7f8, 0xa7fb ) AM_DEVREADWRITE( "pia_3", pia6821_device, read_alt, write_alt) - AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE("mea8000", mea8000_device, read, write) - AM_RANGE ( 0xb000, 0xbfff ) AM_ROMBANK ( MO6_CART_LO ) - AM_WRITE ( mo6_cartridge_w ) - AM_RANGE ( 0xc000, 0xefff ) AM_ROMBANK ( MO6_CART_HI ) - AM_WRITE ( mo6_cartridge_w ) - AM_RANGE ( 0xf000, 0xffff ) AM_ROMBANK ( TO8_BIOS_BANK ) - -/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ -/* 0x20000 - 0x2ffff: 64 KB BIOS ROM */ -/* 0x30000 - 0x347ff: 16 KB floppy / network ROM controllers */ - -/* RAM mapping: 128 KB flat (including video) */ - -ADDRESS_MAP_END - - -/* ------------ ROMS ------------ */ - -ROM_START ( mo5nr ) - ROM_REGION ( 0x34800, "maincpu", 0 ) - - /* BIOS */ - ROM_LOAD ( "mo5nr-0.rom", 0x23000, 0x1000, - CRC(06e31115) - SHA1(7429cc0c15475398b5ab514cb3d3efdc71cf082f) ) - ROM_LOAD ( "mo5nr-1.rom", 0x27000, 0x1000, - CRC(7cda17c9) - SHA1(2ff6480ce9e30acc4c89b6113d7c8ea6095d90a5) ) - - /* BASIC */ - ROM_LOAD ( "basicn-0.rom", 0x20000, 0x3000, - CRC(fae9e691) - SHA1(62fbfd6d4ca837f6cb8ed37f828eca97f80e6200) ) - ROM_LOAD ( "basicn-1.rom", 0x24000, 0x3000, - CRC(cf134dd7) - SHA1(1bd961314e16e460d37a65f5e7f4acf5604fbb17) ) - ROM_LOAD ( "basicn-2.rom", 0x28000, 0x4000, - CRC(b69d2e0d) - SHA1(ea3220bbae991e08259d38a7ea24533b2bb86418) ) - ROM_LOAD ( "basicn-3.rom", 0x2c000, 0x4000, - CRC(7785610f) - SHA1(c38b0be404d8af6f409a1b52cb79a4e10fc33177) ) - - ROM_FLOPPY5 ( 0x30000 ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) /* TODO: network ROM */ -ROM_END - - - - -/* ------------ inputs ------------ */ - -static INPUT_PORTS_START ( mo5nr_keyboard ) - - PORT_START ( "keyboard.0" ) - KEY ( 0, "N", N ) PORT_CHAR('N') - KEY ( 1, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') - KEY ( 2, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') - KEY ( 3, "@ \342\206\221", TILDE ) PORT_CHAR('@') PORT_CHAR('^') - KEY ( 4, "Space Caps-Lock", SPACE ) PORT_CHAR(' ') PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - KEY ( 5, "X", X ) PORT_CHAR('X') - KEY ( 6, "W", W ) PORT_CHAR('W') - KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START ( "keyboard.1" ) - KEY ( 0, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - KEY ( 2, "Home", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - KEY ( 3, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - KEY ( 4, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - KEY ( 6, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) - KEY ( 7, "BASIC", RCONTROL ) - PORT_START ( "keyboard.2" ) - KEY ( 0, "J", J ) PORT_CHAR('J') - KEY ( 1, "K", K ) PORT_CHAR('K') - KEY ( 2, "L", L ) PORT_CHAR('L') - KEY ( 3, "M", M ) PORT_CHAR('M') - KEY ( 4, "B \140", B ) PORT_CHAR('B') - KEY ( 5, "V", V ) PORT_CHAR('V') - KEY ( 6, "C \136", C ) PORT_CHAR('C') - PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard.3" ) - KEY ( 0, "H \302\250", H ) PORT_CHAR('H') - KEY ( 1, "G", G ) PORT_CHAR('G') - KEY ( 2, "F", F ) PORT_CHAR('F') - KEY ( 3, "D", D ) PORT_CHAR('D') - KEY ( 4, "S", S ) PORT_CHAR('S') - KEY ( 5, "Q", Q ) PORT_CHAR('Q') - KEY ( 6, "Clear", ESC ) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard.4" ) - KEY ( 0, "U", U ) PORT_CHAR('U') - KEY ( 1, "I", I ) PORT_CHAR('I') - KEY ( 2, "O", O ) PORT_CHAR('O') - KEY ( 3, "P", P ) PORT_CHAR('P') - KEY ( 4, "/ ?", SLASH ) PORT_CHAR('/') PORT_CHAR('?') - KEY ( 5, "* :", QUOTE ) PORT_CHAR('*') PORT_CHAR(':') - KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) - PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard.5" ) - KEY ( 0, "Y", Y ) PORT_CHAR('Y') - KEY ( 1, "T", T ) PORT_CHAR('T') - KEY ( 2, "R", R ) PORT_CHAR('R') - KEY ( 3, "E", E ) PORT_CHAR('E') - KEY ( 4, "Z", Z ) PORT_CHAR('Z') - KEY ( 5, "A \140", A ) PORT_CHAR('A') - KEY ( 6, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard.6" ) - KEY ( 0, "7 ' \303\250", 7 ) PORT_CHAR('7') PORT_CHAR('\'' ) - KEY ( 1, "8 ( \303\271", 8 ) PORT_CHAR('8') PORT_CHAR('(') - KEY ( 2, "9 ) \303\247", 9 ) PORT_CHAR('9') PORT_CHAR(')') - KEY ( 3, "0 \303\240", 0 ) PORT_CHAR('0') PORT_CHAR( 0xe0 ) - KEY ( 4, "- =", MINUS ) PORT_CHAR('-') PORT_CHAR('=') - KEY ( 5, "+ ;", EQUALS ) PORT_CHAR('+') PORT_CHAR(';') - KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard.7" ) - KEY ( 0, "6 & \303\251", 6 ) PORT_CHAR('6') PORT_CHAR('&') - KEY ( 1, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') - KEY ( 2, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') - KEY ( 3, "3 #", 3 ) PORT_CHAR('3') PORT_CHAR('#') - KEY ( 4, "2 \"", 2 ) PORT_CHAR('2') PORT_CHAR('"') - KEY ( 5, "1 !", 1 ) PORT_CHAR('1') PORT_CHAR('!') - KEY ( 6, "Stop", TAB ) PORT_CHAR(27) - PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - /* unused */ - PORT_START ( "keyboard.8" ) - PORT_START ( "keyboard.9" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START ( mo5nr ) - PORT_INCLUDE ( thom_lightpen ) - PORT_INCLUDE ( thom_game_port ) - PORT_INCLUDE ( mo5nr_keyboard ) - PORT_INCLUDE ( to7_config ) - PORT_INCLUDE ( to7_fconfig ) - PORT_INCLUDE ( to7_vconfig ) -INPUT_PORTS_END - - -/* ------------ driver ------------ */ - -static MACHINE_CONFIG_DERIVED( mo5nr, to7 ) - MCFG_MACHINE_START_OVERRIDE( thomson_state, mo5nr ) - MCFG_MACHINE_RESET_OVERRIDE( thomson_state, mo5nr ) - - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP ( mo5nr) - - MCFG_DEVICE_REMOVE( "mc6846" ) - - MCFG_DEVICE_MODIFY(THOM_PIA_SYS) - MCFG_PIA_READPA_HANDLER(READ8(thomson_state, mo6_sys_porta_in)) - MCFG_PIA_READPB_HANDLER(READ8(thomson_state, mo5nr_sys_portb_in)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo5nr_sys_porta_out)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(thomson_state, mo6_sys_portb_out)) - MCFG_PIA_CA2_HANDLER(WRITELINE(thomson_state, mo5_set_cassette_motor)) - MCFG_PIA_CB2_HANDLER(WRITELINE(thomson_state, mo6_sys_cb2_out)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) /* differs from TO */ - - MCFG_DEVICE_MODIFY(THOM_PIA_GAME) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(thomson_state, mo6_game_porta_out)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(thomson_state, write_centronics_busy)) - - MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_REMOVE("cartslot") - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart") - MCFG_GENERIC_EXTENSIONS("m5,rom") - MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - -COMP ( 1986, mo5nr, 0, 0, mo5nr, mo5nr, driver_device, 0, "Thomson", "MO5 NR", 0 ) diff --git a/src/mess/drivers/ti630.c b/src/mess/drivers/ti630.c deleted file mode 100644 index b92f03785d4..00000000000 --- a/src/mess/drivers/ti630.c +++ /dev/null @@ -1,212 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders: Felipe Sanches -/*************************************************************************** - - Intelbras TI630 telephone - Driver by Felipe Correa da Silva Sanches - - http://images.quebarato.com.br/T440x/telefone+ks+ti+630+seminovo+intelbras+sao+paulo+sp+brasil__2E255D_1.jpg - - Changelog: - - 2014 JUN 17 [Felipe Sanches]: - * Initial driver skeleton - * LCD works - -================ - Messages displayed on screen are in brazilian portuguese. - During boot, it says: - -"TI auto-test." -"Wait!" - - Then it says: - -"Initializing..." -"Wait!" - - And finally: - -"TI did not receive" -"the dial tone" - -It means we probably would have to emulate a modem device for it to treat communications with a PABX phone hub. -================ -*/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "video/hd44780.h" -#include "rendlay.h" - -class ti630_state : public driver_device -{ -public: - ti630_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_lcdc(*this, "hd44780") - { } - - DECLARE_WRITE8_MEMBER(ti630_io_w); - DECLARE_READ8_MEMBER(ti630_io_r); - DECLARE_DRIVER_INIT(ti630); - DECLARE_PALETTE_INIT(ti630); -private: - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_device m_lcdc; -}; - -#define LOG_IO_PORTS 0 - -static ADDRESS_MAP_START(i80c31_prg, AS_PROGRAM, 8, ti630_state) - AM_RANGE(0x0000, 0xffff) AM_ROM -ADDRESS_MAP_END - -DRIVER_INIT_MEMBER( ti630_state, ti630 ) -{ -} - -static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, ti630_state) - AM_RANGE(0x0000,0x0000) /*AM_MIRROR(?)*/ AM_DEVWRITE("hd44780", hd44780_device, control_write) - AM_RANGE(0x1000,0x1000) /*AM_MIRROR(?)*/ AM_DEVWRITE("hd44780", hd44780_device, data_write) - AM_RANGE(0x2000,0x2000) /*AM_MIRROR(?)*/ AM_DEVREAD("hd44780", hd44780_device, control_read) - AM_RANGE(0x8000,0xffff) AM_RAM /*TODO: verify the ammont of RAM and the correct address range to which it is mapped. This is just a first reasonable guess that apparently yields good results in the emulation */ - - AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(ti630_io_r, ti630_io_w) -ADDRESS_MAP_END - -void ti630_state::machine_start() -{ -} - -void ti630_state::machine_reset() -{ -} - -READ8_MEMBER(ti630_state::ti630_io_r) -{ - switch (offset) - { - case 0x01: - { - UINT8 value = 0; -#if LOG_IO_PORTS - printf("P1 read value:%02X\n", value); -#endif - return value; - } - default: -#if LOG_IO_PORTS - printf("Unhandled I/O Read at offset 0x%02X (return 0)\n", offset); -#endif - return 0; - } -} - -WRITE8_MEMBER(ti630_state::ti630_io_w) -{ - static UINT8 p0=0, p1=0, p2=0, p3=0; - switch (offset) - { - case 0x00: - { - if (data != p0) - { - p0=data; -#if LOG_IO_PORTS - printf("Write to P0: %02X\n", data); -#endif - } - break; - } - case 0x01: - { - if (data != p1) - { - p1=data; -#if LOG_IO_PORTS - printf("Write to P1: %02X\n", data); -#endif - } - break; - } - case 0x02: - { - if (data != p2) - { - p2=data; -#if LOG_IO_PORTS - printf("Write to P2: %02X\n", data); -#endif - } - break; - } - case 0x03: - { - if (data != p3) - { - p3=data; -#if LOG_IO_PORTS - printf("Write to P3: %02X\n", data); -#endif - } - break; - } - } -} - -PALETTE_INIT_MEMBER(ti630_state, ti630) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static const gfx_layout ti630_charlayout = -{ - 5, 8, /* 5 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 3, 4, 5, 6, 7}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( ti630 ) - GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, ti630_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( ti630, ti630_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I80C31, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(i80c31_prg) - MCFG_CPU_IO_MAP(i80c31_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_SIZE(6*16, 9*2) - MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(ti630_state, ti630) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ti630) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 16) -MACHINE_CONFIG_END - -ROM_START( ti630 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "ti630.ci11", 0x00000, 0x10000, CRC(2602cbdc) SHA1(98266bea52a5893e0af0b5872eca0a0a1e0c5f9c) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1999, ti630, 0, 0, ti630, 0, ti630_state, ti630, "Intelbras", "TI630 telephone", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/ti74.c b/src/mess/drivers/ti74.c deleted file mode 100644 index 4b2798ac3db..00000000000 --- a/src/mess/drivers/ti74.c +++ /dev/null @@ -1,605 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/*************************************************************************** - - Texas Instruments TI-74 BASICALC - Texas Instruments TI-95 PROCALC - hardware family: CC-40 -> TI-74 BASICALC -> TI-95 PROCALC - - TI-74 PCB layout: - note: TI-95 PCB is nearly the same, just with a different size LCD screen, - its CPU is labeled C70011, and the system ROM is labeled HN61256PC95. - - DOCK-BUS - --||||||||--- - C == | - a == | - r == HN61256 | - t == ---------------------------- - | | - ------- C70009 4MHz | - | HM6264 RC4193N | - | | - | | - | | - | | - ---------------||||||||||||||||||||||||------- - |||||||||||||||||||||||| - ---------------||||||||||||||||||||||||------- - | *HD44100H *HD44780A00 | - | | - | | - | | - | | - ---------- | - | ----------------------------------| - | | || - | | LCD screen || - | | || - | ----------------------------------| - ------------------------------------- - - IC1 HN61256PC93 - Hitachi DIP-28 32KB CMOS Mask PROM - IC2 C70009 - Texas Instruments TMS70C46, 54 pins. Basically a TMS70C40 with some TI custom I/O mods. - 128 bytes internal RAM, 4KB internal ROM, running at max 4MHz. - IC3 HM6264LP-15 - Hitachi 8KB SRAM (battery backed) - RC4193N - Micropower Switching Regulator - HD44100H - 60-pin QFP Hitachi HD44100 LCD Driver - HD44780A00 - 80-pin TFP Hitachi HD44780 LCD Controller - - * - indicates that it's on the other side of the PCB - - - Overall, the hardware is very similar to TI CC-40. A lot has been shuffled around - to cut down on complexity (and probably for protection too). To reduce power usage - even more, the OS often idles while waiting for any keypress that triggers an interrupt - and wakes the processor up. - - The machine is powered by 4 AAA batteries. These will also save internal RAM, - provided that the machine is turned off properly. - - - TODO: - - it runs too fast due to missing clock divider emulation in TMS70C46 - - external ram cartridge - - DOCK-BUS interface and peripherals, compatible with both TI-74 and TI-95 - * CI-7 cassette interface - * PC-324 thermal printer - (+ old Hexbus devices can be connected via a converter cable) - -***************************************************************************/ - -#include "emu.h" -#include "cpu/tms7000/tms7000.h" -#include "video/hd44780.h" -#include "machine/nvram.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#include "ti74.lh" -#include "ti95.lh" - - -class ti74_state : public driver_device -{ -public: - ti74_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_key_matrix(*this, "IN"), - m_battery_inp(*this, "BATTERY") - { } - - required_device m_maincpu; - required_device m_cart; - required_ioport_array<8> m_key_matrix; - required_ioport m_battery_inp; - - UINT8 m_key_select; - UINT8 m_power; - - void update_lcd_indicator(UINT8 y, UINT8 x, int state); - void update_battery_status(int state); - - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(keyboard_w); - DECLARE_WRITE8_MEMBER(bankswitch_w); - - virtual void machine_reset(); - virtual void machine_start(); - DECLARE_PALETTE_INIT(ti74); - DECLARE_INPUT_CHANGED_MEMBER(battery_status_changed); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ti74_cartridge); -}; - - - -/*************************************************************************** - - File Handling - -***************************************************************************/ - -DEVICE_IMAGE_LOAD_MEMBER(ti74_state, ti74_cartridge) -{ - UINT32 size = m_cart->common_get_size("rom"); - - // max size is 32KB - if (size > 0x8000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - - -/*************************************************************************** - - Video - -***************************************************************************/ - -PALETTE_INIT_MEMBER(ti74_state, ti74) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); // background - palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on - palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off -} - -void ti74_state::update_lcd_indicator(UINT8 y, UINT8 x, int state) -{ - // TI-74 ref._________________... - // output# |10 11 12 13 14 2 3 4 - // above | < SHIFT CTL FN I/O UCL _LOW > - // ---- raw lcd screen here ---- - // under | BASIC CALC DEG RAD GRAD STAT - // output# | 63 64 1 62 53 54 - // - // TI-95 ref._________________... - // output# | 40 43 41 44 42 12 11 10/13/14 0 1 2 - // above | _LOW _ERROR 2nd INV ALPHA LC INS DEGRAD HEX OCT I/O - // screen- | _P{70} <{71} RUN{3} - // area . SYS{4} - output_set_lamp_value(y * 10 + x, state); -} - -static HD44780_PIXEL_UPDATE(ti74_pixel_update) -{ - // char size is 5x7 + cursor - if (x > 4 || y > 7) - return; - - if (line == 1 && pos == 15) - { - // the last char is used to control the 14 lcd indicators - ti74_state *driver_state = device.machine().driver_data(); - driver_state->update_lcd_indicator(y, x, state); - } - else if (line < 2 && pos < 16) - { - // internal: 2*16, external: 1*31 - if (y == 7) y++; // the cursor is slightly below the character - bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; - } -} - -static HD44780_PIXEL_UPDATE(ti95_pixel_update) -{ - // char size is 5x7 + cursor - if (x > 4 || y > 7) - return; - - if (line == 1 && pos == 15) - { - // the last char is used to control the 17 lcd indicators - ti74_state *driver_state = device.machine().driver_data(); - driver_state->update_lcd_indicator(y, x, state); - } - else if (line == 0 && pos < 16) - { - // 1st line is simply 16 chars - if (y == 7) y++; // the cursor is slightly below the char - bitmap.pix16(10 + y, 1 + pos*6 + x) = state ? 1 : 2; - } - else if (line == 1 && pos < 15 && y < 7) - { - // 2nd line is segmented into 5 groups of 3 chars, there is no cursor - // note: the chars are smaller than on the 1st line (this is handled in .lay file) - const int gap = 9; - int group = pos / 3; - bitmap.pix16(1 + y, 1 + group*gap + pos*6 + x) = state ? 1 : 2; - } -} - - - -/*************************************************************************** - - I/O, Memory Maps - -***************************************************************************/ - -READ8_MEMBER(ti74_state::keyboard_r) -{ - UINT8 ret = 0; - - // read selected keyboard rows - for (int i = 0; i < 8; i++) - { - if (m_key_select >> i & 1) - ret |= m_key_matrix[i]->read(); - } - - return ret; -} - -WRITE8_MEMBER(ti74_state::keyboard_w) -{ - // d(0-7): select keyboard column - m_key_select = data; -} - -WRITE8_MEMBER(ti74_state::bankswitch_w) -{ - // d0-d1: system rom bankswitch - membank("sysbank")->set_entry(data & 3); - - // d2: power-on latch - if (~data & 4 && m_power) - { - m_power = 0; - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // stop running - } - - // d3: N/C -} - -static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, ti74_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) - AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("sysram.ic3") - //AM_RANGE(0x4000, 0xbfff) // mapped by the cartslot - AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("sysbank") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( main_io_map, AS_IO, 8, ti74_state ) - AM_RANGE(TMS7000_PORTA, TMS7000_PORTA) AM_READ(keyboard_r) - AM_RANGE(TMS7000_PORTB, TMS7000_PORTB) AM_WRITE(bankswitch_w) - AM_RANGE(TMS7000_PORTE, TMS7000_PORTE) AM_WRITE(keyboard_w) AM_READNOP -ADDRESS_MAP_END - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -INPUT_CHANGED_MEMBER(ti74_state::battery_status_changed) -{ - if (machine().phase() == MACHINE_PHASE_RUNNING) - update_battery_status(newval); -} - -static INPUT_PORTS_START( ti74 ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ti74_state, battery_status_changed, 0) - PORT_CONFSETTING( 0x00, "Low" ) - PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) - - // 8x8 keyboard matrix, RESET and ON buttons are not on it. Unused entries are not connected, but some have a purpose for factory testing. - // For convenience, number keys are mapped to number row too. - // PORT_NAME lists functions under [SHIFT] and [MODE] or [STAT] as secondaries. - PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_NAME("m M Frac") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_NAME("k K Frq") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_NAME("i I " UTF8_SQUAREROOT"x") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME(UTF8_LEFT" " UTF8_LEFT) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_NAME("u U x" UTF8_POW_2) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_NAME("j J nCr") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_NAME("n N Intg") - - PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_NAME("l L (x,y)") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_NAME("o O 1/x") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME(UTF8_RIGHT" EE") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_NAME("y Y log") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_NAME("h H nPr") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_NAME("b B EXC") - - PORT_START("IN.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('\'') PORT_NAME("SPACE ' " UTF8_CAPITAL_DELTA"%") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_NAME("; : " UTF8_CAPITAL_SIGMA"+") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_NAME("p P y" UTF8_POW_X) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('(') PORT_NAME(UTF8_UP" (") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_NAME("t T ln(x)") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_NAME("g G n!") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_NAME("v V SUM") - - PORT_START("IN.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) PORT_CHAR('=') PORT_NAME("ENTER =") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("CLR UCL CE/C") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(')') PORT_NAME(UTF8_DOWN" )") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("RUN x<>y") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_NAME("r R " UTF8_SMALL_PI) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_NAME("f F P>R") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_NAME("c C RCL") - - PORT_START("IN.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('~') PORT_CHAR('?') PORT_NAME("+/- ? CSR") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_NAME("1 ! r") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_NAME("4 $ " UTF8_CAPITAL_SIGMA"x") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("7 DEL " UTF8_CAPITAL_SIGMA"x" UTF8_POW_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("BREAK") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_NAME("e E tan") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_NAME("d D DRG>") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_NAME("x X STO") - - PORT_START("IN.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('<') PORT_NAME("0 < x" UTF8_PRIME) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_NAME("2 \" a") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('&') PORT_NAME("5 & " UTF8_CAPITAL_SIGMA"y") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("8 INS " UTF8_CAPITAL_SIGMA"y" UTF8_POW_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_NAME("MODE") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_NAME("w W cos") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_NAME("s S DRG") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_NAME("z Z PRINT") - - PORT_START("IN.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_CHAR('>') PORT_NAME(". > y" UTF8_PRIME) // 2 on the keyboard, same scancode - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_NAME("3 # b") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_NAME("6 ^ n") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9 PB " UTF8_CAPITAL_SIGMA"xy") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) PORT_NAME("OFF") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_NAME("q Q sin") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_NAME("a A DMS>DD") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("+ s(y)") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("- s(x)") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME("* y" UTF8_NONSPACE_MACRON) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_NAME("/ x" UTF8_NONSPACE_MACRON) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("FN hyp") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("CTL STAT") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("SHIFT INV") -INPUT_PORTS_END - -static INPUT_PORTS_START( ti95 ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x01, 0x01, "Battery Status" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ti74_state, battery_status_changed, 0) - PORT_CONFSETTING( 0x00, "Low" ) - PORT_CONFSETTING( 0x01, DEF_STR( Normal ) ) - - // 8x8 keyboard matrix, RESET and ON buttons are not on it. - // For convenience, number keys are mapped to number row too. - // PORT_NAME lists functions under [ALPHA] and [2nd] as secondaries. - PORT_START("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("BREAK Q") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("SIN A") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_NAME("I/O Z") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("HELP ASM") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(')') PORT_NAME(") ] DRG") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_NAME(UTF8_DIVIDE" \\ DFN") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('=') PORT_NAME("= ~ TRACE") - - PORT_START("IN.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_NAME("EE { ENG") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_NAME("HALT W") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("COS S") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("FILES X") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_NAME("ALPHA PART") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_NAME("3 ; SBL") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("+ & RTN") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_NAME("2 : GTL") - - PORT_START("IN.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME(UTF8_CAPITAL_SIGMA"+ E") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_NAME("TAN D") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("STAT C") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("LEARN PC") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_NAME("6 @ CP") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("- _ 13d") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_NAME("5 % CMS") - - PORT_START("IN.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME("x~t R AH") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_NAME("LN F") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_NAME("CONV V") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("OLD NOP") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9 > x!") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) PORT_NAME(UTF8_MULTIPLY" ^ " UTF8_SMALL_PI) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_NAME("8 < nCr") - - PORT_START("IN.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("HYP T BH") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("LOG G") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_NAME("NUM B") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("RUN SPACE") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_NAME("0 $ PAUSE") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') PORT_NAME(". ? ADV") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("+/- ! PRINT") - - PORT_START("IN.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("INCR Y CH") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_NAME("x" UTF8_POW_2" H") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("FLAGS N") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_NAME(UTF8_LEFT" DEL") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("RCL O FH") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME("INV P") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_NAME("7 } nPr") - - PORT_START("IN.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_NAME("EXC U DH") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_NAME(UTF8_SQUAREROOT"x J") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("TESTS M") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_NAME(UTF8_RIGHT" INS") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("y" UTF8_POW_X" L") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("2nd") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4' )PORT_NAME("4 IND") - - PORT_START("IN.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('(') PORT_NAME("( [ FIX") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_NAME("STO I EH") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_NAME("1/x K") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("FUNC , \"") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("CE F:CLR") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_NAME("LIST . '") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("CLEAR") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_NAME("1 # LBL") -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -void ti74_state::update_battery_status(int state) -{ - // battery ok/low status is on int1 line! - m_maincpu->set_input_line(TMS7000_INT1_LINE, state ? ASSERT_LINE : CLEAR_LINE); -} - -void ti74_state::machine_reset() -{ - m_power = 1; - - update_battery_status(m_battery_inp->read()); -} - -void ti74_state::machine_start() -{ - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - - membank("sysbank")->configure_entries(0, 4, memregion("system")->base(), 0x2000); - membank("sysbank")->set_entry(0); - - // zerofill - m_key_select = 0; - m_power = 0; - - // register for savestates - save_item(NAME(m_key_select)); - save_item(NAME(m_power)); -} - -static MACHINE_CONFIG_START( ti74, ti74_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS70C46, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_IO_MAP(main_io_map) - - MCFG_NVRAM_ADD_0FILL("sysram.ic3") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) // arbitrary - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(6*31+1, 9*1+1+1) - MCFG_SCREEN_VISIBLE_AREA(0, 6*31, 0, 9*1+1) - MCFG_DEFAULT_LAYOUT(layout_ti74) - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(ti74_state, ti74) - - MCFG_HD44780_ADD("hd44780") // 270kHz - MCFG_HD44780_LCD_SIZE(2, 16) // 2*16 internal - MCFG_HD44780_PIXEL_UPDATE_CB(ti74_pixel_update) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ti74_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom,256") - MCFG_GENERIC_LOAD(ti74_state, ti74_cartridge) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "ti74_cart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ti95, ti74_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS70C46, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_IO_MAP(main_io_map) - - MCFG_NVRAM_ADD_0FILL("sysram.ic3") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(60) // arbitrary - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(200, 20) - MCFG_SCREEN_VISIBLE_AREA(0, 200-1, 0, 20-1) - MCFG_DEFAULT_LAYOUT(layout_ti95) - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(ti74_state, ti74) - - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 16) - MCFG_HD44780_PIXEL_UPDATE_CB(ti95_pixel_update) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ti95_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom,256") - MCFG_GENERIC_LOAD(ti74_state, ti74_cartridge) - - //MCFG_SOFTWARE_LIST_ADD("cart_list", "ti95_cart") -MACHINE_CONFIG_END - - - -/*************************************************************************** - - ROM Definitions - -***************************************************************************/ - -ROM_START( ti74 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "c70009.ic2", 0xf000, 0x1000, CRC(55a2f7c0) SHA1(530e3de42f2e304c8f4805ad389f38a459ec4e33) ) // internal cpu rom - - ROM_REGION( 0x8000, "system", 0 ) - ROM_LOAD( "hn61256pc93.ic1", 0x0000, 0x8000, CRC(019aaa2f) SHA1(04a1e694a49d50602e45a7834846de4d9f7d587d) ) // system rom, banked -ROM_END - - -ROM_START( ti95 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "c70011.ic2", 0xf000, 0x1000, CRC(b4d0a5c1) SHA1(3ff41946d014f72220a88803023b6a06d5086ce4) ) // internal cpu rom - - ROM_REGION( 0x8000, "system", 0 ) - ROM_LOAD( "hn61256pc95.ic1", 0x0000, 0x8000, CRC(c46d29ae) SHA1(c653f08590dbc28241a9f5a6c2541641bdb0208b) ) // system rom, banked -ROM_END - - -COMP( 1985, ti74, 0, 0, ti74, ti74, driver_device, 0, "Texas Instruments", "TI-74 BASICALC", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1986, ti95, 0, 0, ti95, ti95, driver_device, 0, "Texas Instruments", "TI-95 PROCALC", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/ti85.c b/src/mess/drivers/ti85.c deleted file mode 100644 index 179149c33d6..00000000000 --- a/src/mess/drivers/ti85.c +++ /dev/null @@ -1,931 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha,Jon Sturm -/*************************************************************************** -TI-85 and TI-86 drivers by Krzysztof Strzecha -TI-83 Plus, TI-84 Plus, and Siliver Edition support by Jon Sturm - -Notes: -1. After start TI-85 waits for ON key interrupt, so press ON key to start - calculator. ************* PRESS THE "Q" KEY TO TURN IT ON. ******************** -2. Only difference between all TI-85 drivers is ROM version. -3. TI-86 is TI-85 with more RAM and ROM. -4. Only difference between all TI-86 drivers is ROM version. -5. Video engine (with grayscale support) based on the idea found in VTI source - emulator written by Rusty Wagner. -6. NVRAM is saved properly only when calculator is turned off before exiting MESS. -7. To receive data from TI press "R" immediately after TI starts to send data. -8. To request screen dump from calculator press "S". -9. TI-81 does not have a serial link. - -Needed: -1. Info about ports 3 (bit 2 seems to be allways 0) and 4. -2. Any info on TI-81 hardware. -3. ROM dumps of unemulated models. -4. Artworks. - -New: -05/10/2002 TI-85 serial link works again. -17/09/2002 TI-85 snapshots loading fixed. Few code cleanups. - TI-86 SNAPSHOT LOADING DOESNT WORK. - TI-85, TI-86 SERIAL LINK DOESNT WORK. -08/09/2001 TI-81, TI-85, TI-86 modified to new core. - TI-81, TI-85, TI-86 reset corrected. -21/08/2001 TI-81, TI-85, TI-86 NVRAM corrected. -20/08/2001 TI-81 ON/OFF fixed. - TI-81 ROM bank switching added (port 5). - TI-81 NVRAM support added. -15/08/2001 TI-81 kayboard is now mapped as it should be. -14/08/2001 TI-81 preliminary driver added. -05/07/2001 Serial communication corrected (transmission works now after reset). -02/07/2001 Many source cleanups. - PCR added. -01/07/2001 Possibility to request screen dump from TI (received dumps are saved - as t85i file). -29/06/2001 Received variables can be saved now. -19/06/2001 Possibility to receive variables from calculator (they are nor saved - yet). -17/06/2001 TI-86 reset fixed. -15/06/2001 Possibility to receive memory backups from calculator. -07/06/2001 TI-85 reset fixed. - Work on receiving data from calculator started. -04/06/2001 TI-85 is able to receive variables and memory backups. -14/05/2001 Many source cleanups. -11/05/2001 Release years corrected. Work on serial link started. -26/04/2001 NVRAM support added. -25/04/2001 Video engine totally rewritten so grayscale works now. -17/04/2001 TI-86 snapshots loading added. - ti86grom driver added. -16/04/2001 Sound added. - Five TI-86 drivers added (all features of TI-85 drivers without - snapshot loading). -13/04/2001 Snapshot loading (VTI 2.0 save state files). -18/02/2001 Palette (not perfect). - Contrast control (port 2) implemented. - LCD ON/OFF implemented (port 3). - Interrupts corrected (port 3) - ON/OFF and APD works now. - Artwork added. -09/02/2001 Keypad added. - 200Hz timer interrupts implemented. - ON key and its interrupts implemented. - Calculator is now fully usable. -02/02/2001 Preliminary driver - -To do: -- port 7 (TI-86) -- port 4 (all models) -- artwork (all models) -- port 0 link (TI-82 and TI-83) -- add TI-73, TI-83+ and T84+ drivers - - -TI-81 memory map - - CPU: Z80 2MHz - 0000-7fff ROM - 8000-ffff RAM (?) - -TI-82 memory map - - CPU: Z80 6MHz - 0000-3fff ROM 0 - 4000-7fff ROM 1-7 (switched) - 8000-ffff RAM - -TI-83 memory map - - CPU: Z80 6MHz - 0000-3fff ROM 0 - 4000-7fff ROM 1-15 (switched) - 8000-ffff RAM - -TI-83Plus memory map - - CPU: Z80 8MHz (running at 6 MHz) - 0000-3fff ROM 0 - 4000-7fff ROM 0-31 or RAM 0-1 (switched) - 7000-bfff ROM 0-31 or RAM 0-1 (switched) - c000-ffff RAM 0-31 or RAM 0-1 (switched) - -TI-85 memory map - - CPU: Z80 6MHz - 0000-3fff ROM 0 - 4000-7fff ROM 1-7 (switched) - 8000-ffff RAM - -TI-86 memory map - - CPU: Z80 6MHz - 0000-3fff ROM 0 - 4000-7fff ROM 0-15 or RAM 0-7 (switched) - 7000-bfff ROM 0-15 or RAM 0-7 (switched) - c000-ffff RAM 0 - -Interrupts: - - IRQ: 200Hz timer - ON key - -TI-81 ports: - 0: Video buffer offset (write only) - 1: Keypad - 2: Contrast (write only) - 3: ON status, LCD power - 4: Video buffer width, interrupt control (write only) - 5: ? - 6: - 7: ? - -TI-82 ports: - 0: Link - 1: Keypad - 2: Memory page - 3: ON status, LCD power - 4: Video buffer width, interrupt control (write only) - 10: Control port for the display controller - 11: Data port for the display controller - -TI-83 ports: - 0: Link + Memory page - 1: Keypad - 2: Memory page - 3: ON status, LCD power - 4: Video buffer width, interrupt control (write only) - 10: Control port for the display controller - 11: Data port for the display controller - 14: Battery Status - -TI-83Plus ports: - 0: Link - 1: Keypad - 2: ? - 3: ON status, LCD power - 4: Interrupt status - 6: Memory page 1 - 7: Memory page 2 - 10: Control port for the display controller - 11: Data port for the display controller - -TI-83PlusSE ports: - 0: Link - 1: Keypad - 2: ? - 3: ON status, LCD power - 4: Interrupt status - 5: Memory page 3 - 6: Memory page 1 - 7: Memory page 2 - 10: Controll port for the display controller - 11: Data port for the display controller - 15: Asic Version - -TI-85 ports: - 0: Video buffer offset (write only) - 1: Keypad - 2: Contrast (write only) - 3: ON status, LCD power - 4: Video buffer width, interrupt control (write only) - 5: Memory page - 6: Power mode - 7: Link - -TI-86 ports: - 0: Video buffer offset (write only) - 1: Keypad - 2: Contrast (write only) - 3: ON status, LCD power - 4: Power mode - 5: Memory page - 6: Memory page - 7: Link - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "imagedev/snapquik.h" -#include "includes/ti85.h" -#include "machine/bankdev.h" - -/* port i/o functions */ - -static ADDRESS_MAP_START( ti81_io, AS_IO, 8, ti85_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti85_port_0000_r, ti85_port_0000_w ) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti85_port_0002_r, ti85_port_0002_w ) - AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) - AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) - AM_RANGE(0x0005, 0x0005) AM_READWRITE(ti85_port_0005_r, ti85_port_0005_w ) - AM_RANGE(0x0007, 0x0007) AM_WRITE(ti81_port_0007_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti85_io, AS_IO, 8, ti85_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti85_port_0000_r, ti85_port_0000_w ) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti85_port_0002_r, ti85_port_0002_w ) - AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) - AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) - AM_RANGE(0x0005, 0x0005) AM_READWRITE(ti85_port_0005_r, ti85_port_0005_w ) - AM_RANGE(0x0006, 0x0006) AM_READWRITE(ti85_port_0006_r, ti85_port_0006_w ) - AM_RANGE(0x0007, 0x0007) AM_READWRITE(ti8x_serial_r, ti8x_serial_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti82_io, AS_IO, 8, ti85_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti8x_serial_r, ti8x_serial_w ) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti82_port_0002_r, ti82_port_0002_w ) - AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) - AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) - AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) - AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti81v2_io, AS_IO, 8, ti85_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti82_port_0002_r, ti82_port_0002_w ) - AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) - AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) - AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) - AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti83_io, AS_IO, 8, ti85_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti83_port_0000_r, ti83_port_0000_w ) //TODO - AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti83_port_0002_r, ti83_port_0002_w ) - AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti83_port_0003_r, ti83_port_0003_w ) - AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0004_r, ti85_port_0004_w ) - AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) - AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) - AM_RANGE(0x0014, 0x0014) AM_READ_PORT( "BATTERY" ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti83p_io, AS_IO, 8, ti85_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti8x_plus_serial_r, ti8x_plus_serial_w) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) - AM_RANGE(0x0002, 0x0002) AM_READ(ti83p_port_0002_r) - AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti83_port_0003_r, ti83p_int_mask_w ) - AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti83p_port_0004_r, ti83p_port_0004_w ) - AM_RANGE(0x0006, 0x0006) AM_READWRITE(ti86_port_0005_r, ti83p_port_0006_w ) - AM_RANGE(0x0007, 0x0007) AM_READWRITE(ti86_port_0006_r, ti83p_port_0007_w ) - AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) - AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) - AM_RANGE(0x0007, 0x0007) AM_WRITE(ti83p_port_0014_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti83pse_io, AS_IO, 8, ti85_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti8x_plus_serial_r, ti8x_plus_serial_w) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti83pse_port_0002_r, ti83pse_int_ack_w ) - AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti83_port_0003_r, ti83p_int_mask_w ) - AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti83p_port_0004_r, ti83pse_port_0004_w ) - AM_RANGE(0x0005, 0x0005) AM_READWRITE(ti83pse_port_0005_r, ti83pse_port_0005_w ) - AM_RANGE(0x0006, 0x0006) AM_READWRITE(ti86_port_0005_r, ti83pse_port_0006_w ) - AM_RANGE(0x0007, 0x0007) AM_READWRITE(ti86_port_0006_r, ti83pse_port_0007_w ) - AM_RANGE(0x0009, 0x0009) AM_READ(ti83pse_port_0009_r) - AM_RANGE(0x0010, 0x0010) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) - AM_RANGE(0x0011, 0x0011) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) - AM_RANGE(0x0012, 0x0012) AM_DEVREADWRITE("t6a04", t6a04_device, control_read, control_write) - AM_RANGE(0x0013, 0x0013) AM_DEVREADWRITE("t6a04", t6a04_device, data_read, data_write) - AM_RANGE(0x0014, 0x0014) AM_WRITE(ti83p_port_0014_w ) - AM_RANGE(0x0015, 0x0015) AM_READ(ti83pse_port_0015_r) - AM_RANGE(0x0020, 0x0020) AM_READWRITE(ti83pse_port_0020_r, ti83pse_port_0020_w ) - AM_RANGE(0x0021, 0x0021) AM_READWRITE(ti83pse_port_0021_r, ti83pse_port_0021_w ) - - AM_RANGE(0x0030, 0x0030) AM_READWRITE(ti83pse_ctimer1_setup_r, ti83pse_ctimer1_setup_w ) - AM_RANGE(0x0031, 0x0031) AM_READWRITE(ti83pse_ctimer1_loop_r, ti83pse_ctimer1_loop_w ) - AM_RANGE(0x0032, 0x0032) AM_READWRITE(ti83pse_ctimer1_count_r, ti83pse_ctimer1_count_w ) - AM_RANGE(0x0033, 0x0033) AM_READWRITE(ti83pse_ctimer2_setup_r, ti83pse_ctimer2_setup_w ) - AM_RANGE(0x0034, 0x0034) AM_READWRITE(ti83pse_ctimer2_loop_r, ti83pse_ctimer2_loop_w ) - AM_RANGE(0x0035, 0x0035) AM_READWRITE(ti83pse_ctimer2_count_r, ti83pse_ctimer2_count_w ) - AM_RANGE(0x0036, 0x0036) AM_READWRITE(ti83pse_ctimer3_setup_r, ti83pse_ctimer3_setup_w ) - AM_RANGE(0x0037, 0x0037) AM_READWRITE(ti83pse_ctimer3_loop_r, ti83pse_ctimer3_loop_w ) - AM_RANGE(0x0038, 0x0038) AM_READWRITE(ti83pse_ctimer3_count_r, ti83pse_ctimer3_count_w ) - - AM_RANGE(0x0055, 0x0055) AM_READ(ti84pse_port_0055_r) - AM_RANGE(0x0056, 0x0056) AM_READ(ti84pse_port_0056_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti86_io, AS_IO, 8, ti85_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(ti85_port_0000_r, ti85_port_0000_w ) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(ti8x_keypad_r, ti8x_keypad_w ) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(ti85_port_0002_r, ti85_port_0002_w ) - AM_RANGE(0x0003, 0x0003) AM_READWRITE(ti85_port_0003_r, ti85_port_0003_w ) - AM_RANGE(0x0004, 0x0004) AM_READWRITE(ti85_port_0006_r, ti85_port_0006_w ) - AM_RANGE(0x0005, 0x0005) AM_READWRITE(ti86_port_0005_r, ti86_port_0005_w ) - AM_RANGE(0x0006, 0x0006) AM_READWRITE(ti86_port_0006_r, ti86_port_0006_w ) - AM_RANGE(0x0007, 0x0007) AM_READWRITE(ti8x_serial_r, ti8x_serial_w ) -ADDRESS_MAP_END - -/* memory w/r functions */ - -static ADDRESS_MAP_START( ti81_mem , AS_PROGRAM, 8, ti85_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2") - AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("nvram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti86_mem , AS_PROGRAM, 8, ti85_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti83pse_banked_mem , AS_PROGRAM, 8, ti85_state ) - AM_RANGE(0x0000, 0x1fffff) AM_DEVREADWRITE("flash", intelfsh8_device, read, write) - AM_RANGE(0x200000, 0x21BFFF) AM_RAM AM_SHARE("nvram") -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( ti84p_banked_mem , AS_PROGRAM, 8, ti85_state ) - AM_RANGE(0x0000, 0xfffff) AM_DEVREADWRITE("flash", intelfsh8_device, read, write) - AM_RANGE(0x200000, 0x21BFFF) AM_RAM AM_SHARE("nvram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti83p_banked_mem , AS_PROGRAM, 8, ti85_state ) - AM_RANGE(0x00000, 0x7ffff) AM_DEVREADWRITE("flash", intelfsh8_device, read, write) - AM_RANGE(0x100000, 0x107fff) AM_RAM AM_SHARE("nvram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ti83p_asic_mem , AS_PROGRAM, 8, ti85_state ) - AM_RANGE(0x0000, 0x3fff) AM_DEVREADWRITE("membank1", address_map_bank_device, read8, write8) - AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("membank2", address_map_bank_device, read8, write8) - AM_RANGE(0x8000, 0xbfff) AM_DEVREADWRITE("membank3", address_map_bank_device, read8, write8) - AM_RANGE(0xc000, 0xffff) AM_DEVREADWRITE("membank4", address_map_bank_device, read8, write8) -ADDRESS_MAP_END - -/* keyboard input */ - -static INPUT_PORTS_START (ti81) - PORT_START("BIT0") /* bit 0 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-)") PORT_CODE(KEYCODE_M) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_F5) - PORT_START("BIT1") /* bit 1 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRACE") PORT_CODE(KEYCODE_F4) - PORT_START("BIT2") /* bit 2 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ZOOM") PORT_CODE(KEYCODE_F3) - PORT_START("BIT3") /* bit 3 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RANGE") PORT_CODE(KEYCODE_F2) - PORT_START("BIT4") /* bit 4 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE") PORT_CODE(KEYCODE_END) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y=") PORT_CODE(KEYCODE_F1) - PORT_START("BIT5") /* bit 5 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^-1") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) - PORT_START("BIT6") /* bit 6 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VARS") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRGM") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MATRX") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MATH") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_TILDE) - PORT_START("BIT7") /* bit 7 */ - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X|T") PORT_CODE(KEYCODE_X) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_START("ON") /* ON */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/OFF") PORT_CODE(KEYCODE_Q) -INPUT_PORTS_END - -static INPUT_PORTS_START (ti85) - PORT_START("BIT0") /* bit 0 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER (ENTRY)") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-) (ANS |_|)") PORT_CODE(KEYCODE_M) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (: Z)") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 (CHAR Y)") PORT_CODE(KEYCODE_0) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5 (M5)") PORT_CODE(KEYCODE_F5) - PORT_START("BIT1") /* bit 1 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ (MEM X)") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 (VARS W)") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 (TEST V)") PORT_CODE(KEYCODE_2) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 (BASE U)") PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE (RCL =)") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4 (M4)") PORT_CODE(KEYCODE_F4) - PORT_START("BIT2") /* bit 2 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- (LIST T)") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 (STRNG S)") PORT_CODE(KEYCODE_6) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 (CONV R)") PORT_CODE(KEYCODE_5) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 (CONS Q)") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", (ANGLE P)") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3 (M3)") PORT_CODE(KEYCODE_F3) - PORT_START("BIT3") /* bit 3 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("* (MATH O)") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (CPLX N)") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (VECTR M)") PORT_CODE(KEYCODE_8) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 (MATRX L)") PORT_CODE(KEYCODE_7) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2 (SQRT K)") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2 (M2)") PORT_CODE(KEYCODE_F2) - PORT_START("BIT4") /* bit 4 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ (CALC J)") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") (] I)") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( ([ H)") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE (X^-1 G)") PORT_CODE(KEYCODE_END) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN (e^x F)") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1 (M1)") PORT_CODE(KEYCODE_F1) - PORT_START("BIT5") /* bit 5 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^ (PI E)") PORT_CODE(KEYCODE_P) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN (TAN^-1 D)") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS (COS^-1 C)") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN (SIN^-1 B)") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG (10^x A)") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) - PORT_START("BIT6") /* bit 6 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR (TOLER)") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CUSTOM (CATALOG)") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRGM (POLY)") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STAT (SIMULT)") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GRAPH (SOLVER)") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EXIT (QUIT)") PORT_CODE(KEYCODE_ESC) - PORT_START("BIT7") /* bit 7 */ - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL (INS)") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x-VAR (LINK x)") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA (alpha)") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MORE (MODE)") PORT_CODE(KEYCODE_TILDE) - PORT_START("ON") /* ON */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/OFF") PORT_CODE(KEYCODE_Q) -INPUT_PORTS_END - -static INPUT_PORTS_START (ti82) - PORT_START("BIT0") /* bit 0 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-)") PORT_CODE(KEYCODE_M) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_F5) - PORT_START("BIT1") /* bit 1 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_S) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TRACE") PORT_CODE(KEYCODE_F4) - PORT_START("BIT2") /* bit 2 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ZOOM") PORT_CODE(KEYCODE_F3) - PORT_START("BIT3") /* bit 3 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LOG") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("WINDOW") PORT_CODE(KEYCODE_F2) - PORT_START("BIT4") /* bit 4 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_END) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y=") PORT_CODE(KEYCODE_F1) - PORT_START("BIT5") /* bit 5 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^-1") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) - PORT_START("BIT6") /* bit 6 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("VARS") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRGM") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MATRX") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MATH") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_ESC) - PORT_START("BIT7") /* bit 7 */ - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STAT") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x-VAR") PORT_CODE(KEYCODE_X) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_START("ON") /* ON */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON/OFF") PORT_CODE(KEYCODE_Q) -INPUT_PORTS_END - -static INPUT_PORTS_START (ti83) - PORT_INCLUDE( ti82 ) - - PORT_START("BATTERY") - PORT_DIPNAME( 0x01, 0x01, "Battery Status" ) - PORT_DIPSETTING( 0x01, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x00, "Low Battery" ) -INPUT_PORTS_END - -/* machine definition */ -static MACHINE_CONFIG_START( ti81, ti85_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 2000000) /* 2 MHz */ - MCFG_CPU_PROGRAM_MAP(ti81_mem) - MCFG_CPU_IO_MAP(ti81_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_SIZE(96, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 96-1, 0, 64-1) - MCFG_SCREEN_UPDATE_DRIVER(ti85_state, screen_update_ti85) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 224) - MCFG_PALETTE_INDIRECT_ENTRIES(224) - MCFG_PALETTE_INIT_OWNER(ti85_state, ti85) - - MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ti85, ti81 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(6000000) /* 6 MHz */ - MCFG_CPU_IO_MAP(ti85_io) - - MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti85 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(128, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 64-1) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ti85d, ti85 ) - MCFG_SNAPSHOT_ADD("snapshot", ti85_state, ti8x, "sav", 0) - //MCFG_TI85SERIAL_ADD( "tiserial" ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ti82, ti81 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(6000000) /* 6 MHz */ - MCFG_CPU_IO_MAP(ti82_io) - - MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti85 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(2) - MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 ) - - MCFG_DEVICE_ADD("t6a04", T6A04, 0) - MCFG_T6A04_SIZE(96, 64) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - //MCFG_TI82SERIAL_ADD( "tiserial" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ti81v2, ti82 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(ti81v2_io) - - //MCFG_DEVICE_REMOVE( "tiserial" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ti83, ti81 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(6000000) /* 6 MHz */ - MCFG_CPU_IO_MAP(ti83_io) - - MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti85 ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(2) - MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 ) - - MCFG_DEVICE_ADD("t6a04", T6A04, 0) - MCFG_T6A04_SIZE(96, 64) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ti86, ti85 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(ti86_mem) - MCFG_CPU_IO_MAP(ti86_io) - - MCFG_MACHINE_START_OVERRIDE(ti85_state, ti86 ) - MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti85 ) - - MCFG_SNAPSHOT_ADD("snapshot", ti85_state, ti8x, "sav", 0) - //MCFG_TI86SERIAL_ADD( "tiserial" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ti83p, ti81 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(6000000) /* 8 MHz running at 6 MHz */ - MCFG_CPU_PROGRAM_MAP(ti83p_asic_mem) - MCFG_CPU_IO_MAP(ti83p_io) - - MCFG_MACHINE_START_OVERRIDE(ti85_state, ti83p ) - MCFG_MACHINE_RESET_OVERRIDE(ti85_state, ti83p ) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(2) - MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 ) - - MCFG_DEVICE_ADD("membank1", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(ti83p_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_DEVICE_ADD("membank2", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(ti83p_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_DEVICE_ADD("membank3", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(ti83p_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_DEVICE_ADD("membank4", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(ti83p_banked_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_DEVICE_ADD("t6a04", T6A04, 0) - MCFG_T6A04_SIZE(96, 64) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_AMD_29F400T_ADD("flash") - - //MCFG_TI83PSERIAL_ADD( "tiserial" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ti83pse, ti83p ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK( 15000000) - MCFG_CPU_IO_MAP(ti83pse_io) - - MCFG_DEVICE_MODIFY("membank1") - MCFG_DEVICE_PROGRAM_MAP(ti83pse_banked_mem) - - MCFG_DEVICE_MODIFY("membank2") - MCFG_DEVICE_PROGRAM_MAP(ti83pse_banked_mem) - - MCFG_DEVICE_MODIFY("membank3") - MCFG_DEVICE_PROGRAM_MAP(ti83pse_banked_mem) - - MCFG_DEVICE_MODIFY("membank4") - MCFG_DEVICE_PROGRAM_MAP(ti83pse_banked_mem) - - MCFG_MACHINE_START_OVERRIDE(ti85_state, ti83pse ) - MCFG_DEVICE_REPLACE("flash", FUJITSU_29F160T, 0) - - //MCFG_TI83PSERIAL_ADD( "tiserial" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ti84p, ti83pse ) - MCFG_DEVICE_MODIFY("membank1") - MCFG_DEVICE_PROGRAM_MAP(ti84p_banked_mem) - - MCFG_DEVICE_MODIFY("membank2") - MCFG_DEVICE_PROGRAM_MAP(ti84p_banked_mem) - - MCFG_DEVICE_MODIFY("membank3") - MCFG_DEVICE_PROGRAM_MAP(ti84p_banked_mem) - - MCFG_DEVICE_MODIFY("membank4") - MCFG_DEVICE_PROGRAM_MAP(ti84p_banked_mem) - - MCFG_MACHINE_START_OVERRIDE(ti85_state, ti84p ) - MCFG_DEVICE_REPLACE("flash", AMD_29F800T , 0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ti84pse, ti83pse ) - MCFG_MACHINE_START_OVERRIDE(ti85_state, ti84pse ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ti73, ti83p ) - //MCFG_DEVICE_REMOVE( "tiserial" ) - //MCFG_TI73SERIAL_ADD( "tiserial" ) -MACHINE_CONFIG_END - -ROM_START (ti73) - ROM_REGION (0x80000, "flash",0) - ROM_DEFAULT_BIOS("v16") - ROM_SYSTEM_BIOS( 0, "v16", "V 1.6" ) - ROMX_LOAD( "ti73v160.rom", 0x00000, 0x80000, CRC(bb0e3a16) SHA1(d62c2c7532698962818a747a7f32e35e41dfe338), ROM_BIOS(1) ) -ROM_END - -ROM_START (ti81) - ROM_REGION (0x08000, "bios",0) - ROM_DEFAULT_BIOS("v18") - ROM_SYSTEM_BIOS( 0, "v11", "V 1.1K" ) - ROMX_LOAD( "ti81v11k.bin", 0x00000, 0x8000, CRC(0b860a63) SHA1(84a71cfc8818ca4b7d0caa76ffbf6d0463eaf7c6), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v16", "V 1.6K" ) - ROMX_LOAD( "ti81v16k.bin", 0x00000, 0x8000, CRC(452ca838) SHA1(92649f0f3bce7d8829d950cecd6532d7f7db1297), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v18", "V 1.8K" ) - ROMX_LOAD( "ti81v18k.bin", 0x00000, 0x8000, CRC(94ac58e2) SHA1(ba915cfe2fe50a452ef8287db8f2244e29056d54), ROM_BIOS(3) ) - //No dumps 1.0, and 2.0 from ticalc.org, less sure about 1.6K -ROM_END - -ROM_START (ti81v2) - ROM_REGION (0x08000, "bios",0) - ROM_DEFAULT_BIOS("v20") - ROM_SYSTEM_BIOS( 0, "v20", "V 2.0V" ) - ROMX_LOAD( "ti81v20v.bin", 0x00000, 0x8000, CRC(cfbd12da) SHA1(d2a923526d98f1046fcb583e46951939ba66bdb9), ROM_BIOS(1) ) -ROM_END - -ROM_START (ti82) - ROM_REGION (0x20000, "bios",0) - ROM_DEFAULT_BIOS("v19") - ROM_SYSTEM_BIOS( 0, "v16", "V 16.0" ) - ROMX_LOAD( "ti82v16.bin", 0x00000, 0x20000, CRC(e2f5721c) SHA1(df300ae52e105faf2785a8ae9f42e84e4308d460), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v17", "V 17.0" ) - ROMX_LOAD( "ti82v17.bin", 0x00000, 0x20000, CRC(0fc956d4) SHA1(77eef7d2db5ad1fb5de9129086a18428ddf66195), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v18", "V 18.0" ) - ROMX_LOAD( "ti82v18.bin", 0x00000, 0x20000, CRC(6a320f03) SHA1(9ee15ebf0a1f8bde5bef982b5db4ce120c605d29), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "v19", "V 19.0" ) - ROMX_LOAD( "ti82v19.bin", 0x00000, 0x20000, CRC(ed4cf9ff) SHA1(10dc2d01c62b4e971a6ed7ebc75ca0f2e3dc4f95), ROM_BIOS(4) ) - //Rom versions according to ticalc.org 3*, 4*, 7*, 8.0, 10.0, 12.0, 15.0, 16.0, 17.0, 18.0, 19.0, 19.006 -ROM_END - -ROM_START (ti83) - ROM_REGION (0x40000, "bios",0) - ROM_DEFAULT_BIOS("v110") - ROM_SYSTEM_BIOS( 0, "v102", "V 1.02" ) - ROMX_LOAD( "ti83v102.bin", 0x00000, 0x40000, CRC(7ee5d27b) SHA1(ce08f6a808701fc6672230a790167ee485157561), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v103", "V 1.03" ) - ROMX_LOAD( "ti83v103.bin", 0x00000, 0x40000, CRC(926f72a4) SHA1(8399e384804d8d29866caa4c8763d7a61946a467), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v104", "V 1.04" ) - ROMX_LOAD( "ti83v104.bin", 0x00000, 0x40000, CRC(dccb73d3) SHA1(33877ff637dc5f4c5388799fd7e2159b48e72893), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "v106", "V 1.06" ) - ROMX_LOAD( "ti83v106.bin", 0x00000, 0x40000, CRC(2eae1cf0) SHA1(3d65c2a1b771ce8e5e5a0476ec1aa9c9cdc0e833), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "v107", "V 1.07" ) - ROMX_LOAD( "ti83v107.bin", 0x00000, 0x40000, CRC(4bf05697) SHA1(ef66dad3e7b2b6a86f326765e7dfd7d1a308ad8f), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "v108", "V 1.08" ) - ROMX_LOAD( "ti83v108.bin", 0x00000, 0x40000, CRC(0c6aafcc) SHA1(9c74f0b61655e9e160e92164db472ad7ee02b0f8), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS( 6, "v110", "V 1.10" ) - ROMX_LOAD( "ti83v110.bin", 0x00000, 0x40000, CRC(7faee2d2) SHA1(25b373b58523647bb7b904001d391615e0b79bee), ROM_BIOS(7) ) - ROM_SYSTEM_BIOS( 7, "v110-2", "V 1.10 (2)" ) - ROMX_LOAD( "ti83v110-2.bin", 0x00000, 0x40000, CRC(56182912) SHA1(4c77fb77f023502b685a49a8013568b494384b25), ROM_BIOS(8) ) - //Rom versions according to ticalc.org 1.02, 1.03, 1.04, 1.06, 1.07, 1.08, 1.10 -ROM_END - -ROM_START (ti83p) - ROM_REGION (0x80000, "flash",0) - ROM_DEFAULT_BIOS("v116") - ROM_SYSTEM_BIOS( 0, "v103", "V 1.03" ) - ROMX_LOAD( "ti83pv103.bin", 0x00000, 0x80000, CRC(da466be0) SHA1(37eaeeb9fb5c18fb494e322b75070e80cc4d858e), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v103m", "V 1.03 [m]" ) - ROMX_LOAD( "ti83pv103m.bin", 0x00000, 0x80000, CRC(281c9375) SHA1(80d698fed42976015a3e53fd59ebe7f49699b27e), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v103m2", "V 1.03 [m2]" ) - ROMX_LOAD( "ti83pv103m2.bin", 0x00000, 0x80000, CRC(690d9d30) SHA1(d215d3880e06c2ae31ec24b21d542d5bb2f3935b), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "v110", "V 1.10" ) - ROMX_LOAD( "ti83pv110.bin", 0x00000, 0x80000, CRC(62683990) SHA1(f86cdefe4ed5ef9965cd9eb667cb859e2cb10e19), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "v112", "V 1.12" ) - ROMX_LOAD( "ti83pv112.bin", 0x00000, 0x80000, CRC(ddca5026) SHA1(6615df5554076b6b81bd128bf847d2ff046e556b), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "v110-2", "V 1.10-2" ) - ROMX_LOAD( "ti83pv110-2.bin", 0x00000, 0x80000, CRC(504b9879) SHA1(8841d501870e8fc7173642d8a438205a040640fc), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS( 6, "v112-2", "V 1.12-2" ) - ROMX_LOAD( "ti83pv112-2.bin", 0x00000, 0x80000, CRC(2126de12) SHA1(cbedc3a8cf8335eebf2b279d58720d8e7f86c569), ROM_BIOS(7) ) - ROM_SYSTEM_BIOS( 7, "v113", "V 1.13" ) - ROMX_LOAD( "ti83pv113.bin", 0x00000, 0x80000, CRC(30a243aa) SHA1(9b79e994ea1ce7af05b68f8ecee8b1b1fc3f0810), ROM_BIOS(8) ) - ROM_SYSTEM_BIOS( 8, "v114", "V 1.14" ) - ROMX_LOAD( "ti83pv114.bin", 0x00000, 0x80000, CRC(b32059c7) SHA1(46c66ba0421c03fc42f5afb06c7d3af812786140), ROM_BIOS(9) ) - ROM_SYSTEM_BIOS( 9, "v115", "V 1.15" ) - ROMX_LOAD( "ti83pv115.bin", 0x00000, 0x80000, CRC(9288029b) SHA1(8bd05fd47cab4028f275d1cc5383fd4f0e193474), ROM_BIOS(10) ) - ROM_SYSTEM_BIOS( 10, "v116", "V 1.16" ) - ROMX_LOAD( "ti83pv116.bin", 0x00000, 0x80000, CRC(0b7cd006) SHA1(290bc81159ea061d8ccb56a6f63e042f150afb32), ROM_BIOS(11) ) -ROM_END - -ROM_START (ti85) - ROM_REGION (0x20000, "bios",0) - ROM_DEFAULT_BIOS("v100") - ROM_SYSTEM_BIOS( 0, "v30a", "V 3.0A" ) - ROMX_LOAD( "ti85v30a.bin", 0x00000, 0x20000, CRC(de4c0b1a) SHA1(f4cf4b8309372dbe26187bb279545f5d4bd48fc1), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v40", "V 4.0" ) - ROMX_LOAD( "ti85v40.bin", 0x00000, 0x20000, CRC(a1723a17) SHA1(ff5866636bb3f206a6bf39cc9c9dc8308332aaf0), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v50", "V 5.0" ) - ROMX_LOAD( "ti85v50.bin", 0x00000, 0x20000, CRC(781fa403) SHA1(bf20d520d8efd7e5ae269789ca4b3c71848ac32a), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "v60", "V 6.0" ) - ROMX_LOAD( "ti85v60.bin", 0x00000, 0x20000, CRC(b694a117) SHA1(36d58e2723e5ae4ffe0f8da691fa9a83bfe9e06b), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "v80", "V 8.0" ) - ROMX_LOAD( "ti85v80.bin", 0x00000, 0x20000, CRC(7f296338) SHA1(765d5c612b6ffc0d1ded8f79bcbe880b1b562a98), ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "v90", "V 9.0" ) - ROMX_LOAD( "ti85v90.bin", 0x00000, 0x20000, CRC(6a0a94d0) SHA1(7742bf8a6929a21d06f306b494fc03b1fbdfe3e4), ROM_BIOS(6) ) - ROM_SYSTEM_BIOS( 6, "v100", "V 10.0" ) - ROMX_LOAD( "ti85v100.bin", 0x00000, 0x20000, CRC(053325b0) SHA1(36da1080c34e7b53cbe8463be5804e30e4a50dc8), ROM_BIOS(7) ) - //No_dumps 1.0, 2.0 and 7.0 according to ticalc.org -ROM_END - -ROM_START (ti86) - ROM_REGION (0x40000, "bios",0) - ROM_DEFAULT_BIOS("v16") - ROM_SYSTEM_BIOS( 0, "v12", "V 1.2" ) - ROMX_LOAD( "ti86v12.bin", 0x00000, 0x40000, CRC(bdf16105) SHA1(e40b22421c31bf0af104518b748ae79cd21d9c57), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v13", "V 1.3" ) - ROMX_LOAD( "ti86v13.bin", 0x00000, 0x40000, CRC(073ef70f) SHA1(5702d4bb835bdcbfa8075ffd620fca0eaf3a1592), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v14", "V 1.4" ) - ROMX_LOAD( "ti86v14.bin", 0x00000, 0x40000, CRC(fe6e2986) SHA1(23e0fb9a1763d5b9a7b0e593f09c2ff30c760866), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "v15", "V 1.5" ) - ROMX_LOAD( "ti86v15.bin", 0x00000, 0x40000, BAD_DUMP CRC(e6e10546) SHA1(5ca63fdfc965ae3fb8e0695263cf9da41f6ecb90), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "v16", "V 1.6" ) - ROMX_LOAD( "ti86v16.bin", 0x00000, 0x40000, CRC(37e02acc) SHA1(b5ad204885e5dde23a22f18f8d5eaffca69d638d), ROM_BIOS(5) ) - //Rom versions according to ticalc.org 1.2, 1.3, 1.4, 1.5, 1.6 -ROM_END - - -ROM_START (ti83pse) - ROM_REGION (0x200000, "flash", 0) - ROM_DEFAULT_BIOS("v116") - ROM_SYSTEM_BIOS( 0, "v116", "V 1.16" ) - ROMX_LOAD( "ti83psev116.bin", 0x00000, 0x200000, CRC(d2570863) SHA1(d4214b3c0ebb26e10fe95294ac72a90d2ba99537), ROM_BIOS(1) ) -ROM_END - -ROM_START (ti84pse) - ROM_REGION (0x200000, "flash",0) - ROM_DEFAULT_BIOS("v241") - ROM_SYSTEM_BIOS( 0, "v241", "V 2.41" ) - ROMX_LOAD( "ti84sev241.bin", 0x00000, 0x200000, CRC(5758db36) SHA1(7daa4f22e9b5dc8a1cc8fd31bceece9fa8b43515), ROM_BIOS(1) ) -ROM_END - -ROM_START (ti84p) - ROM_REGION (0x100000, "flash",0) - ROM_DEFAULT_BIOS("b100v255mp") - ROM_SYSTEM_BIOS( 0, "b100v255mp", "Boot 1.00 OS V 2.55MP" ) - ROMX_LOAD( "ti84pb100v255mp.bin", 0x00000, 0x100000, CRC(4af31251) SHA1(8f67269346644b87e7cd0f353f5f4030e787cf57), ROM_BIOS(1) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1990, ti81, 0, 0, ti81, ti81, driver_device, 0, "Texas Instruments", "TI-81", MACHINE_NO_SOUND ) -COMP( 1992, ti85, 0, 0, ti85d, ti85, driver_device, 0, "Texas Instruments", "TI-85", MACHINE_NO_SOUND ) -COMP( 1993, ti82, 0, 0, ti82, ti82, driver_device, 0, "Texas Instruments", "TI-82", MACHINE_NO_SOUND ) -COMP( 1994, ti81v2, ti81, 0, ti81v2, ti81, driver_device, 0, "Texas Instruments", "TI-81 v2.0", MACHINE_NO_SOUND ) -COMP( 1996, ti83, 0, 0, ti83, ti83, driver_device, 0, "Texas Instruments", "TI-83", MACHINE_NO_SOUND ) -COMP( 1997, ti86, 0, 0, ti86, ti85, driver_device, 0, "Texas Instruments", "TI-86", MACHINE_NO_SOUND ) -COMP( 1998, ti73, 0, 0, ti73, ti82, driver_device, 0, "Texas Instruments", "TI-73", MACHINE_NO_SOUND ) -COMP( 1999, ti83p, 0, 0, ti83p, ti82, driver_device, 0, "Texas Instruments", "TI-83 Plus", MACHINE_NO_SOUND ) -COMP( 2001, ti83pse, 0, 0, ti83pse, ti82, driver_device, 0, "Texas Instruments", "TI-83 Plus Silver Edition", MACHINE_NO_SOUND ) -COMP( 2004, ti84p, 0, 0, ti84p, ti82, driver_device, 0, "Texas Instruments", "TI-84 Plus", MACHINE_NO_SOUND ) -COMP( 2004, ti84pse, 0, 0, ti84pse, ti82, driver_device, 0, "Texas Instruments", "TI-84 Plus Silver Edition", MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/ti89.c b/src/mess/drivers/ti89.c deleted file mode 100644 index 9958d18ef83..00000000000 --- a/src/mess/drivers/ti89.c +++ /dev/null @@ -1,675 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - TI-89, TI-92, TI-92 plus, Voyage 200 PLT and TI-89 Titanium - - Driver by Sandro Ronco - - Note: - -NVRAM works only if the calculator is turned off (2nd + ON) before closing MESS - - TODO: - -Link - -HW 3 I/O port - -RTC - -LCD contrast - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "includes/ti89.h" -#include "machine/nvram.h" -#include "machine/intelfsh.h" -#include "rendlay.h" - -UINT8 ti68k_state::keypad_r() -{ - UINT8 bit, data = 0xff; - - for (bit = 0; bit < 10; bit++) - { - if (~m_kb_mask & (0x01 << bit)) - { - data ^= m_io_bit0->read() & (0x01 << bit) ? 0x01 : 0x00; - data ^= m_io_bit1->read() & (0x01 << bit) ? 0x02 : 0x00; - data ^= m_io_bit2->read() & (0x01 << bit) ? 0x04 : 0x00; - data ^= m_io_bit3->read() & (0x01 << bit) ? 0x08 : 0x00; - data ^= m_io_bit4->read() & (0x01 << bit) ? 0x10 : 0x00; - data ^= m_io_bit5->read() & (0x01 << bit) ? 0x20 : 0x00; - data ^= m_io_bit6->read() & (0x01 << bit) ? 0x40 : 0x00; - data ^= m_io_bit7->read() & (0x01 << bit) ? 0x80 : 0x00; - } - } - - return data; -} - - -WRITE16_MEMBER ( ti68k_state::ti68k_io_w ) -{ - switch(offset & 0x0f) - { - case 0x00: - m_lcd_contrast = (m_lcd_contrast & 0xfe) | BIT(data, 5); - break; - case 0x02: - if (!(data & 0x10) && data != m_io_hw1[offset]) - m_maincpu->suspend(SUSPEND_REASON_DISABLE, 1); - break; - case 0x08: - m_lcd_base = data << 3; - break; - case 0x09: - m_lcd_width = (0x40 - ((data >> 8) & 0xff)) * 0x10; - m_lcd_height = 0x100 - (data & 0xff); - break; - case 0x0a: - m_timer_on = BIT(data ,1); - switch((data >> 4) & 0x03) - { - case 0: m_timer_mask = 0x0000; break; - case 1: m_timer_mask = 0x000f; break; - case 2: m_timer_mask = 0x007f; break; - case 3: m_timer_mask = 0x1fff; break; - } - break; - case 0x0b: - m_timer_val = data & 0xff; - case 0x0c: - m_kb_mask = data & 0x03ff; - break; - case 0x0e: - m_lcd_on = (((data >> 8) & 0x3c) == 0x3c) ? 0 : 1; - m_lcd_contrast = (m_lcd_contrast & 0x01) | ((data & 0x0f) << 1); - break; - default: break; - } - m_io_hw1[offset & 0x0f] = data; -} - - -READ16_MEMBER ( ti68k_state::ti68k_io_r ) -{ - UINT16 data; - - switch (offset & 0x0f) - { - case 0x00: - data = 0x0400 | ((m_lcd_contrast & 1) << 13); - break; - case 0x0b: - data = m_timer_val; - break; - case 0x0d: - data = ((!m_on_key) << 9) | keypad_r(); - break; - default: - data= m_io_hw1[offset & 0x0f]; - } - return data; -} - - -WRITE16_MEMBER ( ti68k_state::ti68k_io2_w ) -{ - switch(offset & 0x7f) - { - case 0x0b: - m_lcd_base = 0x4c00 + 0x1000 * (data & 0x03); - break; - case 0x0e: - m_lcd_on = (data & 0x02) ? 1 : 0; - break; - default: break; - } - m_io_hw2[offset & 0x7f] = data; -} - - -READ16_MEMBER ( ti68k_state::ti68k_io2_r ) -{ - UINT16 data; - - switch (offset & 0x7f) - { - default: - data= m_io_hw2[offset & 0x7f]; - } - return data; -} - - -WRITE16_MEMBER ( ti68k_state::flash_w ) -{ - // verification if it is flash memory - if (m_flash_mem) - m_flash->write(offset, data); -} - -READ16_MEMBER ( ti68k_state::flash_r ) -{ - if (m_flash_mem) - { - return m_flash->read(offset); - } - else - { - return m_rom_base[offset]; - } -} - - -TIMER_DEVICE_CALLBACK_MEMBER(ti68k_state::ti68k_timer_callback) -{ - m_timer++; - - if (m_timer_on) - { - if (!(m_timer & m_timer_mask) && BIT(m_io_hw1[0x0a], 3)) - { - if (m_timer_val) - m_timer_val++; - else - m_timer_val = (m_io_hw1[0x0b]) & 0xff; - } - - if (!BIT(m_io_hw1[0x0a], 7) && ((m_hw_version == HW1) || (!BIT(m_io_hw1[0x0f], 2) && !BIT(m_io_hw1[0x0f], 1)))) - { - if (!(m_timer & 0x003f)) - m_maincpu->set_input_line(M68K_IRQ_1, HOLD_LINE); - - if (!(m_timer & 0x3fff) && !BIT(m_io_hw1[0x0a], 3)) - m_maincpu->set_input_line(M68K_IRQ_3, HOLD_LINE); - - if (!(m_timer & m_timer_mask) && BIT(m_io_hw1[0x0a], 3) && m_timer_val == 0) - m_maincpu->set_input_line(M68K_IRQ_5, HOLD_LINE); - } - } - - if (keypad_r() != 0xff) - m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); -} - - -static ADDRESS_MAP_START(ti92_mem, AS_PROGRAM, 16, ti68k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x200000, 0x5fffff) AM_UNMAP // ROM - AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(ti89_mem, AS_PROGRAM, 16, ti68k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x200000, 0x3fffff) AM_READWRITE(flash_r, flash_w) - AM_RANGE(0x400000, 0x5fffff) AM_NOP - AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) - AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(ti68k_io2_r, ti68k_io2_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(ti92p_mem, AS_PROGRAM, 16, ti68k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x200000, 0x3fffff) AM_NOP - AM_RANGE(0x400000, 0x5fffff) AM_READWRITE(flash_r, flash_w) - AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) - AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(ti68k_io2_r, ti68k_io2_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(v200_mem, AS_PROGRAM, 16, ti68k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x200000, 0x5fffff) AM_READWRITE(flash_r, flash_w) - AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) - AM_RANGE(0x700000, 0x70ffff) AM_READWRITE(ti68k_io2_r, ti68k_io2_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(ti89t_mem, AS_PROGRAM, 16, ti68k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_MIRROR(0x200000) AM_SHARE("nvram") - AM_RANGE(0x600000, 0x6fffff) AM_READWRITE(ti68k_io_r, ti68k_io_w) - AM_RANGE(0x700000, 0x70ffff) AM_READWRITE(ti68k_io2_r, ti68k_io2_w) - AM_RANGE(0x800000, 0xbfffff) AM_READWRITE(flash_r, flash_w) - AM_RANGE(0xbf0000, 0xffffff) AM_NOP -ADDRESS_MAP_END - - -INPUT_CHANGED_MEMBER(ti68k_state::ti68k_on_key) -{ - m_on_key = newval; - - if (m_on_key) - { - if (m_maincpu->suspended(SUSPEND_REASON_DISABLE)) - m_maincpu->resume(SUSPEND_REASON_DISABLE); - - m_maincpu->set_input_line(M68K_IRQ_6, HOLD_LINE); - } -} - - -/* Input ports for TI-89 and TI-89 Titanium*/ -static INPUT_PORTS_START (ti8x) - PORT_START("BIT0") /* bit 0 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER (ENTRY)") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-)") PORT_CODE(KEYCODE_M) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("APPS") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - - PORT_START("BIT1") /* bit 1 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, ti68k_state, ti68k_on_key, 0) - - PORT_START("BIT2") /* bit 2 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE") PORT_CODE(KEYCODE_E) - - PORT_START("BIT3") /* bit 3 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_L) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("|") PORT_CODE(KEYCODE_COLON) - - PORT_START("BIT4") /* bit 4 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - - PORT_START("BIT5") /* bit 5 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - - PORT_START("BIT6") /* bit 6 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3nd") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CATALOG") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mode") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - - PORT_START("BIT7") /* bit 7 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALPHA") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) -INPUT_PORTS_END - -/* Input ports for TI-92 and TI92 Plus*/ -static INPUT_PORTS_START (ti9x) - PORT_START("BIT0") /* bit 0 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2nd") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_UNUSED - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STORE") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - - PORT_START("BIT1") /* bit 1 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3nd") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) - - PORT_START("BIT2") /* bit 2 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - - PORT_START("BIT3") /* bit 3 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clock") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - - PORT_START("BIT4") /* bit 4 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - - PORT_START("BIT5") /* bit 5 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_F12) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - - PORT_START("BIT6") /* bit 6 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_END) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("APPS") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - - PORT_START("BIT7") /* bit 7 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, ti68k_state, ti68k_on_key, 0) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(-)") PORT_CODE(KEYCODE_MINUS_PAD) -INPUT_PORTS_END - - -void ti68k_state::machine_start() -{ - int i; - - m_flash_mem = !((m_rom_base[0x32] & 0x0f) != 0); - - if (m_flash_mem) - { - UINT32 base = ((((m_rom_base[0x82]) << 16) | m_rom_base[0x83]) & 0xffff)>>1; - - if (m_rom_base[base] >= 8) - m_hw_version = ((m_rom_base[base + 0x0b]) << 16) | m_rom_base[base + 0x0c]; - - if (!m_hw_version) - m_hw_version = HW1; - - for (i = 0x9000; i < 0x100000; i++) - if (m_rom_base[i] == 0xcccc && m_rom_base[i + 1] == 0xcccc) - break; - - m_initial_pc = ((m_rom_base[i + 4]) << 16) | m_rom_base[i + 5]; - } - else - { - m_hw_version = HW1; - m_initial_pc = ((m_rom_base[2]) << 16) | m_rom_base[3]; - - m_maincpu->space(AS_PROGRAM).unmap_read(0x200000, 0x5fffff); - - if (m_initial_pc > 0x400000) - { - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x400000, 0x5fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this),write16_delegate(FUNC(ti68k_state::flash_w), this)); - } - else - { - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x200000, 0x3fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this), write16_delegate(FUNC(ti68k_state::flash_w), this)); - } - } - - logerror("HW=v%x, PC=%06x, Type=%s\n", m_hw_version, m_initial_pc, (m_flash_mem) ? "Flash" : "ROM"); -} - - -void ti68k_state::machine_reset() -{ - m_maincpu->set_state_int(M68K_PC, m_initial_pc); - - m_kb_mask = 0xff; - m_on_key = 0; - m_lcd_base = 0; - m_lcd_width = 0; - m_lcd_height = 0; - m_lcd_on = 0; - m_lcd_contrast = 0; - memset(m_io_hw1, 0, ARRAY_LENGTH(m_io_hw1) * sizeof(UINT16)); - memset(m_io_hw2, 0, ARRAY_LENGTH(m_io_hw2) * sizeof(UINT16)); - m_timer_on = 0; - m_timer_mask = 0xf; - m_timer_val = 0; -} - -/* video */ -UINT32 ti68k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* preliminary implementation, doesn't use the contrast value */ - UINT8 width = screen.width(); - UINT8 height = screen.height(); - UINT8 x, y, b; - - if (!m_lcd_on || !m_lcd_base) - bitmap.fill(0); - else - for (y = 0; y < height; y++) - for (x = 0; x < width / 8; x++) - { - UINT8 s_byte= m_maincpu->space(AS_PROGRAM).read_byte(m_lcd_base + y * (width/8) + x); - for (b = 0; b<8; b++) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(s_byte, b); - } - - return 0; -} - -PALETTE_INIT_MEMBER(ti68k_state, ti68k) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -static MACHINE_CONFIG_START( ti89, ti68k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(ti89_mem) - - MCFG_NVRAM_ADD_0FILL("nvram") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(ti68k_state, screen_update) - MCFG_SCREEN_SIZE(240, 128) - MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 100-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(ti68k_state, ti68k) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_SHARP_UNK128MBIT_ADD("flash") //should be LH28F320 for ti89t and v200 and LH28F160S3T for other models - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ti68k_timer", ti68k_state, ti68k_timer_callback, attotime::from_hz(1<<14)) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ti92, ti89 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(ti92_mem) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 128-1) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ti92p, ti92 ) - MCFG_CPU_REPLACE("maincpu", M68000, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(ti92p_mem) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( v200, ti92 ) - MCFG_CPU_REPLACE("maincpu", M68000, XTAL_12MHz) - MCFG_CPU_PROGRAM_MAP(v200_mem) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( ti89t, ti89 ) - MCFG_CPU_REPLACE("maincpu", M68000, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(ti89t_mem) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( ti89 ) - ROM_REGION( 0x200000, "flash", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v100", "V 1.00 - HW1" ) - ROMX_LOAD( "ti89v100.rom", 0x000000, 0x200000, CRC(264b34ad) SHA1(c87586a7e9b6d49fbe908fbb6f3c0038f3498573), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v100a", "V 1.00 [a] - HW1" ) - ROMX_LOAD( "ti89v100a.rom", 0x000000, 0x200000, CRC(95199934) SHA1(b8e3cdeb4705b0c7e0a15ab6c6f62bcde14a3a55), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v100m", "V 1.00 [m] - HW1" ) - ROMX_LOAD( "ti89v100m.rom", 0x000000, 0x200000, CRC(b9059e06) SHA1(b33a7c2935eb9f73b210bcf6e7c7f32d1548a9d5), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "v100m2", "V 1.00 [m2] - HW1" ) - ROMX_LOAD( "ti89v100m2.rom", 0x000000, 0x200000, CRC(cdd69d34) SHA1(1686362b0997bb9597f39b443490d4d8d85b56cc), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "v105", "V 1.05 - HW1" ) - ROMX_LOAD( "ti89v105.rom", 0x000000, 0x200000, CRC(3bc0b474) SHA1(46fe0cd511eb81d53dc12cc4bdacec8a5bba5171), ROM_BIOS(5)) - ROM_SYSTEM_BIOS( 5, "v201", "V 2.01 - HW1" ) - ROMX_LOAD( "ti89v201.rom", 0x000000, 0x200000, CRC(fa6745e9) SHA1(e4ee6067df9b975356cef6c5a81d0ec664371c1d), ROM_BIOS(6)) - ROM_SYSTEM_BIOS( 6, "v203", "V 2.03 - HW1" ) - ROMX_LOAD( "ti89v203.rom", 0x000000, 0x200000, CRC(a3a74eca) SHA1(55aae3561722a96973b430e3d4cb4f513298ea4e), ROM_BIOS(7)) - ROM_SYSTEM_BIOS( 7, "v203m", "V 2.03 [m] - HW 1" ) - ROMX_LOAD( "ti89v203m.rom", 0x000000, 0x200000, CRC(d79068f7) SHA1(5b6f571417889b11ae19eef99a5fda4f027d5ec2), ROM_BIOS(8)) - ROM_SYSTEM_BIOS( 8, "v209", "V 2.09 - HW 1" ) - ROMX_LOAD( "ti89v209.rom", 0x000000, 0x200000, CRC(f76f9c15) SHA1(66409ef4b20190a3b7c0d48cbd30257580b47dcd), ROM_BIOS(9)) - ROM_SYSTEM_BIOS( 9, "v105-2","V 1.05 - HW2" ) - ROMX_LOAD( "ti89v105-2.rom", 0x000000, 0x200000, CRC(83817402) SHA1(b2ddf785e973cc3f9a437d058a68abdf7ca52ea2), ROM_BIOS(10)) - ROM_SYSTEM_BIOS( 10, "v203-2", "V 2.03 - HW2" ) - ROMX_LOAD( "ti89v203-2.rom", 0x000000, 0x200000, CRC(5e0400a9) SHA1(43c608ee72f15aed56cb5762948ec6a3c93dd9d8), ROM_BIOS(11)) - ROM_SYSTEM_BIOS( 11, "v203m-2", "V 2.03 [m] - HW2" ) - ROMX_LOAD( "ti89v203m-2.rom", 0x000000, 0x200000, CRC(04d5d76d) SHA1(14ca44b64c29aa1bf274508ca40fe69224f5a7cc), ROM_BIOS(12)) - ROM_SYSTEM_BIOS( 12, "v205-2", "V 2.05 - HW2" ) - ROMX_LOAD( "ti89v205-2.rom", 0x000000, 0x200000, CRC(37c4653c) SHA1(f48d00a57430230e489e243383513485009b1b98), ROM_BIOS(13)) - ROM_SYSTEM_BIOS( 13, "v205-2m", "V 2.05 [m] - HW2" ) - ROMX_LOAD( "ti89v205m-2.rom", 0x000000, 0x200000, CRC(e58a23f9) SHA1(d4cb23fb4b414a43802c37dc3c572a8ede670e0f), ROM_BIOS(14)) - ROM_SYSTEM_BIOS( 14, "v205-2m2","V 2.05 [m2] - HW2" ) - ROMX_LOAD( "ti89v205m2-2.rom", 0x000000, 0x200000, CRC(a8ba976c) SHA1(38bd25ada5e2066c64761d1008a9327a37d68654), ROM_BIOS(15)) - ROM_SYSTEM_BIOS( 15,"v209-2", "V 2.09 - HW2" ) - ROMX_LOAD( "ti89v209-2.rom", 0x000000, 0x200000, CRC(242a238f) SHA1(9668df314a0180ef210796e9cb651c5e9f17eb07), ROM_BIOS(16)) -ROM_END - -ROM_START( ti92 ) - ROM_REGION( 0x200000, "flash", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v111", "V 1.11" ) - ROMX_LOAD( "ti92v111.rom", 0x000000, 0x100000, CRC(67878d52) SHA1(c0fdf162961922a76f286c93fd9b861ce20f23a3), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v13e", "V 1.3 [e]" ) - ROMX_LOAD( "ti92v13e.rom", 0x000000, 0x100000, CRC(316c8196) SHA1(82c8cd484c6aebe36f814a2023d2afad6d87f840), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v14e", "V 1.4 [e]" ) - ROMX_LOAD( "ti92v14e.rom", 0x000000, 0x100000, CRC(239e9405) SHA1(df2f1ab17d490fda43a02f5851b5a15052361b28), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "v17e", "V 1.7 [e]" ) - ROMX_LOAD( "ti92v17e.rom", 0x000000, 0x100000, CRC(83e27cc5) SHA1(aec5a6a6157ff94a4e665fa3fe747bacb6688cd4), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "v111e", "V 1.11 [e]" ) - ROMX_LOAD( "ti92v111e.rom", 0x000000, 0x100000, CRC(4a343833) SHA1(ab4eaacc8c83a861c8d37df5c10e532d0d580460), ROM_BIOS(5)) - ROM_SYSTEM_BIOS( 5, "v112e", "V 1.12 [e]" ) - ROMX_LOAD( "ti92v112e.rom", 0x000000, 0x100000, CRC(9a6947a0) SHA1(8bb0538ca98711e9ad46c56e4dfd609d4699be30), ROM_BIOS(6)) - ROM_SYSTEM_BIOS( 6, "v21e", "V 2.1 [e]" ) - ROMX_LOAD( "ti92v21e.rom", 0x000000, 0x200000, CRC(5afb5863) SHA1(bf7b260d37d1502cc4b08dea5e1d55b523f27925), ROM_BIOS(7)) - -ROM_END - -ROM_START( ti92p ) - ROM_REGION( 0x200000, "flash", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v100", "V 1.00 - HW1" ) - ROMX_LOAD( "ti92pv100.rom", 0x0000, 0x200000, CRC(c651a586) SHA1(fbbf7e053e70eefe517f9aae40c072036bc614ea), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v101", "V 1.01 - HW1" ) - ROMX_LOAD( "ti92pv101.rom", 0x0000, 0x200000, CRC(826b1539) SHA1(dd8969511fc6233bf2047f83c3306ac8d2be5644), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v101a","V 1.01 [a] - HW1" ) - ROMX_LOAD( "ti92pv101a.rom", 0x0000, 0x200000, CRC(18f9002f) SHA1(2bf13ba7da0212a8706c5a43853dc2ccb8c2257d), ROM_BIOS(3)) - ROM_SYSTEM_BIOS( 3, "v101m", "V 1.01 [m] - HW1" ) - ROMX_LOAD( "ti92pv101m.rom", 0x0000, 0x200000, CRC(fe2b6e77) SHA1(0e1bb8c677a726ee086c1a4280ab59de95b4abe2), ROM_BIOS(4)) - ROM_SYSTEM_BIOS( 4, "v105", "V 1.05 - HW1" ) - ROMX_LOAD( "ti92pv105.rom", 0x0000, 0x200000, CRC(cd945824) SHA1(6941aca243c6fd5c8a377253bffc2ffb5a84c41b), ROM_BIOS(5)) - ROM_SYSTEM_BIOS( 5, "v105-2", "V 1.05 - HW2" ) - ROMX_LOAD( "ti92pv105-2.rom", 0x0000, 0x200000, CRC(289aa84f) SHA1(c9395750e20d5a201401699d156b62f00530fcdd), ROM_BIOS(6)) - ROM_SYSTEM_BIOS( 6, "v203", "V 2.03 - HW2" ) - ROMX_LOAD( "ti92pv203.rom", 0x0000, 0x200000, CRC(1612213e) SHA1(1715dd5913bed12baedc4912e9abe0cb4e48cd45), ROM_BIOS(7)) - ROM_SYSTEM_BIOS( 7, "v204", "V 2.04 - HW2" ) - ROMX_LOAD( "ti92pv204.rom", 0x0000, 0x200000, CRC(86819be3) SHA1(78032a0f5f11d1e9a45ffbea91e7f9657fd1a8ae), ROM_BIOS(8)) - ROM_SYSTEM_BIOS( 8, "v205", "V 2.05 - HW2" ) - ROMX_LOAD( "ti92pv205.rom", 0x0000, 0x200000, CRC(9509c575) SHA1(703410d8bb98b8ec14277efcd8b7dda45a7cf358), ROM_BIOS(9)) - ROM_SYSTEM_BIOS( 9, "v205m", "V 2.05 [m] - HW2" ) - ROMX_LOAD( "ti92pv205m.rom", 0x000000, 0x200000, CRC(13ef4d57) SHA1(6ef290bb0dda72f645cd3eca9cc1185f6a2d32dc), ROM_BIOS(10)) - ROM_SYSTEM_BIOS( 10, "v209", "V 2.09 - HW2" ) - ROMX_LOAD( "ti92pv209.rom", 0x000000, 0x200000, CRC(4851ad52) SHA1(10e6c2cdc60623bf0be7ea72a9ec840259fb37c3), ROM_BIOS(11)) -ROM_END - -ROM_START( v200 ) - ROM_REGION( 0x400000, "flash", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v209", "V 2.09" ) - ROMX_LOAD( "voyage200v209.rom", 0x0000, 0x400000, CRC(f805c7a6) SHA1(818b919058ba3bd7d15604f11fff6740010d07fc), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v310", "V 3.10" ) - ROMX_LOAD( "voyage200v310.rom", 0x0000, 0x400000, CRC(ed4cbfd2) SHA1(39cdb9932f314ff792b1cc5e3fe041d98b9fd101), ROM_BIOS(2)) -ROM_END - -ROM_START( ti89t ) - ROM_REGION( 0x400000, "flash", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v300", "V 3.00" ) - ROMX_LOAD( "ti89tv300.rom", 0x0000, 0x400000, CRC(55eb4f5a) SHA1(4f919d7752caf2559a79883ec8711a9701d19513), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v310", "V 3.10" ) - ROMX_LOAD( "ti89tv310.rom", 0x0000, 0x400000, CRC(b6967cca) SHA1(fb4f09e5c4500dee651b8de537e502ab97cb8328), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1998, ti89, 0, 0, ti89, ti8x, driver_device, 0, "Texas Instruments", "TI-89", MACHINE_NO_SOUND) -COMP( 1995, ti92, 0, 0, ti92, ti9x, driver_device, 0, "Texas Instruments", "TI-92", MACHINE_NO_SOUND) -COMP( 1999, ti92p, 0, 0, ti92p, ti9x, driver_device, 0, "Texas Instruments", "TI-92 Plus", MACHINE_NO_SOUND) -COMP( 2002, v200, 0, 0, v200, ti9x, driver_device, 0, "Texas Instruments", "Voyage 200 PLT",MACHINE_NO_SOUND) -COMP( 2004, ti89t, 0, 0, ti89t, ti8x, driver_device, 0, "Texas Instruments", "TI-89 Titanium",MACHINE_NO_SOUND) diff --git a/src/mess/drivers/ti990_10.c b/src/mess/drivers/ti990_10.c deleted file mode 100644 index 21c0fe33010..00000000000 --- a/src/mess/drivers/ti990_10.c +++ /dev/null @@ -1,389 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - TI990/10 driver - - This driver boots the DX10 build tape and build a bootable system disk. - I have been able to run a few programs (including most games from the - "fun and games" tape), but I have been unable to perform system generation - and install BASIC/COBOL/PASCAL. - -TODO : -* programmer panel -* emulate TILINE fully: timings, tiline timeout, possibly memory error -* finish tape emulation (write support) -* add additional devices as need appears (931 VDT, FD800, card reader, ASR/KSR, printer) -* emulate 990/10A and 990/12 CPUs? -* find out why the computer locks when executing ALGS and BASIC/COBOL/PASCAL installation -*/ - -/* - CRU map: - - 990/10 CPU board: - 1fa0-1fbe: map file CRU interface - 1fc0-1fde: error interrupt register - 1fe0-1ffe: control panel - - optional hardware (default configuration): - 0000-001e: 733 ASR - 0020-003e: PROM programmer - 0040-005e: card reader - 0060-007e: line printer - 0080-00be: FD800 floppy disc - 00c0-00ee: 913 VDT, or 911 VDT - 0100-013e: 913 VDT #2, or 911 VDT - 0140-017e: 913 VDT #3, or 911 VDT - 1700-177e (0b00-0b7e, 0f00-0f7e): CI402 serial controller #0 (#1, #2) (for 931/940 VDT) - (note that CRU base 1700 is used by the integrated serial controller in newer S300, - S300A, 990/10A (and 990/5?) systems) - 1f00-1f1e: CRU expander #1 interrupt register - 1f20-1f3e: CRU expander #2 interrupt register - 1f40-1f5e: TILINE coupler interrupt control #1-8 - - - TPCS map: - 1ff800: disk controller #1 (system disk) - 1ff810->1ff870: extra disk controllers #2 through #8 - 1ff880 (1ff890): tape controller #1 (#2) - 1ff900->1ff950: communication controllers #1 through #6 - 1ff980 (1ff990, 1ff9A0): CI403/404 serial controller #1 (#2, #3) (for 931/940 VDT) - 1ffb00, 1ffb04, etc: ECC memory controller #1, #2, etc, diagnostic - 1ffb10, 1ffb14, etc: cache memory controller #1, #2, etc, diagnostic - - - interrupt map (default configuration): - 0,1,2: CPU board - 3: free - 4: card reader - 5: line clock - 6: 733 ASR/KSR - 7: FD800 floppy (or FD1000 floppy) - 8: free - 9: 913 VDT #3 - 10: 913 VDT #2 - 11: 913 VDT - 12: free - 13: hard disk - 14 line printer - 15: PROM programmer (actually not used) -*/ - -#include "emu.h" - -#include "cpu/tms9900/ti990_10.h" -#include "sound/beep.h" -#include "bus/ti99x/990_hd.h" -#include "bus/ti99x/990_tap.h" -#include "video/911_vdt.h" - - -class ti990_10_state : public driver_device -{ -public: - ti990_10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_intlines(0), - m_ckon_state(0) { } - - device_t *m_terminal; - DECLARE_DRIVER_INIT(ti990_10); - virtual void machine_reset(); - virtual void video_start(); - - DECLARE_WRITE_LINE_MEMBER( key_interrupt ); - DECLARE_WRITE_LINE_MEMBER( line_interrupt ); - DECLARE_WRITE_LINE_MEMBER( tape_interrupt ); - void ti990_set_int_line(int line, int state); - WRITE_LINE_MEMBER(ti990_set_int13); - TIMER_CALLBACK_MEMBER(clear_load); - void ti990_hold_load(); - WRITE_LINE_MEMBER(ti990_ckon_ckof_callback); - READ8_MEMBER( ti990_panel_read ); - WRITE8_MEMBER( ti990_panel_write ); - - required_device m_maincpu; - UINT16 m_intlines; - int m_ckon_state; -}; - - -/* - Interrupt priority encoder. Actually part of the CPU board. -*/ - -void ti990_10_state::ti990_set_int_line(int line, int state) -{ - int level; - - - if (state) - m_intlines |= (1 << line); - else - m_intlines &= ~ (1 << line); - - if (m_intlines) - { - for (level = 0; ! (m_intlines & (1 << level)); level++) - ; - m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, level); /* interrupt it, baby */ - } - else - m_maincpu->set_input_line(0, CLEAR_LINE); -} - - -WRITE_LINE_MEMBER(ti990_10_state::ti990_set_int13) -{ - ti990_set_int_line(13, state); -} - -/* - hold and debounce load line (emulation is inaccurate) -*/ - -TIMER_CALLBACK_MEMBER(ti990_10_state::clear_load) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); -} - -void ti990_10_state::ti990_hold_load() -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(ti990_10_state::clear_load),this)); -} - -/* - line interrupt -*/ - -/* m_ckon_state: 1 if line clock active (RTCLR flip-flop on TI990/10 schematics - -SMI sheet 4) */ -WRITE_LINE_MEMBER(ti990_10_state::line_interrupt) -{ - // set_int10(state); - if (m_ckon_state) - ti990_set_int_line(5, 1); -} - -WRITE_LINE_MEMBER(ti990_10_state::ti990_ckon_ckof_callback) -{ - m_ckon_state = state; - if (! m_ckon_state) - ti990_set_int_line(5, 0); -} - - - -/* - Control panel emulation - - three panel types - * operator panel - * programmer panel - * MDU (external unit connected instead of the control panel, as seen in - 945401-9701 p. 2-5 though 2-15) - - Operator panel: - * Power led - * Fault led - * Off/On/Load switch - - Programmer panel: - * 16 status light, 32 switches, IDLE, RUN leds - * interface to a low-level debugger in ROMs - - * MDU: - * includes a programmer panel, a tape unit, and a few parts - (diagnostic tape, diagnostic ROMs, etc.) - - CRU output: - 0-7: lights 0-7 - 8: increment scan - 9: clear scan (according to 990 handbook) - A: run light (additionally sets all data LEDs to 1s, the scan count to 0b10 and enables the HALT/SIE switch) - B: fault light - C: Memory Error Interrupt clear - D: Start panel timer - E: Set SIE function (interrupt after 2 instructions are executed) - F: flag (according to 990 handbook) - - input : - 0-7: switches 0-7 (or data from MDU tape) - 8: scan count bit 1 - 9: scan count bit 0 - A: timer active - B: programmer panel not present or locked - C: char in MDU tape unit buffer? - D: unused? - E: if 0, MDU unit present - F: flag (according to 990 handbook) -*/ - -READ8_MEMBER( ti990_10_state::ti990_panel_read ) -{ - if (offset == 1) - return 0x48; - - return 0; -} - -WRITE8_MEMBER( ti990_10_state::ti990_panel_write ) -{ -} - - -void ti990_10_state::machine_reset() -{ - ti990_hold_load(); -} - -/* -void ti990_10_state::rset_callback) -{ - ti990_cpuboard_reset(); - - // clear controller panel and smi fault LEDs -} - -void ti990_10_state::lrex_callback) -{ - // right??? - ti990_hold_load(); -} -*/ - -/* - TI990/10 video emulation. - - We emulate a single VDT911 CRT terminal. -*/ - -void ti990_10_state::video_start() -{ - m_terminal = machine().device("vdt911"); -} - -WRITE_LINE_MEMBER(ti990_10_state::key_interrupt) -{ - // set_int10(state); -} - -/* - Memory map - see description above -*/ - -static ADDRESS_MAP_START(ti990_10_memmap, AS_PROGRAM, 16, ti990_10_state ) - - AM_RANGE(0x000000, 0x0fffff) AM_RAM /* let's say we have 1MB of RAM */ - AM_RANGE(0x100000, 0x1ff7ff) AM_NOP /* free TILINE space */ - AM_RANGE(0x1ff800, 0x1ff81f) AM_DEVREADWRITE("hdc", ti990_hdc_device, read, write) /* disk controller TPCS */ - AM_RANGE(0x1ff820, 0x1ff87f) AM_NOP /* free TPCS */ - AM_RANGE(0x1ff880, 0x1ff89f) AM_DEVREADWRITE("tpc", tap_990_device, read, write) /* tape controller TPCS */ - AM_RANGE(0x1ff8a0, 0x1ffbff) AM_NOP /* free TPCS */ - AM_RANGE(0x1ffc00, 0x1fffff) AM_ROM /* LOAD ROM */ - -ADDRESS_MAP_END - - -/* - CRU map -*/ - -static ADDRESS_MAP_START(ti990_10_io, AS_IO, 8, ti990_10_state ) - AM_RANGE(0x10, 0x11) AM_DEVREAD("vdt911", vdt911_device, cru_r) - AM_RANGE(0x80, 0x8f) AM_DEVWRITE("vdt911", vdt911_device, cru_w) - AM_RANGE(0x1fa, 0x1fb) AM_NOP // AM_READ(ti990_10_mapper_cru_r) - AM_RANGE(0x1fc, 0x1fd) AM_NOP // AM_READ(ti990_10_eir_cru_r) - AM_RANGE(0x1fe, 0x1ff) AM_READ(ti990_panel_read) - AM_RANGE(0xfd0, 0xfdf) AM_NOP // AM_WRITE(ti990_10_mapper_cru_w) - AM_RANGE(0xfe0, 0xfef) AM_NOP // AM_WRITE(ti990_10_eir_cru_w) - AM_RANGE(0xff0, 0xfff) AM_WRITE(ti990_panel_write) - -ADDRESS_MAP_END - -/* - Callback from the tape controller. -*/ -WRITE_LINE_MEMBER(ti990_10_state::tape_interrupt) -{ - // set_int9(state); -} - -static MACHINE_CONFIG_START( ti990_10, ti990_10_state ) - /* basic machine hardware */ - /* TI990/10 CPU @ 4.0(???) MHz */ - MCFG_TMS99xx_ADD("maincpu", TI990_10, 4000000, ti990_10_memmap, ti990_10_io ) - - // VDT 911 terminal - MCFG_DEVICE_ADD("vdt911", VDT911, 0) - MCFG_VDT911_KEYINT_HANDLER(WRITELINE(ti990_10_state, key_interrupt)) - MCFG_VDT911_LINEINT_HANDLER(WRITELINE(ti990_10_state, line_interrupt)) - - // Hard disk - MCFG_DEVICE_ADD("hdc", TI990_HDC, 0) - MCFG_TI990_HDC_INT_CALLBACK(WRITELINE(ti990_10_state, ti990_set_int13)) - - // Tape controller - MCFG_DEVICE_ADD("tpc", TI990_TAPE_CTRL, 0) - MCFG_TI990_TAPE_INT_HANDLER(WRITELINE(ti990_10_state, tape_interrupt)) -MACHINE_CONFIG_END - - -/* - ROM loading -*/ -ROM_START(ti990_10) - - /*CPU memory space*/ -#if 0 - - ROM_REGION16_BE(0x200000, "maincpu",0) - - /* TI990/10 : older boot ROMs for floppy-disk */ - ROM_LOAD16_BYTE("975383.31", 0x1FFC00, 0x100, CRC(64fcd040)) - ROM_LOAD16_BYTE("975383.32", 0x1FFC01, 0x100, CRC(64277276)) - ROM_LOAD16_BYTE("975383.29", 0x1FFE00, 0x100, CRC(af92e7bf)) - ROM_LOAD16_BYTE("975383.30", 0x1FFE01, 0x100, CRC(b7b40cdc)) - -#elif 1 - - ROM_REGION16_BE(0x200000, "maincpu",0) - - /* TI990/10 : newer "universal" boot ROMs */ - ROM_LOAD16_BYTE("975383.45", 0x1FFC00, 0x100, CRC(391943c7) SHA1(bbd4da60b221d146542a6b547ae1570024e41b8a)) - ROM_LOAD16_BYTE("975383.46", 0x1FFC01, 0x100, CRC(f40f7c18) SHA1(03613bbf2263a4335c25dfc63cf2878c06bfe280)) - ROM_LOAD16_BYTE("975383.47", 0x1FFE00, 0x100, CRC(1ba571d8) SHA1(adaa18f149b643cc842fea8d7107ee868d6ffaf4)) - ROM_LOAD16_BYTE("975383.48", 0x1FFE01, 0x100, CRC(8852b09e) SHA1(f0df2abb438716832c16ab111e475da3ae612673)) - -#else - - ROM_REGION16_BE(0x202000, "maincpu",0) - - /* TI990/12 ROMs - actually incompatible with TI990/10, but I just wanted to disassemble them. */ - ROM_LOAD16_BYTE("ti2025-7", 0x1FFC00, 0x1000, CRC(4824f89c)) - ROM_LOAD16_BYTE("ti2025-8", 0x1FFC01, 0x1000, CRC(51fef543)) - /* the other half of this ROM is not loaded - it makes no sense as TI990/12 machine code, as - it is microcode... */ - -#endif - - - /* VDT911 character definitions */ - ROM_REGION(vdt911_chr_region_len, vdt911_chr_region, ROMREGION_ERASEFF) - -ROM_END - -DRIVER_INIT_MEMBER(ti990_10_state,ti990_10) -{ -#if 0 - /* load specific ti990/12 rom page */ - const int page = 3; - - memmove(memregion("maincpu")->base()+0x1FFC00, memregion("maincpu")->base()+0x1FFC00+(page*0x400), 0x400); -#endif -} - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1975, ti990_10, 0, 0, ti990_10, 0, ti990_10_state, ti990_10, "Texas Instruments", "TI Model 990/10 Minicomputer System" , MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/ti990_4.c b/src/mess/drivers/ti990_4.c deleted file mode 100644 index b18fe23ff34..00000000000 --- a/src/mess/drivers/ti990_4.c +++ /dev/null @@ -1,367 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Michael Zapf -/* - ti990/4 driver - - We emulate a basic ti990/4 board, with a FD800 disk controller and an 733 - ASR terminal. A little floppy-based software for this computer is - available thanks to efforts by Dave Pitts: mostly, Forth and TX990. - - - Board setup options: - 8kb of DRAM (onboard option, with optional parity): base 0x0000 or 0x2000 - 4 banks of 512 bytes of ROM or SRAM: base 0x0000, 0x0800, 0xF000 or 0xF800 - power-up vector: 0x0000 (level 0) or 0xFFFC (load) - optional memerr interrupt (level 2) - optional power fail interrupt (level 1) - optional real-time clock interrupt (level 5 or 7) - - - Setup for the emulated system: - 0x0000: 8kb on-board DRAM + 24kb extension RAM (total 32kb) - 0xF800: 512 bytes SRAM - 0xFA00: 512 bytes SRAM (or empty?) - 0xFC00: 512 bytes self-test ROM - 0xFE00: 512 bytes loader ROM - power-up vector: 0xFFFC (load) - - Note that only interrupt levels 3-7 are supported by the board (8-15 are not wired). - -TODO: -* finish ASR emulation -* programmer panel -* emulate other devices: card reader, printer - - Original implementation: Raphael Nabet - - Rewritten by Michael Zapf 2014 -*/ - -#include "emu.h" -#include "cpu/tms9900/tms9900.h" - -#include "video/911_vdt.h" -#include "sound/beep.h" -#include "video/733_asr.h" - -#include "bus/ti99x/990_dk.h" - - -class ti990_4_state : public driver_device -{ -public: - ti990_4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_fd800(*this, "fd800") { } - - DECLARE_READ8_MEMBER( panel_read ); - DECLARE_WRITE8_MEMBER( panel_write ); - DECLARE_WRITE8_MEMBER( external_operation ); - DECLARE_READ8_MEMBER( interrupt_level ); - DECLARE_WRITE_LINE_MEMBER( fd_interrupt ); - DECLARE_WRITE_LINE_MEMBER( asrkey_interrupt ); - DECLARE_WRITE_LINE_MEMBER( vdtkey_interrupt ); - DECLARE_WRITE_LINE_MEMBER( line_interrupt ); - - DECLARE_DRIVER_INIT(ti990_4); - DECLARE_DRIVER_INIT(ti990_4v); - - DECLARE_MACHINE_RESET(ti990_4); - -private: - void hold_load(); - void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - int m_intlines; - int m_int_level; - emu_timer* m_nmi_timer; - void reset_int_lines(); - void set_int_line(int line, int state); - - bool m_ckon_state; - - // Connected devices - required_device m_maincpu; - required_device m_fd800; -}; - -enum -{ - NMI_TIMER_ID = 1 -}; - -void ti990_4_state::hold_load() -{ - m_maincpu->set_input_line(INT_9900_LOAD, ASSERT_LINE); - logerror("ti990_4: Triggering LOAD interrupt\n"); - m_nmi_timer->adjust(attotime::from_msec(100)); -} - -/* - LOAD interrupt trigger callback -*/ -void ti990_4_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - m_maincpu->set_input_line(INT_9900_LOAD, CLEAR_LINE); - logerror("ti990_4: Released LOAD interrupt\n"); -} - -READ8_MEMBER( ti990_4_state::panel_read ) -{ - if (offset == 1) - return 0x48; - - return 0; -} - -WRITE8_MEMBER( ti990_4_state::panel_write ) -{ - logerror("ti990_4: writing to panel @CRU %04x: %02x\n", offset<<1, data); -} - -void ti990_4_state::set_int_line(int line, int state) -{ - if (state) - m_intlines |= (1 << line); - else - m_intlines &= ~(1 << line); - - if (m_intlines != 0) - { - m_int_level = 0; - while ((m_intlines & (1 << m_int_level))==0) m_int_level++; - logerror("ti990_4: Setting int level to %x\n", m_int_level); - m_maincpu->set_input_line(INT_9900_INTREQ, ASSERT_LINE); - } - else - m_maincpu->set_input_line(INT_9900_INTREQ, CLEAR_LINE); -} - -void ti990_4_state::reset_int_lines() -{ - m_intlines = 0; -} - -/* - Callback from the floppy controller. -*/ -WRITE_LINE_MEMBER(ti990_4_state::fd_interrupt) -{ - set_int_line(7, state); -} - -/* - Connection to VDT -*/ -WRITE_LINE_MEMBER(ti990_4_state::vdtkey_interrupt) -{ - set_int_line(3, state); -} - -WRITE_LINE_MEMBER(ti990_4_state::line_interrupt) -{ - if (m_ckon_state) set_int_line(5, state); -} - -/* - Callback from the terminal. -*/ -WRITE_LINE_MEMBER(ti990_4_state::asrkey_interrupt) -{ - set_int_line(6, state); -} - -WRITE8_MEMBER( ti990_4_state::external_operation ) -{ - static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; - switch (offset) - { - case IDLE_OP: - return; - case RSET_OP: - m_ckon_state = false; - // clear controller panel and smi fault LEDs - break; - case CKON_OP: - m_ckon_state = true; - break; - case CKOF_OP: - m_ckon_state = false; - set_int_line(5, 0); - break; - case LREX_OP: - // TODO: Verify this - hold_load(); - break; - - default: - logerror("ti99_4x: External operation %s not implemented on TI-990/4 board\n", extop[offset]); - } -} - -READ8_MEMBER( ti990_4_state::interrupt_level ) -{ - return m_int_level; -} - -/* - Memory map - see description above -*/ - -static ADDRESS_MAP_START(memmap, AS_PROGRAM, 16, ti990_4_state ) - AM_RANGE(0x0000, 0x7fff) AM_RAM /* dynamic RAM */ - AM_RANGE(0x8000, 0xf7ff) AM_NOP /* reserved for expansion */ - AM_RANGE(0xf800, 0xfbff) AM_RAM /* static RAM? */ - AM_RANGE(0xfc00, 0xffff) AM_ROM /* LOAD ROM */ -ADDRESS_MAP_END - - -/* - CRU map - - 0x000-0xF7F: user devices - 0xF80-0xF9F: CRU interrupt + expansion control - 0xFA0-0xFAF: TILINE coupler interrupt control - 0xFB0-0xFCF: reserved - 0xFD0-0xFDF: memory mapping and memory protect - 0xFE0-0xFEF: internal interrupt control - 0xFF0-0xFFF: front panel - - Default user map: - 0x000-0x00f: 733 ASR (int 6) - 0x010-0x01f: PROM programmer (wired to int 15, unused) - 0x020-0x02f: 804 card reader (int 4) - 0x030-0x03f: line printer (wired to int 14, unused) - 0x040-0x05f: FD800 floppy controller (int 7) - 0x060-0x07f: VDT1 (int 3 - wired to int 11, unused) - 0x080-0x09f: VDT2, or CRU expansion (int ??? - wired to int 10, unused) - 0x0a0-0x0bf: VDT3 (int ??? - wired to int 9, unused) -*/ - -static ADDRESS_MAP_START(cru_map, AS_IO, 8, ti990_4_state ) - AM_RANGE(0x00, 0x01) AM_DEVREAD("asr733", asr733_device, cru_r) - AM_RANGE(0x00, 0x0f) AM_DEVWRITE("asr733", asr733_device, cru_w) - - AM_RANGE(0x08, 0x0b) AM_DEVREAD( "fd800", fd800_legacy_device, cru_r ) - AM_RANGE(0x40, 0x5f) AM_DEVWRITE( "fd800", fd800_legacy_device, cru_w ) - - AM_RANGE(0x1fe, 0x1ff) AM_READ( panel_read ) - AM_RANGE(0xff0, 0xfff) AM_WRITE( panel_write ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(cru_map_v, AS_IO, 8, ti990_4_state ) - AM_RANGE(0x10, 0x11) AM_DEVREAD("vdt911", vdt911_device, cru_r) - AM_RANGE(0x80, 0x8f) AM_DEVWRITE("vdt911", vdt911_device, cru_w) - - AM_RANGE(0x08, 0x0b) AM_DEVREAD( "fd800", fd800_legacy_device, cru_r ) - AM_RANGE(0x40, 0x5f) AM_DEVWRITE( "fd800", fd800_legacy_device, cru_w ) - - AM_RANGE(0x1fe, 0x1ff) AM_READ( panel_read ) - AM_RANGE(0xff0, 0xfff) AM_WRITE( panel_write ) -ADDRESS_MAP_END - - -/* static const floppy_interface ti990_4_floppy_interface = -{ - FLOPPY_STANDARD_8_DSSD, - LEGACY_FLOPPY_OPTIONS_NAME(fd800), - NULL -}; */ - -MACHINE_RESET_MEMBER(ti990_4_state,ti990_4) -{ - hold_load(); - reset_int_lines(); - m_ckon_state = false; - m_maincpu->set_ready(ASSERT_LINE); -} - -DRIVER_INIT_MEMBER(ti990_4_state, ti990_4) -{ - m_nmi_timer = timer_alloc(NMI_TIMER_ID); -} - -static MACHINE_CONFIG_START( ti990_4, ti990_4_state ) - /* basic machine hardware */ - /* TMS9900 CPU @ 3.0(???) MHz */ - MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) - MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti990_4_state, external_operation) ) - MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti990_4_state, interrupt_level) ) - - MCFG_MACHINE_RESET_OVERRIDE(ti990_4_state, ti990_4 ) - - // Terminal - MCFG_DEVICE_ADD("asr733", ASR733, 0) - MCFG_ASR733_KEYINT_HANDLER(WRITELINE(ti990_4_state, asrkey_interrupt)) - MCFG_ASR733_LINEINT_HANDLER(WRITELINE(ti990_4_state, line_interrupt)) - - // Floppy controller - MCFG_DEVICE_ADD("fd800", FD800, 0) - MCFG_FD800_INT_HANDLER(WRITELINE(ti990_4_state, fd_interrupt)) - -// MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(ti990_4_floppy_interface) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ti990_4v, ti990_4_state ) - /* basic machine hardware */ - /* TMS9900 CPU @ 3.0(???) MHz */ - MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map_v) - MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti990_4_state, external_operation) ) - MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti990_4_state, interrupt_level) ) - MCFG_MACHINE_RESET_OVERRIDE(ti990_4_state, ti990_4 ) - - // Terminal - MCFG_DEVICE_ADD("vdt911", VDT911, 0) - MCFG_VDT911_KEYINT_HANDLER(WRITELINE(ti990_4_state, vdtkey_interrupt)) - MCFG_VDT911_LINEINT_HANDLER(WRITELINE(ti990_4_state, line_interrupt)) - - // Floppy controller - MCFG_DEVICE_ADD("fd800", FD800, 0) - MCFG_FD800_INT_HANDLER(WRITELINE(ti990_4_state, fd_interrupt)) - -// MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(ti990_4_floppy_interface) -MACHINE_CONFIG_END - -/* - ROM loading -*/ -ROM_START(ti990_4) - /*CPU memory space*/ - ROM_REGION16_BE(0x10000, "maincpu",0) - -#if 0 - /* ROM set 945121-5: "733 ASR ROM loader with self test (prototyping)" - (cf 945401-9701 pp. 1-19) */ - - /* test ROM */ - ROMX_LOAD("94519209.u39", 0xFC00, 0x100, CRC(0a0b0c42), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - ROMX_LOAD("94519210.u55", 0xFC00, 0x100, CRC(d078af61), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - ROMX_LOAD("94519211.u61", 0xFC01, 0x100, CRC(6cf7d4a0), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - ROMX_LOAD("94519212.u78", 0xFC01, 0x100, CRC(d9522458), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - - /* LOAD ROM */ - ROMX_LOAD("94519113.u3", 0xFE00, 0x100, CRC(8719b04e), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - ROMX_LOAD("94519114.u4", 0xFE00, 0x100, CRC(72a040e0), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - ROMX_LOAD("94519115.u6", 0xFE01, 0x100, CRC(9ccf8cca), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - ROMX_LOAD("94519116.u7", 0xFE01, 0x100, CRC(fa387bf3), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - -#else - /* ROM set 945121-4(?): "Floppy disc loader with self test" (cf 945401-9701 pp. 1-19) */ - ROM_LOAD16_WORD("ti9904.rom", 0xFC00, 0x400, CRC(691e7d19) SHA1(58d9bed80490fdf71c743bfd3077c70840b7df8c)) -#endif - - ROM_REGION(asr733_chr_region_len, asr733_chr_region, ROMREGION_ERASEFF) -ROM_END - -ROM_START(ti990_4v) - /*CPU memory space*/ - ROM_REGION16_BE(0x10000, "maincpu",0) - ROM_LOAD16_WORD("ti9904.rom", 0xFC00, 0x400, CRC(691e7d19) SHA1(58d9bed80490fdf71c743bfd3077c70840b7df8c)) - - /* VDT911 character definitions */ - ROM_REGION(vdt911_chr_region_len, vdt911_chr_region, ROMREGION_ERASEFF) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1976, ti990_4, 0, 0, ti990_4, 0, ti990_4_state, ti990_4, "Texas Instruments", "TI Model 990/4 Microcomputer System" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1976, ti990_4v, ti990_4, 0, ti990_4v, 0, ti990_4_state, ti990_4, "Texas Instruments", "TI Model 990/4 Microcomputer System with Video Display Terminal" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/ti99_2.c b/src/mess/drivers/ti99_2.c deleted file mode 100644 index 993b657f29b..00000000000 --- a/src/mess/drivers/ti99_2.c +++ /dev/null @@ -1,416 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - Experimental ti99/2 driver - -TODO : - * find a TI99/2 ROM dump (some TI99/2 ARE in private hands) - * test the driver ! - * understand the "viden" pin - * implement cassette - * implement Hex-Bus - - Raphael Nabet (who really has too much time to waste), december 1999, 2000 -*/ - -/* - TI99/2 facts : - -References : -* TI99/2 main logic board schematics, 83/03/28-30 (on ftp.whtech.com, or just ask me) - (Thanks to Charles Good for posting this) - -general : -* prototypes in 1983 -* uses a 10.7MHz TMS9995 CPU, with the following features : - - 8-bit data bus - - 256 bytes 16-bit RAM (0xff00-0xff0b & 0xfffc-0xffff) - - only available int lines are INT4 (used by vdp), INT1*, and NMI* (both free for extension) - - on-chip decrementer (0xfffa-0xfffb) - - Unlike tms9900, CRU address range is full 0x0000-0xFFFE (A0 is not used as address). - This is possible because tms9995 uses d0-d2 instead of the address MSBits to support external - opcodes. - - quite more efficient than tms9900, and a few additionnal instructions and features -* 24 or 32kb ROM (16kb plain (1kb of which used by vdp), 16kb split into 2 8kb pages) -* 4kb 8-bit RAM, 256 bytes 16-bit RAM -* custom vdp shares CPU RAM/ROM. The display is quite alike to tms9928 graphics mode, except - that colors are a static B&W, and no sprite is displayed. The config (particularily the - table base addresses) cannot be changed. Since TI located the pattern generator table in - ROM, we cannot even redefine the char patterns (unless you insert a custom cartidge which - overrides the system ROMs). VBL int triggers int4 on tms9995. -* CRU is handled by one single custom chip, so the schematics don't show many details :-( . -* I/O : - - 48-key keyboard. Same as TI99/4a, without alpha lock, and with an additional break key. - Note that the hardware can make the difference between the two shift keys. - - cassette I/O (one unit) - - ALC bus (must be another name for Hex-Bus) -* 60-pin expansion/cartidge port on the back - -memory map : -* 0x0000-0x4000 : system ROM (0x1C00-0x2000 (?) : char ROM used by vdp) -* 0x4000-0x6000 : system ROM, mapped to either of two distinct 8kb pages according to the S0 - bit from the keyboard interface (!), which is used to select the first key row. - [only on second-generation TI99/2 protos, first generation protos only had 24kb of ROM] -* 0x6000-0xE000 : free for expansion -* 0xE000-0xF000 : 8-bit "system" RAM (0xEC00-0xEF00 used by vdp) -* 0xF000-0xF0FB : 16-bit processor RAM (on tms9995) -* 0xF0FC-0xFFF9 : free for expansion -* 0xFFFA-0xFFFB : tms9995 internal decrementer -* 0xFFFC-0xFFFF : 16-bit processor RAM (provides the NMI vector) - -CRU map : -* 0x0000-0x1EFC : reserved -* 0x1EE0-0x1EFE : tms9995 flag register -* 0x1F00-0x1FD8 : reserved -* 0x1FDA : tms9995 MID flag -* 0x1FDC-0x1FFF : reserved -* 0x2000-0xE000 : unaffected -* 0xE400-0xE40E : keyboard I/O (8 bits input, either 3 or 6 bit output) -* 0xE80C : cassette I/O -* 0xE80A : ALC BAV -* 0xE808 : ALC HSK -* 0xE800-0xE808 : ALC data (I/O) -* 0xE80E : video enable (probably input - seems to come from the VDP, and is present on the - expansion connector) -* 0xF000-0xFFFE : reserved -Note that only A15-A11 and A3-A1 (A15 = MSB, A0 = LSB) are decoded in the console, so the keyboard -is actually mapped to 0xE000-0xE7FE, and other I/O bits to 0xE800-0xEFFE. -Also, ti99/2 does not support external instructions better than ti99/4(a). This is crazy, it -would just have taken three extra tracks on the main board and a OR gate in an ASIC. -*/ - -#include "emu.h" -#include "machine/tms9901.h" -#include "cpu/tms9900/tms9995.h" - -class ti99_2_state : public driver_device -{ -public: - ti99_2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - required_shared_ptr m_videoram; - int m_ROM_paged; - int m_irq_state; - int m_KeyRow; - DECLARE_WRITE8_MEMBER(ti99_2_write_kbd); - DECLARE_WRITE8_MEMBER(ti99_2_write_misc_cru); - DECLARE_READ8_MEMBER(ti99_2_read_kbd); - DECLARE_READ8_MEMBER(ti99_2_read_misc_cru); - DECLARE_DRIVER_INIT(ti99_2_24); - DECLARE_DRIVER_INIT(ti99_2_32); - virtual void machine_reset(); - UINT32 screen_update_ti99_2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(ti99_2_vblank_interrupt); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; -}; - - - -DRIVER_INIT_MEMBER(ti99_2_state,ti99_2_24) -{ - /* no ROM paging */ - m_ROM_paged = 0; -} - -DRIVER_INIT_MEMBER(ti99_2_state,ti99_2_32) -{ - /* ROM paging enabled */ - m_ROM_paged = 1; -} - -#define TI99_2_32_ROMPAGE0 (memregion("maincpu")->base()+0x4000) -#define TI99_2_32_ROMPAGE1 (memregion("maincpu")->base()+0x10000) - -void ti99_2_state::machine_reset() -{ - m_irq_state = ASSERT_LINE; - if (! m_ROM_paged) - membank("bank1")->set_base(memregion("maincpu")->base()+0x4000); - else - membank("bank1")->set_base((memregion("maincpu")->base()+0x4000)); - - // Configure CPU to insert 1 wait state for each external memory access - // by lowering the READY line on reset - // TODO: Check with specs - static_cast(machine().device("maincpu"))->set_ready(CLEAR_LINE); -} - -INTERRUPT_GEN_MEMBER(ti99_2_state::ti99_2_vblank_interrupt) -{ - m_maincpu->set_input_line(INT_9995_INT1, m_irq_state); - m_irq_state = (m_irq_state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE; -} - - -/* - TI99/2 vdp emulation. - - Things could not be simpler. - We display 24 rows and 32 columns of characters. Each 8*8 pixel character pattern is defined - in a 128-entry table located in ROM. Character code for each screen position are stored - sequentially in RAM. Colors are a fixed Black on White. - - There is an EOL character that blanks the end of the current line, so that - the CPU can get more bus time. -*/ - - - -UINT32 ti99_2_state::screen_update_ti99_2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_videoram; - int i, sx, sy; - - - sx = sy = 0; - - for (i = 0; i < 768; i++) - { - /* Is the char code masked or not ??? */ - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, videoram[i] & 0x7F, 0, - 0, 0, sx, sy); - - sx += 8; - if (sx == 256) - { - sx = 0; - sy += 8; - } - } - - return 0; -} - -static const gfx_layout ti99_2_charlayout = -{ - 8,8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - /* x offsets */ - { 0,1,2,3,4,5,6,7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( ti99_2 ) - GFXDECODE_ENTRY( "maincpu", 0x1c00, ti99_2_charlayout, 0, 1 ) -GFXDECODE_END - - -/* - Memory map - see description above -*/ - -static ADDRESS_MAP_START( ti99_2_memmap, AS_PROGRAM, 8, ti99_2_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM /* system ROM */ - AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1") /* system ROM, banked on 32kb ROMs protos */ - AM_RANGE(0x6000, 0xdfff) AM_NOP /* free for expansion */ - AM_RANGE(0xe000, 0xebff) AM_RAM /* system RAM */ - AM_RANGE(0xec00, 0xeeff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0xef00, 0xefff) AM_RAM /* system RAM */ - AM_RANGE(0xf000, 0xffff) AM_NOP /* free for expansion (and internal processor RAM) */ -ADDRESS_MAP_END - - -/* - CRU map - see description above -*/ - -/* current keyboard row */ - -/* write the current keyboard row */ -WRITE8_MEMBER(ti99_2_state::ti99_2_write_kbd) -{ - offset &= 0x7; /* other address lines are not decoded */ - - if (offset <= 2) - { - /* this implementation is just a guess */ - if (data) - m_KeyRow |= 1 << offset; - else - m_KeyRow &= ~ (1 << offset); - } - /* now, we handle ROM paging */ - if (m_ROM_paged) - { /* if we have paged ROMs, page according to S0 keyboard interface line */ - membank("bank1")->set_base((m_KeyRow == 0) ? TI99_2_32_ROMPAGE1 : TI99_2_32_ROMPAGE0); - } -} - -WRITE8_MEMBER(ti99_2_state::ti99_2_write_misc_cru) -{ - offset &= 0x7; /* other address lines are not decoded */ - - switch (offset) - { - case 0: - case 1: - case 2: - case 3: - /* ALC I/O */ - break; - case 4: - /* ALC HSK */ - break; - case 5: - /* ALC BAV */ - break; - case 6: - /* cassette output */ - break; - case 7: - /* video enable */ - break; - } -} - -/* read keys in the current row */ -READ8_MEMBER(ti99_2_state::ti99_2_read_kbd) -{ - static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; - - return ioport(keynames[m_KeyRow])->read(); -} - -READ8_MEMBER(ti99_2_state::ti99_2_read_misc_cru) -{ - return 0; -} - -static ADDRESS_MAP_START(ti99_2_io, AS_IO, 8, ti99_2_state ) - AM_RANGE(0x0E00, 0x0E7f) AM_READ(ti99_2_read_kbd) - AM_RANGE(0x0E80, 0x0Eff) AM_READ(ti99_2_read_misc_cru) - AM_RANGE(0x7000, 0x73ff) AM_WRITE(ti99_2_write_kbd) - AM_RANGE(0x7400, 0x77ff) AM_WRITE(ti99_2_write_misc_cru) -ADDRESS_MAP_END - - -/* ti99/2 : 54-key keyboard */ -static INPUT_PORTS_START(ti99_2) - - PORT_START("LINE0") /* col 0 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! DEL") PORT_CODE(KEYCODE_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @ INS") PORT_CODE(KEYCODE_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLEAR") PORT_CODE(KEYCODE_4) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % BEGIN") PORT_CODE(KEYCODE_5) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^ PROC'D") PORT_CODE(KEYCODE_6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 & AID") PORT_CODE(KEYCODE_7) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 * REDO") PORT_CODE(KEYCODE_8) - - PORT_START("LINE1") /* col 1 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w W ~") PORT_CODE(KEYCODE_W) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e E (UP)") PORT_CODE(KEYCODE_E) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r R [") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t T ]") PORT_CODE(KEYCODE_T) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i I ?") PORT_CODE(KEYCODE_I) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ( BACK") PORT_CODE(KEYCODE_9) - - PORT_START("LINE2") /* col 2 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s S (LEFT)") PORT_CODE(KEYCODE_S) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d D (RIGHT)") PORT_CODE(KEYCODE_D) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f F {") PORT_CODE(KEYCODE_F) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u U _") PORT_CODE(KEYCODE_U) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o O '") PORT_CODE(KEYCODE_O) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) - - PORT_START("LINE3") /* col 3 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z Z \\") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x X (DOWN)") PORT_CODE(KEYCODE_X) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c C `") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g G }") PORT_CODE(KEYCODE_G) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p P \"") PORT_CODE(KEYCODE_P) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= + QUIT") PORT_CODE(KEYCODE_EQUALS) - - PORT_START("LINE4") /* col 4 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT/*KEYCODE_CAPSLOCK*/) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ -") PORT_CODE(KEYCODE_SLASH) - - PORT_START("LINE5") /* col 5 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(SPACE)") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCTN") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - - PORT_START("LINE6") /* col 6 */ - PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE7") /* col 7 */ - PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) - -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ti99_2, ti99_2_state ) - // basic machine hardware - // TMS9995, standard variant - // We have no lines connected yet - MCFG_TMS99xx_ADD("maincpu", TMS9995, 10700000, ti99_2_memmap, ti99_2_io) - - MCFG_CPU_VBLANK_INT_DRIVER("screen", ti99_2_state, ti99_2_vblank_interrupt) - - /* video hardware */ - /*MCFG_TMS9928A( &tms9918_interface )*/ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 192) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 192-1) - MCFG_SCREEN_UPDATE_DRIVER(ti99_2_state, screen_update_ti99_2) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ti99_2) - MCFG_PALETTE_ADD_WHITE_AND_BLACK("palette") -MACHINE_CONFIG_END - - - -/* - ROM loading -*/ -ROM_START(ti99_224) - /*CPU memory space*/ - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("992rom.bin", 0x0000, 0x6000, NO_DUMP) /* system ROMs */ -ROM_END - -ROM_START(ti99_232) - /*64kb CPU memory space + 8kb to read the extra ROM page*/ - ROM_REGION(0x12000,"maincpu",0) - ROM_LOAD("992rom32.bin", 0x0000, 0x6000, NO_DUMP) /* system ROM - 32kb */ - ROM_CONTINUE(0x10000,0x2000) -ROM_END - -/* one expansion/cartridge port on the back */ -/* one cassette unit port */ -/* Hex-bus disk controller: supports up to 4 floppy disk drives */ -/* None of these is supported (tape should be easy to emulate) */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1983, ti99_224, 0, 0, ti99_2, ti99_2, ti99_2_state, ti99_2_24, "Texas Instruments", "TI-99/2 BASIC Computer (24kb ROMs)" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1983, ti99_232, ti99_224, 0, ti99_2, ti99_2, ti99_2_state, ti99_2_32, "Texas Instruments", "TI-99/2 BASIC Computer (32kb ROMs)" , MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/ti99_4p.c b/src/mess/drivers/ti99_4p.c deleted file mode 100644 index 7122ab40a05..00000000000 --- a/src/mess/drivers/ti99_4p.c +++ /dev/null @@ -1,914 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Michael Zapf -/**************************************************************************** - - SNUG SGCPU (a.k.a. 99/4p) system - - This system is a reimplementation of the old ti99/4a console. It is known - both as the 99/4p ("peripheral box", since the system is a card to be - inserted in the peripheral box, instead of a self contained console), and - as the SGCPU ("Second Generation CPU", which was originally the name used - in TI documentation to refer to either (or both) TI99/5 and TI99/8 - projects). - - The SGCPU was designed and built by the SNUG (System 99 Users Group), - namely by Michael Becker for the hardware part and Harald Glaab for the - software part. It has no relationship with TI. - - The card is architectured around a 16-bit bus (vs. an 8-bit bus in every - other TI99 system). It includes 64kb of ROM, including a GPL interpreter, - an internal DSR ROM which contains system-specific code, part of the TI - extended Basic interpreter, and up to 1Mbyte of RAM. It still includes a - 16-bit to 8-bit multiplexer in order to support extension cards designed - for TI99/4a, but it can support 16-bit cards, too. It does not include - GROMs, video or sound: instead, it relies on the HSGPL and EVPC cards to - do the job. - - IMPORTANT: The SGCPU card relies on a properly set up HSGPL flash memory - card; without, it will immediately lock up. It is impossible to set it up - from here (a bootstrap problem; you cannot start without the HSGPL). - The best chance is to start a ti99_4ev with a plugged-in HSGPL - and go through the setup process there. Copy the nvram files of the hsgpl into this - driver's nvram subdirectory. The contents will be directly usable for the SGCPU. - - Michael Zapf - - February 2012: Rewritten as class - -*****************************************************************************/ - -#include "emu.h" -#include "cpu/tms9900/tms9900.h" -#include "sound/wave.h" -#include "sound/dac.h" - -#include "machine/tms9901.h" -#include "imagedev/cassette.h" - -#include "bus/ti99x/videowrp.h" -#include "bus/ti99x/joyport.h" - -#include "bus/ti99_peb/peribox.h" - -#define TMS9901_TAG "tms9901" -#define SGCPU_TAG "sgcpu" - -#define VERBOSE 1 -#define LOG logerror - -class ti99_4p_state : public driver_device -{ -public: - ti99_4p_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cpu(*this, "maincpu"), - m_tms9901(*this, TMS9901_TAG), - m_sound(*this, TISOUND_TAG), - m_video(*this, VIDEO_SYSTEM_TAG), - m_cassette(*this, "cassette"), - m_peribox(*this, PERIBOX_TAG), - m_joyport(*this, JOYPORT_TAG) { } - - DECLARE_WRITE_LINE_MEMBER( console_ready ); - DECLARE_WRITE_LINE_MEMBER( console_ready_dmux ); - - DECLARE_WRITE_LINE_MEMBER( extint ); - DECLARE_WRITE_LINE_MEMBER( notconnected ); - DECLARE_READ8_MEMBER( interrupt_level ); - DECLARE_READ16_MEMBER( memread ); - DECLARE_WRITE16_MEMBER( memwrite ); - - DECLARE_READ16_MEMBER( samsmem_read ); - DECLARE_WRITE16_MEMBER( samsmem_write ); - - DECLARE_WRITE8_MEMBER(external_operation); - DECLARE_WRITE_LINE_MEMBER( clock_out ); - - void clock_in(int clock); - - // CRU (Communication Register Unit) handling - DECLARE_READ8_MEMBER( cruread ); - DECLARE_WRITE8_MEMBER( cruwrite ); - DECLARE_READ8_MEMBER( read_by_9901 ); - DECLARE_WRITE_LINE_MEMBER(keyC0); - DECLARE_WRITE_LINE_MEMBER(keyC1); - DECLARE_WRITE_LINE_MEMBER(keyC2); - DECLARE_WRITE_LINE_MEMBER(cs_motor); - DECLARE_WRITE_LINE_MEMBER(audio_gate); - DECLARE_WRITE_LINE_MEMBER(cassette_output); - DECLARE_WRITE8_MEMBER(tms9901_interrupt); - DECLARE_WRITE_LINE_MEMBER(handset_ack); - DECLARE_WRITE_LINE_MEMBER(alphaW); - virtual void machine_start(); - DECLARE_MACHINE_RESET(ti99_4p); - - DECLARE_WRITE_LINE_MEMBER(set_tms9901_INT2_from_v9938); - - required_device m_cpu; - required_device m_tms9901; - required_device m_sound; - required_device m_video; - required_device m_cassette; - required_device m_peribox; - required_device m_joyport; - - // Pointer to ROM0 - UINT16 *m_rom0; - - // Pointer to DSR ROM - UINT16 *m_dsr; - - // Pointer to ROM6, first bank - UINT16 *m_rom6a; - - // Pointer to ROM6, second bank - UINT16 *m_rom6b; - - // AMS RAM (1 Mib) - std::vector m_ram; - - // Scratch pad ram (1 KiB) - std::vector m_scratchpad; - - // First joystick. 6 for TI-99/4A - int m_firstjoy; - - // READY line - int m_ready_line, m_ready_line_dmux; - -private: - DECLARE_READ16_MEMBER( datamux_read ); - DECLARE_WRITE16_MEMBER( datamux_write ); - void set_keyboard_column(int number, int data); - - int m_keyboard_column; - int m_check_alphalock; - - // True if SGCPU DSR is enabled - bool m_internal_dsr; - - // True if SGCPU rom6 is enabled - bool m_internal_rom6; - - // Offset to the ROM6 bank. - int m_rom6_bank; - - // Wait states - int m_waitcount; - - // TRUE when mapper is active - bool m_map_mode; - - // TRUE when mapper registers are accessible - bool m_access_mapper; - - UINT8 m_lowbyte; - UINT8 m_highbyte; - UINT8 m_latch; - - // Mapper registers - UINT8 m_mapper[16]; - - // Latch for 9901 INT2, INT1 lines - int m_9901_int; - void set_9901_int(int line, line_state state); - - int m_ready_prev; // for debugging purposes only - -}; - -static ADDRESS_MAP_START(memmap, AS_PROGRAM, 16, ti99_4p_state) - AM_RANGE(0x0000, 0xffff) AM_READWRITE( memread, memwrite ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(cru_map, AS_IO, 8, ti99_4p_state) - AM_RANGE(0x0000, 0x003f) AM_DEVREAD(TMS9901_TAG, tms9901_device, read) - AM_RANGE(0x0000, 0x01ff) AM_READ( cruread ) - - AM_RANGE(0x0000, 0x01ff) AM_DEVWRITE(TMS9901_TAG, tms9901_device, write) - AM_RANGE(0x0000, 0x0fff) AM_WRITE( cruwrite ) -ADDRESS_MAP_END - -/* - Input ports, used by machine code for TI keyboard and joystick emulation. - - Since the keyboard microcontroller is not emulated, we use the TI99/4a 48-key keyboard, - plus two optional joysticks. -*/ - -static INPUT_PORTS_START(ti99_4p) - /* 4 ports for keyboard and joystick */ - PORT_START("COL0") // col 0 - PORT_BIT(0x88, IP_ACTIVE_LOW, IPT_UNUSED) - /* The original control key is located on the left, but we accept the right control key as well */ - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - /* TI99/4a has a second shift key which maps the same */ - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - /* The original function key is located on the right, but we accept the left alt key as well */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCTN") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= + QUIT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR(UCHAR_MAMEKEY(F12)) - - PORT_START("COL1") // col 1 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR('~') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ( BACK") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("COL2") // col 2 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('`') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # ERASE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 * REDO") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR('?') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("COL3") // col 3 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('[') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLEAR") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 & AID") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("COL4") // col 4 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(']') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % BEGIN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^ PROC'D") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("COL5") // col 5 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR('\\') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('\"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('-') - - PORT_START("ALPHA") /* one more port for Alpha line */ - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - - -INPUT_PORTS_END - -/* - Memory access -*/ -READ16_MEMBER( ti99_4p_state::memread ) -{ - int addroff = offset << 1; - if (m_rom0 == NULL) return 0; // premature access - - UINT16 zone = addroff & 0xe000; - UINT16 value = 0; - - if (zone==0x0000) - { - // ROM0 - value = m_rom0[(addroff & 0x1fff)>>1]; - return value; - } - if (zone==0x2000 || zone==0xa000 || zone==0xc000 || zone==0xe000) - { - value = samsmem_read(space, offset, mem_mask); - return value; - } - - if (zone==0x4000) - { - if (m_internal_dsr) - { - value = m_dsr[(addroff & 0x1fff)>>1]; - return value; - } - else - { - if (m_access_mapper && ((addroff & 0xffe0)==0x4000)) - { - value = m_mapper[offset & 0x000f]<<8; - return value; - } - } - } - - if (zone==0x6000 && m_internal_rom6) - { - if (m_rom6_bank==0) - value = m_rom6a[(addroff & 0x1fff)>>1]; - else - value = m_rom6b[(addroff & 0x1fff)>>1]; - - return value; - } - - // Scratch pad RAM and sound - // speech is in peribox - // groms are in hsgpl in peribox - if (zone==0x8000) - { - if ((addroff & 0xfff0)==0x8400) // cannot read from sound - { - value = 0; - return value; - } - if ((addroff & 0xfc00)==0x8000) - { - value = m_scratchpad[(addroff & 0x03ff)>>1]; - return value; - } - // Video: 8800, 8802 - if ((addroff & 0xfffd)==0x8800) - { - value = m_video->read16(space, offset, mem_mask); - return value; - } - } - - // If we are here, check the peribox via the datamux - // catch-all for unmapped zones - value = datamux_read(space, offset, mem_mask); - return value; -} - -WRITE16_MEMBER( ti99_4p_state::memwrite ) -{ -// m_cpu->adjust_icount(-4); - - int addroff = offset << 1; - UINT16 zone = addroff & 0xe000; - - if (zone==0x0000) - { - // ROM0 - if (VERBOSE>4) LOG("sgcpu: ignoring ROM write access at %04x\n", addroff); - return; - } - - if (zone==0x2000 || zone==0xa000 || zone==0xc000 || zone==0xe000) - { - samsmem_write(space, offset, data, mem_mask); - return; - } - - if (zone==0x4000) - { - if (m_internal_dsr) - { - if (VERBOSE>4) LOG("sgcpu: ignoring DSR write access at %04x\n", addroff); - return; - } - else - { - if (m_access_mapper && ((addroff & 0xffe0)==0x4000)) - { - m_mapper[offset & 0x000f] = data; - return; - } - } - } - - if (zone==0x6000 && m_internal_rom6) - { - m_rom6_bank = offset & 0x0001; - return; - } - - // Scratch pad RAM and sound - // speech is in peribox - // groms are in hsgpl in peribox - if (zone==0x8000) - { - if ((addroff & 0xfff0)==0x8400) //sound write - { - m_sound->write(space, 0, (data >> 8) & 0xff); - return; - } - if ((addroff & 0xfc00)==0x8000) - { - m_scratchpad[(addroff & 0x03ff)>>1] = data; - return; - } - // Video: 8C00, 8C02 - if ((addroff & 0xfffd)==0x8c00) - { - m_video->write16(space, offset, data, mem_mask); - return; - } - } - - // If we are here, check the peribox via the datamux - // catch-all for unmapped zones - datamux_write(space, offset, data, mem_mask); -} - -/*************************************************************************** - Internal datamux; similar to TI-99/4A. However, here we have just - one device, the peripheral box, so it is much simpler. -***************************************************************************/ - -/* - The datamux is connected to the clock line in order to operate - the wait state counter. -*/ -void ti99_4p_state::clock_in(int clock) -{ - if (clock==ASSERT_LINE && m_waitcount!=0) - { - m_waitcount--; - if (m_waitcount==0) console_ready_dmux(ASSERT_LINE); - } -} - - -READ16_MEMBER( ti99_4p_state::datamux_read ) -{ - UINT8 hbyte = 0; - UINT16 addroff = (offset << 1); - - m_peribox->readz(space, addroff+1, &m_latch, mem_mask); - m_lowbyte = m_latch; - - m_peribox->readz(space, addroff, &hbyte, mem_mask); - m_highbyte = hbyte; - - // use the latch and the currently read byte and put it on the 16bit bus -// printf("read address = %04x, value = %04x, memmask = %4x\n", addroff, (hbyte<<8) | sgcpu->latch, mem_mask); - - // Insert four wait states and let CPU enter wait state - m_waitcount = 6; - console_ready_dmux(CLEAR_LINE); - - return (hbyte<<8) | m_latch ; -} - -/* - Write access. - TODO: use the 16-bit expansion in the box for suitable cards -*/ -WRITE16_MEMBER( ti99_4p_state::datamux_write ) -{ - UINT16 addroff = (offset << 1); -// printf("write address = %04x, value = %04x, memmask = %4x\n", addroff, data, mem_mask); - - // read more about the datamux in datamux.c - - // Write to the PEB - m_peribox->write(space, addroff+1, data & 0xff); - - // Write to the PEB - m_peribox->write(space, addroff, (data>>8) & 0xff); - - // Insert four wait states and let CPU enter wait state - m_waitcount = 6; - console_ready_dmux(CLEAR_LINE); -} - -/*************************************************************************** - CRU interface -***************************************************************************/ - -#define MAP_CRU_BASE 0x0f00 -#define SAMS_CRU_BASE 0x1e00 - -/* - CRU write -*/ -WRITE8_MEMBER( ti99_4p_state::cruwrite ) -{ - int addroff = offset<<1; - - if ((addroff & 0xff00)==MAP_CRU_BASE) - { - if ((addroff & 0x000e)==0) m_internal_dsr = data; - if ((addroff & 0x000e)==2) m_internal_rom6 = data; - if ((addroff & 0x000e)==4) m_peribox->senila((data!=0)? ASSERT_LINE : CLEAR_LINE); - if ((addroff & 0x000e)==6) m_peribox->senilb((data!=0)? ASSERT_LINE : CLEAR_LINE); - // TODO: more CRU bits? 8=Fast timing / a=KBENA - return; - } - if ((addroff & 0xff00)==SAMS_CRU_BASE) - { - if ((addroff & 0x000e)==0) m_access_mapper = data; - if ((addroff & 0x000e)==2) m_map_mode = data; - return; - } - - // No match - pass to peribox - m_peribox->cruwrite(space, addroff, data); -} - -READ8_MEMBER( ti99_4p_state::cruread ) -{ - UINT8 value = 0; - m_peribox->crureadz(space, offset<<4, &value); - return value; -} - -/*************************************************************************** - AMS Memory implementation -***************************************************************************/ - -/* - Memory read. The SAMS card has two address areas: The memory is at locations - 0x2000-0x3fff and 0xa000-0xffff, and the mapper area is at 0x4000-0x401e - (only even addresses). -*/ -READ16_MEMBER( ti99_4p_state::samsmem_read ) -{ - UINT32 address = 0; - int addroff = offset << 1; - - // select memory expansion - if (m_map_mode) - address = (m_mapper[(addroff>>12) & 0x000f] << 12) + (addroff & 0x0fff); - else // transparent mode - address = addroff; - - return m_ram[address>>1]; -} - -/* - Memory write -*/ -WRITE16_MEMBER( ti99_4p_state::samsmem_write ) -{ - UINT32 address = 0; - int addroff = offset << 1; - - // select memory expansion - if (m_map_mode) - address = (m_mapper[(addroff>>12) & 0x000f] << 12) + (addroff & 0x0fff); - else // transparent mode - address = addroff; - - m_ram[address>>1] = data; -} - -/*************************************************************************** - Keyboard/tape control -****************************************************************************/ -static const char *const column[] = { "COL0", "COL1", "COL2", "COL3", "COL4", "COL5" }; - -READ8_MEMBER( ti99_4p_state::read_by_9901 ) -{ - int answer=0; - - switch (offset & 0x03) - { - case TMS9901_CB_INT7: - // Read pins INT3*-INT7* of TI99's 9901. - // bit 1: INT1 status - // bit 2: INT2 status - // bit 3-7: keyboard status bits 0 to 4 - // - // |K|K|K|K|K|I2|I1|C| - // - if (m_keyboard_column >= m_firstjoy) // joy 1 and 2 - { - answer = m_joyport->read_port(); - } - else - { - answer = ioport(column[m_keyboard_column])->read(); - } - if (m_check_alphalock) - { - answer &= ~(ioport("ALPHA")->read()); - } - answer = (answer << 3) | m_9901_int; - break; - - case TMS9901_INT8_INT15: - // Read pins INT8*-INT15* of TI99's 9901. - // bit 0-2: keyboard status bits 5 to 7 - // bit 3: tape input mirror - // bit 5-7: weird, not emulated - - // |1|1|1|1|0|K|K|K| - if (m_keyboard_column >= m_firstjoy) answer = 0x07; - else answer = ((ioport(column[m_keyboard_column])->read())>>5) & 0x07; - answer |= 0xf0; - break; - - case TMS9901_P0_P7: - break; - - case TMS9901_P8_P15: - // Read pins P8-P15 of TI99's 9901. - // bit 26: high - // bit 27: tape input - answer = 4; - if (m_cassette->input() > 0) answer |= 8; - break; - } - return answer; -} - -/* - WRITE key column select (P2-P4) -*/ -void ti99_4p_state::set_keyboard_column(int number, int data) -{ - if (data!=0) m_keyboard_column |= 1 << number; - else m_keyboard_column &= ~(1 << number); - - if (m_keyboard_column >= m_firstjoy) - { - m_joyport->write_port(m_keyboard_column - m_firstjoy + 1); - } -} - -WRITE_LINE_MEMBER( ti99_4p_state::keyC0 ) -{ - set_keyboard_column(0, state); -} - -WRITE_LINE_MEMBER( ti99_4p_state::keyC1 ) -{ - set_keyboard_column(1, state); -} - -WRITE_LINE_MEMBER( ti99_4p_state::keyC2 ) -{ - set_keyboard_column(2, state); -} - -/* - WRITE alpha lock line (P5) -*/ -WRITE_LINE_MEMBER( ti99_4p_state::alphaW ) -{ - m_check_alphalock = (state==0); -} - -/* - command CS1 (only) tape unit motor (P6) -*/ -WRITE_LINE_MEMBER( ti99_4p_state::cs_motor ) -{ - m_cassette->change_state((state!=0)? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); -} - -/* - audio gate (P8) - - Set to 1 before using tape: this enables the mixing of tape input sound - with computer sound. - - We do not really need to emulate this as the tape recorder generates sound - on its own. -*/ -WRITE_LINE_MEMBER( ti99_4p_state::audio_gate ) -{ -} - -/* - tape output (P9) -*/ -WRITE_LINE_MEMBER( ti99_4p_state::cassette_output ) -{ - m_cassette->output((state!=0)? +1 : -1); -} - -/* -// TMS9901 setup. The callback functions pass a reference to the TMS9901 as device. -const tms9901_interface tms9901_wiring_sgcpu = -{ - TMS9901_INT1 | TMS9901_INT2 | TMS9901_INTC, // only input pins whose state is always known - - // read handler - DEVCB_DRIVER_MEMBER(ti99_4p_state, read_by_9901), - - { // write handlers - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC0), - DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC1), - DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, keyC2), - DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, alphaW), - DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, cs_motor), - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, audio_gate), - DEVCB_DRIVER_LINE_MEMBER(ti99_4p_state, cassette_output), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL - }, - - // interrupt handler - DEVCB_DRIVER_MEMBER(ti99_4p_state, tms9901_interrupt) -}; - -*/ - -/*************************************************************************** - Control lines -****************************************************************************/ - -/* - We may have lots of devices pulling down this line; so we should use a AND - gate to do it right. On the other hand, when READY is down, there is just - no chance to make another device pull down the same line; the CPU just - won't access any other device in this time. -*/ -WRITE_LINE_MEMBER( ti99_4p_state::console_ready ) -{ - m_ready_line = state; - int combined = (m_ready_line == ASSERT_LINE && m_ready_line_dmux == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE; - - if (VERBOSE>6) - { - if (m_ready_prev != combined) LOG("ti99_4p: READY level = %d\n", combined); - } - m_ready_prev = combined; - m_cpu->set_ready(combined); -} - -/* - The exception of the above rule. Memory access over the datamux also operates - the READY line, and the datamux raises READY depending on the clock pulse. - So we must make sure this does not interfere. -*/ -WRITE_LINE_MEMBER( ti99_4p_state::console_ready_dmux ) -{ - m_ready_line_dmux = state; - int combined = (m_ready_line == ASSERT_LINE && m_ready_line_dmux == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE; - - if (VERBOSE>7) - { - if (m_ready_prev != combined) LOG("ti99_4p: READY dmux level = %d\n", state); - } - m_ready_prev = combined; - m_cpu->set_ready(combined); -} - -void ti99_4p_state::set_9901_int( int line, line_state state) -{ - m_tms9901->set_single_int(line, state); - // We latch the value for the read operation. Mind the negative logic. - if (state==CLEAR_LINE) m_9901_int |= (1<6) LOG("ti99_4p: EXTINT level = %02x\n", state); - set_9901_int(1, (line_state)state); -} - -WRITE_LINE_MEMBER( ti99_4p_state::notconnected ) -{ - if (VERBOSE>6) LOG("ti99_4p: Setting a not connected line ... ignored\n"); -} - -/* - Clock line from the CPU. Used to control wait state generation. -*/ -WRITE_LINE_MEMBER( ti99_4p_state::clock_out ) -{ - clock_in(state); -} - -WRITE8_MEMBER( ti99_4p_state::tms9901_interrupt ) -{ - // offset contains the interrupt level (0-15) - // However, the TI board just ignores that level and hardwires it to 1 - // See below (interrupt_level) - m_cpu->set_input_line(INT_9900_INTREQ, data); -} - -READ8_MEMBER( ti99_4p_state::interrupt_level ) -{ - // On the TI-99 systems these IC lines are not used; the input lines - // at the CPU are hardwired to level 1. - return 1; -} - -WRITE8_MEMBER( ti99_4p_state::external_operation ) -{ - static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; - if (VERBOSE>1) LOG("External operation %s not implemented on the SGCPU board\n", extop[offset]); -} - -/*****************************************************************************/ - -void ti99_4p_state::machine_start() -{ - m_ram.resize(0x80000/2); - m_scratchpad.resize(0x400/2); - - m_peribox->senila(CLEAR_LINE); - m_peribox->senilb(CLEAR_LINE); - - m_firstjoy = 6; - - m_ready_line = m_ready_line_dmux = ASSERT_LINE; - - UINT16 *rom = (UINT16*)(memregion("maincpu")->base()); - m_rom0 = rom + 0x2000; - m_dsr = rom + 0x6000; - m_rom6a = rom + 0x3000; - m_rom6b = rom + 0x7000; -} - -/* - set the state of int2 (called by the v9938) -*/ -WRITE_LINE_MEMBER(ti99_4p_state::set_tms9901_INT2_from_v9938) -{ - set_9901_int(2, (line_state)state); -} - -/* - Reset the machine. -*/ -MACHINE_RESET_MEMBER(ti99_4p_state,ti99_4p) -{ - set_9901_int(12, CLEAR_LINE); - - m_cpu->set_ready(ASSERT_LINE); - m_cpu->set_hold(CLEAR_LINE); - m_9901_int = 0x03; // INT2* and INT1* set to 1, i.e. inactive -} - - -/* - Machine description. -*/ -static MACHINE_CONFIG_START( ti99_4p_60hz, ti99_4p_state ) - /* basic machine hardware */ - /* TMS9900 CPU @ 3.0 MHz */ - MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) - MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti99_4p_state, external_operation) ) - MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti99_4p_state, interrupt_level) ) - MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4p_state, clock_out) ) - - /* video hardware */ - // Although we should have a 60 Hz screen rate, we have to set it to 30 here. - // The reason is that that the number of screen lines is counted twice for the - // interlace mode, but in non-interlace modes only half of the lines are - // painted. Accordingly, the full set of lines is refreshed at 30 Hz, - // not 60 Hz. This should be fixed in the v9938 emulation. - MCFG_TI_V9938_ADD(VIDEO_SYSTEM_TAG, 30, SCREEN_TAG, 2500, 512+32, (212+28)*2, ti99_4p_state, set_tms9901_INT2_from_v9938) - - // tms9901 - MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) - MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_4p_state, read_by_9901) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_4p_state, keyC0) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_4p_state, keyC1) ) - MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_4p_state, keyC2) ) - MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_4p_state, cs_motor) ) - MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_4p_state, audio_gate) ) - MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4p_state, cassette_output) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4p_state, tms9901_interrupt) ) - - // Peripheral expansion box (SGCPU composition) - MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_SG, 0) - MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_4p_state, extint) ) - MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4p_state, notconnected) ) - MCFG_PERIBOX_READY_HANDLER( WRITELINE(ti99_4p_state, console_ready) ) - - // sound hardware - MCFG_TI_SOUND_94624_ADD( TISOUND_TAG ) - MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4p_state, console_ready) ) - - // Cassette drives - MCFG_SPEAKER_STANDARD_MONO("cass_out") - MCFG_CASSETTE_ADD( "cassette" ) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) - - // Joystick port - MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG ) - -MACHINE_CONFIG_END - - -ROM_START(ti99_4p) - /*CPU memory space*/ - ROM_REGION16_BE(0x10000, "maincpu", 0) - ROM_LOAD16_BYTE("sgcpu_hb.bin", 0x0000, 0x8000, CRC(aa100730) SHA1(35e585b2dcd3f2a0005bebb15ede6c5b8c787366) ) /* system ROMs */ - ROM_LOAD16_BYTE("sgcpu_lb.bin", 0x0001, 0x8000, CRC(2a5dc818) SHA1(dec141fe2eea0b930859cbe1ebd715ac29fa8ecb) ) /* system ROMs */ -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1996, ti99_4p, 0, 0, ti99_4p_60hz, ti99_4p, driver_device, 0, "System 99 Users Group", "SGCPU (a.k.a. 99/4P)" , 0 ) diff --git a/src/mess/drivers/ti99_4x.c b/src/mess/drivers/ti99_4x.c deleted file mode 100644 index a90dc92aaf2..00000000000 --- a/src/mess/drivers/ti99_4x.c +++ /dev/null @@ -1,1179 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Michael Zapf -/**************************************************************************** - - MESS Driver for TI-99/4 and TI-99/4A Home Computers. - TI99/4 info: - - Similar to TI99/4a, except for the following: - * tms9918/9928 has no bitmap mode - * smaller, 40-key keyboard - * many small differences in the contents of system ROMs - - Historical notes: TI made several last minute design changes. - * TI99/4 prototypes had an extra port for an I/R joystick and keypad interface. - * early TI99/4 prototypes were designed for a tms9985, not a tms9900. - - Emulation architecture: - (also see datamux.c, peribox.c) - - +---- video (upper 8 bits of databus) - | - CPU | - TMS9900 ==##== datamux --------+------ peribox ----------- [8] slots with peripheral devices - | || (16->8) | - | || +------ Console GROMs (0, 1, 2) - | ##=== Console ROM | - TMS9901 || +------ gromport (cartridge port) - (I/O) ##=== 256 byte RAM | - | || +------ sound - | ##=== 32KiB RAM - +---+--+ unofficial mod - | | (16 bit) - Cass joyport - - Raphael Nabet, 1999-2003. - Rewritten by Michael Zapf - February 2012: Rewritten as class - -*****************************************************************************/ - -#include "emu.h" -#include "cpu/tms9900/tms9900.h" - -#include "sound/wave.h" -#include "video/v9938.h" -#include "machine/tms9901.h" -#include "imagedev/cassette.h" - -#include "bus/ti99x/videowrp.h" -#include "bus/ti99x/datamux.h" -#include "bus/ti99x/grom.h" -#include "bus/ti99x/gromport.h" -#include "bus/ti99x/joyport.h" - -#include "bus/ti99_peb/peribox.h" - -// Debugging -#define TRACE_READY 0 -#define TRACE_INTERRUPTS 0 -#define TRACE_CRU 0 - -/* - The console. -*/ -class ti99_4x_state : public driver_device -{ -public: - ti99_4x_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cpu(*this, "maincpu"), - m_tms9901(*this, TMS9901_TAG), - m_gromport(*this, GROMPORT_TAG), - m_peribox(*this, PERIBOX_TAG), - m_joyport(*this, JOYPORT_TAG), - m_datamux(*this, DATAMUX_TAG), - m_video(*this, VIDEO_SYSTEM_TAG), - m_cassette1(*this, "cassette"), - m_cassette2(*this, "cassette2") - { } - - // Machine management - DECLARE_MACHINE_START(ti99_4); - DECLARE_MACHINE_START(ti99_4a); - DECLARE_MACHINE_START(ti99_4qi); - DECLARE_MACHINE_RESET(ti99_4); - DECLARE_MACHINE_RESET(ti99_4a); - - // Processor connections with the main board - DECLARE_READ8_MEMBER( cruread ); - DECLARE_READ8_MEMBER( interrupt_level ); - DECLARE_WRITE8_MEMBER( cruwrite ); - DECLARE_WRITE8_MEMBER( external_operation ); - DECLARE_WRITE_LINE_MEMBER( clock_out ); - DECLARE_WRITE_LINE_MEMBER( dbin_line ); - - // Connections from outside towards the CPU (callbacks) - DECLARE_WRITE_LINE_MEMBER( console_ready_dmux ); - DECLARE_WRITE_LINE_MEMBER( console_ready_sound ); - DECLARE_WRITE_LINE_MEMBER( console_ready_pbox ); - DECLARE_WRITE_LINE_MEMBER( console_ready_cart ); - DECLARE_WRITE_LINE_MEMBER( console_ready_grom ); - DECLARE_WRITE_LINE_MEMBER( console_reset ); - DECLARE_WRITE_LINE_MEMBER( notconnected ); - - // Connections with the system interface chip 9901 - DECLARE_WRITE_LINE_MEMBER( extint ); - DECLARE_WRITE_LINE_MEMBER( video_interrupt_in ); - DECLARE_WRITE_LINE_MEMBER( handset_interrupt_in ); - - // Connections with the system interface TMS9901 - DECLARE_READ8_MEMBER(read_by_9901); - DECLARE_WRITE_LINE_MEMBER(keyC0); - DECLARE_WRITE_LINE_MEMBER(keyC1); - DECLARE_WRITE_LINE_MEMBER(keyC2); - DECLARE_WRITE_LINE_MEMBER(cs1_motor); - DECLARE_WRITE_LINE_MEMBER(audio_gate); - DECLARE_WRITE_LINE_MEMBER(cassette_output); - DECLARE_WRITE8_MEMBER(tms9901_interrupt); - DECLARE_WRITE_LINE_MEMBER(handset_ack); - DECLARE_WRITE_LINE_MEMBER(cs2_motor); - DECLARE_WRITE_LINE_MEMBER(alphaW); - - // Interrupt triggers - DECLARE_INPUT_CHANGED_MEMBER( load_interrupt ); - -private: - void set_keyboard_column(int number, int data); - int m_keyboard_column; - int m_check_alphalock; - - // READY handling - int m_nready_combined; - int m_nready_prev; - void console_ready_join(int id, int state); - - // Console type - int m_model; - - // Latch for 9901 INT1, INT2, and INT12 lines - line_state m_int1; - line_state m_int2; - line_state m_int12; - - // Connected devices - required_device m_cpu; - required_device m_tms9901; - required_device m_gromport; - required_device m_peribox; - required_device m_joyport; - required_device m_datamux; - required_device m_video; - required_device m_cassette1; - required_device m_cassette2; -}; - -/* - Console models. -*/ -enum -{ - MODEL_4, - MODEL_4A, - MODEL_4QI -}; - -/* - READY bits. -*/ -enum -{ - READY_GROM = 1, - READY_DMUX = 2, - READY_PBOX = 4, - READY_SOUND = 8, - READY_CART = 16 -}; - -/* - Memory map. - Most of the work is done in the datamux (see datamux.c). We only keep ROM - and the small 256 byte PAD RAM here because they are directly connected - to the 16bit bus, and the wait state logic is not active during their - accesses. -*/ -static ADDRESS_MAP_START(memmap, AS_PROGRAM, 16, ti99_4x_state) - ADDRESS_MAP_GLOBAL_MASK(0xffff) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAM - AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(DATAMUX_TAG, ti99_datamux_device, read, write) AM_DEVSETOFFSET(DATAMUX_TAG, ti99_datamux_device, setoffset) -ADDRESS_MAP_END - -/* - CRU map - TMS9900 CRU address space is 12 bits wide, attached to A3-A14, A0-A2 must - be 000 (other values for external commands like RSET, LREX, CKON...), - A15 is used as CRUOUT - The TMS9901 is incompletely decoded - ---0 00xx xxcc ccc0 - causing 16 mirrors (0000, 0040, 0080, 00c0, ... , 03c0) - - Reading is done by transfering 8 successive bits, so addresses refer to - 8 bit groups; writing, however, is done using output lines. The CRU base - address in the ti99 systems is twice the bit address: - - (base=0, bit=0x10) == (base=0x20,bit=0) - - Read: 0000 - 003f translates to base addresses 0000 - 03fe - 0000 - 01ff is the complete CRU address space 0000 - 1ffe (for TMS9900) - - Write:0000 - 01ff corresponds to bit 0 of base address 0000 - 03fe -*/ -static ADDRESS_MAP_START(cru_map, AS_IO, 8, ti99_4x_state) - AM_RANGE(0x0000, 0x0003) AM_MIRROR(0x003c) AM_DEVREAD(TMS9901_TAG, tms9901_device, read) - AM_RANGE(0x0000, 0x01ff) AM_READ(cruread) - - AM_RANGE(0x0000, 0x001f) AM_MIRROR(0x01e0) AM_DEVWRITE(TMS9901_TAG, tms9901_device, write) - AM_RANGE(0x0000, 0x0fff) AM_WRITE(cruwrite) -ADDRESS_MAP_END - - -/***************************************************************************** - Input ports - ****************************************************************************/ - -static INPUT_PORTS_START(ti99_4) - PORT_START("COL0") // col 0 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q QUIT") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR(UCHAR_MAMEKEY(F12)) - /* TI99/4 has a second space key which maps the same */ - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(' ') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P \"") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L =") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('=') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("COL1") // col 1 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W BEGIN") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A AID") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z BACK") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O +") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('+') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K /") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('/') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", .") PORT_CODE(KEYCODE_STOP) PORT_CHAR(',') PORT_CHAR('.') - - PORT_START("COL2") // col 2 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E UP") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S LEFT") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X DOWN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I -") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('-') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J ^") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('^') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M ;") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR(';') - /* col 3 */ - PORT_START("COL3") // col 3 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R REDO") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D RIGHT") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C CLEAR") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U _") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H <") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('<') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N :") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(':') - - PORT_START("COL4") // col 4 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T ERASE") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F DEL") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V PROC'D") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y >") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G INS") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ?") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('?') - -INPUT_PORTS_END - -/* TI99/4a: 48-key keyboard */ -static INPUT_PORTS_START(ti99_4a) - PORT_START( "ALPHABUG" ) - PORT_CONFNAME( 0x01, 0x01, "Alpha Lock blocks joystick up" ) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - - PORT_START( "LOADINT ") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Load interrupt") PORT_CODE(KEYCODE_PRTSCR) PORT_CHANGED_MEMBER(DEVICE_SELF, ti99_4x_state, load_interrupt, 1) - - PORT_START("COL0") // col 0 - PORT_BIT(0x88, IP_ACTIVE_LOW, IPT_UNUSED) - /* The original control key is located on the left, but we accept the right control key as well */ - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - /* TI99/4a has a second shift key which maps the same */ - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - /* The original function key is located on the right, but we accept the left alt key as well */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCTN") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= + QUIT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR(UCHAR_MAMEKEY(F12)) - - PORT_START("COL1") // col 1 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR('~') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ( BACK") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("COL2") // col 2 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('`') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # ERASE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 * REDO") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR('?') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("COL3") // col 3 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('[') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLEAR") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 & AID") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("COL4") // col 4 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(']') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % BEGIN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^ PROC'D") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("COL5") // col 5 - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR('\\') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('\"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('-') - - PORT_START("ALPHA") /* one more port for Alpha line */ - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - - /* another version of Alpha Lock which is non-toggling; this is useful when we want to attach - a real TI keyboard for input. For home computers, the Alpha Lock / Shift Lock was a physically - locking key. */ - PORT_START("ALPHA1") - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Alpha Lock non-toggle") PORT_CODE(KEYCODE_RWIN) - -INPUT_PORTS_END - - -/***************************************************************************** - Components -******************************************************************************/ - -static GROM_CONFIG(grom0_config) -{ - false, 0, region_grom, 0x0000, 0x1800, GROMFREQ -}; - -static GROM_CONFIG(grom1_config) -{ - false, 1, region_grom, 0x2000, 0x1800, GROMFREQ -}; - -static GROM_CONFIG(grom2_config) -{ - false, 2, region_grom, 0x4000, 0x1800, GROMFREQ -}; - -READ8_MEMBER( ti99_4x_state::cruread ) -{ -// if (TRACE_CRU) logerror("read access to CRU address %04x\n", offset << 4); - UINT8 value = 0; - - // Similar to the bus8z_devices, just let the gromport and the p-box - // decide whether they want to change the value at the CRU address - // Also, we translate the bit addresses to base addresses - - // The QI version does not propagate the CRU signals to the cartridge slot - if (m_model != MODEL_4QI) m_gromport->crureadz(space, offset<<4, &value); - m_peribox->crureadz(space, offset<<4, &value); - - return value; -} - -WRITE8_MEMBER( ti99_4x_state::cruwrite ) -{ - if (TRACE_CRU) logerror("ti99_4x: write access to CRU address %04x\n", offset << 1); - // The QI version does not propagate the CRU signals to the cartridge slot - if (m_model != MODEL_4QI) m_gromport->cruwrite(space, offset<<1, data); - m_peribox->cruwrite(space, offset<<1, data); -} - -WRITE8_MEMBER( ti99_4x_state::external_operation ) -{ - static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; - // Some games (e.g. Slymoids) actually use IDLE for synchronization - if (offset == IDLE_OP) return; - else - { - logerror("ti99_4x: External operation %s not implemented on TI-99 board\n", extop[offset]); - } -} - -/*************************************************************************** - TI99/4x-specific tms9901 I/O handlers - - See mess/machine/tms9901.c for generic tms9901 CRU handlers. - - TMS9901 interrupt handling on a TI99/4(a). - - TI99/4(a) uses the following interrupts: - INT1: external interrupt (used by RS232 controller, for instance) - INT2: VDP interrupt - TMS9901 timer interrupt (overrides INT3) - INT12: handset interrupt (only on a TI-99/4 with the handset prototypes) - - Three (occasionally four) interrupts are used by the system (INT1, INT2, - timer, and INT12 on a TI-99/4 with remote handset prototypes), out of 15/16 - possible interrupts. Keyboard pins can be used as interrupt pins, too, but - this is not emulated (it's a trick, anyway, and I don't know any program - which uses it). - - When an interrupt line is set (and the corresponding bit in the interrupt mask is set), - a level 1 interrupt is requested from the TMS9900. This interrupt request lasts as long as - the interrupt pin and the relevant bit in the interrupt mask are set. - -***************************************************************************/ - - -static const char *const column[] = { "COL0", "COL1", "COL2", "COL3", "COL4", "COL5" }; - -READ8_MEMBER( ti99_4x_state::read_by_9901 ) -{ - int answer=0; - - switch (offset & 0x03) - { - case TMS9901_CB_INT7: - // - // Read pins INT3*-INT7* of TI99's 9901. - // bit 1: INT1 status - // bit 2: INT2 status - // bit 3-7: keyboard status bits 0 to 4 - // - // |K|K|K|K|K|I2|I1|C| - // - if (m_keyboard_column >= (m_model==MODEL_4? 5:6)) // joy 1, 2, handset - { - answer = m_joyport->read_port(); - // The hardware bug of the TI-99/4A: you have to release the - // Alphalock key when using joysticks. This is a maldesign of the - // board: When none of the other keyboard lines are selected the - // depressed Alphalock key pulls up the /INT7 line which is also - // used for joystick up. The joystick switch then fails to lower - // the line enough to make the TMS9901 sense the low level. - // A reported, feasible fix was to cut the line and insert a diode - // below the Alphalock key. - if ((ioport("ALPHABUG")!=0) && (m_model!=MODEL_4)) answer |= (ioport("ALPHA")->read() | ioport("ALPHA1")->read()); - } - else - { - answer = ioport(column[m_keyboard_column])->read(); - } - if (m_check_alphalock) // never true for TI-99/4 - { - answer &= ~(ioport("ALPHA")->read() | ioport("ALPHA1")->read()); - } - answer = (answer << 3); - if (m_int1 == CLEAR_LINE) answer |= 0x02; - if (m_int2 == CLEAR_LINE) answer |= 0x04; - - break; - - case TMS9901_INT8_INT15: - // |1|1|1|INT12|0|K|K|K| - if (m_keyboard_column >= (m_model==MODEL_4? 5:6)) answer = 0x07; - else answer = ((ioport(column[m_keyboard_column])->read())>>5) & 0x07; - answer |= 0xe0; - if (m_model != MODEL_4 || m_int12==CLEAR_LINE) answer |= 0x10; - break; - - case TMS9901_P0_P7: - // Required for the handset (only on TI-99/4) - if ((m_joyport->read_port() & 0x20)!=0) answer |= 2; - break; - - case TMS9901_P8_P15: - // Preset to 1 - answer = 4; - - // Interrupt pin of the handset (only on TI-99/4) - // Negative logic (interrupt pulls line down) - if ((m_joyport->read_port() & 0x40)==0) answer = 0; - - // we don't take CS2 into account, as CS2 is a write-only unit - if (m_cassette1->input() > 0) - { - answer |= 8; - } - break; - } - return answer; -} - -/* - Handler for TMS9901 P0 pin (handset data acknowledge); only for 99/4 -*/ -WRITE_LINE_MEMBER( ti99_4x_state::handset_ack ) -{ - // Write a value to the joyport. If there is a handset this will set its - // ACK line. - m_joyport->write_port(state==ASSERT_LINE? 0x01 : 0x00); -} - -/* - WRITE key column select (P2-P4), TI-99/4 -*/ -void ti99_4x_state::set_keyboard_column(int number, int data) -{ - if (data != 0) - m_keyboard_column |= 1 << number; - else - m_keyboard_column &= ~ (1 << number); - - if (m_keyboard_column >= (m_model==MODEL_4? 5:6)) - { - m_joyport->write_port(m_keyboard_column - (m_model==MODEL_4? 5:6) + 1); - } - - // TI-99/4: joystick 1 = column 5 - // joystick 2 = column 6 - // (only for the prototype versions; the released versions had no IR - // handset and the board was already redesigned to use columns 6 and 7) - - // TI-99/4A: joystick 1 = column 6 - // joystick 2 = column 7 -} - -WRITE_LINE_MEMBER( ti99_4x_state::keyC0 ) -{ - set_keyboard_column(0, state); -} - -WRITE_LINE_MEMBER( ti99_4x_state::keyC1 ) -{ - set_keyboard_column(1, state); -} - -WRITE_LINE_MEMBER( ti99_4x_state::keyC2 ) -{ - set_keyboard_column(2, state); -} - -/* - Select alpha lock line - TI99/4a only (P5) -*/ -WRITE_LINE_MEMBER( ti99_4x_state::alphaW ) -{ - m_check_alphalock = (state==0); -} - -/* - Control CS1 tape unit motor (P6) -*/ -WRITE_LINE_MEMBER( ti99_4x_state::cs1_motor ) -{ - m_cassette1->change_state(state==ASSERT_LINE? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); -} - -/* - Control CS2 tape unit motor (P7) -*/ -WRITE_LINE_MEMBER( ti99_4x_state::cs2_motor ) -{ - m_cassette2->change_state(state==ASSERT_LINE? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); -} - -/* - Audio gate (P8) - Set to 1 before using tape: this enables the mixing of tape input sound - with computer sound. - We do not really need to emulate this as the tape recorder generates sound - on its own. -*/ -WRITE_LINE_MEMBER( ti99_4x_state::audio_gate ) -{ -} - -/* - Tape output (P9) - I think polarity is correct, but don't take my word for it. -*/ -WRITE_LINE_MEMBER( ti99_4x_state::cassette_output ) -{ - m_cassette1->output(state==ASSERT_LINE? +1 : -1); - m_cassette2->output(state==ASSERT_LINE? +1 : -1); -} - -WRITE8_MEMBER( ti99_4x_state::tms9901_interrupt ) -{ - // offset contains the interrupt level (0-15) - // However, the TI board just ignores that level and hardwires it to 1 - // See below (interrupt_level) - m_cpu->set_input_line(INT_9900_INTREQ, data); -} - -READ8_MEMBER( ti99_4x_state::interrupt_level ) -{ - // On the TI-99 systems these IC lines are not used; the input lines - // at the CPU are hardwired to level 1. - return 1; -} - -/* - Clock line from the CPU. Used to control wait state generation. -*/ -WRITE_LINE_MEMBER( ti99_4x_state::clock_out ) -{ - m_datamux->clock_in(state); -} - -/* - Data bus in (DBIN) line from the CPU. -*/ -WRITE_LINE_MEMBER( ti99_4x_state::dbin_line ) -{ - m_datamux->dbin_in(state); -} - -/*****************************************************************************/ - -/* - set the state of TMS9901's INT2 (called by the tms9928 core) -*/ -WRITE_LINE_MEMBER( ti99_4x_state::video_interrupt_in ) -{ - if (TRACE_INTERRUPTS) logerror("ti99_4x: VDP INT2 on tms9901, level=%d\n", state); - - // Pulse for the handset - if (m_model == MODEL_4) m_joyport->pulse_clock(); - - m_int2 = (line_state)state; - m_tms9901->set_single_int(2, state); -} - -/* - set the state of TMS9901's INT12 (called by the handset prototype of TI-99/4) -*/ -WRITE_LINE_MEMBER( ti99_4x_state::handset_interrupt_in) -{ - if (TRACE_INTERRUPTS) logerror("ti99_4x: joyport INT12 on tms9901, level=%d\n", state); - m_int12 = (line_state)state; - m_tms9901->set_single_int(12, state); -} - -/* - One of the common hardware mods was to add a switch to trigger a LOAD - interrupt -*/ -INPUT_CHANGED_MEMBER( ti99_4x_state::load_interrupt ) -{ - logerror("ti99_4x: LOAD interrupt, level=%d\n", newval); - m_cpu->set_input_line(INT_9900_LOAD, (newval==0)? ASSERT_LINE : CLEAR_LINE); -} - -/*********************************************************** - Links to external devices -***********************************************************/ - -/* - We combine the incoming READY signals and propagate them to the CPU. - An alternative would be to let the CPU get the READY state, but this would - be a much higher overhead, as this happens in each clock tick. -*/ -void ti99_4x_state::console_ready_join(int id, int state) -{ - if (state==CLEAR_LINE) - m_nready_combined |= id; - else - m_nready_combined &= ~id; - - if (TRACE_READY) - { - if (m_nready_prev != m_nready_combined) logerror("ti99_4x: READY bits = %04x\n", ~m_nready_combined); - } - - m_nready_prev = m_nready_combined; - m_cpu->set_ready(m_nready_combined==0); -} - -/* - Connections to the READY line. This might look a bit ugly; we need an - implementation of a "Wired AND" device. -*/ -WRITE_LINE_MEMBER( ti99_4x_state::console_ready_grom ) -{ - console_ready_join(READY_GROM, state); -} - -WRITE_LINE_MEMBER( ti99_4x_state::console_ready_dmux ) -{ - console_ready_join(READY_DMUX, state); -} - -WRITE_LINE_MEMBER( ti99_4x_state::console_ready_pbox ) -{ - console_ready_join(READY_PBOX, state); -} - -WRITE_LINE_MEMBER( ti99_4x_state::console_ready_sound ) -{ - console_ready_join(READY_SOUND, state); -} - -WRITE_LINE_MEMBER( ti99_4x_state::console_ready_cart ) -{ - console_ready_join(READY_CART, state); -} - -/* - The RESET line leading to a reset of the CPU. This is asserted when a - cartridge is plugged in. -*/ -WRITE_LINE_MEMBER( ti99_4x_state::console_reset ) -{ - if (machine().phase() != MACHINE_PHASE_INIT) - { - logerror("ti99_4x: Console reset line = %d\n", state); - m_cpu->set_input_line(INT_9900_RESET, state); - m_video->reset_vdp(state); - } -} - -WRITE_LINE_MEMBER( ti99_4x_state::extint ) -{ - if (TRACE_INTERRUPTS) logerror("ti99_4x: EXTINT level = %02x\n", state); - m_int1 = (line_state)state; - m_tms9901->set_single_int(1, state); -} - -WRITE_LINE_MEMBER( ti99_4x_state::notconnected ) -{ - if (TRACE_INTERRUPTS) logerror("ti99_4x: Setting a not connected line ... ignored\n"); -} - -/*****************************************************************************/ - -/* - Devices attached to the databus multiplexer. We cannot solve this with - the common address maps since the multiplexer also inserts wait states - that we want to emulate properly. Also, devices may reside on the same - memory locations (like GROMs) and select themselves according to some - inner state (e.g. GROMs have an own address counter and a given address - area). -*/ -static const dmux_device_list_entry dmux_devices[] = -{ - { VIDEO_SYSTEM_TAG, 0x8800, 0xfc01, 0x0400, NULL, 0, 0 }, - { GROM0_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, - { GROM1_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, - { GROM2_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, - { TISOUND_TAG, 0x8400, 0xfc01, 0x0000, NULL, 0, 0 }, - { GROMPORT_TAG, 0x9800, 0xfc01, 0x0400, NULL, 0, 0 }, - { GROMPORT_TAG, 0x6000, 0xe000, 0x0000, NULL, 0, 0 }, - { PERIBOX_TAG, 0x0000, 0x0000, 0x0000, NULL, 0, 0 }, // Peribox needs all addresses - { NULL, 0, 0, 0, NULL, 0, 0 } -}; - -static const dmux_device_list_entry dmux_devices_ev[] = -{ - { VIDEO_SYSTEM_TAG, 0x8800, 0xfc01, 0x0400, NULL, 0, 0 }, - { GROM0_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, - { GROM1_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, - { GROM2_TAG, 0x9800, 0xfc01, 0x0400, "GROMENA", 0x01, 0x00 }, - { TISOUND_TAG, 0x8400, 0xfc01, 0x0000, NULL, 0, 0 }, - { GROMPORT_TAG, 0x9800, 0xfc01, 0x0400, NULL, 0, 0 }, - { GROMPORT_TAG, 0x6000, 0xe000, 0x0000, NULL, 0, 0 }, - { PERIBOX_TAG, 0x0000, 0x0000, 0x0000, NULL, 0, 0 }, // Peribox needs all addresses - { NULL, 0, 0, 0, NULL, 0, 0 } -}; - -static DMUX_CONFIG( datamux_conf ) -{ - dmux_devices -}; - -static DMUX_CONFIG( datamux_conf_ev ) -{ - dmux_devices_ev -}; - -/****************************************************************************** - Machine definitions -******************************************************************************/ - -MACHINE_START_MEMBER(ti99_4x_state,ti99_4) -{ - m_peribox->senila(CLEAR_LINE); - m_peribox->senilb(CLEAR_LINE); - m_nready_combined = 0; - m_model = MODEL_4; -} - -MACHINE_RESET_MEMBER(ti99_4x_state,ti99_4) -{ - m_cpu->set_ready(ASSERT_LINE); - m_cpu->set_hold(CLEAR_LINE); - m_int1 = CLEAR_LINE; - m_int2 = CLEAR_LINE; - m_int12 = CLEAR_LINE; -} - -/********************************************************************** - TI-99/4 - predecessor of the more popular TI-99/4A -***********************************************************************/ - -static MACHINE_CONFIG_START( ti99_4, ti99_4x_state ) - // CPU - MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) - MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti99_4x_state, external_operation) ) - MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti99_4x_state, interrupt_level) ) - MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4x_state, clock_out) ) - MCFG_TMS99xx_DBIN_HANDLER( WRITELINE(ti99_4x_state, dbin_line) ) - - MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4 ) - MCFG_MACHINE_RESET_OVERRIDE(ti99_4x_state, ti99_4 ) - - /* Main board */ - MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) - MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_4x_state, read_by_9901) ) - MCFG_TMS9901_P0_HANDLER( WRITELINE( ti99_4x_state, handset_ack) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_4x_state, keyC0) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_4x_state, keyC1) ) - MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_4x_state, keyC2) ) - MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_4x_state, cs1_motor) ) - MCFG_TMS9901_P7_HANDLER( WRITELINE( ti99_4x_state, cs2_motor) ) - MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_4x_state, audio_gate) ) - MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) ) - - MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf ) - MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) ) - MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG ) - MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) ) - MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) ) - - /* Software list */ - MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") - - /* Peripheral expansion box */ - MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX, 0) - MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_4x_state, extint) ) - MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) ) - MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) ) - - /* sound hardware */ - MCFG_TI_SOUND_94624_ADD( TISOUND_TAG ) - MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) ) - - /* Cassette drives */ - MCFG_SPEAKER_STANDARD_MONO("cass_out") - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_ADD( "cassette2" ) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) - - /* GROM devices */ - MCFG_GROM_ADD( GROM0_TAG, grom0_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( GROM1_TAG, grom1_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( GROM2_TAG, grom2_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - - // Joystick port - MCFG_TI_JOYPORT4_ADD( JOYPORT_TAG ) - MCFG_JOYPORT_INT_HANDLER( WRITELINE(ti99_4x_state, handset_interrupt_in) ) -MACHINE_CONFIG_END - -/* - US version: 60 Hz, NTSC -*/ -static MACHINE_CONFIG_DERIVED( ti99_4_60hz, ti99_4 ) - MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918, 0x4000, ti99_4x_state, video_interrupt_in) -MACHINE_CONFIG_END - -/* - European version: 50 Hz, PAL -*/ -static MACHINE_CONFIG_DERIVED( ti99_4_50hz, ti99_4 ) - MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929, 0x4000, ti99_4x_state, video_interrupt_in) -MACHINE_CONFIG_END - -/********************************************************************** - TI-99/4A - replaced the 99/4 and became the standard TI-99 console -***********************************************************************/ - -MACHINE_START_MEMBER(ti99_4x_state,ti99_4a) -{ - m_peribox->senila(CLEAR_LINE); - m_peribox->senilb(CLEAR_LINE); - m_nready_combined = 0; - m_model = MODEL_4A; -} - -MACHINE_RESET_MEMBER(ti99_4x_state,ti99_4a) -{ - m_cpu->set_ready(ASSERT_LINE); - m_cpu->set_hold(CLEAR_LINE); - m_int1 = CLEAR_LINE; - m_int2 = CLEAR_LINE; - m_int12 = CLEAR_LINE; -} - -static MACHINE_CONFIG_START( ti99_4a, ti99_4x_state ) - /* CPU */ - MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) - MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti99_4x_state, external_operation) ) - MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti99_4x_state, interrupt_level) ) - MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4x_state, clock_out) ) - MCFG_TMS99xx_DBIN_HANDLER( WRITELINE(ti99_4x_state, dbin_line) ) - - MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4a ) - MCFG_MACHINE_RESET_OVERRIDE(ti99_4x_state, ti99_4a ) - - /* Main board */ - MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) - MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_4x_state, read_by_9901) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_4x_state, keyC0) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_4x_state, keyC1) ) - MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_4x_state, keyC2) ) - MCFG_TMS9901_P5_HANDLER( WRITELINE( ti99_4x_state, alphaW) ) - MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_4x_state, cs1_motor) ) - MCFG_TMS9901_P7_HANDLER( WRITELINE( ti99_4x_state, cs2_motor) ) - MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_4x_state, audio_gate) ) - MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) ) - - MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf ) - MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) ) - MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG ) - MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) ) - MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) ) - - /* Software list */ - MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") - - /* Peripheral expansion box */ - MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX, 0) - MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_4x_state, extint) ) - MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) ) - MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) ) - - /* sound hardware */ - MCFG_TI_SOUND_94624_ADD( TISOUND_TAG ) - MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) ) - - /* Cassette drives */ - MCFG_SPEAKER_STANDARD_MONO("cass_out") - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_ADD( "cassette2" ) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) - - /* GROM devices */ - MCFG_GROM_ADD( GROM0_TAG, grom0_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( GROM1_TAG, grom1_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( GROM2_TAG, grom2_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - - // Joystick port - MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG ) -MACHINE_CONFIG_END - -/* - US version: 60 Hz, NTSC -*/ -static MACHINE_CONFIG_DERIVED( ti99_4a_60hz, ti99_4a ) - MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918A, 0x4000, ti99_4x_state, video_interrupt_in) -MACHINE_CONFIG_END - -/* - European version: 50 Hz, PAL -*/ -static MACHINE_CONFIG_DERIVED( ti99_4a_50hz, ti99_4a ) - MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929A, 0x4000, ti99_4x_state, video_interrupt_in) -MACHINE_CONFIG_END - -/************************************************************************ - TI-99/4QI - the final version of the TI-99/4A - This was a last modification of the console. One purpose was to lower - production costs by a redesigned board layout. The other was that TI - removed the ROM search for cartridges so that only cartridges with GROMs - could be started, effectively kicking out all third-party cartridges like - those from Atarisoft. -*************************************************************************/ - -MACHINE_START_MEMBER(ti99_4x_state, ti99_4qi) -{ - m_peribox->senila(CLEAR_LINE); - m_peribox->senilb(CLEAR_LINE); - m_model = MODEL_4QI; - m_nready_combined = 0; -} - -static MACHINE_CONFIG_DERIVED( ti99_4qi, ti99_4a ) - MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4qi ) -MACHINE_CONFIG_END - -/* - US version: 60 Hz, NTSC -*/ -static MACHINE_CONFIG_DERIVED( ti99_4qi_60hz, ti99_4qi ) - MCFG_TI_TMS991x_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9918A, 0x4000, ti99_4x_state, video_interrupt_in) -MACHINE_CONFIG_END - -/* - European version: 50 Hz, PAL -*/ -static MACHINE_CONFIG_DERIVED( ti99_4qi_50hz, ti99_4qi ) - MCFG_TI_TMS991x_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9929A, 0x4000, ti99_4x_state, video_interrupt_in) -MACHINE_CONFIG_END - -/************************************************************************ - TI-99/4A with 80-column support. Actually a separate expansion card (EVPC), - replacing the console video processor. -*************************************************************************/ - -static MACHINE_CONFIG_START( ti99_4ev_60hz, ti99_4x_state ) - /* CPU */ - MCFG_TMS99xx_ADD("maincpu", TMS9900, 3000000, memmap, cru_map) - MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(ti99_4x_state, external_operation) ) - MCFG_TMS99xx_INTLEVEL_HANDLER( READ8(ti99_4x_state, interrupt_level) ) - MCFG_TMS99xx_CLKOUT_HANDLER( WRITELINE(ti99_4x_state, clock_out) ) - MCFG_TMS99xx_DBIN_HANDLER( WRITELINE(ti99_4x_state, dbin_line) ) - - MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4a ) - - /* video hardware */ - // Although we should have a 60 Hz screen rate, we have to set it to 30 here. - // The reason is that that the number of screen lines is counted twice for the - // interlace mode, but in non-interlace modes only half of the lines are - // painted. Accordingly, the full set of lines is refreshed at 30 Hz, - // not 60 Hz. This should be fixed in the v9938 emulation. - MCFG_TI_V9938_ADD(VIDEO_SYSTEM_TAG, 30, SCREEN_TAG, 2500, 512+32, (212+28)*2, ti99_4x_state, video_interrupt_in) - - /* Main board */ - MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, 3000000) - MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_4x_state, read_by_9901) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_4x_state, keyC0) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_4x_state, keyC1) ) - MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_4x_state, keyC2) ) - MCFG_TMS9901_P5_HANDLER( WRITELINE( ti99_4x_state, alphaW) ) - MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_4x_state, cs1_motor) ) - MCFG_TMS9901_P7_HANDLER( WRITELINE( ti99_4x_state, cs2_motor) ) - MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_4x_state, audio_gate) ) - MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_4x_state, cassette_output) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_4x_state, tms9901_interrupt) ) - - MCFG_DMUX_ADD( DATAMUX_TAG, datamux_conf_ev ) - MCFG_DMUX_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_dmux) ) - MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG ) - MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_cart) ) - MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_4x_state, console_reset) ) - - /* Software list */ - MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") - - /* Peripheral expansion box */ - MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_EV, 0) - MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_4x_state, extint) ) - MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_4x_state, notconnected) ) - MCFG_PERIBOX_READY_HANDLER( DEVWRITELINE(DATAMUX_TAG, ti99_datamux_device, ready_line) ) - - /* sound hardware */ - MCFG_TI_SOUND_94624_ADD( TISOUND_TAG ) - MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_4x_state, console_ready_sound) ) - - /* Cassette drives */ - MCFG_SPEAKER_STANDARD_MONO("cass_out") - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_ADD( "cassette2" ) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) - - /* GROM devices */ - MCFG_GROM_ADD( GROM0_TAG, grom0_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( GROM1_TAG, grom1_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( GROM2_TAG, grom2_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_4x_state, console_ready_grom)) - - // Joystick port - MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG ) - -MACHINE_CONFIG_END - -/***************************************************************************** - ROM loading - Note that we use the same ROMset for 50Hz and 60Hz versions. - ROMs for peripheral equipment have been moved to the respective files. -******************************************************************************/ -#define rom_ti99_4e rom_ti99_4 -#define rom_ti99_4ae rom_ti99_4a -#define rom_ti99_4qe rom_ti99_4qi - -ROM_START(ti99_4) - // CPU memory space - ROM_REGION16_BE(0x2000, "maincpu", 0) - ROM_LOAD16_BYTE("u610.bin", 0x0000, 0x1000, CRC(6fcf4b15) SHA1(d085213c64701d429ae535f9a4ac8a50427a8343)) /* CPU ROMs high */ - ROM_LOAD16_BYTE("u611.bin", 0x0001, 0x1000, CRC(491c21d1) SHA1(7741ae9294c51a44a78033d1b77c01568a6bbfb9)) /* CPU ROMs low */ - - // GROM memory space - ROM_REGION(0x10000, region_grom, 0) - ROM_LOAD("u500.bin", 0x0000, 0x1800, CRC(aa757e13) SHA1(4658d3d01c0131c283a30cebd12e76754d41a84a)) /* system GROM 0 */ - ROM_LOAD("u501.bin", 0x2000, 0x1800, CRC(c863e460) SHA1(6d849a76011273a069a98ed0c3feaf13831c942f)) /* system GROM 1 */ - ROM_LOAD("u502.bin", 0x4000, 0x1800, CRC(b0eda548) SHA1(725e3f26f8c819f356e4bb405b4102b5ae1e0e70)) /* system GROM 2 */ -ROM_END - -ROM_START(ti99_4a) - // CPU memory space - ROM_REGION16_BE(0x2000, "maincpu", 0) - ROM_LOAD16_WORD("994arom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */ - - // GROM memory space - ROM_REGION(0x10000, region_grom, 0) - ROM_LOAD("994agrom.bin", 0x0000, 0x6000, CRC(af5c2449) SHA1(0c5eaad0093ed89e9562a2c0ee6a370bdc9df439)) /* system GROMs */ -ROM_END - -ROM_START(ti99_4qi) - // CPU memory space - ROM_REGION16_BE(0x2000, "maincpu", 0) - ROM_LOAD16_WORD("994qirom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */ - - // GROM memory space - ROM_REGION(0x10000, region_grom, 0) - ROM_LOAD("994qigr0.bin", 0x0000, 0x1800, CRC(8b07772d) SHA1(95dcf5b7350ade65297eadd2d680c27561cc975c)) /* system GROM 0 */ - ROM_LOAD("994qigr1.bin", 0x2000, 0x1800, CRC(b8f367ab) SHA1(3ecead4b83ec525084c70b6123d4053f8a80e1f7)) /* system GROM 1 */ - ROM_LOAD("994qigr2.bin", 0x4000, 0x1800, CRC(e0bb5341) SHA1(e255f0d65d69b927cecb8fcfac7a4c17d585ea96)) /* system GROM 2 */ -ROM_END - - -ROM_START(ti99_4ev) - /*CPU memory space*/ - ROM_REGION16_BE(0x2000, "maincpu", 0) - ROM_LOAD16_WORD("994arom.bin", 0x0000, 0x2000, CRC(db8f33e5) SHA1(6541705116598ab462ea9403c00656d6353ceb85)) /* system ROMs */ - - /*GROM memory space*/ - ROM_REGION(0x10000, region_grom, 0) - ROM_LOAD("994agr38.bin", 0x0000, 0x6000, CRC(bdd9f09b) SHA1(9b058a55d2528d2a6a69d7081aa296911ed7c0de)) /* system GROMs */ -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1979, ti99_4, 0, 0, ti99_4_60hz, ti99_4, driver_device, 0, "Texas Instruments", "TI-99/4 Home Computer (US)" , 0) -COMP( 1980, ti99_4e, ti99_4, 0, ti99_4_50hz, ti99_4, driver_device, 0, "Texas Instruments", "TI-99/4 Home Computer (Europe)" , 0) -COMP( 1981, ti99_4a, 0, 0, ti99_4a_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer (US)" , 0) -COMP( 1981, ti99_4ae, ti99_4a, 0, ti99_4a_50hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer (Europe)" , 0) -COMP( 1983, ti99_4qe, ti99_4qi, 0, ti99_4qi_50hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4QI Home Computer (Europe)" , 0) -COMP( 1983, ti99_4qi, 0, 0, ti99_4qi_60hz, ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4QI Home Computer" , 0) -COMP( 1994, ti99_4ev, ti99_4a, 0, ti99_4ev_60hz,ti99_4a, driver_device, 0, "Texas Instruments", "TI-99/4A Home Computer with EVPC" , 0) diff --git a/src/mess/drivers/ti99_8.c b/src/mess/drivers/ti99_8.c deleted file mode 100644 index eeaacff3591..00000000000 --- a/src/mess/drivers/ti99_8.c +++ /dev/null @@ -1,1124 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Michael Zapf -/**************************************************************************** - - The MESS TI-99/8 emulation driver - - The TI-99/8 was the envisaged successor to the TI-99/4A but never passed - its prototype state. Only a few dozens of consoles were built. The ROMs - were not even finalized, so the few available consoles have different - operating system versions and capabilities. - - - Characteristics - --------------- - - Name: "Texas Instruments Computer TI-99/8" (no "Home") - - Inofficial nickname: "Armadillo" - - CPU: Single-CPU system using a TMS9995, but as a variant named MP9537. This - variant does not offer on-chip RAM or decrementer. - - Video: TMS9118 Video Display Processor with 16 KiB RAM. The 9118 has the - same capabilities as the 9918/28 in the TI-99/4A, except for the - missing GROM clock (which must be provided separately) and the - different DRAM type (2 chips TMS 4416 16K*4). Delivers a 60 Hz - interrupt to the CPU via the PSI. - - Keyboard: 50-key keyboard, slightly different to the TI-99/4A, but also with - modifiers Control, Function, Shift, Caps Lock. Connects to the TMS 9901 - PSI like in the TI-99/4A, but the pin assignment and key matrix - are different: - - P0-P3: column select - - INT6*-INT11*: row inputs (INT6* is only used for joystick fire) - - Cassette: Identical to TI-99/4A, except that the CS2 unit is not implemented - - Sound: SN94624 as used in the TI-99/4A - - Speech: TMS5200C, a rare variant of the TMS52xx family. Compatible to the - speech data for the separate speech synthesizer for the TI-99/4A. - Speech ROMs CD2325A, CD2326A (total 128K*1) - - ROM: TMS4764 (8K*8), called "ROM0" in the specifications [1] - TMS47256 (32K*8), called "ROM1" [1] - TMS47128 (16K*8), "P-Code ROM" (only available in late prototypes) - See below for contents - - GROMs: TI-specific ROM circuits with internal address counter and 6 KiB - capacity (see grom.c) - 3 GROMs (system GROMs, access via port at logical address F830) - 8 GROMs (Pascal / Text-to-speech GROMs, port at logical address F840) - 8 GROMs (Pascal GROMs, port at logical address F850) - 3 GROMs (Pascal GROMs, access via port at logical address F860) - (total of 132 KiB GROM) - - RAM: 1 TMS4016 (SRAM 2K*8) - 8 TMS4164 (DRAM 64K*1) - - PSI: (programmable system interface) TMS9901 with connections to - keyboard, joystick port, cassette port, and external interrupt lines - (video, peripheral devices) - - External connectors: - - Joystick port (compatible to TI-99/4A joystick slot) - - Cassette port - - Cartridge port (compatible to TI-99/4A cartridge slot, but vertically - orientated, so cartridges are plugged in from the top) - - I/O port (not compatible to TI-99/4A I/O port, needs a special P-Box - card called "Armadillo interface") - - Hexbus port (new peripheral system, also seen with later TI designs) - - Video port (composite) - - Custom chips: Five custom chips contain mapping and selection logic - - "Vaquerro": Logical address space decoder - - "Mofetta" : Physical address space decoder - - "Amigo" : Mapper - - "Pollo" : DRAM controller - - "Oso" : Hexbus interface - - Modes: - - Compatibility mode (TI-99/4A mode): Memory-mapped devices are - placed at the same location as found in the TI-99/4A, thereby - providing a good downward compatibility. - The console starts up in compatibility mode. - - Native mode (Armadillo mode): Devices are located at positions above - 0xF000 that allow for a contiguous usage of memory. - - - ROM contents - ------------ - The ROM0 chip is accessible at addresses 0000-1FFF in the logical address - space of the compatibility mode. It contains the GPL interpreter. In - native mode the ROM0 chip is invisible. - - ROM0 - offset Logical address Name - ----------------------------------- - 0000 0000-1FFF ROM0 - - - The ROM1 chip contains 32 KiB of various system software. It is located in - the physical address space, so it must be mapped into the logical address - space by defining an appropriate map. - - ROM1 - offset Physical address Name - ---------------------------------------------------------- - 0000 FFA000-FFDFFF ROM1 - 4000 FF4000-FF5FFF @CRU>2700 Text-to-speech ROM/DSR - 6000 FF4000-FF5FFF @CRU>1700 Hexbus DSR - - The DSR portions have to be selected via the CRU bits >1700 or >2700. - - - Mapper - ------ - The mapper uses 4K pages (unlike the Geneve mapper with 8K pages) which - are defined by a 32 bit word. The address bits A0-A3 serve as the page - index, whereas bits A4-A15 are the offset in the page. - From the 32 bits, 24 bits define the physical address, so this allows for - a maximum of 16 MiB of mapped-addressable memory. - - See more about the mapper in the file mapper8.c. - - - Availability of ROMs and documentation - -------------------------------------- - By written consent, TI granted free use of all software and documentation - concerning the TI-99/8, including all specifications, ROMs, and source code - of ROMs. - - - Acknowledgements - ---------------- - Special thanks go to Ciro Barile of the TI99 Italian User Club - (www.ti99iuc.it): By his courtesy we have a consistent dump of ROMs for - one of the most evolved versions of the TI-99/8 with - - - complete GROM set (with Pascal) - - complete ROM set (with Hexbus DSR and TTS) - - complete speech ROM set - - Also, by applying test programs on his real console, many unclear - specifications were resolved. - - - References - ---------- - [1] Texas Instruments: Armadillo Product Specifications, July 1983 - [2] Source code (Assembler and GPL) of the TI-99/8 ROMs and GROMs - [3] Schematics of the TI-99/8 - - - Implementation - -------------- - Initial version by Raphael Nabet, 2003. - - February 2012: Rewritten as class [Michael Zapf] - November 2013: Included new dumps [Michael Zapf] - -=========================================================================== -Known Issues (MZ, 2010-11-07) - - KEEP IN MIND THAT TEXAS INSTRUMENTS NEVER RELEASED THE TI-99/8 AND THAT - THERE ARE ONLY A FEW PROTOTYPES OF THE TI-99/8 AVAILABLE. ALL SOFTWARE - MUST BE ASSUMED TO HAVE REMAINED IN A PRELIMINARY STATE. - -- Extended Basic II does not start when a floppy controller is present. This is - a problem of the prototypical XB II which we cannot solve. It seems as if only - hexbus devices are properly supported, but we currently do not have an - emulation for those. Thus you can currently only use cassette to load and - save programs. You MUST not plug in any floppy controller when you intend to - start XB II. Other cartridges (like Editor/Assembler) - seem to be unaffected by this problem and can make use of the floppy - controllers. - Technical detail: The designers of XB II seem to have decided to put PABs - (Peripheral access block; contains pointers to buffers, the file name, and - the access modes) into CPU RAM instead of the traditional storage in VDP - RAM. The existing peripheral cards are hard-coded to interpret the given - pointer to the PAB as pointing to a VDP RAM address. That is, as soon as - the card is found, control is passed to the DSR (device service routine), - the file name will not be found, and control returns with an error. It seems - as if XB II does not properly handle this situation and may lock up - (sometimes it starts up, but file access is still not possible). - - TODO: Emulate a Hexbus floppy. - -- Multiple cartridges are not shown in the startup screen; only one - cartridge is presented. You have to manually select the cartridges with the - dip switch. - -- SAVE and OLD MINIMEM do not work properly in XB II. It seems as if the - mapper shadows the NVRAM of the cartridge. You will lose the contents when - you turn off the machine. - -*****************************************************************************/ - - -#include "emu.h" -#include "cpu/tms9900/tms9995.h" - -#include "sound/sn76496.h" -#include "sound/wave.h" -#include "machine/tms9901.h" -#include "imagedev/cassette.h" - -#include "bus/ti99x/998board.h" -#include "bus/ti99x/videowrp.h" -#include "bus/ti99x/grom.h" -#include "bus/ti99x/gromport.h" -#include "bus/ti99x/joyport.h" - -#include "bus/ti99_peb/peribox.h" - -// Debugging -#define TRACE_READY 0 -#define TRACE_INTERRUPTS 0 -#define TRACE_CRU 0 - -/* - READY bits. -*/ -enum -{ - READY_GROM = 1, - READY_MAPPER = 2, - READY_PBOX = 4, - READY_SOUND = 8, - READY_CART = 16, - READY_SPEECH = 32 -}; - -class ti99_8_state : public driver_device -{ -public: - ti99_8_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cpu(*this, "maincpu"), - m_tms9901(*this, TMS9901_TAG), - m_gromport(*this, GROMPORT_TAG), - m_peribox(*this, PERIBOX_TAG), - m_mainboard(*this, MAINBOARD8_TAG), - m_joyport(*this, JOYPORT_TAG), - m_video(*this, VIDEO_SYSTEM_TAG), - m_cassette(*this, "cassette") { } - - // Machine management - DECLARE_MACHINE_START(ti99_8); - DECLARE_MACHINE_RESET(ti99_8); - - // Processor connections with the main board - DECLARE_READ8_MEMBER( cruread ); - DECLARE_WRITE8_MEMBER( cruwrite ); - DECLARE_WRITE8_MEMBER( external_operation ); - DECLARE_WRITE_LINE_MEMBER( clock_out ); - - // Connections from outside towards the CPU (callbacks) - DECLARE_WRITE_LINE_MEMBER( console_ready_mapper ); - DECLARE_WRITE_LINE_MEMBER( console_ready_sound ); - DECLARE_WRITE_LINE_MEMBER( console_ready_pbox ); - DECLARE_WRITE_LINE_MEMBER( console_ready_cart ); - DECLARE_WRITE_LINE_MEMBER( console_ready_grom ); - DECLARE_WRITE_LINE_MEMBER( console_ready_speech ); - DECLARE_WRITE_LINE_MEMBER( console_reset ); - DECLARE_WRITE_LINE_MEMBER( notconnected ); - - // Connections with the system interface chip 9901 - DECLARE_WRITE_LINE_MEMBER( extint ); - DECLARE_WRITE_LINE_MEMBER( video_interrupt ); - - // Connections with the system interface TMS9901 - DECLARE_READ8_MEMBER(read_by_9901); - DECLARE_WRITE_LINE_MEMBER(keyC0); - DECLARE_WRITE_LINE_MEMBER(keyC1); - DECLARE_WRITE_LINE_MEMBER(keyC2); - DECLARE_WRITE_LINE_MEMBER(keyC3); - DECLARE_WRITE_LINE_MEMBER(CRUS); - DECLARE_WRITE_LINE_MEMBER(PTGEN); - DECLARE_WRITE_LINE_MEMBER(audio_gate); - DECLARE_WRITE_LINE_MEMBER(cassette_output); - DECLARE_WRITE_LINE_MEMBER(cassette_motor); - DECLARE_WRITE8_MEMBER(tms9901_interrupt); - -private: - // Keyboard support - void set_keyboard_column(int number, int data); - int m_keyboard_column; - - // READY handling - int m_nready_combined; - int m_nready_prev; - void console_ready_join(int id, int state); - - // Latch for 9901 INT2, INT1 lines - line_state m_int1; - line_state m_int2; - - // Connected devices - required_device m_cpu; - required_device m_tms9901; - required_device m_gromport; - required_device m_peribox; - required_device m_mainboard; - required_device m_joyport; - required_device m_video; - required_device m_cassette; -}; - -/* - Memory map. We have a configurable mapper, so we need to delegate the - job to the mapper completely. -*/ -static ADDRESS_MAP_START(memmap, AS_PROGRAM, 8, ti99_8_state) - AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE(MAINBOARD8_TAG, mainboard8_device, readm, writem ) -ADDRESS_MAP_END - -/* - CRU map - see description above - The TMS9901 is fully decoded according to the specification, so we only - have 32 bits for it; the rest goes to the CRU bus - (decoded by the "Vaquerro" chip, signal NNOICS*) -*/ - -static ADDRESS_MAP_START(crumap, AS_IO, 8, ti99_8_state) - AM_RANGE(0x0000, 0x0003) AM_DEVREAD(TMS9901_TAG, tms9901_device, read) - AM_RANGE(0x0000, 0x02ff) AM_READ(cruread) - - AM_RANGE(0x0000, 0x001f) AM_DEVWRITE(TMS9901_TAG, tms9901_device, write) - AM_RANGE(0x0000, 0x17ff) AM_WRITE(cruwrite) -ADDRESS_MAP_END - -/* ti99/8 : 54-key keyboard */ -static INPUT_PORTS_START(ti99_8) - - /* 16 ports for keyboard and joystick */ - PORT_START("COL0") /* col 0 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALPHA LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FCTN") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL1") /* col 1 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! DEL") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL2") /* col 2 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @ INS") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s S (LEFT)") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x X (DOWN)") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL3") /* col 3 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e E (UP)") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d D (RIGHT)") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL4") /* col 4 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ CLEAR") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL5") /* col 5 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % BEGIN") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL6") /* col 6 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ^ PROC'D") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL7") /* col 7 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 & AID") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL8") /* col 8 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 * REDO") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL9") /* col 9 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ( BACK") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL10") /* col 10 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL11") /* col 11 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= + QUIT") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL12") /* col 12 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(SPACE)") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("COL13") /* col 13 */ - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) - -INPUT_PORTS_END - -/***************************************************************************** - Components -******************************************************************************/ -#define region_sysgrom "sysgrom" - -static GROM_CONFIG(grom0_config) -{ - false, 0, region_sysgrom, 0x0000, 0x1800, GROMFREQ -}; - -static GROM_CONFIG(grom1_config) -{ - false, 1, region_sysgrom, 0x2000, 0x1800, GROMFREQ -}; - -static GROM_CONFIG(grom2_config) -{ - false, 2, region_sysgrom, 0x4000, 0x1800, GROMFREQ -}; - -/**************************************************** - PASCAL groms, 3 libraries @ 8 GROMs - Do some macro tricks to keep writing effort low -*****************************************************/ - -#define region_gromlib1 "gromlib1" -#define region_gromlib2 "gromlib2" -#define region_gromlib3 "gromlib3" - -#define MCFG_GROM_LIBRARY_ADD8(_tag, _config) \ - MCFG_DEVICE_ADD(#_tag "0", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##0) \ - MCFG_DEVICE_ADD(#_tag "1", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##1) \ - MCFG_DEVICE_ADD(#_tag "2", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##2) \ - MCFG_DEVICE_ADD(#_tag "3", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##3) \ - MCFG_DEVICE_ADD(#_tag "4", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##4) \ - MCFG_DEVICE_ADD(#_tag "5", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##5) \ - MCFG_DEVICE_ADD(#_tag "6", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##6) \ - MCFG_DEVICE_ADD(#_tag "7", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##7) - -#define MCFG_GROM_LIBRARY_ADD3(_tag, _config) \ - MCFG_DEVICE_ADD(#_tag "0", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##0) \ - MCFG_DEVICE_ADD(#_tag "1", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##1) \ - MCFG_DEVICE_ADD(#_tag "2", GROM, 0) \ - MCFG_DEVICE_CONFIG(_config##2) - -#define GROM_LIBRARY_CONFIG8(_conf, _region) \ -static GROM_CONFIG(_conf##0) \ -{ false, 0, _region, 0x0000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##1) \ -{ false, 1, _region, 0x2000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##2) \ -{ false, 2, _region, 0x4000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##3) \ -{ false, 3, _region, 0x6000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##4) \ -{ false, 4, _region, 0x8000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##5) \ -{ false, 5, _region, 0xa000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##6) \ -{ false, 6, _region, 0xc000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##7) \ -{ false, 7, _region, 0xe000, 0x1800, GROMFREQ }; - -#define GROM_LIBRARY_CONFIG3(_conf, _region) \ -static GROM_CONFIG(_conf##0) \ -{ false, 0, _region, 0x0000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##1) \ -{ false, 1, _region, 0x2000, 0x1800, GROMFREQ }; \ -static GROM_CONFIG(_conf##2) \ -{ false, 2, _region, 0x4000, 0x1800, GROMFREQ }; -GROM_LIBRARY_CONFIG8(pascal1, region_gromlib1) -GROM_LIBRARY_CONFIG8(pascal2, region_gromlib2) -GROM_LIBRARY_CONFIG3(pascal3, region_gromlib3) - -READ8_MEMBER( ti99_8_state::cruread ) -{ -// if (VERBOSE>6) logerror("read access to CRU address %04x\n", offset << 4); - UINT8 value = 0; - - // Similar to the bus8z_devices, just let the mapper, the gromport, and the p-box - // decide whether they want to change the value at the CRU address - // Also, we translate the bit addresses to base addresses - m_mainboard->crureadz(space, offset<<4, &value); - m_gromport->crureadz(space, offset<<4, &value); - m_peribox->crureadz(space, offset<<4, &value); - - if (TRACE_CRU) logerror("ti99_8: CRU %04x -> %02x\n", offset<<4, value); - return value; -} - -WRITE8_MEMBER( ti99_8_state::cruwrite ) -{ - if (TRACE_CRU) logerror("ti99_8: CRU %04x <- %x\n", offset<<1, data); - m_mainboard->cruwrite(space, offset<<1, data); - m_gromport->cruwrite(space, offset<<1, data); - m_peribox->cruwrite(space, offset<<1, data); -} - -/*************************************************************************** - TI99/8-specific tms9901 I/O handlers - These methods are callbacks from the TMS9901 system interface. That is, - they deliver the values queried via the TMS9901, and they represent - console functions which are under control of the TMS9901 (like the - keyboard column selection.) -***************************************************************************/ - -static const char *const column[] = { - "COL0", "COL1", "COL2", "COL3", "COL4", "COL5", "COL6", "COL7", - "COL8", "COL9", "COL10", "COL11", "COL12", "COL13" -}; - -READ8_MEMBER( ti99_8_state::read_by_9901 ) -{ - int answer=0; - UINT8 joyst; - switch (offset & 0x03) - { - case TMS9901_CB_INT7: - // Read pins INT3*-INT7* of TI99's 9901. - // - // bit 1: INT1 status - // bit 2: INT2 status - // bits 3-4: unused? - // bit 5: ??? - // bit 6-7: keyboard status bits 0 through 1 - - // |K|K|-|-|-|I2|I1|C| - if (m_keyboard_column >= 14) - { - // TI-99/8's wiring differs from the TI-99/4A - joyst = m_joyport->read_port(); - answer = (joyst & 0x01) | ((joyst & 0x10)>>3); - } - else - { - answer = ioport(column[m_keyboard_column])->read(); - } - answer = (answer << 6); - if (m_int1 == CLEAR_LINE) answer |= 0x02; - if (m_int2 == CLEAR_LINE) answer |= 0x04; - - break; - - case TMS9901_INT8_INT15: - // Read pins INT8*-INT15* of TI99's 9901. - // - // bit 0-2: keyboard status bits 2 to 4 - // bit 3: tape input mirror - // bit 4: unused - // bit 5-7: weird, not emulated - - // |0|0|0|0|0|K|K|K| - - if (m_keyboard_column >= 14) - { - joyst = m_joyport->read_port(); - answer = joyst << 1; - } - else - { - answer = ioport(column[m_keyboard_column])->read(); - } - answer = (answer >> 2) & 0x07; - break; - - case TMS9901_P0_P7: - // Read pins P0-P7 of TI99's 9901. None here. - break; - - case TMS9901_P8_P15: - // Read pins P8-P15 of TI99's 9901. (TI-99/8) - // - // bit 26: high - // bit 27: tape input - answer = 4; - if (m_cassette->input() > 0) - answer |= 8; - break; - } - return answer; -} - -/* - WRITE key column select (P2-P4), TI-99/8 -*/ -void ti99_8_state::set_keyboard_column(int number, int data) -{ - if (data != 0) - m_keyboard_column |= 1 << number; - else - m_keyboard_column &= ~(1 << number); - - if (m_keyboard_column >= 14) - { - m_joyport->write_port(m_keyboard_column - 13); - } -} - -WRITE_LINE_MEMBER( ti99_8_state::keyC0 ) -{ - set_keyboard_column(0, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::keyC1 ) -{ - set_keyboard_column(1, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::keyC2 ) -{ - set_keyboard_column(2, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::keyC3 ) -{ - set_keyboard_column(3, state); -} - -/* - Set 99/4A compatibility mode (CRUS=1) -*/ -WRITE_LINE_MEMBER( ti99_8_state::CRUS ) -{ - m_mainboard->CRUS_set(state==ASSERT_LINE); - - // In Armadillo mode, GROMs are located at f830; accordingly, the - // gromport must be reconfigured - if (state==ASSERT_LINE) - { - m_gromport->set_grom_base(0x9800, 0xfbf1); - } - else - { - m_gromport->set_grom_base(0xf830, 0xfff1); - } -} - -/* - Set mapper /PTGEN. This is negative logic; we use PTGE as the positive logic signal. -*/ -WRITE_LINE_MEMBER( ti99_8_state::PTGEN ) -{ - m_mainboard->PTGE_set(state==CLEAR_LINE); -} - -/* - Control cassette tape unit motor (P6) -*/ -WRITE_LINE_MEMBER( ti99_8_state::cassette_motor ) -{ - m_cassette->change_state(state==ASSERT_LINE? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); -} - -/* - Audio gate (P8) - Set to 1 before using tape: this enables the mixing of tape input sound - with computer sound. - We do not really need to emulate this as the tape recorder generates sound - on its own. -*/ -WRITE_LINE_MEMBER( ti99_8_state::audio_gate ) -{ -} - -/* - Tape output (P9) - I think polarity is correct, but don't take my word for it. -*/ -WRITE_LINE_MEMBER( ti99_8_state::cassette_output ) -{ - m_cassette->output(state==ASSERT_LINE? +1 : -1); -} - -WRITE8_MEMBER( ti99_8_state::tms9901_interrupt ) -{ - m_cpu->set_input_line(INT_9995_INT1, data); -} - -/*****************************************************************************/ - -/* - set the state of TMS9901's INT2 (called by the tms9928 core) -*/ -WRITE_LINE_MEMBER( ti99_8_state::video_interrupt ) -{ - if (TRACE_INTERRUPTS) logerror("ti99_8: VDP int 2 on tms9901, level=%02x\n", state); - m_int2 = (line_state)state; - m_tms9901->set_single_int(2, state); -} - -/*********************************************************** - Links to external devices -***********************************************************/ - -/* - We combine the incoming READY signals and propagate them to the CPU. - An alternative would be to let the CPU get the READY state, but this would - be a much higher overhead, as this happens in each clock tick. -*/ -void ti99_8_state::console_ready_join(int id, int state) -{ - if (state==CLEAR_LINE) - m_nready_combined |= id; - else - m_nready_combined &= ~id; - - if (TRACE_READY) - { - if (m_nready_prev != m_nready_combined) logerror("ti99_8: READY bits = %04x\n", ~m_nready_combined); - } - - m_nready_prev = m_nready_combined; - m_cpu->set_ready(m_nready_combined==0); -} - -/* - Connections to the READY line. This might look a bit ugly; we need an - implementation of a "Wired AND" device. -*/ -WRITE_LINE_MEMBER( ti99_8_state::console_ready_grom ) -{ - console_ready_join(READY_GROM, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::console_ready_mapper ) -{ - console_ready_join(READY_MAPPER, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::console_ready_pbox ) -{ - console_ready_join(READY_PBOX, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::console_ready_sound ) -{ - console_ready_join(READY_SOUND, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::console_ready_cart ) -{ - console_ready_join(READY_CART, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::console_ready_speech ) -{ - console_ready_join(READY_SPEECH, state); -} - -/* - The RESET line leading to a reset of the CPU. -*/ -WRITE_LINE_MEMBER( ti99_8_state::console_reset ) -{ - if (machine().phase() != MACHINE_PHASE_INIT) - { - m_cpu->set_input_line(INT_9995_RESET, state); - m_video->reset_vdp(state); - } -} - -WRITE_LINE_MEMBER( ti99_8_state::extint ) -{ - if (TRACE_READY) logerror("ti99_8: EXTINT level = %02x\n", state); - m_int1 = (line_state)state; - m_tms9901->set_single_int(1, state); -} - -WRITE_LINE_MEMBER( ti99_8_state::notconnected ) -{ - if (TRACE_READY) logerror("ti99_8: Setting a not connected line ... ignored\n"); -} - -WRITE8_MEMBER( ti99_8_state::external_operation ) -{ - static const char* extop[8] = { "inv1", "inv2", "IDLE", "RSET", "inv3", "CKON", "CKOF", "LREX" }; - if (offset == IDLE_OP) return; - else - { - logerror("ti99_4x: External operation %s not implemented on TI-99/8 board\n", extop[offset]); - } -} - -/* - Clock line from the CPU. Used to control wait state generation. -*/ -WRITE_LINE_MEMBER( ti99_8_state::clock_out ) -{ - m_mainboard->clock_in(state); -} - -/*****************************************************************************/ - -/* - Format: - Name, mode, stop, mask, select, write, read8z function, write8 function - - Multiple devices may have the same select pattern; as in the real hardware, - care must be taken that only one device actually responds. In the case of - GROMs, each chip has an internal address counter and an ID, and the chip - only responds when the ID and the most significant 3 bits match. - - NATIVE <-> CRUS=0 - TI99EM <-> CRUS=1 - - PATGEN <-> PTGEN=1 - - CONT: Mapper continues iterating through devices - STOP: Mapper stops iterating when found - - Access to the mapper registers is done directly in the mapper, not via - this list. - - TODO: This should (must) be improved in terms of performance. Every single - memory access goes through the mapper. Either we use an ordered search list, - or we order the entries according to their frequency. - (I did this right now, putting the Pascal GROMs at the end.) - We should think about a set entry where devices with the same address - are collected as one single entry (think about the Pascal lib with 21 GROMs, - twice eight and once three of them on the same address). -*/ - -#define PASCAL_GROM_LIB8(_tag, _addr) \ - { _tag "0", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "1", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "2", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "3", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "4", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "5", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "6", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "7", PATGEN, CONT, _addr, 0xfff1, 0x0000 } - -#define PASCAL_GROM_LIB3(_tag, _addr) \ - { _tag "0", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "1", PATGEN, CONT, _addr, 0xfff1, 0x0000 }, \ - { _tag "2", PATGEN, CONT, _addr, 0xfff1, 0x0000 } - - -static const mapper8_list_entry mapper_devices[] = -{ - // TI-99/4A mode (CRUS=1) - // Full/partial decoding has been verified on a real machine - // GROMs: According to the spec, the 99/8 supports up to 4 GROM libraries - // (99/4A supports 256 libraries) - // at 9800, 9804, 9808, 980c. Address counter access is at 9802,6,a,e. Write access +0400. - { ROM0NAME, TI99EM, STOP, 0x0000, 0xe000, 0x0000 }, // 0000-1fff - { TISOUND_TAG, TI99EM, STOP, 0x8400, 0xfff1, 0x0000 }, // 8400-840f - { VIDEO_SYSTEM_TAG, TI99EM, STOP, 0x8800, 0xfff1, 0x0400 }, // 8800,8802 / 8c00,8c02 - { SPEECH_TAG, TI99EM, STOP, 0x9000, 0xfff1, 0x0400 }, // 9000-900f / 9400-940f - { SRAMNAME, TI99EM, STOP, 0x8000, 0xf800, 0x0000 }, // 8000-87ff; must follow the sound generator - { MAINBOARD8_TAG, TI99EM, STOP, 0x8810, 0xfff0, 0x0000 }, - - { GROM0_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // 9800,2,4,...e/9c00,2,4,...e - { GROM1_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto. - { GROM2_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto. (GROMs are connected in parallel, - { GROMPORT_TAG, TI99EM, CONT, 0x9800, 0xfff1, 0x0400 }, // dto. use internal address counter and id) - - // TI-99/8 mode - // Full/partial decoding has been verified on a real machine - // Sound ports are at f800, f802, f804, ..., f80e - // VDP ports are (f810,f812), (f814,f816), (f818,f81a), (f81c,f81e) - // Note that unmapped GROM accesses (odd addresses like F831) return FF, - // not 00 as in our emulation, so that is not quite consistent, but tolerable ... I guess - - { SRAMNAME, NATIVE, STOP, 0xf000, 0xf800, 0x0000 }, // f000-f7ff - { TISOUND_TAG, NATIVE, STOP, 0xf800, 0xfff1, 0x0000 }, // f800-f80e (even addresses) - { VIDEO_SYSTEM_TAG, NATIVE, STOP, 0xf810, 0xfff1, 0x0000 }, // f810,2 (unlike 99/4A, no different read/write ports) - { SPEECH_TAG, NATIVE, STOP, 0xf820, 0xfff1, 0x0000 }, // f820-f82f - { MAINBOARD8_TAG, NATIVE, STOP, 0xf870, 0xfff0, 0x0000 }, - - { GROM0_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, // f830-f83e (4 banks), no different read/write ports - { GROM1_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, - { GROM2_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, - { GROMPORT_TAG, NATIVE, CONT, 0xf830, 0xfff1, 0x0000 }, - - PASCAL_GROM_LIB8("pascal1_grom", 0xf840), - PASCAL_GROM_LIB8("pascal2_grom", 0xf850), - PASCAL_GROM_LIB3("pascal3_grom", 0xf860), - - // Physical (need to pack this in here as well to keep config simple) - // but these lines will be put into a separate list - { DRAMNAME, PHYSIC, STOP, 0x000000, 0xff0000, 0x000000 }, // 000000-00ffff 64 KiB DRAM - { PCODENAME, PHYSIC, STOP, 0xf00000, 0xffc000, 0x000000 }, // f00000-f03fff P-Code ROM - { MAINBOARD8_TAG, PHYSIC, CONT, 0xff4000, 0xffe000, 0x000000 }, // ff4000-ff5fff Internal DSR - { GROMPORT_TAG, PHYSIC, STOP, 0xff6000, 0xffe000, 0x000000 }, // ff6000-ff7fff Cartridge ROM space - { GROMPORT_TAG, PHYSIC, STOP, 0xff8000, 0xffe000, 0x000000 }, // ff8000-ff9fff Cartridge ROM space - { ROM1A0NAME, PHYSIC, STOP, 0xffa000, 0xffe000, 0x000000 }, // ffa000-ffbfff ROM1 - { ROM1C0NAME, PHYSIC, STOP, 0xffc000, 0xffe000, 0x000000 }, // ffc000-ffdfff ROM1 - { INTSNAME, PHYSIC, STOP, 0xffe000, 0xfffff0, 0x000000 }, // ffe000-ffe00f Interrupt level sense - { PERIBOX_TAG, PHYSIC, STOP, 0x000000, 0x000000, 0x000000 }, // Peripheral Expansion Box - - { NULL, 0, 0, 0, 0, 0 } -}; - -static MAPPER8_CONFIG( mapper_conf ) -{ - mapper_devices -}; - -MACHINE_START_MEMBER(ti99_8_state,ti99_8) -{ - m_nready_combined = 0; - m_peribox->senila(CLEAR_LINE); - m_peribox->senilb(CLEAR_LINE); -} - -MACHINE_RESET_MEMBER(ti99_8_state, ti99_8) -{ - m_cpu->set_hold(CLEAR_LINE); - - // Pulling down the line on RESET configures the CPU to insert one wait - // state on external memory accesses - m_cpu->set_ready(CLEAR_LINE); - - // But we assert the line here so that the system starts running - m_nready_combined = 0; - m_gromport->set_grom_base(0x9800, 0xfff1); - - // Clear INT1 and INT2 latch - m_int1 = CLEAR_LINE; - m_int2 = CLEAR_LINE; -} - -static MACHINE_CONFIG_START( ti99_8, ti99_8_state ) - // basic machine hardware */ - // TMS9995-MP9537 CPU @ 10.7 MHz - // MP9537 mask: This variant of the TMS9995 does not contain on-chip RAM - MCFG_TMS99xx_ADD("maincpu", TMS9995_MP9537, XTAL_10_738635MHz, memmap, crumap) - MCFG_TMS9995_EXTOP_HANDLER( WRITE8(ti99_8_state, external_operation) ) - MCFG_TMS9995_CLKOUT_HANDLER( WRITELINE(ti99_8_state, clock_out) ) - - MCFG_MACHINE_START_OVERRIDE(ti99_8_state, ti99_8 ) - MCFG_MACHINE_RESET_OVERRIDE(ti99_8_state, ti99_8 ) - - /* Main board */ - MCFG_DEVICE_ADD(TMS9901_TAG, TMS9901, XTAL_10_738635MHz/4.0) - MCFG_TMS9901_READBLOCK_HANDLER( READ8(ti99_8_state, read_by_9901) ) - MCFG_TMS9901_P0_HANDLER( WRITELINE( ti99_8_state, keyC0) ) - MCFG_TMS9901_P1_HANDLER( WRITELINE( ti99_8_state, keyC1) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( ti99_8_state, keyC2) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( ti99_8_state, keyC3) ) - MCFG_TMS9901_P4_HANDLER( WRITELINE( ti99_8_state, CRUS) ) - MCFG_TMS9901_P5_HANDLER( WRITELINE( ti99_8_state, PTGEN) ) - MCFG_TMS9901_P6_HANDLER( WRITELINE( ti99_8_state, cassette_motor) ) - MCFG_TMS9901_P8_HANDLER( WRITELINE( ti99_8_state, audio_gate) ) - MCFG_TMS9901_P9_HANDLER( WRITELINE( ti99_8_state, cassette_output) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( ti99_8_state, tms9901_interrupt) ) - - MCFG_MAINBOARD8_ADD( MAINBOARD8_TAG, mapper_conf ) - MCFG_MAINBOARD8_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_mapper)) - MCFG_TI99_GROMPORT_ADD( GROMPORT_TAG ) - MCFG_GROMPORT_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_cart) ) - MCFG_GROMPORT_RESET_HANDLER( WRITELINE(ti99_8_state, console_reset) ) - - /* Peripheral expansion box */ - MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_998, 0) - MCFG_PERIBOX_INTA_HANDLER( WRITELINE(ti99_8_state, extint) ) - MCFG_PERIBOX_INTB_HANDLER( WRITELINE(ti99_8_state, notconnected) ) - MCFG_PERIBOX_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_pbox) ) - - /* Sound hardware */ - MCFG_TI_SOUND_76496_ADD( TISOUND_TAG ) - MCFG_TI_SOUND_READY_HANDLER( WRITELINE(ti99_8_state, console_ready_sound) ) - - /* Cassette drives */ - MCFG_SPEAKER_STANDARD_MONO("cass_out") - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25) - - /* Console GROMs */ - MCFG_GROM_ADD( GROM0_TAG, grom0_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom)) - MCFG_GROM_ADD( GROM1_TAG, grom1_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom)) - MCFG_GROM_ADD( GROM2_TAG, grom2_config ) - MCFG_GROM_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_grom)) - - /* Pascal GROM libraries. */ - MCFG_GROM_LIBRARY_ADD8(pascal1_grom, pascal1) - MCFG_GROM_LIBRARY_ADD8(pascal2_grom, pascal2) - MCFG_GROM_LIBRARY_ADD3(pascal3_grom, pascal3) - - /* Devices */ - MCFG_DEVICE_ADD(SPEECH_TAG, SPEECH8, 0) - MCFG_SPEECH8_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_speech)) - - // Joystick port - MCFG_TI_JOYPORT4A_ADD( JOYPORT_TAG ) -MACHINE_CONFIG_END - -/* - TI-99/8 US version (NTSC, 60 Hz) -*/ -static MACHINE_CONFIG_DERIVED( ti99_8_60hz, ti99_8 ) - MCFG_TI998_ADD_NTSC(VIDEO_SYSTEM_TAG, TMS9118, 0x4000, ti99_8_state, video_interrupt) -MACHINE_CONFIG_END - -/* - TI-99/8 European version (PAL, 50 Hz) -*/ -static MACHINE_CONFIG_DERIVED( ti99_8_50hz, ti99_8 ) - MCFG_TI998_ADD_PAL(VIDEO_SYSTEM_TAG, TMS9129, 0x4000, ti99_8_state, video_interrupt) -MACHINE_CONFIG_END - -/* - All ROM dumps except the speech ROM have a CRC16 checksum as the final two - bytes. ROM1 contains four 8K chunks of ROM contents with an own CRC at their - ends. All GROMs, ROM0, and the four ROM1 parts were successfully - validated. -*/ -ROM_START(ti99_8) - // Logical (CPU) memory space: ROM0 - ROM_REGION(0x2000, ROM0_TAG, 0) - ROM_LOAD("u4_rom0.bin", 0x0000, 0x2000, CRC(901eb8d6) SHA1(13190c5e834baa9c0a70066b566cfcef438ed88a)) - - // Physical memory space (mapped): ROM1 - ROM_REGION(0x8000, ROM1_TAG, 0) - ROM_LOAD("u25_rom1.bin", 0x0000, 0x8000, CRC(b574461a) SHA1(42c6aed44802cfabdd26b565d6e5ddfcd689f11e)) - - // Physical memory space (mapped): P-Code ROM - // This circuit is only available in later versions of the console and seems - // to be picky-backed on ROM1. - // To make things worse, the decoding logic of the custom chips do not show - // the required select line for this ROM on the available schematics, so - // they seem to be from the earlier version. The location in the address - // space was determined by ROM disassembly. - ROM_REGION(0x8000, PCODEROM_TAG, 0) - ROM_LOAD("u25a_pas.bin", 0x0000, 0x4000, CRC(d7ed6dd6) SHA1(32212ce6426ceccbff73d342d4a3ef699c0ae1e4)) - - // System GROMs. 3 chips @ f830 - // The schematics do not enumerate the circuits but only talk about - // "circuits on board" (COB) so we name the GROMs as gM_N.bin where M is the - // ID (0-7) and N is the access port in the logical address space. - ROM_REGION(0x6000, region_sysgrom, 0) - ROM_LOAD("g0_f830.bin", 0x0000, 0x1800, CRC(1026db60) SHA1(7327095bf4f390476e69d9fd8424e98ea1f2325a)) - ROM_LOAD("g1_f830.bin", 0x2000, 0x1800, CRC(93a43d65) SHA1(19be8a07d674bc7554c2bc9c7a5725d81e888e6e)) - ROM_LOAD("g2_f830.bin", 0x4000, 0x1800, CRC(06f2b901) SHA1(f65e0fcb2c63e230b4a9563c72f91259b94ce955)) - - // TTS & Pascal library. 8 chips @ f840 - ROM_REGION(0x10000, region_gromlib1, 0) - ROM_LOAD("g0_f840.bin", 0x0000, 0x1800, CRC(44501071) SHA1(4b5ef7f1aa43a87e7ae4f02090944be5c39b1f26)) - ROM_LOAD("g1_f840.bin", 0x2000, 0x1800, CRC(5a271d9e) SHA1(bb95befa2ffba2cc17ac437386e069e8ff621248)) - ROM_LOAD("g2_f840.bin", 0x4000, 0x1800, CRC(d52502df) SHA1(17063e33ee8709d0df8030f38bb92c4322d55e1e)) - ROM_LOAD("g3_f840.bin", 0x6000, 0x1800, CRC(86c12396) SHA1(119b6df9211b5399245e017721fc51b88b60879f)) - ROM_LOAD("g4_f840.bin", 0x8000, 0x1800, CRC(f17a2ef8) SHA1(dcb044f71d7f8a165b41f39e35a368d8f2d63b67)) - ROM_LOAD("g5_f840.bin", 0xA000, 0x1800, CRC(7dc41301) SHA1(dff714da68de352db93fba309db8e5a8ae7cab1a)) - ROM_LOAD("g6_f840.bin", 0xC000, 0x1800, CRC(7e310a90) SHA1(e927d8b3f8b32aa4fb9f7d080d5262c566a77fc7)) - ROM_LOAD("g7_f840.bin", 0xE000, 0x1800, CRC(3a9d20df) SHA1(1e6f9f8ec7df4b997a7579be742d0a7d54bc8763)) - - // Pascal library. 8 chips @ f850 - ROM_REGION(0x10000, region_gromlib2, 0) - ROM_LOAD("g0_f850.bin", 0x0000, 0x1800, CRC(2d948672) SHA1(cf15912d6dae5a450e0cfd796aa36ea5e521dc56)) - ROM_LOAD("g1_f850.bin", 0x2000, 0x1800, CRC(7d64a842) SHA1(d5884bb2af21c8027311478ee506beac6f46203d)) - ROM_LOAD("g2_f850.bin", 0x4000, 0x1800, CRC(e5ed8900) SHA1(03826882ce10fb5a6b3a9ccc85d3d1fe51979d0b)) - ROM_LOAD("g3_f850.bin", 0x6000, 0x1800, CRC(87aaf19e) SHA1(fdbe163773b8a30fa6b9508e679be6fa4f99bf7a)) - ROM_LOAD("g4_f850.bin", 0x8000, 0x1800, CRC(d3e789a5) SHA1(5ab06aa75ca694b1035ce5ac0bebacc928721388)) - ROM_LOAD("g5_f850.bin", 0xA000, 0x1800, CRC(49fd90bd) SHA1(44b2cef29c2d5304a0dcfedbdcdf9f21f2201bf9)) - ROM_LOAD("g6_f850.bin", 0xC000, 0x1800, CRC(31bac4ab) SHA1(e29049f0597d5de0bfd5c9c7bfea902abe858010)) - ROM_LOAD("g7_f850.bin", 0xE000, 0x1800, CRC(71534098) SHA1(75e87123efde885e27dd749e07cb189eb2cc45a8)) - - // Pascal library. 3 chips @ f860 - ROM_REGION(0x6000, region_gromlib3, 0) - ROM_LOAD("g0_f860.bin", 0x0000, 0x1800, CRC(0ceef210) SHA1(b89957fbff094b758746391a69dea6907c66b950)) - ROM_LOAD("g1_f860.bin", 0x2000, 0x1800, CRC(fc87de25) SHA1(4695b7f979f59a01ec16c55e4587c3379482b658)) - ROM_LOAD("g2_f860.bin", 0x4000, 0x1800, CRC(e833e350) SHA1(6ffe501981a1112be1af596a489d96e287fc6be5)) - - // Built-in RAM - ROM_REGION(SRAM_SIZE, SRAM_TAG, 0) - ROM_FILL(0x0000, SRAM_SIZE, 0x00) - - ROM_REGION(DRAM_SIZE, DRAM_TAG, 0) - ROM_FILL(0x0000, DRAM_SIZE, 0x00) -ROM_END - -#define rom_ti99_8e rom_ti99_8 - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1983, ti99_8, 0, 0, ti99_8_60hz,ti99_8, driver_device, 0, "Texas Instruments", "TI-99/8 Computer (US)" , 0) -COMP( 1983, ti99_8e, ti99_8, 0, ti99_8_50hz,ti99_8, driver_device, 0, "Texas Instruments", "TI-99/8 Computer (Europe)" , 0 ) diff --git a/src/mess/drivers/ticalc1x.c b/src/mess/drivers/ticalc1x.c deleted file mode 100644 index f043f634f17..00000000000 --- a/src/mess/drivers/ticalc1x.c +++ /dev/null @@ -1,1316 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Sean Riddle -/*************************************************************************** - - ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** - - Texas Instruments TMS1xxx family handheld calculators (mostly single-chip) - - Refer to their official manuals on how to use them. - - - TODO: - - MCU clocks are unknown where noted - -***************************************************************************/ - -#include "includes/hh_tms1k.h" - -// internal artwork -#include "dataman.lh" -#include "ti1270.lh" -#include "ti30.lh" -#include "tisr16.lh" -#include "wizatron.lh" - - -class ticalc1x_state : public hh_tms1k_state -{ -public: - ticalc1x_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag) - { } - -protected: - virtual void machine_start(); -}; - - -void ticalc1x_state::machine_start() -{ - hh_tms1k_state::machine_start(); - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! -} - - - -/*************************************************************************** - - Minidrivers (subclass, I/O, Inputs, Machine Config) - -***************************************************************************/ - -/*************************************************************************** - - TI SR-16, SR-16 II - * SR-16: TMS1000 MCU labeled TMS1001NL. die labeled 1000, 1001A - * SR-16 II: TMS1000 MCU labeled TMS1016NL. die labeled 1000B, 1016A - * 12-digit 7seg LED display - - SR-16 II is a cost-reduced 'sequel', [10^x] was removed, and [pi] was added. - -***************************************************************************/ - -class tisr16_state : public ticalc1x_state -{ -public: - tisr16_state(const machine_config &mconfig, device_type type, const char *tag) - : ticalc1x_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void tisr16_state::prepare_display() -{ - // update leds state - for (int y = 0; y < 11; y++) - m_display_state[y] = (m_r >> y & 1) ? m_o : 0; - - // exponent sign is from R10 O1, and R10 itself only uses segment G - m_display_state[11] = m_display_state[10] << 5 & 0x40; - m_display_state[10] &= 0x40; - - set_display_size(8, 12); - display_update(); -} - -WRITE16_MEMBER(tisr16_state::write_r) -{ - // R0-R10: input mux - // R0-R10: select digit (right-to-left) - m_r = m_inp_mux = data; - prepare_display(); -} - -WRITE16_MEMBER(tisr16_state::write_o) -{ - // O0-O7: digit segments - m_o = data; - prepare_display(); -} - -READ8_MEMBER(tisr16_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(11); -} - - -// config - -static INPUT_PORTS_START( tisr16 ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("CE") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("EE") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME(UTF8_CAPITAL_SIGMA) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - - PORT_START("IN.6") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - - PORT_START("IN.7") // R7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - - PORT_START("IN.8") // R8 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("10" UTF8_POW_X) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("e" UTF8_POW_X) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - - PORT_START("IN.9") // R9 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - - PORT_START("IN.10") // R10 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("C") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("log") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -static INPUT_PORTS_START( tisr16ii ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("C") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("CD") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("log") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("EE") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - - PORT_START("IN.6") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - - PORT_START("IN.7") // R7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - - PORT_START("IN.8") // R8 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - - PORT_START("IN.9") // R9 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("e" UTF8_POW_X) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME(UTF8_CAPITAL_SIGMA) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - - PORT_START("IN.10") // R10 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME(UTF8_SMALL_PI) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( tisr16, tisr16_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 300000) // RC osc. R=43K, C=68pf -> ~300kHz (note: tisr16ii MCU RC osc. is different: R=30K, C=100pf -> also ~300kHz) - MCFG_TMS1XXX_READ_K_CB(READ8(tisr16_state, read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tisr16_state, write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tisr16_state, write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_tisr16) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - TI-1270 - * TMS0970 MCU labeled TMC0974NL ZA0355, DP0974A. die labeled 0970D-74A - * 8-digit 7seg LED display - -***************************************************************************/ - -class ti1270_state : public ticalc1x_state -{ -public: - ti1270_state(const machine_config &mconfig, device_type type, const char *tag) - : ticalc1x_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(ti1270_state::write_r) -{ - // R0-R7: select digit (right-to-left) - display_matrix_seg(8, 8, m_o, data, 0xff); -} - -WRITE16_MEMBER(ti1270_state::write_o) -{ - // O1-O5,O7: input mux - // O0-O7: digit segments - m_inp_mux = (data >> 1 & 0x1f) | (data >> 2 & 0x20); - m_o = data; -} - -READ8_MEMBER(ti1270_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(6); -} - - -// config - -static INPUT_PORTS_START( ti1270 ) - PORT_START("IN.0") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("CE/C") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - - PORT_START("IN.1") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - - PORT_START("IN.2") // O3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - - PORT_START("IN.3") // O4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - - PORT_START("IN.4") // O5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME(UTF8_SMALL_PI) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - - PORT_START("IN.5") // O7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ti1270, ti1270_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ti1270_state, read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1270_state, write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1270_state, write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ti1270) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - TI-1000 - * TMS1990 MCU labeled TMC1991NL, die labeled 1991-91A - * 8-digit 7seg LED display - -***************************************************************************/ - -class ti1000_state : public ticalc1x_state -{ -public: - ti1000_state(const machine_config &mconfig, device_type type, const char *tag) - : ticalc1x_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(ti1000_state::write_r) -{ - // R0-R7: select digit (right-to-left) - UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5); - display_matrix_seg(8, 8, o, data, 0xff); -} - -WRITE16_MEMBER(ti1000_state::write_o) -{ - // O0-O3,O5(?): input mux - // O0-O7: digit segments - m_inp_mux = (data & 0xf) | (data >> 1 & 0x10); - m_o = data; -} - -READ8_MEMBER(ti1000_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(5); -} - - -// config - -static INPUT_PORTS_START( ti1000 ) - PORT_START("IN.0") // O0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - - PORT_START("IN.1") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - - PORT_START("IN.2") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - - // note: even though power buttons are on the matrix, they are not CPU-controlled - PORT_START("IN.3") // O3 or O4? - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("%") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - - PORT_START("IN.4") // O5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( ti1000, ti1000_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1990, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ti1000_state, read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1000_state, write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1000_state, write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ti1270) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - TI WIZ-A-TRON - * TMS0970 MCU labeled TMC0907NL ZA0379, DP0907BS. die labeled 0970F-07B - * 9-digit 7seg LED display(one custom digit) - -***************************************************************************/ - -class wizatron_state : public ticalc1x_state -{ -public: - wizatron_state(const machine_config &mconfig, device_type type, const char *tag) - : ticalc1x_state(mconfig, type, tag) - { } - - virtual DECLARE_WRITE16_MEMBER(write_o); - virtual DECLARE_WRITE16_MEMBER(write_r); - virtual DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(wizatron_state::write_r) -{ - // 6th digit is custom(not 7seg), for math symbols, like this: - // \./ GAB - // --- F - // /.\ EDC - - // 3rd digit only has A and G for =, though some newer hardware revisions - // (goes for both wizatron and lilprof) use a custom equals-sign digit here - m_display_segmask[3] = 0x41; - - // R0-R8: select digit (right-to-left) - display_matrix_seg(7, 9, m_o, data, 0x7f); -} - -WRITE16_MEMBER(wizatron_state::write_o) -{ - // O1-O4: input mux - // O0-O6: digit segments A-G - // O7: N/C - m_inp_mux = data >> 1 & 0xf; - m_o = data & 0x7f; -} - -READ8_MEMBER(wizatron_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(4); -} - - -// config - -static INPUT_PORTS_START( wizatron ) - PORT_START("IN.0") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - - PORT_START("IN.1") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - - PORT_START("IN.2") // O3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - - PORT_START("IN.3") // O4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( wizatron, wizatron_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(wizatron_state, read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(wizatron_state, write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(wizatron_state, write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_wizatron) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - TI Little Professor (1976 version) - * TMS0970 MCU labeled TMS0975NL ZA0356, GP0975CS. die labeled 0970D-75C - * 9-digit 7seg LED display(one custom digit) - - The hardware is nearly identical to Wiz-A-Tron (or vice versa, since this - one is older). - -***************************************************************************/ - -class lilprof_state : public wizatron_state -{ -public: - lilprof_state(const machine_config &mconfig, device_type type, const char *tag) - : wizatron_state(mconfig, type, tag) - { } - - virtual DECLARE_WRITE16_MEMBER(write_o); - virtual DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(lilprof_state::write_o) -{ - // O1-O4,O7: input mux - // O0-O6: digit segments A-G - m_inp_mux = (data >> 1 & 0xf) | (data >> 3 & 0x10); - m_o = data; -} - -READ8_MEMBER(lilprof_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(5); -} - - -// config - -static INPUT_PORTS_START( lilprof ) - PORT_INCLUDE( wizatron ) - - PORT_MODIFY("IN.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_CODE(KEYCODE_DEL) PORT_NAME("Set") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") - - PORT_START("IN.4") // O7 - PORT_CONFNAME( 0x0f, 0x01, "Level") - PORT_CONFSETTING( 0x01, "1" ) - PORT_CONFSETTING( 0x02, "2" ) - PORT_CONFSETTING( 0x04, "3" ) - PORT_CONFSETTING( 0x08, "4" ) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( lilprof, lilprof_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(lilprof_state, read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lilprof_state, write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(wizatron_state, write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_wizatron) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - TI Little Professor (1978 version) - * TMS1990 MCU labeled TMC1993NL. die labeled 1990C-c3C - * 9-digit 7seg LED display(one custom digit) - - 1978 re-release, with on/off and level select on buttons instead of - switches. The casing was slightly revised in 1980 again, but same rom. - -***************************************************************************/ - -class lilprof78_state : public ticalc1x_state -{ -public: - lilprof78_state(const machine_config &mconfig, device_type type, const char *tag) - : ticalc1x_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(lilprof78_state::write_r) -{ - // update leds state - UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f; - UINT16 r = (data & 7) | (data << 1 & 0x1f0); - - for (int y = 0; y < 9; y++) - m_display_state[y] = (r >> y & 1) ? o : 0; - - // 3rd digit A/G(equals sign) is from O7 - m_display_state[3] = (r && m_o & 0x80) ? 0x41 : 0; - - // 6th digit is a custom 7seg for math symbols (see wizatron_state write_r) - m_display_state[6] = BITSWAP8(m_display_state[6],7,6,1,4,2,3,5,0); - - set_display_size(7, 9); - display_update(); -} - -WRITE16_MEMBER(lilprof78_state::write_o) -{ - // O0-O3,O5(?): input mux - // O0-O6: digit segments A-G - // O7: 6th digit - m_inp_mux = (data & 0xf) | (data >> 1 & 0x10); - m_o = data; -} - -READ8_MEMBER(lilprof78_state::read_k) -{ - // K: multiplexed inputs - return read_inputs(5); -} - - -// config - -static INPUT_PORTS_START( lilprof78 ) - PORT_START("IN.0") // O0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - - PORT_START("IN.1") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - - PORT_START("IN.2") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - - // note: even though power buttons are on the matrix, they are not CPU-controlled - PORT_START("IN.3") // O3 or O4? - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Set") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("Level") - - PORT_START("IN.4") // O5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( lilprof78, lilprof78_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1990, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(lilprof78_state, read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lilprof78_state, write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(lilprof78_state, write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_wizatron) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - TI DataMan - * TMS1980 MCU labeled TMC1982NL. die labeled 1980A 82B - * 10-digit cyan VFD display(3 digits are custom) - -***************************************************************************/ - -class dataman_state : public ticalc1x_state -{ -public: - dataman_state(const machine_config &mconfig, device_type type, const char *tag) - : ticalc1x_state(mconfig, type, tag) - { } - - void prepare_display(); - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -void dataman_state::prepare_display() -{ - // note the extra segment on R9 - display_matrix_seg(8, 9, m_o | (m_r >> 2 & 0x80), m_r & 0x1ff, 0x7f); -} - -WRITE16_MEMBER(dataman_state::write_r) -{ - // R0-R4: input mux - // R0-R8: select digit - // R9: =(equals sign) segment - m_r = m_inp_mux = data; - prepare_display(); -} - -WRITE16_MEMBER(dataman_state::write_o) -{ - // O0-O6: digit segments A-G - m_o = BITSWAP8(data,7,1,6,5,4,3,2,0) & 0x7f; - prepare_display(); -} - -READ8_MEMBER(dataman_state::read_k) -{ - // K: multiplexed inputs (note: the Vss row is always on) - return m_inp_matrix[5]->read() | read_inputs(5); -} - - -// config - -static INPUT_PORTS_START( dataman ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Memory Bank") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Go") - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Force Out") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("Number Guesser") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Wipe Out") - - // note: even though power buttons are on the matrix, they are not CPU-controlled - PORT_START("IN.5") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_U) PORT_NAME("On/User Entry") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("?") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Electro Flash") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( dataman, dataman_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1980, 300000) // patent says 300kHz - MCFG_TMS1XXX_READ_K_CB(READ8(dataman_state, read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(dataman_state, write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(dataman_state, write_r)) - MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_dataman) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Majestic-line calculators: - * TI-30(aka SR-40): TMS0980 MCU labeled TMC0981NL. die labeled 0980B-81F - * TI Programmer: TMS0980 MCU labeled ZA0675NL, JP0983AT. die labeled 0980B-83 - * TI Business Analyst-I: TMS0980 MCU labeled TMC0982NL. die labeled 0980B-82F - * 9-digit 7seg LED display - - Of note is a peripheral by Schoenherr, called the Braillotron. It acts as - a docking station to the TI-30, with an additional display made of magnetic - refreshable Braille cells. The TI-30 itself is slightly modified to wire - the original LED display to a 25-pin D-Sub connector. - -***************************************************************************/ - -class majestic_state : public ticalc1x_state -{ -public: - majestic_state(const machine_config &mconfig, device_type type, const char *tag) - : ticalc1x_state(mconfig, type, tag) - { } - - DECLARE_WRITE16_MEMBER(write_o); - DECLARE_WRITE16_MEMBER(write_r); - DECLARE_READ8_MEMBER(read_k); -}; - -// handlers - -WRITE16_MEMBER(majestic_state::write_r) -{ - // note: 1st digit only has segments B,F,G,DP - m_display_segmask[0] = 0xe2; - - // R0-R8: select digit - UINT8 o = BITSWAP8(m_o,7,5,2,1,4,0,6,3); - display_matrix_seg(8, 9, o, data, 0xff); -} - -WRITE16_MEMBER(majestic_state::write_o) -{ - // O0-O2,O4-O7: input mux - // O0-O7: digit segments - m_inp_mux = (data & 7) | (data >> 1 & 0x78); - m_o = data; -} - -READ8_MEMBER(majestic_state::read_k) -{ - // K: multiplexed inputs (note: the Vss row is always on) - return m_inp_matrix[7]->read() | read_inputs(7); -} - - -// config - -static INPUT_PORTS_START( ti30 ) - PORT_START("IN.0") // O0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_NAME("K") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("log") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("EE" UTF8_DOWN) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x)") - - PORT_START("IN.1") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - - PORT_START("IN.2") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - - PORT_START("IN.3") // O4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME(UTF8_SMALL_PI) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("%") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")") - - PORT_START("IN.4") // O5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("SUM") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - - PORT_START("IN.5") // O6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_NAME("DRG") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_NAME("INV") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("cos") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("sin") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("tan") - - PORT_START("IN.6") // O7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("EXC") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") - - // note: even though power buttons are on the matrix, they are not CPU-controlled - PORT_START("IN.7") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) -INPUT_PORTS_END - - -static INPUT_PORTS_START( tiprog ) - PORT_START("IN.0") // O0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_NAME("K") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("SHF") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("E") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_NAME("d") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_NAME("F") - - PORT_START("IN.1") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_NAME("OR") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - - PORT_START("IN.2") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("AND") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - - PORT_START("IN.3") // O4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_NAME("1'sC") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_NAME("b") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("A") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("C") - - PORT_START("IN.4") // O5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("XOR") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - - PORT_START("IN.5") // O6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(")") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("SUM") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("(") - - PORT_START("IN.6") // O7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("CE") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") - - // note: even though power buttons are on the matrix, they are not CPU-controlled - PORT_START("IN.7") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_PGUP) PORT_NAME("C/ON") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("DEC") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_NAME("OCT") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_NAME("HEX") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) -INPUT_PORTS_END - - -static INPUT_PORTS_START( tibusan1 ) - // PORT_NAME lists functions under [2nd] as secondaries. - PORT_START("IN.0") // O0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X" " UTF8_POW_X"" UTF8_SQUAREROOT"y") // 2nd one implies xth root of y - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("% " UTF8_CAPITAL_DELTA"%") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_NAME("SEL") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("CST") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_NAME("MAR") - - PORT_START("IN.1") // O1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("STO m") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - - PORT_START("IN.2") // O2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_NAME("RCL b") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - - PORT_START("IN.3") // O4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME(UTF8_CAPITAL_SIGMA"+ " UTF8_CAPITAL_SIGMA"-") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("( AN-CI\"") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("x<>y L.R.") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME(") 1/x") - - PORT_START("IN.4") // O5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("SUM x" UTF8_PRIME) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - - PORT_START("IN.5") // O6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_NAME("FV") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_NAME("N") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_NAME("PMT") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_NAME("%i") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_NAME("PV") - - PORT_START("IN.6") // O7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("EXC x" UTF8_PRIME) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") - - // note: even though power buttons are on the matrix, they are not CPU-controlled - PORT_START("IN.7") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("2nd") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2" " UTF8_SQUAREROOT"x") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x) e" UTF8_POW_X) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) -INPUT_PORTS_END - - -static MACHINE_CONFIG_START( majestic, majestic_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0980, 400000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(majestic_state, read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(majestic_state, write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(majestic_state, write_r)) - MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_ti30) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( tisr16 ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "tms1001nl", 0x0000, 0x0400, CRC(b7ce3c1d) SHA1(95cdb0c6be31043f4fe06314ed41c0ca1337bc46) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1000_sr16_micro.pla", 0, 867, CRC(5b35019c) SHA1(730d3b9041ed76d57fbedd73b009477fe432b386) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1000_sr16_output.pla", 0, 365, CRC(29b08739) SHA1(d55f01e40a2d493d45ea422f12e63b01bcde08fb) ) -ROM_END - - -ROM_START( tisr16ii ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "tms1016nl", 0x0000, 0x0400, CRC(c07a7b27) SHA1(34ea4d3b59871e08db74f8c5bfb7ff00d1f0adc7) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1000_sr16ii_micro.pla", 0, 867, CRC(31b43e95) SHA1(6864e4c20f3affffcd3810dcefbc9484dd781547) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1000_sr16ii_output.pla", 0, 365, CRC(c45dfbd0) SHA1(5d588c1abc317134b51eb08ac3953f1009d80056) ) -ROM_END - - -ROM_START( ti1270 ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "za0355", 0x0000, 0x0400, CRC(48e09b4b) SHA1(17f27167164df223f9f06082ece4c3fc3900eda3) ) - - ROM_REGION( 782, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) - ROM_REGION( 860, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0970_ti1270_micro.pla", 0, 860, CRC(6ff5d51d) SHA1(59d3e5de290ba57694068ddba78d21a0c1edf427) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0970_ti1270_output.pla", 0, 352, CRC(f39bf0a4) SHA1(160341490043eb369720d5f487cf0f59f458a93e) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0970_common2_segment.pla", 0, 157, CRC(56c37a4f) SHA1(18ecc20d2666e89673739056483aed5a261ae927) ) -ROM_END - - -ROM_START( ti1000 ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "tmc1991nl", 0x0000, 0x0400, CRC(2da5381d) SHA1(b5dc14553db2068ed48e130e5ec9109930d8cda9) ) - - ROM_REGION( 782, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) - ROM_REGION( 860, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0970_common1_micro.pla", 0, 860, CRC(7f50ab2e) SHA1(bff3be9af0e322986f6e545b567c97d70e135c93) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0970_ti1000_output.pla", 0, 352, CRC(1d82061a) SHA1(90e4a4b0fb3b4ae5965da90479b7fed737ad8831) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0970_ti1000_segment.pla", 0, 157, CRC(234ca3a8) SHA1(76844dd87cb380a07c8fcbef143038087e98f138) ) -ROM_END - - -ROM_START( wizatron ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "za0379", 0x0000, 0x0400, CRC(5a6af094) SHA1(b1f27e1f13f4db3b052dd50fb08dbf9c4d8db26e) ) - - ROM_REGION( 782, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) - ROM_REGION( 860, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0970_common1_micro.pla", 0, 860, CRC(7f50ab2e) SHA1(bff3be9af0e322986f6e545b567c97d70e135c93) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0970_wizatron_output.pla", 0, 352, CRC(745a3900) SHA1(031b55a0cf783c8a88eec4289d4373eb8538f374) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0970_common2_segment.pla", 0, 157, CRC(56c37a4f) SHA1(18ecc20d2666e89673739056483aed5a261ae927) ) -ROM_END - - -ROM_START( lilprof ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "za0356", 0x0000, 0x0400, CRC(fef9dd39) SHA1(5c9614c9c5092d55dabeee2d6e0387d50d6ad4d5) ) - - ROM_REGION( 782, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) - ROM_REGION( 860, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0970_lilprof_micro.pla", 0, 860, CRC(6ff5d51d) SHA1(59d3e5de290ba57694068ddba78d21a0c1edf427) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0970_lilprof_output.pla", 0, 352, CRC(c74daf97) SHA1(c4948000196171b34d4fe9cdd2962a945da9883d) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0970_common2_segment.pla", 0, 157, CRC(56c37a4f) SHA1(18ecc20d2666e89673739056483aed5a261ae927) ) -ROM_END - -ROM_START( lilprof78 ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "tmc1993nl", 0x0000, 0x0400, CRC(e941316b) SHA1(7e1542045d1e731cea81a639c9ac9e91bb233b15) ) - - ROM_REGION( 782, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0970_common1_instr.pla", 0, 782, CRC(05306ef8) SHA1(60a0a3c49ce330bce0c27f15f81d61461d0432ce) ) - ROM_REGION( 860, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0970_common1_micro.pla", 0, 860, CRC(7f50ab2e) SHA1(bff3be9af0e322986f6e545b567c97d70e135c93) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0970_lilprof78_output.pla", 0, 352, CRC(03f509c4) SHA1(691554a55db0c5950df848077095f23a991b1909) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0970_lilprof78_segment.pla", 0, 157, CRC(234ca3a8) SHA1(76844dd87cb380a07c8fcbef143038087e98f138) ) -ROM_END - - -ROM_START( dataman ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD16_WORD( "tmc1982nl", 0x0000, 0x1000, CRC(3521f53f) SHA1(c46fe7fe20715fdf5aed65833fb867cfd3938062) ) // it matches with source code in patent US4340374 - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2056, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1980_dataman_micro.pla", 0, 2056, CRC(b733b621) SHA1(7897d7db72c0c24555e58738a09ebe0f7f7689b0) ) - ROM_REGION( 525, "maincpu:opla", 0 ) - ROM_LOAD( "tms1980_dataman_output.pla", 0, 525, CRC(5fc6f451) SHA1(11475c785c34eab5b13c5dc67f413c709cd4bd4d) ) -ROM_END - - -ROM_START( ti30 ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD16_WORD( "tmc0981nl", 0x0000, 0x1000, CRC(41298a14) SHA1(06f654c70add4044a612d3a38b0c2831c188fd0c) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 1982, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0980_ti30_output.pla", 0, 352, CRC(38788410) SHA1(cb3d1a61190b887cd2e6d9c60b4fdb9b901f7eed) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) -ROM_END - - -ROM_START( tibusan1 ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD16_WORD( "tmc0982nl", 0x0000, 0x1000, CRC(6954560a) SHA1(6c153a0c9239a811e3514a43d809964c06f8f88e) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 1982, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0980_common1_micro.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0980_tibusan1_output.pla", 0, 352, CRC(38788410) SHA1(cb3d1a61190b887cd2e6d9c60b4fdb9b901f7eed) ) - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) -ROM_END - - -ROM_START( tiprog ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD16_WORD( "za0675nl", 0x0000, 0x1000, CRC(82355854) SHA1(03fab373bce04df8ea3fe25352525e8539213626) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 1982, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0980_tiprog_micro.pla", 0, 1982, CRC(57043284) SHA1(0fa06d5865830ecdb3d870271cb92ac917bed3ca) ) - ROM_REGION( 352, "maincpu:opla", 0 ) - ROM_LOAD( "tms0980_tiprog_output.pla", 0, 352, BAD_DUMP CRC(2a63956f) SHA1(26a62ca2b5973d8564e580e12230292f6d2888d9) ) // corrected by hand - ROM_REGION( 157, "maincpu:spla", 0 ) - ROM_LOAD( "tms0980_common1_segment.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1974, tisr16, 0, 0, tisr16, tisr16, driver_device, 0, "Texas Instruments", "SR-16", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1975, tisr16ii, 0, 0, tisr16, tisr16ii, driver_device, 0, "Texas Instruments", "SR-16 II", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) - -COMP( 1976, ti1270, 0, 0, ti1270, ti1270, driver_device, 0, "Texas Instruments", "TI-1270", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1977, ti1000, 0, 0, ti1000, ti1000, driver_device, 0, "Texas Instruments", "TI-1000", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1977, wizatron, 0, 0, wizatron, wizatron, driver_device, 0, "Texas Instruments", "Wiz-A-Tron", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1976, lilprof, 0, 0, lilprof, lilprof, driver_device, 0, "Texas Instruments", "Little Professor (1976 version)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1978, lilprof78, lilprof, 0, lilprof78, lilprof78, driver_device, 0, "Texas Instruments", "Little Professor (1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) - -COMP( 1977, dataman, 0, 0, dataman, dataman, driver_device, 0, "Texas Instruments", "DataMan", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) - -COMP( 1976, ti30, 0, 0, majestic, ti30, driver_device, 0, "Texas Instruments", "TI-30", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1977, tiprog, 0, 0, majestic, tiprog, driver_device, 0, "Texas Instruments", "TI Programmer", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) -COMP( 1979, tibusan1, 0, 0, majestic, tibusan1, driver_device, 0, "Texas Instruments", "TI Business Analyst-I", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/tiki100.c b/src/mess/drivers/tiki100.c deleted file mode 100644 index d15fa011db3..00000000000 --- a/src/mess/drivers/tiki100.c +++ /dev/null @@ -1,745 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Tiki 100 - - 12/05/2009 Skeleton driver. - - http://www.djupdal.org/tiki/ - -****************************************************************************/ - -/* - - TODO: - - - 3 expansion slots - - palette RAM should be written during HBLANK - - DART clocks - - winchester hard disk - - analog/digital I/O - - light pen - - 8088 CPU card - - 360KB floppy format - -*/ - -#include "includes/tiki100.h" -#include "bus/rs232/rs232.h" - -/* Memory Banking */ - -READ8_MEMBER( tiki100_state::gfxram_r ) -{ - UINT16 addr = (offset + (m_scroll << 7)) & TIKI100_VIDEORAM_MASK; - - return m_video_ram[addr]; -} - -WRITE8_MEMBER( tiki100_state::gfxram_w ) -{ - UINT16 addr = (offset + (m_scroll << 7)) & TIKI100_VIDEORAM_MASK; - - m_video_ram[addr] = data; -} - -void tiki100_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - if (m_vire) - { - if (!m_rome) - { - /* reserved */ - program.unmap_readwrite(0x0000, 0xffff); - } - else - { - /* GFXRAM, GFXRAM, RAM */ - program.install_readwrite_handler(0x0000, 0x7fff, READ8_DELEGATE(tiki100_state, gfxram_r), WRITE8_DELEGATE(tiki100_state, gfxram_w)); - program.install_readwrite_bank(0x8000, 0xffff, "bank3"); - - membank("bank1")->set_entry(BANK_VIDEO_RAM); - membank("bank2")->set_entry(BANK_VIDEO_RAM); - membank("bank3")->set_entry(BANK_RAM); - } - } - else - { - if (!m_rome) - { - /* ROM, RAM, RAM */ - program.install_read_bank(0x0000, 0x3fff, "bank1"); - program.unmap_write(0x0000, 0x3fff); - program.install_readwrite_bank(0x4000, 0x7fff, "bank2"); - program.install_readwrite_bank(0x8000, 0xffff, "bank3"); - - membank("bank1")->set_entry(BANK_ROM); - membank("bank2")->set_entry(BANK_RAM); - membank("bank3")->set_entry(BANK_RAM); - } - else - { - /* RAM, RAM, RAM */ - program.install_readwrite_bank(0x0000, 0x3fff, "bank1"); - program.install_readwrite_bank(0x4000, 0x7fff, "bank2"); - program.install_readwrite_bank(0x8000, 0xffff, "bank3"); - - membank("bank1")->set_entry(BANK_RAM); - membank("bank2")->set_entry(BANK_RAM); - membank("bank3")->set_entry(BANK_RAM); - } - } -} - -/* Read/Write Handlers */ - -READ8_MEMBER( tiki100_state::keyboard_r ) -{ - UINT8 data = 0xff; - - switch (m_keylatch) - { - case 0: data = m_y1->read(); break; - case 1: data = m_y2->read(); break; - case 2: data = m_y3->read(); break; - case 3: data = m_y4->read(); break; - case 4: data = m_y5->read(); break; - case 5: data = m_y6->read(); break; - case 6: data = m_y7->read(); break; - case 7: data = m_y8->read(); break; - case 8: data = m_y9->read(); break; - case 9: data = m_y10->read(); break; - case 10: data = m_y11->read(); break; - case 11: data = m_y12->read(); break; - } - - m_keylatch++; - if (m_keylatch == 12) m_keylatch = 0; - - return data; -} - -WRITE8_MEMBER( tiki100_state::keyboard_w ) -{ - m_keylatch = 0; -} - -WRITE8_MEMBER( tiki100_state::video_mode_w ) -{ - /* - - bit description - - 0 palette entry bit 0 - 1 palette entry bit 1 - 2 palette entry bit 2 - 3 palette entry bit 3 - 4 mode select bit 0 - 5 mode select bit 1 - 6 unused - 7 write color during HBLANK - - */ - - m_mode = data; - - if (BIT(data, 7)) - { - int color = data & 0x0f; - UINT8 colordata = ~m_palette_val; - - m_palette->set_pen_color(color, pal3bit(colordata >> 5), pal3bit(colordata >> 2), pal2bit(colordata >> 0)); - } -} - -WRITE8_MEMBER( tiki100_state::palette_w ) -{ - /* - - bit description - - 0 blue intensity bit 0 - 1 blue intensity bit 1 - 2 green intensity bit 0 - 3 green intensity bit 1 - 4 green intensity bit 2 - 5 red intensity bit 0 - 6 red intensity bit 1 - 7 red intensity bit 2 - - */ - - m_palette_val = data; -} - -WRITE8_MEMBER( tiki100_state::system_w ) -{ - /* - - bit signal description - - 0 DRIS0 drive select 0 - 1 DRIS1 drive select 1 - 2 _ROME enable ROM at 0000-3fff - 3 VIRE enable video RAM at 0000-7fff - 4 SDEN single density select (0=DD, 1=SD) - 5 _LMP0 GRAFIKK key led - 6 MOTON floppy motor - 7 _LMP1 LOCK key led - - */ - - // drive select - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - - // density select - m_fdc->dden_w(BIT(data, 4)); - - // floppy motor - if (floppy) floppy->mon_w(!BIT(data, 6)); - - /* GRAFIKK key led */ - set_led_status(machine(), 1, BIT(data, 5)); - - /* LOCK key led */ - set_led_status(machine(), 2, BIT(data, 7)); - - /* bankswitch */ - m_rome = BIT(data, 2); - m_vire = BIT(data, 3); - - bankswitch(); -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( tiki100_mem, AS_PROGRAM, 8, tiki100_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xffff) AM_RAMBANK("bank3") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tiki100_io, AS_IO, 8, tiki100_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_MIRROR(0x03) AM_READWRITE(keyboard_r, keyboard_w) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(Z80DART_TAG, z80dart_device, cd_ba_r, cd_ba_w) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x03) AM_WRITE(video_mode_w) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(FD1797_TAG, fd1797_t, read, write) - AM_RANGE(0x14, 0x14) AM_MIRROR(0x01) AM_WRITE(palette_w) - AM_RANGE(0x16, 0x16) AM_DEVWRITE(AY8912_TAG, ay8910_device, address_w) - AM_RANGE(0x17, 0x17) AM_DEVREADWRITE(AY8912_TAG, ay8910_device, data_r, data_w) - AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x1c, 0x1c) AM_MIRROR(0x03) AM_WRITE(system_w) -// AM_RANGE(0x20, 0x27) AM_NOP // winchester controller -// AM_RANGE(0x60, 0x6f) analog I/O (SINTEF) -// AM_RANGE(0x60, 0x67) digital I/O (RVO) -// AM_RANGE(0x70, 0x77) analog/digital I/O -// AM_RANGE(0x78, 0x7b) light pen -// AM_RANGE(0x7e, 0x7f) 8088/87 processor w/128KB RAM -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( tiki100 ) -/* - | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | - ----+---------+---------+---------+---------+---------+---------+---------+---------+ - 1 | CTRL | SHIFT | BRYT | RETUR | MLMROM | / (num) | SLETT | | - 2 | GRAFIKK | 1 | ANGRE | a | < | z | q | LOCK | - 3 | 2 | w | s | x | 3 | e | d | c | - 4 | 4 | r | f | v | 5 | t | g | b | - 5 | 6 | y | h | n | 7 | u | j | m | - 6 | 8 | i | k | , | 9 | o | l | . | - 7 | 0 | p | ? | - | + | ? | ? | HJELP | - 8 | @ | ^ | ' | VENSTRE | UTVID | F1 | F4 | SIDEOPP | - 9 | F2 | F3 | F5 | F6 | OPP | SIDENED | VTAB | NED | - 10 | + (num) | - (num) | * (num) | 7 (num) | 8 (num) | 9 (num) | % (num) | = (num) | - 11 | 4 (num) | 5 (num) | 6 (num) | HTAB | 1 (num) | 0 (num) | . (num) | | - 12 | HJEM | H?YRE | 2 (num) | 3 (num) | ENTER | | | | - ----+---------+---------+---------+---------+---------+---------+---------+---------+ -*/ - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BRYTT") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MLMROM") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad /") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SLETT") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAFIKK") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ANGRE") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\xB8 \xC3\x98") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\xA5 \xC3\x85") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\xA6 \xC3\x86") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HJELP") - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('^') PORT_CHAR('|') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\'') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UTVID") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SIDEOPP") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SIDENED") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("VTAB") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("Y10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad %") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") - - PORT_START("Y11") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HTAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) PORT_CHAR('\t') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y12") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HJEM") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -/* Video */ - -UINT32 tiki100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT16 addr = (m_scroll << 7); - int sx, y, pixel, mode = (m_mode >> 4) & 0x03; - - for (y = 0; y < 256; y++) - { - for (sx = 0; sx < 128; sx++) - { - UINT8 data = m_video_ram[addr & TIKI100_VIDEORAM_MASK]; - - switch (mode) - { - case 0: - for (pixel = 0; pixel < 8; pixel++) - { - int x = (sx * 8) + pixel; - - bitmap.pix32(y, x) = palette[0]; - } - break; - - case 1: /* 1024x256x2 */ - for (pixel = 0; pixel < 8; pixel++) - { - int x = (sx * 8) + pixel; - int color = BIT(data, 0); - - bitmap.pix32(y, x) = palette[color]; - - data >>= 1; - } - break; - - case 2: /* 512x256x4 */ - for (pixel = 0; pixel < 4; pixel++) - { - int x = (sx * 8) + (pixel * 2); - int color = data & 0x03; - - bitmap.pix32(y, x) = palette[color]; - bitmap.pix32(y, x + 1) = palette[color]; - - data >>= 2; - } - break; - - case 3: /* 256x256x16 */ - for (pixel = 0; pixel < 2; pixel++) - { - int x = (sx * 8) + (pixel * 4); - int color = data & 0x0f; - - bitmap.pix32(y, x) = palette[color]; - bitmap.pix32(y, x + 1) = palette[color]; - bitmap.pix32(y, x + 2) = palette[color]; - bitmap.pix32(y, x + 3) = palette[color]; - - data >>= 4; - } - break; - } - - addr++; - } - } - - return 0; -} - -/* Z80-PIO Interface */ - -DECLARE_WRITE_LINE_MEMBER( tiki100_state::write_centronics_ack ) -{ - m_centronics_ack = state; -} - -DECLARE_WRITE_LINE_MEMBER( tiki100_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -DECLARE_WRITE_LINE_MEMBER( tiki100_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -READ8_MEMBER( tiki100_state::pio_pb_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 ACK - 5 BUSY - 6 NO PAPER - 7 UNIT SELECT, tape in - - */ - - UINT8 data = 0; - - // centronics - data |= m_centronics_ack << 4; - data |= m_centronics_busy << 5; - data |= m_centronics_perror << 6; - - // cassette - data |= (m_cassette->input() > 0.0) << 7; - - return data; -} - -WRITE8_MEMBER( tiki100_state::pio_pb_w ) -{ - /* - - bit description - - 0 STRB - 1 - 2 - 3 - 4 - 5 - 6 tape out - 7 - - */ - - // centronics - m_centronics->write_strobe(BIT(data, 0)); - - // cassette - m_cassette->output(BIT(data, 6) ? -1 : 1); -} - -/* Z80-CTC Interface */ - -TIMER_DEVICE_CALLBACK_MEMBER(tiki100_state::ctc_tick) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); - - m_ctc->trg1(1); - m_ctc->trg1(0); -} - -WRITE_LINE_MEMBER( tiki100_state::ctc_z0_w ) -{ - m_ctc->trg2(state); - - m_dart->rxca_w(state); - m_dart->txca_w(state); -} - -WRITE_LINE_MEMBER( tiki100_state::ctc_z2_w ) -{ - m_ctc->trg3(state); -} - -/* FD1797 Interface */ - -FLOPPY_FORMATS_MEMBER( tiki100_state::floppy_formats ) - FLOPPY_TIKI100_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( tiki100_floppies ) - SLOT_INTERFACE( "525ssdd", FLOPPY_525_SSDD ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) // Tead FD-55A - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Teac FD-55F -SLOT_INTERFACE_END - -/* AY-3-8912 Interface */ - -WRITE8_MEMBER( tiki100_state::video_scroll_w ) -{ - m_scroll = data; -} - -/* Z80 Daisy Chain */ - -static const z80_daisy_config tiki100_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80DART_TAG }, - { Z80PIO_TAG }, - { NULL } -}; - - - -TIMER_DEVICE_CALLBACK_MEMBER( tiki100_state::tape_tick ) -{ - m_pio->port_b_write((m_cassette->input() > 0.0) << 7); -} - -/* Machine Start */ - -void tiki100_state::machine_start() -{ - /* allocate video RAM */ - m_video_ram.allocate(TIKI100_VIDEORAM_SIZE); - - /* setup memory banking */ - UINT8 *ram = m_ram->pointer(); - - membank("bank1")->configure_entry(BANK_ROM, m_rom->base()); - membank("bank1")->configure_entry(BANK_RAM, ram); - membank("bank1")->configure_entry(BANK_VIDEO_RAM, m_video_ram); - - membank("bank2")->configure_entry(BANK_RAM, ram + 0x4000); - membank("bank2")->configure_entry(BANK_VIDEO_RAM, m_video_ram + 0x4000); - - membank("bank3")->configure_entry(BANK_RAM, ram + 0x8000); - - bankswitch(); - - /* register for state saving */ - save_item(NAME(m_rome)); - save_item(NAME(m_vire)); - save_item(NAME(m_scroll)); - save_item(NAME(m_mode)); - save_item(NAME(m_palette_val)); - save_item(NAME(m_keylatch)); -} - -void tiki100_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - system_w(space, 0, 0); -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( tiki100, tiki100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) - MCFG_CPU_PROGRAM_MAP(tiki100_mem) - MCFG_CPU_IO_MAP(tiki100_io) - MCFG_CPU_CONFIG(tiki100_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(tiki100_state, screen_update) - MCFG_SCREEN_SIZE(1024, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 256-1) - - MCFG_PALETTE_ADD("palette", 16) - // pixel clock 20.01782 MHz - - /* devices */ - MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_8MHz/4, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_8MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) - MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_IN_PB_CB(READ8(tiki100_state, pio_pb_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(tiki100_state, pio_pb_w)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_8MHz/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(tiki100_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(tiki100_state, ctc_z2_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", tiki100_state, ctc_tick, attotime::from_hz(XTAL_8MHz/4)) - - MCFG_FD1797_ADD(FD1797_TAG, XTAL_8MHz/8) // FD1767PL-02 or FD1797-PL - MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":0", tiki100_floppies, "525qd", tiki100_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":1", tiki100_floppies, "525qd", tiki100_state::floppy_formats) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(tiki100_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(tiki100_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(tiki100_state, write_centronics_perror)) - - MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_CASSETTE_ADD(CASSETTE_TAG) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", tiki100_state, tape_tick, attotime::from_hz(44100)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(AY8912_TAG, AY8912, XTAL_8MHz/4) - MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(tiki100_state, video_scroll_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "tiki100") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( kontiki ) - ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF ) - ROM_LOAD( "tikirom-1.30.u10", 0x0000, 0x2000, CRC(c482dcaf) SHA1(d140706bb7fc8b1fbb37180d98921f5bdda73cf9) ) - - ROM_REGION( 0x100, "proms", 0 ) - ROM_LOAD( "63ls140.u4", 0x000, 0x100, NO_DUMP ) -ROM_END - -ROM_START( tiki100 ) - ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS( "v203w" ) - - ROM_SYSTEM_BIOS( 0, "v135", "TIKI ROM v1.35" ) - ROMX_LOAD( "tikirom-1.35.u10", 0x0000, 0x2000, CRC(7dac5ee7) SHA1(14d622fd843833faec346bf5357d7576061f5a3d), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v203w", "TIKI ROM v2.03 W" ) - ROMX_LOAD( "tikirom-2.03w.u10", 0x0000, 0x2000, CRC(79662476) SHA1(96336633ecaf1b2190c36c43295ac9f785d1f83a), ROM_BIOS(2) ) - - ROM_REGION( 0x100, "proms", 0 ) - ROM_LOAD( "63ls140.u4", 0x000, 0x100, NO_DUMP ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, kontiki, 0, 0, tiki100, tiki100, driver_device, 0, "Kontiki Data A/S", "KONTIKI 100", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, tiki100, kontiki, 0, tiki100, tiki100, driver_device, 0, "Tiki Data A/S", "TIKI 100", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/tim011.c b/src/mess/drivers/tim011.c deleted file mode 100644 index 005efa249a2..00000000000 --- a/src/mess/drivers/tim011.c +++ /dev/null @@ -1,165 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - TIM-011 - - 04/09/2010 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z180/z180.h" -#include "machine/upd765.h" - -#define FDC9266_TAG "u43" - -class tim011_state : public driver_device -{ -public: - tim011_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_fdc(*this, FDC9266_TAG), - m_floppy0(*this, FDC9266_TAG ":0:35dd"), - m_floppy1(*this, FDC9266_TAG ":1:35dd"), - m_floppy2(*this, FDC9266_TAG ":2:35dd"), - m_floppy3(*this, FDC9266_TAG ":3:35dd") { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_tim011(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE8_MEMBER(print_w); - DECLARE_WRITE8_MEMBER(scroll_w); - DECLARE_WRITE8_MEMBER(fdc_dma_w); - DECLARE_READ8_MEMBER(print_r); - DECLARE_READ8_MEMBER(scroll_r); - UINT8 m_scroll; - - required_device m_maincpu; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; -}; - - -static ADDRESS_MAP_START(tim011_mem, AS_PROGRAM, 8, tim011_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x01fff) AM_ROM AM_MIRROR(0x3e000) - AM_RANGE(0x40000, 0x7ffff) AM_RAM // 256KB RAM 8 * 41256 DRAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tim011_io, AS_IO, 8, tim011_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x007f) AM_RAM /* Z180 internal registers */ - AM_RANGE(0x0080, 0x009f) AM_DEVICE(FDC9266_TAG, upd765a_device, map) - //AM_RANGE(0x00a0, 0x00a0) AM_MIRROR(0x001f) AM_WRITE(fdc_dma_w) - //AM_RANGE(0x00c0, 0x00c1) AM_MIRROR(0x000e) AM_READWRITE(print_r,print_w) - //AM_RANGE(0x00d0, 0x00d0) AM_MIRROR(0x000f) AM_READWRITE(scroll_r,scroll_w) - AM_RANGE(0x8000, 0xffff) AM_RAM // Video RAM 43256 SRAM (32KB) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( tim011 ) -INPUT_PORTS_END - -void tim011_state::machine_reset() -{ - // motor is actually connected on TXS pin of CPU - m_floppy0->mon_w(0); - m_floppy1->mon_w(0); - m_floppy2->mon_w(0); - m_floppy3->mon_w(0); -} - -void tim011_state::video_start() -{ -} - -UINT32 tim011_state::screen_update_tim011(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -WRITE8_MEMBER(tim011_state::fdc_dma_w) -{ - printf("fdc_dma_w :%02x\n",data); -} - -WRITE8_MEMBER(tim011_state::print_w) -{ - //printf("print_w :%02x\n",data); -} - -READ8_MEMBER(tim011_state::print_r) -{ - //printf("print_r\n"); - return 0; -} - -WRITE8_MEMBER(tim011_state::scroll_w) -{ - m_scroll = data; -} - -READ8_MEMBER(tim011_state::scroll_r) -{ - return m_scroll; -} - -static SLOT_INTERFACE_START( tim011_floppies ) - SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) -SLOT_INTERFACE_END - -static const floppy_format_type tim011_floppy_formats[] = { - FLOPPY_IMD_FORMAT, - FLOPPY_MFI_FORMAT, - FLOPPY_MFM_FORMAT, - NULL -}; - -static MACHINE_CONFIG_START( tim011,tim011_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z180, XTAL_12_288MHz / 2) // location U17 HD64180 - MCFG_CPU_PROGRAM_MAP(tim011_mem) - MCFG_CPU_IO_MAP(tim011_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", tim011_state, irq0_line_hold) - -// MCFG_CPU_ADD("keyboard",CDP1802, XTAL_1_75MHz) // CDP1802, uknown clock - - // FDC9266 location U43 XTAL_8MHz - MCFG_UPD765A_ADD(FDC9266_TAG, true, true) - MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ2)) - - /* floppy drives */ - MCFG_FLOPPY_DRIVE_ADD(FDC9266_TAG ":0", tim011_floppies, "35dd", tim011_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC9266_TAG ":1", tim011_floppies, "35dd", tim011_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC9266_TAG ":2", tim011_floppies, "35dd", tim011_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC9266_TAG ":3", tim011_floppies, "35dd", tim011_floppy_formats) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(tim011_state, screen_update_tim011) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( tim011 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "sys_tim011.u16", 0x0000, 0x2000, CRC(5b4f1300) SHA1(d324991c4292d7dcde8b8d183a57458be8a2be7b)) - ROM_REGION( 0x10000, "keyboard", ROMREGION_ERASEFF ) - ROM_LOAD( "keyb_tim011.bin", 0x0000, 0x1000, CRC(a99c40a6) SHA1(d6d505271d91df4e079ec3c0a4abbe75ae9d649b)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, tim011, 0, 0, tim011, tim011, driver_device, 0, "Mihajlo Pupin Institute", "TIM-011", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/tim100.c b/src/mess/drivers/tim100.c deleted file mode 100644 index 212a2e60f39..00000000000 --- a/src/mess/drivers/tim100.c +++ /dev/null @@ -1,168 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - TIM-100 Terminal - Mihajlo Pupin Institute - - 21/12/2012 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8251.h" -#include "video/i8275.h" - -class tim100_state : public driver_device -{ -public: - tim100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_palette; - virtual void machine_start(); - virtual void machine_reset(); - I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); - -private: - UINT8 *m_charmap; -}; - -static ADDRESS_MAP_START(tim100_mem, AS_PROGRAM, 8, tim100_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_ROM // 2764 at U16 - AM_RANGE(0x2000, 0x27ff) AM_RAM // 2KB static ram CDM6116A at U15 - - AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("i8276", i8275_device, read, write) - - AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE("uart_u17", i8251_device, status_r, control_w) - AM_RANGE(0x6001, 0x6001) AM_DEVREADWRITE("uart_u17", i8251_device, data_r, data_w) - - AM_RANGE(0x8000, 0x8000) AM_DEVREADWRITE("uart_u18", i8251_device, status_r, control_w) - AM_RANGE(0x8001, 0x8001) AM_DEVREADWRITE("uart_u18", i8251_device, data_r, data_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tim100_io, AS_IO, 8, tim100_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( tim100 ) -INPUT_PORTS_END - -static const rgb_t tim100_palette[3] = { - rgb_t(0x00, 0x00, 0x00), // black - rgb_t(0xa0, 0xa0, 0xa0), // white - rgb_t(0xff, 0xff, 0xff) // highlight -}; - -void tim100_state::machine_start() -{ - m_charmap = memregion("chargen")->base(); -} - -void tim100_state::machine_reset() -{ - m_palette->set_pen_colors(0, tim100_palette, ARRAY_LENGTH(tim100_palette)); -} - -const gfx_layout tim100_charlayout = -{ - 12, 16, /* 8x16 characters */ - 256, /* 128 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {0,1,2,3,4,5,0x8000,0x8001,0x8002,0x8003,0x8004,0x8005}, - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, - 8 * 8, 9 * 8, 10 * 8, 11 * 8, 12 * 8, 13 * 8, 14 * 8, 15 * 8}, - 8*16 /* space between characters */ -}; - -static GFXDECODE_START( tim100 ) - GFXDECODE_ENTRY( "chargen", 0x0000, tim100_charlayout, 0, 1 ) -GFXDECODE_END - - -// this gets called via a (i8275_dack_w), so does nothing currently -// once fixed, pixel count needs adjusting -I8275_DRAW_CHARACTER_MEMBER( tim100_state::crtc_display_pixels ) -{ - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 pixels = m_charmap[(linecount & 15) + (charcode << 4)]; - if (vsp) - { - pixels = 0; - } - - if (lten) - { - pixels = 0xff; - } - - if (rvv) - { - pixels ^= 0xff; - } - - for(i=0;i<8;i++) // 6 pixels - { - bitmap.pix32(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; - } -} - -static MACHINE_CONFIG_START( tim100, tim100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8085A, XTAL_4_9152MHz) // divider unknown - MCFG_CPU_PROGRAM_MAP(tim100_mem) - MCFG_CPU_IO_MAP(tim100_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DEVICE("i8276", i8275_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(40*16, 16*16) - MCFG_SCREEN_VISIBLE_AREA(0, 40*16-1, 0, 16*16-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tim100 ) - - MCFG_DEVICE_ADD("i8276", I8275, XTAL_4_9152MHz) - MCFG_I8275_CHARACTER_WIDTH(16) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(tim100_state, crtc_display_pixels) - MCFG_I8275_IRQ_CALLBACK(INPUTLINE("maincpu", I8085_RST65_LINE)) - - MCFG_PALETTE_ADD("palette", 3) - - MCFG_DEVICE_ADD("uart_u17", I8251, 0) - MCFG_DEVICE_ADD("uart_u18", I8251, 0) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( tim100 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "tim 100 v.3.2.0.u16", 0x0000, 0x2000, CRC(4de9c8ad) SHA1(b0914d6e8d618e92a87b4b39c35391541251e8cc)) - - // The first and 2nd halves of these roms are identical, confirmed ok - ROM_REGION( 0x2000, "chargen", ROMREGION_INVERT ) - ROM_SYSTEM_BIOS( 0, "212", "v 2.1.2" ) - ROMX_LOAD( "tim 100kg v.2.1.2.u12", 0x0000, 0x0800, CRC(faf5743c) SHA1(310b662e9535878210f8aaab3e2b846fade60642),ROM_BIOS(1)) - ROM_CONTINUE (0x1000, 0x0800) - ROM_CONTINUE (0x0800, 0x0800) - ROM_CONTINUE (0x1800, 0x0800) - ROM_SYSTEM_BIOS( 1, "220", "v 2.2.0" ) - ROMX_LOAD( "tim 100kg v.2.2.0.u12", 0x0000, 0x0800, CRC(358dbbd3) SHA1(14b7d6ee41b19bedf2f070f5b28b03aaff2cac4f),ROM_BIOS(2)) - ROM_CONTINUE (0x1000, 0x0800) - ROM_CONTINUE (0x0800, 0x0800) - ROM_CONTINUE (0x1800, 0x0800) -ROM_END - -/* Driver */ -COMP( 1985, tim100, 0, 0, tim100, tim100, driver_device, 0, "Mihajlo Pupin Institute", "TIM-100", MACHINE_IS_SKELETON) diff --git a/src/mess/drivers/timex.c b/src/mess/drivers/timex.c deleted file mode 100644 index 806b6887571..00000000000 --- a/src/mess/drivers/timex.c +++ /dev/null @@ -1,781 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/*************************************************************************** - - NOTE: ****** Specbusy: press N, R, or E to boot ************* - - - Spectrum/Inves/TK90X etc. memory map: - - CPU: - 0000-3fff ROM - 4000-ffff RAM - - Spectrum 128/+2/+2a/+3 memory map: - - CPU: - 0000-3fff Banked ROM/RAM (banked rom only on 128/+2) - 4000-7fff Banked RAM - 8000-bfff Banked RAM - c000-ffff Banked RAM - - TS2068 memory map: (Can't have both EXROM and DOCK active) - The 8K EXROM can be loaded into multiple pages. - - CPU: - 0000-1fff ROM / EXROM / DOCK (Cartridge) - 2000-3fff ROM / EXROM / DOCK - 4000-5fff \ - 6000-7fff \ - 8000-9fff |- RAM / EXROM / DOCK - a000-bfff | - c000-dfff / - e000-ffff / - - -Interrupts: - -Changes: - -29/1/2000 KT - Implemented initial +3 emulation. -30/1/2000 KT - Improved input port decoding for reading and therefore - correct keyboard handling for Spectrum and +3. -31/1/2000 KT - Implemented buzzer sound for Spectrum and +3. - Implementation copied from Paul Daniel's Jupiter driver. - Fixed screen display problems with dirty chars. - Added support to load .Z80 snapshots. 48k support so far. -13/2/2000 KT - Added Interface II, Kempston, Fuller and Mikrogen - joystick support. -17/2/2000 DJR - Added full key descriptions and Spectrum+ keys. - Fixed Spectrum +3 keyboard problems. -17/2/2000 KT - Added tape loading from WAV/Changed from DAC to generic - speaker code. -18/2/2000 KT - Added tape saving to WAV. -27/2/2000 KT - Took DJR's changes and added my changes. -27/2/2000 KT - Added disk image support to Spectrum +3 driver. -27/2/2000 KT - Added joystick I/O code to the Spectrum +3 I/O handler. -14/3/2000 DJR - Tape handling dipswitch. -26/3/2000 DJR - Snapshot files are now classifed as snapshots not - cartridges. -04/4/2000 DJR - Spectrum 128 / +2 Support. -13/4/2000 DJR - +4 Support (unofficial 48K hack). -13/4/2000 DJR - +2a Support (rom also used in +3 models). -13/4/2000 DJR - TK90X, TK95 and Inves support (48K clones). -21/4/2000 DJR - TS2068 and TC2048 support (TC2048 Supports extra video - modes but doesn't have bank switching or sound chip). -09/5/2000 DJR - Spectrum +2 (France, Spain), +3 (Spain). -17/5/2000 DJR - Dipswitch to enable/disable disk drives on +3 and clones. -27/6/2000 DJR - Changed 128K/+3 port decoding (sound now works in Zub 128K). -06/8/2000 DJR - Fixed +3 Floppy support -10/2/2001 KT - Re-arranged code and split into each model emulated. - Code is split into 48k, 128k, +3, tc2048 and ts2048 - segments. 128k uses some of the functions in 48k, +3 - uses some functions in 128, and tc2048/ts2048 use some - of the functions in 48k. The code has been arranged so - these functions come in some kind of "override" order, - read functions changed to use READ8_HANDLER and write - functions changed to use WRITE8_HANDLER. - Added Scorpion256 preliminary. -18/6/2001 DJR - Added support for Interface 2 cartridges. -xx/xx/2001 KS - TS-2068 sound fixed. - Added support for DOCK cartridges for TS-2068. - Added Spectrum 48k Psycho modified rom driver. - Added UK-2086 driver. -23/12/2001 KS - 48k machines are now able to run code in screen memory. - Programs which keep their code in screen memory - like monitors, tape copiers, decrunchers, etc. - works now. - Fixed problem with interrupt vector set to 0xffff (much - more 128k games works now). - A useful used trick on the Spectrum is to set - interrupt vector to 0xffff (using the table - which contain 0xff's) and put a byte 0x18 hex, - the opcode for JR, at this address. The first - byte of the ROM is a 0xf3 (DI), so the JR will - jump to 0xfff4, where a long JP to the actual - interrupt routine is put. Due to unideal - bankswitching in MAME this JP were to 0001 what - causes Spectrum to reset. Fixing this problem - made much more software runing (i.e. Paperboy). - Corrected frames per second value for 48k and 128k - Sincalir machines. - There are 50.08 frames per second for Spectrum - 48k what gives 69888 cycles for each frame and - 50.021 for Spectrum 128/+2/+2A/+3 what gives - 70908 cycles for each frame. - Remaped some Spectrum+ keys. - Presing F3 to reset was seting 0xf7 on keyboard - input port. Problem occurred for snapshots of - some programms where it was readed as pressing - key 4 (which is exit in Tapecopy by R. Dannhoefer - for example). - Added support to load .SP snapshots. - Added .BLK tape images support. - .BLK files are identical to .TAP ones, extension - is an only difference. -08/03/2002 KS - #FF port emulation added. - Arkanoid works now, but is not playable due to - completly messed timings. - -Initialisation values used when determining which model is being emulated: - 48K Spectrum doesn't use either port. - 128K/+2 Bank switches with port 7ffd only. - +3/+2a Bank switches with both ports. - -Notes: - 1. No contented memory. - 2. No hi-res colour effects (need contended memory first for accurate timing). - 3. Multiface 1 and Interface 1 not supported. - 4. Horace and the Spiders cartridge doesn't run properly. - 5. Tape images not supported: - .TZX, .SPC, .ITM, .PAN, .TAP(Warajevo), .VOC, .ZXS. - 6. Snapshot images not supported: - .ACH, .PRG, .RAW, .SEM, .SIT, .SNX, .ZX, .ZXS, .ZX82. - 7. 128K emulation is not perfect - the 128K machines crash and hang while - running quite a lot of games. - 8. Disk errors occur on some +3 games. - 9. Video hardware of all machines is timed incorrectly. -10. EXROM and HOME cartridges are not emulated. -11. The TK90X and TK95 roms output 0 to port #df on start up. -12. The purpose of this port is unknown (probably display mode as TS2068) and - thus is not emulated. - -Very detailed infos about the ZX Spectrum +3e can be found at - -http://www.z88forever.org.uk/zxplus3e/ - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "includes/spectrum.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" -#include "sound/ay8910.h" -#include "formats/tzx_cas.h" -#include "machine/spec_snqk.h" -#include "machine/beta.h" -#include "machine/ram.h" - -/****************************************************************************************************/ -/* TS2048 specific functions */ - - -READ8_MEMBER( spectrum_state::ts2068_port_f4_r ) -{ - return m_port_f4_data; -} - -WRITE8_MEMBER( spectrum_state::ts2068_port_f4_w ) -{ - m_port_f4_data = data; - ts2068_update_memory(); -} - -READ8_MEMBER( spectrum_state::ts2068_port_ff_r ) -{ - return m_port_ff_data; -} - -WRITE8_MEMBER( spectrum_state::ts2068_port_ff_w ) -{ - /* Bits 0-2 Video Mode Select - Bits 3-5 64 column mode ink/paper selection - (See ts2068_vh_screenrefresh for more info) - Bit 6 17ms Interrupt Inhibit - Bit 7 Cartridge (0) / EXROM (1) select - */ - m_port_ff_data = data; - ts2068_update_memory(); - logerror("Port %04x write %02x\n", offset, data); -} - -/******************************************************************* - * - * Bank switch between the 3 internal memory banks HOME, EXROM - * and DOCK (Cartridges). The HOME bank contains 16K ROM in the - * 0-16K area and 48K RAM fills the rest. The EXROM contains 8K - * ROM and can appear in every 8K segment (ie 0-8K, 8-16K etc). - * The DOCK is empty and is meant to be occupied by cartridges - * you can plug into the cartridge dock of the 2068. - * - * The address space is divided into 8 8K chunks. Bit 0 of port - * #f4 corresponds to the 0-8K chunk, bit 1 to the 8-16K chunk - * etc. If the bit is 0 then the chunk is controlled by the HOME - * bank. If the bit is 1 then the chunk is controlled by either - * the DOCK or EXROM depending on bit 7 of port #ff. Note this - * means that that the Z80 can't see chunks of the EXROM and DOCK - * at the same time. - * - *******************************************************************/ -void spectrum_state::ts2068_update_memory() -{ - UINT8 *messram = m_ram->pointer(); - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *DOCK = m_dock_crt->base(); - UINT8 *ExROM = memregion("maincpu")->base() + 0x014000; - UINT8 *ChosenROM; - - if (m_port_f4_data & 0x01) - { - if (m_port_ff_data & 0x80) - { - space.install_read_bank(0x0000, 0x1fff, "bank1"); - space.unmap_write(0x0000, 0x1fff); - membank("bank1")->set_base(ExROM); - logerror("0000-1fff EXROM\n"); - } - else - { - if (m_dock_cart_type == TIMEX_CART_DOCK) - { - membank("bank1")->set_base(DOCK); - space.install_read_bank(0x0000, 0x1fff, "bank1"); - if (m_ram_chunks & 0x01) - space.install_write_bank(0x0000, 0x1fff, "bank9"); - else - space.unmap_write(0x0000, 0x1fff); - - - } - else - { - space.nop_read(0x0000, 0x1fff); - space.unmap_write(0x0000, 0x1fff); - } - logerror("0000-1fff Cartridge\n"); - } - } - else - { - ChosenROM = memregion("maincpu")->base() + 0x010000; - membank("bank1")->set_base(ChosenROM); - space.install_read_bank(0x0000, 0x1fff, "bank1"); - space.unmap_write(0x0000, 0x1fff); - logerror("0000-1fff HOME\n"); - } - - if (m_port_f4_data & 0x02) - { - if (m_port_ff_data & 0x80) - { - membank("bank2")->set_base(ExROM); - space.install_read_bank(0x2000, 0x3fff, "bank2"); - space.unmap_write(0x2000, 0x3fff); - logerror("2000-3fff EXROM\n"); - } - else - { - if (m_dock_cart_type == TIMEX_CART_DOCK) - { - membank("bank2")->set_base(DOCK+0x2000); - space.install_read_bank(0x2000, 0x3fff, "bank2"); - if (m_ram_chunks & 0x02) - space.install_write_bank(0x2000, 0x3fff, "bank10"); - else - space.unmap_write(0x2000, 0x3fff); - - } - else - { - space.nop_read(0x2000, 0x3fff); - space.unmap_write(0x2000, 0x3fff); - } - logerror("2000-3fff Cartridge\n"); - } - } - else - { - ChosenROM = memregion("maincpu")->base() + 0x012000; - membank("bank2")->set_base(ChosenROM); - space.install_read_bank(0x2000, 0x3fff, "bank2"); - space.unmap_write(0x2000, 0x3fff); - logerror("2000-3fff HOME\n"); - } - - if (m_port_f4_data & 0x04) - { - if (m_port_ff_data & 0x80) - { - membank("bank3")->set_base(ExROM); - space.install_read_bank(0x4000, 0x5fff, "bank3"); - space.unmap_write(0x4000, 0x5fff); - logerror("4000-5fff EXROM\n"); - } - else - { - if (m_dock_cart_type == TIMEX_CART_DOCK) - { - membank("bank3")->set_base(DOCK+0x4000); - space.install_read_bank(0x4000, 0x5fff, "bank3"); - if (m_ram_chunks & 0x04) - space.install_write_bank(0x4000, 0x5fff, "bank11"); - else - space.unmap_write(0x4000, 0x5fff); - } - else - { - space.nop_read(0x4000, 0x5fff); - space.unmap_write(0x4000, 0x5fff); - } - logerror("4000-5fff Cartridge\n"); - } - } - else - { - membank("bank3")->set_base(messram); - membank("bank11")->set_base(messram); - space.install_read_bank(0x4000, 0x5fff, "bank3"); - space.install_write_bank(0x4000, 0x5fff, "bank11"); - logerror("4000-5fff RAM\n"); - } - - if (m_port_f4_data & 0x08) - { - if (m_port_ff_data & 0x80) - { - membank("bank4")->set_base(ExROM); - space.install_read_bank(0x6000, 0x7fff, "bank4"); - space.unmap_write(0x6000, 0x7fff); - logerror("6000-7fff EXROM\n"); - } - else - { - if (m_dock_cart_type == TIMEX_CART_DOCK) - { - membank("bank4")->set_base(DOCK+0x6000); - space.install_read_bank(0x6000, 0x7fff, "bank4"); - if (m_ram_chunks & 0x08) - space.install_write_bank(0x6000, 0x7fff, "bank12"); - else - space.unmap_write(0x6000, 0x7fff); - } - else - { - space.nop_read(0x6000, 0x7fff); - space.unmap_write(0x6000, 0x7fff); - } - logerror("6000-7fff Cartridge\n"); - } - } - else - { - membank("bank4")->set_base(messram + 0x2000); - membank("bank12")->set_base(messram + 0x2000); - space.install_read_bank(0x6000, 0x7fff, "bank4"); - space.install_write_bank(0x6000, 0x7fff, "bank12"); - logerror("6000-7fff RAM\n"); - } - - if (m_port_f4_data & 0x10) - { - if (m_port_ff_data & 0x80) - { - membank("bank5")->set_base(ExROM); - space.install_read_bank(0x8000, 0x9fff, "bank5"); - space.unmap_write(0x8000, 0x9fff); - logerror("8000-9fff EXROM\n"); - } - else - { - if (m_dock_cart_type == TIMEX_CART_DOCK) - { - membank("bank5")->set_base(DOCK+0x8000); - space.install_read_bank(0x8000, 0x9fff,"bank5"); - if (m_ram_chunks & 0x10) - space.install_write_bank(0x8000, 0x9fff,"bank13"); - else - space.unmap_write(0x8000, 0x9fff); - } - else - { - space.nop_read(0x8000, 0x9fff); - space.unmap_write(0x8000, 0x9fff); - } - logerror("8000-9fff Cartridge\n"); - } - } - else - { - membank("bank5")->set_base(messram + 0x4000); - membank("bank13")->set_base(messram + 0x4000); - space.install_read_bank(0x8000, 0x9fff,"bank5"); - space.install_write_bank(0x8000, 0x9fff,"bank13"); - logerror("8000-9fff RAM\n"); - } - - if (m_port_f4_data & 0x20) - { - if (m_port_ff_data & 0x80) - { - membank("bank6")->set_base(ExROM); - space.install_read_bank(0xa000, 0xbfff, "bank6"); - space.unmap_write(0xa000, 0xbfff); - logerror("a000-bfff EXROM\n"); - } - else - { - if (m_dock_cart_type == TIMEX_CART_DOCK) - { - membank("bank6")->set_base(DOCK+0xa000); - space.install_read_bank(0xa000, 0xbfff, "bank6"); - if (m_ram_chunks & 0x20) - space.install_write_bank(0xa000, 0xbfff, "bank14"); - else - space.unmap_write(0xa000, 0xbfff); - - } - else - { - space.nop_read(0xa000, 0xbfff); - space.unmap_write(0xa000, 0xbfff); - } - logerror("a000-bfff Cartridge\n"); - } - } - else - { - membank("bank6")->set_base(messram + 0x6000); - membank("bank14")->set_base(messram + 0x6000); - space.install_read_bank(0xa000, 0xbfff, "bank6"); - space.install_write_bank(0xa000, 0xbfff, "bank14"); - logerror("a000-bfff RAM\n"); - } - - if (m_port_f4_data & 0x40) - { - if (m_port_ff_data & 0x80) - { - membank("bank7")->set_base(ExROM); - space.install_read_bank(0xc000, 0xdfff, "bank7"); - space.unmap_write(0xc000, 0xdfff); - logerror("c000-dfff EXROM\n"); - } - else - { - if (m_dock_cart_type == TIMEX_CART_DOCK) - { - membank("bank7")->set_base(DOCK+0xc000); - space.install_read_bank(0xc000, 0xdfff, "bank7"); - if (m_ram_chunks & 0x40) - space.install_write_bank(0xc000, 0xdfff, "bank15"); - else - space.unmap_write(0xc000, 0xdfff); - } - else - { - space.nop_read(0xc000, 0xdfff); - space.unmap_write(0xc000, 0xdfff); - } - logerror("c000-dfff Cartridge\n"); - } - } - else - { - membank("bank7")->set_base(messram + 0x8000); - membank("bank15")->set_base(messram + 0x8000); - space.install_read_bank(0xc000, 0xdfff, "bank7"); - space.install_write_bank(0xc000, 0xdfff, "bank15"); - logerror("c000-dfff RAM\n"); - } - - if (m_port_f4_data & 0x80) - { - if (m_port_ff_data & 0x80) - { - membank("bank8")->set_base(ExROM); - space.install_read_bank(0xe000, 0xffff, "bank8"); - space.unmap_write(0xe000, 0xffff); - logerror("e000-ffff EXROM\n"); - } - else - { - if (m_dock_cart_type == TIMEX_CART_DOCK) - { - membank("bank8")->set_base(DOCK+0xe000); - space.install_read_bank(0xe000, 0xffff, "bank8"); - if (m_ram_chunks & 0x80) - space.install_write_bank(0xe000, 0xffff, "bank16"); - else - space.unmap_write(0xe000, 0xffff); - } - else - { - space.nop_read(0xe000, 0xffff); - space.unmap_write(0xe000, 0xffff); - } - logerror("e000-ffff Cartridge\n"); - } - } - else - { - membank("bank8")->set_base(messram + 0xa000); - membank("bank16")->set_base(messram + 0xa000); - space.install_read_bank(0xe000, 0xffff, "bank8"); - space.install_write_bank(0xe000, 0xffff, "bank16"); - logerror("e000-ffff RAM\n"); - } -} - -static ADDRESS_MAP_START(ts2068_io, AS_IO, 8, spectrum_state ) - AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r ) AM_MIRROR(0xff00) - AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r ) AM_MIRROR(0xff00) - AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r ) AM_MIRROR(0xff00) - AM_RANGE(0xf4, 0xf4) AM_READWRITE(ts2068_port_f4_r,ts2068_port_f4_w ) AM_MIRROR(0xff00) - AM_RANGE(0xf5, 0xf5) AM_DEVWRITE("ay8912", ay8910_device, address_w ) AM_MIRROR(0xff00) - AM_RANGE(0xf6, 0xf6) AM_DEVREADWRITE("ay8912", ay8910_device, data_r, data_w ) AM_MIRROR(0xff00) - AM_RANGE(0xfe, 0xfe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w ) AM_MIRROR(0xff00) AM_MASK(0xffff) - AM_RANGE(0xff, 0xff) AM_READWRITE(ts2068_port_ff_r,ts2068_port_ff_w ) AM_MIRROR(0xff00) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ts2068_mem, AS_PROGRAM, 8, spectrum_state ) - AM_RANGE(0x0000, 0x1fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank9") - AM_RANGE(0x2000, 0x3fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank10") - AM_RANGE(0x4000, 0x5fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank11") - AM_RANGE(0x6000, 0x7fff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank12") - AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank13") - AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank14") - AM_RANGE(0xc000, 0xdfff) AM_READ_BANK("bank7") AM_WRITE_BANK("bank15") - AM_RANGE(0xe000, 0xffff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank16") -ADDRESS_MAP_END - - -MACHINE_RESET_MEMBER(spectrum_state,ts2068) -{ - m_port_ff_data = 0; - m_port_f4_data = 0; - - std::string region_tag; - m_dock_crt = memregion(region_tag.assign(m_dock->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - m_dock_cart_type = m_dock_crt ? TIMEX_CART_DOCK : TIMEX_CART_NONE; - - ts2068_update_memory(); - MACHINE_RESET_CALL_MEMBER(spectrum); -} - - -/****************************************************************************************************/ -/* TC2048 specific functions */ - - -WRITE8_MEMBER( spectrum_state::tc2048_port_ff_w ) -{ - m_port_ff_data = data; - logerror("Port %04x write %02x\n", offset, data); -} - -static ADDRESS_MAP_START(tc2048_io, AS_IO, 8, spectrum_state ) - AM_RANGE(0x00, 0x00) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) - AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) - AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) - AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) - AM_RANGE(0xff, 0xff) AM_READWRITE(ts2068_port_ff_r,tc2048_port_ff_w) AM_MIRROR(0xff00) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tc2048_mem, AS_PROGRAM, 8, spectrum_state ) - AM_RANGE( 0x0000, 0x3fff) AM_ROM - AM_RANGE( 0x4000, 0xffff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") -ADDRESS_MAP_END - -MACHINE_RESET_MEMBER(spectrum_state,tc2048) -{ - UINT8 *messram = m_ram->pointer(); - - membank("bank1")->set_base(messram); - membank("bank2")->set_base(messram); - m_port_ff_data = 0; - m_port_f4_data = -1; - MACHINE_RESET_CALL_MEMBER(spectrum); -} - - -DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart ) -{ - UINT32 size = m_dock->common_get_size("rom"); - - if (image.software_entry() == NULL) - { - UINT8 *DOCK; - int chunks_in_file = 0; - dynamic_buffer header; - header.resize(9); - - if (size % 0x2000 != 9) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted"); - return IMAGE_INIT_FAIL; - } - if (image.software_entry() != NULL) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Loading from softlist is not supported yet"); - return IMAGE_INIT_FAIL; - } - - m_dock->rom_alloc(0x10000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - DOCK = m_dock->get_rom_base(); - - // check header - image.fread(&header[0], 9); - - for (int i = 0; i < 8; i++) - if (header[i + 1] & 0x02) chunks_in_file++; - - if (chunks_in_file * 0x2000 + 0x09 != size) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted"); - return IMAGE_INIT_FAIL; - } - - switch (header[0]) - { - case 0x00: logerror ("DOCK cart\n"); - m_ram_chunks = 0; - for (int i = 0; i < 8; i++) - { - m_ram_chunks = m_ram_chunks | ((header[i + 1] & 0x01) << i); - if (header[i + 1] & 0x02) - image.fread(DOCK + i * 0x2000, 0x2000); - else - { - if (header[i + 1] & 0x01) - memset(DOCK + i * 0x2000, 0x00, 0x2000); - else - memset(DOCK + i * 0x2000, 0xff, 0x2000); - } - } - break; - - default: - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cart type not supported"); - return IMAGE_INIT_FAIL; - } - - logerror ("Cart loaded [Chunks %02x]\n", m_ram_chunks); - } - else - { - m_dock->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - memcpy(m_dock->get_rom_base(), image.get_software_region("rom"), size); - } - - return IMAGE_INIT_PASS; -} - - -/* F4 Character Displayer - tc2048 code is inherited from the spectrum */ -static const gfx_layout ts2068_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 96, /* 96 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( ts2068 ) - GFXDECODE_ENTRY( "maincpu", 0x13d00, ts2068_charlayout, 0, 8 ) -GFXDECODE_END - -static MACHINE_CONFIG_DERIVED( ts2068, spectrum_128 ) - MCFG_CPU_REPLACE("maincpu", Z80, XTAL_14_112MHz/4) /* From Schematic; 3.528 MHz */ - MCFG_CPU_PROGRAM_MAP(ts2068_mem) - MCFG_CPU_IO_MAP(ts2068_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", spectrum_state, spec_interrupt) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, ts2068 ) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(TS2068_SCREEN_WIDTH, TS2068_SCREEN_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, TS2068_SCREEN_WIDTH-1, 0, TS2068_SCREEN_HEIGHT-1) - MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_ts2068) - MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_timex) - - MCFG_GFXDECODE_MODIFY("gfxdecode", ts2068) - - MCFG_VIDEO_START_OVERRIDE(spectrum_state, ts2068 ) - - /* sound */ - MCFG_SOUND_REPLACE("ay8912", AY8912, XTAL_14_112MHz/8) /* From Schematic; 1.764 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* cartridge */ - MCFG_DEVICE_REMOVE("cartslot") - MCFG_GENERIC_CARTSLOT_ADD("dockslot", generic_plain_slot, "timex_cart") - MCFG_GENERIC_EXTENSIONS("dck,bin") - MCFG_GENERIC_LOAD(spectrum_state, timex_cart) - - /* Software lists */ - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list", "timex_dock") - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( uk2086, ts2068 ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(50) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( tc2048, spectrum ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(tc2048_mem) - MCFG_CPU_IO_MAP(tc2048_io) - - MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, tc2048 ) - - /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(TS2068_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, TS2068_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1) - MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_tc2048) - MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_timex) - - MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum_128 ) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("48K") -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(tc2048) - ROM_REGION(0x10000,"maincpu",0) - ROM_LOAD("tc2048.rom",0x0000,0x4000, CRC(f1b5fa67) SHA1(febb2d495b6eda7cdcb4074935d6e9d9f328972d)) -ROM_END - -ROM_START(ts2068) - ROM_REGION(0x16000,"maincpu",0) - ROM_LOAD("ts2068_h.rom",0x10000,0x4000, CRC(bf44ec3f) SHA1(1446cb2780a9dedf640404a639fa3ae518b2d8aa)) - ROM_LOAD("ts2068_x.rom",0x14000,0x2000, CRC(ae16233a) SHA1(7e265a2c1f621ed365ea23bdcafdedbc79c1299c)) -ROM_END - -ROM_START(uk2086) - ROM_REGION(0x16000,"maincpu",0) - ROM_LOAD("uk2086_h.rom",0x10000,0x4000, CRC(5ddc0ca2) SHA1(1d525fe5cdc82ab46767f665ad735eb5363f1f51)) - ROM_LOAD("ts2068_x.rom",0x14000,0x2000, CRC(ae16233a) SHA1(7e265a2c1f621ed365ea23bdcafdedbc79c1299c)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1984, tc2048, spectrum, 0, tc2048, spectrum, driver_device, 0, "Timex of Portugal", "TC-2048" , 0) -COMP( 1983, ts2068, spectrum, 0, ts2068, spectrum, driver_device, 0, "Timex Sinclair", "TS-2068" , 0) -COMP( 1986, uk2086, spectrum, 0, uk2086, spectrum, driver_device, 0, "Unipolbrit", "UK-2086 ver. 1.2" , 0) diff --git a/src/mess/drivers/tispeak.c b/src/mess/drivers/tispeak.c deleted file mode 100644 index 2e66df4a007..00000000000 --- a/src/mess/drivers/tispeak.c +++ /dev/null @@ -1,1339 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Jonathan Gevaryahu, Sean Riddle -/*************************************************************************** - - ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** - - Texas Instruments 1st-gen. handheld speech devices. - - These devices, mostly edu-toys, are based around an MCU(TMS0270/TMS1100), - TMS51xx speech, and VSM ROM(s). Newer devices, such as Speak & Music, - are based around the TMP50C40 and belong in another driver, probably. - - note: except for tntell, MAME external artwork is not required. But it - is objectively a large improvement. - ----------------------------------------------------------------------------- - -Known devices on this hardware: (* denotes not dumped, ** denotes pending dump) - - -ROM (and/or source) code obtained from patents: -Some of these may have pre-release bugs. - - Speak & Spell: US4189779 - Speak & Math: US4946391 - Touch & Tell: US4403965, EP0048835A2 (patent calls it "Speak & Seek") - Language Translator: US4631748 - - -Speak & Spell: - -This is the original Speak & Spell. TI had done educational toys before, like -Wiz-A-Tron or Little Professor. But the popularity of this product was much -above expectations. TI continued to manufacture many products for this line. - - Speak & Spell (US), 1978 - - MCU: TMC0271* - - TMS51xx: TMC0281 - - VSM(1/2): 16KB TMC0351NL - - VSM(2/2): 16KB TMC0352NL - - VFD: NEC FIP8A5AR no. 3A - - notes: keyboard has buttons instead of cheap membrane - - Speak & Spell (US), 1979 - - MCU: TMC0271* (different from 1978 version) - - TMS51xx: TMC0281 - - VSM(1/2): 16KB TMC0351N2L - - VSM(2/2): 16KB TMC0352N2L - - notes: fixed a funny bug with gibberish-talk when Module button is pressed - with no module inserted - - Speak & Spell (US), 1980 - - MCU: same as 1979 version - - TMS51xx: TMC0281D - - VSM: 16KB CD2350(rev.A) - - notes: only 1 VSM, meaning much smaller internal vocabulary - - Speak & Spell (Japan), 1980 - - MCU: TMC0271* (assume same as US 1978 or 1979 version) - - TMS51xx: TMC0281 - - VSM(1/2): 16KB CD2321 - - VSM(2/2): 16KB CD2322 - - notes: no local name for the product, words are in English but very low difficulty - - Speak & Spell (UK), 1978 - - MCU: TMC0271* (assume same as US 1978 version) - - TMS51xx: TMC0281 - - VSM(1/2): 16KB CD2303 - - VSM(2/2): 16KB CD2304 - - notes: voice data was manually altered to give it a UK accent, - here's a small anecdote from developer: - "(...) I cannot bear to listen the product even now. I remember the - word 'butcher' took 3 days - I still don't know if it sounds right." - - Speak & Spell (UK), 1981 - - MCU: TMC0271* (assume same as US 1979 version) - - TMS51xx: CD2801 - - VSM: 16KB CD62175 - - VFD: same as Speak & Math(!) - - notes: this one has a dedicated voice actor - - Speak & Spell (France) "La Dictee Magique", 1980 - - MCU: CD2702** - - TMS51xx: CD2801 - - VSM: 16KB CD2352 - - Speak & Spell (Germany) "Buddy", 1980 - - MCU & TMS51xx: same as French 1980 version - - VSM(1/2): 16KB CD2345* - - VSM(2/2): 16KB CD2346* - - Speak & Spell (Italy) "Grillo Parlante", 1982 - - MCU & TMS51xx: same as French 1980 version - - VSM: 16KB CD62190 - - VFD: same as Speak & Math - - notes: it appears that TI ran out of original snspell VFDs in the early 80s? - - Speak & Spell Compact (US), 1981 - - MCU: CD8011** - - TMS51xx: TMC0281D - - VSM: 16KB CD2354, CD2354(rev.A) - - notes: no display, MCU is TMS1100 instead of TMS0270, overall similar to Touch & Tell - - Speak & Spell Compact (UK) "Speak & Write", 1981 - - MCU & TMS51xx: same as US 1981 version - - VSM: 16KB CD62174(rev.A) - - notes: anecdotes from the developer, the same person working on the original UK version: - "We included a pencil and writing pad - it was now about 'writing'.", - and one about the welcome message: - "I had to manually create a sentence of digital speech from thin air. - I had to write down a 20 character code which would create each 10/s - sound bite that made up the phrase "Welcome to Speak and Write". - It took me 1 week. (...) Even Larry Brantingham was amazed." - -Speak & Spell modules: -Note that they are interchangeable, eg. you can use a French module on a US Speak & Spell. - - English: - - Vowel Power: VSM: 16KB CD2302 - - Number Stumpers 4-6: VSM: 16KB CD2305 - - Number Stumpers 7-8: VSM: 16KB CD2307(rev.A) - - Basic Builders: VSM: 16KB CD2308 - - Mighty Verbs: VSM: 16KB CD2309(rev.B) - - Homonym Heroes: VSM: 16KB CD2310 - - Vowel Ventures: VSM: 16KB CD2347(rev.C) - - Noun Endings: VSM: 16KB CD2348 - - Magnificent Modifiers: VSM: 16KB CD2349 - - E.T. Fantasy: VSM: 16KB CD2360 - - French: - - No.1: Les Mots de Base: VSM: 16KB CD2353 (1st release was called "Module No. 1 de Jacques Capelovici") - - No.2: Les Mots Difficilies: VSM: 16KB? CD62177* - - No.3: Les Animaux Familiers: VSM: 16KB? CD62047* - - No.4: Les Magasins De La Rue: VSM: 16KB CD62048 - - No.5: Les Extra-Terrestres: VSM: 16KB? CD62178* - - Italian: - - Super Modulo: VSM: 16KB? CD62313* - - -Speak & Math: - - Speak & Math (US), 1980 (renamed to "Speak & Maths" in UK, but is the same product) - - MCU: CD2704* - - TMS51xx: CD2801 - - VSM(1/2): 16KB CD2392 - - VSM(2/2): 16KB CD2393 - - VFD: Futaba 9SY -02Z 7E - - notes: As with the Speak & Spell, the voice actor was a radio announcer. - However, the phrase "is greater than or less than" had to be added in a - hurry by one of the TI employees in a hurry, the day before a demo. - Apparently QA never found out and it ended up in the final product. - - Speak & Math (US), 1986 - - MCU: CD2708, labeled CD2708N2L (die labeled TMC0270F 2708A) - - TMS51xx: CD2801 - - VSM(1/2): 16KB CD2381 - - VSM(2/2): 4KB CD2614 - - Speak & Math 'Compact' (France) "Les Maths Magiques", 1986? - - MCU: CP3447-NL* (TMS1100?) - - TMS51xx: CD2801 - - VSM: 16KB? CD62173* - - notes: this is not the same as "Le Calcul Magique", that's from a - series centered around a TMS50C40 instead of MCU+TMS51xx - - -Speak & Read: - - Speak & Read (US), 1980 - - MCU: CD2705, labeled CD2705B-N2L (die labeled TMC0270E 2705B) - 2nd revision? - - TMS51xx: CD2801 - - VSM(1/2): 16KB CD2394(rev.A) - - VSM(2/2): 16KB CD2395(rev.A) - - VFD: same as Language Tutor, rightmost digit unused - -Speak & Read modules: - - English: - - Sea Sights: VSM: 16KB CD2396(rev.A) - - Who's Who at the Zoo: VSM: 16KB CD2397 - - A Dog on a Log: VSM: 16KB CD3534(rev.A) - - The Seal That Could Fly: VSM: 16KB CD3535 - - A Ghost in the House: VSM: 16KB CD3536* - - On the Track: VSM: 16KB CD3538 - - The Third Circle: VSM: 16KB CD3539* - - The Millionth Knight: VSM: 16KB CD3540 - - -Touch & Tell: - - Touch & Tell (US), 1981 - - MCU: CD8012 - - TMS51xx: CD2802 - - VSM: 4KB CD2610 - - notes: MCU is TMS1100 instead of TMS0270. CD8010 is seen in some devices - too, maybe an earlier version? - - Touch & Tell (UK), 1981 - - MCU & TMS51xx: same as US version - - VSM: 16KB CD62170 - - Touch & Tell (France) "Le Livre Magique", 1981 - - MCU & TMS51xx: same as US version - - VSM: 16KB CD62171 - - Touch & Tell (Germany) "Tipp & Sprich", 1981 - - MCU & TMS51xx: same as US version - - VSM: ?KB CD62172* - - Touch & Tell (Italy) "Libro Parlante", 1982 - - MCU & TMS51xx: same as US version - - VSM: ?KB CD62176* - - Vocaid (US), 1982 - - MCU & TMS51xx: same as Touch & Tell (US) - - VSM: 16KB CD2357 - - notes: MCU is the same as in Touch & Tell, but instead of a toddler's toy, - you get a serious medical aid device for the voice-impaired. The PCB is - identical, it includes the edge connector for modules but no external slot. - -Touch & Tell modules: - - English: - - Alphabet Fun: VSM: 4KB CD2611 - - Animal Friends: VSM: 16KB CD2355 - - Number Fun: VSM: 4KB CD2612*, CD2612(rev.A) - - All About Me: VSM: 4KB CD2613 - - World of Transportation: VSM: 16KB CD2361 - - Little Creatures: VSM: 16KB CD2362 - - E.T.: VSM: 16KB CD2363 - -Touch & Tell/Vocaid overlay reference: - - tntell CD2610: - - 04: a - Colors - - 01: b - Objects - - 05: c - Shapes - - 09: d - Home Scene - tntelluk CD62170, tntellfr CD62171: - - see tntell - - see numfun(not A) - - see animalfr - - 08: ? - Clown Face - - 0B: ? - Body Parts - vocaid CD2357: - - 1C: 1 - Leisure - - 1E: 2 - Telephone - - 1B: 3 - Bedside - - 1D: 4 - Alphabet - alphabet CD2611: - - 0E: 1a - Alphabet A-M - - 0D: 1b - Alphabet N-Z - - 0C: 1c - Letter Jumble A-M - - 0B: 1d - Letter Jumble N-Z - animalfr CD2355: - - 0A: 2a - Farm Animals - - 0F: 2b - At The Farm - - 0E: 2c - Animal Babies - - 0D: 2d - In The Jungle - numfun CD2612: - - 02/0A(rev.A): 3a - Numbers 1-10 - - 03/0F(rev.A): 3b - Numbers 11-30 - - 07/0D(rev.A): 3c - How Many? - - 06/0E(rev.A): 3d - Hidden Numbers - aboutme CD2613: - - 0E: 4a - Clown Face - - 0B: 4b - Body Parts - - 0D: 4c - Things to Wear - - 0C: 4d - Just For Me - wot CD2361: - - 0A: 5a - On Land - - 0B: 5b - In The Air - - 0C: 5c - On The Water - - 0D: 5d - In Space - - 10: 5e - What Belongs Here? - - 11: 5f - How It Used To Be - - 12: 5g - Word Fun - - 13: 5h - In the Surprise Garage - lilcreat CD2362: - - 14: 6a - In The Park - - 15: 6b - In The Sea - - 16: 6c - In The Woods - - 17: 6d - Whose House? - - 18: 6e - Hide & Seek - - 1A: 6f - Who Is It? - - 19: 6g - But It's Not - - 1B: 6h - Word Fun - et CD2363: - - 0F: 7a - The Adventure On Earth I - - 10: 7b - The Adventure On Earth II - - 11: 7c - Fun And Friendship I - - 12: 7d - Fun And Friendship II - - 13: 7e - E.T. The Star I - - 14: 7f - E.T. The Star II - - 15: 7g - Do You Remember? I - - 16: 7h - Do You Remember? II - - -Language Tutor/Translator: - -A later device, called Language Teacher, was released without speech hardware. - - Language Tutor (US), 1978 - - MCU: TMC0275* - - TMS51xx: CD2801 - - VFD: NEC FIP10xxx? - - notes: external module is required (see below) - -Language Tutor modules: - - - Ingles(1/4): VSM: 16KB CD2311 - - Ingles(2/4): VSM: 16KB CD2312 - - Ingles(3/4): VSM: 16KB CD2313 - - Ingles(4/4): VSM: 16KB CD2314 - - - Spanish(1/4): VSM: 16KB CD2315 - - Spanish(2/4): VSM: 16KB CD2316 - - Spanish(3/4): VSM: 16KB CD2317 - - Spanish(4/4): VSM: 16KB CD2318 - - - French(1/4): VSM: 16KB CD2327 - - French(2/4): VSM: 16KB CD2328 - - French(3/4): VSM: 16KB CD2329 - - French(4/4): VSM: 16KB CD2330 - - - German(1/4): VSM: 16KB CD2331 - - German(2/4): VSM: 16KB CD2332 - - German(3/4): VSM: 16KB CD2333 - - German(4/4): VSM: 16KB CD2334 - - - English(1/4): VSM: 16KB CD3526 - - English(2/4): VSM: 16KB CD3527 - - English(3/4): VSM: 16KB CD3528 - - English(4/4): VSM: 16KB CD3529 - - ----------------------------------------------------------------------------- - - TODO: - - why doesn't lantutor work? - - emulate other known devices - - -***************************************************************************/ - -#include "includes/hh_tms1k.h" -#include "sound/tms5110.h" -#include "machine/tms6100.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -// internal artwork -#include "lantutor.lh" -#include "snmath.lh" -#include "snspell.lh" -#include "tntell.lh" // keyboard overlay - -// The master clock is a single stage RC oscillator into TMS5100 RCOSC: -// In an early 1979 Speak & Spell, C is 68pf, R is a 50kohm trimpot which is set to around 33.6kohm -// (measured in-circuit). CPUCLK is this osc freq /2, ROMCLK is this osc freq /4. -// The typical osc freq curve for TMS5100 is unknown. Let's assume it is set to the default frequency, -// which is 640kHz for 8KHz according to the TMS5100 documentation. - -#define MASTER_CLOCK (640000) - - -class tispeak_state : public hh_tms1k_state -{ -public: - tispeak_state(const machine_config &mconfig, device_type type, const char *tag) - : hh_tms1k_state(mconfig, type, tag), - m_tms5100(*this, "tms5100"), - m_tms6100(*this, "tms6100"), - m_cart(*this, "cartslot") - { } - - // devices - required_device m_tms5100; - required_device m_tms6100; - optional_device m_cart; - - DECLARE_INPUT_CHANGED_MEMBER(snspell_power_button); - void snspell_power_off(); - void prepare_display(); - - DECLARE_READ8_MEMBER(snspell_read_k); - DECLARE_WRITE16_MEMBER(snmath_write_o); - DECLARE_WRITE16_MEMBER(snspell_write_o); - DECLARE_WRITE16_MEMBER(snspell_write_r); - DECLARE_WRITE16_MEMBER(lantutor_write_r); - - DECLARE_READ8_MEMBER(tntell_read_k); - DECLARE_WRITE16_MEMBER(tntell_write_o); - DECLARE_WRITE16_MEMBER(tntell_write_r); - - // cartridge - UINT32 m_cart_max_size; - UINT8* m_cart_base; - void init_cartridge(); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(tispeak_cartridge); - DECLARE_DRIVER_INIT(snspell); - DECLARE_DRIVER_INIT(tntell); - DECLARE_DRIVER_INIT(lantutor); - - UINT8 m_overlay; - TIMER_DEVICE_CALLBACK_MEMBER(tntell_get_overlay); - -protected: - virtual void machine_start(); -}; - - -void tispeak_state::machine_start() -{ - hh_tms1k_state::machine_start(); - memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! - - init_cartridge(); -} - - - -/*************************************************************************** - - Cartridge Handling - -***************************************************************************/ - -void tispeak_state::init_cartridge() -{ - m_overlay = 0; - - if (m_cart != NULL && m_cart->exists()) - { - std::string region_tag; - memory_region *src = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - if (src) - memcpy(m_cart_base, src->base(), src->bytes()); - } -} - -DEVICE_IMAGE_LOAD_MEMBER(tispeak_state, tispeak_cartridge) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size > m_cart_max_size) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - -DRIVER_INIT_MEMBER(tispeak_state, snspell) -{ - m_cart_max_size = 0x4000; - m_cart_base = memregion("tms6100")->base() + 0x8000; -} - -DRIVER_INIT_MEMBER(tispeak_state, tntell) -{ - m_cart_max_size = 0x4000; - m_cart_base = memregion("tms6100")->base() + 0x4000; -} - -DRIVER_INIT_MEMBER(tispeak_state, lantutor) -{ - m_cart_max_size = 0x10000; - m_cart_base = memregion("tms6100")->base(); -} - - - -/*************************************************************************** - - I/O - -***************************************************************************/ - -// common/snspell - -void tispeak_state::prepare_display() -{ - UINT16 gridmask = (m_display_decay[15][16] != 0) ? 0xffff : 0x8000; - display_matrix_seg(16+1, 16, m_plate | 0x10000, m_grid & gridmask, 0x3fff); -} - -WRITE16_MEMBER(tispeak_state::snspell_write_r) -{ - // R13: power-off request, on falling edge - if ((m_r >> 13 & 1) && !(data >> 13 & 1)) - snspell_power_off(); - - // R0-R7: input mux and select digit (+R8 if the device has 9 digits) - // R15: filament on - // other bits: MCU internal use - m_r = m_inp_mux = data; - m_grid = data & 0x81ff; - prepare_display(); -} - -WRITE16_MEMBER(tispeak_state::snspell_write_o) -{ - // reorder opla to led14seg, plus DP as d14 and AP as d15: - // note: lantutor and snread VFD has an accent triangle instead of DP, and no AP - // E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK) - m_plate = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5); - prepare_display(); -} - -READ8_MEMBER(tispeak_state::snspell_read_k) -{ - // note: the Vss row is always on - return m_inp_matrix[8]->read() | read_inputs(8); -} - - -void tispeak_state::snspell_power_off() -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_tms5100->reset(); - m_tms6100->reset(); - - m_power_on = false; -} - - -// snmath specific - -WRITE16_MEMBER(tispeak_state::snmath_write_o) -{ - // reorder opla to led14seg, plus DP as d14 and CT as d15: - // [DP],D,C,H,F,B,I,M,L,K,N,J,[CT],E,G,A (sidenote: TI KLMN = MAME MLNK) - m_plate = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15); - prepare_display(); -} - - -// lantutor specific - -WRITE16_MEMBER(tispeak_state::lantutor_write_r) -{ - // same as default, except R13 is used for an extra digit - m_r = m_inp_mux = data; - m_grid = data & 0xa1ff; - prepare_display(); -} - - -// tntell specific - -WRITE16_MEMBER(tispeak_state::tntell_write_r) -{ - // R10: CD2802 PDC pin - m_tms5100->pdc_w(data >> 10); - - // R9: power-off request, on falling edge - if ((m_r >> 9 & 1) && !(data >> 9 & 1)) - snspell_power_off(); - - // R0-R8: input mux - m_r = m_inp_mux = data; -} - -WRITE16_MEMBER(tispeak_state::tntell_write_o) -{ - // O3210: CD2802 CTL8124 - m_o = BITSWAP8(data,7,6,5,4,3,0,1,2); - m_tms5100->ctl_w(space, 0, m_o & 0xf); -} - -READ8_MEMBER(tispeak_state::tntell_read_k) -{ - // multiplexed inputs (and K2 from on-button) - UINT8 k = m_inp_matrix[9]->read() | read_inputs(9); - - // K4: CD2802 CTL1 - if (m_tms5100->ctl_r(space, 0) & 1) - k |= 4; - - // K8: overlay code from R5,O4-O7 - if (((m_r >> 1 & 0x10) | (m_o >> 4 & 0xf)) & m_overlay) - k |= 8; - - return k; -} - -TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::tntell_get_overlay) -{ - // Each keyboard overlay insert has 5 holes, used by the game to determine - // which one is active(if any). If it matches with the internal ROM or - // external module, the game continues. - // 00 for none, 1F for diagnostics, see comment section above for a list - - // try to get overlay code from artwork file(in decimal), otherwise pick the - // one that was selected in machine configuration - m_overlay = output_get_value("overlay_code") & 0x1f; - if (m_overlay == 0) - m_overlay = m_inp_matrix[10]->read(); - - for (int i = 0; i < 5; i++) - output_set_indexed_value("ol", i+1, m_overlay >> i & 1); -} - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -INPUT_CHANGED_MEMBER(tispeak_state::snspell_power_button) -{ - int on = (int)(FPTR)param; - - if (on && !m_power_on) - { - m_power_on = true; - m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - } - else if (!on && m_power_on) - snspell_power_off(); -} - -static INPUT_PORTS_START( snspell ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_NAME("Module") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Erase") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Enter") - - PORT_START("IN.6") // R6 - PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.7") // R7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_NAME("Go") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_NAME("Replay") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("Repeat") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_NAME("Clue") - - PORT_START("IN.8") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_NAME("Mystery Word") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("Secret Code") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("Letter") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("Say It") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Spell/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) -INPUT_PORTS_END - - -static INPUT_PORTS_START( snmath ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Go") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("<") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_STOP) PORT_NAME(">") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Repeat") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) // / - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Mix It") - - PORT_START("IN.6") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("Number Stumper") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("Write It") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Greater/Less") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Word Problems") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Solve It/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) - - PORT_START("IN.7") - PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("IN.8") - PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -static INPUT_PORTS_START( snread ) - PORT_INCLUDE( snspell ) - - PORT_MODIFY("IN.7") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("Word Zapper") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_NAME("Word Maker") - - PORT_MODIFY("IN.8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_NAME("Read It") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("Picture Read") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("Letter Stumper") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("Hear It") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Word Zap/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) -INPUT_PORTS_END - - -static INPUT_PORTS_START( lantutor ) - PORT_INCLUDE( snspell ) - - PORT_MODIFY("IN.5") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("Diacritical") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Space") - - PORT_MODIFY("IN.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("3") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_NAME("4") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_NAME("5") - - PORT_MODIFY("IN.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("6") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("7") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("8") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_NAME("9") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_NAME("0") - - PORT_MODIFY("IN.8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_NAME("Translate") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("Learn") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("Phrase") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("Link") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_NAME("Repeat") -INPUT_PORTS_END - - -static INPUT_PORTS_START( tntell ) - PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("Grid 1-1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("Grid 1-2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_NAME("Grid 1-4") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("Grid 1-3") - - PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Grid 2-1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Grid 2-2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Grid 2-4") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Grid 2-3") - - PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Grid 3-1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Grid 3-2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Grid 3-4") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Grid 3-3") - - PORT_START("IN.3") // R3 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Grid 4-1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Grid 4-2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_V) PORT_NAME("Grid 4-4") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Grid 4-3") - - PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_NAME("Grid 5-1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_NAME("Grid 5-2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("Grid 5-4") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_NAME("Grid 5-3") - - PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_NAME("Grid 5-6") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("Grid 6-5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("Grid 5-5") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) // overlay code - - PORT_START("IN.6") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Grid 3-5") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Grid 2-5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Grid 4-5") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_NAME("Grid 1-5") - - PORT_START("IN.7") // R7 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("Grid 3-6") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Grid 2-6") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("Grid 4-6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_NAME("Grid 1-6") - - PORT_START("IN.8") // R8 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Grid 6-1 (Off)") // -> auto_power_off - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("Grid 6-2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Grid 6-4") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("Grid 6-3") - - PORT_START("IN.9") // Vss! - PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Grid 6-6 (On)") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) - - PORT_START("IN.10") - PORT_CONFNAME( 0x1f, 0x04, "Overlay Code" ) // only if not provided by external artwork - PORT_CONFSETTING( 0x00, "00 (None)" ) - PORT_CONFSETTING( 0x01, "01" ) - PORT_CONFSETTING( 0x02, "02" ) - PORT_CONFSETTING( 0x03, "03" ) - PORT_CONFSETTING( 0x04, "04" ) - PORT_CONFSETTING( 0x05, "05" ) - PORT_CONFSETTING( 0x06, "06" ) - PORT_CONFSETTING( 0x07, "07" ) - PORT_CONFSETTING( 0x08, "08" ) - PORT_CONFSETTING( 0x09, "09" ) - PORT_CONFSETTING( 0x0a, "0A" ) - PORT_CONFSETTING( 0x0b, "0B" ) - PORT_CONFSETTING( 0x0c, "0C" ) - PORT_CONFSETTING( 0x0d, "0D" ) - PORT_CONFSETTING( 0x0e, "0E" ) - PORT_CONFSETTING( 0x0f, "0F" ) - PORT_CONFSETTING( 0x10, "10" ) - PORT_CONFSETTING( 0x11, "11" ) - PORT_CONFSETTING( 0x12, "12" ) - PORT_CONFSETTING( 0x13, "13" ) - PORT_CONFSETTING( 0x14, "14" ) - PORT_CONFSETTING( 0x15, "15" ) - PORT_CONFSETTING( 0x16, "16" ) - PORT_CONFSETTING( 0x17, "17" ) - PORT_CONFSETTING( 0x18, "18" ) - PORT_CONFSETTING( 0x19, "19" ) - PORT_CONFSETTING( 0x1a, "1A" ) - PORT_CONFSETTING( 0x1b, "1B" ) - PORT_CONFSETTING( 0x1c, "1C" ) - PORT_CONFSETTING( 0x1d, "1D" ) - PORT_CONFSETTING( 0x1e, "1E" ) - PORT_CONFSETTING( 0x1f, "1F (Diagnostic)" ) -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -static MACHINE_CONFIG_FRAGMENT( tms5110_route ) - - /* sound hardware */ - MCFG_TMS5110_M0_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m0_w)) - MCFG_TMS5110_M1_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m1_w)) - MCFG_TMS5110_ADDR_CB(DEVWRITE8("tms6100", tms6100_device, tms6100_addr_w)) - MCFG_TMS5110_DATA_CB(DEVREADLINE("tms6100", tms6100_device, tms6100_data_r)) - MCFG_TMS5110_ROMCLK_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_romclock_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( snmath, tispeak_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS0270, MASTER_CLOCK/2) - MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, snspell_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snmath_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, snspell_write_r)) - - MCFG_TMS0270_READ_CTL_CB(DEVREAD8("tms5100", tms5110_device, ctl_r)) - MCFG_TMS0270_WRITE_CTL_CB(DEVWRITE8("tms5100", tms5110_device, ctl_w)) - MCFG_TMS0270_WRITE_PDC_CB(DEVWRITELINE("tms5100", tms5110_device, pdc_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_snmath) - - /* no video! */ - - /* sound hardware */ - MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("tms5100", CD2801, MASTER_CLOCK) - MCFG_FRAGMENT_ADD(tms5110_route) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( sns_cd2801, snmath ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o)) - - MCFG_DEFAULT_LAYOUT(layout_snspell) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "snspell") - MCFG_GENERIC_EXTENSIONS("vsm") - MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "snspell") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sns_tmc0281, sns_cd2801 ) - - /* sound hardware */ - MCFG_SOUND_REPLACE("tms5100", TMC0281, MASTER_CLOCK) - MCFG_FRAGMENT_ADD(tms5110_route) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sns_tmc0281d, sns_cd2801 ) - - /* sound hardware */ - MCFG_SOUND_REPLACE("tms5100", TMC0281D, MASTER_CLOCK) - MCFG_FRAGMENT_ADD(tms5110_route) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sns_cd2801_m, sns_cd2801 ) - - /* basic machine hardware */ - MCFG_DEFAULT_LAYOUT(layout_snmath) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( snread, snmath ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o)) - - MCFG_DEFAULT_LAYOUT(layout_lantutor) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "snread") - MCFG_GENERIC_EXTENSIONS("vsm") - MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "snread") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( lantutor, snmath ) - - /* basic machine hardware */ - MCFG_CPU_MODIFY("maincpu") - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snspell_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, lantutor_write_r)) - - MCFG_DEFAULT_LAYOUT(layout_lantutor) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "lantutor") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_EXTENSIONS("vsm,bin") - MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "lantutor") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_START( vocaid, tispeak_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, MASTER_CLOCK/2) - MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, tntell_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, tntell_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, tntell_write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("ol_timer", tispeak_state, tntell_get_overlay, attotime::from_msec(50)) - MCFG_DEFAULT_LAYOUT(layout_tntell) - - /* no video! */ - - /* sound hardware */ - MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("tms5100", CD2802, MASTER_CLOCK) - MCFG_FRAGMENT_ADD(tms5110_route) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tntell, vocaid ) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "tntell") - MCFG_GENERIC_EXTENSIONS("vsm") - MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) - - MCFG_SOFTWARE_LIST_ADD("cart_list", "tntell") -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -#define rom_snspellp rom_snspell // until we have a correct dump - -ROM_START( snspell ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // typed in from patent US4189779, verified by 2 sources - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge - ROM_LOAD( "tmc0351nl.vsm", 0x0000, 0x4000, CRC(beea3373) SHA1(8b0f7586d2f12c3d4a885fdb528cf23feffa1a3b) ) - ROM_LOAD( "tmc0352nl.vsm", 0x4000, 0x4000, CRC(d51f0587) SHA1(ddaa484be1bba5fef46b481cafae517e4acaa8ed) ) -ROM_END - -ROM_START( snspella ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge - ROM_LOAD( "tmc0351n2l.vsm", 0x0000, 0x4000, CRC(2d03b292) SHA1(a3e9a365307ae936c7472f720a7a8240741531d6) ) - ROM_LOAD( "tmc0352n2l.vsm", 0x4000, 0x4000, CRC(a6d56883) SHA1(eebf9c07f2f9001679dec06c2367d4a50596d04b) ) -ROM_END - -ROM_START( snspellb ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge - ROM_LOAD( "cd2350a.vsm", 0x0000, 0x4000, CRC(2adda742) SHA1(3f868ed8284b723c815a30343057e03467c043b5) ) -ROM_END - -ROM_START( snspelluk ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge - ROM_LOAD( "cd2303.vsm", 0x0000, 0x4000, CRC(0fae755c) SHA1(b68c3120a63a61db474feb5d71a6e5dd67910d80) ) - ROM_LOAD( "cd2304.vsm", 0x4000, 0x4000, CRC(e2a270eb) SHA1(c13c95ad15f1923a4841f66504e0f22646e71d99) ) -ROM_END - -ROM_START( snspelluka ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge - ROM_LOAD( "cd62175.vsm", 0x0000, 0x4000, CRC(6e1063d4) SHA1(b5c66c51148c5921ecb8ffccd7a460ae639cdb68) ) -ROM_END - -ROM_START( snspelljp ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge - ROM_LOAD( "cd2321.vsm", 0x0000, 0x4000, CRC(ac010cce) SHA1(c0200d857b62be696248ac2d684a390c66ab0c31) ) - ROM_LOAD( "cd2322.vsm", 0x4000, 0x4000, CRC(b6f4bba4) SHA1(65d686a9385b5ef3f080a5f47c6b2418bb9455b0) ) -ROM_END - -ROM_START( snspellfr ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, BAD_DUMP CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // placeholder, use the one we have - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge - ROM_LOAD( "cd2352.vsm", 0x0000, 0x4000, CRC(181a239e) SHA1(e16043766c385e152b7005c1c010be4c5fccdd9b) ) -ROM_END - -ROM_START( snspellit ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, BAD_DUMP CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // placeholder, use the one we have - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge - ROM_LOAD( "cd62190.vsm", 0x0000, 0x4000, CRC(63832002) SHA1(ea8124b2bf0f5908c5f1a56d60063f2468a10143) ) -ROM_END - - -ROM_START( snmath ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "cd2708n2l", 0x0000, 0x1000, CRC(35937360) SHA1(69c362c75bb459056c09c7fab37c91040485474b) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_cd2708_output.pla", 0, 1246, CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) - - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) - ROM_LOAD( "cd2381.vsm", 0x0000, 0x4000, CRC(f048dc81) SHA1(e97667d1002de40ab3d702c63b82311480032e0f) ) - ROM_LOAD( "cd2614.vsm", 0x4000, 0x1000, CRC(11989074) SHA1(0e9cf906de9bcdf4acb425535dc442846fc48fa2) ) - ROM_RELOAD( 0x5000, 0x1000 ) - ROM_RELOAD( 0x6000, 0x1000 ) - ROM_RELOAD( 0x7000, 0x1000 ) -ROM_END - -ROM_START( snmathp ) - ROM_REGION( 0x1000, "maincpu", 0 ) - // typed in from patent 4946391, verified with source code - // BTANB note: Mix It does not work at all, this is an original bug in the patent listing. There are probably other minor bugs too. - ROM_LOAD( "us4946391_t2074", 0x0000, 0x1000, CRC(011f0c2d) SHA1(d2e14d72e03ca864abd51da78ffb71a9da82f624) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_cd2708_output.pla", 0, 1246, BAD_DUMP CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) // taken from cd2708, need to verify if it's same as cd2704 - - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) - ROM_LOAD( "cd2392.vsm", 0x0000, 0x4000, CRC(4ed2e920) SHA1(8896f29e25126c1e4d9a47c9a325b35dddecc61f) ) - ROM_LOAD( "cd2393.vsm", 0x4000, 0x4000, CRC(571d5b5a) SHA1(83284755d9b77267d320b5b87fdc39f352433715) ) -ROM_END - - -ROM_START( snread ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "cd2705b-n2l", 0x0000, 0x1000, CRC(c235636e) SHA1(57b24dd8414bf76ec786a51d10cb8a5898b60e18) ) - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_cd2705_output.pla", 0, 1246, CRC(bf859848) SHA1(66b297fbf534968fa6db7413b99ef0e81cc35ddc) ) - - ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // 8000-bfff = space reserved for cartridge - ROM_LOAD( "cd2394a.vsm", 0x0000, 0x4000, CRC(cbb0e2b1) SHA1(5e322c683baf806523de171310258ae371671327) ) - ROM_LOAD( "cd2395a.vsm", 0x4000, 0x4000, CRC(3d519504) SHA1(76b19ba5a9a3486005e09c98e8a6abc8b88288dd) ) -ROM_END - - -ROM_START( lantutor ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4631748_tmc0275", 0x0000, 0x1000, CRC(22818845) SHA1(1a84f15fb18ca66b1f2bf7491d76fbc56068984d) ) // extracted visually from patent US4631748, verified with source code - - ROM_REGION( 1246, "maincpu:ipla", 0 ) - ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) - ROM_REGION( 2127, "maincpu:mpla", 0 ) - ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified - ROM_REGION( 1246, "maincpu:opla", 0 ) - ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, BAD_DUMP CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // taken from snspell, mostly looks correct - - ROM_REGION( 0x10000, "tms6100", ROMREGION_ERASEFF ) // cartridge area -ROM_END - - -ROM_START( tntell ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) - - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge - ROM_LOAD( "cd2610.vsm", 0x0000, 0x1000, CRC(6db34e5a) SHA1(10fa5db20fdcba68034058e7194f35c90b9844e6) ) -ROM_END - -ROM_START( tntelluk ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) - - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge - ROM_LOAD( "cd62170.vsm", 0x0000, 0x4000, CRC(6dc9d072) SHA1(9d2c9ff57c4f8fe69768666ffa41fcac649279ef) ) -ROM_END - -ROM_START( tntellfr ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) - - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge - ROM_LOAD( "cd62171.vsm", 0x0000, 0x4000, CRC(cc26f7d1) SHA1(2b03e37b3bf3cbeca36980acfc45246dac706b83) ) -ROM_END - -ROM_START( tntellp ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "us4403965_cd1100", 0x0000, 0x0800, BAD_DUMP CRC(863a1c9e) SHA1(f2f9eb0ae17eedd4ef2b887b34601e75b4f6c720) ) // typed in from patent US4403965/EP0048835A2, may have errors - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) // from cd8012, matches patent source code - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_us4403965_output.pla", 0, 365, CRC(66cfb3c3) SHA1(80a05e5d729518e1f35d8f26438f56e80ffbd003) ) - - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge - ROM_LOAD( "cd2610.vsm", 0x0000, 0x1000, CRC(6db34e5a) SHA1(10fa5db20fdcba68034058e7194f35c90b9844e6) ) -ROM_END - - -ROM_START( vocaid ) - ROM_REGION( 0x0800, "maincpu", 0 ) - ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) - - ROM_REGION( 867, "maincpu:mpla", 0 ) - ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) - ROM_REGION( 365, "maincpu:opla", 0 ) - ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) - - ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // same hw as tntell, but no external slot - ROM_LOAD( "cd2357.vsm", 0x0000, 0x4000, CRC(19c251fa) SHA1(8f8163069f32413379e7e1681ce6a4d0819d4ebc) ) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1978, snspell, 0, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, uses patent MCU ROM -COMP( 1978, snspellp, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1979, snspella, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " -COMP( 1980, snspellb, snspell, 0, sns_tmc0281d,snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1980 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " -COMP( 1978, snspelluk, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " -COMP( 1981, snspelluka, snspell, 0, sns_cd2801_m,snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " -COMP( 1979, snspelljp, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " -COMP( 1980, snspellfr, snspell, 0, sns_cd2801, snspell, tispeak_state, snspell, "Texas Instruments", "La Dictee Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // doesn't work due to missing CD2702 MCU dump, German/Italian version has CD2702 too -COMP( 1982, snspellit, snspell, 0, sns_cd2801_m,snspell, tispeak_state, snspell, "Texas Instruments", "Grillo Parlante (Italy)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " - -COMP( 1986, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1986 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1980 version/patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) - -COMP( 1980, snread, 0, 0, snread, snread, tispeak_state, snspell, "Texas Instruments", "Speak & Read (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) - -COMP( 1979, lantutor, 0, 0, lantutor, lantutor, tispeak_state, lantutor, "Texas Instruments", "Language Tutor (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) - -COMP( 1981, tntell, 0, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (US, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) // assume there is an older version too, with CD8010 MCU -COMP( 1980, tntellp, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -COMP( 1981, tntelluk, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (UK)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) -COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Le Livre Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) - -COMP( 1982, vocaid, 0, 0, vocaid, tntell, driver_device, 0, "Texas Instruments", "Vocaid", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mess/drivers/tk2000.c b/src/mess/drivers/tk2000.c deleted file mode 100644 index 6a5cd4a276c..00000000000 --- a/src/mess/drivers/tk2000.c +++ /dev/null @@ -1,608 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - tk2000.c - Microdigital TK2000 - - Driver by R. Belmont - - This system is only vaguely Apple II compatible. - The keyboard works entirely differently, which is a big deal. - - $C05A - banks RAM from c100-ffff - $C05B - banks ROM from c100-ffff - -************************************************************************/ - -#include "emu.h" -#include "machine/bankdev.h" -#include "machine/ram.h" -#include "sound/speaker.h" -#include "imagedev/flopdrv.h" -#include "imagedev/cassette.h" -#include "formats/ap2_dsk.h" -#include "cpu/m6502/m6502.h" -#include "video/apple2.h" - -#define A2_CPU_TAG "maincpu" -#define A2_BUS_TAG "a2bus" -#define A2_SPEAKER_TAG "speaker" -#define A2_CASSETTE_TAG "tape" -#define A2_UPPERBANK_TAG "inhbank" -#define A2_VIDEO_TAG "a2video" - -class tk2000_state : public driver_device -{ -public: - tk2000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, A2_CPU_TAG), - m_ram(*this, RAM_TAG), - m_video(*this, A2_VIDEO_TAG), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_kbspecial(*this, "keyb_special"), - m_sysconfig(*this, "a2_config"), - m_speaker(*this, A2_SPEAKER_TAG), - m_cassette(*this, A2_CASSETTE_TAG), - m_upperbank(*this, A2_UPPERBANK_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_video; - required_ioport m_row0, m_row1, m_row2, m_row3, m_row4, m_row5, m_row6, m_row7; - required_ioport m_kbspecial; - required_ioport m_sysconfig; - required_device m_speaker; - required_device m_cassette; - required_device m_upperbank; - - TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_PALETTE_INIT(tk2000); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER(ram_r); - DECLARE_WRITE8_MEMBER(ram_w); - DECLARE_READ8_MEMBER(c000_r); - DECLARE_WRITE8_MEMBER(c000_w); - DECLARE_READ8_MEMBER(c080_r); - DECLARE_WRITE8_MEMBER(c080_w); - DECLARE_READ8_MEMBER(c100_r); - DECLARE_WRITE8_MEMBER(c100_w); - -private: - int m_speaker_state; - int m_cassette_state; - - UINT8 m_strobe; - - bool m_page2; - - UINT8 *m_ram_ptr; - int m_ram_size; - - void do_io(address_space &space, int offset); - UINT8 read_floatingbus(); -}; - -/*************************************************************************** - START/RESET -***************************************************************************/ - -void tk2000_state::machine_start() -{ - m_ram_ptr = m_ram->pointer(); - m_ram_size = m_ram->size(); - m_speaker_state = 0; - m_speaker->level_w(m_speaker_state); - m_cassette_state = 0; - m_cassette->output(-1.0f); - m_upperbank->set_bank(0); - - // setup save states - save_item(NAME(m_speaker_state)); - save_item(NAME(m_cassette_state)); - save_item(NAME(m_strobe)); - save_item(NAME(m_page2)); - - // setup video pointers - m_video->m_ram_ptr = m_ram_ptr; - m_video->m_aux_ptr = m_ram_ptr; - m_video->m_char_ptr = NULL; - m_video->m_char_size = 0; -} - -void tk2000_state::machine_reset() -{ - m_page2 = false; - m_strobe = 0; -} - -/*************************************************************************** - VIDEO -***************************************************************************/ - -TIMER_DEVICE_CALLBACK_MEMBER(tk2000_state::apple2_interrupt) -{ - int scanline = param; - - if((scanline % 8) == 0) - machine().first_screen()->update_partial(machine().first_screen()->vpos()); - - // update the video system's shadow copy of the system config at the end of the frame - if (scanline == 192) - { - m_video->m_sysconfig = m_sysconfig->read(); - } -} - -PALETTE_INIT_MEMBER(tk2000_state, tk2000) -{ - m_video->palette_init_apple2(palette); -} - -UINT32 tk2000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_video->hgr_update(screen, bitmap, cliprect, 0, 191); - return 0; -} - -/*************************************************************************** - I/O -***************************************************************************/ -// most softswitches don't care about read vs write, so handle them here -void tk2000_state::do_io(address_space &space, int offset) -{ - if(space.debugger_access()) - { - return; - } - - switch (offset) - { - case 0x20: - m_cassette_state ^= 1; - m_cassette->output(m_cassette_state ? 1.0f : -1.0f); - break; - - case 0x30: - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - break; - - case 0x50: // monochrome - break; - - case 0x51: // color - break; - - case 0x54: // set page 1 - m_page2 = false; - m_video->m_page2 = false; - break; - - case 0x55: // set page 2 - m_page2 = true; - m_video->m_page2 = true; - break; - - case 0x5a: // ROM - m_upperbank->set_bank(0); - break; - - case 0x5b: // RAM - m_upperbank->set_bank(1); - break; - - case 0x5e: - break; - - default: - printf("do_io: unk access @ $C0%02X\n", offset & 0xff); - break; - } -} - -READ8_MEMBER(tk2000_state::c000_r) -{ - switch (offset) - { - case 0x00: - return 0; - - case 0x10: // keyboard strobe - return m_strobe; - - case 0x60: // cassette in - case 0x68: - return m_cassette->input() > 0.0 ? 0x80 : 0; - - default: - do_io(space, offset); - break; - } - - return read_floatingbus(); -} - -WRITE8_MEMBER(tk2000_state::c000_w) -{ - switch (offset) - { - case 0x00: // write row mask for keyboard scan - switch (data) - { - case 0: - break; - - case 0x01: m_strobe = m_row0->read(); break; - case 0x02: m_strobe = m_row1->read(); break; - case 0x04: m_strobe = m_row2->read(); break; - case 0x08: m_strobe = m_row3->read(); break; - case 0x10: m_strobe = m_row4->read(); break; - case 0x20: m_strobe = m_row5->read(); break; - case 0x40: m_strobe = m_row6->read(); break; - case 0x80: m_strobe = m_row7->read(); break; - } - break; - - case 0x5f: - m_strobe = m_kbspecial->read(); - break; - - default: - do_io(space, offset); - break; - } -} - -READ8_MEMBER(tk2000_state::c080_r) -{ - return read_floatingbus(); -} - -WRITE8_MEMBER(tk2000_state::c080_w) -{ -} - -READ8_MEMBER(tk2000_state::c100_r) -{ - return m_ram_ptr[offset + 0xc100]; -} - -WRITE8_MEMBER(tk2000_state::c100_w) -{ - m_ram_ptr[offset + 0xc100] = data; -} - -// floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter -UINT8 tk2000_state::read_floatingbus() -{ - enum - { - // scanner types - kScannerNone = 0, kScannerApple2, kScannerApple2e, - - // scanner constants - kHBurstClock = 53, // clock when Color Burst starts - kHBurstClocks = 4, // clocks per Color Burst duration - kHClock0State = 0x18, // H[543210] = 011000 - kHClocks = 65, // clocks per horizontal scan (including HBL) - kHPEClock = 40, // clock when HPE (horizontal preset enable) goes low - kHPresetClock = 41, // clock when H state presets - kHSyncClock = 49, // clock when HSync starts - kHSyncClocks = 4, // clocks per HSync duration - kNTSCScanLines = 262, // total scan lines including VBL (NTSC) - kNTSCVSyncLine = 224, // line when VSync starts (NTSC) - kPALScanLines = 312, // total scan lines including VBL (PAL) - kPALVSyncLine = 264, // line when VSync starts (PAL) - kVLine0State = 0x100, // V[543210CBA] = 100000000 - kVPresetLine = 256, // line when V state presets - kVSyncLines = 4, // lines per VSync duration - kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? - }; - - // vars - // - int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ - h_clock, h_state, h_0, h_1, h_2, h_3, h_4, h_5, - v_line, v_state, v_A, v_B, v_C, v_0, v_1, v_2, v_3, v_4, /* v_5, */ - _hires, addend0, addend1, addend2, sum, address; - - // video scanner data - // - i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync - - // machine state switches - // - Hires = 1; //m_video->m_hires ? 1 : 0; - Mixed = 0; //m_video->m_mix ? 1 : 0; - Page2 = m_page2 ? 1 : 0; - _80Store = 0; - - // calculate video parameters according to display standard - // - ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? - // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? - // ScanCycles = ScanLines * kHClocks; - - // calculate horizontal scanning state - // - h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock - h_state = kHClock0State + h_clock; // H state bits - if (h_clock >= kHPresetClock) // check for horizontal preset - { - h_state -= 1; // correct for state preset (two 0 states) - } - h_0 = (h_state >> 0) & 1; // get horizontal state bits - h_1 = (h_state >> 1) & 1; - h_2 = (h_state >> 2) & 1; - h_3 = (h_state >> 3) & 1; - h_4 = (h_state >> 4) & 1; - h_5 = (h_state >> 5) & 1; - - // calculate vertical scanning state - // - v_line = i / kHClocks; // which vertical scanning line - v_state = kVLine0State + v_line; // V state bits - if ((v_line >= kVPresetLine)) // check for previous vertical state preset - { - v_state -= ScanLines; // compensate for preset - } - v_A = (v_state >> 0) & 1; // get vertical state bits - v_B = (v_state >> 1) & 1; - v_C = (v_state >> 2) & 1; - v_0 = (v_state >> 3) & 1; - v_1 = (v_state >> 4) & 1; - v_2 = (v_state >> 5) & 1; - v_3 = (v_state >> 6) & 1; - v_4 = (v_state >> 7) & 1; - //v_5 = (v_state >> 8) & 1; - - // calculate scanning memory address - // - _hires = Hires; - if (Hires && Mixed && (v_4 & v_2)) - { - _hires = 0; // (address is in text memory) - } - - addend0 = 0x68; // 1 1 0 1 - addend1 = (h_5 << 5) | (h_4 << 4) | (h_3 << 3); - addend2 = (v_4 << 6) | (v_3 << 5) | (v_4 << 4) | (v_3 << 3); - sum = (addend0 + addend1 + addend2) & (0x0F << 3); - - address = 0; - address |= h_0 << 0; // a0 - address |= h_1 << 1; // a1 - address |= h_2 << 2; // a2 - address |= sum; // a3 - aa6 - address |= v_0 << 7; // a7 - address |= v_1 << 8; // a8 - address |= v_2 << 9; // a9 - address |= ((_hires) ? v_A : (1 ^ (Page2 & (1 ^ _80Store)))) << 10; // a10 - address |= ((_hires) ? v_B : (Page2 & (1 ^ _80Store))) << 11; // a11 - if (_hires) // hires? - { - // Y: insert hires only address bits - // - address |= v_C << 12; // a12 - address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 - address |= (Page2 & (1 ^ _80Store)) << 14; // a14 - } - else - { - // N: text, so no higher address bits unless Apple ][, not Apple //e - // - if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) - (kHPEClock <= h_clock) && // Y: HBL? - (h_clock <= (kHClocks - 1))) - { - address |= 1 << 12; // Y: a12 (add $1000 to address!) - } - } - - return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? -} - -/*************************************************************************** - ADDRESS MAP -***************************************************************************/ - -READ8_MEMBER(tk2000_state::ram_r) -{ - if (offset < m_ram_size) - { - return m_ram_ptr[offset]; - } - - return 0xff; -} - -WRITE8_MEMBER(tk2000_state::ram_w) -{ - if (offset < m_ram_size) - { - m_ram_ptr[offset] = data; - } -} - -static ADDRESS_MAP_START( apple2_map, AS_PROGRAM, 8, tk2000_state ) - AM_RANGE(0x0000, 0xbfff) AM_READWRITE(ram_r, ram_w) - AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) - AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) - AM_RANGE(0xc100, 0xffff) AM_DEVICE(A2_UPPERBANK_TAG, address_map_bank_device, amap8) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( inhbank_map, AS_PROGRAM, 8, tk2000_state ) - AM_RANGE(0x0000, 0x3eff) AM_ROM AM_REGION("maincpu", 0x100) - AM_RANGE(0x4000, 0x7eff) AM_READWRITE(c100_r, c100_w) -ADDRESS_MAP_END - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -/* - TK2000 matrix: - - 0 1 2 3 4 5 6 7 - 0SHIF B V C X Z - 1 G F D S A - 2 SPC T R E W Q - 3 LFT 5 4 3 2 1 - 4 RGT 6 7 8 9 0 - 5 DWN Y U I O P - 6 UP H J K L : - 7 RTN N M , . ? - - write row mask 1/2/4/8/10/20/40/80 to $C000 - read column at $C010 - - If $C05F is written, the Ctrl key is read in bit 0 of $C010 immediately afterwards. -*/ -static INPUT_PORTS_START( tk2000 ) - PORT_START("ROW0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - - PORT_START("ROW1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - - PORT_START("ROW2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - - PORT_START("ROW3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("ROW4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - - PORT_START("ROW5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - - PORT_START("ROW6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - - PORT_START("ROW7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("keyb_special") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("a2_config") - PORT_CONFNAME(0x03, 0x00, "Composite monitor type") - PORT_CONFSETTING(0x00, "Color") - PORT_CONFSETTING(0x01, "B&W") - PORT_CONFSETTING(0x02, "Green") - PORT_CONFSETTING(0x03, "Amber") -INPUT_PORTS_END - -static MACHINE_CONFIG_START( tk2000, tk2000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(A2_CPU_TAG, M6502, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_CPU_PROGRAM_MAP(apple2_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tk2000_state, apple2_interrupt, "screen", 0, 1) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_DEVICE_ADD(A2_VIDEO_TAG, APPLE2_VIDEO, XTAL_14_31818MHz) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(280*2, 262) - MCFG_SCREEN_VISIBLE_AREA(0, (280*2)-1,0,192-1) - MCFG_SCREEN_UPDATE_DRIVER(tk2000_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(tk2000_state, tk2000) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(A2_SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* /INH banking */ - MCFG_DEVICE_ADD(A2_UPPERBANK_TAG, ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(inhbank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) - - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - MCFG_CASSETTE_ADD(A2_CASSETTE_TAG) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ -ROM_START(tk2000) - ROM_REGION(0x4000,"maincpu",0) - ROM_LOAD( "tk2000.rom", 0x000000, 0x004000, CRC(dfdbacc3) SHA1(bb37844c31616046630868a4399ee3d55d6df277) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1984, tk2000, 0, 0, tk2000, tk2000, driver_device, 0, "Microdigital", "TK2000", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/tk80.c b/src/mess/drivers/tk80.c deleted file mode 100644 index c6b79cc7d54..00000000000 --- a/src/mess/drivers/tk80.c +++ /dev/null @@ -1,344 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - - -NEC TK80 / MIKROLAB KR580IK80 -***************************** -TK80 driver by Robbbert -Mikrolab driver by Micko -Merged by Robbbert. - -TK80 (Training Kit 80) considered to be Japan's first home computer. -It consisted of 25 keys and 8 LED digits, and was programmed in hex. -The Mikrolab is a Russian clone which appears to be almost completely identical. - -TK85 seems to be the same as TK80, except is has a larger ROM. No -schematics etc are available. Thanks to 'Nama' who dumped the rom. -It has 25 keys, so a few aren't defined yet. - -ND-80Z : http://www.alles.or.jp/~thisida/nd80z3syokai.html (newer version) -Like the TK85, it has a 2KB rom. Thanks again to 'Nama' who dumped it. - -When booted, the system begins at 0000 which is ROM. You need to change the -address to 8000 before entering a program. Here is a test to paste in: -8000-11^22^33^44^55^66^77^88^99^8000- -Press the right-arrow to confirm data has been entered. - -Operation: -4 digits at left is the address; 2 digits at right is the data. -As you increment addresses, the middle 2 digits show the previous byte. -You can enter 4 digits, and pressing 'ADRS SET' will transfer this info -to the left, thus setting the address to this value. Press 'WRITE INCR' to -store new data and increment the address. Press 'READ INCR' and 'READ DECR' -to scan through data without updating it. Other keys unknown/not implemented. - -ToDo: -- Add storage - - - -ICS8080 -- Keys labels are correct, but which key is which is not known -- Character B is corrupt -- Operation is different to the other systems - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "machine/keyboard.h" -#include "tk80.lh" - - -class tk80_state : public driver_device -{ -public: - tk80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - - DECLARE_READ8_MEMBER(key_matrix_r); - DECLARE_READ8_MEMBER(nd80z_key_r); - DECLARE_READ8_MEMBER(serial_r); - DECLARE_WRITE8_MEMBER(serial_w); - DECLARE_WRITE8_MEMBER(mikrolab_serial_w); - DECLARE_READ8_MEMBER(display_r); - DECLARE_WRITE8_MEMBER(display_w); - UINT8 m_term_data; - UINT8 m_keyb_press; - UINT8 m_keyb_press_flag; - UINT8 m_shift_press_flag; - UINT8 m_ppi_portc; - required_device m_maincpu; -}; - - -READ8_MEMBER( tk80_state::display_r ) -{ - return output_get_digit_value(offset); -} - -WRITE8_MEMBER( tk80_state::display_w ) -{ - output_set_digit_value(offset, data); -} - -static ADDRESS_MAP_START(tk80_mem, AS_PROGRAM, 8, tk80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x83ff) // A10-14 not connected - AM_RANGE(0x0000, 0x02ff) AM_ROM - AM_RANGE(0x0300, 0x03ff) AM_RAM // EEPROM - AM_RANGE(0x8000, 0x83f7) AM_RAM // RAM - AM_RANGE(0x83f8, 0x83ff) AM_RAM AM_READWRITE(display_r,display_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tk85_mem, AS_PROGRAM, 8, tk80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x87ff) // A10-14 not connected - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x8000, 0x83f7) AM_RAM - AM_RANGE(0x83f8, 0x83ff) AM_RAM AM_READWRITE(display_r,display_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ics8080_mem, AS_PROGRAM, 8, tk80_state) - ADDRESS_MAP_UNMAP_HIGH - //ADDRESS_MAP_GLOBAL_MASK(0x87ff) // A10-14 not connected - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x8000, 0x83f7) AM_RAM - AM_RANGE(0x83f8, 0x83ff) AM_RAM AM_READWRITE(display_r,display_w) - AM_RANGE(0x8400, 0x8fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tk80_io, AS_IO, 8, tk80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x03) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(mikrolab_io, AS_IO, 8, tk80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x03) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(nd80z_io, AS_IO, 8, tk80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x03) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( tk80 ) - PORT_START("X0") /* KEY ROW 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("X1") /* KEY ROW 1 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("X2") /* KEY ROW 2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RET") PORT_CODE(KEYCODE_W) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADRS SET") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("READ DECR") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("READ INCR") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("WRITE INCR") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STORE DATA") PORT_CODE(KEYCODE_I) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOAD DATA") PORT_CODE(KEYCODE_O) -INPUT_PORTS_END - -INPUT_PORTS_START( mikrolab ) - PORT_INCLUDE( tk80 ) - PORT_MODIFY("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESUME") PORT_CODE(KEYCODE_W) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADDRESS") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SAVE") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("END") PORT_CODE(KEYCODE_I) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_O) -INPUT_PORTS_END - -INPUT_PORTS_START( ics8080 ) - PORT_INCLUDE( tk80 ) - PORT_MODIFY("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADDR") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_T) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLR") PORT_CODE(KEYCODE_U) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_I) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_O) -INPUT_PORTS_END - -READ8_MEMBER( tk80_state::key_matrix_r ) -{ -// PA0-7 keyscan in - - UINT8 data = 0xff; - - if (BIT(m_ppi_portc, 4)) - data &= ioport("X0")->read(); - if (BIT(m_ppi_portc, 5)) - data &= ioport("X1")->read(); - if (BIT(m_ppi_portc, 6)) - data &= ioport("X2")->read(); - - return data; -} - -READ8_MEMBER( tk80_state::nd80z_key_r ) -{ -// PA0-7 keyscan in - - UINT8 data = 0xff, row = m_ppi_portc & 7; - if (row == 6) - data &= ioport("X0")->read(); - else - if (row == 5) - data &= ioport("X1")->read(); - else - if (row == 3) - data &= ioport("X2")->read(); - - return data; -} - -READ8_MEMBER( tk80_state::serial_r ) -{ -// PB0 - serial in - //printf("B R\n"); - - return 0; -} - -WRITE8_MEMBER( tk80_state::serial_w ) -{ -// PC0 - serial out -// PC4-6 keyscan out -// PC7 - display on/off - m_ppi_portc = data ^ 0x70; -} - -WRITE8_MEMBER( tk80_state::mikrolab_serial_w ) -{ -// PC0 - serial out -// PC4-6 keyscan out -// PC7 - display on/off - m_ppi_portc = data; -} - -static MACHINE_CONFIG_START( tk80, tk80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_1MHz) // 18.432 / 9 - MCFG_CPU_PROGRAM_MAP(tk80_mem) - MCFG_CPU_IO_MAP(tk80_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_tk80) - - /* Devices */ - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(tk80_state, key_matrix_r)) - MCFG_I8255_IN_PORTB_CB(READ8(tk80_state, serial_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(tk80_state, serial_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mikrolab, tk80 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(tk85_mem) - MCFG_CPU_IO_MAP(mikrolab_io) - - /* Devices */ - MCFG_DEVICE_REMOVE("ppi8255") - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(tk80_state, key_matrix_r)) - MCFG_I8255_IN_PORTB_CB(READ8(tk80_state, serial_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(tk80_state, mikrolab_serial_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( nd80z, tk80 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(tk85_mem) - MCFG_CPU_IO_MAP(nd80z_io) - - /* Devices */ - MCFG_DEVICE_REMOVE("ppi8255") - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(tk80_state, nd80z_key_r)) - MCFG_I8255_IN_PORTB_CB(READ8(tk80_state, serial_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(tk80_state, mikrolab_serial_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tk85, tk80 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(tk85_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ics8080, tk80 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(ics8080_mem) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( tk80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "tk80-1.bin", 0x0000, 0x0100, CRC(897295e4) SHA1(50fb42b07252fc48044830e2f228e218fc59481c)) - ROM_LOAD( "tk80-2.bin", 0x0100, 0x0100, CRC(d54480c3) SHA1(354962aca1710ac75b40c8c23a6c303938f9d596)) - ROM_LOAD( "tk80-3.bin", 0x0200, 0x0100, CRC(8d4b02ef) SHA1(2b5a1ee8f97db23ffec48b96f12986461024c995)) -ROM_END - -ROM_START( ics8080 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "amtsmnonv27.rom1", 0x0000, 0x0800, CRC(82d40dc5) SHA1(9215457101c3b9b8706dbebe902196494993a282) ) - ROM_LOAD( "thmcplv11.rom2", 0x0800, 0x0800, CRC(51784f70) SHA1(c05c75d566c4ff8f681eba29cd48e72b95be89e0) ) - ROM_LOAD( "tunev08.rom3", 0x1000, 0x0800, CRC(aae2344b) SHA1(b02b22cadb43c7ac26c43d443688b9b19d465973) ) - ROM_LOAD( "mtrspdv12.rom4", 0x1800, 0x0800, CRC(920dda33) SHA1(631ee5e6314d9788e7be0ae00a97b55693eeb855) ) -ROM_END - -ROM_START( mikrolab ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - /* these dumps are taken from PDF so need check with real device */ - ROM_LOAD( "rom-1.bin", 0x0000, 0x0200, BAD_DUMP CRC(eed5f23b) SHA1(c82f7a16ce44c4fcbcb333245555feae1fcdf058)) - ROM_LOAD( "rom-2.bin", 0x0200, 0x0200, BAD_DUMP CRC(726a224f) SHA1(7ed8d2c6dd4fb7836475e207e1972e33a6a91d2f)) -ROM_END - -ROM_START( nectk85 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "tk85.bin", 0x0000, 0x0800, CRC(8a0b6d7e) SHA1(6acc8c04990692b08929043ccf638761b7301def)) -ROM_END - -ROM_START( nd80z ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "nd80z.bin", 0x0000, 0x0800, CRC(fe829f1d) SHA1(6fff31884b8d984076d4450ca3a3e48efadeb648)) -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1976, tk80, 0, 0, tk80, tk80, driver_device, 0, "Nippon Electronic Company", "TK-80", MACHINE_NO_SOUND_HW) -COMP( 1980, nectk85, tk80, 0, tk85, tk80, driver_device, 0, "Nippon Electronic Company", "TK-85", MACHINE_NO_SOUND_HW) -COMP( 19??, nd80z, tk80, 0, nd80z, tk80, driver_device, 0, "Chunichi", "ND-80Z", MACHINE_NO_SOUND_HW) -COMP( 19??, mikrolab, tk80, 0, mikrolab, mikrolab, driver_device, 0, "", "Mikrolab KR580IK80", MACHINE_NO_SOUND_HW) -COMP( 19??, ics8080, tk80, 0, ics8080, ics8080, driver_device, 0, "", "ICS8080", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/tk80bs.c b/src/mess/drivers/tk80bs.c deleted file mode 100644 index 99d6f1f1db5..00000000000 --- a/src/mess/drivers/tk80bs.c +++ /dev/null @@ -1,225 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese, Robbbert -/*************************************************************************** - - -NEC TK80BS -********** -TK-80BS (c) 1980 NEC - -Preliminary driver by Angelo Salese -Various additions by Robbbert - -The TK80BS (Basic Station) has a plugin keyboard, BASIC in rom, -and connected to a tv. - -TODO: - - (try to) dump proper roms, the whole driver is based off fake roms; - - bios 0 BASIC doesn't seem to work properly; (It does if you type NEW first) - - bios 1 does not boot up because it runs off into the weeds - - bios 2 also does that, somehow it starts up anyway, but no commands work - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "machine/keyboard.h" - -#define KEYBOARD_TAG "keyboard" - -class tk80bs_state : public driver_device -{ -public: - tk80bs_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_ppi(*this, "ppi"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { - } - - DECLARE_READ8_MEMBER(ppi_custom_r); - DECLARE_WRITE8_MEMBER(ppi_custom_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(port_a_r); - DECLARE_READ8_MEMBER(port_b_r); - UINT32 screen_update_tk80bs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; -private: - UINT8 m_term_data; - required_device m_maincpu; - required_device m_ppi; - required_device m_gfxdecode; - required_device m_palette; -}; - - -UINT32 tk80bs_state::screen_update_tk80bs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - int count; - - count = 0; - - for(y=0;y<16;y++) - { - for(x=0;x<32;x++) - { - int tile = m_p_videoram[count++]; - - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*8); - } - } - - return 0; -} - -/* A0 and A1 are swapped at the 8255 chip */ -READ8_MEMBER( tk80bs_state::ppi_custom_r ) -{ - switch(offset) - { - case 1: - return m_ppi->read(space, 2); - case 2: - return m_ppi->read(space, 1); - default: - return m_ppi->read(space, offset); - } -} - -WRITE8_MEMBER( tk80bs_state::ppi_custom_w ) -{ - switch(offset) - { - case 1: - m_ppi->write(space, 2, data); - break; - case 2: - m_ppi->write(space, 1, data); - break; - default: - m_ppi->write(space, offset, data); - } -} - -static ADDRESS_MAP_START(tk80bs_mem, AS_PROGRAM, 8, tk80bs_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM -// AM_RANGE(0x0c00, 0x7bff) AM_ROM // ext - AM_RANGE(0x7df8, 0x7df9) AM_NOP // i8251 sio - AM_RANGE(0x7dfc, 0x7dff) AM_READWRITE(ppi_custom_r,ppi_custom_w) - AM_RANGE(0x7e00, 0x7fff) AM_RAM AM_SHARE("videoram") // video ram - AM_RANGE(0x8000, 0xcfff) AM_RAM // RAM - AM_RANGE(0xd000, 0xefff) AM_ROM // BASIC - AM_RANGE(0xf000, 0xffff) AM_ROM // BSMON -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( tk80bs ) -INPUT_PORTS_END - -READ8_MEMBER( tk80bs_state::port_a_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - - -READ8_MEMBER( tk80bs_state::port_b_r ) -{ - if (m_term_data) - { - m_ppi->pc4_w(0); // send a strobe pulse - return 0x20; - } - else - return 0; -} - -WRITE8_MEMBER( tk80bs_state::kbd_put ) -{ - data &= 0x7f; - if (data > 0x5f) data-=0x20; - m_term_data = data; -} - -/* F4 Character Displayer */ -static const gfx_layout tk80bs_charlayout = -{ - 8, 8, - 512, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static GFXDECODE_START( tk80bs ) - GFXDECODE_ENTRY( "chargen", 0x0000, tk80bs_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( tk80bs, tk80bs_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_1MHz) //unknown clock - MCFG_CPU_PROGRAM_MAP(tk80bs_mem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 128) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 128-1) - MCFG_SCREEN_UPDATE_DRIVER(tk80bs_state, screen_update_tk80bs) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tk80bs) - - /* Devices */ - MCFG_DEVICE_ADD("ppi", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(tk80bs_state, port_a_r)) - MCFG_I8255_IN_PORTB_CB(READ8(tk80bs_state, port_b_r)) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(tk80bs_state, kbd_put)) -MACHINE_CONFIG_END - - -ROM_START( tk80bs ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - /* all of these aren't taken from an original machine*/ - ROM_SYSTEM_BIOS(0, "psedo", "Pseudo LEVEL 1") - ROMX_LOAD( "tk80.dummy", 0x0000, 0x0800, BAD_DUMP CRC(553b25ca) SHA1(939350d7fa56ce567ddf393c9f4b9db6ebc18a2c), ROM_BIOS(1)) - ROMX_LOAD( "ext.l1", 0x0c00, 0x6e46, BAD_DUMP CRC(d05ed3ff) SHA1(8544aa2cb58df9edf221f5be2cdafa248dd33828), ROM_BIOS(1)) - ROMX_LOAD( "lv1basic.l1",0xe000, 0x09a2, BAD_DUMP CRC(3ff67a71) SHA1(528c9331740637e853c099e1739ecdea6dd200bc), ROM_BIOS(1)) - ROMX_LOAD( "bsmon.l1", 0xf000, 0x0db0, BAD_DUMP CRC(5daa599b) SHA1(7e6ec5bfb3eea114f7ee9ef589a89246b8533b2f), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS(1, "psedo10", "Pseudo LEVEL 2 1.0") - ROMX_LOAD( "tk80.dummy", 0x0000, 0x0800, BAD_DUMP CRC(553b25ca) SHA1(939350d7fa56ce567ddf393c9f4b9db6ebc18a2c), ROM_BIOS(2)) - ROMX_LOAD( "ext.10", 0x0c00, 0x3dc2, BAD_DUMP CRC(3c64d488) SHA1(919180d5b34b981ab3dd8b2885d3c0933203f355), ROM_BIOS(2)) - ROMX_LOAD( "lv2basic.10",0xd000, 0x2000, BAD_DUMP CRC(594fe70e) SHA1(5854c1be5fa78c1bfee365379495f14bc23e15e7), ROM_BIOS(2)) - ROMX_LOAD( "bsmon.10", 0xf000, 0x0daf, BAD_DUMP CRC(d0047983) SHA1(79e2b5dc47b574b55375cbafffff144744093ec1), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS(2, "psedo11", "Pseudo LEVEL 2 1.1") - ROMX_LOAD( "tk80.dummy", 0x0000, 0x0800, BAD_DUMP CRC(553b25ca) SHA1(939350d7fa56ce567ddf393c9f4b9db6ebc18a2c), ROM_BIOS(3)) - ROMX_LOAD( "ext.11", 0x0c00, 0x3dd4, BAD_DUMP CRC(bd5c5169) SHA1(2ad70828348372328b76bac0fa93d3f6f17ade34), ROM_BIOS(3)) - ROMX_LOAD( "lv2basic.11",0xd000, 0x2000, BAD_DUMP CRC(3df9a3bd) SHA1(9539409c876bce27d630fe47d07a4316d2ce09cb), ROM_BIOS(3)) - ROMX_LOAD( "bsmon.11", 0xf000, 0x0ff6, BAD_DUMP CRC(fca7a609) SHA1(7c7eb5e5e4cf1e0021383bdfc192b88262aba6f5), ROM_BIOS(3)) - - ROM_REGION( 0x1000, "chargen", ROMREGION_ERASEFF ) - ROM_LOAD( "font.rom", 0x0000, 0x1000, BAD_DUMP CRC(94d95199) SHA1(9fe741eab866b0c520d4108bccc6277172fa190c)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, tk80bs, tk80, 0, tk80bs, tk80bs, driver_device, 0, "Nippon Electronic Company", "TK-80BS", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/tm990189.c b/src/mess/drivers/tm990189.c deleted file mode 100644 index f6c778dd305..00000000000 --- a/src/mess/drivers/tm990189.c +++ /dev/null @@ -1,1051 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet, Robbbert -/* - Experimental tm990/189 ("University Module") driver. - - The tm990/189 is a simple board built around a tms9980 at 2.0 MHz. - The board features: - * a calculator-like alphanumeric keyboard, a 10-digit 8-segment display, - a sound buzzer and 4 status LEDs - * a 4kb ROM socket (0x3000-0x3fff), and a 2kb ROM socket (0x0800-0x0fff) - * 1kb of RAM expandable to 2kb (0x0000-0x03ff and 0x0400-0x07ff) - * a tms9901 controlling a custom parallel I/O port (available for - expansion) - * an optional on-board serial interface (either TTY or RS232): TI ROMs - support a terminal connected to this port - * an optional tape interface - * an optional bus extension port for adding additional custom devices (TI - sold a video controller expansion built around a tms9918, which was - supported by University Basic) - - One tms9901 is set up so that it handles tms9980 interrupts. The other - tms9901, the tms9902, and extension cards can trigger interrupts on the - interrupt-handling tms9901. - - TI sold two ROM sets for this machine: a monitor and assembler ("UNIBUG", - packaged as one 4kb EPROM) and a Basic interpreter ("University BASIC", - packaged as a 4kb and a 2kb EPROM). Users could burn and install custom - ROM sets, too. - - This board was sold to universities to learn either assembly language or - BASIC programming. - - A few hobbyists may have bought one of these, too. This board can actually - be used as a development kit for the tms9980, but it was not supported as - such (there was no EPROM programmer or mass storage system for the - tm990/189, though you could definitively design your own and attach them to - the extension port). - - - Raphael Nabet 2003 - - Bug - The input buffer of character segments isn't fully cleared. If you - press Shift, then Z enough times, garbage appears. This is because - the boot process should have set 18C-1CB to FF, but only sets up to 1B3. - - Need a dump of the UNIBUG rom. - - Demo programs for the 990189v: You can get impressive colour displays (with - sprites) from the 4 included demos. Press the Enter key after each instruction, - and wait for the READY prompt before proceeding to the next. - - NEW - LOADx (where x = 0,1,2,3) - RUN - - University BASIC fully supports the tms9918 videocard option. For example, enter - COLOR x (where x = 1 to 15), to get a coloured background. - - - Robbbert 2011 - -******************************************************************************************/ - -#include "emu.h" -#include "cpu/tms9900/tms9980a.h" -#include "machine/tms9901.h" -#include "machine/tms9902.h" -#include "video/tms9928a.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "tm990189.lh" -#include "tm990189v.lh" - -#define TMS9901_0_TAG "tms9901_usr" -#define TMS9901_1_TAG "tms9901_sys" - -class tm990189_state : public driver_device -{ -public: - tm990189_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_tms9980a(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cass(*this, "cassette"), - m_tms9918(*this, "tms9918" ), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_tms9901_usr(*this, TMS9901_0_TAG), - m_tms9901_sys(*this, TMS9901_1_TAG) { } - - required_device m_tms9980a; - required_device m_speaker; - required_device m_cass; - optional_device m_tms9918; - - DECLARE_READ8_MEMBER( interrupt_level ); - - DECLARE_READ8_MEMBER(video_vdp_r); - DECLARE_WRITE8_MEMBER(video_vdp_w); - DECLARE_READ8_MEMBER(video_joy_r); - DECLARE_WRITE8_MEMBER(video_joy_w); - int m_load_state; - - int m_digitsel; - int m_segment; - emu_timer *m_displayena_timer; - UINT8 m_segment_state[10]; - UINT8 m_old_segment_state[10]; - UINT8 m_LED_state; - emu_timer *m_joy1x_timer; - emu_timer *m_joy1y_timer; - emu_timer *m_joy2x_timer; - emu_timer *m_joy2y_timer; - device_image_interface *m_rs232_fp; - UINT8 m_rs232_rts; - emu_timer *m_rs232_input_timer; - UINT8 m_bogus_read_save; - - DECLARE_WRITE8_MEMBER( external_operation ); - - DECLARE_INPUT_CHANGED_MEMBER( load_interrupt ); - - DECLARE_WRITE_LINE_MEMBER(usr9901_led0_w); - DECLARE_WRITE_LINE_MEMBER(usr9901_led1_w); - DECLARE_WRITE_LINE_MEMBER(usr9901_led2_w); - DECLARE_WRITE_LINE_MEMBER(usr9901_led3_w); - DECLARE_WRITE8_MEMBER(usr9901_interrupt_callback); - - DECLARE_WRITE8_MEMBER(sys9901_interrupt_callback); - DECLARE_READ8_MEMBER(sys9901_r); - DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel0_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel1_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel2_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel3_w); - - DECLARE_WRITE_LINE_MEMBER(sys9901_segment0_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment1_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment2_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment3_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment4_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment5_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment6_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_segment7_w); - - DECLARE_WRITE_LINE_MEMBER(sys9901_dsplytrgr_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_shiftlight_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_spkrdrive_w); - DECLARE_WRITE_LINE_MEMBER(sys9901_tapewdata_w); - - DECLARE_WRITE8_MEMBER( xmit_callback ); - DECLARE_MACHINE_START(tm990_189); - DECLARE_MACHINE_RESET(tm990_189); - DECLARE_MACHINE_START(tm990_189_v); - DECLARE_MACHINE_RESET(tm990_189_v); - - TIMER_DEVICE_CALLBACK_MEMBER(display_callback); - TIMER_CALLBACK_MEMBER(clear_load); - void hold_load(); -private: - void draw_digit(void); - void led_set(int number, bool state); - void segment_set(int offset, bool state); - void digitsel(int offset, bool state); - required_device m_maincpu; - required_device m_cassette; - required_device m_tms9901_usr; - required_device m_tms9901_sys; -}; - - -#define displayena_duration attotime::from_usec(4500) /* Can anyone confirm this? 74LS123 connected to C=0.1uF and R=100kOhm */ - -MACHINE_RESET_MEMBER(tm990189_state,tm990_189) -{ - m_tms9980a->set_ready(ASSERT_LINE); - m_tms9980a->set_hold(CLEAR_LINE); - hold_load(); -} - -MACHINE_START_MEMBER(tm990189_state,tm990_189) -{ - m_displayena_timer = machine().scheduler().timer_alloc(FUNC_NULL); -} - -MACHINE_START_MEMBER(tm990189_state,tm990_189_v) -{ - m_displayena_timer = machine().scheduler().timer_alloc(FUNC_NULL); - - m_joy1x_timer = machine().scheduler().timer_alloc(FUNC_NULL); - m_joy1y_timer = machine().scheduler().timer_alloc(FUNC_NULL); - m_joy2x_timer = machine().scheduler().timer_alloc(FUNC_NULL); - m_joy2y_timer = machine().scheduler().timer_alloc(FUNC_NULL); -} - -MACHINE_RESET_MEMBER(tm990189_state,tm990_189_v) -{ - m_tms9980a->set_ready(ASSERT_LINE); - m_tms9980a->set_hold(CLEAR_LINE); - hold_load(); -} - -/* - hold and debounce load line (emulation is inaccurate) -*/ - -TIMER_CALLBACK_MEMBER(tm990189_state::clear_load) -{ - m_load_state = FALSE; - m_tms9980a->set_input_line(INT_9980A_LOAD, CLEAR_LINE); -} - -void tm990189_state::hold_load() -{ - m_load_state = TRUE; - m_tms9980a->set_input_line(INT_9980A_LOAD, ASSERT_LINE); - machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(tm990189_state::clear_load),this)); -} - -/* - LOAD interrupt switch -*/ -INPUT_CHANGED_MEMBER( tm990189_state::load_interrupt ) -{ - // When depressed, fire LOAD (neg logic) - if (newval==CLEAR_LINE) hold_load(); -} - - -/* - tm990_189 video emulation. - - Has an integrated 10 digit 8-segment display. - Supports EIA and TTY terminals, and an optional 9918 controller. -*/ - -void tm990189_state::draw_digit() -{ - m_segment_state[m_digitsel] |= ~m_segment; -} - - -TIMER_DEVICE_CALLBACK_MEMBER(tm990189_state::display_callback) -{ - UINT8 i; - char ledname[8]; - // since the segment data is cleared after being used, the old_segment is there - // in case the segment data hasn't been refreshed yet. - for (i = 0; i < 10; i++) - { - m_old_segment_state[i] |= m_segment_state[i]; - sprintf(ledname,"digit%d",i); - output_set_digit_value(i, m_old_segment_state[i]); - m_old_segment_state[i] = m_segment_state[i]; - m_segment_state[i] = 0; - } - - for (i = 0; i < 7; i++) - { - sprintf(ledname,"led%d",i); - output_set_value(ledname, !BIT(m_LED_state, i)); - } -} - -/* - tms9901 code -*/ - -WRITE8_MEMBER( tm990189_state::usr9901_interrupt_callback ) -{ - // Triggered by internal timer (set by ROM to 1.6 ms cycle) on level 3 - // or by keyboard interrupt (level 6) - if (!m_load_state) - { - m_tms9980a->set_input_line(offset & 7, ASSERT_LINE); - } -} - -void tm990189_state::led_set(int offset, bool state) -{ - if (state) - m_LED_state |= (1 << offset); - else - m_LED_state &= ~(1 << offset); -} - -WRITE_LINE_MEMBER( tm990189_state::usr9901_led0_w ) -{ - led_set(0, state); -} - -WRITE_LINE_MEMBER( tm990189_state::usr9901_led1_w ) -{ - led_set(1, state); -} - -WRITE_LINE_MEMBER( tm990189_state::usr9901_led2_w ) -{ - led_set(2, state); -} - -WRITE_LINE_MEMBER( tm990189_state::usr9901_led3_w ) -{ - led_set(3, state); -} - -WRITE8_MEMBER( tm990189_state::sys9901_interrupt_callback ) -{ - // machine().device("tms9901_0")->set_single_int(5, (data!=0)? ASSERT_LINE:CLEAR_LINE); - // TODO: Check this - m_tms9901_usr->set_single_int(5, (data!=0)? ASSERT_LINE:CLEAR_LINE); -} - -READ8_MEMBER( tm990189_state::sys9901_r ) -{ - UINT8 data = 0; - if (offset == TMS9901_CB_INT7) - { - static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8" }; - - /* keyboard read */ - if (m_digitsel < 9) - data |= ioport(keynames[m_digitsel])->read() << 1; - - /* tape input */ - if (m_cass->input() > 0.0) - data |= 0x40; - } - - return data; -} - -void tm990189_state::digitsel(int offset, bool state) -{ - if (state) - m_digitsel |= 1 << offset; - else - m_digitsel &= ~ (1 << offset); -} - -WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel0_w ) -{ - digitsel(0, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel1_w ) -{ - digitsel(1, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel2_w ) -{ - digitsel(2, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel3_w ) -{ - digitsel(3, state); -} - - -void tm990189_state::segment_set(int offset, bool state) -{ - if (state) - m_segment |= 1 << offset; - else - { - m_segment &= ~ (1 << offset); - if ((m_displayena_timer->remaining() > attotime::zero) && (m_digitsel < 10)) - draw_digit(); - } -} - -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment0_w ) -{ - segment_set(0, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment1_w ) -{ - segment_set(1, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment2_w ) -{ - segment_set(2, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment3_w ) -{ - segment_set(3, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment4_w ) -{ - segment_set(4, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment5_w ) -{ - segment_set(5, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment6_w ) -{ - segment_set(6, state); -} -WRITE_LINE_MEMBER( tm990189_state::sys9901_segment7_w ) -{ - segment_set(7, state); -} - -WRITE_LINE_MEMBER( tm990189_state::sys9901_dsplytrgr_w ) -{ - if ((!state) && (m_digitsel < 10)) - { - m_displayena_timer->reset(displayena_duration); - draw_digit(); - } -} - -WRITE_LINE_MEMBER( tm990189_state::sys9901_shiftlight_w ) -{ - if (state) - m_LED_state |= 0x10; - else - m_LED_state &= ~0x10; -} - -WRITE_LINE_MEMBER( tm990189_state::sys9901_spkrdrive_w ) -{ - m_speaker->level_w(state); -} - -WRITE_LINE_MEMBER( tm990189_state::sys9901_tapewdata_w ) -{ - m_cassette->output(state ? +1.0 : -1.0); -} - -class tm990_189_rs232_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - tm990_189_rs232_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_SERIAL; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return ""; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); -}; - -const device_type TM990_189_RS232 = &device_creator; - -tm990_189_rs232_image_device::tm990_189_rs232_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, TM990_189_RS232, "TM990/189 RS232 port", tag, owner, clock, "tm990_189_rs232_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -void tm990_189_rs232_image_device::device_config_complete() -{ - update_names(); -} - -void tm990_189_rs232_image_device::device_start() -{ -} - -void tm990_189_rs232_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - //tm990189_state *state = machine.driver_data(); - UINT8 buf; - if (/*state->m_rs232_rts &&*/ /*(mame_ftell(state->m_rs232_fp) < mame_fsize(state->m_rs232_fp))*/1) - { - tms9902_device* tms9902 = static_cast(machine().device("tms9902")); - if (fread(&buf, 1) == 1) - tms9902->rcv_data(buf); - } -} - -bool tm990_189_rs232_image_device::call_load() -{ - tm990189_state *state = machine().driver_data(); - tms9902_device* tms9902 = static_cast(machine().device("tms9902")); - tms9902->rcv_dsr(ASSERT_LINE); - state->m_rs232_input_timer = timer_alloc(); - state->m_rs232_input_timer->adjust(attotime::zero, 0, attotime::from_msec(10)); - return IMAGE_INIT_PASS; -} - - -void tm990_189_rs232_image_device::call_unload() -{ - tm990189_state *state = machine().driver_data(); - tms9902_device* tms9902 = static_cast(machine().device("tms9902")); - tms9902->rcv_dsr(CLEAR_LINE); - - state->m_rs232_input_timer->reset(); /* FIXME - timers should only be allocated once */ -} - -#define MCFG_TM990_189_RS232_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, TM990_189_RS232, 0) - - -/* static TMS9902_RTS_CALLBACK( rts_callback ) -{ - tm990189 *state = device->machine().driver_data(); - state->m_rs232_rts = RTS; - tms9902->set_cts(RTS); -} */ - -WRITE8_MEMBER( tm990189_state::xmit_callback ) -{ - UINT8 buf = data; - if (m_rs232_fp) m_rs232_fp->fwrite(&buf, 1); -} - -/* - External instruction decoding -*/ -WRITE8_MEMBER( tm990189_state::external_operation ) -{ - switch (offset) - { - case 2: // IDLE - if (data) - m_LED_state |= 0x40; - else - m_LED_state &= ~0x40; - break; - case 3: // RSET - // Not used on the default board - break; - case 5: // CKON: set DECKCONTROL - m_LED_state |= 0x20; - m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - break; - case 6: // CKOF: clear DECKCONTROL - m_LED_state &= ~0x20; - m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - break; - case 7: // LREX: trigger LOAD - hold_load(); - break; - default: // undefined - break; - } -} - -/* - Video Board handling -*/ - -READ8_MEMBER( tm990189_state::video_vdp_r ) -{ - int reply = 0; - - /* When the tms9980 reads @>2000 or @>2001, it actually does a word access: - it reads @>2000 first, then @>2001. According to schematics, both access - are decoded to the VDP: read accesses are therefore bogus, all the more so - since the two reads are too close (1us) for the VDP to be able to reload - the read buffer: the read address pointer is probably incremented by 2, but - only the first byte is valid. There is a work around for this problem: all - you need is reloading the address pointer before each read. However, - software always uses the second byte, which is very weird, particularly - for the status port. Presumably, since the read buffer has not been - reloaded, the second byte read from the memory read port is equal to the - first; however, this explanation is not very convincing for the status - port. Still, I do not have any better explanation, so I will stick with - it. */ - - if (offset & 2) - reply = m_tms9918->register_read(space, 0); - else - reply = m_tms9918->vram_read(space, 0); - - if (!(offset & 1)) - m_bogus_read_save = reply; - else - reply = m_bogus_read_save; - - return reply; -} - -WRITE8_MEMBER( tm990189_state::video_vdp_w ) -{ - if (offset & 1) - { - if (offset & 2) - m_tms9918->register_write(space, 0, data); - else - m_tms9918->vram_write(space, 0, data); - } -} - -READ8_MEMBER( tm990189_state::video_joy_r ) -{ - UINT8 data = ioport("BUTTONS")->read(); - - if (m_joy1x_timer->remaining() < attotime::zero) - data |= 0x01; - - if (m_joy1y_timer->remaining() < attotime::zero) - data |= 0x02; - - if (m_joy2x_timer->remaining() < attotime::zero) - data |= 0x08; - - if (m_joy2y_timer->remaining() < attotime::zero) - data |= 0x10; - - return data; -} - -WRITE8_MEMBER( tm990189_state::video_joy_w ) -{ - m_joy1x_timer->reset(attotime::from_usec(ioport("JOY1_X")->read()*28+28)); - m_joy1y_timer->reset(attotime::from_usec(ioport("JOY1_Y")->read()*28+28)); - m_joy2x_timer->reset(attotime::from_usec(ioport("JOY2_X")->read()*28+28)); - m_joy2y_timer->reset(attotime::from_usec(ioport("JOY2_Y")->read()*28+28)); -} - -/* -// user tms9901 setup -static const tms9901_interface usr9901reset_param = -{ - TMS9901_INT1 | TMS9901_INT2 | TMS9901_INT3 | TMS9901_INT4 | TMS9901_INT5 | TMS9901_INT6, // only input pins whose state is always known - - // Read handler. Covers all input lines (see tms9901.h) - DEVCB_NULL, - - // write handlers - { - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led0_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led1_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led2_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led3_w), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL - }, - - // interrupt handler - DEVCB_DRIVER_MEMBER(tm990189_state, usr9901_interrupt_callback) -}; -*/ - -/* -// system tms9901 setup -static const tms9901_interface sys9901reset_param = -{ - 0, // only input pins whose state is always known - - // Read handler. Covers all input lines (see tms9901.h) - DEVCB_DRIVER_MEMBER(tm990189_state, sys9901_r), - - // write handlers - { - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel0_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel1_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel2_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel3_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment0_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment1_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment2_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment3_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment4_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment5_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment6_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment7_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_dsplytrgr_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_shiftlight_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_spkrdrive_w), - DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_tapewdata_w) - }, - - // interrupt handler - DEVCB_DRIVER_MEMBER(tm990189_state, sys9901_interrupt_callback) -}; - -*/ - -/* - Memory map: - - 0x0000-0x03ff: 1kb RAM - 0x0400-0x07ff: 1kb onboard expansion RAM - 0x0800-0x0bff or 0x0800-0x0fff: 1kb or 2kb onboard expansion ROM - 0x1000-0x2fff: reserved for offboard expansion - Only known card: Color Video Board - 0x1000-0x17ff (R): Video board ROM 1 - 0x1800-0x1fff (R): Video board ROM 2 - 0x2000-0x27ff (R): tms9918 read ports (bogus) - (address & 2) == 0: data port (bogus) - (address & 2) == 1: status register (bogus) - 0x2800-0x2fff (R): joystick read port - d2: joy 2 switch - d3: joy 2 Y (length of pulse after retrigger is proportional to axis position) - d4: joy 2 X (length of pulse after retrigger is proportional to axis position) - d2: joy 1 switch - d3: joy 1 Y (length of pulse after retrigger is proportional to axis position) - d4: joy 1 X (length of pulse after retrigger is proportional to axis position) - 0x1801-0x1fff ((address & 1) == 1) (W): joystick write port (retrigger) - 0x2801-0x2fff ((address & 1) == 1) (W): tms9918 write ports - (address & 2) == 0: data port - (address & 2) == 1: control register - 0x3000-0x3fff: 4kb onboard ROM -*/ - -static ADDRESS_MAP_START( tm990_189_memmap, AS_PROGRAM, 8, tm990189_state ) - AM_RANGE(0x0000, 0x07ff) AM_RAM /* RAM */ - AM_RANGE(0x0800, 0x0fff) AM_ROM /* extra ROM - application programs with unibug, remaining 2kb of program for university basic */ - AM_RANGE(0x1000, 0x2fff) AM_NOP /* reserved for expansion (RAM and/or tms9918 video controller) */ - AM_RANGE(0x3000, 0x3fff) AM_ROM /* main ROM - unibug or university basic */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tm990_189_v_memmap, AS_PROGRAM, 8, tm990189_state ) - AM_RANGE(0x0000, 0x07ff) AM_RAM /* RAM */ - AM_RANGE(0x0800, 0x0fff) AM_ROM /* extra ROM - application programs with unibug, remaining 2kb of program for university basic */ - - AM_RANGE(0x1000, 0x17ff) AM_ROM AM_WRITENOP /* video board ROM 1 */ - AM_RANGE(0x1800, 0x1fff) AM_ROM AM_WRITE(video_joy_w) /* video board ROM 2 and joystick write port*/ - AM_RANGE(0x2000, 0x27ff) AM_READ(video_vdp_r) AM_WRITENOP /* video board tms9918 read ports (bogus) */ - AM_RANGE(0x2800, 0x2fff) AM_READWRITE(video_joy_r, video_vdp_w) /* video board joystick read port and tms9918 write ports */ - - AM_RANGE(0x3000, 0x3fff) AM_ROM /* main ROM - unibug or university basic */ -ADDRESS_MAP_END - -/* - CRU map - - The board features one tms9901 for keyboard and sound I/O, another tms9901 - to drive the parallel port and a few LEDs and handle tms9980 interrupts, - and one optional tms9902 for serial I/O. - - * bits >000->1ff (R12=>000->3fe): first TMS9901: parallel port, a few LEDs, - interrupts - - CRU bits 1-5: UINT1* through UINT5* (jumper connectable to parallel - port or COMINT from tms9902) - - CRU bit 6: KBINT (interrupt request from second tms9901) - - CRU bits 7-15: mirrors P15-P7 - - CRU bits 16-31: P0-P15 (parallel port) - (bits 16, 17, 18 and 19 control LEDs numbered 1, 2, 3 and 4, too) - * bits >200->3ff (R12=>400->7fe): second TMS9901: display, keyboard and - sound - - CRU bits 1-5: KB1*-KB5* (inputs from current keyboard row) - - CRU bit 6: RDATA (tape in) - - CRU bits 7-15: mirrors P15-P7 - - CRU bits 16-19: DIGITSELA-DIGITSELD (select current display digit and - keyboard row) - - CRU bits 20-27: SEGMENTA*-SEGMENTG* and SEGMENTP* (drives digit - segments) - - CRU bit 28: DSPLYTRGR*: used as an alive signal for a watchdog circuit - which turns off the display when the program hangs and - LED segments would continuously emit light - - - bit 29: SHIFTLIGHT (controls shift light) - - bit 30: SPKRDRIVE (controls buzzer) - - bit 31: WDATA (tape out) - * bits >400->5ff (R12=>800->bfe): optional TMS9902 - * bits >600->7ff (R12=>c00->ffe): reserved for expansion - * write 0 to bits >1000->17ff: IDLE: flash IDLE LED - * write 0 to bits >1800->1fff: RSET: not connected, but it is decoded and - hackers can connect any device they like to this pin - * write 1 to bits >0800->0fff: CKON: light FWD LED and activates - DECKCONTROL* signal (part of tape interface) - * write 1 to bits >1000->17ff: CKOF: light off FWD LED and deactivates - DECKCONTROL* signal (part of tape interface) - * write 1 to bits >1800->1fff: LREX: trigger load interrupt - - Keyboard map: see input ports - - Display segment designation: - a - ___ - | | - f| |b - |___| - | g | - e| |c - |___| .p - d -*/ - -static ADDRESS_MAP_START( tm990_189_cru_map, AS_IO, 8, tm990189_state ) - AM_RANGE(0x0000, 0x003f) AM_DEVREAD(TMS9901_0_TAG, tms9901_device, read) /* user I/O tms9901 */ - AM_RANGE(0x0040, 0x006f) AM_DEVREAD(TMS9901_1_TAG, tms9901_device, read) /* system I/O tms9901 */ - AM_RANGE(0x0080, 0x00cf) AM_DEVREAD("tms9902", tms9902_device, cruread) /* optional tms9902 */ - - AM_RANGE(0x0000, 0x01ff) AM_DEVWRITE(TMS9901_0_TAG, tms9901_device, write) /* user I/O tms9901 */ - AM_RANGE(0x0200, 0x03ff) AM_DEVWRITE(TMS9901_1_TAG, tms9901_device, write) /* system I/O tms9901 */ - AM_RANGE(0x0400, 0x05ff) AM_DEVWRITE("tms9902", tms9902_device, cruwrite) /* optional tms9902 */ -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( tm990_189, tm990189_state ) - /* basic machine hardware */ - MCFG_TMS99xx_ADD("maincpu", TMS9980A, 2000000, tm990_189_memmap, tm990_189_cru_map) - MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(tm990189_state, external_operation) ) - - MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189 ) - MCFG_MACHINE_RESET_OVERRIDE(tm990189_state, tm990_189 ) - - /* Video hardware */ - MCFG_DEFAULT_LAYOUT(layout_tm990189) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_CASSETTE_ADD( "cassette" ) - - MCFG_DEVICE_ADD(TMS9901_0_TAG, TMS9901, 2000000) - MCFG_TMS9901_P0_HANDLER( WRITELINE( tm990189_state, usr9901_led0_w) ) - MCFG_TMS9901_P1_HANDLER( WRITELINE( tm990189_state, usr9901_led1_w) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( tm990189_state, usr9901_led2_w) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( tm990189_state, usr9901_led3_w) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( tm990189_state, usr9901_interrupt_callback) ) - - MCFG_DEVICE_ADD(TMS9901_1_TAG, TMS9901, 2000000) - MCFG_TMS9901_READBLOCK_HANDLER( READ8(tm990189_state, sys9901_r) ) - MCFG_TMS9901_P0_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel0_w) ) - MCFG_TMS9901_P1_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel1_w) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel2_w) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel3_w) ) - MCFG_TMS9901_P4_HANDLER( WRITELINE( tm990189_state, sys9901_segment0_w) ) - MCFG_TMS9901_P5_HANDLER( WRITELINE( tm990189_state, sys9901_segment1_w) ) - MCFG_TMS9901_P6_HANDLER( WRITELINE( tm990189_state, sys9901_segment2_w) ) - MCFG_TMS9901_P7_HANDLER( WRITELINE( tm990189_state, sys9901_segment3_w) ) - MCFG_TMS9901_P8_HANDLER( WRITELINE( tm990189_state, sys9901_segment4_w) ) - MCFG_TMS9901_P9_HANDLER( WRITELINE( tm990189_state, sys9901_segment5_w) ) - MCFG_TMS9901_P10_HANDLER( WRITELINE( tm990189_state, sys9901_segment6_w) ) - MCFG_TMS9901_P11_HANDLER( WRITELINE( tm990189_state, sys9901_segment7_w) ) - MCFG_TMS9901_P12_HANDLER( WRITELINE( tm990189_state, sys9901_dsplytrgr_w) ) - MCFG_TMS9901_P13_HANDLER( WRITELINE( tm990189_state, sys9901_shiftlight_w) ) - MCFG_TMS9901_P14_HANDLER( WRITELINE( tm990189_state, sys9901_spkrdrive_w) ) - MCFG_TMS9901_P15_HANDLER( WRITELINE( tm990189_state, sys9901_tapewdata_w) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( tm990189_state, sys9901_interrupt_callback) ) - - MCFG_DEVICE_ADD("tms9902", TMS9902, 2000000) // MZ: needs to be fixed once the RS232 support is complete - MCFG_TMS9902_XMIT_CB(WRITE8(tm990189_state, xmit_callback)) /* called when a character is transmitted */ - MCFG_TM990_189_RS232_ADD("rs232") - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_timer", tm990189_state, display_callback, attotime::from_hz(30)) - // Need to delay the timer, or it will spoil the initial LOAD - // TODO: Fix this, probably inside CPU - MCFG_TIMER_START_DELAY(attotime::from_msec(150)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( tm990_189_v, tm990189_state ) - /* basic machine hardware */ - MCFG_TMS99xx_ADD("maincpu", TMS9980A, 2000000, tm990_189_v_memmap, tm990_189_cru_map) - MCFG_TMS99xx_EXTOP_HANDLER( WRITE8(tm990189_state, external_operation) ) - - MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189_v ) - MCFG_MACHINE_RESET_OVERRIDE(tm990189_state, tm990_189_v ) - - /* video hardware */ - MCFG_DEVICE_ADD( "tms9918", TMS9918, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9918", tms9918_device, screen_update ) - MCFG_DEFAULT_LAYOUT(layout_tm990189v) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) /* one two-level buzzer */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_DEVICE_ADD(TMS9901_0_TAG, TMS9901, 2000000) - MCFG_TMS9901_P0_HANDLER( WRITELINE( tm990189_state, usr9901_led0_w) ) - MCFG_TMS9901_P1_HANDLER( WRITELINE( tm990189_state, usr9901_led1_w) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( tm990189_state, usr9901_led2_w) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( tm990189_state, usr9901_led3_w) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( tm990189_state, usr9901_interrupt_callback) ) - - MCFG_DEVICE_ADD(TMS9901_1_TAG, TMS9901, 2000000) - MCFG_TMS9901_READBLOCK_HANDLER( READ8(tm990189_state, sys9901_r) ) - MCFG_TMS9901_P0_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel0_w) ) - MCFG_TMS9901_P1_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel1_w) ) - MCFG_TMS9901_P2_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel2_w) ) - MCFG_TMS9901_P3_HANDLER( WRITELINE( tm990189_state, sys9901_digitsel3_w) ) - MCFG_TMS9901_P4_HANDLER( WRITELINE( tm990189_state, sys9901_segment0_w) ) - MCFG_TMS9901_P5_HANDLER( WRITELINE( tm990189_state, sys9901_segment1_w) ) - MCFG_TMS9901_P6_HANDLER( WRITELINE( tm990189_state, sys9901_segment2_w) ) - MCFG_TMS9901_P7_HANDLER( WRITELINE( tm990189_state, sys9901_segment3_w) ) - MCFG_TMS9901_P8_HANDLER( WRITELINE( tm990189_state, sys9901_segment4_w) ) - MCFG_TMS9901_P9_HANDLER( WRITELINE( tm990189_state, sys9901_segment5_w) ) - MCFG_TMS9901_P10_HANDLER( WRITELINE( tm990189_state, sys9901_segment6_w) ) - MCFG_TMS9901_P11_HANDLER( WRITELINE( tm990189_state, sys9901_segment7_w) ) - MCFG_TMS9901_P12_HANDLER( WRITELINE( tm990189_state, sys9901_dsplytrgr_w) ) - MCFG_TMS9901_P13_HANDLER( WRITELINE( tm990189_state, sys9901_shiftlight_w) ) - MCFG_TMS9901_P14_HANDLER( WRITELINE( tm990189_state, sys9901_spkrdrive_w) ) - MCFG_TMS9901_P15_HANDLER( WRITELINE( tm990189_state, sys9901_tapewdata_w) ) - MCFG_TMS9901_INTLEVEL_HANDLER( WRITE8( tm990189_state, sys9901_interrupt_callback) ) - - MCFG_DEVICE_ADD("tms9902", TMS9902, 2000000) // MZ: needs to be fixed once the RS232 support is complete - MCFG_TMS9902_XMIT_CB(WRITE8(tm990189_state, xmit_callback)) /* called when a character is transmitted */ - MCFG_TM990_189_RS232_ADD("rs232") - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_timer", tm990189_state, display_callback, attotime::from_hz(30)) - MCFG_TIMER_START_DELAY(attotime::from_msec(150)) -MACHINE_CONFIG_END - - -/* - ROM loading -*/ -ROM_START(990189) - /*CPU memory space*/ - ROM_REGION(0x4000, "maincpu", 0 ) - - /* extra ROM */ - ROM_LOAD("990-469.u32", 0x0800, 0x0800, CRC(08df7edb) SHA1(fa9751fd2e3e5d7ae03819fc9c7099e2ddd9fb53)) - - /* boot ROM */ - ROM_LOAD("990-469.u33", 0x3000, 0x1000, CRC(e9b4ac1b) SHA1(96e88f4cb7a374033cdf3af0dc26ca5b1d55b9f9)) -ROM_END - -ROM_START(990189v) - /*CPU memory space*/ - ROM_REGION(0x4000, "maincpu", 0 ) - - /* extra ROM */ - ROM_LOAD("990-469.u32", 0x0800, 0x0800, CRC(08df7edb) SHA1(fa9751fd2e3e5d7ae03819fc9c7099e2ddd9fb53)) - - /* extension ROM */ - ROM_LOAD_OPTIONAL("demo1000.u13", 0x1000, 0x0800, CRC(c0e16685) SHA1(d0d314134c42fa4682aafbace67f539f67f6ba65)) - - /* extension ROM */ - ROM_LOAD_OPTIONAL("demo1800.u11", 0x1800, 0x0800, CRC(8737dc4b) SHA1(b87da7aa4d3f909e70f885c4b36999cc1abf5764)) - - /* boot ROM */ - ROM_LOAD("990-469.u33", 0x3000, 0x1000, CRC(e9b4ac1b) SHA1(96e88f4cb7a374033cdf3af0dc26ca5b1d55b9f9)) - /*ROM_LOAD("unibasic.bin", 0x3000, 0x1000, CRC(de4d9744))*/ /* older, partial dump of university BASIC */ -ROM_END - -#define JOYSTICK_DELTA 10 -#define JOYSTICK_SENSITIVITY 100 - -static INPUT_PORTS_START(tm990_189) - - PORT_START( "LOADINT ") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Load interrupt") PORT_CODE(KEYCODE_PRTSCR) PORT_CHANGED_MEMBER(DEVICE_SELF, tm990189_state, load_interrupt, 1) - - /* 45-key calculator-like alphanumeric keyboard... */ - PORT_START("LINE0") /* row 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sp *") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('*') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ret '") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR('\'') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("$ =") PORT_CODE(KEYCODE_STOP) PORT_CHAR('$') PORT_CHAR('=') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("LINE1") /* row 1 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+ (") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('+') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- )") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('-') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ /") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('@') PORT_CHAR('/') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("> %") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('>') PORT_CHAR('%') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('^') - - PORT_START("LINE2") /* row 2 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 .") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('.') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 ;") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(';') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 :") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 ?") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('?') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 !") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('!') - - PORT_START("LINE3") /* row 3 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 _") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \"") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\"') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 #") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (ESC)") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A (SOH)") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - - PORT_START("LINE4") /* row 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B (STH)") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C (ETX)") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D (EOT)") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E (ENQ)") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F (ACK)") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("LINE5") /* row 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G (BEL)") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H (BS)") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I (HT)") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J (LF)") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K (VT)") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - - PORT_START("LINE6") /* row 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L (FF)") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M (DEL)") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N (SO)") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O (SI)") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P (DLE)") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - - PORT_START("LINE7") /* row 7 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q (DC1)") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R (DC2)") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S (DC3)") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T (DC4)") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U (NAK)") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - - PORT_START("LINE8") /* row 8 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V <-D") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W (ETB)") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X (CAN)") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y (EM)") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z ->D") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - - /* analog joysticks (video board only) */ - - PORT_START("BUTTONS") /* joystick 1 & 2 buttons */ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) - - PORT_START("JOY1_X") /* joystick 1, X axis */ - PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(1) - - PORT_START("JOY1_Y") /* joystick 1, Y axis */ - PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(1) PORT_REVERSE - - PORT_START("JOY2_X") /* joystick 2, X axis */ - PORT_BIT( 0x3ff, 0x180, IPT_AD_STICK_X) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x180 ) PORT_PLAYER(2) - - PORT_START("JOY2_Y") /* joystick 2, Y axis */ - PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(2) PORT_REVERSE -INPUT_PORTS_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1978, 990189, 0, 0, tm990_189, tm990_189, driver_device, 0, "Texas Instruments", "TM 990/189 University Board microcomputer" , 0) -COMP( 1980, 990189v, 990189, 0, tm990_189_v, tm990_189, driver_device, 0, "Texas Instruments", "TM 990/189 University Board microcomputer with Video Board Interface" , 0) diff --git a/src/mess/drivers/tmc1800.c b/src/mess/drivers/tmc1800.c deleted file mode 100644 index 728ec7ee446..00000000000 --- a/src/mess/drivers/tmc1800.c +++ /dev/null @@ -1,884 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Telmac 2000 - -PCB Layout ----------- - -|-----------------------------------------------------------| -| | -| | 4051 4042 2114 2114 | -| CN1 | -| | 4051 4042 2114 2114 | -| | -| 4011 4013 |--------| 2114 2114 | -| | 4515 | | -| 4013 |--------| 2114 2114 | -| 4042 | -| 4011 2114 2114 | -| 4011 | -| 4011 2114 2114 | -|SW1 | -| 4011 |--------| 2114 2114 | -| | PROM | | -| 40107 |--------| 2114 2114 | -| 4050 1.75MHz | -| |-------------| 2114 2114 | -| | CDP1802 | | -| |-------------| 2114 2114 | -| 4049 | -| |-------------| 2114 2114 | -| 4.43MHz | CDP1864 | | -| |-------------| 2114 2114 | -| | -| 741 4502 2114 2114 | -| - | -| | 2114 2114 2114 | -| CN2 | -| | 4001 4051 2114 2114 | -| - | -| 2114 2114 | -|-----------------------------------------------------------| - -Notes: - All IC's shown. - - PROM - MMI6341 - 2114 - 2114 4096 Bit (1024x4) NMOS Static RAM - CDP1802 - RCA CDP1802 CMOS 8-Bit Microprocessor @ 1.75 MHz - CDP1864 - RCA CDP1864CE COS/MOS PAL Compatible Color TV Interface @ 1.75 MHz - CN1 - keyboard connector - CN2 - ASTEC RF modulator connector - SW1 - Run/Reset switch - -*/ - -/* - -OSCOM Nano - -PCB Layout ----------- - -OK 30379 - -|-------------------------------------------------| -| CN1 CN2 CN3 7805 | -| 1.75MHz | -| 741 | -| |-------------| - | -| 741 741 4011 | CDP1864 | | | -| |-------------| | | -| 4013 |-------------| | | -| | CDP1802 | | | -| 4093 |-------------| | | -| C | -| 4051 4042 4017 4042 N | -| |-------| 4 | -| | ROM | 14556 | | -| |-------| | | -| 2114 2114 | | -| | | -| 2114 2114 | | -| - | -| 2114 2114 | -| | -| 2114 2114 | -|-------------------------------------------------| - -Notes: - All IC's shown. - - ROM - Intersil 5504? - 2114 - 2114UCB 4096 Bit (1024x4) NMOS Static RAM - CDP1802 - RCA CDP1802E CMOS 8-Bit Microprocessor @ 1.75 MHz - CDP1864 - RCA CDP1864CE COS/MOS PAL Compatible Color TV Interface @ 1.75 MHz - CN1 - tape connector - CN2 - video connector - CN3 - power connector - CN4 - expansion connector - -*/ - -/* - - TODO: - - - tape input/output - - tmc2000: add missing keys - - tmc2000: TOOL-2000 rom banking - - nano: correct time constant for EF4 RC circuit - -*/ - -#include "includes/tmc1800.h" -#include "sound/beep.h" - -/* Read/Write Handlers */ - -WRITE8_MEMBER( tmc1800_state::keylatch_w ) -{ - m_keylatch = data; -} - -WRITE8_MEMBER( osc1000b_state::keylatch_w ) -{ - m_keylatch = data; -} - -WRITE8_MEMBER( tmc2000_state::keylatch_w ) -{ - /* - - bit description - - 0 X0 - 1 X1 - 2 X2 - 3 Y0 - 4 Y1 - 5 Y2 - 6 EXP1 - 7 EXP2 - - */ - - m_keylatch = data & 0x3f; -} - -WRITE8_MEMBER( nano_state::keylatch_w ) -{ - /* - - bit description - - 0 A - 1 B - 2 C - 3 NY0 - 4 NY1 - 5 - 6 - 7 - - */ - - m_keylatch = data & 0x1f; -} - -void tmc2000_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - UINT8 *rom = m_rom->base(); - - if (m_roc) - { - // monitor ROM - program.install_rom(0x0000, 0x01ff, 0, 0x7e00, rom); - } - else - { - // RAM - switch (m_ram->size()) - { - case 4 * 1024: - program.install_ram(0x0000, 0x0fff, 0, 0x7000, ram); - break; - - case 16 * 1024: - program.install_ram(0x0000, 0x3fff, 0, 0x4000, ram); - break; - - case 32 * 1024: - program.install_ram(0x0000, 0x7fff, ram); - break; - } - } - - if (m_rac) - { - // color RAM - program.install_ram(0x8000, 0x81ff, 0, 0x7e00, m_colorram); - program.unmap_read(0x8000, 0x81ff, 0, 0x7e00); - } - else - { - // monitor ROM - program.install_rom(0x8000, 0x81ff, 0, 0x7e00, rom); - } -} - -WRITE8_MEMBER( tmc2000_state::bankswitch_w ) -{ - m_roc = 0; - m_rac = BIT(data, 0); - bankswitch(); - - m_cti->tone_latch_w(space, 0, data); -} - -WRITE8_MEMBER( nano_state::bankswitch_w ) -{ - /* enable RAM */ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - program.install_ram(0x0000, 0x0fff, 0, 0x7000, ram); - - /* write to CDP1864 tone latch */ - m_cti->tone_latch_w(space, 0, data); -} - -READ8_MEMBER( tmc1800_state::dispon_r ) -{ - m_vdc->disp_on_w(1); - m_vdc->disp_on_w(0); - - return 0xff; -} - -WRITE8_MEMBER( tmc1800_state::dispoff_w ) -{ - m_vdc->disp_off_w(1); - m_vdc->disp_off_w(0); -} - -/* Memory Maps */ - -// Telmac 1800 - -static ADDRESS_MAP_START( tmc1800_map, AS_PROGRAM, 8, tmc1800_state ) - AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x7800) AM_RAM - AM_RANGE(0x8000, 0x81ff) AM_MIRROR(0x7e00) AM_ROM AM_REGION(CDP1802_TAG, 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tmc1800_io_map, AS_IO, 8, tmc1800_state ) - AM_RANGE(0x01, 0x01) AM_READWRITE(dispon_r, dispoff_w) - AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) -ADDRESS_MAP_END - -// OSCOM 1000B - -static ADDRESS_MAP_START( osc1000b_map, AS_PROGRAM, 8, osc1000b_state ) - AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x7800) AM_RAM - AM_RANGE(0x8000, 0x81ff) AM_MIRROR(0x7e00) AM_ROM AM_REGION(CDP1802_TAG, 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( osc1000b_io_map, AS_IO, 8, osc1000b_state ) - AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) -ADDRESS_MAP_END - -// Telmac 2000 - -static ADDRESS_MAP_START( tmc2000_map, AS_PROGRAM, 8, tmc2000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x7fff) // RAM / monitor ROM - AM_RANGE(0x8000, 0xffff) // color RAM / monitor ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tmc2000_io_map, AS_IO, 8, tmc2000_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispon_r, step_bgcolor_w) - AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) - AM_RANGE(0x04, 0x04) AM_DEVREAD(CDP1864_TAG, cdp1864_device, dispoff_r) AM_WRITE(bankswitch_w) -ADDRESS_MAP_END - -// OSCOM Nano - -static ADDRESS_MAP_START( nano_map, AS_PROGRAM, 8, nano_state ) - AM_RANGE(0x0000, 0x7fff) // RAM / monitor ROM - AM_RANGE(0x8000, 0x81ff) AM_MIRROR(0x7e00) AM_ROM AM_REGION(CDP1802_TAG, 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( nano_io_map, AS_IO, 8, nano_state ) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_device, dispon_r, step_bgcolor_w) - AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) - AM_RANGE(0x04, 0x04) AM_DEVREAD(CDP1864_TAG, cdp1864_device, dispoff_r) AM_WRITE(bankswitch_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( tmc1800 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("RUN") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Run/Reset") PORT_CODE(KEYCODE_R) PORT_TOGGLE -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER( tmc2000_state::run_pressed ) -{ - if (oldval && !newval) - { - machine_reset(); - } -} - -static INPUT_PORTS_START( tmc2000 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("RUN") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("Run/Reset") PORT_CODE(KEYCODE_R) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, tmc2000_state, run_pressed, 0) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) -INPUT_PORTS_END - -INPUT_CHANGED_MEMBER( nano_state::run_pressed ) -{ - if (oldval && !newval) - { - machine_reset(); - } -} - -INPUT_CHANGED_MEMBER( nano_state::monitor_pressed ) -{ - if (oldval && !newval) - { - machine_reset(); - - m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, CLEAR_LINE); - } - else if (!oldval && newval) - { - // TODO: what are the correct values? - int t = RES_K(27) * CAP_U(1) * 1000; // t = R26 * C1 - timer_set(attotime::from_msec(t), TIMER_ID_EF4); - } -} - -static INPUT_PORTS_START( nano ) - PORT_START("NY0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - - PORT_START("NY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("RUN") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("RUN") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, nano_state, run_pressed, 0) - - PORT_START("MONITOR") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("MONITOR") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, nano_state, monitor_pressed, 0) -INPUT_PORTS_END - -/* CDP1802 Interfaces */ - -// Telmac 1800 - -READ_LINE_MEMBER( tmc1800_state::clear_r ) -{ - return BIT(m_run->read(), 0); -} - -READ_LINE_MEMBER( tmc1800_state::ef2_r ) -{ - return m_cassette->input() < 0; -} - -READ_LINE_MEMBER( tmc1800_state::ef3_r ) -{ - return CLEAR_LINE; // TODO -} - -WRITE_LINE_MEMBER( tmc1800_state::q_w ) -{ - m_cassette->output(state ? 1.0 : -1.0); -} - -// Oscom 1000B - -READ_LINE_MEMBER( osc1000b_state::clear_r ) -{ - return BIT(m_run->read(), 0); -} - -READ_LINE_MEMBER( osc1000b_state::ef2_r ) -{ - return m_cassette->input() < 0; -} - -READ_LINE_MEMBER( osc1000b_state::ef3_r ) -{ - return CLEAR_LINE; // TODO -} - -WRITE_LINE_MEMBER( osc1000b_state::q_w ) -{ - m_cassette->output(state ? 1.0 : -1.0); -} - -// Telmac 2000 - -READ_LINE_MEMBER( tmc2000_state::clear_r ) -{ - return BIT(m_run->read(), 0); -} - -READ_LINE_MEMBER( tmc2000_state::ef2_r ) -{ - return (m_cassette)->input() < 0; -} - -READ_LINE_MEMBER( tmc2000_state::ef3_r ) -{ - UINT8 data = ~m_key_row[m_keylatch / 8]->read(); - - return BIT(data, m_keylatch % 8); -} - -WRITE_LINE_MEMBER( tmc2000_state::q_w ) -{ - /* CDP1864 audio output enable */ - m_cti->aoe_w(state); - - /* set Q led status */ - set_led_status(machine(), 1, state); - - /* tape output */ - m_cassette->output(state ? 1.0 : -1.0); -} - -WRITE8_MEMBER( tmc2000_state::dma_w ) -{ - m_color = ~(m_colorram[offset & 0x1ff]) & 0x07; - - m_cti->con_w(0); // HACK - m_cti->dma_w(space, offset, data); -} - -// OSCOM Nano - -READ_LINE_MEMBER( nano_state::clear_r ) -{ - int run = BIT(m_run->read(), 0); - int monitor = BIT(m_monitor->read(), 0); - - return run && monitor; -} - -READ_LINE_MEMBER( nano_state::ef2_r ) -{ - return m_cassette->input() < 0; -} - -READ_LINE_MEMBER( nano_state::ef3_r ) -{ - UINT8 data = 0xff; - - if (!BIT(m_keylatch, 3)) data &= m_ny0->read(); - if (!BIT(m_keylatch, 4)) data &= m_ny1->read(); - - return !BIT(data, m_keylatch & 0x07); -} - -WRITE_LINE_MEMBER( nano_state::q_w ) -{ - /* CDP1864 audio output enable */ - m_cti->aoe_w(state); - - /* set Q led status */ - set_led_status(machine(), 1, state); - - /* tape output */ - m_cassette->output(state ? 1.0 : -1.0); -} - -/* Machine Initialization */ - -// Telmac 1800 - -void tmc1800_state::machine_start() -{ - /* register for state saving */ - save_item(NAME(m_keylatch)); -} - -void tmc1800_state::machine_reset() -{ - /* reset CDP1861 */ - m_vdc->reset(); -} - -// OSCOM 1000B - -void osc1000b_state::machine_start() -{ - /* register for state saving */ - save_item(NAME(m_keylatch)); -} - -void osc1000b_state::machine_reset() -{ -} - -// Telmac 2000 - -void tmc2000_state::machine_start() -{ - UINT16 addr; - - m_colorram.allocate(TMC2000_COLORRAM_SIZE); - - // randomize color RAM contents - for (addr = 0; addr < TMC2000_COLORRAM_SIZE; addr++) - { - m_colorram[addr] = machine().rand() & 0xff; - } - - // find keyboard rows - m_key_row[0] = m_y0; - m_key_row[1] = m_y1; - m_key_row[2] = m_y2; - m_key_row[3] = m_y3; - m_key_row[4] = m_y4; - m_key_row[5] = m_y5; - m_key_row[6] = m_y6; - m_key_row[7] = m_y7; - - // state saving - save_item(NAME(m_keylatch)); - save_item(NAME(m_rac)); - save_item(NAME(m_roc)); -} - -void tmc2000_state::machine_reset() -{ - // reset CDP1864 - m_cti->reset(); - - // banking - m_roc = 1; - m_rac = 0; - bankswitch(); -} - -// OSCOM Nano - -void nano_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_ID_EF4: - m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, ASSERT_LINE); - break; - } -} - -void nano_state::machine_start() -{ - /* register for state saving */ - save_item(NAME(m_keylatch)); -} - -void nano_state::machine_reset() -{ - /* assert EF4 */ - m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF4, ASSERT_LINE); - - /* reset CDP1864 */ - m_cti->reset(); - - /* enable ROM */ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *rom = m_rom->base(); - program.install_rom(0x0000, 0x01ff, 0, 0x7e00, rom); -} - -/* Machine Drivers */ - -QUICKLOAD_LOAD_MEMBER( tmc1800_base_state, tmc1800 ) -{ - UINT8 *ptr = m_rom->base(); - int size = image.length(); - - if (size > m_ram->size()) - { - return IMAGE_INIT_FAIL; - } - - image.fread( ptr, size); - - return IMAGE_INIT_PASS; -} - -static MACHINE_CONFIG_START( tmc1800, tmc1800_state ) - // basic system hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) - MCFG_CPU_PROGRAM_MAP(tmc1800_map) - MCFG_CPU_IO_MAP(tmc1800_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(tmc1800_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(tmc1800_state, ef2_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(tmc1800_state, ef3_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(tmc1800_state, q_w)) - MCFG_COSMAC_DMAW_CALLBACK(DEVWRITE8(CDP1861_TAG, cdp1861_device, dma_w)) - - // video hardware - MCFG_FRAGMENT_ADD(tmc1800_video) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_QUICKLOAD_ADD("quickload", tmc1800_base_state, tmc1800, "bin", 0) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2K") - MCFG_RAM_EXTRA_OPTIONS("4K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( osc1000b, osc1000b_state ) - // basic system hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) - MCFG_CPU_PROGRAM_MAP(osc1000b_map) - MCFG_CPU_IO_MAP(osc1000b_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(osc1000b_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(osc1000b_state, ef2_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(osc1000b_state, ef3_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(osc1000b_state, q_w)) - - // video hardware - MCFG_FRAGMENT_ADD(osc1000b_video) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_QUICKLOAD_ADD("quickload", tmc1800_base_state, tmc1800, "bin", 0) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2K") - MCFG_RAM_EXTRA_OPTIONS("4K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( tmc2000, tmc2000_state ) - // basic system hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) - MCFG_CPU_PROGRAM_MAP(tmc2000_map) - MCFG_CPU_IO_MAP(tmc2000_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(tmc2000_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(tmc2000_state, ef2_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(tmc2000_state, ef3_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(tmc2000_state, q_w)) - MCFG_COSMAC_DMAW_CALLBACK(WRITE8(tmc2000_state, dma_w)) - - // video hardware - MCFG_FRAGMENT_ADD(tmc2000_video) - - // devices - MCFG_QUICKLOAD_ADD("quickload", tmc1800_base_state, tmc1800, "bin", 0) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") - MCFG_RAM_EXTRA_OPTIONS("16K,32K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( nano, nano_state ) - // basic system hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) - MCFG_CPU_PROGRAM_MAP(nano_map) - MCFG_CPU_IO_MAP(nano_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(nano_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(nano_state, ef2_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(nano_state, ef3_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(nano_state, q_w)) - MCFG_COSMAC_DMAW_CALLBACK(DEVWRITE8(CDP1864_TAG, cdp1864_device, dma_w)) - - // video hardware - MCFG_FRAGMENT_ADD(nano_video) - - // devices - MCFG_QUICKLOAD_ADD("quickload", tmc1800_base_state, tmc1800, "bin", 0) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( tmc1800 ) - ROM_REGION( 0x200, CDP1802_TAG, 0 ) - ROM_LOAD( "mmi6341-1.ic2", 0x000, 0x200, NO_DUMP ) // equivalent to 82S141 -ROM_END - -ROM_START( osc1000b ) - ROM_REGION( 0x200, CDP1802_TAG, 0 ) - ROM_LOAD( "mmi6341-1.ic2", 0x000, 0x0200, NO_DUMP ) // equivalent to 82S141 - - ROM_REGION( 0x400, "gfx1", 0 ) - ROM_LOAD( "mmi6349.5d", 0x000, 0x200, NO_DUMP ) // equivalent to 82S147 - ROM_LOAD( "mmi6349.5c", 0x200, 0x200, NO_DUMP ) // equivalent to 82S147 -ROM_END - -ROM_START( tmc2000 ) - ROM_REGION( 0x800, CDP1802_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "prom200", "PROM N:o 200" ) - ROMX_LOAD( "200.m5", 0x000, 0x200, BAD_DUMP CRC(79da3221) SHA1(008da3ef4f69ab1a493362dfca856375b19c94bd), ROM_BIOS(1) ) // typed in from the manual - ROM_SYSTEM_BIOS( 1, "prom202", "PROM N:o 202" ) - ROMX_LOAD( "202.m5", 0x000, 0x200, NO_DUMP, ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "tool2000", "TOOL-2000" ) - ROMX_LOAD( "tool2000", 0x000, 0x800, NO_DUMP, ROM_BIOS(3) ) -ROM_END - -ROM_START( nano ) - ROM_REGION( 0x200, CDP1802_TAG, 0 ) - ROM_LOAD( "mmi6349.ic", 0x000, 0x200, BAD_DUMP CRC(1ec1b432) SHA1(ac41f5e38bcd4b80bd7a5b277a2c600899fd5fb8) ) // equivalent to 82S141 -ROM_END - -/* Driver Initialization */ - -void tmc1800_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_SETUP_BEEP: - m_beeper->set_state(0); - m_beeper->set_frequency(0); - break; - default: - assert_always(FALSE, "Unknown id in tmc1800_state::device_timer"); - } -} - -DRIVER_INIT_MEMBER(tmc1800_state,tmc1800) -{ - timer_set(attotime::zero, TIMER_SETUP_BEEP); -} - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1977, tmc1800, 0, 0, tmc1800, tmc1800, tmc1800_state, tmc1800, "Telercas Oy", "Telmac 1800", MACHINE_NOT_WORKING ) -COMP( 1977, osc1000b, tmc1800,0, osc1000b, tmc1800, driver_device, 0, "OSCOM Oy", "OSCOM 1000B", MACHINE_NOT_WORKING ) -COMP( 1980, tmc2000, 0, 0, tmc2000, tmc2000, driver_device, 0, "Telercas Oy", "Telmac 2000", MACHINE_SUPPORTS_SAVE ) -COMP( 1980, nano, tmc2000,0, nano, nano, driver_device, 0, "OSCOM Oy", "OSCOM Nano", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/tmc2000e.c b/src/mess/drivers/tmc2000e.c deleted file mode 100644 index c3691141631..00000000000 --- a/src/mess/drivers/tmc2000e.c +++ /dev/null @@ -1,328 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Telmac 2000E - ------------ - (c) 1980 Telercas Oy, Finland - - CPU: CDP1802A 1.75 MHz - RAM: 8 KB - ROM: 8 KB - - Video: CDP1864 1.75 MHz - Color RAM: 1 KB - - Colors: 8 fg, 4 bg - Resolution: 64x192 - Sound: frequency control, volume on/off - Keyboard: ASCII (RCA VP-601/VP-611), KB-16/KB-64 - - SBASIC: 24.0 - - - Telmac TMC-121/111/112 - ---------------------- - (c) 198? Telercas Oy, Finland - - CPU: CDP1802A ? MHz - - Built from Telmac 2000 series cards. Huge metal box. - -*/ - -#include "includes/tmc2000e.h" - -/* Read/Write Handlers */ - -READ8_MEMBER( tmc2000e_state::vismac_r ) -{ - return 0; -} - -WRITE8_MEMBER( tmc2000e_state::vismac_w ) -{ -} - -READ8_MEMBER( tmc2000e_state::floppy_r ) -{ - return 0; -} - -WRITE8_MEMBER( tmc2000e_state::floppy_w ) -{ -} - -READ8_MEMBER( tmc2000e_state::ascii_keyboard_r ) -{ - return 0; -} - -READ8_MEMBER( tmc2000e_state::io_r ) -{ - return 0; -} - -WRITE8_MEMBER( tmc2000e_state::io_w ) -{ -} - -WRITE8_MEMBER( tmc2000e_state::io_select_w ) -{ -} - -WRITE8_MEMBER( tmc2000e_state::keyboard_latch_w ) -{ - m_keylatch = data; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( tmc2000e_map, AS_PROGRAM, 8, tmc2000e_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAM - AM_RANGE(0xc000, 0xdfff) AM_ROM - AM_RANGE(0xfc00, 0xffff) AM_WRITEONLY AM_SHARE("colorram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tmc2000e_io_map, AS_IO, 8, tmc2000e_state ) - AM_RANGE(0x01, 0x01) AM_DEVWRITE(CDP1864_TAG, cdp1864_device, tone_latch_w) - AM_RANGE(0x02, 0x02) AM_DEVWRITE(CDP1864_TAG, cdp1864_device, step_bgcolor_w) - AM_RANGE(0x03, 0x03) AM_READWRITE(ascii_keyboard_r, keyboard_latch_w) - AM_RANGE(0x04, 0x04) AM_READWRITE(io_r, io_w) - AM_RANGE(0x05, 0x05) AM_READWRITE(vismac_r, vismac_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(floppy_r, floppy_w) - AM_RANGE(0x07, 0x07) AM_READ_PORT("DSW0") AM_WRITE(io_select_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( tmc2000e ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("DSW0") // System Configuration DIPs - PORT_DIPNAME( 0x80, 0x00, "Keyboard Type" ) - PORT_DIPSETTING( 0x00, "ASCII" ) - PORT_DIPSETTING( 0x80, "Matrix" ) - PORT_DIPNAME( 0x40, 0x00, "Operating System" ) - PORT_DIPSETTING( 0x00, "TOOL-2000-E" ) - PORT_DIPSETTING( 0x40, "Load from disk" ) - PORT_DIPNAME( 0x30, 0x00, "Display Interface" ) - PORT_DIPSETTING( 0x00, "PAL" ) - PORT_DIPSETTING( 0x10, "CDG-80" ) - PORT_DIPSETTING( 0x20, "VISMAC" ) - PORT_DIPSETTING( 0x30, "UART" ) - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("RUN") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Run/Reset") PORT_CODE(KEYCODE_R) PORT_TOGGLE -INPUT_PORTS_END - -/* Video */ - -READ_LINE_MEMBER( tmc2000e_state::rdata_r ) -{ - return BIT(m_color, 2); -} - -READ_LINE_MEMBER( tmc2000e_state::bdata_r ) -{ - return BIT(m_color, 1); -} - -READ_LINE_MEMBER( tmc2000e_state::gdata_r ) -{ - return BIT(m_color, 0); -} - -/* CDP1802 Interface */ - -READ_LINE_MEMBER( tmc2000e_state::clear_r ) -{ - return BIT(m_run->read(), 0); -} - -READ_LINE_MEMBER( tmc2000e_state::ef2_r ) -{ - return m_cassette->input() < 0; -} - -READ_LINE_MEMBER( tmc2000e_state::ef3_r ) -{ - UINT8 data = ~(m_key_row[m_keylatch / 8])->read(); - - return BIT(data, m_keylatch % 8); -} - -WRITE_LINE_MEMBER( tmc2000e_state::q_w ) -{ - // turn CDP1864 sound generator on/off - m_cti->aoe_w(state); - - // set Q led status - set_led_status(machine(), 1, state); - - // tape out - m_cassette->output(state ? -1.0 : +1.0); - - // floppy control (FDC-6) -} - -WRITE8_MEMBER( tmc2000e_state::dma_w ) -{ - m_color = (m_colorram[offset & 0x3ff]) & 0x07; // 0x04 = R, 0x02 = B, 0x01 = G - - m_cti->con_w(0); // HACK - m_cti->dma_w(space, offset, data); -} - - -/* Machine Initialization */ - -void tmc2000e_state::machine_start() -{ - // find keyboard rows - m_key_row[0] = m_y0; - m_key_row[1] = m_y1; - m_key_row[2] = m_y2; - m_key_row[3] = m_y3; - m_key_row[4] = m_y4; - m_key_row[5] = m_y5; - m_key_row[6] = m_y6; - m_key_row[7] = m_y7; - - /* register for state saving */ - save_item(NAME(m_cdp1864_efx)); - save_item(NAME(m_keylatch)); -} - -void tmc2000e_state::machine_reset() -{ - m_cti->reset(); - - // reset program counter to 0xc000 -} - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( tmc2000e, tmc2000e_state ) - // basic system hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz) - MCFG_CPU_PROGRAM_MAP(tmc2000e_map) - MCFG_CPU_IO_MAP(tmc2000e_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(tmc2000e_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(tmc2000e_state, ef2_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(tmc2000e_state, ef3_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(tmc2000e_state, q_w)) - MCFG_COSMAC_DMAW_CALLBACK(WRITE8(tmc2000e_state, dma_w)) - - // video hardware - MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) - MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(tmc2000e_state, rdata_r), READLINE(tmc2000e_state, bdata_r), READLINE(tmc2000e_state, gdata_r)) - MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(5.1), RES_K(4.7)) // unverified - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_RAM_EXTRA_OPTIONS("40K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( tmc2000e ) - ROM_REGION( 0x10000, CDP1802_TAG, 0 ) - ROM_LOAD( "1", 0xc000, 0x0800, NO_DUMP ) - ROM_LOAD( "2", 0xc800, 0x0800, NO_DUMP ) - ROM_LOAD( "3", 0xd000, 0x0800, NO_DUMP ) - ROM_LOAD( "4", 0xd800, 0x0800, NO_DUMP ) -ROM_END - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME -COMP( 1980, tmc2000e, 0, 0, tmc2000e, tmc2000e, driver_device, 0, "Telercas Oy", "Telmac 2000E", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/tmc600.c b/src/mess/drivers/tmc600.c deleted file mode 100644 index 5b0f73c05dc..00000000000 --- a/src/mess/drivers/tmc600.c +++ /dev/null @@ -1,314 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Telmac TMC-600 - -PCB Layout ----------- - -HP14782-1 - - CN2 CN3 - |---------| |------------------------| -|-------|---------|-----|------------------------|------------------------------------------| -| CN1 CN4 SW1 CN5 CN6 P1 SW2 CN7 | -| |-------| 4049 T3 | -| T1 K1 |CDP1852| 4050 4050 4050 40107 T2 C1 C2 8.867238MHz | -| |-------| |-------| 5.6260MHz T4 | -| MC1374 |CDP1852| ROM5 |---------| | -| |-------| | CDP1870 | | -| K2 ROM4 |---------| | -| |-------------| 4050 5114 5114 | -| 4013 | CDP1802 | 4050 5114 5114 ROM3 4030 ROM6 4060| -| 4013 |-------------| 4050 5114 5114 | -| 4081 40106 4051 5114 5114 ROM2 4076 5114 4011| -| 4556 5114 5114 CDP1856 5114 | -| |-------| 5114 5114 ROM1 CDP1856 5114 4076| -| LS1 |CDP1852| CDP1853 CDP1856 5114 5114 | -| |-------| CDP1856 5114 5114 ROM0 |---------| 4011| -| | CDP1869 | | -| 7805 4051 4051 |---------| | -| | -| |--CN8--| | -|-------------------------------------------------------------------------------------------| - -Notes: - All IC's shown. TMCP-300 and TMC-700 expansions have been installed. - - ROM0-5 - Toshiba TMM2732DI 4Kx8 EPROM - ROM6 - Hitachi HN462732G 4Kx8 EPROM - 5114 - RCA MWS5114E1 1024-Word x 4-Bit LSI Static RAM - MC1374 - Motorola MC1374P TV Modulator - CDP1802 - RCA CDP1802BE CMOS 8-Bit Microprocessor running at ? MHz - CDP1852 - RCA CDP1852CE Byte-Wide Input/Output Port - CDP1853 - RCA CDP1853CE N-Bit 1 of 8 Decoder - CDP1856 - RCA CDP1856CE 4-Bit Memory Buffer - CDP1869 - RCA CDP1869CE Video Interface System (VIS) Address and Sound Generator - CDP1870 - RCA CDP1870CE Video Interface System (VIS) Color Video (DOT XTAL at 5.6260MHz, CHROM XTAL at 8.867238MHz) - CN1 - RF connector [TMC-700] - CN2 - printer connector [TMC-700] - CN3 - EURO connector - CN4 - tape connector - CN5 - video connector - CN6 - power connector - CN7 - audio connector [TMCP-300] - CN8 - keyboard connector - SW1 - RUN/STOP switch - SW2 - internal speaker/external audio switch [TMCP-300] - P1 - color phase lock adjustment - C1 - dot oscillator adjustment - C2 - chrom oscillator adjustment - T1 - RF signal strength adjustment [TMC-700] - T2 - tape recording level adjustment (0.57 Vpp) - T3 - video output level adjustment (1 Vpp) - T4 - video synchronization pulse adjustment - K1 - RF signal quality adjustment [TMC-700] - K2 - RF channel adjustment (VHF I) [TMC-700] - LS1 - loudspeaker - -*/ - -/* - - TODO: - - - proper emulation of the VISMAC interface (cursor blinking, color RAM), schematics are needed - - disk interface - - CPU frequency needs to be derived from the schematics - - serial interface expansion card - - centronics printer handshaking - -*/ - -#include "includes/tmc600.h" - -/* Read/Write Handlers */ - -WRITE8_MEMBER( tmc600_state::keyboard_latch_w ) -{ - m_keylatch = data; -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( tmc600_map, AS_PROGRAM, 8, tmc600_state ) - AM_RANGE(0x0000, 0x4fff) AM_ROM - AM_RANGE(0x6000, 0xbfff) AM_RAM - AM_RANGE(0xf400, 0xf7ff) AM_DEVICE(CDP1869_TAG, cdp1869_device, char_map) - AM_RANGE(0xf800, 0xffff) AM_DEVICE(CDP1869_TAG, cdp1869_device, page_map) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tmc600_io_map, AS_IO, 8, tmc600_state ) - AM_RANGE(0x03, 0x03) AM_WRITE(keyboard_latch_w) - AM_RANGE(0x04, 0x04) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x05, 0x05) AM_WRITE(vismac_data_w) -// AM_RANGE(0x06, 0x06) AM_WRITE(floppy_w) - AM_RANGE(0x07, 0x07) AM_WRITE(vismac_register_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( tmc600 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHAR('/') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('\\') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x85") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00C5) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x84") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x96") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E2") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL1") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL2") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E1") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("(unknown)") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(10) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("RUN") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Run/Stop") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_TOGGLE -INPUT_PORTS_END - -/* CDP1802 Interface */ - -READ_LINE_MEMBER( tmc600_state::clear_r ) -{ - return BIT(m_run->read(), 0); -} - -READ_LINE_MEMBER( tmc600_state::ef2_r ) -{ - return m_cassette->input() < 0; -} - -READ_LINE_MEMBER( tmc600_state::ef3_r ) -{ - UINT8 data = ~m_key_row[m_keylatch / 8]->read(); - - return BIT(data, m_keylatch % 8); -} - -WRITE_LINE_MEMBER( tmc600_state::q_w ) -{ - m_cassette->output(state ? +1.0 : -1.0); -} - -/* Machine Initialization */ - -void tmc600_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - /* configure RAM */ - switch (m_ram->size()) - { - case 8*1024: - program.unmap_readwrite(0x8000, 0xbfff); - break; - - case 16*1024: - program.unmap_readwrite(0xa000, 0xbfff); - break; - } - - // find keyboard rows - m_key_row[0] = m_y0; - m_key_row[1] = m_y1; - m_key_row[2] = m_y2; - m_key_row[3] = m_y3; - m_key_row[4] = m_y4; - m_key_row[5] = m_y5; - m_key_row[6] = m_y6; - m_key_row[7] = m_y7; - - /* register for state saving */ - save_item(NAME(m_keylatch)); -} - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( tmc600, tmc600_state ) - // basic system hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, 3579545) // ??? - MCFG_CPU_PROGRAM_MAP(tmc600_map) - MCFG_CPU_IO_MAP(tmc600_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(tmc600_state, clear_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(tmc600_state, ef2_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(tmc600_state, ef3_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(tmc600_state, q_w)) - - // sound and video hardware - MCFG_FRAGMENT_ADD(tmc600_video) - - /* devices */ - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_RAM_EXTRA_OPTIONS("16K,24K") -MACHINE_CONFIG_END - -/* ROMs */ - -#if 0 -ROM_START( tmc600s1 ) - ROM_REGION( 0x5000, CDP1802_TAG, 0 ) - ROM_LOAD( "sb20", 0x0000, 0x1000, NO_DUMP ) - ROM_LOAD( "sb21", 0x1000, 0x1000, NO_DUMP ) - ROM_LOAD( "sb22", 0x2000, 0x1000, NO_DUMP ) - ROM_LOAD( "sb23", 0x3000, 0x1000, NO_DUMP ) - ROM_LOAD( "190482_2", 0x4000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "chargen", 0x0000, 0x1000, NO_DUMP ) -ROM_END -#endif - -ROM_START( tmc600s2 ) - ROM_REGION( 0x5000, CDP1802_TAG, 0 ) - ROM_LOAD( "sb30", 0x0000, 0x1000, CRC(95d1292a) SHA1(1fa52d59d3005f8ac74a32c2164fdb22947c2748) ) - ROM_LOAD( "sb31", 0x1000, 0x1000, CRC(2c8f3d17) SHA1(f14e8adbcddeaeaa29b1e7f3dfa741f4e230f599) ) - ROM_LOAD( "sb32", 0x2000, 0x1000, CRC(dd58a128) SHA1(be9bdb0fc5e0cc3dcc7f2fb7ccab69bf5b043803) ) - ROM_LOAD( "sb33", 0x3000, 0x1000, CRC(b7d241fa) SHA1(6f3eadf86c4e3aaf93d123e302a18dc4d9db964b) ) - ROM_LOAD( "151182", 0x4000, 0x1000, CRC(c1a8d9d8) SHA1(4552e1f06d0e338ba7b0f1c3a20b8a51c27dafde) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "chargen", 0x0000, 0x1000, CRC(93f92cbf) SHA1(371156fb38fa5319c6fde537ccf14eed94e7adfb) ) -ROM_END - -/* System Drivers */ -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME -//COMP( 1982, tmc600s1, 0, 0, tmc600, tmc600, driver_device, 0, "Telercas Oy", "Telmac TMC-600 (Sarja I)", MACHINE_NOT_WORKING ) -COMP( 1982, tmc600s2, 0, 0, tmc600, tmc600, driver_device, 0, "Telercas Oy", "Telmac TMC-600 (Sarja II)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/tricep.c b/src/mess/drivers/tricep.c deleted file mode 100644 index 728f8496177..00000000000 --- a/src/mess/drivers/tricep.c +++ /dev/null @@ -1,94 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Morrow Tricep - - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class tricep_state : public driver_device -{ -public: - tricep_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - , - m_p_ram(*this, "p_ram"){ } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ16_MEMBER(tricep_terminal_r); - DECLARE_WRITE16_MEMBER(tricep_terminal_w); - DECLARE_WRITE8_MEMBER(kbd_put); - required_shared_ptr m_p_ram; - virtual void machine_reset(); -}; - - - -READ16_MEMBER( tricep_state::tricep_terminal_r ) -{ - return 0xffff; -} - -WRITE16_MEMBER( tricep_state::tricep_terminal_w ) -{ - m_terminal->write(space, 0, data >> 8); -} - -static ADDRESS_MAP_START(tricep_mem, AS_PROGRAM, 16, tricep_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_SHARE("p_ram") - AM_RANGE(0x00fd0000, 0x00fd1fff) AM_ROM AM_REGION("user1",0) - AM_RANGE(0x00ff0028, 0x00ff0029) AM_READWRITE(tricep_terminal_r,tricep_terminal_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( tricep ) -INPUT_PORTS_END - - -void tricep_state::machine_reset() -{ - UINT8* user1 = memregion("user1")->base(); - - memcpy((UINT8*)m_p_ram.target(),user1,0x2000); - - m_maincpu->reset(); -} - -WRITE8_MEMBER( tricep_state::kbd_put ) -{ -} - -static MACHINE_CONFIG_START( tricep, tricep_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",M68000, XTAL_8MHz) - MCFG_CPU_PROGRAM_MAP(tricep_mem) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(tricep_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( tricep ) - ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "tri2.4_odd.u37", 0x0000, 0x1000, CRC(31eb2dcf) SHA1(2d9df9262ee1096d0398505e10d209201ac49a5d)) - ROM_LOAD16_BYTE( "tri2.4_even.u36", 0x0001, 0x1000, CRC(4414dcdc) SHA1(00a3d293617dc691748ae85b6ccdd6723daefc0a)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, tricep, 0, 0, tricep, tricep, driver_device, 0, "Morrow Designs", "Tricep", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/trs80.c b/src/mess/drivers/trs80.c deleted file mode 100644 index 8a9c0c3af24..00000000000 --- a/src/mess/drivers/trs80.c +++ /dev/null @@ -1,927 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert and unknown others -/*************************************************************************** -TRS80 memory map - -0000-2fff ROM R D0-D7 -3000-37ff ROM on Model III R D0-D7 - unused on Model I -37de UART status R/W D0-D7 -37df UART data R/W D0-D7 -37e0 interrupt latch address (lnw80 = for the realtime clock) -37e1 select disk drive 0 W -37e2 cassette drive latch address W -37e3 select disk drive 1 W -37e4 select which cassette unit W D0-D1 (D0 selects unit 1, D1 selects unit 2) -37e5 select disk drive 2 W -37e7 select disk drive 3 W -37e0-37e3 floppy motor W D0-D3 - or floppy head select W D3 -37e8 send a byte to printer W D0-D7 -37e8 read printer status R D7 -37ec-37ef FDC WD179x R/W D0-D7 -37ec command W D0-D7 -37ec status R D0-D7 -37ed track R/W D0-D7 -37ee sector R/W D0-D7 -37ef data R/W D0-D7 -3800-38ff keyboard matrix R D0-D7 -3900-3bff unused - kbd mirrored -3c00-3fff video RAM R/W D0-D5,D7 (or D0-D7) -4000-ffff RAM - -Interrupts: -IRQ mode 1 -NMI - -Printer: Level II usually 37e8; System80 uses port FD; Model 4 uses port F8. -Uart: TR1602, equivalent to the uart used in the Exidy Sorcerer. -System80 has non-addressable dip switches to set the UART control register. -System80 and LNW80 have non-addressable links to set the baud rate. Receive and Transmit clocks are tied together. -It is assumed that the TRS80L2 UART setup is identical to the System80, apart from the address ports used. -Due to the above, the only working emulated UART is for the Model 3. - -Cassette baud rates: Model I level I - 250 baud - Model I level II and all clones - 500 baud - Model III/4 - 500 and 1500 baud selectable at boot time - - When it says "Cass?" press L for 500 baud, or Enter otherwise. - LNW-80 - 500 baud @1.77MHz and 1000 baud @4MHz. - -I/O ports -FF: -- bits 0 and 1 are for writing a cassette -- bit 2 must be high to turn the cassette motor on, enables cassette data paths on a system-80 -- bit 3 switches the display between 64 or 32 characters per line -- bit 6 remembers the 32/64 screen mode (inverted) -- bit 7 is for reading from a cassette - -FE: -- bit 0 is for selecting inverse video of the whole screen on a lnw80 -- bit 2 enables colour on a lnw80 -- bit 3 is for selecting roms (low) or 16k hires area (high) on a lnw80 -- bit 4 selects internal cassette player (low) or external unit (high) on a system-80 - -FD: -- Read printer status on a system-80 -- Write to printer on a system-80 - -F9: -- UART data (write) status (read) on a system-80 - -F8: -- UART data (read) status (write) on a system-80 -- Write to printer (Model III/4) -- Read printer status (Model III/4) - -EB: -- UART data (read and write) on a Model III/4 - -EA: -- UART status (read and write) on a Model III/4 - -E9: -- UART Configuration jumpers (read) on a Model III/4 -- Set baud rate (Model III/4) - -E8: -- UART Modem Status register (read) on a Model III/4 -- UART Master Reset (write) on a Model III/4 - -Model 4 - C0-CF = hard drive (optional) - - 90-93 write sound (optional) - - 80-8F hires graphics (optional) - -About the ht1080z - This was made for schools in Hungary. Each comes with a BASIC extension roms - which activated Hungarian features. To activate - start emulation - enter SYSTEM - Enter /12288 and the extensions will be installed and you are returned to READY. - The ht1080z is identical to the System 80, apart from the character rom. - The ht1080z2 has a modified extension rom and character generator. - -About the RTC - The time is incremented while ever the cursor is flashing. It is stored in a series - of bytes in the computer's work area. The bytes are in a certain order, this is: - seconds, minutes, hours, year, day, month. On a model 1, the seconds are stored at - 0x4041, while on the model 4 it is 0x4217. A reboot always sets the time to zero. - -Model 4 memory organisation - - Mode 0: ROM=0-37E7 and 37EA-3FFF; Printer=37E8-37E9; Keyboard=3800-3BFF; Video=3C00-3FFF - Mode 1: Keyboard and Video as above; 0-3FFF read=ROM and write=RAM - Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM - Mode 3: All RAM - In the "maincpu" memory map, the first 64k is given to the ROM, keyboard, printer and video, - while the second 64k is RAM that is switched in as needed. The area from 4800-FFFF - is considered a "black hole", any writes to there will disappear. - The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous. - -Model 4P - is the same as Model 4 except: - - ROM is only 0000-0FFF, while 1000-37FF is given over to RAM - - There is no cassette support in hardware. - -*************************************************************************** - -Not dumped (to our knowledge): - TRS80 Japanese bios - TRS80 Katakana Character Generator - TRS80 Small English Character Generator - TRS80 Model III old version Character Generator - TRS80 Model II bios and boot disk - -Not emulated: - TRS80 Japanese kana/ascii switch and alternate keyboard - TRS80 Model III/4 Hard drive, Graphics board, Alternate Character set - LNW80 1.77 / 4.0 MHz switch (this is a physical switch) - -Virtual floppy disk formats are JV1, JV3, and DMK. Only the JV1 is emulated. -There don't seem to be any JV1 boot disks for Model III/4. - -***************************************************************************/ - -#include "includes/trs80.h" -#include "formats/trs80_dsk.h" -#include "formats/dmk_dsk.h" - - -static ADDRESS_MAP_START( trs80_map, AS_PROGRAM, 8, trs80_state ) - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x3800, 0x38ff) AM_READ(trs80_keyboard_r) - AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(trs80_videoram_r, trs80_videoram_w) AM_SHARE("p_videoram") - AM_RANGE(0x4000, 0x7fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( trs80_io, AS_IO, 8, trs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( model1_map, AS_PROGRAM, 8, trs80_state ) - AM_RANGE(0x0000, 0x377f) AM_ROM // sys80,ht1080 needs up to 375F - AM_RANGE(0x37de, 0x37de) AM_READWRITE(sys80_f9_r, sys80_f8_w) - AM_RANGE(0x37df, 0x37df) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) - AM_RANGE(0x37e0, 0x37e3) AM_READWRITE(trs80_irq_status_r, trs80_motor_w) - AM_RANGE(0x37e4, 0x37e7) AM_WRITE(trs80_cassunit_w) - AM_RANGE(0x37e8, 0x37eb) AM_READWRITE(trs80_printer_r, trs80_printer_w) - AM_RANGE(0x37ec, 0x37ec) AM_READ(trs80_wd179x_r) - AM_RANGE(0x37ec, 0x37ec) AM_DEVWRITE("fdc", fd1793_t, cmd_w) - AM_RANGE(0x37ed, 0x37ed) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) - AM_RANGE(0x37ee, 0x37ee) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) - AM_RANGE(0x37ef, 0x37ef) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) - AM_RANGE(0x3800, 0x38ff) AM_MIRROR(0x300) AM_READ(trs80_keyboard_r) - AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(trs80_videoram_r, trs80_videoram_w) AM_SHARE("p_videoram") - AM_RANGE(0x4000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( model1_io, AS_IO, 8, trs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sys80_io, AS_IO, 8, trs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf8, 0xf8) AM_READWRITE(trs80m4_eb_r, sys80_f8_w) - AM_RANGE(0xf9, 0xf9) AM_READWRITE(sys80_f9_r, trs80m4_eb_w) - AM_RANGE(0xfd, 0xfd) AM_READWRITE(trs80_printer_r, trs80_printer_w) - AM_RANGE(0xfe, 0xfe) AM_WRITE(sys80_fe_w) - AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( lnw80_map, AS_PROGRAM, 8, trs80_state ) - AM_RANGE(0x4000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( lnw80_io, AS_IO, 8, trs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) - AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") - AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) - AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) - AM_RANGE(0xfe, 0xfe) AM_READWRITE(lnw80_fe_r, lnw80_fe_w) - AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( model3_map, AS_PROGRAM, 8, trs80_state ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( model3_io, AS_IO, 8, trs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80m4_e0_r, trs80m4_e0_w) - AM_RANGE(0xe4, 0xe4) AM_READWRITE(trs80m4_e4_r, trs80m4_e4_w) - AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) - AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") AM_WRITE(trs80m4_e9_w) - AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) - AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) - AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) - AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) - AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) - AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) - AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) - AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) - AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) - AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) - AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( model4_io, AS_IO, 8, trs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x84, 0x87) AM_WRITE(trs80m4_84_w) - AM_RANGE(0x88, 0x89) AM_WRITE(trs80m4_88_w) - AM_RANGE(0x90, 0x93) AM_WRITE(trs80m4_90_w) - AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80m4_e0_r, trs80m4_e0_w) - AM_RANGE(0xe4, 0xe4) AM_READWRITE(trs80m4_e4_r, trs80m4_e4_w) - AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) - AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") AM_WRITE(trs80m4_e9_w) - AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) - AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) - AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) - AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) - AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) - AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) - AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) - AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) - AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) - AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) - AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( model4p_io, AS_IO, 8, trs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x84, 0x87) AM_WRITE(trs80m4_84_w) - AM_RANGE(0x88, 0x89) AM_WRITE(trs80m4_88_w) - AM_RANGE(0x90, 0x93) AM_WRITE(trs80m4_90_w) - AM_RANGE(0x9c, 0x9f) AM_WRITE(trs80m4p_9c_w) - AM_RANGE(0xe0, 0xe3) AM_READWRITE(trs80m4_e0_r, trs80m4_e0_w) - AM_RANGE(0xe4, 0xe4) AM_READWRITE(trs80m4_e4_r, trs80m4_e4_w) - AM_RANGE(0xe8, 0xe8) AM_READWRITE(trs80m4_e8_r, trs80m4_e8_w) - AM_RANGE(0xe9, 0xe9) AM_READ_PORT("E9") AM_WRITE(trs80m4_e9_w) - AM_RANGE(0xea, 0xea) AM_READWRITE(trs80m4_ea_r, trs80m4_ea_w) - AM_RANGE(0xeb, 0xeb) AM_READWRITE(trs80m4_eb_r, trs80m4_eb_w) - AM_RANGE(0xec, 0xef) AM_READWRITE(trs80m4_ec_r, trs80m4_ec_w) - AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) - AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) - AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) - AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) - AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) - AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) - AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) - AM_RANGE(0xfc, 0xff) AM_READWRITE(trs80m4_ff_r, trs80m4_ff_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( meritum_map, AS_PROGRAM, 8, trs80_state ) - AM_RANGE(0x0000, 0x37ff) AM_ROM - AM_RANGE(0x3800, 0x38ff) AM_MIRROR(0x300) AM_READ(trs80_keyboard_r) - AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(trs80_videoram_r, trs80_videoram_w) AM_SHARE("p_videoram") - AM_RANGE(0x4000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( meritum_io, AS_IO, 8, trs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - // There are specific writes to ports 03, F3, F7, F8, FA, FB, FD - // so perhaps this system uses devices at these locations. - // The disk input expects values that are different to the usual, - // eg. port F0 should be 5, port F2 should have bit 3 set. - //AM_RANGE(0x03, 0x03) unknown - AM_RANGE(0xf0, 0xf0) AM_READ(trs80_wd179x_r) - AM_RANGE(0xf0, 0xf0) AM_DEVWRITE("fdc", fd1793_t, cmd_w) - AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("fdc", fd1793_t, track_r, track_w) - AM_RANGE(0xf2, 0xf2) AM_DEVREADWRITE("fdc", fd1793_t, sector_r, sector_w) - AM_RANGE(0xf3, 0xf3) AM_DEVREADWRITE("fdc", fd1793_t, data_r, data_w) - AM_RANGE(0xf4, 0xf4) AM_WRITE(trs80m4_f4_w) - AM_RANGE(0xf8, 0xfb) AM_READWRITE(trs80_printer_r, trs80_printer_w) - //AM_RANGE(0xfc, 0xfd) unknown - AM_RANGE(0xff, 0xff) AM_READWRITE(trs80_ff_r, trs80_ff_w) -ADDRESS_MAP_END - -/************************************************************************** - w/o SHIFT with SHIFT - +-------------------------------+ +-------------------------------+ - | 0 1 2 3 4 5 6 7 | | 0 1 2 3 4 5 6 7 | -+--+---+---+---+---+---+---+---+---+ +--+---+---+---+---+---+---+---+---+ -|0 | @ | A | B | C | D | E | F | G | |0 | ` | a | b | c | d | e | f | g | -| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ -|1 | H | I | J | K | L | M | N | O | |1 | h | i | j | k | l | m | n | o | -| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ -|2 | P | Q | R | S | T | U | V | W | |2 | p | q | r | s | t | u | v | w | -| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ -|3 | X | Y | Z | [ | \ | ] | ^ | _ | |3 | x | y | z | { | | | } | ~ | | -| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ -|4 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |4 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | -| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ -|5 | 8 | 9 | : | ; | , | - | . | / | |5 | 8 | 9 | * | + | < | = | > | ? | -| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ -|6 |ENT|CLR|BRK|UP |DN |LFT|RGT|SPC| |6 |ENT|CLR|BRK|UP |DN |LFT|RGT|SPC| -| +---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ -|7 |SHF|ALT|PUP|PDN|INS|DEL|CTL|END| |7 |SHF|ALT|PUP|PDN|INS|DEL|CTL|END| -+--+---+---+---+---+---+---+---+---+ +--+---+---+---+---+---+---+---+---+ -NB: row 7 contains some originally unused bits - only the shift bit was there in the TRS80 - -2008-05 FP: -NB2: 3:3 -> 3:7 have no correspondent keys (see - below) in the usual 53-keys keyboard ( + - 12-keys keypad) for Model I, III and 4. Where - are the symbols above coming from? -NB3: the 12-keys keypad present in later models - is mapped to the corrispondent keys of the - keyboard: '0' -> '9', 'Enter', '.' -NB4: when it was added a 15-key keypad, there were - three functions key 'F1', 'F2', 'F3'. I found no - doc about their position in the matrix above, - but the schematics of the clone System-80 MkII - (which had 4 function keys) put these keys in - 3:4 -> 3:7. Right now they're not implemented - below. - -***************************************************************************/ - -static INPUT_PORTS_START( trs80 ) - PORT_START("CONFIG") /* IN0 */ - PORT_CONFNAME( 0x80, 0x00, "Floppy Disc Drives") - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x80, DEF_STR( On ) ) - PORT_BIT(0x7f, 0x7f, IPT_UNUSED) - - PORT_START("LINE0") /* KEY ROW 0 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("LINE1") /* KEY ROW 1 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("LINE2") /* KEY ROW 2 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START("LINE3") /* KEY ROW 3 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - /* on Model I and Model III keyboards, there are only 53 keys (+ 12 keypad keys) and these are not connected: - on Model I, they produce arrows and '_', on Model III either produce garbage or overlap with other keys; - on Model 4 (which has a 15-key with 3 function keys) here are mapped 'F1', 'F2', 'F3' */ - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") - - PORT_START("LINE4") /* KEY ROW 4 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - - PORT_START("LINE5") /* KEY ROW 5 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("LINE6") /* KEY ROW 6 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(F8)) // 3rd line, 1st key from right - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F9)) // 1st line, 1st key from right - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - /* backspace do the same as cursor left */ - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE7") /* KEY ROW 7 */ - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - /* These keys are only on a Model 4. The one marked CTL seems to be another shift key (4 in total). */ - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("CTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x80, 0x00, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( trs80m3 ) - PORT_INCLUDE (trs80) - PORT_START("E9") // these are the power-on uart settings - PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_DIPNAME( 0x88, 0x08, "Parity") - PORT_DIPSETTING( 0x08, DEF_STR(None)) - PORT_DIPSETTING( 0x00, "Odd") - PORT_DIPSETTING( 0x80, "Even") - PORT_DIPNAME( 0x10, 0x10, "Stop Bits") - PORT_DIPSETTING( 0x10, "2") - PORT_DIPSETTING( 0x00, "1") - PORT_DIPNAME( 0x60, 0x60, "Bits") - PORT_DIPSETTING( 0x00, "5") - PORT_DIPSETTING( 0x20, "6") - PORT_DIPSETTING( 0x40, "7") - PORT_DIPSETTING( 0x60, "8") -INPUT_PORTS_END - - -/**************************** F4 CHARACTER DISPLAYER ***********************************************************/ -static const gfx_layout trs80_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout ht1080z_charlayout = -{ - 5, 12, /* 5 x 12 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static const gfx_layout trs80m4_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout lnw80_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 5, 6, 1, 0, 2, 4, 3 }, - /* y offsets */ - { 0*8, 512*8, 256*8, 768*8, 1*8, 513*8, 257*8, 769*8 }, - 8*2 /* every char takes 8 bytes */ -}; - -static const gfx_layout radionic_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 2048*8, 2049*8, 2050*8, 2051*8, 2052*8, 2053*8, 2054*8, 2055*8 }, - 8*8 /* every char takes 16 bytes */ -}; - -static const gfx_layout meritum_charlayout = -{ - 6, 11, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 }, - 8*16 /* every char takes 16 bytes (unused scanlines are blank) */ -}; - -static GFXDECODE_START(trs80) - GFXDECODE_ENTRY( "chargen", 0, trs80_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START(ht1080z) - GFXDECODE_ENTRY( "chargen", 0, ht1080z_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START(trs80m4) - GFXDECODE_ENTRY( "chargen", 0, trs80m4_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START(lnw80) - GFXDECODE_ENTRY( "chargen", 0, lnw80_charlayout, 0, 4 ) -GFXDECODE_END - -static GFXDECODE_START(radionic) - GFXDECODE_ENTRY( "chargen", 0, radionic_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START(meritum) - GFXDECODE_ENTRY( "chargen", 0, meritum_charlayout, 0, 1 ) -GFXDECODE_END - - -FLOPPY_FORMATS_MEMBER( trs80_state::floppy_formats ) - FLOPPY_TRS80_FORMAT, - FLOPPY_DMK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( trs80_floppies ) - SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( trs80, trs80_state ) // the original model I, level I, with no extras - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 1796000) /* 1.796 MHz */ - MCFG_CPU_PROGRAM_MAP(trs80_map) - MCFG_CPU_IO_MAP(trs80_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*6, 16*12) - MCFG_SCREEN_VISIBLE_AREA(0,64*6-1,0,16*12-1) - MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_trs80) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", trs80) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( model1, trs80 ) // model I, level II - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( model1_map) - MCFG_CPU_IO_MAP( model1_io) - MCFG_CPU_PERIODIC_INT_DRIVER(trs80_state, trs80_rtc_interrupt, 40) - - /* devices */ - MCFG_CASSETTE_MODIFY( "cassette" ) - MCFG_CASSETTE_FORMATS(trs80l2_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - - MCFG_QUICKLOAD_ADD("quickload", trs80_state, trs80_cmd, "cmd", 0.5) - - MCFG_FD1793_ADD("fdc", XTAL_1MHz) // todo: should be fd1771 - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(trs80_state,trs80_fdc_intrq_w)) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", trs80_floppies, "sssd", trs80_state::floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", trs80_floppies, "sssd", trs80_state::floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", trs80_floppies, "", trs80_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", trs80_floppies, "", trs80_state::floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7)) - MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit6)) - MCFG_CENTRONICS_SELECT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5)) - MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4)) - - MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_DEVICE_ADD( "tr1602", AY31015, 0 ) - MCFG_AY31015_RX_CLOCK(0.0) - MCFG_AY31015_TX_CLOCK(0.0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( model3, model1 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( model3_map) - MCFG_CPU_IO_MAP( model3_io) - MCFG_CPU_PERIODIC_INT_DRIVER(trs80_state, trs80_rtc_interrupt, 30) - - MCFG_MACHINE_RESET_OVERRIDE(trs80_state, trs80m4 ) - - MCFG_GFXDECODE_MODIFY("gfxdecode",trs80m4) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_trs80m4) - MCFG_SCREEN_SIZE(80*8, 240) - MCFG_SCREEN_VISIBLE_AREA(0,80*8-1,0,239) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( model4, model3 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_IO_MAP( model4_io) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( model4p, model3 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_IO_MAP( model4p_io) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( sys80, model1 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_IO_MAP( sys80_io) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ht1080z, sys80 ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_ht1080z) - MCFG_GFXDECODE_MODIFY("gfxdecode", ht1080z) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( lnw80, model1 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( lnw80_map) - MCFG_CPU_IO_MAP( lnw80_io) - MCFG_MACHINE_RESET_OVERRIDE(trs80_state, lnw80 ) - - MCFG_GFXDECODE_MODIFY("gfxdecode",lnw80) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(8) - MCFG_PALETTE_INIT_OWNER(trs80_state,lnw80) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(80*6, 16*12) - MCFG_SCREEN_VISIBLE_AREA(0,80*6-1,0,16*12-1) - MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_lnw80) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( radionic, model1 ) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(64*8, 16*16) - MCFG_SCREEN_VISIBLE_AREA(0,64*8-1,0,16*16-1) - MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_radionic) - MCFG_GFXDECODE_MODIFY("gfxdecode", radionic) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( meritum, sys80 ) - MCFG_CPU_MODIFY( "maincpu" ) - MCFG_CPU_PROGRAM_MAP( meritum_map) - MCFG_CPU_IO_MAP( meritum_io) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_meritum) - MCFG_GFXDECODE_MODIFY("gfxdecode", meritum) -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(trs80) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("level1.rom", 0x0000, 0x1000, CRC(70d06dff) SHA1(20d75478fbf42214381e05b14f57072f3970f765)) - - ROM_REGION(0x00400, "chargen",0) - ROM_LOAD("trs80m1.chr", 0x0000, 0x0400, CRC(0033f2b9) SHA1(0d2cd4197d54e2e872b515bbfdaa98efe502eda7)) -ROM_END - -ROM_START(trs80l2) - ROM_REGION(0x10000, "maincpu",0) - ROM_SYSTEM_BIOS(0, "level2", "Radio Shack Level II Basic") - ROMX_LOAD("trs80.z33", 0x0000, 0x1000, CRC(37c59db2) SHA1(e8f8f6a4460a6f6755873580be6ff70cebe14969), ROM_BIOS(1)) - ROMX_LOAD("trs80.z34", 0x1000, 0x1000, CRC(05818718) SHA1(43c538ca77623af6417474ca5b95fb94205500c1), ROM_BIOS(1)) - ROMX_LOAD("trs80.zl2", 0x2000, 0x1000, CRC(306e5d66) SHA1(1e1abcfb5b02d4567cf6a81ffc35318723442369), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "rsl2", "R/S L2 Basic") - ROMX_LOAD("trs80alt.z33",0x0000, 0x1000, CRC(be46faf5) SHA1(0e63fc11e207bfd5288118be5d263e7428cc128b), ROM_BIOS(2)) - ROMX_LOAD("trs80alt.z34",0x1000, 0x1000, CRC(6c791c2d) SHA1(2a38e0a248f6619d38f1a108eea7b95761cf2aee), ROM_BIOS(2)) - ROMX_LOAD("trs80alt.zl2",0x2000, 0x1000, CRC(55b3ad13) SHA1(6279f6a68f927ea8628458b278616736f0b3c339), ROM_BIOS(2)) - - ROM_REGION(0x00400, "chargen",0) - ROM_LOAD("trs80m1.chr", 0x0000, 0x0400, CRC(0033f2b9) SHA1(0d2cd4197d54e2e872b515bbfdaa98efe502eda7)) -ROM_END - -ROM_START(radionic) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("ep1.bin", 0x0000, 0x1000, CRC(e8908f44) SHA1(7a5a60c3afbeb6b8434737dd302332179a7fca59)) - ROM_LOAD("ep2.bin", 0x1000, 0x1000, CRC(46e88fbf) SHA1(a3ca32757f269e09316e1e91ba1502774e2f5155)) - ROM_LOAD("ep3.bin", 0x2000, 0x1000, CRC(306e5d66) SHA1(1e1abcfb5b02d4567cf6a81ffc35318723442369)) - ROM_LOAD("ep4.bin", 0x3000, 0x0400, CRC(70f90f26) SHA1(cbee70da04a3efac08e50b8e3a270262c2440120)) - ROM_CONTINUE(0x3000, 0x400) - ROM_CONTINUE(0x3000, 0x600) - ROM_IGNORE(0x200) - - ROM_REGION(0x01000, "chargen",0) - ROM_LOAD("trschar.bin", 0x0000, 0x1000, CRC(02e767b6) SHA1(c431fcc6bd04ce2800ca8c36f6f8aeb2f91ce9f7)) -ROM_END - -ROM_START(sys80) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("sys80rom.1", 0x0000, 0x1000, CRC(8f5214de) SHA1(d8c052be5a2d0ec74433043684791d0554bf203b)) - ROM_LOAD("sys80rom.2", 0x1000, 0x1000, CRC(46e88fbf) SHA1(a3ca32757f269e09316e1e91ba1502774e2f5155)) - ROM_LOAD("trs80.zl2", 0x2000, 0x1000, CRC(306e5d66) SHA1(1e1abcfb5b02d4567cf6a81ffc35318723442369)) - /* This rom turns the system80 into the "blue label" version. SYSTEM then /12288 to activate. */ - ROM_LOAD("sys80.ext", 0x3000, 0x0800, CRC(2a851e33) SHA1(dad21ec60973eb66e499fe0ecbd469118826a715)) - - ROM_REGION(0x00400, "chargen",0) - ROM_LOAD("trs80m1.chr", 0x0000, 0x0400, CRC(0033f2b9) SHA1(0d2cd4197d54e2e872b515bbfdaa98efe502eda7)) -ROM_END - -ROM_START(lnw80) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("lnw_a.bin", 0x0000, 0x0800, CRC(e09f7e91) SHA1(cd28e72efcfebde6cf1c7dbec4a4880a69e683da)) - ROM_LOAD("lnw_a1.bin", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0)) - ROM_LOAD("lnw_b.bin", 0x1000, 0x0800, CRC(c4303568) SHA1(13e3d81c6f0de0e93956fa58c465b5368ea51682)) - ROM_LOAD("lnw_b1.bin", 0x1800, 0x0800, CRC(3a5ea239) SHA1(8c489670977892d7f2bfb098f5df0b4dfa8fbba6)) - ROM_LOAD("lnw_c.bin", 0x2000, 0x0800, CRC(2ba025d7) SHA1(232efbe23c3f5c2c6655466ebc0a51cf3697be9b)) - ROM_LOAD("lnw_c1.bin", 0x2800, 0x0800, CRC(ed547445) SHA1(20102de89a3ee4a65366bc2d62be94da984a156b)) - - ROM_REGION(0x00800, "chargen",0) - ROM_LOAD("lnw_chr.bin", 0x0000, 0x0800, CRC(c89b27df) SHA1(be2a009a07e4378d070002a558705e9a0de59389)) - - ROM_REGION(0x04400, "gfx2", ROMREGION_ERASEFF) /* 0x4000 for trs80_gfxram + 0x400 for videoram */ -ROM_END - -ROM_START(trs80m3) -/* ROMS we have and are missing: -HAVE TRS-80 Model III Level 1 ROM (U104) -MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC BBC4 -MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC DA75 -HAVE TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC 9639 -HAVE TRS-80 Model III Level 2 (ENGLISH) ROM B (U105) ver. CRC 407C -MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2B91 - early mfg. #80040316 -MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 278A - no production REV A -HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2EF8 - Manufacturing #80040316 REV B -HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2F84 - Manufacturing #80040316 REV C -MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 2764 - Network III v1 -HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 276A - Network III v2 -MISSING TRS-80 Model III Level 2 (BELGIUM) CRC ???? -Note: Be careful when dumping rom C: if dumped on the trs-80 m3 with software, bytes 0x7e8 and 0x7e9 (addresses 0x37e8, 0x0x37e9) - will read as 0xFF 0xFF; on the original rom, these bytes are 0x00 0x00 (for eproms) or 0xAA 0xAA (for mask roms), those two bytes are used for printer status on the trs-80 and are mapped on top of the rom; This problem should be avoided by pulling the rom chips and dumping them directly. -*/ - ROM_REGION(0x20000, "maincpu",0) - ROM_SYSTEM_BIOS(0, "trs80m3_revc", "Level 2 bios, RomC Rev C") - ROMX_LOAD("8041364.u104", 0x0000, 0x2000, CRC(ec0c6daa) SHA1(257cea6b9b46912d4681251019ec2b84f1b95fc8), ROM_BIOS(1)) // Label: "SCM91248C // Tandy (c) 80 // 8041364 // 8134" (Level 2 bios ROM A '9639') - ROMX_LOAD("8040332.u105", 0x2000, 0x1000, CRC(ed4ee921) SHA1(ec0a19d4b72f71e51965de63250009c3c4e4cab3), ROM_BIOS(1)) // Label: "SCM91619P // Tandy (c) 80 // 8040332 // QQ8117", (Level 2 bios ROM B '407c') - ROMX_LOAD("8040316c.u106", 0x3000, 0x0800, CRC(c8f79433) SHA1(6f395bba822d39d3cd2b73c8ea25aab4c4c26da7), ROM_BIOS(1)) // Label: "SCM91692P // Tandy (c) 81 // 8040316-C // QQ8220" (Level 2 bios ROM C REV C '2f84') - ROM_SYSTEM_BIOS(1, "trs80m3_revb", "Level 2 bios, RomC Rev B") - ROMX_LOAD("8041364.u104", 0x0000, 0x2000, CRC(ec0c6daa) SHA1(257cea6b9b46912d4681251019ec2b84f1b95fc8), ROM_BIOS(2)) // Label: "SCM91248C // Tandy (c) 80 // 8041364 // 8134" (Level 2 bios ROM A '9639') - ROMX_LOAD("8040332.u105", 0x2000, 0x1000, CRC(ed4ee921) SHA1(ec0a19d4b72f71e51965de63250009c3c4e4cab3), ROM_BIOS(2)) // Label: "SCM91619P // Tandy (c) 80 // 8040332 // QQ8117", (Level 2 bios ROM B '407c') - ROMX_LOAD("8040316b.u106", 0x3000, 0x0800, CRC(84a5702d) SHA1(297dca756a9d3c6fd13e0fa6f93d172ff795b520), ROM_BIOS(2)) // Label: "SCM91692P // Tandy (c) 80 // 8040316B // QQ8040" (Level 2 bios ROM C REV B '2ef8') - ROM_SYSTEM_BIOS(2, "trs80m3_n3v2", "Level 2 bios, Network III v2 (student)") - ROMX_LOAD("8041364.u104", 0x0000, 0x2000, CRC(ec0c6daa) SHA1(257cea6b9b46912d4681251019ec2b84f1b95fc8), ROM_BIOS(3)) // Label: "SCM91248C // Tandy (c) 80 // 8041364 // 8134" (Level 2 bios ROM A '9639') - ROMX_LOAD("8040332.u105", 0x2000, 0x1000, CRC(ed4ee921) SHA1(ec0a19d4b72f71e51965de63250009c3c4e4cab3), ROM_BIOS(3)) // Label: "SCM91619P // Tandy (c) 80 // 8040332 // QQ8117" (Level 2 bios ROM B '407c') - ROMX_LOAD("276a.u106", 0x3000, 0x0800, CRC(7d38720a) SHA1(bef621e5ae2a8c1f9e7f6325b7841f5ab8ab7e6a), ROM_BIOS(3)) // 2716 EPROM Label: "MOD.III // ROM C // (276A)" (Network III v2 ROM C '276a') - ROM_SYSTEM_BIOS(3, "trs80m3_l1", "Level 1 bios") - ROMX_LOAD("8040032.u104", 0x0000, 0x1000, CRC(6418d641) SHA1(f823ab6ceb102588d27e5f5c751e31175289291c), ROM_BIOS(4) ) // Label: "8040032 // (M) QQ8028 // SCM91616P"; Silkscreen: "TANDY // (C) '80"; (Level 1 bios) - - ROM_REGION(0x00800, "chargen",0) /* correct for later systems; the trs80m3_l1 bios uses the non-a version of this rom, dump is pending */ - ROM_LOAD("8044316.u36", 0x0000, 0x0800, NO_DUMP) // Label: "(M) // SCM91665P // 8044316 // QQ8029" ('no-letter' revision) - ROM_LOAD("8044316a.u36", 0x0000, 0x0800, CRC(444c8b60) SHA1(c52ee41439bd5e57c3b113ebfd61c951e2af4446)) // Label: "Tandy (C) 81 // 8044316A // 8206" (rev A) -ROM_END - -// for model 4 and 4p info, see http://vt100.net/mirror/harte/Radio%20Shack/TRS-80%20Model%204_4P%20Soft%20Tech%20Ref.pdf -ROM_START(trs80m4) - ROM_REGION(0x20000, "maincpu",0) - ROM_LOAD("trs80m4.rom", 0x0000, 0x3800, BAD_DUMP CRC(1a92d54d) SHA1(752555fdd0ff23abc9f35c6e03d9d9b4c0e9677b)) // should be split into 3 roms, roms A, B, C, exactly like trs80m3; in fact, roms A and B are shared between both systems. - - ROM_REGION(0x00800, "chargen",0) - ROM_LOAD("8044316a.u36", 0x0000, 0x0800, CRC(444c8b60) SHA1(c52ee41439bd5e57c3b113ebfd61c951e2af4446)) // according to parts catalog, this is the correct rom for both model 3 and 4 -ROM_END - -ROM_START(trs80m4p) // uses a completely different memory map scheme to the others; the trs-80 model 3 roms are loaded from a boot disk, the only rom on the machine is a bootloader; bootloader can be banked out of 0x0000-0x1000 space which is replaced with ram; see the tech ref pdf, pdf page 62 - ROM_REGION(0x20000, "maincpu",0) - ROM_SYSTEM_BIOS(0, "trs80m4p", "Level 2 bios, gate array machine") - ROMX_LOAD("8075332.u69", 0x0000, 0x1000, CRC(3a738aa9) SHA1(6393396eaa10a84b9e9f0cf5930aba73defc5c52), ROM_BIOS(1)) // Label: "SCM95060P // 8075332 // TANDY (C) 1983 // 8421" at location U69 (may be located at U70 on some pcb revisions) - ROM_SYSTEM_BIOS(1, "trs80m4p_hack", "Disk loader hack") - ROMX_LOAD("trs80m4p_loader_hack.rom", 0x0000, 0x01f8, CRC(7ff336f4) SHA1(41184f5240b4b54f3804f5a22b4d78bbba52ed1d), ROM_BIOS(2)) - - ROM_REGION(0x00800, "chargen",0) - ROM_LOAD("8049007.u103", 0x0000, 0x0800, CRC(1ac44bea) SHA1(c9426ab2b2aa5380dc97a7b9c048ccd1bbde92ca)) // Label: "SCM95987P // 8049007 // TANDY (C) 1983 // 8447" at location U103 (may be located at U43 on some pcb revisions) -ROM_END - -ROM_START(ht1080z) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("ht1080z.rom", 0x0000, 0x3000, CRC(2bfef8f7) SHA1(7a350925fd05c20a3c95118c1ae56040c621be8f)) - ROM_LOAD("sys80.ext", 0x3000, 0x0800, CRC(2a851e33) SHA1(dad21ec60973eb66e499fe0ecbd469118826a715)) - - ROM_REGION(0x00800, "chargen",0) - ROM_LOAD("ht1080z.chr", 0x0000, 0x0800, CRC(e8c59d4f) SHA1(a15f30a543e53d3e30927a2e5b766fcf80f0ae31)) -ROM_END - -ROM_START(ht1080z2) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("ht1080z.rom", 0x0000, 0x3000, CRC(2bfef8f7) SHA1(7a350925fd05c20a3c95118c1ae56040c621be8f)) - ROM_LOAD("ht1080z2.ext", 0x3000, 0x0800, CRC(07415ac6) SHA1(b08746b187946e78c4971295c0aefc4e3de97115)) - - ROM_REGION(0x00800, "chargen",0) - ROM_LOAD("ht1080z2.chr", 0x0000, 0x0800, CRC(6728f0ab) SHA1(1ba949f8596f1976546f99a3fdcd3beb7aded2c5)) -ROM_END - -ROM_START(ht108064) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD("ht108064.rom", 0x0000, 0x3000, CRC(48985a30) SHA1(e84cf3121f9e0bb9e1b01b095f7a9581dcfaaae4)) - ROM_LOAD("ht108064.ext", 0x3000, 0x0800, CRC(fc12bd28) SHA1(0da93a311f99ec7a1e77486afe800a937778e73b)) - - ROM_REGION(0x00800, "chargen",0) - ROM_LOAD("ht108064.chr", 0x0000, 0x0800, CRC(e76b73a4) SHA1(6361ee9667bf59d50059d09b0baf8672fdb2e8af)) -ROM_END - -ROM_START( meritum) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD( "01.bin", 0x0000, 0x0800, CRC(ed705a47) SHA1(dae8b14eb2ddb2a8b4458215180ebc0fb781816a)) - ROM_LOAD( "02.bin", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0)) - ROM_LOAD( "03.bin", 0x1000, 0x0800, CRC(a21d0d62) SHA1(6dfdf3806ed2b6502e09a1b6922f21494134cc05)) - ROM_LOAD( "04.bin", 0x1800, 0x0800, CRC(3610bdda) SHA1(602f0ba1e1267f24620f993acac019ac6342a594)) - ROM_LOAD( "05.bin", 0x2000, 0x0800, CRC(461fbf0d) SHA1(bd19187dd992168af43bd68055343d515f152624)) - ROM_LOAD( "06.bin", 0x2800, 0x0800, CRC(ed547445) SHA1(20102de89a3ee4a65366bc2d62be94da984a156b)) - ROM_LOAD( "07.bin", 0x3000, 0x0800, CRC(044b1459) SHA1(faace7353ffbef6587b1b9e7f8b312e0892e3427)) - ROM_REGION(0x1000, "chargen", ROMREGION_INVERT) - ROM_LOAD( "chargen.bin", 0x0000, 0x1000, CRC(3dfc6439) SHA1(6e45a27f68c3491c403b4eafe45a108f348dd2fd)) -ROM_END - -ROM_START( meritum_net ) - ROM_REGION(0x10000, "maincpu",0) - ROM_LOAD( "01_447_m07_015m.bin", 0x0000, 0x0800, CRC(6d30cb49) SHA1(558241340a84eebcbbf8d92540e028e9164b6f8a)) - ROM_LOAD( "02_440_m08_01.bin", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0)) - ROM_LOAD( "03_440_m09_015m.bin", 0x1000, 0x0800, CRC(88e267da) SHA1(9cb8626801f8e969f35291de43c1b643c809a3c3)) - ROM_LOAD( "04_447_m10_015m.bin", 0x1800, 0x0800, CRC(e51991e4) SHA1(a7d42436da1af405970f9f99ab34b6d9abd05adf)) - ROM_LOAD( "05_440_m11_02.bin", 0x2000, 0x0800, CRC(461fbf0d) SHA1(bd19187dd992168af43bd68055343d515f152624)) - ROM_LOAD( "06_440_m12_01.bin", 0x2800, 0x0800, CRC(ed547445) SHA1(20102de89a3ee4a65366bc2d62be94da984a156b)) - ROM_LOAD( "07_447_m13_015m.bin", 0x3000, 0x0800, CRC(789f6964) SHA1(9b2231ca7ffd82bbca1f53988a7df833290ddbf2)) - ROM_REGION(0x1000, "chargen", ROMREGION_INVERT) - ROM_LOAD( "char.bin", 0x0000, 0x1000, CRC(2c09a5a7) SHA1(146891b3ddfc2de95e6a5371536394a657880054)) -ROM_END - -DRIVER_INIT_MEMBER(trs80_state,trs80) -{ - m_mode = 0; - m_model4 = 0; -} - -DRIVER_INIT_MEMBER(trs80_state,trs80l2) -{ - m_mode = 2; - m_model4 = 0; -} - -DRIVER_INIT_MEMBER(trs80_state,trs80m4) -{ - m_mode = 0; - m_model4 = 2; - m_p_videoram.set_target(memregion("maincpu")->base()+0x4000,m_p_videoram.bytes()); -} - -DRIVER_INIT_MEMBER(trs80_state,trs80m4p) -{ - m_mode = 0; - m_model4 = 4; - m_p_videoram.set_target(memregion("maincpu")->base()+0x4000,m_p_videoram.bytes()); -} - -DRIVER_INIT_MEMBER(trs80_state,lnw80) -{ - m_mode = 0; - m_model4 = 0; - m_p_gfxram = memregion("gfx2")->base(); - m_p_videoram.set_target(memregion("maincpu")->base()+0x4000,m_p_videoram.bytes()); -} - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1977, trs80, 0, 0, trs80, trs80, trs80_state, trs80, "Tandy Radio Shack", "TRS-80 Model I (Level I Basic)", 0 ) -COMP( 1978, trs80l2, trs80, 0, model1, trs80, trs80_state, trs80l2, "Tandy Radio Shack", "TRS-80 Model I (Level II Basic)", 0 ) -COMP( 1983, radionic, trs80, 0, radionic, trs80, trs80_state, trs80, "Komtek", "Radionic", 0 ) -COMP( 1980, sys80, trs80, 0, sys80, trs80, trs80_state, trs80l2, "EACA Computers Ltd", "System-80", 0 ) -COMP( 1981, lnw80, trs80, 0, lnw80, trs80m3, trs80_state, lnw80, "LNW Research", "LNW-80", 0 ) -COMP( 1980, trs80m3, trs80, 0, model3, trs80m3, trs80_state, trs80m4, "Tandy Radio Shack", "TRS-80 Model III", 0 ) -COMP( 1980, trs80m4, trs80, 0, model4, trs80m3, trs80_state, trs80m4, "Tandy Radio Shack", "TRS-80 Model 4", 0 ) -COMP( 1983, trs80m4p, trs80, 0, model4p, trs80m3, trs80_state, trs80m4p, "Tandy Radio Shack", "TRS-80 Model 4P", 0 ) -COMP( 1983, ht1080z, trs80, 0, ht1080z, trs80, trs80_state, trs80l2, "Hiradastechnika Szovetkezet", "HT-1080Z Series I", 0 ) -COMP( 1984, ht1080z2, trs80, 0, ht1080z, trs80, trs80_state, trs80l2, "Hiradastechnika Szovetkezet", "HT-1080Z Series II", 0 ) -COMP( 1985, ht108064, trs80, 0, ht1080z, trs80, trs80_state, trs80, "Hiradastechnika Szovetkezet", "HT-1080Z/64", 0 ) -COMP( 1985, meritum, trs80, 0, meritum, trs80, trs80_state, trs80l2, "Mera-Elzab", "Meritum I (Model 2)", 0 ) -COMP( 1985, meritum_net, trs80, 0, meritum, trs80, trs80_state, trs80l2, "Mera-Elzab", "Meritum I (Model 2) (network)", 0 ) diff --git a/src/mess/drivers/trs80m2.c b/src/mess/drivers/trs80m2.c deleted file mode 100644 index 57b2e20bcff..00000000000 --- a/src/mess/drivers/trs80m2.c +++ /dev/null @@ -1,953 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Tandy Radio Shack TRS-80 Model II/12/16/16B/6000 - - http://home.iae.nl/users/pb0aia/cm/modelii.html - -*/ - -/* - - TODO: - - - CP/M won't load prompt (z80dma_do_operation: invalid mode 0 when reading track 0) - - keyboard CPU ROM - - graphics board - - Tandy 6000 HD - - chdman -createblankhd tandy6000hd.chd 306 6 34 256 - -*/ - -#include "includes/trs80m2.h" - -#define KEYBOARD_TAG "keyboard" - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -READ8_MEMBER( trs80m2_state::read ) -{ - UINT8 data = 0; - - if (offset < 0x800) - { - if (m_boot_rom) - { - data = m_rom->base()[offset]; - } - else - { - data = m_ram->pointer()[offset]; - } - } - else if (offset < 0x8000) - { - data = m_ram->pointer()[offset]; - } - else - { - if (m_msel && offset >= 0xf800) - { - data = m_video_ram[offset & 0x7ff]; - } - else if (m_bank) - { - offs_t addr = (m_bank << 15) | (offset & 0x7fff); - - if (addr < m_ram->size()) - { - data = m_ram->pointer()[addr]; - } - } - } - - return data; -} - -WRITE8_MEMBER( trs80m2_state::write ) -{ - if (offset < 0x8000) - { - m_ram->pointer()[offset] = data; - } - else - { - if (m_msel && offset >= 0xf800) - { - m_video_ram[offset & 0x7ff] = data; - } - else if (m_bank) - { - offs_t addr = (m_bank << 15) | (offset & 0x7fff); - - if (addr < m_ram->size()) - { - m_ram->pointer()[addr] = data; - } - } - } -} - -WRITE8_MEMBER( trs80m2_state::rom_enable_w ) -{ - /* - - bit description - - 0 BOOT ROM - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - m_boot_rom = BIT(data, 0); -} - -WRITE8_MEMBER( trs80m2_state::drvslt_w ) -{ - /* - - bit signal - - 0 DS1 - 1 DS2 - 2 DS3 - 3 DS4 - 4 - 5 - 6 SDSEL - 7 FM/MFM - - */ - - // drive select - m_floppy = NULL; - - if (!BIT(data, 0)) m_floppy = m_floppy0->get_device(); - if (!BIT(data, 1)) m_floppy = m_floppy1->get_device(); - if (!BIT(data, 2)) m_floppy = m_floppy2->get_device(); - if (!BIT(data, 3)) m_floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(m_floppy); - - if (m_floppy) - { - // side select - m_floppy->ss_w(!BIT(data, 6)); - } - - // FM/MFM - m_fdc->dden_w(!BIT(data, 7)); -} - -READ8_MEMBER( trs80m2_state::keyboard_r ) -{ - // clear keyboard interrupt - if (!m_kbirq) - { - m_kbirq = 1; - m_ctc->trg3(m_kbirq); - m_kb->busy_w(m_kbirq); - } - - m_key_bit = 0; - - return m_key_data; -} - -READ8_MEMBER( trs80m2_state::rtc_r ) -{ - // clear RTC interrupt - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - - return 0; -} - -READ8_MEMBER( trs80m2_state::nmi_r ) -{ - /* - - bit signal description - - 0 - 1 - 2 - 3 - 4 80/40 CHAR EN 80/40 character mode - 5 ENABLE RTC INT RTC interrupt enable - 6 DE display enabled - 7 KBIRQ keyboard interrupt - - */ - - UINT8 data = 0; - - // 80/40 character mode*/ - data |= m_80_40_char_en << 4; - - // RTC interrupt enable - data |= m_enable_rtc_int << 5; - - // display enabled - data |= m_de << 6; - - // keyboard interrupt - data |= !m_kbirq << 7; - - return data; -} - -WRITE8_MEMBER( trs80m2_state::nmi_w ) -{ - /* - - bit signal description - - 0 memory bank select bit 0 - 1 memory bank select bit 1 - 2 memory bank select bit 2 - 3 memory bank select bit 3 - 4 80/40 CHAR EN 80/40 character mode - 5 ENABLE RTC INT RTC interrupt enable - 6 BLNKVID video display enable - 7 video RAM enable - - */ - - // memory bank select - m_bank = data & 0x0f; - - // 80/40 character mode - m_80_40_char_en = BIT(data, 4); - m_crtc->set_clock(m_80_40_char_en ? XTAL_12_48MHz/16 : XTAL_12_48MHz/8); - - // RTC interrupt enable - m_enable_rtc_int = BIT(data, 5); - - if (m_enable_rtc_int && m_rtc_int) - { - // trigger RTC interrupt - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - } - - // video display enable - m_blnkvid = BIT(data, 6); - - // video RAM enable - m_msel = BIT(data, 7); -} - -READ8_MEMBER( trs80m2_state::fdc_r ) -{ - return m_fdc->gen_r(offset) ^ 0xff; -} - -WRITE8_MEMBER( trs80m2_state::fdc_w ) -{ - m_fdc->gen_w(offset, data ^ 0xff); -} - -WRITE8_MEMBER( trs80m16_state::tcl_w ) -{ - /* - - bit description - - 0 CONT0 - 1 CONT1 - 2 HALT - 3 RESET - 4 CONT4 - 5 CONT5 - 6 CONT6 - 7 A14 - - */ - - m_subcpu->set_input_line(INPUT_LINE_HALT, BIT(data, 2) ? ASSERT_LINE : CLEAR_LINE); - m_subcpu->set_input_line(INPUT_LINE_RESET, BIT(data, 3) ? ASSERT_LINE : CLEAR_LINE); - - m_pic->ir0_w(BIT(data, 4)); - m_pic->ir1_w(BIT(data, 5)); - m_pic->ir2_w(BIT(data, 6)); - - m_ual = (m_ual & 0x1fe) | BIT(data, 7); -} - -WRITE8_MEMBER( trs80m16_state::ual_w ) -{ - /* - - bit description - - 0 A15 - 1 A16 - 2 A17 - 3 A18 - 4 A19 - 5 A20 - 6 A21 - 7 A22 - - */ - - m_ual = (data << 1) | BIT(m_ual, 0); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( z80_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, trs80m2_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( z80_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( z80_io, AS_IO, 8, trs80m2_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_device, read, write) - AM_RANGE(0xe4, 0xe7) AM_READWRITE(fdc_r, fdc_w) - AM_RANGE(0xef, 0xef) AM_WRITE(drvslt_w) - AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, cd_ba_r, cd_ba_w) - AM_RANGE(0xf8, 0xf8) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) - AM_RANGE(0xf9, 0xf9) AM_WRITE(rom_enable_w) - AM_RANGE(0xfc, 0xfc) AM_READ(keyboard_r) AM_DEVWRITE(MC6845_TAG, mc6845_device, address_w) - AM_RANGE(0xfd, 0xfd) AM_DEVREADWRITE(MC6845_TAG, mc6845_device, register_r, register_w) - AM_RANGE(0xfe, 0xfe) AM_READ(rtc_r) - AM_RANGE(0xff, 0xff) AM_READWRITE(nmi_r, nmi_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( m16_z80_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( m16_z80_io, AS_IO, 8, trs80m16_state ) - AM_IMPORT_FROM(z80_io) - AM_RANGE(0xde, 0xde) AM_WRITE(tcl_w) - AM_RANGE(0xdf, 0xdf) AM_WRITE(ual_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( m68000_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( m68000_mem, AS_PROGRAM, 16, trs80m2_state ) -// AM_RANGE(0x7800d0, 0x7800d1) PIC -// AM_RANGE(0x7800d2, 0x7800d3) limit/offset 2 -// AM_RANGE(0x7800d4, 0x7800d5) limit/offset 1 -// AM_RANGE(0x7800d6, 0x7800d7) Z80 IRQ -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( trs80m2 ) -//------------------------------------------------- - -static INPUT_PORTS_START( trs80m2 ) -INPUT_PORTS_END - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -MC6845_UPDATE_ROW( trs80m2_state::crtc_update_row ) -{ - const pen_t *pen = m_palette->pens(); - - int x = 0; - - for (int column = 0; column < x_count; column++) - { - UINT8 code = m_video_ram[(ma + column) & 0x7ff]; - offs_t address = ((code & 0x7f) << 4) | (ra & 0x0f); - UINT8 data = m_char_rom->base()[address]; - - int dcursor = (column == cursor_x); - int drevid = BIT(code, 7); - - for (int bit = 0; bit < 8; bit++) - { - int dout = BIT(data, 7); - int color = (dcursor ^ drevid ^ dout) && de; - - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; - - data <<= 1; - } - } -} - -WRITE_LINE_MEMBER( trs80m2_state::de_w ) -{ - m_de = state; -} - -WRITE_LINE_MEMBER( trs80m2_state::vsync_w ) -{ - if (state) - { - m_rtc_int = !m_rtc_int; - - if (m_enable_rtc_int && m_rtc_int) - { - // trigger RTC interrupt - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - } - } -} - -void trs80m2_state::video_start() -{ - // allocate memory - m_video_ram.allocate(0x800); -} - -UINT32 trs80m2_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - if (m_blnkvid) - { - bitmap.fill(rgb_t::black, cliprect); - } - else - { - m_crtc->screen_update(screen, bitmap, cliprect); - } - - return 0; -} - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// TRS80M2_KEYBOARD_INTERFACE( kb_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( trs80m2_state::kb_clock_w ) -{ - int kbdata = m_kb->data_r(); - - if (m_key_bit == 8) - { - if (!m_kbdata && kbdata) - { - // trigger keyboard interrupt - m_kbirq = 0; - m_ctc->trg3(m_kbirq); - m_kb->busy_w(m_kbirq); - } - } - else - { - if (!m_kbclk && state) - { - // shift in keyboard data bit - m_key_data <<= 1; - m_key_data |= kbdata; - m_key_bit++; - } - } - - m_kbdata = kbdata; - m_kbclk = state; -} - -WRITE8_MEMBER( trs80m2_state::kbd_w ) -{ - // latch key data - m_key_data = data; - - // trigger keyboard interrupt - m_kbirq = 0; - m_ctc->trg3(m_kbirq); -} - -//------------------------------------------------- -// Z80DMA -//------------------------------------------------- - -READ8_MEMBER(trs80m2_state::io_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(trs80m2_state::io_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.write_byte(offset, data); -} - -//------------------------------------------------- -// Z80PIO -//------------------------------------------------- - -WRITE_LINE_MEMBER( trs80m2_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( trs80m2_state::write_centronics_fault ) -{ - m_centronics_fault = state; -} - -WRITE_LINE_MEMBER( trs80m2_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -READ8_MEMBER( trs80m2_state::pio_pa_r ) -{ - /* - - bit signal description - - 0 INTRQ FDC INT request - 1 _TWOSID 2-sided diskette - 2 _DSKCHG disk change - 3 PRIME prime - 4 FAULT printer fault - 5 PSEL printer select - 6 PE paper empty - 7 BUSY printer busy - - */ - - UINT8 data = 0; - - // floppy interrupt - data |= (m_fdc->intrq_r() ? 0x01 : 0x00); - - // 2-sided diskette - data |= (m_floppy ? m_floppy->twosid_r() : 1) << 1; - - // disk change - data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 2; - - // printer fault - data |= m_centronics_fault << 4; - - // paper empty - data |= m_centronics_perror << 6; - - // printer busy - data |= m_centronics_busy << 7; - - return data; -} - -WRITE8_MEMBER( trs80m2_state::pio_pa_w ) -{ - /* - - bit signal description - - 0 INTRQ FDC INT request - 1 _TWOSID 2-sided diskette - 2 _DSKCHG disk change - 3 PRIME prime - 4 FAULT printer fault - 5 PSEL printer select - 6 PE paper empty - 7 BUSY printer busy - - */ - - // prime - m_centronics->write_init(BIT(data, 3)); -} - -WRITE_LINE_MEMBER( trs80m2_state::strobe_w ) -{ - m_centronics->write_strobe(!state); -} - -//------------------------------------------------- -// Z80CTC -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(trs80m2_state::ctc_tick) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); - - m_ctc->trg1(1); - m_ctc->trg1(0); - - m_ctc->trg2(1); - m_ctc->trg2(0); -} - -static SLOT_INTERFACE_START( trs80m2_floppies ) - SLOT_INTERFACE( "8ssdd", FLOPPY_8_SSDD ) // Shugart SA-800 - SLOT_INTERFACE( "8dsdd", FLOPPY_8_DSDD ) // Shugart SA-850 -SLOT_INTERFACE_END - - -//------------------------------------------------- -// z80_daisy_config trs80m2_daisy_chain -//------------------------------------------------- - -static const z80_daisy_config trs80m2_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80SIO_TAG }, - { Z80DMA_TAG }, - { Z80PIO_TAG }, - { NULL } -}; - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// machine_start -//------------------------------------------------- - -void trs80m2_state::machine_start() -{ - // register for state saving - save_item(NAME(m_boot_rom)); - save_item(NAME(m_bank)); - save_item(NAME(m_msel)); - save_item(NAME(m_key_latch)); - save_item(NAME(m_key_data)); - save_item(NAME(m_key_bit)); - save_item(NAME(m_kbclk)); - save_item(NAME(m_kbdata)); - save_item(NAME(m_kbirq)); - save_item(NAME(m_blnkvid)); - save_item(NAME(m_80_40_char_en)); - save_item(NAME(m_de)); - save_item(NAME(m_rtc_int)); - save_item(NAME(m_enable_rtc_int)); -} - -void trs80m16_state::machine_start() -{ - trs80m2_state::machine_start(); - - // register for state saving - save_item(NAME(m_ual)); - save_item(NAME(m_limit)); - save_item(NAME(m_offset)); -} - - -//------------------------------------------------- -// machine_reset -//------------------------------------------------- - -void trs80m2_state::machine_reset() -{ - // clear keyboard interrupt - m_kbirq = 1; - m_ctc->trg3(m_kbirq); - m_kb->busy_w(m_kbirq); - - // enable boot ROM - m_boot_rom = 1; - - // disable video RAM - m_msel = 0; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( trs80m2 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( trs80m2, trs80m2_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) - MCFG_CPU_CONFIG(trs80m2_daisy_chain) - MCFG_CPU_PROGRAM_MAP(z80_mem) - MCFG_CPU_IO_MAP(z80_io) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_UPDATE_DRIVER(trs80m2_state, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_12_48MHz/8) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(trs80m2_state, crtc_update_row) - MCFG_MC6845_OUT_DE_CB(WRITELINE(trs80m2_state, de_w)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(trs80m2_state, vsync_w)) - - // devices - MCFG_FD1791_ADD(FD1791_TAG, XTAL_8MHz/4) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITE8(Z80PIO_TAG, z80pio_device, pa_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(Z80DMA_TAG, z80dma_device, rdy_w)) - MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":0", trs80m2_floppies, "8dsdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":1", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_8MHz/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxca_w)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, txca_w)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", trs80m2_state, ctc_tick, attotime::from_hz(XTAL_8MHz/2/2)) - - MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_8MHz/2) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(trs80m2_state, read)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(trs80m2_state, write)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(trs80m2_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(trs80m2_state, io_write_byte)) - - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_8MHz/2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(trs80m2_state, pio_pa_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(trs80m2_state, pio_pa_w)) - MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(trs80m2_state, strobe_w)) - - MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_8MHz/2, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(Z80PIO_TAG, z80pio_device, strobe_b)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(trs80m2_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(trs80m2_state, write_centronics_fault)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(trs80m2_state, write_centronics_perror)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_DEVICE_ADD(TRS80M2_KEYBOARD_TAG, TRS80M2_KEYBOARD, 0) - MCFG_TRS80M2_KEYBOARD_CLOCK_CALLBACK(WRITELINE(trs80m2_state, kb_clock_w)) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(trs80m2_state, kbd_w)) - - // internal RAM - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("32K,96K,128K,160K,192K,224K,256K,288K,320K,352K,384K,416K,448K,480K,512K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "trs80m2") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( trs80m16 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( trs80m16, trs80m16_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) - MCFG_CPU_CONFIG(trs80m2_daisy_chain) - MCFG_CPU_PROGRAM_MAP(z80_mem) - MCFG_CPU_IO_MAP(m16_z80_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(AM9519A_TAG, pic8259_device, inta_cb) - - MCFG_CPU_ADD(M68000_TAG, M68000, XTAL_24MHz/4) - MCFG_CPU_PROGRAM_MAP(m68000_mem) - MCFG_DEVICE_DISABLE() - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_UPDATE_DRIVER(trs80m2_state, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_12_48MHz/8) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(trs80m2_state, crtc_update_row) - MCFG_MC6845_OUT_DE_CB(WRITELINE(trs80m2_state, de_w)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(trs80m2_state, vsync_w)) - - // devices - MCFG_FD1791_ADD(FD1791_TAG, XTAL_8MHz/4) - MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITE8(Z80PIO_TAG, z80pio_device, pa_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE(Z80DMA_TAG, z80dma_device, rdy_w)) - MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":0", trs80m2_floppies, "8dsdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":1", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_8MHz/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxca_w)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, txca_w)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", trs80m2_state, ctc_tick, attotime::from_hz(XTAL_8MHz/2/2)) - - MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, XTAL_8MHz/2) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(trs80m2_state, read)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(trs80m2_state, write)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(trs80m2_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(trs80m2_state, io_write_byte)) - - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_8MHz/2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(trs80m2_state, pio_pa_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(trs80m2_state, pio_pa_w)) - MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_Z80PIO_OUT_BRDY_CB(WRITELINE(trs80m2_state, strobe_w)) - - MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_8MHz/2, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_PIC8259_ADD(AM9519A_TAG, INPUTLINE(M68000_TAG, M68K_IRQ_5), VCC, NULL ) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(Z80PIO_TAG, z80pio_device, strobe_b)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(trs80m2_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(trs80m2_state, write_centronics_fault)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(trs80m2_state, write_centronics_perror)) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_DEVICE_ADD(TRS80M2_KEYBOARD_TAG, TRS80M2_KEYBOARD, 0) - MCFG_TRS80M2_KEYBOARD_CLOCK_CALLBACK(WRITELINE(trs80m2_state, kb_clock_w)) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(trs80m2_state, kbd_w)) - - // internal RAM - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_RAM_EXTRA_OPTIONS("512K,768K,1M") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "trs80m2") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -/* - - TRS-80 Model II/16 Z80 CPU Board ROM - - It would seem that every processor board I find has a different ROM on it! It seems that the early ROMs - don't boot directly from a hard drive. But there seems to be many versions of ROMs. I've placed them in - order of serial number in the list below. There also appears to be at least two board revisions, "C" and "D". - - cpu_c8ff.bin/hex: - Mask Programmable PROM, Equivilant to Intel 2716 EPROM, with checksum C8FF came from a cpu board with - serial number 120353 out of a Model II with serial number 2002102 and catalog number 26-6002. The board - was labeled, "Revision C". This appears to be an early ROM and according to a very helpful fellow - collector, Aaron in Australia, doesn't allow boot directly from a hard disk. - - cpu_9733.bin/hex: - An actual SGS-Ates (Now STMicroelectronics) 2716 EPROM, with checksum 9733 came from a cpu board with - serial number 161993 out of a pile of random cards that I have. I don't know what machine it originated - from. The board was labeled, "Revision C". This appears to be a later ROM in that it is able to boot - directly from an 8MB hard disk. The EPROM had a windows sticker on it labeled, "U54". - - cpu_2119.bin/hex: - An actual Texas Instruments TMS2516 EPROM, with checksum 2119 came from a cpu board with serial number - 178892 out of a Model 16 with serial number 64014509 and catalog number 26-4002. The board was labeled, - "Revision D". This appears to be a later ROM and does appear to allow boot directly from an 8MB hard disk. - - cpu_2bff.bin/hex: - Mask Programmable PROM, Equivilant to Intel 2716 EPROM, with checksum 2BFF came from a cpu board with - serial number 187173 our of a pile of random cards that I have. I don't know what machine it originated - from. The board was labeled, "Revision D". This appears to be a later ROM in that it is able to boot - directly from an 8MB hard disk. - -*/ - -//------------------------------------------------- -// ROM( trs80m2 ) -//------------------------------------------------- - -ROM_START( trs80m2 ) - ROM_REGION( 0x800, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "9733" ) - ROM_SYSTEM_BIOS( 0, "c8ff", "Version 1" ) - ROMX_LOAD( "8043216.u11", 0x0000, 0x0800, CRC(7017a373) SHA1(1c7127fcc99fc351a40d3a3199ba478e783c452e), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "2bff", "Version 2 (1981-07-29)" ) - ROMX_LOAD( "8047316.u11", 0x0000, 0x0800, CRC(c6c71d8b) SHA1(7107e2cbbe769851a4460680c2deff8e76a101b5), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "2119", "Version 3 (1982-05-07)" ) - ROMX_LOAD( "cpu_2119.u11", 0x0000, 0x0800, CRC(7a663049) SHA1(f308439ce266df717bfe79adcdad6024b4faa141), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "1bbe", "Version 3 (1982-05-07, Alt)" ) - ROMX_LOAD( "cpu_11be.u11", 0x0000, 0x0800, CRC(8edceea7) SHA1(3d797acedd8a71a82c695129ca764f85aa9022b2), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "fc86", "Version 4 (1982-11-18)" ) - ROMX_LOAD( "cpu_fc86.u11", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(5) ) - ROM_SYSTEM_BIOS( 5, "9733", "Version 5 (1983-07-29)" ) - ROMX_LOAD( "u54.u11", 0x0000, 0x0800, CRC(823924b1) SHA1(aee0625bcbd8620b28ab705e15ad9bea804c8476), ROM_BIOS(6) ) - - ROM_REGION( 0x800, MC6845_TAG, 0 ) - ROM_LOAD( "8043316.u9", 0x0000, 0x0800, CRC(04425b03) SHA1(32a29dc202b7fcf21838289cc3bffc51ef943dab) ) -ROM_END - - -//------------------------------------------------- -// ROM( trs80m16 ) -//------------------------------------------------- - -#define rom_trs80m16 rom_trs80m2 - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1979, trs80m2, 0, 0, trs80m2, trs80m2, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model II", MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) -COMP( 1982, trs80m16, trs80m2, 0, trs80m16, trs80m2, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 16", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) -//COMP( 1983, trs80m12, trs80m2, 0, trs80m16, trs80m2, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 12", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) -//COMP( 1984, trs80m16b,trs80m2, 0, trs80m16, trs80m2, driver_device, 0, "Tandy Radio Shack", "TRS-80 Model 16B", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) -//COMP( 1985, tandy6k, trs80m2, 0, tandy6k, trs80m2, driver_device, 0, "Tandy Radio Shack", "Tandy 6000 HD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_KEYBOARD ) diff --git a/src/mess/drivers/ts802.c b/src/mess/drivers/ts802.c deleted file mode 100644 index 19680c956cb..00000000000 --- a/src/mess/drivers/ts802.c +++ /dev/null @@ -1,242 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Skeleton driver for Televideo TS802 - - 2012-11-06 Skeleton - 2014-02-07 Started adding devices - - Status: - - TS802: After 5 seconds, Slowly prints dots - - TS802H: After 5 seconds, type in any 5 characters, then you get a prompt. - - TODO: - - Almost everything - - Technical manual at: - http://bitsavers.org/pdf/televideo/TS800A_TS802_TS802H_Maintenance_Manual_1982.pdf - - includes in-depth discussion of the inner workings of the WD1000 HDD controller. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/terminal.h" -#include "machine/z80dma.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/wd_fdc.h" - -#define TERMINAL_TAG "terminal" - -class ts802_state : public driver_device -{ -public: - ts802_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_DRIVER_INIT(ts802); - DECLARE_MACHINE_RESET(ts802); - DECLARE_READ8_MEMBER(port00_r) { return 0x80; }; - DECLARE_READ8_MEMBER(port0c_r) { return 1; }; - DECLARE_READ8_MEMBER(port0e_r) { return 0; }; - DECLARE_READ8_MEMBER(port0f_r) { return (m_term_data) ? 5 : 4; }; - DECLARE_READ8_MEMBER(port0d_r); - DECLARE_WRITE8_MEMBER(port04_w); - DECLARE_WRITE8_MEMBER(port18_w); - DECLARE_WRITE8_MEMBER(port80_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - DECLARE_WRITE8_MEMBER( kbd_put ); -private: - UINT8 m_term_data; - address_space *m_mem; - address_space *m_io; - required_device m_maincpu; - required_device m_terminal; -}; - -static ADDRESS_MAP_START(ts802_mem, AS_PROGRAM, 8, ts802_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE(0x1000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ts802_io, AS_IO, 8, ts802_state) - //ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_READ(port00_r) // DIP switches - // 04 - written once after OS boot to bank in RAM from 0000-3FFF instead of ROM. 4000-FFFF is always RAM. - AM_RANGE(0x04, 0x07) AM_WRITE(port04_w) - // 08-0B: Z80 CTC - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - // 0C-0F: Z80 SIO #1 - //AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80dart1", z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x0c, 0x0c) AM_READ(port0c_r) - AM_RANGE(0x0d, 0x0d) AM_READ(port0d_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x0e, 0x0e) AM_READ(port0e_r) - AM_RANGE(0x0f, 0x0f) AM_READ(port0f_r) - // 10: Z80 DMA - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("z80dma", z80dma_device, read, write) - // 14-17: WD 1793 - AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("fdc", fd1793_t, read, write) - // 18: floppy misc. - AM_RANGE(0x18, 0x1c) AM_WRITE(port18_w) - // 20-23: Z80 SIO #2 - AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80dart2", z80dart_device, ba_cd_r, ba_cd_w) - // 48-4F: WD1000 harddisk controller - // 80: LEDs - AM_RANGE(0x80, 0x80) AM_WRITE(port80_w) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( ts802 ) -INPUT_PORTS_END - -WRITE8_MEMBER( ts802_state::port04_w ) -{ - membank("bankr0")->set_entry(1); -} - -WRITE8_MEMBER( ts802_state::port18_w ) -{ -} - -WRITE8_MEMBER( ts802_state::port80_w ) -{ -} - -READ8_MEMBER( ts802_state::memory_read_byte ) -{ - return m_mem->read_byte(offset); -} - -WRITE8_MEMBER( ts802_state::memory_write_byte ) -{ - m_mem->write_byte(offset, data); -} - -READ8_MEMBER( ts802_state::io_read_byte ) -{ - return m_io->read_byte(offset); -} - -WRITE8_MEMBER( ts802_state::io_write_byte ) -{ - m_io->write_byte(offset, data); -} - -static SLOT_INTERFACE_START( ts802_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -MACHINE_RESET_MEMBER( ts802_state, ts802 ) -{ - membank("bankr0")->set_entry(0); // point at rom - membank("bankw0")->set_entry(0); // always write to ram -} - -READ8_MEMBER( ts802_state::port0d_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -WRITE8_MEMBER( ts802_state::kbd_put ) -{ - m_term_data = data; -} - -#if 0 -// not correct -static const z80_daisy_config daisy_chain_intf[] = -{ - { "z80dart1" }, - { "z80dart2" }, - { "z80dma" }, - { "z80ctc" }, - { NULL } -}; -#endif - -DRIVER_INIT_MEMBER( ts802_state, ts802 ) -{ - m_mem = &m_maincpu->space(AS_PROGRAM); - m_io = &m_maincpu->space(AS_IO); - - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(1, &main[0x0000]); - membank("bankr0")->configure_entry(0, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); -} - -static MACHINE_CONFIG_START( ts802, ts802_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(ts802_mem) - MCFG_CPU_IO_MAP(ts802_io) - //MCFG_CPU_CONFIG(daisy_chain_intf) // causes problems - MCFG_MACHINE_RESET_OVERRIDE(ts802_state, ts802) - - /* Devices */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ts802_state, kbd_put)) - - MCFG_DEVICE_ADD("z80dma", Z80DMA, XTAL_16MHz / 4) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE("maincpu", INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(ts802_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(ts802_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(ts802_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(ts802_state, io_write_byte)) - - MCFG_Z80DART_ADD("z80dart1", XTAL_16MHz / 4, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_Z80DART_ADD("z80dart2", XTAL_16MHz / 4, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_FD1793_ADD("fdc", XTAL_4MHz / 2) // unknown clock - MCFG_FLOPPY_DRIVE_ADD("fdc:0", ts802_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ts802 ) - ROM_REGION(0x11000, "maincpu", 0) - ROM_LOAD( "ts802.rom", 0x10000, 0x1000, CRC(60bd086a) SHA1(82c5b60223e0d895683d3592a56684ef2dabfba6) ) -ROM_END - -ROM_START( ts802h ) - ROM_REGION(0x11000, "maincpu", 0) - ROM_LOAD( "8000050 050 2732", 0x10000, 0x1000, CRC(7054f384) SHA1(cf0a01a32283272532ed4890c3a3c2082f1618bf) ) - - ROM_REGION(0x2000, "roms", 0) // not Z80 code - ROM_LOAD( "i800000 047d.a53", 0x0000, 0x1000, CRC(94bfcbc1) SHA1(87c5f8898b0041d012e142ee7f559cb8a90f4dc1) ) - ROM_LOAD( "a64", 0x1000, 0x1000, CRC(41b5feda) SHA1(c9435a97c032ffe457bdb84d5dde8ecf3677b56c) ) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "800000-003a.a68", 0x0000, 0x0800, CRC(24eeb74d) SHA1(77900937f1492b4c5a70ba3aac55da322d403fbd) ) - ROM_LOAD( "800000-002a.a67", 0x0800, 0x0800, CRC(4b6c6e29) SHA1(c236e4625bc16062154cbebc4dbc8d62183ef9ab) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, ts802, 0, 0, ts802, ts802, ts802_state, ts802, "Televideo", "TS802", MACHINE_IS_SKELETON ) -COMP( 1982, ts802h, ts802, 0, ts802, ts802, ts802_state, ts802, "Televideo", "TS802H", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/ts803.c b/src/mess/drivers/ts803.c deleted file mode 100644 index 4bcfc4922bd..00000000000 --- a/src/mess/drivers/ts803.c +++ /dev/null @@ -1,68 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Skeleton driver for Televideo TS803 - - TODO: - - Everything - this is just a skeleton - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" - - -class ts803_state : public driver_device -{ -public: - ts803_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - required_device m_maincpu; - - virtual void machine_reset(); -}; - -static ADDRESS_MAP_START(ts803_mem, AS_PROGRAM, 8, ts803_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ts803_io, AS_IO, 8, ts803_state) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( ts803 ) -INPUT_PORTS_END - - -void ts803_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( ts803, ts803_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(ts803_mem) - MCFG_CPU_IO_MAP(ts803_io) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ts803h ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "180001-37 rev d 803 5 23 84", 0x0000, 0x2000, CRC(0aa658a7) SHA1(42d0a89c2ff9b6588cd88bdb1f800fac540dccbb) ) - - ROM_REGION(0x10000, "proms", 0) - ROM_LOAD( "8000134.bin", 0x000, 0x100, CRC(231fe6d6) SHA1(3c052ba4b74547e0e2451fa1ae67bbcb83a18bab) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, ts803h, 0, 0, ts803, ts803, driver_device, 0, "Televideo", "TS803H", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/ts816.c b/src/mess/drivers/ts816.c deleted file mode 100644 index c9cfd795665..00000000000 --- a/src/mess/drivers/ts816.c +++ /dev/null @@ -1,109 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - 2013-09-10 Skeleton driver for Televideo ts816 - - TODO: - - Everything - this is just a skeleton - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class ts816_state : public driver_device -{ -public: - ts816_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(keyin_r); - DECLARE_READ8_MEMBER(status_r); - -private: - UINT8 m_term_data; - UINT8 m_status; - virtual void machine_reset(); - required_device m_maincpu; - required_device m_terminal; -}; - -static ADDRESS_MAP_START(ts816_mem, AS_PROGRAM, 8, ts816_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(ts816_io, AS_IO, 8, ts816_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x50, 0x50) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x52, 0x52) AM_READ(status_r) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( ts816 ) -INPUT_PORTS_END - - -READ8_MEMBER( ts816_state::keyin_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( ts816_state::status_r ) -{ - if (m_status) - { - m_status--; - return 5; - } - else - return 4; -} - -WRITE8_MEMBER( ts816_state::kbd_put ) -{ - m_term_data = data; - m_status = 3; -} - -void ts816_state::machine_reset() -{ - m_term_data = 0; - m_status = 1; -} - -static MACHINE_CONFIG_START( ts816, ts816_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 4000000) - MCFG_CPU_PROGRAM_MAP(ts816_mem) - MCFG_CPU_IO_MAP(ts816_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ts816_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ts816 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "81640v11.rom", 0x0000, 0x1000, CRC(295a15e7) SHA1(6f49078ab3cd49aecd2afafcbed3af0e3bcfd48c) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, ts816, 0, 0, ts816, ts816, driver_device, 0, "Televideo", "TS816", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/tsispch.c b/src/mess/drivers/tsispch.c deleted file mode 100644 index 4a1cc037fe8..00000000000 --- a/src/mess/drivers/tsispch.c +++ /dev/null @@ -1,548 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/****************************************************************************** -* -* Telesensory Systems Inc./Speech Plus -* 1500 and 2000 series -* Prose 2020 -* Copyright (C) 2011-2013 Jonathan Gevaryahu AKA Lord Nightmare and Kevin 'kevtris' Horton -* -* The Prose 2000 card is an IEEE 796 Multibus card, with additional connectors to facilitate power and serial input other than via multibus. -* There are two hardware versions of the card: -* - The 1981 Telesensory Systems Inc copyrighted version -* (lacks U82, has some rework on the power input to add a bypass capacitor and an extra power line to the 8086) -* - The 1986 Speech Plus copyrighted version -* (adds U82 as an extra buffer for status (not sure)? integrates the greenwire fixes from the above board, minor reorganizations of passives) -* Both versions encountered have been in non-multibus enclosures: -* - The 1981 Version appeared on a 'Voice V4' Speech board scrapped from a "Kurzweil Reading Machine" Talking Scanner (predecessor to the TSI/Kurzweil/Xerox 'Reading Edge' scanner which is SPARC based) [I'm very sorry I didn't get the OCR computing guts of the scanner itself too :( ] -* - The 1986 Version appeared in a 'Prose 2020' under-monitor RS232 speech unit. -* -* DONE: -* Skeleton Written -* Load cpu and dsp roms and mapper proms -* Successful compile -* Successful run -* Correctly Interleave 8086 CPU roms -* Debug LEDs hooked to popmessage -* Correctly load UPD7720 roms as UPD7725 data - done; this is utterly disgusting code, but appears to work. -* Attached i8251a uart at u15 -* Added dipswitch array S4 -* Attached 8259 PIC - * IR0 = upd7720 p0 pin masked by (probably peripheral bit 8) - * IR1 = i8251 rxrdy - * IR2 = i8251 txempty - * IR3 = i8251 txrdy - * IR4,5,6,7 unknown so far, not hooked up yet -* Hooked the terminal to the i8251a uart at u15 -* Hooked up upd7720 reset line -* Verified CPU and DSP clocks -* -* TODO: -* UPD7720: hook up serial output and SCK, and hook SO to the DAC; this requires fixing the upd7725 core to actually support SCK and serial output/SO! -* Attach the other i8251a uart (assuming it is hooked to the main hardware at all!) -* Correctly implement UPD7720 cpu core to avoid needing revolting conversion code; this probably involves overriding and duplicating much of the exec_xx sections of the 7725 core -* Correct memory maps and io maps, and figure out what all the proms do - mostly done -* 8259 PIC: figure out where IR4-7 come from, if anywhere. -* UPD7720 and 8259: hook up p0 and p1 as outputs, and figure out how 8259 IR0 is masked from 7720 p0. -* Add other dipswitches and jumpers (these may actually just control clock dividers for the two 8251s) -* Older v1.1 set gets stuck forever waiting for upd7720 status port to equal 0x20, which never happens. -* Everything else -* -* Notes: -* Text in rom indicates there is a test mode 'activated by switch s4 dash 7' -* When switch s4-7 is switched on, the hardware says, over and over: -* "This is version 3.4.1 test mode, activated by switch s4 dash 7" -* -* 0x03400: the peripheral register -* the low 8 bits (7-0) are Sw4 -* the high 8 bits: -* Bit F E D C B A 9 8 -* | | | | | | | \- unknown but used, probably control (1=allow 0=mask?) 7720 p0 int to 8259 ir0? -* | | | | | | \--- LED 6 control (0 = on) -* | | | | | \----- LED 5 control (0 = on) -* | | | | \------- LED 4 control (0 = on) -* | | | \--------- LED 3 control (0 = on) -* | | \----------- unknown, possibly unused? -* | \------------- UPD7720 RESET line (0 = high/in reset, 1 = low/running) -* \--------------- unknown, possibly unused? but might possibly related to 7720 p0->8259 as well? -* -* When the unit is idle, leds 5 and 3 are on and upd7720 reset is low (write of 0b?1?0101?. -* On all character writes from i8251, bit 8 is unset, then set again, possibly to avoid interrupt clashes? -* -* Bootup notes v3.4.1: -* D3109: checks if 0x80 (S4-8) is set: if set, continue, else jump to D3123 -* D3123: write 0x1C (0 0 0 [1 1 1 0] 0) to 3401 -* then jump to D32B0 -* D32B0: memory test routine: -* This routine flood-fills memory from 0000-2FFF with 0xFF, -* then, bytewise starting from 0000, shifts the value progresively -* right by one, writes it and checks that it still matches, -* i.e. read 0xFF, write 0x7f, read 0x7f, write 0x3f... etc. -* Loop at D32E4. -* D32E6: similar to D32B0, but rotates in 1 bits to 16 bit words, -* though only the low byte is written, and only fills the 2BFF -* down to 0000 region. (seems rather redundant, actually) -* Loop at D3301. -* D3311: write 0x0A (0 0 0 [0 1 0 1] 0) to 3401 -* then jump to D3330 -* D3330: jump back to D312E -* D312E: this is some unknown conditional code, usually goes to D314E -* if BP is not 1, go to D314E and don't update leds (usually taken?) -* if BP is 1 and SI is 0, delay for 8*65536 cycles. no delay if si!=0 -* write 0x0C (0 0 0 [0 1 1 0] 0) to 3401 -* D314E: floodfill 0000-2BFF with 0x55 (rep at D315C) -* check if bp was 1 and jump to D318F if it was -* write 0x14 (0 0 0 [1 0 1 0] 0) to 3401 -* call E3987: initialize UPD7720, return -* D33D2: checksum the roms in 5? passes, loop at D33DA, test at D33E6 (which passes) -* if test DID fail: write 0x10 (0 0 0 [1 0 0 0] 0) to 3401 -* more stuff -* write 0xFF to 3401 -* more stuff -* set up word table? not sure what its doing here... -* if test does NOT fail (and it doesn't): -* D3414: write 0x08 (0 0 0 [0 1 0 0] 0) to 3400 -* D5E14: initialize PIC8259 -* -* D338A: write 0x12 0 0 0 [1 0 0 1] 0 to 3401 -* -* F44B4: general in-operation LED status write -******************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "includes/tsispch.h" -#include "cpu/upd7725/upd7725.h" -#include "cpu/i86/i86.h" -#include "machine/i8251.h" -#include "machine/pic8259.h" -#include "machine/terminal.h" - -// defines -#define DEBUG_PARAM 1 -#undef DEBUG_DSP -#undef DEBUG_DSP_W - -/* - Devices and handlers - */ - -/***************************************************************************** - USART 8251 and Terminal stuff -*****************************************************************************/ -WRITE_LINE_MEMBER(tsispch_state::i8251_rxrdy_int) -{ - machine().device("pic8259")->ir1_w(state); -} - -WRITE_LINE_MEMBER(tsispch_state::i8251_txempty_int) -{ - machine().device("pic8259")->ir2_w(state); -} - -WRITE_LINE_MEMBER(tsispch_state::i8251_txrdy_int) -{ - machine().device("pic8259")->ir3_w(state); -} - -WRITE8_MEMBER( tsispch_state::i8251_rxd ) -{ - i8251_device *uart = machine().device("i8251a_u15"); - uart->receive_character(data); -} - -/***************************************************************************** - LED/dipswitch stuff -*****************************************************************************/ -READ8_MEMBER( tsispch_state::dsw_r ) -{ - /* the only dipswitch I'm really sure about is s4-7 which enables the test mode - * The switches are, for normal operation on my unit (and the older unit as well): - * 1 2 3 4 5 6 7 8 - * ON ON OFF OFF OFF OFF OFF OFF - * which makes this register read 0xFC - * When s4-7 is turned on, it reads 0xBC - */ - return ioport("s4")->read(); -} - -WRITE8_MEMBER( tsispch_state::peripheral_w ) -{ - /* This controls the four LEDS, the RESET line for the upd77p20, - and (probably) the p0-to-ir0 masking of the upd77p20; there are two - unknown and seemingly unused bits as well. - see the top of the file for more info. - */ - m_paramReg = data; - m_dsp->set_input_line(INPUT_LINE_RESET, BIT(data,6)?CLEAR_LINE:ASSERT_LINE); -#ifdef DEBUG_PARAM - //fprintf(stderr,"8086: Parameter Reg written: UNK7: %d, DSPRST6: %d; UNK5: %d; LED4: %d; LED3: %d; LED2: %d; LED1: %d; DSPIRQMASK: %d\n", BIT(data,7), BIT(data,6), BIT(data,5), BIT(data,4), BIT(data,3), BIT(data,2), BIT(data,1), BIT(data,0)); - logerror("8086: Parameter Reg written: UNK7: %d, DSPRST6: %d; UNK5: %d; LED4: %d; LED3: %d; LED2: %d; LED1: %d; DSPIRQMASK: %d\n", BIT(data,7), BIT(data,6), BIT(data,5), BIT(data,4), BIT(data,3), BIT(data,2), BIT(data,1), BIT(data,0)); -#endif - popmessage("LEDS: 6/Talking:%d 5:%d 4:%d 3:%d\n", 1-BIT(data,1), 1-BIT(data,2), 1-BIT(data,3), 1-BIT(data,4)); -} - -/***************************************************************************** - UPD77P20 stuff -*****************************************************************************/ -READ16_MEMBER( tsispch_state::dsp_data_r ) -{ - upd7725_device *upd7725 = machine().device("dsp"); -#ifdef DEBUG_DSP - UINT8 temp; - temp = upd7725->snesdsp_read(true); - fprintf(stderr, "dsp data read: %02x\n", temp); - return temp; -#else - return upd7725->snesdsp_read(true); -#endif -} - -WRITE16_MEMBER( tsispch_state::dsp_data_w ) -{ - upd7725_device *upd7725 = machine().device("dsp"); -#ifdef DEBUG_DSP_W - fprintf(stderr, "dsp data write: %02x\n", data); -#endif - upd7725->snesdsp_write(true, data); -} - -READ16_MEMBER( tsispch_state::dsp_status_r ) -{ - upd7725_device *upd7725 = machine().device("dsp"); -#ifdef DEBUG_DSP - UINT8 temp; - temp = upd7725->snesdsp_read(false); - fprintf(stderr, "dsp status read: %02x\n", temp); - return temp; -#else - return upd7725->snesdsp_read(false); -#endif -} - -WRITE16_MEMBER( tsispch_state::dsp_status_w ) -{ - fprintf(stderr, "warning: upd772x status register should never be written to!\n"); - upd7725_device *upd7725 = machine().device("dsp"); - upd7725->snesdsp_write(false, data); -} - -WRITE_LINE_MEMBER( tsispch_state::dsp_to_8086_p0_w ) -{ - fprintf(stderr, "upd772x changed p0 state to %d!\n",state); - //TODO: do stuff here! -} - -WRITE_LINE_MEMBER( tsispch_state::dsp_to_8086_p1_w ) -{ - fprintf(stderr, "upd772x changed p1 state to %d!\n",state); - //TODO: do stuff here! -} - -/***************************************************************************** - Reset and Driver Init -*****************************************************************************/ -void tsispch_state::machine_reset() -{ - fprintf(stderr,"machine reset\n"); -} - -DRIVER_INIT_MEMBER(tsispch_state,prose2k) -{ - UINT8 *dspsrc = (UINT8 *)(memregion("dspprgload")->base()); - UINT32 *dspprg = (UINT32 *)(memregion("dspprg")->base()); - fprintf(stderr,"driver init\n"); - // unpack 24 bit 7720 data into 32 bit space and shuffle it so it can run as 7725 code - // data format as-is in dspsrc: (L = always 0, X = doesn't matter) - // source upd7720 dest upd7725 - // bit 7 6 5 4 3 2 1 0 bit 7 6 5 4 3 2 1 0 - // for OP/RT: - // b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15 - // b2 L 8 9 10 11 12 13 14 -> 14 13 12 L 11 10 9 8 - // b3 0 1 2 3 4 5 6 7 -> 7 6 5 4 3 2 1 0 - // for JP: - // b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15 - // b2 L 8 9 10 11 12 13 14 -> 14 13 L L L 12 11 10 - // b3 0 1 2 3 4 5 6 7 -> 9 8 7 6 5 4 X X - // for LD: - // b1 15 16 17 18 19 20 21 22 -> 22 21 20 19 18 17 16 15 - // b2 L 8 9 10 11 12 13 14 -> 14 13 12 11 10 9 8 7 - // b3 0 1 2 3 4 5 6 7 -> 6 5 X X 3 2 1 0 - UINT8 byte1t; - UINT16 byte23t; - for (int i = 0; i < 0x600; i+= 3) - { - byte1t = BITSWAP8(dspsrc[0+i], 0, 1, 2, 3, 4, 5, 6, 7); - // here's where things get disgusting: if the first byte was an OP or RT, do the following: - if ((byte1t&0x80) == 0x00) // op or rt instruction - { - byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 15, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7); - } - else if ((byte1t&0xC0) == 0x80) // jp instruction - { - byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 15, 15, 15, 10, 11, 12, 13, 14, 0, 1, 2, 3, 6, 7); - } - else // ld instruction - { - byte23t = BITSWAP16( (((UINT16)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 3, 4, 5, 6, 7); - } - - *dspprg = byte1t<<24 | byte23t<<8; - dspprg++; - } - m_paramReg = 0x00; // on power up, all leds on, reset to upd7720 is high - m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); // starts in reset -} - -/****************************************************************************** - Address Maps -******************************************************************************/ -/* The address map of the prose 2020 is controlled by 2 proms, see the rom section - for details on those. - (x = ignored; * = selects address within this range; s = selects one of a pair of chips) - A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 - 0 0 x x 0 x 0 * * * * * * * * * * * * s 6264*2 SRAM first half - 0 0 x x 0 x 1 0 * * * * * * * * * * * s 6264*2 SRAM 3rd quarter - 0 0 x x 0 x 1 1 0 0 0 x x x x x x x * x iP8251A @ U15 - 0 0 x x 0 x 1 1 0 0 1 x x x x x x x * x AMD P8259A PIC - 0 0 x x 0 x 1 1 0 1 0 x x x x x x x x * LEDS, dipswitches, and UPD77P20 control lines - 0 0 x x 0 x 1 1 0 1 1 x x x x x x x * x UPD77P20 data/status - 0 0 x x 0 x 1 1 1 x x Open bus, verified (returns 0x00EA) - 0 0 x x 1 x Open bus? (or maybe communication with multibus connector?) (returns 0xFA,B,C,FFF) - 0 1 Open bus, verified (returns 0x00EA) - 1 0 Open bus, verified (returns 0x00EA) - 1 1 0 * * * * * * * * * * * * * * * * s ROMs 2 and 3 - 1 1 1 * * * * * * * * * * * * * * * * s ROMs 0 and 1 -*/ -static ADDRESS_MAP_START(i8086_mem, AS_PROGRAM, 16, tsispch_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x02FFF) AM_MIRROR(0x34000) AM_RAM // verified; 6264*2 sram, only first 3/4 used - AM_RANGE(0x03000, 0x03001) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("i8251a_u15", i8251_device, data_r, data_w, 0x00FF) - AM_RANGE(0x03002, 0x03003) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("i8251a_u15", i8251_device, status_r, control_w, 0x00FF) - AM_RANGE(0x03200, 0x03203) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00FF) // AMD P8259 PIC @ U5 (reads as 04 and 7c, upper byte is open bus) - AM_RANGE(0x03400, 0x03401) AM_MIRROR(0x341FE) AM_READ8(dsw_r, 0x00FF) // verified, read from dipswitch s4 - AM_RANGE(0x03400, 0x03401) AM_MIRROR(0x341FE) AM_WRITE8(peripheral_w, 0xFF00) // verified, write to the 4 leds, plus 4 control bits - AM_RANGE(0x03600, 0x03601) AM_MIRROR(0x341FC) AM_READWRITE(dsp_data_r, dsp_data_w) // verified; UPD77P20 data reg r/w - AM_RANGE(0x03602, 0x03603) AM_MIRROR(0x341FC) AM_READWRITE(dsp_status_r, dsp_status_w) // verified; UPD77P20 status reg r - AM_RANGE(0xc0000, 0xfffff) AM_ROM // verified -ADDRESS_MAP_END - -// Technically the IO line of the i8086 is completely ignored (it is running in 8086 MIN mode,I believe, which may ignore IO) -static ADDRESS_MAP_START(i8086_io, AS_IO, 16, tsispch_state) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -static ADDRESS_MAP_START(dsp_prg_map, AS_PROGRAM, 32, tsispch_state) - AM_RANGE(0x0000, 0x01ff) AM_ROM AM_REGION("dspprg", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(dsp_data_map, AS_DATA, 16, tsispch_state) - AM_RANGE(0x0000, 0x01ff) AM_ROM AM_REGION("dspdata", 0) -ADDRESS_MAP_END - - -/****************************************************************************** - Input Ports -******************************************************************************/ -static INPUT_PORTS_START( prose2k ) -PORT_START("s4") // dipswitch array s4 - PORT_DIPNAME( 0x01, 0x00, "S4-1") PORT_DIPLOCATION("SW4:1") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, "S4-2") PORT_DIPLOCATION("SW4:2") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, "S4-3") PORT_DIPLOCATION("SW4:3") - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "S4-4") PORT_DIPLOCATION("SW4:4") - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "S4-5") PORT_DIPLOCATION("SW4:5") - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "S4-6") PORT_DIPLOCATION("SW4:6") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "S4-7: Self Test") PORT_DIPLOCATION("SW4:7") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "S4-8") PORT_DIPLOCATION("SW4:8") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -/****************************************************************************** - Machine Drivers -******************************************************************************/ -static MACHINE_CONFIG_START( prose2k, tsispch_state ) - /* basic machine hardware */ - /* There are two crystals on the board: a 24MHz xtal at Y2 and a 16MHz xtal at Y1 */ - MCFG_CPU_ADD("maincpu", I8086, 8000000) /* VERIFIED clock, unknown divider */ - MCFG_CPU_PROGRAM_MAP(i8086_mem) - MCFG_CPU_IO_MAP(i8086_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) - - /* TODO: the UPD7720 has a 10KHz clock to its INT pin */ - /* TODO: the UPD7720 has a 2MHz clock to its SCK pin */ - /* TODO: hook up p0, p1, int */ - MCFG_CPU_ADD("dsp", UPD7725, 8000000) /* VERIFIED clock, unknown divider; correct dsp type is UPD77P20 */ - MCFG_CPU_PROGRAM_MAP(dsp_prg_map) - MCFG_CPU_DATA_MAP(dsp_data_map) - MCFG_NECDSP_OUT_P0_CB(WRITELINE(tsispch_state, dsp_to_8086_p0_w)) - MCFG_NECDSP_OUT_P1_CB(WRITELINE(tsispch_state, dsp_to_8086_p1_w)) - - /* PIC 8259 */ - MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) - - /* uarts */ - MCFG_DEVICE_ADD("i8251a_u15", I8251, 0) - // (todo: proper hookup, currently using hack w/i8251_receive_character()) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(tsispch_state, i8251_rxrdy_int)) - MCFG_I8251_TXRDY_HANDLER(WRITELINE(tsispch_state, i8251_txrdy_int)) - MCFG_I8251_TXEMPTY_HANDLER(WRITELINE(tsispch_state, i8251_txempty_int)) - - /* sound hardware */ - //MCFG_SPEAKER_STANDARD_MONO("mono") - //MCFG_SOUND_ADD("dac", DAC, 0) /* TODO: correctly figure out how the DAC works; apparently it is connected to the serial output of the upd7720, which will be "fun" to connect up */ - //MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(tsispch_state, i8251_rxd)) -MACHINE_CONFIG_END - -/****************************************************************************** - ROM Definitions -******************************************************************************/ -ROM_START( prose2k ) - ROM_REGION(0x100000,"maincpu", 0) - // prose 2000/2020 firmware version 3.4.1 - ROMX_LOAD( "v3.4.1__2000__2.u22", 0xc0000, 0x10000, CRC(201d3114) SHA1(549ef1aa28d5664d4198cbc1826b31020d6c4870),ROM_SKIP(1)) - ROMX_LOAD( "v3.4.1__2000__3.u45", 0xc0001, 0x10000, CRC(190c77b6) SHA1(2b90b3c227012f2085719e6283da08afb36f394f),ROM_SKIP(1)) - ROMX_LOAD( "v3.4.1__2000__0.u21", 0xe0000, 0x10000, CRC(3fae874a) SHA1(e1d3e7ba309b29a9c3edbe3d22becf82eae50a31),ROM_SKIP(1)) - ROMX_LOAD( "v3.4.1__2000__1.u44", 0xe0001, 0x10000, CRC(bdbb0785) SHA1(6512a8c2641e032ef6bb0889490d82f5d4399575),ROM_SKIP(1)) - - // TSI/Speech plus DSP firmware v3.12 8/9/88, NEC UPD77P20 - ROM_REGION( 0x600, "dspprgload", 0) // packed 24 bit data - ROM_LOAD( "v3.12__8-9-88__dsp_prog.u29", 0x0000, 0x0600, CRC(9e46425a) SHA1(80a915d731f5b6863aeeb448261149ff15e5b786)) - ROM_REGION( 0x800, "dspprg", ROMREGION_ERASEFF) // for unpacking 24 bit data into 32 bit data which cpu core can understand - ROM_REGION( 0x400, "dspdata", 0) - ROM_LOAD( "v3.12__8-9-88__dsp_data.u29", 0x0000, 0x0400, CRC(f4e4dd16) SHA1(6e184747db2f26e45d0e02907105ff192e51baba)) - - // mapping proms: - // All are am27s19 32x8 TriState PROMs (equivalent to 82s123/6331) - // L - always low; H - always high - // U77: unknown (what does this do? likely as to do with multibus and possibly waitstates?) - // input is A19 for I4, A18 for I3, A15 for I2, A13 for I1, A12 for I0 - // output bits 0bLLLLzyxH (TODO: recheck) - // bit - function - // 7, 6, 5, 4 - seem unconnected? - // 3 - connection unknown, low in the RAM, ROM, and Peripheral memory areas - // 2 - connection unknown, low in the RAM and ROM memory areas - // 1 - unknown, always high (TODO: recheck) - // 0 - unknown, always high - // - // U79: SRAM and peripheral mapping: - // input is A19 for I4, A18 for I3, A15 for I2, A13 for I1, A12 for I0, same as U77 - // On the Prose 2000 later board dumped, only bits 3 and 0 are used; - // bits 7-4 are always low, bits 2 and 1 are always high. - // SRAMS are only populated in U61 and U64. - // On the Prose 2000 earlier board dumped, bits 3,2,1,0 are all used; - // bits 7-4 are always low. sram is in 6 6116s, mapped the same as the 2 6264s on the later board. - // output bits 0bLLLL3210 - // 7,6,5,4 - seem unconnected? - // 3 - to /EN3 (pin 4) of 74S138N at U80 - // AND to EN1 (pin 6) of 74S138N at U78 - // i.e. one is activated when pin is high and other when pin is low - // The 74S138N at U80: [*ENABLED ONLY WITHIN/CONTROLS THE 3000-3FFF AREA*] - // /EN2 - pulled to GND - // EN1 - pulled to VCC through resistor R5 - // inputs: S0 - A9; S1 - A10; S2 - A11 - // /Y0 - /CS (pin 11) of iP8251A at U15 [0x3000-0x31FF] - // /Y1 - /CS (pin 1) of AMD 8259A at U4 [0x3200-0x33FF] - // /Y2 - pins 1, 4, 9 (1A, 2A, 3A inputs) of 74HCT32 Quad OR gate at U58 [0x3400-0x35FF] - // /Y3 - pin 26 (/CS) of UPD77P20 at U29 [0x3600-0x37FF] - // /Y4 through /Y7 - seem unconnected? [0x3800-0x3FFF] - // The 74S138N at U78: [*ENABLED IN ALL AREAS EXCEPT 3000-3FFF*] - // /EN3 - ? (TODO: figure these out) - // /EN2 - ? - // inputs: S0 - A18; S1 - A19; S2 - Pulled to GND - // /Y0 - ? - // /Y1 - ? - // /Y2 - ? - // /Y3 - connects somewhere, only active when A18 and A19 are high, possibly a rom bus buffer enable? (TODO: figure out what this does) - // /Y4-/Y7 - never used since S2 is pulled to GND - // 2 - to /CS1 on 6264 SRAMs at U63 and U66 - // 1 - to /CS1 on 6264 SRAMs at U62 and U65 - // 0 - to /CS1 on 6264 SRAMs at U61 and U64 - // - // U81: (OPTIONAL) maps ROMS: input is A19-A15 for I4,3,2,1,0 - // On the Prose 2000 board dumped, only bits 6 and 5 are used, - // the rest are always high; maps roms 0,1,2,3 to C0000-FFFFF. - // The Prose 2000 board has empty unpopulated sockets for roms 4-15; - // if present these would be driven by a different prom in this location. - // bit - function - // 7 - to /CE of ROMs 14(U28) and 15(U51) - // 6 - to /CE of ROMs 0(U21) and 1(U44) - // 5 - to /CE of ROMs 2(U22) and 3(U45) - // 4 - to /CE of ROMs 4(U23) and 5(U46) - // 3 - to /CE of ROMs 6(U24) and 7(U47) - // 2 - to /CE of ROMs 8(U25) and 9(U48) - // 1 - to /CE of ROMs 10(U26) and 11(U49) - // 0 - to /CE of ROMs 12(U27) and 13(U50) - // - // Note U81 is optional; it can be replaced by a 74s138 instead of a prom, - // with A19, A18, A17 as inputs, for decoding the roms as: - // 7 - to /CE of ROMs 0(U21) and 1(U44) (0xE0000-0xE3FFF) - // 6 - to /CE of ROMs 2(U22) and 3(U45) (0xE4000-0xE7FFF) - // 5 - to /CE of ROMs 4(U23) and 5(U46) (0xE8000-0xEBFFF) - // 4 - to /CE of ROMs 6(U24) and 7(U47) (0xEC000-0xEFFFF) - // 3 - to /CE of ROMs 8(U25) and 9(U48) (0xF0000-0xF3FFF) - // 2 - to /CE of ROMs 10(U26) and 11(U49) (0xF4000-0xF7FFF) - // 1 - to /CE of ROMs 12(U27) and 13(U50) (0xF8000-0xFBFFF) - // 0 - to /CE of ROMs 14(U28) and 15(U51) (0xFC000-0xFFFFF) - - ROM_REGION(0x1000, "proms", 0) - ROM_LOAD( "am27s19.u77", 0x0000, 0x0020, CRC(a88757fc) SHA1(9066d6dbc009d7a126d75b8461ca464ddf134412)) - ROM_LOAD( "am27s19.u79", 0x0020, 0x0020, CRC(a165b090) SHA1(bfc413c79915c68906033741318c070ad5dd0f6b)) - ROM_LOAD( "am27s19.u81", 0x0040, 0x0020, CRC(62e1019b) SHA1(acade372edb08fd0dcb1fa3af806c22c47081880)) - ROM_END - -ROM_START( prose2ko ) - // 'Older' prose2k set - ROM_REGION(0x100000,"maincpu", 0) - // prose 2000 firmware version 1.1 - ROMX_LOAD( "v1.1__6__speech__plus__(c)1983.am2764.6.u24", 0xec000, 0x2000, CRC(c881f92d) SHA1(2d4eb96360adac54d4f0110595bfaf682280c1ca),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__7__speech__plus__(c)1983.am2764.7.u47", 0xec001, 0x2000, CRC(4d5771cb) SHA1(55ed59ad1cad154804dbeeebed98f062783c33c3),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__8__speech__plus__(c)1983.am2764.8.u25", 0xf0000, 0x2000, CRC(adf9bfb8) SHA1(0b73561b52b388b740fabf07ada2d70a52f22037),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__9__speech__plus__(c)1983.am2764.9.u48", 0xf0001, 0x2000, CRC(355f97d2) SHA1(7655fc55b577821e0bd8bf81fb74b8a20b1df098),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__10__speech__plus__(c)1983.am2764.10.u26", 0xf4000, 0x2000, CRC(949a0344) SHA1(8e33c69dfc413aea95f166b08902ad97b1e3e980),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__11__speech__plus__(c)1983.am2764.11.u49", 0xf4001, 0x2000, CRC(ad9a0670) SHA1(769f2f8696c7b6907706466aa9ab7a897ed9f889),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__12__speech__plus__(c)1983.am2764.12.u27", 0xf8000, 0x2000, CRC(9eaf9378) SHA1(d296b1d347c03e6123c38c208ead25b1f43b9859),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__13__speech__plus__(c)1983.am2764.13.u50", 0xf8001, 0x2000, CRC(5e173667) SHA1(93230c2fede5095f56e10d20ea36a5a45a1e7356),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__14__speech__plus__(c)1983.am2764.14.u28", 0xfc000, 0x2000, CRC(e616bd6e) SHA1(5dfae2c5079d89f791c9d7166f9504231a464203),ROM_SKIP(1)) - ROMX_LOAD( "v1.1__15__speech__plus__(c)1983.am2764.15.u51", 0xfc001, 0x2000, CRC(beb1fa19) SHA1(72130fe45c3fd3de7cf794936dc68ed2d4193daf),ROM_SKIP(1)) - - // TSI/Speech plus DSP firmware v?.? (no sticker, but S140025 printed on chip), unlabeled chip, but clearly a NEC UPD7720C ceramic - // NOT DUMPED YET, using the 3.12 dsp firmware as a placeholder, since the dsp on the older board is MASK ROM and doesn't dump easily - ROM_REGION( 0x600, "dspprgload", 0) // packed 24 bit data - ROM_LOAD( "s140025__dsp_prog.u29", 0x0000, 0x0600, NO_DUMP) - ROM_LOAD( "v3.12__8-9-88__dsp_prog.u29", 0x0000, 0x0600, CRC(9e46425a) SHA1(80a915d731f5b6863aeeb448261149ff15e5b786)) // temp placeholder - ROM_REGION( 0x800, "dspprg", ROMREGION_ERASEFF) // for unpacking 24 bit data into 32 bit data which cpu core can understand - ROM_REGION( 0x400, "dspdata", 0) - ROM_LOAD( "s140025__dsp_data.u29", 0x0000, 0x0400, NO_DUMP) - ROM_LOAD( "v3.12__8-9-88__dsp_data.u29", 0x0000, 0x0400, CRC(f4e4dd16) SHA1(6e184747db2f26e45d0e02907105ff192e51baba)) // temp placeholder - - ROM_REGION(0x1000, "proms", 0) - ROM_LOAD( "dm74s288n.u77", 0x0000, 0x0020, CRC(a88757fc) SHA1(9066d6dbc009d7a126d75b8461ca464ddf134412)) // == am27s19.u77 - ROM_LOAD( "dm74s288n.whitespot.u79", 0x0020, 0x0020, CRC(7faee6cb) SHA1(b6dd2a6909dac9e89e7317c006a013ff0866382d)) - // no third prom in this set, a 74S138 is used instead for e0000-fffff rom mapping - ROM_END - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, prose2k, 0, 0, prose2k, prose2k, tsispch_state, prose2k, "Telesensory Systems Inc/Speech Plus", "Prose 2000/2020 v3.4.1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1985, prose2ko, prose2k, 0, prose2k, prose2k, tsispch_state, prose2k, "Telesensory Systems Inc/Speech Plus", "Prose 2000/2020 v1.1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/tutor.c b/src/mess/drivers/tutor.c deleted file mode 100644 index 1978e64fdb0..00000000000 --- a/src/mess/drivers/tutor.c +++ /dev/null @@ -1,796 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - Experimental Tomy Tutor driver - - This computer is known as Tomy Tutor in US, and as Grandstand Tutor in UK. - It was initially released in Japan in 1982 or 1983 under the name of Pyuuta - (Pi-yu-u-ta, with a Kanji for the "ta"). The Japanese versions are - different from the English-language versions, as they have different ROMs - with Japanese messages and support for the katakana syllabus. There are at - least 4 versions: - * original Pyuuta (1982 or 1983) with title screens in Japanese but no - Basic - * Pyuuta Jr. (1983?) which is a console with a simplified keyboard - * Tomy/Grandstand Tutor (circa October 1983?) with title screens in English - and integrated Basic - * Pyuuta Mk. 2 (1984?) with a better-looking keyboard and integrated Basic - - The Tomy Tutor features a TMS9995 CPU @10.7MHz (which includes a - timer/counter and 256 bytes of 16-bit RAM), 48kb of ROM (32kb on early - models that did not have the BASIC interpreter), a tms9918a/9929a VDP (or - equivalent?) with 16kb of VRAM, and a sn76489an sound generator. - There is a tape interface, a 56-key keyboard, an interface for two - joysticks, a cartridge port and an extension port. The OS design does not - seem to be particularly expandable (I don't see any hook for additional - DSRs), but there were prototypes for a parallel port (emulated) - and a speech synthesizer unit (not emulated). - - - The Tutor appears to be related to Texas Instruments' TI99 series. - - The general architecture is relatively close to the ti99/4(a): arguably, - the Tutor does not include any GROM (it uses regular CPU ROMs for GPL - code), and its memory map is quite different due to the fact it was - designed with a tms9995 in mind (vs. a tms9985 for ti99/4), but, apart from - that, it has a similar architecture with only 256 bytes of CPU RAM and 16kb - of VRAM. - - While the OS is not derived directly from the TI99/4(a) OS, there are - disturbing similarities: the Japanese title screen is virtually identical - to the TI-99 title screen. Moreover, the Tutor BASIC seems to be be - derived from TI Extended BASIC, as both BASIC uses similar tokens and - syntax, and are partially written in GPL (there is therefore a GPL - interpreter in Tutor ROMs, although the Tutor GPL is incompatible with TI - GPL, does not seem to be used by any program other than Tutor Basic, and it - seems unlikely that the original Pyuuta had this GPL interpreter in ROMs). - - It appears that TI has sold the licence of the TI BASIC to Tomy, probably - after it terminated its TI99 series. It is not impossible that the entire - Tutor concept is derived from a TI project under licence: this machine - looks like a crossbreed of the TI99/2 and the TI99/4 (or /4a, /4b, /5), and - it could either have been an early version of the TI99/2 project with a - tms9918a/99289a VDP instead of the DMA video controller, or a "TI99/3" that - would have closed the gap between the extremely low-end TI99/2 and the - relatively mid-range TI99/5. - - - Raphael Nabet, 2003 - - -TODO : - * debug the tape interface (Saved tapes sound OK, both Verify and Load - recognize the tape as a Tomy tape, but the data seems to be corrupted and - we end with a read error.) - * guess which device is located at the >e600 base - * find info about other Tutor variants - - - Interrupts: - - Interrupt levels 1 (external interrupt 1) and 2 (error interrupt) do not - seem to be used: triggering these seems to cause a soft reset. XOPs are - not used at all: the ROM area where these vectors should be defined is used - by a ROM branch table. - - -Memory Map found at http://www.floodgap.com/retrobits/tomy/mmap.html - - *** $0000-$7FFF is the 32K BIOS *** - it is also possible to replace the BIOS with an external ROM (see $E000 range) - -0000 - reset vector (level 0) - 0000-0001: WP 0002-0003: PC (%) -0004 - level 1 and 2 IRQ vectors (%) - idem. These just seem to reset the system. -000C - additional vectors -0040 - XOP vectors (%) - The BIOS doesn't seem to use these for XOPs. - Instead, this is a branch table. -0080 - BIOS code - (CRU only: $1EE0-FE: 9995 flag register; - $1FDA: MID flag) -4000 - GBASIC - (on the American v2.3 firmware, the GPL - interpreter and VDP RAMLUT co-exist - with GBASIC in this range) - - *** $8000-$BFFF is the 16K option ROM area *** - -8000 - BASIC (Tutor only) and/or cartridge ROM - (controlled by $E100) - To be recognized, a cartridge must have a - $55, $66 or $aa header sequence. - - *** end ROM *** -C000 - unmapped (possible use in 24K cartridges) -E000 - I/O range - --------- - 9918A VDP data/register ports: $E000, E002 - "MMU" banking controls: $E100-E1FF - $E100 write: enable cartridge, disable - BIOS at $0000 (???) -- magic - required at $E110 for this - $E108 write: enable BASIC ROM, disable - cartridge at $8000 - $E10C write: enable cartridge, disable - BASIC ROM at $8000 - $E110 must be $42 to enable $E100 - and to replace the BIOS with - an installed cartridge ROM. - BLWP assumed at $0000 (??). - SN76489AN sound data port: $E200 - Device handshaking: $E600 - Unknown purpose, disk drive maybe? - Printer handshaking: $E800 - This is a standard Centronics port. - $E810 write: parallel data bus - $E820 read: parallel port busy - $E840 write: port handshake output - Keyboard lines: $EC00-$EC7E (*CRU*) - (CRU physical address $7600-$763F) - Cassette lines: $ED00-$EEFF - $ED00 (*CRU*): input level - (physical address $7680) - $EE00 write: tape output zero - $EE20 write: tape output one - $EE40 write: tape IRQ on - $EE60 write: tape IRQ off - $EE80, A0, C0, E0: ??? - -F000 - TMS9995 RAM (*) -F0FC - ?? -FFFA - decrementer (*) -FFFC - NMI vector (*) -FFFF - - - -PYUUTAJR -******** - -This is a handheld unit with 12 'chiclet' buttons. The keyboard has E800, EA00, EC00, EE00 scanned, -although 2 of these rows have no keys. TUTOR carts will run, however since most of them ask for -A=AMA, P=PRO, these keys don't exist, and so the games cannot be played. - -*********************************************************************************************************/ - -#include "emu.h" -#include "cpu/tms9900/tms9995.h" -#include "sound/wave.h" -#include "video/tms9928a.h" -#include "imagedev/cassette.h" -#include "sound/sn76496.h" -#include "bus/centronics/ctronics.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class tutor_state : public driver_device -{ -public: - tutor_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_cass(*this, "cassette"), - m_centronics(*this, "centronics"), - m_cent_data_out(*this, "cent_data_out"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank1_switching(0) - { - } - - required_device m_maincpu; - required_device m_cart; - optional_device m_cass; - optional_device m_centronics; - optional_device m_cent_data_out; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - memory_region *m_cart_rom; - - int m_bank1_switching; - DECLARE_READ8_MEMBER(key_r); - DECLARE_READ8_MEMBER(tutor_mapper_r); - DECLARE_WRITE8_MEMBER(tutor_mapper_w); - DECLARE_READ8_MEMBER(tutor_cassette_r); - DECLARE_WRITE8_MEMBER(tutor_cassette_w); - DECLARE_READ8_MEMBER(tutor_printer_r); - DECLARE_WRITE8_MEMBER(tutor_printer_w); - - DECLARE_READ8_MEMBER(tutor_highmem_r); - int m_tape_interrupt_enable; - emu_timer *m_tape_interrupt_timer; - virtual void machine_start(); - virtual void machine_reset(); - TIMER_CALLBACK_MEMBER(tape_interrupt_handler); - - int m_centronics_busy; - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); -}; - - -void tutor_state::machine_start() -{ - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this)); - - m_bank1->configure_entry(0, memregion("maincpu")->base() + 0x4000); - m_bank1->set_entry(0); - m_bank2->configure_entry(0, memregion("maincpu")->base() + 0x8000); - m_bank2->set_entry(0); - - if (m_cart_rom) - { - if (m_cart_rom->bytes() > 0x4000) - { - m_bank1_switching = 1; - m_bank1->configure_entry(1, m_cart_rom->base()); - m_bank1->set_entry(1); - m_bank2->configure_entry(1, m_cart_rom->base() + 0x4000); - m_bank2->set_entry(1); - } - else - { - m_bank2->configure_entry(1, m_cart_rom->base()); - m_bank2->set_entry(1); - } - } -} - -void tutor_state::machine_reset() -{ - m_tape_interrupt_enable = 0; - m_centronics_busy = 0; - - // Enable auto wait states by lowering READY during reset - m_maincpu->set_ready(CLEAR_LINE); -} - -/* - Keyboard: - - Keyboard ports are located at CRU logical address >ec00->ec7e (CRU physical - address >7600->763f). There is one bit per key (bit >00 for keycode >00, - bit >01 for keycode >01, etc.), each bit is set to one when the key is - down. - - Joystick: - - Joystick ports seem to overlap keyboard ports, i.e. some CRU bits are - mapped to both a keyboard key and a joystick switch. -*/ - -READ8_MEMBER( tutor_state::key_r ) -{ - char port[12]; - UINT8 value; - - snprintf(port, ARRAY_LENGTH(port), "LINE%d", offset); - value = ioport(port)->read(); - - /* hack for ports overlapping with joystick */ - if (offset == 4 || offset == 5) - { - snprintf(port, ARRAY_LENGTH(port), "LINE%d_alt", offset); - value |= ioport(port)->read(); - } - - return value; -} - - -/* - Cartridge mapping: - - Cartridges share the >8000 address base with BASIC. A write to @>e10c - disables the BASIC ROM and enable the cartridge. A write to @>e108 - disables the cartridge and enables the BASIC ROM. - - In order to be recognized by the system ROM, a cartridge should start with - >55, >66 or >aa. This may may correspond to three different ROM header - versions (I am not sure). - - Cartridge may also define a boot ROM at base >0000 (see below). -*/ - -READ8_MEMBER( tutor_state::tutor_mapper_r ) -{ - int reply; - - switch (offset) - { - case 0x10: - /* return 0x42 if we have a cartridge with an alternate boot ROM */ - reply = 0; - break; - - default: - logerror("unknown port in %s %d\n", __FILE__, __LINE__); - reply = 0; - break; - } - - return reply; -} - -WRITE8_MEMBER( tutor_state::tutor_mapper_w ) -{ - switch (offset) - { - case 0x00: - /* disable system ROM, enable alternate boot ROM in cartridge */ - break; - - case 0x08: - /* disable cartridge ROM, enable BASIC ROM at base >8000 */ - m_bank1->set_entry(0); - m_bank2->set_entry(0); - break; - - case 0x0c: - /* enable cartridge ROM, disable BASIC ROM at base >8000 */ - if (m_cart_rom) - { - if (m_bank1_switching) - m_bank1->set_entry(1); - m_bank2->set_entry(1); - } - break; - - default: - if (!(offset & 1)) - logerror("unknown port in %s %d\n", __FILE__, __LINE__); - break; - } -} - -/* - This is only called from the debugger; the on-chip memory is handled - within the CPU itself. -*/ -READ8_MEMBER( tutor_state::tutor_highmem_r ) -{ - if (m_maincpu->is_onchip(offset | 0xf000)) return m_maincpu->debug_read_onchip_memory(offset&0xff); - return 0; -} - -/* - Cassette interface: - - The cassette interface uses several ports in the >e000 range. - - Writing to *CPU* address @>ee00 will set the tape output to 0. Writing to - *CPU* address @>ee20 will set the tape output to 1. - - Tape input level can be read from *CRU* logical address >ed00 (CRU physical - address >7680). - - Writing to @>ee40 enables tape interrupts; writing to @>ee60 disables tape - interrupts. Tape interrupts are level-4 interrupt that occur when the tape - input level is high(?). - - There are other output ports: @>ee80, @>eea0, @>eec0 & @>eee0. I don't - know their exact meaning. -*/ - -TIMER_CALLBACK_MEMBER(tutor_state::tape_interrupt_handler) -{ - //assert(m_tape_interrupt_enable); - m_maincpu->set_input_line(INT_9995_INT4, (m_cass->input() > 0.0) ? ASSERT_LINE : CLEAR_LINE); -} - -/* CRU handler */ -READ8_MEMBER( tutor_state::tutor_cassette_r ) -{ - return (m_cass->input() > 0.0) ? 1 : 0; -} - -/* memory handler */ -WRITE8_MEMBER( tutor_state::tutor_cassette_w ) -{ - if (offset & /*0x1f*/0x1e) - logerror("unknown port in %s %d\n", __FILE__, __LINE__); - - if ((offset & 0x1f) == 0) - { - data = BIT(offset, 5); - - switch ((offset >> 6) & 3) - { - case 0: - /* data out */ - m_cass->output((data) ? +1.0 : -1.0); - break; - case 1: - /* interrupt control??? */ - //logerror("ignoring write of %d to cassette port 1\n", data); - if (m_tape_interrupt_enable != data) - { - m_tape_interrupt_enable = data; - if (!m_tape_interrupt_enable) - m_tape_interrupt_timer->adjust(/*attotime::from_hz(44100)*/attotime::zero, 0, attotime::from_hz(44100)); - else - { - m_tape_interrupt_timer->adjust(attotime::never); - m_maincpu->set_input_line(INT_9995_INT4, CLEAR_LINE); - } - } - break; - case 2: - /* ??? */ - logerror("ignoring write of %d to cassette port 2\n", data); - break; - case 3: - /* ??? */ - logerror("ignoring write of %d to cassette port 3\n", data); - break; - } - } -} - -WRITE_LINE_MEMBER( tutor_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -/* memory handlers */ -READ8_MEMBER( tutor_state::tutor_printer_r ) -{ - int reply; - - switch (offset) - { - case 0x20: - /* busy */ - reply = m_centronics_busy ? 0x00 : 0xff; - break; - - default: - if (! (offset & 1)) - logerror("unknown port in %s %d\n", __FILE__, __LINE__); - reply = 0; - break; - } - - return reply; -} - -WRITE8_MEMBER( tutor_state::tutor_printer_w ) -{ - switch (offset) - { - case 0x10: - /* data */ - m_cent_data_out->write(space, 0, data); - break; - - case 0x40: - /* strobe */ - m_centronics->write_strobe(BIT(data, 7)); - break; - - default: - if (! (offset & 1)) - logerror("unknown port in %s %d\n", __FILE__, __LINE__); - break; - } -} - -/* - Memory map summary: - - @>0000-@>7fff: system ROM (can be paged out, see above). - @>8000-@>bfff: basic ROM (can be paged out, see above). - @>c000-@>dfff: free for future expansion? Used by 24kb cartridges? - - @>e000(r/w): VDP data - @>e002(r/w): VDP register - - @>e100(w): enable cart and disable system ROM at base >0000??? (the system will only link to such a ROM if @>e110 is >42???) - @>e108(w): disable cart and enable BASIC ROM at base >8000? - @>e10c(w): enable cart and disable BASIC ROM at base >8000? - @>e110(r): cartridges should return >42 if they have a ROM at base >0000 and they want the Tutor to boot from this ROM (with a blwp@>0000)??? - - @>e200(w): sound write - - @>e600(r): handshake in from whatever device??? - @>e610(w): ??? - @>e620(w): ??? - @>e680(w): handshake out to this device??? - - @>e810(w): parallel port data bus - @>e820(r): parallel port busy input - @>e840(w): parallel port strobe output - - @>ee00-@>eee0(w): tape interface (see above) - - @>f000-@>f0fb: tms9995 internal RAM 1 - @>fffa-@>fffb: tms9995 internal decrementer - @>f000-@>f0fb: tms9995 internal RAM 2 -*/ - -#ifdef UNUSED_FUNCTION -WRITE8_MEMBER( tutor_state::test_w ) -{ - switch (offset) - { - default: - logerror("unmapped write %d %d\n", offset, data); - break; - } -} -#endif - -static ADDRESS_MAP_START(tutor_memmap, AS_PROGRAM, 8, tutor_state) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") AM_WRITENOP - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") AM_WRITENOP - AM_RANGE(0xc000, 0xdfff) AM_NOP /*free for expansion, or cartridge ROM?*/ - - AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) /*VDP data*/ - AM_RANGE(0xe002, 0xe002) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)/*VDP status*/ - AM_RANGE(0xe100, 0xe1ff) AM_READWRITE(tutor_mapper_r, tutor_mapper_w) /*cartridge mapper*/ - AM_RANGE(0xe200, 0xe200) AM_DEVWRITE("sn76489a", sn76489a_device, write) /*sound chip*/ - AM_RANGE(0xe800, 0xe8ff) AM_READWRITE(tutor_printer_r, tutor_printer_w) /*printer*/ - AM_RANGE(0xee00, 0xeeff) AM_READNOP AM_WRITE( tutor_cassette_w) /*cassette interface*/ - - AM_RANGE(0xf000, 0xffff) AM_READ(tutor_highmem_r) AM_WRITENOP /*free for expansion (and internal processor RAM)*/ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(pyuutajr_mem, AS_PROGRAM, 8, tutor_state) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") AM_WRITENOP - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") AM_WRITENOP - AM_RANGE(0xc000, 0xdfff) AM_NOP /*free for expansion, or cartridge ROM?*/ - - AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) /*VDP data*/ - AM_RANGE(0xe002, 0xe002) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)/*VDP status*/ - AM_RANGE(0xe100, 0xe1ff) AM_READWRITE(tutor_mapper_r, tutor_mapper_w) /*cartridge mapper*/ - AM_RANGE(0xe200, 0xe200) AM_DEVWRITE("sn76489a", sn76489a_device, write) /*sound chip*/ - AM_RANGE(0xe800, 0xe800) AM_READ_PORT("LINE0") - AM_RANGE(0xea00, 0xea00) AM_READ_PORT("LINE1") - AM_RANGE(0xec00, 0xec00) AM_READ_PORT("LINE2") - AM_RANGE(0xee00, 0xee00) AM_READ_PORT("LINE3") - - AM_RANGE(0xf000, 0xffff) AM_READ(tutor_highmem_r) AM_WRITENOP /*free for expansion (and internal processor RAM)*/ -ADDRESS_MAP_END - -/* - CRU map summary: - - >1ee0->1efe: tms9995 flag register - >1fda: tms9995 MID flag - - >ec00->ec7e(r): keyboard interface - >ed00(r): tape input -*/ - -static ADDRESS_MAP_START(tutor_io, AS_IO, 8, tutor_state) - AM_RANGE(0xec0, 0xec7) AM_READ(key_r) /*keyboard interface*/ - AM_RANGE(0xed0, 0xed0) AM_READ(tutor_cassette_r) /*cassette interface*/ -ADDRESS_MAP_END - -/* tutor keyboard: 56 keys - -2008-05 FP: -Small note about natural keyboard support: currently, -- "MON" is mapped to 'F1' -- "MOD" is mapped to 'F2' -- A, S, D, F, G, R seem to have problems in natural mode -*/ - -static INPUT_PORTS_START(tutor) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- b") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - - PORT_START("LINE4_alt") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_CODE(KEYCODE_6_PAD) - - PORT_START("LINE5") - /* Unused? */ - PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("o ^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('_') PORT_CHAR('@') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') // this one is 4th line, 4th key after 'M' - - PORT_START("LINE5_alt") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - - PORT_START("LINE6") - /* Unused? */ - PORT_BIT(0x21, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - /* only one shift key located on the left, but we support both for emulation to be friendlier */ - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mon") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Mod") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - /* Unused? */ - PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -// Unit only has 12 buttons. LINE0 & 3 are scanned with the others, but have nothing connected? -static INPUT_PORTS_START(pyuutajr) - PORT_START("LINE0") - PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PALLET") PORT_CODE(KEYCODE_P) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_M) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MONITOR") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - - PORT_START("LINE3") - PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( tutor, tutor_state ) - // basic machine hardware - // TMS9995 CPU @ 10.7 MHz - // No lines connected yet - MCFG_TMS99xx_ADD("maincpu", TMS9995, XTAL_10_738635MHz, tutor_memmap, tutor_io) - - /* video hardware */ - MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) - MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) - - /* sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD("sn76489a", SN76489A, 3579545) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(tutor_state, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - MCFG_CASSETTE_ADD( "cassette" ) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "tutor_cart") - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","tutor") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pyuutajr, tutor ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(pyuutajr_mem) - //MCFG_DEVICE_REMOVE("centronics") - //MCFG_DEVICE_REMOVE("cassette") -MACHINE_CONFIG_END - -/* - ROM loading -*/ - -ROM_START(tutor) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("tutor1.bin", 0x0000, 0x8000, CRC(702c38ba) SHA1(ce60607c3038895e31915d41bb5cf71cb8522d7a)) /* system ROM */ - ROM_LOAD("tutor2.bin", 0x8000, 0x4000, CRC(05f228f5) SHA1(46a14a45f6f9e2c30663a2b87ce60c42768a78d0)) /* BASIC ROM */ -ROM_END - - -ROM_START(pyuuta) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("tomy29.7", 0x0000, 0x8000, CRC(7553bb6a) SHA1(fa41c45cb6d3daf7435f2a82f77dfa286003255e)) /* system ROM */ -ROM_END - -ROM_START(pyuutajr) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD( "ipl.rom", 0x0000, 0x4000, CRC(2ca37e62) SHA1(eebdc5c37d3b532edd5e5ca65eb785269ebd1ac0)) /* system ROM */ -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP(1983?, tutor, 0, 0, tutor, tutor, driver_device, 0, "Tomy", "Tomy Tutor" , 0) -COMP(1982, pyuuta, tutor, 0, tutor, tutor, driver_device, 0, "Tomy", "Tomy Pyuuta" , 0) -COMP(1983, pyuutajr, tutor, 0, pyuutajr, pyuutajr, driver_device, 0, "Tomy", "Tomy Pyuuta Jr." , 0) diff --git a/src/mess/drivers/tv950.c b/src/mess/drivers/tv950.c deleted file mode 100644 index eeddfa630e9..00000000000 --- a/src/mess/drivers/tv950.c +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - 2013-09-10 Skeleton driver for Televideo TV950 - - TODO: - - Everything - this is just a skeleton - - Seems there should be a few more roms. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" - - -class tv950_state : public driver_device -{ -public: - tv950_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - -private: - virtual void machine_reset(); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(tv950_mem, AS_PROGRAM, 8, tv950_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xefff) AM_RAM - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tv950_io, AS_IO, 8, tv950_state) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( tv950 ) -INPUT_PORTS_END - - -void tv950_state::machine_reset() -{ -} - -static MACHINE_CONFIG_START( tv950, tv950_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(tv950_mem) - MCFG_CPU_IO_MAP(tv950_io) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( tv950 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_SYSTEM_BIOS( 0, "8000043", "8000043") - ROMX_LOAD( "tv-043h.rom", 0xf000, 0x1000, CRC(89b826be) SHA1(fd5575be04317682d0c9062702b5932b46f89926), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "8000044", "8000044") - ROMX_LOAD( "tv-044h.rom", 0xf000, 0x1000, CRC(24b0383d) SHA1(71cabb7f3da8652a36afdf3d505ab8a41651e801), ROM_BIOS(2) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, tv950, 0, 0, tv950, tv950, driver_device, 0, "Televideo", "TV950", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/tvc.c b/src/mess/drivers/tvc.c deleted file mode 100644 index 7199ef354e8..00000000000 --- a/src/mess/drivers/tvc.c +++ /dev/null @@ -1,876 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic,Sandro Ronco -/*************************************************************************** - - Videoton TVC 32/64 driver - - 12/05/2009 Skeleton driver. - - TODO: - - UPM crashes when formatting a floppy - - overscan and mid-frame changes - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "machine/ram.h" -#include "audio/tvc_snd.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "formats/tvc_cas.h" - -#include "bus/tvc/tvc.h" -#include "bus/tvc/hbf.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define TVC_RAM_BANK 1 -#define TVC_ROM_BANK 2 - -#define CENTRONICS_TAG "centronics" - - -class tvc_state : public driver_device -{ -public: - tvc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_sound(*this, "custom"), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_centronics(*this, CENTRONICS_TAG), - m_palette(*this, "palette"), - m_keyboard(*this, "LINE") - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_sound; - required_device m_cassette; - required_device m_cart; - required_device m_centronics; - required_device m_palette; - required_ioport_array<16> m_keyboard; - - tvcexp_slot_device *m_expansions[4]; - memory_region *m_bios_rom; - memory_region *m_cart_rom; - memory_region *m_ext; - memory_region *m_vram; - - void machine_start(); - void machine_reset(); - - void set_mem_page(UINT8 data); - DECLARE_WRITE8_MEMBER(bank_w); - DECLARE_WRITE8_MEMBER(vram_bank_w); - DECLARE_WRITE8_MEMBER(palette_w); - DECLARE_WRITE8_MEMBER(keyboard_w); - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_READ8_MEMBER(int_state_r); - DECLARE_WRITE8_MEMBER(flipflop_w); - DECLARE_WRITE8_MEMBER(border_color_w); - DECLARE_WRITE8_MEMBER(sound_w); - DECLARE_WRITE8_MEMBER(cassette_w); - DECLARE_READ8_MEMBER(_5b_r); - DECLARE_WRITE_LINE_MEMBER(int_ff_set); - DECLARE_WRITE_LINE_MEMBER(centronics_ack); - - // expansions - DECLARE_WRITE8_MEMBER(expansion_w); - DECLARE_READ8_MEMBER(expansion_r); - DECLARE_READ8_MEMBER(exp_id_r); - DECLARE_WRITE8_MEMBER(expint_ack_w); - - DECLARE_QUICKLOAD_LOAD_MEMBER( tvc64); - - MC6845_UPDATE_ROW(crtc_update_row); - - UINT8 m_video_mode; - UINT8 m_keyline; - UINT8 m_active_slot; - UINT8 m_int_flipflop; - UINT8 m_col[4]; - UINT8 m_bank_type[4]; - UINT8 m_bank; - UINT8 m_vram_bank; - UINT8 m_cassette_ff; - UINT8 m_centronics_ff; - DECLARE_PALETTE_INIT(tvc); -}; - - - -#define TVC_INSTALL_ROM_BANK(_bank,_tag,_start,_end) \ - if (m_bank_type[_bank] != TVC_ROM_BANK) \ - { \ - space.install_read_bank(_start, _end, _tag); \ - space.unmap_write(_start, _end); \ - m_bank_type[_bank] = TVC_ROM_BANK; \ - } -#define TVC_INSTALL_RAM_BANK(_bank,_tag,_start,_end) \ - if (m_bank_type[_bank] != TVC_RAM_BANK) \ - { \ - space.install_readwrite_bank(_start, _end, _tag); \ - m_bank_type[_bank] = TVC_RAM_BANK; \ - } - -void tvc_state::set_mem_page(UINT8 data) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - switch (data & 0x18) - { - case 0x00 : // system ROM selected - TVC_INSTALL_ROM_BANK(0, "bank1", 0x0000, 0x3fff); - membank("bank1")->set_base(m_bios_rom->base()); - break; - case 0x08 : // Cart ROM selected - if (m_cart_rom) - { - TVC_INSTALL_ROM_BANK(0, "bank1", 0x0000, 0x3fff); - membank("bank1")->set_base(m_cart_rom->base()); - } - break; - case 0x10 : // RAM selected - TVC_INSTALL_RAM_BANK(0, "bank1", 0x0000, 0x3fff); - membank("bank1")->set_base(m_ram->pointer()); - break; - case 0x18 : // Video RAM - if (m_vram->bytes() > 0x4000) - { - // TVC 64+ only - TVC_INSTALL_RAM_BANK(0, "bank1", 0x0000, 0x3fff); - membank("bank1")->set_base(m_vram->base() + ((m_vram_bank & 0x03)<<14)); - } - else - { - space.unmap_readwrite(0x0000, 0x3fff); - m_bank_type[0] = -1; - } - break; - } - - if ((data & 0x20)==0) // Video RAM - { - TVC_INSTALL_RAM_BANK(2, "bank3", 0x8000, 0xbfff); - membank("bank3")->set_base(m_vram->base() + ((m_vram_bank & 0x0c)<<12)); - } - else // System RAM page 3 - { - if (m_ram->size() > 0x8000) - { - TVC_INSTALL_RAM_BANK(2, "bank3", 0x8000, 0xbfff); - membank("bank3")->set_base(m_ram->pointer() + 0x8000); - } - else - { - space.unmap_readwrite(0x8000, 0xbfff); - m_bank_type[2] = -1; - } - } - - switch(data & 0xc0) - { - case 0x00 : // Cart ROM selected - if (m_cart_rom) - { - TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff); - membank("bank4")->set_base(m_cart_rom->base()); - } - break; - case 0x40 : // System ROM selected - TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff); - membank("bank4")->set_base(m_bios_rom->base()); - break; - case 0x80 : // RAM selected - if (m_ram->size() > 0x8000) - { - TVC_INSTALL_RAM_BANK(3, "bank4", 0xc000, 0xffff); - membank("bank4")->set_base(m_ram->pointer() + 0xc000); - } - else - { - space.unmap_readwrite(0xc000, 0xffff); - m_bank_type[3] = -1; - } - break; - case 0xc0 : // External ROM selected - TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff); - membank("bank4")->set_base(m_ext->base()); - space.install_readwrite_handler (0xc000, 0xdfff, 0, 0, read8_delegate(FUNC(tvc_state::expansion_r), this), write8_delegate(FUNC(tvc_state::expansion_w), this), 0); - m_bank_type[3] = -1; - break; - } -} - - -WRITE8_MEMBER(tvc_state::expansion_w) -{ - m_expansions[m_active_slot & 3]->write(space, offset, data); -} - - -READ8_MEMBER(tvc_state::expansion_r) -{ - return m_expansions[m_active_slot & 3]->read(space, offset); -} - -WRITE8_MEMBER(tvc_state::bank_w) -{ - m_bank = data; - set_mem_page(data); -} - -WRITE8_MEMBER(tvc_state::vram_bank_w) -{ - // TVC 64+ only - if (m_vram->bytes() > 0x4000) - { - // bit 4-5 - screen video RAM - // bit 2-3 - video RAM active in bank 3 - // bit 0-1 - video RAM active in bank 1 - - m_vram_bank = data; - set_mem_page(m_bank); - } -} - -WRITE8_MEMBER(tvc_state::palette_w) -{ - // 0 I 0 G | 0 R 0 B - // 0 0 0 0 | I G R B - int i = ((data&0x40)>>3) | ((data&0x10)>>2) | ((data&0x04)>>1) | (data&0x01); - - m_col[offset] = i; -} - -WRITE8_MEMBER(tvc_state::keyboard_w) -{ - // bit 6-7 - expansion select - // bit 0-3 - keyboard scan - - m_keyline = data & 0x0f; - m_active_slot = (data>>6) & 0x03; -} - -READ8_MEMBER(tvc_state::keyboard_r) -{ - return m_keyboard[m_keyline & 0x0f]->read(); -} - -READ8_MEMBER(tvc_state::int_state_r) -{ - /* - x--- ---- centronics ACK flipflop - -x-- ---- colour - --x- ---- cassette input - ---x ---- vblank or tone interrupt - ---- xxxx expansions interrupt (active low) - */ - - double level = m_cassette->input(); - - UINT8 expint = (m_expansions[0]->int_r()<<0) | (m_expansions[1]->int_r()<<1) | - (m_expansions[2]->int_r()<<2) | (m_expansions[3]->int_r()<<3); - - return 0x40 | (m_int_flipflop << 4) | (level > 0.01 ? 0x20 : 0x00) | (m_centronics_ff << 7) | (expint & 0x0f); -} - -WRITE8_MEMBER(tvc_state::flipflop_w) -{ - // every write here clears the vblank flipflop - m_int_flipflop = 1; - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -READ8_MEMBER(tvc_state::exp_id_r) -{ - // expansion slots ID - return (m_expansions[0]->id_r()<<0) | (m_expansions[1]->id_r()<<2) | - (m_expansions[2]->id_r()<<4) | (m_expansions[3]->id_r()<<6); -} - -WRITE8_MEMBER(tvc_state::expint_ack_w) -{ - m_expansions[offset & 3]->int_ack(); -} - -WRITE8_MEMBER(tvc_state::border_color_w) -{ - // x-x- x-x- border color (I G R B) -} - - -WRITE8_MEMBER(tvc_state::sound_w) -{ - switch(offset) - { - case 1: - // bit 6-7 - cassette motors - m_cassette->change_state(BIT(data, 6) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - //m_cassette2->change_state(BIT(data, 7) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_cassette->output(m_cassette_ff ? +1 : -1); - break; - case 2: - // bit 0-1 - video mode - // bit 7 - centronics STROBE - m_video_mode = data & 0x03; - m_centronics->write_strobe(BIT(data, 7)); - if (!BIT(data, 7)) - m_centronics_ff = 0; - break; - } - - // sound ports - m_sound->write(space, offset, data); -} - -READ8_MEMBER(tvc_state::_5b_r) -{ - m_sound->reset_divider(); - return 0xff; -} - -WRITE8_MEMBER(tvc_state::cassette_w) -{ - // writig here cause the toggle of the cassette flipflop - m_cassette_ff = !m_cassette_ff; - m_cassette->output(m_cassette_ff ? +1 : -1); -} - -static ADDRESS_MAP_START(tvc_mem, AS_PROGRAM, 8, tvc_state ) - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tvc_io , AS_IO, 8, tvc_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_WRITE(border_color_w) - AM_RANGE(0x01, 0x01) AM_DEVWRITE("cent_data_out", output_latch_device, write) - AM_RANGE(0x02, 0x02) AM_WRITE(bank_w) - AM_RANGE(0x03, 0x03) AM_WRITE(keyboard_w) - AM_RANGE(0x04, 0x06) AM_WRITE(sound_w) - AM_RANGE(0x07, 0x07) AM_WRITE(flipflop_w) - AM_RANGE(0x0f, 0x0f) AM_WRITE(vram_bank_w) - AM_RANGE(0x10, 0x1f) AM_DEVREADWRITE("exp1", tvcexp_slot_device, io_read, io_write) - AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("exp2", tvcexp_slot_device, io_read, io_write) - AM_RANGE(0x30, 0x3f) AM_DEVREADWRITE("exp3", tvcexp_slot_device, io_read, io_write) - AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("exp4", tvcexp_slot_device, io_read, io_write) - AM_RANGE(0x50, 0x50) AM_WRITE(cassette_w) - AM_RANGE(0x58, 0x58) AM_READ(keyboard_r) - AM_RANGE(0x59, 0x59) AM_READ(int_state_r) - AM_RANGE(0x5a, 0x5a) AM_READ(exp_id_r) - AM_RANGE(0x5b, 0x5b) AM_READ(_5b_r) - AM_RANGE(0x58, 0x5b) AM_WRITE(expint_ack_w) - AM_RANGE(0x60, 0x63) AM_WRITE(palette_w) - AM_RANGE(0x70, 0x70) AM_DEVWRITE("crtc", mc6845_device, address_w) - AM_RANGE(0x71, 0x71) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( tvc ) - PORT_START("LINE.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('+') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('&') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('/') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\x8d") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(0x00cd) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('\'') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('!') - - PORT_START("LINE.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xbc") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(0x00fc) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(0x00f3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb6") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(0x00f6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('=') - - PORT_START("LINE.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_HOME) PORT_CHAR('@') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - - PORT_START("LINE.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc5\x91") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(0x0151) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xba") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(0x00fa) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - - PORT_START("LINE.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_END) PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - - PORT_START("LINE.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa1") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(0x00e1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc5\xb1") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(0x0171) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(0x00e9) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START("LINE.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("LINE.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("LINE.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fire") PORT_CODE(KEYCODE_PGUP) //PORT_CHAR(UCHAR_MAMEKEY()) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Acc") PORT_CODE(KEYCODE_PGDN) //PORT_CHAR(UCHAR_MAMEKEY()) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.9") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.10") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.11") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.12") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.13") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.14") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.15") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( tvc64pru ) - PORT_START("LINE.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x0436) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DL") PORT_CODE(KEYCODE_HOME) // delete line - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DC") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START("LINE.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("IL") PORT_CODE(KEYCODE_END) // insert line - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - - PORT_START("LINE.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("LINE.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("LINE.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START("LINE.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("LINE.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('^') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("LINE.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_RALT) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('@') PORT_CHAR('\'') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("LINE.8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Up") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Down") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Fire") PORT_CODE(KEYCODE_PGUP) //PORT_CHAR(UCHAR_MAMEKEY()) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Acc") PORT_CODE(KEYCODE_PGDN) //PORT_CHAR(UCHAR_MAMEKEY()) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Right") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy Left") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("LINE.9") - PORT_BIT(0x7f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_START("LINE.10") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.11") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.12") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.13") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.14") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE.15") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -void tvc_state::machine_start() -{ - for (int i = 0; i < 4; i++) - m_col[i] = i; - - m_int_flipflop = 0; - - m_expansions[0] = machine().device("exp1"); - m_expansions[1] = machine().device("exp2"); - m_expansions[2] = machine().device("exp3"); - m_expansions[3] = machine().device("exp4"); - - m_bios_rom = memregion("sys"); - m_ext = memregion("ext"); - m_vram = memregion("vram"); - - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); -} - -void tvc_state::machine_reset() -{ - memset(m_ram->pointer(), 0, m_ram->size()); - set_mem_page(0); - m_video_mode = 0; - m_cassette_ff = 1; - m_centronics_ff = 1; - m_bank = 0; - m_vram_bank = 0; - memset(m_bank_type, 0, sizeof(m_bank_type)); - m_active_slot = 0; - - // Bank 2 is always RAM - membank("bank2")->set_base(m_ram->pointer() + 0x4000); -} - -MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - UINT8 *vram = m_vram->base() + ((m_vram_bank & 0x30)<<10); - UINT16 offset = ((ma*4 + ra*0x40) & 0x3fff); - int i; - - switch(m_video_mode) { - case 0 : - // 2 colors mode - for ( i = 0; i < x_count; i++ ) - { - UINT8 data = vram[offset + i]; - *p++ = palette[m_col[BIT(data,7)]]; - *p++ = palette[m_col[BIT(data,6)]]; - *p++ = palette[m_col[BIT(data,5)]]; - *p++ = palette[m_col[BIT(data,4)]]; - *p++ = palette[m_col[BIT(data,3)]]; - *p++ = palette[m_col[BIT(data,2)]]; - *p++ = palette[m_col[BIT(data,1)]]; - *p++ = palette[m_col[BIT(data,0)]]; - } - break; - case 1 : - // 4 colors mode - // a0 b0 c0 d0 a1 b1 c1 d1 - for ( i = 0; i < x_count; i++ ) - { - UINT8 data = vram[offset + i]; - *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; - *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; - *p++ = palette[m_col[BIT(data,2)*2 + BIT(data,6)]]; - *p++ = palette[m_col[BIT(data,2)*2 + BIT(data,6)]]; - *p++ = palette[m_col[BIT(data,1)*2 + BIT(data,5)]]; - *p++ = palette[m_col[BIT(data,1)*2 + BIT(data,5)]]; - *p++ = palette[m_col[BIT(data,0)*2 + BIT(data,4)]]; - *p++ = palette[m_col[BIT(data,0)*2 + BIT(data,4)]]; - } - break; - default: - // 16 colors mode - // IIGG RRBB - for ( i = 0; i < x_count; i++ ) - { - UINT8 data = vram[offset + i]; - UINT8 col0 = ((data & 0x80)>>4) | ((data & 0x20)>>3) | ((data & 0x08)>>2) | ((data & 0x02)>>1); - UINT8 col1 = ((data & 0x40)>>3) | ((data & 0x10)>>2) | ((data & 0x04)>>1) | (data & 0x01); - *p++ = palette[col0]; - *p++ = palette[col0]; - *p++ = palette[col0]; - *p++ = palette[col0]; - *p++ = palette[col1]; - *p++ = palette[col1]; - *p++ = palette[col1]; - *p++ = palette[col1]; - } - break; - - } -} - -PALETTE_INIT_MEMBER(tvc_state, tvc) -{ - const static unsigned char tvc_palette[16][3] = - { - { 0x00,0x00,0x00 }, - { 0x00,0x00,0x7f }, - { 0x7f,0x00,0x00 }, - { 0x7f,0x00,0x7f }, - { 0x00,0x7f,0x00 }, - { 0x00,0x7f,0x7f }, - { 0x7f,0x7f,0x00 }, - { 0x7f,0x7f,0x7f }, - { 0x00,0x00,0x00 }, - { 0x00,0x00,0xff }, - { 0xff,0x00,0x00 }, - { 0xff,0x00,0xff }, - { 0x00,0xff,0x00 }, - { 0x00,0xff,0xff }, - { 0xff,0xff,0x00 }, - { 0xff,0xff,0xff } - }; - int i; - - for(i = 0; i < 16; i++) - palette.set_pen_color(i, tvc_palette[i][0], tvc_palette[i][1], tvc_palette[i][2]); -} - -WRITE_LINE_MEMBER(tvc_state::int_ff_set) -{ - if (state) - { - m_int_flipflop = 0; - m_maincpu->set_input_line(0, ASSERT_LINE); - } -} - -WRITE_LINE_MEMBER(tvc_state::centronics_ack) -{ - if (state) - m_centronics_ff = 1; -} - -QUICKLOAD_LOAD_MEMBER( tvc_state, tvc64) -{ - UINT8 first_byte; - - image.fread(&first_byte, 1); - if (first_byte == 0x11) - { - image.fseek(0x90, SEEK_SET); - image.fread(m_ram->pointer() + 0x19ef, image.length() - 0x90); - return IMAGE_INIT_PASS; - } - else - { - return IMAGE_INIT_FAIL; - } -} - - -extern SLOT_INTERFACE_START(tvc_exp) - SLOT_INTERFACE("hbf", TVC_HBF) // Videoton HBF floppy interface -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( tvc, tvc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, 3125000) - MCFG_CPU_PROGRAM_MAP(tvc_mem) - MCFG_CPU_IO_MAP(tvc_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(512, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 512 - 1, 0, 240 - 1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - - MCFG_PALETTE_ADD( "palette", 16 ) - MCFG_PALETTE_INIT_OWNER(tvc_state, tvc) - - MCFG_MC6845_ADD("crtc", MC6845, "screen", 3125000/2) // clk taken from schematics - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) /*?*/ - MCFG_MC6845_UPDATE_ROW_CB(tvc_state, crtc_update_row) - MCFG_MC6845_OUT_CUR_CB(WRITELINE(tvc_state, int_ff_set)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("32K") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", TVC_SOUND, 0) - MCFG_TVC_SOUND_SNDINT_CALLBACK(WRITELINE(tvc_state, int_ff_set)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(tvc_state, centronics_ack)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "tvc_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom,crt") - - /* expansion interface */ - MCFG_DEVICE_ADD("exp1", TVCEXP_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) - MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_DEVICE_ADD("exp2", TVCEXP_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) - MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_DEVICE_ADD("exp3", TVCEXP_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) - MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_DEVICE_ADD("exp4", TVCEXP_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) - MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) - MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - - /* cassette */ - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(tvc64_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED) - MCFG_CASSETTE_INTERFACE("tvc_cass") - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", tvc_state, tvc64, "cas", 6) - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "tvc_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "tvc_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "tvc_flop") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( tvc64 ) - ROM_REGION( 0x4000, "sys", ROMREGION_ERASEFF ) - ROM_LOAD( "tvc12_d4.64k", 0x0000, 0x2000, CRC(834ca9be) SHA1(c333318c1c6185aae2d3dfb86d55e3a4a3071a73)) - ROM_LOAD( "tvc12_d3.64k", 0x2000, 0x2000, CRC(71753d02) SHA1(d9a1905cf55c532b3380c83158fb5254ee503829)) - - ROM_REGION( 0x4000, "ext", ROMREGION_ERASEFF ) - ROM_LOAD( "tvc12_d7.64k", 0x2000, 0x2000, CRC(1cbbeac6) SHA1(54b29c9ca9942f04620fbf3edab3b8e3cd21c194)) - - ROM_REGION( 0x4000, "vram", ROMREGION_ERASE ) -ROM_END - -ROM_START( tvc64p ) - ROM_REGION( 0x4000, "sys", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v22", "v2.2") - ROMX_LOAD( "tvc22_d6.64k", 0x0000, 0x2000, CRC(05ac3a34) SHA1(bdc7eda5fd53f806dca8c4929ee498e8e59eb787), ROM_BIOS(1) ) - ROMX_LOAD( "tvc22_d4.64k", 0x2000, 0x2000, CRC(ba6ad589) SHA1(e5c8a6db506836a327d901387a8dc8c681a272db), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v21", "v2.1") - ROMX_LOAD( "tvc21_d6.64k", 0x0000, 0x2000, CRC(f197ffce) SHA1(7b27a91504dd864170451949ada5f938d6532cae), ROM_BIOS(2) ) - ROMX_LOAD( "tvc21_d4.64k", 0x2000, 0x2000, CRC(b054c0b2) SHA1(c8ca8d5a4d092604de01e2cafc2a2dabe94e6380), ROM_BIOS(2) ) - - ROM_REGION( 0x4000, "ext", ROMREGION_ERASEFF ) - ROM_LOAD( "tvc22_d7.64k", 0x2000, 0x2000, CRC(05e1c3a8) SHA1(abf119cf947ea32defd08b29a8a25d75f6bd4987)) - - ROM_REGION( 0x10000, "vram", ROMREGION_ERASE ) -ROM_END - -ROM_START( tvc64pru ) - ROM_REGION( 0x4000, "sys", ROMREGION_ERASEFF ) - ROM_LOAD( "tvcru_d6.bin", 0x0000, 0x2000, CRC(1e0fa0b8) SHA1(9bebb6c8f03f9641bd35c9fd45ffc13a48e5c572)) - ROM_LOAD( "tvcru_d4.bin", 0x2000, 0x2000, CRC(bac5dd4f) SHA1(665a1b8c80b6ad82090803621f0c73ef9243c7d4)) - - ROM_REGION( 0x4000, "ext", ROMREGION_ERASEFF ) - ROM_LOAD( "tvcru_d7.bin", 0x2000, 0x2000, CRC(70cde756) SHA1(c49662af9f6653347ead641e85777c3463cc161b)) - - ROM_REGION( 0x10000, "vram", ROMREGION_ERASE ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, tvc64, 0, 0, tvc, tvc, driver_device, 0, "Videoton", "TVC 64", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1985, tvc64p, tvc64, 0, tvc, tvc, driver_device, 0, "Videoton", "TVC 64+", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1985, tvc64pru, tvc64, 0, tvc, tvc64pru, driver_device, 0, "Videoton", "TVC 64+ (Russian)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/tvgame.c b/src/mess/drivers/tvgame.c deleted file mode 100644 index 44ede341caf..00000000000 --- a/src/mess/drivers/tvgame.c +++ /dev/null @@ -1,133 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders: Robbbert -/*************************************************************************** - - Homebrew Z80-based TV Game computer by Mr. Isizu - - http://w01.tp1.jp/~a571632211/z80tvgame/index.html - - 2015-06-12 Driver by Robbbert - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "sound/speaker.h" - - -class tvgame_state : public driver_device -{ -public: - tvgame_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_speaker(*this, "speaker") - , m_p_videoram(*this, "videoram") - { } - - DECLARE_WRITE8_MEMBER(speaker_w); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -private: - required_device m_maincpu; - required_device m_speaker; - required_shared_ptr m_p_videoram; -}; - -static ADDRESS_MAP_START( tvgame_mem, AS_PROGRAM, 8, tvgame_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x7fff ) AM_ROM - AM_RANGE( 0x8000, 0xbfff ) AM_RAM - AM_RANGE( 0xc000, 0xdfff ) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( tvgame_io, AS_IO, 8, tvgame_state ) - ADDRESS_MAP_GLOBAL_MASK(3) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0003) AM_DEVREADWRITE("ppi", i8255_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( tvgame ) - PORT_START("LINE0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -WRITE8_MEMBER( tvgame_state::speaker_w ) -{ - m_speaker->level_w(BIT(data, 0)); -} - -UINT32 tvgame_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,gfx; - UINT16 sy=0,ma=241,x; - - for (y = 0; y < 213; y++) - { - UINT16 *p = &bitmap.pix16(sy++); - for (x = ma; x < ma+27; x++) - { - gfx = m_p_videoram[x]; - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 0); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 7); - } - ma+=30; - } - return 0; -} - -static MACHINE_CONFIG_START( tvgame, tvgame_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(tvgame_mem) - MCFG_CPU_IO_MAP(tvgame_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(tvgame_state, screen_update) - MCFG_SCREEN_SIZE(216, 213) - MCFG_SCREEN_VISIBLE_AREA(0, 215, 0, 212) - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - // Devices - MCFG_DEVICE_ADD("ppi", I8255, 0) - MCFG_I8255_IN_PORTA_CB(IOPORT("LINE0")) - MCFG_I8255_OUT_PORTC_CB(WRITE8(tvgame_state, speaker_w)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( tvgame ) - ROM_REGION( 0x8000, "maincpu", 0 ) - ROM_LOAD( "tvgame_all.ppi", 0x0000, 0x8000, CRC(b61d17bd) SHA1(bb92d6679370fc31d67cc334807d88d7288c7cfa) ) - - ROM_REGION(0x1000, "proms", 0) - ROM_LOAD( "video32.bin", 0x0000, 0x1000, CRC(516006e3) SHA1(942b31acccf833cd722cbcb739eb87673dc633d7) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -CONS( 2011, tvgame, 0, 0, tvgame, tvgame, driver_device, 0, "Mr. Isizu", "Z80 TV Game System", 0 ) diff --git a/src/mess/drivers/tx0.c b/src/mess/drivers/tx0.c deleted file mode 100644 index d2a2865572e..00000000000 --- a/src/mess/drivers/tx0.c +++ /dev/null @@ -1,1625 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - TX-0 - - Raphael Nabet, 2004 -*/ - -#include "emu.h" -#include "cpu/pdp1/tx0.h" -#include "includes/tx0.h" -#include "video/crt.h" - - -/* - driver init function -*/ -DRIVER_INIT_MEMBER(tx0_state,tx0) -{ - UINT8 *dst; - - static const unsigned char fontdata6x8[tx0_fontdata_size] = - { /* ASCII characters */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, - 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00, - 0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08, - 0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00, - 0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00, - 0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00, - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00, - 0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00, - 0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, - 0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00, - 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00, - 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60, - 0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, - 0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, - 0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, - 0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, - 0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, - 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00, - 0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, - 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, - 0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08, - 0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00, - 0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00, - 0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00, - 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00, - 0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc, - 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, - 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00, - 0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, - 0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, - 0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00, - 0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00, - 0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, - 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, - 0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, - 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00, - 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00, - 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, - 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, - 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00, - }; - - /* set up our font */ - dst = memregion("gfx1")->base(); - - memcpy(dst, fontdata6x8, tx0_fontdata_size); -} - - -static ADDRESS_MAP_START(tx0_64kw_map, AS_PROGRAM, 32, tx0_state ) - AM_RANGE(0x0000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START(tx0_8kw_map, AS_PROGRAM, 32, tx0_state ) - AM_RANGE(0x0000, 0x1fff) AM_RAM -ADDRESS_MAP_END - - -static INPUT_PORTS_START( tx0 ) - - PORT_START("CSW") /* 0: various tx0 operator control panel switches */ - PORT_BIT(tx0_control, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(tx0_stop_cyc0, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop at cycle 0") PORT_CODE(KEYCODE_Q) - PORT_BIT(tx0_stop_cyc1, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop at cycle 1") PORT_CODE(KEYCODE_W) - PORT_BIT(tx0_gbl_cm_sel, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CM select") PORT_CODE(KEYCODE_E) - PORT_BIT(tx0_stop, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop") PORT_CODE(KEYCODE_P) - PORT_BIT(tx0_restart, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("restart") PORT_CODE(KEYCODE_O) - PORT_BIT(tx0_read_in, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("read in") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(tx0_toggle_dn, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("edit next toggle switch register") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(tx0_toggle_up, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("edit previous toggle switch register") PORT_CODE(KEYCODE_UP) - PORT_BIT(tx0_cm_sel, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TSS CM switch") PORT_CODE(KEYCODE_A) - PORT_BIT(tx0_lr_sel, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TSS LR switch") PORT_CODE(KEYCODE_SLASH) - - PORT_START("MSW") /* 1: operator control panel toggle switch register switches MS */ - PORT_BIT( 0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 0") PORT_CODE(KEYCODE_S) - PORT_BIT( 0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 1") PORT_CODE(KEYCODE_D) - - PORT_START("LSW") /* 2: operator control panel toggle switch register switches LS */ - PORT_BIT( 0100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 2") PORT_CODE(KEYCODE_F) - PORT_BIT( 0040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 3") PORT_CODE(KEYCODE_G) - PORT_BIT( 0020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 4") PORT_CODE(KEYCODE_H) - PORT_BIT( 0010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 5") PORT_CODE(KEYCODE_J) - PORT_BIT( 0004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 6") PORT_CODE(KEYCODE_K) - PORT_BIT( 0002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 7") PORT_CODE(KEYCODE_L) - PORT_BIT( 0001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 8") PORT_CODE(KEYCODE_COLON) - PORT_BIT( 0000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 9") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 10") PORT_CODE(KEYCODE_X) - PORT_BIT( 0000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 11") PORT_CODE(KEYCODE_C) - PORT_BIT( 0000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 12") PORT_CODE(KEYCODE_V) - PORT_BIT( 0000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 13") PORT_CODE(KEYCODE_B) - PORT_BIT( 0000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 14") PORT_CODE(KEYCODE_N) - PORT_BIT( 0000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 15") PORT_CODE(KEYCODE_M) - PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 16") PORT_CODE(KEYCODE_COMMA) - PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 17") PORT_CODE(KEYCODE_STOP) - - PORT_START("TWR.0") /* 3: typewriter codes 00-17 */ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| _") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(Space)") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= :") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ /") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - - PORT_START("TWR.1") /* 4: typewriter codes 20-37 */ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". )") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - - PORT_START("TWR.2") /* 5: typewriter codes 40-57 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab Key") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - - PORT_START("TWR.3") /* 6: typewriter codes 60-77 */ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upper case") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lower Case") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - -INPUT_PORTS_END - - -static const gfx_layout fontlayout = -{ - 6, 8, /* 6*8 characters */ - tx0_charnum, /* 96+xx characters */ - 1, /* 1 bit per pixel */ - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ -}; - - -/* - The static palette only includes the pens for the control panel and - the typewriter, as the CRT palette is generated dynamically. - - The CRT palette defines various levels of intensity between white and - black. Grey levels follow an exponential law, so that decrementing the - color index periodically will simulate the remanence of a cathode ray tube. -*/ -static const UINT8 tx0_colors[] = -{ - 0x00,0x00,0x00, /* black */ - 0xFF,0xFF,0xFF, /* white */ - 0x00,0xFF,0x00, /* green */ - 0x00,0x40,0x00, /* dark green */ - 0xFF,0x00,0x00, /* red */ - 0x80,0x80,0x80 /* light gray */ -}; - -static const UINT8 tx0_palette[] = -{ - pen_panel_bg, pen_panel_caption, /* captions */ - pen_typewriter_bg, pen_black, /* black typing in typewriter */ - pen_typewriter_bg, pen_red /* red typing in typewriter */ -}; - -static const UINT8 total_colors_needed = pen_crt_num_levels + sizeof(tx0_colors) / 3; - -static GFXDECODE_START( tx0 ) - GFXDECODE_ENTRY( "gfx1", 0, fontlayout, pen_crt_num_levels + sizeof(tx0_colors) / 3, 3 ) -GFXDECODE_END - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(tx0_state, tx0) -{ - /* rgb components for the two color emissions */ - const double r1 = .1, g1 = .1, b1 = .924, r2 = .7, g2 = .7, b2 = .076; - /* half period in seconds for the two color emissions */ - const double half_period_1 = .05, half_period_2 = .20; - /* refresh period in seconds */ - const double update_period = 1./refresh_rate; - double decay_1, decay_2; - double cur_level_1, cur_level_2; -#if 0 -#ifdef MAME_DEBUG - /* level at which we stop emulating the decay and say the pixel is black */ - double cut_level = .02; -#endif -#endif - UINT8 i, r, g, b; - - /* initialize CRT palette */ - - /* compute the decay factor per refresh frame */ - decay_1 = pow(.5, update_period / half_period_1); - decay_2 = pow(.5, update_period / half_period_2); - - cur_level_1 = cur_level_2 = 255.; /* start with maximum level */ - - for (i=pen_crt_max_intensity; i>0; i--) - { - /* compute the current color */ - r = (int) ((r1*cur_level_1 + r2*cur_level_2) + .5); - g = (int) ((g1*cur_level_1 + g2*cur_level_2) + .5); - b = (int) ((b1*cur_level_1 + b2*cur_level_2) + .5); - /* write color in palette */ - palette.set_indirect_color(i, rgb_t(r, g, b)); - /* apply decay for next iteration */ - cur_level_1 *= decay_1; - cur_level_2 *= decay_2; - } -#if 0 -#ifdef MAME_DEBUG - { - int recommended_pen_crt_num_levels; - if (decay_1 > decay_2) - recommended_pen_crt_num_levels = ceil(log(cut_level)/log(decay_1))+1; - else - recommended_pen_crt_num_levels = ceil(log(cut_level)/log(decay_2))+1; - if (recommended_pen_crt_num_levels != pen_crt_num_levels) - osd_printf_debug("File %s line %d: recommended value for pen_crt_num_levels is %d\n", __FILE__, __LINE__, recommended_pen_crt_num_levels); - } - /*if ((cur_level_1 > 255.*cut_level) || (cur_level_2 > 255.*cut_level)) - osd_printf_debug("File %s line %d: Please take higher value for pen_crt_num_levels or smaller value for decay\n", __FILE__, __LINE__);*/ -#endif -#endif - palette.set_indirect_color(0, rgb_t(0, 0, 0)); - - /* load static palette */ - for ( i = 0; i < 6; i++ ) - { - r = tx0_colors[i*3]; g = tx0_colors[i*3+1]; b = tx0_colors[i*3+2]; - palette.set_indirect_color(pen_crt_num_levels + i, rgb_t(r, g, b)); - } - - /* copy colortable to palette */ - for( i = 0; i < total_colors_needed; i++ ) - palette.set_pen_indirect(i, i); - - /* set up palette for text */ - for( i = 0; i < 6; i++ ) - palette.set_pen_indirect(total_colors_needed + i, tx0_palette[i]); -} - - - -/* - TX-0 -* - Raphael Nabet, 2004 -*/ - - - -/* crt display timer */ - - - -enum -{ - PF_RWC = 040, - PF_EOR = 020, - PF_PC = 010, - PF_EOT = 004 -}; - - -void tx0_state::machine_reset() -{ - /* reset device state */ - m_tape_reader.rcl = m_tape_reader.rc = 0; -} - - -void tx0_state::tx0_machine_stop() -{ - /* the core will take care of freeing the timers, BUT we must set the variables - to NULL if we don't want to risk confusing the tape image init function */ - m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.prt_timer = m_dis_timer = NULL; -} - - -void tx0_state::machine_start() -{ - m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::reader_callback),this)); - m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::puncher_callback),this)); - m_typewriter.prt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::prt_callback),this)); - m_dis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::dis_callback),this)); - - machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_state::tx0_machine_stop),this)); -} - - -/* - perforated tape handling -*/ - -class tx0_readtape_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - tx0_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 0; } - virtual bool is_creatable() const { return 0; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "tap,rim"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type TX0_READTAPE = &device_creator; - -tx0_readtape_image_device::tx0_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, TX0_READTAPE, "TX0 Tape Reader", tag, owner, clock, "tx0_readtape_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -class tx0_punchtape_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - tx0_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_PUNCHTAPE; } - - virtual bool is_readable() const { return 0; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "tap,rim"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type TX0_PUNCHTAPE = &device_creator; - -tx0_punchtape_image_device::tx0_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, TX0_PUNCHTAPE, "TX0 Tape Puncher", tag, owner, clock, "tx0_punchtape_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - - -class tx0_printer_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - tx0_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_PRINTER; } - - virtual bool is_readable() const { return 0; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "typ"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start() { } -}; - -const device_type TX0_PRINTER = &device_creator; - -tx0_printer_image_device::tx0_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, TX0_PRINTER, "TX0 Typewriter", tag, owner, clock, "tx0_printer_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -class tx0_magtape_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - tx0_magtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_MAGTAPE; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "tap"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); -protected: - // device-level overrides - virtual void device_config_complete() { update_names(); } - virtual void device_start(); -}; - -const device_type TX0_MAGTAPE = &device_creator; - -tx0_magtape_image_device::tx0_magtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, TX0_MAGTAPE, "TX0 Magnetic Tape", tag, owner, clock, "tx0_magtape_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -/* - Open a perforated tape image - - unit 0 is reader (read-only), unit 1 is puncher (write-only) -*/ -bool tx0_readtape_image_device::call_load() -{ - tx0_state *state = machine().driver_data(); - - /* reader unit */ - state->m_tape_reader.fd = this; - - /* start motor */ - state->m_tape_reader.motor_on = 1; - - /* restart reader IO when necessary */ - /* note that this function may be called before tx0_init_machine, therefore - before tape_reader.timer is allocated. It does not matter, as the clutch is never - down at power-up, but we must not call timer_enable with a NULL parameter! */ - - if (state->m_tape_reader.timer) - { - if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl) - { - /* delay is approximately 1/400s */ - state->m_tape_reader.timer->adjust(attotime::from_usec(2500)); - } - else - { - state->m_tape_reader.timer->enable(0); - } - } - - return IMAGE_INIT_PASS; -} - -void tx0_readtape_image_device::call_unload() -{ - tx0_state *state = machine().driver_data(); - - /* reader unit */ - state->m_tape_reader.fd = NULL; - - /* stop motor */ - state->m_tape_reader.motor_on = 0; - - if (state->m_tape_reader.timer) - state->m_tape_reader.timer->enable(0); -} - -/* - Read a byte from perforated tape -*/ -int tx0_state::tape_read(UINT8 *reply) -{ - if (m_tape_reader.fd && (m_tape_reader.fd->fread(reply, 1) == 1)) - return 0; /* unit OK */ - else - return 1; /* unit not ready */ -} - -/* - Write a byte to perforated tape -*/ -void tx0_state::tape_write(UINT8 data) -{ - if (m_tape_puncher.fd) - m_tape_puncher.fd->fwrite(& data, 1); -} - -/* - common code for tape read commands (R1C, R3C, and read-in mode) -*/ -void tx0_state::begin_tape_read(int binary) -{ - m_tape_reader.rcl = 1; - m_tape_reader.rc = (binary) ? 1 : 3; - - /* set up delay if tape is advancing */ - if (m_tape_reader.motor_on && m_tape_reader.rcl) - { - /* delay is approximately 1/400s */ - m_tape_reader.timer->adjust(attotime::from_usec(2500)); - } - else - { - m_tape_reader.timer->enable(0); - } -} - - -/* - timer callback to simulate reader IO -*/ -TIMER_CALLBACK_MEMBER(tx0_state::reader_callback) -{ - int not_ready; - UINT8 data; - int ac; - - if (m_tape_reader.rc) - { - not_ready = tape_read( & data); - if (not_ready) - { - m_tape_reader.motor_on = 0; /* let us stop the motor */ - } - else - { - if (data & 0100) - { - /* read current AC */ - ac = m_maincpu->state_int(TX0_AC); - /* cycle right */ - ac = (ac >> 1) | ((ac & 1) << 17); - /* shuffle and insert data into AC */ - ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3); - /* write modified AC */ - m_maincpu->set_state_int(TX0_AC, ac); - - m_tape_reader.rc = (m_tape_reader.rc+1) & 3; - - if (m_tape_reader.rc == 0) - { /* IO complete */ - m_tape_reader.rcl = 0; - m_maincpu->set_state_int(TX0_IOS,1); - } - } - } - } - - if (m_tape_reader.motor_on && m_tape_reader.rcl) - /* delay is approximately 1/400s */ - m_tape_reader.timer->adjust(attotime::from_usec(2500)); - else - m_tape_reader.timer->enable(0); -} - -/* - timer callback to generate punch completion pulse -*/ -bool tx0_punchtape_image_device::call_load() -{ - tx0_state *state = machine().driver_data(); - - /* punch unit */ - state->m_tape_puncher.fd = this; - - return IMAGE_INIT_PASS; -} - -void tx0_punchtape_image_device::call_unload() -{ - tx0_state *state = machine().driver_data(); - - /* punch unit */ - state->m_tape_puncher.fd = NULL; -} - -TIMER_CALLBACK_MEMBER(tx0_state::puncher_callback) -{ - m_maincpu->set_state_int(TX0_IOS,1); -} - -/* - Initiate read of a 6-bit word from tape -*/ -WRITE_LINE_MEMBER( tx0_state::tx0_io_r1l ) -{ - begin_tape_read( 0); -} - -/* - Initiate read of a 18-bit word from tape (used in read-in mode) -*/ -WRITE_LINE_MEMBER( tx0_state::tx0_io_r3l ) -{ - begin_tape_read(1); -} - -/* - Write a 7-bit word to tape (7th bit clear) -*/ -WRITE_LINE_MEMBER( tx0_state::tx0_io_p6h ) -{ - int ac; - - /* read current AC */ - ac = m_maincpu->state_int(TX0_AC); - /* shuffle and punch 6-bit word */ - tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5)); - - m_tape_puncher.timer->adjust(attotime::from_usec(15800)); -} - -/* - Write a 7-bit word to tape (7th bit set) -*/ -WRITE_LINE_MEMBER( tx0_state::tx0_io_p7h ) -{ - int ac; - - /* read current AC */ - ac = m_maincpu->state_int(TX0_AC); - /* shuffle and punch 6-bit word */ - tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100); - - m_tape_puncher.timer->adjust(attotime::from_usec(15800)); -} - - -/* - Typewriter handling - - The alphanumeric on-line typewriter is a standard device on tx-0: it can - both handle keyboard input and print output text. -*/ - -/* - Open a file for typewriter output -*/ -bool tx0_printer_image_device::call_load() -{ - tx0_state *state = machine().driver_data(); - /* open file */ - state->m_typewriter.fd = this; - - return IMAGE_INIT_PASS; -} - -void tx0_printer_image_device::call_unload() -{ - tx0_state *state = machine().driver_data(); - state->m_typewriter.fd = NULL; -} - -/* - Write a character to typewriter -*/ -void tx0_state::typewriter_out(UINT8 data) -{ - tx0_typewriter_drawchar(data); - if (m_typewriter.fd) - m_typewriter.fd->fwrite(& data, 1); -} - -/* - timer callback to generate typewriter completion pulse -*/ -TIMER_CALLBACK_MEMBER(tx0_state::prt_callback) -{ - m_maincpu->io_complete(); -} - -/* - prt io callback -*/ -WRITE_LINE_MEMBER( tx0_state::tx0_io_prt ) -{ - int ac; - int ch; - - /* read current AC */ - ac = m_maincpu->state_int(TX0_AC); - /* shuffle and print 6-bit word */ - ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5); - typewriter_out(ch); - - m_typewriter.prt_timer->adjust(attotime::from_msec(100)); -} - - -/* - timer callback to generate crt completion pulse -*/ -TIMER_CALLBACK_MEMBER(tx0_state::dis_callback) -{ - m_maincpu->io_complete(); -} - -/* - Plot one point on crt -*/ -WRITE_LINE_MEMBER( tx0_state::tx0_io_dis ) -{ - int ac; - int x; - int y; - - ac = m_maincpu->state_int(TX0_AC); - x = ac >> 9; - y = ac & 0777; - tx0_plot(x, y); - - m_dis_timer->adjust(attotime::from_usec(50)); -} - - -/* - Magtape support - - Magtape format: - - 7-track tape, 6-bit data, 1-bit parity - - -*/ - -void tx0_state::schedule_select() -{ - attotime delay = attotime::zero; - - switch (m_magtape.command) - { - case 0: /* backspace */ - delay = attotime::from_usec(4600); - break; - case 1: /* read */ - delay = attotime::from_usec(8600); - break; - case 2: /* rewind */ - delay = attotime::from_usec(12000); - break; - case 3: /* write */ - delay = attotime::from_usec(4600); - break; - } - m_magtape.timer->adjust(delay); -} - -void tx0_state::schedule_unselect() -{ - attotime delay = attotime::zero; - - switch (m_magtape.command) - { - case 0: /* backspace */ - delay = attotime::from_usec(5750); - break; - case 1: /* read */ - delay = attotime::from_usec(1750); - break; - case 2: /* rewind */ - delay = attotime::from_usec(0); - break; - case 3: /* write */ - delay = attotime::from_usec(5750); - break; - } - m_magtape.timer->adjust(delay); -} - -void tx0_magtape_image_device::device_start() -{ - tx0_state *state = machine().driver_data(); - state->m_magtape.img = this; -} - -/* - Open a magnetic tape image -*/ -bool tx0_magtape_image_device::call_load() -{ - tx0_state *state = machine().driver_data(); - state->m_magtape.img = this; - - state->m_magtape.irg_pos = MTIRGP_END; - - /* restart IO when necessary */ - /* note that this function may be called before tx0_init_machine, therefore - before magtape.timer is allocated. We must not call timer_enable with a - NULL parameter! */ - if (state->m_magtape.timer) - { - if (state->m_magtape.state == MTS_SELECTING) - state->schedule_select(); - } - - return IMAGE_INIT_PASS; -} - -void tx0_magtape_image_device::call_unload() -{ - tx0_state *state = machine().driver_data(); - state->m_magtape.img = NULL; - - if (state->m_magtape.timer) - { - if (state->m_magtape.state == MTS_SELECTING) - /* I/O has not actually started, we can cancel the selection */ - state->m_tape_reader.timer->enable(0); - if ((state->m_magtape.state == MTS_SELECTED) || ((state->m_magtape.state == MTS_SELECTING) && (state->m_magtape.command == 2))) - { /* unit has become unavailable */ - state->m_magtape.state = MTS_UNSELECTING; - state->m_maincpu->set_state_int(TX0_PF, state->m_maincpu->state_int(TX0_PF) | PF_RWC); - state->schedule_unselect(); - } - } -} - -void tx0_state::magtape_callback() -{ - UINT8 buf = 0; - int lr; - - switch (m_magtape.state) - { - case MTS_UNSELECTING: - m_magtape.state = MTS_UNSELECTED; - - case MTS_UNSELECTED: - if (m_magtape.sel_pending) - { - int mar; - - mar = m_maincpu->state_int(TX0_MAR); - - if ((mar & 03) != 1) - { /* unimplemented device: remain in unselected state and set rwc - flag? */ - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_RWC); - } - else - { - m_magtape.state = MTS_SELECTING; - - m_magtape.command = (mar & 014 >> 2); - - m_magtape.binary_flag = (mar & 020 >> 4); - - if (m_magtape.img) - schedule_select(); - } - - m_magtape.sel_pending = FALSE; - m_maincpu->io_complete(); - } - break; - - case MTS_SELECTING: - m_magtape.state = MTS_SELECTED; - switch (m_magtape.command) - { - case 0: /* backspace */ - m_magtape.long_parity = 0177; - m_magtape.u.backspace_state = MTBSS_STATE0; - break; - case 1: /* read */ - m_magtape.long_parity = 0177; - m_magtape.u.read.state = MTRDS_STATE0; - break; - case 2: /* rewind */ - break; - case 3: /* write */ - m_magtape.long_parity = 0177; - m_magtape.u.write.state = MTWTS_STATE0; - switch (m_magtape.irg_pos) - { - case MTIRGP_START: - m_magtape.u.write.counter = 150; - break; - case MTIRGP_ENDMINUS1: - m_magtape.u.write.counter = 1; - break; - case MTIRGP_END: - m_magtape.u.write.counter = 0; - break; - } - break; - } - - case MTS_SELECTED: - switch (m_magtape.command) - { - case 0: /* backspace */ - if (m_magtape.img->ftell() == 0) - { /* tape at ldp */ - m_magtape.state = MTS_UNSELECTING; - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_RWC); - schedule_unselect(); - } - else if (m_magtape.img->fseek( -1, SEEK_CUR)) - { /* eject tape */ - m_magtape.img->unload(); - } - else if (m_magtape.img->fread(&buf, 1) != 1) - { /* eject tape */ - m_magtape.img->unload(); - } - else if (m_magtape.img->fseek( -1, SEEK_CUR)) - { /* eject tape */ - m_magtape.img->unload(); - } - else - { - buf &= 0x7f; /* 7-bit tape, ignore 8th bit */ - m_magtape.long_parity ^= buf; - switch (m_magtape.u.backspace_state) - { - case MTBSS_STATE0: - /* STATE0 -> initial interrecord gap, longitudinal parity; - if longitudinal parity was all 0s, gap between longitudinal - parity and data, first byte of data */ - if (buf != 0) - m_magtape.u.backspace_state = MTBSS_STATE1; - break; - case MTBSS_STATE1: - /* STATE1 -> first byte of gap between longitudinal parity and - data, second byte of data */ - if (buf == 0) - m_magtape.u.backspace_state = MTBSS_STATE2; - else - m_magtape.u.backspace_state = MTBSS_STATE5; - break; - case MTBSS_STATE2: - /* STATE2 -> second byte of gap between longitudinal parity and - data */ - if (buf == 0) - m_magtape.u.backspace_state = MTBSS_STATE3; - else - { - logerror("tape seems to be corrupt\n"); - /* eject tape */ - m_magtape.img->unload(); - } - break; - case MTBSS_STATE3: - /* STATE3 -> third byte of gap between longitudinal parity and - data */ - if (buf == 0) - m_magtape.u.backspace_state = MTBSS_STATE4; - else - { - logerror("tape seems to be corrupt\n"); - /* eject tape */ - m_magtape.img->unload(); - } - break; - case MTBSS_STATE4: - /* STATE4 -> first byte of data word, first byte of - interrecord gap after data */ - if (buf == 0) - { - if (m_magtape.long_parity) - logerror("invalid longitudinal parity\n"); - /* set EOR and unselect... */ - m_magtape.state = MTS_UNSELECTING; - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_EOR); - schedule_unselect(); - m_magtape.irg_pos = MTIRGP_ENDMINUS1; - } - else - m_magtape.u.backspace_state = MTBSS_STATE5; - break; - case MTBSS_STATE5: - /* STATE5 -> second byte of data word */ - if (buf == 0) - { - logerror("tape seems to be corrupt\n"); - /* eject tape */ - m_magtape.img->unload(); - } - else - m_magtape.u.backspace_state = MTBSS_STATE6; - break; - case MTBSS_STATE6: - /* STATE6 -> third byte of data word */ - if (buf == 0) - { - logerror("tape seems to be corrupt\n"); - /* eject tape */ - m_magtape.img->unload(); - } - else - m_magtape.u.backspace_state = MTBSS_STATE6; - break; - } - if (m_magtape.state != MTS_UNSELECTING) - m_magtape.timer->adjust(attotime::from_usec(66)); - } - break; - - case 1: /* read */ - if (m_magtape.img->fread(&buf, 1) != 1) - { /* I/O error or EOF? */ - /* The MAME fileio layer makes it very hard to make the - difference... MAME seems to assume that I/O errors never - happen, whereas it is really easy to cause one by - deconnecting an external drive the image is located on!!! */ - UINT64 offs; - offs = m_magtape.img->ftell(); - if (m_magtape.img->fseek( 0, SEEK_END) || (offs != m_magtape.img->ftell())) - { /* I/O error */ - /* eject tape */ - m_magtape.img->unload(); - } - else - { /* end of tape -> ??? */ - /* maybe we run past end of tape, so that tape is ejected from - upper reel and unit becomes unavailable??? */ - /*m_magtape.img->unload();*/ - /* Or do we stop at EOT mark??? */ - m_magtape.state = MTS_UNSELECTING; - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_EOT); - schedule_unselect(); - } - } - else - { - buf &= 0x7f; /* 7-bit tape, ignore 8th bit */ - m_magtape.long_parity ^= buf; - switch (m_magtape.u.read.state) - { - case MTRDS_STATE0: - /* STATE0 -> interrecord blank or first byte of data */ - if (buf != 0) - { - if (m_magtape.cpy_pending) - { /* read command */ - m_magtape.u.read.space_flag = FALSE; - m_maincpu->set_state_int(TX0_IOS,1); - m_maincpu->set_state_int(TX0_LR, ((m_maincpu->state_int(TX0_LR) >> 1) & 0333333) - | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); - /* check parity */ - if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ m_magtape.binary_flag)) - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); - } - else - { /* space command */ - m_magtape.u.read.space_flag = TRUE; - } - m_magtape.u.read.state = MTRDS_STATE1; - } - break; - case MTRDS_STATE1: - /* STATE1 -> second byte of data word */ - if (buf == 0) - { - logerror("tape seems to be corrupt\n"); - /* eject tape */ - m_magtape.img->unload(); - } - if (!m_magtape.u.read.space_flag) - { - m_maincpu->set_state_int(TX0_LR, ((m_maincpu->state_int(TX0_LR) >> 1) & 0333333) - | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); - /* check parity */ - if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ m_magtape.binary_flag)) - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); - } - m_magtape.u.read.state = MTRDS_STATE2; - break; - case MTRDS_STATE2: - /* STATE2 -> third byte of data word */ - if (buf == 0) - { - logerror("tape seems to be corrupt\n"); - /* eject tape */ - m_magtape.img->unload(); - } - if (!m_magtape.u.read.space_flag) - { - m_maincpu->set_state_int(TX0_LR, ((m_maincpu->state_int(TX0_LR) >> 1) & 0333333) - | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); - /* check parity */ - if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ m_magtape.binary_flag)) - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); - /* synchronize with cpy instruction */ - if (m_magtape.cpy_pending) - m_maincpu->set_state_int(TX0_IOS,1); - else - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_RWC); - } - m_magtape.u.read.state = MTRDS_STATE3; - break; - case MTRDS_STATE3: - /* STATE3 -> first byte of new word of data, or first byte - of gap between data and longitudinal parity */ - if (buf != 0) - { - m_magtape.u.read.state = MTRDS_STATE1; - if (!m_magtape.u.read.space_flag) - { - m_maincpu->set_state_int(TX0_LR, ((m_maincpu->state_int(TX0_LR) >> 1) & 0333333) - | ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2)); - /* check parity */ - if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ m_magtape.binary_flag)) - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); - } - } - else - m_magtape.u.read.state = MTRDS_STATE4; - break; - case MTRDS_STATE4: - /* STATE4 -> second byte of gap between data and - longitudinal parity */ - if (buf != 0) - { - logerror("tape seems to be corrupt\n"); - /* eject tape */ - m_magtape.img->unload(); - } - else - m_magtape.u.read.state = MTRDS_STATE5; - break; - - case MTRDS_STATE5: - /* STATE5 -> third byte of gap between data and - longitudinal parity */ - if (buf != 0) - { - logerror("tape seems to be corrupt\n"); - /* eject tape */ - m_magtape.img->unload(); - } - else - m_magtape.u.read.state = MTRDS_STATE6; - break; - - case MTRDS_STATE6: - /* STATE6 -> longitudinal parity */ - /* check parity */ - if (m_magtape.long_parity) - { - logerror("invalid longitudinal parity\n"); - /* no idea if the original tx-0 magtape controller - checks parity, but can't harm if we do */ - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_PC); - } - /* set EOR and unselect... */ - m_magtape.state = MTS_UNSELECTING; - m_maincpu->set_state_int(TX0_PF, m_maincpu->state_int(TX0_PF) | PF_EOR); - schedule_unselect(); - m_magtape.irg_pos = MTIRGP_START; - break; - } - if (m_magtape.state != MTS_UNSELECTING) - m_magtape.timer->adjust(attotime::from_usec(66)); - } - break; - - case 2: /* rewind */ - m_magtape.state = MTS_UNSELECTING; - /* we rewind at 10*read speed (I don't know the real value) */ - m_magtape.timer->adjust((attotime::from_nsec(6600) * m_magtape.img->ftell())); - //schedule_unselect(state); - m_magtape.img->fseek( 0, SEEK_END); - m_magtape.irg_pos = MTIRGP_END; - break; - - case 3: /* write */ - switch (m_magtape.u.write.state) - { - case MTWTS_STATE0: - if (m_magtape.u.write.counter != 0) - { - m_magtape.u.write.counter--; - buf = 0; - break; - } - else - { - m_magtape.u.write.state = MTWTS_STATE1; - } - - case MTWTS_STATE1: - if (m_magtape.u.write.counter) - { - m_magtape.u.write.counter--; - lr = m_maincpu->state_int(TX0_LR); - buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001); - buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!m_magtape.binary_flag) << 6)) & 0100; - m_maincpu->set_state_int(TX0_LR, lr >> 1); - } - else - { - if (m_magtape.cpy_pending) - { - m_maincpu->set_state_int(TX0_IOS,1); - lr = m_maincpu->state_int(TX0_LR); - buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001); - buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!m_magtape.binary_flag) << 6)) & 0100; - m_maincpu->set_state_int(TX0_LR, lr >> 1); - m_magtape.u.write.counter = 2; - break; - } - else - { - m_magtape.u.write.state = MTWTS_STATE2; - m_magtape.u.write.counter = 3; - } - } - - case MTWTS_STATE2: - if (m_magtape.u.write.counter != 0) - { - m_magtape.u.write.counter--; - buf = 0; - break; - } - else - { - buf = m_magtape.long_parity; - m_magtape.state = (state_t)MTWTS_STATE3; - m_magtape.u.write.counter = 150; - } - break; - - case MTWTS_STATE3: - if (m_magtape.u.write.counter != 0) - { - m_magtape.u.write.counter--; - buf = 0; - break; - } - else - { - m_magtape.state = MTS_UNSELECTING; - schedule_unselect(); - m_magtape.irg_pos = MTIRGP_END; - } - break; - } - if (m_magtape.state != MTS_UNSELECTING) - { /* write data word */ - m_magtape.long_parity ^= buf; - if (m_magtape.img->fwrite(&buf, 1) != 1) - { /* I/O error */ - /* eject tape */ - m_magtape.img->unload(); - } - else - m_magtape.timer->adjust(attotime::from_usec(66)); - } - break; - } - break; - } -} - -WRITE_LINE_MEMBER( tx0_state::tx0_sel ) -{ - m_magtape.sel_pending = TRUE; - - if (m_magtape.state == MTS_UNSELECTED) - { - if (0) - magtape_callback(); - m_magtape.timer->adjust(attotime::zero); - } -} - -WRITE_LINE_MEMBER( tx0_state::tx0_io_cpy ) -{ - switch (m_magtape.state) - { - case MTS_UNSELECTED: - case MTS_UNSELECTING: - /* ignore instruction and set rwc flag? */ - m_maincpu->io_complete(); - break; - - case MTS_SELECTING: - case MTS_SELECTED: - switch (m_magtape.command) - { - case 0: /* backspace */ - case 2: /* rewind */ - /* ignore instruction and set rwc flag? */ - m_maincpu->io_complete(); - break; - case 1: /* read */ - case 3: /* write */ - m_magtape.cpy_pending = TRUE; - break; - } - break; - } -} - - -/* - callback which is called when reset line is pulsed - - IO devices should reset -*/ -WRITE_LINE_MEMBER( tx0_state::tx0_io_reset_callback ) -{ - m_tape_reader.rcl = m_tape_reader.rc = 0; - if (m_tape_reader.timer) - m_tape_reader.timer->enable(0); - - if (m_tape_puncher.timer) - m_tape_puncher.timer->enable(0); - - if (m_typewriter.prt_timer) - m_typewriter.prt_timer->enable(0); - - if (m_dis_timer) - m_dis_timer->enable(0); -} - - -/* - typewriter keyboard handler -*/ -void tx0_state::tx0_keyboard() -{ - int i; - int j; - - int typewriter_keys[4]; - - int typewriter_transitions; - int charcode, lr; - - for (i=0; i<4; i++) - { - typewriter_keys[i] = m_twr[i]->read(); - } - - for (i=0; i<4; i++) - { - typewriter_transitions = typewriter_keys[i] & (~ m_old_typewriter_keys[i]); - if (typewriter_transitions) - { - for (j=0; (((typewriter_transitions >> j) & 1) == 0) /*&& (j<16)*/; j++) - ; - charcode = (i << 4) + j; - /* shuffle and insert data into LR */ - /* BTW, I am not sure how the char code is combined with the - previous LR */ - lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); - /* write modified LR */ - m_maincpu->set_state_int(TX0_LR, lr); - tx0_typewriter_drawchar(charcode); /* we want to echo input */ - break; - } - } - - for (i=0; i<4; i++) - m_old_typewriter_keys[i] = typewriter_keys[i]; -} - -/* - Not a real interrupt - just handle keyboard input -*/ -INTERRUPT_GEN_MEMBER(tx0_state::tx0_interrupt) -{ - int control_keys; - int tsr_keys; - - int control_transitions; - int tsr_transitions; - - - /* read new state of control keys */ - control_keys = m_csw->read(); - - if (control_keys & tx0_control) - { - /* compute transitions */ - control_transitions = control_keys & (~ m_old_control_keys); - - if (control_transitions & tx0_stop_cyc0) - { - m_maincpu->set_state_int(TX0_STOP_CYC0, !m_maincpu->state_int(TX0_STOP_CYC0)); - } - if (control_transitions & tx0_stop_cyc1) - { - m_maincpu->set_state_int(TX0_STOP_CYC1, !m_maincpu->state_int(TX0_STOP_CYC1)); - } - if (control_transitions & tx0_gbl_cm_sel) - { - m_maincpu->set_state_int(TX0_GBL_CM_SEL, !m_maincpu->state_int(TX0_GBL_CM_SEL)); - } - if (control_transitions & tx0_stop) - { - m_maincpu->set_state_int(TX0_RUN, (UINT64)0); - m_maincpu->set_state_int(TX0_RIM, (UINT64)0); - } - if (control_transitions & tx0_restart) - { - m_maincpu->set_state_int(TX0_RUN, 1); - m_maincpu->set_state_int(TX0_RIM, (UINT64)0); - } - if (control_transitions & tx0_read_in) - { /* set cpu to read instructions from perforated tape */ - m_maincpu->pulse_reset(); - m_maincpu->set_state_int(TX0_RUN, (UINT64)0); - m_maincpu->set_state_int(TX0_RIM, 1); - } - if (control_transitions & tx0_toggle_dn) - { - m_tsr_index++; - if (m_tsr_index == 18) - m_tsr_index = 0; - } - if (control_transitions & tx0_toggle_up) - { - m_tsr_index--; - if (m_tsr_index == -1) - m_tsr_index = 17; - } - if (control_transitions & tx0_cm_sel) - { - if (m_tsr_index >= 2) - { - UINT32 cm_sel = (UINT32) m_maincpu->state_int(TX0_CM_SEL); - m_maincpu->set_state_int(TX0_CM_SEL, cm_sel ^ (1 << (m_tsr_index - 2))); - } - } - if (control_transitions & tx0_lr_sel) - { - if (m_tsr_index >= 2) - { - UINT32 lr_sel = (UINT32) m_maincpu->state_int(TX0_LR_SEL); - m_maincpu->set_state_int(TX0_LR_SEL, (lr_sel ^ (1 << (m_tsr_index - 2)))); - } - } - - /* remember new state of control keys */ - m_old_control_keys = control_keys; - - - /* handle toggle switch register keys */ - tsr_keys = (ioport("MSW")->read() << 16) | ioport("LSW")->read(); - - /* compute transitions */ - tsr_transitions = tsr_keys & (~ m_old_tsr_keys); - - /* update toggle switch register */ - if (tsr_transitions) - m_maincpu->set_state_int(TX0_TBR+m_tsr_index, m_maincpu->state_int(TX0_TBR+m_tsr_index) ^ tsr_transitions); - - /* remember new state of toggle switch register keys */ - m_old_tsr_keys = tsr_keys; - } - else - { - m_old_control_keys = 0; - m_old_tsr_keys = 0; - - tx0_keyboard(); - } -} - -static MACHINE_CONFIG_START( tx0_64kw, tx0_state ) - /* basic machine hardware */ - /* TX0 CPU @ approx. 167 kHz (no master clock, but the memory cycle time is approximately 6usec) */ - MCFG_CPU_ADD("maincpu", TX0_64KW, 166667) - MCFG_TX0_CONFIG( - WRITELINE( tx0_state, tx0_io_cpy ), - WRITELINE( tx0_state, tx0_io_r1l ), - WRITELINE( tx0_state, tx0_io_dis ), - WRITELINE( tx0_state, tx0_io_r3l ), - WRITELINE( tx0_state, tx0_io_prt ), - NULL, - WRITELINE( tx0_state, tx0_io_p6h ), - WRITELINE( tx0_state, tx0_io_p7h ), - WRITELINE( tx0_state, tx0_sel ), - WRITELINE( tx0_state, tx0_io_reset_callback ) - ) - MCFG_CPU_PROGRAM_MAP(tx0_64kw_map) - /* dummy interrupt: handles input */ - MCFG_CPU_VBLANK_INT_DRIVER("screen", tx0_state, tx0_interrupt) - - /* video hardware (includes the control panel and typewriter output) */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(refresh_rate) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(virtual_width, virtual_height) - MCFG_SCREEN_VISIBLE_AREA(0, virtual_width-1, 0, virtual_height-1) - MCFG_SCREEN_UPDATE_DRIVER(tx0_state, screen_update_tx0) - MCFG_SCREEN_VBLANK_DRIVER(tx0_state, screen_eof_tx0) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEVICE_ADD("crt", CRT, 0) - MCFG_CRT_NUM_LEVELS(pen_crt_num_levels) - MCFG_CRT_OFFSETS(crt_window_offset_x, crt_window_offset_y) - MCFG_CRT_SIZE(crt_window_width, crt_window_height) - - MCFG_DEVICE_ADD("readt", TX0_READTAPE, 0) - MCFG_DEVICE_ADD("punch", TX0_PUNCHTAPE, 0) - MCFG_DEVICE_ADD("typewriter", TX0_PRINTER, 0) - MCFG_DEVICE_ADD("magtape", TX0_MAGTAPE, 0) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", tx0) - MCFG_PALETTE_ADD("palette", total_colors_needed + sizeof(tx0_palette)) - MCFG_PALETTE_INDIRECT_ENTRIES(total_colors_needed) - MCFG_PALETTE_INIT_OWNER(tx0_state, tx0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( tx0_8kw, tx0_64kw ) - - /* basic machine hardware */ - /* TX0 CPU @ approx. 167 kHz (no master clock, but the memory cycle time is - approximately 6usec) */ - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(tx0_8kw_map) - /*MCFG_CPU_PORTS(readport, writeport)*/ -MACHINE_CONFIG_END - -ROM_START(tx0_64kw) - /*CPU memory space*/ - ROM_REGION(0x10000 * sizeof(UINT32),"maincpu",ROMREGION_ERASEFF) - /* Note this computer has no ROM... */ - - ROM_REGION(tx0_fontdata_size, "gfx1", ROMREGION_ERASEFF) - /* space filled with our font */ -ROM_END - -ROM_START(tx0_8kw) - /*CPU memory space*/ - ROM_REGION(0x2000 * sizeof(UINT32),"maincpu",ROMREGION_ERASEFF) - /* Note this computer has no ROM... */ - - ROM_REGION(tx0_fontdata_size, "gfx1", ROMREGION_ERASEFF) - /* space filled with our font */ -ROM_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1956, tx0_64kw, 0, 0, tx0_64kw, tx0, tx0_state, tx0, "MIT", "TX-0 original demonstrator (64 kWords of RAM)" , MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING) -COMP( 1962, tx0_8kw, tx0_64kw, 0, tx0_8kw, tx0, tx0_state, tx0, "MIT", "TX-0 upgraded system (8 kWords of RAM)" , MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/uknc.c b/src/mess/drivers/uknc.c deleted file mode 100644 index 13b266ccb2b..00000000000 --- a/src/mess/drivers/uknc.c +++ /dev/null @@ -1,93 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - UKNC - - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/t11/t11.h" - - -class uknc_state : public driver_device -{ -public: - uknc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_uknc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(uknc_mem, AS_PROGRAM, 16, uknc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x7fff ) AM_RAM // RAM - AM_RANGE( 0x8000, 0xffff ) AM_ROM // ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(uknc_sub_mem, AS_PROGRAM, 16, uknc_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x7fff ) AM_RAM // RAM - AM_RANGE( 0x8000, 0xffff ) AM_ROM // ROM -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( uknc ) -INPUT_PORTS_END - - -void uknc_state::machine_reset() -{ -} - -void uknc_state::video_start() -{ -} - -UINT32 uknc_state::screen_update_uknc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( uknc, uknc_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", K1801VM2, 8000000) - MCFG_T11_INITIAL_MODE(0x8000) - MCFG_CPU_PROGRAM_MAP(uknc_mem) - - MCFG_CPU_ADD("subcpu", K1801VM2, 6000000) - MCFG_T11_INITIAL_MODE(0x8000) - MCFG_CPU_PROGRAM_MAP(uknc_sub_mem) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(uknc_state, screen_update_uknc) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( uknc ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "uknc.rom", 0x8000, 0x8000, CRC(a1536994) SHA1(b3c7c678c41ffa9b37f654fbf20fef7d19e6407b)) - - ROM_REGION( 0x10000, "subcpu", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, uknc, 0, 0, uknc, uknc, driver_device, 0, "", "UKNC", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/unior.c b/src/mess/drivers/unior.c deleted file mode 100644 index e3013d53955..00000000000 --- a/src/mess/drivers/unior.c +++ /dev/null @@ -1,463 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Unior - - 2009-05-12 Skeleton driver. - 2013-10-09 Added DMA and CRTC - 2013-10-11 Added PPI, PIT, UART, sound - - Some info obtained from EMU-80. - The schematic is difficult to read, and some code is guesswork. - -The monitor will only allow certain characters to be typed, thus the -modifier keys appear to do nothing. There is no need to use the enter -key; using spacebar and the correct parameters is enough. - -If you press Shift, indicators for numlock and capslock will appear. - -Monitor commands: -C -D - hex dump -E - save -F -G -H - set register -I - load -J - modify memory -K -L - list registers -M - -ToDo: -- Cassette -- Colour - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8251.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "machine/i8257.h" -#include "video/i8275.h" -#include "sound/speaker.h" - - -class unior_state : public driver_device -{ -public: - unior_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pit(*this, "pit"), - m_dma(*this, "dma"), - m_uart(*this, "uart"), - m_palette(*this, "palette") - { - } - - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_WRITE8_MEMBER(scroll_w); - DECLARE_WRITE_LINE_MEMBER(write_uart_clock); - DECLARE_READ8_MEMBER(ppi0_b_r); - DECLARE_WRITE8_MEMBER(ppi0_b_w); - DECLARE_READ8_MEMBER(ppi1_a_r); - DECLARE_READ8_MEMBER(ppi1_b_r); - DECLARE_READ8_MEMBER(ppi1_c_r); - DECLARE_WRITE8_MEMBER(ppi1_a_w); - DECLARE_WRITE8_MEMBER(ppi1_c_w); - DECLARE_WRITE_LINE_MEMBER(hrq_w); - DECLARE_PALETTE_INIT(unior); - DECLARE_READ8_MEMBER(dma_r); - I8275_DRAW_CHARACTER_MEMBER(display_pixels); - - UINT8 *m_p_vram; - UINT8 *m_p_chargen; -private: - UINT8 m_4c; - UINT8 m_4e; - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; - required_device m_pit; - required_device m_dma; - required_device m_uart; -public: - required_device m_palette; -}; - -static ADDRESS_MAP_START( unior_mem, AS_PROGRAM, 8, unior_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xffff) AM_ROM AM_WRITE(vram_w) // main video -ADDRESS_MAP_END - -static ADDRESS_MAP_START( unior_io, AS_IO, 8, unior_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x30, 0x38) AM_DEVREADWRITE("dma", i8257_device, read, write) // dma data - AM_RANGE(0x3c, 0x3f) AM_DEVREADWRITE("ppi0", i8255_device, read, write) // cassette player control - AM_RANGE(0x4c, 0x4f) AM_DEVREADWRITE("ppi1", i8255_device, read, write) - AM_RANGE(0x50, 0x50) AM_WRITE(scroll_w) - AM_RANGE(0x60, 0x61) AM_DEVREADWRITE("crtc", i8275_device, read, write) - AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE("pit", pit8253_device, read, write ) - AM_RANGE(0xec, 0xec) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w) - AM_RANGE(0xed, 0xed) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( unior ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // nothing - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // nothing - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) - - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) // cancel input - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) // Russian little M - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLK") PORT_CODE(KEYCODE_NUMLOCK) // switches 1st indicator between N and B - numlock? rctrl - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) - - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') // ; - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) // switches 2nd indicator between U and B - capslock? rshift - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) - - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) // A - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') // ^ (') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) - - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) // B - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) // H - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) // I - - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) // C - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) // G - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_HOME) PORT_CHAR(10) // line feed? - - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') // I then hangs - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) // Russian A - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) // ? (/) - - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) // D - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) // Russian bl - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) // Russian signpost - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) // } (<>) - - PORT_START("X8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) // E - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') // > - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= :") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') // : - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('=') // = - - PORT_START("X9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) // Russian U - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_START("XA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') // (`) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') // < - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') -INPUT_PORTS_END - - -/************************************************* - - Video - -*************************************************/ - -/* F4 Character Displayer */ -static const gfx_layout unior_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( unior ) - GFXDECODE_ENTRY( "chargen", 0x0000, unior_charlayout, 0, 1 ) -GFXDECODE_END - -WRITE8_MEMBER( unior_state::vram_w ) -{ - m_p_vram[offset] = data; -} - -// pulses a 1 to scroll -WRITE8_MEMBER( unior_state::scroll_w ) -{ - if (data) - memcpy(m_p_vram, m_p_vram+80, 24*80); -} - -I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 gfx = m_p_chargen[(linecount & 7) | (charcode << 3)]; - - if(linecount == 8) - gfx = 0; - - if (vsp) - gfx = 0; - - if (lten) - gfx = 0xff; - - if (rvv) - gfx ^= 0xff; - - for(UINT8 i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0]; -} - -static const rgb_t unior_palette[3] = -{ - rgb_t(0x00, 0x00, 0x00), // black - rgb_t(0xa0, 0xa0, 0xa0), // white - rgb_t(0xff, 0xff, 0xff) // highlight -}; - -PALETTE_INIT_MEMBER(unior_state,unior) -{ - palette.set_pen_colors(0, unior_palette, ARRAY_LENGTH(unior_palette)); -} - - -/************************************************* - - i8255 - -*************************************************/ - - -WRITE_LINE_MEMBER(unior_state::write_uart_clock) -{ - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - -READ8_MEMBER( unior_state::ppi0_b_r ) -{ - return 0; -} - -WRITE8_MEMBER( unior_state::ppi0_b_w ) -{ -} - -READ8_MEMBER( unior_state::ppi1_a_r ) -{ - return m_4c; -} - -READ8_MEMBER( unior_state::ppi1_b_r ) -{ - char kbdrow[6]; - sprintf(kbdrow,"X%X", m_4c&15); - return ioport(kbdrow)->read(); -} - -READ8_MEMBER( unior_state::ppi1_c_r ) -{ - return m_4e; -} - -WRITE8_MEMBER( unior_state::ppi1_a_w ) -{ - m_4c = data; -} - -/* -d0,1,2 = connect to what might be a 74LS138, then to an external slot -d4 = speaker gate -d5 = unknown -d6 = connect to A7 of the palette prom -d7 = not used -*/ -WRITE8_MEMBER( unior_state::ppi1_c_w ) -{ - m_4e = data; - m_pit->write_gate2(BIT(data, 4)); -} - -/************************************************* - - i8257 - -*************************************************/ - -READ8_MEMBER(unior_state::dma_r) -{ - if (offset < 0xf800) - return m_maincpu->space(AS_PROGRAM).read_byte(offset); - else - return m_p_vram[offset & 0x7ff]; -} - -WRITE_LINE_MEMBER( unior_state::hrq_w ) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state); - m_dma->hlda_w(state); -} - - -/************************************************* - - Machine - -*************************************************/ - -void unior_state::machine_reset() -{ - m_maincpu->set_state_int(I8085_PC, 0xF800); -} - -void unior_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); - m_p_vram = memregion("vram")->base(); -} - -static MACHINE_CONFIG_START( unior, unior_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_20MHz / 9) - MCFG_CPU_PROGRAM_MAP(unior_mem) - MCFG_CPU_IO_MAP(unior_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", unior) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(unior_state,unior) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD("uart", I8251, 0) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_20MHz / 12) - MCFG_PIT8253_CLK1(XTAL_20MHz / 9) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(unior_state, write_uart_clock)) - MCFG_PIT8253_CLK2(XTAL_16MHz / 9 / 64) // unknown frequency - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("speaker", speaker_sound_device, level_w)) - - MCFG_DEVICE_ADD("ppi0", I8255, 0) - // ports a & c connect to an external slot - MCFG_I8255_IN_PORTB_CB(READ8(unior_state, ppi0_b_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(unior_state, ppi0_b_w)) - - MCFG_DEVICE_ADD("ppi1", I8255, 0) - // ports a & b are for the keyboard - // port c operates various control lines for mostly unknown purposes - MCFG_I8255_IN_PORTA_CB(READ8(unior_state, ppi1_a_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(unior_state, ppi1_a_w)) - MCFG_I8255_IN_PORTB_CB(READ8(unior_state, ppi1_b_r)) - MCFG_I8255_IN_PORTC_CB(READ8(unior_state, ppi1_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(unior_state, ppi1_c_w)) - - MCFG_DEVICE_ADD("dma", I8257, XTAL_20MHz / 9) - MCFG_I8257_OUT_HRQ_CB(WRITELINE(unior_state, hrq_w)) - MCFG_I8257_IN_MEMR_CB(READ8(unior_state, dma_r)) - MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("crtc", i8275_device, dack_w)) - - MCFG_DEVICE_ADD("crtc", I8275, XTAL_20MHz / 12) - MCFG_I8275_CHARACTER_WIDTH(6) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(unior_state, display_pixels) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma",i8257_device, dreq2_w)) - MCFG_VIDEO_SET_SCREEN("screen") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( unior ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "unior.rom", 0xf800, 0x0800, CRC(23a347e8) SHA1(2ef3134e2f4a696c3b52a145fa5a2d4c3487194b)) - - ROM_REGION( 0x0840, "chargen", ROMREGION_ERASEFF ) - ROM_LOAD( "unior.fnt", 0x0000, 0x0800, CRC(4f654828) SHA1(8c0ac11ea9679a439587952e4908940b67c4105e)) - // according to schematic this should be 256 bytes - ROM_LOAD( "palette.rom", 0x0800, 0x0040, CRC(b4574ceb) SHA1(f7a82c61ab137de8f6a99b0c5acf3ac79291f26a)) - - ROM_REGION( 0x0800, "vram", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, unior, radio86, 0, unior, unior, driver_device, 0, "", "Unior", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/unistar.c b/src/mess/drivers/unistar.c deleted file mode 100644 index 6fe5817fe7c..00000000000 --- a/src/mess/drivers/unistar.c +++ /dev/null @@ -1,125 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Callan Unistar Terminal - - 2009-12-09 Skeleton driver. - - Chips used: i8275, AM9513, i8085, i8237, i8255, 2x 2651. XTAL 20MHz - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" - - -class unistar_state : public driver_device -{ -public: - unistar_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(unistar); - UINT32 screen_update_unistar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - const UINT8 *m_p_chargen; -private: - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(unistar_mem, AS_PROGRAM, 8, unistar_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x2fff) AM_ROM - AM_RANGE(0x8000, 0x8fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(unistar_io, AS_IO, 8, unistar_state) - //ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // ports used: 00,02,03(W),08(RW),09,0A,0B,0D,0F(W),80,81(R),82,83(W),84(R),8C,8D(W),94(R),97,98(W),99(RW) - // if nonzero returned from port 94, it goes into test mode. -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( unistar ) -INPUT_PORTS_END - - -void unistar_state::machine_reset() -{ - m_p_chargen = memregion("chargen")->base(); -} - -PALETTE_INIT_MEMBER( unistar_state, unistar ) -{ - palette.set_pen_color(0, 0, 0, 0 ); /* Black */ - palette.set_pen_color(1, 0, 255, 0 ); /* Full */ - palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */ -} - -void unistar_state::video_start() -{ -} - -UINT32 unistar_state::screen_update_unistar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout unistar_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( unistar ) - GFXDECODE_ENTRY( "chargen", 0x0000, unistar_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( unistar, unistar_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8085A, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(unistar_mem) - MCFG_CPU_IO_MAP(unistar_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(unistar_state, screen_update_unistar) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", unistar) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(unistar_state, unistar) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( unistar ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "280010c.u48", 0x0000, 0x1000, CRC(613ef521) SHA1(a77459e91617d2882778ab2dada74fcb5f44e949)) - ROM_LOAD( "280011c.u49", 0x1000, 0x1000, CRC(6cc5e704) SHA1(fb93645f51d5ad0635cbc8a9174c61f96799313d)) - ROM_LOAD( "280012c.u50", 0x2000, 0x1000, CRC(0b9ca5a5) SHA1(20bf4aeacda14ff7a3cf988c7c0bff6ec60406c7)) - - ROM_REGION( 0x0800, "chargen", ROMREGION_ERASEFF ) - ROM_LOAD( "280014a.u1", 0x0000, 0x0800, CRC(a9e1b5b2) SHA1(6f5b597ee1417f1108ac5957b005a927acb5314a)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, unistar, 0, 0, unistar, unistar, driver_device, 0, "Callan Data Systems", "Unistar 200 Terminal", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/univac.c b/src/mess/drivers/univac.c deleted file mode 100644 index d26216c3bc5..00000000000 --- a/src/mess/drivers/univac.c +++ /dev/null @@ -1,214 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Univac Terminals - - The terminals are models UTS20, UTS30, UTS40, UTS50 and SVT1120, - however only the UTS20 is dumped (program roms only). - - 25/05/2009 Skeleton driver - - The terminal has 2 screens selectable by the operator with the Fn + 1-2 - buttons. Thus the user can have two sessions open at once, to different - mainframes or applications. - - Sound is a beeper. - - This driver is all guesswork; Unisys never released technical info - to customers. All parts on the PCBs have internal Unisys part numbers - instead of the manufacturer's numbers. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/nvram.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" - - -class univac_state : public driver_device -{ -public: - univac_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_p_videoram(*this, "videoram") - , m_nvram(*this, "nvram") - , m_ctc(*this, "ctc") - , m_dart(*this, "dart") - { } - - DECLARE_READ8_MEMBER(vram_r); - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_WRITE8_MEMBER(port43_w); - INTERRUPT_GEN_MEMBER(vblank_irq); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -private: - const UINT8 *m_p_chargen; - bool m_screen_num; - UINT8 m_framecnt; - virtual void machine_start(); - virtual void machine_reset(); - required_device m_maincpu; - required_shared_ptr m_p_videoram; - required_device m_nvram; - required_device m_ctc; - required_device m_dart; -}; - - - -WRITE8_MEMBER( univac_state::port43_w ) -{ - m_screen_num = BIT(data, 0); -} - -READ8_MEMBER( univac_state::vram_r ) -{ - offs_t offs = (offset & 0x1fff) ^ (BIT(offset, 13) ? 0x2000 : 0) ^ (m_screen_num ? 0x2000 : 0); - return m_p_videoram[offs]; -} - -WRITE8_MEMBER( univac_state::vram_w ) -{ - offs_t offs = (offset & 0x1fff) ^ (BIT(offset, 13) ? 0x2000 : 0) ^ (m_screen_num ? 0x2000 : 0); - m_p_videoram[offs] = data; -} - - -static ADDRESS_MAP_START(uts20_mem, AS_PROGRAM, 8, univac_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x4fff ) AM_ROM AM_REGION("roms", 0) - AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(vram_r,vram_w) - AM_RANGE( 0xc000, 0xffff ) AM_RAM AM_SHARE("videoram") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( uts20_io, AS_IO, 8, univac_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("dart", z80dart_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("dart", z80dart_device, cd_ba_r, cd_ba_w) // ?? no idea - AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) - AM_RANGE(0x43, 0x43) AM_WRITE(port43_w) - AM_RANGE(0x80, 0xbf) AM_RAM AM_SHARE("nvram") -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( uts20 ) -INPUT_PORTS_END - - -void univac_state::machine_start() -{ -// D7DC and D7DD are checked for valid RID and SID (usually 21 and 51) if not valid then NVRAM gets initialised. -} - -void univac_state::machine_reset() -{ - m_screen_num = 0; - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 univac_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // this is used to get the ctc to pass the test - bool state = BIT(m_framecnt,0); - m_ctc->trg0(state); - m_ctc->trg1(state); - m_ctc->trg2(state); - m_ctc->trg3(state); - - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - UINT8 *videoram = m_p_videoram;//+(m_screen_num ? 0x2000 : 0); - - m_framecnt++; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 80; x++) - { - chr = videoram[x]; - - /* Take care of 'corner' characters */ - if (((chr == 0x1c) || (chr == 0x1d)) && (m_framecnt & 16)) - chr = 0x20; - - gfx = (ra ? m_p_chargen[((chr & 0x7f)<<4) | (ra-1) ] : 0) ^ (BIT(chr, 7) ? 0xff : 0); - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=80; - } - return 0; -} - -static const z80_daisy_config daisy_chain[] = -{ - { "dart" }, - { "ctc" }, - { NULL } -}; - -static MACHINE_CONFIG_START( uts20, univac_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) // unknown clock - MCFG_CPU_PROGRAM_MAP(uts20_mem) - MCFG_CPU_IO_MAP(uts20_io) - MCFG_CPU_CONFIG(daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(univac_state, screen_update) - MCFG_SCREEN_SIZE(640, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) - MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_NVRAM_ADD_1FILL("nvram") - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DART_ADD("dart", XTAL_4MHz, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( uts20 ) - ROM_REGION( 0x5000, "roms", ROMREGION_ERASEFF ) - ROM_LOAD( "uts20a.rom", 0x0000, 0x1000, CRC(1a7b4b4e) SHA1(c3732e25b4b7c7a80172e3fe55c77b923cf511eb) ) - ROM_LOAD( "uts20b.rom", 0x1000, 0x1000, CRC(7f8de87b) SHA1(a85f404ad9d560df831cc3e651a4b45e4ed30130) ) - ROM_LOAD( "uts20c.rom", 0x2000, 0x1000, CRC(4e334705) SHA1(ff1a730551b42f29d20af8ecc4495fd30567d35b) ) - ROM_LOAD( "uts20d.rom", 0x3000, 0x1000, CRC(76757cf7) SHA1(b0509d9a35366b21955f83ec3685163844c4dbf1) ) - ROM_LOAD( "uts20e.rom", 0x4000, 0x1000, CRC(0dfc8062) SHA1(cd681020bfb4829d4cebaf1b5bf618e67b55bda3) ) - ROM_FILL(0x2bd,1,0xaf) // test 2 - ROM_FILL(0x3c1,2,0xaf) // test 5 - ROM_FILL(0x928,1,0) - - /* character generator not dumped, using the one from 'c10' for now */ - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD("c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, uts20, 0, 0, uts20, uts20, driver_device, 0, "Sperry Univac", "UTS-20", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/unixpc.c b/src/mess/drivers/unixpc.c deleted file mode 100644 index 0372d6493d2..00000000000 --- a/src/mess/drivers/unixpc.c +++ /dev/null @@ -1,235 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - AT&T Unix PC series - - Skeleton driver - - Note: The 68k core needs restartable instruction support for this - to have a chance to run. - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "unixpc.lh" - - -/*************************************************************************** - DRIVER STATE -***************************************************************************/ - -class unixpc_state : public driver_device -{ -public: - unixpc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_wd2797(*this, "wd2797"), - m_floppy(*this, "wd2797:0:525dd"), - m_mapram(*this, "mapram"), - m_videoram(*this, "videoram"){ } - - required_device m_maincpu; - required_device m_ram; - required_device m_wd2797; - required_device m_floppy; - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - virtual void machine_reset(); - - DECLARE_READ16_MEMBER( line_printer_r ); - DECLARE_WRITE16_MEMBER( misc_control_w ); - DECLARE_WRITE16_MEMBER( disk_control_w ); - DECLARE_WRITE16_MEMBER( romlmap_w ); - - DECLARE_WRITE_LINE_MEMBER( wd2797_intrq_w ); - DECLARE_WRITE_LINE_MEMBER( wd2797_drq_w ); - - required_shared_ptr m_mapram; - required_shared_ptr m_videoram; -}; - - -/*************************************************************************** - MEMORY -***************************************************************************/ - -WRITE16_MEMBER( unixpc_state::romlmap_w ) -{ - if (BIT(data, 15)) - space.install_ram(0x000000, 0x3fffff, m_ram->pointer()); - else - space.install_rom(0x000000, 0x3fffff, memregion("bootrom")->base()); -} - -void unixpc_state::machine_reset() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - // force ROM into lower mem on reset - romlmap_w(program, 0, 0, 0xffff); - - // reset cpu so that it can pickup the new values - m_maincpu->reset(); -} - - -/*************************************************************************** - MISC -***************************************************************************/ - -READ16_MEMBER( unixpc_state::line_printer_r ) -{ - UINT16 data = 0; - - data |= 1; // no dial tone detected - data |= 1 << 1; // no parity error - data |= 0 << 2; // hdc intrq - data |= m_wd2797->intrq_r() << 3; - - logerror("line_printer_r: %04x\n", data); - - return data; -} - -WRITE16_MEMBER( unixpc_state::misc_control_w ) -{ - logerror("misc_control_w: %04x\n", data); - - output_set_value("led_0", !BIT(data, 8)); - output_set_value("led_1", !BIT(data, 9)); - output_set_value("led_2", !BIT(data, 10)); - output_set_value("led_3", !BIT(data, 11)); -} - - -/*************************************************************************** - FLOPPY -***************************************************************************/ - -WRITE16_MEMBER( unixpc_state::disk_control_w ) -{ - logerror("disk_control_w: %04x\n", data); - - m_floppy->mon_w(!BIT(data, 5)); - - // bit 6 = floppy selected / not selected - if (BIT(data, 6)) - m_wd2797->set_floppy(m_floppy); - else - m_wd2797->set_floppy(NULL); -} - -WRITE_LINE_MEMBER( unixpc_state::wd2797_intrq_w ) -{ - logerror("wd2797_intrq_w: %d\n", state); -} - -WRITE_LINE_MEMBER( unixpc_state::wd2797_drq_w ) -{ - logerror("wd2797_drq_w: %d\n", state); -} - - -/*************************************************************************** - VIDEO -***************************************************************************/ - -UINT32 unixpc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int y = 0; y < 348; y++) - for (int x = 0; x < 720/16; x++) - for (int b = 0; b < 16; b++) - bitmap.pix16(y, x * 16 + b) = BIT(m_videoram[y * (720/16) + x], b); - - return 0; -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( unixpc_mem, AS_PROGRAM, 16, unixpc_state ) - AM_RANGE(0x000000, 0x3fffff) AM_RAMBANK("bank1") - AM_RANGE(0x400000, 0x4007ff) AM_RAM AM_SHARE("mapram") - AM_RANGE(0x420000, 0x427fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x470000, 0x470001) AM_READ(line_printer_r) - AM_RANGE(0x4a0000, 0x4a0001) AM_WRITE(misc_control_w) - AM_RANGE(0x4e0000, 0x4e0001) AM_WRITE(disk_control_w) - AM_RANGE(0x800000, 0xbfffff) AM_MIRROR(0x7fc000) AM_ROM AM_REGION("bootrom", 0) - AM_RANGE(0xe10000, 0xe10007) AM_DEVREADWRITE8("wd2797", wd_fdc_t, read, write, 0x00ff) - AM_RANGE(0xe43000, 0xe43001) AM_WRITE(romlmap_w) -ADDRESS_MAP_END - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START( unixpc ) -INPUT_PORTS_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static SLOT_INTERFACE_START( unixpc_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( unixpc, unixpc_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", M68010, XTAL_10MHz) - MCFG_CPU_PROGRAM_MAP(unixpc_mem) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(unixpc_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_20MHz, 896, 0, 720, 367, 0, 348) - MCFG_SCREEN_PALETTE("palette") - // vsync should actually last 17264 pixels - - MCFG_DEFAULT_LAYOUT(layout_unixpc) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1M") - MCFG_RAM_EXTRA_OPTIONS("2M") - - // floppy - MCFG_DEVICE_ADD("wd2797", WD2797, 1000000) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(unixpc_state, wd2797_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(unixpc_state, wd2797_drq_w)) - MCFG_FLOPPY_DRIVE_ADD("wd2797:0", unixpc_floppies, "525dd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -// ROMs were provided by Michael Lee und imaged by Philip Pemberton -ROM_START( 3b1 ) - ROM_REGION16_BE(0x400000, "bootrom", 0) - ROM_LOAD16_BYTE("72-00617.15c", 0x000000, 0x002000, CRC(4e93ff40) SHA1(1a97c8d32ec862f7f5fa1032f1688b76ea0672cc)) - ROM_LOAD16_BYTE("72-00616.14c", 0x000001, 0x002000, CRC(c61f7ae0) SHA1(ab3ac29935a2a587a083c4d175a5376badd39058)) -ROM_END - - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1985, 3b1, 0, 0, unixpc, unixpc, driver_device, 0, "AT&T", "3B1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/ut88.c b/src/mess/drivers/ut88.c deleted file mode 100644 index 029f929febe..00000000000 --- a/src/mess/drivers/ut88.c +++ /dev/null @@ -1,264 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - UT88 driver by Miodrag Milanovic - - 09/03/2008 Keyboard fixed, sound added. - 06/03/2008 Preliminary driver. - -UT88MINI -******** -Need instructions... -When started you enter a one-key command, followed by whatever parameters -are needed. - -Pressing 1 will allow entry of bytes into RAM, however the system doesn't -allow you to view memory (afaik). - -Command 3 does a test of the display, however the rest are a mystery. - -Paste facility was tested but doesn't work, so all code remnants removed. - -****************************************************************************/ - -#include "includes/ut88.h" -#include "formats/rk_cas.h" -#include "ut88mini.lh" - -static GFXDECODE_START( ut88 ) - GFXDECODE_ENTRY( "chargen", 0x0000, ut88_charlayout, 0, 1 ) -GFXDECODE_END - -/* Address maps */ -static ADDRESS_MAP_START( ut88mini_mem, AS_PROGRAM, 8, ut88_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x03ff ) AM_ROM // System ROM - AM_RANGE( 0xc000, 0xc3ff ) AM_RAM // RAM - AM_RANGE( 0x9000, 0x9fff ) AM_WRITE(ut88mini_write_led) // 7seg LED -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ut88_mem, AS_PROGRAM, 8, ut88_state ) - AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK("bank1") // First bank - AM_RANGE( 0x0800, 0xdfff ) AM_RAM // RAM - AM_RANGE( 0xe000, 0xe7ff ) AM_RAM // Video RAM (not used) - AM_RANGE( 0xe800, 0xefff ) AM_RAM AM_SHARE("p_videoram") // Video RAM - AM_RANGE( 0xf400, 0xf7ff ) AM_RAM // System RAM - AM_RANGE( 0xf800, 0xffff ) AM_ROM // System ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ut88mini_io, AS_IO, 8, ut88_state ) - AM_RANGE( 0xA0, 0xA0) AM_READ(ut88mini_keyboard_r) - AM_RANGE( 0xA1, 0xA1) AM_READ(ut88_tape_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ut88_io, AS_IO, 8, ut88_state ) - AM_RANGE( 0x04, 0x07) AM_READWRITE(ut88_keyboard_r, ut88_keyboard_w) - AM_RANGE( 0xA1, 0xA1) AM_READWRITE(ut88_tape_r, ut88_sound_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( ut88 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - -static INPUT_PORTS_START( ut88mini ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_7) - - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_B) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_C) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_D) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_E) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_F) - - PORT_START("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) -INPUT_PORTS_END - -/* Machine driver */ -static MACHINE_CONFIG_START( ut88, ut88_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(ut88_mem) - MCFG_CPU_IO_MAP(ut88_io) - MCFG_MACHINE_RESET_OVERRIDE(ut88_state, ut88 ) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(64*8, 28*8) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 28*8-1) - MCFG_VIDEO_START_OVERRIDE(ut88_state,ut88) - MCFG_SCREEN_UPDATE_DRIVER(ut88_state, screen_update_ut88) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", ut88 ) - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* Devices */ - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(ut88_state, ut88_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(ut88_state, ut88_8255_portb_r)) - MCFG_I8255_IN_PORTC_CB(READ8(ut88_state, ut88_8255_portc_r)) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rku_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("ut88_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","ut88") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( ut88mini, ut88_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 2000000) - MCFG_CPU_PROGRAM_MAP(ut88mini_mem) - MCFG_CPU_IO_MAP(ut88mini_io) - MCFG_MACHINE_START_OVERRIDE(ut88_state,ut88mini) - MCFG_MACHINE_RESET_OVERRIDE(ut88_state, ut88mini ) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_ut88mini) - - /* Cassette */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(rku_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED) - MCFG_CASSETTE_INTERFACE("ut88_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","ut88") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( ut88 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ut88.rom", 0xf800, 0x0800, CRC(f433202e) SHA1(a5808a4f68fb10eb7f17f2a05c3b8479fec0e05d) ) - ROM_REGION(0x0800, "chargen",0) - ROM_LOAD ("ut88.fnt", 0x0000, 0x0800, CRC(874b4d29) SHA1(357efbb295cd9e47fa97d4d03f4f1859a915b5c3) ) -ROM_END - -ROM_START( ut88mini ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ut88mini.rom", 0x0000, 0x0400, CRC(ce9213ee) SHA1(16b71b3051a800386d664dbcc5983b783475d0c6) ) - ROM_REGION( 0x200, "proms", 0 ) - ROM_LOAD( "ut88key1.rom", 0x0000, 0x0100, CRC(ecfe42c7) SHA1(d7f10bbb05934150c1a258db1c8b4eb65771af59) ) - ROM_LOAD( "ut88key2.rom", 0x0100, 0x0100, CRC(96324d23) SHA1(9dca3f639fc29d87df56505b3dde668ef2849da3) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, ut88mini, 0, 0, ut88mini, ut88mini, ut88_state, ut88mini, "", "UT-88 mini", 0) -COMP( 1989, ut88, ut88mini, 0, ut88, ut88, ut88_state, ut88, "", "UT-88", 0) diff --git a/src/mess/drivers/uzebox.c b/src/mess/drivers/uzebox.c deleted file mode 100644 index 383e674be50..00000000000 --- a/src/mess/drivers/uzebox.c +++ /dev/null @@ -1,310 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Belogic Uzebox - - driver by Sandro Ronco - - TODO: - - Sound - - SDCard - -****************************************************************************/ - -#include "emu.h" -#include "cpu/avr8/avr8.h" -#include "sound/speaker.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "bus/snes_ctrl/ctrl.h" - -// overclocked to 8 * NTSC burst frequency -#define MASTER_CLOCK 28618180 - -#define INTERLACED 0 - -class uzebox_state : public driver_device -{ -public: - uzebox_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_ctrl1(*this, "ctrl1"), - m_ctrl2(*this, "ctrl2"), - m_speaker(*this, "speaker") - { } - - required_device m_maincpu; - required_device m_cart; - required_device m_ctrl1; - required_device m_ctrl2; - required_device m_speaker; - - DECLARE_READ8_MEMBER(port_a_r); - DECLARE_WRITE8_MEMBER(port_a_w); - DECLARE_READ8_MEMBER(port_b_r); - DECLARE_WRITE8_MEMBER(port_b_w); - DECLARE_READ8_MEMBER(port_c_r); - DECLARE_WRITE8_MEMBER(port_c_w); - DECLARE_READ8_MEMBER(port_d_r); - DECLARE_WRITE8_MEMBER(port_d_w); - - virtual void machine_start(); - virtual void machine_reset(); - void line_update(); - UINT32 screen_update_uzebox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(uzebox_cart); - -private: - int m_vpos; - UINT64 m_line_start_cycles; - UINT32 m_line_pos_cycles; - UINT8 m_port_a; - UINT8 m_port_b; - UINT8 m_port_c; - UINT8 m_port_d; - bitmap_rgb32 m_bitmap; -}; - -void uzebox_state::machine_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0xffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -void uzebox_state::machine_reset() -{ - m_vpos = 0; - m_line_start_cycles = 0; - m_line_pos_cycles = 0; - m_port_a = 0; - m_port_b = 0; - m_port_c = 0; - m_port_d = 0; -} - - -WRITE8_MEMBER(uzebox_state::port_a_w) -{ - // xxxx ---- NC - // ---- x--- SNES controller clk - // ---- -x-- SNES controller latch - // ---- --x- SNES controller P2 data - // ---- ---x SNES controller P1 data - - m_ctrl1->write_strobe(BIT(data, 2)); - m_ctrl2->write_strobe(BIT(data, 2)); - - UINT8 changed = m_port_a ^ data; - if ((changed & data & 0x08) || (changed & (~data) & 0x04)) - { - m_port_a &= ~0x03; - m_port_a |= m_ctrl1->read_pin4() ? 0 : 0x01; - m_port_a |= m_ctrl2->read_pin4() ? 0 : 0x02; - } - - m_port_a = (data & 0x0c) | (m_port_a & 0x03); -} - -READ8_MEMBER(uzebox_state::port_a_r) -{ - return m_port_a | 0xf0; -} - -WRITE8_MEMBER(uzebox_state::port_b_w) -{ - // xxx- ---- SDCard - // ---x ---- AD725 CE - // ---- x--- AD725 4FSC - // ---- -xx- NC - // ---- ---x AD725 HSYNC - - // AD725 CE is hard-wired to VCC in early revisions (C1, D1 and E1) - if ((m_port_b & 0x10) || ioport("AD725_CE")->read() == 0) - if ((m_port_b ^ data) & m_port_b & 0x01) - { - line_update(); - - UINT32 cycles = (UINT32)(m_maincpu->get_elapsed_cycles() - m_line_start_cycles); - if (cycles < 1000 && m_vpos >= 448) - m_vpos = INTERLACED ? ((m_vpos ^ 0x01) & 0x01) : 0; - else if (cycles > 1000) - m_vpos += 2; - - m_line_start_cycles = m_maincpu->get_elapsed_cycles(); - m_line_pos_cycles = 0; - } - - m_port_b = data; -} - -READ8_MEMBER(uzebox_state::port_b_r) -{ - return m_port_b; -} - -WRITE8_MEMBER(uzebox_state::port_c_w) -{ - // xx-- ---- blue - // --xx x--- green - // ---- -xxx red - - line_update(); - m_port_c = data; -} - -READ8_MEMBER(uzebox_state::port_c_r) -{ - return m_port_c; -} - -WRITE8_MEMBER(uzebox_state::port_d_w) -{ - // x--- ---- sound - // -x-- ---- SDCard CS - // ---x ---- LED - // --x- x--- NC - // ---- -x-- power - // ---- --xx UART MIDI - if ((m_port_d ^ data) & 0x80) - { - m_speaker->level_w(data & 0x80); - } - m_port_d = data; -} - -READ8_MEMBER(uzebox_state::port_d_r) -{ - return m_port_d; -} - - -/****************************************************\ -* Address maps * -\****************************************************/ - -static ADDRESS_MAP_START( uzebox_prg_map, AS_PROGRAM, 8, uzebox_state ) - AM_RANGE(0x0000, 0xffff) AM_ROM // 64 KB internal eprom ATmega644 -ADDRESS_MAP_END - -static ADDRESS_MAP_START( uzebox_data_map, AS_DATA, 8, uzebox_state ) - AM_RANGE(0x0100, 0x10ff) AM_RAM // 4KB RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( uzebox_io_map, AS_IO, 8, uzebox_state ) - AM_RANGE(AVR8_REG_A, AVR8_REG_A) AM_READWRITE( port_a_r, port_a_w ) - AM_RANGE(AVR8_REG_B, AVR8_REG_B) AM_READWRITE( port_b_r, port_b_w ) - AM_RANGE(AVR8_REG_C, AVR8_REG_C) AM_READWRITE( port_c_r, port_c_w ) - AM_RANGE(AVR8_REG_D, AVR8_REG_D) AM_READWRITE( port_d_r, port_d_w ) -ADDRESS_MAP_END - -/****************************************************\ -* Input ports * -\****************************************************/ - -static INPUT_PORTS_START( uzebox ) - PORT_START("AD725_CE") - PORT_CONFNAME( 0x01, 0x00, "AD725 CE" ) - PORT_CONFSETTING( 0x00, "VCC" ) - PORT_CONFSETTING( 0x01, "PB4" ) -INPUT_PORTS_END - -/****************************************************\ -* Video hardware * -\****************************************************/ - -void uzebox_state::line_update() -{ - UINT32 cycles = (UINT32)(m_maincpu->get_elapsed_cycles() - m_line_start_cycles) / 2; - rgb_t color = rgb_t(pal3bit(m_port_c >> 0), pal3bit(m_port_c >> 3), pal2bit(m_port_c >> 6)); - - for (UINT32 x = m_line_pos_cycles; x < cycles; x++) - { - if (m_bitmap.cliprect().contains(x, m_vpos)) - m_bitmap.pix32(m_vpos, x) = color; - if (!INTERLACED) - if (m_bitmap.cliprect().contains(x, m_vpos + 1)) - m_bitmap.pix32(m_vpos + 1, x) = color; - } - - m_line_pos_cycles = cycles; -} - -UINT32 uzebox_state::screen_update_uzebox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - -DEVICE_IMAGE_LOAD_MEMBER(uzebox_state, uzebox_cart) -{ - UINT32 size = m_cart->common_get_size("rom"); - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - - if (image.software_entry() == NULL) - { - dynamic_buffer data(size); - image.fread(&data[0], size); - - if (!strncmp((const char*)&data[0], "UZEBOX", 6)) - memcpy(m_cart->get_rom_base(), &data[0x200], size - 0x200); - else - memcpy(m_cart->get_rom_base(), &data[0], size); - } - else - memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size); - - return IMAGE_INIT_PASS; -} - - -/****************************************************\ -* Machine definition * -\****************************************************/ - -static MACHINE_CONFIG_START( uzebox, uzebox_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", ATMEGA644, MASTER_CLOCK) - MCFG_CPU_PROGRAM_MAP(uzebox_prg_map) - MCFG_CPU_DATA_MAP(uzebox_data_map) - MCFG_CPU_IO_MAP(uzebox_io_map) - MCFG_CPU_AVR8_EEPROM("eeprom") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.99) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1395)) - MCFG_SCREEN_SIZE(870, 525) - MCFG_SCREEN_VISIBLE_AREA(150, 870-1, 40, 488-1) - MCFG_SCREEN_UPDATE_DRIVER(uzebox_state, screen_update_uzebox) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(0, "mono", 1.00) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "uzebox") - MCFG_GENERIC_EXTENSIONS("bin,uze") - MCFG_GENERIC_MANDATORY - MCFG_GENERIC_LOAD(uzebox_state, uzebox_cart) - - MCFG_SNES_CONTROL_PORT_ADD("ctrl1", snes_control_port_devices, "joypad") - MCFG_SNES_CONTROL_PORT_ADD("ctrl2", snes_control_port_devices, "joypad") - - MCFG_SOFTWARE_LIST_ADD("eprom_list","uzebox") -MACHINE_CONFIG_END - -ROM_START( uzebox ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) /* Main program store */ - - ROM_REGION( 0x800, "eeprom", ROMREGION_ERASE00 ) /* on-die eeprom */ -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS(2010, uzebox, 0, 0, uzebox, uzebox, driver_device, 0, "Belogic", "Uzebox", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/v1050.c b/src/mess/drivers/v1050.c deleted file mode 100644 index 8461bb815fc..00000000000 --- a/src/mess/drivers/v1050.c +++ /dev/null @@ -1,1148 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Visual 1050 - -PCB Layout ----------- - -REV B-1 - -|---------------------------------------------------------------------------------------------------| -| |----------| | -| 9216 | ROM0 | LS74 | -| |----------| | --- LS00 7406 LS255 LS393 4164 4164 | -|| |-----------| |----------| | -|| | WD1793 | LS14 7407 - LS393 LS74 | 8251A | 4164 4164 | -|| |-----------| | |----------| | -|C | 4164 4164 | -|N 7406 LS00 LS74 LS14 |C LS20 LS08 LS75 | -|1 |N 4164 4164 | -|| |5 | -|| 7406 LS195 LS244 | LS04 LS32 LS08 4164 4164 | -|| - | -|| |------------| |--------| 4164 4164 | --- BAT | 8255A | | 8214 | LS139 LS32 LS138 LS17 | --- |------------| |--------| - 4164 4164 | -|| |C | -|| |--------| LS00 LS00 |N LS00 LS32 LS138 4164 4164 | -|C | 8251A | |6 | -|N |--------| |------------| - |------------| | -|2 | 8255A | | Z80A | | -|| 1488 1489 RTC |------------| LS00 LS32 |------------| LS257 LS257 | -|| | --- |------------| |------------| | -| LS04 | 8255A | | 8255A | | -| |------------| |------------| | -| | -| 7404 LS257 LS257 | -| 16MHz | -| LS04 LS74 LS257 9016 9016 | -| | --- LS74 LS04 LS74 LS163 9016 9016 | -|| | -|| 9016 9016 | -|| LS02 LS163 LS74 7404 7404 | -|| 9016 9016 | -|| | -|C LS244 LS10 LS257 LS362 |----------| 9016 9016 | -|N | ROM1 | | -|3 LS245 7404 LS273 LS32 |----------| 9016 9016 | -|| | -|| 7407 LS174 LS32 9016 9016 | -|| 15.36MHz | -|| |------------| 9016 9016 | --- LS09 LS04 LS12 | 6502 | | -| |------------| 9016 9016 | --- | -|C LS175 LS86 LS164 LS164 9016 9016 | -|N |------------| | -|4 | 6845 | LS253 LS253 | --- 7426 LS02 LS74 LS00 LS164 |------------| | -| LS253 LS253 | -| REV B-1 W/O 1059 S/N 492 | -|---------------------------------------------------------------------------------------------------| - -Notes: - All IC's shown. - - ROM0 - "IC 244-032 V1.0" - ROM1 - "IC 244-033 V1.0" - Z80A - Zilog Z8400APS Z80A CPU - 6502 - Synertek SY6502A CPU - 4164 - NEC D4164-2 64Kx1 Dynamic RAM - 9016 - AMD AM9016EPC 16Kx1 Dynamic RAM - 8214 - NEC uPB8214C Priority Interrupt Control Unit - 8255A - NEC D8255AC-5 Programmable Peripheral Interface - 8251A - NEC D8251AC Programmable Communication Interface - WD1793 - Mitsubishi MB8877 Floppy Disc Controller - 9216 - SMC FDC9216 Floppy Disk Data Separator - 1488 - Motorola MC1488 Quad Line EIA-232D Driver - 1489 - Motorola MC1489 Quad Line Receivers - 6845 - Hitachi HD46505SP CRT Controller - RTC - OKI MSM58321RS Real Time Clock - BAT - 3.4V battery - CN1 - parallel connector - CN2 - serial connector - CN3 - winchester connector - CN4 - monitor connector - CN5 - floppy data connector - CN6 - floppy power connector - -*/ - -/* - - Using the hard disk - ------------------- - - Use the chdman utility to create a Tandon TM501 (5MB) or CMI CM-5412 (10MB) hard disk image: - - $ chdman createhd -chs 306,2,32 -ss 256 -o tm501.chd - $ chdman createhd -chs 306,4,32 -ss 256 -o cm5412.chd - - Start the Visual 1050 emulator with the floppy and hard disk images mounted: - - $ mess v1050 -flop1 cpm3:flop2 -hard tm501.chd - $ mess v1050 -flop1 cpm3:flop2 -hard cm5412.chd - - Start the Winchester Format Program from the CP/M prompt: - - A>fmtwinch - - Enter Y to continue. - Enter A for 5MB, or B for 10MB hard disk. - Enter C to start formatting. - - Once the formatting is complete, the CP/M system files need to be copied over to the hard disk: - - A>copysys - - Enter source drive name "a" and press RETURN. - Enter target drive name "c" and press RETURN. - Enter "y" at the prompt for CPM3.SYS. - Enter "y" at the prompt for CCP.COM. - Press RETURN to return to CP/M. - - You can now boot from the hard disk with: - - $ mess v1050 -hard tm501.chd - $ mess v1050 -hard cm5412.chd - - Or skip all of the above and use the preformatted images in the software list: - - $ mess v1050 -hard cpm3hd5 - $ mess v1050 -hard cpm3hd10 - -*/ - -/* - - TODO: - - - floppy 1 is broken - - write to banked RAM at 0x0000-0x1fff when ROM is active - - real keyboard w/i8049 - - keyboard beeper (NE555 wired in strange mix of astable/monostable modes) - -*/ - -#include "includes/v1050.h" -#include "bus/rs232/rs232.h" - -void v1050_state::set_interrupt(UINT8 mask, int state) -{ - if (state) - { - m_int_state |= mask; - } - else - { - m_int_state &= ~mask; - } - - m_pic->r_w(~(m_int_state & m_int_mask)); -} - -void v1050_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - int bank = (m_bank >> 1) & 0x03; - - if (BIT(m_bank, 0)) - { - program.install_readwrite_bank(0x0000, 0x1fff, "bank1"); - membank("bank1")->set_entry(bank); - } - else - { - program.install_read_bank(0x0000, 0x1fff, "bank1"); - program.unmap_write(0x0000, 0x1fff); - membank("bank1")->set_entry(3); - } - - membank("bank2")->set_entry(bank); - - if (bank == 2) - { - program.unmap_readwrite(0x4000, 0xbfff); - } - else - { - program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); - program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - membank("bank3")->set_entry(bank); - membank("bank4")->set_entry(bank); - } - - membank("bank5")->set_entry(bank); -} - -// Keyboard HACK - -static const UINT8 V1050_KEYCODES[4][12][8] = -{ - { // unshifted - { 0xc0, 0xd4, 0xd8, 0xdc, 0xe0, 0xe4, 0xe8, 0xec }, - { 0xf0, 0xfc, 0x90, 0xf4, 0xf8, 0x94, 0xc4, 0xc8 }, - { 0xcc, 0xd0, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35 }, - { 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x60 }, - { 0x08, 0x88, 0x8c, 0x71, 0x77, 0x65, 0x72, 0x74 }, - { 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d }, - { 0x7f, 0x00, 0x80, 0x61, 0x73, 0x64, 0x66, 0x67 }, - { 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27, 0x5c, 0x84 }, - { 0x00, 0x7a, 0x78, 0x63, 0x76, 0x62, 0x6e, 0x6d }, - { 0x2c, 0x2e, 0x2f, 0x00, 0x0a, 0x20, 0x81, 0x82 }, - { 0xb7, 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac }, - { 0xb1, 0xb2, 0xb3, 0x83, 0xb0, 0xae, 0x00, 0x00 }, - }, - - { // shifted - { 0xc1, 0xd5, 0xd9, 0xdd, 0xe1, 0xe5, 0xe9, 0xed }, - { 0xf1, 0xfd, 0x91, 0xf5, 0xf9, 0x95, 0xc5, 0xc9 }, - { 0xcd, 0xd1, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25 }, - { 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x7e }, - { 0x08, 0x89, 0x8d, 0x51, 0x57, 0x45, 0x52, 0x54 }, - { 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d, 0x0d }, - { 0x7f, 0x00, 0x80, 0x41, 0x53, 0x44, 0x46, 0x47 }, - { 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22, 0x7c, 0x85 }, - { 0x00, 0x5a, 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d }, - { 0x3c, 0x3e, 0x3f, 0x0a, 0x20, 0x81, 0x82, 0xb7 }, - { 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac, 0xb1 }, - { 0xb2, 0xb3, 0x83, 0xb0, 0xa0, 0x00, 0x00, 0x00 }, - }, - - { // control - { 0xc2, 0xd6, 0xda, 0xde, 0xe2, 0xe6, 0xea, 0xee }, - { 0xf2, 0xfe, 0x92, 0xf6, 0xfa, 0x96, 0xc6, 0xca }, - { 0xce, 0xd2, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35 }, - { 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x00 }, - { 0x08, 0x8a, 0x8e, 0x11, 0x17, 0x05, 0x12, 0x14 }, - { 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d, 0x0d }, - { 0x7f, 0x00, 0x80, 0x01, 0x13, 0x04, 0x06, 0x07 }, - { 0x08, 0x0a, 0x0b, 0x0c, 0x3b, 0x27, 0x1c, 0x86 }, - { 0x00, 0x1a, 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d }, - { 0x2c, 0x2e, 0x2f, 0x0a, 0x20, 0x81, 0x82, 0xb7 }, - { 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac, 0xb1 }, - { 0xb2, 0xb3, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 }, - }, - - { // shift & control - { 0xc3, 0xd7, 0xdb, 0xdf, 0xe3, 0xe7, 0xeb, 0xef }, - { 0xf3, 0xff, 0x93, 0xf7, 0xfb, 0x97, 0xc7, 0xcb }, - { 0xcf, 0xd3, 0x1b, 0x21, 0x00, 0x23, 0x24, 0x25 }, - { 0x1e, 0x26, 0x2a, 0x28, 0x29, 0x1f, 0x2b, 0x1e }, - { 0x08, 0x8b, 0x8f, 0x11, 0x17, 0x05, 0x12, 0x14 }, - { 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d, 0x0d }, - { 0x7f, 0x00, 0x80, 0x01, 0x13, 0x04, 0x06, 0x07 }, - { 0x08, 0x0a, 0x0b, 0x0c, 0x3a, 0x22, 0x1c, 0x87 }, - { 0x00, 0x1a, 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d }, - { 0x3c, 0x3e, 0x3f, 0x0a, 0x20, 0x81, 0x82, 0xb7 }, - { 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac, 0xb1 }, - { 0xb2, 0xb3, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 }, - } -}; - -void v1050_state::scan_keyboard() -{ - static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9", "ROW10", "ROW11" }; - int table = 0, row, col; - int keydata = 0xff; - - UINT8 line_mod = ioport("ROW12")->read(); - - if((line_mod & 0x07) && (line_mod & 0x18)) - { - table = 3; // shift & control - } - else if (line_mod & 0x07) - { - table = 1; // shifted - } - else if (line_mod & 0x18) - { - table = 2; // ctrl - } - - // scan keyboard - for (row = 0; row < 12; row++) - { - UINT8 data = ioport(keynames[row])->read(); - - for (col = 0; col < 8; col++) - { - if (!BIT(data, col)) - { - // latch key data - keydata = V1050_KEYCODES[table][row][col]; - - if (m_keydata != keydata) - { - m_keydata = keydata; - m_keyavail = 1; - - set_interrupt(INT_KEYBOARD, 1); - return; - } - } - } - } - - m_keydata = keydata; -} - -TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::v1050_keyboard_tick) -{ - scan_keyboard(); -} - -READ8_MEMBER( v1050_state::kb_data_r ) -{ - m_keyavail = 0; - - set_interrupt(INT_KEYBOARD, 0); - - return m_keydata; -} - -READ8_MEMBER( v1050_state::kb_status_r ) -{ - UINT8 val = m_uart_kb->status_r(space, 0); - - return val | (m_keyavail ? 0x02 : 0x00); -} - -// Z80 Read/Write Handlers - -WRITE8_MEMBER( v1050_state::v1050_i8214_w ) -{ - m_pic->b_w((data >> 1) & 0x07); - m_pic->sgs_w(BIT(data, 4)); -} - -READ8_MEMBER( v1050_state::vint_clr_r ) -{ - set_interrupt(INT_VSYNC, 0); - - return 0xff; -} - -WRITE8_MEMBER( v1050_state::vint_clr_w ) -{ - set_interrupt(INT_VSYNC, 0); -} - -READ8_MEMBER( v1050_state::dint_clr_r ) -{ - set_interrupt(INT_DISPLAY, 0); - - return 0xff; -} - -WRITE8_MEMBER( v1050_state::dint_clr_w ) -{ - set_interrupt(INT_DISPLAY, 0); -} - -WRITE8_MEMBER( v1050_state::bank_w ) -{ - m_bank = data; - - bankswitch(); -} - -// SY6502A Read/Write Handlers - -WRITE8_MEMBER( v1050_state::dint_w ) -{ - set_interrupt(INT_DISPLAY, 1); -} - -WRITE8_MEMBER( v1050_state::dvint_clr_w ) -{ - m_subcpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); -} - -WRITE8_MEMBER( v1050_state::sasi_data_w ) -{ - m_sasi_data = data; - - if (m_sasi_data_enable) - { - m_sasi_data_out->write(m_sasi_data); - } -} - -WRITE_LINE_MEMBER( v1050_state::write_sasi_io ) -{ - m_sasi_ctrl_in->write_bit4(state); - - m_sasi_data_enable = state; - - if (m_sasi_data_enable) - { - m_sasi_data_out->write(m_sasi_data); - } - else - { - m_sasi_data_out->write(0); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sasi_ack_tick) -{ - m_sasibus->write_ack(0); -} - -TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sasi_rst_tick) -{ - m_sasibus->write_rst(0); -} - -WRITE8_MEMBER( v1050_state::sasi_ctrl_w ) -{ - /* - - bit description - - 0 SEL - 1 ACK - 2 - 3 - 4 - 5 - 6 - 7 RST - - */ - - m_sasibus->write_sel(BIT(data, 0)); - - if (BIT(data, 1)) - { - // send acknowledge pulse - m_sasibus->write_ack(1); - - m_timer_ack->adjust(attotime::from_nsec(100)); - } - - if (BIT(data, 7)) - { - // send reset pulse - m_sasibus->write_rst(1); - - m_timer_rst->adjust(attotime::from_nsec(100)); - } -} - -// Memory Maps - -static ADDRESS_MAP_START( v1050_mem, AS_PROGRAM, 8, v1050_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") - AM_RANGE(0x2000, 0x3fff) AM_RAMBANK("bank2") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank3") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank4") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank5") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( v1050_io, AS_IO, 8, v1050_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(I8255A_DISP_TAG, i8255_device, read, write) -// AM_RANGE(0x88, 0x88) AM_DEVREADWRITE(I8251A_KB_TAG, i8251_device, data_r, data_w) -// AM_RANGE(0x89, 0x89) AM_DEVREADWRITE(I8251A_KB_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x88, 0x88) AM_READ(kb_data_r) AM_DEVWRITE(I8251A_KB_TAG, i8251_device, data_w) - AM_RANGE(0x89, 0x89) AM_READ(kb_status_r) AM_DEVWRITE(I8251A_KB_TAG, i8251_device, control_w) - AM_RANGE(0x8c, 0x8c) AM_DEVREADWRITE(I8251A_SIO_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x8d, 0x8d) AM_DEVREADWRITE(I8251A_SIO_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x90, 0x93) AM_DEVREADWRITE(I8255A_MISC_TAG, i8255_device, read, write) - AM_RANGE(0x94, 0x97) AM_DEVREADWRITE(MB8877_TAG, mb8877_t, read, write) - AM_RANGE(0x9c, 0x9f) AM_DEVREADWRITE(I8255A_RTC_TAG, i8255_device, read, write) - AM_RANGE(0xa0, 0xa0) AM_READWRITE(vint_clr_r, vint_clr_w) - AM_RANGE(0xb0, 0xb0) AM_READWRITE(dint_clr_r, dint_clr_w) - AM_RANGE(0xc0, 0xc0) AM_WRITE(v1050_i8214_w) - AM_RANGE(0xd0, 0xd0) AM_WRITE(bank_w) - AM_RANGE(0xe0, 0xe0) AM_WRITE(sasi_data_w) AM_DEVREAD("scsi_data_in", input_buffer_device, read) - AM_RANGE(0xe1, 0xe1) AM_DEVREAD("scsi_ctrl_in", input_buffer_device, read) AM_WRITE(sasi_ctrl_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( v1050_crt_mem, AS_PROGRAM, 8, v1050_state ) - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(videoram_r, videoram_w) AM_SHARE("video_ram") - AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(H46505_TAG, mc6845_device, address_w) - AM_RANGE(0x8001, 0x8001) AM_DEVREADWRITE(H46505_TAG, mc6845_device, register_r, register_w) - AM_RANGE(0x9000, 0x9003) AM_DEVREADWRITE(I8255A_M6502_TAG, i8255_device, read, write) - AM_RANGE(0xa000, 0xa000) AM_READWRITE(attr_r, attr_w) - AM_RANGE(0xb000, 0xb000) AM_WRITE(dint_w) - AM_RANGE(0xc000, 0xc000) AM_WRITE(dvint_clr_w) - AM_RANGE(0xe000, 0xffff) AM_ROM -ADDRESS_MAP_END - -// Input Ports - -static INPUT_PORTS_START( v1050 ) - PORT_START("ROW0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // HELP - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) - - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F14) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F15) - - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // F16 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) // F17 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START("ROW3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - - PORT_START("ROW4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_PAUSE) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - - PORT_START("ROW5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - - PORT_START("ROW6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("ROW7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SCRLOCK) - - PORT_START("ROW8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SHIFT - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("ROW9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) // SHIFT - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) // DOWN - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) // UP - - PORT_START("ROW10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("ROW11") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("ROW12") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) -INPUT_PORTS_END - -// 8214 Interface - -WRITE_LINE_MEMBER(v1050_state::pic_int_w) -{ - if (state == ASSERT_LINE) - { - m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); - } -} - -// Display 8255A Interface - -WRITE8_MEMBER(v1050_state::disp_ppi_pc_w) -{ - m_ppi_6502->pc2_w(BIT(data, 6)); - m_ppi_6502->pc4_w(BIT(data, 7)); -} - -WRITE8_MEMBER(v1050_state::m6502_ppi_pc_w) -{ - m_ppi_disp->pc2_w(BIT(data, 7)); - m_ppi_disp->pc4_w(BIT(data, 6)); -} - -// Miscellanous 8255A Interface - -WRITE8_MEMBER( v1050_state::misc_ppi_pa_w ) -{ - /* - - bit signal description - - PA0 f_ds<0> drive 0 select - PA1 f_ds<1> drive 1 select - PA2 f_ds<2> drive 2 select - PA3 f_ds<3> drive 3 select - PA4 f_side_1 floppy side select - PA5 f_pre_comp precompensation - PA6 f_motor_on* floppy motor - PA7 f_dden* double density select - - */ - - // floppy drive select - floppy_image_device *floppy = NULL; - - if (!BIT(data, 0)) floppy = m_floppy0->get_device(); - if (!BIT(data, 1)) floppy = m_floppy1->get_device(); - if (!BIT(data, 2)) floppy = m_floppy2->get_device(); - if (!BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - - // floppy side select - if (floppy) floppy->ss_w(BIT(data, 4)); - - // floppy motor - if (floppy) floppy->mon_w(BIT(data, 6)); - - // density select - m_fdc->dden_w(BIT(data, 7)); -} - -WRITE_LINE_MEMBER(v1050_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER(v1050_state::write_centronics_perror) -{ - m_centronics_perror = state; -} - -READ8_MEMBER(v1050_state::misc_ppi_pc_r) -{ - /* - - bit signal description - - PC0 pr_strobe printer strobe - PC1 f_int_enb floppy interrupt enable - PC2 baud_sel_a - PC3 baud_sel_b - PC4 pr_busy* printer busy - PC5 pr_pe* printer paper end - PC6 - PC7 - - */ - - UINT8 data = 0; - - data |= m_centronics_busy << 4; - data |= m_centronics_perror << 5; - - return data; -} - -void v1050_state::set_baud_sel(int baud_sel) -{ - if (baud_sel != m_baud_sel) - { - int divider = 1; - - switch (baud_sel) - { - case 0: - divider = 13 * 16; // 19200 - break; - - case 1: - divider = 13 * 8; // 38400 - break; - - case 2: - divider = 8; // 500000 - break; - - case 3: - divider = 13 * 2; // 153600 - break; - } - - m_clock_sio->set_clock_scale((double) 1 / divider); - - m_baud_sel = baud_sel; - } -} - -WRITE8_MEMBER( v1050_state::misc_ppi_pc_w ) -{ - /* - - bit signal description - - PC0 pr_strobe printer strobe - PC1 f_int_enb floppy interrupt enable - PC2 baud_sel_a - PC3 baud_sel_b - PC4 pr_busy* printer busy - PC5 pr_pe* printer paper end - PC6 - PC7 - - */ - - // printer strobe - m_centronics->write_strobe(BIT(data, 0)); - - // floppy interrupt enable - m_f_int_enb = BIT(data, 1); - update_fdc(); - - // baud select - set_baud_sel((data >> 2) & 0x03); -} - -// Real Time Clock 8255A Interface - -WRITE8_MEMBER( v1050_state::rtc_ppi_pb_w ) -{ - /* - - bit signal description - - PB0 RS-232 - PB1 Winchester - PB2 keyboard - PB3 floppy disk interrupt - PB4 vertical interrupt - PB5 display interrupt - PB6 expansion B - PB7 expansion A - - */ - - m_int_mask = data; -} - -READ8_MEMBER( v1050_state::rtc_ppi_pa_r ) -{ - return m_rtc_ppi_pa; -} - -WRITE8_MEMBER( v1050_state::rtc_ppi_pa_w ) -{ - m_rtc->d0_w((data >> 0) & 1); - m_rtc->d1_w((data >> 1) & 1); - m_rtc->d2_w((data >> 2) & 1); - m_rtc->d3_w((data >> 3) & 1); -} - -READ8_MEMBER( v1050_state::rtc_ppi_pc_r ) -{ - /* - - bit signal description - - PC0 - PC1 - PC2 - PC3 clock busy - PC4 - PC5 - PC6 - PC7 - - */ - - return m_rtc_ppi_pc; -} - -WRITE8_MEMBER( v1050_state::rtc_ppi_pc_w ) -{ - /* - - bit signal description - - PC0 - PC1 - PC2 - PC3 - PC4 clock address write - PC5 clock data write - PC6 clock data read - PC7 clock device select - - */ - - m_rtc->address_write_w(BIT(data, 4)); - m_rtc->write_w(BIT(data, 5)); - m_rtc->read_w(BIT(data, 6)); - m_rtc->cs2_w(BIT(data, 7)); -} - -// Keyboard 8251A Interface - -WRITE_LINE_MEMBER(v1050_state::write_keyboard_clock) -{ - m_uart_kb->write_txc(state); - m_uart_kb->write_rxc(state); -} - -WRITE_LINE_MEMBER( v1050_state::kb_rxrdy_w ) -{ - set_interrupt(INT_KEYBOARD, state); -} - -// Serial 8251A Interface - -WRITE_LINE_MEMBER(v1050_state::write_sio_clock) -{ - m_uart_sio->write_txc(state); - m_uart_sio->write_rxc(state); -} - -WRITE_LINE_MEMBER( v1050_state::sio_rxrdy_w ) -{ - m_rxrdy = state; - - set_interrupt(INT_RS_232, m_rxrdy || m_txrdy); -} - -WRITE_LINE_MEMBER( v1050_state::sio_txrdy_w ) -{ - m_txrdy = state; - - set_interrupt(INT_RS_232, m_rxrdy || m_txrdy); -} - -// MB8877 Interface - -void v1050_state::update_fdc() -{ - if (m_f_int_enb) - { - set_interrupt(INT_FLOPPY, m_fdc_irq ? 1 : 0); - m_maincpu->set_input_line(INPUT_LINE_NMI, m_fdc_drq ? ASSERT_LINE : CLEAR_LINE); - } - else - { - set_interrupt(INT_FLOPPY, 0); - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - } -} - -// disk format: 80 tracks, 1 head, 10 sectors, 512 bytes sector length, first sector id 1 - -static SLOT_INTERFACE_START( v1050_floppies ) - SLOT_INTERFACE( "525ssqd", FLOPPY_525_SSQD ) // Teac FD 55E-02-U - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Teac FD 55-FV-35-U -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER( v1050_state::fdc_intrq_w ) -{ - m_fdc_irq = state; - - update_fdc(); -} - -WRITE_LINE_MEMBER( v1050_state::fdc_drq_w ) -{ - m_fdc_drq = state; - - update_fdc(); -} - - -// Machine Initialization - -IRQ_CALLBACK_MEMBER(v1050_state::v1050_int_ack) -{ - UINT8 vector = 0xf0 | (m_pic->a_r() << 1); - - //logerror("Interrupt Acknowledge Vector: %02x\n", vector); - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); - - return vector; -} - -void v1050_state::machine_start() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - // initialize I8214 - m_pic->etlg_w(1); - m_pic->inte_w(1); - - // initialize RTC - m_rtc->cs1_w(1); - - // setup memory banking - UINT8 *ram = m_ram->pointer(); - - membank("bank1")->configure_entries(0, 2, ram, 0x10000); - membank("bank1")->configure_entry(2, ram + 0x1c000); - membank("bank1")->configure_entry(3, m_rom->base()); - - program.install_readwrite_bank(0x2000, 0x3fff, "bank2"); - membank("bank2")->configure_entries(0, 2, ram + 0x2000, 0x10000); - membank("bank2")->configure_entry(2, ram + 0x1e000); - - program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); - membank("bank3")->configure_entries(0, 2, ram + 0x4000, 0x10000); - - program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - membank("bank4")->configure_entries(0, 2, ram + 0x8000, 0x10000); - - program.install_readwrite_bank(0xc000, 0xffff, "bank5"); - membank("bank5")->configure_entries(0, 3, ram + 0xc000, 0); - - bankswitch(); - - // register for state saving - save_item(NAME(m_int_mask)); - save_item(NAME(m_int_state)); - save_item(NAME(m_f_int_enb)); - save_item(NAME(m_fdc_irq)); - save_item(NAME(m_fdc_drq)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_keydata)); - save_item(NAME(m_keyavail)); - save_item(NAME(m_rxrdy)); - save_item(NAME(m_txrdy)); - save_item(NAME(m_baud_sel)); - save_item(NAME(m_bank)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_perror)); -} - -void v1050_state::machine_reset() -{ - m_bank = 0; - bankswitch(); - - set_baud_sel(0); - - m_fdc->reset(); -} - -// Machine Driver - -static MACHINE_CONFIG_START( v1050, v1050_state ) - // basic machine hardware - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) - MCFG_CPU_PROGRAM_MAP(v1050_mem) - MCFG_CPU_IO_MAP(v1050_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(v1050_state,v1050_int_ack) - - MCFG_QUANTUM_PERFECT_CPU(Z80_TAG) - - MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_15_36MHz/16) - MCFG_CPU_PROGRAM_MAP(v1050_crt_mem) - MCFG_QUANTUM_PERFECT_CPU(M6502_TAG) - - // keyboard HACK - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", v1050_state, v1050_keyboard_tick, attotime::from_hz(60)) - - // video hardware - MCFG_FRAGMENT_ADD(v1050_video) - - // devices - MCFG_DEVICE_ADD(UPB8214_TAG, I8214, XTAL_16MHz/4) - MCFG_I8214_IRQ_CALLBACK(WRITELINE(v1050_state, pic_int_w)) - - MCFG_DEVICE_ADD(MSM58321RS_TAG, MSM58321, XTAL_32_768kHz) - MCFG_MSM58321_D0_HANDLER(WRITELINE(v1050_state, rtc_ppi_pa_0_w)) - MCFG_MSM58321_D1_HANDLER(WRITELINE(v1050_state, rtc_ppi_pa_1_w)) - MCFG_MSM58321_D2_HANDLER(WRITELINE(v1050_state, rtc_ppi_pa_2_w)) - MCFG_MSM58321_D3_HANDLER(WRITELINE(v1050_state, rtc_ppi_pa_3_w)) - MCFG_MSM58321_BUSY_HANDLER(WRITELINE(v1050_state, rtc_ppi_pc_3_w)) - - MCFG_DEVICE_ADD(I8255A_DISP_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(DEVREAD8(I8255A_M6502_TAG, i8255_device, pb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(v1050_state, disp_ppi_pc_w)) - - MCFG_DEVICE_ADD(I8255A_MISC_TAG, I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(v1050_state, misc_ppi_pa_w)) - MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_IN_PORTC_CB(READ8(v1050_state,misc_ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(v1050_state,misc_ppi_pc_w)) - - MCFG_DEVICE_ADD(I8255A_RTC_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(v1050_state, rtc_ppi_pa_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(v1050_state, rtc_ppi_pa_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(v1050_state, rtc_ppi_pb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(v1050_state, rtc_ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(v1050_state, rtc_ppi_pc_w)) - - MCFG_DEVICE_ADD(I8255A_M6502_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(DEVREAD8(I8255A_DISP_TAG, i8255_device, pb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(v1050_state, m6502_ppi_pc_w)) - - MCFG_DEVICE_ADD(I8251A_KB_TAG, I8251, 0/*XTAL_16MHz/8,*/) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(V1050_KEYBOARD_TAG, v1050_keyboard_device, si_w)) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(v1050_state, kb_rxrdy_w)) - - MCFG_DEVICE_ADD(CLOCK_KB_TAG, CLOCK, XTAL_16MHz/4/13/8) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v1050_state, write_keyboard_clock)) - - // keyboard - MCFG_DEVICE_ADD(V1050_KEYBOARD_TAG, V1050_KEYBOARD, 0) - MCFG_V1050_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_KB_TAG, i8251_device, write_rxd)) - - MCFG_DEVICE_ADD(I8251A_SIO_TAG, I8251, 0/*XTAL_16MHz/8,*/) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(v1050_state, sio_rxrdy_w)) - MCFG_I8251_TXRDY_HANDLER(WRITELINE(v1050_state, sio_txrdy_w)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_SIO_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_SIO_TAG, i8251_device, write_dsr)) - - MCFG_DEVICE_ADD(CLOCK_SIO_TAG, CLOCK, XTAL_16MHz/4) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v1050_state, write_sio_clock)) - - MCFG_MB8877_ADD(MB8877_TAG, XTAL_16MHz/16) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(v1050_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(v1050_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", v1050_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":1", v1050_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":2", v1050_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":3", v1050_floppies, NULL, floppy_image_device::default_floppy_formats) - - // SASI bus - MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0) - MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") - MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit0)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit1)) - MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit2)) - MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3)) - MCFG_SCSI_IO_HANDLER(WRITELINE(v1050_state, write_sasi_io)) MCFG_DEVCB_XOR(1) // bit4 - MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", S1410, SCSI_ID_0) - - MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SASIBUS_TAG) - MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) - MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0) - - MCFG_TIMER_DRIVER_ADD(TIMER_ACK_TAG, v1050_state, sasi_ack_tick) - MCFG_TIMER_DRIVER_ADD(TIMER_RST_TAG, v1050_state, sasi_rst_tick) - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "v1050_flop") - MCFG_SOFTWARE_LIST_ADD("hdd_list", "v1050_hdd") - - // printer - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(v1050_state, write_centronics_busy)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(v1050_state, write_centronics_perror)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") -MACHINE_CONFIG_END - -// ROMs - -ROM_START( v1050 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "e244-032 rev 1.2.u86", 0x0000, 0x2000, CRC(46f847a7) SHA1(374db7a38a9e9230834ce015006e2f1996b9609a) ) - - ROM_REGION( 0x10000, M6502_TAG, 0 ) - ROM_LOAD( "e244-033 rev 1.1.u77", 0xe000, 0x2000, CRC(c0502b66) SHA1(bc0015f5b14f98110e652eef9f7c57c614683be5) ) -ROM_END - -// System Drivers - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, v1050, 0, 0, v1050, v1050, driver_device, 0, "Visual Technology Inc", "Visual 1050", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND | MACHINE_IMPERFECT_KEYBOARD ) diff --git a/src/mess/drivers/v6809.c b/src/mess/drivers/v6809.c deleted file mode 100644 index 1b408d95335..00000000000 --- a/src/mess/drivers/v6809.c +++ /dev/null @@ -1,382 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Vegas 6809 - - Skeleton driver - -Devices: - -MC6809 cpu -MC6840 timer -MM58174 RTC -MB8876 (or FD1791) FDC -SY6545-1 CRTC -2x MC6821 PIA -2x MC6850 ACIA - -Memory ranges: - -0000-EFFF RAM -F000-F7FF Devices -F800-FFFF ROM - -Monitor commands: - -D boot from floppy (launch Flex OS) -F relaunch Flex -G go -M modify memory (. to exit) - -ToDo: - - - Colours (Looks like characters 0xc0-0xff produce coloured lores gfx). - - - Connect the RTC interrupt pin (not supported currently) - - - Find the missing character generator rom. - - - Enable sound, when what seems to be a 6840 bug is fixed. - - - Schematic is almost useless, riddled with omissions and errors. - All documents are in French, so no help there. The parts list - only has half of the parts. - - - Need software - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "machine/6821pia.h" -#include "machine/6840ptm.h" -#include "machine/clock.h" -#include "video/mc6845.h" -#include "machine/6850acia.h" -#include "machine/mm58274c.h" -#include "machine/keyboard.h" -#include "sound/speaker.h" -#include "machine/wd_fdc.h" - -#define KEYBOARD_TAG "keyboard" - -class v6809_state : public driver_device -{ -public: - v6809_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_video_address(0), - m_pia0(*this, "pia0"), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "crtc"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_speaker(*this, "speaker"), - m_acia0(*this, "acia0"), - m_acia1(*this, "acia1"), - m_palette(*this, "palette") - { - } - - DECLARE_WRITE8_MEMBER(speaker_en_w); - DECLARE_WRITE8_MEMBER(speaker_w); - DECLARE_READ8_MEMBER(pb_r); - DECLARE_WRITE8_MEMBER(pa_w); - DECLARE_WRITE8_MEMBER(videoram_w); - DECLARE_WRITE8_MEMBER(v6809_address_w); - DECLARE_WRITE8_MEMBER(v6809_register_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - DECLARE_MACHINE_RESET(v6809); - MC6845_UPDATE_ROW(crtc_update_row); - MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); - - UINT8 *m_p_videoram; - const UINT8 *m_p_chargen; - UINT16 m_video_address; - -private: - bool m_speaker_en; - UINT8 m_video_index; - UINT8 m_term_data; - UINT8 m_vidbyte; - required_device m_pia0; - required_device m_maincpu; - required_device m_crtc; - required_device m_fdc; - required_device m_floppy0; - required_device m_speaker; - required_device m_acia0; - required_device m_acia1; -public: - required_device m_palette; -}; - - -static ADDRESS_MAP_START(v6809_mem, AS_PROGRAM, 8, v6809_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xefff) AM_RAM - AM_RANGE(0xf000, 0xf000) AM_MIRROR(0xfe) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(v6809_address_w) - AM_RANGE(0xf001, 0xf001) AM_MIRROR(0xfe) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(v6809_register_w) - AM_RANGE(0xf200, 0xf200) AM_MIRROR(0xff) AM_WRITE(videoram_w) - AM_RANGE(0xf504, 0xf504) AM_MIRROR(0x36) AM_DEVREADWRITE("acia0", acia6850_device, status_r, control_w) // modem - AM_RANGE(0xf505, 0xf505) AM_MIRROR(0x36) AM_DEVREADWRITE("acia0", acia6850_device, data_r, data_w) - AM_RANGE(0xf50c, 0xf50c) AM_MIRROR(0x36) AM_DEVREADWRITE("acia1", acia6850_device, status_r, control_w) // printer - AM_RANGE(0xf50d, 0xf50d) AM_MIRROR(0x36) AM_DEVREADWRITE("acia1", acia6850_device, data_r, data_w) - AM_RANGE(0xf600, 0xf603) AM_MIRROR(0x3c) AM_DEVREADWRITE("fdc", mb8876_t, read, write) - AM_RANGE(0xf640, 0xf64f) AM_MIRROR(0x30) AM_DEVREADWRITE("rtc", mm58274c_device, read, write) - AM_RANGE(0xf680, 0xf683) AM_MIRROR(0x3c) AM_DEVREADWRITE("pia0", pia6821_device, read, write) - AM_RANGE(0xf6c8, 0xf6cf) AM_MIRROR(0x08) AM_DEVREADWRITE("ptm", ptm6840_device, read, write) - AM_RANGE(0xf6d0, 0xf6d3) AM_MIRROR(0x0c) AM_DEVREADWRITE("pia1", pia6821_device, read, write) - AM_RANGE(0xf800, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(v6809_io, AS_PROGRAM, 8, v6809_state) - AM_RANGE(0x0064, 0x0064) AM_WRITENOP -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( v6809 ) -INPUT_PORTS_END - -MACHINE_RESET_MEMBER( v6809_state, v6809) -{ - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("videoram")->base(); - m_term_data = 0; - m_pia0->cb1_w(1); -} - -// **** Video **** - -/* F4 Character Displayer */ -static const gfx_layout v6809_charlayout = -{ - 8, 10, /* 8 x 10 characters */ - 256, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( v6809 ) - GFXDECODE_ENTRY( "chargen", 0x0000, v6809_charlayout, 0, 1 ) -GFXDECODE_END - -MC6845_UPDATE_ROW( v6809_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) - { - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); - - /* Display a scanline of a character (8 pixels) */ - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} - -MC6845_ON_UPDATE_ADDR_CHANGED( v6809_state::crtc_update_addr ) -{ -/* not sure what goes in here - parameters passed are device, address, strobe */ - m_video_address = address & 0x7ff; -} - -WRITE8_MEMBER( v6809_state::videoram_w ) -{ - m_vidbyte = data; -} - -WRITE8_MEMBER( v6809_state::v6809_address_w ) -{ - m_crtc->address_w( space, 0, data ); - - m_video_index = data & 0x1f; - - if (m_video_index == 31) - m_p_videoram[m_video_address] = m_vidbyte; -} - -WRITE8_MEMBER( v6809_state::v6809_register_w ) -{ - UINT16 temp = m_video_address; - - m_crtc->register_w( space, 0, data ); - - // Get transparent address - if (m_video_index == 18) - m_video_address = ((data & 7) << 8 ) | (temp & 0xff); - else - if (m_video_index == 19) - m_video_address = data | (temp & 0xff00); -} - -// **** Keyboard **** - -WRITE8_MEMBER( v6809_state::kbd_put ) -{ - m_term_data = data; - m_pia0->cb1_w(0); - m_pia0->cb1_w(1); -} - -WRITE_LINE_MEMBER( v6809_state::write_acia_clock ) -{ - m_acia0->write_txc(state); - m_acia0->write_rxc(state); - m_acia1->write_txc(state); - m_acia1->write_rxc(state); -} - -READ8_MEMBER( v6809_state::pb_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -// can support 4 drives -WRITE8_MEMBER( v6809_state::pa_w ) -{ - floppy_image_device *floppy = NULL; - if ((data & 3) == 0) floppy = m_floppy0->get_device(); - //if ((data & 3) == 1) floppy = m_floppy1->get_device(); - //if ((data & 3) == 2) floppy = m_floppy2->get_device(); - //if ((data & 3) == 3) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - -// Bits 2 and 3 go to the floppy connector but are not documented - - if (floppy) - { - floppy->mon_w(0); - m_fdc->dden_w(BIT(data, 4)); - } -} - -// this should output 1 to enable sound, then output 0 after a short time -// however it continuously outputs 1 -WRITE8_MEMBER( v6809_state::speaker_en_w ) -{ - m_speaker_en = data; -} - -WRITE8_MEMBER( v6809_state::speaker_w ) -{ -// if (m_speaker_en) -// m_speaker->level_w(data); -} - -static SLOT_INTERFACE_START( v6809_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - - -// *** Machine **** - -static MACHINE_CONFIG_START( v6809, v6809_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6809, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(v6809_mem) - MCFG_CPU_IO_MAP(v6809_io) - MCFG_MACHINE_RESET_OVERRIDE(v6809_state, v6809) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", v6809) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_16MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(v6809_state, crtc_update_row) - MCFG_MC6845_ADDR_CHANGED_CB(v6809_state, crtc_update_addr) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(v6809_state, kbd_put)) - -// port A = drive select and 2 control lines ; port B = keyboard -// CB2 connects to the interrupt pin of the RTC (the rtc code doesn't support it) - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(v6809_state, pb_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(v6809_state, pa_w)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) - -// no idea what this does - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line)) - - MCFG_DEVICE_ADD("ptm", PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(XTAL_16MHz / 4) - MCFG_PTM6840_EXTERNAL_CLOCKS(4000000/14, 4000000/14, 4000000/14/8) - MCFG_PTM6840_OUT1_CB(WRITE8(v6809_state, speaker_w)) - MCFG_PTM6840_OUT2_CB(WRITE8(v6809_state, speaker_en_w)) - MCFG_PTM6840_IRQ_CB(INPUTLINE("maincpu", M6809_IRQ_LINE)) - - MCFG_DEVICE_ADD("acia0", ACIA6850, 0) - - MCFG_DEVICE_ADD("acia1", ACIA6850, 0) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 10) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v6809_state, write_acia_clock)) - - MCFG_DEVICE_ADD("rtc", MM58274C, 0) -// this is all guess - MCFG_MM58274C_MODE24(0) // 12 hour - MCFG_MM58274C_DAY1(1) // monday - - MCFG_MB8876_ADD("fdc", XTAL_16MHz / 16) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", v6809_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( v6809 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "v6809.rom", 0xf800, 0x0800, CRC(54bf5f32) SHA1(10d1d70f0b51e2b90e5c29249d3eab4c6b0033a1) ) - - ROM_REGION( 0x800, "videoram", ROMREGION_ERASE00 ) - - /* character generator not dumped, using the one from 'h19' for now */ - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "2716_444-29_h19font.bin", 0x0000, 0x0800, BAD_DUMP CRC(d595ac1d) SHA1(130fb4ea8754106340c318592eec2d8a0deaf3d0)) - ROM_RELOAD(0x0800, 0x0800) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, v6809, 0, 0, v6809, v6809, driver_device, 0, "Microkit", "Vegas 6809", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/vax11.c b/src/mess/drivers/vax11.c deleted file mode 100644 index acf6e607316..00000000000 --- a/src/mess/drivers/vax11.c +++ /dev/null @@ -1,174 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - VAX-11 - - VAX-11/785 - ------- - M7459 TRS, TERMINATOR & SILO - M7460 KA785, SBL,CUP SBI LOW BITS - M7461 KA785, SBH,SBI - M7462 KA785, CAM, CACHE ADDRESS MATRIX - M7463 KA785, CDM, CACHE DATA MATRIX - M7464 KA785, TBM, CPU TRANSLATION BUFFER - M7465 KA785, IDP, CPU INSTRUCTION DATA - M7466 KA785, IRC, CPU INSTRUCTION DECODE - M7467 KA785, DPB, CPU DATA PATH B - M7468 KA785, DEP, CPU DATA PATH E - M7469 KA785, DDP, CPU DATA PATH D - M7470 KA785, DCP, CPU DATA PATH C - M7471 KA785, DAP, CPU DATA PATH A - M7472 KA785, CEW (CONDITION CODES, EXCEP - M7473 KA785, ICL (INTERRUPT CONTROL, LOW - M7474 KA785, CLK (CPU CLOCK) - M7475 KA785, JCS, JOINT CONTROL STORE - M7476 KA785, USC, MICRO SEQUENCER CONTROL - M7477 KA785, CIB, CPU CONSOLE INTERFACE - - +----------FP785--------+ - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 - M7459 M7460 M7461 M7462 M7463 M7464 M7465 M7466 M7467 M7468 M7469 M7470 M7471 M7472 M7473 M7474 M7475 M7475 UNUSED M7476 M7540 M7541 M7542 M7543 M7544 M7477 - TRS SBL SBH CAM CDM TBM IDP IRC DBP DEP DDP DCP DAP CEH ICL CLK JCS JCS USC FNM FMH FML FAD FCT CIB - - VAX-11/780 - ------- - M8237 TERMINATOR SILO - M8218 SBL LOW BIT INTERFACE - M8219 SBH HIGH BITS INTERFACE - M8220 CAM CPU CACHE ADAPTER MATRIX - M8221 CDM CPU CACHE DATA MATRIX - M8222 TBM CPU TRANSLATION BUFFER MATRIX - M8223 IRC CPU INSTRUCT DECODE&CLOCKS - M8224 IDP CPU INSTRUCTION DATA PATH - M8225 DBP DATA PATH B - M8226 DEP DATA PATH E - M8227 DDP DATA PATH D - M8228 DCP DATA PATH C - M8229 DAP DATA PATH A - M8230 CEH CPU CONDITION CODE - M8231 ICL CPU TRAPS AND INTERRUPT CONTROL - M8232 CLK CPU CLOCK - M8238 WCS KU780-A 2K WCS - M8234 PCS KA780-A PCS, PROM CONTROL STORE - M8235 USC MICRO SEQUENCE CONTROL - M8236 CIB CONSOLE INTERFACE - - +----------FP780--------+ - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 - M8237 M8218 M8219 M8220 M8221 M8222 M8223 M8224 M8225 M8226 M8227 M8228 M8229 M8230 M8231 M8232 M8233 M8233 M8234 M8235 M8285 M8286 M8287 M8288 M8289 M8236 - TRS SBL SBH CAM CDM TBM IDP IRC DBP DEP DDP DCP DAP CEH ICL CLK or or PCS USC FNM FMH FML FAD FCT CIB - M8238 M8238 - - - 02/08/2012 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/t11/t11.h" -#include "machine/terminal.h" -#include "machine/rx01.h" - -#define TERMINAL_TAG "terminal" - -class vax11_state : public driver_device -{ -public: - vax11_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ16_MEMBER( term_r ); - DECLARE_READ16_MEMBER( term_tx_status_r ); - DECLARE_READ16_MEMBER( term_rx_status_r ); - DECLARE_WRITE16_MEMBER( term_w ); - DECLARE_WRITE8_MEMBER( kbd_put ); - UINT8 m_term_data; - UINT16 m_term_status; -}; - -WRITE16_MEMBER(vax11_state::term_w) -{ - m_terminal->write(space, 0, data); -} - -READ16_MEMBER(vax11_state::term_r) -{ - m_term_status = 0x0000; - return m_term_data; -} - -READ16_MEMBER(vax11_state::term_tx_status_r) -{ // always ready - return 0xffff; -} - -READ16_MEMBER(vax11_state::term_rx_status_r) -{ - return m_term_status; -} - -static ADDRESS_MAP_START(vax11_mem, AS_PROGRAM, 16, vax11_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xbfff ) AM_RAM // RAM - AM_RANGE( 0xc000, 0xd7ff ) AM_ROM - - AM_RANGE( 0xfe78, 0xfe7b ) AM_DEVREADWRITE("rx01", rx01_device, read, write) - - AM_RANGE( 0xff70, 0xff71 ) AM_READ(term_rx_status_r) - AM_RANGE( 0xff72, 0xff73 ) AM_READ(term_r) - AM_RANGE( 0xff74, 0xff75 ) AM_READ(term_tx_status_r) - AM_RANGE( 0xff76, 0xff77 ) AM_WRITE(term_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vax11 ) -INPUT_PORTS_END - -WRITE8_MEMBER( vax11_state::kbd_put ) -{ - m_term_data = data; - m_term_status = 0xffff; -} - -static MACHINE_CONFIG_START( vax11, vax11_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) // Need proper CPU here - MCFG_T11_INITIAL_MODE(0 << 13) - MCFG_CPU_PROGRAM_MAP(vax11_mem) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(vax11_state, kbd_put)) - - MCFG_RX01_ADD("rx01") -MACHINE_CONFIG_END - -ROM_START( vax785 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // M7477 - ROMX_LOAD( "23-144f1-00.e56", 0xc000, 0x0400, CRC(99c1f117) SHA1(f05b6e97bf258392656058864abc1177379194da), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - ROMX_LOAD( "23-145f1-00.e68", 0xc000, 0x0400, CRC(098b63d2) SHA1(c2742aaccdac2921e1704c835ee5cef242cd7308), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - ROMX_LOAD( "23-146f1-00.e84", 0xc001, 0x0400, CRC(0f5f5d7b) SHA1(2fe325d2a78a8ce5146317cc39c084c4967c323c), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - ROMX_LOAD( "23-147f1-00.e72", 0xc001, 0x0400, CRC(bde386f2) SHA1(fcb5a1fa505912c5f44781619c9508cd142721e3), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - - ROMX_LOAD( "23-148f1-00.e58", 0xc800, 0x0400, CRC(fe4c61e3) SHA1(4641a236761692a8f45b14ed6a73f535d57c2daa), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - ROMX_LOAD( "23-149f1-00.e70", 0xc800, 0x0400, CRC(a13f5f8a) SHA1(6a9d3b5a71a3249f3b9491d541c9854e071a320c), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - ROMX_LOAD( "23-150f1-00.e87", 0xc801, 0x0400, CRC(ca8d6419) SHA1(6d9c3e1e2f5a35f92c82240fcede14645aa83340), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - ROMX_LOAD( "23-151f1-00.e74", 0xc801, 0x0400, CRC(58ce48d3) SHA1(230dbcab1470752befb6733a89e3612ad7fba10d), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - - ROMX_LOAD( "23-236f1-00.e57", 0xd000, 0x0400, CRC(6f23470a) SHA1(d90a0bc56f04c2830f8cfb6b870db207b96e75b1), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - ROMX_LOAD( "23-237f1-00.e69", 0xd000, 0x0400, CRC(2bf8cf0b) SHA1(6db79c5392b265e38b5b8b386528d7c138d995e9), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - ROMX_LOAD( "23-238f1-00.e85", 0xd001, 0x0400, CRC(ff569f71) SHA1(05985396047fb4639959000a1abe50d2f184deaa), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(1)) - ROMX_LOAD( "23-239f1-00.e73", 0xd001, 0x0400, CRC(cec7abe3) SHA1(8b8b52bd46340c58efa5adef3f306e0cdcb77520), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(1)) - -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, vax785, 0, 0, vax11, vax11, driver_device, 0, "Digital Equipment Corporation", "VAX-11/785", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/vboy.c b/src/mess/drivers/vboy.c deleted file mode 100644 index 897c592231c..00000000000 --- a/src/mess/drivers/vboy.c +++ /dev/null @@ -1,1397 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese, Miodrag Milanovic -/*************************************************************************** - - Nintendo Virtual Boy - - driver by Miodrag Milanovic & Angelo Salese - - Great info at http://www.goliathindustries.com/vb/ - and http://www.vr32.de/modules/dokuwiki/doku.php? - - TODO: - - sound is way incomplete - - various timing issues (irq & events aren't known) - - 3dtetris: missing gfxs on gameplay (writes to framebuffer) - - boundh: game is way too fast - - galactic: ball goes out of bounds sometimes? - - golf: missing gfxs on gameplay (writes to framebuffer) - - marioten: title screen logo is misplaced if Mario completes his animation - - nesterfb: once that you hit the pins, animation phase takes a while to start - - redalarm: gameplay doesn't work - - spaceinv: Taito logo only if you press the button, framebuffer? - - spaceinv: missing shots - - vlab: doesn't boot (irq issue?) - - wariolnd: brightness gets suddently darker during intro. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/v810/v810.h" -#include "audio/vboy.h" -#include "bus/vboy/slot.h" -#include "bus/vboy/rom.h" -#include "vboy.lh" - -#define READ_BGMAP(bgoffs) m_bgmap[(bgoffs) & 0xffff] -#define READ_WORLD(wldoffs) READ_BGMAP((0x1d800 >> 1) + wldoffs) -#define READ_COLTAB1(wldoffs) READ_BGMAP((0x1dc00 >> 1) + wldoffs) -#define READ_COLTAB2(wldoffs) READ_BGMAP((0x1de00 >> 1) + wldoffs) -#define READ_OBJECTS(wldoffs) READ_BGMAP((0x1e000 >> 1) + wldoffs) - -#define WRITE_OVR_TEMPDRAW_MAP(woffs, wdat) m_ovr_tempdraw_map[(woffs) & 0x3f] = wdat; -#define READ_OVR_TEMPDRAW_MAP(roffs) m_ovr_tempdraw_map[(roffs) & 0x3f]; - -#define READ_FONT(roffs) m_font[(roffs)&0x1ffff] - -// bit of magic here, we also write pre-flipped copies of the data to extra ram we've allocated -// to simplify the draw loop (we can just pass the flip / unused bits as the upper character bits) -// (all TILE words are in the format of ccxy -ttt tttt tttt -// where 'c' = palette, 'x/y' are flips, '-' is unused(?) and 't' is your basic tile number - -#define WRITE_FONT(woffs) \ - COMBINE_DATA(&m_font[woffs]); /* normal */ \ - UINT16 dat = m_font[woffs]; \ - m_font[((woffs) + 0x4000)] = dat; /* normal */ \ - m_font[((woffs) + 0x8000) ^ 7] = dat; /* flip y */ \ - m_font[((woffs) + 0xc000) ^ 7] = dat; /* flip y */ \ - dat = BITSWAP16(dat,1,0,3,2,5,4,7,6,9,8,11,10,13,12,15,14); \ - m_font[((woffs) + 0x10000)] = dat; /* flip x */ \ - m_font[((woffs) + 0x14000)] = dat; /* flip x */ \ - m_font[((woffs) + 0x18000) ^ 7] = dat; /* flip x+y */ \ - m_font[((woffs) + 0x1c000) ^ 7] = dat; /* flip x+y */ - - -/* FIXME: most if not all of these must be UINT8 */ -struct vboy_regs_t -{ - UINT32 lpc, lpc2, lpt, lpr; - UINT32 khb, klb; - UINT8 thb, tlb; - UINT32 tcr, wcr, kcr; -}; - -struct vip_regs_t -{ - UINT16 INTPND; - UINT16 INTENB; - UINT16 DPSTTS; - UINT16 DPCTRL; - UINT16 BRTA; - UINT16 BRTB; - UINT16 BRTC; - UINT16 REST; - UINT16 FRMCYC; - UINT16 CTA; - UINT16 XPSTTS; - UINT16 XPCTRL; - UINT16 VER; - UINT16 SPT[4]; - UINT16 GPLT[4]; - UINT16 JPLT[4]; - UINT16 BKCOL; -}; - -struct vboy_timer_t -{ - UINT16 count; - UINT16 latch; -}; - -struct vboy_timer_t; - -class vboy_state : public driver_device -{ -public: - vboy_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_maintimer(*this, "timer_main"), - m_palette(*this, "palette") - { - m_vip_regs.INTPND = 0; - m_vip_regs.INTENB = 0; - m_vip_regs.DPSTTS = 0; - m_vip_regs.DPCTRL = 0; - m_vip_regs.BRTA = 0; - m_vip_regs.BRTB = 0; - m_vip_regs.BRTC = 0; - m_vip_regs.REST = 0; - m_vip_regs.FRMCYC = 0; - m_vip_regs.CTA = 0; - m_vip_regs.XPSTTS = 0; - m_vip_regs.XPCTRL = 0; - m_vip_regs.VER = 0; - m_vip_regs.SPT[0] = 0; - m_vip_regs.SPT[1] = 0; - m_vip_regs.SPT[2] = 0; - m_vip_regs.SPT[3] = 0; - m_vip_regs.GPLT[0] = 0; - m_vip_regs.GPLT[1] = 0; - m_vip_regs.GPLT[2] = 0; - m_vip_regs.GPLT[3] = 0; - m_vip_regs.JPLT[0] = 0; - m_vip_regs.JPLT[1] = 0; - m_vip_regs.JPLT[2] = 0; - m_vip_regs.JPLT[3] = 0; - m_vip_regs.BKCOL = 0; - - m_vboy_regs.lpc = 0; - m_vboy_regs.lpc2 = 0; - m_vboy_regs.lpt = 0; - m_vboy_regs.lpr = 0; - m_vboy_regs.khb = 0; - m_vboy_regs.klb = 0; - m_vboy_regs.thb = 0; - m_vboy_regs.tlb = 0; - m_vboy_regs.tcr = 0; - m_vboy_regs.wcr = 0; - m_vboy_regs.kcr = 0x80; - - m_vboy_timer.count = 0; - m_vboy_timer.latch = 0; - } - - required_device m_maincpu; - required_device m_cart; - required_device m_maintimer; - required_device m_palette; - memory_region *m_cart_rom; - - DECLARE_READ32_MEMBER(io_r); - DECLARE_WRITE32_MEMBER(io_w); - DECLARE_READ16_MEMBER(vip_r); - DECLARE_WRITE16_MEMBER(vip_w); - DECLARE_WRITE16_MEMBER(font0_w); - DECLARE_WRITE16_MEMBER(font1_w); - DECLARE_WRITE16_MEMBER(font2_w); - DECLARE_WRITE16_MEMBER(font3_w); - DECLARE_READ16_MEMBER(font0_r); - DECLARE_READ16_MEMBER(font1_r); - DECLARE_READ16_MEMBER(font2_r); - DECLARE_READ16_MEMBER(font3_r); - DECLARE_WRITE16_MEMBER(vboy_bgmap_w); - DECLARE_READ16_MEMBER(vboy_bgmap_r); - DECLARE_READ8_MEMBER(lfb0_r); - DECLARE_READ8_MEMBER(lfb1_r); - DECLARE_READ8_MEMBER(rfb0_r); - DECLARE_READ8_MEMBER(rfb1_r); - DECLARE_WRITE8_MEMBER(lfb0_w); - DECLARE_WRITE8_MEMBER(lfb1_w); - DECLARE_WRITE8_MEMBER(rfb0_w); - DECLARE_WRITE8_MEMBER(rfb1_w); - UINT16 *m_font; - UINT16 *m_bgmap; - UINT8 *m_l_frame_0; - UINT8 *m_l_frame_1; - UINT8 *m_r_frame_0; - UINT8 *m_r_frame_1; - vboy_regs_t m_vboy_regs; - vip_regs_t m_vip_regs; - vboy_timer_t m_vboy_timer; - INT32 *m_ovr_tempdraw_map; - UINT16 m_frame_count; - UINT8 m_displayfb; - UINT8 m_drawfb; - UINT8 m_row_num; - attotime m_input_latch_time; - void m_timer_tick(void); - void m_scanline_tick(int scanline, UINT8 screen_type); - void m_set_irq(UINT16 irq_vector); - - void put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, UINT16 code, UINT8 pal); - void fill_ovr_char(UINT16 code, UINT8 pal); - INT8 get_bg_map_pixel(int num, int xpos, int ypos); - void draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 param_base, int mode, int gx, int gp, int gy, int mx, int mp, int my,int h, int w, - UINT16 x_mask, UINT16 y_mask, UINT8 ovr, bool right, int bg_map_num); - void draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 param_base, int gx, int gp, int gy, int h, int w, - UINT16 x_mask, UINT16 y_mask, UINT8 ovr, bool right, int bg_map_num); - UINT8 display_world(int num, bitmap_ind16 &bitmap, const rectangle &cliprect, bool right, int &cur_spt); - void m_set_brightness(void); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(vboy); - UINT32 screen_update_vboy_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_vboy_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(timer_main_tick); - TIMER_DEVICE_CALLBACK_MEMBER(timer_pad_tick); - TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineL); - TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineR); -}; - - -void vboy_state::video_start() -{ - // Allocate memory for temporary screens - m_ovr_tempdraw_map = auto_alloc_array_clear(machine(), INT32, 0x40); - - // Allocate memory for framebuffers - m_l_frame_0 = auto_alloc_array_clear(machine(), UINT8, 0x6000); - m_l_frame_1 = auto_alloc_array_clear(machine(), UINT8, 0x6000); - m_r_frame_0 = auto_alloc_array_clear(machine(), UINT8, 0x6000); - m_r_frame_1 = auto_alloc_array_clear(machine(), UINT8, 0x6000); - - m_font = auto_alloc_array_clear(machine(), UINT16, (0x8000 >> 1)*4 * 2); - m_bgmap = auto_alloc_array(machine(), UINT16, 0x20000 >> 1); - memset(m_bgmap, 0, sizeof(UINT16) * (0x20000 >> 1)); -} - -void vboy_state::put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, UINT16 code, UINT8 pal) -{ - UINT16 data; - UINT8 yi, xi, dat, col; - - for (yi = 0; yi < 8; yi++) - { - data = READ_FONT(code * 8 + yi); - - for (xi = 0; xi < 8; xi++) - { - int res_x,res_y; - - dat = ((data >> (xi << 1)) & 0x03); - - res_x = x + xi; - res_y = y + yi; - - col = (pal >> (dat*2)) & 3; - - if (dat) - { - if (cliprect.contains(res_x, res_y)) - bitmap.pix16((res_y), (res_x)) = m_palette->pen(col); - } - } - } -} - - - -void vboy_state::fill_ovr_char(UINT16 code, UINT8 pal) -{ - UINT16 data; - UINT8 yi, xi, dat; - int col; - - for (yi = 0; yi < 8; yi++) - { - data = READ_FONT(code * 8 + yi); - - for (xi = 0; xi < 8; xi++) - { - dat = ((data >> (xi << 1)) & 0x03); - col = (pal >> (dat*2)) & 3; - - if(dat == 0) - col = -1; - - WRITE_OVR_TEMPDRAW_MAP(yi*8+xi, col); - } - } -} - -inline INT8 vboy_state::get_bg_map_pixel(int num, int xpos, int ypos) -{ -// g_profiler.start(PROFILER_USER1); - int x, y; - UINT8 stepx, stepy; - - y = ypos >>3; - x = xpos >>3; - - stepx = (x & 0x1c0) >> 6; - stepy = ((y & 0x1c0) >> 6) * (stepx+1); - UINT16 val = READ_BGMAP((x & 0x3f) + (64 * (y & 0x3f)) + ((num + stepx + stepy) * 0x1000)); - int pal = m_vip_regs.GPLT[(val >> 14) & 3]; - int code = val & 0x3fff; - - UINT16 data; - UINT8 yi, xi, dat; - - yi = ypos & 7; - data = READ_FONT(code * 8 + yi); - xi = xpos & 7; - dat = ((data >> (xi << 1)) & 0x03); - - if(dat == 0) - { - //g_profiler.stop(); - return -1; - } - // g_profiler.stop(); - return (pal >> (dat*2)) & 3; -} - -void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 param_base, int mode, int gx, int gp, int gy, int mx, int mp, int my, int h, int w, - UINT16 x_mask, UINT16 y_mask, UINT8 ovr, bool right, int bg_map_num) -{ -// g_profiler.start(PROFILER_USER2); - int x,y; - - for(y=0;y<=h;y++) - { - INT32 y1 = (y+gy); - - if ((y1 < cliprect.min_y) || (y1 > cliprect.max_y)) - continue; - - int src_y = y+my; - - for(x=0;x<=w;x++) - { - INT32 x1 = (x+gx); - - x1 += right ? -gp : gp; - - if ((x1 < cliprect.min_x) || (x1 > cliprect.max_x)) - continue; - - int src_x; - src_x = x+mx; - if (mode==1) - src_x += (INT16)READ_BGMAP(param_base + (y*2+(right ^ 1))); - - src_x += right ? -mp : mp; - - - int pix = 0; - if(ovr) - { - if ((src_x > x_mask || src_y > y_mask || src_x < 0 || src_y < 0)) - { - g_profiler.start(PROFILER_USER3); - pix = READ_OVR_TEMPDRAW_MAP((src_y & 7)*8+(src_x & 7)); - g_profiler.stop(); - } - else - { - pix = get_bg_map_pixel(bg_map_num, src_x & x_mask, src_y & y_mask); - } - } - else - { - pix = get_bg_map_pixel(bg_map_num, src_x & x_mask, src_y & y_mask); - } - - if(pix != -1) - bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); - } - } -// g_profiler.stop(); -} - -void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 param_base, int gx, int gp, int gy, int h, int w, - UINT16 x_mask, UINT16 y_mask, UINT8 ovr, bool right, int bg_map_num) -{ -// g_profiler.start(PROFILER_USER3); - int x,y; - - for(y=0;y<=h;y++) - { - float h_skw = (INT16)READ_BGMAP(param_base + (y*8+0)) / 8.0; - float prlx = (INT16)READ_BGMAP(param_base + (y*8+1)) / 8.0; - float v_skw = (INT16)READ_BGMAP(param_base + (y*8+2)) / 8.0; - float h_scl = (INT16)READ_BGMAP(param_base + (y*8+3)) / 512.0; - float v_scl = (INT16)READ_BGMAP(param_base + (y*8+4)) / 512.0; - - h_skw += right ? -prlx : prlx; - - for(x=0;x<=w;x++) - { - INT32 src_x,src_y; - INT16 y1 = (y+gy); - INT16 x1 = (x+gx); - int pix = 0; - - x1 += right ? -gp : gp; - - src_x = (INT32)((h_skw) + (h_scl * x)); - src_y = (INT32)((v_skw) + (v_scl * x)); - - if(ovr && (src_y > y_mask || src_x > x_mask || src_x < 0 || src_y < 0)) - { - pix = READ_OVR_TEMPDRAW_MAP((src_y & 7)*8+(src_x & 7)); - } - else - { - pix = get_bg_map_pixel(bg_map_num, src_x & x_mask, src_y & y_mask); - } - - if(pix != -1) - if (cliprect.contains(x1, y1)) - bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); - } - } -// g_profiler.stop(); -} - -/* -x--- ---- ---- ---- [0] LON --x-- ---- ---- ---- RON ---xx ---- ---- ---- BGM type ----- xx-- ---- ---- SCX ----- --xx ---- ---- SCY ----- ---- x--- ---- OVR ----- ---- -x-- ---- END ----- ---- --00 ---- ----- ---- ---- xxxx BGMAP_BASE -*/ - -UINT8 vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle &cliprect, bool right, int &cur_spt) -{ - num <<= 4; - UINT16 def = READ_WORLD(num); - UINT8 lon = (def >> 15) & 1; - UINT8 ron = (def >> 14) & 1; - UINT8 mode = (def >> 12) & 3; - UINT16 scx = 64 << ((def >> 10) & 3); - UINT16 scy = 64 << ((def >> 8) & 3); - UINT8 ovr = (def >> 7) & 1; - UINT8 end = (def >> 6) & 1; - INT16 gx = READ_WORLD(num+1); - INT16 gp = READ_WORLD(num+2); - INT16 gy = READ_WORLD(num+3); - INT16 mx = READ_WORLD(num+4); - INT16 mp = READ_WORLD(num+5); - INT16 my = READ_WORLD(num+6); - UINT16 w = READ_WORLD(num+7); - UINT16 h = READ_WORLD(num+8); - UINT16 param_base = READ_WORLD(num+9) & 0xfff0; - UINT16 ovr_char = READ_BGMAP(READ_WORLD(num+10)); - UINT8 bg_map_num = def & 0x0f; - int i; - - if(end) - return 1; - - if (mode < 2) // Normal / HBias Mode - { - if(ovr) - fill_ovr_char(ovr_char & 0x3fff, m_vip_regs.GPLT[(ovr_char >> 14) & 3]); - - if (lon && (!right)) - { - draw_bg_map(bitmap, cliprect, param_base, mode, gx, gp, gy, mx, mp, my, h,w, scx*8-1, scy*8-1, ovr, right, bg_map_num); - } - - if (ron && (right)) - { - draw_bg_map(bitmap, cliprect, param_base, mode, gx, gp, gy, mx, mp, my, h,w, scx*8-1, scy*8-1, ovr, right, bg_map_num); - } - } - else if (mode==2) // Affine Mode - { - if(ovr) - fill_ovr_char(ovr_char & 0x3fff, m_vip_regs.GPLT[(ovr_char >> 14) & 3]); - - if (lon && (!right)) - { - draw_affine_map(bitmap, cliprect, param_base, gx, gp, gy, h,w, scx*8-1, scy*8-1, ovr, right, bg_map_num); - } - - if (ron && (right)) - { - draw_affine_map(bitmap, cliprect, param_base, gx, gp, gy, h,w, scx*8-1, scy*8-1, ovr, right, bg_map_num); - } - } - else if (mode==3) // OBJ Mode - { - int start_offs, end_offs; - - if(cur_spt == -1) - { - popmessage("Cur spt used with -1 pointer!"); - return 0; - } - - start_offs = m_vip_regs.SPT[cur_spt]; - - end_offs = 0x3ff; - if(cur_spt != 0) - end_offs = m_vip_regs.SPT[cur_spt-1]; - - i = start_offs; - do - { - UINT16 start_ndx = i * 4; - INT16 jx = READ_OBJECTS(start_ndx+0); - INT16 jp = READ_OBJECTS(start_ndx+1) & 0x3fff; - INT16 jy = READ_OBJECTS(start_ndx+2) & 0x1ff; - UINT16 val = READ_OBJECTS(start_ndx+3); - UINT8 jlon = (READ_OBJECTS(start_ndx+1) & 0x8000) >> 15; - UINT8 jron = (READ_OBJECTS(start_ndx+1) & 0x4000) >> 14; - - if (!right && jlon) - put_obj(bitmap, cliprect, (jx-jp) & 0x1ff, jy, val & 0x3fff, m_vip_regs.JPLT[(val>>14) & 3]); - - if(right && jron) - put_obj(bitmap, cliprect, (jx+jp) & 0x1ff, jy, val & 0x3fff, m_vip_regs.JPLT[(val>>14) & 3]); - - i --; - i &= 0x3ff; - }while(i != end_offs); - - if((lon && !right) || (ron && right)) - cur_spt --; - } - - return 0; -} - -UINT32 vboy_state::screen_update_vboy_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(m_palette->pen(m_vip_regs.BKCOL), cliprect); - int cur_spt; - - if(!(m_vip_regs.DPCTRL & 2)) /* Don't bother if screen is off */ - return 0; - - cur_spt = 3; - for(int i=31; i>=0; i--) - if (display_world(i, bitmap, cliprect, false, cur_spt)) break; - - if(0) - { - int x,y; - - for(y=0;y<224;y++) - { - for(x=0;x<384;x++) - { - UINT8 pen; - UINT8 pix; - int yi; - - pen = m_l_frame_1[(x*0x40)+(y >> 2)]; - yi = ((y & 0x3)*2); - pix = (pen >> yi) & 3; - - bitmap.pix16(y, x) = m_palette->pen(pix & 3); - } - } - } - - return 0; -} - -UINT32 vboy_state::screen_update_vboy_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(m_palette->pen(m_vip_regs.BKCOL), cliprect); - int cur_spt; - - if(!(m_vip_regs.DPCTRL & 2)) /* Don't bother if screen is off */ - return 0; - - cur_spt = 3; - for(int i=31; i>=0; i--) - if (display_world(i, bitmap, cliprect, true, cur_spt)) break; - - return 0; -} - -/********************************** - * - * I/O - * - *********************************/ - -READ32_MEMBER( vboy_state::io_r ) -{ - UINT32 value = 0x00; - - switch ((offset << 2)) - { - case 0x10: // KLB (Keypad Low Byte) - value = m_vboy_regs.klb; // 0x02 is always 1 - break; - case 0x14: // KHB (Keypad High Byte) - value = m_vboy_regs.khb; - break; - case 0x18: // TLB (Timer Low Byte) - value = m_vboy_regs.tlb; - break; - case 0x1c: // THB (Timer High Byte) - value = m_vboy_regs.thb; - break; - case 0x20: // TCR (Timer Control Reg) - value = m_vboy_regs.tcr; - break; - case 0x24: // WCR (Wait State Control Reg) - value = m_vboy_regs.wcr; - break; - case 0x28: // KCR (Keypad Control Reg) - { -// attotime new_time = machine().time(); - -// if((new_time - m_input_latch_time) < m_maincpu->cycles_to_attotime(640)) - value |= machine().rand() & 2; - - value = m_vboy_regs.kcr | 0x4c; - } - break; - case 0x00: // LPC (Link Port Control Reg) - case 0x04: // LPC2 (Link Port Control Reg) - case 0x08: // LPT (Link Port Transmit) - case 0x0c: // LPR (Link Port Receive) - default: - logerror("Unemulated read: offset %08x\n", 0x02000000 + (offset << 2)); - break; - } - return value; -} - -WRITE32_MEMBER( vboy_state::io_w ) -{ - switch (offset<<2) - { - case 0x0c: // LPR (Link Port Receive) - case 0x10: // KLB (Keypad Low Byte) - case 0x14: // KHB (Keypad High Byte) - //logerror("Ilegal write: offset %02x should be only read\n", offset); - break; - case 0x18: // TLB (Timer Low Byte) - m_vboy_regs.tlb = data; - m_vboy_timer.latch = m_vboy_regs.tlb | (m_vboy_timer.latch & 0xff00); - break; - case 0x1c: // THB (Timer High Byte) - m_vboy_regs.thb = data; - m_vboy_timer.latch = (m_vboy_regs.thb<<8) | (m_vboy_timer.latch & 0xff); - break; - case 0x20: // TCR (Timer Control Reg) - /* - 111- ---- always 1 - ---x ---- timer select (1=20 us, 0=100 us) - ---- x--- timer irq - ---- -x-- resets timer zero flag - ---- --x- timer is zero flag - ---- ---x enables timer - */ - if (!(data & 0x08)) - { - m_maincpu->set_input_line(1, CLEAR_LINE); - } - - if (data & 1) - { - m_vboy_regs.tlb = m_vboy_timer.latch & 0xff; - m_vboy_regs.thb = m_vboy_timer.latch >> 8; - m_vboy_timer.count = m_vboy_timer.latch; - - // only start timer if tcr & 1 is 1 and wasn't before? - if (!(m_vboy_regs.tcr & 1)) - { - if (data & 0x10) - { - m_maintimer->adjust(attotime::from_hz(50000)); - } - else - { - m_maintimer->adjust(attotime::from_hz(10000)); - } - - } - } - - m_vboy_regs.tcr = (data & 0xfd) | (0xe4) | (m_vboy_regs.tcr & 2); // according to docs: bits 5, 6 & 7 are unused and set to 1, bit 1 is read only. - if(data & 4) - m_vboy_regs.tcr &= 0xfd; - break; - case 0x24: // WCR (Wait State Control Reg) - m_vboy_regs.wcr = data | 0xfc; // according to docs: bits 2 to 7 are unused and set to 1. - break; - case 0x28: // KCR (Keypad Control Reg) - if (data & 0x04 ) - { - m_vboy_regs.klb = (ioport("INPUT")->read() & 0x00ff); - m_vboy_regs.khb = (ioport("INPUT")->read() & 0xff00) >> 8; - //m_input_latch_time = machine().time(); - } - - if (data & 1) - { - m_vboy_regs.klb = 0; - m_vboy_regs.khb = 0; - //m_input_latch_time = attotime::zero; - } - - - m_vboy_regs.kcr = (data | 0x48) & 0xfd; // according to docs: bit 6 & bit 3 are unused and set to 1, bit 1 is read only. - break; - case 0x00: // LPC (Link Port Control Reg) - case 0x04: // LPC2 (Link Port Control Reg) - case 0x08: // LPT (Link Port Transmit) - default: - logerror("Unemulated write: offset %08x, data %04x\n", 0x02000000 + (offset << 2), data); - break; - } -} - - -/********************************** - * - * VIP - * - *********************************/ -/* -TODO: brightness presumably isn't a linear algorythm, also REST needs to be taken into account (needs a working example) -*/ -void vboy_state::m_set_brightness(void) -{ - int a,b,c; - - //d = (m_vip_regs.BRTA + m_vip_regs.BRTB + m_vip_regs.BRTC + m_vip_regs.REST); - a = (0xff * (m_vip_regs.BRTA)) / 0x80; - b = (0xff * (m_vip_regs.BRTA + m_vip_regs.BRTB)) / 0x80; - c = (0xff * (m_vip_regs.BRTA + m_vip_regs.BRTB + m_vip_regs.BRTC)) / 0x80; - - if(a < 0) { a = 0; } - if(b < 0) { b = 0; } - if(c < 0) { c = 0; } - if(a > 0xff) { a = 0xff; } - if(b > 0xff) { b = 0xff; } - if(c > 0xff) { c = 0xff; } - -// popmessage("%02x %02x %02x %02x",m_vip_regs.BRTA,m_vip_regs.BRTB,m_vip_regs.BRTC,m_vip_regs.REST); - m_palette->set_pen_color(1, a,0,0); - m_palette->set_pen_color(2, b,0,0); - m_palette->set_pen_color(3, c,0,0); -} - -READ16_MEMBER( vboy_state::vip_r ) -{ - switch(offset << 1) { - case 0x00: //INTPND - return m_vip_regs.INTPND; - case 0x02: //INTENB - return m_vip_regs.INTENB; - case 0x04: //INTCLR - logerror("Error reading INTCLR\n"); - break; -/* - ---- -x-- ---- ---- LOCK (status column table address (CTA) lock) - ---- --x- ---- ---- SYNCE (status of sync signal enable) - ---- ---x ---- ---- RE (status of memory refresh cycle) - ---- ---- x--- ---- FCLK - ---- ---- -x-- ---- SCANRDY (active low) - ---- ---- --xx xx-- DPBSY (current framebuffer displayed) - ---- ---- --10 00-- RFB1 - ---- ---- --01 00-- LFB1 - ---- ---- --00 10-- RFB0 - ---- ---- --00 01-- LFB0 - ---- ---- ---- --x- DISP -*/ - case 0x20: //DPSTTS - { - UINT16 res; - - res = m_vip_regs.DPCTRL & 0x0702; - - if(m_vip_regs.DPCTRL & 2) - { - if(m_row_num < 224/8) - { - if(m_displayfb == 0) - res |= 0x0c; - else - res |= 0x30; - } - } - - res |= 0x40; - //printf("%04x\n",res); - return res; - } - case 0x22: //DPCTRL - return m_vip_regs.DPCTRL; - case 0x24: //BRTA - return m_vip_regs.BRTA; - case 0x26: //BRTB - return m_vip_regs.BRTB; - case 0x28: //BRTC - return m_vip_regs.BRTC; - case 0x2A: //REST - return m_vip_regs.REST; - case 0x2E: //FRMCYC - return m_vip_regs.FRMCYC; - case 0x30: //CTA - printf("Read CTA\n"); - return m_vip_regs.CTA; - case 0x40: //XPSTTS, piXel Processor STaTuS - { - /* - x--- ---- ---- ---- SBOUT - ---x xxxx ---- ---- SBCOUNT - ---- ---- ---x ---- OVERTIME (process overflow) - ---- ---- ---- x--- XPBSY1 (second framebuffer busy flag) - ---- ---- ---- -x-- XPBSY0 (first framebfuffer busy flag) - ---- ---- ---- --x- XPEN (starts drawing at beginning of game frame) - ---- ---- ---- ---x XPRST (force drawing process to idle) - */ - UINT16 res; - - //printf("%d\n",row_num); - - res = m_vip_regs.XPSTTS & 0x00f3; // empty ^^' - res |= m_drawfb << 2; - - if(m_row_num < 224/8) - { - res |= 0x8000; - res |= m_row_num<<8; - } - - return res; - } - case 0x42: //XPCTRL - return m_vip_regs.XPCTRL; - case 0x44: //VER - printf("%08x read VER\n",m_maincpu->pc()); - return m_vip_regs.VER; - case 0x48: //SPT0 - return m_vip_regs.SPT[0]; - case 0x4A: //SPT1 - return m_vip_regs.SPT[1]; - case 0x4C: //SPT2 - return m_vip_regs.SPT[2]; - case 0x4E: //SPT3 - return m_vip_regs.SPT[3]; - case 0x60: //GPLT0 - return m_vip_regs.GPLT[0]; - case 0x62: //GPLT1 - return m_vip_regs.GPLT[1]; - case 0x64: //GPLT2 - return m_vip_regs.GPLT[2]; - case 0x66: //GPLT3 - return m_vip_regs.GPLT[3]; - case 0x68: //JPLT0 - return m_vip_regs.JPLT[0]; - case 0x6A: //JPLT1 - return m_vip_regs.JPLT[1]; - case 0x6C: //JPLT2 - return m_vip_regs.JPLT[2]; - case 0x6E: //JPLT3 - return m_vip_regs.JPLT[3]; - case 0x70: //BKCOL - return m_vip_regs.BKCOL; - default: - logerror("Unemulated read: addr %08x\n", offset * 2 + 0x0005f800); - break; - } - return 0xffff; -} - -WRITE16_MEMBER( vboy_state::vip_w ) -{ - if(mem_mask != 0xffff) - printf("%04x %02x\n",mem_mask,offset*2); - - switch(offset << 1) { - /* - x--- ---- ---- ---- TIME_ERR - -x-- ---- ---- ---- XP_END - --x- ---- ---- ---- SB_HIT - ---- ---- ---x ---- FRAME_START - ---- ---- ---- x--- GAME_START - ---- ---- ---- -x-- RFB_END - ---- ---- ---- --x- LFB_END - ---- ---- ---- ---x SCAN_ERR - */ - case 0x00: //INTPND - logerror("Error writing INTPND\n"); - break; - case 0x02: //INTENB - m_vip_regs.INTENB = data; - m_set_irq(0); - //printf("%04x ENB\n",data); - break; - case 0x04: //INTCLR - m_vip_regs.INTPND &= ~data; - m_set_irq(0); - //else - // printf("%04x\n",m_vip_regs.INTPND); - break; - case 0x20: //DPSTTS - logerror("Error writing DPSTTS\n"); - break; -/* - ---- -x-- ---- ---- LOCK (status column table address (CTA) lock) - ---- --x- ---- ---- SYNCE (status of sync signal enable) - ---- ---x ---- ---- RE (status of memory refresh cycle) - ---- ---- ---- --x- DISP - ---- ---- ---- ---x DPRST (Resets the VIP internal counter) -*/ - case 0x22: //DPCTRL - m_vip_regs.DPCTRL = data & 0x0702; - - if(data & 1) - { - m_vip_regs.INTPND &= 0xe000; // reset FRAME_START, GAME_START, RFB_END, LFB_END and SCAN_ERR irqs - m_set_irq(0); - } - break; - case 0x24: //BRTA - m_vip_regs.BRTA = data; - m_set_brightness(); - break; - case 0x26: //BRTB - m_vip_regs.BRTB = data; - m_set_brightness(); - break; - case 0x28: //BRTC - m_vip_regs.BRTC = data; - m_set_brightness(); - break; - case 0x2A: //REST - m_vip_regs.REST = data; - m_set_brightness(); - if(data) - printf("%04x REST\n",data); - break; - case 0x2E: //FRMCYC - //printf("%d\n",data); - m_vip_regs.FRMCYC = data; - break; - case 0x30: //CTA - m_vip_regs.CTA = data; - printf("%04x CTA\n",data); - break; - case 0x40: //XPSTTS - logerror("Error writing XPSTTS\n"); - break; - case 0x42: //XPCTRL, w/o - /* - ---- ---- ---- --x- - ---- ---- ---- ---x Reset Pixel Processor - */ - m_vip_regs.XPCTRL = data & 0x1f02; - - //if(data & 0x1f00) - // printf("%04x SBCMP\n",data); - - if(data & 1) - { - m_vip_regs.INTPND &= 0x1fff; // reset SB_HIT, XP_END and TIME_ERR irqs - m_set_irq(0); - } - break; - case 0x44: //VER - //m_vip_regs.VER = data; - break; - case 0x48: //SPT0 - m_vip_regs.SPT[0] = data & 0x3ff; - break; - case 0x4A: //SPT1 - m_vip_regs.SPT[1] = data & 0x3ff; - break; - case 0x4C: //SPT2 - m_vip_regs.SPT[2] = data & 0x3ff; - break; - case 0x4E: //SPT3 - m_vip_regs.SPT[3] = data & 0x3ff; - break; - case 0x60: //GPLT0 - m_vip_regs.GPLT[0] = data; - break; - case 0x62: //GPLT1 - m_vip_regs.GPLT[1] = data; - break; - case 0x64: //GPLT2 - m_vip_regs.GPLT[2] = data; - break; - case 0x66: //GPLT3 - m_vip_regs.GPLT[3] = data; - break; - case 0x68: //JPLT0 - m_vip_regs.JPLT[0] = data & 0xfc; - break; - case 0x6A: //JPLT1 - m_vip_regs.JPLT[1] = data & 0xfc; - break; - case 0x6C: //JPLT2 - m_vip_regs.JPLT[2] = data & 0xfc; - break; - case 0x6E: //JPLT3 - m_vip_regs.JPLT[3] = data & 0xfc; - break; - case 0x70: //BKCOL - m_vip_regs.BKCOL = data & 3; - break; - default: - logerror("Unemulated write: addr %08x, data %04x\n", offset * 2 + 0x0005f800, data); - break; - } -} - - - -WRITE16_MEMBER( vboy_state::font0_w ) -{ - WRITE_FONT(offset); -} - -WRITE16_MEMBER( vboy_state::font1_w ) -{ - WRITE_FONT(offset+0x1000); -} - -WRITE16_MEMBER( vboy_state::font2_w ) -{ - WRITE_FONT(offset+0x2000); -} - -WRITE16_MEMBER( vboy_state::font3_w ) -{ - WRITE_FONT(offset+0x3000); -} - -READ16_MEMBER( vboy_state::font0_r ) -{ - return READ_FONT(offset); -} - -READ16_MEMBER( vboy_state::font1_r ) -{ - return READ_FONT(offset + 0x1000); -} - -READ16_MEMBER( vboy_state::font2_r ) -{ - return READ_FONT(offset + 0x2000); -} - -READ16_MEMBER( vboy_state::font3_r ) -{ - return READ_FONT(offset + 0x3000); -} - -WRITE16_MEMBER( vboy_state::vboy_bgmap_w ) -{ - m_bgmap[offset] = data | (m_bgmap[offset] & (mem_mask ^ 0xffff)); -} - -READ16_MEMBER( vboy_state::vboy_bgmap_r ) -{ - return m_bgmap[offset]; -} - -READ8_MEMBER( vboy_state::lfb0_r ) { return m_l_frame_0[offset]; } -READ8_MEMBER( vboy_state::lfb1_r ) { return m_l_frame_1[offset]; } -READ8_MEMBER( vboy_state::rfb0_r ) { return m_r_frame_0[offset]; } -READ8_MEMBER( vboy_state::rfb1_r ) { return m_r_frame_1[offset]; } -WRITE8_MEMBER( vboy_state::lfb0_w ) { m_l_frame_0[offset] = data; } -WRITE8_MEMBER( vboy_state::lfb1_w ) { m_l_frame_1[offset] = data; } -WRITE8_MEMBER( vboy_state::rfb0_w ) { m_r_frame_0[offset] = data; } -WRITE8_MEMBER( vboy_state::rfb1_w ) { m_r_frame_1[offset] = data; } - - -static ADDRESS_MAP_START( vboy_mem, AS_PROGRAM, 32, vboy_state ) - ADDRESS_MAP_GLOBAL_MASK(0x07ffffff) - AM_RANGE( 0x00000000, 0x00005fff ) AM_READWRITE8(lfb0_r, lfb0_w,0xffffffff) // L frame buffer 0 - AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 - AM_RANGE( 0x00008000, 0x0000dfff ) AM_READWRITE8(lfb1_r, lfb1_w,0xffffffff) // L frame buffer 1 - AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 - AM_RANGE( 0x00010000, 0x00015fff ) AM_READWRITE8(rfb0_r, rfb0_w,0xffffffff) // R frame buffer 0 - AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 - AM_RANGE( 0x00018000, 0x0001dfff ) AM_READWRITE8(rfb1_r, rfb1_w,0xffffffff) // R frame buffer 1 - AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 - - AM_RANGE( 0x00020000, 0x0003ffff ) AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory - - //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC - AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff) - - AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 mirror - AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 mirror - AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 mirror - AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 mirror - - AM_RANGE( 0x01000000, 0x010005ff ) AM_DEVREADWRITE8("vbsnd", vboysnd_device, read, write, 0xffffffff) - AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff - //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area - AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram")// Main RAM - 64K mask 0xffff - AM_RANGE( 0x06000000, 0x06003fff ) AM_DEVREADWRITE("cartslot", vboy_cart_slot_device, read_eeprom, write_eeprom) // Cart RAM - 8K NVRAM -// AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( vboy_io, AS_IO, 32, vboy_state ) - ADDRESS_MAP_GLOBAL_MASK(0x07ffffff) - AM_RANGE( 0x00000000, 0x00005fff ) AM_RAM AM_SHARE("l_frame_0") // L frame buffer 0 - AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 - AM_RANGE( 0x00008000, 0x0000dfff ) AM_RAM AM_SHARE("l_frame_1") // L frame buffer 1 - AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 - AM_RANGE( 0x00010000, 0x00015fff ) AM_RAM AM_SHARE("r_frame_0") // R frame buffer 0 - AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 - AM_RANGE( 0x00018000, 0x0001dfff ) AM_RAM AM_SHARE("r_frame_1") // R frame buffer 1 - AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 - - AM_RANGE( 0x00020000, 0x0003ffff ) AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory - - //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC - AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff) - - AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 mirror - AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 mirror - AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 mirror - AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 mirror - - AM_RANGE( 0x01000000, 0x010005ff ) AM_DEVREADWRITE8("vbsnd", vboysnd_device, read, write, 0xffffffff) - AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff -// AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area - AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram") // Main RAM - 64K mask 0xffff - AM_RANGE( 0x06000000, 0x06003fff ) AM_NOP // Cart RAM - 8K NVRAM ? -// AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vboy ) - PORT_START("INPUT") - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1) - PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1) - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("L") PORT_PLAYER(1) // Left button on back - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("R") PORT_PLAYER(1) // Right button on back - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") PORT_PLAYER(1) // B button (Mario Clash Jump button) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") PORT_PLAYER(1) // A button - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED ) // Always 1 - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // Battery low -INPUT_PORTS_END - - -void vboy_state::machine_start() -{ - // install the cart ROM as a bank into the address map. - // this speeds up the rom access, by skipping the m_cart->read_rom - // trampoline (but forces us to alloc always a 0x200000-wide region) - if (m_cart->exists()) - { - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(VBOYSLOT_ROM_REGION_TAG).c_str()); - - m_maincpu->space(AS_PROGRAM).install_read_bank(0x07000000, 0x071fffff, 0, 0x0e00000, "prog_cart_bank"); - m_maincpu->space(AS_IO).install_read_bank(0x07000000, 0x071fffff, 0, 0x0e00000, "io_cart_bank"); - membank("prog_cart_bank")->set_base(m_cart_rom->base()); - membank("io_cart_bank")->set_base(m_cart_rom->base()); - - m_cart->save_eeprom(); - } -} - -void vboy_state::machine_reset() -{ - /* Initial values taken from Reality Boy, to be verified when emulation improves */ - m_vboy_regs.lpc = 0x6d; - m_vboy_regs.lpc2 = 0xff; - m_vboy_regs.lpt = 0x00; - m_vboy_regs.lpr = 0x00; - m_vboy_regs.klb = 0x00; - m_vboy_regs.khb = 0x00; - m_vboy_regs.tlb = 0xff; - m_vboy_regs.thb = 0xff; - m_vboy_regs.tcr = 0xe4; - m_vboy_regs.wcr = 0xfc; - m_vboy_regs.kcr = 0x4c | 0x80; - m_vip_regs.DPCTRL = 2; // ssquash relies on this at boot otherwise no frame_start irq is fired - m_displayfb = 0; - m_drawfb = 0; - - m_vboy_timer.count = 0; - m_maintimer->adjust(attotime::never); -} - - -void vboy_state::m_timer_tick() -{ - if(m_vboy_timer.count > 0) - { - m_vboy_timer.count--; - m_vboy_regs.tlb = m_vboy_timer.count & 0xff; - m_vboy_regs.thb = m_vboy_timer.count >> 8; - } - - if (m_vboy_timer.count == 0) - { - m_vboy_timer.count = m_vboy_timer.latch; - m_vboy_regs.tcr |= 0x02; - if(m_vboy_regs.tcr & 8) - { - m_maincpu->set_input_line(1, ASSERT_LINE); - } - } - - if (m_vboy_regs.tcr & 0x10) - { - m_maintimer->adjust(attotime::from_hz(50000)); - } - else - { - m_maintimer->adjust(attotime::from_hz(10000)); - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::timer_main_tick) -{ - m_timer_tick(); -} - -TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::timer_pad_tick) -{ - if((m_vboy_regs.kcr & 0x80) == 0) - m_maincpu->set_input_line(0, HOLD_LINE); -} - -PALETTE_INIT_MEMBER(vboy_state, vboy) -{ - palette.set_pen_color(0, rgb_t::black); - palette.set_pen_color(1, rgb_t::black); - palette.set_pen_color(2, rgb_t::black); - palette.set_pen_color(3, rgb_t::black); -} - -void vboy_state::m_set_irq(UINT16 irq_vector) -{ - m_vip_regs.INTPND |= irq_vector; - - if(m_vip_regs.INTENB & m_vip_regs.INTPND) - m_maincpu->set_input_line(4, ASSERT_LINE); - - if((m_vip_regs.INTENB & m_vip_regs.INTPND) == 0) - m_maincpu->set_input_line(4, CLEAR_LINE); -} - -/* TODO: obviously all of this needs clean-ups and better implementation ... */ -void vboy_state::m_scanline_tick(int scanline, UINT8 screen_type) -{ - //int frame_num = machine().first_screen()->frame_number(); - - if(screen_type == 0) - m_row_num = (scanline / 8) & 0x1f; - - if(scanline == 0) - { - if(m_vip_regs.DPCTRL & 2) - m_set_irq(0x0010); // FRAME_START - - m_frame_count++; - - if(m_frame_count > m_vip_regs.FRMCYC) - { - m_set_irq(0x0008); // GAME_START - m_frame_count = 0; - } - - if(m_vip_regs.DPCTRL & 2) - m_displayfb ^= 1; - } - - if(scanline == 224) - { - if(m_displayfb) - m_drawfb = 1; - else - m_drawfb = 2; - m_set_irq(0x4000); // XPEND - } - - if(scanline == 232) - { - m_drawfb = 0; - m_set_irq(0x0002); // LFBEND - } - - if(scanline == 240) - { - m_set_irq(0x0004); // RFBEND - } - - if(m_row_num == ((m_vip_regs.XPCTRL & 0x1f00) >> 8)) - { - m_set_irq(0x2000); // SBHIT - } - -} - -TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::vboy_scanlineL) -{ - int scanline = param; - - m_scanline_tick(scanline,0); -} - -#if 0 -TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::vboy_scanlineR) -{ - int scanline = param; - - //m_scanline_tick(scanline,1); -} -#endif - - -static SLOT_INTERFACE_START(vboy_cart) - SLOT_INTERFACE_INTERNAL("vb_rom", VBOY_ROM_STD) - SLOT_INTERFACE_INTERNAL("vb_eeprom", VBOY_ROM_EEPROM) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( vboy, vboy_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD( "maincpu", V810, XTAL_20MHz ) - MCFG_CPU_PROGRAM_MAP(vboy_mem) - MCFG_CPU_IO_MAP(vboy_io) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_l", vboy_state, vboy_scanlineL, "3dleft", 0, 1) - //MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_r", vboy_state, vboy_scanlineR, "3dright", 0, 1) - - // programmable timer - MCFG_TIMER_DRIVER_ADD("timer_main", vboy_state, timer_main_tick) - - // pad ready, which should be once per VBL - MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_pad", vboy_state, timer_pad_tick, attotime::from_hz(50.038029f)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_vboy) - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(vboy_state, vboy) - - /* Left screen */ - MCFG_SCREEN_ADD("3dleft", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_20MHz/2,757,0,384,264,0,224) - MCFG_SCREEN_UPDATE_DRIVER(vboy_state, screen_update_vboy_left) - MCFG_SCREEN_PALETTE("palette") - - /* Right screen */ - MCFG_SCREEN_ADD("3dright", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_20MHz/2,757,0,384,264,0,224) - MCFG_SCREEN_UPDATE_DRIVER(vboy_state, screen_update_vboy_right) - MCFG_SCREEN_PALETTE("palette") - - /* cartridge */ - MCFG_VBOY_CARTRIDGE_ADD("cartslot", vboy_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","vboy") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_VBOYSND_ADD("vbsnd") - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( vboy ) - ROM_REGION( 0x2000000, "maincpu", ROMREGION_ERASEFF ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 1995, vboy, 0, 0, vboy, vboy, driver_device, 0, "Nintendo", "Virtual Boy", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mess/drivers/vc4000.c b/src/mess/drivers/vc4000.c deleted file mode 100644 index 8e3c8d106fb..00000000000 --- a/src/mess/drivers/vc4000.c +++ /dev/null @@ -1,715 +0,0 @@ -// license:??? -// copyright-holders:Peter Trauner, Manfred Schneider, Robbbert -/****************************************************************************** - Peter Trauner May 2001 - - Paul Robson's Emulator at www.classicgaming.com/studio2 made it possible -******************************************************************************/ - -/***************************************************************************** -Additional Notes by Manfred Schneider -Memory Map -Memory mapping is done in two steps. The PVI(2636) provides the chip select signals -according to signals provided by the CPU address lines. -The PVI has 12 address line (A0-A11) which give him control over 4K. A11 of the PVI is not -connected to A11 of the CPU, but connected to the cartridge slot. On the cartridge it is -connected to A12 of the CPU which extends the addressable Range to 8K. This is also the -maximum usable space, because A13 and A14 of the CPU are not used. -With the above in mind address range will look like this: -$0000 - $15FF ROM, RAM -$1600 - $167F unused -$1680 - $16FF used for I/O Control on main PCB -$1700 - $17FF PVI internal Registers and RAM -$1800 - $1DFF ROM, RAM -$1E00 - $1E7F unused -$1E80 - $1EFF mirror of $1680 - $167F -$1F00 - $1FFF mirror of $1700 - $17FF -$2000 - $3FFF mirror of $0000 - $1FFF -$4000 - $5FFF mirror of $0000 - $1FFF -$6000 - $7FFF mirror of $0000 - $1FFF -On all cartridges for the Interton A11 from PVI is connected to A12 of the CPU. -There are four different types of Cartridges with the following memory mapping. -Type 1: 2K Rom or EPROM mapped from $0000 - $07FF -Type 2: 4K Rom or EPROM mapped from $0000 - $0FFF -Type 3: 4K Rom + 1K Ram - Rom is mapped from $0000 - $0FFF - Ram is mapped from $1000 - $13FF and mirrored from $1800 - $1BFF -Type 4: 6K Rom + 1K Ram - Rom is mapped from $0000 - $15FF (only 5,5K ROM visible to the CPU) - Ram is mapped from $1800 - $1BFF - -One other type is known for Radofin (rom compatible to VC4000, but not the Cartridge connector). -It consisted of a 2K ROM and 2K RAM which are most likely mapped as follows (needs to be confirmed): -2K Rom mapped from $0000 - $07FF -2K Ram mapped from $0800 - $0FFF -The Cartridge is called Hobby Module and the Rom is probably the same as used in -elektor TV Game Computer which is a kind of developer machine for the VC4000. - -****************************************************************************** - -Elektor TV Games Computer -This is much the same as the vc4000, however it has its own ROM (with inbuilt -monitor program similar to the Signetics Instructor 50), and 2K of ram. No cart -slot, no joystick, but has a cassette interface. - -ToDo: -- Most quickloads don't work too well -- Might need to rework keyboard, again - -When booted you get the familiar 00 00 pattern. Pressing Q gives a display of -IIII. Now, you enter a command. - -Key Command Purpose ------------------------- -Q Start Boot up system -L RCAS Load a tape -S WCAS Save a tape -W BP1/2 Set a breakpoint -R REG View/Set registers -X PC Go -+pad + Enter data and do next thing --pad - Decrement -- MEM Specify an address -0-9 0-9 Hex digits -A-F A-F Hex digits - -Keyboard layout when using the Monitor on real hardware (n/a = key not assigned) - -n/a RCAS WCAS C D E F -Start BP1/2 REG 8 9 A B -n/a PC MEM 4 5 6 7 -Reset - + 0 1 2 3 - -This wouldn't fit too well on our keyboard with any chance of remembering -it, so I've hooked it much the same as the Instructor. - -The Select key (Z) and the joystick don't actually exist, but I've left them -in the keyboard matrix for now. - - -Quickloads ----------- -You can load pgm and tvc files with the quickload facility. The quickloads -are meant for the ElektorTVGC, however with a bit a trickery they can be made -to work on the vc4000 as well. Procedure: - -- Get a copy of the Elektor bios and rename it to ELEKTOR.BIN then save it - with the rest of your vc4000 carts. - -- Start vc4000, and load ELEKTOR.BIN into the cartslot. Now your vc4000 - thinks it is an Elektor. - -- Load a quickload file. Some of them will work, and in some cases, better - than on the Elektor system. - - -Pasting -------- -This system uses the standard trainer paste codes: - 0-F : as is - + : ^ - - : V - MEM : - - MON : Q - -Here's a sample from the manual, page 34/35 (down-arrow to escape) -Q-0900^762005CA06CA0D4A00CD7F00FA780C1E88441099791F0000040005CA06CACD4A00FA7B -04FFCC0AC8CC0AC90409CC0AC60402CC0AC01F0900 --0A00^F15155757FFFFFC3A52480FF4FFF-0AC0^C018P0900^ - -Another sample, from page 94 (Q to escape) -Q-0900^76203F0161063005080E492DCD4890597877103F020E75105A0A0C1E89F4101879 -1F003877103F02CF75101B5A -17A2A2A2A2A2A217 -17171000000D1717 -0A171100BC17000F -17170D000E051717 -14150A0CBC120C0E -0A171112BCBC110EP0900^ - - -******************************************************************************/ - -#include "includes/vc4000.h" - -READ8_MEMBER( vc4000_state::vc4000_key_r ) -{ - UINT8 data=0; - switch(offset & 0x0f) - { - case 0x08: - data = m_keypad1_1->read(); - break; - case 0x09: - data = m_keypad1_2->read(); - break; - case 0x0a: - data = m_keypad1_3->read(); - break; - case 0x0b: - data = m_panel->read(); - break; - case 0x0c: - data = m_keypad2_1->read(); - break; - case 0x0d: - data = m_keypad2_2->read(); - break; - case 0x0e: - data = m_keypad2_3->read(); - break; - } - return data; -} - -WRITE8_MEMBER( vc4000_state::vc4000_sound_ctl ) -{ - logerror("Write to sound control register offset= %d value= %d\n", offset, data); -} - -// Write cassette - Address 0x1DFF -WRITE8_MEMBER( vc4000_state::elektor_cass_w ) -{ - m_cassette->output(BIT(data, 7) ? -1.0 : +1.0); -} - -// Read cassette - Address 0x1DBF -READ8_MEMBER( vc4000_state::elektor_cass_r ) -{ - return (m_cassette->input() > 0.03) ? 0xff : 0x7f; -} - -static ADDRESS_MAP_START( vc4000_mem, AS_PROGRAM, 8, vc4000_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x1fff) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x1680, 0x16ff) AM_READWRITE(vc4000_key_r, vc4000_sound_ctl) AM_MIRROR(0x0800) - AM_RANGE(0x1700, 0x17ff) AM_READWRITE(vc4000_video_r, vc4000_video_w) AM_MIRROR(0x0800) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( vc4000_io, AS_IO, 8, vc4000_state ) - AM_RANGE( S2650_SENSE_PORT,S2650_SENSE_PORT) AM_READ(vc4000_vsync_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(elektor_mem, AS_PROGRAM, 8, vc4000_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x1fff) - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0x15ff) AM_RAM - AM_RANGE(0x1d80, 0x1dff) AM_MIRROR(0x400) AM_READWRITE(elektor_cass_r,elektor_cass_w) - AM_RANGE(0x1e80, 0x1e8f) AM_MIRROR(0x800) AM_READWRITE(vc4000_key_r,vc4000_sound_ctl) - AM_RANGE(0x1f00, 0x1fff) AM_MIRROR(0x800) AM_READWRITE(vc4000_video_r, vc4000_video_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( vc4000 ) - PORT_START("PANEL") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Game Select") - - PORT_START("KEYPAD1_1") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Enter") PORT_CODE(KEYCODE_PLUS_PAD) - - PORT_START("KEYPAD1_2") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 0") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("KEYPAD1_3") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Clear") PORT_CODE(KEYCODE_MINUS_PAD) - - PORT_START("KEYPAD2_1") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Enter") PORT_CODE(KEYCODE_V) - - PORT_START("KEYPAD2_2") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 0") PORT_CODE(KEYCODE_F) - - PORT_START("KEYPAD2_3") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Clear") PORT_CODE(KEYCODE_R) -#ifndef ANALOG_HACK - // auto centering too slow, so only using 5 bits, and scaling at videoside - PORT_START("JOY1_X") -PORT_BIT(0xff,0x70,IPT_AD_STICK_X) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) - PORT_START("JOY1_Y") -PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) - PORT_START("JOY2_X") -PORT_BIT(0xff,0x70,IPT_AD_STICK_X) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_DEL) PORT_CODE_INC(KEYCODE_PGDN) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) - PORT_START("JOY2_Y") -PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_HOME) PORT_CODE_INC(KEYCODE_END) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) -#else - PORT_START("JOYS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CODE(KEYCODE_DEL) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CODE(KEYCODE_PGDN) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CODE(KEYCODE_END) PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CODE(KEYCODE_HOME) PORT_PLAYER(2) - - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x00, "Treat Joystick as...") - PORT_CONFSETTING( 0x00, "Buttons") - PORT_CONFSETTING( 0x01, "Paddle") -#endif -INPUT_PORTS_END - -INPUT_PORTS_START( elektor ) - PORT_START("PANEL") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MON") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Game Select") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - - PORT_START("KEYPAD1_1") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RCAS") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BP1/2") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - - PORT_START("KEYPAD1_2") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("WCAS") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MEM") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - - PORT_START("KEYPAD1_3") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - - PORT_START("KEYPAD2_1") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - - PORT_START("KEYPAD2_2") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - - PORT_START("KEYPAD2_3") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') -#ifndef ANALOG_HACK - // auto centering too slow, so only using 5 bits, and scaling at videoside - PORT_START("JOY1_X") -PORT_BIT(0xff,0x70,IPT_AD_STICK_X) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) - PORT_START("JOY1_Y") -PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) - PORT_START("JOY2_X") -PORT_BIT(0xff,0x70,IPT_AD_STICK_X) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_DEL) PORT_CODE_INC(KEYCODE_PGDN) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) - PORT_START("JOY2_Y") -PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_MINMAX(20,225) PORT_CODE_DEC(KEYCODE_HOME) PORT_CODE_INC(KEYCODE_END) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) -#else - PORT_START("JOYS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CODE(KEYCODE_DEL) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CODE(KEYCODE_PGDN) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CODE(KEYCODE_END) PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CODE(KEYCODE_HOME) PORT_PLAYER(2) - - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x00, "Treat Joystick as...") - PORT_CONFSETTING( 0x00, "Buttons") - PORT_CONFSETTING( 0x01, "Paddle") -#endif -INPUT_PORTS_END - -static const rgb_t vc4000_palette[] = -{ - // background colors - rgb_t(0, 0, 0), // black - rgb_t(0, 0, 175), // blue - rgb_t(0, 175, 0), // green - rgb_t(0, 255, 255), // cyan - rgb_t(255, 0, 0), // red - rgb_t(255, 0, 255), // magenta - rgb_t(200, 200, 0), // yellow - rgb_t(200, 200, 200), // white - /* sprite colors - The control line simply inverts the RGB lines all at once. - We can do that in the code with ^7 */ -}; - -PALETTE_INIT_MEMBER(vc4000_state, vc4000) -{ - palette.set_pen_colors(0, vc4000_palette, ARRAY_LENGTH(vc4000_palette)); -} - - -void vc4000_state::machine_start() -{ - if (m_cart->exists()) - { - // extra handler - switch (m_cart->get_type()) - { - case VC4000_STD: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x07ff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); - break; - case VC4000_ROM4K: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); - break; - case VC4000_RAM1K: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1000, 0x15ff, read8_delegate(FUNC(vc4000_cart_slot_device::read_ram),(vc4000_cart_slot_device*)m_cart), write8_delegate(FUNC(vc4000_cart_slot_device::write_ram),(vc4000_cart_slot_device*)m_cart)); - break; - case VC4000_CHESS2: - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x15ff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1800, 0x1bff, read8_delegate(FUNC(vc4000_cart_slot_device::read_ram),(vc4000_cart_slot_device*)m_cart), write8_delegate(FUNC(vc4000_cart_slot_device::write_ram),(vc4000_cart_slot_device*)m_cart)); - break; - // undumped Radofin Hobby Module -// case VC4000_HOBBY: -// m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x07ff, read8_delegate(FUNC(vc4000_cart_slot_device::read_rom),(vc4000_cart_slot_device*)m_cart)); -// m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0800, 0x0fff, read8_delegate(FUNC(vc4000_cart_slot_device::read_ram),(vc4000_cart_slot_device*)m_cart), write8_delegate(FUNC(vc4000_cart_slot_device::write_ram),(vc4000_cart_slot_device*)m_cart)); -// break; - } - - m_cart->save_ram(); - } -} - - -QUICKLOAD_LOAD_MEMBER( vc4000_state,vc4000) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int i; - int exec_addr; - int quick_length; - dynamic_buffer quick_data; - int read_; - int result = IMAGE_INIT_FAIL; - - quick_length = image.length(); - quick_data.resize(quick_length); - read_ = image.fread( &quick_data[0], quick_length); - if (read_ != quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file"); - image.message(" Cannot read the file"); - } - else - { - if (core_stricmp(image.filetype(), "tvc")==0) - { - if (quick_data[0] != 2) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); - image.message(" Invalid header"); - } - else - { - int quick_addr = quick_data[1] * 256 + quick_data[2]; - exec_addr = quick_data[3] * 256 + quick_data[4]; - - if (quick_length < 0x5) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); - image.message(" File too short"); - } - else - if ((quick_length + quick_addr - 5) > 0x1600) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); - image.message(" File too long"); - } - else - { - space.write_byte(0x08be, quick_data[3]); - space.write_byte(0x08bf, quick_data[4]); - - for (i = 5; i < quick_length; i++) - space.write_byte(i - 5 + quick_addr, quick_data[i]); - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length-5,quick_addr,quick_addr+quick_length-5,exec_addr); - - // Start the quickload - m_maincpu->set_state_int(S2650_PC, exec_addr); - result = IMAGE_INIT_PASS; - } - } - } - else - if (core_stricmp(image.filetype(), "pgm")==0) - { - if (quick_data[0] != 0) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header"); - image.message(" Invalid header"); - } - else - { - exec_addr = quick_data[1] * 256 + quick_data[2]; - - if (exec_addr >= quick_length) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file"); - image.message(" Exec address beyond end of file"); - } - else - if (quick_length < 0x904) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short"); - image.message(" File too short"); - } - else - if (quick_length > 0x2000) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long"); - image.message(" File too long"); - } - else - { - space.write_byte(0x08be, quick_data[1]); - space.write_byte(0x08bf, quick_data[2]); - - // load to 08C0-15FF (standard ram + extra) - int read_ = 0x1600; - if (quick_length < 0x1600) - read_ = quick_length; - for (i = 0x8c0; i < read_; i++) - space.write_byte(i, quick_data[i]); - - // load to 1F50-1FAF (PVI regs) - read_ = 0x1FB0; - if (quick_length < 0x1FB0) - read_ = quick_length; - if (quick_length > 0x1FC0) - for (i = 0x1F50; i < read_; i++) - vc4000_video_w(space, i-0x1f00, quick_data[i]); - - /* display a message about the loaded quickload */ - image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr); - - // Start the quickload - m_maincpu->set_state_int(S2650_PC, exec_addr); - result = IMAGE_INIT_PASS; - } - } - } - } - return result; -} - -static SLOT_INTERFACE_START(vc4000_cart) - SLOT_INTERFACE_INTERNAL("std", VC4000_ROM_STD) - SLOT_INTERFACE_INTERNAL("rom4k", VC4000_ROM_ROM4K) - SLOT_INTERFACE_INTERNAL("ram1k", VC4000_ROM_RAM1K) - SLOT_INTERFACE_INTERNAL("chess2", VC4000_ROM_CHESS2) -SLOT_INTERFACE_END - - -static MACHINE_CONFIG_START( vc4000, vc4000_state ) - /* basic machine hardware */ -// MCFG_CPU_ADD("maincpu", S2650, 865000) /* 3550000/4, 3580000/3, 4430000/3 */ - MCFG_CPU_ADD("maincpu", S2650, 3546875/4) - MCFG_CPU_PROGRAM_MAP(vc4000_mem) - MCFG_CPU_IO_MAP(vc4000_io) - MCFG_CPU_PERIODIC_INT_DRIVER(vc4000_state, vc4000_video_line, 312*53) // GOLF needs this exact value - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(226, 312) - MCFG_SCREEN_VISIBLE_AREA(8, 184, 0, 269) - MCFG_SCREEN_UPDATE_DRIVER(vc4000_state, screen_update_vc4000) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(vc4000_state, vc4000) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", VC4000_SND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", vc4000_state, vc4000, "pgm,tvc", 0) - - /* cartridge */ - MCFG_VC4000_CARTRIDGE_ADD("cartslot", vc4000_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "vc4000") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( cx3000tc, vc4000 ) - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list", "cx3000tc") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( mpu1000, vc4000 ) - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list", "mpu1000") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( database, vc4000 ) - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list", "database") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( rwtrntcs, vc4000 ) - MCFG_DEVICE_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_ADD("cart_list", "rwtrntcs") -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( elektor, vc4000 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(elektor_mem) - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -ROM_START( vc4000 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( spc4000 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( cx3000tc ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( tvc4000 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( 1292apvs ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( 1392apvs ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( mpu1000 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( mpu2000 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( pp1292 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( pp1392 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( f1392 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( fforce2 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( hmg1292 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( hmg1392 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( lnsy1392 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( vc6000 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( database ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( vmdtbase ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( rwtrntcs ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( telngtcs ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( krvnjvtv ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( oc2000 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( mpt05 ) - ROM_REGION( 0x2000,"maincpu", ROMREGION_ERASEFF ) -ROM_END - -ROM_START( elektor ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "elektor.rom", 0x0000, 0x0800, CRC(e6ef1ee1) SHA1(6823b5a22582344016415f2a37f9f3a2dc75d2a7)) -ROM_END - - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS(1978, vc4000, 0, 0, vc4000, vc4000, driver_device, 0, "Interton", "Interton Electronic VC 4000", MACHINE_IMPERFECT_GRAPHICS ) /* Germany, Austria, UK, Australia */ -CONS(1979, spc4000, vc4000, 0, vc4000, vc4000, driver_device, 0, "Grundig", "Super Play Computer 4000", MACHINE_IMPERFECT_GRAPHICS ) /* Germany, Austria */ -CONS(1979, cx3000tc, vc4000, 0, cx3000tc, vc4000, driver_device, 0, "Palson", "CX 3000 Tele Computer", MACHINE_IMPERFECT_GRAPHICS ) /* Spain */ -CONS(1979, tvc4000, vc4000, 0, vc4000, vc4000, driver_device, 0, "Koerting", "TVC-4000", MACHINE_IMPERFECT_GRAPHICS ) /* Argentina */ -CONS(1976, 1292apvs, 0, vc4000, vc4000, vc4000, driver_device, 0, "Radofin", "1292 Advanced Programmable Video System", MACHINE_IMPERFECT_GRAPHICS )/* Europe */ -CONS(1976, 1392apvs, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Radofin", "1392 Advanced Programmable Video System", MACHINE_IMPERFECT_GRAPHICS )/* Europe */ -CONS(1979, mpu1000, 1292apvs, 0, mpu1000, vc4000, driver_device, 0, "Acetronic", "MPU-1000", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ -CONS(1979, mpu2000, 1292apvs, 0, mpu1000, vc4000, driver_device, 0, "Acetronic", "MPU-2000", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ -CONS(1978, pp1292, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Audio Sonic", "PP-1292 Advanced Programmable Video System", MACHINE_IMPERFECT_GRAPHICS )/* Europe */ -CONS(1978, pp1392, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Audio Sonic", "PP-1392 Advanced Programmable Video System", MACHINE_IMPERFECT_GRAPHICS )/* Europe */ -CONS(1979, f1392, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Fountain", "Fountain 1392", MACHINE_IMPERFECT_GRAPHICS ) /* New Zealand */ -CONS(1979, fforce2, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Fountain", "Fountain Force 2", MACHINE_IMPERFECT_GRAPHICS ) /* New Zealand, Australia */ -CONS(1979, hmg1292, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Hanimex", "HMG 1292", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ -CONS(1979, hmg1392, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Hanimex", "HMG 1392", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ -CONS(1979, lnsy1392, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Lansay", "Lansay 1392", MACHINE_IMPERFECT_GRAPHICS ) /* Europe */ -CONS(1979, vc6000, 1292apvs, 0, vc4000, vc4000, driver_device, 0, "Prinztronic", "VC 6000", MACHINE_IMPERFECT_GRAPHICS ) /* UK */ -CONS(1979, database, 0, vc4000, database, vc4000, driver_device, 0, "Voltmace", "Voltmace Database", MACHINE_IMPERFECT_GRAPHICS ) /* UK */ -CONS(1979, vmdtbase, database, 0, database, vc4000, driver_device, 0, "Videomaster", "Videomaster Database Games-Computer", MACHINE_IMPERFECT_GRAPHICS )/* UK */ -CONS(1979, rwtrntcs, 0, vc4000, rwtrntcs, vc4000, driver_device, 0, "Rowtron", "Rowtron Television Computer System", MACHINE_IMPERFECT_GRAPHICS )/* UK */ -CONS(1979, telngtcs, rwtrntcs, 0, rwtrntcs, vc4000, driver_device, 0, "Teleng", "Teleng Television Computer System", MACHINE_IMPERFECT_GRAPHICS )/* UK */ -CONS(1979, krvnjvtv, 0, vc4000, vc4000, vc4000, driver_device, 0, "SOE", "OC Jeu Video TV Karvan", MACHINE_IMPERFECT_GRAPHICS ) /* France */ -CONS(1979, oc2000, krvnjvtv, 0, vc4000, vc4000, driver_device, 0, "SOE", "OC-2000", MACHINE_IMPERFECT_GRAPHICS ) /* France */ -CONS(1980, mpt05, 0, vc4000, vc4000, vc4000, driver_device, 0, "ITMC", "MPT-05", MACHINE_IMPERFECT_GRAPHICS ) /* France */ -CONS(1979, elektor, 0, 0, elektor, elektor, driver_device, 0, "Elektor", "Elektor TV Games Computer", MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/vcs80.c b/src/mess/drivers/vcs80.c deleted file mode 100644 index cd6e9512825..00000000000 --- a/src/mess/drivers/vcs80.c +++ /dev/null @@ -1,257 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - VCS-80 - - 12/05/2009 Skeleton driver. - - http://hc-ddr.hucki.net/entwicklungssysteme.htm#VCS_80_von_Eckhard_Schiller - -This system is heavily based on the tk80. The display and keyboard matrix -are very similar, while the operation is easier in the vcs80. The hardware -is completely different however. - -Pasting: - 0-F : as is - A+ : ^ - A- : V - MA : - - GO : X - -When booted, the system begins at 0000 which is ROM. You need to change the -address to 0400 before entering a program. Here is a test to paste in: -0400-11^22^33^44^55^66^77^88^99^0400- -Press the up-arrow to confirm data has been entered. - -Operation: -4 digits at left is the address; 2 digits at right is the data. -As you increment addresses, the middle 2 digits show the previous byte. -You can enter 4 digits, and pressing 'MA' will transfer this info -to the left, thus setting the address to this value. Press 'A+' to -store new data and increment the address. - -****************************************************************************/ - -#include "includes/vcs80.h" -#include "vcs80.lh" - -/* Read/Write Handlers */ - -READ8_MEMBER( vcs80_state::pio_r ) -{ - switch (offset) - { - case 0: return m_pio->control_read(); - case 1: return m_pio->control_read(); - case 2: return m_pio->data_read(1); - case 3: return m_pio->data_read(0); - } - - return 0; -} - -WRITE8_MEMBER( vcs80_state::pio_w ) -{ - switch (offset) - { - case 0: m_pio->control_write(1, data); break; - case 1: m_pio->control_write(0, data); break; - case 2: m_pio->data_write(1, data); break; - case 3: m_pio->data_write(0, data); break; - } -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( vcs80_mem, AS_PROGRAM, 8, vcs80_state ) - AM_RANGE(0x0000, 0x01ff) AM_ROM - AM_RANGE(0x0400, 0x07ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( vcs80_io, AS_IO, 8, vcs80_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x04, 0x07) AM_READWRITE(pio_r, pio_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( vcs80 ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A-") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MA") PORT_CODE(KEYCODE_M) PORT_CHAR('-') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RE") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TR") PORT_CODE(KEYCODE_T) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ST") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PE") PORT_CODE(KEYCODE_P) -INPUT_PORTS_END - -/* Z80-PIO Interface */ - -TIMER_DEVICE_CALLBACK_MEMBER(vcs80_state::vcs80_keyboard_tick) -{ - if (m_keyclk) - { - m_keylatch++; - m_keylatch &= 7; - } - - m_pio->port_a_write(m_keyclk << 7); - - m_keyclk = !m_keyclk; -} - -READ8_MEMBER( vcs80_state::pio_pa_r ) -{ - /* - - bit description - - PA0 keyboard and led latch bit 0 - PA1 keyboard and led latch bit 1 - PA2 keyboard and led latch bit 2 - PA3 GND - PA4 keyboard row input 0 - PA5 keyboard row input 1 - PA6 keyboard row input 2 - PA7 demultiplexer clock input - - */ - - UINT8 data = 0; - - /* keyboard and led latch */ - data |= m_keylatch; - - /* keyboard rows */ - data |= BIT(m_y0->read(), m_keylatch) << 4; - data |= BIT(m_y1->read(), m_keylatch) << 5; - data |= BIT(m_y2->read(), m_keylatch) << 6; - - /* demultiplexer clock */ - data |= (m_keyclk << 7); - - return data; -} - -WRITE8_MEMBER( vcs80_state::pio_pb_w ) -{ - /* - - bit description - - PB0 VQD30 segment A - PB1 VQD30 segment B - PB2 VQD30 segment C - PB3 VQD30 segment D - PB4 VQD30 segment E - PB5 VQD30 segment G - PB6 VQD30 segment F - PB7 _A0 - - */ - - UINT8 led_data = BITSWAP8(data & 0x7f, 7, 5, 6, 4, 3, 2, 1, 0); - int digit = m_keylatch; - - /* skip middle digit */ - if (digit > 3) digit++; - - output_set_digit_value(8 - digit, led_data); -} - -/* Z80 Daisy Chain */ - -static const z80_daisy_config vcs80_daisy_chain[] = -{ - { Z80PIO_TAG }, - { NULL } -}; - -/* Machine Initialization */ - -void vcs80_state::machine_start() -{ - m_pio->strobe_a(1); - m_pio->strobe_b(1); - - /* register for state saving */ - save_item(NAME(m_keylatch)); - save_item(NAME(m_keyclk)); -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( vcs80, vcs80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_5MHz/2) /* U880D */ - MCFG_CPU_PROGRAM_MAP(vcs80_mem) - MCFG_CPU_IO_MAP(vcs80_io) - MCFG_CPU_CONFIG(vcs80_daisy_chain) - - /* keyboard timer */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", vcs80_state, vcs80_keyboard_tick, attotime::from_hz(1000)) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT( layout_vcs80 ) - - /* devices */ - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, XTAL_5MHz/2) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(vcs80_state, pio_pa_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(vcs80_state, pio_pb_w)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( vcs80 ) - ROM_REGION( 0x10000, Z80_TAG, 0 ) - ROM_LOAD( "monitor.rom", 0x0000, 0x0200, CRC(44aff4e9) SHA1(3472e5a9357eaba3ed6de65dee2b1c6b29349dd2) ) -ROM_END - -/* Driver Initialization */ - -DIRECT_UPDATE_MEMBER(vcs80_state::vcs80_direct_update_handler) -{ - /* _A0 is connected to PIO PB7 */ - m_pio->port_b_write((!BIT(address, 0)) << 7); - - return address; -} - -DRIVER_INIT_MEMBER(vcs80_state,vcs80) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(vcs80_state::vcs80_direct_update_handler), this)); - m_maincpu->space(AS_IO).set_direct_update_handler(direct_update_delegate(FUNC(vcs80_state::vcs80_direct_update_handler), this)); -} - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, vcs80, 0, 0, vcs80, vcs80, vcs80_state, vcs80, "Eckhard Schiller", "VCS-80", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/vector06.c b/src/mess/drivers/vector06.c deleted file mode 100644 index 8546573f221..00000000000 --- a/src/mess/drivers/vector06.c +++ /dev/null @@ -1,233 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Vector06c driver by Miodrag Milanovic - - 10/07/2008 Preliminary driver. - -****************************************************************************/ - -#include "includes/vector06.h" -#include "formats/vector06_dsk.h" - - -/* Address maps */ -static ADDRESS_MAP_START(vector06_mem, AS_PROGRAM, 8, vector06_state) - AM_RANGE( 0x0000, 0x7fff ) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") - AM_RANGE( 0x8000, 0xffff ) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vector06_io, AS_IO, 8, vector06_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x00, 0x03) AM_READWRITE(vector06_8255_1_r, vector06_8255_1_w ) - AM_RANGE( 0x04, 0x07) AM_READWRITE(vector06_8255_2_r, vector06_8255_2_w ) - AM_RANGE( 0x0C, 0x0C) AM_WRITE(vector06_color_set) - AM_RANGE( 0x18, 0x18) AM_DEVREADWRITE("wd1793", fd1793_t, data_r, data_w) - AM_RANGE( 0x19, 0x19) AM_DEVREADWRITE("wd1793", fd1793_t, sector_r, sector_w) - AM_RANGE( 0x1a, 0x1a) AM_DEVREADWRITE("wd1793", fd1793_t, track_r, track_w) - AM_RANGE( 0x1b, 0x1b) AM_DEVREADWRITE("wd1793", fd1793_t, status_r, cmd_w) - AM_RANGE( 0x1C, 0x1C) AM_WRITE(vector06_disc_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vector06 ) - PORT_START("LINE.0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BkSp") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_START("LINE.1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_START("LINE.2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_START("LINE.3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_START("LINE.4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_START("LINE.5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_START("LINE.6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_START("LINE.7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_START("LINE.8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) - PORT_START("RESET") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset 2") PORT_CODE(KEYCODE_F12) - -INPUT_PORTS_END - - -FLOPPY_FORMATS_MEMBER( vector06_state::floppy_formats ) - FLOPPY_VECTOR06_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( vector06_floppies ) - SLOT_INTERFACE("qd", FLOPPY_525_QD) -SLOT_INTERFACE_END - - -/* Machine driver */ -static MACHINE_CONFIG_START( vector06, vector06_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8080, 3000000) -// MCFG_CPU_ADD("maincpu", Z80, 3000000) - MCFG_CPU_PROGRAM_MAP(vector06_mem) - MCFG_CPU_IO_MAP(vector06_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vector06_state, vector06_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vector06_state,vector06_irq_callback) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256+64, 256+64) - MCFG_SCREEN_VISIBLE_AREA(0, 256+64-1, 0, 256+64-1) - MCFG_SCREEN_UPDATE_DRIVER(vector06_state, screen_update_vector06) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(vector06_state, vector06) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD("ppi8255", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(vector06_state, vector06_8255_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(vector06_state, vector06_8255_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(vector06_state, vector06_8255_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(vector06_state, vector06_8255_portc_r)) - - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(vector06_state, vector06_romdisk_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(vector06_state, vector06_romdisk_portb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(vector06_state, vector06_romdisk_portc_w)) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_FD1793_ADD("wd1793", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("wd1793:0", vector06_floppies, "qd", vector06_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1793:1", vector06_floppies, "qd", vector06_state::floppy_formats) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vector06_cart") - MCFG_GENERIC_EXTENSIONS("bin,emr") - - MCFG_SOFTWARE_LIST_ADD("cart_list", "vector06_cart") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_DEFAULT_VALUE(0) -MACHINE_CONFIG_END - -/* ROM definition */ - -ROM_START( vector06 ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "unboot32k", "Universal Boot 32K") - ROMX_LOAD( "unboot32k.rt", 0x10000, 0x8000, CRC(28c9b5cd) SHA1(8cd7fb658896a7066ae93b10eaafa0f12139ad81), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "unboot2k", "Universal Boot 2K") - ROMX_LOAD( "unboot2k.rt", 0x10000, 0x0800, CRC(4c80dc31) SHA1(7e5e3acfdbea2e52b0d64c5868821deaec383815), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "coman", "Boot Coman") - ROMX_LOAD( "coman.rt", 0x10000, 0x0800, CRC(f8c4a85a) SHA1(47fa8b02f09a1d06aa63a2b90b2597b1d93d976f), ROM_BIOS(3)) - ROM_SYSTEM_BIOS(3, "bootbyte", "Boot Byte") - ROMX_LOAD( "bootbyte.rt", 0x10000, 0x0800, CRC(3b42fd9d) SHA1(a112f4fe519bc3dbee85b09040d4804a17c9eda2), ROM_BIOS(4)) - ROM_SYSTEM_BIOS(4, "bootos", "Boot OS") - ROMX_LOAD( "bootos.rt", 0x10000, 0x0200, CRC(46bef038) SHA1(6732f4a360cd38112c53c458842d31f5b035cf59), ROM_BIOS(5)) - ROM_SYSTEM_BIOS(5, "boot512", "Boot 512") - ROMX_LOAD( "boot512.rt", 0x10000, 0x0200, CRC(a0b1c6b2) SHA1(f6fe15cb0974aed30f9b7aa72133324a66d1ed3f), ROM_BIOS(6)) -ROM_END - -ROM_START( vec1200 ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "vec1200.bin", 0x10000, 0x2000, CRC(37349224) SHA1(060fbb2c1a89040c929521cfd58cb6f1431a8b75)) - - ROM_REGION( 0x0200, "palette", 0 ) - ROM_LOAD( "palette.bin", 0x0000, 0x0200, CRC(74b7376b) SHA1(fb56b60babd7e6ed68e5f4e791ad2800d7ef6729)) -ROM_END - -ROM_START( pk6128c ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "6128.bin", 0x10000, 0x4000, CRC(d4f68433) SHA1(ef5ac75f9240ca8996689c23642d4e47e5e774d8)) -ROM_END - -ROM_START( krista2 ) - ROM_REGION( 0x18000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "krista2.epr", 0x10000, 0x0200, CRC(df5440b0) SHA1(bcbbb3cc10aeb17c1262b45111d20279266b9ba4)) - ROM_LOAD( "krista2.pal", 0x0000, 0x0200, CRC(b243da33) SHA1(9af7873e6f8bf452c8d831833ffb02dce833c095)) -ROM_END -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, vector06, 0, 0, vector06, vector06, driver_device, 0, "", "Vector 06c", MACHINE_NOT_WORKING) -COMP( 1987, vec1200, vector06, 0, vector06, vector06, driver_device, 0, "", "Vector 1200", MACHINE_NOT_WORKING) -COMP( 1987, pk6128c, vector06, 0, vector06, vector06, driver_device, 0, "", "PK-6128c", MACHINE_NOT_WORKING) -COMP( 1987, krista2, vector06, 0, vector06, vector06, driver_device, 0, "", "Krista-2", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/vector4.c b/src/mess/drivers/vector4.c deleted file mode 100644 index 52a1e8c5938..00000000000 --- a/src/mess/drivers/vector4.c +++ /dev/null @@ -1,120 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Vector 4 - - 08/12/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class vector4_state : public driver_device -{ -public: - vector4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - DECLARE_READ8_MEMBER(vector4_02_r); - DECLARE_READ8_MEMBER(vector4_03_r); - DECLARE_WRITE8_MEMBER(vector4_02_w); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_term_data; - virtual void machine_reset(); -}; - - - -WRITE8_MEMBER( vector4_state::vector4_02_w ) -{ - if (data < 0xff) - m_terminal->write(space, 0, data); -} - -READ8_MEMBER( vector4_state::vector4_03_r ) -{ - return (m_term_data) ? 3 : 1; -} - -READ8_MEMBER( vector4_state::vector4_02_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -static ADDRESS_MAP_START(vector4_mem, AS_PROGRAM, 8, vector4_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xefff) AM_ROM - AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xf8ff) AM_ROM - AM_RANGE(0xfc00, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vector4_io, AS_IO, 8, vector4_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x02, 0x02) AM_READWRITE(vector4_02_r,vector4_02_w) - AM_RANGE(0x03, 0x03) AM_READ(vector4_03_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vector4 ) -INPUT_PORTS_END - - -void vector4_state::machine_reset() -{ - m_term_data = 0; - m_maincpu->set_state_int(Z80_PC, 0xe000); -} - -WRITE8_MEMBER( vector4_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( vector4, vector4_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(vector4_mem) - MCFG_CPU_IO_MAP(vector4_io) - - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(vector4_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( vector4 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - - ROM_SYSTEM_BIOS( 0, "v4c", "ver 4.0c" ) - ROMX_LOAD( "vg40cl_ihl.bin", 0xe000, 0x0400, CRC(dcaf79e6) SHA1(63619ddb12ff51e5862902fb1b33a6630f555ad7), ROM_BIOS(1)) - ROMX_LOAD( "vg40ch_ihl.bin", 0xe400, 0x0400, CRC(3ff97d70) SHA1(b401e49aa97ac106c2fd5ee72d89e683ebe34e34), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "v43", "ver 4.3" ) - ROMX_LOAD( "vg-em-43.bin", 0xe000, 0x1000, CRC(29a0fcee) SHA1(ca44de527f525b72f78b1c084c39aa6ce21731b5), ROM_BIOS(2)) - - ROM_SYSTEM_BIOS( 2, "v5", "ver 5.0" ) - ROMX_LOAD( "vg-zcb50.bin", 0xe000, 0x1000, CRC(22d692ce) SHA1(cbb21b0acc98983bf5febd59ff67615d71596e36), ROM_BIOS(3)) - ROM_LOAD( "mfdc.bin", 0xf800, 0x0100, CRC(d82a40d6) SHA1(cd1ef5fb0312cd1640e0853d2442d7d858bc3e3b)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, vector4, 0, 0, vector4, vector4, driver_device, 0, "Vector Graphics", "Vector 4", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/vg5k.c b/src/mess/drivers/vg5k.c deleted file mode 100644 index 8cbf24c352f..00000000000 --- a/src/mess/drivers/vg5k.c +++ /dev/null @@ -1,421 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Philips VG-5000mu - - Driver by Sandro Ronco with help from Daniel Coulom - - 05/2010 (Sandro Ronco) - - EF9345 video controller - - keyboard input ports - 05/2009 Skeleton driver. - - Known issues: - - 1200 bauds cassette don't works - - BASIC games hangs in default BIOS but works in alternative version - - Informations ( see the very informative http://vg5k.free.fr/ ): - - Variants: Radiola VG5000 and Schneider VG5000 - - CPU: Zilog Z80 running at 4MHz - - ROM: 18KB (16 KB BASIC + 2 KB charset ) - - RAM: 24 KB - - Video: SGS Thomson EF9345 processor - - Text mode: 25 rows x 40 columns - - Character matrix: 8 x 10 - - ASCII characters set, 128 graphics mode characters, 192 user characters. - - Graphics mode: not available within basic, only semi graphic is available. - - Colors: 8 - - Sound: Synthesizer, 4 Octaves - - Keyboard: 63 keys AZERTY, Caps Lock, CTRL key to access 33 BASIC instructions - - I/O: Tape recorder connector (1200/2400 bauds), Scart connector to TV (RGB), - External PSU (VU0022) connector, Bus connector (2x25 pins) - - There are 2 versions of the VG5000 ROM, one with Basic v1.0, - contained in two 8 KB ROMs, and one with Basic 1.1, contained in - a single 16 KB ROM. - - RAM: 24 KB (3 x 8 KB) type SRAM D4168C, more precisely: - 2 x 8 KB, used by the system - 1 x 8 KB, used by the video processor - - Memory Map: - $0000 - $3fff BASIC + monitor - $4000 - $47cf Screen - $47d0 - $7fff reserved area for BASIC, variables, etc - $8000 - $bfff Memory Expansion 16K or ROM cart - $c000 - $ffff Memory Expansion 32K or ROM cart - - This computer was NOT MSX-compatible! - - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "imagedev/printer.h" -#include "video/ef9345.h" -#include "sound/dac.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "formats/vg5k_cas.h" - - -class vg5k_state : public driver_device -{ -public: - vg5k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ef9345(*this, "ef9345"), - m_dac(*this, "dac"), - m_printer(*this, "printer"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG) - { } - - required_device m_maincpu; - required_device m_ef9345; - required_device m_dac; - required_device m_printer; - required_device m_cassette; - required_device m_ram; - - offs_t m_ef9345_offset; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( printer_r ); - DECLARE_WRITE8_MEMBER( printer_w ); - DECLARE_WRITE8_MEMBER ( ef9345_offset_w ); - DECLARE_READ8_MEMBER ( ef9345_io_r ); - DECLARE_WRITE8_MEMBER ( ef9345_io_w ); - DECLARE_READ8_MEMBER ( cassette_r ); - DECLARE_WRITE8_MEMBER ( cassette_w ); - DECLARE_DRIVER_INIT(vg5k); - TIMER_CALLBACK_MEMBER(z80_irq_clear); - TIMER_DEVICE_CALLBACK_MEMBER(z80_irq); - TIMER_DEVICE_CALLBACK_MEMBER(vg5k_scanline); -}; - - -READ8_MEMBER( vg5k_state::printer_r ) -{ - return (m_printer->is_ready() ? 0x00 : 0xff); -} - - -WRITE8_MEMBER( vg5k_state::printer_w ) -{ - m_printer->output(data); -} - - -WRITE8_MEMBER ( vg5k_state::ef9345_offset_w ) -{ - m_ef9345_offset = data; -} - - -READ8_MEMBER ( vg5k_state::ef9345_io_r ) -{ - return m_ef9345->data_r(space, m_ef9345_offset, 0xff); -} - - -WRITE8_MEMBER ( vg5k_state::ef9345_io_w ) -{ - m_ef9345->data_w(space, m_ef9345_offset, data, 0xff); -} - - -READ8_MEMBER ( vg5k_state::cassette_r ) -{ - double level = m_cassette->input(); - - return (level > 0.03) ? 0xff : 0x00; -} - - -WRITE8_MEMBER ( vg5k_state::cassette_w ) -{ - m_dac->write_unsigned8(data <<2); - - if (data == 0x03) - m_cassette->output(+1); - else if (data == 0x02) - m_cassette->output(-1); - else - m_cassette->output(0); -} - - -static ADDRESS_MAP_START( vg5k_mem, AS_PROGRAM, 8, vg5k_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x3fff ) AM_ROM - AM_RANGE( 0x4000, 0x7fff ) AM_RAM - AM_RANGE( 0x8000, 0xffff ) AM_NOP /* messram expansion memory */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( vg5k_io , AS_IO, 8, vg5k_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK (0xff) - - /* joystick */ - AM_RANGE( 0x07, 0x07 ) AM_READ_PORT("JOY0") - AM_RANGE( 0x08, 0x08 ) AM_READ_PORT("JOY1") - - /* printer */ - AM_RANGE( 0x10, 0x10 ) AM_READ(printer_r) - AM_RANGE( 0x11, 0x11 ) AM_WRITE(printer_w) - - /* keyboard */ - AM_RANGE( 0x80, 0x80 ) AM_READ_PORT("ROW1") - AM_RANGE( 0x81, 0x81 ) AM_READ_PORT("ROW2") - AM_RANGE( 0x82, 0x82 ) AM_READ_PORT("ROW3") - AM_RANGE( 0x83, 0x83 ) AM_READ_PORT("ROW4") - AM_RANGE( 0x84, 0x84 ) AM_READ_PORT("ROW5") - AM_RANGE( 0x85, 0x85 ) AM_READ_PORT("ROW6") - AM_RANGE( 0x86, 0x86 ) AM_READ_PORT("ROW7") - AM_RANGE( 0x87, 0x87 ) AM_READ_PORT("ROW8") - - /* EF9345 */ - AM_RANGE( 0x8f, 0x8f ) AM_WRITE(ef9345_offset_w) - AM_RANGE( 0xcf, 0xcf ) AM_READWRITE(ef9345_io_r, ef9345_io_w) - - /* cassette */ - AM_RANGE( 0xaf,0xaf ) AM_READWRITE(cassette_r, cassette_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vg5k ) - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_NAME("HOME") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("SHIFT") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_NAME("LEFT") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("RIGHT") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_NAME("DOWN") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_NAME("CTRL") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_NAME("INS") - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("RUN") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("CAPSLOCK") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("ENTER") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_NAME("UP") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_START("ROW3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_START("ROW4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_START("ROW5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_START("ROW6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("..") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_START("ROW7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("PRINT") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_START("ROW8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("<--") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_START("JOY0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED - PORT_START("JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_UNUSED -INPUT_PORTS_END - - -TIMER_CALLBACK_MEMBER(vg5k_state::z80_irq_clear) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); -} - - -TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::z80_irq) -{ - m_maincpu->set_input_line(0, ASSERT_LINE); - - machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(vg5k_state::z80_irq_clear),this)); -} - -TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::vg5k_scanline) -{ - m_ef9345->update_scanline((UINT16)param); -} - - -void vg5k_state::machine_start() -{ - save_item(NAME(m_ef9345_offset)); -} - -void vg5k_state::machine_reset() -{ - m_ef9345_offset = 0; -} - -/* F4 Character Displayer */ -static const gfx_layout vg5k_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7, 6, 5, 4, 3, 2, 1, 0 }, - /* y offsets */ - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( vg5k ) - GFXDECODE_ENTRY( "ef9345", 0x2000, vg5k_charlayout, 0, 4 ) -GFXDECODE_END - -DRIVER_INIT_MEMBER(vg5k_state,vg5k) -{ - UINT8 *FNT = memregion("ef9345")->base(); - UINT16 a,b,c,d,dest=0x2000; - - /* Unscramble the chargen rom as the format is too complex for gfxdecode to handle unaided */ - for (a = 0; a < 8192; a+=4096) - for (b = 0; b < 2048; b+=64) - for (c = 0; c < 4; c++) - for (d = 0; d < 64; d+=4) - FNT[dest++]=FNT[a|b|c|d]; - - - /* install expansion memory*/ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - UINT16 ram_size = m_ram->size(); - - if (ram_size > 0x4000) - program.install_ram(0x8000, 0x3fff + ram_size, ram); -} - - -static MACHINE_CONFIG_START( vg5k, vg5k_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(vg5k_mem) - MCFG_CPU_IO_MAP(vg5k_io) - - MCFG_TIMER_DRIVER_ADD_SCANLINE("vg5k_scanline", vg5k_state, vg5k_scanline, "screen", 0, 10) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", vg5k_state, z80_irq, attotime::from_msec(20)) - - MCFG_DEVICE_ADD("ef9345", EF9345, 0) - MCFG_EF9345_PALETTE("palette") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("ef9345", ef9345_device, screen_update) - MCFG_SCREEN_SIZE(336, 300) - MCFG_SCREEN_VISIBLE_AREA(00, 336-1, 00, 270-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", vg5k) - MCFG_PALETTE_ADD("palette", 8) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("dac", DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - /* cassette */ - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(0, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(vg5k_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MASK_SPEAKER) - MCFG_CASSETTE_INTERFACE("vg5k_cass") - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("32K,48k") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list", "vg5k") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( vg5k ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS(0, "v11", "BASIC v1.1") - ROMX_LOAD( "vg5k11.bin", 0x0000, 0x4000, CRC(a6998ff8) SHA1(881ba594be0a721a999378312aea0c3c1c7b2b58), ROM_BIOS(1) ) // dumped from a Radiola VG-5000 - ROM_SYSTEM_BIOS(1, "v11a", "BASIC v1.1 (alt)") - ROMX_LOAD( "vg5k11a.bin", 0x0000, 0x4000, BAD_DUMP CRC(a6f4a0ea) SHA1(58eccce33cc21fc17bc83921018f531b8001eda3), ROM_BIOS(2) ) // from dcvg5k - ROM_SYSTEM_BIOS(2, "v10", "BASIC v1.0") - ROMX_LOAD( "vg5k10.bin", 0x0000, 0x4000, BAD_DUMP CRC(57983260) SHA1(5ad1787a6a597b5c3eedb7c3704b649faa9be4ca), ROM_BIOS(3) ) - - ROM_REGION( 0x4000, "ef9345", 0 ) - ROM_LOAD( "charset.rom", 0x0000, 0x2000, BAD_DUMP CRC(b2f49eb3) SHA1(d0ef530be33bfc296314e7152302d95fdf9520fc) ) // from dcvg5k -ROM_END - -/* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, vg5k, 0, 0, vg5k, vg5k, vg5k_state, vg5k, "Philips", "VG-5000", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/vic10.c b/src/mess/drivers/vic10.c deleted file mode 100644 index d34232c93bd..00000000000 --- a/src/mess/drivers/vic10.c +++ /dev/null @@ -1,678 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - TODO: - - - memory mapping with PLA - - PLA dump - -*/ - - - -#include "includes/vic10.h" - - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// check_interrupts - -//------------------------------------------------- - -void vic10_state::check_interrupts() -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, m_cia_irq || m_vic_irq || m_exp_irq); -} - - - -//************************************************************************** -// MEMORY MANAGEMENT -//************************************************************************** - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( vic10_state::read ) -{ - // TODO this is really handled by the PLA - - UINT8 data = m_vic->bus_r(); - int lorom = 1, uprom = 1, exram = 1; - - if (offset < 0x800) - { - data = m_ram->pointer()[offset]; - } - else if (offset < 0x1000) - { - exram = 0; - } - else if (offset >= 0x8000 && offset < 0xa000) - { - lorom = 0; - } - else if (offset >= 0xd000 && offset < 0xd400) - { - data = m_vic->read(space, offset & 0x3f); - } - else if (offset >= 0xd400 && offset < 0xd800) - { - data = m_sid->read(space, offset & 0x1f); - } - else if (offset >= 0xd800 && offset < 0xdc00) - { - data = m_color_ram[offset & 0x3ff]; - } - else if (offset >= 0xdc00 && offset < 0xe000) - { - data = m_cia->read(space, offset & 0x0f); - } - else if (offset >= 0xe000) - { - uprom = 0; - } - - return m_exp->cd_r(space, offset, data, lorom, uprom, exram); -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( vic10_state::write ) -{ - // TODO this is really handled by the PLA - - int lorom = 1, uprom = 1, exram = 1; - - if (offset < 0x800) - { - m_ram->pointer()[offset] = data; - } - else if (offset < 0x1000) - { - exram = 0; - } - else if (offset >= 0xd000 && offset < 0xd400) - { - m_vic->write(space, offset & 0x3f, data); - } - else if (offset >= 0xd400 && offset < 0xd800) - { - m_sid->write(space, offset & 0x1f, data); - } - else if (offset >= 0xd800 && offset < 0xdc00) - { - m_color_ram[offset & 0x3ff] = data & 0x0f; - } - else if (offset >= 0xdc00 && offset < 0xe000) - { - m_cia->write(space, offset & 0x0f, data); - } - - m_exp->cd_w(space, offset, data, lorom, uprom, exram); -} - - -//------------------------------------------------- -// vic_videoram_r - -//------------------------------------------------- - -READ8_MEMBER( vic10_state::vic_videoram_r ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - if (offset < 0x3000) - return program.read_byte(offset); - - return program.read_byte(0xe000 + (offset & 0x1fff)); -} - - -//------------------------------------------------- -// vic_colorram_r - -//------------------------------------------------- - -READ8_MEMBER( vic10_state::vic_colorram_r ) -{ - return m_color_ram[offset]; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( vic10_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic10_mem, AS_PROGRAM, 8, vic10_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_videoram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, vic10_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_colorram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, vic10_state ) - AM_RANGE(0x000, 0x3ff) AM_READ(vic_colorram_r) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( vic10 ) -//------------------------------------------------- - -static INPUT_PORTS_START( vic10 ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START( "RESTORE" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) - - PORT_START( "LOCK" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// vic2_interface vic_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( vic10_state::vic_irq_w ) -{ - m_vic_irq = state; - - check_interrupts(); -} - - -//------------------------------------------------- -// sid6581_interface sid_intf -//------------------------------------------------- - -READ8_MEMBER( vic10_state::sid_potx_r ) -{ - UINT8 data = 0xff; - - switch (m_cia->pa_r() >> 6) - { - case 1: data = m_joy1->pot_x_r(); break; - case 2: data = m_joy2->pot_x_r(); break; - case 3: - if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) - { - data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); - } - else if (m_joy1->has_pot_x()) - { - data = m_joy1->pot_x_r(); - } - else if (m_joy2->has_pot_x()) - { - data = m_joy2->pot_x_r(); - } - break; - } - - return data; -} - -READ8_MEMBER( vic10_state::sid_poty_r ) -{ - UINT8 data = 0xff; - - switch (m_cia->pa_r() >> 6) - { - case 1: data = m_joy1->pot_y_r(); break; - case 2: data = m_joy2->pot_y_r(); break; - case 3: - if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) - { - data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); - } - else if (m_joy1->has_pot_y()) - { - data = m_joy1->pot_y_r(); - } - else if (m_joy2->has_pot_y()) - { - data = m_joy2->pot_y_r(); - } - break; - } - - return data; -} - - -//------------------------------------------------- -// MOS6526_INTERFACE( cia_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( vic10_state::cia_irq_w ) -{ - m_cia_irq = state; - - check_interrupts(); -} - -READ8_MEMBER( vic10_state::cia_pa_r ) -{ - /* - - bit description - - PA0 COL0, JOY B0 - PA1 COL1, JOY B1 - PA2 COL2, JOY B2 - PA3 COL3, JOY B3 - PA4 COL4, BTNB - PA5 COL5 - PA6 COL6 - PA7 COL7 - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy_b = m_joy2->joy_r(); - - data &= (0xf0 | (joy_b & 0x0f)); - data &= ~(!BIT(joy_b, 5) << 4); - - // keyboard - UINT8 cia_pb = m_cia->pb_r(); - UINT8 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), - m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; - - for (int i = 0; i < 8; i++) - { - if (!BIT(cia_pb, i)) - { - if (!BIT(row[7], i)) data &= ~0x80; - if (!BIT(row[6], i)) data &= ~0x40; - if (!BIT(row[5], i)) data &= ~0x20; - if (!BIT(row[4], i)) data &= ~0x10; - if (!BIT(row[3], i)) data &= ~0x08; - if (!BIT(row[2], i)) data &= ~0x04; - if (!BIT(row[1], i)) data &= ~0x02; - if (!BIT(row[0], i)) data &= ~0x01; - } - } - - return data; -} - -READ8_MEMBER( vic10_state::cia_pb_r ) -{ - /* - - bit description - - PB0 JOY A0 - PB1 JOY A1 - PB2 JOY A2 - PB3 JOY A3 - PB4 BTNA/_LP - PB5 - PB6 - PB7 - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy_a = m_joy1->joy_r(); - - data &= (0xf0 | (joy_a & 0x0f)); - data &= ~(!BIT(joy_a, 5) << 4); - - // keyboard - UINT8 cia_pa = m_cia->pa_r(); - - if (!BIT(cia_pa, 7)) data &= m_row7->read(); - if (!BIT(cia_pa, 6)) data &= m_row6->read(); - if (!BIT(cia_pa, 5)) data &= m_row5->read(); - if (!BIT(cia_pa, 4)) data &= m_row4->read(); - if (!BIT(cia_pa, 3)) data &= m_row3->read(); - if (!BIT(cia_pa, 2)) data &= m_row2->read(); - if (!BIT(cia_pa, 1)) data &= m_row1->read() & m_lock->read(); - if (!BIT(cia_pa, 0)) data &= m_row0->read(); - - return data; -} - -WRITE8_MEMBER( vic10_state::cia_pb_w ) -{ - /* - - bit description - - PB0 ROW0 - PB1 ROW1 - PB2 ROW2 - PB3 ROW3 - PB4 ROW4 - PB5 ROW5 - PB6 ROW6 - PB7 ROW7 - - */ - - m_vic->lp_w(BIT(data, 4)); -} - - -//------------------------------------------------- -// M6510_INTERFACE( cpu_intf ) -//------------------------------------------------- - -READ8_MEMBER( vic10_state::cpu_r ) -{ - /* - - bit description - - P0 EXPANSION PORT - P1 - P2 - P3 - P4 CASS SENS - P5 0 - - */ - - UINT8 data = 0; - - // expansion port - data |= m_exp->p0_r(); - - // cassette sense - data |= m_cassette->sense_r() << 4; - - return data; -} - -WRITE8_MEMBER( vic10_state::cpu_w ) -{ - /* - - bit description - - P0 EXPANSION PORT - P1 - P2 - P3 CASS WRT - P4 - P5 CASS MOTOR - - */ - - if (BIT(offset, 0)) - { - m_exp->p0_w(BIT(data, 0)); - } - - // cassette write - m_cassette->write(BIT(data, 3)); - - // cassette motor - m_cassette->motor_w(BIT(data, 5)); -} - - -//------------------------------------------------- -// VIC10_EXPANSION_INTERFACE( expansion_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( vic10_state::exp_irq_w ) -{ - m_exp_irq = state; - - check_interrupts(); -} - -WRITE_LINE_MEMBER( vic10_state::exp_reset_w ) -{ - if (state == ASSERT_LINE) - { - machine_reset(); - } -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( vic10 ) -//------------------------------------------------- - -void vic10_state::machine_start() -{ - // allocate memory - m_color_ram.allocate(0x400); - - // initialize memory - UINT8 data = 0xff; - - for (offs_t offset = 0; offset < m_ram->size(); offset++) - { - m_ram->pointer()[offset] = data; - if (!(offset % 64)) data ^= 0xff; - } - - // state saving - save_item(NAME(m_cia_irq)); - save_item(NAME(m_vic_irq)); - save_item(NAME(m_exp_irq)); -} - - -void vic10_state::machine_reset() -{ - m_maincpu->reset(); - - m_vic->reset(); - m_sid->reset(); - m_cia->reset(); - - m_exp->reset(); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( vic10 ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( vic10, vic10_state ) - // basic hardware - MCFG_CPU_ADD(M6510_TAG, M6510, XTAL_8MHz/8) - MCFG_CPU_PROGRAM_MAP(vic10_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - MCFG_M6510_PORT_CALLBACKS(READ8(vic10_state, cpu_r), WRITE8(vic10_state, cpu_w)) - MCFG_M6510_PORT_PULLS(0x10, 0x20) - MCFG_QUANTUM_PERFECT_CPU(M6510_TAG) - - // video hardware - MCFG_DEVICE_ADD(MOS6566_TAG, MOS6566, XTAL_8MHz/8) - MCFG_MOS6566_CPU(M6510_TAG) - MCFG_MOS6566_IRQ_CALLBACK(WRITELINE(vic10_state, vic_irq_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - MCFG_DEVICE_ADDRESS_MAP(AS_0, vic_videoram_map) - MCFG_DEVICE_ADDRESS_MAP(AS_1, vic_colorram_map) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(VIC6566_VRETRACERATE) - MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) - MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) - MCFG_SCREEN_UPDATE_DEVICE(MOS6566_TAG, mos6566_device, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6581_TAG, MOS6581, XTAL_8MHz/8) - MCFG_MOS6581_POTX_CALLBACK(READ8(vic10_state, sid_potx_r)) - MCFG_MOS6581_POTY_CALLBACK(READ8(vic10_state, sid_poty_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - // devices - MCFG_DEVICE_ADD(MOS6526_TAG, MOS6526, XTAL_8MHz/8) - MCFG_MOS6526_TOD(60) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(vic10_state, cia_irq_w)) - MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, cnt_w)) - MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, sp_w)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(vic10_state, cia_pa_r)) - MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(vic10_state, cia_pb_r)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(vic10_state, cia_pb_w)) - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(MOS6526_TAG, mos6526_device, flag_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL) - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(DEVWRITELINE(MOS6566_TAG, mos6566_device, lp_w)) - MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy") - MCFG_VIC10_EXPANSION_SLOT_ADD(VIC10_EXPANSION_SLOT_TAG, XTAL_8MHz/8, vic10_expansion_cards, NULL) - MCFG_VIC10_EXPANSION_SLOT_IRQ_CALLBACK(WRITELINE(vic10_state, exp_irq_w)) - MCFG_VIC10_EXPANSION_SLOT_RES_CALLBACK(WRITELINE(vic10_state, exp_reset_w)) - MCFG_VIC10_EXPANSION_SLOT_CNT_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w)) - MCFG_VIC10_EXPANSION_SLOT_SP_CALLBACK(DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w)) - - // software list - MCFG_SOFTWARE_LIST_ADD("cart_list", "vic10") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -ROM_START( vic10 ) - ROM_REGION( 0x100, "pla", 0 ) - ROM_LOAD( "6703.u4", 0x000, 0x100, NO_DUMP ) -ROM_END - - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -COMP( 1982, vic10, 0, 0, vic10, vic10, driver_device, 0, "Commodore Business Machines", "VIC-10 / Max Machine / UltiMax (NTSC)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/vic20.c b/src/mess/drivers/vic20.c deleted file mode 100644 index 498e22c9b11..00000000000 --- a/src/mess/drivers/vic20.c +++ /dev/null @@ -1,859 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - TODO: - - - C1540 is not working currently - - mos6560_port_r/w should respond at 0x1000-0x100f - - VIC21 (built in 21K ram) - -*/ - -#include "includes/vic20.h" - - - -QUICKLOAD_LOAD_MEMBER( vic20_state, cbm_vc20 ) -{ - return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_quick_sethiaddress); -} - -//************************************************************************** -// MEMORY MANAGEMENT -//************************************************************************** - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( vic20_state::read ) -{ - UINT8 data = m_vic->bus_r(); - - int ram1 = 1, ram2 = 1, ram3 = 1; - int blk1 = 1, blk2 = 1, blk3 = 1, blk5 = 1; - int io2 = 1, io3 = 1; - - switch ((offset >> 13) & 0x07) - { - case BLK0: - switch ((offset >> 10) & 0x07) - { - case RAM0: - data = m_ram->pointer()[offset & 0x3ff]; - break; - - case RAM1: ram1 = 0; break; - case RAM2: ram2 = 0; break; - case RAM3: ram3 = 0; break; - - default: - data = m_ram->pointer()[0x400 + (offset & 0xfff)]; - break; - } - break; - - case BLK1: blk1 = 0; break; - case BLK2: blk2 = 0; break; - case BLK3: blk3 = 0; break; - - case BLK4: - switch ((offset >> 10) & 0x07) - { - default: - data = m_charom[offset & 0xfff]; - break; - - case IO0: - if (BIT(offset, 4)) - { - data = m_via1->read(space, offset & 0x0f); - } - else if (BIT(offset, 5)) - { - data = m_via2->read(space, offset & 0x0f); - } - else if (offset >= 0x9000 && offset < 0x9010) - { - data = m_vic->read(space, offset & 0x0f); - } - break; - - case COLOR: - data = m_color_ram[offset & 0x3ff]; - break; - - case IO2: io2 = 0; break; - case IO3: io3 = 0; break; - } - break; - - case BLK5: blk5 = 0; break; - - case BLK6: - data = m_basic[offset & 0x1fff]; - break; - - case BLK7: - data = m_kernal[offset & 0x1fff]; - break; - } - - return m_exp->cd_r(space, offset & 0x1fff, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( vic20_state::write ) -{ - int ram1 = 1, ram2 = 1, ram3 = 1; - int blk1 = 1, blk2 = 1, blk3 = 1, blk5 = 1; - int io2 = 1, io3 = 1; - - switch ((offset >> 13) & 0x07) - { - case BLK0: - switch ((offset >> 10) & 0x07) - { - case RAM0: - m_ram->pointer()[offset] = data; - break; - - case RAM1: ram1 = 0; break; - case RAM2: ram2 = 0; break; - case RAM3: ram3 = 0; break; - - default: - m_ram->pointer()[0x400 + (offset & 0xfff)] = data; - break; - } - break; - - case BLK1: blk1 = 0; break; - case BLK2: blk2 = 0; break; - case BLK3: blk3 = 0; break; - - case BLK4: - switch ((offset >> 10) & 0x07) - { - case IO0: - if (BIT(offset, 4)) - { - m_via1->write(space, offset & 0x0f, data); - } - else if (BIT(offset, 5)) - { - m_via2->write(space, offset & 0x0f, data); - } - else if (offset >= 0x9000 && offset < 0x9010) - { - m_vic->write(space, offset & 0x0f, data); - } - break; - - case COLOR: - m_color_ram[offset & 0x3ff] = data & 0x0f; - break; - - case IO2: io2 = 0; break; - case IO3: io3 = 0; break; - } - break; - - case BLK5: blk5 = 0; break; - } - - m_exp->cd_w(space, offset & 0x1fff, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); -} - - -//------------------------------------------------- -// vic_videoram_r - -//------------------------------------------------- - -READ8_MEMBER( vic20_state::vic_videoram_r ) -{ - int ram1 = 1, ram2 = 1, ram3 = 1; - int blk1 = 1, blk2 = 1, blk3 = 1, blk5 = 1; - int io2 = 1, io3 = 1; - - UINT8 data = 0; - - if (BIT(offset, 13)) - { - switch ((offset >> 10) & 0x07) - { - case RAM0: - data = m_ram->pointer()[offset & 0x3ff]; - break; - - case RAM1: ram1 = 0; break; - case RAM2: ram2 = 0; break; - case RAM3: ram3 = 0; break; - - default: - data = m_ram->pointer()[0x400 + (offset & 0xfff)]; - break; - } - } - else - { - data = m_charom[offset & 0xfff]; - } - - return m_exp->cd_r(space, offset & 0x1fff, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3); -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( vic20_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic20_mem, AS_PROGRAM, 8, vic20_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_videoram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_videoram_map, AS_0, 8, vic20_state ) - AM_RANGE(0x0000, 0x3fff) AM_READ(vic_videoram_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vic_colorram_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vic_colorram_map, AS_1, 8, vic20_state ) - AM_RANGE(0x000, 0x3ff) AM_RAM AM_SHARE("color_ram") -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( vic20 ) -//------------------------------------------------- - -static INPUT_PORTS_START( vic20 ) - PORT_START( "ROW0" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START( "ROW1" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) - - PORT_START( "ROW2" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START( "ROW3" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_HOME) - - PORT_START( "ROW4" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START( "ROW5" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LCONTROL) - - PORT_START( "ROW6" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - - PORT_START( "ROW7" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - - PORT_START( "RESTORE" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(M6522_1_TAG, via6522_device, write_ca1) - - PORT_START( "LOCK" ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( vic1001 ) -//------------------------------------------------- - -static INPUT_PORTS_START( vic1001 ) - PORT_INCLUDE( vic20 ) - - PORT_MODIFY( "ROW0" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('\xA5') -INPUT_PORTS_END - - -//------------------------------------------------- -// INPUT_PORTS( vic20s ) -//------------------------------------------------- - -static INPUT_PORTS_START( vic20s ) - PORT_INCLUDE( vic20 ) - - PORT_MODIFY( "ROW0" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - - PORT_MODIFY( "ROW1" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('@') - - PORT_MODIFY( "ROW2" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) - - PORT_MODIFY( "ROW5" ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) - - PORT_MODIFY( "ROW6" ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00C5) - - PORT_MODIFY( "ROW7" ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -READ8_MEMBER( vic20_state::via1_pa_r ) -{ - /* - - bit description - - PA0 SERIAL CLK IN - PA1 SERIAL DATA IN - PA2 JOY 0 (UP) - PA3 JOY 1 (DOWN) - PA4 JOY 2 (LEFT) - PA5 LITE PEN (FIRE) - PA6 CASS SWITCH - PA7 - - */ - - UINT8 data = 0; - - // serial clock in - data |= m_iec->clk_r(); - - // serial data in - data |= m_iec->data_r() << 1; - - // joystick / user port - UINT8 joy = m_joy->joy_r(); - - data |= (m_user_joy0 && BIT(joy, 0)) << 2; - data |= (m_user_joy1 && BIT(joy, 1)) << 3; - data |= (m_user_joy2 && BIT(joy, 2)) << 4; - data |= (m_user_light_pen && BIT(joy, 5)) << 5; - - // cassette switch - data |= (m_user_cassette_switch && m_cassette->sense_r()) << 6; - - return data; -} - -WRITE8_MEMBER( vic20_state::via1_pa_w ) -{ - /* - - bit description - - PA0 - PA1 - PA2 - PA3 - PA4 - PA5 LITE PEN (FIRE) - PA6 - PA7 SERIAL ATN OUT - - */ - - // light pen strobe - m_user->write_7(BIT(data, 5)); - m_vic->lp_w(BIT(data, 5)); - - // serial attention out - m_user->write_9(!BIT(data, 7)); - m_iec->atn_w(!BIT(data, 7)); -} - -WRITE8_MEMBER( vic20_state::via1_pb_w ) -{ - m_user->write_c((data>>0)&1); - m_user->write_d((data>>1)&1); - m_user->write_e((data>>2)&1); - m_user->write_f((data>>3)&1); - m_user->write_h((data>>4)&1); - m_user->write_j((data>>5)&1); - m_user->write_k((data>>6)&1); - m_user->write_l((data>>7)&1); -} - -READ8_MEMBER( vic20_state::via2_pa_r ) -{ - /* - - bit description - - PA0 ROW 0 - PA1 ROW 1 - PA2 ROW 2 - PA3 ROW 3 - PA4 ROW 4 - PA5 ROW 5 - PA6 ROW 6 - PA7 ROW 7 - - */ - - UINT8 data = 0xff; - - if (!BIT(m_key_col, 0)) data &= m_row0->read(); - if (!BIT(m_key_col, 1)) data &= m_row1->read(); - if (!BIT(m_key_col, 2)) data &= m_row2->read(); - if (!BIT(m_key_col, 3)) data &= m_row3->read(); - if (!BIT(m_key_col, 4)) data &= m_row4->read(); - if (!BIT(m_key_col, 5)) data &= m_row5->read(); - if (!BIT(m_key_col, 6)) data &= m_row6->read(); - if (!BIT(m_key_col, 7)) data &= m_row7->read(); - - return data; -} - -READ8_MEMBER( vic20_state::via2_pb_r ) -{ - /* - - bit description - - PB0 COL 0 - PB1 COL 1 - PB2 COL 2 - PB3 COL 3 - PB4 COL 4 - PB5 COL 5 - PB6 COL 6 - PB7 COL 7, JOY 3 (RIGHT) - - */ - - UINT8 data = 0xff; - - // joystick - UINT8 joy = m_joy->joy_r(); - - data &= BIT(joy, 3) << 7; - - return data; -} - -WRITE8_MEMBER( vic20_state::via2_pb_w ) -{ - /* - - bit description - - PB0 COL 0 - PB1 COL 1 - PB2 COL 2 - PB3 COL 3, CASS WRITE - PB4 COL 4 - PB5 COL 5 - PB6 COL 6 - PB7 COL 7 - - */ - - // cassette write - m_cassette->write(BIT(data, 3)); - - // keyboard column - m_key_col = data; -} - -WRITE_LINE_MEMBER( vic20_state::via2_ca2_w ) -{ - // serial clock out - m_iec->clk_w(!state); -} - -WRITE_LINE_MEMBER( vic20_state::via2_cb2_w ) -{ - // serial data out - m_iec->data_w(!state); -} - - -//------------------------------------------------- -// VIC20_EXPANSION_INTERFACE( expansion_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( vic20_state::exp_reset_w ) -{ - if (!state) - { - machine_reset(); - } -} - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( vic20 ) -//------------------------------------------------- - -void vic20_state::machine_start() -{ - // initialize memory - UINT8 data = 0xff; - - for (offs_t offset = 0; offset < m_ram->size(); offset++) - { - m_ram->pointer()[offset] = data; - if (!(offset % 64)) data ^= 0xff; - } - - // state saving - save_item(NAME(m_key_col)); - save_item(NAME(m_light_pen)); - save_item(NAME(m_user_joy0)); - save_item(NAME(m_user_joy1)); - save_item(NAME(m_user_joy2)); - save_item(NAME(m_user_light_pen)); - save_item(NAME(m_user_cassette_switch)); -} - - -void vic20_state::machine_reset() -{ - m_maincpu->reset(); - - m_vic->reset(); - m_via1->reset(); - m_via2->reset(); - - m_iec->reset(); - m_exp->reset(); - - m_user->write_3(0); - m_user->write_3(1); -} - -WRITE_LINE_MEMBER(vic20_state::write_user_joy0) -{ - m_user_joy0 = state; -} - -WRITE_LINE_MEMBER(vic20_state::write_user_joy1) -{ - m_user_joy1 = state; -} - -WRITE_LINE_MEMBER(vic20_state::write_user_joy2) -{ - m_user_joy2 = state; -} - -WRITE_LINE_MEMBER(vic20_state::write_light_pen) -{ - m_light_pen = state; - m_vic->lp_w(m_light_pen && m_user_light_pen); -} - -WRITE_LINE_MEMBER(vic20_state::write_user_light_pen) -{ - m_user_light_pen = state; - m_vic->lp_w(m_light_pen && m_user_light_pen); -} - -WRITE_LINE_MEMBER(vic20_state::write_user_cassette_switch) -{ - m_user_cassette_switch = state; -} - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( vic20_common ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( vic20, vic20_state ) - // devices - MCFG_DEVICE_ADD(M6522_1_TAG, VIA6522, 0) - MCFG_VIA6522_READPA_HANDLER(READ8(vic20_state, via1_pa_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(vic20_state, via1_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(vic20_state, via1_pb_w)) - MCFG_VIA6522_CB1_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_b)) - MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, motor_w)) - MCFG_VIA6522_CB2_HANDLER(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_m)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(M6502_TAG, m6502_device, nmi_line)) - - MCFG_DEVICE_ADD(M6522_2_TAG, VIA6522, 0) - MCFG_VIA6522_READPA_HANDLER(READ8(vic20_state, via2_pa_r)) - MCFG_VIA6522_READPB_HANDLER(READ8(vic20_state, via2_pb_r)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(vic20_state, via2_pb_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(vic20_state, via2_ca2_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(vic20_state, via2_cb2_w)) - MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE(M6502_TAG, m6502_device, irq_line)) - - MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", DEVWRITELINE(M6522_2_TAG, via6522_device, write_ca1)) - MCFG_CBM_IEC_ADD("c1541") - MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(M6522_2_TAG, via6522_device, write_cb1)) - - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, "joy") - MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(WRITELINE(vic20_state, write_light_pen)) - - MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, vic20_user_port_cards, NULL) - MCFG_PET_USER_PORT_3_HANDLER(WRITELINE(vic20_state, exp_reset_w)) - MCFG_PET_USER_PORT_4_HANDLER(WRITELINE(vic20_state, write_user_joy0)) - MCFG_PET_USER_PORT_5_HANDLER(WRITELINE(vic20_state, write_user_joy1)) - MCFG_PET_USER_PORT_6_HANDLER(WRITELINE(vic20_state, write_user_joy2)) - MCFG_PET_USER_PORT_7_HANDLER(WRITELINE(vic20_state, write_user_light_pen)) - MCFG_PET_USER_PORT_8_HANDLER(WRITELINE(vic20_state, write_user_cassette_switch)) - MCFG_PET_USER_PORT_B_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_cb1)) - MCFG_PET_USER_PORT_C_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb0)) - MCFG_PET_USER_PORT_D_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb1)) - MCFG_PET_USER_PORT_E_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb2)) - MCFG_PET_USER_PORT_F_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb3)) - MCFG_PET_USER_PORT_H_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb4)) - MCFG_PET_USER_PORT_J_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb5)) - MCFG_PET_USER_PORT_K_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb6)) - MCFG_PET_USER_PORT_L_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb7)) - MCFG_PET_USER_PORT_M_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_cb2)) - - MCFG_QUICKLOAD_ADD("quickload", vic20_state, cbm_vc20, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list", "vic1001_cart") - MCFG_SOFTWARE_LIST_ADD("cass_list", "vic1001_cass") - MCFG_SOFTWARE_LIST_ADD("flop_list", "vic1001_flop") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("5K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( ntsc ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( ntsc, vic20 ) - // basic machine hardware - MCFG_CPU_ADD(M6502_TAG, M6502, MOS6560_CLOCK) - MCFG_CPU_PROGRAM_MAP(vic20_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - - // video/sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_MOS6560_ADD(M6560_TAG, SCREEN_TAG, MOS6560_CLOCK, vic_videoram_map, vic_colorram_map) - MCFG_MOS6560_POTX_CALLBACK(DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_x_r)) - MCFG_MOS6560_POTY_CALLBACK(DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_y_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, MOS6560_CLOCK, vic20_expansion_cards, NULL) - MCFG_VIC20_EXPANSION_SLOT_IRQ_CALLBACK(INPUTLINE(M6502_TAG, M6502_IRQ_LINE)) - MCFG_VIC20_EXPANSION_SLOT_NMI_CALLBACK(INPUTLINE(M6502_TAG, M6502_NMI_LINE)) - MCFG_VIC20_EXPANSION_SLOT_RES_CALLBACK(WRITELINE(vic20_state, exp_reset_w)) - - // software lists - MCFG_SOFTWARE_LIST_FILTER("cart_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("cass_list", "NTSC") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "NTSC") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( pal ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( pal, vic20 ) - // basic machine hardware - MCFG_CPU_ADD(M6502_TAG, M6502, MOS6561_CLOCK) - MCFG_CPU_PROGRAM_MAP(vic20_mem) - MCFG_M6502_DISABLE_DIRECT() // address decoding is 100% dynamic, no RAM/ROM banks - - // video/sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_MOS6561_ADD(M6560_TAG, SCREEN_TAG, MOS6561_CLOCK, vic_videoram_map, vic_colorram_map) - MCFG_MOS6560_POTX_CALLBACK(DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_x_r)) - MCFG_MOS6560_POTY_CALLBACK(DEVREAD8(CONTROL1_TAG, vcs_control_port_device, pot_y_r)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, MOS6561_CLOCK, vic20_expansion_cards, NULL) - MCFG_VIC20_EXPANSION_SLOT_IRQ_CALLBACK(INPUTLINE(M6502_TAG, M6502_IRQ_LINE)) - MCFG_VIC20_EXPANSION_SLOT_NMI_CALLBACK(INPUTLINE(M6502_TAG, M6502_NMI_LINE)) - MCFG_VIC20_EXPANSION_SLOT_RES_CALLBACK(WRITELINE(vic20_state, exp_reset_w)) - - // software lists - MCFG_SOFTWARE_LIST_FILTER("cart_list", "PAL") - MCFG_SOFTWARE_LIST_FILTER("cass_list", "PAL") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "PAL") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -//------------------------------------------------- -// ROM( vic1001 ) -//------------------------------------------------- - -ROM_START( vic1001 ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901486-01", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "901486-02", 0x0000, 0x2000, CRC(336900d7) SHA1(c9ead45e6674d1042ca6199160e8583c23aeac22) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901460-02", 0x0000, 0x1000, CRC(fcfd8a4b) SHA1(dae61ac03065aa2904af5c123ce821855898c555) ) -ROM_END - - -//------------------------------------------------- -// ROM( vic20 ) -//------------------------------------------------- - -ROM_START( vic20 ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901486-01.ue11", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_SYSTEM_BIOS( 0, "cbm", "Original" ) - ROMX_LOAD( "901486-06.ue12", 0x0000, 0x2000, CRC(e5e7c174) SHA1(06de7ec017a5e78bd6746d89c2ecebb646efeb19), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "jiffydos", "JiffyDOS" ) - ROMX_LOAD( "jiffydos vic-20 ntsc.ue12", 0x0000, 0x2000, CRC(683a757f) SHA1(83fb83e97b5a840311dbf7e1fe56fe828f41936d), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901460-03.ud7", 0x0000, 0x1000, CRC(83e032a6) SHA1(4fd85ab6647ee2ac7ba40f729323f2472d35b9b4) ) -ROM_END - - -//------------------------------------------------- -// ROM( vic20p ) -//------------------------------------------------- - -ROM_START( vic20p ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901486-01.ue11", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_SYSTEM_BIOS( 0, "cbm", "Original" ) - ROMX_LOAD( "901486-07.ue12", 0x0000, 0x2000, CRC(4be07cb4) SHA1(ce0137ed69f003a299f43538fa9eee27898e621e), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "jiffydos", "JiffyDOS" ) - ROMX_LOAD( "jiffydos vic-20 pal.ue12", 0x0000, 0x2000, CRC(705e7810) SHA1(5a03623a4b855531b8bffd756f701306f128be2d), ROM_BIOS(2) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "901460-03.ud7", 0x0000, 0x1000, CRC(83e032a6) SHA1(4fd85ab6647ee2ac7ba40f729323f2472d35b9b4) ) -ROM_END - - -//------------------------------------------------- -// ROM( vic20_se ) -//------------------------------------------------- - -ROM_START( vic20_se ) - ROM_REGION( 0x2000, "basic", 0 ) - ROM_LOAD( "901486-01.ue11", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) ) - - ROM_REGION( 0x2000, "kernal", 0 ) - ROM_LOAD( "nec22081.206", 0x0000, 0x2000, CRC(b2a60662) SHA1(cb3e2f6e661ea7f567977751846ce9ad524651a3) ) - - ROM_REGION( 0x1000, "charom", 0 ) - ROM_LOAD( "nec22101.207", 0x0000, 0x1000, CRC(d808551d) SHA1(f403f0b0ce5922bd61bbd768bdd6f0b38e648c9f) ) -ROM_END - - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1980, vic1001, 0, 0, ntsc, vic1001, driver_device, 0, "Commodore Business Machines", "VIC-1001 (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -COMP( 1981, vic20, vic1001, 0, ntsc, vic20, driver_device, 0, "Commodore Business Machines", "VIC-20 (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -COMP( 1981, vic20p, vic1001, 0, pal, vic20, driver_device, 0, "Commodore Business Machines", "VIC-20 / VC-20 (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -COMP( 1981, vic20_se, vic1001, 0, pal, vic20s, driver_device, 0, "Commodore Business Machines", "VIC-20 (Sweden/Finland)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/victor9k.c b/src/mess/drivers/victor9k.c deleted file mode 100644 index a67c97c101f..00000000000 --- a/src/mess/drivers/victor9k.c +++ /dev/null @@ -1,601 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Victor 9000 / ACT Sirius 1 emulation - -**********************************************************************/ - -/* - - TODO: - - - expansion bus - - Z80 card - - Winchester DMA card (Xebec S1410 + Tandon TM502/TM603SE) - - RAM cards - - clock cards - - floppy 8048 - - hires graphics - - brightness/contrast - - MC6852 - - codec sound - -*/ - -#include "includes/victor9k.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( victor9k_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( victor9k_mem, AS_PROGRAM, 8, victor9k_state ) - AM_RANGE(0x00000, 0x1ffff) AM_RAM - AM_RANGE(0x20000, 0xdffff) AM_NOP - AM_RANGE(0xe0000, 0xe0001) AM_MIRROR(0x7f00) AM_DEVREADWRITE(I8259A_TAG, pic8259_device, read, write) - AM_RANGE(0xe0020, 0xe0023) AM_MIRROR(0x7f00) AM_DEVREADWRITE(I8253_TAG, pit8253_device, read, write) - AM_RANGE(0xe0040, 0xe0043) AM_MIRROR(0x7f00) AM_DEVREADWRITE(UPD7201_TAG, upd7201_device, cd_ba_r, cd_ba_w) - AM_RANGE(0xe8000, 0xe8000) AM_MIRROR(0x7f00) AM_DEVREADWRITE(HD46505S_TAG, mc6845_device, status_r, address_w) - AM_RANGE(0xe8001, 0xe8001) AM_MIRROR(0x7f00) AM_DEVREADWRITE(HD46505S_TAG, mc6845_device, register_r, register_w) - AM_RANGE(0xe8020, 0xe802f) AM_MIRROR(0x7f00) AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write) - AM_RANGE(0xe8040, 0xe804f) AM_MIRROR(0x7f00) AM_DEVREADWRITE(M6522_2_TAG, via6522_device, read, write) - AM_RANGE(0xe8060, 0xe8061) AM_MIRROR(0x7f00) AM_DEVREADWRITE(MC6852_TAG, mc6852_device, read, write) - AM_RANGE(0xe8080, 0xe808f) AM_MIRROR(0x7f00) AM_DEVREADWRITE(M6522_3_TAG, via6522_device, read, write) - AM_RANGE(0xe80a0, 0xe80af) AM_MIRROR(0x7f00) AM_DEVREADWRITE(FDC_TAG, victor_9000_fdc_t, cs5_r, cs5_w) - AM_RANGE(0xe80c0, 0xe80cf) AM_MIRROR(0x7f00) AM_DEVREADWRITE(FDC_TAG, victor_9000_fdc_t, cs6_r, cs6_w) - AM_RANGE(0xe80e0, 0xe80ef) AM_MIRROR(0x7f00) AM_DEVREADWRITE(FDC_TAG, victor_9000_fdc_t, cs7_r, cs7_w) - AM_RANGE(0xf0000, 0xf0fff) AM_MIRROR(0x1000) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0xf8000, 0xf9fff) AM_MIRROR(0x6000) AM_ROM AM_REGION(I8088_TAG, 0) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( victor9k ) -//------------------------------------------------- - -static INPUT_PORTS_START( victor9k ) - // defined in machine/victor9kb.c -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MC6845 -//------------------------------------------------- - -#define CODE_NON_DISPLAY 0x1000 -#define CODE_UNDERLINE 0x2000 -#define CODE_LOW_INTENSITY 0x4000 -#define CODE_REVERSE_VIDEO 0x8000 - -MC6845_UPDATE_ROW( victor9k_state::crtc_update_row ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - if (BIT(ma, 13)) - { - fatalerror("Graphics mode not supported!\n"); - } - else - { - UINT16 video_ram_addr = (ma & 0xfff) << 1; - - for (int sx = 0; sx < x_count; sx++) - { - UINT16 code = (m_video_ram[video_ram_addr + 1] << 8) | m_video_ram[video_ram_addr]; - UINT32 char_ram_addr = (BIT(ma, 12) << 16) | ((code & 0xff) << 5) | (ra << 1); - UINT16 data = program.read_word(char_ram_addr); - - if (code & CODE_REVERSE_VIDEO) data ^= 0xffff; - if (code & CODE_NON_DISPLAY) data = 0; - if (sx == cursor_x) data = 0xffff; - - for (int x = 0; x <= 10; x++) - { - int pixel = BIT(data, x); - int color = palette[pixel && de]; - if (!(code & CODE_LOW_INTENSITY) && color) color = 2; - - bitmap.pix32(vbp + y, hbp + x + sx*10) = color; - } - - video_ram_addr += 2; - video_ram_addr &= 0xfff; - } - } -} - -WRITE_LINE_MEMBER(victor9k_state::vert_w) -{ - m_via2->write_pa7(state); - m_pic->ir7_w(state); -} - - - -WRITE_LINE_MEMBER(victor9k_state::mux_serial_b_w) -{ -} - -WRITE_LINE_MEMBER(victor9k_state::mux_serial_a_w) -{ -} - -//------------------------------------------------- -// PIC8259 -//------------------------------------------------- - -/* - - pin signal description - - IR0 SYN sync detect - IR1 COMM serial communications (7201) - IR2 TIMER 8253 timer - IR3 PARALLEL all 6522 IRQ (including disk) - IR4 IR4 expansion IR4 - IR5 IR5 expansion IR5 - IR6 KBINT keyboard data ready - IR7 VINT vertical sync or nonspecific interrupt - -*/ - -//------------------------------------------------- -// MC6852_INTERFACE( ssda_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( victor9k_state::ssda_irq_w ) -{ - m_ssda_irq = state; - - m_pic->ir3_w(m_ssda_irq || m_via1_irq || m_via3_irq || m_fdc_irq); -} - - -WRITE8_MEMBER( victor9k_state::via1_pa_w ) -{ - /* - - bit description - - PA0 DIO1 - PA1 DIO2 - PA2 DIO3 - PA3 DIO4 - PA4 DIO5 - PA5 DIO6 - PA6 DIO7 - PA7 DIO8 - - */ - - // centronics - m_centronics->write_data0(BIT(data, 0)); - m_centronics->write_data1(BIT(data, 1)); - m_centronics->write_data2(BIT(data, 2)); - m_centronics->write_data3(BIT(data, 3)); - m_centronics->write_data4(BIT(data, 4)); - m_centronics->write_data5(BIT(data, 5)); - m_centronics->write_data6(BIT(data, 6)); - m_centronics->write_data7(BIT(data, 7)); - - // IEEE-488 - m_ieee488->dio_w(data); -} - -DECLARE_WRITE_LINE_MEMBER( victor9k_state::write_nfrd ) -{ - m_via1->write_pb6(state); - m_via1->write_ca1(state); -} - -DECLARE_WRITE_LINE_MEMBER( victor9k_state::write_ndac ) -{ - m_via1->write_pb7(state); - m_via1->write_ca2(state); -} - -WRITE8_MEMBER( victor9k_state::via1_pb_w ) -{ - /* - - bit description - - PB0 STROBE/DAV - PB1 PI/EOI - PB2 REN - PB3 ATN - PB4 IFC - PB5 SRQ/BUSY SRQ - PB6 NRFD/ACK RFD - PB7 SEL/DAC - - */ - - // centronics - m_centronics->write_strobe(BIT(data, 0)); - - // IEEE-488 - m_ieee488->dav_w(BIT(data, 0)); - m_ieee488->eoi_w(BIT(data, 1)); - m_ieee488->ren_w(BIT(data, 2)); - m_ieee488->atn_w(BIT(data, 3)); - m_ieee488->ifc_w(BIT(data, 4)); - m_ieee488->srq_w(BIT(data, 5)); - m_ieee488->nrfd_w(BIT(data, 6)); - m_ieee488->ndac_w(BIT(data, 7)); -} - -WRITE_LINE_MEMBER( victor9k_state::codec_vol_w ) -{ -} - -WRITE_LINE_MEMBER( victor9k_state::via1_irq_w ) -{ - m_via1_irq = state; - - m_pic->ir3_w(m_ssda_irq || m_via1_irq || m_via3_irq || m_fdc_irq); -} - -WRITE8_MEMBER( victor9k_state::via2_pa_w ) -{ - /* - - bit description - - PA0 _INT/EXTA - PA1 _INT/EXTB - PA2 - PA3 - PA4 - PA5 - PA6 - PA7 - - */ -} - -void victor9k_state::update_kback() -{ - int kback = !(!(m_kbrdy && !m_via2_irq) && !(m_kbackctl && m_via2_irq)); - - m_kb->kback_w(kback); -} - -WRITE8_MEMBER( victor9k_state::via2_pb_w ) -{ - /* - - bit description - - PB0 TALK/LISTEN - PB1 KBACKCTL - PB2 BRT0 - PB3 BRT1 - PB4 BRT2 - PB5 CONT0 - PB6 CONT1 - PB7 CONT2 - - */ - - // keyboard acknowledge - m_kbackctl = BIT(data, 1); - update_kback(); - - // brightness - m_brt = (data >> 2) & 0x07; - - // contrast - m_cont = data >> 5; -} - -WRITE_LINE_MEMBER( victor9k_state::via2_irq_w ) -{ - m_via2_irq = state; - - m_pic->ir6_w(m_via2_irq); - update_kback(); -} - - -WRITE_LINE_MEMBER( victor9k_state::write_ria ) -{ - m_upd7201->ria_w(state); - m_via2->write_pa2(state); -} - - -WRITE_LINE_MEMBER( victor9k_state::write_rib ) -{ - m_upd7201->rib_w(state); - m_via2->write_pa4(state); -} - - -/* - bit description - - PA0 J5-16 - PA1 J5-18 - PA2 J5-20 - PA3 J5-22 - PA4 J5-24 - PA5 J5-26 - PA6 J5-28 - PA7 J5-30 - PB0 J5-32 - PB1 J5-34 - PB2 J5-36 - PB3 J5-38 - PB4 J5-40 - PB5 J5-42 - PB6 J5-44 - PB7 J5-46 - CA1 J5-12 - CB1 J5-48 - CA2 J5-14 - CB2 J5-50 -*/ - -WRITE8_MEMBER( victor9k_state::via3_pb_w ) -{ - // codec clock output - m_ssda->rx_clk_w(BIT(data, 7)); - m_ssda->tx_clk_w(BIT(data, 7)); -} - -WRITE_LINE_MEMBER( victor9k_state::via3_irq_w ) -{ - m_via3_irq = state; - - m_pic->ir3_w(m_ssda_irq || m_via1_irq || m_via3_irq || m_fdc_irq); -} - - -//------------------------------------------------- -// VICTOR9K_KEYBOARD_INTERFACE( kb_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( victor9k_state::kbrdy_w ) -{ - if (LOG) logerror("KBRDY %u\n", state); - - m_via2->write_cb1(state); - - m_kbrdy = state; - update_kback(); -} - -WRITE_LINE_MEMBER( victor9k_state::kbdata_w ) -{ - if (LOG) logerror("KBDATA %u\n", state); - - m_via2->write_cb2(state); - m_via2->write_pa6(state); -} - - -WRITE_LINE_MEMBER( victor9k_state::fdc_irq_w ) -{ - m_fdc_irq = state; - - m_pic->ir3_w(m_ssda_irq || m_via1_irq || m_via3_irq || m_fdc_irq); -} - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -void victor9k_state::machine_start() -{ - // state saving - save_item(NAME(m_brt)); - save_item(NAME(m_cont)); - save_item(NAME(m_via1_irq)); - save_item(NAME(m_via2_irq)); - save_item(NAME(m_via3_irq)); - save_item(NAME(m_fdc_irq)); - save_item(NAME(m_ssda_irq)); - save_item(NAME(m_kbrdy)); - save_item(NAME(m_kbackctl)); - - // patch out SCP self test - m_rom->base()[0x11ab] = 0xc3; - - // patch out ROM checksum error - m_rom->base()[0x1d51] = 0x90; - m_rom->base()[0x1d52] = 0x90; - m_rom->base()[0x1d53] = 0x90; - m_rom->base()[0x1d54] = 0x90; -} - -void victor9k_state::machine_reset() -{ - m_maincpu->reset(); - m_upd7201->reset(); - m_ssda->reset(); - m_via1->reset(); - m_via2->reset(); - m_via3->reset(); - m_crtc->reset(); - m_fdc->reset(); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( victor9k ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( victor9k, victor9k_state ) - // basic machine hardware - MCFG_CPU_ADD(I8088_TAG, I8088, XTAL_30MHz/6) - MCFG_CPU_PROGRAM_MAP(victor9k_mem) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A_TAG, pic8259_device, inta_cb) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_UPDATE_DEVICE(HD46505S_TAG, hd6845_device, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - MCFG_MC6845_ADD(HD46505S_TAG, HD6845, SCREEN_TAG, XTAL_30MHz/11) // HD6845 == HD46505S - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(10) - MCFG_MC6845_UPDATE_ROW_CB(victor9k_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(victor9k_state, vert_w)) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(HC55516_TAG, HC55516, 100000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_IEEE488_BUS_ADD() - MCFG_IEEE488_DAV_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb0)) - MCFG_IEEE488_EOI_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb1)) - MCFG_IEEE488_REN_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb2)) - MCFG_IEEE488_ATN_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb3)) - MCFG_IEEE488_IFC_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb4)) - MCFG_IEEE488_SRQ_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb5)) - MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(victor9k_state, write_nfrd)) - MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(victor9k_state, write_ndac)) - - MCFG_PIC8259_ADD(I8259A_TAG, INPUTLINE(I8088_TAG, INPUT_LINE_IRQ0), VCC, NULL) - - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(2500000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(victor9k_state, mux_serial_b_w)) - MCFG_PIT8253_CLK1(2500000) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(victor9k_state, mux_serial_a_w)) - MCFG_PIT8253_CLK2(100000) - MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE(I8259A_TAG, pic8259_device, ir2_w)) - - MCFG_UPD7201_ADD(UPD7201_TAG, XTAL_30MHz/30, 0, 0, 0, 0) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir1_w)) - - MCFG_DEVICE_ADD(MC6852_TAG, MC6852, XTAL_30MHz/30) - MCFG_MC6852_TX_DATA_CALLBACK(DEVWRITELINE(HC55516_TAG, hc55516_device, digit_w)) - MCFG_MC6852_IRQ_CALLBACK(WRITELINE(victor9k_state, ssda_irq_w)) - - MCFG_DEVICE_ADD(M6522_1_TAG, VIA6522, XTAL_30MHz/30) - MCFG_VIA6522_READPA_HANDLER(DEVREAD8(IEEE488_TAG, ieee488_device, dio_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(victor9k_state, via1_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor9k_state, via1_pb_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(victor9k_state, codec_vol_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor9k_state, via1_irq_w)) - - MCFG_DEVICE_ADD(M6522_2_TAG, VIA6522, XTAL_30MHz/30) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(victor9k_state, via2_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor9k_state, via2_pb_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor9k_state, via2_irq_w)) - - MCFG_DEVICE_ADD(M6522_3_TAG, VIA6522, XTAL_30MHz/30) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor9k_state, via3_pb_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor9k_state, via3_irq_w)) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb5)) - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb6)) - MCFG_CENTRONICS_SELECT_HANDLER(DEVWRITELINE(M6522_1_TAG, via6522_device, write_pb7)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, dcda_w)) - MCFG_RS232_RI_HANDLER(WRITELINE(victor9k_state, write_ria)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, ctsa_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(M6522_2_TAG, via6522_device, write_pa3)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, dcdb_w)) - MCFG_RS232_RI_HANDLER(WRITELINE(victor9k_state, write_ria)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE(UPD7201_TAG, z80dart_device, ctsb_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(M6522_2_TAG, via6522_device, write_pa5)) - - MCFG_DEVICE_ADD(KB_TAG, VICTOR9K_KEYBOARD, 0) - MCFG_VICTOR9K_KBRDY_HANDLER(WRITELINE(victor9k_state, kbrdy_w)) - MCFG_VICTOR9K_KBDATA_HANDLER(WRITELINE(victor9k_state, kbdata_w)) - - MCFG_DEVICE_ADD(FDC_TAG, VICTOR_9000_FDC, 0) - MCFG_VICTOR_9000_FDC_IRQ_CB(WRITELINE(victor9k_state, fdc_irq_w)) - MCFG_VICTOR_9000_FDC_SYN_CB(DEVWRITELINE(I8259A_TAG, pic8259_device, ir0_w)) MCFG_DEVCB_XOR(1) - MCFG_VICTOR_9000_FDC_LBRDY_CB(INPUTLINE(I8088_TAG, INPUT_LINE_TEST)) MCFG_DEVCB_XOR(1) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "victor9k_flop") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( victor9k ) -//------------------------------------------------- - -ROM_START( victor9k ) - ROM_REGION( 0x2000, I8088_TAG, 0 ) - ROM_DEFAULT_BIOS( "univ" ) - ROM_SYSTEM_BIOS( 0, "old", "Older" ) - ROMX_LOAD( "102320.7j", 0x0000, 0x1000, CRC(3d615fd7) SHA1(b22f7e5d66404185395d8effbf57efded0079a92), ROM_BIOS(1) ) - ROMX_LOAD( "102322.8j", 0x1000, 0x1000, CRC(9209df0e) SHA1(3ee8e0c15186bbd5768b550ecc1fa3b6b1dbb928), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "univ", "Universal" ) - ROMX_LOAD( "v9000 univ. fe f3f7 13db.7j", 0x0000, 0x1000, CRC(25c7a59f) SHA1(8784e9aa7eb9439f81e18b8e223c94714e033911), ROM_BIOS(2) ) - ROMX_LOAD( "v9000 univ. ff f3f7 39fe.8j", 0x1000, 0x1000, CRC(496c7467) SHA1(eccf428f62ef94ab85f4a43ba59ae6a066244a66), ROM_BIOS(2) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1982, victor9k, 0, 0, victor9k, victor9k, driver_device, 0, "Victor Business Products", "Victor 9000", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/vidbrain.c b/src/mess/drivers/vidbrain.c deleted file mode 100644 index 7612dc337db..00000000000 --- a/src/mess/drivers/vidbrain.c +++ /dev/null @@ -1,601 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - VideoBrain FamilyComputer - - http://www.atariprotos.com/othersystems/videobrain/videobrain.htm - http://www.seanriddle.com/vbinfo.html - http://www.seanriddle.com/videobrain.html - http://www.google.com/patents/US4232374 - http://www.google.com/patents/US4177462 - http://www.orphanedgames.com/videobrain/ - http://www.datalytixllc.com/videobrain/ - http://blog.kevtris.org/blogfiles/videobrain/videobrain_unwrapped.txt - -****************************************************************************/ - -/* - - TODO: - - - wait states (UV201: 2.9us, memory except RES1: 1.65us) - - interlaced video? - - pinball background colors - - Y-zoom starting on odd scanline only 1 line high - - object height 0 glitch - - object column 0xff glitch - - video interrupts - - R-2R ladder DAC - - reset on cartridge unload - - use machine/f3853.h - - joystick scan timer 555 - - expander 1 (F3870 CPU, cassette, RS-232) - - expander 2 (modem) - -*/ - -#include "includes/vidbrain.h" -#include "vidbrain.lh" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 1 - - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -//------------------------------------------------- -// keyboard_w - keyboard column write -//------------------------------------------------- - -WRITE8_MEMBER( vidbrain_state::keyboard_w ) -{ - /* - - bit description - - 0 keyboard column 0, sound data 0 - 1 keyboard column 1, sound data 1 - 2 keyboard column 2 - 3 keyboard column 3 - 4 keyboard column 4 - 5 keyboard column 5 - 6 keyboard column 6 - 7 keyboard column 7 - - */ - - if (LOG) logerror("Keyboard %02x\n", data); - - m_keylatch = data; -} - - -//------------------------------------------------- -// keyboard_r - keyboard row read -//------------------------------------------------- - -READ8_MEMBER( vidbrain_state::keyboard_r ) -{ - /* - - bit description - - 0 keyboard row 0, joystick 1 fire - 1 keyboard row 1, joystick 2 fire - 2 keyboard row 2, joystick 3 fire - 3 keyboard row 3, joystick 4 fire - 4 - 5 - 6 - 7 - - */ - - UINT8 data = m_joy_r->read(); - - if (BIT(m_keylatch, 0)) data |= m_io00->read(); - if (BIT(m_keylatch, 1)) data |= m_io01->read(); - if (BIT(m_keylatch, 2)) data |= m_io02->read(); - if (BIT(m_keylatch, 3)) data |= m_io03->read(); - if (BIT(m_keylatch, 4)) data |= m_io04->read(); - if (BIT(m_keylatch, 5)) data |= m_io05->read(); - if (BIT(m_keylatch, 6)) data |= m_io06->read(); - if (BIT(m_keylatch, 7)) data |= m_io07->read(); - if (!m_uv->kbd_r()) data |= m_uv201_31->read(); - - return data; -} - - -//------------------------------------------------- -// sound_w - sound clock write -//------------------------------------------------- - -WRITE8_MEMBER( vidbrain_state::sound_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 sound clock - 5 accessory jack pin 5 - 6 accessory jack pin 1 - 7 joystick enable - - */ - - if (LOG) logerror("Sound %02x\n", data); - - // sound clock - int sound_clk = BIT(data, 4); - - if (!m_sound_clk && sound_clk) - { - //m_discrete->write(space, NODE_01, m_keylatch & 0x03); - - UINT8 dac_data = 0; - - switch (m_keylatch & 0x03) - { - case 0: dac_data = 0x00; break; - case 1: dac_data = 0x55; break; - case 2: dac_data = 0xaa; break; - case 3: dac_data = 0xff; break; - } - - m_dac->write_unsigned8(dac_data); - } - - m_sound_clk = sound_clk; - - // joystick enable - m_joy_enable = BIT(data, 7); -} - - -//------------------------------------------------- -// interrupt_check - check interrupts -//------------------------------------------------- - -void vidbrain_state::interrupt_check() -{ - int interrupt = CLEAR_LINE; - - switch (m_int_enable) - { - case 1: - if (m_ext_int_latch) interrupt = ASSERT_LINE; - break; - - case 3: - if (m_timer_int_latch) interrupt = ASSERT_LINE; - break; - } - - m_maincpu->set_input_line(F8_INPUT_LINE_INT_REQ, interrupt); -} - - -//------------------------------------------------- -// f3853_w - F3853 SMI write -//------------------------------------------------- - -WRITE8_MEMBER( vidbrain_state::f3853_w ) -{ - switch (offset) - { - case 0: - // interrupt vector address high - m_vector = (data << 8) | (m_vector & 0xff); - logerror("%s: F3853 Interrupt Vector %04x\n", machine().describe_context(), m_vector); - break; - - case 1: - // interrupt vector address low - m_vector = (m_vector & 0xff00) | data; - logerror("%s: F3853 Interrupt Vector %04x\n", machine().describe_context(), m_vector); - break; - - case 2: - // interrupt control - m_int_enable = data & 0x03; - logerror("%s: F3853 Interrupt Control %u\n", machine().describe_context(), m_int_enable); - interrupt_check(); - - if (m_int_enable == 0x03) fatalerror("F3853 Timer not supported!\n"); - break; - - case 3: - // timer 8-bit polynomial counter - fatalerror("%s: F3853 Timer not supported!\n", machine().describe_context()); - } -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( vidbrain_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vidbrain_mem, AS_PROGRAM, 8, vidbrain_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3fff) - AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("res1", 0) - AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x2300) AM_DEVREADWRITE(UV201_TAG, uv201_device, read, write) - AM_RANGE(0x0c00, 0x0fff) AM_MIRROR(0x2000) AM_RAM - AM_RANGE(0x1000, 0x17ff) AM_DEVREADWRITE(VIDEOBRAIN_EXPANSION_SLOT_TAG, videobrain_expansion_slot_device, cs1_r, cs1_w) - AM_RANGE(0x1800, 0x1fff) AM_DEVREADWRITE(VIDEOBRAIN_EXPANSION_SLOT_TAG, videobrain_expansion_slot_device, cs2_r, cs2_w) - AM_RANGE(0x2000, 0x27ff) AM_ROM AM_REGION("res2", 0) - AM_RANGE(0x3000, 0x3fff) AM_DEVREADWRITE(VIDEOBRAIN_EXPANSION_SLOT_TAG, videobrain_expansion_slot_device, unmap_r, unmap_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vidbrain_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vidbrain_io, AS_IO, 8, vidbrain_state ) - AM_RANGE(0x00, 0x00) AM_WRITE(keyboard_w) - AM_RANGE(0x01, 0x01) AM_READWRITE(keyboard_r, sound_w) - AM_RANGE(0x0c, 0x0f) AM_WRITE(f3853_w) -// AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(F3853_TAG, f3853_device, read, write) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_CHANGED_MEMBER( trigger_reset ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( vidbrain_state::trigger_reset ) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); -} - - -//------------------------------------------------- -// INPUT_PORTS( vidbrain ) -//------------------------------------------------- - -static INPUT_PORTS_START( vidbrain ) - PORT_START("IO00") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P \xC2\xA2") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR(0x00a2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; \xC2\xB6") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(0x00b6) - - PORT_START("IO01") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('$') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('\'') PORT_CHAR('*') - - PORT_START("IO02") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y \xC3\xB7") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR(0x00f7) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR(':') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("IO03") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T \xC3\x97") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR(0x00d7) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('/') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(',') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ERASE RESTART") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_START("IO04") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('9') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('=') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE RUN/STOP") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("IO05") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('6') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPECIAL ALARM") PORT_CODE(KEYCODE_F4) - - PORT_START("IO06") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('7') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT CLOCK") PORT_CODE(KEYCODE_F3) - - PORT_START("IO07") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('4') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PREVIOUS COLOR") PORT_CODE(KEYCODE_F2) - - PORT_START("UV201-31") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('.') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('0') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BACK TEXT") PORT_CODE(KEYCODE_F1) - - PORT_START("RESET") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MASTER CONTROL") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, vidbrain_state, trigger_reset, 0) - - PORT_START("JOY1-X") - PORT_BIT( 0xff, 50, IPT_AD_STICK_X ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(1) - - PORT_START("JOY1-Y") - PORT_BIT( 0xff, 50, IPT_AD_STICK_Y ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(1) - - PORT_START("JOY2-X") - PORT_BIT( 0xff, 50, IPT_AD_STICK_X ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(2) - - PORT_START("JOY2-Y") - PORT_BIT( 0xff, 50, IPT_AD_STICK_Y ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(2) - - PORT_START("JOY3-X") - PORT_BIT( 0xff, 50, IPT_AD_STICK_X ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(3) - - PORT_START("JOY3-Y") - PORT_BIT( 0xff, 50, IPT_AD_STICK_Y ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(3) - - PORT_START("JOY4-X") - PORT_BIT( 0xff, 50, IPT_AD_STICK_X ) PORT_MINMAX(0, 99) PORT_SENSITIVITY(25) PORT_PLAYER(4) - - PORT_START("JOY4-Y") - PORT_BIT( 0xff, 70, IPT_AD_STICK_Y ) PORT_MINMAX(0, 139) PORT_SENSITIVITY(25) PORT_PLAYER(4) - - PORT_START("JOY-R") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) -INPUT_PORTS_END - - - -//************************************************************************** -// SOUND -//************************************************************************** - -//------------------------------------------------- -// DISCRETE_SOUND( vidbrain ) -//------------------------------------------------- - -static const discrete_dac_r1_ladder vidbrain_dac = -{ - 2, - { RES_K(120), RES_K(120) }, // R=56K, 2R=120K - 0, 0, RES_K(120), 0 -}; - -static DISCRETE_SOUND_START( vidbrain ) - DISCRETE_INPUT_DATA(NODE_01) - DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &vidbrain_dac) - DISCRETE_OUTPUT(NODE_02, 5000) -DISCRETE_SOUND_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// f3853 interrupt request callback -//------------------------------------------------- - -F3853_INTERRUPT_REQ_CB(vidbrain_state::f3853_int_req_w) -{ - m_vector = addr; - m_maincpu->set_input_line(F8_INPUT_LINE_INT_REQ, level); -} - -//------------------------------------------------- -// UV201_INTERFACE( uv_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( vidbrain_state::ext_int_w ) -{ - if (state) - { - m_ext_int_latch = state; - interrupt_check(); - } -} - -WRITE_LINE_MEMBER( vidbrain_state::hblank_w ) -{ - if (state && m_joy_enable && !m_timer_ne555->enabled()) - { - UINT8 joydata = 0; - - if (!BIT(m_keylatch, 0)) joydata = m_joy1_x->read(); - if (!BIT(m_keylatch, 1)) joydata = m_joy1_y->read(); - if (!BIT(m_keylatch, 2)) joydata = m_joy2_x->read(); - if (!BIT(m_keylatch, 3)) joydata = m_joy2_y->read(); - if (!BIT(m_keylatch, 4)) joydata = m_joy3_x->read(); - if (!BIT(m_keylatch, 5)) joydata = m_joy3_y->read(); - if (!BIT(m_keylatch, 6)) joydata = m_joy4_x->read(); - if (!BIT(m_keylatch, 7)) joydata = m_joy4_y->read(); - - // NE555 in monostable mode - // R = 3K9 + 100K linear pot - // C = 0.003uF - // t = 1.1 * R * C - double t = 1.1 * (RES_K(3.9) + RES_K(joydata)) * 3; - - timer_set(attotime::from_nsec(t), TIMER_JOYSTICK); - } -} - -READ8_MEMBER(vidbrain_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// IRQ_CALLBACK_MEMBER(vidbrain_int_ack) -//------------------------------------------------- - -IRQ_CALLBACK_MEMBER(vidbrain_state::vidbrain_int_ack) -{ - UINT16 vector = m_vector; - - switch (m_int_enable) - { - case 1: - vector |= 0x80; - m_ext_int_latch = 0; - break; - - case 3: - vector &= ~0x80; - m_timer_int_latch = 0; - break; - } - - interrupt_check(); - - return vector; -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void vidbrain_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - m_uv->ext_int_w(0); - - m_ext_int_latch = 1; - interrupt_check(); -} - - -//------------------------------------------------- -// MACHINE_START( vidbrain ) -//------------------------------------------------- - -void vidbrain_state::machine_start() -{ - // allocate timers - m_timer_ne555 = timer_alloc(TIMER_JOYSTICK); - - // register for state saving - save_item(NAME(m_vector)); - save_item(NAME(m_int_enable)); - save_item(NAME(m_ext_int_latch)); - save_item(NAME(m_timer_int_latch)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_joy_enable)); - save_item(NAME(m_sound_clk)); -} - - -void vidbrain_state::machine_reset() -{ - m_int_enable = 0; - m_ext_int_latch = 0; - m_timer_int_latch = 0; -} - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( vidbrain ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( vidbrain, vidbrain_state ) - // basic machine hardware - MCFG_CPU_ADD(F3850_TAG, F8, XTAL_4MHz/2) - MCFG_CPU_PROGRAM_MAP(vidbrain_mem) - MCFG_CPU_IO_MAP(vidbrain_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vidbrain_state,vidbrain_int_ack) - - // video hardware - MCFG_DEFAULT_LAYOUT(layout_vidbrain) - - MCFG_UV201_ADD(UV201_TAG, SCREEN_TAG, 3636363, uv_intf) - MCFG_UV201_EXT_INT_CALLBACK(WRITELINE(vidbrain_state, ext_int_w)) - MCFG_UV201_HBLANK_CALLBACK(WRITELINE(vidbrain_state, hblank_w)) - MCFG_UV201_DB_CALLBACK(READ8(vidbrain_state, memory_read_byte)) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(vidbrain) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - MCFG_SOUND_ADD(DAC_TAG, DAC, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - // devices - MCFG_DEVICE_ADD(F3853_TAG, F3853, XTAL_4MHz/2) - MCFG_F3853_EXT_INPUT_CB(vidbrain_state, f3853_int_req_w) - - // cartridge - MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(VIDEOBRAIN_EXPANSION_SLOT_TAG, vidbrain_expansion_cards, NULL) - - // software lists - MCFG_SOFTWARE_LIST_ADD("cart_list", "vidbrain") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( vidbrain ) -//------------------------------------------------- - -ROM_START( vidbrain ) - ROM_REGION( 0x800, "res1", 0 ) - ROM_LOAD( "uvres 1n.d67", 0x000, 0x800, CRC(065fe7c2) SHA1(9776f9b18cd4d7142e58eff45ac5ee4bc1fa5a2a) ) - - ROM_REGION( 0x800, "res2", 0 ) - ROM_LOAD( "resn2.e5", 0x000, 0x800, CRC(1d85d7be) SHA1(26c5a25d1289dedf107fa43aa8dfc14692fd9ee6) ) - - ROM_REGION( 0x800, F3870_TAG, 0 ) - ROM_LOAD( "expander1.bin", 0x0000, 0x0800, CRC(dac31abc) SHA1(e1ac7a9d654c2a70979effc744d98f21d13b4e05) ) -ROM_END - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1977, vidbrain, 0, 0, vidbrain, vidbrain, driver_device, 0, "VideoBrain Computer Company", "VideoBrain FamilyComputer", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mess/drivers/vii.c b/src/mess/drivers/vii.c deleted file mode 100644 index 8b845590826..00000000000 --- a/src/mess/drivers/vii.c +++ /dev/null @@ -1,1234 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz, Robbbert -/****************************************************************************** - - - Sport Vii / The Batman - ---------------------- - - MESS driver by Harmony - Based largely off of Unununium, by Segher - - -******************************************************************************* - - Short Description: - - Systems run on the SPG243 SoC - - Status: - - Mostly working - - To-Do: - - Audio (SPG243) - Motion controls (Vii) - - Known u'nSP-Based Systems: - - ND - SPG243 - Some form of Leapfrog "edutainment" system - ND - SPG243 - Star Wars: Clone Wars - ND - SPG243 - Toy Story - ND - SPG243 - Animal Art Studio - ND - SPG243 - Finding Nemo - D - SPG243 - The Batman - D - SPG243 - Wall-E - D - SPG243 - Chintendo / KenSingTon / Siatronics / Jungle Soft Vii - Partial D - SPG200 - V-Tech V-Smile - ND - Likely many more - - -Similar Systems: ( from http://en.wkikpedia.org/wiki/V.Smile ) -- V.Smile by Vtech, a system designed for children under the age of 10 -- V.Smile Pocket (2 versions) -- V.SMile Cyber Pocket -- V.Smile PC Pal -- V-Motion Active Learning System -- Leapster -- V.Smile Baby Infant Development System -- V.Flash - -Detailed list of bugs: -- When loading a cart from file manager, sometimes it will crash -- On 'vii_vc1' & 'vii_vc2' cart, the left-right keys are transposed with the up-down keys -- The game 'Jewel Master' on both above carts displays a priority error at top of screen -- In the default bios (no cart loaded): --- In the menu, when 'Come On!' is selected, a graphics error appears --- Catch Fish, black screen --- Come On! freezes at the high score screen, controls seem haywire --- Bird Knight, no controls --- Lucky Dice, the dice never stop spinning --- Fever Move, after pressing A it freezes --- Alacrity Golf, black screen --- Smart Dart, black screen --- Happy Tennis, controls are haywire --- Bowling, freezes at the high score screen - - -*******************************************************************************/ - -#include "emu.h" -#include "cpu/unsp/unsp.h" -#include "machine/i2cmem.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -#define PAGE_ENABLE_MASK 0x0008 - -#define PAGE_DEPTH_FLAG_MASK 0x3000 -#define PAGE_DEPTH_FLAG_SHIFT 12 -#define PAGE_TILE_HEIGHT_MASK 0x00c0 -#define PAGE_TILE_HEIGHT_SHIFT 6 -#define PAGE_TILE_WIDTH_MASK 0x0030 -#define PAGE_TILE_WIDTH_SHIFT 4 -#define TILE_X_FLIP 0x0004 -#define TILE_Y_FLIP 0x0008 - -class vii_state : public driver_device -{ -public: - vii_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_p_ram(*this, "p_ram"), - m_p_rowscroll(*this, "p_rowscroll"), - m_p_palette(*this, "p_palette"), - m_p_spriteram(*this, "p_spriteram"), - m_bios_rom(*this, "bios"), - m_io_p1(*this, "P1") - { } - - required_device m_maincpu; - optional_device m_cart; - DECLARE_READ16_MEMBER(video_r); - DECLARE_WRITE16_MEMBER(video_w); - DECLARE_READ16_MEMBER(audio_r); - DECLARE_WRITE16_MEMBER(audio_w); - DECLARE_READ16_MEMBER(io_r); - DECLARE_WRITE16_MEMBER(io_w); - DECLARE_WRITE16_MEMBER(rowscroll_w); - DECLARE_WRITE16_MEMBER(spriteram_w); - DECLARE_READ16_MEMBER(rom_r); - required_shared_ptr m_p_ram; - required_shared_ptr m_p_rowscroll; - required_shared_ptr m_p_palette; - required_shared_ptr m_p_spriteram; - - std::vector m_p_cart; - - UINT32 m_current_bank; - - UINT16 m_video_regs[0x100]; - UINT32 m_centered_coordinates; - void test_centered(UINT8 *ROM); - - struct - { - UINT8 r, g, b; - } - m_screenram[320*240]; - - UINT16 m_io_regs[0x200]; - UINT16 m_uart_rx_count; - UINT8 m_controller_input[8]; - UINT32 m_spg243_mode; - - emu_timer *m_tmb1; - emu_timer *m_tmb2; - void do_dma(UINT32 len); - void do_gpio(UINT32 offset); - void switch_bank(UINT32 bank); - void do_i2c(); - void spg_do_dma(UINT32 len); - DECLARE_DRIVER_INIT(vsmile); - DECLARE_DRIVER_INIT(walle); - DECLARE_DRIVER_INIT(vii); - DECLARE_DRIVER_INIT(batman); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vii_vblank); - TIMER_CALLBACK_MEMBER(tmb1_tick); - TIMER_CALLBACK_MEMBER(tmb2_tick); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vii_cart); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vsmile_cart); - -protected: - optional_memory_region m_bios_rom; - required_ioport m_io_p1; - - memory_region *m_cart_rom; - - void blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile); - void blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs); - void blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr); - void blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth); - inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); - inline UINT8 expand_rgb5_to_rgb8(UINT8 val); - inline UINT8 mix_channel(UINT8 a, UINT8 b); - void mix_pixel(UINT32 offset, UINT16 rgb); - void set_pixel(UINT32 offset, UINT16 rgb); -}; - -enum -{ - SPG243_VII = 0, - SPG243_BATMAN, - SPG243_VSMILE, - - SPG243_MODEL_COUNT -}; - - -#define VII_CTLR_IRQ_ENABLE m_io_regs[0x21] -#define VII_VIDEO_IRQ_ENABLE m_video_regs[0x62] -#define VII_VIDEO_IRQ_STATUS m_video_regs[0x63] - - -#define VERBOSE_LEVEL (3) - -#define ENABLE_VERBOSE_LOG (1) - -inline void vii_state::verboselog(int n_level, const char *s_fmt, ...) -{ -#if ENABLE_VERBOSE_LOG - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - } -#endif -} - -/************************* -* Video Hardware * -*************************/ - -void vii_state::video_start() -{ -} - -inline UINT8 vii_state::expand_rgb5_to_rgb8(UINT8 val) -{ - UINT8 temp = val & 0x1f; - return (temp << 3) | (temp >> 2); -} - -// Perform a lerp between a and b -inline UINT8 vii_state::mix_channel(UINT8 a, UINT8 b) -{ - UINT8 alpha = m_video_regs[0x1c] & 0x00ff; - return ((64 - alpha) * a + alpha * b) / 64; -} - -void vii_state::mix_pixel(UINT32 offset, UINT16 rgb) -{ - m_screenram[offset].r = mix_channel(m_screenram[offset].r, expand_rgb5_to_rgb8(rgb >> 10)); - m_screenram[offset].g = mix_channel(m_screenram[offset].g, expand_rgb5_to_rgb8(rgb >> 5)); - m_screenram[offset].b = mix_channel(m_screenram[offset].b, expand_rgb5_to_rgb8(rgb)); -} - -void vii_state::set_pixel(UINT32 offset, UINT16 rgb) -{ - m_screenram[offset].r = expand_rgb5_to_rgb8(rgb >> 10); - m_screenram[offset].g = expand_rgb5_to_rgb8(rgb >> 5); - m_screenram[offset].b = expand_rgb5_to_rgb8(rgb); -} - -void vii_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - UINT32 h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT); - UINT32 w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT); - - UINT32 yflipmask = attr & TILE_Y_FLIP ? h - 1 : 0; - UINT32 xflipmask = attr & TILE_X_FLIP ? w - 1 : 0; - - UINT32 nc = ((attr & 0x0003) + 1) << 1; - - UINT32 palette_offset = (attr & 0x0f00) >> 4; - palette_offset >>= nc; - palette_offset <<= nc; - - UINT32 m = bitmap_addr + nc*w*h/16*tile; - UINT32 bits = 0; - UINT32 nbits = 0; - - UINT32 x, y; - - for(y = 0; y < h; y++) - { - UINT32 yy = (yoff + (y ^ yflipmask)) & 0x1ff; - - for(x = 0; x < w; x++) - { - UINT32 xx = (xoff + (x ^ xflipmask)) & 0x1ff; - UINT32 pal; - - bits <<= nc; - if(nbits < nc) - { - UINT16 b = space.read_word((m++ & 0x3fffff) << 1); - b = (b << 8) | (b >> 8); - bits |= b << (nc - nbits); - nbits += 16; - } - nbits -= nc; - - pal = palette_offset | (bits >> 16); - bits &= 0xffff; - - if((ctrl & 0x0010) && yy < 240) - { - xx = (xx - (INT16)m_p_rowscroll[yy]) & 0x01ff; - } - - if(xx < 320 && yy < 240) - { - UINT16 rgb = m_p_palette[pal]; - if(!(rgb & 0x8000)) - { - if (attr & 0x4000) - { - mix_pixel(xx + 320*yy, rgb); - } - else - { - set_pixel(xx + 320*yy, rgb); - } - } - } - } - } -} - -void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 bitmap_addr, UINT16 *regs) -{ - UINT32 x0, y0; - UINT32 xscroll = regs[0]; - UINT32 yscroll = regs[1]; - UINT32 attr = regs[2]; - UINT32 ctrl = regs[3]; - UINT32 tilemap = regs[4]; - UINT32 palette_map = regs[5]; - UINT32 h, w, hn, wn; - address_space &space = m_maincpu->space(AS_PROGRAM); - - if(!(ctrl & PAGE_ENABLE_MASK)) - { - return; - } - - if(((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth) - { - return; - } - - h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT); - w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT); - - hn = 256 / h; - wn = 512 / w; - - for(y0 = 0; y0 < hn; y0++) - { - for(x0 = 0; x0 < wn; x0++) - { - UINT16 tile = space.read_word((tilemap + x0 + wn * y0) << 1); - UINT16 palette = 0; - UINT32 xx, yy; - - if(!tile) - { - continue; - } - - palette = space.read_word((palette_map + (x0 + wn * y0) / 2) << 1); - if(x0 & 1) - { - palette >>= 8; - } - - UINT32 tileattr = attr; - UINT32 tilectrl = ctrl; - if ((ctrl & 2) == 0) - { // -(1) bld(1) flip(2) pal(4) - tileattr &= ~0x000c; - tileattr |= (palette >> 2) & 0x000c; // flip - - tileattr &= ~0x0f00; - tileattr |= (palette << 8) & 0x0f00; // palette - - tileattr &= ~0x0100; - tileattr |= (palette << 2) & 0x0100; // blend - } - - yy = ((h*y0 - yscroll + 0x10) & 0xff) - 0x10; - xx = (w*x0 - xscroll) & 0x1ff; - - blit(bitmap, cliprect, xx, yy, tileattr, tilectrl, bitmap_addr, tile); - } - } -} - -void vii_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT16 tile, attr; - INT16 x, y; - UINT32 h, w; - UINT32 bitmap_addr = 0x40 * m_video_regs[0x22]; - - tile = space.read_word((base_addr + 0) << 1); - x = space.read_word((base_addr + 1) << 1); - y = space.read_word((base_addr + 2) << 1); - attr = space.read_word((base_addr + 3) << 1); - - if(!tile) - { - return; - } - - if(((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth) - { - return; - } - - if(m_centered_coordinates) - { - x = 160 + x; - y = 120 - y; - - h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT); - w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT); - - x -= (w/2); - y -= (h/2) - 8; - } - - x &= 0x01ff; - y &= 0x01ff; - - blit(bitmap, cliprect, x, y, attr, 0, bitmap_addr, tile); -} - -void vii_state::blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth) -{ - UINT32 n; - - if (!(m_video_regs[0x42] & 1)) - { - return; - } - - for(n = 0; n < 256; n++) - { - //if(space.read_word((0x2c00 + 4*n) << 1)) - { - blit_sprite(bitmap, cliprect, depth, 0x2c00 + 4*n); - } - } -} - -UINT32 vii_state::screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int i, x, y; - - bitmap.fill(0, cliprect); - - memset(m_screenram, 0, sizeof(m_screenram)); - - for(i = 0; i < 4; i++) - { - blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x20], m_video_regs + 0x10); - blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x21], m_video_regs + 0x16); - blit_sprites(bitmap, cliprect, i); - } - - for(y = 0; y < 240; y++) - { - for(x = 0; x < 320; x++) - { - bitmap.pix32(y, x) = (m_screenram[x + 320*y].r << 16) | (m_screenram[x + 320*y].g << 8) | m_screenram[x + 320*y].b; - } - } - - return 0; -} - -/************************* -* Machine Hardware * -*************************/ - -void vii_state::do_dma(UINT32 len) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT32 src = m_video_regs[0x70]; - UINT32 dst = m_video_regs[0x71] + 0x2c00; - UINT32 j; - - for(j = 0; j < len; j++) - { - mem.write_word((dst+j) << 1, mem.read_word((src+j) << 1)); - } - - m_video_regs[0x72] = 0; - m_video_regs[0x63] |= 4; -} - -READ16_MEMBER( vii_state::video_r ) -{ - switch(offset) - { - case 0x62: // Video IRQ Enable - verboselog(0, "video_r: Video IRQ Enable: %04x\n", VII_VIDEO_IRQ_ENABLE); - return VII_VIDEO_IRQ_ENABLE; - - case 0x63: // Video IRQ Status - verboselog(0, "video_r: Video IRQ Status: %04x\n", VII_VIDEO_IRQ_STATUS); - return VII_VIDEO_IRQ_STATUS; - - default: - verboselog(0, "video_r: Unknown register %04x = %04x\n", 0x2800 + offset, m_video_regs[offset]); - break; - } - return m_video_regs[offset]; -} - -WRITE16_MEMBER( vii_state::video_w ) -{ - switch(offset) - { - case 0x10: case 0x16: // page 1,2 X scroll - data &= 0x01ff; - COMBINE_DATA(&m_video_regs[offset]); - break; - - case 0x11: case 0x17: // page 1,2 Y scroll - data &= 0x00ff; - COMBINE_DATA(&m_video_regs[offset]); - break; - case 0x36: // IRQ pos V - case 0x37: // IRQ pos H - data &= 0x01ff; - COMBINE_DATA(&m_video_regs[offset]); - break; - case 0x62: // Video IRQ Enable - verboselog(0, "video_w: Video IRQ Enable = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&VII_VIDEO_IRQ_ENABLE); - break; - - case 0x63: // Video IRQ Acknowledge - verboselog(0, "video_w: Video IRQ Acknowledge = %04x (%04x)\n", data, mem_mask); - VII_VIDEO_IRQ_STATUS &= ~data; - if(!VII_VIDEO_IRQ_STATUS) - { - m_maincpu->set_input_line(UNSP_IRQ0_LINE, CLEAR_LINE); - } - break; - - case 0x70: // Video DMA Source - verboselog(0, "video_w: Video DMA Source = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_video_regs[offset]); - break; - - case 0x71: // Video DMA Dest - verboselog(0, "video_w: Video DMA Dest = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_video_regs[offset]); - break; - - case 0x72: // Video DMA Length - verboselog(0, "video_w: Video DMA Length = %04x (%04x)\n", data, mem_mask); - do_dma(data); - break; - - default: - verboselog(0, "video_w: Unknown register %04x = %04x (%04x)\n", 0x2800 + offset, data, mem_mask); - COMBINE_DATA(&m_video_regs[offset]); - break; - } -} - -READ16_MEMBER( vii_state::audio_r ) -{ - switch(offset) - { - default: - verboselog(4, "audio_r: Unknown register %04x\n", 0x3000 + offset); - break; - } - return 0; -} - -WRITE16_MEMBER( vii_state::audio_w ) -{ - switch(offset) - { - default: - verboselog(4, "audio_w: Unknown register %04x = %04x (%04x)\n", 0x3000 + offset, data, mem_mask); - break; - } -} - -void vii_state::switch_bank(UINT32 bank) -{ - if (bank != m_current_bank) - { - m_current_bank = bank; - if (m_cart_rom) - memcpy(&m_p_cart[0], m_cart_rom->base() + 0x400000 * bank * 2, 0x400000 * 2); - else - memcpy(&m_p_cart[0], m_bios_rom->base() + 0x400000 * bank * 2, 0x400000 * 2); - } -} - -void vii_state::do_gpio(UINT32 offset) -{ - UINT32 index = (offset - 1) / 5; - UINT16 buffer = m_io_regs[5*index + 2]; - UINT16 dir = m_io_regs[5*index + 3]; - UINT16 attr = m_io_regs[5*index + 4]; - UINT16 special= m_io_regs[5*index + 5]; - - UINT16 push = dir; - UINT16 pull = (~dir) & (~attr); - UINT16 what = (buffer & (push | pull)); - what ^= (dir & ~attr); - what &= ~special; - - if (m_spg243_mode == SPG243_VII) - { - if(index == 1) - { - UINT32 bank = ((what & 0x80) >> 7) | ((what & 0x20) >> 4); - switch_bank(bank); - } - } - else if (m_spg243_mode == SPG243_BATMAN) - { - if(index == 0) - { - UINT16 temp = m_io_p1->read(); - what |= (temp & 0x0001) ? 0x8000 : 0; - what |= (temp & 0x0002) ? 0x4000 : 0; - what |= (temp & 0x0004) ? 0x2000 : 0; - what |= (temp & 0x0008) ? 0x1000 : 0; - what |= (temp & 0x0010) ? 0x0800 : 0; - what |= (temp & 0x0020) ? 0x0400 : 0; - what |= (temp & 0x0040) ? 0x0200 : 0; - what |= (temp & 0x0080) ? 0x0100 : 0; - } - - if(index == 2) - { - } - } - else if (m_spg243_mode == SPG243_VSMILE) - { - // TODO: find out how vsmile accesses these GPIO regs! - } - - m_io_regs[5*index + 1] = what; -} - -void vii_state::do_i2c() -{ -} - -void vii_state::spg_do_dma(UINT32 len) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - - UINT32 src = ((m_io_regs[0x101] & 0x3f) << 16) | m_io_regs[0x100]; - UINT32 dst = m_io_regs[0x103] & 0x3fff; - UINT32 j; - - for(j = 0; j < len; j++) - mem.write_word((dst+j) << 1, mem.read_word((src+j) << 1)); - - m_io_regs[0x102] = 0; -} - -READ16_MEMBER( vii_state::io_r ) -{ - static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" }; - static const char gpioports[] = { 'A', 'B', 'C' }; - - UINT16 val = m_io_regs[offset]; - - switch(offset) - { - case 0x01: case 0x06: case 0x0b: // GPIO Data Port A/B/C - do_gpio(offset); - verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask); - val = m_io_regs[offset]; - break; - - case 0x02: case 0x03: case 0x04: case 0x05: - case 0x07: case 0x08: case 0x09: case 0x0a: - case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Other GPIO regs - verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask); - break; - - case 0x1c: // Random - val = machine().rand() & 0x00ff; - verboselog(3, "io_r: Random = %04x (%04x)\n", val, mem_mask); - break; - - case 0x21: // IRQ Control - verboselog(3, "io_r: Controller IRQ Control = %04x (%04x)\n", val, mem_mask); - break; - - case 0x22: // IRQ Status - verboselog(3, "io_r: Controller IRQ Status = %04x (%04x)\n", val, mem_mask); - break; - - case 0x2c: case 0x2d: // Timers? - val = machine().rand() & 0x0000ffff; - verboselog(3, "io_r: Unknown Timer %d Register = %04x (%04x)\n", offset - 0x2c, val, mem_mask); - break; - - case 0x2f: // Data Segment - val = m_maincpu->state_int(UNSP_SR) >> 10; - verboselog(3, "io_r: Data Segment = %04x (%04x)\n", val, mem_mask); - break; - - case 0x31: // Unknown, UART Status? - verboselog(3, "io_r: Unknown (UART Status?) = %04x (%04x)\n", 3, mem_mask); - val = 3; - break; - - case 0x36: // UART RX Data - val = m_controller_input[m_uart_rx_count]; - m_uart_rx_count = (m_uart_rx_count + 1) % 8; - verboselog(3, "io_r: UART RX Data = %04x (%04x)\n", val, mem_mask); - break; - - case 0x59: // I2C Status - verboselog(3, "io_r: I2C Status = %04x (%04x)\n", val, mem_mask); - break; - - case 0x5e: // I2C Data In - verboselog(3, "io_r: I2C Data In = %04x (%04x)\n", val, mem_mask); - break; - - default: - verboselog(3, "io_r: Unknown register %04x\n", 0x3d00 + offset); - break; - } - - return val; -} - -WRITE16_MEMBER( vii_state::io_w ) -{ - static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" }; - static const char gpioports[3] = { 'A', 'B', 'C' }; - - UINT16 temp = 0; - - switch(offset) - { - case 0x00: // GPIO special function select - verboselog(3, "io_w: GPIO Function Select = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x01: case 0x06: case 0x0b: // GPIO data, port A/B/C - offset++; - // Intentional fallthrough - - case 0x02: case 0x03: case 0x04: case 0x05: // Port A - case 0x07: case 0x08: case 0x09: case 0x0a: // Port B - case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Port C - verboselog(3, "io_w: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - do_gpio(offset); - break; - - case 0x10: // timebase control - if ((m_io_regs[offset] & 0x0003) != (data & 0x0003)) { - UINT16 hz = 8 << (data & 0x0003); - verboselog(3, "*** TMB1 FREQ set to %dHz\n", hz); - m_tmb1->adjust(attotime::zero, 0, attotime::from_hz( hz )); - } - if ((m_io_regs[offset] & 0x000c) != (data & 0x000c)) { - UINT16 hz = 128 << ((data & 0x000c) >> 2); - verboselog(3, "*** TMB2 FREQ set to %dHz\n", hz); - m_tmb2->adjust(attotime::zero, 0, attotime::from_hz( hz )); - } - COMBINE_DATA(&m_io_regs[offset]); - break; - case 0x21: // IRQ Enable - verboselog(3, "io_w: Controller IRQ Control = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&VII_CTLR_IRQ_ENABLE); - if(!VII_CTLR_IRQ_ENABLE) - { - m_maincpu->set_input_line(UNSP_IRQ3_LINE, CLEAR_LINE); - } - break; - - case 0x22: // IRQ Acknowledge - verboselog(3, "io_w: Controller IRQ Acknowledge = %04x (%04x)\n", data, mem_mask); - m_io_regs[0x22] &= ~data; - if(!m_io_regs[0x22]) - { - m_maincpu->set_input_line(UNSP_IRQ3_LINE, CLEAR_LINE); - } - break; - - case 0x2f: // Data Segment - temp = m_maincpu->state_int(UNSP_SR); - m_maincpu->set_state_int(UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10)); - verboselog(3, "io_w: Data Segment = %04x (%04x)\n", data, mem_mask); - break; - - case 0x31: // Unknown UART - verboselog(3, "io_w: Unknown UART = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x32: // UART Reset - verboselog(3, "io_w: UART Reset\n"); - break; - - case 0x33: // UART Baud Rate - verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (m_io_regs[0x34] << 8) - data)); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x35: // UART TX Data - verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (data << 8) - m_io_regs[0x33])); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5a: // I2C Access Mode - verboselog(3, "io_w: I2C Access Mode = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5b: // I2C Device Address - verboselog(3, "io_w: I2C Device Address = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5c: // I2C Sub-Address - verboselog(3, "io_w: I2C Sub-Address = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5d: // I2C Data Out - verboselog(3, "io_w: I2C Data Out = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5e: // I2C Data In - verboselog(3, "io_w: I2C Data In = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5f: // I2C Controller Mode - verboselog(3, "io_w: I2C Controller Mode = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x58: // I2C Command - verboselog(3, "io_w: I2C Command = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - do_i2c(); - break; - - case 0x59: // I2C Status / IRQ Acknowledge(?) - verboselog(3, "io_w: I2C Status / Ack = %04x (%04x)\n", data, mem_mask); - m_io_regs[offset] &= ~data; - break; - - case 0x100: // DMA Source (L) - case 0x101: // DMA Source (H) - case 0x103: // DMA Destination - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x102: // DMA Length - spg_do_dma(data); - break; - - default: - verboselog(3, "io_w: Unknown register %04x = %04x (%04x)\n", 0x3d00 + offset, data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - } -} - -/* -WRITE16_MEMBER( vii_state::rowscroll_w ) -{ - switch(offset) - { - default: - verboselog(0, "rowscroll_w: %04x = %04x (%04x)\n", 0x2900 + offset, data, mem_mask); - break; - } -} - -WRITE16_MEMBER( vii_state::spriteram_w ) -{ - switch(offset) - { - default: - verboselog(0, "spriteram_w: %04x = %04x (%04x)\n", 0x2c00 + offset, data, mem_mask); - break; - } -} -*/ - -READ16_MEMBER( vii_state::rom_r ) -{ - return m_p_cart[offset + 0x4000]; -} - -static ADDRESS_MAP_START( vii_mem, AS_PROGRAM, 16, vii_state ) - AM_RANGE( 0x000000, 0x0027ff ) AM_RAM AM_SHARE("p_ram") - AM_RANGE( 0x002800, 0x0028ff ) AM_READWRITE(video_r, video_w) - AM_RANGE( 0x002900, 0x002aff ) AM_RAM AM_SHARE("p_rowscroll") - AM_RANGE( 0x002b00, 0x002bff ) AM_RAM AM_SHARE("p_palette") - AM_RANGE( 0x002c00, 0x002fff ) AM_RAM AM_SHARE("p_spriteram") - AM_RANGE( 0x003000, 0x0037ff ) AM_READWRITE(audio_r, audio_w) - AM_RANGE( 0x003d00, 0x003eff ) AM_READWRITE(io_r, io_w) - AM_RANGE( 0x004000, 0x3fffff ) AM_READ(rom_r) -ADDRESS_MAP_END - -static INPUT_PORTS_START( vii ) - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Button A") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Button B") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Button C") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Button D") -INPUT_PORTS_END - -static INPUT_PORTS_START( batman ) - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Menu") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("B Button") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("X Button") -INPUT_PORTS_END - -static INPUT_PORTS_START( vsmile ) - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Menu") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("B Button") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("X Button") -INPUT_PORTS_END - -static INPUT_PORTS_START( walle ) - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("B Button") -INPUT_PORTS_END - - -void vii_state::test_centered(UINT8 *ROM) -{ - if (ROM[0x3cd808] == 0x99 && - ROM[0x3cd809] == 0x99 && - ROM[0x3cd80a] == 0x83 && - ROM[0x3cd80b] == 0x5e && - ROM[0x3cd80c] == 0x52 && - ROM[0x3cd80d] == 0x6b && - ROM[0x3cd80e] == 0x78 && - ROM[0x3cd80f] == 0x7f) - { - m_centered_coordinates = 0; - } -} - -DEVICE_IMAGE_LOAD_MEMBER( vii_state, vii_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size < 0x800000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - test_centered(m_cart->get_rom_base()); - - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_LOAD_MEMBER( vii_state, vsmile_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - - -TIMER_CALLBACK_MEMBER(vii_state::tmb1_tick) -{ - m_io_regs[0x22] |= 1; -} - -TIMER_CALLBACK_MEMBER(vii_state::tmb2_tick) -{ - m_io_regs[0x22] |= 2; -} - -void vii_state::machine_start() -{ - memset(m_video_regs, 0, 0x100 * sizeof(UINT16)); - memset(m_io_regs, 0, 0x100 * sizeof(UINT16)); - m_current_bank = 0; - - m_controller_input[0] = 0; - m_controller_input[4] = 0; - m_controller_input[6] = 0xff; - m_controller_input[7] = 0; - - m_p_cart.resize(0x400000); - - if (m_cart && m_cart->exists()) - { - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - memcpy(&m_p_cart[0], m_cart_rom->base(), 0x400000 * 2); - } - else if (m_spg243_mode == SPG243_VII) // Vii bios is banked - memcpy(&m_p_cart[0], m_bios_rom->base(), 0x400000 * 2); - else - memcpy(&m_p_cart[0], memregion("maincpu")->base(), 0x400000 * 2); - - m_video_regs[0x36] = 0xffff; - m_video_regs[0x37] = 0xffff; - - m_tmb1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb1_tick),this)); - m_tmb2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb2_tick),this)); - m_tmb1->reset(); - m_tmb2->reset(); -} - -void vii_state::machine_reset() -{ -} - -INTERRUPT_GEN_MEMBER(vii_state::vii_vblank) -{ - UINT32 x = machine().rand() & 0x3ff; - UINT32 y = machine().rand() & 0x3ff; - UINT32 z = machine().rand() & 0x3ff; - - - m_controller_input[0] = m_io_p1->read(); - m_controller_input[1] = (UINT8)x; - m_controller_input[2] = (UINT8)y; - m_controller_input[3] = (UINT8)z; - m_controller_input[4] = 0; - x >>= 8; - y >>= 8; - z >>= 8; - m_controller_input[5] = (z << 4) | (y << 2) | x; - m_controller_input[6] = 0xff; - m_controller_input[7] = 0; - - m_uart_rx_count = 0; - - VII_VIDEO_IRQ_STATUS = VII_VIDEO_IRQ_ENABLE & 1; - if(VII_VIDEO_IRQ_STATUS) - { - verboselog(0, "Video IRQ\n"); - m_maincpu->set_input_line(UNSP_IRQ0_LINE, ASSERT_LINE); - } - -// { -// verboselog(0, "audio 1 IRQ\n"); -// m_maincpu->set_input_line(UNSP_IRQ1_LINE, ASSERT_LINE); -// } - if(m_io_regs[0x22] & m_io_regs[0x21] & 0x0c00) - { - verboselog(0, "timerA, timer B IRQ\n"); - m_maincpu->set_input_line(UNSP_IRQ2_LINE, ASSERT_LINE); - } - - //if(m_io_regs[0x22] & m_io_regs[0x21] & 0x2100) - // For now trigger always if any enabled - if(VII_CTLR_IRQ_ENABLE) - { - verboselog(0, "UART, ADC IRQ\n"); - m_maincpu->set_input_line(UNSP_IRQ3_LINE, ASSERT_LINE); - } -// { -// verboselog(0, "audio 4 IRQ\n"); -// m_maincpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE); -// } - - if(m_io_regs[0x22] & m_io_regs[0x21] & 0x1200) - { - verboselog(0, "External IRQ\n"); - m_maincpu->set_input_line(UNSP_IRQ5_LINE, ASSERT_LINE); - } - if(m_io_regs[0x22] & m_io_regs[0x21] & 0x0070) - { - verboselog(0, "1024Hz, 2048HZ, 4096HZ IRQ\n"); - m_maincpu->set_input_line(UNSP_IRQ6_LINE, ASSERT_LINE); - } - if(m_io_regs[0x22] & m_io_regs[0x21] & 0x008b) - { - verboselog(0, "TMB1, TMB2, 4Hz, key change IRQ\n"); - m_maincpu->set_input_line(UNSP_IRQ7_LINE, ASSERT_LINE); - } - -} - -static MACHINE_CONFIG_START( vii, vii_state ) - - MCFG_CPU_ADD( "maincpu", UNSP, XTAL_27MHz) - MCFG_CPU_PROGRAM_MAP( vii_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) - - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vii_cart") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_LOAD(vii_state, vii_cart) - - MCFG_SOFTWARE_LIST_ADD("vii_cart","vii") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( vsmile, vii_state ) - - MCFG_CPU_ADD( "maincpu", UNSP, XTAL_27MHz) - MCFG_CPU_PROGRAM_MAP( vii_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) - - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) - MCFG_PALETTE_ADD("palette", 32768) - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vsmile_cart") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_LOAD(vii_state, vsmile_cart) - - MCFG_SOFTWARE_LIST_ADD("cart_list","vsmile_cart") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( batman, vii_state ) - - MCFG_CPU_ADD( "maincpu", UNSP, XTAL_27MHz) - MCFG_CPU_PROGRAM_MAP( vii_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) - - - MCFG_I2CMEM_ADD("i2cmem") - MCFG_I2CMEM_DATA_SIZE(0x200) - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) - MCFG_PALETTE_ADD("palette", 32768) -MACHINE_CONFIG_END - -DRIVER_INIT_MEMBER(vii_state,vii) -{ - m_spg243_mode = SPG243_VII; - m_centered_coordinates = 1; -} - -DRIVER_INIT_MEMBER(vii_state,batman) -{ - m_spg243_mode = SPG243_BATMAN; - m_centered_coordinates = 1; -} - -DRIVER_INIT_MEMBER(vii_state,vsmile) -{ - m_spg243_mode = SPG243_VSMILE; - m_centered_coordinates = 1; -} - -DRIVER_INIT_MEMBER(vii_state,walle) -{ - m_spg243_mode = SPG243_BATMAN; - m_centered_coordinates = 0; -} - -ROM_START( vii ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ - - ROM_REGION( 0x2000000, "bios", 0 ) - ROM_LOAD( "vii.bin", 0x0000, 0x2000000, CRC(04627639) SHA1(f883a92d31b53c9a5b0cdb112d07cd793c95fc43)) -ROM_END - -ROM_START( batmantv ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ - ROM_LOAD16_WORD_SWAP( "batman.bin", 0x000000, 0x400000, CRC(46f848e5) SHA1(5875d57bb3fe0cac5d20e626e4f82a0e5f9bb94c) ) -ROM_END - -ROM_START( vsmile ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ - ROM_LOAD16_WORD_SWAP( "bios german.bin", 0x000000, 0x200000, CRC(205c5296) SHA1(7fbcf761b5885c8b1524607aabaf364b4559c8cc) ) -ROM_END - -ROM_START( vsmilef ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ - ROM_LOAD16_WORD_SWAP( "sysrom_france", 0x000000, 0x200000, CRC(0cd0bdf5) SHA1(5c8d1eada1b6b545555b8d2b09325d7127681af8) ) -ROM_END - -ROM_START( walle ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ - ROM_LOAD16_WORD_SWAP( "walle.bin", 0x000000, 0x400000, BAD_DUMP CRC(bd554cba) SHA1(6cd06a036ab12e7b0e1fd8003db873b0bb783868) ) - // Alternate dump, we need to decide which one is correct. - //ROM_LOAD16_WORD_SWAP( "walle.bin", 0x000000, 0x400000, CRC(6bc90b16) SHA1(184d72de059057aae7800da510fcf05ed1da9ec9)) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -CONS( 2004, batmantv, vii, 0, batman, batman, vii_state, batman, "JAKKS Pacific Inc / HotGen Ltd", "The Batman", MACHINE_NO_SOUND ) -CONS( 2005, vsmile, 0, 0, vsmile, vsmile, vii_state, vsmile, "V-Tech", "V-Smile (Germany)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) -CONS( 2005, vsmilef, vsmile, 0, vsmile, vsmile, vii_state, vsmile, "V-Tech", "V-Smile (France)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) -CONS( 2007, vii, 0, 0, vii, vii, vii_state, vii, "Jungle Soft / KenSingTon / Chintendo / Siatronics", "Vii", MACHINE_NO_SOUND ) -CONS( 2008, walle, vii, 0, batman, walle, vii_state, walle, "JAKKS Pacific Inc", "Wall-E", MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/vip.c b/src/mess/drivers/vip.c deleted file mode 100644 index f47528f5e07..00000000000 --- a/src/mess/drivers/vip.c +++ /dev/null @@ -1,810 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -RCA COSMAC VIP - -PCB Layout ----------- - -|-------------------------------------------------------------------------------| -| |---------------CN1---------------| |---------------CN2---------------| | -|CN6 | -| |---------| |---------| 4050 4050 | -| | CDPR566 | | CDP1861 | CN3 | -| |---------| |---------| | -| CN4 | -| 7805 |---------| |--------| | -| 2114 3.521280MHz | 4508 | | 4508 | CN5 | -| |---------| |--------| | -| 2114 |--------| | -| 7474 7400 4049 4051 4028 | 4515 | CA3401 | -| 2114 |--------| | -| |-------------| | -| 2114 | CDP1802 | | -| |-------------| LED1 | -| 2114 | -| LED2 | -| 2114 4556 4042 | -| LED3 | -| 555 2114 4011 4013 | -| SW1 | -| 2114 | -| | -|-------------------------------------------------------------------------------| - -Notes: - All IC's shown. - - CDPR566 - Programmed CDP1832 512 x 8-Bit Static ROM - 2114 - 2114 4096 Bit (1024x4) NMOS Static RAM - CDP1802 - RCA CDP1802 CMOS 8-Bit Microprocessor - CDP1861 - RCA CDP1861 Video Display Controller - CA3401 - Quad Single-Supply Op-Amp - CN1 - expansion interface connector - CN2 - parallel I/O interface connector - CN3 - video connector - CN4 - tape in connector - CN5 - tape out connector - CN6 - power connector - LED1 - power led - LED2 - Q led - LED3 - tape led - SW1 - Run/Reset switch - -*/ - -/* - - TODO: - - - ASCII keyboard - - cassette loading - - 20K RAM for Floating Point BASIC - - VP-111 has 1K RAM, no byte I/O, no expansion - - VP-601/611 ASCII Keyboard (VP-601 58 keys, VP611 58 keys + 16 keys numerical keypad) - - VP-700 Expanded Tiny Basic Board (4 KB ROM expansion) - -*/ - -/* - - VP-711 COSMAC MicroComputer $199 - (CDP18S711) Features RCA COSMAC microprocessor. 2K RAM, expandable to - 32K (4K on-board). Built-in cassette interface and video interface. - 16 key hexidecimal keypad. ROM operating system. CHIP-8 language and - machine language. Tone generator and speaker. 8-bit input port, 8-bit - output port, and full system expansion connector. Power supply and 3 - manuals (VP-311, VP-320, MPM201 B) included. Completely assembled. - - VP-44 VP-711 RAM On-Board Expansion Kit $36 - Four type 2114 RAM IC's for expanding VP-711 on-board memory - to 4K bytes. - - VP-111 MicroComputer $99 - RCA COSMAC microprocessor. 1 K RAM expandable to 32K (4K On- - board). Built-in cassette interface and video interface. 16 key - Hexidecimal keypad. ROM operating system. CHIP-8 language and Machine - language. Tone generator. Assembled - user must install Cables - (supplied) and furnish 5 volt power supply and speaker. - - VP-114 VP-111 Expansion Kit $76 - Includes I/O ports, system expansion connector and additional - 3K of RAM. Expands VP-111 to VP-711 capability. - - VP-155 VP-111 Cover $12 - Attractive protective plastic cover for VP-111. - - VP-3301 Interactive Data Terminal Available Approx. 6 Months - Microprocessor Based Computer Terminal with keyboard, video - Interface and color graphics - includes full resident and user - Definable character font, switch selectable configuration, cursor - Control, reverse video and many other features. - - VP-590 Color Board $69 - Displays VP-711 output in color! Program control of four - Background colors and eight foreground colors. CHIP-8X language - Adds color commands. Includes two sockets for VP-580 Expansion - Keyboards. - - VP-595 Simple Sound Board $30 - Provides 256 different frequencies in place of VP-711 single- - tone Output. Use with VP-590 Color Board for simultaneous color and - Sound. Great for simple music or sound effects! Includes speaker. - - VP-550 Super Sound Board $49 - Turn your VP-711 into a music synthesizer! Two independent - sound Channels. Frequency, duration and amplitude envelope (voice) of - Each channel under program control. On-board tempo control. Provision - for multi-track recording or slaving VP-711's. Output drives audio - preamp. Does not permit simultaneous video display. - - VP-551 Super Sound 4-Channel Expander Package $74 - VP-551 provides four (4) independent sound channels with - frequency duration and amplitude envelope for each channel. Package - includes modified VP-550 super sound board, VP-576 two board - expander, data cassette with 4-channel PIN-8 program, and instruction - manual. Requires 4K RAM system and your VP-550 Super Sound Board. - - VP-570 Memory Expansion Board $95 - Plug-in 4K static RAM memory. Jumper locates RAM in any 4K - block in first 32K of VP-711 memory space. - - VP-580 Auxiliary Keyboard $20 - Adds two-player interactive game capability to VP-711 16-key - keypad with cable. Connects to sockets on VP-590 Color Board or VP- - 585 Keyboard Interface. - - VP-585 Keyboard Interface Board $15 - Interfaces two VP-580 Expansion Keyboards directly to the VP- - 711. Not required when VP-590 Color Board is used. - - VP-560 EPROM Board $34 - Interfaces two Intel 2716 EPROMs to VP-711. Places EPROMs any- - where in memory space. Can also re-allocate on-board RAM in memory - space. - - VP-565 EPROM Programmer Board $99 - Programs Intel 2716 EPROMs with VP-711. Complete with software - to program, copy, and verify. On-board generation of all programming - voltages. - - VP-575 Expansion Board $59 - Plug-in board with 4 buffered and one unbuffered socket. - Permits use of up to 5 Accessory Boards in VP-711 Expansion Socket. - - VP-576 Two-Board Expander $20 - Plug-in board for VP-711 I/O or Expansion Socket permits use - of two Accessory Boards in either location. - - VP-601* ASCII Keyboard. 7-Bit Parallel Output $69 - Fully encoded, 128-character ASCII alphanumeric keyboard. 58 - light touch keys (2 user defined). Selectable "Upper-Case-Only". - - VP-606* ASCII Keyboard - Serial Output $99 - Same as VP-601. EIA RS232C compatible, 20 mA current loop and - TTL outputs. Six selectable baud rates. Available mid-1980. - - VP-611* ASCII/Numeric Keyboard. 7-Bit Parallel Output $89 - ASCII Keyboard identical to VP-601 plus 16 key numeric entry - keyboard for easier entry of numbers. - - VP-616* ASCII/Numeric Keyboard - Serial Output $119 - Same as VP-611. EIA RS232C compatible, 20 mA current loop and - TTL outputs. Six selectable baud rates. Available mid-1980. - - VP-620 Cable: ASCII Keyboards to VP-711 $20 - Flat ribbon cable, 24" length, for connecting VP-601 or VP- - 611 and VP-711. Includes matching connector on both ends. - - VP-623 Cable: Parallel Output ASCII Keyboards $20 - Flat ribbon cable, 36" length with mating connector for VP- - 601 or VP-611 Keyboards. Other end is unterminated. - - VP-626 Connector: Serial Output ASCII Keyboards & Terminal $7 - 25 pin solderable male "D" connector mates to VP-606, VP-616 - or VP-3301. - - TC1210 9" Video Monitor $195 - Ideal, low-cost monochrome monitor for displaying the video - output from your microcomputer or terminal. - - TC1217 17" Video Monitor $480 - A really BIG monochrome monitor for use with your - microcomputer or terminal 148 sq. in. pictures. - - VP-700 Tiny BASIC ROM Board $39 - Run Tiny BASIC on your VP-711! All BASIC code stored in ROM. - Requires separate ASCII keyboard. - - VP-701 Floating Point BASIC for VP-711 $49 - 16K bytes on cassette tape, includes floating point and - integer math, string capability and color graphics. More than 70 - commands and statements. Available mid-1980. - - VP-710 Game Manual $10 - More exciting games for your VP-711! Includes Blackjack, - Biorythm, Pinball, Bowling and 10 others. - - VP-720 Game Manual II More exciting games. Available mid-1980. $15 - - VP-311 VP-711 Instruction Manual (Included with VP-711) $5 - - VP-320 VP-711 User Guide Manual (Included with VP-711) $5 - - MPM-201B CDP1802 User Manual (Included with VP-711) $5 - - * Quantities of 15 or more available less case and speaker (Assembled - keypad and circut board only). Price on request. - -*/ - -#include "includes/vip.h" - - - -//************************************************************************** -// MACROS/CONSTANTS -//************************************************************************** - -enum -{ - LED_POWER = 0, - LED_Q, - LED_TAPE -}; - - - -//************************************************************************** -// IMPLEMENTATION -//************************************************************************** - -//------------------------------------------------- -// update_interrupts - -//------------------------------------------------- - -void vip_state::update_interrupts() -{ - int irq = m_vdc_int || m_exp_int; - int dma_in = m_exp_dma_in; - int dma_out = m_vdc_dma_out || m_exp_dma_out; - - m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, irq); - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAIN, dma_in); - m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAOUT, dma_out); -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( vip_state::read ) -{ - int cs = BIT(offset, 15) || m_8000; - int cdef = !((offset >= 0xc00) && (offset < 0x1000)); - int minh = 0; - - UINT8 data = m_exp->program_r(space, offset, cs, cdef, &minh); - - if (cs) - { - data = m_rom->base()[offset & 0x1ff]; - } - else if (!minh) - { - data = m_ram->pointer()[offset & m_ram->mask()]; - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( vip_state::write ) -{ - int cs = BIT(offset, 15) || m_8000; - int cdef = !((offset >= 0xc00) && (offset < 0x1000)); - int minh = 0; - - m_exp->program_w(space, offset, data, cdef, &minh); - - if (!cs && !minh) - { - m_ram->pointer()[offset & m_ram->mask()] = data; - } -} - - -//------------------------------------------------- -// io_r - -//------------------------------------------------- - -READ8_MEMBER( vip_state::io_r ) -{ - UINT8 data = m_exp->io_r(space, offset); - - switch (offset) - { - case 1: - m_vdc->disp_on_w(1); - m_vdc->disp_on_w(0); - break; - - case 3: - data = m_byteio_data; - break; - } - - if (BIT(offset, 2)) - { - m_8000 = 0; - } - - return data; -} - - -//------------------------------------------------- -// io_w - -//------------------------------------------------- - -WRITE8_MEMBER( vip_state::io_w ) -{ - m_exp->io_w(space, offset, data); - - switch (offset) - { - case 1: - m_vdc->disp_off_w(1); - m_vdc->disp_off_w(0); - break; - - case 2: - m_keylatch = data & 0x0f; - break; - - case 3: - m_byteio->out_w(data); - break; - } - - if (BIT(offset, 2)) - { - m_8000 = 0; - } -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( vip_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vip_mem, AS_PROGRAM, 8, vip_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vip_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vip_io, AS_IO, 8, vip_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00, 0x07) AM_READWRITE(io_r, io_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( vip ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( vip_state::reset_w ) -{ - m_exp->run_w(newval); - - if (oldval && !newval) - { - machine_reset(); - } -} - -INPUT_CHANGED_MEMBER( vip_state::beeper_w ) -{ - m_beeper->set_output_gain(0, newval ? 0.80 : 0); -} - -static INPUT_PORTS_START( vip ) - PORT_START("KEYPAD") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 MW") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("A MR") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("B TR") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("F TW") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - - PORT_START("RUN") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Run/Reset") PORT_CODE(KEYCODE_R) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, vip_state, reset_w, 0) - - PORT_START("BEEPER") - PORT_CONFNAME( 0x01, 0x01, "Internal Speaker" ) PORT_CHANGED_MEMBER(DEVICE_SELF, vip_state, beeper_w, 0) - PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x01, DEF_STR( On ) ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// COSMAC_INTERFACE( cosmac_intf ) -//------------------------------------------------- - -READ_LINE_MEMBER( vip_state::clear_r ) -{ - return BIT(m_run->read(), 0); -} - -READ_LINE_MEMBER( vip_state::ef1_r ) -{ - return m_vdc_ef1 || m_exp->ef1_r(); -} - -READ_LINE_MEMBER( vip_state::ef2_r ) -{ - set_led_status(machine(), LED_TAPE, m_cassette->input() > 0); - - return (m_cassette->input() < 0) ? ASSERT_LINE : CLEAR_LINE; -} - -READ_LINE_MEMBER( vip_state::ef3_r ) -{ - return !BIT(m_keypad->read(), m_keylatch) || m_byteio_ef3 || m_exp_ef3; -} - -READ_LINE_MEMBER( vip_state::ef4_r ) -{ - return m_byteio_ef4 || m_exp_ef4; -} - -WRITE_LINE_MEMBER( vip_state::q_w ) -{ - // sound output - m_beeper->write(machine().driver_data()->generic_space(), NODE_01, state); - - // Q led - set_led_status(machine(), LED_Q, state); - - // tape output - m_cassette->output(state ? 1.0 : -1.0); - - // expansion - m_exp->q_w(state); -} - -READ8_MEMBER( vip_state::dma_r ) -{ - return m_exp->dma_r(space, offset); -} - -WRITE8_MEMBER( vip_state::dma_w ) -{ - m_vdc->dma_w(space, offset, data); - - m_exp->dma_w(space, offset, data); -} - -WRITE8_MEMBER( vip_state::sc_w ) -{ - m_exp->sc_w(data); -} - - -//------------------------------------------------- -// CDP1861_INTERFACE( vdc_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( vip_state::vdc_int_w ) -{ - m_vdc_int = state; - - update_interrupts(); -} - -WRITE_LINE_MEMBER( vip_state::vdc_dma_out_w ) -{ - m_vdc_dma_out = state; - - update_interrupts(); -} - -WRITE_LINE_MEMBER( vip_state::vdc_ef1_w ) -{ - m_vdc_ef1 = state; -} - -UINT32 vip_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_vdc->screen_update(screen, bitmap, cliprect); - - m_exp->screen_update(screen, bitmap, cliprect); - - return 0; -} - - -//------------------------------------------------- -// DISCRETE_SOUND( vip ) -//------------------------------------------------- - -static const discrete_555_desc vip_ca555_a = -{ - DISC_555_OUT_SQW | DISC_555_OUT_DC, - 5, // B+ voltage of 555 - DEFAULT_555_VALUES -}; - -static DISCRETE_SOUND_START( vip ) - DISCRETE_INPUT_LOGIC(NODE_01) - DISCRETE_555_ASTABLE_CV(NODE_02, NODE_01, 470, (int) RES_M(1), (int) CAP_P(470), NODE_01, &vip_ca555_a) - DISCRETE_OUTPUT(NODE_02, 5000) -DISCRETE_SOUND_END - - -//------------------------------------------------- -// VIP_BYTEIO_PORT_INTERFACE( byteio_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( vip_state::byteio_inst_w ) -{ - if (!state) - { - m_byteio_data = m_byteio->in_r(); - } -} - - -//------------------------------------------------- -// VIP_EXPANSION_INTERFACE( expansion_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( vip_state::exp_int_w ) -{ - m_exp_int = state; - - update_interrupts(); -} - -WRITE_LINE_MEMBER( vip_state::exp_dma_out_w ) -{ - m_exp_dma_out = state; - - update_interrupts(); -} - -WRITE_LINE_MEMBER( vip_state::exp_dma_in_w ) -{ - m_exp_dma_in = state; - - update_interrupts(); -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( vip ) -//------------------------------------------------- - -void vip_state::machine_start() -{ - UINT8 *ram = m_ram->pointer(); - - // randomize RAM contents - for (UINT16 addr = 0; addr < m_ram->size(); addr++) - { - ram[addr] = machine().rand() & 0xff; - } - - // turn on power LED - set_led_status(machine(), LED_POWER, 1); - - // reset sound - m_beeper->write(machine().driver_data()->generic_space(), NODE_01, 0); - - // state saving - save_item(NAME(m_8000)); - save_item(NAME(m_vdc_int)); - save_item(NAME(m_vdc_dma_out)); - save_item(NAME(m_vdc_ef1)); - save_item(NAME(m_exp_int)); - save_item(NAME(m_exp_dma_out)); - save_item(NAME(m_exp_dma_in)); - save_item(NAME(m_byteio_ef3)); - save_item(NAME(m_byteio_ef4)); - save_item(NAME(m_exp_ef1)); - save_item(NAME(m_exp_ef3)); - save_item(NAME(m_exp_ef4)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_byteio_data)); -} - - -void vip_state::machine_reset() -{ - // reset the VDC - m_vdc->reset(); - - // force map ROM - m_8000 = 1; - - // internal speaker - m_beeper->set_output_gain(0, m_io_beeper->read() ? 0.80 : 0); - - // clear byte I/O latch - m_byteio_data = 0; -} - - -//------------------------------------------------- -// QUICKLOAD_LOAD_MEMBER( vip_state, vip ) -//------------------------------------------------- - -QUICKLOAD_LOAD_MEMBER( vip_state, vip ) -{ - UINT8 *ram = m_ram->pointer(); - UINT8 *chip8_ptr = NULL; - int chip8_size = 0; - int size = image.length(); - - if (strcmp(image.filetype(), "c8") == 0) - { - /* CHIP-8 program */ - chip8_ptr = m_chip8->base(); - chip8_size = m_chip8->bytes(); - } - else if (strcmp(image.filename(), "c8x") == 0) - { - /* CHIP-8X program */ - chip8_ptr = m_chip8x->base(); - chip8_size = m_chip8x->bytes(); - } - - if ((size + chip8_size) > m_ram->size()) - { - return IMAGE_INIT_FAIL; - } - - if (chip8_size > 0) - { - /* copy CHIP-8 interpreter to RAM */ - memcpy(ram, chip8_ptr, chip8_size); - } - - /* load image to RAM */ - image.fread(ram + chip8_size, size); - - return IMAGE_INIT_PASS; -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( vip ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( vip, vip_state ) - // basic machine hardware - MCFG_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_3_52128MHz/2) - MCFG_CPU_PROGRAM_MAP(vip_mem) - MCFG_CPU_IO_MAP(vip_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) - MCFG_COSMAC_CLEAR_CALLBACK(READLINE(vip_state, clear_r)) - MCFG_COSMAC_EF1_CALLBACK(READLINE(vip_state, ef1_r)) - MCFG_COSMAC_EF2_CALLBACK(READLINE(vip_state, ef2_r)) - MCFG_COSMAC_EF3_CALLBACK(READLINE(vip_state, ef3_r)) - MCFG_COSMAC_EF4_CALLBACK(READLINE(vip_state, ef4_r)) - MCFG_COSMAC_Q_CALLBACK(WRITELINE(vip_state, q_w)) - MCFG_COSMAC_DMAR_CALLBACK(READ8(vip_state, dma_r)) - MCFG_COSMAC_DMAW_CALLBACK(WRITE8(vip_state, dma_w)) - MCFG_COSMAC_SC_CALLBACK(WRITE8(vip_state, sc_w)) - - // video hardware - MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, XTAL_3_52128MHz/2) - MCFG_CDP1861_IRQ_CALLBACK(WRITELINE(vip_state, vdc_int_w)) - MCFG_CDP1861_DMA_OUT_CALLBACK(WRITELINE(vip_state, vdc_dma_out_w)) - MCFG_CDP1861_EFX_CALLBACK(WRITELINE(vip_state, vdc_ef1_w)) - MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_52128MHz/2) - MCFG_SCREEN_UPDATE_DRIVER(vip_state, screen_update) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(vip) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - - MCFG_VIP_BYTEIO_PORT_ADD(VIP_BYTEIO_PORT_TAG, vip_byteio_cards, NULL, WRITELINE(vip_state, byteio_inst_w)) - MCFG_VIP_EXPANSION_SLOT_ADD(VIP_EXPANSION_SLOT_TAG, XTAL_3_52128MHz/2, vip_expansion_cards, NULL) - MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(vip_state, exp_int_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(vip_state, exp_dma_out_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(vip_state, exp_dma_in_w)) - - // devices - MCFG_QUICKLOAD_ADD("quickload", vip_state, vip, "bin,c8,c8x", 0) - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) - MCFG_CASSETTE_INTERFACE("vip_cass") - - // software lists - MCFG_SOFTWARE_LIST_ADD("cass_list", "vip") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2K") - MCFG_RAM_EXTRA_OPTIONS("4K") -MACHINE_CONFIG_END - - -//------------------------------------------------- -// MACHINE_CONFIG( vp111 ) -//------------------------------------------------- - -static MACHINE_CONFIG_DERIVED( vp111, vip ) - // internal ram - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") - MCFG_RAM_EXTRA_OPTIONS("2K,4K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( vip ) -//------------------------------------------------- - -ROM_START( vip ) - ROM_REGION( 0x200, CDP1802_TAG, 0 ) - ROM_LOAD( "cdpr566.u10", 0x0000, 0x0200, CRC(5be0a51f) SHA1(40266e6d13e3340607f8b3dcc4e91d7584287c06) ) - - ROM_REGION( 0x200, "chip8", 0 ) - ROM_LOAD( "chip8.bin", 0x0000, 0x0200, CRC(438ec5d5) SHA1(8aa634c239004ff041c9adbf9144bd315ab5fc77) ) - - ROM_REGION( 0x300, "chip8x", 0 ) - ROM_LOAD( "chip8x.bin", 0x0000, 0x0300, CRC(79c5f6f8) SHA1(ed438747b577399f6ccbf20fe14156f768842898) ) -ROM_END - - -//------------------------------------------------- -// ROM( vp111 ) -//------------------------------------------------- - -#define rom_vp111 rom_vip - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1977, vip, 0, 0, vip, vip, driver_device, 0, "RCA", "Cosmac VIP (VP-711)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_COLORS ) -COMP( 1977, vp111, vip, 0, vp111, vip, driver_device, 0, "RCA", "Cosmac VIP (VP-111)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_COLORS ) diff --git a/src/mess/drivers/vixen.c b/src/mess/drivers/vixen.c deleted file mode 100644 index c4db7010fd4..00000000000 --- a/src/mess/drivers/vixen.c +++ /dev/null @@ -1,877 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - -Osborne 4 Vixen - -Main PCB Layout ---------------- - -TODO - -Notes: - Relevant IC's shown. - - CPU - Zilog Z8400APS Z80A CPU - FDC - SMC FDC1797 - 8155 - Intel P8155H - ROM0 - - ROM1,2 - AMD AM2732-1DC 4Kx8 EPROM - CN1 - keyboard connector - CN2 - - CN3 - - CN4 - floppy connector - CN5 - power connector - CN6 - composite video connector - SW1 - reset switch - SW2 - - - -I/O PCB Layout --------------- - -TODO - -Notes: - Relevant IC's shown. - - 8155 - Intel P8155H - 8251 - AMD P8251A - CN1 - IEEE488 connector - CN2 - RS232 connector - CN3 - - -*/ - -/* - - TODO: - - - video line buffer - - floppy - - keyboard - - RS232 RI interrupt - - PCB layouts - -*/ - - -#include "includes/vixen.h" - - - -//************************************************************************** -// INTERRUPTS -//************************************************************************** - -//------------------------------------------------- -// update_interrupt - -//------------------------------------------------- - -void vixen_state::update_interrupt() -{ - int state = (m_cmd_d1 && m_fdint) || m_vsync;// || (!m_enb_srq_int && !m_srq) || (!m_enb_atn_int && !m_atn) || (!m_enb_xmt_int && m_txrdy) || (!m_enb_rcv_int && m_rxrdy); - - m_maincpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); -} - - -//------------------------------------------------- -// ctl_w - command write -//------------------------------------------------- - -WRITE8_MEMBER( vixen_state::ctl_w ) -{ - logerror("CTL %u\n", data); - - membank("bank3")->set_entry(BIT(data, 0)); -} - - -//------------------------------------------------- -// status_r - status read -//------------------------------------------------- - -READ8_MEMBER( vixen_state::status_r ) -{ - /* - - bit description - - 0 VSYNC enable - 1 FDINT enable - 2 VSYNC - 3 1 - 4 1 - 5 1 - 6 1 - 7 1 - - */ - - UINT8 data = 0xf8; - - // vertical sync interrupt enable - data |= m_cmd_d0; - - // floppy interrupt enable - data |= m_cmd_d1 << 1; - - // vertical sync - data |= m_vsync << 2; - - return data; -} - - -//------------------------------------------------- -// cmd_w - command write -//------------------------------------------------- - -WRITE8_MEMBER( vixen_state::cmd_w ) -{ - /* - - bit description - - 0 VSYNC enable - 1 FDINT enable - 2 - 3 - 4 - 5 - 6 - 7 - - */ - -// logerror("CMD %u\n", data); - - // vertical sync interrupt enable - m_cmd_d0 = BIT(data, 0); - - if (!m_cmd_d0) - { - // clear vertical sync - m_vsync = 0; - } - - // floppy interrupt enable - m_cmd_d1 = BIT(data, 1); - - update_interrupt(); -} - - -//------------------------------------------------- -// ieee488_r - IEEE488 bus read -//------------------------------------------------- - -READ8_MEMBER( vixen_state::ieee488_r ) -{ - /* - - bit description - - 0 ATN - 1 DAV - 2 NDAC - 3 NRFD - 4 EOI - 5 SRQ - 6 IFC - 7 REN - - */ - - UINT8 data = 0; - - /* attention */ - data |= m_ieee488->atn_r(); - - /* data valid */ - data |= m_ieee488->dav_r() << 1; - - /* data not accepted */ - data |= m_ieee488->ndac_r() << 2; - - /* not ready for data */ - data |= m_ieee488->nrfd_r() << 3; - - /* end or identify */ - data |= m_ieee488->eoi_r() << 4; - - /* service request */ - data |= m_ieee488->srq_r() << 5; - - /* interface clear */ - data |= m_ieee488->ifc_r() << 6; - - /* remote enable */ - data |= m_ieee488->ren_r() << 7; - - return data; -} - - -//------------------------------------------------- -// port3_r - serial status read -//------------------------------------------------- - -READ8_MEMBER( vixen_state::port3_r ) -{ - /* - - bit description - - 0 RI - 1 DCD - 2 1 - 3 1 - 4 1 - 5 1 - 6 1 - 7 1 - - */ - - UINT8 data = 0xfc; - - // ring indicator - data |= m_rs232->ri_r(); - - // data carrier detect - data |= m_rs232->dcd_r() << 1; - - return data; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( vixen_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vixen_mem, AS_PROGRAM, 8, vixen_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xefff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2") - AM_RANGE(0xf000, 0xffff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4") AM_SHARE("video_ram") -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( vixen_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( vixen_io, AS_IO, 8, vixen_state ) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(FDC1797_TAG, fd1797_t, read, write) - AM_RANGE(0x04, 0x04) AM_MIRROR(0x03) AM_READWRITE(status_r, cmd_w) - AM_RANGE(0x08, 0x08) AM_MIRROR(0x01) AM_DEVREADWRITE(P8155H_TAG, i8155_device, read, write) - AM_RANGE(0x0c, 0x0d) AM_DEVWRITE(P8155H_TAG, i8155_device, ale_w) - AM_RANGE(0x10, 0x10) AM_MIRROR(0x07) AM_DEVREAD(IEEE488_TAG, ieee488_device, dio_r) - AM_RANGE(0x18, 0x18) AM_MIRROR(0x07) AM_READ(ieee488_r) - AM_RANGE(0x20, 0x21) AM_MIRROR(0x04) AM_DEVWRITE(P8155H_IO_TAG, i8155_device, ale_w) - AM_RANGE(0x28, 0x28) AM_MIRROR(0x05) AM_DEVREADWRITE(P8155H_IO_TAG, i8155_device, read, write) - AM_RANGE(0x30, 0x30) AM_MIRROR(0x06) AM_DEVREADWRITE(P8251A_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x31, 0x31) AM_MIRROR(0x06) AM_DEVREADWRITE(P8251A_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x38, 0x38) AM_MIRROR(0x07) AM_READ(port3_r) -// AM_RANGE(0xf0, 0xff) Hard Disk? -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( vixen ) -//------------------------------------------------- - -INPUT_PORTS_START( vixen ) - PORT_START("KEY.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("KEY.1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("KEY.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("KEY.3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("KEY.4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("KEY.5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("KEY.6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("KEY.7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) -INPUT_PORTS_END - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -//------------------------------------------------- -// TIMER_DEVICE_CALLBACK_MEMBER( vsync_tick ) -//------------------------------------------------- - -TIMER_DEVICE_CALLBACK_MEMBER(vixen_state::vsync_tick) -{ - if (m_cmd_d0) - { - m_vsync = 1; - update_interrupt(); - } -} - - -void vixen_state::video_start() -{ - // register for state saving - save_item(NAME(m_alt)); - save_item(NAME(m_256)); - save_item(NAME(m_vsync)); -} - - -//------------------------------------------------- -// SCREEN_UPDATE( vixen ) -//------------------------------------------------- - -UINT32 vixen_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const pen_t *pen = m_palette->pens(); - - for (int txadr = 0; txadr < 26; txadr++) - { - for (int scan = 0; scan < 10; scan++) - { - for (int chadr = 0; chadr < 128; chadr++) - { - UINT16 sync_addr = (txadr << 7) | chadr; - UINT8 sync_data = m_sync_rom[sync_addr]; - int blank = BIT(sync_data, 4); - /* - int clrchadr = BIT(sync_data, 7); - int hsync = BIT(sync_data, 6); - int clrtxadr = BIT(sync_data, 5); - int vsync = BIT(sync_data, 3); - int comp_sync = BIT(sync_data, 2); - - logerror("SYNC %03x:%02x TXADR %u SCAN %u CHADR %u : COMPSYNC %u VSYNC %u BLANK %u CLRTXADR %u HSYNC %u CLRCHADR %u\n", - sync_addr,sync_data,txadr,scan,chadr,comp_sync,vsync,blank,clrtxadr,hsync,clrchadr); - */ - - int reverse = 0; - - UINT16 video_addr = (txadr << 7) | chadr; - UINT8 video_data = m_video_ram[video_addr]; - UINT16 char_addr = 0; - - if (m_256) - { - char_addr = (BIT(video_data, 7) << 11) | (scan << 7) | (video_data & 0x7f); - reverse = m_alt; - } - else - { - char_addr = (scan << 7) | (video_data & 0x7f); - reverse = BIT(video_data, 7); - } - - UINT8 char_data = m_char_rom[char_addr]; - - for (int x = 0; x < 8; x++) - { - int color = (BIT(char_data, 7 - x) ^ reverse) & !blank; - - bitmap.pix32((txadr * 10) + scan, (chadr * 8) + x) = pen[color]; - } - } - } - } - - return 0; -} - - - -//************************************************************************** -// SOUND -//************************************************************************** - -//------------------------------------------------- -// DISCRETE_SOUND( vixen ) -//------------------------------------------------- - -static DISCRETE_SOUND_START( vixen ) - DISCRETE_INPUT_LOGIC(NODE_01) - DISCRETE_SQUAREWAVE(NODE_02, NODE_01, XTAL_23_9616MHz/15360, 100, 50, 0, 90) - DISCRETE_OUTPUT(NODE_02, 2000) -DISCRETE_SOUND_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// I8155 interface -//------------------------------------------------- - -READ8_MEMBER( vixen_state::i8155_pa_r ) -{ - UINT8 data = 0xff; - - for (int i = 0; i < 8; i++) - if (!BIT(m_col, i)) data &= m_key[i]->read(); - - return data; -} - -WRITE8_MEMBER( vixen_state::i8155_pb_w ) -{ - m_col = data; -} - -WRITE8_MEMBER( vixen_state::i8155_pc_w ) -{ - /* - - bit description - - 0 DSEL1/ - 1 DSEL2/ - 2 DDEN/ - 3 ALT CHARSET/ - 4 256 CHARS - 5 BEEP ENB - 6 - 7 - - */ - - // drive select - floppy_image_device *floppy = NULL; - - if (!BIT(data, 0)) floppy = m_floppy0->get_device(); - if (!BIT(data, 1)) floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) floppy->mon_w(0); - - // density select - m_fdc->dden_w(BIT(data, 2)); - - // charset - m_alt = BIT(data, 3); - m_256 = BIT(data, 4); - - // beep enable - m_discrete->write(space, NODE_01, BIT(data, 5)); -} - -//------------------------------------------------- -// I8155 IO interface -//------------------------------------------------- - -WRITE8_MEMBER( vixen_state::io_i8155_pb_w ) -{ - /* - - bit description - - PB0 ATN - PB1 DAV - PB2 NDAC - PB3 NRFD - PB4 EOI - PB5 SRQ - PB6 IFC - PB7 REN - - */ - - /* data valid */ - m_ieee488->atn_w(BIT(data, 0)); - - /* end or identify */ - m_ieee488->dav_w(BIT(data, 1)); - - /* remote enable */ - m_ieee488->ndac_w(BIT(data, 2)); - - /* attention */ - m_ieee488->nrfd_w(BIT(data, 3)); - - /* interface clear */ - m_ieee488->eoi_w(BIT(data, 4)); - - /* service request */ - m_ieee488->srq_w(BIT(data, 5)); - - /* not ready for data */ - m_ieee488->ifc_w(BIT(data, 6)); - - /* data not accepted */ - m_ieee488->ren_w(BIT(data, 7)); -} - -WRITE8_MEMBER( vixen_state::io_i8155_pc_w ) -{ - /* - - bit description - - PC0 select internal clock - PC1 ENB RING INT - PC2 ENB RCV INT - PC3 ENB XMT INT - PC4 ENB ATN INT - PC5 ENB SRQ INT - PC6 - PC7 - - */ - - m_int_clk = BIT(data, 0); - m_enb_ring_int = BIT(data, 1); - m_enb_rcv_int = BIT(data, 2); - m_enb_xmt_int = BIT(data, 3); - m_enb_atn_int = BIT(data, 4); - m_enb_srq_int = BIT(data, 5); -} - -WRITE_LINE_MEMBER( vixen_state::io_i8155_to_w ) -{ - if (m_int_clk) - { - m_usart->write_txc(state); - m_usart->write_rxc(state); - } -} - -//------------------------------------------------- -// i8251_interface usart_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( vixen_state::rxrdy_w ) -{ - m_rxrdy = state; - update_interrupt(); -} - -WRITE_LINE_MEMBER( vixen_state::txrdy_w ) -{ - m_txrdy = state; - update_interrupt(); -} - -//------------------------------------------------- -// IEEE488_INTERFACE( ieee488_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( vixen_state::srq_w ) -{ - m_srq = state; - update_interrupt(); -} - -WRITE_LINE_MEMBER( vixen_state::atn_w ) -{ - m_atn = state; - update_interrupt(); -} - -static SLOT_INTERFACE_START( vixen_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -WRITE_LINE_MEMBER( vixen_state::fdc_intrq_w ) -{ - m_fdint = state; - update_interrupt(); -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// IRQ_CALLBACK_MEMBER( vixen_int_ack ) -//------------------------------------------------- - -IRQ_CALLBACK_MEMBER(vixen_state::vixen_int_ack) -{ - // D0 is pulled low - return 0xfe; -} - - -//------------------------------------------------- -// MACHINE_START( vixen ) -//------------------------------------------------- - -void vixen_state::machine_start() -{ - // configure memory banking - UINT8 *ram = m_ram->pointer(); - - membank("bank1")->configure_entry(0, ram); - membank("bank1")->configure_entry(1, m_rom); - - membank("bank2")->configure_entry(0, ram); - membank("bank2")->configure_entry(1, m_video_ram); - - membank("bank3")->configure_entry(0, m_video_ram); - membank("bank3")->configure_entry(1, m_rom); - - membank("bank4")->configure_entry(0, m_video_ram); - - // register for state saving - save_item(NAME(m_reset)); - save_item(NAME(m_col)); - save_item(NAME(m_cmd_d0)); - save_item(NAME(m_cmd_d1)); - save_item(NAME(m_fdint)); -} - - -void vixen_state::machine_reset() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - program.install_read_bank(0x0000, 0xefff, 0xfff, 0, "bank1"); - program.install_write_bank(0x0000, 0xefff, 0xfff, 0, "bank2"); - - membank("bank1")->set_entry(1); - membank("bank2")->set_entry(1); - membank("bank3")->set_entry(1); - - m_reset = 1; - - m_vsync = 0; - m_cmd_d0 = 0; - m_cmd_d1 = 0; - update_interrupt(); - - m_fdc->reset(); - m_io_i8155->reset(); - m_usart->reset(); -} - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( vixen ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( vixen, vixen_state ) - // basic machine hardware - MCFG_CPU_ADD(Z8400A_TAG, Z80, XTAL_23_9616MHz/6) - MCFG_CPU_PROGRAM_MAP(vixen_mem) - MCFG_CPU_IO_MAP(vixen_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vixen_state,vixen_int_ack) - - // video hardware - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(vixen_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_23_9616MHz/2, 96*8, 0*8, 81*8, 27*10, 0*10, 26*10) - - MCFG_TIMER_DRIVER_ADD_SCANLINE("vsync", vixen_state, vsync_tick, SCREEN_TAG, 26*10, 27*10) - - MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(vixen) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) - - // devices - MCFG_DEVICE_ADD(P8155H_TAG, I8155, XTAL_23_9616MHz/6) - MCFG_I8155_IN_PORTA_CB(READ8(vixen_state, i8155_pa_r)) - MCFG_I8155_OUT_PORTB_CB(WRITE8(vixen_state, i8155_pb_w)) - MCFG_I8155_OUT_PORTC_CB(WRITE8(vixen_state, i8155_pc_w)) - - MCFG_DEVICE_ADD(P8155H_IO_TAG, I8155, XTAL_23_9616MHz/6) - MCFG_I8155_OUT_PORTA_CB(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w)) - MCFG_I8155_OUT_PORTB_CB(WRITE8(vixen_state, io_i8155_pb_w)) - MCFG_I8155_OUT_PORTC_CB(WRITE8(vixen_state, io_i8155_pc_w)) - MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(vixen_state, io_i8155_to_w)) - - MCFG_DEVICE_ADD(P8251A_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_I8251_RXRDY_HANDLER(WRITELINE(vixen_state, rxrdy_w)) - MCFG_I8251_TXRDY_HANDLER(WRITELINE(vixen_state, txrdy_w)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_dsr)) - - MCFG_FD1797_ADD(FDC1797_TAG, XTAL_23_9616MHz/24) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(vixen_state, fdc_intrq_w)) - MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":0", vixen_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":1", vixen_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_IEEE488_BUS_ADD() - MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(vixen_state, srq_w)) - MCFG_IEEE488_ATN_CALLBACK(WRITELINE(vixen_state, atn_w)) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("disk_list", "vixen") - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROMS -//************************************************************************** - -//------------------------------------------------- -// ROM( vixen ) -//------------------------------------------------- - -ROM_START( vixen ) - ROM_REGION( 0x1000, Z8400A_TAG, 0 ) - ROM_LOAD( "osborne 4 mon rom v1.04 3p40082-03 a0a9.4c", 0x0000, 0x1000, CRC(5f1038ce) SHA1(e6809fac23650bbb4689e58edc768d917d80a2df) ) // OSBORNE 4 MON ROM / V1.04 3P40082-03 / A0A9 (c) OCC 1985 - - ROM_REGION( 0x1000, "video", 0 ) - ROM_LOAD( "v1.10.3j", 0x0000, 0x1000, CRC(1f93e2d7) SHA1(0c479bfd3ac8d9959c285c020d0096930a9c6867) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "v1.00 l.1j", 0x0000, 0x1000, CRC(f97c50d9) SHA1(39f73afad68508c4b8a4d241c064f9978098d8f2) ) -ROM_END - - - -//************************************************************************** -// DRIVER INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// DRIVER_INIT( vixen ) -//------------------------------------------------- - -DIRECT_UPDATE_MEMBER(vixen_state::vixen_direct_update_handler) -{ - if (address >= 0xf000) - { - if (m_reset) - { - address_space &program = m_maincpu->space(AS_PROGRAM); - - program.install_read_bank(0x0000, 0xefff, "bank1"); - program.install_write_bank(0x0000, 0xefff, "bank2"); - - membank("bank1")->set_entry(0); - membank("bank2")->set_entry(0); - - m_reset = 0; - } - - direct.explicit_configure(0xf000, 0xffff, 0xfff, m_rom); - - return ~0; - } - - return address; -} - -DRIVER_INIT_MEMBER(vixen_state,vixen) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(vixen_state::vixen_direct_update_handler), this)); -} - - - -//************************************************************************** -// SYSTEM DRIVERS -//************************************************************************** - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1984, vixen, 0, 0, vixen, vixen, vixen_state, vixen, "Osborne", "Vixen", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/vk100.c b/src/mess/drivers/vk100.c deleted file mode 100644 index 376b54efbcb..00000000000 --- a/src/mess/drivers/vk100.c +++ /dev/null @@ -1,1265 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/*************************************************************************** - - DEC VK100 'GIGI' - - 12/05/2009 Skeleton driver. - 28/07/2009 added Guru-readme(TM) - 08/01/2012 Fleshed out driver. - - Todo: - * fix vector generator hardware enough to pass the startup self test - the tests are described on page 6-5 thru 6-8 of the tech reference - * hook up the bresenham DU/DVM/ERR stuff, currently only simple directional vectors work - * hook up the vector and sync proms to the sync counter - * figure out how the erase prom actually works at a hardware level - * redump the vector prom, the first two bytes look bad - * figure out the correct meaning of systat b register - needed for communications selftest - * hook up smc com5016t baud generator to i8251 rx and tx clocks - begun - - Notes: - The directions for the DIR value are arranged, starting from the * - as the vector origin: - 3 2 1 - \ | / - \|/ - 4--*--0 - /|\ - / | \ - 5 6 7 - - The X and Y counters are techincally 12 bits long each, though - only the low 9 and 10 bits respectively are used for ram addressing. - The MSB bit of each counter does have a special purpose with - regards to the RAS/ERASE prom though, perhaps to detect an - underflow 000->FFF - - Tony DiCenzo, now the director of standards and architecture at Oracle, was on the team that developed the VK100 - see http://startup.nmnaturalhistory.org/visitorstories/view.php?ii=79 - Robert "Bob" C. Quinn was definitely lead engineer on the VT125 - Robert "Bob" T. Collins was the lead engineer on the VK100 - Pedro Ortiz (https://www.linkedin.com/pub/pedro-ortiz/16/68b/196) did the drafting for the enclosure and case - - The prototype name for the VK100 was 'SMAKY' (Smart Keyboard) - -****************************************************************************/ -/* -DEC VK100 -DEC, 1982 - -This is a VK100 terminal, otherwise known as a DEC Gigi graphics terminal. -There's a technical manual dated 1982 here: -http://web.archive.org/web/20091015205827/http://www.computer.museum.uq.edu.au/pdf/EK-VK100-TM-001%20VK100%20Technical%20Manual.pdf -Installation and owner's manual is at: -http://www.bitsavers.org/pdf/dec/terminal/gigi/EK-VK100-IN-002_GIGI_Terminal_Installation_and_Owners_Manual_Apr81.pdf -An enormous amount of useful info can be derived from the VT125 technical manual: -http://www.bitsavers.org/pdf/dec/terminal/vt100/EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf starting on page 6-70, pdf page 316 -And its schematics: -http://bitsavers.org/pdf/dec/terminal/vt125/MP01053_VT125_Mar82.pdf - -PCB Layout ----------- - -VK100 LOGICBOARD - |-------| |---------| |---------| |-| |-| |-| |-| -|---|-20 mA-|----|---EIA---|--|HARD-COPY|----|B|-|G|-|R|--|-|--DSW(8)--| -| BW | -| POWER | -| PR2 | -| HD46505SP 4116 4116 4116 4116 | -| | -| 4116 4116 4116 4116 | -| PR5 INTEL ROM1 | -| PR1 PR6 P8251A 4116 4116 4116 4116 | -| 45.6192MHz ROM2 PR3 | -| 4116 4116 4116 4116 | -| 4116 4116 4116 INTEL ROM3 | -| D8202A | -| 4116 4116 4116 5.0688MHz ROM4 PR4 | -| | -| 4116 4116 INTEL SMC_5016T PIEZO | -| D8085A IDC40 LM556 75452 | -|----------------------------------------------------------------------| -Notes: - ROM1 - TP-01 (C) DEC 23-031E4-00 (M) SCM91276L 8114 - ROM2 - TP-01 (C) DEC 1980 23-017E4-00 MOSTEK MK36444N 8116 - ROM3 - TP-01 (C) MICROSOFT 1979 23-018E4-00 MOSTEK MK36445N 8113 - ROM4 - TP-01 (C) DEC 1980 23-190E2-00 P8316E AMD 35517 8117DPP - - LED meanings: - The LEDS on the vk100 (there are 7) are set up above the keyboard as: - Label: ON LINE LOCAL NO SCROLL BASIC HARD-COPY L1 L2 - Bit: !d5 d5 !d4 !d3 !d2 !d1 !d0 (of port 0x68) -according to manual from http://www.bitsavers.org/pdf/dec/terminal/gigi/EK-VK100-IN-002_GIGI_Terminal_Installation_and_Owners_Manual_Apr81.pdf -where X = on, 0 = off, ? = variable (- = off) - - X 0 0 0 0 0 (0x1F) = Microprocessor error - X - 0 X X X X (0x30) " - - - X 0 0 0 0 X (0x1E) = ROM error - X - 0 0 ? ? ? (0x3x) " -1E 3F = rom error, rom 1 (0000-0fff) -1E 3E = rom error, rom 1 (1000-1fff) -1E 3D = rom error, rom 2 (2000-2fff) -1E 3C = rom error, rom 2 (3000-3fff) -1E 3B = rom error, rom 3 (4000-4fff) -1E 3A = rom error, rom 3 (5000-5fff) -1E 39 = rom error, rom 4 (6000-6fff) - - - X 0 0 0 X 0 (0x1D) = RAM error - X - 0 ? ? ? ? (0x3x) " - - - X 0 0 0 X X (0x1C) = CRT Controller error - X - 0 X X X X (0x30) " -This test writes 0xF to port 00 (crtc address reg) and writes a pattern to it -via port 01 (crtc data reg) then reads it back and checks to be sure the data -matches. - - - X 0 0 X 0 0 (0x1B) = CRT Controller time-out - X - 0 X X X X (0x30) " -This test writes 00 to all the crtc registers and checks to be sure an rst7.5 -(vblank) interrupt fires on the 8085 within a certain time period. - - - X 0 0 X 0 X (0x1A) = Vector time-out error - X - 0 X X X X (0x30) " -Not sure exactly what this tests, likely tries firing the vector generator -state machine and sees if the GO bit ever finishes and goes back to 0 -*/ - -// named timer IDs -#define TID_I8251_RX 1 -#define TID_I8251_TX 2 -#define TID_SYNC 3 - -// show messages related to writes to the 0x4x VG registers -#undef VG40_VERBOSE -// show messages related to writes to the 0x6x VG registers -#undef VG60_VERBOSE -// show messages related to LED/beeper writes -#undef LED_VERBOSE -// show messages related to KYBD writes -#undef KBD_VERBOSE -// debug the pattern reg -#undef PAT_DEBUG -// show reads from the two systat registers -#undef SYSTAT_A_VERBOSE -#undef SYSTAT_B_VERBOSE - -// debug state dump for the vector generator -#undef DEBUG_VG_STATE - -#include "bus/rs232/rs232.h" -#include "cpu/i8085/i8085.h" -#include "sound/beep.h" -#include "video/mc6845.h" -#include "machine/com8116.h" -#include "machine/i8251.h" -#include "vk100.lh" - -#define RS232_TAG "rs232" -#define COM5016T_TAG "com5016t" - -class vk100_state : public driver_device -{ -public: - enum - { - TIMER_EXECUTE_VG - }; - - vk100_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "crtc"), - m_speaker(*this, "beeper"), - m_uart(*this, "i8251"), - m_dbrg(*this, COM5016T_TAG), - //m_i8251_rx_timer(NULL), - //m_i8251_tx_timer(NULL), - //m_sync_timer(NULL), - - m_capsshift(*this, "CAPSSHIFT"), - m_dipsw(*this, "SWITCHES") - { - } - - required_device m_maincpu; - required_device m_crtc; - required_device m_speaker; - required_device m_uart; - required_device m_dbrg; - //required_device<> m_i8251_rx_timer; - //required_device<> m_i8251_tx_timer; - //required_device<> m_sync_timer; - - required_ioport m_capsshift; - required_ioport m_dipsw; - - UINT8* m_vram; - UINT8* m_trans; - UINT8* m_pattern; - UINT8* m_dir; - UINT8* m_sync; - UINT8* m_vector; - UINT8* m_ras_erase; - UINT8 m_dir_a6; // latched a6 of dir rom - UINT8 m_cout; // carry out from vgERR adder - UINT8 m_vsync; // vsync pin of crtc - UINT16 m_vgX; // 12 bit X value for vector draw position - UINT16 m_vgY; // 12 bit Y value for vector draw position - UINT16 m_vgERR; // error register can cause carries which need to be caught - UINT8 m_vgSOPS; - UINT8 m_vgPAT; - UINT16 m_vgPAT_Mask; // current mask for PAT - UINT8 m_vgPMUL; // reload value for PMUL_Count - UINT8 m_vgPMUL_Count; - UINT8 m_vgDownCount; // down counter = number of pixels, loaded from vgDU on execute -#define VG_DU m_vgRegFile[0] -#define VG_DVM m_vgRegFile[1] -#define VG_DIR m_vgRegFile[2] -#define VG_WOPS m_vgRegFile[3] - UINT8 m_vgRegFile[4]; - UINT8 m_VG_MODE; // 2 bits, latched on EXEC - UINT8 m_vgGO; // activated on next SYNC pulse after EXEC - UINT8 m_ACTS; - UINT8 m_ADSR; - ioport_port* m_col_array[16]; - - DECLARE_WRITE8_MEMBER(vgLD_X); - DECLARE_WRITE8_MEMBER(vgLD_Y); - DECLARE_WRITE8_MEMBER(vgERR); - DECLARE_WRITE8_MEMBER(vgSOPS); - DECLARE_WRITE8_MEMBER(vgPAT); - DECLARE_WRITE8_MEMBER(vgPMUL); - DECLARE_WRITE8_MEMBER(vgREG); - DECLARE_WRITE8_MEMBER(vgEX); - DECLARE_WRITE8_MEMBER(KBDW); - DECLARE_WRITE8_MEMBER(BAUD); - DECLARE_READ8_MEMBER(vk100_keyboard_column_r); - DECLARE_READ8_MEMBER(SYSTAT_A); - DECLARE_READ8_MEMBER(SYSTAT_B); - DECLARE_DRIVER_INIT(vk100); - virtual void machine_start(); - virtual void video_start(); - TIMER_CALLBACK_MEMBER(execute_vg); - DECLARE_WRITE_LINE_MEMBER(crtc_vsync); - DECLARE_WRITE_LINE_MEMBER(i8251_rxrdy_int); - DECLARE_WRITE_LINE_MEMBER(i8251_txrdy_int); - DECLARE_WRITE_LINE_MEMBER(i8251_rts); - UINT8 vram_read(); - UINT8 vram_attr_read(); - MC6845_UPDATE_ROW(crtc_update_row); - void vram_write(UINT8 data); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -// vram access functions: - /* figure out vram address based on tech manual page 5-24: - * real address to 16-bit chunk a13 a12 | a11 a10 a9 a8 | a7 a6 a5 a4 | a3 a2 a1 a0 - * X+Y input Y8 Y7 | Y6 Y5 Y4 Y3 | Y2 Y1 X9' X8'| X7' X6' X5' X4' - * X3' and X2' choose a 4-bit block, X1 and X0 choose a bit within that. - * Figure out the ram address in address space "vram" based on this: - * vram is 0x8000 long (0x4000 16-bit blocks in sequence) - * so: - * vram: a14 a13 a12 | a11 a10 a9 a8 | a7 a6 a5 a4 | a3 a2 a1 a0 - * vg: Y8 Y7 Y6 | Y5 Y4 Y3 Y2 | Y1 X9' X8' X7'| X6' X5' X4'(x3') x2' x1 x0 - * X3' is handled by the nybbleNum statement, as is X2' - * X1 and X0 are handled by the pattern rom directly: - * x0 -> a0, x1 -> a1 - * this handles bits like: - * x1 x0 - * 0 0 -> bit 0 - * 0 1 -> bit 1 - * 1 0 -> bit 2 - * 1 1 -> bit 3 - */ - -// returns one nybble from vram array based on X and Y regs -UINT8 vk100_state::vram_read() -{ - // XFinal is (X'&0x3FC)|(X&0x3) - UINT16 XFinal = m_trans[(m_vgX&0x3FC)>>2]<<2|(m_vgX&0x3); // appears correct - // EA is the effective ram address for a 16-bit block - UINT16 EA = ((m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct - // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte) - UINT16 block = m_vram[(EA<<1)+1] | (m_vram[(EA<<1)]<<8); - // nybbleNum is which of the four nybbles within the block to address. should NEVER be 3! - UINT8 nybbleNum = (XFinal&0xC)>>2; - return (block>>(4*nybbleNum))&0xF; -} - -// returns the attribute nybble for the current pixel based on X and Y regs -UINT8 vk100_state::vram_attr_read() -{ - // XFinal is (X'&0x3FC)|(X&0x3) - UINT16 XFinal = m_trans[(m_vgX&0x3FC)>>2]<<2|(m_vgX&0x3); // appears correct - // EA is the effective ram address for a 16-bit block - UINT16 EA = ((m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct - // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte) - UINT16 block = m_vram[(EA<<1)+1] | (m_vram[(EA<<1)]<<8); - // nybbleNum is the attribute nybble, which in this case is always 3 - UINT8 nybbleNum = 3; - return (block>>(4*nybbleNum))&0xF; -} - -// writes one nybble to vram array based on X and Y regs, and updates the attrib ram if needed -void vk100_state::vram_write(UINT8 data) -{ - // XFinal is (X'&0x3FC)|(X&0x3) - UINT16 XFinal = m_trans[(m_vgX&0x3FC)>>2]<<2|(m_vgX&0x3); // appears correct - // EA is the effective ram address for a 16-bit block - UINT16 EA = ((m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct - // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte) - UINT16 block = m_vram[(EA<<1)+1] | (m_vram[(EA<<1)]<<8); - // nybbleNum is which of the four nybbles within the block to address. should NEVER be 3! - UINT8 nybbleNum = (XFinal&0xC)>>2; - block &= ~((UINT16)0xF<<(nybbleNum*4)); // mask out the part we want to replace - block |= data<<(nybbleNum*4); // write the new part - // NOTE: this next part may have to be made conditional on VG_MODE - // check if the attribute nybble is supposed to be modified, and if so do so - if (VG_WOPS&0x08) block = (block&0x0FFF)|(((UINT16)VG_WOPS&0xF0)<<8); - m_vram[(EA<<1)+1] = block&0xFF; // write block back to vram - m_vram[(EA<<1)] = (block&0xFF00)>>8; // '' -} - -void vk100_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_EXECUTE_VG: - execute_vg(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in vk100_state::device_timer"); - } -} - -/* this is the "DIRECTION ROM" == mb6309 (256x8, 82s135) - * see figure 5-24 on page 5-39 - * It tells the direction and enable for counting on the X and Y counters - * and also handles the non-math related parts of the bresenham line algorithm - * control bits: - * /CE1 ----- DCOUNT 0 H [verified via tracing] - * /CE2 ----- ENA ERROR L [verified via tracing] - * addr bits: 76543210 - * ||||\\\\-- DIR (vgDIR register low 4 bits) - * |||\------ C OUT aka ERROR CARRY (strobed in by STROBE L from the error counter's adder) [verified via tracing] - * ||\------- Y0 (the otherwise unused lsb of the Y register, used for bresenham) [verified via tracing] - * |\-------- feedback bit from d5 strobed by V CLK [verified via tracing] - * \--------- GND; the second half of the prom is blank (0x00) - * data bits: 76543210 - * |||||||\-- ENA Y (enables change on Y counter) - * ||||||\--- ENA X (enables change on X counter) - * |||||\---- Y DIRECTION (high is count down, low is count up) - * ||||\----- X DIRECTION (high is count down, low is count up) - * |||\------ PIXEL WRT - * ||\------- feedback bit to a6, this bit is held in PRESET/1 condition by GO being inactive, and if the vector prom is disabled it is pulled to 1 [verified via tracing and schematics] - * |\-------- UNUSED, always 0 - * \--------- UNUSED, always 0 - * The VT125 prom @ E41 is literally identical to this, the same exact part: 23-059B1 - */ -TIMER_CALLBACK_MEMBER(vk100_state::execute_vg) -{ - m_cout = 1; // hack for now - UINT8 dirbyte = m_dir[(m_dir_a6<<6)|((m_vgY&1)<<5)|(m_cout<<4)|VG_DIR]; -#ifdef DEBUG_VG_STATE - static const char *const vg_functions[] = { "Move", "Dot", "Vector", "Erase" }; - fprintf(stderr, "VGMODE: %s; DIR: A:%02x; D:%02x; X: %03X; Y: %03X; DownCount: %02X\n", vg_functions[m_VG_MODE], ((m_dir_a6<<6)|((m_vgY&1)<<5)|(m_cout<<4)|VG_DIR), dirbyte, m_vgX, m_vgY, m_vgDownCount); -#endif - m_dir_a6 = m_vgGO?((dirbyte&0x20)>>5):1; - if (dirbyte&2) // ena_x is active - { - if (dirbyte&0x80) m_vgX--; - else m_vgX++; - } - if (dirbyte&1) // ena_y is active - { - if (dirbyte&0x40) m_vgY--; - else m_vgY++; - } - if (dirbyte&0x10) m_vgDownCount--; // decrement the down counter - UINT8 thisNyb = vram_read(); // read in the nybble - // pattern rom addressing is a complex mess. see the pattern rom def later in this file. - UINT8 newNyb = m_pattern[((m_vgPAT&m_vgPAT_Mask)?0x200:0)|((VG_WOPS&7)<<6)|((m_vgX&3)<<4)|thisNyb]; // calculate new nybble based on pattern rom - // finally write the block back to ram depending on the VG_MODE (sort of a hack until we get the vector and sync and dir roms all hooked up) - // but only do it if the direction rom said so! - switch (m_VG_MODE) - { - case 0: // move; adjusts the x and y but doesn't write anything. do nothing - break; - case 1: // dot: only write the LAST pixel in the chain? TODO: some fallthrough magic here? - if ((m_vgDownCount) == 0x00) - { - if (dirbyte&0x10) vram_write(newNyb); // write out the modified nybble - } - break; - case 2: // vec: draw the vector - if (dirbyte&0x10) vram_write(newNyb); // write out the modified nybble - break; - case 3: // er: erase: special case here: wipe the entire screen (except for color/attrib?) and then set done. - for (int i = 0; i < 0x8000; i++) - { - if (!(i&1)) // avoid stomping attribute - m_vram[i] = m_vram[i]&0xF0; - else // (i&1) - m_vram[i] = 0; - } - m_vgGO = 0; // done - break; - } - if ((m_vgDownCount) == 0x00) m_vgGO = 0; // check if the down counter hit terminal count (0), if so we're done. - if (((++m_vgPMUL_Count)&0xF)==0) // if pattern multiplier counter overflowed - { - m_vgPMUL_Count = m_vgPMUL; // reload counter - m_vgPAT_Mask >>= 1; // shift the mask - if (m_vgPAT_Mask == 0) m_vgPAT_Mask = 0x80; // reset mask if it hits 0 - } - if (m_vgGO) timer_set(attotime::from_hz(XTAL_45_6192Mhz/3/12/2), TIMER_EXECUTE_VG); // /3/12/2 is correct. the sync counter is clocked by the dot clock, despite the error on figure 5-21 -} - -/* ports 0x40 and 0x41: load low and high bytes of vector gen X register */ -WRITE8_MEMBER(vk100_state::vgLD_X) -{ - m_vgX &= 0xFF << ((1-offset)*8); - m_vgX |= ((UINT16)data) << (offset*8); -#ifdef VG40_VERBOSE - logerror("VG: 0x%02X: X Reg loaded with %04X, new X value is %04X\n", 0x40+offset, ((UINT16)data) << (offset*8), m_vgX); -#endif -} - -/* ports 0x42 and 0x43: load low and high bytes of vector gen Y register */ -WRITE8_MEMBER(vk100_state::vgLD_Y) -{ - m_vgY &= 0xFF << ((1-offset)*8); - m_vgY |= ((UINT16)data) << (offset*8); -#ifdef VG40_VERBOSE - logerror("VG: 0x%02X: Y Reg loaded with %04X, new Y value is %04X\n", 0x42+offset, ((UINT16)data) << (offset*8), m_vgY); -#endif -} - -/* port 0x44: "ERR" load bresenham line algorithm 'error' count */ -WRITE8_MEMBER(vk100_state::vgERR) -{ - m_vgERR = data; -#ifdef VG40_VERBOSE - logerror("VG: 0x44: ERR Reg loaded with %02X\n", m_vgERR); -#endif -} - -/* port 0x45: "SOPS" screen options - * (handled by 74LS273 @ E55, schematic sheet 10, all signals called 'VVG1 BDx' where x is 7 to 0) - * Blink --Background color-- Blink Serial Serial Reverse - * Enable Green Red Blue Control SL1 SL0 BG/FG - * d7 d6 d5 d4 d3 d2 d1 d0 - * apparently, SLx: 00 = rs232/eia(J6), 01 = 20ma(J1), 10 = hardcopy(J7), 11 = test/loopback - * Serial Select (SLx) routing controls are rather complex, shown on schematic - * page 9: - * VDC2 | I8251 pins | SYSTAT_B bits - * SL1 SL0 | 8251RXD 8251RTS 8251TXD 8251/DTR 8251/DSR 8251CTS | SYSTATB_ACTS SYSTATB_ADSR - * 0 0 J6 /RXD J6 /RTS J6 TXD J6 /DTR J7 URTS GND J6 /CTS J6 /DSR - * 0 1 J1 +-R ACTS(loop) J1 +-T J6 /DTR J7 URTS GND 8251RTS(loop) J6 /DSR - * 1 0 J7 DRXD J7 DRTS* J7 DTXD J6 /DTR J7 URTS GND J7 /DCTS J6 /DSR - * 1 1 8251TXD ACTS(loop) 8251RXD J6 /DTR J7 URTS GND 8251RTS(loop) J6 /DSR - * * and UCTS, the pin drives both pins on J7 - */ -WRITE8_MEMBER(vk100_state::vgSOPS) -{ - m_vgSOPS = data; -#ifdef VG40_VERBOSE - static const char *const serialDest[4] = { "EIA232", "20ma", "Hardcopy", "Loopback/test" }; - logerror("VG: 0x45: SOPS Reg loaded with %02X: Background KGRB: %d%d%d%d, Blink: %d, Serial select: %s, Reverse BG/FG: %d\n", m_vgSOPS, (m_vgSOPS>>7)&1, (m_vgSOPS>>6)&1, (m_vgSOPS>>5)&1, (m_vgSOPS>>4)&1, (m_vgSOPS>>3)&1, serialDest[(m_vgSOPS>>1)&3], m_vgSOPS&1); -#endif -} - -/* port 0x46: "PAT" load vg Pattern register */ -WRITE8_MEMBER(vk100_state::vgPAT) -{ - m_vgPAT = data; -#ifdef PAT_DEBUG - for (int i = 7; i >= 0; i--) - { - printf("%s", (data&(1<>7)&1, (VG_WOPS>>6)&1, (VG_WOPS>>5)&1, (VG_WOPS>>4)&1, (VG_WOPS>>3)&1, wopsFunctions[(VG_WOPS>>1)&3], VG_WOPS&1); -#endif -} - - -/* port 0x64: "EX MOV" execute a move (relative move of x and y using du/dvm/dir/err, no writing) */ -/* port 0x65: "EX DOT" execute a dot (draw a dot at x,y?) */ -/* port 0x66: "EX VEC" execute a vector (draw a vector from x,y to a destination using du/dvm/dir/err ) */ -/* port 0x67: "EX ER" execute an erase (clear the screen to the bg color, i.e. fill vram with zeroes) */ -WRITE8_MEMBER(vk100_state::vgEX) -{ -#ifdef VG60_VERBOSE - static const char *const ex_functions[] = { "Move", "Dot", "Vector", "Erase" }; - logerror("VG Execute %s 0x%02X written with %d\n", ex_functions[offset&3], 0x67+offset, data); - //fprintf(stderr, "VG Execute %s 0x%02X written with %d\n", ex_functions[offset&3], 0x67+offset, data); -#endif - m_vgPMUL_Count = m_vgPMUL; // load PMUL_Count - m_vgPAT_Mask = 0x80; - m_vgDownCount = VG_DU; // set down counter to length of major vector - m_VG_MODE = offset&3; - m_vgGO = 1; - timer_set(attotime::zero, TIMER_EXECUTE_VG); -} - - -/* port 0x68: "KBDW" d7 is beeper, d6 is keyclick, d5-d0 are keyboard LEDS */ -WRITE8_MEMBER(vk100_state::KBDW) -{ - output_set_value("online_led",BIT(data, 5) ? 1 : 0); - output_set_value("local_led", BIT(data, 5) ? 0 : 1); - output_set_value("noscroll_led",BIT(data, 4) ? 1 : 0); - output_set_value("basic_led", BIT(data, 3) ? 1 : 0); - output_set_value("hardcopy_led", BIT(data, 2) ? 1 : 0); - output_set_value("l1_led", BIT(data, 1) ? 1 : 0); - output_set_value("l2_led", BIT(data, 0) ? 1 : 0); -#ifdef LED_VERBOSE - if (BIT(data, 6)) logerror("kb keyclick bit 6 set: not emulated yet (multivibrator)!\n"); -#endif - m_speaker->set_state(BIT(data, 7)); -#ifdef LED_VERBOSE - logerror("LED state: %02X: %s %s %s %s %s %s\n", data&0xFF, (data&0x20)?"------- LOCAL ":"ON LINE ----- ", (data&0x10)?"--------- ":"NO SCROLL ", (data&0x8)?"----- ":"BASIC ", (data&0x4)?"--------- ":"HARD-COPY ", (data&0x2)?"-- ":"L1 ", (data&0x1)?"-- ":"L2 "); -#endif -} - -/* port 0x6C: "BAUD" controls the smc com5016t dual baud generator which - * controls the divisors for the rx and tx clocks on the 8251 from the - 5.0688Mhz cpu xtal. - It has 5v,12v on pins 2 and 9, pin 10 is NC. - * A later part that replaced this on the market is SMC COM8116(T)/8136(T), which - was a 5v-only part (pin 9 and 10 are NC, 10 is a clock out on the 8136. - * Note that even on the SMC COM5016T version, SMC would allow the user - to mask their own dividers on custom ordered chips if desired. - * The COM8116(T)/8136(T) came it at least 4 mask rom types meant for different - input clocks: - -000 or no mark for 5.0688Mhz (which exactly matches the table below) (synertek sy2661-3 also matches this exactly) - -003 is for 6.01835MHz - -005 is for 4.915200Mhz - -006 is for 5.0688Mhz but omits the 2000 baud entry, instead has 200, - and output frequencies are 2x as fast (meant for a 32X clock uart) - -013 is for 2.76480MHz - -013A is for 5.52960MHz - (several other unknown refclock masks appear on partscalper sites) - GI also made a clone of the 8116 5v chip called the AY-5-8116(T)/8136(T) - which had at least two masks: -000/no mark and -005, matching speeds above - WD made the WD1943 which is similarly 5v compatible, with -00, -05, -06 masks - The COM8046(T) has 5 bits for selection instead of 4, but still expects - a 5.0688MHz reference clock, and the second half of the table matches the - values below; the first half of the table is the values below /2, rounded - down (for uarts which need a clock rate of 32x baud instead of 16x). - WD's BR1941 is also functionally compatible but uses 5v,12v,-5v on pins 2,9,10 - * The baud divisor lookup table has 16 entries, but only entries 2,5,6,7,A,C,E,F are documented/used in the vk100 tech manual - * The others are based on page 13 of http://www.hartetechnologies.com/manuals/Tarbell/Tarbell%20Z80%20CPU%20Board%20Model%203033.pdf - * D C B A Divisor Expected Baud - * 0 0 0 0 - 6336 (5068800 / 6336 = 16*50 = 50 baud - * 0 0 0 1 - 4224 (5068800 / 4224 = 16*75) = 75 baud - * 0 0 1 0 - 2880 (5068800 / 2880 = 16*110) = 110 baud - * 0 0 1 1 - 2355 (5068800 / 2355 = 16*134.5223) ~= 134.5 baud - * 0 1 0 0 - 2112 (5068800 / 2112 = 16*150) = 150 baud - * 0 1 0 1 - 1056 (5068800 / 1056 = 16*300) = 300 baud - * 0 1 1 0 - 528 (5068800 / 528 = 16*600) = 600 baud - * 0 1 1 1 - 264 (5068800 / 264 = 16*1200) = 1200 baud - * 1 0 0 0 - 176 (5068800 / 176 = 16*1800) = 1800 baud - * 1 0 0 1 - 158 (5068800 / 158 = 16*2005.0633) ~= 2000 baud - * 1 0 1 0 - 132 (5068800 / 132 = 16*2400) = 2400 baud - * 1 0 1 1 - 88 (5068800 / 88 = 16*3600) = 3600 baud - * 1 1 0 0 - 66 (5068800 / 66 = 16*4800) = 4800 baud - * 1 1 0 1 - 44 (5068800 / 44 = 16*7200) = 7200 baud - * 1 1 1 0 - 33 (5068800 / 33 = 16*9600) = 9600 baud - * 1 1 1 1 - 16 (5068800 / 16 = 16*19800) ~= 19200 baud - */ -WRITE8_MEMBER(vk100_state::BAUD) -{ - m_dbrg->str_w(data & 0x0f); - m_dbrg->stt_w(data >> 4); -} - -/* port 0x40-0x47: "SYSTAT A"; various status bits, poorly documented in the tech manual - * /GO VDM1 VDM1 VDM1 VDM1 Dip RST7.5 GND*** - * BIT3 BIT2 BIT1 BIT0 Switch VSYNC - * d7 d6 d5 d4 d3 d2 d1 d0 - bit3, 2, 1, 0 are the 4 bits output from the VRAM 12->4 multiplexer - which are also inputs to the pattern rom; they are constantly updated - by the sync rom and related circuitry. - This is the only way the vram can be read by the cpu. - d7 is from the /Q output of the GO latch - d6,5,4,3 are from the 74ls298 at ic4 (right edge of pcb) - d2 is where the dipswitch values are read from, based on the offset - d1 is connected to 8085 rst7.5 (pin 7) and crtc pin 40 (VSYNC) [verified via tracing] - d0 is tied to GND [verified via tracing] but the schematics both tie it to GND - and call it LP FLAG, may be a leftover from development. - - 31D reads and checks d7 in a loop - 205 reads, xors with 0x55 (from reg D), ANDS result with 0x78 and branches if it is not zero (checking for bit pattern 1010?) - 299 reads, rotates result right 3 times and ANDs the result with 0x0F - 2A4 reads, rotates result left 1 time and ANDS the result with 0xF0 -*/ -READ8_MEMBER(vk100_state::SYSTAT_A) -{ - UINT8 dipswitchLUT[8] = { 1,3,5,7,6,4,2,0 }; // the dipswitches map in a weird order to offsets -#ifdef SYSTAT_A_VERBOSE - if (m_maincpu->pc() != 0x31D) logerror("0x%04X: SYSTAT_A Read!\n", m_maincpu->pc()); -#endif - return ((m_vgGO?0:1)<<7)|(vram_read()<<3)|(((m_dipsw->read()>>dipswitchLUT[offset])&1)?0x4:0)|(m_vsync?0x2:0); -} - -/* port 0x48: "SYSTAT B"; NOT documented in the tech manual at all. - * when in loopback/test mode, SYSTAT_B is read and expected the following, around 0x606: - * reset 8751, modewrite of 0x5E - * write command -> 0x20 (normal, normal, /RTS is 0, normal, normal, receive off, /DTR is 1, transmit off) - * read SYSTAT B (and xor with 0xe), expect d7 to be CLEAR or jump to error - * write command -> 0x05 (normal, normal, /RTS is 1, normal, normal, receive ON, /DTR is 0, transmit off) - * read SYSTAT B (and xor with 0xe), expect d7 to be SET or jump to error - * after this it does something and waits for an rxrdy interrupt - - shows the results of: - * ACTS (/CTS) ADSR (/DSR) GND GND ATTR3 ATTR2 ATTR1 ATTR0 - * d7 d6 d5 d4 d3 d2 d1 d0 - * the ACTS (inverse of DCTS) signal lives in one of these bits (see 5-62) - * it XORs the read of systat_b with the E register (which holds 0x6) - * and checks the result - * The 4 attribute ram bits for the cell being pointed at by the X and Y regs are readable as the low nybble. - * The DSR pin is readable as bit 6. - */ -READ8_MEMBER(vk100_state::SYSTAT_B) -{ -#ifdef SYSTAT_B_VERBOSE - logerror("0x%04X: SYSTAT_B Read!\n", m_maincpu->pc()); -#endif - return (m_ACTS<<7)|(m_ADSR<<6)|vram_attr_read(); -} - -READ8_MEMBER(vk100_state::vk100_keyboard_column_r) -{ - UINT8 code = m_col_array[offset&0xF]->read() | m_capsshift->read(); -#ifdef KBD_VERBOSE - logerror("Keyboard column %X read, returning %02X\n", offset&0xF, code); -#endif - return code; -} - -static ADDRESS_MAP_START(vk100_mem, AS_PROGRAM, 8, vk100_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x6fff ) AM_ROM - AM_RANGE( 0x7000, 0x700f ) AM_MIRROR(0x0ff0) AM_READ(vk100_keyboard_column_r) - AM_RANGE( 0x8000, 0xbfff ) AM_RAM -ADDRESS_MAP_END - -/* - * 8085 IO address map (x = ignored; * = selects address within this range; ? = not sure; ** = subparts check this bit) - * (a15 to a8 are latched the same value as a7-a0 on the 8080 and 8085) - * [this map is derived from extensive tracing as well as some guesswork, noted for the crtc, systat_b and the uart] - a7 a6 a5 a4 a3 a2 a1 a0 - x 0 x x x x x 0 W CRTC address - x 0 x x x x x 1 RW CRTC register r/w - x 1 * * * ** ** ** read area (rightmost 74ls138): - x 1 0 0 0 * * * R SYSTAT_A (a0-a3 chooses the bit of the dipswitches read via d3) - x 1 0 0 1 x x x R SYSTAT_B - x 1 0 1 0 x x 0 R i8251 UART data - x 1 0 1 0 x x 1 R i8251 UART status - x 1 0 1 1 x x x R unused - x 1 1 0 0 x x x R unused - x 1 1 0 1 x x x R unused - x 1 1 1 0 x x x R unused - x 1 1 1 1 x x x R unused - x 1 0 x x * * * write area (right 74ls138): - x 1 0 x x 0 0 0 W X (low 8 bits) - x 1 0 x x 0 0 1 W X (high 4 bits) - x 1 0 x x 0 1 0 W Y (low 8 bits) - x 1 0 x x 0 1 1 W Y (high 4 bits) - x 1 0 x x 1 0 0 W ERR - x 1 0 x x 1 0 1 W SOPS - x 1 0 x x 1 1 0 W PAT - x 1 0 x x 1 1 1 W PMUL - x 1 1 * * * ** ** write area (middle 74ls138): - x 1 1 0 0 0 ** ** write to register file 2x 74ls670: - x 1 1 0 0 0 0 0 W DU - x 1 1 0 0 0 0 1 W DVM - x 1 1 0 0 0 1 0 W DIR - x 1 1 0 0 0 1 1 W WOPS - x 1 1 0 0 1 * * W set VG_MODE to * * XOR 3 and Execute (if GO is not active) - x 1 1 0 1 0 x x W KYBDW - x 1 1 0 1 1 x x W BAUD - x 1 1 1 0 0 x 0 W i8251 UART data - x 1 1 1 0 0 x 1 W i8251 UART control - x 1 1 1 0 1 x x W unused - x 1 1 1 1 0 x x W unused - x 1 1 1 1 1 x x W unused -*/ -static ADDRESS_MAP_START(vk100_io, AS_IO, 8, vk100_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x7f) // guess, probably correct - AM_RANGE(0x00, 0x00) AM_MIRROR(0xBE) AM_DEVWRITE("crtc", mc6845_device, address_w) - AM_RANGE(0x01, 0x01) AM_MIRROR(0xBE) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - // Comments are from page 118 (5-14) of http://web.archive.org/web/20091015205827/http://www.computer.museum.uq.edu.au/pdf/EK-VK100-TM-001%20VK100%20Technical%20Manual.pdf - AM_RANGE (0x40, 0x41) AM_MIRROR(0x98) AM_WRITE(vgLD_X) //LD X LO + HI 12 bits - AM_RANGE (0x42, 0x43) AM_MIRROR(0x98) AM_WRITE(vgLD_Y) //LD Y LO + HI 12 bits - AM_RANGE (0x44, 0x44) AM_MIRROR(0x98) AM_WRITE(vgERR) //LD ERR ('error' in bresenham algorithm) - AM_RANGE (0x45, 0x45) AM_MIRROR(0x98) AM_WRITE(vgSOPS) //LD SOPS (screen options (plus uart dest)) - AM_RANGE (0x46, 0x46) AM_MIRROR(0x98) AM_WRITE(vgPAT) //LD PAT (pattern register) - AM_RANGE (0x47, 0x47) AM_MIRROR(0x98) AM_WRITE(vgPMUL) //LD PMUL (pattern multiplier) - AM_RANGE (0x60, 0x63) AM_MIRROR(0x80) AM_WRITE(vgREG) //LD DU, DVM, DIR, WOPS (register file) - AM_RANGE (0x64, 0x67) AM_MIRROR(0x80) AM_WRITE(vgEX) //EX MOV, DOT, VEC, ER - AM_RANGE (0x68, 0x68) AM_MIRROR(0x83) AM_WRITE(KBDW) //KBDW (probably AM_MIRROR(0x03)) - AM_RANGE (0x6C, 0x6C) AM_MIRROR(0x83) AM_WRITE(BAUD) //LD BAUD (baud rate clock divider setting for i8251 tx and rx clocks) (probably AM_MIRROR(0x03)) - AM_RANGE (0x70, 0x70) AM_MIRROR(0x82) AM_DEVWRITE("i8251", i8251_device, data_w) //LD COMD (i8251 data reg) - AM_RANGE (0x71, 0x71) AM_MIRROR(0x82) AM_DEVWRITE("i8251", i8251_device, control_w) //LD COM (i8251 control reg) - //AM_RANGE (0x74, 0x74) AM_MIRROR(0x83) AM_WRITE(unknown_74) - //AM_RANGE (0x78, 0x78) AM_MIRROR(0x83) AM_WRITE(kbdw) //KBDW ?(mirror?) - //AM_RANGE (0x7C, 0x7C) AM_MIRROR(0x83) AM_WRITE(unknown_7C) - AM_RANGE (0x40, 0x47) AM_MIRROR(0x80) AM_READ(SYSTAT_A) // SYSTAT A (state machine done and last 4 bits of vram, as well as dipswitches) - AM_RANGE (0x48, 0x48) AM_MIRROR(0x87/*0x80*/) AM_READ(SYSTAT_B) // SYSTAT B (uart stuff) - AM_RANGE (0x50, 0x50) AM_MIRROR(0x86) AM_DEVREAD("i8251", i8251_device, data_r) // UART O - AM_RANGE (0x51, 0x51) AM_MIRROR(0x86) AM_DEVREAD("i8251", i8251_device, status_r) // UAR - //AM_RANGE (0x58, 0x58) AM_MIRROR(0x87) AM_READ(unknown_58) - //AM_RANGE (0x60, 0x60) AM_MIRROR(0x87) AM_READ(unknown_60) - //AM_RANGE (0x68, 0x68) AM_MIRROR(0x87) AM_READ(unknown_68) // NOT USED - //AM_RANGE (0x70, 0x70) AM_MIRROR(0x87) AM_READ(unknown_70) - //AM_RANGE (0x78, 0x7f) AM_MIRROR(0x87) AM_READ(unknown_78) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vk100 ) - // the dipswitches are common ground: when open (upward) the lines are pulled to 5v, otherwise they read as 0 - PORT_START("SWITCHES") - PORT_DIPNAME( 0x01, 0x00, "Power Frequency" ) PORT_DIPLOCATION("SW:!1") - PORT_DIPSETTING( 0x00, "60Hz" ) - PORT_DIPSETTING( 0x01, "50Hz" ) - PORT_DIPNAME( 0x02, 0x00, "Default Serial Port" ) PORT_DIPLOCATION("SW:!2") - PORT_DIPSETTING( 0x00, "EIA port" ) - PORT_DIPSETTING( 0x02, "20ma port" ) - PORT_DIPNAME( 0x04, 0x00, "Default US/UK" ) PORT_DIPLOCATION("SW:!3") - PORT_DIPSETTING( 0x00, "US" ) - PORT_DIPSETTING( 0x04, "UK" ) - PORT_DIPNAME( 0x18, 0x00, "Default Parity" ) PORT_DIPLOCATION("SW:!4,!5") - PORT_DIPSETTING( 0x00, "Off" ) - PORT_DIPSETTING( 0x10, "Even" ) - PORT_DIPSETTING( 0x08, "Odd" ) - PORT_DIPSETTING( 0x18, "Do Not Use This Setting" ) - PORT_DIPNAME( 0xe0, 0x00, "Default Baud Rate" ) PORT_DIPLOCATION("SW:!6,!7,!8") - PORT_DIPSETTING( 0x00, "110" ) - PORT_DIPSETTING( 0x80, "300" ) - PORT_DIPSETTING( 0x40, "600" ) - PORT_DIPSETTING( 0xc0, "1200" ) - PORT_DIPSETTING( 0x20, "2400" ) - PORT_DIPSETTING( 0xa0, "4800" ) - PORT_DIPSETTING( 0x60, "9600" ) - PORT_DIPSETTING( 0xe0, "19200" ) - - PORT_START("CAPSSHIFT") // CAPS LOCK and SHIFT appear as the high 2 bits on all rows - PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_TOGGLE PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_START("COL0") - PORT_BIT(0x1f, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) // row 0 bit 6 is always low, checked by keyboard test - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) // all rows have these bits left low to save a mask op later - PORT_START("COL1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Set Up") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF1/Hardcopy") PORT_CODE(KEYCODE_F1) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("No scroll") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF2/Locator") PORT_CODE(KEYCODE_F2) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF3/Text") PORT_CODE(KEYCODE_F3) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF4/Reset") PORT_CODE(KEYCODE_F4) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COL9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLB") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLC") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLD") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLE") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line feed") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("COLF") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x18, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - - -void vk100_state::machine_start() -{ - m_speaker->set_frequency(116); //116 hz (page 172 of TM), but duty cycle is wrong here! - output_set_value("online_led",1); - output_set_value("local_led", 0); - output_set_value("noscroll_led",1); - output_set_value("basic_led", 1); - output_set_value("hardcopy_led", 1); - output_set_value("l1_led", 1); - output_set_value("l2_led", 1); - m_vsync = 0; - m_dir_a6 = 1; - m_cout = 0; - m_vgX = 0; - m_vgY = 0; - m_vgERR = 0; - m_vgSOPS = 0; - m_vgPAT = 0; - m_vgPAT_Mask = 0x80; - m_vgPMUL = 0; - m_vgPMUL_Count = 0; - m_vgDownCount = 0; - VG_DU = 0; - VG_DVM = 0; - VG_DIR = 0; - VG_WOPS = 0; - m_VG_MODE = 0; - m_vgGO = 0; - m_ACTS = 1; - m_ADSR = 1; - char kbdcol[8]; - // look up all 16 tags 'the slow way' but only once on reset - for (int i = 0; i < 16; i++) - { - sprintf(kbdcol,"COL%X", i); - m_col_array[i] = ioport(kbdcol); - } -} - -WRITE_LINE_MEMBER(vk100_state::crtc_vsync) -{ - m_maincpu->set_input_line(I8085_RST75_LINE, state? ASSERT_LINE : CLEAR_LINE); - m_vsync = state; -} - -WRITE_LINE_MEMBER(vk100_state::i8251_rxrdy_int) -{ - m_maincpu->set_input_line(I8085_RST65_LINE, state?ASSERT_LINE:CLEAR_LINE); -} - -WRITE_LINE_MEMBER(vk100_state::i8251_txrdy_int) -{ - m_maincpu->set_input_line(I8085_RST55_LINE, state?ASSERT_LINE:CLEAR_LINE); -} - -WRITE_LINE_MEMBER(vk100_state::i8251_rts) -{ - logerror("callback: RTS state changed to %d\n", state); - // TODO: only change this during loopback mode! - m_ACTS = state; -} - -DRIVER_INIT_MEMBER(vk100_state,vk100) -{ - // figure out how the heck to initialize the timers here - //m_i8251_rx_timer = timer_alloc(TID_I8251_RX); - //m_i8251_tx_timer = timer_alloc(TID_I8251_TX); - //m_i8251_sync_timer = timer_alloc(TID_SYNC); - //machine().scheduler().timer_set(attotime::from_hz(10000), FUNC(i8251_rx_clk)); -} - -void vk100_state::video_start() -{ - m_vram = memregion("vram")->base(); - m_trans = memregion("trans")->base(); - m_pattern = memregion("pattern")->base(); - m_dir = memregion("dir")->base(); - m_sync = memregion("sync")->base(); - m_vector = memregion("vector")->base(); - m_ras_erase = memregion("ras_erase")->base(); -} - -MC6845_UPDATE_ROW( vk100_state::crtc_update_row ) -{ - static const UINT32 colorTable[16] = { - 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF, - 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF }; - static const UINT32 colorTable2[16] = { - 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 }; - //printf("y=%d, ma=%04x, ra=%02x, x_count=%02x ", y, ma, ra, x_count); - /* figure out ram address based on tech manual page 5-23: - * real address to 16-bit chunk a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 - * crtc input MA11 MA10 MA9 MA8 MA7 MA6 RA1 RA0 MA5 MA4 MA3 MA2 MA1 MA0 - */ - UINT16 EA = ((ma&0xfc0)<<2)|((ra&0x3)<<6)|(ma&0x3F); - // display the 64 different 12-bit-wide chunks - for (int i = 0; i < 64; i++) - { - UINT16 block = m_vram[(EA<<1)+(2*i)+1] | (m_vram[(EA<<1)+(2*i)]<<8); - UINT32 fgColor = (m_vgSOPS&0x08)?colorTable[(block&0xF000)>>12]:colorTable2[(block&0xF000)>>12]; - UINT32 bgColor = (m_vgSOPS&0x08)?colorTable[(m_vgSOPS&0xF0)>>4]:colorTable2[(m_vgSOPS&0xF0)>>4]; - // display a 12-bit wide chunk - for (int j = 0; j < 12; j++) - { - bitmap.pix32(y, (12*i)+j) = (((block&(0x0001< timer0 = baud clock - timer1 = pitch (duty cycle output to modify RC) - timer2 = volume (duty cycle output to control trans. gate which does vol. control) - portb: pin 6 through pin 13 of parallel port - portc 0 = NC, 1 = GND, 2 = pin 5, 3 = /RXINTEN, 4 = pin 15, 5 = pin 14 through inverter, 6 = 8910 enable, 7 = from pin 4 through inverter (I believe that's for the parallel port) - porta: pin 16 through 23 of parallel port - that's the 8255 - on the AY-3-8910: - IOA0-A5 = phoneme # - IOA6 = strobe (SC-01) - IOA7 = vochord control, 0 = off, 1 = on - IOB0-IOB7 = dip switches - there ya go, complete IO port map - cool :) - I pinned the IO to the serial port from the 8251 but I don't think it's too useful - eh, its useful - I drew out the schematic for the analog section - oh that will be useful - but I didn't draw out the digital part, just made an I/O and memory map but I can't find them - i also see the ay is running at 2 MHz - sounds about right - got it - I drew out the clocking section too - 8MHz xtal - 4MHz for the Z80 - 2MHz for the 8253 and '8910 - then the dividers also generate the system reset signals for the 8251 - and a periodic IRQ - on the z80? - ok how does that work? - IRQ rate is umm - 122Hz - (8MHz / 65536) - oh the 8251 is not reset by the counters - it just takes a positive reset off an inverter that resets the counters - PIT2 is gated by 8MHz / 256 - PIT1 is gated by 8MHz / 4096 - PIT0 is not gated - (i.e. it always runs) - oh boy, this is sounding more fun by the minute - aaand your luck is about to run out - that's all I got - thats good enough, saved me a lot of work - but that's everything you need - yeah - - -Things to be looked at: -- Serial doesn't work, so has been disabled. -- Bottom 3 dips must be off/serial/off, or else nothing works. -- No sound at all. -- volume and pitch should be controlled by ppi outputs -- pit to be hooked up -- bit 0 of portc is not connected according to text above, but it - completely changes the irq operation. - -******************************************************************************/ - -/* Core includes */ -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -//#include "votrpss.lh" - -/* Components */ -#include "sound/ay8910.h" -#include "sound/votrax.h" -#include "machine/clock.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/i8251.h" - -/* For testing */ -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class votrpss_state : public driver_device -{ -public: - votrpss_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_ppi(*this, "ppi"), - m_uart(*this, "uart") - { - } - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(ppi_pa_r); - DECLARE_READ8_MEMBER(ppi_pb_r); - DECLARE_READ8_MEMBER(ppi_pc_r); - DECLARE_WRITE8_MEMBER(ppi_pa_w); - DECLARE_WRITE8_MEMBER(ppi_pb_w); - DECLARE_WRITE8_MEMBER(ppi_pc_w); - TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); - DECLARE_WRITE_LINE_MEMBER(write_uart_clock); - IRQ_CALLBACK_MEMBER(irq_ack); -private: - UINT8 m_term_data; - UINT8 m_porta; - UINT8 m_portb; - UINT8 m_portc; - virtual void machine_start(); - required_device m_maincpu; - required_device m_terminal; - required_device m_ppi; - required_device m_uart; -}; - - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(votrpss_mem, AS_PROGRAM, 8, votrpss_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROM /* main roms (in potted module) */ - AM_RANGE(0x4000, 0x7fff) AM_NOP /* open bus/space for expansion rom (reads as 0xFF) */ - AM_RANGE(0x8000, 0x8fff) AM_RAM /* onboard memory (2x 6116) */ - AM_RANGE(0x9000, 0xbfff) AM_NOP /* open bus (space for memory expansion, checked by main roms, will be used if found)*/ - AM_RANGE(0xc000, 0xdfff) AM_ROM /* 'personality rom', containing self-test code and optional user code */ - AM_RANGE(0xe000, 0xffff) AM_NOP /* open bus (space for more personality rom, not normally used) */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START(votrpss_io, AS_IO, 8, votrpss_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_MIRROR(0x3c) AM_DEVREADWRITE("ppi", i8255_device, read, write) - AM_RANGE(0x40, 0x40) AM_MIRROR(0x3e) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x41, 0x41) AM_MIRROR(0x3e) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE("pit", pit8253_device, read, write) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3e) AM_DEVREADWRITE("ay", ay8910_device, data_r, address_w) - AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x3e) AM_DEVREADWRITE("ay", ay8910_device, data_r, data_w) -ADDRESS_MAP_END - - -/****************************************************************************** - Input Ports -******************************************************************************/ - -static INPUT_PORTS_START(votrpss) - PORT_START("DSW1") - PORT_DIPNAME( 0x07, 0x00, "Baud Rate" ) PORT_DIPLOCATION("SW1:1,2,3") - PORT_DIPSETTING( 0x00, "9600" ) - PORT_DIPSETTING( 0x01, "4800" ) - PORT_DIPSETTING( 0x02, "2400" ) - PORT_DIPSETTING( 0x03, "1200" ) - PORT_DIPSETTING( 0x04, "600" ) - PORT_DIPSETTING( 0x05, "300" ) - PORT_DIPSETTING( 0x06, "150" ) - PORT_DIPSETTING( 0x07, "75" ) - PORT_DIPNAME( 0x08, 0x00, "Serial Handshaking" ) PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x00, "RTS/CTS" ) - PORT_DIPSETTING( 0x08, "XON/XOFF" ) - PORT_DIPNAME( 0x10, 0x00, "Parity bit behavior" ) PORT_DIPLOCATION("SW1:5") /* note: only firmware 3.C (1984?) and up handle this bit; on earlier firmwares, its function is 'unused' */ - PORT_DIPSETTING( 0x00, "Bit 8 ignored/zeroed" ) - PORT_DIPSETTING( 0x10, "Bit 8 treated as data" ) - PORT_DIPNAME( 0x20, 0x20, "Startup Message" ) PORT_DIPLOCATION("SW1:6") - PORT_DIPSETTING( 0x00, DEF_STR ( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR ( On ) ) - PORT_DIPNAME( 0x40, 0x00, "Default Communications Port" ) PORT_DIPLOCATION("SW1:7") - PORT_DIPSETTING( 0x00, "Serial/RS-232" ) - PORT_DIPSETTING( 0x40, "Parallel" ) - PORT_DIPNAME( 0x80, 0x00, "Self Test Mode" ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x00, DEF_STR ( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR ( On ) ) -INPUT_PORTS_END - -void votrpss_state::machine_start() -{ -} - -TIMER_DEVICE_CALLBACK_MEMBER( votrpss_state::irq_timer ) -{ - m_maincpu->set_input_line(0, ASSERT_LINE); -} - -IRQ_CALLBACK_MEMBER( votrpss_state::irq_ack ) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); - return 0x38; -} - -READ8_MEMBER( votrpss_state::ppi_pa_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( votrpss_state::ppi_pb_r ) -{ - return m_portb; -} - -// Bit 0 controls what happens at interrupt time. See code around 518. -READ8_MEMBER( votrpss_state::ppi_pc_r ) -{ - UINT8 data = 0; - - if (m_term_data) - { - m_ppi->pc4_w(0); // send a strobe pulse - data |= 0x20; - } - - return (m_portc & 0xdb) | data; - //return data; -} - -WRITE8_MEMBER( votrpss_state::ppi_pa_w ) -{ - m_porta = data; -} - -WRITE8_MEMBER( votrpss_state::ppi_pb_w ) -{ - m_portb = data; - m_terminal->write(space, offset, data&0x7f); -} - -WRITE8_MEMBER( votrpss_state::ppi_pc_w ) -{ - m_portc = data; -} - -WRITE8_MEMBER( votrpss_state::kbd_put ) -{ - m_term_data = data; -} - -DECLARE_WRITE_LINE_MEMBER( votrpss_state::write_uart_clock ) -{ - m_uart->write_txc(state); - m_uart->write_rxc(state); -} - -/****************************************************************************** - Machine Drivers -******************************************************************************/ - -static MACHINE_CONFIG_START( votrpss, votrpss_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz/2) /* 4.000 MHz, verified */ - MCFG_CPU_PROGRAM_MAP(votrpss_mem) - MCFG_CPU_IO_MAP(votrpss_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(votrpss_state,irq_ack) - - /* video hardware */ - //MCFG_DEFAULT_LAYOUT(layout_votrpss) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ay", AY8910, XTAL_8MHz/4) /* 2.000 MHz, verified */ - MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1")) // port B read - MCFG_AY8910_PORT_A_WRITE_CB(DEVWRITE8("votrax", votrax_sc01_device, write)) // port A write - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720 kHz? needs verify */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* Devices */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(votrpss_state, kbd_put)) - - MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart", i8251_device, write_dsr)) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_8MHz) /* Timer 0: baud rate gen for 8251 */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(votrpss_state, write_uart_clock)) - MCFG_PIT8253_CLK1(XTAL_8MHz / 256) /* Timer 1: Pitch */ - MCFG_PIT8253_CLK2(XTAL_8MHz / 4096) /* Timer 2: Volume */ - - MCFG_DEVICE_ADD("ppi", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8(votrpss_state, ppi_pa_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(votrpss_state, ppi_pa_w)) - MCFG_I8255_IN_PORTB_CB(READ8(votrpss_state, ppi_pb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(votrpss_state, ppi_pb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(votrpss_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(votrpss_state, ppi_pc_w)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", votrpss_state, irq_timer, attotime::from_msec(10)) -MACHINE_CONFIG_END - - - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -ROM_START(votrpss) - ROM_REGION(0x10000, "maincpu", 0) - /* old logo PSS, version 3.A (1982), selftest 3.0? (1982) */ - //ROM_LOAD("u-2.3.A.bin", 0x0000, 0x2000, NO_DUMP )) /* 3.A 1982 */ - //ROM_LOAD("u-3.3.A.bin", 0x2000, 0x2000, NO_DUMP )) /* 3.A 1982 */ - //ROM_LOAD("u-4.3.0.bin", 0xc000, 0x2000, NO_DUMP )) /* 3.0? */ - - /* old logo PSS, version 3.B (late 82/early83), selftest 3.0? (1982) */ - //ROM_LOAD("u-2.3.B.bin", 0x0000, 0x2000, NO_DUMP )) /* 3.B 1983? */ - //ROM_LOAD("u-3.3.B.bin", 0x2000, 0x2000, NO_DUMP )) /* 3.B 1983? */ - //ROM_LOAD("u-4.3.0.bin", 0xc000, 0x2000, NO_DUMP )) /* 3.0? */ - - /* old or new logo PSS, Version 3.C (1984?), selftest 3.1 (1985?) */ - ROM_LOAD("u-2.1985.bin", 0x0000, 0x2000, CRC(410c58cf) SHA1(6e181e61ab9c268e3772fbeba101302fd40b09a2)) /* 3.C 1984?; The 1987/1988 version marked "U-2 // 090788" matches this rom */ - ROM_LOAD("u-3.1985.bin", 0x2000, 0x2000, CRC(1439492e) SHA1(46af8ccac6fdb93cbeb8a6d57dce5898e0e0d623)) /* 3.C 1984? */ - ROM_LOAD("u-4.100985.bin", 0xc000, 0x2000, CRC(0b7c4260) SHA1(56f0b6b1cd7b1104e09a9962583121c112337984)) /* 3.1 10/09/85 */ - -ROM_END - - - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, votrpss, 0, 0, votrpss, votrpss, driver_device, 0, "Votrax", "Personal Speech System", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/votrtnt.c b/src/mess/drivers/votrtnt.c deleted file mode 100644 index 65c1e79dddf..00000000000 --- a/src/mess/drivers/votrtnt.c +++ /dev/null @@ -1,151 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/****************************************************************************** -* -* Votrax Type 'N Talk Driver -* By Jonathan Gevaryahu AKA Lord Nightmare -* with loads of help (dumping, code disassembly, schematics, and other -* documentation) from Kevin 'kevtris' Horton -* -* The Votrax TNT was sold from some time in early 1981 until at least 1983. -* -* 2011-02-27 The TNT communicates with its host via serial (RS-232) by -* using a 6850 ACIA. It will echo whatever is sent, back to the -* host. In order that we can examine it, I have connected the -* 'terminal' so we can enter data, and see what gets sent back. -* I've also connected the 'votrax' device, but it is far from -* complete (the sounds are not understandable). -* -* ACIA status code is set to E2 for no data and E3 for data. -* -* On the CPU, A12 and A15 are not connected. A13 and A14 are used -* to select devices. A0-A9 address RAM. A0-A11 address ROM. -* A0 switches the ACIA between status/command, and data in/out. -* -* Special codes: The Type 'N Talk will take notice of certain codes. They -* are: 08, 0D, 1B, 20. I didn't investigate what the codes do. -* -* ToDo: -* - Votrax device needs considerable improvement in sound quality. -* -* -******************************************************************************/ - -/* Core includes */ -#include "bus/rs232/rs232.h" -#include "cpu/m6800/m6800.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "sound/votrax.h" -#include "votrtnt.lh" - - -class votrtnt_state : public driver_device -{ -public: - votrtnt_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_votrax(*this, "votrax"), - m_acia(*this, "acia") - { - } - - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - -private: - required_device m_maincpu; - required_device m_votrax; - required_device m_acia; -}; - - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(6802_mem, AS_PROGRAM, 8, votrtnt_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0x6fff) - AM_RANGE(0x0000, 0x03ff) AM_RAM AM_MIRROR(0xc00)/* RAM, 2114*2 (0x400 bytes) mirrored 4x */ - AM_RANGE(0x2000, 0x2000) AM_MIRROR(0xffe) AM_DEVREADWRITE("acia", acia6850_device, status_r, control_w) - AM_RANGE(0x2001, 0x2001) AM_MIRROR(0xffe) AM_DEVREADWRITE("acia", acia6850_device, data_r, data_w) - AM_RANGE(0x4000, 0x5fff) AM_DEVWRITE("votrax", votrax_sc01_device, write) /* low 6 bits write to 6 bit input of sc-01-a; high 2 bits are ignored (but by adding a buffer chip could be made to control the inflection bits of the sc-01-a which are normally grounded on the tnt) */ - AM_RANGE(0x6000, 0x6fff) AM_ROM /* ROM in potted block */ -ADDRESS_MAP_END - - -/****************************************************************************** - Input Ports -******************************************************************************/ - -static INPUT_PORTS_START(votrtnt) - PORT_START("DSW1") /* not connected to cpu, each switch is connected directly to the output of a 4040 counter dividing the cpu m1? clock to feed the 6850 ACIA. Setting more than one switch on is a bad idea. see tnt_schematic.jpg */ - PORT_DIPNAME( 0xFF, 0x80, "Baud Rate" ) PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8") - PORT_DIPSETTING( 0x01, "75" ) - PORT_DIPSETTING( 0x02, "150" ) - PORT_DIPSETTING( 0x04, "300" ) - PORT_DIPSETTING( 0x08, "600" ) - PORT_DIPSETTING( 0x10, "1200" ) - PORT_DIPSETTING( 0x20, "2400" ) - PORT_DIPSETTING( 0x40, "4800" ) - PORT_DIPSETTING( 0x80, "9600" ) -INPUT_PORTS_END - - -WRITE_LINE_MEMBER(votrtnt_state::write_acia_clock) -{ - m_acia->write_txc(state); - m_acia->write_rxc(state); -} - - -/****************************************************************************** - Machine Drivers -******************************************************************************/ - -static MACHINE_CONFIG_START( votrtnt, votrtnt_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6802, XTAL_2_4576MHz) /* 2.4576MHz XTAL, verified; divided by 4 inside the m6802*/ - MCFG_CPU_PROGRAM_MAP(6802_mem) - - /* video hardware */ - //MCFG_DEFAULT_LAYOUT(layout_votrtnt) - - /* serial hardware */ - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("acia", acia6850_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("acia", acia6850_device, write_cts)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(votrtnt_state, write_acia_clock)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720kHz? needs verify */ - MCFG_VOTRAX_SC01_REQUEST_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -ROM_START(votrtnt) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("cn49752n.bin", 0x6000, 0x1000, CRC(a44e1af3) SHA1(af83b9e84f44c126b24ee754a22e34ca992a8d3d)) /* 2332 mask rom inside potted brick */ -ROM_END - - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, votrtnt, 0, 0, votrtnt, votrtnt, driver_device, 0, "Votrax", "Type 'N Talk", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/vt100.c b/src/mess/drivers/vt100.c deleted file mode 100644 index 561de2441e0..00000000000 --- a/src/mess/drivers/vt100.c +++ /dev/null @@ -1,862 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu -/*************************************************************************** - - DEC VT100 driver by Miodrag Milanovic - - 29/04/2009 Preliminary driver. - - TODO: keyboard doesn't work properly, kb uart comms issue? - TODO: split keyboard off as a synchronous serial device? - TODO: vt100 gives a '2' error on startup indicating bad nvram checksum - adding the serial nvram support should fix this - TODO: support for the on-AVO character set roms - TODO: finish support for the on-cpu board alternate character set rom - - An enormous amount of useful info can be derived from the VT125 technical manual: - http://www.bitsavers.org/pdf/dec/terminal/vt100/EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf starting on page 6-70, pdf page 316 - And its schematics: - http://bitsavers.org/pdf/dec/terminal/vt125/MP01053_VT125_Mar82.pdf -****************************************************************************/ - -#include "bus/rs232/rs232.h" -#include "cpu/i8085/i8085.h" -#include "cpu/z80/z80.h" -#include "machine/com8116.h" -#include "machine/i8251.h" -#include "sound/beep.h" -#include "video/vtvideo.h" -#include "vt100.lh" - -#define RS232_TAG "rs232" -#define COM5016T_TAG "com5016t" - -class vt100_state : public driver_device -{ -public: - vt100_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "vt100_video"), - m_speaker(*this, "beeper"), - m_uart(*this, "i8251"), - m_dbrg(*this, COM5016T_TAG), - m_p_ram(*this, "p_ram") - { - } - - required_device m_maincpu; - required_device m_crtc; - required_device m_speaker; - required_device m_uart; - required_device m_dbrg; - DECLARE_READ8_MEMBER(vt100_flags_r); - DECLARE_WRITE8_MEMBER(vt100_keyboard_w); - DECLARE_READ8_MEMBER(vt100_keyboard_r); - DECLARE_WRITE8_MEMBER(vt100_baud_rate_w); - DECLARE_WRITE8_MEMBER(vt100_nvr_latch_w); - DECLARE_READ8_MEMBER(vt100_read_video_ram_r); - DECLARE_WRITE_LINE_MEMBER(vt100_clear_video_interrupt); - required_shared_ptr m_p_ram; - bool m_keyboard_int; - bool m_receiver_int; - bool m_vertical_int; - bool m_key_scan; - UINT8 m_key_code; - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update_vt100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vt100_vertical_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback); - IRQ_CALLBACK_MEMBER(vt100_irq_callback); - UINT8 bit_sel(UINT8 data); -}; - - - - -static ADDRESS_MAP_START(vt100_mem, AS_PROGRAM, 8, vt100_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x1fff ) AM_ROM // ROM ( 4 * 2K) - AM_RANGE( 0x2000, 0x2bff ) AM_RAM AM_SHARE("p_ram") // Screen and scratch RAM - AM_RANGE( 0x2c00, 0x2fff ) AM_RAM // AVO Screen RAM - AM_RANGE( 0x3000, 0x3fff ) AM_RAM // AVO Attribute RAM (4 bits wide) - // 0x4000, 0x7fff is unassigned - AM_RANGE( 0x8000, 0x9fff ) AM_ROM // Program memory expansion ROM (4 * 2K) - AM_RANGE( 0xa000, 0xbfff ) AM_ROM // Program memory expansion ROM (1 * 8K) - // 0xc000, 0xffff is unassigned -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vt180_mem, AS_PROGRAM, 8, vt100_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x1fff ) AM_ROM - AM_RANGE( 0x2000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vt180_io, AS_IO, 8, vt100_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -ADDRESS_MAP_END - -// 0 - XMIT flag H -// 1 - Advance Video L -// 2 - Graphics Flag L -// 3 - Option present H -// 4 - Even field L -// 5 - NVR data H -// 6 - LBA 7 H -// 7 - Keyboard TBMT H -READ8_MEMBER( vt100_state::vt100_flags_r ) -{ - UINT8 ret = 0; - ret |= m_crtc->lba7_r(space, 0) << 6; - ret |= m_keyboard_int << 7; - return ret; -} - -UINT8 vt100_state::bit_sel(UINT8 data) -{ - if (!BIT(data,7)) return 0x70; - if (!BIT(data,6)) return 0x60; - if (!BIT(data,5)) return 0x50; - if (!BIT(data,4)) return 0x40; - if (!BIT(data,3)) return 0x30; - if (!BIT(data,2)) return 0x20; - if (!BIT(data,1)) return 0x10; - if (!BIT(data,0)) return 0x00; - return 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(vt100_state::keyboard_callback) -{ - UINT8 i, code; - char kbdrow[8]; - if (m_key_scan) - { - for(i = 0; i < 16; i++) - { - sprintf(kbdrow,"LINE%X", i); - code = ioport(kbdrow)->read(); - if (code < 0xff) - { - m_keyboard_int = 1; - m_key_code = i | bit_sel(code); - m_maincpu->set_input_line(0, HOLD_LINE); - break; - } - } - } -} - - -WRITE8_MEMBER( vt100_state::vt100_keyboard_w ) -{ - m_speaker->set_frequency(786); // 7.945us per serial clock = ~125865.324hz, / 160 clocks per char = ~ 786 hz - output_set_value("online_led",BIT(data, 5) ? 0 : 1); - output_set_value("local_led", BIT(data, 5)); - output_set_value("locked_led",BIT(data, 4) ? 0 : 1); - output_set_value("l1_led", BIT(data, 3) ? 0 : 1); - output_set_value("l2_led", BIT(data, 2) ? 0 : 1); - output_set_value("l3_led", BIT(data, 1) ? 0 : 1); - output_set_value("l4_led", BIT(data, 0) ? 0 : 1); - m_key_scan = BIT(data, 6); - m_speaker->set_state(BIT(data, 7)); -} - -READ8_MEMBER( vt100_state::vt100_keyboard_r ) -{ - return m_key_code; -} - -WRITE8_MEMBER( vt100_state::vt100_baud_rate_w ) -{ - m_dbrg->str_w(data & 0x0f); - m_dbrg->stt_w(data >> 4); -} - -WRITE8_MEMBER( vt100_state::vt100_nvr_latch_w ) -{ -} - -static ADDRESS_MAP_START(vt100_io, AS_IO, 8, vt100_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - // 0x00, 0x01 PUSART (Intel 8251) - AM_RANGE (0x00, 0x00) AM_DEVREADWRITE("i8251", i8251_device, data_r, data_w) - AM_RANGE (0x01, 0x01) AM_DEVREADWRITE("i8251", i8251_device, status_r, control_w) - // 0x02 Baud rate generator - AM_RANGE (0x02, 0x02) AM_WRITE(vt100_baud_rate_w) - // 0x22 Modem buffer - // AM_RANGE (0x22, 0x22) - // 0x42 Flags buffer - AM_RANGE (0x42, 0x42) AM_READ(vt100_flags_r) - // 0x42 Brightness D/A latch - AM_RANGE (0x42, 0x42) AM_DEVWRITE("vt100_video", vt100_video_device, brightness_w) - // 0x62 NVR latch - AM_RANGE (0x62, 0x62) AM_WRITE(vt100_nvr_latch_w) - // 0x82 Keyboard UART data output - AM_RANGE (0x82, 0x82) AM_READ(vt100_keyboard_r) - // 0x82 Keyboard UART data input - AM_RANGE (0x82, 0x82) AM_WRITE(vt100_keyboard_w) - // 0xA2 Video processor DC012 - AM_RANGE (0xa2, 0xa2) AM_DEVWRITE("vt100_video", vt100_video_device, dc012_w) - // 0xC2 Video processor DC011 - AM_RANGE (0xc2, 0xc2) AM_DEVWRITE("vt100_video", vt100_video_device, dc011_w) - // 0xE2 Graphics port - // AM_RANGE (0xe2, 0xe2) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vt100 ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 9") PORT_CODE(KEYCODE_9_PAD) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num Return") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line feed") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_START("LINE6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_START("LINE8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_START("LINE9") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_START("LINEA") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("No scroll") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_START("LINEB") - PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Setup") PORT_CODE(KEYCODE_F5) - PORT_START("LINEC") - PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_START("LINED") - PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_START("LINEE") - PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_START("LINEF") - PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) // Always return 0x7f on last scan line -INPUT_PORTS_END - -UINT32 vt100_state::screen_update_vt100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_crtc->video_update(bitmap, cliprect); - return 0; -} - - -//Interrupts -// in latch A3 - keyboard -// A4 - receiver -// A5 - vertical fequency -// all other set to 1 -IRQ_CALLBACK_MEMBER(vt100_state::vt100_irq_callback) -{ - UINT8 ret = 0xc7 | (m_keyboard_int << 3) | (m_receiver_int << 4) | (m_vertical_int << 5); - m_receiver_int = 0; - return ret; -} - -void vt100_state::machine_start() -{ -} - -void vt100_state::machine_reset() -{ - m_keyboard_int = 0; - m_receiver_int = 0; - m_vertical_int = 0; - m_speaker->set_frequency(786); // 7.945us per serial clock = ~125865.324hz, / 160 clocks per char = ~ 786 hz - output_set_value("online_led",1); - output_set_value("local_led", 0); - output_set_value("locked_led",1); - output_set_value("l1_led", 1); - output_set_value("l2_led", 1); - output_set_value("l3_led", 1); - output_set_value("l4_led", 1); - - m_key_scan = 0; -} - -READ8_MEMBER( vt100_state::vt100_read_video_ram_r ) -{ - return m_p_ram[offset]; -} - -WRITE_LINE_MEMBER( vt100_state::vt100_clear_video_interrupt ) -{ - m_vertical_int = 0; -} - -INTERRUPT_GEN_MEMBER(vt100_state::vt100_vertical_interrupt) -{ - m_vertical_int = 1; - device.execute().set_input_line(0, HOLD_LINE); -} - -/* F4 Character Displayer */ -static const gfx_layout vt100_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 256, /* 2 x 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( vt100 ) - GFXDECODE_ENTRY( "chargen", 0x0000, vt100_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( vt100, vt100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_24_8832MHz / 9) - MCFG_CPU_PROGRAM_MAP(vt100_mem) - MCFG_CPU_IO_MAP(vt100_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vt100_state, vt100_vertical_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vt100_state,vt100_irq_callback) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(80*10, 25*10) - MCFG_SCREEN_VISIBLE_AREA(0, 80*10-1, 0, 25*10-1) - MCFG_SCREEN_UPDATE_DRIVER(vt100_state, screen_update_vt100) - MCFG_SCREEN_PALETTE("vt100_video:palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "vt100_video:palette", vt100) -// MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_DEFAULT_LAYOUT( layout_vt100 ) - - MCFG_DEVICE_ADD("vt100_video", VT100_VIDEO, 0) - MCFG_VT_SET_SCREEN("screen") - MCFG_VT_CHARGEN("chargen") - MCFG_VT_VIDEO_RAM_CALLBACK(READ8(vt100_state, vt100_read_video_ram_r)) - MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(vt100_state, vt100_clear_video_interrupt)) - - MCFG_DEVICE_ADD("i8251", I8251, 0) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_dsr)) - - MCFG_DEVICE_ADD(COM5016T_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(DEVWRITELINE("i8251", i8251_device, write_txc)) - - /* audio hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", vt100_state, keyboard_callback, attotime::from_hz(800)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( vt180, vt100 ) - MCFG_CPU_ADD("z80cpu", Z80, XTAL_24_8832MHz / 9) - MCFG_CPU_PROGRAM_MAP(vt180_mem) - MCFG_CPU_IO_MAP(vt180_io) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( vt102, vt100 ) - MCFG_CPU_REPLACE("maincpu",I8085A, XTAL_24_8832MHz / 9) - MCFG_CPU_PROGRAM_MAP(vt100_mem) - MCFG_CPU_IO_MAP(vt100_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vt100_state, vt100_vertical_interrupt) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vt100_state,vt100_irq_callback) -MACHINE_CONFIG_END - -/* VT1xx models: - * VT100 - 1978 base model. the 'later' rom is from 1979 or 1980. - * The vt100 had a whole series of -XX models branching off of it; the - ones I know of are described here, as well as anything special about - them: - * VT100-AA - standard model with 120vac cable \__voltage can be switched - * VT100-AB - standard model with 240vac cable / inside any VT100 unit - * VT100-W* - word processing series: - * VT100-WA/WB - has special LA120 AVO board preinstalled, WP romset?, - English WP keyboard, no alt charset rom, LA120? 23-069E2 AVO rom. - (The WA and WB variants are called the '-02' variant on the schematics) - * VT100-WC through WZ: foreign language word processing series: - (The WC through WK variants are called the '-03' variant on the schematics) - * VT100-WC/WD - has AVO board preinstalled, WP romset?, French Canadian - WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. - * VT100-WE/WF - has AVO board preinstalled, WP romset?, French - WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. - * VT100-WG/WH - has AVO board preinstalled, WP romset?, Dutch - WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. - * VT100-WJ/WK - has AVO board preinstalled, WP romset?, German - WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. - * VT100-WY/WZ - has AVO board preinstalled, WP romset?, English - WP keyboard, has 23-094E2 alt charset rom, 23-093E2 AVO rom. - The WP romset supports English, French, Dutch and German languages but - will only display text properly in the non-English languages if the - 23-094E2 alt charset rom AND the foreign language 23-093E2 - AVO rom are populated. - * VT100-NA/NB - ? romset with DECFORM keycaps - * VT100 with vt1xx-ac kit - adds serial printer interface (STP) - pcb, replaces roms with the 095e2/096e2/139e2/140e2 STP set - * VT101 - 1981 cost reduced unexpandable vt100; Is the same as a stock - unexpanded vt100. It has no AVO nor the upgrade connector for it, and no - video input port.) Has its own firmware. - Shares same pcb with vt102 and vt131, but STP/AVO are unpopulated; - * VT102 - 1981 cost reduced unexpandable vt100 with built in AVO and STP - Is the same as a stock vt100 with the AVO and STP expansions installed, - but all on one pcb. Does NOT support the AVO extended character roms, nor - the word processing rom set. Has its own firmware. - Shares same pcb with vt101 and vt131, has STP and AVO populated. - * VT103 - 1980 base model vt100 with an integrated TU58 tape drive, and an - LSI-11 backplane, which an LSI-11 cpu card is used in, hence the computer - is effectively a tiny lsi-11 (pdp-11) built in a vt100 case. uses same roms - as vt100 for the vt100 portion, and tu58 has its own cpu and rom. It can - have the normal vt100 romset variant, and also can have the multiple word - processing variations (which use the same roms as the vt100 ones do). - * VT104 doesn't exist. - * VT105 - 1978 vt100 with the WG waveform generator board installed - (for simple chart-type line-compare-made raster graphics using some built - in functions), AVO optional; was intended for use on the MINC analog data - acquisition computer. - * VT110 - 1978 vt100 with a DPM01 DECDataway serial multiplexer installed - The DPM01 supposedly has its own processor and roms. - * vt125 - 1982? base model (stock vt100 firmware plus extra gfx board - firmware and processor) vt100 with the ReGIS graphical language board - (aka GPO) installed (almost literally a vk100-on-a-board, but with added - backwards compatibility mode for vt105/WG, and 2 bits per pixel color), - AVO optional; Includes a custom 'dumb' STP board. - * vt131 - 1982 cost reduced version of vt132, no longer has the vt100 - expansion backplane; has the AVO advanced video board built in, as well - as the parallel port interface board, and supports serial block mode. - Shares same pcb with vt101 and vt102, has STP and AVO populated. - * vt132 - 1980? base vt100 with AVO, STP, and its own 23-099e2/23-100e2 - AVO character rom set. Has its own base firmware roms which support block - serial mode. - * vt180 - 1980 vt10x (w/vt100 expansion backplane) with a z80 daughterboard - installed; - The daughterboard has two roms on it: 23-017e3-00 and 23-021e3-00 - (both are 0x1000 long, 2332 mask roms) - * vk100 'gigi'- graphical terminal; the vt125 GPO board is a very close derivative; - relatively little info so far but progress has been made. - see vk100.c for current driver for this - - * Upgrade kits for vt1xx: - * VT1xx-AA : p/n 5413206 20ma current loop interface pcb for vt100 - * VT1xx-AB : p/n 5413097 AVO board (AVO roms could be optionally ordered along with - this board if needed) - * VT1xx-AC : STP serial printer board (includes a special romset) - * VT1xx-CA : p/n 5413206? 20ma current loop interface pcb for vt101/vt102/vt131 - * VT1xx-CB or CL: GPO "ReGIS" board vt100->vt125 upgrade kit (p/n 5414275 paddle board and 5414277 gpo board) - * VT1xx-CE : DECWord Conversion kit - * VT1xx-FB : Anti-glare kit - - * Info about mask roms and other nasties: - * A normal 2716 rom has pin 18: /CE; pin 20: /OE; pin 21: VPP (acts as CE2) - * The vt100 23-031e2/23-061e2, 23-032e2, 23-033e2, and 23-034e2 mask roms - have the follwing enables: - 23-031e2/23-061e2: pin 18: CS2; pin 20: CS1; pin 21: CS3 - 23-032e2: pin 18: /CS2; pin 20: CS1; pin 21: CS3 - 23-033e2: pin 18: CS2; pin 20: CS1; pin 21: /CS3 - 23-034e2: pin 18: /CS2; pin 20: CS1; pin 21: /CS3 - (This is cute because it technically means the roms can be put in the - 4 sockets in ANY ORDER and will still work properly since the cs2 and - cs3 pins make them self-decode and activate at their proper address) - (This same cute trick is almost certainly also done with the - 23-180e2, 181e2, 182e2 183e2 romset, as well as the - 23-095e2,096e2,139e2,140e2 set and probably others as well) - * The vt100/101/102/103/etc 23-018e2-00 character set rom at location e4 is a 24 pin 2316 mask rom with enables as such: pin 18: CS2; pin 20: /CS1; pin 21: /CS3 - * The optional 23-094e2-00 alternate character set rom at location e9 is a 24 pin 2316 mask rom with enables as such: pin 18: /CS2; pin 20: /CS1; pin 21: /CS3 - Supposedly the 23-094e2 rom is meant for vt100-WC or -WF systems, (which are French Canadian and French respectively), implying that it has European language specific accented characters on it. It is probably used in all the -W* systems. - Pin 21 can be jumpered to +5v for this socket at location e9 by removing jumper w4 and inserting jumper w5, allowing a normal 2716 eprom to be used. - * The optional AVO character set roms (see below) have: pin 18: /CS2*; pin 20: /CS1; pin 21: CS3 hence they match a normal 2716 - *(this is marked on the image as if it was CS2 but the input is tied to gnd meaning it must be /CS2) - - * The AVO itself can hold up to four roms on it (see http://www.bitsavers.org/pdf/dec/terminal/vt100/MP00633_VT100_Mar80.pdf - and http://vt100.net/dec/ek-vt1ac-ug-002.pdf ) - and these roms can depending on jumpers be mapped at 0x8000, OR overlay the main code roms at 0x0000-0x1fff! - They may even allow banking between the main code roms and the overlay roms, I haven't traced the schematic. - At least sixteen of these AVO roms were made, and are used as such: - (based on EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf) - * No roms - normal vt100 system with AVO installed - * 23-069E2 (location e21) - meant for vt100-wa and -wb 'LA120' 'word processing' systems (the mapping of the rom for this system is different than for the ones below) - * 23-099E2 (location e21) and 23-100E2 (location e17) - meant for vt132 but only with the OLD vt132 main romset of 095,096,097,098E2 - * 23-093E2 (location e21) - meant for vt100 wc through wz 'foreign language' word processing systems - * 23-184E2 and 23-185E2 - meant for vt100 with STP printer option board installed, version 1, comes with vt1xx-ac kit - * 23-186E2 and 23-187E2 - meant for vt100 with STP printer option board installed, version 2, comes with vt1xx-ac kit - * 23-224E2, 23-225E2, 23-226E2, 23-227E2 - meant for vt132 but only with the NEW vt132 main romset of 180,181,182,183E2 - * 23-236E2, 23-237E2, 23-238E2, 23-239E2 - meant for vt132 but only with the NEW vt132 main romset of 180,181,182,183E2, unknown difference to above (PROM VS MASK ROM? same contents?) - */ - -/* ROM definition */ -ROM_START( vt100 ) // This is from the schematics at http://www.bitsavers.org/pdf/dec/terminal/vt100/MP00633_VT100_Mar80.pdf -// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated -// This romset is also used for the vt103, vt105, vt110, vt125, and vt180 - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS( "vt100" ) - ROM_SYSTEM_BIOS( 0, "vt100o", "VT100 older roms" ) - ROMX_LOAD( "23-031e2-00.e56", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(1)) // version 1 1978 'earlier rom', dump needed, correct for earlier vt100s - ROM_SYSTEM_BIOS( 1, "vt100", "VT100 newer roms" ) - ROMX_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15), ROM_BIOS(2)) // version 2 1979 or 1980 'later rom', correct for later vt100s - ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) - ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) - ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL("23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional ?word processing? alternate character set rom -ROM_END - -#if 0 -ROM_START( vt100wp ) // This is from the schematics at http://www.bitsavers.org/pdf/dec/terminal/vt100/MP00633_VT100_Mar80.pdf -// This is the standard vt100 cpu board, with the ?word processing? romset, included in the VT1xx-CE kit? -// the vt103 can also use this rom set (-04 and -05 revs have it by default, -05 rev also has the optional alt charset rom by default) -// NOTE: this is actually the same as the newer VT132 romset; vt132 has different AVO roms as well. - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-180e2-00.e56", 0x0000, 0x0800, NO_DUMP) - ROM_LOAD( "23-181e2-00.e52", 0x0800, 0x0800, NO_DUMP) - ROM_LOAD( "23-182e2-00.e45", 0x1000, 0x0800, NO_DUMP) - ROM_LOAD( "23-183e2-00.e40", 0x1800, 0x0800, NO_DUMP) - - ROM_REGION(0x1000, "avo", 0) - ROM_LOAD( "23-184e2-00.bin", 0x0000, 0x0800, NO_DUMP) - ROM_LOAD( "23-185e2-00.bin", 0x0800, 0x0800, NO_DUMP) - ROM_LOAD( "23-186e2-00.bin", 0x1000, 0x0800, NO_DUMP) - ROM_LOAD( "23-187e2-00.bin", 0x1800, 0x0800, NO_DUMP) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // REQUIRED foreign language alternate character set rom -ROM_END - -ROM_START( vt132 ) // This is from anecdotal evidence and vt100.net, as the vt132 schematics are not scanned -// but is pretty much confirmed by page 433 in http://bitsavers.trailing-edge.com/www.computer.museum.uq.edu.au/pdf/EK-VT100-TM-003%20VT100%20Series%20Video%20Terminal%20Technical%20Manual.pdf -// VT100 board with block serial roms, AVO with special roms, STP, custom firmware with block serial mode - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - // OLDER vt132 romset - ROM_LOAD( "23-095e2-00.e56", 0x0000, 0x0800, NO_DUMP) - ROM_LOAD( "23-096e2-00.e52", 0x0800, 0x0800, NO_DUMP) - ROM_LOAD( "23-097e2-00.e45", 0x1000, 0x0800, NO_DUMP) - ROM_LOAD( "23-098e2-00.e40", 0x1800, 0x0800, NO_DUMP) - - // NEWER vt132 (and STP?) romset - ROM_LOAD( "23-180e2-00.e56", 0x0000, 0x0800, NO_DUMP) - ROM_LOAD( "23-181e2-00.e52", 0x0800, 0x0800, NO_DUMP) - ROM_LOAD( "23-182e2-00.e45", 0x1000, 0x0800, NO_DUMP) - ROM_LOAD( "23-183e2-00.e40", 0x1800, 0x0800, NO_DUMP) - - // AVO roms for OLDER romset only - ROM_REGION(0x1000, "avo", 0) - ROM_LOAD( "23-099e2-00.e21", 0x0000, 0x0800, NO_DUMP) - ROM_LOAD( "23-100e2-00.e17", 0x0800, 0x0800, NO_DUMP) - // other 2 sockets are empty - - // AVO roms for NEWER romset only - ROM_LOAD( "23-224e2-00.e21", 0x0000, 0x0800, NO_DUMP) - ROM_LOAD( "23-225e2-00.e17", 0x0800, 0x0800, NO_DUMP) - ROM_LOAD( "23-226e2-00.e15", 0x1000, 0x0800, NO_DUMP) // loc is a guess - ROM_LOAD( "23-227e2-00.e13", 0x1800, 0x0800, NO_DUMP) // loc is a guess - // alt rev of newer avo roms, tech manual implies above are PROMS below are MASK ROMS? same data? - ROM_LOAD( "23-236e2-00.e21", 0x0000, 0x0800, NO_DUMP) - ROM_LOAD( "23-237e2-00.e17", 0x0800, 0x0800, NO_DUMP) - ROM_LOAD( "23-238e2-00.e15", 0x1000, 0x0800, NO_DUMP) // loc is a guess - ROM_LOAD( "23-239e2-00.e13", 0x1800, 0x0800, NO_DUMP) // loc is a guess - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom -ROM_END - -ROM_START( vt100stp ) // This is from the VT180 technical manual at http://www.bitsavers.org/pdf/dec/terminal/vt180/EK-VT18X-TM-001_VT180_Technical_Man_Feb83.pdf -// This is the standard vt100 cpu board, but with the rom set included with the VT1xx-AC kit -// which is only used when the part 54-14260-00 STP 'printer port expansion' card is installed into the terminal board. -// Or as http://bitsavers.trailing-edge.com/www.computer.museum.uq.edu.au/pdf/EK-VT100-TM-003%20VT100%20Series%20Video%20Terminal%20Technical%20Manual.pdf -// on page 433: VT100 WC or WK uses these as well. -// This romset adds the Set-up C page to the setup menu (press keypad 5 twice once you hit set-up) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-095e2-00.e56", 0x0000, 0x0800, NO_DUMP) - ROM_LOAD( "23-096e2-00.e52", 0x0800, 0x0800, NO_DUMP) - ROM_LOAD( "23-139e2-00.e45", 0x1000, 0x0800, NO_DUMP) // revision 2?; revision 1 is 23-097e2 - ROM_LOAD( "23-140e2-00.e40", 0x1800, 0x0800, NO_DUMP) // revision 2?; revision 1 is 23-098e2 - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional ?word processing? alternate character set rom - ROM_REGION(0x10000, "stpcpu",ROMREGION_ERASEFF) -// expansion board for a vt100 with a processor on it and dma, intended to act as a ram/send buffer for the STP printer board. -// It can be populated with two banks of two eproms each, each bank either contains 2k or 4k eproms depending on the w2/w3 and w4/w5 jumpers. -// It also has two proms on the cpu board. I don't know if it is technically necessary to have this board installed if an STP module is installed, but due to the alt stp romset, it probably is. - ROM_LOAD( "23-003e3-00.e10", 0x0000, 0x1000, NO_DUMP) // "EPROM 0" bank 0 - ROM_LOAD( "23-004e3-00.e4", 0x1000, 0x1000, NO_DUMP) // "EPROM 1" bank 0 - ROM_LOAD( "23-005e3-00.e9", 0x2000, 0x1000, NO_DUMP) // "EPROM 2" bank 1 - ROM_LOAD( "23-006e3-00.e3", 0x3000, 0x1000, NO_DUMP) // "EPROM 3" bank 1 - //ROM_REGION(0x0800, "avo",0) - //ROM_LOAD( "23-???e2-00.e34", 0x0000, 0x0800, NO_DUMP) // ? second gfx rom? - ROM_REGION(0x0400, "proms",0) - ROM_LOAD( "23-312a1-07.e26", 0x0000, 0x0200, NO_DUMP) // "PROM A"; handles 8085 i/o? mapping (usart, timer, dma, comm, etc) - ROM_LOAD( "23-313a1-07.e15", 0x0200, 0x0200, NO_DUMP) // "PROM B"; handles firmware rom mapping and memory size/page select; bit 0 = ram page, bits 1-3 unused, bits 4-7 select one eprom each -ROM_END - -ROM_START( vt103 ) // This is from the schematics at http://www.bitsavers.org/pdf/dec/terminal/vt103/MP00731_VT103_Aug80.pdf -// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with an -// LSI-11 backplane (instead of a normal VT100 one, hence it cannot use the AVO, WG, GPO, or VT180 Z80 boards) and -// DEC TU58 dual 256k tape drive integrated; It was intended that you would put an LSI-11 cpu card in there, which -// Would talk to the terminal as its input/output device. Several LSI-11 cpu cards were available? - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' - ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) - ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) - ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom - - ROM_REGION(0x0800, "tapecpu", 0) // rom for the 8085 cpu in the integrated serial tu58-xa drive - ROM_LOAD( "23-089e2.e1", 0x0000, 0x0800, CRC(8614dd4c) SHA1(1b554e6c98bddfc6bc48d81c990deea43cf9df7f)) // Label: "23-089E2 // P8316E - AMD // 35227 8008NPP" - - ROM_REGION(0x80000, "lsi11cpu", 0) // rom for the LSI-11 cpu board - ROM_LOAD_OPTIONAL( "unknown.bin", 0x00000, 0x80000, NO_DUMP) -ROM_END -#endif - -ROM_START( vt105 ) // This is from anecdotal evidence and vt100.net, as the vt105 schematics are not scanned -// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a -// WG waveform generator board factory installed; this makes the terminal act like a vt55 with vt100 terminal capability -// The VT105 was intended for use on the MINC analog data acquisition computer - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' - ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) - ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) - ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom -ROM_END - -#if 0 -ROM_START( vt110 ) -// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a -// DECDataway DPM01 board, which adds 4 or 5 special network-addressable 50ohm? current loop serial lines -// and may add its own processor and ram to control them. see http://bitsavers.org/pdf/dec/terminal/EK-VT110_UG-001_Dec78.pdf - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' - ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) - ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) - ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL ( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom -//DECDataway board roms go here! -ROM_END - -ROM_START( vt125 ) // This is from bitsavers and vt100.net, as the vt125 schematics are not scanned -// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a -// special "GPO" ReGIS cpu+ram card 54-14277 installed which provides a framebuffer, text rotation, custom ram fonts, and many other features. -// Comes with a custom 'dumb' STP card 54-14275 as well. -// VT125 upgrade kit (upgrade from vt100 or vt105) was called VT1xx-CB or CL - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' - ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) - ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) - ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL ( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom - - // "GPO" aka vt125 "mono board" roms and proms - ROM_REGION(0x10000, "monocpu", ROMREGION_ERASEFF) // roms for the 8085 subcpu - ROM_LOAD( "23-043e4-00.e22", 0x0000, 0x2000, NO_DUMP) // 2364/MK36xxx mask rom - ROM_LOAD( "23-044e4-00.e23", 0x2000, 0x2000, NO_DUMP) // 2364/MK36xxx mask rom - ROM_LOAD( "23-045e4-00.e24", 0x4000, 0x2000, NO_DUMP) // 2364/MK36xxx mask rom - // E25 socket is empty - - ROM_REGION(0x100, "dir", ROMREGION_ERASEFF ) // vt125 direction prom, same as on vk100, 82s135 equiv - ROM_LOAD( "23-059b1.e41", 0x0000, 0x0100, CRC(4b63857a) SHA1(3217247d983521f0b0499b5c4ef6b5de9844c465)) - - ROM_REGION(0x100, "trans", ROMREGION_ERASEFF ) // vt125 x translate prom, same as on vk100, 82s135 equiv - ROM_LOAD( "23-060b1.e60", 0x0000, 0x0100, CRC(198317fc) SHA1(00e97104952b3fbe03a4f18d800d608b837d10ae)) - - ROM_REGION(0x500, "proms", ROMREGION_ERASEFF) // vt125 mono board proms - ROM_LOAD( "23-067b1.e135", 0x0000, 0x0100, NO_DUMP) // 82s135, waitstate prom - ROM_LOAD( "23-068b1.e64", 0x0100, 0x0100, NO_DUMP) // 82s135, sync_a prom - ROM_LOAD( "23-069b1.e66", 0x0200, 0x0100, NO_DUMP) // 82s135, sync_b prom - ROM_LOAD( "23-070b1.e71", 0x0300, 0x0100, NO_DUMP) // 82s135, vector prom - ROM_LOAD( "23-582a2.e93", 0x0400, 0x0100, NO_DUMP) // 82s129, ras/erase prom -ROM_END -#endif - -ROM_START( vt101 ) // p/n 5414185-01 'unupgradable/low cost' vt101/vt102/vt131 mainboard -// does not have integrated STP or AVO populated -// 8085 based instead of I8080 - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-028e4-00.e71", 0x0000, 0x2000, CRC(fccce02c) SHA1(f3e3e93a857443685b816cab4fb52e34c0bc72b1)) // rom is unique to vt101; "CN55004N 8232 // DEC TP03 // 23-028E4-00" 24-pin mask rom (mc68764 pinout) - //e69 socket is empty/unpopulated on vt101? - //e67 socket is empty/unpopulated on vt101? - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e3", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL( "23-094e2-00.e4", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom -ROM_END - - -ROM_START( vt102 ) // p/n 5414185-01 'unupgradable/low cost' vt101/vt102/vt131 mainboard -// has integrated STP and AVO both populated -// ROMS have the set up page C in them -// 8085 based instead of I8080 - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS( "vt102" ) - ROM_SYSTEM_BIOS( 0, "vt102o", "VT102 older roms" ) - ROMX_LOAD( "23-042e4-00.e71", 0x0000, 0x2000, CRC(e8aa006c) SHA1(8ac2a84a8d2a9fa0c6cd583ae35e4c21f863b45b), ROM_BIOS(1)) // shared with vt131 - ROMX_LOAD( "23-041e4-00.e69", 0x8000, 0x2000, CRC(b11d331e) SHA1(8b0f885c7e032d1d709e3913d279d6950bbd4b6a), ROM_BIOS(1)) // shared with vt131 - ROM_SYSTEM_BIOS( 1, "vt102", "VT102 newer roms" ) - ROMX_LOAD( "23-226e4-00.e71", 0x0000, 0x2000, CRC(85c9279a) SHA1(3283d27e9c45d9e384227a7e6e98ee8d54b92bcb), ROM_BIOS(2)) // shared with vt131 - ROMX_LOAD( "23-225e4-00.e69", 0x8000, 0x2000, CRC(3567c760) SHA1(672473162e9c92cd237e4dbf92c2700a31c5374b), ROM_BIOS(2)) // shared with vt131 - //e67 socket is empty but populated on vt102 - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e3", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL( "23-094e2-00.e4", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom -ROM_END - -ROM_START( vt131 ) // p/n 5414185-01 'unupgradable/low cost' vt101/vt131 mainboard with vt132-style block serial mode -// has integrated STP and AVO both populated -// ROMS have the set up page C in them -// 8085 based instead of I8080 - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-226e4-00.e71", 0x0000, 0x2000, CRC(85c9279a) SHA1(3283d27e9c45d9e384227a7e6e98ee8d54b92bcb)) // shared with vt102 - ROM_LOAD( "23-225e4-00.e69", 0x8000, 0x2000, CRC(3567c760) SHA1(672473162e9c92cd237e4dbf92c2700a31c5374b)) // shared with vt102 - ROM_LOAD( "23-280e2-00.e67", 0xA000, 0x0800, CRC(71b4172e) SHA1(5a82c7dc313bb92b9829eb8350840e072825a797)) // called "VT131 ROM" in the vt101 quick reference guide; pins 20, 18 and 21 are /CE /CE2 and /CE3 on this mask rom - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e3", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL( "23-094e2-00.e4", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom -ROM_END - -ROM_START( vt180 ) -// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a -// Z80 daughterboard added to the expansion slot, and replacing the STP adapter (STP roms are replaced with the normal set) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-061e2-00.e56", 0x0000, 0x0800, CRC(3dae97ff) SHA1(e3437850c33565751b86af6c2fe270a491246d15)) // version 2 1980 'later rom' - ROM_LOAD( "23-032e2-00.e52", 0x0800, 0x0800, CRC(3d86db99) SHA1(cdd8bdecdc643442f6e7d2c83cf002baf8101867)) - ROM_LOAD( "23-033e2-00.e45", 0x1000, 0x0800, CRC(384dac0a) SHA1(22aaf5ab5f9555a61ec43f91d4dea3029f613e64)) - ROM_LOAD( "23-034e2-00.e40", 0x1800, 0x0800, CRC(4643184d) SHA1(27e6c19d9932bf13fdb70305ef4d806e90d60833)) - - ROM_REGION(0x1000, "chargen", 0) - ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) - ROM_LOAD_OPTIONAL ( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom - - ROM_REGION(0x10000, "z80cpu", 0) // z80 daughterboard - ROM_LOAD( "23-021e3-00.bin", 0x0000, 0x1000, CRC(a2a575d2) SHA1(47a2c40aaec89e8476240f25515d75ab157f2911)) - ROM_LOAD( "23-017e3-00.bin", 0x1000, 0x1000, CRC(4bdd2398) SHA1(84f288def6c143a2d2ed9dedf947c862c66bb18e)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1978, vt100, 0, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT100",MACHINE_NOT_WORKING) -//COMP( 1978, vt100wp, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT100-Wx", MACHINE_NOT_WORKING) -//COMP( 1978, vt100stp, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT100 w/VT1xx-AC STP", MACHINE_NOT_WORKING) -COMP( 1981, vt101, vt102, 0, vt102, vt100, driver_device, 0, "Digital Equipment Corporation", "VT101", MACHINE_NOT_WORKING) -COMP( 1981, vt102, 0, 0, vt102, vt100, driver_device, 0, "Digital Equipment Corporation", "VT102", MACHINE_NOT_WORKING) -//COMP( 1979, vt103, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT103", MACHINE_NOT_WORKING) -COMP( 1978, vt105, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT105", MACHINE_NOT_WORKING) -//COMP( 1978, vt110, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT110", MACHINE_NOT_WORKING) -//COMP( 1981, vt125, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT125", MACHINE_NOT_WORKING) -COMP( 1981, vt131, vt102, 0, vt102, vt100, driver_device, 0, "Digital Equipment Corporation", "VT131", MACHINE_NOT_WORKING) -//COMP( 1979, vt132, vt100, 0, vt100, vt100, driver_device, 0, "Digital Equipment Corporation", "VT132", MACHINE_NOT_WORKING) -COMP( 1983, vt180, vt100, 0, vt180, vt100, driver_device, 0, "Digital Equipment Corporation", "VT180", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/vt220.c b/src/mess/drivers/vt220.c deleted file mode 100644 index 88984bf90f7..00000000000 --- a/src/mess/drivers/vt220.c +++ /dev/null @@ -1,113 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu -/*************************************************************************** - - DEC VT220 - - 30/06/2009 Skeleton driver. - - Schematics at www.bitsavers.org/pdf/dec/terminal/vt220/VT220_Schematic_Aug83.pdf - There is an X2212 NVRAM at E17 which needs hookup - -****************************************************************************/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "machine/ram.h" - - -class vt220_state : public driver_device -{ -public: - vt220_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG) { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_vt220(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_ram; -}; - - -static ADDRESS_MAP_START(vt220_mem, AS_PROGRAM, 8, vt220_state) - AM_RANGE(0x0000, 0x7fff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vt220_io, AS_IO, 8, vt220_state) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vt220 ) -INPUT_PORTS_END - -void vt220_state::machine_reset() -{ - memset(m_ram->pointer(),0,16*1024); -} - -void vt220_state::video_start() -{ -} - -UINT32 vt220_state::screen_update_vt220(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - -static MACHINE_CONFIG_START( vt220, vt220_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8051, XTAL_11_0592MHz) // from schematic - MCFG_CPU_PROGRAM_MAP(vt220_mem) - MCFG_CPU_IO_MAP(vt220_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(vt220_state, screen_update_vt220) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( vt220 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS( "vt220" ) - ROM_SYSTEM_BIOS( 0, "vt220o", "VT220 from schematics" ) - ROMX_LOAD( "23-012e5.e3", 0x0000, 0x4000, NO_DUMP, ROM_BIOS(1)) // location e3 with jumper w7 present and w6 cut; the 8051 maps on top(?) of the first 0x1000 bytes of this rom, though this rom does seem to contain code there. - ROMX_LOAD( "23-012e5.e3", 0x4000, 0x4000, NO_DUMP, ROM_BIOS(1)) // the rom also maps to 4000-7fff as a14 is unconnected (do we have a ROMX_RELOAD I could use here instead of this?) - ROMX_LOAD( "23-248e4.e4", 0x8000, 0x2000, NO_DUMP, ROM_BIOS(1)) - // a000-bfff may be open bus or may be a mirror of above depending on whether the rom uses PGM/A13 as a secondary enable or not - ROMX_LOAD( "23-248e4.e4", 0xc000, 0x2000, NO_DUMP, ROM_BIOS(1)) - // e000-ffff may be open bus or may be a mirror of above depending on whether the rom uses PGM/A13 as a secondary enable or not - ROMX_LOAD( "23-011m1.e1", 0x0000, 0x1000, CRC(6c4930a9) SHA1(1200a5dbf431017a11a51b5c4c9b4e7952b0a2bb), ROM_BIOS(1)) // 8051 internal code, maps on top of the e3 rom at 0000-1000 - ROM_SYSTEM_BIOS( 1, "vt220v21", "VT220 Version 2.1" ) - ROMX_LOAD( "23-183e5.e3", 0x0000, 0x4000, CRC(2848db40) SHA1(b3b029ef964c86ede68ad1b2854cfad766f20af0), ROM_BIOS(2)) // location e3 with jumper w7 present and w6 cut; the 8051 maps on top(?) of the first 0x1000 bytes of this rom, though this rom does seem to contain code there. - ROMX_LOAD( "23-183e5.e3", 0x4000, 0x4000, CRC(2848db40) SHA1(b3b029ef964c86ede68ad1b2854cfad766f20af0), ROM_BIOS(2)) // the rom also maps to 4000-7fff as a14 is unconnected (do we have a ROMX_RELOAD I could use here instead of this?) - ROMX_LOAD( "23-182e5.e4", 0x8000, 0x4000, CRC(c759bf9f) SHA1(6fe21e8eb9576fbcda76d7909b07859db0793c4e), ROM_BIOS(2)) - ROMX_LOAD( "23-182e5.e4", 0xc000, 0x4000, CRC(c759bf9f) SHA1(6fe21e8eb9576fbcda76d7909b07859db0793c4e), ROM_BIOS(2)) // again a14 is unconnected here, so it maps at c000-ffff as well (do we have a ROMX_RELOAD I could use here instead of this?) - ROMX_LOAD( "23-011m1.e1", 0x0000, 0x1000, CRC(6c4930a9) SHA1(1200a5dbf431017a11a51b5c4c9b4e7952b0a2bb), ROM_BIOS(2)) // 8051 internal code, maps on top of the e3 rom at 0000-1000 - ROM_SYSTEM_BIOS( 2, "vt220", "VT220 Version 2.3" ) - ROMX_LOAD( "23-178e6.bin", 0x0000, 0x8000, CRC(cce5088c) SHA1(4638304729d1213658a96bb22c5211322b74d8fc), ROM_BIOS(3)) // probably location e3 with jumper w7 cut and w6 present, hence a14 connects to this rom. socket e4 would be empty so 8000-ffff is open bus - - ROM_REGION( 0x4000, "chargen", ROMREGION_ERASEFF ) - ROM_LOAD( "23-247e4.e13", 0x0000, 0x2000, NO_DUMP) // this is listed in the schematics - ROM_LOAD( "23-348e4.e13", 0x0000, 0x2000, CRC(994f3e37) SHA1(fe72a9fe9adb3a24743a6288d88ae07570cfea9a)) // this can maybe be read as well as a read/writable ram for custom characters which lives ?above? it in chargen address space by setting a bit in a config register. I haven't figured out where in 8051 address space it appears when readable nor where the ram appears. -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, vt220, 0, 0, vt220, vt220, driver_device, 0, "Digital Equipment Corporation", "VT220", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/vt240.c b/src/mess/drivers/vt240.c deleted file mode 100644 index 80acf4e14ab..00000000000 --- a/src/mess/drivers/vt240.c +++ /dev/null @@ -1,331 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu -/*************************************************************************** - - DEC VT240 - - 31/03/2010 Skeleton driver. - - TODO: - - understand how PCG works, it should be a funky i/o $30 to uPD7220 DMA - transfer; - - hook-up T11, rst65 irq + $20 reads are latches for that - - ROM POST notes: - 0x0139: ROM test - 0x015f: RAM test - 0x0071: RAM fill to 0x00 - 0x1c8f: UPD7220 - - // vt240: x2212 nvram at E56 -****************************************************************************/ - -#include "emu.h" - -#include "bus/rs232/rs232.h" -#include "cpu/i8085/i8085.h" -#include "cpu/t11/t11.h" -#include "machine/clock.h" -#include "machine/dec_lk201.h" -#include "machine/i8251.h" -#include "machine/mc68681.h" -#include "machine/ms7004.h" -#include "machine/ram.h" -#include "video/upd7220.h" - -#define VERBOSE_DBG 1 /* general debug messages */ - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \ - logerror A; \ - } \ - } while (0) - -class vt240_state : public driver_device -{ -public: - vt240_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_i8251(*this, "i8251"), - m_duart(*this, "duart"), - m_hgdc(*this, "upd7220"), - m_video_ram(*this, "video_ram"){ } - - required_device m_maincpu; - - required_device m_i8251; - DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); - - required_device m_duart; - - required_device m_hgdc; - DECLARE_READ8_MEMBER( test_r ); - DECLARE_READ8_MEMBER( pcg_r ); - DECLARE_WRITE8_MEMBER( pcg_w ); - - //UINT16 m_pcg_addr; - //UINT8 m_pcg_internal_addr; - //UINT8 *m_char_rom; - - required_shared_ptr m_video_ram; - - DECLARE_DRIVER_INIT(vt240); - virtual void machine_reset(); - INTERRUPT_GEN_MEMBER(vt240_irq); - UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); -}; - -WRITE_LINE_MEMBER(vt240_state::write_keyboard_clock) -{ - m_i8251->write_txc(state); - m_i8251->write_rxc(state); -} - -/* TODO */ -UPD7220_DRAW_TEXT_LINE_MEMBER( vt240_state::hgdc_draw_text ) -{ - //int x; - //int xi,yi; - //int tile,color; - //UINT8 tile_data; - - #if 0 - for( x = 0; x < pitch; x++ ) - { - tile = (vram[(addr+x)*2] & 0xff); - color = (vram[(addr+x)*2+1] & 0x0f); - - for( yi = 0; yi < lr; yi++) - { - tile_data = m_char_rom[(tile*8+yi) & 0x7ff]; - - if(cursor_on && cursor_addr == addr+x) //TODO - tile_data^=0xff; - - for( xi = 0; xi < 8; xi++) - { - int res_x,res_y; - int pen = (tile_data >> xi) & 1 ? color : 0; - - if(yi >= 8) { pen = 0; } - - res_x = x * 8 + xi; - res_y = y + yi; - - if(res_x > screen_max_x || res_y > screen_max_y) - continue; - - bitmap.pix16(res_y, res_x) = pen; - } - } - } - #endif -} - - -/* presumably communication with T11 */ -READ8_MEMBER( vt240_state::test_r ) -{ - //m_maincpu->set_input_line(I8085_RST65_LINE, CLEAR_LINE); - - return rand(); -} - - -// PDF page 78 (4-25) -static ADDRESS_MAP_START( vt240_mem, AS_PROGRAM, 16, vt240_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE (0000000, 0077777) AM_ROM - // 0170xxx MEM MAP/8085 decoder - AM_RANGE (0171000, 0171003) AM_DEVREADWRITE8("i8251", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE (0171004, 0171007) AM_DEVREADWRITE8("i8251", i8251_device, status_r, control_w, 0x00ff) - AM_RANGE (0172000, 0172077) AM_DEVREADWRITE8("duart", mc68681_device, read, write, 0xff) - // 0173000 Video logic - // 0174000 Video logic - // 017500x Video logic - // 0176xxx NVR - // 017700x System comm logic -ADDRESS_MAP_END - -// PDF page 134 (6-9) -#if 0 -static ADDRESS_MAP_START(vt240_char_mem, AS_PROGRAM, 8, vt240_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("charcpu", 0) - AM_RANGE(0x4000, 0x5fff) AM_ROM AM_REGION("charcpu", 0x8000) - AM_RANGE(0x8000, 0x87ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vt240_char_io, AS_IO, 8, vt240_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("upd7220", upd7220_device, read, write) - AM_RANGE(0x20, 0x20) AM_READ(test_r) - //AM_RANGE(0x30, 0x30) AM_READWRITE(pcg_r,pcg_w) // 0x30 PCG -ADDRESS_MAP_END -#endif - -static ADDRESS_MAP_START( upd7220_map, AS_0, 16, vt240_state) - AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vt240 ) -INPUT_PORTS_END - - -void vt240_state::machine_reset() -{ -} - -INTERRUPT_GEN_MEMBER(vt240_state::vt240_irq) -{ - //device.execute().set_input_line(I8085_RST65_LINE, ASSERT_LINE); -} - -static const gfx_layout vt240_chars_8x10 = -{ - 8,10, - RGN_FRAC(1,1), - 1, - { 0 }, - { STEP8(0,1) }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 8*10 -}; - -static GFXDECODE_START( vt240 ) - GFXDECODE_ENTRY( "charcpu", 0x338*10-2, vt240_chars_8x10, 0, 8 ) -GFXDECODE_END - -static MACHINE_CONFIG_FRAGMENT( vt240_motherboard ) - MCFG_CPU_ADD("maincpu", T11, XTAL_7_3728MHz) // confirm - MCFG_CPU_PROGRAM_MAP(vt240_mem) - MCFG_T11_INITIAL_MODE(5 << 13) - -/* - MCFG_CPU_ADD("charcpu", I8085A, XTAL_16MHz / 4) - MCFG_CPU_PROGRAM_MAP(vt240_char_mem) - MCFG_CPU_IO_MAP(vt240_char_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vt240_state, vt240_irq) -*/ - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) -// MCFG_VIDEO_START_OVERRIDE(vt240_state,vt240) - MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", vt240) - - MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4MHz / 4) - MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map) - MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(vt240_state, hgdc_draw_text) - - MCFG_MC68681_ADD("duart", XTAL_3_6864MHz) /* 2681 duart (not 68681!) */ -// MCFG_MC68681_IRQ_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_irq_handler)) - MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) -// MCFG_MC68681_B_TX_CALLBACK(WRITELINE(dectalk_state, dectalk_duart_txa)) -// MCFG_MC68681_INPORT_CALLBACK(READ8(dectalk_state, dectalk_duart_input)) -// MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(dectalk_state, dectalk_duart_output)) -// MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) -// MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "null_modem") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("duart", mc68681_device, rx_a_w)) -// MCFG_RS232_DSR_HANDLER(DEVWRITELINE("duart", mc68681_device, ipX_w)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( mc7105, vt240_state ) - MCFG_FRAGMENT_ADD(vt240_motherboard) - - // serial connection to MS7004 keyboard - MCFG_DEVICE_ADD("i8251", I8251, 0) -// MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir1_w)) - - MCFG_DEVICE_ADD("ms7004", MS7004, 0) - MCFG_MS7004_TX_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd)) - - // baud rate is supposed to be 4800 but keyboard is slightly faster - MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4960*16) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(vt240_state, write_keyboard_clock)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( mc7105 ) - ROM_REGION( 0x10000, "charcpu", ROMREGION_ERASEFF ) - ROM_LOAD( "027.bin", 0x8000, 0x8000, CRC(a159b412) SHA1(956097ccc2652d494258b3682498cfd3096d7d4f)) - ROM_LOAD( "028.bin", 0x0000, 0x8000, CRC(b253151f) SHA1(22ffeef8eb5df3c38bfe91266f26d1e7822cdb53)) - - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "029.bin", 0x00000, 0x8000, CRC(4a6db217) SHA1(47637325609ea19ffab61fe31e2700d72fa50729)) - ROM_LOAD16_BYTE( "031.bin", 0x00001, 0x8000, CRC(47129579) SHA1(39de9e2e26f90c5da5e72a09ff361c1a94b9008a)) - ROM_LOAD16_BYTE( "030.bin", 0x10000, 0x8000, CRC(05fd7b75) SHA1(2ad8c14e76accfa1b9b8748c58e9ebbc28844a47)) - ROM_LOAD16_BYTE( "032.bin", 0x10001, 0x8000, CRC(e81d93c4) SHA1(982412a7a6e65d6f6b4f66bd093e54ee16f31384)) -ROM_END - -/* ROM definition */ -ROM_START( vt240 ) - ROM_REGION( 0x10000, "charcpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-008e6-00.e100", 0x0000, 0x8000, CRC(ebc8a2fe) SHA1(70838175f8302fdc0dee79b2403fa95e6d989206)) - - ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS( "vt240" ) - // according to the schematics an even older set exists, variation 'E1' with roms: - // e100/8085: 23-003e6 - // e20: 23-001e6 - // e22: 23-002e6 - // e19: 23-048e5 - // e21: 23-049e5 - // but according to the Field Change Order below, the initial release is V2.1, so the above must be a prototype. - // DOL for v2.1 to v2.2 change: http://web.archive.org/web/20060905145200/http://cmcnabb.cc.vt.edu/dec94mds/vt240dol.txt - ROM_SYSTEM_BIOS( 0, "vt240v21", "VT240 V2.1" ) // initial factory release, FCO says this was 8 Feburary 1985 - ROMX_LOAD( "23-006e6-00.e20", 0x00000, 0x8000, CRC(79c11d82) SHA1(5a6fe5b75b6504a161f2c9b148c0fe9f19770837), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "23-004e6-00.e22", 0x00001, 0x8000, CRC(eba10fef) SHA1(c0ee4d8e4eeb70066f03f3d17a7e2f2bd0b5f8ad), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "23-007e6-00.e19", 0x10000, 0x8000, CRC(d18a2ab8) SHA1(37f448a332fc50298007ed39c8bf1ab1eb6d4cae), ROM_SKIP(1) | ROM_BIOS(1)) - ROMX_LOAD( "23-005e6-00.e21", 0x10001, 0x8000, CRC(558d0285) SHA1(e96a49bf9d55d8ab879d9b39aa380368c5c9ade0), ROM_SKIP(1) | ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "vt240", "VT240 V2.2" ) // Revised version, December 1985 - ROMX_LOAD( "23-058e6.e20", 0x00000, 0x8000, CRC(d2a56b90) SHA1(39cbb26134d7d8ba308df3a93228918a5945b45f), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "23-056e6.e22", 0x00001, 0x8000, CRC(c46e13c3) SHA1(0f2801fa7483d1f97708143cd81ae0816bf9a435), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "23-059e6.e19", 0x10000, 0x8000, CRC(f8393346) SHA1(1e28daf1b7f2bdabc47ce2f6fa99ef038b275a29), ROM_SKIP(1) | ROM_BIOS(2)) - ROMX_LOAD( "23-057e6.e21", 0x10001, 0x8000, CRC(7ce9dce9) SHA1(5a105e5bdca13910b3b79cc23567ce2dc36b844d), ROM_SKIP(1) | ROM_BIOS(2)) - // E39, E85, E131 are empty. - - ROM_REGION( 0x1000, "proms", ROMREGION_ERASEFF ) - ROM_LOAD( "23-351a1.e149", 0x0000, 0x0020, NO_DUMP) // 82s123; DRAM RAS/CAS Timing PROM - ROM_LOAD( "23-352a1.e187", 0x0020, 0x0020, NO_DUMP) // 82s123; "CT0" Timing PROM - ROM_LOAD( "23-369a1.e53", 0x0040, 0x0020, NO_DUMP) // 82s123; ROM and RAM mapping PROM - ROM_LOAD( "23-370a1.e188", 0x0060, 0x0020, NO_DUMP) // 82s123; "CT1" Timing PROM - ROM_LOAD( "23-994a9.e74", 0x0100, 0x0200, NO_DUMP) // 82s131; T11 Interrupt Encoder PROM - - ROM_REGION( 0x1000, "pals", 0 ) - ROM_LOAD( "23-087j5.e182.e183.jed", 0x0000, 0x1000, NO_DUMP ) // PAL16L8ACN; "Logic Unit" Character Pattern Related -ROM_END - -/* Driver */ -DRIVER_INIT_MEMBER(vt240_state,vt240) -{ - UINT8 *ROM = memregion("charcpu")->base(); - - /* patch T11 check */ - ROM[0x09d] = 0x00; - ROM[0x09e] = 0x00; - ROM[0x09f] = 0x00; - - /* ROM checksum */ - ROM[0x15c] = 0x00; - ROM[0x15d] = 0x00; - ROM[0x15e] = 0x00; -} - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, vt240, 0, 0, mc7105, vt240, vt240_state, vt240, "Digital Equipment Corporation", "VT240", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -//COMP( 1983, vt241, 0, 0, vt220, vt220, driver_device, 0, "Digital Equipment Corporation", "VT241", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -// NOTE: the only difference between VT240 and VT241 is the latter comes with a VR241 Color monitor, while the former comes with a mono display; the ROMs and operation are identical. -COMP( 1983, mc7105, 0, 0, mc7105, vt240, vt240_state, vt240, "Elektronika", "MC7105", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/vt320.c b/src/mess/drivers/vt320.c deleted file mode 100644 index ee452a5852d..00000000000 --- a/src/mess/drivers/vt320.c +++ /dev/null @@ -1,125 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu -/*************************************************************************** - - DEC VT320 - - 30/06/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "machine/ram.h" - - -class vt320_state : public driver_device -{ -public: - vt320_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG) { } - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_vt320(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_ram; -}; - -/* - -Partlist : - -Siemens SAB8031A-16-P -ROMless version of the 8051 microcontroller, running at 16 MHz. -Motorola MC2681P -Dual Universal Asynchronous Receiver/Transmitter (DUART), 40-pin package. -Toshiba TC53512AP -ROM, 512K bits = 64K bytes. 28-pin package. -Toshiba TC5565APL-12, 2 off -Static RAM, 64K bit = 8K byte. -ST TDA1170N -Vertical deflection system IC. -UC 80343Q -20 pins. Unknown. -UC 80068Q -20 pins. Unknown. -Motorola SN74LS157NQST -16 pins. Quad 2-to-1 multiplexer. -Microchip ER5911 -8 pins. Serial EEPROM. 1K bits = 128 bytes. -Texas Inst. 749X 75146 -8 pins. Unknown. -Signetics? 74LS373N -8-bit D-type latch. This has eight inputs and eight outputs. -*/ -static ADDRESS_MAP_START(vt320_mem, AS_PROGRAM, 8, vt320_state) - AM_RANGE(0x0000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vt320_io, AS_IO, 8, vt320_state) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vt320 ) -INPUT_PORTS_END - -void vt320_state::machine_reset() -{ - memset(m_ram->pointer(),0,16*1024); -} - -void vt320_state::video_start() -{ -} - -UINT32 vt320_state::screen_update_vt320(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - - -static MACHINE_CONFIG_START( vt320, vt320_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I8051, XTAL_16MHz) - MCFG_CPU_PROGRAM_MAP(vt320_mem) - MCFG_CPU_IO_MAP(vt320_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(vt320_state, screen_update_vt320) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( vt320 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_DEFAULT_BIOS( "vt320" ) - //DOL: http://web.archive.org/web/20060905115711/http://cmcnabb.cc.vt.edu/dec94mds/vt320dol.txt - ROM_SYSTEM_BIOS( 0, "vt320v11", "VT320 V1.1" ) - // 23-054E7 below can also appear (same contents?) as 23-048E7 which is a mask rom - ROMX_LOAD( "23-054e7.e9", 0x0000, 0x10000, CRC(be98f9a4) SHA1(b8044d42ffaadb734fbd047fbca9c8aadeb0bf6c), ROM_BIOS(1)) // EPROM - ROM_SYSTEM_BIOS( 1, "vt320", "VT320 V1.2" ) - ROMX_LOAD( "23-104e7.e9", 0x0000, 0x10000, CRC(5f419b5a) SHA1(dbc429b32d6baefd8a56862717d6e7fea1fb0c1c), ROM_BIOS(2)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, vt320, 0, 0, vt320, vt320, driver_device, 0, "Digital Equipment Corporation", "VT320", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -//COMP( 1989?, vt330, 0, 0, vt320, vt320, driver_device, 0, "Digital Equipment Corporation", "VT330", MACHINE_NOT_WORKING) -//COMP( 1989?, vt340, 0, 0, vt320, vt320, driver_device, 0, "Digital Equipment Corporation", "VT340", MACHINE_NOT_WORKING) -//COMP( 1990?, vt340p, 0, 0, vt320, vt320, driver_device, 0, "Digital Equipment Corporation", "VT340+", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/vt520.c b/src/mess/drivers/vt520.c deleted file mode 100644 index 9f4b0216587..00000000000 --- a/src/mess/drivers/vt520.c +++ /dev/null @@ -1,111 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu -/*************************************************************************** - - DEC VT520 - - 02/07/2009 Skeleton driver. - -****************************************************************************/ - -#include "emu.h" -#include "machine/ram.h" -#include "cpu/mcs51/mcs51.h" - - -class vt520_state : public driver_device -{ -public: - vt520_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } - - DECLARE_READ8_MEMBER(vt520_some_r); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_vt520(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - - -static ADDRESS_MAP_START(vt520_mem, AS_PROGRAM, 8, vt520_state) - AM_RANGE(0x0000, 0xffff) AM_RAMBANK("bank1") -ADDRESS_MAP_END - -/* - On the board there is TC160G41AF (1222) custom chip - doing probably all video/uart logic - there is 43.430MHz xtal near by -*/ - -READ8_MEMBER( vt520_state::vt520_some_r ) -{ - //bit 5 0 - //bit 6 1 - return 0x40; -} - -static ADDRESS_MAP_START(vt520_io, AS_IO, 8, vt520_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x7ffb, 0x7ffb) AM_READ(vt520_some_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vt520 ) -INPUT_PORTS_END - - -void vt520_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *rom = memregion("maincpu")->base(); - space.unmap_write(0x0000, 0xffff); - membank("bank1")->set_base(rom + 0x70000); -} - -void vt520_state::video_start() -{ -} - -UINT32 vt520_state::screen_update_vt520(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static MACHINE_CONFIG_START( vt520, vt520_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8032, XTAL_20MHz) - MCFG_CPU_PROGRAM_MAP(vt520_mem) - MCFG_CPU_IO_MAP(vt520_io) - - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(802, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 802-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(vt520_state, screen_update_vt520) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - // On the board there are two M5M44256BJ-7 chips - // Which are DRAM 256K x 4bit - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( vt520 ) - ROM_REGION( 0x80000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "23-010ed-00.e20", 0x0000, 0x80000, CRC(2502cc22) SHA1(0437c3107412f69e09d050fef003f2a81d8a3163)) // "(C)DEC94 23-010ED-00 // 9739 D" dumped from a VT520-A4 model -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -//COMP( 1993, vt510, 0, 0, vt520, vt520, driver_device, 0, "Digital Equipment Corporation", "VT510", MACHINE_NOT_WORKING) -COMP( 1994, vt520, 0, 0, vt520, vt520, driver_device, 0, "Digital Equipment Corporation", "VT520", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -//COMP( 1994, vt525, 0, 0, vt520, vt520, driver_device, 0, "Digital Equipment Corporation", "VT525", MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/vta2000.c b/src/mess/drivers/vta2000.c deleted file mode 100644 index 4f64a6ab490..00000000000 --- a/src/mess/drivers/vta2000.c +++ /dev/null @@ -1,195 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - VTA-2000 Terminal - - board images : http://fotki.yandex.ru/users/lodedome/album/93699?p=0 - - BDP-15 board only - - 29/11/2010 Skeleton driver. - -Better known on the net as BTA2000-15m. -It is a green-screen terminal, using RS232, and supposedly VT100 compatible. -The top line is a status line. - -Note: port 0 bit 4 is NOT a speaker bit. See code at 027B. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" - - -class vta2000_state : public driver_device -{ -public: - vta2000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_p_videoram(*this, "videoram") - , m_maincpu(*this, "maincpu") - { } - - const UINT8 *m_p_chargen; - UINT32 screen_update_vta2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_shared_ptr m_p_videoram; - DECLARE_PALETTE_INIT(vta2000); -private: - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; -}; - -static ADDRESS_MAP_START(vta2000_mem, AS_PROGRAM, 8, vta2000_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x5fff ) AM_ROM AM_REGION("roms", 0) - AM_RANGE( 0x8000, 0xc7ff ) AM_RAM AM_SHARE("videoram") - AM_RANGE( 0xc800, 0xc8ff ) AM_ROM AM_REGION("roms", 0x5000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vta2000_io, AS_IO, 8, vta2000_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( vta2000 ) -INPUT_PORTS_END - - -void vta2000_state::machine_reset() -{ -} - -void vta2000_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 vta2000_state::screen_update_vta2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -/* Cursor is missing. */ -{ - static UINT8 framecnt=0; - UINT8 y,ra,gfx,attr,fg,bg; - UINT16 sy=0,ma=0,x,xx=0,chr; - - framecnt++; - - for (y = 0; y < 25; y++) - { - for (ra = 0; ra < 12; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - xx = ma << 1; - for (x = ma; x < ma + 80; x++) - { - chr = m_p_videoram[xx++]; - attr = m_p_videoram[xx++]; - - if ((chr & 0x60)==0x60) - chr+=256; - - gfx = m_p_chargen[(chr<<4) | ra ]; - bg = 0; - - /* Process attributes */ - if (BIT(attr, 4)) - { - gfx ^= 0xff; // reverse video - bg = 2; - } - if (BIT(attr, 0)) - fg = 2; // highlight - else - fg = 1; - if ((BIT(attr, 1)) && (BIT(framecnt, 5))) - gfx = 0; // blink - if ((BIT(attr, 5)) && (ra == 10)) - { - gfx = 0xff; // underline - fg = 2; - } - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7) ? fg : bg; - *p++ = BIT(gfx, 6) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 0) ? fg : bg; - } - } - if (y) - ma+=132; - else - ma+=80; - } - return 0; -} - - -/* F4 Character Displayer */ -static const gfx_layout vta2000_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 512, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( vta2000 ) - GFXDECODE_ENTRY( "chargen", 0x0000, vta2000_charlayout, 0, 1 ) -GFXDECODE_END - -PALETTE_INIT_MEMBER(vta2000_state, vta2000) -{ - palette.set_pen_color(0, rgb_t::black); // black - palette.set_pen_color(1, 0x00, 0xc0, 0x00); // green - palette.set_pen_color(2, 0x00, 0xff, 0x00); // highlight -} - -static MACHINE_CONFIG_START( vta2000, vta2000_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8080, XTAL_4MHz / 4) - MCFG_CPU_PROGRAM_MAP(vta2000_mem) - MCFG_CPU_IO_MAP(vta2000_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(80*8, 25*12) - MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*12-1) - MCFG_SCREEN_UPDATE_DRIVER(vta2000_state, screen_update_vta2000) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(vta2000_state, vta2000) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", vta2000) -MACHINE_CONFIG_END - - -/* ROM definition */ -ROM_START( vta2000 ) - ROM_REGION( 0x6000, "roms", 0 ) - ROM_LOAD( "bdp-15_11.rom", 0x4000, 0x2000, CRC(d4abe3e9) SHA1(ab1973306e263b0f66f2e1ede50cb5230f8d69d5) ) - ROM_LOAD( "bdp-15_12.rom", 0x2000, 0x2000, CRC(4a5fe332) SHA1(f1401c26687236184fec0558cc890e796d7d5c77) ) - ROM_LOAD( "bdp-15_13.rom", 0x0000, 0x2000, CRC(b6b89d90) SHA1(0356d7ba77013b8a79986689fb22ef4107ef885b) ) - - ROM_REGION(0x2000, "chargen", ROMREGION_INVERT ) - ROM_LOAD( "bdp-15_14.rom", 0x0000, 0x2000, CRC(a1dc4f8e) SHA1(873fd211f44713b713d73163de2d8b5db83d2143) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 19??, vta2000, 0, 0, vta2000, vta2000, driver_device, 0, "", "VTA-2000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/vtech1.c b/src/mess/drivers/vtech1.c deleted file mode 100644 index d75006d4318..00000000000 --- a/src/mess/drivers/vtech1.c +++ /dev/null @@ -1,558 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Dirk Best -/*************************************************************************** - - Video Technology Laser 110 - Video Technology Laser 200 - Salora Fellow - Texet TX-8000 (?) - Video Technology VZ-200 - Video Technology Laser 210 - Dick Smith Electronics VZ-200 - Video Technology Laser 310 - Dick Smith Electronics VZ-300 - -Thanks go to: - - - Guy Thomason - - Jason Oakley - - Bushy Maunder - - and anybody else on the vzemu list :) - - Davide Moretti for the detailed description of the colors - - Leslie Milburn - -Todo: - - - Figure out which machines were shipped with which ROM version - where not known (currently only a guess) - - Lightpen support - - Rewrite floppy - -***************************************************************************/ - -#include "emu.h" -#include "formats/imageutl.h" -#include "cpu/z80/z80.h" -#include "video/mc6847.h" -#include "bus/vtech/ioexp/ioexp.h" -#include "bus/vtech/memexp/memexp.h" -#include "sound/wave.h" -#include "sound/speaker.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "formats/vt_cas.h" - - -/*************************************************************************** - CONSTANTS & MACROS -***************************************************************************/ - -#define LOG_VTECH1_LATCH 0 - -#define VTECH1_CLK 3579500 -#define VZ300_XTAL1_CLK XTAL_17_73447MHz - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -class vtech1_state : public driver_device -{ -public: - vtech1_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_mc6847(*this, "mc6847"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_ioexp(*this, "io"), - m_memexp(*this, "mem") - { - } - - DECLARE_DRIVER_INIT(vtech1); - DECLARE_DRIVER_INIT(vtech1h); - - DECLARE_READ8_MEMBER(vtech1_lightpen_r); - DECLARE_READ8_MEMBER(vtech1_keyboard_r); - DECLARE_WRITE8_MEMBER(vtech1_latch_w); - - DECLARE_WRITE8_MEMBER(vtech1_video_bank_w); - DECLARE_READ8_MEMBER(mc6847_videoram_r); - - DECLARE_SNAPSHOT_LOAD_MEMBER( vtech1 ); - -private: - static const UINT8 VZ_BASIC = 0xf0; - static const UINT8 VZ_MCODE = 0xf1; - - required_shared_ptr m_videoram; - - required_device m_maincpu; - required_device m_mc6847; - required_device m_speaker; - required_device m_cassette; - required_device m_ioexp; - required_device m_memexp; -}; - - -/*************************************************************************** - SNAPSHOT LOADING -***************************************************************************/ - -SNAPSHOT_LOAD_MEMBER( vtech1_state, vtech1 ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 header[24]; - char pgmname[18]; - - // get the header - image.fread(&header, sizeof(header)); - - // get image name - for (int i = 0; i < 16; i++) - pgmname[i] = header[i+4]; - pgmname[16] = '\0'; - - // get start and end addresses - UINT16 start = pick_integer_le(header, 22, 2); - UINT16 end = start + snapshot_size - sizeof(header); - UINT16 size = end - start; - - // write it to ram - UINT8 *ptr = (UINT8 *)image.ptr() + sizeof(header); - - for (UINT16 addr = start; addr <= end; addr++, ptr++) - { - UINT8 to_write = *ptr; - space.write_byte(addr, to_write); - - // verify - if (space.read_byte(addr) != to_write) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Insufficient RAM to load snapshot"); - image.message("Insufficient RAM to load snapshot (%d bytes needed) [%s]", size, pgmname); - - return IMAGE_INIT_FAIL; - } - } - - // patch variables depending on snapshot type - switch (header[21]) - { - case VZ_BASIC: - space.write_byte(0x78a4, start % 256); /* start of basic program */ - space.write_byte(0x78a5, start / 256); - space.write_byte(0x78f9, end % 256); /* end of basic program */ - space.write_byte(0x78fa, end / 256); - space.write_byte(0x78fb, end % 256); /* start variable table */ - space.write_byte(0x78fc, end / 256); - space.write_byte(0x78fd, end % 256); /* start free mem, end variable table */ - space.write_byte(0x78fe, end / 256); - image.message(" %s (B)\nsize=%04X : start=%04X : end=%04X", pgmname, size, start, end); - break; - - case VZ_MCODE: - space.write_byte(0x788e, start % 256); /* usr subroutine address */ - space.write_byte(0x788f, start / 256); - image.message(" %s (M)\nsize=%04X : start=%04X : end=%04X", pgmname, size, start, end); - m_maincpu->set_pc(start); /* start program */ - break; - - default: - image.seterror(IMAGE_ERROR_UNSUPPORTED, "Snapshot format not supported."); - image.message("Snapshot format not supported."); - return IMAGE_INIT_FAIL; - } - - return IMAGE_INIT_PASS; -} - - -/*************************************************************************** - INPUTS -***************************************************************************/ - -READ8_MEMBER( vtech1_state::vtech1_lightpen_r ) -{ - logerror("vtech1_lightpen_r(%d)\n", offset); - return 0xff; -} - -READ8_MEMBER( vtech1_state::vtech1_keyboard_r ) -{ - UINT8 result = 0x3f; - - // bit 0 to 5, keyboard input - if (!BIT(offset, 0)) result &= ioport("keyboard_0")->read(); - if (!BIT(offset, 1)) result &= ioport("keyboard_1")->read(); - if (!BIT(offset, 2)) result &= ioport("keyboard_2")->read(); - if (!BIT(offset, 3)) result &= ioport("keyboard_3")->read(); - if (!BIT(offset, 4)) result &= ioport("keyboard_4")->read(); - if (!BIT(offset, 5)) result &= ioport("keyboard_5")->read(); - if (!BIT(offset, 6)) result &= ioport("keyboard_6")->read(); - if (!BIT(offset, 7)) result &= ioport("keyboard_7")->read(); - - // bit 6, cassette input - result |= ((m_cassette->input()) > 0 ? 1 : 0) << 6; - - // bit 7, field sync - result |= m_mc6847->fs_r() << 7; - - return result; -} - - -/*************************************************************************** - I/O LATCH -***************************************************************************/ - -WRITE8_MEMBER( vtech1_state::vtech1_latch_w ) -{ - if (LOG_VTECH1_LATCH) - logerror("vtech1_latch_w $%02X\n", data); - - // bit 1, SHRG mod (if installed) - if (m_videoram.bytes() == 0x2000) - { - m_mc6847->gm0_w(BIT(data, 1)); - m_mc6847->gm2_w(BIT(data, 1)); - } - - // bit 2, cassette out (actually bits 1 and 2 perform this function, so either can be used) - m_cassette->output( BIT(data, 2) ? -1.0 : +1.0); - - // bit 3 and 4, vdc mode control lines - m_mc6847->ag_w(BIT(data, 3)); - m_mc6847->css_w(BIT(data, 4)); - - // bit 0 and 5, speaker - m_speaker->level_w((BIT(data, 5) << 1) | BIT(data, 0)); -} - - -/*************************************************************************** - MEMORY BANKING -***************************************************************************/ - -WRITE8_MEMBER( vtech1_state::vtech1_video_bank_w ) -{ - membank("bank4")->set_entry(data & 0x03); -} - - -/*************************************************************************** - VIDEO EMULATION -***************************************************************************/ - -READ8_MEMBER( vtech1_state::mc6847_videoram_r ) -{ - if (offset == ~0) return 0xff; - - m_mc6847->inv_w(BIT(m_videoram[offset], 6)); - m_mc6847->as_w(BIT(m_videoram[offset], 7)); - - return m_videoram[offset]; -} - - -/*************************************************************************** - DRIVER INIT -***************************************************************************/ - -DRIVER_INIT_MEMBER( vtech1_state, vtech1 ) -{ - // setup expansion slots - m_ioexp->set_io_space(&m_maincpu->space(AS_IO)); - m_memexp->set_program_space(&m_maincpu->space(AS_PROGRAM)); - m_memexp->set_io_space(&m_maincpu->space(AS_IO)); -} - -DRIVER_INIT_MEMBER( vtech1_state, vtech1h ) -{ - DRIVER_INIT_CALL(vtech1); - - // the SHRG mod replaces the standard videoram chip with an 8k chip - m_videoram.allocate(0x2000); - - m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x7000, 0x77ff, "bank4"); - membank("bank4")->configure_entries(0, 4, m_videoram, 0x800); - membank("bank4")->set_entry(0); -} - - -/*************************************************************************** - ADDRESS MAPS -***************************************************************************/ - -static ADDRESS_MAP_START( laser110_mem, AS_PROGRAM, 8, vtech1_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM // basic rom - AM_RANGE(0x6800, 0x6fff) AM_READWRITE(vtech1_keyboard_r, vtech1_latch_w) - AM_RANGE(0x7000, 0x77ff) AM_RAM AM_SHARE("videoram") // 6847 - AM_RANGE(0x7800, 0x7fff) AM_RAM // 2k user ram -ADDRESS_MAP_END - -static ADDRESS_MAP_START( laser210_mem, AS_PROGRAM, 8, vtech1_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM // basic rom - AM_RANGE(0x6800, 0x6fff) AM_READWRITE(vtech1_keyboard_r, vtech1_latch_w) - AM_RANGE(0x7000, 0x77ff) AM_RAM AM_SHARE("videoram") // 6847 - AM_RANGE(0x7800, 0x8fff) AM_RAM // 6k user ram -ADDRESS_MAP_END - -static ADDRESS_MAP_START( laser310_mem, AS_PROGRAM, 8, vtech1_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM // basic rom - AM_RANGE(0x6800, 0x6fff) AM_READWRITE(vtech1_keyboard_r, vtech1_latch_w) - AM_RANGE(0x7000, 0x77ff) AM_RAM AM_SHARE("videoram") // 6847 - AM_RANGE(0x7800, 0xb7ff) AM_RAM // 16k user ram -ADDRESS_MAP_END - -static ADDRESS_MAP_START( vtech1_io, AS_IO, 8, vtech1_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x40, 0x4f) AM_READ(vtech1_lightpen_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( vtech1_shrg_io, AS_IO, 8, vtech1_state ) - AM_IMPORT_FROM(vtech1_io) - AM_RANGE(0xd0, 0xdf) AM_WRITE(vtech1_video_bank_w) -ADDRESS_MAP_END - - -/*************************************************************************** - INPUT PORTS -***************************************************************************/ - -static INPUT_PORTS_START(vtech1) - PORT_START("keyboard_0") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R RETURN LEFT$") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q FOR CHR$") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E NEXT LEN(") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W TO VAL(") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T THEN MID$") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - - PORT_START("keyboard_1") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F GOSUB RND(") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A MODE( ASC(") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DIM RESTORE") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S STEP STR$(") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G GOTO STOP") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - - PORT_START("keyboard_2") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V LPRINT USR") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z PEEK( INP") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C CONT COPY") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X POKE OUT") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B LLIST SOUND") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - - PORT_START("keyboard_3") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $ VERIFY ATN(") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ! CSAVE SIN(") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 # CRUN TAN(") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \" CLOAD COS(") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 % LIST LOG(") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START("keyboard_4") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M \\ \xE2\x86\x90") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('\\') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE \xE2\x86\x93") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('~') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", < \xE2\x86\x92") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". > \xE2\x86\x91") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N ^ COLOR USING") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('^') - - PORT_START("keyboard_5") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ' END SGN(") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 @ DATA INT(") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 ( NEW SQR(") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- = [Break]") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 ) READ ABS(") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 & RUN EXP(") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - - PORT_START("keyboard_6") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U IF INKEY$") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P ] PRINT NOT") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR(']') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I INPUT AND") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN [Function]") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O [ LET OR") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('[') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y ELSE RIGHT$(") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - - PORT_START("keyboard_7") - PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J REM RESET") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; + [Rubout]") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K / TAB( POINT") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('/') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": * [Inverse]") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L ? [Insert]") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('?') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H CLS SET") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - - /* Enhanced options not available on real hardware */ - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x01, DEF_STR(Yes)) -// PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") -// PORT_CONFSETTING( 0x08, DEF_STR(On)) -// PORT_CONFSETTING( 0x00, DEF_STR(Off)) -INPUT_PORTS_END - - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -static const INT16 speaker_levels[] = {-32768, 0, 32767, 0}; - -static MACHINE_CONFIG_START( laser110, vtech1_state ) - - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, VTECH1_CLK) /* 3.57950 MHz */ - MCFG_CPU_PROGRAM_MAP(laser110_mem) - MCFG_CPU_IO_MAP(vtech1_io) - - // video hardware - MCFG_SCREEN_MC6847_PAL_ADD("screen", "mc6847") - - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT - MCFG_MC6847_INPUT_CALLBACK(READ8(vtech1_state, mc6847_videoram_r)) - MCFG_MC6847_BW(true) - MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM1) - // GM2 = GND, GM0 = GND, INTEXT = GND - // other lines not connected - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SPEAKER_LEVELS(4, speaker_levels) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - // peripheral and memory expansion slots - MCFG_IOEXP_SLOT_ADD("io") - MCFG_MEMEXP_SLOT_ADD("mem") - - // snapshot - MCFG_SNAPSHOT_ADD("snapshot", vtech1_state, vtech1, "vz", 1.5) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(vtech1_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - MCFG_CASSETTE_INTERFACE("vtech1_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list", "vz_cass") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( laser200, laser110 ) - MCFG_DEVICE_REMOVE("mc6847") - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT - MCFG_MC6847_INPUT_CALLBACK(READ8(vtech1_state, mc6847_videoram_r)) - MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM1) - // GM2 = GND, GM0 = GND, INTEXT = GND - // other lines not connected -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( laser210, laser200 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(laser210_mem) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( laser310, laser200 ) - MCFG_CPU_REPLACE("maincpu", Z80, VZ300_XTAL1_CLK / 5) /* 3.546894 MHz */ - MCFG_CPU_PROGRAM_MAP(laser310_mem) - MCFG_CPU_IO_MAP(vtech1_io) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( laser310h, laser310 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(vtech1_shrg_io) - - MCFG_DEVICE_REMOVE("mc6847") - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT - MCFG_MC6847_INPUT_CALLBACK(READ8(vtech1_state, mc6847_videoram_r)) - MCFG_MC6847_FIXED_MODE(MC6847_MODE_GM1) - // INTEXT = GND - // other lines not connected -MACHINE_CONFIG_END - - -/*************************************************************************** - ROM DEFINITIONS -***************************************************************************/ - -ROM_START( laser110 ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_LOAD("vtechv12.u09", 0x0000, 0x2000, CRC(99412d43) SHA1(6aed8872a0818be8e1b08ecdfd92acbe57a3c96d)) - ROM_LOAD("vtechv12.u10", 0x2000, 0x2000, CRC(e4c24e8b) SHA1(9d8fb3d24f3d4175b485cf081a2d5b98158ab2fb)) -ROM_END - -// The VZ-200 sold in Germany and the Netherlands came with BASIC V1.1, which is currently not dumped. -ROM_START( vz200de ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_LOAD("vtechv11.u09", 0x0000, 0x2000, NO_DUMP) - ROM_LOAD("vtechv11.u10", 0x2000, 0x2000, NO_DUMP) -ROM_END - -#define rom_laser200 rom_laser110 -#define rom_fellow rom_laser110 - -// It's possible that the Texet TX-8000 came with BASIC V1.0, but this needs to be verified -#define rom_tx8000 rom_laser110 - -ROM_START( laser210 ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_LOAD("vtechv20.u09", 0x0000, 0x2000, CRC(cc854fe9) SHA1(6e66a309b8e6dc4f5b0b44e1ba5f680467353d66)) - ROM_LOAD("vtechv20.u10", 0x2000, 0x2000, CRC(7060f91a) SHA1(8f3c8f24f97ebb98f3c88d4e4ba1f91ffd563440)) -ROM_END - -ROM_START( vz200 ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "basic20", "BASIC V2.0") - ROMX_LOAD("vtechv20.u09", 0x0000, 0x2000, CRC(cc854fe9) SHA1(6e66a309b8e6dc4f5b0b44e1ba5f680467353d66), ROM_BIOS(1)) - ROMX_LOAD("vtechv20.u10", 0x2000, 0x2000, CRC(7060f91a) SHA1(8f3c8f24f97ebb98f3c88d4e4ba1f91ffd563440), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "enhanced", "VZ-200 Enhanced BASIC V1.01") - ROMX_LOAD("vz200_v101.u9", 0x0000, 0x2000, CRC(70340b97) SHA1(eb3f3c8cf0cfa7acd646e89a90a3edf9e556cab6), ROM_BIOS(2)) - ROMX_LOAD("vtechv20.u10", 0x2000, 0x2000, CRC(7060f91a) SHA1(8f3c8f24f97ebb98f3c88d4e4ba1f91ffd563440), ROM_BIOS(2)) -ROM_END - -ROM_START( laser310 ) - ROM_REGION(0x4000, "maincpu", 0) - ROM_SYSTEM_BIOS(0, "basic20", "BASIC V2.0") - ROMX_LOAD("vtechv20.u12", 0x0000, 0x4000, CRC(613de12c) SHA1(f216c266bc09b0dbdbad720796e5ea9bc7d91e53), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "basic21", "BASIC V2.1 (hack)") - ROMX_LOAD("vtechv21.u12", 0x0000, 0x4000, CRC(f7df980f) SHA1(5ba14a7a2eedca331b033901080fa5d205e245ea), ROM_BIOS(2)) -ROM_END - -#define rom_vz300 rom_laser310 -#define rom_laser310h rom_laser310 - - -/*************************************************************************** - GAME DRIVERS -***************************************************************************/ - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1983, laser110, 0, 0, laser110, vtech1, vtech1_state, vtech1, "Video Technology", "Laser 110", 0 ) -COMP( 1983, laser200, 0, 0, laser200, vtech1, vtech1_state, vtech1, "Video Technology", "Laser 200", 0 ) -COMP( 1983, vz200de, laser200, 0, laser200, vtech1, vtech1_state, vtech1, "Video Technology", "VZ-200 (Germany & Netherlands)", MACHINE_NOT_WORKING ) -COMP( 1983, fellow, laser200, 0, laser200, vtech1, vtech1_state, vtech1, "Salora", "Fellow (Finland)", 0 ) -COMP( 1983, tx8000, laser200, 0, laser200, vtech1, vtech1_state, vtech1, "Texet", "TX-8000 (UK)", 0 ) -COMP( 1984, laser210, 0, 0, laser210, vtech1, vtech1_state, vtech1, "Video Technology", "Laser 210", 0 ) -COMP( 1984, vz200, laser210, 0, laser210, vtech1, vtech1_state, vtech1, "Dick Smith Electronics", "VZ-200 (Oceania)", 0 ) -COMP( 1984, laser310, 0, 0, laser310, vtech1, vtech1_state, vtech1, "Video Technology", "Laser 310", 0 ) -COMP( 1984, vz300, laser310, 0, laser310, vtech1, vtech1_state, vtech1, "Dick Smith Electronics", "VZ-300 (Oceania)", 0 ) -COMP( 1984, laser310h, laser310, 0, laser310h, vtech1, vtech1_state, vtech1h, "Video Technology", "Laser 310 (SHRG)", MACHINE_UNOFFICIAL) diff --git a/src/mess/drivers/vtech2.c b/src/mess/drivers/vtech2.c deleted file mode 100644 index d5595320b72..00000000000 --- a/src/mess/drivers/vtech2.c +++ /dev/null @@ -1,506 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/*************************************************************************** - vtech2.c - - system driver - Juergen Buchmueller MESS driver, Jan 2000 - Davide Moretti ROM dump and hardware description - - LASER 350 (it has only 16K of RAM) - FFFF|-------| - | Empty | - | 5 | - C000|-------| - | RAM | - | 3 | - 8000|-------|-------|-------| - | ROM |Display| I/O | - | 1 | 3 | 2 | - 4000|-------|-------|-------| - | ROM | - | 0 | - 0000|-------| - - - Laser 500/700 with 64K of RAM and - Laser 350 with 64K RAM expansion module - FFFF|-------| - | RAM | - | 5 | - C000|-------| - | RAM | - | 4 | - 8000|-------|-------|-------| - | ROM |Display| I/O | - | 1 | 7 | 2 | - 4000|-------|-------|-------| - | ROM | - | 0 | - 0000|-------| - - - Bank "maincpu" Contents - 0 0x00000 - 0x03fff ROM 1st half - 1 0x04000 - 0x07fff ROM 2nd half - 2 n/a I/O 2KB area (mirrored 8 times?) - 3 0x0c000 - 0x0ffff Display RAM (16KB) present in Laser 350 only! - 4 0x10000 - 0x13fff RAM #4 - 5 0x14000 - 0x17fff RAM #5 - 6 0x18000 - 0x1bfff RAM #6 - 7 0x1c000 - 0x1ffff RAM #7 (Display RAM with 64KB) - 8 0x20000 - 0x23fff RAM #8 (Laser 700 or 128KB extension) - 9 0x24000 - 0x27fff RAM #9 - A 0x28000 - 0x2bfff RAM #A - B 0x2c000 - 0x2ffff RAM #B - C 0x30000 - 0x33fff ROM expansion - D 0x34000 - 0x34fff ROM expansion - E 0x38000 - 0x38fff ROM expansion - F 0x3c000 - 0x3ffff ROM expansion - - TODO: - Add ROMs and drivers for the Laser100, 110, - 210 and 310 machines and the Texet 8000. - They should probably go to the vtech1.c files, though. - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "includes/vtech2.h" -#include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" -#include "formats/vt_cas.h" - -static ADDRESS_MAP_START(vtech2_mem, AS_PROGRAM, 8, vtech2_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") - AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3") - AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4") -ADDRESS_MAP_END - -static ADDRESS_MAP_START(vtech2_io, AS_IO, 8, vtech2_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x10, 0x1f) AM_READWRITE(laser_fdc_r, laser_fdc_w) - AM_RANGE(0x40, 0x43) AM_WRITE(laser_bank_select_w) - AM_RANGE(0x44, 0x44) AM_WRITE(laser_bg_mode_w) - AM_RANGE(0x45, 0x45) AM_WRITE(laser_two_color_w) -ADDRESS_MAP_END - -/* 2008-05 FP: -Small note about natural keyboard: currently, -- "Graph" is mapped to 'F11' -- "Del Line" is mapped to 'F12' -*/ -static INPUT_PORTS_START( laser500 ) - PORT_START("ROW0") /* KEY ROW 0 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("ROW1") /* KEY ROW 1 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - - PORT_START("ROW2") /* KEY ROW 2 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - - PORT_START("ROW3") /* KEY ROW 3 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - - PORT_START("ROW4") /* KEY ROW 4 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - - PORT_START("ROW5") /* KEY ROW 5 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - - PORT_START("ROW6") /* KEY ROW 6 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START("ROW7") /* KEY ROW 7 */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("ROWA") /* KEY ROW A */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("ROWB") /* KEY ROW B */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("ROWC") /* KEY ROW C */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cap Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del Line") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("ROWD") /* KEY ROW D */ - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mu \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\xA3') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) -INPUT_PORTS_END - -/* 2008-05 FP: I wasn't able to find a good picture of the laser 350 to verify the mapping of the emulated keyboard. -However, old-computers.com describes it as a laser 500/700 in a laser 300/310 case. The missing inputs seem to -confirm this. */ -static INPUT_PORTS_START( laser350 ) - PORT_INCLUDE( laser500 ) - - PORT_MODIFY("ROW2") /* KEY ROW 2 */ - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) /* TAB not on the Laser350 */ - - PORT_MODIFY("ROW3") /* KEY ROW 3 */ - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) /* ESC not on the Laser350 */ - - PORT_MODIFY("ROW5") /* KEY ROW 5 */ - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) /* BS not on the Laser350 */ - - PORT_MODIFY("ROW7") /* KEY ROW 7 */ - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) /* GRAPH not on the Laser350 */ - - PORT_MODIFY("ROWA") /* KEY ROW A */ - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) /* not on the Laser350 */ - - PORT_MODIFY("ROWB") /* KEY ROW B */ - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) /* not on the Laser350 */ - - PORT_MODIFY("ROWC") /* KEY ROW C */ - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) /* not on the Laser350 */ - - PORT_MODIFY("ROWD") /* KEY ROW D */ - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) /* not on the Laser350 */ - - /* 2008-05 FP: This input_port seems never to be read. Is it a leftover of the old cassette code? */ - PORT_START("TAPE") /* Tape control */ - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Start") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Stop") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Rewind") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x1f, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - - -static const gfx_layout charlayout_80 = -{ - 8,8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout charlayout_40 = -{ - 8*2,8, /* 8*2 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes; 1 bit per pixel */ - /* x offsets */ - { 0,0, 1,1, 2,2, 3,3, 4,4, 5,5, 6,6, 7,7 }, - /* y offsets */ - { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout gfxlayout_1bpp = -{ - 8,1, /* 8x1 pixels */ - 256, /* 256 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7,6,5,4,3,2,1,0 }, - /* y offsets */ - { 0 }, - 8 /* one byte per code */ -}; - -static const gfx_layout gfxlayout_1bpp_dw = -{ - 8*2,1, /* 8 times 2x1 pixels */ - 256, /* 256 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7,7,6,6,5,5,4,4,3,3,2,2,1,1,0,0 }, - /* y offsets */ - { 0 }, - 8 /* one byte per code */ -}; - -static const gfx_layout gfxlayout_1bpp_qw = -{ - 8*4,1, /* 8 times 4x1 pixels */ - 256, /* 256 codes */ - 1, /* 1 bit per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 7,7,7,7,6,6,6,6,5,5,5,5,4,4,4,4,3,3,3,3,2,2,2,2,1,1,1,1,0,0,0,0 }, - /* y offsets */ - { 0 }, - 8 /* one byte per code */ -}; - -static const gfx_layout gfxlayout_4bpp = -{ - 2*4,1, /* 2 times 4x1 pixels */ - 256, /* 256 codes */ - 4, /* 4 bit per pixel */ - { 0,1,2,3 }, /* four bitplanes */ - /* x offsets */ - { 4,4,4,4, 0,0,0,0 }, - /* y offsets */ - { 0 }, - 2*4 /* one byte per code */ -}; - -static const gfx_layout gfxlayout_4bpp_dh = -{ - 2*4,2, /* 2 times 4x2 pixels */ - 256, /* 256 codes */ - 4, /* 4 bit per pixel */ - { 0,1,2,3 }, /* four bitplanes */ - /* x offsets */ - { 4,4,4,4, 0,0,0,0 }, - /* y offsets */ - { 0,0 }, - 2*4 /* one byte per code */ -}; - -static GFXDECODE_START( vtech2 ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout_80, 0, 256 ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout_40, 0, 256 ) - GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_1bpp, 0, 256 ) - GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_1bpp_dw, 0, 256 ) - GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_1bpp_qw, 0, 256 ) - GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_4bpp, 2*256, 1 ) - GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_4bpp_dh, 2*256, 1 ) -GFXDECODE_END - - -static const rgb_t vt_colors[] = -{ - rgb_t::black, - rgb_t(0x00, 0x00, 0x7f), /* blue */ - rgb_t(0x00, 0x7f, 0x00), /* green */ - rgb_t(0x00, 0x7f, 0x7f), /* cyan */ - rgb_t(0x7f, 0x00, 0x00), /* red */ - rgb_t(0x7f, 0x00, 0x7f), /* magenta */ - rgb_t(0x7f, 0x7f, 0x00), /* yellow */ - rgb_t(0xa0, 0xa0, 0xa0), /* bright grey */ - rgb_t(0x7f, 0x7f, 0x7f), /* dark grey */ - rgb_t(0x00, 0x00, 0xff), /* bright blue */ - rgb_t(0x00, 0xff, 0x00), /* bright green */ - rgb_t(0x00, 0xff, 0xff), /* bright cyan */ - rgb_t(0xff, 0x00, 0x00), /* bright red */ - rgb_t(0xff, 0x00, 0xff), /* bright magenta */ - rgb_t(0xff, 0xff, 0x00), /* bright yellow */ - rgb_t::white -}; - - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(vtech2_state, vtech2) -{ - int i; - - for ( i = 0; i < 16; i++ ) - palette.set_indirect_color(i, vt_colors[i]); - - for (i = 0; i < 256; i++) - { - palette.set_pen_indirect(2*i, i&15); - palette.set_pen_indirect(2*i+1, i>>4); - } - - for (i = 0; i < 16; i++) - palette.set_pen_indirect(512+i, i); -} - -INTERRUPT_GEN_MEMBER(vtech2_state::vtech2_interrupt) -{ - m_maincpu->set_input_line(0, HOLD_LINE); -} - -static const floppy_interface vtech2_floppy_interface = -{ - FLOPPY_STANDARD_5_25_SSDD_40, - LEGACY_FLOPPY_OPTIONS_NAME(default), - NULL -}; - -static MACHINE_CONFIG_START( laser350, vtech2_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, 3694700) /* 3.694700 MHz */ - MCFG_CPU_PROGRAM_MAP(vtech2_mem) - MCFG_CPU_IO_MAP(vtech2_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vtech2_state, vtech2_interrupt) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_SIZE(88*8, 24*8+32) - MCFG_SCREEN_VISIBLE_AREA(0*8, 88*8-1, 0*8, 24*8+32-1) - MCFG_SCREEN_UPDATE_DRIVER(vtech2_state, screen_update_laser) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", vtech2 ) - MCFG_PALETTE_ADD("palette", 512+16) - MCFG_PALETTE_INDIRECT_ENTRIES(16) - MCFG_PALETTE_INIT_OWNER(vtech2_state, vtech2) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(vtech2_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY) - - /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vtech_cart") - MCFG_GENERIC_EXTENSIONS("rom,bin") - - /* 5.25" Floppy drive */ - MCFG_LEGACY_FLOPPY_DRIVE_ADD( FLOPPY_0, vtech2_floppy_interface ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( laser500, laser350 ) - MCFG_MACHINE_RESET_OVERRIDE(vtech2_state, laser500 ) -MACHINE_CONFIG_END - - -static MACHINE_CONFIG_DERIVED( laser700, laser350 ) - MCFG_MACHINE_RESET_OVERRIDE(vtech2_state, laser700 ) - - /* Second 5.25" floppy drive */ - MCFG_LEGACY_FLOPPY_DRIVE_ADD( FLOPPY_1, vtech2_floppy_interface ) -MACHINE_CONFIG_END - - -ROM_START(laser350) - ROM_REGION(0x40000,"maincpu",0) - ROM_LOAD("laserv3.rom", 0x00000, 0x08000, CRC(9bed01f7) SHA1(3210fddfab2f4c7855fa902fb8e2fc18d10d48f1)) - ROM_REGION(0x00800,"gfx1",0) - ROM_LOAD("laser.fnt", 0x00000, 0x00800, CRC(ed6bfb2a) SHA1(95e247021a10167b9de1d6ffc91ec4ba83b0ec87)) - ROM_REGION(0x00100,"gfx2",ROMREGION_ERASEFF) - /* initialized in init_laser */ -ROM_END - - -ROM_START(laser500) // based on the picture at http://www.8bit-museum.de/hardware/laser500pcb-h.jpg -// There should be two roms, one 0x2000 long for the font at u10, and one longer one for the os rom at u6. - ROM_REGION(0x40000,"maincpu",0) - ROM_LOAD("27-0401-00-00.u6", 0x00000, 0x08000, CRC(9bed01f7) SHA1(3210fddfab2f4c7855fa902fb8e2fc18d10d48f1)) // may be dumped at wrong size; label is: "VTL 27-0401-00-00 // 6133-7081 // 8611MAK" - ROM_REGION(0x00800,"gfx1",0) - ROM_LOAD("27-393-00.u10", 0x00000, 0x00800, BAD_DUMP CRC(ed6bfb2a) SHA1(95e247021a10167b9de1d6ffc91ec4ba83b0ec87)) // dumped at wrong size; correct size is 0x2000; label is "TMS 2364-25NL // D8614L // ZA234015 // 27-393-00/VT 85 // SINGAPORE" - ROM_REGION(0x00100,"gfx2",ROMREGION_ERASEFF) - /* initialized in init_laser */ -ROM_END - -ROM_START(laser700) - ROM_REGION(0x40000,"maincpu",0) - ROM_LOAD("laserv3.rom", 0x00000, 0x08000, CRC(9bed01f7) SHA1(3210fddfab2f4c7855fa902fb8e2fc18d10d48f1)) - ROM_REGION(0x00800,"gfx1",0) - ROM_LOAD("laser.fnt", 0x00000, 0x00800, CRC(ed6bfb2a) SHA1(95e247021a10167b9de1d6ffc91ec4ba83b0ec87)) - ROM_REGION(0x00100,"gfx2",ROMREGION_ERASEFF) - /* initialized in init_laser */ -ROM_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1984?, laser350, 0, 0, laser350, laser350, vtech2_state, laser, "Video Technology", "Laser 350" , 0) -COMP( 1984?, laser500, laser350, 0, laser500, laser500, vtech2_state, laser, "Video Technology", "Laser 500" , 0) -COMP( 1984?, laser700, laser350, 0, laser700, laser500, vtech2_state, laser, "Video Technology", "Laser 700" , 0) diff --git a/src/mess/drivers/wangpc.c b/src/mess/drivers/wangpc.c deleted file mode 100644 index 4ca371b4267..00000000000 --- a/src/mess/drivers/wangpc.c +++ /dev/null @@ -1,1194 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/* - - Wang Professional Computer - - http://www.seasip.info/VintagePC/wangpc.html - - chdman -createblankhd q540.chd 512 8 17 512 - -*/ - -/* - - TODO: - - - with quantum perfect cpu gets stuck @ 49c3 mov ss,cs:[52ah] - - hard disk - -*/ - -#include "includes/wangpc.h" -#include "bus/rs232/rs232.h" - - -//************************************************************************** -// MACROS/CONSTANTS -//************************************************************************** - -#define LOG 0 - -enum -{ - LED_DIAGNOSTIC = 0 -}; - - - -//************************************************************************** -// IMPLEMENTATION -//************************************************************************** - -void wangpc_state::select_drive() -{ - floppy_image_device *floppy = NULL; - - if (m_ds1) floppy = m_floppy0; - if (m_ds2) floppy = m_floppy1; - - m_fdc->set_floppy(floppy); -} - -WRITE8_MEMBER( wangpc_state::fdc_ctrl_w ) -{ - /* - - bit description - - 0 Enable /EOP - 1 Disable /DREQ2 - 2 Clear drive 1 door disturbed interrupt - 3 Clear drive 2 door disturbed interrupt - 4 - 5 - 6 - 7 - - */ - - m_enable_eop = BIT(data, 0); - m_disable_dreq2 = BIT(data, 1); - - if (BIT(data, 2)) m_fdc_dd0 = 0; - if (BIT(data, 3)) m_fdc_dd1 = 0; - - if (LOG) - { - logerror("%s: Enable /EOP %u\n", machine().describe_context(), m_enable_eop); - logerror("%s: Disable /DREQ2 %u\n", machine().describe_context(), m_disable_dreq2); - } - - update_fdc_tc(); - update_fdc_drq(); -} - - -READ8_MEMBER( wangpc_state::deselect_drive1_r ) -{ - m_ds1 = false; - select_drive(); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::deselect_drive1_w ) -{ - deselect_drive1_r(space, offset); -} - -READ8_MEMBER( wangpc_state::select_drive1_r ) -{ - m_ds1 = true; - select_drive(); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::select_drive1_w ) -{ - select_drive1_r(space, offset); -} - -READ8_MEMBER( wangpc_state::deselect_drive2_r ) -{ - m_ds2 = false; - select_drive(); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::deselect_drive2_w ) -{ - deselect_drive2_r(space, offset); -} - -READ8_MEMBER( wangpc_state::select_drive2_r ) -{ - m_ds2 = true; - select_drive(); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::select_drive2_w ) -{ - select_drive2_r(space, offset); -} - -READ8_MEMBER( wangpc_state::motor1_off_r ) -{ - if (LOG) logerror("%s: Drive 1 motor OFF\n", machine().describe_context()); - - m_floppy0->mon_w(1); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::motor1_off_w ) -{ - motor1_off_r(space, offset); -} - -READ8_MEMBER( wangpc_state::motor1_on_r ) -{ - if (LOG) logerror("%s: Drive 1 motor ON\n", machine().describe_context()); - - m_floppy0->mon_w(0); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::motor1_on_w ) -{ - motor1_on_r(space, offset); -} - -READ8_MEMBER( wangpc_state::motor2_off_r ) -{ - if (LOG) logerror("%s: Drive 2 motor OFF\n", machine().describe_context()); - - m_floppy1->mon_w(1); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::motor2_off_w ) -{ - motor2_off_r(space, offset); -} - -READ8_MEMBER( wangpc_state::motor2_on_r ) -{ - if (LOG) logerror("%s: Drive 2 motor ON\n", machine().describe_context()); - - m_floppy1->mon_w(0); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::motor2_on_w ) -{ - motor2_on_r(space, offset); -} - -READ8_MEMBER( wangpc_state::fdc_reset_r ) -{ - if (LOG) logerror("%s: FDC reset\n", machine().describe_context()); - - m_fdc->reset(); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::fdc_reset_w ) -{ - fdc_reset_r(space, offset); -} - -READ8_MEMBER( wangpc_state::fdc_tc_r ) -{ - if (LOG) logerror("%s: FDC TC\n", machine().describe_context()); - - m_fdc->tc_w(1); - m_fdc->tc_w(0); - - return 0xff; -} - -WRITE8_MEMBER( wangpc_state::fdc_tc_w ) -{ - fdc_tc_r(space, offset); -} - - -//------------------------------------------------- -// dma_page_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::dma_page_w ) -{ - if (LOG) logerror("%s: DMA page %u: %06x\n", machine().describe_context(), offset + 1, (data & 0x0f) << 16); - - m_dma_page[offset + 1] = data & 0x0f; -} - - -//------------------------------------------------- -// status_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::status_r ) -{ - /* - - bit description - - 0 Memory Parity Flag - 1 I/O Error Flag - 2 Unassigned - 3 FDC Interrupt Flag - 4 Door disturbed on drive 1 - 5 Door disturbed on drive 2 - 6 Door open on drive 1 - 7 Door open on drive 2 - - */ - - UINT8 data = 0x03; - - // floppy interrupts - data |= m_fdc->get_irq() << 3; - data |= m_fdc_dd0 << 4; - data |= m_fdc_dd1 << 5; - data |= m_floppy0->exists() ? 0 : 0x40; - data |= m_floppy1->exists() ? 0 : 0x80; - - return data; -} - - -//------------------------------------------------- -// timer0_int_clr_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::timer0_irq_clr_w ) -{ - //if (LOG) logerror("%s: Timer 0 IRQ clear\n", machine().describe_context()); - - m_pic->ir0_w(CLEAR_LINE); -} - - -//------------------------------------------------- -// timer2_irq_clr_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::timer2_irq_clr_r ) -{ - //if (LOG) logerror("%s: Timer 2 IRQ clear\n", machine().describe_context()); - - m_timer2_irq = 1; - check_level1_interrupts(); - - return 0xff; -} - - -//------------------------------------------------- -// nmi_mask_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::nmi_mask_w ) -{ - if (LOG) logerror("%s: NMI mask %02x\n", machine().describe_context(), data); -} - - -//------------------------------------------------- -// led_on_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::led_on_r ) -{ - if (LOG) logerror("%s: Diagnostic LED on\n", machine().describe_context()); - - output_set_led_value(LED_DIAGNOSTIC, 1); - - return 0xff; -} - - -//------------------------------------------------- -// fpu_mask_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::fpu_mask_w ) -{ - if (LOG) logerror("%s: FPU mask %02x\n", machine().describe_context(), data); -} - - -//------------------------------------------------- -// dma_eop_clr_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::dma_eop_clr_r ) -{ - if (LOG) logerror("%s: EOP clear\n", machine().describe_context()); - - m_dma_eop = 1; - - check_level2_interrupts(); - - return 0xff; -} - - -//------------------------------------------------- -// uart_tbre_clr_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::uart_tbre_clr_w ) -{ - if (LOG) logerror("%s: TBRE clear\n", machine().describe_context()); - - m_uart_tbre = 0; - - check_level2_interrupts(); -} - - -//------------------------------------------------- -// uart_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::uart_r ) -{ - m_uart_dr = 0; - - check_level2_interrupts(); - - UINT8 data = m_uart->read(space, 0); - - if (LOG) logerror("%s: UART read %02x\n", machine().describe_context(), data); - - return data; -} - - -//------------------------------------------------- -// uart_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::uart_w ) -{ - if (LOG) logerror("%s: UART write %02x\n", machine().describe_context(), data); - - switch (data) - { - case 0x10: m_led[0] = 1; break; - case 0x11: m_led[0] = 0; break; - case 0x12: m_led[1] = 1; break; - case 0x13: m_led[1] = 0; break; - case 0x14: m_led[2] = 1; break; - case 0x15: m_led[2] = 0; break; - case 0x16: m_led[3] = 1; break; - case 0x17: m_led[3] = 0; break; - case 0x18: m_led[4] = 1; break; - case 0x19: m_led[4] = 0; break; - case 0x1a: m_led[5] = 1; break; - case 0x1b: m_led[5] = 0; break; - case 0x1c: m_led[0] = m_led[1] = m_led[2] = m_led[3] = m_led[4] = m_led[5] = 1; break; - case 0x1d: m_led[0] = m_led[1] = m_led[2] = m_led[3] = m_led[4] = m_led[5] = 0; break; - } - - if (LOG) popmessage("%u%u%u%u%u%u", m_led[0], m_led[1], m_led[2], m_led[3], m_led[4], m_led[5]); - - m_uart_tbre = 0; - check_level2_interrupts(); - - m_uart->write(space, 0, data); -} - - -//------------------------------------------------- -// centronics_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::centronics_r ) -{ - m_dav = 1; - check_level1_interrupts(); - - return m_cent_data_in->read(); -} - - -//------------------------------------------------- -// centronics_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::centronics_w ) -{ - m_centronics_ack = 1; - check_level1_interrupts(); - - m_cent_data_out->write(data); - - m_centronics->write_strobe(0); - m_centronics->write_strobe(1); -} - - -//------------------------------------------------- -// busy_clr_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::busy_clr_r ) -{ - if (LOG) logerror("%s: BUSY clear\n", machine().describe_context()); - - m_centronics_busy = 1; - check_level1_interrupts(); - - return 0xff; -} - - -//------------------------------------------------- -// acknlg_clr_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::acknlg_clr_w ) -{ - if (LOG) logerror("%s: ACKNLG clear\n", machine().describe_context()); - - m_centronics_ack = 1; - check_level1_interrupts(); -} - - -//------------------------------------------------- -// led_off_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::led_off_r ) -{ - if (LOG) logerror("%s: Diagnostic LED off\n", machine().describe_context()); - - output_set_led_value(LED_DIAGNOSTIC, 0); - - return 0xff; -} - - -//------------------------------------------------- -// parity_nmi_clr_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_state::parity_nmi_clr_w ) -{ - if (LOG) logerror("%s: Parity NMI clear\n", machine().describe_context()); -} - - -//------------------------------------------------- -// option_id_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::option_id_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 FDC Interrupt Flag - - */ - - UINT8 data = 0; - - // FDC interrupt - data |= (m_fdc_dd0 || m_fdc_dd1 || (int) m_fdc->get_irq()) << 7; - - return data; -} - - - -//************************************************************************** -// ADDRESS MAPS -//************************************************************************** - -//------------------------------------------------- -// ADDRESS_MAP( wangpc_mem ) -//------------------------------------------------- - -static ADDRESS_MAP_START( wangpc_mem, AS_PROGRAM, 16, wangpc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000, 0x1ffff) AM_RAM - AM_RANGE(0x40000, 0xf3fff) AM_DEVREADWRITE(WANGPC_BUS_TAG, wangpcbus_device, mrdc_r, amwc_w) - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ADDRESS_MAP( wangpc_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( wangpc_io, AS_IO, 16, wangpc_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x1000, 0x1001) AM_WRITE8(fdc_ctrl_w, 0x00ff) - AM_RANGE(0x1004, 0x1005) AM_READWRITE8(deselect_drive1_r, deselect_drive1_w, 0x00ff) - AM_RANGE(0x1006, 0x1007) AM_READWRITE8(select_drive1_r, select_drive1_w, 0x00ff) - AM_RANGE(0x1008, 0x1009) AM_READWRITE8(deselect_drive2_r, deselect_drive2_w, 0x00ff) - AM_RANGE(0x100a, 0x100b) AM_READWRITE8(select_drive2_r, select_drive2_w, 0x00ff) - AM_RANGE(0x100c, 0x100d) AM_READWRITE8(motor1_off_r, motor1_off_w, 0x00ff) - AM_RANGE(0x100e, 0x100f) AM_READWRITE8(motor1_on_r, motor1_on_w, 0x00ff) - AM_RANGE(0x1010, 0x1011) AM_READWRITE8(motor2_off_r, motor2_off_w, 0x00ff) - AM_RANGE(0x1012, 0x1013) AM_READWRITE8(motor2_on_r, motor2_on_w, 0x00ff) - AM_RANGE(0x1014, 0x1017) AM_DEVICE8(UPD765_TAG, upd765a_device, map, 0x00ff) - AM_RANGE(0x1018, 0x1019) AM_MIRROR(0x0002) AM_READWRITE8(fdc_reset_r, fdc_reset_w, 0x00ff) - AM_RANGE(0x101c, 0x101d) AM_MIRROR(0x0002) AM_READWRITE8(fdc_tc_r, fdc_tc_w, 0x00ff) - AM_RANGE(0x1020, 0x1027) AM_DEVREADWRITE8(I8255A_TAG, i8255_device, read, write, 0x00ff) - AM_RANGE(0x1028, 0x1029) //AM_WRITE(?) - AM_RANGE(0x1040, 0x1047) AM_DEVREADWRITE8(I8253_TAG, pit8253_device, read, write, 0x00ff) - AM_RANGE(0x1060, 0x1063) AM_DEVREADWRITE8(I8259A_TAG, pic8259_device, read, write, 0x00ff) - AM_RANGE(0x1080, 0x1087) AM_DEVREAD8(SCN2661_TAG, mc2661_device, read, 0x00ff) - AM_RANGE(0x1088, 0x108f) AM_DEVWRITE8(SCN2661_TAG, mc2661_device, write, 0x00ff) - AM_RANGE(0x10a0, 0x10bf) AM_DEVREADWRITE8(AM9517A_TAG, am9517a_device, read, write, 0x00ff) - AM_RANGE(0x10c2, 0x10c7) AM_WRITE8(dma_page_w, 0x00ff) - AM_RANGE(0x10e0, 0x10e1) AM_READWRITE8(status_r, timer0_irq_clr_w, 0x00ff) - AM_RANGE(0x10e2, 0x10e3) AM_READWRITE8(timer2_irq_clr_r, nmi_mask_w, 0x00ff) - AM_RANGE(0x10e4, 0x10e5) AM_READWRITE8(led_on_r, fpu_mask_w, 0x00ff) - AM_RANGE(0x10e6, 0x10e7) AM_READWRITE8(dma_eop_clr_r, uart_tbre_clr_w, 0x00ff) - AM_RANGE(0x10e8, 0x10e9) AM_READWRITE8(uart_r, uart_w, 0x00ff) - AM_RANGE(0x10ea, 0x10eb) AM_READWRITE8(centronics_r, centronics_w, 0x00ff) - AM_RANGE(0x10ec, 0x10ed) AM_READWRITE8(busy_clr_r, acknlg_clr_w, 0x00ff) - AM_RANGE(0x10ee, 0x10ef) AM_READWRITE8(led_off_r, parity_nmi_clr_w, 0x00ff) - AM_RANGE(0x10fe, 0x10ff) AM_READ8(option_id_r, 0x00ff) - AM_RANGE(0x1100, 0x1fff) AM_DEVREADWRITE(WANGPC_BUS_TAG, wangpcbus_device, sad_r, sad_w) -ADDRESS_MAP_END - - - -//************************************************************************** -// INPUT PORTS -//************************************************************************** - -//------------------------------------------------- -// INPUT_PORTS( wangpc ) -//------------------------------------------------- - -static INPUT_PORTS_START( wangpc ) - // keyboard defined in machine/wangpckb.c - - PORT_START("SW") - PORT_DIPNAME( 0x0f, 0x0f, "CPU Baud Rate" ) PORT_DIPLOCATION("SW:1,2,3,4") - PORT_DIPSETTING( 0x0f, "19200" ) - PORT_DIPSETTING( 0x0e, "9600" ) - PORT_DIPSETTING( 0x0d, "7200" ) - PORT_DIPSETTING( 0x0c, "4800" ) - PORT_DIPSETTING( 0x0b, "3600" ) - PORT_DIPSETTING( 0x0a, "2400" ) - PORT_DIPSETTING( 0x09, "2000" ) - PORT_DIPSETTING( 0x08, "1800" ) - PORT_DIPSETTING( 0x07, "1200" ) - PORT_DIPSETTING( 0x06, "600" ) - PORT_DIPSETTING( 0x05, "300" ) - PORT_DIPSETTING( 0x04, "150" ) - PORT_DIPSETTING( 0x03, "134.5" ) - PORT_DIPSETTING( 0x02, "110" ) - PORT_DIPSETTING( 0x01, "75" ) - PORT_DIPSETTING( 0x00, "50 (Loop on Power-Up)" ) -INPUT_PORTS_END - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// I8237 -//------------------------------------------------- - -void wangpc_state::update_fdc_tc() -{ - if (m_enable_eop) - m_fdc->tc_w(m_fdc_tc); - else - m_fdc->tc_w(0); -} - -WRITE_LINE_MEMBER( wangpc_state::hrq_w ) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - m_dmac->hack_w(state); -} - -WRITE_LINE_MEMBER( wangpc_state::eop_w ) -{ - if (m_dack == 2) - { - m_fdc_tc = state; - update_fdc_tc(); - } - - if (state) - { - if (LOG) logerror("EOP set\n"); - - m_dma_eop = 0; - check_level2_interrupts(); - } - - m_bus->tc_w(state); -} - -READ8_MEMBER( wangpc_state::memr_r ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - offs_t addr = (m_dma_page[m_dack] << 16) | offset; - - return program.read_byte(addr); -} - -WRITE8_MEMBER( wangpc_state::memw_w ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - offs_t addr = (m_dma_page[m_dack] << 16) | offset; - - program.write_byte(addr, data); -} - -READ8_MEMBER( wangpc_state::ior2_r ) -{ - if (m_disable_dreq2) - return m_bus->dack_r(space, 2); - else - return m_fdc->dma_r(); -} - -WRITE8_MEMBER( wangpc_state::iow2_w ) -{ - if (m_disable_dreq2) - m_bus->dack_w(space, 2, data); - else - m_fdc->dma_w(data); -} - -WRITE_LINE_MEMBER( wangpc_state::dack0_w ) -{ - if (!state) m_dack = 0; -} - -WRITE_LINE_MEMBER( wangpc_state::dack1_w ) -{ - if (!state) m_dack = 1; -} - -WRITE_LINE_MEMBER( wangpc_state::dack2_w ) -{ - if (!state) m_dack = 2; -} - -WRITE_LINE_MEMBER( wangpc_state::dack3_w ) -{ - if (!state) m_dack = 3; -} - -//------------------------------------------------- -// pic8259_interface pic_intf -//------------------------------------------------- - -void wangpc_state::check_level1_interrupts() -{ - int state = !m_timer2_irq || m_epci->rxrdy_r() || m_epci->txemt_r() || !m_centronics_ack || !m_dav || !m_centronics_busy; - - m_pic->ir1_w(state); -} - -void wangpc_state::check_level2_interrupts() -{ - int state = !m_dma_eop || m_uart_dr || m_uart_tbre || m_fdc_dd0 || m_fdc_dd1 || m_fdc->get_irq() || m_fpu_irq || m_bus_irq2; - - m_pic->ir2_w(state); -} - -//------------------------------------------------- -// I8255A INTERFACE -//------------------------------------------------- - -READ8_MEMBER( wangpc_state::ppi_pa_r ) -{ - /* - - bit description - - 0 /POWER ON - 1 /SMART - 2 /DATA AVAILABLE - 3 SLCT - 4 BUSY - 5 /FAULT - 6 PE - 7 ACKNOWLEDGE - - */ - - UINT8 data = 0x08 | 0x02 | 0x01; - - data |= m_dav << 2; - data |= m_centronics_busy << 4; - data |= m_centronics_fault << 5; - data |= m_centronics_perror << 6; - data |= m_centronics_ack << 7; - - return data; -} - -READ8_MEMBER( wangpc_state::ppi_pb_r ) -{ - /* - - bit description - - 0 /TIMER 2 INTERRUPT - 1 /SERIAL INTERRUPT - 2 /PARALLEL PORT INTERRUPT - 3 /DMA INTERRUPT - 4 KBD INTERRUPT TRANSMIT - 5 KBD INTERRUPT RECEIVE - 6 FLOPPY DISK INTERRUPT - 7 8087 INTERRUPT - - */ - - UINT8 data = 0; - - // timer 2 interrupt - data |= m_timer2_irq; - - // serial interrupt - data |= !(m_epci->rxrdy_r() | m_epci->txemt_r()) << 1; - - // parallel port interrupt - data |= m_centronics_ack << 2; - - // DMA interrupt - data |= m_dma_eop << 3; - - // keyboard interrupt - data |= m_uart_tbre << 4; - data |= m_uart_dr << 5; - - // FDC interrupt - data |= m_fdc->get_irq() << 6; - - // 8087 interrupt - data |= m_fpu_irq << 7; - - return data; -} - -READ8_MEMBER( wangpc_state::ppi_pc_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 SW1 - 5 SW2 - 6 SW3 - 7 SW4 - - */ - - return m_sw->read() << 4; -} - -WRITE8_MEMBER( wangpc_state::ppi_pc_w ) -{ - /* - - bit description - - 0 /USR0 (pin 14) - 1 /USR1 (pin 36) - 2 /RESET (pin 31) - 3 Unassigned - 4 - 5 - 6 - 7 - - */ - - m_centronics->write_autofd(BIT(data, 0)); - m_centronics->write_select_in(BIT(data, 1)); - m_centronics->write_init(BIT(data, 2)); -} - -WRITE_LINE_MEMBER( wangpc_state::pit2_w ) -{ - if (state) - { - m_timer2_irq = 0; - check_level1_interrupts(); - } -} - -//------------------------------------------------- -// IM6402_INTERFACE( uart_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( wangpc_state::uart_dr_w ) -{ - if (state) - { - if (LOG) logerror("DR set\n"); - - m_uart_dr = 1; - check_level2_interrupts(); - } -} - -WRITE_LINE_MEMBER( wangpc_state::uart_tbre_w ) -{ - if (state) - { - if (LOG) logerror("TBRE set\n"); - - m_uart_tbre = 1; - check_level2_interrupts(); - } -} - - -//------------------------------------------------- -// SCN2661_INTERFACE( epci_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( wangpc_state::epci_irq_w ) -{ - check_level1_interrupts(); -} - - -//------------------------------------------------- -// upd765_interface fdc_intf -//------------------------------------------------- - -static SLOT_INTERFACE_START( wangpc_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( wangpc_state::floppy_formats ) - FLOPPY_PC_FORMAT -FLOPPY_FORMATS_END - -WRITE_LINE_MEMBER( wangpc_state::fdc_irq ) -{ - if (LOG) logerror("FDC INT %u\n", state); - - check_level2_interrupts(); -} - -WRITE_LINE_MEMBER( wangpc_state::fdc_drq ) -{ - if (LOG) logerror("FDC DRQ %u\n", state); - - m_fdc_drq = state; - update_fdc_drq(); -} - -void wangpc_state::update_fdc_drq() -{ - if (m_disable_dreq2) - m_dmac->dreq2_w(1); - else - m_dmac->dreq2_w(!m_fdc_drq); -} - - -//------------------------------------------------- -// centronics_interface centronics_intf -//------------------------------------------------- - -WRITE_LINE_MEMBER( wangpc_state::write_centronics_ack ) -{ - if (LOG) logerror("ACKNLG %u\n", state); - - m_centronics_ack = state; - - check_level1_interrupts(); -} - -WRITE_LINE_MEMBER( wangpc_state::write_centronics_busy ) -{ - if (LOG) logerror("BUSY %u\n", state); - - m_centronics_busy = state; - - check_level1_interrupts(); -} - -WRITE_LINE_MEMBER( wangpc_state::write_centronics_fault ) -{ - m_centronics_fault = state; -} - -WRITE_LINE_MEMBER( wangpc_state::write_centronics_perror ) -{ - m_centronics_perror = state; -} - -//------------------------------------------------- -// WANGPC_BUS_INTERFACE( kb_intf ) -//------------------------------------------------- - -WRITE_LINE_MEMBER( wangpc_state::bus_irq2_w ) -{ - if (LOG) logerror("Bus IRQ2 %u\n", state); - - m_bus_irq2 = state; - - check_level2_interrupts(); -} - - - -//************************************************************************** -// MACHINE INITIALIZATION -//************************************************************************** - -//------------------------------------------------- -// MACHINE_START( wangpc ) -//------------------------------------------------- - -void wangpc_state::machine_start() -{ - // connect floppy callbacks - m_floppy0->setup_load_cb(floppy_image_device::load_cb(FUNC(wangpc_state::on_disk0_load), this)); - m_floppy0->setup_unload_cb(floppy_image_device::unload_cb(FUNC(wangpc_state::on_disk0_unload), this)); - m_floppy1->setup_load_cb(floppy_image_device::load_cb(FUNC(wangpc_state::on_disk1_load), this)); - m_floppy1->setup_unload_cb(floppy_image_device::unload_cb(FUNC(wangpc_state::on_disk1_unload), this)); - - // state saving - save_item(NAME(m_dma_page)); - save_item(NAME(m_dack)); - save_item(NAME(m_timer2_irq)); - save_item(NAME(m_centronics_ack)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_fault)); - save_item(NAME(m_centronics_perror)); - save_item(NAME(m_dav)); - save_item(NAME(m_dma_eop)); - save_item(NAME(m_uart_dr)); - save_item(NAME(m_uart_tbre)); - save_item(NAME(m_fpu_irq)); - save_item(NAME(m_bus_irq2)); - save_item(NAME(m_enable_eop)); - save_item(NAME(m_disable_dreq2)); - save_item(NAME(m_fdc_drq)); - save_item(NAME(m_ds1)); - save_item(NAME(m_ds2)); -} - - -void wangpc_state::machine_reset() -{ - // initialize UART - m_uart->cls1_w(1); - m_uart->cls2_w(1); - m_uart->pi_w(1); - m_uart->sbs_w(1); - m_uart->crl_w(1); -} - - -//------------------------------------------------- -// on_disk0_change - -//------------------------------------------------- - -int wangpc_state::on_disk0_load(floppy_image_device *image) -{ - on_disk0_unload(image); - - return IMAGE_INIT_PASS; -} - -void wangpc_state::on_disk0_unload(floppy_image_device *image) -{ - if (LOG) logerror("Door 1 disturbed\n"); - - m_fdc_dd0 = 1; - check_level2_interrupts(); -} - - -//------------------------------------------------- -// on_disk1_change - -//------------------------------------------------- - -int wangpc_state::on_disk1_load(floppy_image_device *image) -{ - on_disk1_unload(image); - - return IMAGE_INIT_PASS; -} - -void wangpc_state::on_disk1_unload(floppy_image_device *image) -{ - if (LOG) logerror("Door 2 disturbed\n"); - - m_fdc_dd1 = 1; - check_level2_interrupts(); -} - - - -//************************************************************************** -// MACHINE DRIVERS -//************************************************************************** - -//------------------------------------------------- -// MACHINE_CONFIG( wangpc ) -//------------------------------------------------- - -static MACHINE_CONFIG_START( wangpc, wangpc_state ) - MCFG_CPU_ADD(I8086_TAG, I8086, 8000000) - MCFG_CPU_PROGRAM_MAP(wangpc_mem) - MCFG_CPU_IO_MAP(wangpc_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(I8259A_TAG, pic8259_device, inta_cb) - //MCFG_QUANTUM_PERFECT_CPU(I8086_TAG) - - // devices - MCFG_DEVICE_ADD(AM9517A_TAG, AM9517A, 4000000) - MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(wangpc_state, hrq_w)) - MCFG_AM9517A_OUT_EOP_CB(WRITELINE(wangpc_state, eop_w)) - MCFG_AM9517A_IN_MEMR_CB(READ8(wangpc_state, memr_r)) - MCFG_AM9517A_OUT_MEMW_CB(WRITE8(wangpc_state, memw_w)) - MCFG_AM9517A_IN_IOR_1_CB(DEVREAD8(WANGPC_BUS_TAG, wangpcbus_device, dack1_r)) - MCFG_AM9517A_IN_IOR_2_CB(READ8(wangpc_state, ior2_r)) - MCFG_AM9517A_IN_IOR_3_CB(DEVREAD8(WANGPC_BUS_TAG, wangpcbus_device, dack3_r)) - MCFG_AM9517A_OUT_IOW_1_CB(DEVWRITE8(WANGPC_BUS_TAG, wangpcbus_device, dack1_w)) - MCFG_AM9517A_OUT_IOW_2_CB(WRITE8(wangpc_state, iow2_w)) - MCFG_AM9517A_OUT_IOW_3_CB(DEVWRITE8(WANGPC_BUS_TAG, wangpcbus_device, dack3_w)) - MCFG_AM9517A_OUT_DACK_0_CB(WRITELINE(wangpc_state, dack0_w)) - MCFG_AM9517A_OUT_DACK_1_CB(WRITELINE(wangpc_state, dack1_w)) - MCFG_AM9517A_OUT_DACK_2_CB(WRITELINE(wangpc_state, dack2_w)) - MCFG_AM9517A_OUT_DACK_3_CB(WRITELINE(wangpc_state, dack3_w)) - - MCFG_PIC8259_ADD(I8259A_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(wangpc_state, ppi_pa_r)) - MCFG_I8255_IN_PORTB_CB(READ8(wangpc_state, ppi_pb_r)) - MCFG_I8255_IN_PORTC_CB(READ8(wangpc_state, ppi_pc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(wangpc_state, ppi_pc_w)) - - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(500000) - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE(I8259A_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(2000000) - MCFG_PIT8253_CLK2(500000) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(wangpc_state, pit2_w)) - - MCFG_IM6402_ADD(IM6402_TAG, 0, 62500*16) // HACK for wangpckb in IM6402 derives clocks from data line - MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(WANGPC_KEYBOARD_TAG, wangpc_keyboard_device, write_rxd)) - MCFG_IM6402_DR_CALLBACK(WRITELINE(wangpc_state, uart_dr_w)) - MCFG_IM6402_TBRE_CALLBACK(WRITELINE(wangpc_state, uart_tbre_w)) - - MCFG_DEVICE_ADD(SCN2661_TAG, MC2661, 0) - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_MC2661_RXRDY_HANDLER(WRITELINE(wangpc_state, epci_irq_w)) - MCFG_MC2661_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_MC2661_TXEMT_DSCHG_HANDLER(WRITELINE(wangpc_state, epci_irq_w)) - - MCFG_UPD765A_ADD(UPD765_TAG, false, false) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(wangpc_state, fdc_irq)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE(wangpc_state, fdc_drq)) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", wangpc_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", wangpc_floppies, "525dd", wangpc_state::floppy_formats) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(wangpc_state, write_centronics_ack)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(wangpc_state, write_centronics_busy)) - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(wangpc_state, write_centronics_fault)) - MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(wangpc_state, write_centronics_perror)) - - MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(SCN2661_TAG, mc2661_device, rx_w)) - - MCFG_DEVICE_ADD(WANGPC_KEYBOARD_TAG, WANGPC_KEYBOARD, 0) - MCFG_WANGPCKB_TXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri)) - - // bus - MCFG_WANGPC_BUS_ADD() - MCFG_WANGPC_BUS_IRQ2_CALLBACK(WRITELINE(wangpc_state, bus_irq2_w)) - MCFG_WANGPC_BUS_IRQ3_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir3_w)) - MCFG_WANGPC_BUS_IRQ4_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir4_w)) - MCFG_WANGPC_BUS_IRQ5_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir5_w)) - MCFG_WANGPC_BUS_IRQ6_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir6_w)) - MCFG_WANGPC_BUS_IRQ7_CALLBACK(DEVWRITELINE(I8259A_TAG, pic8259_device, ir7_w)) - MCFG_WANGPC_BUS_DRQ1_CALLBACK(DEVWRITELINE(AM9517A_TAG, am9517a_device, dreq1_w)) - MCFG_WANGPC_BUS_DRQ2_CALLBACK(DEVWRITELINE(AM9517A_TAG, am9517a_device, dreq2_w)) - MCFG_WANGPC_BUS_DRQ3_CALLBACK(DEVWRITELINE(AM9517A_TAG, am9517a_device, dreq3_w)) - MCFG_WANGPC_BUS_IOERROR_CALLBACK(INPUTLINE(I8086_TAG, INPUT_LINE_NMI)) - MCFG_WANGPC_BUS_SLOT_ADD("slot1", 1, wangpc_cards, NULL) - MCFG_WANGPC_BUS_SLOT_ADD("slot2", 2, wangpc_cards, "mvc") - MCFG_WANGPC_BUS_SLOT_ADD("slot3", 3, wangpc_cards, NULL) - MCFG_WANGPC_BUS_SLOT_ADD("slot4", 4, wangpc_cards, NULL) - MCFG_WANGPC_BUS_SLOT_ADD("slot5", 5, wangpc_cards, NULL) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - - // software list - MCFG_SOFTWARE_LIST_ADD("flop_list", "wangpc") -MACHINE_CONFIG_END - - - -//************************************************************************** -// ROM DEFINITIONS -//************************************************************************** - -//------------------------------------------------- -// ROM( wangpc ) -//------------------------------------------------- - -ROM_START( wangpc ) - ROM_REGION16_LE( 0x4000, I8086_TAG, 0) - ROM_LOAD16_BYTE( "0001 r2.l94", 0x0001, 0x2000, CRC(f9f41304) SHA1(1815295809ef11573d724ede47446f9ac7aee713) ) - ROM_LOAD16_BYTE( "379-0000 r2.l115", 0x0000, 0x2000, CRC(67b37684) SHA1(70d9f68eb88cc2bc9f53f949cc77411c09a4266e) ) -ROM_END - - - -//************************************************************************** -// GAME DRIVERS -//************************************************************************** - -COMP( 1985, wangpc, 0, 0, wangpc, wangpc, driver_device, 0, "Wang Laboratories", "Wang Professional Computer", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/wicat.c b/src/mess/drivers/wicat.c deleted file mode 100644 index b9bba8cd301..00000000000 --- a/src/mess/drivers/wicat.c +++ /dev/null @@ -1,989 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert, Barry Rodewald -/*************************************************************************** - -Wicat - various systems. - -2013-09-01 Skeleton driver - -****************************************************************************/ - -/* - - TODO: - - - video DMA is done line by line and needs to be in perfect sync - -*/ - -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "cpu/z8000/z8000.h" -#include "cpu/8x300/8x300.h" -#include "machine/6522via.h" -#include "machine/mm58274c.h" -#include "machine/mc2661.h" -#include "machine/im6402.h" -#include "video/i8275.h" -#include "machine/am9517a.h" -#include "machine/x2212.h" -#include "machine/wd_fdc.h" -#include "wicat.lh" - -class wicat_state : public driver_device -{ -public: - wicat_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_vram(*this, "vram"), - m_maincpu(*this, "maincpu"), - m_rtc(*this, "rtc"), - m_via(*this, "via"), - m_uart0(*this,"uart0"), - m_uart1(*this,"uart1"), - m_uart2(*this,"uart2"), - m_uart3(*this,"uart3"), - m_uart4(*this,"uart4"), - m_uart5(*this,"uart5"), - m_uart6(*this,"uart6"), - m_videocpu(*this,"videocpu"), - m_videoctrl(*this,"video"), - m_videodma(*this,"videodma"), - m_videouart0(*this,"videouart0"), - m_videouart1(*this,"videouart1"), - m_videouart(*this,"videouart"), - m_videosram(*this,"vsram"), - m_palette(*this, "palette"), - m_chargen(*this,"g2char"), - m_fdc(*this,"fdc") - { - } - - DECLARE_READ16_MEMBER(invalid_r); - DECLARE_WRITE16_MEMBER(invalid_w); - DECLARE_READ16_MEMBER(memmap_r); - DECLARE_WRITE16_MEMBER(memmap_w); - DECLARE_WRITE16_MEMBER(parallel_led_w); - DECLARE_WRITE8_MEMBER(via_a_w); - DECLARE_WRITE8_MEMBER(via_b_w); - DECLARE_READ8_MEMBER(video_r); - DECLARE_WRITE8_MEMBER(video_w); - DECLARE_READ8_MEMBER(video_dma_r); - DECLARE_WRITE8_MEMBER(video_dma_w); - DECLARE_READ8_MEMBER(video_uart0_r); - DECLARE_WRITE8_MEMBER(video_uart0_w); - DECLARE_READ8_MEMBER(video_uart1_r); - DECLARE_WRITE8_MEMBER(video_uart1_w); - DECLARE_READ8_MEMBER(videosram_r); - DECLARE_WRITE8_MEMBER(videosram_w); - DECLARE_WRITE8_MEMBER(videosram_store_w); - DECLARE_WRITE8_MEMBER(videosram_recall_w); - DECLARE_READ8_MEMBER(video_timer_r); - DECLARE_WRITE8_MEMBER(video_timer_w); - DECLARE_READ8_MEMBER(vram_r); - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_READ8_MEMBER(video_ctrl_r); - DECLARE_WRITE8_MEMBER(video_ctrl_w); - DECLARE_READ8_MEMBER(video_status_r); - DECLARE_WRITE_LINE_MEMBER(dma_hrq_w); - DECLARE_WRITE_LINE_MEMBER(dma_nmi_cb); - DECLARE_WRITE_LINE_MEMBER(crtc_cb); - DECLARE_READ8_MEMBER(hdc_r); - DECLARE_WRITE8_MEMBER(hdc_w); - DECLARE_READ8_MEMBER(fdc_r); - DECLARE_WRITE8_MEMBER(fdc_w); - DECLARE_READ16_MEMBER(via_r); - DECLARE_WRITE16_MEMBER(via_w); - DECLARE_WRITE_LINE_MEMBER(kb_data_ready); - I8275_DRAW_CHARACTER_MEMBER(wicat_display_pixels); - - required_shared_ptr m_vram; - required_device m_maincpu; - required_device m_rtc; - required_device m_via; - required_device m_uart0; - required_device m_uart1; - required_device m_uart2; - required_device m_uart3; - required_device m_uart4; - required_device m_uart5; - required_device m_uart6; - required_device m_videocpu; - required_device m_videoctrl; - required_device m_videodma; - required_device m_videouart0; - required_device m_videouart1; - required_device m_videouart; - required_device m_videosram; - required_device m_palette; - required_memory_region m_chargen; - required_device m_fdc; - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; } - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - -private: - virtual void machine_start(); - virtual void machine_reset(); - virtual void driver_start(); - - void poll_kb(); - void send_key(UINT8 val); - - emu_timer* m_video_timer; - emu_timer* m_kb_timer; - emu_timer* m_kb_serial_timer; - static const device_timer_id VIDEO_TIMER = 0; - static const device_timer_id KB_TIMER = 1; - static const device_timer_id KB_SERIAL_TIMER = 2; - - UINT8 m_portA; - UINT8 m_portB; - bool m_video_timer_irq; - bool m_video_kb_irq; - UINT8 m_nmi_enable; - UINT8 m_crtc_irq; - UINT16 m_kb_data; - UINT8 m_kb_bit; - UINT32 m_kb_keys[8]; -}; - - -static ADDRESS_MAP_START(wicat_mem, AS_PROGRAM, 16, wicat_state) - ADDRESS_MAP_UNMAP_LOW - ADDRESS_MAP_GLOBAL_MASK(0xffffff) - AM_RANGE(0x000000, 0x001fff) AM_ROM AM_REGION("c2", 0x0000) - AM_RANGE(0x020000, 0x1fffff) AM_RAM - AM_RANGE(0x200000, 0x2fffff) AM_RAM - AM_RANGE(0x300000, 0xdfffff) AM_READWRITE(invalid_r,invalid_w) - AM_RANGE(0xeff800, 0xeffbff) AM_RAM // memory mapping SRAM, used during boot sequence for storing various data (TODO) - AM_RANGE(0xeffc00, 0xeffc01) AM_READWRITE(memmap_r,memmap_w) - AM_RANGE(0xf00000, 0xf00007) AM_DEVREADWRITE8("uart0",mc2661_device,read,write,0xff00) // UARTs - AM_RANGE(0xf00008, 0xf0000f) AM_DEVREADWRITE8("uart1",mc2661_device,read,write,0xff00) - AM_RANGE(0xf00010, 0xf00017) AM_DEVREADWRITE8("uart2",mc2661_device,read,write,0xff00) - AM_RANGE(0xf00018, 0xf0001f) AM_DEVREADWRITE8("uart3",mc2661_device,read,write,0xff00) - AM_RANGE(0xf00020, 0xf00027) AM_DEVREADWRITE8("uart4",mc2661_device,read,write,0xff00) - AM_RANGE(0xf00028, 0xf0002f) AM_DEVREADWRITE8("uart5",mc2661_device,read,write,0xff00) - AM_RANGE(0xf00030, 0xf00037) AM_DEVREADWRITE8("uart6",mc2661_device,read,write,0xff00) - AM_RANGE(0xf00040, 0xf0005f) AM_READWRITE(via_r, via_w) - AM_RANGE(0xf00060, 0xf0007f) AM_DEVREADWRITE8("rtc",mm58274c_device,read,write,0xff00) - AM_RANGE(0xf000d0, 0xf000d1) AM_WRITE(parallel_led_w) - AM_RANGE(0xf00180, 0xf0018f) AM_READWRITE8(hdc_r,hdc_w,0xffff) // WD1000 - AM_RANGE(0xf00190, 0xf0019f) AM_READWRITE8(fdc_r,fdc_w,0xffff) // FD1795 - AM_RANGE(0xf00f00, 0xf00fff) AM_READWRITE(invalid_r,invalid_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(wicat_video_mem, AS_PROGRAM, 16, wicat_state) - AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("g1", 0x0000) - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(wicat_video_io, AS_IO, 8, wicat_state) - // these are largely wild guesses... - AM_RANGE(0x0000,0x0003) AM_READWRITE(video_timer_r,video_timer_w) // some sort of timer? - AM_RANGE(0x0100,0x0107) AM_READWRITE(video_uart0_r,video_uart0_w) // INS2651 UART #1 - AM_RANGE(0x0200,0x0207) AM_READWRITE(video_uart1_r,video_uart1_w) // INS2651 UART #2 - AM_RANGE(0x0304,0x0304) AM_READ(video_status_r) - AM_RANGE(0x0400,0x047f) AM_READWRITE(videosram_r,videosram_w) // XD2210 4-bit NOVRAM - AM_RANGE(0x0500,0x0500) AM_WRITE(videosram_recall_w) - AM_RANGE(0x0600,0x0600) AM_WRITE(videosram_store_w) - AM_RANGE(0x0800,0x080f) AM_READWRITE(video_ctrl_r,video_ctrl_w) - AM_RANGE(0x0a00,0x0a1f) AM_READWRITE(video_dma_r,video_dma_w) // AM9517A DMA - AM_RANGE(0x0b00,0x0b03) AM_READWRITE(video_r,video_w) // i8275 CRTC - AM_RANGE(0x0e00,0x0eff) AM_RAM - AM_RANGE(0x4000,0x5fff) AM_RAM AM_SHARE("vram") // video RAM? - AM_RANGE(0x8000,0x8fff) AM_ROM AM_REGION("g2char",0x0000) - AM_RANGE(0x9000,0x9fff) AM_ROM AM_REGION("g2char",0x0000) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(wicat_wd1000_mem, AS_PROGRAM, 16, wicat_state) - AM_RANGE(0x0000, 0x17ff) AM_ROM AM_REGION("wd3", 0x0000) - AM_RANGE(0x1800, 0x1fff) AM_NOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START(wicat_wd1000_io, AS_IO, 8, wicat_state) - AM_RANGE(0x0000, 0x00ff) AM_RAM // left bank - RAM - AM_RANGE(0x0100, 0x01ff) AM_RAM // right bank - I/O ports (TODO) -ADDRESS_MAP_END - - -/* Input ports */ -static INPUT_PORTS_START( wicat ) - PORT_START("kb0") - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(7) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Retrn") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("kb1") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - - PORT_START("kb2") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - - PORT_START("kb3") - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Unknown (7F)") PORT_CODE(KEYCODE_F4) - - PORT_START("kb4") - - PORT_START("kb5") - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Unknown (AA)") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Unknown (B0)") PORT_CODE(KEYCODE_F3) - - PORT_START("kb6") - - PORT_START("kb7") - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Set-up (FE)") PORT_CODE(KEYCODE_F1) - -INPUT_PORTS_END - -void wicat_state::driver_start() -{ - m_video_timer = timer_alloc(VIDEO_TIMER); - m_kb_timer = timer_alloc(KB_TIMER); - m_kb_serial_timer = timer_alloc(KB_SERIAL_TIMER); -} - -void wicat_state::machine_start() -{ -} - -void wicat_state::machine_reset() -{ - // on the terminal board /DCD on both INS2651s are tied to GND - m_videouart0->dcd_w(0); - m_videouart1->dcd_w(0); - m_uart0->dcd_w(0); - m_uart1->dcd_w(0); - m_uart2->dcd_w(0); - m_uart3->dcd_w(0); - m_uart4->dcd_w(0); - m_uart5->dcd_w(0); - - // initialise im6402 (terminal board) - m_videouart->cls1_w(1); - m_videouart->cls2_w(1); - m_videouart->pi_w(1); - m_videouart->sbs_w(0); - m_videouart->crl_w(1); - - m_video_timer_irq = false; - m_video_kb_irq = false; - m_video_timer->adjust(attotime::zero,0,attotime::from_hz(60)); - m_kb_timer->adjust(attotime::zero,0,attotime::from_msec(50)); - m_nmi_enable = 0; - m_crtc_irq = CLEAR_LINE; - for(int x=0;x<8;x++) - m_kb_keys[x] = 0; -} - -void wicat_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case VIDEO_TIMER: - m_video_timer_irq = true; - m_videocpu->set_input_line(INPUT_LINE_IRQ0,ASSERT_LINE); - break; - case KB_TIMER: - poll_kb(); - break; - case KB_SERIAL_TIMER: - m_videouart->write_rri((m_kb_data >> (m_kb_bit)) & 0x01); - m_kb_bit++; - if(m_kb_bit > 10) - { - m_kb_serial_timer->reset(); - } - break; - } -} - -void wicat_state::poll_kb() -{ - UINT8 line; - UINT8 val = 0; - UINT8 x; - UINT32 data; - char kbtag[8]; - - for(line=0;line<8;line++) - { - sprintf(kbtag,"kb%i",line); - data = ioport(kbtag)->read(); - for(x=0;x<32;x++) - { - if((data & (1<adjust(attotime::zero,0,attotime::from_hz(1200)); -} - -WRITE16_MEMBER( wicat_state::parallel_led_w ) -{ - // bit 0 - parallel port A direction (0 = input) - // bit 1 - parallel port B direction (0 = input) - output_set_value("led1",data & 0x0400); - output_set_value("led2",data & 0x0800); - output_set_value("led3",data & 0x1000); - output_set_value("led4",data & 0x2000); - output_set_value("led5",data & 0x4000); - output_set_value("led6",data & 0x8000); -} - -WRITE8_MEMBER( wicat_state::via_a_w ) -{ - m_portA = data; - logerror("VIA: write %02x to port A\n",data); -} - -WRITE8_MEMBER( wicat_state::via_b_w ) -{ - m_portB = data; - logerror("VIA: write %02x to port B\n",data); -} - -READ16_MEMBER( wicat_state::invalid_r ) -{ - if(!space.debugger_access()) - { - m_maincpu->set_buserror_details(0x300000+offset*2-2,0,m_maincpu->get_fc()); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - } - return 0xff; -} - -WRITE16_MEMBER( wicat_state::invalid_w ) -{ - if(!space.debugger_access()) - { - m_maincpu->set_buserror_details(0x300000+offset*2-2,1,m_maincpu->get_fc()); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - } -} - -// TODO -READ16_MEMBER(wicat_state::memmap_r) -{ - popmessage("Memory mapping register EFFC01 read!"); - return 0xff; -} - -WRITE16_MEMBER(wicat_state::memmap_w) -{ - popmessage("Memory mapping register EFFC01 written!"); -} - -// WD1000 Winchester Disk controller (10MB 5 1/4" HD) -// for now, we'll just try to tell the system there is no HD -READ8_MEMBER(wicat_state::hdc_r) -{ - switch(offset) - { - case 0x00: // Error register - return 0x00; - case 0x06: // Status register - return 0x05; - } - return 0x00; -} - -WRITE8_MEMBER(wicat_state::hdc_w) -{ - switch(offset) - { - case 0x00: // Write precomp / Error register - logerror("HDC: Write precomp %02x\n",data); - break; - case 0x01: // Data register - logerror("HDC: Data %02x\n",data); - break; - case 0x02: // Sector Number - logerror("HDC: Sector Number %02x\n",data); - break; - case 0x03: // Sector Count - logerror("HDC: Sector Count %02x\n",data); - break; - case 0x04: // Cylinder High - logerror("HDC: Cylinder High %02x\n",data); - break; - case 0x05: // Cylinder Low - logerror("HDC: Cylinder Low %02x\n",data); - break; - case 0x06: // Command register - logerror("HDC: Command %1x\n",(data & 0xf0) >> 4); - m_maincpu->set_input_line(M68K_IRQ_5,HOLD_LINE); - break; - case 0x07: // Size / Drive / Head - logerror("HDC: Size / Drive / Head %02x\n",data); - break; - case 0x0c: // DMA bits 9-16 - logerror("HDC: DMA address mid %02x\n",data); - break; - case 0x0d: // DMA bits 1-8 (bit 0 cannot be set) - logerror("HDC: DMA address low %02x\n",data); - break; - case 0x0e: // DMA R/W - logerror("HDC: DMA R/W %02x\n",data); - break; - case 0x0f: // DMA bits 17-23 - logerror("HDC: DMA address high %02x\n",data); - break; - default: - logerror("HDC: Write to unknown register %02x\n",data); - } -} - -READ8_MEMBER(wicat_state::fdc_r) -{ - UINT8 ret = 0x00; - - popmessage("FDC: read offset %02x",offset); - switch(offset) - { - case 0x00: - ret = m_fdc->status_r(space,0); - break; - case 0x01: - ret = m_fdc->track_r(space,0); - break; - case 0x02: - ret = m_fdc->sector_r(space,0); - break; - case 0x03: - ret = m_fdc->data_r(space,0); - break; - case 0x08: - // Interrupt status (TODO, not part of the FD1795) - break; - } - return ret; -} - -WRITE8_MEMBER(wicat_state::fdc_w) -{ - popmessage("FDC: write offset %02x data %02x",offset,data); - switch(offset) - { - case 0x00: - m_fdc->cmd_w(space,0,data); - break; - case 0x01: - m_fdc->track_w(space,0,data); - break; - case 0x02: - m_fdc->sector_w(space,0,data); - break; - case 0x03: - m_fdc->data_w(space,0,data); - break; - case 0x08: - // Interrupt disable / Drive select (TODO, not part of the FD1795) - break; - } -} - -READ16_MEMBER(wicat_state::via_r) -{ - if(ACCESSING_BITS_0_7) - return m_via->read(space,offset); - return 0x00; -} - -WRITE16_MEMBER(wicat_state::via_w) -{ - if(ACCESSING_BITS_0_7) - m_via->write(space,offset,data); - else if(ACCESSING_BITS_8_15) - m_via->write(space,offset,data>>8); -} - -READ8_MEMBER(wicat_state::video_r) -{ - switch(offset) - { - case 0x00: - return m_videoctrl->read(space,0); - case 0x02: - return m_videoctrl->read(space,1); - default: - return 0xff; - } -} - -WRITE8_MEMBER(wicat_state::video_w) -{ - switch(offset) - { - case 0x00: - m_videoctrl->write(space,0,data); - break; - case 0x02: - m_videoctrl->write(space,1,data); - break; - } -} - -READ8_MEMBER( wicat_state::vram_r ) -{ - return m_videocpu->space(AS_IO).read_byte(offset*2); -} - -WRITE8_MEMBER( wicat_state::vram_w ) -{ - m_videocpu->space(AS_IO).write_byte(offset*2,data); -} - -READ8_MEMBER(wicat_state::video_dma_r) -{ - return m_videodma->read(space,offset/2); -} - -WRITE8_MEMBER(wicat_state::video_dma_w) -{ - if(!(offset & 0x01)) - m_videodma->write(space,offset/2,data); -} - -READ8_MEMBER(wicat_state::video_uart0_r) -{ - UINT16 noff = offset >> 1; - return m_videouart0->read(space,noff); -} - -WRITE8_MEMBER(wicat_state::video_uart0_w) -{ - UINT16 noff = offset >> 1; - m_videouart0->write(space,noff,data); -} - -READ8_MEMBER(wicat_state::video_uart1_r) -{ - UINT16 noff = offset >> 1; - return m_videouart1->read(space,noff); -} - -WRITE8_MEMBER(wicat_state::video_uart1_w) -{ - UINT16 noff = offset >> 1; - m_videouart1->write(space,noff,data); -} - -// XD2210 64 x 4bit NOVRAM -READ8_MEMBER(wicat_state::videosram_r) -{ - if(offset & 0x01) - return 0xff; - else - return m_videosram->read(space,offset/2); -} - -WRITE8_MEMBER(wicat_state::videosram_w) -{ - if(!(offset & 0x01)) - m_videosram->write(space,offset/2,data); -} - -WRITE8_MEMBER(wicat_state::videosram_store_w) -{ - if(data & 0x01) // unsure of the actual bit checked, the terminal code just writes 0xff - { - m_videosram->store(1); - m_videosram->store(0); - logerror("XD2210: Store triggered.\n"); - } -} - -WRITE8_MEMBER(wicat_state::videosram_recall_w) -{ - if(data & 0x01) // unsure of the actual bit checked, the terminal code just writes 0xff - { - m_videosram->recall(1); - m_videosram->recall(0); - logerror("XD2210: Store triggered.\n"); - } -} - -READ8_MEMBER(wicat_state::video_timer_r) -{ - UINT8 ret = 0x00; - - if(offset == 0x00) - { - if(m_video_timer_irq) - { - ret |= 0x08; - m_video_timer_irq = false; - m_videocpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE); - } - if(m_video_kb_irq) - { - ret |= 0x10; - m_video_kb_irq = false; - m_videocpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE); - } - } - if(offset == 0x02) - return m_videouart->read(space,0); - return ret; -} - -WRITE8_MEMBER(wicat_state::video_timer_w) -{ - logerror("I/O port 0x%04x write %02x\n",offset,data); - if(offset == 0x02) - m_videouart->write(space,0,data); -} - -READ8_MEMBER(wicat_state::video_ctrl_r) -{ - return 0x00; // TODO -} - -WRITE8_MEMBER(wicat_state::video_ctrl_w) -{ - if(offset == 0x07) - m_nmi_enable = data; -} - -READ8_MEMBER(wicat_state::video_status_r) -{ - // this port is read in the NVI IRQ routine, which if bit 2 is set, will unmask DMA channel 0. But no idea what triggers it... - if(m_crtc_irq == ASSERT_LINE) - { - m_crtc_irq = CLEAR_LINE; - m_videocpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE); - return 0x04; - } - else - return 0x00; -} - -WRITE_LINE_MEMBER(wicat_state::dma_hrq_w) -{ - m_videocpu->set_input_line(INPUT_LINE_HALT,state ? ASSERT_LINE : CLEAR_LINE); - m_videodma->hack_w(state); -} - -WRITE_LINE_MEMBER(wicat_state::dma_nmi_cb) -{ - if(state) - { - if(m_nmi_enable != 0) - m_videocpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); - } -} - -WRITE_LINE_MEMBER(wicat_state::kb_data_ready) -{ - m_video_kb_irq = state ? ASSERT_LINE : CLEAR_LINE; - m_videocpu->set_input_line(INPUT_LINE_IRQ0,m_video_kb_irq); -} - -WRITE_LINE_MEMBER(wicat_state::crtc_cb) -{ - m_crtc_irq = state ? ASSERT_LINE : CLEAR_LINE; - m_videocpu->set_input_line(INPUT_LINE_IRQ0,m_crtc_irq); -} - -I8275_DRAW_CHARACTER_MEMBER(wicat_state::wicat_display_pixels) -{ - UINT8 romdata = m_chargen->base()[((charcode << 4) | linecount) + 1]; - const pen_t *pen = m_palette->pens(); - - for (int i = 0; i < 8; i++) - { - int color = (romdata >> (7-i)) & 0x01; - - if(vsp || linecount > 9) - color = 0; - - bitmap.pix32(y, x + i) = pen[color]; - } -} - -static MACHINE_CONFIG_START( wicat, wicat_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, XTAL_8MHz) - MCFG_CPU_PROGRAM_MAP(wicat_mem) - - MCFG_DEVICE_ADD("via", VIA6522, XTAL_8MHz) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(wicat_state, via_a_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(wicat_state, via_b_w)) - MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M68K_IRQ_1)) - - MCFG_DEVICE_ADD("rtc", MM58274C, 0) // actually an MM58174AN, but should be compatible - MCFG_MM58274C_MODE24(0) // 12 hour - MCFG_MM58274C_DAY1(1) // monday - - // internal terminal - MCFG_DEVICE_ADD("uart0", MC2661, XTAL_5_0688MHz) // connected to terminal board - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("videouart0", mc2661_device, rx_w)) - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("videouart0", mc2661_device, cts_w)) - MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("videouart0", mc2661_device, dsr_w)) - - // RS232C ports (x5) - MCFG_DEVICE_ADD("uart1", MC2661, XTAL_5_0688MHz) - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial1", rs232_port_device, write_txd)) - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial1", rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial1", rs232_port_device, write_dtr)) - MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - - MCFG_DEVICE_ADD("uart2", MC2661, XTAL_5_0688MHz) - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial2", rs232_port_device, write_txd)) - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial2", rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial2", rs232_port_device, write_dtr)) - - MCFG_DEVICE_ADD("uart3", MC2661, XTAL_5_0688MHz) - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial3", rs232_port_device, write_txd)) - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial3", rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial3", rs232_port_device, write_dtr)) - MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - - MCFG_DEVICE_ADD("uart4", MC2661, XTAL_5_0688MHz) - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial4", rs232_port_device, write_txd)) - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial4", rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial4", rs232_port_device, write_dtr)) - MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - - MCFG_DEVICE_ADD("uart5", MC2661, XTAL_5_0688MHz) - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("serial5", rs232_port_device, write_txd)) - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("serial5", rs232_port_device, write_rts)) - MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("serial5", rs232_port_device, write_dtr)) - MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - - // modem - MCFG_DEVICE_ADD("uart6", MC2661, XTAL_5_0688MHz) // connected to modem port - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - MCFG_MC2661_TXEMT_DSCHG_HANDLER(INPUTLINE("maincpu", M68K_IRQ_2)) - - MCFG_RS232_PORT_ADD("serial1",default_rs232_devices,NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart1",mc2661_device,rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart1",mc2661_device,dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart1",mc2661_device,dsr_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart1",mc2661_device,cts_w)) - - MCFG_RS232_PORT_ADD("serial2",default_rs232_devices,NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart2",mc2661_device,rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart2",mc2661_device,dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart2",mc2661_device,dsr_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart2",mc2661_device,cts_w)) - - MCFG_RS232_PORT_ADD("serial3",default_rs232_devices,NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart3",mc2661_device,rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart3",mc2661_device,dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart3",mc2661_device,dsr_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart3",mc2661_device,cts_w)) - - MCFG_RS232_PORT_ADD("serial4",default_rs232_devices,NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart4",mc2661_device,rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart4",mc2661_device,dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart4",mc2661_device,dsr_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart4",mc2661_device,cts_w)) - - MCFG_RS232_PORT_ADD("serial5",default_rs232_devices,NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart5",mc2661_device,rx_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart5",mc2661_device,dcd_w)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart5",mc2661_device,dsr_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart5",mc2661_device,cts_w)) - - /* video hardware */ - MCFG_CPU_ADD("videocpu",Z8002,XTAL_8MHz/2) // AMD AMZ8002DC - MCFG_CPU_PROGRAM_MAP(wicat_video_mem) - MCFG_CPU_IO_MAP(wicat_video_io) - - MCFG_DEVICE_ADD("videodma", AM9517A, XTAL_8MHz) // clock is a bit of guess - MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(wicat_state, dma_hrq_w)) - MCFG_AM9517A_OUT_EOP_CB(WRITELINE(wicat_state, dma_nmi_cb)) - MCFG_AM9517A_IN_MEMR_CB(READ8(wicat_state, vram_r)) - MCFG_AM9517A_OUT_MEMW_CB(WRITE8(wicat_state, vram_w)) - MCFG_AM9517A_OUT_IOW_0_CB(DEVWRITE8("video", i8275_device, dack_w)) - MCFG_IM6402_ADD("videouart", 0, 0) - MCFG_IM6402_DR_CALLBACK(WRITELINE(wicat_state, kb_data_ready)) - - // terminal (2x INS2651, 1x IM6042 - one of these is for the keyboard, another communicates with the main board, the third is unknown) - MCFG_DEVICE_ADD("videouart0", MC2661, XTAL_5_0688MHz) // the INS2651 looks similar enough to the MC2661... - MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("uart0", mc2661_device, rx_w)) - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("videocpu", INPUT_LINE_IRQ0)) - MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("uart0", mc2661_device, cts_w)) - MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("uart0", mc2661_device, dsr_w)) - - MCFG_DEVICE_ADD("videouart1", MC2661, XTAL_5_0688MHz) - MCFG_MC2661_RXC(19200) - MCFG_MC2661_TXC(19200) - MCFG_MC2661_RXRDY_HANDLER(INPUTLINE("videocpu", INPUT_LINE_IRQ0)) - - MCFG_X2210_ADD("vsram") // XD2210 - - MCFG_SCREEN_ADD("screen",RASTER) - MCFG_SCREEN_SIZE(720,300) - MCFG_SCREEN_VISIBLE_AREA(0,720-1,0,300-1) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DEVICE("video",i8275_device,screen_update) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_DEVICE_ADD("video", I8275, XTAL_19_6608MHz/8) - MCFG_I8275_CHARACTER_WIDTH(9) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(wicat_state, wicat_display_pixels) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("videodma",am9517a_device, dreq0_w)) - MCFG_I8275_IRQ_CALLBACK(WRITELINE(wicat_state,crtc_cb)) - MCFG_VIDEO_SET_SCREEN("screen") - - MCFG_DEFAULT_LAYOUT(layout_wicat) - - /* Winchester Disk Controller (WD1000 + FD1795) */ - MCFG_CPU_ADD("wd1kcpu",N8X300,XTAL_8MHz) - MCFG_CPU_PROGRAM_MAP(wicat_wd1000_mem) - MCFG_CPU_IO_MAP(wicat_wd1000_io) - MCFG_FD1795_ADD("fdc",XTAL_8MHz) - - -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( wicat ) - ROM_REGION16_BE(0x4000, "c1", 0) - ROM_LOAD16_BYTE("wiboot.e", 0x00000, 0x0800, CRC(6f0f73c6) SHA1(be635bf3ffa1301f844a3d5560e278de46740d19) ) - ROM_LOAD16_BYTE("wiboot.o", 0x00001, 0x0800, CRC(b9763bbd) SHA1(68f497be56ff69534e17b41a40737cd6f708d65e) ) - ROM_LOAD16_BYTE("tpcnif.e", 0x01000, 0x0800, CRC(fd1127ec) SHA1(7c6b436c0cea41dbb23cb6bd9b9a5c21fa61d232) ) - ROM_LOAD16_BYTE("tpcnif.o", 0x01001, 0x0800, CRC(caa16e2a) SHA1(b3e64b676f50b65b3e365fc5f17eb1759c1310df) ) - ROM_LOAD16_BYTE("tpcf.e", 0x02000, 0x0800, CRC(d34be25c) SHA1(1b167918cbc19c9364f020176f4cc3722cba8434) ) - ROM_LOAD16_BYTE("tpcf.o", 0x02001, 0x0800, CRC(7712c570) SHA1(8743b7c98190ecf3bf7e917e6143b47b3b36db8d) ) - ROM_REGION(0x0060, "c1proms", 0) - ROM_LOAD ("cpu.8b", 0x00000, 0x0020, CRC(99b90665) SHA1(8a4677ea814e1843001fe28b284226b7291cdf76) ) - ROM_LOAD ("cpu.8c", 0x00020, 0x0020, CRC(190a55ad) SHA1(de8a847bff8c343d69b853a215e6ee775ef2ef96) ) - ROM_LOAD ("cpu.15c", 0x00040, 0x0020, CRC(ba2dd77d) SHA1(eb693d6d30aa6a9dba61c6c41a75614ed4e9e69a) ) - - // System 150 CPU/MU board - ROM_REGION16_BE(0x2000, "c2", 0) - ROM_SYSTEM_BIOS( 0, "cms", "CMS HD / Floppy Boot / Boot v1.56" ) - ROMX_LOAD("s156.a5", 0x00000, 0x0800, CRC(2c1e9542) SHA1(50184e04f0c881818e96e2162111d16304e8762f), ROM_SKIP(1) | ROM_BIOS(1) ) - ROMX_LOAD("s156.a7", 0x00001, 0x0800, CRC(5a0cb30d) SHA1(aa106ad5a8b9e89613f7ea026d62832cfdb19fd0), ROM_SKIP(1) | ROM_BIOS(1) ) - ROMX_LOAD("37m.b5", 0x01000, 0x0800, CRC(831571fb) SHA1(fcc647b3ef9f0cca3e8212f850f96676d24cf318), ROM_SKIP(1) | ROM_BIOS(1) ) - ROMX_LOAD("37m.b7", 0x01001, 0x0800, CRC(3c346e8e) SHA1(d8ff8297d265b25655c854ed8515fa9e16c63f39), ROM_SKIP(1) | ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "wd3", "WD3 HD Boot / Boot v1.56" ) - ROMX_LOAD("boot156.a5", 0x00000, 0x0800, CRC(58510a52) SHA1(d2135b056a04ba830b0ae1cef539e4a9a1b58f82), ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD("boot156.a7", 0x00001, 0x0800, CRC(e53999f1) SHA1(9c6c6a3a56b5c16a35e1fe824f37c8ae739ebcb9), ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD("wd3_15.b5", 0x01000, 0x0800, CRC(a765899b) SHA1(8427c564029914b7dbc29768ce451604180e390f), ROM_SKIP(1) | ROM_BIOS(2) ) - ROMX_LOAD("wd3_15.b7", 0x01001, 0x0800, CRC(9d986585) SHA1(1ac7579c692f827b121c56dac0a77b15400caba1), ROM_SKIP(1) | ROM_BIOS(2) ) - - // Terminal CPU board (Graphical) - // "MG8000 VERSION 3.0" - ROM_REGION16_BE(0x8000, "g1", 0) - ROM_LOAD16_BYTE("1term0.e", 0x00000, 0x0800, CRC(a9aade37) SHA1(644e9362d5a9523be5c6f39a650b574735dbd4a2) ) - ROM_LOAD16_BYTE("1term0.o", 0x00001, 0x0800, CRC(8026b5b7) SHA1(cb93e0595b321889694cbb87f497d244e6a2d648) ) - ROM_LOAD16_BYTE("1term1.e", 0x01000, 0x0800, CRC(e6ce8016) SHA1(fae987f1ac26d027ed176f8886832e87d1feae60) ) - ROM_LOAD16_BYTE("1term1.o", 0x01001, 0x0800, CRC(d71f763e) SHA1(b0a7f4cc90ce267aec7e72ad22a227f0c8c1f650) ) - ROM_LOAD16_BYTE("1term2.e", 0x02000, 0x0800, CRC(c0e82703) SHA1(7a17da13c01e15b61eea65b06d988ab8ba7eaaf3) ) - ROM_LOAD16_BYTE("1term2.o", 0x02001, 0x0800, CRC(aa0d5b4f) SHA1(b37c2e5220f4838a805b20a0ef21689067f1a759) ) - ROM_LOAD16_BYTE("1term3.e", 0x03000, 0x0800, CRC(cd33f4c8) SHA1(6603c5f2330a9a5ec1121a367cebe6e900a00cb0) ) - ROM_LOAD16_BYTE("1term3.o", 0x03001, 0x0800, CRC(05e56714) SHA1(0c31be3c9ec90a0858fe04a208e2627e4beb12b0) ) - ROM_LOAD16_BYTE("1term4.e", 0x04000, 0x0800, CRC(a157c61f) SHA1(59b7be6cd696b2508b5c1fd7b6e6f7cb5a9f12ab) ) - ROM_LOAD16_BYTE("1term4.o", 0x04001, 0x0800, CRC(364c1a95) SHA1(bfd62a71c9d8f83dc12a7dbbf362d18819380ef3) ) - ROM_LOAD16_BYTE("1term5.e", 0x05000, 0x0800, CRC(c2b8bc9e) SHA1(cd054988a9694b3a211e1993da1b3dc2c5e6fdc2) ) - ROM_LOAD16_BYTE("1term5.o", 0x05001, 0x0800, CRC(421e0521) SHA1(29b87938f5c25c05920ca2c14893700bc45a86c5) ) - ROM_LOAD16_BYTE("1term6.e", 0x06000, 0x0800, CRC(f0d14ed6) SHA1(840acc2b90e8d16df7e5d60c399b08ec0e126a88) ) - ROM_LOAD16_BYTE("1term6.o", 0x06001, 0x0800, CRC(e245ff49) SHA1(9a34e6cf6013b1044cccf26371cc3a000f17b58c) ) - ROM_LOAD16_BYTE("1term7.e", 0x07000, 0x0800, CRC(0c918550) SHA1(2ef6ce41cc2643d45c4bae31ce151d8b6c363471) ) - ROM_LOAD16_BYTE("1term7.o", 0x07001, 0x0800, CRC(71fdc692) SHA1(d6f12ec20ff2e4948f54b0c79f11ccbdc9db865c) ) - ROM_REGION(0x40, "vsram", 0) - ROM_LOAD ("ee8-82.bin", 0x00000, 0x0040, CRC(dfb4b0fb) SHA1(12304f5c5236791f5e931d9e49b4a70dcbba55c0) ) - - // "MG8000 VERSION 1.1" - ROM_REGION16_BE(0x8000, "g2", 0) - ROM_LOAD16_BYTE("2term0.e", 0x00000, 0x0800, CRC(29e5dd68) SHA1(9023f53d554b9ef4f4efc731645ba42f728bcd2c) ) - ROM_LOAD16_BYTE("2term0.o", 0x00001, 0x0800, CRC(91edd05d) SHA1(378b06fc8316199b7c580a6e7f28368dacdac5a9) ) - ROM_LOAD16_BYTE("2term1.e", 0x01000, 0x0800, CRC(2b48abe4) SHA1(4c9b4db1c1408b6551d50172dda994b36a2ee4b1) ) - ROM_LOAD16_BYTE("2term1.o", 0x01001, 0x0800, CRC(4c0e4f95) SHA1(bd49bf71fea1acfd50781820f0a650411b6f996b) ) - ROM_LOAD16_BYTE("2term2.e", 0x02000, 0x0800, CRC(3251324b) SHA1(e8f52308c9cbb9bcb5adb2685609d6a69b9eec1d) ) - ROM_LOAD16_BYTE("2term2.o", 0x02001, 0x0800, CRC(3a49c9e7) SHA1(0718b029ed316bc8e7bf22b0e94b6b5628758580) ) - ROM_LOAD16_BYTE("2term3.e", 0x03000, 0x0800, CRC(0f17be85) SHA1(9c40b4d06f3fb8def88b87615a590bb03dcfc4f4) ) - ROM_LOAD16_BYTE("2term3.o", 0x03001, 0x0800, CRC(08ae31c5) SHA1(2e53f87b6a4e0b973f7918d97f57f6560c651ab6) ) - ROM_LOAD16_BYTE("2term4.e", 0x04000, 0x0800, CRC(413936e7) SHA1(ce9d8666ca4e6847514bcf4de5703f0845e72928) ) - ROM_LOAD16_BYTE("2term4.o", 0x04001, 0x0800, CRC(06deab4e) SHA1(af5be7105a24d81dcc539296631b4309f7b8cb3f) ) - ROM_LOAD16_BYTE("2term5.e", 0x05000, 0x0800, CRC(7979bf59) SHA1(1bc397c58ce026fb90a02714d42df8f179a4f50e) ) - ROM_LOAD16_BYTE("2term5.o", 0x05001, 0x0800, CRC(e1f738ca) SHA1(bd8d7f1acb243880fd364f71097b9711de496739) ) - ROM_LOAD16_BYTE("2term6.e", 0x06000, 0x0800, CRC(bb04d70c) SHA1(0b482c2f06fe5e042a5813f027f5cf034d72e0dd) ) - ROM_LOAD16_BYTE("2term6.o", 0x06001, 0x0800, CRC(0afb566c) SHA1(761455ced46b6fccd0be9c8fa920f7954a36972b) ) - ROM_LOAD16_BYTE("2term7.e", 0x07000, 0x0800, CRC(033ea830) SHA1(27c33eea2df812a1a96e2f47ba7993e2ca3675ad) ) - ROM_LOAD16_BYTE("2term7.o", 0x07001, 0x0800, CRC(e157c5d2) SHA1(3cd1ea0fb9df1358e8a358468a4df5e4eaaa86a2) ) - ROM_REGION(0x40, "g2novram", 0) - ROM_LOAD ("ee2-2.bin", 0x00000, 0x0040, CRC(8f265118) SHA1(6bd74e3d01cf85cca1abcc15cb229dbd63022978) ) - - // Terminal Video board - ROM_REGION(0x1000, "g2char", 0) - ROM_LOAD ("ascii.chr", 0x00000, 0x0800, CRC(43e26e37) SHA1(f3d5d16040c66f0e827f72a35d4694ca62950949) ) - ROM_LOAD ("apl.chr", 0x00800, 0x0800, CRC(8c6d698e) SHA1(147dd9296fe2efc6140fa148a6edf673c33f9371) ) - - // Winchester Disk Controller (WD1000 (comprised of an 8X300 + some WD1100-xx bits), FD1795 (FDC)) - ROM_REGION16_BE(0x1800, "wd3", 0) - ROM_LOAD16_BYTE("wd3.u96", 0x00000, 0x0800, CRC(52736e61) SHA1(71c7c9170c733c483393969cb1cb3798b3eb980c) ) // 8X300 code even - ROM_LOAD16_BYTE("wd3.u97", 0x00001, 0x0800, CRC(a66619ec) SHA1(5d091ac7c88f2f45b4a05e78bfc7a16c206b31ff) ) // 8X300 code odd - ROM_LOAD ("wd3.u95", 0x01000, 0x0800, CRC(80bb0617) SHA1(ac0f3194fcbef77532571baa3fec78b3010528bf) ) // "Fast IO select" bytes -ROM_END - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, wicat, 0, 0, wicat, wicat, driver_device, 0, "Millennium Systems", "Wicat System 150", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/wildfire.c b/src/mess/drivers/wildfire.c deleted file mode 100644 index 992fcbc544c..00000000000 --- a/src/mess/drivers/wildfire.c +++ /dev/null @@ -1,343 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/*************************************************************************** - - Parker Brothers Wildfire, by Bob and Holly Doyle (prototype), and Garry Kitchen - * AMI S2150, labeled C10641 - - This is an electronic handheld pinball game. It has dozens of small leds - to create the illusion of a moving ball, and even the flippers are leds. - A drawing of a pinball table is added as overlay. - - NOTE!: MAME external artwork is required - - - TODO: - - sound emulation could still be improved - - when the game strobes a led faster, it should appear brighter, for example when - the ball hits one of the bumpers - - 7seg decoder is guessed - - MCU clock is unknown - -***************************************************************************/ - -#include "emu.h" -#include "cpu/amis2000/amis2000.h" -#include "sound/speaker.h" - -#include "wildfire.lh" // this is a test layout, use external artwork - -// master clock is a single stage RC oscillator: R=?K, C=?pf, -// S2000 default frequency is 850kHz -#define MASTER_CLOCK (850000) - - -class wildfire_state : public driver_device -{ -public: - wildfire_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_a12_decay_timer(*this, "a12_decay") - { } - - required_device m_maincpu; - required_device m_speaker; - required_device m_a12_decay_timer; - - UINT8 m_d; - UINT16 m_a; - UINT8 m_q2; - UINT8 m_q3; - - UINT16 m_display_state[0x10]; - UINT16 m_display_cache[0x10]; - UINT8 m_display_decay[0x100]; - - DECLARE_WRITE8_MEMBER(write_d); - DECLARE_WRITE16_MEMBER(write_a); - DECLARE_WRITE_LINE_MEMBER(write_f); - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - bool index_is_7segled(int index); - void display_update(); - - TIMER_DEVICE_CALLBACK_MEMBER(reset_q2); - void write_a12(int state); - void sound_update(); - - virtual void machine_start(); -}; - - - -/*************************************************************************** - - LED Display - -***************************************************************************/ - -// The device strobes the outputs very fast, it is unnoticeable to the user. -// To prevent flickering here, we need to simulate a decay. - -// decay time, in steps of 1ms -#define DISPLAY_DECAY_TIME 40 - -inline bool wildfire_state::index_is_7segled(int index) -{ - // first 3 A are 7segleds - return (index < 3); -} - -// lamp translation table: Lzz from patent US4334679 FIG.4 = MAME lampxxy, -// where xx is led column and y is led row, eg. lamp103 is output A10 D3 -// (note: 2 mistakes in the patent: the L19 between L12 and L14 should be L13, and L84 should of course be L48) -/* - L0 = - L10 = lamp60 L20 = lamp41 L30 = lamp53 L40 = lamp57 L50 = lamp110 - L1 = lamp107 L11 = lamp50 L21 = lamp42 L31 = lamp43 L41 = lamp66 L51 = lamp111 - L2 = lamp106 L12 = lamp61 L22 = lamp52 L32 = lamp54 L42 = lamp76 L52 = lamp112 - L3 = lamp105 L13 = lamp71 L23 = lamp63 L33 = lamp55 L43 = lamp86 L53 = lamp113 - L4 = lamp104 L14 = lamp81 L24 = lamp73 L34 = lamp117 L44 = lamp96 L60 = lamp30 - L5 = lamp103 L15 = lamp92 L25 = lamp115 L35 = lamp75 L45 = lamp67 L61 = lamp30(!) - L6 = lamp102 L16 = lamp82 L26 = lamp93 L36 = lamp95 L46 = lamp77 L62 = lamp31 - L7 = lamp101 L17 = lamp72 L27 = lamp94 L37 = lamp56 L47 = lamp87 L63 = lamp31(!) - L8 = lamp80 L18 = lamp114 L28 = lamp84 L38 = lamp65 L48 = lamp97 L70 = lamp33 - L9 = lamp70 L19 = lamp51 L29 = lamp116 L39 = lamp85 L49 = - -*/ - -void wildfire_state::display_update() -{ - UINT16 active_state[0x10]; - - for (int i = 0; i < 0x10; i++) - { - // update current state - m_display_state[i] = (m_a >> i & 1) ? m_d : 0; - - active_state[i] = 0; - - for (int j = 0; j < 0x10; j++) - { - int di = j << 4 | i; - - // turn on powered segments - if (m_display_state[i] >> j & 1) - m_display_decay[di] = DISPLAY_DECAY_TIME; - - // determine active state - int ds = (m_display_decay[di] != 0) ? 1 : 0; - active_state[i] |= (ds << j); - } - } - - // on difference, send to output - for (int i = 0; i < 0x10; i++) - if (m_display_cache[i] != active_state[i]) - { - if (index_is_7segled(i)) - output_set_digit_value(i, BITSWAP8(active_state[i],7,0,1,2,3,4,5,6) & 0x7f); - - for (int j = 0; j < 8; j++) - output_set_lamp_value(i*10 + j, active_state[i] >> j & 1); - } - - memcpy(m_display_cache, active_state, sizeof(m_display_cache)); -} - -TIMER_DEVICE_CALLBACK_MEMBER(wildfire_state::display_decay_tick) -{ - // slowly turn off unpowered segments - for (int i = 0; i < 0x100; i++) - if (!(m_display_state[i & 0xf] >> (i>>4) & 1) && m_display_decay[i]) - m_display_decay[i]--; - - display_update(); -} - - - -/*************************************************************************** - - Sound - -***************************************************************************/ - -// Sound output is via a speaker between transistors Q2(from A12) and Q3(from F_out) -// A12 to Q2 has a little electronic circuit going, causing a slight delay. -// (see patent US4334679 FIG.5, the 2 resistors are 10K and the cap is a 4.7uF electrolytic) - -// decay time, in steps of 1ms -#define A12_DECAY_TIME 5 /* a complete guess */ - -void wildfire_state::sound_update() -{ - m_speaker->level_w(m_q2 & m_q3); -} - -WRITE_LINE_MEMBER(wildfire_state::write_f) -{ - // F_out pin: speaker out - m_q3 = (state) ? 1 : 0; - sound_update(); -} - -TIMER_DEVICE_CALLBACK_MEMBER(wildfire_state::reset_q2) -{ - m_q2 = 0; - sound_update(); -} - -void wildfire_state::write_a12(int state) -{ - if (state) - { - m_a12_decay_timer->adjust(attotime::never); - m_q2 = state; - sound_update(); - } - else if (m_a >> 12 & 1) - { - // falling edge - m_a12_decay_timer->adjust(attotime::from_msec(A12_DECAY_TIME)); - } -} - - - -/*************************************************************************** - - I/O - -***************************************************************************/ - -WRITE8_MEMBER(wildfire_state::write_d) -{ - // D0-D7: leds out - m_d = data; - display_update(); -} - -WRITE16_MEMBER(wildfire_state::write_a) -{ - data ^= 0x1fff; // active-low - - // A12: enable speaker - write_a12(data >> 12 & 1); - - // A0-A2: select 7segleds - // A3-A11: select other leds - m_a = data; - display_update(); -} - - - -/*************************************************************************** - - Inputs - -***************************************************************************/ - -static INPUT_PORTS_START( wildfire ) - PORT_START("IN1") // I - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Shooter Button") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Left Flipper") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Right Flipper") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - - -/*************************************************************************** - - Machine Config - -***************************************************************************/ - -void wildfire_state::machine_start() -{ - // zerofill - memset(m_display_state, 0, sizeof(m_display_state)); - memset(m_display_cache, 0, sizeof(m_display_cache)); - memset(m_display_decay, 0, sizeof(m_display_decay)); - - m_d = 0; - m_a = 0; - m_q2 = 0; - m_q3 = 0; - - // register for savestates - save_item(NAME(m_display_state)); - save_item(NAME(m_display_cache)); - save_item(NAME(m_display_decay)); - - save_item(NAME(m_d)); - save_item(NAME(m_a)); - save_item(NAME(m_q2)); - save_item(NAME(m_q3)); -} - -// LED segments A-G -enum -{ - lA = 0x40, - lB = 0x20, - lC = 0x10, - lD = 0x08, - lE = 0x04, - lF = 0x02, - lG = 0x01 -}; - -static const UINT8 wildfire_7seg_table[0x10] = -{ - 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, // 0-9 unaltered - 0x77, // A -> unused? - lA+lB+lE+lF+lG, // b -> P - 0x4e, // C -> unused? - lD+lE+lF, // d -> L - 0x4f, // E -> unused? - lG // F -> - -}; - - -static MACHINE_CONFIG_START( wildfire, wildfire_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", AMI_S2152, MASTER_CLOCK) - MCFG_AMI_S2000_7SEG_DECODER(wildfire_7seg_table) - MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1")) - MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d)) - MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a)) - MCFG_AMI_S2152_FOUT_CB(WRITELINE(wildfire_state, write_f)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", wildfire_state, display_decay_tick, attotime::from_msec(1)) - MCFG_TIMER_DRIVER_ADD("a12_decay", wildfire_state, reset_q2) - - MCFG_DEFAULT_LAYOUT(layout_wildfire) - - /* no video! */ - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( wildfire ) - ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 ) - ROM_LOAD( "us4341385", 0x0000, 0x0400, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums) - ROM_CONTINUE( 0x0600, 0x0200 ) -ROM_END - - -CONS( 1979, wildfire, 0, 0, wildfire, wildfire, driver_device, 0, "Parker Brothers", "Wildfire (patent)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) // note: pretty sure that it matches the commercial release diff --git a/src/mess/drivers/wswan.c b/src/mess/drivers/wswan.c deleted file mode 100644 index be33de5b961..00000000000 --- a/src/mess/drivers/wswan.c +++ /dev/null @@ -1,185 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Anthony Kruize,Wilbert Pol -/*************************************************************************** - - wswan.c - - Driver file to handle emulation of the Bandai WonderSwan - By: - - Anthony Kruize - Wilbert Pol - - Based on the WStech documentation by Judge and Dox. - - Known issues/TODOs: - - Get the V30MZ core into MAME, still need to remove some nec specific - instructions and fix the flags handling of the div/mul instructions. - - Add support for noise sound - - Add support for voice sound - - Add support for enveloped sound - - Perform video DMA at proper timing. - - Add sound DMA. - - Setup some reasonable values in the internal EEPROM area? - - Add (real/proper) RTC support. - - Look into timing issues like in Puzzle Bobble. VBlank interrupt lasts very long - which causes sprites to be disabled until about 10%-40% of drawing the screen. - The real unit seems to display things fine, need a real unit + real cart to - verify. - - Is background color setting really ok? - - Get a dump of the internal BIOSes. - - Swan Crystal can handle up to 512Mbit ROMs?????? - - -***************************************************************************/ - -#include "includes/wswan.h" -#include "wswan.lh" - -static ADDRESS_MAP_START (wswan_mem, AS_PROGRAM, 8, wswan_state) - AM_RANGE(0x00000, 0x03fff) AM_DEVREADWRITE("vdp", wswan_video_device, vram_r, vram_w) // 16kb RAM / 4 colour tiles - AM_RANGE(0x04000, 0x0ffff) AM_NOP // nothing - //AM_RANGE(0x10000, 0xeffff) // cart range, setup at machine_start - AM_RANGE(0xf0000, 0xfffff) AM_READ(bios_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START (wscolor_mem, AS_PROGRAM, 8, wswan_state) - AM_RANGE(0x00000, 0x0ffff) AM_DEVREADWRITE("vdp", wswan_video_device, vram_r, vram_w) // 16kb RAM / 4 colour tiles, 16 colour tiles + palettes - //AM_RANGE(0x10000, 0xeffff) // cart range, setup at machine_start - AM_RANGE(0xf0000, 0xfffff) AM_READ(bios_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START (wswan_io, AS_IO, 8, wswan_state) - AM_RANGE(0x00, 0xff) AM_READWRITE(port_r, port_w) // I/O ports -ADDRESS_MAP_END - -static INPUT_PORTS_START( wswan ) - PORT_START("CURSX") - PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("X1 - Up") - PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("X3 - Down") - PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("X4 - Left") - PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("X2 - Right") - - PORT_START("BUTTONS") - PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start") - PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Button A") - PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Button B") - - PORT_START("CURSY") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y1 - Up") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y3 - Down") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y4 - Left") PORT_CODE(KEYCODE_A) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y2 - Right") PORT_CODE(KEYCODE_D) -INPUT_PORTS_END - -static GFXDECODE_START( wswan ) -GFXDECODE_END - -/* WonderSwan can display 16 shades of grey */ -PALETTE_INIT_MEMBER(wswan_state, wswan) -{ - for (int i = 0; i < 16; i++) - { - UINT8 shade = i * (256 / 16); - palette.set_pen_color(15 - i, shade, shade, shade); - } -} - -PALETTE_INIT_MEMBER(wswan_state, wscolor) -{ - for (int i = 0; i < 4096; i++) - { - int r = (i & 0x0f00) >> 8; - int g = (i & 0x00f0) >> 4; - int b = i & 0x000f; - palette.set_pen_color(i, r << 4, g << 4, b << 4); - } -} - -static SLOT_INTERFACE_START(wswan_cart) - SLOT_INTERFACE_INTERNAL("ws_rom", WS_ROM_STD) - SLOT_INTERFACE_INTERNAL("ws_sram", WS_ROM_SRAM) - SLOT_INTERFACE_INTERNAL("ws_eeprom", WS_ROM_EEPROM) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( wswan, wswan_state ) - /* Basic machine hardware */ - MCFG_CPU_ADD("maincpu", V30MZ, 3072000) - MCFG_CPU_PROGRAM_MAP(wswan_mem) - MCFG_CPU_IO_MAP(wswan_io) - - MCFG_DEVICE_ADD("vdp", WSWAN_VIDEO, 0) - MCFG_WSWAN_VIDEO_TYPE(VDP_TYPE_WSWAN) - MCFG_WSWAN_VIDEO_IRQ_CB(wswan_state, set_irq_line) - MCFG_WSWAN_VIDEO_DMASND_CB(wswan_state, dma_sound_cb) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(75) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_UPDATE_DEVICE("vdp", wswan_video_device, screen_update) - MCFG_SCREEN_SIZE(WSWAN_X_PIXELS, WSWAN_Y_PIXELS) - MCFG_SCREEN_VISIBLE_AREA(0*8, WSWAN_X_PIXELS - 1, 0, WSWAN_Y_PIXELS - 1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_wswan) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_NVRAM_ADD_1FILL("nvram") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", wswan) - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(wswan_state, wswan) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", WSWAN_SND, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - - /* cartridge */ - MCFG_WSWAN_CARTRIDGE_ADD("cartslot", wswan_cart, NULL) - - /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","wswan") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("wsc_list","wscolor") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( wscolor, wswan ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(wscolor_mem) - MCFG_MACHINE_START_OVERRIDE(wswan_state, wscolor) - - MCFG_DEVICE_MODIFY("vdp") - MCFG_WSWAN_VIDEO_TYPE(VDP_TYPE_WSC) - - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(4096) - MCFG_PALETTE_INIT_OWNER(wswan_state, wscolor) - - /* software lists */ - MCFG_DEVICE_REMOVE("cart_list") - MCFG_DEVICE_REMOVE("wsc_list") - MCFG_SOFTWARE_LIST_ADD("cart_list","wscolor") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("ws_list","wswan") -MACHINE_CONFIG_END - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( wswan ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) -// ROM_LOAD_OPTIONAL( "ws_bios.bin", 0x0000, 0x0001, NO_DUMP ) -ROM_END - -ROM_START( wscolor ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) -// ROM_LOAD_OPTIONAL( "wsc_bios.bin", 0x0000, 0x0001, NO_DUMP ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME*/ -CONS( 1999, wswan, 0, 0, wswan, wswan, driver_device, 0, "Bandai", "WonderSwan", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -CONS( 2000, wscolor, wswan, 0, wscolor, wswan, driver_device, 0, "Bandai", "WonderSwan Color", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/x07.c b/src/mess/drivers/x07.c deleted file mode 100644 index c676cb42a27..00000000000 --- a/src/mess/drivers/x07.c +++ /dev/null @@ -1,1568 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Canon X-07 - - Driver by Sandro Ronco based on X-07 emu by J.Brigaud - - TODO: - - move T6834 in a device - - better emulation of the i/o ports - - external video (need X-720 dump) - - serial port - - Memory Map - - 0x0000 - 0x1fff Internal RAM - 0x2000 - 0x3fff External RAM Card - 0x4000 - 0x5fff Extension ROM/RAM - 0x6000 - 0x7fff ROM Card - 0x8000 - 0x97ff Video RAM - 0x9800 - 0x9fff ? - 0xa000 - 0xafff TV ROM (no dump) - 0xb000 - 0xffff ROM - - CPU was actually a NSC800 (Z80 compatible) - More info: http://www.silicium.org/oldskool/calc/x07/ - -****************************************************************************/ - -#include "includes/x07.h" - -/*************************************************************************** - T6834 IMPLEMENTATION -***************************************************************************/ - -void x07_state::t6834_cmd (UINT8 cmd) -{ - switch (cmd) - { - case 0x00: //NOP??? - break; - - case 0x01: //DATA$ TIME$ read - { - system_time systime; - machine().current_datetime(systime); - m_out.data[m_out.write++] = (systime.local_time.year>>8) & 0xff; - m_out.data[m_out.write++] = systime.local_time.year & 0xff; - m_out.data[m_out.write++] = systime.local_time.month + 1; - m_out.data[m_out.write++] = systime.local_time.mday; - m_out.data[m_out.write++] = ~(((0x01 << (7 - systime.local_time.weekday)) - 1) & 0xff); - m_out.data[m_out.write++] = systime.local_time.hour; - m_out.data[m_out.write++] = systime.local_time.minute; - m_out.data[m_out.write++] = systime.local_time.second; - } - break; - - case 0x02: //STICK - { - UINT8 data; - - switch (ioport("S1")->read() & 0x3c) - { - case 0x04: data = 0x33; break; //right - case 0x08: data = 0x37; break; //left - case 0x10: data = 0x31; break; //up - case 0x20: data = 0x35; break; //down - default: data = 0x30; break; - } - m_out.data[m_out.write++] = data; - } - break; - - case 0x03: //STRIG(0) - { - m_out.data[m_out.write++] = (ioport("S6")->read() & 0x20 ? 0x00 : 0xff); - } - break; - - case 0x04: //STRIG(1) - { - m_out.data[m_out.write++] = (ioport("S1")->read() & 0x40 ? 0x00 : 0xff); - } - break; - - case 0x05: //T6834 RAM read - { - UINT16 address; - UINT8 data; - address = m_in.data[m_in.read++]; - address |= (m_in.data[m_in.read++] << 8); - - if(address == 0xc00e) - data = 0x0a; - else if(address == 0xd000) - data = ioport("BATTERY")->read(); - else - data = m_t6834_ram[address & 0x7ff]; - - m_out.data[m_out.write++] = data; - } - break; - - case 0x06: //T6834 RAM write - { - UINT16 address; - UINT8 data; - data = m_in.data[m_in.read++]; - address = m_in.data[m_in.read++]; - address |= (m_in.data[m_in.read++] << 8); - - m_t6834_ram[address & 0x7ff] = data; - } - break; - - case 0x07: //scroll set - { - m_scroll_min = m_in.data[m_in.read++]; - m_scroll_max = m_in.data[m_in.read++]; - } - break; - - case 0x08: //scroll exec - { - if(m_scroll_min <= m_scroll_max && m_scroll_max < 4) - { - for(int i = m_scroll_min * 8; i < m_scroll_max * 8; i++) - memcpy(&m_lcd_map[i][0], &m_lcd_map[i + 8][0], 120); - - for(int i = m_scroll_max * 8; i < (m_scroll_max + 1) * 8; i++) - memset(&m_lcd_map[i][0], 0, 120); - } - } - break; - - case 0x09: //line clear - { - UINT8 line = m_in.data[m_in.read++] & 3; - for(UINT8 l = line * 8; l < (line + 1) * 8; l++) - memset(&m_lcd_map[l][0], 0, 120); - } - break; - - case 0x0a: //DATA$ TIME$ write - break; - - case 0x0b: //calendar - { - system_time systime; - machine().current_datetime(systime); - m_out.data[m_out.write++] = systime.local_time.weekday; - } - break; - - case 0x0c: //ALM$ write - { - for(int i = 0; i < 8; i++) - m_alarm[i] = m_in.data[m_in.read++]; - } - break; - - case 0x0d: //buzzer on - case 0x0e: //buzzer off - break; - - case 0x0f: //read LCD line - { - UINT8 line = m_in.data[m_in.read++]; - for(int i = 0; i < 120; i++) - m_out.data[m_out.write++] = (line < 32) ? m_lcd_map[line][i] : 0; - } - break; - - case 0x10: //read LCD point - { - UINT8 x = m_in.data[m_in.read++]; - UINT8 y = m_in.data[m_in.read++]; - if(x < 120 && y < 32) - m_out.data[m_out.write++] = (m_lcd_map[y][x] ? 0xff : 0); - else - m_out.data[m_out.write++] = 0; - } - break; - - case 0x11: //PSET - { - UINT8 x = m_in.data[m_in.read++]; - UINT8 y = m_in.data[m_in.read++]; - draw_point(x, y, 1); - } - break; - - case 0x12: //PRESET - { - UINT8 x = m_in.data[m_in.read++]; - UINT8 y = m_in.data[m_in.read++]; - draw_point(x, y, 0); - } - break; - - case 0x13: //PEOR - { - UINT8 x = m_in.data[m_in.read++]; - UINT8 y = m_in.data[m_in.read++]; - if(x < 120 && y < 32) - m_lcd_map[y][x] = !m_lcd_map[y][x]; - } - break; - - case 0x14: //Line - { - UINT8 delta_x, delta_y, step_x, step_y, next_x, next_y, p1, p2, p3, p4; - INT16 frac; - next_x = p1 = m_in.data[m_in.read++]; - next_y = p2 = m_in.data[m_in.read++]; - p3 = m_in.data[m_in.read++]; - p4 = m_in.data[m_in.read++]; - delta_x = abs(p3 - p1) * 2; - delta_y = abs(p4 - p2) * 2; - step_x = (p3 < p1) ? -1 : 1; - step_y = (p4 < p2) ? -1 : 1; - - if(delta_x > delta_y) - { - frac = delta_y - delta_x / 2; - while(next_x != p3) - { - if(frac >= 0) - { - next_y += step_y; - frac -= delta_x; - } - next_x += step_x; - frac += delta_y; - draw_point(next_x, next_y, 0x01); - } - } - else { - frac = delta_x - delta_y / 2; - while(next_y != p4) - { - if(frac >= 0) - { - next_x += step_x; - frac -= delta_y; - } - next_y += step_y; - frac += delta_x; - draw_point(next_x, next_y, 0x01); - } - } - draw_point(p1, p2, 0x01); - draw_point(p3, p4, 0x01); - } - break; - - case 0x15: //Circle - { - UINT8 p1 = m_in.data[m_in.read++]; - UINT8 p2 = m_in.data[m_in.read++]; - UINT8 p3 = m_in.data[m_in.read++]; - - for(int x = 0, y = p3; x <= sqrt((double)(p3 * p3) / 2) ; x++) - { - /* - * The old code produced results most likely not intended: - * UINT32 d1 = (x * x + y * y) - p3 * p3; - * UINT32 d2 = (x * x + (y - 1) * (y - 1)) - p3 * p3; - * if(abs((double)d1) > abs((double)d2)) - * - * (double)(-1) = 4294967294.000000 - * abs((double)(-1)) = -2147483648; - * - * Therefore changed. - */ - INT32 d1 = (x * x + y * y) - p3 * p3; - INT32 d2 = (x * x + (y - 1) * (y - 1)) - p3 * p3; - if (abs(d1) > abs(d2)) - y--; - draw_point(x + p1, y + p2, 0x01); - draw_point(x + p1, -y + p2, 0x01); - draw_point(-x + p1, y + p2, 0x01); - draw_point(-x + p1, -y + p2, 0x01); - draw_point(y + p1, x + p2, 0x01); - draw_point(y + p1, -x + p2, 0x01); - draw_point(-y + p1, x + p2, 0x01); - draw_point(-y + p1, -x + p2, 0x01); - } - } - break; - - case 0x16: //UDK write - { - UINT8 pos = m_in.data[m_in.read++] - 1; - UINT8 udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; - - for(int i = 0; i < udk_size; i++) - { - UINT8 udk_char = m_in.data[m_in.read++]; - m_t6834_ram[udk_offset[pos] + i] = udk_char; - if(!udk_char) break; - } - } - break; - - case 0x17: //UDK read - { - UINT8 pos = m_in.data[m_in.read++] - 1; - UINT8 udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; - - for(int i = 0; i < udk_size; i++) - { - UINT8 udk_char = m_t6834_ram[udk_offset[pos] + i]; - m_out.data[m_out.write++] = udk_char; - if(!udk_char) break; - } - } - break; - - case 0x18: //UDK on - case 0x19: //UDK off - m_udk_on = !BIT(cmd,0); - break; - - case 0x1a: //UDC write - { - UINT8 udc_code = m_in.data[m_in.read++]; - - if(udc_code>=128 && udc_code<=159) - for(int i = 0; i < 8; i++) - m_t6834_ram[(udc_code<<3) + i - 0x200] = m_in.data[m_in.read++]; - else if(udc_code>=224) - for(int i = 0; i < 8; i++) - m_t6834_ram[(udc_code<<3) + i - 0x400] = m_in.data[m_in.read++]; - } - break; - - case 0x1b: //UDC read - { - UINT16 address = m_in.data[m_in.read++] << 3; - for(int i = 0; i < 8; i++) - m_out.data[m_out.write++] = get_char(address + i); - } - break; - case 0x1c: //UDC Init - { - memcpy(m_t6834_ram + 0x200, (UINT8*)memregion("gfx1")->base() + 0x400, 0x100); - memcpy(m_t6834_ram + 0x300, (UINT8*)memregion("gfx1")->base() + 0x700, 0x100); - } - break; - - case 0x1d: //start program write - { - for(int i = 0; i < 0x80; i++) - { - UINT8 sp_char = m_in.data[m_in.read++]; - m_t6834_ram[0x500 + i] = sp_char; - if (!sp_char) break; - } - } - break; - - case 0x1e: //start program write cont - { - for(int i = (int)strlen((char*)&m_t6834_ram[0x500]); i < 0x80; i++) - { - UINT8 sp_char = m_in.data[m_in.read++]; - m_t6834_ram[0x500 + i] = sp_char; - if (!sp_char) break; - } - } - break; - - case 0x1f: //start program on - case 0x20: //start program off - m_sp_on = BIT(cmd, 0); - break; - - case 0x21: //start program read - { - for(int i = 0; i < 0x80; i++) - { - UINT8 sp_data = m_t6834_ram[0x500 + i]; - m_out.data[m_out.write++] = sp_data; - if (!sp_data) break; - } - } - break; - - case 0x22: //ON state - m_out.data[m_out.write++] = 0x04 | (m_sleep<<6) | m_warm_start; - break; - - case 0x23: //OFF - m_warm_start = 1; - m_sleep = 0; - m_lcd_on = 0; - break; - - case 0x24: //locate - { - UINT8 x = m_in.data[m_in.read++]; - UINT8 y = m_in.data[m_in.read++]; - UINT8 char_code = m_in.data[m_in.read++]; - m_locate.on = (m_locate.x != x || m_locate.y != y); - m_locate.x = m_cursor.x = x; - m_locate.y = m_cursor.y = y; - - if(char_code) - draw_char(x, y, char_code); - } - break; - - case 0x25: //cursor on - case 0x26: //cursor off - m_cursor.on = BIT(cmd, 0); - break; - - case 0x27: //test key - { - static const char *const lines[] = {"S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "BZ", "A1"}; - UINT16 matrix; - UINT8 data = 0; - matrix = m_in.data[m_in.read++]; - matrix |= (m_in.data[m_in.read++] << 8); - - for (int i=0 ;i<10; i++) - if (matrix & (1<read(); - - m_out.data[m_out.write++] = data; - } - break; - - case 0x28: //test chr - { - UINT8 idx = kb_get_index(m_in.data[m_in.read++]); - m_out.data[m_out.write++] = (ioport(x07_keycodes[idx].tag)->read() & x07_keycodes[idx].mask) ? 0x00 : 0xff; - } - break; - - case 0x29: //init sec - case 0x2a: //init date - break; - - case 0x2b: //LCD off - case 0x2c: //LCD on - m_lcd_on = !BIT(cmd,0); - break; - - case 0x2d: //KB buffer clear - memset(m_t6834_ram + 0x400, 0, 0x100); - m_kb_size = 0; - break; - - case 0x2e: //CLS - memset(m_lcd_map, 0, sizeof(m_lcd_map)); - break; - - case 0x2f: //home - m_cursor.x = m_cursor.y = 0; - break; - - case 0x30: //draw UDK on - case 0x31: //draw UDK off - { - m_draw_udk = !BIT(cmd,0); - - if (m_draw_udk) - draw_udk(); - else - for(UINT8 l = 3 * 8; l < (3 + 1) * 8; l++) - memset(&m_lcd_map[l][0], 0, 120); - } - break; - - case 0x32: //repeat key on - case 0x33: //repeat key off - m_repeat_key = !BIT(cmd,0); - break; - - case 0x34: //UDK KANA - break; - - case 0x35: //UDK cont write - { - UINT8 pos = m_in.data[m_in.read++] - 1; - UINT8 udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; - - for(int i = (int)strlen((char*)&m_t6834_ram[udk_offset[pos]]); i < udk_size; i++) - { - UINT8 udk_char = m_in.data[m_in.read++]; - m_t6834_ram[udk_offset[pos] + i] = udk_char; - if(!udk_char) break; - } - } - break; - - case 0x36: //alarm read - { - for(int i = 0; i < 8; i++) - m_out.data[m_out.write++] = m_alarm[i]; - } - break; - - case 0x37: // buzzer zero - m_out.data[m_out.write++] = 0xff; - break; - - case 0x38: //click off - case 0x39: //click on - break; - - case 0x3a: //Locate Close - break; - - case 0x3b: // keyboard on - case 0x3c: // keyboard off - m_kb_on = BIT(cmd, 0); - break; - - case 0x3d: //run start program after power on - case 0x3e: //run start program before power off - break; - - case 0x3f: //Sleep - m_warm_start = 1; - m_lcd_on = 0; - m_sleep = 1; - break; - - case 0x40: //UDK init - { - memset(m_t6834_ram, 0, 0x200); - for(int i = 0; i < 12; i++) - strcpy((char*)m_t6834_ram + udk_offset[i], udk_ini[i]); - } - break; - - case 0x41: //char wrire - { - for(int cy = 0; cy < 8; cy++) - { - UINT8 cl = m_in.data[m_in.read++]; - - for(int cx = 0; cx < 6; cx++) - m_lcd_map[m_cursor.y * 8 + cy][m_cursor.x * 6 + cx] = (cl & (0x80>>cx)) ? 1 : 0; - } - } - break; - - case 0x42: //char read - { - for(int cy = 0; cy < 8; cy++) - { - UINT8 cl = 0x00; - - for(int cx = 0; cx < 6; cx++) - cl |= (m_lcd_map[m_cursor.y * 8 + cy][m_cursor.x * 6 + cx] != 0) ? (1<<(7-cx)) : 0; - - m_out.data[m_out.write++] = cl; - } - } - break; - - case 0x43: //ScanR - case 0x44: //ScanL - { - m_out.data[m_out.write++] = 0; - m_out.data[m_out.write++] = 0; - } - break; - - case 0x45: //TimeChk - case 0x46: //AlmChk - m_out.data[m_out.write++] = 0; - break; - default: - logerror( "T6834 unimplemented command %02x encountered\n", cmd ); - } -} - - -void x07_state::t6834_r () -{ - m_out.read++; - m_regs_r[2] &= 0xfe; - if(m_out.write > m_out.read) - { - m_regs_r[0] = 0x40; - m_regs_r[1] = m_out.data[m_out.read]; - m_regs_r[2] |= 0x01; - m_maincpu->set_input_line(NSC800_RSTA, ASSERT_LINE); - m_rsta_clear->adjust(attotime::from_msec(50)); - } -} - - -void x07_state::t6834_w () -{ - if (!m_in.write) - { - if (m_locate.on && ((m_regs_w[1] & 0x7F) != 0x24) && ((m_regs_w[1]) >= 0x20) && ((m_regs_w[1]) < 0x80)) - { - m_cursor.x++; - draw_char(m_cursor.x, m_cursor.y, m_regs_w[1]); - } - else - { - m_locate.on = 0; - - if ((m_regs_w[1] & 0x7f) < 0x47) - { - m_in.data[m_in.write++] = m_regs_w[1] & 0x7f; - } - } - } - else - { - m_in.data[m_in.write++] = m_regs_w[1]; - - if (m_in.write == 2) - { - if (m_in.data[m_in.read] == 0x0c && m_regs_w [1] == 0xb0) - { - memset(m_lcd_map, 0, sizeof(m_lcd_map)); - m_in.write = 0; - m_in.read = 0; - m_in.data[m_in.write++] = m_regs_w[1] & 0x7f; - } - - if (m_in.data[m_in.read] == 0x07 && m_regs_w [1] > 4) - { - m_in.write = 0; - m_in.read = 0; - m_in.data[m_in.write++] = m_regs_w[1] & 0x7f; - } - } - } - - if (m_in.write) - { - UINT8 cmd_len = t6834_cmd_len[m_in.data[m_in.read]]; - if(cmd_len & 0x80) - { - if((cmd_len & 0x7f) < m_in.write && !m_regs_w[1]) - cmd_len = m_in.write; - } - - if(m_in.write == cmd_len) - { - m_out.write = 0; - m_out.read = 0; - t6834_cmd(m_in.data[m_in.read++]); - m_in.write = 0; - m_in.read = 0; - if(m_out.write) - { - m_regs_r[0] = 0x40; - m_regs_r[1] = m_out.data[m_out.read]; - m_regs_r[2] |= 0x01; - m_maincpu->set_input_line(NSC800_RSTA, ASSERT_LINE); - m_rsta_clear->adjust(attotime::from_msec(50)); - } - } - } -} - -void x07_state::cassette_r() -{ - m_regs_r[6] &= ~2; -} - -void x07_state::cassette_w() -{ - m_regs_r[6] &= ~1; - m_cass_data = m_regs_w[7]; -} - -TIMER_CALLBACK_MEMBER(x07_state::cassette_tick) -{ - m_cass_clk++; -} - -TIMER_CALLBACK_MEMBER(x07_state::cassette_poll) -{ - if ((m_cassette->get_state() & 0x03) == CASSETTE_PLAY) - cassette_load(); - else if ((m_cassette->get_state() & 0x03) == CASSETTE_RECORD) - cassette_save(); -} - -void x07_state::cassette_load() -{ - int cass = (m_cassette->input() >= 0) ? +1 : -1; - if (cass > 0 && m_cass_state < 0) - { - if ((m_cass_clk & 0x7f) >= 4 && (m_cass_clk & 0x7f) <= 6) - { - if (m_cass_clk & 0x80) - { - m_cass_clk = 0; - receive_bit(1); - } - else - { - m_cass_clk = 0x80; - } - } - else if ((m_cass_clk & 0x7f) >= 9 && (m_cass_clk & 0x7f) <= 11) - { - m_cass_clk = 0; - receive_bit(0); - } - else - { - m_cass_clk = 0; - logerror("Invalid data: %d %f\n", (m_cass_clk & 0x7f), m_cassette->get_position()); - } - - m_cass_tick->adjust(attotime::from_hz(12000), 0, attotime::from_hz(12000)); - } - - m_cass_state = cass; -} - - -void x07_state::cassette_save() -{ - int cass = m_cass_state; - - if (m_cass_clk % 10 == 0) - { - if (m_bit_count < 4) - { - switch (m_bit_count & 3) - { - case 0: case 1: cass = +1; break; - case 2: case 3: cass = -1; break; - } - - m_bit_count++; - } - else if (m_bit_count < 36) - { - switch (m_bit_count & 3) - { - case 0: cass = +1; break; - case 1: cass = (m_cass_data & 1) ? -1 : +1; break; - case 2: cass = (m_cass_data & 1) ? +1 : -1; break; - case 3: cass = -1; m_cass_data >>= 1; break; - } - - m_bit_count++; - } - else if (m_bit_count < 48) - { - switch (m_bit_count & 3) - { - case 0: case 2: cass = +1; break; - case 1: case 3: cass = -1; break; - } - - if (m_bit_count == 47) - m_regs_r[6] |= 1; - - m_bit_count++; - } - else - { - cass = (m_cass_state > 0) ? -1 : +1; - } - - m_cassette->output( cass ); - } - - // finish the current cycle before start the next - if ((m_cass_state <= 0) && !(m_regs_r[6] & 1) && m_bit_count >= 48) - m_bit_count = 0; - - m_cass_state = cass; - m_cass_clk++; -} - -void x07_state::receive_bit(int bit) -{ - if (m_bit_count == 0) - { - // wait for start bit - if (bit == 0) - m_bit_count++; - } - else if (m_bit_count < 9) - { - m_cass_data = (m_cass_data>>1) | (bit<<7); - m_bit_count++; - } - else if (m_bit_count < 12) - { - if (bit != 1) - logerror("Invalid stop bit: %f\n", m_cassette->get_position()); - - m_bit_count++; - } - - // every byte take 12 bit - if (m_bit_count == 12) - { - //printf("data: %02x %f\n", m_cass_data, m_cassette->get_position()); - m_regs_r[6] |= 2; - m_regs_r[7] = m_cass_data; - m_cass_data = 0; - m_bit_count = 0; - - m_maincpu->set_input_line(NSC800_RSTB, ASSERT_LINE); - m_rstb_clear->adjust(attotime::from_usec(200)); - - } -} - - -/**************************************************** - this function emulate the color printer X-710 - only the text functions are emulated -****************************************************/ -void x07_state::printer_w() -{ - UINT16 char_pos = 0; -// UINT16 text_color = 0; -// UINT16 text_size = 1; - - if (m_regs_r[4] & 0x20) - m_prn_char_code |= 1; - - m_prn_sendbit++; - - if (m_prn_sendbit == 8) - { - if (m_prn_char_code) - { - m_prn_buffer[m_prn_size++] = m_prn_char_code; - - if (m_prn_buffer[m_prn_size - 2] == 0x4f && m_prn_buffer[m_prn_size - 1] == 0xaf) - { - if (m_prn_buffer[0] == 0xff && m_prn_buffer[1] == 0xb7) - { - for (int i = 2; i < m_prn_size - 2; i++) - { -/* - if (m_prn_buffer[i - 1] == 0x4f && m_prn_buffer[i] == 0x3d) - text_color = printer_charcode[m_prn_buffer[i + 1]] - 0x30; - - if (m_prn_buffer[i - 1] == 0x4f && m_prn_buffer[i] == 0x35) - { - if (m_prn_buffer[i + 2] == 0x4f) - text_size = printer_charcode[m_prn_buffer[i + 1]] - 0x2f; - else - text_size = 0x0a + (printer_charcode[m_prn_buffer[i + 2]] - 0x2f); - } -*/ - if (m_prn_buffer[i - 1] == 0x4f && m_prn_buffer[i] == 0x77) - { - char_pos = i + 1 ; - break; - } - } - } - - //send the chars to the printer, color and size are not used - for (int i = char_pos ;i < m_prn_size ; i++) - m_printer->output(printer_charcode[m_prn_buffer[i]]); - - //clears the print buffer - memset(m_prn_buffer, 0, sizeof(m_prn_buffer)); - m_prn_size = 0; - } - } - - m_prn_sendbit = 0; - m_prn_char_code = 0; - m_regs_r[2] |= 0x80; - } - else - m_prn_char_code <<= 1; -} - -inline UINT8 x07_state::kb_get_index(UINT8 char_code) -{ - for(UINT8 i=0 ; i< ARRAY_LENGTH(x07_keycodes); i++) - if (x07_keycodes[i].codes[0] == char_code) - return i; - - return 0; -} - -inline UINT8 x07_state::get_char(UINT16 pos) -{ - UINT8 code = pos>>3; - - if(code>=128 && code<=159) //UDC 0 - { - return m_t6834_ram[pos - 0x200]; - } - else if(code>=224) //UDC 1 - { - return m_t6834_ram[pos - 0x400]; - } - else //charset - { - return memregion("gfx1")->base()[pos]; - } -} - -INPUT_CHANGED_MEMBER( x07_state::kb_func_keys ) -{ - UINT8 data = 0; - UINT8 idx = (UINT8)(FPTR)param; - - if (m_kb_on && newval) - { - UINT8 shift = (ioport("A1")->read() & 0x01); - UINT16 udk_s = udk_offset[(shift*6) + idx - 1]; - - /* First 3 chars are used for description */ - udk_s += 3; - - do - { - data = m_t6834_ram[udk_s++]; - - if (m_kb_size < 0xff && data != 0) - m_t6834_ram[0x400 + m_kb_size++] = data; - } while(data != 0); - - kb_irq(); - } -} - -INPUT_CHANGED_MEMBER( x07_state::kb_keys ) -{ - UINT8 modifier; - UINT8 a1 = ioport("A1")->read(); - UINT8 bz = ioport("BZ")->read(); - UINT8 keycode = (UINT8)(FPTR)param; - - if (m_kb_on && !newval) - { - if (a1 == 0x01 && bz == 0x00) //Shift - modifier = 1; - else if (a1 == 0x02 && bz == 0x00) //CTRL - modifier = 2; - else if (a1 == 0x00 && bz == 0x08) //Num - modifier = 3; - else if (a1 == 0x00 && bz == 0x02) //Kana - modifier = 4; - else if (a1 == 0x01 && bz == 0x02) //Shift+Kana - modifier = 5; - else if (a1 == 0x00 && bz == 0x04) //Graph - modifier = 6; - else - modifier = 0; - - if (m_kb_size < 0xff) - { - UINT8 idx = kb_get_index(keycode); - m_t6834_ram[0x400 + m_kb_size++] = x07_keycodes[idx].codes[modifier]; - } - - kb_irq(); - } -} - -INPUT_CHANGED_MEMBER( x07_state::kb_update_udk ) -{ - draw_udk(); -} - -INPUT_CHANGED_MEMBER( x07_state::kb_break ) -{ - if (newval) - { - if (!m_lcd_on) - { - m_lcd_on = 1; - m_maincpu->set_state_int(Z80_PC, 0xc3c3); - } - else - { - m_regs_r[0] = 0x80; - m_regs_r[1] = 0x05; - m_regs_r[2] |= 0x01; - m_maincpu->set_input_line(NSC800_RSTA, ASSERT_LINE ); - m_rsta_clear->adjust(attotime::from_msec(50)); - } - } -} - - -void x07_state::kb_irq() -{ - if (m_kb_size) - { - m_regs_r[0] = 0; - m_regs_r[1] = m_t6834_ram[0x400]; - memcpy(m_t6834_ram + 0x400, m_t6834_ram + 0x401, 0xff); - m_kb_size--; - m_regs_r[2] |= 0x01; - m_maincpu->set_input_line(NSC800_RSTA, ASSERT_LINE); - m_rsta_clear->adjust(attotime::from_msec(50)); - } -} - - -/*************************************************************************** - Video -***************************************************************************/ - -inline void x07_state::draw_char(UINT8 x, UINT8 y, UINT8 char_pos) -{ - if(x < 20 && y < 4) - for(int cy = 0; cy < 8; cy++) - for(int cx = 0; cx < 6; cx++) - m_lcd_map[y * 8 + cy][x * 6 + cx] = (get_char(((char_pos << 3) + cy) & 0x7ff) & (0x80>>cx)) ? 1 : 0; -} - - -inline void x07_state::draw_point(UINT8 x, UINT8 y, UINT8 color) -{ - if(x < 120 && y < 32) - m_lcd_map[y][x] = color; -} - - -inline void x07_state::draw_udk() -{ - UINT8 i, x, j; - - if (m_draw_udk) - for(i = 0, x = 0; i < 5; i++) - { - UINT16 ofs = udk_offset[i + ((ioport("A1")->read()&0x01) ? 6 : 0)]; - draw_char(x++, 3, 0x83); - for(j = 0; j < 3; j++) - draw_char(x++, 3, m_t6834_ram[ofs++]); - } -} - -DEVICE_IMAGE_LOAD_MEMBER( x07_state, x07_card ) -{ - UINT32 size = m_card->common_get_size("rom"); - - // check card type - if (image.software_entry() != NULL) - { - const char *card_type = image.get_feature("card_type"); - - if (strcmp(card_type, "xp140")) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported card type"); - return IMAGE_INIT_FAIL; - } - } - - m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG); - m_card->common_load_rom(m_card->get_rom_base(), size, "rom"); - - m_card->ram_alloc(0x1000); - - return IMAGE_INIT_PASS; -} - -PALETTE_INIT_MEMBER(x07_state, x07) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - - -UINT32 x07_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0); - - if (m_lcd_on) - { - for(int py = 0; py < 4; py++) - for(int px = 0; px < 20; px++) - for(int y = 0; y < 8; y++) - for (int x=0; x<6; x++) - if(m_cursor.on && m_blink && m_cursor.x == px && m_cursor.y == py) - bitmap.pix16(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; - else - bitmap.pix16(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; - - } - - return 0; -} - - -/*************************************************************************** - Machine -***************************************************************************/ - -READ8_MEMBER( x07_state::x07_io_r ) -{ - UINT8 data = 0xff; - - switch(offset) - { - case 0x80: - case 0x81: - case 0x82: - case 0x83: - case 0x84: - case 0x85: - case 0x86: - case 0x87: - case 0x88: - case 0x89: - case 0x8a: - case 0x8b: - case 0x8c: - data = ((offset & 0x0f) < 8) ? get_char((m_font_code << 3) | (offset & 7)) : 0; - break; - - case 0x90: - data = 0x00; - break; - case 0xf6: - if (m_cass_motor) m_regs_r[6] |= 4; - //fall through - case 0xf0: - case 0xf1: - case 0xf3: - case 0xf4: - case 0xf5: - case 0xf7: - data = m_regs_r[offset & 7]; - break; - - case 0xf2: - if(m_regs_w[5] & 4) - m_regs_r[2] |= 2; - else - m_regs_r[2] &= 0xfd; - data = m_regs_r[2] | 2; - break; - } - - return data; -} - - -WRITE8_MEMBER( x07_state::x07_io_w ) -{ - switch(offset) - { - case 0x80: - m_font_code = data; - break; - - case 0xf0: - case 0xf1: - case 0xf2: - case 0xf3: - case 0xf6: - case 0xf7: - m_regs_w[offset & 7] = data; - break; - - case 0xf4: - m_regs_r[4] = m_regs_w[4] = data; - m_cass_motor = ((data & 0x0d) == 0x09) ? 1 : 0; - - if (m_cass_motor) - { - m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_cass_poll->adjust(attotime::from_hz(48000), 0, attotime::from_hz(48000)); - } - else - { - m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_cass_poll->reset(); - m_cass_tick->reset(); - } - -#if(1) - if((data & 0x0e) == 0x0e) - { - m_beep->set_state(1); - m_beep->set_frequency(192000 / ((m_regs_w[2] | (m_regs_w[3] << 8)) & 0x0fff)); - - m_beep_stop->adjust(attotime::from_msec(m_ram->pointer()[0x450] * 0x20)); - } - else - m_beep->set_state(0); -#endif - break; - - case 0xf5: - if(data & 0x01) - t6834_r(); - if(data & 0x02) - t6834_w(); - if(data & 0x04) - cassette_r(); - if(data & 0x08) - cassette_w(); - if(data & 0x20) - printer_w(); - - m_regs_w[5] = data; - break; - } -} - -static ADDRESS_MAP_START(x07_mem, AS_PROGRAM, 8, x07_state) - ADDRESS_MAP_UNMAP_LOW - AM_RANGE(0x0000, 0x1fff) AM_NOP //RAM installed at runtime - AM_RANGE(0x2000, 0x7fff) AM_NOP //Memory Card RAM/ROM - AM_RANGE(0x8000, 0x97ff) AM_RAM //TV VRAM - AM_RANGE(0x9800, 0x9fff) AM_UNMAP //unused/unknown - AM_RANGE(0xa000, 0xafff) AM_ROM AM_REGION("x720", 0) //TV ROM - AM_RANGE(0xb000, 0xffff) AM_ROM AM_REGION("basic", 0) //BASIC ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( x07_io , AS_IO, 8, x07_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK (0xff) - AM_RANGE(0x00, 0xff) AM_READWRITE(x07_io_r, x07_io_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( x07 ) - PORT_START("BATTERY") - PORT_CONFNAME( 0x40, 0x30, "Battery Status" ) - PORT_CONFSETTING( 0x30, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x40, "Low Battery" ) - PORT_START("CARDBATTERY") - PORT_CONFNAME( 0x10, 0x00, "Card Battery Status" ) - PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) - PORT_CONFSETTING( 0x10, "Low Battery" ) - - PORT_START("S1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x12) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x16) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x1c) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x1d) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x1e) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x1f) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x20) - PORT_START("S2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x5a) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x58) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x43) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x56) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x42) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4e) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4d) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x2c) - PORT_START("S3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x41) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x53) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x44) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x46) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x47) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x48) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4a) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4b) - PORT_START("S4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x51) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x57) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x45) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x52) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x54) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x59) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x55) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x49) - PORT_START("S5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x31) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x32) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x33) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x34) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x35) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x36) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x37) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x38) - PORT_START("S6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 3) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 4) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 5) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_func_keys, 6) - PORT_START("S7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x2e) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x2f) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CHAR('?') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x3f) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x0d) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4f) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x50) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR('@') PORT_CHAR('\'') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x40) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x5b) - PORT_START("S8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x4c) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(';') PORT_CHAR('+') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x3b) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x3a) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x5d) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x39) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('|') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x30) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x2d) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('`') PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x3d) - PORT_START("BZ") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_keys, 0x0b) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("KANA") PORT_CODE(KEYCODE_RALT) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("GRPH") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NUM") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("OFF") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ON/BREAK") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_break, 0) - PORT_START("A1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED_MEMBER(DEVICE_SELF,x07_state,kb_update_udk, 0) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) -INPUT_PORTS_END - - -void x07_state::nvram_init(nvram_device &nvram, void *data, size_t size) -{ - memcpy(data, memregion("default")->base(), size); - m_warm_start = 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(x07_state::blink_timer) -{ - m_blink = !m_blink; -} - -TIMER_CALLBACK_MEMBER(x07_state::rsta_clear) -{ - m_maincpu->set_input_line(NSC800_RSTA, CLEAR_LINE); - - if (m_kb_size) - kb_irq(); -} - -TIMER_CALLBACK_MEMBER(x07_state::rstb_clear) -{ - m_maincpu->set_input_line(NSC800_RSTB, CLEAR_LINE); -} - -TIMER_CALLBACK_MEMBER(x07_state::beep_stop) -{ - m_beep->set_state(0); -} - -static const gfx_layout x07_charlayout = -{ - 6, 8, /* 6 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - { 0, 1, 2, 3, 4, 5}, - { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, - 8*8 /* 8 bytes */ -}; - -static GFXDECODE_START( x07 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, x07_charlayout, 0, 1 ) -GFXDECODE_END - -void x07_state::machine_start() -{ - UINT32 ram_size = m_ram->size(); - m_rsta_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rsta_clear),this)); - m_rstb_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rstb_clear),this)); - m_beep_stop = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::beep_stop),this)); - m_cass_poll = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_poll),this)); - m_cass_tick = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_tick),this)); - - m_nvram1->set_base(&m_t6834_ram, 0x800); - m_nvram2->set_base(m_ram->pointer(), ram_size); - - /* Save State */ - save_item(NAME(m_sleep)); - save_item(NAME(m_warm_start)); - save_item(NAME(m_udk_on)); - save_item(NAME(m_draw_udk)); - save_item(NAME(m_sp_on)); - save_item(NAME(m_font_code)); - save_item(NAME(m_lcd_on)); - save_item(NAME(m_scroll_min)); - save_item(NAME(m_scroll_max)); - save_item(NAME(m_blink)); - save_item(NAME(m_kb_on)); - save_item(NAME(m_repeat_key)); - save_item(NAME(m_kb_size)); - save_item(NAME(m_prn_sendbit)); - save_item(NAME(m_prn_char_code)); - save_item(NAME(m_prn_size)); - save_item(NAME(m_cass_motor)); - save_item(NAME(m_cass_data)); - save_item(NAME(m_cass_clk)); - save_item(NAME(m_cass_state)); - save_item(NAME(m_bit_count)); - save_item(NAME(m_t6834_ram)); - save_item(NAME(m_regs_r)); - save_item(NAME(m_regs_w)); - save_item(NAME(m_alarm)); - save_item(NAME(m_lcd_map)); - save_item(NAME(m_prn_buffer)); - save_item(NAME(m_in.read)); - save_item(NAME(m_in.write)); - save_item(NAME(m_in.data)); - save_item(NAME(m_out.read)); - save_item(NAME(m_out.write)); - save_item(NAME(m_out.data)); - save_item(NAME(m_locate.x)); - save_item(NAME(m_locate.y)); - save_item(NAME(m_locate.on)); - save_item(NAME(m_cursor.x)); - save_item(NAME(m_cursor.y)); - save_item(NAME(m_cursor.on)); - - // install RAM - address_space &program = m_maincpu->space(AS_PROGRAM); - program.install_ram(0x0000, ram_size - 1, m_ram->pointer()); - - // card - if (m_card->exists()) - { - // 0x4000 - 0x4fff 4KB RAM - // 0x6000 - 0x7fff 8KB ROM - program.install_read_handler(ram_size, ram_size + 0xfff, read8_delegate(FUNC(generic_slot_device::read_ram),(generic_slot_device*)m_card)); - program.install_write_handler(ram_size, ram_size + 0xfff, write8_delegate(FUNC(generic_slot_device::write_ram),(generic_slot_device*)m_card)); - program.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_card)); - - m_card->save_ram(); - } -} - -void x07_state::machine_reset() -{ - memset(m_regs_r, 0, sizeof(m_regs_r)); - memset(m_regs_w, 0, sizeof(m_regs_w)); - memset(m_alarm, 0, sizeof(m_alarm)); - memset(&m_in, 0, sizeof(m_in)); - memset(&m_out, 0, sizeof(m_out)); - memset(&m_locate, 0, sizeof(m_locate)); - memset(&m_cursor, 0, sizeof(m_cursor)); - memset(m_prn_buffer, 0, sizeof(m_prn_buffer)); - memset(m_lcd_map, 0, sizeof(m_lcd_map)); - - m_sleep = 0; - m_udk_on = 0; - m_draw_udk = 0; - m_sp_on = 0; - m_font_code = 0; - m_lcd_on = 1; - m_scroll_min = 0; - m_scroll_max = 3; - m_blink = 0; - m_kb_on = 0; - m_repeat_key = 0; - m_kb_size = 0; - m_repeat_key = 0; - m_prn_sendbit = 0; - m_prn_char_code = 0; - m_prn_size = 0; - - m_regs_r[2] = ioport("CARDBATTERY")->read(); - - m_maincpu->set_state_int(Z80_PC, 0xc3c3); -} - -static MACHINE_CONFIG_START( x07, x07_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NSC800, XTAL_15_36MHz / 4) - MCFG_CPU_PROGRAM_MAP(x07_mem) - MCFG_CPU_IO_MAP(x07_io) - - /* video hardware */ - MCFG_SCREEN_ADD("lcd", LCD) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(x07_state, screen_update) - MCFG_SCREEN_SIZE(120, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 32-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(x07_state, x07) - MCFG_DEFAULT_LAYOUT(layout_lcd) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", x07) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO( "mono" ) - MCFG_SOUND_ADD( "beeper", BEEP, 0 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 0.50 ) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* printer */ - MCFG_DEVICE_ADD("printer", PRINTER, 0) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("blink_timer", x07_state, blink_timer, attotime::from_msec(300)) - - MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram1", x07_state, nvram_init) // t6834 RAM - MCFG_NVRAM_ADD_0FILL("nvram2") // RAM banks - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - // 8KB no expansion - // 12KB XM-100 - // 16KB XR-100 or XM-101 - // 20KB XR-100 and XM-100 - // 24KB XR-100 and XM-101 - MCFG_RAM_DEFAULT_SIZE("16K") - MCFG_RAM_EXTRA_OPTIONS("8K,12K,20K,24k") - - /* Memory Card */ - MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_romram_plain_slot, "x07_card") - MCFG_GENERIC_EXTENSIONS("rom,bin") - MCFG_GENERIC_LOAD(x07_state, x07_card) - - /* cassette */ - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(x07_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("x07_cass") - - /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("card_list", "x07_card") - MCFG_SOFTWARE_LIST_ADD("cass_list", "x07_cass") -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( x07 ) - ROM_REGION( 0x6000, "basic", ROMREGION_ERASEFF ) - ROM_LOAD( "x07.bin", 0x0000, 0x5001, BAD_DUMP CRC(61a6e3cc) SHA1(c53c22d33085ac7d5e490c5d8f41207729e5f08a) ) //very strange size... - - ROM_REGION( 0x1000, "x720", ROMREGION_ERASEFF ) - ROM_LOAD( "x720.bin", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x0800, "gfx1", 0 ) - ROM_LOAD( "charset.rom", 0x0000, 0x0800, BAD_DUMP CRC(b1e59a6e) SHA1(b0c06315a2d5c940a8f288fb6a3428d738696e69) ) - - ROM_REGION( 0x0800, "default", ROMREGION_ERASE00 ) -ROM_END - -DRIVER_INIT_MEMBER(x07_state, x07) -{ - UINT8 *RAM = memregion("default")->base(); - UINT8 *GFX = memregion("gfx1")->base(); - - for (int i = 0; i < 12; i++) - strcpy((char *)RAM + udk_offset[i], udk_ini[i]); - - //copy default chars in the UDC - memcpy(RAM + 0x200, GFX + 0x400, 0x100); - memcpy(RAM + 0x300, GFX + 0x700, 0x100); -} - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, x07, 0, 0, x07, x07, x07_state, x07, "Canon", "X-07", MACHINE_SUPPORTS_SAVE) diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c deleted file mode 100644 index 9bad6b21493..00000000000 --- a/src/mess/drivers/x1.c +++ /dev/null @@ -1,2649 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese, Barry Rodewald -/************************************************************************************************ - - Sharp X1 (c) 1983 Sharp Corporation - - driver by Angelo Salese & Barry Rodewald, - special thanks to Dirk Best for various wd17xx fixes - - TODO: - - Rewrite keyboard input hook-up and decap/dump the keyboard MCU if possible; - - Fix the 0xe80/0xe83 kanji ROM readback; - - x1turbo keyboard inputs are currently broken, use x1turbo40 for now; - - Hook-up remaining .tap image formats; - - Implement APSS tape commands; - - Sort out / redump the BIOS gfx roms; - - X1Turbo: Implement SIO. - - Implement true 400 lines mode (i.e. Chatnoir no Mahjong v2.1, Casablanca) - - Implement SASI HDD interface; - - clean-ups! - - There are various unclear video things, these are: - - Implement the remaining scrn regs; - - Implement the new features of the x1turboz, namely the 4096 color feature amongst other things - - (anything else?) - - Driver Configuration switches: - - OPN for X1 - - EMM, and hook-up for X1 too - - RAM size for EMM - - specific x1turboz features? - - per-game/program specific TODO: - - CZ8FB02 / CZ8FB03: doesn't load at all, they are 2hd floppies apparently; - - Chack'n Pop: game is too fast, presumably missing wait states; - - Dragon Buster: it crashed to me once with a obj flag hang; - - The Goonies (x1 only): goes offsync with the PCG beam positions; - - Graphtol: sets up x1turboz paletteram, graphic garbage due of it; - - Gyajiko2: hangs when it's supposed to load the character selection screen, FDC bug? - - Hydlide 3: can't get the user disk to work properly, could be a bad dump; - - Lupin the 3rd: don't know neither how to "data load" nor how to "create a character" ... does the game hangs? - - Might & Magic: uses 0xe80-3 kanji ports, should be a good test case for that; - - "newtype": trips a z80dma assert, worked around for now; - - Saziri: doesn't re-initialize the tilemap attribute vram when you start a play, making it to have missing colors if you don't start a play in time; - - Suikoden: shows a JP message error (DFJustin: "Problem with the disk device !! Please set a floppy disk properly and press the return key. Retrying.") - - Super Billiards (X1 Pack 14): has a slight PCG timing bug, that happens randomly; - - Trivia-Q: dunno what to do on the selection screen, missing inputs? - - Turbo Alpha: has z80dma / fdc bugs, doesn't show the presentation properly and then hangs; - - Will 2: doesn't load, fdc issue presumably (note: it's a x1turbo game ONLY); - - X1F Demo ("New X1 Demo"): needs partial updates, but they doesn't cope well with current video system; - - Ys 2: crashes after the disclaimer screen; - - Ys 3: missing user disk, to hack it (and play with x1turboz features): bp 81ca,pc += 2 - - Ys 3: never uploads a valid 4096 palette, probably related to the fact that we don't have an user disk - - Notes: - - An interesting feature of the Sharp X-1 is the extended i/o bank. When the ppi port c bit 5 - does a 1->0 transition, any write to the i/o space accesses 2 or 3 banks gradients of the bitmap RAM - with a single write (generally used for layer clearances and bitmap-style sprites). - Any i/o read disables this extended bitmap ram. - - I/O port $700 bit 7 of X1 Turbo is a sound (dip-)switch / jumper setting. I don't know yet what is for, - but King's Knight needs it to be active otherwise it refuses to boot. - - ROM format is: - 0x00 ROM id (must be 0x01) - 0x01 - 0x0e ROM header - 0xff16 - 0xff17 start-up vector - In theory, you can convert your tape / floppy games into ROM format easily, provided that you know what's the pinout of the - cartridge slot and it doesn't exceed 64k (0x10000) of size. - - Gruppe: shows a random bitmap graphic then returns "program load error" ... it wants that the floppy has write protection enabled (!) (btanb) - - Maidum: you need to load BOTH disk with write protection disabled, otherwise it refuses to run. (btanb) - - Marvelous: needs write protection disabled (btanb) - - Chack'n Pop: to load this game, do a files command on the "Jodan Dos" prompt then move the cursor up at the "Chack'n Pop" file. - Substitute bin with load and press enter. Finally, do a run once that it loaded correctly. - - Faeries Residence: to load this game, put a basic v2.0 in drive 0, then execute a NEWON command. Load game disks into drive 0 and 1 then - type run"START" (case sensitive) - - POPLEMON: same as above, but you need to type run"POP" - -================================================================================================= - - X1 (CZ-800C) - November, 1982 - * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) - * ROM: IPL (4KB) + chargen (2KB) - * RAM: Main memory (64KB) + VRAM (4KB) + RAM for PCG (6KB) + GRAM (48KB, Option) - * Text Mode: 80x25 or 40x25 - * Graphic Mode: 640x200 or 320x200, 8 colors - * Sound: PSG 8 octave - * I/O Ports: Centronic ports, 2 Joystick ports, Cassette port (2700 baud) - - X1C (CZ-801C) - October, 1983 - * same but only 48KB GRAM - - X1D (CZ-802C) - October, 1983 - * same as X1C but with a 3" floppy drive (notice: 3" not 3" 1/2!!) - - X1Cs (CZ-803C) - June, 1984 - * two expansion I/O ports - - X1Ck (CZ-804C) - June, 1984 - * same as X1Cs - * ROM: IPL (4KB) + chargen (2KB) + Kanji 1st level - - X1F Model 10 (CZ-811C) - July, 1985 - * Re-designed - * ROM: IPL (4KB) + chargen (2KB) - - X1F Model 20 (CZ-812C) - July, 1985 - * Re-designed (same as Model 10) - * ROM: IPL (4KB) + chargen (2KB) + Kanji - * Built Tape drive plus a 5" floppy drive was available - - X1G Model 10 (CZ-820C) - July, 1986 - * Re-designed again - * ROM: IPL (4KB) + chargen (2KB) - - X1G Model 30 (CZ-822C) - July, 1986 - * Re-designed again (same as Model 10) - * ROM: IPL (4KB) + chargen (2KB) + Kanji - * Built Tape drive plus a 5" floppy drive was available - - X1twin (CZ-830C) - December, 1986 - * Re-designed again (same as Model 10) - * ROM: IPL (4KB) + chargen (2KB) + Kanji - * Built Tape drive plus a 5" floppy drive was available - * It contains a PC-Engine - - ============= X1 Turbo series ============= - - X1turbo Model 30 (CZ-852C) - October, 1984 - * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) - * ROM: IPL (32KB) + chargen (8KB) + Kanji (128KB) - * RAM: Main memory (64KB) + VRAM (6KB) + RAM for PCG (6KB) + GRAM (96KB) - * Text Mode: 80xCh or 40xCh with Ch = 10, 12, 20, 25 (same for Japanese display) - * Graphic Mode: 640x200 or 320x200, 8 colors - * Sound: PSG 8 octave - * I/O Ports: Centronic ports, 2 Joystick ports, built-in Cassette interface, - 2 Floppy drive for 5" disks, two expansion I/O ports - - X1turbo Model 20 (CZ-851C) - October, 1984 - * same as Model 30, but only 1 Floppy drive is included - - X1turbo Model 10 (CZ-850C) - October, 1984 - * same as Model 30, but Floppy drive is optional and GRAM is 48KB (it can - be expanded to 96KB however) - - X1turbo Model 40 (CZ-862C) - July, 1985 - * same as Model 30, but uses tv screen (you could watch television with this) - - X1turboII (CZ-856C) - November, 1985 - * same as Model 30, but restyled, cheaper and sold with utility software - - X1turboIII (CZ-870C) - November, 1986 - * with two High Density Floppy driver - - X1turboZ (CZ-880C) - December, 1986 - * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) - * ROM: IPL (32KB) + chargen (8KB) + Kanji 1st & 2nd level - * RAM: Main memory (64KB) + VRAM (6KB) + RAM for PCG (6KB) + GRAM (96KB) - * Text Mode: 80xCh or 40xCh with Ch = 10, 12, 20, 25 (same for Japanese display) - * Graphic Mode: 640x200 or 320x200, 8 colors [in compatibility mode], - 640x400, 8 colors (out of 4096); 320x400, 64 colors (out of 4096); - 320x200, 4096 colors [in multimode], - * Sound: PSG 8 octave + FM 8 octave - * I/O Ports: Centronic ports, 2 Joystick ports, built-in Cassette interface, - 2 Floppy drive for HD 5" disks, two expansion I/O ports - - X1turboZII (CZ-881C) - December, 1987 - * same as turboZ, but added 64KB expansion RAM - - X1turboZIII (CZ-888C) - December, 1988 - * same as turboZII, but no more built-in cassette drive - - Please refer to http://www2s.biglobe.ne.jp/~ITTO/x1/x1menu.html for - more info - - BASIC has to be loaded from external media (tape or disk), the - computer only has an Initial Program Loader (IPL) - -================================================================================================= - - x1turbo specs (courtesy of Yasuhiro Ogawa): - - upper board: Z80A-CPU - Z80A-DMA - Z80A-SIO(O) - Z80A-CTC - uPD8255AC - LH5357(28pin mask ROM. for IPL?) - YM2149F - 16.000MHz(X1) - - lower board: IX0526CE(HN61364) (28pin mask ROM. for ANK font?) - MB83256x4 (Kanji ROMs) - HD46505SP (VDP) - M80C49-277 (MCU) - uPD8255AC - uPD1990 (RTC) + battery - 6.000MHz(X2) - 42.9545MHz(X3) - - FDD I/O board: MB8877A (FDC) - MB4107 (VFO) - - RAM banks: - upper board: MB8265A-15 x8 (main memory) - lower board: MB8416A-12 x3 (VRAM) - MB8416A-15 x3 (PCG RAM) - MB81416-10 x12 (GRAM) - -************************************************************************************************/ - -#include "includes/x1.h" -#include "formats/2d_dsk.h" - -#define MAIN_CLOCK XTAL_16MHz -#define VDP_CLOCK XTAL_42_9545MHz -#define MCU_CLOCK XTAL_6MHz - - - - -/************************************* - * - * Video Functions - * - *************************************/ - -VIDEO_START_MEMBER(x1_state,x1) -{ - m_avram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_tvram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_kvram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_gfx_bitmap_ram = auto_alloc_array_clear(machine(), UINT8, 0xc000*2); - m_pal_4096 = auto_alloc_array_clear(machine(), UINT8, 0x1000*3); -} - -void x1_state::x1_draw_pixel(bitmap_rgb32 &bitmap,int y,int x,UINT16 pen,UINT8 width,UINT8 height) -{ - if(!machine().first_screen()->visible_area().contains(x, y)) - return; - - if(width && height) - { - bitmap.pix32(y+0+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+0+m_ystart, x+1+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+1+m_xstart) = m_palette->pen(pen); - } - else if(width) - { - bitmap.pix32(y+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+m_ystart, x+1+m_xstart) = m_palette->pen(pen); - } - else if(height) - { - bitmap.pix32(y+0+m_ystart, x+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+m_xstart) = m_palette->pen(pen); - } - else - bitmap.pix32(y+m_ystart, x+m_xstart) = m_palette->pen(pen); -} - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff)) - - -/* adjust tile index when we are under double height condition */ -UINT8 x1_state::check_prev_height(int x,int y,int x_size) -{ - UINT8 prev_tile = m_tvram[(x+((y-1)*x_size)+mc6845_start_addr) & 0x7ff]; - UINT8 cur_tile = m_tvram[(x+(y*x_size)+mc6845_start_addr) & 0x7ff]; - UINT8 prev_attr = m_avram[(x+((y-1)*x_size)+mc6845_start_addr) & 0x7ff]; - UINT8 cur_attr = m_avram[(x+(y*x_size)+mc6845_start_addr) & 0x7ff]; - - if(prev_tile == cur_tile && prev_attr == cur_attr) - return 8; - - return 0; -} - -/* Exoa II - Warroid: if double height isn't enabled on the first tile of the line then double height is disabled on everything else. */ -UINT8 x1_state::check_line_valid_height(int y,int x_size,int height) -{ - UINT8 line_attr = m_avram[(0+(y*x_size)+mc6845_start_addr) & 0x7ff]; - - if((line_attr & 0x40) == 0) - return 0; - - return height; -} - -void x1_state::draw_fgtilemap(bitmap_rgb32 &bitmap,const rectangle &cliprect) -{ - /* - attribute table: - x--- ---- double width - -x-- ---- double height - --x- ---- PCG select - ---x ---- color blinking - ---- x--- reverse color - ---- -xxx color pen - - x--- ---- select Kanji ROM - -x-- ---- Kanji side (0=left, 1=right) - --x- ---- Underline - ---x ---- Kanji ROM select (0=level 1, 1=level 2) (TODO: implement this) - ---- xxxx Kanji upper 4 bits - */ - - int y,x,res_x,res_y; - UINT32 tile_offset; - UINT8 x_size,y_size; - - x_size = mc6845_h_display; - y_size = mc6845_v_display; - - if(x_size == 0 || y_size == 0) - return; //don't bother if screen is off - - if(x_size != 80 && x_size != 40 && y_size != 25) - popmessage("%d %d",x_size,y_size); - - for (y=0;ybase(); - int knj_enable = 0; - int knj_side = 0; - int knj_bank = 0; - int knj_uline = 0; - if(m_is_turbo) - { - knj_enable = BIT(m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 7); - knj_side = BIT(m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 6); - knj_uline = BIT(m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 5); - //knj_lv2 = BIT(m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 4); - knj_bank = m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff] & 0x0f; - if(knj_enable) - { - gfx_data = m_kanji_rom; - tile = ((tile + (knj_bank << 8)) << 1) + (knj_side & 1); - } - } - - { - int pen[3],pen_mask,pcg_pen,xi,yi,dy; - - pen_mask = color & 7; - - dy = 0; - - height = check_line_valid_height(y,x_size,height); - - if(height && y) - dy = check_prev_height(x,y,x_size); - - /* guess: assume that Kanji VRAM doesn't double the vertical size */ - if(knj_enable) { height = 0; } - - for(yi=0;yi> (height+m_scrn_reg.v400_mode); - pen[0] = gfx_data[tile_offset+0x0000]>>(7-xi) & (pen_mask & 1)>>0; - pen[1] = gfx_data[tile_offset+0x0000]>>(7-xi) & (pen_mask & 2)>>1; - pen[2] = gfx_data[tile_offset+0x0000]>>(7-xi) & (pen_mask & 4)>>2; - - if(yi == mc6845_tile_height-1 && knj_uline) //underlined attribute - { - pen[0] = (pen_mask & 1)>>0; - pen[1] = (pen_mask & 2)>>1; - pen[2] = (pen_mask & 4)>>2; - } - - if((yi >= 16 && m_scrn_reg.v400_mode == 0) || (yi >= 32 && m_scrn_reg.v400_mode == 1)) - pen[0] = pen[1] = pen[2] = 0; - } - else if(pcg_bank) // PCG - { - tile_offset = tile * 8; - tile_offset += (yi+dy*(m_scrn_reg.v400_mode+1)) >> (height+m_scrn_reg.v400_mode); - - pen[0] = gfx_data[tile_offset+0x0000]>>(7-xi) & (pen_mask & 1)>>0; - pen[1] = gfx_data[tile_offset+0x0800]>>(7-xi) & (pen_mask & 2)>>1; - pen[2] = gfx_data[tile_offset+0x1000]>>(7-xi) & (pen_mask & 4)>>2; - - if((yi >= 8 && m_scrn_reg.v400_mode == 0) || (yi >= 16 && m_scrn_reg.v400_mode == 1)) - pen[0] = pen[1] = pen[2] = 0; - } - else - { - tile_offset = tile * (8*(m_scrn_reg.ank_sel+1)); - tile_offset += (yi+dy*(m_scrn_reg.v400_mode+1)) >> (height+m_scrn_reg.v400_mode); - - pen[0] = gfx_data[tile_offset+m_scrn_reg.ank_sel*0x0800]>>(7-xi) & (pen_mask & 1)>>0; - pen[1] = gfx_data[tile_offset+m_scrn_reg.ank_sel*0x0800]>>(7-xi) & (pen_mask & 2)>>1; - pen[2] = gfx_data[tile_offset+m_scrn_reg.ank_sel*0x0800]>>(7-xi) & (pen_mask & 4)>>2; - - if(m_scrn_reg.ank_sel) - { - if((yi >= 16 && m_scrn_reg.v400_mode == 0) || (yi >= 32 && m_scrn_reg.v400_mode == 1)) - pen[0] = pen[1] = pen[2] = 0; - } - else - { - if((yi >= 8 && m_scrn_reg.v400_mode == 0) || (yi >= 16 && m_scrn_reg.v400_mode == 1)) - pen[0] = pen[1] = pen[2] = 0; - } - } - - pcg_pen = pen[2]<<2|pen[1]<<1|pen[0]<<0; - - if(color & 0x10 && machine().first_screen()->frame_number() & 0x10) //reverse flickering - pcg_pen^=7; - - if(pcg_pen == 0 && (!(color & 8))) - continue; - - if(color & 8) //revert the used color pen - pcg_pen^=7; - - if((m_scrn_reg.blackclip & 8) && (color == (m_scrn_reg.blackclip & 7))) - pcg_pen = 0; // clip the pen to black - - res_x = x*8+xi*(width+1); - res_y = y*(mc6845_tile_height)+yi; - - if(res_y < cliprect.min_y || res_y > cliprect.max_y) // partial update, TODO: optimize - continue; - - x1_draw_pixel(bitmap,res_y,res_x,pcg_pen,width,0); - } - } - } - - if(width) //skip next char if we are under double width condition - x++; - } - } -} - -/* - * Priority Mixer Calculation (pri) - * - * If pri is 0xff then the bitmap entirely covers the tilemap, if it's 0x00 then - * the tilemap priority is entirely above the bitmap. Any other value mixes the - * bitmap and the tilemap priorities based on the pen value, bit 0 = entry 0 <-> bit 7 = entry 7 - * of the bitmap. - * - */ -int x1_state::priority_mixer_pri(int color) -{ - int pri_i,pri_mask_calc; - - pri_i = 0; - pri_mask_calc = 1; - - while(pri_i < 7) - { - if((color & 7) == pri_i) - break; - - pri_i++; - pri_mask_calc<<=1; - } - - return pri_mask_calc; -} - -void x1_state::draw_gfxbitmap(bitmap_rgb32 &bitmap,const rectangle &cliprect, int plane,int pri) -{ - int xi,yi,x,y; - int pen_r,pen_g,pen_b,color; - int pri_mask_val; - UINT8 x_size,y_size; - int gfx_offset; - - x_size = mc6845_h_display; - y_size = mc6845_v_display; - - if(x_size == 0 || y_size == 0) - return; //don't bother if screen is off - - if(x_size != 80 && x_size != 40 && y_size != 25) - popmessage("%d %d",x_size,y_size); - - //popmessage("%04x %02x",mc6845_start_addr,mc6845_tile_height); - - for (y=0;y> m_scrn_reg.v400_mode) * 0x800) & 0x3fff; - pen_b = (m_gfx_bitmap_ram[gfx_offset+0x0000+plane*0xc000]>>(7-xi)) & 1; - pen_r = (m_gfx_bitmap_ram[gfx_offset+0x4000+plane*0xc000]>>(7-xi)) & 1; - pen_g = (m_gfx_bitmap_ram[gfx_offset+0x8000+plane*0xc000]>>(7-xi)) & 1; - - color = (pen_g<<2 | pen_r<<1 | pen_b<<0) | 8; - - pri_mask_val = priority_mixer_pri(color); - if(pri_mask_val & pri) continue; - - if((color == 8 && m_scrn_reg.blackclip & 0x10) || (color == 9 && m_scrn_reg.blackclip & 0x20)) // bitmap color clip to black conditions - color = 0; - - if(y*(mc6845_tile_height)+yi < cliprect.min_y || y*(mc6845_tile_height)+yi > cliprect.max_y) // partial update TODO: optimize - continue; - - x1_draw_pixel(bitmap,y*(mc6845_tile_height)+yi,x*8+xi,color,0,0); - } - } - } - } -} - -UINT32 x1_state::screen_update_x1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(rgb_t(0xff,0x00,0x00,0x00), cliprect); - - /* TODO: correct calculation thru mc6845 regs */ - m_xstart = ((mc6845_h_char_total - mc6845_h_sync_pos) * 8) / 2; - m_ystart = ((mc6845_v_char_total - mc6845_v_sync_pos) * 8) / 2; - -// popmessage("%d %d %d %d",mc6845_h_sync_pos,mc6845_v_sync_pos,mc6845_h_char_total,mc6845_v_char_total); - - draw_gfxbitmap(bitmap,cliprect,m_scrn_reg.disp_bank,m_scrn_reg.pri); - draw_fgtilemap(bitmap,cliprect); - draw_gfxbitmap(bitmap,cliprect,m_scrn_reg.disp_bank,m_scrn_reg.pri^0xff); - - return 0; -} - - -/************************************* - * - * Keyboard MCU simulation - * - *************************************/ - - -UINT16 x1_state::check_keyboard_press() -{ - static const char *const portnames[3] = { "key1","key2","key3" }; - int i,port_i,scancode; - UINT8 keymod = ioport("key_modifiers")->read() & 0x1f; - UINT32 pad = ioport("tenkey")->read(); - UINT32 f_key = ioport("f_keys")->read(); - scancode = 0; - - for(port_i=0;port_i<3;port_i++) - { - for(i=0;i<32;i++) - { - if((ioport(portnames[port_i])->read()>>i) & 1) - { - //key_flag = 1; - if(keymod & 0x02) // shift not pressed - { - if(scancode >= 0x41 && scancode < 0x5a) - scancode += 0x20; // lowercase - } - else - { - if(scancode >= 0x31 && scancode < 0x3a) - scancode -= 0x10; - if(scancode == 0x30) - { - scancode = 0x3d; - } - } - if((keymod & 0x10) == 0) // graph on - scancode |= 0x80; - - return scancode; - } - scancode++; - } - } - - // check numpad - scancode = 0x30; - for(i=0;i<10;i++) - { - if((pad >> i) & 0x01) - { - return scancode | 0x100; - } - scancode++; - } - - // check function keys - scancode = 0x71; - for(i=0;i<5;i++) - { - if((f_key >> i) & 0x01) - { - return (scancode + ((keymod & 0x02) ? 0 : 5)) | 0x100; - } - scancode++; - } - - return 0; -} - -UINT8 x1_state::check_keyboard_shift() -{ - UINT8 val = 0xe0; - /* - all of those are active low - x--- ---- TEN: Numpad, Function key, special input key - -x-- ---- KIN: Valid key - --x- ---- REP: Key repeat - ---x ---- GRAPH key ON - ---- x--- CAPS lock ON - ---- -x-- KANA lock ON - ---- --x- SHIFT ON - ---- ---x CTRL ON - */ - - val |= ioport("key_modifiers")->read() & 0x1f; - - if(check_keyboard_press() != 0) - val &= ~0x40; - - if(check_keyboard_press() & 0x100) //function keys - val &= ~0x80; - - return val; -} - -UINT8 x1_state::get_game_key(UINT8 port) -{ - // key status returned by sub CPU function 0xE3. - // in order from bit 7 to 0: - // port 0: Q,W,E,A,D,Z,X,C - // port 1: numpad 7,4,1,8,2,9,6,3 - // port 2: ESC,1,[-],[+],[*],TAB,SPC,RET ([] = numpad) - // bits are active high - UINT8 ret = 0; - - if (port == 0) - { - UINT32 key3 = ioport("key3")->read(); - if(key3 & 0x00020000) ret |= 0x80; // Q - if(key3 & 0x00800000) ret |= 0x40; // W - if(key3 & 0x00000020) ret |= 0x20; // E - if(key3 & 0x00000002) ret |= 0x10; // A - if(key3 & 0x00000010) ret |= 0x08; // D - if(key3 & 0x04000000) ret |= 0x04; // Z - if(key3 & 0x01000000) ret |= 0x02; // X - if(key3 & 0x00000008) ret |= 0x01; // C - } - else - if (port == 1) - { - UINT32 pad = ioport("tenkey")->read(); - if(pad & 0x00000080) ret |= 0x80; // Tenkey 7 - if(pad & 0x00000010) ret |= 0x40; // Tenkey 4 - if(pad & 0x00000002) ret |= 0x20; // Tenkey 1 - if(pad & 0x00000100) ret |= 0x10; // Tenkey 8 - if(pad & 0x00000004) ret |= 0x08; // Tenkey 2 - if(pad & 0x00000200) ret |= 0x04; // Tenkey 9 - if(pad & 0x00000040) ret |= 0x02; // Tenkey 6 - if(pad & 0x00000008) ret |= 0x01; // Tenkey 3 - } - else - if (port == 2) - { - UINT32 key1 = ioport("key1")->read(); - UINT32 key2 = ioport("key2")->read(); - UINT32 pad = ioport("tenkey")->read(); - if(key1 & 0x08000000) ret |= 0x80; // ESC - if(key2 & 0x00020000) ret |= 0x40; // 1 - if(pad & 0x00000400) ret |= 0x20; // Tenkey - - if(pad & 0x00000800) ret |= 0x10; // Tenkey + - if(pad & 0x00001000) ret |= 0x08; // Tenkey * - if(key1 & 0x00000200) ret |= 0x04; // TAB - if(key2 & 0x00000001) ret |= 0x02; // SPC - if(key1 & 0x00002000) ret |= 0x01; // RET - } - - return ret; -} - -READ8_MEMBER( x1_state::x1_sub_io_r ) -{ - UINT8 ret,bus_res; - - /* Looks like that the HW retains the latest data putted on the bus here, behaviour confirmed by Rally-X */ - if(m_sub_obf) - { - bus_res = m_sub_val[m_key_i]; - /* FIXME: likely to be different here. */ - m_key_i++; - if(m_key_i >= 2) - m_key_i = 0; - - return bus_res; - } - -#if 0 - if(key_flag == 1) - { - key_flag = 0; - return 0x82; //TODO: this is for shift/ctrl/kana lock etc. - } -#endif - - m_sub_cmd_length--; - m_sub_obf = (m_sub_cmd_length) ? 0x00 : 0x20; - - ret = m_sub_val[m_sub_val_ptr]; - - m_sub_val_ptr++; - if(m_sub_cmd_length <= 0) - m_sub_val_ptr = 0; - - return ret; -} - -void x1_state::cmt_command( UINT8 cmd ) -{ - // CMT deck control command (E9 xx) - // E9 00 - Eject - // E9 01 - Stop - // E9 02 - Play - // E9 03 - Fast Forward - // E9 04 - Rewind - // E9 05 - APSS Fast Forward - // E9 06 - APSS Rewind - // E9 0A - Record - /* - APSS is a Sharp invention and stands for Automatic Program Search System, it scans the tape for silent parts that are bigger than 4 seconds. - It's basically used for audio tapes in order to jump over the next/previous "track". - */ - m_cmt_current_cmd = cmd; - - if(m_cassette->get_image() == NULL) //avoid a crash if a disk game tries to access this - return; - - switch(cmd) - { - case 0x01: // Stop - m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - m_cmt_test = 1; - popmessage("CMT: Stop"); - break; - case 0x02: // Play - m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); - popmessage("CMT: Play"); - break; - case 0x03: // Fast Forward - m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - popmessage("CMT: Fast Forward"); - break; - case 0x04: // Rewind - m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - popmessage("CMT: Rewind"); - break; - case 0x05: // APSS Fast Forward - m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - popmessage("CMT: APSS Fast Forward"); - break; - case 0x06: // APSS Rewind - m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - popmessage("CMT: APSS Rewind"); - break; - case 0x0a: // Record - m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - m_cassette->change_state(CASSETTE_RECORD,CASSETTE_MASK_UISTATE); - popmessage("CMT: Record"); - break; - default: - logerror("Unimplemented or invalid CMT command (0x%02x)\n",cmd); - } - logerror("CMT: Command 0xe9-0x%02x received.\n",cmd); -} - -TIMER_DEVICE_CALLBACK_MEMBER(x1_state::x1_cmt_wind_timer) -{ - if(m_cassette->get_image() == NULL) //avoid a crash if a disk game tries to access this - return; - - switch(m_cmt_current_cmd) - { - case 0x03: - case 0x05: // Fast Forwarding tape - m_cassette->seek(1,SEEK_CUR); - if(m_cassette->get_position() >= m_cassette->get_length()) // at end? - cmt_command(0x01); // Stop tape - break; - case 0x04: - case 0x06: // Rewinding tape - m_cassette->seek(-1,SEEK_CUR); - if(m_cassette->get_position() <= 0) // at beginning? - cmt_command(0x01); // Stop tape - break; - } -} - -WRITE8_MEMBER( x1_state::x1_sub_io_w ) -{ - /* sub-routine at $10e sends to these sub-routines when a keyboard input is triggered: - $17a -> floppy - $094 -> ROM - $0c0 -> timer - $052 -> cmt - $0f5 -> reload sub-routine? */ - - if(m_sub_cmd == 0xe4) - { - m_key_irq_vector = data; - logerror("Key vector set to 0x%02x\n",data); - data = 0; - } - - if(m_sub_cmd == 0xe9) - { - cmt_command(data); - data = 0; - } - - if((data & 0xf0) == 0xd0) //reads here tv recording timer data. (Timer set (0xd0) / Timer readout (0xd8)) - { - /* - xx-- ---- mode - --xx xxxx interval - */ - m_sub_val[0] = 0; - /* - xxxx xxxx command code: - 00 timer disabled - 01 TV command - 10 interrupt - 11 Cassette deck - */ - m_sub_val[1] = 0; - /* - ---x xxxx minute - */ - m_sub_val[2] = 0; - /* - ---- xxxx hour - */ - m_sub_val[3] = 0; - /* - xxxx ---- month - ---- -xxx day of the week - */ - m_sub_val[4] = 0; - /* - --xx xxxx day - */ - m_sub_val[5] = 0; - m_sub_cmd_length = 6; - } - - switch(data) - { - case 0xe3: //game key obtaining - m_sub_cmd_length = 3; - m_sub_val[0] = get_game_key(0); - m_sub_val[1] = get_game_key(1); - m_sub_val[2] = get_game_key(2); - break; - case 0xe4: //irq vector setting - break; - //case 0xe5: //timer irq clear - // break; - case 0xe6: //key data readout - m_sub_val[0] = check_keyboard_shift() & 0xff; - m_sub_val[1] = check_keyboard_press() & 0xff; - m_sub_cmd_length = 2; - break; -// case 0xe7: // TV Control -// break; - case 0xe8: // TV Control read-out - m_sub_val[0] = m_sub_cmd; - m_sub_cmd_length = 1; - break; - case 0xe9: // CMT Control - break; - case 0xea: // CMT Control status - m_sub_val[0] = m_cmt_current_cmd; - m_sub_cmd_length = 1; - logerror("CMT: Command 0xEA received, returning 0x%02x.\n",m_sub_val[0]); - break; - case 0xeb: // CMT Tape status - // bit 0 = tape end (0=end of tape) - // bit 1 = tape inserted - // bit 2 = record status (1=OK, 0=write protect) - m_sub_val[0] = 0x05; - if(m_cassette->get_image() != NULL) - m_sub_val[0] |= 0x02; - m_sub_cmd_length = 1; - logerror("CMT: Command 0xEB received, returning 0x%02x.\n",m_sub_val[0]); - break; -// case 0xec: //set date -// break; - case 0xed: //get date - m_sub_val[0] = m_rtc.day; - m_sub_val[1] = (m_rtc.month<<4) | (m_rtc.wday & 0xf); - m_sub_val[2] = m_rtc.year; - m_sub_cmd_length = 3; - break; -// case 0xee: //set time -// break; - case 0xef: //get time - m_sub_val[0] = m_rtc.hour; - m_sub_val[1] = m_rtc.min; - m_sub_val[2] = m_rtc.sec; - m_sub_cmd_length = 3; - break; - } - - m_sub_cmd = data; - - m_sub_obf = (m_sub_cmd_length) ? 0x00 : 0x20; - - if(data != 0xe6) - logerror("SUB: Command byte 0x%02x\n",data); -} - -/************************************* - * - * ROM Image / Banking Handling - * - *************************************/ - - -READ8_MEMBER( x1_state::x1_rom_r ) -{ -// printf("%06x\n",m_rom_index[0]<<16|m_rom_index[1]<<8|m_rom_index[2]<<0); - if (m_cart->exists()) - return m_cart->read_rom(space, (m_rom_index[0] << 16) | (m_rom_index[1] << 8) | (m_rom_index[2] << 0)); - else - return 0; -} - -WRITE8_MEMBER( x1_state::x1_rom_w ) -{ - m_rom_index[offset] = data; -} - -WRITE8_MEMBER( x1_state::x1_rom_bank_0_w ) -{ - m_ram_bank = 0x10; -} - -WRITE8_MEMBER( x1_state::x1_rom_bank_1_w ) -{ - m_ram_bank = 0x00; -} - -/************************************* - * - * MB8877A FDC (wd17XX compatible) - * - *************************************/ - -READ8_MEMBER( x1_state::x1_fdc_r ) -{ - //UINT8 ret = 0; - - switch(offset+0xff8) - { - case 0x0ff8: - return m_fdc->status_r(space, offset); - case 0x0ff9: - return m_fdc->track_r(space, offset); - case 0x0ffa: - return m_fdc->sector_r(space, offset); - case 0x0ffb: - return m_fdc->data_r(space, offset); - case 0x0ffc: - printf("FDC: read FM type\n"); - return 0xff; - case 0x0ffd: - printf("FDC: read MFM type\n"); - return 0xff; - case 0x0ffe: - printf("FDC: read 1.6M type\n"); - return 0xff; - case 0x0fff: - printf("FDC: switching between 500k/1M\n"); - return 0xff; - } - - return 0x00; -} - -WRITE8_MEMBER( x1_state::x1_fdc_w ) -{ - floppy_image_device *floppy = NULL; - - switch(offset+0xff8) - { - case 0x0ff8: - m_fdc->cmd_w(space, offset,data); - break; - case 0x0ff9: - m_fdc->track_w(space, offset,data); - break; - case 0x0ffa: - m_fdc->sector_w(space, offset,data); - break; - case 0x0ffb: - m_fdc->data_w(space, offset,data); - break; - - case 0x0ffc: - switch (data & 0x03) - { - case 0: floppy = m_floppy0->get_device(); break; - case 1: floppy = m_floppy1->get_device(); break; - case 2: floppy = m_floppy2->get_device(); break; - case 3: floppy = m_floppy3->get_device(); break; - } - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->ss_w(BIT(data, 4)); - floppy->mon_w(!BIT(data, 7)); - } - break; - - case 0x0ffd: - case 0x0ffe: - case 0x0fff: - logerror("FDC: undefined write to %04x = %02x\n",offset+0xff8,data); - break; - } -} - -WRITE_LINE_MEMBER(x1_state::fdc_drq_w) -{ - m_dma->rdy_w(state ^ 1); -} - -/************************************* - * - * Programmable Character Generator - * - *************************************/ - -UINT16 x1_state::check_pcg_addr() -{ - if(m_avram[0x7ff] & 0x20) return 0x7ff; - if(m_avram[0x3ff] & 0x20) return 0x3ff; - if(m_avram[0x5ff] & 0x20) return 0x5ff; - if(m_avram[0x1ff] & 0x20) return 0x1ff; - - return 0x3ff; -} - -UINT16 x1_state::check_chr_addr() -{ - if(!(m_avram[0x7ff] & 0x20)) return 0x7ff; - if(!(m_avram[0x3ff] & 0x20)) return 0x3ff; - if(!(m_avram[0x5ff] & 0x20)) return 0x5ff; - if(!(m_avram[0x1ff] & 0x20)) return 0x1ff; - - return 0x3ff; -} - -UINT16 x1_state::get_pcg_addr( UINT16 width, UINT8 y_char_size ) -{ - int hbeam = machine().first_screen()->hpos() >> 3; - int vbeam = machine().first_screen()->vpos() / y_char_size; - UINT16 pcg_offset = ((hbeam + vbeam*width) + (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff))) & 0x7ff; - - //printf("%08x %d %d %d %d\n",(hbeam+vbeam*width),hbeam,vbeam,machine.first_screen()->vpos() & 7,width); - - return pcg_offset; -} - -READ8_MEMBER( x1_state::x1_pcg_r ) -{ - int addr; - int pcg_offset; - UINT8 res; - UINT8 *gfx_data; - - addr = (offset & 0x300) >> 8; - - if(addr == 0 && m_scrn_reg.pcg_mode) // Kanji ROM read, X1Turbo only - { - gfx_data = m_kanji_rom; - pcg_offset = (m_tvram[check_chr_addr()]+(m_kvram[check_chr_addr()]<<8)) & 0xfff; - pcg_offset*=0x20; - pcg_offset+=(offset & 0x0f); - pcg_offset+=(m_kvram[check_chr_addr()] & 0x40) >> 2; //left-right check - - res = gfx_data[pcg_offset]; - } - else - { - UINT8 y_char_size; - - /* addr == 0 reads from the ANK rom */ - gfx_data = addr == 0 ? m_cg_rom : m_pcg_ram; - y_char_size = ((m_crtc_vreg[9]+1) > 8) ? 8 : m_crtc_vreg[9]+1; - if(y_char_size == 0) { y_char_size = 1; } - pcg_offset = m_tvram[get_pcg_addr(m_crtc_vreg[1], y_char_size)]*8; - pcg_offset+= machine().first_screen()->vpos() & (y_char_size-1); - if(addr) { pcg_offset+= ((addr-1)*0x800); } - res = gfx_data[pcg_offset]; - } - - return res; -} - -WRITE8_MEMBER( x1_state::x1_pcg_w ) -{ - int addr,pcg_offset; - - addr = (offset & 0x300) >> 8; - - if(addr == 0) - { - /* NOP */ - logerror("Warning: write to the ANK area! %04x %02x\n",offset,data); - } - else - { - if(m_scrn_reg.pcg_mode) // Hi-Speed Mode, X1Turbo only - { - pcg_offset = m_tvram[check_pcg_addr()]*8; - pcg_offset+= (offset & 0xe) >> 1; - pcg_offset+=((addr-1)*0x800); - m_pcg_ram[pcg_offset] = data; - - pcg_offset &= 0x7ff; - - m_gfxdecode->gfx(3)->mark_dirty(pcg_offset >> 3); - } - else // Compatible Mode - { - UINT8 y_char_size; - - /* TODO: Brain Breaker doesn't work with this arrangement in high resolution mode, check out why */ - y_char_size = (m_crtc_vreg[9]+1) > 8 ? (m_crtc_vreg[9]+1)-8 : m_crtc_vreg[9]+1; - if(y_char_size == 0) { y_char_size = 1; } - pcg_offset = m_tvram[get_pcg_addr(m_crtc_vreg[1], y_char_size)]*8; - pcg_offset+= machine().first_screen()->vpos() & (y_char_size-1); - pcg_offset+= ((addr-1)*0x800); - - m_pcg_ram[pcg_offset] = data; - - pcg_offset &= 0x7ff; - - m_gfxdecode->gfx(3)->mark_dirty(pcg_offset >> 3); - } - } -} - -/************************************* - * - * Other Video-related functions - * - *************************************/ - -/* for bitmap mode */ -void x1_state::set_current_palette() -{ - UINT8 addr,r,g,b; - - for(addr=0;addr<8;addr++) - { - r = ((m_x_r)>>(addr)) & 1; - g = ((m_x_g)>>(addr)) & 1; - b = ((m_x_b)>>(addr)) & 1; - - m_palette->set_pen_color(addr|8, pal1bit(r), pal1bit(g), pal1bit(b)); - } -} - -WRITE8_MEMBER( x1_state::x1turboz_4096_palette_w ) -{ - UINT32 pal_entry; - UINT8 r,g,b; - - pal_entry = ((offset & 0xff) << 4) | ((data & 0xf0) >> 4); - - m_pal_4096[pal_entry+((offset & 0x300)<<4)] = data & 0xf; - - r = m_pal_4096[pal_entry+(1<<12)]; - g = m_pal_4096[pal_entry+(2<<12)]; - b = m_pal_4096[pal_entry+(0<<12)]; - - m_palette->set_pen_color(pal_entry+16, pal3bit(r), pal3bit(g), pal3bit(b)); -} - -/* Note: docs claims that reading the palette ports makes the value to change somehow in X1 mode ... - In 4096 color mode, it's used for reading the value back. */ -WRITE8_MEMBER( x1_state::x1_pal_r_w ) -{ - if(m_turbo_reg.pal & 0x80) //AEN bit, Turbo Z - { - if(m_turbo_reg.gfx_pal & 0x80) //APEN bit - x1turboz_4096_palette_w(space,offset & 0x3ff,data); - } - else //compatible mode - { - m_x_r = data; - set_current_palette(); - //if(m_old_vpos != machine().first_screen()->vpos()) - //{ - // machine().first_screen()->update_partial(machine().first_screen()->vpos()); - // m_old_vpos = machine().first_screen()->vpos(); - //} - } -} - -WRITE8_MEMBER( x1_state::x1_pal_g_w ) -{ - if(m_turbo_reg.pal & 0x80) //AEN bit, Turbo Z - { - if(m_turbo_reg.gfx_pal & 0x80) //APEN bit - x1turboz_4096_palette_w(space,offset & 0x3ff,data); - } - else - { - m_x_g = data; - set_current_palette(); - //if(m_old_vpos != machine().first_screen()->vpos()) - //{ - machine().first_screen()->update_partial(machine().first_screen()->vpos()); - // m_old_vpos = machine().first_screen()->vpos(); - //} - } -} - -WRITE8_MEMBER( x1_state::x1_pal_b_w ) -{ - if(m_turbo_reg.pal & 0x80) //AEN bit, Turbo Z - { - if(m_turbo_reg.gfx_pal & 0x80) //APEN bit - x1turboz_4096_palette_w(space,offset & 0x3ff,data); - } - else - { - m_x_b = data; - set_current_palette(); - //if(m_old_vpos != machine().first_screen()->vpos()) - //{ - // machine().first_screen()->update_partial(machine().first_screen()->vpos()); - // m_old_vpos = machine().first_screen()->vpos(); - //} - } -} - -WRITE8_MEMBER( x1_state::x1_ex_gfxram_w ) -{ - UINT8 ex_mask; - - if ( offset <= 0x3fff) { ex_mask = 7; } - else if(offset >= 0x4000 && offset <= 0x7fff) { ex_mask = 6; } - else if(offset >= 0x8000 && offset <= 0xbfff) { ex_mask = 5; } - else { ex_mask = 3; } - - if(ex_mask & 1) { m_gfx_bitmap_ram[(offset & 0x3fff)+0x0000+(m_scrn_reg.gfx_bank*0xc000)] = data; } - if(ex_mask & 2) { m_gfx_bitmap_ram[(offset & 0x3fff)+0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; } - if(ex_mask & 4) { m_gfx_bitmap_ram[(offset & 0x3fff)+0x8000+(m_scrn_reg.gfx_bank*0xc000)] = data; } -} - -/* - SCRN flags - - d0(01) = 0:low resolution (15KHz) 1: high resolution (24KHz) - d1(02) = 0:1 raster / pixel 1:2 raster / pixel - d2(04) = 0:8 rasters / CHR 1:16 rasters / CHR - d3(08) = 0:bank 0 0:bank 1 <- display - d4(10) = 0:bank 0 0:bank 1 <- access - d5(20) = 0:compatibility 1:high speed <- define PCG mode - d6(40) = 0:8-raster graphics 1:16-raster graphics - d7(80) = 0:don't display 1:display <- underline (when 1, graphics are not displayed) -*/ -WRITE8_MEMBER( x1_state::x1_scrn_w ) -{ - m_scrn_reg.pcg_mode = BIT(data, 5); - m_scrn_reg.gfx_bank = BIT(data, 4); - m_scrn_reg.disp_bank = BIT(data, 3); - m_scrn_reg.ank_sel = BIT(data, 2); - m_scrn_reg.v400_mode = ((data & 0x03) == 3) ? 1 : 0; - - if(data & 0x80) - printf("SCRN = %02x\n",data & 0x80); - if((data & 0x03) == 1) - printf("SCRN sets true 400 lines mode\n"); -} - -WRITE8_MEMBER( x1_state::x1_pri_w ) -{ - m_scrn_reg.pri = data; -// printf("PRI = %02x\n",data); -} - -WRITE8_MEMBER( x1_state::x1_6845_w ) -{ - if(offset == 0) - { - m_crtc_index = data & 31; - machine().device("crtc")->address_w(space, offset, data); - } - else - { - m_crtc_vreg[m_crtc_index] = data; - machine().device("crtc")->register_w(space, offset, data); - } -} - -READ8_MEMBER( x1_state::x1turboz_blackclip_r ) -{ - /* TODO: this returns only on x1turboz */ - return m_scrn_reg.blackclip; -} - -WRITE8_MEMBER( x1_state::x1turbo_blackclip_w ) -{ - /* - -x-- ---- replace blanking duration with black - --x- ---- replace bitmap palette 1 with black - ---x ---- replace bitmap palette 0 with black - ---- x--- enable text blackclip - ---- -xxx palette color number for text black - */ - m_scrn_reg.blackclip = data; - if(data & 0x40) - printf("Blackclip data access %02x\n",data); -} - -READ8_MEMBER( x1_state::x1turbo_pal_r ) -{ - return m_turbo_reg.pal; -} - -READ8_MEMBER( x1_state::x1turbo_txpal_r ) -{ - return m_turbo_reg.txt_pal[offset]; -} - -READ8_MEMBER( x1_state::x1turbo_txdisp_r ) -{ - return m_turbo_reg.txt_disp; -} - -READ8_MEMBER( x1_state::x1turbo_gfxpal_r ) -{ - return m_turbo_reg.gfx_pal; -} - -WRITE8_MEMBER( x1_state::x1turbo_pal_w ) -{ - printf("TURBO PAL %02x\n",data); - m_turbo_reg.pal = data; -} - -WRITE8_MEMBER( x1_state::x1turbo_txpal_w ) -{ - int r,g,b; - - printf("TURBO TEXT PAL %02x %02x\n",data,offset); - m_turbo_reg.txt_pal[offset] = data; - - if(m_turbo_reg.pal & 0x80) - { - r = (data & 0x0c) >> 2; - g = (data & 0x30) >> 4; - b = (data & 0x03) >> 0; - - m_palette->set_pen_color(offset, pal2bit(r), pal2bit(g), pal2bit(b)); - } -} - -WRITE8_MEMBER( x1_state::x1turbo_txdisp_w ) -{ - printf("TURBO TEXT DISPLAY %02x\n",data); - m_turbo_reg.txt_disp = data; -} - -WRITE8_MEMBER( x1_state::x1turbo_gfxpal_w ) -{ - printf("TURBO GFX PAL %02x\n",data); - m_turbo_reg.gfx_pal = data; -} - - -/* - * FIXME: bit-wise this doesn't make any sense, I guess that it uses the lv 2 kanji roms - * Test cases for this port so far are Hyper Olympics '84 disk version and Might & Magic. - */ -UINT16 x1_state::jis_convert(int kanji_addr) -{ - if(kanji_addr >= 0x0e00 && kanji_addr <= 0x0e9f) { kanji_addr -= 0x0e00; kanji_addr &= 0x0ff; return ((0x0e0) + (kanji_addr >> 3)) << 4; } // numbers - if(kanji_addr >= 0x0f00 && kanji_addr <= 0x109f) { kanji_addr -= 0x0f00; kanji_addr &= 0x1ff; return ((0x4c0) + (kanji_addr >> 3)) << 4; } // lower case chars - if(kanji_addr >= 0x1100 && kanji_addr <= 0x129f) { kanji_addr -= 0x1100; kanji_addr &= 0x1ff; return ((0x2c0) + (kanji_addr >> 3)) << 4; } // upper case chars - if(kanji_addr >= 0x0100 && kanji_addr <= 0x01ff) { kanji_addr -= 0x0100; kanji_addr &= 0x0ff; return ((0x040) + (kanji_addr >> 3)) << 4; } // grammar symbols - if(kanji_addr >= 0x0500 && kanji_addr <= 0x06ff) { kanji_addr -= 0x0500; kanji_addr &= 0x1ff; return ((0x240) + (kanji_addr >> 3)) << 4; } // math symbols - if(kanji_addr >= 0x0300 && kanji_addr <= 0x04ff) { kanji_addr -= 0x0300; kanji_addr &= 0x1ff; return ((0x440) + (kanji_addr >> 3)) << 4; } // parentesis - - if(kanji_addr != 0x0720 && kanji_addr != 0x0730) - printf("%08x\n",kanji_addr); - - return 0x0000; -} - -READ8_MEMBER( x1_state::x1_kanji_r ) -{ - UINT8 res; - - res = m_kanji_rom[jis_convert(m_kanji_addr & 0xfff0)+(offset*0x10)+(m_kanji_addr & 0xf)]; - - if(offset == 1) - m_kanji_addr_latch++; - - return res; -} - -WRITE8_MEMBER( x1_state::x1_kanji_w ) -{ -// if(offset < 2) - - switch(offset) - { - case 0: m_kanji_addr_latch = (data & 0xff)|(m_kanji_addr_latch&0xff00); break; - case 1: m_kanji_addr_latch = (data<<8)|(m_kanji_addr_latch&0x00ff); - //if(m_kanji_addr_latch != 0x720 && m_kanji_addr_latch != 0x730) - // printf("%08x\n",m_kanji_addr_latch); - break; - case 2: - { - /* 0 -> selects Expanded EEPROM */ - /* 1 -> selects Kanji ROM */ - /* 0 -> 1 -> latches Kanji ROM data */ - - if(((m_kanji_eksel & 1) == 0) && ((data & 1) == 1)) - { - m_kanji_addr = (m_kanji_addr_latch); - //m_kanji_addr &= 0x3fff; //<- temp kludge until the rom is redumped. - //printf("%08x\n",m_kanji_addr); - //m_kanji_addr+= m_kanji_count; - } - m_kanji_eksel = data & 1; - } - break; - } -} - -READ8_MEMBER( x1_state::x1_emm_r ) -{ - UINT8 res; - - if(offset & ~3) - { - printf("Warning: read EMM BASIC area [%02x]\n",offset & 0xff); - return 0xff; - } - - if(offset != 3) - printf("Warning: read EMM address [%02x]\n",offset); - - res = 0xff; - - if(offset == 3) - { - res = m_emm_ram[m_emm_addr]; - m_emm_addr++; - } - - return res; -} - -WRITE8_MEMBER( x1_state::x1_emm_w ) -{ - if(offset & ~3) - { - printf("Warning: write EMM BASIC area [%02x] %02x\n",offset & 0xff,data); - return; - } - - switch(offset) - { - case 0: m_emm_addr = (m_emm_addr & 0xffff00) | (data & 0xff); break; - case 1: m_emm_addr = (m_emm_addr & 0xff00ff) | (data << 8); break; - case 2: m_emm_addr = (m_emm_addr & 0x00ffff) | (data << 16); break; //TODO: this has a max size limit, check exactly how much - case 3: - m_emm_ram[m_emm_addr] = data; - m_emm_addr++; - break; - } -} - -/* - CZ-141SF, CZ-127MF, X1turboZII, X1turboZ3 boards -*/ -READ8_MEMBER( x1_state::x1turbo_bank_r ) -{ -// printf("BANK access read\n"); - return m_ex_bank & 0x3f; -} - -WRITE8_MEMBER( x1_state::x1turbo_bank_w ) -{ - //UINT8 *RAM = memregion("x1_cpu")->base(); - /* - --x- ---- BML5: latch bit (doesn't have any real function) - ---x ---- BMCS: select bank RAM, active low - ---- xxxx BMNO: Bank memory ID - */ - - m_ex_bank = data & 0x3f; -// printf("BANK access write %02x\n",data); -} - -/* TODO: waitstate penalties */ -READ8_MEMBER( x1_state::x1_mem_r ) -{ - if((offset & 0x8000) == 0 && (m_ram_bank == 0)) - { - return m_ipl_rom[offset]; //ROM - } - - return m_work_ram[offset]; //RAM -} - -WRITE8_MEMBER( x1_state::x1_mem_w ) -{ - m_work_ram[offset] = data; //RAM -} - -READ8_MEMBER( x1_state::x1turbo_mem_r ) -{ - if((m_ex_bank & 0x10) == 0) - return m_work_ram[offset+((m_ex_bank & 0xf)*0x10000)]; - - return x1_mem_r(space,offset); -} - -WRITE8_MEMBER( x1_state::x1turbo_mem_w ) -{ - if((m_ex_bank & 0x10) == 0) - m_work_ram[offset+((m_ex_bank & 0xf)*0x10000)] = data; //RAM - else - x1_mem_w(space,offset,data); -} - -/************************************* - * - * Memory maps - * - *************************************/ - -READ8_MEMBER( x1_state::x1_io_r ) -{ - m_io_bank_mode = 0; //any read disables the extended mode. - - if(offset == 0x0e03) { return x1_rom_r(space, 0); } - // TODO: user could install ym2151 on plain X1 too - //0x700, 0x701 - //if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(m_ctc, offset-0x0704); } - else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } - else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } - else if(offset >= 0x1900 && offset <= 0x19ff) { return x1_sub_io_r(space, 0); } - else if(offset >= 0x1a00 && offset <= 0x1aff) { return machine().device("ppi8255_0")->read(space, (offset-0x1a00) & 3); } - else if(offset >= 0x1b00 && offset <= 0x1bff) { return machine().device("ay")->data_r(space, 0); } -// else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(machine().device("dma"), 0); } -// else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(machine().device("sio"), (offset-0x1f90) & 1); } -// else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(machine().device("sio"), (offset-0x1f92) & 1); } - else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return m_ctc->read(space,offset-0x1fa0); } - else if(offset >= 0x1fa8 && offset <= 0x1fab) { return m_ctc->read(space,offset-0x1fa8); } -// else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } -// else if(offset == 0x1fe0) { return x1turboz_blackclip_r(space,0); } - else if(offset >= 0x2000 && offset <= 0x2fff) { return m_avram[offset & 0x7ff]; } - else if(offset >= 0x3000 && offset <= 0x3fff) { return m_tvram[offset & 0x7ff]; } // Ys checks if it's a x1/x1turbo machine by checking if this area is a mirror - else if(offset >= 0x4000 && offset <= 0xffff) { return m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)]; } - else - { - //logerror("(PC=%06x) Read i/o address %04x\n",space.device().safe_pc(),offset); - } - return 0xff; -} - -WRITE8_MEMBER( x1_state::x1_io_w ) -{ - if(m_io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } - // TODO: user could install ym2151 on plain X1 too - //0x700, 0x701 -// else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(m_ctc, offset-0x0704,data); } -// else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(machine(), 0, data); } - else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } -// else if(offset >= 0x0e80 && offset <= 0x0e82) { x1_kanji_w(machine(), offset-0xe80,data); } - else if(offset >= 0x0ff8 && offset <= 0x0fff) { x1_fdc_w(space, offset-0xff8,data); } - else if(offset >= 0x1000 && offset <= 0x10ff) { x1_pal_b_w(space, 0,data); } - else if(offset >= 0x1100 && offset <= 0x11ff) { x1_pal_r_w(space, 0,data); } - else if(offset >= 0x1200 && offset <= 0x12ff) { x1_pal_g_w(space, 0,data); } - else if(offset >= 0x1300 && offset <= 0x13ff) { x1_pri_w(space, 0,data); } - else if(offset >= 0x1400 && offset <= 0x17ff) { x1_pcg_w(space, offset-0x1400,data); } - else if(offset == 0x1800 || offset == 0x1801) { x1_6845_w(space, offset-0x1800, data); } - else if(offset >= 0x1900 && offset <= 0x19ff) { x1_sub_io_w(space, 0,data); } - else if(offset >= 0x1a00 && offset <= 0x1aff) { machine().device("ppi8255_0")->write(space, (offset-0x1a00) & 3,data); } - else if(offset >= 0x1b00 && offset <= 0x1bff) { machine().device("ay")->data_w(space, 0,data); } - else if(offset >= 0x1c00 && offset <= 0x1cff) { machine().device("ay")->address_w(space, 0,data); } - else if(offset >= 0x1d00 && offset <= 0x1dff) { x1_rom_bank_1_w(space,0,data); } - else if(offset >= 0x1e00 && offset <= 0x1eff) { x1_rom_bank_0_w(space,0,data); } -// else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(machine().device("dma"), 0,data); } -// else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(machine().device("sio"), (offset-0x1f90) & 1,data); } -// else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(machine().device("sio"), (offset-0x1f92) & 1,data); } - else if(offset >= 0x1fa0 && offset <= 0x1fa3) { m_ctc->write(space,offset-0x1fa0,data); } - else if(offset >= 0x1fa8 && offset <= 0x1fab) { m_ctc->write(space,offset-0x1fa8,data); } -// else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } -// else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } -// else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } -// else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } -// else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } -// else if(offset == 0x1fe0) { x1turbo_blackclip_w(space,0,data); } - else if(offset >= 0x2000 && offset <= 0x2fff) { m_avram[offset & 0x7ff] = data; } - else if(offset >= 0x3000 && offset <= 0x3fff) { m_tvram[offset & 0x7ff] = data; } - else if(offset >= 0x4000 && offset <= 0xffff) { m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; } - else - { - //logerror("(PC=%06x) Write %02x at i/o address %04x\n",space.device().safe_pc(),data,offset); - } -} - -/* TODO: I should actually simplify this, by just overwriting X1 Turbo specifics here, and call plain X1 functions otherwise */ -READ8_MEMBER( x1_state::x1turbo_io_r ) -{ - m_io_bank_mode = 0; //any read disables the extended mode. - - // a * at the end states devices used on plain X1 too - if(offset == 0x0700) { return (machine().device("ym")->read(space, offset-0x0700) & 0x7f) | (ioport("SOUND_SW")->read() & 0x80); } - else if(offset == 0x0701) { return machine().device("ym")->read(space, offset-0x0700); } - //0x704 is FM sound detection port on X1 turboZ - else if(offset >= 0x0704 && offset <= 0x0707) { return m_ctc->read(space,offset-0x0704); } - else if(offset == 0x0801) { printf("Color image board read\n"); return 0xff; } // * - else if(offset == 0x0803) { printf("Color image board 2 read\n"); return 0xff; } // * - else if(offset >= 0x0a00 && offset <= 0x0a07) { printf("Stereoscopic board read %04x\n",offset); return 0xff; } // * - else if(offset == 0x0b00) { return x1turbo_bank_r(space,0); } - else if(offset >= 0x0c00 && offset <= 0x0cff) { printf("RS-232C read %04x\n",offset); return 0; } // * - else if(offset >= 0x0d00 && offset <= 0x0dff) { return x1_emm_r(space,offset & 0xff); } // * - else if(offset == 0x0e03) { return x1_rom_r(space, 0); } - else if(offset >= 0x0e80 && offset <= 0x0e81) { return x1_kanji_r(space, offset-0xe80); } - else if(offset >= 0x0fd0 && offset <= 0x0fd3) { /* printf("SASI HDD read %04x\n",offset); */ return 0xff; } // * - else if(offset >= 0x0fe8 && offset <= 0x0fef) { printf("8-inch FD read %04x\n",offset); return 0xff; } // * - else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } - else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } - else if(offset >= 0x1900 && offset <= 0x19ff) { return x1_sub_io_r(space, 0); } - else if(offset >= 0x1a00 && offset <= 0x1aff) { return machine().device("ppi8255_0")->read(space, (offset-0x1a00) & 3); } - else if(offset >= 0x1b00 && offset <= 0x1bff) { return machine().device("ay")->data_r(space, 0); } - else if(offset >= 0x1f80 && offset <= 0x1f8f) { return m_dma->read(space, 0); } - else if(offset >= 0x1f90 && offset <= 0x1f93) { return machine().device("sio")->ba_cd_r(space, (offset-0x1f90) & 3); } - else if(offset >= 0x1f98 && offset <= 0x1f9f) { printf("Extended SIO/CTC read %04x\n",offset); return 0xff; } - else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return m_ctc->read(space,offset-0x1fa0); } - else if(offset >= 0x1fa8 && offset <= 0x1fab) { return m_ctc->read(space,offset-0x1fa8); } - else if(offset == 0x1fb0) { return x1turbo_pal_r(space,0); } // Z only! - else if(offset >= 0x1fb8 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb8); } //Z only! - else if(offset == 0x1fc0) { return x1turbo_txdisp_r(space,0); } // Z only! - else if(offset == 0x1fc5) { return x1turbo_gfxpal_r(space,0); } // Z only! -// else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } //Z only - else if(offset == 0x1fe0) { return x1turboz_blackclip_r(space,0); } - else if(offset == 0x1ff0) { return ioport("X1TURBO_DSW")->read(); } - else if(offset >= 0x2000 && offset <= 0x2fff) { return m_avram[offset & 0x7ff]; } - else if(offset >= 0x3000 && offset <= 0x37ff) { return m_tvram[offset & 0x7ff]; } - else if(offset >= 0x3800 && offset <= 0x3fff) { return m_kvram[offset & 0x7ff]; } - else if(offset >= 0x4000 && offset <= 0xffff) { return m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)]; } - else - { - //logerror("(PC=%06x) Read i/o address %04x\n",space.device().safe_pc(),offset); - } - return 0xff; -} - -WRITE8_MEMBER( x1_state::x1turbo_io_w ) -{ - // a * at the end states devices used on plain X1 too - if(m_io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } - else if(offset == 0x0700 || offset == 0x0701) { machine().device("ym")->write(space, offset-0x0700,data); } - //0x704 is FM sound detection port on X1 turboZ - else if(offset >= 0x0704 && offset <= 0x0707) { m_ctc->write(space,offset-0x0704,data); } - else if(offset == 0x0800) { printf("Color image board write %02x\n",data); } // * - else if(offset == 0x0802) { printf("Color image board 2 write %02x\n",data); } // * - else if(offset >= 0x0a00 && offset <= 0x0a07) { printf("Stereoscopic board write %04x %02x\n",offset,data); } // * - else if(offset == 0x0b00) { x1turbo_bank_w(space,0,data); } - else if(offset >= 0x0c00 && offset <= 0x0cff) { printf("RS-232C write %04x %02x\n",offset,data); } // * - else if(offset >= 0x0d00 && offset <= 0x0dff) { x1_emm_w(space,offset & 0xff,data); } // * - else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } - else if(offset >= 0x0e80 && offset <= 0x0e83) { x1_kanji_w(space, offset-0xe80,data); } - else if(offset >= 0x0fd0 && offset <= 0x0fd3) { printf("SASI HDD write %04x %02x\n",offset,data); } // * - else if(offset >= 0x0fe8 && offset <= 0x0fef) { printf("8-inch FD write %04x %02x\n",offset,data); } // * - else if(offset >= 0x0ff8 && offset <= 0x0fff) { x1_fdc_w(space, offset-0xff8,data); } - else if(offset >= 0x1000 && offset <= 0x10ff) { x1_pal_b_w(space, offset & 0x3ff,data); } - else if(offset >= 0x1100 && offset <= 0x11ff) { x1_pal_r_w(space, offset & 0x3ff,data); } - else if(offset >= 0x1200 && offset <= 0x12ff) { x1_pal_g_w(space, offset & 0x3ff,data); } - else if(offset >= 0x1300 && offset <= 0x13ff) { x1_pri_w(space, 0,data); } - else if(offset >= 0x1400 && offset <= 0x17ff) { x1_pcg_w(space, offset-0x1400,data); } - else if(offset == 0x1800 || offset == 0x1801) { x1_6845_w(space, offset-0x1800, data); } - else if(offset >= 0x1900 && offset <= 0x19ff) { x1_sub_io_w(space, 0,data); } - else if(offset >= 0x1a00 && offset <= 0x1aff) { machine().device("ppi8255_0")->write(space, (offset-0x1a00) & 3,data); } - else if(offset >= 0x1b00 && offset <= 0x1bff) { machine().device("ay")->data_w(space, 0,data); } - else if(offset >= 0x1c00 && offset <= 0x1cff) { machine().device("ay")->address_w(space, 0,data); } - else if(offset >= 0x1d00 && offset <= 0x1dff) { x1_rom_bank_1_w(space,0,data); } - else if(offset >= 0x1e00 && offset <= 0x1eff) { x1_rom_bank_0_w(space,0,data); } - else if(offset >= 0x1f80 && offset <= 0x1f8f) { m_dma->write(space, 0,data); } - else if(offset >= 0x1f90 && offset <= 0x1f93) { machine().device("sio")->ba_cd_w(space, (offset-0x1f90) & 3,data); } - else if(offset >= 0x1f98 && offset <= 0x1f9f) { printf("Extended SIO/CTC write %04x %02x\n",offset,data); } - else if(offset >= 0x1fa0 && offset <= 0x1fa3) { m_ctc->write(space,offset-0x1fa0,data); } - else if(offset >= 0x1fa8 && offset <= 0x1fab) { m_ctc->write(space,offset-0x1fa8,data); } - else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } // Z only! - else if(offset >= 0x1fb8 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb8,data); } //Z only! - else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } //Z only! - else if(offset == 0x1fc1) { printf("Z image capturing access %02x\n",data); } // Z only! - else if(offset == 0x1fc2) { printf("Z mosaic effect access %02x\n",data); } // Z only! - else if(offset == 0x1fc3) { printf("Z Chroma key access %02x\n",data); } // Z only! - else if(offset == 0x1fc4) { printf("Z Extra scroll config access %02x\n",data); } // Z only! - else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } // Z only! - else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } - else if(offset == 0x1fe0) { x1turbo_blackclip_w(space,0,data); } - else if(offset >= 0x2000 && offset <= 0x2fff) { m_avram[offset & 0x7ff] = data; } - else if(offset >= 0x3000 && offset <= 0x37ff) { m_tvram[offset & 0x7ff] = data; } - else if(offset >= 0x3800 && offset <= 0x3fff) { m_kvram[offset & 0x7ff] = data; } - else if(offset >= 0x4000 && offset <= 0xffff) { m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; } - else - { - //logerror("(PC=%06x) Write %02x at i/o address %04x\n",space.device().safe_pc(),data,offset); - } -} - -static ADDRESS_MAP_START( x1_mem, AS_PROGRAM, 8, x1_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_mem_r,x1_mem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( x1turbo_mem, AS_PROGRAM, 8, x1_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1turbo_mem_r,x1turbo_mem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( x1_io, AS_IO, 8, x1_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_io_r, x1_io_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( x1turbo_io, AS_IO, 8, x1_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1turbo_io_r, x1turbo_io_w) -ADDRESS_MAP_END - -/************************************* - * - * PPI8255 - * - *************************************/ - -READ8_MEMBER( x1_state::x1_porta_r ) -{ - printf("PPI Port A read\n"); - return 0xff; -} - -/* this port is system related */ -READ8_MEMBER( x1_state::x1_portb_r ) -{ - //printf("PPI Port B read\n"); - /* - x--- ---- "v disp" - -x-- ---- "sub cpu ibf" - --x- ---- "sub cpu obf" - ---x ---- ROM/RAM flag (0=ROM, 1=RAM) - ---- x--- "busy" <- allow printer data output - ---- -x-- "v sync" - ---- --x- "cmt read" - ---- ---x "cmt test" (active low) <- actually this is "Sub CPU detected BREAK" - */ - UINT8 res = 0; - int vblank_line = m_crtc_vreg[6] * (m_crtc_vreg[9]+1); - int vsync_line = m_crtc_vreg[7] * (m_crtc_vreg[9]+1); - m_vdisp = (machine().first_screen()->vpos() < vblank_line) ? 0x80 : 0x00; - m_vsync = (machine().first_screen()->vpos() < vsync_line) ? 0x00 : 0x04; - -// popmessage("%d",vsync_line); -// popmessage("%d",vblank_line); - - res = m_ram_bank | m_sub_obf | m_vsync | m_vdisp; - - if(m_cassette->input() > 0.03) - res |= 0x02; - -// if(cassette_get_state(m_cassette) & CASSETTE_MOTOR_DISABLED) -// res &= ~0x02; // is zero if not playing - - // CMT test bit is set low when the CMT Stop command is issued, and becomes - // high again when this bit is read. - res |= 0x01; - if(m_cmt_test != 0) - { - m_cmt_test = 0; - res &= ~0x01; - } - - return res; -} - -/* I/O system port */ -READ8_MEMBER( x1_state::x1_portc_r ) -{ - //printf("PPI Port C read\n"); - /* - x--- ---- Printer port output - -x-- ---- 320 mode (r/w), divider for the pixel clock - --x- ---- i/o mode (r/w) - ---x ---- smooth scroll enabled (?) - ---- ---x cassette output data - */ - return (m_io_sys & 0x9f) | m_hres_320 | ~m_io_switch; -} - -WRITE8_MEMBER( x1_state::x1_porta_w ) -{ - //printf("PPI Port A write %02x\n",data); -} - -WRITE8_MEMBER( x1_state::x1_portb_w ) -{ - //printf("PPI Port B write %02x\n",data); -} - -WRITE8_MEMBER( x1_state::x1_portc_w ) -{ - m_hres_320 = data & 0x40; - - /* set up the pixel clock according to the above divider */ - m_crtc->set_clock(VDP_CLOCK/((m_hres_320) ? 48 : 24)); - - if(!BIT(data, 5) && BIT(m_io_switch, 5)) - m_io_bank_mode = 1; - - m_io_switch = data & 0x20; - m_io_sys = data & 0xff; - - m_cassette->output(BIT(data, 0) ? +1.0 : -1.0); -} - -READ8_MEMBER(x1_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(x1_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.write_byte(offset, data); -} - -READ8_MEMBER(x1_state::io_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(x1_state::io_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.write_byte(offset, data); -} - -/************************************* - * - * Inputs - * - *************************************/ - -INPUT_CHANGED_MEMBER(x1_state::ipl_reset) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); - - m_ram_bank = 0x00; - if(m_is_turbo) { m_ex_bank = 0x10; } - //anything else? -} - -/* Apparently most games doesn't support this (not even the Konami ones!), one that does is...177 :o */ -INPUT_CHANGED_MEMBER(x1_state::nmi_reset) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_PORTS_START( x1 ) - PORT_START("FP_SYS") //front panel buttons, hard-wired with the soft reset/NMI lines - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, x1_state, ipl_reset,0) PORT_NAME("IPL reset") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, x1_state, nmi_reset,0) PORT_NAME("NMI reset") - - PORT_START("SOUND_SW") //FIXME: this is X1Turbo specific - PORT_DIPNAME( 0x80, 0x80, "OPM Sound Setting?" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("IOSYS") //TODO: implement front-panel DIP-SW here - PORT_DIPNAME( 0x01, 0x01, "IOSYS" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Sound Setting?" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("key1") //0x00-0x1f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-8") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-8") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - - PORT_START("key2") //0x20-0x3f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2b + - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2e . - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2f / - - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3c < - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? - - PORT_START("key3") //0x40-0x5f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") - - PORT_START("f_keys") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - - PORT_START("tenkey") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) - // TODO: add other numpad keys - - PORT_START("key_modifiers") - PORT_BIT(0x00000001,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00000002,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x00000004,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x00000008,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x00000010,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) - -#if 0 - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") - - PORT_START("key3") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey ,") - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("EL") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DUP") PORT_CODE(KEYCODE_END) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) - -#endif -INPUT_PORTS_END - -INPUT_PORTS_START( x1turbo ) - PORT_INCLUDE( x1 ) - - PORT_START("X1TURBO_DSW") - PORT_DIPNAME( 0x01, 0x01, "Interlace mode" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x0e, 0x00, "Default Auto-boot Device" ) // this selects what kind of device is loaded at start-up - PORT_DIPSETTING( 0x00, "5/3-inch 2D" ) - PORT_DIPSETTING( 0x02, "5/3-inch 2DD" ) - PORT_DIPSETTING( 0x04, "5/3-inch 2HD" ) - PORT_DIPSETTING( 0x06, "5/3-inch 2DD (IBM)" ) - PORT_DIPSETTING( 0x08, "8-inch 2D256" ) - PORT_DIPSETTING( 0x0a, "8-inch 2D256 (IBM)" ) - PORT_DIPSETTING( 0x0c, "8-inch 1S128 (IBM)" ) - PORT_DIPSETTING( 0x0e, "SASI HDD" ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) //this is a port conditional of some sort ... - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -/************************************* - * - * GFX decoding - * - *************************************/ - -static const gfx_layout x1_chars_8x8 = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static const gfx_layout x1_chars_8x16 = -{ - 8,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, - 8*16 -}; - -static const gfx_layout x1_chars_16x16 = -{ - 8,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 -}; - -/* decoded for debugging purpose, this will be nuked in the end... */ -static GFXDECODE_START( x1 ) - GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8, 0, 1 ) - GFXDECODE_ENTRY( "font", 0x00000, x1_chars_8x16, 0, 1 ) - GFXDECODE_ENTRY( "kanji", 0x00000, x1_chars_16x16, 0, 1 ) -// GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8, 0, 1 ) -GFXDECODE_END - -static const z80_daisy_config x1_daisy[] = -{ - { "x1kb" }, - { "ctc" }, - { NULL } -}; - -static const z80_daisy_config x1turbo_daisy[] = -{ - { "x1kb" }, - { "ctc" }, - { "dma" }, - { "sio" }, - { NULL } -}; - -/************************************* - * - * Machine Functions - * - *************************************/ - -#ifdef UNUSED_FUNCTION -IRQ_CALLBACK_MEMBER(x1_state::x1_irq_callback) -{ - if(m_ctc_irq_flag != 0) - { - m_ctc_irq_flag = 0; - if(m_key_irq_flag == 0) // if no other devices are pulling the IRQ line high - device.execute().set_input_line(0, CLEAR_LINE); - return m_irq_vector; - } - if(m_key_irq_flag != 0) - { - m_key_irq_flag = 0; - if(m_ctc_irq_flag == 0) // if no other devices are pulling the IRQ line high - device.execute().set_input_line(0, CLEAR_LINE); - return m_key_irq_vector; - } - return m_irq_vector; -} -#endif - -TIMER_DEVICE_CALLBACK_MEMBER(x1_state::x1_keyboard_callback) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT32 key1 = ioport("key1")->read(); - UINT32 key2 = ioport("key2")->read(); - UINT32 key3 = ioport("key3")->read(); - UINT32 key4 = ioport("tenkey")->read(); - UINT32 f_key = ioport("f_keys")->read(); - - if(m_key_irq_vector) - { - //if(key1 == 0 && key2 == 0 && key3 == 0 && key4 == 0 && f_key == 0) - // return; - - if((key1 != m_old_key1) || (key2 != m_old_key2) || (key3 != m_old_key3) || (key4 != m_old_key4) || (f_key != m_old_fkey)) - { - // generate keyboard IRQ - x1_sub_io_w(space,0,0xe6); - m_irq_vector = m_key_irq_vector; - m_key_irq_flag = 1; - m_maincpu->set_input_line(0,ASSERT_LINE); - m_old_key1 = key1; - m_old_key2 = key2; - m_old_key3 = key3; - m_old_key4 = key4; - m_old_fkey = f_key; - } - } -} - -TIMER_CALLBACK_MEMBER(x1_state::x1_rtc_increment) -{ - static const UINT8 dpm[12] = { 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31 }; - - m_rtc.sec++; - - if((m_rtc.sec & 0x0f) >= 0x0a) { m_rtc.sec+=0x10; m_rtc.sec&=0xf0; } - if((m_rtc.sec & 0xf0) >= 0x60) { m_rtc.min++; m_rtc.sec = 0; } - if((m_rtc.min & 0x0f) >= 0x0a) { m_rtc.min+=0x10; m_rtc.min&=0xf0; } - if((m_rtc.min & 0xf0) >= 0x60) { m_rtc.hour++; m_rtc.min = 0; } - if((m_rtc.hour & 0x0f) >= 0x0a) { m_rtc.hour+=0x10; m_rtc.hour&=0xf0; } - if((m_rtc.hour & 0xff) >= 0x24) { m_rtc.day++; m_rtc.wday++; m_rtc.hour = 0; } - if((m_rtc.wday & 0x0f) >= 0x07) { m_rtc.wday = 0; } - if((m_rtc.day & 0x0f) >= 0x0a) { m_rtc.day+=0x10; m_rtc.day&=0xf0; } - /* FIXME: very crude leap year support (i.e. it treats the RTC to be with a 2000-2099 timeline), dunno how the real x1 supports this, - maybe it just have a 1980-1999 timeline since year 0x00 shows as a XX on display */ - if(((m_rtc.year % 4) == 0) && m_rtc.month == 2) - { - if((m_rtc.day & 0xff) >= dpm[m_rtc.month-1]+1+1) - { m_rtc.month++; m_rtc.day = 0x01; } - } - else if((m_rtc.day & 0xff) >= dpm[m_rtc.month-1]+1){ m_rtc.month++; m_rtc.day = 0x01; } - if(m_rtc.month > 12) { m_rtc.year++; m_rtc.month = 0x01; } - if((m_rtc.year & 0x0f) >= 0x0a) { m_rtc.year+=0x10; m_rtc.year&=0xf0; } - if((m_rtc.year & 0xf0) >= 0xa0) { m_rtc.year = 0; } //roll over -} - -MACHINE_RESET_MEMBER(x1_state,x1) -{ - //UINT8 *ROM = memregion("x1_cpu")->base(); - int i; - - memset(m_gfx_bitmap_ram,0x00,0xc000*2); - - for(i=0;i<0x1800;i++) - { - m_pcg_ram[i] = 0; - m_gfxdecode->gfx(3)->mark_dirty(i >> 3); - } - - m_is_turbo = 0; - - m_io_bank_mode = 0; - - //m_x1_cpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(x1_state::x1_irq_callback),this)); - - m_cmt_current_cmd = 0; - m_cmt_test = 0; - m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - - m_key_irq_flag = m_ctc_irq_flag = 0; - m_sub_cmd = 0; - m_key_irq_vector = 0; - m_sub_cmd_length = 0; - m_sub_val[0] = 0; - m_sub_val[1] = 0; - m_sub_val[2] = 0; - m_sub_val[3] = 0; - m_sub_val[4] = 0; - m_sub_obf = (m_sub_cmd_length) ? 0x00 : 0x20; - - m_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1)); - - /* Reinitialize palette here if there's a soft reset for the Turbo PAL stuff*/ - for(i=0;i<0x10;i++) - m_palette->set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); - - m_ram_bank = 0; -// m_old_vpos = -1; -} - -MACHINE_RESET_MEMBER(x1_state,x1turbo) -{ - MACHINE_RESET_CALL_MEMBER( x1 ); - m_is_turbo = 1; - m_ex_bank = 0x10; - - m_scrn_reg.blackclip = 0; -} - -static const gfx_layout x1_pcg_8x8 = -{ - 8,8, - 0x100, - 3, - { 0x1000*8,0x800*8, 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -MACHINE_START_MEMBER(x1_state,x1) -{ - /* set up RTC */ - { - system_time systime; - machine().base_datetime(systime); - - m_rtc.day = ((systime.local_time.mday / 10)<<4) | ((systime.local_time.mday % 10) & 0xf); - m_rtc.month = ((systime.local_time.month+1)); - m_rtc.wday = ((systime.local_time.weekday % 10) & 0xf); - m_rtc.year = (((systime.local_time.year % 100)/10)<<4) | ((systime.local_time.year % 10) & 0xf); - m_rtc.hour = ((systime.local_time.hour / 10)<<4) | ((systime.local_time.hour % 10) & 0xf); - m_rtc.min = ((systime.local_time.minute / 10)<<4) | ((systime.local_time.minute % 10) & 0xf); - m_rtc.sec = ((systime.local_time.second / 10)<<4) | ((systime.local_time.second % 10) & 0xf); - - m_rtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x1_state::x1_rtc_increment),this)); - } - - m_ipl_rom = memregion("ipl")->base(); - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000*0x10); - m_emm_ram = auto_alloc_array_clear(machine(), UINT8, 0x1000000); - m_pcg_ram = auto_alloc_array_clear(machine(), UINT8, 0x1800); - m_cg_rom = memregion("cgrom")->base(); - m_kanji_rom = memregion("kanji")->base(); - - save_pointer(NAME(m_work_ram), 0x10000*0x10); - save_pointer(NAME(m_emm_ram), 0x1000000); - save_pointer(NAME(m_pcg_ram), 0x1800); - - m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, x1_pcg_8x8, (UINT8 *)m_pcg_ram, 0, 1, 0))); -} - -PALETTE_INIT_MEMBER(x1_state,x1) -{ - int i; - - for(i=0;i<(0x10+0x1000);i++) - palette.set_pen_color(i,rgb_t(0x00,0x00,0x00)); -} - -FLOPPY_FORMATS_MEMBER( x1_state::floppy_formats ) - FLOPPY_2D_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( x1_floppies ) - SLOT_INTERFACE("dd", FLOPPY_525_DD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( x1, x1_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("x1_cpu", Z80, MAIN_CLOCK/4) - MCFG_CPU_PROGRAM_MAP(x1_mem) - MCFG_CPU_IO_MAP(x1_io) - MCFG_CPU_CONFIG(x1_daisy) - - MCFG_DEVICE_ADD("ctc", Z80CTC, MAIN_CLOCK/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("ctc", z80ctc_device, trg3)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("ctc", z80ctc_device, trg2)) - - MCFG_DEVICE_ADD("x1kb", X1_KEYBOARD, 0) - - MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(x1_state, x1_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(x1_state, x1_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(x1_state, x1_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(x1_state, x1_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(x1_state, x1_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(x1_state, x1_portc_w)) - - MCFG_MACHINE_START_OVERRIDE(x1_state,x1) - MCFG_MACHINE_RESET_OVERRIDE(x1_state,x1) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(x1_state, screen_update_x1) - - MCFG_MC6845_ADD("crtc", H46505, "screen", (VDP_CLOCK/48)) //unknown divider - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_PALETTE_ADD("palette", 0x10+0x1000) - MCFG_PALETTE_INIT_OWNER(x1_state,x1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", x1) - - MCFG_VIDEO_START_OVERRIDE(x1_state,x1) - - MCFG_MB8877_ADD("fdc", MAIN_CLOCK / 16) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", x1_floppies, "dd", x1_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", x1_floppies, "dd", x1_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", x1_floppies, "dd", x1_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", x1_floppies, "dd", x1_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "x1_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - /* TODO:is the AY mono or stereo? Also volume balance isn't right. */ - MCFG_SOUND_ADD("ay", AY8910, MAIN_CLOCK/8) - MCFG_AY8910_PORT_A_READ_CB(IOPORT("P1")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("P2")) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) - MCFG_SOUND_ROUTE(0, "rspeaker", 0.25) - MCFG_SOUND_ROUTE(1, "lspeaker", 0.5) - MCFG_SOUND_ROUTE(2, "rspeaker", 0.5) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.10) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(x1_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("x1_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","x1_cass") - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", x1_state, x1_keyboard_callback, attotime::from_hz(250)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("cmt_wind_timer", x1_state, x1_cmt_wind_timer, attotime::from_hz(16)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( x1turbo, x1 ) - MCFG_CPU_MODIFY("x1_cpu") - MCFG_CPU_PROGRAM_MAP(x1turbo_mem) - MCFG_CPU_IO_MAP(x1turbo_io) - MCFG_CPU_CONFIG(x1turbo_daisy) - MCFG_MACHINE_RESET_OVERRIDE(x1_state,x1turbo) - - MCFG_Z80SIO0_ADD("sio", MAIN_CLOCK/4 , 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("dma", Z80DMA, MAIN_CLOCK/4) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE("x1_cpu", INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) - MCFG_Z80DMA_IN_MREQ_CB(READ8(x1_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(x1_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(x1_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(x1_state, io_write_byte)) - - MCFG_DEVICE_MODIFY("fdc") - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(x1_state, fdc_drq_w)) - - MCFG_YM2151_ADD("ym", MAIN_CLOCK/8) //option board - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) -MACHINE_CONFIG_END - -/************************************* - * - * ROM definitions - * - *************************************/ - -ROM_START( x1 ) - ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.x1", 0x0000, 0x1000, CRC(7b28d9de) SHA1(c4db9a6e99873808c8022afd1c50fef556a8b44d) ) - - ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu" - ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION(0x2000, "font", 0) //TODO: this contains 8x16 charset only, maybe it's possible that it derivates a 8x8 charset by skipping gfx lines? - ROM_LOAD( "ank.fnt", 0x0000, 0x2000, BAD_DUMP CRC(19689fbd) SHA1(0d4e072cd6195a24a1a9b68f1d37500caa60e599) ) - - ROM_REGION(0x1800, "cgrom", 0) - ROM_LOAD("fnt0808.x1", 0x00000, 0x00800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) ) - ROM_COPY("font", 0x1000, 0x00800, 0x1000 ) - - ROM_REGION(0x20000, "kanji", ROMREGION_ERASEFF) - - ROM_REGION(0x20000, "raw_kanji", ROMREGION_ERASEFF) -ROM_END - -ROM_START( x1turbo ) - ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.x1t", 0x0000, 0x8000, CRC(2e8b767c) SHA1(44620f57a25f0bcac2b57ca2b0f1ebad3bf305d3) ) - - ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu" - ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION(0x2000, "font", 0) //TODO: this contains 8x16 charset only, maybe it's possible that it derivates a 8x8 charset by skipping gfx lines? - ROM_LOAD( "ank.fnt", 0x0000, 0x2000, CRC(19689fbd) SHA1(0d4e072cd6195a24a1a9b68f1d37500caa60e599) ) - - ROM_REGION(0x4800, "cgrom", 0) - ROM_LOAD("fnt0808_turbo.x1", 0x00000, 0x00800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) ) - ROM_COPY("font", 0x01000, 0x00800, 0x1000 ) - - ROM_REGION(0x20000, "kanji", ROMREGION_ERASEFF) - - ROM_REGION(0x20000, "raw_kanji", ROMREGION_ERASEFF) - ROM_LOAD("kanji4.rom", 0x00000, 0x8000, CRC(3e39de89) SHA1(d3fd24892bb1948c4697dedf5ff065ff3eaf7562) ) - ROM_LOAD("kanji2.rom", 0x08000, 0x8000, CRC(e710628a) SHA1(103bbe459dc8da27a9400aa45b385255c18fcc75) ) - ROM_LOAD("kanji3.rom", 0x10000, 0x8000, CRC(8cae13ae) SHA1(273f3329c70b332f6a49a3a95e906bbfe3e9f0a1) ) - ROM_LOAD("kanji1.rom", 0x18000, 0x8000, CRC(5874f70b) SHA1(dad7ada1b70c45f1e9db11db273ef7b385ef4f17) ) -ROM_END - -ROM_START( x1turbo40 ) - ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.bin", 0x0000, 0x8000, CRC(112f80a2) SHA1(646cc3fb5d2d24ff4caa5167b0892a4196e9f843) ) - - ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu" - ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION(0x2000, "font", 0) //TODO: this contains 8x16 charset only, maybe it's possible that it derivates a 8x8 charset by skipping gfx lines? - ROM_LOAD( "ank.fnt", 0x0000, 0x2000, CRC(19689fbd) SHA1(0d4e072cd6195a24a1a9b68f1d37500caa60e599) ) - - ROM_REGION(0x4800, "cgrom", 0) - ROM_LOAD("fnt0808_turbo.x1",0x00000, 0x0800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) ) - ROM_COPY("font", 0x01000, 0x0800, 0x1000 ) - - ROM_REGION(0x20000, "kanji", ROMREGION_ERASEFF) - - ROM_REGION(0x20000, "raw_kanji", ROMREGION_ERASEFF) - ROM_LOAD("kanji4.rom", 0x00000, 0x8000, CRC(3e39de89) SHA1(d3fd24892bb1948c4697dedf5ff065ff3eaf7562) ) - ROM_LOAD("kanji2.rom", 0x08000, 0x8000, CRC(e710628a) SHA1(103bbe459dc8da27a9400aa45b385255c18fcc75) ) - ROM_LOAD("kanji3.rom", 0x10000, 0x8000, CRC(8cae13ae) SHA1(273f3329c70b332f6a49a3a95e906bbfe3e9f0a1) ) - ROM_LOAD("kanji1.rom", 0x18000, 0x8000, CRC(5874f70b) SHA1(dad7ada1b70c45f1e9db11db273ef7b385ef4f17) ) -ROM_END - - -/* Convert the ROM interleaving into something usable by the write handlers */ -DRIVER_INIT_MEMBER(x1_state,x1_kanji) -{ - UINT32 i,j,k,l; - UINT8 *kanji = memregion("kanji")->base(); - UINT8 *raw_kanji = memregion("raw_kanji")->base(); - - k = 0; - for(l=0;l<2;l++) - { - for(j=l*16;j<(l*16)+0x10000;j+=32) - { - for(i=0;i<16;i++) - { - kanji[j+i] = raw_kanji[k]; - kanji[j+i+0x10000] = raw_kanji[0x10000+k]; - k++; - } - } - } -} - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, x1, 0, 0, x1, x1, driver_device, 0, "Sharp", "X1 (CZ-800C)", 0 ) -// x1twin in x1twin.c -COMP( 1984, x1turbo, x1, 0, x1turbo, x1turbo, x1_state, x1_kanji, "Sharp", "X1 Turbo (CZ-850C)", MACHINE_NOT_WORKING ) //model 10 -COMP( 1985, x1turbo40, x1, 0, x1turbo, x1turbo, x1_state, x1_kanji, "Sharp", "X1 Turbo (CZ-862C)", 0 ) //model 40 -//COMP( 1986, x1turboz, x1, 0, x1turbo, x1turbo, x1_state, x1_kanji, "Sharp", "X1 TurboZ", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/x1twin.c b/src/mess/drivers/x1twin.c deleted file mode 100644 index 30d98a6a2eb..00000000000 --- a/src/mess/drivers/x1twin.c +++ /dev/null @@ -1,540 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese -/************************************************************************************************ - - Sharp X1Twin = Sharp X1 + NEC PC Engine All-in-One - - Both systems doesn't interact at all, according to info on the net they just shares the - same "house". It doesn't even do super-imposing, not even with the in-built X1 feature apparently - - TODO: - - Find 100% trusted info about it. - - inherit pce_state into x1twin_state - - Needs video mods - -************************************************************************************************/ - -#include "includes/x1.h" - -#include "includes/pce.h" -//#include "cpu/h6280/h6280.h" -//#include "sound/c6280.h" - -#include "rendlay.h" - -class x1twin_state : public x1_state -{ - public: - x1twin_state(const machine_config &mconfig, device_type type, const char *tag) - : x1_state(mconfig, type, tag) - { } - UINT32 screen_update_x1pce(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_INPUT_CHANGED_MEMBER(ipl_reset); - DECLARE_INPUT_CHANGED_MEMBER(nmi_reset); -}; - - -#define X1_MAIN_CLOCK XTAL_16MHz -#define VDP_CLOCK XTAL_42_9545MHz -#define MCU_CLOCK XTAL_6MHz -#define PCE_MAIN_CLOCK VDP_CLOCK / 2 - -UINT32 x1twin_state::screen_update_x1pce(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -static ADDRESS_MAP_START( x1_mem, AS_PROGRAM, 8, x1twin_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_mem_r,x1_mem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( x1_io, AS_IO, 8, x1twin_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_io_r, x1_io_w) -ADDRESS_MAP_END - -#if 0 -static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8, x1twin_state ) - AM_RANGE( 0x000000, 0x09FFFF) AM_ROM - AM_RANGE( 0x1F0000, 0x1F1FFF) AM_RAM AM_MIRROR(0x6000) - AM_RANGE( 0x1FE000, 0x1FE3FF) AM_READWRITE( vdc_r, vdc_w ) - AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE( vce_r, vce_w ) - AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE( "c6280", c6280_device, c6280_r, c6280_w ) - AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE( h6280_timer_r, h6280_timer_w ) - AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( pce_joystick_r, pce_joystick_w ) - AM_RANGE( 0x1FF400, 0x1FF7FF) AM_DEVREADWRITE( "maincpu", h6280_device, irq_status_r, irq_status_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pce_io, AS_IO, 8, x1twin_state ) - AM_RANGE( 0x00, 0x03) AM_READWRITE( vdc_r, vdc_w ) -ADDRESS_MAP_END -#endif - -/************************************* - * - * Inputs - * - *************************************/ - -INPUT_CHANGED_MEMBER(x1twin_state::ipl_reset) -{ - //address_space &space = m_maincpu->space(AS_PROGRAM); - - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE); - - m_ram_bank = 0x00; - if(m_is_turbo) { m_ex_bank = 0x10; } - //anything else? -} - -/* Apparently most games doesn't support this (not even the Konami ones!), one that does is...177 :o */ -INPUT_CHANGED_MEMBER(x1twin_state::nmi_reset) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); -} - -INPUT_PORTS_START( x1twin ) - PORT_START("FP_SYS") //front panel buttons, hard-wired with the soft reset/NMI lines - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, x1twin_state, ipl_reset,0) PORT_NAME("IPL reset") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED_MEMBER(DEVICE_SELF, x1twin_state, nmi_reset,0) PORT_NAME("NMI reset") - - PORT_START("SOUND_SW") //FIXME: this is X1Turbo specific - PORT_DIPNAME( 0x80, 0x80, "OPM Sound Setting?" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("IOSYS") //TODO: implement front-panel DIP-SW here - PORT_DIPNAME( 0x01, 0x01, "IOSYS" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Sound Setting?" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("key1") //0x00-0x1f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-8") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-8") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - - PORT_START("key2") //0x20-0x3f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2b + - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2e . - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2f / - - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3c < - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? - - PORT_START("key3") //0x40-0x5f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") - - PORT_START("f_keys") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - - PORT_START("tenkey") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) - // TODO: add other numpad keys - - PORT_START("key_modifiers") - PORT_BIT(0x00000001,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00000002,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x00000004,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x00000008,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x00000010,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) - -#if 0 - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") - - PORT_START("key3") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey ,") - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("EL") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DUP") PORT_CODE(KEYCODE_END) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) - -#endif -INPUT_PORTS_END - - -/************************************* - * - * GFX decoding - * - *************************************/ - -static const gfx_layout x1_chars_8x8 = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static const gfx_layout x1_chars_8x16 = -{ - 8,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, - 8*16 -}; - -static const gfx_layout x1_pcg_8x8 = -{ - 8,8, - RGN_FRAC(1,3), - 3, - { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 -}; - -static const gfx_layout x1_chars_16x16 = -{ - 8,16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 -}; - -/* decoded for debugging purpose, this will be nuked in the end... */ -static GFXDECODE_START( x1 ) - GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8, 0, 1 ) - GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8, 0, 1 ) - GFXDECODE_ENTRY( "font", 0x00000, x1_chars_8x16, 0, 1 ) - GFXDECODE_ENTRY( "kanji", 0x00000, x1_chars_16x16, 0, 1 ) -GFXDECODE_END - -static const z80_daisy_config x1_daisy[] = -{ - { "x1kb" }, - { "ctc" }, - { NULL } -}; - -static SLOT_INTERFACE_START( x1_floppies ) - SLOT_INTERFACE("dd", FLOPPY_525_DD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( x1twin, x1twin_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("x1_cpu", Z80, X1_MAIN_CLOCK/4) - MCFG_CPU_PROGRAM_MAP(x1_mem) - MCFG_CPU_IO_MAP(x1_io) - MCFG_CPU_CONFIG(x1_daisy) - - MCFG_DEVICE_ADD("ctc", Z80CTC, MAIN_CLOCK/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("x1_cpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("ctc", z80ctc_device, trg3)) - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("ctc", z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("ctc", z80ctc_device, trg2)) - - MCFG_DEVICE_ADD("x1kb", X1_KEYBOARD, 0) - - MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(x1_state, x1_porta_r)) - MCFG_I8255_OUT_PORTA_CB(WRITE8(x1_state, x1_porta_w)) - MCFG_I8255_IN_PORTB_CB(READ8(x1_state, x1_portb_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(x1_state, x1_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(x1_state, x1_portc_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(x1_state, x1_portc_w)) - - MCFG_MACHINE_START_OVERRIDE(x1twin_state,x1) - MCFG_MACHINE_RESET_OVERRIDE(x1twin_state,x1) - - #if 0 - MCFG_CPU_ADD("pce_cpu", H6280, PCE_MAIN_CLOCK/3) - MCFG_CPU_PROGRAM_MAP(pce_mem) - MCFG_CPU_IO_MAP(pce_io) - MCFG_TIMER_ADD_SCANLINE("scantimer", pce_interrupt, "pce_screen", 0, 1) - #endif - - MCFG_DEFAULT_LAYOUT(layout_dualhsxs) - /* video hardware */ - MCFG_SCREEN_ADD("x1_screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(x1twin_state, screen_update_x1) - - MCFG_SCREEN_ADD("pce_screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK/2, HUC6260_WPF, 70, 70 + 512 + 32, HUC6260_LPF, 14, 14+242) - MCFG_SCREEN_UPDATE_DRIVER(x1twin_state, screen_update_x1pce) - - MCFG_MC6845_ADD("crtc", H46505, "x1_screen", (VDP_CLOCK/48)) //unknown divider - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_PALETTE_ADD("palette", 0x10+0x1000) - MCFG_PALETTE_INIT_OWNER(x1twin_state,x1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", x1) - - MCFG_VIDEO_START_OVERRIDE(x1twin_state,x1) - - MCFG_MB8877_ADD("fdc", MAIN_CLOCK / 16) - - MCFG_FLOPPY_DRIVE_ADD("fdc:0", x1_floppies, "dd", x1_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", x1_floppies, "dd", x1_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:2", x1_floppies, "dd", x1_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:3", x1_floppies, "dd", x1_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") - - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "x1_cart") - MCFG_GENERIC_EXTENSIONS("bin,rom") - - MCFG_SPEAKER_ADD("x1_l",-0.2, 0.0, 1.0) - MCFG_SPEAKER_ADD("x1_r",0.2, 0.0, 1.0) - MCFG_SPEAKER_ADD("pce_l",-0.2, 0.0, 1.0) - MCFG_SPEAKER_ADD("pce_r",0.2, 0.0, 1.0) - -// MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - /* TODO:is the AY mono or stereo? Also volume balance isn't right. */ - MCFG_SOUND_ADD("ay", AY8910, MAIN_CLOCK/8) - MCFG_AY8910_PORT_A_READ_CB(IOPORT("P1")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("P2")) - MCFG_SOUND_ROUTE(0, "x1_l", 0.25) - MCFG_SOUND_ROUTE(0, "x1_r", 0.25) - MCFG_SOUND_ROUTE(1, "x1_l", 0.5) - MCFG_SOUND_ROUTE(2, "x1_r", 0.5) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "x1_l", 0.25) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "x1_r", 0.10) - - MCFG_CASSETTE_ADD("cassette") - MCFG_CASSETTE_FORMATS(x1_cassette_formats) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_CASSETTE_INTERFACE("x1_cass") - - MCFG_SOFTWARE_LIST_ADD("cass_list","x1_cass") - -#if 0 - MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6) - MCFG_C6280_CPU("pce_cpu") - MCFG_SOUND_ROUTE(0, "pce_l", 0.5) - MCFG_SOUND_ROUTE(1, "pce_r", 0.5) -#endif - - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", x1twin_state, x1_keyboard_callback, attotime::from_hz(250)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("cmt_wind_timer", x1twin_state, x1_cmt_wind_timer, attotime::from_hz(16)) -MACHINE_CONFIG_END - -ROM_START( x1twin ) - ROM_REGION( 0x10000, "x1_cpu", ROMREGION_ERASEFF ) - - ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "ipl.rom", 0x0000, 0x1000, CRC(e70011d3) SHA1(d3395e9aeb5b8bbba7654dd471bcd8af228ee69a) ) - - ROM_REGION( 0x10000, "wram", ROMREGION_ERASE00 ) - - ROM_REGION(0x1000, "mcu", ROMREGION_ERASEFF) //MCU for the Keyboard, "sub cpu" - ROM_LOAD( "80c48", 0x0000, 0x1000, NO_DUMP ) - - ROM_REGION( 0x1000000, "emm", ROMREGION_ERASEFF ) - - ROM_REGION(0x1800, "pcg", ROMREGION_ERASEFF) - - ROM_REGION(0x1000, "font", 0) //TODO: this contains 8x16 charset only, maybe it's possible that it derivates a 8x8 charset by skipping gfx lines? - ROM_LOAD( "ank16.rom", 0x0000, 0x1000, CRC(8f9fb213) SHA1(4f06d20c997a79ee6af954b69498147789bf1847) ) - - ROM_REGION(0x1800, "cgrom", 0) - ROM_LOAD("ank8.rom", 0x00000, 0x00800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) ) - ROM_COPY("font", 0x00000, 0x00800, 0x1000 ) - - ROM_REGION(0x20000, "kanji", ROMREGION_ERASEFF) - - ROM_REGION(0x20000, "raw_kanji", ROMREGION_ERASEFF) // these comes from x1 turbo - ROM_LOAD("kanji4.rom", 0x00000, 0x8000, BAD_DUMP CRC(3e39de89) SHA1(d3fd24892bb1948c4697dedf5ff065ff3eaf7562) ) - ROM_LOAD("kanji2.rom", 0x08000, 0x8000, BAD_DUMP CRC(e710628a) SHA1(103bbe459dc8da27a9400aa45b385255c18fcc75) ) - ROM_LOAD("kanji3.rom", 0x10000, 0x8000, BAD_DUMP CRC(8cae13ae) SHA1(273f3329c70b332f6a49a3a95e906bbfe3e9f0a1) ) - ROM_LOAD("kanji1.rom", 0x18000, 0x8000, BAD_DUMP CRC(5874f70b) SHA1(dad7ada1b70c45f1e9db11db273ef7b385ef4f17) ) -ROM_END - -COMP( 1986, x1twin, x1, 0, x1twin, x1twin, x1_state, x1_kanji,"Sharp", "X1 Twin (CZ-830C)", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/x68k.c b/src/mess/drivers/x68k.c deleted file mode 100644 index af0a91a4948..00000000000 --- a/src/mess/drivers/x68k.c +++ /dev/null @@ -1,1854 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald,Carl - -// Preliminary X68000 driver for MESS -// Started 18/11/2006 -// Written by Barry Rodewald - -/* - *** Basic memory map - - 0x000000 - 0xbfffff RAM (Max 12MB), vector table from ROM at 0xff0000 maps to 0x000000 at reset only - 0xc00000 - 0xdfffff Graphic VRAM - 0xe00000 - 0xe1ffff Text VRAM Plane 1 - 0xe20000 - 0xe3ffff Text VRAM Plane 2 - 0xe40000 - 0xe5ffff Text VRAM Plane 3 - 0xe60000 - 0xe7ffff Text VRAM Plane 4 - 0xe80000 CRTC - 0xe82000 Video Controller - 0xe84000 DMA Controller - 0xe86000 Supervisor Area set - 0xe88000 MFP - 0xe8a000 RTC - 0xe8c000 Printer - 0xe8e000 System Port (?) - 0xe90000 FM Sound source - 0xe92000 ADPCM - 0xe94000 FDC - 0xe96000 HDC - 0xe96021 SCSI (internal model) - 0xe98000 SCC - 0xe9a000 Serial I/O (PPI) - 0xe9c000 I/O controller - - [Expansions] - 0xe9c000 / 0xe9e000 FPU (Optional, X68000 only) - 0xea0000 SCSI - 0xeaf900 FAX - 0xeafa00 / 0xeafa10 MIDI (1st/2nd) - 0xeafb00 Serial - 0xeafc00/10/20/30 EIA232E - 0xeafd00 EIA232E - 0xeafe00 GPIB (?) - 0xec0000 - 0xecffff User I/O Expansion - - 0xeb0000 - 0xeb7fff Sprite registers - 0xeb8000 - 0xebffff Sprite VRAM - 0xed0000 - 0xed3fff SRAM - 0xf00000 - 0xfb0000 ROM (CGROM.DAT) - 0xfe0000 - 0xffffff ROM (IPLROM.DAT) - - - *** System hardware - - CPU : X68000: 68000 at 10MHz - X68000 XVI: 68000 at 16MHz - X68030: 68EC030 at 25MHz - - RAM : between 1MB and 4MB stock, expandable to 12MB - - FDD : 2x 5.25", Compact models use 2x 3.5" drives. - FDC : NEC uPD72065 - - HDD : HD models have up to an 81MB HDD. - HDC : Fujitsu MB89352A (SCSI) - - SCC : Serial controller - Zilog z85C30 (Dual channel, 1 for RS232, 1 for mouse) - PPI : Parallel controller - NEC 8255 (Printer, Joystick) - - Sound : FM - YM2151, with YM3012 DAC - ADPCM - Okidata MSM6258 - - DMA : Hitachi HD63450, DMA I/O for FDD, HDD, Expansion slots, and ADPCM - - MFP : Motorola MC68901 - monitor sync, serial port, RTC, soft power, FM synth, IRQs, keyboard - - RTC : Ricoh RP5C15 - - ...plus a number of custom chips for video and other stuff... - - - *** Current status (28/12/08) - MFP : Largely works, as far as the X68000 goes. - - PPI : Joystick controls work okay. - - HDC/HDD : SCSI is not implemented, not a requirement at this point. - - RTC : Seems to work. (Tested using SX-Window's Timer application) - - DMA : Works fine. - - Sound : FM works, ADPCM mostly works (timing(?) issues in a few games). - - SCC : Works enough to get the mouse running, although only with the IPL v1.0 BIOS - - Video : Text mode works, but is rather slow, especially scrolling up (uses multple "raster copy" commands). - Graphic layers work. - BG tiles and sprites work, but many games have the sprites offset by a small amount (some by a lot :)) - Still a few minor priority issues around. - - Other issues: - Bus error exceptions are a bit late at times. Currently using a fake bus error for MIDI expansion checks. These - are used determine if a piece of expansion hardware is present. - Keyboard doesn't work properly (MFP USART). - Supervisor area set isn't implemented. - - Some minor game-specific issues: - Salamander: System error when using keys in-game. No error if a joystick is used. - Some text is drawn incorrectly. - Dragon Buster: Text is black and unreadable. (Text layer actually covers it) - Tetris: Black dots over screen (text layer). - Parodius Da!: Black squares in areas. - - More detailed documentation at http://x68kdev.emuvibes.com/iomap.html - if you can stand broken english :) - -*/ - -#include "emu.h" -#include "machine/mc68901.h" -#include "machine/upd765.h" -#include "sound/okim6258.h" -#include "machine/rp5c15.h" -#include "machine/mb89352.h" -#include "formats/xdf_dsk.h" -#include "formats/dim_dsk.h" -#include "machine/x68k_hdc.h" -#include "machine/x68k_kbd.h" -#include "includes/x68k.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "bus/x68k/x68kexp.h" -#include "bus/x68k/x68k_neptunex.h" -#include "bus/x68k/x68k_scsiext.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsihd.h" -#include "x68000.lh" - - - -void x68k_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_X68K_LED: - x68k_led_callback(ptr, param); - break; - case TIMER_X68K_SCC_ACK: - x68k_scc_ack(ptr, param); - break; - case TIMER_MD_6BUTTON_PORT1_TIMEOUT: - md_6button_port1_timeout(ptr, param); - break; - case TIMER_MD_6BUTTON_PORT2_TIMEOUT: - md_6button_port2_timeout(ptr, param); - break; - case TIMER_X68K_BUS_ERROR: - x68k_bus_error(ptr, param); - break; - case TIMER_X68K_NET_IRQ: - x68k_net_irq(ptr, param); - break; - case TIMER_X68K_CRTC_OPERATION_END: - x68k_crtc_operation_end(ptr, param); - break; - case TIMER_X68K_HSYNC: - x68k_hsync(ptr, param); - break; - case TIMER_X68K_CRTC_RASTER_END: - x68k_crtc_raster_end(ptr, param); - break; - case TIMER_X68K_CRTC_RASTER_IRQ: - x68k_crtc_raster_irq(ptr, param); - break; - case TIMER_X68K_CRTC_VBLANK_IRQ: - x68k_crtc_vblank_irq(ptr, param); - break; - case TIMER_X68K_FDC_TC: - m_upd72065->tc_w(ASSERT_LINE); - m_upd72065->tc_w(CLEAR_LINE); - break; - case TIMER_X68K_ADPCM: - m_hd63450->drq3_w(1); - m_hd63450->drq3_w(0); - break; - default: - assert_always(FALSE, "Unknown id in x68k_state::device_timer"); - } -} - -// LED timer callback -TIMER_CALLBACK_MEMBER(x68k_state::x68k_led_callback) -{ - int drive; - if(m_led_state == 0) - m_led_state = 1; - else - m_led_state = 0; - if(m_led_state == 1) - { - for(drive=0;drive<4;drive++) - output_set_indexed_value("ctrl_drv",drive,m_fdc.led_ctrl[drive] ? 0 : 1); - } - else - { - for(drive=0;drive<4;drive++) - output_set_indexed_value("ctrl_drv",drive,1); - } - -} - - -// mouse input -// port B of the Z8530 SCC -// typically read from the SCC data port on receive buffer full interrupt per byte -int x68k_state::x68k_read_mouse() -{ - char val = 0; - char ipt = 0; - - if(!(m_scc->get_reg_b(5) & 0x02)) - return 0xff; - - switch(m_mouse.inputtype) - { - case 0: - ipt = m_mouse1->read(); - break; - case 1: - val = m_mouse2->read(); - ipt = val - m_mouse.last_mouse_x; - m_mouse.last_mouse_x = val; - break; - case 2: - val = m_mouse3->read(); - ipt = val - m_mouse.last_mouse_y; - m_mouse.last_mouse_y = val; - break; - } - m_mouse.inputtype++; - if(m_mouse.inputtype > 2) - { - int i_val = m_scc->get_reg_b(0); - m_mouse.inputtype = 0; - m_mouse.bufferempty = 1; - i_val &= ~0x01; - m_scc->set_reg_b(0, i_val); - logerror("SCC: mouse buffer empty\n"); - } - - return ipt; -} - -/* - 0xe98001 - Z8530 command port B - 0xe98003 - Z8530 data port B (mouse input) - 0xe98005 - Z8530 command port A - 0xe98007 - Z8530 data port A (RS232) -*/ -READ16_MEMBER(x68k_state::x68k_scc_r ) -{ - offset %= 4; - switch(offset) - { - case 0: - return m_scc->reg_r(space, 0); - case 1: - return x68k_read_mouse(); - case 2: - return m_scc->reg_r(space, 1); - case 3: - return m_scc->reg_r(space, 3); - default: - return 0xff; - } -} - -WRITE16_MEMBER(x68k_state::x68k_scc_w ) -{ - offset %= 4; - - switch(offset) - { - case 0: - m_scc->reg_w(space, 0,(UINT8)data); - if((m_scc->get_reg_b(5) & 0x02) != m_scc_prev) - { - if(m_scc->get_reg_b(5) & 0x02) // Request to Send - { - int val = m_scc->get_reg_b(0); - m_mouse.bufferempty = 0; - val |= 0x01; - m_scc->set_reg_b(0,val); - } - } - break; - case 1: - m_scc->reg_w(space, 2,(UINT8)data); - break; - case 2: - m_scc->reg_w(space, 1,(UINT8)data); - break; - case 3: - m_scc->reg_w(space, 3,(UINT8)data); - break; - } - m_scc_prev = m_scc->get_reg_b(5) & 0x02; -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_scc_ack) -{ - if(m_mouse.bufferempty != 0) // nothing to do if the mouse data buffer is empty - return; - -// if((m_ioc.irqstatus & 0xc0) != 0) -// return; - - // hard-code the IRQ vector for now, until the SCC code is more complete - if((m_scc->get_reg_a(9) & 0x08) || (m_scc->get_reg_b(9) & 0x08)) // SCC reg WR9 is the same for both channels - { - if((m_scc->get_reg_b(1) & 0x18) != 0) // if bits 3 and 4 of WR1 are 0, then Rx IRQs are disabled on this channel - { - if(m_scc->get_reg_b(5) & 0x02) // RTS signal - { - m_mouse.irqactive = 1; - m_current_vector[5] = 0x54; - m_current_irq_line = 5; - m_maincpu->set_input_line_and_vector(5,ASSERT_LINE,0x54); - } - } - } -} - -void x68k_state::x68k_set_adpcm() -{ - UINT32 rate = 0; - - switch(m_adpcm.rate & 0x0c) - { - case 0x00: - rate = 7812/2; - break; - case 0x04: - rate = 10417/2; - break; - case 0x08: - rate = 15625/2; - break; - default: - logerror("PPI: Invalid ADPCM sample rate set.\n"); - rate = 15625/2; - } - if(m_adpcm.clock != 0) - rate = rate/2; - m_adpcm_timer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); -} - -// Megadrive 3 button gamepad -// According to XM6, bits 4 and 7 are always 1 (is this correct?) -// Bits 4 and 5 of PPI port C control each controller's multiplexer -// Button inputs (Start, A, B and C) are read in bits 5 and 6 (rather than 4 -// and 5 like on a Megadrive) - -UINT8 x68k_state::md_3button_r(int port) -{ - if(port == 1) - { - UINT8 porta = m_md3b->read() & 0xff; - UINT8 portb = (m_md3b->read() >> 8) & 0xff; - if(m_mdctrl.mux1 & 0x10) - { - return porta | 0x90; - } - else - { - return (portb & 0x60) | (porta & 0x03) | 0x90; - } - } - if(port == 2) - { - UINT8 porta = (m_md3b->read() >> 16) & 0xff; - UINT8 portb = (m_md3b->read() >> 24) & 0xff; - if(m_mdctrl.mux2 & 0x20) - { - return porta | 0x90; - } - else - { - return (portb & 0x60) | (porta & 0x03) | 0x90; - } - } - return 0xff; -} - -// Megadrive 6 button gamepad -TIMER_CALLBACK_MEMBER(x68k_state::md_6button_port1_timeout) -{ - m_mdctrl.seq1 = 0; -} - -TIMER_CALLBACK_MEMBER(x68k_state::md_6button_port2_timeout) -{ - m_mdctrl.seq2 = 0; -} - -void x68k_state::md_6button_init() -{ - m_mdctrl.io_timeout1 = timer_alloc(TIMER_MD_6BUTTON_PORT1_TIMEOUT); - m_mdctrl.io_timeout2 = timer_alloc(TIMER_MD_6BUTTON_PORT2_TIMEOUT); -} - -UINT8 x68k_state::md_6button_r(int port) -{ - if(port == 1) - { - UINT8 porta = m_md6b->read() & 0xff; - UINT8 portb = (m_md6b->read() >> 8) & 0xff; - UINT8 extra = m_md6b_extra->read() & 0x0f; - - switch(m_mdctrl.seq1) - { - case 1: - default: - if(m_mdctrl.mux1 & 0x10) - { - return porta | 0x90; - } - else - { - return (portb & 0x60) | (porta & 0x03) | 0x90; - } - case 2: - if(m_mdctrl.mux1 & 0x10) - { - return porta | 0x90; - } - else - { - return (portb & 0x60) | 0x90; - } - case 3: - if(m_mdctrl.mux1 & 0x10) - { - return (porta & 0x60) | (extra & 0x0f) | 0x90; - } - else - { - return (portb & 0x60) | 0x9f; - } - } - } - if(port == 2) - { - UINT8 porta = (m_md6b->read() >> 16) & 0xff; - UINT8 portb = (m_md6b->read() >> 24) & 0xff; - UINT8 extra = (m_md6b_extra->read() >> 4) & 0x0f; - - switch(m_mdctrl.seq2) - { - case 1: - default: - if(m_mdctrl.mux2 & 0x20) - { - return porta | 0x90; - } - else - { - return (portb & 0x60) | (porta & 0x03) | 0x90; - } - case 2: - if(m_mdctrl.mux2 & 0x20) - { - return porta | 0x90; - } - else - { - return (portb & 0x60) | 0x90; - } - case 3: - if(m_mdctrl.mux2 & 0x20) - { - return (porta & 0x60) | (extra & 0x0f) | 0x90; - } - else - { - return (portb & 0x60) | 0x9f; - } - } - } - return 0xff; -} - -// XPD-1LR dual D-pad controller. -// Sold with Video Game Anthology Vol 4: Libble Rabble. -// Also compatible with Video Game Anthology Vol 5: Crazy Climber 1 & 2 -// Uses the same input multiplexer hardware as Megadrive controllers -// Output is the same as for standard controllers, but when ctl is high, -// the directions refer to the right D-pad, and when low, the left D-pad -// The buttons are read the same as normal, regardless of ctl. -UINT8 x68k_state::xpd1lr_r(int port) -{ - if(port == 1) - { - UINT8 porta = m_xpd1lr->read() & 0xff; - UINT8 portb = (m_xpd1lr->read() >> 8) & 0xff; - if(m_mdctrl.mux1 & 0x10) - { - return porta; - } - else - { - return portb | (porta & 0x60); - } - } - if(port == 2) - { - UINT8 porta = (m_xpd1lr->read() >> 16) & 0xff; - UINT8 portb = (m_xpd1lr->read() >> 24) & 0xff; - if(m_mdctrl.mux2 & 0x20) - { - return porta; - } - else - { - return portb | (porta & 0x60); - } - } - return 0xff; -} - -// Judging from the XM6 source code, PPI ports A and B are joystick inputs -READ8_MEMBER(x68k_state::ppi_port_a_r) -{ - int ctrl = m_ctrltype->read() & 0x0f; - - switch(ctrl) - { - case 0x00: // standard MSX/FM-Towns joystick - if(m_joy.joy1_enable == 0) - return m_joy1->read(); - else - return 0xff; - case 0x01: // 3-button Megadrive gamepad - return md_3button_r(1); - case 0x02: // 6-button Megadrive gamepad - return md_6button_r(1); - case 0x03: // XPD-1LR - return xpd1lr_r(1); - } - - return 0xff; -} - -READ8_MEMBER(x68k_state::ppi_port_b_r) -{ - int ctrl = m_ctrltype->read() & 0xf0; - - switch(ctrl) - { - case 0x00: // standard MSX/FM-Towns joystick - if(m_joy.joy2_enable == 0) - return m_joy2->read(); - else - return 0xff; - case 0x10: // 3-button Megadrive gamepad - return md_3button_r(2); - case 0x20: // 6-button Megadrive gamepad - return md_6button_r(2); - case 0x30: // XPD-1LR - return xpd1lr_r(2); - } - - return 0xff; -} - -READ8_MEMBER(x68k_state::ppi_port_c_r) -{ - return m_ppi_port[2]; -} - -/* PPI port C (Joystick control, R/W) - bit 7 - IOC7 - Function B operation of joystick 1 (?) - bit 6 - IOC6 - Function A operation of joystick 1 (?) - bit 5 - IOC5 - Enable Joystick 2 - bit 4 - IOC4 - Enable Joystick 1 - bits 3,2 - ADPCM Sample rate - bits 1,0 - ADPCM Pan -*/ -WRITE8_MEMBER(x68k_state::ppi_port_c_w) -{ - // ADPCM / Joystick control - m_ppi_port[2] = data; - if((data & 0x0f) != (m_ppi_prev & 0x0f)) - { - m_adpcm.pan = data & 0x03; - m_adpcm.rate = data & 0x0c; - x68k_set_adpcm(); - m_okim6258->set_divider((data >> 2) & 3); - } - - // The joystick enable bits also handle the multiplexer for various controllers - m_joy.joy1_enable = data & 0x10; - m_mdctrl.mux1 = data & 0x10; - if((m_ppi_prev & 0x10) == 0x00 && (data & 0x10) == 0x10) - { - m_mdctrl.seq1++; - m_mdctrl.io_timeout1->adjust(m_maincpu->cycles_to_attotime(8192)); - } - - m_joy.joy2_enable = data & 0x20; - m_mdctrl.mux2 = data & 0x20; - if((m_ppi_prev & 0x20) == 0x00 && (data & 0x20) == 0x20) - { - m_mdctrl.seq2++; - m_mdctrl.io_timeout2->adjust(m_maincpu->cycles_to_attotime(8192)); - } - m_ppi_prev = data; - - m_joy.ioc6 = data & 0x40; - m_joy.ioc7 = data & 0x80; -} - - -// NEC uPD72065 at 0xe94000 -WRITE16_MEMBER(x68k_state::x68k_fdc_w) -{ - unsigned int drive, x; - switch(offset) - { - case 0x00: // drive option signal control - x = data & 0x0f; - for(drive=0;drive<4;drive++) - { - if(m_fdc.control_drives & (1 << drive)) - { - if(!(x & (1 << drive))) // functions take place on 1->0 transitions of drive bits only - { - m_fdc.led_ctrl[drive] = data & 0x80; // blinking drive LED if no disk inserted - m_fdc.led_eject[drive] = data & 0x40; // eject button LED (on when set to 0) - output_set_indexed_value("eject_drv",drive,(data & 0x40) ? 1 : 0); - if((data & 0x60) == 0x20) // ejects disk - m_fdc.floppy[drive]->unload(); - } - } - } - m_fdc.control_drives = data & 0x0f; - logerror("FDC: signal control set to %02x\n",data); - break; - case 0x01: { - x = data & 3; - m_upd72065->set_floppy(m_fdc.floppy[x]); - m_upd72065->set_rate((data & 0x10) ? 300000 : 500000); - m_fdc.motor = data & 0x80; - - for(int i = 0; i < 4; i++) - if(m_fdc.floppy[i]->exists()) - m_fdc.floppy[i]->mon_w(!BIT(data, 7)); - - output_set_indexed_value("access_drv",x,0); - if(x != m_fdc.select_drive) - output_set_indexed_value("access_drv",m_fdc.select_drive,1); - m_fdc.select_drive = x; - logerror("FDC: Drive #%i: Drive selection set to %02x\n",x,data); - break; - } - } -} - -READ16_MEMBER(x68k_state::x68k_fdc_r) -{ - unsigned int ret; - int x; - - switch(offset) - { - case 0x00: - ret = 0x00; - for(x=0;x<4;x++) - { - if(m_fdc.control_drives & (1 << x)) - { - ret = 0x00; - if(m_fdc.floppy[x]->exists()) - { - ret |= 0x80; - } - // bit 7 = disk inserted - // bit 6 = disk error (in insertion, presumably) - logerror("FDC: Drive #%i Disk check - returning %02x\n",x,ret); - } - } - return ret; - case 0x01: - logerror("FDC: IOC selection is write-only\n"); - return 0xff; - } - return 0xff; -} - -WRITE_LINE_MEMBER( x68k_state::fdc_irq ) -{ - if((m_ioc.irqstatus & 0x04) && state) - { - m_current_vector[1] = m_ioc.fdcvector; - m_ioc.irqstatus |= 0x80; - m_current_irq_line = 1; - logerror("FDC: IRQ triggered\n"); - m_maincpu->set_input_line_and_vector(1, ASSERT_LINE, m_current_vector[1]); - } - else - m_maincpu->set_input_line(1, CLEAR_LINE); -} - -WRITE8_MEMBER(x68k_state::x68k_ct_w) -{ - // CT1 and CT2 bits from YM2151 port 0x1b - // CT1 - ADPCM clock - 0 = 8MHz, 1 = 4MHz - // CT2 - 1 = Set ready state of FDC - if(data & 1) - { - m_upd72065->set_ready_line_connected(0); - m_upd72065->ready_w(0); - } - else - m_upd72065->set_ready_line_connected(1); - - m_adpcm.clock = data & 0x02; - x68k_set_adpcm(); - m_okim6258->set_clock(data & 0x02 ? 4000000 : 8000000); -} - -/* - Custom I/O controller at 0xe9c000 - 0xe9c001 (R) - Interrupt status - 0xe9c001 (W) - Interrupt mask (low nibble only) - - bit 7 = FDC interrupt - - bit 6 = FDD interrupt - - bit 5 = Printer Busy signal - - bit 4 = HDD interrupt - - bit 3 = HDD interrupts enabled - - bit 2 = FDC interrupts enabled - - bit 1 = FDD interrupts enabled - - bit 0 = Printer interrupts enabled - 0xe9c003 (W) - Interrupt vector - - bits 7-2 = vector - - bits 1,0 = device (00 = FDC, 01 = FDD, 10 = HDD, 11 = Printer) -*/ -WRITE16_MEMBER(x68k_state::x68k_ioc_w) -{ - switch(offset) - { - case 0x00: - m_ioc.irqstatus = data & 0x0f; - logerror("I/O: Status register write %02x\n",data); - break; - case 0x01: - switch(data & 0x03) - { - case 0x00: - m_ioc.fdcvector = data & 0xfc; - logerror("IOC: FDC IRQ vector = 0x%02x\n",data & 0xfc); - break; - case 0x01: - m_ioc.fddvector = data & 0xfc; - logerror("IOC: FDD IRQ vector = 0x%02x\n",data & 0xfc); - break; - case 0x02: - m_ioc.hdcvector = data & 0xfc; - logerror("IOC: HDD IRQ vector = 0x%02x\n",data & 0xfc); - break; - case 0x03: - m_ioc.prnvector = data & 0xfc; - logerror("IOC: Printer IRQ vector = 0x%02x\n",data & 0xfc); - break; - } - break; - } -} - -READ16_MEMBER(x68k_state::x68k_ioc_r) -{ - switch(offset) - { - case 0x00: - logerror("I/O: Status register read\n"); - return (m_ioc.irqstatus & 0xdf) | 0x20; - default: - return 0x00; - } -} - -/* - System ports at 0xe8e000 - Port 1 (0xe8e001) - Monitor contrast (bits 3-0) - Port 2 (0xe8e003) - Display / 3D scope control - - bit 3 - Display control signal (0 = on) - - bit 1 - 3D scope left shutter (0 = closed) - - bit 0 - 3D scope right shutter - Port 3 (0xe8e005) - Colour image unit control (bits 3-0) - Port 4 (0xe8e007) - Keyboard/NMI/Dot clock - - bit 3 - (R) 1 = Keyboard connected, (W) 1 = Key data can be transmitted - - bit 1 - NMI Reset - - bit 0 - HRL - high resolution dot clock - 1 = 1/2, 1/4, 1/8, 0 = 1/2, 1/3, 1/6 (normal) - Port 5 (0xe8e009) - ROM (bits 7-4)/DRAM (bits 3-0) wait, X68030 only - Port 6 (0xe8e00b) - CPU type and clock speed (XVI or later only, X68000 returns 0xFF) - - bits 7-4 - CPU Type (1100 = 68040, 1101 = 68030, 1110 = 68020, 1111 = 68000) - - bits 3-0 - clock speed (1001 = 50MHz, 40, 33, 25, 20, 16, 1111 = 10MHz) - Port 7 (0xe8e00d) - SRAM write enable - if 0x31 is written to this port, writing to SRAM is allowed. - Any other value, then SRAM is read only. - Port 8 (0xe8e00f) - Power off control - write 0x00, 0x0f, 0x0f sequentially to switch power off. -*/ -WRITE16_MEMBER(x68k_state::x68k_sysport_w) -{ - switch(offset) - { - case 0x00: - m_sysport.contrast = data & 0x0f; // often used for screen fades / blanking - m_screen->set_brightness(m_sysport.contrast * 0x11); - break; - case 0x01: - m_sysport.monitor = data & 0x08; - break; - case 0x03: - m_sysport.keyctrl = data & 0x08; // bit 3 = enable keyboard data transmission - break; - case 0x06: - COMBINE_DATA(&m_sysport.sram_writeprotect); - break; - default: -// logerror("SYS: [%08x] Wrote %04x to invalid or unimplemented system port %04x\n",space.device().safe_pc(),data,offset); - break; - } -} - -READ16_MEMBER(x68k_state::x68k_sysport_r) -{ - int ret = 0; - switch(offset) - { - case 0x00: // monitor contrast setting (bits3-0) - return m_sysport.contrast; - case 0x01: // monitor control (bit3) / 3D Scope (bits1,0) - ret |= m_sysport.monitor; - return ret; - case 0x03: // bit 3 = key control (is 1 if keyboard is connected) - return 0x08; - case 0x05: // CPU type and speed - return m_sysport.cputype; - default: - logerror("Read from invalid or unimplemented system port %04x\n",offset); - return 0xff; - } -} - -WRITE16_MEMBER(x68k_state::x68k_ppi_w) -{ - m_ppi->write(space,offset & 0x03,data); -} - -READ16_MEMBER(x68k_state::x68k_ppi_r) -{ - return m_ppi->read(space,offset & 0x03); -} - - -WRITE16_MEMBER(x68k_state::x68k_sram_w) -{ - if(m_sysport.sram_writeprotect == 0x31) - { - COMBINE_DATA(&m_nvram[offset]); - } -} - -READ16_MEMBER(x68k_state::x68k_sram_r) -{ - // HACKS! -// if(offset == 0x5a/2) // 0x5a should be 0 if no SASI HDs are present. -// return 0x0000; - if(offset == 0x08/2) - return m_ram->size() >> 16; // RAM size - return m_nvram[offset]; -} - -WRITE16_MEMBER(x68k_state::x68k_vid_w) -{ - switch(offset) - { - case 0x000: - COMBINE_DATA(m_video.reg); - break; - case 0x080: // priority levels - COMBINE_DATA(m_video.reg+1); - if(ACCESSING_BITS_0_7) - { - m_video.gfxlayer_pri[0] = data & 0x0003; - m_video.gfxlayer_pri[1] = (data & 0x000c) >> 2; - m_video.gfxlayer_pri[2] = (data & 0x0030) >> 4; - m_video.gfxlayer_pri[3] = (data & 0x00c0) >> 6; - } - if(ACCESSING_BITS_8_15) - { - m_video.gfx_pri = (data & 0x0300) >> 8; - m_video.text_pri = (data & 0x0c00) >> 10; - m_video.sprite_pri = (data & 0x3000) >> 12; - if(m_video.gfx_pri == 3) - m_video.gfx_pri--; - if(m_video.text_pri == 3) - m_video.text_pri--; - if(m_video.sprite_pri == 3) - m_video.sprite_pri--; - } - break; - case 0x100: - COMBINE_DATA(m_video.reg+2); - break; - default: - logerror("VC: Invalid video controller write (offset = 0x%04x, data = %04x)\n",offset,data); - } -} - -READ16_MEMBER(x68k_state::x68k_vid_r) -{ - switch(offset) - { - case 0x000: - return m_video.reg[0]; - case 0x080: - return m_video.reg[1]; - case 0x100: - return m_video.reg[2]; - default: - logerror("VC: Invalid video controller read (offset = 0x%04x)\n",offset); - } - - return 0xff; -} - -READ16_MEMBER(x68k_state::x68k_areaset_r) -{ - // register is write-only - return 0xffff; -} - -WRITE16_MEMBER(x68k_state::x68k_areaset_w) -{ - // TODO - logerror("SYS: Supervisor area set: 0x%02x\n",data & 0xff); -} - -WRITE16_MEMBER(x68k_state::x68k_enh_areaset_w ) -{ - // TODO - logerror("SYS: Enhanced Supervisor area set (from %iMB): 0x%02x\n",(offset + 1) * 2,data & 0xff); -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_bus_error) -{ - m_bus_error = false; -} - -void x68k_state::set_bus_error(UINT32 address, bool write, UINT16 mem_mask) -{ - if(m_bus_error) - return; - if(!ACCESSING_BITS_8_15) - address++; - m_bus_error = true; - m_maincpu->set_buserror_details(address, write, m_maincpu->get_fc()); - m_maincpu->mmu_tmp_buserror_address = address; // Hack for x68030 - m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - m_bus_error_timer->adjust(m_maincpu->cycles_to_attotime(16)); // let rmw cycles complete - logerror("%s: Bus error: Unused RAM access [%08x]\n", machine().describe_context(), address); -} - -READ16_MEMBER(x68k_state::x68k_rom0_r) -{ - /* this location contains the address of some expansion device ROM, if no ROM exists, - then access causes a bus error */ - if((m_options->read() & 0x02) && !space.debugger_access()) - set_bus_error((offset << 1) + 0xbffffc, 0, mem_mask); - return 0xff; -} - -WRITE16_MEMBER(x68k_state::x68k_rom0_w) -{ - /* this location contains the address of some expansion device ROM, if no ROM exists, - then access causes a bus error */ - if((m_options->read() & 0x02) && !space.debugger_access()) - set_bus_error((offset << 1) + 0xbffffc, 1, mem_mask); -} - -READ16_MEMBER(x68k_state::x68k_emptyram_r) -{ - /* this location is unused RAM, access here causes a bus error - Often a method for detecting amount of installed RAM, is to read or write at 1MB intervals, until a bus error occurs */ - if((m_options->read() & 0x02) && !space.debugger_access()) - set_bus_error((offset << 1), 0, mem_mask); - return 0xff; -} - -WRITE16_MEMBER(x68k_state::x68k_emptyram_w) -{ - /* this location is unused RAM, access here causes a bus error - Often a method for detecting amount of installed RAM, is to read or write at 1MB intervals, until a bus error occurs */ - if((m_options->read() & 0x02) && !space.debugger_access()) - set_bus_error((offset << 1), 1, mem_mask); -} - -READ16_MEMBER(x68k_state::x68k_exp_r) -{ - /* These are expansion devices, if not present, they cause a bus error */ - if((m_options->read() & 0x02) && !space.debugger_access()) - set_bus_error((offset << 1) + 0xeafa00, 0, mem_mask); - return 0xff; -} - -WRITE16_MEMBER(x68k_state::x68k_exp_w) -{ - /* These are expansion devices, if not present, they cause a bus error */ - if((m_options->read() & 0x02) && !space.debugger_access()) - set_bus_error((offset << 1) + 0xeafa00, 1, mem_mask); -} - -void x68k_state::dma_irq(int channel) -{ - m_current_vector[3] = m_hd63450->get_vector(channel); - m_current_irq_line = 3; - logerror("DMA#%i: DMA End (vector 0x%02x)\n",channel,m_current_vector[3]); - m_maincpu->set_input_line_and_vector(3,ASSERT_LINE,m_current_vector[3]); -} - -WRITE8_MEMBER(x68k_state::dma_end) -{ - if(data != 0) - { - dma_irq(offset); - } - if(offset == 0) - { - m_fdc_tc->adjust(attotime::from_usec(1), 0, attotime::never); - } -} - -WRITE8_MEMBER(x68k_state::dma_error) -{ - if(data != 0) - { - m_current_vector[3] = m_hd63450->get_error_vector(offset); - m_current_irq_line = 3; - logerror("DMA#%i: DMA Error (vector 0x%02x)\n",offset,m_current_vector[3]); - m_maincpu->set_input_line_and_vector(3,ASSERT_LINE,m_current_vector[3]); - } -} - -WRITE_LINE_MEMBER(x68k_state::x68k_fm_irq) -{ - if(state == CLEAR_LINE) - { - m_mfpdev->i3_w(1); - } - else - { - m_mfpdev->i3_w(0); - } -} - -WRITE8_MEMBER(x68k_state::x68030_adpcm_w) -{ - switch(offset) - { - case 0x00: - m_okim6258->okim6258_ctrl_w(space,0,data); - break; - case 0x01: - m_okim6258->okim6258_data_w(space,0,data); - break; - } -} - -WRITE_LINE_MEMBER(x68k_state::mfp_irq_callback) -{ - if(m_mfp_prev == CLEAR_LINE && state == CLEAR_LINE) // eliminate unnecessary calls to set the IRQ line for speed reasons - return; - if(state != CLEAR_LINE) - state = HOLD_LINE; // to get around erroneous spurious interrupt -// if((m_ioc.irqstatus & 0xc0) != 0) // if the FDC is busy, then we don't want to miss that IRQ -// return; - m_maincpu->set_input_line(6, state); - m_current_vector[6] = 0; - m_mfp_prev = state; -} - -IRQ_CALLBACK_MEMBER(x68k_state::x68k_int_ack) -{ - if(irqline == 6) // MFP - { - if(m_current_vector[6] != 0x4b && m_current_vector[6] != 0x4c) - m_current_vector[6] = m_mfpdev->get_vector(); - else - m_maincpu->set_input_line_and_vector(irqline,CLEAR_LINE,m_current_vector[irqline]); - logerror("SYS: IRQ acknowledged (vector=0x%02x, line = %i)\n",m_current_vector[6],irqline); - return m_current_vector[6]; - } - - m_maincpu->set_input_line_and_vector(irqline,CLEAR_LINE,m_current_vector[irqline]); - if(irqline == 1) // IOSC - { - m_ioc.irqstatus &= ~0xf0; - } - if(irqline == 5) // SCC - { - m_mouse.irqactive = 0; - } - - logerror("SYS: IRQ acknowledged (vector=0x%02x, line = %i)\n",m_current_vector[irqline],irqline); - return m_current_vector[irqline]; -} - -WRITE_LINE_MEMBER(x68k_state::x68k_scsi_irq) -{ - // TODO : Internal SCSI IRQ vector 0x6c, External SCSI IRQ vector 0xf6, IRQs go through the IOSC (IRQ line 1) - if(state != 0) - { - m_current_vector[1] = 0x6c; - m_current_irq_line = 1; - m_maincpu->set_input_line_and_vector(1,ASSERT_LINE,m_current_vector[1]); - } -} - -WRITE_LINE_MEMBER(x68k_state::x68k_scsi_drq) -{ - // TODO -} - -static ADDRESS_MAP_START(x68k_map, AS_PROGRAM, 16, x68k_state ) - AM_RANGE(0x000000, 0xbffffb) AM_READWRITE(x68k_emptyram_r, x68k_emptyram_w) - AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE(x68k_rom0_r, x68k_rom0_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(x68k_gvram_r, x68k_gvram_w) - AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE(x68k_tvram_r, x68k_tvram_w) - AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE(x68k_crtc_r, x68k_crtc_w) - AM_RANGE(0xe82000, 0xe821ff) AM_DEVREADWRITE("gfxpalette", palette_device, read, write) AM_SHARE("gfxpalette") - AM_RANGE(0xe82200, 0xe823ff) AM_DEVREADWRITE("pcgpalette", palette_device, read, write) AM_SHARE("pcgpalette") - AM_RANGE(0xe82400, 0xe83fff) AM_READWRITE(x68k_vid_r, x68k_vid_w) - AM_RANGE(0xe84000, 0xe85fff) AM_DEVREADWRITE("hd63450", hd63450_device, read, write) - AM_RANGE(0xe86000, 0xe87fff) AM_READWRITE(x68k_areaset_r, x68k_areaset_w) - AM_RANGE(0xe88000, 0xe89fff) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff) - AM_RANGE(0xe8a000, 0xe8bfff) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff) -// AM_RANGE(0xe8c000, 0xe8dfff) AM_READWRITE(x68k_printer_r, x68k_printer_w) - AM_RANGE(0xe8e000, 0xe8ffff) AM_READWRITE(x68k_sysport_r, x68k_sysport_w) - AM_RANGE(0xe90000, 0xe91fff) AM_DEVREADWRITE8("ym2151", ym2151_device, read, write, 0x00ff) - AM_RANGE(0xe92000, 0xe92001) AM_DEVREADWRITE8("okim6258", okim6258_device, okim6258_status_r, okim6258_ctrl_w, 0x00ff) - AM_RANGE(0xe92002, 0xe92003) AM_DEVREADWRITE8("okim6258", okim6258_device, okim6258_status_r, okim6258_data_w, 0x00ff) - AM_RANGE(0xe94000, 0xe94003) AM_DEVICE8("upd72065", upd72065_device, map, 0x00ff) - AM_RANGE(0xe94004, 0xe94007) AM_READWRITE(x68k_fdc_r, x68k_fdc_w) - AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE("x68k_hdc", x68k_hdc_image_device, hdc_r, hdc_w) - AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE(x68k_scc_r, x68k_scc_w) - AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE(x68k_ppi_r, x68k_ppi_w) - AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE(x68k_ioc_r, x68k_ioc_w) - AM_RANGE(0xe9e000, 0xe9e3ff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // FPU (Optional) - AM_RANGE(0xea0000, 0xea1fff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // external SCSI ROM and controller - AM_RANGE(0xeafa00, 0xeafa1f) AM_READWRITE(x68k_exp_r, x68k_exp_w) - AM_RANGE(0xeafa80, 0xeafa89) AM_READWRITE(x68k_areaset_r, x68k_enh_areaset_w) - AM_RANGE(0xeb0000, 0xeb7fff) AM_READWRITE(x68k_spritereg_r, x68k_spritereg_w) - AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE(x68k_spriteram_r, x68k_spriteram_w) - AM_RANGE(0xece000, 0xece3ff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // User I/O - AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE(x68k_sram_r, x68k_sram_w) - AM_RANGE(0xed4000, 0xefffff) AM_NOP - AM_RANGE(0xf00000, 0xfbffff) AM_ROM - AM_RANGE(0xfc0000, 0xfdffff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // internal SCSI ROM - AM_RANGE(0xfe0000, 0xffffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(x68kxvi_map, AS_PROGRAM, 16, x68k_state ) - AM_RANGE(0x000000, 0xbffffb) AM_READWRITE(x68k_emptyram_r, x68k_emptyram_w) - AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE(x68k_rom0_r, x68k_rom0_w) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(x68k_gvram_r, x68k_gvram_w) - AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE(x68k_tvram_r, x68k_tvram_w) - AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE(x68k_crtc_r, x68k_crtc_w) - AM_RANGE(0xe82000, 0xe821ff) AM_DEVREADWRITE("gfxpalette", palette_device, read, write) AM_SHARE("gfxpalette") - AM_RANGE(0xe82200, 0xe823ff) AM_DEVREADWRITE("pcgpalette", palette_device, read, write) AM_SHARE("pcgpalette") - AM_RANGE(0xe82400, 0xe83fff) AM_READWRITE(x68k_vid_r, x68k_vid_w) - AM_RANGE(0xe84000, 0xe85fff) AM_DEVREADWRITE("hd63450", hd63450_device, read, write) - AM_RANGE(0xe86000, 0xe87fff) AM_READWRITE(x68k_areaset_r, x68k_areaset_w) - AM_RANGE(0xe88000, 0xe89fff) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff) - AM_RANGE(0xe8a000, 0xe8bfff) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff) -// AM_RANGE(0xe8c000, 0xe8dfff) AM_READWRITE(x68k_printer_r, x68k_printer_w) - AM_RANGE(0xe8e000, 0xe8ffff) AM_READWRITE(x68k_sysport_r, x68k_sysport_w) - AM_RANGE(0xe90000, 0xe91fff) AM_DEVREADWRITE8("ym2151", ym2151_device, read, write, 0x00ff) - AM_RANGE(0xe92000, 0xe92001) AM_DEVREADWRITE8("okim6258", okim6258_device, okim6258_status_r, okim6258_ctrl_w, 0x00ff) - AM_RANGE(0xe92002, 0xe92003) AM_DEVREADWRITE8("okim6258", okim6258_device, okim6258_status_r, okim6258_data_w, 0x00ff) - AM_RANGE(0xe94000, 0xe94003) AM_DEVICE8("upd72065", upd72065_device, map, 0x00ff) - AM_RANGE(0xe94004, 0xe94007) AM_READWRITE(x68k_fdc_r, x68k_fdc_w) -// AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE("x68k_hdc", x68k_hdc_image_device, hdc_r, hdc_w) - AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff) - AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE(x68k_scc_r, x68k_scc_w) - AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE(x68k_ppi_r, x68k_ppi_w) - AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE(x68k_ioc_r, x68k_ioc_w) - AM_RANGE(0xe9e000, 0xe9e3ff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // FPU (Optional) - AM_RANGE(0xea0000, 0xea1fff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // external SCSI ROM and controller - AM_RANGE(0xeafa00, 0xeafa1f) AM_READWRITE(x68k_exp_r, x68k_exp_w) - AM_RANGE(0xeafa80, 0xeafa89) AM_READWRITE(x68k_areaset_r, x68k_enh_areaset_w) - AM_RANGE(0xeb0000, 0xeb7fff) AM_READWRITE(x68k_spritereg_r, x68k_spritereg_w) - AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE(x68k_spriteram_r, x68k_spriteram_w) - AM_RANGE(0xece000, 0xece3ff) AM_READWRITE(x68k_exp_r, x68k_exp_w) // User I/O - AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE(x68k_sram_r, x68k_sram_w) - AM_RANGE(0xed4000, 0xefffff) AM_NOP - AM_RANGE(0xf00000, 0xfbffff) AM_ROM - AM_RANGE(0xfc0000, 0xfdffff) AM_ROM // internal SCSI ROM - AM_RANGE(0xfe0000, 0xffffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(x68030_map, AS_PROGRAM, 32, x68k_state ) - ADDRESS_MAP_GLOBAL_MASK(0x00ffffff) // Still only has 24-bit address space - AM_RANGE(0x000000, 0xbffffb) AM_READWRITE16(x68k_emptyram_r, x68k_emptyram_w,0xffffffff) - AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE16(x68k_rom0_r, x68k_rom0_w,0xffffffff) - AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16(x68k_gvram_r, x68k_gvram_w, 0xffffffff) - AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE16(x68k_tvram_r, x68k_tvram_w, 0xffffffff) - AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE16(x68k_crtc_r, x68k_crtc_w,0xffffffff) - AM_RANGE(0xe82000, 0xe821ff) AM_DEVREADWRITE("gfxpalette", palette_device, read, write) AM_SHARE("gfxpalette") - AM_RANGE(0xe82200, 0xe823ff) AM_DEVREADWRITE("pcgpalette", palette_device, read, write) AM_SHARE("pcgpalette") - AM_RANGE(0xe82400, 0xe83fff) AM_READWRITE16(x68k_vid_r, x68k_vid_w,0xffffffff) - AM_RANGE(0xe84000, 0xe85fff) AM_DEVREADWRITE16("hd63450", hd63450_device, read, write, 0xffffffff) - AM_RANGE(0xe86000, 0xe87fff) AM_READWRITE16(x68k_areaset_r, x68k_areaset_w,0xffffffff) - AM_RANGE(0xe88000, 0xe89fff) AM_DEVREADWRITE8(MC68901_TAG, mc68901_device, read, write, 0x00ff00ff) - AM_RANGE(0xe8a000, 0xe8bfff) AM_DEVREADWRITE8(RP5C15_TAG, rp5c15_device, read, write, 0x00ff00ff) -// AM_RANGE(0xe8c000, 0xe8dfff) AM_READWRITE(x68k_printer_r, x68k_printer_w) - AM_RANGE(0xe8e000, 0xe8ffff) AM_READWRITE16(x68k_sysport_r, x68k_sysport_w,0xffffffff) - AM_RANGE(0xe90000, 0xe91fff) AM_DEVREADWRITE8("ym2151", ym2151_device, read, write, 0x00ff00ff) - AM_RANGE(0xe92000, 0xe92003) AM_DEVREAD8("okim6258", okim6258_device, okim6258_status_r, 0x00ff00ff) AM_WRITE8(x68030_adpcm_w, 0x00ff00ff) - AM_RANGE(0xe94000, 0xe94003) AM_DEVICE8("upd72065", upd72065_device, map, 0x00ff00ff) - AM_RANGE(0xe94004, 0xe94007) AM_READWRITE16(x68k_fdc_r, x68k_fdc_w,0xffffffff) -// AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE16("x68k_hdc", x68k_hdc_image_device, hdc_r, hdc_w, 0xffffffff) - AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff00ff) - AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE16(x68k_scc_r, x68k_scc_w,0xffffffff) - AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE16(x68k_ppi_r, x68k_ppi_w,0xffffffff) - AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE16(x68k_ioc_r, x68k_ioc_w,0xffffffff) - AM_RANGE(0xe9e000, 0xe9e3ff) AM_READWRITE16(x68k_exp_r, x68k_exp_w,0xffffffff) // FPU (Optional) - AM_RANGE(0xea0000, 0xea1fff) AM_NOP//AM_READWRITE16(x68k_exp_r, x68k_exp_w,0xffffffff) // external SCSI ROM and controller - AM_RANGE(0xeafa00, 0xeafa1f) AM_READWRITE16(x68k_exp_r, x68k_exp_w,0xffffffff) - AM_RANGE(0xeafa80, 0xeafa8b) AM_READWRITE16(x68k_areaset_r, x68k_enh_areaset_w,0xffffffff) - AM_RANGE(0xeb0000, 0xeb7fff) AM_READWRITE16(x68k_spritereg_r, x68k_spritereg_w,0xffffffff) - AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE16(x68k_spriteram_r, x68k_spriteram_w,0xffffffff) - AM_RANGE(0xece000, 0xece3ff) AM_READWRITE16(x68k_exp_r, x68k_exp_w,0xffffffff) // User I/O - AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE16(x68k_sram_r, x68k_sram_w, 0xffffffff) - AM_RANGE(0xed4000, 0xefffff) AM_NOP - AM_RANGE(0xf00000, 0xfbffff) AM_ROM - AM_RANGE(0xfc0000, 0xfdffff) AM_ROM // internal SCSI ROM - AM_RANGE(0xfe0000, 0xffffff) AM_ROM -ADDRESS_MAP_END - -static INPUT_PORTS_START( x68000 ) - PORT_START("ctrltype") - PORT_CONFNAME(0x0f, 0x00, "Joystick Port 1") - PORT_CONFSETTING(0x00, "Standard 2-button MSX/FM-Towns joystick") - PORT_CONFSETTING(0x01, "3-button Megadrive gamepad") - PORT_CONFSETTING(0x02, "6-button Megadrive gamepad") - PORT_CONFSETTING(0x03, "XPD-1LR dual D-pad gamepad") - PORT_CONFNAME(0xf0, 0x00, "Joystick Port 2") - PORT_CONFSETTING(0x00, "Standard 2-button MSX/FM-Towns joystick") - PORT_CONFSETTING(0x10, "3-button Megadrive gamepad") - PORT_CONFSETTING(0x20, "6-button Megadrive gamepad") - PORT_CONFSETTING(0x30, "XPD-1LR dual D-pad gamepad") -// TODO: Sharp Cyber Stick (CZ-8NJ2) support - - PORT_START( "joy1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x00) - - PORT_START( "joy2" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x00) - - PORT_START("options") - PORT_CONFNAME( 0x02, 0x02, "Enable fake bus errors") - PORT_CONFSETTING( 0x00, DEF_STR( Off )) - PORT_CONFSETTING( 0x02, DEF_STR( On )) - PORT_CONFNAME( 0x04, 0x04, "Enable partial updates on each HSync") - PORT_CONFSETTING( 0x00, DEF_STR( Off )) - PORT_CONFSETTING( 0x04, DEF_STR( On )) - - PORT_START("mouse1") // mouse buttons - PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) - PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) - - PORT_START("mouse2") // X-axis - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START("mouse3") // Y-axis - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) - - // 3-button Megadrive gamepad - PORT_START("md3b") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 1 Up") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("MD Pad 1 Down") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("MD Pad 1 Left") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("MD Pad 1 Right") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 B Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 C Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - - PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 A Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Start Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x01) - - PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 2 Up") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("MD Pad 2 Down") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("MD Pad 2 Left") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("MD Pad 2 Right") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 B Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 C Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - - PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x10000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 A Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Start Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x10) - - // 6-button Megadrive gamepad - PORT_START("md6b") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 1 Up") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("MD Pad 1 Down") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("MD Pad 1 Left") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("MD Pad 1 Right") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 B Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 C Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - - PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 A Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Start Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - - PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 2 Up") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("MD Pad 2 Down") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("MD Pad 2 Left") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("MD Pad 2 Right") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 B Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 C Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - - PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x10000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 A Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Start Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - - // extra inputs - PORT_START("md6b_extra") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Z Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Y Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 X Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME("MD Pad 1 Mode Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x02) - - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Z Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Y Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 X Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Mode Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x20) - - // Dempa/Micomsoft XPD-1LR (dual D-pad gamepad sold with Libble Rabble) - PORT_START("xpd1lr") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_NAME("XPD Pad 1 Left/Up") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_NAME("XPD Pad 1 Left/Down") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_NAME("XPD Pad 1 Left/Left") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_NAME("XPD Pad 1 Left/Right") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("XPD Pad 1 B Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("XPD Pad 1 A Button") PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - - PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_NAME("XPD Pad 1 Right/Up") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_NAME("XPD Pad 1 Right/Down") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_NAME("XPD Pad 1 Right/Left") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_NAME("XPD Pad 1 Right/Right") PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0x0f, EQUALS, 0x03) - - PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_NAME("XPD Pad 2 Left/Up") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_NAME("XPD Pad 2 Left/Down") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_NAME("XPD Pad 2 Left/Left") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_NAME("XPD Pad 2 Left/Right") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("XPD Pad 2 B Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("XPD Pad 2 A Button") PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - - PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_NAME("XPD Pad 2 Right/Up") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_NAME("XPD Pad 2 Right/Down") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_NAME("XPD Pad 2 Right/Left") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_NAME("XPD Pad 2 Right/Right") PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x10000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("ctrltype", 0xf0, EQUALS, 0x30) - -INPUT_PORTS_END - -void x68k_state::floppy_load_unload(bool load, floppy_image_device *dev) -{ - dev->mon_w(m_fdc.motor && !load); - if(m_ioc.irqstatus & 0x02) - { - m_current_vector[1] = 0x61; - m_ioc.irqstatus |= 0x40; - m_current_irq_line = 1; - m_maincpu->set_input_line_and_vector(1,ASSERT_LINE,m_current_vector[1]); // Disk insert/eject interrupt - logerror("IOC: Disk image inserted\n"); - } -} - -int x68k_state::floppy_load(floppy_image_device *dev) -{ - floppy_load_unload(true, dev); - return IMAGE_INIT_PASS; -} - -void x68k_state::floppy_unload(floppy_image_device *dev) -{ - floppy_load_unload(false, dev); -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_net_irq) -{ - m_current_vector[2] = 0xf9; - m_current_irq_line = 2; - m_maincpu->set_input_line_and_vector(2,ASSERT_LINE,m_current_vector[2]); -} - -WRITE_LINE_MEMBER(x68k_state::x68k_irq2_line) -{ - if(state==ASSERT_LINE) - { - m_net_timer->adjust(attotime::from_usec(16)); - } - else - m_maincpu->set_input_line_and_vector(2,CLEAR_LINE,m_current_vector[2]); - logerror("EXP: IRQ2 set to %i\n",state); - -} - -static SLOT_INTERFACE_START(x68000_exp_cards) - SLOT_INTERFACE("neptunex",X68K_NEPTUNEX) // Neptune-X ethernet adapter (ISA NE2000 bridge) - SLOT_INTERFACE("cz6bs1",X68K_SCSIEXT) // Sharp CZ-6BS1 SCSI-1 controller -SLOT_INTERFACE_END - -MACHINE_RESET_MEMBER(x68k_state,x68000) -{ - /* The last half of the IPLROM is mapped to 0x000000 on reset only - Just copying the inital stack pointer and program counter should - more or less do the same job */ - - int drive; - UINT8* romdata = memregion("user2")->base(); - attotime irq_time; - - memset(m_ram->pointer(),0,m_ram->size()); - memcpy(m_ram->pointer(),romdata,8); - - // initialise CRTC, set registers to defaults for the standard text mode (768x512) - m_crtc.reg[0] = 137; // Horizontal total (in characters) - m_crtc.reg[1] = 14; // Horizontal sync end - m_crtc.reg[2] = 28; // Horizontal start - m_crtc.reg[3] = 124; // Horizontal end - m_crtc.reg[4] = 567; // Vertical total - m_crtc.reg[5] = 5; // Vertical sync end - m_crtc.reg[6] = 40; // Vertical start - m_crtc.reg[7] = 552; // Vertical end - m_crtc.reg[8] = 27; // Horizontal adjust - - m_scanline = machine().first_screen()->vpos();// = m_crtc.reg[6]; // Vertical start - - // start VBlank timer - m_crtc.vblank = 1; - irq_time = m_screen->time_until_pos(m_crtc.reg[6],2); - m_vblank_irq->adjust(irq_time); - - // start HBlank timer - m_scanline_timer->adjust(m_screen->scan_period(), 1); - - /// TODO: get callbacks to trigger these - m_mfpdev->i0_w(1); // alarm - m_mfpdev->i1_w(1); // expon - m_mfpdev->i2_w(0); // pow sw - m_mfpdev->i3_w(1); // fmirq - m_mfpdev->i4_w(1); // v-disp - m_mfpdev->i5_w(1); // unused (always set) - m_mfpdev->i6_w(1); // cirq - m_mfpdev->i7_w(1); // h-sync - - // reset output values - output_set_value("key_led_kana",1); - output_set_value("key_led_romaji",1); - output_set_value("key_led_code",1); - output_set_value("key_led_caps",1); - output_set_value("key_led_insert",1); - output_set_value("key_led_hiragana",1); - output_set_value("key_led_fullsize",1); - for(drive=0;drive<4;drive++) - { - output_set_indexed_value("eject_drv",drive,1); - output_set_indexed_value("ctrl_drv",drive,1); - output_set_indexed_value("access_drv",drive,1); - } - m_fdc.select_drive = 0; - - // reset CPU - m_maincpu->reset(); -} - -MACHINE_START_MEMBER(x68k_state,x68000) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - /* Install RAM handlers */ - m_spriteram = (UINT16*)(memregion("user1")->base()); - space.install_readwrite_bank(0x000000,m_ram->size()-1,0xffffffff,0,"bank1"); - membank("bank1")->set_base(m_ram->pointer()); - - // start mouse timer - m_mouse_timer->adjust(attotime::zero, 0, attotime::from_msec(1)); // a guess for now - m_mouse.inputtype = 0; - - // start LED timer - m_led_timer->adjust(attotime::zero, 0, attotime::from_msec(400)); - - for(int drive=0;drive<4;drive++) - { - char devname[16]; - sprintf(devname, "%d", drive); - floppy_image_device *floppy = m_upd72065->subdevice(devname)->get_device(); - m_fdc.floppy[drive] = floppy; - if(floppy) { - floppy->setup_load_cb(floppy_image_device::load_cb(FUNC(x68k_state::floppy_load), this)); - floppy->setup_unload_cb(floppy_image_device::unload_cb(FUNC(x68k_state::floppy_unload), this)); - } - } - m_fdc.motor = 0; -} - -DRIVER_INIT_MEMBER(x68k_state,x68000) -{ - unsigned char* rom = memregion("maincpu")->base(); - unsigned char* user2 = memregion("user2")->base(); - - machine().device("nvram")->set_base(&m_nvram[0], m_nvram.size()*sizeof(m_nvram[0])); - -#ifdef USE_PREDEFINED_SRAM - { - unsigned char* ramptr = memregion("user3")->base(); - memcpy(m_sram,ramptr,0x4000); - } -#endif - - // copy last half of BIOS to a user region, to use for inital startup - memcpy(user2,(rom+0xff0000),0x10000); - - m_scanline_timer = timer_alloc(TIMER_X68K_HSYNC); - m_raster_irq = timer_alloc(TIMER_X68K_CRTC_RASTER_IRQ); - m_vblank_irq = timer_alloc(TIMER_X68K_CRTC_VBLANK_IRQ); - m_mouse_timer = timer_alloc(TIMER_X68K_SCC_ACK); - m_led_timer = timer_alloc(TIMER_X68K_LED); - m_net_timer = timer_alloc(TIMER_X68K_NET_IRQ); - m_fdc_tc = timer_alloc(TIMER_X68K_FDC_TC); - m_adpcm_timer = timer_alloc(TIMER_X68K_ADPCM); - m_bus_error_timer = timer_alloc(TIMER_X68K_BUS_ERROR); - - // Initialise timers for 6-button MD controllers - md_6button_init(); - - m_sysport.cputype = 0xff; // 68000, 10MHz - m_is_32bit = false; - - save_item(NAME(m_tvram)); - save_item(NAME(m_gvram)); - save_item(NAME(m_spritereg)); -} - -DRIVER_INIT_MEMBER(x68k_state,x68kxvi) -{ - DRIVER_INIT_CALL( x68000 ); - m_sysport.cputype = 0xfe; // 68000, 16MHz - m_is_32bit = false; -} - -DRIVER_INIT_MEMBER(x68k_state,x68030) -{ - DRIVER_INIT_CALL( x68000 ); - m_sysport.cputype = 0xdc; // 68030, 25MHz - m_is_32bit = true; -} - -FLOPPY_FORMATS_MEMBER( x68k_state::floppy_formats ) - FLOPPY_XDF_FORMAT, - FLOPPY_DIM_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( x68k_floppies ) - SLOT_INTERFACE( "525hd", FLOPPY_525_HD ) -SLOT_INTERFACE_END - -static SLOT_INTERFACE_START(keyboard) - SLOT_INTERFACE("x68k", X68K_KEYBOARD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( x68000, x68k_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 10000000) /* 10 MHz */ - MCFG_CPU_PROGRAM_MAP(x68k_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(x68k_state,x68k_int_ack) - - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - MCFG_MACHINE_START_OVERRIDE(x68k_state, x68000 ) - MCFG_MACHINE_RESET_OVERRIDE(x68k_state, x68000 ) - - /* device hardware */ - MCFG_DEVICE_ADD(MC68901_TAG, MC68901, 4000000) - MCFG_MC68901_TIMER_CLOCK(4000000) - MCFG_MC68901_RX_CLOCK(0) - MCFG_MC68901_TX_CLOCK(0) - MCFG_MC68901_OUT_IRQ_CB(WRITELINE(x68k_state, mfp_irq_callback)) - MCFG_MC68901_OUT_TBO_CB(DEVWRITELINE(MC68901_TAG, mc68901_device, clock_w)) - MCFG_MC68901_OUT_SO_CB(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD("keyboard", keyboard, "x68k") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(MC68901_TAG, mc68901_device, write_rx)) - - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(x68k_state, ppi_port_a_r)) - MCFG_I8255_IN_PORTB_CB(READ8(x68k_state, ppi_port_b_r)) - MCFG_I8255_IN_PORTC_CB(READ8(x68k_state, ppi_port_c_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(x68k_state, ppi_port_c_w)) - - MCFG_DEVICE_ADD("hd63450", HD63450, 0) - MCFG_HD63450_CPU("maincpu") // CPU - 68000 - MCFG_HD63450_CLOCKS(attotime::from_usec(2), attotime::from_nsec(450), attotime::from_usec(4), attotime::from_hz(15625/2)) - MCFG_HD63450_BURST_CLOCKS(attotime::from_usec(2), attotime::from_nsec(450), attotime::from_nsec(50), attotime::from_nsec(50)) - MCFG_HD63450_DMA_END_CB(WRITE8(x68k_state, dma_end)) - MCFG_HD63450_DMA_ERROR_CB(WRITE8(x68k_state, dma_error)) - MCFG_HD63450_DMA_READ_0_CB(DEVREAD8("upd72065", upd72065_device, mdma_r)) - MCFG_HD63450_DMA_WRITE_0_CB(DEVWRITE8("upd72065", upd72065_device, mdma_w)) - - MCFG_DEVICE_ADD("scc", SCC8530, 5000000) - - MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL_32_768kHz) - MCFG_RP5C15_OUT_ALARM_CB(DEVWRITELINE(MC68901_TAG, mc68901_device, i0_w)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(55.45) - MCFG_SCREEN_SIZE(1096, 568) // inital setting - MCFG_SCREEN_VISIBLE_AREA(0, 767, 0, 511) - MCFG_SCREEN_UPDATE_DRIVER(x68k_state, screen_update_x68000) - - MCFG_GFXDECODE_ADD("gfxdecode", "pcgpalette", empty) - - MCFG_PALETTE_ADD("gfxpalette", 256) - MCFG_PALETTE_FORMAT_CLASS(2, x68k_state, GGGGGRRRRRBBBBBI) - MCFG_PALETTE_ADD("pcgpalette", 256) - MCFG_PALETTE_FORMAT_CLASS(2, x68k_state, GGGGGRRRRRBBBBBI) - - MCFG_VIDEO_START_OVERRIDE(x68k_state, x68000 ) - - MCFG_DEFAULT_LAYOUT( layout_x68000 ) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_YM2151_ADD("ym2151", 4000000) - MCFG_YM2151_IRQ_HANDLER(WRITELINE(x68k_state,x68k_fm_irq)) - MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(x68k_state,x68k_ct_w)) // CT1, CT2 from YM2151 port 0x1b - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) - - MCFG_OKIM6258_ADD("okim6258", 4000000) - MCFG_OKIM6258_DIVIDER(FOSC_DIV_BY_512) - MCFG_OKIM6258_ADPCM_TYPE(TYPE_4BITS) - MCFG_OKIM6258_OUT_BITS(OUTPUT_10BITS) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) - - MCFG_UPD72065_ADD("upd72065", true, false) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(x68k_state, fdc_irq)) - MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("hd63450", hd63450_device, drq0_w)) - MCFG_FLOPPY_DRIVE_ADD("upd72065:0", x68k_floppies, "525hd", x68k_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd72065:1", x68k_floppies, "525hd", x68k_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd72065:2", x68k_floppies, "525hd", x68k_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd72065:3", x68k_floppies, "525hd", x68k_state::floppy_formats) - - MCFG_SOFTWARE_LIST_ADD("flop_list","x68k_flop") - - MCFG_DEVICE_ADD("exp", X68K_EXPANSION_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(x68000_exp_cards, NULL, false) - MCFG_X68K_EXPANSION_SLOT_OUT_IRQ2_CB(WRITELINE(x68k_state, x68k_irq2_line)) - MCFG_X68K_EXPANSION_SLOT_OUT_IRQ4_CB(INPUTLINE("maincpu", M68K_IRQ_4)) - MCFG_X68K_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("4M") - MCFG_RAM_EXTRA_OPTIONS("1M,2M,3M,5M,6M,7M,8M,9M,10M,11M,12M") - - MCFG_NVRAM_ADD_0FILL("nvram") - - MCFG_X68KHDC_ADD( "x68k_hdc" ) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( x68ksupr, x68000 ) - MCFG_DEVICE_REMOVE("x68k_hdc") - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(x68kxvi_map) - - MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "harddisk", SCSIHD, SCSI_ID_0) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE2, "harddisk", SCSIHD, SCSI_ID_1) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE3, "harddisk", SCSIHD, SCSI_ID_2) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE4, "harddisk", SCSIHD, SCSI_ID_3) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE5, "harddisk", SCSIHD, SCSI_ID_4) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE6, "harddisk", SCSIHD, SCSI_ID_5) - MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE7, "harddisk", SCSIHD, SCSI_ID_6) - - MCFG_DEVICE_ADD("mb89352", MB89352A, 0) - MCFG_LEGACY_SCSI_PORT("scsi") - MCFG_MB89352A_IRQ_CB(WRITELINE(x68k_state, x68k_scsi_irq)) - MCFG_MB89352A_DRQ_CB(WRITELINE(x68k_state, x68k_scsi_drq)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( x68kxvi, x68ksupr ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(16000000) /* 16 MHz */ -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( x68030, x68ksupr ) - MCFG_CPU_REPLACE("maincpu", M68030, 25000000) /* 25 MHz 68EC030 */ - MCFG_CPU_PROGRAM_MAP(x68030_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(x68k_state,x68k_int_ack) -MACHINE_CONFIG_END - -ROM_START( x68000 ) - ROM_REGION16_BE(0x1000000, "maincpu", 0) // 16MB address space - ROM_DEFAULT_BIOS("ipl10") - ROM_LOAD( "cgrom.dat", 0xf00000, 0xc0000, CRC(9f3195f1) SHA1(8d72c5b4d63bb14c5dbdac495244d659aa1498b6) ) - ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0 (87/05/07)") - ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1 (91/01/11)") - ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2 (91/10/24)") - ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") - ROMX_LOAD( "iplrom30.dat", 0xfe0000, 0x020000, CRC(e8f8fdad) SHA1(239e9124568c862c31d9ec0605e32373ea74b86a), ROM_BIOS(4) ) - ROM_REGION(0x8000, "user1",0) // For Background/Sprite decoding - ROM_FILL(0x0000,0x8000,0x00) - ROM_REGION(0x20000, "user2", 0) - ROM_FILL(0x000,0x20000,0x00) -ROM_END - -ROM_START( x68ksupr ) - ROM_REGION16_BE(0x1000000, "maincpu", 0) // 16MB address space - ROM_DEFAULT_BIOS("ipl11") - ROM_LOAD( "cgrom.dat", 0xf00000, 0xc0000, CRC(9f3195f1) SHA1(8d72c5b4d63bb14c5dbdac495244d659aa1498b6) ) - ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0 (87/05/07)") - ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1 (91/01/11)") - ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2 (91/10/24)") - ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") - ROMX_LOAD( "iplrom30.dat", 0xfe0000, 0x020000, CRC(e8f8fdad) SHA1(239e9124568c862c31d9ec0605e32373ea74b86a), ROM_BIOS(4) ) - ROM_LOAD("scsiinsu.bin",0xfc0000, 0x002000, CRC(f65a3e24) SHA1(15a17798839a3f7f361119205aebc301c2df5967) ) // Dumped from an X68000 Super HD -// ROM_LOAD("scsiexrom.dat",0xea0000, 0x002000, NO_DUMP ) - ROM_REGION(0x8000, "user1",0) // For Background/Sprite decoding - ROM_FILL(0x0000,0x8000,0x00) - ROM_REGION(0x20000, "user2", 0) - ROM_FILL(0x000,0x20000,0x00) -ROM_END - -ROM_START( x68kxvi ) - ROM_REGION16_BE(0x1000000, "maincpu", 0) // 16MB address space - ROM_DEFAULT_BIOS("ipl11") - ROM_LOAD( "cgrom.dat", 0xf00000, 0xc0000, CRC(9f3195f1) SHA1(8d72c5b4d63bb14c5dbdac495244d659aa1498b6) ) - ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0 (87/05/07)") - ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1 (91/01/11)") - ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2 (91/10/24)") - ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") - ROMX_LOAD( "iplrom30.dat", 0xfe0000, 0x020000, CRC(e8f8fdad) SHA1(239e9124568c862c31d9ec0605e32373ea74b86a), ROM_BIOS(4) ) - ROM_LOAD("scsiinco.bin",0xfc0000, 0x002000, CRC(2485e14d) SHA1(101a9bba8ea4bb90965c144bcfd7182f889ab958) ) // Dumped from an X68000 XVI Compact -// ROM_LOAD("scsiexrom.dat",0xea0000, 0x002000, NO_DUMP ) - ROM_REGION(0x8000, "user1",0) // For Background/Sprite decoding - ROM_FILL(0x0000,0x8000,0x00) - ROM_REGION(0x20000, "user2", 0) - ROM_FILL(0x000,0x20000,0x00) -ROM_END - -ROM_START( x68030 ) - ROM_REGION16_BE(0x1000000, "maincpu", 0) // 16MB address space - ROM_DEFAULT_BIOS("ipl13") - ROM_LOAD( "cgrom.dat", 0xf00000, 0xc0000, CRC(9f3195f1) SHA1(8d72c5b4d63bb14c5dbdac495244d659aa1498b6) ) - ROM_SYSTEM_BIOS(0, "ipl10", "IPL-ROM V1.0 (87/05/07)") - ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "ipl11", "IPL-ROM V1.1 (91/01/11)") - ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "ipl12", "IPL-ROM V1.2 (91/10/24)") - ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "ipl13", "IPL-ROM V1.3 (92/11/27)") - ROMX_LOAD( "iplrom30.dat", 0xfe0000, 0x020000, CRC(e8f8fdad) SHA1(239e9124568c862c31d9ec0605e32373ea74b86a), ROM_BIOS(4) ) - ROM_LOAD("scsiinrom.dat",0xfc0000, 0x002000, CRC(1c6c889e) SHA1(3f063d4231cdf53da6adc4db96533725e260076a) BAD_DUMP ) -// ROM_LOAD("scsiexrom.dat",0xea0000, 0x002000, NO_DUMP ) - ROM_REGION(0x8000, "user1",0) // For Background/Sprite decoding - ROM_FILL(0x0000,0x8000,0x00) - ROM_REGION(0x20000, "user2", 0) - ROM_FILL(0x000,0x20000,0x00) -ROM_END - - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1987, x68000, 0, 0, x68000, x68000, x68k_state, x68000, "Sharp", "X68000", MACHINE_IMPERFECT_GRAPHICS ) -COMP( 1990, x68ksupr,x68000, 0, x68ksupr,x68000, x68k_state,x68000, "Sharp", "X68000 Super", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) -COMP( 1991, x68kxvi,x68000, 0, x68kxvi,x68000, x68k_state, x68kxvi,"Sharp", "X68000 XVI", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) -COMP( 1993, x68030, x68000, 0, x68030, x68000, x68k_state, x68030, "Sharp", "X68030", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/xavix.c b/src/mess/drivers/xavix.c deleted file mode 100644 index 36f5efe2fa1..00000000000 --- a/src/mess/drivers/xavix.c +++ /dev/null @@ -1,179 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Skeleton driver for XaviX TV PNP console and childs (Let's! Play TV Classic) - - CPU is M6502 derivative, almost likely to be a G65816 - - TODO: - - understand how to map ROM at 0x800000-0x9fffff / 0xc00000 / 0xdfffff - banks (granted that we have the ROM for that, of course) - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/m6502/m6502.h" -//#include "sound/ay8910.h" -#include "cpu/g65816/g65816.h" - -#define MAIN_CLOCK XTAL_21_4772MHz - -class xavix_state : public driver_device -{ -public: - xavix_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - // devices - required_device m_maincpu; - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); -}; - -void xavix_state::video_start() -{ -} - -UINT32 xavix_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - return 0; -} - -static ADDRESS_MAP_START( xavix_map, AS_PROGRAM, 8, xavix_state ) - AM_RANGE(0x000000, 0x0001ff) AM_RAM - AM_RANGE(0x00f000, 0x00ffff) AM_ROM AM_REGION("bios", 0x00f000) - AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("bios", 0x000000) // wrong -ADDRESS_MAP_END - -static INPUT_PORTS_START( xavix ) - /* dummy active high structure */ - PORT_START("SYSA") - PORT_DIPNAME( 0x01, 0x00, "SYSA" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - - /* dummy active low structure */ - PORT_START("DSWA") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -/* correct, 4bpp gfxs */ -static const gfx_layout charlayout = -{ - 8,8, - RGN_FRAC(1,1), - 4, - { STEP4(0,1) }, - { 1*4,0*4,3*4,2*4,5*4,4*4,7*4,6*4 }, - { STEP8(0,4*8) }, - 8*8*4 -}; - -static GFXDECODE_START( xavix ) - GFXDECODE_ENTRY( "bios", 0, charlayout, 0, 1 ) -GFXDECODE_END - - -void xavix_state::machine_start() -{ -} - -void xavix_state::machine_reset() -{ -} - - -static MACHINE_CONFIG_START( xavix, xavix_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",G65816,MAIN_CLOCK/4) - MCFG_CPU_PROGRAM_MAP(xavix_map) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(xavix_state, screen_update) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", xavix) - - MCFG_PALETTE_ADD("palette", 16) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( taitons1 ) - ROM_REGION( 0x200000, "bios", ROMREGION_ERASE00 ) - ROM_LOAD( "taitonostalgia1.u3", 0x000000, 0x200000, CRC(25bd8c67) SHA1(a109cd2da6aa4596e3ca3abd1afce2d0001a473f) ) -ROM_END - -CONS( 2006, taitons1, 0, 0, xavix, xavix, driver_device, 0, "Bandai / SSD Company LTD / Taito", "Let's! TV Play Classic - Taito Nostalgia 1", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/xbox.c b/src/mess/drivers/xbox.c deleted file mode 100644 index b337b3a8a94..00000000000 --- a/src/mess/drivers/xbox.c +++ /dev/null @@ -1,254 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:? -/*************************************************************************** - - XBOX (c) 2001 Microsoft - - Skeleton driver - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/i386/i386.h" -#include "machine/lpci.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/idectrl.h" -#include "machine/idehd.h" -#include "machine/atapicdr.h" -#include "video/poly.h" -#include "bitmap.h" -#include "debug/debugcon.h" -#include "debug/debugcmd.h" -#include "debug/debugcpu.h" -#include "includes/chihiro.h" -#include "includes/xbox.h" - -#define CPU_DIV 64 - -class xbox_state : public xbox_base_state -{ -public: - xbox_state(const machine_config &mconfig, device_type type, const char *tag) : - xbox_base_state(mconfig, type, tag), - usbhack_index(-1), - usbhack_counter(0) - { } - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - - virtual void hack_eeprom(); - virtual void hack_usb(); - - struct chihiro_devices { - bus_master_ide_controller_device *ide; - } xbox_devs; - int usbhack_index; - int usbhack_counter; -}; - -void xbox_state::video_start() -{ -} - -static ADDRESS_MAP_START(xbox_map, AS_PROGRAM, 32, xbox_state) - AM_IMPORT_FROM(xbox_base_map) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(xbox_map_io, AS_IO, 32, xbox_state) - AM_IMPORT_FROM(xbox_base_map_io) -ADDRESS_MAP_END - -static INPUT_PORTS_START( xbox ) - /* dummy active high structure */ - PORT_START("SYSA") - PORT_DIPNAME( 0x01, 0x00, "SYSA" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - - /* dummy active low structure */ - PORT_START("DSWA") - PORT_DIPNAME( 0x01, 0x01, "DSWA" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - - -void xbox_state::hack_eeprom() -{ - // 8004e5da,4e5da=0xc3 - m_maincpu->space(0).write_byte(0x4e5da, 0xc3); // remove audio wait - // 8006e654,6e654=0 - m_maincpu->space(0).write_byte(0x6e654, 0); // disable boot animation -} - -/*static const struct { - const char *game_name; - struct { - UINT32 address; - UINT8 write_byte; - } modify[16]; -} hacks[] = { { "chihiro",{ { 0x6a79f, 0x01 },{ 0x6a7a0, 0x00 },{ 0x6b575, 0x00 },{ 0x6b576, 0x00 },{ 0x6b5af, 0x75 },{ 0x6b78a, 0x75 },{ 0x6b7ca, 0x00 },{ 0x6b7b8, 0x00 },{ 0x8f5b2, 0x75 },{ 0x79a9e, 0x74 },{ 0x79b80, 0x74 },{ 0x79b97, 0x74 },{ 0, 0 } } }, -{ "outr2",{ { 0x12e4cf, 0x01 },{ 0x12e4d0, 0x00 },{ 0x4793e, 0x01 },{ 0x4793f, 0x00 },{ 0x47aa3, 0x01 },{ 0x47aa4, 0x00 },{ 0x14f2b6, 0x84 },{ 0x14f2d1, 0x75 },{ 0x8732f, 0x7d },{ 0x87384, 0x7d },{ 0x87388, 0xeb },{ 0, 0 } } } };*/ - -void xbox_state::hack_usb() -{ - int p; - - if (usbhack_counter == 0) - p = 0; - else if (usbhack_counter == 1) // after game loaded - p = usbhack_index; - else - p = -1; - if (p >= 0) { - /*for (int a = 0; a < 16; a++) { - if (hacks[p].modify[a].address == 0) - break; - m_maincpu->space(0).write_byte(hacks[p].modify[a].address, hacks[p].modify[a].write_byte); - }*/ - } - usbhack_counter++; -} - -void xbox_state::machine_start() -{ - xbox_base_state::machine_start(); - xbox_devs.ide = machine().device("ide"); - usbhack_index = -1; - /*for (int a = 1; a < 2; a++) - if (strcmp(machine().basename(), hacks[a].game_name) == 0) { - usbhack_index = a; - break; - }*/ - usbhack_counter = 0; - // savestates - save_item(NAME(usbhack_counter)); -} - -void xbox_state::machine_reset() -{ - ata_mass_storage_device *devh; - atapi_cdrom_device *devc; - UINT16 *id; - - // set some neede parameters - devh = machine().device("ide:0:hdd"); - id = devh->identify_device_buffer(); - id[88] |= (1 << 2); // ultra dma mode 2 supported - id[128] |= 2; // bits 2-1=01 drive already unlocked - devc = machine().device("ide:1:cdrom"); - id = devc->identify_device_buffer(); - id[64] |= (1 << 1); - id[88] |= (1 << 2); // ultra dma mode 2 supported -} - -SLOT_INTERFACE_START(xbox_ata_devices) -SLOT_INTERFACE("hdd", IDE_HARDDISK) -SLOT_INTERFACE("cdrom", ATAPI_CDROM) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_DERIVED_CLASS(xbox, xbox_base, xbox_state) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_PROGRAM_MAP(xbox_map) - MCFG_CPU_IO_MAP(xbox_map_io) - - MCFG_DEVICE_MODIFY("ide:0") - MCFG_DEVICE_SLOT_INTERFACE(xbox_ata_devices, "hdd", true) - MCFG_DEVICE_MODIFY("ide:1") - MCFG_DEVICE_SLOT_INTERFACE(xbox_ata_devices, "cdrom", true) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Machine driver(s) - -***************************************************************************/ - -ROM_START( xbox ) - ROM_REGION( 0x400, "mcpx", 0 ) - // mcpx_1_0.bin is bad, first byte (0x7f) sould be removed and a byte with value 0xee added at the end - ROM_LOAD( "mcpx_1_0.bin", 0, 0x200, CRC(f31429fc) SHA1(a9ecbf8896d10db81594923e485862aa3aac7b58) ) - ROM_LOAD( "mcpx_1_1.bin", 0x200, 0x200, CRC(94ce376b) SHA1(6c875f17f773aaec51eb434068bb6c657c4343c0) ) - - ROM_REGION( 0x100000, "bios", 0) - ROM_LOAD( "4134_1024k.bin", 0x000000, 0x100000, CRC(49d8055a) SHA1(d46cef771a63dc8024fe36d7ab5b959087ac999f) ) - ROM_COPY( "mcpx", 1, 0x7fe00, 0x1ff) - - - ROM_REGION( 0x1000000, "tbp", 0 ) // To Be Processed, of course - ROM_LOAD( "3944_1024k.bin", 0x000000, 0x100000, CRC(32a9ecb6) SHA1(67054fc88bda94e33e86f1b19be60efec0724fb6) ) - ROM_LOAD( "4034_1024k.bin", 0x000000, 0x100000, CRC(0d6fc88f) SHA1(ab676b712204fb1728bf89f9cd541a8f5a64ab97) ) - ROM_LOAD( "4817_1024k.bin", 0x000000, 0x100000, CRC(3f30863a) SHA1(dc955bd4d3ca71e01214a49e5d0aba615270c03c) ) - ROM_LOAD( "5101_256k.bin", 0x000000, 0x040000, CRC(e8a9224e) SHA1(5108e1025f48071c07a6823661d708c66dee97a9) ) - ROM_LOAD( "xbox-5530.bin", 0x000000, 0x040000, CRC(9569c4d3) SHA1(40fa73277013be3168135e1768b09623a987ff63) ) - ROM_LOAD( "xbox-5713.bin", 0x040000, 0x040000, CRC(58fd8173) SHA1(8b7ccc4648ccd78cdb7b65cfca09621eaf2d4238) ) - ROM_LOAD( "5838_256k.bin", 0x000000, 0x040000, CRC(5be2413d) SHA1(b9489e883c650b5e5fe2f83a32237dbf74f0e9f1) ) -ROM_END -// See src/emu/gamedrv.h for details -// For a game: -// GAME(YEAR,NAME,PARENT,MACHINE,INPUT,CLASS,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) - -// For a console: -// CONS(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) - -// For a computer: -// COMP(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) - -// For a generic system: -// SYST(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) - -CONS( 2001, xbox, 0, 0, xbox, xbox, driver_device, 0, "Microsoft", "XBOX", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/xerox820.c b/src/mess/drivers/xerox820.c deleted file mode 100644 index bd7756004d3..00000000000 --- a/src/mess/drivers/xerox820.c +++ /dev/null @@ -1,833 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*************************************************************************** - - Xerox 820 - - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -/* - - TODO: - - - Xerox 820 - - floppy format has 3xcd at the end of track data - :u109: write track 0 - :u109: track description 16xff ... 109xff 3xcd - - Xerox 820-II - - floppy (read/write to FDC triggers Z80 WAIT) - - Winchester - - Shugart SA1004 (chs=256,4,40 ss=256) - - Shugart SA606 (chs=160,6, ss=256) - - Shugart SA1403D controller - - Xerox 16/8 - - Emerald Microware X120 board - - type in Monitor v1.0 from manual - - ASCII keyboard - - low-profile keyboard - - http://users.telenet.be/lust/Xerox820/index.htm - http://www.classiccmp.org/dunfield/img41867/system.htm - http://www.microcodeconsulting.com/z80/plus2.htm - - Note: - - MK-82 have same roms as original Big Board - - MK-83 have 256K of RAM - - 8-inch formats - 77 tracks, 1 head, 26 sectors, 128 bytes sector length, first sector id 1 - 77 tracks, 1 head, 26 sectors, 256 bytes sector length, first sector id 1 - - 5.25-inch formats - 40 tracks, 1 head, 18 sectors, 128 bytes sector length, first sector id 1 - 40 tracks, 2 heads, 18 sectors, 128 bytes sector length, first sector id 1 - -*/ - - -#include "includes/xerox820.h" - -/* Read/Write Handlers */ - -void xerox820_state::bankswitch(int bank) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - if (bank) - { - /* ROM */ - program.install_rom(0x0000, 0x0fff, m_rom->base()); - program.unmap_readwrite(0x1000, 0x1fff); - program.install_ram(0x3000, 0x3fff, m_video_ram); - } - else - { - /* RAM */ - program.install_ram(0x0000, 0x3fff, ram); - } -} - -void xerox820ii_state::bankswitch(int bank) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - if (bank) - { - /* ROM */ - program.install_rom(0x0000, 0x1fff, m_rom->base()); - program.unmap_readwrite(0x2000, 0x2fff); - program.install_ram(0x3000, 0x3fff, m_video_ram); - program.unmap_readwrite(0x4000, 0xbfff); - } - else - { - /* RAM */ - program.install_ram(0x0000, 0xbfff, ram); - } -} - -READ8_MEMBER( xerox820_state::fdc_r ) -{ - return m_fdc->gen_r(offset) ^ 0xff; -} - -WRITE8_MEMBER( xerox820_state::fdc_w ) -{ - m_fdc->gen_w(offset, data ^ 0xff); -} - -WRITE8_MEMBER( xerox820_state::scroll_w ) -{ - m_scroll = (offset >> 8) & 0x1f; -} - -#ifdef UNUSED_CODE -WRITE8_MEMBER( xerox820_state::x120_system_w ) -{ - /* - - bit signal description - - 0 DSEL0 drive select bit 0 (01=A, 10=B, 00=C, 11=D) - 1 DSEL1 drive select bit 1 - 2 SIDE side select - 3 VATT video attribute (0=inverse, 1=blinking) - 4 BELL bell trigger - 5 DENSITY density (0=double, 1=single) - 6 _MOTOR disk motor (0=on, 1=off) - 7 BANK memory bank switch (0=RAM, 1=ROM/video) - - */ -} -#endif - -WRITE8_MEMBER( xerox820ii_state::bell_w ) -{ - m_speaker->level_w(offset); -} - -WRITE8_MEMBER( xerox820ii_state::slden_w ) -{ - m_fdc->dden_w(offset); -} - -WRITE8_MEMBER( xerox820ii_state::chrom_w ) -{ - m_chrom = offset; -} - -WRITE8_MEMBER( xerox820ii_state::lowlite_w ) -{ - m_lowlite = data; -} - -WRITE8_MEMBER( xerox820ii_state::sync_w ) -{ - if (offset) - { - /* set external clocks for synchronous sio A */ - } - else - { - /* set internal clocks for asynchronous sio A */ - } -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( xerox820_mem, AS_PROGRAM, 8, xerox820_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x3000, 0x3fff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0x4000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( xerox820_io, AS_IO, 8, xerox820_state ) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff03) AM_DEVWRITE(COM8116_TAG, com8116_device, str_w) - AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) - AM_RANGE(0x08, 0x0b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80PIO_GP_TAG, z80pio_device, read_alt, write_alt) - AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff03) AM_DEVWRITE(COM8116_TAG, com8116_device, stt_w) - AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_READWRITE(fdc_r, fdc_w) - AM_RANGE(0x14, 0x14) AM_MIRROR(0xff03) AM_MASK(0xff00) AM_WRITE(scroll_w) - AM_RANGE(0x18, 0x1b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0x1c, 0x1f) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80PIO_KB_TAG, z80pio_device, read_alt, write_alt) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( xerox820ii_mem, AS_PROGRAM, 8, xerox820ii_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x3000, 0x3fff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0xc000, 0xffff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( xerox820ii_io, AS_IO, 8, xerox820ii_state ) - AM_IMPORT_FROM(xerox820_io) - AM_RANGE(0x28, 0x29) AM_MIRROR(0xff00) AM_WRITE(bell_w) - AM_RANGE(0x30, 0x31) AM_MIRROR(0xff00) AM_WRITE(slden_w) - AM_RANGE(0x34, 0x35) AM_MIRROR(0xff00) AM_WRITE(chrom_w) - AM_RANGE(0x36, 0x36) AM_MIRROR(0xff00) AM_WRITE(lowlite_w) - AM_RANGE(0x68, 0x69) AM_MIRROR(0xff00) AM_WRITE(sync_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( xerox168_mem, AS_PROGRAM, 16, xerox820ii_state ) - AM_RANGE(0x00000, 0x3ffff) AM_RAM - AM_RANGE(0xff000, 0xfffff) AM_ROM AM_REGION(I8086_TAG, 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mk83_mem, AS_PROGRAM, 8, xerox820_state ) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x3000, 0x6fff) AM_RAM - AM_RANGE(0x7000, 0x7fff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0x8000, 0xffff) AM_RAM -ADDRESS_MAP_END - - -/* Input Ports */ - -static INPUT_PORTS_START( xerox820 ) - // inputs defined in machine/keyboard.c -INPUT_PORTS_END - -TIMER_CALLBACK_MEMBER( bigboard_state::bigboard_beepoff ) -{ - m_beeper->set_state(0); -} - -/* Z80 PIO */ - -READ8_MEMBER( xerox820_state::kbpio_pa_r ) -{ - /* - - bit signal description - - 0 - 1 - 2 - 3 PBRDY keyboard data available - 4 8/N5 8"/5.25" disk select (0=5.25", 1=8") - 5 400/460 double sided disk detect (only on Etch 2 PCB) (0=SS, 1=DS) - 6 - 7 - - */ - - UINT8 data = 0; - - // keyboard - data |= m_kbpio->rdy_b() << 3; - - // floppy - data |= m_8n5 << 4; - data |= m_400_460 << 5; - - return data; -} - -WRITE8_MEMBER( xerox820_state::kbpio_pa_w ) -{ - /* - - bit signal description - - 0 _DVSEL1 drive select 1 - 1 _DVSEL2 drive select 2 - 2 SIDE side select - 3 - 4 - 5 - 6 NCSET2 display character set (inverted and connected to chargen A10) - 7 BANK bank switching (0=RAM, 1=ROM/videoram) - - */ - - /* drive select */ - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - int _8n5 = (floppy->get_form_factor() == floppy_image::FF_8); - - if (m_8n5 != _8n5) - { - m_8n5 = _8n5; - - m_fdc->set_unscaled_clock(m_8n5 ? XTAL_20MHz/10 : XTAL_20MHz/20); - } - - m_400_460 = !floppy->twosid_r(); - - floppy->mon_w(0); - - floppy->ss_w(BIT(data, 2)); - } - - /* display character set */ - m_ncset2 = !BIT(data, 6); - - /* bank switching */ - bankswitch(BIT(data, 7)); -} - -WRITE8_MEMBER( bigboard_state::kbpio_pa_w ) -{ - xerox820_state::kbpio_pa_w(space, offset, data); - - /* beeper on bigboard */ - if (BIT(data, 5) & (!m_bit5)) - { - machine().scheduler().timer_set(attotime::from_msec(40), timer_expired_delegate(FUNC(bigboard_state::bigboard_beepoff),this)); - m_beeper->set_state(1); - } - m_bit5 = BIT(data, 5); -} - -READ8_MEMBER( xerox820_state::kbpio_pb_r ) -{ - /* - - bit description - - 0 KB0 - 1 KB1 - 2 KB2 - 3 KB3 - 4 KB4 - 5 KB5 - 6 KB6 - 7 KB7 - - */ - - return m_kb->read() ^ 0xff; -} - -WRITE8_MEMBER( xerox820ii_state::rdpio_pb_w ) -{ - /* - - bit description - - 0 NBSY - 1 NMSG - 2 NC/D - 3 NREQ - 4 NI/O - 5 NSEL - 6 LS74 Q - 7 NRST - */ - - m_sasibus->write_sel(!BIT(data, 5)); - m_sasibus->write_rst(!BIT(data, 7)); - // TODO: LS74 Q -} - -WRITE_LINE_MEMBER( xerox820ii_state::rdpio_pardy_w ) -{ - // TODO -} - -/* Z80 CTC */ - -TIMER_DEVICE_CALLBACK_MEMBER( xerox820_state::ctc_tick ) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); -} - -/* Z80 Daisy Chain */ - -static const z80_daisy_config xerox820_daisy_chain[] = -{ - { Z80SIO_TAG }, - { Z80PIO_KB_TAG }, - { Z80PIO_GP_TAG }, - { Z80CTC_TAG }, - { NULL } -}; - -/* WD1771 Interface */ - -static SLOT_INTERFACE_START( xerox820_floppies ) - SLOT_INTERFACE( "sa400", FLOPPY_525_SSSD_35T ) // Shugart SA-400 - SLOT_INTERFACE( "sa450", FLOPPY_525_DD ) // Shugart SA-450 - SLOT_INTERFACE( "sa800", FLOPPY_8_SSDD ) // Shugart SA-800 - SLOT_INTERFACE( "sa850", FLOPPY_8_DSDD ) // Shugart SA-850 -SLOT_INTERFACE_END - -void xerox820_state::update_nmi() -{ - int halt = m_maincpu->state_int(Z80_HALT); - int state = (halt && (m_fdc_irq || m_fdc_drq)) ? ASSERT_LINE : CLEAR_LINE; - - m_maincpu->set_input_line(INPUT_LINE_NMI, state); -} - -WRITE_LINE_MEMBER( xerox820_state::fdc_intrq_w ) -{ - m_fdc_irq = state; - - update_nmi(); -} - -WRITE_LINE_MEMBER( xerox820_state::fdc_drq_w ) -{ - m_fdc_drq = state; - - update_nmi(); -} - -/* COM8116 Interface */ - -WRITE_LINE_MEMBER( xerox820_state::fr_w ) -{ - m_sio->rxca_w(state); - m_sio->txca_w(state); -} - -/* Video */ - -UINT32 xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=(m_scroll + 1) * 0x80,x; - const pen_t *pen=m_palette->pens(); - - m_framecnt++; - - for (y = 0; y < 24; y++) - { - if (ma > 0xb80) ma = 0; - - for (ra = 0; ra < 10; ra++) - { - UINT32 *p = &bitmap.pix32(sy++); - - for (x = ma; x < ma + 80; x++) - { - if (ra < 8) - { - chr = m_video_ram[x & XEROX820_VIDEORAM_MASK] ^ 0x80; - - /* Take care of flashing characters */ - if ((chr < 0x80) && (m_framecnt & 0x08)) - chr |= 0x80; - - /* get pattern of pixels for that character scanline */ - gfx = m_char_rom->base()[(m_ncset2 << 10) | (chr<<3) | ra ]; - } - else - gfx = 0xff; - - /* Display a scanline of a character (7 pixels) */ - *p++ = pen[0]; - *p++ = pen[BIT(gfx, 4) ^ 1]; - *p++ = pen[BIT(gfx, 3) ^ 1]; - *p++ = pen[BIT(gfx, 2) ^ 1]; - *p++ = pen[BIT(gfx, 1) ^ 1]; - *p++ = pen[BIT(gfx, 0) ^ 1]; - *p++ = pen[0]; - } - } - ma+=128; - } - return 0; -} - -/* Machine Initialization */ - -void xerox820_state::machine_start() -{ - // state saving - save_item(NAME(m_scroll)); - save_item(NAME(m_ncset2)); - save_item(NAME(m_vatt)); - save_item(NAME(m_fdc_irq)); - save_item(NAME(m_fdc_drq)); - save_item(NAME(m_8n5)); - save_item(NAME(m_400_460)); -} - -void xerox820_state::machine_reset() -{ - bankswitch(1); - - m_fdc->reset(); -} - -void bigboard_state::machine_reset() -{ - bankswitch(1); - - /* bigboard has a one-pulse output to drive a user-supplied beeper */ - m_beeper->set_state(0); - m_beeper->set_frequency(950); - - m_fdc->reset(); -} - -void xerox820ii_state::machine_reset() -{ - bankswitch(1); - - m_fdc->reset(); -} - - -/* F4 Character Displayer */ -static const gfx_layout xerox820_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static const gfx_layout xerox820_gfxlayout = -{ - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( xerox820 ) - GFXDECODE_ENTRY( "chargen", 0x0000, xerox820_charlayout, 0, 1 ) -GFXDECODE_END - -static GFXDECODE_START( xerox820ii ) - GFXDECODE_ENTRY( "chargen", 0x0000, xerox820_charlayout, 0, 1 ) - GFXDECODE_ENTRY( "chargen", 0x0800, xerox820_gfxlayout, 0, 1 ) -GFXDECODE_END - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( xerox820, xerox820_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_20MHz/8) - MCFG_CPU_PROGRAM_MAP(xerox820_mem) - MCFG_CPU_IO_MAP(xerox820_io) - MCFG_CPU_CONFIG(xerox820_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(xerox820_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_10_69425MHz, 700, 0, 560, 260, 0, 240) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", xerox820) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* devices */ - MCFG_DEVICE_ADD(Z80PIO_KB_TAG, Z80PIO, XTAL_20MHz/8) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(xerox820_state, kbpio_pa_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(xerox820_state, kbpio_pa_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(xerox820_state, kbpio_pb_r)) - - MCFG_DEVICE_ADD(Z80PIO_GP_TAG, Z80PIO, XTAL_20MHz/8) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_20MHz/8) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) - //MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(XTAL_20MHz/8)) - - MCFG_FD1771_ADD(FD1771_TAG, XTAL_20MHz/20) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(xerox820_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(xerox820_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(FD1771_TAG":0", xerox820_floppies, "sa400", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1771_TAG":1", xerox820_floppies, "sa400", floppy_image_device::default_floppy_formats) - - MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_20MHz/8, 0, 0, 0, 0) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80sio0_device, rxa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80sio0_device, rxb_w)) - - MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(xerox820_state, fr_w)) - MCFG_COM8116_FT_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, XEROX_820_KEYBOARD, 0) - MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(DEVWRITELINE(Z80PIO_KB_TAG, z80pio_device, strobe_b)) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "xerox820") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( bigboard, xerox820, bigboard_state ) - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) /* bigboard only */ -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( xerox820ii, xerox820ii_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) - MCFG_CPU_PROGRAM_MAP(xerox820ii_mem) - MCFG_CPU_IO_MAP(xerox820ii_io) - MCFG_CPU_CONFIG(xerox820_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(xerox820ii_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(XTAL_10_69425MHz, 700, 0, 560, 260, 0, 240) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", xerox820ii) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* devices */ - MCFG_DEVICE_ADD(Z80PIO_KB_TAG, Z80PIO, XTAL_16MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(xerox820_state, kbpio_pa_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(xerox820_state, kbpio_pa_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(xerox820_state, kbpio_pb_r)) - - MCFG_DEVICE_ADD(Z80PIO_GP_TAG, Z80PIO, XTAL_16MHz/4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80PIO_RD_TAG, Z80PIO, XTAL_20MHz/8) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(DEVREAD8("sasi_data_in", input_buffer_device, read)) - MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("sasi_data_out", output_latch_device, write)) - MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(xerox820ii_state, rdpio_pardy_w)) - MCFG_Z80PIO_IN_PB_CB(DEVREAD8("sasi_ctrl_in", input_buffer_device, read)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(xerox820ii_state, rdpio_pb_w)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/4) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg1)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) - //MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(XTAL_16MHz/4)) - - MCFG_FD1797_ADD(FD1797_TAG, XTAL_16MHz/8) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(xerox820_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(xerox820_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":0", xerox820_floppies, "sa450", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":1", xerox820_floppies, "sa450", floppy_image_device::default_floppy_formats) - - MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_16MHz/4, 0, 0, 0, 0) - MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80sio0_device, rxa_w)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80sio0_device, rxb_w)) - - MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(xerox820_state, fr_w)) - MCFG_COM8116_FT_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w)) - - MCFG_DEVICE_ADD(KEYBOARD_TAG, XEROX_820_KEYBOARD, 0) - MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(DEVWRITELINE(Z80PIO_KB_TAG, z80pio_device, strobe_b)) - - // SASI bus - MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0) - MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in") - MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit0)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit1)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_CD_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit2)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_IO_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) MCFG_DEVCB_XOR(1) - - MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SA1403D, SCSI_ID_0) - - MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG) - MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0) - MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - - // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "xerox820ii") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( xerox168, xerox820ii ) - MCFG_CPU_ADD(I8086_TAG, I8086, 4770000) - MCFG_CPU_PROGRAM_MAP(xerox168_mem) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("192K") - MCFG_RAM_EXTRA_OPTIONS("320K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( mk83, xerox820 ) - MCFG_CPU_MODIFY(Z80_TAG) - MCFG_CPU_PROGRAM_MAP(mk83_mem) -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( bigboard ) - ROM_REGION( 0x1000, Z80_TAG, 0 ) - ROM_LOAD( "bigboard.u67", 0x0000, 0x0800, CRC(5a85a228) SHA1(d51a2cbd0aae80315bda9530275aabfe8305364e) ) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "bigboard.u73", 0x0000, 0x0800, CRC(10bf0d81) SHA1(7ec73670a4d9d6421a5d6a4c4edc8b7c87923f6c) ) -ROM_END - -#define rom_mk82 rom_bigboard - -ROM_START( x820 ) - ROM_REGION( 0x1000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "v20" ) - ROM_SYSTEM_BIOS( 0, "v10", "Xerox Monitor v1.0" ) - ROMX_LOAD( "x820v10.u64", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(1) ) - ROMX_LOAD( "x820v10.u63", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v20", "Xerox Monitor v2.0" ) - ROMX_LOAD( "x820v20.u64", 0x0000, 0x0800, CRC(2fc227e2) SHA1(b4ea0ae23d281a687956e8a514cb364a1372678e), ROM_BIOS(2) ) - ROMX_LOAD( "x820v20.u63", 0x0800, 0x0800, CRC(bc11f834) SHA1(4fd2b209a6e6ff9b0c41800eb5228c34a0d7f7ef), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "smart23", "MICROCode SmartROM v2.3" ) - ROMX_LOAD( "mxkx25a.u64", 0x0000, 0x0800, CRC(7ec5f100) SHA1(5d0ff35a51aa18afc0d9c20ef99ff5d9d3f2075b), ROM_BIOS(3) ) - ROMX_LOAD( "mxkx25b.u63", 0x0800, 0x0800, CRC(a7543798) SHA1(886e617e1003d13f86f33085cbd49391b77291a3), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "plus2", "MICROCode Plus2 v0.2a" ) - ROMX_LOAD( "p2x25a.u64", 0x0000, 0x0800, CRC(3ccd7a8f) SHA1(6e46c88f03fc7289595dd6bec95e23bb13969525), ROM_BIOS(4) ) - ROMX_LOAD( "p2x25b.u63", 0x0800, 0x0800, CRC(1e580391) SHA1(e91f8ce82586df33c0d6d02eb005e8079f4de67d), ROM_BIOS(4) ) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "x820.u92", 0x0000, 0x0800, CRC(b823fa98) SHA1(ad0ea346aa257a53ad5701f4201896a2b3a0f928) ) -ROM_END - -ROM_START( x820ii ) - ROM_REGION( 0x2000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "v404" ) - ROM_SYSTEM_BIOS( 0, "v400", "Balcones Operating System v4.00" ) // Initial U.S. 3-ROM set: support for double density disks - ROMX_LOAD( "v400.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(1) ) - ROMX_LOAD( "v400.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(1) ) - ROMX_LOAD( "v400.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v401", "Balcones Operating System v4.01" ) // Corrected overflow problem with large data files - ROMX_LOAD( "v401.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(2) ) - ROMX_LOAD( "v401.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(2) ) - ROMX_LOAD( "v401.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v402", "Balcones Operating System v4.02" ) // Rank Xerox (European) boot ROM version of US 4.01 - ROMX_LOAD( "v402.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(3) ) - ROMX_LOAD( "v402.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(3) ) - ROMX_LOAD( "v402.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(3) ) - ROM_SYSTEM_BIOS( 3, "v403", "Balcones Operating System v4.03" ) // Incorporate programmable communications option and support for the low-profile keyboard (4-ROM set and type-ahead input buffer) - ROMX_LOAD( "v403.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(4) ) - ROMX_LOAD( "v403.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(4) ) - ROMX_LOAD( "v403.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(4) ) - ROMX_LOAD( "v403.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(4) ) - ROM_SYSTEM_BIOS( 4, "v404", "Balcones Operating System v4.04" ) // Changes sign-on message from Xerox 820-II to Xerox - ROMX_LOAD( "537p3652.u33", 0x0000, 0x0800, CRC(7807cfbb) SHA1(bd3cc5cc5c59c84a50747aae5c17eb4617b0dbc3), ROM_BIOS(5) ) - ROMX_LOAD( "537p3653.u34", 0x0800, 0x0800, CRC(a9c6c0c3) SHA1(c2da9d1bf0da96e6b8bfa722783e411d2fe6deb9), ROM_BIOS(5) ) - ROMX_LOAD( "537p3654.u35", 0x1000, 0x0800, CRC(a8a07223) SHA1(e8ae1ebf2d7caf76771205f577b88ae493836ac9), ROM_BIOS(5) ) - ROMX_LOAD( "v404.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(5) ) // fitted for low-profile keyboard only - ROM_SYSTEM_BIOS( 5, "v50", "Balcones Operating System v5.0" ) // Operating system modifications for DEM and new 5.25" disk controller (4 new boot ROMs) - ROMX_LOAD( "v50.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(6) ) - ROMX_LOAD( "v50.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(6) ) - ROMX_LOAD( "v50.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(6) ) - ROMX_LOAD( "v50.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(6) ) // fitted for low-profile keyboard only - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "x820ii.u57", 0x0000, 0x0800, CRC(1a50f600) SHA1(df4470c80611c14fa7ea8591f741fbbecdfe4fd9) ) - ROM_LOAD( "x820ii.u58", 0x0800, 0x0800, CRC(aca4b9b3) SHA1(77f41470b0151945b8d3c3a935fc66409e9157b3) ) -ROM_END - -ROM_START( x168 ) - ROM_REGION( 0x2000, Z80_TAG, 0 ) - ROM_DEFAULT_BIOS( "v404" ) - ROM_SYSTEM_BIOS( 0, "v404", "Balcones Operating System v4.04" ) // Changes sign-on message from Xerox 820-II to Xerox - ROMX_LOAD( "537p3652.u33", 0x0000, 0x0800, CRC(7807cfbb) SHA1(bd3cc5cc5c59c84a50747aae5c17eb4617b0dbc3), ROM_BIOS(1) ) - ROMX_LOAD( "537p3653.u34", 0x0800, 0x0800, CRC(a9c6c0c3) SHA1(c2da9d1bf0da96e6b8bfa722783e411d2fe6deb9), ROM_BIOS(1) ) - ROMX_LOAD( "537p3654.u35", 0x1000, 0x0800, CRC(a8a07223) SHA1(e8ae1ebf2d7caf76771205f577b88ae493836ac9), ROM_BIOS(1) ) - ROMX_LOAD( "v404.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(1) ) // fitted for low-profile keyboard only - ROM_SYSTEM_BIOS( 1, "v50", "Balcones Operating System v5.0" ) // Operating system modifications for DEM and new 5.25" disk controller (4 new boot ROMs) - ROMX_LOAD( "v50.u33", 0x0000, 0x0800, NO_DUMP, ROM_BIOS(2) ) - ROMX_LOAD( "v50.u34", 0x0800, 0x0800, NO_DUMP, ROM_BIOS(2) ) - ROMX_LOAD( "v50.u35", 0x1000, 0x0800, NO_DUMP, ROM_BIOS(2) ) - ROMX_LOAD( "v50.u36", 0x1800, 0x0800, NO_DUMP, ROM_BIOS(2) ) // fitted for low-profile keyboard only - - ROM_REGION( 0x1000, I8086_TAG, 0 ) - ROM_LOAD( "8086.u33", 0x0000, 0x1000, CRC(ee49e3dc) SHA1(a5f20c74fc53f9d695d8894534ab69a39e2c38d8) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "x820ii.u57", 0x0000, 0x0800, CRC(1a50f600) SHA1(df4470c80611c14fa7ea8591f741fbbecdfe4fd9) ) - ROM_LOAD( "x820ii.u58", 0x0800, 0x0800, CRC(aca4b9b3) SHA1(77f41470b0151945b8d3c3a935fc66409e9157b3) ) -ROM_END - -ROM_START( mk83 ) - ROM_REGION( 0x1000, Z80_TAG, 0 ) - ROM_LOAD( "2732mk83.bin", 0x0000, 0x1000, CRC(a845c7e1) SHA1(3ccf629c5cd384953794ac4a1d2b45678bd40e92) ) - - ROM_REGION( 0x800, "chargen", 0 ) - ROM_LOAD( "2716mk83.bin", 0x0000, 0x0800, CRC(10bf0d81) SHA1(7ec73670a4d9d6421a5d6a4c4edc8b7c87923f6c) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, bigboard, 0, 0, bigboard, xerox820, driver_device, 0, "Digital Research Computers", "Big Board", 0 ) -COMP( 1981, x820, bigboard, 0, xerox820, xerox820, driver_device, 0, "Xerox", "Xerox 820", MACHINE_NO_SOUND_HW ) -COMP( 1982, mk82, bigboard, 0, bigboard, xerox820, driver_device, 0, "Scomar", "MK-82", 0 ) -COMP( 1983, x820ii, 0, 0, xerox820ii, xerox820, driver_device, 0, "Xerox", "Xerox 820-II", MACHINE_NOT_WORKING ) -COMP( 1983, x168, x820ii, 0, xerox168, xerox820, driver_device, 0, "Xerox", "Xerox 16/8", MACHINE_NOT_WORKING ) -COMP( 1983, mk83, x820ii, 0, mk83, xerox820, driver_device, 0, "Scomar", "MK-83", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/xor100.c b/src/mess/drivers/xor100.c deleted file mode 100644 index 8c2e544c544..00000000000 --- a/src/mess/drivers/xor100.c +++ /dev/null @@ -1,599 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/**************************************************************************************************** - - XOR S-100-12 - -***************************************************************************************************** - - All input must be in upper case. - Summary of Monitor commands: - - D xxxx yyyy = dump memory to screen - F xxxx yyyy zz = fill memory from xxxx to yyyy-1 with zz - G xxxx = execute program at xxxx - H xxxx yyyy aa bb... = Search memory for a string of bytes - L xxxx = edit memory (. to exit) - M xxxx yyyy zzzz = Move (copy) memory - V xxxx = Ascii dump of memory to the screen (cr to continue, space to exit) - X n = Select a bank (0 works, others freeze) - - Note some of the commands are a bit buggy, eg F doesn't fill the last byte - -*****************************************************************************************************/ - -/* - - TODO: - - - cannot boot from floppy (at prompt press ^C, wait, it says 'Drive not ready') - - honor jumper settings - - CTC signal header - - serial printer - - cassette? (no mention of it in the manuals) - -*/ - - -#include "includes/xor100.h" -#include "bus/rs232/rs232.h" - -/* Read/Write Handlers */ - -enum -{ - EPROM_0000 = 0, - EPROM_F800, - EPROM_OFF -}; - -void xor100_state::bankswitch() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - int banks = m_ram->size() / 0x10000; - - switch (m_mode) - { - case EPROM_0000: - if (m_bank < banks) - { - program.install_write_bank(0x0000, 0xffff, "bank1"); - membank("bank1")->set_entry(1 + m_bank); - } - else - { - program.unmap_write(0x0000, 0xffff); - } - - program.install_read_bank(0x0000, 0xf7ff, 0x07ff, 0, "bank2"); - program.install_read_bank(0xf800, 0xffff, "bank3"); - membank("bank2")->set_entry(0); - membank("bank3")->set_entry(0); - break; - - case EPROM_F800: - if (m_bank < banks) - { - program.install_write_bank(0x0000, 0xffff, "bank1"); - program.install_read_bank(0x0000, 0xf7ff, "bank2"); - membank("bank1")->set_entry(1 + m_bank); - membank("bank2")->set_entry(1 + m_bank); - } - else - { - program.unmap_write(0x0000, 0xffff); - program.unmap_read(0x0000, 0xf7ff); - } - - program.install_read_bank(0xf800, 0xffff, "bank3"); - membank("bank3")->set_entry(0); - break; - - case EPROM_OFF: - if (m_bank < banks) - { - program.install_write_bank(0x0000, 0xffff, "bank1"); - program.install_read_bank(0x0000, 0xf7ff, "bank2"); - program.install_read_bank(0xf800, 0xffff, "bank3"); - membank("bank1")->set_entry(1 + m_bank); - membank("bank2")->set_entry(1 + m_bank); - membank("bank3")->set_entry(1 + m_bank); - } - else - { - program.unmap_write(0x0000, 0xffff); - program.unmap_read(0x0000, 0xf7ff); - program.unmap_read(0xf800, 0xffff); - } - break; - } -} - -WRITE8_MEMBER( xor100_state::mmu_w ) -{ - /* - - bit description - - 0 A16 - 1 A17 - 2 A18 - 3 A19 - 4 - 5 - 6 - 7 - - */ - - m_bank = data & 0x07; - - bankswitch(); -} - -WRITE8_MEMBER( xor100_state::prom_toggle_w ) -{ - switch (m_mode) - { - case EPROM_OFF: m_mode = EPROM_F800; break; - case EPROM_F800: m_mode = EPROM_OFF; break; - } - - bankswitch(); -} - -READ8_MEMBER( xor100_state::prom_disable_r ) -{ - m_mode = EPROM_F800; - - bankswitch(); - - return 0xff; -} - -WRITE8_MEMBER( xor100_state::baud_w ) -{ - m_dbrg->str_w(data & 0x0f); - m_dbrg->stt_w(data >> 4); -} - -READ8_MEMBER( xor100_state::fdc_r ) -{ - return m_fdc->gen_r(offset) ^ 0xff; -} - -WRITE8_MEMBER( xor100_state::fdc_w ) -{ - m_fdc->gen_w(offset, data ^ 0xff); -} - -READ8_MEMBER( xor100_state::fdc_wait_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 FDC IRQ - - */ - - if (!space.debugger_access()) - { - if (!m_fdc_irq && !m_fdc_drq) - { - fatalerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); - } - } - - return !m_fdc_irq << 7; -} - -WRITE8_MEMBER( xor100_state::fdc_dcont_w ) -{ - /* - - bit description - - 0 DS0 - 1 DS1 - 2 DS2 - 3 DS3 - 4 - 5 - 6 - 7 _HLSTB - - */ - - // drive select - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - if (BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) floppy->mon_w(0); -} - -WRITE8_MEMBER( xor100_state::fdc_dsel_w ) -{ - /* - - bit description - - 0 J - 1 K - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - switch (data & 0x03) - { - case 0: break; - case 1: m_fdc_dden = 1; break; - case 2: m_fdc_dden = 0; break; - case 3: m_fdc_dden = !m_fdc_dden; break; - } - - m_fdc->dden_w(m_fdc_dden); -} - -/* Memory Maps */ - -static ADDRESS_MAP_START( xor100_mem, AS_PROGRAM, 8, xor100_state ) - AM_RANGE(0x0000, 0xffff) AM_WRITE_BANK("bank1") - AM_RANGE(0x0000, 0xf7ff) AM_READ_BANK("bank2") - AM_RANGE(0xf800, 0xffff) AM_READ_BANK("bank3") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( xor100_io, AS_IO, 8, xor100_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(I8251_A_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(I8251_A_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x02, 0x02) AM_DEVREADWRITE(I8251_B_TAG, i8251_device, data_r, data_w) - AM_RANGE(0x03, 0x03) AM_DEVREADWRITE(I8251_B_TAG, i8251_device, status_r, control_w) - AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write) - AM_RANGE(0x08, 0x08) AM_WRITE(mmu_w) - AM_RANGE(0x09, 0x09) AM_WRITE(prom_toggle_w) - AM_RANGE(0x0a, 0x0a) AM_READ(prom_disable_r) - AM_RANGE(0x0b, 0x0b) AM_READ_PORT("DSW0") AM_WRITE(baud_w) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write) - AM_RANGE(0xf8, 0xfb) AM_READWRITE(fdc_r, fdc_w) - AM_RANGE(0xfc, 0xfc) AM_READWRITE(fdc_wait_r, fdc_dcont_w) - AM_RANGE(0xfd, 0xfd) AM_WRITE(fdc_dsel_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( xor100 ) - - PORT_START("DSW0") - PORT_DIPNAME( 0x0f, 0x05, "Serial Port A" ) - PORT_DIPSETTING( 0x00, "50 baud" ) - PORT_DIPSETTING( 0x01, "75 baud" ) - PORT_DIPSETTING( 0x02, "110 baud" ) - PORT_DIPSETTING( 0x03, "134.5 baud" ) - PORT_DIPSETTING( 0x04, "150 baud" ) - PORT_DIPSETTING( 0x05, "300 baud" ) - PORT_DIPSETTING( 0x06, "600 baud" ) - PORT_DIPSETTING( 0x07, "1200 baud" ) - PORT_DIPSETTING( 0x08, "1800 baud" ) - PORT_DIPSETTING( 0x09, "2000 baud" ) - PORT_DIPSETTING( 0x0a, "2400 baud" ) - PORT_DIPSETTING( 0x0b, "3600 baud" ) - PORT_DIPSETTING( 0x0c, "4800 baud" ) - PORT_DIPSETTING( 0x0d, "7200 baud" ) - PORT_DIPSETTING( 0x0e, "9600 baud" ) - PORT_DIPSETTING( 0x0f, "19200 baud" ) - PORT_DIPNAME( 0xf0, 0xe0, "Serial Port B" ) - PORT_DIPSETTING( 0x00, "50 baud" ) - PORT_DIPSETTING( 0x10, "75 baud" ) - PORT_DIPSETTING( 0x20, "110 baud" ) - PORT_DIPSETTING( 0x30, "134.5 baud" ) - PORT_DIPSETTING( 0x40, "150 baud" ) - PORT_DIPSETTING( 0x50, "300 baud" ) - PORT_DIPSETTING( 0x60, "600 baud" ) - PORT_DIPSETTING( 0x70, "1200 baud" ) - PORT_DIPSETTING( 0x80, "1800 baud" ) - PORT_DIPSETTING( 0x90, "2000 baud" ) - PORT_DIPSETTING( 0xa0, "2400 baud" ) - PORT_DIPSETTING( 0xb0, "3600 baud" ) - PORT_DIPSETTING( 0xc0, "4800 baud" ) - PORT_DIPSETTING( 0xd0, "7200 baud" ) - PORT_DIPSETTING( 0xe0, "9600 baud" ) - PORT_DIPSETTING( 0xf0, "19200 baud" ) - - PORT_START("J1") - PORT_CONFNAME( 0x01, 0x01, "J1 Wait State") - PORT_CONFSETTING( 0x00, "No Wait States" ) - PORT_CONFSETTING( 0x01, "1 M1 Wait State" ) - - PORT_START("J2") - PORT_CONFNAME( 0x01, 0x01, "J2 CPU Speed") - PORT_CONFSETTING( 0x00, "2 MHz" ) - PORT_CONFSETTING( 0x01, "4 MHz" ) - - PORT_START("J3") - PORT_CONFNAME( 0x01, 0x00, "J3") - PORT_CONFSETTING( 0x00, "" ) - PORT_CONFSETTING( 0x01, "" ) - - PORT_START("J4-J5") - PORT_CONFNAME( 0x01, 0x01, "J4/J5 EPROM Type") - PORT_CONFSETTING( 0x00, "2708" ) - PORT_CONFSETTING( 0x01, "2716" ) - - PORT_START("J6") - PORT_CONFNAME( 0x01, 0x01, "J6 EPROM") - PORT_CONFSETTING( 0x00, "Disabled" ) - PORT_CONFSETTING( 0x01, "Enabled" ) - - PORT_START("J7") - PORT_CONFNAME( 0x01, 0x00, "J7 I/O Port Addresses") - PORT_CONFSETTING( 0x00, "00-0F" ) - PORT_CONFSETTING( 0x01, "10-1F" ) - - PORT_START("J8") - PORT_CONFNAME( 0x01, 0x00, "J8") - PORT_CONFSETTING( 0x00, "" ) - PORT_CONFSETTING( 0x01, "" ) - - PORT_START("J9") - PORT_CONFNAME( 0x01, 0x01, "J9 Power On RAM") - PORT_CONFSETTING( 0x00, "Enabled" ) - PORT_CONFSETTING( 0x01, "Disabled" ) -INPUT_PORTS_END - -/* COM5016 Interface */ - -WRITE_LINE_MEMBER( xor100_state::com5016_fr_w ) -{ - m_uart_a->write_txc(state); - m_uart_a->write_rxc(state); -} - -WRITE_LINE_MEMBER( xor100_state::com5016_ft_w ) -{ - m_uart_b->write_txc(state); - m_uart_b->write_rxc(state); -} - -/* Printer 8255A Interface */ - -WRITE_LINE_MEMBER( xor100_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER( xor100_state::write_centronics_select ) -{ - m_centronics_select = state; -} - -READ8_MEMBER(xor100_state::i8255_pc_r) -{ - /* - - bit description - - PC0 - PC1 - PC2 - PC3 - PC4 ON LINE - PC5 BUSY - PC6 _ACK - PC7 - - */ - - UINT8 data = 0; - - /* on line */ - data |= m_centronics_select << 4; - - /* busy */ - data |= m_centronics_busy << 5; - - return data; -} - -/* Z80-CTC Interface */ - -WRITE_LINE_MEMBER( xor100_state::ctc_z0_w ) -{ -} - -WRITE_LINE_MEMBER( xor100_state::ctc_z1_w ) -{ -} - -WRITE_LINE_MEMBER( xor100_state::ctc_z2_w ) -{ -} - -/* WD1795-02 Interface */ - -static SLOT_INTERFACE_START( xor100_floppies ) - SLOT_INTERFACE( "8ssdd", FLOPPY_8_SSDD ) // Shugart SA-100 -SLOT_INTERFACE_END - -void xor100_state::fdc_intrq_w(bool state) -{ - m_fdc_irq = state; - m_ctc->trg0(state); - - if (state) - { - fatalerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); - } -} - -void xor100_state::fdc_drq_w(bool state) -{ - m_fdc_drq = state; - - if (state) - { - fatalerror("Z80 WAIT not supported by MAME core\n"); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); - } -} - - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -static SLOT_INTERFACE_START( xor100_s100_cards ) -SLOT_INTERFACE_END - -/* Machine Initialization */ - -void xor100_state::machine_start() -{ - int banks = m_ram->size() / 0x10000; - UINT8 *ram = m_ram->pointer(); - UINT8 *rom = m_rom->base(); - - /* setup memory banking */ - membank("bank1")->configure_entries(1, banks, ram, 0x10000); - membank("bank2")->configure_entry(0, rom); - membank("bank2")->configure_entries(1, banks, ram, 0x10000); - membank("bank3")->configure_entry(0, rom); - membank("bank3")->configure_entries(1, banks, ram + 0xf800, 0x10000); - - machine().save().register_postload(save_prepost_delegate(FUNC(xor100_state::post_load), this)); - - /* register for state saving */ - save_item(NAME(m_mode)); - save_item(NAME(m_bank)); - save_item(NAME(m_fdc_irq)); - save_item(NAME(m_fdc_drq)); - save_item(NAME(m_fdc_dden)); - save_item(NAME(m_centronics_busy)); - save_item(NAME(m_centronics_select)); -} - -void xor100_state::machine_reset() -{ - m_mode = EPROM_0000; - - bankswitch(); -} - -void xor100_state::post_load() -{ - bankswitch(); -} - -/* Machine Driver */ - -static MACHINE_CONFIG_START( xor100, xor100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2) - MCFG_CPU_PROGRAM_MAP(xor100_mem) - MCFG_CPU_IO_MAP(xor100_io) - - /* devices */ - MCFG_DEVICE_ADD(I8251_A_TAG, I8251, 0/*XTAL_8MHz/2,*/) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_A_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_A_TAG, i8251_device, write_dsr)) - - MCFG_DEVICE_ADD(I8251_B_TAG, I8251, 0/*XTAL_8MHz/2,*/) - MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_B_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_B_TAG, i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) - - MCFG_DEVICE_ADD(COM5016_TAG, COM8116, XTAL_5_0688MHz) - MCFG_COM8116_FR_HANDLER(WRITELINE(xor100_state, com5016_fr_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE(xor100_state, com5016_ft_w)) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_I8255_OUT_PORTB_CB(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe)) - MCFG_I8255_IN_PORTC_CB(READ8(xor100_state, i8255_pc_r)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_8MHz/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(xor100_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(xor100_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(xor100_state, ctc_z2_w)) - - MCFG_FD1795_ADD(WD1795_TAG, XTAL_8MHz/4) - MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":0", xor100_floppies, "8ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":1", xor100_floppies, "8ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":2", xor100_floppies, NULL, floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":3", xor100_floppies, NULL, floppy_image_device::default_floppy_formats) - - MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(I8255A_TAG, i8255_device, pc4_w)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(xor100_state, write_centronics_busy)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(xor100_state, write_centronics_select)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - - // S-100 - MCFG_S100_BUS_ADD() - MCFG_S100_RDY_CALLBACK(INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT)) - MCFG_S100_SLOT_ADD("s100_1", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_2", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_3", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_4", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_5", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_6", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_7", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_8", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_9", xor100_s100_cards, NULL) - MCFG_S100_SLOT_ADD("s100_10", xor100_s100_cards, NULL) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("64K") - MCFG_RAM_EXTRA_OPTIONS("128K,192K,256K,320K,384K,448K,512K") -MACHINE_CONFIG_END - -/* ROMs */ - -ROM_START( xor100 ) - ROM_REGION( 0x800, Z80_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "v185", "v1.85" ) - ROMX_LOAD( "xp 185.8b", 0x000, 0x800, CRC(0d0bda8d) SHA1(11c83f7cd7e6a570641b44a2f2cc5737a7dd8ae3), ROM_BIOS(1) ) -ROM_END - -/* System Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, xor100, 0, 0, xor100, xor100, driver_device, 0, "Xor Data Science", "XOR S-100-12", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/ymmu100.c b/src/mess/drivers/ymmu100.c deleted file mode 100644 index 2273fdb827a..00000000000 --- a/src/mess/drivers/ymmu100.c +++ /dev/null @@ -1,499 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont, Olivier Galibert -/************************************************************************************* - - Yamaha MU-100 : 32-voice polyphonic/multitimbral General MIDI/GS/XG tone module - Preliminary driver by R. Belmont and O. Galibert - - CPU: Hitachi H8S/2655 (HD6432655F), strapped for mode 4 (24-bit address, 16-bit data, no internal ROM) - Sound ASIC: Yamaha XS725A0 - RAM: 1 MSM51008 (1 meg * 1 bit = 128KBytes) - - I/O ports from service manual: - - Port 1: - 0 - LCD data, SW data, LED 1 - 1 - LCD data, SW data, LED 2 - 2 - LCD data, SW data, LED 3 - 3 - LCD data, SW data, LED 4 - 4 - LCD data, SW data, LED 5 - 5 - LCD data, SW strobe data - 6 - LCD data, SW strobe data - 7 - LCD data, SW data, LED 6 - - Port 2: - 0 - (out) LCD control RS - 1 - (out) LCD control R/W - 2 - (out) LCD control E - 3 - (out) LCD contrast A - 4 - (out) LCD contrast B - 5 - (out) LCD contrast C - 6 - (out) 1 MHz clock for serial - 7 - NC - - Port 3: - 4 - (out) A/D gain control 1 - 5 - (out) A/D gain control 2 - - Port 5: - 3 - (out) Reset signal for rotary encoder - - Port 6: - 1 - NC - 2 - (out) PB select (SW1) - 3 - (out) PB select (SW2) - 4 - (out) reset PB - 5 - (out) reset SWP30 (sound chip) - 6 - NC - 7 - (in) Plug detection for A/D input - - Port A: - 5 - (in) Off Line Detection - 6 - (out) Signal for rotary encoder (REB) - 7 - (out) Signal for rotary encoder (REA) - - Port F: - 0 - (out) (sws) LED,SW Strobe data latch - 1 - (out) (swd) SW data read control - 2 - (out) PB select (SW4) - - Port G: - 0 - (out) PB select (SW3) - - Analog input channels: - 0 - level input R - 2 - level output L - 4 - host SW type switch position - 6 - battery voltage - 7 - model check (0 for MU100, 0.5 for OEM, 1 for MU100R) - - Switch map at the connector (17=ground) - 09 8 play - 10 8 edit - 11 8 mute/solo - 12 8 part - - 13 8 part + - 14 8 util - 15 8 effect - 16 8 enter - 12 7 select < - 13 7 select > - 16 7 mode - 15 7 eq - 14 7 exit - 10 7 value - - 11 7 value + - 2 led play - 3 led edit - 4 led util - 5 led effect - 6 led mode - 1 led eq - - IC32: - 1 p10 c.2 - 2 p11 c.3 - 3 p12 c.4 - 4 p13 c.5 - 5 p14 c.6 - 6 p15 c.7 - 7 p16 c.8 - 8 p17 c.1 - g sws - - IC33 - 1 p17 c.09 - 2 p16 c.10 - 3 p15 c.11 - 4 p14 c.12 - 5 p13 c.13 - 6 p12 c.14 - 7 p11 c.15 - 8 p10 c.16 - g swd - -**************************************************************************************/ - -#include "emu.h" -#include "debugger.h" -#include "cpu/h8/h8s2655.h" -#include "video/hd44780.h" -#include "rendlay.h" -#include "bus/midi/midiinport.h" -#include "bus/midi/midioutport.h" - -static INPUT_PORTS_START( mu100 ) - PORT_START("P7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Effect") PORT_CODE(KEYCODE_F) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Util") PORT_CODE(KEYCODE_U) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part +") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Part -") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mute/Solo") PORT_CODE(KEYCODE_S) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Edit") PORT_CODE(KEYCODE_E) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Play") PORT_CODE(KEYCODE_A) - - PORT_START("P8") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mode") PORT_CODE(KEYCODE_M) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Eq") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Exit") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select >") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select <") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Value +") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Value -") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -class mu100_state : public driver_device -{ -public: - enum { - P2_LCD_RS = 0x01, - P2_LCD_RW = 0x02, - P2_LCD_ENABLE = 0x04 - }; - - mu100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_lcd(*this, "lcd"), - m_ioport_p7(*this, "P7"), - m_ioport_p8(*this, "P8") - { } - - required_device m_maincpu; - required_device m_lcd; - required_ioport m_ioport_p7; - required_ioport m_ioport_p8; - - UINT8 cur_p1, cur_p2, cur_p3, cur_p5, cur_p6, cur_pa, cur_pf, cur_pg; - UINT8 cur_ic32; - float contrast; - - DECLARE_READ16_MEMBER(adc0_r); - DECLARE_READ16_MEMBER(adc2_r); - DECLARE_READ16_MEMBER(adc4_r); - DECLARE_READ16_MEMBER(adc6_r); - virtual DECLARE_READ16_MEMBER(adc7_r); - - DECLARE_WRITE16_MEMBER(p1_w); - DECLARE_READ16_MEMBER(p1_r); - DECLARE_WRITE16_MEMBER(p2_w); - DECLARE_WRITE16_MEMBER(p3_w); - DECLARE_WRITE16_MEMBER(p5_w); - DECLARE_WRITE16_MEMBER(p6_w); - DECLARE_READ16_MEMBER(p6_r); - DECLARE_WRITE16_MEMBER(pa_w); - DECLARE_READ16_MEMBER(pa_r); - DECLARE_WRITE16_MEMBER(pf_w); - DECLARE_WRITE16_MEMBER(pg_w); - - DECLARE_READ16_MEMBER(snd_r); - DECLARE_WRITE16_MEMBER(snd_w); - - float lightlevel(const UINT8 *src, const UINT8 *render); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - virtual void machine_start(); -}; - -class mu100r_state : public mu100_state { -public: - mu100r_state(const machine_config &mconfig, device_type type, const char *tag) - : mu100_state(mconfig, type, tag) - { } - - virtual DECLARE_READ16_MEMBER(adc7_r); -}; - -#include "../drivers/ymmu100.inc" - -void mu100_state::machine_start() -{ - cur_p1 = cur_p2 = cur_p3 = cur_p5 = cur_p6 = cur_pa = cur_pf = cur_pg = cur_ic32 = 0xff; - contrast = 1.0; -} - -float mu100_state::lightlevel(const UINT8 *src, const UINT8 *render) -{ - UINT8 l = *src; - if(l == 0) - return 1.0; - int slot = (src[1] << 8) | src[2]; - if(slot >= 0xff00) - return (255-l)/255.0; - - int bit = slot & 7; - int adr = (slot >> 3); - if(render[adr] & (1 << bit)) - return 1-(1-(255-l)/255.0f)*contrast; - return 0.95f; -} - -UINT32 mu100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const UINT8 *render = m_lcd->render(); - const UINT8 *src = ymmu100_bkg + 15; - - for(int y=0; y<241; y++) { - UINT32 *pix = reinterpret_cast(bitmap.raw_pixptr(y)); - for(int x=0; x<800; x++) { - float light = lightlevel(src, render); - UINT32 col = (int(0xef*light) << 16) | (int(0xf5*light) << 8); - *pix++ = col; - src += 3; - } - for(int x=800; x<900; x++) - *pix++ = 0; - } - - for(int i=0; i<6; i++) - if(cur_ic32 & (1 << (i == 5 ? 7 : i))) { - int x = 830 + 40*(i & 1); - int y = 55 + 65*(i >> 1); - for(int yy=-9; yy <= 9; yy++) { - int dx = int(sqrt((float)(99-yy*yy))); - UINT32 *pix = reinterpret_cast(bitmap.raw_pixptr(y+yy)) + (x-dx); - for(int xx=0; xx<2*dx+1; xx++) - *pix++ = 0x00ff00; - } - } - return 0; -} - -static ADDRESS_MAP_START( mu100_map, AS_PROGRAM, 16, mu100_state ) - AM_RANGE(0x000000, 0x1fffff) AM_ROM AM_REGION("maincpu", 0) - AM_RANGE(0x200000, 0x21ffff) AM_RAM // 128K work RAM - AM_RANGE(0x400000, 0x401fff) AM_READWRITE(snd_r, snd_w) -ADDRESS_MAP_END - -READ16_MEMBER(mu100_state::snd_r) -{ - int chan = (offset >> 6) & 0x3f; - int slot = offset & 0x3f; - logerror("snd_r %02x.%02x (%06x)\n", chan, slot, m_maincpu->pc()); - return 0x0000; -} - -WRITE16_MEMBER(mu100_state::snd_w) -{ - int chan = (offset >> 6) & 0x3f; - int slot = offset & 0x3f; - logerror("snd_w %02x.%02x, %04x (%06x)\n", chan, slot, data, m_maincpu->pc()); -} - -READ16_MEMBER(mu100_state::adc0_r) -{ - logerror("adc0_r\n"); - return 0; -} - -READ16_MEMBER(mu100_state::adc2_r) -{ - logerror("adc2_r\n"); - return 0; -} - -// Put the host switch to pure midi -READ16_MEMBER(mu100_state::adc4_r) -{ - return 0; -} - -// Battery level -READ16_MEMBER(mu100_state::adc6_r) -{ - logerror("adc6_r\n"); - return 0x3ff; -} - -// model detect. pulled to GND (0) on MU100, to 0.5Vcc on the card version, to Vcc on MU100R -READ16_MEMBER(mu100_state::adc7_r) -{ - return 0; -} - -READ16_MEMBER(mu100r_state::adc7_r) -{ - return 0x3ff; -} - -WRITE16_MEMBER(mu100_state::p1_w) -{ - cur_p1 = data; -} - -READ16_MEMBER(mu100_state::p1_r) -{ - if((cur_p2 & P2_LCD_ENABLE)) { - if(cur_p2 & P2_LCD_RW) { - if(cur_p2 & P2_LCD_RS) - return m_lcd->data_read(space, offset); - else - return m_lcd->control_read(space, offset); - } else - return 0x00; - } - - if(!(cur_pf & 0x02)) { - UINT8 val = 0xff; - if(!(cur_ic32 & 0x20)) - val &= m_ioport_p7->read(); - if(!(cur_ic32 & 0x40)) - val &= m_ioport_p8->read(); - return val; - } - - return 0xff; -} - -WRITE16_MEMBER(mu100_state::p2_w) -{ - // LCB enable edge - if(!(cur_p2 & P2_LCD_ENABLE) && (data & P2_LCD_ENABLE)) { - if(!(cur_p2 & P2_LCD_RW)) { - if(cur_p2 & P2_LCD_RS) - m_lcd->data_write(space, offset, cur_p1); - else - m_lcd->control_write(space, offset, cur_p1); - } - } - contrast = (8 - ((cur_p2 >> 3) & 7))/8.0; - cur_p2 = data; -} - -WRITE16_MEMBER(mu100_state::p3_w) -{ - cur_p3 = data; - logerror("A/D gain control %d\n", (data >> 4) & 3); -} - -WRITE16_MEMBER(mu100_state::p5_w) -{ - cur_p5 = data; - logerror("Rotary reset %d\n", (data >> 3) & 1); -} - -WRITE16_MEMBER(mu100_state::p6_w) -{ - cur_p6 = data; - logerror("pbsel %d pbreset %d soundreset %d\n", (data >> 2) & 3, (data >> 4) & 1, (data >> 5) & 1); -} - -READ16_MEMBER(mu100_state::p6_r) -{ - logerror("plug in detect read\n"); - return 0x00; -} - -WRITE16_MEMBER(mu100_state::pa_w) -{ - cur_pa = data; - logerror("rotary encoder %d\n", (data >> 6) & 3); -} - -READ16_MEMBER(mu100_state::pa_r) -{ - logerror("offline detect read\n"); - return 0x00; -} - -WRITE16_MEMBER(mu100_state::pf_w) -{ - if(!(cur_pf & 0x01) && (data & 0x01)) - cur_ic32 = cur_p1; - cur_pf = data; -} - -WRITE16_MEMBER(mu100_state::pg_w) -{ - cur_pg = data; - logerror("pbsel3 %d\n", data & 1); -} - -static ADDRESS_MAP_START( mu100_iomap, AS_IO, 16, mu100_state ) - AM_RANGE(h8_device::PORT_1, h8_device::PORT_1) AM_READWRITE(p1_r, p1_w) - AM_RANGE(h8_device::PORT_2, h8_device::PORT_2) AM_WRITE(p2_w) - AM_RANGE(h8_device::PORT_3, h8_device::PORT_3) AM_WRITE(p3_w) - AM_RANGE(h8_device::PORT_5, h8_device::PORT_5) AM_WRITE(p5_w) - AM_RANGE(h8_device::PORT_6, h8_device::PORT_6) AM_READWRITE(p6_r, p6_w) - AM_RANGE(h8_device::PORT_A, h8_device::PORT_A) AM_READWRITE(pa_r, pa_w) - AM_RANGE(h8_device::PORT_F, h8_device::PORT_F) AM_WRITE(pf_w) - AM_RANGE(h8_device::PORT_G, h8_device::PORT_G) AM_WRITE(pg_w) - AM_RANGE(h8_device::ADC_0, h8_device::ADC_0) AM_READ(adc0_r) - AM_RANGE(h8_device::ADC_2, h8_device::ADC_2) AM_READ(adc2_r) - AM_RANGE(h8_device::ADC_4, h8_device::ADC_4) AM_READ(adc4_r) - AM_RANGE(h8_device::ADC_6, h8_device::ADC_6) AM_READ(adc6_r) - AM_RANGE(h8_device::ADC_7, h8_device::ADC_7) AM_READ(adc7_r) -ADDRESS_MAP_END - -static MACHINE_CONFIG_START( mu100, mu100_state ) - MCFG_CPU_ADD( "maincpu", H8S2655, XTAL_16MHz ) - MCFG_CPU_PROGRAM_MAP( mu100_map ) - MCFG_CPU_IO_MAP( mu100_iomap ) - - MCFG_HD44780_ADD("lcd") - MCFG_HD44780_LCD_SIZE(4, 20) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate, asynchronous updating anyway */ - MCFG_SCREEN_UPDATE_DRIVER(mu100_state, screen_update) - MCFG_SCREEN_SIZE(900, 241) - MCFG_SCREEN_VISIBLE_AREA(0, 899, 0, 240) - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") - MCFG_MIDI_RX_HANDLER(DEVWRITELINE("maincpu:sci0", h8_sci_device, rx_w)) - - MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") - MCFG_DEVICE_MODIFY("maincpu:sci0") - MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE(":mdout", midi_port_device, write_txd)) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED_CLASS( mu100r, mu100, mu100r_state ) -MACHINE_CONFIG_END - -#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \ - ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios+1)) /* Note '+1' */ - -ROM_START( mu100 ) - ROM_REGION( 0x200000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "bios0", "xu50720 (v1.11, Aug. 3, 1999)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 0, "xu50720.ic11", 0x000000, 0x200000, CRC(1126a8a4) SHA1(e90b8bd9d14297da26ba12f4d9a4f2d22cd7d34a) ) - ROM_SYSTEM_BIOS( 1, "bios1", "xt71420 (v1.05, Sep. 19, 1997)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 1, "xt71420.ic11", 0x000000, 0x200000, CRC(0e5b3bae) SHA1(3148c5bd59a3d00809d3ab1921216215fe2582c5) ) - - ROM_REGION( 0x2800000, "waverom", 0 ) - ROM_LOAD32_WORD( "sx518b0.ic34", 0x000000, 0x400000, CRC(2550d44f) SHA1(fd3cce228c7d389a2fde25c808a5b26080588cba) ) - ROM_LOAD32_WORD( "sx743b0.ic35", 0x000002, 0x400000, CRC(a9109a6c) SHA1(a67bb49378a38a2d809bd717d286e18bc6496db0) ) - ROM_LOAD32_WORD( "xt445a0-828.ic36", 0x800000, 0x1000000, CRC(d4483a43) SHA1(5bfd0762dea8598eda19db20251dac20e31fa02c) ) - ROM_LOAD32_WORD( "xt461a0-829.ic37", 0x800002, 0x1000000, CRC(c5af4501) SHA1(1c88de197c36382311053add8b19a5740802cb78) ) - - ROM_REGION( 0x1000, "lcd", 0) - // Hand made, 3 characters unused - ROM_LOAD( "mu100-font.bin", 0x0000, 0x1000, BAD_DUMP CRC(a7d6c1d6) SHA1(9f0398d678bdf607cb34d83ee535f3b7fcc97c41) ) -ROM_END - -// Identical to the mu100 -ROM_START( mu100r ) - ROM_REGION( 0x200000, "maincpu", 0 ) - ROM_SYSTEM_BIOS( 0, "bios0", "xu50720 (v1.11, Aug. 3, 1999)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 0, "xu50720.ic11", 0x000000, 0x200000, CRC(1126a8a4) SHA1(e90b8bd9d14297da26ba12f4d9a4f2d22cd7d34a) ) - ROM_SYSTEM_BIOS( 1, "bios1", "xt71420 (v1.05, Sep. 19, 1997)" ) - ROM_LOAD16_WORD_SWAP_BIOS( 1, "xt71420.ic11", 0x000000, 0x200000, CRC(0e5b3bae) SHA1(3148c5bd59a3d00809d3ab1921216215fe2582c5) ) - - ROM_REGION( 0x2800000, "waverom", 0 ) - ROM_LOAD32_WORD( "sx518b0.ic34", 0x000000, 0x400000, CRC(2550d44f) SHA1(fd3cce228c7d389a2fde25c808a5b26080588cba) ) - ROM_LOAD32_WORD( "sx743b0.ic35", 0x000002, 0x400000, CRC(a9109a6c) SHA1(a67bb49378a38a2d809bd717d286e18bc6496db0) ) - ROM_LOAD32_WORD( "xt445a0-828.ic36", 0x800000, 0x1000000, CRC(d4483a43) SHA1(5bfd0762dea8598eda19db20251dac20e31fa02c) ) - ROM_LOAD32_WORD( "xt461a0-829.ic37", 0x800002, 0x1000000, CRC(c5af4501) SHA1(1c88de197c36382311053add8b19a5740802cb78) ) - - ROM_REGION( 0x1000, "lcd", 0) - // Hand made, 3 characters unused - ROM_LOAD( "mu100-font.bin", 0x0000, 0x1000, BAD_DUMP CRC(a7d6c1d6) SHA1(9f0398d678bdf607cb34d83ee535f3b7fcc97c41) ) -ROM_END - -CONS( 1997, mu100, 0, 0, mu100, mu100, driver_device, 0, "Yamaha", "MU100", MACHINE_NOT_WORKING ) -CONS( 1997, mu100r, mu100, 0, mu100r, mu100, driver_device, 0, "Yamaha", "MU100 Rackable version", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/ymmu100.ppm b/src/mess/drivers/ymmu100.ppm deleted file mode 100644 index 7a826314f7e..00000000000 Binary files a/src/mess/drivers/ymmu100.ppm and /dev/null differ diff --git a/src/mess/drivers/z100.c b/src/mess/drivers/z100.c deleted file mode 100644 index 016c86b4334..00000000000 --- a/src/mess/drivers/z100.c +++ /dev/null @@ -1,731 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - Zenith Z-100 - - 15/07/2011 Skeleton driver. - - Commands: - Press H to list all the commands. - - TODO: - - remove parity check IRQ patch (understand what it really wants there!) - - implement S-100 bus features; - - irqs needs 8259 "auto-ack"-ing in order to work properly; - - vertical scrolling isn't understood; - -============================================================================ - -Z207A EQU 0B0H ; Z-207 disk controller base port - ; (See DEFZ207 to program controller) -Z217A EQU 0AEH ; Z-217 disk controller base port - ; (See DEFZ217 to program controller) -ZGRNSEG EQU 0E000H ; Segment of green video plane -ZREDSEG EQU 0D000H ; Segment of red video plane -ZBLUSEG EQU 0C000H ; Segment of blue video plane -ZVIDEO EQU 0D8H ; Video 68A21 port - ; PA0 -> enable red display - ; PA1 -> enable green display - ; PA2 -> enable blue display - ; PA3 -> not flash screen - ; PA4 -> not write multiple red - ; PA5 -> not write multiple green - ; PA6 -> not write multiple blue - ; PA7 -> disable video RAM - ; PB7-PB0 -> LA15-LA8 - ; CA1 - not used - ; CA2 -> clear screen - ; CB1 - not used - ; CB2 -> value to write (0 or 1) on clear screen - ; (see DEF6821 to program the 6821) -ZCRTC EQU 0DCH ; Video 6845 CRT-C port - ; (see DEF6845 to program the 6845) -ZLPEN EQU 0DEH ; Light pen latch - ZLPEN_BIT EQU 00000111B ; Bit hit by pen - ZLPEN_ROW EQU 11110000B ; Row hit by pen -ZPIA EQU 0E0H ; Parallel printer plus light pen and - ; video vertical retrace 68A21 port - ; PA0 -> PDATA1 - ; PA1 -> PDATA2 - ; PA2 -> not STROBE - ; PA3 -> not INIT - ; PA4 <- VSYNC - ; PA5 -> clear VSYNC flip flop - ; PA6 <- light pen switch - ; PA7 -> clear light pen flip flop - ; PB0 <- BUSY - ; PB1 <- not ERROR - ; PB2 -> PDATA3 - ; PB3 -> PDATA4 - ; PB4 -> PDATA5 - ; PB5 -> PDATA6 - ; PB6 -> PDATA7 - ; PB7 -> PDATA8 - ; CA1 <- light pen hit (from flip flop) - ; CA2 <- VSYNC (from flip flop) - ; CB1 <- not ACKNLG - ; CB2 <- BUSY - ; (See DEF6821 to program the PIA) -ZTIMER EQU 0E4H ; Timer 8253 port - ZTIMEVAL EQU 2500 ; 100ms divide by N value - ; (See DEF8253 to program the 8253) -ZTIMERS EQU 0FBH ; Timer interrupt status port - ZTIMERS0 EQU 001H ; Timer 0 interrupt - ZTIMERS2 EQU 002H ; Timer 2 interrupt -ZSERA EQU 0E8H ; First 2661-2 serial port -ZSERB EQU 0ECH ; Second 2661-2 serial port - ; (See DEFEP2 to program 2661-2) -ZM8259A EQU 0F2H ; Master 8259A interrupt controller port - ZINTEI EQU 0 ; Parity error or S-100 pin 98 interrupt - ZINTPS EQU 1 ; Processor swap interrupt - ZINTTIM EQU 2 ; Timer interrupt - ZINTSLV EQU 3 ; Slave 8259A interrupt - ZINTSA EQU 4 ; Serial port A interrupt - ZINTSB EQU 5 ; Serial port B interrupt - ZINTKD EQU 6 ; Keyboard, Display, or Light pen interrupt - ZINTPP EQU 7 ; Parallel port interrupt - ; (See DEF8259A to program the 8259A) - ZM8259AI EQU 64 ; Base interrupt number for master -ZS8259A EQU 0F0H ; Secondary 8259A interrupt controller port - ZS8259AI EQU 72 ; Base interrupt number for slave - BIOSAI EQU ZS8259AI+8 ; Base of BIOS generated interrupts -ZKEYBRD EQU 0F4H ; Keyboard port - ZKEYBRDD EQU ZKEYBRD+0 ; Keyboard data port - ZKEYBRDC EQU ZKEYBRD+1 ; Keyboard command port - ZKEYRES EQU 0 ; Reset command - ZKEYARD EQU 1 ; Autorepeat on command - ZKEYARF EQU 2 ; Autorepeat off command - ZKEYKCO EQU 3 ; Key click on command - ZKEYKCF EQU 4 ; Key click off command - ZKEYCF EQU 5 ; Clear keyboard FIFO command - ZKEYCLK EQU 6 ; Generate a click sound command - ZKEYBEP EQU 7 ; Generate a beep sound command - ZKEYEK EQU 8 ; Enable keyboard command - ZKEYDK EQU 9 ; Disable keyboard command - ZKEYUDM EQU 10 ; Enter UP/DOWN mode command - ZKEYNSM EQU 11 ; Enter normal scan mode command - ZKEYEI EQU 12 ; Enable keyboard interrupts command - ZKEYDI EQU 13 ; Disable keyboard interrupts command - ZKEYBRDS EQU ZKEYBRD+1 ; Keyboard status port - ZKEYOBF EQU 001H ; Output buffer not empty - ZKEYIBF EQU 002H ; Input buffer full -ZMCL EQU 0FCH ; Memory control latch - ZMCLMS EQU 00000011B ; Map select mask - ZSM0 EQU 0 ; Map select 0 - ZSM1 EQU 1 ; Map select 1 - ZSM2 EQU 2 ; Map select 2 - ZSM3 EQU 3 ; Map select 3 - ZMCLRM EQU 00001100B ; Monitor ROM mapping mask - ZRM0 EQU 0*4 ; Power up mode - ROM everywhere on reads - ZRM1 EQU 1*4 ; ROM at top of every 64K page - ZRM2 EQU 2*4 ; ROM at top of 8088's addr space - ZRM3 EQU 3*4 ; Disable ROM - ZMCLPZ EQU 00010000B ; 0=Set Parity to the zero state - ZMCLPK EQU 00100000B ; 0=Disable parity checking circuity - ZMCLPF EQU 01000000B ; 0=Disable parity error flag -Z205BA EQU 098H ; Base address for Z-205 boards - Z205BMC EQU 8 ; Maximum of 8 Z-205 boards installed -ZHAL EQU 0FDH ; Hi-address latch - ZHAL85 EQU 0FFH ; 8085 Mask - ZHAL88 EQU 0F0H ; 8088 Mask -ZPSP EQU 0FEH ; Processor swap port - ZPSPPS EQU 10000000B ; Processor select (0=8085, 1=8088) - ZPSPPS5 EQU 00000000B ; Select 8085 - ZPSPPS8 EQU 10000000B ; Select 8088 - ZPSPSI EQU 00000010B ; Generate interrupt on swapping - ZPSPI8 EQU 00000001B ; 8088 processes all interrupts -ZDIPSW EQU 0FFH ; Configuration dip switches - ZDIPSWBOOT EQU 00000111B ; Boot device field - ZDIPSWAB EQU 00001000B ; 1=Auto boot(0=Manual boot) - ZDIPSWRES EQU 01110000B ; Reserved - ZDIPSWHZ EQU 10000000B ; 1=50Hz(0=60HZ) - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "video/mc6845.h" -#include "machine/pic8259.h" -#include "machine/6821pia.h" -#include "machine/wd_fdc.h" -#include "imagedev/flopdrv.h" - -class z100_state : public driver_device -{ -public: - z100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pia0(*this, "pia0"), - m_pia1(*this, "pia1"), - m_picm(*this, "pic8259_master"), - m_pics(*this, "pic8259_slave"), - m_fdc(*this, "z207_fdc"), - m_floppy0(*this, "z207_fdc:0"), - m_floppy1(*this, "z207_fdc:1"), - m_floppy2(*this, "z207_fdc:2"), - m_floppy3(*this, "z207_fdc:3"), - m_crtc(*this, "crtc"), - m_palette(*this, "palette"), - m_floppy(NULL) - { } - - required_device m_maincpu; - required_device m_pia0; - required_device m_pia1; - required_device m_picm; - required_device m_pics; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_device m_crtc; - required_device m_palette; - - DECLARE_READ8_MEMBER(z100_vram_r); - DECLARE_WRITE8_MEMBER(z100_vram_w); - DECLARE_READ8_MEMBER(keyb_data_r); - DECLARE_READ8_MEMBER(keyb_status_r); - DECLARE_WRITE8_MEMBER(keyb_command_w); - DECLARE_WRITE8_MEMBER(z100_6845_address_w); - DECLARE_WRITE8_MEMBER(z100_6845_data_w); - DECLARE_WRITE8_MEMBER(floppy_select_w); - DECLARE_WRITE8_MEMBER(floppy_motor_w); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE8_MEMBER(video_pia_A_w); - DECLARE_WRITE8_MEMBER(video_pia_B_w); - DECLARE_WRITE_LINE_MEMBER(video_pia_CA2_w); - DECLARE_WRITE_LINE_MEMBER(video_pia_CB2_w); - UINT8 *m_gvram; - UINT8 m_keyb_press,m_keyb_status; - UINT8 m_vram_enable; - UINT8 m_gbank; - UINT8 m_display_mask; - UINT8 m_flash; - UINT8 m_clr_val; - UINT8 m_crtc_vreg[0x100],m_crtc_index; - UINT16 m_start_addr; - - floppy_image_device *m_floppy; - - mc6845_device *m_mc6845; - DECLARE_DRIVER_INIT(z100); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_z100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); -}; - -#define mc6845_h_char_total (m_crtc_vreg[0]) -#define mc6845_h_display (m_crtc_vreg[1]) -#define mc6845_h_sync_pos (m_crtc_vreg[2]) -#define mc6845_sync_width (m_crtc_vreg[3]) -#define mc6845_v_char_total (m_crtc_vreg[4]) -#define mc6845_v_total_adj (m_crtc_vreg[5]) -#define mc6845_v_display (m_crtc_vreg[6]) -#define mc6845_v_sync_pos (m_crtc_vreg[7]) -#define mc6845_mode_ctrl (m_crtc_vreg[8]) -#define mc6845_tile_height (m_crtc_vreg[9]+1) -#define mc6845_cursor_y_start (m_crtc_vreg[0x0a]) -#define mc6845_cursor_y_end (m_crtc_vreg[0x0b]) -#define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0xff00) | (m_crtc_vreg[0x0d] & 0xff)) -#define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0xff00) | (m_crtc_vreg[0x0f] & 0xff)) -#define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0xff00) | (m_crtc_vreg[0x11] & 0xff)) -#define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0xff00) | (m_crtc_vreg[0x13] & 0xff)) - - -void z100_state::video_start() -{ - m_gvram = auto_alloc_array_clear(machine(), UINT8, 0x30000); -} - -UINT32 z100_state::screen_update_z100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,xi,yi; - int dot; - int i; - - bitmap.fill(0, cliprect); - - for(y=0;y> (7-xi)) & 1) << i; // b, r, g - - dot &= m_display_mask; - - /* overwrite */ - if(m_flash) - dot = m_display_mask; - - if(y*mc6845_tile_height+yi < 216 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(dot); - } - } - } - } - - return 0; -} - -READ8_MEMBER( z100_state::z100_vram_r ) -{ - return m_gvram[offset]; -} - -WRITE8_MEMBER( z100_state::z100_vram_w ) -{ - if(m_vram_enable) - { - int i; - - m_gvram[offset] = data; - - for(i=0;i<3;i++) - { - if(m_gbank & (1 << i)) - m_gvram[((offset) & 0xffff)+0x10000*i] = data; - } - } -} - -static ADDRESS_MAP_START(z100_mem, AS_PROGRAM, 8, z100_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x00000,0x3ffff) AM_RAM // 128*2 KB RAM -// AM_RANGE(0xb0000,0xbffff) AM_ROM // expansion ROM - AM_RANGE(0xc0000,0xeffff) AM_READWRITE(z100_vram_r,z100_vram_w) // Blue / Red / Green -// AM_RANGE(0xf0000,0xf0fff) // network card (NET-100) -// AM_RANGE(0xf4000,0xf7fff) // MTRET-100 Firmware I expansion ROM -// AM_RANGE(0xf8000,0xfbfff) // MTRET-100 Firmware II expansion ROM check ID 0x4550 - AM_RANGE(0xfc000,0xfffff) AM_ROM AM_REGION("ipl", 0) -ADDRESS_MAP_END - -READ8_MEMBER( z100_state::keyb_data_r ) -{ - if(m_keyb_press) - { - UINT8 res; - - res = m_keyb_press; - - m_keyb_press = 0; - return res; - } - - return m_keyb_press; -} - -READ8_MEMBER( z100_state::keyb_status_r ) -{ - if(m_keyb_status) - { - m_keyb_status = 0; - return 1; - } - - return m_keyb_status; -} - -WRITE8_MEMBER( z100_state::keyb_command_w ) -{ - // ... -} - -WRITE8_MEMBER( z100_state::z100_6845_address_w ) -{ - data &= 0x1f; - m_crtc_index = data; - m_crtc->address_w( space, offset, data ); -} - -WRITE8_MEMBER( z100_state::z100_6845_data_w ) -{ - m_crtc_vreg[m_crtc_index] = data; - m_crtc->register_w(space, offset, data); -} - -// todo: side select? - -WRITE8_MEMBER( z100_state::floppy_select_w ) -{ - switch (data & 0x03) - { - case 0: m_floppy = m_floppy0->get_device(); break; - case 1: m_floppy = m_floppy1->get_device(); break; - case 2: m_floppy = m_floppy2->get_device(); break; - case 3: m_floppy = m_floppy3->get_device(); break; - } - - m_fdc->set_floppy(m_floppy); -} - -WRITE8_MEMBER( z100_state::floppy_motor_w ) -{ - if (m_floppy) - m_floppy->mon_w(!BIT(data, 1)); -} - -static ADDRESS_MAP_START(z100_io, AS_IO, 8, z100_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) -// AM_RANGE (0x00, 0x3f) reserved for non-ZDS vendors -// AM_RANGE (0x40, 0x5f) secondary Multiport card (Z-204) -// AM_RANGE (0x60, 0x7f) primary Multiport card (Z-204) -// AM_RANGE (0x80, 0x83) development board -// AM_RANGE (0x98, 0x9f) Z-205 expansion memory boards -// AM_RANGE (0xa0, 0xa3) network card (NET-100) -// AM_RANGE (0xa4, 0xa7) gateway (reserved) -// AM_RANGE (0xac, 0xad) Z-217 secondary disk controller (winchester) -// AM_RANGE (0xae, 0xaf) Z-217 primary disk controller (winchester) - AM_RANGE (0xb0, 0xb3) AM_DEVREADWRITE("z207_fdc", fd1797_t, read, write) - AM_RANGE (0xb4, 0xb4) AM_WRITE(floppy_select_w) - AM_RANGE (0xb5, 0xb5) AM_WRITE(floppy_motor_w) -// z-207 secondary disk controller (wd1797) -// AM_RANGE (0xcd, 0xce) ET-100 CRT Controller -// AM_RANGE (0xd4, 0xd7) ET-100 Trainer Parallel I/O - AM_RANGE (0xd8, 0xdb) AM_DEVREADWRITE("pia0", pia6821_device, read, write) //video board - AM_RANGE (0xdc, 0xdc) AM_WRITE(z100_6845_address_w) - AM_RANGE (0xdd, 0xdd) AM_WRITE(z100_6845_data_w) -// AM_RANGE (0xde, 0xde) light pen - AM_RANGE (0xe0, 0xe3) AM_DEVREADWRITE("pia1", pia6821_device, read, write) //main board -// AM_RANGE (0xe4, 0xe7) 8253 PIT -// AM_RANGE (0xe8, 0xeb) First 2661-2 serial port (printer) -// AM_RANGE (0xec, 0xef) Second 2661-2 serial port (modem) - AM_RANGE (0xf0, 0xf1) AM_DEVREADWRITE("pic8259_slave", pic8259_device, read, write) - AM_RANGE (0xf2, 0xf3) AM_DEVREADWRITE("pic8259_master", pic8259_device, read, write) - AM_RANGE (0xf4, 0xf4) AM_READ(keyb_data_r) // -> 8041 MCU - AM_RANGE (0xf5, 0xf5) AM_READWRITE(keyb_status_r,keyb_command_w) -// AM_RANGE (0xf6, 0xf6) expansion ROM is present (bit 0, active low) -// AM_RANGE (0xfb, 0xfb) timer irq status -// AM_RANGE (0xfc, 0xfc) memory latch -// AM_RANGE (0xfd, 0xfd) Hi-address latch -// AM_RANGE (0xfe, 0xfe) Processor swap port - AM_RANGE (0xff, 0xff) AM_READ_PORT("DSW101") -ADDRESS_MAP_END - -INPUT_CHANGED_MEMBER(z100_state::key_stroke) -{ - if(newval && !oldval) - { - /* TODO: table */ - m_keyb_press = (UINT8)(FPTR)(param) & 0xff; - //pic8259_ir6_w(m_picm, 1); - m_keyb_status = 1; - } - - if(oldval && !newval) - { - m_keyb_press = 0; - m_keyb_status = 0; - } -} - -/* Input ports */ -INPUT_PORTS_START( z100 ) - PORT_START("KEY0") // 0x00 - 0x07 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x01) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x02) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x03) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x04) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x05) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x06) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x07) - - PORT_START("KEY1") // 0x08 - 0x0f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x08) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x09) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x0f) - - PORT_START("KEY2") // 0x10 - 0x17 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x10) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x11) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x12) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x13) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x14) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x15) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x16) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x17) - - PORT_START("KEY3") // 0x18 - 0x1f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x18) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x19) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x1f) - - PORT_START("KEY4") // 0x20 - 0x27 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x20) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x21) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x22) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x23) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x24) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x25) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x26) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x27) - - PORT_START("KEY5") // 0x28 - 0x2f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x28) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-1") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x29) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x2f) - - PORT_START("KEY6") // 0x30 - 0x37 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_IMPULSE(1) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x30) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x31) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x32) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x33) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x34) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x35) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x36) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x37) - - PORT_START("KEY7") // 0x38 - 0x3f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x38) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x39) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-2") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-3") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x3f) - - PORT_START("KEY8") // 0x40 - 0x47 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8-0") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x60) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x61) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x62) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x63) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x64) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x65) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x66) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x67) - - PORT_START("KEY9") // 0x48 - 0x4f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x68) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x69) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x6f) - - PORT_START("KEYA") // 0x50 - 0x57 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x70) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x71) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x72) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x73) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x74) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x75) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x76) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x77) - - PORT_START("KEYB") // 0x58 - 0x5f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x78) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x79) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-4") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-5") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-6") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B-7") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DELETE key") PORT_CODE(KEYCODE_DEL) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x7f) - - PORT_START("KEYC") // 0x58 - 0x5f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HELP key") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, z100_state, key_stroke, 0x95) - - PORT_START("DSW101") - PORT_DIPNAME( 0x07, 0x00, "Default Auto-boot Device" ) - PORT_DIPSETTING( 0x00, "0" ) - PORT_DIPSETTING( 0x01, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x03, "3" ) - PORT_DIPSETTING( 0x04, "4" ) - PORT_DIPSETTING( 0x05, "5" ) - PORT_DIPSETTING( 0x06, "6" ) - PORT_DIPSETTING( 0x07, "7" ) - PORT_DIPNAME( 0x08, 0x08, "Auto-boot" ) - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) // Reserved - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) // Reserved - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) // Reserved - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, "Monitor" ) - PORT_DIPSETTING( 0x80, "PAL 50 Hz" ) - PORT_DIPSETTING( 0x00, "NTSC 60 Hz" ) - - PORT_START("CONFIG") - PORT_CONFNAME( 0x01, 0x01, "Video Board" ) - PORT_CONFSETTING( 0x00, "Monochrome" ) - PORT_CONFSETTING( 0x01, "Color" ) -INPUT_PORTS_END - -READ8_MEMBER( z100_state::get_slave_ack ) -{ - if (offset==7) { // IRQ = 7 - return m_pics->acknowledge(); - } - return 0; -} - -WRITE8_MEMBER( z100_state::video_pia_A_w ) -{ - /* - all bits are active low - x--- ---- -> disable video RAM - -x-- ---- -> not write multiple blue - --x- ---- -> not write multiple green - ---x ---- -> not write multiple red - ---- x--- -> not flash screen - ---- -x-- -> enable blue display - ---- --x- -> enable green display - ---- ---x -> enable red display - */ - - m_vram_enable = ((data & 0x80) >> 7) ^ 1; - m_gbank = BITSWAP8(((data & 0x70) >> 4) ^ 0x7,7,6,5,4,3,1,0,2); - m_flash = ((data & 8) >> 3) ^ 1; - m_display_mask = BITSWAP8((data & 7) ^ 7,7,6,5,4,3,1,0,2); -} - -WRITE8_MEMBER( z100_state::video_pia_B_w ) -{ - m_start_addr = data << 4; //<- TODO -} - -/* clear screen */ -WRITE_LINE_MEMBER( z100_state::video_pia_CA2_w ) -{ - int i; - - for(i=0; i<0x30000; i++) - m_gvram[i] = m_clr_val; -} - -WRITE_LINE_MEMBER( z100_state::video_pia_CB2_w ) -{ - m_clr_val = (state & 1) ? 0x00 : 0xff; -} - -void z100_state::machine_start() -{ - m_mc6845 = machine().device("crtc"); -} - -void z100_state::machine_reset() -{ - int i; - - if(ioport("CONFIG")->read() & 1) - { - for(i=0;i<8;i++) - m_palette->set_pen_color(i,pal1bit(i >> 1),pal1bit(i >> 2),pal1bit(i >> 0)); - } - else - { - for(i=0;i<8;i++) - m_palette->set_pen_color(i,pal3bit(0),pal3bit(i),pal3bit(0)); - } -} - -static SLOT_INTERFACE_START( z100_floppies ) - SLOT_INTERFACE("dd", FLOPPY_525_DD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( z100, z100_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",I8088, XTAL_14_31818MHz/3) - MCFG_CPU_PROGRAM_MAP(z100_mem) - MCFG_CPU_IO_MAP(z100_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_UPDATE_DRIVER(z100_state, screen_update_z100) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - - /* devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_14_31818MHz/8) /* unknown clock, hand tuned to get ~50/~60 fps */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - - MCFG_PIC8259_ADD( "pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(z100_state, get_slave_ack) ) - MCFG_PIC8259_ADD( "pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir3_w), GND, NULL ) - - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(z100_state, video_pia_A_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(z100_state, video_pia_B_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE(z100_state, video_pia_CA2_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE(z100_state, video_pia_CB2_w)) - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - - MCFG_FD1797_ADD("z207_fdc", XTAL_1MHz) - - MCFG_FLOPPY_DRIVE_ADD("z207_fdc:0", z100_floppies, "dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("z207_fdc:1", z100_floppies, "dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("z207_fdc:2", z100_floppies, "", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("z207_fdc:3", z100_floppies, "", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( z100 ) - ROM_REGION( 0x4000, "ipl", ROMREGION_ERASEFF ) - ROM_LOAD( "intel-d27128-1.bin", 0x0000, 0x4000, CRC(b21f0392) SHA1(69e492891cceb143a685315efe0752981a2d8143)) - - ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF ) //8041 - ROM_LOAD( "mcu", 0x0000, 0x1000, NO_DUMP ) -ROM_END - -DRIVER_INIT_MEMBER(z100_state,z100) -{ - UINT8 *ROM = memregion("ipl")->base(); - - ROM[0xfc116 & 0x3fff] = 0x90; // patch parity IRQ check - ROM[0xfc117 & 0x3fff] = 0x90; - - ROM[0xfc0d4 & 0x3fff] = 0x75; // patch checksum -} - - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, z100, 0, 0, z100, z100, z100_state, z100, "Zenith", "Z-100", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mess/drivers/z1013.c b/src/mess/drivers/z1013.c deleted file mode 100644 index 6c22545ed7b..00000000000 --- a/src/mess/drivers/z1013.c +++ /dev/null @@ -1,468 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - Z1013 driver by Miodrag Milanovic - - 22/04/2009 Preliminary driver. - -The 8x4 keyboard contains letters A-W, enter, cursor right/left, space, and -4 shift keys. -S1 - X-Z, numbers -S2 - a-w -S3 - x-z, punctuation -S4 - control keys - -Control Keys: -G - Graphics -A - Alpha -T - clear screen -U - enter -P - cursor left -Q - cursor right - -Monitor commands (debug) -R - registers -B - breakpoint -E - execute -G - resume after breakpoint -N - single-step - -Monitor commands (general) -H - switch to hex keyboard (H to Q become 0 to 9) -A - switch back to normal alpha keyboard -C - Compare memory blocks -D - Dump memory -F - Find bytes in memory -T - Copy memory block -M - Modify bytes (; to exit) -I - reboot -J - Jump to address -K - Fill memory (K by itself fills all of memory) -L - Load Cassette -S - Save Cassette -W - window (example: W EF00 EFFF) - -Due to no input checking, misuse of commands can crash the system. - - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80pio.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" - - -class z1013_state : public driver_device -{ -public: - z1013_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cass(*this, "cassette"), - m_p_videoram(*this, "videoram"){ } - - required_device m_maincpu; - required_device m_cass; - DECLARE_WRITE8_MEMBER(z1013_keyboard_w); - DECLARE_READ8_MEMBER(port_b_r); - DECLARE_WRITE8_MEMBER(port_b_w); - DECLARE_READ8_MEMBER(k7659_port_b_r); - required_shared_ptr m_p_videoram; - const UINT8 *m_p_chargen; - UINT8 m_keyboard_line; - bool m_keyboard_part; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_z1013(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_SNAPSHOT_LOAD_MEMBER( z1013 ); -}; - - -/* Address maps */ -static ADDRESS_MAP_START(z1013_mem, AS_PROGRAM, 8, z1013_state) - AM_RANGE( 0x0000, 0xebff ) AM_RAM - AM_RANGE( 0xec00, 0xefff ) AM_RAM AM_SHARE("videoram") - AM_RANGE( 0xf000, 0xffff ) AM_ROM // ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(z1013_io, AS_IO, 8, z1013_state) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) - AM_RANGE( 0x08, 0x08 ) AM_WRITE(z1013_keyboard_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( z1013_8x4 ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_LSHIFT) - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S2") PORT_CODE(KEYCODE_LCONTROL) - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S3") PORT_CODE(KEYCODE_RSHIFT) - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S4") PORT_CODE(KEYCODE_RCONTROL) - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER) -INPUT_PORTS_END - -static INPUT_PORTS_START( z1013_8x8 ) - PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS) - PORT_START("X6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) -INPUT_PORTS_END - -static INPUT_PORTS_START( z1013 ) -INPUT_PORTS_END - - -void z1013_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 z1013_state::screen_update_z1013(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 32; y++) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma+32; x++) - { - chr = m_p_videoram[x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | ra]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=32; - } - return 0; -} - -void z1013_state::machine_reset() -{ - m_maincpu->set_state_int(Z80_PC, 0xF000); - m_keyboard_part = 0; - m_keyboard_line = 0; -} - -WRITE8_MEMBER( z1013_state::z1013_keyboard_w ) -{ - m_keyboard_line = data; -} - -READ8_MEMBER( z1013_state::port_b_r ) -{ - char kbdrow[6]; - sprintf(kbdrow,"X%d", m_keyboard_line & 7); - UINT8 data = ioport(kbdrow)->read(); - - if (m_keyboard_part) - data >>= 4; - - data &= 0x0f; - - if (m_cass->input() > 0.03) - data |= 0x40; - - return data; -} - -WRITE8_MEMBER( z1013_state::port_b_w ) -{ - m_keyboard_part = BIT(data, 4); // for z1013a2 only - m_cass->output(BIT(data, 7) ? -1.0 : +1.0); -} - -READ8_MEMBER( z1013_state::k7659_port_b_r ) -{ - return 0xff; -} - -SNAPSHOT_LOAD_MEMBER( z1013_state, z1013 ) -{ -/* header layout -0000,0001 - load address -0002,0003 - end address -0004,0005 - exec address -0006-000B - unknown -000C - Filetype (appears B=Basic, C=Machine Language, I=?, could be more) -000D-000F - bytes D3, D3, D3 -0010-001F - Filename -0020 up - Program to load -*/ - - UINT8* data= auto_alloc_array(machine(), UINT8, snapshot_size); - UINT16 startaddr,endaddr,runaddr; - - image.fread( data, snapshot_size); - - startaddr = data[0] + data[1]*256; - endaddr = data[2] + data[3]*256; - runaddr = data[4] + data[5]*256; - - if ((data[13]==data[14]) && (data[14]==data[15])) - { } - else - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Not a Z1013 image"); - image.message(" Not a Z1013 image"); - return IMAGE_INIT_FAIL; - } - - memcpy (m_maincpu->space(AS_PROGRAM).get_read_ptr(startaddr), - data+0x20, endaddr - startaddr + 1); - - if (runaddr) - m_maincpu->set_state_int(Z80_PC, runaddr); - else - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Loaded but cannot run"); - image.message(" Loaded but cannot run"); - } - - return IMAGE_INIT_PASS; -} - -/* F4 Character Displayer */ -static const gfx_layout z1013_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 512, /* 2 x 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -static GFXDECODE_START( z1013 ) - GFXDECODE_ENTRY( "chargen", 0x0000, z1013_charlayout, 0, 1 ) -GFXDECODE_END - -/* Machine driver */ -static MACHINE_CONFIG_START( z1013, z1013_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_1MHz ) - MCFG_CPU_PROGRAM_MAP(z1013_mem) - MCFG_CPU_IO_MAP(z1013_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(z1013_state, screen_update_z1013) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", z1013) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - /* devices */ - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_1MHz) - MCFG_Z80PIO_IN_PB_CB(READ8(z1013_state, port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(z1013_state, port_b_w)) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_SNAPSHOT_ADD("snapshot", z1013_state, z1013, "z80", 0) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( z1013k76, z1013 ) - MCFG_DEVICE_REMOVE("z80pio") - MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_1MHz) - MCFG_Z80PIO_IN_PB_CB(READ8(z1013_state, k7659_port_b_r)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( z1013 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "202", "Original" ) - ROMX_LOAD( "mon_202.bin", 0xf000, 0x0800, CRC(5884edab) SHA1(c3a45ea5cc4da2b7c270068ba1e2d75916960709), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "jm", "Jens Muller version" ) - ROMX_LOAD( "mon_jm_1992.bin", 0xf000, 0x0800, CRC(186d2888) SHA1(b52ccb557c41c96bace7db4c4f5031a0cd736168), ROM_BIOS(2)) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) - ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) -ROM_END - -ROM_START( z1013a2 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mon_a2.bin", 0xf000, 0x0800, CRC(98b19b10) SHA1(97e158f589198cb96aae1567ee0aa6e47824027e)) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) - ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) -ROM_END - -ROM_START( z1013k76 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "mon_rb_k7659.bin", 0xf000, 0x1000, CRC(b3d88c45) SHA1(0bcd20338cf0706b384f40901b7f8498c6f6c320)) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) - ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) - - ROM_REGION(0x1000, "k7659",0) - ROM_LOAD ("k7659n.bin", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) -ROM_END - -ROM_START( z1013s60 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) - ROMX_LOAD( "mon_rb_s6009.bin", 0xf000, 0x1000, CRC(b37faeed) SHA1(ce2e69af5378d39284e8b3be23da50416a0b0fbe), ROM_BIOS(1)) - - ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) - ROMX_LOAD( "4k-moni-k7652.bin", 0xf000, 0x1000, CRC(a1625fce) SHA1(f0847399502b38a73ad26b38ee2d85ba04ab85ec), ROM_BIOS(2)) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) - ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) -ROM_END - -ROM_START( z1013k69 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "4k-moni-k7669.bin", 0xf000, 0x1000, CRC(09cd2a7a) SHA1(0b8500320d464469868a6b48db31105f34710c41)) - - ROM_REGION(0x1000, "chargen",0) - ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) - ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) -ROM_END -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1985, z1013, 0, 0, z1013, z1013_8x4, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (matrix 8x4)", 0 ) -COMP( 1985, z1013a2, z1013, 0, z1013, z1013_8x8, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (matrix 8x8)", 0 ) -COMP( 1985, z1013k76, z1013, 0, z1013k76, z1013, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (K7659)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1985, z1013s60, z1013, 0, z1013k76, z1013_8x8, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (K7652/S6009)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) -COMP( 1985, z1013k69, z1013, 0, z1013k76, z1013, driver_device, 0, "VEB Robotron Electronics Riesa", "Z1013 (K7669)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/z80dev.c b/src/mess/drivers/z80dev.c deleted file mode 100644 index aa9377a2ca1..00000000000 --- a/src/mess/drivers/z80dev.c +++ /dev/null @@ -1,127 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Z80 dev board (unknown) - - http://retro.hansotten.nl/index.php?page=z80-dev-kit - - 23/04/2010 Skeleton driver. - -Pasting: - 0-F : as is - MEM --> (inc) : ^ - MEM <-- (dec) : V - GO : X - To set an address, paste R0
, so R01040 to select 1040 - -Example paste: R01040^11^22^33^44^55^66^77^88^99^^R01040^ -Press the up-arrow key to confirm data has been entered. - - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "z80dev.lh" - -class z80dev_state : public driver_device -{ -public: - z80dev_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - required_device m_maincpu; - DECLARE_WRITE8_MEMBER( display_w ); - DECLARE_READ8_MEMBER( test_r ); -}; - -WRITE8_MEMBER( z80dev_state::display_w ) -{ - // ---- xxxx digit - // xxxx ---- ??? - static const UINT8 hex_7seg[] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71}; - - output_set_digit_value(offset, hex_7seg[data&0x0f]); -} - -READ8_MEMBER( z80dev_state::test_r ) -{ - return space.machine().rand(); -} - -static ADDRESS_MAP_START(z80dev_mem, AS_PROGRAM, 8, z80dev_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x1000, 0x10ff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z80dev_io , AS_IO, 8, z80dev_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK (0xff) - AM_RANGE(0x20, 0x20) AM_READ_PORT("LINE0") - AM_RANGE(0x21, 0x21) AM_READ_PORT("LINE1") - AM_RANGE(0x22, 0x22) AM_READ_PORT("LINE2") - AM_RANGE(0x23, 0x23) AM_READ_PORT("LINE3") - AM_RANGE(0x20, 0x25) AM_WRITE(display_w) - - AM_RANGE(0x13, 0x13) AM_READ(test_r) -ADDRESS_MAP_END - -/* Input ports */ -INPUT_PORTS_START( z80dev ) - PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_T) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BK") PORT_CODE(KEYCODE_K) - PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEM <--") PORT_CODE(KEYCODE_DOWN) PORT_CHAR('V') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEM -->") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') - PORT_START("LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MV") PORT_CODE(KEYCODE_M) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EI") PORT_CODE(KEYCODE_I) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I/O") PORT_CODE(KEYCODE_O) - PORT_START("LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SV") PORT_CODE(KEYCODE_S) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LD") PORT_CODE(KEYCODE_L) -INPUT_PORTS_END - -static MACHINE_CONFIG_START( z80dev, z80dev_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) - MCFG_CPU_PROGRAM_MAP(z80dev_mem) - MCFG_CPU_IO_MAP(z80dev_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_z80dev) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( z80dev ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "z80dev.bin", 0x0000, 0x0800, CRC(dd5b9cd9) SHA1(97c176fcb63674f0592851b7858cb706886b5857)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, z80dev, 0, 0, z80dev, z80dev, driver_device, 0, "", "Z80 dev board", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/z80ne.c b/src/mess/drivers/z80ne.c deleted file mode 100644 index 1c0fcd7851f..00000000000 --- a/src/mess/drivers/z80ne.c +++ /dev/null @@ -1,601 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Roberto Lavarone -/****************************************************************************** - Nuova Elettronica Z80NE system driver - - Preliminary driver - - Roberto Lavarone, 2009-01-05 - - Thanks go to: - Roberto Bazzano: www.z80ne.com - - Z80NE memory map - - LX.382 CPU board - range short description - 0000-03FF RAM - 8000-83FF EPROM firmware - - LX.383 HEX keyboard and display controller for LX.384 hex keyboard and display - range short description - F0-F7 I/O 7-segment LED dual-port RAM write - F0 I/O keyboard read - F8 I/O enable single step for next instruction - - LX.385 Cassette interface - range short description - EE I/O UART Data Read/Write - EF I/O UART Status/Control - Cassette Tape Control - - LX.392 32K Memory expansion board - range short description - - - LX.389 Printer Interface - range short description - 02-03 - 06-07 - 0A-0B - 0E-0F - 12-13 - 16-17 - 1A-1B - 1E-1F - - LX.548 16K Basic eprom - range short description - 0000-3FFF EPROM firmware - - LX.388 Video Interface - range short description - EC00-EDFF RAM - EA I/O keyboard - EB I/O video retrace - - LX.529 Graphics Video and Printer Interface - range short description - 80 I/O PIO 0 port A data (ram 0) - 81 I/O PIO 0 port A control (ram 0) - 82 I/O PIO 0 port B data (printer) - 83 I/O PIO 0 port B control (printer) - 84 I/O PIO 1 port A data (ram 1) - 85 I/O PIO 1 port A control (ram 1) - 86 I/O PIO 1 port B data (keyboard) - 87 I/O PIO 1 port B control (keyboard) - 88 I/O PIO 2 port A data (ram 2) - 89 I/O PIO 2 port A control (ram 2) - 8A I/O PIO 2 port B data (printer busy + 40/80 video chars) - 8B I/O PIO 2 port B control (printer busy + 40/40 video chars) - 8C I/O SY6845 address and status register - 8D I/O SY6845 data register - 8E I/O RAM 3 character attribute - 8F I/O beeper - - LX.390 Floppy Interface - range short description - F000-F3FF EPROM firmware - D0 I/O command/status register - D1 I/O trace register - D2 I/O sector register - D3 I/O data register (write only if controller idle) - D6 I/O drive select / drive side one select - D7 I/O data register (write always) - - LX.394-395 EPROM Programmer - range short description - 9000-9FFF EPROM EPROM to be written - 8400-8FFF EPROM firmware - - -******************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "cpu/z80/z80.h" -#include "includes/z80ne.h" -#include "imagedev/flopdrv.h" -#include "formats/dmk_dsk.h" -#include "machine/ram.h" - -/* Layout */ -#include "z80ne.lh" -#include "z80net.lh" -#include "z80netb.lh" -#include "z80netf.lh" - - -/****************************************************************************** - Memory Maps -******************************************************************************/ - - -/* LX.382 CPU Board RAM */ -/* LX.382 CPU Board EPROM */ -static ADDRESS_MAP_START( z80ne_mem, AS_PROGRAM, 8, z80ne_state ) - AM_RANGE( 0x0000, 0x03ff ) AM_RAMBANK("bank1") - AM_RANGE( 0x0400, 0x7fff ) AM_RAM - AM_RANGE( 0x8000, 0x83ff ) AM_ROMBANK("bank2") - AM_RANGE( 0x8400, 0xffff ) AM_READNOP AM_WRITENOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z80net_mem, AS_PROGRAM, 8, z80ne_state ) - AM_RANGE( 0x0000, 0x03ff ) AM_RAMBANK("bank1") - AM_RANGE( 0x0400, 0x7fff ) AM_RAM - AM_RANGE( 0x8000, 0x83ff ) AM_ROMBANK("bank2") - AM_RANGE( 0x8400, 0xebff ) AM_RAM - AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_SHARE("videoram") /* (6847) */ - AM_RANGE( 0xee00, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z80netb_mem, AS_PROGRAM, 8, z80ne_state ) - AM_RANGE( 0x0000, 0x3fff ) AM_ROM - AM_RANGE( 0x4000, 0xebff ) AM_RAM - AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_SHARE("videoram") /* (6847) */ - AM_RANGE( 0xee00, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z80ne_io, AS_IO, 8, z80ne_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xee, 0xee) AM_READWRITE(lx385_data_r, lx385_data_w ) - AM_RANGE(0xef, 0xef) AM_READWRITE(lx385_ctrl_r, lx385_ctrl_w ) - AM_RANGE(0xf0, 0xff) AM_READWRITE(lx383_r, lx383_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z80net_io, AS_IO, 8, z80ne_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xea, 0xea) AM_READ(lx388_data_r ) - AM_RANGE(0xeb, 0xeb) AM_READ(lx388_read_field_sync ) - AM_RANGE(0xee, 0xee) AM_READWRITE(lx385_data_r, lx385_data_w ) - AM_RANGE(0xef, 0xef) AM_READWRITE(lx385_ctrl_r, lx385_ctrl_w ) - AM_RANGE(0xf0, 0xff) AM_READWRITE(lx383_r, lx383_w ) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z80netf_mem, AS_PROGRAM, 8, z80ne_state ) - AM_RANGE( 0x0000, 0x03ff ) AM_RAMBANK("bank1") - AM_RANGE( 0x0400, 0x3fff ) AM_RAMBANK("bank2") - AM_RANGE( 0x4000, 0x7fff ) AM_RAM - AM_RANGE( 0x8000, 0x83ff ) AM_RAMBANK("bank3") - AM_RANGE( 0x8400, 0xdfff ) AM_RAM - AM_RANGE( 0xe000, 0xebff ) AM_READNOP AM_WRITENOP - AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_SHARE("videoram") /* (6847) */ - AM_RANGE( 0xee00, 0xefff ) AM_READNOP AM_WRITENOP - AM_RANGE( 0xf000, 0xf3ff ) AM_RAMBANK("bank4") - AM_RANGE( 0xf400, 0xffff ) AM_READNOP AM_WRITENOP -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z80netf_io, AS_IO, 8, z80ne_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xd0, 0xd7) AM_READWRITE(lx390_fdc_r, lx390_fdc_w) - AM_RANGE(0xea, 0xea) AM_READ(lx388_data_r ) - AM_RANGE(0xeb, 0xeb) AM_READ(lx388_read_field_sync ) - AM_RANGE(0xee, 0xee) AM_READWRITE(lx385_data_r, lx385_data_w ) - AM_RANGE(0xef, 0xef) AM_READWRITE(lx385_ctrl_r, lx385_ctrl_w ) - AM_RANGE(0xf0, 0xff) AM_READWRITE(lx383_r, lx383_w ) -ADDRESS_MAP_END - - - -/****************************************************************************** - Input Ports -******************************************************************************/ - - -static INPUT_PORTS_START( z80ne ) -/* LX.384 Hex Keyboard and Display */ -/* - * In natural mode the CTRL key is mapped on shift - */ -PORT_START("ROW0") /* IN0 keys row 0 */ -PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 0") PORT_CODE(KEYCODE_0) //PORT_CHAR('0') PORT_CHAR('=') -PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 1") PORT_CODE(KEYCODE_1) //PORT_CHAR('1') PORT_CHAR('!') -PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 2") PORT_CODE(KEYCODE_2) //PORT_CHAR('2') PORT_CHAR('"') -PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 3") PORT_CODE(KEYCODE_3) //PORT_CHAR('3') PORT_CHAR(0x00a3) // ?? -PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 4") PORT_CODE(KEYCODE_4) //PORT_CHAR('4') PORT_CHAR('$') -PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 5") PORT_CODE(KEYCODE_5) //PORT_CHAR('5') PORT_CHAR('%') -PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 6") PORT_CODE(KEYCODE_6) //PORT_CHAR('6') PORT_CHAR('&') -PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 7") PORT_CODE(KEYCODE_7) //PORT_CHAR('7') PORT_CHAR('/') - -PORT_START("ROW1") /* IN1 keys row 1 */ -PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 8") PORT_CODE(KEYCODE_8) //PORT_CHAR('8') PORT_CHAR('(') -PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 9") PORT_CODE(KEYCODE_9) //PORT_CHAR('9') PORT_CHAR(')') -PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 A") PORT_CODE(KEYCODE_A) //PORT_CHAR('a') PORT_CHAR('A') -PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 B") PORT_CODE(KEYCODE_B) //PORT_CHAR('b') PORT_CHAR('B') -PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 C") PORT_CODE(KEYCODE_C) //PORT_CHAR('c') PORT_CHAR('C') -PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 D") PORT_CODE(KEYCODE_D) //PORT_CHAR('d') PORT_CHAR('D') -PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 E") PORT_CODE(KEYCODE_E) //PORT_CHAR('e') PORT_CHAR('E') -PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 F") PORT_CODE(KEYCODE_F) //PORT_CHAR('f') PORT_CHAR('F') - -PORT_START("CTRL") /* CONTROL key */ -PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) -PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) -PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) //PORT_CHAR(UCHAR_SHIFT_1) -PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) -PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) -PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) -PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - -PORT_START("RST") /* RESET key */ -PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, z80ne_state, z80ne_reset, NULL) - -/* Settings */ -PORT_START("LX.385") -PORT_CONFNAME(0x07, 0x01 , "LX.385 Cassette: P1,P3 Data Rate") -PORT_CONFSETTING( 0x01, "A-B: 300 bps") -PORT_CONFSETTING( 0x02, "A-C: 600 bps") -PORT_CONFSETTING( 0x04, "A-D: 1200 bps") -PORT_CONFNAME( 0x08, 0x00, "LX.385: P4 Parity Check") -PORT_CONFSETTING( 0x00, "Parity Check Enabled") -PORT_CONFSETTING( 0x08, "Parity Check Disabled") - -INPUT_PORTS_END - - -static INPUT_PORTS_START( z80net ) - -PORT_INCLUDE( z80ne ) - -/* LX.388 Keyboard BREAK key */ -PORT_START("LX388_BRK") -PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_CHANGED_MEMBER(DEVICE_SELF, z80ne_state, z80ne_nmi, NULL) - -/* LX.388 Keyboard (Encoded by KR2376) */ - -PORT_START("X0") -PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED ) - -PORT_START("X1") -PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED ) - - -PORT_START("X2") -PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') -PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') -PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('_') - -PORT_START("X3") -PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') -PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') -PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') -PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('`') PORT_CHAR('@') -PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_NAME("Del") -PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') -PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') -PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_NAME("CR") -PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(10) PORT_NAME("LF") -PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED ) - -PORT_START("X4") -PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') -PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') -PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') -PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') -PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') -PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') -PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') -PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') -PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') -PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') -PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - -PORT_START("X5") -PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') -PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') -PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') -PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') -PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('c') PORT_CHAR('G') -PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') -PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') -PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') -PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') -PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED ) -PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - - -PORT_START("X6") -PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') -PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') -PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') -PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') -PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') -PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') -PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') -PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') -PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - -PORT_START("X7") -PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') -PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') -PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') -PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') -PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') -PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') -PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') -PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') -PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') -PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') -PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - -PORT_START("MODIFIERS") -PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) -PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - -INPUT_PORTS_END - - -static INPUT_PORTS_START( z80netf ) - -PORT_INCLUDE( z80net ) - -/* Settings */ -PORT_START("CONFIG") -PORT_CONFNAME(0x07, 0x01, "Boot EPROM") -PORT_CONFSETTING( 0x01, "EP382 Hex Monitor") -PORT_CONFSETTING( 0x02, "EP548 16k BASIC") -PORT_CONFSETTING( 0x03, "EP390 Boot Loader for 5.5k floppy BASIC") -PORT_CONFSETTING( 0x04, "EP1390 Boot Loader for NE DOS 1.0/1.5") -PORT_CONFSETTING( 0x05, "EP2390 Boot Loader for NE DOS G.1") -PORT_BIT(0xf8, 0xf8, IPT_UNUSED) - -INPUT_PORTS_END - - - - -/****************************************************************************** - Machine Drivers -******************************************************************************/ -#if 0 -static const UINT32 lx388palette[] = -{ - rgb_t(0x00, 0xff, 0x00), /* GREEN */ - rgb_t(0x00, 0xff, 0x00), /* YELLOW in original, here GREEN */ - rgb_t(0x00, 0x00, 0xff), /* BLUE */ - rgb_t(0xff, 0x00, 0x00), /* RED */ - rgb_t(0xff, 0xff, 0xff), /* BUFF */ - rgb_t(0x00, 0xff, 0xff), /* CYAN */ - rgb_t(0xff, 0x00, 0xff), /* MAGENTA */ - rgb_t(0xff, 0x80, 0x00), /* ORANGE */ - - rgb_t(0x00, 0x20, 0x00), /* BLACK in original, here DARK green */ - rgb_t(0x00, 0xff, 0x00), /* GREEN */ - rgb_t(0x00, 0x00, 0x00), /* BLACK */ - rgb_t(0xff, 0xff, 0xff), /* BUFF */ - - rgb_t(0x00, 0x20, 0x00), /* ALPHANUMERIC DARK GREEN */ - rgb_t(0x00, 0xff, 0x00), /* ALPHANUMERIC BRIGHT GREEN */ - rgb_t(0x40, 0x10, 0x00), /* ALPHANUMERIC DARK ORANGE */ - rgb_t(0xff, 0xc4, 0x18) /* ALPHANUMERIC BRIGHT ORANGE */ -}; -#endif - -FLOPPY_FORMATS_MEMBER( z80ne_state::floppy_formats ) - FLOPPY_DMK_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( z80ne_floppies ) - SLOT_INTERFACE("sssd", FLOPPY_525_SSSD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( z80ne, z80ne_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ) - MCFG_CPU_PROGRAM_MAP(z80ne_mem) - MCFG_CPU_IO_MAP(z80ne_io) - - MCFG_MACHINE_START_OVERRIDE(z80ne_state,z80ne) - MCFG_MACHINE_RESET_OVERRIDE(z80ne_state,z80ne) - - MCFG_DEVICE_ADD( "ay_3_1015", AY31015, 0 ) - MCFG_AY31015_TX_CLOCK(4800.0) - MCFG_AY31015_RX_CLOCK(4800.0) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_CASSETTE_ADD( "cassette2" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_DEFAULT_LAYOUT(layout_z80ne) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( z80net, z80ne ) - - MCFG_CPU_MODIFY("z80ne") - MCFG_CPU_PROGRAM_MAP(z80net_mem) - MCFG_CPU_IO_MAP(z80net_io) - - MCFG_MACHINE_START_OVERRIDE(z80ne_state, z80net ) - MCFG_MACHINE_RESET_OVERRIDE(z80ne_state, z80net ) - - MCFG_DEVICE_ADD("lx388_kr2376", KR2376, 50000) - - /* video hardware */ - MCFG_SCREEN_MC6847_PAL_ADD("lx388", "mc6847") - - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_INPUT_CALLBACK(READ8(z80ne_state, lx388_mc6847_videoram_r)) - // AG = GND, GM2 = GND, GM1 = GND, GM0 = GND, CSS = GND - // other lines not connected - - MCFG_DEFAULT_LAYOUT(layout_z80net) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("1K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( z80netb, z80ne_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ) - MCFG_CPU_PROGRAM_MAP(z80netb_mem) - MCFG_CPU_IO_MAP(z80net_io) - - MCFG_MACHINE_START_OVERRIDE(z80ne_state,z80netb) - MCFG_MACHINE_RESET_OVERRIDE(z80ne_state,z80netb) - - MCFG_DEVICE_ADD( "ay_3_1015", AY31015, 0 ) - MCFG_AY31015_TX_CLOCK(4800.0) - MCFG_AY31015_RX_CLOCK(4800.0) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_CASSETTE_ADD( "cassette2" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_DEVICE_ADD("lx388_kr2376", KR2376, 50000) - - /* video hardware */ - MCFG_SCREEN_MC6847_PAL_ADD("lx388", "mc6847") - - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_INPUT_CALLBACK(READ8(z80ne_state, lx388_mc6847_videoram_r)) - // AG = GND, GM2 = GND, GM1 = GND, GM0 = GND, CSS = GND - // other lines not connected - - MCFG_DEFAULT_LAYOUT(layout_z80netb) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("1K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_START( z80netf, z80ne_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ) - MCFG_CPU_PROGRAM_MAP(z80netf_mem) - MCFG_CPU_IO_MAP(z80netf_io) - - MCFG_MACHINE_START_OVERRIDE(z80ne_state,z80netf) - MCFG_MACHINE_RESET_OVERRIDE(z80ne_state,z80netf) - - MCFG_DEVICE_ADD( "ay_3_1015", AY31015, 0 ) - MCFG_AY31015_TX_CLOCK(4800.0) - MCFG_AY31015_RX_CLOCK(4800.0) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_CASSETTE_ADD( "cassette2" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) - - MCFG_DEVICE_ADD("lx388_kr2376", KR2376, 50000) - - /* video hardware */ - MCFG_SCREEN_MC6847_PAL_ADD("lx388", "mc6847") - - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL_4_433619MHz) - MCFG_MC6847_INPUT_CALLBACK(READ8(z80ne_state, lx388_mc6847_videoram_r)) - // AG = GND, GM2 = GND, GM1 = GND, GM0 = GND, CSS = GND - // other lines not connected - - MCFG_FD1771_ADD("wd1771", XTAL_2MHz / 2) - MCFG_FLOPPY_DRIVE_ADD("wd1771:0", z80ne_floppies, "sssd", z80ne_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1771:1", z80ne_floppies, "sssd", z80ne_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1771:2", z80ne_floppies, NULL, z80ne_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd1771:3", z80ne_floppies, NULL, z80ne_state::floppy_formats) - - MCFG_DEFAULT_LAYOUT(layout_z80netf) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("56K") -MACHINE_CONFIG_END - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - - -ROM_START( z80ne ) - ROM_REGION(0x20000, "z80ne", 0) - ROM_LOAD( "ep382.ic5", 0x14000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) ) -ROM_END - -ROM_START( z80net ) - ROM_REGION(0x20000, "z80ne", 0) - ROM_LOAD( "ep382.ic5", 0x14000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) ) -ROM_END - -ROM_START( z80netb ) -/* - * 16k Basic - */ - ROM_REGION(0x10000, "z80ne", 0) - ROM_LOAD( "548-1.ic1", 0x0000, 0x0800, CRC(868cad39) SHA1(0ea8af010786a080f823a879a4211f5712d260da) ) - ROM_LOAD( "548-2.ic2", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0) ) - ROM_LOAD( "548-3.ic3", 0x1000, 0x0800, CRC(9c1fe511) SHA1(ff5b6e49a137c2ff9cb760c39bfd85ce4b52bb7d) ) - ROM_LOAD( "548-4.ic4", 0x1800, 0x0800, CRC(cb5e0de3) SHA1(0beaa8927faaf61f6c3fc0ea1d3d5670f901aae3) ) - ROM_LOAD( "548-5.ic5", 0x2000, 0x0800, CRC(0bd4559c) SHA1(e736a3124819ffb43e96a8114cd188f18d538053) ) - ROM_LOAD( "548-6.ic6", 0x2800, 0x0800, CRC(6d663034) SHA1(57588be4e360658dbb313946d7a608e36c1fdd68) ) - ROM_LOAD( "548-7.ic7", 0x3000, 0x0800, CRC(0bab06c0) SHA1(d52f1519c798e91f25648e996b1db174d90ce0f5) ) - ROM_LOAD( "548-8.ic8", 0x3800, 0x0800, CRC(f381b594) SHA1(2de7a8941ba48d463974c73d62e994d3cbe2868d) ) -ROM_END - -ROM_START( z80netf ) - ROM_REGION(0x20000, "z80ne", 0) /* 64k for code 64k for banked code */ - /* ep548 banked at 0x0000 - 0x3FFF */ - ROM_LOAD( "548-1.ic1", 0x10000, 0x0800, CRC(868cad39) SHA1(0ea8af010786a080f823a879a4211f5712d260da) ) - ROM_LOAD( "548-2.ic2", 0x10800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0) ) - ROM_LOAD( "548-3.ic3", 0x11000, 0x0800, CRC(9c1fe511) SHA1(ff5b6e49a137c2ff9cb760c39bfd85ce4b52bb7d) ) - ROM_LOAD( "548-4.ic4", 0x11800, 0x0800, CRC(cb5e0de3) SHA1(0beaa8927faaf61f6c3fc0ea1d3d5670f901aae3) ) - ROM_LOAD( "548-5.ic5", 0x12000, 0x0800, CRC(0bd4559c) SHA1(e736a3124819ffb43e96a8114cd188f18d538053) ) - ROM_LOAD( "548-6.ic6", 0x12800, 0x0800, CRC(6d663034) SHA1(57588be4e360658dbb313946d7a608e36c1fdd68) ) - ROM_LOAD( "548-7.ic7", 0x13000, 0x0800, CRC(0bab06c0) SHA1(d52f1519c798e91f25648e996b1db174d90ce0f5) ) - ROM_LOAD( "548-8.ic8", 0x13800, 0x0800, CRC(f381b594) SHA1(2de7a8941ba48d463974c73d62e994d3cbe2868d) ) - - /* ep382 - banked at 0x0000 - 0x03FF */ - ROM_LOAD( "ep382.ic5", 0x14000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) ) - - /* ep390 - banked at 0x0000 - 0x03FF */ - ROM_LOAD( "ep390.ic6", 0x14400, 0x0400, CRC(e4dd7de9) SHA1(523caa97112a9e67cc078c1a70ceee94ec232093) ) - /* ep1390 - banked at 0x0000 - 0x03FF */ - ROM_LOAD( "ep1390.ic6", 0x14800, 0x0400, CRC(dc2cbc1d) SHA1(e23418b8f8261a17892f3a73ec09c72bb02e1d0b) ) - /* ep2390 - banked at 0x0000 - 0x03FF */ - ROM_LOAD( "ep2390.ic6", 0x14C00, 0x0400, CRC(28d28eee) SHA1(b80f75c1ac4905ae369ecbc9b9ce120cc85502ed) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, z80ne, 0, 0, z80ne, z80ne, z80ne_state, z80ne, "Nuova Elettronica", "Z80NE", MACHINE_NO_SOUND_HW) -COMP( 1980, z80net, z80ne, 0, z80net, z80net, z80ne_state, z80net, "Nuova Elettronica", "Z80NE + LX.388", MACHINE_NO_SOUND_HW) -COMP( 1980, z80netb, z80ne, 0, z80netb, z80net, z80ne_state, z80netb, "Nuova Elettronica", "Z80NE + LX.388 + Basic 16k", MACHINE_NO_SOUND_HW) -COMP( 1980, z80netf, z80ne, 0, z80netf, z80netf, z80ne_state, z80netf, "Nuova Elettronica", "Z80NE + LX.388 + LX.390", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/z88.c b/src/mess/drivers/z88.c deleted file mode 100644 index 4dcef312899..00000000000 --- a/src/mess/drivers/z88.c +++ /dev/null @@ -1,758 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/****************************************************************************** - - z88.c - - z88 Notepad computer - - system driver - - TODO: - - speaker controlled by txd - - expansion interface - - serial port - - Kevin Thacker [MESS driver] - -*******************************************************************************/ - -#include "includes/z88.h" - - -/* Assumption: - -all banks can access the same memory blocks in the same way. -bank 0 is special. If a bit is set in the com register, -the lower 8k is replaced with the rom. Bank 0 has been split -into 2 8k chunks, and all other banks into 16k chunks. -I wanted to handle all banks in the code below, and this -explains why the extra checks are done - - - bank 0 0x0000-0x3FFF - bank 1 0x4000-0x7FFF - bank 2 0x8000-0xBFFF - bank 3 0xC000-0xFFFF - - pages 0x00 - 0x1f internal ROM - pages 0x20 - 0x3f 512KB internal RAM - pages 0x40 - 0x7f Slot 1 - pages 0x80 - 0xbf Slot 2 - pages 0xc0 - 0xff Slot 3 - -*/ - -// cartridges read -READ8_MEMBER(z88_state::bank0_cart_r) { return m_carts[m_bank[0].slot]->read(space, (m_bank[0].page<<14) + offset); } -READ8_MEMBER(z88_state::bank1_cart_r) { return m_carts[m_bank[1].slot]->read(space, (m_bank[1].page<<14) + offset); } -READ8_MEMBER(z88_state::bank2_cart_r) { return m_carts[m_bank[2].slot]->read(space, (m_bank[2].page<<14) + offset); } -READ8_MEMBER(z88_state::bank3_cart_r) { return m_carts[m_bank[3].slot]->read(space, (m_bank[3].page<<14) + offset); } - -// cartridges write -WRITE8_MEMBER(z88_state::bank0_cart_w) { m_carts[m_bank[0].slot]->write(space, (m_bank[0].page<<14) + offset, data); } -WRITE8_MEMBER(z88_state::bank1_cart_w) { m_carts[m_bank[1].slot]->write(space, (m_bank[1].page<<14) + offset, data); } -WRITE8_MEMBER(z88_state::bank2_cart_w) { m_carts[m_bank[2].slot]->write(space, (m_bank[2].page<<14) + offset, data); } -WRITE8_MEMBER(z88_state::bank3_cart_w) { m_carts[m_bank[3].slot]->write(space, (m_bank[3].page<<14) + offset, data); } - - -UPD65031_MEMORY_UPDATE(z88_state::bankswitch_update) -{ - char bank_tag[6]; - sprintf(bank_tag, "bank%d", bank + 2); - - // bank 0 is always even - if (bank == 0) page &= 0xfe; - - if (page < 0x20) // internal ROM - { - // install read bank - if (m_bank_type[bank] != Z88_BANK_ROM) - { - m_maincpu->space(AS_PROGRAM).install_read_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag); - m_maincpu->space(AS_PROGRAM).unmap_write(bank<<14, (bank<<14) + 0x3fff); - m_bank_type[bank] = Z88_BANK_ROM; - } - - membank(bank_tag)->set_entry(page); - } - else if (page < 0x40) // internal RAM - { - if((page & 0x1f) < (m_ram->size()>>14)) - { - // install readwrite bank - if (m_bank_type[bank] != Z88_BANK_RAM) - { - m_maincpu->space(AS_PROGRAM).install_readwrite_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag); - m_bank_type[bank] = Z88_BANK_RAM; - } - - // set the bank - membank(bank_tag)->set_entry(page); - } - else - { - if (m_bank_type[bank] != Z88_BANK_UNMAP) - { - m_maincpu->space(AS_PROGRAM).unmap_readwrite(bank<<14, (bank<<14) + 0x3fff); - m_bank_type[bank] = Z88_BANK_UNMAP; - } - } - } - else // cartridges - { - m_bank[bank].slot = (page >> 6) & 3; - m_bank[bank].page = page & 0x3f; - - if (m_bank_type[bank] != Z88_BANK_CART) - { - switch (bank) - { - case 0: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0000, 0x3fff, 0, 0, read8_delegate(FUNC(z88_state::bank0_cart_r), this), write8_delegate(FUNC(z88_state::bank0_cart_w), this)); - break; - case 1: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(z88_state::bank1_cart_r), this), write8_delegate(FUNC(z88_state::bank1_cart_w), this)); - break; - case 2: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(z88_state::bank2_cart_r), this), write8_delegate(FUNC(z88_state::bank2_cart_w), this)); - break; - case 3: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(z88_state::bank3_cart_r), this), write8_delegate(FUNC(z88_state::bank3_cart_w), this)); - break; - } - - m_bank_type[bank] = Z88_BANK_CART; - } - } - - - // override setting for lower 8k of bank 0 - if (bank == 0) - { - m_maincpu->space(AS_PROGRAM).install_read_bank(0, 0x1fff, "bank1"); - - // enable RAM - if (rams) - m_maincpu->space(AS_PROGRAM).install_write_bank(0, 0x1fff, "bank1"); - else - m_maincpu->space(AS_PROGRAM).unmap_write(0, 0x1fff); - - membank("bank1")->set_entry(rams & 1); - } -} - - -static ADDRESS_MAP_START(z88_mem, AS_PROGRAM, 8, z88_state ) - AM_RANGE(0x0000, 0x1fff) AM_READWRITE_BANK("bank1") - AM_RANGE(0x2000, 0x3fff) AM_READWRITE_BANK("bank2") - AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank3") - AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank4") - AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("bank5") -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z88_io, AS_IO, 8, z88_state ) - AM_RANGE(0x0000, 0xffff) AM_DEVREADWRITE("blink", upd65031_device, read, write) -ADDRESS_MAP_END - - - -/* -------------------------------------------------------------------------- - | D7 D6 D5 D4 D3 D2 D1 D0 -------------------------------------------------------------------------- -A15 (#7) | RSH SQR ESC INDEX CAPS . / ?? -A14 (#6) | HELP LSH TAB DIA MENU , ; ' -A13 (#5) | [ SPACE 1 Q A Z L 0 -A12 (#4) | ] LFT 2 W S X M P -A11 (#3) | - RGT 3 E D C K 9 -A10 (#2) | = DWN 4 R F V J O -A9 (#1) | \ UP 5 T G B U I -A8 (#0) | DEL ENTER 6 Y H N 7 8 -------------------------------------------------------------------------- - -2008-05 FP: -Small note about natural keyboard: currently, -- "Square" is mapped to 'F1' -- "Diamond" is mapped to 'Left Control' -- "Index" is mapped to 'F2' -- "Menu" is mapped to 'F3' -- "Help" is mapped to 'F4' -*/ - -static INPUT_PORTS_START( z88 ) - PORT_START("LINE0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - - PORT_START("LINE1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - - PORT_START("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("LINE3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - - PORT_START("LINE4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - - PORT_START("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - - PORT_START("LINE6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Diamond") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - - PORT_START("LINE7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Square") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Index") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\xA3') PORT_CHAR('~') -INPUT_PORTS_END - -static INPUT_PORTS_START( z88de ) - PORT_INCLUDE(z88) - - PORT_MODIFY("LINE0") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(0x00B0) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR('{') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR('}') - - PORT_MODIFY("LINE1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('~') - - PORT_MODIFY("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('\'') PORT_CHAR('`') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR('|') - - PORT_MODIFY("LINE3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x00DF) PORT_CHAR('?') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00A7) PORT_CHAR(0x00A3) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR('[') - - PORT_MODIFY("LINE4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_CHAR('@') - - PORT_MODIFY("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR('\\') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR(']') - - PORT_MODIFY("LINE6") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) - - PORT_MODIFY("LINE7") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('^') -INPUT_PORTS_END - -static INPUT_PORTS_START( z88fr ) - PORT_INCLUDE(z88) - - PORT_MODIFY("LINE0") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR(0x00A7) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR(0x00E8) PORT_CHAR('7') PORT_CHAR('{') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('!') PORT_CHAR('8') PORT_CHAR('}') - - PORT_MODIFY("LINE1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') PORT_CHAR('~') - - PORT_MODIFY("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') PORT_CHAR('|') - - PORT_MODIFY("LINE3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(')') PORT_CHAR(0x00B0) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('\"') PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR(0x00E7) PORT_CHAR('9') PORT_CHAR('[') - - PORT_MODIFY("LINE4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR(0x00E9) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') - - PORT_MODIFY("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('*') PORT_CHAR(0x00A8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('&') PORT_CHAR('1') PORT_CHAR('\\') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(0x00E0) PORT_CHAR('0') PORT_CHAR(']') - - PORT_MODIFY("LINE6") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('.') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F9) PORT_CHAR('%') - - PORT_MODIFY("LINE7") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('$') PORT_CHAR(0x00A3) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) -INPUT_PORTS_END - -static INPUT_PORTS_START( z88es ) - PORT_INCLUDE(z88) - - PORT_MODIFY("LINE0") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('/') PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR('{') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR('}') - - PORT_MODIFY("LINE1") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('~') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0x00E7) PORT_CHAR(0x00C7) - - PORT_MODIFY("LINE2") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR('|') - - PORT_MODIFY("LINE3") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(0x00A3) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('[') - - PORT_MODIFY("LINE4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(0x00BF) PORT_CHAR('@') - - PORT_MODIFY("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR(0x00A1) PORT_CHAR('\\') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(']') - - PORT_MODIFY("LINE6") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0x00F1) PORT_CHAR(0x00D1) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - - PORT_MODIFY("LINE7") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') -INPUT_PORTS_END - -static INPUT_PORTS_START( z88it ) - PORT_INCLUDE(z88) - - PORT_MODIFY("LINE0") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - - PORT_MODIFY("LINE1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0x00F9) PORT_CHAR('|') PORT_CHAR('\\') - - PORT_MODIFY("LINE3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('{') - - PORT_MODIFY("LINE4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00EC) PORT_CHAR('~') PORT_CHAR(']') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(0x00A3) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - - PORT_MODIFY("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E8) PORT_CHAR(0x00E9) PORT_CHAR('[') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR('}') - - PORT_MODIFY("LINE6") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00F2) PORT_CHAR('\'') PORT_CHAR('@') - - PORT_MODIFY("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00E0) PORT_CHAR('\"') PORT_CHAR('`') -INPUT_PORTS_END - -static INPUT_PORTS_START( z88se ) - PORT_INCLUDE(z88) - - PORT_MODIFY("LINE1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_MODIFY("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('+') PORT_CHAR('>') - - PORT_MODIFY("LINE3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('<') - - PORT_MODIFY("LINE4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') PORT_CHAR('`') - - PORT_MODIFY("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) PORT_CHAR('\\') - - PORT_MODIFY("LINE6") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) PORT_CHAR('{') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) PORT_CHAR('}') - - PORT_MODIFY("LINE7") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00A3) PORT_CHAR('~') -INPUT_PORTS_END - -static INPUT_PORTS_START( z88no ) - PORT_INCLUDE(z88se) - - PORT_MODIFY("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) PORT_CHAR('}') - - PORT_MODIFY("LINE6") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E6) PORT_CHAR(0x00C6) PORT_CHAR('{') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00F8) PORT_CHAR(0x00D8) PORT_CHAR('|') -INPUT_PORTS_END - -static INPUT_PORTS_START( z88ch ) - PORT_INCLUDE(z88) - - PORT_MODIFY("LINE0") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR('^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR('{') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR('[') - - PORT_MODIFY("LINE1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('~') - - PORT_MODIFY("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00FA) PORT_CHAR(0x00F9) PORT_CHAR('`') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x00E7) PORT_CHAR(0x00C7) - - PORT_MODIFY("LINE3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('?') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('*') PORT_CHAR('#') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(']') - - PORT_MODIFY("LINE4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00A8) PORT_CHAR('!') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_CHAR('@') - - PORT_MODIFY("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E8) PORT_CHAR(0x00FC) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('+') PORT_CHAR('\\') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR('}') - - PORT_MODIFY("LINE6") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00E9) PORT_CHAR(0x00F6) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0x00E0) PORT_CHAR(0x00E4) - - PORT_MODIFY("LINE7") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('$') PORT_CHAR(0x00A3) -INPUT_PORTS_END - -static INPUT_PORTS_START( z88tr ) - PORT_INCLUDE(z88) - - PORT_MODIFY("LINE0") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('?') PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR('{') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR('}') - - PORT_MODIFY("LINE1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') PORT_CHAR('`') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('<') - - PORT_MODIFY("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('^') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR('~') - - PORT_MODIFY("LINE3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(0x00A3) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('[') - - PORT_MODIFY("LINE4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('&') PORT_CHAR('@') - - PORT_MODIFY("LINE5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x011F) PORT_CHAR(0x011E) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR('|') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(']') - - PORT_MODIFY("LINE6") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x015F) PORT_CHAR(0x015E) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0x0131) PORT_CHAR(0x0130) - - PORT_MODIFY("LINE7") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0x00E7) PORT_CHAR(0x00C7) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') -INPUT_PORTS_END - - -void z88_state::machine_start() -{ - m_bios = (UINT8*)memregion("bios")->base(); - m_ram_base = (UINT8*)m_ram->pointer(); - - // configure the memory banks - membank("bank1")->configure_entry(0, m_bios); - membank("bank1")->configure_entry(1, m_ram_base); - membank("bank2")->configure_entries(0, 32, m_bios, 0x4000); - membank("bank3")->configure_entries(0, 32, m_bios, 0x4000); - membank("bank4")->configure_entries(0, 32, m_bios, 0x4000); - membank("bank5")->configure_entries(0, 32, m_bios, 0x4000); - membank("bank2")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000); - membank("bank3")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000); - membank("bank4")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000); - membank("bank5")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000); - - m_carts[1] = machine().device("slot1"); - m_carts[2] = machine().device("slot2"); - m_carts[3] = machine().device("slot3"); -} - -void z88_state::machine_reset() -{ - m_bank_type[0] = m_bank_type[1] = m_bank_type[2] = m_bank_type[3] = 0; -} - -READ8_MEMBER(z88_state::kb_r) -{ - UINT8 data = 0xff; - - if (!(offset & 0x80)) - data &= ioport("LINE7")->read(); - - if (!(offset & 0x40)) - data &= ioport("LINE6")->read(); - - if (!(offset & 0x20)) - data &= ioport("LINE5")->read(); - - if (!(offset & 0x10)) - data &= ioport("LINE4")->read(); - - if (!(offset & 0x08)) - data &= ioport("LINE3")->read(); - - if (!(offset & 0x04)) - data &= ioport("LINE2")->read(); - - if (!(offset & 0x02)) - data &= ioport("LINE1")->read(); - - if (!(offset & 0x01)) - data &= ioport("LINE0")->read(); - - return data; -} - -static SLOT_INTERFACE_START(z88_cart) - SLOT_INTERFACE("32krom", Z88_32K_ROM) // 32KB ROM cart - SLOT_INTERFACE("128krom", Z88_128K_ROM) // 128KB ROM cart - SLOT_INTERFACE("256krom", Z88_256K_ROM) // 256KB ROM cart - SLOT_INTERFACE("32kram", Z88_32K_RAM) // 32KB RAM cart - SLOT_INTERFACE("128kram", Z88_128K_RAM) // 128KB RAM cart - SLOT_INTERFACE("512kram", Z88_512K_RAM) // 512KB RAM cart - SLOT_INTERFACE("1024kram",Z88_1024K_RAM) // 1024KB RAM cart - SLOT_INTERFACE("1024kflash",Z88_1024K_FLASH) // 1024KB Flash cart -SLOT_INTERFACE_END - -static MACHINE_CONFIG_START( z88, z88_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_9_8304MHz/3) // divided by 3 through the uPD65031 - MCFG_CPU_PROGRAM_MAP(z88_mem) - MCFG_CPU_IO_MAP(z88_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(Z88_SCREEN_WIDTH, Z88_SCREEN_HEIGHT) - MCFG_SCREEN_VISIBLE_AREA(0, (Z88_SCREEN_WIDTH - 1), 0, (Z88_SCREEN_HEIGHT - 1)) - MCFG_SCREEN_UPDATE_DEVICE("blink", upd65031_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", Z88_NUM_COLOURS) - MCFG_PALETTE_INIT_OWNER(z88_state, z88) - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_DEVICE_ADD("blink", UPD65031, XTAL_9_8304MHz) - MCFG_UPD65031_KB_CALLBACK(READ8(z88_state, kb_r)) - MCFG_UPD65031_INT_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_UPD65031_NMI_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_UPD65031_SPKR_CALLBACK(DEVWRITELINE("speaker", speaker_sound_device, level_w)) - MCFG_UPD65031_SCR_UPDATE_CB(z88_state, lcd_update) - MCFG_UPD65031_MEM_UPDATE_CB(z88_state, bankswitch_update) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("128K") - MCFG_RAM_EXTRA_OPTIONS("32K,64K,256K,512k") - - // cartridges - MCFG_DEVICE_ADD("slot1", Z88CART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) - MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) - MCFG_DEVICE_ADD("slot2", Z88CART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) - MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) - MCFG_DEVICE_ADD("slot3", Z88CART_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) - MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START(z88) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_DEFAULT_BIOS("v40uk") - ROM_SYSTEM_BIOS( 0, "v220uk", "Version 2.20 UK") - ROMX_LOAD("z88v220.rom", 0x00000, 0x20000, CRC(0ae7d0fc) SHA1(5d89e8d98d2cc0acb8cd42dbfca601b7bd09c51e), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "v30uk", "Version 3.0 UK") - ROMX_LOAD("z88v300.rom" , 0x00000, 0x20000, CRC(802cb9aa) SHA1(ceb688025b79454cf229cae4dbd0449df2747f79), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 2, "v40uk", "Version 4.0 UK") - ROMX_LOAD("z88v400.rom", 0x00000, 0x20000, CRC(1356d440) SHA1(23c63ceced72d0a9031cba08d2ebc72ca336921d), ROM_BIOS(3) ) -ROM_END - -ROM_START(z88de) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v318de", "Version 3.18 German") - ROMX_LOAD("z88v318de.rom", 0x00000, 0x20000, CRC(d7eaf937) SHA1(5acbfa324e2a6582ffd1af5f2e28086318d2ed27), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88es) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v319es", "Version 3.19 Spanish") - ROMX_LOAD("z88v319es.rom", 0x00000, 0x20000, CRC(7a08af73) SHA1(a99a7581f47a032e1ec3b4f534c06f00f67647df), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88fr) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v326fr", "Version 3.26 French") - ROMX_LOAD("z88v326fr.rom", 0x00000, 0x20000, CRC(218fbb72) SHA1(6e4c590f40f5b14d66e6559807f538fb5fa91474), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88it) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v323it", "Version 3.23 Italian") - ROMX_LOAD("z88v323it.rom", 0x00000, 0x20000, CRC(13f54308) SHA1(29bda04ae803f2dff6357d81b3894db669d12dbf), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88se) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v250se", "Version 2.50 Swedish") - ROMX_LOAD("z88v250sw.rom", 0x00000, 0x20000, CRC(dad01338) SHA1(3825eee346b692b16215a500250cc0c76d2d8f0b), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88fi) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v401fi", "Version 4.01 Finnish") - ROMX_LOAD("z88v401fi.rom", 0x00000, 0x20000, CRC(ecd7f3f6) SHA1(bf8d3e083f1959e5a0d7e9c8d2ad0c14abd46381), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88no) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v260no", "Version 2.60 Norwegian") - ROMX_LOAD("z88v260nr.rom", 0x00000, 0x20000, CRC(293f35c8) SHA1(b68b8f5bb1f69fe7a24897933b1464dc79e96d80), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88dk) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v321dk", "Version 3.21 Danish") - ROMX_LOAD("z88v321dk.rom", 0x00000, 0x20000, CRC(baa80408) SHA1(7b0d44af2688d0fe47667e0424860aafa0948dae), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88ch) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v313ch", "Version 3.13 Swiss") - ROMX_LOAD("z88v313he.rom", 0x00000, 0x20000, CRC(a56d732c) SHA1(c2276a12d457f01a8fd2e2ac238aff2b5c3559d8), ROM_BIOS(1) ) -ROM_END - -ROM_START(z88tr) - ROM_REGION(0x80000, "bios", ROMREGION_ERASEFF) - ROM_SYSTEM_BIOS( 0, "v317tk", "Version 3.17 Turkish") - ROMX_LOAD("z88v317tk.rom", 0x00000, 0x20000, CRC(9468d677) SHA1(8d76e94f43846c736bf257d15d531c2df1e20fae), ROM_BIOS(1) ) -ROM_END - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1988, z88 , 0, 0, z88, z88 , driver_device, 0, "Cambridge Computers", "Z88" , MACHINE_NOT_WORKING) -COMP( 1988, z88de, z88, 0, z88, z88de, driver_device, 0, "Cambridge Computers", "Z88 (German)" , MACHINE_NOT_WORKING) -COMP( 1988, z88es, z88, 0, z88, z88es, driver_device, 0, "Cambridge Computers", "Z88 (Spanish)" , MACHINE_NOT_WORKING) -COMP( 1988, z88fr, z88, 0, z88, z88fr, driver_device, 0, "Cambridge Computers", "Z88 (French)" , MACHINE_NOT_WORKING) -COMP( 1988, z88it, z88, 0, z88, z88it, driver_device, 0, "Cambridge Computers", "Z88 (Italian)" , MACHINE_NOT_WORKING) -COMP( 1988, z88se, z88, 0, z88, z88se, driver_device, 0, "Cambridge Computers", "Z88 (Swedish)" , MACHINE_NOT_WORKING) -COMP( 1988, z88fi, z88, 0, z88, z88se, driver_device, 0, "Cambridge Computers", "Z88 (Finnish)" , MACHINE_NOT_WORKING) -COMP( 1988, z88no, z88, 0, z88, z88no, driver_device, 0, "Cambridge Computers", "Z88 (Norwegian)", MACHINE_NOT_WORKING) -COMP( 1988, z88dk, z88, 0, z88, z88no, driver_device, 0, "Cambridge Computers", "Z88 (Danish)" , MACHINE_NOT_WORKING) -COMP( 1988, z88ch, z88, 0, z88, z88ch, driver_device, 0, "Cambridge Computers", "Z88 (Swiss)" , MACHINE_NOT_WORKING) -COMP( 1988, z88tr, z88, 0, z88, z88tr, driver_device, 0, "Cambridge Computers", "Z88 (Turkish)" , MACHINE_NOT_WORKING) diff --git a/src/mess/drivers/z9001.c b/src/mess/drivers/z9001.c deleted file mode 100644 index 91ab13e2e03..00000000000 --- a/src/mess/drivers/z9001.c +++ /dev/null @@ -1,317 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic , Robbbert -/*************************************************************************** - - Robotron Z9001 (KC85/1) - - 12/05/2009 Skeleton driver. - 13/07/2011 Notes added. You can enter text via terminal input. - Colour and flashing added. - -The only kind of acceptable input is a filename that is in 8.3 format and -begins with a letter. It will say 'start tape'. You can press ^C here to -escape, or any key to continue. - -Some other control keys: -^B clear input line -^C break -^F toggle flashing attribute -^H backspace -^L clear screen - - -ToDo: -- cassette in -- proper keyboard -- get rid of temporary code - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80pio.h" -#include "machine/z80ctc.h" -#include "cpu/z80/z80daisy.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "sound/beep.h" - -// temporary -#include "machine/keyboard.h" - -#define KEYBOARD_TAG "keyboard" - -class z9001_state : public driver_device -{ -public: - z9001_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_framecnt(0), - m_beeper(*this, "beeper"), - m_cass(*this, "cassette"), - m_p_colorram(*this, "colorram"), - m_p_videoram(*this, "videoram") - { - } - - required_device m_maincpu; - UINT8 m_framecnt; - required_device m_beeper; - required_device m_cass; - required_shared_ptr m_p_colorram; - required_shared_ptr m_p_videoram; - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_WRITE8_MEMBER(port88_w); - DECLARE_WRITE_LINE_MEMBER(cass_w); - const UINT8 *m_p_chargen; - bool m_cassbit; - virtual void machine_reset(); - //virtual void machine_start(); - virtual void video_start(); - UINT32 screen_update_z9001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(timer_callback); -}; - -static ADDRESS_MAP_START(z9001_mem, AS_PROGRAM, 8, z9001_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0xe7ff ) AM_RAM - AM_RANGE( 0xe800, 0xebff ) AM_RAM AM_SHARE("colorram") - AM_RANGE( 0xec00, 0xefff ) AM_RAM AM_SHARE("videoram") - AM_RANGE( 0xf000, 0xffff ) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( z9001_io, AS_IO, 8, z9001_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x83) AM_MIRROR(4) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0x88, 0x8B) AM_MIRROR(4) AM_DEVREADWRITE("z80pio1", z80pio_device, read, write) - AM_RANGE(0x90, 0x93) AM_MIRROR(4) AM_DEVREADWRITE("z80pio2", z80pio_device, read, write) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( z9001 ) -INPUT_PORTS_END - -static const z80_daisy_config z9001_daisy_chain[] = -{ - { "z80pio2" }, - { "z80pio1" }, - { "z80ctc" }, - { NULL } -}; - -//Bits0,1 not connected; 2,3,4,5 go to a connector; 6 goes to 'graphics' LED; 7 goes to speaker. -WRITE8_MEMBER( z9001_state::port88_w ) -{ - m_beeper->set_state(BIT(data, 7)); -} - -WRITE_LINE_MEMBER( z9001_state::cass_w ) -{ - if (state) - { - m_cassbit ^= 1; - m_cass->output( m_cassbit ? -1.0 : +1.0); - } -} - - -// temporary (prevent freezing when you type an invalid filename) -TIMER_DEVICE_CALLBACK_MEMBER(z9001_state::timer_callback) -{ - m_maincpu->space(AS_PROGRAM).write_byte(0x006a, 0); -} - -void z9001_state::machine_reset() -{ - m_beeper->set_frequency(800); - m_maincpu->set_state_int(Z80_PC, 0xf000); -} - -void z9001_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 z9001_state::screen_update_z9001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,col,fg,bg; - UINT16 sy=0,ma=0,x; - m_framecnt++; - - for(y = 0; y < 24; y++ ) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 40; x++) - { - chr = m_p_videoram[x]; // get char in videoram - gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen - col = m_p_colorram[x]; - fg = col>>4; - bg = col&15; - - /* Check for flashing - swap bg & fg */ - if ((BIT(col, 7)) && (m_framecnt & 0x10)) - { - bg = fg; - fg = col&15; - } - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7) ? fg : bg; - *p++ = BIT(gfx, 6) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 0) ? fg : bg; - } - } - ma+=40; - } - return 0; -} - -/* F4 Character Displayer */ -static const gfx_layout z9001_charlayout = -{ - 8, 8, /* 8 x 8 characters */ - 1024, /* 4 x 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ -}; - -WRITE8_MEMBER( z9001_state::kbd_put ) -{ - m_maincpu->space(AS_PROGRAM).write_byte(0x0025, data); -} - -static GFXDECODE_START( z9001 ) - GFXDECODE_ENTRY( "chargen", 0x0000, z9001_charlayout, 0, 1 ) -GFXDECODE_END - - -static MACHINE_CONFIG_START( z9001, z9001_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_9_8304MHz / 4) - MCFG_CPU_PROGRAM_MAP(z9001_mem) - MCFG_CPU_IO_MAP(z9001_io) - MCFG_CPU_CONFIG(z9001_daisy_chain) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(40*8, 24*8) - MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 24*8-1) - MCFG_SCREEN_UPDATE_DRIVER(z9001_state, screen_update_z9001) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", z9001) - MCFG_PALETTE_ADD("palette", 16) - - /* Sound */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(z9001_state, kbd_put)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("z9001_timer", z9001_state, timer_callback, attotime::from_msec(10)) - - MCFG_DEVICE_ADD("z80pio1", Z80PIO, XTAL_9_8304MHz / 4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(z9001_state, port88_w)) - - MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_9_8304MHz / 4) // keyboard PIO - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_9_8304MHz / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(z9001_state, cass_w)) - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3)) - - MCFG_CASSETTE_ADD( "cassette" ) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( z9001 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "orig", "Original" ) - ROMX_LOAD( "os____f0.851", 0xf000, 0x1000, CRC(9fe60a92) SHA1(553609631f5eaa7d6758a73f56c613e280a5b310), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "rb20", "ROM-Bank System without menu" ) - ROMX_LOAD( "os_rb20.rom", 0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) - ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) - - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) - ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) - ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) - ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) -ROM_END - -#define rom_kc85_111 rom_z9001 - -ROM_START( kc87_10 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "orig", "Original" ) - ROMX_LOAD( "os____f0.851", 0xf000, 0x1000, CRC(9fe60a92) SHA1(553609631f5eaa7d6758a73f56c613e280a5b310), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "rb20", "ROM-Bank System without menu" ) - ROMX_LOAD( "os_rb20.rom", 0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) - ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) - - ROM_LOAD( "basic_c0.87a", 0xc000, 0x2800, CRC(c508d45e) SHA1(ea85b53e21429c4cb85cdb81b92f278a8f4eb574)) - - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) - ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) - ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) - ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) -ROM_END - -#define rom_kc87_11 rom_kc87_10 - -ROM_START( kc87_20 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_SYSTEM_BIOS( 0, "orig", "Original" ) - ROMX_LOAD( "os____f0.87b", 0xf000, 0x1000, CRC(a357d093) SHA1(b1df6b499517c8366a0795030ee800e8a258e938), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "rb20", "ROM-Bank System without menu" ) - ROMX_LOAD( "os_rb20.rom", 0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) - ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) - - ROM_LOAD( "basic_c0.87b", 0xc000, 0x2800, CRC(9e8f6380) SHA1(8ffecc64ba35c953c93738f8568c83dc6af1ae72)) - - ROM_REGION( 0x2000, "chargen", 0 ) - ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) - ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) - ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) - ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) -ROM_END - -#define rom_kc87_21 rom_kc87_20 - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, z9001, 0, 0, z9001, z9001, driver_device, 0, "Robotron", "Z9001 (KC 85/1.10)", MACHINE_NOT_WORKING ) -COMP( 1986, kc85_111, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 85/1.11", MACHINE_NOT_WORKING ) -COMP( 1987, kc87_10, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 87.10", MACHINE_NOT_WORKING ) -COMP( 1987, kc87_11, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 87.11", MACHINE_NOT_WORKING ) -COMP( 1987, kc87_20, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 87.20", MACHINE_NOT_WORKING ) -COMP( 1987, kc87_21, z9001, 0, z9001, z9001, driver_device, 0, "Robotron", "KC 87.21", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/zapcomputer.c b/src/mess/drivers/zapcomputer.c deleted file mode 100644 index a2a81a32d64..00000000000 --- a/src/mess/drivers/zapcomputer.c +++ /dev/null @@ -1,156 +0,0 @@ -// license:GPL2+ -// copyright-holders:FelipeSanches -/* - ZAP - Z80 Applications Processor - - driver by: Felipe Correa da Silva Sanches - - Based on the technical descriptions and - assembly listings of the book: - - "Build Your Own Z80 Microcomputer" - by Steve Ciarcia (1981) - published by BYTE/McGRAW-HILL - - Basic usage instructions: - SHIFT + 0: view and edit memory values - SHIFT + 1: view and edit register values - SHIFT + 2: execution mode - - For more info, please check chapter 6 "Monitor software" in the book - and/or the assembly listings of the ZAP monitor software - avaliable at appendix D. - - Currently missing features in this driver: - * hookup RS232 support - * maybe also support video terminal described in chapter 9 -*/ - -#include "includes/zapcomputer.h" -#include "zapcomputer.lh" - -static unsigned char decode7seg(int data){ - //These are bit patterns representing the conversion of 4bit values - //into the status of the segments of the 7 segment displays - //controlled by a 82S23 PROM - - unsigned char patterns[16] = { - 0x77, 0x41, 0x6e, 0x6b, - 0x59, 0x3b, 0x3f, 0x61, - 0x7f, 0x79, 0x7d, 0x1f, - 0x36, 0x4f, 0x3e, 0x3c - }; - - // Bit order for the FAIRCHILD FND-70 - // 7-SEGMENT LCD: . g f e d c b a - return BITSWAP8(patterns[data & 0x0F], 7, 3, 4, 2, 1, 0, 6, 5); -} - -WRITE8_MEMBER(zapcomp_state::display_7seg_w){ - switch (offset){ - case 0: //Port 0x05 : address HI - output_set_digit_value(0, decode7seg(data >> 4)); - output_set_digit_value(1, decode7seg(data)); - break; - case 1: //Port 0x06 : address LOW - output_set_digit_value(2, decode7seg(data >> 4)); - output_set_digit_value(3, decode7seg(data)); - break; - case 2: //Port 0x07 : data - output_set_digit_value(4, decode7seg(data >> 4)); - output_set_digit_value(5, decode7seg(data)); - break; - default: - break; - } -} - -READ8_MEMBER(zapcomp_state::keyboard_r){ - unsigned char retval = 0x00; - unsigned char special = ioport("special_keys")->read(); - unsigned int hex_keys = (ioport("hex_keys_2")->read() << 8) | ioport("hex_keys_1")->read(); - - if (special & 0x04) /* "SHIFT" key is pressed */ - retval = 0x40; /* turn on the SHIFT bit but DO NOT turn on the strobe bit */ - - if (special & 0x02) /* "NEXT" key is pressed */ - retval |= 0xA0; /* turn on the strobe & NEXT bits */ - - if (special & 0x01) /* "EXEC" key is pressed */ - retval |= 0x90; /* turn on the strobe & EXEC bit */ - - for (int i=0; i<16; i++){ - if (hex_keys & (1 << i)){ - retval |= (0x80 | i); /* provide the key index in bits 3-0 - as well as turning on the strobe bit */ - } - } - return retval; -} - -static ADDRESS_MAP_START( zapcomp_mem, AS_PROGRAM, 8, zapcomp_state ) - AM_RANGE(0x0000, 0x03ff) AM_ROM /* system monitor */ - AM_RANGE(0x0400, 0x07ff) AM_RAM /* mandatory 1 kilobyte bank #0 */ - AM_RANGE(0x0800, 0x0bff) AM_RAM /* extra 1 kilobyte bank #1 (optional) */ - AM_RANGE(0x0c00, 0x0fff) AM_RAM /* extra 1 kilobyte bank #2 (optional) */ - AM_RANGE(0x1000, 0x13ff) AM_RAM /* extra 1 kilobyte bank #3 (optional) */ - AM_RANGE(0x1400, 0x17ff) AM_RAM /* extra 1 kilobyte bank #4 (optional) */ - AM_RANGE(0x1800, 0x1bff) AM_RAM /* extra 1 kilobyte bank #5 (optional) */ - AM_RANGE(0x1c00, 0x1fff) AM_RAM /* extra 1 kilobyte bank #6 (optional) */ - AM_RANGE(0x2000, 0x23ff) AM_RAM /* extra 1 kilobyte bank #7 (optional) */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( zapcomp_io, AS_IO, 8, zapcomp_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(keyboard_r) - AM_RANGE(0x05, 0x07) AM_WRITE(display_7seg_w) -ADDRESS_MAP_END - -static INPUT_PORTS_START( zapcomp ) - PORT_START("hex_keys_1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - - PORT_START("hex_keys_2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') - - PORT_START("special_keys") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("EXEC") PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) -INPUT_PORTS_END - -void zapcomp_state::machine_start() -{ -} - -static MACHINE_CONFIG_START( zapcomp, zapcomp_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, XTAL_2MHz) - MCFG_CPU_PROGRAM_MAP(zapcomp_mem) - MCFG_CPU_IO_MAP(zapcomp_io) - - /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_zapcomputer) -MACHINE_CONFIG_END - -ROM_START( zapcomp ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD("zap.rom", 0x0000, 0x0400, CRC(cedad5d5) SHA1(576adfafbe5475004675638c1703415f8c468c6f)) -ROM_END - -// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS -COMP( 1981, zapcomp, 0, 0, zapcomp, zapcomp, driver_device, 0, "Steve Ciarcia / BYTE / McGRAW-HILL", "ZAP - Z80 Applications Processor", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mess/drivers/zaurus.c b/src/mess/drivers/zaurus.c deleted file mode 100644 index 0fe4724067f..00000000000 --- a/src/mess/drivers/zaurus.c +++ /dev/null @@ -1,1815 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/**************************************************************************************************************************************** - - Sharp Zaurus PDA skeleton driver (SL, ARM/Linux based, 4th generation) - - TODO: - - PXA-255 ID opcode fails on this - - ARM TLB look-up errors? - - RTC irq doesn't fire? - - For whatever reason, after RTC check ARM executes invalid code at 0-0x200 - - Dumps are questionable to say the least - -========================================================================================================================================= -Sharp Zaurus ------------- - -Personal Information (PI) Series --------------------------------- - -Model: Pi^2 T (proof-of-concept model) -Manufacturer: Sharp -Nickname/Series: -Demo/Press Release Date: April 1992 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 288 KB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix DSFTN mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA -Keyboard: No -Features: handwriting recognition -Note: - -Model: PI-3000 -Manufacturer: Sharp -Nickname/Series: -Release Date: October 1, 1993 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 288 KB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix DSFTN mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA -Keyboard: No -Features: handwriting recognition, external faxmodem adapter (optional) -Note: - -Model: PI-4000 -Manufacturer: Sharp -Nickname/Series: -Release Date: June 1994 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 544 KB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA -Keyboard: No -Features: handwriting recognition, external faxmodem adapter (optional), "ink capabilities"? -Note: - -Model: PI-4000FX -Manufacturer: Sharp -Nickname/Series: -Release Date: June 1994 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 544 KB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA -Keyboard: No -Features: handwriting recognition, included external faxmodem adapter -Note: - -Model: PI-5000 -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: November 1994 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: No -Features: handwriting recognition, external faxmodem adapter (optional), email, add-in software capabilities -Note: - -Model: PI-5000FX -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: November 1994 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: No -Features: handwriting recognition, included external faxmodem adapter, email, add-in software capabilities -Note: - -Model: PI-5000DA -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: November 1994 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: No -Features: handwriting recognition, email, included digital mobile phone adapter, add-in software capabilities -Note: - -Model: PI-4500 -Manufacturer: Sharp -Nickname/Series: -Release Date: January 1995 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 544 KB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: No -Features: handwriting recognition, included external faxmodem adapter, email, add-in software capabilities -Note: - -Model: PI-6000 -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: August 25, 1995 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB -Flash (Internal): none -Other Storage: none -Slots: Flash IC card slot -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: No -Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email, add-in software capabilities -Note: - -Model: PI-6000FX -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: August 25, 1995 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB -Flash (Internal): none -Other Storage: none -Slots: Flash IC card slot -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: No -Features: upgraded handwriting recognition (over PI-4xxx/5xxx), included external faxmodem adapter, email -Note: - -Model: PI-6000DA -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: December 16, 1995 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB -Flash (Internal): none -Slots: Flash IC card slot -Other Storage: none -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: No -Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email, included digital mobile phone adapter -Note: - -Model: PI-7000 -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: February 1996 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB -Flash (Internal): 2 MB -Slots: no IC card slot -Other Storage: none -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, internal faxmodem, I/O Port - serial PC Link -Keyboard: No -Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email -Note: - -Model: PI-6500 -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: November 22, 1996 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB (715 KB user addressable) -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: No -Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email -Note: - -Model: PI-8000 -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: January 24, 1997 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible for handwriting recognition -Memory: 1 MB (711 KB user addressable) -Flash (Internal): none -Other Storage: none -Slots: -Display: 319x168 dot matrix mono "widescreen" LCD touchscreen -OS: Sharp Synergy -I/O: IrDA, internal faxmodem, I/O Port - serial PC Link -Keyboard: No -Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email -Note: - -Model: PI-6600 -Manufacturer: Sharp -Nickname/Series: AccessZaurus -Release Date: September 25, 1997 -Availability: Japan -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB -Flash (Internal): none -Other Storage: none -Slots: -Display: 239x168 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, internal faxmodem, I/O Port - serial PC Link -Keyboard: Yes -Features: upgraded handwriting recognition (over PI-4xxx/5xxx), email, included external digital mobile phone adapter, PC PIM software PowerPIMM ver 2.0, Microsoft Excel PC Viewer software -Note: - -============================================================================================ - -PI-B Series (Business/Commercial) ---------------------------------- - -Model: PI-B304 -Manufacturer: Sharp -Nickname/Series: -Release Date: October 1995 -Availability: Japan -CPU: NEC V30 (low-power version) 16-bit CPU -Memory: 2 MB RAM -Flash (Internal): 2 MB -Other Storage: none -Slots: -Display: 480x320 dot matrix reflective mono LCD touchscreen -OS: MS-DOS -I/O: IrDA, I/O Port - serial PC Link -Keyboard: -Features: -Note: - -Model: PI-B308 -Manufacturer: Sharp -Nickname/Series: -Release Date: October 1995 -Availability: Japan -CPU: NEC V30 (low-power version) 16-bit CPU -Memory: 2 MB RAM -Flash (Internal): 6 MB -Other Storage: none -Slots: -Display: 480x320 dot matrix reflective mono LCD touchscreen -OS: MS-DOS -I/O: IrDA, I/O Port - serial PC Link -Keyboard: -Features: -Note: - -============================================================================================ - -K-PDA (ZR) Series ------------------ - -Model: ZR-5000 -Manufacturer: Sharp -Nickname/Series: K-PDA -Release Date: January 1995 -Availability: US, Euro -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB RAM -Flash (Internal): none -Other Storage: none -Slots: PCMCIA Type II -Display: 320x240 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: Yes -Features: handwriting recognition, email -Note: - -Model: ZR-5000/FX -Manufacturer: Sharp -Nickname/Series: K-PDA -Release Date: January 1995 -Availability: US, Euro -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB RAM -Flash (Internal): none -Other Storage: none -Slots: PCMCIA Type II -Display: 320x240 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email -Note: - -Model: ZR-5700 -Manufacturer: Sharp -Nickname/Series: K-PDA -Release Date: 1995/1996? -Availability: US, Euro -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB RAM (user area: approx. 600K) -Flash (Internal): none -Other Storage: none -Slots: PCMCIA Type II -Display: 320x240 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: Yes -Features: handwriting recognition, email -Note: - -Model: ZR-5700 -Manufacturer: Sharp -Nickname/Series: K-PDA -Release Date: 1995/1996? -Availability: US, Euro -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB RAM (user area: approx. 600K) -Flash (Internal): none -Other Storage: none -Slots: PCMCIA Type II -Display: 320x240 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email -Note: - -Model: ZR-5800 -Manufacturer: Sharp -Nickname/Series: K-PDA -Release Date: 1996 -Availability: US, Euro -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 2 MB RAM (user area: approx. 1624K) -Flash (Internal): none -Other Storage: none -Slots: PCMCIA Type II -Display: 320x240 backlit dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: Yes -Features: upgraded handwriting recognition, email, digital mobile phone adapter (optional) -Note: - -Model: ZR-5800/FX -Manufacturer: Sharp -Nickname/Series: K-PDA -Release Date: 1996 -Availability: US, Euro -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 2 MB RAM (user area: approx. 1624K) -Flash (Internal): none -Other Storage: none -Slots: PCMCIA Type II -Display: 320x240 backlit dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: upgraded handwriting recognition, email, digital mobile phone adapter (optional) -Note: - -Model: ZR-3000 -Manufacturer: Sharp -Nickname/Series: K-PDA -Release Date: 1996 -Availability: US, Euro -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB RAM (user area approx. 650K) -Flash (Internal): none -Other Storage: none -Slots: -Display: 320x240 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link -Keyboard: Yes -Features: handwriting recognition, external faxmodem adapter (optional), email -Note: - -Model: ZR-3500X -Manufacturer: Sharp -Nickname/Series: K-PDA -Release Date: 1996 -Availability: US, Euro -Main CPU: Sharp SC62015-compatible "ESR-L" 8-bit CPU -Sub CPU: Z80-compatible co-processor for handwriting recognition -Memory: 1 MB RAM (user area approx. 650K) -Flash (Internal): 1 MB -Other Storage: none -Slots: -Display: 320x240 dot matrix mono LCD touchscreen -OS: Sharp Synergy -I/O: ASK/IrDA, I/O Port - serial PC Link, internal faxmodem (14.4/9.6 kbit/s) -Keyboard: Yes -Features: handwriting recognition, email -Note: - -============================================================================================ - -MI Series ---------- - -Model: MI-10 -Manufacturer: Sharp -Nickname/Series: ColorZaurus -Release Date: June 25, 1996 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: unknown -Flash (Internal): none -Other Storage: none -Slots: -Display: 320x240 16-bit color TFT LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-10DC -Manufacturer: Sharp -Nickname/Series: ColorZaurus -Release Date: June 25, 1996 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: unknown -Flash (Internal): none -Other Storage: none -Slots: -Display: 320x240 16-bit color TFT LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, digital camera -Note: - -Model: MI-504 -Manufacturer: Sharp -Nickname/Series: PowerZaurus -Release Date: July 17, 1997 -Availability: Japan -CPU: 30 MHz Hitachi SH3 32-bit CPU -Memory: 1.4 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 16-bit color LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-506 -Manufacturer: Sharp -Nickname/Series: PowerZaurus -Release Date: July 17, 1997 -Availability: Japan -CPU: 30 MHz Hitachi SH3 32-bit CPU -Memory: 3.4 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 16-bit color LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-506DC -Manufacturer: Sharp -Nickname/Series: PowerZaurus -Release Date: July 17, 1997 -Availability: Japan -CPU: 30 MHz Hitachi SH3 32-bit CPU -Memory: 3.4 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 16-bit color LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, digital camera -Note: - -Model: MI-106 -Manufacturer: Sharp -Nickname/Series: ZaurusPocket -Release Date: November 28, 1997 -Availability: Japan -CPU: 30 MHz Hitachi SH3 32-bit CPU -Memory: 6 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-106M -Manufacturer: Sharp -Nickname/Series: ZaurusPocket -Release Date: November 28, 1997 -Availability: Japan -CPU: 30 MHz Hitachi SH3 32-bit CPU -Memory: 6 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-110M -Manufacturer: Sharp -Nickname/Series: ZaurusPocket -Release Date: November 28, 1997 -Availability: Japan -CPU: 30 MHz Hitachi SH3 32-bit CPU -Memory: 10 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-610 -Manufacturer: Sharp -Nickname/Series: PowerZaurus -Release Date: March 3, 1998 -Availability: Japan -CPU: 60 MHz Hitachi SH3 32-bit CPU -Memory: 10 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 16-bit color TFT LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-610DC -Manufacturer: Sharp -Nickname/Series: PowerZaurus -Release Date: March 3, 1998 -Availability: Japan -CPU: 60 MHz Hitachi SH3 32-bit CPU -Memory: 10 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 16-bit color TFT LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, digital camera -Note: - -Model: MI-310 -Manufacturer: Sharp -Nickname/Series: PowerZaurus -Release Date: September 4, 1998 -Availability: Japan -CPU: 66 MHz Hitachi SH3 32-bit CPU -Memory: 10 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 16-bit color reflective TFT LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: No -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-P1-LA -Manufacturer: Sharp -Nickname/Series: Zaurus i-Geti -Release Date: March 20, 1999 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 6 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-P1-A -Manufacturer: Sharp -Nickname/Series: Zaurus i-Geti -Release Date: March 20, 1999 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 6 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-P1-W -Manufacturer: Sharp -Nickname/Series: Zaurus i-Geti -Release Date: March 20, 1999 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 6 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-EX1 -Manufacturer: Sharp -Nickname/Series: Zaurus i-Cruise -Release Date: April 16, 1999 -Availability: Japan -CPU: 120 MHz Hitachi SH3 32-bit CPU -Memory: 8 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 640x480 VGA 16-bit color TFT LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -=== Note: Every MI-series after this point _might_ not be a Hitachi SH3 CPU, best references so far call them RISC 32-bit CPUs... === - -Model: MI-P2-B -Manufacturer: Sharp -Nickname/Series: Zaurus i-Geti -Release Date: July 9, 1999 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 10 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, more internal software -Note: - -Model: MI-TR1 -Manufacturer: Sharp -Nickname/Series: Zaurus i-Cruise (customized) -Release Date: August 1999 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 16 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 640x480 VGA 16-bit color TFT LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-C1-S -Manufacturer: Sharp -Nickname/Series: PowerZaurus -Release Date: December 7, 1999 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 16 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 Super Mobile 16-bit color reflective LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-C1-A -Manufacturer: Sharp -Nickname/Series: PowerZaurus -Release Date: December 7, 1999 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 16 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 Super Mobile 16-bit color reflective LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-P10-S -Manufacturer: Sharp -Nickname/Series: Zaurus i-Geti -Release Date: July 14, 2000 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 16 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen (not backlit) -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, more internal software -Note: - -Model: MI-J1 -Manufacturer: Sharp -Nickname/Series: Internet Dictionary Zaurus -Release Date: August 4, 2000 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 6 MB -Flash (Internal): -Other Storage: none -Slots: -Display: 320x240 grayscale LCD touchscreen -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, more internal software, larger dictionary -Note: - -Model: MI-E1 -Manufacturer: Sharp -Nickname/Series: -Release Date: December 15, 2000 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 16 MB -Flash (Internal): -Other Storage: none -Slots: Smart Disk/Secure Digital/MMC, CompactFlash -Display: 240x320 16-bit color backlit TFT LCD touchscreen (vertical display) -Audio Controller: -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, MP3 player, MPEG4 video playback, headphone jack -Note: - -Model: MI-L1 -Manufacturer: Sharp -Nickname/Series: -Release Date: May 21, 2001 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: 16 MB -Flash (Internal): -Other Storage: none -Slots: Smart Disk/Secure Digital/MMC, CompactFlash -Display: 240x320 16-bit color LCD touchscreen (not backlit, vertical display) -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording -Note: - -Model: MI-E21 -Manufacturer: Sharp -Nickname/Series: -Release Date: September 7, 2001 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU (faster than MI-E1 CPU) -Memory: 32 MB -Flash (Internal): -Other Storage: none -Slots: Smart Disk/Secure Digital/MMC, CompactFlash -Display: 240x320 16-bit color backlit TFT LCD touchscreen (vertical display) -Audio Controller: -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, MP3 player, MPEG4 video playback, headphone jack -Note: - -Model: MI-E25DC -Manufacturer: Sharp -Nickname/Series: -Release Date: March 15, 2002 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU (same as MI-E21) -Memory: 32 MB -Flash (Internal): -Other Storage: none -Slots: Smart Disk/Secure Digital/MMC, CompactFlash -Display: 240x320 16-bit color backlit TFT LCD touchscreen (vertical display) -Audio Controller: -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: IrDA, I/O Port - serial PC Link, internal faxmodem -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, external digital mobile phone adapter, Internet, audio recording, MP3 player, MPEG4 video playback, headphone jack, 640x480 digital camera -Note: - -============================================================================================ - -MT Series ---------- - -Model: MT-200 -Manufacturer: Sharp -Nickname/Series: -Release Date: December 4, 1998 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: unknown -Flash (Internal): -Other Storage: -Slots: -Display: -Audio Controller: -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: -Keyboard: -Features: -Note: The "Communication Pals" or "Browser Boards", not technically Zaurus, basically MI technology with a keyboard on top - -Model: MT-200SA -Manufacturer: Sharp -Nickname/Series: -Release Date: -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: unknown -Flash (Internal): -Other Storage: -Slots: -Display: -Audio Controller: -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: -Keyboard: -Features: -Note: The "Communication Pals" or "Browser Boards", not technically Zaurus, basically MI technology with a keyboard on top - -Model: MT-300 -Manufacturer: Sharp -Nickname/Series: -Release Date: September 9, 1999 -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: unknown -Flash (Internal): -Other Storage: -Slots: -Display: -Audio Controller: -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: -Keyboard: -Features: -Note: The "Communication Pals" or "Browser Boards", not technically Zaurus, basically MI technology with a keyboard on top - -Model: MT-300C -Manufacturer: Sharp -Nickname/Series: -Release Date: -Availability: Japan -CPU: unknown MHz Hitachi SH3 32-bit CPU -Memory: unknown -Flash (Internal): -Other Storage: -Slots: -Display: -Audio Controller: -OS: Sharp ZaurusOS (Axe XTAL microkernel) -I/O: -Keyboard: -Features: -Note: The "Communication Pals" or "Browser Boards", not technically Zaurus, basically MI technology with a keyboard on top - -============================================================================================ - -SL Series ---------- - -Model: SL-5000D -Manufacturer: Sharp -Nickname/Series: Developer Edition -Release Date: 2001 -Availability: World -CPU: 206 MHz Intel SA-1110 StrongARM 32-bit CPU -Memory: 32 MB DRAM -Flash (Internal): 16 MB -Other Storage: none -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 240x320 16-bit color reflective TFT LCD touchscreen -Audio Controller: -OS: Lineo Embedix Plus PDA OS (Linux 2.4), Qtopia GUI, Jeode Java VM -I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, headphone jack -Note: - -Model: SL-5500 -Manufacturer: Sharp -Nickname/Series: Collie -Release Date: March 11, 2002 -Availability: World -CPU: 206 MHz Intel SA-1110 StrongARM 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 16 MB -Other Storage: none -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 240x320 16-bit color reflective TFT LCD touchscreen with front light -Audio Controller: -OS: Lineo Embedix Plus PDA OS (Linux 2.4), Qtopia GUI, Jeode Java VM -I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, headphone jack -Note: - -Model: SL-5500G -Manufacturer: Sharp -Nickname/Series: Collie -Release Date: March 11, 2002 -Availability: Germany? -CPU: 206 MHz Intel SA-1110 StrongARM 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 16 MB -Other Storage: none -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 240x320 16-bit color reflective TFT LCD touchscreen with front light -Audio Controller: -OS: Lineo Embedix Plus PDA OS (Linux 2.4), Qtopia GUI, Jeode Java VM -I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, headphone jack -Note: - -Model: SL-A300 -Manufacturer: Sharp -Nickname/Series: Discovery -Release Date: July 12, 2002 -Availability: Japan -CPU: 200 MHz Intel XScale PXA210 32-bit CPU -Memory: 64 MB DRAM (approx. 32 MB user area) -Flash (Internal): 16 MB -Other Storage: none -Slots: Secure Digital/MMC -Display: 240x320 16-bit color backlit TFT LCD touchscreen -Audio Controller: -OS: Lineo Embedix Plus PDA OS (Linux 2.4), Qtopia GUI, Jeode Java VM -I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link -Keyboard: No -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, headphone jack -Note: - -Model: SL-B500 -Manufacturer: Sharp -Nickname/Series: Poodle -Release Date: December 14, 2002 -Availability: Japan -CPU: 400MHz Intel XScale PXA250 32-bit CPU -Memory: 32 MB DRAM -Flash (Internal): 64 MB -Other Storage: 512KB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 240x320 16-bit color backlit TFT LCD touchscreen -Audio Controller: -OS: Lineo Embedix OS (Linux 2.4), Qtopia GUI -I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack -Note: - -Model: SL-5600 -Manufacturer: Sharp -Nickname/Series: Poodle -Release Date: April 2?, 2002 -Availability: World -CPU: 400MHz Intel XScale PXA250 32-bit CPU -Memory: 32 MB DRAM -Flash (Internal): 64 MB (approx. 33 MB user area) -Other Storage: 512KB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 240x320 16-bit color relective TFT LCD touchscreen with front light -Audio Controller: -OS: Lineo Embedix3 OS (Linux 2.4.18), Qtopia GUI 1.5.0 -I/O: IrDA, internal faxmodem, I/O Port - serial/USB PC Link -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack -Note: Some have an easily-fixed cache bug on the PXA-250 - -Model: SL-C700 -Manufacturer: Sharp -Nickname/Series: Corgi -Release Date: December 14, 2002 -Availability: Japan -CPU: 206 MHz Intel XScale PXA250 32-bit CPU (underclocked to similar speed as SL-5500?) -Memory: 32 MB DRAM -Flash (Internal): 64 MB -Other Storage: 512KB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: -OS: Lineo Embedix OS (Linux 2.4.18), Qtopia GUI -I/O: IrDA, internal faxmodem, I/O Port - USB PC Link -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, internal speaker/microphone, headphone jack -Note: - -Model: SL-C750 -Manufacturer: Sharp -Nickname/Series: Shepherd -Release Date: 2003 -Availability: Japan -CPU: 400 MHz Intel XScale PXA255 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 64 MB (user area: approx. 30 MB) -Other Storage: 512KB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: -OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM -I/O: IrDA, internal faxmodem, I/O Port - USB PC Link -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, updated software, internal speaker/microphone, headphone jack -Note: - -Model: SL-C760 -Manufacturer: Sharp -Nickname/Series: Husky -Release Date: 2003 -Availability: Japan -CPU: 400 MHz Intel XScale PXA255 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 128 MB (user area: approx. 65 MB) -Other Storage: 512KB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC (possibly SDIO-compatible), CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: -OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM -I/O: IrDA, internal faxmodem, I/O Port - USB PC Link -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, internal speaker/microphone, headphone jack -Note: - -Model: SL-C860 -Manufacturer: Sharp -Nickname/Series: Boxer -Release Date: 2003 -Availability: Japan -CPU: 400 MHz Intel XScale PXA255 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 128 MB (user area: approx. 65 MB) -Other Storage: 512KB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC (possibly SDIO-compatible), CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: -OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM -I/O: IrDA, internal faxmodem, USB Device, I/O Port - USB PC Link -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, English-Japanese translation software, internal speaker/microphone, headphone jack -Note: - -Model: SL-6000N -Manufacturer: Sharp -Nickname/Series: Tosa -Release Date: early 2004 -Availability: World -CPU: 400 MHz Intel XScale PXA255 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 64 MB -Other Storage: 8 MB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: Wolfson WM9712 -OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack -Note: - -Model: HC-6000N -Manufacturer: Sharp -Nickname/Series: -Release Date: early 2004 -Availability: World -CPU: 400 MHz Intel XScale PXA255 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 64 MB -Other Storage: 8 MB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: Wolfson WM9712 -OS: Microsoft Windows Mobile 2003 Second Edition -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack -Note: Clone - Hitachi FLORA-ie MX1 - -Model: SL-6000D -Manufacturer: Sharp -Nickname/Series: Tosa -Release Date: early 2004 -Availability: World -CPU: 400 MHz Intel XScale PXA255 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 64 MB -Other Storage: 8 MB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: Wolfson WM9712 -OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack -Note: - -Model: SL-6000L -Manufacturer: Sharp -Nickname/Series: Tosa -Release Date: early 2004 -Availability: World -CPU: 400 MHz Intel XScale PXA255 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 128 MB -Other Storage: 8 MB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: Wolfson WM9712 -OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack -Note: - -Model: SL-6000W -Manufacturer: Sharp -Nickname/Series: Tosa -Release Date: early 2004 -Availability: World -CPU: 400 MHz Intel XScale PXA255 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 64 MB -Other Storage: 8 MB "rescue" mode NOR P2ROM -Slots: Secure Digital/MMC, CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: Wolfson WM9712 -OS: Metrowerks OpenPDA OS, Qtopia GUI, CVM Java VM -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 -Keyboard: Yes -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, internal speaker/microphone, headphone jack -Note: - -Model: SL-C3000 -Manufacturer: Sharp -Nickname/Series: Spitz -Release Date: October 2004 -Availability: Japan -CPU: 416 MHz Intel XScale PXA270 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 16 MB -Other Storage: 4 GB Hitachi MicroDrive -Slots: Secure Digital/MMC (SDIO), CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: Wolfson WM8750 -OS: Lineo uLinux OS, Qtopia GUI -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, overclockable, internal speaker/microphone, headphone jack -Note: - -Model: SL-C1000 -Manufacturer: Sharp -Nickname/Series: Akita -Release Date: March 2005 -Availability: World -CPU: 416 MHz Intel XScale PXA270 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 128 MB -Other Storage: none -Slots: Secure Digital/MMC (possibly SDIO-compatible), CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: -OS: Lineo uLinux OS, Qtopia GUI -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, overclockable, internal speaker/microphone, headphone jack -Note: - -Model: SL-C3100 -Manufacturer: Sharp -Nickname/Series: Borzoi -Release Date: June 2005 -Availability: World -CPU: 416 MHz Intel XScale PXA270 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 128 MB -Other Storage: 8 MB "rescue" mode NOR P2ROM, 4 GB Hitachi MicroDrive -Slots: Secure Digital/MMC (SDIO), CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: Wolfson WM8750 -OS: Lineo uLinux OS, Qtopia GUI -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, overclockable, internal speaker/microphone, headphone jack, dictionary, map, electronic library -Note: - -Model: SL-C3200 -Manufacturer: Sharp -Nickname/Series: Terrier -Release Date: March 17, 2006 -Availability: World -CPU: 416 MHz Intel XScale PXA270 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 128 MB -Other Storage: 6 GB Hitachi MicroDrive -Slots: Secure Digital/MMC (SDIO) up to 4 GB, CompactFlash Type II -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: Wolfson WM8750 -OS: Lineo uLinux OS, Qtopia GUI -I/O: IrDA, internal faxmodem, USB OTG 1.1 (Slave/Host), I/O Port, 802.11b WiFi, Bluetooth v1.1 -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, email, digital mobile phone adapter, Internet, 640x480 digital camera, audio recording, MP3 player, MPEG4 video playback, screen rotation, overclockable, Nuance text-to-speech, updated dictionary, TOEIC, internal speaker/microphone, headphone jack -Note: - -============================================================================================ - -RD Series ---------- - -Model: RD-CMP2000R -Manufacturer: Sharp -Nickname/Series: -Demo/Press Release Date: October 2006 -Availability: Korea -CPU: unknown 32-bit CPU -Memory: -Flash (Internal): -Other Storage: -Slots: Secure Digital/MMC up to 4 GB -Display: 320x240 16-bit color LCD touchscreen -Audio Controller: -OS: Linux, unknown GUI -I/O: -Keyboard: Yes -Features: 1280x960 1.33 MP camera, electronic dictionary, e-Book reader, FM radio, music player -Note: - -============================================================================================ - -"WS Series" ------------ - -Model: W-ZERO3 WS003SH -Manufacturer: Willcom (mfg. by Sharp) -Nickname/Series: -Release Date: after January 2007 -Availability: Japan -CPU: 416 MHz Intel XScale PXA270 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 128 MB -Other Storage: -Slots: miniSD, W-SIM -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: -OS: Microsoft Windows Mobile 5.0 -I/O: USB PC Link, USB Host, 802.11b WiFi -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, 1280x960 1.33 MP camera, wireless/cellular phone/data features, Internet, email -Note: - -Model: W-ZERO3 WS004SH -Manufacturer: Willcom (mfg. by Sharp) -Nickname/Series: -Release Date: after January 2007 -Availability: Japan -CPU: 416 MHz Intel XScale PXA270 32-bit CPU -Memory: 64 MB DRAM -Flash (Internal): 256 MB (user area about 197MB) -Other Storage: -Slots: miniSD, W-SIM -Display: 640x480 VGA 16-bit color Sharp "System LCD" semi-transflective backlit CGS TFT LCD touchscreen -Audio Controller: -OS: Microsoft Windows Mobile 5.0 -I/O: USB PC Link, USB Host, 802.11b WiFi -Keyboard: Yes (mini-keyboard) -Features: handwriting recognition, 1280x960 1.33 MP camera, wireless/cellular phone/data features, Internet, email, English-Japanese translation dictionary -Note: - - - -*****************************************************************************************************************************************/ - - -#include "emu.h" -#include "cpu/arm7/arm7.h" -#include "cpu/arm7/arm7core.h" -#include "machine/pxa255.h" - -#define MAIN_CLOCK XTAL_8MHz - -class zaurus_state : public driver_device -{ -public: - zaurus_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, "ram") - { } - - // devices - required_device m_maincpu; - required_shared_ptr m_ram; - - UINT8 m_rtc_tick; - DECLARE_READ32_MEMBER(pxa255_ostimer_r); - DECLARE_WRITE32_MEMBER(pxa255_ostimer_w); - DECLARE_READ32_MEMBER(pxa255_rtc_r); - DECLARE_WRITE32_MEMBER(pxa255_rtc_w); - DECLARE_READ32_MEMBER(pxa255_intc_r); - DECLARE_WRITE32_MEMBER(pxa255_intc_w); - PXA255_OSTMR_Regs m_ostimer_regs; - PXA255_INTC_Regs m_intc_regs; - - void pxa255_ostimer_irq_check(); - void pxa255_update_interrupts(); - void pxa255_set_irq_line(UINT32 line, int irq_state); - TIMER_DEVICE_CALLBACK_MEMBER(rtc_irq_callback); - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -protected: - // driver_device overrides - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); -}; - -#define VERBOSE_LEVEL ( 5 ) - -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine& machine, int n_level, const char* s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[32768]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%s: %s", machine.describe_context(), buf ); - //printf( "%s: %s", machine.describe_context(), buf ); - } -} - - -void zaurus_state::video_start() -{ -} - -UINT32 zaurus_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) -{ - return 0; -} - -void zaurus_state::pxa255_update_interrupts() -{ - PXA255_INTC_Regs *intc_regs = &m_intc_regs; - - intc_regs->icfp = (intc_regs->icpr & intc_regs->icmr) & intc_regs->iclr; - intc_regs->icip = (intc_regs->icpr & intc_regs->icmr) & (~intc_regs->iclr); - m_maincpu->set_input_line(ARM7_FIRQ_LINE, intc_regs->icfp ? ASSERT_LINE : CLEAR_LINE); - m_maincpu->set_input_line(ARM7_IRQ_LINE, intc_regs->icip ? ASSERT_LINE : CLEAR_LINE); -} - -void zaurus_state::pxa255_set_irq_line(UINT32 line, int irq_state) -{ - PXA255_INTC_Regs *intc_regs = &m_intc_regs; - - intc_regs->icpr &= ~line; - intc_regs->icpr |= irq_state ? line : 0; - //printf( "Setting IRQ line %08x to %d\n", line, irq_state ); - pxa255_update_interrupts(); -} - -void zaurus_state::pxa255_ostimer_irq_check() -{ - PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; - -// logerror("%08x OStimer irq check\n",ostimer_regs->oier); - - pxa255_set_irq_line(PXA255_INT_OSTIMER0, (ostimer_regs->oier & PXA255_OIER_E0) ? ((ostimer_regs->ossr & PXA255_OSSR_M0) ? 1 : 0) : 0); - //pxa255_set_irq_line(PXA255_INT_OSTIMER1, (ostimer_regs->oier & PXA255_OIER_E1) ? ((ostimer_regs->ossr & PXA255_OSSR_M1) ? 1 : 0) : 0); - //pxa255_set_irq_line(PXA255_INT_OSTIMER2, (ostimer_regs->oier & PXA255_OIER_E2) ? ((ostimer_regs->ossr & PXA255_OSSR_M2) ? 1 : 0) : 0); - //pxa255_set_irq_line(PXA255_INT_OSTIMER3, (ostimer_regs->oier & PXA255_OIER_E3) ? ((ostimer_regs->ossr & PXA255_OSSR_M3) ? 1 : 0) : 0); -} - -READ32_MEMBER(zaurus_state::pxa255_ostimer_r) -{ - PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; - - switch(PXA255_OSTMR_BASE_ADDR | (offset << 2)) - { - case PXA255_OSMR0: - if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Match Register 0: %08x & %08x\n", ostimer_regs->osmr[0], mem_mask ); - return ostimer_regs->osmr[0]; - case PXA255_OSMR1: - if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Match Register 1: %08x & %08x\n", ostimer_regs->osmr[1], mem_mask ); - return ostimer_regs->osmr[1]; - case PXA255_OSMR2: - if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Match Register 2: %08x & %08x\n", ostimer_regs->osmr[2], mem_mask ); - return ostimer_regs->osmr[2]; - case PXA255_OSMR3: - if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Match Register 3: %08x & %08x\n", ostimer_regs->osmr[3], mem_mask ); - return ostimer_regs->osmr[3]; - case PXA255_OSCR: - if (0) verboselog( machine(), 4, "pxa255_ostimer_r: OS Timer Count Register: %08x & %08x\n", ostimer_regs->oscr, mem_mask ); - // free-running 3.something MHz counter. this is a complete hack. - ostimer_regs->oscr += 0x300; - return ostimer_regs->oscr; - case PXA255_OSSR: - if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Status Register: %08x & %08x\n", ostimer_regs->ossr, mem_mask ); - return ostimer_regs->ossr; - case PXA255_OWER: - if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Watchdog Match Enable Register: %08x & %08x\n", ostimer_regs->ower, mem_mask ); - return ostimer_regs->ower; - case PXA255_OIER: - if (0) verboselog( machine(), 3, "pxa255_ostimer_r: OS Timer Interrupt Enable Register: %08x & %08x\n", ostimer_regs->oier, mem_mask ); - return ostimer_regs->oier; - default: - if (0) verboselog( machine(), 0, "pxa255_ostimer_r: Unknown address: %08x\n", PXA255_OSTMR_BASE_ADDR | (offset << 2)); - break; - } - return 0; -} - -WRITE32_MEMBER(zaurus_state::pxa255_ostimer_w) -{ - PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; - - switch(PXA255_OSTMR_BASE_ADDR | (offset << 2)) - { - case PXA255_OSMR0: - if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Match Register 0: %08x & %08x\n", data, mem_mask ); - ostimer_regs->osmr[0] = data; - if(ostimer_regs->oier & PXA255_OIER_E0) - { - attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[0] - ostimer_regs->oscr); - - //printf( "Adjusting one-shot timer to 200MHz * %08x\n", ostimer_regs->osmr[0]); - ostimer_regs->timer[0]->adjust(period); - } - break; - case PXA255_OSMR1: - if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Match Register 1: %08x & %08x\n", data, mem_mask ); - ostimer_regs->osmr[1] = data; - if(ostimer_regs->oier & PXA255_OIER_E1) - { - attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[1] - ostimer_regs->oscr); - - ostimer_regs->timer[1]->adjust(period, 1); - } - break; - case PXA255_OSMR2: - if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Match Register 2: %08x & %08x\n", data, mem_mask ); - ostimer_regs->osmr[2] = data; - if(ostimer_regs->oier & PXA255_OIER_E2) - { - attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[2] - ostimer_regs->oscr); - - ostimer_regs->timer[2]->adjust(period, 2); - } - break; - case PXA255_OSMR3: - if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Match Register 3: %08x & %08x\n", data, mem_mask ); - ostimer_regs->osmr[3] = data; - if(ostimer_regs->oier & PXA255_OIER_E3) - { - //attotime period = attotime::from_hz(3846400) * (ostimer_regs->osmr[3] - ostimer_regs->oscr); - - //ostimer_regs->timer[3]->adjust(period, 3); - } - break; - case PXA255_OSCR: - if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Count Register: %08x & %08x\n", data, mem_mask ); - ostimer_regs->oscr = data; - break; - case PXA255_OSSR: - if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Status Register: %08x & %08x\n", data, mem_mask ); - ostimer_regs->ossr &= ~data; - pxa255_ostimer_irq_check(); - break; - case PXA255_OWER: - if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Watchdog Enable Register: %08x & %08x\n", data, mem_mask ); - ostimer_regs->ower = data & 0x00000001; - break; - case PXA255_OIER: - { - int index = 0; - if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Interrupt Enable Register: %08x & %08x\n", data, mem_mask ); - ostimer_regs->oier = data & 0x0000000f; - for(index = 0; index < 4; index++) - { - if(ostimer_regs->oier & (1 << index)) - { - //attotime period = attotime::from_hz(200000000) * ostimer_regs->osmr[index]; - - //ostimer_regs->timer[index]->adjust(period, index); - } - } - - break; - } - default: - verboselog( machine(), 0, "pxa255_ostimer_w: Unknown address: %08x = %08x & %08x\n", PXA255_OSTMR_BASE_ADDR | (offset << 2), data, mem_mask); - break; - } -} - -READ32_MEMBER(zaurus_state::pxa255_intc_r) -{ - PXA255_INTC_Regs *intc_regs = &m_intc_regs; - - switch(PXA255_INTC_BASE_ADDR | (offset << 2)) - { - case PXA255_ICIP: - if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller IRQ Pending Register: %08x & %08x\n", intc_regs->icip, mem_mask ); - return intc_regs->icip; - case PXA255_ICMR: - if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller Mask Register: %08x & %08x\n", intc_regs->icmr, mem_mask ); - return intc_regs->icmr; - case PXA255_ICLR: - if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller Level Register: %08x & %08x\n", intc_regs->iclr, mem_mask ); - return intc_regs->iclr; - case PXA255_ICFP: - if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller FIQ Pending Register: %08x & %08x\n", intc_regs->icfp, mem_mask ); - return intc_regs->icfp; - case PXA255_ICPR: - if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller Pending Register: %08x & %08x\n", intc_regs->icpr, mem_mask ); - return intc_regs->icpr; - case PXA255_ICCR: - if (0) verboselog( machine(), 3, "pxa255_intc_r: Interrupt Controller Control Register: %08x & %08x\n", intc_regs->iccr, mem_mask ); - return intc_regs->iccr; - default: - verboselog( machine(), 0, "pxa255_intc_r: Unknown address: %08x\n", PXA255_INTC_BASE_ADDR | (offset << 2)); - break; - } - return 0; -} - -WRITE32_MEMBER(zaurus_state::pxa255_intc_w) -{ - PXA255_INTC_Regs *intc_regs = &m_intc_regs; - - switch(PXA255_INTC_BASE_ADDR | (offset << 2)) - { - case PXA255_ICIP: - verboselog( machine(), 3, "pxa255_intc_w: (Invalid Write) Interrupt Controller IRQ Pending Register: %08x & %08x\n", data, mem_mask ); - break; - case PXA255_ICMR: - if (0) verboselog( machine(), 3, "pxa255_intc_w: Interrupt Controller Mask Register: %08x & %08x\n", data, mem_mask ); - intc_regs->icmr = data & 0xfffe7f00; - break; - case PXA255_ICLR: - if (0) verboselog( machine(), 3, "pxa255_intc_w: Interrupt Controller Level Register: %08x & %08x\n", data, mem_mask ); - intc_regs->iclr = data & 0xfffe7f00; - break; - case PXA255_ICFP: - if (0) verboselog( machine(), 3, "pxa255_intc_w: (Invalid Write) Interrupt Controller FIQ Pending Register: %08x & %08x\n", data, mem_mask ); - break; - case PXA255_ICPR: - if (0) verboselog( machine(), 3, "pxa255_intc_w: (Invalid Write) Interrupt Controller Pending Register: %08x & %08x\n", data, mem_mask ); - break; - case PXA255_ICCR: - if (0) verboselog( machine(), 3, "pxa255_intc_w: Interrupt Controller Control Register: %08x & %08x\n", data, mem_mask ); - intc_regs->iccr = data & 0x00000001; - break; - default: - verboselog( machine(), 0, "pxa255_intc_w: Unknown address: %08x = %08x & %08x\n", PXA255_INTC_BASE_ADDR | (offset << 2), data, mem_mask); - break; - } -} - -READ32_MEMBER(zaurus_state::pxa255_rtc_r) -{ - printf("%08x\n",offset << 2); - - return 0; -} - -WRITE32_MEMBER(zaurus_state::pxa255_rtc_w) -{ - printf("%08x %08x\n",offset << 2,data); - -} - -static ADDRESS_MAP_START( zaurus_map, AS_PROGRAM, 32, zaurus_state ) - AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_REGION("firmware", 0) - AM_RANGE(0x40900000, 0x4090000f) AM_READWRITE(pxa255_rtc_r,pxa255_rtc_w) - AM_RANGE(0x40a00000, 0x40a0001f) AM_READWRITE(pxa255_ostimer_r, pxa255_ostimer_w ) - AM_RANGE(0x40d00000, 0x40d00017) AM_READWRITE(pxa255_intc_r, pxa255_intc_w ) - AM_RANGE(0xa0000000, 0xa07fffff) AM_RAM AM_SHARE("ram") -ADDRESS_MAP_END - - -static INPUT_PORTS_START( zaurus ) -INPUT_PORTS_END - - - -void zaurus_state::machine_start() -{ -} - -void zaurus_state::machine_reset() -{ -} - - -/* TODO: Hack */ -TIMER_DEVICE_CALLBACK_MEMBER(zaurus_state::rtc_irq_callback) -{ - #if 0 - m_rtc_tick++; - m_rtc_tick&=1; - - if(m_rtc_tick & 1) - pxa255_set_irq_line(PXA255_INT_RTC_HZ,1); - else - pxa255_set_irq_line(PXA255_INT_RTC_HZ,0); - #endif -} - -// TODO: main CPU differs greatly between versions! -static MACHINE_CONFIG_START( zaurus, zaurus_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",PXA255,MAIN_CLOCK) - MCFG_CPU_PROGRAM_MAP(zaurus_map) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("rtc_timer", zaurus_state, rtc_irq_callback, attotime::from_hz(XTAL_32_768kHz)) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(zaurus_state, screen_update) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - - MCFG_PALETTE_ADD("palette", 8) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") -// MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) -// MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) -MACHINE_CONFIG_END - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -/* was labeled SL-C500 */ -ROM_START( zsl5500 ) - ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) - ROM_LOAD( "sl-c500 v1.20 (zimage).bin", 0x000000, 0x13c000, BAD_DUMP CRC(dc1c259f) SHA1(8150744196a72821ae792462d0381182274c2ce0) ) -ROM_END - -ROM_START( zsl5600 ) - ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) - ROM_LOAD( "zaurus sl-b500 - 5600 (zimage).bin", 0x000000, 0x11b6b0, BAD_DUMP CRC(779c70a1) SHA1(26824e3dc563b681f195029f220dfaa405613f9e) ) -ROM_END - -ROM_START( zslc750 ) - ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) - ROM_LOAD( "zaurus sl-c750 (zimage).bin", 0x000000, 0x121544, BAD_DUMP CRC(56353f4d) SHA1(8e1fff6e93d560bd6572c5c163bbd81378693f68) ) -ROM_END - -ROM_START( zslc760 ) - ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) - ROM_LOAD( "zaurus sl-c760 (zimage).bin", 0x000000, 0x120b44, BAD_DUMP CRC(feedcba3) SHA1(1821ad0fc03a8c3832ad5fe2221c21c1ca277508) ) -ROM_END - -ROM_START( zslc3000 ) - ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) - ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c3000-20050428091110.bin", 0x000000, 0x12828c, BAD_DUMP CRC(fd94510d) SHA1(901f8154b4228a448f5551f0c9f21c2153e1e3a1) ) -ROM_END - -ROM_START( zslc1000 ) - ROM_REGION32_LE( 0x200000, "firmware", ROMREGION_ERASE00 ) - ROM_LOAD( "openzaurus 3.5.3 - zimage-sharp sl-c1000-20050427214434.bin", 0x000000, 0x128980, BAD_DUMP CRC(1e1a9279) SHA1(909ac3f00385eced55822d6a155b79d9d25f43b3) ) -ROM_END - -COMP( 2002, zsl5500, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-5500 \"Collie\"", MACHINE_IS_SKELETON ) -COMP( 2002, zsl5600, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-5600 / SL-B500 \"Poodle\"", MACHINE_IS_SKELETON ) -COMP( 2003, zslc750, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-C750 \"Shepherd\" (Japan)", MACHINE_IS_SKELETON ) -COMP( 2004, zslc760, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-C760 \"Husky\" (Japan)", MACHINE_IS_SKELETON ) -COMP( 200?, zslc3000, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-C3000 \"Spitz\" (Japan)", MACHINE_IS_SKELETON ) -COMP( 200?, zslc1000, 0, 0, zaurus, zaurus, driver_device, 0, "Sharp", "Zaurus SL-C3000 \"Akita\" (Japan)", MACHINE_IS_SKELETON ) diff --git a/src/mess/drivers/zexall.c b/src/mess/drivers/zexall.c deleted file mode 100644 index 553f65613f7..00000000000 --- a/src/mess/drivers/zexall.c +++ /dev/null @@ -1,171 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu, Robbbert -/****************************************************************************** -* -* Self Contained zexall 'Z80 instruction exerciser' test driver -* Zexall originally written by Frank Cringle for ZX Spectrum -* Modularized Spectrum-independent Zexall binary supplied by Blargg -* Serial interface binary/preloader at 0x0000-0x00FF written by Kevin 'kevtris' Horton -* -* -* mem map: -Ram 0000-FFFF (preloaded with binary) -Special calls take place for three ram values (this interface was designed by kevtris): -FFFD - 'ack' - shared ram with output device; z80 reads from here and considers the byte at FFFF read if this value incremented -FFFE - 'req' - shared ram with output device; z80 writes an incrementing value to FFFE to indicate that there is a byte waiting at FFFF and hence requesting the output device on the other end do something about it, until FFFD is incremented by the output device to acknowledge receipt -FFFF - 'data' - shared ram with output device; z80 writes the data to be sent to output device here -One i/o port is used: -0001 - bit 0 controls whether interrupt timer is enabled (1) or not (0), this is a holdover from a project of kevtris' and can be ignored. - -******************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class zexall_state : public driver_device -{ -public: - zexall_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_main_ram(*this, "main_ram") - { - } - - DECLARE_READ8_MEMBER( zexall_output_ack_r ); - DECLARE_READ8_MEMBER( zexall_output_req_r ); - DECLARE_READ8_MEMBER( zexall_output_data_r ); - DECLARE_WRITE8_MEMBER( zexall_output_ack_w ); - DECLARE_WRITE8_MEMBER( zexall_output_req_w ); - DECLARE_WRITE8_MEMBER( zexall_output_data_w ); - DECLARE_DRIVER_INIT(zexall); -private: - required_device m_maincpu; - required_device m_terminal; - required_shared_ptr m_main_ram; - UINT8 m_out_data; // byte written to 0xFFFF - UINT8 m_out_req; // byte written to 0xFFFE - UINT8 m_out_req_last; // old value at 0xFFFE before the most recent write - UINT8 m_out_ack; // byte written to 0xFFFC - virtual void machine_reset(); -}; - -DRIVER_INIT_MEMBER(zexall_state,zexall) -{ - m_out_ack = 0; - m_out_req = 0; - m_out_req_last = 0; - m_out_data = 0; -} - -void zexall_state::machine_reset() -{ -// rom is self-modifying, so need to refresh it on each run - UINT8 *rom = memregion("romcode")->base(); - UINT8 *ram = m_main_ram; - /* fill main ram with zexall code */ - memcpy(ram, rom, 0x228a); -} - -READ8_MEMBER( zexall_state::zexall_output_ack_r ) -{ -// spit out the byte in out_byte if out_req is not equal to out_req_last - if (m_out_req != m_out_req_last) - { - m_terminal->write(space,0,m_out_data); - fprintf(stderr,"%c",m_out_data); - m_out_req_last = m_out_req; - m_out_ack++; - } - return m_out_ack; -} - -WRITE8_MEMBER( zexall_state::zexall_output_ack_w ) -{ - m_out_ack = data; -} - -READ8_MEMBER( zexall_state::zexall_output_req_r ) -{ - return m_out_req; -} - -WRITE8_MEMBER( zexall_state::zexall_output_req_w ) -{ - m_out_req_last = m_out_req; - m_out_req = data; -} - -READ8_MEMBER( zexall_state::zexall_output_data_r ) -{ - return m_out_data; -} - -WRITE8_MEMBER( zexall_state::zexall_output_data_w ) -{ - m_out_data = data; -} - -/****************************************************************************** - Address Maps -******************************************************************************/ - -static ADDRESS_MAP_START(z80_mem, AS_PROGRAM, 8, zexall_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xfffc) AM_RAM AM_SHARE("main_ram") - AM_RANGE(0xfffd, 0xfffd) AM_READWRITE(zexall_output_ack_r,zexall_output_ack_w) - AM_RANGE(0xfffe, 0xfffe) AM_READWRITE(zexall_output_req_r,zexall_output_req_w) - AM_RANGE(0xffff, 0xffff) AM_READWRITE(zexall_output_data_r,zexall_output_data_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(z80_io, AS_IO, 8, zexall_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0001, 0x0001) AM_NOP // really a disable/enable for some sort of interrupt timer on kev's hardware, which is completely irrelevant for the zexall test -ADDRESS_MAP_END - - -/****************************************************************************** - Input Ports -******************************************************************************/ -static INPUT_PORTS_START( zexall ) -INPUT_PORTS_END - -/****************************************************************************** - Machine Drivers -******************************************************************************/ - -static MACHINE_CONFIG_START( zexall, zexall_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz*10) - MCFG_CPU_PROGRAM_MAP(z80_mem) - MCFG_CPU_IO_MAP(z80_io) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) -MACHINE_CONFIG_END - - - -/****************************************************************************** - ROM Definitions -******************************************************************************/ - -ROM_START(zexall) - ROM_REGION(0x22ff, "romcode", 0) - ROM_LOAD("zex.bin", 0x0000, 0x2289, CRC(77e0a1df) SHA1(cc8f84724e3837783816d92a6dfb8e5975232c66)) -ROM_END - - - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 2009, zexall, 0, 0, zexall, zexall, zexall_state, zexall, "Frank Cringle & MESSDEV", "ZEXALL Z80 instruction set exerciser (modified for MESS)", MACHINE_NO_SOUND_HW ) diff --git a/src/mess/drivers/zorba.c b/src/mess/drivers/zorba.c deleted file mode 100644 index 2b0a9aed58d..00000000000 --- a/src/mess/drivers/zorba.c +++ /dev/null @@ -1,432 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/************************************************************************************************************ - -Telcon Zorba - -2013-08-25 Skeleton - -This was one of the last CP/M-based systems, already out of date when it was released. -Because it doesn't use the standard Z80 peripherals, it uses a homebrew interrupt controller to make use - of the Z80's IM2. - -The keyboard is an intelligent serial device like the Kaypro's keyboard. They even have the same plug, -and might be swappable. Need a schematic. - -Instead of using a daisy chain, the IM2 vectors are calculated by a prom (u77). Unfortunately, the prom -contents make no sense at all (mostly FF), so the vectors for IRQ0 and IRQ2 are hard-coded. Other IRQ -vectors are not used as yet. - -Status: -- Boots up, and the keyboard works - -ToDo: -- Need software that does more than plain text (such as games) -- Add masking feature (only used for the UARTs) -- Connect devices to the above hardware -- Fix the display -- Connect the PIT to the UARTs -- Replace the ascii keyboard with the real one, if possible -- Probably lots of other things - - -*************************************************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/m6805/m6805.h" -#include "machine/i8251.h" -#include "machine/6821pia.h" -#include "machine/z80dma.h" -#include "machine/pit8253.h" -#include "video/i8275.h" -#include "sound/beep.h" -#include "machine/keyboard.h" -#include "machine/wd_fdc.h" - - -class zorba_state : public driver_device -{ -public: - zorba_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_beep(*this, "beeper") - , m_dma(*this, "dma") - , m_u0(*this, "uart0") - , m_u1(*this, "uart1") - , m_u2(*this, "uart2") - , m_pia0(*this, "pia0") - , m_pia1(*this, "pia1") - , m_crtc(*this, "crtc") - , m_fdc (*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - {} - -public: - const UINT8 *m_p_chargen; - DECLARE_DRIVER_INIT(zorba); - DECLARE_MACHINE_RESET(zorba); - DECLARE_READ8_MEMBER(ram_r); - DECLARE_WRITE8_MEMBER(ram_w); - DECLARE_READ8_MEMBER(rom_r); - DECLARE_WRITE8_MEMBER(rom_w); - DECLARE_WRITE8_MEMBER(intmask_w); - DECLARE_WRITE_LINE_MEMBER(busreq_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - DECLARE_WRITE8_MEMBER(pia0_porta_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE_LINE_MEMBER(irq0_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); - I8275_DRAW_CHARACTER_MEMBER(zorba_update_chr); - required_device m_palette; - -private: - UINT8 m_term_data; - UINT8 m_fdc_rq; - required_device m_maincpu; - required_device m_beep; - required_device m_dma; - required_device m_u0; - required_device m_u1; - required_device m_u2; - required_device m_pia0; - required_device m_pia1; - required_device m_crtc; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; -}; - -static ADDRESS_MAP_START( zorba_mem, AS_PROGRAM, 8, zorba_state ) - AM_RANGE( 0x0000, 0x3fff ) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") - AM_RANGE( 0x4000, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( zorba_kbdmem, AS_PROGRAM, 8, zorba_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE( 0x000, 0x07f ) AM_RAM // internal RAM - AM_RANGE( 0x080, 0x7ff ) AM_ROM // internal EPROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( zorba_io, AS_IO, 8, zorba_state ) - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit", pit8254_device, read, write) - AM_RANGE(0x04, 0x04) AM_READWRITE(rom_r,rom_w) - AM_RANGE(0x05, 0x05) AM_READWRITE(ram_r,ram_w) - AM_RANGE(0x10, 0x11) AM_DEVREADWRITE("crtc", i8275_device, read, write) - AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("uart0", i8251_device, data_r, data_w) - AM_RANGE(0x21, 0x21) AM_DEVREADWRITE("uart0", i8251_device, status_r, control_w) - AM_RANGE(0x22, 0x22) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) - AM_RANGE(0x23, 0x23) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) - //AM_RANGE(0x24, 0x24) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w) - //AM_RANGE(0x25, 0x25) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w) - AM_RANGE(0x24, 0x25) AM_READ(keyboard_r) AM_WRITENOP - AM_RANGE(0x26, 0x26) AM_WRITE(intmask_w) - AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("dma", z80dma_device, read, write) - AM_RANGE(0x40, 0x43) AM_DEVREADWRITE("fdc", fd1793_t, read, write) - AM_RANGE(0x50, 0x53) AM_DEVREADWRITE("pia0", pia6821_device, read, write) - AM_RANGE(0x60, 0x63) AM_DEVREADWRITE("pia1", pia6821_device, read, write) -ADDRESS_MAP_END - -READ8_MEMBER( zorba_state::ram_r ) -{ - membank("bankr0")->set_entry(0); - return 0; -} - -WRITE8_MEMBER( zorba_state::ram_w ) -{ - membank("bankr0")->set_entry(0); -} - -READ8_MEMBER( zorba_state::rom_r ) -{ - membank("bankr0")->set_entry(1); - return 0; -} - -WRITE8_MEMBER( zorba_state::rom_w ) -{ - membank("bankr0")->set_entry(1); -} - -WRITE_LINE_MEMBER( zorba_state::irq0_w ) -{ - if (state) - { - m_maincpu->set_input_line_vector(0, 0x88); - m_maincpu->set_input_line(0, ASSERT_LINE); - } - else - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -WRITE_LINE_MEMBER( zorba_state::fdc_intrq_w ) -{ - m_fdc_rq = (m_fdc_rq & 2) | state; - if (m_fdc_rq == 1) - { - m_maincpu->set_input_line_vector(0, 0x80); - m_maincpu->set_input_line(0, ASSERT_LINE); - } - else - if (m_fdc_rq == 0) - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -WRITE_LINE_MEMBER( zorba_state::fdc_drq_w ) -{ - m_fdc_rq = (m_fdc_rq & 1) | (state << 1); - if (m_fdc_rq == 2) - { - m_maincpu->set_input_line_vector(0, 0x80); - m_maincpu->set_input_line(0, ASSERT_LINE); - } - else - if (m_fdc_rq == 0) - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -WRITE8_MEMBER( zorba_state::intmask_w ) -{ -} - -static INPUT_PORTS_START( zorba ) -INPUT_PORTS_END - -DRIVER_INIT_MEMBER( zorba_state, zorba ) -{ - UINT8 *main = memregion("maincpu")->base(); - - membank("bankr0")->configure_entry(0, &main[0x0000]); - membank("bankr0")->configure_entry(1, &main[0x10000]); - membank("bankw0")->configure_entry(0, &main[0x0000]); -} - -//------------------------------------------------- -// Z80DMA -//------------------------------------------------- - -WRITE_LINE_MEMBER( zorba_state::busreq_w ) -{ -// since our Z80 has no support for BUSACK, we assume it is granted immediately - m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); - m_dma->bai_w(state); // tell dma that bus has been granted -} - -READ8_MEMBER(zorba_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(zorba_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - prog_space.write_byte(offset, data); -} - -READ8_MEMBER(zorba_state::io_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(zorba_state::io_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_IO); - - if (offset == 0x10) - { - m_crtc->dack_w(space, 0, data); - } - else - { - prog_space.write_byte(offset, data); - } -} - - -static SLOT_INTERFACE_START( zorba_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) -SLOT_INTERFACE_END - -WRITE8_MEMBER( zorba_state::pia0_porta_w ) -{ - m_beep->set_state(BIT(data, 7)); - m_fdc->dden_w(BIT(data, 6)); - - floppy_image_device *floppy = NULL; - if (!BIT(data, 0)) floppy = m_floppy0->get_device(); - if (!BIT(data, 1)) floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - floppy->ss_w(!BIT(data, 5)); - - m_floppy0->get_device()->mon_w(BIT(data, 4)); - m_floppy1->get_device()->mon_w(BIT(data, 4)); -} - -I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) -{ - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - UINT8 gfx = m_p_chargen[(linecount & 15) + (charcode << 4) + ((gpa & 1) << 11)]; - - if (vsp) - gfx = 0; - - if (lten) - gfx = 0xff; - - if (rvv) - gfx ^= 0xff; - - for(i=0;i<8;i++) - bitmap.pix32(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; -} - - -/* F4 Character Displayer */ -static const gfx_layout u5_charlayout = -{ - 8, 11, /* 8 x 11 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( zorba ) - GFXDECODE_ENTRY( "chargen", 0x0000, u5_charlayout, 0, 1 ) -GFXDECODE_END - -MACHINE_RESET_MEMBER( zorba_state, zorba ) -{ - m_fdc_rq = 0; - m_beep->set_frequency(800); - m_p_chargen = memregion("chargen")->base(); - membank("bankr0")->set_entry(1); // point at rom - membank("bankw0")->set_entry(0); // always write to ram - m_maincpu->reset(); -} - -READ8_MEMBER( zorba_state::keyboard_r ) -{ - if (offset) - return (m_term_data) ? 0x87 : 0x85; - - UINT8 data = m_term_data; - m_term_data = 0; - return data; -} - -WRITE8_MEMBER( zorba_state::kbd_put ) -{ - m_term_data = data; -} - -static MACHINE_CONFIG_START( zorba, zorba_state ) - // basic machine hardware - MCFG_CPU_ADD("maincpu", Z80, XTAL_24MHz / 6) - MCFG_CPU_PROGRAM_MAP(zorba_mem) - MCFG_CPU_IO_MAP(zorba_io) - MCFG_MACHINE_RESET_OVERRIDE(zorba_state, zorba) - - /* keyboard */ - MCFG_CPU_ADD("kbdcpu", M68705, XTAL_3_579545MHz) // MC68705P3S (0x80 bytes ram, 0x780 bytes of rom) - MCFG_CPU_PROGRAM_MAP(zorba_kbdmem) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", zorba) - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - - /* devices */ - MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_24MHz/6) - // busack on cpu connects to bai pin - MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(zorba_state, busreq_w)) //connects to busreq on cpu - MCFG_Z80DMA_OUT_INT_CB(WRITELINE(zorba_state, irq0_w)) // connects to IRQ0 on IM2 controller - //ba0 - not connected - MCFG_Z80DMA_IN_MREQ_CB(READ8(zorba_state, memory_read_byte)) - MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(zorba_state, memory_write_byte)) - MCFG_Z80DMA_IN_IORQ_CB(READ8(zorba_state, io_read_byte)) - MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(zorba_state, io_write_byte)) - - MCFG_DEVICE_ADD("uart0", I8251, 0) // U32 COM port J2 - - MCFG_DEVICE_ADD("uart1", I8251, 0) // U31 printer port J3 - - MCFG_DEVICE_ADD("uart2", I8251, 0) // U30 serial keyboard J6 - - // port A - disk select etc, beeper - // port B - parallel interface - MCFG_DEVICE_ADD("pia0", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(zorba_state, pia0_porta_w)) - - // IEEE488 interface - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(XTAL_24MHz / 3) /* Timer 0: clock to J2 comm port */ - MCFG_PIT8253_CLK1(XTAL_24MHz / 3) /* Timer 1: clock to U31 */ - MCFG_PIT8253_CLK2(XTAL_24MHz / 3) /* Timer 2: clock to U30 */ - - MCFG_DEVICE_ADD("crtc", I8275, XTAL_14_31818MHz/7) - MCFG_I8275_CHARACTER_WIDTH(8) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(zorba_state, zorba_update_chr) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) - MCFG_I8275_IRQ_CALLBACK(WRITELINE(zorba_state, irq0_w)) - MCFG_FD1793_ADD("fdc", XTAL_24MHz / 24) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(zorba_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(zorba_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - - /* Keyboard */ - MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(zorba_state, kbd_put)) -MACHINE_CONFIG_END - -ROM_START( zorba ) - ROM_REGION( 0x14000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "780000.u47", 0x10000, 0x1000, CRC(6d58f2c5) SHA1(7763f08c801cd36e5a761c6dc9f30a50b3bc482d) ) - - ROM_REGION( 0x800, "kbdcpu", 0 ) - ROM_LOAD( "8999-1 3-28-83", 0x080, 0x780, CRC(79fe6c0d) SHA1(4b6fca9379d5199d1347ad1187cbfdebfc4c73e7) ) - - ROM_REGION( 0x1000, "chargen", 0 ) - ROM_LOAD( "773000.u5", 0x0000, 0x1000, CRC(d0a2f8fc) SHA1(29aee7ee657778c46e9800abd4955e6d4b33ef68) ) - - ROM_REGION( 0x60, "proms", 0 ) - ROM_LOAD( "74ls288.u37", 0x0000, 0x0020, CRC(0a67edd6) SHA1(c1ece8978a3a061e0130d43907fa63a71e75e75d) ) - ROM_LOAD( "74ls288.u38", 0x0020, 0x0020, CRC(5ec93ea7) SHA1(3a84c098474b05d5cbe1939a3e15f66d06470581) ) - ROM_LOAD( "74ls288.u77", 0x0040, 0x0020, CRC(946e03b0) SHA1(24240bdd7bdf507a5b51628fb36ad1266fc53a28) ) // suspected bad dump -ROM_END - -COMP( 1982, zorba, 0, 0, zorba, zorba, zorba_state, zorba, "Telcon Industries", "Zorba", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/zrt80.c b/src/mess/drivers/zrt80.c deleted file mode 100644 index fa192a2050a..00000000000 --- a/src/mess/drivers/zrt80.c +++ /dev/null @@ -1,323 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - DEC ZRT-80 - - 12/05/2009 Skeleton driver. - - 16/02/2011 Working. - - The beeper is external, frequency not known. I've made a reasonable - assumption of frequency and lengths. - - Make sure 'mode' dipswitch is set to 'local' so you can see your - typing. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/mc6845.h" -#include "machine/ins8250.h" -#include "machine/keyboard.h" -#include "sound/beep.h" - -#define KEYBOARD_TAG "keyboard" - -class zrt80_state : public driver_device -{ -public: - enum - { - TIMER_BEEP_OFF - }; - - zrt80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "crtc"), - m_8250(*this, "ins8250"), - m_beep(*this, "beeper"), - m_palette(*this, "palette") - { - } - - DECLARE_READ8_MEMBER(zrt80_10_r); - DECLARE_WRITE8_MEMBER(zrt80_30_w); - DECLARE_WRITE8_MEMBER(zrt80_38_w); - DECLARE_WRITE8_MEMBER(kbd_put); - MC6845_UPDATE_ROW(crtc_update_row); - const UINT8 *m_p_chargen; - required_shared_ptr m_p_videoram; -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -private: - UINT8 m_term_data; - virtual void machine_reset(); - virtual void video_start(); - required_device m_maincpu; - required_device m_crtc; - required_device m_8250; - required_device m_beep; -public: - required_device m_palette; -}; - - -READ8_MEMBER( zrt80_state::zrt80_10_r ) -{ - UINT8 ret = m_term_data; - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return ret; -} - -void zrt80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BEEP_OFF: - m_beep->set_state(0); - break; - default: - assert_always(FALSE, "Unknown id in zrt80_state::device_timer"); - } -} - - -WRITE8_MEMBER(zrt80_state::zrt80_30_w) -{ - timer_set(attotime::from_msec(100), TIMER_BEEP_OFF); - m_beep->set_state(1); -} - -WRITE8_MEMBER(zrt80_state::zrt80_38_w) -{ - timer_set(attotime::from_msec(400), TIMER_BEEP_OFF); - m_beep->set_state(1); -} - -static ADDRESS_MAP_START(zrt80_mem, AS_PROGRAM, 8, zrt80_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x0fff) AM_ROM // Z25 - Main firmware - AM_RANGE(0x1000, 0x1fff) AM_ROM // Z24 - Expansion - AM_RANGE(0x4000, 0x43ff) AM_RAM // Board RAM - // Normally video RAM is 0x800 but could be expanded up to 8K - AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("videoram") // Video RAM - -ADDRESS_MAP_END - -static ADDRESS_MAP_START( zrt80_io, AS_IO, 8, zrt80_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x07) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w ) - AM_RANGE(0x08, 0x08) AM_DEVWRITE("crtc", mc6845_device, address_w) - AM_RANGE(0x09, 0x09) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) - AM_RANGE(0x10, 0x17) AM_READ(zrt80_10_r) - AM_RANGE(0x18, 0x1F) AM_READ_PORT("DIPSW2") - AM_RANGE(0x20, 0x27) AM_READ_PORT("DIPSW3") - AM_RANGE(0x30, 0x37) AM_WRITE(zrt80_30_w) - AM_RANGE(0x38, 0x3F) AM_WRITE(zrt80_38_w) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( zrt80 ) - PORT_START("DIPSW1") - PORT_DIPNAME( 0x01, 0x01, "Composite Sync" ) - PORT_DIPSETTING( 0x01, "Negative" ) - PORT_DIPSETTING( 0x00, "Positive" ) - PORT_DIPNAME( 0x02, 0x02, "Vertical Sync" ) - PORT_DIPSETTING( 0x02, "Negative" ) - PORT_DIPSETTING( 0x00, "Positive" ) - PORT_DIPNAME( 0x04, 0x00, "Video" ) - PORT_DIPSETTING( 0x04, "Negative" ) - PORT_DIPSETTING( 0x00, "Positive" ) - PORT_DIPNAME( 0x08, 0x08, "Keypad" ) - PORT_DIPSETTING( 0x08, "Numeric" ) - PORT_DIPSETTING( 0x00, "Alternate Keyboard" ) - PORT_DIPNAME( 0x10, 0x10, "Horizontal Sync" ) - PORT_DIPSETTING( 0x10, "Negative" ) - PORT_DIPSETTING( 0x00, "Positive" ) - PORT_DIPNAME( 0x20, 0x20, "CPU" ) - PORT_DIPSETTING( 0x20, "Operating" ) - PORT_DIPSETTING( 0x00, "Reset" ) - PORT_DIPNAME( 0x40, 0x40, "Keyboard strobe" ) - PORT_DIPSETTING( 0x40, "Negative" ) - PORT_DIPSETTING( 0x00, "Positive" ) - PORT_DIPNAME( 0x80, 0x00, "Beeper" ) - PORT_DIPSETTING( 0x80, "Silent" ) - PORT_DIPSETTING( 0x00, "Enable" ) - PORT_START("DIPSW2") - PORT_DIPNAME( 0x0f, 0x05, "Baud rate" ) - PORT_DIPSETTING( 0x00, "50" ) - PORT_DIPSETTING( 0x01, "75" ) - PORT_DIPSETTING( 0x02, "110" ) - PORT_DIPSETTING( 0x03, "134.5" ) - PORT_DIPSETTING( 0x04, "150" ) - PORT_DIPSETTING( 0x05, "300" ) - PORT_DIPSETTING( 0x06, "600" ) - PORT_DIPSETTING( 0x07, "1200" ) - PORT_DIPSETTING( 0x08, "1800" ) - PORT_DIPSETTING( 0x09, "2000" ) - PORT_DIPSETTING( 0x0a, "2400" ) - PORT_DIPSETTING( 0x0b, "3600" ) - PORT_DIPSETTING( 0x0c, "4800" ) - PORT_DIPSETTING( 0x0d, "7200" ) - PORT_DIPSETTING( 0x0e, "9600" ) - PORT_DIPSETTING( 0x0f, "19200" ) - PORT_DIPNAME( 0x30, 0x20, "Parity" ) - PORT_DIPSETTING( 0x00, "Odd" ) - PORT_DIPSETTING( 0x10, "Even" ) - PORT_DIPSETTING( 0x20, "Marking" ) - PORT_DIPSETTING( 0x30, "Spacing" ) - PORT_DIPNAME( 0x40, 0x40, "Handshake" ) - PORT_DIPSETTING( 0x40, "CTS" ) - PORT_DIPSETTING( 0x00, "XON/XOFF" ) - PORT_DIPNAME( 0x80, 0x80, "Line Feed" ) - PORT_DIPSETTING( 0x80, "No LF on CR" ) - PORT_DIPSETTING( 0x00, "Auto" ) - PORT_START("DIPSW3") - PORT_DIPNAME( 0x07, 0x07, "Display" ) - PORT_DIPSETTING( 0x00, "96 x 24 15750Hz, 50Hz" ) - PORT_DIPSETTING( 0x01, "80 x 48 15750Hz, 50Hz" ) - PORT_DIPSETTING( 0x02, "80 x 24 15750Hz, 50Hz" ) - PORT_DIPSETTING( 0x03, "96 x 24 15750Hz, 60Hz" ) - PORT_DIPSETTING( 0x04, "80 x 48 18700Hz, 50Hz" ) - PORT_DIPSETTING( 0x05, "80 x 24 17540Hz, 60Hz" ) - PORT_DIPSETTING( 0x06, "80 x 48 15750Hz, 60Hz" ) - PORT_DIPSETTING( 0x07, "80 x 24 15750Hz, 60Hz" ) - PORT_DIPNAME( 0x18, 0x18, "Emulation" ) - PORT_DIPSETTING( 0x00, "Adds" ) - PORT_DIPSETTING( 0x08, "Beehive" ) - PORT_DIPSETTING( 0x10, "LSI ADM-3" ) - PORT_DIPSETTING( 0x18, "Heath H-19" ) - PORT_DIPNAME( 0x20, 0x00, "Mode" ) - PORT_DIPSETTING( 0x20, "Line" ) - PORT_DIPSETTING( 0x00, "Local" ) - PORT_DIPNAME( 0x40, 0x40, "Duplex" ) - PORT_DIPSETTING( 0x40, "Full" ) - PORT_DIPSETTING( 0x00, "Half" ) - PORT_DIPNAME( 0x80, 0x80, "Wraparound" ) - PORT_DIPSETTING( 0x80, "Disabled" ) - PORT_DIPSETTING( 0x00, "Enabled" ) -INPUT_PORTS_END - - -void zrt80_state::machine_reset() -{ - m_beep->set_frequency(800); - m_term_data = 0; -} - -void zrt80_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -MC6845_UPDATE_ROW( zrt80_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,inv; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - UINT8 polarity = ioport("DIPSW1")->read() & 4 ? 0xff : 0; - - for (x = 0; x < x_count; x++) - { - inv = polarity; - if (x == cursor_x) inv ^= 0xff; - mem = (ma + x) & 0x1fff; - chr = m_p_videoram[mem]; - - if BIT(chr, 7) - { - inv ^= 0xff; - chr &= 0x7f; - } - - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; - - /* Display a scanline of a character */ - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} - -WRITE8_MEMBER( zrt80_state::kbd_put ) -{ - m_term_data = data; - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); -} - -/* F4 Character Displayer */ -static const gfx_layout zrt80_charlayout = -{ - 8, 16, /* 8 x 16 characters */ - 128, /* 128 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 16 bytes */ -}; - -static GFXDECODE_START( zrt80 ) - GFXDECODE_ENTRY( "chargen", 0x0000, zrt80_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_START( zrt80, zrt80_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) - MCFG_CPU_PROGRAM_MAP(zrt80_mem) - MCFG_CPU_IO_MAP(zrt80_io) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_SCREEN_SIZE(640, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", zrt80) - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - /* Devices */ - MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_20MHz / 8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) /*?*/ - MCFG_MC6845_UPDATE_ROW_CB(zrt80_state, crtc_update_row) - - MCFG_DEVICE_ADD( "ins8250", INS8250, 2457600 ) - MCFG_INS8250_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(zrt80_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( zrt80 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD("zrt80mon.z25", 0x0000, 0x1000, CRC(e6ea96dc) SHA1(e3075e30bb2b85f9288d0b8b8cdf1d2b4f7586fd) ) - //z24 is 2nd chip, used as expansion - - ROM_REGION( 0x0800, "chargen", 0 ) - ROM_LOAD("zrt80chr.z30", 0x0000, 0x0800, CRC(4dbdc60f) SHA1(20e393f7207a8440029c8290cdf2f121d317a37e) ) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1982, zrt80, 0, 0, zrt80, zrt80, driver_device, 0, "Digital Research Computers", "ZRT-80", 0) diff --git a/src/mess/drivers/zsbc3.c b/src/mess/drivers/zsbc3.c deleted file mode 100644 index 65efc05856b..00000000000 --- a/src/mess/drivers/zsbc3.c +++ /dev/null @@ -1,127 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Digital Microsystems ZSBC-3 - - 11/01/2010 Skeleton driver. - 28/11/2010 Connected to a terminal - 11/01/2011 Converted to Modern. - -**************************************************************************** - - Monitor commands: [] indicates optional - - Bx = Boot from device x (0 to 7) - Dx [y] = Dump memory (hex and ascii) in range x [to y] - Fx y z = Fill memory x to y with z - Gx = Execute program at address x - Ix = Display IN of port x - Ox y = Output y to port x - Sx = Enter memory editing mode, press enter for next address - Mx y = unknown (affects memory) - Tx = unknown (does strange things) - enter = dump memory from 9000 to 907F (why?) - -**************************************************************************** - - TODO: - Everything really... - - Devices of all kinds; - Use the other rom for something.. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class zsbc3_state : public driver_device -{ -public: - zsbc3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - DECLARE_READ8_MEMBER(zsbc3_28_r); - DECLARE_READ8_MEMBER(zsbc3_2a_r); - DECLARE_WRITE8_MEMBER(kbd_put); -private: - UINT8 m_term_data; - virtual void machine_reset(); - required_device m_maincpu; - required_device m_terminal; -}; - - -READ8_MEMBER( zsbc3_state::zsbc3_28_r ) -{ - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; -} - -READ8_MEMBER( zsbc3_state::zsbc3_2a_r ) -{ - return (m_term_data) ? 5 : 4; -} - -static ADDRESS_MAP_START(zsbc3_mem, AS_PROGRAM, 8, zsbc3_state) - ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x07ff ) AM_ROM - AM_RANGE( 0x0800, 0xffff ) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(zsbc3_io, AS_IO, 8, zsbc3_state) - ADDRESS_MAP_UNMAP_HIGH - ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x28, 0x28) AM_READ(zsbc3_28_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write) - AM_RANGE(0x2a, 0x2a) AM_READ(zsbc3_2a_r) -ADDRESS_MAP_END - -/* Input ports */ -static INPUT_PORTS_START( zsbc3 ) -INPUT_PORTS_END - - -void zsbc3_state::machine_reset() -{ -} - -WRITE8_MEMBER( zsbc3_state::kbd_put ) -{ - m_term_data = data; -} - - -static MACHINE_CONFIG_START( zsbc3, zsbc3_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, XTAL_16MHz /4) - MCFG_CPU_PROGRAM_MAP(zsbc3_mem) - MCFG_CPU_IO_MAP(zsbc3_io) - - /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(zsbc3_state, kbd_put)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( zsbc3 ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "54-3002_zsbc_monitor_1.09.bin", 0x0000, 0x0800, CRC(628588e9) SHA1(8f0d489147ec8382ca007236e0a95a83b6ebcd86)) - - ROM_REGION( 0x10000, "hdc", ROMREGION_ERASEFF ) - ROM_LOAD( "54-8622_hdc13.bin", 0x0000, 0x0400, CRC(02c7cd6d) SHA1(494281ba081a0f7fbadfc30a7d2ea18c59e55101)) -ROM_END - -/* Driver */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, zsbc3, 0, 0, zsbc3, zsbc3, driver_device, 0, "Digital Microsystems", "ZSBC-3", MACHINE_NO_SOUND_HW) diff --git a/src/mess/drivers/zx.c b/src/mess/drivers/zx.c deleted file mode 100644 index 467d515aacb..00000000000 --- a/src/mess/drivers/zx.c +++ /dev/null @@ -1,544 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Krzysztof Strzecha, Robbbert -/*************************************************************************** - zx.c - - Original driver by: - Juergen Buchmueller, Dec 1999 - - Fixes and additions by Krzysztof Strzecha: - 07.06.2004 Tape loading added. Some cleanups of debug code. - Fixed stupid bug in timings (vblank duration). - MACHINE_NOT_WORKING flag removed. - 29.05.2004 CPU clock, number of scanlines, vblank duration corrected. - Some cleanups. Two non-working TESTDRIVERS added. - 14.05.2004 Finally fixed and readded. - - Changes done by Robbbert in Jan 2009: - - Added the NTSC/PAL diode to all systems except pc8300 which doesn't support it. - - Applied NTSC timings to pc8300 only, all others depend on the diode. - - Many keyboard fixes, and descriptions added to keys. - - Fixed .O files from causing an access violation. - - Enabled cassette saving. - - Many general fixes to pow3000/lambda. - - Added sound to pc8300/pow3000/lambda. - - 24/12/2009 (Robbbert) - - Added rom mirror, this fixes ringo470 - - Added back the F4 character display - - 14/08/2011 (Robbbert) - - Modernised. - - To do / problems: - - Some memory areas are not mirrored as they should. - - Video hardware is not fully emulated, so it does not support pseudo hi-res and hi-res modes. - - The screen in pc8300/pow3000/lambda jumps when you type something. - - lambda/pow3000 32k memory pack is unemulated, because where is the upper 16k mirror going to be? - - h4th and tree4th need their address maps worked out (eg, the stack is set to FB80) - - lambda/pow3000 joystick, connected in parallel with the 4,R,F,7,U keys, but the directions are unknown. - - Many games don't work. - - -****************************************************************************/ - -#include "includes/zx.h" - -/* Memory Maps */ - -static ADDRESS_MAP_START( zx80_map, AS_PROGRAM, 8, zx_state ) - AM_RANGE(0x0000, 0x1fff) AM_ROM AM_MIRROR(0x2000) - AM_RANGE(0xc000, 0xffff) AM_RAM_READ(zx_ram_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( zx80_io_map, AS_IO, 8, zx_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(zx80_io_r, zx80_io_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( zx81_io_map, AS_IO, 8, zx_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(zx81_io_r, zx81_io_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8300_io_map, AS_IO, 8, zx_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(pc8300_io_r, zx81_io_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pow3000_io_map, AS_IO, 8, zx_state ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(pow3000_io_r, zx81_io_w) -ADDRESS_MAP_END - -/* Input Ports */ - -static INPUT_PORTS_START( zx80 ) -/* PORT_NAME = Key Mode (Press Key) Shift Mode (Press Key+Shift) BASIC Mode (Press Key at BASIC) */ -/* Some keys (e.g. A,S,D,F,G etc.) produce glyphs when used in Shift Mode. MESS currently cannot show -these functions in Input (This System) menu, hence we live some empty space in the menu */ - PORT_START("ROW0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z :") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR(':') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X ; CLEAR") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR(';') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C ? CLS") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('?') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V / GOSUB") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('/') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A LIST") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S STOP") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DIM") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F FOR") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q NEW") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W LOAD") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E SAVE") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R RUN") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T CONT") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 NOT") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 AND") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 THEN") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 TO") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 Left") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 RUBOUT") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(8) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 HOME") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 Right") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 Up") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 Down") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P *") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O ) PRINT") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I ( INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U $ IF") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y \" REM") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('"') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEWLINE EDIT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L =") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K + LET") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J - RAND") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H ** POKE") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE \xC2\xA3 BREAK") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('\xA3') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". ,") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(',') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M >") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N < NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B OR RET") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("CONFIG") /* config diode on main board */ - PORT_CONFNAME( 0x40, 0x40, "TV system") - PORT_CONFSETTING( 0x00, "NTSC") - PORT_CONFSETTING( 0x40, "PAL") -INPUT_PORTS_END - -static INPUT_PORTS_START( pc8300 ) -/* PORT_NAME = Key Mode (Press Key) Shift Mode (Press Key+Shift) BASIC Mode (Press Key at BASIC) */ - PORT_START("ROW0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z :") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR(':') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X ;") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR(';') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C ?") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('?') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V /") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('/') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A STOP NEW") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S LPRINT SAVE") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D SLOW DIM") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F FAST FOR") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G LLIST GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q \"\" PLOT") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W OR UNPLOT") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E STEP REM") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R <= RUN") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T <> RAND") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 EDIT") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 AND") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 THEN") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 TO") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 Left") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 DELETE") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(8) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 GRAPHICS") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 Right") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 Up") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 Down") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P \" PRINT") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O ) POKE") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I ( INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U $ IF") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y >= RETURN") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER FUNCTION") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L = LET") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K + LIST") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J - LOAD") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H ** GOSUB") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE \xC2\xA3") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR('\xA3') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". ,") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(',') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M > PAUSE") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N < NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B * SCROLL") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('*') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - -static INPUT_PORTS_START( zx81 ) - PORT_INCLUDE(pc8300) - - PORT_START("CONFIG") /* config diode on main board */ - PORT_CONFNAME( 0x40, 0x40, "TV system") - PORT_CONFSETTING( 0x00, "NTSC") - PORT_CONFSETTING( 0x40, "PAL") -INPUT_PORTS_END - -static INPUT_PORTS_START( pow3000 ) - PORT_START("ROW0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z PRINT") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X AUTO") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C Up") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V Down") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A ASN") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S ACS") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D ATN") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F EXP") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G ABS") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q SIN") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W COS") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E TAN") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R LOG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T SGN") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 \"") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('"') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 =") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 ,") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(',') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 ;") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(';') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P >") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('>') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O <") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('<') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I PI") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U RND") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y SQR") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER GRAPHICS") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L +") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('+') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K -") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('-') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J *") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H /") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('/') - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("ROW7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE BREAK") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". DELETE") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M EDIT") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N Right") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B Left") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("CONFIG") /* config diode on main board */ - PORT_CONFNAME( 0x01, 0x00, "TV system") - PORT_CONFSETTING( 0x00, "NTSC") - PORT_CONFSETTING( 0x01, "PAL") -INPUT_PORTS_END - - -/* F4 character display */ - -static const gfx_layout zx_gfx_layout = -{ - 8, 8, /* 8x8 pixels */ - 64, /* 64 codes */ - 1, /* 1 bit per pixel */ - {0}, /* no bitplanes */ - /* x offsets */ - {0, 1, 2, 3, 4, 5, 6, 7}, - /* y offsets */ - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, - 8 * 8 /* eight bytes per code */ -}; - - -/* Graphics Decode Information */ - -static GFXDECODE_START( zx80 ) - GFXDECODE_ENTRY( "maincpu", 0x0e00, zx_gfx_layout, 0, 2 ) -GFXDECODE_END - -static GFXDECODE_START( zx81 ) - GFXDECODE_ENTRY( "maincpu", 0x1e00, zx_gfx_layout, 0, 2 ) -GFXDECODE_END - -static GFXDECODE_START( pc8300 ) - GFXDECODE_ENTRY( "gfx1", 0, zx_gfx_layout, 0, 2 ) -GFXDECODE_END - - - -/* Palette Initialization */ - - -PALETTE_INIT_MEMBER(zx_state, zx) -{ - palette.set_pen_color(0,rgb_t::white); /* white */ - palette.set_pen_color(1,rgb_t::black); /* black */ - palette.set_pen_color(2,rgb_t::black); /* black */ - palette.set_pen_color(3,rgb_t::white); /* white */ -} - -PALETTE_INIT_MEMBER(zx_state,ts1000) -{ - palette.set_pen_color(0,rgb_t(64, 244, 244)); /* cyan */ - palette.set_pen_color(1,rgb_t::black); /* black */ - palette.set_pen_color(2,rgb_t::black); /* black */ - palette.set_pen_color(3,rgb_t(64, 244, 244)); /* cyan */ -} - - -#define ZX81_CPU_CLOCK 3250000 -#define ZX81_CYCLES_PER_SCANLINE 207 -#define ZX81_PIXELS_PER_SCANLINE 256 -#define ZX81_CYCLES_PER_VBLANK 1235 -#define ZX81_VBLANK_DURATION (1.0*ZX81_CYCLES_PER_VBLANK/ZX81_CPU_CLOCK*1000*1000) - -#define ZX81_PAL_SCANLINES 304 -#define ZX81_PAL_FRAMES_PER_SECOND (1.0*ZX81_CPU_CLOCK/(ZX81_PAL_SCANLINES*ZX81_CYCLES_PER_SCANLINE+ZX81_CYCLES_PER_VBLANK)) - -#define ZX81_NTSC_SCANLINES 256 -#define ZX81_NTSC_FRAMES_PER_SECOND (1.0*ZX81_CPU_CLOCK/(ZX81_NTSC_SCANLINES*ZX81_CYCLES_PER_SCANLINE+ZX81_CYCLES_PER_VBLANK)) - -/* Machine Drivers */ - -static MACHINE_CONFIG_START( zx80, zx_state ) - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", Z80, ZX81_CPU_CLOCK) - MCFG_CPU_PROGRAM_MAP(zx80_map) - MCFG_CPU_IO_MAP(zx80_io_map) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(ZX81_PAL_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(ZX81_VBLANK_DURATION)) - - - /* video hardware */ - MCFG_SCREEN_UPDATE_DRIVER(zx_state, screen_update) - MCFG_SCREEN_SIZE(ZX81_PIXELS_PER_SCANLINE, ZX81_PAL_SCANLINES) - MCFG_SCREEN_VISIBLE_AREA(0, ZX81_PIXELS_PER_SCANLINE-1, 0, ZX81_PAL_SCANLINES-1) - MCFG_SCREEN_VBLANK_DRIVER(zx_state, screen_eof_zx) - MCFG_SCREEN_PALETTE("palette") - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", zx80) - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(zx_state,zx) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) /* Used by pc8300/lambda/pow3000 */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_FORMATS(zx80_o_format) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED) - - /* internal ram */ - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("1K") - MCFG_RAM_EXTRA_OPTIONS("16K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( zx81, zx80 ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(zx81_io_map) - - MCFG_GFXDECODE_MODIFY("gfxdecode", zx81) - - MCFG_CASSETTE_MODIFY( "cassette" ) - MCFG_CASSETTE_FORMATS(zx81_p_format) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ts1000, zx81 ) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(zx_state,ts1000) -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( ts1500, ts1000 ) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pc8300, zx81 ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(pc8300_io_map) - - MCFG_MACHINE_RESET_OVERRIDE(zx_state,pc8300) - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(ZX81_NTSC_FRAMES_PER_SECOND) - MCFG_SCREEN_SIZE(ZX81_PIXELS_PER_SCANLINE, ZX81_NTSC_SCANLINES) - MCFG_SCREEN_VISIBLE_AREA(0, ZX81_PIXELS_PER_SCANLINE-1, 0, ZX81_NTSC_SCANLINES-1) - - MCFG_GFXDECODE_MODIFY("gfxdecode", pc8300) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("16K") -MACHINE_CONFIG_END - -static MACHINE_CONFIG_DERIVED( pow3000, zx81 ) - - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_IO_MAP(pow3000_io_map) - - MCFG_MACHINE_RESET_OVERRIDE(zx_state,pow3000) - - MCFG_GFXDECODE_MODIFY("gfxdecode", pc8300) - - /* internal ram */ - MCFG_RAM_MODIFY(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("2K") - MCFG_RAM_EXTRA_OPTIONS("16K") -MACHINE_CONFIG_END - - -/* ROMs */ - -ROM_START(zx80) - ROM_REGION( 0x10000, "maincpu",0 ) - ROM_SYSTEM_BIOS(0, "default", "BASIC") - ROMX_LOAD( "zx80.rom", 0x0000, 0x1000, CRC(4c7fc597) SHA1(b6769a3197c77009e0933e038c15b43cf4c98c7a), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "aszmic", "ASZMIC") - ROMX_LOAD( "aszmic.rom", 0x0000, 0x1000, CRC(6c123536) SHA1(720867cbfafafc8c7438bbc325a77eaef571e5c0), ROM_BIOS(2) ) -ROM_END - -ROM_START(zx81) - ROM_REGION( 0x10000, "maincpu",0 ) - ROM_SYSTEM_BIOS(0, "3rd", "3rd rev.") - ROMX_LOAD( "zx81b.rom", 0x0000, 0x2000, CRC(522c37b8) SHA1(c6d8e06cb936989f6e1cc7a56d1f092da854a515), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS(1, "1st", "1st rev.") - ROMX_LOAD( "zx81.rom", 0x0000, 0x2000, CRC(fcbbd617) SHA1(a0ade36540561cc1691bb6f0c42ceae12484a102), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS(2, "2nd", "2nd rev.") - ROMX_LOAD( "zx81a.rom", 0x0000, 0x2000, CRC(4b1dd6eb) SHA1(7b143ee964e9ada89d1f9e88f0bd48d919184cfc), ROM_BIOS(3) ) - ROM_SYSTEM_BIOS(3, "hforth", "Forth by David Husband") - ROMX_LOAD( "h4th.rom", 0x0000, 0x2000, CRC(257d5a32) SHA1(03809a6b464609ff924f7e55a85eef875cd47ae8), ROM_BIOS(4) ) - ROM_SYSTEM_BIOS(4, "tforth", "Forth by Tree Systems") - ROMX_LOAD( "tree4th.rom", 0x0000, 0x2000, CRC(71616238) SHA1(3ee15779e03482b10fc59eb4df2446376c56b00d), ROM_BIOS(5) ) -ROM_END - -ROM_START(ts1000) - ROM_REGION( 0x10000, "maincpu",0 ) - ROM_LOAD( "zx81a.rom", 0x0000, 0x2000, CRC(4b1dd6eb) SHA1(7b143ee964e9ada89d1f9e88f0bd48d919184cfc) ) -ROM_END - -ROM_START(ts1500) - ROM_REGION( 0x10000, "maincpu",0 ) - ROM_LOAD( "d2364c_649.u2", 0x0000, 0x2000, CRC(7dd19c48) SHA1(3eb437359221b4406d236085ec66fa02278e7495) ) -ROM_END - -ROM_START(ringo470) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "ringo470.rom", 0x0000, 0x2000, CRC(b9c5abec) SHA1(191c4994adfffe4f83b98dc3959dde2724b1dbac) ) -ROM_END - -ROM_START(pc8300) - ROM_REGION( 0x10000, "maincpu",0 ) - ROM_LOAD( "8300_org.rom", 0x0000, 0x2000, CRC(a350f2b1) SHA1(6a9be484556cc27a9cd9d71085d2027c6243333f) ) - - ROM_REGION( 0x200, "gfx1", 0 ) - ROM_LOAD( "8300_fnt.bin", 0x0000, 0x0200, CRC(6bd0408c) SHA1(34a7a5afee511dc8bba28eccf305c873d80a557a) ) -ROM_END - -ROM_START(pow3000) - ROM_REGION( 0x10000, "maincpu",0 ) - ROM_LOAD( "pow3000.rom", 0x0000, 0x2000, CRC(8a49b2c3) SHA1(9b22daf2f3a991aa6a358ef95b091654c3ca1bdf) ) - - ROM_REGION( 0x200, "gfx1", 0 ) - ROM_LOAD( "pow3000.chr", 0x0000, 0x0200, CRC(1c42fe46) SHA1(5b30ba77c8f57065d106db69964c9ff2e4221760) ) -ROM_END - -ROM_START(lambda) - ROM_REGION( 0x10000, "maincpu",0 ) - ROM_LOAD( "lambda.rom", 0x0000, 0x2000, CRC(8a49b2c3) SHA1(9b22daf2f3a991aa6a358ef95b091654c3ca1bdf) ) - - ROM_REGION( 0x200, "gfx1", 0 ) - ROM_LOAD( "8300_fnt.bin", 0x0000, 0x0200, CRC(6bd0408c) SHA1(34a7a5afee511dc8bba28eccf305c873d80a557a) ) -ROM_END - -ROM_START( tk85 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "tk85.rom", 0x0000, 0x2800, CRC(8972d756) SHA1(7b961a1733fc047eb682150a32e17bca10a018d2) ) -ROM_END - -/* This homebrew has 192k of RAM and 32k of ROM via bankswitching. One of the primary bankswitching lines is /M1, - which is not emulated by MAME's z80. */ -ROM_START( zx97 ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "zx97.rom", 0x0000, 0x2000, CRC(5cf49744) SHA1(b2a486efdc7b2bc3dc8e5a441ea5532bfa3207bd) ) - ROM_IGNORE( 0x6000 ) /* Unemulated bankswitched part */ -ROM_END - -/* Game Drivers */ - -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, zx80, 0, 0, zx80, zx80, zx_state, zx, "Sinclair Research Ltd", "ZX-80", 0 ) -COMP( 1981, zx81, 0, 0, zx81, zx81, zx_state, zx, "Sinclair Research Ltd", "ZX-81", 0 ) -COMP( 1982, ts1000, zx81, 0, ts1000, zx81, zx_state, zx, "Timex Sinclair", "Timex Sinclair 1000", 0 ) -COMP( 1983, ts1500, zx81, 0, ts1500, zx81, zx_state, zx, "Timex Sinclair", "Timex Sinclair 1500", 0 ) -COMP( 1983, tk85, zx81, 0, ts1000, zx81, zx_state, zx, "Microdigital", "TK85", 0 ) -COMP( 1983, ringo470, zx81, 0, ts1000, zx81, zx_state, zx, "Ritas do Brasil Ltda", "Ringo 470", 0 ) -COMP( 1984, pc8300, zx81, 0, pc8300, pc8300, zx_state, zx, "Your Computer", "PC8300", 0 ) -COMP( 1983, pow3000, zx81, 0, pow3000, pow3000, zx_state, zx, "Creon Enterprises", "Power 3000", 0 ) -COMP( 1982, lambda, zx81, 0, pow3000, pow3000, zx_state, zx, "Lambda Electronics Ltd", "Lambda 8300", 0 ) -COMP( 1997, zx97, zx81, 0, zx81, zx81, zx_state, zx, "Wilf Rigter", "ZX97", MACHINE_NOT_WORKING | MACHINE_UNOFFICIAL ) diff --git a/src/mess/includes/abc1600.h b/src/mess/includes/abc1600.h deleted file mode 100644 index 9e32684766f..00000000000 --- a/src/mess/includes/abc1600.h +++ /dev/null @@ -1,158 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __ABC1600__ -#define __ABC1600__ - -#include "bus/abcbus/abcbus.h" -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "machine/8530scc.h" -#include "bus/abckb/abckb.h" -#include "machine/abc1600mac.h" -#include "machine/e0516.h" -#include "machine/nmc9306.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "machine/z80dart.h" -#include "machine/z80dma.h" -#include "machine/z8536.h" -#include "video/abc1600.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define MC68008P8_TAG "3f" -#define Z8410AB1_0_TAG "5g" -#define Z8410AB1_1_TAG "7g" -#define Z8410AB1_2_TAG "9g" -#define Z8470AB1_TAG "17b" -#define Z8530B1_TAG "2a" -#define Z8536B1_TAG "15b" -#define SAB1797_02P_TAG "5a" -#define FDC9229BT_TAG "7a" -#define E050_C16PC_TAG "13b" -#define NMC9306_TAG "14c" -#define SCREEN_TAG "screen" -#define BUS0I_TAG "bus0i" -#define BUS0X_TAG "bus0x" -#define BUS1_TAG "bus1" -#define BUS2_TAG "bus2" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" -#define ABC_KEYBOARD_PORT_TAG "kb" - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> abc1600_state - -class abc1600_state : public driver_device -{ -public: - abc1600_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MC68008P8_TAG), - m_dma0(*this, Z8410AB1_0_TAG), - m_dma1(*this, Z8410AB1_1_TAG), - m_dma2(*this, Z8410AB1_2_TAG), - m_dart(*this, Z8470AB1_TAG), - m_scc(*this, Z8530B1_TAG), - m_cio(*this, Z8536B1_TAG), - m_fdc(*this, SAB1797_02P_TAG), - m_rtc(*this, E050_C16PC_TAG), - m_nvram(*this, NMC9306_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, SAB1797_02P_TAG":0"), - m_floppy1(*this, SAB1797_02P_TAG":1"), - m_floppy2(*this, SAB1797_02P_TAG":2"), - m_bus0i(*this, BUS0I_TAG), - m_bus0x(*this, BUS0X_TAG), - m_bus1(*this, BUS1_TAG), - m_bus2(*this, BUS2_TAG) - { } - - required_device m_maincpu; - required_device m_dma0; - required_device m_dma1; - required_device m_dma2; - required_device m_dart; - required_device m_scc; - required_device m_cio; - required_device m_fdc; - required_device m_rtc; - required_device m_nvram; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_bus0i; - required_device m_bus0x; - required_device m_bus1; - required_device m_bus2; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( bus_r ); - DECLARE_WRITE8_MEMBER( bus_w ); - DECLARE_READ8_MEMBER( dart_r ); - DECLARE_WRITE8_MEMBER( dart_w ); - DECLARE_READ8_MEMBER( scc_r ); - DECLARE_WRITE8_MEMBER( scc_w ); - DECLARE_READ8_MEMBER( cio_r ); - DECLARE_WRITE8_MEMBER( cio_w ); - DECLARE_WRITE8_MEMBER( fw0_w ); - DECLARE_WRITE8_MEMBER( fw1_w ); - DECLARE_WRITE8_MEMBER( spec_contr_reg_w ); - - DECLARE_WRITE_LINE_MEMBER( dbrq_w ); - - DECLARE_READ8_MEMBER( cio_pa_r ); - DECLARE_READ8_MEMBER( cio_pb_r ); - DECLARE_WRITE8_MEMBER( cio_pb_w ); - DECLARE_READ8_MEMBER( cio_pc_r ); - DECLARE_WRITE8_MEMBER( cio_pc_w ); - - DECLARE_WRITE_LINE_MEMBER( nmi_w ); - - IRQ_CALLBACK_MEMBER( abc1600_int_ack ); - - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - - UINT8 read_io(offs_t offset); - void write_io(offs_t offset, UINT8 data); - UINT8 read_internal_io(offs_t offset); - void write_internal_io(offs_t offset, UINT8 data); - UINT8 read_external_io(offs_t offset); - void write_external_io(offs_t offset, UINT8 data); - - void update_drdy0(); - void update_drdy1(); - void update_drdy2(); - - // DMA - int m_dmadis; - int m_sysscc; - int m_sysfs; - UINT8 m_cause; - int m_partst; // parity test - - // peripherals - int m_cs7; // card select address bit 7 - int m_bus0; // BUS 0 selected - UINT8 m_csb; // card select - int m_atce; // V.24 channel A external clock enable - int m_btce; // V.24 channel B external clock enable -}; - - - -#endif diff --git a/src/mess/includes/abc80.h b/src/mess/includes/abc80.h deleted file mode 100644 index 253ed7e757d..00000000000 --- a/src/mess/includes/abc80.h +++ /dev/null @@ -1,184 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/***************************************************************************** - * - * includes/abc80.h - * - ****************************************************************************/ - -#ifndef __ABC80__ -#define __ABC80__ - -#include "bus/abcbus/abcbus.h" -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "imagedev/flopdrv.h" -#include "imagedev/printer.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "machine/abc80kb.h" -#include "machine/keyboard.h" -#include "machine/ram.h" -#include "machine/z80pio.h" -#include "sound/sn76477.h" -#include "sound/wave.h" - -#define ABC80_HTOTAL 384 -#define ABC80_HBEND 35 -#define ABC80_HBSTART 384 -#define ABC80_VTOTAL 312 -#define ABC80_VBEND 15 -#define ABC80_VBSTART 312 - -#define ABC80_K5_HSYNC 0x01 -#define ABC80_K5_DH 0x02 -#define ABC80_K5_LINE_END 0x04 -#define ABC80_K5_ROW_START 0x08 - -#define ABC80_K2_VSYNC 0x01 -#define ABC80_K2_DV 0x02 -#define ABC80_K2_FRAME_END 0x04 -#define ABC80_K2_FRAME_RESET 0x08 - -#define ABC80_J3_BLANK 0x01 -#define ABC80_J3_TEXT 0x02 -#define ABC80_J3_GRAPHICS 0x04 -#define ABC80_J3_VERSAL 0x08 - -#define ABC80_E7_VIDEO_RAM 0x01 -#define ABC80_E7_INT_RAM 0x02 -#define ABC80_E7_31K_EXT_RAM 0x04 -#define ABC80_E7_16K_INT_RAM 0x08 - -#define ABC80_CHAR_CURSOR 0x80 - -#define SCREEN_TAG "screen" -#define Z80_TAG "ab67" -#define Z80PIO_TAG "cd67" -#define SN76477_TAG "g8" -#define RS232_TAG "ser" -#define CASSETTE_TAG "cassette" -#define KEYBOARD_TAG "keyboard" -#define TIMER_CASSETTE_TAG "cass" - -class abc80_state : public driver_device -{ -public: - abc80_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_pio(*this, Z80PIO_TAG), - m_psg(*this, SN76477_TAG), - m_cassette(*this, "cassette"), - m_bus(*this, ABCBUS_TAG), - m_kb(*this, ABC80_KEYBOARD_TAG), - m_ram(*this, RAM_TAG), - m_rs232(*this, RS232_TAG), - m_palette(*this, "palette"), - m_rom(*this, Z80_TAG), - m_mmu_rom(*this, "mmu"), - m_char_rom(*this, "chargen"), - m_hsync_prom(*this, "hsync"), - m_vsync_prom(*this, "vsync"), - m_line_prom(*this, "line"), - m_attr_prom(*this, "attr"), - m_video_ram(*this, "video_ram"), - m_motor(false), - m_tape_in(1), - m_tape_in_latch(1) - { } - - required_device m_maincpu; - required_device m_pio; - required_device m_psg; - required_device m_cassette; - required_device m_bus; - required_device m_kb; - required_device m_ram; - required_device m_rs232; - required_device m_palette; - required_memory_region m_rom; - required_memory_region m_mmu_rom; - required_memory_region m_char_rom; - required_memory_region m_hsync_prom; - required_memory_region m_vsync_prom; - required_memory_region m_line_prom; - required_memory_region m_attr_prom; - optional_shared_ptr m_video_ram; - - enum - { - TIMER_ID_PIO, - TIMER_ID_CASSETTE, - TIMER_ID_BLINK, - TIMER_ID_VSYNC_ON, - TIMER_ID_VSYNC_OFF, - TIMER_ID_FAKE_KEYBOARD_CLEAR - }; - - enum - { - BOFA = 0xfe1c, - EOFA = 0xfe1e, - HEAD = 0xfe20 - }; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - virtual void machine_start(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE_LINE_MEMBER( vco_voltage_w ); - - DECLARE_READ8_MEMBER( pio_pa_r ); - DECLARE_READ8_MEMBER( pio_pb_r ); - DECLARE_WRITE8_MEMBER( pio_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( keydown_w ); - DECLARE_WRITE8_MEMBER( kbd_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( bac ); - - enum - { - MMU_XM = 0x01, - MMU_ROM = 0x02, - MMU_VRAMS = 0x04, - MMU_RAM = 0x08 - }; - - // keyboard state - int m_key_data; - int m_key_strobe; - int m_pio_astb; - - // video state - UINT8 m_latch; - int m_blink; - - // cassette state - bool m_motor; - int m_tape_in; - int m_tape_in_latch; - - // timers - emu_timer *m_pio_timer; - emu_timer *m_cassette_timer; - emu_timer *m_blink_timer; - emu_timer *m_vsync_on_timer; - emu_timer *m_vsync_off_timer; -}; - -//----------- defined in video/abc80.c ----------- - -MACHINE_CONFIG_EXTERN( abc80_video ); - -#endif diff --git a/src/mess/includes/abc80x.h b/src/mess/includes/abc80x.h deleted file mode 100644 index 86a54269778..00000000000 --- a/src/mess/includes/abc80x.h +++ /dev/null @@ -1,356 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __ABC800__ -#define __ABC800__ - -#include "bus/abcbus/abcbus.h" -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "cpu/mcs48/mcs48.h" -#include "imagedev/cassette.h" -#include "bus/abckb/abckb.h" -#include "bus/abckb/abc800kb.h" -#include "machine/e0516.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/ram.h" -#include "sound/discrete.h" -#include "video/mc6845.h" -#include "video/saa5050.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define ABC800_X01 XTAL_12MHz -#define ABC806_X02 XTAL_32_768kHz - -#define ABC802_AT0 0x01 -#define ABC802_AT1 0x02 -#define ABC802_ATD 0x40 -#define ABC802_ATE 0x80 -#define ABC802_INV 0x80 - -#define ABC800C_CHAR_RAM_SIZE 0x400 -#define ABC800M_CHAR_RAM_SIZE 0x800 -#define ABC800_VIDEO_RAM_SIZE 0x4000 -#define ABC802_CHAR_RAM_SIZE 0x800 -#define ABC806_CHAR_RAM_SIZE 0x800 -#define ABC806_ATTR_RAM_SIZE 0x800 -#define ABC806_VIDEO_RAM_SIZE 0x20000 - -#define ABC800_CHAR_WIDTH 6 -#define ABC800_CCLK ABC800_X01/ABC800_CHAR_WIDTH - -#define SCREEN_TAG "screen" -#define Z80_TAG "z80" -#define E0516_TAG "j13" -#define MC6845_TAG "b12" -#define SAA5052_TAG "5c" -#define Z80CTC_TAG "z80ctc" -#define Z80SIO_TAG "z80sio" -#define Z80DART_TAG "z80dart" -#define DISCRETE_TAG "discrete" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" -#define ABC_KEYBOARD_PORT_TAG "kb" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> abc800_state - -class abc800_state : public driver_device -{ -public: - abc800_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ctc(*this, Z80CTC_TAG), - m_dart(*this, Z80DART_TAG), - m_sio(*this, Z80SIO_TAG), - m_discrete(*this, "discrete"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_rom(*this, Z80_TAG), - m_video_ram(*this, "video_ram"), - m_char_ram(*this, "char_ram"), - m_io_sb(*this, "SB"), - m_ctc_z0(0), - m_sio_txcb(0), - m_sio_txdb(1), - m_sio_rtsb(1), - m_dfd_out(0), - m_tape_ctr(4) - { } - - required_device m_maincpu; - required_device m_ctc; - required_device m_dart; - required_device m_sio; - optional_device m_discrete; - optional_device m_cassette; - required_device m_ram; - required_memory_region m_rom; - optional_shared_ptr m_video_ram; - optional_shared_ptr m_char_ram; - required_ioport m_io_sb; - - enum - { - TIMER_ID_CTC, - TIMER_ID_CASSETTE - }; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - - void bankswitch(); - void clock_cassette(int state); - - DECLARE_READ8_MEMBER( pling_r ); - DECLARE_READ8_MEMBER( keyboard_col_r ); - DECLARE_WRITE8_MEMBER( keyboard_row_w ); - DECLARE_WRITE8_MEMBER( keyboard_ctrl_w ); - DECLARE_READ8_MEMBER( keyboard_t1_r ); - DECLARE_WRITE8_MEMBER( hrs_w ); - DECLARE_WRITE8_MEMBER( hrc_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); - DECLARE_WRITE_LINE_MEMBER( sio_txdb_w ); - DECLARE_WRITE_LINE_MEMBER( sio_dtrb_w ); - DECLARE_WRITE_LINE_MEMBER( sio_rtsb_w ); - - // memory state - int m_fetch_charram; // opcode fetched from character RAM region (0x7800-0x7fff) - - // sound state - int m_pling; - - // serial state - UINT8 m_sb; - int m_ctc_z0; - int m_sio_txcb; - int m_sio_txdb; - int m_sio_rtsb; - int m_dfd_out; - int m_dfd_in; - int m_tape_ctr; - - // video state - UINT8 m_hrs; // HR picture start scanline - UINT8 m_fgctl; // HR foreground control - - // timers - emu_timer *m_ctc_timer; - emu_timer *m_cassette_timer; -}; - - -// ======================> abc800m_state - -class abc800m_state : public abc800_state -{ -public: - abc800m_state(const machine_config &mconfig, device_type type, const char *tag) : - abc800_state(mconfig, type, tag), - m_crtc(*this, MC6845_TAG), - m_palette(*this, "palette"), - m_fgctl_prom(*this, "hru2"), - m_char_rom(*this, MC6845_TAG) - { } - - required_device m_crtc; - required_device m_palette; - required_memory_region m_fgctl_prom; - required_memory_region m_char_rom; - - DECLARE_DRIVER_INIT(driver_init); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); - MC6845_UPDATE_ROW( abc800m_update_row ); -}; - - -// ======================> abc800c_state - -class abc800c_state : public abc800_state -{ -public: - abc800c_state(const machine_config &mconfig, device_type type, const char *tag) : - abc800_state(mconfig, type, tag), - m_trom(*this, SAA5052_TAG), - m_palette(*this, "palette"), - m_fgctl_prom(*this, "hru2") - { } - - required_device m_trom; - required_device m_palette; - required_memory_region m_fgctl_prom; - - DECLARE_DRIVER_INIT(driver_init); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - offs_t translate_trom_offset(offs_t offset); - void hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( char_ram_r ); - DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); - DECLARE_PALETTE_INIT( abc800c ); -}; - - -// ======================> abc802_state - -class abc802_state : public abc800_state -{ -public: - abc802_state(const machine_config &mconfig, device_type type, const char *tag) : - abc800_state(mconfig, type, tag), - m_crtc(*this, MC6845_TAG), - m_palette(*this, "palette"), - m_char_rom(*this, MC6845_TAG), - m_config(*this, "CONFIG") - { } - - required_device m_crtc; - required_device m_palette; - required_memory_region m_char_rom; - required_ioport m_config; - - DECLARE_DRIVER_INIT(driver_init); - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void bankswitch(); - - DECLARE_READ8_MEMBER( pling_r ); - DECLARE_WRITE_LINE_MEMBER( lrs_w ); - DECLARE_WRITE_LINE_MEMBER( mux80_40_w ); - DECLARE_WRITE_LINE_MEMBER( vs_w ); - DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); - MC6845_UPDATE_ROW( abc802_update_row ); - - // cpu state - int m_lrs; // low RAM select - - // video state - int m_flshclk_ctr; // flash clock counter - int m_flshclk; // flash clock - int m_80_40_mux; // 40/80 column mode -}; - - -// ======================> abc806_state - -class abc806_state : public abc800_state -{ -public: - abc806_state(const machine_config &mconfig, device_type type, const char *tag) : - abc800_state(mconfig, type, tag), - m_crtc(*this, MC6845_TAG), - m_palette(*this, "palette"), - m_rtc(*this, E0516_TAG), - m_rad_prom(*this, "rad"), - m_hru2_prom(*this, "hru"), - m_char_rom(*this, MC6845_TAG), - m_attr_ram(*this, "attr_ram") - { } - - required_device m_crtc; - required_device m_palette; - required_device m_rtc; - required_memory_region m_rad_prom; - required_memory_region m_hru2_prom; - required_memory_region m_char_rom; - optional_shared_ptr m_attr_ram; - - DECLARE_DRIVER_INIT(driver_init); - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void bankswitch(); - void hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( mai_r ); - DECLARE_WRITE8_MEMBER( mao_w ); - DECLARE_WRITE8_MEMBER( hrs_w ); - DECLARE_WRITE8_MEMBER( hrc_w ); - DECLARE_READ8_MEMBER( charram_r ); - DECLARE_WRITE8_MEMBER( charram_w ); - DECLARE_READ8_MEMBER( ami_r ); - DECLARE_WRITE8_MEMBER( amo_w ); - DECLARE_READ8_MEMBER( cli_r ); - DECLARE_WRITE8_MEMBER( sso_w ); - DECLARE_READ8_MEMBER( sti_r ); - DECLARE_WRITE8_MEMBER( sto_w ); - DECLARE_WRITE_LINE_MEMBER( keydtr_w ); - DECLARE_WRITE_LINE_MEMBER( hs_w ); - DECLARE_WRITE_LINE_MEMBER( vs_w ); - DECLARE_DIRECT_UPDATE_MEMBER( direct_update_handler ); - DECLARE_PALETTE_INIT( abc806 ); - MC6845_UPDATE_ROW( abc806_update_row ); - - // memory state - int m_keydtr; // keyboard DTR - int m_eme; // extended memory enable - UINT8 m_map[16]; // memory page register - - // video state - int m_txoff; // text display enable - int m_40; // 40/80 column mode - int m_flshclk_ctr; // flash clock counter - int m_flshclk; // flash clock - UINT8 m_attr_data; // attribute data latch - UINT8 m_hrc[16]; // HR palette - UINT8 m_sync; // line synchronization delay - UINT8 m_v50_addr; // vertical sync PROM address - int m_hru2_a8; // HRU II PROM address line 8 - UINT32 m_vsync_shift; // vertical sync shift register - int m_vsync; // vertical sync - int m_d_vsync; // delayed vertical sync -}; - - - -//************************************************************************** -// MACHINE CONFIGURATION -//************************************************************************** - -/*----------- defined in video/abc800.c -----------*/ - -MACHINE_CONFIG_EXTERN(abc800m_video); -MACHINE_CONFIG_EXTERN(abc800c_video); - -/*----------- defined in video/abc802.c -----------*/ - -MACHINE_CONFIG_EXTERN(abc802_video); - -/*----------- defined in video/abc806.c -----------*/ - -MACHINE_CONFIG_EXTERN(abc806_video); - -#endif diff --git a/src/mess/includes/ac1.h b/src/mess/includes/ac1.h deleted file mode 100644 index b18cad87b24..00000000000 --- a/src/mess/includes/ac1.h +++ /dev/null @@ -1,48 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/ac1.h - * - ****************************************************************************/ - -#ifndef AC1_H_ -#define AC1_H_ - -#include "machine/z80pio.h" -#include "imagedev/cassette.h" - -class ac1_state : public driver_device -{ -public: - ac1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cassette(*this, "cassette"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_io_line(*this, "LINE") - { } - - DECLARE_DRIVER_INIT(ac1); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_ac1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_ac1_32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER(ac1_port_b_r); - DECLARE_READ8_MEMBER(ac1_port_a_r); - DECLARE_WRITE8_MEMBER(ac1_port_a_w); - DECLARE_WRITE8_MEMBER(ac1_port_b_w); - -private: - required_device m_cassette; - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - required_ioport_array<7> m_io_line; -}; - -/*----------- defined in video/ac1.c -----------*/ -extern const gfx_layout ac1_charlayout; - -#endif /* AC1_h_ */ diff --git a/src/mess/includes/adam.h b/src/mess/includes/adam.h deleted file mode 100644 index 1705011db88..00000000000 --- a/src/mess/includes/adam.h +++ /dev/null @@ -1,118 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef ADAM_H_ -#define ADAM_H_ - -#include "emu.h" -#include "bus/adam/exp.h" -#include "bus/adamnet/adamnet.h" -#include "bus/coleco/ctrl.h" -#include "bus/coleco/exp.h" -#include "cpu/z80/z80.h" -#include "cpu/m6800/m6800.h" -#include "machine/coleco.h" -#include "machine/ram.h" -#include "sound/sn76496.h" -#include "video/tms9928a.h" - -#define Z80_TAG "u1" -#define M6801_TAG "u6" -#define SN76489A_TAG "u20" -#define TMS9928A_TAG "tms9928a" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" - -class adam_state : public driver_device -{ -public: - adam_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_netcpu(*this, M6801_TAG), - m_vdc(*this, TMS9928A_TAG), - m_psg(*this, SN76489A_TAG), - m_ram(*this, RAM_TAG), - m_adamnet(*this, ADAMNET_TAG), - m_slot1(*this, ADAM_LEFT_EXPANSION_SLOT_TAG), - m_slot2(*this, ADAM_CENTER_EXPANSION_SLOT_TAG), - m_slot3(*this, ADAM_RIGHT_EXPANSION_SLOT_TAG), - m_cart(*this, COLECOVISION_CARTRIDGE_SLOT_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_boot_rom(*this, "boot"), - m_os7_rom(*this, "os7"), - m_mioc(0), - m_game(0), - m_an(0), - m_dma(1), - m_bwr(1), - m_spindis(1) - { } - - required_device m_maincpu; - required_device m_netcpu; - required_device m_vdc; - required_device m_psg; - required_device m_ram; - required_device m_adamnet; - required_device m_slot1; - required_device m_slot2; - required_device m_slot3; - required_device m_cart; - required_device m_joy1; - required_device m_joy2; - required_memory_region m_boot_rom; - required_memory_region m_os7_rom; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( mreq_r ); - DECLARE_WRITE8_MEMBER( mreq_w ); - DECLARE_READ8_MEMBER( iorq_r ); - DECLARE_WRITE8_MEMBER( iorq_w ); - - DECLARE_READ8_MEMBER( adamnet_r ); - DECLARE_WRITE8_MEMBER( adamnet_w ); - DECLARE_READ8_MEMBER( mioc_r ); - DECLARE_WRITE8_MEMBER( mioc_w ); - - DECLARE_WRITE8_MEMBER( m6801_p1_w ); - DECLARE_READ8_MEMBER( m6801_p2_r ); - DECLARE_WRITE8_MEMBER( m6801_p2_w ); - DECLARE_READ8_MEMBER( m6801_p3_r ); - DECLARE_WRITE8_MEMBER( m6801_p3_w ); - DECLARE_WRITE8_MEMBER( m6801_p4_w ); - - DECLARE_WRITE_LINE_MEMBER( vdc_int_w ); - - DECLARE_WRITE_LINE_MEMBER( os3_w ); - - DECLARE_WRITE_LINE_MEMBER( joy1_irq_w ); - DECLARE_WRITE_LINE_MEMBER( joy2_irq_w ); - - // memory state - UINT8 m_mioc; - int m_game; - - // ADAMnet state - UINT8 m_an; - - // DMA state - UINT16 m_ba; - int m_dma; - int m_bwr; - UINT8 m_data_in; - UINT8 m_data_out; - - // paddle state - int m_spindis; - - // video state - int m_vdp_nmi; -}; - -#endif diff --git a/src/mess/includes/advision.h b/src/mess/includes/advision.h deleted file mode 100644 index 3aa523c56df..00000000000 --- a/src/mess/includes/advision.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/***************************************************************************** - * - * includes/advision.h - * - ****************************************************************************/ - -#ifndef __ADVISION__ -#define __ADVISION__ - -#include "sound/dac.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define SCREEN_TAG "screen" -#define I8048_TAG "i8048" -#define COP411_TAG "cop411" - -class advision_state : public driver_device -{ -public: - advision_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8048_TAG), - m_soundcpu(*this, COP411_TAG), - m_dac(*this, "dac"), - m_cart(*this, "cartslot"), - m_bank1(*this, "bank1"), - m_joy(*this, "joystick"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_soundcpu; - required_device m_dac; - required_device m_cart; - required_memory_bank m_bank1; - required_ioport m_joy; - required_device m_palette; - - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void update_dac(); - void vh_write(int data); - void vh_update(int x); - - DECLARE_READ8_MEMBER( rom_r ); - DECLARE_READ8_MEMBER( ext_ram_r ); - DECLARE_WRITE8_MEMBER( ext_ram_w ); - DECLARE_READ8_MEMBER( controller_r ); - DECLARE_WRITE8_MEMBER( bankswitch_w ); - DECLARE_WRITE8_MEMBER( av_control_w ); - DECLARE_READ8_MEMBER( vsync_r ); - DECLARE_READ8_MEMBER( sound_cmd_r ); - DECLARE_WRITE8_MEMBER( sound_g_w ); - DECLARE_WRITE8_MEMBER( sound_d_w ); - - memory_region *m_cart_rom; - - int m_ea_bank; - - /* external RAM state */ - dynamic_buffer m_ext_ram; - int m_rambank; - - /* video state */ - int m_frame_count; - int m_frame_start; - int m_video_enable; - int m_video_bank; - int m_video_hpos; - UINT8 m_led_latch[8]; - dynamic_buffer m_display; - - /* sound state */ - int m_sound_cmd; - int m_sound_d; - int m_sound_g; - DECLARE_PALETTE_INIT(advision); -}; - -#endif diff --git a/src/mess/includes/aim65.h b/src/mess/includes/aim65.h deleted file mode 100644 index 724fe61cb4c..00000000000 --- a/src/mess/includes/aim65.h +++ /dev/null @@ -1,99 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner, Dan Boris, Dirk Best, Robbbert -/***************************************************************************** - * - * includes/aim65.h - * - * Rockwell AIM-65 - * - ****************************************************************************/ - -#ifndef AIM65_H_ -#define AIM65_H_ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "video/dl1416.h" -#include "machine/6522via.h" -#include "machine/mos6530n.h" -#include "machine/6821pia.h" -#include "machine/ram.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -/** R6502 Clock. - * - * The R6502 on AIM65 operates at 1 MHz. The frequency reference is a 4 MHz - * crystal controlled oscillator. Dual D-type flip-flop Z10 divides the 4 MHz - * signal by four to drive the R6502 phase 0 (O0) input with a 1 MHz clock. - */ -#define AIM65_CLOCK XTAL_4MHz/4 - - -class aim65_state : public driver_device -{ -public: - aim65_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette1(*this, "cassette"), - m_cassette2(*this, "cassette2"), - m_z24(*this, "z24"), - m_z25(*this, "z25"), - m_z26(*this, "z26"), - m_ram(*this, RAM_TAG), - m_ds1(*this, "ds1"), - m_ds2(*this, "ds2"), - m_ds3(*this, "ds3"), - m_ds4(*this, "ds4"), - m_ds5(*this, "ds5") - { } - - DECLARE_WRITE8_MEMBER(aim65_pia_a_w); - DECLARE_WRITE8_MEMBER(aim65_pia_b_w); - DECLARE_READ8_MEMBER(aim65_riot_b_r); - DECLARE_WRITE8_MEMBER(aim65_riot_a_w); - DECLARE_WRITE8_MEMBER(aim65_pa_w); - DECLARE_WRITE8_MEMBER(aim65_pb_w); - DECLARE_WRITE8_MEMBER(aim65_printer_on); - DECLARE_READ8_MEMBER(aim65_pb_r); - UINT8 m_pia_a; - UINT8 m_pia_b; - UINT8 m_riot_port_a; - UINT8 m_pb_save; - - required_device m_maincpu; - required_device m_cassette1; - required_device m_cassette2; - required_device m_z24; - required_device m_z25; - required_device m_z26; - required_device m_ram; - required_device m_ds1; - required_device m_ds2; - required_device m_ds3; - required_device m_ds4; - required_device m_ds5; - virtual void machine_start(); - TIMER_CALLBACK_MEMBER(aim65_printer_timer); - void aim65_pia(); - - DECLARE_WRITE16_MEMBER(aim65_update_ds1); - DECLARE_WRITE16_MEMBER(aim65_update_ds2); - DECLARE_WRITE16_MEMBER(aim65_update_ds3); - DECLARE_WRITE16_MEMBER(aim65_update_ds4); - DECLARE_WRITE16_MEMBER(aim65_update_ds5); - - void dl1416_update(dl1416_device *device, int index); - - int load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z24_load) { return load_cart(image, m_z24, "z24"); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z25_load) { return load_cart(image, m_z25, "z25"); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(z26_load) { return load_cart(image, m_z26, "z26"); } -}; - - -#endif /* AIM65_H_ */ diff --git a/src/mess/includes/alesis.h b/src/mess/includes/alesis.h deleted file mode 100644 index a0acc3db8f4..00000000000 --- a/src/mess/includes/alesis.h +++ /dev/null @@ -1,115 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Alesis HR-16 and SR-16 drum machines - -****************************************************************************/ - -#pragma once - -#ifndef _ALESIS_H_ -#define _ALESIS_H_ - -#include "cpu/mcs51/mcs51.h" -#include "machine/nvram.h" -#include "sound/dac.h" -#include "video/hd44780.h" -#include "imagedev/cassette.h" -#include "rendlay.h" - -#define MCFG_ALESIS_DM3AG_ADD(_tag,_clock) \ - MCFG_DEVICE_ADD( _tag, ALESIS_DM3AG, _clock ) - - -// ======================> alesis_dm3ag_device - -class alesis_dm3ag_device : public device_t -{ -public: - // construction/destruction - alesis_dm3ag_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; - - // device interface - DECLARE_WRITE8_MEMBER(write); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - static const device_timer_id TIMER_DAC_UPDATE = 1; - required_device m_dac; - required_region_ptr m_samples; - - emu_timer * m_dac_update_timer; - bool m_output_active; - int m_count; - int m_shift; - UINT32 m_cur_sample; - UINT8 m_cmd[5]; -}; - - -// ======================> alesis_state - -class alesis_state : public driver_device -{ -public: - alesis_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_lcdc(*this, "hd44780"), - m_cassette(*this, "cassette"), - m_maincpu(*this, "maincpu"), - m_col1(*this, "COL1"), - m_col2(*this, "COL2"), - m_col3(*this, "COL3"), - m_col4(*this, "COL4"), - m_col5(*this, "COL5"), - m_col6(*this, "COL6"), - m_select(*this, "SELECT") - { } - - required_device m_lcdc; - optional_device m_cassette; - - DECLARE_PALETTE_INIT(alesis); - virtual void machine_reset(); - - void update_lcd_symbols(bitmap_ind16 &bitmap, UINT8 pos, UINT8 y, UINT8 x, int state); - DECLARE_DRIVER_INIT(hr16); - DECLARE_WRITE8_MEMBER( led_w ); - DECLARE_WRITE8_MEMBER( mmt8_led_w ); - DECLARE_READ8_MEMBER( mmt8_led_r ); - DECLARE_WRITE8_MEMBER( track_led_w ); - DECLARE_WRITE8_MEMBER( kb_matrix_w ); - DECLARE_READ8_MEMBER( kb_r ); - DECLARE_READ8_MEMBER( p3_r ); - DECLARE_WRITE8_MEMBER( p3_w ); - DECLARE_READ8_MEMBER( mmt8_p3_r ); - DECLARE_WRITE8_MEMBER( mmt8_p3_w ); - DECLARE_WRITE8_MEMBER( sr16_lcd_w ); - -private: - UINT8 m_kb_matrix; - UINT8 m_leds; - UINT8 m_lcd_digits[5]; - required_device m_maincpu; - required_ioport m_col1; - required_ioport m_col2; - required_ioport m_col3; - required_ioport m_col4; - required_ioport m_col5; - required_ioport m_col6; - optional_ioport m_select; -}; - -// device type definition -extern const device_type ALESIS_DM3AG; - -#endif // _ALESIS_H_ diff --git a/src/mess/includes/amstrad.h b/src/mess/includes/amstrad.h deleted file mode 100644 index 40c798ccbdb..00000000000 --- a/src/mess/includes/amstrad.h +++ /dev/null @@ -1,325 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Barry Rodewald -/***************************************************************************** - * - * includes/amstrad.h - * - ****************************************************************************/ - -#ifndef AMSTRAD_H_ -#define AMSTRAD_H_ - -#include "cpu/z80/z80.h" -#include "sound/ay8910.h" -#include "machine/upd765.h" -#include "video/mc6845.h" -#include "machine/i8255.h" -#include "machine/mc146818.h" -#include "imagedev/snapquik.h" -#include "bus/cpc/cpcexp.h" -#include "bus/cpc/ddi1.h" -#include "bus/cpc/cpc_ssa1.h" -#include "bus/cpc/cpc_rom.h" -#include "bus/cpc/mface2.h" -#include "bus/cpc/cpc_pds.h" -#include "bus/cpc/cpc_rs232.h" -#include "bus/cpc/symbfac2.h" -#include "bus/cpc/amdrum.h" -#include "bus/cpc/playcity.h" -#include "bus/cpc/smartwatch.h" -#include "bus/cpc/brunword4.h" -#include "bus/cpc/hd20.h" -#include "bus/cpc/magicsound.h" -#include "machine/ram.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "bus/centronics/comxpl80.h" -#include "bus/centronics/epson_ex800.h" -#include "bus/centronics/epson_lx800.h" -#include "bus/centronics/epson_lx810l.h" -#include "bus/centronics/printer.h" -#include "bus/centronics/digiblst.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -/**************************** - * Gate Array data (CPC) - - ****************************/ -struct gate_array_t -{ - bitmap_ind16 *bitmap; /* The bitmap we work on */ - UINT8 pen_selected; /* Pen selection */ - UINT8 mrer; /* Mode and ROM Enable Register */ - UINT8 upper_bank; - UINT8 romdis; // ROMDIS signal from the expansion port - - /* input signals from CRTC */ - int vsync; - int hsync; - int de; - int ma; - int ra; - - /* used for timing */ - int hsync_after_vsync_counter; - int hsync_counter; /* The gate array counts CRTC HSYNC pulses using an internal 6-bit counter. */ - - /* used for drawing the screen */ - attotime last_draw_time; - int y; - UINT16 *draw_p; /* Position in the bitmap where we are currently drawing */ - UINT16 colour; - UINT16 address; - UINT8 *mode_lookup; - UINT8 data; - UINT8 ticks; - UINT8 ticks_increment; - UINT16 line_ticks; - UINT8 colour_ticks; - UINT8 max_colour_ticks; -}; - -/**************************** - * ASIC data (CPC plus) - ****************************/ -struct asic_t -{ - UINT8 *ram; /* pointer to RAM used for the CPC+ ASIC memory-mapped registers */ - UINT8 enabled; /* Are CPC plus features enabled/unlocked */ - UINT8 pri; /* Programmable raster interrupt */ - UINT8 seqptr; /* Current position in the ASIC unlocking sequence */ - UINT8 rmr2; /* ROM mapping register 2 */ - UINT16 split_ma_base; /* Used to handle split screen support */ - UINT16 split_ma_started; /* Used to handle split screen support */ - UINT16 vpos; /* Current logical scanline */ - UINT16 h_start; /* Position where DE became active */ - UINT16 h_end; /* Position where DE became inactive */ - UINT8 addr_6845; /* We need these to store a shadow copy of R1 of the mc6845 */ - UINT8 horiz_disp; - UINT8 hscroll; - UINT8 de_start; /* flag to check if DE is been enabled this frame yet */ - - /* DMA */ - UINT8 dma_status; - UINT8 dma_clear; /* Set if DMA interrupts are to be cleared automatically */ - UINT8 dma_prescaler[3]; /* DMA channel prescaler */ - UINT16 dma_repeat[3]; /* Location of the DMA channel's last repeat */ - UINT16 dma_addr[3]; /* DMA channel address */ - UINT16 dma_loopcount[3]; /* Count loops taken on this channel */ - UINT16 dma_pause[3]; /* DMA pause count */ -}; - - -class amstrad_state : public driver_device -{ -public: - enum - { - TIMER_PC2_LOW, - TIMER_VIDEO_UPDATE, - TIMER_SET_RESOLUTION - }; - - amstrad_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ay(*this, "ay"), - m_fdc(*this, "upd765"), - m_crtc(*this, "mc6845"), - m_ppi(*this, "ppi8255"), - m_centronics(*this, "centronics"), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_ram(*this, RAM_TAG), - m_exp(*this, "exp"), - m_rtc(*this, "rtc"), - m_region_maincpu(*this, "maincpu"), - m_region_user1(*this, "user1"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_bank5(*this, "bank5"), - m_bank6(*this, "bank6"), - m_bank7(*this, "bank7"), - m_bank8(*this, "bank8"), - m_bank9(*this, "bank9"), - m_bank10(*this, "bank10"), - m_bank11(*this, "bank11"), - m_bank12(*this, "bank12"), - m_bank13(*this, "bank13"), - m_bank14(*this, "bank14"), - m_bank15(*this, "bank15"), - m_bank16(*this, "bank16"), - m_io_kbrow(*this, "kbrow"), - m_io_analog(*this, "analog"), - m_io_mouse1(*this,"mouse_input1"), - m_io_mouse2(*this,"mouse_input2"), - m_io_mouse3(*this,"mouse_input3"), - m_io_solder_links(*this, "solder_links"), - m_io_green_display(*this, "green_display"), - m_io_ctrltype(*this,"controller_type"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } - - required_device m_maincpu; - required_device m_ay; - optional_device m_fdc; // not on a GX4000 - required_device m_crtc; - required_device m_ppi; - optional_device m_centronics; // not on a GX4000 - optional_device m_cassette; // not on a GX4000, (or technically, the 6128+) - optional_device m_cart; // only on 664+, 6128+ and GX4000 - required_device m_ram; - optional_device m_exp; // not on a GX4000 - optional_device m_rtc; // Aleste 520EX only - - int m_system_type; - UINT8 m_aleste_mode; - int m_plus_irq_cause; - gate_array_t m_gate_array; - asic_t m_asic; - int m_GateArray_RamConfiguration; - unsigned char *m_AmstradCPC_RamBanks[4]; - unsigned char *m_Aleste_RamBanks[4]; - int m_aleste_active_page[4]; - unsigned char *m_Amstrad_ROM_Table[256]; - UINT8 m_ppi_port_inputs[3]; - UINT8 m_ppi_port_outputs[3]; - int m_aleste_rtc_function; - int m_prev_reg; - UINT16 m_GateArray_render_colours[17]; - UINT8 m_mode0_lookup[256]; - UINT8 m_mode1_lookup[256]; - UINT8 m_mode2_lookup[256]; - int m_prev_data; - int m_printer_bit8_selected; - unsigned char m_Psg_FunctionSelected; - int m_previous_ppi_portc_w; - UINT8 m_amx_mouse_data; - DECLARE_WRITE8_MEMBER(amstrad_plus_asic_4000_w); - DECLARE_WRITE8_MEMBER(amstrad_plus_asic_6000_w); - DECLARE_READ8_MEMBER(amstrad_plus_asic_4000_r); - DECLARE_READ8_MEMBER(amstrad_plus_asic_6000_r); - DECLARE_WRITE8_MEMBER(aleste_msx_mapper); - DECLARE_READ8_MEMBER(amstrad_cpc_io_r); - DECLARE_WRITE8_MEMBER(amstrad_cpc_io_w); - DECLARE_READ8_MEMBER(amstrad_psg_porta_read); - void amstrad_plus_seqcheck(int data); - DECLARE_MACHINE_START(amstrad); - DECLARE_MACHINE_RESET(amstrad); - DECLARE_VIDEO_START(amstrad); - DECLARE_PALETTE_INIT(amstrad_cpc); - DECLARE_PALETTE_INIT(amstrad_cpc_green); - DECLARE_MACHINE_START(plus); - DECLARE_MACHINE_RESET(plus); - DECLARE_PALETTE_INIT(amstrad_plus); - DECLARE_MACHINE_START(gx4000); - DECLARE_MACHINE_RESET(gx4000); - DECLARE_MACHINE_START(kccomp); - DECLARE_MACHINE_RESET(kccomp); - DECLARE_PALETTE_INIT(kccomp); - DECLARE_MACHINE_START(aleste); - DECLARE_MACHINE_RESET(aleste); - DECLARE_PALETTE_INIT(aleste); - UINT32 screen_update_amstrad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void screen_eof_amstrad(screen_device &screen, bool state); - DECLARE_INPUT_CHANGED_MEMBER(cpc_monitor_changed); - TIMER_CALLBACK_MEMBER(amstrad_pc2_low); - TIMER_CALLBACK_MEMBER(amstrad_video_update_timer); - TIMER_CALLBACK_MEMBER(cb_set_resolution); - DECLARE_WRITE_LINE_MEMBER(amstrad_hsync_changed); - DECLARE_WRITE_LINE_MEMBER(amstrad_plus_hsync_changed); - DECLARE_WRITE_LINE_MEMBER(amstrad_vsync_changed); - DECLARE_WRITE_LINE_MEMBER(amstrad_plus_vsync_changed); - DECLARE_WRITE_LINE_MEMBER(amstrad_de_changed); - DECLARE_WRITE_LINE_MEMBER(amstrad_plus_de_changed); - DECLARE_READ8_MEMBER(amstrad_ppi_porta_r); - DECLARE_WRITE8_MEMBER(amstrad_ppi_porta_w); - DECLARE_READ8_MEMBER(amstrad_ppi_portb_r); - DECLARE_WRITE8_MEMBER(amstrad_ppi_portc_w); - - DECLARE_WRITE_LINE_MEMBER( cpc_romdis ); - DECLARE_WRITE_LINE_MEMBER( cpc_romen ); - DECLARE_WRITE8_MEMBER(rom_select); - - DECLARE_FLOPPY_FORMATS( aleste_floppy_formats ); - - IRQ_CALLBACK_MEMBER(amstrad_cpu_acknowledge_int); - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( amstrad_plus_cartridge ); - - void amstrad_handle_snapshot(unsigned char *pSnapshot); - void amstrad_rethinkMemory(); - DECLARE_SNAPSHOT_LOAD_MEMBER( amstrad ); - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - -protected: - required_memory_region m_region_maincpu; - optional_memory_region m_region_user1; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_memory_bank m_bank5; - required_memory_bank m_bank6; - required_memory_bank m_bank7; - required_memory_bank m_bank8; - required_memory_bank m_bank9; - required_memory_bank m_bank10; - required_memory_bank m_bank11; - required_memory_bank m_bank12; - required_memory_bank m_bank13; - required_memory_bank m_bank14; - required_memory_bank m_bank15; - required_memory_bank m_bank16; - optional_ioport_array<11> m_io_kbrow; - optional_ioport_array<4> m_io_analog; - optional_ioport m_io_mouse1; - optional_ioport m_io_mouse2; - optional_ioport m_io_mouse3; - required_ioport m_io_solder_links; - required_ioport m_io_green_display; - optional_ioport m_io_ctrltype; - required_device m_screen; - required_device m_palette; - - memory_region *m_region_cart; - - void amstrad_init_lookups(); - void amstrad_vh_update_mode(); - void amstrad_plus_dma_parse(int channel); - void amstrad_plus_handle_dma(); - void amstrad_vh_update_colour(int PenIndex, UINT16 hw_colour_index); - void aleste_vh_update_colour(int PenIndex, UINT16 hw_colour_index); - void amstrad_gate_array_get_video_data(); - void amstrad_update_video(); - void amstrad_plus_gate_array_get_video_data(); - void amstrad_plus_update_video(); - void amstrad_plus_update_video_sprites(); - void amstrad_setLowerRom(); - void amstrad_setUpperRom(); - void AmstradCPC_GA_SetRamConfiguration(); - void AmstradCPC_PALWrite(int data); - void amstrad_GateArray_write(UINT8 dataToGateArray); - void amstrad_reset_machine(); - void kccomp_reset_machine(); - void update_psg(); - void amstrad_common_init(); - void enumerate_roms(); - unsigned char kccomp_get_colour_element(int colour_value); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - int m_centronics_busy; -}; - - -/*----------- defined in machine/amstrad.c -----------*/ - - -SLOT_INTERFACE_EXTERN(cpc_exp_cards); -SLOT_INTERFACE_EXTERN(cpcplus_exp_cards); - -#endif /* AMSTRAD_H_ */ diff --git a/src/mess/includes/apollo.h b/src/mess/includes/apollo.h deleted file mode 100644 index 41b0f04e6ff..00000000000 --- a/src/mess/includes/apollo.h +++ /dev/null @@ -1,602 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Hans Ostermeyer, R. Belmont -/* - * apollo.h - APOLLO DN3500/DN3000 driver includes - * - * Created on: May 12, 2010 - * Author: Hans Ostermeyer - * - */ - -#pragma once - -#ifndef APOLLO_H_ -#define APOLLO_H_ - -#include "emu.h" - -#include "cpu/m68000/m68000.h" -#include "bus/rs232/rs232.h" -#include "machine/terminal.h" -#include "machine/ram.h" -#include "machine/6840ptm.h" -#include "machine/mc68681.h" -#include "machine/am9517a.h" -#include "machine/pic8259.h" -#include "machine/mc146818.h" -#include "machine/apollo_kbd.h" -#include "machine/clock.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "bus/isa/3c505.h" - -#ifndef VERBOSE -#define VERBOSE 0 -#endif - -#define LOG(x) { logerror x; logerror ("\n"); apollo_check_log(); } -#define LOG1(x) { if (VERBOSE > 0) LOG(x) } -#define LOG2(x) { if (VERBOSE > 1) LOG(x) } -#define CLOG(x) { logerror ("%s - %s: ", apollo_cpu_context(machine().device(MAINCPU)), tag()); LOG(x) } -#define CLOG1(x) { if (VERBOSE > 0) CLOG(x) } -#define CLOG2(x) { if (VERBOSE > 1) CLOG(x) } -#define DLOG(x) { logerror ("%s - %s: ", apollo_cpu_context(device->machine().device(MAINCPU)), device->tag()); LOG(x) } -#define DLOG1(x) { if (VERBOSE > 0) DLOG(x) } -#define DLOG2(x) { if (VERBOSE > 1) DLOG(x) } -#define MLOG(x) { logerror ("%s: ", apollo_cpu_context(machine().device(MAINCPU))); LOG(x) } -#define MLOG1(x) { if (VERBOSE > 0) MLOG(x) } -#define MLOG2(x) { if (VERBOSE > 1) MLOG(x) } -#define SLOG(x) { logerror ("%s: ", apollo_cpu_context(&space.device())); LOG(x) } -#define SLOG1(x) { if (VERBOSE > 0) SLOG(x) } -#define SLOG2(x) { if (VERBOSE > 1) SLOG(x) } - -#define MAINCPU "maincpu" - -/*----------- machine/apollo_dbg.c -----------*/ - -int apollo_debug_instruction_hook(m68000_base_device *device, offs_t curpc); - -/*----------- drivers/apollo.c -----------*/ - -// return the current CPU context for log file entries -const char *apollo_cpu_context(device_t *cpu); - -// enable/disable the FPU -void apollo_set_cpu_has_fpu(m68000_base_device *device, int onoff); - -// check for excessive logging -void apollo_check_log(); - -// return 1 if node is DN3000 or DSP3000, 0 otherwise -int apollo_is_dn3000(void); - -// return 1 if node is DSP3000 or DSP3500, 0 otherwise -int apollo_is_dsp3x00(void); - -// get the ram configuration byte -UINT8 apollo_get_ram_config_byte(void); - -//apollo_get_node_id - get the node id -UINT32 apollo_get_node_id(void); - - // should be called by the CPU core before executing each instruction -int apollo_instruction_hook(m68000_base_device *device, offs_t curpc); - -void apollo_set_cache_status_register(UINT8 mask, UINT8 data); - -/*----------- machine/apollo.c -----------*/ - -#define APOLLO_CONF_TAG "conf" -#define APOLLO_DMA1_TAG "dma8237_1" -#define APOLLO_DMA2_TAG "dma8237_2" -#define APOLLO_KBD_TAG "kbd" -#define APOLLO_STDIO_TAG "stdio" -#define APOLLO_PIC1_TAG "pic8259_master" -#define APOLLO_PIC2_TAG "pic8259_slave" -#define APOLLO_PTM_TAG "ptm" -#define APOLLO_RTC_TAG "rtc" -#define APOLLO_SIO_TAG "sio" -#define APOLLO_SIO2_TAG "sio2" -#define APOLLO_ETH_TAG "3c505" -#define APOLLO_ISA_TAG "isabus" - -// forward declaration -class apollo_sio; - -class apollo_state : public driver_device -{ -public: - apollo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MAINCPU), - m_messram_ptr(*this, "messram"), - m_dma8237_1(*this, APOLLO_DMA1_TAG), - m_dma8237_2(*this, APOLLO_DMA2_TAG), - m_pic8259_master(*this, APOLLO_PIC1_TAG), - m_pic8259_slave(*this, APOLLO_PIC2_TAG), - m_ptm(*this, APOLLO_PTM_TAG), - m_sio(*this, APOLLO_SIO_TAG), - m_sio2(*this, APOLLO_SIO2_TAG), - m_rtc(*this, APOLLO_RTC_TAG), - m_isa(*this, APOLLO_ISA_TAG) - { } - - required_device m_maincpu; - required_shared_ptr m_messram_ptr; - - required_device m_dma8237_1; - required_device m_dma8237_2; - required_device m_pic8259_master; - required_device m_pic8259_slave; - required_device m_ptm; - required_device m_sio; - optional_device m_sio2; - required_device m_rtc; - required_device m_isa; - - DECLARE_WRITE16_MEMBER(apollo_csr_status_register_w); - DECLARE_READ16_MEMBER(apollo_csr_status_register_r); - DECLARE_WRITE16_MEMBER(apollo_csr_control_register_w); - DECLARE_READ16_MEMBER(apollo_csr_control_register_r); - DECLARE_WRITE8_MEMBER(apollo_dma_1_w); - DECLARE_READ8_MEMBER(apollo_dma_1_r); - DECLARE_WRITE8_MEMBER(apollo_dma_2_w); - DECLARE_READ8_MEMBER(apollo_dma_2_r); - DECLARE_WRITE8_MEMBER(apollo_dma_page_register_w); - DECLARE_READ8_MEMBER(apollo_dma_page_register_r); - DECLARE_WRITE16_MEMBER(apollo_address_translation_map_w); - DECLARE_READ16_MEMBER(apollo_address_translation_map_r); - DECLARE_READ8_MEMBER(apollo_dma_read_byte); - DECLARE_WRITE8_MEMBER(apollo_dma_write_byte); - DECLARE_READ8_MEMBER(apollo_dma_read_word); - DECLARE_WRITE8_MEMBER(apollo_dma_write_word); - DECLARE_WRITE8_MEMBER(apollo_rtc_w); - DECLARE_READ8_MEMBER(apollo_rtc_r); - DECLARE_WRITE8_MEMBER(cache_control_register_w); - DECLARE_READ8_MEMBER(cache_status_register_r); - DECLARE_WRITE8_MEMBER(task_alias_register_w); - DECLARE_READ8_MEMBER(task_alias_register_r); - DECLARE_WRITE16_MEMBER(apollo_node_id_w); - DECLARE_READ16_MEMBER(apollo_node_id_r); - DECLARE_WRITE16_MEMBER(latch_page_on_parity_error_register_w); - DECLARE_READ16_MEMBER(latch_page_on_parity_error_register_r); - DECLARE_WRITE8_MEMBER(master_req_register_w); - DECLARE_READ8_MEMBER(master_req_register_r); - DECLARE_WRITE16_MEMBER(selective_clear_locations_w); - DECLARE_READ16_MEMBER(selective_clear_locations_r); - DECLARE_READ32_MEMBER(ram_with_parity_r); - DECLARE_WRITE32_MEMBER(ram_with_parity_w); - DECLARE_READ32_MEMBER(apollo_unmapped_r); - DECLARE_WRITE32_MEMBER(apollo_unmapped_w); - DECLARE_WRITE32_MEMBER(apollo_rom_w); - DECLARE_READ16_MEMBER(apollo_atbus_io_r); - DECLARE_WRITE16_MEMBER(apollo_atbus_io_w); - DECLARE_READ16_MEMBER(apollo_atbus_memory_r); - DECLARE_WRITE16_MEMBER(apollo_atbus_memory_w); - DECLARE_WRITE8_MEMBER(dn5500_memory_present_register_w); - DECLARE_READ8_MEMBER(dn5500_memory_present_register_r); - DECLARE_WRITE8_MEMBER(dn5500_11500_w); - DECLARE_READ8_MEMBER(dn5500_11500_r); - DECLARE_WRITE8_MEMBER(dn5500_io_protection_map_w); - DECLARE_READ8_MEMBER(dn5500_io_protection_map_r); - DECLARE_READ32_MEMBER(apollo_f8_r); - DECLARE_WRITE32_MEMBER(apollo_f8_w); - DECLARE_DRIVER_INIT(dsp3000); - DECLARE_DRIVER_INIT(dsp5500); - DECLARE_DRIVER_INIT(dn3500); - DECLARE_DRIVER_INIT(dn3000); - DECLARE_DRIVER_INIT(dsp3500); - DECLARE_DRIVER_INIT(dn5500); - DECLARE_DRIVER_INIT(apollo); - - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_MACHINE_RESET(apollo); - DECLARE_MACHINE_START(apollo); - - IRQ_CALLBACK_MEMBER(apollo_irq_acknowledge); - IRQ_CALLBACK_MEMBER(apollo_pic_acknowledge); - void apollo_bus_error(); - DECLARE_WRITE8_MEMBER( apollo_kbd_putchar ); - DECLARE_READ_LINE_MEMBER( apollo_kbd_is_german ); - DECLARE_WRITE_LINE_MEMBER( apollo_dma8237_out_eop ); - DECLARE_WRITE_LINE_MEMBER( apollo_dma_1_hrq_changed ); - DECLARE_WRITE_LINE_MEMBER( apollo_dma_2_hrq_changed ); - DECLARE_WRITE_LINE_MEMBER( apollo_pic8259_master_set_int_line ); - DECLARE_WRITE_LINE_MEMBER( apollo_pic8259_slave_set_int_line ); - DECLARE_WRITE_LINE_MEMBER( sio_irq_handler ); - DECLARE_WRITE8_MEMBER( sio_output ); - DECLARE_WRITE_LINE_MEMBER( sio2_irq_handler ); - DECLARE_WRITE_LINE_MEMBER( apollo_ptm_irq_function ); - DECLARE_WRITE_LINE_MEMBER( apollo_ptm_timer_tick ); - DECLARE_READ8_MEMBER( apollo_pic8259_get_slave_ack ); - - DECLARE_READ8_MEMBER(pc_dma8237_0_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_1_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_2_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_3_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_5_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_6_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_7_dack_r); - DECLARE_WRITE8_MEMBER(pc_dma8237_0_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_1_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_2_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_3_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_5_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_6_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_7_dack_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack0_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack1_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack2_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack3_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack4_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack5_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack6_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack7_w); - TIMER_CALLBACK_MEMBER( apollo_rtc_timer ); - - void apollo_pic_set_irq_line(int irq, int state); - void select_dma_channel(int channel, bool state); - - DECLARE_WRITE_LINE_MEMBER(apollo_reset_instr_callback); - DECLARE_READ32_MEMBER(apollo_instruction_hook); - -private: - UINT32 ptm_counter; - UINT8 sio_output_data; - int m_dma_channel; - bool m_cur_eop; - emu_timer *m_dn3000_timer; -}; - -MACHINE_CONFIG_EXTERN( apollo ); -MACHINE_CONFIG_EXTERN( apollo_terminal ); - -/*----------- machine/apollo_config.c -----------*/ - -// configuration bit definitions - -#define APOLLO_CONF_SERVICE_MODE 0x0001 -#define APOLLO_CONF_DISPLAY 0x001e -#define APOLLO_CONF_8_PLANES 0x0002 -#define APOLLO_CONF_4_PLANES 0x0004 -#define APOLLO_CONF_MONO_15I 0x0008 -#define APOLLO_CONF_MONO_19I 0x0010 -#define APOLLO_CONF_GERMAN_KBD 0x0020 -#define APOLLO_CONF_20_YEARS_AGO 0x0040 -#define APOLLO_CONF_25_YEARS_AGO 0x0080 -#define APOLLO_CONF_NODE_ID 0x0100 -#define APOLLO_CONF_IDLE_SLEEP 0x0200 -#define APOLLO_CONF_TRAP_TRACE 0x0400 -#define APOLLO_CONF_FPU_TRACE 0x0800 -#define APOLLO_CONF_DISK_TRACE 0x1000 -#define APOLLO_CONF_NET_TRACE 0x2000 - -// check configuration setting -int apollo_config(int mask); - -INPUT_PORTS_EXTERN(apollo_config); - -/*----------- machine/apollo_csr.c -----------*/ - -#define APOLLO_CSR_SR_SERVICE 0x0001 -#define APOLLO_CSR_SR_ATBUS_IO_TIMEOUT 0x0002 -#define APOLLO_CSR_SR_FP_TRAP 0x0004 -#define APOLLO_CSR_SR_INTERRUPT_PENDING 0x0008 // DN3000 only -#define APOLLO_CSR_SR_PARITY_BYTE_MASK 0x00f0 -#define APOLLO_CSR_SR_CPU_TIMEOUT 0x0100 -#define APOLLO_CSR_SR_ATBUS_MEM_TIMEOUT 0x2000 -#define APOLLO_CSR_SR_BIT15 0x8000 -#define APOLLO_CSR_SR_CLEAR_ALL 0x3ffe - -#define APOLLO_CSR_CR_INTERRUPT_ENABLE 0x0001 -#define APOLLO_CSR_CR_RESET_DEVICES 0x0002 -#define APOLLO_CSR_CR_FPU_TRAP_ENABLE 0x0004 -#define APOLLO_CSR_CR_FORCE_BAD_PARITY 0x0008 -#define APOLLO_CSR_CR_PARITY_BYTE_MASK 0x00f0 - -UINT16 apollo_csr_get_control_register(void); -UINT16 apollo_csr_get_status_register(void); -void apollo_csr_set_status_register(UINT16 mask, UINT16 data); - -/*----------- machine/apollo_sio.c -----------*/ - -#define MCFG_APOLLO_SIO_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, APOLLO_SIO, _clock) - -#define MCFG_APOLLO_SIO_IRQ_CALLBACK(_cb) \ - devcb = &apollo_sio::set_irq_cb(*device, DEVCB_##_cb); - -#define MCFG_APOLLO_SIO_A_TX_CALLBACK(_cb) \ - devcb = &apollo_sio::set_a_tx_cb(*device, DEVCB_##_cb); - -#define MCFG_APOLLO_SIO_B_TX_CALLBACK(_cb) \ - devcb = &apollo_sio::set_b_tx_cb(*device, DEVCB_##_cb); - -#define MCFG_APOLLO_SIO_OUTPORT_CALLBACK(_cb) \ - devcb = &apollo_sio::set_outport_cb(*device, DEVCB_##_cb); - -class apollo_sio: public mc68681_device -{ -public: - apollo_sio(const machine_config &mconfig, const char *tag, - device_t *owner, UINT32 clock); - - DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); - -protected: - virtual void device_reset(); - -private: - UINT8 m_csrb; - UINT8 m_ip6; -}; - -extern const device_type APOLLO_SIO; - -/*----------- video/apollo.c -----------*/ - -#define APOLLO_SCREEN_TAG "apollo_screen" - -class apollo_graphics_15i : public device_t -{ -public: - apollo_graphics_15i(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - apollo_graphics_15i(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, device_type type, const char *name, const char *shortname, const char *source); - ~apollo_graphics_15i(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - // monochrome control - DECLARE_READ8_MEMBER( apollo_mcr_r ); - DECLARE_WRITE8_MEMBER( apollo_mcr_w ); - - // monochrome and color memory - DECLARE_READ16_MEMBER( apollo_mem_r ); - DECLARE_WRITE16_MEMBER( apollo_mem_w ); - - // color control - DECLARE_READ8_MEMBER( apollo_ccr_r ); - DECLARE_WRITE8_MEMBER( apollo_ccr_w ); - - DECLARE_READ16_MEMBER( apollo_mgm_r ); - DECLARE_WRITE16_MEMBER( apollo_mgm_w ); - - DECLARE_READ16_MEMBER( apollo_cgm_r ); - DECLARE_WRITE16_MEMBER( apollo_cgm_w ); - - void vblank_state_changed(screen_device &screen, bool vblank_state); - - int is_mono() { return m_n_planes == 1; } - -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - virtual void device_reset(); -protected: - class lut_fifo; - class bt458; - - const char *cr_text(offs_t offset, UINT8 data, UINT8 rw); - - void increment_h_clock(); - void increment_v_clock(); - void increment_p_clock(); - - void log_cr1(const char * text); - void set_cr1(UINT8 data); - void set_cr3a(UINT8 data); - void set_cr3b(UINT8 data); - void set_lut_cr(UINT8 data); - - void register_vblank_callback(); - - UINT32 set_msb0(UINT32 value, UINT8 data) - { - return (value & 0xffffff00) | data; - } - UINT32 set_lsb0(UINT32 value, UINT8 data) - { - return (value & 0xffff00ff) | (data << 8); - } - UINT32 set_msb1(UINT32 value, UINT8 data) - { - return (value & 0xff00ffff) | (data << 16); - } - UINT32 set_lsb1(UINT32 value, UINT8 data) - { - return (value & 0x00ffffff) | (data << 24); - } - UINT8 get_msb1(UINT32 value) - { - return (value >> 16) & 0xff; - } - UINT8 get_lsb1(UINT32 value) - { - return (value >> 24) & 0xff; - } - - void set_status_rmw(); - UINT16 rop(UINT16 dest_data, UINT16 src_data, UINT8 plane); - void set_source_data(UINT32 offset); - UINT32 get_source_data(UINT8 plane); - void blt(UINT32 dest_addr, UINT16 mem_mask); - - UINT8 get_pixel(UINT32 offset, UINT16 mask); - UINT8 c4p_read_adc(UINT8 data); - UINT8 c8p_read_adc(UINT8 data); - - void screen_update1(bitmap_rgb32 &bitmap, const rectangle &cliprect); -protected: - UINT16 m_n_planes; - UINT16 m_width; - UINT16 m_height; - UINT16 m_buffer_width; - UINT16 m_buffer_height; - - UINT8 m_sr; - UINT8 m_device_id; - UINT16 m_write_enable_register; - UINT32 m_rop_register; - UINT16 m_diag_mem_request; - UINT8 m_cr0; - UINT8 m_cr1; - UINT8 m_cr2; - UINT8 m_cr2b; - UINT8 m_cr2_s_data; - UINT8 m_cr2_s_plane; - UINT8 m_cr2_d_plane; - UINT8 m_cr3a; - UINT8 m_cr3b; - UINT8 m_ad_result; - UINT8 m_ad_pending; - - UINT8 m_lut_control; - UINT8 m_lut_data; - - UINT8 m_update_flag; - UINT8 m_update_pending; - - UINT8 m_blt_cycle_count; - UINT32 m_image_offset; - UINT32 m_guard_latch[8]; - - int m_h_clock; - int m_v_clock; - int m_p_clock; - int m_data_clock; - - UINT16 *m_image_memory; - int m_image_plane_size; - int m_image_memory_size; - - UINT32 m_color_lookup_table[16]; - - lut_fifo *m_lut_fifo; - bt458 *m_bt458; -}; - - -#define LUT_FIFO_SIZE 1024 - - -//************************************************************************** -// class LUT Fifo -//************************************************************************** - -class apollo_graphics_15i::lut_fifo -{ -public: - lut_fifo() - { - reset(); - } - - void reset() - { - m_size = LUT_FIFO_SIZE; - m_get_index = 0; - m_put_index = 0; - } - - void put(const UINT8 data) - { - if (!is_full()) - { - m_data[m_put_index] = data; - m_put_index = (m_put_index + 1) % m_size; - } - } - - UINT8 get() - { - UINT8 data = is_empty() ? 0xff : m_data[m_get_index]; - m_get_index = (m_get_index + 1) % m_size; - return data; - } - - int is_empty() - { - return m_get_index == m_put_index; - } - - int is_full() - { - return ((m_put_index + 1) % m_size) == m_get_index; - } - -private: - UINT16 m_size; - UINT16 m_get_index; - UINT16 m_put_index; - UINT8 m_data[LUT_FIFO_SIZE]; -}; - -//************************************************************************** -// class Brooktree Bt458 -//************************************************************************** - -class apollo_graphics_15i::bt458 -{ -public: - bt458(running_machine &running_machine); - void start(); - void reset(); - UINT8 read(UINT8 c10); - void write(UINT8 data, UINT8 c10); - UINT32 get_rgb(UINT8 index); - -private: - running_machine &machine() const - { - assert(m_machine != NULL); - return *m_machine; - } - - UINT8 m_color_counter; - UINT8 m_red; - UINT8 m_green; - - UINT8 m_address_register; - UINT32 m_color_palette_RAM[256]; - UINT32 m_overlay_color[4]; - UINT8 m_read_mask_register; - UINT8 m_blink_mask_register; - UINT8 m_command_register; - UINT8 m_control_test_register; - - running_machine *m_machine; -}; - -extern const device_type APOLLO_GRAPHICS; - -#define MCFG_APOLLO_GRAPHICS_ADD( _tag) \ - MCFG_FRAGMENT_ADD(apollo_graphics) \ - MCFG_DEVICE_ADD(_tag, APOLLO_GRAPHICS, 0) - -MACHINE_CONFIG_EXTERN( apollo_graphics ); - -class apollo_graphics_19i : public apollo_graphics_15i -{ -public: - apollo_graphics_19i(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - virtual void device_reset(); -private: - // internal state -}; - -extern const device_type APOLLO_MONO19I; - -#define MCFG_APOLLO_MONO19I_ADD(_tag) \ - MCFG_FRAGMENT_ADD(apollo_mono19i) \ - MCFG_DEVICE_ADD(_tag, APOLLO_MONO19I, 0) - -MACHINE_CONFIG_EXTERN( apollo_mono19i ); - -#endif /* APOLLO_H_ */ diff --git a/src/mess/includes/apple1.h b/src/mess/includes/apple1.h deleted file mode 100644 index 220200ade56..00000000000 --- a/src/mess/includes/apple1.h +++ /dev/null @@ -1,92 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels, Colin Howell, R. Belmont -/***************************************************************************** - * - * includes/apple1.h - * - ****************************************************************************/ - -#ifndef APPLE1_H_ -#define APPLE1_H_ - -#include "imagedev/snapquik.h" -#include "machine/ram.h" - -typedef short termchar_t; - -struct terminal_t -{ - tilemap_t *tm; - int gfx; - int blank_char; - int char_bits; - int num_cols; - int num_rows; - int (*getcursorcode)(int original_code); - int cur_offset; - int cur_hidden; - termchar_t mem[1]; -}; - - -class apple1_state : public driver_device -{ -public: - apple1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen") { } - - int m_vh_clrscrn_pressed; - int m_kbd_data; - UINT32 m_kbd_last_scan[4]; - int m_reset_flag; - terminal_t *m_current_terminal; - terminal_t *m_terminal; - int m_blink_on; - DECLARE_DRIVER_INIT(apple1); - TILE_GET_INFO_MEMBER(terminal_gettileinfo); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(apple1_kbd_poll); - TIMER_CALLBACK_MEMBER(apple1_kbd_strobe_end); - TIMER_CALLBACK_MEMBER(apple1_dsp_ready_start); - TIMER_CALLBACK_MEMBER(apple1_dsp_ready_end); - DECLARE_READ8_MEMBER(apple1_pia0_kbdin); - DECLARE_WRITE8_MEMBER(apple1_pia0_dspout); - DECLARE_WRITE_LINE_MEMBER(apple1_pia0_dsp_write_signal); - required_device m_maincpu; - void terminal_draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal); - void verify_coords(terminal_t *terminal, int x, int y); - void terminal_putchar(terminal_t *terminal, int x, int y, int ch); - int terminal_getchar(terminal_t *terminal, int x, int y); - void terminal_putblank(terminal_t *terminal, int x, int y); - void terminal_dirtycursor(terminal_t *terminal); - void terminal_setcursor(terminal_t *terminal, int x, int y); - void terminal_hidecursor(terminal_t *terminal); - void terminal_showcursor(terminal_t *terminal); - void terminal_getcursor(terminal_t *terminal, int *x, int *y); - void terminal_fill(terminal_t *terminal, int val); - void terminal_clear(terminal_t *terminal); - void apple1_vh_dsp_w (int data); - void apple1_vh_dsp_clr (); - void apple1_vh_cursor_blink (); - int apple1_verify_header (UINT8 *data); - terminal_t *terminal_create(int gfx, int blank_char, int char_bits,int (*getcursorcode)(int original_code),int num_cols, int num_rows); - attotime apple1_vh_dsp_time_to_ready(); - DECLARE_SNAPSHOT_LOAD_MEMBER( apple1 ); - required_device m_ram; - required_device m_gfxdecode; - required_device m_screen; -}; - - -/*----------- defined in drivers/apple1.c -----------*/ - -extern const gfx_layout apple1_charlayout; - - -#endif /* APPLE1_H_ */ diff --git a/src/mess/includes/apple2.h b/src/mess/includes/apple2.h deleted file mode 100644 index ec8b9963db5..00000000000 --- a/src/mess/includes/apple2.h +++ /dev/null @@ -1,382 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - includes/apple2.h - - Include file to handle emulation of the Apple II series. - -***************************************************************************/ - -#ifndef APPLE2_H_ -#define APPLE2_H_ - -#include "cpu/m6502/m6502.h" -#include "cpu/m6502/m65c02.h" -#include "bus/a2bus/a2bus.h" -#include "bus/a2bus/a2eauxslot.h" -#include "machine/applefdc.h" -#include "machine/ram.h" -#include "imagedev/cassette.h" -#include "machine/kb3600.h" -#include "sound/speaker.h" -#include "machine/ram.h" -#include "bus/rs232/rs232.h" -#include "machine/mos6551.h" - -#define AUXSLOT_TAG "auxbus" - -#define IIC_ACIA1_TAG "acia1" -#define IIC_ACIA2_TAG "acia2" -#define IICP_IWM_TAG "iwm" - -#define LASER128_UDC_TAG "l128udc" - -#define PRINTER_PORT_TAG "printer" -#define MODEM_PORT_TAG "modem" - -/*************************************************************************** - SOFTSWITCH VALUES -***************************************************************************/ - -#define VAR_80STORE 0x000001 -#define VAR_RAMRD 0x000002 -#define VAR_RAMWRT 0x000004 -#define VAR_INTCXROM 0x000008 -#define VAR_ALTZP 0x000010 -#define VAR_SLOTC3ROM 0x000020 -#define VAR_80COL 0x000040 -#define VAR_ALTCHARSET 0x000080 -#define VAR_TEXT 0x000100 -#define VAR_MIXED 0x000200 -#define VAR_PAGE2 0x000400 -#define VAR_HIRES 0x000800 -#define VAR_AN0 0x001000 -#define VAR_AN1 0x002000 -#define VAR_AN2 0x004000 -#define VAR_AN3 0x008000 -#define VAR_LCRAM 0x010000 -#define VAR_LCRAM2 0x020000 -#define VAR_LCWRITE 0x040000 -#define VAR_ROMSWITCH 0x080000 -#define VAR_TK2000RAM 0x100000 // ROM/RAM switch for TK2000 - -#define VAR_DHIRES VAR_AN3 - -/*************************************************************************** - OTHER -***************************************************************************/ - -/* ----------------------------------------------------------------------- - * New Apple II memory manager - * ----------------------------------------------------------------------- */ - -#define APPLE2_MEM_AUX 0x40000000 -#define APPLE2_MEM_SLOT 0x80000000 -#define APPLE2_MEM_ROM 0xC0000000 -#define APPLE2_MEM_FLOATING 0xFFFFFFFF -#define APPLE2_MEM_MASK 0x00FFFFFF - -enum machine_type_t -{ - APPLE_II, // Apple II/II+ - APPLE_IIE, // Apple IIe with aux slots - APPLE_IIGS, // Apple IIgs - APPLE_IIC, // Apple IIc - APPLE_IICPLUS, // Apple IIc+ - TK2000, // Microdigital TK2000 - TK3000, // Microdigital TK3000 - LASER128, // Laser 128/128EX/128EX2 - SPACE84, // "Space 84" with flipped text mode - LABA2P // lab equipment (?) II Plus with flipped text mode -}; - -enum bank_disposition_t -{ - A2MEM_IO = 0, /* this is always handlers; never banked memory */ - A2MEM_MONO = 1, /* this is a bank where read and write are always in unison */ - A2MEM_DUAL = 2 /* this is a bank where read and write can go different places */ -}; - -struct apple2_meminfo -{ - UINT32 read_mem; - read8_delegate *read_handler; - UINT32 write_mem; - write8_delegate *write_handler; -}; - -struct apple2_memmap_entry -{ - offs_t begin; - offs_t end; - void (*get_meminfo)(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo); - bank_disposition_t bank_disposition; -}; - -struct apple2_memmap_config -{ - int first_bank; - UINT8 *auxmem; - UINT32 auxmem_length; - const apple2_memmap_entry *memmap; -}; - -class apple2_state : public driver_device -{ -public: - apple2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_ay3600(*this, "ay3600"), - m_a2bus(*this, "a2bus"), - m_a2eauxslot(*this, AUXSLOT_TAG), - m_joy1x(*this, "joystick_1_x"), - m_joy1y(*this, "joystick_1_y"), - m_joy2x(*this, "joystick_2_x"), - m_joy2y(*this, "joystick_2_y"), - m_joybuttons(*this, "joystick_buttons"), - m_kbdrom(*this, "keyboard"), - m_kbspecial(*this, "keyb_special"), - m_kbrepeat(*this, "keyb_repeat"), - m_resetdip(*this, "reset_dip"), - m_sysconfig(*this, "a2_config"), - m_cassette(*this, "cassette"), - m_acia1(*this, IIC_ACIA1_TAG), - m_acia2(*this, IIC_ACIA2_TAG), - m_laserudc(*this, LASER128_UDC_TAG), - m_iicpiwm(*this, IICP_IWM_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_ay3600; - required_device m_a2bus; - optional_device m_a2eauxslot; - - optional_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons; - optional_memory_region m_kbdrom; - required_ioport m_kbspecial; - optional_ioport m_kbrepeat; - optional_ioport m_resetdip; - optional_ioport m_sysconfig; - optional_device m_cassette; - - optional_device m_acia1, m_acia2; - optional_device m_laserudc; - optional_device m_iicpiwm; - - UINT32 m_flags, m_flags_mask; - INT32 m_a2_cnxx_slot; - UINT32 m_a2_mask; - UINT32 m_a2_set; - int m_a2_speaker_state; - double m_joystick_x1_time; - double m_joystick_y1_time; - double m_joystick_x2_time; - double m_joystick_y2_time; - apple2_memmap_config m_mem_config; - apple2_meminfo *m_current_meminfo; - int m_fdc_diskreg; - const UINT8 *m_a2_videoram, *m_a2_videoaux, *m_textgfx_data; - UINT32 m_a2_videomask, m_textgfx_datalen; - UINT32 m_old_a2; - int m_fgcolor; - int m_bgcolor; - int m_flash; - int m_alt_charset_value; - UINT16 *m_hires_artifact_map; - UINT16 *m_dhires_artifact_map; - bool m_monochrome_dhr; - int m_inh_slot; - int m_reset_flag; - - UINT8 *m_rambase; - - UINT8 *m_rom, *m_slot_ram; - UINT32 m_rom_length, m_slot_length; - - machine_type_t m_machinetype; - - device_a2eauxslot_card_interface *m_auxslotdevice; - - UINT16 m_lastchar, m_strobe; - UINT8 m_transchar; - - READ8_MEMBER(apple2_c0xx_r); - WRITE8_MEMBER(apple2_c0xx_w); - READ8_MEMBER(apple2_c080_r); - WRITE8_MEMBER(apple2_c080_w); - - READ8_MEMBER ( apple2_c00x_r ); - READ8_MEMBER ( apple2_c01x_r ); - READ8_MEMBER ( apple2_c02x_r ); - READ8_MEMBER ( apple2_c03x_r ); - READ8_MEMBER ( apple2_c05x_r ); - READ8_MEMBER ( apple2_c06x_r ); - READ8_MEMBER ( apple2_c07x_r ); - WRITE8_MEMBER ( apple2_c00x_w ); - WRITE8_MEMBER ( apple2_c01x_w ); - WRITE8_MEMBER ( apple2_c02x_w ); - WRITE8_MEMBER ( apple2_c03x_w ); - WRITE8_MEMBER ( apple2_c05x_w ); - WRITE8_MEMBER ( apple2_c07x_w ); - - READ8_MEMBER ( apple2_mainram0000_r ); - READ8_MEMBER ( apple2_mainram0200_r ); - READ8_MEMBER ( apple2_mainram0400_r ); - READ8_MEMBER ( apple2_mainram0800_r ); - READ8_MEMBER ( apple2_mainram2000_r ); - READ8_MEMBER ( apple2_mainram4000_r ); - READ8_MEMBER ( apple2_mainramc000_r ); - READ8_MEMBER ( apple2_mainramd000_r ); - READ8_MEMBER ( apple2_mainrame000_r ); - READ8_MEMBER ( apple2_auxram0000_r ); - READ8_MEMBER ( apple2_auxram0200_r ); - READ8_MEMBER ( apple2_auxram0400_r ); - READ8_MEMBER ( apple2_auxram0800_r ); - READ8_MEMBER ( apple2_auxram2000_r ); - READ8_MEMBER ( apple2_auxram4000_r ); - READ8_MEMBER ( apple2_auxramc000_r ); - READ8_MEMBER ( apple2_auxramd000_r ); - READ8_MEMBER ( apple2_auxrame000_r ); - - WRITE8_MEMBER ( apple2_mainram0000_w ); - WRITE8_MEMBER ( apple2_mainram0200_w ); - WRITE8_MEMBER ( apple2_mainram0400_w ); - WRITE8_MEMBER ( apple2_mainram0800_w ); - WRITE8_MEMBER ( apple2_mainram2000_w ); - WRITE8_MEMBER ( apple2_mainram4000_w ); - WRITE8_MEMBER ( apple2_mainramc000_w ); - WRITE8_MEMBER ( apple2_mainramd000_w ); - WRITE8_MEMBER ( apple2_mainrame000_w ); - WRITE8_MEMBER ( apple2_auxram0000_w ); - WRITE8_MEMBER ( apple2_auxram0200_w ); - WRITE8_MEMBER ( apple2_auxram0400_w ); - WRITE8_MEMBER ( apple2_auxram0800_w ); - WRITE8_MEMBER ( apple2_auxram2000_w ); - WRITE8_MEMBER ( apple2_auxram4000_w ); - WRITE8_MEMBER ( apple2_auxramc000_w ); - WRITE8_MEMBER ( apple2_auxramd000_w ); - WRITE8_MEMBER ( apple2_auxrame000_w ); - - READ8_MEMBER ( apple2_c1xx_r ); - WRITE8_MEMBER ( apple2_c1xx_w ); - READ8_MEMBER ( apple2_c3xx_r ); - WRITE8_MEMBER ( apple2_c3xx_w ); - READ8_MEMBER ( apple2_c4xx_r ); - WRITE8_MEMBER ( apple2_c4xx_w ); - - READ8_MEMBER ( apple2_c800_r ); - WRITE8_MEMBER ( apple2_c800_w ); - READ8_MEMBER ( apple2_ce00_r ); - WRITE8_MEMBER ( apple2_ce00_w ); - - READ8_MEMBER ( apple2_inh_d000_r ); - WRITE8_MEMBER ( apple2_inh_d000_w ); - READ8_MEMBER ( apple2_inh_e000_r ); - WRITE8_MEMBER ( apple2_inh_e000_w ); - - READ8_MEMBER(read_floatingbus); - - READ8_MEMBER(apple2_cfff_r); - WRITE8_MEMBER(apple2_cfff_w); - - void apple2_refresh_delegates(); - int apple2_pressed_specialkey(UINT8 key); - - read8_delegate read_delegates_master[4]; - write8_delegate write_delegates_master[3]; - write8_delegate write_delegates_0000[2]; - write8_delegate write_delegates_0200[2]; - write8_delegate write_delegates_0400[2]; - write8_delegate write_delegates_0800[2]; - write8_delegate write_delegates_2000[2]; - write8_delegate write_delegates_4000[2]; - write8_delegate write_delegates_c000[2]; - write8_delegate write_delegates_d000[2]; - write8_delegate write_delegates_e000[2]; - read8_delegate read_delegates_0000[2]; - read8_delegate read_delegates_0200[2]; - read8_delegate read_delegates_0400[2]; - read8_delegate read_delegates_0800[2]; - read8_delegate read_delegates_2000[2]; - read8_delegate read_delegates_4000[2]; - read8_delegate read_delegates_c000[2]; - read8_delegate read_delegates_d000[2]; - read8_delegate read_delegates_e000[2]; - read8_delegate rd_c000; - write8_delegate wd_c000; - read8_delegate rd_c080; - write8_delegate wd_c080; - read8_delegate rd_cfff; - write8_delegate wd_cfff; - read8_delegate rd_c800; - write8_delegate wd_c800; - read8_delegate rd_ce00; - write8_delegate wd_ce00; - read8_delegate rd_inh_d000; - write8_delegate wd_inh_d000; - read8_delegate rd_inh_e000; - write8_delegate wd_inh_e000; - DECLARE_MACHINE_START(apple2orig); - DECLARE_MACHINE_START(apple2e); - DECLARE_MACHINE_START(apple2c); - DECLARE_MACHINE_START(apple2cp); - DECLARE_MACHINE_START(tk2000); - DECLARE_MACHINE_START(tk3000); - DECLARE_MACHINE_START(laser128); - DECLARE_MACHINE_START(space84); - DECLARE_MACHINE_START(laba2p); - DECLARE_VIDEO_START(apple2); - DECLARE_PALETTE_INIT(apple2); - DECLARE_VIDEO_START(apple2p); - DECLARE_VIDEO_START(apple2e); - DECLARE_VIDEO_START(apple2c); - UINT32 screen_update_apple2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); - DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); - DECLARE_READ_LINE_MEMBER(ay3600_shift_r); - DECLARE_READ_LINE_MEMBER(ay3600_control_r); - DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); - DECLARE_WRITE_LINE_MEMBER(ay3600_iie_data_ready_w); - void apple2_update_memory_postload(); - virtual void machine_reset(); - void apple2_setup_memory(const apple2_memmap_config *config); - void apple2_update_memory(); - inline UINT32 effective_a2(); - UINT32 compute_video_address(int col, int row); - void adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow); - inline void apple2_plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, - const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2); - void apple2_text_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); - void apple2_lores_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); - void apple2_hires_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); - void apple2_video_start(const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo); - void apple2_setvar(UINT32 val, UINT32 mask); - UINT8 apple2_getfloatingbusvalue(); - int apple2_fdc_has_35(); - int apple2_fdc_has_525(); - void apple2_iwm_setdiskreg(UINT8 data); - void apple2_init_common(); - void apple2eplus_init_common(void *apple2cp_ce00_ram); - INT8 apple2_slotram_r(address_space &space, int slotnum, int offset); - int a2_no_ctrl_reset(); - -private: - // Laser 128EX2 slot 5 Apple Memory Expansion emulation vars - UINT8 m_exp_bankhior; - int m_exp_addrmask; - UINT8 m_exp_regs[0x10]; - UINT8 *m_exp_ram; - int m_exp_wptr, m_exp_liveptr; -}; -/*----------- defined in drivers/apple2.c -----------*/ -INPUT_PORTS_EXTERN( apple2ep ); -/*----------- defined in machine/apple2.c -----------*/ -extern const applefdc_interface apple2_fdc_interface; - -#endif /* APPLE2_H_ */ diff --git a/src/mess/includes/apple2gs.h b/src/mess/includes/apple2gs.h deleted file mode 100644 index eddd8445cd5..00000000000 --- a/src/mess/includes/apple2gs.h +++ /dev/null @@ -1,267 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,R. Belmont -/***************************************************************************** - * - * includes/apple2gs.h - * - * Apple IIgs - * - ****************************************************************************/ - -#ifndef APPLE2GS_H_ -#define APPLE2GS_H_ - -#define RUN_ADB_MICRO (0) - -#include "includes/apple2.h" -#include "sound/es5503.h" -#include "machine/nvram.h" -#include "cpu/g65816/g65816.h" -#include "cpu/m6502/m5074x.h" - -#define ADBMICRO_TAG "adbmicro" - -// IIgs clocks as marked on the schematics -#define APPLE2GS_28M (XTAL_28_63636MHz) // IIGS master clock -#define APPLE2GS_14M (APPLE2GS_28M/2) -#define APPLE2GS_7M (APPLE2GS_28M/4) - -// screen dimensions -#define BORDER_LEFT (32) -#define BORDER_RIGHT (32) -#define BORDER_TOP (16) // (plus bottom) - -// these are numbered as seen from the MCU -enum glu_reg_names -{ - GLU_KEY_DATA = 0, // MCU W - GLU_COMMAND, // MCU R - GLU_MOUSEX, // MCU W - GLU_MOUSEY, // MCU W - GLU_KG_STATUS, // MCU R - GLU_ANY_KEY_DOWN, // MCU W - GLU_KEYMOD, // MCU W - GLU_DATA, // MCU W - - GLU_C000, // 816 R - GLU_C010, // 816 RW - GLU_SYSSTAT // 816 R/(limited) W -}; - -enum glu_kg_status -{ - KGS_ANY_KEY_DOWN = 0x01, - KGS_KEYSTROBE = 0x10, - KGS_DATA_FULL = 0x20, - KGS_COMMAND_FULL = 0x40, - KGS_MOUSEX_FULL = 0x80 -}; - -enum apple2gs_clock_mode -{ - CLOCKMODE_IDLE, - CLOCKMODE_TIME, - CLOCKMODE_INTERNALREGS, - CLOCKMODE_BRAM1, - CLOCKMODE_BRAM2 -}; - - -enum adbstate_t -{ - ADBSTATE_IDLE, - ADBSTATE_INCOMMAND, - ADBSTATE_INRESPONSE -}; - -#define IRQ_KBD_SRQ 0x01 -#define IRQ_ADB_DATA 0x02 -#define IRQ_ADB_MOUSE 0x04 -#define IRQ_VGC_SCANLINE 0x08 -#define IRQ_VGC_SECOND 0x10 -#define IRQ_INTEN_QSECOND 0x20 -#define IRQ_INTEN_VBL 0x40 -#define IRQ_DOC 0x80 -#define IRQ_SLOT 0x100 - -void apple2gs_add_irq(running_machine &machine, UINT16 irq_mask); -void apple2gs_remove_irq(running_machine &machine, UINT16 irq_mask); - -class apple2gs_state : public apple2_state -{ -public: - apple2gs_state(const machine_config &mconfig, device_type type, const char *tag) - : apple2_state(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_es5503(*this, "es5503"), - m_fdc(*this, "fdc"), - #if RUN_ADB_MICRO - m_adbmicro(*this, ADBMICRO_TAG), - #endif - m_adb_mousex(*this, "adb_mouse_x"), - m_adb_mousey(*this, "adb_mouse_y"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_es5503; - required_device m_fdc; - #if RUN_ADB_MICRO - optional_device m_adbmicro; - #endif - - required_ioport m_adb_mousex, m_adb_mousey; - required_device m_palette; - - UINT8 *m_slowmem; - UINT8 m_newvideo; - UINT16 m_bordercolor; - UINT8 m_vgcint; - UINT8 m_langsel; - UINT8 m_sltromsel; - UINT8 m_cyareg; - UINT8 m_inten; - UINT8 m_intflag; - UINT8 m_shadow; - UINT16 m_pending_irqs; - UINT8 m_mouse_x; - UINT8 m_mouse_y; - INT8 m_mouse_dx; - INT8 m_mouse_dy; - device_t *m_cur_slot6_image; - emu_timer *m_scanline_timer; - emu_timer *m_clock_timer; - emu_timer *m_qsecond_timer; - UINT8 m_clock_data; - UINT8 m_clock_control; - UINT8 m_clock_read; - UINT8 m_clock_reg1; - apple2gs_clock_mode m_clock_mode; - UINT32 m_clock_curtime; - seconds_t m_clock_curtime_interval; - UINT8 m_clock_bram[256]; - #if !RUN_ADB_MICRO - adbstate_t m_adb_state; - UINT8 m_adb_command; - UINT8 m_adb_mode; - UINT8 m_adb_kmstatus; - UINT8 m_adb_latent_result; - INT32 m_adb_command_length; - INT32 m_adb_command_pos; - UINT8 m_adb_command_bytes[8]; - UINT8 m_adb_response_bytes[8]; - UINT8 m_adb_response_length; - INT32 m_adb_response_pos; - UINT8 m_adb_memory[0x100]; - int m_adb_address_keyboard; - int m_adb_address_mouse; - #endif - UINT8 m_sndglu_ctrl; - int m_sndglu_addr; - int m_sndglu_dummy_read; - bitmap_ind16 *m_legacy_gfx; - bool m_is_rom3; - UINT8 m_echo_bank; - UINT64 m_last_adb_time; - int m_adb_dtime; - UINT32 m_a2_palette[16]; - UINT32 m_shr_palette[256]; - - READ8_MEMBER( apple2gs_c0xx_r ); - WRITE8_MEMBER( apple2gs_c0xx_w ); - WRITE8_MEMBER( apple2gs_main0400_w ); - WRITE8_MEMBER( apple2gs_aux0400_w ); - WRITE8_MEMBER( apple2gs_main2000_w ); - WRITE8_MEMBER( apple2gs_aux2000_w ); - WRITE8_MEMBER( apple2gs_main4000_w ); - WRITE8_MEMBER( apple2gs_aux4000_w ); - - UINT8 adb_read_datareg(); - UINT8 adb_read_kmstatus(); - - void apple2gs_refresh_delegates(); - - write8_delegate write_delegates_2gs0400[2]; - write8_delegate write_delegates_2gs2000[2]; - write8_delegate write_delegates_2gs4000[2]; - DECLARE_MACHINE_START(apple2gs); - DECLARE_MACHINE_RESET(apple2gs); - DECLARE_VIDEO_START(apple2gs); - DECLARE_PALETTE_INIT(apple2gs); - DECLARE_MACHINE_START(apple2gsr1); - DECLARE_MACHINE_START(apple2gscommon); - UINT32 screen_update_apple2gs(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(apple2gs_clock_tick); - TIMER_CALLBACK_MEMBER(apple2gs_qsecond_tick); - TIMER_CALLBACK_MEMBER(apple2gs_scanline_tick); - DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); - DECLARE_READ8_MEMBER(apple2gs_read_vector); - - // ADB MCU and ADB GLU stuff - #if RUN_ADB_MICRO - UINT8 m_glu_regs[8], m_glu_bus, m_glu_sysstat; - bool m_glu_mcu_read_kgs, m_glu_816_read_dstat, m_glu_mouse_read_stat, m_adb_line; - - UINT8 keyglu_mcu_read(UINT8 offset); - void keyglu_mcu_write(UINT8 offset, UINT8 data); - UINT8 keyglu_816_read(UINT8 offset); - void keyglu_816_write(UINT8 offset, UINT8 data); - - DECLARE_READ8_MEMBER(adbmicro_p0_in); - DECLARE_READ8_MEMBER(adbmicro_p1_in); - DECLARE_READ8_MEMBER(adbmicro_p2_in); - DECLARE_READ8_MEMBER(adbmicro_p3_in); - DECLARE_WRITE8_MEMBER(adbmicro_p0_out); - DECLARE_WRITE8_MEMBER(adbmicro_p1_out); - DECLARE_WRITE8_MEMBER(adbmicro_p2_out); - DECLARE_WRITE8_MEMBER(adbmicro_p3_out); - #endif - void process_clock(); - const char *apple2gs_irq_name(UINT16 irq_mask); - void apple2gs_add_irq(UINT16 irq_mask); - void apple2gs_remove_irq(UINT16 irq_mask); - UINT8 adb_read_memory(UINT32 address); - void adb_write_memory(UINT32 address, UINT8 data); - void adb_set_mode(UINT8 mode); - void adb_set_config(UINT8 b1, UINT8 b2, UINT8 b3); - void adb_post_response(const UINT8 *bytes, size_t length); - void adb_post_response_1(UINT8 b); - void adb_post_response_2(UINT8 b1, UINT8 b2); - void adb_do_command(); - void adb_write_datareg(UINT8 data); - void adb_write_kmstatus(UINT8 data); - UINT8 adb_read_mousedata(); - INT8 seven_bit_diff(UINT8 v1, UINT8 v2); - void adb_check_mouse(); - void apple2gs_set_scanint(UINT8 data); - int apple2gs_get_vpos(); - UINT8 *apple2gs_getslotmem(offs_t address); - UINT8 apple2gs_xxCxxx_r(address_space &space, offs_t address); - void apple2gs_xxCxxx_w(address_space &space, offs_t address, UINT8 data); - void apple2gs_setup_memory(); - - DECLARE_READ8_MEMBER( gssnd_r ); - DECLARE_WRITE8_MEMBER( gssnd_w ); - DECLARE_READ8_MEMBER( apple2gs_00Cxxx_r ); - DECLARE_READ8_MEMBER( apple2gs_01Cxxx_r ); - DECLARE_READ8_MEMBER( apple2gs_E0Cxxx_r ); - DECLARE_READ8_MEMBER( apple2gs_E1Cxxx_r ); - DECLARE_WRITE8_MEMBER( apple2gs_00Cxxx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_01Cxxx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_E0Cxxx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_E1Cxxx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_Exxxxx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_E004xx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_E02xxx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_E104xx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_E12xxx_w ); - DECLARE_WRITE8_MEMBER( apple2gs_slowmem_w ); - DECLARE_READ8_MEMBER(apple2gs_bank_echo_r); - DECLARE_WRITE_LINE_MEMBER( apple2gs_doc_irq); - DECLARE_READ8_MEMBER(apple2gs_adc_read); - -}; - -#endif /* APPLE2GS_H_ */ diff --git a/src/mess/includes/apple3.h b/src/mess/includes/apple3.h deleted file mode 100644 index 1d389c0b435..00000000000 --- a/src/mess/includes/apple3.h +++ /dev/null @@ -1,173 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,R. Belmont -/***************************************************************************** - * - * includes/apple3.h - * - * Apple /// - * - ****************************************************************************/ - -#ifndef APPLE3_H_ -#define APPLE3_H_ - -#include "cpu/m6502/m6502.h" -#include "includes/apple2.h" -#include "machine/ram.h" -#include "bus/a2bus/a2bus.h" -#include "machine/mos6551.h" -#include "machine/6522via.h" -#include "machine/kb3600.h" -#include "machine/mm58167.h" -#include "sound/speaker.h" -#include "sound/dac.h" -#include "machine/wozfdc.h" -#include "imagedev/floppy.h" -#include "formats/flopimg.h" - -#define VAR_VM0 0x0001 -#define VAR_VM1 0x0002 -#define VAR_VM2 0x0004 -#define VAR_VM3 0x0008 -#define VAR_EXTA0 0x0010 -#define VAR_EXTA1 0x0020 -#define VAR_EXTPOWER 0x0040 -#define VAR_EXTSIDE 0x0080 - -#define SPEAKER_TAG "a3spkr" -#define DAC_TAG "a3dac" - -class apple3_state : public driver_device -{ -public: - apple3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_via_0(*this, "via6522_0"), - m_via_1(*this, "via6522_1"), - m_acia(*this, "acia"), - m_fdc(*this, "fdc"), - m_ay3600(*this, "ay3600"), - m_a2bus(*this, "a2bus"), - m_rtc(*this, "rtc"), - m_speaker(*this, SPEAKER_TAG), - m_dac(*this, DAC_TAG), - m_kbspecial(*this, "keyb_special"), - m_palette(*this, "palette"), - m_joy1x(*this, "joy_1_x"), - m_joy1y(*this, "joy_1_y"), - m_joy2x(*this, "joy_2_x"), - m_joy2y(*this, "joy_2_y"), - m_joybuttons(*this, "joy_buttons"), - m_pdltimer(*this, "pdltimer"), - floppy0(*this, "0"), - floppy1(*this, "1"), - floppy2(*this, "2"), - floppy3(*this, "3") - { - } - - required_device m_maincpu; - required_device m_ram; - required_device m_via_0; - required_device m_via_1; - required_device m_acia; - required_device m_fdc; - required_device m_ay3600; - required_device m_a2bus; - required_device m_rtc; - required_device m_speaker; - required_device m_dac; - required_ioport m_kbspecial; - required_device m_palette; - required_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons; - required_device m_pdltimer; - required_device floppy0; - required_device floppy1; - required_device floppy2; - required_device floppy3; - - DECLARE_READ8_MEMBER(apple3_memory_r); - DECLARE_WRITE8_MEMBER(apple3_memory_w); - DECLARE_WRITE_LINE_MEMBER(apple3_sync_w); - DECLARE_READ8_MEMBER(apple3_c0xx_r); - DECLARE_WRITE8_MEMBER(apple3_c0xx_w); - DECLARE_READ8_MEMBER(apple3_00xx_r); - DECLARE_WRITE8_MEMBER(apple3_00xx_w); - DECLARE_DRIVER_INIT(apple3); - DECLARE_MACHINE_RESET(apple3); - DECLARE_VIDEO_START(apple3); - UINT32 screen_update_apple3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(apple3_interrupt); - DECLARE_WRITE_LINE_MEMBER(apple3_acia_irq_func); - DECLARE_WRITE8_MEMBER(apple3_via_0_out_a); - DECLARE_WRITE8_MEMBER(apple3_via_0_out_b); - DECLARE_WRITE8_MEMBER(apple3_via_1_out_a); - DECLARE_WRITE8_MEMBER(apple3_via_1_out_b); - DECLARE_WRITE_LINE_MEMBER(apple3_via_0_irq_func); - DECLARE_WRITE_LINE_MEMBER(apple3_via_1_irq_func); - void apple3_write_charmem(); - void apple3_video_text40(bitmap_ind16 &bitmap); - void apple3_video_text80(bitmap_ind16 &bitmap); - void apple3_video_graphics_hgr(bitmap_ind16 &bitmap); - UINT8 swap_bits(UINT8 b); - void apple3_video_graphics_chgr(bitmap_ind16 &bitmap); - void apple3_video_graphics_shgr(bitmap_ind16 &bitmap); - void apple3_video_graphics_chires(bitmap_ind16 &bitmap); - UINT8 *apple3_bankaddr(UINT16 bank, offs_t offset); - UINT8 *apple3_get_zpa_addr(offs_t offset); - void apple3_update_memory(); - void apple3_via_out(UINT8 *var, UINT8 data); - UINT8 *apple3_get_indexed_addr(offs_t offset); - TIMER_DEVICE_CALLBACK_MEMBER(apple3_c040_tick); - DECLARE_PALETTE_INIT(apple3); - void apple3_irq_update(); - DECLARE_READ_LINE_MEMBER(ay3600_shift_r); - DECLARE_READ_LINE_MEMBER(ay3600_control_r); - DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); - void apple3_postload(); - TIMER_DEVICE_CALLBACK_MEMBER(paddle_timer); - void pdl_handler(int offset); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); - DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); - - // these need to be public for now - UINT32 m_flags; - int m_enable_mask; - -private: - int m_acia_irq; - UINT8 m_via_0_a; - UINT8 m_via_0_b; - UINT8 m_via_1_a; - UINT8 m_via_1_b; - int m_via_0_irq; - int m_via_1_irq; - offs_t m_zpa; - UINT8 m_last_n; - UINT8 m_char_mem[0x800]; - UINT32 *m_hgr_map; - - bool m_sync; - bool m_rom_has_been_disabled; - int m_cnxx_slot; - UINT8 m_indir_bank; - - UINT8 *m_bank2, *m_bank3, *m_bank4, *m_bank5, *m_bank8, *m_bank9; - UINT8 *m_bank10, *m_bank11; - UINT8 *m_bank6, *m_bank7rd, *m_bank7wr; - int m_speaker_state; - int m_c040_time; - UINT16 m_lastchar, m_strobe; - UINT8 m_transchar; - - int m_analog_sel; - bool m_ramp_active; - int m_pdl_charge; - int m_va, m_vb, m_vc; - int m_smoothscr; -}; - -#endif /* APPLE3_H_ */ diff --git a/src/mess/includes/aquarius.h b/src/mess/includes/aquarius.h deleted file mode 100644 index 1375aa6015c..00000000000 --- a/src/mess/includes/aquarius.h +++ /dev/null @@ -1,89 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/***************************************************************************** - * - * includes/aquarius.h - * - ****************************************************************************/ - -#ifndef __AQUARIUS__ -#define __AQUARIUS__ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "video/tea1002.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "sound/ay8910.h" -#include "sound/speaker.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -class aquarius_state : public driver_device -{ -public: - aquarius_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_speaker(*this, "speaker"), - m_cart(*this, "cartslot"), - m_ram(*this, RAM_TAG), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_tea1002(*this, "encoder"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_cassette; - required_device m_speaker; - required_device m_cart; - required_device m_ram; - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_device m_gfxdecode; - required_device m_screen; - required_device m_tea1002; - required_device m_palette; - - UINT8 m_scrambler; - tilemap_t *m_tilemap; - - DECLARE_WRITE8_MEMBER(aquarius_videoram_w); - DECLARE_WRITE8_MEMBER(aquarius_colorram_w); - DECLARE_READ8_MEMBER(cassette_r); - DECLARE_WRITE8_MEMBER(cassette_w); - DECLARE_READ8_MEMBER(vsync_r); - DECLARE_WRITE8_MEMBER(mapper_w); - DECLARE_READ8_MEMBER(printer_r); - DECLARE_WRITE8_MEMBER(printer_w); - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(scrambler_w); - DECLARE_READ8_MEMBER(cartridge_r); - DECLARE_DRIVER_INIT(aquarius); - TILE_GET_INFO_MEMBER(aquarius_gettileinfo); - virtual void video_start(); - DECLARE_PALETTE_INIT(aquarius); - UINT32 screen_update_aquarius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_INPUT_CHANGED_MEMBER(aquarius_reset); -}; -#endif /* AQUARIUS_H_ */ diff --git a/src/mess/includes/arcadia.h b/src/mess/includes/arcadia.h deleted file mode 100644 index f7bf608bb42..00000000000 --- a/src/mess/includes/arcadia.h +++ /dev/null @@ -1,128 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/arcadia.h - * - ****************************************************************************/ - -#ifndef ARCADIA_H_ -#define ARCADIA_H_ - -#include "emu.h" -#include "cpu/s2650/s2650.h" -#include "audio/arcadia.h" - -#include "bus/arcadia/slot.h" -#include "bus/arcadia/rom.h" - -// space vultures sprites above -// combat below and invisible -#define YPOS 0 -//#define YBOTTOM_SIZE 24 -// grand slam sprites left and right -// space vultures left -// space attack left -#define XPOS 32 - - -class arcadia_state : public driver_device -{ -public: - arcadia_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_custom(*this, "custom"), - m_panel(*this, "panel"), - m_controller1_col1(*this, "controller1_col1"), - m_controller1_col2(*this, "controller1_col2"), - m_controller1_col3(*this, "controller1_col3"), - m_controller1_extra(*this, "controller1_extra"), - m_controller2_col1(*this, "controller2_col1"), - m_controller2_col2(*this, "controller2_col2"), - m_controller2_col3(*this, "controller2_col3"), - m_controller2_extra(*this, "controller2_extra"), - m_joysticks(*this, "joysticks") , - m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_screen(*this, "screen") { } - - DECLARE_READ8_MEMBER(vsync_r); - DECLARE_READ8_MEMBER(video_r); - DECLARE_WRITE8_MEMBER(video_w); - int m_line; - int m_charline; - int m_shift; - int m_ad_delay; - int m_ad_select; - int m_ypos; - int m_graphics; - int m_doublescan; - int m_lines26; - int m_multicolor; - struct { int x, y; } m_pos[4]; - UINT8 m_bg[262][16+2*XPOS/8]; - UINT8 m_rectangle[0x40][8]; - UINT8 m_chars[0x40][8]; - int m_breaker; - union - { - UINT8 data[0x400]; - struct - { - // 0x1800 - UINT8 chars1[13][16]; - UINT8 ram1[2][16]; - struct { UINT8 y,x; } pos[4]; - UINT8 ram2[4]; - UINT8 vpos; - UINT8 sound1, sound2; - UINT8 char_line; - // 0x1900 - UINT8 pad1a, pad1b, pad1c, pad1d; - UINT8 pad2a, pad2b, pad2c, pad2d; - UINT8 keys, unmapped3[0x80-9]; - UINT8 chars[8][8]; - UINT8 unknown[0x38]; - UINT8 pal[4]; - UINT8 collision_bg, - collision_sprite; - UINT8 ad[2]; - // 0x1a00 - UINT8 chars2[13][16]; - UINT8 ram3[3][16]; - } d; - } m_reg; - bitmap_ind16 *m_bitmap; - DECLARE_DRIVER_INIT(arcadia); - virtual void machine_start(); - virtual void video_start(); - DECLARE_PALETTE_INIT(arcadia); - UINT32 screen_update_arcadia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(video_line); - -protected: - required_device m_custom; - required_ioport m_panel; - required_ioport m_controller1_col1; - required_ioport m_controller1_col2; - required_ioport m_controller1_col3; - required_ioport m_controller1_extra; - required_ioport m_controller2_col1; - required_ioport m_controller2_col2; - required_ioport m_controller2_col3; - required_ioport m_controller2_extra; - required_ioport m_joysticks; - - void draw_char(UINT8 *ch, int charcode, int y, int x); - void vh_draw_line(int y, UINT8 chars1[16]); - int sprite_collision(int n1, int n2); - void draw_sprites(); - required_device m_maincpu; - required_device m_cart; - required_device m_gfxdecode; - required_device m_palette; - required_device m_screen; -}; -#endif /* ARCADIA_H_ */ diff --git a/src/mess/includes/at.h b/src/mess/includes/at.h deleted file mode 100644 index 63391195f90..00000000000 --- a/src/mess/includes/at.h +++ /dev/null @@ -1,200 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Miodrag Milanovic -/***************************************************************************** - * - * includes/at.h - * - * IBM AT Compatibles - * - ****************************************************************************/ - -#ifndef AT_H_ -#define AT_H_ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "cpu/i86/i286.h" -#include "cpu/i386/i386.h" - -#include "machine/ins8250.h" -#include "machine/mc146818.h" -#include "machine/ds128x.h" -#include "machine/pic8259.h" -#include "bus/lpci/i82371ab.h" -#include "bus/lpci/i82371sb.h" -#include "bus/lpci/i82439tx.h" -#include "bus/lpci/vt82c505.h" -#include "machine/vt82c496.h" -#include "machine/cs8221.h" -#include "machine/pit8253.h" -#include "machine/wd7600.h" - -#include "machine/idectrl.h" -#include "machine/at_keybc.h" - -#include "imagedev/harddriv.h" -#include "machine/am9517a.h" -#include "bus/lpci/pci.h" - -#include "sound/dac.h" -#include "sound/speaker.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" - -#include "machine/pc_lpt.h" -#include "bus/pc_kbd/pc_kbdc.h" - - -class at586_state : public driver_device -{ -public: - at586_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") { } - required_device m_maincpu; - - DECLARE_DRIVER_INIT(at586); -}; - -class at_state : public driver_device -{ -public: - at_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pic8259_master(*this, "pic8259_master"), - m_pic8259_slave(*this, "pic8259_slave"), - m_dma8237_1(*this, "dma8237_1"), - m_dma8237_2(*this, "dma8237_2"), - m_pit8254(*this, "pit8254"), - m_cs8221(*this, "cs8221"), - m_ide(*this, "ide"), - m_keybc(*this, "keybc"), - m_isabus(*this, "isabus"), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG), - m_mc146818(*this, "rtc"), - m_pc_kbdc(*this, "pc_kbdc") - { } - - required_device m_maincpu; - optional_device m_pic8259_master; - optional_device m_pic8259_slave; - optional_device m_dma8237_1; - optional_device m_dma8237_2; - optional_device m_pit8254; - optional_device m_cs8221; - optional_device m_ide; - optional_device m_keybc; - optional_device m_isabus; - required_device m_speaker; - optional_device m_ram; - optional_device m_mc146818; - optional_device m_pc_kbdc; - DECLARE_READ8_MEMBER(at_page8_r); - DECLARE_WRITE8_MEMBER(at_page8_w); - DECLARE_READ8_MEMBER(at_portb_r); - DECLARE_WRITE8_MEMBER(at_portb_w); - DECLARE_READ8_MEMBER(ps2_portb_r); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE_LINE_MEMBER(at_pit8254_out0_changed); - DECLARE_WRITE_LINE_MEMBER(at_pit8254_out2_changed); - DECLARE_WRITE_LINE_MEMBER(pc_dma_hrq_changed); - DECLARE_READ8_MEMBER(pc_dma8237_0_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_1_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_2_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_3_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_5_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_6_dack_r); - DECLARE_READ8_MEMBER(pc_dma8237_7_dack_r); - DECLARE_WRITE8_MEMBER(pc_dma8237_0_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_1_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_2_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_3_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_5_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_6_dack_w); - DECLARE_WRITE8_MEMBER(pc_dma8237_7_dack_w); - DECLARE_WRITE_LINE_MEMBER(at_dma8237_out_eop); - DECLARE_WRITE_LINE_MEMBER(pc_dack0_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack1_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack2_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack3_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack4_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack5_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack6_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack7_w); - DECLARE_READ32_MEMBER(ide_r); - DECLARE_WRITE32_MEMBER(ide_w); - DECLARE_READ8_MEMBER(at_dma8237_2_r); - DECLARE_WRITE8_MEMBER(at_dma8237_2_w); - DECLARE_READ8_MEMBER(at_keybc_r); - DECLARE_WRITE8_MEMBER(at_keybc_w); - DECLARE_READ16_MEMBER(neat_chipset_r); - DECLARE_WRITE16_MEMBER(neat_chipset_w); - DECLARE_WRITE_LINE_MEMBER(at_mc146818_irq); - DECLARE_WRITE8_MEMBER(write_rtc); - UINT8 m_at_spkrdata; - UINT8 m_pit_out2; - int m_dma_channel; - bool m_cur_eop; - UINT8 m_dma_offset[2][4]; - UINT8 m_at_pages[0x10]; - UINT16 m_dma_high_byte; - UINT8 m_at_speaker; - UINT16 m_ps1_reg[2]; - DECLARE_READ16_MEMBER(ps1_unk_r); - DECLARE_WRITE16_MEMBER(ps1_unk_w); - DECLARE_READ8_MEMBER(ps1_kbdc_r); - - void at_speaker_set_spkrdata(UINT8 data); - DECLARE_WRITE_LINE_MEMBER(at_shutdown); - - UINT8 m_channel_check; - UINT8 m_nmi_enabled; - DECLARE_READ8_MEMBER(pc_dma_read_byte); - DECLARE_WRITE8_MEMBER(pc_dma_write_byte); - DECLARE_READ8_MEMBER(pc_dma_read_word); - DECLARE_WRITE8_MEMBER(pc_dma_write_word); - - DECLARE_DRIVER_INIT(atcga); - DECLARE_DRIVER_INIT(atvga); - DECLARE_DRIVER_INIT(megapcpla); - DECLARE_DRIVER_INIT(atpci); - DECLARE_MACHINE_START(at); - DECLARE_MACHINE_RESET(at); - void pc_set_dma_channel(int channel, int state); - void init_at_common(int xmsbase); - UINT32 at_286_a20(bool state); -}; - -class megapc_state : public driver_device -{ -public: - megapc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_wd7600(*this, "wd7600"), - m_isabus(*this, "isabus"), - m_speaker(*this, "speaker") - { } - -public: - required_device m_maincpu; - required_device m_wd7600; - required_device m_isabus; - required_device m_speaker; - - DECLARE_DRIVER_INIT(megapc); - DECLARE_DRIVER_INIT(megapcpl); - - DECLARE_READ16_MEMBER( wd7600_ior ); - DECLARE_WRITE16_MEMBER( wd7600_iow ); - DECLARE_WRITE_LINE_MEMBER( wd7600_hold ); - DECLARE_WRITE8_MEMBER( wd7600_tc ) { m_isabus->eop_w(offset, data); } - DECLARE_WRITE_LINE_MEMBER( wd7600_spkr ) { m_speaker->level_w(state); } -}; - - -#endif /* AT_H_ */ diff --git a/src/mess/includes/atarist.h b/src/mess/includes/atarist.h deleted file mode 100644 index 2e153b4a59a..00000000000 --- a/src/mess/includes/atarist.h +++ /dev/null @@ -1,469 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Olivier Galibert -#pragma once - -#ifndef __ATARI_ST__ -#define __ATARI_ST__ - -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "cpu/m6800/m6800.h" -#include "machine/6850acia.h" -#include "machine/8530scc.h" -#include "bus/centronics/ctronics.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "machine/mc68901.h" -#include "machine/ram.h" -#include "machine/rescap.h" -#include "machine/rp5c15.h" -#include "machine/wd_fdc.h" -#include "sound/ay8910.h" -#include "sound/lmc1992.h" - -#define M68000_TAG "m68000" -#define HD6301V1_TAG "hd6301" -#define YM2149_TAG "ym2149" -#define MC6850_0_TAG "mc6850_0" -#define MC6850_1_TAG "mc6850_1" -#define Z8530_TAG "z8530" -#define COP888_TAG "u703" -#define RP5C15_TAG "rp5c15" -#define YM3439_TAG "ym3439" -#define MC68901_TAG "mc68901" -#define LMC1992_TAG "lmc1992" -#define WD1772_TAG "wd1772" -#define SCREEN_TAG "screen" -#define CENTRONICS_TAG "centronics" -#define RS232_TAG "rs232" - -// Atari ST - -#define Y1 XTAL_2_4576MHz - -// STBook - -#define U517 XTAL_16MHz -#define Y200 XTAL_2_4576MHz -#define Y700 XTAL_10MHz - -#define DMA_STATUS_DRQ 0x04 -#define DMA_STATUS_SECTOR_COUNT 0x02 -#define DMA_STATUS_ERROR 0x01 - -#define DMA_MODE_READ_WRITE 0x100 -#define DMA_MODE_FDC_HDC_ACK 0x080 -#define DMA_MODE_ENABLED 0x040 -#define DMA_MODE_SECTOR_COUNT 0x010 -#define DMA_MODE_FDC_HDC_CS 0x008 -#define DMA_MODE_A1 0x004 -#define DMA_MODE_A0 0x002 -#define DMA_MODE_ADDRESS_MASK 0x006 - -#define DMA_SECTOR_SIZE 512 - -enum -{ - IKBD_MOUSE_PHASE_STATIC = 0, - IKBD_MOUSE_PHASE_POSITIVE, - IKBD_MOUSE_PHASE_NEGATIVE -}; - -class st_state : public driver_device -{ -public: - enum - { - TIMER_MOUSE_TICK, - TIMER_SHIFTER_TICK, - TIMER_GLUE_TICK, - TIMER_BLITTER_TICK - }; - - st_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M68000_TAG), - m_fdc(*this, WD1772_TAG), - m_mfp(*this, MC68901_TAG), - m_acia0(*this, MC6850_0_TAG), - m_acia1(*this, MC6850_1_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_cart(*this, "cartslot"), - m_ram(*this, RAM_TAG), - m_rs232(*this, RS232_TAG), - m_p31(*this, "P31"), - m_p32(*this, "P32"), - m_p33(*this, "P33"), - m_p34(*this, "P34"), - m_p35(*this, "P35"), - m_p36(*this, "P36"), - m_p37(*this, "P37"), - m_p40(*this, "P40"), - m_p41(*this, "P41"), - m_p42(*this, "P42"), - m_p43(*this, "P43"), - m_p44(*this, "P44"), - m_p45(*this, "P45"), - m_p46(*this, "P46"), - m_p47(*this, "P47"), - m_joy0(*this, "IKBD_JOY0"), - m_joy1(*this, "IKBD_JOY1"), - m_mousex(*this, "IKBD_MOUSEX"), - m_mousey(*this, "IKBD_MOUSEY"), - m_config(*this, "config"), - m_acia_ikbd_irq(1), - m_acia_midi_irq(1), - m_ikbd_mouse_x(0), - m_ikbd_mouse_y(0), - m_ikbd_mouse_px(IKBD_MOUSE_PHASE_STATIC), - m_ikbd_mouse_py(IKBD_MOUSE_PHASE_STATIC), - m_ikbd_mouse_pc(0), - m_ikbd_joy(1), - m_monochrome(1), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_fdc; - required_device m_mfp; - required_device m_acia0; - required_device m_acia1; - required_device m_centronics; - required_device m_cart; - required_device m_ram; - required_device m_rs232; - required_ioport m_p31; - required_ioport m_p32; - required_ioport m_p33; - required_ioport m_p34; - required_ioport m_p35; - required_ioport m_p36; - required_ioport m_p37; - required_ioport m_p40; - required_ioport m_p41; - required_ioport m_p42; - required_ioport m_p43; - required_ioport m_p44; - required_ioport m_p45; - required_ioport m_p46; - required_ioport m_p47; - optional_ioport m_joy0; - optional_ioport m_joy1; - optional_ioport m_mousex; - optional_ioport m_mousey; - optional_ioport m_config; - - void machine_start(); - - void video_start(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - // video - DECLARE_READ8_MEMBER( shifter_base_r ); - DECLARE_READ8_MEMBER( shifter_counter_r ); - DECLARE_READ8_MEMBER( shifter_sync_r ); - DECLARE_READ16_MEMBER( shifter_palette_r ); - DECLARE_READ8_MEMBER( shifter_mode_r ); - - DECLARE_WRITE8_MEMBER( shifter_base_w ); - DECLARE_WRITE8_MEMBER( shifter_sync_w ); - DECLARE_WRITE16_MEMBER( shifter_palette_w ); - DECLARE_WRITE8_MEMBER( shifter_mode_w ); - - DECLARE_READ16_MEMBER( blitter_halftone_r ); - DECLARE_READ16_MEMBER( blitter_src_inc_x_r ); - DECLARE_READ16_MEMBER( blitter_src_inc_y_r ); - DECLARE_READ16_MEMBER( blitter_src_r ); - DECLARE_READ16_MEMBER( blitter_end_mask_r ); - DECLARE_READ16_MEMBER( blitter_dst_inc_x_r ); - DECLARE_READ16_MEMBER( blitter_dst_inc_y_r ); - DECLARE_READ16_MEMBER( blitter_dst_r ); - DECLARE_READ16_MEMBER( blitter_count_x_r ); - DECLARE_READ16_MEMBER( blitter_count_y_r ); - DECLARE_READ16_MEMBER( blitter_op_r ); - DECLARE_READ16_MEMBER( blitter_ctrl_r ); - - DECLARE_WRITE16_MEMBER( blitter_halftone_w ); - DECLARE_WRITE16_MEMBER( blitter_src_inc_x_w ); - DECLARE_WRITE16_MEMBER( blitter_src_inc_y_w ); - DECLARE_WRITE16_MEMBER( blitter_src_w ); - DECLARE_WRITE16_MEMBER( blitter_end_mask_w ); - DECLARE_WRITE16_MEMBER( blitter_dst_inc_x_w ); - DECLARE_WRITE16_MEMBER( blitter_dst_inc_y_w ); - DECLARE_WRITE16_MEMBER( blitter_dst_w ); - DECLARE_WRITE16_MEMBER( blitter_count_x_w ); - DECLARE_WRITE16_MEMBER( blitter_count_y_w ); - DECLARE_WRITE16_MEMBER( blitter_op_w ); - DECLARE_WRITE16_MEMBER( blitter_ctrl_w ); - - void mouse_tick(); - inline pen_t shift_mode_0(); - inline pen_t shift_mode_1(); - inline pen_t shift_mode_2(); - void shifter_tick(); - inline void shifter_load(); - void glue_tick(); - void set_screen_parameters(); - void blitter_source(); - UINT16 blitter_hop(); - void blitter_op(UINT16 s, UINT32 dstaddr, UINT16 mask); - void blitter_tick(); - - // driver - DECLARE_READ16_MEMBER( fdc_data_r ); - DECLARE_WRITE16_MEMBER( fdc_data_w ); - DECLARE_READ16_MEMBER( dma_status_r ); - DECLARE_WRITE16_MEMBER( dma_mode_w ); - DECLARE_READ8_MEMBER( dma_counter_r ); - DECLARE_WRITE8_MEMBER( dma_base_w ); - DECLARE_READ8_MEMBER( mmu_r ); - DECLARE_WRITE8_MEMBER( mmu_w ); - DECLARE_READ16_MEMBER( berr_r ); - DECLARE_WRITE16_MEMBER( berr_w ); - DECLARE_READ8_MEMBER( ikbd_port1_r ); - DECLARE_READ8_MEMBER( ikbd_port2_r ); - DECLARE_WRITE8_MEMBER( ikbd_port2_w ); - DECLARE_WRITE8_MEMBER( ikbd_port3_w ); - DECLARE_READ8_MEMBER( ikbd_port4_r ); - DECLARE_WRITE8_MEMBER( ikbd_port4_w ); - - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - - DECLARE_WRITE8_MEMBER( psg_pa_w ); - - DECLARE_WRITE_LINE_MEMBER( ikbd_tx_w ); - DECLARE_WRITE_LINE_MEMBER( acia_ikbd_irq_w ); - DECLARE_WRITE_LINE_MEMBER( acia_midi_irq_w ); - - DECLARE_READ8_MEMBER( mfp_gpio_r ); - DECLARE_WRITE_LINE_MEMBER( mfp_tdo_w ); - - DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); - - void toggle_dma_fifo(); - void flush_dma_fifo(); - void fill_dma_fifo(); - void fdc_dma_transfer(); - - void configure_memory(); - void state_save(); - - /* memory state */ - UINT8 m_mmu; - - /* keyboard state */ - int m_acia_ikbd_irq; - int m_acia_midi_irq; - UINT16 m_ikbd_keylatch; - UINT8 m_ikbd_mouse; - UINT8 m_ikbd_mouse_x; - UINT8 m_ikbd_mouse_y; - UINT8 m_ikbd_mouse_px; - UINT8 m_ikbd_mouse_py; - UINT8 m_ikbd_mouse_pc; - int m_ikbd_tx; - int m_ikbd_joy; - int m_midi_tx; - - /* floppy state */ - UINT32 m_dma_base; - UINT16 m_dma_error; - UINT16 m_fdc_mode; - UINT8 m_fdc_sectors; - UINT16 m_fdc_fifo[2][8]; - int m_fdc_fifo_sel; - int m_fdc_fifo_index; - int m_fdc_fifo_msb; - int m_fdc_fifo_empty[2]; - int m_fdc_dmabytes; - - /* shifter state */ - UINT32 m_shifter_base; - UINT32 m_shifter_ofs; - UINT8 m_shifter_sync; - UINT8 m_shifter_mode; - UINT16 m_shifter_palette[16]; - UINT16 m_shifter_rr[4]; - UINT16 m_shifter_ir[4]; - int m_shifter_bitplane; - int m_shifter_shift; - int m_shifter_h; - int m_shifter_v; - int m_shifter_de; - int m_shifter_x_start; - int m_shifter_x_end; - int m_shifter_y_start; - int m_shifter_y_end; - int m_shifter_hblank_start; - int m_shifter_vblank_start; - - /* blitter state */ - UINT16 m_blitter_halftone[16]; - INT16 m_blitter_src_inc_x; - INT16 m_blitter_src_inc_y; - INT16 m_blitter_dst_inc_x; - INT16 m_blitter_dst_inc_y; - UINT32 m_blitter_src; - UINT32 m_blitter_dst; - UINT16 m_blitter_endmask1; - UINT16 m_blitter_endmask2; - UINT16 m_blitter_endmask3; - UINT16 m_blitter_xcount; - UINT16 m_blitter_ycount; - UINT16 m_blitter_xcountl; - UINT8 m_blitter_hop; - UINT8 m_blitter_op; - UINT8 m_blitter_ctrl; - UINT8 m_blitter_skew; - UINT32 m_blitter_srcbuf; - - /* timers */ - emu_timer *m_mouse_timer; - emu_timer *m_glue_timer; - emu_timer *m_shifter_timer; - - bitmap_rgb32 m_bitmap; - - floppy_image_device *floppy_devices[2]; - - DECLARE_FLOPPY_FORMATS(floppy_formats); - IRQ_CALLBACK_MEMBER(atarist_int_ack); - - int m_monochrome; - required_device m_palette; - DECLARE_WRITE_LINE_MEMBER( write_monochrome ); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -class megast_state : public st_state -{ -public: - megast_state(const machine_config &mconfig, device_type type, const char *tag) - : st_state(mconfig, type, tag) - { } - - DECLARE_READ16_MEMBER( fpu_r ); - DECLARE_WRITE16_MEMBER( fpu_w ); -}; - -class ste_state : public st_state -{ -public: - enum - { - TIMER_DMASOUND_TICK, - TIMER_MICROWIRE_TICK - }; - - ste_state(const machine_config &mconfig, device_type type, const char *tag) - : st_state(mconfig, type, tag), - m_lmc1992(*this, LMC1992_TAG) - { } - - optional_device m_lmc1992; - - void machine_start(); - - void video_start(); - - DECLARE_READ8_MEMBER( shifter_base_low_r ); - DECLARE_WRITE8_MEMBER( shifter_base_low_w ); - DECLARE_READ8_MEMBER( shifter_counter_r ); - DECLARE_WRITE8_MEMBER( shifter_counter_w ); - DECLARE_WRITE16_MEMBER( shifter_palette_w ); - DECLARE_READ8_MEMBER( shifter_lineofs_r ); - DECLARE_WRITE8_MEMBER( shifter_lineofs_w ); - DECLARE_READ8_MEMBER( shifter_pixelofs_r ); - DECLARE_WRITE8_MEMBER( shifter_pixelofs_w ); - - DECLARE_READ8_MEMBER( sound_dma_control_r ); - DECLARE_READ8_MEMBER( sound_dma_base_r ); - DECLARE_READ8_MEMBER( sound_dma_counter_r ); - DECLARE_READ8_MEMBER( sound_dma_end_r ); - DECLARE_READ8_MEMBER( sound_mode_r ); - DECLARE_WRITE8_MEMBER( sound_dma_control_w ); - DECLARE_WRITE8_MEMBER( sound_dma_base_w ); - DECLARE_WRITE8_MEMBER( sound_dma_end_w ); - DECLARE_WRITE8_MEMBER( sound_mode_w ); - DECLARE_READ16_MEMBER( microwire_data_r ); - DECLARE_WRITE16_MEMBER( microwire_data_w ); - DECLARE_READ16_MEMBER( microwire_mask_r ); - DECLARE_WRITE16_MEMBER( microwire_mask_w ); - - DECLARE_READ8_MEMBER( mfp_gpio_r ); - DECLARE_WRITE_LINE_MEMBER( write_monochrome ); - - void dmasound_set_state(int level); - void dmasound_tick(); - void microwire_shift(); - void microwire_tick(); - void state_save(); - - // shifter state - UINT8 m_shifter_lineofs; - UINT8 m_shifter_pixelofs; - - /* microwire state */ - UINT16 m_mw_data; - UINT16 m_mw_mask; - int m_mw_shift; - - /* DMA sound state */ - UINT32 m_dmasnd_base; - UINT32 m_dmasnd_end; - UINT32 m_dmasnd_cntr; - UINT32 m_dmasnd_baselatch; - UINT32 m_dmasnd_endlatch; - UINT8 m_dmasnd_ctrl; - UINT8 m_dmasnd_mode; - UINT8 m_dmasnd_fifo[8]; - UINT8 m_dmasnd_samples; - int m_dmasnd_active; - - // timers - emu_timer *m_microwire_timer; - emu_timer *m_dmasound_timer; - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -class megaste_state : public ste_state -{ -public: - megaste_state(const machine_config &mconfig, device_type type, const char *tag) - : ste_state(mconfig, type, tag) - { } - - void machine_start(); - - DECLARE_READ16_MEMBER( cache_r ); - DECLARE_WRITE16_MEMBER( cache_w ); - - UINT16 m_cache; -}; - -class stbook_state : public ste_state -{ -public: - stbook_state(const machine_config &mconfig, device_type type, const char *tag) - : ste_state(mconfig, type, tag), - m_sw400(*this, "SW400") - { } - - required_ioport m_sw400; - - void machine_start(); - void video_start(); - - DECLARE_READ16_MEMBER( config_r ); - DECLARE_WRITE16_MEMBER( lcd_control_w ); - - DECLARE_WRITE8_MEMBER( psg_pa_w ); - DECLARE_READ8_MEMBER( mfp_gpio_r ); -}; - -#endif diff --git a/src/mess/includes/atom.h b/src/mess/includes/atom.h deleted file mode 100644 index bd7b2427897..00000000000 --- a/src/mess/includes/atom.h +++ /dev/null @@ -1,169 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -#pragma once - -#ifndef __ATOM__ -#define __ATOM__ - - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" -#include "machine/ram.h" -#include "imagedev/snapquik.h" -#include "formats/atom_tap.h" -#include "formats/atom_dsk.h" -#include "formats/uef_cas.h" -#include "bus/centronics/ctronics.h" -#include "machine/6522via.h" -#include "machine/i8255.h" -#include "machine/i8271.h" -#include "sound/speaker.h" -#include "video/mc6847.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define SY6502_TAG "ic22" -#define INS8255_TAG "ic25" -#define MC6847_TAG "ic31" -#define R6522_TAG "ic1" -#define I8271_TAG "ic13" -#define MC6854_TAG "econet_ic1" -#define SCREEN_TAG "screen" -#define CENTRONICS_TAG "centronics" -#define BASERAM_TAG "baseram" - - -#define X1 XTAL_3_579545MHz // MC6847 Clock -#define X2 XTAL_4MHz // CPU Clock - a divider reduces it to 1MHz - -class atom_state : public driver_device -{ -public: - atom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, SY6502_TAG), - m_vdg(*this, MC6847_TAG), - m_cassette(*this, "cassette"), - m_fdc(*this, I8271_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_speaker(*this, "speaker"), - m_cart(*this, "cartslot"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_rpt(*this, "RPT"), - m_video_ram(*this, "video_ram") - { } - - required_device m_maincpu; - required_device m_vdg; - required_device m_cassette; - optional_device m_fdc; - required_device m_centronics; - required_device m_speaker; - optional_device m_cart; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_rpt; - - virtual void machine_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void bankswitch(); - - DECLARE_WRITE8_MEMBER( ppi_pa_w ); - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_READ8_MEMBER( ppi_pc_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - DECLARE_READ8_MEMBER( vdg_videoram_r ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_WRITE_LINE_MEMBER( atom_8271_interrupt_callback ); - DECLARE_WRITE_LINE_MEMBER( motor_w ); - - /* video state */ - required_shared_ptr m_video_ram; - - /* keyboard state */ - int m_keylatch; - - /* cassette state */ - int m_hz2400; - int m_pc0; - int m_pc1; - - /* devices */ - int m_previous_i8271_int_state; - DECLARE_FLOPPY_FORMATS(floppy_formats); - TIMER_DEVICE_CALLBACK_MEMBER(cassette_output_tick); - - int load_cart(device_image_interface &image, generic_slot_device *slot); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load) { return load_cart(image, m_cart); } - DECLARE_QUICKLOAD_LOAD_MEMBER(atom_atm); -}; - -class atomeb_state : public atom_state -{ -public: - atomeb_state(const machine_config &mconfig, device_type type, const char *tag) - : atom_state(mconfig, type, tag), - m_e0(*this, "rom_e0"), - m_e1(*this, "rom_e1") - { - } - - virtual void machine_start(); - - DECLARE_READ8_MEMBER(eprom_r); - DECLARE_WRITE8_MEMBER(eprom_w); - DECLARE_READ8_MEMBER(ext_r); - DECLARE_READ8_MEMBER(dos_r); - - DECLARE_DRIVER_INIT(atomeb); - - /* eprom state */ - int m_eprom; - - generic_slot_device *m_ext[16]; - required_device m_e0; - required_device m_e1; - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a0_load) { return load_cart(image, m_ext[0x0]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a1_load) { return load_cart(image, m_ext[0x1]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a2_load) { return load_cart(image, m_ext[0x2]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a3_load) { return load_cart(image, m_ext[0x3]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a4_load) { return load_cart(image, m_ext[0x4]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a5_load) { return load_cart(image, m_ext[0x5]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a6_load) { return load_cart(image, m_ext[0x6]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a7_load) { return load_cart(image, m_ext[0x7]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a8_load) { return load_cart(image, m_ext[0x8]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(a9_load) { return load_cart(image, m_ext[0x9]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(aa_load) { return load_cart(image, m_ext[0xa]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ab_load) { return load_cart(image, m_ext[0xb]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ac_load) { return load_cart(image, m_ext[0xc]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ad_load) { return load_cart(image, m_ext[0xd]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ae_load) { return load_cart(image, m_ext[0xe]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(af_load) { return load_cart(image, m_ext[0xf]); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(e0_load) { return load_cart(image, m_e0); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(e1_load) { return load_cart(image, m_e1); } -}; - -#endif diff --git a/src/mess/includes/aussiebyte.h b/src/mess/includes/aussiebyte.h deleted file mode 100644 index 0f798e1a99f..00000000000 --- a/src/mess/includes/aussiebyte.h +++ /dev/null @@ -1,126 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert - -/*********************************************************** - - Includes - -************************************************************/ -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "machine/z80dma.h" -#include "bus/centronics/ctronics.h" -#include "sound/speaker.h" -#include "sound/votrax.h" -#include "video/mc6845.h" -#include "bus/rs232/rs232.h" -#include "machine/wd_fdc.h" -#include "machine/msm5832.h" - - -/*********************************************************** - - Class - -************************************************************/ -class aussiebyte_state : public driver_device -{ -public: - aussiebyte_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_ctc(*this, "ctc") - , m_dma(*this, "dma") - , m_pio1(*this, "pio1") - , m_pio2(*this, "pio2") - , m_sio1(*this, "sio1") - , m_sio2(*this, "sio2") - , m_centronics(*this, "centronics") - , m_rs232(*this, "rs232") - , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - , m_crtc(*this, "crtc") - , m_speaker(*this, "speaker") - , m_votrax(*this, "votrax") - {} - - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE8_MEMBER(port15_w); - DECLARE_WRITE8_MEMBER(port16_w); - DECLARE_WRITE8_MEMBER(port17_w); - DECLARE_WRITE8_MEMBER(port18_w); - DECLARE_READ8_MEMBER(port19_r); - DECLARE_WRITE8_MEMBER(port1a_w); - DECLARE_WRITE8_MEMBER(port1b_w); - DECLARE_WRITE8_MEMBER(port1c_w); - DECLARE_WRITE8_MEMBER(port20_w); - DECLARE_READ8_MEMBER(port28_r); - DECLARE_READ8_MEMBER(port33_r); - DECLARE_WRITE8_MEMBER(port34_w); - DECLARE_WRITE8_MEMBER(port35_w); - DECLARE_READ8_MEMBER(port36_r); - DECLARE_READ8_MEMBER(port37_r); - DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - DECLARE_WRITE_LINE_MEMBER(busreq_w); - DECLARE_WRITE_LINE_MEMBER(votrax_w); - DECLARE_WRITE_LINE_MEMBER(sio1_rdya_w); - DECLARE_WRITE_LINE_MEMBER(sio1_rdyb_w); - DECLARE_WRITE_LINE_MEMBER(sio2_rdya_w); - DECLARE_WRITE_LINE_MEMBER(sio2_rdyb_w); - DECLARE_MACHINE_RESET(aussiebyte); - DECLARE_DRIVER_INIT(aussiebyte); - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); - DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); - DECLARE_WRITE8_MEMBER(address_w); - DECLARE_WRITE8_MEMBER(register_w); - MC6845_UPDATE_ROW(crtc_update_row); - MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); - int m_centronics_busy; - required_device m_palette; - -private: - UINT8 crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16 ac_cnt, bool ac_curs); - bool m_port15; // rom switched in (0), out (1) - UINT8 m_port17; - UINT8 m_port17_rdy; - UINT8 m_port19; - UINT8 m_port1a; // bank to switch to when write to port 15 happens - UINT8 m_port28; - UINT8 m_port34; - UINT8 m_port35; // byte to be written to vram or aram - UINT8 m_video_index; - UINT16 m_cnt; - UINT8 *m_p_videoram; - UINT8 *m_p_attribram; - const UINT8 *m_p_chargen; - UINT16 m_alpha_address; - UINT16 m_graph_address; - required_device m_maincpu; - required_device m_ctc; - required_device m_dma; - required_device m_pio1; - required_device m_pio2; - required_device m_sio1; - required_device m_sio2; - required_device m_centronics; - required_device m_rs232; - required_device m_fdc; - required_device m_floppy0; - optional_device m_floppy1; - required_device m_crtc; - required_device m_speaker; - required_device m_votrax; -}; diff --git a/src/mess/includes/avigo.h b/src/mess/includes/avigo.h deleted file mode 100644 index b06dab92c65..00000000000 --- a/src/mess/includes/avigo.h +++ /dev/null @@ -1,116 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/***************************************************************************** - * - * includes/avigo.h - * - ****************************************************************************/ - -#ifndef AVIGO_H_ -#define AVIGO_H_ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "machine/rp5c01.h" -#include "machine/ins8250.h" -#include "machine/intelfsh.h" -#include "machine/nvram.h" -#include "sound/speaker.h" -#include "machine/ram.h" -#include "imagedev/snapquik.h" - -#define AVIGO_NUM_COLOURS 2 - -#define AVIGO_SCREEN_WIDTH 160 -#define AVIGO_SCREEN_HEIGHT 240 -#define AVIGO_PANEL_HEIGHT 26 - - -class avigo_state : public driver_device -{ -public: - avigo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_speaker(*this, "speaker"), - m_uart(*this, "ns16550"), - m_serport(*this, "serport"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_speaker; - required_device m_uart; - required_device m_serport; - required_device m_palette; - - // defined in drivers/avigo.c - virtual void machine_start(); - virtual void machine_reset(); - void postload(); - void refresh_memory(UINT8 bank, UINT8 chip_select); - void refresh_ints(); - void nvram_init(nvram_device &nvram, void *base, size_t size); - - DECLARE_WRITE_LINE_MEMBER( tc8521_alarm_int ); - DECLARE_WRITE_LINE_MEMBER( com_interrupt ); - - DECLARE_READ8_MEMBER(flash_0x0000_read_handler); - DECLARE_WRITE8_MEMBER(flash_0x0000_write_handler); - DECLARE_READ8_MEMBER(flash_0x4000_read_handler); - DECLARE_WRITE8_MEMBER(flash_0x4000_write_handler); - DECLARE_READ8_MEMBER(flash_0x8000_read_handler); - DECLARE_WRITE8_MEMBER(flash_0x8000_write_handler); - - DECLARE_READ8_MEMBER(key_data_read_r); - DECLARE_WRITE8_MEMBER(set_key_line_w); - DECLARE_WRITE8_MEMBER(port2_w); - DECLARE_READ8_MEMBER(irq_r); - DECLARE_WRITE8_MEMBER(irq_w); - DECLARE_READ8_MEMBER(bank1_r); - DECLARE_READ8_MEMBER(bank2_r); - DECLARE_WRITE8_MEMBER(bank1_w); - DECLARE_WRITE8_MEMBER(bank2_w); - DECLARE_READ8_MEMBER(ad_control_status_r); - DECLARE_WRITE8_MEMBER(ad_control_status_w); - DECLARE_READ8_MEMBER(ad_data_r); - DECLARE_WRITE8_MEMBER(speaker_w); - DECLARE_READ8_MEMBER(port_04_r); - - DECLARE_INPUT_CHANGED_MEMBER(pen_irq); - DECLARE_INPUT_CHANGED_MEMBER(pen_move_irq); - DECLARE_INPUT_CHANGED_MEMBER(kb_irq); - DECLARE_INPUT_CHANGED_MEMBER(power_down_irq); - - // defined in video/avigo.c - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER(vid_memory_r); - DECLARE_WRITE8_MEMBER(vid_memory_w); - - // driver state - UINT8 m_key_line; - UINT8 m_irq; - UINT8 m_port2; - UINT8 m_bank2_l; - UINT8 m_bank2_h; - UINT8 m_bank1_l; - UINT8 m_bank1_h; - UINT8 m_ad_control_status; - intelfsh8_device * m_flashes[3]; - int m_flash_at_0x4000; - int m_flash_at_0x8000; - UINT16 m_ad_value; - UINT8 * m_video_memory; - UINT8 m_screen_column; - UINT8 m_warm_start; - UINT8 * m_ram_base; - DECLARE_PALETTE_INIT(avigo); - TIMER_DEVICE_CALLBACK_MEMBER(avigo_scan_timer); - TIMER_DEVICE_CALLBACK_MEMBER(avigo_1hz_timer); - - DECLARE_QUICKLOAD_LOAD_MEMBER( avigo); -}; -#endif /* AVIGO_H_ */ diff --git a/src/mess/includes/b2m.h b/src/mess/includes/b2m.h deleted file mode 100644 index 86bd3162114..00000000000 --- a/src/mess/includes/b2m.h +++ /dev/null @@ -1,81 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/b2m.h - * - ****************************************************************************/ - -#ifndef B2M_H_ -#define B2M_H_ - -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/wd_fdc.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "machine/ram.h" - -class b2m_state : public driver_device -{ -public: - b2m_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_pit(*this, "pit8253"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") { } - - UINT8 m_b2m_8255_porta; - UINT8 m_b2m_video_scroll; - UINT8 m_b2m_8255_portc; - - UINT8 m_b2m_video_page; - UINT8 m_b2m_drive; - UINT8 m_b2m_side; - - UINT8 m_b2m_romdisk_lsb; - UINT8 m_b2m_romdisk_msb; - - UINT8 m_b2m_color[4]; - UINT8 m_b2m_localmachine; - UINT8 m_vblank_state; - required_device m_maincpu; - required_device m_speaker; - required_device m_pit; - required_device m_ram; - required_device m_palette; - - /* devices */ - fd1793_t *m_fdc; - pic8259_device *m_pic; - DECLARE_READ8_MEMBER(b2m_keyboard_r); - DECLARE_WRITE8_MEMBER(b2m_palette_w); - DECLARE_READ8_MEMBER(b2m_palette_r); - DECLARE_WRITE8_MEMBER(b2m_localmachine_w); - DECLARE_READ8_MEMBER(b2m_localmachine_r); - DECLARE_DRIVER_INIT(b2m); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(b2m); - UINT32 screen_update_b2m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(b2m_vblank_interrupt); - DECLARE_WRITE_LINE_MEMBER(bm2_pit_out1); - DECLARE_WRITE8_MEMBER(b2m_8255_porta_w); - DECLARE_WRITE8_MEMBER(b2m_8255_portb_w); - DECLARE_WRITE8_MEMBER(b2m_8255_portc_w); - DECLARE_READ8_MEMBER(b2m_8255_portb_r); - DECLARE_WRITE8_MEMBER(b2m_ext_8255_portc_w); - DECLARE_READ8_MEMBER(b2m_romdisk_porta_r); - DECLARE_WRITE8_MEMBER(b2m_romdisk_portb_w); - DECLARE_WRITE8_MEMBER(b2m_romdisk_portc_w); - DECLARE_WRITE_LINE_MEMBER(b2m_fdc_drq); - DECLARE_FLOPPY_FORMATS( b2m_floppy_formats ); - void b2m_postload(); - void b2m_set_bank(int bank); -}; - -#endif diff --git a/src/mess/includes/banctec.h b/src/mess/includes/banctec.h deleted file mode 100644 index 5a048ee6680..00000000000 --- a/src/mess/includes/banctec.h +++ /dev/null @@ -1,38 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Felipe Sanches -/***************************************************************************** - * - * includes/banctec.h - * - ****************************************************************************/ - -#ifndef BANCTEC_H_ -#define BANCTEC_H_ - -#include "video/mc6845.h" - -class banctec_state : public driver_device -{ -public: - banctec_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_videoram(*this, "videoram") { } - - DECLARE_READ8_MEMBER(banctec_read); - DECLARE_WRITE8_MEMBER(banctec_write); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_banctec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - required_device m_maincpu; - required_device m_gfxdecode; - required_shared_ptr m_videoram; - - tilemap_t *m_bg_tilemap; -}; - -#endif /* BANCTEC_H_ */ diff --git a/src/mess/includes/bbc.h b/src/mess/includes/bbc.h deleted file mode 100644 index 5b8e56d25e5..00000000000 --- a/src/mess/includes/bbc.h +++ /dev/null @@ -1,439 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Gordon Jefferyes, Nigel Barnes -/***************************************************************************** - * - * includes/bbc.h - * - * BBC Model B - * - * Driver by Gordon Jefferyes - * - ****************************************************************************/ - -#ifndef BBC_H_ -#define BBC_H_ - -#include "bus/rs232/rs232.h" -#include "machine/6522via.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "machine/mc6854.h" -#include "machine/ram.h" -#include "machine/i8271.h" -#include "machine/wd_fdc.h" -#include "machine/upd7002.h" -#include "machine/mc146818.h" -#include "video/mc6845.h" -#include "video/saa5050.h" -#include "sound/sn76496.h" -#include "sound/tms5220.h" -#include "imagedev/cassette.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define RS232_TAG "rs232" - -class bbc_state : public driver_device -{ -public: - bbc_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_mc6845(*this, "mc6845"), - m_adlc(*this, "mc6854"), - m_sn(*this, "sn76489"), - m_trom(*this, "saa5050"), - m_tms(*this, "tms5220"), - m_cassette(*this, "cassette"), - m_acia(*this, "acia6850"), - m_acia_clock(*this, "acia_clock"), - m_rs232(*this, RS232_TAG), - m_via6522_0(*this, "via6522_0"), - m_via6522_1(*this, "via6522_1"), - m_upd7002(*this, "upd7002"), - m_rtc(*this, "rtc"), - m_i8271(*this, "i8271"), - m_wd1770(*this, "wd1770"), - m_wd1772(*this, "wd1772"), - m_exp1(*this, "exp_rom1"), - m_exp2(*this, "exp_rom2"), - m_exp3(*this, "exp_rom3"), - m_exp4(*this, "exp_rom4"), - m_joy0(*this, "JOY0"), - m_joy1(*this, "JOY1"), - m_joy2(*this, "JOY2"), - m_joy3(*this, "JOY3"), - m_region_maincpu(*this, "maincpu"), - m_region_os(*this, "os"), - m_region_opt(*this, "option"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_bank5(*this, "bank5"), - m_bank6(*this, "bank6"), - m_bank7(*this, "bank7"), - m_bank8(*this, "bank8"), - m_ACCCON_IRR(CLEAR_LINE), - m_via_system_irq(CLEAR_LINE), - m_via_user_irq(CLEAR_LINE), - m_acia_irq(CLEAR_LINE), - m_palette(*this, "palette") - { } - - DECLARE_FLOPPY_FORMATS(floppy_formats_525sd); - DECLARE_FLOPPY_FORMATS(floppy_formats_525dd); - DECLARE_FLOPPY_FORMATS(floppy_formats_35dd); - - DECLARE_WRITE8_MEMBER(bbc_page_selecta_w); - DECLARE_WRITE8_MEMBER(bbc_memorya1_w); - DECLARE_WRITE8_MEMBER(bbc_page_selectb_w); - DECLARE_WRITE8_MEMBER(bbc_memoryb3_w); - DECLARE_WRITE8_MEMBER(bbc_memoryb4_w); - DECLARE_WRITE8_MEMBER(bbc_page_selectbp_w); - DECLARE_WRITE8_MEMBER(bbc_memorybp1_w); - DECLARE_WRITE8_MEMBER(bbc_memorybp2_w); - DECLARE_WRITE8_MEMBER(bbc_memorybp4_w); - DECLARE_WRITE8_MEMBER(bbc_memorybp4_128_w); - DECLARE_WRITE8_MEMBER(bbc_memorybp6_128_w); - DECLARE_READ8_MEMBER(bbcm_ACCCON_read); - DECLARE_WRITE8_MEMBER(bbcm_ACCCON_write); - DECLARE_WRITE8_MEMBER(page_selectbm_w); - DECLARE_WRITE8_MEMBER(bbc_memorybm1_w); - DECLARE_WRITE8_MEMBER(bbc_memorybm2_w); - DECLARE_WRITE8_MEMBER(bbc_memorybm4_w); - DECLARE_WRITE8_MEMBER(bbc_memorybm5_w); - DECLARE_WRITE8_MEMBER(bbc_memorybm7_w); - DECLARE_READ8_MEMBER(bbcm_r); - DECLARE_WRITE8_MEMBER(bbcm_w); - DECLARE_WRITE8_MEMBER(bbc_SerialULA_w); - - DECLARE_WRITE8_MEMBER(bbc_wd1770_status_w); - DECLARE_READ8_MEMBER(bbcm_wd177xl_read); - DECLARE_WRITE8_MEMBER(bbcm_wd1770l_write); - DECLARE_WRITE8_MEMBER(bbcm_wd1772l_write); - DECLARE_WRITE8_MEMBER(bbc_videoULA_w); - DECLARE_READ8_MEMBER(bbc_fe_r); - DECLARE_DIRECT_UPDATE_MEMBER(bbcbp_direct_handler); - DECLARE_DIRECT_UPDATE_MEMBER(bbcm_direct_handler); - - DECLARE_DRIVER_INIT(bbc); - - DECLARE_MACHINE_START(bbca); - DECLARE_MACHINE_RESET(bbca); - DECLARE_VIDEO_START(bbca); - - DECLARE_MACHINE_START(bbcb); - DECLARE_MACHINE_RESET(bbcb); - DECLARE_VIDEO_START(bbcb); - - DECLARE_MACHINE_START(bbcbp); - DECLARE_MACHINE_RESET(bbcbp); - DECLARE_VIDEO_START(bbcbp); - - DECLARE_MACHINE_START(bbcm); - DECLARE_MACHINE_RESET(bbcm); - DECLARE_VIDEO_START(bbcm); - - DECLARE_PALETTE_INIT(bbc); - UINT32 screen_update_bbc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(bbcb_vsync); - INTERRUPT_GEN_MEMBER(bbcb_keyscan); - INTERRUPT_GEN_MEMBER(bbcm_keyscan); - TIMER_CALLBACK_MEMBER(bbc_tape_timer_cb); - DECLARE_WRITE_LINE_MEMBER(write_acia_clock); - DECLARE_WRITE_LINE_MEMBER(bbcb_acia6850_irq_w); - DECLARE_WRITE_LINE_MEMBER(econet_clk_w); - DECLARE_WRITE8_MEMBER(bbcb_via_system_write_porta); - DECLARE_WRITE8_MEMBER(bbcb_via_system_write_portb); - DECLARE_READ8_MEMBER(bbcb_via_system_read_porta); - DECLARE_READ8_MEMBER(bbcb_via_system_read_portb); - DECLARE_WRITE_LINE_MEMBER(bbcb_via_system_irq_w); - DECLARE_READ8_MEMBER(bbcb_via_user_read_portb); - DECLARE_WRITE8_MEMBER(bbcb_via_user_write_portb); - DECLARE_WRITE_LINE_MEMBER(bbcb_via_user_irq_w); - DECLARE_WRITE_LINE_MEMBER(bbc_wd177x_intrq_w); - DECLARE_WRITE_LINE_MEMBER(bbc_wd177x_drq_w); - DECLARE_WRITE_LINE_MEMBER(bbc_vsync); - void update_acia_rxd(); - void update_acia_dcd(); - void update_acia_cts(); - DECLARE_WRITE_LINE_MEMBER(bbc_rts_w); - DECLARE_WRITE_LINE_MEMBER(bbc_txd_w); - DECLARE_WRITE_LINE_MEMBER(write_rxd_serial); - DECLARE_WRITE_LINE_MEMBER(write_dcd_serial); - DECLARE_WRITE_LINE_MEMBER(write_cts_serial); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_WRITE_LINE_MEMBER(bbc_i8271_interrupt); - DECLARE_WRITE_LINE_MEMBER(motor_w); - - UPD7002_GET_ANALOGUE(BBC_get_analogue_input); - UPD7002_EOC(BBC_uPD7002_EOC); - - void bbc_setup_banks(memory_bank *membank, int banks, UINT32 shift, UINT32 size); - void bbcm_setup_banks(memory_bank *membank, int banks, UINT32 shift, UINT32 size); - - int bbc_load_cart(device_image_interface &image, generic_slot_device *slot); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp1_load) { return bbc_load_cart(image, m_exp1); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp2_load) { return bbc_load_cart(image, m_exp2); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp3_load) { return bbc_load_cart(image, m_exp3); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp4_load) { return bbc_load_cart(image, m_exp4); } - - int bbcm_load_cart(device_image_interface &image, generic_slot_device *slot); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(bbcm_exp1_load) { return bbcm_load_cart(image, m_exp1); } - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(bbcm_exp2_load) { return bbcm_load_cart(image, m_exp2); } - - MC6845_UPDATE_ROW(crtc_update_row); - -private: - required_device m_maincpu; - required_device m_ram; - required_device m_mc6845; - optional_device m_adlc; - optional_device m_sn; -public: // HACK FOR MC6845 - optional_device m_trom; - optional_device m_tms; - optional_device m_cassette; - optional_device m_acia; - optional_device m_acia_clock; - optional_device m_rs232; - required_device m_via6522_0; - optional_device m_via6522_1; - optional_device m_upd7002; - optional_device m_rtc; - optional_device m_i8271; - optional_device m_wd1770; - optional_device m_wd1772; - required_device m_exp1; - required_device m_exp2; - optional_device m_exp3; - optional_device m_exp4; - optional_ioport m_joy0, m_joy1, m_joy2, m_joy3; - - required_memory_region m_region_maincpu; - required_memory_region m_region_os; - required_memory_region m_region_opt; - required_memory_bank m_bank1; // bbca bbcb bbcbp bbcbp128 bbcm - optional_memory_bank m_bank2; // bbcbp bbcbp128 bbcm - optional_memory_bank m_bank3; // bbca bbcb - required_memory_bank m_bank4; // bbca bbcb bbcbp bbcbp128 bbcm - optional_memory_bank m_bank5; // bbcm - optional_memory_bank m_bank6; // bbcbp bbcbp128 - required_memory_bank m_bank7; // bbca bbcb bbcbp bbcbp128 bbcm - optional_memory_bank m_bank8; // bbcm - - void check_interrupts(); - - int m_SWRAMtype; // this stores the DIP switch setting for the SWRAM type being used - int m_Speech; // this stores the CONF setting for Speech enabled/disabled - - int m_ACCCON_IRR; // IRQ inputs - - int m_rombank; // This is the latch that holds the sideways ROM bank to read - - int m_userport; // This stores the sideways RAM latch type. - // Acorn and others use the bbc_rombank latch to select the write bank to be used.(type 0) - // Solidisc use the BBC's userport to select the write bank to be used (type 1) - - int m_pagedRAM; // BBC B+ memory handling - int m_vdusel; // BBC B+ memory handling - - /* - ACCCON - - b7 IRR 1=Causes an IRQ to the processor - b6 TST 1=Selects &FC00-&FEFF read from OS-ROM - b5 IFJ 1=Internal 1 MHz bus - 0=External 1MHz bus - b4 ITU 1=Internal Tube - 0=External Tube - b3 Y 1=Read/Write HAZEL &C000-&DFFF RAM - 0=Read/Write ROM &C000-&DFFF OS-ROM - b2 X 1=Read/Write LYNNE - 0=Read/WRITE main memory &3000-&8000 - b1 E 1=Causes shadow if VDU code - 0=Main all the time - b0 D 1=Display LYNNE as screen - 0=Display main RAM screen - - ACCCON is a read/write register - */ - - int m_ACCCON; - int m_ACCCON_TST; - int m_ACCCON_IFJ; - int m_ACCCON_ITU; - int m_ACCCON_Y; - int m_ACCCON_X; - int m_ACCCON_E; - int m_ACCCON_D; - - - /* - The addressable latch - This 8 bit addressable latch is operated from port B lines 0-3. - PB0-PB2 are set to the required address of the output bit to be set. - PB3 is set to the value which should be programmed at that bit. - The function of the 8 output bits from this latch are:- - - B0 - Write Enable to the sound generator IC - B1 - READ select on the speech processor - B2 - WRITE select on the speech processor - B3 - Keyboard write enable - B4,B5 - these two outputs define the number to be added to the - start of screen address in hardware to control hardware scrolling:- - Mode Size Start of screen Number to add B5 B4 - 0,1,2 20K &3000 12K 1 1 - 3 16K &4000 16K 0 0 - 4,5 10K &5800 (or &1800) 22K 1 0 - 6 8K &6000 (or &2000) 24K 0 1 - B6 - Operates the CAPS lock LED (Pin 17 keyboard connector) - B7 - Operates the SHIFT lock LED (Pin 16 keyboard connector) - */ - - int m_b0_sound; - int m_b1_speech_read; - int m_b2_speech_write; - int m_b3_keyboard; - int m_b4_video0; - int m_b5_video1; - int m_b6_caps_lock_led; - int m_b7_shift_lock_led; - - int m_MC146818_WR; // FE30 bit 1 replaces b1_speech_read - int m_MC146818_DS; // FE30 bit 2 replaces b2_speech_write - int m_MC146818_AS; // 6522 port b bit 7 - int m_MC146818_CE; // 6522 port b bit 6 - - int m_via_system_porta; - int m_via_system_irq; - int m_via_user_irq; - int m_acia_irq; - - int m_column; // this is a counter in the keyboard circuit - - - /*************************************** - BBC 2C199 Serial Interface Cassette - ****************************************/ - - double m_last_dev_val; - int m_wav_len; - int m_len0; - int m_len1; - int m_len2; - int m_len3; - int m_mc6850_clock; - UINT8 m_serproc_data; - int m_rxd_serial; - int m_dcd_serial; - int m_cts_serial; - int m_dcd_cass; - int m_rxd_cass; - int m_cass_out_enabled; - int m_txd; - UINT32 m_nr_high_tones; - int m_cass_out_samples_to_go; - int m_cass_out_bit; - int m_cass_out_phase; - emu_timer *m_tape_timer; - - - /************************************** - i8271 disc control - ***************************************/ - - int m_previous_i8271_int_state; // 8271 interrupt status - - /************************************** - WD1770 disc control - ***************************************/ - - int m_drive_control; - int m_wd177x_irq_state; - int m_wd177x_drq_state; - int m_previous_wd177x_int_state; - int m_177x_IntEnabled; - - /************************************** - Video Code - ***************************************/ - - int m_memorySize; - - -// this is the real location of the start of the BBC's ram in the emulation -// it can be changed if shadow ram is being used to point at the upper 32K of RAM - -// this is the screen memory location of the next pixels to be drawn - -// this is a more global variable to store the bitmap variable passed in in the bbc_vh_screenrefresh function - -// this is the X and Y screen location in emulation pixels of the next pixels to be drawn - - - unsigned char *m_BBC_Video_RAM; - UINT16 *m_BBC_display; - UINT16 *m_BBC_display_left; - UINT16 *m_BBC_display_right; - bitmap_ind16 *m_BBC_bitmap; - int m_y_screen_pos; - unsigned char m_pixel_bits[256]; - int m_BBC_HSync; - int m_BBC_VSync; - - - int m_Teletext_Latch; - int m_VideoULA_CR; - int m_VideoULA_CR_counter; - int m_videoULA_Reg; - int m_videoULA_master_cursor_size; - int m_videoULA_width_of_cursor; - int m_videoULA_6845_clock_rate; - int m_videoULA_characters_per_line; - int m_videoULA_teletext_normal_select; - int m_videoULA_flash_colour_select; - - - int m_pixels_per_byte; - int m_emulation_pixels_per_real_pixel; - int m_emulation_pixels_per_byte; - - int m_emulation_cursor_size; - int m_cursor_state; - - int m_videoULA_pallet0[16]; - int m_videoULA_pallet1[16]; - int *m_videoULA_pallet_lookup; - - void (*m_draw_function)(running_machine &machine); - - void bbcbp_setvideoshadow(int vdusel); - void common_init(int memorySize); - void set_pixel_lookup(); - void set_cursor(bbc_state *state); - void BBC_Clock_CR(bbc_state *state); - void BBC_draw_teletext(); - void BBC_ula_drawpixel(bbc_state *state, int col, int number_of_pixels); - void BBC_draw_hi_res(); - void BBC_Set_HSync(int offset, int data); - void BBC_Set_VSync(int offset, int data); - void BBC_Set_CRE(int offset, int data); - void bbc_frameclock(); - int vdudriverset(); - int bbcm_vdudriverset(); - int bbc_keyboard(address_space &space, int data); - void bbcb_IC32_initialise(bbc_state *state); - void MC146818_set(address_space &space); - void bbc_TMSint(int status); - void MC6850_Receive_Clock(int new_clock); - void BBC_Cassette_motor(unsigned char status); - void bbc_update_fdq_int(int state); - unsigned int calculate_video_address(int ma,int ra); - required_device m_palette; -}; - -#endif /* BBC_H_ */ diff --git a/src/mess/includes/bebox.h b/src/mess/includes/bebox.h deleted file mode 100644 index d9909a67b44..00000000000 --- a/src/mess/includes/bebox.h +++ /dev/null @@ -1,136 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, R. Belmont -/***************************************************************************** - * - * includes/bebox.h - * - * BeBox - * - ****************************************************************************/ - -#ifndef BEBOX_H_ -#define BEBOX_H_ - -#include "emu.h" -#include "machine/53c810.h" -#include "machine/am9517a.h" -#include "machine/idectrl.h" -#include "machine/ins8250.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "machine/upd765.h" -#include "machine/intelfsh.h" -#include "bus/lpci/pci.h" - - -class bebox_state : public driver_device -{ -public: - enum - { - TIMER_GET_DEVICES - }; - - bebox_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_ppc1(*this, "ppc1"), - m_ppc2(*this, "ppc2"), - m_lsi53c810(*this, "lsi53c810"), - m_dma8237_1(*this, "dma8237_1"), - m_dma8237_2(*this, "dma8237_2"), - m_pic8259_1(*this, "pic8259_1"), - m_pic8259_2(*this, "pic8259_2"), - m_pit8254(*this, "pit8254"), - m_ram(*this, RAM_TAG), - m_smc37c78(*this, "smc37c78"), - m_flash(*this, "flash"), - m_pcibus(*this, "pcibus") - { - } - - required_device m_ppc1; - required_device m_ppc2; - required_device m_lsi53c810; - required_device m_dma8237_1; - required_device m_dma8237_2; - required_device m_pic8259_1; - required_device m_pic8259_2; - required_device m_pit8254; - required_device m_ram; - required_device m_smc37c78; - required_device m_flash; - required_device m_pcibus; - UINT32 m_cpu_imask[2]; - UINT32 m_interrupts; - UINT32 m_crossproc_interrupts; - int m_dma_channel; - UINT16 m_dma_offset[2][4]; - UINT8 m_at_pages[0x10]; - UINT32 m_scsi53c810_data[0x100 / 4]; - DECLARE_DRIVER_INIT(bebox); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_WRITE_LINE_MEMBER(bebox_pic8259_master_set_int_line); - DECLARE_WRITE_LINE_MEMBER(bebox_pic8259_slave_set_int_line); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE_LINE_MEMBER(bebox_dma_hrq_changed); - DECLARE_READ8_MEMBER(bebox_dma8237_fdc_dack_r); - DECLARE_WRITE8_MEMBER(bebox_dma8237_fdc_dack_w); - DECLARE_WRITE_LINE_MEMBER(bebox_dma8237_out_eop); - DECLARE_WRITE_LINE_MEMBER(pc_dack0_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack1_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack2_w); - DECLARE_WRITE_LINE_MEMBER(pc_dack3_w); - DECLARE_WRITE_LINE_MEMBER(bebox_timer0_w); - DECLARE_READ64_MEMBER(bebox_cpu0_imask_r); - DECLARE_READ64_MEMBER(bebox_cpu1_imask_r); - DECLARE_READ64_MEMBER(bebox_interrupt_sources_r); - DECLARE_READ64_MEMBER(bebox_crossproc_interrupts_r); - DECLARE_READ64_MEMBER(bebox_interrupt_ack_r); - DECLARE_READ8_MEMBER(bebox_page_r); - DECLARE_READ8_MEMBER(bebox_80000480_r); - DECLARE_READ8_MEMBER(bebox_flash_r); - - DECLARE_WRITE64_MEMBER(bebox_cpu0_imask_w); - DECLARE_WRITE64_MEMBER(bebox_cpu1_imask_w); - DECLARE_WRITE64_MEMBER(bebox_crossproc_interrupts_w); - DECLARE_WRITE64_MEMBER(bebox_processor_resets_w); - DECLARE_WRITE8_MEMBER(bebox_800001F0_w); - DECLARE_WRITE64_MEMBER(bebox_800003F0_w); - DECLARE_WRITE8_MEMBER(bebox_page_w); - DECLARE_WRITE8_MEMBER(bebox_80000480_w); - DECLARE_WRITE8_MEMBER(bebox_flash_w); - DECLARE_READ8_MEMBER(at_dma8237_1_r); - DECLARE_WRITE8_MEMBER(at_dma8237_1_w); - DECLARE_READ8_MEMBER(bebox_dma_read_byte); - DECLARE_WRITE8_MEMBER(bebox_dma_write_byte); - DECLARE_READ64_MEMBER(scsi53c810_r); - DECLARE_WRITE64_MEMBER(scsi53c810_w); - DECLARE_READ64_MEMBER(bb_slave_64be_r); - - DECLARE_WRITE_LINE_MEMBER(bebox_ide_interrupt); - - DECLARE_WRITE_LINE_MEMBER(bebox_keyboard_interrupt); - - DECLARE_WRITE_LINE_MEMBER( fdc_interrupt ); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - LSI53C810_FETCH_CB(scsi_fetch); - LSI53C810_IRQ_CB(scsi_irq_callback); - LSI53C810_DMA_CB(scsi_dma_callback); - - void bebox_set_irq_bit(unsigned int interrupt_bit, int val); - void bebox_update_interrupts(); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -/*----------- defined in machine/bebox.c -----------*/ - -UINT32 scsi53c810_pci_read(device_t *busdevice, device_t *device, int function, int offset, UINT32 mem_mask); -void scsi53c810_pci_write(device_t *busdevice, device_t *device, int function, int offset, UINT32 data, UINT32 mem_mask); - -#endif /* BEBOX_H_ */ diff --git a/src/mess/includes/bk.h b/src/mess/includes/bk.h deleted file mode 100644 index c40b6078e56..00000000000 --- a/src/mess/includes/bk.h +++ /dev/null @@ -1,50 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/bk.h - * - ****************************************************************************/ - -#ifndef BK_H_ -#define BK_H_ -#include "imagedev/cassette.h" - -class bk_state : public driver_device -{ -public: - bk_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_bk0010_video_ram(*this, "video_ram"), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette") { } - - UINT16 m_scrool; - required_shared_ptr m_bk0010_video_ram; - UINT16 m_kbd_state; - UINT16 m_key_code; - UINT16 m_key_pressed; - UINT16 m_key_irq_vector; - UINT16 m_drive; - DECLARE_READ16_MEMBER(bk_key_state_r); - DECLARE_READ16_MEMBER(bk_key_code_r); - DECLARE_READ16_MEMBER(bk_vid_scrool_r); - DECLARE_READ16_MEMBER(bk_key_press_r); - DECLARE_WRITE16_MEMBER(bk_key_state_w); - DECLARE_WRITE16_MEMBER(bk_vid_scrool_w); - DECLARE_WRITE16_MEMBER(bk_key_press_w); - DECLARE_READ16_MEMBER(bk_floppy_cmd_r); - DECLARE_WRITE16_MEMBER(bk_floppy_cmd_w); - DECLARE_READ16_MEMBER(bk_floppy_data_r); - DECLARE_WRITE16_MEMBER(bk_floppy_data_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_bk0010(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(keyboard_callback); - IRQ_CALLBACK_MEMBER(bk0010_irq_callback); - required_device m_maincpu; - required_device m_cassette; -}; - -#endif /* BK_H_ */ diff --git a/src/mess/includes/bullet.h b/src/mess/includes/bullet.h deleted file mode 100644 index 390aac07ad8..00000000000 --- a/src/mess/includes/bullet.h +++ /dev/null @@ -1,184 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __BULLET__ -#define __BULLET__ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "bus/centronics/ctronics.h" -#include "machine/ram.h" -#include "bus/scsi/scsi.h" -#include "machine/wd_fdc.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/z80dma.h" -#include "machine/z80pio.h" - -#define Z80_TAG "u20" -#define Z80CTC_TAG "u1" -#define Z80DMA_TAG "u50" -#define Z80DART_TAG "u45" -#define Z80PIO_TAG "z80pio" -#define MB8877_TAG "u55" -#define CENTRONICS_TAG "centronics" -#define SCSIBUS_TAG "scsi" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" - -class bullet_state : public driver_device -{ -public: - bullet_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ctc(*this, Z80CTC_TAG), - m_dart(*this, Z80DART_TAG), - m_dmac(*this, Z80DMA_TAG), - m_fdc(*this, MB8877_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, MB8877_TAG":0"), - m_floppy1(*this, MB8877_TAG":1"), - m_floppy2(*this, MB8877_TAG":2"), - m_floppy3(*this, MB8877_TAG":3"), - m_floppy4(*this, MB8877_TAG":4"), - m_floppy5(*this, MB8877_TAG":5"), - m_floppy6(*this, MB8877_TAG":6"), - m_floppy7(*this, MB8877_TAG":7"), - m_floppy(NULL), - m_centronics(*this, CENTRONICS_TAG), - m_rom(*this, Z80_TAG), - m_sw1(*this, "SW1"), - m_fdrdy(0), - m_exdsk_sw(false), - m_hdcon_sw(false) - { - } - - required_device m_maincpu; - required_device m_ctc; - required_device m_dart; - required_device m_dmac; - required_device m_fdc; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_device m_floppy4; - required_device m_floppy5; - required_device m_floppy6; - required_device m_floppy7; - floppy_image_device *m_floppy; - required_device m_centronics; - required_memory_region m_rom; - required_ioport m_sw1; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( mreq_r ); - DECLARE_WRITE8_MEMBER( mreq_w ); - DECLARE_READ8_MEMBER( info_r ); - DECLARE_READ8_MEMBER( brom_r ); - DECLARE_WRITE8_MEMBER( brom_w ); - DECLARE_READ8_MEMBER( win_r ); - DECLARE_WRITE8_MEMBER( wstrobe_w ); - DECLARE_WRITE8_MEMBER( exdsk_w ); - DECLARE_WRITE8_MEMBER( exdma_w ); - DECLARE_WRITE8_MEMBER( hdcon_w ); - DECLARE_WRITE8_MEMBER( segst_w ); - DECLARE_WRITE8_MEMBER( dart_w ); - DECLARE_READ8_MEMBER( dma_mreq_r ); - DECLARE_WRITE8_MEMBER( dma_mreq_w ); - DECLARE_READ8_MEMBER( pio_pb_r ); - DECLARE_WRITE_LINE_MEMBER( dartardy_w ); - DECLARE_WRITE_LINE_MEMBER( dartbrdy_w ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_perror ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_fault ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - - void bankswitch(); - void update_dma_rdy(); - - // memory state - int m_segst; - int m_brom; - - // DMA state - UINT8 m_exdma; - int m_buf; - bool m_fdrdy; - int m_dartardy; - int m_dartbrdy; - int m_winrdy; - int m_exrdy1; - int m_exrdy2; - bool m_exdsk_sw; - bool m_hdcon_sw; - - int m_centronics_busy; - int m_centronics_perror; - int m_centronics_select; - int m_centronics_fault; - - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); - DECLARE_WRITE_LINE_MEMBER(dart_rxtxca_w); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); -}; - -class bulletf_state : public bullet_state -{ -public: - bulletf_state(const machine_config &mconfig, device_type type, const char *tag) : - bullet_state(mconfig, type, tag), - m_floppy8(*this, MB8877_TAG":8"), - m_floppy9(*this, MB8877_TAG":9"), - m_scsibus(*this, SCSIBUS_TAG), - m_scsi_data_in(*this, "scsi_data_in"), - m_scsi_data_out(*this, "scsi_data_out"), - m_scsi_ctrl_in(*this, "scsi_ctrl_in") - { - } - - required_device m_floppy8; - required_device m_floppy9; - required_device m_scsibus; - required_device m_scsi_data_in; - required_device m_scsi_data_out; - required_device m_scsi_ctrl_in; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( mreq_r ); - DECLARE_WRITE8_MEMBER( mreq_w ); - DECLARE_WRITE8_MEMBER( xdma0_w ); - DECLARE_WRITE8_MEMBER( xfdc_w ); - DECLARE_WRITE8_MEMBER( mbank_w ); - DECLARE_READ8_MEMBER( hwsts_r ); - DECLARE_READ8_MEMBER( scsi_r ); - DECLARE_WRITE8_MEMBER( scsi_w ); - - DECLARE_READ8_MEMBER( dma_mreq_r ); - DECLARE_WRITE8_MEMBER( dma_mreq_w ); - DECLARE_WRITE8_MEMBER( pio_pa_w ); - DECLARE_WRITE_LINE_MEMBER( cstrb_w ); - DECLARE_WRITE_LINE_MEMBER( req_w ); - - void fdc_intrq_w(bool state); - - void update_dma_rdy(); - - int m_rome; - UINT8 m_xdma0; - UINT8 m_mbank; - int m_wack; - int m_wrdy; -}; - -#endif diff --git a/src/mess/includes/busicom.h b/src/mess/includes/busicom.h deleted file mode 100644 index 5a589036db9..00000000000 --- a/src/mess/includes/busicom.h +++ /dev/null @@ -1,45 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/busicom.h - * - ****************************************************************************/ - -#ifndef BUSICOM_H_ -#define BUSICOM_H_ - -#include "cpu/i4004/i4004.h" - -class busicom_state : public driver_device -{ -public: - busicom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") { } - - UINT8 m_drum_index; - UINT16 m_keyboard_shifter; - UINT32 m_printer_shifter; - UINT8 m_timer; - UINT8 m_printer_line[11][17]; - UINT8 m_printer_line_color[11]; - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_READ8_MEMBER(printer_r); - DECLARE_WRITE8_MEMBER(shifter_w); - DECLARE_WRITE8_MEMBER(printer_w); - DECLARE_WRITE8_MEMBER(status_w); - DECLARE_WRITE8_MEMBER(printer_ctrl_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(busicom); - UINT32 screen_update_busicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(timer_callback); - required_device m_maincpu; - required_device m_palette; - UINT8 get_bit_selected(UINT32 val,int num); -}; - -#endif /* BUSICOM_H_ */ diff --git a/src/mess/includes/bw12.h b/src/mess/includes/bw12.h deleted file mode 100644 index 474d4b2ad70..00000000000 --- a/src/mess/includes/bw12.h +++ /dev/null @@ -1,127 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __BW12__ -#define __BW12__ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "formats/bw12_dsk.h" -#include "machine/6821pia.h" -#include "bus/centronics/ctronics.h" -#include "machine/kb3600.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "machine/rescap.h" -#include "machine/upd765.h" -#include "machine/z80dart.h" -#include "video/mc6845.h" -#include "sound/dac.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "ic35" -#define MC6845_TAG "ic14" -#define UPD765_TAG "ic45" -#define Z80SIO_TAG "ic15" -#define PIT8253_TAG "ic34" -#define PIA6821_TAG "ic16" -#define MC1408_TAG "ic4" -#define AY3600PRO002_TAG "ic74" -#define CENTRONICS_TAG "centronics" -#define FLOPPY_TIMER_TAG "motor_off" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" - -#define BW12_VIDEORAM_MASK 0x7ff -#define BW12_CHARROM_MASK 0xfff - -class bw12_state : public driver_device -{ -public: - bw12_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_pia(*this, PIA6821_TAG), - m_sio(*this, Z80SIO_TAG), - m_fdc(*this, UPD765_TAG), - m_kbc(*this, AY3600PRO002_TAG), - m_crtc(*this, MC6845_TAG), - m_pit(*this, PIT8253_TAG), - m_palette(*this, "palette"), - m_centronics(*this, CENTRONICS_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, UPD765_TAG ":1:525dd"), - m_floppy1(*this, UPD765_TAG ":2:525dd"), - m_floppy_timer(*this, FLOPPY_TIMER_TAG), - m_rom(*this, Z80_TAG), - m_char_rom(*this, "chargen"), - m_video_ram(*this, "video_ram"), - m_modifiers(*this, "MODIFIERS") - { } - - required_device m_maincpu; - required_device m_pia; - required_device m_sio; - required_device m_fdc; - required_device m_kbc; - required_device m_crtc; - required_device m_pit; - required_device m_palette; - required_device m_centronics; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy_timer; - required_memory_region m_rom; - required_memory_region m_char_rom; - required_shared_ptr m_video_ram; - required_ioport m_modifiers; - - virtual void machine_start(); - virtual void machine_reset(); - - void bankswitch(); - void floppy_motor_off(); - void set_floppy_motor_off_timer(); - void ls259_w(int address, int data); - - DECLARE_READ8_MEMBER( ls259_r ); - DECLARE_WRITE8_MEMBER( ls259_w ); - DECLARE_READ8_MEMBER( pia_pa_r ); - DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); - DECLARE_WRITE_LINE_MEMBER( pit_out2_w ); - DECLARE_READ_LINE_MEMBER( ay3600_shift_r ); - DECLARE_READ_LINE_MEMBER( ay3600_control_r ); - DECLARE_WRITE_LINE_MEMBER( ay3600_data_ready_w ); - MC6845_UPDATE_ROW( crtc_update_row ); - - /* memory state */ - int m_bank; - - /* PIT state */ - int m_pit_out2; - - /* keyboard state */ - int m_key_data[9]; - int m_key_sin; - int m_key_stb; - int m_key_shift; - - /* floppy state */ - int m_motor_on; - int m_motor0; - int m_motor1; - TIMER_DEVICE_CALLBACK_MEMBER(floppy_motor_off_tick); - DECLARE_WRITE_LINE_MEMBER(pit_out0_w); - DECLARE_FLOPPY_FORMATS( bw12_floppy_formats ); - DECLARE_FLOPPY_FORMATS( bw14_floppy_formats ); - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - int m_centronics_busy; - int m_centronics_fault; - int m_centronics_perror; -}; - -#endif diff --git a/src/mess/includes/bw2.h b/src/mess/includes/bw2.h deleted file mode 100644 index 563ce4b4acd..00000000000 --- a/src/mess/includes/bw2.h +++ /dev/null @@ -1,118 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __BW2__ -#define __BW2__ - -#include "emu.h" -#include "bus/bw2/exp.h" -#include "cpu/z80/z80.h" -#include "formats/bw2_dsk.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8251.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "video/msm6255.h" -#include "rendlay.h" - -#define Z80_TAG "ic1" -#define I8255A_TAG "ic4" -#define WD2797_TAG "ic5" -#define I8253_TAG "ic6" -#define I8251_TAG "ic7" -#define MSM6255_TAG "ic49" -#define CENTRONICS_TAG "centronics" -#define RS232_TAG "rs232" -#define SCREEN_TAG "screen" - -class bw2_state : public driver_device -{ -public: - bw2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_uart(*this, I8251_TAG), - m_fdc(*this, WD2797_TAG), - m_lcdc(*this, MSM6255_TAG), - m_pit(*this, I8253_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_exp(*this, BW2_EXPANSION_SLOT_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, WD2797_TAG":0"), - m_floppy1(*this, WD2797_TAG":1"), - m_floppy(NULL), - m_rom(*this, Z80_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_video_ram(*this, "videoram") - { } - - required_device m_maincpu; - required_device m_uart; - required_device m_fdc; - required_device m_lcdc; - required_device m_pit; - required_device m_centronics; - required_device m_exp; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - floppy_image_device *m_floppy; - required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE8_MEMBER( ppi_pa_w ); - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - DECLARE_READ8_MEMBER( ppi_pc_r ); - - DECLARE_WRITE_LINE_MEMBER( pit_out0_w ); - DECLARE_WRITE_LINE_MEMBER( mtron_w ); - - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - // keyboard state - UINT8 m_kb; - - // memory state - UINT8 m_bank; - - // floppy state - int m_mtron; - int m_mfdbk; - - // video state - optional_shared_ptr m_video_ram; - DECLARE_PALETTE_INIT(bw2); - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - int m_centronics_busy; -}; - -#endif diff --git a/src/mess/includes/c128.h b/src/mess/includes/c128.h deleted file mode 100644 index c32b2afd726..00000000000 --- a/src/mess/includes/c128.h +++ /dev/null @@ -1,253 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __C128__ -#define __C128__ - -#include "emu.h" -#include "bus/cbmiec/cbmiec.h" -#include "bus/c64/exp.h" -#include "bus/vic20/user.h" -#include "bus/pet/cass.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "imagedev/snapquik.h" -#include "cpu/m6502/m8502.h" -#include "machine/mos6526.h" -#include "machine/mos8722.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/mos6581.h" -#include "video/mc6845.h" -#include "video/mos6566.h" - -#define Z80A_TAG "u10" -#define M8502_TAG "u6" -#define MOS8563_TAG "u22" -#define MOS8564_TAG "u21" -#define MOS8566_TAG "u21" -#define MOS6581_TAG "u5" -#define MOS6526_1_TAG "u1" -#define MOS6526_2_TAG "u4" -#define MOS8721_TAG "u11" -#define MOS8722_TAG "u7" -#define SCREEN_VIC_TAG "screen" -#define SCREEN_VDC_TAG "screen80" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" -#define PET_USER_PORT_TAG "user" - -class c128_state : public driver_device -{ -public: - c128_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, Z80A_TAG), - m_subcpu(*this, M8502_TAG), - m_mmu(*this, MOS8722_TAG), - m_pla(*this, MOS8721_TAG), - m_vdc(*this, MOS8563_TAG), - m_vic(*this, MOS8564_TAG), - m_sid(*this, MOS6581_TAG), - m_cia1(*this, MOS6526_1_TAG), - m_cia2(*this, MOS6526_2_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, C64_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_from(*this, "from"), - m_rom(*this, M8502_TAG), - m_charom(*this, "charom"), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_k0(*this, "K0"), - m_k1(*this, "K1"), - m_k2(*this, "K2"), - m_lock(*this, "LOCK"), - m_caps(*this, "CAPS"), - m_40_80(*this, "40_80"), - m_z80en(0), - m_loram(1), - m_hiram(1), - m_charen(1), - m_game(1), - m_exrom(1), - m_va14(1), - m_va15(1), - m_clrbank(0), - m_cnt1(1), - m_sp1(1), - m_iec_data_out(1), - m_restore(1), - m_cia1_irq(CLEAR_LINE), - m_cia2_irq(CLEAR_LINE), - m_vic_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE), - m_exp_nmi(CLEAR_LINE), - m_cass_rd(1), - m_iec_srq(1), - m_vic_k(0x07), - m_caps_lock(1) - { } - - required_device m_maincpu; - required_device m_subcpu; - required_device m_mmu; - required_device m_pla; - required_device m_vdc; - required_device m_vic; - required_device m_sid; - required_device m_cia1; - required_device m_cia2; - required_device m_iec; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - required_device m_user; - required_device m_ram; - required_device m_cassette; - required_device m_from; - required_memory_region m_rom; - required_memory_region m_charom; - optional_shared_ptr m_color_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_k0; - required_ioport m_k1; - required_ioport m_k2; - required_ioport m_lock; - required_ioport m_caps; - required_ioport m_40_80; - - virtual void machine_start(); - virtual void machine_reset(); - - inline void check_interrupts(); - int read_pla(offs_t offset, offs_t ca, offs_t vma, int ba, int rw, int aec, int z80io, int ms3, int ms2, int ms1, int ms0); - UINT8 read_memory(address_space &space, offs_t offset, offs_t vma, int ba, int aec, int z80io); - void write_memory(address_space &space, offs_t offset, offs_t vma, UINT8 data, int ba, int aec, int z80io); - inline void update_iec(); - - DECLARE_READ8_MEMBER( z80_r ); - DECLARE_WRITE8_MEMBER( z80_w ); - DECLARE_READ8_MEMBER( z80_io_r ); - DECLARE_WRITE8_MEMBER( z80_io_w ); - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_colorram_r ); - - DECLARE_WRITE_LINE_MEMBER( mmu_z80en_w ); - DECLARE_WRITE_LINE_MEMBER( mmu_fsdir_w ); - DECLARE_READ_LINE_MEMBER( mmu_game_r ); - DECLARE_READ_LINE_MEMBER( mmu_exrom_r ); - DECLARE_READ_LINE_MEMBER( mmu_sense40_r ); - - DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); - DECLARE_WRITE8_MEMBER( vic_k_w ); - - DECLARE_READ8_MEMBER( sid_potx_r ); - DECLARE_READ8_MEMBER( sid_poty_r ); - - DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); - DECLARE_WRITE_LINE_MEMBER( cia1_cnt_w ); - DECLARE_WRITE_LINE_MEMBER( cia1_sp_w ); - DECLARE_READ8_MEMBER( cia1_pa_r ); - DECLARE_WRITE8_MEMBER( cia1_pa_w ); - DECLARE_READ8_MEMBER( cia1_pb_r ); - DECLARE_WRITE8_MEMBER( cia1_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( cia2_irq_w ); - DECLARE_READ8_MEMBER( cia2_pa_r ); - DECLARE_WRITE8_MEMBER( cia2_pa_w ); - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_WRITE_LINE_MEMBER( iec_srq_w ); - DECLARE_WRITE_LINE_MEMBER( iec_data_w ); - - DECLARE_READ8_MEMBER( exp_dma_cd_r ); - DECLARE_WRITE8_MEMBER( exp_dma_cd_w ); - DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); - DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); - DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); - DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - - DECLARE_WRITE_LINE_MEMBER( write_restore ); - DECLARE_INPUT_CHANGED_MEMBER( caps_lock ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); - - DECLARE_READ8_MEMBER( cia2_pb_r ); - DECLARE_WRITE8_MEMBER( cia2_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( write_user_pa2 ) { m_user_pa2 = state; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb0 ) { if (state) m_user_pb |= 1; else m_user_pb &= ~1; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb1 ) { if (state) m_user_pb |= 2; else m_user_pb &= ~2; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb2 ) { if (state) m_user_pb |= 4; else m_user_pb &= ~4; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb3 ) { if (state) m_user_pb |= 8; else m_user_pb &= ~8; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb4 ) { if (state) m_user_pb |= 16; else m_user_pb &= ~16; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb5 ) { if (state) m_user_pb |= 32; else m_user_pb &= ~32; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb6 ) { if (state) m_user_pb |= 64; else m_user_pb &= ~64; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb7 ) { if (state) m_user_pb |= 128; else m_user_pb &= ~128; } - - // memory state - int m_z80en; - int m_loram; - int m_hiram; - int m_charen; - int m_game; - int m_exrom; - int m_reset; - - // video state - int m_va14; - int m_va15; - int m_clrbank; - - // fast serial state - int m_cnt1; - int m_sp1; - int m_iec_data_out; - - // interrupt state - int m_restore; - int m_cia1_irq; - int m_cia2_irq; - int m_vic_irq; - int m_exp_irq; - int m_exp_nmi; - int m_exp_dma; - int m_cass_rd; - int m_iec_srq; - - // keyboard state - UINT8 m_vic_k; - int m_caps_lock; - - int m_user_pa2; - int m_user_pb; -}; - - - -#endif diff --git a/src/mess/includes/c64.h b/src/mess/includes/c64.h deleted file mode 100644 index 787fe5a6f60..00000000000 --- a/src/mess/includes/c64.h +++ /dev/null @@ -1,216 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __C64__ -#define __C64__ - -#include "emu.h" -#include "bus/cbmiec/cbmiec.h" -#include "bus/c64/exp.h" -#include "bus/vic20/user.h" -#include "bus/pet/cass.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m6510.h" -#include "imagedev/snapquik.h" -#include "machine/mos6526.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/mos6581.h" -#include "video/mos6566.h" - -#define M6510_TAG "u7" -#define MOS6567_TAG "u19" -#define MOS6569_TAG "u19" -#define MOS6581_TAG "u18" -#define MOS6526_1_TAG "u1" -#define MOS6526_2_TAG "u2" -#define PLA_TAG "u17" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" -#define PET_USER_PORT_TAG "user" - -class c64_state : public driver_device -{ -public: - c64_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, M6510_TAG), - m_pla(*this, PLA_TAG), - m_vic(*this, MOS6569_TAG), - m_sid(*this, MOS6581_TAG), - m_cia1(*this, MOS6526_1_TAG), - m_cia2(*this, MOS6526_2_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, C64_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_lock(*this, "LOCK"), - m_loram(1), - m_hiram(1), - m_charen(1), - m_va14(1), - m_va15(1), - m_restore(1), - m_cia1_irq(CLEAR_LINE), - m_cia2_irq(CLEAR_LINE), - m_vic_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE), - m_exp_nmi(CLEAR_LINE) - { } - - // ROM - UINT8 *m_basic; - UINT8 *m_kernal; - UINT8 *m_charom; - - required_device m_maincpu; - required_device m_pla; - required_device m_vic; - required_device m_sid; - required_device m_cia1; - required_device m_cia2; - optional_device m_iec; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - required_device m_user; - required_device m_ram; - optional_device m_cassette; - optional_shared_ptr m_color_ram; - optional_ioport m_row0; - optional_ioport m_row1; - optional_ioport m_row2; - optional_ioport m_row3; - optional_ioport m_row4; - optional_ioport m_row5; - optional_ioport m_row6; - optional_ioport m_row7; - optional_ioport m_lock; - - virtual void machine_start(); - virtual void machine_reset(); - - void check_interrupts(); - int read_pla(offs_t offset, offs_t va, int rw, int aec, int ba); - UINT8 read_memory(address_space &space, offs_t offset, offs_t va, int aec, int ba); - void write_memory(address_space &space, offs_t offset, UINT8 data, int aec, int ba); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_colorram_r ); - DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); - - DECLARE_READ8_MEMBER( sid_potx_r ); - DECLARE_READ8_MEMBER( sid_poty_r ); - - DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); - DECLARE_READ8_MEMBER( cia1_pa_r ); - DECLARE_WRITE8_MEMBER( cia1_pa_w ); - DECLARE_READ8_MEMBER( cia1_pb_r ); - DECLARE_WRITE8_MEMBER( cia1_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( cia2_irq_w ); - DECLARE_READ8_MEMBER( cia2_pa_r ); - DECLARE_WRITE8_MEMBER( cia2_pa_w ); - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_WRITE_LINE_MEMBER( write_restore ); - DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); - DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); - DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); - DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); - - DECLARE_READ8_MEMBER( cia2_pb_r ); - DECLARE_WRITE8_MEMBER( cia2_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( write_user_pa2 ) { m_user_pa2 = state; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb0 ) { if (state) m_user_pb |= 1; else m_user_pb &= ~1; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb1 ) { if (state) m_user_pb |= 2; else m_user_pb &= ~2; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb2 ) { if (state) m_user_pb |= 4; else m_user_pb &= ~4; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb3 ) { if (state) m_user_pb |= 8; else m_user_pb &= ~8; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb4 ) { if (state) m_user_pb |= 16; else m_user_pb &= ~16; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb5 ) { if (state) m_user_pb |= 32; else m_user_pb &= ~32; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb6 ) { if (state) m_user_pb |= 64; else m_user_pb &= ~64; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb7 ) { if (state) m_user_pb |= 128; else m_user_pb &= ~128; } - - // memory state - int m_loram; - int m_hiram; - int m_charen; - - // video state - int m_va14; - int m_va15; - - // interrupt state - int m_restore; - int m_cia1_irq; - int m_cia2_irq; - int m_vic_irq; - int m_exp_irq; - int m_exp_nmi; - int m_exp_dma; - - int m_user_pa2; - int m_user_pb; -}; - - -class sx64_state : public c64_state -{ -public: - sx64_state(const machine_config &mconfig, device_type type, const char *tag) - : c64_state(mconfig, type, tag) - { } - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); -}; - - -class c64c_state : public c64_state -{ -public: - c64c_state(const machine_config &mconfig, device_type type, const char *tag) - : c64_state(mconfig, type, tag) - { } -}; - - -class c64gs_state : public c64c_state -{ -public: - c64gs_state(const machine_config &mconfig, device_type type, const char *tag) - : c64c_state(mconfig, type, tag) - { } - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_READ8_MEMBER( cia1_pa_r ); - DECLARE_READ8_MEMBER( cia1_pb_r ); -}; - - - -#endif diff --git a/src/mess/includes/c65.h b/src/mess/includes/c65.h deleted file mode 100644 index e8771e83fc1..00000000000 --- a/src/mess/includes/c65.h +++ /dev/null @@ -1,2 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders: Angelo Salese diff --git a/src/mess/includes/c80.h b/src/mess/includes/c80.h deleted file mode 100644 index d2b461fb0a3..00000000000 --- a/src/mess/includes/c80.h +++ /dev/null @@ -1,57 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __C80__ -#define __C80__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80pio.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "d2" -#define Z80PIO1_TAG "d11" -#define Z80PIO2_TAG "d12" - -class c80_state : public driver_device -{ -public: - c80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_pio1(*this, Z80PIO1_TAG), - m_cassette(*this, "cassette"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2") - { } - - required_device m_maincpu; - required_device m_pio1; - required_device m_cassette; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( pio1_pa_r ); - DECLARE_WRITE8_MEMBER( pio1_pa_w ); - DECLARE_WRITE8_MEMBER( pio1_pb_w ); - DECLARE_WRITE_LINE_MEMBER( pio1_brdy_w ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); - - /* keyboard state */ - int m_keylatch; - - /* display state */ - int m_digit; - int m_pio1_a5; - int m_pio1_brdy; -}; - -#endif diff --git a/src/mess/includes/cbm2.h b/src/mess/includes/cbm2.h deleted file mode 100644 index 41ba6707dc8..00000000000 --- a/src/mess/includes/cbm2.h +++ /dev/null @@ -1,329 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __P500__ -#define __P500__ - -#include "emu.h" -#include "bus/cbm2/exp.h" -#include "bus/cbm2/user.h" -#include "bus/ieee488/ieee488.h" -#include "bus/pet/cass.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m6509.h" -#include "cpu/i86/i86.h" -#include "machine/cbm_snqk.h" -#include "machine/6525tpi.h" -#include "machine/ds75160a.h" -#include "machine/ds75161a.h" -#include "machine/mos6526.h" -#include "machine/mos6551.h" -#include "machine/pic8259.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/mos6581.h" -#include "video/mc6845.h" -#include "video/mos6566.h" - -#define M6509_TAG "u13" -#define PLA1_TAG "u78" -#define PLA2_TAG "u88" -#define MOS6567_TAG "u23" -#define MOS6569_TAG "u23" -#define MC68B45_TAG "u10" -#define MOS6581_TAG "u4" -#define MOS6525_1_TAG "u20" -#define MOS6525_2_TAG "u102" -#define MOS6551A_TAG "u19" -#define MOS6526_TAG "u2" -#define DS75160A_TAG "u3" -#define DS75161A_TAG "u7" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" -#define RS232_TAG "rs232" - -#define EXT_I8088_TAG "ext_u1" -#define EXT_I8087_TAG "ext_u4" -#define EXT_I8259A_TAG "ext_u3" -#define EXT_MOS6526_TAG "ext_u15" -#define EXT_MOS6525_TAG "ext_u16" - -class cbm2_state : public driver_device -{ -public: - cbm2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6509_TAG), - m_pla1(*this, PLA1_TAG), - m_crtc(*this, MC68B45_TAG), - m_palette(*this, "palette"), - m_sid(*this, MOS6581_TAG), - m_tpi1(*this, MOS6525_1_TAG), - m_tpi2(*this, MOS6525_2_TAG), - m_acia(*this, MOS6551A_TAG), - m_cia(*this, MOS6526_TAG), - m_ieee1(*this, DS75160A_TAG), - m_ieee2(*this, DS75161A_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, CBM2_EXPANSION_SLOT_TAG), - m_user(*this, CBM2_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_ieee(*this, IEEE488_TAG), - m_ext_cpu(*this, EXT_I8088_TAG), - m_ext_pic(*this, EXT_I8259A_TAG), - m_ext_cia(*this, EXT_MOS6526_TAG), - m_ext_tpi(*this, EXT_MOS6525_TAG), - m_basic(*this, "basic"), - m_kernal(*this, "kernal"), - m_charom(*this, "charom"), - m_buffer_ram(*this, "buffer_ram"), - m_extbuf_ram(*this, "extbuf_ram"), - m_video_ram(*this, "video_ram"), - m_pa0(*this, "PA0"), - m_pa1(*this, "PA1"), - m_pa2(*this, "PA2"), - m_pa3(*this, "PA3"), - m_pa4(*this, "PA4"), - m_pa5(*this, "PA5"), - m_pa6(*this, "PA6"), - m_pa7(*this, "PA7"), - m_pb0(*this, "PB0"), - m_pb1(*this, "PB1"), - m_pb2(*this, "PB2"), - m_pb3(*this, "PB3"), - m_pb4(*this, "PB4"), - m_pb5(*this, "PB5"), - m_pb6(*this, "PB6"), - m_pb7(*this, "PB7"), - m_lock(*this, "LOCK"), - m_dramon(1), - m_video_ram_size(0x800), - m_graphics(1), - m_todclk(0), - m_tpi1_irq(CLEAR_LINE), - m_acia_irq(CLEAR_LINE), - m_user_irq(CLEAR_LINE), - m_tpi2_pa(0), - m_tpi2_pb(0) - { } - - required_device m_maincpu; - required_device m_pla1; - optional_device m_crtc; - optional_device m_palette; - required_device m_sid; - required_device m_tpi1; - required_device m_tpi2; - required_device m_acia; - required_device m_cia; - required_device m_ieee1; - required_device m_ieee2; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - required_device m_user; - required_device m_ram; - required_device m_cassette; - required_device m_ieee; - optional_device m_ext_cpu; - optional_device m_ext_pic; - optional_device m_ext_cia; - optional_device m_ext_tpi; - required_memory_region m_basic; - required_memory_region m_kernal; - required_memory_region m_charom; - optional_shared_ptr m_buffer_ram; - optional_shared_ptr m_extbuf_ram; - optional_shared_ptr m_video_ram; - required_ioport m_pa0; - required_ioport m_pa1; - required_ioport m_pa2; - required_ioport m_pa3; - required_ioport m_pa4; - required_ioport m_pa5; - required_ioport m_pa6; - required_ioport m_pa7; - required_ioport m_pb0; - required_ioport m_pb1; - required_ioport m_pb2; - required_ioport m_pb3; - required_ioport m_pb4; - required_ioport m_pb5; - required_ioport m_pb6; - required_ioport m_pb7; - required_ioport m_lock; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - DECLARE_MACHINE_START( cbm2 ); - DECLARE_MACHINE_START( cbm2_ntsc ); - DECLARE_MACHINE_START( cbm2_pal ); - DECLARE_MACHINE_START( cbm2x_ntsc ); - DECLARE_MACHINE_START( cbm2x_pal ); - DECLARE_MACHINE_RESET( cbm2 ); - - virtual void read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4); - - void bankswitch(offs_t offset, int eras, int ecas, int refen, int cas, int ras, int *sysioen, int *dramen, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *buframcs, int *extbufcs, int *vidramcs, - int *diskromcs, int *csbank1, int *csbank2, int *csbank3, int *basiccs, int *knbcs, int *kernalcs, - int *crtccs, int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs); - - UINT8 read_keyboard(); - void set_busy2(int state); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( ext_read ); - DECLARE_WRITE8_MEMBER( ext_write ); - - DECLARE_READ8_MEMBER( sid_potx_r ); - DECLARE_READ8_MEMBER( sid_poty_r ); - - DECLARE_WRITE_LINE_MEMBER( tpi1_irq_w ); - DECLARE_READ8_MEMBER( tpi1_pa_r ); - DECLARE_WRITE8_MEMBER( tpi1_pa_w ); - DECLARE_READ8_MEMBER( tpi1_pb_r ); - DECLARE_WRITE8_MEMBER( tpi1_pb_w ); - DECLARE_WRITE_LINE_MEMBER( tpi1_ca_w ); - DECLARE_WRITE_LINE_MEMBER( tpi1_cb_w ); - - DECLARE_WRITE8_MEMBER( tpi2_pa_w ); - DECLARE_WRITE8_MEMBER( tpi2_pb_w ); - DECLARE_READ8_MEMBER( tpi2_pc_r ); - - DECLARE_READ8_MEMBER( cia_pa_r ); - DECLARE_WRITE8_MEMBER( cia_pa_w ); - DECLARE_READ8_MEMBER( cia_pb_r ); - - DECLARE_WRITE_LINE_MEMBER( tape_read_w ); - - DECLARE_READ8_MEMBER( ext_tpi_pb_r ); - DECLARE_WRITE8_MEMBER( ext_tpi_pb_w ); - DECLARE_WRITE8_MEMBER( ext_tpi_pc_w ); - - DECLARE_WRITE_LINE_MEMBER( ext_cia_irq_w ); - DECLARE_READ8_MEMBER( ext_cia_pb_r ); - DECLARE_WRITE8_MEMBER( ext_cia_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( user_irq_w ); - - MC6845_UPDATE_ROW( crtc_update_row ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbmb ); - // memory state - int m_dramon; - int m_busen1; - int m_busy2; - - // video state - size_t m_video_ram_size; - int m_graphics; - int m_ntsc; - - // interrupt state - int m_todclk; - int m_tpi1_irq; - int m_acia_irq; - int m_user_irq; - - // keyboard state; - UINT8 m_tpi2_pa; - UINT8 m_tpi2_pb; - UINT8 m_cia_pa; - - UINT8 m_ext_cia_pb; - UINT8 m_ext_tpi_pb; - - // timers - emu_timer *m_todclk_timer; -}; - - -class cbm2hp_state : public cbm2_state -{ -public: - cbm2hp_state(const machine_config &mconfig, device_type type, const char *tag) - : cbm2_state(mconfig, type, tag) - { } - - virtual void read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4); - - DECLARE_READ8_MEMBER( tpi2_pc_r ); -}; - - -class p500_state : public cbm2_state -{ -public: - p500_state(const machine_config &mconfig, device_type type, const char *tag) - : cbm2_state(mconfig, type, tag), - m_pla2(*this, PLA2_TAG), - m_vic(*this, MOS6569_TAG), - m_color_ram(*this, "color_ram"), - m_statvid(1), - m_vicdotsel(1), - m_vicbnksel(0x03), - m_vic_irq(CLEAR_LINE) - { } - - required_device m_pla2; - required_device m_vic; - optional_shared_ptr m_color_ram; - - DECLARE_MACHINE_START( p500 ); - DECLARE_MACHINE_START( p500_ntsc ); - DECLARE_MACHINE_START( p500_pal ); - DECLARE_MACHINE_RESET( p500 ); - - void read_pla1(offs_t offset, int busy2, int clrnibcsb, int procvid, int refen, int ba, int aec, int srw, - int *datxen, int *dramxen, int *clrniben, int *segf, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr); - - void read_pla2(offs_t offset, offs_t va, int ba, int vicen, int ae, int segf, int bank0, - int *clrnibcsb, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *procvid, int *viccs, int *vidmatcs); - - void bankswitch(offs_t offset, offs_t va, int srw, int ba, int ae, int busy2, int refen, - int *datxen, int *dramxen, int *clrniben, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr, - int *clrnibcs, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *viccs, int *vidmatcs, - int *csbank1, int *csbank2, int *csbank3, int *basiclocs, int *basichics, int *kernalcs, - int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs, int *aec, int *vsysaden); - - UINT8 read_memory(address_space &space, offs_t offset, offs_t va, int ba, int ae); - void write_memory(address_space &space, offs_t offset, UINT8 data, int ba, int ae); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_colorram_r ); - DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); - - DECLARE_WRITE_LINE_MEMBER( tpi1_irq_w ); - DECLARE_WRITE_LINE_MEMBER( tpi1_ca_w ); - DECLARE_WRITE_LINE_MEMBER( tpi1_cb_w ); - - DECLARE_READ8_MEMBER( tpi2_pc_r ); - DECLARE_WRITE8_MEMBER( tpi2_pc_w ); - - DECLARE_WRITE_LINE_MEMBER( user_irq_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( p500 ); - // video state - int m_statvid; - int m_vicdotsel; - int m_vicbnksel; - - // interrupt state - int m_vic_irq; -}; - - - -#endif diff --git a/src/mess/includes/cgc7900.h b/src/mess/includes/cgc7900.h deleted file mode 100644 index d5b6dc86548..00000000000 --- a/src/mess/includes/cgc7900.h +++ /dev/null @@ -1,104 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __CGC7900__ -#define __CGC7900__ - - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/ram.h" -#include "machine/i8251.h" -#include "sound/ay8910.h" - -#define M68000_TAG "uh8" -#define INS8251_0_TAG "uc10" -#define INS8251_1_TAG "uc8" -#define MM58167_TAG "uc6" -#define AY8910_TAG "uc4" -#define K1135A_TAG "uc11" -#define I8035_TAG "i8035" -#define AM2910_TAG "11d" -#define SCREEN_TAG "screen" - -class cgc7900_state : public driver_device -{ -public: - cgc7900_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M68000_TAG), - m_palette(*this, "palette"), - m_char_rom(*this, "gfx1"), - m_chrom_ram(*this, "chrom_ram"), - m_plane_ram(*this, "plane_ram"), - m_clut_ram(*this, "clut_ram"), - m_overlay_ram(*this, "overlay_ram"), - m_roll_bitmap(*this, "roll_bitmap"), - m_pan_x(*this, "pan_x"), - m_pan_y(*this, "pan_y"), - m_zoom(*this, "zoom"), - m_blink_select(*this, "blink_select"), - m_plane_select(*this, "plane_select"), - m_plane_switch(*this, "plane_switch"), - m_color_status_fg(*this, "color_status_fg"), - m_color_status_bg(*this, "color_status_bg"), - m_roll_overlay(*this, "roll_overlay") - { } - - required_device m_maincpu; - required_device m_palette; - required_memory_region m_char_rom; - required_shared_ptr m_chrom_ram; - required_shared_ptr m_plane_ram; - required_shared_ptr m_clut_ram; - required_shared_ptr m_overlay_ram; - required_shared_ptr m_roll_bitmap; - required_shared_ptr m_pan_x; - required_shared_ptr m_pan_y; - required_shared_ptr m_zoom; - required_shared_ptr m_blink_select; - required_shared_ptr m_plane_select; - required_shared_ptr m_plane_switch; - required_shared_ptr m_color_status_fg; - required_shared_ptr m_color_status_bg; - required_shared_ptr m_roll_overlay; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_PALETTE_INIT(cgc7900); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ16_MEMBER( keyboard_r ); - DECLARE_WRITE16_MEMBER( keyboard_w ); - DECLARE_WRITE16_MEMBER( interrupt_mask_w ); - DECLARE_READ16_MEMBER( disk_data_r ); - DECLARE_WRITE16_MEMBER( disk_data_w ); - DECLARE_READ16_MEMBER( disk_status_r ); - DECLARE_WRITE16_MEMBER( disk_command_w ); - DECLARE_READ16_MEMBER( z_mode_r ); - DECLARE_WRITE16_MEMBER( z_mode_w ); - DECLARE_WRITE16_MEMBER( color_status_w ); - DECLARE_READ16_MEMBER( sync_r ); - - void update_clut(); - void draw_bitmap(screen_device *screen, bitmap_rgb32 &bitmap); - void draw_overlay(screen_device *screen, bitmap_rgb32 &bitmap); - - /* interrupt state */ - UINT16 m_int_mask; - - /* video state */ - rgb_t m_clut[256]; - int m_blink; - - TIMER_DEVICE_CALLBACK_MEMBER(blink_tick); -}; - -/*----------- defined in video/cgc7900.c -----------*/ - -MACHINE_CONFIG_EXTERN( cgc7900_video ); - -#endif diff --git a/src/mess/includes/channelf.h b/src/mess/includes/channelf.h deleted file mode 100644 index 606e0a6abfb..00000000000 --- a/src/mess/includes/channelf.h +++ /dev/null @@ -1,54 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle -/***************************************************************************** - * - * includes/channelf.h - * - ****************************************************************************/ - -#ifndef CHANNELF_H_ -#define CHANNELF_H_ - -#include "emu.h" -#include "cpu/f8/f8.h" -#include "audio/channelf.h" - -#include "bus/chanf/slot.h" -#include "bus/chanf/rom.h" - - -class channelf_state : public driver_device -{ -public: - channelf_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_custom(*this,"custom"), - m_cart(*this, "cartslot") - { } - - DECLARE_READ8_MEMBER(port_0_r); - DECLARE_READ8_MEMBER(port_1_r); - DECLARE_READ8_MEMBER(port_4_r); - DECLARE_READ8_MEMBER(port_5_r); - DECLARE_WRITE8_MEMBER(port_0_w); - DECLARE_WRITE8_MEMBER(port_1_w); - DECLARE_WRITE8_MEMBER(port_4_w); - DECLARE_WRITE8_MEMBER(port_5_w); - UINT8 *m_p_videoram; - UINT8 m_latch[6]; - UINT8 m_val_reg; - UINT8 m_row_reg; - UINT8 m_col_reg; - UINT8 port_read_with_latch(UINT8 ext, UINT8 latch_state); - virtual void video_start(); - virtual void machine_start(); - DECLARE_PALETTE_INIT(channelf); - UINT32 screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_custom; - required_device m_cart; - int recalc_palette_offset(int reg1, int reg2); -}; - -#endif /* CHANNELF_H_ */ diff --git a/src/mess/includes/coco.h b/src/mess/includes/coco.h deleted file mode 100644 index 363fcff5d2a..00000000000 --- a/src/mess/includes/coco.h +++ /dev/null @@ -1,269 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco.h - - TRS-80 Radio Shack Color Computer Family - -***************************************************************************/ - -#pragma once - -#ifndef __COCO__ -#define __COCO__ - - -#include "emu.h" -#include "imagedev/cassette.h" -#include "bus/rs232/rs232.h" -#include "machine/6821pia.h" -#include "bus/coco/cococart.h" -#include "machine/coco_vhd.h" -#include "bus/coco/coco_dwsock.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/wave.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -INPUT_PORTS_EXTERN( coco_analog_control ); -INPUT_PORTS_EXTERN( coco_cart_autostart ); -INPUT_PORTS_EXTERN( coco_rtc ); -INPUT_PORTS_EXTERN( coco_beckerport ); - -SLOT_INTERFACE_EXTERN( coco_cart ); - -// constants -#define JOYSTICK_DELTA 10 -#define JOYSTICK_SENSITIVITY 100 - -// devices -#define MAINCPU_TAG "maincpu" -#define PIA0_TAG "pia0" -#define PIA1_TAG "pia1" -#define SAM_TAG "sam" -#define VDG_TAG "vdg" -#define SCREEN_TAG "screen" -#define DAC_TAG "dac" -#define CARTRIDGE_TAG "ext" -#define RS232_TAG "rs232" -#define DWSOCK_TAG "dwsock" -#define VHD0_TAG "vhd0" -#define VHD1_TAG "vhd1" - -// inputs -#define CTRL_SEL_TAG "ctrl_sel" -#define HIRES_INTF_TAG "hires_intf" -#define CART_AUTOSTART_TAG "cart_autostart" -#define BECKERPORT_TAG "beckerport" -#define JOYSTICK_RX_TAG "joystick_rx" -#define JOYSTICK_RY_TAG "joystick_ry" -#define JOYSTICK_LX_TAG "joystick_lx" -#define JOYSTICK_LY_TAG "joystick_ly" -#define JOYSTICK_BUTTONS_TAG "joystick_buttons" -#define RAT_MOUSE_RX_TAG "rat_mouse_rx" -#define RAT_MOUSE_RY_TAG "rat_mouse_ry" -#define RAT_MOUSE_LX_TAG "rat_mouse_lx" -#define RAT_MOUSE_LY_TAG "rat_mouse_ly" -#define RAT_MOUSE_BUTTONS_TAG "rat_mouse_buttons" -#define DIECOM_LIGHTGUN_RX_TAG "dclg_rx" -#define DIECOM_LIGHTGUN_RY_TAG "dclg_ry" -#define DIECOM_LIGHTGUN_LX_TAG "dclg_lx" -#define DIECOM_LIGHTGUN_LY_TAG "dclg_ly" -#define DIECOM_LIGHTGUN_BUTTONS_TAG "dclg_triggers" - -MACHINE_CONFIG_EXTERN( coco_sound ); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class coco_state : public driver_device -{ -public: - coco_state(const machine_config &mconfig, device_type type, const char *tag); - - required_device m_maincpu; - required_device m_pia_0; - required_device m_pia_1; - required_device m_dac; - required_device m_wave; - required_device m_cococart; - required_device m_ram; - required_device m_cassette; - optional_device m_rs232; - optional_device m_vhd_0; - optional_device m_vhd_1; - optional_device m_beckerport; - optional_ioport m_beckerportconfig; - - // driver update handlers - DECLARE_INPUT_CHANGED_MEMBER(keyboard_changed); - DECLARE_INPUT_CHANGED_MEMBER(joystick_mode_changed); - - // IO - virtual DECLARE_READ8_MEMBER( ff00_read ); - virtual DECLARE_WRITE8_MEMBER( ff00_write ); - virtual DECLARE_READ8_MEMBER( ff20_read ); - virtual DECLARE_WRITE8_MEMBER( ff20_write ); - virtual DECLARE_READ8_MEMBER( ff40_read ); - virtual DECLARE_WRITE8_MEMBER( ff40_write ); - DECLARE_READ8_MEMBER( ff60_read ); - DECLARE_WRITE8_MEMBER( ff60_write ); - - // PIA0 - DECLARE_WRITE8_MEMBER( pia0_pa_w ); - DECLARE_WRITE8_MEMBER( pia0_pb_w ); - DECLARE_WRITE_LINE_MEMBER( pia0_ca2_w ); - DECLARE_WRITE_LINE_MEMBER( pia0_cb2_w ); - DECLARE_WRITE_LINE_MEMBER( pia0_irq_a ); - DECLARE_WRITE_LINE_MEMBER( pia0_irq_b ); - - // PIA1 - DECLARE_READ8_MEMBER( pia1_pa_r ); - DECLARE_READ8_MEMBER( pia1_pb_r ); - DECLARE_WRITE8_MEMBER( pia1_pa_w ); - DECLARE_WRITE8_MEMBER( pia1_pb_w ); - DECLARE_WRITE_LINE_MEMBER( pia1_ca2_w ); - DECLARE_WRITE_LINE_MEMBER( pia1_cb2_w ); - DECLARE_WRITE_LINE_MEMBER( pia1_firq_a ); - DECLARE_WRITE_LINE_MEMBER( pia1_firq_b ); - - // floating bus - DECLARE_READ8_MEMBER( floating_bus_read ) { return floating_bus_read(); } - - DECLARE_WRITE_LINE_MEMBER( cart_w ) { cart_w((bool) state); } -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // interrupts - virtual bool firq_get_line(void); - virtual bool irq_get_line(void); - void recalculate_irq(void); - void recalculate_firq(void); - - // changed handlers - virtual void pia1_pa_changed(UINT8 data); - virtual void pia1_pb_changed(UINT8 data); - - // miscellaneous - virtual void update_keyboard_input(UINT8 value, UINT8 z); - virtual void cart_w(bool state); - virtual void update_cart_base(UINT8 *cart_base) = 0; - -private: - // timer constants - static const device_timer_id TIMER_HIRES_JOYSTICK_X = 0; - static const device_timer_id TIMER_HIRES_JOYSTICK_Y = 1; - static const device_timer_id TIMER_DIECOM_LIGHTGUN = 2; - - enum soundmux_status_t - { - SOUNDMUX_SEL1 = 1, - SOUNDMUX_SEL2 = 2, - SOUNDMUX_ENABLE = 4 - }; - - enum joystick_type_t - { - JOYSTICK_NONE = 0x00, - JOYSTICK_NORMAL = 0x01, - JOYSTICK_RAT_MOUSE = 0x02, - JOYSTICK_DIECOM_LIGHT_GUN = 0x03 - }; - - enum hires_type_t - { - HIRES_NONE = 0x00, - HIRES_RIGHT = 0x01, - HIRES_RIGHT_COCOMAX3 = 0x02, - HIRES_LEFT = 0x03, - HIRES_LEFT_COCOMAX3 = 0x04 - }; - - struct analog_input_t - { - ioport_port *m_input[2][2]; - ioport_port *m_buttons; - - UINT8 input(int joystick, int axis) const { return m_input[joystick][axis] ? m_input[joystick][axis]->read() : 0x00; } - UINT8 buttons(void) const { return m_buttons ? m_buttons->read() : 0x00; } - }; - - void analog_port_start(analog_input_t *analog, const char *rx_tag, const char *ry_tag, const char *lx_tag, const char *ly_tag, const char *buttons_tag); - - // wrappers for configuration - joystick_type_t joystick_type(int index); - hires_type_t hires_interface_type(void); - bool is_joystick_hires(int joystick_index); - - soundmux_status_t soundmux_status(void); - void update_sound(void); - bool joyin(void); - void poll_joystick(bool *joyin, UINT8 *buttons); - void poll_keyboard(void); - void poll_hires_joystick(void); - void update_cassout(int cassout); - void update_prinout(bool prinout); - void diecom_lightgun_clock(void); - - // thin wrappers for PIA output - UINT8 dac_output(void) { return m_dac_output; } // PA drives the DAC - bool sel1(void) { return m_pia_0->ca2_output() ? true : false; } - bool sel2(void) { return m_pia_0->cb2_output() ? true : false; } - bool snden(void) { return m_pia_1->cb2_output() ? true : false; } - - // VHD selection - coco_vhd_image_device *current_vhd(void); - - // floating bus - UINT8 floating_bus_read(void); - - // disassembly override - static offs_t dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); - - // input ports - ioport_port *m_keyboard[7]; - ioport_port *m_joystick_type_control; - ioport_port *m_joystick_hires_control; - analog_input_t m_joystick; - analog_input_t m_rat_mouse; - analog_input_t m_diecom_lightgun; - - // DAC output - UINT8 m_dac_output; - - // remember the last audio sample level from the analog sources (DAC, cart, cassette) so that we don't - // introduce step changes when the audio output is enabled/disabled via PIA1 CB2 - UINT8 m_analog_audio_level; - - // hires interface - emu_timer *m_hiresjoy_transition_timer[2]; - bool m_hiresjoy_ca; - - // diecom lightgun - emu_timer *m_diecom_lightgun_timer; - bool m_dclg_previous_bit; - UINT8 m_dclg_output_h; - UINT8 m_dclg_output_v; - UINT8 m_dclg_state; - UINT16 m_dclg_timer; - - // VHD selection - UINT8 m_vhd_select; - - // safety to prevent stack overflow when reading floating bus - bool m_in_floating_bus_read; -}; - -#endif // __COCO__ diff --git a/src/mess/includes/coco12.h b/src/mess/includes/coco12.h deleted file mode 100644 index 030adc35b25..00000000000 --- a/src/mess/includes/coco12.h +++ /dev/null @@ -1,67 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco12.h - - TRS-80 Radio Shack Color Computer 1/2 Family - -***************************************************************************/ - -#pragma once - -#ifndef __COCO12__ -#define __COCO12__ - - -#include "includes/coco.h" -#include "machine/6883sam.h" -#include "video/mc6847.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define SAM_TAG "sam" -#define VDG_TAG "vdg" - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class coco12_state : public coco_state -{ -public: - coco12_state(const machine_config &mconfig, device_type type, const char *tag) - : coco_state(mconfig, type, tag), - m_sam(*this, SAM_TAG), - m_vdg(*this, VDG_TAG) - { - } - - - required_device m_sam; - required_device m_vdg; - - DECLARE_READ8_MEMBER( sam_read ); - - DECLARE_WRITE_LINE_MEMBER( horizontal_sync ); - DECLARE_WRITE_LINE_MEMBER( field_sync ); -protected: - virtual void device_start(); - virtual void update_cart_base(UINT8 *cart_base); - - /* PIA1 */ - virtual void pia1_pb_changed(UINT8 data); - -private: - - void configure_sam(void); -}; - - -#endif /* __COCO12__ */ diff --git a/src/mess/includes/coco3.h b/src/mess/includes/coco3.h deleted file mode 100644 index 8ac863fa6b3..00000000000 --- a/src/mess/includes/coco3.h +++ /dev/null @@ -1,67 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco3.h - - TRS-80 Radio Shack Color Computer 1/2 Family - -***************************************************************************/ - -#pragma once - -#ifndef __COCO3__ -#define __COCO3__ - - -#include "includes/coco.h" -#include "video/gime.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define GIME_TAG "gime" -#define VDG_TAG "vdg" -#define COMPOSITE_SCREEN_TAG "composite" -#define RGB_SCREEN_TAG "rgb" - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class coco3_state : public coco_state -{ -public: - coco3_state(const machine_config &mconfig, device_type type, const char *tag) - : coco_state(mconfig, type, tag), - m_gime(*this, GIME_TAG) { } - - required_device m_gime; - - virtual DECLARE_WRITE8_MEMBER( ff20_write ); - virtual DECLARE_READ8_MEMBER( ff40_read ); - virtual DECLARE_WRITE8_MEMBER( ff40_write ); - - DECLARE_WRITE_LINE_MEMBER(gime_firq_w) { recalculate_firq(); } - DECLARE_WRITE_LINE_MEMBER(gime_irq_w) { recalculate_irq(); } - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -protected: - virtual void update_cart_base(UINT8 *cart_base); - - /* interrupts */ - virtual bool firq_get_line(void); - virtual bool irq_get_line(void); - - /* miscellaneous */ - virtual void update_keyboard_input(UINT8 value, UINT8 z); - virtual void cart_w(bool line); -}; - -#endif // __COCO3__ diff --git a/src/mess/includes/coleco.h b/src/mess/includes/coleco.h deleted file mode 100644 index ab6e1379663..00000000000 --- a/src/mess/includes/coleco.h +++ /dev/null @@ -1,99 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mike Balfour, Ben Bruscella, Sean Young -#pragma once - -#ifndef __COLECO__ -#define __COLECO__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/sn76496.h" -#include "video/tms9928a.h" -#include "machine/coleco.h" -#include "bus/coleco/exp.h" - -class coleco_state : public driver_device -{ -public: - coleco_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cart(*this, COLECOVISION_CARTRIDGE_SLOT_TAG), - m_ram(*this, "ram"), - m_ctrlsel(*this, "CTRLSEL"), - m_std_keypad1(*this, "STD_KEYPAD1"), - m_std_joy1(*this, "STD_JOY1"), - m_std_keypad2(*this, "STD_KEYPAD2"), - m_std_joy2(*this, "STD_JOY2"), - m_sac_keypad1(*this, "SAC_KEYPAD1"), - m_sac_joy1(*this, "SAC_JOY1"), - m_sac_slide1(*this, "SAC_SLIDE1"), - m_sac_keypad2(*this, "SAC_KEYPAD2"), - m_sac_joy2(*this, "SAC_JOY2"), - m_sac_slide2(*this, "SAC_SLIDE2"), - m_driv_wheel1(*this, "DRIV_WHEEL1"), - m_driv_pedal1(*this, "DRIV_PEDAL1"), - m_driv_wheel2(*this, "DRIV_WHEEL2"), - m_driv_pedal2(*this, "DRIV_PEDAL2"), - m_roller_x(*this, "ROLLER_X"), - m_roller_y(*this, "ROLLER_Y") - { } - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( cart_r ); - DECLARE_READ8_MEMBER( paddle_1_r ); - DECLARE_READ8_MEMBER( paddle_2_r ); - DECLARE_WRITE8_MEMBER( paddle_off_w ); - DECLARE_WRITE8_MEMBER( paddle_on_w ); - - TIMER_CALLBACK_MEMBER(paddle_d7reset_callback); - TIMER_CALLBACK_MEMBER(paddle_irqreset_callback); - TIMER_CALLBACK_MEMBER(paddle_pulse_callback); - TIMER_DEVICE_CALLBACK_MEMBER(paddle_update_callback); - DECLARE_WRITE_LINE_MEMBER(coleco_vdp_interrupt); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(czz50_cart); - - UINT8 coleco_paddle_read(int port, int joy_mode, UINT8 joy_status); - UINT8 coleco_scan_paddles(UINT8 *joy_status0, UINT8 *joy_status1); - -private: - required_device m_maincpu; - required_device m_cart; - required_shared_ptr m_ram; - - int m_joy_mode; - int m_last_nmi_state; - - // analog controls - attotime m_joy_pulse_reload[2]; - emu_timer *m_joy_pulse_timer[2]; - emu_timer *m_joy_irq_timer[2]; - emu_timer *m_joy_d7_timer[2]; - int m_joy_irq_state[2]; - int m_joy_d7_state[2]; - UINT8 m_joy_analog_state[2]; - UINT8 m_joy_analog_reload[2]; - - optional_ioport m_ctrlsel; - required_ioport m_std_keypad1; - required_ioport m_std_joy1; - required_ioport m_std_keypad2; - required_ioport m_std_joy2; - optional_ioport m_sac_keypad1; - optional_ioport m_sac_joy1; - optional_ioport m_sac_slide1; - optional_ioport m_sac_keypad2; - optional_ioport m_sac_joy2; - optional_ioport m_sac_slide2; - optional_ioport m_driv_wheel1; - optional_ioport m_driv_pedal1; - optional_ioport m_driv_wheel2; - optional_ioport m_driv_pedal2; - optional_ioport m_roller_x; - optional_ioport m_roller_y; -}; - -#endif diff --git a/src/mess/includes/compis.h b/src/mess/includes/compis.h deleted file mode 100644 index fbb562b4b90..00000000000 --- a/src/mess/includes/compis.h +++ /dev/null @@ -1,135 +0,0 @@ -// license:??? -// copyright-holders:Per Ola Ingvarsson, Tomas Karlsson -/***************************************************************************** - * - * includes/compis.h - * - * machine driver header - * - * Per Ola Ingvarsson - * Tomas Karlsson - * - ****************************************************************************/ - -#pragma once - -#ifndef __COMPIS__ -#define __COMPIS__ - -#include "emu.h" -#include "bus/isbx/isbx.h" -#include "cpu/i86/i186.h" -#include "cpu/mcs48/mcs48.h" -#include "imagedev/cassette.h" -#include "machine/compiskb.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8251.h" -#include "machine/i8255.h" -#include "machine/i80130.h" -#include "machine/mm58274c.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "machine/z80dart.h" -#include "video/upd7220.h" - -#define I80186_TAG "ic1" -#define I80130_TAG "ic15" -#define I8251A_TAG "ic59" -#define I8253_TAG "ic60" -#define I8274_TAG "ic65" -#define MM58174A_TAG "ic66" -#define I8255_TAG "ic69" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" -#define CASSETTE_TAG "cassette" -#define CENTRONICS_TAG "centronics" -#define ISBX_0_TAG "isbx0" -#define ISBX_1_TAG "isbx1" -#define SCREEN_TAG "screen" -#define COMPIS_KEYBOARD_TAG "compiskb" - -class compis_state : public driver_device -{ -public: - compis_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I80186_TAG), - m_osp(*this, I80130_TAG), - m_pit(*this, I8253_TAG), - m_ppi(*this, I8255_TAG), - m_mpsc(*this, I8274_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_uart(*this, I8251A_TAG), - m_rtc(*this, MM58174A_TAG), - m_crtc(*this, "upd7220"), - m_palette(*this, "palette"), - m_cassette(*this, CASSETTE_TAG), - m_isbx0(*this, ISBX_0_TAG), - m_isbx1(*this, ISBX_1_TAG), - m_ram(*this, RAM_TAG), - m_video_ram(*this, "video_ram"), - m_s8(*this, "S8") - { } - - required_device m_maincpu; - required_device m_osp; - required_device m_pit; - required_device m_ppi; - required_device m_mpsc; - required_device m_centronics; - required_device m_uart; - required_device m_rtc; - required_device m_crtc; - required_device m_palette; - required_device m_cassette; - required_device m_isbx0; - required_device m_isbx1; - required_device m_ram; - required_shared_ptr m_video_ram; - required_ioport m_s8; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( tape_mon_w ); - DECLARE_READ16_MEMBER( isbx0_tdma_r ); - DECLARE_WRITE16_MEMBER( isbx0_tdma_w ); - DECLARE_READ16_MEMBER( isbx1_tdma_r ); - DECLARE_WRITE16_MEMBER( isbx1_tdma_w ); - DECLARE_READ16_MEMBER( isbx0_cs_r ); - DECLARE_WRITE16_MEMBER( isbx0_cs_w ); - DECLARE_READ16_MEMBER( isbx0_dack_r ); - DECLARE_WRITE16_MEMBER( isbx0_dack_w ); - DECLARE_READ16_MEMBER( isbx1_cs_r ); - DECLARE_WRITE16_MEMBER( isbx1_cs_w ); - DECLARE_READ16_MEMBER( isbx1_dack_r ); - DECLARE_WRITE16_MEMBER( isbx1_dack_w ); - - DECLARE_READ8_MEMBER( compis_irq_callback ); - - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - - DECLARE_WRITE_LINE_MEMBER( tmr0_w ); - DECLARE_WRITE_LINE_MEMBER( tmr1_w ); - DECLARE_WRITE_LINE_MEMBER( tmr2_w ); - DECLARE_WRITE_LINE_MEMBER( tmr5_w ); - - TIMER_DEVICE_CALLBACK_MEMBER( tape_tick ); - - int m_centronics_busy; - int m_centronics_select; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_select); - - int m_tmr0; - int m_unk_video; - - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); -}; - - - -#endif diff --git a/src/mess/includes/comquest.h b/src/mess/includes/comquest.h deleted file mode 100644 index 5b36a3efefe..00000000000 --- a/src/mess/includes/comquest.h +++ /dev/null @@ -1,34 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/comquest.h - * - ****************************************************************************/ - -#ifndef COMQUEST_H_ -#define COMQUEST_H_ - - -class comquest_state : public driver_device -{ -public: - comquest_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") { } - - UINT8 m_data[128][8]; - void *m_timer; - int m_line; - int m_dma_activ; - int m_state; - int m_count; - DECLARE_READ8_MEMBER(comquest_read); - DECLARE_WRITE8_MEMBER(comquest_write); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_comquest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; -}; - -#endif /* COMQUEST_H_ */ diff --git a/src/mess/includes/comx35.h b/src/mess/includes/comx35.h deleted file mode 100644 index 93bc60a84e8..00000000000 --- a/src/mess/includes/comx35.h +++ /dev/null @@ -1,106 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __COMX35__ -#define __COMX35__ - -#include "emu.h" -#include "bus/comx35/exp.h" -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "imagedev/printer.h" -#include "imagedev/snapquik.h" -#include "machine/cdp1871.h" -#include "machine/ram.h" -#include "machine/rescap.h" -#include "sound/cdp1869.h" -#include "sound/wave.h" - -#define SCREEN_TAG "screen" - -#define CDP1870_TAG "u1" -#define CDP1869_TAG "u2" -#define CDP1802_TAG "u3" -#define CDP1871_TAG "u4" -#define EXPANSION_TAG "exp" - -#define COMX35_CHARRAM_SIZE 0x800 -#define COMX35_CHARRAM_MASK 0x7ff - -class comx35_state : public driver_device -{ -public: - comx35_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_vis(*this, CDP1869_TAG), - m_kbe(*this, CDP1871_TAG), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_exp(*this, EXPANSION_TAG), - m_rom(*this, CDP1802_TAG), - m_char_ram(*this, "char_ram"), - m_d6(*this, "D6"), - m_modifiers(*this, "MODIFIERS") - { } - - required_device m_maincpu; - required_device m_vis; - required_device m_kbe; - required_device m_cassette; - required_device m_ram; - required_device m_exp; - required_memory_region m_rom; - optional_shared_ptr m_char_ram; - required_ioport m_d6; - required_ioport m_modifiers; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - - enum - { - TIMER_ID_RESET - }; - - void check_interrupt(); - - DECLARE_READ8_MEMBER( mem_r ); - DECLARE_WRITE8_MEMBER( mem_w ); - DECLARE_READ8_MEMBER( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - DECLARE_WRITE8_MEMBER( cdp1869_w ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef4_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_WRITE8_MEMBER( sc_w ); - DECLARE_WRITE_LINE_MEMBER( irq_w ); - DECLARE_WRITE_LINE_MEMBER( prd_w ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_QUICKLOAD_LOAD_MEMBER( comx35_comx ); - void image_fread_memory(device_image_interface &image, UINT16 addr, UINT32 count); - CDP1869_CHAR_RAM_READ_MEMBER(comx35_charram_r); - CDP1869_CHAR_RAM_WRITE_MEMBER(comx35_charram_w); - CDP1869_PCB_READ_MEMBER(comx35_pcb_r); - - // processor state - int m_clear; // CPU mode - int m_q; // Q flag - int m_iden; // interrupt/DMA enable - int m_dma; // memory refresh DMA - int m_int; // interrupt request - int m_prd; // predisplay - int m_cr1; // interrupt enable -}; - -// ---------- defined in video/comx35.c ---------- - -MACHINE_CONFIG_EXTERN( comx35_pal_video ); -MACHINE_CONFIG_EXTERN( comx35_ntsc_video ); - -#endif diff --git a/src/mess/includes/concept.h b/src/mess/includes/concept.h deleted file mode 100644 index c9759c893a8..00000000000 --- a/src/mess/includes/concept.h +++ /dev/null @@ -1,71 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet, Brett Wyer -/***************************************************************************** - * - * includes/concept.h - * - * Corvus Concept driver - * - * Raphael Nabet, 2003 - * - ****************************************************************************/ - -#ifndef CONCEPT_H_ -#define CONCEPT_H_ - -#include "cpu/m68000/m68000.h" -#include "machine/6522via.h" -#include "machine/mos6551.h" -#include "machine/mm58274c.h" /* mm58274 seems to be compatible with mm58174 */ -#include "sound/speaker.h" -#include "bus/a2bus/a2bus.h" - -#define ACIA_0_TAG "acia0" -#define ACIA_1_TAG "acia1" -#define KBD_ACIA_TAG "kbacia" -#define SPEAKER_TAG "spkr" -#define A2BUS_TAG "a2bus" - -class concept_state : public driver_device -{ -public: - concept_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_acia0(*this, ACIA_0_TAG), - m_acia1(*this, ACIA_1_TAG), - m_kbdacia(*this, KBD_ACIA_TAG), - m_speaker(*this, SPEAKER_TAG), - m_mm58274(*this,"mm58274c"), - m_a2bus(*this, A2BUS_TAG), - m_videoram(*this,"videoram") { } - - required_device m_maincpu; - required_device m_acia0; - required_device m_acia1; - required_device m_kbdacia; - required_device m_speaker; - required_device m_mm58274; - required_device m_a2bus; - required_shared_ptr m_videoram; - - UINT8 m_pending_interrupts; - bool m_clock_enable; - UINT8 m_clock_address; - DECLARE_READ16_MEMBER(concept_io_r); - DECLARE_WRITE16_MEMBER(concept_io_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_concept(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER(via_in_a); - DECLARE_WRITE8_MEMBER(via_out_a); - DECLARE_READ8_MEMBER(via_in_b); - DECLARE_WRITE8_MEMBER(via_out_b); - DECLARE_WRITE_LINE_MEMBER(via_out_cb2); - DECLARE_WRITE_LINE_MEMBER(via_irq_func); - void concept_set_interrupt(int level, int state); -}; - -#endif /* CONCEPT_H_ */ diff --git a/src/mess/includes/cosmicos.h b/src/mess/includes/cosmicos.h deleted file mode 100644 index 9941d4b732f..00000000000 --- a/src/mess/includes/cosmicos.h +++ /dev/null @@ -1,147 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __COSMICOS__ -#define __COSMICOS__ - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "imagedev/snapquik.h" -#include "machine/rescap.h" -#include "sound/cdp1864.h" -#include "sound/speaker.h" -#include "video/dm9368.h" - -#define CDP1802_TAG "ic19" -#define CDP1864_TAG "ic3" -#define DM9368_TAG "ic10" -#define SCREEN_TAG "screen" - -enum -{ - LED_RUN = 0, - LED_LOAD, - LED_PAUSE, - LED_RESET, - LED_D7, - LED_D6, - LED_D5, - LED_D4, - LED_D3, - LED_D2, - LED_D1, - LED_D0, - LED_Q, - LED_CASSETTE -}; - -class cosmicos_state : public driver_device -{ -public: - cosmicos_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_cti(*this, CDP1864_TAG), - m_led(*this, DM9368_TAG), - m_cassette(*this, "cassette"), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG), - m_rom(*this, CDP1802_TAG), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_io_data(*this, "DATA"), - m_special(*this, "SPECIAL"), - m_buttons(*this, "BUTTONS") - { } - - required_device m_maincpu; - required_device m_cti; - required_device m_led; - required_device m_cassette; - required_device m_speaker; - required_device m_ram; - required_memory_region m_rom; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_io_data; - required_ioport m_special; - required_ioport m_buttons; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( video_off_r ); - DECLARE_READ8_MEMBER( video_on_r ); - DECLARE_WRITE8_MEMBER( audio_latch_w ); - DECLARE_READ8_MEMBER( hex_keyboard_r ); - DECLARE_WRITE8_MEMBER( hex_keylatch_w ); - DECLARE_READ8_MEMBER( reset_counter_r ); - DECLARE_WRITE8_MEMBER( segment_w ); - DECLARE_READ8_MEMBER( data_r ); - DECLARE_WRITE8_MEMBER( display_w ); - DECLARE_WRITE_LINE_MEMBER( dmaout_w ); - DECLARE_WRITE_LINE_MEMBER( efx_w ); - DECLARE_READ_LINE_MEMBER( wait_r ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef1_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_READ_LINE_MEMBER( ef4_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_READ8_MEMBER( dma_r ); - DECLARE_WRITE8_MEMBER( sc_w ); - DECLARE_INPUT_CHANGED_MEMBER( data ); - DECLARE_INPUT_CHANGED_MEMBER( enter ); - DECLARE_INPUT_CHANGED_MEMBER( single_step ); - DECLARE_INPUT_CHANGED_MEMBER( run ); - DECLARE_INPUT_CHANGED_MEMBER( load ); - DECLARE_INPUT_CHANGED_MEMBER( cosmicos_pause ); - DECLARE_INPUT_CHANGED_MEMBER( reset ); - DECLARE_INPUT_CHANGED_MEMBER( clear_data ); - DECLARE_INPUT_CHANGED_MEMBER( memory_protect ); - DECLARE_INPUT_CHANGED_MEMBER( memory_disable ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cosmicos ); - - void set_cdp1802_mode(int mode); - void clear_input_data(); - - /* CPU state */ - int m_wait; - int m_clear; - int m_sc1; - - /* memory state */ - UINT8 m_data; - int m_boot; - int m_ram_protect; - int m_ram_disable; - - /* keyboard state */ - ioport_port* m_key_row[4]; - UINT8 m_keylatch; - - /* display state */ - UINT8 m_segment; - int m_digit; - int m_counter; - int m_q; - int m_dmaout; - int m_efx; - int m_video_on; - - DECLARE_DRIVER_INIT(cosmicos); - TIMER_DEVICE_CALLBACK_MEMBER(digit_tick); - TIMER_DEVICE_CALLBACK_MEMBER(int_tick); -}; - -#endif diff --git a/src/mess/includes/crvision.h b/src/mess/includes/crvision.h deleted file mode 100644 index 0956119c4c7..00000000000 --- a/src/mess/includes/crvision.h +++ /dev/null @@ -1,114 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Curt Coder - -#ifndef __CRVISION__ -#define __CRVISION__ - - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "imagedev/cassette.h" -#include "machine/6821pia.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "bus/crvision/slot.h" -#include "bus/crvision/rom.h" -#include "machine/ram.h" -#include "sound/sn76496.h" -#include "sound/wave.h" -#include "video/tms9928a.h" - -#define SCREEN_TAG "screen" -#define M6502_TAG "u2" -#define TMS9929_TAG "u3" -#define PIA6821_TAG "u21" -#define SN76489_TAG "u22" -#define CENTRONICS_TAG "centronics" - -#define BANK_ROM1 "bank1" -#define BANK_ROM2 "bank2" - -class crvision_state : public driver_device -{ -public: - crvision_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6502_TAG), - m_pia(*this, PIA6821_TAG), - m_psg(*this, SN76489_TAG), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_cent_data_out(*this, "cent_data_out"), - m_ram(*this, RAM_TAG), - m_inp_pa0(*this, "PA0"), - m_inp_pa1(*this, "PA1"), - m_inp_pa2(*this, "PA2"), - m_inp_pa3(*this, "PA3") - { } - - required_device m_maincpu; - required_device m_pia; - required_device m_psg; - required_device m_cassette; - required_device m_cart; - required_device m_cent_data_out; - required_device m_ram; - optional_ioport_array<8> m_inp_pa0; - optional_ioport_array<8> m_inp_pa1; - optional_ioport_array<8> m_inp_pa2; - optional_ioport_array<8> m_inp_pa3; - - UINT8 m_keylatch; - UINT8 read_keyboard(int pa); - - DECLARE_WRITE8_MEMBER( pia_pa_w ); - DECLARE_READ8_MEMBER( pia_pa_r ); - DECLARE_READ8_MEMBER( pia_pb_r ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); - -protected: - virtual void machine_start(); -}; - -class crvision_pal_state : public crvision_state -{ -public: - crvision_pal_state(const machine_config &mconfig, device_type type, const char *tag) - : crvision_state(mconfig, type, tag) - { } -}; - -class laser2001_state : public crvision_state -{ -public: - laser2001_state(const machine_config &mconfig, device_type type, const char *tag) - : crvision_state(mconfig, type, tag), - m_centronics(*this, CENTRONICS_TAG), - m_inp_y(*this, "Y"), - m_inp_joy(*this, "JOY") - { } - - required_device m_centronics; - required_ioport_array<8> m_inp_y; - required_ioport_array<4> m_inp_joy; - - UINT8 m_joylatch; - int m_centronics_busy; - int m_psg_ready; - - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_WRITE_LINE_MEMBER( write_psg_ready ); - DECLARE_READ8_MEMBER( pia_pa_r ); - DECLARE_WRITE8_MEMBER( pia_pa_w ); - DECLARE_READ8_MEMBER( pia_pb_r ); - DECLARE_WRITE8_MEMBER( pia_pb_w ); - DECLARE_READ_LINE_MEMBER( pia_ca1_r ); - DECLARE_WRITE_LINE_MEMBER( pia_ca2_w ); - DECLARE_READ_LINE_MEMBER( pia_cb1_r ); - DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); - -protected: - virtual void machine_start(); -}; - -#endif // __CRVISION__ diff --git a/src/mess/includes/cxhumax.h b/src/mess/includes/cxhumax.h deleted file mode 100644 index 1fd1e4d7568..00000000000 --- a/src/mess/includes/cxhumax.h +++ /dev/null @@ -1,281 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Lukasz Markowski -#ifndef CXHUMAX_H_ -#define CXHUMAX_H_ - -#include "cpu/arm7/arm7.h" -#include "cpu/arm7/arm7core.h" -#include "machine/intelfsh.h" -#include "machine/i2cmem.h" -#include "machine/terminal.h" - -#define MAX_CX_TIMERS 16 - -struct cx_timer_t -{ - UINT32 value; - UINT32 limit; - UINT32 mode; - UINT32 timebase; - emu_timer *timer; -}; - -struct cx_timer_regs_t -{ - cx_timer_t timer[MAX_CX_TIMERS]; - UINT32 timer_irq; -}; - -#define TERMINAL_TAG "terminal" - -class cxhumax_state : public driver_device -{ -public: - cxhumax_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_flash(*this, "flash"), - m_ram(*this, "ram"), - m_terminal(*this, TERMINAL_TAG), - m_i2cmem(*this, "eeprom") - { - } - - required_device m_maincpu; - required_device m_flash; - required_shared_ptr m_ram; - required_device m_terminal; - - DECLARE_WRITE32_MEMBER ( flash_w ); - DECLARE_READ32_MEMBER ( flash_r ); - - DECLARE_WRITE32_MEMBER ( cx_hsx_w ); - DECLARE_READ32_MEMBER ( cx_hsx_r ); - - DECLARE_WRITE32_MEMBER ( cx_romdescr_w ); - DECLARE_READ32_MEMBER ( cx_romdescr_r ); - DECLARE_WRITE32_MEMBER ( cx_isaromdescr_w ); - DECLARE_READ32_MEMBER ( cx_isaromdescr_r ); - DECLARE_WRITE32_MEMBER ( cx_isadescr_w ); - DECLARE_READ32_MEMBER ( cx_isadescr_r ); - DECLARE_WRITE32_MEMBER ( cx_rommap_w ); - DECLARE_READ32_MEMBER ( cx_rommap_r ); - DECLARE_WRITE32_MEMBER ( cx_rommode_w ); - DECLARE_READ32_MEMBER ( cx_rommode_r ); - DECLARE_WRITE32_MEMBER ( cx_xoemask_w ); - DECLARE_READ32_MEMBER ( cx_xoemask_r ); - DECLARE_WRITE32_MEMBER ( cx_pci_w ); - DECLARE_READ32_MEMBER ( cx_pci_r ); - DECLARE_WRITE32_MEMBER ( cx_extdesc_w ); - DECLARE_READ32_MEMBER ( cx_extdesc_r ); - - DECLARE_WRITE32_MEMBER ( cx_remap_w ); - DECLARE_WRITE32_MEMBER ( cx_scratch_w ); - DECLARE_READ32_MEMBER ( cx_scratch_r ); - - DECLARE_WRITE32_MEMBER ( cx_timers_w ); - DECLARE_READ32_MEMBER ( cx_timers_r ); - - DECLARE_WRITE32_MEMBER ( cx_uart2_w ); - DECLARE_READ32_MEMBER ( cx_uart2_r ); - - DECLARE_WRITE32_MEMBER ( cx_pll_w ); - DECLARE_READ32_MEMBER ( cx_pll_r ); - DECLARE_WRITE32_MEMBER ( cx_clkdiv_w ); - DECLARE_READ32_MEMBER ( cx_clkdiv_r ); - DECLARE_WRITE32_MEMBER ( cx_pllprescale_w ); - DECLARE_READ32_MEMBER ( cx_pllprescale_r ); - - DECLARE_WRITE32_MEMBER ( cx_chipcontrol_w ); - DECLARE_READ32_MEMBER ( cx_chipcontrol_r ); - - DECLARE_WRITE32_MEMBER ( cx_intctrl_w ); - DECLARE_READ32_MEMBER ( cx_intctrl_r ); - - DECLARE_WRITE32_MEMBER ( cx_ss_w ); - DECLARE_READ32_MEMBER ( cx_ss_r ); - - DECLARE_WRITE32_MEMBER ( cx_i2c0_w ); - DECLARE_READ32_MEMBER ( cx_i2c0_r ); - DECLARE_WRITE32_MEMBER ( cx_i2c1_w ); - DECLARE_READ32_MEMBER ( cx_i2c1_r ); - DECLARE_WRITE32_MEMBER ( cx_i2c2_w ); - DECLARE_READ32_MEMBER ( cx_i2c2_r ); - - DECLARE_WRITE32_MEMBER ( cx_mc_cfg_w ); - DECLARE_READ32_MEMBER ( cx_mc_cfg_r ); - - DECLARE_WRITE32_MEMBER ( cx_drm0_w ); - DECLARE_READ32_MEMBER ( cx_drm0_r ); - DECLARE_WRITE32_MEMBER ( cx_drm1_w ); - DECLARE_READ32_MEMBER ( cx_drm1_r ); - - DECLARE_WRITE32_MEMBER ( cx_hdmi_w ); - DECLARE_READ32_MEMBER ( cx_hdmi_r ); - - DECLARE_WRITE32_MEMBER ( cx_gxa_w ); - DECLARE_READ32_MEMBER ( cx_gxa_r ); - - DECLARE_READ32_MEMBER ( dummy_flash_r ); - - UINT32 m_romdescr_reg; - UINT32 m_isaromdescr_regs[0x0C/4]; - UINT32 m_isadescr_regs[0x10/4]; - UINT32 m_rommode_reg; - UINT32 m_xoemask_reg; - UINT32 m_pci_regs[0x08/4]; - UINT32 m_extdesc_regs[0x80/4]; - - UINT32 m_scratch_reg; - cx_timer_regs_t m_timer_regs; - - UINT32 m_uart2_regs[0x30/4]; - - UINT32 m_pll_regs[0x14/4]; - UINT32 m_clkdiv_regs[0x18/4]; - UINT32 m_pllprescale_reg; - - UINT32 m_intctrl_regs[0x38/4]; - - UINT32 m_ss_regs[0x18/4]; - UINT8 m_ss_tx_fifo[8]; // 8 entries (size hardcoded to 8 bits per entry - TODO) - - UINT32 m_i2c0_regs[0x20/4]; - UINT32 m_i2c1_regs[0x20/4]; - required_device m_i2cmem; - UINT32 m_i2c2_regs[0x20/4]; - - void i2cmem_start(); - void i2cmem_stop(); - UINT8 i2cmem_read_byte(int last); - void i2cmem_write_byte(UINT8 data); - - UINT32 m_mccfg_regs[0x0C/4]; - - UINT32 m_chipcontrol_regs[0x74/4]; - - UINT32 m_drm0_regs[0xfc/4]; - UINT32 m_drm1_regs[0xfc/4]; - - UINT32 m_hdmi_regs[0x400/4]; - - UINT32 m_gxa_cmd_regs[0x130/4]; - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_cxhumax(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(timer_tick); -}; - -#define INTDEST 0 // Interrupt destination (1=IRQ, 0=FIQ) -#define INTENABLE 1 // Enables the interrupt generation -#define INTIRQ 2 // Normal interrupt -#define INTFIQ 3 // Fast interrupt -#define INTSTATCLR 4 // Read: interrupt status, Write: clear pending interrupt -#define INTSTATSET 5 // Read: interrupt status, Write: sets a pending interrupt -#define INTGROUP1 0 -#define INTGROUP2 1 - -#define INTREG(group, index) (((group) << 3) | (index)) - -#define GXA_CMD_RW_REGISTER 0x00 -#define GXA_CMD_QMARK 0x02 -#define GXA_CMD_PALETTE_FETCH 0x03 -#define GXA_CMD_VFILTER_COEFF_FETCH 0x04 -#define GXA_CMD_HFILTER_COEFF_FETCH 0x05 -#define GXA_CMD_BLT_21 0x21 -#define GXA_CMD_BLT_23 0x23 -#define GXA_CMD_BLT_25 0x25 -#define GXA_CMD_BLT_27 0x27 -#define GXA_CMD_BLT_2B 0x2b -#define GXA_CMD_BLT_2F 0x2f -#define GXA_CMD_LINE_30 0x30 -#define GXA_CMD_LINE_32 0x32 -#define GXA_CMD_BLT_31 0x31 -#define GXA_CMD_BLT 0x33 -#define GXA_CMD_LINE_34 0x34 -#define GXA_CMD_LINE_36 0x36 -#define GXA_CMD_BLT_35 0x35 -#define GXA_CMD_BLT_37 0x37 -#define GXA_CMD_LINE_3A 0x3a -#define GXA_CMD_BLT_3B 0x3b -#define GXA_CMD_LINE_3E 0x3e -#define GXA_CMD_BLT_3F 0x3f -#define GXA_CMD_SBLT_ABLEND 0x71 -#define GXA_CMD_SBLT_ROP 0x7b - -#define GXA_CMD_REG 0x07 - -#define GXA_CFG2_REG 0x3f -#define IRQ_STAT_QMARK 21 -#define IRQ_EN_QMARK 17 - -#define INT_UART2_BIT (1<<1) -#define INT_TIMER_BIT (1<<7) -#define INT_PWM_BIT (1 << 14) -#define INT_PIO103_BIT (1 << 15) - -#define PCI_CFG_ADDR_REG 0 -#define PCI_CFG_DATA_REG 1 - -#define TIMER_VALUE 0 -#define TIMER_LIMIT 1 -#define TIMER_MODE 2 -#define TIMER_TIMEBASE 3 - -#define UART_FIFO_REG 0 -#define UART_IRQE_REG 1 -#define UART_IRQE_TIDE_BIT (1<<6) -#define UART_BRDL_REG 0 -#define UART_BRDU_REG 1 -#define UART_FIFC_REG 2 -#define UART_FRMC_REG 3 -#define UART_FRMC_BDS_BIT (1<<7) -#define UART_STAT_REG 5 -#define UART_STAT_TSR_BIT (1<<5) -#define UART_STAT_TID_BIT (1<<6) - -#define SREG_MPG_0_INTFRAC_REG 0 -#define SREG_MPG_1_INTFRAC_REG 1 -#define SREG_ARM_INTFRAC_REG 2 -#define SREG_MEM_INTFRAC_REG 3 -#define SREG_USB_INTFRAC_REG 4 - -#define SREG_DIV_0_REG 0 -#define SREG_DIV_1_REG 1 -#define SREG_DIV_2_REG 2 -#define SREG_DIV_3_REG 3 -#define SREG_DIV_4_REG 4 -#define SREG_DIV_5_REG 5 - -#define PIN_CONFIG_0_REG 0 // Pin Configuration 0 Register -#define SREG_MODE_REG 3 // SREG Mode Register -#define PIN_ALT_FUNC_REG 4 // Alternate Pin Function Select Register -#define PLL_LOCK_STAT_0_REG 9 // Resource Lock Register -#define PLL_IO_CTL_REG 20 // IO Control Register -#define SREG_TEST_REG 28 // Test Register - -#define I2C_MODE_REG 0 -#define I2C_CTRL_REG 1 -#define I2C_STAT_REG 2 -#define I2C_RDATA_REG 3 - -#define I2C_WACK_BIT (1<<1) -#define I2C_INT_BIT (1<<0) - -#define SS_CNTL_REG 0 -#define SS_FIFC_REG 1 -#define SS_BAUD_REG 2 -#define SS_FIFO_REG 4 -#define SS_STAT_REG 5 - -#define MC_CFG0 0 -#define MC_CFG1 1 -#define MC_CFG2 2 - -#define DRM_ACTIVE_X_REG 1 -#define DRM_ACTIVE_Y_REG 2 -#define DRM_BCKGND_REG 3 -#define DRM_OSD_PTR_REG 32 - -#endif /* CXHUMAX_H_ */ diff --git a/src/mess/includes/cybiko.h b/src/mess/includes/cybiko.h deleted file mode 100644 index 7bf4e0834de..00000000000 --- a/src/mess/includes/cybiko.h +++ /dev/null @@ -1,106 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/***************************************************************************** - * - * includes/cybiko.h - * - * Cybiko Wireless Inter-tainment System - * - * (c) 2001-2007 Tim Schuerewegen - * - * Cybiko Classic (V1) - * Cybiko Classic (V2) - * Cybiko Xtreme - * - ****************************************************************************/ - -#ifndef CYBIKO_H_ -#define CYBIKO_H_ - -/* Core includes */ -#include "emu.h" -#include "emuopts.h" -#include "sound/speaker.h" - -/* Components */ -#include "cpu/h8/h8s2320.h" -#include "cpu/h8/h8s2245.h" -#include "video/hd66421.h" -#include "machine/pcf8593.h" -#include "machine/at45dbxx.h" -#include "machine/intelfsh.h" -#include "machine/ram.h" -#include "imagedev/snapquik.h" -#include "machine/nvram.h" - -struct CYBIKO_RS232_PINS -{ - int sck; // serial clock - int txd; // transmit data - int rxd; // receive data -}; - -struct CYBIKO_RS232 -{ - CYBIKO_RS232_PINS pin; - UINT8 rx_bits, rx_byte, tx_byte, tx_bits; -}; - -class cybiko_state : public driver_device -{ -public: - cybiko_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "hd66421"), - m_speaker(*this, "speaker"), - m_rtc(*this, "rtc"), - m_ram(*this, RAM_TAG), - m_flash1(*this, "flash1"), - m_nvram(*this, "nvram"), - m_input(*this, "A") - { } - - DECLARE_READ16_MEMBER(serflash_r); - DECLARE_WRITE16_MEMBER(serflash_w); - DECLARE_READ16_MEMBER(clock_r); - DECLARE_WRITE16_MEMBER(clock_w); - DECLARE_READ16_MEMBER(xtclock_r); - DECLARE_WRITE16_MEMBER(xtclock_w); - DECLARE_READ16_MEMBER(xtpower_r); - - CYBIKO_RS232 m_rs232; - DECLARE_READ16_MEMBER(cybiko_lcd_r); - DECLARE_WRITE16_MEMBER(cybiko_lcd_w); - DECLARE_READ16_MEMBER(cybikov1_key_r); - DECLARE_READ16_MEMBER(cybikov2_key_r); - DECLARE_READ16_MEMBER(cybikoxt_key_r); - DECLARE_WRITE16_MEMBER(cybiko_usb_w); - int cybiko_key_r( offs_t offset, int mem_mask); - void cybiko_rs232_write_byte(int data); - void cybiko_rs232_pin_sck(int data); - void cybiko_rs232_pin_txd(int data); - int cybiko_rs232_pin_rxd(); - int cybiko_rs232_rx_queue(); - void cybiko_rs232_init(); - void cybiko_rs232_exit(); - void cybiko_rs232_reset(); - - required_device m_maincpu; - required_device m_crtc; - required_device m_speaker; - required_device m_rtc; - required_device m_ram; - optional_device m_flash1; - required_device m_nvram; - optional_ioport_array<15> m_input; - DECLARE_DRIVER_INIT(cybikoxt); - DECLARE_DRIVER_INIT(cybiko); - virtual void machine_start(); - virtual void machine_reset(); - void machine_stop_cybiko(); - DECLARE_QUICKLOAD_LOAD_MEMBER( cybiko ); - DECLARE_QUICKLOAD_LOAD_MEMBER( cybikoxt ); -}; - -#endif /* CYBIKO_H_ */ diff --git a/src/mess/includes/dai.h b/src/mess/includes/dai.h deleted file mode 100644 index 2eb2d403979..00000000000 --- a/src/mess/includes/dai.h +++ /dev/null @@ -1,81 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha, Nathan Woods -/***************************************************************************** - * - * includes/dai.h - * - ****************************************************************************/ - -#ifndef DAI_H_ -#define DAI_H_ - -#include "cpu/i8085/i8085.h" -#include "audio/dai_snd.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "machine/tms5501.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" - - -class dai_state : public driver_device -{ -public: - enum - { - TIMER_BOOTSTRAP, - TIMER_TMS5501 - }; - - dai_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pit(*this, "pit8253"), - m_tms5501(*this, "tms5501"), - m_sound(*this, "custom"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") { } - - required_device m_maincpu; - required_device m_pit; - required_device m_tms5501; - required_device m_sound; - required_device m_cassette; - required_device m_ram; - required_device m_palette; - - UINT8 m_paddle_select; - UINT8 m_paddle_enable; - UINT8 m_cassette_motor[2]; - UINT8 m_keyboard_scan_mask; - unsigned short m_4_colours_palette[4]; - DECLARE_WRITE8_MEMBER(dai_stack_interrupt_circuit_w); - DECLARE_READ8_MEMBER(dai_io_discrete_devices_r); - DECLARE_WRITE8_MEMBER(dai_io_discrete_devices_w); - DECLARE_READ8_MEMBER(dai_amd9511_r); - DECLARE_WRITE8_MEMBER(dai_amd9511_w); - DECLARE_READ8_MEMBER(dai_pit_r); - DECLARE_WRITE8_MEMBER(dai_pit_w); - DECLARE_READ8_MEMBER(dai_keyboard_r); - DECLARE_WRITE8_MEMBER(dai_keyboard_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(dai); - UINT32 screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void dai_update_memory(int dai_rom_bank); - IRQ_CALLBACK_MEMBER(int_ack); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -/*----------- defined in video/dai.c -----------*/ - -extern const unsigned char dai_palette[16*3]; - - -#endif /* DAI_H_ */ diff --git a/src/mess/includes/dccons.h b/src/mess/includes/dccons.h deleted file mode 100644 index 47b47d72f6c..00000000000 --- a/src/mess/includes/dccons.h +++ /dev/null @@ -1,48 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese, R. Belmont -#include "imagedev/chd_cd.h" -#include "machine/gdrom.h" -#include "machine/ataintf.h" -#include "machine/intelfsh.h" - -class dc_cons_state : public dc_state -{ -public: - dc_cons_state(const machine_config &mconfig, device_type type, const char *tag) - : dc_state(mconfig, type, tag), - m_ata(*this, "ata") -// m_dcflash(*this, "dcflash") - { } - - required_device m_ata; -// required_device m_dcflash; - - DECLARE_DRIVER_INIT(dc); - DECLARE_DRIVER_INIT(dcus); - DECLARE_DRIVER_INIT(dcjp); - - DECLARE_READ64_MEMBER(dcus_idle_skip_r); - DECLARE_READ64_MEMBER(dcjp_idle_skip_r); - - DECLARE_MACHINE_RESET(dc_console); - DECLARE_READ64_MEMBER(dc_pdtra_r); - DECLARE_WRITE64_MEMBER(dc_pdtra_w); - DECLARE_READ64_MEMBER(dc_arm_r); - DECLARE_WRITE64_MEMBER(dc_arm_w); - DECLARE_WRITE_LINE_MEMBER(aica_irq); - DECLARE_WRITE_LINE_MEMBER(sh4_aica_irq); - DECLARE_WRITE_LINE_MEMBER(ata_interrupt); - - TIMER_CALLBACK_MEMBER( atapi_xfer_end ); - - void dreamcast_atapi_init(); - DECLARE_READ32_MEMBER( dc_mess_g1_ctrl_r ); - DECLARE_WRITE32_MEMBER( dc_mess_g1_ctrl_w ); -// DECLARE_READ8_MEMBER( dc_flash_r ); -// DECLARE_WRITE8_MEMBER( dc_flash_w ); - -private: - UINT64 PDTRA, PCTRA; - emu_timer *atapi_timer; - int atapi_xferlen, atapi_xferbase; -}; diff --git a/src/mess/includes/dgn_beta.h b/src/mess/includes/dgn_beta.h deleted file mode 100644 index 3869f71fffc..00000000000 --- a/src/mess/includes/dgn_beta.h +++ /dev/null @@ -1,226 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/***************************************************************************** - * - * includes/dgn_beta.h - * - ****************************************************************************/ - -#ifndef DGN_BETA_H_ -#define DGN_BETA_H_ - -#include "video/mc6845.h" -#include "machine/wd_fdc.h" -#include "machine/6821pia.h" -#include "machine/ram.h" - -/* Tags */ - -#define MAINCPU_TAG "maincpu" -#define DMACPU_TAG "dmacpu" -#define PIA_0_TAG "pia_0" -#define PIA_1_TAG "pia_1" -#define PIA_2_TAG "pia_2" -#define FDC_TAG "wd2797" - - -#define DGNBETA_CPU_SPEED_HZ 2000000 /* 2MHz */ -#define DGNBETA_FRAMES_PER_SECOND 50 - -#define RamSize 256 /* 256K by default */ -#define RamPageSize 4096 /* ram pages are 4096 bytes */ - -#define MaxTasks 16 /* Tasks 0..15 */ -#define MaxPage 16 /* 16 4K pages */ -#define NoPagingTask MaxTasks /* Task registers to use when paging disabled 16 */ - -#define RAMPage 0 /* Page with RAM in at power on */ -#define VideoPage 6 /* Page where video ram mapped */ -#define IOPage MaxPage-1 /* Page for I/O */ -#define ROMPage MaxPage-2 /* Page for ROM */ -#define LastPage MaxPage-1 - -#define RAMPageValue 0x00 /* page with RAM at power on */ -#define VideoPageValue 0x1F /* Default page for video ram */ -#define NoMemPageValue 0xC0 /* Page guaranteed not to have memory in */ -#define ROMPageValue 0xFE /* Page with boot ROM */ -#define IOPageValue 0xFF /* Page with I/O & Boot ROM */ - -#define TextVidBasePage 0x18 /* Base page of text video ram */ - -/***** Keyboard stuff *****/ -#define NoKeyrows 0x0a /* Number of rows in keyboard */ - -/* From Dragon Beta OS9 keyboard driver */ -#define KAny 0x04 /* Any key pressed mask PB2 */ -#define KOutClk 0x08 /* Ouput shift register clock */ -#define KInClk 0x10 /* Input shift register clock */ -#define KOutDat KInClk /* Also used for data into output shifter */ -#define KInDat 0x20 /* Keyboard data in from keyboard (serial stream) */ - -/***** Video Modes *****/ - -enum BETA_VID_MODES -{ - TEXT_40x25, /* Text mode 40x25 */ - TEXT_80x25, /* Text mode 80x25 */ - GRAPH_320x256x4, /* Graphics 320x256x4 */ - GRAPH_320x256x16, /* Graphics 320x256x16 */ - GRAPH_640x512x2 /* Graphics 640X512X2 */ -}; - -#define iosize (0xfEFF-0xfc00) - -struct PageReg -{ - int value; /* Value of the page register */ - UINT8 *memory; /* The memory it actually points to */ -}; - - -class dgn_beta_state : public driver_device -{ -public: - dgn_beta_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_mc6845(*this, "crtc"), - m_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_fdc(*this, FDC_TAG), - m_floppy0(*this, FDC_TAG ":0"), - m_floppy1(*this, FDC_TAG ":1"), - m_floppy2(*this, FDC_TAG ":2"), - m_floppy3(*this, FDC_TAG ":3"), - m_palette(*this, "palette") { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - required_device m_mc6845; - required_shared_ptr m_videoram; - - UINT8 *m_system_rom; - int m_LogDatWrites; - int m_Keyboard[NoKeyrows]; - int m_RowShifter; - int m_Keyrow; - int m_d_pia0_pb_last; - int m_d_pia0_cb2_last; - int m_KInDat_next; - int m_KAny_next; - int m_d_pia1_pa_last; - int m_d_pia1_pb_last; - int m_DMA_NMI_LAST; - int m_wd2797_written; - int m_TaskReg; - int m_PIATaskReg; - int m_EnableMapRegs; - PageReg m_PageRegs[MaxTasks+1][MaxPage+1]; - int m_beta_6845_RA; - int m_beta_scr_x; - int m_beta_scr_y; - int m_beta_HSync; - int m_beta_VSync; - int m_beta_DE; - int m_LogRegWrites; - int m_BoxColour; - int m_BoxMinX; - int m_BoxMinY; - int m_BoxMaxX; - int m_BoxMaxY; - int m_HSyncMin; - int m_VSyncMin; - int m_DEPos; - int m_NoScreen; - bitmap_ind16 *m_bit; - int m_MinAddr; - int m_MaxAddr; - int m_MinX; - int m_MaxX; - int m_MinY; - int m_MaxY; - int m_VidAddr; - int m_ClkMax; - int m_GCtrl; - int m_FlashCount; - int m_FlashBit; - int m_s_DoubleY; - int m_DoubleHL; - int m_ColourRAM[4]; - int m_Field; - int m_DrawInterlace; - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(dgn); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b0_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b1_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b2_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b3_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b4_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b5_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b6_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b7_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b8_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_b9_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_bA_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_bB_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_bC_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_bD_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_bE_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_bF_w); - DECLARE_WRITE8_MEMBER(dgnbeta_ram_bG_w); - DECLARE_READ8_MEMBER(d_pia0_pa_r); - DECLARE_WRITE8_MEMBER(d_pia0_pa_w); - DECLARE_READ8_MEMBER(d_pia0_pb_r); - DECLARE_WRITE8_MEMBER(d_pia0_pb_w); - DECLARE_WRITE_LINE_MEMBER(d_pia0_cb2_w); - DECLARE_WRITE_LINE_MEMBER(d_pia0_irq_a); - DECLARE_WRITE_LINE_MEMBER(d_pia0_irq_b); - DECLARE_READ8_MEMBER(d_pia1_pa_r); - DECLARE_WRITE8_MEMBER(d_pia1_pa_w); - DECLARE_READ8_MEMBER(d_pia1_pb_r); - DECLARE_WRITE8_MEMBER(d_pia1_pb_w); - DECLARE_WRITE_LINE_MEMBER(d_pia1_irq_a); - DECLARE_WRITE_LINE_MEMBER(d_pia1_irq_b); - DECLARE_READ8_MEMBER(d_pia2_pa_r); - DECLARE_WRITE8_MEMBER(d_pia2_pa_w); - DECLARE_READ8_MEMBER(d_pia2_pb_r); - DECLARE_WRITE8_MEMBER(d_pia2_pb_w); - DECLARE_WRITE_LINE_MEMBER(d_pia2_irq_a); - DECLARE_WRITE_LINE_MEMBER(d_pia2_irq_b); - DECLARE_WRITE_LINE_MEMBER(dgnbeta_fdc_intrq_w); - DECLARE_WRITE_LINE_MEMBER(dgnbeta_fdc_drq_w); - DECLARE_WRITE_LINE_MEMBER(dgnbeta_vsync_changed); - /* 74HC670 4x4bit colour ram */ - DECLARE_WRITE8_MEMBER(dgnbeta_colour_ram_w); - // Page IO at FE00 - DECLARE_READ8_MEMBER(dgn_beta_page_r); - DECLARE_WRITE8_MEMBER(dgn_beta_page_w); - MC6845_UPDATE_ROW(crtc_update_row); - - /* WD2797 FDC */ - DECLARE_READ8_MEMBER(dgnbeta_wd2797_r); - DECLARE_WRITE8_MEMBER(dgnbeta_wd2797_w); - required_device m_maincpu; - void dgnbeta_vid_set_gctrl(int data); - void UpdateBanks(int first, int last); - void SetDefaultTask(); - void dgn_beta_bank_memory(int offset, int data, int bank); - int SelectedKeyrow(dgn_beta_state *state, int Rows); - int GetKeyRow(dgn_beta_state *state, int RowNo); - void cpu0_recalc_irq(int state); - void cpu0_recalc_firq(int state); - void cpu1_recalc_firq(int state); - void ScanInKeyboard(void); - void dgn_beta_frame_interrupt (int data); - void dgn_beta_line_interrupt (int data); - required_device m_ram; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_device m_palette; -}; - -#endif /* DGN_BETA_H_ */ diff --git a/src/mess/includes/dgnalpha.h b/src/mess/includes/dgnalpha.h deleted file mode 100644 index 402de4f846f..00000000000 --- a/src/mess/includes/dgnalpha.h +++ /dev/null @@ -1,97 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - dgnalpha.h - - Dragon Alpha - -***************************************************************************/ - -#pragma once - -#ifndef __DGNALPHA__ -#define __DGNALPHA__ - - -#include "includes/dragon.h" -#include "sound/ay8910.h" -#include "machine/wd_fdc.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -/* devices */ -#define PIA2_TAG "pia2" -#define AY8912_TAG "ay8912" -#define WD2797_TAG "wd2797" - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class dragon_alpha_state : public dragon64_state -{ -public: - dragon_alpha_state(const machine_config &mconfig, device_type type, const char *tag) - : dragon64_state(mconfig, type, tag), - m_pia_2(*this, PIA2_TAG), - m_ay8912(*this, AY8912_TAG), - m_fdc(*this, WD2797_TAG), - m_floppy0(*this, WD2797_TAG ":0"), - m_floppy1(*this, WD2797_TAG ":1"), - m_floppy2(*this, WD2797_TAG ":2"), - m_floppy3(*this, WD2797_TAG ":3") - { - } - - DECLARE_FLOPPY_FORMATS(dragon_formats); - - required_device m_pia_2; - required_device m_ay8912; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - - - /* pia2 */ - DECLARE_WRITE8_MEMBER( pia2_pa_w ); - DECLARE_WRITE_LINE_MEMBER( pia2_firq_a ); - DECLARE_WRITE_LINE_MEMBER( pia2_firq_b ); - - /* psg */ - DECLARE_READ8_MEMBER( psg_porta_read ); - DECLARE_WRITE8_MEMBER( psg_porta_write ); - - /* fdc */ - DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - -protected: - /* driver overrides */ - virtual void device_start(void); - virtual void device_reset(void); - - /* interrupts */ - virtual bool firq_get_line(void); - - /* PIA1 */ - virtual DECLARE_READ8_MEMBER( ff20_read ); - virtual DECLARE_WRITE8_MEMBER( ff20_write ); - -private: - UINT8 m_just_reset; - - /* modem */ - UINT8 modem_r(offs_t offset); - void modem_w(offs_t offset, UINT8 data); -}; - -#endif /* __DGNALPHA__ */ diff --git a/src/mess/includes/dm7000.h b/src/mess/includes/dm7000.h deleted file mode 100644 index 241ba0d31b6..00000000000 --- a/src/mess/includes/dm7000.h +++ /dev/null @@ -1,94 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Lukasz Markowski -#ifndef DM7000_H_ -#define DM7000_H_ - -#include "emu.h" -#include "cpu/powerpc/ppc.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class dm7000_state : public driver_device -{ -public: - dm7000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } - - required_device m_maincpu; - required_device m_terminal; - - DECLARE_WRITE8_MEMBER ( dm7000_iic0_w ); - DECLARE_READ8_MEMBER ( dm7000_iic0_r ); - DECLARE_WRITE8_MEMBER ( dm7000_iic1_w ); - DECLARE_READ8_MEMBER ( dm7000_iic1_r ); - - DECLARE_WRITE8_MEMBER ( dm7000_scc0_w ); - DECLARE_READ8_MEMBER ( dm7000_scc0_r ); - DECLARE_WRITE8_MEMBER(kbd_put); - UINT8 m_scc0_lcr; - UINT8 m_scc0_lsr; - UINT8 m_term_data; - - - DECLARE_WRITE8_MEMBER ( dm7000_gpio0_w ); - DECLARE_READ8_MEMBER ( dm7000_gpio0_r ); - - DECLARE_WRITE8_MEMBER ( dm7000_scp0_w ); - DECLARE_READ8_MEMBER ( dm7000_scp0_r ); - - DECLARE_WRITE16_MEMBER ( dm7000_enet_w ); - DECLARE_READ16_MEMBER ( dm7000_enet_r ); - - DECLARE_READ32_MEMBER( dcr_r ); - DECLARE_WRITE32_MEMBER( dcr_w ); - - - UINT16 m_enet_regs[32]; - - UINT32 dcr[1024]; - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_dm7000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); -}; - -/* */ -#define UART_DLL 0 -#define UART_RBR 0 -#define UART_THR 0 -#define UART_DLH 1 -#define UART_IER 1 -#define UART_IIR 2 -#define UART_FCR 2 -#define UART_LCR 3 -#define UART_LCR_DLAB 0x80 -#define UART_MCR 4 -#define UART_LSR 5 -#define UART_LSR_TEMT 0x20 -#define UART_LSR_THRE 0x40 -#define UART_MSR 6 -#define UART_SCR 7 - -/* */ -#define SCP_SPMODE 0 -#define SCP_RXDATA 1 -#define SCP_TXDATA 2 -#define SCP_SPCOM 3 -#define SCP_STATUS 4 -#define SCP_STATUS_RXRDY 1 -#define SCP_CDM 6 - -/* STB045xxx DCRs */ - -#define DCRSTB045_CICVCR 0x033 /* CIC Video Control Register */ -#define DCRSTB045_SCCR 0x120 /* Serial Clock Control Register */ -#define DCRSTB045_VIDEO_CNTL 0x140 /* Video Control Register */ -#define DCRSTB045_CMD_STAT 0x14a /* Command status */ -#define DCRSTB045_DISP_MODE 0x154 /* Display Mode Register */ -#define DCRSTB045_FRAME_BUFR_BASE 0x179 /* Frame Buffers Base Address Register */ - -#endif /* DM7000_H_ */ diff --git a/src/mess/includes/dragon.h b/src/mess/includes/dragon.h deleted file mode 100644 index 7006d37e68d..00000000000 --- a/src/mess/includes/dragon.h +++ /dev/null @@ -1,72 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - dragon.h - - Dragon Family - -***************************************************************************/ - -#pragma once - -#ifndef __DRAGON__ -#define __DRAGON__ - - -#include "includes/coco12.h" -#include "imagedev/printer.h" -#include "machine/mos6551.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define PRINTER_TAG "printer" -#define ACIA_TAG "acia" - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class dragon_state : public coco12_state -{ -public: - dragon_state(const machine_config &mconfig, device_type type, const char *tag) - : coco12_state(mconfig, type, tag), - m_printer(*this, PRINTER_TAG) - { - } - - required_device m_printer; - -protected: - virtual void pia1_pa_changed(UINT8 data); -}; - - -/* dragon64 has an ACIA chip */ -class dragon64_state : public dragon_state -{ -public: - dragon64_state(const machine_config &mconfig, device_type type, const char *tag) - : dragon_state(mconfig, type, tag), - m_acia(*this, ACIA_TAG) - { - } - - required_device m_acia; - -protected: - virtual DECLARE_READ8_MEMBER( ff00_read ); - virtual DECLARE_WRITE8_MEMBER( ff00_write ); - - virtual void pia1_pb_changed(UINT8 data); - void page_rom(bool romswitch); -}; - -#endif /* __DRAGON__ */ diff --git a/src/mess/includes/ec184x.h b/src/mess/includes/ec184x.h deleted file mode 100644 index 7921bf5b97e..00000000000 --- a/src/mess/includes/ec184x.h +++ /dev/null @@ -1,43 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/***************************************************************************** - * - * includes/ec184x.h - * - ****************************************************************************/ - -#ifndef EC184X_H_ -#define EC184X_H_ - -#include "includes/genpc.h" - -#define MCFG_EC1841_MOTHERBOARD_ADD(_tag, _cputag) \ - MCFG_DEVICE_ADD(_tag, EC1841_MOTHERBOARD, 0) \ - ec1841_mb_device::static_set_cputag(*device, _cputag); - -// ======================> ibm5150_mb_device -class ec1841_mb_device : public ibm5160_mb_device -{ -public: - // construction/destruction - ec1841_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -public: - virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r ); - virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w ); -}; - - -// device type definition -extern const device_type EC1841_MOTHERBOARD; - -#endif /* EC184X_H_ */ diff --git a/src/mess/includes/einstein.h b/src/mess/includes/einstein.h deleted file mode 100644 index c027a36701e..00000000000 --- a/src/mess/includes/einstein.h +++ /dev/null @@ -1,221 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Dirk Best, Phill Harvey-Smith -/*************************************************************************** - - Tatung Einstein - -***************************************************************************/ - -#ifndef EINSTEIN_H_ -#define EINSTEIN_H_ - -#include "emu.h" -#include "video/mc6845.h" -#include "cpu/z80/z80daisy.h" -#include "machine/wd_fdc.h" -#include "machine/z80ctc.h" -#include "video/tms9928a.h" -#include "machine/ram.h" -#include "machine/i8251.h" -#include "bus/centronics/ctronics.h" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -/* xtals */ -#define XTAL_X001 XTAL_10_738635MHz -#define XTAL_X002 XTAL_8MHz - -/* integrated circuits */ -#define IC_I001 "i001" /* Z8400A */ -#define IC_I030 "i030" /* AY-3-8910 */ -#define IC_I038 "i038" /* TMM9129 */ -#define IC_I042 "i042" /* WD1770-PH */ -#define IC_I050 "i050" /* ADC0844CCN */ -#define IC_I058 "i058" /* Z8430A */ -#define IC_I060 "i060" /* uPD8251A */ -#define IC_I063 "i063" /* Z8420A */ - -/* interrupt sources */ -#define EINSTEIN_KEY_INT (1<<0) -#define EINSTEIN_ADC_INT (1<<1) -#define EINSTEIN_FIRE_INT (1<<2) - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -class einstein_state : public driver_device -{ -public: - einstein_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_fdc(*this, IC_I042), - m_color_screen(*this, "screen"), - m_ctc(*this, IC_I058), - m_tms9929a(*this, "tms9929a"), - m_region_gfx1(*this, "gfx1"), - m_mc6845(*this, "crtc"), - m_crtc_screen(*this, "80column"), - m_uart(*this, IC_I060), - m_ram(*this, RAM_TAG), - m_centronics(*this, "centronics"), - m_region_bios(*this, "bios"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1"), - m_line2(*this, "LINE2"), - m_line3(*this, "LINE3"), - m_line4(*this, "LINE4"), - m_line5(*this, "LINE5"), - m_line6(*this, "LINE6"), - m_line7(*this, "LINE7"), - m_extra(*this, "EXTRA"), - m_buttons(*this, "BUTTONS"), - m_config(*this, "config"), - m_80column_dips(*this, "80column_dips"), - m_palette(*this, "palette") { } - - required_device m_fdc; - required_device m_color_screen; - required_device m_ctc; - required_device m_tms9929a; - optional_memory_region m_region_gfx1; - - int m_rom_enabled; - int m_interrupt; - int m_interrupt_mask; - int m_ctc_trigger; - - /* keyboard */ - UINT8 m_keyboard_line; - UINT8 m_keyboard_data; - - /* 80 column device */ - optional_device m_mc6845; - optional_device m_crtc_screen; - UINT8 *m_crtc_ram; - UINT8 m_de; - - int m_centronics_busy; - int m_centronics_perror; - int m_centronics_fault; - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - DECLARE_WRITE8_MEMBER(einstein_80col_ram_w); - DECLARE_READ8_MEMBER(einstein_80col_ram_r); - DECLARE_READ8_MEMBER(einstein_80col_state_r); - DECLARE_WRITE8_MEMBER(einstein_keyboard_line_write); - DECLARE_READ8_MEMBER(einstein_keyboard_data_read); - DECLARE_WRITE8_MEMBER(einstein_rom_w); - DECLARE_READ8_MEMBER(einstein_kybintmsk_r); - DECLARE_WRITE8_MEMBER(einstein_kybintmsk_w); - DECLARE_WRITE8_MEMBER(einstein_adcintmsk_w); - DECLARE_WRITE8_MEMBER(einstein_fire_int_w); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_MACHINE_START(einstein2); - DECLARE_MACHINE_RESET(einstein2); - UINT32 screen_update_einstein2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(einstein_keyboard_timer_callback); - TIMER_DEVICE_CALLBACK_MEMBER(einstein_ctc_trigger_callback); - DECLARE_WRITE_LINE_MEMBER(einstein_6845_de_changed); - DECLARE_WRITE8_MEMBER(einstein_drsel_w); - DECLARE_WRITE_LINE_MEMBER(einstein_serial_transmit_clock); - DECLARE_WRITE_LINE_MEMBER(einstein_serial_receive_clock); - MC6845_UPDATE_ROW(crtc_update_row); - -protected: - required_device m_uart; - required_device m_ram; - required_device m_centronics; - required_memory_region m_region_bios; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_ioport m_line0; - required_ioport m_line1; - required_ioport m_line2; - required_ioport m_line3; - required_ioport m_line4; - required_ioport m_line5; - required_ioport m_line6; - required_ioport m_line7; - required_ioport m_extra; - required_ioport m_buttons; - required_ioport m_config; - optional_ioport m_80column_dips; -public: - optional_device m_palette; - - void einstein_scan_keyboard(); - void einstein_page_rom(); -}; - - -// ======================> einstein_keyboard_daisy_device - -class einstein_keyboard_daisy_device : public device_t, - public device_z80daisy_interface -{ -public: - // construction/destruction - einstein_keyboard_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -private: - virtual void device_start(); - // z80daisy_interface overrides - virtual int z80daisy_irq_state(); - virtual int z80daisy_irq_ack(); - virtual void z80daisy_irq_reti(); -}; - -extern const device_type EINSTEIN_KEYBOARD_DAISY; - - -// ======================> einstein_adc_daisy_device - -class einstein_adc_daisy_device : public device_t, - public device_z80daisy_interface -{ -public: - // construction/destruction - einstein_adc_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -private: - virtual void device_start(); - // z80daisy_interface overrides - virtual int z80daisy_irq_state(); - virtual int z80daisy_irq_ack(); - virtual void z80daisy_irq_reti(); - -}; - -extern const device_type EINSTEIN_ADC_DAISY; - -// ======================> einstein_fire_daisy_device - -class einstein_fire_daisy_device : public device_t, - public device_z80daisy_interface -{ -public: - // construction/destruction - einstein_fire_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -private: - virtual void device_start(); - // z80daisy_interface overrides - virtual int z80daisy_irq_state(); - virtual int z80daisy_irq_ack(); - virtual void z80daisy_irq_reti(); -}; - -extern const device_type EINSTEIN_FIRE_DAISY; - -#endif /* EINSTEIN_H_ */ diff --git a/src/mess/includes/electron.h b/src/mess/includes/electron.h deleted file mode 100644 index d9623923f17..00000000000 --- a/src/mess/includes/electron.h +++ /dev/null @@ -1,117 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/***************************************************************************** - * - * includes/electron.h - * - * Acorn Electron - * - * Driver by Wilbert Pol - * - ****************************************************************************/ - -#ifndef ELECTRON_H_ -#define ELECTRON_H_ - -#include "imagedev/cassette.h" -#include "sound/beep.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -/* Interrupts */ -#define INT_HIGH_TONE 0x40 -#define INT_TRANSMIT_EMPTY 0x20 -#define INT_RECEIVE_FULL 0x10 -#define INT_RTC 0x08 -#define INT_DISPLAY_END 0x04 -#define INT_SET 0x100 -#define INT_CLEAR 0x200 - -/* ULA context */ - -struct ULA -{ - UINT8 interrupt_status; - UINT8 interrupt_control; - UINT8 rompage; - UINT16 screen_start; - UINT16 screen_base; - int screen_size; - UINT16 screen_addr; - UINT8 *vram; - int current_pal[16]; - int communication_mode; - int screen_mode; - int cassette_motor_mode; - int capslock_mode; -// int scanline; - /* tape reading related */ - UINT32 tape_value; - int tape_steps; - int bit_count; - int high_tone_set; - int start_bit; - int stop_bit; - int tape_running; - UINT8 tape_byte; -}; - - -class electron_state : public driver_device -{ -public: - enum - { - TIMER_TAPE_HANDLER, - TIMER_SETUP_BEEP, - TIMER_SCANLINE_INTERRUPT - }; - - electron_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_beeper(*this, "beeper"), - m_cart(*this, "cartslot"), - m_keybd(*this, "LINE") - { } - - ULA m_ula; - emu_timer *m_tape_timer; - int m_map4[256]; - int m_map16[256]; - emu_timer *m_scanline_timer; - DECLARE_READ8_MEMBER(electron_read_keyboard); - DECLARE_READ8_MEMBER(electron_jim_r); - DECLARE_WRITE8_MEMBER(electron_jim_w); - DECLARE_READ8_MEMBER(electron_1mhz_r); - DECLARE_WRITE8_MEMBER(electron_1mhz_w); - DECLARE_READ8_MEMBER(electron_ula_r); - DECLARE_WRITE8_MEMBER(electron_ula_w); - void electron_tape_start(); - void electron_tape_stop(); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(electron); - UINT32 screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(electron_tape_timer_handler); - TIMER_CALLBACK_MEMBER(setup_beep); - TIMER_CALLBACK_MEMBER(electron_scanline_interrupt); - required_device m_maincpu; - required_device m_cassette; - required_device m_beeper; - required_device m_cart; - required_ioport_array<14> m_keybd; - inline UINT8 read_vram( UINT16 addr ); - inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - void electron_interrupt_handler(int mode, int interrupt); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( electron_cart ); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -#endif /* ELECTRON_H_ */ diff --git a/src/mess/includes/elf.h b/src/mess/includes/elf.h deleted file mode 100644 index d3dbc3d685e..00000000000 --- a/src/mess/includes/elf.h +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __INCLUDES_ELF__ -#define __INCLUDES_ELF__ - - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "machine/mm74c922.h" -#include "video/cdp1861.h" -#include "video/dm9368.h" -#include "machine/rescap.h" -#include "machine/ram.h" - -#define SCREEN_TAG "screen" -#define CDP1802_TAG "a6" -#define CDP1861_TAG "a14" -#define MM74C923_TAG "a10" -#define DM9368_L_TAG "a12" -#define DM9368_H_TAG "a8" - -class elf2_state : public driver_device -{ -public: - elf2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_vdc(*this, CDP1861_TAG), - m_kb(*this, MM74C923_TAG), - m_led_l(*this, DM9368_L_TAG), - m_led_h(*this, DM9368_H_TAG), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_special(*this, "SPECIAL") - { } - - required_device m_maincpu; - required_device m_vdc; - required_device m_kb; - required_device m_led_l; - required_device m_led_h; - required_device m_cassette; - required_device m_ram; - required_ioport m_special; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( dispon_r ); - DECLARE_READ8_MEMBER( data_r ); - DECLARE_WRITE8_MEMBER( data_w ); - DECLARE_WRITE8_MEMBER( memory_w ); - DECLARE_READ_LINE_MEMBER( wait_r ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef4_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_READ8_MEMBER( dma_r ); - DECLARE_WRITE8_MEMBER( sc_w ); - DECLARE_WRITE_LINE_MEMBER( da_w ); - DECLARE_INPUT_CHANGED_MEMBER( input_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( elf ); - // display state - UINT8 m_data; -}; - -#endif diff --git a/src/mess/includes/ep64.h b/src/mess/includes/ep64.h deleted file mode 100644 index 42dd9115e35..00000000000 --- a/src/mess/includes/ep64.h +++ /dev/null @@ -1,98 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Enterprise Sixty Four / One Two Eight emulation - -**********************************************************************/ - -#pragma once - -#ifndef __EP64__ -#define __EP64__ - -#include "audio/dave.h" -#include "bus/rs232/rs232.h" -#include "bus/ep64/exp.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "machine/ram.h" -#include "video/nick.h" - -#define Z80_TAG "u1" -#define DAVE_TAG "u3" -#define NICK_TAG "u4" -#define CENTRONICS_TAG "centronics" -#define RS232_TAG "rs232" -#define CASSETTE1_TAG "cassette1" -#define CASSETTE2_TAG "cassette2" -#define SCREEN_TAG "screen" - -class ep64_state : public driver_device -{ -public: - ep64_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_dave(*this, DAVE_TAG), - m_nick(*this, NICK_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_rs232(*this, RS232_TAG), - m_cassette1(*this, CASSETTE1_TAG), - m_cassette2(*this, CASSETTE2_TAG), - m_cart(*this, "cartslot"), - m_ram(*this, RAM_TAG), - m_rom(*this, Z80_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9") - { } - - required_device m_maincpu; - required_device m_dave; - required_device m_nick; - required_device m_centronics; - required_device m_rs232; - required_device m_cassette1; - required_device m_cassette2; - required_device m_cart; - required_device m_ram; - required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( rd0_r ); - DECLARE_WRITE8_MEMBER( wr0_w ); - DECLARE_READ8_MEMBER( rd1_r ); - DECLARE_WRITE8_MEMBER( wr1_w ); - DECLARE_READ8_MEMBER( rd2_r ); - DECLARE_WRITE8_MEMBER( wr2_w ); - - UINT8 m_key; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - int m_centronics_busy; -}; - -#endif diff --git a/src/mess/includes/eti660.h b/src/mess/includes/eti660.h deleted file mode 100644 index 6298475d66a..00000000000 --- a/src/mess/includes/eti660.h +++ /dev/null @@ -1,75 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __ETI660__ -#define __ETI660__ - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "machine/6821pia.h" -#include "machine/rescap.h" -#include "sound/cdp1864.h" - -#define SCREEN_TAG "screen" -#define CDP1802_TAG "ic3" -#define CDP1864_TAG "ic4" -#define MC6821_TAG "ic5" - -enum -{ - LED_POWER = 0, - LED_PULSE -}; - -class eti660_state : public driver_device -{ -public: - eti660_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_cti(*this, CDP1864_TAG), - m_pia(*this, MC6821_TAG), - m_cassette(*this, "cassette"), - m_pa0(*this, "PA0"), - m_pa1(*this, "PA1"), - m_pa2(*this, "PA2"), - m_pa3(*this, "PA3"), - m_special(*this, "SPECIAL") - { } - - required_device m_maincpu; - required_device m_cti; - required_device m_pia; - required_device m_cassette; - required_ioport m_pa0; - required_ioport m_pa1; - required_ioport m_pa2; - required_ioport m_pa3; - required_ioport m_special; - - DECLARE_READ8_MEMBER( pia_r ); - DECLARE_WRITE8_MEMBER( pia_w ); - DECLARE_WRITE8_MEMBER( colorram_w ); - DECLARE_READ_LINE_MEMBER( rdata_r ); - DECLARE_READ_LINE_MEMBER( bdata_r ); - DECLARE_READ_LINE_MEMBER( gdata_r ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef4_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_WRITE8_MEMBER( dma_w ); - DECLARE_READ8_MEMBER( pia_pa_r ); - DECLARE_WRITE8_MEMBER( pia_pa_w ); - - /* keyboard state */ - UINT8 m_keylatch; - - /* video state */ - UINT8 m_color_ram[0x100]; - UINT8 m_color; -}; - -#endif diff --git a/src/mess/includes/exp85.h b/src/mess/includes/exp85.h deleted file mode 100644 index b5a57422d2e..00000000000 --- a/src/mess/includes/exp85.h +++ /dev/null @@ -1,48 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __EXP85__ -#define __EXP85__ - -#include "bus/rs232/rs232.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" - -#define SCREEN_TAG "screen" -#define I8085A_TAG "u100" -#define I8155_TAG "u106" -#define I8355_TAG "u105" - -class exp85_state : public driver_device -{ -public: - exp85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8085A_TAG), - m_rs232(*this, "rs232"), - m_cassette(*this, "cassette"), - m_speaker(*this, "speaker"), - m_rom(*this, I8085A_TAG), - m_tape_control(0) - { } - - required_device m_maincpu; - required_device m_rs232; - required_device m_cassette; - required_device m_speaker; - required_memory_region m_rom; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( i8355_a_r ); - DECLARE_WRITE8_MEMBER( i8355_a_w ); - DECLARE_READ_LINE_MEMBER( sid_r ); - DECLARE_WRITE_LINE_MEMBER( sod_w ); - DECLARE_WRITE_LINE_MEMBER( terminal_w ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_rst75 ); - - /* cassette state */ - int m_tape_control; -}; - -#endif diff --git a/src/mess/includes/fidelz80.h b/src/mess/includes/fidelz80.h deleted file mode 100644 index 64f47809e4c..00000000000 --- a/src/mess/includes/fidelz80.h +++ /dev/null @@ -1,79 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Kevin Horton,Jonathan Gevaryahu,Sandro Ronco -/*************************************************************************** - - fidelz80.h - -****************************************************************************/ - -#pragma once - -#ifndef _FIDELZ80_H_ -#define _FIDELZ80_H_ - -#include "sound/beep.h" -#include "sound/s14001a.h" - -class fidelz80_state : public driver_device -{ -public: - fidelz80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speech(*this, "speech"), - m_beep(*this, "beeper"), - m_i8041(*this, "mcu"), - m_i8243(*this, "i8243") - { } - - required_device m_maincpu; - optional_device m_speech; - optional_device m_beep; - optional_device m_i8041; - optional_device m_i8243; - - UINT16 m_kp_matrix; // keypad/leds matrix - UINT8 m_led_data; // data for the two individual leds, in 0bxxxx12xx format - UINT8 m_led_selected; // 5 bit selects for 7 seg leds and for common other leds, bits are (7seg leds are 0 1 2 3, common other leds are C) 0bxx3210xc - UINT16 m_digit_data; // data for seg leds - UINT8 m_digit_line_status[4]; // prevent overwrite of m_digit_data - - virtual void machine_reset(); - - //model VCC/UVC - void update_display(); - DECLARE_READ8_MEMBER( fidelz80_portc_r ); - DECLARE_WRITE8_MEMBER( fidelz80_portb_w ); - DECLARE_WRITE8_MEMBER( fidelz80_portc_w ); - DECLARE_WRITE8_MEMBER( cc10_porta_w ); - DECLARE_READ8_MEMBER( vcc_portb_r ); - DECLARE_WRITE8_MEMBER( vcc_porta_w ); - - //model 7014 and VBC - DECLARE_WRITE8_MEMBER(bridgec_speech_w ); - DECLARE_WRITE8_MEMBER(kp_matrix_w); - DECLARE_READ8_MEMBER(unknown_r); - DECLARE_READ8_MEMBER(unknown2_r); - DECLARE_READ8_MEMBER(exp_i8243_p2_r); - DECLARE_WRITE8_MEMBER(exp_i8243_p2_w); - DECLARE_WRITE8_MEMBER(mcu_data_w); - DECLARE_WRITE8_MEMBER(mcu_command_w); - DECLARE_READ8_MEMBER(mcu_data_r); - DECLARE_READ8_MEMBER(mcu_status_r); - DECLARE_INPUT_CHANGED_MEMBER(bridgec_trigger_reset); - - //model VSC - DECLARE_WRITE8_MEMBER(vsc_porta_w); - DECLARE_WRITE8_MEMBER(vsc_portb_w); - DECLARE_WRITE8_MEMBER(vsc_portc_w); - DECLARE_READ8_MEMBER(vsc_pio_porta_r); - DECLARE_READ8_MEMBER(vsc_pio_portb_r); - DECLARE_WRITE8_MEMBER(vsc_pio_portb_w); - DECLARE_INPUT_CHANGED_MEMBER(fidelz80_trigger_reset); - TIMER_DEVICE_CALLBACK_MEMBER(nmi_timer); - - DECLARE_WRITE8_MEMBER(digit_w); -}; - - -#endif // _FIDELZ80_H_ diff --git a/src/mess/includes/fm7.h b/src/mess/includes/fm7.h deleted file mode 100644 index 797d19657f0..00000000000 --- a/src/mess/includes/fm7.h +++ /dev/null @@ -1,390 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/cassette.h" -#include "sound/beep.h" -#include "sound/2203intf.h" -#include "machine/wd_fdc.h" -#include "machine/bankdev.h" - -/* - * - * FM-7 header file - * - */ - -#ifndef FM7_H_ -#define FM7_H_ - -// Interrupt flags -#define IRQ_FLAG_KEY 0x01 -#define IRQ_FLAG_PRINTER 0x02 -#define IRQ_FLAG_TIMER 0x04 -#define IRQ_FLAG_OTHER 0x08 -// the following are not read in port 0xfd03 -#define IRQ_FLAG_MFD 0x10 -#define IRQ_FLAG_TXRDY 0x20 -#define IRQ_FLAG_RXRDY 0x40 -#define IRQ_FLAG_SYNDET 0x80 - -// system types -#define SYS_FM7 1 -#define SYS_FM77AV 2 -#define SYS_FM77AV40EX 3 -#define SYS_FM11 4 -#define SYS_FM16 5 - -// keyboard scancode formats -#define KEY_MODE_FM7 0 // FM-7 ASCII type code -#define KEY_MODE_FM16B 1 // FM-16B (FM-77AV and later only) -#define KEY_MODE_SCAN 2 // Scancode Make/Break (PC-like) - -struct fm7_encoder_t -{ - UINT8 buffer[12]; - UINT8 tx_count; - UINT8 rx_count; - UINT8 command_length; - UINT8 answer_length; - UINT8 latch; // 0=ready to receive - UINT8 ack; - UINT8 position; -}; - -struct fm7_mmr_t -{ - UINT8 bank_addr[8][16]; - UINT8 segment; - UINT8 window_offset; - UINT8 enabled; - UINT8 mode; -}; - -struct fm7_video_t -{ - UINT8 sub_busy; - UINT8 sub_halt; - UINT8 sub_reset; // high if reset caused by subrom change - UINT8 attn_irq; - UINT8 vram_access; // VRAM access flag - UINT8 crt_enable; - UINT16 vram_offset; - UINT16 vram_offset2; - UINT8 fm7_pal[8]; - UINT16 fm77av_pal_selected; - UINT8 subrom; // currently active sub CPU ROM (AV only) - UINT8 cgrom; // currently active CGROM (AV only) - UINT8 modestatus; - UINT8 multi_page; - UINT8 fine_offset; - UINT8 nmi_mask; - UINT8 active_video_page; - UINT8 display_video_page; - UINT8 vsync_flag; -}; - -struct fm7_alu_t -{ - UINT8 command; - UINT8 lcolour; - UINT8 mask; - UINT8 compare_data; - UINT8 compare[8]; - UINT8 bank_disable; - UINT8 tilepaint_b; - UINT8 tilepaint_r; - UINT8 tilepaint_g; - UINT16 addr_offset; - UINT16 line_style; - UINT16 x0; - UINT16 x1; - UINT16 y0; - UINT16 y1; - UINT8 busy; -}; - - -class fm7_state : public driver_device -{ -public: - enum - { - TIMER_FM7_BEEPER_OFF, - TIMER_FM77AV_ENCODER_ACK, - TIMER_FM7_IRQ, - TIMER_FM7_SUBTIMER_IRQ, - TIMER_FM7_KEYBOARD_POLL, - TIMER_FM77AV_ALU_TASK_END, - TIMER_FM77AV_VSYNC - }; - - fm7_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_shared_ram(*this, "shared_ram"), - m_boot_ram(*this, "boot_ram"), - m_maincpu(*this, "maincpu"), - m_sub(*this, "sub"), - m_x86(*this, "x86"), - m_cassette(*this, "cassette"), - m_beeper(*this, "beeper"), - m_ym(*this, "ym"), - m_psg(*this, "psg"), - m_centronics(*this, "centronics"), - m_cent_data_out(*this, "cent_data_out"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_floppy(NULL), - m_kanji(*this, "kanji1"), - m_key1(*this, "key1"), - m_key2(*this, "key2"), - m_key3(*this, "key3"), - m_keymod(*this, "key_modifiers"), - m_joy1(*this, "joy1"), - m_joy2(*this, "joy2"), - m_dsw(*this, "DSW"), - m_palette(*this, "palette"), - m_av_palette(*this, "av_palette"), - m_avbank1(*this, "av_bank1"), - m_avbank2(*this, "av_bank2"), - m_avbank3(*this, "av_bank3"), - m_avbank4(*this, "av_bank4"), - m_avbank5(*this, "av_bank5"), - m_avbank6(*this, "av_bank6"), - m_avbank7(*this, "av_bank7"), - m_avbank8(*this, "av_bank8"), - m_avbank9(*this, "av_bank9"), - m_avbank10(*this, "av_bank10"), - m_avbank11(*this, "av_bank11"), - m_avbank12(*this, "av_bank12"), - m_avbank13(*this, "av_bank13"), - m_avbank14(*this, "av_bank14"), - m_avbank15(*this, "av_bank15"), - m_avbank16(*this, "av_bank16") - { - } - - optional_shared_ptr m_shared_ram; - optional_shared_ptr m_boot_ram; - - UINT8 m_irq_flags; - UINT8 m_irq_mask; - emu_timer* m_timer; - emu_timer* m_subtimer; - emu_timer* m_keyboard_timer; - UINT8 m_basic_rom_en; - UINT8 m_init_rom_en; - unsigned int m_key_delay; - unsigned int m_key_repeat; - UINT16 m_current_scancode; - UINT32 m_key_data[4]; - UINT32 m_mod_data; - UINT8 m_key_scan_mode; - UINT8 m_break_flag; - UINT8 m_psg_regsel; - UINT8 m_psg_data; - UINT8 m_fdc_side; - UINT8 m_fdc_drive; - UINT8 m_fdc_irq_flag; - UINT8 m_fdc_drq_flag; - UINT8 m_fm77av_ym_irq; - UINT8 m_speaker_active; - UINT16 m_kanji_address; - fm7_encoder_t m_encoder; - fm7_mmr_t m_mmr; - UINT8 m_cp_prev; - UINT8* m_video_ram; - emu_timer* m_fm77av_vsync_timer; - UINT8 m_type; - fm7_video_t m_video; - fm7_alu_t m_alu; - int m_sb_prev; - DECLARE_READ8_MEMBER(fm7_subintf_r); - DECLARE_WRITE8_MEMBER(fm7_subintf_w); - DECLARE_READ8_MEMBER(fm7_sub_busyflag_r); - DECLARE_WRITE8_MEMBER(fm7_sub_busyflag_w); - DECLARE_READ8_MEMBER(fm7_cancel_ack); - DECLARE_READ8_MEMBER(fm7_attn_irq_r); - DECLARE_READ8_MEMBER(fm7_vram_access_r); - DECLARE_WRITE8_MEMBER(fm7_vram_access_w); - DECLARE_READ8_MEMBER(fm7_vram_r); - DECLARE_WRITE8_MEMBER(fm7_vram_w); - DECLARE_WRITE8_MEMBER(fm7_vram_banked_w); - DECLARE_READ8_MEMBER(fm7_vram0_r); - DECLARE_READ8_MEMBER(fm7_vram1_r); - DECLARE_READ8_MEMBER(fm7_vram2_r); - DECLARE_READ8_MEMBER(fm7_vram3_r); - DECLARE_READ8_MEMBER(fm7_vram4_r); - DECLARE_READ8_MEMBER(fm7_vram5_r); - DECLARE_READ8_MEMBER(fm7_vram6_r); - DECLARE_READ8_MEMBER(fm7_vram7_r); - DECLARE_READ8_MEMBER(fm7_vram8_r); - DECLARE_READ8_MEMBER(fm7_vram9_r); - DECLARE_READ8_MEMBER(fm7_vramA_r); - DECLARE_READ8_MEMBER(fm7_vramB_r); - DECLARE_WRITE8_MEMBER(fm7_vram0_w); - DECLARE_WRITE8_MEMBER(fm7_vram1_w); - DECLARE_WRITE8_MEMBER(fm7_vram2_w); - DECLARE_WRITE8_MEMBER(fm7_vram3_w); - DECLARE_WRITE8_MEMBER(fm7_vram4_w); - DECLARE_WRITE8_MEMBER(fm7_vram5_w); - DECLARE_WRITE8_MEMBER(fm7_vram6_w); - DECLARE_WRITE8_MEMBER(fm7_vram7_w); - DECLARE_WRITE8_MEMBER(fm7_vram8_w); - DECLARE_WRITE8_MEMBER(fm7_vram9_w); - DECLARE_WRITE8_MEMBER(fm7_vramA_w); - DECLARE_WRITE8_MEMBER(fm7_vramB_w); - DECLARE_READ8_MEMBER(fm7_crt_r); - DECLARE_WRITE8_MEMBER(fm7_crt_w); - DECLARE_WRITE8_MEMBER(fm7_vram_offset_w); - DECLARE_WRITE8_MEMBER(fm7_multipage_w); - DECLARE_READ8_MEMBER(fm7_palette_r); - DECLARE_WRITE8_MEMBER(fm7_palette_w); - DECLARE_WRITE8_MEMBER(fm77av_analog_palette_w); - DECLARE_READ8_MEMBER(fm77av_video_flags_r); - DECLARE_WRITE8_MEMBER(fm77av_video_flags_w); - DECLARE_READ8_MEMBER(fm77av_sub_modestatus_r); - DECLARE_WRITE8_MEMBER(fm77av_sub_modestatus_w); - DECLARE_WRITE8_MEMBER(fm77av_sub_bank_w); - DECLARE_READ8_MEMBER(fm77av_alu_r); - DECLARE_WRITE8_MEMBER(fm77av_alu_w); - DECLARE_READ8_MEMBER(fm7_sub_ram_ports_banked_r); - DECLARE_WRITE8_MEMBER(fm7_sub_ram_ports_banked_w); - DECLARE_READ8_MEMBER(fm7_console_ram_banked_r); - DECLARE_WRITE8_MEMBER(fm7_console_ram_banked_w); - DECLARE_WRITE8_MEMBER(fm7_irq_mask_w); - DECLARE_READ8_MEMBER(fm7_irq_cause_r); - DECLARE_WRITE8_MEMBER(fm7_beeper_w); - DECLARE_READ8_MEMBER(fm7_sub_beeper_r); - DECLARE_READ8_MEMBER(vector_r); - DECLARE_WRITE8_MEMBER(vector_w); - DECLARE_READ8_MEMBER(fm7_fd04_r); - DECLARE_READ8_MEMBER(fm7_rom_en_r); - DECLARE_WRITE8_MEMBER(fm7_rom_en_w); - DECLARE_WRITE8_MEMBER(fm7_init_en_w); - DECLARE_READ8_MEMBER(fm7_fdc_r); - DECLARE_WRITE8_MEMBER(fm7_fdc_w); - DECLARE_READ8_MEMBER(fm7_keyboard_r); - DECLARE_READ8_MEMBER(fm7_sub_keyboard_r); - DECLARE_READ8_MEMBER(fm77av_key_encoder_r); - DECLARE_WRITE8_MEMBER(fm77av_key_encoder_w); - DECLARE_READ8_MEMBER(fm7_cassette_printer_r); - DECLARE_WRITE8_MEMBER(fm7_cassette_printer_w); - DECLARE_READ8_MEMBER(fm77av_boot_mode_r); - DECLARE_READ8_MEMBER(fm7_psg_select_r); - DECLARE_WRITE8_MEMBER(fm7_psg_select_w); - DECLARE_WRITE8_MEMBER(fm77av_ym_select_w); - DECLARE_READ8_MEMBER(fm7_psg_data_r); - DECLARE_WRITE8_MEMBER(fm7_psg_data_w); - DECLARE_WRITE8_MEMBER(fm77av_bootram_w); - DECLARE_READ8_MEMBER(fm7_main_shared_r); - DECLARE_WRITE8_MEMBER(fm7_main_shared_w); - DECLARE_READ8_MEMBER(fm7_fmirq_r); - DECLARE_READ8_MEMBER(fm7_unknown_r); - DECLARE_READ8_MEMBER(fm7_mmr_r); - DECLARE_WRITE8_MEMBER(fm7_mmr_w); - DECLARE_READ8_MEMBER(fm7_kanji_r); - DECLARE_WRITE8_MEMBER(fm7_kanji_w); - void fm77av_encoder_setup_command(); - void fm77av_encoder_handle_command(); - DECLARE_DRIVER_INIT(fm7); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_MACHINE_START(fm7); - DECLARE_MACHINE_START(fm77av); - DECLARE_MACHINE_START(fm11); - DECLARE_MACHINE_START(fm16); - UINT32 screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(fm7_beeper_off); - TIMER_CALLBACK_MEMBER(fm77av_encoder_ack); - TIMER_CALLBACK_MEMBER(fm7_timer_irq); - TIMER_CALLBACK_MEMBER(fm7_subtimer_irq); - TIMER_CALLBACK_MEMBER(fm7_keyboard_poll); - TIMER_CALLBACK_MEMBER(fm77av_alu_task_end); - TIMER_CALLBACK_MEMBER(fm77av_vsync); - DECLARE_WRITE_LINE_MEMBER(fm7_fdc_intrq_w); - DECLARE_WRITE_LINE_MEMBER(fm7_fdc_drq_w); - DECLARE_READ8_MEMBER(fm77av_joy_1_r); - DECLARE_READ8_MEMBER(fm77av_joy_2_r); - IRQ_CALLBACK_MEMBER(fm7_irq_ack); - IRQ_CALLBACK_MEMBER(fm7_sub_irq_ack); - DECLARE_WRITE_LINE_MEMBER(fm77av_fmirq); - required_device m_maincpu; - required_device m_sub; - optional_device m_x86; - required_device m_cassette; - required_device m_beeper; - optional_device m_ym; - optional_device m_psg; - required_device m_centronics; - required_device m_cent_data_out; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - - floppy_image_device *m_floppy; - - void fm7_alu_mask_write(UINT32 offset, int bank, UINT8 dat); - void fm7_alu_function_compare(UINT32 offset); - void fm7_alu_function_pset(UINT32 offset); - void fm7_alu_function_or(UINT32 offset); - void fm7_alu_function_and(UINT32 offset); - void fm7_alu_function_xor(UINT32 offset); - void fm7_alu_function_not(UINT32 offset); - void fm7_alu_function_invalid(UINT32 offset); - void fm7_alu_function_tilepaint(UINT32 offset); - void fm7_alu_function(UINT32 offset); - UINT32 fm7_line_set_pixel(int x, int y); - void fm77av_line_draw(); - void main_irq_set_flag(UINT8 flag); - void main_irq_clear_flag(UINT8 flag); - void fm7_update_psg(); - void fm7_update_bank(address_space & space, int bank, UINT8 physical); - void fm7_mmr_refresh(address_space& space); - void key_press(UINT16 scancode); - void fm7_keyboard_poll_scan(); - - int m_centronics_busy; - int m_centronics_fault; - int m_centronics_ack; - int m_centronics_perror; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - - optional_memory_region m_kanji; - required_ioport m_key1; - required_ioport m_key2; - required_ioport m_key3; - required_ioport m_keymod; - required_ioport m_joy1; - required_ioport m_joy2; - required_ioport m_dsw; - required_device m_palette; - optional_device m_av_palette; - - optional_device m_avbank1; - optional_device m_avbank2; - optional_device m_avbank3; - optional_device m_avbank4; - optional_device m_avbank5; - optional_device m_avbank6; - optional_device m_avbank7; - optional_device m_avbank8; - optional_device m_avbank9; - optional_device m_avbank10; - optional_device m_avbank11; - optional_device m_avbank12; - optional_device m_avbank13; - optional_device m_avbank14; - optional_device m_avbank15; - optional_device m_avbank16; - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /*FM7_H_*/ diff --git a/src/mess/includes/fmtowns.h b/src/mess/includes/fmtowns.h deleted file mode 100644 index fb521304d8d..00000000000 --- a/src/mess/includes/fmtowns.h +++ /dev/null @@ -1,384 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -#ifndef FMTOWNS_H_ -#define FMTOWNS_H_ - - -#include "emu.h" -#include "cpu/i386/i386.h" -#include "sound/2612intf.h" -#include "sound/rf5c68.h" -#include "sound/cdda.h" -#include "sound/speaker.h" -#include "imagedev/chd_cd.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/wd_fdc.h" -#include "imagedev/floppy.h" -#include "formats/fmtowns_dsk.h" -#include "machine/upd71071.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "machine/fm_scsi.h" - -#define IRQ_LOG 0 // set to 1 to log IRQ line activity - -struct towns_cdrom_controller -{ - UINT8 command; - UINT8 status; - UINT8 cmd_status[4]; - UINT8 cmd_status_ptr; - UINT8 extra_status; - UINT8 parameter[8]; - UINT8 mpu_irq_enable; - UINT8 dma_irq_enable; - UINT8 buffer[2048]; - INT32 buffer_ptr; - UINT32 lba_current; - UINT32 lba_last; - UINT32 cdda_current; - UINT32 cdda_length; - bool software_tx; - emu_timer* read_timer; -}; - -struct towns_video_controller -{ - UINT8 towns_vram_wplane; - UINT8 towns_vram_rplane; - UINT8 towns_vram_page_sel; - UINT8 towns_palette_select; - UINT8 towns_palette_r[256]; - UINT8 towns_palette_g[256]; - UINT8 towns_palette_b[256]; - UINT8 towns_degipal[8]; - UINT8 towns_dpmd_flag; - UINT8 towns_crtc_mix; - UINT8 towns_crtc_sel; // selected CRTC register - UINT16 towns_crtc_reg[32]; - UINT8 towns_video_sel; // selected video register - UINT8 towns_video_reg[2]; - UINT8 towns_sprite_sel; // selected sprite register - UINT8 towns_sprite_reg[8]; - UINT8 towns_sprite_flag; // sprite drawing flag - UINT8 towns_sprite_page; // VRAM page (not layer) sprites are drawn to - UINT8 towns_tvram_enable; - UINT16 towns_kanji_offset; - UINT8 towns_kanji_code_h; - UINT8 towns_kanji_code_l; - rectangle towns_crtc_layerscr[2]; // each layer has independent sizes - UINT8 towns_display_plane; - UINT8 towns_display_page_sel; - UINT8 towns_vblank_flag; - UINT8 towns_layer_ctrl; - emu_timer* sprite_timer; -}; - -class towns_state : public driver_device -{ - public: - towns_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_pic_master(*this, "pic8259_master"), - m_pic_slave(*this, "pic8259_slave"), - m_pit(*this, "pit"), - m_dma_1(*this, "dma_1"), - m_dma_2(*this, "dma_2"), - m_palette(*this, "palette"), - m_ram(*this, RAM_TAG), - m_fdc(*this, "fdc"), - m_flop0(*this, "fdc:0"), - m_flop1(*this, "fdc:1"), - m_nvram(*this, "nvram"), - m_nvram16(*this, "nvram16"), - m_ctrltype(*this, "ctrltype"), - m_key1(*this, "key1"), - m_key2(*this, "key2"), - m_key3(*this, "key3"), - m_key4(*this, "key4"), - m_joy1(*this, "joy1"), - m_joy2(*this, "joy2"), - m_joy1_ex(*this, "joy1_ex"), - m_joy2_ex(*this, "joy2_ex"), - m_6b_joy1(*this, "6b_joy1"), - m_6b_joy2(*this, "6b_joy2"), - m_6b_joy1_ex(*this, "6b_joy1_ex"), - m_6b_joy2_ex(*this, "6b_joy2_ex"), - m_mouse1(*this, "mouse1"), - m_mouse2(*this, "mouse2"), - m_mouse3(*this, "mouse3"), - m_user(*this,"user"), - m_serial(*this,"serial") - { } - - /* devices */ - required_device m_maincpu; - required_device m_speaker; - required_device m_pic_master; - required_device m_pic_slave; - required_device m_pit; - required_device m_dma_1; - required_device m_dma_2; - required_device m_palette; - required_device m_ram; - required_device m_fdc; - required_device m_flop0; - required_device m_flop1; - ram_device* m_messram; - cdrom_image_device* m_cdrom; - cdda_device* m_cdda; - class fmscsi_device* m_scsi; - - UINT16 m_ftimer; - UINT16 m_freerun_timer; - emu_timer* m_towns_freerun_counter; - UINT16 m_intervaltimer2_period; - UINT8 m_intervaltimer2_irqmask; - UINT8 m_intervaltimer2_timeout_flag; - UINT8 m_intervaltimer2_timeout_flag2; - emu_timer* m_towns_intervaltimer2; - UINT8 m_nmi_mask; - UINT8 m_compat_mode; - UINT8 m_towns_system_port; - UINT32 m_towns_ankcg_enable; - UINT32 m_towns_mainmem_enable; - UINT32 m_towns_ram_enable; - UINT32* m_towns_vram; - UINT8* m_towns_gfxvram; - UINT8* m_towns_txtvram; - int m_towns_selected_drive; - UINT8 m_towns_fdc_irq6mask; - UINT8* m_towns_serial_rom; - int m_towns_srom_position; - UINT8 m_towns_srom_clk; - UINT8 m_towns_srom_reset; - UINT8 m_towns_rtc_select; - UINT8 m_towns_rtc_data; - UINT8 m_towns_rtc_reg[16]; - emu_timer* m_towns_rtc_timer; - UINT8 m_towns_timer_mask; - UINT16 m_towns_machine_id; // default is 0x0101 - UINT8 m_towns_kb_status; - UINT8 m_towns_kb_irq1_enable; - UINT8 m_towns_kb_output; // key output - UINT8 m_towns_kb_extend; // extended key output - emu_timer* m_towns_kb_timer; - emu_timer* m_towns_mouse_timer; - UINT8 m_towns_fm_irq_flag; - UINT8 m_towns_pcm_irq_flag; - UINT8 m_towns_pcm_channel_flag; - UINT8 m_towns_pcm_channel_mask; - UINT8 m_towns_pad_mask; - UINT8 m_towns_mouse_output; - UINT8 m_towns_mouse_x; - UINT8 m_towns_mouse_y; - UINT8 m_towns_volume[8]; // volume ports - UINT8 m_towns_volume_select; - UINT8 m_towns_scsi_control; - UINT8 m_towns_scsi_status; - UINT8 m_towns_spkrdata; - UINT8 m_pit_out0; - UINT8 m_pit_out1; - UINT8 m_pit_out2; - UINT8 m_timer0; - UINT8 m_timer1; - - emu_timer* m_towns_wait_timer; - emu_timer* m_towns_status_timer; - emu_timer* m_towns_cdda_timer; - struct towns_cdrom_controller m_towns_cd; - struct towns_video_controller m_video; - - UINT32 m_kb_prev[4]; - UINT8 m_prev_pad_mask; - UINT8 m_prev_x; - UINT8 m_prev_y; - - optional_shared_ptr m_nvram; - optional_shared_ptr m_nvram16; - - virtual void driver_start(); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - DECLARE_READ8_MEMBER(towns_system_r); - DECLARE_WRITE8_MEMBER(towns_system_w); - DECLARE_READ8_MEMBER(towns_intervaltimer2_r); - DECLARE_WRITE8_MEMBER(towns_intervaltimer2_w); - DECLARE_READ8_MEMBER(towns_sys6c_r); - DECLARE_WRITE8_MEMBER(towns_sys6c_w); - DECLARE_READ8_MEMBER(towns_dma1_r); - DECLARE_WRITE8_MEMBER(towns_dma1_w); - DECLARE_READ8_MEMBER(towns_dma2_r); - DECLARE_WRITE8_MEMBER(towns_dma2_w); - DECLARE_READ8_MEMBER(towns_floppy_r); - DECLARE_WRITE8_MEMBER(towns_floppy_w); - DECLARE_READ8_MEMBER(towns_keyboard_r); - DECLARE_WRITE8_MEMBER(towns_keyboard_w); - DECLARE_READ8_MEMBER(towns_port60_r); - DECLARE_WRITE8_MEMBER(towns_port60_w); - DECLARE_READ8_MEMBER(towns_sys5e8_r); - DECLARE_WRITE8_MEMBER(towns_sys5e8_w); - DECLARE_READ8_MEMBER(towns_sound_ctrl_r); - DECLARE_WRITE8_MEMBER(towns_sound_ctrl_w); - DECLARE_READ8_MEMBER(towns_padport_r); - DECLARE_WRITE8_MEMBER(towns_pad_mask_w); - DECLARE_READ8_MEMBER(towns_cmos8_r); - DECLARE_WRITE8_MEMBER(towns_cmos8_w); - DECLARE_READ8_MEMBER(towns_cmos_low_r); - DECLARE_WRITE8_MEMBER(towns_cmos_low_w); - DECLARE_READ8_MEMBER(towns_cmos_r); - DECLARE_WRITE8_MEMBER(towns_cmos_w); - DECLARE_READ8_MEMBER(towns_sys480_r); - DECLARE_WRITE8_MEMBER(towns_sys480_w); - DECLARE_READ8_MEMBER(towns_video_404_r); - DECLARE_WRITE8_MEMBER(towns_video_404_w); - DECLARE_READ8_MEMBER(towns_cdrom_r); - DECLARE_WRITE8_MEMBER(towns_cdrom_w); - DECLARE_READ8_MEMBER(towns_rtc_r); - DECLARE_WRITE8_MEMBER(towns_rtc_w); - DECLARE_WRITE8_MEMBER(towns_rtc_select_w); - DECLARE_READ8_MEMBER(towns_volume_r); - DECLARE_WRITE8_MEMBER(towns_volume_w); - DECLARE_READ8_MEMBER(towns_41ff_r); - - DECLARE_READ8_MEMBER(towns_gfx_high_r); - DECLARE_WRITE8_MEMBER(towns_gfx_high_w); - DECLARE_READ8_MEMBER(towns_gfx_r); - DECLARE_WRITE8_MEMBER(towns_gfx_w); - DECLARE_READ8_MEMBER(towns_video_cff80_r); - DECLARE_WRITE8_MEMBER(towns_video_cff80_w); - DECLARE_READ8_MEMBER(towns_video_cff80_mem_r); - DECLARE_WRITE8_MEMBER(towns_video_cff80_mem_w); - DECLARE_READ8_MEMBER(towns_video_440_r); - DECLARE_WRITE8_MEMBER(towns_video_440_w); - DECLARE_READ8_MEMBER(towns_video_5c8_r); - DECLARE_WRITE8_MEMBER(towns_video_5c8_w); - DECLARE_READ8_MEMBER(towns_video_fd90_r); - DECLARE_WRITE8_MEMBER(towns_video_fd90_w); - DECLARE_READ8_MEMBER(towns_video_ff81_r); - DECLARE_READ8_MEMBER(towns_video_unknown_r); - DECLARE_WRITE8_MEMBER(towns_video_ff81_w); - DECLARE_READ8_MEMBER(towns_spriteram_low_r); - DECLARE_WRITE8_MEMBER(towns_spriteram_low_w); - DECLARE_READ8_MEMBER(towns_spriteram_r); - DECLARE_WRITE8_MEMBER(towns_spriteram_w); - - DECLARE_WRITE_LINE_MEMBER(mb8877a_irq_w); - DECLARE_WRITE_LINE_MEMBER(mb8877a_drq_w); - DECLARE_WRITE_LINE_MEMBER(pit_out2_changed); - - RF5C68_SAMPLE_END_CB_MEMBER(towns_pcm_irq); - - void towns_update_video_banks(address_space&); - void init_serial_rom(); - void init_rtc(); - void kb_sendcode(UINT8 scancode, int release); - UINT8 speaker_get_spk(); - void speaker_set_spkrdata(UINT8 data); - void speaker_set_input(UINT8 data); - UINT8 towns_cdrom_read_byte_software(); - - required_ioport m_ctrltype; - required_ioport m_key1; - required_ioport m_key2; - required_ioport m_key3; - required_ioport m_key4; - required_ioport m_joy1; - required_ioport m_joy2; - required_ioport m_joy1_ex; - required_ioport m_joy2_ex; - required_ioport m_6b_joy1; - required_ioport m_6b_joy2; - required_ioport m_6b_joy1_ex; - required_ioport m_6b_joy2_ex; - required_ioport m_mouse1; - required_ioport m_mouse2; - required_ioport m_mouse3; - required_memory_region m_user; - optional_memory_region m_serial; - -private: - static const device_timer_id TIMER_RTC = 0; - static const device_timer_id TIMER_FREERUN = 1; - static const device_timer_id TIMER_INTERVAL2 = 2; - static const device_timer_id TIMER_KEYBOARD = 3; - static const device_timer_id TIMER_MOUSE = 4; - static const device_timer_id TIMER_WAIT = 5; - static const device_timer_id TIMER_CDSTATUS = 6; - static const device_timer_id TIMER_CDDA = 7; - void rtc_second(); - void freerun_inc(); - void intervaltimer2_timeout(); - void poll_keyboard(); - void mouse_timeout(); - void wait_end(); - void towns_cd_set_status(UINT8 st0, UINT8 st1, UINT8 st2, UINT8 st3); - void towns_cdrom_execute_command(cdrom_image_device* device); - void towns_cdrom_play_cdda(cdrom_image_device* device); - void towns_cdrom_read(cdrom_image_device* device); - void towns_cd_status_ready(); - void towns_delay_cdda(cdrom_image_device* dev); -public: - INTERRUPT_GEN_MEMBER(towns_vsync_irq); - TIMER_CALLBACK_MEMBER(towns_cdrom_read_byte); - TIMER_CALLBACK_MEMBER(towns_sprite_done); - TIMER_CALLBACK_MEMBER(towns_vblank_end); - DECLARE_WRITE_LINE_MEMBER(towns_scsi_irq); - DECLARE_WRITE_LINE_MEMBER(towns_scsi_drq); - DECLARE_WRITE_LINE_MEMBER(towns_pit_out0_changed); - DECLARE_WRITE_LINE_MEMBER(towns_pit_out1_changed); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE_LINE_MEMBER(towns_fm_irq); - DECLARE_FLOPPY_FORMATS(floppy_formats); - void towns_crtc_refresh_mode(); - void towns_update_kanji_offset(); - void towns_update_palette(); - void render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect); - void render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect); - void draw_sprites(const rectangle* rect); - void towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); - void towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); - void towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); - void towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer); - void render_text_char(UINT8 x, UINT8 y, UINT8 ascii, UINT16 jis, UINT8 attr); - void draw_text_layer(); - inline UINT8 byte_to_bcd(UINT8 val); - inline UINT8 bcd_to_byte(UINT8 val); - inline UINT32 msf_to_lbafm(UINT32 val); // because the CDROM core doesn't provide this; - DECLARE_READ16_MEMBER(towns_fdc_dma_r); - DECLARE_WRITE16_MEMBER(towns_fdc_dma_w); - void towns_cdrom_set_irq(int line,int state); - UINT8 towns_cd_get_track(); - DECLARE_READ16_MEMBER(towns_cdrom_dma_r); - void rtc_hour(); - void rtc_minute(); - DECLARE_READ16_MEMBER(towns_scsi_dma_r); - DECLARE_WRITE16_MEMBER(towns_scsi_dma_w); -}; - -class towns16_state : public towns_state -{ - public: - towns16_state(const machine_config &mconfig, device_type type, const char *tag) - : towns_state(mconfig, type, tag) - { } -}; - -class marty_state : public towns_state -{ - public: - marty_state(const machine_config &mconfig, device_type type, const char *tag) - : towns_state(mconfig, type, tag) - { } - - virtual void driver_start(); -}; - -#endif /*FMTOWNS_H_*/ diff --git a/src/mess/includes/galaxy.h b/src/mess/includes/galaxy.h deleted file mode 100644 index a115eb146f1..00000000000 --- a/src/mess/includes/galaxy.h +++ /dev/null @@ -1,58 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha, Miodrag Milanovic -/***************************************************************************** - * - * includes/galaxy.h - * - ****************************************************************************/ - -#ifndef GALAXY_H_ -#define GALAXY_H_ - -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - - -class galaxy_state : public driver_device -{ -public: - galaxy_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_region_gfx1(*this, "gfx1") { } - - int m_interrupts_enabled; - UINT8 m_latch_value; - UINT32 m_gal_cnt; - UINT8 m_code; - UINT8 m_first; - UINT32 m_start_addr; - emu_timer *m_gal_video_timer; - bitmap_ind16 m_bitmap; - DECLARE_READ8_MEMBER(galaxy_keyboard_r); - DECLARE_WRITE8_MEMBER(galaxy_latch_w); - DECLARE_DRIVER_INIT(galaxy); - DECLARE_DRIVER_INIT(galaxyp); - virtual void video_start(); - DECLARE_MACHINE_RESET(galaxy); - DECLARE_MACHINE_RESET(galaxyp); - UINT32 screen_update_galaxy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(galaxy_interrupt); - TIMER_CALLBACK_MEMBER(gal_video); - IRQ_CALLBACK_MEMBER(galaxy_irq_callback); - void galaxy_set_timer(); - void galaxy_setup_snapshot (const UINT8 * data, UINT32 size); - required_device m_maincpu; - DECLARE_SNAPSHOT_LOAD_MEMBER( galaxy ); -protected: - required_device m_cassette; - required_device m_ram; - required_memory_region m_region_gfx1; - ioport_port *m_io_ports[8]; -}; - - -#endif /* GALAXY_H_ */ diff --git a/src/mess/includes/galeb.h b/src/mess/includes/galeb.h deleted file mode 100644 index a510622818d..00000000000 --- a/src/mess/includes/galeb.h +++ /dev/null @@ -1,36 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/galeb.h - * - ****************************************************************************/ - -#ifndef GALEB_H_ -#define GALEB_H_ - - -class galeb_state : public driver_device -{ -public: - galeb_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_video_ram(*this, "video_ram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - required_shared_ptr m_video_ram; - DECLARE_READ8_MEMBER(galeb_keyboard_r); - virtual void video_start(); - UINT32 screen_update_galeb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; -}; - -/*----------- defined in video/galeb.c -----------*/ - -extern const gfx_layout galeb_charlayout; - -#endif /* GALEB_H_ */ diff --git a/src/mess/includes/gamate.h b/src/mess/includes/gamate.h deleted file mode 100644 index 0a662e60436..00000000000 --- a/src/mess/includes/gamate.h +++ /dev/null @@ -1,100 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/gamate.h - * - ****************************************************************************/ - -#ifndef GAMATE_H_ -#define GAMATE_H_ - -#include "cpu/m6502/m6502.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -// ======================> gamate_sound_device - -class gamate_sound_device : public device_t, public device_sound_interface -{ -public: - gamate_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~gamate_sound_device() { } - - DECLARE_WRITE8_MEMBER( device_w ); - DECLARE_READ8_MEMBER( device_r ); - -protected: - // device-level overrides - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -private: - - static const int DAConverter[]; - static int Value2Volume(int volume) { return DAConverter[volume]*1; } - - sound_stream *m_mixer_channel; - struct Tone - { - Tone() : - envelope_on(false), - level(false), - tone(false), full_cycle(false), - volume(0), - pos(0), - size(0) - {} - - bool envelope_on, level; - bool tone/*else noise*/, full_cycle/* else square signal/pulse */; - int volume; - int pos, size; - }; - - enum - { - Right, - Left, - Both - }; - - Tone m_channels[3]; - - struct Noise - { - Noise(): - state(1), - level(false), - step(0.0), - pos(0.0) - {} - - int state; - bool level; - double step, pos; - } noise; - - struct Envelope - { - Envelope(): - control(0), - index(0), - first(false) - {} - - int control; - int index; - bool first; - double step, pos; - } envelope; - - UINT8 reg[14]; -}; - -extern const device_type GAMATE_SND; - -#endif /* GAMATE_H_ */ diff --git a/src/mess/includes/gamecom.h b/src/mess/includes/gamecom.h deleted file mode 100644 index cbac6041120..00000000000 --- a/src/mess/includes/gamecom.h +++ /dev/null @@ -1,290 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Robbbert -/***************************************************************************** - * - * includes/gamecom.h - * - * Tiger Game.com - * - * Driver by Wilbert Pol - * - ****************************************************************************/ - -#ifndef GAMECOM_H_ -#define GAMECOM_H_ - -#include "emu.h" -#include "cpu/sm8500/sm8500.h" -#include "sound/dac.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "machine/nvram.h" - -/* SM8521 register addresses */ -enum -{ - SM8521_R0 = 0x00, - SM8521_R1 = 0x01, - SM8521_R2 = 0x02, - SM8521_R3 = 0x03, - SM8521_R4 = 0x04, - SM8521_R5 = 0x05, - SM8521_R6 = 0x06, - SM8521_R7 = 0x07, - SM8521_R8 = 0x08, - SM8521_R9 = 0x09, - SM8521_R10 = 0x0A, - SM8521_R11 = 0x0B, - SM8521_R12 = 0x0C, - SM8521_R13 = 0x0D, - SM8521_R14 = 0x0E, - SM8521_R15 = 0x0F, - SM8521_IE0 = 0x10, - SM8521_IE1 = 0x11, - SM8521_IR0 = 0x12, - SM8521_IR1 = 0x13, - SM8521_P0 = 0x14, - SM8521_P1 = 0x15, - SM8521_P2 = 0x16, - SM8521_P3 = 0x17, - SM8521_18 = 0x18, /* reserved */ - SM8521_SYS = 0x19, - SM8521_CKC = 0x1A, - SM8521_1B = 0x1B, /* reserved */ - SM8521_SPH = 0x1C, - SM8521_SPL = 0x1D, - SM8521_PS0 = 0x1E, - SM8521_PS1 = 0x1F, - SM8521_P0C = 0x20, - SM8521_P1C = 0x21, - SM8521_P2C = 0x22, - SM8521_P3C = 0x23, - SM8521_MMU0 = 0x24, - SM8521_MMU1 = 0x25, - SM8521_MMU2 = 0x26, - SM8521_MMU3 = 0x27, - SM8521_MMU4 = 0x28, - SM8521_29 = 0x29, /* reserved */ - SM8521_2A = 0x2A, /* reserved */ - SM8521_URTT = 0x2B, - SM8521_URTR = 0x2C, - SM8521_URTS = 0x2D, - SM8521_URTC = 0x2E, - SM8521_2F = 0x2F, /* reserved */ - SM8521_LCDC = 0x30, - SM8521_LCH = 0x31, - SM8521_LCV = 0x32, - SM8521_33 = 0x33, /* reserved */ - SM8521_DMC = 0x34, - SM8521_DMX1 = 0x35, - SM8521_DMY1 = 0x36, - SM8521_DMDX = 0x37, - SM8521_DMDY = 0x38, - SM8521_DMX2 = 0x39, - SM8521_DMY2 = 0x3A, - SM8521_DMPL = 0x3B, - SM8521_DMBR = 0x3C, - SM8521_DMVP = 0x3D, - SM8521_3E = 0x3E, /* reserved */ - SM8521_3F = 0x3F, /* reserved */ - SM8521_SGC = 0x40, - SM8521_41 = 0x41, /* reserved */ - SM8521_SG0L = 0x42, - SM8521_43 = 0x43, /* reserved */ - SM8521_SG1L = 0x44, - SM8521_45 = 0x45, /* reserved */ - SM8521_SG0TH = 0x46, - SM8521_SG0TL = 0x47, - SM8521_SG1TH = 0x48, - SM8521_SG1TL = 0x49, - SM8521_SG2L = 0x4A, - SM8521_4B = 0x4B, /* reserved */ - SM8521_SG2TH = 0x4C, - SM8521_SG2TL = 0x4D, - SM8521_SGDA = 0x4E, - SM8521_4F = 0x4F, /* reserved */ - SM8521_TM0C = 0x50, - SM8521_TM0D = 0x51, - SM8521_TM1C = 0x52, - SM8521_TM1D = 0x53, - SM8521_CLKT = 0x54, - SM8521_55 = 0x55, /* reserved */ - SM8521_56 = 0x56, /* reserved */ - SM8521_57 = 0x57, /* reserved */ - SM8521_58 = 0x58, /* reserved */ - SM8521_59 = 0x59, /* reserved */ - SM8521_5A = 0x5A, /* reserved */ - SM8521_5B = 0x5B, /* reserved */ - SM8521_5C = 0x5C, /* reserved */ - SM8521_5D = 0x5D, /* reserved */ - SM8521_WDT = 0x5E, - SM8521_WDTC = 0x5F, - SM8521_SG0W0 = 0x60, - SM8521_SG0W1 = 0x61, - SM8521_SG0W2 = 0x62, - SM8521_SG0W3 = 0x63, - SM8521_SG0W4 = 0x64, - SM8521_SG0W5 = 0x65, - SM8521_SG0W6 = 0x66, - SM8521_SG0W7 = 0x67, - SM8521_SG0W8 = 0x68, - SM8521_SG0W9 = 0x69, - SM8521_SG0W10 = 0x6A, - SM8521_SG0W11 = 0x6B, - SM8521_SG0W12 = 0x6C, - SM8521_SG0W13 = 0x6D, - SM8521_SG0W14 = 0x6E, - SM8521_SG0W15 = 0x6F, - SM8521_SG1W0 = 0x70, - SM8521_SG1W1 = 0x71, - SM8521_SG1W2 = 0x72, - SM8521_SG1W3 = 0x73, - SM8521_SG1W4 = 0x74, - SM8521_SG1W5 = 0x75, - SM8521_SG1W6 = 0x76, - SM8521_SG1W7 = 0x77, - SM8521_SG1W8 = 0x78, - SM8521_SG1W9 = 0x79, - SM8521_SG1W10 = 0x7A, - SM8521_SG1W11 = 0x7B, - SM8521_SG1W12 = 0x7C, - SM8521_SG1W13 = 0x7D, - SM8521_SG1W14 = 0x7E, - SM8521_SG1W15 = 0x7F -}; - -struct GAMECOM_DMA -{ - int enabled; - int transfer_mode; - int decrement_y; - int decrement_x; - int overwrite_mode; - int width_x; - int width_y; - int width_x_count; - int width_y_count; - int source_x; - int source_x_current; - int source_y; - int source_width; - int dest_x; - int dest_x_current; - int dest_y; - int dest_width; - int state_count; - int state_pixel; - int state_limit; - UINT8 palette[4]; - UINT8 *source_bank; - unsigned int source_current; - unsigned int source_line; - unsigned int source_mask; - UINT8 *dest_bank; - unsigned int dest_current; - unsigned int dest_line; - unsigned int dest_mask; -}; - -struct GAMECOM_TIMER -{ - int enabled; - int state_count; - int state_limit; - int check_value; -}; - -struct gamecom_sound_t -{ - UINT8 sgc; - UINT8 sg0l; - UINT8 sg1l; - UINT8 sg2l; - UINT16 sg0t; - UINT16 sg1t; - UINT16 sg2t; - UINT8 sgda; - UINT8 sg0w[16]; - UINT8 sg1w[16]; -}; - - -class gamecom_state : public driver_device -{ -public: - gamecom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_p_videoram(*this,"videoram") - , m_p_nvram(*this,"nvram") - , m_maincpu(*this, "maincpu") - , m_dac(*this, "dac") - , m_cart1(*this, "cartslot1") - , m_cart2(*this, "cartslot2") - , m_bank1(*this, "bank1") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - , m_bank4(*this, "bank4") - , m_region_maincpu(*this, "maincpu") - , m_region_kernel(*this, "kernel") - , m_io_in0(*this, "IN0") - , m_io_in1(*this, "IN1") - , m_io_in2(*this, "IN2") - , m_io_grid(*this, "GRID") - { } - - DECLARE_READ8_MEMBER( gamecom_internal_r ); - DECLARE_READ8_MEMBER( gamecom_pio_r ); - DECLARE_WRITE8_MEMBER( gamecom_internal_w ); - DECLARE_WRITE8_MEMBER( gamecom_pio_w ); - DECLARE_DRIVER_INIT(gamecom); - DECLARE_PALETTE_INIT(gamecom); - INTERRUPT_GEN_MEMBER(gamecom_interrupt); - TIMER_CALLBACK_MEMBER(gamecom_clock_timer_callback); - TIMER_CALLBACK_MEMBER(gamecom_scanline); - DECLARE_WRITE8_MEMBER( gamecom_handle_dma ); - DECLARE_WRITE8_MEMBER( gamecom_update_timers ); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( gamecom_cart1 ); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( gamecom_cart2 ); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -private: - UINT8 *m_p_ram; - UINT8 *m_cart_ptr; - UINT8 m_lcdc_reg; - UINT8 m_lch_reg; - UINT8 m_lcv_reg; - UINT16 m_scanline; - UINT16 m_base_address; - memory_region *m_cart1_rom; - memory_region *m_cart2_rom; - emu_timer *m_clock_timer; - emu_timer *m_scanline_timer; - GAMECOM_DMA m_dma; - GAMECOM_TIMER m_timer[2]; - gamecom_sound_t m_sound; - bitmap_ind16 m_bitmap; - void gamecom_set_mmu(UINT8 mmu, UINT8 data); - void handle_stylus_press(int column); - void recompute_lcd_params(); - void handle_input_press(UINT16 mux_data); - int common_load(device_image_interface &image, generic_slot_device *slot); - virtual void machine_reset(); - virtual void video_start(); - required_shared_ptr m_p_videoram; - required_shared_ptr m_p_nvram; - required_device m_maincpu; - required_device m_dac; - required_device m_cart1; - required_device m_cart2; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_memory_region m_region_maincpu; - required_memory_region m_region_kernel; - required_ioport m_io_in0; - required_ioport m_io_in1; - required_ioport m_io_in2; - required_ioport_array<13> m_io_grid; -}; - -#endif /* GAMECOM_H_ */ diff --git a/src/mess/includes/gamepock.h b/src/mess/includes/gamepock.h deleted file mode 100644 index 678db1dc9f4..00000000000 --- a/src/mess/includes/gamepock.h +++ /dev/null @@ -1,47 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#ifndef _GAMEPOCK_H_ -#define _GAMEPOCK_H_ -#include "sound/speaker.h" -#include "bus/generic/slot.h" - -struct HD44102CH { - UINT8 enabled; - UINT8 start_page; - UINT8 address; - UINT8 y_inc; - UINT8 ram[256]; /* There are actually 50 x 4 x 8 bits. This just makes addressing easier. */ -}; - -class gamepock_state : public driver_device -{ -public: - gamepock_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cart(*this, "cartslot") - { } - - virtual void machine_reset(); - - UINT8 m_port_a; - UINT8 m_port_b; - HD44102CH m_hd44102ch[3]; - - void hd44102ch_w( int which, int c_d, UINT8 data ); - void hd44102ch_init( int which ); - void lcd_update(); - - DECLARE_WRITE8_MEMBER( port_a_w ); - DECLARE_READ8_MEMBER( port_b_r ); - DECLARE_WRITE8_MEMBER( port_b_w ); - DECLARE_READ8_MEMBER( port_c_r ); - UINT32 screen_update_gamepock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_speaker; - required_device m_cart; - DECLARE_WRITE_LINE_MEMBER(gamepock_to_w); -}; - -#endif diff --git a/src/mess/includes/gb.h b/src/mess/includes/gb.h deleted file mode 100644 index 714daafa832..00000000000 --- a/src/mess/includes/gb.h +++ /dev/null @@ -1,171 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/***************************************************************************** - * - * includes/gb.h - * - ****************************************************************************/ - -#ifndef GB_H_ -#define GB_H_ - -#include "audio/gb.h" -#include "cpu/lr35902/lr35902.h" -#include "bus/gameboy/gb_slot.h" -#include "machine/ram.h" -#include "video/gb_lcd.h" - -/* Interrupts */ -#define VBL_INT 0 /* V-Blank */ -#define LCD_INT 1 /* LCD Status */ -#define TIM_INT 2 /* Timer */ -#define SIO_INT 3 /* Serial I/O */ -#define EXT_INT 4 /* Joypad */ - -#ifdef TIMER -#undef TIMER -#endif - -/* Cartridge types */ -#define CART_RAM 0x01 /* Cartridge has RAM */ -#define BATTERY 0x02 /* Cartridge has a battery to save RAM */ -#define TIMER 0x04 /* Cartridge has a real-time-clock (MBC3 only) */ -#define RUMBLE 0x08 /* Cartridge has a rumble motor (MBC5 only) */ -#define SRAM 0x10 /* Cartridge has SRAM */ -#define UNKNOWN 0x80 /* Cartridge is of an unknown type */ - -#define DMG_FRAMES_PER_SECOND 59.732155 -#define SGB_FRAMES_PER_SECOND 61.17 - - -#define MAX_ROMBANK 512 -#define MAX_RAMBANK 256 - - - -class gb_state : public driver_device -{ -public: - gb_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cartslot(*this, "gbslot"), - m_maincpu(*this, "maincpu"), - m_custom(*this, "custom"), - m_region_maincpu(*this, "maincpu"), - m_rambank(*this, "cgb_ram"), - m_inputs(*this, "INPUTS"), - m_bios_hack(*this, "SKIP_CHECK"), - m_ram(*this, RAM_TAG), - m_lcd(*this, "lcd") { } - - //gb_state driver_data; - UINT8 m_gb_io[0x10]; - - /* Timer related */ - UINT16 m_divcount; - UINT8 m_shift; - UINT16 m_shift_cycles; - UINT8 m_triggering_irq; - UINT8 m_reloading; - - /* Serial I/O related */ - UINT32 m_sio_count; /* Serial I/O counter */ - emu_timer *m_gb_serial_timer; - - /* SGB variables */ - INT8 m_sgb_packets; - UINT8 m_sgb_bitcount; - UINT8 m_sgb_bytecount; - UINT8 m_sgb_start; - UINT8 m_sgb_rest; - UINT8 m_sgb_controller_no; - UINT8 m_sgb_controller_mode; - UINT8 m_sgb_data[0x100]; - - /* CGB variables */ - UINT8 *m_gbc_rammap[8]; /* (CGB) Addresses of internal RAM banks */ - UINT8 m_gbc_rambank; /* (CGB) Current CGB RAM bank */ - - int m_bios_disable; - - DECLARE_WRITE8_MEMBER(gb_io_w); - DECLARE_WRITE8_MEMBER(gb_io2_w); - DECLARE_WRITE8_MEMBER(sgb_io_w); - DECLARE_READ8_MEMBER(gb_ie_r); - DECLARE_WRITE8_MEMBER(gb_ie_w); - DECLARE_READ8_MEMBER(gb_io_r); - DECLARE_WRITE8_MEMBER(gbc_io2_w); - DECLARE_READ8_MEMBER(gbc_io2_r); - DECLARE_PALETTE_INIT(gb); - DECLARE_MACHINE_START(sgb); - DECLARE_MACHINE_RESET(sgb); - DECLARE_PALETTE_INIT(sgb); - DECLARE_PALETTE_INIT(gbp); - DECLARE_MACHINE_START(gbc); - DECLARE_MACHINE_RESET(gbc); - DECLARE_PALETTE_INIT(gbc); - TIMER_CALLBACK_MEMBER(gb_serial_timer_proc); - DECLARE_WRITE8_MEMBER(gb_timer_callback); - - DECLARE_READ8_MEMBER(gb_cart_r); - DECLARE_READ8_MEMBER(gbc_cart_r); - DECLARE_WRITE8_MEMBER(gb_bank_w); - DECLARE_READ8_MEMBER(gb_ram_r); - DECLARE_WRITE8_MEMBER(gb_ram_w); - DECLARE_READ8_MEMBER(gb_echo_r); - DECLARE_WRITE8_MEMBER(gb_echo_w); - optional_device m_cartslot; - -protected: - required_device m_maincpu; - required_device m_custom; - required_memory_region m_region_maincpu; - optional_memory_bank m_rambank; // cgb - required_ioport m_inputs; - required_ioport m_bios_hack; - optional_device m_ram; - required_device m_lcd; - - void gb_timer_increment(); - void gb_timer_check_irq(); - void gb_init(); - void gb_init_regs(); - void gb_video_reset(int mode); - void gb_video_start(int mode); - - void save_gb_base(); - void save_gbc_only(); - void save_sgb_only(); - - virtual void machine_start(); - virtual void machine_reset(); -}; - - -class megaduck_state : public gb_state -{ -public: - megaduck_state(const machine_config &mconfig, device_type type, const char *tag) - : gb_state(mconfig, type, tag) - , m_cartslot(*this, "duckslot") - { } - - DECLARE_READ8_MEMBER(megaduck_video_r); - DECLARE_WRITE8_MEMBER(megaduck_video_w); - DECLARE_WRITE8_MEMBER(megaduck_sound_w1); - DECLARE_READ8_MEMBER(megaduck_sound_r1); - DECLARE_WRITE8_MEMBER(megaduck_sound_w2); - DECLARE_READ8_MEMBER(megaduck_sound_r2); - DECLARE_MACHINE_START(megaduck); - DECLARE_MACHINE_RESET(megaduck); - DECLARE_PALETTE_INIT(megaduck); - - DECLARE_READ8_MEMBER(cart_r); - DECLARE_WRITE8_MEMBER(bank1_w); - DECLARE_WRITE8_MEMBER(bank2_w); - optional_device m_cartslot; -}; - - - -#endif /* GB_H_ */ diff --git a/src/mess/includes/gba.h b/src/mess/includes/gba.h deleted file mode 100644 index 58637b0275f..00000000000 --- a/src/mess/includes/gba.h +++ /dev/null @@ -1,279 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont,Ryan Holtz -#ifndef _GBA_H_ -#define _GBA_H_ - -#include "audio/gb.h" -#include "machine/intelfsh.h" -#include "bus/gba/gba_slot.h" -#include "sound/dac.h" - -#define DISPSTAT_VBL 0x0001 -#define DISPSTAT_HBL 0x0002 -#define DISPSTAT_VCNT 0x0004 -#define DISPSTAT_VBL_IRQ_EN 0x0008 -#define DISPSTAT_HBL_IRQ_EN 0x0010 -#define DISPSTAT_VCNT_IRQ_EN 0x0020 -#define DISPSTAT_VCNT_VALUE 0xff00 - -#define INT_VBL 0x0001 -#define INT_HBL 0x0002 -#define INT_VCNT 0x0004 -#define INT_TM0_OVERFLOW 0x0008 -#define INT_TM1_OVERFLOW 0x0010 -#define INT_TM2_OVERFLOW 0x0020 -#define INT_TM3_OVERFLOW 0x0040 -#define INT_SIO 0x0080 -#define INT_DMA0 0x0100 -#define INT_DMA1 0x0200 -#define INT_DMA2 0x0400 -#define INT_DMA3 0x0800 -#define INT_KEYPAD 0x1000 -#define INT_GAMEPAK 0x2000 - -#define DISPCNT_MODE 0x0007 -#define DISPCNT_FRAMESEL 0x0010 -#define DISPCNT_HBL_FREE 0x0020 - -#define DISPCNT_VRAM_MAP 0x0040 -#define DISPCNT_VRAM_MAP_2D 0x0000 -#define DISPCNT_VRAM_MAP_1D 0x0040 - -#define DISPCNT_BLANK 0x0080 -#define DISPCNT_BG0_EN 0x0100 -#define DISPCNT_BG1_EN 0x0200 -#define DISPCNT_BG2_EN 0x0400 -#define DISPCNT_BG3_EN 0x0800 -#define DISPCNT_OBJ_EN 0x1000 -#define DISPCNT_WIN0_EN 0x2000 -#define DISPCNT_WIN1_EN 0x4000 -#define DISPCNT_OBJWIN_EN 0x8000 - -#define OBJ_Y_COORD 0x00ff -#define OBJ_ROZMODE 0x0300 -#define OBJ_ROZMODE_NONE 0x0000 -#define OBJ_ROZMODE_ROZ 0x0100 -#define OBJ_ROZMODE_DISABLE 0x0200 -#define OBJ_ROZMODE_DBLROZ 0x0300 - -#define OBJ_MODE 0x0c00 -#define OBJ_MODE_NORMAL 0x0000 -#define OBJ_MODE_ALPHA 0x0400 -#define OBJ_MODE_WINDOW 0x0800 -#define OBJ_MODE_UNDEFINED 0x0c00 - -#define OBJ_MOSAIC 0x1000 - -#define OBJ_PALMODE 0x2000 -#define OBJ_PALMODE_16 0x0000 -#define OBJ_PALMODE_256 0x2000 - -#define OBJ_SHAPE 0xc000 -#define OBJ_SHAPE_SQR 0x0000 -#define OBJ_SHAPE_HORIZ 0x4000 -#define OBJ_SHAPE_VERT 0x8000 - -#define OBJ_X_COORD 0x01ff -#define OBJ_SCALE_PARAM 0x3e00 -#define OBJ_SCALE_PARAM_SHIFT 9 -#define OBJ_HFLIP 0x1000 -#define OBJ_VFLIP 0x2000 -#define OBJ_SIZE 0xc000 -#define OBJ_SIZE_8 0x0000 -#define OBJ_SIZE_16 0x4000 -#define OBJ_SIZE_32 0x8000 -#define OBJ_SIZE_64 0xc000 - -#define OBJ_TILENUM 0x03ff -#define OBJ_PRIORITY 0x0c00 -#define OBJ_PRIORITY_SHIFT 10 -#define OBJ_PALNUM 0xf000 -#define OBJ_PALNUM_SHIFT 12 - -#define BGCNT_SCREENSIZE 0xc000 -#define BGCNT_SCREENSIZE_SHIFT 14 -#define BGCNT_PALETTESET_WRAP 0x2000 -#define BGCNT_SCREENBASE 0x1f00 -#define BGCNT_SCREENBASE_SHIFT 8 -#define BGCNT_PALETTE256 0x0080 -#define BGCNT_MOSAIC 0x0040 -#define BGCNT_CHARBASE 0x003c -#define BGCNT_CHARBASE_SHIFT 2 -#define BGCNT_PRIORITY 0x0003 - -#define BLDCNT_BG0TP1 0x0001 -#define BLDCNT_BG1TP1 0x0002 -#define BLDCNT_BG2TP1 0x0004 -#define BLDCNT_BG3TP1 0x0008 -#define BLDCNT_OBJTP1 0x0010 -#define BLDCNT_BDTP1 0x0020 -#define BLDCNT_SFX 0x00c0 -#define BLDCNT_SFX_NONE 0x0000 -#define BLDCNT_SFX_ALPHA 0x0040 -#define BLDCNT_SFX_LIGHTEN 0x0080 -#define BLDCNT_SFX_DARKEN 0x00c0 -#define BLDCNT_BG0TP2 0x0100 -#define BLDCNT_BG1TP2 0x0200 -#define BLDCNT_BG2TP2 0x0400 -#define BLDCNT_BG3TP2 0x0800 -#define BLDCNT_OBJTP2 0x1000 -#define BLDCNT_BDTP2 0x2000 -#define BLDCNT_TP2_SHIFT 8 - -#define TILEOBJ_TILE 0x03ff -#define TILEOBJ_HFLIP 0x0400 -#define TILEOBJ_VFLIP 0x0800 -#define TILEOBJ_PALETTE 0xf000 - -/* driver state */ -class gba_state : public driver_device -{ -public: - gba_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gba_pram(*this, "gba_pram"), - m_gba_vram(*this, "gba_vram"), - m_gba_oam(*this, "gba_oam"), - m_ladac(*this, "direct_a_left"), - m_radac(*this, "direct_a_right"), - m_lbdac(*this, "direct_b_left"), - m_rbdac(*this, "direct_b_right"), - m_gbsound(*this, "custom"), - m_cart(*this, "cartslot"), - m_region_maincpu(*this, "maincpu"), - m_io_inputs(*this, "INPUTS"), - m_bios_hack(*this, "SKIP_CHECK") - { } - - required_device m_maincpu; - required_shared_ptr m_gba_pram; - required_shared_ptr m_gba_vram; - required_shared_ptr m_gba_oam; - required_device m_ladac; - required_device m_radac; - required_device m_lbdac; - required_device m_rbdac; - required_device m_gbsound; - required_device m_cart; - - void request_irq(UINT32 int_type); - void dma_exec(FPTR ch); - void audio_tick(int ref); - - // video-related - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - bitmap_ind16 m_bitmap; - - UINT32 m_DISPSTAT; - UINT32 m_BG2X, m_BG2Y, m_BG3X, m_BG3Y; - UINT16 m_DISPCNT, m_GRNSWAP; - UINT16 m_BG0CNT, m_BG1CNT, m_BG2CNT, m_BG3CNT; - UINT16 m_BG0HOFS, m_BG0VOFS, m_BG1HOFS, m_BG1VOFS, m_BG2HOFS, m_BG2VOFS, m_BG3HOFS, m_BG3VOFS; - UINT16 m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, m_BG3PA, m_BG3PB, m_BG3PC, m_BG3PD; - UINT16 m_WIN0H, m_WIN1H, m_WIN0V, m_WIN1V, m_WININ, m_WINOUT; - UINT16 m_MOSAIC; - UINT16 m_BLDCNT; - UINT16 m_BLDALPHA; - UINT16 m_BLDY; - UINT8 m_SOUNDCNT_X; - UINT16 m_SOUNDCNT_H; - UINT16 m_SOUNDBIAS; - UINT16 m_SIOMULTI0, m_SIOMULTI1, m_SIOMULTI2, m_SIOMULTI3; - UINT16 m_SIOCNT, m_SIODATA8; - UINT16 m_KEYCNT; - UINT16 m_RCNT; - UINT16 m_JOYCNT; - UINT32 m_JOY_RECV, m_JOY_TRANS; - UINT16 m_JOYSTAT; - UINT16 m_IR, m_IE, m_IF, m_IME; - UINT16 m_WAITCNT; - UINT8 m_POSTFLG; - UINT8 m_HALTCNT; - - UINT8 m_windowOn; - UINT8 m_fxOn; - UINT8 m_gfxBG2Changed; - UINT8 m_gfxBG3Changed; - INT32 m_gfxBG2X; - INT32 m_gfxBG2Y; - INT32 m_gfxBG3X; - INT32 m_gfxBG3Y; - - // DMA - emu_timer *m_dma_timer[4]; - UINT32 m_dma_regs[16]; - UINT32 m_dma_src[4]; - UINT32 m_dma_dst[4]; - UINT32 m_dma_cnt[4]; - UINT32 m_dma_srcadd[4]; - UINT32 m_dma_dstadd[4]; - - // Timers - UINT32 m_timer_regs[4]; - UINT16 m_timer_reload[4]; - int m_timer_recalc[4]; - - emu_timer *m_tmr_timer[4], *m_irq_timer; - emu_timer *m_scan_timer, *m_hbl_timer; - - double m_timer_hz[4]; - - int m_fifo_a_ptr; - int m_fifo_b_ptr; - int m_fifo_a_in; - int m_fifo_b_in; - UINT8 m_fifo_a[20]; - UINT8 m_fifo_b[20]; - UINT32 m_xferscan[7][240+2048]; - - UINT32 m_bios_last_address; - int m_bios_protected; - - DIRECT_UPDATE_MEMBER(gba_direct); - DECLARE_READ32_MEMBER(gba_io_r); - DECLARE_WRITE32_MEMBER(gba_io_w); - DECLARE_WRITE32_MEMBER(gba_pram_w); - DECLARE_WRITE32_MEMBER(gba_vram_w); - DECLARE_WRITE32_MEMBER(gba_oam_w); - DECLARE_READ32_MEMBER(gba_bios_r); - DECLARE_READ32_MEMBER(gba_10000000_r); - DECLARE_READ32_MEMBER(sram_r); - DECLARE_WRITE32_MEMBER(sram_w); - DECLARE_READ32_MEMBER(flash_r); - DECLARE_WRITE32_MEMBER(flash_w); - DECLARE_READ32_MEMBER(eeprom_r); - DECLARE_WRITE32_MEMBER(eeprom_w); - DECLARE_DRIVER_INIT(gbadv); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(gba); - TIMER_CALLBACK_MEMBER(dma_complete); - TIMER_CALLBACK_MEMBER(timer_expire); - TIMER_CALLBACK_MEMBER(handle_irq); - TIMER_CALLBACK_MEMBER(perform_hbl); - TIMER_CALLBACK_MEMBER(perform_scan); - - // video related - void draw_scanline(int y); - - void draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth); - void draw_roz_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed); - void draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, UINT32 hofs, UINT32 vofs); - void draw_gba_oam_window(UINT32 *scanline, int y); - void draw_gba_oam(UINT32 *scanline, int y); - - inline int is_in_window(int x, int window); - - inline void update_mask(UINT8* mask, int mode, int submode, UINT32* obj_win, UINT8 inwin0, UINT8 inwin1, UINT8 in0_mask, UINT8 in1_mask, UINT8 out_mask); - void draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); - -protected: - required_region_ptr m_region_maincpu; - required_ioport m_io_inputs; - required_ioport m_bios_hack; -}; - - -#endif diff --git a/src/mess/includes/genpc.h b/src/mess/includes/genpc.h deleted file mode 100644 index 08cc742aa7f..00000000000 --- a/src/mess/includes/genpc.h +++ /dev/null @@ -1,202 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Miodrag Milanovic -/***************************************************************************** - * - * includes/pc.h - * - ****************************************************************************/ - -#ifndef GENPC_H_ -#define GENPC_H_ - -#include "machine/ins8250.h" -#include "machine/i8255.h" -#include "machine/am9517a.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "bus/pc_kbd/pc_kbdc.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "sound/speaker.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - -#define MCFG_IBM5160_MOTHERBOARD_ADD(_tag, _cputag) \ - MCFG_DEVICE_ADD(_tag, IBM5160_MOTHERBOARD, 0) \ - ibm5160_mb_device::static_set_cputag(*device, _cputag); -// ======================> ibm5160_mb_device -class ibm5160_mb_device : public device_t -{ -public: - // construction/destruction - ibm5160_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - // inline configuration - static void static_set_cputag(device_t &device, const char *tag); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler); -public: - required_device m_maincpu; - required_device m_pic8259; - required_device m_dma8237; - required_device m_pit8253; - optional_device m_ppi8255; - required_device m_speaker; - required_device m_isabus; - optional_device m_pc_kbdc; - required_device m_ram; - - /* U73 is an LS74 - dual flip flop */ - /* Q2 is set by OUT1 from the 8253 and goes to DRQ1 on the 8237 */ - UINT8 m_u73_q2; - UINT8 m_out1; - int m_dma_channel; - UINT8 m_dma_offset[4]; - UINT8 m_pc_spkrdata; - UINT8 m_pit_out2; - bool m_cur_eop; - - UINT8 m_nmi_enabled; - - int m_ppi_portc_switch_high; - int m_ppi_speaker; - int m_ppi_keyboard_clear; - UINT8 m_ppi_keyb_clock; - UINT8 m_ppi_portb; - UINT8 m_ppi_clock_signal; - UINT8 m_ppi_data_signal; - UINT8 m_ppi_shift_register; - UINT8 m_ppi_shift_enable; - - // interface to the keyboard - virtual DECLARE_WRITE_LINE_MEMBER( keyboard_clock_w ); - DECLARE_WRITE_LINE_MEMBER( keyboard_data_w ); - - virtual DECLARE_READ8_MEMBER ( pc_ppi_porta_r ); - virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r ); - virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w ); - - DECLARE_WRITE_LINE_MEMBER( pc_pit8253_out1_changed ); - DECLARE_WRITE_LINE_MEMBER( pc_pit8253_out2_changed ); - - DECLARE_WRITE_LINE_MEMBER( pc_dma_hrq_changed ); - DECLARE_WRITE_LINE_MEMBER( pc_dma8237_out_eop ); - DECLARE_READ8_MEMBER( pc_dma_read_byte ); - DECLARE_WRITE8_MEMBER( pc_dma_write_byte ); - DECLARE_READ8_MEMBER( pc_dma8237_1_dack_r ); - DECLARE_READ8_MEMBER( pc_dma8237_2_dack_r ); - DECLARE_READ8_MEMBER( pc_dma8237_3_dack_r ); - DECLARE_WRITE8_MEMBER( pc_dma8237_1_dack_w ); - DECLARE_WRITE8_MEMBER( pc_dma8237_2_dack_w ); - DECLARE_WRITE8_MEMBER( pc_dma8237_3_dack_w ); - DECLARE_WRITE8_MEMBER( pc_dma8237_0_dack_w ); - DECLARE_WRITE_LINE_MEMBER( pc_dack0_w ); - DECLARE_WRITE_LINE_MEMBER( pc_dack1_w ); - DECLARE_WRITE_LINE_MEMBER( pc_dack2_w ); - DECLARE_WRITE_LINE_MEMBER( pc_dack3_w ); - - DECLARE_WRITE_LINE_MEMBER( pc_speaker_set_spkrdata ); - - DECLARE_READ8_MEMBER(pc_page_r); - DECLARE_WRITE8_MEMBER(pc_page_w); - DECLARE_WRITE8_MEMBER(nmi_enable_w); - - const char *m_cputag; - -private: - void pc_select_dma_channel(int channel, bool state); -}; - - -// device type definition -extern const device_type IBM5160_MOTHERBOARD; - - -#define MCFG_IBM5150_MOTHERBOARD_ADD(_tag, _cputag) \ - MCFG_DEVICE_ADD(_tag, IBM5150_MOTHERBOARD, 0) \ - ibm5150_mb_device::static_set_cputag(*device, _cputag); - -// ======================> ibm5150_mb_device -class ibm5150_mb_device : public ibm5160_mb_device -{ -public: - // construction/destruction - ibm5150_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; - - virtual DECLARE_WRITE_LINE_MEMBER( keyboard_clock_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - required_device m_cassette; -public: - virtual DECLARE_READ8_MEMBER ( pc_ppi_porta_r ); - virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r ); - virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w ); -}; - - -// device type definition -extern const device_type IBM5150_MOTHERBOARD; - - -#define MCFG_EC1841_MOTHERBOARD_ADD(_tag, _cputag) \ - MCFG_DEVICE_ADD(_tag, EC1841_MOTHERBOARD, 0) \ - ec1841_mb_device::static_set_cputag(*device, _cputag); - -class ec1841_mb_device : public ibm5160_mb_device -{ -public: - // construction/destruction - ec1841_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -public: - virtual DECLARE_READ8_MEMBER ( pc_ppi_portc_r ); - virtual DECLARE_WRITE8_MEMBER( pc_ppi_portb_w ); - - virtual DECLARE_WRITE_LINE_MEMBER( keyboard_clock_w ); -}; - -extern const device_type EC1841_MOTHERBOARD; - -#define MCFG_PCNOPPI_MOTHERBOARD_ADD(_tag, _cputag) \ - MCFG_DEVICE_ADD(_tag, PCNOPPI_MOTHERBOARD, 0) \ - pc_noppi_mb_device::static_set_cputag(*device, _cputag); - -class pc_noppi_mb_device : public ibm5160_mb_device -{ -public: - // construction/destruction - pc_noppi_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; -protected: - // device-level overrides - void device_start(); -}; - -extern const device_type PCNOPPI_MOTHERBOARD; - -#endif /* GENPC_H_ */ diff --git a/src/mess/includes/gp32.h b/src/mess/includes/gp32.h deleted file mode 100644 index a3754f5b9aa..00000000000 --- a/src/mess/includes/gp32.h +++ /dev/null @@ -1,250 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -#ifndef _GP32_H_ -#define _GP32_H_ - -#include "machine/smartmed.h" -#include "sound/dac.h" -#include "machine/nvram.h" - - -#define INT_ADC 31 -#define INT_RTC 30 -#define INT_UTXD1 29 -#define INT_UTXD0 28 -#define INT_IIC 27 -#define INT_USBH 26 -#define INT_USBD 25 -#define INT_URXD1 24 -#define INT_URXD0 23 -#define INT_SPI 22 -#define INT_MMC 21 -#define INT_DMA3 20 -#define INT_DMA2 19 -#define INT_DMA1 18 -#define INT_DMA0 17 -#define INT_RESERVED 16 -#define INT_UERR 15 -#define INT_TIMER4 14 -#define INT_TIMER3 13 -#define INT_TIMER2 12 -#define INT_TIMER1 11 -#define INT_TIMER0 10 -#define INT_WDT 9 -#define INT_TICK 8 -#define INT_EINT7 7 -#define INT_EINT6 6 -#define INT_EINT5 5 -#define INT_EINT4 4 -#define INT_EINT3 3 -#define INT_EINT2 2 -#define INT_EINT1 1 -#define INT_EINT0 0 - -struct s3c240x_lcd_t -{ - UINT32 vramaddr_cur; - UINT32 vramaddr_max; - UINT32 offsize; - UINT32 pagewidth_cur; - UINT32 pagewidth_max; - UINT32 bppmode; - UINT32 bswp, hwswp; - UINT32 hozval, lineval; - int vpos, hpos; -}; - -struct smc_t -{ - int add_latch; - int chip; - int cmd_latch; - int do_read; - int do_write; - int read; - int wp; - int busy; - UINT8 datarx; - UINT8 datatx; -}; - -struct i2s_t -{ - int l3d; - int l3m; - int l3c; -}; - -struct s3c240x_iic_t -{ - UINT8 data[4]; - int data_index; - UINT16 address; -}; - -struct s3c240x_iis_t -{ - UINT16 fifo[16/2]; - int fifo_index; -}; - - -class gp32_state : public driver_device -{ -public: - gp32_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_s3c240x_ram(*this, "s3c240x_ram"), - m_maincpu(*this, "maincpu"), - m_smartmedia(*this, "smartmedia"), - m_dac1(*this, "dac1"), - m_dac2(*this, "dac2"), - m_nvram(*this, "nvram"), - m_io_in0(*this, "IN0"), - m_io_in1(*this, "IN1"), - m_palette(*this, "palette") { } - - virtual void video_start(); - - required_shared_ptr m_s3c240x_ram; - UINT8 *m_eeprom_data; - UINT32 m_s3c240x_lcd_regs[0x400/4]; - emu_timer *m_s3c240x_lcd_timer; - s3c240x_lcd_t m_s3c240x_lcd; - UINT32 m_s3c240x_lcd_palette[0x400/4]; - UINT32 m_s3c240x_clkpow_regs[0x18/4]; - UINT32 m_s3c240x_irq_regs[0x18/4]; - emu_timer *m_s3c240x_pwm_timer[5]; - UINT32 m_s3c240x_pwm_regs[0x44/4]; - emu_timer *m_s3c240x_dma_timer[4]; - UINT32 m_s3c240x_dma_regs[0x7c/4]; - smc_t m_smc; - i2s_t m_i2s; - UINT32 m_s3c240x_gpio[0x60/4]; - UINT32 m_s3c240x_memcon_regs[0x34/4]; - UINT32 m_s3c240x_usb_host_regs[0x5C/4]; - UINT32 m_s3c240x_uart_0_regs[0x2C/4]; - UINT32 m_s3c240x_uart_1_regs[0x2C/4]; - UINT32 m_s3c240x_usb_device_regs[0xBC/4]; - UINT32 m_s3c240x_watchdog_regs[0x0C/4]; - s3c240x_iic_t m_s3c240x_iic; - emu_timer *m_s3c240x_iic_timer; - UINT32 m_s3c240x_iic_regs[0x10/4]; - s3c240x_iis_t m_s3c240x_iis; - emu_timer *m_s3c240x_iis_timer; - UINT32 m_s3c240x_iis_regs[0x14/4]; - UINT32 m_s3c240x_rtc_regs[0x4C/4]; - UINT32 m_s3c240x_adc_regs[0x08/4]; - UINT32 m_s3c240x_spi_regs[0x18/4]; - UINT32 m_s3c240x_mmc_regs[0x40/4]; - bitmap_rgb32 m_bitmap; - DECLARE_READ32_MEMBER(s3c240x_lcd_r); - DECLARE_WRITE32_MEMBER(s3c240x_lcd_w); - DECLARE_READ32_MEMBER(s3c240x_lcd_palette_r); - DECLARE_WRITE32_MEMBER(s3c240x_lcd_palette_w); - DECLARE_READ32_MEMBER(s3c240x_clkpow_r); - DECLARE_WRITE32_MEMBER(s3c240x_clkpow_w); - DECLARE_READ32_MEMBER(s3c240x_irq_r); - DECLARE_WRITE32_MEMBER(s3c240x_irq_w); - DECLARE_READ32_MEMBER(s3c240x_pwm_r); - DECLARE_WRITE32_MEMBER(s3c240x_pwm_w); - DECLARE_READ32_MEMBER(s3c240x_dma_r); - DECLARE_WRITE32_MEMBER(s3c240x_dma_w); - DECLARE_READ32_MEMBER(s3c240x_gpio_r); - DECLARE_WRITE32_MEMBER(s3c240x_gpio_w); - DECLARE_READ32_MEMBER(s3c240x_memcon_r); - DECLARE_WRITE32_MEMBER(s3c240x_memcon_w); - DECLARE_READ32_MEMBER(s3c240x_usb_host_r); - DECLARE_WRITE32_MEMBER(s3c240x_usb_host_w); - DECLARE_READ32_MEMBER(s3c240x_uart_0_r); - DECLARE_WRITE32_MEMBER(s3c240x_uart_0_w); - DECLARE_READ32_MEMBER(s3c240x_uart_1_r); - DECLARE_WRITE32_MEMBER(s3c240x_uart_1_w); - DECLARE_READ32_MEMBER(s3c240x_usb_device_r); - DECLARE_WRITE32_MEMBER(s3c240x_usb_device_w); - DECLARE_READ32_MEMBER(s3c240x_watchdog_r); - DECLARE_WRITE32_MEMBER(s3c240x_watchdog_w); - DECLARE_READ32_MEMBER(s3c240x_iic_r); - DECLARE_WRITE32_MEMBER(s3c240x_iic_w); - DECLARE_READ32_MEMBER(s3c240x_iis_r); - DECLARE_WRITE32_MEMBER(s3c240x_iis_w); - DECLARE_READ32_MEMBER(s3c240x_rtc_r); - DECLARE_WRITE32_MEMBER(s3c240x_rtc_w); - DECLARE_READ32_MEMBER(s3c240x_adc_r); - DECLARE_WRITE32_MEMBER(s3c240x_adc_w); - DECLARE_READ32_MEMBER(s3c240x_spi_r); - DECLARE_WRITE32_MEMBER(s3c240x_spi_w); - DECLARE_READ32_MEMBER(s3c240x_mmc_r); - DECLARE_WRITE32_MEMBER(s3c240x_mmc_w); - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update_gp32(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(s3c240x_lcd_timer_exp); - TIMER_CALLBACK_MEMBER(s3c240x_pwm_timer_exp); - TIMER_CALLBACK_MEMBER(s3c240x_dma_timer_exp); - TIMER_CALLBACK_MEMBER(s3c240x_iic_timer_exp); - TIMER_CALLBACK_MEMBER(s3c240x_iis_timer_exp); -protected: - required_device m_maincpu; - required_device m_smartmedia; - required_device m_dac1; - required_device m_dac2; - required_device m_nvram; - required_ioport m_io_in0; - required_ioport m_io_in1; - required_device m_palette; - - UINT32 s3c240x_get_fclk(int reg); - UINT32 s3c240x_get_hclk(int reg); - UINT32 s3c240x_get_pclk(int reg); - void s3c240x_lcd_dma_reload(); - void s3c240x_lcd_dma_init(); - void s3c240x_lcd_configure(); - void s3c240x_lcd_start(); - void s3c240x_lcd_stop(); - void s3c240x_lcd_recalc(); - void s3c240x_check_pending_irq(); - void s3c240x_request_irq(UINT32 int_type); - void s3c240x_dma_reload(int dma); - void s3c240x_dma_trigger(int dma); - void s3c240x_dma_request_iis(); - void s3c240x_dma_request_pwm(); - void s3c240x_dma_start(int dma); - void s3c240x_dma_stop(int dma); - void s3c240x_dma_recalc(int dma); - void s3c240x_pwm_start(int timer); - void s3c240x_pwm_stop(int timer); - void s3c240x_pwm_recalc(int timer); - void s3c240x_iis_start(); - void s3c240x_iis_stop(); - void s3c240x_iis_recalc(); - void smc_reset(); - void smc_init(); - UINT8 smc_read(); - void smc_write(UINT8 data); - void smc_update(); - void i2s_reset(); - void i2s_init(); - void i2s_write(int line, int data); - UINT8 eeprom_read(UINT16 address); - void eeprom_write(UINT16 address, UINT8 data); - void iic_start(); - void iic_stop(); - void iic_resume(); - void s3c240x_machine_start(); - void s3c240x_machine_reset(); - inline rgb_t s3c240x_get_color_5551( UINT16 data); - UINT32 s3c240x_lcd_dma_read( ); - void s3c240x_lcd_render_01( ); - void s3c240x_lcd_render_02( ); - void s3c240x_lcd_render_04( ); - void s3c240x_lcd_render_08( ); - void s3c240x_lcd_render_16( ); - UINT8 i2cmem_read_byte( int last); - void i2cmem_write_byte( UINT8 data); - void i2cmem_start( ); - void i2cmem_stop( ); -}; - - -#endif diff --git a/src/mess/includes/hec2hrp.h b/src/mess/includes/hec2hrp.h deleted file mode 100644 index c30b7bfccd3..00000000000 --- a/src/mess/includes/hec2hrp.h +++ /dev/null @@ -1,199 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:JJ Stacino -///////////////////////////////////////////////////////////////////// -////// HECTOR HEADER FILE ///////////////////////////////////////// -///////////////////////////////////////////////////////////////////// -/* - Hector 2HR+ - Victor - Hector 2HR - Hector HRX - Hector MX40c - Hector MX80c - Hector 1 - Interact - - 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com - 31/06/2009 Video - Robbbert - - 29/10/2009 Update skeleton to functional machine - by yo_fr (jj.stac @ aliceadsl.fr) - - => add Keyboard, - => add color, - => add cassette, - => add sn76477 sound and 1bit sound, - => add joysticks (stick, pot, fire) - => add BR/HR switching - => add bank switch for HRX - => add device MX80c and bank switching for the ROM - 03/01/2010 Update and clean prog by yo_fr (jj.stac@aliceadsl.fr) - => add the port mapping for keyboard - 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M runnig! JJStacino - 11/11/2011 : add the minidisque support -3 pouces 1/2 driver- JJStacino (jj.stac @ aliceadsl.fr) - - don't forget to keep some information about these machine see DChector project : http://dchector.free.fr/ made by DanielCoulom - (and thank's to Daniel!) and Yves site : http://hectorvictor.free.fr/ (thank's too Yves!) - - TODO : Add the cartridge function, - Adjust the one shot and A/D timing (sn76477) -*/ - -#include "machine/upd765.h" -#include "machine/wd_fdc.h" -#include "imagedev/flopdrv.h" -#include "imagedev/cassette.h" -#include "sound/sn76477.h" /* for sn sound*/ - -/* Enum status for high memory bank (c000 - ffff)*/ -enum -{ - HECTOR_BANK_PROG = 0, /* first BANK is program ram*/ - HECTOR_BANK_VIDEO /* second BANK is Video ram */ -}; -/* Status for rom memory bank (0000 - 3fff) in MX machine*/ -enum -{ - HECTORMX_BANK_PAGE0 = 0, /* first BANK is base rom*/ - HECTORMX_BANK_PAGE1, /* second BANK is basic rom */ - HECTORMX_BANK_PAGE2 /* 3 BANK is monitrix / assemblex rom */ -}; -/* Status for rom memory bank (0000 - 3fff) in Mini Disc machine*/ -enum -{ - HECTOR_BANK_BASE = 0, /* first BANK is normal rom*/ - HECTOR_BANK_DISC /* second BANK is extra rom for mini disc use*/ -}; -/* Enum status for low memory bank (00000 - 0fff) for DISC II*/ -enum -{ - DISCII_BANK_RAM = 0, /* first BANK is program ram*/ - DISCII_BANK_ROM /* second BANK is ROM */ -}; - -class hec2hrp_state : public driver_device -{ -public: - hec2hrp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_disc2cpu(*this, "disc2cpu"), - m_cassette(*this, "cassette"), - m_sn(*this, "sn76477"), - m_palette(*this, "palette"), - m_videoram(*this,"videoram"), - m_hector_videoram(*this,"hector_videoram") , - m_keyboard(*this, "KEY"), - m_minidisc_fdc(*this, "wd179x"), - m_floppy0(*this, "wd179x:0") - {} - - DECLARE_FLOPPY_FORMATS(minidisc_formats); - - required_device m_maincpu; - optional_device m_disc2cpu; - required_device m_cassette; - required_device m_sn; - required_device m_palette; - optional_shared_ptr m_videoram; - optional_shared_ptr m_hector_videoram; - required_ioport_array<9> m_keyboard; - - optional_device m_minidisc_fdc; - optional_device m_floppy0; - - UINT8 m_hector_flag_hr; - UINT8 m_hector_flag_80c; - UINT8 m_hector_color[4]; - UINT8 m_hector_disc2_data_r_ready; - UINT8 m_hector_disc2_data_w_ready; - UINT8 m_hector_disc2_data_read; - UINT8 m_hector_disc2_data_write; - UINT8 m_hector_disc2_RNMI; - UINT8 m_state3000; - UINT8 m_write_cassette; - emu_timer *m_Cassette_timer; - UINT8 m_CK_signal ; - UINT8 m_flag_clk; - double m_Pin_Value[29][2]; - int m_AU[17]; - int m_ValMixer; - int m_oldstate3000; - int m_oldstate1000; - UINT8 m_pot0; - UINT8 m_pot1; - UINT8 m_actions; - UINT8 m_hector_port_a; - UINT8 m_hector_port_b; - UINT8 m_hector_port_c_h; - UINT8 m_hector_port_c_l; - UINT8 m_hector_port_cmd; - UINT8 m_cassette_bit; - UINT8 m_cassette_bit_mem; - UINT8 m_Data_K7; - int m_counter_write; - int m_IRQ_current_state; - int m_NMI_current_state; - int m_hector_cmd[10]; - int m_hector_nb_cde; - int m_hector_flag_result; - int m_print; - UINT8 m_hector_videoram_hrx[0x04000]; - - DECLARE_WRITE8_MEMBER(minidisc_control_w); - - DECLARE_WRITE8_MEMBER(hector_switch_bank_w); - DECLARE_WRITE8_MEMBER(hector_keyboard_w); - DECLARE_READ8_MEMBER(hector_keyboard_r); - DECLARE_WRITE8_MEMBER(hector_sn_2000_w); - DECLARE_WRITE8_MEMBER(hector_sn_2800_w); - DECLARE_READ8_MEMBER(hector_cassette_r); - DECLARE_WRITE8_MEMBER(hector_sn_3000_w); - DECLARE_WRITE8_MEMBER(hector_color_a_w); - DECLARE_WRITE8_MEMBER(hector_color_b_w); - DECLARE_READ8_MEMBER(hector_io_8255_r); - DECLARE_WRITE8_MEMBER(hector_io_8255_w); - DECLARE_WRITE8_MEMBER(hector_mx40_io_port_w); - DECLARE_WRITE8_MEMBER(hector_mx80_io_port_w); - DECLARE_MACHINE_START(hec2hrp); - DECLARE_MACHINE_RESET(hec2hrp); - DECLARE_VIDEO_START(hec2hrp); - DECLARE_MACHINE_START(hec2hrx); - DECLARE_MACHINE_RESET(hec2hrx); - DECLARE_MACHINE_START(hec2mdhrx); - DECLARE_MACHINE_RESET(hec2mdhrx); - UINT32 screen_update_hec2hrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(Callback_CK); - - DECLARE_WRITE_LINE_MEMBER( disc2_fdc_interrupt ); - DECLARE_WRITE_LINE_MEMBER( disc2_fdc_dma_irq ); - int isHectorWithDisc2(); - int isHectorWithMiniDisc(); - int isHectorHR(); - int isHectoreXtend(); - void Mise_A_Jour_Etat(int Adresse, int Value ); - void Init_Value_SN76477_Hector(); - void Update_Sound(address_space &space, UINT8 data); - void hector_reset(int hr, int with_D2 ); - void hector_init(); - void Init_Hector_Palette(); - void hector_80c(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) ; - void hector_hr(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) ; - /*----------- defined in machine/hecdisk2.c -----------*/ - - // disc2 handling - DECLARE_READ8_MEMBER( hector_disc2_io00_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io00_port_w); - DECLARE_READ8_MEMBER( hector_disc2_io20_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io20_port_w); - DECLARE_READ8_MEMBER( hector_disc2_io30_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io30_port_w); - DECLARE_READ8_MEMBER( hector_disc2_io40_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io40_port_w); - DECLARE_READ8_MEMBER( hector_disc2_io50_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io50_port_w); - - void hector_disc2_reset(); -}; - -MACHINE_CONFIG_EXTERN( hector_audio ); diff --git a/src/mess/includes/hh_tms1k.h b/src/mess/includes/hh_tms1k.h deleted file mode 100644 index edcea970b64..00000000000 --- a/src/mess/includes/hh_tms1k.h +++ /dev/null @@ -1,86 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Sean Riddle, Kevin Horton -/* - - TMS1000 MCU series tabletops/handhelds or other simple devices. - -*/ - -#ifndef _HH_TMS1K_H_ -#define _HH_TMS1K_H_ - - -#include "emu.h" -#include "cpu/tms0980/tms0980.h" -#include "sound/speaker.h" - - -class hh_tms1k_state : public driver_device -{ -public: - hh_tms1k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_inp_matrix(*this, "IN"), - m_speaker(*this, "speaker"), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) - { } - - // devices - required_device m_maincpu; - optional_ioport_array<11> m_inp_matrix; // max 11 - optional_device m_speaker; - - // misc common - UINT16 m_r; // MCU R-pins data - UINT16 m_o; // MCU O-pins data - UINT16 m_inp_mux; // multiplexed inputs mask - bool m_power_on; - bool m_power_led; - - UINT8 read_inputs(int columns); - DECLARE_INPUT_CHANGED_MEMBER(power_button); - DECLARE_WRITE_LINE_MEMBER(auto_power_off); - - // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) - - UINT32 m_grid; // VFD current row data - UINT32 m_plate; // VFD current column data - - UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - UINT32 m_display_cache[0x20]; // (internal use) - UINT8 m_display_decay[0x20][0x20]; // (internal use) - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask); - -protected: - virtual void machine_start(); - virtual void machine_reset(); -}; - - -// LED segments -enum -{ - lA = 0x01, - lB = 0x02, - lC = 0x04, - lD = 0x08, - lE = 0x10, - lF = 0x20, - lG = 0x40, - lDP = 0x80 -}; - - -#endif /* _HH_TMS1K_H_ */ diff --git a/src/mess/includes/hh_ucom4.h b/src/mess/includes/hh_ucom4.h deleted file mode 100644 index 79d51afccb9..00000000000 --- a/src/mess/includes/hh_ucom4.h +++ /dev/null @@ -1,66 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap, Kevin Horton -/* - - NEC uCOM4 MCU tabletops/handhelds or other simple devices, - -*/ - -#ifndef _HH_UCOM4_H_ -#define _HH_UCOM4_H_ - - -#include "emu.h" -#include "cpu/ucom4/ucom4.h" -#include "sound/speaker.h" - - -class hh_ucom4_state : public driver_device -{ -public: - hh_ucom4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_inp_matrix(*this, "IN"), - m_speaker(*this, "speaker"), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) - { } - - // devices - required_device m_maincpu; - optional_ioport_array<5> m_inp_matrix; // max 5 - optional_device m_speaker; - - // misc common - UINT8 m_port[9]; // MCU port A-I write data (optional) - UINT16 m_inp_mux; // multiplexed inputs mask - - UINT8 read_inputs(int columns); - - // display common - int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) - - UINT32 m_grid; // VFD current row data - UINT32 m_plate; // VFD current column data - - UINT32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - UINT16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - UINT32 m_display_cache[0x20]; // (internal use) - UINT8 m_display_decay[0x20][0x20]; // (internal use) - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - -protected: - virtual void machine_start(); - virtual void machine_reset(); -}; - - -#endif /* _HH_UCOM4_H_ */ diff --git a/src/mess/includes/hp48.h b/src/mess/includes/hp48.h deleted file mode 100644 index 70780f2817d..00000000000 --- a/src/mess/includes/hp48.h +++ /dev/null @@ -1,219 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2008 - - Hewlett Packard HP48 S/SX & G/GX and HP49 G - -**********************************************************************/ - -#include "sound/dac.h" -/* model */ -typedef enum { - HP48_S, - HP48_SX, - HP48_G, - HP48_GX, - HP48_GP, - HP49_G -} hp48_models; - -/* memory module configuration */ -typedef struct -{ - /* static part */ - UINT32 off_mask; /* offset bit-mask, indicates the real size */ - read8_delegate read; - const char *read_name; - write8_delegate write; - void* data; /* non-NULL for banks */ - int isnop; - - /* configurable part */ - UINT8 state; /* one of HP48_MODULE_ */ - UINT32 base; /* base address */ - UINT32 mask; /* often improperly called size, it is an address select mask */ - -} hp48_module; - - -/* screen image averaging */ -#define HP48_NB_SCREENS 3 - -class hp48_state : public driver_device -{ -public: - hp48_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac"), - m_palette(*this, "palette") { } - - UINT8 *m_videoram; - UINT8 m_io[64]; - hp48_models m_model; - - /* OUT register from SATURN (actually 12-bit) */ - UINT16 m_out; - - /* keyboard interrupt */ - UINT8 m_kdn; - - /* from highest to lowest priority: HDW, NCE2, CE1, CE2, NCE3, NCE1 */ - hp48_module m_modules[6]; - - /* RAM/ROM extensions, GX/SX only (each UINT8 stores one nibble) - port1: SX/GX: 32/128 KB - port2: SX:32/128KB, GX:128/512/4096 KB - */ - UINT32 m_port_size[2]; - UINT8 m_port_write[2]; - UINT8* m_port_data[2]; - - UINT32 m_bank_switch; - UINT32 m_io_addr; - UINT16 m_crc; - UINT8 m_timer1; - UINT32 m_timer2; - UINT8 m_screens[ HP48_NB_SCREENS ][ 64 ][ 144 ]; - int m_cur_screen; - UINT8* m_rom; - - DECLARE_DRIVER_INIT(hp48); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(hp48); - DECLARE_MACHINE_START(hp49g); - DECLARE_MACHINE_START(hp48gx); - DECLARE_MACHINE_START(hp48g); - DECLARE_MACHINE_START(hp48gp); - DECLARE_MACHINE_START(hp48sx); - DECLARE_MACHINE_START(hp48s); - UINT32 screen_update_hp48(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void hp48_machine_start(hp48_models model); - DECLARE_WRITE8_MEMBER(hp48_io_w); - DECLARE_READ8_MEMBER(hp48_io_r); - DECLARE_READ8_MEMBER(hp48_bank_r); - DECLARE_WRITE8_MEMBER(hp49_bank_w); - TIMER_CALLBACK_MEMBER(hp48_rs232_byte_recv_cb); - TIMER_CALLBACK_MEMBER(hp48_rs232_byte_sent_cb); - TIMER_CALLBACK_MEMBER(hp48_chardev_byte_recv_cb); - TIMER_CALLBACK_MEMBER(hp48_kbd_cb); - TIMER_CALLBACK_MEMBER(hp48_timer1_cb); - TIMER_CALLBACK_MEMBER(hp48_timer2_cb); - void hp48_update_annunciators(); - void hp48_apply_modules(); - required_device m_maincpu; - required_device m_dac; - required_device m_palette; - void hp48_pulse_irq( int irq_line); - void hp48_rs232_start_recv_byte( UINT8 data ); - void hp48_rs232_send_byte( ); - int hp48_get_in( ); - void hp48_update_kdn( ); - void hp48_reset_modules( ); - void hp48_decode_nibble( UINT8* dst, UINT8* src, int size ); - void hp48_encode_nibble( UINT8* dst, UINT8* src, int size ); - - /* memory controller */ - DECLARE_WRITE_LINE_MEMBER( hp48_mem_reset ); - DECLARE_WRITE32_MEMBER( hp48_mem_config ); - DECLARE_WRITE32_MEMBER( hp48_mem_unconfig ); - DECLARE_READ32_MEMBER( hp48_mem_id ); - - /* CRC computation */ - DECLARE_WRITE32_MEMBER( hp48_mem_crc ); - - /* IN/OUT registers */ - DECLARE_READ32_MEMBER( hp48_reg_in ); - DECLARE_WRITE32_MEMBER( hp48_reg_out ); - - /* keybord interrupt system */ - DECLARE_WRITE_LINE_MEMBER( hp48_rsi ); -}; - - -/*************************************************************************** - MACROS -***************************************************************************/ - -/* read from I/O memory */ -#define HP48_IO_4(x) (m_io[(x)]) -#define HP48_IO_8(x) (m_io[(x)] | (m_io[(x)+1] << 4)) -#define HP48_IO_12(x) (m_io[(x)] | (m_io[(x)+1] << 4) | (m_io[(x)+2] << 8)) -#define HP48_IO_20(x) (m_io[(x)] | (m_io[(x)+1] << 4) | (m_io[(x)+2] << 8) | \ - (m_io[(x)+3] << 12) | (m_io[(x)+4] << 16)) - - -/*----------- defined in machine/hp48.c -----------*/ - -/*************************************************************************** - GLOBAL VARIABLES & CONSTANTS -***************************************************************************/ - -/* I/O memory */ - - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -/* list of memory modules from highest to lowest priority */ -#define HP48_HDW 0 -#define HP48_NCE2 1 -#define HP48_CE1 2 -#define HP48_CE2 3 -#define HP48_NCE3 4 -#define HP48_NCE1 5 - -/****************************** cards ********************************/ - -class hp48_port_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - hp48_port_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - static void set_port_config(device_t &device, int port, int module, int max_size) - { - downcast(device).m_port = port; - downcast(device).m_module = module; - downcast(device).m_max_size = max_size; - } - - // image-level overrides - virtual iodevice_t image_type() const { return IO_MEMCARD; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "crd"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); - virtual bool call_create(int format_type, option_resolution *format_options); -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); -private: - void hp48_fill_port(); - void hp48_unfill_port(); - - int m_port; /* port index: 0 or 1 (for port 1 and 2) */ - int m_module; /* memory module where the port is visible */ - int m_max_size; /* maximum size, in bytes 128 KB or 4 GB */ -}; - -// device type definition -extern const device_type HP48_PORT; - -#define MCFG_HP48_PORT_ADD(_tag, _port, _module, _max_size) \ - MCFG_DEVICE_ADD(_tag, HP48_PORT, 0) \ - hp48_port_image_device::set_port_config(*device, _port, _module, _max_size); diff --git a/src/mess/includes/huebler.h b/src/mess/includes/huebler.h deleted file mode 100644 index eb49ae03f07..00000000000 --- a/src/mess/includes/huebler.h +++ /dev/null @@ -1,104 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __HUEBLER__ -#define __HUEBLER__ - -#define SCREEN_TAG "screen" -#define Z80_TAG "z80" -#define Z80CTC_TAG "z80ctc" -#define Z80SIO_TAG "z80sio" -#define Z80PIO1_TAG "z80pio1" -#define Z80PIO2_TAG "z80pio2" - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "machine/z80ctc.h" - -class amu880_state : public driver_device -{ -public: - amu880_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cassette(*this, "cassette"), - m_z80sio(*this, Z80SIO_TAG), - m_palette(*this, "palette"), - m_kb_rom(*this, "keyboard"), - m_char_rom(*this, "chargen"), - m_video_ram(*this, "video_ram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_y11(*this, "Y11"), - m_y12(*this, "Y12"), - m_y13(*this, "Y13"), - m_y14(*this, "Y14"), - m_y15(*this, "Y15"), - m_special(*this, "SPECIAL"), - m_key_d6(0), - m_key_d7(0), - m_key_a8(1) - { } - - required_device m_cassette; - required_device m_z80sio; - required_device m_palette; - required_memory_region m_kb_rom; - required_memory_region m_char_rom; - required_shared_ptr m_video_ram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_y11; - required_ioport m_y12; - required_ioport m_y13; - required_ioport m_y14; - required_ioport m_y15; - required_ioport m_special; - - virtual void machine_start(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( keyboard_r ); - TIMER_DEVICE_CALLBACK_MEMBER( tape_tick ); - - void scan_keyboard(); - - // keyboard state - ioport_port* m_key_row[16]; - int m_key_d6; - int m_key_d7; - int m_key_a4; - int m_key_a5; - int m_key_a8; - - // video state - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick); - DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); - DECLARE_READ_LINE_MEMBER(cassette_r); - DECLARE_WRITE_LINE_MEMBER(cassette_w); -}; - -#endif diff --git a/src/mess/includes/hx20.h b/src/mess/includes/hx20.h deleted file mode 100644 index 11fefd77b62..00000000000 --- a/src/mess/includes/hx20.h +++ /dev/null @@ -1,139 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __HX20__ -#define __HX20__ - -#include "bus/rs232/rs232.h" -#include "cpu/m6800/m6800.h" -#include "imagedev/cassette.h" -#include "bus/epson_sio/epson_sio.h" -#include "machine/mc146818.h" -#include "machine/ram.h" -#include "video/upd7227.h" -#include "sound/speaker.h" -#include "rendlay.h" - -#define HD6301V1_MAIN_TAG "8g" -#define HD6301V1_SLAVE_TAG "6d" -#define MC146818_TAG "6g" -#define UPD7227_0_TAG "lcdc0" -#define UPD7227_1_TAG "lcdc1" -#define UPD7227_2_TAG "lcdc2" -#define UPD7227_3_TAG "lcdc3" -#define UPD7227_4_TAG "lcdc4" -#define UPD7227_5_TAG "lcdc5" -#define SPEAKER_TAG "speaker" -#define CASSETTE_TAG "cassette" -#define RS232_TAG "rs232" -#define SCREEN_TAG "screen" - -class hx20_state : public driver_device -{ -public: - hx20_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, HD6301V1_MAIN_TAG), - m_subcpu(*this, HD6301V1_SLAVE_TAG), - m_rtc(*this, MC146818_TAG), - m_lcdc0(*this, UPD7227_0_TAG), - m_lcdc1(*this, UPD7227_1_TAG), - m_lcdc2(*this, UPD7227_2_TAG), - m_lcdc3(*this, UPD7227_3_TAG), - m_lcdc4(*this, UPD7227_4_TAG), - m_lcdc5(*this, UPD7227_5_TAG), - m_speaker(*this, SPEAKER_TAG), - m_cassette(*this, CASSETTE_TAG), - m_rs232(*this, RS232_TAG), - m_sio(*this, "sio"), - m_ksc0(*this, "KSC0"), - m_ksc1(*this, "KSC1"), - m_ksc2(*this, "KSC2"), - m_ksc3(*this, "KSC3"), - m_ksc4(*this, "KSC4"), - m_ksc5(*this, "KSC5"), - m_ksc6(*this, "KSC6"), - m_ksc7(*this, "KSC7"), - m_sw6(*this, "SW6"), - m_slave_rx(1), - m_slave_tx(1), - m_slave_flag(1), - m_rtc_irq(CLEAR_LINE), - m_kbrequest(1) - { } - - required_device m_maincpu; - required_device m_subcpu; - required_device m_rtc; - required_device m_lcdc0; - required_device m_lcdc1; - required_device m_lcdc2; - required_device m_lcdc3; - required_device m_lcdc4; - required_device m_lcdc5; - required_device m_speaker; - required_device m_cassette; - required_device m_rs232; - required_device m_sio; - required_ioport m_ksc0; - required_ioport m_ksc1; - required_ioport m_ksc2; - required_ioport m_ksc3; - required_ioport m_ksc4; - required_ioport m_ksc5; - required_ioport m_ksc6; - required_ioport m_ksc7; - required_ioport m_sw6; - - virtual void machine_start(); - DECLARE_PALETTE_INIT(hx20); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE8_MEMBER( ksc_w ); - DECLARE_READ8_MEMBER( krtn07_r ); - DECLARE_READ8_MEMBER( krtn89_r ); - DECLARE_WRITE8_MEMBER( lcd_cs_w ); - DECLARE_WRITE8_MEMBER( lcd_data_w ); - - DECLARE_READ8_MEMBER( main_p1_r ); - DECLARE_WRITE8_MEMBER( main_p1_w ); - DECLARE_READ8_MEMBER( main_p2_r ); - DECLARE_WRITE8_MEMBER( main_p2_w ); - - DECLARE_READ8_MEMBER( slave_p1_r ); - DECLARE_WRITE8_MEMBER( slave_p1_w ); - DECLARE_READ8_MEMBER( slave_p2_r ); - DECLARE_WRITE8_MEMBER( slave_p2_w ); - DECLARE_READ8_MEMBER( slave_p3_r ); - DECLARE_WRITE8_MEMBER( slave_p3_w ); - DECLARE_READ8_MEMBER( slave_p4_r ); - DECLARE_WRITE8_MEMBER( slave_p4_w ); - - DECLARE_WRITE_LINE_MEMBER( rtc_irq_w ); - - DECLARE_WRITE_LINE_MEMBER( sio_rx_w ) { m_sio_rx = state; } - DECLARE_WRITE_LINE_MEMBER( sio_pin_w ) { m_sio_pin = state; } - - void update_interrupt(); - - // CPU state - int m_slave_sio; - int m_slave_rx; - int m_slave_tx; - int m_slave_flag; - int m_rtc_irq; - - // keyboard state - UINT8 m_ksc; - int m_kbrequest; - - // video state - UINT8 m_lcd_data; - - // sio state - int m_sio_rx; - int m_sio_pin; -}; - -#endif diff --git a/src/mess/includes/imds2.h b/src/mess/includes/imds2.h deleted file mode 100644 index 298b808be82..00000000000 --- a/src/mess/includes/imds2.h +++ /dev/null @@ -1,145 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:F. Ulivi -// Driver for Intel Intellec MDS series-II - -#ifndef _IMDS2_H_ -#define _IMDS2_H_ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/i8257.h" -#include "video/i8275.h" -#include "sound/beep.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/i8271.h" -#include "imagedev/flopdrv.h" -#include "bus/centronics/ctronics.h" - -class imds2_state : public driver_device -{ - public: - imds2_state(const machine_config &mconfig, device_type type, const char *tag); - - DECLARE_READ8_MEMBER(ipc_mem_read); - DECLARE_WRITE8_MEMBER(ipc_mem_write); - DECLARE_WRITE8_MEMBER(imds2_ipc_control_w); - DECLARE_WRITE_LINE_MEMBER(imds2_ipc_intr); - DECLARE_READ8_MEMBER(imds2_ipcsyspic_r); - DECLARE_READ8_MEMBER(imds2_ipclocpic_r); - DECLARE_WRITE8_MEMBER(imds2_ipcsyspic_w); - DECLARE_WRITE8_MEMBER(imds2_ipclocpic_w); - - DECLARE_WRITE8_MEMBER(imds2_miscout_w); - DECLARE_READ8_MEMBER(imds2_miscin_r); - DECLARE_WRITE_LINE_MEMBER(imds2_beep_timer_w); - DECLARE_WRITE8_MEMBER(imds2_start_timer_w); - DECLARE_READ8_MEMBER(imds2_kb_read); - DECLARE_READ8_MEMBER(imds2_kb_port_p2_r); - DECLARE_WRITE8_MEMBER(imds2_kb_port_p1_w); - DECLARE_READ8_MEMBER(imds2_kb_port_t0_r); - DECLARE_READ8_MEMBER(imds2_kb_port_t1_r); - DECLARE_WRITE8_MEMBER(imds2_ioc_dbbout_w); - DECLARE_WRITE8_MEMBER(imds2_ioc_f0_w); - DECLARE_WRITE8_MEMBER(imds2_ioc_set_f1_w); - DECLARE_WRITE8_MEMBER(imds2_ioc_reset_f1_w); - DECLARE_READ8_MEMBER(imds2_ioc_status_r); - DECLARE_READ8_MEMBER(imds2_ioc_dbbin_r); - DECLARE_READ8_MEMBER(imds2_ipc_dbbout_r); - DECLARE_READ8_MEMBER(imds2_ipc_status_r); - DECLARE_WRITE8_MEMBER(imds2_ipc_dbbin_data_w); - DECLARE_WRITE8_MEMBER(imds2_ipc_dbbin_cmd_w); - DECLARE_WRITE_LINE_MEMBER(imds2_hrq_w); - - DECLARE_READ8_MEMBER(imds2_ioc_mem_r); - DECLARE_WRITE8_MEMBER(imds2_ioc_mem_w); - DECLARE_READ8_MEMBER(imds2_pio_port_p1_r); - DECLARE_WRITE8_MEMBER(imds2_pio_port_p1_w); - DECLARE_READ8_MEMBER(imds2_pio_port_p2_r); - DECLARE_WRITE8_MEMBER(imds2_pio_port_p2_w); - DECLARE_WRITE_LINE_MEMBER(imds2_pio_lpt_ack_w); - DECLARE_WRITE_LINE_MEMBER(imds2_pio_lpt_busy_w); - DECLARE_WRITE_LINE_MEMBER(imds2_pio_lpt_select_w); - - I8275_DRAW_CHARACTER_MEMBER(crtc_display_pixels); - - virtual void driver_start(); - virtual void machine_start(); - virtual void video_start(); - virtual void machine_reset(); - - private: - required_device m_ipccpu; - required_device m_ipcsyspic; - required_device m_ipclocpic; - required_device m_ioccpu; - required_device m_iocdma; - required_device m_ioccrtc; - required_device m_iocbeep; - required_device m_ioctimer; - required_device m_iocfdc; - required_device m_flop0; - required_device m_flop1; - required_device m_iocpio; - required_device m_kbcpu; - required_device m_palette; - required_device m_gfxdecode; - required_device m_centronics; - required_ioport m_io_key0; - required_ioport m_io_key1; - required_ioport m_io_key2; - required_ioport m_io_key3; - required_ioport m_io_key4; - required_ioport m_io_key5; - required_ioport m_io_key6; - required_ioport m_io_key7; - required_ioport m_ioc_options; - - std::vector m_ipc_ram; - - bool imds2_in_ipc_rom(offs_t offset) const; - - void imds2_update_beeper(void); - void imds2_update_printer(void); - int floppy_load(floppy_image_device *dev); - void floppy_unload(floppy_image_device *dev); - - // IPC control port - UINT8 m_ipc_control; - - // IPC ROM content - const UINT8 *m_ipc_rom; - - // Character generator - const UINT8 *m_chargen; - - // MISCOUT state - UINT8 m_miscout; - - // Beeper timer line - int m_beeper_timer; - - // Keyboard state - UINT8 m_kb_p1; - - // IPC to IOC buffer - UINT8 m_ioc_ibf; - - // IOC to IPC buffer - UINT8 m_ioc_obf; - - // IPC/IOC status - UINT8 m_ipc_ioc_status; - - // PIO port 1 - UINT8 m_pio_port1; - - // PIO port 2 - UINT8 m_pio_port2; - - // PIO device status byte - UINT8 m_device_status_byte; -}; - -#endif /* _IMDS2_H_ */ diff --git a/src/mess/includes/intv.h b/src/mess/includes/intv.h deleted file mode 100644 index 952844a2022..00000000000 --- a/src/mess/includes/intv.h +++ /dev/null @@ -1,155 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,Frank Palazzolo -/***************************************************************************** - * - * includes/intv.h - * - ****************************************************************************/ - -#ifndef INTV_H_ -#define INTV_H_ - -#include "sound/ay8910.h" -#include "video/stic.h" -#include "bus/intv/slot.h" -#include "bus/intv/voice.h" -#include "bus/intv/ecs.h" -//#include "bus/intv/keycomp.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class intv_state : public driver_device -{ -public: - enum - { - TIMER_INTV_INTERRUPT2_COMPLETE, - TIMER_INTV_INTERRUPT_COMPLETE, - TIMER_INTV_BTB_FILL - }; - - intv_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_sound(*this, "ay8914"), - m_stic(*this, "stic"), - m_cart(*this, "cartslot"), - m_intvkbd_dualport_ram(*this, "dualport_ram"), - m_videoram(*this, "videoram"), - m_keyboard(*this, "keyboard"), - m_iocart1(*this, "ioslot1"), - m_iocart2(*this, "ioslot2"), - m_region_maincpu(*this, "maincpu"), - m_region_keyboard(*this, "keyboard"), - m_io_options(*this, "OPTIONS"), - m_io_test(*this, "TEST"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_sound; - required_device m_stic; - optional_device m_cart; - optional_shared_ptr m_intvkbd_dualport_ram; - optional_shared_ptr m_videoram; - - DECLARE_READ16_MEMBER(intv_stic_r); - DECLARE_WRITE16_MEMBER(intv_stic_w); - DECLARE_READ16_MEMBER(intv_gram_r); - DECLARE_WRITE16_MEMBER(intv_gram_w); - DECLARE_READ16_MEMBER(intv_ram8_r); - DECLARE_WRITE16_MEMBER(intv_ram8_w); - DECLARE_READ16_MEMBER(intv_ram16_r); - DECLARE_WRITE16_MEMBER(intv_ram16_w); - DECLARE_READ8_MEMBER(intvkb_iocart_r); - - DECLARE_READ8_MEMBER(intv_right_control_r); - DECLARE_READ8_MEMBER(intv_left_control_r); - - UINT8 m_bus_copy_mode; - UINT8 m_backtab_row; - UINT16 m_ram16[0x160]; - int m_sr1_int_pending; - UINT8 m_ram8[256]; - - // Keyboard Component - DECLARE_READ8_MEMBER(intvkbd_tms9927_r); - DECLARE_WRITE8_MEMBER(intvkbd_tms9927_w); - DECLARE_WRITE16_MEMBER(intvkbd_dualport16_w); - DECLARE_READ8_MEMBER(intvkbd_dualport8_lsb_r); - DECLARE_WRITE8_MEMBER(intvkbd_dualport8_lsb_w); - DECLARE_READ8_MEMBER(intvkbd_dualport8_msb_r); - DECLARE_WRITE8_MEMBER(intvkbd_dualport8_msb_w); - - UINT8 m_tms9927_num_rows; - UINT8 m_tms9927_cursor_col; - UINT8 m_tms9927_cursor_row; - UINT8 m_tms9927_last_row; - - int m_intvkbd_text_blanked; - int m_intvkbd_keyboard_col; - int m_tape_int_pending; - int m_tape_interrupts_enabled; - int m_tape_unknown_write[6]; - int m_tape_motor_mode; - DECLARE_DRIVER_INIT(intvecs); - DECLARE_DRIVER_INIT(intvkbd); - DECLARE_DRIVER_INIT(intv); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(intv); - void ecs_banks_restore(); - UINT32 screen_update_intv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_intvkbd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(intv_interrupt2); - INTERRUPT_GEN_MEMBER(intv_interrupt); - TIMER_CALLBACK_MEMBER(intv_interrupt2_complete); - TIMER_CALLBACK_MEMBER(intv_interrupt_complete); - TIMER_CALLBACK_MEMBER(intv_btb_fill); - -protected: - int m_is_keybd; - - optional_device m_keyboard; - optional_device m_iocart1; - optional_device m_iocart2; - required_memory_region m_region_maincpu; - optional_memory_region m_region_keyboard; - required_ioport m_io_options; - optional_ioport m_io_test; - - optional_device m_gfxdecode; - required_device m_palette; - - ioport_port *m_keypad[4]; - ioport_port *m_disc[4]; - ioport_port *m_discx[4]; - ioport_port *m_discy[4]; - ioport_port *m_intv_keyboard[10]; - - int intv_load_rom_file(device_image_interface &image); - UINT8 intv_control_r(int hand); - void intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - UINT32 intv_get_pixel(bitmap_ind16 &bitmap, int x, int y); - void intv_plot_box(bitmap_ind16 &bm, int x, int y, int w, int h, int color); - int sprites_collide(int spriteNum1, int spriteNum2); - void determine_sprite_collisions(); - void render_sprites(); - void render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor); - void render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3); - void render_color_stack_mode(bitmap_ind16 &bitmap); - void render_fg_bg_mode(bitmap_ind16 &bitmap); - void copy_sprites_to_background(bitmap_ind16 &bitmap); - void render_background(bitmap_ind16 &bitmap); - void draw_borders(bitmap_ind16 &bm); - void intv_stic_screenrefresh(); - void draw_background(bitmap_ind16 &bitmap, int transparency); - void draw_sprites(bitmap_ind16 &bitmap, int behind_foreground); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* INTV_H_ */ diff --git a/src/mess/includes/jupiter.h b/src/mess/includes/jupiter.h deleted file mode 100644 index 03ffa92de5e..00000000000 --- a/src/mess/includes/jupiter.h +++ /dev/null @@ -1,59 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Robbbert -#pragma once - -#ifndef __JUPITER__ -#define __JUPITER__ - -#define MCM6571AP_TAG "vid125_6c" -#define S6820_TAG "vid125_4a" -#define Z80_TAG "cpu126_4c" -#define INS1771N1_TAG "fdi027_4c" -#define MC6820P_TAG "fdi027_4b" -#define MC6850P_TAG "rsi068_6a" -#define MC6821P_TAG "sdm058_4b" - -class jupiter2_state : public driver_device -{ -public: - jupiter2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MCM6571AP_TAG) - { } - - required_device m_maincpu; - - virtual void machine_start(); - DECLARE_DRIVER_INIT(jupiter); -}; - -class jupiter3_state : public driver_device -{ -public: - jupiter3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_p_videoram(*this, "p_videoram"), - m_p_ram(*this, "p_ram") - { } - - required_device m_maincpu; - - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(status_r); - DECLARE_READ8_MEMBER(key_r); - DECLARE_READ8_MEMBER(ff_r); - UINT8 m_term_data; - - required_shared_ptr m_p_videoram; - required_shared_ptr m_p_ram; - const UINT8 *m_p_chargen; - - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_DRIVER_INIT(jupiter3); -}; - -#endif diff --git a/src/mess/includes/kaypro.h b/src/mess/includes/kaypro.h deleted file mode 100644 index ef5d5ab008a..00000000000 --- a/src/mess/includes/kaypro.h +++ /dev/null @@ -1,113 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "machine/com8116.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/snapquik.h" -#include "sound/beep.h" -#include "video/mc6845.h" -#include "machine/wd_fdc.h" - -struct kay_kbd_t; - -class kaypro_state : public driver_device -{ -public: - enum - { - TIMER_FLOPPY - }; - - kaypro_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_pio_g(*this, "z80pio_g") - , m_pio_s(*this, "z80pio_s") - , m_sio(*this, "z80sio") - , m_sio2x(*this, "z80sio_2x") - , m_centronics(*this, "centronics") - , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - , m_crtc(*this, "crtc") - , m_beep(*this, "beeper") - {} - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_READ8_MEMBER(kaypro2x_87_r); - DECLARE_READ8_MEMBER(kaypro2x_system_port_r); - DECLARE_READ8_MEMBER(kaypro2x_status_r); - DECLARE_READ8_MEMBER(kaypro2x_videoram_r); - DECLARE_WRITE8_MEMBER(kaypro2x_system_port_w); - DECLARE_WRITE8_MEMBER(kaypro2x_index_w); - DECLARE_WRITE8_MEMBER(kaypro2x_register_w); - DECLARE_WRITE8_MEMBER(kaypro2x_videoram_w); - DECLARE_READ8_MEMBER(pio_system_r); - DECLARE_WRITE8_MEMBER(common_pio_system_w); - DECLARE_WRITE8_MEMBER(kayproii_pio_system_w); - DECLARE_WRITE8_MEMBER(kaypro4_pio_system_w); - DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - DECLARE_READ8_MEMBER(kaypro_videoram_r); - DECLARE_WRITE8_MEMBER(kaypro_videoram_w); - DECLARE_MACHINE_START(kayproii); - DECLARE_MACHINE_RESET(kaypro); - DECLARE_VIDEO_START(kaypro); - DECLARE_PALETTE_INIT(kaypro); - DECLARE_MACHINE_RESET(kay_kbd); - DECLARE_DRIVER_INIT(kaypro); - DECLARE_FLOPPY_FORMATS(kayproii_floppy_formats); - DECLARE_FLOPPY_FORMATS(kaypro2x_floppy_formats); - UINT32 screen_update_kayproii(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_kaypro2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(kay_kbd_interrupt); - DECLARE_READ8_MEMBER(kaypro_sio_r); - DECLARE_WRITE8_MEMBER(kaypro_sio_w); - MC6845_UPDATE_ROW(kaypro2x_update_row); - DECLARE_QUICKLOAD_LOAD_MEMBER(kaypro); - const UINT8 *m_p_chargen; - UINT8 m_mc6845_cursor[16]; - UINT8 m_mc6845_reg[32]; - UINT8 m_mc6845_ind; - UINT8 m_framecnt; - UINT8 *m_p_videoram; - kay_kbd_t *m_kbd; - int m_centronics_busy; - required_device m_palette; - -private: - bool m_is_motor_off; - UINT8 m_fdc_rq; - UINT8 m_system_port; - UINT16 m_mc6845_video_address; - floppy_image_device *m_floppy; - void mc6845_cursor_configure(); - void mc6845_screen_configure(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - required_device m_maincpu; - optional_device m_pio_g; - optional_device m_pio_s; - required_device m_sio; - optional_device m_sio2x; - required_device m_centronics; - required_device m_fdc; - required_device m_floppy0; - optional_device m_floppy1; - optional_device m_crtc; - required_device m_beep; -}; - - -/*----------- defined in machine/kay_kbd.c -----------*/ - -UINT8 kay_kbd_c_r( running_machine &machine ); -UINT8 kay_kbd_d_r( running_machine &machine ); -void kay_kbd_d_w( running_machine &machine, UINT8 data ); - -INPUT_PORTS_EXTERN( kay_kbd ); diff --git a/src/mess/includes/kc.h b/src/mess/includes/kc.h deleted file mode 100644 index 46f1cd93d1e..00000000000 --- a/src/mess/includes/kc.h +++ /dev/null @@ -1,189 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/***************************************************************************** - * - * includes/kc.h - * - ****************************************************************************/ - -#ifndef KC_H_ -#define KC_H_ - -/* Devices */ -#include "imagedev/cassette.h" -#include "machine/ram.h" - -// Components -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "machine/ram.h" -#include "machine/kc_keyb.h" -#include "machine/rescap.h" -#include "cpu/z80/z80daisy.h" -#include "sound/speaker.h" -#include "sound/wave.h" - -// Devices -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" - -// Formats -#include "formats/kc_cas.h" - -// Expansions -#include "bus/kc/kc.h" -#include "bus/kc/ram.h" -#include "bus/kc/rom.h" -#include "bus/kc/d002.h" -#include "bus/kc/d004.h" - -// from service manual -#define KC85_3_CLOCK 1751938 -#define KC85_4_CLOCK 1773447 - -#define KC85_4_SCREEN_PIXEL_RAM_SIZE 0x04000 -#define KC85_4_SCREEN_COLOUR_RAM_SIZE 0x04000 - -#define KC85_PALETTE_SIZE 24 -#define KC85_SCREEN_WIDTH 320 -#define KC85_SCREEN_HEIGHT 256 - -// cassette input polling frequency -#define KC_CASSETTE_TIMER_FREQUENCY attotime::from_hz(44100) - - -class kc_state : public driver_device -{ -public: - kc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_z80pio(*this, "z80pio"), - m_z80ctc(*this, "z80ctc"), - m_ram(*this, RAM_TAG), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette") - { } - - required_device m_maincpu; - required_device m_z80pio; - required_device m_z80ctc; - required_device m_ram; - required_device m_speaker; - required_device m_cassette; - - // defined in machine/kc.c - virtual void machine_start(); - virtual void machine_reset(); - - // modules read/write - DECLARE_READ8_MEMBER ( expansion_read ); - DECLARE_WRITE8_MEMBER( expansion_write ); - DECLARE_READ8_MEMBER ( expansion_4000_r ); - DECLARE_WRITE8_MEMBER( expansion_4000_w ); - DECLARE_READ8_MEMBER ( expansion_8000_r ); - DECLARE_WRITE8_MEMBER( expansion_8000_w ); - DECLARE_READ8_MEMBER ( expansion_c000_r ); - DECLARE_WRITE8_MEMBER( expansion_c000_w ); - DECLARE_READ8_MEMBER ( expansion_e000_r ); - DECLARE_WRITE8_MEMBER( expansion_e000_w ); - DECLARE_READ8_MEMBER ( expansion_io_read ); - DECLARE_WRITE8_MEMBER( expansion_io_write ); - - // bankswitch - virtual void update_0x00000(); - virtual void update_0x04000(); - virtual void update_0x08000(); - virtual void update_0x0c000(); - virtual void update_0x0e000(); - - // PIO callback - DECLARE_READ8_MEMBER( pio_porta_r ); - DECLARE_READ8_MEMBER( pio_portb_r ); - DECLARE_WRITE_LINE_MEMBER( pio_ardy_cb); - DECLARE_WRITE_LINE_MEMBER( pio_brdy_cb); - DECLARE_WRITE8_MEMBER( pio_porta_w ); - DECLARE_WRITE8_MEMBER( pio_portb_w ); - - // CTC callback - DECLARE_WRITE_LINE_MEMBER( ctc_zc0_callback ); - DECLARE_WRITE_LINE_MEMBER( ctc_zc1_callback ); - DECLARE_WRITE_LINE_MEMBER( ctc_zc2_callback ); - - // keyboard - DECLARE_WRITE_LINE_MEMBER( keyboard_cb ); - - // cassette - void update_cassette(int state); - void cassette_set_motor(int motor_state); - - // speaker - void speaker_update(); - - // defined in video/kc.c - virtual void video_start(); - virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER( video_toggle_blink_state ); - void video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, UINT8 colour_byte, UINT8 gfx_byte); - - // driver state - UINT8 * m_ram_base; - UINT8 * m_video_ram; - int m_pio_data[2]; - int m_high_resolution; - UINT8 m_ardy; - UINT8 m_brdy; - int m_kc85_blink_state; - int m_k0_line; - int m_k1_line; - UINT8 m_speaker_level; - - // cassette - emu_timer * m_cassette_timer; - emu_timer * m_cassette_oneshot_timer; - int m_astb; - int m_cassette_in; - - kcexp_slot_device * m_expansions[3]; - DECLARE_PALETTE_INIT(kc85); - TIMER_CALLBACK_MEMBER(kc_cassette_oneshot_timer); - TIMER_CALLBACK_MEMBER(kc_cassette_timer_callback); - TIMER_DEVICE_CALLBACK_MEMBER(kc_scanline); - - DECLARE_QUICKLOAD_LOAD_MEMBER( kc ); -}; - - -class kc85_4_state : public kc_state -{ -public: - kc85_4_state(const machine_config &mconfig, device_type type, const char *tag) - : kc_state(mconfig, type, tag) - { } - - // defined in machine/kc.c - virtual void machine_reset(); - - virtual void update_0x04000(); - virtual void update_0x08000(); - virtual void update_0x0c000(); - - DECLARE_READ8_MEMBER( kc85_4_86_r ); - DECLARE_READ8_MEMBER( kc85_4_84_r ); - DECLARE_WRITE8_MEMBER( kc85_4_86_w ); - DECLARE_WRITE8_MEMBER( kc85_4_84_w ); - - // defined in video/kc.c - virtual void video_start(); - virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void video_control_w(int data); - - // driver state - UINT8 m_port_84_data; - UINT8 m_port_86_data; - UINT8 * m_display_video_ram; -}; - -#endif /* KC_H_ */ diff --git a/src/mess/includes/kramermc.h b/src/mess/includes/kramermc.h deleted file mode 100644 index 87222f7e578..00000000000 --- a/src/mess/includes/kramermc.h +++ /dev/null @@ -1,41 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/kramermc.h - * - ****************************************************************************/ - -#ifndef KRAMERMC_H_ -#define KRAMERMC_H_ - -#include "machine/z80pio.h" - -class kramermc_state : public driver_device -{ -public: - kramermc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - UINT8 m_key_row; - DECLARE_DRIVER_INIT(kramermc); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_kramermc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER(kramermc_port_a_r); - DECLARE_READ8_MEMBER(kramermc_port_b_r); - DECLARE_WRITE8_MEMBER(kramermc_port_a_w); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; -}; - -/*----------- defined in video/kramermc.c -----------*/ - -extern const gfx_layout kramermc_charlayout; - - -#endif /* KRAMERMC_h_ */ diff --git a/src/mess/includes/kyocera.h b/src/mess/includes/kyocera.h deleted file mode 100644 index ef5e5737dea..00000000000 --- a/src/mess/includes/kyocera.h +++ /dev/null @@ -1,291 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __KYOCERA__ -#define __KYOCERA__ - - -#include "bus/rs232/rs232.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8155.h" -#include "machine/i8251.h" -#include "machine/im6402.h" -#include "machine/ram.h" -#include "machine/rp5c01.h" -#include "machine/upd1990a.h" -#include "video/hd44102.h" -#include "video/hd61830.h" -#include "sound/speaker.h" -#include "rendlay.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define SCREEN_TAG "screen" -#define I8085_TAG "m19" -#define I8155_TAG "m25" -#define UPD1990A_TAG "m18" -#define IM6402_TAG "m22" -#define MC14412_TAG "m31" -#define HD44102_0_TAG "m1" -#define HD44102_1_TAG "m2" -#define HD44102_2_TAG "m3" -#define HD44102_3_TAG "m4" -#define HD44102_4_TAG "m5" -#define HD44102_5_TAG "m6" -#define HD44102_6_TAG "m7" -#define HD44102_7_TAG "m8" -#define HD44102_8_TAG "m9" -#define HD44102_9_TAG "m10" -#define CENTRONICS_TAG "centronics" -#define RS232_TAG "rs232" - -//#define I8085_TAG "m19" -//#define I8155_TAG "m12" -//#define MC14412_TAG "m8" -#define RP5C01A_TAG "m301" -#define TCM5089_TAG "m11" -#define I8251_TAG "m20" -#define HD61830_TAG "m18" - -class kc85_state : public driver_device -{ -public: - kc85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8085_TAG), - m_rtc(*this, UPD1990A_TAG), - m_uart(*this, IM6402_TAG), - m_lcdc0(*this, HD44102_0_TAG), - m_lcdc1(*this, HD44102_1_TAG), - m_lcdc2(*this, HD44102_2_TAG), - m_lcdc3(*this, HD44102_3_TAG), - m_lcdc4(*this, HD44102_4_TAG), - m_lcdc5(*this, HD44102_5_TAG), - m_lcdc6(*this, HD44102_6_TAG), - m_lcdc7(*this, HD44102_7_TAG), - m_lcdc8(*this, HD44102_8_TAG), - m_lcdc9(*this, HD44102_9_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_opt_cart(*this, "opt_cartslot"), - m_ram(*this, RAM_TAG), - m_rs232(*this, RS232_TAG), - m_rom(*this, I8085_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_battery(*this, "BATTERY") - { } - - required_device m_maincpu; - required_device m_rtc; - optional_device m_uart; - required_device m_lcdc0; - required_device m_lcdc1; - required_device m_lcdc2; - required_device m_lcdc3; - required_device m_lcdc4; - required_device m_lcdc5; - required_device m_lcdc6; - required_device m_lcdc7; - required_device m_lcdc8; - required_device m_lcdc9; - required_device m_centronics; - required_device m_speaker; - required_device m_cassette; - required_device m_opt_cart; - required_device m_ram; - required_device m_rs232; - required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_battery; - - virtual void machine_start(); - memory_region *m_opt_region; - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( uart_status_r ); - DECLARE_WRITE8_MEMBER( uart_ctrl_w ); - DECLARE_WRITE8_MEMBER( modem_w ); - DECLARE_WRITE8_MEMBER( ctrl_w ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_READ8_MEMBER( lcd_r ); - DECLARE_WRITE8_MEMBER( lcd_w ); - DECLARE_WRITE8_MEMBER( i8155_pa_w ); - DECLARE_WRITE8_MEMBER( i8155_pb_w ); - DECLARE_READ8_MEMBER( i8155_pc_r ); - DECLARE_WRITE_LINE_MEMBER( i8155_to_w ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); - - /* memory state */ - UINT8 m_bank; /* memory bank selection */ - - /* keyboard state */ - UINT16 m_keylatch; /* keyboard latch */ - - /* sound state */ - int m_buzzer; /* buzzer select */ - int m_bell; /* bell output */ - - int m_centronics_busy; - int m_centronics_select; - - DECLARE_PALETTE_INIT(kc85); - DECLARE_WRITE_LINE_MEMBER(kc85_sod_w); - DECLARE_READ_LINE_MEMBER(kc85_sid_r); -}; - -class trsm100_state : public kc85_state -{ -public: - trsm100_state(const machine_config &mconfig, device_type type, const char *tag) - : kc85_state(mconfig, type, tag) { } - - virtual void machine_start(); -}; - -class pc8201_state : public kc85_state -{ -public: - pc8201_state(const machine_config &mconfig, device_type type, const char *tag) - : kc85_state(mconfig, type, tag), - m_cas_cart(*this, "cas_cartslot") - { } - - virtual void machine_start(); - required_device m_cas_cart; - - DECLARE_READ8_MEMBER( bank_r ); - DECLARE_WRITE8_MEMBER( bank_w ); - DECLARE_WRITE8_MEMBER( scp_w ); - DECLARE_READ8_MEMBER( uart_status_r ); - DECLARE_WRITE8_MEMBER( romah_w ); - DECLARE_WRITE8_MEMBER( romal_w ); - DECLARE_WRITE8_MEMBER( romam_w ); - DECLARE_READ8_MEMBER( romrd_r ); - - void bankswitch(UINT8 data); - - // ROM cassette - int m_rom_sel; - UINT32 m_rom_addr; - - /* peripheral state */ - int m_iosel; /* serial interface select */ -}; - -class tandy200_state : public driver_device -{ -public: - tandy200_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8085_TAG), - m_rtc(*this, RP5C01A_TAG), - m_lcdc(*this, HD61830_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_cent_data_out(*this, "cent_data_out"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_opt_cart(*this, "opt_cartslot"), - m_ram(*this, RAM_TAG), - m_rs232(*this, RS232_TAG), - m_rom(*this, I8085_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8") - { } - - required_device m_maincpu; - required_device m_rtc; - required_device m_lcdc; - required_device m_centronics; - required_device m_cent_data_out; - required_device m_speaker; - required_device m_cassette; - required_device m_opt_cart; - required_device m_ram; - required_device m_rs232; - required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - - virtual void machine_start(); - memory_region *m_opt_region; - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( bank_r ); - DECLARE_WRITE8_MEMBER( bank_w ); - DECLARE_READ8_MEMBER( stbk_r ); - DECLARE_WRITE8_MEMBER( stbk_w ); - DECLARE_WRITE8_MEMBER( i8155_pa_w ); - DECLARE_WRITE8_MEMBER( i8155_pb_w ); - DECLARE_READ8_MEMBER( i8155_pc_r ); - DECLARE_WRITE_LINE_MEMBER( i8155_to_w ); - DECLARE_WRITE_LINE_MEMBER(kc85_sod_w); - DECLARE_READ_LINE_MEMBER(kc85_sid_r); - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_select ); - - DECLARE_PALETTE_INIT(tandy200); - - TIMER_DEVICE_CALLBACK_MEMBER(tandy200_tp_tick); - - void bankswitch(UINT8 data); - - /* memory state */ - UINT8 m_bank; /* memory bank selection */ - - /* keyboard state */ - UINT16 m_keylatch; /* keyboard latch */ - int m_tp; /* timing pulse */ - - /* sound state */ - int m_buzzer; /* buzzer select */ - int m_bell; /* bell output */ - - int m_centronics_busy; - int m_centronics_select; -}; - -/* ---------- defined in video/kyocera.c ---------- */ - -MACHINE_CONFIG_EXTERN( kc85_video ); -MACHINE_CONFIG_EXTERN( tandy200_video ); - -#endif diff --git a/src/mess/includes/lc80.h b/src/mess/includes/lc80.h deleted file mode 100644 index bf54ed9ed95..00000000000 --- a/src/mess/includes/lc80.h +++ /dev/null @@ -1,68 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __LC80__ -#define __LC80__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "machine/z80pio.h" -#include "machine/z80ctc.h" -#include "sound/speaker.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "d201" -#define Z80CTC_TAG "d208" -#define Z80PIO1_TAG "d206" -#define Z80PIO2_TAG "d207" -//#define SPEAKER_TAG "b237" - -class lc80_state : public driver_device -{ -public: - lc80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_pio2(*this, Z80PIO2_TAG), - m_cassette(*this, "cassette"), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3") - { } - - required_device m_maincpu; - required_device m_pio2; - required_device m_cassette; - required_device m_speaker; - required_device m_ram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - - virtual void machine_start(); - - DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); - DECLARE_WRITE8_MEMBER( pio1_pa_w ); - DECLARE_READ8_MEMBER( pio1_pb_r ); - DECLARE_WRITE8_MEMBER( pio1_pb_w ); - DECLARE_READ8_MEMBER( pio2_pb_r ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); - - void update_display(); - - // display state - UINT8 m_digit; - UINT8 m_segment; -}; - -#endif diff --git a/src/mess/includes/lisa.h b/src/mess/includes/lisa.h deleted file mode 100644 index c52c53fb833..00000000000 --- a/src/mess/includes/lisa.h +++ /dev/null @@ -1,237 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/***************************************************************************** - * - * includes/lisa.h - * - * Lisa driver declarations - * - ****************************************************************************/ - -#ifndef LISA_H_ -#define LISA_H_ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/6522via.h" -#include "machine/8530scc.h" -#include "machine/6522via.h" -#include "machine/nvram.h" -#include "machine/applefdc.h" -#include "machine/sonydriv.h" -#include "sound/speaker.h" - -#define COP421_TAG "u9f" -#define KB_COP421_TAG "kbcop" - -/* lisa MMU segment regs */ -struct real_mmu_entry -{ - UINT16 sorg; - UINT16 slim; -}; - -/* MMU regs translated into a more efficient format */ -enum mmu_entry_t { RAM_stack_r, RAM_r, RAM_stack_rw, RAM_rw, IO, invalid, special_IO }; - -struct mmu_entry -{ - offs_t sorg; /* (real_sorg & 0x0fff) << 9 */ - mmu_entry_t type; /* <-> (real_slim & 0x0f00) */ - int slim; /* (~ ((real_slim & 0x00ff) << 9)) & 0x01ffff */ -}; - -enum floppy_hardware_t -{ - twiggy, /* twiggy drives (Lisa 1) */ - sony_lisa2, /* 3.5'' drive with LisaLite adapter (Lisa 2) */ - sony_lisa210 /* 3.5'' drive with modified fdc hardware (Lisa 2/10, Mac XL) */ -}; - -enum clock_mode_t -{ - clock_timer_disable = 0, - timer_disable = 1, - timer_interrupt = 2, /* timer underflow generates interrupt */ - timer_power_on = 3 /* timer underflow turns system on if it is off and gens interrupt */ -}; /* clock mode */ - -/* clock registers */ -struct clock_regs_t -{ - long alarm; /* alarm (20-bit binary) */ - int years; /* years (4-bit binary ) */ - int days1; /* days (BCD : 1-366) */ - int days2; - int days3; - int hours1; /* hours (BCD : 0-23) */ - int hours2; - int minutes1; /* minutes (BCD : 0-59) */ - int minutes2; - int seconds1; /* seconds (BCD : 0-59) */ - int seconds2; - int tenths; /* tenths of second (BCD : 0-9) */ - - int clock_write_ptr; /* clock byte to be written next (-1 if clock write disabled) */ - - enum clock_mode_t clock_mode; -}; - -struct lisa_features_t -{ - unsigned int has_fast_timers : 1; /* I/O board VIAs are clocked at 1.25 MHz (?) instead of .5 MHz (?) (Lisa 2/10, Mac XL) */ - /* Note that the beep routine in boot ROMs implies that - VIA clock is 1.25 times faster with fast timers than with - slow timers. I read the schematics again and again, and - I simply don't understand : in one case the VIA is - connected to the 68k E clock, which is CPUCK/10, and in - another case, to a generated PH2 clock which is CPUCK/4, - with additionnal logic to keep it in phase with the 68k - memory cycle. After hearing the beep when MacWorks XL - boots, I bet the correct values are .625 MHz and .5 MHz. - Maybe the schematics are wrong, and PH2 is CPUCK/8. - Maybe the board uses a 6522 variant with different - timings. */ - floppy_hardware_t floppy_hardware; - unsigned int has_double_sided_floppy : 1; /* true on lisa 1 and *hacked* lisa 2/10 / Mac XL */ - unsigned int has_mac_xl_video : 1; /* modified video for MacXL */ -}; - - -class lisa_state : public driver_device -{ -public: - lisa_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_via0(*this, "via6522_0"), - m_via1(*this, "via6522_1"), - m_fdc(*this, "fdc"), - m_scc(*this, "scc"), - m_speaker(*this, "speaker"), - m_nvram(*this, "nvram"), - m_fdc_rom(*this,"fdc_rom"), - m_fdc_ram(*this,"fdc_ram"), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_line4(*this, "LINE4"), - m_io_line5(*this, "LINE5"), - m_io_line6(*this, "LINE6"), - m_io_line7(*this, "LINE7"), - m_io_mouse_x(*this, "MOUSE_X"), - m_io_mouse_y(*this, "MOUSE_Y"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_via0; - required_device m_via1; - optional_device m_fdc; - required_device m_scc; - required_device m_speaker; - required_device m_nvram; - - required_shared_ptr m_fdc_rom; - required_shared_ptr m_fdc_ram; - - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - required_ioport m_io_line3; - required_ioport m_io_line4; - required_ioport m_io_line5; - required_ioport m_io_line6; - required_ioport m_io_line7; - required_ioport m_io_mouse_x; - required_ioport m_io_mouse_y; - - required_device m_palette; - - UINT8 *m_ram_ptr; - UINT8 *m_rom_ptr; - UINT8 *m_videoROM_ptr; - int m_setup; - int m_seg; - real_mmu_entry m_real_mmu_regs[4][128]; - mmu_entry m_mmu_regs[4][128]; - int m_diag2; - int m_test_parity; - UINT16 m_mem_err_addr_latch; - int m_parity_error_pending; - int m_bad_parity_count; - UINT8 *m_bad_parity_table; - int m_VTMSK; - int m_VTIR; - UINT16 m_video_address_latch; - UINT16 *m_videoram_ptr; - int m_KBIR; - int m_FDIR; - int m_DISK_DIAG; - int m_MT1; - int m_PWM_floppy_motor_speed; - int m_model; - lisa_features_t m_features; - int m_COPS_Ready; - int m_COPS_command; - int m_fifo_data[8]; - int m_fifo_size; - int m_fifo_head; - int m_fifo_tail; - int m_mouse_data_offset; - int m_COPS_force_unplug; - emu_timer *m_mouse_timer; - int m_hold_COPS_data; - int m_NMIcode; - clock_regs_t m_clock_regs; - int m_key_matrix[8]; - int m_last_mx; - int m_last_my; - int m_frame_count; - int m_videoROM_address; - DECLARE_READ8_MEMBER(lisa_fdc_io_r); - DECLARE_WRITE8_MEMBER(lisa_fdc_io_w); - DECLARE_READ8_MEMBER(lisa_fdc_r); - DECLARE_READ8_MEMBER(lisa210_fdc_r); - DECLARE_WRITE8_MEMBER(lisa_fdc_w); - DECLARE_WRITE8_MEMBER(lisa210_fdc_w); - DECLARE_READ16_MEMBER(lisa_r); - DECLARE_WRITE16_MEMBER(lisa_w); - DECLARE_READ16_MEMBER(lisa_IO_r); - DECLARE_WRITE16_MEMBER(lisa_IO_w); - - DECLARE_DRIVER_INIT(lisa210); - DECLARE_DRIVER_INIT(mac_xl); - DECLARE_DRIVER_INIT(lisa2); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - void nvram_init(nvram_device &nvram, void *data, size_t size); - UINT32 screen_update_lisa(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(lisa_interrupt); - TIMER_CALLBACK_MEMBER(handle_mouse); - TIMER_CALLBACK_MEMBER(read_COPS_command); - TIMER_CALLBACK_MEMBER(set_COPS_ready); - DECLARE_WRITE8_MEMBER(COPS_via_out_a); - DECLARE_WRITE_LINE_MEMBER(COPS_via_out_ca2); - DECLARE_WRITE8_MEMBER(COPS_via_out_b); - DECLARE_WRITE_LINE_MEMBER(COPS_via_out_cb2); - - void field_interrupts(); - void set_parity_error_pending(int value); - void set_VTIR(int value); - void cpu_board_control_access(offs_t offset); - void init_COPS(); - void reset_COPS(); - void lisa_fdc_ttl_glue_access(offs_t offset); - void COPS_send_data_if_possible(); - void COPS_queue_data(const UINT8 *data, int len); - void COPS_via_irq_func(int val); - void scan_keyboard(); - void unplug_keyboard(); - void plug_keyboard(); - void init_lisa1(void); -}; - -#endif /* LISA_H_ */ diff --git a/src/mess/includes/llc.h b/src/mess/includes/llc.h deleted file mode 100644 index c98a7484146..00000000000 --- a/src/mess/includes/llc.h +++ /dev/null @@ -1,64 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/***************************************************************************** - * - * includes/llc.h - * - ****************************************************************************/ - -#ifndef LLC_H_ -#define LLC_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80pio.h" -#include "machine/z80ctc.h" -#include "machine/ram.h" -#include "machine/k7659kb.h" -#include "sound/speaker.h" - -class llc_state : public driver_device -{ -public: - llc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_speaker(*this, "speaker"), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG) { } - - DECLARE_WRITE8_MEMBER(llc2_rom_disable_w); - DECLARE_WRITE8_MEMBER(llc2_basic_enable_w); - DECLARE_WRITE8_MEMBER(kbd_put); - DECLARE_READ8_MEMBER(llc1_port1_a_r); - DECLARE_READ8_MEMBER(llc1_port2_a_r); - DECLARE_READ8_MEMBER(llc1_port2_b_r); - DECLARE_WRITE8_MEMBER(llc1_port1_a_w); - DECLARE_WRITE8_MEMBER(llc1_port1_b_w); - DECLARE_READ8_MEMBER(llc2_port1_b_r); - DECLARE_READ8_MEMBER(llc2_port2_a_r); - DECLARE_WRITE8_MEMBER(llc2_port1_b_w); - const UINT8 *m_p_chargen; - optional_device m_speaker; - optional_shared_ptr m_p_videoram; - bool m_rv; - UINT8 m_term_status; - UINT8 m_llc1_key; -private: - UINT8 m_porta; - UINT8 m_term_data; -public: - DECLARE_DRIVER_INIT(llc2); - DECLARE_DRIVER_INIT(llc1); - virtual void video_start(); - DECLARE_MACHINE_START(llc1); - DECLARE_MACHINE_RESET(llc1); - DECLARE_MACHINE_RESET(llc2); - UINT32 screen_update_llc1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_llc2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - optional_device m_ram; -}; - -#endif diff --git a/src/mess/includes/lviv.h b/src/mess/includes/lviv.h deleted file mode 100644 index 363948263e2..00000000000 --- a/src/mess/includes/lviv.h +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/***************************************************************************** - * - * includes/lviv.h - * - ****************************************************************************/ - -#ifndef LVIV_H_ -#define LVIV_H_ - -#include "imagedev/snapquik.h" -#include "machine/i8255.h" -#include "sound/speaker.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - -class lviv_state : public driver_device -{ -public: - lviv_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") { } - - unsigned char * m_video_ram; - unsigned short m_colortable[1][4]; - UINT8 m_ppi_port_outputs[2][3]; - UINT8 m_startup_mem_map; - DECLARE_READ8_MEMBER(lviv_io_r); - DECLARE_WRITE8_MEMBER(lviv_io_w); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(lviv); - UINT32 screen_update_lviv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER(lviv_ppi_0_porta_r); - DECLARE_READ8_MEMBER(lviv_ppi_0_portb_r); - DECLARE_READ8_MEMBER(lviv_ppi_0_portc_r); - DECLARE_WRITE8_MEMBER(lviv_ppi_0_porta_w); - DECLARE_WRITE8_MEMBER(lviv_ppi_0_portb_w); - DECLARE_WRITE8_MEMBER(lviv_ppi_0_portc_w); - DECLARE_READ8_MEMBER(lviv_ppi_1_porta_r); - DECLARE_READ8_MEMBER(lviv_ppi_1_portb_r); - DECLARE_READ8_MEMBER(lviv_ppi_1_portc_r); - DECLARE_WRITE8_MEMBER(lviv_ppi_1_porta_w); - DECLARE_WRITE8_MEMBER(lviv_ppi_1_portb_w); - DECLARE_WRITE8_MEMBER(lviv_ppi_1_portc_w); - required_device m_maincpu; - required_device m_speaker; - required_device m_cassette; - required_device m_ram; - required_device m_palette; - void lviv_update_palette(UINT8 pal); - void lviv_update_memory (); - void lviv_setup_snapshot (UINT8 * data); - void dump_registers(); - int lviv_verify_snapshot (UINT8 * data, UINT32 size); - DECLARE_SNAPSHOT_LOAD_MEMBER( lviv ); - DECLARE_INPUT_CHANGED_MEMBER(lviv_reset); -}; - -/*----------- defined in video/lviv.c -----------*/ - -extern const unsigned char lviv_palette[8*3]; - - -#endif /* LVIV_H_ */ diff --git a/src/mess/includes/lynx.h b/src/mess/includes/lynx.h deleted file mode 100644 index 9d45fa13467..00000000000 --- a/src/mess/includes/lynx.h +++ /dev/null @@ -1,295 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/lynx.h - * - ****************************************************************************/ - -#ifndef LYNX_H_ -#define LYNX_H_ - -#include "audio/lynx.h" -#include "imagedev/snapquik.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define LYNX_CART 0 -#define LYNX_QUICKLOAD 1 - - -struct BLITTER -{ - // global - UINT16 screen; - UINT16 colbuf; - UINT16 colpos; // byte where value of collision is written - INT16 xoff, yoff; - // in command - int mode; - UINT8 spr_coll; - UINT8 spritenr; - INT16 x_pos,y_pos; - UINT16 width, height; // uint16 important for blue lightning - INT16 tilt_accumulator; - UINT16 height_accumulator, width_accumulator; - UINT16 width_offset, height_offset; - INT16 stretch, tilt; - UINT8 color[16]; // or stored - UINT16 bitmap; - int use_rle; - int line_color; - - UINT8 spr_ctl0; - UINT8 spr_ctl1; - UINT16 scb; - UINT16 scb_next; - UINT8 sprite_collide; - - int everon; - UINT8 fred; - int memory_accesses; - attotime time; - - int no_collide; - int vstretch; - int lefthanded; - int busy; -}; - -struct UART -{ - UINT8 serctl; - UINT8 data_received, data_to_send, buffer; - int received; - int sending; - int buffer_loaded; -}; - -struct SUZY -{ - UINT8 data[0x100]; - UINT8 high; - int low; - int signed_math; - int accumulate; - int accumulate_overflow; -}; - -struct MIKEY -{ - UINT8 data[0x100]; - UINT16 disp_addr; - UINT8 vb_rest; -}; - -struct LYNX_TIMER -{ - UINT8 bakup; - UINT8 cntrl1; - UINT8 cntrl2; - UINT8 counter; - emu_timer *timer; - int timer_active; -}; - -#define NR_LYNX_TIMERS 8 - -class lynx_state : public driver_device -{ -public: - enum - { - TIMER_BLITTER, - TIMER_SHOT, - TIMER_UART_LOOPBACK, - TIMER_UART - }; - - lynx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_mem_0000(*this, "mem_0000"), - m_mem_fc00(*this, "mem_fc00"), - m_mem_fd00(*this, "mem_fd00"), - m_mem_fe00(*this, "mem_fe00"), - m_mem_fffa(*this, "mem_fffa"), - m_maincpu(*this, "maincpu"), - m_sound(*this, "custom"), - m_cart(*this, "cartslot"), - m_palette(*this, "palette") { } - - virtual void video_start(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - required_shared_ptr m_mem_0000; - required_shared_ptr m_mem_fc00; - required_shared_ptr m_mem_fd00; - required_shared_ptr m_mem_fe00; - required_shared_ptr m_mem_fffa; - required_device m_maincpu; - required_device m_sound; - required_device m_cart; - required_device m_palette; - UINT16 m_granularity; - int m_sign_AB; - int m_sign_CD; - UINT32 m_lynx_palette[0x10]; - int m_rotate; - UINT8 m_memory_config; - - BLITTER m_blitter; - SUZY m_suzy; - MIKEY m_mikey; - UART m_uart; - LYNX_TIMER m_timer[NR_LYNX_TIMERS]; - - bitmap_ind16 m_bitmap; - bitmap_ind16 m_bitmap_temp; - DECLARE_READ8_MEMBER(suzy_read); - DECLARE_WRITE8_MEMBER(suzy_write); - DECLARE_WRITE8_MEMBER(lynx_uart_w); - DECLARE_READ8_MEMBER(lynx_uart_r); - DECLARE_READ8_MEMBER(mikey_read); - DECLARE_WRITE8_MEMBER(mikey_write); - DECLARE_READ8_MEMBER(lynx_memory_config_r); - DECLARE_WRITE8_MEMBER(lynx_memory_config_w); - void lynx_divide(); - void lynx_multiply(); - UINT8 lynx_timer_read(int which, int offset); - void lynx_timer_write(int which, int offset, UINT8 data); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(lynx); - void sound_cb(); - TIMER_CALLBACK_MEMBER(lynx_blitter_timer); - TIMER_CALLBACK_MEMBER(lynx_timer_shot); - TIMER_CALLBACK_MEMBER(lynx_uart_loopback_timer); - TIMER_CALLBACK_MEMBER(lynx_uart_timer); - void lynx_postload(); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( lynx_cart ); - UINT8 lynx_read_ram(UINT16 address); - void lynx_write_ram(UINT16 address, UINT8 data); - inline void lynx_plot_pixel(const int mode, const INT16 x, const int y, const int color); - void lynx_blit_do_work(const int y, const int xdir, const int bits_per_pixel, const int mask ); - void lynx_blit_rle_do_work( const INT16 y, const int xdir, const int bits_per_pixel, const int mask ); - void lynx_blit_lines(); - void lynx_blitter(); - void lynx_draw_line(); - void lynx_timer_init(int which); - void lynx_timer_signal_irq(int which); - void lynx_timer_count_down(int which); - UINT32 lynx_time_factor(int val); - void lynx_uart_reset(); - int lynx_verify_cart (char *header, int kind); - DECLARE_QUICKLOAD_LOAD_MEMBER( lynx ); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -/*---------- suzy registers ------------- */ -#define TMPADRL 0x00 // Temporary address (not sure what this is used for) -#define TMPADRH 0x01 -#define TILTACUML 0x02 // Tilt accumulator (signed fixed-point, eight bits to the left of decimal) -#define TILTACUMH 0x03 -#define HOFFL 0x04 // X offset to edge of visible window -#define HOFFH 0x05 -#define VOFFL 0x06 // Y offset to edge of visible window -#define VOFFH 0x07 -#define VIDBASL 0x08 // Video buffer address -#define VIDBASH 0x09 -#define COLLBASL 0x0A // Collision buffer address -#define COLLBASH 0x0B -#define VIDADRL 0x0C // Current Video Build Address -#define VIDADRH 0x0D -#define COLLADRL 0x0E // Current Collision Build Address -#define COLLADRH 0x0F -#define SCBNEXTL 0x10 // Address of next SCB -#define SCBNEXTH 0x11 -#define SPRDLINEL 0x12 // Sprite data start address -#define SPRDLINEH 0x13 -#define HPOSSTRTL 0x14 // Starting Hpos -#define HPOSSTRTH 0x15 -#define VPOSSTRTL 0x16 // Starting Vpos -#define VPOSSTRTH 0x17 -#define SPRHSIZL 0x18 // H Size -#define SPRHSIZH 0x19 -#define SPRVSIZL 0x1A // V Size -#define SPRVSIZH 0x1B -#define STRETCHL 0x1C // H/V Size Adder (signed fixed-point) -#define STRETCHH 0x1D -#define TILTL 0x1E // H Position Adder (signed fixed-point) -#define TILTH 0x1F -#define SPRDOFFL 0x20 // Offset to Next Sprite Data Line -#define SPRDOFFH 0x21 -#define SPRVPOSL 0x22 // Current Vpos -#define SPRVPOSH 0x23 -#define COLLOFFL 0x24 // Offset to Collision Depository -#define COLLOFFH 0x25 -#define VSIZACUML 0x26 // Vertical Size Accumulator -#define VSIZACUMH 0x27 -#define HSIZOFFL 0x28 // Horizontal Size Offset -#define HSIZOFFH 0x29 -#define VSIZOFFL 0x2A // Vertical Size Offset -#define VSIZOFFH 0x2B -#define SCBADRL 0x2C // Address of Current SCB -#define SCBADRH 0x2D -#define PROCADRL 0x2E // Current Spr Data Proc Address - -#define MATH_D 0x52 -#define MATH_C 0x53 -#define MATH_B 0x54 -#define MATH_A 0x55 -#define MATH_P 0x56 -#define MATH_N 0x57 -#define MATH_H 0x60 -#define MATH_G 0x61 -#define MATH_F 0x62 -#define MATH_E 0x63 - -#define MATH_M 0x6c -#define MATH_L 0x6d -#define MATH_K 0x6e -#define MATH_J 0x6f - -#define SPRCTL0 0x80 // Sprite Control Bits 0 (W)(U) -#define SPRCTL1 0x81 // Sprite Control Bits 1 (W)(U) -#define SPRCOLL 0x82 // Sprite Collision Number (W) -#define SPRINIT 0x83 // Sprite Initialization Bits (W)(U) - -#define SUZYHREV 0x88 // Suzy Hardware Revision (R) = '01' - -#define SUZYBUSEN 0x90 // Suzy Bus Enable (W) -#define SPRGO 0x91 // Sprite Process Start Bit (W) -#define SPRSYS 0x92 // System Control Bits (R/W) - -#define JOYSTICK 0xB0 // Read Joystick and Switches(R) -#define SWITCHES 0xB1 // Read Other Switches (R) -#define RCART 0xB2 // Read / Write Cartridge Bank 0 (R/W) -#define RCART_BANK1 0xB3 // Read / Write Cartridge Bank 1 (R/W) (Unused in existing cartridges?) - -//0xC0 LEDs (W) -//0xC2 Parallel Port Status(R/W) -//0xC3 Parallel Port Data (R/W) -//0xC4 Howie (R/W) - -// SCB offsets - -//8-bit -#define SCB_SPRCTL0 0x00 // 8 bit -#define SCB_SPRCTL1 0x01 // 8 bit -#define SCB_SPRCOLL 0x02 // 4 bit - -//16-bit -#define SCB_SCBNEXT 0x03 // L,H Address of Next SCB -#define SCB_SPRDLINE 0x05 // L,H Start of Sprite Data Line Address -#define SCB_HPOSSTRT 0x07 // L,H Starting Hpos -#define SCB_VPOSSTRT 0x09 // L,H Starting Vpos -#define SCB_SPRHSIZ 0x0B // L,H H Size -#define SCB_SPRVSIZ 0x0D // L,H V Size -#define SCB_STRETCH 0x0F // L H H/V Size Adder -#define SCB_TILT 0x11 // L,H H Position Adder - -#endif /* LYNX_H_ */ diff --git a/src/mess/includes/m5.h b/src/mess/includes/m5.h deleted file mode 100644 index 6d95a69a6c5..00000000000 --- a/src/mess/includes/m5.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __M5__ -#define __M5__ - -#include "machine/z80ctc.h" - -#define Z80_TAG "ic17" -#define Z80CTC_TAG "ic19" -#define SN76489AN_TAG "ic15" -#define TMS9918A_TAG "ic10" -#define TMS9929A_TAG "ic10" -#define I8255A_TAG "i8255a" -#define Z80_FD5_TAG "z80fd5" -#define UPD765_TAG "upd765" -#define CENTRONICS_TAG "centronics" -#define SCREEN_TAG "screen" - -class m5_state : public driver_device -{ -public: - m5_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_fd5cpu(*this, Z80_FD5_TAG), - m_ctc(*this, Z80CTC_TAG), - m_ppi(*this, I8255A_TAG), - m_fdc(*this, UPD765_TAG), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_centronics(*this, CENTRONICS_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, UPD765_TAG ":0:525dd"), - m_reset(*this, "RESET") - { } - - required_device m_maincpu; - required_device m_fd5cpu; - required_device m_ctc; - required_device m_ppi; - required_device m_fdc; - required_device m_cassette; - required_device m_cart; - required_device m_centronics; - required_device m_ram; - required_device m_floppy0; - required_ioport m_reset; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( sts_r ); - DECLARE_WRITE8_MEMBER( com_w ); - - DECLARE_READ8_MEMBER( ppi_pa_r ); - DECLARE_WRITE8_MEMBER( ppi_pa_w ); - DECLARE_WRITE8_MEMBER( ppi_pb_w ); - DECLARE_READ8_MEMBER( ppi_pc_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - - DECLARE_READ8_MEMBER( fd5_data_r ); - DECLARE_WRITE8_MEMBER( fd5_data_w ); - DECLARE_READ8_MEMBER( fd5_com_r ); - DECLARE_WRITE8_MEMBER( fd5_com_w ); - DECLARE_WRITE8_MEMBER( fd5_ctrl_w ); - DECLARE_WRITE8_MEMBER( fd5_tc_w ); - - // video state -// const TMS9928a_interface *m_vdp_intf; - - int m_centronics_busy; - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - - // floppy state - UINT8 m_fd5_data; - UINT8 m_fd5_com; - int m_intra; - int m_ibfa; - int m_obfa; - DECLARE_DRIVER_INIT(pal); - DECLARE_DRIVER_INIT(ntsc); - DECLARE_WRITE_LINE_MEMBER(sordm5_video_interrupt_callback); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); -}; - -#endif diff --git a/src/mess/includes/mac.h b/src/mess/includes/mac.h deleted file mode 100644 index 6b0092501fd..00000000000 --- a/src/mess/includes/mac.h +++ /dev/null @@ -1,562 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/***************************************************************************** - * - * includes/mac.h - * - * Macintosh driver declarations - * - ****************************************************************************/ - -#ifndef MAC_H_ -#define MAC_H_ - -#include "machine/8530scc.h" -#include "machine/6522via.h" -#include "machine/ram.h" -#include "machine/egret.h" -#include "machine/cuda.h" -#include "bus/nubus/nubus.h" -#include "bus/macpds/macpds.h" -#include "machine/ncr539x.h" -#include "machine/ncr5380.h" -#include "machine/mackbd.h" -#include "machine/macrtc.h" -#include "sound/asc.h" -#include "sound/awacs.h" -#include "cpu/m68000/m68000.h" - -#define MAC_SCREEN_NAME "screen" -#define MAC_539X_1_TAG "539x_1" -#define MAC_539X_2_TAG "539x_2" -#define MACKBD_TAG "mackbd" - -// uncomment to run i8021 keyboard in original Mac/512(e)/Plus -//#define MAC_USE_EMULATED_KBD (1) - -// model helpers -#define ADB_IS_BITBANG ((mac->m_model == MODEL_MAC_SE || mac->m_model == MODEL_MAC_CLASSIC) || (mac->m_model >= MODEL_MAC_II && mac->m_model <= MODEL_MAC_IICI) || (mac->m_model == MODEL_MAC_SE30) || (mac->m_model == MODEL_MAC_QUADRA_700)) -#define ADB_IS_BITBANG_CLASS ((m_model == MODEL_MAC_SE || m_model == MODEL_MAC_CLASSIC) || (m_model >= MODEL_MAC_II && m_model <= MODEL_MAC_IICI) || (m_model == MODEL_MAC_SE30) || (m_model == MODEL_MAC_QUADRA_700)) -#define ADB_IS_EGRET (m_model >= MODEL_MAC_LC && m_model <= MODEL_MAC_CLASSIC_II) || ((m_model >= MODEL_MAC_IISI) && (m_model <= MODEL_MAC_IIVI)) -#define ADB_IS_EGRET_NONCLASS (mac->m_model >= MODEL_MAC_LC && mac->m_model <= MODEL_MAC_CLASSIC_II) || ((mac->m_model >= MODEL_MAC_IISI) && (mac->m_model <= MODEL_MAC_IIVI)) -#define ADB_IS_CUDA ((m_model >= MODEL_MAC_COLOR_CLASSIC && m_model <= MODEL_MAC_LC_580) || ((m_model >= MODEL_MAC_QUADRA_660AV) && (m_model <= MODEL_MAC_QUADRA_630)) || (m_model >= MODEL_MAC_POWERMAC_6100)) -#define ADB_IS_CUDA_NONCLASS ((mac->m_model >= MODEL_MAC_COLOR_CLASSIC && mac->m_model <= MODEL_MAC_LC_580) || ((mac->m_model >= MODEL_MAC_QUADRA_660AV) && (mac->m_model <= MODEL_MAC_QUADRA_630)) || (mac->m_model >= MODEL_MAC_POWERMAC_6100)) -#define ADB_IS_PM_VIA1_CLASS (m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100) -#define ADB_IS_PM_VIA2_CLASS (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c) -#define ADB_IS_PM_CLASS ((m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100) || (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c)) - -/* for Egret and CUDA streaming MCU commands, command types */ -enum mac_streaming_t -{ - MCU_STREAMING_NONE = 0, - MCU_STREAMING_PRAMRD, - MCU_STREAMING_PRAMWR, - MCU_STREAMING_WRAMRD, - MCU_STREAMING_WRAMWR -}; - -enum -{ - RBV_TYPE_RBV = 0, - RBV_TYPE_V8, - RBV_TYPE_SONORA, - RBV_TYPE_DAFB -}; - -/* tells which model is being emulated (set by macxxx_init) */ -enum model_t -{ - MODEL_MAC_128K512K, // 68000 machines - MODEL_MAC_512KE, - MODEL_MAC_PLUS, - MODEL_MAC_SE, - MODEL_MAC_CLASSIC, - - MODEL_MAC_PORTABLE, // Portable/PB100 are sort of hybrid classic and Mac IIs - MODEL_MAC_PB100, - - MODEL_MAC_II, // Mac II class 68020/030 machines - MODEL_MAC_II_FDHD, - MODEL_MAC_IIX, - MODEL_MAC_IICX, - MODEL_MAC_IICI, - MODEL_MAC_IISI, - MODEL_MAC_IIVX, - MODEL_MAC_IIVI, - MODEL_MAC_IIFX, - MODEL_MAC_SE30, - - MODEL_MAC_LC, // LC class 68030 machines, generally using a V8 or compatible gate array - MODEL_MAC_LC_II, - MODEL_MAC_LC_III, - MODEL_MAC_LC_III_PLUS, - MODEL_MAC_CLASSIC_II, - MODEL_MAC_COLOR_CLASSIC, - - MODEL_MAC_LC_475, // LC III clones with Cuda instead of Egret and 68LC040 on most models - MODEL_MAC_LC_520, - MODEL_MAC_LC_550, - MODEL_MAC_TV, - MODEL_MAC_LC_575, - MODEL_MAC_LC_580, - - MODEL_MAC_PB140, // 68030 PowerBooks. 140/145/145B/170 all have the same machine ID - MODEL_MAC_PB160, // 160/180/165 all have the same machine ID too - MODEL_MAC_PB165c, - MODEL_MAC_PB180c, - MODEL_MAC_PB150, // 150 is fairly radically different from the other 1x0s - - MODEL_MAC_PBDUO_210, // 68030 PowerBook Duos - MODEL_MAC_PBDUO_230, - MODEL_MAC_PBDUO_250, - MODEL_MAC_PBDUO_270c, - - MODEL_MAC_QUADRA_700, // 68(LC)040 desktops - MODEL_MAC_QUADRA_610, - MODEL_MAC_QUADRA_650, - MODEL_MAC_QUADRA_800, - MODEL_MAC_QUADRA_900, - MODEL_MAC_QUADRA_950, - MODEL_MAC_QUADRA_660AV, - MODEL_MAC_QUADRA_840AV, - MODEL_MAC_QUADRA_605, - MODEL_MAC_QUADRA_630, - - MODEL_MAC_PB550c, // 68(LC)040 PowerBooks - MODEL_MAC_PB520, - MODEL_MAC_PB520c, - MODEL_MAC_PB540, - MODEL_MAC_PB540c, - MODEL_MAC_PB190, - MODEL_MAC_PB190cs, - - MODEL_MAC_POWERMAC_6100, // NuBus PowerMacs - MODEL_MAC_POWERMAC_7100, - MODEL_MAC_POWERMAC_8100 -}; - -// video parameters for classic Macs -#define MAC_H_VIS (512) -#define MAC_V_VIS (342) -#define MAC_H_TOTAL (704) // (512+192) -#define MAC_V_TOTAL (370) // (342+28) - -/*----------- defined in machine/mac.c -----------*/ - -void mac_fdc_set_enable_lines(device_t *device, int enable_mask); - -/*----------- defined in audio/mac.c -----------*/ - -class mac_sound_device : public device_t, - public device_sound_interface -{ -public: - mac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~mac_sound_device() {} - - void enable_sound(int on); - void set_sound_buffer(int buffer); - void set_volume(int volume); - void sh_updatebuffer(); - -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); -private: - // internal state - - ram_device *m_ram; - model_t m_mac_model; - - sound_stream *m_mac_stream; - int m_sample_enable; - UINT16 *m_mac_snd_buf_ptr; - UINT8 *m_snd_cache; - int m_snd_cache_len; - int m_snd_cache_head; - int m_snd_cache_tail; - int m_indexx; -}; - -extern const device_type MAC_SOUND; - - -/* Mac driver data */ - -class mac_state : public driver_device -{ -public: - mac_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_via1(*this, "via6522_0"), - m_via2(*this, "via6522_1"), - m_asc(*this, "asc"), - m_awacs(*this, "awacs"), - m_egret(*this, EGRET_TAG), - m_cuda(*this, CUDA_TAG), - m_ram(*this, RAM_TAG), - m_539x_1(*this, MAC_539X_1_TAG), - m_539x_2(*this, MAC_539X_2_TAG), - m_ncr5380(*this, "ncr5380"), - m_mackbd(*this, MACKBD_TAG), - m_rtc(*this,"rtc"), - m_mouse0(*this, "MOUSE0"), - m_mouse1(*this, "MOUSE1"), - m_mouse2(*this, "MOUSE2"), - m_key0(*this, "KEY0"), - m_key1(*this, "KEY1"), - m_key2(*this, "KEY2"), - m_key3(*this, "KEY3"), - m_key4(*this, "KEY4"), - m_key5(*this, "KEY5"), - m_key6(*this, "KEY6"), - m_montype(*this, "MONTYPE"), - m_vram(*this,"vram"), - m_vram16(*this,"vram16"), - m_via2_ca1_hack(0), - m_screen(*this, "screen"), - m_palette(*this, "palette") - { - } - - required_device m_maincpu; - required_device m_via1; - optional_device m_via2; - optional_device m_asc; - optional_device m_awacs; - optional_device m_egret; - optional_device m_cuda; - required_device m_ram; - optional_device m_539x_1; - optional_device m_539x_2; - optional_device m_ncr5380; - optional_device m_mackbd; - optional_device m_rtc; - - required_ioport m_mouse0, m_mouse1, m_mouse2; - required_ioport m_key0, m_key1, m_key2, m_key3, m_key4, m_key5; - optional_ioport m_key6, m_montype; - - virtual void machine_start(); - virtual void machine_reset(); - - model_t m_model; - - UINT32 m_overlay; - int m_drive_select; - int m_scsiirq_enable; - - UINT32 m_via2_vbl; - UINT32 m_se30_vbl_enable; - UINT8 m_nubus_irq_state; - -#ifndef MAC_USE_EMULATED_KBD - /* used to store the reply to most keyboard commands */ - int m_keyboard_reply; - - /* Keyboard communication in progress? */ - int m_kbd_comm; - int m_kbd_receive; - /* timer which is used to time out inquiry */ - emu_timer *m_inquiry_timeout; - - int m_kbd_shift_reg; - int m_kbd_shift_count; - - /* keycode buffer (used for keypad/arrow key transition) */ - int m_keycode_buf[2]; - int m_keycode_buf_index; -#endif - - /* keyboard matrix to detect transition - macadb needs to stop relying on this */ - int m_key_matrix[7]; - - int m_mouse_bit_x; - int m_mouse_bit_y; - int last_mx, last_my; - int count_x, count_y; - int m_last_was_x; - int m_screen_buffer; - - int irq_count, ca1_data, ca2_data; - - // Mac ADB state - INT32 m_adb_irq_pending, m_adb_waiting_cmd, m_adb_datasize, m_adb_buffer[257]; - INT32 m_adb_state, m_adb_command, m_adb_send, m_adb_timer_ticks, m_adb_extclock, m_adb_direction; - INT32 m_adb_listenreg, m_adb_listenaddr, m_adb_last_talk, m_adb_srq_switch; - INT32 m_adb_streaming, m_adb_stream_ptr; - INT32 m_adb_linestate; - bool m_adb_srqflag; -#define kADBKeyBufSize 32 - UINT8 m_adb_keybuf[kADBKeyBufSize]; - UINT8 m_adb_keybuf_start; - UINT8 m_adb_keybuf_end; - - // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition) - UINT8 m_pm_data_send, m_pm_data_recv, m_pm_ack, m_pm_req, m_pm_cmd[32], m_pm_out[32], m_pm_dptr, m_pm_sptr, m_pm_slen, m_pm_state; - UINT8 m_pmu_int_status, m_pmu_last_adb_command, m_pmu_poll; - emu_timer *m_pmu_send_timer; - - // 60.15 Hz timer for RBV/V8/Sonora/Eagle/VASP/etc. - emu_timer *m_6015_timer; - - // RBV and friends (V8, etc) - UINT8 m_rbv_regs[256], m_rbv_ier, m_rbv_ifr, m_rbv_type, m_rbv_montype, m_rbv_vbltime; - UINT32 m_rbv_colors[3], m_rbv_count, m_rbv_clutoffs, m_rbv_immed10wr; - UINT32 m_rbv_palette[256]; - UINT8 m_sonora_vctl[8]; - emu_timer *m_vbl_timer, *m_cursor_timer; - UINT16 m_cursor_line; - UINT16 m_dafb_int_status; - int m_dafb_scsi1_drq, m_dafb_scsi2_drq; - UINT8 m_dafb_mode; - UINT32 m_dafb_base, m_dafb_stride; - - // this is shared among all video setups with vram - optional_shared_ptr m_vram; - optional_shared_ptr m_vram16; - - // interrupts - int m_scc_interrupt, m_via_interrupt, m_via2_interrupt, m_scsi_interrupt, m_asc_interrupt, m_last_taken_interrupt; - - // defined in machine/mac.c - void v8_resize(); - void set_memory_overlay(int overlay); - void scc_mouse_irq( int x, int y ); - void nubus_slot_interrupt(UINT8 slot, UINT32 state); - DECLARE_WRITE_LINE_MEMBER(set_scc_interrupt); - void set_via_interrupt(int value); - void set_via2_interrupt(int value); - void field_interrupts(); - void rtc_write_rTCEnb(int data); - void rtc_shift_data(int data); - void vblank_irq(); - void rtc_incticks(); - void adb_talk(); - void mouse_callback(); - void rbv_recalc_irqs(); - void pmu_exec(); - void mac_adb_newaction(int state); - void set_adb_line(int linestate); - - DECLARE_READ16_MEMBER ( mac_via_r ); - DECLARE_WRITE16_MEMBER ( mac_via_w ); - DECLARE_READ16_MEMBER ( mac_via2_r ); - DECLARE_WRITE16_MEMBER ( mac_via2_w ); - DECLARE_READ16_MEMBER ( mac_autovector_r ); - DECLARE_WRITE16_MEMBER ( mac_autovector_w ); - DECLARE_READ16_MEMBER ( mac_iwm_r ); - DECLARE_WRITE16_MEMBER ( mac_iwm_w ); - DECLARE_READ16_MEMBER ( mac_scc_r ); - DECLARE_WRITE16_MEMBER ( mac_scc_w ); - DECLARE_WRITE16_MEMBER ( mac_scc_2_w ); - DECLARE_READ16_MEMBER ( macplus_scsi_r ); - DECLARE_WRITE16_MEMBER ( macplus_scsi_w ); - DECLARE_WRITE16_MEMBER ( macii_scsi_w ); - DECLARE_READ32_MEMBER (macii_scsi_drq_r); - DECLARE_WRITE32_MEMBER (macii_scsi_drq_w); - - DECLARE_READ32_MEMBER( rbv_ramdac_r ); - DECLARE_WRITE32_MEMBER( rbv_ramdac_w ); - DECLARE_WRITE32_MEMBER( ariel_ramdac_w ); - DECLARE_READ8_MEMBER( mac_sonora_vctl_r ); - DECLARE_WRITE8_MEMBER( mac_sonora_vctl_w ); - DECLARE_READ8_MEMBER ( mac_rbv_r ); - DECLARE_WRITE8_MEMBER ( mac_rbv_w ); - - DECLARE_READ32_MEMBER(mac_read_id); - - DECLARE_READ16_MEMBER(mac_config_r); - - DECLARE_READ32_MEMBER(biu_r); - DECLARE_WRITE32_MEMBER(biu_w); - DECLARE_READ8_MEMBER(oss_r); - DECLARE_WRITE8_MEMBER(oss_w); - DECLARE_READ32_MEMBER(buserror_r); - DECLARE_READ8_MEMBER(swimiop_r); - DECLARE_WRITE8_MEMBER(swimiop_w); - DECLARE_READ8_MEMBER(scciop_r); - DECLARE_WRITE8_MEMBER(scciop_w); - - DECLARE_READ8_MEMBER(hmc_r); - DECLARE_WRITE8_MEMBER(hmc_w); - DECLARE_READ8_MEMBER(amic_dma_r); - DECLARE_WRITE8_MEMBER(amic_dma_w); - DECLARE_READ8_MEMBER(pmac_diag_r); - - DECLARE_READ8_MEMBER(mac_gsc_r); - DECLARE_WRITE8_MEMBER(mac_gsc_w); - - DECLARE_READ8_MEMBER(mac_5396_r); - DECLARE_WRITE8_MEMBER(mac_5396_w); - - DECLARE_READ32_MEMBER(dafb_r); - DECLARE_WRITE32_MEMBER(dafb_w); - DECLARE_READ32_MEMBER(dafb_dac_r); - DECLARE_WRITE32_MEMBER(dafb_dac_w); - - DECLARE_READ32_MEMBER(macwd_r); - DECLARE_WRITE32_MEMBER(macwd_w); - - DECLARE_WRITE_LINE_MEMBER(nubus_irq_9_w); - DECLARE_WRITE_LINE_MEMBER(nubus_irq_a_w); - DECLARE_WRITE_LINE_MEMBER(nubus_irq_b_w); - DECLARE_WRITE_LINE_MEMBER(nubus_irq_c_w); - DECLARE_WRITE_LINE_MEMBER(nubus_irq_d_w); - DECLARE_WRITE_LINE_MEMBER(nubus_irq_e_w); - - DECLARE_WRITE_LINE_MEMBER(irq_539x_1_w); - DECLARE_WRITE_LINE_MEMBER(drq_539x_1_w); - - DECLARE_WRITE_LINE_MEMBER(cuda_reset_w); - DECLARE_WRITE_LINE_MEMBER(adb_linechange_w); - - DECLARE_WRITE_LINE_MEMBER(mac_scsi_irq); - DECLARE_WRITE_LINE_MEMBER(mac_asc_irq); - - DECLARE_DIRECT_UPDATE_MEMBER(overlay_opbaseoverride); -private: - int has_adb(); - void adb_reset(); - void adb_vblank(); - int adb_pollkbd(int update); - int adb_pollmouse(); - void adb_accummouse( UINT8 *MouseX, UINT8 *MouseY ); - void pmu_one_byte_reply(UINT8 result); - void pmu_three_byte_reply(UINT8 result1, UINT8 result2, UINT8 result3); - - // wait states for accessing the VIA - int m_via_cycles; - - // ADB mouse state - int m_adb_mouseaddr; - int m_adb_lastmousex, m_adb_lastmousey, m_adb_lastbutton, m_adb_mouse_initialized; - - // ADB keyboard state - int m_adb_keybaddr; - int m_adb_keybinitialized, m_adb_currentkeys[2], m_adb_modifiers; - - // PRAM for ADB MCU HLEs (mostly unused now) - UINT8 m_adb_pram[256]; - - UINT8 m_oss_regs[0x400]; - - // AMIC for x100 PowerMacs - UINT8 m_amic_regs[0x200]; - - // HMC for x100 PowerMacs - UINT64 m_hmc_reg, m_hmc_shiftout; - - int m_via2_ca1_hack; - optional_device m_screen; - optional_device m_palette; -public: - emu_timer *m_scanline_timer; - emu_timer *m_adb_timer; - DECLARE_DRIVER_INIT(maclc2); - DECLARE_DRIVER_INIT(maciifdhd); - DECLARE_DRIVER_INIT(macse30); - DECLARE_DRIVER_INIT(macprtb); - DECLARE_DRIVER_INIT(maciivx); - DECLARE_DRIVER_INIT(macpd210); - DECLARE_DRIVER_INIT(macii); - DECLARE_DRIVER_INIT(macclassic); - DECLARE_DRIVER_INIT(macquadra700); - DECLARE_DRIVER_INIT(macclassic2); - DECLARE_DRIVER_INIT(maciifx); - DECLARE_DRIVER_INIT(maclc); - DECLARE_DRIVER_INIT(macpb160); - DECLARE_DRIVER_INIT(macplus); - DECLARE_DRIVER_INIT(macse); - DECLARE_DRIVER_INIT(macpb140); - DECLARE_DRIVER_INIT(mac128k512k); - DECLARE_DRIVER_INIT(macpm6100); - DECLARE_DRIVER_INIT(mac512ke); - DECLARE_DRIVER_INIT(maclc520); - DECLARE_DRIVER_INIT(maciici); - DECLARE_DRIVER_INIT(maciix); - DECLARE_DRIVER_INIT(maclrcclassic); - DECLARE_DRIVER_INIT(maciisi); - DECLARE_DRIVER_INIT(maciicx); - DECLARE_DRIVER_INIT(maclc3); - DECLARE_DRIVER_INIT(maclc3plus); - DECLARE_DRIVER_INIT(macpm7100); - DECLARE_DRIVER_INIT(macpm8100); - DECLARE_DRIVER_INIT(macpb100); - DECLARE_VIDEO_START(mac); - DECLARE_PALETTE_INIT(mac); - DECLARE_VIDEO_START(macprtb); - DECLARE_PALETTE_INIT(macgsc); - DECLARE_VIDEO_START(macsonora); - DECLARE_VIDEO_RESET(macrbv); - DECLARE_VIDEO_START(macdafb); - DECLARE_VIDEO_RESET(macdafb); - DECLARE_VIDEO_START(macv8); - DECLARE_VIDEO_RESET(macsonora); - DECLARE_VIDEO_RESET(maceagle); - DECLARE_VIDEO_START(macrbv); - UINT32 screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macprtb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macse30(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(mac_rbv_vbl); -#ifndef MAC_USE_EMULATED_KBD - TIMER_CALLBACK_MEMBER(kbd_clock); - TIMER_CALLBACK_MEMBER(inquiry_timeout_func); -#endif - TIMER_CALLBACK_MEMBER(mac_6015_tick); - TIMER_CALLBACK_MEMBER(mac_scanline_tick); - TIMER_CALLBACK_MEMBER(dafb_vbl_tick); - TIMER_CALLBACK_MEMBER(dafb_cursor_tick); - DECLARE_WRITE_LINE_MEMBER(mac_via_out_cb2); - DECLARE_WRITE_LINE_MEMBER(mac_adb_via_out_cb2); - DECLARE_READ8_MEMBER(mac_via_in_a); - DECLARE_READ8_MEMBER(mac_via_in_b); - DECLARE_WRITE8_MEMBER(mac_via_out_a); - DECLARE_WRITE8_MEMBER(mac_via_out_b); - DECLARE_READ8_MEMBER(mac_via_in_a_pmu); - DECLARE_READ8_MEMBER(mac_via_in_b_pmu); - DECLARE_WRITE8_MEMBER(mac_via_out_a_pmu); - DECLARE_WRITE8_MEMBER(mac_via_out_b_pmu); - DECLARE_WRITE8_MEMBER(mac_via_out_b_bbadb); - DECLARE_WRITE8_MEMBER(mac_via_out_b_egadb); - DECLARE_WRITE8_MEMBER(mac_via_out_b_cdadb); - DECLARE_READ8_MEMBER(mac_via_in_b_via2pmu); - DECLARE_WRITE8_MEMBER(mac_via_out_b_via2pmu); - DECLARE_READ8_MEMBER(mac_via2_in_a); - DECLARE_READ8_MEMBER(mac_via2_in_b); - DECLARE_WRITE8_MEMBER(mac_via2_out_a); - DECLARE_WRITE8_MEMBER(mac_via2_out_b); - DECLARE_READ8_MEMBER(mac_via2_in_a_pmu); - DECLARE_READ8_MEMBER(mac_via2_in_b_pmu); - DECLARE_WRITE8_MEMBER(mac_via2_out_a_pmu); - DECLARE_WRITE8_MEMBER(mac_via2_out_b_pmu); - DECLARE_WRITE_LINE_MEMBER(mac_kbd_clk_in); - void mac_state_load(); - DECLARE_WRITE_LINE_MEMBER(mac_via_irq); - DECLARE_WRITE_LINE_MEMBER(mac_via2_irq); - void dafb_recalc_ints(); - void set_scc_waitrequest(int waitrequest); - int scan_keyboard(); - void keyboard_init(); - void kbd_shift_out(int data); - void keyboard_receive(int val); - void mac_driver_init(model_t model); - void mac_tracetrap(const char *cpu_name_local, int addr, int trap); - void mac_install_memory(offs_t memory_begin, offs_t memory_end, - offs_t memory_size, void *memory_data, int is_rom, const char *bank); -}; - -#endif /* MAC_H_ */ diff --git a/src/mess/includes/macpci.h b/src/mess/includes/macpci.h deleted file mode 100644 index 56f7d066431..00000000000 --- a/src/mess/includes/macpci.h +++ /dev/null @@ -1,169 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/***************************************************************************** - * - * includes/macpci.h - * - * PCI-based Power Macintosh driver declarations - * - ****************************************************************************/ - -#ifndef MACPCI_H_ -#define MACPCI_H_ - -#include "machine/8530scc.h" -#include "machine/6522via.h" -#include "machine/ram.h" -#include "machine/cuda.h" -#include "machine/ncr539x.h" -#include "sound/awacs.h" - -#define C7M (7833600) -#define C15M (C7M*2) - -#define MAC_SCREEN_NAME "screen" -#define MAC_539X_1_TAG "539x_1" -#define MAC_539X_2_TAG "539x_2" - -/* tells which model is being emulated (set by macxxx_init) */ -enum model_t -{ - PCIMODEL_MAC_PM5200, - PCIMODEL_MAC_PM6200, - PCIMODEL_MAC_PM5300, - PCIMODEL_MAC_PM7200, - PCIMODEL_MAC_PM7500, - PCIMODEL_MAC_PM8500, - PCIMODEL_MAC_PM9500, - PCIMODEL_MAC_PM7215, - PCIMODEL_MAC_PM5260, - PCIMODEL_MAC_PM5400, - PCIMODEL_MAC_PM7600, - PCIMODEL_MAC_PM8200, - PCIMODEL_MAC_PM6300, - PCIMODEL_MAC_PM6400, - PCIMODEL_MAC_PM4400, - PCIMODEL_MAC_PM5500, - PCIMODEL_MAC_PM7220, - PCIMODEL_MAC_PM7300, - PCIMODEL_MAC_PM6500, - PCIMODEL_MAC_PM8600, - PCIMODEL_MAC_PM9600, - - PCIMODEL_MAC_20TH, - - PCIMODEL_MAC_G3_GOSSAMER, - PCIMODEL_MAC_G3_ALLINONE, - - PCIMODEL_MAC_PB5x0PPC, - PCIMODEL_MAC_PB1400, - PCIMODEL_MAC_PB2300, - PCIMODEL_MAC_PB2400, - PCIMODEL_MAC_PB3400, - PCIMODEL_MAC_PB5300, - - PCIMODEL_MAC_PBG3KANGA, - PCIMODEL_MAC_PBG3WALLST1, - PCIMODEL_MAC_PBG3WALLST2, - - PCIMODEL_MAC_PIPPIN // Apple/Bandai Pippin - -}; - - -/* Mac driver data */ - -class macpci_state : public driver_device -{ -public: - macpci_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_via1(*this, "via6522_0"), - m_awacs(*this, "awacs"), - m_cuda(*this, CUDA_TAG), - m_ram(*this, RAM_TAG), - m_539x_1(*this, MAC_539X_1_TAG), - m_539x_2(*this, MAC_539X_2_TAG) - { } - - required_device m_maincpu; - required_device m_via1; - optional_device m_awacs; - required_device m_cuda; - required_device m_ram; - optional_device m_539x_1; - optional_device m_539x_2; - - virtual void machine_start(); - virtual void machine_reset(); - - model_t m_model; - - // 60.15 Hz timer for RBV/V8/Sonora/Eagle/VASP/etc. - emu_timer *m_6015_timer; - - // RBV and friends (V8, etc) - UINT8 m_rbv_regs[256], m_rbv_ier, m_rbv_ifr, m_rbv_type, m_rbv_montype, m_rbv_vbltime; - UINT32 m_rbv_colors[3], m_rbv_count, m_rbv_clutoffs, m_rbv_immed10wr; - UINT32 m_rbv_palette[256]; - UINT8 m_sonora_vctl[8]; - emu_timer *m_vbl_timer, *m_cursor_timer; - UINT16 m_cursor_line; - UINT16 m_dafb_int_status; - int m_dafb_scsi1_drq, m_dafb_scsi2_drq; - UINT8 m_dafb_mode; - UINT32 m_dafb_base, m_dafb_stride; - - // this is shared among all video setups with vram - UINT32 *m_vram; - - // defined in machine/mac.c - void set_via_interrupt(int value); - void vblank_irq(); - void mac_adb_newaction(int state); - - DECLARE_READ16_MEMBER ( mac_via_r ); - DECLARE_WRITE16_MEMBER ( mac_via_w ); - DECLARE_READ16_MEMBER ( mac_scc_r ); - DECLARE_WRITE16_MEMBER ( mac_scc_w ); - DECLARE_WRITE16_MEMBER ( mac_scc_2_w ); - - DECLARE_READ32_MEMBER(mac_read_id); - - DECLARE_READ8_MEMBER(mac_5396_r); - DECLARE_WRITE8_MEMBER(mac_5396_w); - - DECLARE_WRITE_LINE_MEMBER(irq_539x_1_w); - DECLARE_WRITE_LINE_MEMBER(drq_539x_1_w); - - DECLARE_WRITE_LINE_MEMBER(cuda_reset_w); - DECLARE_WRITE_LINE_MEMBER(cuda_adb_linechange_w); - - // hack functions - DECLARE_READ64_MEMBER ( unk1_r ); - DECLARE_READ64_MEMBER ( unk2_r ); - - DECLARE_DRIVER_INIT(pippin); -private: - // wait states for accessing the VIA - int m_via_cycles; - - // hack - UINT16 m_unk1_test; - -public: - emu_timer *m_scanline_timer; - UINT32 screen_update_pippin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(mac_6015_tick); - DECLARE_READ8_MEMBER(mac_via_in_a); - DECLARE_READ8_MEMBER(mac_via_in_b); - DECLARE_WRITE8_MEMBER(mac_via_out_a); - DECLARE_WRITE8_MEMBER(mac_via_out_b); - DECLARE_READ_LINE_MEMBER(mac_adb_via_in_cb2); - DECLARE_WRITE_LINE_MEMBER(mac_adb_via_out_cb2); - DECLARE_WRITE_LINE_MEMBER(mac_via_irq); - void mac_driver_init(model_t model); -}; - -#endif /* PCIMAC_H_ */ diff --git a/src/mess/includes/mbc55x.h b/src/mess/includes/mbc55x.h deleted file mode 100644 index d0578708939..00000000000 --- a/src/mess/includes/mbc55x.h +++ /dev/null @@ -1,221 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phill Harvey-Smith -/* - mbc55x.h - Includes for the Sanyo MBC-550, MBC-555. - - Phill Harvey-Smith - 2011-01-29. -*/ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "machine/ram.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/wd_fdc.h" -#include "machine/i8251.h" -#include "sound/speaker.h" -#include "video/mc6845.h" -#include "imagedev/flopdrv.h" -#include "formats/pc_dsk.h" -#include "debugger.h" -#include "debug/debugcon.h" - -#define MAINCPU_TAG "maincpu" - -#define SCREEN_TAG "screen" -#define SCREEN_WIDTH_PIXELS 640 -#define SCREEN_HEIGHT_LINES 250 -#define SCREEN_NO_COLOURS 8 - -#define VIDEO_MEM_SIZE (32*1024) -#define VID_MC6845_NAME "mc6845" - -// Red and blue colour planes sit at a fixed location, green -// is in main memory. - -#define COLOUR_PLANE_SIZE 0x4000 - -#define RED_PLANE_OFFSET (0*COLOUR_PLANE_SIZE) -#define BLUE_PLANE_OFFSET (1*COLOUR_PLANE_SIZE) - -#define COLOUR_PLANE_MEMBASE 0xF0000 -#define RED_PLANE_MEMBASE (COLOUR_PLANE_MEMBASE+RED_PLANE_OFFSET) -#define BLUE_PLANE_MEMBASE (COLOUR_PLANE_MEMBASE+BLUE_PLANE_OFFSET) - -#define RED_PLANE_TAG "red" -#define BLUE_PLANE_TAG "blue" - -// Keyboard - -#define MBC55X_KEYROWS 7 -#define KEYBOARD_QUEUE_SIZE 32 - -#define KB_BITMASK 0x1000 -#define KB_SHIFTS 12 - -#define KEY_SPECIAL_TAG "KEY_SPECIAL" -#define KEY_BIT_LSHIFT 0x01 -#define KEY_BIT_RSHIFT 0x02 -#define KEY_BIT_CTRL 0x04 -#define KEY_BIT_GRAPH 0x08 - -#define PPI8255_TAG "ppi8255" -#define PIC8259_TAG "pic8259" - -// From tech manual clock c1 is fed from c0, but it approx 100Hz -#define PIT8253_TAG "pit8253" -#define PIT_C0_CLOCK 78600 -#define PIT_C1_CLOCK 100 -#define PIT_C2_CLOCK 1789770 - -#define MONO_TAG "mono" -#define I8251A_KB_TAG "i8251a_kb" -#define FDC_TAG "wd1793" - - -struct keyboard_t -{ - UINT8 keyrows[MBC55X_KEYROWS]; - emu_timer *keyscan_timer; - - UINT8 key_special; -}; - - -class mbc55x_state : public driver_device -{ -public: - mbc55x_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MAINCPU_TAG), - m_crtc(*this, VID_MC6845_NAME), - m_kb_uart(*this, I8251A_KB_TAG), - m_pit(*this, PIT8253_TAG), - m_ppi(*this, PPI8255_TAG), - m_pic(*this, PIC8259_TAG), - m_fdc(*this, FDC_TAG), - m_floppy0(*this, FDC_TAG ":0"), - m_floppy1(*this, FDC_TAG ":1"), - m_floppy2(*this, FDC_TAG ":2"), - m_floppy3(*this, FDC_TAG ":3"), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") - { - } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - required_device m_maincpu; - required_device m_crtc; - required_device m_kb_uart; - required_device m_pit; - required_device m_ppi; - required_device m_pic; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_device m_speaker; - required_device m_ram; - required_device m_palette; - //DECLARE_READ8_MEMBER(pic8259_r); - //DECLARE_WRITE8_MEMBER(pic8259_w); - //DECLARE_READ8_MEMBER(mbc55x_disk_r); - //DECLARE_WRITE8_MEMBER(mbc55x_disk_w); - DECLARE_READ8_MEMBER(mbc55x_usart_r); - DECLARE_WRITE8_MEMBER(mbc55x_usart_w); - //DECLARE_READ8_MEMBER(mbc55x_kb_usart_r); - //DECLARE_WRITE8_MEMBER(mbc55x_kb_usart_w); - DECLARE_READ8_MEMBER(vram_page_r); - DECLARE_WRITE8_MEMBER(vram_page_w); - DECLARE_READ8_MEMBER(ppi8255_r); - DECLARE_WRITE8_MEMBER(ppi8255_w); - //DECLARE_READ8_MEMBER(pit8253_r); - //DECLARE_WRITE8_MEMBER(pit8253_w); - DECLARE_READ16_MEMBER(mbc55x_io_r); - DECLARE_WRITE16_MEMBER(mbc55x_io_w); - DECLARE_READ8_MEMBER(mbc55x_ppi_porta_r); - DECLARE_READ8_MEMBER(mbc55x_ppi_portb_r); - DECLARE_READ8_MEMBER(mbc55x_ppi_portc_r); - DECLARE_WRITE8_MEMBER(mbc55x_ppi_porta_w); - DECLARE_WRITE8_MEMBER(mbc55x_ppi_portb_w); - DECLARE_WRITE8_MEMBER(mbc55x_ppi_portc_w); - DECLARE_WRITE_LINE_MEMBER(vid_hsync_changed); - DECLARE_WRITE_LINE_MEMBER(vid_vsync_changed); - DECLARE_WRITE_LINE_MEMBER(pit8253_t2); - - UINT32 m_debug_machine; - UINT32 m_debug_video; - UINT8 m_video_mem[VIDEO_MEM_SIZE]; - UINT8 m_vram_page; - - keyboard_t m_keyboard; - DECLARE_READ8_MEMBER(mbcpic8259_r); - DECLARE_WRITE8_MEMBER(mbcpic8259_w); - DECLARE_READ8_MEMBER(mbcpit8253_r); - DECLARE_WRITE8_MEMBER(mbcpit8253_w); - DECLARE_READ8_MEMBER(mbc55x_disk_r); - DECLARE_WRITE8_MEMBER(mbc55x_disk_w); - DECLARE_READ8_MEMBER(mbc55x_kb_usart_r); - DECLARE_WRITE8_MEMBER(mbc55x_kb_usart_w); - DECLARE_DRIVER_INIT(mbc55x); - MC6845_UPDATE_ROW(crtc_update_row); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - virtual void video_reset(); - DECLARE_PALETTE_INIT(mbc55x); - void screen_eof_mbc55x(screen_device &screen, bool state); - TIMER_CALLBACK_MEMBER(keyscan_callback); - void keyboard_reset(); - void scan_keyboard(); - void set_ram_size(); -}; - -/*----------- defined in drivers/mbc55x.c -----------*/ - -extern const unsigned char mbc55x_palette[SCREEN_NO_COLOURS][3]; - - -/*----------- defined in machine/mbc55x.c -----------*/ - -/* Memory controller */ -#define RAM_BANK00_TAG "bank0" -#define RAM_BANK01_TAG "bank1" -#define RAM_BANK02_TAG "bank2" -#define RAM_BANK03_TAG "bank3" -#define RAM_BANK04_TAG "bank4" -#define RAM_BANK05_TAG "bank5" -#define RAM_BANK06_TAG "bank6" -#define RAM_BANK07_TAG "bank7" -#define RAM_BANK08_TAG "bank8" -#define RAM_BANK09_TAG "bank9" -#define RAM_BANK0A_TAG "banka" -#define RAM_BANK0B_TAG "bankb" -#define RAM_BANK0C_TAG "bankc" -#define RAM_BANK0D_TAG "bankd" -#define RAM_BANK0E_TAG "banke" - -#define RAM_BANK_SIZE (64*1024) -#define RAM_BANK_COUNT 15 - -/* Floppy drive interface */ - -#define FDC_PAUSE 10000 - - -/*----------- defined in video/mbc55x.c -----------*/ - -#define RED 0 -#define GREEN 1 -#define BLUE 2 - -#define LINEAR_ADDR(seg,ofs) ((seg<<4)+ofs) - -#define OUTPUT_SEGOFS(mess,seg,ofs) logerror("%s=%04X:%04X [%08X]\n",mess,seg,ofs,((seg<<4)+ofs)) diff --git a/src/mess/includes/mbee.h b/src/mess/includes/mbee.h deleted file mode 100644 index 53ea3282d37..00000000000 --- a/src/mess/includes/mbee.h +++ /dev/null @@ -1,171 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/***************************************************************************** - * - * includes/mbee.h - * - ****************************************************************************/ - -#ifndef MBEE_H_ -#define MBEE_H_ - -#include "emu.h" -#include "imagedev/snapquik.h" -#include "machine/z80pio.h" -#include "machine/8530scc.h" -#include "imagedev/cassette.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "machine/mc146818.h" -#include "video/mc6845.h" -#include "sound/speaker.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "sound/wave.h" -#include "machine/wd_fdc.h" - - -class mbee_state : public driver_device -{ -public: - enum - { - TIMER_MBEE_NEWKB - }; - - mbee_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_pio(*this, "z80pio") - , m_cassette(*this, "cassette") - , m_wave(*this, WAVE_TAG) - , m_speaker(*this, "speaker") - , m_centronics(*this, "centronics") - , m_cent_data_out(*this, "cent_data_out") - , m_crtc(*this, "crtc") - , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - , m_rtc(*this, "rtc") - , m_pak(*this, "pak") - , m_telcom(*this, "telcom") - , m_basic(*this, "basic") - , m_io_x7(*this, "X.7") - , m_io_oldkb(*this, "X") - , m_io_newkb(*this, "Y") - , m_io_config(*this, "CONFIG") - , m_screen(*this, "screen") - { } - - DECLARE_WRITE8_MEMBER(port04_w); - DECLARE_WRITE8_MEMBER(port06_w); - DECLARE_READ8_MEMBER(port07_r); - DECLARE_READ8_MEMBER(port08_r); - DECLARE_WRITE8_MEMBER(port08_w); - DECLARE_WRITE8_MEMBER(port0a_w); - DECLARE_WRITE8_MEMBER(port0b_w); - DECLARE_READ8_MEMBER(port18_r); - DECLARE_READ8_MEMBER(port1c_r); - DECLARE_WRITE8_MEMBER(port1c_w); - DECLARE_WRITE8_MEMBER(mbee128_50_w); - DECLARE_WRITE8_MEMBER(mbee256_50_w); - DECLARE_READ8_MEMBER(telcom_low_r); - DECLARE_READ8_MEMBER(telcom_high_r); - DECLARE_READ8_MEMBER(speed_low_r); - DECLARE_READ8_MEMBER(speed_high_r); - DECLARE_WRITE8_MEMBER(m6545_index_w); - DECLARE_WRITE8_MEMBER(m6545_data_w); - DECLARE_READ8_MEMBER(video_low_r); - DECLARE_READ8_MEMBER(video_high_r); - DECLARE_WRITE8_MEMBER(video_low_w); - DECLARE_WRITE8_MEMBER(video_high_w); - DECLARE_WRITE8_MEMBER(pio_port_b_w); - DECLARE_READ8_MEMBER(pio_port_b_r); - DECLARE_WRITE_LINE_MEMBER(pio_ardy); - DECLARE_WRITE_LINE_MEMBER(crtc_vs); - DECLARE_READ8_MEMBER(fdc_status_r); - DECLARE_WRITE8_MEMBER(fdc_motor_w); - DECLARE_DRIVER_INIT(mbeepc85); - DECLARE_DRIVER_INIT(mbee256); - DECLARE_DRIVER_INIT(mbee56); - DECLARE_DRIVER_INIT(mbeett); - DECLARE_DRIVER_INIT(mbeeppc); - DECLARE_DRIVER_INIT(mbee); - DECLARE_DRIVER_INIT(mbeepc); - DECLARE_DRIVER_INIT(mbeeic); - DECLARE_DRIVER_INIT(mbee128); - DECLARE_MACHINE_RESET(mbee); - DECLARE_VIDEO_START(mono); - DECLARE_VIDEO_START(standard); - DECLARE_VIDEO_START(premium); - DECLARE_PALETTE_INIT(standard); - DECLARE_PALETTE_INIT(premium); - DECLARE_MACHINE_RESET(mbee56); - DECLARE_MACHINE_RESET(mbee128); - DECLARE_MACHINE_RESET(mbee256); - DECLARE_MACHINE_RESET(mbeett); - UINT32 screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(timer_newkb); - DECLARE_QUICKLOAD_LOAD_MEMBER(mbee); - DECLARE_QUICKLOAD_LOAD_MEMBER(mbee_z80bin); - WRITE_LINE_MEMBER(rtc_irq_w); - WRITE_LINE_MEMBER(fdc_intrq_w); - WRITE_LINE_MEMBER(fdc_drq_w); - MC6845_UPDATE_ROW(crtc_update_row); - MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); - - required_device m_palette; -private: - UINT8 *m_p_videoram; - UINT8 *m_p_gfxram; - UINT8 *m_p_colorram; - UINT8 *m_p_attribram; - bool m_is_premium; - bool m_has_oldkb; - size_t m_size; - bool m_b7_rtc; - bool m_b7_vs; - bool m_b2; - UINT8 m_framecnt; - UINT8 m_08; - UINT8 m_0a; - UINT8 m_0b; - UINT8 m_1c; - UINT8 m_sy6545_cursor[16]; - UINT8 m_mbee256_was_pressed[15]; - UINT8 m_mbee256_q[20]; - UINT8 m_mbee256_q_pos; - UINT8 m_sy6545_reg[32]; - UINT8 m_sy6545_ind; - UINT8 m_fdc_rq; - UINT8 m_bank_array[33]; - void setup_banks(UINT8 data, bool first_time, UINT8 b_mask); - void sy6545_cursor_configure(); - void oldkb_scan(UINT16 param); - void oldkb_matrix_r(UINT16 offs); - void machine_reset_common(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - required_device m_maincpu; - required_device m_pio; - required_device m_cassette; - required_device m_wave; - required_device m_speaker; - required_device m_centronics; - required_device m_cent_data_out; - required_device m_crtc; - optional_device m_fdc; - optional_device m_floppy0; - optional_device m_floppy1; - optional_device m_rtc; - optional_memory_bank m_pak; - optional_memory_bank m_telcom; - optional_memory_bank m_basic; - optional_ioport m_io_x7; - optional_ioport_array<8> m_io_oldkb; - optional_ioport_array<15> m_io_newkb; - required_ioport m_io_config; - required_device m_screen; -}; - -#endif /* MBEE_H_ */ diff --git a/src/mess/includes/mboard.h b/src/mess/includes/mboard.h deleted file mode 100644 index b6e8c5028f4..00000000000 --- a/src/mess/includes/mboard.h +++ /dev/null @@ -1,122 +0,0 @@ -// license:??? -// copyright-holders:Ralf Schaefer, Cowering -/********************************************************************** - - Mephisto Chess Computers - -**********************************************************************/ - -#ifndef __MBOARD_H__ -#define __MBOARD_H__ - -/*************************************************************************** - MACROS -***************************************************************************/ - -enum -{ - EM, /*No piece*/ - BP, - BN, - BB, - BR, - BQ, - BK, - WP, - WN, - WB, - WR, - WQ, - WK -}; - -#define NOT_VALID 99 -#define BORDER_PIECE 64 - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -class mboard_state : public driver_device -{ -public: - mboard_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_line(*this, "LINE"), - m_line10(*this, "LINE10"), - m_b_white(*this, "B_WHITE"), - m_b_black(*this, "B_BLACK"), - m_b_buttons(*this, "B_BUTTONS"), - m_mouse_x(*this, "MOUSE_X"), - m_mouse_y(*this, "MOUSE_Y"), - m_button_l(*this, "BUTTON_L"), - m_button_r(*this, "BUTTON_R") - { } - - DECLARE_READ8_MEMBER(mboard_read_board_8); - DECLARE_WRITE8_MEMBER(mboard_write_board_8); - DECLARE_WRITE8_MEMBER(mboard_write_LED_8); - - DECLARE_READ16_MEMBER(mboard_read_board_16); - DECLARE_WRITE16_MEMBER(mboard_write_board_16); - DECLARE_WRITE16_MEMBER(mboard_write_LED_16); - - DECLARE_READ32_MEMBER(mboard_read_board_32); - DECLARE_WRITE32_MEMBER(mboard_write_board_32); - DECLARE_WRITE32_MEMBER(mboard_write_LED_32); - - TIMER_DEVICE_CALLBACK_MEMBER( mboard_update_artwork); - - void mboard_savestate_register(); - - void mboard_set_board(); - void mboard_set_border_pieces(); - - inline UINT8 pos_to_num(UINT8 val); - - UINT8 mboard_lcd_invert; - UINT8 mboard_key_select; - UINT8 mboard_key_selector; - - int get_first_cleared_bit(UINT8 data); -private: - static const int start_board[64]; - static UINT8 border_pieces[12]; - - int m_board[64]; - int save_board[64]; - UINT16 Line18_LED; - UINT16 Line18_REED; - - int mouse_hold_border_piece; - UINT8 mouse_hold_from; - UINT8 mouse_hold_piece; - - int read_board_flag; - int get_first_bit(UINT8 data); - UINT8 read_board(); - void write_board(UINT8 data); - void write_LED(UINT8 data); - void board_presave(); - void board_postload(); - void clear_board(); - void set_artwork(); - void check_board_buttons(); -public: - required_device m_maincpu; - required_ioport_array<8> m_line; - required_ioport m_line10; - required_ioport m_b_white; - required_ioport m_b_black; - required_ioport m_b_buttons; - required_ioport m_mouse_x; - required_ioport m_mouse_y; - required_ioport m_button_l; - required_ioport m_button_r; -}; - - - -#endif /* __MBOARD_H__ */ diff --git a/src/mess/includes/mc1000.h b/src/mess/includes/mc1000.h deleted file mode 100644 index b39932b290e..00000000000 --- a/src/mess/includes/mc1000.h +++ /dev/null @@ -1,120 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __MC1000__ -#define __MC1000__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "video/mc6845.h" -#include "video/mc6847.h" -#include "sound/ay8910.h" -#include "bus/centronics/ctronics.h" -#include "machine/rescap.h" -#include "machine/ram.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "u13" -#define AY8910_TAG "u21" -#define MC6845_TAG "mc6845" -#define MC6847_TAG "u19" -#define CENTRONICS_TAG "centronics" - -#define MC1000_MC6845_VIDEORAM_SIZE 0x800 -#define MC1000_MC6847_VIDEORAM_SIZE 0x1800 - -class mc1000_state : public driver_device -{ -public: - mc1000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_vdg(*this, MC6847_TAG), - m_crtc(*this, MC6845_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_rom(*this, Z80_TAG), - m_mc6845_video_ram(*this, "mc6845_vram"), - m_mc6847_video_ram(*this, "mc6847_vram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_joya(*this, "JOYA"), - m_joyb(*this, "JOYB"), - m_modifiers(*this, "MODIFIERS"), - m_joyakeymap(*this, "JOYAKEYMAP"), - m_joybkeymap(*this, "JOYBKEYMAP") - { } - - required_device m_maincpu; - required_device m_vdg; - optional_device m_crtc; - required_device m_centronics; - required_device m_cassette; - required_device m_ram; - required_memory_region m_rom; - required_shared_ptr m_mc6845_video_ram; - required_shared_ptr m_mc6847_video_ram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_joya; - required_ioport m_joyb; - required_ioport m_modifiers; - required_ioport m_joyakeymap; - required_ioport m_joybkeymap; - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( printer_r ); - DECLARE_WRITE8_MEMBER( printer_w ); - DECLARE_WRITE8_MEMBER( mc6845_ctrl_w ); - DECLARE_WRITE8_MEMBER( mc6847_attr_w ); - DECLARE_WRITE_LINE_MEMBER( fs_w ); - DECLARE_WRITE_LINE_MEMBER( hs_w ); - DECLARE_READ8_MEMBER( videoram_r ); - DECLARE_WRITE8_MEMBER( keylatch_w ); - DECLARE_READ8_MEMBER( keydata_r ); - DIRECT_UPDATE_MEMBER(mc1000_direct_update_handler); - - void bankswitch(); - - /* cpu state */ - int m_ne555_int; - - /* memory state */ - int m_rom0000; - int m_mc6845_bank; - int m_mc6847_bank; - - /* keyboard state */ - int m_keylatch; - - /* video state */ - int m_hsync; - int m_vsync; - UINT8 m_mc6847_attr; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - int m_centronics_busy; - - DECLARE_DRIVER_INIT(mc1000); - TIMER_DEVICE_CALLBACK_MEMBER(ne555_tick); -}; - -#endif diff --git a/src/mess/includes/mc1502.h b/src/mess/includes/mc1502.h deleted file mode 100644 index 28b38aca85e..00000000000 --- a/src/mess/includes/mc1502.h +++ /dev/null @@ -1,84 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/***************************************************************************** - * - * includes/mc1502.h - * - ****************************************************************************/ - -#ifndef MC1502_H_ -#define MC1502_H_ - -#include "imagedev/cassette.h" -#include "machine/i8251.h" -#include "machine/i8255.h" -#include "bus/isa/isa.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "bus/isa/xsu_cards.h" -#include "sound/speaker.h" -#include "bus/centronics/ctronics.h" - -class mc1502_state : public driver_device -{ -public: - mc1502_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_upd8251(*this, "upd8251"), - m_pic8259(*this, "pic8259"), - m_pit8253(*this, "pit8253"), - m_ppi8255n1(*this, "ppi8255n1"), - m_ppi8255n2(*this, "ppi8255n2"), - m_isabus(*this, "isa"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_centronics(*this, "centronics"), - m_ram(*this, RAM_TAG) { } - - required_device m_maincpu; - required_device m_upd8251; - required_device m_pic8259; - required_device m_pit8253; - required_device m_ppi8255n1; - required_device m_ppi8255n2; - required_device m_isabus; - required_device m_speaker; - required_device m_cassette; - required_device m_centronics; - required_device m_ram; - - DECLARE_DRIVER_INIT(mc1502); - DECLARE_MACHINE_START(mc1502); - DECLARE_MACHINE_RESET(mc1502); - - TIMER_CALLBACK_MEMBER(keyb_signal_callback); - - struct { - UINT8 pulsing; - UINT16 mask; /* input lines */ - emu_timer *keyb_signal_timer; - } m_kbd; - - UINT8 m_ppi_portb; - UINT8 m_ppi_portc; - UINT8 m_spkrdata; - - DECLARE_WRITE_LINE_MEMBER(mc1502_pit8253_out1_changed); - DECLARE_WRITE_LINE_MEMBER(mc1502_pit8253_out2_changed); - DECLARE_WRITE_LINE_MEMBER(mc1502_speaker_set_spkrdata); - DECLARE_WRITE_LINE_MEMBER(mc1502_i8251_syndet); - - DECLARE_WRITE8_MEMBER(mc1502_ppi_portb_w); - DECLARE_WRITE8_MEMBER(mc1502_ppi_portc_w); - DECLARE_READ8_MEMBER(mc1502_ppi_portc_r); - DECLARE_READ8_MEMBER(mc1502_kppi_porta_r); - DECLARE_WRITE8_MEMBER(mc1502_kppi_portb_w); - DECLARE_WRITE8_MEMBER(mc1502_kppi_portc_w); - -private: - int m_pit_out2; -}; - -#endif /* MC1502_H_ */ diff --git a/src/mess/includes/mc80.h b/src/mess/includes/mc80.h deleted file mode 100644 index 74699a2327c..00000000000 --- a/src/mess/includes/mc80.h +++ /dev/null @@ -1,57 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/mc80.h - * - ****************************************************************************/ - -#ifndef MC80_H_ -#define MC80_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" - -class mc80_state : public driver_device -{ -public: - mc80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_p_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu") { } - - DECLARE_WRITE8_MEMBER(mc8030_zve_write_protect_w); - DECLARE_WRITE8_MEMBER(mc8030_vis_w); - DECLARE_WRITE8_MEMBER(mc8030_eprom_prog_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); - DECLARE_READ8_MEMBER(mc80_port_b_r); - DECLARE_READ8_MEMBER(mc80_port_a_r); - DECLARE_WRITE8_MEMBER(mc80_port_a_w); - DECLARE_WRITE8_MEMBER(mc80_port_b_w); - DECLARE_READ8_MEMBER(zve_port_a_r); - DECLARE_READ8_MEMBER(zve_port_b_r); - DECLARE_WRITE8_MEMBER(zve_port_a_w); - DECLARE_WRITE8_MEMBER(zve_port_b_w); - DECLARE_READ8_MEMBER(asp_port_a_r); - DECLARE_READ8_MEMBER(asp_port_b_r); - DECLARE_WRITE8_MEMBER(asp_port_a_w); - DECLARE_WRITE8_MEMBER(asp_port_b_w); - optional_shared_ptr m_p_videoram; - DECLARE_MACHINE_RESET(mc8020); - DECLARE_VIDEO_START(mc8020); - DECLARE_MACHINE_RESET(mc8030); - DECLARE_VIDEO_START(mc8030); - UINT32 screen_update_mc8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_mc8030(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(mc8020_kbd); - DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); - IRQ_CALLBACK_MEMBER(mc8020_irq_callback); - IRQ_CALLBACK_MEMBER(mc8030_irq_callback); - required_device m_maincpu; -}; - -#endif diff --git a/src/mess/includes/md_cons.h b/src/mess/includes/md_cons.h deleted file mode 100644 index b2904a4134a..00000000000 --- a/src/mess/includes/md_cons.h +++ /dev/null @@ -1,49 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood - -#include "includes/megadriv.h" -#include "bus/megadrive/md_slot.h" -#include "bus/megadrive/md_carts.h" -#include "machine/mega32x.h" -#include "machine/megacd.h" - - -class md_cons_state : public md_base_state -{ -public: - md_cons_state(const machine_config &mconfig, device_type type, const char *tag) - : md_base_state(mconfig, type, tag), - m_32x(*this,"sega32x"), - m_segacd(*this,"segacd"), - m_cart(*this, "mdslot") - { } - - ioport_port *m_io_ctrlr; - ioport_port *m_io_pad3b[4]; - ioport_port *m_io_pad6b[2][4]; - - optional_device m_32x; - optional_device m_segacd; - optional_device m_cart; - - DECLARE_DRIVER_INIT(mess_md_common); - DECLARE_DRIVER_INIT(genesis); - DECLARE_DRIVER_INIT(md_eur); - DECLARE_DRIVER_INIT(md_jpn); - - READ8_MEMBER(mess_md_io_read_data_port); - WRITE16_MEMBER(mess_md_io_write_data_port); - - DECLARE_MACHINE_START( md_common ); // setup ioport_port - DECLARE_MACHINE_START( ms_megadriv ); // setup ioport_port + install cartslot handlers - DECLARE_MACHINE_START( ms_megacd ); // setup ioport_port + dma delay for cd - DECLARE_MACHINE_RESET( ms_megadriv ); - - void screen_eof_console(screen_device &screen, bool state); - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( _32x_cart ); - - void _32x_scanline_callback(int x, UINT32 priority, UINT16 &lineptr); - void _32x_interrupt_callback(int scanline, int irq6); - void _32x_scanline_helper_callback(int scanline); -}; diff --git a/src/mess/includes/micronic.h b/src/mess/includes/micronic.h deleted file mode 100644 index f55fe9bb586..00000000000 --- a/src/mess/includes/micronic.h +++ /dev/null @@ -1,98 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/***************************************************************************** - - includes/micronic.h - -*****************************************************************************/ - -#ifndef __MICRONIC__ -#define __MICRONIC__ - -#include "cpu/z80/z80.h" -#include "video/hd61830.h" -#include "machine/mc146818.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "sound/beep.h" -#include "imagedev/cassette.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "z80" -#define MC146818_TAG "mc146818" -#define HD61830_TAG "hd61830" - -class micronic_state : public driver_device -{ -public: - micronic_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_lcdc(*this, HD61830_TAG), - m_beep(*this, "beeper"), - m_rtc(*this, MC146818_TAG), - m_nvram1(*this, "nvram1"), - m_nvram2(*this, "nvram2"), - m_ram(*this, RAM_TAG), - m_ram_base(*this, "ram_base"), - m_status_flag(1), - m_bank1(*this, "bank1"), - m_bit0(*this, "BIT0"), - m_bit1(*this, "BIT1"), - m_bit2(*this, "BIT2"), - m_bit3(*this, "BIT3"), - m_bit4(*this, "BIT4"), - m_bit5(*this, "BIT5"), - m_backbattery(*this, "BACKBATTERY"), - m_mainbattery(*this, "MAINBATTERY"), - m_cassette(*this, "cassette") - { } - - required_device m_maincpu; - required_device m_lcdc; - required_device m_beep; - required_device m_rtc; - required_device m_nvram1; - required_device m_nvram2; - required_device m_ram; - - virtual void machine_start(); - virtual void machine_reset(); - void nvram_init(nvram_device &nvram, void *data, size_t size); - - DECLARE_READ8_MEMBER( keypad_r ); - DECLARE_READ8_MEMBER( status_flag_r ); - DECLARE_WRITE8_MEMBER( status_flag_w ); - DECLARE_WRITE8_MEMBER( kp_matrix_w ); - DECLARE_WRITE8_MEMBER( beep_w ); - DECLARE_READ8_MEMBER( irq_flag_r ); - DECLARE_WRITE8_MEMBER( port_2c_w ); - DECLARE_WRITE8_MEMBER( bank_select_w ); - DECLARE_WRITE8_MEMBER( lcd_contrast_w ); - DECLARE_WRITE8_MEMBER( rtc_address_w ); - DECLARE_READ8_MEMBER( rtc_data_r ); - DECLARE_WRITE8_MEMBER( rtc_data_w ); - DECLARE_WRITE_LINE_MEMBER( mc146818_irq ); - - required_shared_ptr m_ram_base; - UINT8 m_banks_num; - UINT8 m_kp_matrix; - UINT8 m_lcd_contrast; - int m_lcd_backlight; - UINT8 m_status_flag; - DECLARE_PALETTE_INIT(micronic); - -protected: - required_memory_bank m_bank1; - required_ioport m_bit0; - required_ioport m_bit1; - required_ioport m_bit2; - required_ioport m_bit3; - required_ioport m_bit4; - required_ioport m_bit5; - required_ioport m_backbattery; - required_ioport m_mainbattery; - optional_device m_cassette; -}; - -#endif diff --git a/src/mess/includes/microtan.h b/src/mess/includes/microtan.h deleted file mode 100644 index 29640649763..00000000000 --- a/src/mess/includes/microtan.h +++ /dev/null @@ -1,103 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/****************************************************************************** - * Microtan 65 - * - * variables and function prototypes - * - * Juergen Buchmueller , Jul 2000 - * - * Thanks go to Geoff Macdonald - * for his site http://www.geo255.redhotant.com - * and to Fabrice Frances - * for his site http://www.ifrance.com/oric/microtan.html - * - ******************************************************************************/ - -#ifndef MICROTAN_H_ -#define MICROTAN_H_ - -#include "imagedev/snapquik.h" -#include "machine/6522via.h" -#include "imagedev/cassette.h" - -class microtan_state : public driver_device -{ -public: - enum - { - TIMER_READ_CASSETTE, - TIMER_PULSE_NMI - }; - - microtan_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_via6522_0(*this, "via6522_0"), - m_via6522_1(*this, "via6522_1"), - m_gfxdecode(*this, "gfxdecode") - { } - - required_shared_ptr m_videoram; - UINT8 m_chunky_graphics; - UINT8 *m_chunky_buffer; - UINT8 m_keypad_column; - UINT8 m_keyboard_ascii; - emu_timer *m_timer; - int m_via_0_irq_line; - int m_via_1_irq_line; - int m_kbd_irq_line; - UINT8 m_keyrows[10]; - int m_lastrow; - int m_mask; - int m_key; - int m_repeat; - int m_repeater; - tilemap_t *m_bg_tilemap; - DECLARE_READ8_MEMBER(microtan_sound_r); - DECLARE_WRITE8_MEMBER(microtan_sound_w); - DECLARE_READ8_MEMBER(microtan_bffx_r); - DECLARE_WRITE8_MEMBER(microtan_bffx_w); - DECLARE_WRITE8_MEMBER(microtan_videoram_w); - DECLARE_DRIVER_INIT(microtan); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_microtan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(microtan_interrupt); - TIMER_CALLBACK_MEMBER(microtan_read_cassette); - TIMER_CALLBACK_MEMBER(microtan_pulse_nmi); - DECLARE_READ8_MEMBER(via_0_in_a); - DECLARE_WRITE8_MEMBER(via_0_out_a); - DECLARE_WRITE8_MEMBER(via_0_out_b); - DECLARE_WRITE_LINE_MEMBER(via_0_out_ca2); - DECLARE_WRITE_LINE_MEMBER(via_0_out_cb2); - DECLARE_WRITE8_MEMBER(via_1_out_a); - DECLARE_WRITE8_MEMBER(via_1_out_b); - DECLARE_WRITE_LINE_MEMBER(via_1_out_ca2); - DECLARE_WRITE_LINE_MEMBER(via_1_out_cb2); - DECLARE_WRITE_LINE_MEMBER(via_0_irq); - DECLARE_WRITE_LINE_MEMBER(via_1_irq); - required_device m_maincpu; - required_device m_cassette; - required_device m_via6522_0; - required_device m_via6522_1; - required_device m_gfxdecode; - UINT8 read_dsw(); - void microtan_set_irq_line(); - void store_key(int key); - int microtan_verify_snapshot(UINT8 *data, int size); - int parse_intel_hex(UINT8 *snapshot_buff, char *src); - int parse_zillion_hex(UINT8 *snapshot_buff, char *src); - void microtan_set_cpu_regs(const UINT8 *snapshot_buff, int base); - void microtan_snapshot_copy(UINT8 *snapshot_buff, int snapshot_size); - DECLARE_SNAPSHOT_LOAD_MEMBER( microtan ); - DECLARE_QUICKLOAD_LOAD_MEMBER( microtan ); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* MICROTAN_H_ */ diff --git a/src/mess/includes/mikro80.h b/src/mess/includes/mikro80.h deleted file mode 100644 index 99ca55e3692..00000000000 --- a/src/mess/includes/mikro80.h +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/mikro80.h - * - ****************************************************************************/ - -#ifndef MIKRO80_H_ -#define MIKRO80_H_ - -#include "machine/i8255.h" -#include "imagedev/cassette.h" - -class mikro80_state : public driver_device -{ -public: - enum - { - TIMER_RESET - }; - - mikro80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cursor_ram(*this, "cursor_ram"), - m_video_ram(*this, "video_ram"), - m_ppi8255(*this, "ppi8255"), - m_cassette(*this, "cassette"), - m_region_maincpu(*this, "maincpu"), - m_region_gfx1(*this, "gfx1"), - m_bank1(*this, "bank1"), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_line4(*this, "LINE4"), - m_io_line5(*this, "LINE5"), - m_io_line6(*this, "LINE6"), - m_io_line7(*this, "LINE7"), - m_io_line8(*this, "LINE8") , - m_maincpu(*this, "maincpu") { } - - required_shared_ptr m_cursor_ram; - required_shared_ptr m_video_ram; - int m_keyboard_mask; - int m_key_mask; - DECLARE_READ8_MEMBER(mikro80_8255_portb_r); - DECLARE_READ8_MEMBER(mikro80_8255_portc_r); - DECLARE_WRITE8_MEMBER(mikro80_8255_porta_w); - DECLARE_WRITE8_MEMBER(mikro80_8255_portc_w); - DECLARE_READ8_MEMBER(mikro80_keyboard_r); - DECLARE_WRITE8_MEMBER(mikro80_keyboard_w); - DECLARE_WRITE8_MEMBER(mikro80_tape_w); - DECLARE_READ8_MEMBER(mikro80_tape_r); - DECLARE_DRIVER_INIT(radio99); - DECLARE_DRIVER_INIT(mikro80); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_mikro80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - required_device m_ppi8255; - required_device m_cassette; - required_memory_region m_region_maincpu; - required_memory_region m_region_gfx1; - required_memory_bank m_bank1; - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - required_ioport m_io_line3; - required_ioport m_io_line4; - required_ioport m_io_line5; - required_ioport m_io_line6; - required_ioport m_io_line7; - required_ioport m_io_line8; - required_device m_maincpu; -}; - -#endif /* UT88_H_ */ diff --git a/src/mess/includes/mikromik.h b/src/mess/includes/mikromik.h deleted file mode 100644 index 3565d77e8de..00000000000 --- a/src/mess/includes/mikromik.h +++ /dev/null @@ -1,138 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __MIKROMIKKO__ -#define __MIKROMIKKO__ - -#include "bus/rs232/rs232.h" -#include "cpu/i8085/i8085.h" -#include "formats/mm_dsk.h" -#include "machine/am9517a.h" -#include "machine/i8212.h" -#include "machine/mm1kb.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "machine/z80dart.h" -#include "machine/upd765.h" -#include "video/i8275.h" -#include "video/upd7220.h" - -#define SCREEN_TAG "screen" -#define I8085A_TAG "ic40" -#define I8212_TAG "ic12" -#define I8237_TAG "ic45" -#define I8253_TAG "ic6" -#define UPD765_TAG "ic15" -#define I8275_TAG "ic59" -#define UPD7201_TAG "ic11" -#define UPD7220_TAG "ic101" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" -#define RS232_C_TAG "rs232c" -#define KB_TAG "kb" - -class mm1_state : public driver_device -{ -public: - mm1_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, I8085A_TAG), - m_iop(*this, I8212_TAG), - m_dmac(*this, I8237_TAG), - m_pit(*this, I8253_TAG), - m_crtc(*this, I8275_TAG), - m_fdc(*this, UPD765_TAG), - m_mpsc(*this, UPD7201_TAG), - m_hgdc(*this, UPD7220_TAG), - m_palette(*this, "palette"), - m_floppy0(*this, UPD765_TAG ":0:525qd"), - m_floppy1(*this, UPD765_TAG ":1:525qd"), - m_rs232a(*this, RS232_A_TAG), - m_rs232b(*this, RS232_B_TAG), - m_rs232c(*this, RS232_C_TAG), - m_ram(*this, RAM_TAG), - m_rom(*this, I8085A_TAG), - m_mmu_rom(*this, "address"), - m_char_rom(*this, "chargen"), - m_video_ram(*this, "video_ram"), - m_a8(0), - m_recall(0), - m_dack3(1), - m_tc(CLEAR_LINE), - m_fdc_tc(0) - { } - - required_device m_maincpu; - required_device m_iop; - required_device m_dmac; - required_device m_pit; - required_device m_crtc; - required_device m_fdc; - required_device m_mpsc; - required_device m_hgdc; - required_device m_palette; - required_device m_floppy0; - required_device m_floppy1; - required_device m_rs232a; - required_device m_rs232b; - required_device m_rs232c; - required_device m_ram; - required_memory_region m_rom; - required_memory_region m_mmu_rom; - required_memory_region m_char_rom; - required_shared_ptr m_video_ram; - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_WRITE8_MEMBER( ls259_w ); - DECLARE_WRITE_LINE_MEMBER( dma_hrq_w ); - DECLARE_READ8_MEMBER( mpsc_dack_r ); - DECLARE_WRITE8_MEMBER( mpsc_dack_w ); - DECLARE_WRITE_LINE_MEMBER( dma_eop_w ); - DECLARE_WRITE_LINE_MEMBER( dack3_w ); - DECLARE_WRITE_LINE_MEMBER( itxc_w ); - DECLARE_WRITE_LINE_MEMBER( irxc_w ); - DECLARE_WRITE_LINE_MEMBER( auxc_w ); - DECLARE_WRITE_LINE_MEMBER( drq2_w ); - DECLARE_WRITE_LINE_MEMBER( drq1_w ); - DECLARE_READ_LINE_MEMBER( dsra_r ); - - void update_tc(); - void fdc_intrq_w(bool state); - void fdc_drq_w(bool state); - - int m_a8; - - // video state - int m_llen; - - // serial state - int m_intc; - int m_rx21; - int m_tx21; - int m_rcl; - - // floppy state - int m_recall; - int m_dack3; - int m_tc; - int m_fdc_tc; - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); - UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); -}; - - -//----------- defined in video/mikromik.c ----------- - -MACHINE_CONFIG_EXTERN( mm1m6_video ); - - -#endif diff --git a/src/mess/includes/mpf1.h b/src/mess/includes/mpf1.h deleted file mode 100644 index e4d6a19b628..00000000000 --- a/src/mess/includes/mpf1.h +++ /dev/null @@ -1,78 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Curt Coder -#pragma once - -#ifndef __MPF1__ -#define __MPF1__ - - -#include "emu.h" -#include "machine/spchrom.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "imagedev/cassette.h" -#include "machine/i8255.h" -#include "machine/z80ctc.h" -#include "machine/z80pio.h" -#include "sound/speaker.h" -#include "sound/tms5220.h" - -#define Z80_TAG "u1" -#define Z80CTC_TAG "u11" -#define Z80PIO_TAG "u10" -#define I8255A_TAG "u14" -#define TMS5220_TAG "tms5220" - -class mpf1_state : public driver_device -{ -public: - mpf1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ctc(*this, Z80CTC_TAG), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_pc0(*this, "PC0"), - m_pc1(*this, "PC1"), - m_pc2(*this, "PC2"), - m_pc3(*this, "PC3"), - m_pc4(*this, "PC4"), - m_pc5(*this, "PC5"), - m_special(*this, "SPECIAL") - { } - - required_device m_maincpu; - required_device m_ctc; - required_device m_speaker; - required_device m_cassette; - required_ioport m_pc0; - required_ioport m_pc1; - required_ioport m_pc2; - required_ioport m_pc3; - required_ioport m_pc4; - required_ioport m_pc5; - required_ioport m_special; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( ppi_pa_r ); - DECLARE_WRITE8_MEMBER( ppi_pb_w ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_irq ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_res ); - DECLARE_DIRECT_UPDATE_MEMBER(mpf1_direct_update_handler); - - int m_break; - int m_m1; - - UINT8 m_lednum; - - emu_timer *m_led_refresh_timer; - DECLARE_DRIVER_INIT(mpf1); - TIMER_CALLBACK_MEMBER(led_refresh); - TIMER_DEVICE_CALLBACK_MEMBER(check_halt_callback); -}; - -#endif diff --git a/src/mess/includes/mpz80.h b/src/mess/includes/mpz80.h deleted file mode 100644 index 8802273b5a3..00000000000 --- a/src/mess/includes/mpz80.h +++ /dev/null @@ -1,99 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __MPZ80__ -#define __MPZ80__ - -#include "emu.h" -#include "bus/s100/s100.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" - -#define Z80_TAG "17a" -#define AM9512_TAG "17d" - -class mpz80_state : public driver_device -{ -public: - mpz80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ram(*this, RAM_TAG), - m_s100(*this, S100_TAG), - m_rom(*this, Z80_TAG), - m_map_ram(*this, "map_ram"), - m_16c(*this, "16C"), - m_nmi(1), - m_pint(1), - m_int_pend(0), - m_pretrap(0), - m_trap(0), - m_trap_reset(0), - m_trap_void(1), - m_trap_halt(1), - m_trap_int(1), - m_trap_stop(1), - m_trap_aux(1) - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_s100; - required_memory_region m_rom; - optional_shared_ptr m_map_ram; - required_ioport m_16c; - - virtual void machine_start(); - virtual void machine_reset(); - - inline offs_t get_address(offs_t offset); - inline offs_t get_io_address(offs_t offset); - - inline void check_traps(); - inline void check_interrupt(); - - DECLARE_READ8_MEMBER( mmu_r ); - DECLARE_WRITE8_MEMBER( mmu_w ); - DECLARE_READ8_MEMBER( mmu_io_r ); - DECLARE_WRITE8_MEMBER( mmu_io_w ); - DECLARE_READ8_MEMBER( trap_addr_r ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_READ8_MEMBER( switch_r ); - DECLARE_READ8_MEMBER( status_r ); - DECLARE_WRITE8_MEMBER( disp_seg_w ); - DECLARE_WRITE8_MEMBER( disp_col_w ); - DECLARE_WRITE8_MEMBER( task_w ); - DECLARE_WRITE8_MEMBER( mask_w ); - DECLARE_WRITE8_MEMBER( terminal_w ); - DECLARE_WRITE_LINE_MEMBER( s100_pint_w ); - DECLARE_WRITE_LINE_MEMBER( s100_nmi_w ); - DECLARE_DIRECT_UPDATE_MEMBER(mpz80_direct_update_handler); - - // memory state - UINT32 m_addr; - UINT8 m_task; - UINT8 m_mask; - - // interrupt state - int m_nmi; - int m_pint; - int m_int_pend; - - // trap state - UINT8 m_pretrap_addr; - UINT8 m_trap_addr; - UINT8 m_status; - UINT16 m_trap_start; - int m_pretrap; - int m_trap; - int m_trap_reset; - int m_trap_void; - int m_trap_halt; - int m_trap_int; - int m_trap_stop; - int m_trap_aux; - DECLARE_DRIVER_INIT(mpz80); -}; - -#endif diff --git a/src/mess/includes/msbc1.h b/src/mess/includes/msbc1.h deleted file mode 100644 index 870e0d65167..00000000000 --- a/src/mess/includes/msbc1.h +++ /dev/null @@ -1,28 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Curt Coder -#pragma once - -#ifndef __MSBC1__ -#define __MSBC1__ - -#define MC68000R12_TAG "u50" -#define MK68564_0_TAG "u14" -#define MK68564_1_TAG "u15" -#define MC68230L10_TAG "u16" - -class msbc1_state : public driver_device -{ -public: - msbc1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,MC68000R12_TAG) - { - } - - virtual void machine_reset(); - -private: - required_device m_maincpu; -}; - -#endif diff --git a/src/mess/includes/msx.h b/src/mess/includes/msx.h deleted file mode 100644 index d849693ec14..00000000000 --- a/src/mess/includes/msx.h +++ /dev/null @@ -1,265 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/***************************************************************************** - * - * includes/msx.h - * - ****************************************************************************/ - -#ifndef __MSX_H__ -#define __MSX_H__ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/rp5c01.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "sound/ay8910.h" -#include "sound/dac.h" -#include "sound/wave.h" -#include "sound/2413intf.h" -#include "video/v9938.h" -#include "video/tms9928a.h" -#include "imagedev/flopdrv.h" -#include "imagedev/cassette.h" -#include "formats/fmsx_cas.h" -#include "formats/msx_dsk.h" -#include "hashfile.h" -#include "machine/wd_fdc.h" -#include "imagedev/floppy.h" -#include "bus/msx_slot/slot.h" -#include "bus/msx_slot/rom.h" -#include "bus/msx_slot/ram.h" -#include "bus/msx_slot/cartridge.h" -#include "bus/msx_slot/ram_mm.h" -#include "bus/msx_slot/disk.h" -#include "bus/msx_slot/music.h" -#include "bus/msx_slot/bunsetsu.h" -#include "bus/msx_slot/fs4600.h" -#include "bus/msx_slot/panasonic08.h" -#include "bus/msx_slot/sony08.h" - - -#define TC8521_TAG "rtc" - -#define MCFG_MSX_LAYOUT_ROM(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_ROM_ADD(_tag, _page, _numpages, _region, _offset) \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_RAM(_tag, _prim, _sec, _page, _numpages) \ - MCFG_MSX_SLOT_RAM_ADD(_tag, _page, _numpages) \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_CARTRIDGE(_tag, _prim, _sec) \ - MCFG_MSX_SLOT_CARTRIDGE_ADD(_tag, WRITELINE(msx_state, msx_irq_source1)) \ - msx_state::install_slot_pages(*owner, _prim, _sec, 0, 4, device); - -#define MCFG_MSX_LAYOUT_YAMAHA_EXPANSION(_tag, _prim, _sec, _default) \ - MCFG_MSX_SLOT_YAMAHA_EXPANSION_ADD(_tag, WRITELINE(msx_state, msx_irq_source2), _default) \ - msx_state::install_slot_pages(*owner, _prim, _sec, 0, 4, device); - -#define MCFG_MSX_LAYOUT_RAM_MM(_tag, _prim, _sec, _total_size) \ - MCFG_MSX_SLOT_RAM_MM_ADD(_tag, _total_size) \ - msx_state::install_slot_pages(*owner, _prim, _sec, 0, 4, device); - -#define MCFG_MSX_RAMIO_SET_BITS(_ramio_set_bits) \ - MCFG_MSX_SLOT_RAMM_SET_RAMIO_BITS(_ramio_set_bits) - -#define MCFG_MSX_LAYOUT_DISK1(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_DISK1_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages + 1, device); /* Memory mapped FDC registers are also accessible through page 2 */ - -#define MCFG_MSX_LAYOUT_DISK2(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_DISK2_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages + 1, device); /* Memory mapped FDC registers are also accessible through page 2 */ - -#define MCFG_MSX_LAYOUT_DISK3(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_DISK3_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_DISK4(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_DISK4_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_DISK5(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_DISK5_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1", "fdc:2", "fdc:3") \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_DISK6(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_DISK6_ADD(_tag, _page, _numpages, _region, _offset, "fdc", "fdc:0", "fdc:1") \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_MUSIC(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_MUSIC_ADD(_tag, _page, _numpages, _region, _offset, "ym2413" ) \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_BUNSETSU(_tag, _prim, _sec, _page, _numpages, _region, _offset, _bunsetsu_tag) \ - MCFG_MSX_SLOT_BUNSETSU_ADD(_tag, _page, _numpages, _region, _offset, _bunsetsu_tag) \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_FS4600(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_FS4600_ADD(_tag, _page, _numpages, _region, _offset) \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_PANASONIC08(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_PANASONIC08_ADD(_tag, _page, _numpages, _region, _offset) \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - -#define MCFG_MSX_LAYOUT_SONY08(_tag, _prim, _sec, _page, _numpages, _region, _offset) \ - MCFG_MSX_SLOT_SONY08_ADD(_tag, _page, _numpages, _region, _offset) \ - msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device); - - -class msx_state : public driver_device -{ -public: - msx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_v9938(*this, "v9938") - , m_v9958(*this, "v9958") - , m_cassette(*this, "cassette") - , m_ay8910(*this, "ay8910") - , m_dac(*this, "dac") - , m_rtc(*this, TC8521_TAG) - , m_switched_device_as_config("switched_device", ENDIANNESS_LITTLE, 8, 16, 0, address_map_delegate(FUNC(msx_state::switched_device_map), this)) - , m_region_maincpu(*this, "maincpu") - , m_region_kanji(*this, "kanji") - , m_io_joy0(*this, "JOY0") - , m_io_joy1(*this, "JOY1") - , m_io_dsw(*this, "DSW") - , m_io_mouse0(*this, "MOUSE0") - , m_io_mouse1(*this, "MOUSE1") - , m_io_key0(*this, "KEY0") - , m_io_key1(*this, "KEY1") - , m_io_key2(*this, "KEY2") - , m_io_key3(*this, "KEY3") - , m_io_key4(*this, "KEY4") - , m_io_key5(*this, "KEY5") - , m_psg_b(0) - , m_rtc_latch(0) - , m_kanji_latch(0) - , m_primary_slot(0) - , m_port_c_old(0) - , m_keylatch(0) - , m_current_switched_device(0) - { - for (int prim = 0; prim < 4; prim++ ) - { - m_slot_expanded[prim] = false; - m_secondary_slot[prim] = 0; - for (int sec = 0; sec < 4; sec++ ) - { - for (int page = 0; page < 4; page++ ) - { - m_all_slots[prim][sec][page] = NULL; - } - } - } - m_mouse[0] = m_mouse[1] = 0; - m_mouse_stat[0] = m_mouse_stat[1] = 0; - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) - { - m_irq_state[i] = CLEAR_LINE; - } - } - - // static configuration helpers - static void install_slot_pages(device_t &owner, UINT8 prim, UINT8 sec, UINT8 page, UINT8 numpages, device_t *device); - - virtual void driver_start(); - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_ADDRESS_MAP(switched_device_map, 8); - DECLARE_WRITE8_MEMBER(msx_sec_slot_w); - DECLARE_READ8_MEMBER(msx_sec_slot_r); - DECLARE_READ8_MEMBER(msx_kanji_r); - DECLARE_WRITE8_MEMBER(msx_kanji_w); - DECLARE_WRITE8_MEMBER(msx_ppi_port_a_w); - DECLARE_WRITE8_MEMBER(msx_ppi_port_c_w); - DECLARE_READ8_MEMBER(msx_ppi_port_b_r); - DECLARE_READ8_MEMBER(msx_rtc_reg_r); - DECLARE_WRITE8_MEMBER(msx_rtc_reg_w); - DECLARE_WRITE8_MEMBER(msx_rtc_latch_w); - DECLARE_READ8_MEMBER(msx_mem_read); - DECLARE_WRITE8_MEMBER(msx_mem_write); - DECLARE_READ8_MEMBER(msx_switched_r); - DECLARE_WRITE8_MEMBER(msx_switched_w); - DECLARE_WRITE_LINE_MEMBER(turbo_w); - - void msx_memory_map_all(); - void msx_memory_map_page(UINT8 page); - void msx_memory_reset(); - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - DECLARE_READ8_MEMBER(msx_psg_port_a_r); - DECLARE_READ8_MEMBER(msx_psg_port_b_r); - DECLARE_WRITE8_MEMBER(msx_psg_port_a_w); - DECLARE_WRITE8_MEMBER(msx_psg_port_b_w); - INTERRUPT_GEN_MEMBER(msx_interrupt); - DECLARE_WRITE8_MEMBER(msx_ay8910_w); - void msx_memory_init(); - void post_load(); - - DECLARE_WRITE_LINE_MEMBER(msx_irq_source0) { msx_irq_source(0, state); } // usually tms9918/v9938/v9958 - DECLARE_WRITE_LINE_MEMBER(msx_irq_source1) { msx_irq_source(1, state); } // usually first cartridge slot - DECLARE_WRITE_LINE_MEMBER(msx_irq_source2) { msx_irq_source(2, state); } // usually second cartridge slot - DECLARE_WRITE_LINE_MEMBER(msx_irq_source3) { msx_irq_source(3, state); } // sometimes expansion slot - -protected: - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == 0) ? &m_switched_device_as_config : NULL; } - -private: - required_device m_maincpu; - optional_device m_v9938; - optional_device m_v9958; - required_device m_cassette; - required_device m_ay8910; - required_device m_dac; - optional_device m_rtc; - address_space_config m_switched_device_as_config; - required_memory_region m_region_maincpu; - optional_memory_region m_region_kanji; - required_ioport m_io_joy0; - required_ioport m_io_joy1; - required_ioport m_io_dsw; - required_ioport m_io_mouse0; - required_ioport m_io_mouse1; - required_ioport m_io_key0; - required_ioport m_io_key1; - required_ioport m_io_key2; - required_ioport m_io_key3; - required_ioport m_io_key4; - required_ioport m_io_key5; - - /* PSG */ - int m_psg_b; - /* mouse */ - UINT16 m_mouse[2]; - int m_mouse_stat[2]; - /* rtc */ - int m_rtc_latch; - /* kanji */ - int m_kanji_latch; - /* memory */ - msx_internal_slot_interface m_empty_slot; - msx_internal_slot_interface *m_all_slots[4][4][4]; - msx_internal_slot_interface *m_current_page[4]; - bool m_slot_expanded[4]; - UINT8 m_primary_slot; - UINT8 m_secondary_slot[4]; - int m_port_c_old; - int m_keylatch; - UINT8 m_current_switched_device; - - int m_irq_state[4]; - - void msx_irq_source(int source, int level); - void check_irq(); -}; - - -#endif /* __MSX_H__ */ diff --git a/src/mess/includes/mtx.h b/src/mess/includes/mtx.h deleted file mode 100644 index 5558e1fcd15..00000000000 --- a/src/mess/includes/mtx.h +++ /dev/null @@ -1,99 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Lee Ward, Dirk Best, Curt Coder -/************************************************************************* - - Memotech MTX 500, MTX 512 and RS 128 - -*************************************************************************/ - -#ifndef __MTX__ -#define __MTX__ - -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "machine/z80dart.h" -#include "machine/z80ctc.h" -#include "sound/sn76496.h" -#include "machine/ram.h" - -#define Z80_TAG "z80" -#define Z80CTC_TAG "z80ctc" -#define Z80DART_TAG "z80dart" -#define FD1793_TAG "fd1793" // SDX -#define FD1791_TAG "fd1791" // FDX -#define SN76489A_TAG "sn76489a" -#define MC6845_TAG "mc6845" -#define SCREEN_TAG "screen" -#define CENTRONICS_TAG "centronics" - -class mtx_state : public driver_device -{ -public: - mtx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_sn(*this, SN76489A_TAG), - m_z80ctc(*this, Z80CTC_TAG), - m_z80dart(*this, Z80DART_TAG), - m_cassette(*this, "cassette"), - m_centronics(*this, CENTRONICS_TAG), - m_ram(*this, RAM_TAG) - { } - - required_device m_maincpu; - required_device m_sn; - required_device m_z80ctc; - optional_device m_z80dart; - required_device m_cassette; - required_device m_centronics; - required_device m_ram; - - /* keyboard state */ - UINT8 m_key_sense; - - /* video state */ - UINT8 *m_video_ram; - UINT8 *m_attr_ram; - - /* sound state */ - UINT8 m_sound_latch; - - /* timers */ - device_t *m_cassette_timer; - - int m_centronics_busy; - int m_centronics_fault; - int m_centronics_perror; - int m_centronics_select; - - DECLARE_WRITE8_MEMBER(mtx_bankswitch_w); - DECLARE_WRITE8_MEMBER(mtx_sound_latch_w); - DECLARE_WRITE8_MEMBER(mtx_sense_w); - DECLARE_READ8_MEMBER(mtx_key_lo_r); - DECLARE_READ8_MEMBER(mtx_key_hi_r); - DECLARE_WRITE8_MEMBER(hrx_address_w); - DECLARE_READ8_MEMBER(hrx_data_r); - DECLARE_WRITE8_MEMBER(hrx_data_w); - DECLARE_READ8_MEMBER(hrx_attr_r); - DECLARE_WRITE8_MEMBER(hrx_attr_w); - DECLARE_MACHINE_START(mtx512); - DECLARE_MACHINE_RESET(mtx512); - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); - TIMER_DEVICE_CALLBACK_MEMBER(cassette_tick); - DECLARE_WRITE_LINE_MEMBER(ctc_trg1_w); - DECLARE_WRITE_LINE_MEMBER(ctc_trg2_w); - DECLARE_WRITE_LINE_MEMBER(mtx_tms9929a_interrupt); - DECLARE_READ8_MEMBER(mtx_strobe_r); - DECLARE_READ8_MEMBER(mtx_sound_strobe_r); - DECLARE_WRITE8_MEMBER(mtx_cst_w); - DECLARE_READ8_MEMBER(mtx_prt_r); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - DECLARE_WRITE_LINE_MEMBER(write_centronics_select); - void bankswitch(UINT8 data); - DECLARE_SNAPSHOT_LOAD_MEMBER( mtx ); -}; - -#endif /* __MTX_H__ */ diff --git a/src/mess/includes/mz700.h b/src/mess/includes/mz700.h deleted file mode 100644 index 6558180dbbd..00000000000 --- a/src/mess/includes/mz700.h +++ /dev/null @@ -1,119 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Dirk Best -/****************************************************************************** - * Sharp MZ700 - * - * Reference: http://sharpmz.computingmuseum.com - * - ******************************************************************************/ - -#ifndef MZ700_H_ -#define MZ700_H_ - -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/z80pio.h" -#include "sound/speaker.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "machine/ram.h" - -class mz_state : public driver_device -{ -public: - mz_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_pit(*this, "pit8253"), - m_ppi(*this, "ppi8255"), - m_cassette(*this, "cassette"), - m_centronics(*this, "centronics"), - m_ram(*this, RAM_TAG), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - int m_mz700; /* 1 if running on an mz700 */ - - int m_cursor_timer; - int m_other_timer; - - int m_intmsk; /* PPI8255 pin PC2 */ - - int m_mz700_ram_lock; /* 1 if ram lock is active */ - int m_mz700_ram_vram; /* 1 if vram is banked in */ - - /* mz800 specific */ - UINT8 *m_cgram; - - int m_mz700_mode; /* 1 if in mz700 mode */ - int m_mz800_ram_lock; /* 1 if lock is active */ - int m_mz800_ram_monitor; /* 1 if monitor rom banked in */ - - int m_hires_mode; /* 1 if in 640x200 mode */ - int m_screennum; /* screen designation */ - - int m_centronics_busy; - int m_centronics_perror; - - UINT8 *m_colorram; - UINT8 *m_videoram; - UINT8 m_speaker_level; - UINT8 m_prev_state; - UINT16 m_mz800_ramaddr; - UINT8 m_mz800_palette[4]; - UINT8 m_mz800_palette_bank; - DECLARE_READ8_MEMBER(mz700_e008_r); - DECLARE_WRITE8_MEMBER(mz700_e008_w); - DECLARE_READ8_MEMBER(mz800_bank_0_r); - DECLARE_WRITE8_MEMBER(mz700_bank_0_w); - DECLARE_WRITE8_MEMBER(mz800_bank_0_w); - DECLARE_READ8_MEMBER(mz800_bank_1_r); - DECLARE_WRITE8_MEMBER(mz700_bank_1_w); - DECLARE_WRITE8_MEMBER(mz700_bank_2_w); - DECLARE_WRITE8_MEMBER(mz700_bank_3_w); - DECLARE_WRITE8_MEMBER(mz700_bank_4_w); - DECLARE_WRITE8_MEMBER(mz700_bank_5_w); - DECLARE_WRITE8_MEMBER(mz700_bank_6_w); - DECLARE_READ8_MEMBER(mz800_crtc_r); - DECLARE_WRITE8_MEMBER(mz800_write_format_w); - DECLARE_WRITE8_MEMBER(mz800_read_format_w); - DECLARE_WRITE8_MEMBER(mz800_display_mode_w); - DECLARE_WRITE8_MEMBER(mz800_scroll_border_w); - DECLARE_READ8_MEMBER(mz800_ramdisk_r); - DECLARE_WRITE8_MEMBER(mz800_ramdisk_w); - DECLARE_WRITE8_MEMBER(mz800_ramaddr_w); - DECLARE_WRITE8_MEMBER(mz800_palette_w); - DECLARE_WRITE8_MEMBER(mz800_cgram_w); - DECLARE_DRIVER_INIT(mz800); - DECLARE_DRIVER_INIT(mz700); - virtual void machine_start(); - DECLARE_PALETTE_INIT(mz); - DECLARE_VIDEO_START(mz800); - UINT32 screen_update_mz700(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_mz800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(ne556_cursor_callback); - TIMER_DEVICE_CALLBACK_MEMBER(ne556_other_callback); - DECLARE_WRITE_LINE_MEMBER(pit_out0_changed); - DECLARE_WRITE_LINE_MEMBER(pit_irq_2); - DECLARE_READ8_MEMBER(pio_port_b_r); - DECLARE_READ8_MEMBER(pio_port_c_r); - DECLARE_WRITE8_MEMBER(pio_port_a_w); - DECLARE_WRITE8_MEMBER(pio_port_c_w); - DECLARE_WRITE_LINE_MEMBER(mz800_z80pio_irq); - DECLARE_READ8_MEMBER(mz800_z80pio_port_a_r); - DECLARE_WRITE8_MEMBER(mz800_z80pio_port_a_w); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - required_device m_maincpu; - required_device m_speaker; - required_device m_pit; - required_device m_ppi; - required_device m_cassette; - optional_device m_centronics; - required_device m_ram; - required_device m_gfxdecode; - required_device m_palette; -}; - -#endif /* MZ700_H_ */ diff --git a/src/mess/includes/mz80.h b/src/mess/includes/mz80.h deleted file mode 100644 index ac973027482..00000000000 --- a/src/mess/includes/mz80.h +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/mz80.h - * - ****************************************************************************/ - -#ifndef MZ80_H_ -#define MZ80_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" -#include "sound/wave.h" - -class mz80_state : public driver_device -{ -public: - mz80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pit(*this, "pit8253"), - m_ppi(*this, "ppi8255"), - m_cassette(*this, "cassette"), - m_speaker(*this, "speaker"), - m_p_ram(*this, "p_ram"), - m_p_videoram(*this, "p_videoram"){ } - - required_device m_maincpu; - required_device m_pit; - required_device m_ppi; - required_device m_cassette; - required_device m_speaker; - DECLARE_READ8_MEMBER(mz80k_strobe_r); - DECLARE_WRITE8_MEMBER(mz80k_strobe_w); - DECLARE_READ8_MEMBER(mz80k_8255_portb_r); - DECLARE_READ8_MEMBER(mz80k_8255_portc_r); - DECLARE_WRITE8_MEMBER(mz80k_8255_porta_w); - DECLARE_WRITE8_MEMBER(mz80k_8255_portc_w); - DECLARE_WRITE_LINE_MEMBER(pit_out0_changed); - DECLARE_WRITE_LINE_MEMBER(pit_out2_changed); - bool m_mz80k_vertical; - bool m_mz80k_tempo_strobe; - UINT8 m_speaker_level; - bool m_prev_state; - UINT8 m_mz80k_cursor_cnt; - UINT8 m_mz80k_keyboard_line; - required_shared_ptr m_p_ram; - const UINT8 *m_p_chargen; - required_shared_ptr m_p_videoram; - DECLARE_DRIVER_INIT(mz80k); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_mz80k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_mz80kj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_mz80a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(ne555_tempo_callback); -}; - - -/*----------- defined in video/mz80.c -----------*/ - -extern const gfx_layout mz80k_charlayout; -extern const gfx_layout mz80kj_charlayout; - -#endif /* MZ80_H_ */ diff --git a/src/mess/includes/nc.h b/src/mess/includes/nc.h deleted file mode 100644 index e640ee3927d..00000000000 --- a/src/mess/includes/nc.h +++ /dev/null @@ -1,155 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Wilbert Pol, Kevin Thacker -/***************************************************************************** - * - * includes/nc.h - * - ****************************************************************************/ - -#ifndef NC_H_ -#define NC_H_ - -#include "bus/centronics/ctronics.h" -#include "machine/i8251.h" -#include "machine/clock.h" -#include "machine/ram.h" -#include "machine/nvram.h" -#include "sound/beep.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define NC_NUM_COLOURS 4 - -#define NC_SCREEN_WIDTH 480 -#define NC_SCREEN_HEIGHT 64 - -#define NC200_SCREEN_WIDTH 480 -#define NC200_SCREEN_HEIGHT 128 - -#define NC200_NUM_COLOURS 4 - -enum -{ - NC_TYPE_1xx, /* nc100/nc150 */ - NC_TYPE_200 /* nc200 */ -}; - - -class nc_state : public driver_device -{ -public: - nc_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_beeper1(*this, "beep.1"), - m_beeper2(*this, "beep.2"), - m_centronics(*this, "centronics"), - m_card(*this, "cardslot"), - m_uart(*this, "uart"), - m_uart_clock(*this, "uart_clock"), - m_nvram(*this, "nvram") - { - } - - DECLARE_READ8_MEMBER(nc_memory_management_r); - DECLARE_WRITE8_MEMBER(nc_memory_management_w); - DECLARE_WRITE8_MEMBER(nc_irq_mask_w); - DECLARE_WRITE8_MEMBER(nc_irq_status_w); - DECLARE_READ8_MEMBER(nc_irq_status_r); - DECLARE_READ8_MEMBER(nc_key_data_in_r); - DECLARE_WRITE8_MEMBER(nc_sound_w); - DECLARE_WRITE8_MEMBER(nc_uart_control_w); - DECLARE_WRITE8_MEMBER(nc100_display_memory_start_w); - DECLARE_WRITE8_MEMBER(nc100_uart_control_w); - DECLARE_WRITE8_MEMBER(nc100_poweroff_control_w); - DECLARE_READ8_MEMBER(nc100_card_battery_status_r); - DECLARE_WRITE8_MEMBER(nc100_memory_card_wait_state_w); - DECLARE_WRITE8_MEMBER(nc200_display_memory_start_w); - DECLARE_READ8_MEMBER(nc200_card_battery_status_r); - DECLARE_READ8_MEMBER(nc200_printer_status_r); - DECLARE_WRITE8_MEMBER(nc200_uart_control_w); - DECLARE_WRITE8_MEMBER(nc200_memory_card_wait_state_w); - DECLARE_WRITE8_MEMBER(nc200_poweroff_control_w); - - DECLARE_PALETTE_INIT(nc); - DECLARE_MACHINE_START(nc200); - DECLARE_MACHINE_RESET(nc200); - UINT32 screen_update_nc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(nc_keyboard_timer_callback); - TIMER_CALLBACK_MEMBER(nc_serial_timer_callback); - TIMER_DEVICE_CALLBACK_MEMBER(dummy_timer_callback); - DECLARE_WRITE_LINE_MEMBER(nc100_tc8521_alarm_callback); - DECLARE_WRITE_LINE_MEMBER(nc100_txrdy_callback); - DECLARE_WRITE_LINE_MEMBER(nc100_rxrdy_callback); - DECLARE_WRITE_LINE_MEMBER(write_uart_clock); - DECLARE_WRITE_LINE_MEMBER(write_nc100_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_nc200_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(nc200_txrdy_callback); - DECLARE_WRITE_LINE_MEMBER(nc200_rxrdy_callback); - DECLARE_WRITE_LINE_MEMBER(nc200_fdc_interrupt); - - DECLARE_DRIVER_INIT( nc ); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( nc_pcmcia_card ); - DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( nc_pcmcia_card ); - -protected: - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - -private: - void nc200_video_set_backlight(int state); - int card_calculate_mask(int size); - void set_card_present_state(int state); - void nc_update_interrupts(); - void nc_refresh_memory_bank_config(int bank); - void nc_refresh_memory_config(); - void nc_common_init_machine(); - void nc_sound_update(int channel); - void nc150_init_machine(); - void nc200_refresh_uart_interrupt(); - void nc200_floppy_drive_index_callback(int drive_id); - -public: // HACK FOR MC6845 - required_device m_maincpu; - required_device m_ram; - required_device m_beeper1; - required_device m_beeper2; - required_device m_centronics; - required_device m_card; - required_device m_uart; - required_device m_uart_clock; - required_device m_nvram; - - char m_memory_config[4]; - emu_timer *m_keyboard_timer; - int m_membank_rom_mask; - int m_membank_internal_ram_mask; - UINT8 m_poweroff_control; - int m_card_status; - unsigned char m_uart_control; - int m_irq_mask; - int m_irq_status; - int m_irq_latch; - int m_irq_latch_mask; - int m_sound_channel_periods[2]; - int m_previous_inputport_10_state; - int m_previous_alarm_state; - UINT8 m_nc200_uart_interrupt_irq; - memory_region *m_card_ram; - int m_membank_card_ram_mask; - int m_card_size; - unsigned long m_display_memory_start; - UINT8 m_type; - int m_nc200_backlight; - - int m_centronics_ack; - int m_centronics_busy; -}; - - - -#endif /* NC_H_ */ diff --git a/src/mess/includes/nes.h b/src/mess/includes/nes.h deleted file mode 100644 index 49d8b51df12..00000000000 --- a/src/mess/includes/nes.h +++ /dev/null @@ -1,120 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Brad Oliver,Fabio Priuli -/***************************************************************************** - - nes.h - - Nintendo Entertainment System / Famicom - - ****************************************************************************/ - -#ifndef NES_H_ -#define NES_H_ - - -#include "video/ppu2c0x.h" -#include "bus/nes/nes_slot.h" -#include "bus/nes/nes_carts.h" -#include "bus/nes_ctrl/ctrl.h" -#include "sound/nes_apu.h" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define NTSC_CLOCK N2A03_DEFAULTCLOCK /* 1.789772 MHz */ -#define PAL_CLOCK (26601712.0/16) /* 1.662607 MHz */ - -#define NES_BATTERY_SIZE 0x2000 - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -/*PPU fast banking constants and structures */ - -#define CHRROM 0 -#define CHRRAM 1 - - -/*PPU nametable fast banking constants and structures */ - -#define CIRAM 0 -#define ROM 1 -#define EXRAM 2 -#define MMC5FILL 3 -#define CART_NTRAM 4 - -#define NES_BATTERY 0 -#define NES_WRAM 1 - - -class nes_state : public driver_device -{ -public: - nes_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ppu(*this, "ppu"), - m_sound(*this, "nessound"), - m_ctrl1(*this, "ctrl1"), - m_ctrl2(*this, "ctrl2"), - m_exp(*this, "exp"), - m_cartslot(*this, "nes_slot"), - m_disk(*this, "disk") - { } - - /* video-related */ - int m_last_frame_flip; - - /* misc */ - ioport_port *m_io_disksel; - - UINT8 *m_vram; - UINT8 *m_ciram; //PPU nametable RAM - external to PPU! - - required_device m_maincpu; - required_device m_ppu; - required_device m_sound; - required_device m_ctrl1; - required_device m_ctrl2; - optional_device m_exp; - optional_device m_cartslot; - optional_device m_disk; - - int nes_ppu_vidaccess(int address, int data); - void ppu_nmi(int *ppu_regs); - - DECLARE_READ8_MEMBER(nes_in0_r); - DECLARE_READ8_MEMBER(nes_in1_r); - DECLARE_WRITE8_MEMBER(nes_in0_w); - DECLARE_READ8_MEMBER(fc_in0_r); - DECLARE_READ8_MEMBER(fc_in1_r); - DECLARE_WRITE8_MEMBER(fc_in0_w); - DECLARE_WRITE8_MEMBER(nes_vh_sprite_dma_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - virtual void video_reset(); - DECLARE_PALETTE_INIT(nes); - UINT32 screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER(psg_4015_r); - DECLARE_WRITE8_MEMBER(psg_4015_w); - DECLARE_WRITE8_MEMBER(psg_4017_w); - NESCTRL_BRIGHTPIXEL_CB(bright_pixel); - - DECLARE_DRIVER_INIT(famicom); - - // these are needed until we modernize the FDS controller - DECLARE_MACHINE_START(fds); - DECLARE_MACHINE_START(famitwin); - DECLARE_MACHINE_RESET(fds); - DECLARE_MACHINE_RESET(famitwin); - void setup_disk(nes_disksys_device *slot); - -private: - memory_bank *m_prg_bank_mem[5]; -}; - -#endif /* NES_H_ */ diff --git a/src/mess/includes/newbrain.h b/src/mess/includes/newbrain.h deleted file mode 100644 index 6819aef9729..00000000000 --- a/src/mess/includes/newbrain.h +++ /dev/null @@ -1,274 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __NEWBRAIN__ -#define __NEWBRAIN__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "cpu/cop400/cop400.h" -#include "imagedev/cassette.h" -#include "machine/6850acia.h" -#include "machine/adc0808.h" -#include "machine/z80ctc.h" -#include "machine/rescap.h" -#include "machine/ram.h" -#include "machine/upd765.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "409" -#define COP420_TAG "419" -#define MC6850_TAG "459" -#define ADC0809_TAG "427" -#define DAC0808_TAG "461" -#define Z80CTC_TAG "458" -#define FDC_Z80_TAG "416" -#define UPD765_TAG "418" - -#define NEWBRAIN_EIM_RAM_SIZE 0x10000 - -#define NEWBRAIN_ENRG1_CLK 0x01 -#define NEWBRAIN_ENRG1_TVP 0x04 -#define NEWBRAIN_ENRG1_CTS 0x10 -#define NEWBRAIN_ENRG1_DO 0x20 -#define NEWBRAIN_ENRG1_PO 0x80 -#define NEWBRAIN_ENRG1_UST_BIT_1_MASK 0x30 -#define NEWBRAIN_ENRG1_UST_BIT_0_MASK 0xc0 - -#define NEWBRAIN_ENRG2_USERP 0x01 -#define NEWBRAIN_ENRG2_ANP 0x02 -#define NEWBRAIN_ENRG2_MLTMD 0x04 -#define NEWBRAIN_ENRG2_MSPD 0x08 -#define NEWBRAIN_ENRG2_ENOR 0x10 -#define NEWBRAIN_ENRG2_ANSW 0x20 -#define NEWBRAIN_ENRG2_ENOT 0x40 -#define NEWBRAIN_ENRG2_CENTRONICS_OUT 0x80 - -#define NEWBRAIN_VIDEO_RV 0x01 -#define NEWBRAIN_VIDEO_FS 0x02 -#define NEWBRAIN_VIDEO_32_40 0x04 -#define NEWBRAIN_VIDEO_UCR 0x08 -#define NEWBRAIN_VIDEO_80L 0x40 - -class newbrain_state : public driver_device -{ -public: - newbrain_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_copcpu(*this, COP420_TAG), - m_palette(*this, "palette"), - m_cassette1(*this, "cassette"), - m_cassette2(*this, "cassette2"), - m_rom(*this, Z80_TAG), - m_eim_rom(*this, "eim"), - m_char_rom(*this, "chargen"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_y11(*this, "Y11"), - m_y12(*this, "Y12"), - m_y13(*this, "Y13"), - m_y14(*this, "Y14"), - m_y15(*this, "Y15") - { - } - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE8_MEMBER( enrg1_w ); - DECLARE_WRITE8_MEMBER( a_enrg1_w ); - DECLARE_READ8_MEMBER( ust_r ); - DECLARE_READ8_MEMBER( a_ust_r ); - DECLARE_READ8_MEMBER( user_r ); - DECLARE_WRITE8_MEMBER( user_w ); - DECLARE_READ8_MEMBER( clclk_r ); - DECLARE_WRITE8_MEMBER( clclk_w ); - DECLARE_READ8_MEMBER( clusr_r ); - DECLARE_WRITE8_MEMBER( clusr_w ); - DECLARE_READ8_MEMBER( cop_l_r ); - DECLARE_WRITE8_MEMBER( cop_l_w ); - DECLARE_WRITE8_MEMBER( cop_g_w ); - DECLARE_READ8_MEMBER( cop_g_r ); - DECLARE_WRITE8_MEMBER( cop_d_w ); - DECLARE_READ8_MEMBER( cop_in_r ); - DECLARE_WRITE_LINE_MEMBER( cop_sk_w ); - DECLARE_READ_LINE_MEMBER( cop_si_r ); - DECLARE_WRITE_LINE_MEMBER( cop_so_w ); - DECLARE_READ8_MEMBER( tvl_r ); - DECLARE_WRITE8_MEMBER( tvl_w ); - DECLARE_WRITE8_MEMBER( tvctl_w ); - DECLARE_READ8_MEMBER( cop_r ); - DECLARE_WRITE8_MEMBER( cop_w ); - - INTERRUPT_GEN_MEMBER(newbrain_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(cop_regint_tick); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - - enum - { - TIMER_ID_RESET, - TIMER_ID_PWRUP - }; - - void check_interrupt(); - void bankswitch(); - void tvram_w(UINT8 data, int a6); - inline int get_reset_t(); - inline int get_pwrup_t(); - void screen_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); - - required_device m_maincpu; - required_device m_copcpu; - required_device m_palette; - required_device m_cassette1; - required_device m_cassette2; - required_memory_region m_rom; - optional_memory_region m_eim_rom; - required_memory_region m_char_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_y11; - required_ioport m_y12; - required_ioport m_y13; - required_ioport m_y14; - required_ioport m_y15; - - // processor state - int m_pwrup; // power up - int m_userint; // user interrupt - int m_userint0; // parallel port interrupt - int m_clkint; // clock interrupt - int m_aciaint; // ACIA interrupt - int m_copint; // COP interrupt - int m_anint; // A/DC interrupt - int m_bee; // identity - UINT8 m_enrg1; // enable register 1 - UINT8 m_enrg2; // enable register 2 - int m_acia_txd; // ACIA transmit - - // COP420 state - UINT8 m_cop_bus; // data bus - int m_cop_so; // serial out - int m_cop_tdo; // tape data output - int m_cop_tdi; // tape data input - int m_cop_rd; // memory read - int m_cop_wr; // memory write - int m_cop_access; // COP access - - // keyboard state - ioport_port* m_key_row[16]; - int m_keylatch; // keyboard row - int m_keydata; // keyboard column - - // video state - int m_segment_data[16]; // VF segment data - int m_tvcnsl; // TV console required - int m_tvctl; // TV control register - UINT16 m_tvram; // TV start address - - // user bus state - UINT8 m_user; - - // devices - UINT8 m_copdata; - int m_copstate; - int m_copbytes; - int m_copregint; -}; - -class newbrain_eim_state : public newbrain_state -{ -public: - newbrain_eim_state(const machine_config &mconfig, device_type type, const char *tag) - : newbrain_state(mconfig, type, tag), - m_fdccpu(*this, FDC_Z80_TAG), - m_ctc(*this, Z80CTC_TAG), - m_acia(*this, MC6850_TAG), - m_fdc(*this, UPD765_TAG), - m_floppy(*this, UPD765_TAG ":0:525dd"), - m_eim_ram(*this, "eim_ram") - { } - - required_device m_fdccpu; - required_device m_ctc; - required_device m_acia; - required_device m_fdc; - required_device m_floppy; - optional_shared_ptr m_eim_ram; - - virtual void machine_start(); - - DECLARE_WRITE8_MEMBER( fdc_auxiliary_w ); - DECLARE_READ8_MEMBER( fdc_control_r ); - DECLARE_READ8_MEMBER( ust2_r ); - DECLARE_WRITE8_MEMBER( enrg2_w ); - DECLARE_WRITE8_MEMBER( pr_w ); - DECLARE_READ8_MEMBER( user_r ); - DECLARE_WRITE8_MEMBER( user_w ); - DECLARE_READ8_MEMBER( anout_r ); - DECLARE_WRITE8_MEMBER( anout_w ); - DECLARE_READ8_MEMBER( anin_r ); - DECLARE_WRITE8_MEMBER( anio_w ); - DECLARE_READ8_MEMBER( st0_r ); - DECLARE_READ8_MEMBER( st1_r ); - DECLARE_READ8_MEMBER( st2_r ); - DECLARE_READ8_MEMBER( usbs_r ); - DECLARE_WRITE8_MEMBER( usbs_w ); - DECLARE_WRITE8_MEMBER( paging_w ); - DECLARE_WRITE_LINE_MEMBER( acia_tx ); - DECLARE_WRITE_LINE_MEMBER( acia_interrupt ); - DECLARE_WRITE_LINE_MEMBER( fdc_interrupt ); - DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); - DECLARE_WRITE_LINE_MEMBER( adc_eoc_w ); - - ADC0808_ANALOG_READ_CB(adc_vref_pos_r); - ADC0808_ANALOG_READ_CB(adc_vref_neg_r); - ADC0808_ANALOG_READ_CB(adc_input_r); - - TIMER_DEVICE_CALLBACK_MEMBER(ctc_c2_tick); - - void bankswitch(); - - // paging state - int m_paging; // paging enabled - int m_mpm; // multi paging mode ? - int m_a16; // address line 16 - UINT8 m_pr[16]; // expansion interface paging register - - // floppy state - int m_fdc_int; // interrupt - int m_fdc_att; // attention -}; - -// ---------- defined in video/newbrain.c ---------- - -MACHINE_CONFIG_EXTERN( newbrain_video ); - -#endif diff --git a/src/mess/includes/next.h b/src/mess/includes/next.h deleted file mode 100644 index 25bc09cdaa5..00000000000 --- a/src/mess/includes/next.h +++ /dev/null @@ -1,190 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -#pragma once - -#ifndef __NEXT__ -#define __NEXT__ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/nscsi_bus.h" -#include "machine/mccs1850.h" -#include "machine/8530scc.h" -#include "machine/nextkbd.h" -#include "machine/upd765.h" -#include "machine/ncr5390.h" -#include "machine/mb8795.h" -#include "machine/nextmo.h" -#include "imagedev/chd_cd.h" -#include "imagedev/harddriv.h" - -class next_state : public driver_device -{ -public: - next_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - maincpu(*this, "maincpu"), - rtc(*this, "rtc"), - scc(*this, "scc"), - keyboard(*this, "keyboard"), - scsibus(*this, "scsibus"), - scsi(*this, "scsibus:7:ncr5390"), - net(*this, "net"), - mo(*this, "mo"), - fdc(*this, "fdc"), - vram(*this, "vram"), - m_maincpu(*this, "maincpu") { } - - required_device maincpu; - required_device rtc; - required_device scc; - required_device keyboard; - required_device scsibus; - required_device scsi; - required_device net; - required_device mo; - optional_device fdc; // 040 only - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void setup(UINT32 scr1, int size_x, int size_y, int skip, bool color); - - DECLARE_READ8_MEMBER( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - DECLARE_READ32_MEMBER( rom_map_r ); - DECLARE_READ32_MEMBER( scr2_r ); - DECLARE_WRITE32_MEMBER( scr2_w ); - DECLARE_READ32_MEMBER( scr1_r ); - DECLARE_READ32_MEMBER( irq_status_r ); - DECLARE_READ32_MEMBER( irq_mask_r ); - DECLARE_WRITE32_MEMBER( irq_mask_w ); - DECLARE_READ32_MEMBER( modisk_r ); - DECLARE_READ32_MEMBER( network_r ); - DECLARE_READ32_MEMBER( event_counter_r ); - DECLARE_READ32_MEMBER( dsp_r ); - DECLARE_READ32_MEMBER( fdc_control_r ); - DECLARE_WRITE32_MEMBER( fdc_control_w ); - DECLARE_READ32_MEMBER( dma_ctrl_r ); - DECLARE_WRITE32_MEMBER( dma_ctrl_w ); - DECLARE_WRITE32_MEMBER( dma_040_ctrl_w ); - DECLARE_READ32_MEMBER( dma_regs_r ); - DECLARE_WRITE32_MEMBER( dma_regs_w ); - DECLARE_READ32_MEMBER( scsictrl_r ); - DECLARE_WRITE32_MEMBER( scsictrl_w ); - DECLARE_READ32_MEMBER( phy_r ); - DECLARE_WRITE32_MEMBER( phy_w ); - DECLARE_READ32_MEMBER( timer_data_r ); - DECLARE_WRITE32_MEMBER( timer_data_w ); - DECLARE_READ32_MEMBER( timer_ctrl_r ); - DECLARE_WRITE32_MEMBER( timer_ctrl_w ); - DECLARE_WRITE8_MEMBER( ramdac_w ); - - UINT32 scr1; - UINT32 scr2; - UINT32 irq_status; - UINT32 irq_mask; - int irq_level; - required_shared_ptr vram; - UINT8 scsictrl, scsistat; - - UINT32 phy[2]; - - attotime timer_tbase; - UINT16 timer_vbase; - UINT32 timer_data, timer_next_data; - UINT32 timer_ctrl; - emu_timer *timer_tm; - - UINT32 eventc_latch; - - DECLARE_WRITE_LINE_MEMBER(scc_irq); - DECLARE_WRITE_LINE_MEMBER(keyboard_irq); - DECLARE_WRITE_LINE_MEMBER(power_irq); - DECLARE_WRITE_LINE_MEMBER(nmi_irq); - - DECLARE_WRITE_LINE_MEMBER(scsi_irq); - DECLARE_WRITE_LINE_MEMBER(scsi_drq); - - DECLARE_WRITE_LINE_MEMBER(fdc_irq); - DECLARE_WRITE_LINE_MEMBER(fdc_drq); - - DECLARE_WRITE_LINE_MEMBER(net_tx_irq); - DECLARE_WRITE_LINE_MEMBER(net_rx_irq); - DECLARE_WRITE_LINE_MEMBER(net_tx_drq); - DECLARE_WRITE_LINE_MEMBER(net_rx_drq); - - DECLARE_WRITE_LINE_MEMBER(mo_irq); - DECLARE_WRITE_LINE_MEMBER(mo_drq); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - void vblank_w(screen_device &screen, bool vblank_state); - -protected: - struct dma_slot { - UINT32 start, limit, chain_start, chain_limit, current; - UINT8 state; - bool supdate, restart, drq; - }; - - enum { - // write bits - DMA_SETENABLE = 0x01, - DMA_SETSUPDATE = 0x02, - DMA_SETREAD = 0x04, - DMA_CLRCOMPLETE = 0x08, - DMA_RESET = 0x10, - DMA_INITBUF = 0x20, - DMA_INITBUFTURBO = 0x40, - - // read bits - DMA_ENABLE = 0x01, - DMA_SUPDATE = 0x02, - DMA_READ = 0x04, - DMA_COMPLETE = 0x08, - DMA_BUSEXC = 0x10 - }; - - static const char *dma_targets[0x20]; - static const int dma_irqs[0x20]; - static const bool dma_has_saved[0x20]; - static const int scsi_clocks[4]; - - dma_slot dma_slots[0x20]; - UINT32 esp; - - int screen_sx, screen_sy, screen_skip; - bool screen_color; - bool vbl_enabled; - - virtual void machine_start(); - virtual void machine_reset(); - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - void timer_start(); - void timer_update(); - - void irq_set(int id, bool raise); - void irq_check(); - const char *dma_name(int slot); - void dma_do_ctrl_w(int slot, UINT8 data); - void dma_drq_w(int slot, bool state); - void dma_read(int slot, UINT8 &val, bool &eof, bool &err); - void dma_write(int slot, UINT8 val, bool eof, bool &err); - void dma_check_update(int slot); - void dma_check_end(int slot, bool eof); - void dma_done(int slot); - void dma_end(int slot); - -public: - DECLARE_DRIVER_INIT(nexts2); - DECLARE_DRIVER_INIT(next); - DECLARE_DRIVER_INIT(nextsc); - DECLARE_DRIVER_INIT(nextst); - DECLARE_DRIVER_INIT(nextct); - DECLARE_DRIVER_INIT(nextstc); - DECLARE_DRIVER_INIT(nextctc); - DECLARE_DRIVER_INIT(nexts); - required_device m_maincpu; -}; - -#endif diff --git a/src/mess/includes/ob68k1a.h b/src/mess/includes/ob68k1a.h deleted file mode 100644 index 4f0560273fd..00000000000 --- a/src/mess/includes/ob68k1a.h +++ /dev/null @@ -1,62 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __OB68K1A__ -#define __OB68K1A__ - -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "machine/6821pia.h" -#include "machine/6840ptm.h" -#include "machine/6850acia.h" -#include "machine/com8116.h" -#include "machine/ram.h" - -#define MC68000L10_TAG "u50" -#define MC6821_0_TAG "u32" -#define MC6821_1_TAG "u33" -#define MC6840_TAG "u35" -#define MC6850_0_TAG "u34" -#define MC6850_1_TAG "u26" -#define COM8116_TAG "u56" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" - -class ob68k1a_state : public driver_device -{ -public: - ob68k1a_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MC68000L10_TAG), - m_dbrg(*this, COM8116_TAG), - m_acia0(*this, MC6850_0_TAG), - m_acia1(*this, MC6850_1_TAG), - m_pia0(*this, MC6821_0_TAG), - m_pia1(*this, MC6821_1_TAG), - m_rs232a(*this, RS232_A_TAG), - m_rs232b(*this, RS232_B_TAG), - m_ram(*this, RAM_TAG) - { } - - required_device m_maincpu; - required_device m_dbrg; - required_device m_acia0; - required_device m_acia1; - required_device m_pia0; - required_device m_pia1; - required_device m_rs232a; - required_device m_rs232b; - required_device m_ram; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( com8116_w ); - DECLARE_READ8_MEMBER( pia_r ); - DECLARE_WRITE8_MEMBER( pia_w ); - DECLARE_WRITE_LINE_MEMBER( rx_tx_0_w ); - DECLARE_WRITE_LINE_MEMBER( rx_tx_1_w ); -}; - -#endif diff --git a/src/mess/includes/ondra.h b/src/mess/includes/ondra.h deleted file mode 100644 index f0bae4768fa..00000000000 --- a/src/mess/includes/ondra.h +++ /dev/null @@ -1,76 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/ondra.h - * - ****************************************************************************/ - -#ifndef ONDRA_H_ -#define ONDRA_H_ - -#include "imagedev/cassette.h" -#include "machine/ram.h" - -class ondra_state : public driver_device -{ -public: - ondra_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_region_maincpu(*this, "maincpu"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1"), - m_line2(*this, "LINE2"), - m_line3(*this, "LINE3"), - m_line4(*this, "LINE4"), - m_line5(*this, "LINE5"), - m_line6(*this, "LINE6"), - m_line7(*this, "LINE7"), - m_line8(*this, "LINE8"), - m_line9(*this, "LINE9"), - m_nmi(*this, "NMI") { } - - UINT8 m_video_enable; - UINT8 m_bank1_status; - UINT8 m_bank2_status; - DECLARE_READ8_MEMBER(ondra_keyboard_r); - DECLARE_WRITE8_MEMBER(ondra_port_03_w); - DECLARE_WRITE8_MEMBER(ondra_port_09_w); - DECLARE_WRITE8_MEMBER(ondra_port_0a_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_ondra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(ondra_interrupt); - TIMER_CALLBACK_MEMBER(nmi_check_callback); - -protected: - required_device m_maincpu; - required_device m_cassette; - required_device m_ram; - required_memory_region m_region_maincpu; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_ioport m_line0; - required_ioport m_line1; - required_ioport m_line2; - required_ioport m_line3; - required_ioport m_line4; - required_ioport m_line5; - required_ioport m_line6; - required_ioport m_line7; - required_ioport m_line8; - required_ioport m_line9; - required_ioport m_nmi; - - void ondra_update_banks(); -}; - -#endif diff --git a/src/mess/includes/orao.h b/src/mess/includes/orao.h deleted file mode 100644 index abd6a619529..00000000000 --- a/src/mess/includes/orao.h +++ /dev/null @@ -1,46 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/orao.h - * - ****************************************************************************/ - -#ifndef ORAO_H_ -#define ORAO_H_ -#include "sound/speaker.h" -#include "imagedev/cassette.h" - -class orao_state : public driver_device -{ -public: - orao_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_memory(*this, "memory"), - m_video_ram(*this, "video_ram"), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_line(*this, "LINE"), - m_beep(0) - { } - - DECLARE_READ8_MEMBER(orao_io_r); - DECLARE_WRITE8_MEMBER(orao_io_w); - DECLARE_DRIVER_INIT(orao); - DECLARE_DRIVER_INIT(orao103); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_orao(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -private: - required_shared_ptr m_memory; - required_shared_ptr m_video_ram; - required_device m_maincpu; - required_device m_speaker; - required_device m_cassette; - required_ioport_array<20> m_line; - UINT8 m_beep; -}; - -#endif /* ORAO_H_ */ diff --git a/src/mess/includes/orion.h b/src/mess/includes/orion.h deleted file mode 100644 index 5d6a57058be..00000000000 --- a/src/mess/includes/orion.h +++ /dev/null @@ -1,125 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/orion.h - * - ****************************************************************************/ - -#ifndef ORION_H_ -#define ORION_H_ - -#include "machine/wd_fdc.h" -#include "includes/radio86.h" -#include "cpu/z80/z80.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "machine/ram.h" -#include "machine/mc146818.h" -#include "sound/speaker.h" -#include "sound/ay8910.h" -#include "sound/wave.h" - - -class orion_state : public radio86_state -{ -public: - orion_state(const machine_config &mconfig, device_type type, const char *tag) - : radio86_state(mconfig, type, tag) - , m_fdc(*this, "fd1793") - , m_ram(*this, RAM_TAG) - , m_fd0(*this, "fd0") - , m_fd1(*this, "fd1") - , m_fd2(*this, "fd2") - , m_fd3(*this, "fd3") - , m_rtc(*this, "rtc") - , m_speaker(*this, "speaker") - , m_ay8912(*this, "ay8912") - , m_bank2(*this, "bank2") - , m_bank3(*this, "bank3") - , m_bank4(*this, "bank4") - , m_bank5(*this, "bank5") - , m_bank6(*this, "bank6") - , m_bank7(*this, "bank7") - , m_bank8(*this, "bank8") - { } - - UINT8 m_orion128_video_mode; - UINT8 m_orion128_video_page; - UINT8 m_orion128_video_width; - UINT8 m_video_mode_mask; - UINT8 m_orionpro_pseudo_color; - UINT8 m_romdisk_lsb; - UINT8 m_romdisk_msb; - UINT8 m_orion128_memory_page; - UINT8 m_orionz80_memory_page; - UINT8 m_orionz80_dispatcher; - UINT8 m_speaker_data; - UINT8 m_orionpro_ram0_segment; - UINT8 m_orionpro_ram1_segment; - UINT8 m_orionpro_ram2_segment; - UINT8 m_orionpro_page; - UINT8 m_orionpro_128_page; - UINT8 m_orionpro_rom2_segment; - UINT8 m_orionpro_dispatcher; - - required_device m_fdc; - - DECLARE_READ8_MEMBER(orion128_system_r); - DECLARE_WRITE8_MEMBER(orion128_system_w); - DECLARE_READ8_MEMBER(orion128_romdisk_r); - DECLARE_WRITE8_MEMBER(orion128_romdisk_w); - DECLARE_WRITE8_MEMBER(orion128_video_mode_w); - DECLARE_WRITE8_MEMBER(orion128_video_page_w); - DECLARE_WRITE8_MEMBER(orion128_memory_page_w); - DECLARE_WRITE8_MEMBER(orion_disk_control_w); - DECLARE_READ8_MEMBER(orion128_floppy_r); - DECLARE_WRITE8_MEMBER(orion128_floppy_w); - DECLARE_READ8_MEMBER(orionz80_floppy_rtc_r); - DECLARE_WRITE8_MEMBER(orionz80_floppy_rtc_w); - DECLARE_WRITE8_MEMBER(orionz80_sound_w); - DECLARE_WRITE8_MEMBER(orionz80_sound_fe_w); - DECLARE_WRITE8_MEMBER(orionz80_memory_page_w); - DECLARE_WRITE8_MEMBER(orionz80_dispatcher_w); - DECLARE_READ8_MEMBER(orionz80_io_r); - DECLARE_WRITE8_MEMBER(orionz80_io_w); - DECLARE_WRITE8_MEMBER(orionpro_memory_page_w); - DECLARE_READ8_MEMBER(orionpro_io_r); - DECLARE_WRITE8_MEMBER(orionpro_io_w); - DECLARE_MACHINE_START(orion128); - DECLARE_MACHINE_RESET(orion128); - DECLARE_VIDEO_START(orion128); - DECLARE_PALETTE_INIT(orion128); - DECLARE_MACHINE_START(orionz80); - DECLARE_MACHINE_RESET(orionz80); - DECLARE_MACHINE_RESET(orionpro); - UINT32 screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(orionz80_interrupt); - DECLARE_READ8_MEMBER(orion_romdisk_porta_r); - DECLARE_WRITE8_MEMBER(orion_romdisk_portb_w); - DECLARE_WRITE8_MEMBER(orion_romdisk_portc_w); - DECLARE_FLOPPY_FORMATS( orion_floppy_formats ); - -protected: - required_device m_ram; - required_device m_fd0; - required_device m_fd1; - required_device m_fd2; - required_device m_fd3; - optional_device m_rtc; - optional_device m_speaker; - optional_device m_ay8912; - required_memory_bank m_bank2; - optional_memory_bank m_bank3; - optional_memory_bank m_bank4; - optional_memory_bank m_bank5; - optional_memory_bank m_bank6; - optional_memory_bank m_bank7; - optional_memory_bank m_bank8; - - void orionz80_switch_bank(); - void orion_set_video_mode(int width); - void orionpro_bank_switch(); -}; - -#endif /* ORION_H_ */ diff --git a/src/mess/includes/osborne1.h b/src/mess/includes/osborne1.h deleted file mode 100644 index 52d39a09461..00000000000 --- a/src/mess/includes/osborne1.h +++ /dev/null @@ -1,147 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/***************************************************************************** - * - * includes/osborne1.h - * - ****************************************************************************/ - -#ifndef OSBORNE1_H_ -#define OSBORNE1_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "sound/beep.h" -#include "machine/6821pia.h" -#include "machine/6850acia.h" -#include "bus/ieee488/ieee488.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" - -class osborne1_state : public driver_device -{ -public: - enum - { - TIMER_VIDEO, - TIMER_SETUP - }; - - osborne1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pia0(*this, "pia_0"), - m_pia1(*this, "pia_1"), - m_fdc(*this, "mb8877"), - m_beep(*this, "beeper"), - m_ram(*this, RAM_TAG), - m_ieee(*this, IEEE488_TAG), - m_floppy0(*this, "mb8877:0:525ssdd"), - m_floppy1(*this, "mb8877:1:525ssdd"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_region_maincpu(*this, "maincpu") { } - - virtual void video_start(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - bitmap_ind16 m_bitmap; - - required_device m_maincpu; - required_device m_pia0; - required_device m_pia1; - required_device m_fdc; - required_device m_beep; - required_device m_ram; - required_device m_ieee; - required_device m_floppy0; - required_device m_floppy1; - - DECLARE_WRITE8_MEMBER(osborne1_0000_w); - DECLARE_WRITE8_MEMBER(osborne1_1000_w); - DECLARE_READ8_MEMBER(osborne1_2000_r); - DECLARE_WRITE8_MEMBER(osborne1_2000_w); - DECLARE_WRITE8_MEMBER(osborne1_3000_w); - DECLARE_WRITE8_MEMBER(osborne1_videoram_w); - DECLARE_WRITE8_MEMBER(osborne1_bankswitch_w); - DECLARE_WRITE_LINE_MEMBER(ieee_pia_irq_a_func); - DECLARE_READ8_MEMBER(ieee_pia_pb_r); - DECLARE_WRITE8_MEMBER(ieee_pia_pb_w); - DECLARE_WRITE_LINE_MEMBER(video_pia_out_cb2_dummy); - DECLARE_WRITE8_MEMBER(video_pia_port_a_w); - DECLARE_WRITE8_MEMBER(video_pia_port_b_w); - DECLARE_WRITE_LINE_MEMBER(video_pia_irq_a_func); - DECLARE_DIRECT_UPDATE_MEMBER(osborne1_opbase); - - bool m_bank2_enabled; - bool m_bank3_enabled; - UINT8 *m_bank4_ptr; - UINT8 *m_empty_4K; - /* IRQ states */ - bool m_pia_0_irq_state; - bool m_pia_1_irq_state; - /* video related */ - UINT8 m_new_start_x; - UINT8 m_new_start_y; - emu_timer *m_video_timer; - UINT8 *m_p_chargen; - /* bankswitch setting */ - UINT8 m_bankswitch; - bool m_in_irq_handler; - bool m_beep_state; - DECLARE_DRIVER_INIT(osborne1); - virtual void machine_reset(); - TIMER_CALLBACK_MEMBER(osborne1_video_callback); - TIMER_CALLBACK_MEMBER(setup_osborne1); - -protected: - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_memory_region m_region_maincpu; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -// ======================> osborne1_daisy_device - -class osborne1_daisy_device : public device_t, - public device_z80daisy_interface -{ -public: - // construction/destruction - osborne1_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -private: - virtual void device_start(); - // z80daisy_interface overrides - virtual int z80daisy_irq_state(); - virtual int z80daisy_irq_ack(); - virtual void z80daisy_irq_reti(); -}; - -extern const device_type OSBORNE1_DAISY; - -#endif /* OSBORNE1_H_ */ diff --git a/src/mess/includes/osi.h b/src/mess/includes/osi.h deleted file mode 100644 index 735b511fc37..00000000000 --- a/src/mess/includes/osi.h +++ /dev/null @@ -1,167 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Robbbert, Wilbert Pol -#pragma once - -#ifndef __OSI__ -#define __OSI__ - - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "formats/basicdsk.h" -#include "imagedev/cassette.h" -#include "imagedev/floppy.h" -#include "machine/6850acia.h" -#include "machine/6821pia.h" -#include "machine/ram.h" -#include "sound/discrete.h" -#include "sound/beep.h" - -#define SCREEN_TAG "screen" -#define M6502_TAG "m6502" -#define DISCRETE_TAG "discrete" - -#define X1 3932160 -#define UK101_X1 XTAL_8MHz - -#define OSI600_VIDEORAM_SIZE 0x400 -#define OSI630_COLORRAM_SIZE 0x400 - -class sb2m600_state : public driver_device -{ -public: - sb2m600_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, M6502_TAG), - m_acia_0(*this, "acia_0"), - m_cassette(*this, "cassette"), - m_discrete(*this, DISCRETE_TAG), - m_ram(*this, RAM_TAG), - m_video_ram(*this, "video_ram"), - m_color_ram(*this, "color_ram"), - m_io_row0(*this, "ROW0"), - m_io_row1(*this, "ROW1"), - m_io_row2(*this, "ROW2"), - m_io_row3(*this, "ROW3"), - m_io_row4(*this, "ROW4"), - m_io_row5(*this, "ROW5"), - m_io_row6(*this, "ROW6"), - m_io_row7(*this, "ROW7"), - m_io_sound(*this, "Sound"), - m_io_reset(*this, "Reset"), - m_beeper(*this, "beeper") - { - } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_WRITE8_MEMBER( keyboard_w ); - DECLARE_WRITE8_MEMBER( ctrl_w ); - DECLARE_WRITE_LINE_MEMBER( cassette_tx ); - DECLARE_WRITE_LINE_MEMBER( write_cassette_clock ); - - void floppy_index_callback(floppy_image_device *floppy, int state); - - DECLARE_PALETTE_INIT(osi630); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void machine_start(); - virtual void video_start(); - - enum - { - TIMER_SETUP_BEEP - }; - - required_device m_maincpu; - required_device m_acia_0; - required_device m_cassette; - optional_device m_discrete; - required_device m_ram; - required_shared_ptr m_video_ram; - optional_shared_ptr m_color_ram; - required_ioport m_io_row0; - required_ioport m_io_row1; - required_ioport m_io_row2; - required_ioport m_io_row3; - required_ioport m_io_row4; - required_ioport m_io_row5; - required_ioport m_io_row6; - required_ioport m_io_row7; - required_ioport m_io_sound; - required_ioport m_io_reset; - optional_device m_beeper; - - /* floppy state */ - int m_fdc_index; - - /* keyboard state */ - UINT8 m_keylatch; - - /* video state */ - int m_32; - int m_coloren; - UINT8 *m_p_chargen; -}; - -class c1p_state : public sb2m600_state -{ -public: - c1p_state(const machine_config &mconfig, device_type type, const char *tag) : - sb2m600_state(mconfig, type, tag), - m_beep(*this, "beeper") - { - } - - required_device m_beep; - - virtual void machine_start(); - - DECLARE_WRITE8_MEMBER( osi630_ctrl_w ); - DECLARE_WRITE8_MEMBER( osi630_sound_w ); - DECLARE_DRIVER_INIT(c1p); -}; - -class c1pmf_state : public c1p_state -{ -public: - c1pmf_state(const machine_config &mconfig, device_type type, const char *tag) : - c1p_state(mconfig, type, tag), - m_floppy0(*this, "floppy0"), - m_floppy1(*this, "floppy1") - { } - - DECLARE_READ8_MEMBER( osi470_pia_pa_r ); - DECLARE_WRITE8_MEMBER( osi470_pia_pa_w ); - DECLARE_WRITE8_MEMBER( osi470_pia_pb_w ); - DECLARE_WRITE_LINE_MEMBER( osi470_pia_cb2_w ); - -protected: - virtual void machine_start(); - -private: - required_device m_floppy0; - required_device m_floppy1; -}; - -class uk101_state : public sb2m600_state -{ -public: - uk101_state(const machine_config &mconfig, device_type type, const char *tag) : - sb2m600_state(mconfig, type, tag) - { - } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE8_MEMBER( keyboard_w ); -}; - -/* ---------- defined in video/osi.c ---------- */ - -MACHINE_CONFIG_EXTERN( osi600_video ); -MACHINE_CONFIG_EXTERN( uk101_video ); -MACHINE_CONFIG_EXTERN( osi630_video ); - -#endif diff --git a/src/mess/includes/p2000t.h b/src/mess/includes/p2000t.h deleted file mode 100644 index 0548f661356..00000000000 --- a/src/mess/includes/p2000t.h +++ /dev/null @@ -1,57 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels -/***************************************************************************** - * - * includes/p2000t.h - * - ****************************************************************************/ - -#ifndef P2000T_H_ -#define P2000T_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "video/saa5050.h" - - -class p2000t_state : public driver_device -{ -public: - p2000t_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_videoram(*this, "videoram"), - m_keyboard(*this, "KEY") { } - - required_device m_maincpu; - required_device m_speaker; - optional_device m_gfxdecode; - optional_device m_palette; - required_shared_ptr m_videoram; - required_ioport_array<10> m_keyboard; - DECLARE_READ8_MEMBER(p2000t_port_000f_r); - DECLARE_READ8_MEMBER(p2000t_port_202f_r); - DECLARE_WRITE8_MEMBER(p2000t_port_101f_w); - DECLARE_WRITE8_MEMBER(p2000t_port_303f_w); - DECLARE_WRITE8_MEMBER(p2000t_port_505f_w); - DECLARE_WRITE8_MEMBER(p2000t_port_707f_w); - DECLARE_WRITE8_MEMBER(p2000t_port_888b_w); - DECLARE_WRITE8_MEMBER(p2000t_port_8c90_w); - DECLARE_WRITE8_MEMBER(p2000t_port_9494_w); - DECLARE_READ8_MEMBER(videoram_r); - UINT8 m_port_101f; - UINT8 m_port_202f; - UINT8 m_port_303f; - UINT8 m_port_707f; - INT8 m_frame_count; - DECLARE_VIDEO_START(p2000m); - DECLARE_PALETTE_INIT(p2000m); - UINT32 screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(p2000_interrupt); -}; - -#endif /* P2000T_H_ */ diff --git a/src/mess/includes/partner.h b/src/mess/includes/partner.h deleted file mode 100644 index f5eba1168f8..00000000000 --- a/src/mess/includes/partner.h +++ /dev/null @@ -1,45 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/partner.h - * - ****************************************************************************/ - -#ifndef partner_H_ -#define partner_H_ - -#include "machine/i8255.h" -#include "machine/wd_fdc.h" -#include "machine/ram.h" - -class partner_state : public radio86_state -{ -public: - partner_state(const machine_config &mconfig, device_type type, const char *tag) - : radio86_state(mconfig, type, tag), - m_ram(*this, RAM_TAG), - m_fdc(*this, "wd1793") { } - - UINT8 m_mem_page; - UINT8 m_win_mem_page; - DECLARE_READ8_MEMBER(partner_floppy_r); - DECLARE_WRITE8_MEMBER(partner_floppy_w); - DECLARE_WRITE8_MEMBER(partner_win_memory_page_w); - DECLARE_WRITE8_MEMBER(partner_mem_page_w); - DECLARE_DRIVER_INIT(partner); - DECLARE_MACHINE_START(partner); - DECLARE_MACHINE_RESET(partner); - I8275_DRAW_CHARACTER_MEMBER(display_pixels); - - void partner_window_1(UINT8 bank_num, UINT16 offset,UINT8 *rom); - void partner_window_2(UINT8 bank_num, UINT16 offset,UINT8 *rom); - void partner_iomap_bank(UINT8 *rom); - void partner_bank_switch(); - required_device m_ram; - required_device m_fdc; - DECLARE_FLOPPY_FORMATS( floppy_formats ); -}; - - -#endif /* partner_H_ */ diff --git a/src/mess/includes/pasopia.h b/src/mess/includes/pasopia.h deleted file mode 100644 index 80902e20682..00000000000 --- a/src/mess/includes/pasopia.h +++ /dev/null @@ -1,137 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -#define PASOPIA_KEYBOARD \ - PORT_START("KEY0") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) \ - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) \ - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KANA LOCK") \ - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) \ - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ - PORT_START("KEY1") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) \ - PORT_START("KEY2") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Home") \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) \ - PORT_START("KEY3") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("RIGHT") \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Status?") \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("BACKSPACE") PORT_CHAR(8) \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) \ - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) \ - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) \ - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) \ - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) \ - PORT_START("KEY4") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("StatusLine") \ - PORT_DIPNAME( 0x02, 0x00, "4" ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) \ - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) \ - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) \ - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("LEFT") \ - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) \ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) \ - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("SPACE") PORT_CHAR(' ') \ - PORT_START("KEY5") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("F6") \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_NAME("F7") \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_NAME("F8") \ - PORT_START("KEY6") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHAR('1') PORT_CHAR('1') \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHAR('0') PORT_CHAR('0') \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHAR('4') PORT_CHAR('O') \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('r') PORT_CHAR('O') \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('y') PORT_CHAR('O') \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("_") PORT_CHAR('_') \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_NAME("^") \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Yen") \ - PORT_START("KEY7") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHAR('2') PORT_CHAR('"') \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHAR('3') PORT_CHAR('#') \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHAR('8') PORT_CHAR('(') \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('T') PORT_CHAR('t') \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('U') PORT_CHAR('u') \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHAR('7') PORT_CHAR('\'') \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_NAME("@") PORT_CHAR('@') \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("[ {") PORT_CHAR('[') PORT_CHAR('{') \ - PORT_START("KEY8") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHAR('-') PORT_CHAR('=') \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHAR('5') PORT_CHAR('%') \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHAR('6') PORT_CHAR('&') \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('F') PORT_CHAR('f') \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('H') PORT_CHAR('h') \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHAR('9') PORT_CHAR(')') \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_NAME(": *") PORT_CHAR(':') PORT_CHAR('*') \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("] }") PORT_CHAR(']') PORT_CHAR('}') \ - PORT_START("KEY9") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('Q') PORT_CHAR('q') \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('W') PORT_CHAR('w') \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('E') PORT_CHAR('e') \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('G') PORT_CHAR('g') \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('J') PORT_CHAR('j') \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('I') PORT_CHAR('i') \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('O') PORT_CHAR('o') \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('P') PORT_CHAR('p') \ - PORT_START("KEYA") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('A') PORT_CHAR('a') \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('S') PORT_CHAR('s') \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('D') PORT_CHAR('d') \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('V') PORT_CHAR('v') \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('N') PORT_CHAR('n') \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('K') PORT_CHAR('k') \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('L') PORT_CHAR('l') \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME("; +") PORT_CHAR(';') PORT_CHAR('+') \ - PORT_START("KEYB") \ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('Z') PORT_CHAR('z') \ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('X') PORT_CHAR('x') \ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('C') PORT_CHAR('c') \ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('B') PORT_CHAR('b') \ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('M') PORT_CHAR('m') \ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(", <") PORT_CHAR(',') PORT_CHAR('<') \ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(". >") PORT_CHAR('.') PORT_CHAR('>') \ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/ ?") PORT_CHAR('/') PORT_CHAR('?') diff --git a/src/mess/includes/pc1251.h b/src/mess/includes/pc1251.h deleted file mode 100644 index d03a4524bf5..00000000000 --- a/src/mess/includes/pc1251.h +++ /dev/null @@ -1,62 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/pc1251.h - * - * Pocket Computer 1251 - * - ****************************************************************************/ - -#ifndef PC1251_H_ -#define PC1251_H_ - -#include "pocketc.h" -#include "cpu/sc61860/sc61860.h" -#include "machine/nvram.h" - -#define PC1251_CONTRAST (ioport("DSW0")->read() & 0x07) - - -class pc1251_state : public pocketc_state -{ -public: - enum - { - TIMER_POWER_UP - }; - - pc1251_state(const machine_config &mconfig, device_type type, const char *tag) - : pocketc_state(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - UINT8 m_outa; - UINT8 m_outb; - int m_power; - UINT8 m_reg[0x100]; - - DECLARE_DRIVER_INIT(pc1251); - UINT32 screen_update_pc1251(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE8_MEMBER(pc1251_outa); - DECLARE_WRITE8_MEMBER(pc1251_outb); - DECLARE_WRITE8_MEMBER(pc1251_outc); - - DECLARE_READ_LINE_MEMBER(pc1251_reset); - DECLARE_READ_LINE_MEMBER(pc1251_brk); - DECLARE_READ8_MEMBER(pc1251_ina); - DECLARE_READ8_MEMBER(pc1251_inb); - DECLARE_READ8_MEMBER(pc1251_lcd_read); - DECLARE_WRITE8_MEMBER(pc1251_lcd_write); - virtual void machine_start(); - DECLARE_MACHINE_START(pc1260); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* PC1251_H_ */ diff --git a/src/mess/includes/pc1350.h b/src/mess/includes/pc1350.h deleted file mode 100644 index b50758c5917..00000000000 --- a/src/mess/includes/pc1350.h +++ /dev/null @@ -1,60 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/pc1350.h - * - * Pocket Computer 1350 - * - ****************************************************************************/ - -#ifndef PC1350_H_ -#define PC1350_H_ - -#include "pocketc.h" -#include "cpu/sc61860/sc61860.h" -#include "machine/nvram.h" -#include "machine/ram.h" - -#define PC1350_CONTRAST (ioport("DSW0")->read() & 0x07) - - -class pc1350_state : public pocketc_state -{ -public: - enum - { - TIMER_POWER_UP - }; - - pc1350_state(const machine_config &mconfig, device_type type, const char *tag) - : pocketc_state(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG) { } - - UINT8 m_outa; - UINT8 m_outb; - int m_power; - UINT8 m_reg[0x1000]; - UINT32 screen_update_pc1350(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE8_MEMBER(pc1350_outa); - DECLARE_WRITE8_MEMBER(pc1350_outb); - DECLARE_WRITE8_MEMBER(pc1350_outc); - - DECLARE_READ_LINE_MEMBER(pc1350_brk); - DECLARE_READ8_MEMBER(pc1350_ina); - DECLARE_READ8_MEMBER(pc1350_inb); - DECLARE_READ8_MEMBER(pc1350_lcd_read); - DECLARE_WRITE8_MEMBER(pc1350_lcd_write); - DECLARE_READ8_MEMBER(pc1350_keyboard_line_r); - - virtual void machine_start(); - required_device m_maincpu; - required_device m_ram; - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* PC1350_H_ */ diff --git a/src/mess/includes/pc1401.h b/src/mess/includes/pc1401.h deleted file mode 100644 index 00797e2fe17..00000000000 --- a/src/mess/includes/pc1401.h +++ /dev/null @@ -1,60 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/pc1401.h - * - * Pocket Computer 1401 - * - ****************************************************************************/ - -#ifndef PC1401_H_ -#define PC1401_H_ - -#include "pocketc.h" -#include "cpu/sc61860/sc61860.h" -#include "machine/nvram.h" - -#define CONTRAST (ioport("DSW0")->read() & 0x07) - - -class pc1401_state : public pocketc_state -{ -public: - enum - { - TIMER_POWER_UP - }; - - pc1401_state(const machine_config &mconfig, device_type type, const char *tag) - : pocketc_state(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - UINT8 m_portc; - UINT8 m_outa; - UINT8 m_outb; - int m_power; - UINT8 m_reg[0x100]; - DECLARE_DRIVER_INIT(pc1401); - UINT32 screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ_LINE_MEMBER(pc1401_reset); - DECLARE_READ_LINE_MEMBER(pc1401_brk); - DECLARE_WRITE8_MEMBER(pc1401_outa); - DECLARE_WRITE8_MEMBER(pc1401_outb); - DECLARE_WRITE8_MEMBER(pc1401_outc); - DECLARE_READ8_MEMBER(pc1401_ina); - DECLARE_READ8_MEMBER(pc1401_inb); - DECLARE_READ8_MEMBER(pc1401_lcd_read); - DECLARE_WRITE8_MEMBER(pc1401_lcd_write); - - virtual void machine_start(); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* PC1401_H_ */ diff --git a/src/mess/includes/pc1403.h b/src/mess/includes/pc1403.h deleted file mode 100644 index d40b2bb2bce..00000000000 --- a/src/mess/includes/pc1403.h +++ /dev/null @@ -1,65 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/pc1403.h - * - * Pocket Computer 1403 - * - ****************************************************************************/ - -#ifndef PC1403_H_ -#define PC1403_H_ - -#include "pocketc.h" -#include "cpu/sc61860/sc61860.h" -#include "machine/nvram.h" - -#define CONTRAST (ioport("DSW0")->read() & 0x07) - - -class pc1403_state : public pocketc_state -{ -public: - enum - { - TIMER_POWER_UP - }; - - pc1403_state(const machine_config &mconfig, device_type type, const char *tag) - : pocketc_state(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - UINT8 m_portc; - UINT8 m_outa; - int m_power; - UINT8 m_asic[4]; - int m_DOWN; - int m_RIGHT; - UINT8 m_reg[0x100]; - - DECLARE_DRIVER_INIT(pc1403); - UINT32 screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ_LINE_MEMBER(pc1403_reset); - DECLARE_READ_LINE_MEMBER(pc1403_brk); - DECLARE_WRITE8_MEMBER(pc1403_outa); - DECLARE_WRITE8_MEMBER(pc1403_outc); - DECLARE_READ8_MEMBER(pc1403_ina); - - DECLARE_READ8_MEMBER(pc1403_asic_read); - DECLARE_WRITE8_MEMBER(pc1403_asic_write); - DECLARE_READ8_MEMBER(pc1403_lcd_read); - DECLARE_WRITE8_MEMBER(pc1403_lcd_write); - virtual void video_start(); - virtual void machine_start(); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* PC1403_H_ */ diff --git a/src/mess/includes/pc1512.h b/src/mess/includes/pc1512.h deleted file mode 100644 index 218a3d5599e..00000000000 --- a/src/mess/includes/pc1512.h +++ /dev/null @@ -1,258 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PC1512__ -#define __PC1512__ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "cpu/mcs48/mcs48.h" -#include "formats/pc_dsk.h" -#include "machine/am9517a.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "machine/ins8250.h" -#include "bus/isa/isa.h" -#include "bus/isa/isa_cards.h" -#include "machine/mc146818.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/pc1512kb.h" -#include "machine/pc_fdc.h" -#include "machine/ram.h" -#include "sound/speaker.h" -#include "video/mc6845.h" -#include "bus/isa/pc1640_iga.h" - -#define I8086_TAG "ic120" -#define I8087_TAG "ic119" -#define I8048_TAG "i8048" -#define I8237A5_TAG "ic130" -#define I8259A2_TAG "ic109" -#define I8253_TAG "ic114" -#define MC146818_TAG "ic134" -#define PC_FDC_XT_TAG "ic112" -#define INS8250_TAG "ic106" -#define AMS40041_TAG "ic126" -#define CENTRONICS_TAG "centronics" -#define SPEAKER_TAG "speaker" -#define ISA_BUS_TAG "isa" -#define RS232_TAG "rs232" -#define SCREEN_TAG "screen" - -class pc1512_state : public driver_device -{ -public: - pc1512_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8086_TAG), - m_dmac(*this, I8237A5_TAG), - m_pic(*this, I8259A2_TAG), - m_pit(*this, I8253_TAG), - m_rtc(*this, MC146818_TAG), - m_fdc(*this, PC_FDC_XT_TAG), - m_uart(*this, INS8250_TAG), - m_vdu(*this, AMS40041_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_cent_data_out(*this, "cent_data_out"), - m_speaker(*this, SPEAKER_TAG), - m_kb(*this, PC1512_KEYBOARD_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, PC_FDC_XT_TAG ":0:525dd" ), - m_floppy1(*this, PC_FDC_XT_TAG ":1:525dd" ), - m_bus(*this, ISA_BUS_TAG), - m_char_rom(*this, AMS40041_TAG), - m_video_ram(*this, "video_ram"), - m_lk(*this, "LK"), - m_pit1(0), - m_pit2(0), - m_status1(0), - m_status2(0), - m_port61(0), - m_nmi_enable(0), - m_kb_bits(0), - m_kbclk(1), - m_kbdata(1), - m_dreq0(0), - m_nden(1), - m_dint(0), - m_ddrq(0), - m_fdc_dsr(0), - m_neop(0), - m_ack_int_enable(1), - m_centronics_ack(0), - m_speaker_drive(0) - { } - - required_device m_maincpu; - required_device m_dmac; - required_device m_pic; - required_device m_pit; - required_device m_rtc; - required_device m_fdc; - required_device m_uart; - optional_device m_vdu; - required_device m_centronics; - required_device m_cent_data_out; - required_device m_speaker; - required_device m_kb; - required_device m_ram; - required_device m_floppy0; - optional_device m_floppy1; - required_device m_bus; - optional_memory_region m_char_rom; - optional_shared_ptr m_video_ram; - required_ioport m_lk; - - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void update_speaker(); - void update_fdc_int(); - void update_fdc_drq(); - void update_fdc_tc(); - void update_ack(); - void set_fdc_dsr(UINT8 data); - int get_display_mode(UINT8 mode); - offs_t get_char_rom_offset(); - int get_color(UINT8 data); - MC6845_UPDATE_ROW(draw_alpha); - MC6845_UPDATE_ROW(draw_graphics_1); - MC6845_UPDATE_ROW(draw_graphics_2); - - DECLARE_READ8_MEMBER( video_ram_r ); - DECLARE_WRITE8_MEMBER( video_ram_w ); - DECLARE_READ8_MEMBER( system_r ); - DECLARE_WRITE8_MEMBER( system_w ); - DECLARE_READ8_MEMBER( mouse_r ); - DECLARE_WRITE8_MEMBER( mouse_w ); - DECLARE_WRITE8_MEMBER( dma_page_w ); - DECLARE_WRITE8_MEMBER( nmi_mask_w ); - DECLARE_READ8_MEMBER( printer_r ); - DECLARE_WRITE8_MEMBER( printer_w ); - DECLARE_READ8_MEMBER( fdc_r ); - DECLARE_WRITE8_MEMBER( fdc_w ); - DECLARE_READ8_MEMBER( vdu_r ); - DECLARE_WRITE8_MEMBER( vdu_w ); - DECLARE_WRITE_LINE_MEMBER( kbdata_w ); - DECLARE_WRITE_LINE_MEMBER( kbclk_w ); - DECLARE_WRITE_LINE_MEMBER( pit1_w ); - DECLARE_WRITE_LINE_MEMBER( pit2_w ); - DECLARE_WRITE_LINE_MEMBER( ack_w ); - DECLARE_WRITE_LINE_MEMBER( hrq_w ); - DECLARE_WRITE_LINE_MEMBER( eop_w ); - DECLARE_READ8_MEMBER( memr_r ); - DECLARE_WRITE8_MEMBER( memw_w ); - DECLARE_READ8_MEMBER( ior1_r ); - DECLARE_READ8_MEMBER( ior2_r ); - DECLARE_READ8_MEMBER( ior3_r ); - DECLARE_WRITE8_MEMBER( iow0_w ); - DECLARE_WRITE8_MEMBER( iow1_w ); - DECLARE_WRITE8_MEMBER( iow2_w ); - DECLARE_WRITE8_MEMBER( iow3_w ); - DECLARE_WRITE_LINE_MEMBER( dack0_w ); - DECLARE_WRITE_LINE_MEMBER( dack1_w ); - DECLARE_WRITE_LINE_MEMBER( dack2_w ); - DECLARE_WRITE_LINE_MEMBER( dack3_w ); - DECLARE_INPUT_CHANGED_MEMBER( mouse_button_1_changed ); - DECLARE_INPUT_CHANGED_MEMBER( mouse_button_2_changed ); - DECLARE_INPUT_CHANGED_MEMBER( mouse_x_changed ); - DECLARE_INPUT_CHANGED_MEMBER( mouse_y_changed ); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - DECLARE_WRITE_LINE_MEMBER( fdc_int_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - DECLARE_WRITE_LINE_MEMBER(write_centronics_select); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - MC6845_UPDATE_ROW(crtc_update_row); - - // system status register - int m_pit1; - int m_pit2; - UINT8 m_status1; - UINT8 m_status2; - UINT8 m_port61; - - // interrupt state - int m_nmi_enable; - - // keyboard state - UINT8 m_kbd; - int m_kb_bits; - int m_kbclk; - int m_kbdata; - - // mouse state - UINT8 m_mouse_x; - UINT8 m_mouse_y; - - // DMA state - UINT8 m_dma_page[4]; - int m_dma_channel; - int m_dreq0; - - // floppy state - int m_nden; - int m_dint; - int m_ddrq; - UINT8 m_fdc_dsr; - int m_neop; - - // printer state - int m_ack_int_enable; - int m_centronics_ack; - int m_centronics_busy; - int m_centronics_perror; - int m_centronics_select; - int m_centronics_fault; - UINT8 m_printer_data; - UINT8 m_printer_control; - - // video state - int m_toggle; - int m_lpen; - int m_blink; - int m_cursor; - int m_blink_ctr; - UINT8 m_vdu_mode; - UINT8 m_vdu_color; - UINT8 m_vdu_plane; - UINT8 m_vdu_rdsel; - UINT8 m_vdu_border; - - // sound state - int m_speaker_drive; -}; - -class pc1640_state : public pc1512_state -{ -public: - pc1640_state(const machine_config &mconfig, device_type type, const char *tag) - : pc1512_state(mconfig, type, tag), - m_sw(*this, "SW"), - m_opt(0) - { } - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( io_r ); - DECLARE_READ8_MEMBER( printer_r ); - - required_ioport m_sw; - - int m_opt; -}; - -// ---------- defined in video/pc1512.c ---------- - -MACHINE_CONFIG_EXTERN( pc1512_video ); - -#endif diff --git a/src/mess/includes/pc4.h b/src/mess/includes/pc4.h deleted file mode 100644 index 003669597b8..00000000000 --- a/src/mess/includes/pc4.h +++ /dev/null @@ -1,76 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - VTech Laser PC4 - -****************************************************************************/ - -#pragma once - -#ifndef _PC4_H_ -#define _PC4_H_ - - -#include "sound/beep.h" - -class pc4_state : public driver_device -{ -public: - pc4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_beep(*this, "beeper"), - m_region_charset(*this, "charset"), - m_rombank(*this, "rombank") { } - - required_device m_maincpu; - required_device m_beep; - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - virtual void machine_start(); - - DECLARE_WRITE8_MEMBER( beep_w ); - DECLARE_WRITE8_MEMBER( bank_w ); - DECLARE_READ8_MEMBER( kb_r ); - - //LCD controller - void update_ac(void); - void set_busy_flag(UINT16 usec); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - DECLARE_WRITE8_MEMBER(lcd_control_w); - DECLARE_READ8_MEMBER(lcd_control_r); - DECLARE_WRITE8_MEMBER(lcd_data_w); - DECLARE_READ8_MEMBER(lcd_data_r); - DECLARE_WRITE8_MEMBER( lcd_offset_w ); - - static const device_timer_id BUSY_TIMER = 0; - static const device_timer_id BLINKING_TIMER = 1; - - emu_timer *m_blink_timer; - emu_timer *m_busy_timer; - - UINT8 m_busy_flag; - UINT8 m_ddram[0xa0]; - UINT8 m_cgram[0x40]; - INT16 m_ac; - UINT8 m_ac_mode; - UINT8 m_data_bus_flag; - INT16 m_cursor_pos; - UINT8 m_display_on; - UINT8 m_cursor_on; - UINT8 m_blink_on; - UINT8 m_shift_on; - INT8 m_disp_shift; - INT8 m_direction; - UINT8 m_blink; - DECLARE_PALETTE_INIT(pc4); - -protected: - required_memory_region m_region_charset; - required_memory_bank m_rombank; - ioport_port *io_port[8]; -}; - -#endif // _PC4_H_ diff --git a/src/mess/includes/pc8001.h b/src/mess/includes/pc8001.h deleted file mode 100644 index 524adfba29c..00000000000 --- a/src/mess/includes/pc8001.h +++ /dev/null @@ -1,96 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PC8001__ -#define __PC8001__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8257.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "machine/ram.h" -#include "machine/upd1990a.h" -#include "sound/speaker.h" -#include "video/upd3301.h" - -#define Z80_TAG "z80" -#define I8251_TAG "i8251" -#define I8255A_TAG "i8255" -#define I8257_TAG "i8257" -#define UPD1990A_TAG "upd1990a" -#define UPD3301_TAG "upd3301" -#define CENTRONICS_TAG "centronics" -#define SCREEN_TAG "screen" - -class pc8001_state : public driver_device -{ -public: - pc8001_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_rtc(*this, UPD1990A_TAG), - m_dma(*this, I8257_TAG), - m_crtc(*this, UPD3301_TAG), - m_cassette(*this, "cassette"), - m_centronics(*this, CENTRONICS_TAG), - m_cent_data_out(*this, "cent_data_out"), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG), - m_rom(*this, Z80_TAG), - m_char_rom(*this, UPD3301_TAG) - { } - - required_device m_maincpu; - required_device m_rtc; - required_device m_dma; - required_device m_crtc; - required_device m_cassette; - required_device m_centronics; - required_device m_cent_data_out; - required_device m_speaker; - required_device m_ram; - required_memory_region m_rom; - required_memory_region m_char_rom; - - virtual void machine_start(); - - DECLARE_WRITE8_MEMBER( port10_w ); - DECLARE_WRITE8_MEMBER( port30_w ); - DECLARE_READ8_MEMBER( port40_r ); - DECLARE_WRITE8_MEMBER( port40_w ); - DECLARE_WRITE_LINE_MEMBER( crtc_drq_w ); - DECLARE_WRITE_LINE_MEMBER( hrq_w ); - DECLARE_READ8_MEMBER( dma_mem_r ); - - /* video state */ - int m_width80; - int m_color; - - int m_centronics_busy; - int m_centronics_ack; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - UPD3301_DRAW_CHARACTER_MEMBER( pc8001_display_pixels ); -}; - -class pc8001mk2_state : public pc8001_state -{ -public: - pc8001mk2_state(const machine_config &mconfig, device_type type, const char *tag) - : pc8001_state(mconfig, type, tag), - m_kanji_rom(*this, "kanji") - { } - - required_memory_region m_kanji_rom; - - DECLARE_WRITE8_MEMBER( port31_w ); -}; - -#endif diff --git a/src/mess/includes/pc8401a.h b/src/mess/includes/pc8401a.h deleted file mode 100644 index 10e99652cd1..00000000000 --- a/src/mess/includes/pc8401a.h +++ /dev/null @@ -1,115 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PC8401A__ -#define __PC8401A__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "machine/ram.h" -#include "machine/upd1990a.h" -#include "video/mc6845.h" -#include "video/sed1330.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define SCREEN_TAG "screen" -#define CRT_SCREEN_TAG "screen2" - -#define Z80_TAG "z80" -#define I8255A_TAG "i8255a" -#define UPD1990A_TAG "upd1990a" -#define AY8910_TAG "ay8910" -#define SED1330_TAG "sed1330" -#define MC6845_TAG "mc6845" -#define I8251_TAG "i8251" -#define RS232_TAG "rs232" - -#define PC8401A_CRT_VIDEORAM_SIZE 0x2000 - -class pc8401a_state : public driver_device -{ -public: - pc8401a_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_rtc(*this, UPD1990A_TAG), - m_lcdc(*this, SED1330_TAG), - m_crtc(*this, MC6845_TAG), - m_screen_lcd(*this, SCREEN_TAG), - m_cart(*this, "cartslot"), - m_io_cart(*this, "io_cart"), - m_ram(*this, RAM_TAG), - m_rom(*this, Z80_TAG), - m_crt_ram(*this, "crt_ram"), - m_io_y(*this, "Y") - { } - - required_device m_maincpu; - required_device m_rtc; - required_device m_lcdc; - optional_device m_crtc; - required_device m_screen_lcd; - required_device m_cart; - required_device m_io_cart; - required_device m_ram; - required_memory_region m_rom; - optional_shared_ptr m_crt_ram; - required_ioport_array<10> m_io_y; - - memory_region *m_cart_rom; - - virtual void machine_start(); - virtual void video_start(); - - DECLARE_WRITE8_MEMBER( mmr_w ); - DECLARE_READ8_MEMBER( mmr_r ); - DECLARE_READ8_MEMBER( rtc_r ); - DECLARE_WRITE8_MEMBER( rtc_cmd_w ); - DECLARE_WRITE8_MEMBER( rtc_ctrl_w ); - DECLARE_READ8_MEMBER( io_rom_data_r ); - DECLARE_WRITE8_MEMBER( io_rom_addr_w ); - DECLARE_READ8_MEMBER( port70_r ); - DECLARE_READ8_MEMBER( port71_r ); - DECLARE_WRITE8_MEMBER( port70_w ); - DECLARE_WRITE8_MEMBER( port71_w ); - DECLARE_READ8_MEMBER( ppi_pc_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - DECLARE_PALETTE_INIT(pc8401a); - - void scan_keyboard(); - void bankswitch(UINT8 data); - - // keyboard state - int m_key_strobe; // key pressed - - // memory state - UINT8 m_mmr; // memory mapping register - UINT32 m_io_addr; // I/O ROM address counter - - UINT8 m_key_latch; - TIMER_DEVICE_CALLBACK_MEMBER(pc8401a_keyboard_tick); -}; - -class pc8500_state : public pc8401a_state -{ -public: - pc8500_state(const machine_config &mconfig, device_type type, const char *tag) - : pc8401a_state(mconfig, type, tag) - { } - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - -// ---------- defined in video/pc8401a.c ---------- - -MACHINE_CONFIG_EXTERN( pc8401a_video ); -MACHINE_CONFIG_EXTERN( pc8500_video ); - -#endif diff --git a/src/mess/includes/pce.h b/src/mess/includes/pce.h deleted file mode 100644 index 9d9a7d34b56..00000000000 --- a/src/mess/includes/pce.h +++ /dev/null @@ -1,82 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Charles MacDonald, Wilbert Pol, Angelo Salese -/***************************************************************************** - * - * includes/pce.h - * - * NEC PC Engine/TurboGrafx16 - * - ****************************************************************************/ - -#ifndef PCE_H_ -#define PCE_H_ - -#include "cdrom.h" -#include "cpu/h6280/h6280.h" -#include "bus/pce/pce_slot.h" -#include "machine/pce_cd.h" -#include "video/huc6260.h" - -#define C6280_TAG "c6280" - -#define MAIN_CLOCK 21477270 - -#define TG_16_JOY_SIG 0x00 -#define PCE_JOY_SIG 0x40 -#define NO_CD_SIG 0x80 -#define CD_SIG 0x00 -/* these might be used to indicate something, but they always seem to return 1 */ -#define CONST_SIG 0x30 - - - -class pce_state : public driver_device -{ -public: - pce_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cd_ram(*this, "cd_ram"), - m_user_ram(*this, "user_ram"), - m_huc6260(*this, "huc6260"), - m_cartslot(*this, "cartslot"), - m_cd(*this, "pce_cd"), - m_joy(*this, "JOY_P"), - m_joy6b(*this, "JOY6B_P"), - m_joy_type(*this, "JOY_TYPE"), - m_a_card(*this, "A_CARD") - { } - - required_device m_maincpu; - required_shared_ptr m_cd_ram; - required_shared_ptr m_user_ram; - optional_device m_huc6260; - required_device m_cartslot; - optional_device m_cd; - required_ioport_array<5> m_joy; - required_ioport_array<5> m_joy6b; - required_ioport m_joy_type; - required_ioport m_a_card; - - UINT8 m_io_port_options; - UINT8 m_sys3_card; - UINT8 m_acard; - int m_joystick_port_select; - int m_joystick_data_select; - UINT8 m_joy_6b_packet[5]; - DECLARE_WRITE8_MEMBER(mess_pce_joystick_w); - DECLARE_READ8_MEMBER(mess_pce_joystick_r); - DECLARE_WRITE8_MEMBER(pce_cd_intf_w); - DECLARE_READ8_MEMBER(pce_cd_intf_r); - DECLARE_READ8_MEMBER(pce_cd_acard_wram_r); - DECLARE_WRITE8_MEMBER(pce_cd_acard_wram_w); - DECLARE_DRIVER_INIT(sgx); - DECLARE_DRIVER_INIT(tg16); - DECLARE_DRIVER_INIT(mess_pce); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_MACHINE_START(pce); - DECLARE_MACHINE_RESET(mess_pce); - DECLARE_WRITE_LINE_MEMBER(pce_irq_changed); -}; - -#endif /* PCE_H_ */ diff --git a/src/mess/includes/pcw.h b/src/mess/includes/pcw.h deleted file mode 100644 index ef81c98bc82..00000000000 --- a/src/mess/includes/pcw.h +++ /dev/null @@ -1,140 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/***************************************************************************** - * - * includes/pcw.h - * - ****************************************************************************/ - -#ifndef PCW_H_ -#define PCW_H_ - -#include "machine/upd765.h" -#include "machine/ram.h" -#include "sound/beep.h" - -#define PCW_BORDER_HEIGHT 8 -#define PCW_BORDER_WIDTH 8 -#define PCW_NUM_COLOURS 2 -#define PCW_DISPLAY_WIDTH 720 -#define PCW_DISPLAY_HEIGHT 256 - -#define PCW_SCREEN_WIDTH (PCW_DISPLAY_WIDTH + (PCW_BORDER_WIDTH<<1)) -#define PCW_SCREEN_HEIGHT (PCW_DISPLAY_HEIGHT + (PCW_BORDER_HEIGHT<<1)) -#define PCW_PRINTER_WIDTH (80*16) -#define PCW_PRINTER_HEIGHT (20*16) - - -class pcw_state : public driver_device -{ -public: - pcw_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_fdc(*this, "upd765"), - m_ram(*this, RAM_TAG), - m_beeper(*this, "beeper"), - m_screen(*this, "screen"), - m_palette(*this, "palette") - { } - - int m_boot; - int m_system_status; - int m_fdc_interrupt_code; - int m_interrupt_counter; - UINT8 m_banks[4]; - unsigned char m_bank_force; - UINT8 m_timer_irq_flag; - UINT8 m_nmi_flag; - UINT8 m_printer_command; - UINT8 m_printer_data; - UINT8 m_printer_status; - INT16 m_printer_headpos; - UINT16 m_kb_scan_row; - UINT8 m_mcu_keyboard_data[16]; - UINT8 m_mcu_transmit_reset_seq; - UINT8 m_mcu_transmit_count; - UINT8 m_mcu_selected; - UINT8 m_mcu_buffer; - UINT8 m_mcu_prev; - unsigned int m_roller_ram_addr; - unsigned short m_roller_ram_offset; - unsigned char m_vdu_video_control_register; - UINT8 m_printer_serial; // value if shift/store data pin - UINT8 m_printer_shift; // state of shift register - UINT8 m_printer_shift_output; // output presented to the paper feed motor and print head motor - UINT8 m_head_motor_state; - UINT8 m_linefeed_motor_state; - UINT16 m_printer_pins; - UINT8 m_printer_p2; // MCU port P2 state - UINT32 m_paper_feed; // amount of paper fed through printer, by n/360 inches. One line feed is 61/360in (from the linefeed command in CP/M;s ptr menu) - bitmap_ind16* m_prn_output; - UINT8 m_printer_p2_prev; - emu_timer* m_prn_stepper; - emu_timer* m_prn_pins; - DECLARE_READ8_MEMBER(pcw_keyboard_r); - DECLARE_READ8_MEMBER(pcw_keyboard_data_r); - DECLARE_READ8_MEMBER(pcw_interrupt_counter_r); - DECLARE_WRITE8_MEMBER(pcw_bank_select_w); - DECLARE_WRITE8_MEMBER(pcw_bank_force_selection_w); - DECLARE_WRITE8_MEMBER(pcw_roller_ram_addr_w); - DECLARE_WRITE8_MEMBER(pcw_pointer_table_top_scan_w); - DECLARE_WRITE8_MEMBER(pcw_vdu_video_control_register_w); - DECLARE_WRITE8_MEMBER(pcw_system_control_w); - DECLARE_READ8_MEMBER(pcw_system_status_r); - DECLARE_READ8_MEMBER(pcw_expansion_r); - DECLARE_WRITE8_MEMBER(pcw_expansion_w); - DECLARE_WRITE8_MEMBER(pcw_printer_data_w); - DECLARE_WRITE8_MEMBER(pcw_printer_command_w); - DECLARE_READ8_MEMBER(pcw_printer_data_r); - DECLARE_READ8_MEMBER(pcw_printer_status_r); - DECLARE_READ8_MEMBER(mcu_printer_p1_r); - DECLARE_WRITE8_MEMBER(mcu_printer_p1_w); - DECLARE_READ8_MEMBER(mcu_printer_p2_r); - DECLARE_WRITE8_MEMBER(mcu_printer_p2_w); - DECLARE_READ8_MEMBER(mcu_printer_t1_r); - DECLARE_READ8_MEMBER(mcu_printer_t0_r); - DECLARE_READ8_MEMBER(mcu_kb_scan_r); - DECLARE_WRITE8_MEMBER(mcu_kb_scan_w); - DECLARE_READ8_MEMBER(mcu_kb_scan_high_r); - DECLARE_WRITE8_MEMBER(mcu_kb_scan_high_w); - DECLARE_READ8_MEMBER(mcu_kb_data_r); - DECLARE_READ8_MEMBER(mcu_kb_t1_r); - DECLARE_READ8_MEMBER(mcu_kb_t0_r); - DECLARE_READ8_MEMBER(pcw9512_parallel_r); - DECLARE_WRITE8_MEMBER(pcw9512_parallel_w); - void mcu_transmit_serial(UINT8 bit); - DECLARE_DRIVER_INIT(pcw); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(pcw); - UINT32 screen_update_pcw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_pcw_printer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(pcw_timer_pulse); - TIMER_CALLBACK_MEMBER(pcw_stepper_callback); - TIMER_CALLBACK_MEMBER(pcw_pins_callback); - TIMER_CALLBACK_MEMBER(setup_beep); - TIMER_DEVICE_CALLBACK_MEMBER(pcw_timer_interrupt); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - DECLARE_WRITE_LINE_MEMBER( pcw_fdc_interrupt ); - required_device m_maincpu; - required_device m_fdc; - required_device m_ram; - required_device m_beeper; - required_device m_screen; - required_device m_palette; - - inline void pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - void pcw_update_interrupt_counter(); - void pcw_update_irqs(); - void pcw_update_read_memory_block(int block, int bank); - void pcw_update_write_memory_block(int block, int bank); - void pcw_update_mem(int block, int data); - int pcw_get_sys_status(); - void pcw_printer_fire_pins(UINT16 pins); -}; - -#endif /* PCW_H_ */ diff --git a/src/mess/includes/pcw16.h b/src/mess/includes/pcw16.h deleted file mode 100644 index 2321267578c..00000000000 --- a/src/mess/includes/pcw16.h +++ /dev/null @@ -1,160 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/***************************************************************************** - * - * includes/pcw16.h - * - ****************************************************************************/ - -#ifndef PCW16_H_ -#define PCW16_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/upd765.h" /* FDC superio */ -#include "machine/pc_lpt.h" /* PC-Parallel Port */ -#include "machine/pckeybrd.h" /* PC-AT keyboard */ -#include "machine/upd765.h" /* FDC superio */ -#include "machine/ins8250.h" /* pc com port */ -#include "sound/beep.h" /* pcw/pcw16 beeper */ -#include "machine/intelfsh.h" -#include "formats/pc_dsk.h" -#include "machine/ram.h" - -#define PCW16_BORDER_HEIGHT 8 -#define PCW16_BORDER_WIDTH 8 -#define PCW16_NUM_COLOURS 32 -#define PCW16_DISPLAY_WIDTH 640 -#define PCW16_DISPLAY_HEIGHT 480 - -#define PCW16_SCREEN_WIDTH (PCW16_DISPLAY_WIDTH + (PCW16_BORDER_WIDTH<<1)) -#define PCW16_SCREEN_HEIGHT (PCW16_DISPLAY_HEIGHT + (PCW16_BORDER_HEIGHT<<1)) - - -class pcw16_state : public driver_device -{ -public: - pcw16_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_flash0(*this, "flash0"), - m_flash1(*this, "flash1"), - m_fdc(*this, "fdc"), - m_uart2(*this, "ns16550_2"), - m_beeper(*this, "beeper"), - m_ram(*this, RAM_TAG), - m_keyboard(*this, "at_keyboard"), - m_region_rom(*this, "maincpu"), - m_io_extra(*this, "EXTRA") - { } - - required_device m_maincpu; - required_device m_flash0; - required_device m_flash1; - required_device m_fdc; - required_device m_uart2; - required_device m_beeper; - required_device m_ram; - required_device m_keyboard; - required_memory_region m_region_rom; - required_ioport m_io_extra; - - unsigned long m_interrupt_counter; - int m_banks[4]; - int m_4_bit_port; - int m_fdc_int_code; - int m_system_status; - char *m_mem_ptr[4]; - unsigned char m_keyboard_data_shift; - int m_keyboard_parity_table[256]; - int m_keyboard_bits; - int m_keyboard_bits_output; - int m_keyboard_state; - int m_keyboard_previous_state; - unsigned char m_rtc_seconds; - unsigned char m_rtc_minutes; - unsigned char m_rtc_hours; - unsigned char m_rtc_days_max; - unsigned char m_rtc_days; - unsigned char m_rtc_months; - unsigned char m_rtc_years; - unsigned char m_rtc_control; - unsigned char m_rtc_256ths_seconds; - int m_previous_fdc_int_state; - int m_colour_palette[16]; - int m_video_control; - DECLARE_WRITE8_MEMBER(pcw16_palette_w); - DECLARE_READ8_MEMBER(pcw16_bankhw_r); - DECLARE_WRITE8_MEMBER(pcw16_bankhw_w); - DECLARE_WRITE8_MEMBER(pcw16_video_control_w); - DECLARE_READ8_MEMBER(pcw16_keyboard_data_shift_r); - DECLARE_WRITE8_MEMBER(pcw16_keyboard_data_shift_w); - DECLARE_READ8_MEMBER(pcw16_keyboard_status_r); - DECLARE_WRITE8_MEMBER(pcw16_keyboard_control_w); - DECLARE_READ8_MEMBER(rtc_year_invalid_r); - DECLARE_READ8_MEMBER(rtc_month_r); - DECLARE_READ8_MEMBER(rtc_days_r); - DECLARE_READ8_MEMBER(rtc_hours_r); - DECLARE_READ8_MEMBER(rtc_minutes_r); - DECLARE_READ8_MEMBER(rtc_seconds_r); - DECLARE_READ8_MEMBER(rtc_256ths_seconds_r); - DECLARE_WRITE8_MEMBER(rtc_control_w); - DECLARE_WRITE8_MEMBER(rtc_seconds_w); - DECLARE_WRITE8_MEMBER(rtc_minutes_w); - DECLARE_WRITE8_MEMBER(rtc_hours_w); - DECLARE_WRITE8_MEMBER(rtc_days_w); - DECLARE_WRITE8_MEMBER(rtc_month_w); - DECLARE_WRITE8_MEMBER(rtc_year_w); - DECLARE_READ8_MEMBER(pcw16_system_status_r); - DECLARE_READ8_MEMBER(pcw16_timer_interrupt_counter_r); - DECLARE_WRITE8_MEMBER(pcw16_system_control_w); - DECLARE_WRITE8_MEMBER(pcw16_superio_fdc_datarate_w); - DECLARE_WRITE8_MEMBER(pcw16_superio_fdc_digital_output_register_w); - DECLARE_WRITE8_MEMBER(pcw16_superio_fdc_data_w); - DECLARE_READ8_MEMBER(pcw16_superio_fdc_data_r); - DECLARE_READ8_MEMBER(pcw16_superio_fdc_main_status_register_r); - DECLARE_READ8_MEMBER(pcw16_superio_fdc_digital_input_register_r); - DECLARE_READ8_MEMBER(pcw16_mem_r); - DECLARE_WRITE8_MEMBER(pcw16_mem_w); - void pcw16_keyboard_init(); - void pcw16_keyboard_refresh_outputs(); - void pcw16_keyboard_set_clock_state(int state); - void pcw16_keyboard_int(int state); - void pcw16_keyboard_reset(); - int pcw16_keyboard_can_transmit(); - void pcw16_keyboard_signal_byte_received(int data); - void pcw16_refresh_ints(); - void rtc_setup_max_days(); - UINT8 pcw16_read_mem(UINT8 bank, UINT16 offset); - void pcw16_write_mem(UINT8 bank, UINT16 offset, UINT8 data); - UINT8 read_bank_data(UINT8 type, UINT16 offset); - void write_bank_data(UINT8 type, UINT16 offset, UINT8 data); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(pcw16); - UINT32 screen_update_pcw16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(pcw16_timer_callback); - TIMER_DEVICE_CALLBACK_MEMBER(rtc_timer_callback); - DECLARE_WRITE_LINE_MEMBER(pcw16_com_interrupt_1); - DECLARE_WRITE_LINE_MEMBER(pcw16_com_interrupt_2); - DECLARE_WRITE_LINE_MEMBER(pcw16_com_tx_0); - DECLARE_WRITE_LINE_MEMBER(pcw16_com_dtr_0); - DECLARE_WRITE_LINE_MEMBER(pcw16_com_rts_0); - DECLARE_WRITE_LINE_MEMBER(pcw16_com_tx_1); - DECLARE_WRITE_LINE_MEMBER(pcw16_com_dtr_1); - DECLARE_WRITE_LINE_MEMBER(pcw16_com_rts_1); - DECLARE_WRITE_LINE_MEMBER(pcw16_keyboard_callback); - INPUT_CHANGED_MEMBER(power); - - void trigger_fdc_int(); - DECLARE_WRITE_LINE_MEMBER( fdc_interrupt ); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - inline void pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - void pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); - void pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); - void pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); - void pcw16_begin_byte_transfer(); -}; - -#endif /* PCW16_H_ */ diff --git a/src/mess/includes/pdp1.h b/src/mess/includes/pdp1.h deleted file mode 100644 index 074c907a489..00000000000 --- a/src/mess/includes/pdp1.h +++ /dev/null @@ -1,336 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/***************************************************************************** - * - * includes/pdp1.h - * - ****************************************************************************/ - -#ifndef PDP1_H_ -#define PDP1_H_ - -#include "cpu/pdp1/pdp1.h" -#include "video/crt.h" - -/* defines for each bit and mask in input port "CSW" */ -enum -{ - /* bit numbers */ - pdp1_control_bit = 0, - - pdp1_extend_bit = 1, - pdp1_start_nobrk_bit= 2, - pdp1_start_brk_bit = 3, - pdp1_stop_bit = 4, - pdp1_continue_bit = 5, - pdp1_examine_bit = 6, - pdp1_deposit_bit = 7, - pdp1_read_in_bit = 8, - pdp1_reader_bit = 9, - pdp1_tape_feed_bit = 10, - pdp1_single_step_bit= 11, - pdp1_single_inst_bit= 12, - - /* masks */ - pdp1_control = (1 << pdp1_control_bit), - pdp1_extend = (1 << pdp1_extend_bit), - pdp1_start_nobrk = (1 << pdp1_start_nobrk_bit), - pdp1_start_brk = (1 << pdp1_start_brk_bit), - pdp1_stop = (1 << pdp1_stop_bit), - pdp1_continue = (1 << pdp1_continue_bit), - pdp1_examine = (1 << pdp1_examine_bit), - pdp1_deposit = (1 << pdp1_deposit_bit), - pdp1_read_in = (1 << pdp1_read_in_bit), - pdp1_reader = (1 << pdp1_reader_bit), - pdp1_tape_feed = (1 << pdp1_tape_feed_bit), - pdp1_single_step = (1 << pdp1_single_step_bit), - pdp1_single_inst = (1 << pdp1_single_inst_bit) -}; - -/* defines for each bit in input port pdp1_spacewar_controllers*/ -#define ROTATE_LEFT_PLAYER1 0x01 -#define ROTATE_RIGHT_PLAYER1 0x02 -#define THRUST_PLAYER1 0x04 -#define FIRE_PLAYER1 0x08 -#define ROTATE_LEFT_PLAYER2 0x10 -#define ROTATE_RIGHT_PLAYER2 0x20 -#define THRUST_PLAYER2 0x40 -#define FIRE_PLAYER2 0x80 -#define HSPACE_PLAYER1 0x100 -#define HSPACE_PLAYER2 0x200 - -/* defines for each field in input port pdp1_config */ -enum -{ - pdp1_config_extend_bit = 0, - pdp1_config_extend_mask = 0x3, /* 2 bits */ - pdp1_config_hw_mul_div_bit = 2, - pdp1_config_hw_mul_div_mask = 0x1, - /*pdp1_config_hw_obsolete_bit = 3, - pdp1_config_hw_obsolete_mask = 0x1,*/ - pdp1_config_type_20_sbs_bit = 4, - pdp1_config_type_20_sbs_mask = 0x1, - pdp1_config_lightpen_bit = 5, - pdp1_config_lightpen_mask = 0x1 -}; - -/* defines for each field in input port pdp1_lightpen_state */ -enum -{ - pdp1_lightpen_down_bit = 0, - pdp1_lightpen_smaller_bit = 1, - pdp1_lightpen_larger_bit = 2, - - pdp1_lightpen_down = (1 << pdp1_lightpen_down_bit), - pdp1_lightpen_smaller = (1 << pdp1_lightpen_smaller_bit), - pdp1_lightpen_larger = (1 << pdp1_lightpen_larger_bit) -}; - -/* defines for our font */ -enum -{ - pdp1_charnum = /*104*/128, /* ASCII set + 8 special characters */ - /* for whatever reason, 104 breaks some characters */ - - pdp1_fontdata_size = 8 * pdp1_charnum -}; - -enum -{ - /* size and position of crt window */ - crt_window_width = 512, - crt_window_height = 512, - crt_window_offset_x = 0, - crt_window_offset_y = 0, - /* size and position of operator control panel window */ - panel_window_width = 384, - panel_window_height = 128, - panel_window_offset_x = crt_window_width, - panel_window_offset_y = 0, - /* size and position of typewriter window */ - typewriter_window_width = 640, - typewriter_window_height = 160, - typewriter_window_offset_x = 0, - typewriter_window_offset_y = crt_window_height -}; - -enum -{ - total_width = crt_window_width + panel_window_width, - total_height = crt_window_height + typewriter_window_height, - - /* respect 4:3 aspect ratio to keep pixels square */ - virtual_width_1 = ((total_width+3)/4)*4, - virtual_height_1 = ((total_height+2)/3)*3, - virtual_width_2 = virtual_height_1*4/3, - virtual_height_2 = virtual_width_1*3/4, - virtual_width = (virtual_width_1 > virtual_width_2) ? virtual_width_1 : virtual_width_2, - virtual_height = (virtual_height_1 > virtual_height_2) ? virtual_height_1 : virtual_height_2 -}; - -enum -{ /* refresh rate in Hz: can be changed at will */ - refresh_rate = 60 -}; - -/* Color codes */ -enum -{ - /* first pen_crt_num_levels colors used for CRT (with remanence) */ - pen_crt_num_levels = 69, - pen_crt_max_intensity = pen_crt_num_levels-1, - - /* next colors used for control panel and typewriter */ - pen_black = pen_crt_num_levels, - pen_white, - pen_green, - pen_dk_green, - pen_red, - pen_lt_gray, - - /* color constants for control panel */ - pen_panel_bg = pen_black, - pen_panel_caption = pen_white, - color_panel_caption = 0, - pen_switch_nut = pen_lt_gray, - pen_switch_button = pen_white, - pen_lit_lamp = pen_green, - pen_unlit_lamp = pen_dk_green, - - /* color constants for typewriter */ - pen_typewriter_bg = pen_white, - color_typewriter_black = 1, - color_typewriter_red = 2, - - /* color constants used for light pen */ - pen_lightpen_nonpressed = pen_red, - pen_lightpen_pressed = pen_green -}; - -/* tape reader registers */ -struct tape_reader_t -{ - device_image_interface *fd; /* file descriptor of tape image */ - - int motor_on; /* 1-bit reader motor on */ - - int rb; /* 18-bit reader buffer */ - int rcl; /* 1-bit reader clutch */ - int rc; /* 2-bit reader counter */ - int rby; /* 1-bit reader binary mode flip-flop */ - int rcp; /* 1-bit reader "need a completion pulse" flip-flop */ - - emu_timer *timer; /* timer to simulate reader timing */ -}; - - - -/* tape puncher registers */ -struct tape_puncher_t -{ - device_image_interface *fd; /* file descriptor of tape image */ - - emu_timer *timer; /* timer to generate completion pulses */ -}; - - - -/* typewriter registers */ -struct typewriter_t -{ - device_image_interface *fd; /* file descriptor of output image */ - - int tb; /* typewriter buffer */ - - emu_timer *tyo_timer;/* timer to generate completion pulses */ -}; - -/* MIT parallel drum (mostly similar to type 23) */ -struct parallel_drum_t -{ - device_image_interface *fd; /* file descriptor of drum image */ - - int il; /* initial location (12-bit) */ - int wc; /* word counter (12-bit) */ - int wcl; /* word core location counter (16-bit) */ - int rfb; /* read field buffer (5-bit) */ - int wfb; /* write field buffer (5-bit) */ - - int dba; - - emu_timer *rotation_timer; /* timer called each time dc is 0 */ - emu_timer *il_timer; /* timer called each time dc is il */ -}; - - -struct lightpen_t -{ - char active; - char down; - short x, y; - short radius; -}; - - -class pdp1_state : public driver_device -{ -public: - pdp1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_crt(*this, "crt"), - m_spacewar(*this, "SPACEWAR"), - m_csw(*this, "CSW"), - m_sense(*this, "SENSE"), - m_tstadd(*this, "TSTADD"), - m_twdmsb(*this, "TWDMSB"), - m_twdlsb(*this, "TWDLSB"), - m_twr(*this, "TWR"), - m_cfg(*this, "CFG"), - m_io_lightpen(*this, "LIGHTPEN"), - m_lightx(*this, "LIGHTX"), - m_lighty(*this, "LIGHTY") - { } - - int m_io_status; - tape_reader_t m_tape_reader; - tape_puncher_t m_tape_puncher; - typewriter_t m_typewriter; - emu_timer *m_dpy_timer; - lightpen_t m_lightpen; - parallel_drum_t m_parallel_drum; - required_device m_maincpu; - - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(pdp1); - UINT32 screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void screen_eof_pdp1(screen_device &screen, bool state); - INTERRUPT_GEN_MEMBER(pdp1_interrupt); - TIMER_CALLBACK_MEMBER(reader_callback); - TIMER_CALLBACK_MEMBER(puncher_callback); - TIMER_CALLBACK_MEMBER(tyo_callback); - TIMER_CALLBACK_MEMBER(dpy_callback); - TIMER_CALLBACK_MEMBER(il_timer_callback); - void pdp1_machine_stop(); - inline void pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - void pdp1_plot(int x, int y); - void pdp1_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); - void pdp1_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); - void pdp1_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state); - void pdp1_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); - void pdp1_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color); - void pdp1_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color); - void pdp1_draw_panel_backdrop(bitmap_ind16 &bitmap); - void pdp1_draw_panel(bitmap_ind16 &bitmap); - void pdp1_typewriter_linefeed(); - void pdp1_typewriter_drawchar(int character); - void pdp1_update_lightpen_state(const lightpen_t *new_state); - void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_); - void pdp1_erase_lightpen(bitmap_ind16 &bitmap); - void pdp1_draw_lightpen(bitmap_ind16 &bitmap); - int tape_read(UINT8 *reply); - void begin_tape_read(int binary, int nac); - void tape_write(UINT8 data); - void typewriter_out(UINT8 data); - void parallel_drum_set_il(int il); - void parallel_drum_init(); - UINT32 drum_read(int field, int position); - void drum_write(int field, int position, UINT32 data); - void pdp1_keyboard(); - void pdp1_lightpen(); - int read_spacewar() { return m_spacewar->read(); } - -private: - pdp1_reset_param_t m_reset_param; - int m_old_typewriter_keys[4]; - int m_old_lightpen; - int m_old_control_keys; - int m_old_tw_keys; - int m_old_ta_keys; - int m_typewriter_color; - bitmap_ind16 m_panel_bitmap; - bitmap_ind16 m_typewriter_bitmap; - lightpen_t m_lightpen_state; - lightpen_t m_previous_lightpen_state; - int m_pos; - int m_case_shift; - required_device m_gfxdecode; - required_device m_palette; - required_device m_crt; - required_ioport m_spacewar; - required_ioport m_csw; - required_ioport m_sense; - required_ioport m_tstadd; - required_ioport m_twdmsb; - required_ioport m_twdlsb; - required_ioport_array<4> m_twr; - required_ioport m_cfg; - required_ioport m_io_lightpen; - required_ioport m_lightx; - required_ioport m_lighty; -}; -#endif /* PDP1_H_ */ diff --git a/src/mess/includes/pecom.h b/src/mess/includes/pecom.h deleted file mode 100644 index 0cbe6111337..00000000000 --- a/src/mess/includes/pecom.h +++ /dev/null @@ -1,76 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -#ifndef __PECOM__ -#define __PECOM__ - -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - -#define SCREEN_TAG "screen" -#define CDP1802_TAG "cdp1802" -#define CDP1869_TAG "cdp1869" - -#define PECOM_CHAR_RAM_SIZE 0x800 - -class pecom_state : public driver_device -{ -public: - pecom_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cdp1802(*this, CDP1802_TAG), - m_cdp1869(*this, CDP1869_TAG), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_io_cnt(*this, "CNT") { } - - required_device m_cdp1802; - required_device m_cdp1869; - - UINT8 *m_charram; /* character generator ROM */ - int m_reset; /* CPU mode */ - int m_dma; /* memory refresh DMA */ - - /* timers */ - emu_timer *m_reset_timer; /* power on reset timer */ - - DECLARE_READ8_MEMBER(pecom_cdp1869_charram_r); - DECLARE_WRITE8_MEMBER(pecom_cdp1869_charram_w); - DECLARE_READ8_MEMBER(pecom_cdp1869_pageram_r); - DECLARE_WRITE8_MEMBER(pecom_cdp1869_pageram_w); - DECLARE_WRITE8_MEMBER(pecom_bank_w); - DECLARE_READ8_MEMBER(pecom_keyboard_r); - DECLARE_WRITE8_MEMBER(pecom_cdp1869_w); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_VIDEO_START(pecom); - DECLARE_INPUT_CHANGED_MEMBER(ef_w); - TIMER_CALLBACK_MEMBER(reset_tick); - DECLARE_READ_LINE_MEMBER(clear_r); - DECLARE_READ_LINE_MEMBER(ef2_r); - DECLARE_WRITE_LINE_MEMBER(q_w); - DECLARE_WRITE8_MEMBER( sc_w ); - DECLARE_WRITE_LINE_MEMBER(pecom_prd_w); - CDP1869_CHAR_RAM_READ_MEMBER(pecom_char_ram_r); - CDP1869_CHAR_RAM_WRITE_MEMBER(pecom_char_ram_w); - CDP1869_PCB_READ_MEMBER(pecom_pcb_r); -protected: - required_device m_cassette; - required_device m_ram; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_ioport m_io_cnt; - ioport_port *m_io_ports[26]; -}; - -/* ---------- defined in video/pecom.c ---------- */ - -MACHINE_CONFIG_EXTERN( pecom_video ); - -#endif diff --git a/src/mess/includes/pes.h b/src/mess/includes/pes.h deleted file mode 100644 index 2130901cb3d..00000000000 --- a/src/mess/includes/pes.h +++ /dev/null @@ -1,55 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/*************************************************************************** - - pes.h - -****************************************************************************/ - -#pragma once - -#ifndef _PES_H_ -#define _PES_H_ - -#include "machine/terminal.h" -#include "sound/tms5220.h" -#include "cpu/mcs51/mcs51.h" - -#define TERMINAL_TAG "terminal" - -class pes_state : public driver_device -{ -public: - pes_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG), - m_speech(*this, "tms5220") - { - } - - required_device m_maincpu; - required_device m_terminal; - required_device m_speech; - - UINT8 m_wsstate; // /WS - UINT8 m_rsstate; // /RS - UINT8 m_port3_state; // Port3 state as last written - UINT8 m_infifo[32]; // input fifo - UINT8 m_infifo_tail_ptr; // " tail - UINT8 m_infifo_head_ptr; // " head - - virtual void machine_reset(); - DECLARE_WRITE8_MEMBER(rsws_w); - DECLARE_WRITE8_MEMBER(port1_w); - DECLARE_WRITE8_MEMBER(port3_w); - DECLARE_READ8_MEMBER(port1_r); - DECLARE_READ8_MEMBER(port3_r); - DECLARE_DRIVER_INIT(pes); - DECLARE_WRITE8_MEMBER(pes_kbd_input); - DECLARE_READ8_MEMBER(data_to_i8031); - DECLARE_WRITE8_MEMBER(data_from_i8031); -}; - - -#endif // _PES_H_ diff --git a/src/mess/includes/pet.h b/src/mess/includes/pet.h deleted file mode 100644 index d4572a99c05..00000000000 --- a/src/mess/includes/pet.h +++ /dev/null @@ -1,284 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PET__ -#define __PET__ - -#include "emu.h" -#include "bus/ieee488/c8050.h" -#include "bus/ieee488/ieee488.h" -#include "bus/pet/cass.h" -#include "bus/pet/exp.h" -#include "bus/pet/user.h" -#include "cpu/m6502/m6502.h" -#include "machine/6522via.h" -#include "machine/6821pia.h" -#include "imagedev/snapquik.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/speaker.h" -#include "video/mc6845.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define M6502_TAG "f3" -#define M6522_TAG "a5" -#define M6520_1_TAG "g8" -#define M6520_2_TAG "b8" -#define MC6845_TAG "ub13" -#define SCREEN_TAG "screen" -#define PLA1_TAG "ue6" -#define PLA2_TAG "ue5" -#define PET_USER_PORT_TAG "user" - -class pet_state : public driver_device -{ -public: - pet_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, M6502_TAG), - m_via(*this, M6522_TAG), - m_pia1(*this, M6520_1_TAG), - m_pia2(*this, M6520_2_TAG), - m_crtc(*this, MC6845_TAG), - m_ieee(*this, IEEE488_TAG), - m_palette(*this, "palette"), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_cassette2(*this, PET_DATASSETTE_PORT2_TAG), - m_exp(*this, PET_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_speaker(*this, "speaker"), - m_cart_9000(*this, "cart_9000"), - m_cart_a000(*this, "cart_a000"), - m_cart_b000(*this, "cart_b000"), - m_ram(*this, RAM_TAG), - m_rom(*this, M6502_TAG), - m_char_rom(*this, "charom"), - m_video_ram(*this, "video_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_row8(*this, "ROW8"), - m_row9(*this, "ROW9"), - m_lock(*this, "LOCK"), - m_key(0), - m_sync(0), - m_graphic(0), - m_blanktv(0), - m_via_irq(CLEAR_LINE), - m_pia1a_irq(CLEAR_LINE), - m_pia1b_irq(CLEAR_LINE), - m_pia2a_irq(CLEAR_LINE), - m_pia2b_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE), - m_user_diag(1) - { } - - required_device m_maincpu; - required_device m_via; - required_device m_pia1; - required_device m_pia2; - optional_device m_crtc; - required_device m_ieee; - required_device m_palette; - required_device m_cassette; - required_device m_cassette2; - required_device m_exp; - required_device m_user; - optional_device m_speaker; - optional_device m_cart_9000; - optional_device m_cart_a000; - optional_device m_cart_b000; - required_device m_ram; - required_memory_region m_rom; - required_memory_region m_char_rom; - optional_shared_ptr m_video_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_row8; - required_ioport m_row9; - required_ioport m_lock; - - DECLARE_MACHINE_START( pet ); - DECLARE_MACHINE_START( pet2001 ); - DECLARE_MACHINE_RESET( pet ); - DECLARE_MACHINE_START( pet40 ); - DECLARE_MACHINE_RESET( pet40 ); - - MC6845_BEGIN_UPDATE( pet_begin_update ); - MC6845_UPDATE_ROW( pet40_update_row ); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void check_interrupts(); - void update_speaker(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE_LINE_MEMBER( via_irq_w ); - DECLARE_WRITE8_MEMBER( via_pa_w ); - DECLARE_READ8_MEMBER( via_pb_r ); - DECLARE_WRITE8_MEMBER( via_pb_w ); - DECLARE_WRITE_LINE_MEMBER( via_ca2_w ); - DECLARE_WRITE_LINE_MEMBER( via_cb2_w ); - - DECLARE_WRITE_LINE_MEMBER( pia1_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( pia1_irqb_w ); - DECLARE_READ8_MEMBER( pia1_pa_r ); - DECLARE_READ8_MEMBER( pia1_pb_r ); - DECLARE_WRITE8_MEMBER( pia1_pa_w ); - DECLARE_WRITE_LINE_MEMBER( pia1_ca2_w ); - - DECLARE_WRITE_LINE_MEMBER( pia2_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( pia2_irqb_w ); - - DECLARE_WRITE_LINE_MEMBER( user_diag_w ); - - TIMER_DEVICE_CALLBACK_MEMBER( sync_tick ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_pet ); - - enum - { - SEL0 = 0, - SEL1, - SEL2, - SEL3, - SEL4, - SEL5, - SEL6, - SEL7, - SEL8, - SEL9, - SELA, - SELB, - SELC, - SELD, - SELE, - SELF - }; - - // keyboard state - UINT8 m_key; - - // video state - int m_sync; - int m_graphic; - int m_blanktv; - int m_video_ram_size; - - // sound state - int m_via_cb2; - int m_pia1_pa7; - - UINT8 m_via_pa; - - // interrupt state - int m_via_irq; - int m_pia1a_irq; - int m_pia1b_irq; - int m_pia2a_irq; - int m_pia2b_irq; - int m_exp_irq; - int m_user_diag; -}; - - -class pet2001b_state : public pet_state -{ -public: - pet2001b_state(const machine_config &mconfig, device_type type, const char *tag) : - pet_state(mconfig, type, tag) - { } - - DECLARE_READ8_MEMBER( pia1_pb_r ); -}; - - -class pet80_state : public pet2001b_state -{ -public: - pet80_state(const machine_config &mconfig, device_type type, const char *tag) : - pet2001b_state(mconfig, type, tag) - { } - - DECLARE_MACHINE_START( pet80 ); - DECLARE_MACHINE_RESET( pet80 ); - - MC6845_UPDATE_ROW( pet80_update_row ); - MC6845_UPDATE_ROW( cbm8296_update_row ); -}; - - -class superpet_state : public pet80_state -{ -public: - superpet_state(const machine_config &mconfig, device_type type, const char *tag) - : pet80_state(mconfig, type, tag) - { } -}; - - -class cbm8096_state : public pet80_state -{ -public: - cbm8096_state(const machine_config &mconfig, device_type type, const char *tag) : - pet80_state(mconfig, type, tag) - { } -}; - - -class cbm8296_state : public pet80_state -{ -public: - cbm8296_state(const machine_config &mconfig, device_type type, const char *tag) : - pet80_state(mconfig, type, tag), - m_basic_rom(*this, "basic"), - m_editor_rom(*this, "editor"), - m_ue5_rom(*this, "ue5_eprom"), - m_ue6_rom(*this, "ue6_eprom"), - m_pla1(*this, PLA1_TAG), - m_pla2(*this, PLA2_TAG) - { } - - required_memory_region m_basic_rom; - required_memory_region m_editor_rom; - required_memory_region m_ue5_rom; - required_memory_region m_ue6_rom; - required_device m_pla1; - required_device m_pla2; - - DECLARE_MACHINE_START( cbm8296 ); - DECLARE_MACHINE_RESET( cbm8296 ); - - void read_pla1(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, - int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1); - void read_pla2(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15); - - void read_pla1_eprom(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, - int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1); - void read_pla2_eprom(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - UINT8 m_cr; -}; - - - -#endif diff --git a/src/mess/includes/phc25.h b/src/mess/includes/phc25.h deleted file mode 100644 index 482a543b83b..00000000000 --- a/src/mess/includes/phc25.h +++ /dev/null @@ -1,59 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Robbbert -#pragma once - -#ifndef __PHC25__ -#define __PHC25__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" -#include "machine/ram.h" -#include "bus/centronics/ctronics.h" -#include "video/mc6847.h" -#include "sound/ay8910.h" -#include "formats/phc25_cas.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "z80" -#define AY8910_TAG "ay8910" -#define MC6847_TAG "mc6847" -#define CENTRONICS_TAG "centronics" - -#define PHC25_VIDEORAM_SIZE 0x1800 - -class phc25_state : public driver_device -{ -public: - phc25_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_video_ram(*this, "video_ram") - , m_maincpu(*this, Z80_TAG) - , m_vdg(*this, MC6847_TAG) - , m_centronics(*this, CENTRONICS_TAG) - , m_cassette(*this, "cassette") - { } - - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_READ8_MEMBER( port40_r ); - DECLARE_WRITE8_MEMBER( port40_w ); - DECLARE_WRITE_LINE_MEMBER(irq_w); - DECLARE_READ8_MEMBER( video_ram_r ); - MC6847_GET_CHARROM_MEMBER(ntsc_char_rom_r); - MC6847_GET_CHARROM_MEMBER(pal_char_rom_r); - -private: - virtual void video_start(); - UINT8 *m_char_rom; - UINT8 m_port40; - required_shared_ptr m_video_ram; - required_device m_maincpu; - required_device m_vdg; - required_device m_centronics; - required_device m_cassette; - int m_centronics_busy; -}; - -#endif diff --git a/src/mess/includes/pk8020.h b/src/mess/includes/pk8020.h deleted file mode 100644 index e73fa870187..00000000000 --- a/src/mess/includes/pk8020.h +++ /dev/null @@ -1,108 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/pk8020.h - * - ****************************************************************************/ - -#ifndef PK8020_H_ -#define PK8020_H_ - -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/i8251.h" -#include "machine/wd_fdc.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "machine/ram.h" - - -class pk8020_state : public driver_device -{ -public: - pk8020_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ppi8255_1(*this, "ppi8255_1"), - m_ppi8255_2(*this, "ppi8255_2"), - m_ppi8255_3(*this, "ppi8255_3"), - m_rs232(*this, "rs232"), - m_lan(*this, "lan"), - m_ram(*this, RAM_TAG), - m_wd1793(*this, "wd1793"), - m_floppy0(*this, "wd1793:0"), - m_floppy1(*this, "wd1793:1"), - m_floppy2(*this, "wd1793:2"), - m_floppy3(*this, "wd1793:3"), - m_pit8253(*this, "pit8253"), - m_pic8259(*this, "pic8259"), - m_speaker(*this, "speaker"), - m_region_maincpu(*this, "maincpu"), - m_region_gfx1(*this, "gfx1"), - m_palette(*this, "palette") { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - UINT8 m_color; - UINT8 m_video_page; - UINT8 m_wide; - UINT8 m_font; - UINT8 m_attr; - UINT8 m_text_attr; - UINT8 m_takt; - UINT8 m_video_page_access; - UINT8 m_portc_data; - UINT8 m_sound_gate; - UINT8 m_sound_level; - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_READ8_MEMBER(sysreg_r); - DECLARE_WRITE8_MEMBER(sysreg_w); - DECLARE_READ8_MEMBER(text_r); - DECLARE_WRITE8_MEMBER(text_w); - DECLARE_READ8_MEMBER(gzu_r); - DECLARE_WRITE8_MEMBER(gzu_w); - DECLARE_READ8_MEMBER(devices_r); - DECLARE_WRITE8_MEMBER(devices_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(pk8020); - UINT32 screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(pk8020_interrupt); - DECLARE_READ8_MEMBER(pk8020_porta_r); - DECLARE_WRITE8_MEMBER(pk8020_portc_w); - DECLARE_WRITE8_MEMBER(pk8020_portb_w); - DECLARE_READ8_MEMBER(pk8020_portc_r); - DECLARE_WRITE8_MEMBER(pk8020_2_portc_w); - DECLARE_WRITE_LINE_MEMBER(pk8020_pit_out0); - DECLARE_WRITE_LINE_MEMBER(pk8020_pit_out1); - DECLARE_WRITE_LINE_MEMBER(pk8020_pic_set_int_line); - IRQ_CALLBACK_MEMBER(pk8020_irq_callback); - -protected: - required_device m_maincpu; - required_device m_ppi8255_1; - required_device m_ppi8255_2; - required_device m_ppi8255_3; - required_device m_rs232; - required_device m_lan; - required_device m_ram; - required_device m_wd1793; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_device m_pit8253; - required_device m_pic8259; - required_device m_speaker; - required_memory_region m_region_maincpu; - required_memory_region m_region_gfx1; - ioport_port *m_io_port[16]; - required_device m_palette; - void pk8020_set_bank(UINT8 data); -}; - -#endif /* pk8020_H_ */ diff --git a/src/mess/includes/plus4.h b/src/mess/includes/plus4.h deleted file mode 100644 index adadf6e19ec..00000000000 --- a/src/mess/includes/plus4.h +++ /dev/null @@ -1,176 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PLUS4__ -#define __PLUS4__ - -#include "emu.h" -#include "bus/cbmiec/cbmiec.h" -#include "bus/pet/cass.h" -#include "bus/plus4/exp.h" -#include "bus/plus4/user.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m7501.h" -#include "imagedev/snapquik.h" -#include "machine/mos6529.h" -#include "machine/mos6551.h" -#include "machine/mos8706.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/mos7360.h" - -#define MOS7501_TAG "u2" -#define MOS7360_TAG "u1" -#define MOS6551_TAG "u3" -#define MOS6529_USER_TAG "u5" -#define MOS6529_KB_TAG "u27" -#define T6721A_TAG "t6721a" -#define MOS8706_TAG "mos8706" -#define PLA_TAG "u19" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" -#define PET_USER_PORT_TAG "user" - -class plus4_state : public driver_device -{ -public: - plus4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MOS7501_TAG), - m_pla(*this, PLA_TAG), - m_ted(*this, MOS7360_TAG), - m_acia(*this, MOS6551_TAG), - m_spi_user(*this, MOS6529_USER_TAG), - m_spi_kb(*this, MOS6529_KB_TAG), - m_vslsi(*this, MOS8706_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, PLUS4_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_kernal(*this, "kernal"), - m_function(*this, "function"), - m_c2(*this, "c2"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_lock(*this, "LOCK"), - m_addr(0), - m_ted_irq(CLEAR_LINE), - m_acia_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE) - { } - - required_device m_maincpu; - required_device m_pla; - required_device m_ted; - optional_device m_acia; - optional_device m_spi_user; - required_device m_spi_kb; - optional_device m_vslsi; - required_device m_iec; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - optional_device m_user; - required_device m_ram; - required_device m_cassette; - required_memory_region m_kernal; - optional_memory_region m_function; - optional_memory_region m_c2; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_lock; - - virtual void machine_start(); - virtual void machine_reset(); - - void check_interrupts(); - void bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal); - UINT8 read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal); - UINT8 read_keyboard(UINT8 databus); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( ted_videoram_r ); - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_WRITE_LINE_MEMBER( ted_irq_w ); - DECLARE_READ8_MEMBER( ted_ram_r ); - DECLARE_READ8_MEMBER( ted_rom_r ); - DECLARE_READ8_MEMBER( ted_k_r ); - - DECLARE_WRITE_LINE_MEMBER( write_kb0 ) { if (state) m_kb |= 1; else m_kb &= ~1; } - DECLARE_WRITE_LINE_MEMBER( write_kb1 ) { if (state) m_kb |= 2; else m_kb &= ~2; } - DECLARE_WRITE_LINE_MEMBER( write_kb2 ) { if (state) m_kb |= 4; else m_kb &= ~4; } - DECLARE_WRITE_LINE_MEMBER( write_kb3 ) { if (state) m_kb |= 8; else m_kb &= ~8; } - DECLARE_WRITE_LINE_MEMBER( write_kb4 ) { if (state) m_kb |= 16; else m_kb &= ~16; } - DECLARE_WRITE_LINE_MEMBER( write_kb5 ) { if (state) m_kb |= 32; else m_kb &= ~32; } - DECLARE_WRITE_LINE_MEMBER( write_kb6 ) { if (state) m_kb |= 64; else m_kb &= ~64; } - DECLARE_WRITE_LINE_MEMBER( write_kb7 ) { if (state) m_kb |= 128; else m_kb &= ~128; } - - DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); - - DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c16 ); - - enum - { - CS0_BASIC = 0, - CS0_FUNCTION_LO, - CS0_C1_LOW, - CS0_C2_LOW - }; - - enum - { - CS1_KERNAL = 0, - CS1_FUNCTION_HI, - CS1_C1_HIGH, - CS1_C2_HIGH - }; - - // memory state - UINT8 m_addr; - - // interrupt state - int m_ted_irq; - int m_acia_irq; - int m_exp_irq; - - // keyboard state - UINT8 m_kb; -}; - - -class c16_state : public plus4_state -{ -public: - c16_state(const machine_config &mconfig, device_type type, const char *tag) - : plus4_state(mconfig, type, tag) - { } - - DECLARE_READ8_MEMBER( cpu_r ); -}; - - - -#endif diff --git a/src/mess/includes/pmd85.h b/src/mess/includes/pmd85.h deleted file mode 100644 index 07d9986994b..00000000000 --- a/src/mess/includes/pmd85.h +++ /dev/null @@ -1,155 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/***************************************************************************** - * - * includes/pmd85.h - * - ****************************************************************************/ - -#ifndef PMD85_H_ -#define PMD85_H_ - -#include "machine/i8251.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - - -class pmd85_state : public driver_device -{ -public: - enum - { - TIMER_CASSETTE - }; - - pmd85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_cassette(*this, "cassette"), - m_pit8253(*this, "pit8253"), - m_uart(*this, "uart"), - m_ppi8255_0(*this, "ppi8255_0"), - m_ppi8255_1(*this, "ppi8255_1"), - m_ppi8255_2(*this, "ppi8255_2"), - m_ppi8255_3(*this, "ppi8255_3"), - m_region_maincpu(*this, "maincpu"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_bank5(*this, "bank5"), - m_bank6(*this, "bank6"), - m_bank7(*this, "bank7"), - m_bank8(*this, "bank8"), - m_bank9(*this, "bank9"), - m_bank10(*this, "bank10"), - m_bank11(*this, "bank11"), - m_bank12(*this, "bank12"), - m_bank13(*this, "bank13"), - m_bank14(*this, "bank14"), - m_bank15(*this, "bank15"), - m_bank16(*this, "bank16"), - m_io_dsw0(*this, "DSW0"), - m_palette(*this, "palette") { } - - UINT8 m_rom_module_present; - UINT8 m_ppi_port_outputs[4][3]; - UINT8 m_startup_mem_map; - UINT8 m_pmd853_memory_mapping; - int m_previous_level; - int m_clk_level; - int m_clk_level_tape; - UINT8 m_model; - emu_timer * m_cassette_timer; - void (pmd85_state::*update_memory)(); - DECLARE_READ8_MEMBER(pmd85_io_r); - DECLARE_WRITE8_MEMBER(pmd85_io_w); - DECLARE_READ8_MEMBER(mato_io_r); - DECLARE_WRITE8_MEMBER(mato_io_w); - DECLARE_DRIVER_INIT(mato); - DECLARE_DRIVER_INIT(pmd852a); - DECLARE_DRIVER_INIT(pmd851); - DECLARE_DRIVER_INIT(pmd853); - DECLARE_DRIVER_INIT(alfa); - DECLARE_DRIVER_INIT(c2717); - virtual void machine_reset(); - UINT32 screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback); - DECLARE_WRITE_LINE_MEMBER(write_cas_tx); - DECLARE_READ8_MEMBER(pmd85_ppi_0_porta_r); - DECLARE_READ8_MEMBER(pmd85_ppi_0_portb_r); - DECLARE_READ8_MEMBER(pmd85_ppi_0_portc_r); - DECLARE_WRITE8_MEMBER(pmd85_ppi_0_porta_w); - DECLARE_WRITE8_MEMBER(pmd85_ppi_0_portb_w); - DECLARE_WRITE8_MEMBER(pmd85_ppi_0_portc_w); - DECLARE_READ8_MEMBER(mato_ppi_0_portb_r); - DECLARE_READ8_MEMBER(mato_ppi_0_portc_r); - DECLARE_WRITE8_MEMBER(mato_ppi_0_portc_w); - DECLARE_READ8_MEMBER(pmd85_ppi_1_porta_r); - DECLARE_READ8_MEMBER(pmd85_ppi_1_portb_r); - DECLARE_READ8_MEMBER(pmd85_ppi_1_portc_r); - DECLARE_WRITE8_MEMBER(pmd85_ppi_1_porta_w); - DECLARE_WRITE8_MEMBER(pmd85_ppi_1_portb_w); - DECLARE_WRITE8_MEMBER(pmd85_ppi_1_portc_w); - DECLARE_READ8_MEMBER(pmd85_ppi_2_porta_r); - DECLARE_READ8_MEMBER(pmd85_ppi_2_portb_r); - DECLARE_READ8_MEMBER(pmd85_ppi_2_portc_r); - DECLARE_WRITE8_MEMBER(pmd85_ppi_2_porta_w); - DECLARE_WRITE8_MEMBER(pmd85_ppi_2_portb_w); - DECLARE_WRITE8_MEMBER(pmd85_ppi_2_portc_w); - DECLARE_READ8_MEMBER(pmd85_ppi_3_porta_r); - DECLARE_READ8_MEMBER(pmd85_ppi_3_portb_r); - DECLARE_READ8_MEMBER(pmd85_ppi_3_portc_r); - DECLARE_WRITE8_MEMBER(pmd85_ppi_3_porta_w); - DECLARE_WRITE8_MEMBER(pmd85_ppi_3_portb_w); - DECLARE_WRITE8_MEMBER(pmd85_ppi_3_portc_w); - DECLARE_INPUT_CHANGED_MEMBER(pmd85_reset); - -protected: - required_device m_maincpu; - required_device m_ram; - required_device m_cassette; - required_device m_pit8253; - optional_device m_uart; - optional_device m_ppi8255_0; - optional_device m_ppi8255_1; - optional_device m_ppi8255_2; - optional_device m_ppi8255_3; - required_memory_region m_region_maincpu; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - optional_memory_bank m_bank5; - optional_memory_bank m_bank6; - optional_memory_bank m_bank7; - optional_memory_bank m_bank8; - optional_memory_bank m_bank9; - optional_memory_bank m_bank10; - optional_memory_bank m_bank11; - optional_memory_bank m_bank12; - optional_memory_bank m_bank13; - optional_memory_bank m_bank14; - optional_memory_bank m_bank15; - optional_memory_bank m_bank16; - optional_ioport m_io_dsw0; - ioport_port *m_io_port[16]; - required_device m_palette; - - void pmd851_update_memory(); - void pmd852a_update_memory(); - void pmd853_update_memory(); - void alfa_update_memory(); - void mato_update_memory(); - void c2717_update_memory(); - void pmd85_common_driver_init(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - int m_cas_tx; -}; - - -#endif /* PMD85_H_ */ diff --git a/src/mess/includes/pocketc.h b/src/mess/includes/pocketc.h deleted file mode 100644 index 5edc361dc70..00000000000 --- a/src/mess/includes/pocketc.h +++ /dev/null @@ -1,26 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/pocketc.h - * - ****************************************************************************/ - -#ifndef POCKETC_H_ -#define POCKETC_H_ - -typedef const char *POCKETC_FIGURE[]; - -class pocketc_state : public driver_device -{ -public: - pocketc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } - - DECLARE_PALETTE_INIT(pocketc); - - static const unsigned short pocketc_colortable[8][2]; - void pocketc_draw_special(bitmap_ind16 &bitmap,int x, int y, const POCKETC_FIGURE fig, int color); -}; - -#endif /* POCKETC_H_ */ diff --git a/src/mess/includes/poisk1.h b/src/mess/includes/poisk1.h deleted file mode 100644 index 023b4d5afd9..00000000000 --- a/src/mess/includes/poisk1.h +++ /dev/null @@ -1,101 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/***************************************************************************** - * - * includes/poisk1.h - * - ****************************************************************************/ - -#ifndef POISK1_H_ -#define POISK1_H_ - -#include "imagedev/cassette.h" -#include "machine/i8255.h" -#include "bus/isa/isa.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "machine/ram.h" -#include "bus/isa/xsu_cards.h" -#include "sound/speaker.h" - -#define POISK1_UPDATE_ROW(name) \ - void name(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 *videoram, UINT16 ma, UINT8 ra, UINT8 stride) - -class p1_state : public driver_device -{ -public: - p1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pic8259(*this, "pic8259"), - m_pit8253(*this, "pit8253"), - m_ppi8255n1(*this, "ppi8255n1"), - m_ppi8255n2(*this, "ppi8255n2"), - m_isabus(*this, "isa"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") { } - - required_device m_maincpu; - required_device m_pic8259; - required_device m_pit8253; - required_device m_ppi8255n1; - required_device m_ppi8255n2; - required_device m_isabus; - required_device m_speaker; - required_device m_cassette; - required_device m_ram; - - DECLARE_DRIVER_INIT(poisk1); - DECLARE_MACHINE_START(poisk1); - DECLARE_MACHINE_RESET(poisk1); - - DECLARE_PALETTE_INIT(p1); - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void set_palette_luts(); - POISK1_UPDATE_ROW(cga_gfx_2bpp_update_row); - POISK1_UPDATE_ROW(cga_gfx_1bpp_update_row); - POISK1_UPDATE_ROW(poisk1_gfx_1bpp_update_row); - - DECLARE_WRITE_LINE_MEMBER(p1_pit8253_out2_changed); - DECLARE_WRITE_LINE_MEMBER(p1_speaker_set_spkrdata); - UINT8 m_p1_spkrdata; - UINT8 m_p1_input; - - UINT8 m_kbpoll_mask; - - struct - { - UINT8 trap[4]; - UINT8 *videoram_base; - UINT8 *videoram; - UINT8 mode_control_6a; - UINT8 color_select_68; - UINT8 palette_lut_2bpp[4]; - int stride; - void *update_row(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 *videoram, UINT16 ma, UINT8 ra, UINT8 stride); - } m_video; - - DECLARE_READ8_MEMBER(p1_trap_r); - DECLARE_WRITE8_MEMBER(p1_trap_w); - DECLARE_READ8_MEMBER(p1_cga_r); - DECLARE_WRITE8_MEMBER(p1_cga_w); - DECLARE_WRITE8_MEMBER(p1_vram_w); - - DECLARE_READ8_MEMBER(p1_ppi_r); - DECLARE_WRITE8_MEMBER(p1_ppi_w); - DECLARE_WRITE8_MEMBER(p1_ppi_porta_w); - DECLARE_READ8_MEMBER(p1_ppi_porta_r); - DECLARE_READ8_MEMBER(p1_ppi_portb_r); - DECLARE_READ8_MEMBER(p1_ppi_portc_r); - DECLARE_WRITE8_MEMBER(p1_ppi_portc_w); - DECLARE_WRITE8_MEMBER(p1_ppi2_porta_w); - DECLARE_WRITE8_MEMBER(p1_ppi2_portb_w); - DECLARE_READ8_MEMBER(p1_ppi2_portc_r); - required_device m_palette; - const char *m_cputag; -}; - -#endif /* POISK1_H_ */ diff --git a/src/mess/includes/poly88.h b/src/mess/includes/poly88.h deleted file mode 100644 index 1cdc53463b6..00000000000 --- a/src/mess/includes/poly88.h +++ /dev/null @@ -1,85 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/poly88.h - * - ****************************************************************************/ - -#ifndef POLY88_H_ -#define POLY88_H_ - -#include "machine/i8251.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" - -class poly88_state : public driver_device -{ -public: - enum - { - TIMER_USART, - TIMER_KEYBOARD, - TIMER_CASSETTE - }; - - poly88_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_video_ram(*this, "video_ram"), - m_maincpu(*this, "maincpu"), - m_uart(*this, "uart"), - m_cassette(*this, "cassette"), - m_linec(*this, "LINEC"), - m_line0(*this, "LINE0"), - m_line1(*this, "LINE1"), - m_line2(*this, "LINE2"), - m_line3(*this, "LINE3"), - m_line4(*this, "LINE4"), - m_line5(*this, "LINE5"), - m_line6(*this, "LINE6") { } - - required_shared_ptr m_video_ram; - UINT8 *m_FNT; - UINT8 m_intr; - UINT8 m_last_code; - UINT8 m_int_vector; - emu_timer * m_cassette_timer; - emu_timer * m_usart_timer; - int m_previous_level; - int m_clk_level; - int m_clk_level_tape; - DECLARE_WRITE8_MEMBER(poly88_baud_rate_w); - DECLARE_READ8_MEMBER(poly88_keyboard_r); - DECLARE_WRITE8_MEMBER(poly88_intr_w); - DECLARE_DRIVER_INIT(poly88); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_poly88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(poly88_interrupt); - TIMER_CALLBACK_MEMBER(poly88_usart_timer_callback); - TIMER_CALLBACK_MEMBER(keyboard_callback); - TIMER_CALLBACK_MEMBER(poly88_cassette_timer_callback); - DECLARE_WRITE_LINE_MEMBER(write_cas_tx); - DECLARE_WRITE_LINE_MEMBER(poly88_usart_rxready); - IRQ_CALLBACK_MEMBER(poly88_irq_callback); - DECLARE_SNAPSHOT_LOAD_MEMBER( poly88 ); - -protected: - required_device m_maincpu; - required_device m_uart; - required_device m_cassette; - required_ioport m_linec; - required_ioport m_line0; - required_ioport m_line1; - required_ioport m_line2; - required_ioport m_line3; - required_ioport m_line4; - required_ioport m_line5; - required_ioport m_line6; - UINT8 row_number(UINT8 code); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - int m_cas_tx; -}; - -#endif /* POLY88_H_ */ diff --git a/src/mess/includes/poly880.h b/src/mess/includes/poly880.h deleted file mode 100644 index b92ed0a92f4..00000000000 --- a/src/mess/includes/poly880.h +++ /dev/null @@ -1,59 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __POLY880__ -#define __POLY880__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "imagedev/cassette.h" -#include "machine/z80pio.h" -#include "machine/z80ctc.h" -#include "machine/ram.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "i1" -#define Z80CTC_TAG "i4" -#define Z80PIO1_TAG "i2" -#define Z80PIO2_TAG "i3" - -class poly880_state : public driver_device -{ -public: - poly880_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_cassette(*this, "cassette"), - m_ki1(*this, "KI1"), - m_ki2(*this, "KI2"), - m_ki3(*this, "KI3") - { } - - required_device m_maincpu; - required_device m_cassette; - required_ioport m_ki1; - required_ioport m_ki2; - required_ioport m_ki3; - - virtual void machine_start(); - - DECLARE_WRITE8_MEMBER( cldig_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z1_w ); - DECLARE_WRITE8_MEMBER( pio1_pa_w ); - DECLARE_READ8_MEMBER( pio1_pb_r ); - DECLARE_WRITE8_MEMBER( pio1_pb_w ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); - - void update_display(); - - /* display state */ - UINT8 m_digit; - UINT8 m_segment; -}; - -#endif diff --git a/src/mess/includes/portfoli.h b/src/mess/includes/portfoli.h deleted file mode 100644 index e02a206f0e4..00000000000 --- a/src/mess/includes/portfoli.h +++ /dev/null @@ -1,123 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PORTFOLIO__ -#define __PORTFOLIO__ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8255.h" -#include "machine/ins8250.h" -#include "machine/nvram.h" -#include "machine/ram.h" -#include "sound/speaker.h" -#include "video/hd61830.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define M80C88A_TAG "u1" -#define M82C55A_TAG "hpc101_u1" -#define M82C50A_TAG "hpc102_u1" -#define HD61830_TAG "hd61830" -#define CENTRONICS_TAG "centronics" -#define TIMER_TICK_TAG "tick" -#define SCREEN_TAG "screen" -#define RS232_TAG "rs232" - -class portfolio_state : public driver_device -{ -public: - portfolio_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M80C88A_TAG), - m_lcdc(*this, HD61830_TAG), - m_ppi(*this, M82C55A_TAG), - m_uart(*this, M82C50A_TAG), - m_speaker(*this, "speaker"), - m_timer_tick(*this, TIMER_TICK_TAG), - m_rom(*this, M80C88A_TAG), - m_char_rom(*this, HD61830_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_battery(*this, "BATTERY"), - m_contrast(*this, "contrast"), - m_ram(*this, RAM_TAG) - { } - - required_device m_maincpu; - required_device m_lcdc; - required_device m_ppi; - required_device m_uart; - required_device m_speaker; - required_device m_timer_tick; - required_region_ptr m_rom; - required_region_ptr m_char_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_battery; - - virtual void machine_start(); - virtual void machine_reset(); - - void check_interrupt(); - void trigger_interrupt(int level); - void scan_keyboard(); - - DECLARE_READ8_MEMBER( irq_status_r ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_READ8_MEMBER( battery_r ); - DECLARE_READ8_MEMBER( counter_r ); - DECLARE_READ8_MEMBER( pid_r ); - - DECLARE_WRITE8_MEMBER( irq_mask_w ); - DECLARE_WRITE8_MEMBER( sivr_w ); - DECLARE_WRITE8_MEMBER( speaker_w ); - DECLARE_WRITE8_MEMBER( power_w ); - DECLARE_WRITE8_MEMBER( unknown_w ); - DECLARE_WRITE8_MEMBER( counter_w ); - DECLARE_WRITE8_MEMBER( ncc1_w ); - - DECLARE_WRITE_LINE_MEMBER( i8250_intrpt_w ); - - /* interrupt state */ - UINT8 m_ip; /* interrupt pending */ - UINT8 m_ie; /* interrupt enable */ - UINT8 m_sivr; /* serial interrupt vector register */ - - /* counter state */ - UINT16 m_counter; - - /* keyboard state */ - UINT8 m_keylatch; - - /* video state */ - required_shared_ptr m_contrast; - - /* peripheral state */ - UINT8 m_pid; /* peripheral identification */ - DECLARE_PALETTE_INIT(portfolio); - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick); - TIMER_DEVICE_CALLBACK_MEMBER(system_tick); - TIMER_DEVICE_CALLBACK_MEMBER(counter_tick); - DECLARE_READ8_MEMBER(hd61830_rd_r); - IRQ_CALLBACK_MEMBER(portfolio_int_ack); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( portfolio_cart ); - required_device m_ram; -}; - -#endif diff --git a/src/mess/includes/pp01.h b/src/mess/includes/pp01.h deleted file mode 100644 index d405563bcdc..00000000000 --- a/src/mess/includes/pp01.h +++ /dev/null @@ -1,66 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/pp01.h - * - ****************************************************************************/ - -#ifndef PP01_H_ -#define PP01_H_ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/ram.h" -#include "machine/i8251.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "sound/speaker.h" -//#include "sound/wave.h" -//#include "imagedev/cassette.h" - -class pp01_state : public driver_device -{ -public: - pp01_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pit(*this, "pit8253"), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG) { } - - required_device m_maincpu; - required_device m_pit; - required_device m_speaker; - required_device m_ram; - UINT8 m_video_scroll; - UINT8 m_memory_block[16]; - UINT8 m_video_write_mode; - UINT8 m_key_line; - DECLARE_WRITE8_MEMBER(pp01_video_write_mode_w); - DECLARE_WRITE8_MEMBER(pp01_video_r_1_w); - DECLARE_WRITE8_MEMBER(pp01_video_g_1_w); - DECLARE_WRITE8_MEMBER(pp01_video_b_1_w); - DECLARE_WRITE8_MEMBER(pp01_video_r_2_w); - DECLARE_WRITE8_MEMBER(pp01_video_g_2_w); - DECLARE_WRITE8_MEMBER(pp01_video_b_2_w); - DECLARE_WRITE8_MEMBER(pp01_mem_block_w); - DECLARE_READ8_MEMBER(pp01_mem_block_r); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(pp01); - UINT32 screen_update_pp01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(pp01_pit_out0); - DECLARE_WRITE_LINE_MEMBER(pp01_pit_out1); - DECLARE_READ8_MEMBER(pp01_8255_porta_r); - DECLARE_WRITE8_MEMBER(pp01_8255_porta_w); - DECLARE_READ8_MEMBER(pp01_8255_portb_r); - DECLARE_WRITE8_MEMBER(pp01_8255_portb_w); - DECLARE_WRITE8_MEMBER(pp01_8255_portc_w); - DECLARE_READ8_MEMBER(pp01_8255_portc_r); - void pp01_video_w(UINT8 block,UINT16 offset,UINT8 data,UINT8 part); - void pp01_set_memory(UINT8 block, UINT8 data); -}; - -#endif diff --git a/src/mess/includes/primo.h b/src/mess/includes/primo.h deleted file mode 100644 index ef58558bc7f..00000000000 --- a/src/mess/includes/primo.h +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/***************************************************************************** - * - * includes/primo.h - * - ****************************************************************************/ - -#ifndef PRIMO_H_ -#define PRIMO_H_ - -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "bus/cbmiec/cbmiec.h" -#include "sound/speaker.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -class primo_state : public driver_device -{ -public: - primo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_iec(*this, CBM_IEC_TAG), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_cart1(*this, "cartslot1"), - m_cart2(*this, "cartslot2") - { } - - required_device m_maincpu; - required_device m_iec; - required_device m_speaker; - required_device m_cassette; - required_device m_cart1; - required_device m_cart2; - - memory_region *m_cart1_rom; - memory_region *m_cart2_rom; - - UINT16 m_video_memory_base; - UINT8 m_port_FD; - int m_nmi; - DECLARE_READ8_MEMBER(primo_be_1_r); - DECLARE_READ8_MEMBER(primo_be_2_r); - DECLARE_WRITE8_MEMBER(primo_ki_1_w); - DECLARE_WRITE8_MEMBER(primo_ki_2_w); - DECLARE_WRITE8_MEMBER(primo_FD_w); - DECLARE_DRIVER_INIT(primo48); - DECLARE_DRIVER_INIT(primo64); - DECLARE_DRIVER_INIT(primo32); - virtual void machine_reset(); - virtual void machine_start(); - DECLARE_MACHINE_RESET(primob); - UINT32 screen_update_primo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(primo_vblank_interrupt); - void primo_draw_scanline(bitmap_ind16 &bitmap, int primo_scanline); - void primo_update_memory(); - void primo_common_driver_init (primo_state *state); - void primo_common_machine_init (); - void primo_setup_pss (UINT8* snapshot_data, UINT32 snapshot_size); - void primo_setup_pp (UINT8* quickload_data, UINT32 quickload_size); - DECLARE_SNAPSHOT_LOAD_MEMBER( primo ); - DECLARE_QUICKLOAD_LOAD_MEMBER( primo ); -}; - - -#endif /* PRIMO_H_ */ diff --git a/src/mess/includes/prof180x.h b/src/mess/includes/prof180x.h deleted file mode 100644 index 0c38e6d183f..00000000000 --- a/src/mess/includes/prof180x.h +++ /dev/null @@ -1,48 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PROF180X__ -#define __PROF180X__ - -#define HD64180_TAG "hd64180" -#define FDC9268_TAG "fdc9268" -#define FDC9229_TAG "fdc9229" -#define MK3835_TAG "mk3835" -#define SCREEN_TAG "screen" -#define CENTRONICS_TAG "centronics" - -class prof180x_state : public driver_device -{ -public: - prof180x_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_centronics(*this, CENTRONICS_TAG) - { - } - - required_device m_centronics; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE8_MEMBER( flr_w ); - DECLARE_READ8_MEMBER( status0_r ); - DECLARE_READ8_MEMBER( status1_r ); - DECLARE_READ8_MEMBER( status_r ); - - void ls259_w(int flag, int value); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - int m_c0; - int m_c1; - int m_c2; - int m_mm0; - int m_mm1; -}; - -#endif diff --git a/src/mess/includes/prof80.h b/src/mess/includes/prof80.h deleted file mode 100644 index 5a48f376196..00000000000 --- a/src/mess/includes/prof80.h +++ /dev/null @@ -1,98 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PROF80__ -#define __PROF80__ - -#include "bus/ecbbus/ecbbus.h" -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/prof80mmu.h" -#include "machine/ram.h" -#include "machine/rescap.h" -#include "machine/upd1990a.h" -#include "machine/upd765.h" - -#define Z80_TAG "z1" -#define MMU_TAG "mmu" -#define UPD765_TAG "z38" -#define UPD1990A_TAG "z43" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" - -// ------------------------------------------------------------------------ - -#define UNIO_Z80STI_TAG "z5" -#define UNIO_Z80SIO_TAG "z15" -#define UNIO_Z80PIO_TAG "z13" -#define UNIO_CENTRONICS1_TAG "n3" -#define UNIO_CENTRONICS2_TAG "n4" - -class prof80_state : public driver_device -{ -public: - prof80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_mmu(*this, MMU_TAG), - m_rtc(*this, UPD1990A_TAG), - m_fdc(*this, UPD765_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, UPD765_TAG":0"), - m_floppy1(*this, UPD765_TAG":1"), - m_ecb(*this, ECBBUS_TAG), - m_rs232a(*this, RS232_A_TAG), - m_rs232b(*this, RS232_B_TAG), - m_rom(*this, Z80_TAG), - m_j4(*this, "J4"), - m_j5(*this, "J5") - { } - - required_device m_maincpu; - required_device m_mmu; - required_device m_rtc; - required_device m_fdc; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_ecb; - required_device m_rs232a; - required_device m_rs232b; - required_memory_region m_rom; - required_ioport m_j4; - required_ioport m_j5; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void machine_start(); - virtual void machine_reset(); - - enum - { - TIMER_ID_MOTOR - }; - - DECLARE_WRITE8_MEMBER( flr_w ); - DECLARE_READ8_MEMBER( status_r ); - DECLARE_READ8_MEMBER( status2_r ); - - void ls259_w(int fa, int sa, int fb, int sb); - void motor(int mon); - - // RTC state - int m_c0; - int m_c1; - int m_c2; - - // floppy state - int m_motor; - int m_ready; - int m_select; - - // timers - emu_timer *m_floppy_motor_off_timer; - -}; - -#endif diff --git a/src/mess/includes/psion.h b/src/mess/includes/psion.h deleted file mode 100644 index 65d5648f601..00000000000 --- a/src/mess/includes/psion.h +++ /dev/null @@ -1,104 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Psion Organiser II series - -****************************************************************************/ - -#pragma once - -#ifndef _PSION_H_ -#define _PSION_H_ - -#include "cpu/m6800/m6800.h" -#include "machine/nvram.h" -#include "machine/psion_pack.h" -#include "video/hd44780.h" -#include "sound/beep.h" - - -// ======================> psion_state - -class psion_state : public driver_device -{ -public: - psion_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_lcdc(*this, "hd44780"), - m_beep(*this, "beeper"), - m_pack1(*this, "pack1"), - m_pack2(*this, "pack2"), - m_nvram1(*this, "nvram1"), - m_nvram2(*this, "nvram2"), - m_nvram3(*this, "nvram3"), - m_sys_register(*this, "sys_register"), - m_stby_pwr(1), - m_ram(*this, "ram"){ } - - required_device m_maincpu; - required_device m_lcdc; - required_device m_beep; - required_device m_pack1; - required_device m_pack2; - required_device m_nvram1; - required_device m_nvram2; - optional_device m_nvram3; - - UINT16 m_kb_counter; - UINT8 m_enable_nmi; - optional_shared_ptr m_sys_register; - UINT8 m_tcsr_value; - UINT8 m_stby_pwr; - UINT8 m_pulse; - - UINT8 m_port2_ddr; // datapack i/o ddr - UINT8 m_port2; // datapack i/o data bus - UINT8 m_port6_ddr; // datapack control lines ddr - UINT8 m_port6; // datapack control lines - - // RAM/ROM banks - required_shared_ptr m_ram; - UINT8 *m_paged_ram; - UINT8 m_rom_bank; - UINT8 m_ram_bank; - UINT8 m_ram_bank_count; - UINT8 m_rom_bank_count; - - virtual void machine_start(); - virtual void machine_reset(); - void nvram_init(nvram_device &nvram, void *data, size_t size); - - UINT8 kb_read(); - void update_banks(); - DECLARE_WRITE8_MEMBER( hd63701_int_reg_w ); - DECLARE_READ8_MEMBER( hd63701_int_reg_r ); - void io_rw(address_space &space, UINT16 offset); - DECLARE_WRITE8_MEMBER( io_w ); - DECLARE_READ8_MEMBER( io_r ); - DECLARE_PALETTE_INIT(psion); - DECLARE_INPUT_CHANGED_MEMBER(psion_on); - TIMER_DEVICE_CALLBACK_MEMBER(nmi_timer); - - static HD44780_PIXEL_UPDATE(lz_pixel_update); -}; - - -class psion1_state : public psion_state -{ -public: - psion1_state(const machine_config &mconfig, device_type type, const char *tag) - : psion_state(mconfig, type, tag) - { } - - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( reset_kb_counter_r ); - DECLARE_READ8_MEMBER( inc_kb_counter_r ); - DECLARE_READ8_MEMBER( switchoff_r ); - - static HD44780_PIXEL_UPDATE(psion1_pixel_update); -}; - -#endif // _PSION_H_ diff --git a/src/mess/includes/px8.h b/src/mess/includes/px8.h deleted file mode 100644 index 22034809b86..00000000000 --- a/src/mess/includes/px8.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Curt Coder,Dirk Best -#pragma once - -#ifndef __PX8__ -#define __PX8__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/m6800/m6800.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "machine/i8251.h" -#include "bus/epson_sio/pf10.h" -#include "sound/wave.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define UPD70008_TAG "4a" -#define UPD7508_TAG "2e" -#define HD6303_TAG "13d" -#define SED1320_TAG "7c" -#define I8251_TAG "13e" -#define UPD7001_TAG "1d" -#define SCREEN_TAG "screen" - -#define PX8_VIDEORAM_MASK 0x17ff - -class px8_state : public driver_device -{ -public: - px8_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, UPD70008_TAG), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_video_ram(*this, "video_ram"){ } - - required_device m_maincpu; - required_device m_cassette; - required_device m_ram; - /* video state */ - required_shared_ptr m_video_ram; /* LCD video RAM */ - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( gah40m_r ); - DECLARE_WRITE8_MEMBER( gah40m_w ); - DECLARE_READ8_MEMBER( gah40s_r ); - DECLARE_WRITE8_MEMBER( gah40s_w ); - DECLARE_WRITE8_MEMBER( gah40s_ier_w ); - DECLARE_READ8_MEMBER( krtn_0_3_r ); - DECLARE_READ8_MEMBER( krtn_4_7_r ); - DECLARE_WRITE8_MEMBER( ksc_w ); - - void bankswitch(); - UINT8 krtn_read(); - - /* GAH40M state */ - UINT16 m_icr; /* input capture register */ - UINT16 m_frc; /* free running counter */ - UINT8 m_ier; /* interrupt acknowledge register */ - UINT8 m_isr; /* interrupt status register */ - UINT8 m_sio; /* serial I/O register */ - int m_bank0; /* */ - - /* GAH40S state */ - UINT16 m_cnt; /* microcassette tape counter */ - int m_swpr; /* P-ROM power switch */ - UINT16 m_pra; /* P-ROM address */ - UINT8 m_prd; /* P-ROM data */ - - /* memory state */ - int m_bk2; /* */ - - /* keyboard state */ - int m_ksc; /* keyboard scan column */ - DECLARE_PALETTE_INIT(px8); - UINT32 screen_update_px8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - -#endif diff --git a/src/mess/includes/ql.h b/src/mess/includes/ql.h deleted file mode 100644 index ad2b14039ac..00000000000 --- a/src/mess/includes/ql.h +++ /dev/null @@ -1,143 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Phill Harvey-Smith -#pragma once - -#ifndef __QL__ -#define __QL__ - -#include "emu.h" -#include "bus/ql/exp.h" -#include "bus/ql/rom.h" -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/microdrv.h" -#include "machine/qimi.h" -#include "machine/ram.h" -#include "machine/zx8302.h" -#include "sound/speaker.h" -#include "video/zx8301.h" - -#define SCREEN_TAG "screen" - -#define M68008_TAG "ic18" -#define I8749_TAG "ic24" -#define I8051_TAG "i8051" -#define ZX8301_TAG "ic22" -#define ZX8302_TAG "ic23" -#define RS232_A_TAG "ser1" -#define RS232_B_TAG "ser2" -#define QIMI_TAG "qimi" - -#define X1 XTAL_15MHz -#define X2 XTAL_32_768kHz -#define X3 XTAL_4_436MHz -#define X4 XTAL_11MHz - -class ql_state : public driver_device -{ -public: - ql_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, M68008_TAG), - m_ipc(*this, I8749_TAG), - m_zx8301(*this, ZX8301_TAG), - m_zx8302(*this, ZX8302_TAG), - m_speaker(*this, "speaker"), - m_mdv1(*this, MDV_1), - m_mdv2(*this, MDV_2), - m_ser1(*this, RS232_A_TAG), - m_ser2(*this, RS232_A_TAG), - m_ram(*this, RAM_TAG), - m_exp(*this, "exp"), - m_cart(*this, "rom"), - m_qimi(*this, QIMI_TAG), - m_rom(*this, M68008_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_joy0(*this, "JOY0"), - m_joy1(*this, "JOY1"), - m_config(*this, "config"), - m_extintl(CLEAR_LINE), - m_keylatch(0), - m_ipl(0), - m_comdata_to_ipc(0), - m_baudx4(0), - m_qimi_enabled(false), - m_qimi_extint(CLEAR_LINE) - { } - - required_device m_maincpu; - required_device m_ipc; - required_device m_zx8301; - required_device m_zx8302; - required_device m_speaker; - required_device m_mdv1; - required_device m_mdv2; - required_device m_ser1; - required_device m_ser2; - required_device m_ram; - required_device m_exp; - required_device m_cart; - optional_device m_qimi; - required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_joy0; - required_ioport m_joy1; - required_ioport m_config; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE8_MEMBER( ipc_w ); - DECLARE_WRITE8_MEMBER( ipc_port1_w ); - DECLARE_WRITE8_MEMBER( ipc_port2_w ); - DECLARE_READ8_MEMBER( ipc_port2_r ); - DECLARE_READ8_MEMBER( ipc_t1_r ); - DECLARE_READ8_MEMBER( ipc_bus_r ); - DECLARE_READ8_MEMBER( ql_ram_r ); - DECLARE_WRITE8_MEMBER( ql_ram_w ); - DECLARE_WRITE_LINE_MEMBER( ql_baudx4_w ); - DECLARE_WRITE_LINE_MEMBER( ql_comdata_w ); - DECLARE_WRITE_LINE_MEMBER( zx8302_mdselck_w ); - DECLARE_WRITE_LINE_MEMBER( zx8302_mdrdw_w ); - DECLARE_WRITE_LINE_MEMBER( zx8302_erase_w ); - DECLARE_WRITE_LINE_MEMBER( zx8302_raw1_w ); - DECLARE_READ_LINE_MEMBER( zx8302_raw1_r ); - DECLARE_WRITE_LINE_MEMBER( zx8302_raw2_w ); - DECLARE_READ_LINE_MEMBER( zx8302_raw2_r ); - DECLARE_WRITE_LINE_MEMBER( exp_extintl_w ); - DECLARE_WRITE_LINE_MEMBER( qimi_extintl_w ); - - void update_interrupt(); - - int m_extintl; - - // IPC - UINT8 m_keylatch; - int m_ipl; - int m_comdata_to_ipc; - int m_baudx4; - - // QIMI - bool m_qimi_enabled; - int m_qimi_extint; -}; - -#endif diff --git a/src/mess/includes/radio86.h b/src/mess/includes/radio86.h deleted file mode 100644 index 2dd9f3298e8..00000000000 --- a/src/mess/includes/radio86.h +++ /dev/null @@ -1,129 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/radio86.h - * - ****************************************************************************/ - -#ifndef radio86_H_ -#define radio86_H_ - -#include "machine/i8255.h" -#include "machine/i8257.h" -#include "video/i8275.h" -#include "imagedev/cassette.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class radio86_state : public driver_device -{ -public: - enum - { - TIMER_RESET - }; - - radio86_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_dma8257(*this, "dma8257"), - m_ppi8255_1(*this, "ppi8255_1"), - m_ppi8255_2(*this, "ppi8255_2"), - m_region_maincpu(*this, "maincpu"), - m_bank1(*this, "bank1"), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_line4(*this, "LINE4"), - m_io_line5(*this, "LINE5"), - m_io_line6(*this, "LINE6"), - m_io_line7(*this, "LINE7"), - m_io_line8(*this, "LINE8"), - m_io_cline0(*this, "CLINE0"), - m_io_cline1(*this, "CLINE1"), - m_io_cline2(*this, "CLINE2"), - m_io_cline3(*this, "CLINE3"), - m_io_cline4(*this, "CLINE4"), - m_io_cline5(*this, "CLINE5"), - m_io_cline6(*this, "CLINE6"), - m_io_cline7(*this, "CLINE7"), - m_palette(*this, "palette") { } - - virtual void video_start(); - - UINT8 m_tape_value; - UINT8 m_mikrosha_font_page; - int m_keyboard_mask; - UINT8* m_radio_ram_disk; - UINT8 m_romdisk_lsb; - UINT8 m_romdisk_msb; - UINT8 m_disk_sel; - const UINT8 *m_charmap; - DECLARE_READ8_MEMBER(radio_cpu_state_r); - DECLARE_READ8_MEMBER(radio_io_r); - DECLARE_WRITE8_MEMBER(radio_io_w); - DECLARE_WRITE8_MEMBER(radio86_pagesel); - DECLARE_DRIVER_INIT(radioram); - DECLARE_DRIVER_INIT(radio86); - DECLARE_MACHINE_RESET(radio86); - DECLARE_PALETTE_INIT(radio86); - DECLARE_READ8_MEMBER(radio86_8255_portb_r2); - DECLARE_READ8_MEMBER(radio86_8255_portc_r2); - DECLARE_WRITE8_MEMBER(radio86_8255_porta_w2); - DECLARE_WRITE8_MEMBER(radio86_8255_portc_w2); - DECLARE_READ8_MEMBER(rk7007_8255_portc_r); - DECLARE_WRITE_LINE_MEMBER(hrq_w); - DECLARE_READ8_MEMBER(radio86rom_romdisk_porta_r); - DECLARE_READ8_MEMBER(radio86ram_romdisk_porta_r); - DECLARE_WRITE8_MEMBER(radio86_romdisk_portb_w); - DECLARE_WRITE8_MEMBER(radio86_romdisk_portc_w); - DECLARE_WRITE8_MEMBER(mikrosha_8255_font_page_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - I8275_DRAW_CHARACTER_MEMBER(display_pixels); - required_device m_maincpu; - -protected: - required_device m_cassette; - optional_device m_cart; // for ROMDisk - only Radio86K & Orion? - optional_device m_dma8257; - required_device m_ppi8255_1; - optional_device m_ppi8255_2; - required_memory_region m_region_maincpu; - required_memory_bank m_bank1; - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - required_ioport m_io_line3; - required_ioport m_io_line4; - required_ioport m_io_line5; - required_ioport m_io_line6; - required_ioport m_io_line7; - required_ioport m_io_line8; - optional_ioport m_io_cline0; - optional_ioport m_io_cline1; - optional_ioport m_io_cline2; - optional_ioport m_io_cline3; - optional_ioport m_io_cline4; - optional_ioport m_io_cline5; - optional_ioport m_io_cline6; - optional_ioport m_io_cline7; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - void radio86_init_keyboard(); -public: - required_device m_palette; -}; - - -/*----------- defined in drivers/radio86.c -----------*/ - -INPUT_PORTS_EXTERN( radio86 ); -INPUT_PORTS_EXTERN( ms7007 ); - -#endif /* radio86_H_ */ diff --git a/src/mess/includes/rm380z.h b/src/mess/includes/rm380z.h deleted file mode 100644 index b3b47a23bfd..00000000000 --- a/src/mess/includes/rm380z.h +++ /dev/null @@ -1,138 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol,Gabriele D'Antona - -/* - -Research Machines RM 380Z - -*/ - -#ifndef RM380Z_H_ -#define RM380Z_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "imagedev/flopdrv.h" -#include "machine/wd_fdc.h" -#include "machine/keyboard.h" - -// -// -// - -#define RM380Z_MAINCPU_TAG "maincpu" -#define RM380Z_PORTS_ENABLED_HIGH ( m_port0 & 0x80 ) -#define RM380Z_PORTS_ENABLED_LOW ( ( m_port0 & 0x80 ) == 0x00 ) - -#define RM380Z_VIDEOMODE_40COL 0x01 -#define RM380Z_VIDEOMODE_80COL 0x02 - -#define RM380Z_CHDIMX 5 -#define RM380Z_CHDIMY 9 -#define RM380Z_NCX 8 -#define RM380Z_NCY 16 -#define RM380Z_SCREENCOLS 80 -#define RM380Z_SCREENROWS 24 - -#define RM380Z_VIDEORAM_SIZE 0x600 -#define RM380Z_SCREENSIZE 0x1200 - - -// -// -// - - -class rm380z_state : public driver_device -{ -private: - - void put_point(int charnum,int x,int y,int col); - void init_graphic_chars(); - - void putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bitmap,unsigned char* chsb,int vmode); - void decode_videoram_char(int pos,UINT8& chr,UINT8& attrib); - void scroll_videoram(); - void config_videomode(); - void check_scroll_register(); - - int writenum; - -protected: - virtual void machine_reset(); - virtual void machine_start(); - -public: - - UINT8 m_port0; - UINT8 m_port0_kbd; - UINT8 m_port1; - UINT8 m_fbfd; - UINT8 m_fbfe; - - UINT8 m_graphic_chars[0x80][(RM380Z_CHDIMX+1)*(RM380Z_CHDIMY+1)]; - - UINT8 m_mainVideoram[RM380Z_VIDEORAM_SIZE]; - UINT8 m_vramchars[RM380Z_SCREENSIZE]; - UINT8 m_vramattribs[RM380Z_SCREENSIZE]; - UINT8 m_vram[RM380Z_SCREENSIZE]; - - int m_rasterlineCtr; - emu_timer* m_vblankTimer; - - int m_old_fbfd; - int m_old_old_fbfd; - - int m_videomode; - int m_old_videomode; - - required_device m_maincpu; - required_device m_messram; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - - rm380z_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, RM380Z_MAINCPU_TAG), - m_messram(*this, RAM_TAG), - m_fdc(*this, "wd1771"), - m_floppy0(*this, "wd1771:0"), - m_floppy1(*this, "wd1771:1") - { - } - - DECLARE_WRITE8_MEMBER( port_write ); - DECLARE_READ8_MEMBER( port_read ); - DECLARE_WRITE8_MEMBER( port_write_1b00 ); - DECLARE_READ8_MEMBER( port_read_1b00 ); - - DECLARE_READ8_MEMBER( main_read ); - DECLARE_WRITE8_MEMBER( main_write ); - - DECLARE_READ8_MEMBER( videoram_read ); - DECLARE_WRITE8_MEMBER( videoram_write ); - - UINT8 hiram[0x1000]; - DECLARE_READ8_MEMBER( hiram_read ); - DECLARE_WRITE8_MEMBER( hiram_write ); - - DECLARE_READ8_MEMBER( rm380z_portlow_r ); - DECLARE_WRITE8_MEMBER( rm380z_portlow_w ); - DECLARE_READ8_MEMBER( rm380z_porthi_r ); - DECLARE_WRITE8_MEMBER( rm380z_porthi_w ); - - DECLARE_WRITE8_MEMBER(disk_0_control); - - DECLARE_WRITE8_MEMBER( keyboard_put ); - - void config_memory_map(); - int keyboard_decode(); - void update_screen(bitmap_ind16 &bitmap); - UINT32 screen_update_rm380z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(static_vblank_timer); -}; - - -#endif diff --git a/src/mess/includes/rmnimbus.h b/src/mess/includes/rmnimbus.h deleted file mode 100644 index 3d0cba8e05c..00000000000 --- a/src/mess/includes/rmnimbus.h +++ /dev/null @@ -1,222 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phill Harvey-Smith, Carl -/* - rmnimbus.c - Machine driver for the Research Machines Nimbus. - - Phill Harvey-Smith - 2009-11-29. -*/ -#include "emu.h" -#include "cpu/i86/i186.h" -#include "machine/z80dart.h" -#include "machine/wd_fdc.h" -#include "bus/scsi/scsi.h" -#include "machine/6522via.h" -#include "machine/ram.h" -#include "machine/eepromser.h" -#include "sound/ay8910.h" -#include "sound/msm5205.h" -#include "bus/centronics/ctronics.h" - -#define MAINCPU_TAG "maincpu" -#define IOCPU_TAG "iocpu" -#define Z80SIO_TAG "z80sio" -#define FDC_TAG "wd2793" -#define SCSIBUS_TAG "scsibus" -#define ER59256_TAG "er59256" -#define AY8910_TAG "ay8910" -#define MONO_TAG "mono" -#define MSM5205_TAG "msm5205" -#define VIA_TAG "via6522" -#define CENTRONICS_TAG "centronics" - -/* Mouse / Joystick */ - -#define JOYSTICK0_TAG "joystick0" -#define MOUSE_BUTTON_TAG "mousebtn" -#define MOUSEX_TAG "mousex" -#define MOUSEY_TAG "mousey" - -/* Memory controller */ -#define RAM_BANK00_TAG "bank0" -#define RAM_BANK01_TAG "bank1" -#define RAM_BANK02_TAG "bank2" -#define RAM_BANK03_TAG "bank3" -#define RAM_BANK04_TAG "bank4" -#define RAM_BANK05_TAG "bank5" -#define RAM_BANK06_TAG "bank6" -#define RAM_BANK07_TAG "bank7" - -class rmnimbus_state : public driver_device -{ -public: - rmnimbus_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_msm(*this, MSM5205_TAG), - m_scsibus(*this, SCSIBUS_TAG), - m_ram(*this, RAM_TAG), - m_eeprom(*this, ER59256_TAG), - m_via(*this, VIA_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_palette(*this, "palette"), - m_scsi_data_out(*this, "scsi_data_out"), - m_scsi_data_in(*this, "scsi_data_in"), - m_scsi_ctrl_out(*this, "scsi_ctrl_out"), - m_fdc(*this, FDC_TAG), - m_z80sio(*this, Z80SIO_TAG), - m_screen(*this, "screen"), - m_io_config(*this, "config"), - m_io_joystick0(*this, JOYSTICK0_TAG), - m_io_mouse_button(*this, MOUSE_BUTTON_TAG), - m_io_mousex(*this, MOUSEX_TAG), - m_io_mousey(*this, MOUSEY_TAG) - { - } - - required_device m_maincpu; - required_device m_msm; - required_device m_scsibus; - required_device m_ram; - required_device m_eeprom; - required_device m_via; - required_device m_centronics; - required_device m_palette; - required_device m_scsi_data_out; - required_device m_scsi_data_in; - required_device m_scsi_ctrl_out; - required_device m_fdc; - required_device m_z80sio; - required_device m_screen; - required_ioport m_io_config; - required_ioport m_io_joystick0; - required_ioport m_io_mouse_button; - required_ioport m_io_mousex; - required_ioport m_io_mousey; - - bitmap_ind16 m_video_mem; - - UINT32 m_debug_machine; - UINT8 m_mcu_reg080; - UINT8 m_iou_reg092; - UINT8 m_last_playmode; - UINT8 m_ay8910_a; - UINT16 m_x, m_y, m_yline; - UINT8 m_colours, m_mode, m_op; - UINT32 m_debug_video; - UINT8 m_vector; - UINT8 m_eeprom_bits; - UINT8 m_eeprom_state; - - DECLARE_READ8_MEMBER(nimbus_mcu_r); - DECLARE_WRITE8_MEMBER(nimbus_mcu_w); - DECLARE_READ8_MEMBER(scsi_r); - DECLARE_WRITE8_MEMBER(scsi_w); - DECLARE_WRITE8_MEMBER(fdc_ctl_w); - DECLARE_READ8_MEMBER(nimbus_pc8031_r); - DECLARE_WRITE8_MEMBER(nimbus_pc8031_w); - DECLARE_READ8_MEMBER(nimbus_pc8031_iou_r); - DECLARE_WRITE8_MEMBER(nimbus_pc8031_iou_w); - DECLARE_READ8_MEMBER(nimbus_pc8031_port_r); - DECLARE_WRITE8_MEMBER(nimbus_pc8031_port_w); - DECLARE_READ8_MEMBER(nimbus_iou_r); - DECLARE_WRITE8_MEMBER(nimbus_iou_w); - DECLARE_WRITE8_MEMBER(nimbus_sound_ay8910_porta_w); - DECLARE_WRITE8_MEMBER(nimbus_sound_ay8910_portb_w); - DECLARE_READ8_MEMBER(nimbus_mouse_js_r); - DECLARE_WRITE8_MEMBER(nimbus_mouse_js_w); - DECLARE_READ16_MEMBER(nimbus_video_io_r); - DECLARE_WRITE16_MEMBER(nimbus_video_io_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - virtual void video_reset(); - UINT32 screen_update_nimbus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(sio_interrupt); - DECLARE_WRITE_LINE_MEMBER(nimbus_fdc_intrq_w); - DECLARE_WRITE_LINE_MEMBER(nimbus_fdc_drq_w); - DECLARE_WRITE8_MEMBER(nimbus_via_write_portb); - DECLARE_WRITE_LINE_MEMBER(write_scsi_bsy); - DECLARE_WRITE_LINE_MEMBER(write_scsi_cd); - DECLARE_WRITE_LINE_MEMBER(write_scsi_io); - DECLARE_WRITE_LINE_MEMBER(write_scsi_msg); - DECLARE_WRITE_LINE_MEMBER(write_scsi_req); - DECLARE_WRITE_LINE_MEMBER(nimbus_msm5205_vck); - DECLARE_WRITE_LINE_MEMBER(write_scsi_iena); - - UINT8 get_pixel(UINT16 x, UINT16 y); - UINT16 read_pixel_line(UINT16 x, UINT16 y, UINT8 pixels, UINT8 bpp); - UINT16 read_pixel_data(UINT16 x, UINT16 y); - void set_pixel(UINT16 x, UINT16 y, UINT8 colour); - void set_pixel40(UINT16 x, UINT16 y, UINT8 colour); - void write_pixel_line(UINT16 x, UINT16 y, UINT16, UINT8 pixels, UINT8 bpp); - void move_pixel_line(UINT16 x, UINT16 y, UINT8 width); - void write_pixel_data(UINT16 x, UINT16 y, UINT16 data); - void change_palette(UINT8 bank, UINT16 colours); - void external_int(UINT8 vector, bool state); - DECLARE_READ8_MEMBER(cascade_callback); - void nimbus_bank_memory(); - void memory_reset(); - void fdc_reset(); - UINT8 fdc_driveno(UINT8 drivesel); - void hdc_reset(); - void hdc_ctrl_write(UINT8 data); - void hdc_post_rw(); - void hdc_drq(bool state); - void pc8031_reset(); - //void ipc_dumpregs(); - void iou_reset(); - void rmni_sound_reset(); - void mouse_js_reset(); - void check_scsi_irq(); - - int m_scsi_iena; - int m_scsi_msg; - int m_scsi_bsy; - int m_scsi_io; - int m_scsi_cd; - int m_scsi_req; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - enum - { - TIMER_MOUSE - }; - - // Static data related to Floppy and SCSI hard disks - struct - { - UINT8 reg400; - } m_nimbus_drives; - - /* 8031 Peripheral controler */ - struct - { - UINT8 ipc_in; - UINT8 ipc_out; - UINT8 status_in; - UINT8 status_out; - } m_ipc_interface; - - /* Mouse/Joystick */ - struct - { - UINT8 m_mouse_px; - UINT8 m_mouse_py; - - UINT8 m_mouse_x; - UINT8 m_mouse_y; - UINT8 m_mouse_pc; - UINT8 m_mouse_pcx; - UINT8 m_mouse_pcy; - - UINT8 m_intstate_x; - UINT8 m_intstate_y; - - UINT8 m_reg0a4; - - emu_timer *m_mouse_timer; - } m_nimbus_mouse; -}; diff --git a/src/mess/includes/sage2.h b/src/mess/includes/sage2.h deleted file mode 100644 index a8138e3c716..00000000000 --- a/src/mess/includes/sage2.h +++ /dev/null @@ -1,99 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8251.h" -#include "machine/i8255.h" -#include "bus/ieee488/ieee488.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/ram.h" -#include "machine/upd765.h" - -#define M68000_TAG "u68" -#define I8255A_0_TAG "u22" -#define I8255A_1_TAG "u39" -#define I8253_0_TAG "u74" -#define I8253_1_TAG "u75" -#define I8259_TAG "u73" -#define I8251_0_TAG "u58" -#define I8251_1_TAG "u67" -#define UPD765_TAG "u21" -#define TMS9914_TAG "u6" -#define CENTRONICS_TAG "centronics" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" - -class sage2_state : public driver_device -{ -public: - sage2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M68000_TAG), - m_pic(*this, I8259_TAG), - m_usart0(*this, I8251_0_TAG), - m_usart1(*this, I8251_1_TAG), - m_fdc(*this, UPD765_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, UPD765_TAG ":0"), - m_floppy1(*this, UPD765_TAG ":1"), - m_floppy(NULL), - m_centronics(*this, CENTRONICS_TAG), - m_ieee488(*this, IEEE488_TAG), - m_reset(1), - m_fdc_int(0), - m_fdie(0) - { } - - required_device m_maincpu; - required_device m_pic; - required_device m_usart0; - required_device m_usart1; - required_device m_fdc; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - floppy_image_device *m_floppy; - required_device m_centronics; - required_device m_ieee488; - - virtual void machine_start(); - virtual void machine_reset(); - - void update_fdc_int(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_WRITE_LINE_MEMBER( br1_w ); - DECLARE_WRITE_LINE_MEMBER( br2_w ); - DECLARE_WRITE8_MEMBER( ppi0_pc_w ); - DECLARE_READ8_MEMBER( ppi1_pb_r ); - DECLARE_WRITE8_MEMBER( ppi1_pc_w ); - - DECLARE_WRITE8_MEMBER(kbd_put); - - DECLARE_DIRECT_UPDATE_MEMBER(sage2_direct_update_handler); - - DECLARE_WRITE_LINE_MEMBER( fdc_irq ); - - const UINT8 *m_rom; - int m_reset; - - // floppy state - int m_fdc_int; - int m_fdie; - DECLARE_DRIVER_INIT(sage2); - - int m_centronics_busy; - int m_centronics_perror; - int m_centronics_select; - int m_centronics_fault; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - DECLARE_WRITE_LINE_MEMBER(write_centronics_select); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); -}; diff --git a/src/mess/includes/samcoupe.h b/src/mess/includes/samcoupe.h deleted file mode 100644 index e576e32f782..00000000000 --- a/src/mess/includes/samcoupe.h +++ /dev/null @@ -1,203 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Lee Hammerton, Dirk Best -/***************************************************************************** - * - * includes/coupe.h - * - * SAM Coupe - * - * Driver by Lee Hammerton - * - ****************************************************************************/ - -#ifndef SAMCOUPE_H_ -#define SAMCOUPE_H_ - -#include "machine/wd_fdc.h" -#include "sound/speaker.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "machine/ram.h" -#include "machine/msm6242.h" - -/* screen dimensions */ -#define SAM_BLOCK 8 - -#define SAM_TOTAL_WIDTH SAM_BLOCK*96 -#define SAM_TOTAL_HEIGHT 312 -#define SAM_SCREEN_WIDTH SAM_BLOCK*64 -#define SAM_SCREEN_HEIGHT 192 -#define SAM_BORDER_LEFT SAM_BLOCK*4 -#define SAM_BORDER_RIGHT SAM_BLOCK*4 -#define SAM_BORDER_TOP 37 -#define SAM_BORDER_BOTTOM 46 - -/* interrupt sources */ -#define SAM_LINE_INT 0x01 -#define SAM_MOUSE_INT 0x02 -#define SAM_MIDIIN_INT 0x04 -#define SAM_FRAME_INT 0x08 -#define SAM_MIDIOUT_INT 0x10 - - -class samcoupe_state : public driver_device -{ -public: - enum - { - TIMER_IRQ_OFF, - TIMER_MOUSE_RESET, - TIMER_VIDEO_UPDATE - }; - - samcoupe_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_lpt1(*this, "lpt1"), - m_lpt2(*this, "lpt2"), - m_ram(*this, RAM_TAG), - m_rtc(*this, "sambus_clock"), - m_fdc(*this, "wd1772"), - m_wd1772_0(*this, "wd1772:0"), - m_wd1772_1(*this, "wd1772:1"), - m_region_maincpu(*this, "maincpu"), - m_keyboard_row_fe(*this, "keyboard_row_fe"), - m_keyboard_row_fd(*this, "keyboard_row_fd"), - m_keyboard_row_fb(*this, "keyboard_row_fb"), - m_keyboard_row_f7(*this, "keyboard_row_f7"), - m_keyboard_row_ef(*this, "keyboard_row_ef"), - m_keyboard_row_df(*this, "keyboard_row_df"), - m_keyboard_row_bf(*this, "keyboard_row_bf"), - m_keyboard_row_7f(*this, "keyboard_row_7f"), - m_keyboard_row_ff(*this, "keyboard_row_ff"), - m_mouse_buttons(*this, "mouse_buttons"), - m_io_mouse_x(*this, "mouse_x"), - m_io_mouse_y(*this, "mouse_y"), - m_config(*this, "config") - { - sam_bank_read_ptr[0] = NULL; - sam_bank_write_ptr[0] = NULL; - sam_bank_read_ptr[1] = NULL; - sam_bank_write_ptr[1] = NULL; - sam_bank_read_ptr[2] = NULL; - sam_bank_write_ptr[2] = NULL; - sam_bank_read_ptr[3] = NULL; - sam_bank_write_ptr[3] = NULL; - } - - virtual void video_start(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - bitmap_ind16 m_bitmap; - - emu_timer *m_video_update_timer; - - UINT8 m_lmpr, m_hmpr, m_vmpr; /* memory pages */ - UINT8 m_lext, m_hext; /* extended memory page */ - UINT8 m_border; /* border */ - UINT8 m_clut[16]; /* color lookup table, 16 entries */ - UINT8 m_line_int; /* line interrupt */ - UINT8 m_status; /* status register */ - - /* attribute */ - UINT8 m_attribute; - - /* mouse */ - int m_mouse_index; - emu_timer *m_mouse_reset; - UINT8 m_mouse_data[9]; - int m_mouse_x, m_mouse_y; - UINT8 *m_videoram; - DECLARE_WRITE8_MEMBER(samcoupe_ext_mem_w); - DECLARE_READ8_MEMBER(samcoupe_disk_r); - DECLARE_WRITE8_MEMBER(samcoupe_disk_w); - DECLARE_READ8_MEMBER(samcoupe_pen_r); - DECLARE_WRITE8_MEMBER(samcoupe_clut_w); - DECLARE_READ8_MEMBER(samcoupe_status_r); - DECLARE_WRITE8_MEMBER(samcoupe_line_int_w); - DECLARE_READ8_MEMBER(samcoupe_lmpr_r); - DECLARE_WRITE8_MEMBER(samcoupe_lmpr_w); - DECLARE_READ8_MEMBER(samcoupe_hmpr_r); - DECLARE_WRITE8_MEMBER(samcoupe_hmpr_w); - DECLARE_READ8_MEMBER(samcoupe_vmpr_r); - DECLARE_WRITE8_MEMBER(samcoupe_vmpr_w); - DECLARE_READ8_MEMBER(samcoupe_midi_r); - DECLARE_WRITE8_MEMBER(samcoupe_midi_w); - DECLARE_READ8_MEMBER(samcoupe_keyboard_r); - DECLARE_WRITE8_MEMBER(samcoupe_border_w); - DECLARE_READ8_MEMBER(samcoupe_attributes_r); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(samcoupe); - INTERRUPT_GEN_MEMBER(samcoupe_frame_interrupt); - TIMER_CALLBACK_MEMBER(irq_off); - TIMER_CALLBACK_MEMBER(samcoupe_mouse_reset); - TIMER_CALLBACK_MEMBER(sam_video_update_callback); - DECLARE_READ8_MEMBER(samcoupe_lpt1_busy_r); - DECLARE_WRITE8_MEMBER(samcoupe_lpt1_strobe_w); - DECLARE_READ8_MEMBER(samcoupe_lpt2_busy_r); - DECLARE_WRITE8_MEMBER(samcoupe_lpt2_strobe_w); - DECLARE_READ8_MEMBER(samcoupe_rtc_r); - DECLARE_WRITE8_MEMBER(samcoupe_rtc_w); - - DECLARE_READ8_MEMBER(sam_bank1_r); - DECLARE_WRITE8_MEMBER(sam_bank1_w); - DECLARE_READ8_MEMBER(sam_bank2_r); - DECLARE_WRITE8_MEMBER(sam_bank2_w); - DECLARE_READ8_MEMBER(sam_bank3_r); - DECLARE_WRITE8_MEMBER(sam_bank3_w); - DECLARE_READ8_MEMBER(sam_bank4_r); - DECLARE_WRITE8_MEMBER(sam_bank4_w); - - UINT8* sam_bank_read_ptr[4]; - UINT8* sam_bank_write_ptr[4]; - DECLARE_FLOPPY_FORMATS( floppy_formats ); - required_device m_maincpu; - required_device m_speaker; - required_device m_cassette; - required_device m_lpt1; - required_device m_lpt2; - required_device m_ram; - required_device m_rtc; - required_device m_fdc; - required_device m_wd1772_0; - required_device m_wd1772_1; - required_memory_region m_region_maincpu; - required_ioport m_keyboard_row_fe; - required_ioport m_keyboard_row_fd; - required_ioport m_keyboard_row_fb; - required_ioport m_keyboard_row_f7; - required_ioport m_keyboard_row_ef; - required_ioport m_keyboard_row_df; - required_ioport m_keyboard_row_bf; - required_ioport m_keyboard_row_7f; - required_ioport m_keyboard_row_ff; - required_ioport m_mouse_buttons; - required_ioport m_io_mouse_x; - required_ioport m_io_mouse_y; - required_ioport m_config; - - void draw_mode4_line(int y, int hpos); - void draw_mode3_line(int y, int hpos); - void draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask); - void draw_mode2_line(int y, int hpos); - void draw_mode1_line(int y, int hpos); - void samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memory, int is_readonly); - void samcoupe_install_ext_mem(address_space &space); - void samcoupe_update_memory(address_space &space); - UINT8 samcoupe_mouse_r(); - void samcoupe_irq(UINT8 src); - - DECLARE_WRITE_LINE_MEMBER(write_lpt1_busy); - DECLARE_WRITE_LINE_MEMBER(write_lpt2_busy); - - int m_lpt1_busy; - int m_lpt2_busy; -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* SAMCOUPE_H_ */ diff --git a/src/mess/includes/sg1000.h b/src/mess/includes/sg1000.h deleted file mode 100644 index 47d9497f7db..00000000000 --- a/src/mess/includes/sg1000.h +++ /dev/null @@ -1,149 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __SG1000__ -#define __SG1000__ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "formats/sc3000_bit.h" -#include "formats/sf7000_dsk.h" -#include "imagedev/cassette.h" -#include "imagedev/printer.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "machine/ram.h" -#include "bus/sega8/sega8_slot.h" -#include "machine/upd765.h" -#include "sound/sn76496.h" -#include "video/tms9928a.h" -#include "crsshair.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "z80" -#define SN76489AN_TAG "sn76489an" -#define UPD765_TAG "upd765" -#define UPD8251_TAG "upd8251" -#define UPD9255_TAG "upd9255" -#define UPD9255_0_TAG "upd9255_0" -#define UPD9255_1_TAG "upd9255_1" -#define CENTRONICS_TAG "centronics" -#define TMS9918A_TAG "tms9918a" -#define RS232_TAG "rs232" -#define CARTSLOT_TAG "slot" - - -INPUT_PORTS_EXTERN( sk1100 ); - -class sg1000_state : public driver_device -{ -public: - enum - { - TIMER_LIGHTGUN_TICK - }; - - sg1000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ram(*this, RAM_TAG), - m_rom(*this, Z80_TAG), - m_cart(*this, CARTSLOT_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - required_memory_region m_rom; - optional_device m_cart; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( joysel_r ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); - - DECLARE_READ8_MEMBER( omv_r ); - DECLARE_WRITE8_MEMBER( omv_w ); - - /* keyboard state */ - UINT8 m_keylatch; - - DECLARE_WRITE_LINE_MEMBER(sg1000_vdp_interrupt); -}; - -class sc3000_state : public sg1000_state -{ -public: - sc3000_state(const machine_config &mconfig, device_type type, const char *tag) - : sg1000_state(mconfig, type, tag), - m_cassette(*this, "cassette"), - m_pa0(*this, "PA0"), - m_pa1(*this, "PA1"), - m_pa2(*this, "PA2"), - m_pa3(*this, "PA3"), - m_pa4(*this, "PA4"), - m_pa5(*this, "PA5"), - m_pa6(*this, "PA6"), - m_pa7(*this, "PA7"), - m_pb0(*this, "PB0"), - m_pb1(*this, "PB1"), - m_pb2(*this, "PB2"), - m_pb3(*this, "PB3"), - m_pb4(*this, "PB4"), - m_pb5(*this, "PB5"), - m_pb6(*this, "PB6"), - m_pb7(*this, "PB7") - { } - - required_device m_cassette; - required_ioport m_pa0; - required_ioport m_pa1; - required_ioport m_pa2; - required_ioport m_pa3; - required_ioport m_pa4; - required_ioport m_pa5; - required_ioport m_pa6; - required_ioport m_pa7; - required_ioport m_pb0; - required_ioport m_pb1; - required_ioport m_pb2; - required_ioport m_pb3; - required_ioport m_pb4; - required_ioport m_pb5; - required_ioport m_pb6; - required_ioport m_pb7; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( ppi_pa_r ); - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - - ioport_port* m_key_row[16]; -}; - -class sf7000_state : public sc3000_state -{ -public: - sf7000_state(const machine_config &mconfig, device_type type, const char *tag) - : sc3000_state(mconfig, type, tag), - m_fdc(*this, UPD765_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_floppy0(*this, UPD765_TAG ":0:3ssdd") - { } - - required_device m_fdc; - required_device m_centronics; - required_device m_floppy0; - - virtual void machine_start(); - virtual void machine_reset(); - - int m_centronics_busy; - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_READ8_MEMBER( ppi_pa_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); -}; - -#endif diff --git a/src/mess/includes/sms.h b/src/mess/includes/sms.h deleted file mode 100644 index 4f2efcdbbd3..00000000000 --- a/src/mess/includes/sms.h +++ /dev/null @@ -1,250 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Charles MacDonald,Mathis Rosenhauer,Brad Oliver,Michael Luong,Fabio Priuli,Enik Land -/***************************************************************************** - * - * includes/sms.h - * - ****************************************************************************/ - -#ifndef SMS_H_ -#define SMS_H_ - -#define LOG_REG -#define LOG_PAGING -#define LOG_COLOR - -#define NVRAM_SIZE (0x08000) -#define CPU_ADDRESSABLE_SIZE (0x10000) - -#define MAX_CARTRIDGES 16 - -#define CONTROL1_TAG "ctrl1" -#define CONTROL2_TAG "ctrl2" - -#include "bus/sega8/sega8_slot.h" -#include "bus/sms_exp/smsexp.h" -#include "bus/sms_ctrl/smsctrl.h" -#include "bus/gamegear/ggext.h" - - -class sms_state : public driver_device -{ -public: - sms_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_vdp(*this, "sms_vdp"), - m_main_scr(*this, "screen"), - m_psg_sms(*this, "segapsg"), - m_psg_gg(*this, "gamegear"), - m_ym(*this, "ym2413"), - m_port_ctrl1(*this, CONTROL1_TAG), - m_port_ctrl2(*this, CONTROL2_TAG), - m_port_gg_ext(*this, "ext"), - m_port_gg_dc(*this, "GG_PORT_DC"), - m_port_pause(*this, "PAUSE"), - m_port_reset(*this, "RESET"), - m_port_start(*this, "START"), - m_port_scope(*this, "SEGASCOPE"), - m_port_scope_binocular(*this, "SSCOPE_BINOCULAR"), - m_port_persist(*this, "PERSISTENCE"), - m_region_maincpu(*this, "maincpu"), - m_mainram(NULL), - m_is_gamegear(0), - m_is_gg_region_japan(0), - m_is_smsj(0), - m_is_mark_iii(0), - m_is_sdisp(0), - m_has_bios_0400(0), - m_has_bios_2000(0), - m_has_bios_full(0), - m_has_fm(0), - m_has_jpn_sms_cart_slot(0), - m_store_cart_selection_data(0) { } - - // devices - required_device m_maincpu; - required_device m_vdp; - required_device m_main_scr; - optional_device m_psg_sms; - optional_device m_psg_gg; - optional_device m_ym; - optional_device m_port_ctrl1; - optional_device m_port_ctrl2; - optional_device m_port_gg_ext; - - optional_ioport m_port_gg_dc; - optional_ioport m_port_pause; - optional_ioport m_port_reset; - optional_ioport m_port_start; - optional_ioport m_port_scope; - optional_ioport m_port_scope_binocular; - optional_ioport m_port_persist; - - required_memory_region m_region_maincpu; - address_space *m_space; - UINT8 *m_mainram; - UINT8 *m_BIOS; - - // for 3D glass binocular hack - device_t *m_left_lcd; - device_t *m_right_lcd; - bitmap_rgb32 m_prevleft_bitmap; - bitmap_rgb32 m_prevright_bitmap; - - // for gamegear LCD persistence hack - bitmap_rgb32 m_prev_bitmap; - bool m_prev_bitmap_copied; - - // for gamegear SMS mode scaling - bitmap_rgb32 m_gg_sms_mode_bitmap; - // line_buffer will be used to hold 4 lines of line data as a kind of cache for - // vertical scaling in the gamegear sms compatibility mode. - int *m_line_buffer; - - // model identifiers - UINT8 m_is_gamegear; - UINT8 m_is_gg_region_japan; - UINT8 m_is_smsj; - UINT8 m_is_mark_iii; - UINT8 m_is_sdisp; - UINT8 m_has_bios_0400; - UINT8 m_has_bios_2000; - UINT8 m_has_bios_full; - UINT8 m_has_fm; - UINT8 m_has_jpn_sms_cart_slot; - - // [0] for 0x400-0x3fff, [1] for 0x4000-0x7fff, [2] for 0x8000-0xffff, [3] for 0x0000-0x0400 - UINT8 m_bios_page[4]; - - UINT8 m_bios_page_count; - UINT8 m_mapper[4]; - UINT8 m_io_ctrl_reg; - UINT8 m_mem_ctrl_reg; - UINT8 m_mem_device_enabled; - UINT8 m_audio_control; - UINT8 m_port_dc_reg; - UINT8 m_port_dd_reg; - UINT8 m_gg_sio[5]; - int m_paused; - - UINT8 m_ctrl1_th_state; - UINT8 m_ctrl2_th_state; - UINT8 m_ctrl1_th_latch; - UINT8 m_ctrl2_th_latch; - - // Data needed for Light Phaser - int m_lphaser_x_offs; /* Needed to 'calibrate' lphaser; set at cart loading */ - - // Data needed for SegaScope (3D glasses) - UINT8 m_sscope_state; - UINT8 m_frame_sscope_state; - - // slot devices - sega8_cart_slot_device *m_cartslot; - sega8_card_slot_device *m_cardslot; - sms_expansion_slot_device *m_expslot; - - // these are only used by the Store Display unit, but we keep them here temporarily to avoid the need of separate start/reset - sega8_cart_slot_device *m_slots[16]; - sega8_card_slot_device *m_cards[16]; - UINT8 m_store_control; - UINT8 m_store_cart_selection_data; - void store_post_load(); - void store_select_cart(UINT8 data); - - DECLARE_READ8_MEMBER(read_0000); - DECLARE_READ8_MEMBER(read_4000); - DECLARE_READ8_MEMBER(read_8000); - DECLARE_READ8_MEMBER(read_ram); - DECLARE_WRITE8_MEMBER(write_ram); - DECLARE_WRITE8_MEMBER(write_cart); - - DECLARE_READ8_MEMBER(sms_mapper_r); - DECLARE_WRITE8_MEMBER(sms_mapper_w); - DECLARE_WRITE8_MEMBER(sms_mem_control_w); - DECLARE_WRITE8_MEMBER(sms_io_control_w); - DECLARE_READ8_MEMBER(sms_count_r); - DECLARE_READ8_MEMBER(sms_input_port_dc_r); - DECLARE_READ8_MEMBER(sms_input_port_dd_r); - DECLARE_READ8_MEMBER(gg_input_port_00_r); - DECLARE_READ8_MEMBER(gg_sio_r); - DECLARE_WRITE8_MEMBER(gg_sio_w); - DECLARE_WRITE8_MEMBER(gg_psg_stereo_w); - DECLARE_WRITE8_MEMBER(gg_psg_w); - DECLARE_WRITE8_MEMBER(sms_psg_w); - DECLARE_READ8_MEMBER(sms_audio_control_r); - DECLARE_WRITE8_MEMBER(sms_audio_control_w); - DECLARE_WRITE8_MEMBER(sms_ym2413_register_port_w); - DECLARE_WRITE8_MEMBER(sms_ym2413_data_port_w); - DECLARE_READ8_MEMBER(sms_sscope_r); - DECLARE_WRITE8_MEMBER(sms_sscope_w); - - DECLARE_WRITE_LINE_MEMBER(sms_int_callback); - DECLARE_WRITE_LINE_MEMBER(sms_pause_callback); - DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input); - DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input); - DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input); - DECLARE_READ32_MEMBER(sms_pixel_color); - - DECLARE_DRIVER_INIT(sg1000m3); - DECLARE_DRIVER_INIT(gamegear); - DECLARE_DRIVER_INIT(gamegeaj); - DECLARE_DRIVER_INIT(sms1krfm); - DECLARE_DRIVER_INIT(sms1kr); - DECLARE_DRIVER_INIT(smskr); - DECLARE_DRIVER_INIT(smsj); - DECLARE_DRIVER_INIT(sms1); - DECLARE_MACHINE_START(sms); - DECLARE_MACHINE_RESET(sms); - DECLARE_VIDEO_START(gamegear); - DECLARE_VIDEO_RESET(gamegear); - DECLARE_VIDEO_START(sms1); - DECLARE_VIDEO_RESET(sms1); - - UINT32 screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void screen_vblank_sms1(screen_device &screen, bool state); - -protected: - UINT8 read_bus(address_space &space, unsigned int bank, UINT16 base_addr, UINT16 offset); - void setup_bios(); - void setup_media_slots(); - void setup_enabled_slots(); - void lphaser_hcount_latch(); - void sms_get_inputs(); -}; - -class smssdisp_state : public sms_state -{ -public: - smssdisp_state(const machine_config &mconfig, device_type type, const char *tag) - : sms_state(mconfig, type, tag), - m_control_cpu(*this, "control") - { } - - required_device m_control_cpu; - - DECLARE_READ8_MEMBER(sms_store_cart_select_r); - DECLARE_WRITE8_MEMBER(sms_store_cart_select_w); - DECLARE_WRITE8_MEMBER(sms_store_control_w); - DECLARE_DRIVER_INIT(smssdisp); - - DECLARE_READ8_MEMBER(store_cart_peek); - - DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback); -}; - - -/*----------- defined in machine/sms.c -----------*/ - -#define IO_EXPANSION (0x80) /* Expansion slot enable (1= disabled, 0= enabled) */ -#define IO_CARTRIDGE (0x40) /* Cartridge slot enable (1= disabled, 0= enabled) */ -#define IO_CARD (0x20) /* Card slot disabled (1= disabled, 0= enabled) */ -#define IO_WORK_RAM (0x10) /* Work RAM disabled (1= disabled, 0= enabled) */ -#define IO_BIOS_ROM (0x08) /* BIOS ROM disabled (1= disabled, 0= enabled) */ -#define IO_CHIP (0x04) /* I/O chip disabled (1= disabled, 0= enabled) */ - -#endif /* SMS_H_ */ diff --git a/src/mess/includes/softbox.h b/src/mess/includes/softbox.h deleted file mode 100644 index 2ad510fa682..00000000000 --- a/src/mess/includes/softbox.h +++ /dev/null @@ -1,68 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Mike Naberezny -#pragma once - -#ifndef __SOFTBOX__ -#define __SOFTBOX__ - -#include "emu.h" -#include "bus/ieee488/ieee488.h" -#include "bus/imi7000/imi7000.h" -#include "cpu/z80/z80.h" -#include "imagedev/harddriv.h" -#include "machine/corvushd.h" -#include "machine/com8116.h" -#include "machine/i8251.h" -#include "machine/i8255.h" - -#define Z80_TAG "z80" -#define I8251_TAG "ic15" -#define I8255_0_TAG "ic17" -#define I8255_1_TAG "ic16" -#define COM8116_TAG "ic14" -#define RS232_TAG "rs232" -#define CORVUS_HDC_TAG "corvus" - -class softbox_state : public driver_device -{ -public: - softbox_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_dbrg(*this, COM8116_TAG), - m_ieee(*this, IEEE488_TAG), - m_hdc(*this, CORVUS_HDC_TAG) - { } - - required_device m_maincpu; - required_device m_dbrg; - required_device m_ieee; - required_device m_hdc; - - virtual void machine_start(); - virtual void device_reset_after_children(); - - // device_ieee488_interface overrides - virtual void ieee488_ifc(int state); - - DECLARE_WRITE8_MEMBER( dbrg_w ); - - DECLARE_READ8_MEMBER( ppi0_pa_r ); - DECLARE_WRITE8_MEMBER( ppi0_pb_w ); - - DECLARE_READ8_MEMBER( ppi1_pa_r ); - DECLARE_WRITE8_MEMBER( ppi1_pb_w ); - DECLARE_READ8_MEMBER( ppi1_pc_r ); - DECLARE_WRITE8_MEMBER( ppi1_pc_w ); - - enum - { - LED_A, - LED_B, - LED_READY - }; - - int m_ifc; // Tracks previous state of IEEE-488 IFC line -}; - -#endif diff --git a/src/mess/includes/sorcerer.h b/src/mess/includes/sorcerer.h deleted file mode 100644 index 3cff01cdc38..00000000000 --- a/src/mess/includes/sorcerer.h +++ /dev/null @@ -1,110 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Robbbert -/***************************************************************************** - * - * includes/sorcerer.h - * - ****************************************************************************/ - -#ifndef SORCERER_H_ -#define SORCERER_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/dac.h" -#include "sound/wave.h" -#include "machine/ay31015.h" -#include "bus/centronics/ctronics.h" -#include "machine/ram.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "imagedev/flopdrv.h" -#include "formats/sorc_dsk.h" -#include "formats/sorc_cas.h" -#include "machine/micropolis.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define SORCERER_USING_RS232 0 - -struct cass_data_t { - struct { - int length; /* time cassette level is at input.level */ - int level; /* cassette level */ - int bit; /* bit being read */ - } input; - struct { - int length; /* time cassette level is at output.level */ - int level; /* cassette level */ - int bit; /* bit to output */ - } output; -}; - - -class sorcerer_state : public driver_device -{ -public: - enum - { - TIMER_SERIAL, - TIMER_CASSETTE, - TIMER_RESET - }; - - sorcerer_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_cassette1(*this, "cassette") - , m_cassette2(*this, "cassette2") - , m_wave1(*this, WAVE_TAG) - , m_wave2(*this, WAVE2_TAG) - , m_uart(*this, "uart") - , m_centronics(*this, "centronics") - , m_cart(*this, "cartslot") - , m_ram(*this, RAM_TAG) - , m_iop_config(*this, "CONFIG") - , m_iop_vs(*this, "VS") - , m_iop_x(*this, "X") - { } - - DECLARE_READ8_MEMBER(sorcerer_fc_r); - DECLARE_READ8_MEMBER(sorcerer_fd_r); - DECLARE_READ8_MEMBER(sorcerer_fe_r); - DECLARE_WRITE8_MEMBER(sorcerer_fc_w); - DECLARE_WRITE8_MEMBER(sorcerer_fd_w); - DECLARE_WRITE8_MEMBER(sorcerer_fe_w); - DECLARE_WRITE8_MEMBER(sorcerer_ff_w); - DECLARE_MACHINE_START(sorcererd); - DECLARE_DRIVER_INIT(sorcerer); - TIMER_CALLBACK_MEMBER(sorcerer_serial_tc); - TIMER_CALLBACK_MEMBER(sorcerer_cassette_tc); - TIMER_CALLBACK_MEMBER(sorcerer_reset); - DECLARE_SNAPSHOT_LOAD_MEMBER( sorcerer ); - DECLARE_QUICKLOAD_LOAD_MEMBER( sorcerer); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -private: - UINT8 m_fe; - UINT8 m_keyboard_line; - const UINT8 *m_p_videoram; - emu_timer *m_serial_timer; - emu_timer *m_cassette_timer; - cass_data_t m_cass_data; - virtual void video_start(); - virtual void machine_start(); - virtual void machine_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - required_device m_maincpu; - required_device m_cassette1; - required_device m_cassette2; - required_device m_wave1; - required_device m_wave2; - required_device m_uart; - required_device m_centronics; - required_device m_cart; - required_device m_ram; - required_ioport m_iop_config; - required_ioport m_iop_vs; - required_ioport_array<16> m_iop_x; -}; - -#endif /* SORCERER_H_ */ diff --git a/src/mess/includes/special.h b/src/mess/includes/special.h deleted file mode 100644 index 56350a8bbc7..00000000000 --- a/src/mess/includes/special.h +++ /dev/null @@ -1,153 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/special.h - * - ****************************************************************************/ - -#ifndef SPECIAL_H_ -#define SPECIAL_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/i8085/i8085.h" -#include "audio/specimx_snd.h" -#include "sound/dac.h" -#include "sound/wave.h" -#include "machine/i8255.h" -#include "machine/pit8253.h" -#include "imagedev/cassette.h" -#include "formats/smx_dsk.h" -#include "formats/rk_cas.h" -#include "machine/wd_fdc.h" -#include "machine/ram.h" - - -class special_state : public driver_device -{ -public: - enum - { - TIMER_RESET, - TIMER_PIT8253_GATES - }; - - special_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ppi(*this, "ppi8255"), - m_fdc(*this, "fd1793"), - m_dac(*this, "dac"), - m_pit(*this, "pit8253"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_p_videoram(*this, "p_videoram"), - m_region_maincpu(*this, "maincpu"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_bank5(*this, "bank5"), - m_bank6(*this, "bank6"), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_line4(*this, "LINE4"), - m_io_line5(*this, "LINE5"), - m_io_line6(*this, "LINE6"), - m_io_line7(*this, "LINE7"), - m_io_line8(*this, "LINE8"), - m_io_line9(*this, "LINE9"), - m_io_line10(*this, "LINE10"), - m_io_line11(*this, "LINE11"), - m_io_line12(*this, "LINE12"), - m_palette(*this, "palette") { } - - DECLARE_WRITE8_MEMBER(specimx_select_bank); - DECLARE_WRITE8_MEMBER(video_memory_w); - DECLARE_WRITE8_MEMBER(specimx_video_color_w); - DECLARE_READ8_MEMBER(specimx_video_color_r); - DECLARE_READ8_MEMBER(specimx_disk_ctrl_r); - DECLARE_WRITE8_MEMBER(specimx_disk_ctrl_w); - DECLARE_READ8_MEMBER(erik_rr_reg_r); - DECLARE_WRITE8_MEMBER(erik_rr_reg_w); - DECLARE_READ8_MEMBER(erik_rc_reg_r); - DECLARE_WRITE8_MEMBER(erik_rc_reg_w); - DECLARE_READ8_MEMBER(erik_disk_reg_r); - DECLARE_WRITE8_MEMBER(erik_disk_reg_w); - DECLARE_READ8_MEMBER(specialist_8255_porta_r); - DECLARE_READ8_MEMBER(specialist_8255_portb_r); - DECLARE_READ8_MEMBER(specimx_8255_portb_r); - DECLARE_READ8_MEMBER(specialist_8255_portc_r); - DECLARE_WRITE8_MEMBER(specialist_8255_porta_w); - DECLARE_WRITE8_MEMBER(specialist_8255_portb_w); - DECLARE_WRITE8_MEMBER(specialist_8255_portc_w); - void specimx_set_bank(offs_t i, UINT8 data); - void erik_set_bank(); - UINT8 *m_specimx_colorram; - UINT8 m_erik_color_1; - UINT8 m_erik_color_2; - UINT8 m_erik_background; - UINT8 m_specimx_color; - int m_specialist_8255_porta; - int m_specialist_8255_portb; - int m_specialist_8255_portc; - UINT8 m_RR_register; - UINT8 m_RC_register; - required_device m_maincpu; - optional_device m_ppi; - optional_device m_fdc; - optional_device m_dac; - optional_device m_pit; - optional_device m_cassette; - optional_device m_ram; - optional_shared_ptr m_p_videoram; - int m_drive; - DECLARE_DRIVER_INIT(erik); - DECLARE_DRIVER_INIT(special); - DECLARE_MACHINE_RESET(special); - DECLARE_VIDEO_START(special); - DECLARE_MACHINE_RESET(erik); - DECLARE_VIDEO_START(erik); - DECLARE_PALETTE_INIT(erik); - DECLARE_VIDEO_START(specialp); - DECLARE_MACHINE_START(specimx); - DECLARE_MACHINE_RESET(specimx); - DECLARE_VIDEO_START(specimx); - DECLARE_PALETTE_INIT(specimx); - UINT32 screen_update_special(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_specialp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_specimx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(fdc_drq); - DECLARE_FLOPPY_FORMATS( specimx_floppy_formats ); - -protected: - required_memory_region m_region_maincpu; - required_memory_bank m_bank1; - optional_memory_bank m_bank2; - optional_memory_bank m_bank3; - optional_memory_bank m_bank4; - optional_memory_bank m_bank5; - optional_memory_bank m_bank6; - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - required_ioport m_io_line3; - required_ioport m_io_line4; - required_ioport m_io_line5; - required_ioport m_io_line6; - required_ioport m_io_line7; - required_ioport m_io_line8; - required_ioport m_io_line9; - required_ioport m_io_line10; - required_ioport m_io_line11; - required_ioport m_io_line12; - - required_device m_palette; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* SPECIAL_H_ */ diff --git a/src/mess/includes/spectrum.h b/src/mess/includes/spectrum.h deleted file mode 100644 index 2706e8223c7..00000000000 --- a/src/mess/includes/spectrum.h +++ /dev/null @@ -1,262 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/***************************************************************************** - * - * includes/spectrum.h - * - ****************************************************************************/ - -#ifndef __SPECTRUM_H__ -#define __SPECTRUM_H__ - -#include "machine/upd765.h" -#include "sound/speaker.h" -#include "machine/ram.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -/* Spectrum crystals */ - -#define X1 XTAL_14MHz // Main clock (48k Spectrum) -#define X1_128_AMSTRAD 35469000 // Main clock (Amstrad 128K model, +2A?) -#define X1_128_SINCLAIR 17734475 // Main clock (Sinclair 128K model) - -#define X2 XTAL_4_433619MHz // PAL color subcarrier - -/* Spectrum screen size in pixels */ -#define SPEC_UNSEEN_LINES 16 /* Non-visible scanlines before first border - line. Some of these may be vertical retrace. */ -#define SPEC_TOP_BORDER 48 /* Number of border lines before actual screen */ -#define SPEC_DISPLAY_YSIZE 192 /* Vertical screen resolution */ -#define SPEC_BOTTOM_BORDER 56 /* Number of border lines at bottom of screen */ -#define SPEC_SCREEN_HEIGHT (SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE + SPEC_BOTTOM_BORDER) - -#define SPEC_LEFT_BORDER 48 /* Number of left hand border pixels */ -#define SPEC_DISPLAY_XSIZE 256 /* Horizontal screen resolution */ -#define SPEC_RIGHT_BORDER 48 /* Number of right hand border pixels */ -#define SPEC_SCREEN_WIDTH (SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE + SPEC_RIGHT_BORDER) - -#define SPEC_LEFT_BORDER_CYCLES 24 /* Cycles to display left hand border */ -#define SPEC_DISPLAY_XSIZE_CYCLES 128 /* Horizontal screen resolution */ -#define SPEC_RIGHT_BORDER_CYCLES 24 /* Cycles to display right hand border */ -#define SPEC_RETRACE_CYCLES 48 /* Cycles taken for horizonal retrace */ -#define SPEC_CYCLES_PER_LINE 224 /* Number of cycles to display a single line */ - -/* 128K machines take an extra 4 cycles per scan line - add this to retrace */ -#define SPEC128_UNSEEN_LINES 15 -#define SPEC128_RETRACE_CYCLES 52 -#define SPEC128_CYCLES_PER_LINE 228 - -/* Border sizes for TS2068. These are guesses based on the number of cycles - available per frame. */ -#define TS2068_TOP_BORDER 32 -#define TS2068_BOTTOM_BORDER 32 -#define TS2068_SCREEN_HEIGHT (TS2068_TOP_BORDER + SPEC_DISPLAY_YSIZE + TS2068_BOTTOM_BORDER) - -/* Double the border sizes to maintain ratio of screen to border */ -#define TS2068_LEFT_BORDER 96 /* Number of left hand border pixels */ -#define TS2068_DISPLAY_XSIZE 512 /* Horizontal screen resolution */ -#define TS2068_RIGHT_BORDER 96 /* Number of right hand border pixels */ -#define TS2068_SCREEN_WIDTH (TS2068_LEFT_BORDER + TS2068_DISPLAY_XSIZE + TS2068_RIGHT_BORDER) - -struct EVENT_LIST_ITEM -{ - /* driver defined ID for this write */ - int Event_ID; - /* driver defined data for this write */ - int Event_Data; - /* time at which this write occurred */ - int Event_Time; -}; - - -enum -{ - TIMEX_CART_NONE, - TIMEX_CART_DOCK, - TIMEX_CART_EXROM, - TIMEX_CART_HOME -}; - - -class spectrum_state : public driver_device -{ -public: - spectrum_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_video_ram(*this, "video_ram"), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_speaker(*this, "speaker"), - m_cart(*this, "cartslot"), - m_dock(*this, "dockslot"), - m_upd765(*this, "upd765"), - m_upd765_0(*this, "upd765:0"), - m_upd765_1(*this, "upd765:1"), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_line4(*this, "LINE4"), - m_io_line5(*this, "LINE5"), - m_io_line6(*this, "LINE6"), - m_io_line7(*this, "LINE7"), - m_io_nmi(*this, "NMI"), - m_io_config(*this, "CONFIG"), - m_io_joy_intf(*this, "JOY_INTF"), - m_io_kempston(*this, "KEMPSTON"), - m_io_fuller(*this, "FULLER"), - m_io_mikrogen(*this, "MIKROGEN"), - m_io_plus0(*this, "PLUS0"), - m_io_plus1(*this, "PLUS1"), - m_io_plus2(*this, "PLUS2"), - m_io_plus3(*this, "PLUS3"), - m_io_plus4(*this, "PLUS4") { } - - int m_port_fe_data; - int m_port_7ffd_data; - int m_port_1ffd_data; /* scorpion and plus3 */ - int m_port_ff_data; /* Display enhancement control */ - int m_port_f4_data; /* Horizontal Select Register */ - - int m_floppy; - - /* video support */ - int m_frame_invert_count; - int m_frame_number; /* Used for handling FLASH 1 */ - int m_flash_invert; - optional_shared_ptr m_video_ram; - UINT8 *m_screen_location; - - int m_ROMSelection; - - - EVENT_LIST_ITEM *m_pCurrentItem; - int m_NumEvents; - int m_TotalEvents; - char *m_pEventListBuffer; - int m_LastFrameStartTime; - int m_CyclesPerFrame; - - UINT8 *m_ram_0000; - UINT8 m_ram_disabled_by_beta; - DECLARE_WRITE8_MEMBER(spectrum_port_fe_w); - DECLARE_READ8_MEMBER(spectrum_port_fe_r); - DECLARE_READ8_MEMBER(spectrum_port_1f_r); - DECLARE_READ8_MEMBER(spectrum_port_7f_r); - DECLARE_READ8_MEMBER(spectrum_port_df_r); - DECLARE_READ8_MEMBER(spectrum_port_ula_r); - - DECLARE_WRITE8_MEMBER(spectrum_128_port_7ffd_w); - DECLARE_READ8_MEMBER(spectrum_128_ula_r); - - DECLARE_WRITE8_MEMBER(spectrum_plus3_port_3ffd_w); - DECLARE_READ8_MEMBER(spectrum_plus3_port_3ffd_r); - DECLARE_READ8_MEMBER(spectrum_plus3_port_2ffd_r); - DECLARE_WRITE8_MEMBER(spectrum_plus3_port_7ffd_w); - DECLARE_WRITE8_MEMBER(spectrum_plus3_port_1ffd_w); - - DECLARE_READ8_MEMBER(ts2068_port_f4_r); - DECLARE_WRITE8_MEMBER(ts2068_port_f4_w); - DECLARE_READ8_MEMBER(ts2068_port_ff_r); - DECLARE_WRITE8_MEMBER(ts2068_port_ff_w); - DECLARE_WRITE8_MEMBER(tc2048_port_ff_w); - - DECLARE_DRIVER_INIT(spectrum); - DECLARE_DRIVER_INIT(plus2); - DECLARE_DRIVER_INIT(plus3); - DECLARE_MACHINE_RESET(spectrum); - DECLARE_VIDEO_START(spectrum); - DECLARE_PALETTE_INIT(spectrum); - DECLARE_MACHINE_RESET(tc2048); - DECLARE_VIDEO_START(spectrum_128); - DECLARE_MACHINE_RESET(spectrum_128); - DECLARE_MACHINE_RESET(spectrum_plus3); - DECLARE_MACHINE_RESET(ts2068); - DECLARE_VIDEO_START(ts2068); - UINT32 screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_tc2048(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_ts2068(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void screen_eof_spectrum(screen_device &screen, bool state); - void screen_eof_timex(screen_device &screen, bool state); - INTERRUPT_GEN_MEMBER(spec_interrupt); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( spectrum_cart ); - - // for timex cart only - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( timex_cart ); - int m_dock_cart_type, m_ram_chunks; - memory_region *m_dock_crt; - - unsigned int m_previous_border_x, m_previous_border_y; - bitmap_ind16 m_border_bitmap; - unsigned int m_previous_screen_x, m_previous_screen_y; - bitmap_ind16 m_screen_bitmap; - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - void spectrum_128_update_memory(); - void spectrum_plus3_update_memory(); - void ts2068_update_memory(); - - DECLARE_SNAPSHOT_LOAD_MEMBER( spectrum ); - DECLARE_QUICKLOAD_LOAD_MEMBER( spectrum ); - - required_device m_maincpu; - -protected: - required_device m_cassette; - required_device m_ram; - required_device m_speaker; - optional_device m_cart; - optional_device m_dock; - optional_device m_upd765; - optional_device m_upd765_0; - optional_device m_upd765_1; - - // Regular spectrum ports; marked as optional because of other subclasses - optional_ioport m_io_line0; - optional_ioport m_io_line1; - optional_ioport m_io_line2; - optional_ioport m_io_line3; - optional_ioport m_io_line4; - optional_ioport m_io_line5; - optional_ioport m_io_line6; - optional_ioport m_io_line7; - optional_ioport m_io_nmi; - optional_ioport m_io_config; - optional_ioport m_io_joy_intf; - optional_ioport m_io_kempston; - optional_ioport m_io_fuller; - optional_ioport m_io_mikrogen; - // Plus ports - optional_ioport m_io_plus0; - optional_ioport m_io_plus1; - optional_ioport m_io_plus2; - optional_ioport m_io_plus3; - optional_ioport m_io_plus4; - - void spectrum_UpdateBorderBitmap(); - void spectrum_UpdateScreenBitmap(bool eof = false); - inline unsigned char get_display_color(unsigned char color, int invert); - inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - void ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines); - void ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor); - void ts2068_lores_scanline(bitmap_ind16 &bitmap, int y, int borderlines, int screen); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - - -/*----------- defined in drivers/spectrum.c -----------*/ - -INPUT_PORTS_EXTERN( spectrum ); -INPUT_PORTS_EXTERN( spec_plus ); - -MACHINE_CONFIG_EXTERN( spectrum ); - -/*----------- defined in drivers/spec128.c -----------*/ - -MACHINE_CONFIG_EXTERN( spectrum_128 ); - -#endif /* __SPECTRUM_H__ */ diff --git a/src/mess/includes/ssystem3.h b/src/mess/includes/ssystem3.h deleted file mode 100644 index 0367a8acb67..00000000000 --- a/src/mess/includes/ssystem3.h +++ /dev/null @@ -1,84 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/ssystem3.h - * - ****************************************************************************/ - -#ifndef SSYSTEM3_H_ -#define SSYSTEM3_H_ - -#include "machine/6522via.h" - - -struct playfield_t -{ - int signal; - // int on; - - int count, bit, started; - UINT8 data; - attotime time, high_time, low_time; - union { - struct { - UINT8 header[7]; - UINT8 field[8][8/2]; - UINT8 unknown[5]; - } s; - UINT8 data[7+8*8/2+5]; - } u; -}; - -struct lcd_t -{ - UINT8 data[5]; - int clock; - int count; -}; - - -class ssystem3_state : public driver_device -{ -public: - ssystem3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_palette(*this, "palette") - , m_via6522_0(*this, "via6522_0") - , m_configuration(*this, "Configuration") - , m_matrix(*this, "matrix") - { } - - DECLARE_DRIVER_INIT(ssystem3); - virtual void video_start(); - DECLARE_PALETTE_INIT(ssystem3); - UINT32 screen_update_ssystem3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE8_MEMBER(ssystem3_via_write_a); - DECLARE_READ8_MEMBER(ssystem3_via_read_a); - DECLARE_READ8_MEMBER(ssystem3_via_read_b); - DECLARE_WRITE8_MEMBER(ssystem3_via_write_b); - void ssystem3_lcd_reset(); - void ssystem3_lcd_write(int clock, int data); - void ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y); - void ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch); - void ssystem3_playfield_getfigure(int x, int y, int *figure, int *black); - void ssystem3_playfield_reset(); - void ssystem3_playfield_write(int reset, int signal); - void ssystem3_playfield_read(int *on, int *ready); - -private: - UINT8 m_porta; - UINT8 *m_videoram; - playfield_t m_playfield; - lcd_t m_lcd; - - required_device m_maincpu; - required_device m_palette; - required_device m_via6522_0; - required_ioport m_configuration; - required_ioport_array<4> m_matrix; -}; - - -#endif /* SSYSTEM3_H_ */ diff --git a/src/mess/includes/super6.h b/src/mess/includes/super6.h deleted file mode 100644 index 9367decda25..00000000000 --- a/src/mess/includes/super6.h +++ /dev/null @@ -1,89 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __SUPER6__ -#define __SUPER6__ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/com8116.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/z80dma.h" -#include "machine/z80pio.h" - -#define Z80_TAG "u30" -#define Z80CTC_TAG "u20" -#define Z80DART_TAG "u38" -#define Z80DMA_TAG "u21" -#define Z80PIO_TAG "u7" -#define WD2793_TAG "u27" -#define BR1945_TAG "u31" -#define SCREEN_TAG "screen" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" - -class super6_state : public driver_device -{ -public: - super6_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ctc(*this, Z80CTC_TAG), - m_dart(*this, Z80DART_TAG), - m_dma(*this, Z80DMA_TAG), - m_pio(*this, Z80PIO_TAG), - m_fdc(*this, WD2793_TAG), - m_brg(*this, BR1945_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, WD2793_TAG":0"), - m_floppy1(*this, WD2793_TAG":1"), - m_rom(*this, Z80_TAG), - m_j7(*this, "J7") - { } - - required_device m_maincpu; - required_device m_ctc; - required_device m_dart; - required_device m_dma; - required_device m_pio; - required_device m_fdc; - required_device m_brg; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_region_ptr m_rom; - required_ioport m_j7; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( fdc_r ); - DECLARE_WRITE8_MEMBER( fdc_w ); - DECLARE_WRITE8_MEMBER( s100_w ); - DECLARE_WRITE8_MEMBER( bank0_w ); - DECLARE_WRITE8_MEMBER( bank1_w ); - DECLARE_WRITE8_MEMBER( baud_w ); - DECLARE_WRITE_LINE_MEMBER( fr_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - - void bankswitch(); - - // memory state - UINT8 m_s100; - UINT8 m_bank0; - UINT8 m_bank1; - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); - DECLARE_WRITE8_MEMBER(dummy_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); -}; - -#endif diff --git a/src/mess/includes/super80.h b/src/mess/includes/super80.h deleted file mode 100644 index 30813f31015..00000000000 --- a/src/mess/includes/super80.h +++ /dev/null @@ -1,123 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "sound/wave.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "video/mc6845.h" -#include "machine/z80pio.h" -#include "machine/z80dma.h" -#include "machine/wd_fdc.h" - - -/* Bits in m_portf0 variable: - d5 cassette LED - d4 super80v rom or pcg bankswitch (1=pcg ram, 0=char gen rom) - d2 super80v video or colour bankswitch (1=video ram, 0=colour ram) - d2 super80 screen off (=2mhz) or on (bursts of 2mhz at 50hz = 1mhz) */ - -class super80_state : public driver_device -{ -public: - super80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_palette(*this, "palette") - , m_maincpu(*this, "maincpu") - , m_pio(*this, "z80pio") - , m_cassette(*this, "cassette") - , m_wave(*this, WAVE_TAG) - , m_speaker(*this, "speaker") - , m_centronics(*this, "centronics") - , m_cent_data_out(*this, "cent_data_out") - , m_io_dsw(*this, "DSW") - , m_io_config(*this, "CONFIG") - , m_io_keyboard(*this, "KEY") - , m_crtc(*this, "crtc") - , m_dma(*this, "dma") - , m_fdc (*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") - { } - - DECLARE_READ8_MEMBER(super80v_low_r); - DECLARE_READ8_MEMBER(super80v_high_r); - DECLARE_WRITE8_MEMBER(super80v_low_w); - DECLARE_WRITE8_MEMBER(super80v_high_w); - DECLARE_WRITE8_MEMBER(super80v_10_w); - DECLARE_WRITE8_MEMBER(super80v_11_w); - DECLARE_READ8_MEMBER(port3e_r); - DECLARE_WRITE8_MEMBER(port3f_w); - DECLARE_WRITE8_MEMBER(super80_f1_w); - DECLARE_READ8_MEMBER(super80_dc_r); - DECLARE_READ8_MEMBER(super80_f2_r); - DECLARE_WRITE8_MEMBER(super80_dc_w); - DECLARE_WRITE8_MEMBER(super80_f0_w); - DECLARE_WRITE8_MEMBER(super80r_f0_w); - DECLARE_READ8_MEMBER(super80_read_ff); - DECLARE_WRITE_LINE_MEMBER(busreq_w); - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - DECLARE_WRITE8_MEMBER(pio_port_a_w); - DECLARE_READ8_MEMBER(pio_port_b_r); - DECLARE_DRIVER_INIT(super80); - DECLARE_VIDEO_START(super80); - DECLARE_VIDEO_START(super80v); - DECLARE_PALETTE_INIT(super80m); - DECLARE_QUICKLOAD_LOAD_MEMBER(super80); - MC6845_UPDATE_ROW(crtc_update_row); - UINT32 screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_super80d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void screen_eof_super80m(screen_device &screen, bool state); - TIMER_CALLBACK_MEMBER(super80_reset); - TIMER_DEVICE_CALLBACK_MEMBER(timer_h); - TIMER_DEVICE_CALLBACK_MEMBER(timer_k); - TIMER_DEVICE_CALLBACK_MEMBER(timer_p); - UINT8 m_s_options; - UINT8 m_portf0; - UINT8 *m_p_videoram; - UINT8 *m_p_colorram; - UINT8 *m_p_pcgram; - UINT8 m_mc6845_cursor[16]; - UINT8 m_palette_index; - required_device m_palette; -private: - virtual void machine_reset(); - UINT8 m_keylatch; - UINT8 m_cass_data[4]; - UINT8 m_int_sw; - UINT8 m_last_data; - UINT8 m_key_pressed; - UINT16 m_vidpg; - UINT8 m_current_charset; - const UINT8 *m_p_chargen; - UINT8 m_mc6845_reg[32]; - UINT8 m_mc6845_ind; - UINT8 *m_p_ram; - void mc6845_cursor_configure(); - void super80_cassette_motor(UINT8 data); - required_device m_maincpu; - required_device m_pio; - required_device m_cassette; - required_device m_wave; - required_device m_speaker; - required_device m_centronics; - required_device m_cent_data_out; - required_ioport m_io_dsw; - required_ioport m_io_config; - required_ioport_array<8> m_io_keyboard; - optional_device m_crtc; - optional_device m_dma; - optional_device m_fdc; - optional_device m_floppy0; - optional_device m_floppy1; -}; diff --git a/src/mess/includes/superslave.h b/src/mess/includes/superslave.h deleted file mode 100644 index cfdc2f5d51d..00000000000 --- a/src/mess/includes/superslave.h +++ /dev/null @@ -1,75 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __SUPERSLAVE__ -#define __SUPERSLAVE__ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/com8116.h" -#include "machine/pic8259.h" -#include "machine/ram.h" -#include "machine/z80dart.h" -#include "machine/z80pio.h" - -#define Z80_TAG "u45" -#define Z80DART_0_TAG "u14" -#define Z80DART_1_TAG "u30" -#define Z80PIO_TAG "u43" -#define AM9519_TAG "u13" -#define BR1941_TAG "u12" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" -#define RS232_C_TAG "rs232c" -#define RS232_D_TAG "rs232d" - -class superslave_state : public driver_device -{ -public: - superslave_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_dart0(*this, Z80DART_0_TAG), - m_dart1(*this, Z80DART_1_TAG), - m_dbrg(*this, BR1941_TAG), - m_ram(*this, RAM_TAG), - m_rs232a(*this, RS232_A_TAG), - m_rs232b(*this, RS232_B_TAG), - m_rs232c(*this, RS232_C_TAG), - m_rs232d(*this, RS232_D_TAG), - m_rom(*this, Z80_TAG), - m_memctrl(0x01), - m_cmd(0x01) - { } - - required_device m_maincpu; - required_device m_dart0; - required_device m_dart1; - required_device m_dbrg; - required_device m_ram; - required_device m_rs232a; - required_device m_rs232b; - required_device m_rs232c; - required_device m_rs232d; - required_memory_region m_rom; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_WRITE8_MEMBER( baud_w ); - DECLARE_WRITE8_MEMBER( memctrl_w ); - DECLARE_READ8_MEMBER( status_r ); - DECLARE_WRITE8_MEMBER( cmd_w ); - - DECLARE_WRITE_LINE_MEMBER( fr_w ); - DECLARE_WRITE_LINE_MEMBER( ft_w ); - - UINT8 m_memctrl; - UINT8 m_cmd; -}; - -#endif diff --git a/src/mess/includes/svi318.h b/src/mess/includes/svi318.h deleted file mode 100644 index a699f6e9bfb..00000000000 --- a/src/mess/includes/svi318.h +++ /dev/null @@ -1,159 +0,0 @@ -// license:??? -// copyright-holders:Sean Young,Tomas Karlsson -/***************************************************************************** - * - * includes/svi318.h - * - * Spectravideo SVI-318 and SVI-328 - * - ****************************************************************************/ - -#ifndef SVI318_H_ -#define SVI318_H_ - -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/ins8250.h" -#include "machine/wd_fdc.h" -#include "machine/ram.h" -#include "machine/buffer.h" -#include "imagedev/cassette.h" -#include "sound/dac.h" -#include "sound/ay8910.h" -#include "sound/wave.h" -#include "video/mc6845.h" -#include "video/tms9928a.h" -#include "bus/centronics/ctronics.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class svi318_state : public driver_device -{ -public: - svi318_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_dac(*this, "dac"), - m_ppi(*this, "ppi8255"), - m_ram(*this, RAM_TAG), - m_centronics(*this, "centronics"), - m_cent_data_out(*this, "cent_data_out"), - m_ins8250_0(*this, "ins8250_0"), - m_ins8250_1(*this, "ins8250_1"), - m_cart(*this, "cartslot"), - m_fd1793(*this, "wd179x"), - m_floppy0(*this, "wd179x:0"), - m_floppy1(*this, "wd179x:1"), - m_crtc(*this, "crtc"), - m_line(*this, "LINE"), - m_joysticks(*this, "JOYSTICKS"), - m_buttons(*this, "BUTTONS"), - m_palette(*this, "palette"), - m_floppy(NULL), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4") - { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - // FDC - int m_drq; - int m_irq; - - DECLARE_WRITE8_MEMBER(ppi_w); - DECLARE_READ8_MEMBER(psg_port_a_r); - DECLARE_WRITE8_MEMBER(psg_port_b_w); - DECLARE_WRITE8_MEMBER(fdc_drive_motor_w); - DECLARE_WRITE8_MEMBER(fdc_density_side_w); - DECLARE_READ8_MEMBER(fdc_irqdrq_r); - DECLARE_WRITE8_MEMBER(svi806_ram_enable_w); - DECLARE_WRITE8_MEMBER(writemem1); - DECLARE_WRITE8_MEMBER(writemem2); - DECLARE_WRITE8_MEMBER(writemem3); - DECLARE_WRITE8_MEMBER(writemem4); - DECLARE_READ8_MEMBER(io_ext_r); - DECLARE_WRITE8_MEMBER(io_ext_w); - DECLARE_DRIVER_INIT(svi318); - DECLARE_DRIVER_INIT(svi328_806); - DECLARE_WRITE_LINE_MEMBER(vdp_interrupt); - DECLARE_WRITE_LINE_MEMBER(ins8250_interrupt); - DECLARE_READ8_MEMBER(ppi_port_a_r); - DECLARE_READ8_MEMBER(ppi_port_b_r); - DECLARE_WRITE8_MEMBER(ppi_port_c_w); - DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - bool cart_verify(UINT8 *ROM); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(svi318_cart); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - - virtual void machine_start(); - virtual void machine_reset(); - - MC6845_UPDATE_ROW(crtc_update_row); - memory_region *m_cart_rom; - memory_region *m_bios_rom; - -protected: - required_device m_maincpu; - required_device m_cassette; - required_device m_dac; - required_device m_ppi; - required_device m_ram; - required_device m_centronics; - required_device m_cent_data_out; - required_device m_ins8250_0; - required_device m_ins8250_1; - required_device m_cart; - required_device m_fd1793; - required_device m_floppy0; - required_device m_floppy1; - optional_device m_crtc; - required_ioport_array<11> m_line; - required_ioport m_joysticks; - required_ioport m_buttons; - optional_device m_palette; - -private: - - void set_banks(); - void postload(); - - // memory banking - UINT8 m_bank_switch; - UINT8 m_bank_low; - UINT8 m_bank_high; - - UINT8 m_bank_low_read_only; - UINT8 m_bank_high1_read_only; - UINT8 m_bank_high2_read_only; - - UINT8 *m_empty_bank; - UINT8 *m_bank_low_ptr; - UINT8 *m_bank_high1_ptr; - UINT8 *m_bank_high2_ptr; - - // keyboard - UINT8 m_keyboard_row; - - floppy_image_device *m_floppy; - - // centronics - int m_centronics_busy; - - // SVI-806 80 column card - UINT8 m_svi806_present; - UINT8 m_svi806_ram_enabled; - dynamic_buffer m_svi806_ram; - UINT8 *m_svi806_gfx; - - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - optional_memory_bank m_bank4; -}; - -#endif /* SVI318_H_ */ diff --git a/src/mess/includes/svision.h b/src/mess/includes/svision.h deleted file mode 100644 index ab8ff9583e7..00000000000 --- a/src/mess/includes/svision.h +++ /dev/null @@ -1,92 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * includes/svision.h - * - ****************************************************************************/ - -#ifndef SVISION_H_ -#define SVISION_H_ - -#include "cpu/m6502/m65c02.h" -#include "audio/svis_snd.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -struct svision_t -{ - emu_timer *timer1; - int timer_shot; -}; - -struct svision_pet_t -{ - int state; - int on, clock, data; - UINT8 input; - emu_timer *timer; -}; - -struct tvlink_t -{ - UINT32 palette[4/*0x40?*/]; /* rgb8 */ - int palette_on; -}; - -class svision_state : public driver_device -{ -public: - svision_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_sound(*this, "custom"), - m_cart(*this, "cartslot"), - m_reg(*this, "reg"), - m_videoram(*this, "videoram"), - m_joy(*this, "JOY"), - m_joy2(*this, "JOY2"), - m_palette(*this, "palette") { } - - int *m_dma_finished; - svision_t m_svision; - svision_pet_t m_pet; - tvlink_t m_tvlink; - - DECLARE_READ8_MEMBER(svision_r); - DECLARE_WRITE8_MEMBER(svision_w); - DECLARE_READ8_MEMBER(tvlink_r); - DECLARE_WRITE8_MEMBER(tvlink_w); - DECLARE_DRIVER_INIT(svisions); - DECLARE_DRIVER_INIT(svision); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(svision); - DECLARE_PALETTE_INIT(svisionp); - DECLARE_PALETTE_INIT(svisionn); - DECLARE_MACHINE_RESET(tvlink); - UINT32 screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_tvlink(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(svision_frame_int); - TIMER_CALLBACK_MEMBER(svision_pet_timer); - TIMER_CALLBACK_MEMBER(svision_timer); - TIMER_DEVICE_CALLBACK_MEMBER(svision_pet_timer_dev); - void svision_irq(); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(svision_cart); - -protected: - required_device m_maincpu; - required_device m_sound; - required_device m_cart; - required_shared_ptr m_reg; - required_shared_ptr m_videoram; - required_ioport m_joy; - optional_ioport m_joy2; - required_device m_palette; - - memory_region *m_cart_rom; - memory_bank *m_bank1; - memory_bank *m_bank2; -}; - -#endif /* SVISION_H_ */ diff --git a/src/mess/includes/swtpc09.h b/src/mess/includes/swtpc09.h deleted file mode 100644 index 222ffe5c11a..00000000000 --- a/src/mess/includes/swtpc09.h +++ /dev/null @@ -1,150 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robert Justice -/*************************************************************************** - swtpc09 include file - Robert Justice ,2009-2014 - -****************************************************************************/ - -#ifndef swtpc09_H_ -#define swtpc09_H_ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "video/generic.h" -#include "machine/wd_fdc.h" -#include "imagedev/flopdrv.h" -#include "machine/6840ptm.h" -#include "machine/6821pia.h" -#include "machine/6850acia.h" -#include "machine/6522via.h" -#include "machine/terminal.h" -#include "imagedev/harddriv.h" -#include "machine/idectrl.h" -#include "machine/clock.h" -#include "bus/rs232/rs232.h" - - - -class swtpc09_state : public driver_device -{ -public: - swtpc09_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pia(*this, "pia"), - m_ptm(*this, "ptm"), - m_acia(*this, "acia"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_floppy2(*this, "fdc:2"), - m_floppy3(*this, "fdc:3"), - m_via(*this, "via"), - m_piaide(*this, "piaide"), - m_harddisk(*this, "harddisk"), - m_ide(*this, "ide") - { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - required_device m_maincpu; - required_device m_pia; - required_device m_ptm; - required_device m_acia; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - optional_device m_via; - optional_device m_piaide; - optional_device m_harddisk; - optional_device m_ide; - - DECLARE_READ8_MEMBER(pia0_a_r); - DECLARE_READ8_MEMBER(pia0_ca1_r); - DECLARE_WRITE_LINE_MEMBER( pia0_irq_a ); - - DECLARE_WRITE8_MEMBER( ptm_o1_callback ); - DECLARE_WRITE8_MEMBER( ptm_o3_callback ); - DECLARE_WRITE_LINE_MEMBER( ptm_irq ); - - DECLARE_WRITE_LINE_MEMBER( acia_interrupt ); - DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); - - DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - - DECLARE_READ8_MEMBER( dmf3_via_read_porta ); - DECLARE_READ8_MEMBER( dmf3_via_read_portb ); - DECLARE_WRITE8_MEMBER( dmf3_via_write_porta ); - DECLARE_WRITE_LINE_MEMBER( dmf3_via_write_ca1 ); - DECLARE_WRITE_LINE_MEMBER( dmf3_via_irq ); - - DECLARE_READ8_MEMBER(piaide_a_r); - DECLARE_READ8_MEMBER(piaide_b_r); - DECLARE_WRITE8_MEMBER(piaide_a_w); - DECLARE_WRITE8_MEMBER(piaide_b_w); - - DECLARE_WRITE8_MEMBER(swtpc09_kbd_put); - - DECLARE_READ8_MEMBER ( dmf2_dma_address_reg_r ); - DECLARE_WRITE8_MEMBER ( dmf2_dma_address_reg_w ); - DECLARE_READ8_MEMBER ( dmf2_control_reg_r ); - DECLARE_WRITE8_MEMBER ( dmf2_control_reg_w ); - - DECLARE_READ8_MEMBER ( dmf3_dma_address_reg_r ); - DECLARE_WRITE8_MEMBER ( dmf3_dma_address_reg_w ); - DECLARE_READ8_MEMBER ( dmf3_control_reg_r ); - DECLARE_WRITE8_MEMBER ( dmf3_control_reg_w ); - - DECLARE_WRITE8_MEMBER ( dc4_control_reg_w ); - - DECLARE_WRITE8_MEMBER(dat_w); - - DECLARE_DRIVER_INIT( swtpc09 ); - DECLARE_DRIVER_INIT( swtpc09i ); - DECLARE_DRIVER_INIT( swtpc09u ); - DECLARE_DRIVER_INIT( swtpc09d3 ); - - void swtpc09_fdc_dma_transfer(); - void swtpc09_irq_handler(UINT8 peripheral, UINT8 state); - - UINT8 m_term_data; // terminal keyboard value - UINT8 m_pia_counter; // this is the counter on pia porta - UINT8 m_fdc_dma_address_reg; // dmf2 or dmf3 dma extended address reg - UINT8 m_system_type; // flag to indicate hw and rom combination - UINT8 m_fdc_status; // for floppy controller - UINT8 m_via_ca1_input; // dmf3 fdc interupt is connected here - UINT8 m_dmf3_via_porta; - UINT8 m_piaide_porta; - UINT8 m_piaide_portb; - UINT8 m_active_interrupt; - UINT8 m_interrupt; - - - // TODO: move this in proper device - - /* channel_data structure holds info about each 6844 DMA channel */ - typedef struct m6844_channel_data - { - int active; - int address; - int counter; - UINT8 control; - int start_address; - int start_counter; - } m6844_channel_data; - - /* 6844 description */ - m6844_channel_data m_m6844_channel[4]; - UINT8 m_m6844_priority; - UINT8 m_m6844_interrupt; - UINT8 m_m6844_chain; - DECLARE_READ8_MEMBER ( m6844_r ); - DECLARE_WRITE8_MEMBER ( m6844_w ); - -}; - -#endif /* swtpc09_H_ */ diff --git a/src/mess/includes/tandy2k.h b/src/mess/includes/tandy2k.h deleted file mode 100644 index 761d2f0cb37..00000000000 --- a/src/mess/includes/tandy2k.h +++ /dev/null @@ -1,229 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __TANDY2K__ -#define __TANDY2K__ - -#include "emu.h" -#include "bus/centronics/ctronics.h" -#include "bus/rs232/rs232.h" -#include "cpu/i86/i186.h" -#include "cpu/mcs48/mcs48.h" -#include "formats/tandy2k_dsk.h" -#include "imagedev/harddriv.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/ram.h" -#include "machine/tandy2kb.h" -#include "machine/upd765.h" -#include "sound/speaker.h" -#include "video/crt9007.h" -#include "video/crt9021.h" -#include "video/crt9212.h" - -#define SCREEN_TAG "screen" -#define I80186_TAG "u76" -#define I8255A_TAG "u75" -#define I8251A_TAG "u41" -#define I8253_TAG "u40" -#define I8259A_0_TAG "u42" -#define I8259A_1_TAG "u43" -#define I8272A_TAG "u121" -#define CRT9007_TAG "u16" -#define CRT9212_0_TAG "u55" -#define CRT9212_1_TAG "u15" -#define CRT9021B_TAG "u14" -#define WD1010_TAG "u18" -#define WD1100_11_TAG "u12" -#define CENTRONICS_TAG "centronics" -#define RS232_TAG "rs232" - -class tandy2k_state : public driver_device -{ -public: - tandy2k_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, I80186_TAG), - m_uart(*this, I8251A_TAG), - m_i8255a(*this, I8255A_TAG), - m_pit(*this, I8253_TAG), - m_fdc(*this, I8272A_TAG), - m_pic0(*this, I8259A_0_TAG), - m_pic1(*this, I8259A_1_TAG), - m_vpac(*this, CRT9007_TAG), - m_drb0(*this, CRT9212_0_TAG), - m_drb1(*this, CRT9212_1_TAG), - m_vac(*this, CRT9021B_TAG), - m_palette(*this, "palette"), - m_timer_vidldsh(*this, "vidldsh"), - m_centronics(*this, CENTRONICS_TAG), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG), - m_floppy0(*this, I8272A_TAG ":0:525qd"), - m_floppy1(*this, I8272A_TAG ":1:525qd"), - m_rs232(*this, RS232_TAG), - m_kb(*this, TANDY2K_KEYBOARD_TAG), - m_hires_ram(*this, "hires_ram"), - m_char_ram(*this, "char_ram"), - m_dma_mux(0), - m_kbdclk(0), - m_kbddat(0), - m_kbdin(0), - m_extclk(0), - m_rxrdy(0), - m_txrdy(0), - m_pb_sel(0), - m_vram_base(0), - m_vidouts(0), - m_clkspd(-1), - m_clkcnt(-1), - m_blc(0), - m_bkc(0), - m_cblank(0), - m_dblc(0), - m_dbkc(0), - m_dblank(0), - m_slg(0), - m_sld(0), - m_cgra(0), - m_vidla(0), - m_outspkr(0), - m_spkrdata(0), - m_centronics_ack(0), - m_centronics_fault(0), - m_centronics_select(0), - m_centronics_perror(0), - m_centronics_busy(0) - { - for (int i = 0; i < 4; i++) - { - m_busdmarq[i] = CLEAR_LINE; - } - } - - required_device m_maincpu; - required_device m_uart; - required_device m_i8255a; - required_device m_pit; - required_device m_fdc; - required_device m_pic0; - required_device m_pic1; - required_device m_vpac; - required_device m_drb0; - required_device m_drb1; - required_device m_vac; - required_device m_palette; - required_device m_timer_vidldsh; - required_device m_centronics; - required_device m_speaker; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_rs232; - required_device m_kb; - required_shared_ptr m_hires_ram; - optional_shared_ptr m_char_ram; - - virtual void machine_start(); - virtual void device_reset_after_children(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void update_drq(); - void dma_request(int line, int state); - void speaker_update(); - - DECLARE_READ8_MEMBER( char_ram_r ); - DECLARE_WRITE8_MEMBER( char_ram_w ); - DECLARE_READ8_MEMBER( videoram_r ); - DECLARE_READ8_MEMBER( enable_r ); - DECLARE_WRITE8_MEMBER( enable_w ); - DECLARE_WRITE8_MEMBER( dma_mux_w ); - DECLARE_READ8_MEMBER( kbint_clr_r ); - DECLARE_READ16_MEMBER( vpac_r ); - DECLARE_WRITE16_MEMBER( vpac_w ); - DECLARE_READ8_MEMBER( fldtc_r ); - DECLARE_WRITE8_MEMBER( fldtc_w ); - DECLARE_WRITE8_MEMBER( addr_ctrl_w ); - DECLARE_WRITE_LINE_MEMBER( rxrdy_w ); - DECLARE_WRITE_LINE_MEMBER( txrdy_w ); - DECLARE_WRITE_LINE_MEMBER( outspkr_w ); - DECLARE_WRITE_LINE_MEMBER( intbrclk_w ); - DECLARE_WRITE_LINE_MEMBER( rfrqpulse_w ); - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - DECLARE_WRITE_LINE_MEMBER( vpac_vlt_w ); - DECLARE_WRITE_LINE_MEMBER( vpac_drb_w ); - DECLARE_WRITE_LINE_MEMBER( vpac_wben_w ); - DECLARE_WRITE_LINE_MEMBER( vpac_cblank_w ); - DECLARE_WRITE_LINE_MEMBER( vpac_slg_w ); - DECLARE_WRITE_LINE_MEMBER( vpac_sld_w ); - DECLARE_WRITE8_MEMBER( vidla_w ); - DECLARE_WRITE8_MEMBER( drb_attr_w ); - DECLARE_WRITE_LINE_MEMBER( kbdclk_w ); - DECLARE_WRITE_LINE_MEMBER( kbddat_w ); - DECLARE_READ8_MEMBER( irq_callback ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_hdl_w ); - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - DECLARE_WRITE_LINE_MEMBER(write_centronics_select); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - CRT9021_DRAW_CHARACTER_MEMBER( vac_draw_character ); - TIMER_DEVICE_CALLBACK_MEMBER( vidldsh_tick ); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - enum - { - LPINEN = 0, - KBDINEN, - PORTINEN - }; - - /* DMA state */ - UINT8 m_dma_mux; - int m_busdmarq[4]; - - /* keyboard state */ - int m_kbdclk; - int m_kbddat; - UINT8 m_kbdin; - - /* serial state */ - int m_extclk; - int m_rxrdy; - int m_txrdy; - - /* PPI state */ - int m_pb_sel; - - /* video state */ - UINT8 m_vram_base; - int m_vidouts; - int m_clkspd; - int m_clkcnt; - int m_blc; - int m_bkc; - int m_cblank; - UINT8 m_dblc; - UINT8 m_dbkc; - UINT8 m_dblank; - int m_slg; - int m_sld; - UINT8 m_cgra; - UINT8 m_vidla; - - /* sound state */ - int m_outspkr; - int m_spkrdata; - - int m_centronics_ack; - int m_centronics_fault; - int m_centronics_select; - int m_centronics_perror; - int m_centronics_busy; -}; - -#endif diff --git a/src/mess/includes/tdv2324.h b/src/mess/includes/tdv2324.h deleted file mode 100644 index 7a2aaf91a22..00000000000 --- a/src/mess/includes/tdv2324.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder,Jonathan Gevaryahu -#pragma once - -#ifndef __TDV2324__ -#define __TDV2324__ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "cpu/m6800/m6800.h" -#include "imagedev/harddriv.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "machine/z80dart.h" -#include "video/tms9927.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define P8085AH_0_TAG "17f" -#define P8259A_TAG "17d" -#define P8253_5_0_TAG "17c" -#define P8253_5_1_TAG "18c" -#define ER3400_TAG "12a" - -#define P8085AH_1_TAG "6c" -#define TMS9937NL_TAG "7e" -#define MK3887N4_TAG "15d" - -#define MC68B02P_TAG "12b" -#define FD1797PL02_TAG "fd1797" - -#define SCREEN_TAG "screen" - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class tdv2324_state : public driver_device -{ -public: - tdv2324_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, P8085AH_0_TAG), - m_subcpu(*this, P8085AH_1_TAG), - m_fdccpu(*this, MC68B02P_TAG), - m_sio(*this, MK3887N4_TAG), - m_pic(*this, P8259A_TAG), - m_pit0(*this, P8253_5_0_TAG), - m_pit1(*this, P8253_5_1_TAG), - m_tms(*this, TMS9937NL_TAG), - m_video_ram(*this, "video_ram") - { } - - required_device m_maincpu; - required_device m_subcpu; - required_device m_fdccpu; - required_device m_sio; - required_device m_pic; - required_device m_pit0; - required_device m_pit1; - required_device m_tms; - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( tdv2324_main_io_30 ); - DECLARE_READ8_MEMBER( tdv2324_main_io_e6 ); - DECLARE_WRITE8_MEMBER( tdv2324_main_io_e2 ); - - UINT8 m_sub_status; - UINT8 m_sub_data; - - // video state - required_shared_ptr m_video_ram; -}; - - -#endif diff --git a/src/mess/includes/tek405x.h b/src/mess/includes/tek405x.h deleted file mode 100644 index f2a70fbd86e..00000000000 --- a/src/mess/includes/tek405x.h +++ /dev/null @@ -1,162 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __TEK405X__ -#define __TEK405X__ - -#include "emu.h" -#include "cpu/m6800/m6800.h" -#include "machine/ram.h" -#include "machine/6821pia.h" -#include "machine/6850acia.h" -#include "machine/clock.h" -#include "bus/ieee488/ieee488.h" -#include "machine/ram.h" -#include "sound/speaker.h" -#include "video/vector.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define MC6800_TAG "u61" -#define MC6820_Y_TAG "u561" -#define MC6820_X_TAG "u565" -#define MC6820_TAPE_TAG "u361" -#define MC6820_KB_TAG "u461" -#define MC6820_GPIB_TAG "u265" -#define MC6820_COM_TAG "u5" -#define MC6850_TAG "u25" -#define RS232_TAG "rs232" -#define SCREEN_TAG "screen" - -#define AM2901A_TAG "am2901a" - -class tek4051_state : public driver_device -{ -public: - tek4051_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, MC6800_TAG), - m_gpib_pia(*this, MC6820_GPIB_TAG), - m_com_pia(*this, MC6820_COM_TAG), - m_acia(*this, MC6850_TAG), - m_acia_clock(*this, "acia_clock"), - m_gpib(*this, IEEE488_TAG), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG), - m_rom(*this, MC6800_TAG), - m_bsofl_rom(*this, "020_0147_00"), - m_bscom_rom(*this, "021_0188_00"), - m_special(*this, "SPECIAL") - { - } - - required_device m_maincpu; - required_device m_gpib_pia; - required_device m_com_pia; - required_device m_acia; - required_device m_acia_clock; - required_device m_gpib; - required_device m_speaker; - required_device m_ram; - required_memory_region m_rom; - required_memory_region m_bsofl_rom; - required_memory_region m_bscom_rom; - required_ioport m_special; - - virtual void machine_start(); - - virtual void video_start(); - - void bankswitch(UINT8 data); - void update_irq(); - void update_nmi(); - void scan_keyboard(); - - DECLARE_WRITE8_MEMBER( lbs_w ); - - DECLARE_READ8_MEMBER( x_pia_pa_r ); - DECLARE_WRITE8_MEMBER( x_pia_pa_w ); - DECLARE_WRITE8_MEMBER( x_pia_pb_w ); - DECLARE_WRITE_LINE_MEMBER( adot_w ); - DECLARE_WRITE_LINE_MEMBER( bufclk_w ); - DECLARE_WRITE_LINE_MEMBER( x_pia_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( x_pia_irqb_w ); - - DECLARE_READ8_MEMBER( sa_r ); - DECLARE_WRITE8_MEMBER( y_pia_pa_w ); - DECLARE_WRITE8_MEMBER( sb_w ); - DECLARE_WRITE_LINE_MEMBER( sot_w ); - DECLARE_WRITE_LINE_MEMBER( y_pia_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( y_pia_irqb_w ); - - DECLARE_READ8_MEMBER( kb_pia_pa_r ); - DECLARE_READ8_MEMBER( kb_pia_pb_r ); - DECLARE_WRITE8_MEMBER( kb_pia_pb_w ); - DECLARE_WRITE_LINE_MEMBER( kb_halt_w ); - DECLARE_WRITE_LINE_MEMBER( kb_pia_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( kb_pia_irqb_w ); - - DECLARE_READ8_MEMBER( tape_pia_pa_r ); - DECLARE_WRITE8_MEMBER( tape_pia_pa_w ); - DECLARE_WRITE8_MEMBER( tape_pia_pb_w ); - DECLARE_WRITE_LINE_MEMBER( tape_pia_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( tape_pia_irqb_w ); - - DECLARE_WRITE8_MEMBER( dio_w ); - DECLARE_READ8_MEMBER( gpib_pia_pb_r ); - DECLARE_WRITE8_MEMBER( gpib_pia_pb_w ); - DECLARE_WRITE_LINE_MEMBER( talk_w ); - DECLARE_WRITE_LINE_MEMBER( gpib_pia_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( gpib_pia_irqb_w ); - - DECLARE_WRITE8_MEMBER( com_pia_pa_w ); - DECLARE_READ8_MEMBER( com_pia_pb_r ); - DECLARE_WRITE8_MEMBER( com_pia_pb_w ); - DECLARE_WRITE_LINE_MEMBER( com_pia_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( com_pia_irqb_w ); - DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); - DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); - - // interrupts - int m_x_pia_irqa; - int m_x_pia_irqb; - int m_y_pia_irqa; - int m_y_pia_irqb; - int m_tape_pia_irqa; - int m_tape_pia_irqb; - int m_kb_pia_irqa; - int m_kb_pia_irqb; - int m_gpib_pia_irqa; - int m_gpib_pia_irqb; - int m_com_pia_irqa; - int m_com_pia_irqb; - int m_acia_irq; - - // keyboard - int m_kbhalt; - int m_kc; - - // GPIB - int m_talk; - TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick); -}; - -class tek4052_state : public driver_device -{ -public: - tek4052_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, AM2901A_TAG), - m_ram(*this, RAM_TAG) - { } - - required_device m_maincpu; - required_device m_ram; - - virtual void machine_start(); - - virtual void video_start(); -}; - -#endif diff --git a/src/mess/includes/thomson.h b/src/mess/includes/thomson.h deleted file mode 100644 index 19c07cf763f..00000000000 --- a/src/mess/includes/thomson.h +++ /dev/null @@ -1,713 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Thomson 8-bit computers - -**********************************************************************/ - -#ifndef _THOMSON_H_ -#define _THOMSON_H_ - -#include "emu.h" -#include "bus/rs232/rs232.h" -#include "cpu/m6809/m6809.h" -#include "machine/6821pia.h" -#include "machine/mc6846.h" -#include "machine/6850acia.h" -#include "machine/mos6551.h" -#include "sound/dac.h" -#include "audio/mea8000.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/cassette.h" -#include "machine/mc6843.h" -#include "machine/mc6846.h" -#include "machine/mc6854.h" -#include "formats/thom_cas.h" -#include "formats/thom_dsk.h" -#include "machine/thomflop.h" -#include "imagedev/floppy.h" -#include "machine/ram.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -/* 6821 PIAs */ -#define THOM_PIA_SYS "pia_0" /* system PIA */ -#define THOM_PIA_GAME "pia_1" /* music & game PIA (joypad + sound) */ -#define THOM_PIA_IO "pia_2" /* CC 90-232 I/O extension (parallel & RS-232) */ -#define THOM_PIA_MODEM "pia_3" /* MD 90-120 MODEM extension */ - -/* sound ports */ -#define THOM_SOUND_BUZ 0 /* 1-bit buzzer */ -#define THOM_SOUND_GAME 1 /* 6-bit game port DAC */ -#define THOM_SOUND_SPEECH 2 /* speech synthesis */ - -/* bank-switching */ -#define THOM_CART_BANK "bank2" /* cartridge ROM */ -#define THOM_RAM_BANK "bank3" /* data RAM */ -#define THOM_FLOP_BANK "bank4" /* external floppy controller ROM */ -#define THOM_BASE_BANK "bank5" /* system RAM */ - -/* bank-switching */ -#define TO8_SYS_LO "bank5" /* system RAM low 2 Kb */ -#define TO8_SYS_HI "bank6" /* system RAM hi 2 Kb */ -#define TO8_DATA_LO "bank7" /* data RAM low 2 Kb */ -#define TO8_DATA_HI "bank8" /* data RAM hi 2 Kb */ -#define TO8_BIOS_BANK "bank9" /* BIOS ROM */ -#define MO6_CART_LO "bank10" -#define MO6_CART_HI "bank11" - - -/* original screen dimension (may be different from emulated screen!) */ -#define THOM_ACTIVE_WIDTH 320 -#define THOM_BORDER_WIDTH 56 -#define THOM_ACTIVE_HEIGHT 200 -#define THOM_BORDER_HEIGHT 47 -#define THOM_TOTAL_WIDTH 432 -#define THOM_TOTAL_HEIGHT 294 - -/* Emulated screen dimension may be doubled to allow hi-res 640x200 mode. - Emulated screen can have smaller borders. - */ - -/* maximum number of video pages: - 1 for TO7 generation (including MO5) - 4 for TO8 generation (including TO9, MO6) - */ -#define THOM_NB_PAGES 4 - -/* page 0 is banked */ -#define THOM_VRAM_BANK "bank1" - - -struct thom_vsignal { - unsigned count; /* pixel counter */ - unsigned init; /* 1 -> active vertical windos, 0 -> border/VBLANK */ - unsigned inil; /* 1 -> active horizontal window, 0 -> border/HBLANK */ - unsigned lt3; /* bit 3 of us counter */ - unsigned line; /* line counter */ -}; - - -class thomson_state : public driver_device -{ -public: - thomson_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_mc6854(*this, "mc6854"), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_buzzer(*this, "buzzer"), - m_dac(*this, "dac"), - m_centronics(*this, "centronics"), - m_cent_data_out(*this, "cent_data_out"), - m_pia_sys(*this, THOM_PIA_SYS), - m_pia_game(*this, THOM_PIA_GAME), - m_acia(*this, "acia6850"), - m_mea8000(*this, "mea8000"), - m_ram(*this, RAM_TAG), - m_mc6846(*this, "mc6846"), - m_mc6843(*this, "mc6843"), - m_acia6850(*this, "acia6850"), - m_screen(*this, "screen"), - m_io_game_port_directions(*this, "game_port_directions"), - m_io_game_port_buttons(*this, "game_port_buttons"), - m_io_mouse_x(*this, "mouse_x"), - m_io_mouse_y(*this, "mouse_y"), - m_io_mouse_button(*this, "mouse_button"), - m_io_lightpen_x(*this, "lightpen_x"), - m_io_lightpen_y(*this, "lightpen_y"), - m_io_lightpen_button(*this, "lightpen_button"), - m_io_config(*this, "config"), - m_io_vconfig(*this, "vconfig"), - m_io_mconfig(*this, "mconfig"), - m_io_fconfig(*this, "fconfig"), - m_io_keyboard(*this, "keyboard"), - m_vrambank(*this, THOM_VRAM_BANK), - m_cartbank(*this, THOM_CART_BANK), - m_rambank(*this, THOM_RAM_BANK), - m_flopbank(*this, THOM_FLOP_BANK), - m_basebank(*this, THOM_BASE_BANK), - m_syslobank(*this, TO8_SYS_LO), - m_syshibank(*this, TO8_SYS_HI), - m_datalobank(*this, TO8_DATA_LO), - m_datahibank(*this, TO8_DATA_HI), - m_biosbank(*this, TO8_BIOS_BANK), - m_cartlobank(*this, MO6_CART_LO), - m_carthibank(*this, MO6_CART_HI) - { - } - - DECLARE_FLOPPY_FORMATS(cd90_640_formats); - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( to7_cartridge ); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( mo5_cartridge ); - - DECLARE_WRITE_LINE_MEMBER( to7_set_cassette_motor ); - DECLARE_WRITE_LINE_MEMBER( mo5_set_cassette_motor ); - DECLARE_WRITE_LINE_MEMBER( thom_dev_irq_0 ); - DECLARE_WRITE_LINE_MEMBER( thom_irq_1 ); - DECLARE_WRITE_LINE_MEMBER( thom_firq_1 ); - DECLARE_WRITE8_MEMBER( to7_cartridge_w ); - DECLARE_READ8_MEMBER( to7_cartridge_r ); - DECLARE_WRITE8_MEMBER( to7_timer_port_out ); - DECLARE_WRITE8_MEMBER( to7_timer_cp2_out ); - DECLARE_READ8_MEMBER( to7_timer_port_in ); - DECLARE_WRITE8_MEMBER( to7_timer_tco_out ); - DECLARE_WRITE_LINE_MEMBER( to7_sys_cb2_out ); - DECLARE_WRITE8_MEMBER( to7_sys_portb_out ); - DECLARE_READ8_MEMBER( to7_sys_porta_in ); - DECLARE_READ8_MEMBER( to7_sys_portb_in ); - DECLARE_WRITE_LINE_MEMBER( to7_modem_cb ); - DECLARE_WRITE_LINE_MEMBER( to7_modem_tx_w ); - DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); - DECLARE_READ8_MEMBER( to7_modem_mea8000_r ); - DECLARE_WRITE8_MEMBER( to7_modem_mea8000_w ); - DECLARE_READ8_MEMBER( to7_game_porta_in ); - DECLARE_READ8_MEMBER( to7_game_portb_in ); - DECLARE_WRITE8_MEMBER( to7_game_portb_out ); - DECLARE_WRITE_LINE_MEMBER( to7_game_cb2_out ); - TIMER_CALLBACK_MEMBER( to7_game_update_cb ); - DECLARE_READ8_MEMBER( to7_midi_r ); - DECLARE_WRITE8_MEMBER( to7_midi_w ); - DECLARE_MACHINE_RESET( to7 ); - DECLARE_MACHINE_START( to7 ); - DECLARE_WRITE_LINE_MEMBER( to770_sys_cb2_out ); - DECLARE_READ8_MEMBER( to770_sys_porta_in ); - void to7_update_cart_bank_postload(); - void to770_update_ram_bank_postload(); - DECLARE_WRITE8_MEMBER( to770_sys_portb_out ); - DECLARE_WRITE8_MEMBER( to770_timer_port_out ); - DECLARE_READ8_MEMBER( to770_gatearray_r ); - DECLARE_WRITE8_MEMBER( to770_gatearray_w ); - DECLARE_MACHINE_RESET( to770 ); - DECLARE_MACHINE_START( to770 ); - void to7_lightpen_cb( int step ); - void mo5_lightpen_cb( int step ); - TIMER_CALLBACK_MEMBER( mo5_periodic_cb ); - DECLARE_WRITE8_MEMBER( mo5_sys_porta_out ); - DECLARE_READ8_MEMBER( mo5_sys_porta_in ); - DECLARE_WRITE8_MEMBER( mo5_sys_portb_out ); - DECLARE_READ8_MEMBER( mo5_sys_portb_in ); - DECLARE_READ8_MEMBER( mo5_gatearray_r ); - DECLARE_WRITE8_MEMBER( mo5_gatearray_w ); - void mo5_update_cart_bank_postload(); - DECLARE_WRITE8_MEMBER( mo5_cartridge_w ); - DECLARE_READ8_MEMBER( mo5_cartridge_r ); - DECLARE_WRITE8_MEMBER( mo5_ext_w ); - DECLARE_MACHINE_RESET( mo5 ); - DECLARE_MACHINE_START( mo5 ); - DECLARE_WRITE8_MEMBER( to9_ieee_w ); - DECLARE_READ8_MEMBER( to9_ieee_r ); - DECLARE_READ8_MEMBER( to9_gatearray_r ); - DECLARE_WRITE8_MEMBER( to9_gatearray_w ); - DECLARE_READ8_MEMBER( to9_vreg_r ); - DECLARE_WRITE8_MEMBER( to9_vreg_w ); - void to9_update_cart_bank_postload(); - DECLARE_WRITE8_MEMBER( to9_cartridge_w ); - DECLARE_READ8_MEMBER( to9_cartridge_r ); - void to9_update_ram_bank_postload(); - DECLARE_READ8_MEMBER( to9_kbd_r ); - DECLARE_WRITE8_MEMBER( to9_kbd_w ); - TIMER_CALLBACK_MEMBER( to9_kbd_timer_cb ); - DECLARE_READ8_MEMBER( to9_sys_porta_in ); - DECLARE_WRITE8_MEMBER( to9_sys_porta_out ); - DECLARE_WRITE8_MEMBER( to9_sys_portb_out ); - DECLARE_WRITE8_MEMBER( to9_timer_port_out ); - DECLARE_MACHINE_RESET( to9 ); - DECLARE_MACHINE_START( to9 ); - TIMER_CALLBACK_MEMBER( to8_kbd_timer_cb ); - void to8_update_floppy_bank_postload(); - void to8_update_ram_bank_postload(); - void to8_update_cart_bank_postload(); - DECLARE_WRITE8_MEMBER( to8_cartridge_w ); - DECLARE_READ8_MEMBER( to8_cartridge_r ); - DECLARE_READ8_MEMBER( to8_floppy_r ); - DECLARE_WRITE8_MEMBER( to8_floppy_w ); - DECLARE_READ8_MEMBER( to8_gatearray_r ); - DECLARE_WRITE8_MEMBER( to8_gatearray_w ); - DECLARE_READ8_MEMBER( to8_vreg_r ); - DECLARE_WRITE8_MEMBER( to8_vreg_w ); - DECLARE_READ8_MEMBER( to8_sys_porta_in ); - DECLARE_WRITE8_MEMBER( to8_sys_portb_out ); - DECLARE_READ8_MEMBER( to8_timer_port_in ); - DECLARE_WRITE8_MEMBER( to8_timer_port_out ); - DECLARE_WRITE8_MEMBER( to8_timer_cp2_out ); - void to8_lightpen_cb( int step ); - DECLARE_MACHINE_RESET( to8 ); - DECLARE_MACHINE_START( to8 ); - DECLARE_READ8_MEMBER( to9p_timer_port_in ); - DECLARE_WRITE8_MEMBER( to9p_timer_port_out ); - DECLARE_MACHINE_RESET( to9p ); - DECLARE_MACHINE_START( to9p ); - void mo6_update_ram_bank_postload(); - void mo6_update_cart_bank_postload(); - DECLARE_WRITE8_MEMBER( mo6_cartridge_w ); - DECLARE_READ8_MEMBER( mo6_cartridge_r ); - DECLARE_WRITE8_MEMBER( mo6_ext_w ); - DECLARE_WRITE_LINE_MEMBER( mo6_centronics_busy ); - DECLARE_WRITE8_MEMBER( mo6_game_porta_out ); - DECLARE_WRITE_LINE_MEMBER( mo6_game_cb2_out ); - TIMER_CALLBACK_MEMBER( mo6_game_update_cb ); - DECLARE_READ8_MEMBER( mo6_sys_porta_in ); - DECLARE_READ8_MEMBER( mo6_sys_portb_in ); - DECLARE_WRITE8_MEMBER( mo6_sys_porta_out ); - DECLARE_WRITE8_MEMBER( mo6_sys_portb_out ); - DECLARE_WRITE_LINE_MEMBER( mo6_sys_cb2_out ); - DECLARE_READ8_MEMBER( mo6_gatearray_r ); - DECLARE_WRITE8_MEMBER( mo6_gatearray_w ); - DECLARE_READ8_MEMBER( mo6_vreg_r ); - DECLARE_WRITE8_MEMBER( mo6_vreg_w ); - DECLARE_MACHINE_RESET( mo6 ); - DECLARE_MACHINE_START( mo6 ); - DECLARE_READ8_MEMBER( mo5nr_net_r ); - DECLARE_WRITE8_MEMBER( mo5nr_net_w ); - DECLARE_READ8_MEMBER( mo5nr_prn_r ); - DECLARE_WRITE8_MEMBER( mo5nr_prn_w ); - DECLARE_READ8_MEMBER( mo5nr_sys_portb_in ); - DECLARE_WRITE8_MEMBER( mo5nr_sys_porta_out ); - DECLARE_MACHINE_RESET( mo5nr ); - DECLARE_MACHINE_START( mo5nr ); - - TIMER_CALLBACK_MEMBER( thom_lightpen_step ); - TIMER_CALLBACK_MEMBER( thom_scanline_start ); - UINT32 screen_update_thom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE8_MEMBER( to7_vram_w ); - DECLARE_WRITE8_MEMBER( to770_vram_w ); - DECLARE_WRITE8_MEMBER( to8_sys_lo_w ); - DECLARE_WRITE8_MEMBER( to8_sys_hi_w ); - DECLARE_WRITE8_MEMBER( to8_data_lo_w ); - DECLARE_WRITE8_MEMBER( to8_data_hi_w ); - DECLARE_WRITE8_MEMBER( to8_vcart_w ); - DECLARE_WRITE8_MEMBER( mo6_vcart_lo_w ); - DECLARE_WRITE8_MEMBER( mo6_vcart_hi_w ); - TIMER_CALLBACK_MEMBER( thom_set_init ); - void to770_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void mo5_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void mo5alt_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void to9_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void bitmap4_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void bitmap4alt_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void bitmap4althalf_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void bitmap16_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void mode80_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void mode80_to9_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void page1_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void page2_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void overlay_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void overlayhalf_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void overlay3_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void to770_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void mo5_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void mo5alt_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void to9_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void bitmap4_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void bitmap4alt_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void bitmap4althalf_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void bitmap16_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void mode80_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void mode80_to9_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void page1_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void page2_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void overlay_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void overlayhalf_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void overlay3_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - void thom_vblank( screen_device &screen, bool state ); - DECLARE_VIDEO_START( thom ); - - DECLARE_READ8_MEMBER( to7_5p14_r ); - DECLARE_WRITE8_MEMBER( to7_5p14_w ); - DECLARE_READ8_MEMBER( to7_5p14sd_r ); - DECLARE_WRITE8_MEMBER( to7_5p14sd_w ); - DECLARE_READ8_MEMBER( to7_qdd_r ); - DECLARE_WRITE8_MEMBER( to7_qdd_w ); - TIMER_CALLBACK_MEMBER( thmfc_floppy_cmd_complete_cb ); - DECLARE_READ8_MEMBER( thmfc_floppy_r ); - DECLARE_WRITE8_MEMBER( thmfc_floppy_w ); - TIMER_CALLBACK_MEMBER( ans4 ); - TIMER_CALLBACK_MEMBER( ans3 ); - TIMER_CALLBACK_MEMBER( ans2 ); - TIMER_CALLBACK_MEMBER( ans ); - DECLARE_READ8_MEMBER( to7_network_r ); - DECLARE_WRITE8_MEMBER( to7_network_w ); - DECLARE_READ8_MEMBER( to7_floppy_r ); - DECLARE_WRITE8_MEMBER( to7_floppy_w ); - DECLARE_READ8_MEMBER( to9_floppy_r ); - DECLARE_WRITE8_MEMBER( to9_floppy_w ); - WRITE_LINE_MEMBER( fdc_index_0_w ); - WRITE_LINE_MEMBER( fdc_index_1_w ); - WRITE_LINE_MEMBER( fdc_index_2_w ); - WRITE_LINE_MEMBER( fdc_index_3_w ); - void thomson_index_callback(legacy_floppy_image_device *device, int state); - DECLARE_PALETTE_INIT(thom); - DECLARE_PALETTE_INIT(mo5); - - optional_device m_mc6854; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - - int m_centronics_busy; - int m_centronics_perror; - - MC6854_OUT_FRAME_CB(to7_network_got_frame); - -protected: - required_device m_maincpu; - required_device m_cassette; - required_device m_buzzer; - required_device m_dac; - optional_device m_centronics; - optional_device m_cent_data_out; - required_device m_pia_sys; - required_device m_pia_game; - required_device m_acia; - required_device m_mea8000; - required_device m_ram; - optional_device m_mc6846; - optional_device m_mc6843; - optional_device m_acia6850; - required_device m_screen; - required_ioport m_io_game_port_directions; - required_ioport m_io_game_port_buttons; - required_ioport m_io_mouse_x; - required_ioport m_io_mouse_y; - required_ioport m_io_mouse_button; - required_ioport m_io_lightpen_x; - required_ioport m_io_lightpen_y; - required_ioport m_io_lightpen_button; - required_ioport m_io_config; - required_ioport m_io_vconfig; - optional_ioport m_io_mconfig; - required_ioport m_io_fconfig; - required_ioport_array<10> m_io_keyboard; - required_memory_bank m_vrambank; - optional_memory_bank m_cartbank; - optional_memory_bank m_rambank; - required_memory_bank m_flopbank; - required_memory_bank m_basebank; - required_memory_bank m_syslobank; - optional_memory_bank m_syshibank; - optional_memory_bank m_datalobank; - optional_memory_bank m_datahibank; - optional_memory_bank m_biosbank; - optional_memory_bank m_cartlobank; - optional_memory_bank m_carthibank; - - /* bank logging and optimisations */ - int m_old_cart_bank; - int m_old_cart_bank_was_read_only; - int m_old_ram_bank; - int m_old_floppy_bank; - /* buffer storing demodulated bits, only for k7 and with speed hack */ - UINT32 m_to7_k7_bitsize; - UINT8* m_to7_k7_bits; - /* several devices on the same irqs */ - UINT8 m_thom_irq; - UINT8 m_thom_firq; - /* ------------ cartridge ------------ */ - UINT8 m_thom_cart_nb_banks; /* number of 16 KB banks (up to 4) */ - UINT8 m_thom_cart_bank; /* current bank */ - UINT8 m_to7_lightpen_step; - UINT8 m_to7_lightpen; - UINT8 m_to7_modem_tx; - /* calls to7_game_update_cb periodically */ - emu_timer* m_to7_game_timer; - UINT8 m_to7_game_sound; - UINT8 m_to7_game_mute; - emu_timer* m_mo5_periodic_timer; - UINT8 m_mo5_reg_cart; /* 0xa7cb bank switch */ - UINT8 m_to9_palette_data[32]; - UINT8 m_to9_palette_idx; - UINT8 m_to9_soft_bank; - UINT8 m_to9_kbd_parity; /* 0=even, 1=odd, 2=no parity */ - UINT8 m_to9_kbd_intr; /* interrupt mode */ - UINT8 m_to9_kbd_in; /* data from keyboard */ - UINT8 m_to9_kbd_status; /* status */ - UINT8 m_to9_kbd_overrun; /* character lost */ - UINT8 m_to9_kbd_periph; /* peripherial mode */ - UINT8 m_to9_kbd_byte_count; /* byte-count in peripherial mode */ - UINT16 m_to9_mouse_x; - UINT16 m_to9_mouse_y; - UINT8 m_to9_kbd_last_key; /* for key repetition */ - UINT16 m_to9_kbd_key_count; - UINT8 m_to9_kbd_caps; /* caps-lock */ - UINT8 m_to9_kbd_pad; /* keypad outputs special codes */ - emu_timer* m_to9_kbd_timer; - UINT8 m_to8_kbd_ack; /* 1 = cpu inits / accepts transfers */ - UINT16 m_to8_kbd_data; /* data to transmit */ - UINT16 m_to8_kbd_step; /* transmission automaton state */ - UINT8 m_to8_kbd_last_key; /* last key (for repetition) */ - UINT32 m_to8_kbd_key_count; /* keypress time (for repetition) */ - UINT8 m_to8_kbd_caps; /* caps lock */ - emu_timer* m_to8_kbd_timer; /* bit-send */ - emu_timer* m_to8_kbd_signal; /* signal from CPU */ - UINT8 m_to8_data_vpage; - UINT8 m_to8_cart_vpage; - UINT8 m_to8_reg_ram; - UINT8 m_to8_reg_cart; - UINT8 m_to8_reg_sys1; - UINT8 m_to8_reg_sys2; - UINT8 m_to8_lightpen_intr; - UINT8 m_to8_soft_select; - UINT8 m_to8_soft_bank; - UINT8 m_to8_bios_bank; - - /* We allow choosing dynamically: - - the border size - - whether we use 640 pixels or 320 pixels in an active row - (now this is automatically choosen by default for each frame) - */ - UINT16 m_thom_bwidth; - UINT16 m_thom_bheight; - /* border size */ - UINT8 m_thom_hires; - /* 0 = low res: 320x200 active area (faster) - 1 = hi res: 640x200 active area (can represent all video modes) - */ - UINT8 m_thom_hires_better; - /* 1 = a 640 mode was used in the last frame */ - /* we use our own video timing to precisely cope with VBLANK and HBLANK */ - emu_timer* m_thom_video_timer; /* time elapsed from beginning of frame */ - /* number of lightpen call-backs per frame */ - int m_thom_lightpen_nb; - /* called thom_lightpen_nb times */ - emu_timer *m_thom_lightpen_timer; - /* lightpen callback function to call from timer */ - void (thomson_state::*m_thom_lightpen_cb)(int step); - UINT8* m_thom_vram; /* pointer to video memory */ - emu_timer* m_thom_scanline_timer; /* scan-line udpate */ - UINT16 m_thom_last_pal[16]; /* palette at last scanline start */ - UINT16 m_thom_pal[16]; /* current palette */ - UINT8 m_thom_pal_changed; /* whether pal != old_pal */ - UINT8 m_thom_border_index; /* current border color index */ - /* the left and right border color for each row (including top and bottom - border rows); -1 means unchanged wrt last scanline - */ - INT16 m_thom_border_l[THOM_TOTAL_HEIGHT+1]; - INT16 m_thom_border_r[THOM_TOTAL_HEIGHT+1]; - /* active area, updated one scan-line at a time every 64us, - then blitted in screen_update - */ - UINT16 m_thom_vbody[640*200]; - UINT8 m_thom_vmode; /* current vide mode */ - UINT8 m_thom_vpage; /* current video page */ - /* this stores the video mode & page at each GPL in the current line - (-1 means unchanged) - */ - INT16 m_thom_vmodepage[41]; - UINT8 m_thom_vmodepage_changed; - /* one dirty flag for each video memory line */ - UINT8 m_thom_vmem_dirty[205]; - /* set to 1 if undirty scanlines need to be redrawn due to other video state - changes */ - UINT8 m_thom_vstate_dirty; - UINT8 m_thom_vstate_last_dirty; - UINT32 m_thom_mode_point; - UINT32 m_thom_floppy_wcount; - UINT32 m_thom_floppy_rcount; - emu_timer *m_thom_init_timer; - void (thomson_state::*m_thom_init_cb)( int init ); - - int to7_get_cassette(); - void to7_set_cassette( int data ); - int mo5_get_cassette(); - void mo5_set_cassette( int data ); - void thom_set_irq( int line, int state ); - void thom_set_firq( int line, int state ); - void thom_irq_reset(); - void thom_irq_init(); - void thom_irq_0( int state ); - void thom_irq_3( int state ); - void thom_firq_2( int state ); - void thom_irq_4( int state ); - void thom_set_caps_led( int led ); - void to7_update_cart_bank(); - void to7_set_init( int init ); - void to7_modem_reset(); - void to7_modem_init(); - UINT8 to7_get_mouse_signal(); - void to7_game_sound_update(); - void to7_game_init(); - void to7_game_reset(); - void to7_midi_reset(); - void to7_midi_init(); - void to770_update_ram_bank(); - void mo5_init_timer(); - void mo5_update_cart_bank(); - void to9_set_video_mode( UINT8 data, int style ); - void to9_palette_init(); - void to9_update_cart_bank(); - void to9_update_ram_bank(); - int to9_kbd_ktest(); - void to9_kbd_update_irq(); - void to9_kbd_send( UINT8 data, int parity ); - int to9_kbd_get_key(); - void to9_kbd_reset(); - void to9_kbd_init(); - int to8_kbd_ktest(); - int to8_kbd_get_key(); - void to8_kbd_timer_func(); - void to8_kbd_set_ack( int data ); - void to8_kbd_reset(); - void to8_kbd_init(); - void to8_update_floppy_bank(); - void to8_update_ram_bank(); - void to8_update_cart_bank(); - void to8_floppy_init(); - void to8_floppy_reset(); - void mo6_update_ram_bank(); - void mo6_update_cart_bank(); - void mo6_game_init(); - void mo6_game_reset(); - void mo5nr_game_init(); - void mo5nr_game_reset(); - - int thom_update_screen_size(); - unsigned thom_video_elapsed(); - struct thom_vsignal thom_get_vsignal(); - void thom_get_lightpen_pos( int*x, int* y ); - struct thom_vsignal thom_get_lightpen_vsignal( int xdec, int ydec, int xdec2 ); - void thom_set_lightpen_callback( int nb ); - int thom_mode_is_hires( int mode ); - void thom_border_changed(); - void thom_gplinfo_changed(); - void thom_set_border_color( unsigned index ); - void thom_set_palette( unsigned index, UINT16 color ); - void thom_set_video_mode( unsigned mode ); - void thom_set_video_page( unsigned page ); - void thom_set_mode_point( int point ); - void thom_floppy_active( int write ); - unsigned to7_lightpen_gpl( int decx, int decy ); - void thom_configure_palette( double gamma, const UINT16* pal, palette_device& palette ); - - int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size ); - int thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, UINT8* dst, int sector_size ); - int thom_floppy_make_track( legacy_floppy_image_device* img, UINT8* dst, int sector_size, int side ); - int thom_qdd_make_addr( int sector, UINT8* dst ); - int thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, UINT8* dst ); - int thom_qdd_make_disk ( legacy_floppy_image_device* img, UINT8* dst ); - void to7_5p14_reset(); - void to7_5p14_init(); - void to7_5p14_index_pulse_callback( device_t *controller,legacy_floppy_image_device *image, int state ); - void to7_5p14sd_reset(); - void to7_5p14sd_init(); - void to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state ); - legacy_floppy_image_device * to7_qdd_image(); - void to7_qdd_stat_update(); - UINT8 to7_qdd_read_byte(); - void to7_qdd_write_byte( UINT8 data ); - void to7_qdd_reset(); - void to7_qdd_init(); - legacy_floppy_image_device * thmfc_floppy_image(); - int thmfc_floppy_is_qdd( legacy_floppy_image_device *image ); - void thmfc_floppy_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state ); - int thmfc_floppy_find_sector( chrn_id* dst ); - void thmfc_floppy_cmd_complete(); - UINT8 thmfc_floppy_read_byte(); - UINT8 thmfc_floppy_raw_read_byte(); - void thmfc_floppy_qdd_write_byte( UINT8 data ); - void thmfc_floppy_write_byte( UINT8 data ); - void thmfc_floppy_format_byte( UINT8 data ); - void thmfc_floppy_reset(); - void thmfc_floppy_init(); - void to7_network_init(); - void to7_network_reset(); - void to7_floppy_init( void* base ); - void to7_floppy_reset(); - void to9_floppy_init(void* int_base, void* ext_base); - void to9_floppy_reset(); - void to7_midi_update_irq ( ); - void to7_midi_ready_to_send_cb( ); -}; - -/*----------- defined in video/thomson.c -----------*/ - -/* - TO7 video: - one line (64 us) = - 56 left border pixels ( 7 us) - + 320 active pixels (40 us) - + 56 right border pixels ( 7 us) - + horizontal retrace (10 us) - - one image (20 ms) = - 47 top border lines (~3 ms) - + 200 active lines (12.8 ms) - + 47 bottom border lines (~3 ms) - + vertical retrace (~1 ms) - - TO9 and up introduced a half (160 pixels) and double (640 pixels) - horizontal mode, but still in 40 us (no change in refresh rate). -*/ - - -/***************************** dimensions **************************/ - - -/*********************** video signals *****************************/ - -/***************************** commons *****************************/ - - -/* video modes */ -#define THOM_VMODE_TO770 0 -#define THOM_VMODE_MO5 1 -#define THOM_VMODE_BITMAP4 2 -#define THOM_VMODE_BITMAP4_ALT 3 -#define THOM_VMODE_80 4 -#define THOM_VMODE_BITMAP16 5 -#define THOM_VMODE_PAGE1 6 -#define THOM_VMODE_PAGE2 7 -#define THOM_VMODE_OVERLAY 8 -#define THOM_VMODE_OVERLAY3 9 -#define THOM_VMODE_TO9 10 -#define THOM_VMODE_80_TO9 11 -#define THOM_VMODE_BITMAP4_ALT_HALF 12 -#define THOM_VMODE_MO5_ALT 13 -#define THOM_VMODE_OVERLAY_HALF 14 -#define THOM_VMODE_NB 15 - - -class to7_io_line_device : public device_t -{ -public: - // construction/destruction - to7_io_line_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - /* read data register */ - DECLARE_READ8_MEMBER(porta_in); - - /* write data register */ - DECLARE_WRITE8_MEMBER(porta_out); - - DECLARE_WRITE_LINE_MEMBER(write_rxd); - DECLARE_WRITE_LINE_MEMBER(write_cts); - DECLARE_WRITE_LINE_MEMBER(write_dsr); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - -protected: - // device-level overrides - virtual void device_start(); - machine_config_constructor device_mconfig_additions() const; - -private: - required_device m_pia_io; - required_device m_rs232; - int m_last_low; - int m_centronics_busy; - int m_rxd; - int m_cts; - int m_dsr; -}; - -extern const device_type TO7_IO_LINE; - -#define MCFG_TO7_IO_LINE_ADD(_tag) \ - MCFG_DEVICE_ADD((_tag), TO7_IO_LINE, 0) - -#endif /* _THOMSON_H_ */ diff --git a/src/mess/includes/ti85.h b/src/mess/includes/ti85.h deleted file mode 100644 index d77433eaf21..00000000000 --- a/src/mess/includes/ti85.h +++ /dev/null @@ -1,229 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha,Jon Sturm -/***************************************************************************** - * - * includes/ti85.h - * - ****************************************************************************/ - -#ifndef TI85_H_ -#define TI85_H_ - -#include "imagedev/snapquik.h" -#include "video/t6a04.h" -#include "machine/bankdev.h" -#include "sound/speaker.h" -#include "machine/nvram.h" -#include "machine/intelfsh.h" - - -/* model */ -enum ti85_model { - TI81, - TI81v2, - TI82, - TI83, - TI85, - TI86, - TI83P, - TI83PSE, - TI84P, - TI84PSE -}; - -typedef struct -{ - UINT8 loop; - UINT8 setup; - float divsor; - bool interrupt; - UINT8 max; - UINT8 count; -} ti83pse_timer; - -typedef enum TI83PSE_CTIMER -{ - CRYSTAL_TIMER1 = 0, - CRYSTAL_TIMER2, - CRYSTAL_TIMER3, - HW_TIMER1, - HW_TIMER2 -} ti83pse_ctimers; - -class ti85_state : public driver_device -{ -public: - ti85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), -// m_serial(*this, "tiserial"), - m_nvram(*this, "nvram"), - m_flash(*this, "flash"), - m_membank1(*this, "membank1"), - m_membank2(*this, "membank2"), - m_membank3(*this, "membank3"), - m_membank4(*this, "membank4") - { } - - required_device m_maincpu; - optional_device m_speaker; - //optional_device<> m_serial; - optional_shared_ptr m_nvram; - optional_device m_flash; - optional_device m_membank1; - optional_device m_membank2; - optional_device m_membank3; - optional_device m_membank4; - - ti85_model m_model; - - UINT8 m_LCD_memory_base; - UINT8 m_LCD_contrast; - UINT8 m_LCD_status; - UINT8 m_timer_interrupt_mask; - UINT8 m_timer_interrupt_status; - UINT8 m_ctimer_interrupt_status; - UINT8 m_ON_interrupt_mask; - UINT8 m_ON_interrupt_status; - UINT8 m_ON_pressed; - UINT8 m_flash_unlocked; - UINT8 m_ti8x_memory_page_1; - UINT8 m_ti8x_memory_page_2; - UINT8 m_ti8x_memory_page_3; - bool m_booting; - UINT8 m_LCD_mask; - UINT8 m_power_mode; - UINT8 m_cpu_speed; - UINT8 m_keypad_mask; - UINT8 m_video_buffer_width; - UINT8 m_interrupt_speed; - UINT8 m_port4_bit0; - UINT8 m_ti81_port_7_data; - UINT8 *m_ti8x_ram; - UINT8 m_PCR; - UINT8 m_red_out; - UINT8 m_white_out; - UINT8 m_ti8x_port2; - UINT8 m_ti83p_port4; - UINT8 m_ti83pse_port21; - int m_ti_video_memory_size; - int m_ti_screen_x_size; - int m_ti_screen_y_size; - int m_ti_number_of_frames; - UINT8 * m_frames; - UINT8 * m_bios; - DECLARE_READ8_MEMBER(ti85_port_0000_r); - DECLARE_READ8_MEMBER(ti8x_keypad_r); - DECLARE_READ8_MEMBER(ti85_port_0006_r); - DECLARE_READ8_MEMBER(ti8x_serial_r); - DECLARE_READ8_MEMBER(ti86_port_0005_r); - DECLARE_READ8_MEMBER(ti83_port_0000_r); - DECLARE_READ8_MEMBER(ti8x_plus_serial_r); - DECLARE_WRITE8_MEMBER(ti81_port_0007_w); - DECLARE_WRITE8_MEMBER(ti85_port_0000_w); - DECLARE_WRITE8_MEMBER(ti8x_keypad_w); - DECLARE_WRITE8_MEMBER(ti85_port_0002_w); - DECLARE_WRITE8_MEMBER(ti85_port_0003_w); - DECLARE_WRITE8_MEMBER(ti85_port_0004_w); - DECLARE_WRITE8_MEMBER(ti85_port_0005_w); - DECLARE_WRITE8_MEMBER(ti85_port_0006_w); - DECLARE_WRITE8_MEMBER(ti8x_serial_w); - DECLARE_WRITE8_MEMBER(ti86_port_0005_w); - DECLARE_WRITE8_MEMBER(ti86_port_0006_w); - DECLARE_WRITE8_MEMBER(ti82_port_0002_w); - DECLARE_WRITE8_MEMBER(ti83_port_0000_w); - DECLARE_WRITE8_MEMBER(ti83_port_0002_w); - DECLARE_WRITE8_MEMBER(ti83_port_0003_w); - DECLARE_WRITE8_MEMBER(ti8x_plus_serial_w); - DECLARE_WRITE8_MEMBER(ti83p_int_mask_w); - DECLARE_WRITE8_MEMBER(ti83p_port_0004_w); - DECLARE_WRITE8_MEMBER(ti83p_port_0006_w); - DECLARE_WRITE8_MEMBER(ti83p_port_0007_w); - DECLARE_WRITE8_MEMBER(ti83pse_int_ack_w); - DECLARE_WRITE8_MEMBER(ti83pse_port_0004_w); - DECLARE_WRITE8_MEMBER(ti83pse_port_0005_w); - DECLARE_WRITE8_MEMBER(ti83pse_port_0006_w); - DECLARE_WRITE8_MEMBER(ti83pse_port_0007_w); - DECLARE_WRITE8_MEMBER(ti83p_port_0014_w); - DECLARE_WRITE8_MEMBER(ti83pse_port_0020_w); - DECLARE_WRITE8_MEMBER(ti83pse_port_0021_w); - DECLARE_READ8_MEMBER( ti85_port_0002_r ); - DECLARE_READ8_MEMBER( ti85_port_0003_r ); - DECLARE_READ8_MEMBER( ti85_port_0004_r ); - DECLARE_READ8_MEMBER( ti85_port_0005_r ); - DECLARE_READ8_MEMBER( ti86_port_0006_r ); - DECLARE_READ8_MEMBER( ti82_port_0002_r ); - DECLARE_READ8_MEMBER( ti83_port_0002_r ); - DECLARE_READ8_MEMBER( ti83_port_0003_r ); - DECLARE_READ8_MEMBER( ti83p_port_0002_r ); - DECLARE_READ8_MEMBER( ti83p_port_0004_r ); - DECLARE_READ8_MEMBER( ti83pse_port_0002_r ); - DECLARE_READ8_MEMBER( ti83pse_port_0005_r ); - DECLARE_READ8_MEMBER( ti83pse_port_0009_r ); - DECLARE_READ8_MEMBER( ti83pse_port_0015_r ); - DECLARE_READ8_MEMBER( ti83pse_port_0020_r ); - DECLARE_READ8_MEMBER( ti83pse_port_0021_r ); - DECLARE_READ8_MEMBER( ti84pse_port_0055_r ); - DECLARE_READ8_MEMBER( ti84pse_port_0056_r ); - virtual void machine_start(); - virtual void video_start(); - DECLARE_PALETTE_INIT(ti85); - DECLARE_MACHINE_RESET(ti85); - DECLARE_MACHINE_RESET(ti83p); - DECLARE_PALETTE_INIT(ti82); - DECLARE_MACHINE_START(ti86); - DECLARE_MACHINE_START(ti83p); - DECLARE_MACHINE_START(ti83pse); - DECLARE_MACHINE_START(ti84pse); - DECLARE_MACHINE_START(ti84p); - void ti8xpse_init_common(); - - UINT32 screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(ti85_timer_callback); - TIMER_CALLBACK_MEMBER(ti83_timer1_callback); - TIMER_CALLBACK_MEMBER(ti83_timer2_callback); - - //crystal timers - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - void ti83pse_count( UINT8 timer, UINT8 data); - - emu_timer *m_crystal_timer1; - emu_timer *m_crystal_timer2; - emu_timer *m_crystal_timer3; - DECLARE_READ8_MEMBER( ti83pse_ctimer1_setup_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer1_setup_w ); - DECLARE_READ8_MEMBER( ti83pse_ctimer1_loop_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer1_loop_w ); - DECLARE_READ8_MEMBER( ti83pse_ctimer1_count_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer1_count_w ); - DECLARE_READ8_MEMBER( ti83pse_ctimer2_setup_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer2_setup_w ); - DECLARE_READ8_MEMBER( ti83pse_ctimer2_loop_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer2_loop_w ); - DECLARE_READ8_MEMBER( ti83pse_ctimer2_count_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer2_count_w ); - DECLARE_READ8_MEMBER( ti83pse_ctimer3_setup_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer3_setup_w ); - DECLARE_READ8_MEMBER( ti83pse_ctimer3_loop_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer3_loop_w ); - DECLARE_READ8_MEMBER( ti83pse_ctimer3_count_r ); - DECLARE_WRITE8_MEMBER( ti83pse_ctimer3_count_w ); - - - void update_ti85_memory (); - void update_ti83p_memory (); - void update_ti83pse_memory (); - void update_ti86_memory (); - void ti8x_snapshot_setup_registers (UINT8 * data); - void ti85_setup_snapshot (UINT8 * data); - void ti86_setup_snapshot (UINT8 * data); - DECLARE_SNAPSHOT_LOAD_MEMBER( ti8x ); - DECLARE_DIRECT_UPDATE_MEMBER( ti83p_direct_update_handler ); - - ti83pse_timer m_ctimer[3]; - - //address_space &asic; -}; - -#endif /* TI85_H_ */ diff --git a/src/mess/includes/ti89.h b/src/mess/includes/ti89.h deleted file mode 100644 index 83f83020513..00000000000 --- a/src/mess/includes/ti89.h +++ /dev/null @@ -1,89 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/***************************************************************************** - * - * includes/ti89.h - * - ****************************************************************************/ - -#ifndef TI89_H_ -#define TI89_H_ - -#include "machine/intelfsh.h" - -class ti68k_state : public driver_device -{ -public: - ti68k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_flash(*this, "flash"), - m_rom_base(*this, "flash"), - m_io_bit0(*this, "BIT0"), - m_io_bit1(*this, "BIT1"), - m_io_bit2(*this, "BIT2"), - m_io_bit3(*this, "BIT3"), - m_io_bit4(*this, "BIT4"), - m_io_bit5(*this, "BIT5"), - m_io_bit6(*this, "BIT6"), - m_io_bit7(*this, "BIT7") - { } - - required_device m_maincpu; - required_device m_flash; - required_region_ptr m_rom_base; - required_ioport m_io_bit0; - required_ioport m_io_bit1; - required_ioport m_io_bit2; - required_ioport m_io_bit3; - required_ioport m_io_bit4; - required_ioport m_io_bit5; - required_ioport m_io_bit6; - required_ioport m_io_bit7; - - // hardware versions - enum { HW1=1, HW2, HW3, HW4 }; - - // HW specifications - UINT8 m_hw_version; - bool m_flash_mem; - UINT32 m_initial_pc; - - // keyboard - UINT16 m_kb_mask; - UINT8 m_on_key; - - // LCD - UINT8 m_lcd_on; - UINT32 m_lcd_base; - UINT16 m_lcd_width; - UINT16 m_lcd_height; - UINT16 m_lcd_contrast; - - // I/O - UINT16 m_io_hw1[0x10]; - UINT16 m_io_hw2[0x80]; - - // Timer - UINT8 m_timer_on; - UINT8 m_timer_val; - UINT16 m_timer_mask; - - virtual void machine_start(); - virtual void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - UINT8 keypad_r(); - DECLARE_WRITE16_MEMBER ( ti68k_io_w ); - DECLARE_READ16_MEMBER ( ti68k_io_r ); - DECLARE_WRITE16_MEMBER ( ti68k_io2_w ); - DECLARE_READ16_MEMBER ( ti68k_io2_r ); - DECLARE_WRITE16_MEMBER ( flash_w ); - DECLARE_READ16_MEMBER ( flash_r ); - UINT64 m_timer; - DECLARE_PALETTE_INIT(ti68k); - DECLARE_INPUT_CHANGED_MEMBER(ti68k_on_key); - TIMER_DEVICE_CALLBACK_MEMBER(ti68k_timer_callback); -}; - -#endif // TI89_H_ diff --git a/src/mess/includes/tiki100.h b/src/mess/includes/tiki100.h deleted file mode 100644 index e66d1a6ff65..00000000000 --- a/src/mess/includes/tiki100.h +++ /dev/null @@ -1,146 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __TIKI100__ -#define __TIKI100__ - - -#include "emu.h" -#include "bus/centronics/ctronics.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "formats/tiki100_dsk.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/z80pio.h" -#include "machine/wd_fdc.h" -#include "sound/ay8910.h" - -#define Z80_TAG "z80" -#define Z80DART_TAG "z80dart" -#define Z80PIO_TAG "z80pio" -#define Z80CTC_TAG "z80ctc" -#define FD1797_TAG "fd1797" -#define AY8912_TAG "ay8912" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" -#define CASSETTE_TAG "cassette" -#define CENTRONICS_TAG "centronics" -#define SCREEN_TAG "screen" - -#define TIKI100_VIDEORAM_SIZE 0x8000 -#define TIKI100_VIDEORAM_MASK 0x7fff - -#define BANK_ROM 0 -#define BANK_RAM 1 -#define BANK_VIDEO_RAM 2 - -class tiki100_state : public driver_device -{ -public: - tiki100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ctc(*this, Z80CTC_TAG), - m_fdc(*this, FD1797_TAG), - m_pio(*this, Z80PIO_TAG), - m_dart(*this, Z80DART_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, FD1797_TAG":0"), - m_floppy1(*this, FD1797_TAG":1"), - m_cassette(*this, CASSETTE_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_rom(*this, Z80_TAG), - m_video_ram(*this, "video_ram"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_y11(*this, "Y11"), - m_y12(*this, "Y12"), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_ctc; - required_device m_fdc; - required_device m_pio; - required_device m_dart; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_cassette; - required_device m_centronics; - required_memory_region m_rom; - optional_shared_ptr m_video_ram; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_y11; - required_ioport m_y12; - required_device m_palette; - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( gfxram_r ); - DECLARE_WRITE8_MEMBER( gfxram_w ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_WRITE8_MEMBER( keyboard_w ); - DECLARE_WRITE8_MEMBER( video_mode_w ); - DECLARE_WRITE8_MEMBER( palette_w ); - DECLARE_WRITE8_MEMBER( system_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z0_w ); - DECLARE_WRITE_LINE_MEMBER( ctc_z2_w ); - DECLARE_WRITE8_MEMBER( video_scroll_w ); - - DECLARE_READ8_MEMBER( pio_pb_r ); - DECLARE_WRITE8_MEMBER( pio_pb_w ); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - void bankswitch(); - - /* memory state */ - int m_rome; - int m_vire; - - /* video state */ - UINT8 m_scroll; - UINT8 m_mode; - UINT8 m_palette_val; - - /* keyboard state */ - int m_keylatch; - - TIMER_DEVICE_CALLBACK_MEMBER( ctc_tick ); - TIMER_DEVICE_CALLBACK_MEMBER( tape_tick ); - - DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - - int m_centronics_ack; - int m_centronics_busy; - int m_centronics_perror; -}; - -#endif diff --git a/src/mess/includes/tmc1800.h b/src/mess/includes/tmc1800.h deleted file mode 100644 index 43d9c98daca..00000000000 --- a/src/mess/includes/tmc1800.h +++ /dev/null @@ -1,209 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __TMC1800__ -#define __TMC1800__ - - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "machine/ram.h" -#include "machine/rescap.h" -#include "sound/cdp1864.h" -#include "video/cdp1861.h" -#include "sound/beep.h" - -#define TMC2000_COLORRAM_SIZE 0x200 - -#define SCREEN_TAG "screen" -#define CDP1802_TAG "cdp1802" -#define CDP1861_TAG "cdp1861" -#define CDP1864_TAG "m3" - -class tmc1800_base_state : public driver_device -{ -public: - tmc1800_base_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_cassette(*this, "cassette"), - m_rom(*this, CDP1802_TAG), - m_run(*this, "RUN"), - m_ram(*this, RAM_TAG), - m_beeper(*this, "beeper") - { } - - - required_device m_maincpu; - required_device m_cassette; - required_memory_region m_rom; - required_ioport m_run; - required_device m_ram; - optional_device m_beeper; - - DECLARE_QUICKLOAD_LOAD_MEMBER( tmc1800 ); -}; - -class tmc1800_state : public tmc1800_base_state -{ -public: - enum - { - TIMER_SETUP_BEEP - }; - - tmc1800_state(const machine_config &mconfig, device_type type, const char *tag) - : tmc1800_base_state(mconfig, type, tag), - m_vdc(*this, CDP1861_TAG) - { } - - required_device m_vdc; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( keylatch_w ); - DECLARE_READ8_MEMBER( dispon_r ); - DECLARE_WRITE8_MEMBER( dispoff_w ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - - /* keyboard state */ - int m_keylatch; /* key latch */ - DECLARE_DRIVER_INIT(tmc1800); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -class osc1000b_state : public tmc1800_base_state -{ -public: - osc1000b_state(const machine_config &mconfig, device_type type, const char *tag) - : tmc1800_base_state(mconfig, type, tag) - { } - - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_WRITE8_MEMBER( keylatch_w ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - - /* keyboard state */ - int m_keylatch; -}; - -class tmc2000_state : public tmc1800_base_state -{ -public: - tmc2000_state(const machine_config &mconfig, device_type type, const char *tag) - : tmc1800_base_state(mconfig, type, tag), - m_cti(*this, CDP1864_TAG), - m_colorram(*this, "color_ram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7") - { } - - required_device m_cti; - optional_shared_ptr m_colorram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( keylatch_w ); - DECLARE_WRITE8_MEMBER( bankswitch_w ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_WRITE8_MEMBER( dma_w ); - DECLARE_READ_LINE_MEMBER( rdata_r ); - DECLARE_READ_LINE_MEMBER( bdata_r ); - DECLARE_READ_LINE_MEMBER( gdata_r ); - DECLARE_INPUT_CHANGED_MEMBER( run_pressed ); - - void bankswitch(); - - // memory - int m_rac; - int m_roc; - - /* video state */ - UINT8 m_color; - - /* keyboard state */ - ioport_port* m_key_row[8]; - int m_keylatch; -}; - -class nano_state : public tmc1800_base_state -{ -public: - nano_state(const machine_config &mconfig, device_type type, const char *tag) - : tmc1800_base_state(mconfig, type, tag), - m_cti(*this, CDP1864_TAG), - m_ny0(*this, "NY0"), - m_ny1(*this, "NY1"), - m_monitor(*this, "MONITOR") - { } - - required_device m_cti; - required_ioport m_ny0; - required_ioport m_ny1; - required_ioport m_monitor; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void machine_start(); - virtual void machine_reset(); - - enum - { - TIMER_ID_EF4 - }; - - DECLARE_WRITE8_MEMBER( keylatch_w ); - DECLARE_WRITE8_MEMBER( bankswitch_w ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_INPUT_CHANGED_MEMBER( run_pressed ); - DECLARE_INPUT_CHANGED_MEMBER( monitor_pressed ); - - /* keyboard state */ - int m_keylatch; /* key latch */ -}; - -/* ---------- defined in video/tmc1800.c ---------- */ - -MACHINE_CONFIG_EXTERN( tmc1800_video ); -MACHINE_CONFIG_EXTERN( osc1000b_video ); -MACHINE_CONFIG_EXTERN( tmc2000_video ); -MACHINE_CONFIG_EXTERN( nano_video ); - -#endif diff --git a/src/mess/includes/tmc2000e.h b/src/mess/includes/tmc2000e.h deleted file mode 100644 index e54fffa67ab..00000000000 --- a/src/mess/includes/tmc2000e.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __TMC2000E__ -#define __TMC2000E__ - - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "machine/rescap.h" -#include "sound/cdp1864.h" - -#define SCREEN_TAG "screen" -#define CDP1802_TAG "cdp1802" -#define CDP1864_TAG "cdp1864" - -#define TMC2000E_COLORRAM_SIZE 0x100 // ??? - -class tmc2000e_state : public driver_device -{ -public: - tmc2000e_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_cti(*this, CDP1864_TAG), - m_cassette(*this, "cassette"), - m_colorram(*this, "colorram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_run(*this, "RUN") - { } - - required_device m_maincpu; - required_device m_cti; - required_device m_cassette; - required_shared_ptr m_colorram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_run; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( vismac_r ); - DECLARE_WRITE8_MEMBER( vismac_w ); - DECLARE_READ8_MEMBER( floppy_r ); - DECLARE_WRITE8_MEMBER( floppy_w ); - DECLARE_READ8_MEMBER( ascii_keyboard_r ); - DECLARE_READ8_MEMBER( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - DECLARE_WRITE8_MEMBER( io_select_w ); - DECLARE_WRITE8_MEMBER( keyboard_latch_w ); - DECLARE_READ_LINE_MEMBER( rdata_r ); - DECLARE_READ_LINE_MEMBER( bdata_r ); - DECLARE_READ_LINE_MEMBER( gdata_r ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_WRITE8_MEMBER( dma_w ); - - /* video state */ - int m_cdp1864_efx; /* EFx */ - UINT8 m_color; - - /* keyboard state */ - ioport_port* m_key_row[8]; - int m_keylatch; /* key latch */ - int m_reset; /* reset activated */ -}; - -#endif diff --git a/src/mess/includes/tmc600.h b/src/mess/includes/tmc600.h deleted file mode 100644 index 67855119897..00000000000 --- a/src/mess/includes/tmc600.h +++ /dev/null @@ -1,101 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __TMC600__ -#define __TMC600__ - - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "bus/centronics/ctronics.h" -#include "machine/ram.h" -#include "sound/cdp1869.h" - -#define SCREEN_TAG "screen" -#define CDP1802_TAG "cdp1802" -#define CDP1869_TAG "cdp1869" -#define CENTRONICS_TAG "centronics" - -#define TMC600_PAGE_RAM_SIZE 0x400 -#define TMC600_PAGE_RAM_MASK 0x3ff - -class tmc600_state : public driver_device -{ -public: - tmc600_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_vis(*this, CDP1869_TAG), - m_cassette(*this, "cassette"), - m_centronics(*this, "centronics"), - m_ram(*this, RAM_TAG), - m_char_rom(*this, "chargen"), - m_page_ram(*this, "page_ram"), - m_color_ram(*this, "color_ram"), - m_run(*this, "RUN"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7") - { } - - required_device m_maincpu; - required_device m_vis; - required_device m_cassette; - required_device m_centronics; - required_device m_ram; - required_region_ptr m_char_rom; - required_shared_ptr m_page_ram; - optional_shared_ptr m_color_ram; - required_ioport m_run; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - - virtual void machine_start(); - - virtual void video_start(); - - DECLARE_WRITE8_MEMBER( keyboard_latch_w ); - DECLARE_WRITE8_MEMBER( vismac_register_w ); - DECLARE_WRITE8_MEMBER( vismac_data_w ); - DECLARE_WRITE8_MEMBER( page_ram_w ); - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - - UINT8 get_color(UINT16 pma); - - // video state - int m_vismac_reg_latch; // video register latch - int m_vismac_color_latch; // color latch - int m_vismac_bkg_latch; // background color latch - int m_blink; // cursor blink - - // keyboard state - ioport_port* m_key_row[8]; - int m_keylatch; // key latch - - TIMER_DEVICE_CALLBACK_MEMBER(blink_tick); - CDP1869_CHAR_RAM_READ_MEMBER(tmc600_char_ram_r); - CDP1869_PCB_READ_MEMBER(tmc600_pcb_r); -}; - -// ---------- defined in video/tmc600.c ---------- - -MACHINE_CONFIG_EXTERN( tmc600_video ); - -#endif diff --git a/src/mess/includes/trs80.h b/src/mess/includes/trs80.h deleted file mode 100644 index e4ced5999ab..00000000000 --- a/src/mess/includes/trs80.h +++ /dev/null @@ -1,206 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert and unknown others -/***************************************************************************** - * - * includes/trs80.h - * - ****************************************************************************/ - -#ifndef TRS80_H_ -#define TRS80_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "machine/ay31015.h" -#include "machine/buffer.h" -#include "bus/centronics/ctronics.h" -#include "machine/wd_fdc.h" -#include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" -#include "imagedev/snapquik.h" -#include "formats/trs_cas.h" - - -class trs80_state : public driver_device -{ -public: - trs80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_centronics(*this, "centronics"), - m_cent_data_out(*this, "cent_data_out"), - m_cent_status_in(*this, "cent_status_in"), - m_ay31015(*this, "tr1602"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_floppy2(*this, "fdc:2"), - m_floppy3(*this, "fdc:3"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_p_videoram(*this, "p_videoram"), - m_region_maincpu(*this, "maincpu"), - m_io_config(*this, "CONFIG"), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_line4(*this, "LINE4"), - m_io_line5(*this, "LINE5"), - m_io_line6(*this, "LINE6"), - m_io_line7(*this, "LINE7"), - m_bank1(NULL), - m_bank2(NULL), - m_bank3(NULL), - m_bank4(NULL), - m_bank5(NULL), - m_bank6(NULL), - m_bank7(NULL), - m_bank8(NULL), - m_bank9(NULL), - m_bank11(NULL), - m_bank12(NULL), - m_bank13(NULL), - m_bank14(NULL), - m_bank15(NULL), - m_bank16(NULL), - m_bank17(NULL), - m_bank18(NULL), - m_bank19(NULL) { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - required_device m_maincpu; - optional_device m_centronics; - optional_device m_cent_data_out; - optional_device m_cent_status_in; - optional_device m_ay31015; - optional_device m_fdc; - optional_device m_floppy0; - optional_device m_floppy1; - optional_device m_floppy2; - optional_device m_floppy3; - required_device m_speaker; - required_device m_cassette; - DECLARE_WRITE8_MEMBER ( trs80_ff_w ); - DECLARE_WRITE8_MEMBER ( lnw80_fe_w ); - DECLARE_WRITE8_MEMBER ( sys80_fe_w ); - DECLARE_WRITE8_MEMBER ( sys80_f8_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_ff_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_f4_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_ec_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_eb_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_ea_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_e9_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_e8_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_e4_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_e0_w ); - DECLARE_WRITE8_MEMBER ( trs80m4p_9c_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_90_w ); - DECLARE_WRITE8_MEMBER ( trs80m4_84_w ); - DECLARE_READ8_MEMBER ( lnw80_fe_r ); - DECLARE_READ8_MEMBER ( trs80_ff_r ); - DECLARE_READ8_MEMBER ( sys80_f9_r ); - DECLARE_READ8_MEMBER ( trs80m4_ff_r ); - DECLARE_READ8_MEMBER ( trs80m4_ec_r ); - DECLARE_READ8_MEMBER ( trs80m4_eb_r ); - DECLARE_READ8_MEMBER ( trs80m4_ea_r ); - DECLARE_READ8_MEMBER ( trs80m4_e8_r ); - DECLARE_READ8_MEMBER ( trs80m4_e4_r ); - DECLARE_READ8_MEMBER ( trs80m4_e0_r ); - DECLARE_READ8_MEMBER( trs80_irq_status_r ); - DECLARE_READ8_MEMBER( trs80_printer_r ); - DECLARE_WRITE8_MEMBER( trs80_printer_w ); - DECLARE_WRITE8_MEMBER( trs80_cassunit_w ); - DECLARE_WRITE8_MEMBER( trs80_motor_w ); - DECLARE_READ8_MEMBER( trs80_keyboard_r ); - DECLARE_WRITE8_MEMBER ( trs80m4_88_w ); - DECLARE_READ8_MEMBER( trs80_videoram_r ); - DECLARE_WRITE8_MEMBER( trs80_videoram_w ); - DECLARE_READ8_MEMBER( trs80_gfxram_r ); - DECLARE_WRITE8_MEMBER( trs80_gfxram_w ); - DECLARE_READ8_MEMBER (trs80_wd179x_r); - const UINT8 *m_p_chargen; - optional_shared_ptr m_p_videoram; - UINT8 *m_p_gfxram; - UINT8 m_model4; - UINT8 m_mode; - UINT8 m_irq; - UINT8 m_mask; - UINT8 m_nmi_mask; - UINT8 m_port_ec; - UINT8 m_tape_unit; - UINT8 m_reg_load; - UINT8 m_nmi_data; -#ifdef USE_TRACK - UINT8 m_track[4]; -#endif - UINT8 m_head; -#ifdef USE_SECTOR - UINT8 m_sector[4]; -#endif - UINT8 m_cassette_data; - emu_timer *m_cassette_data_timer; - double m_old_cassette_val; - UINT16 m_start_address; - UINT8 m_crtc_reg; - UINT8 m_size_store; - DECLARE_DRIVER_INIT(trs80m4); - DECLARE_DRIVER_INIT(trs80l2); - DECLARE_DRIVER_INIT(trs80m4p); - DECLARE_DRIVER_INIT(lnw80); - DECLARE_DRIVER_INIT(trs80); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_MACHINE_RESET(trs80m4); - DECLARE_MACHINE_RESET(lnw80); - DECLARE_PALETTE_INIT(lnw80); - UINT32 screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_trs80m4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_lnw80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_radionic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_meritum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(trs80_rtc_interrupt); - INTERRUPT_GEN_MEMBER(trs80_fdc_interrupt); - TIMER_CALLBACK_MEMBER(cassette_data_callback); - DECLARE_WRITE_LINE_MEMBER(trs80_fdc_intrq_w); - DECLARE_QUICKLOAD_LOAD_MEMBER( trs80_cmd ); - -protected: - required_memory_region m_region_maincpu; - required_ioport m_io_config; - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - required_ioport m_io_line3; - required_ioport m_io_line4; - required_ioport m_io_line5; - required_ioport m_io_line6; - required_ioport m_io_line7; - memory_bank *m_bank1; - memory_bank *m_bank2; - memory_bank *m_bank3; - memory_bank *m_bank4; - memory_bank *m_bank5; - memory_bank *m_bank6; - memory_bank *m_bank7; - memory_bank *m_bank8; - memory_bank *m_bank9; - memory_bank *m_bank11; - memory_bank *m_bank12; - memory_bank *m_bank13; - memory_bank *m_bank14; - memory_bank *m_bank15; - memory_bank *m_bank16; - memory_bank *m_bank17; - memory_bank *m_bank18; - memory_bank *m_bank19; - - void trs80_fdc_interrupt_internal(); -}; - -#endif /* TRS80_H_ */ diff --git a/src/mess/includes/trs80m2.h b/src/mess/includes/trs80m2.h deleted file mode 100644 index 94a85e36038..00000000000 --- a/src/mess/includes/trs80m2.h +++ /dev/null @@ -1,168 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __TRS80M2__ -#define __TRS80M2__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "cpu/mcs48/mcs48.h" -#include "cpu/m68000/m68000.h" -#include "bus/centronics/ctronics.h" -#include "machine/keyboard.h" -#include "machine/pic8259.h" -#include "machine/ram.h" -#include "machine/trs80m2kb.h" -#include "machine/wd_fdc.h" -#include "machine/z80ctc.h" -#include "machine/z80dma.h" -#include "machine/z80pio.h" -#include "machine/z80dart.h" -#include "video/mc6845.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "u12" -#define Z80CTC_TAG "u19" -#define Z80DMA_TAG "u20" -#define Z80PIO_TAG "u22" -#define Z80SIO_TAG "u18" -#define FD1791_TAG "u6" -#define MC6845_TAG "u11" -#define CENTRONICS_TAG "j2" -#define M68000_TAG "m16_u22" -#define AM9519A_TAG "m16_u11" - -class trs80m2_state : public driver_device -{ -public: - trs80m2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ctc(*this, Z80CTC_TAG), - m_dmac(*this, Z80DMA_TAG), - m_pio(*this, Z80PIO_TAG), - m_crtc(*this, MC6845_TAG), - m_palette(*this, "palette"), - m_fdc(*this, FD1791_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_floppy0(*this, FD1791_TAG":0"), - m_floppy1(*this, FD1791_TAG":1"), - m_floppy2(*this, FD1791_TAG":2"), - m_floppy3(*this, FD1791_TAG":3"), - m_floppy(NULL), - m_ram(*this, RAM_TAG), - m_kb(*this, TRS80M2_KEYBOARD_TAG), - m_rom(*this, Z80_TAG), - m_char_rom(*this, MC6845_TAG), - m_video_ram(*this, "video_ram") - { - } - - required_device m_maincpu; - required_device m_ctc; - required_device m_dmac; - required_device m_pio; - required_device m_crtc; - required_device m_palette; - required_device m_fdc; - required_device m_centronics; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - floppy_image_device *m_floppy; - required_device m_ram; - required_device m_kb; - required_memory_region m_rom; - required_memory_region m_char_rom; - optional_shared_ptr m_video_ram; - - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_WRITE8_MEMBER( drvslt_w ); - DECLARE_WRITE8_MEMBER( rom_enable_w ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_READ8_MEMBER( rtc_r ); - DECLARE_READ8_MEMBER( nmi_r ); - DECLARE_WRITE8_MEMBER( nmi_w ); - DECLARE_READ8_MEMBER( keyboard_busy_r ); - DECLARE_READ8_MEMBER( keyboard_data_r ); - DECLARE_WRITE8_MEMBER( keyboard_ctrl_w ); - DECLARE_WRITE8_MEMBER( keyboard_latch_w ); - DECLARE_READ8_MEMBER( fdc_r ); - DECLARE_WRITE8_MEMBER( fdc_w ); - DECLARE_WRITE_LINE_MEMBER( de_w ); - DECLARE_WRITE_LINE_MEMBER( vsync_w ); - DECLARE_READ8_MEMBER( pio_pa_r ); - DECLARE_WRITE8_MEMBER( pio_pa_w ); - DECLARE_WRITE_LINE_MEMBER( strobe_w ); - DECLARE_WRITE_LINE_MEMBER( kb_clock_w ); - DECLARE_WRITE8_MEMBER( kbd_w ); - - MC6845_UPDATE_ROW( crtc_update_row ); - - // memory state - int m_boot_rom; - int m_bank; - int m_msel; - - // keyboard state - UINT8 m_key_latch; - UINT8 m_key_data; - int m_key_bit; - int m_kbclk; - int m_kbdata; - int m_kbirq; - - // video state - int m_blnkvid; - int m_80_40_char_en; - int m_de; - int m_rtc_int; - int m_enable_rtc_int; - - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - - int m_centronics_busy; - int m_centronics_fault; - int m_centronics_perror; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); -}; - -class trs80m16_state : public trs80m2_state -{ -public: - trs80m16_state(const machine_config &mconfig, device_type type, const char *tag) - : trs80m2_state(mconfig, type, tag), - m_subcpu(*this, M68000_TAG), - m_pic(*this, AM9519A_TAG) - { } - - required_device m_subcpu; - required_device m_pic; - - virtual void machine_start(); - - DECLARE_WRITE8_MEMBER( ual_w ); - DECLARE_WRITE8_MEMBER( tcl_w ); - - UINT16 m_ual; - UINT8 m_limit[2]; - UINT8 m_offset[2]; -}; - -#endif diff --git a/src/mess/includes/tsispch.h b/src/mess/includes/tsispch.h deleted file mode 100644 index 25c7b088da6..00000000000 --- a/src/mess/includes/tsispch.h +++ /dev/null @@ -1,58 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Jonathan Gevaryahu -/*************************************************************************** - - tsispch.h - -****************************************************************************/ - -#pragma once - -#ifndef _TSISPCH_H_ -#define _TSISPCH_H_ - -#include "machine/i8251.h" -#include "machine/pic8259.h" -#include "machine/terminal.h" - -#define TERMINAL_TAG "terminal" - -class tsispch_state : public driver_device -{ -public: - tsispch_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dsp(*this, "dsp"), - m_terminal(*this, TERMINAL_TAG), - m_uart(*this, "i8251a_u15"), - m_pic(*this, "pic8259") - { - } - - required_device m_maincpu; - required_device m_dsp; - required_device m_terminal; - required_device m_uart; - required_device m_pic; - - UINT8 m_paramReg; // status leds and resets and etc - - virtual void machine_reset(); - DECLARE_WRITE8_MEMBER(i8251_rxd); - DECLARE_READ8_MEMBER(dsw_r); - DECLARE_WRITE8_MEMBER(peripheral_w); - DECLARE_READ16_MEMBER(dsp_data_r); - DECLARE_WRITE16_MEMBER(dsp_data_w); - DECLARE_READ16_MEMBER(dsp_status_r); - DECLARE_WRITE16_MEMBER(dsp_status_w); - DECLARE_DRIVER_INIT(prose2k); - DECLARE_WRITE_LINE_MEMBER(i8251_rxrdy_int); - DECLARE_WRITE_LINE_MEMBER(i8251_txempty_int); - DECLARE_WRITE_LINE_MEMBER(i8251_txrdy_int); - DECLARE_WRITE_LINE_MEMBER(dsp_to_8086_p0_w); - DECLARE_WRITE_LINE_MEMBER(dsp_to_8086_p1_w); -}; - - -#endif // _TSISPCH_H_ diff --git a/src/mess/includes/tx0.h b/src/mess/includes/tx0.h deleted file mode 100644 index 98d111d72ec..00000000000 --- a/src/mess/includes/tx0.h +++ /dev/null @@ -1,329 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/***************************************************************************** - * - * includes/tx0.h - * - ****************************************************************************/ - -#ifndef TX0_H_ -#define TX0_H_ - -#include "video/crt.h" -#include "cpu/pdp1/tx0.h" - -enum state_t -{ - MTS_UNSELECTED, - MTS_SELECTING, - MTS_SELECTED, - MTS_UNSELECTING -}; - -enum backspace_state_t -{ - MTBSS_STATE0, - MTBSS_STATE1, - MTBSS_STATE2, - MTBSS_STATE3, - MTBSS_STATE4, - MTBSS_STATE5, - MTBSS_STATE6 -}; - -enum state_2_t -{ - MTRDS_STATE0, - MTRDS_STATE1, - MTRDS_STATE2, - MTRDS_STATE3, - MTRDS_STATE4, - MTRDS_STATE5, - MTRDS_STATE6 -}; - -enum state_3_t -{ - MTWTS_STATE0, - MTWTS_STATE1, - MTWTS_STATE2, - MTWTS_STATE3 -}; - -enum irg_pos_t -{ - MTIRGP_START, - MTIRGP_ENDMINUS1, - MTIRGP_END -}; - - - -/* tape reader registers */ -struct tx0_tape_reader_t -{ - device_image_interface *fd; /* file descriptor of tape image */ - - int motor_on; /* 1-bit reader motor on */ - - int rcl; /* 1-bit reader clutch */ - int rc; /* 2-bit reader counter */ - - emu_timer *timer; /* timer to simulate reader timing */ -}; - - - -/* tape puncher registers */ -struct tape_puncher_t -{ - device_image_interface *fd; /* file descriptor of tape image */ - - emu_timer *timer; /* timer to generate completion pulses */ -}; - - - -/* typewriter registers */ -struct tx0_typewriter_t -{ - device_image_interface *fd; /* file descriptor of output image */ - - emu_timer *prt_timer;/* timer to generate completion pulses */ -}; - - -/* magnetic tape unit registers */ -struct magtape_t -{ - device_image_interface *img; /* image descriptor */ - - state_t state; - - int command; - int binary_flag; - - union - { - backspace_state_t backspace_state; - struct - { - state_2_t state; - int space_flag; - } read; - struct - { - state_3_t state; - int counter; - } write; - } u; - - int sel_pending; - int cpy_pending; - - irg_pos_t irg_pos; /* position relative to inter-record gap */ - - int long_parity; - - emu_timer *timer; /* timer to simulate reader timing */ -}; - - -class tx0_state : public driver_device -{ -public: - tx0_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_crt(*this, "crt"), - m_csw(*this, "CSW"), - m_twr(*this, "TWR") - { } - - tx0_tape_reader_t m_tape_reader; - tape_puncher_t m_tape_puncher; - tx0_typewriter_t m_typewriter; - emu_timer *m_dis_timer; - magtape_t m_magtape; - int m_old_typewriter_keys[4]; - int m_old_control_keys; - int m_old_tsr_keys; - int m_tsr_index; - int m_typewriter_color; - bitmap_ind16 m_panel_bitmap; - bitmap_ind16 m_typewriter_bitmap; - int m_pos; - int m_case_shift; - DECLARE_DRIVER_INIT(tx0); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(tx0); - UINT32 screen_update_tx0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void screen_eof_tx0(screen_device &screen, bool state); - INTERRUPT_GEN_MEMBER(tx0_interrupt); - TIMER_CALLBACK_MEMBER(reader_callback); - TIMER_CALLBACK_MEMBER(puncher_callback); - TIMER_CALLBACK_MEMBER(prt_callback); - TIMER_CALLBACK_MEMBER(dis_callback); - void tx0_machine_stop(); - required_device m_maincpu; - inline void tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - void tx0_plot(int x, int y); - void tx0_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); - void tx0_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); - void tx0_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state); - void tx0_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); - void tx0_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color); - void tx0_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color); - void tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color); - void tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color); - void tx0_draw_panel_backdrop(bitmap_ind16 &bitmap); - void tx0_draw_panel(bitmap_ind16 &bitmap); - void tx0_typewriter_linefeed(); - void tx0_typewriter_drawchar(int character); - int tape_read(UINT8 *reply); - void tape_write(UINT8 data); - void begin_tape_read(int binary); - void typewriter_out(UINT8 data); - void schedule_select(); - void schedule_unselect(); - void tx0_keyboard(); - DECLARE_WRITE_LINE_MEMBER(tx0_io_cpy); - DECLARE_WRITE_LINE_MEMBER(tx0_io_r1l); - DECLARE_WRITE_LINE_MEMBER(tx0_io_r3l); - DECLARE_WRITE_LINE_MEMBER(tx0_io_p6h); - DECLARE_WRITE_LINE_MEMBER(tx0_io_p7h); - DECLARE_WRITE_LINE_MEMBER(tx0_io_prt); - DECLARE_WRITE_LINE_MEMBER(tx0_io_dis); - DECLARE_WRITE_LINE_MEMBER(tx0_sel); - DECLARE_WRITE_LINE_MEMBER(tx0_io_reset_callback); - void magtape_callback(); - -private: - required_device m_gfxdecode; - required_device m_palette; - required_device m_crt; - required_ioport m_csw; - required_ioport_array<4> m_twr; -}; - -/* defines for each bit and mask in input port "CSW" */ -enum -{ - /* bit numbers */ - tx0_control_bit = 0, - - tx0_stop_c0_bit = 1, - tx0_stop_c1_bit = 2, - tx0_gbl_cm_sel_bit = 3, - tx0_stop_bit = 4, - tx0_restart_bit = 5, - tx0_read_in_bit = 6, - - tx0_toggle_dn_bit = 12, - tx0_toggle_up_bit = 13, - tx0_cm_sel_bit = 14, - tx0_lr_sel_bit = 15, - - /* masks */ - tx0_control = (1 << tx0_control_bit), - - tx0_stop_cyc0 = (1 << tx0_stop_c0_bit), - tx0_stop_cyc1 = (1 << tx0_stop_c1_bit), - tx0_gbl_cm_sel = (1 << tx0_gbl_cm_sel_bit), - tx0_stop = (1 << tx0_stop_bit), - tx0_restart = (1 << tx0_restart_bit), - tx0_read_in = (1 << tx0_read_in_bit), - - tx0_toggle_dn = (1 << tx0_toggle_dn_bit), - tx0_toggle_up = (1 << tx0_toggle_up_bit), - tx0_cm_sel = (1 << tx0_cm_sel_bit), - tx0_lr_sel = (1 << tx0_lr_sel_bit) -}; - -/* defines for our font */ -enum -{ - tx0_charnum = /*96*/128, /* ASCII set + xx special characters */ - /* for whatever reason, 96 breaks some characters */ - - tx0_fontdata_size = 8 * tx0_charnum -}; - -enum -{ - /* size and position of crt window */ - crt_window_width = /*511*/512, - crt_window_height = /*511*/512, - crt_window_offset_x = 0, - crt_window_offset_y = 0, - /* size and position of operator control panel window */ - panel_window_width = 272, - panel_window_height = 264, - panel_window_offset_x = crt_window_width, - panel_window_offset_y = 0, - /* size and position of typewriter window */ - typewriter_window_width = 640, - typewriter_window_height = 160, - typewriter_window_offset_x = 0, - typewriter_window_offset_y = crt_window_height -}; - -enum -{ - total_width = crt_window_width + panel_window_width, - total_height = crt_window_height + typewriter_window_height, - - /* respect 4:3 aspect ratio to keep pixels square */ - virtual_width_1 = ((total_width+3)/4)*4, - virtual_height_1 = ((total_height+2)/3)*3, - virtual_width_2 = virtual_height_1*4/3, - virtual_height_2 = virtual_width_1*3/4, - virtual_width = (virtual_width_1 > virtual_width_2) ? virtual_width_1 : virtual_width_2, - virtual_height = (virtual_height_1 > virtual_height_2) ? virtual_height_1 : virtual_height_2 -}; - -enum -{ /* refresh rate in Hz: can be changed at will */ - refresh_rate = 60 -}; - -/* Color codes */ -enum -{ - /* first pen_crt_num_levels colors used for CRT (with remanence) */ - pen_crt_num_levels = 69, - pen_crt_max_intensity = pen_crt_num_levels-1, - - /* next colors used for control panel and typewriter */ - pen_black = pen_crt_num_levels, - pen_white, - pen_green, - pen_dk_green, - pen_red, - pen_lt_gray, - - /* color constants for control panel */ - pen_panel_bg = pen_black, - pen_panel_caption = pen_white, - color_panel_caption = 0, - pen_switch_nut = pen_lt_gray, - pen_switch_button = pen_white, - pen_lit_lamp = pen_green, - pen_unlit_lamp = pen_dk_green, - - /* color constants for typewriter */ - pen_typewriter_bg = pen_white, - color_typewriter_black = 1, /* palette 1 = black on white */ - color_typewriter_red = 2, /* palette 2 = red on white */ - - /* color constants used for light pen */ - pen_lightpen_nonpressed = pen_red, - pen_lightpen_pressed = pen_green -}; - - -#endif /* TX0_H_ */ diff --git a/src/mess/includes/ut88.h b/src/mess/includes/ut88.h deleted file mode 100644 index 757d1f7a98c..00000000000 --- a/src/mess/includes/ut88.h +++ /dev/null @@ -1,100 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/ut88.h - * - ****************************************************************************/ - -#ifndef UT88_H_ -#define UT88_H_ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/dac.h" -#include "sound/wave.h" -#include "machine/i8255.h" -#include "imagedev/cassette.h" - - -class ut88_state : public driver_device -{ -public: - enum - { - TIMER_RESET, - TIMER_UPDATE_DISPLAY - }; - - ut88_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_cassette(*this, "cassette"), - m_ppi(*this, "ppi8255"), - m_dac(*this, "dac"), - m_p_videoram(*this, "p_videoram"), - m_region_maincpu(*this, "maincpu"), - m_region_proms(*this, "proms"), - m_bank1(*this, "bank1"), - m_io_line0(*this, "LINE0"), - m_io_line1(*this, "LINE1"), - m_io_line2(*this, "LINE2"), - m_io_line3(*this, "LINE3"), - m_io_line4(*this, "LINE4"), - m_io_line5(*this, "LINE5"), - m_io_line6(*this, "LINE6"), - m_io_line7(*this, "LINE7"), - m_io_line8(*this, "LINE8") , - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - required_device m_cassette; - optional_device m_ppi; - optional_device m_dac; - DECLARE_READ8_MEMBER(ut88_keyboard_r); - DECLARE_WRITE8_MEMBER(ut88_keyboard_w); - DECLARE_WRITE8_MEMBER(ut88_sound_w); - DECLARE_READ8_MEMBER(ut88_tape_r); - DECLARE_READ8_MEMBER(ut88mini_keyboard_r); - DECLARE_WRITE8_MEMBER(ut88mini_write_led); - DECLARE_READ8_MEMBER(ut88_8255_portb_r); - DECLARE_READ8_MEMBER(ut88_8255_portc_r); - DECLARE_WRITE8_MEMBER(ut88_8255_porta_w); - optional_shared_ptr m_p_videoram; - int m_keyboard_mask; - int m_lcd_digit[6]; - DECLARE_DRIVER_INIT(ut88); - DECLARE_DRIVER_INIT(ut88mini); - DECLARE_MACHINE_RESET(ut88); - DECLARE_VIDEO_START(ut88); - DECLARE_MACHINE_START(ut88mini); - DECLARE_MACHINE_RESET(ut88mini); - UINT32 screen_update_ut88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(ut88_reset); - TIMER_CALLBACK_MEMBER(update_display); - -protected: - required_memory_region m_region_maincpu; - optional_memory_region m_region_proms; - optional_memory_bank m_bank1; - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - optional_ioport m_io_line3; - optional_ioport m_io_line4; - optional_ioport m_io_line5; - optional_ioport m_io_line6; - optional_ioport m_io_line7; - optional_ioport m_io_line8; - required_device m_maincpu; - optional_device m_gfxdecode; - optional_device m_palette; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -/*----------- defined in video/ut88.c -----------*/ - -extern const gfx_layout ut88_charlayout; - - -#endif /* UT88_H_ */ diff --git a/src/mess/includes/v1050.h b/src/mess/includes/v1050.h deleted file mode 100644 index 429f032c38a..00000000000 --- a/src/mess/includes/v1050.h +++ /dev/null @@ -1,235 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __V1050__ -#define __V1050__ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/m6502/m6502.h" -#include "bus/centronics/ctronics.h" -#include "bus/scsi/s1410.h" -#include "machine/clock.h" -#include "machine/i8214.h" -#include "machine/i8251.h" -#include "machine/i8255.h" -#include "machine/msm58321.h" -#include "machine/ram.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsihd.h" -#include "machine/v1050kb.h" -#include "machine/wd_fdc.h" -#include "video/mc6845.h" - -#define SCREEN_TAG "screen" - -#define Z80_TAG "u80" -#define UPB8214_TAG "u38" -#define I8255A_DISP_TAG "u79" -#define I8255A_MISC_TAG "u10" -#define I8255A_RTC_TAG "u36" -#define I8251A_KB_TAG "u85" -#define I8251A_SIO_TAG "u8" -#define MSM58321RS_TAG "u26" -#define MB8877_TAG "u13" -#define FDC9216_TAG "u25" -#define M6502_TAG "u76" -#define I8255A_M6502_TAG "u101" -#define H46505_TAG "u75" -#define CENTRONICS_TAG "centronics" -#define CLOCK_KB_TAG "keyboard_clock" -#define CLOCK_SIO_TAG "sio_clock" -#define TIMER_ACK_TAG "timer_ack" -#define TIMER_RST_TAG "timer_rst" -#define SASIBUS_TAG "sasi" -#define RS232_TAG "rs232" -#define V1050_KEYBOARD_TAG "v1050kb" - -#define V1050_VIDEORAM_SIZE 0x8000 -#define V1050_VIDEORAM_MASK 0x7fff - -#define INT_RS_232 0x01 -#define INT_WINCHESTER 0x02 -#define INT_KEYBOARD 0x04 -#define INT_FLOPPY 0x08 -#define INT_VSYNC 0x10 -#define INT_DISPLAY 0x20 -#define INT_EXPANSION_B 0x40 -#define INT_EXPANSION_A 0x80 - -class v1050_state : public driver_device -{ -public: - v1050_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_subcpu(*this, M6502_TAG), - m_pic(*this, UPB8214_TAG), - m_ppi_disp(*this, I8255A_DISP_TAG), - m_ppi_6502(*this, I8255A_M6502_TAG), - m_rtc(*this, MSM58321RS_TAG), - m_uart_kb(*this, I8251A_KB_TAG), - m_uart_sio(*this, I8251A_SIO_TAG), - m_fdc(*this, MB8877_TAG), - m_crtc(*this, H46505_TAG), - m_palette(*this, "palette"), - m_centronics(*this, CENTRONICS_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, MB8877_TAG":0"), - m_floppy1(*this, MB8877_TAG":1"), - m_floppy2(*this, MB8877_TAG":2"), - m_floppy3(*this, MB8877_TAG":3"), - m_clock_sio(*this, CLOCK_SIO_TAG), - m_timer_ack(*this, TIMER_ACK_TAG), - m_timer_rst(*this, TIMER_RST_TAG), - m_sasibus(*this, SASIBUS_TAG), - m_sasi_data_out(*this, "scsi_data_out"), - m_sasi_data_in(*this, "scsi_data_in"), - m_sasi_ctrl_in(*this, "scsi_ctrl_in"), - m_rom(*this, Z80_TAG), - m_video_ram(*this, "video_ram"), - m_attr_ram(*this, "attr_ram"), - m_rtc_ppi_pa(0), - m_rtc_ppi_pc(0) - { - } - - DECLARE_READ8_MEMBER( kb_data_r ); - DECLARE_READ8_MEMBER( kb_status_r ); - DECLARE_WRITE8_MEMBER( v1050_i8214_w ); - DECLARE_READ8_MEMBER( vint_clr_r ); - DECLARE_WRITE8_MEMBER( vint_clr_w ); - DECLARE_READ8_MEMBER( dint_clr_r ); - DECLARE_WRITE8_MEMBER( dint_clr_w ); - DECLARE_WRITE8_MEMBER( bank_w ); - DECLARE_WRITE8_MEMBER( dint_w ); - DECLARE_WRITE8_MEMBER( dvint_clr_w ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_WRITE8_MEMBER( keyboard_w ); - DECLARE_WRITE8_MEMBER( p2_w ); - DECLARE_WRITE8_MEMBER( misc_ppi_pa_w ); - DECLARE_WRITE8_MEMBER( misc_ppi_pc_w ); - DECLARE_READ8_MEMBER( rtc_ppi_pa_r ); - DECLARE_WRITE8_MEMBER( rtc_ppi_pa_w ); - DECLARE_WRITE8_MEMBER( rtc_ppi_pb_w ); - DECLARE_READ8_MEMBER( rtc_ppi_pc_r ); - DECLARE_WRITE8_MEMBER( rtc_ppi_pc_w ); - DECLARE_WRITE_LINE_MEMBER( kb_rxrdy_w ); - DECLARE_WRITE_LINE_MEMBER( sio_rxrdy_w ); - DECLARE_WRITE_LINE_MEMBER( sio_txrdy_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - DECLARE_READ8_MEMBER( attr_r ); - DECLARE_WRITE8_MEMBER( attr_w ); - DECLARE_READ8_MEMBER( videoram_r ); - DECLARE_WRITE8_MEMBER( videoram_w ); - DECLARE_WRITE_LINE_MEMBER( crtc_vs_w ); - DECLARE_WRITE8_MEMBER(sasi_data_w); - DECLARE_WRITE_LINE_MEMBER(write_sasi_io); - DECLARE_READ8_MEMBER( sasi_status_r ); - DECLARE_WRITE8_MEMBER( sasi_ctrl_w ); - - WRITE_LINE_MEMBER( rtc_ppi_pa_0_w ){ m_rtc_ppi_pa = (m_rtc_ppi_pa & ~(1 << 0)) | ((state & 1) << 0); } - WRITE_LINE_MEMBER( rtc_ppi_pa_1_w ){ m_rtc_ppi_pa = (m_rtc_ppi_pa & ~(1 << 1)) | ((state & 1) << 1); } - WRITE_LINE_MEMBER( rtc_ppi_pa_2_w ){ m_rtc_ppi_pa = (m_rtc_ppi_pa & ~(1 << 2)) | ((state & 1) << 2); } - WRITE_LINE_MEMBER( rtc_ppi_pa_3_w ){ m_rtc_ppi_pa = (m_rtc_ppi_pa & ~(1 << 3)) | ((state & 1) << 3); } - WRITE_LINE_MEMBER( rtc_ppi_pc_3_w ){ m_rtc_ppi_pc = (m_rtc_ppi_pc & ~(1 << 3)) | ((state & 1) << 3); } - - TIMER_DEVICE_CALLBACK_MEMBER(v1050_keyboard_tick); - TIMER_DEVICE_CALLBACK_MEMBER(sasi_ack_tick); - TIMER_DEVICE_CALLBACK_MEMBER(sasi_rst_tick); - DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock); - DECLARE_WRITE_LINE_MEMBER(write_sio_clock); - DECLARE_WRITE_LINE_MEMBER(pic_int_w); - DECLARE_WRITE8_MEMBER(disp_ppi_pc_w); - DECLARE_WRITE8_MEMBER(m6502_ppi_pc_w); - DECLARE_READ8_MEMBER(misc_ppi_pc_r); - IRQ_CALLBACK_MEMBER(v1050_int_ack); - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); - - MC6845_UPDATE_ROW(crtc_update_row); - -protected: - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - -private: - void bankswitch(); - void update_fdc(); - void set_interrupt(UINT8 mask, int state); - void scan_keyboard(); - void set_baud_sel(int sel); - -public: // HACK for MC6845 - required_device m_maincpu; - required_device m_subcpu; - required_device m_pic; - required_device m_ppi_disp; - required_device m_ppi_6502; - required_device m_rtc; - required_device m_uart_kb; - required_device m_uart_sio; - required_device m_fdc; - required_device m_crtc; - required_device m_palette; - required_device m_centronics; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_device m_clock_sio; - required_device m_timer_ack; - required_device m_timer_rst; - required_device m_sasibus; - required_device m_sasi_data_out; - required_device m_sasi_data_in; - required_device m_sasi_ctrl_in; - required_memory_region m_rom; - required_shared_ptr m_video_ram; - optional_shared_ptr m_attr_ram; - - // interrupt state - UINT8 m_int_mask; // interrupt mask - UINT8 m_int_state; // interrupt status - int m_f_int_enb; // floppy interrupt enable - bool m_fdc_irq; - bool m_fdc_drq; - - // keyboard state - UINT8 m_keylatch; // keyboard row select - UINT8 m_keydata; - int m_keyavail; - - // serial state - int m_rxrdy; // receiver ready - int m_txrdy; // transmitter ready - int m_baud_sel; // baud select - - // memory state - UINT8 m_bank; // bank register - - // video state - UINT8 m_attr; // attribute latch - - // sasi state - UINT8 m_sasi_data; - int m_sasi_data_enable; - - UINT8 m_rtc_ppi_pa; - UINT8 m_rtc_ppi_pc; - - int m_centronics_busy; - int m_centronics_perror; -}; - -//----------- defined in video/v1050.c ----------- - -MACHINE_CONFIG_EXTERN( v1050_video ); - -#endif diff --git a/src/mess/includes/vc4000.h b/src/mess/includes/vc4000.h deleted file mode 100644 index f0d0c95cab8..00000000000 --- a/src/mess/includes/vc4000.h +++ /dev/null @@ -1,157 +0,0 @@ -// license:??? -// copyright-holders:Peter Trauner, Manfred Schneider, Robbbert -/***************************************************************************** - * - * includes/vc4000.h - * - ****************************************************************************/ - -#ifndef VC4000_H_ -#define VC4000_H_ - -#include "emu.h" -#include "audio/vc4000snd.h" -#include "cpu/s2650/s2650.h" -#include "imagedev/snapquik.h" -#include "imagedev/cassette.h" -#include "sound/wave.h" - -#include "bus/vc4000/slot.h" -#include "bus/vc4000/rom.h" - -// define this to use digital inputs instead of the slow -// autocentering analog mame joys -#define ANALOG_HACK - - -struct SPRITE_HELPER -{ - UINT8 bitmap[10],x1,x2,y1,y2, res1, res2; -}; - -struct SPRITE -{ - const SPRITE_HELPER *data; - int mask; - int state; - int delay; - int size; - int y; - UINT8 scolor; - int finished; - int finished_now; -}; - -struct vc4000_video_t -{ - SPRITE sprites[4]; - int line; - UINT8 sprite_collision; - UINT8 background_collision; - union - { - UINT8 data[0x100]; - struct - { - SPRITE_HELPER sprites[3]; - UINT8 res[0x10]; - SPRITE_HELPER sprite4; - UINT8 res2[0x30]; - UINT8 grid[20][2]; - UINT8 grid_control[5]; - UINT8 res3[0x13]; - UINT8 sprite_sizes; - UINT8 sprite_colors[2]; - UINT8 score_control; - UINT8 res4[2]; - UINT8 background; - UINT8 sound; - UINT8 bcd[2]; - UINT8 background_collision; - UINT8 sprite_collision; - } d; - } reg; -} ; - -class vc4000_state : public driver_device -{ -public: - vc4000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_screen(*this, "screen"), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_custom(*this, "custom"), - m_keypad1_1(*this, "KEYPAD1_1"), - m_keypad1_2(*this, "KEYPAD1_2"), - m_keypad1_3(*this, "KEYPAD1_3"), - m_panel(*this, "PANEL"), - m_keypad2_1(*this, "KEYPAD2_1"), - m_keypad2_2(*this, "KEYPAD2_2"), - m_keypad2_3(*this, "KEYPAD2_3"), -#ifndef ANALOG_HACK - m_io_joy1_x(*this, "JOY1_X"), - m_io_joy1_y(*this, "JOY1_Y"), - m_io_joy2_x(*this, "JOY2_X"), - m_io_joy2_y(*this, "JOY2_Y") -#else - m_joys(*this, "JOYS"), - m_config(*this, "CONFIG") -#endif - { } - - DECLARE_WRITE8_MEMBER(vc4000_sound_ctl); - DECLARE_READ8_MEMBER(vc4000_key_r); - DECLARE_READ8_MEMBER(vc4000_video_r); - DECLARE_WRITE8_MEMBER(vc4000_video_w); - DECLARE_READ8_MEMBER(vc4000_vsync_r); - DECLARE_READ8_MEMBER(elektor_cass_r); - DECLARE_WRITE8_MEMBER(elektor_cass_w); - vc4000_video_t m_video; - UINT8 m_sprite_collision[0x20]; - UINT8 m_background_collision[0x20]; - UINT8 m_joy1_x; - UINT8 m_joy1_y; - UINT8 m_joy2_x; - UINT8 m_joy2_y; - UINT8 m_objects[512]; - UINT8 m_irq_pause; - bitmap_ind16 *m_bitmap; - virtual void machine_start(); - virtual void video_start(); - DECLARE_PALETTE_INIT(vc4000); - UINT32 screen_update_vc4000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vc4000_video_line); - DECLARE_QUICKLOAD_LOAD_MEMBER(vc4000); - -protected: - required_device m_maincpu; - required_device m_screen; - optional_device m_cassette; - required_device m_cart; - required_device m_custom; - required_ioport m_keypad1_1; - required_ioport m_keypad1_2; - required_ioport m_keypad1_3; - required_ioport m_panel; - required_ioport m_keypad2_1; - required_ioport m_keypad2_2; - required_ioport m_keypad2_3; -#ifndef ANALOG_HACK - required_ioport m_io_joy1_x; - required_ioport m_io_joy1_y; - required_ioport m_io_joy2_x; - required_ioport m_io_joy2_y; -#else - required_ioport m_joys; - required_ioport m_config; -#endif - inline UINT8 vc4000_joystick_return_to_centre(UINT8 joy); - void vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line); - inline void vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale); - void vc4000_sprite_update(bitmap_ind16 &bitmap, UINT8 *collision, SPRITE *This); - inline void vc4000_draw_grid(UINT8 *collision); -}; - -#endif /* VC4000_H_ */ diff --git a/src/mess/includes/vcs80.h b/src/mess/includes/vcs80.h deleted file mode 100644 index 7030bbc008d..00000000000 --- a/src/mess/includes/vcs80.h +++ /dev/null @@ -1,52 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -#pragma once - -#ifndef __VCS80__ -#define __VCS80__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80pio.h" -#include "machine/ram.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "z80" -#define Z80PIO_TAG "z80pio" - -class vcs80_state : public driver_device -{ -public: - vcs80_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_pio(*this, Z80PIO_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2") - { } - - required_device m_maincpu; - required_device m_pio; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - - virtual void machine_start(); - - DECLARE_READ8_MEMBER( pio_r ); - DECLARE_WRITE8_MEMBER( pio_w ); - DECLARE_READ8_MEMBER( pio_pa_r ); - DECLARE_WRITE8_MEMBER( pio_pb_w ); - - DECLARE_DIRECT_UPDATE_MEMBER(vcs80_direct_update_handler); - /* keyboard state */ - int m_keylatch; - int m_keyclk; - DECLARE_DRIVER_INIT(vcs80); - TIMER_DEVICE_CALLBACK_MEMBER(vcs80_keyboard_tick); -}; - -#endif diff --git a/src/mess/includes/vector06.h b/src/mess/includes/vector06.h deleted file mode 100644 index 959842aa3b6..00000000000 --- a/src/mess/includes/vector06.h +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/***************************************************************************** - * - * includes/vector06.h - * - ****************************************************************************/ - -#ifndef VECTOR06_H_ -#define VECTOR06_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/i8085/i8085.h" -#include "sound/wave.h" -#include "machine/i8255.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -class vector06_state : public driver_device -{ -public: - vector06_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_fdc(*this, "wd1793"), - m_floppy0(*this, "wd1793:0"), - m_floppy1(*this, "wd1793:1"), - m_ppi(*this, "ppi8255"), - m_ppi2(*this, "ppi8255_2"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_region_maincpu(*this, "maincpu"), - m_line(*this, "LINE"), - m_reset(*this, "RESET") - { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - DECLARE_READ8_MEMBER(vector06_8255_portb_r); - DECLARE_READ8_MEMBER(vector06_8255_portc_r); - DECLARE_WRITE8_MEMBER(vector06_8255_porta_w); - DECLARE_WRITE8_MEMBER(vector06_8255_portb_w); - DECLARE_WRITE8_MEMBER(vector06_color_set); - DECLARE_READ8_MEMBER(vector06_romdisk_portb_r); - DECLARE_WRITE8_MEMBER(vector06_romdisk_porta_w); - DECLARE_WRITE8_MEMBER(vector06_romdisk_portc_w); - DECLARE_READ8_MEMBER(vector06_8255_1_r); - DECLARE_WRITE8_MEMBER(vector06_8255_1_w); - DECLARE_READ8_MEMBER(vector06_8255_2_r); - DECLARE_WRITE8_MEMBER(vector06_8255_2_w); - DECLARE_WRITE8_MEMBER(vector06_disc_w); - void vector06_set_video_mode(int width); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(vector06); - UINT32 screen_update_vector06(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vector06_interrupt); - TIMER_CALLBACK_MEMBER(reset_check_callback); - IRQ_CALLBACK_MEMBER(vector06_irq_callback); - -private: - required_device m_maincpu; - required_device m_cassette; - required_device m_cart; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_ppi; - required_device m_ppi2; - required_device m_ram; - required_device m_palette; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; - required_memory_region m_region_maincpu; - required_ioport_array<9> m_line; - required_ioport m_reset; - - UINT8 m_keyboard_mask; - UINT8 m_color_index; - UINT8 m_video_mode; - UINT8 m_romdisk_msb; - UINT8 m_romdisk_lsb; - UINT8 m_vblank_state; - -}; - -#endif /* VECTOR06_H_ */ diff --git a/src/mess/includes/vic10.h b/src/mess/includes/vic10.h deleted file mode 100644 index 5068bca4454..00000000000 --- a/src/mess/includes/vic10.h +++ /dev/null @@ -1,118 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __VIC10__ -#define __VIC10__ - -#include "emu.h" -#include "bus/pet/cass.h" -#include "bus/vic10/exp.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m6510.h" -#include "machine/mos6526.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/mos6581.h" -#include "video/mos6566.h" - -#define M6510_TAG "u3" -#define MOS6566_TAG "u2" -#define MOS6581_TAG "u6" -#define MOS6526_TAG "u9" -#define SCREEN_TAG "screen" -#define TIMER_C1531_TAG "c1531" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" - -class vic10_state : public driver_device -{ -public: - vic10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6510_TAG), - m_vic(*this, MOS6566_TAG), - m_sid(*this, MOS6581_TAG), - m_cia(*this, MOS6526_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, VIC10_EXPANSION_SLOT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_restore(*this, "RESTORE"), - m_lock(*this, "LOCK"), - m_cia_irq(CLEAR_LINE), - m_vic_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE) - { } - - required_device m_maincpu; - required_device m_vic; - required_device m_sid; - required_device m_cia; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - required_device m_ram; - optional_device m_cassette; - optional_shared_ptr m_color_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_restore; - required_ioport m_lock; - - virtual void machine_start(); - virtual void machine_reset(); - - void check_interrupts(); - UINT8 paddle_read(address_space &space, int which); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_colorram_r ); - DECLARE_READ8_MEMBER( vic_lightpen_x_cb ); - DECLARE_READ8_MEMBER( vic_lightpen_y_cb ); - DECLARE_READ8_MEMBER( vic_lightpen_button_cb ); - DECLARE_READ8_MEMBER( vic_rdy_cb ); - - DECLARE_READ8_MEMBER( sid_potx_r ); - DECLARE_READ8_MEMBER( sid_poty_r ); - - DECLARE_WRITE_LINE_MEMBER( cia_irq_w ); - DECLARE_READ8_MEMBER( cia_pa_r ); - DECLARE_READ8_MEMBER( cia_pb_r ); - DECLARE_WRITE8_MEMBER( cia_pb_w ); - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); - DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - - // interrupt state - int m_cia_irq; - int m_vic_irq; - int m_exp_irq; -}; - - - -#endif diff --git a/src/mess/includes/vic20.h b/src/mess/includes/vic20.h deleted file mode 100644 index 1c900d91acd..00000000000 --- a/src/mess/includes/vic20.h +++ /dev/null @@ -1,162 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __VIC20__ -#define __VIC20__ - -#include "emu.h" -#include "bus/cbmiec/cbmiec.h" -#include "bus/pet/cass.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "bus/vic20/exp.h" -#include "bus/vic20/user.h" -#include "cpu/m6502/m6510.h" -#include "machine/6522via.h" -#include "machine/cbm_snqk.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/mos6560.h" - -#define M6502_TAG "ue10" -#define M6522_1_TAG "uab3" -#define M6522_2_TAG "uab1" -#define M6560_TAG "ub7" -#define M6561_TAG "ub7" -#define IEC_TAG "iec" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define PET_USER_PORT_TAG "user" - -class vic20_state : public driver_device -{ -public: - vic20_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6502_TAG), - m_via1(*this, M6522_1_TAG), - m_via2(*this, M6522_2_TAG), - m_vic(*this, M6560_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy(*this, CONTROL1_TAG), - m_exp(*this, VIC20_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_ram(*this, RAM_TAG), - m_basic(*this, "basic"), - m_kernal(*this, "kernal"), - m_charom(*this, "charom"), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_restore(*this, "RESTORE"), - m_lock(*this, "LOCK") - { } - - required_device m_maincpu; - required_device m_via1; - required_device m_via2; - required_device m_vic; - required_device m_iec; - required_device m_joy; - required_device m_exp; - required_device m_user; - required_device m_cassette; - required_device m_ram; - required_region_ptr m_basic; - required_region_ptr m_kernal; - required_region_ptr m_charom; - required_shared_ptr m_color_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_restore; - required_ioport m_lock; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_lightx_cb ); - DECLARE_READ8_MEMBER( vic_lighty_cb ); - DECLARE_READ8_MEMBER( vic_lightbut_cb ); - - DECLARE_WRITE_LINE_MEMBER( write_light_pen ); - DECLARE_WRITE_LINE_MEMBER( write_user_joy0 ); - DECLARE_WRITE_LINE_MEMBER( write_user_joy1 ); - DECLARE_WRITE_LINE_MEMBER( write_user_joy2 ); - DECLARE_WRITE_LINE_MEMBER( write_user_light_pen ); - DECLARE_WRITE_LINE_MEMBER( write_user_cassette_switch ); - - DECLARE_READ8_MEMBER( via1_pa_r ); - DECLARE_WRITE8_MEMBER( via1_pa_w ); - DECLARE_WRITE8_MEMBER( via1_pb_w ); - - DECLARE_READ8_MEMBER( via2_pa_r ); - DECLARE_READ8_MEMBER( via2_pb_r ); - DECLARE_WRITE8_MEMBER( via2_pb_w ); - DECLARE_WRITE_LINE_MEMBER( via2_ca2_w ); - DECLARE_WRITE_LINE_MEMBER( via2_cb2_w ); - - DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_vc20 ); - // keyboard state - int m_key_col; - int m_light_pen; - int m_user_joy0; - int m_user_joy1; - int m_user_joy2; - int m_user_light_pen; - int m_user_cassette_switch; - - enum - { - BLK0 = 0, - BLK1, - BLK2, - BLK3, - BLK4, - BLK5, - BLK6, - BLK7 - }; - - - enum - { - RAM0 = 0, - RAM1, - RAM2, - RAM3, - RAM4, - RAM5, - RAM6, - RAM7 - }; - - - enum - { - IO0 = 4, - COLOR = 5, - IO2 = 6, - IO3 = 7 - }; -}; - -#endif diff --git a/src/mess/includes/victor9k.h b/src/mess/includes/victor9k.h deleted file mode 100644 index 89c5c0b1c4b..00000000000 --- a/src/mess/includes/victor9k.h +++ /dev/null @@ -1,156 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Victor 9000 / ACT Sirius 1 emulation - -**********************************************************************/ - -#pragma once - -#ifndef __VICTOR9K__ -#define __VICTOR9K__ - -#include "bus/rs232/rs232.h" -#include "bus/centronics/ctronics.h" -#include "cpu/i86/i86.h" -#include "formats/victor9k_dsk.h" -#include "imagedev/floppy.h" -#include "machine/ram.h" -#include "bus/centronics/ctronics.h" -#include "machine/6522via.h" -#include "bus/ieee488/ieee488.h" -#include "machine/mc6852.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/z80dart.h" -#include "machine/victor9kb.h" -#include "machine/victor9k_fdc.h" -#include "sound/hc55516.h" -#include "video/mc6845.h" - -#define I8088_TAG "8l" -#define I8253_TAG "13h" -#define I8259A_TAG "7l" -#define UPD7201_TAG "16e" -#define HD46505S_TAG "11a" -#define MC6852_TAG "11b" -#define HC55516_TAG "15c" -#define M6522_1_TAG "m6522_1" -#define M6522_2_TAG "m6522_2" -#define M6522_3_TAG "14l" -#define DAC0808_0_TAG "5b" -#define DAC0808_1_TAG "5c" -#define CENTRONICS_TAG "centronics" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" -#define SCREEN_TAG "screen" -#define KB_TAG "kb" -#define FDC_TAG "fdc" - -class victor9k_state : public driver_device -{ -public: - victor9k_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, I8088_TAG), - m_ieee488(*this, IEEE488_TAG), - m_pic(*this, I8259A_TAG), - m_upd7201(*this, UPD7201_TAG), - m_ssda(*this, MC6852_TAG), - m_via1(*this, M6522_1_TAG), - m_via2(*this, M6522_2_TAG), - m_via3(*this, M6522_3_TAG), - m_cvsd(*this, HC55516_TAG), - m_crtc(*this, HD46505S_TAG), - m_ram(*this, RAM_TAG), - m_kb(*this, KB_TAG), - m_fdc(*this, FDC_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_rs232a(*this, RS232_A_TAG), - m_rs232b(*this, RS232_B_TAG), - m_palette(*this, "palette"), - m_rom(*this, I8088_TAG), - m_video_ram(*this, "video_ram"), - m_brt(0), - m_cont(0), - m_via1_irq(CLEAR_LINE), - m_via2_irq(CLEAR_LINE), - m_via3_irq(CLEAR_LINE), - m_fdc_irq(CLEAR_LINE), - m_ssda_irq(CLEAR_LINE), - m_kbrdy(1), - m_kbackctl(0) - { } - - required_device m_maincpu; - required_device m_ieee488; - required_device m_pic; - required_device m_upd7201; - required_device m_ssda; - required_device m_via1; - required_device m_via2; - required_device m_via3; - required_device m_cvsd; - required_device m_crtc; - required_device m_ram; - required_device m_kb; - required_device m_fdc; - required_device m_centronics; - required_device m_rs232a; - required_device m_rs232b; - required_device m_palette; - required_memory_region m_rom; - required_shared_ptr m_video_ram; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( via1_pa_w ); - DECLARE_WRITE_LINE_MEMBER( write_nfrd ); - DECLARE_WRITE_LINE_MEMBER( write_ndac ); - DECLARE_WRITE8_MEMBER( via1_pb_w ); - DECLARE_WRITE_LINE_MEMBER( via1_irq_w ); - DECLARE_WRITE_LINE_MEMBER( codec_vol_w ); - - DECLARE_WRITE8_MEMBER( via2_pa_w ); - DECLARE_WRITE8_MEMBER( via2_pb_w ); - DECLARE_WRITE_LINE_MEMBER( write_ria ); - DECLARE_WRITE_LINE_MEMBER( write_rib ); - DECLARE_WRITE_LINE_MEMBER( via2_irq_w ); - - DECLARE_WRITE8_MEMBER( via3_pb_w ); - DECLARE_WRITE_LINE_MEMBER( via3_irq_w ); - - DECLARE_WRITE_LINE_MEMBER( fdc_irq_w ); - - DECLARE_WRITE_LINE_MEMBER( ssda_irq_w ); - - DECLARE_WRITE_LINE_MEMBER( kbrdy_w ); - DECLARE_WRITE_LINE_MEMBER( kbdata_w ); - DECLARE_WRITE_LINE_MEMBER( vert_w ); - - MC6845_UPDATE_ROW( crtc_update_row ); - - DECLARE_WRITE_LINE_MEMBER( mux_serial_b_w ); - DECLARE_WRITE_LINE_MEMBER( mux_serial_a_w ); - - // video state - int m_brt; - int m_cont; - - // interrupts - int m_via1_irq; - int m_via2_irq; - int m_via3_irq; - int m_fdc_irq; - int m_ssda_irq; - - // keyboard - int m_kbrdy; - int m_kbackctl; - - void update_kback(); -}; - -#endif diff --git a/src/mess/includes/vidbrain.h b/src/mess/includes/vidbrain.h deleted file mode 100644 index 3bddb8542d7..00000000000 --- a/src/mess/includes/vidbrain.h +++ /dev/null @@ -1,126 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __VIDBRAIN__ -#define __VIDBRAIN__ - -#include "emu.h" -#include "bus/vidbrain/exp.h" -#include "cpu/f8/f8.h" -#include "machine/f3853.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/discrete.h" -#include "video/uv201.h" - -#define F3850_TAG "cd34" -#define F3853_TAG "cd5" -#define F3870_TAG "f3870" -#define UV201_TAG "uv201" -#define SCREEN_TAG "screen" -#define DISCRETE_TAG "discrete" -#define DAC_TAG "dac" - -class vidbrain_state : public driver_device -{ -public: - vidbrain_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, F3850_TAG), - m_smi(*this, F3853_TAG), - m_uv(*this, UV201_TAG), - m_discrete(*this, DISCRETE_TAG), - m_dac(*this, DAC_TAG), - m_exp(*this, VIDEOBRAIN_EXPANSION_SLOT_TAG), - m_io00(*this, "IO00"), - m_io01(*this, "IO01"), - m_io02(*this, "IO02"), - m_io03(*this, "IO03"), - m_io04(*this, "IO04"), - m_io05(*this, "IO05"), - m_io06(*this, "IO06"), - m_io07(*this, "IO07"), - m_uv201_31(*this, "UV201-31"), - m_joy_r(*this, "JOY-R"), - m_joy1_x(*this, "JOY1-X"), - m_joy1_y(*this, "JOY1-Y"), - m_joy2_x(*this, "JOY2-X"), - m_joy2_y(*this, "JOY2-Y"), - m_joy3_x(*this, "JOY3-X"), - m_joy3_y(*this, "JOY3-Y"), - m_joy4_x(*this, "JOY4-X"), - m_joy4_y(*this, "JOY4-Y") - { } - - required_device m_maincpu; - required_device m_smi; - required_device m_uv; - required_device m_discrete; - required_device m_dac; - required_device m_exp; - required_ioport m_io00; - required_ioport m_io01; - required_ioport m_io02; - required_ioport m_io03; - required_ioport m_io04; - required_ioport m_io05; - required_ioport m_io06; - required_ioport m_io07; - required_ioport m_uv201_31; - required_ioport m_joy_r; - required_ioport m_joy1_x; - required_ioport m_joy1_y; - required_ioport m_joy2_x; - required_ioport m_joy2_y; - required_ioport m_joy3_x; - required_ioport m_joy3_y; - required_ioport m_joy4_x; - required_ioport m_joy4_y; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void machine_start(); - virtual void machine_reset(); - - enum - { - TIMER_JOYSTICK - }; - - DECLARE_WRITE8_MEMBER( keyboard_w ); - DECLARE_READ8_MEMBER( keyboard_r ); - DECLARE_WRITE8_MEMBER( sound_w ); - DECLARE_WRITE8_MEMBER( f3853_w ); - DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); - DECLARE_WRITE_LINE_MEMBER( ext_int_w ); - DECLARE_WRITE_LINE_MEMBER( hblank_w ); - DECLARE_READ8_MEMBER(memory_read_byte); - - F3853_INTERRUPT_REQ_CB(f3853_int_req_w); - - IRQ_CALLBACK_MEMBER(vidbrain_int_ack); - - void interrupt_check(); - - // F3853 SMI state - UINT16 m_vector; - int m_int_enable; - int m_ext_int_latch; - int m_timer_int_latch; - - // keyboard state - UINT8 m_keylatch; - int m_joy_enable; - - // sound state - int m_sound_clk; - - // timers - emu_timer *m_timer_ne555; -}; - -//----------- defined in video/vidbrain.c ----------- - -MACHINE_CONFIG_EXTERN( vidbrain_video ); - -#endif diff --git a/src/mess/includes/vip.h b/src/mess/includes/vip.h deleted file mode 100644 index 9d2baf33491..00000000000 --- a/src/mess/includes/vip.h +++ /dev/null @@ -1,129 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __VIP__ -#define __VIP__ - -#include "emu.h" -#include "bus/vip/byteio.h" -#include "bus/vip/exp.h" -#include "cpu/cosmac/cosmac.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "machine/ram.h" -#include "sound/discrete.h" -#include "video/cdp1861.h" - -#define SCREEN_TAG "screen" -#define CDP1802_TAG "u1" -#define CDP1861_TAG "u2" -#define DISCRETE_TAG "discrete" - - -class vip_state : public driver_device -{ -public: - vip_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, CDP1802_TAG), - m_vdc(*this, CDP1861_TAG), - m_cassette(*this, "cassette"), - m_beeper(*this, DISCRETE_TAG), - m_byteio(*this, VIP_BYTEIO_PORT_TAG), - m_exp(*this, VIP_EXPANSION_SLOT_TAG), - m_ram(*this, RAM_TAG), - m_rom(*this, CDP1802_TAG), - m_chip8(*this, "chip8"), - m_chip8x(*this, "chip8x"), - m_run(*this, "RUN"), - m_keypad(*this, "KEYPAD"), - m_io_beeper(*this, "BEEPER"), - m_8000(1), - m_vdc_int(CLEAR_LINE), - m_vdc_dma_out(CLEAR_LINE), - m_vdc_ef1(CLEAR_LINE), - m_exp_int(CLEAR_LINE), - m_exp_dma_out(CLEAR_LINE), - m_exp_dma_in(CLEAR_LINE), - m_byteio_ef3(CLEAR_LINE), - m_byteio_ef4(CLEAR_LINE), - m_exp_ef1(CLEAR_LINE), - m_exp_ef3(CLEAR_LINE), - m_exp_ef4(CLEAR_LINE) - { } - - required_device m_maincpu; - required_device m_vdc; - required_device m_cassette; - required_device m_beeper; - required_device m_byteio; - required_device m_exp; - required_device m_ram; - required_memory_region m_rom; - required_memory_region m_chip8; - required_memory_region m_chip8x; - required_ioport m_run; - required_ioport m_keypad; - required_ioport m_io_beeper; - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void update_interrupts(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - - DECLARE_READ_LINE_MEMBER( clear_r ); - DECLARE_READ_LINE_MEMBER( ef1_r ); - DECLARE_READ_LINE_MEMBER( ef2_r ); - DECLARE_READ_LINE_MEMBER( ef3_r ); - DECLARE_READ_LINE_MEMBER( ef4_r ); - DECLARE_WRITE_LINE_MEMBER( q_w ); - DECLARE_READ8_MEMBER( dma_r ); - DECLARE_WRITE8_MEMBER( dma_w ); - DECLARE_WRITE8_MEMBER( sc_w ); - - DECLARE_WRITE_LINE_MEMBER( vdc_int_w ); - DECLARE_WRITE_LINE_MEMBER( vdc_dma_out_w ); - DECLARE_WRITE_LINE_MEMBER( vdc_ef1_w ); - - DECLARE_WRITE_LINE_MEMBER( byteio_inst_w ); - - DECLARE_WRITE_LINE_MEMBER( exp_int_w ); - DECLARE_WRITE_LINE_MEMBER( exp_dma_out_w ); - DECLARE_WRITE_LINE_MEMBER( exp_dma_in_w ); - - DECLARE_INPUT_CHANGED_MEMBER( reset_w ); - DECLARE_INPUT_CHANGED_MEMBER( beeper_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( vip ); - // memory state - int m_8000; - - // interrupt state - int m_vdc_int; - int m_vdc_dma_out; - int m_vdc_ef1; - int m_exp_int; - int m_exp_dma_out; - int m_exp_dma_in; - int m_byteio_ef3; - int m_byteio_ef4; - int m_exp_ef1; - int m_exp_ef3; - int m_exp_ef4; - - // keyboard state - int m_keylatch; - - // expansion state - UINT8 m_byteio_data; -}; - -#endif diff --git a/src/mess/includes/vixen.h b/src/mess/includes/vixen.h deleted file mode 100644 index 73dc628b12d..00000000000 --- a/src/mess/includes/vixen.h +++ /dev/null @@ -1,133 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __VIXEN__ -#define __VIXEN__ - -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "machine/i8155.h" -#include "machine/i8251.h" -#include "bus/ieee488/ieee488.h" -#include "machine/ram.h" -#include "machine/wd_fdc.h" -#include "sound/discrete.h" - -#define Z8400A_TAG "5f" -#define FDC1797_TAG "5n" -#define P8155H_TAG "2n" -#define P8155H_IO_TAG "c7" -#define P8251A_TAG "c3" -#define DISCRETE_TAG "discrete" -#define SCREEN_TAG "screen" -#define RS232_TAG "rs232" - -class vixen_state : public driver_device -{ -public: - vixen_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z8400A_TAG), - m_fdc(*this, FDC1797_TAG), - m_io_i8155(*this, P8155H_IO_TAG), - m_usart(*this, P8251A_TAG), - m_discrete(*this, DISCRETE_TAG), - m_ieee488(*this, IEEE488_TAG), - m_palette(*this, "palette"), - m_ram(*this, RAM_TAG), - m_floppy0(*this, FDC1797_TAG":0"), - m_floppy1(*this, FDC1797_TAG":1"), - m_rs232(*this, RS232_TAG), - m_rom(*this, Z8400A_TAG), - m_sync_rom(*this, "video"), - m_char_rom(*this, "chargen"), - m_video_ram(*this, "video_ram"), - m_key(*this, "KEY"), - m_cmd_d1(0), - m_fdint(0), - m_vsync(0), - m_srq(1), - m_atn(1), - m_rxrdy(0), - m_txrdy(0) - { } - - required_device m_maincpu; - required_device m_fdc; - required_device m_io_i8155; - required_device m_usart; - required_device m_discrete; - required_device m_ieee488; - required_device m_palette; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_rs232; - required_region_ptr m_rom; - required_region_ptr m_sync_rom; - required_region_ptr m_char_rom; - required_shared_ptr m_video_ram; - required_ioport_array<8> m_key; - - virtual void machine_start(); - virtual void machine_reset(); - - virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void update_interrupt(); - - DECLARE_WRITE8_MEMBER( ctl_w ); - DECLARE_READ8_MEMBER( status_r ); - DECLARE_WRITE8_MEMBER( cmd_w ); - DECLARE_READ8_MEMBER( ieee488_r ); - DECLARE_READ8_MEMBER( port3_r ); - DECLARE_READ8_MEMBER( i8155_pa_r ); - DECLARE_WRITE8_MEMBER( i8155_pb_w ); - DECLARE_WRITE8_MEMBER( i8155_pc_w ); - DECLARE_WRITE8_MEMBER( io_i8155_pb_w ); - DECLARE_WRITE8_MEMBER( io_i8155_pc_w ); - DECLARE_WRITE_LINE_MEMBER( io_i8155_to_w ); - DECLARE_WRITE_LINE_MEMBER( srq_w ); - DECLARE_WRITE_LINE_MEMBER( atn_w ); - DECLARE_WRITE_LINE_MEMBER( rxrdy_w ); - DECLARE_WRITE_LINE_MEMBER( txrdy_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); - DIRECT_UPDATE_MEMBER(vixen_direct_update_handler); - - // memory state - int m_reset; - - // keyboard state - UINT8 m_col; - - // interrupt state - int m_cmd_d0; - int m_cmd_d1; - - bool m_fdint; - int m_vsync; - - int m_srq; - int m_atn; - int m_enb_srq_int; - int m_enb_atn_int; - - int m_rxrdy; - int m_txrdy; - int m_int_clk; - int m_enb_xmt_int; - int m_enb_rcv_int; - int m_enb_ring_int; - - // video state - int m_alt; - int m_256; - - DECLARE_DRIVER_INIT(vixen); - TIMER_DEVICE_CALLBACK_MEMBER(vsync_tick); - IRQ_CALLBACK_MEMBER(vixen_int_ack); -}; - -#endif diff --git a/src/mess/includes/vtech2.h b/src/mess/includes/vtech2.h deleted file mode 100644 index 9a7efd680b0..00000000000 --- a/src/mess/includes/vtech2.h +++ /dev/null @@ -1,96 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/***************************************************************************** - * - * includes/vtech2.h - * - ****************************************************************************/ - -#ifndef VTECH2_H_ -#define VTECH2_H_ -#include "sound/speaker.h" -#include "imagedev/cassette.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define TRKSIZE_FM 3172 /* size of a standard FM mode track */ - -class vtech2_state : public driver_device -{ -public: - vtech2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - UINT8 *m_videoram; - int m_laser_latch; - char m_laser_frame_message[64+1]; - int m_laser_frame_time; - UINT8 *m_mem; - int m_laser_bank_mask; - int m_laser_bank[4]; - int m_laser_video_bank; - UINT8 m_laser_track_x2[2]; - UINT8 m_laser_fdc_status; - UINT8 m_laser_fdc_data[TRKSIZE_FM]; - int m_laser_data; - int m_laser_fdc_edge; - int m_laser_fdc_bits; - int m_laser_drive; - int m_laser_fdc_start; - int m_laser_fdc_write; - int m_laser_fdc_offs; - int m_laser_fdc_latch; - int m_level_old; - int m_cassette_bit; - int m_row_a; - int m_row_b; - int m_row_c; - int m_row_d; - int m_laser_bg_mode; - int m_laser_two_color; - DECLARE_WRITE8_MEMBER(laser_bank_select_w); - DECLARE_WRITE8_MEMBER(laser_fdc_w); - DECLARE_WRITE8_MEMBER(laser_bg_mode_w); - DECLARE_WRITE8_MEMBER(laser_two_color_w); - DECLARE_READ8_MEMBER(laser_fdc_r); - DECLARE_DRIVER_INIT(laser); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(vtech2); - DECLARE_MACHINE_RESET(laser500); - DECLARE_MACHINE_RESET(laser700); - UINT32 screen_update_laser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vtech2_interrupt); - - int mra_bank(int bank, int offs); - void mwa_bank(int bank, int offs, int data); - memory_region *m_cart_rom; - - DECLARE_WRITE8_MEMBER(mwa_bank1); - DECLARE_WRITE8_MEMBER(mwa_bank2); - DECLARE_WRITE8_MEMBER(mwa_bank3); - DECLARE_WRITE8_MEMBER(mwa_bank4); - DECLARE_READ8_MEMBER(mra_bank1); - DECLARE_READ8_MEMBER(mra_bank2); - DECLARE_READ8_MEMBER(mra_bank3); - DECLARE_READ8_MEMBER(mra_bank4); - required_device m_maincpu; - required_device m_speaker; - required_device m_cassette; - required_device m_cart; - void laser_machine_init(int bank_mask, int video_mask); - void laser_get_track(); - void laser_put_track(); - device_t *laser_file(); - required_device m_gfxdecode; - required_device m_palette; -}; - - -#endif /* VTECH2_H_ */ diff --git a/src/mess/includes/wangpc.h b/src/mess/includes/wangpc.h deleted file mode 100644 index 9a796d9524d..00000000000 --- a/src/mess/includes/wangpc.h +++ /dev/null @@ -1,205 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __WANGPC__ -#define __WANGPC__ - -#include "emu.h" -#include "bus/wangpc/wangpc.h" -#include "cpu/i86/i86.h" -#include "formats/pc_dsk.h" -#include "machine/am9517a.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8255.h" -#include "machine/im6402.h" -#include "machine/mc2661.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" -#include "machine/ram.h" -#include "machine/upd765.h" -#include "machine/wangpckb.h" - -#define I8086_TAG "i8086" -#define AM9517A_TAG "am9517a" -#define I8259A_TAG "i8259" -#define I8255A_TAG "i8255a" -#define I8253_TAG "i8253" -#define IM6402_TAG "im6402" -#define SCN2661_TAG "scn2661" -#define UPD765_TAG "upd765" -#define CENTRONICS_TAG "centronics" -#define RS232_TAG "rs232" -#define WANGPC_KEYBOARD_TAG "wangpckb" - -class wangpc_state : public driver_device -{ -public: - // constructor - wangpc_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, I8086_TAG), - m_dmac(*this, AM9517A_TAG), - m_pic(*this, I8259A_TAG), - m_ppi(*this, I8255A_TAG), - m_pit(*this, I8253_TAG), - m_uart(*this, IM6402_TAG), - m_epci(*this, SCN2661_TAG), - m_fdc(*this, UPD765_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, UPD765_TAG ":0:525dd"), - m_floppy1(*this, UPD765_TAG ":1:525dd"), - m_centronics(*this, CENTRONICS_TAG), - m_cent_data_in(*this, "cent_data_in"), - m_cent_data_out(*this, "cent_data_out"), - m_bus(*this, WANGPC_BUS_TAG), - m_sw(*this, "SW"), - m_timer2_irq(1), - m_centronics_ack(1), - m_dav(1), - m_dma_eop(1), - m_uart_dr(0), - m_uart_tbre(0), - m_fpu_irq(0), - m_bus_irq2(0), - m_enable_eop(0), - m_disable_dreq2(0), - m_fdc_drq(0), - m_fdc_dd0(0), - m_fdc_dd1(0), - m_fdc_tc(0), - m_ds1(false), - m_ds2(false) - { - } - - required_device m_maincpu; - required_device m_dmac; - required_device m_pic; - required_device m_ppi; - required_device m_pit; - required_device m_uart; - required_device m_epci; - required_device m_fdc; - required_device m_ram; - required_device m_floppy0; - required_device m_floppy1; - required_device m_centronics; - required_device m_cent_data_in; - required_device m_cent_data_out; - required_device m_bus; - required_ioport m_sw; - - virtual void machine_start(); - virtual void machine_reset(); - - void select_drive(); - void check_level1_interrupts(); - void check_level2_interrupts(); - void update_fdc_drq(); - void update_fdc_tc(); - - DECLARE_WRITE8_MEMBER( fdc_ctrl_w ); - DECLARE_READ8_MEMBER( deselect_drive1_r ); - DECLARE_WRITE8_MEMBER( deselect_drive1_w ); - DECLARE_READ8_MEMBER( select_drive1_r ); - DECLARE_WRITE8_MEMBER( select_drive1_w ); - DECLARE_READ8_MEMBER( deselect_drive2_r ); - DECLARE_WRITE8_MEMBER( deselect_drive2_w ); - DECLARE_READ8_MEMBER( select_drive2_r ); - DECLARE_WRITE8_MEMBER( select_drive2_w ); - DECLARE_READ8_MEMBER( motor1_off_r ); - DECLARE_WRITE8_MEMBER( motor1_off_w ); - DECLARE_READ8_MEMBER( motor1_on_r ); - DECLARE_WRITE8_MEMBER( motor1_on_w ); - DECLARE_READ8_MEMBER( motor2_off_r ); - DECLARE_WRITE8_MEMBER( motor2_off_w ); - DECLARE_READ8_MEMBER( motor2_on_r ); - DECLARE_WRITE8_MEMBER( motor2_on_w ); - DECLARE_READ8_MEMBER( fdc_reset_r ); - DECLARE_WRITE8_MEMBER( fdc_reset_w ); - DECLARE_READ8_MEMBER( fdc_tc_r ); - DECLARE_WRITE8_MEMBER( fdc_tc_w ); - DECLARE_WRITE8_MEMBER( dma_page_w ); - DECLARE_READ8_MEMBER( status_r ); - DECLARE_WRITE8_MEMBER( timer0_irq_clr_w ); - DECLARE_READ8_MEMBER( timer2_irq_clr_r ); - DECLARE_WRITE8_MEMBER( nmi_mask_w ); - DECLARE_READ8_MEMBER( led_on_r ); - DECLARE_WRITE8_MEMBER( fpu_mask_w ); - DECLARE_READ8_MEMBER( dma_eop_clr_r ); - DECLARE_WRITE8_MEMBER( uart_tbre_clr_w ); - DECLARE_READ8_MEMBER( uart_r ); - DECLARE_WRITE8_MEMBER( uart_w ); - DECLARE_READ8_MEMBER( centronics_r ); - DECLARE_WRITE8_MEMBER( centronics_w ); - DECLARE_READ8_MEMBER( busy_clr_r ); - DECLARE_WRITE8_MEMBER( acknlg_clr_w ); - DECLARE_READ8_MEMBER( led_off_r ); - DECLARE_WRITE8_MEMBER( parity_nmi_clr_w ); - DECLARE_READ8_MEMBER( option_id_r ); - - DECLARE_WRITE_LINE_MEMBER( hrq_w ); - DECLARE_WRITE_LINE_MEMBER( eop_w ); - DECLARE_READ8_MEMBER( memr_r ); - DECLARE_WRITE8_MEMBER( memw_w ); - DECLARE_READ8_MEMBER( ior2_r ); - DECLARE_WRITE8_MEMBER( iow2_w ); - DECLARE_WRITE_LINE_MEMBER( dack0_w ); - DECLARE_WRITE_LINE_MEMBER( dack1_w ); - DECLARE_WRITE_LINE_MEMBER( dack2_w ); - DECLARE_WRITE_LINE_MEMBER( dack3_w ); - DECLARE_READ8_MEMBER( ppi_pa_r ); - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_READ8_MEMBER( ppi_pc_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - DECLARE_WRITE_LINE_MEMBER( pit0_w ); - DECLARE_WRITE_LINE_MEMBER( pit2_w ); - DECLARE_WRITE_LINE_MEMBER( uart_dr_w ); - DECLARE_WRITE_LINE_MEMBER( uart_tbre_w ); - DECLARE_WRITE_LINE_MEMBER( epci_irq_w ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_ack ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_busy ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_fault ); - DECLARE_WRITE_LINE_MEMBER( write_centronics_perror ); - DECLARE_WRITE_LINE_MEMBER( bus_irq2_w ); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - DECLARE_WRITE_LINE_MEMBER( fdc_irq ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq ); - - int on_disk0_load(floppy_image_device *image); - void on_disk0_unload(floppy_image_device *image); - int on_disk1_load(floppy_image_device *image); - void on_disk1_unload(floppy_image_device *image); - - UINT8 m_dma_page[4]; - int m_dack; - - int m_timer2_irq; - int m_centronics_ack; - int m_centronics_busy; - int m_centronics_fault; - int m_centronics_perror; - int m_dav; - int m_dma_eop; - int m_uart_dr; - int m_uart_tbre; - int m_fpu_irq; - int m_bus_irq2; - - int m_enable_eop; - int m_disable_dreq2; - int m_fdc_drq; - int m_fdc_dd0; - int m_fdc_dd1; - int m_fdc_tc; - int m_ds1; - int m_ds2; - - int m_led[6]; -}; - - -#endif diff --git a/src/mess/includes/wswan.h b/src/mess/includes/wswan.h deleted file mode 100644 index 42f8b2b0fa8..00000000000 --- a/src/mess/includes/wswan.h +++ /dev/null @@ -1,104 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/***************************************************************************** - * - * includes/wswan.h - * - ****************************************************************************/ - -#ifndef WSWAN_H_ -#define WSWAN_H_ - -#define WSWAN_TYPE_MONO 0 -#define WSWAN_TYPE_COLOR 1 - -#define INTERNAL_EEPROM_SIZE 1024 - -#include "emu.h" -#include "cpu/v30mz/v30mz.h" -#include "machine/nvram.h" -#include "audio/wswan_snd.h" -#include "video/wswan_video.h" -#include "bus/wswan/slot.h" -#include "bus/wswan/rom.h" - - -struct SoundDMA -{ - UINT32 source; /* Source address */ - UINT16 size; /* Size */ - UINT8 enable; /* Enabled */ -}; - - -class wswan_state : public driver_device -{ -public: - wswan_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_vdp(*this, "vdp"), - m_sound(*this, "custom"), - m_cart(*this, "cartslot"), - m_cursx(*this, "CURSX"), - m_cursy(*this, "CURSY"), - m_buttons(*this, "BUTTONS") - { } - - required_device m_maincpu; - required_device m_vdp; - required_device m_sound; - required_device m_cart; - DECLARE_READ8_MEMBER(bios_r); - DECLARE_READ8_MEMBER(port_r); - DECLARE_WRITE8_MEMBER(port_w); - - UINT8 m_ws_portram[256]; - UINT8 m_internal_eeprom[INTERNAL_EEPROM_SIZE]; - UINT8 m_system_type; - SoundDMA m_sound_dma; - UINT8 *m_ws_bios_bank; - UINT8 m_bios_disabled; - UINT8 m_rotate; - - void set_irq_line(int irq); - void dma_sound_cb(); - void common_start(); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_PALETTE_INIT(wswan); - DECLARE_MACHINE_START(wscolor); - DECLARE_PALETTE_INIT(wscolor); - -protected: - /* Interrupt flags */ - static const UINT8 WSWAN_IFLAG_STX = 0x01; - static const UINT8 WSWAN_IFLAG_KEY = 0x02; - static const UINT8 WSWAN_IFLAG_RTC = 0x04; - static const UINT8 WSWAN_IFLAG_SRX = 0x08; - static const UINT8 WSWAN_IFLAG_LCMP = 0x10; - static const UINT8 WSWAN_IFLAG_VBLTMR = 0x20; - static const UINT8 WSWAN_IFLAG_VBL = 0x40; - static const UINT8 WSWAN_IFLAG_HBLTMR = 0x80; - - /* Interrupts */ - static const UINT8 WSWAN_INT_STX = 0; - static const UINT8 WSWAN_INT_KEY = 1; - static const UINT8 WSWAN_INT_RTC = 2; - static const UINT8 WSWAN_INT_SRX = 3; - static const UINT8 WSWAN_INT_LCMP = 4; - static const UINT8 WSWAN_INT_VBLTMR = 5; - static const UINT8 WSWAN_INT_VBL = 6; - static const UINT8 WSWAN_INT_HBLTMR = 7; - - required_ioport m_cursx; - required_ioport m_cursy; - required_ioport m_buttons; - - void register_save(); - void handle_irqs(); - void clear_irq_line(int irq); -}; - - -#endif /* WSWAN_H_ */ diff --git a/src/mess/includes/x07.h b/src/mess/includes/x07.h deleted file mode 100644 index 2a7cd1e40e6..00000000000 --- a/src/mess/includes/x07.h +++ /dev/null @@ -1,285 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/********************************************************************* - - includes/x07.h - -*********************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/beep.h" -#include "machine/nvram.h" -#include "machine/ram.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "imagedev/printer.h" -#include "formats/x07_cas.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "rendlay.h" - -//default value for user defined keys, taken for official documentation -static const char *const udk_ini[12] = { - "tim?TIME$\r", - "cldCLOAD\"", - "locLOCATE ", - "lstLIST ", - "runRUN\r", - "", - "dat?DATE$\r", - "csvCSAVE\"", - "prtPRINT ", - "slpSLEEP", - "cntCONT\r", - "" -}; - -static const UINT16 udk_offset[12] = -{ - 0x0000, 0x002a, 0x0054, 0x007e, 0x00a8, 0x00d2, - 0x0100, 0x012a, 0x0154, 0x017e, 0x01a8, 0x01d2 -}; - -static const UINT8 printer_charcode[256] = -{ - 0xff, 0x7f, 0xbf, 0x3f, 0xdf, 0x5f, 0x9f, 0x1f, - 0xef, 0x6f, 0xaf, 0x2f, 0xcf, 0x4f, 0x8f, 0x0f, - 0xf7, 0x77, 0xb7, 0x37, 0xd7, 0x57, 0x97, 0x17, - 0xe7, 0x67, 0xa7, 0x27, 0xc7, 0x47, 0x87, 0x07, - 0xfb, 0x7b, 0xbb, 0x3b, 0xdb, 0x5b, 0x9b, 0x1b, - 0xeb, 0x6b, 0xab, 0x2b, 0xcb, 0x4b, 0x8b, 0x0b, - 0xf3, 0x73, 0xb3, 0x33, 0xd3, 0x53, 0x93, 0x13, - 0xe3, 0x63, 0xa3, 0x23, 0xc3, 0x43, 0x83, 0x03, - 0xfd, 0x7d, 0xbd, 0x3d, 0xdd, 0x5d, 0x9d, 0x1d, - 0xed, 0x6d, 0xad, 0x2d, 0xcd, 0x4d, 0x8d, 0x0d, - 0xf5, 0x75, 0xb5, 0x35, 0xd5, 0x55, 0x95, 0x15, - 0xe5, 0x65, 0xa5, 0x25, 0xc5, 0x45, 0x85, 0x05, - 0xf9, 0x79, 0xb9, 0x39, 0xd9, 0x59, 0x99, 0x19, - 0xe9, 0x69, 0xa9, 0x29, 0xc9, 0x49, 0x89, 0x09, - 0xf1, 0x71, 0xb1, 0x31, 0xd1, 0x51, 0x91, 0x11, - 0xe1, 0x61, 0xa1, 0x21, 0xc1, 0x41, 0x81, 0x01, - 0xfe, 0x7e, 0xbe, 0x3e, 0xde, 0x5e, 0x9e, 0x1e, - 0xee, 0x6e, 0xae, 0x2e, 0xce, 0x4e, 0x8e, 0x0e, - 0xf6, 0x76, 0xb6, 0x36, 0xd6, 0x56, 0x96, 0x16, - 0xe6, 0x66, 0xa6, 0x26, 0xc6, 0x46, 0x86, 0x06, - 0xfa, 0x7a, 0xba, 0x3a, 0xda, 0x5a, 0x9a, 0x1a, - 0xea, 0x6a, 0xaa, 0x2a, 0xca, 0x4a, 0x8a, 0x0a, - 0xf2, 0x72, 0xb2, 0x32, 0xd2, 0x52, 0x92, 0x12, - 0xe2, 0x62, 0xa2, 0x22, 0xc2, 0x42, 0x82, 0x02, - 0xfc, 0x7c, 0xbc, 0x3c, 0xdc, 0x5c, 0x9c, 0x1c, - 0xec, 0x6c, 0xac, 0x2c, 0xcc, 0x4c, 0x8c, 0x0c, - 0xf4, 0x74, 0xb4, 0x34, 0xd4, 0x54, 0x94, 0x14, - 0xe4, 0x64, 0xa4, 0x24, 0xc4, 0x44, 0x84, 0x04, - 0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18, - 0xe8, 0x68, 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08, - 0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10, - 0xe0, 0x60, 0xa0, 0x20, 0xc0, 0x40, 0x80, 0x00 -}; - -static const UINT8 t6834_cmd_len[0x47] = -{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x04, 0x03, - 0x01, 0x02, 0x09, 0x01, 0x09, 0x01, 0x01, 0x02, - 0x03, 0x03, 0x03, 0x03, 0x05, 0x04, 0x82, 0x02, - 0x01, 0x01, 0x0a, 0x02, 0x01, 0x81, 0x81, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x03, - 0x02, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x82, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x09, 0x01, 0x03, 0x03, 0x01, 0x01 -}; - -struct x07_kb -{ - const char *tag; //input port tag - UINT8 mask; //bit mask - UINT8 codes[7]; //port codes -}; - -static const x07_kb x07_keycodes[56] = -{ - {"BZ", 0x01, {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}}, - {"S1", 0x01, {0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12}}, - {"S1", 0x02, {0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16}}, - {"S1", 0x04, {0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c}}, - {"S1", 0x08, {0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d}}, - {"S1", 0x10, {0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e}}, - {"S1", 0x20, {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f}}, - {"S1", 0x40, {0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20}}, - {"S2", 0x01, {0x5a, 0x7a, 0x1a, 0x00, 0xc2, 0xaf, 0xe1}}, - {"S2", 0x02, {0x58, 0x78, 0x18, 0x00, 0xbb, 0x00, 0x98}}, - {"S2", 0x04, {0x43, 0x63, 0x03, 0x00, 0xbf, 0x00, 0xe4}}, - {"S2", 0x08, {0x56, 0x76, 0x16, 0x00, 0xcb, 0x00, 0x95}}, - {"S2", 0x10, {0x42, 0x62, 0x02, 0x00, 0xba, 0x00, 0xed}}, - {"S2", 0x20, {0x4e, 0x6e, 0x0e, 0x00, 0xd0, 0x00, 0x89}}, - {"S2", 0x40, {0x4d, 0x6d, 0x0d, 0x30, 0xd3, 0x00, 0xf5}}, - {"S2", 0x80, {0x2c, 0x3c, 0x00, 0x00, 0xc8, 0xa4, 0x9c}}, - {"S3", 0x01, {0x41, 0x61, 0x01, 0x00, 0xc1, 0x00, 0x88}}, - {"S3", 0x02, {0x53, 0x73, 0x13, 0x00, 0xc4, 0x00, 0x9f}}, - {"S3", 0x04, {0x44, 0x64, 0x04, 0x00, 0xbc, 0x00, 0xef}}, - {"S3", 0x08, {0x46, 0x66, 0x06, 0x00, 0xca, 0x00, 0xfd}}, - {"S3", 0x10, {0x47, 0x67, 0x07, 0x00, 0xb7, 0x00, 0x9d}}, - {"S3", 0x20, {0x48, 0x68, 0x08, 0x00, 0xb8, 0x00, 0xfe}}, - {"S3", 0x40, {0x4a, 0x6a, 0x0a, 0x31, 0xcf, 0x00, 0xe5}}, - {"S3", 0x80, {0x4b, 0x6b, 0x0b, 0x32, 0xc9, 0x00, 0x9b}}, - {"S4", 0x01, {0x51, 0x71, 0x11, 0x00, 0xc0, 0x00, 0x8b}}, - {"S4", 0x02, {0x57, 0x77, 0x17, 0x00, 0xc3, 0x00, 0xfb}}, - {"S4", 0x04, {0x45, 0x65, 0x05, 0x00, 0xb2, 0xa8, 0x99}}, - {"S4", 0x08, {0x52, 0x72, 0x12, 0x00, 0xbd, 0x00, 0xf6}}, - {"S4", 0x10, {0x54, 0x74, 0x14, 0x00, 0xb6, 0x00, 0x97}}, - {"S4", 0x20, {0x59, 0x79, 0x19, 0x35, 0xdd, 0x00, 0x96}}, - {"S4", 0x40, {0x55, 0x75, 0x15, 0x34, 0xc5, 0x00, 0x94}}, - {"S4", 0x80, {0x49, 0x69, 0x09, 0x00, 0xc6, 0x00, 0xf9}}, - {"S5", 0x01, {0x31, 0x21, 0x00, 0x00, 0xc7, 0x00, 0xe9}}, - {"S5", 0x02, {0x32, 0x22, 0x00, 0x00, 0xcc, 0x00, 0x90}}, - {"S5", 0x04, {0x33, 0x23, 0x00, 0x00, 0xb1, 0xa7, 0x91}}, - {"S5", 0x08, {0x34, 0x24, 0x00, 0x00, 0xb3, 0xa9, 0x92}}, - {"S5", 0x10, {0x35, 0x25, 0x00, 0x00, 0xb4, 0xaa, 0x93}}, - {"S5", 0x20, {0x36, 0x26, 0x00, 0x00, 0xb5, 0xab, 0xec}}, - {"S5", 0x40, {0x37, 0x27, 0x37, 0x00, 0xd4, 0xac, 0xe0}}, - {"S5", 0x80, {0x38, 0x28, 0x37, 0x00, 0xd5, 0xad, 0xf2}}, - {"S7", 0x01, {0x2e, 0x3e, 0x00, 0x2e, 0xd9, 0xa1, 0x9a}}, - {"S7", 0x02, {0x2f, 0x3f, 0x00, 0x00, 0xd2, 0xa5, 0x80}}, - {"S7", 0x04, {0x3f, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {"S7", 0x08, {0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d}}, - {"S7", 0x10, {0x4f, 0x6f, 0x0f, 0x36, 0xd7, 0x00, 0x9e}}, - {"S7", 0x20, {0x50, 0x70, 0x10, 0x00, 0xbe, 0x00, 0xf7}}, - {"S7", 0x40, {0x40, 0x60, 0x00, 0x00, 0xde, 0x00, 0xe7}}, - {"S7", 0x80, {0x5b, 0x7b, 0x00, 0x00, 0xdf, 0xa2, 0x84}}, - {"S8", 0x01, {0x4c, 0x6c, 0x0c, 0x33, 0xd8, 0x00, 0xf4}}, - {"S8", 0x02, {0x3b, 0x2b, 0x00, 0x00, 0xda, 0x00, 0x82}}, - {"S8", 0x04, {0x3a, 0x2a, 0x00, 0x00, 0xb9, 0x00, 0x81}}, - {"S8", 0x08, {0x5d, 0x7d, 0x00, 0x00, 0xd1, 0xa3, 0x85}}, - {"S8", 0x10, {0x39, 0x29, 0x39, 0x00, 0xd6, 0xae, 0xf1}}, - {"S8", 0x20, {0x30, 0x7c, 0x00, 0x00, 0xdc, 0xa6, 0x8a}}, - {"S8", 0x40, {0x2d, 0x3d, 0x00, 0x00, 0xce, 0x00, 0xf0}}, - {"S8", 0x80, {0x3d, 0x7e, 0x00, 0x00, 0xcd, 0x00, 0xfc}} -}; - -class x07_state : public driver_device -{ -public: - x07_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_printer(*this, "printer"), - m_beep(*this, "beeper"), - m_ram(*this, RAM_TAG), - m_nvram1(*this, "nvram1"), - m_nvram2(*this, "nvram2"), - m_cassette(*this, "cassette"), - m_card(*this, "cardslot"), - m_warm_start(1) - { } - - required_device m_maincpu; - required_device m_printer; - required_device m_beep; - required_device m_ram; - required_device m_nvram1; - required_device m_nvram2; - required_device m_cassette; - required_device m_card; - - void machine_start(); - void machine_reset(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER( x07_io_r ); - DECLARE_WRITE8_MEMBER( x07_io_w ); - - DECLARE_INPUT_CHANGED_MEMBER( kb_keys ); - DECLARE_INPUT_CHANGED_MEMBER( kb_func_keys ); - DECLARE_INPUT_CHANGED_MEMBER( kb_break ); - DECLARE_INPUT_CHANGED_MEMBER( kb_update_udk ); - - DECLARE_DRIVER_INIT(x07); - void nvram_init(nvram_device &nvram, void *data, size_t size); - - void t6834_cmd(UINT8 cmd); - void t6834_r(); - void t6834_w(); - void cassette_w(); - void cassette_r(); - void printer_w(); - void kb_irq(); - void cassette_load(); - void cassette_save(); - void receive_bit(int bit); - - inline UINT8 get_char(UINT16 pos); - inline UINT8 kb_get_index(UINT8 char_code); - inline void draw_char(UINT8 x, UINT8 y, UINT8 char_pos); - inline void draw_point(UINT8 x, UINT8 y, UINT8 color); - inline void draw_udk(); - - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( x07_card ); - - /* general */ - UINT8 m_sleep; - UINT8 m_warm_start; - UINT8 m_t6834_ram[0x800]; - UINT8 m_regs_r[8]; - UINT8 m_regs_w[8]; - UINT8 m_alarm[8]; - - struct fifo_buffer - { - UINT8 data[0x100]; - UINT8 read; - UINT8 write; - }; - fifo_buffer m_in; - fifo_buffer m_out; - - UINT8 m_udk_on; - UINT8 m_draw_udk; - UINT8 m_sp_on; - UINT8 m_font_code; - emu_timer *m_rsta_clear; - emu_timer *m_rstb_clear; - emu_timer *m_beep_stop; - - /* LCD */ - UINT8 m_lcd_on; - UINT8 m_lcd_map[32][120]; - UINT8 m_scroll_min; - UINT8 m_scroll_max; - UINT8 m_blink; - - struct lcd_position - { - UINT8 x; - UINT8 y; - UINT8 on; - }; - lcd_position m_locate; - lcd_position m_cursor; - - /* keyboard */ - UINT8 m_kb_on; - UINT8 m_repeat_key; //not supported - UINT8 m_kb_size; - - /* cassette */ - UINT8 m_cass_motor; - UINT8 m_cass_data; - UINT32 m_cass_clk; - UINT8 m_bit_count; - int m_cass_state; - emu_timer *m_cass_poll; - emu_timer *m_cass_tick; - - /* printer */ - UINT8 m_prn_sendbit; - UINT8 m_prn_char_code; - UINT8 m_prn_buffer[0x100]; - UINT8 m_prn_size; - DECLARE_PALETTE_INIT(x07); - TIMER_CALLBACK_MEMBER(cassette_tick); - TIMER_CALLBACK_MEMBER(cassette_poll); - TIMER_CALLBACK_MEMBER(rsta_clear); - TIMER_CALLBACK_MEMBER(rstb_clear); - TIMER_CALLBACK_MEMBER(beep_stop); - TIMER_DEVICE_CALLBACK_MEMBER(blink_timer); -}; diff --git a/src/mess/includes/x1.h b/src/mess/includes/x1.h deleted file mode 100644 index 13ab9b6ce2e..00000000000 --- a/src/mess/includes/x1.h +++ /dev/null @@ -1,303 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese, Barry Rodewald -/***************************************************************************** - * - * includes/x1.h - * - ****************************************************************************/ - -#ifndef X1_H_ -#define X1_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "machine/i8255.h" -#include "machine/wd_fdc.h" -#include "machine/z80dma.h" -#include "video/mc6845.h" -#include "sound/2151intf.h" -#include "sound/ay8910.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" -#include "formats/x1_tap.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - - -// ======================> x1_keyboard_device - -class x1_keyboard_device : public device_t, - public device_z80daisy_interface -{ -public: - // construction/destruction - x1_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -private: - virtual void device_start(); - // z80daisy_interface overrides - virtual int z80daisy_irq_state(); - virtual int z80daisy_irq_ack(); - virtual void z80daisy_irq_reti(); -}; - -struct scrn_reg_t -{ - UINT8 gfx_bank; - UINT8 disp_bank; - UINT8 pcg_mode; - UINT8 v400_mode; - UINT8 ank_sel; - - UINT8 pri; - UINT8 blackclip; // x1 turbo specific -}; - -struct turbo_reg_t -{ - UINT8 pal; - UINT8 gfx_pal; - UINT8 txt_pal[8]; - UINT8 txt_disp; -}; - -struct x1_rtc_t -{ - UINT8 sec, min, hour, day, wday, month, year; -}; - - -class x1_state : public driver_device -{ -public: - x1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"x1_cpu"), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_floppy2(*this, "fdc:2"), - m_floppy3(*this, "fdc:3"), - m_crtc(*this, "crtc"), - m_ctc(*this, "ctc"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_dma(*this, "dma") - { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - required_device m_maincpu; - required_device m_cassette; - required_device m_cart; - required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_device m_crtc; - required_device m_ctc; - - UINT8 *m_tvram; /**< Pointer for Text Video RAM */ - UINT8 *m_avram; /**< Pointer for Attribute Video RAM */ - UINT8 *m_kvram; /**< Pointer for Extended Kanji Video RAM (X1 Turbo) */ - UINT8 *m_ipl_rom; /**< Pointer for IPL ROM */ - UINT8 *m_work_ram; /**< Pointer for base work RAM */ - UINT8 *m_emm_ram; /**< Pointer for EMM RAM */ - UINT8 *m_pcg_ram; /**< Pointer for PCG GFX RAM */ - UINT8 *m_cg_rom; /**< Pointer for GFX ROM */ - UINT8 *m_kanji_rom; /**< Pointer for Kanji ROMs */ - int m_xstart, /**< Start X offset for screen drawing. */ - m_ystart; /**< Start Y offset for screen drawing. */ - UINT8 m_hres_320; /**< Pixel clock divider setting: (1) 48 (0) 24 */ - UINT8 m_io_switch; /**< Enable access for special bitmap RMW phase in isolated i/o. */ - UINT8 m_io_sys; /**< Read-back for PPI port C */ - UINT8 m_vsync; /**< Screen V-Sync bit, active low */ - UINT8 m_vdisp; /**< Screen V-Disp bit, active high */ - UINT8 m_io_bank_mode; /**< Helper for special bitmap RMW phase. */ - UINT8 *m_gfx_bitmap_ram; /**< Pointer for bitmap layer RAM. */ - UINT8 m_pcg_reset; /**< @todo Unused variable. */ - UINT8 m_sub_obf; /**< MCU side: OBF flag active low, indicates that there are parameters in comm buffer. */ - UINT8 m_ctc_irq_flag; /**< @todo Unused variable. */ - scrn_reg_t m_scrn_reg; /**< Base Video Registers. */ - turbo_reg_t m_turbo_reg; /**< Turbo Z Video Registers. */ - x1_rtc_t m_rtc; /**< Struct for RTC related variables */ - emu_timer *m_rtc_timer; /**< Pointer for RTC timer. */ - UINT8 m_pcg_write_addr; /**< @todo Unused variable. */ - UINT8 m_sub_cmd; /**< MCU side: current command issued from Main to Sub. */ - UINT8 m_sub_cmd_length; /**< MCU side: number of parameters, in bytes. */ - UINT8 m_sub_val[8]; /**< MCU side: parameters buffer. */ - int m_sub_val_ptr; /**< MCU side: index for parameter read-back */ - int m_key_i; /**< MCU side: index for keyboard read-back during OBF phase. */ - UINT8 m_irq_vector; /**< @todo Unused variable. */ - UINT8 m_cmt_current_cmd; /**< MCU side: CMT command issued. */ - UINT8 m_cmt_test; /**< MCU side: Tape BREAK status bit. */ - UINT8 m_rom_index[3]; /**< Current ROM address. */ - UINT32 m_kanji_offset; /**< @todo Unused variable. */ - UINT8 m_bios_offset; /**< @todo Unused variable. */ - UINT8 m_x_b; /**< Palette Register for Blue Gun */ - UINT8 m_x_g; /**< Palette Register for Green Gun */ - UINT8 m_x_r; /**< Palette Register for Red Gun */ - UINT16 m_kanji_addr_latch; /**< Internal Kanji ROM address. */ - UINT32 m_kanji_addr; /**< Latched Kanji ROM address. */ - UINT8 m_kanji_eksel; /**< Kanji ROM register bit for latch phase. */ - UINT8 m_pcg_reset_occurred; /**< @todo Unused variable. */ - UINT32 m_old_key1; /**< Keyboard read buffer for i/o port "key1" */ - UINT32 m_old_key2; /**< Keyboard read buffer for i/o port "key2" */ - UINT32 m_old_key3; /**< Keyboard read buffer for i/o port "key3" */ - UINT32 m_old_key4; /**< Keyboard read buffer for i/o port "tenkey" */ - UINT32 m_old_fkey; /**< Keyboard read buffer for i/o port "f_keys" */ - UINT8 m_key_irq_flag; /**< Keyboard IRQ pending. */ - UINT8 m_key_irq_vector; /**< Keyboard IRQ vector. */ - UINT32 m_emm_addr; /**< EMM RAM current address */ - UINT8 *m_pal_4096; /**< X1 Turbo Z: pointer for 4096 palette entries */ - UINT8 m_crtc_vreg[0x100], /**< CRTC register buffer. */ - m_crtc_index; /**< CRTC register index. */ - UINT8 m_is_turbo; /**< Machine type: (0) X1 Vanilla, (1) X1 Turbo */ - UINT8 m_ex_bank; /**< X1 Turbo Z: RAM bank register */ - UINT8 m_ram_bank; /**< Regular RAM bank for 0x0000-0x7fff memory window: (0) ROM/IPL (1) RAM */ - /** - @brief Refresh current bitmap palette. - */ - void set_current_palette(); - /** - @brief Retrieves the current PCG address. - - @param width Number of currently setted up CRTC characters - @param y_char_size Number of scanlines per character. - @return Destination PCG address. - */ - UINT16 get_pcg_addr(UINT16 width, UINT8 y_char_size); - /** - @brief X1 Turbo: Retrieves the current CHR ROM address in Hi-Speed Mode. - - @return Destination CHR address. - */ - UINT16 check_chr_addr(); - /** - @brief X1 Turbo: Retrieves the current PCG ROM address in Hi-Speed Mode. - - @return Destination CHR address. - */ - UINT16 check_pcg_addr(); - /** - @brief MCU side: retrieve keycode to game key conversion. - - @param port Address to convert. - @return The converted game key buffer - */ - UINT8 get_game_key(UINT8 port); - /** - @brief MCU side: retrieve keyboard special key register. - - @return - x--- ---- TEN: Numpad, Function key, special input key - -x-- ---- KIN: Valid key - --x- ---- REP: Key repeat - ---x ---- GRAPH key ON - ---- x--- CAPS lock ON - ---- -x-- KANA lock ON - ---- --x- SHIFT ON - ---- ---x CTRL ON - */ - UINT8 check_keyboard_shift(); - /** - @brief convert MAME input to raw scancode for keyboard. - - @return the converted scancode - @todo Unoptimized. - */ - UINT16 check_keyboard_press(); - - DECLARE_READ8_MEMBER(x1_mem_r); - DECLARE_WRITE8_MEMBER(x1_mem_w); - DECLARE_READ8_MEMBER(x1_io_r); - DECLARE_WRITE8_MEMBER(x1_io_w); - DECLARE_READ8_MEMBER(x1_sub_io_r); - DECLARE_WRITE8_MEMBER(x1_sub_io_w); - DECLARE_READ8_MEMBER(x1_rom_r); - DECLARE_WRITE8_MEMBER(x1_rom_w); - DECLARE_WRITE8_MEMBER(x1_rom_bank_0_w); - DECLARE_WRITE8_MEMBER(x1_rom_bank_1_w); - DECLARE_READ8_MEMBER(x1_fdc_r); - DECLARE_WRITE8_MEMBER(x1_fdc_w); - DECLARE_READ8_MEMBER(x1_pcg_r); - DECLARE_WRITE8_MEMBER(x1_pcg_w); - DECLARE_WRITE8_MEMBER(x1_pal_r_w); - DECLARE_WRITE8_MEMBER(x1_pal_g_w); - DECLARE_WRITE8_MEMBER(x1_pal_b_w); - DECLARE_WRITE8_MEMBER(x1_ex_gfxram_w); - DECLARE_WRITE8_MEMBER(x1_scrn_w); - DECLARE_WRITE8_MEMBER(x1_pri_w); - DECLARE_WRITE8_MEMBER(x1_6845_w); - DECLARE_READ8_MEMBER(x1_kanji_r); - DECLARE_WRITE8_MEMBER(x1_kanji_w); - DECLARE_READ8_MEMBER(x1_emm_r); - DECLARE_WRITE8_MEMBER(x1_emm_w); - DECLARE_READ8_MEMBER(x1turbo_pal_r); - DECLARE_READ8_MEMBER(x1turbo_txpal_r); - DECLARE_READ8_MEMBER(x1turbo_txdisp_r); - DECLARE_READ8_MEMBER(x1turbo_gfxpal_r); - DECLARE_WRITE8_MEMBER(x1turbo_pal_w); - DECLARE_WRITE8_MEMBER(x1turbo_txpal_w); - DECLARE_WRITE8_MEMBER(x1turbo_txdisp_w); - DECLARE_WRITE8_MEMBER(x1turbo_gfxpal_w); - DECLARE_WRITE8_MEMBER(x1turbo_blackclip_w); - DECLARE_READ8_MEMBER(x1turbo_mem_r); - DECLARE_WRITE8_MEMBER(x1turbo_mem_w); - DECLARE_READ8_MEMBER(x1turbo_io_r); - DECLARE_WRITE8_MEMBER(x1turbo_io_w); - DECLARE_WRITE8_MEMBER(x1turboz_4096_palette_w); - DECLARE_READ8_MEMBER(x1turboz_blackclip_r); - DECLARE_READ8_MEMBER(x1turbo_bank_r); - DECLARE_WRITE8_MEMBER(x1turbo_bank_w); - DECLARE_READ8_MEMBER(x1_porta_r); - DECLARE_READ8_MEMBER(x1_portb_r); - DECLARE_READ8_MEMBER(x1_portc_r); - DECLARE_WRITE8_MEMBER(x1_porta_w); - DECLARE_WRITE8_MEMBER(x1_portb_w); - DECLARE_WRITE8_MEMBER(x1_portc_w); - DECLARE_DRIVER_INIT(x1_kanji); - DECLARE_MACHINE_START(x1); - DECLARE_MACHINE_RESET(x1); - DECLARE_VIDEO_START(x1); - DECLARE_PALETTE_INIT(x1); - DECLARE_MACHINE_RESET(x1turbo); - UINT32 screen_update_x1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_INPUT_CHANGED_MEMBER(ipl_reset); - DECLARE_INPUT_CHANGED_MEMBER(nmi_reset); - TIMER_CALLBACK_MEMBER(x1_rtc_increment); - TIMER_DEVICE_CALLBACK_MEMBER(x1_cmt_wind_timer); - TIMER_DEVICE_CALLBACK_MEMBER(x1_keyboard_callback); - DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - - void x1_draw_pixel(bitmap_rgb32 &bitmap,int y,int x,UINT16 pen,UINT8 width,UINT8 height); - void draw_fgtilemap(bitmap_rgb32 &bitmap,const rectangle &cliprect); - void draw_gfxbitmap(bitmap_rgb32 &bitmap,const rectangle &cliprect, int plane,int pri); - UINT8 check_prev_height(int x,int y,int x_size); - UINT8 check_line_valid_height(int y,int x_size,int height); - - int priority_mixer_pri(int color); - void cmt_command( UINT8 cmd ); - UINT16 jis_convert(int kanji_addr); - - DECLARE_READ8_MEMBER(memory_read_byte); - DECLARE_WRITE8_MEMBER(memory_write_byte); - DECLARE_READ8_MEMBER(io_read_byte); - DECLARE_WRITE8_MEMBER(io_write_byte); - required_device m_gfxdecode; - required_device m_palette; - optional_device m_dma; -}; - -/*----------- defined in machine/x1.c -----------*/ - -extern const device_type X1_KEYBOARD; - -#endif /* X1_H_ */ diff --git a/src/mess/includes/x68k.h b/src/mess/includes/x68k.h deleted file mode 100644 index b9d34c61d91..00000000000 --- a/src/mess/includes/x68k.h +++ /dev/null @@ -1,362 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald,Carl -/***************************************************************************** - * - * includes/x68k.h - * - * Sharp X68000 - * - ****************************************************************************/ - -#ifndef X68K_H_ -#define X68K_H_ - -#include "cpu/m68000/m68000.h" -#include "machine/hd63450.h" -#include "machine/rp5c15.h" -#include "machine/upd765.h" -#include "sound/okim6258.h" -#include "machine/ram.h" -#include "machine/8530scc.h" -#include "sound/2151intf.h" -#include "machine/i8255.h" - -#define MC68901_TAG "mc68901" -#define RP5C15_TAG "rp5c15" - -#define GFX16 0 -#define GFX256 1 -#define GFX65536 2 - -class x68k_state : public driver_device -{ -public: - enum - { - TIMER_X68K_LED, - TIMER_X68K_SCC_ACK, - TIMER_MD_6BUTTON_PORT1_TIMEOUT, - TIMER_MD_6BUTTON_PORT2_TIMEOUT, - TIMER_X68K_BUS_ERROR, - TIMER_X68K_NET_IRQ, - TIMER_X68K_CRTC_OPERATION_END, - TIMER_X68K_HSYNC, - TIMER_X68K_CRTC_RASTER_END, - TIMER_X68K_CRTC_RASTER_IRQ, - TIMER_X68K_CRTC_VBLANK_IRQ, - TIMER_X68K_FDC_TC, - TIMER_X68K_ADPCM - }; - - x68k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_okim6258(*this, "okim6258"), - m_hd63450(*this, "hd63450"), - m_ram(*this, RAM_TAG), - m_gfxdecode(*this, "gfxdecode"), - m_gfxpalette(*this, "gfxpalette"), - m_pcgpalette(*this, "pcgpalette"), - m_mfpdev(*this, MC68901_TAG), - m_rtc(*this, RP5C15_TAG), - m_scc(*this, "scc"), - m_ym2151(*this, "ym2151"), - m_ppi(*this, "ppi8255"), - m_screen(*this, "screen"), - m_upd72065(*this, "upd72065"), - m_options(*this, "options"), - m_mouse1(*this, "mouse1"), - m_mouse2(*this, "mouse2"), - m_mouse3(*this, "mouse3"), - m_xpd1lr(*this, "xpd1lr"), - m_ctrltype(*this, "ctrltype"), - m_joy1(*this, "joy1"), - m_joy2(*this, "joy2"), - m_md3b(*this, "md3b"), - m_md6b(*this, "md6b"), - m_md6b_extra(*this, "md6b_extra"), - m_nvram(0x4000/sizeof(UINT16)), - m_tvram(0x80000/sizeof(UINT16)), - m_gvram(0x80000/sizeof(UINT16)), - m_spritereg(0x8000/sizeof(UINT16), 0) - { } - - required_device m_maincpu; - required_device m_okim6258; - required_device m_hd63450; - required_device m_ram; - required_device m_gfxdecode; - required_device m_gfxpalette; - required_device m_pcgpalette; - required_device m_mfpdev; - required_device m_rtc; - required_device m_scc; - required_device m_ym2151; - required_device m_ppi; - required_device m_screen; - required_device m_upd72065; - - required_ioport m_options; - required_ioport m_mouse1; - required_ioport m_mouse2; - required_ioport m_mouse3; - required_ioport m_xpd1lr; - required_ioport m_ctrltype; - required_ioport m_joy1; - required_ioport m_joy2; - required_ioport m_md3b; - required_ioport m_md6b; - required_ioport m_md6b_extra; - - std::vector m_nvram; - std::vector m_tvram; - std::vector m_gvram; - std::vector m_spritereg; - - bitmap_ind16 *m_pcgbitmap; - bitmap_ind16 *m_gfxbitmap; - - void floppy_load_unload(bool load, floppy_image_device *dev); - int floppy_load(floppy_image_device *dev); - void floppy_unload(floppy_image_device *dev); - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - struct - { - int sram_writeprotect; - int monitor; - int contrast; - int keyctrl; - UINT16 cputype; - } m_sysport; - struct - { - floppy_image_device *floppy[4]; - int led_ctrl[4]; - int led_eject[4]; - int eject[4]; - int motor; - int control_drives; - int select_drive; - } m_fdc; - struct - { - int ioc7; // "Function B operation of joystick # one option" - int ioc6; // "Function A operation of joystick # one option" - int joy1_enable; // IOC4 - int joy2_enable; // IOC5 - } m_joy; - struct - { - int rate; // ADPCM sample rate - int pan; // ADPCM output switch - int clock; // ADPCM clock speed - } m_adpcm; - struct - { - unsigned short reg[24]; // registers - int operation; // operation port (0xe80481) - int vblank; // 1 if in VBlank - int hblank; // 1 if in HBlank - int htotal; // Horizontal Total (in characters) - int vtotal; // Vertical Total - int hbegin; // Horizontal Begin - int vbegin; // Vertical Begin - int hend; // Horizontal End - int vend; // Vertical End - int hsync_end; // Horizontal Sync End - int vsync_end; // Vertical Sync End - int hsyncadjust; // Horizontal Sync Adjustment - float hmultiple; // Horizontal pixel multiplier - float vmultiple; // Vertical scanline multiplier (x2 for doublescan modes) - int height; - int width; - int visible_height; - int visible_width; - int hshift; - int vshift; - int video_width; // horizontal total (in pixels) - int video_height; // vertical total - int bg_visible_height; - int bg_visible_width; - int bg_hshift; - int bg_vshift; - int bg_hvres; // bits 0,1 = H-Res, bits 2,3 = V-Res, bit 4 = L/H Freq (0=15.98kHz, 1=31.5kHz) - int bg_double; // 1 if PCG is to be doubled. - int interlace; // 1024 vertical resolution is interlaced - } m_crtc; // CRTC - struct - { // video controller at 0xe82000 - unsigned short reg[3]; - int text_pri; - int sprite_pri; - int gfx_pri; - int gfxlayer_pri[4]; // block displayed for each priority level - int tile8_dirty[1024]; - int tile16_dirty[256]; - } m_video; - struct - { - int irqstatus; - int fdcvector; - int fddvector; - int hdcvector; - int prnvector; - } m_ioc; - struct - { - int inputtype; // determines which input is to be received - int irqactive; // non-zero if IRQ is being serviced - char last_mouse_x; // previous mouse x-axis value - char last_mouse_y; // previous mouse y-axis value - int bufferempty; // non-zero if buffer is empty - } m_mouse; - struct - { - // port A - int mux1; // multiplexer value - int seq1; // part of 6-button input sequence. - emu_timer* io_timeout1; - // port B - int mux2; // multiplexer value - int seq2; // part of 6-button input sequence. - emu_timer* io_timeout2; - } m_mdctrl; - UINT8 m_ppi_port[3]; - int m_current_vector[8]; - UINT8 m_current_irq_line; - unsigned int m_scanline; - int m_led_state; - emu_timer* m_mouse_timer; - emu_timer* m_led_timer; - emu_timer* m_net_timer; - unsigned char m_scc_prev; - UINT16 m_ppi_prev; - int m_mfp_prev; - emu_timer* m_scanline_timer; - emu_timer* m_raster_irq; - emu_timer* m_vblank_irq; - emu_timer* m_fdc_tc; - emu_timer* m_adpcm_timer; - emu_timer* m_bus_error_timer; - UINT16* m_spriteram; - tilemap_t* m_bg0_8; - tilemap_t* m_bg1_8; - tilemap_t* m_bg0_16; - tilemap_t* m_bg1_16; - int m_sprite_shift; - int m_oddscanline; - bool m_is_32bit; - DECLARE_DRIVER_INIT(x68kxvi); - DECLARE_DRIVER_INIT(x68030); - DECLARE_DRIVER_INIT(x68000); - TILE_GET_INFO_MEMBER(x68k_get_bg0_tile); - TILE_GET_INFO_MEMBER(x68k_get_bg1_tile); - TILE_GET_INFO_MEMBER(x68k_get_bg0_tile_16); - TILE_GET_INFO_MEMBER(x68k_get_bg1_tile_16); - DECLARE_MACHINE_START(x68030); - DECLARE_MACHINE_RESET(x68000); - DECLARE_MACHINE_START(x68000); - DECLARE_VIDEO_START(x68000); - DECLARE_PALETTE_INIT(x68000); - UINT32 screen_update_x68000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(x68k_led_callback); - TIMER_CALLBACK_MEMBER(x68k_scc_ack); - TIMER_CALLBACK_MEMBER(md_6button_port1_timeout); - TIMER_CALLBACK_MEMBER(md_6button_port2_timeout); - TIMER_CALLBACK_MEMBER(x68k_bus_error); - TIMER_CALLBACK_MEMBER(x68k_net_irq); - TIMER_CALLBACK_MEMBER(x68k_crtc_operation_end); - TIMER_CALLBACK_MEMBER(x68k_hsync); - TIMER_CALLBACK_MEMBER(x68k_crtc_raster_end); - TIMER_CALLBACK_MEMBER(x68k_crtc_raster_irq); - TIMER_CALLBACK_MEMBER(x68k_crtc_vblank_irq); - DECLARE_READ8_MEMBER(ppi_port_a_r); - DECLARE_READ8_MEMBER(ppi_port_b_r); - DECLARE_READ8_MEMBER(ppi_port_c_r); - DECLARE_WRITE8_MEMBER(ppi_port_c_w); - DECLARE_WRITE_LINE_MEMBER(fdc_irq); - DECLARE_WRITE8_MEMBER(x68k_ct_w); - DECLARE_WRITE_LINE_MEMBER(x68k_rtc_alarm_irq); - DECLARE_WRITE8_MEMBER(x68030_adpcm_w); - DECLARE_WRITE_LINE_MEMBER(mfp_irq_callback); - DECLARE_WRITE_LINE_MEMBER(x68k_scsi_irq); - DECLARE_WRITE_LINE_MEMBER(x68k_scsi_drq); - - //dmac - void dma_irq(int channel); - DECLARE_WRITE8_MEMBER(dma_end); - DECLARE_WRITE8_MEMBER(dma_error); - - int x68k_read_mouse(); - void x68k_set_adpcm(); - UINT8 md_3button_r(int port); - void md_6button_init(); - UINT8 md_6button_r(int port); - UINT8 xpd1lr_r(int port); - - DECLARE_WRITE_LINE_MEMBER(x68k_fm_irq); - DECLARE_WRITE_LINE_MEMBER(x68k_irq2_line); - - DECLARE_WRITE16_MEMBER(x68k_scc_w); - DECLARE_WRITE16_MEMBER(x68k_fdc_w); - DECLARE_READ16_MEMBER(x68k_fdc_r); - DECLARE_WRITE16_MEMBER(x68k_ioc_w); - DECLARE_READ16_MEMBER(x68k_ioc_r); - DECLARE_WRITE16_MEMBER(x68k_sysport_w); - DECLARE_READ16_MEMBER(x68k_sysport_r); - DECLARE_WRITE16_MEMBER(x68k_ppi_w); - DECLARE_READ16_MEMBER(x68k_ppi_r); - DECLARE_WRITE16_MEMBER(x68k_sram_w); - DECLARE_READ16_MEMBER(x68k_sram_r); - DECLARE_WRITE16_MEMBER(x68k_vid_w); - DECLARE_READ16_MEMBER(x68k_vid_r); - DECLARE_READ16_MEMBER(x68k_areaset_r); - DECLARE_WRITE16_MEMBER(x68k_areaset_w); - DECLARE_WRITE16_MEMBER(x68k_enh_areaset_w); - DECLARE_READ16_MEMBER(x68k_rom0_r); - DECLARE_WRITE16_MEMBER(x68k_rom0_w); - DECLARE_READ16_MEMBER(x68k_emptyram_r); - DECLARE_WRITE16_MEMBER(x68k_emptyram_w); - DECLARE_READ16_MEMBER(x68k_exp_r); - DECLARE_WRITE16_MEMBER(x68k_exp_w); - DECLARE_READ16_MEMBER(x68k_scc_r); - - DECLARE_READ16_MEMBER(x68k_spritereg_r); - DECLARE_WRITE16_MEMBER(x68k_spritereg_w); - DECLARE_READ16_MEMBER(x68k_spriteram_r); - DECLARE_WRITE16_MEMBER(x68k_spriteram_w); - DECLARE_WRITE16_MEMBER(x68k_crtc_w); - DECLARE_READ16_MEMBER(x68k_crtc_r); - DECLARE_WRITE16_MEMBER(x68k_gvram_w); - DECLARE_READ16_MEMBER(x68k_gvram_r); - DECLARE_WRITE16_MEMBER(x68k_tvram_w); - DECLARE_READ16_MEMBER(x68k_tvram_r); - IRQ_CALLBACK_MEMBER(x68k_int_ack); - -private: - inline void x68k_plot_pixel(bitmap_rgb32 &bitmap, int x, int y, UINT32 color); - void x68k_crtc_text_copy(int src, int dest, UINT8 planes); - void x68k_crtc_refresh_mode(); - void x68k_draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle rect); - bool x68k_draw_gfx_scanline(bitmap_ind16 &bitmap, rectangle cliprect, UINT8 priority); - void x68k_draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect); - void x68k_draw_sprites(bitmap_ind16 &bitmap, int priority, rectangle cliprect); - -public: - bitmap_rgb32* x68k_get_gfx_page(int pri,int type); - attotime prescale(int val); - void mfp_trigger_irq(int irq); - void mfp_set_timer(int timer, unsigned char data); - void mfp_recv_data(int data); - DECLARE_PALETTE_DECODER(GGGGGRRRRRBBBBBI); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - void set_bus_error(UINT32 address, bool write, UINT16 mem_mask); - bool m_bus_error; -}; - - - -#endif /* X68K_H_ */ diff --git a/src/mess/includes/xerox820.h b/src/mess/includes/xerox820.h deleted file mode 100644 index 797e5689b6e..00000000000 --- a/src/mess/includes/xerox820.h +++ /dev/null @@ -1,166 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __XEROX820__ -#define __XEROX820__ - -#include "emu.h" -#include "bus/scsi/sa1403d.h" -#include "bus/rs232/rs232.h" -#include "cpu/z80/z80.h" -#include "cpu/z80/z80daisy.h" -#include "cpu/i86/i86.h" -#include "machine/com8116.h" -#include "machine/ram.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsihd.h" -#include "machine/wd_fdc.h" -#include "machine/x820kb.h" -#include "machine/z80pio.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "sound/speaker.h" -#include "sound/beep.h" - -#define SCREEN_TAG "screen" - -#define Z80_TAG "u46" -#define Z80PIO_KB_TAG "u105" -#define Z80PIO_GP_TAG "u101" -#define Z80PIO_RD_TAG "u8" -#define Z80SIO_TAG "u96" -#define Z80CTC_TAG "u99" -#define FD1771_TAG "u109" -#define FD1797_TAG "u109" -#define COM8116_TAG "u76" -#define I8086_TAG "i8086" -#define SASIBUS_TAG "sasi" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" -#define KEYBOARD_TAG "kb" - -#define XEROX820_VIDEORAM_SIZE 0x1000 -#define XEROX820_VIDEORAM_MASK 0x0fff - -class xerox820_state : public driver_device -{ -public: - xerox820_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_kbpio(*this, Z80PIO_KB_TAG), - m_ctc(*this, Z80CTC_TAG), - m_sio(*this, Z80SIO_TAG), - m_fdc(*this, FD1771_TAG), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette"), - m_floppy0(*this, FD1771_TAG":0"), - m_floppy1(*this, FD1771_TAG":1"), - m_kb(*this, KEYBOARD_TAG), - m_rom(*this, Z80_TAG), - m_char_rom(*this, "chargen"), - m_video_ram(*this, "video_ram"), - m_fdc_irq(0), - m_fdc_drq(0), - m_8n5(0), - m_400_460(0) - { } - - virtual void machine_start(); - virtual void machine_reset(); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - required_device m_maincpu; - required_device m_kbpio; - required_device m_ctc; - required_device m_sio; - required_device m_fdc; - required_device m_ram; - required_device m_palette; - required_device m_floppy0; - required_device m_floppy1; - required_device m_kb; - required_memory_region m_rom; - required_memory_region m_char_rom; - required_shared_ptr m_video_ram; - - DECLARE_READ8_MEMBER( fdc_r ); - DECLARE_WRITE8_MEMBER( fdc_w ); - DECLARE_WRITE8_MEMBER( scroll_w ); - //DECLARE_WRITE8_MEMBER( x120_system_w ); - DECLARE_READ8_MEMBER( kbpio_pa_r ); - DECLARE_WRITE8_MEMBER( kbpio_pa_w ); - DECLARE_READ8_MEMBER( kbpio_pb_r ); - DECLARE_WRITE_LINE_MEMBER( intrq_w ); - DECLARE_WRITE_LINE_MEMBER( drq_w ); - DECLARE_WRITE_LINE_MEMBER( fr_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); - DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - - virtual void bankswitch(int bank); - void update_nmi(); - - /* video state */ - UINT8 m_scroll; /* vertical scroll */ - UINT8 m_framecnt; - int m_ncset2; /* national character set */ - int m_vatt; /* X120 video attribute */ - int m_lowlite; /* low light attribute */ - int m_chrom; /* character ROM index */ - - /* floppy state */ - bool m_fdc_irq; /* interrupt request */ - bool m_fdc_drq; /* data request */ - int m_8n5; /* 5.25" / 8" drive select */ - int m_400_460; /* double sided disk detect */ - - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); -}; - -class bigboard_state : public xerox820_state -{ -public: - bigboard_state(const machine_config &mconfig, device_type type, const char *tag) - : xerox820_state(mconfig, type, tag), - m_beeper(*this, "beeper") - { } - - required_device m_beeper; - - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( kbpio_pa_w ); - - bool m_bit5; - - TIMER_CALLBACK_MEMBER(bigboard_beepoff); -}; - -class xerox820ii_state : public xerox820_state -{ -public: - xerox820ii_state(const machine_config &mconfig, device_type type, const char *tag) : - xerox820_state(mconfig, type, tag), - m_speaker(*this, "speaker"), - m_sasibus(*this, SASIBUS_TAG) - { - } - - required_device m_speaker; - required_device m_sasibus; - - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( bell_w ); - DECLARE_WRITE8_MEMBER( slden_w ); - DECLARE_WRITE8_MEMBER( chrom_w ); - DECLARE_WRITE8_MEMBER( lowlite_w ); - DECLARE_WRITE8_MEMBER( sync_w ); - - DECLARE_WRITE8_MEMBER( rdpio_pb_w ); - DECLARE_WRITE_LINE_MEMBER( rdpio_pardy_w ); - - void bankswitch(int bank); -}; - -#endif diff --git a/src/mess/includes/xor100.h b/src/mess/includes/xor100.h deleted file mode 100644 index 63a63a21ea3..00000000000 --- a/src/mess/includes/xor100.h +++ /dev/null @@ -1,107 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __XOR100__ -#define __XOR100__ - -#include "emu.h" -#include "bus/s100/s100.h" -#include "cpu/z80/z80.h" -#include "machine/ram.h" -#include "machine/com8116.h" -#include "bus/centronics/ctronics.h" -#include "machine/i8255.h" -#include "machine/i8251.h" -#include "machine/wd_fdc.h" -#include "machine/z80ctc.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "5b" -#define I8251_A_TAG "12b" -#define I8251_B_TAG "14b" -#define I8255A_TAG "8a" -#define COM5016_TAG "15c" -#define Z80CTC_TAG "11b" -#define WD1795_TAG "wd1795" -#define CENTRONICS_TAG "centronics" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" - -class xor100_state : public driver_device -{ -public: - xor100_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_dbrg(*this, COM5016_TAG), - m_uart_a(*this, I8251_A_TAG), - m_uart_b(*this, I8251_B_TAG), - m_fdc(*this, WD1795_TAG), - m_ctc(*this, Z80CTC_TAG), - m_ram(*this, RAM_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_s100(*this, S100_TAG), - m_floppy0(*this, WD1795_TAG":0"), - m_floppy1(*this, WD1795_TAG":1"), - m_floppy2(*this, WD1795_TAG":2"), - m_floppy3(*this, WD1795_TAG":3"), - m_rom(*this, Z80_TAG) - { } - - required_device m_maincpu; - required_device m_dbrg; - required_device m_uart_a; - required_device m_uart_b; - required_device m_fdc; - required_device m_ctc; - required_device m_ram; - required_device m_centronics; - required_device m_s100; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; - required_memory_region m_rom; - - virtual void machine_start(); - virtual void machine_reset(); - - DECLARE_WRITE8_MEMBER( mmu_w ); - DECLARE_WRITE8_MEMBER( prom_toggle_w ); - DECLARE_READ8_MEMBER( prom_disable_r ); - DECLARE_WRITE8_MEMBER( baud_w ); - DECLARE_READ8_MEMBER( fdc_r ); - DECLARE_WRITE8_MEMBER( fdc_w ); - DECLARE_READ8_MEMBER( fdc_wait_r ); - DECLARE_WRITE8_MEMBER( fdc_dcont_w ); - DECLARE_WRITE8_MEMBER( fdc_dsel_w ); - void fdc_intrq_w(bool state); - void fdc_drq_w(bool state); - - void bankswitch(); - void post_load(); - - // memory state - int m_mode; - int m_bank; - - // floppy state - bool m_fdc_irq; - bool m_fdc_drq; - int m_fdc_dden; - DECLARE_WRITE_LINE_MEMBER(com5016_fr_w); - DECLARE_WRITE_LINE_MEMBER(com5016_ft_w); - DECLARE_READ8_MEMBER(i8255_pc_r); - DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); - DECLARE_WRITE8_MEMBER(xor100_kbd_put); - - int m_centronics_busy; - int m_centronics_select; - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - DECLARE_WRITE_LINE_MEMBER(write_centronics_select); -}; - -#endif diff --git a/src/mess/includes/z80ne.h b/src/mess/includes/z80ne.h deleted file mode 100644 index b6d77971981..00000000000 --- a/src/mess/includes/z80ne.h +++ /dev/null @@ -1,192 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Roberto Lavarone -/***************************************************************************** - * - * includes/z80ne.h - * - * Nuova Elettronica Z80NE - * - * http://www.z80ne.com/ - * - ****************************************************************************/ - -#ifndef Z80NE_H_ -#define Z80NE_H_ - -#include "video/mc6847.h" -#include "imagedev/cassette.h" -#include "machine/ay31015.h" -#include "machine/kr2376.h" -#include "machine/wd_fdc.h" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define Z80NE_CPU_SPEED_HZ 1920000 /* 1.92 MHz */ - -#define LX383_KEYS 16 -#define LX383_DOWNSAMPLING 16 - -#define LX385_TAPE_SAMPLE_FREQ 38400 - -/* wave duration threshold */ -enum z80netape_speed -{ - TAPE_300BPS = 300, /* 300 bps */ - TAPE_600BPS = 600, /* 600 bps */ - TAPE_1200BPS = 1200 /* 1200 bps */ -}; - -struct z80ne_cass_data_t { - struct { - int length; /* time cassette level is at input.level */ - int level; /* cassette level */ - int bit; /* bit being read */ - } input; - struct { - int length; /* time cassette level is at output.level */ - int level; /* cassette level */ - int bit; /* bit to output */ - } output; - z80netape_speed speed; /* 300 - 600 - 1200 */ - int wave_filter; - int wave_length; - int wave_short; - int wave_long; -}; - -struct wd17xx_state_t { - int drq; - int intrq; - UINT8 drive; /* current drive */ - UINT8 head; /* current head */ -}; - - -class z80ne_state : public driver_device -{ -public: - z80ne_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_vdg(*this, "mc6847"), - m_videoram(*this, "videoram"), - m_ay31015(*this, "ay_3_1015"), - m_lx388_kr2376(*this, "lx388_kr2376"), - m_maincpu(*this, "z80ne"), - m_floppy0(*this, "wd1771:0"), - m_floppy1(*this, "wd1771:1"), - m_floppy2(*this, "wd1771:2"), - m_floppy3(*this, "wd1771:3"), - m_cassette1(*this, "cassette"), - m_cassette2(*this, "cassette2"), - m_wd1771(*this, "wd1771"), - m_region_z80ne(*this, "z80ne"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), - m_io_row0(*this, "ROW0"), - m_io_row1(*this, "ROW1"), - m_io_ctrl(*this, "CTRL"), - m_io_rst(*this, "RST"), - m_io_lx_385(*this, "LX.385"), - m_io_lx388_brk(*this, "LX388_BRK"), - m_io_x0(*this, "X0"), - m_io_x1(*this, "X1"), - m_io_x2(*this, "X2"), - m_io_x3(*this, "X3"), - m_io_x4(*this, "X4"), - m_io_x5(*this, "X5"), - m_io_x6(*this, "X6"), - m_io_x7(*this, "X7"), - m_io_modifiers(*this, "MODIFIERS"), - m_io_config(*this, "CONFIG") { } - - DECLARE_FLOPPY_FORMATS(floppy_formats); - - optional_device m_vdg; - optional_shared_ptr m_videoram; - required_device m_ay31015; - optional_device m_lx388_kr2376; - UINT8 m_lx383_scan_counter; - UINT8 m_lx383_key[LX383_KEYS]; - int m_lx383_downsampler; - int m_nmi_delay_counter; - int m_reset_delay_counter; - UINT8 m_lx385_ctrl; - emu_timer *m_cassette_timer; - z80ne_cass_data_t m_cass_data; - wd17xx_state_t m_wd17xx_state; - DECLARE_READ8_MEMBER(lx383_r); - DECLARE_WRITE8_MEMBER(lx383_w); - DECLARE_READ8_MEMBER(lx385_data_r); - DECLARE_READ8_MEMBER(lx385_ctrl_r); - DECLARE_WRITE8_MEMBER(lx385_data_w); - DECLARE_WRITE8_MEMBER(lx385_ctrl_w); - DECLARE_READ8_MEMBER(lx388_data_r); - DECLARE_READ8_MEMBER(lx388_read_field_sync); - DECLARE_DIRECT_UPDATE_MEMBER(z80ne_default); - DECLARE_DIRECT_UPDATE_MEMBER(z80ne_nmi_delay_count); - DECLARE_DIRECT_UPDATE_MEMBER(z80ne_reset_delay_count); - DECLARE_DRIVER_INIT(z80netf); - DECLARE_DRIVER_INIT(z80net); - DECLARE_DRIVER_INIT(z80netb); - DECLARE_DRIVER_INIT(z80ne); - DECLARE_MACHINE_START(z80ne); - DECLARE_MACHINE_RESET(z80ne); - DECLARE_MACHINE_START(z80netb); - DECLARE_MACHINE_RESET(z80netb); - DECLARE_MACHINE_START(z80netf); - DECLARE_MACHINE_RESET(z80netf); - DECLARE_MACHINE_START(z80net); - DECLARE_MACHINE_RESET(z80net); - DECLARE_MACHINE_RESET(z80ne_base); - DECLARE_INPUT_CHANGED_MEMBER(z80ne_reset); - DECLARE_INPUT_CHANGED_MEMBER(z80ne_nmi); - TIMER_CALLBACK_MEMBER(z80ne_cassette_tc); - TIMER_CALLBACK_MEMBER(z80ne_kbd_scan); - DECLARE_READ8_MEMBER(lx388_mc6847_videoram_r); - DECLARE_WRITE8_MEMBER(lx390_motor_w); - DECLARE_READ8_MEMBER(lx390_reset_bank); - DECLARE_READ8_MEMBER(lx390_fdc_r); - DECLARE_WRITE8_MEMBER(lx390_fdc_w); - -protected: - required_device m_maincpu; - optional_device m_floppy0; - optional_device m_floppy1; - optional_device m_floppy2; - optional_device m_floppy3; - required_device m_cassette1; - required_device m_cassette2; - optional_device m_wd1771; - required_memory_region m_region_z80ne; - optional_memory_bank m_bank1; - optional_memory_bank m_bank2; - optional_memory_bank m_bank3; - optional_memory_bank m_bank4; - required_ioport m_io_row0; - required_ioport m_io_row1; - required_ioport m_io_ctrl; - required_ioport m_io_rst; - required_ioport m_io_lx_385; - optional_ioport m_io_lx388_brk; - optional_ioport m_io_x0; - optional_ioport m_io_x1; - optional_ioport m_io_x2; - optional_ioport m_io_x3; - optional_ioport m_io_x4; - optional_ioport m_io_x5; - optional_ioport m_io_x6; - optional_ioport m_io_x7; - optional_ioport m_io_modifiers; - optional_ioport m_io_config; - - cassette_image_device *cassette_device_image(); - void reset_lx388(); - void reset_lx382_banking(); - void reset_lx390_banking(); -}; - -#endif /* Z80NE_H_ */ diff --git a/src/mess/includes/z88.h b/src/mess/includes/z88.h deleted file mode 100644 index 99a26354f5a..00000000000 --- a/src/mess/includes/z88.h +++ /dev/null @@ -1,95 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/***************************************************************************** - * - * includes/z88.h - * - ****************************************************************************/ - -#ifndef Z88_H_ -#define Z88_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/upd65031.h" -#include "machine/ram.h" -#include "bus/z88/z88.h" -#include "bus/z88/flash.h" -#include "bus/z88/ram.h" -#include "bus/z88/rom.h" -#include "sound/speaker.h" -#include "rendlay.h" - -#define Z88_NUM_COLOURS 3 - -#define Z88_SCREEN_WIDTH 640 -#define Z88_SCREEN_HEIGHT 64 - -#define Z88_SCR_HW_REV (1<<4) -#define Z88_SCR_HW_HRS (1<<5) -#define Z88_SCR_HW_UND (1<<1) -#define Z88_SCR_HW_FLS (1<<3) -#define Z88_SCR_HW_GRY (1<<2) -#define Z88_SCR_HW_CURS (Z88_SCR_HW_HRS|Z88_SCR_HW_FLS|Z88_SCR_HW_REV) -#define Z88_SCR_HW_NULL (Z88_SCR_HW_HRS|Z88_SCR_HW_GRY|Z88_SCR_HW_REV) - -enum -{ - Z88_BANK_ROM = 1, - Z88_BANK_RAM, - Z88_BANK_CART, - Z88_BANK_UNMAP -}; - - -class z88_state : public driver_device -{ -public: - z88_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") - { } - - required_device m_maincpu; - required_device m_ram; - required_device m_palette; - - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_READ8_MEMBER(kb_r); - UPD65031_MEMORY_UPDATE(bankswitch_update); - UPD65031_SCREEN_UPDATE(lcd_update); - - // cartridges read/write - DECLARE_READ8_MEMBER(bank0_cart_r); - DECLARE_READ8_MEMBER(bank1_cart_r); - DECLARE_READ8_MEMBER(bank2_cart_r); - DECLARE_READ8_MEMBER(bank3_cart_r); - DECLARE_WRITE8_MEMBER(bank0_cart_w); - DECLARE_WRITE8_MEMBER(bank1_cart_w); - DECLARE_WRITE8_MEMBER(bank2_cart_w); - DECLARE_WRITE8_MEMBER(bank3_cart_w); - - // defined in video/z88.c - inline void plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT16 color); - inline UINT8* convert_address(UINT32 offset); - void vh_render_8x8(bitmap_ind16 &bitmap, int x, int y, UINT16 pen0, UINT16 pen1, UINT8 *gfx); - void vh_render_6x8(bitmap_ind16 &bitmap, int x, int y, UINT16 pen0, UINT16 pen1, UINT8 *gfx); - void vh_render_line(bitmap_ind16 &bitmap, int x, int y, UINT16 pen); - - struct - { - UINT8 slot; - UINT8 page; - } m_bank[4]; - - int m_bank_type[4]; - UINT8 * m_bios; - UINT8 * m_ram_base; - z88cart_slot_device * m_carts[4]; - DECLARE_PALETTE_INIT(z88); -}; - -#endif /* Z88_H_ */ diff --git a/src/mess/includes/zapcomputer.h b/src/mess/includes/zapcomputer.h deleted file mode 100644 index e86ae010da3..00000000000 --- a/src/mess/includes/zapcomputer.h +++ /dev/null @@ -1,30 +0,0 @@ -// license:GPL2+ -// copyright-holders:FelipeSanches -/***************************************************************************** - * - * includes/zapcomputer.h - * - ****************************************************************************/ - -#ifndef __ZAPCOMPUTER__ -#define __ZAPCOMPUTER__ - -#include "emu.h" -#include "cpu/z80/z80.h" - -class zapcomp_state : public driver_device -{ -public: - zapcomp_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { } - - required_device m_maincpu; - DECLARE_READ8_MEMBER(keyboard_r); - DECLARE_WRITE8_MEMBER(display_7seg_w); - - virtual void machine_start(); -}; - -#endif // __ZAPCOMPUTER__ diff --git a/src/mess/includes/zx.h b/src/mess/includes/zx.h deleted file mode 100644 index c6165fd30d3..00000000000 --- a/src/mess/includes/zx.h +++ /dev/null @@ -1,112 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Krzysztof Strzecha, Robbbert -/***************************************************************************** - * - * includes/zx.h - * - ****************************************************************************/ - -#ifndef ZX_H_ -#define ZX_H_ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/speaker.h" -#include "sound/wave.h" -#include "imagedev/cassette.h" -#include "formats/zx81_p.h" -#include "machine/ram.h" - - -class zx_state : public driver_device -{ -public: - enum - { - TIMER_TAPE_PULSE, - TIMER_ULA_NMI, - TIMER_ULA_IRQ - }; - - zx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG), - m_cassette(*this, "cassette"), - m_speaker(*this, "speaker"), - m_region_maincpu(*this, "maincpu"), - m_region_gfx1(*this, "gfx1"), - m_io_row0(*this, "ROW0"), - m_io_row1(*this, "ROW1"), - m_io_row2(*this, "ROW2"), - m_io_row3(*this, "ROW3"), - m_io_row4(*this, "ROW4"), - m_io_row5(*this, "ROW5"), - m_io_row6(*this, "ROW6"), - m_io_row7(*this, "ROW7"), - m_io_config(*this, "CONFIG"), - m_screen(*this, "screen") { } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - bitmap_ind16 m_bitmap; - - DECLARE_READ8_MEMBER(zx_ram_r); - DECLARE_READ8_MEMBER(zx80_io_r); - DECLARE_READ8_MEMBER(zx81_io_r); - DECLARE_READ8_MEMBER(pc8300_io_r); - DECLARE_READ8_MEMBER(pow3000_io_r); - DECLARE_WRITE8_MEMBER(zx80_io_w); - DECLARE_WRITE8_MEMBER(zx81_io_w); - emu_timer *m_ula_nmi; - int m_ula_irq_active; - int m_ula_frame_vsync; - int m_ula_scanline_count; - UINT8 m_tape_bit; - UINT8 m_speaker_state; - int m_old_x; - int m_old_y; - UINT8 m_old_c; - UINT8 m_charline[32]; - UINT8 m_charline_ptr; - int m_offs1; - void zx_ula_bkgnd(UINT8 color); - DECLARE_WRITE8_MEMBER(zx_ram_w); - DECLARE_DIRECT_UPDATE_MEMBER(zx_setdirect); - DECLARE_DIRECT_UPDATE_MEMBER(pc8300_setdirect); - DECLARE_DIRECT_UPDATE_MEMBER(pow3000_setdirect); - DECLARE_DRIVER_INIT(zx); - virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(zx); - DECLARE_PALETTE_INIT(ts1000); - DECLARE_MACHINE_RESET(pc8300); - DECLARE_MACHINE_RESET(pow3000); - void screen_eof_zx(screen_device &screen, bool state); - TIMER_CALLBACK_MEMBER(zx_tape_pulse); - TIMER_CALLBACK_MEMBER(zx_ula_nmi); - TIMER_CALLBACK_MEMBER(zx_ula_irq); - -protected: - required_device m_maincpu; - required_device m_ram; - required_device m_cassette; - required_device m_speaker; - required_memory_region m_region_maincpu; - optional_memory_region m_region_gfx1; - required_ioport m_io_row0; - required_ioport m_io_row1; - required_ioport m_io_row2; - required_ioport m_io_row3; - required_ioport m_io_row4; - required_ioport m_io_row5; - required_ioport m_io_row6; - required_ioport m_io_row7; - optional_ioport m_io_config; - required_device m_screen; - - void zx_ula_r(int offs, memory_region *region, const UINT8 param); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -}; - -#endif /* ZX_H_ */ diff --git a/src/mess/layout/4004clk.lay b/src/mess/layout/4004clk.lay deleted file mode 100644 index e3ec9522743..00000000000 --- a/src/mess/layout/4004clk.lay +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/abc1600.lay b/src/mess/layout/abc1600.lay deleted file mode 100644 index 36ece9eb926..00000000000 --- a/src/mess/layout/abc1600.lay +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/mess/layout/acrnsys1.lay b/src/mess/layout/acrnsys1.lay deleted file mode 100644 index 84afbd9321e..00000000000 --- a/src/mess/layout/acrnsys1.lay +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/aim65.lay b/src/mess/layout/aim65.lay deleted file mode 100644 index b250dc48b35..00000000000 --- a/src/mess/layout/aim65.lay +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/aim65_40.lay b/src/mess/layout/aim65_40.lay deleted file mode 100644 index 1d9aa5b0421..00000000000 --- a/src/mess/layout/aim65_40.lay +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/amaztron.lay b/src/mess/layout/amaztron.lay deleted file mode 100644 index 8b31f239489..00000000000 --- a/src/mess/layout/amaztron.lay +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/amico2k.lay b/src/mess/layout/amico2k.lay deleted file mode 100644 index 7151895247f..00000000000 --- a/src/mess/layout/amico2k.lay +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/amiga.lay b/src/mess/layout/amiga.lay deleted file mode 100644 index 44428fa3392..00000000000 --- a/src/mess/layout/amiga.lay +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/apollo.lay b/src/mess/layout/apollo.lay deleted file mode 100644 index 06c90f31baf..00000000000 --- a/src/mess/layout/apollo.lay +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/apollo_15i.lay b/src/mess/layout/apollo_15i.lay deleted file mode 100644 index f42e8329954..00000000000 --- a/src/mess/layout/apollo_15i.lay +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/apollo_dsp.lay b/src/mess/layout/apollo_dsp.lay deleted file mode 100644 index 2ee7b0fced1..00000000000 --- a/src/mess/layout/apollo_dsp.lay +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/apricotp.lay b/src/mess/layout/apricotp.lay deleted file mode 100644 index 95af108219e..00000000000 --- a/src/mess/layout/apricotp.lay +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/astro.lay b/src/mess/layout/astro.lay deleted file mode 100644 index 978e522d543..00000000000 --- a/src/mess/layout/astro.lay +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/avigo.lay b/src/mess/layout/avigo.lay deleted file mode 100644 index 6db8cfcfd27..00000000000 --- a/src/mess/layout/avigo.lay +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/babbage.lay b/src/mess/layout/babbage.lay deleted file mode 100644 index b493268fd4a..00000000000 --- a/src/mess/layout/babbage.lay +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/bankshot.lay b/src/mess/layout/bankshot.lay deleted file mode 100644 index 8ddcf5c085b..00000000000 --- a/src/mess/layout/bankshot.lay +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/bbc.lay b/src/mess/layout/bbc.lay deleted file mode 100644 index 0d1e4479146..00000000000 --- a/src/mess/layout/bbc.lay +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/beta.lay b/src/mess/layout/beta.lay deleted file mode 100644 index dc9af5cfbf8..00000000000 --- a/src/mess/layout/beta.lay +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/bigtrak.lay b/src/mess/layout/bigtrak.lay deleted file mode 100644 index c74d1d04e82..00000000000 --- a/src/mess/layout/bigtrak.lay +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/bitgrpha.lay b/src/mess/layout/bitgrpha.lay deleted file mode 100644 index fa3235d9489..00000000000 --- a/src/mess/layout/bitgrpha.lay +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/mess/layout/bitgrphb.lay b/src/mess/layout/bitgrphb.lay deleted file mode 100644 index 8def87c47da..00000000000 --- a/src/mess/layout/bitgrphb.lay +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/mess/layout/bob85.lay b/src/mess/layout/bob85.lay deleted file mode 100644 index 28e8392eec5..00000000000 --- a/src/mess/layout/bob85.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/borisdpl.lay b/src/mess/layout/borisdpl.lay deleted file mode 100644 index 2ca7ceae315..00000000000 --- a/src/mess/layout/borisdpl.lay +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/bridgec3.lay b/src/mess/layout/bridgec3.lay deleted file mode 100644 index 3fbbe99deb3..00000000000 --- a/src/mess/layout/bridgec3.lay +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/c80.lay b/src/mess/layout/c80.lay deleted file mode 100644 index d12f973dfe1..00000000000 --- a/src/mess/layout/c80.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/cc40.lay b/src/mess/layout/cc40.lay deleted file mode 100644 index ea366ddc0c1..00000000000 --- a/src/mess/layout/cc40.lay +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/chessmst.lay b/src/mess/layout/chessmst.lay deleted file mode 100644 index 40a623faf32..00000000000 --- a/src/mess/layout/chessmst.lay +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/chesstrv.lay b/src/mess/layout/chesstrv.lay deleted file mode 100644 index 34e9509d990..00000000000 --- a/src/mess/layout/chesstrv.lay +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/cnsector.lay b/src/mess/layout/cnsector.lay deleted file mode 100644 index 5bd9aaa0d48..00000000000 --- a/src/mess/layout/cnsector.lay +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/coco3.lay b/src/mess/layout/coco3.lay deleted file mode 100644 index bebd45729eb..00000000000 --- a/src/mess/layout/coco3.lay +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/mess/layout/comp4.lay b/src/mess/layout/comp4.lay deleted file mode 100644 index 5cca5e96dd9..00000000000 --- a/src/mess/layout/comp4.lay +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/cosmicos.lay b/src/mess/layout/cosmicos.lay deleted file mode 100644 index 68bb3a05370..00000000000 --- a/src/mess/layout/cosmicos.lay +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/cp1.lay b/src/mess/layout/cp1.lay deleted file mode 100644 index b5dbfbc1789..00000000000 --- a/src/mess/layout/cp1.lay +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/cvicny.lay b/src/mess/layout/cvicny.lay deleted file mode 100644 index 9e41a6d4300..00000000000 --- a/src/mess/layout/cvicny.lay +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/dataman.lay b/src/mess/layout/dataman.lay deleted file mode 100644 index fcfae353f4c..00000000000 --- a/src/mess/layout/dataman.lay +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/digel804.lay b/src/mess/layout/digel804.lay deleted file mode 100644 index 5e4f498b46a..00000000000 --- a/src/mess/layout/digel804.lay +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/dmv.lay b/src/mess/layout/dmv.lay deleted file mode 100644 index 4d5753fcb8b..00000000000 --- a/src/mess/layout/dmv.lay +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/dolphunk.lay b/src/mess/layout/dolphunk.lay deleted file mode 100644 index aebc190f91c..00000000000 --- a/src/mess/layout/dolphunk.lay +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/eacc.lay b/src/mess/layout/eacc.lay deleted file mode 100644 index b65f22a056a..00000000000 --- a/src/mess/layout/eacc.lay +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ebaskb2.lay b/src/mess/layout/ebaskb2.lay deleted file mode 100644 index 5a0a3d376f7..00000000000 --- a/src/mess/layout/ebaskb2.lay +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ebball.lay b/src/mess/layout/ebball.lay deleted file mode 100644 index 48bcb51853b..00000000000 --- a/src/mess/layout/ebball.lay +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ebball2.lay b/src/mess/layout/ebball2.lay deleted file mode 100644 index 91d3427f5e3..00000000000 --- a/src/mess/layout/ebball2.lay +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ebball3.lay b/src/mess/layout/ebball3.lay deleted file mode 100644 index 3e6a5df9031..00000000000 --- a/src/mess/layout/ebball3.lay +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/efball.lay b/src/mess/layout/efball.lay deleted file mode 100644 index f46120fae29..00000000000 --- a/src/mess/layout/efball.lay +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/efootb4.lay b/src/mess/layout/efootb4.lay deleted file mode 100644 index 71266b11448..00000000000 --- a/src/mess/layout/efootb4.lay +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/einvader.lay b/src/mess/layout/einvader.lay deleted file mode 100644 index 81021899dbf..00000000000 --- a/src/mess/layout/einvader.lay +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/einvaderc.lay b/src/mess/layout/einvaderc.lay deleted file mode 100644 index 0916b783796..00000000000 --- a/src/mess/layout/einvaderc.lay +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/elecbowl.lay b/src/mess/layout/elecbowl.lay deleted file mode 100644 index 1aab1670364..00000000000 --- a/src/mess/layout/elecbowl.lay +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/elecdet.lay b/src/mess/layout/elecdet.lay deleted file mode 100644 index 3024763cbcf..00000000000 --- a/src/mess/layout/elecdet.lay +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/elekscmp.lay b/src/mess/layout/elekscmp.lay deleted file mode 100644 index edea5e4c461..00000000000 --- a/src/mess/layout/elekscmp.lay +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/elf2.lay b/src/mess/layout/elf2.lay deleted file mode 100644 index 935ea70cd4b..00000000000 --- a/src/mess/layout/elf2.lay +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/esq1by22.lay b/src/mess/layout/esq1by22.lay deleted file mode 100644 index 8667054f8eb..00000000000 --- a/src/mess/layout/esq1by22.lay +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/esq2by40.lay b/src/mess/layout/esq2by40.lay deleted file mode 100644 index 26bba421d9f..00000000000 --- a/src/mess/layout/esq2by40.lay +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/et3400.lay b/src/mess/layout/et3400.lay deleted file mode 100644 index aef0cbeedc0..00000000000 --- a/src/mess/layout/et3400.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/fb01.lay b/src/mess/layout/fb01.lay deleted file mode 100644 index f88d5f6de8b..00000000000 --- a/src/mess/layout/fb01.lay +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/fccpu1.lay b/src/mess/layout/fccpu1.lay deleted file mode 100644 index 0655960a266..00000000000 --- a/src/mess/layout/fccpu1.lay +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/fidelz80.lay b/src/mess/layout/fidelz80.lay deleted file mode 100644 index c9e2907e5bc..00000000000 --- a/src/mess/layout/fidelz80.lay +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/funjacks.lay b/src/mess/layout/funjacks.lay deleted file mode 100644 index 924c03af199..00000000000 --- a/src/mess/layout/funjacks.lay +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/funrlgl.lay b/src/mess/layout/funrlgl.lay deleted file mode 100644 index 7af9fb61ce8..00000000000 --- a/src/mess/layout/funrlgl.lay +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/gamecom.lay b/src/mess/layout/gamecom.lay deleted file mode 100644 index 6cb50665d75..00000000000 --- a/src/mess/layout/gamecom.lay +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/gjackpot.lay b/src/mess/layout/gjackpot.lay deleted file mode 100644 index 84d57fc9745..00000000000 --- a/src/mess/layout/gjackpot.lay +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/gl3000s.lay b/src/mess/layout/gl3000s.lay deleted file mode 100644 index e97b1544f03..00000000000 --- a/src/mess/layout/gl3000s.lay +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/glasgow.lay b/src/mess/layout/glasgow.lay deleted file mode 100644 index 53dd35a623c..00000000000 --- a/src/mess/layout/glasgow.lay +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/gpoker.lay b/src/mess/layout/gpoker.lay deleted file mode 100644 index 25578e687f2..00000000000 --- a/src/mess/layout/gpoker.lay +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/h2hbaseb.lay b/src/mess/layout/h2hbaseb.lay deleted file mode 100644 index ed35017c1b9..00000000000 --- a/src/mess/layout/h2hbaseb.lay +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/h2hfootb.lay b/src/mess/layout/h2hfootb.lay deleted file mode 100644 index 1bf59a074c9..00000000000 --- a/src/mess/layout/h2hfootb.lay +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/h8.lay b/src/mess/layout/h8.lay deleted file mode 100644 index deb28c7690b..00000000000 --- a/src/mess/layout/h8.lay +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/hh_hmcs40_test.lay b/src/mess/layout/hh_hmcs40_test.lay deleted file mode 100644 index 0a7960cee0e..00000000000 --- a/src/mess/layout/hh_hmcs40_test.lay +++ /dev/null @@ -1,684 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/hh_melps4_test.lay b/src/mess/layout/hh_melps4_test.lay deleted file mode 100644 index 8471c1c4989..00000000000 --- a/src/mess/layout/hh_melps4_test.lay +++ /dev/null @@ -1,556 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/hh_sm510_test.lay b/src/mess/layout/hh_sm510_test.lay deleted file mode 100644 index f960f795acc..00000000000 --- a/src/mess/layout/hh_sm510_test.lay +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/hh_tms1k_test.lay b/src/mess/layout/hh_tms1k_test.lay deleted file mode 100644 index 691c91e1aa1..00000000000 --- a/src/mess/layout/hh_tms1k_test.lay +++ /dev/null @@ -1,556 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/hh_ucom4_test.lay b/src/mess/layout/hh_ucom4_test.lay deleted file mode 100644 index 597af18b4e0..00000000000 --- a/src/mess/layout/hh_ucom4_test.lay +++ /dev/null @@ -1,556 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ie15.lay b/src/mess/layout/ie15.lay deleted file mode 100644 index bbb21cbed10..00000000000 --- a/src/mess/layout/ie15.lay +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/instruct.lay b/src/mess/layout/instruct.lay deleted file mode 100644 index 302697dec84..00000000000 --- a/src/mess/layout/instruct.lay +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/junior.lay b/src/mess/layout/junior.lay deleted file mode 100644 index 65cbe26b5ff..00000000000 --- a/src/mess/layout/junior.lay +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/k1003.lay b/src/mess/layout/k1003.lay deleted file mode 100644 index ea96db032d8..00000000000 --- a/src/mess/layout/k1003.lay +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/kim1.lay b/src/mess/layout/kim1.lay deleted file mode 100644 index 65cbe26b5ff..00000000000 --- a/src/mess/layout/kim1.lay +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/lantutor.lay b/src/mess/layout/lantutor.lay deleted file mode 100644 index bfdf2189350..00000000000 --- a/src/mess/layout/lantutor.lay +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/lc80.lay b/src/mess/layout/lc80.lay deleted file mode 100644 index bd07614e28d..00000000000 --- a/src/mess/layout/lc80.lay +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/lightfgt.lay b/src/mess/layout/lightfgt.lay deleted file mode 100644 index 96a327b176e..00000000000 --- a/src/mess/layout/lightfgt.lay +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/llc1.lay b/src/mess/layout/llc1.lay deleted file mode 100644 index 3bd3a42669b..00000000000 --- a/src/mess/layout/llc1.lay +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/lynx.lay b/src/mess/layout/lynx.lay deleted file mode 100644 index b5e76dc6ec2..00000000000 --- a/src/mess/layout/lynx.lay +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mac.lay b/src/mess/layout/mac.lay deleted file mode 100644 index cbefc6620ee..00000000000 --- a/src/mess/layout/mac.lay +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/mess/layout/maniac.lay b/src/mess/layout/maniac.lay deleted file mode 100644 index a0376cfca75..00000000000 --- a/src/mess/layout/maniac.lay +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mathmagi.lay b/src/mess/layout/mathmagi.lay deleted file mode 100644 index eb4e745c77b..00000000000 --- a/src/mess/layout/mathmagi.lay +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mbdtower.lay b/src/mess/layout/mbdtower.lay deleted file mode 100644 index 7dc9b1b61e7..00000000000 --- a/src/mess/layout/mbdtower.lay +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/megacd.lay b/src/mess/layout/megacd.lay deleted file mode 100644 index 5a787335b34..00000000000 --- a/src/mess/layout/megacd.lay +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/mekd2.lay b/src/mess/layout/mekd2.lay deleted file mode 100644 index 2806b919e7b..00000000000 --- a/src/mess/layout/mekd2.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mephisto.lay b/src/mess/layout/mephisto.lay deleted file mode 100644 index ec5cf8c480a..00000000000 --- a/src/mess/layout/mephisto.lay +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/merlin.lay b/src/mess/layout/merlin.lay deleted file mode 100644 index 32d5691e253..00000000000 --- a/src/mess/layout/merlin.lay +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/minicom.lay b/src/mess/layout/minicom.lay deleted file mode 100644 index 7c429bdeac1..00000000000 --- a/src/mess/layout/minicom.lay +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mirage.lay b/src/mess/layout/mirage.lay deleted file mode 100644 index 58d6102dee0..00000000000 --- a/src/mess/layout/mirage.lay +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mk1.lay b/src/mess/layout/mk1.lay deleted file mode 100644 index 532bd44a27b..00000000000 --- a/src/mess/layout/mk1.lay +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mk14.lay b/src/mess/layout/mk14.lay deleted file mode 100644 index edea5e4c461..00000000000 --- a/src/mess/layout/mk14.lay +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mk2.lay b/src/mess/layout/mk2.lay deleted file mode 100644 index cf5b3fd7878..00000000000 --- a/src/mess/layout/mk2.lay +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mkit09.lay b/src/mess/layout/mkit09.lay deleted file mode 100644 index 47e6c0f6194..00000000000 --- a/src/mess/layout/mkit09.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mmd1.lay b/src/mess/layout/mmd1.lay deleted file mode 100644 index 5479074ee90..00000000000 --- a/src/mess/layout/mmd1.lay +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/mmd2.lay b/src/mess/layout/mmd2.lay deleted file mode 100644 index e108623f704..00000000000 --- a/src/mess/layout/mmd2.lay +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/mmerlin.lay b/src/mess/layout/mmerlin.lay deleted file mode 100644 index 4538a482149..00000000000 --- a/src/mess/layout/mmerlin.lay +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mpf1.lay b/src/mess/layout/mpf1.lay deleted file mode 100644 index 22b0a8b42cb..00000000000 --- a/src/mess/layout/mpf1.lay +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mpf1b.lay b/src/mess/layout/mpf1b.lay deleted file mode 100644 index 22b0a8b42cb..00000000000 --- a/src/mess/layout/mpf1b.lay +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mpf1p.lay b/src/mess/layout/mpf1p.lay deleted file mode 100644 index f697b7207f2..00000000000 --- a/src/mess/layout/mpf1p.lay +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/mvbfree.lay b/src/mess/layout/mvbfree.lay deleted file mode 100644 index 29598b63efc..00000000000 --- a/src/mess/layout/mvbfree.lay +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/newbrain.lay b/src/mess/layout/newbrain.lay deleted file mode 100644 index 09df5730d76..00000000000 --- a/src/mess/layout/newbrain.lay +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/pairmtch.lay b/src/mess/layout/pairmtch.lay deleted file mode 100644 index 81282cbe448..00000000000 --- a/src/mess/layout/pairmtch.lay +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/pc1500.lay b/src/mess/layout/pc1500.lay deleted file mode 100644 index 91d49eb7867..00000000000 --- a/src/mess/layout/pc1500.lay +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/pc8500.lay b/src/mess/layout/pc8500.lay deleted file mode 100644 index 67c7527e3b7..00000000000 --- a/src/mess/layout/pc8500.lay +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/mess/layout/pcw.lay b/src/mess/layout/pcw.lay deleted file mode 100644 index a7d580b4d55..00000000000 --- a/src/mess/layout/pcw.lay +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/pmi80.lay b/src/mess/layout/pmi80.lay deleted file mode 100644 index 5767c3d1918..00000000000 --- a/src/mess/layout/pmi80.lay +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/poly880.lay b/src/mess/layout/poly880.lay deleted file mode 100644 index fb90513ec1d..00000000000 --- a/src/mess/layout/poly880.lay +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/pro80.lay b/src/mess/layout/pro80.lay deleted file mode 100644 index 46ae2019bfa..00000000000 --- a/src/mess/layout/pro80.lay +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/pve500.lay b/src/mess/layout/pve500.lay deleted file mode 100644 index e7c9fbef38b..00000000000 --- a/src/mess/layout/pve500.lay +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/px4.lay b/src/mess/layout/px4.lay deleted file mode 100644 index 3f4f3324e24..00000000000 --- a/src/mess/layout/px4.lay +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/px8.lay b/src/mess/layout/px8.lay deleted file mode 100644 index e3d7df9ac9e..00000000000 --- a/src/mess/layout/px8.lay +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/rainbow.lay b/src/mess/layout/rainbow.lay deleted file mode 100644 index bb72bbf21ec..00000000000 --- a/src/mess/layout/rainbow.lay +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ravens.lay b/src/mess/layout/ravens.lay deleted file mode 100644 index e57c5e8ea41..00000000000 --- a/src/mess/layout/ravens.lay +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/savia84.lay b/src/mess/layout/savia84.lay deleted file mode 100644 index baf6a6ab2b7..00000000000 --- a/src/mess/layout/savia84.lay +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/sc1.lay b/src/mess/layout/sc1.lay deleted file mode 100644 index c6ed82b9123..00000000000 --- a/src/mess/layout/sc1.lay +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/sc2.lay b/src/mess/layout/sc2.lay deleted file mode 100644 index c68cee7e136..00000000000 --- a/src/mess/layout/sc2.lay +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/sdk85.lay b/src/mess/layout/sdk85.lay deleted file mode 100644 index 5822262a995..00000000000 --- a/src/mess/layout/sdk85.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/sdk86.lay b/src/mess/layout/sdk86.lay deleted file mode 100644 index 9f77b7200be..00000000000 --- a/src/mess/layout/sdk86.lay +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/selz80.lay b/src/mess/layout/selz80.lay deleted file mode 100644 index 1284aaa84a0..00000000000 --- a/src/mess/layout/selz80.lay +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/simon.lay b/src/mess/layout/simon.lay deleted file mode 100644 index 2cb94ad8c01..00000000000 --- a/src/mess/layout/simon.lay +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/sitcom.lay b/src/mess/layout/sitcom.lay deleted file mode 100644 index fce04d7716e..00000000000 --- a/src/mess/layout/sitcom.lay +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/slc1.lay b/src/mess/layout/slc1.lay deleted file mode 100644 index 92d032c4a80..00000000000 --- a/src/mess/layout/slc1.lay +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/sms1.lay b/src/mess/layout/sms1.lay deleted file mode 100644 index 3275da610d6..00000000000 --- a/src/mess/layout/sms1.lay +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/snmath.lay b/src/mess/layout/snmath.lay deleted file mode 100644 index ca1eb371aea..00000000000 --- a/src/mess/layout/snmath.lay +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/snspell.lay b/src/mess/layout/snspell.lay deleted file mode 100644 index e84c2e9fdfb..00000000000 --- a/src/mess/layout/snspell.lay +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/splitsec.lay b/src/mess/layout/splitsec.lay deleted file mode 100644 index 80bc61a60ab..00000000000 --- a/src/mess/layout/splitsec.lay +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/sr16.lay b/src/mess/layout/sr16.lay deleted file mode 100644 index 8488e83ee3f..00000000000 --- a/src/mess/layout/sr16.lay +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ssimon.lay b/src/mess/layout/ssimon.lay deleted file mode 100644 index 38540fbfaf4..00000000000 --- a/src/mess/layout/ssimon.lay +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/starwbc.lay b/src/mess/layout/starwbc.lay deleted file mode 100644 index 6469cb7dc9a..00000000000 --- a/src/mess/layout/starwbc.lay +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/stopthie.lay b/src/mess/layout/stopthie.lay deleted file mode 100644 index 8efd28b6f8d..00000000000 --- a/src/mess/layout/stopthie.lay +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/super80.lay b/src/mess/layout/super80.lay deleted file mode 100644 index 30bae4a87a2..00000000000 --- a/src/mess/layout/super80.lay +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/svision.lay b/src/mess/layout/svision.lay deleted file mode 100644 index 1b82689e655..00000000000 --- a/src/mess/layout/svision.lay +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/svmu.lay b/src/mess/layout/svmu.lay deleted file mode 100644 index f4419de1b90..00000000000 --- a/src/mess/layout/svmu.lay +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/sym1.lay b/src/mess/layout/sym1.lay deleted file mode 100644 index ad90e2a3ec5..00000000000 --- a/src/mess/layout/sym1.lay +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tactix.lay b/src/mess/layout/tactix.lay deleted file mode 100644 index 63afeac12a4..00000000000 --- a/src/mess/layout/tactix.lay +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tama.lay b/src/mess/layout/tama.lay deleted file mode 100644 index e4a8c62aaab..00000000000 --- a/src/mess/layout/tama.lay +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tandy12.lay b/src/mess/layout/tandy12.lay deleted file mode 100644 index edb6fcb2f27..00000000000 --- a/src/mess/layout/tandy12.lay +++ /dev/null @@ -1,430 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tavernie.lay b/src/mess/layout/tavernie.lay deleted file mode 100644 index a3f1c440f26..00000000000 --- a/src/mess/layout/tavernie.lay +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/mess/layout/tb303.lay b/src/mess/layout/tb303.lay deleted file mode 100644 index b68f4684da9..00000000000 --- a/src/mess/layout/tb303.lay +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tbreakup.lay b/src/mess/layout/tbreakup.lay deleted file mode 100644 index f203a23fee9..00000000000 --- a/src/mess/layout/tbreakup.lay +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tc4.lay b/src/mess/layout/tc4.lay deleted file mode 100644 index c0247704a83..00000000000 --- a/src/mess/layout/tc4.lay +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tec1.lay b/src/mess/layout/tec1.lay deleted file mode 100644 index 2806b919e7b..00000000000 --- a/src/mess/layout/tec1.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tecnbras.lay b/src/mess/layout/tecnbras.lay deleted file mode 100644 index bface68de71..00000000000 --- a/src/mess/layout/tecnbras.lay +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ti1270.lay b/src/mess/layout/ti1270.lay deleted file mode 100644 index 5c411ba99d8..00000000000 --- a/src/mess/layout/ti1270.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ti30.lay b/src/mess/layout/ti30.lay deleted file mode 100644 index d106c98135c..00000000000 --- a/src/mess/layout/ti30.lay +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ti74.lay b/src/mess/layout/ti74.lay deleted file mode 100644 index 16d6c1f55a0..00000000000 --- a/src/mess/layout/ti74.lay +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ti95.lay b/src/mess/layout/ti95.lay deleted file mode 100644 index 6ee4cd6db55..00000000000 --- a/src/mess/layout/ti95.lay +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tisr16.lay b/src/mess/layout/tisr16.lay deleted file mode 100644 index 90e582f832c..00000000000 --- a/src/mess/layout/tisr16.lay +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tk80.lay b/src/mess/layout/tk80.lay deleted file mode 100644 index f0ee0850a4e..00000000000 --- a/src/mess/layout/tk80.lay +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tm990189.lay b/src/mess/layout/tm990189.lay deleted file mode 100644 index 52cdbb6427a..00000000000 --- a/src/mess/layout/tm990189.lay +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tm990189v.lay b/src/mess/layout/tm990189v.lay deleted file mode 100644 index 5e39104fc46..00000000000 --- a/src/mess/layout/tm990189v.lay +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/tntell.lay b/src/mess/layout/tntell.lay deleted file mode 100644 index 629a79643c2..00000000000 --- a/src/mess/layout/tntell.lay +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/unixpc.lay b/src/mess/layout/unixpc.lay deleted file mode 100644 index be594ed0637..00000000000 --- a/src/mess/layout/unixpc.lay +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/ut88mini.lay b/src/mess/layout/ut88mini.lay deleted file mode 100644 index 2058d885cf1..00000000000 --- a/src/mess/layout/ut88mini.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/vboy.lay b/src/mess/layout/vboy.lay deleted file mode 100644 index c6f99f16113..00000000000 --- a/src/mess/layout/vboy.lay +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/vcs80.lay b/src/mess/layout/vcs80.lay deleted file mode 100644 index d12f973dfe1..00000000000 --- a/src/mess/layout/vcs80.lay +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/vidbrain.lay b/src/mess/layout/vidbrain.lay deleted file mode 100644 index ff7b440c31b..00000000000 --- a/src/mess/layout/vidbrain.lay +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/mess/layout/vk100.lay b/src/mess/layout/vk100.lay deleted file mode 100644 index 3dedf312b6f..00000000000 --- a/src/mess/layout/vk100.lay +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/votrpss.lay b/src/mess/layout/votrpss.lay deleted file mode 100644 index 3e4073e1e51..00000000000 --- a/src/mess/layout/votrpss.lay +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/votrtnt.lay b/src/mess/layout/votrtnt.lay deleted file mode 100644 index 3e4073e1e51..00000000000 --- a/src/mess/layout/votrtnt.lay +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/vsc.lay b/src/mess/layout/vsc.lay deleted file mode 100644 index fdd03423e5b..00000000000 --- a/src/mess/layout/vsc.lay +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/vt100.lay b/src/mess/layout/vt100.lay deleted file mode 100644 index 72ac0622aa2..00000000000 --- a/src/mess/layout/vt100.lay +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/wicat.lay b/src/mess/layout/wicat.lay deleted file mode 100644 index 10cf24c71e6..00000000000 --- a/src/mess/layout/wicat.lay +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/wildfire.lay b/src/mess/layout/wildfire.lay deleted file mode 100644 index c2c5ef210be..00000000000 --- a/src/mess/layout/wildfire.lay +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/wizatron.lay b/src/mess/layout/wizatron.lay deleted file mode 100644 index 8e5550757e9..00000000000 --- a/src/mess/layout/wizatron.lay +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/wswan.lay b/src/mess/layout/wswan.lay deleted file mode 100644 index 1247dbe200f..00000000000 --- a/src/mess/layout/wswan.lay +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/mess/layout/x68000.lay b/src/mess/layout/x68000.lay deleted file mode 100644 index 7d399dcfe46..00000000000 --- a/src/mess/layout/x68000.lay +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mess/layout/z80dev.lay b/src/mess/layout/z80dev.lay deleted file mode 100644 index 46ae2019bfa..00000000000 --- a/src/mess/layout/z80dev.lay +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/z80ne.lay b/src/mess/layout/z80ne.lay deleted file mode 100644 index 6485f490345..00000000000 --- a/src/mess/layout/z80ne.lay +++ /dev/null @@ -1,650 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/z80net.lay b/src/mess/layout/z80net.lay deleted file mode 100644 index 3229af18adf..00000000000 --- a/src/mess/layout/z80net.lay +++ /dev/null @@ -1,669 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/z80netb.lay b/src/mess/layout/z80netb.lay deleted file mode 100644 index ef14bec4198..00000000000 --- a/src/mess/layout/z80netb.lay +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/z80netf.lay b/src/mess/layout/z80netf.lay deleted file mode 100644 index d86921ea3ba..00000000000 --- a/src/mess/layout/z80netf.lay +++ /dev/null @@ -1,709 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/layout/zapcomputer.lay b/src/mess/layout/zapcomputer.lay deleted file mode 100644 index a07d3e015f9..00000000000 --- a/src/mess/layout/zapcomputer.lay +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mess/machine/6883sam.c b/src/mess/machine/6883sam.c deleted file mode 100644 index cb5d0685fba..00000000000 --- a/src/mess/machine/6883sam.c +++ /dev/null @@ -1,557 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - 6883sam.c - - Motorola 6883 Synchronous Address Multiplexer - - The Motorola 6883 SAM has 16 bits worth of state, but the state is changed - by writing into a 32 byte address space; odd bytes set bits and even bytes - clear bits. Here is the layout: - - 31 Set TY Map Type 0: RAM/ROM 1: All RAM - 30 Clear TY Map Type - 29 Set M1 Memory Size 00: 4K 10: 64K Dynamic - 28 Clear M1 Memory Size 01: 16K 11: 64K Static - 27 Set M0 Memory Size - 26 Clear M0 Memory Size - 25 Set R1 MPU Rate 00: Slow 10: Fast - 24 Clear R1 MPU Rate 01: Dual 11: Fast - 23 Set R0 MPU Rate - 22 Clear R0 MPU Rate - 21 Set P1 Page #1 0: Low 1: High - 20 Clear P1 Page #1 - 19 Set F6 Display Offset - 18 Clear F6 Display Offset - 17 Set F5 Display Offset - 16 Clear F5 Display Offset - 15 Set F4 Display Offset - 14 Clear F4 Display Offset - 13 Set F3 Display Offset - 12 Clear F3 Display Offset - 11 Set F2 Display Offset - 10 Clear F2 Display Offset - 9 Set F1 Display Offset - 8 Clear F1 Display Offset - 7 Set F0 Display Offset - 6 Clear F0 Display Offset - 5 Set V2 VDG Mode - 4 Clear V2 VDG Mode - 3 Set V1 VDG Mode - 2 Clear V1 VDG Mode - 1 Set V0 VDG Mode - 0 Clear V0 VDG Mode - - All parts of the SAM are fully emulated except R1/R0 (the changes in the - MPU rate are approximated) and M1/M0 - -***************************************************************************/ - - -#include "machine/6883sam.h" - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -#define LOG_SAM 0 - -const device_type SAM6883 = &device_creator; - - - -//************************************************************************** -// DEVICE SETUP -//************************************************************************** - -//------------------------------------------------- -// ctor -//------------------------------------------------- - -sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, SAM6883, "SAM6883", tag, owner, clock, "sam6883", __FILE__), - m_cpu_tag(NULL), - m_cpu_space_ref(AS_PROGRAM), - m_read_res(*this), - m_space_0000(*this), - m_space_8000(*this), - m_space_A000(*this), - m_space_C000(*this), - m_space_FF00(*this), - m_space_FF20(*this), - m_space_FF40(*this), - m_space_FF60(*this), - m_space_FFE0(*this) -{ - memset(m_banks, '\0', sizeof(m_banks)); -} - - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void sam6883_device::device_start() -{ - // find the CPU - m_cpu = machine().device(m_cpu_tag); - m_cpu_space = &m_cpu->space(m_cpu_space_ref); - - // resolve callbacks - m_read_res.resolve_safe(0); - - // install SAM handlers - m_cpu_space->install_read_handler(0xFFC0, 0xFFDF, 0, 0, read8_delegate(FUNC(sam6883_device::read), this)); - m_cpu_space->install_write_handler(0xFFC0, 0xFFDF, 0, 0, write8_delegate(FUNC(sam6883_device::write), this)); - - // save state support - save_item(NAME(m_sam_state)); - save_item(NAME(m_counter)); - save_item(NAME(m_counter_xdiv)); - save_item(NAME(m_counter_ydiv)); -} - - - -//------------------------------------------------- -// configure_bank - bank configuration -//------------------------------------------------- - -void sam6883_device::configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only) -{ - configure_bank(bank, memory, memory_size, is_read_only, read8_delegate(), write8_delegate()); -} - - - -//------------------------------------------------- -// configure_bank - bank configuration -//------------------------------------------------- - -void sam6883_device::configure_bank(int bank, read8_delegate rhandler, write8_delegate whandler) -{ - configure_bank(bank, NULL, 0, false, rhandler, whandler); -} - - - -//------------------------------------------------- -// configure_bank - bank configuration -//------------------------------------------------- - -void sam6883_device::configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only, read8_delegate rhandler, write8_delegate whandler) -{ - assert((bank >= 0) && (bank < ARRAY_LENGTH(m_banks))); - m_banks[bank].m_memory = memory; - m_banks[bank].m_memory_size = memory_size; - m_banks[bank].m_memory_read_only = is_read_only; - m_banks[bank].m_rhandler = rhandler; - m_banks[bank].m_whandler = whandler; - - /* if we're configuring a bank that never changes, update it now */ - switch(bank) - { - case 4: - m_space_FF00.point(&m_banks[4], 0x0000, 0); - break; - case 5: - m_space_FF20.point(&m_banks[5], 0x0000, 0); - break; - case 6: - m_space_FF40.point(&m_banks[6], 0x0000, 0); - break; - case 7: - m_space_FF60.point(&m_banks[7], 0x0000, 0); - break; - case 2: - m_space_FFE0.point(&m_banks[2], 0x1FE0, 0); - break; - } -} - - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void sam6883_device::device_reset() -{ - m_counter = 0; - m_counter_xdiv = 0; - m_counter_ydiv = 0; - m_sam_state = 0x0000; - update_state(); -} - - - -//------------------------------------------------- -// device_post_load - device-specific post load -//------------------------------------------------- - -void sam6883_device::device_post_load() -{ - device_t::device_post_load(); - update_state(); -} - - - -//------------------------------------------------- -// update_state -//------------------------------------------------- - -void sam6883_device::update_state(void) -{ - update_memory(); - update_cpu_clock(); -} - - - -//------------------------------------------------- -// update_memory -//------------------------------------------------- - -void sam6883_device::update_memory(void) -{ - // Memory size - allowed restricting memory accesses to something less than - // 32k - // - // This was a SAM switch that occupied 4 addresses: - // - // $FFDD (set) R1 - // $FFDC (clear) R1 - // $FFDB (set) R0 - // $FFDA (clear) R0 - // - // R1:R0 formed the following states: - // 00 - 4k - // 01 - 16k - // 10 - 64k - // 11 - static RAM (??) - // - // If something less than 64k was set, the low RAM would be smaller and - // mirror the other parts of the RAM - // - // TODO: Find out what "static RAM" is - // TODO: This should affect _all_ memory accesses, not just video ram - // TODO: Verify that the CoCo 3 ignored this - - // for now, lets assume that the caller is nice and made m_memory_size - // a power of two - UINT16 ram_mask = (UINT16) m_banks[0].m_memory_size - 1; - - // switch depending on the M1/M0 variables - bool setup_rom = true; - switch(m_sam_state & (SAM_STATE_M1|SAM_STATE_M0)) - { - case 0: - // 4K mode - m_space_0000.point(&m_banks[0], 0x0000, ram_mask); - m_counter_mask = 0x0FFF; - m_counter_or = 0x0000; - break; - - case SAM_STATE_M0: - // 16K mode - m_space_0000.point(&m_banks[0], 0x0000, ram_mask); - m_counter_mask = 0x3FFF; - m_counter_or = 0x0000; - break; - - case SAM_STATE_M1: - case SAM_STATE_M1|SAM_STATE_M0: - // 64k mode - if (m_sam_state & SAM_STATE_TY) - { - // full 64k RAM - m_space_0000.point(&m_banks[0], 0x0000, ram_mask); - m_space_8000.point(&m_banks[0], 0x8000, 0); - m_space_A000.point(&m_banks[0], 0xA000, 0); - m_space_C000.point(&m_banks[0], 0xC000, 0); - m_counter_mask = 0xFFFF; - m_counter_or = 0x0000; - setup_rom = false; - } - else - { - // ROM/RAM - UINT16 ram_base = (m_sam_state & SAM_STATE_P1) ? 0x8000 : 0x0000; - m_space_0000.point(&m_banks[0], ram_base, ram_mask); - m_counter_mask = 0x7FFF; - m_counter_or = ram_base; - } - break; - } - - if (setup_rom) - { - m_space_8000.point(&m_banks[1], m_banks[1].m_memory_offset, 0); - m_space_A000.point(&m_banks[2], m_banks[2].m_memory_offset, 0); - m_space_C000.point(&m_banks[3], m_banks[3].m_memory_offset, 0); - } - - // update $FFE0-$FFFF - m_space_FFE0.point(&m_banks[2], m_banks[2].m_memory_offset + 0x1FE0, 0); -} - - - -//------------------------------------------------- -// update_cpu_clock - adjusts the speed of the CPU -// clock -//------------------------------------------------- - -void sam6883_friend_device::update_cpu_clock(void) -{ - // The infamous speed up poke. - // - // This was a SAM switch that occupied 4 addresses: - // - // $FFD9 (set) R1 - // $FFD8 (clear) R1 - // $FFD7 (set) R0 - // $FFD6 (clear) R0 - // - // R1:R0 formed the following states: - // 00 - slow 0.89 MHz - // 01 - dual speed ??? - // 1x - fast 1.78 MHz - // - // R1 controlled whether the video addressing was speeded up and R0 - // did the same for the CPU. On pre-CoCo 3 machines, setting R1 caused - // the screen to display garbage because the M6847 could not display - // fast enough. - // - // TODO: Make the overclock more accurate. In dual speed, ROM was a fast - // access but RAM was not. I don't know how to simulate this. - - int speed = (m_sam_state & (SAM_STATE_R1|SAM_STATE_R0)) / SAM_STATE_R0; - - // the line below is weird because we are not strictly emulating the M6809E with emphasis on the 'E' - m_cpu->set_clock_scale(speed ? 2 : 1); -} - - - -//------------------------------------------------- -// set_bank_offset -//------------------------------------------------- - -void sam6883_device::set_bank_offset(int bank, offs_t offset) -{ - if (m_banks[bank].m_memory_offset != offset) - { - m_banks[bank].m_memory_offset = offset; - update_memory(); - } -} - - - -//------------------------------------------------- -// read -//------------------------------------------------- - -READ8_MEMBER( sam6883_device::read ) -{ - return 0; -} - - - -//------------------------------------------------- -// write -//------------------------------------------------- - -WRITE8_MEMBER( sam6883_device::write ) -{ - /* alter the SAM state */ - UINT16 xorval = alter_sam_state(offset); - - /* based on the mask, apply effects */ - if (xorval & (SAM_STATE_TY|SAM_STATE_M1|SAM_STATE_M0|SAM_STATE_P1)) - update_memory(); - if (xorval & (SAM_STATE_R1|SAM_STATE_R0)) - update_cpu_clock(); -} - - - -//------------------------------------------------- -// horizontal_sync -//------------------------------------------------- - -void sam6883_device::horizontal_sync(void) -{ - bool carry; - - // When horizontal sync occurs, bits B1-B3 or B1-B4 may be cleared (except in DMA mode). The catch - // is that the SAM's counter is a chain of flip-flops. Clearing the counter can cause carries to - // occur just as they can when the counter is bumped. - // - // This is critical in getting certain semigraphics modes to work correctly. Guardian uses this - // mode (see bug #1153). Special thanks to Ciaran Anscomb and Phill Harvey-Smith for figuring this - // out - switch((m_sam_state & (SAM_STATE_V2|SAM_STATE_V1|SAM_STATE_V0)) / SAM_STATE_V0) - { - case 0x01: - case 0x03: - case 0x05: - /* these SAM modes clear bits B1-B3 */ - carry = (m_counter & 0x0008) ? true : false; - m_counter &= ~0x000F; - if (carry) - counter_carry_bit3(); - break; - - case 0x00: - case 0x02: - case 0x04: - case 0x06: - /* clear bits B1-B4 */ - carry = (m_counter & 0x0010) ? true : false; - m_counter &= ~0x001F; - if (carry) - counter_carry_bit4(); - break; - - case 0x07: - /* DMA mode - do nothing */ - break; - - default: - fatalerror("Should not get here\n"); - } -} - - - -//------------------------------------------------- -// hs_w -//------------------------------------------------- - -WRITE_LINE_MEMBER( sam6883_device::hs_w ) -{ - if (state) - { - horizontal_sync(); - } -} - - - -//------------------------------------------------- -// sam_space::ctor -//------------------------------------------------- - -template -sam6883_device::sam_space<_addrstart, _addrend>::sam_space(sam6883_device &owner) - : m_owner(owner) -{ - m_read_bank = NULL; - m_write_bank = NULL; - m_mask = 0; -} - - - -//------------------------------------------------- -// sam_space::cpu_space -//------------------------------------------------- - -template -address_space &sam6883_device::sam_space<_addrstart, _addrend>::cpu_space() const -{ - assert(m_owner.m_cpu_space != NULL); - return *m_owner.m_cpu_space; -} - - - -//------------------------------------------------- -// sam_space::point -//------------------------------------------------- - -template -void sam6883_device::sam_space<_addrstart, _addrend>::point(const sam_bank *bank, UINT16 offset, UINT16 mask) -{ - if (LOG_SAM) - { - logerror("sam6883_device::sam_space::point(): addrstart=0x%04X addrend=0x%04X offset=0x%04X mask=0x%04X bank->m_memory=0x%p bank->m_memory_read_only=%s\n", - (unsigned) _addrstart, - (unsigned) _addrend, - (unsigned) offset, - (unsigned) mask, - bank->m_memory, - bank->m_memory_read_only ? "true" : "false"); - } - - point_specific_bank(bank, offset, mask, m_read_bank, _addrstart, _addrend, false); - point_specific_bank(bank, offset, mask, m_write_bank, _addrstart, _addrend, true); -} - - - -//------------------------------------------------- -// sam_space::point_specific_bank -//------------------------------------------------- -template -void sam6883_device::sam_space<_addrstart, _addrend>::point_specific_bank(const sam_bank *bank, UINT16 offset, UINT16 mask, memory_bank *&memory_bank, INT32 addrstart, INT32 addrend, bool is_write) -{ - char buffer[16]; - - if (bank->m_memory != NULL) - { - // normalize offset - if (mask != 0) - offset &= mask; - - // this bank is a memory bank - first ensure that we have a bank - if (!memory_bank || !memory_bank->matches_exactly(addrstart, addrend) || (mask != m_mask)) - { - // name the bank - snprintf(buffer, ARRAY_LENGTH(buffer), "bank%04X_%c", addrstart, is_write ? 'w' : 'r'); - - // install it - if (is_write) - cpu_space().install_write_bank(addrstart, addrend, mask, 0, buffer); - else - cpu_space().install_read_bank(addrstart, addrend, mask, 0, buffer); - m_mask = mask; - - // and get it - memory_bank = cpu_space().device().owner()->membank(buffer); - } - - // point the bank - if (memory_bank != NULL) - { - if (is_write && bank->m_memory_read_only) - memory_bank->set_base(m_owner.m_dummy); - else - memory_bank->set_base(bank->m_memory + offset); - } - } - else - { - // this bank uses handlers - assert((offset == 0) && (mask == 0)); // changes to the offset are not supported - - if (is_write) - { - if (!bank->m_whandler.isnull()) - cpu_space().install_write_handler(addrstart, addrend, 0, 0, bank->m_whandler); - } - else - { - if (!bank->m_rhandler.isnull()) - cpu_space().install_read_handler(addrstart, addrend, 0, 0, bank->m_rhandler); - } - } -} diff --git a/src/mess/machine/6883sam.h b/src/mess/machine/6883sam.h deleted file mode 100644 index 772fe38d63f..00000000000 --- a/src/mess/machine/6883sam.h +++ /dev/null @@ -1,266 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - 6883sam.h - - Motorola 6883 Synchronous Address Multiplexer - -***************************************************************************/ - -#pragma once - -#ifndef __6883SAM__ -#define __6883SAM__ - -#include "emu.h" - -#define MCFG_SAM6883_ADD(_tag, _clock, _cputag, _cpuspace) \ - MCFG_DEVICE_ADD(_tag, SAM6883, _clock) \ - sam6883_device::configure_cpu(*device, _cputag, _cpuspace); - -#define MCFG_SAM6883_RES_CALLBACK(_read) \ - devcb = &sam6883_device::set_res_rd_callback(*device, DEVCB_##_read); - - -//************************************************************************** -// SAM6883 CORE -//************************************************************************** - -// base class so that GIME emulation can use some functionality -class sam6883_friend_device -{ -public: - sam6883_friend_device() { m_cpu = NULL; m_sam_state = 0x0000; } - -protected: - // SAM state constants - static const UINT16 SAM_STATE_TY = 0x8000; - static const UINT16 SAM_STATE_M1 = 0x4000; - static const UINT16 SAM_STATE_M0 = 0x2000; - static const UINT16 SAM_STATE_R1 = 0x1000; - static const UINT16 SAM_STATE_R0 = 0x0800; - static const UINT16 SAM_STATE_P1 = 0x0400; - static const UINT16 SAM_STATE_F6 = 0x0200; - static const UINT16 SAM_STATE_F5 = 0x0100; - static const UINT16 SAM_STATE_F4 = 0x0080; - static const UINT16 SAM_STATE_F3 = 0x0040; - static const UINT16 SAM_STATE_F2 = 0x0020; - static const UINT16 SAM_STATE_F1 = 0x0010; - static const UINT16 SAM_STATE_F0 = 0x0008; - static const UINT16 SAM_STATE_V2 = 0x0004; - static const UINT16 SAM_STATE_V1 = 0x0002; - static const UINT16 SAM_STATE_V0 = 0x0001; - - // incidentals - cpu_device * m_cpu; - - // device state - UINT16 m_sam_state; - - ATTR_FORCE_INLINE UINT16 display_offset(void) - { - return ((m_sam_state & (SAM_STATE_F0|SAM_STATE_F1|SAM_STATE_F2|SAM_STATE_F3|SAM_STATE_F4|SAM_STATE_F5|SAM_STATE_F6)) / SAM_STATE_F0) << 9; - } - - ATTR_FORCE_INLINE UINT16 alter_sam_state(offs_t offset) - { - /* determine the mask */ - UINT16 mask = 1 << (offset >> 1); - - /* determine the new state */ - UINT16 new_state; - if (offset & 0x0001) - new_state = m_sam_state | mask; - else - new_state = m_sam_state & ~mask; - - /* specify the new state */ - UINT16 xorval = m_sam_state ^ new_state; - m_sam_state = new_state; - return xorval; - } - - void update_cpu_clock(void); -}; - -class sam6883_device : public device_t, public sam6883_friend_device -{ -public: - sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_res_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_res.set_callback(object); } - - static void configure_cpu(device_t &device, const char *tag, address_spacenum space) - { - sam6883_device &dev = downcast(device); - dev.m_cpu_tag = tag; - dev.m_cpu_space_ref = space; - } - - // called to configure banks - void configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only); - void configure_bank(int bank, read8_delegate rhandler, write8_delegate whandler); - - // typically called by VDG - ATTR_FORCE_INLINE DECLARE_READ8_MEMBER( display_read ) - { - if (offset == (offs_t) ~0) - { - /* the VDG is telling the counter to reset */ - m_counter = display_offset(); - m_counter_xdiv = 0; - m_counter_ydiv = 0; - } - else if ((offset & 1) != (m_counter & 0x0001)) - { - /* DA0 has been toggled - first bump B0-B3 of the counter */ - bool bit3_carry = (m_counter & 0x000F) == 0x000F; - m_counter = (m_counter & ~0x000F) | ((m_counter + 1) & 0x000F); - - /* and apply the carry (if applicable */ - if (bit3_carry) - counter_carry_bit3(); - } - return m_read_res((m_counter & m_counter_mask) | m_counter_or); - } - - DECLARE_WRITE_LINE_MEMBER( hs_w ); - - // typically called by machine - address_space *mpu_address_space(void) const { return m_cpu_space; } - void set_bank_offset(int bank, offs_t offset); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_post_load(); - -private: - // represents an external memory bank - memory or IO that the SAM - // points to with the S2/S1/S0 output - struct sam_bank - { - UINT8 * m_memory; - UINT32 m_memory_size; - offs_t m_memory_offset; - bool m_memory_read_only; - read8_delegate m_rhandler; - write8_delegate m_whandler; - }; - - // represents one of the memory "spaces" (e.g. - $8000-$9FFF) that - // can ultimately point to a bank - template - class sam_space - { - public: - sam_space(sam6883_device &owner); - void point(const sam_bank *bank, UINT16 offset, UINT16 mask); - - private: - sam6883_device & m_owner; - memory_bank * m_read_bank; - memory_bank * m_write_bank; - UINT16 m_mask; - - address_space &cpu_space() const; - void point_specific_bank(const sam_bank *bank, UINT16 offset, UINT16 mask, memory_bank *&memory_bank, INT32 addrstart, INT32 addrend, bool is_write); - }; - - const char * m_cpu_tag; - address_spacenum m_cpu_space_ref; - - // incidentals - address_space * m_cpu_space; - devcb_read8 m_read_res; - sam_bank m_banks[8]; - sam_space<0x0000, 0x7FFF> m_space_0000; - sam_space<0x8000, 0x9FFF> m_space_8000; - sam_space<0xA000, 0xBFFF> m_space_A000; - sam_space<0xC000, 0xFEFF> m_space_C000; - sam_space<0xFF00, 0xFF1F> m_space_FF00; - sam_space<0xFF20, 0xFF3F> m_space_FF20; - sam_space<0xFF40, 0xFF5F> m_space_FF40; - sam_space<0xFF60, 0xFFBF> m_space_FF60; - sam_space<0xFFE0, 0xFFFF> m_space_FFE0; - UINT16 m_counter_mask; - UINT16 m_counter_or; - - // SAM state - UINT16 m_counter; - UINT8 m_counter_xdiv; - UINT8 m_counter_ydiv; - - // dummy scratch memory - UINT8 m_dummy[0x8000]; - - // typically called by CPU - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - // called when there is a carry out of bit 3 on the counter - ATTR_FORCE_INLINE void counter_carry_bit3(void) - { - UINT8 x_division; - switch((m_sam_state & (SAM_STATE_V2|SAM_STATE_V1|SAM_STATE_V0)) / SAM_STATE_V0) - { - case 0x00: x_division = 1; break; - case 0x01: x_division = 3; break; - case 0x02: x_division = 1; break; - case 0x03: x_division = 2; break; - case 0x04: x_division = 1; break; - case 0x05: x_division = 1; break; - case 0x06: x_division = 1; break; - case 0x07: x_division = 1; break; - default: - fatalerror("Should not get here\n"); - return; - } - - if (++m_counter_xdiv >= x_division) - { - m_counter_xdiv = 0; - m_counter ^= 0x0010; - if ((m_counter & 0x0010) == 0x0000) - counter_carry_bit4(); - } - } - - // called when there is a carry out of bit 4 on the counter - ATTR_FORCE_INLINE void counter_carry_bit4(void) - { - UINT8 y_division; - switch((m_sam_state & (SAM_STATE_V2|SAM_STATE_V1|SAM_STATE_V0)) / SAM_STATE_V0) - { - case 0x00: y_division = 12; break; - case 0x01: y_division = 1; break; - case 0x02: y_division = 3; break; - case 0x03: y_division = 1; break; - case 0x04: y_division = 2; break; - case 0x05: y_division = 1; break; - case 0x06: y_division = 1; break; - case 0x07: y_division = 1; break; - default: - fatalerror("Should not get here\n"); - return; - } - - if (++m_counter_ydiv >= y_division) - { - m_counter_ydiv = 0; - m_counter += 0x0020; - } - } - - // other members - void configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only, read8_delegate rhandler, write8_delegate whandler); - void horizontal_sync(void); - void update_state(void); - void update_memory(void); -}; - -extern const device_type SAM6883; - -#endif /* __6883SAM__ */ diff --git a/src/mess/machine/abc1600mac.c b/src/mess/machine/abc1600mac.c deleted file mode 100644 index b22f55708c6..00000000000 --- a/src/mess/machine/abc1600mac.c +++ /dev/null @@ -1,686 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Luxor ABC 1600 Memory Access Controller emulation - -**********************************************************************/ - -/* - - TODO: - - - segment/page RAM addresses are not correctly decoded, "sas/format/format" can't find the SASI interface because of this - forcetask0 1 t0 0 t1 0 t2 0 t3 0 - sega19 0 task 0 - sega 000 segd 00 pga 008 pgd 4058 virtual 02c730 (should be 004730) -*/ - -#include "abc1600mac.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - - -#define A0 BIT(offset, 0) -#define A1 BIT(offset, 1) -#define A2 BIT(offset, 2) -#define A4 BIT(offset, 4) -#define A7 BIT(offset, 7) -#define A8 BIT(offset, 8) -#define X11 BIT(offset, 11) -#define X12 BIT(offset, 12) -#define A17 BIT(offset, 17) -#define A18 BIT(offset, 18) -#define A19 BIT(offset, 19) - -#define A10_A9_A8 ((offset >> 8) & 0x07) -#define A2_A1_A0 (offset & 0x07) -#define A1_A2 ((A1 << 1) | A2) -#define A2_A1 ((offset >> 1) & 0x03) - -#define FC0 BIT(fc, 0) -#define FC1 BIT(fc, 1) -#define FC2 BIT(fc, 2) - -#define PAGE_WP BIT(page_data, 14) -#define PAGE_NONX BIT(page_data, 15) - -#define BOOTE BIT(m_task, 6) -#define MAGIC BIT(m_task, 7) -#define READ_MAGIC !MAGIC - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type ABC1600_MAC = &device_creator; - - -DEVICE_ADDRESS_MAP_START( map, 8, abc1600_mac_device ) - AM_RANGE(0x00000, 0xfffff) AM_READWRITE(read, write) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, abc1600_mac_device ) -ADDRESS_MAP_END - - -//------------------------------------------------- -// ROM( abc1600_mac ) -//------------------------------------------------- - -ROM_START( abc1600_mac ) - ROM_REGION( 0x4000, "boot", 0 ) - ROM_LOAD( "boot 6490356-04.1f", 0x0000, 0x4000, CRC(9372f6f2) SHA1(86f0681f7ef8dd190b49eda5e781881582e0c2a4) ) - - ROM_REGION( 0x104, "plds", 0 ) - ROM_LOAD( "1022 6490351-01.17e", 0x000, 0x104, CRC(5dd00d43) SHA1(a3871f0d796bea9df8f25d41b3169dd4b8ef65ab) ) // MAC register address decoder -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *abc1600_mac_device::device_rom_region() const -{ - return ROM_NAME( abc1600_mac ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// abc1600_mac_device - constructor -//------------------------------------------------- - -abc1600_mac_device::abc1600_mac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ABC1600_MAC, "ABC 1600 MAC", tag, owner, clock, "abc1600mac", __FILE__), - device_memory_interface(mconfig, *this), - m_space_config("program", ENDIANNESS_LITTLE, 8, 22, 0, *ADDRESS_MAP_NAME(program_map)), - m_rom(*this, "boot"), - m_segment_ram(*this, "segment_ram"), - m_page_ram(*this, "page_ram"), - m_task(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void abc1600_mac_device::device_start() -{ - // get the CPU device - m_cpu = machine().device(m_cpu_tag); - assert(m_cpu != NULL); - - // allocate memory - m_segment_ram.allocate(0x400); - m_page_ram.allocate(0x400); - - // HACK fill segment RAM or abcenix won't boot - memset(m_segment_ram, 0xcd, 0x400); - - // state saving - save_item(NAME(m_ifc2)); - save_item(NAME(m_task)); - save_item(NAME(m_dmamap)); - save_item(NAME(m_cause)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void abc1600_mac_device::device_reset() -{ - // clear task register - m_task = 0; -} - - -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *abc1600_mac_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == AS_PROGRAM) ? &m_space_config : NULL; -} - - -//------------------------------------------------- -// get_current_task - -//------------------------------------------------- - -int abc1600_mac_device::get_current_task(offs_t offset) -{ - int force_task0 = !(m_ifc2 || A19); - int t0 = !(BIT(m_task, 0) || force_task0); - int t1 = !(BIT(m_task, 1) || force_task0); - int t2 = !(BIT(m_task, 2) || force_task0); - int t3 = !(BIT(m_task, 3) || force_task0); - - return (t3 << 3) | (t2 << 2) | (t1 << 1) | t0; -} - - -//------------------------------------------------- -// get_segment_address - -//------------------------------------------------- - -offs_t abc1600_mac_device::get_segment_address(offs_t offset) -{ - int sega19 = !(!(A8 || m_ifc2) || !A19); - int task = get_current_task(offset); - - return (task << 5) | (sega19 << 4) | ((offset >> 15) & 0x0f); -} - - -//------------------------------------------------- -// get_page_address - -//------------------------------------------------- - -offs_t abc1600_mac_device::get_page_address(offs_t offset, UINT8 segd) -{ - return ((segd & 0x3f) << 4) | ((offset >> 11) & 0x0f); -} - - -//------------------------------------------------- -// translate_address - -//------------------------------------------------- - -offs_t abc1600_mac_device::translate_address(offs_t offset, int *nonx, int *wp) -{ - // segment - offs_t sega = get_segment_address(offset); - UINT8 segd = m_segment_ram[sega]; - - // page - offs_t pga = get_page_address(offset, segd); - UINT16 page_data = m_page_ram[pga]; - - offs_t virtual_offset = ((page_data & 0x3ff) << 11) | (offset & 0x7ff); - - if (PAGE_NONX) - { - //logerror("Bus error %06x : %06x\n", offset, virtual_offset); - //m_cpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - //m_cpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); - } - - *nonx = PAGE_NONX; - *wp = PAGE_WP; - - return virtual_offset; -} - - -//------------------------------------------------- -// read_user_memory - -//------------------------------------------------- - -UINT8 abc1600_mac_device::read_user_memory(offs_t offset) -{ - int nonx = 0, wp = 0; - offs_t virtual_offset = translate_address(offset, &nonx, &wp); - - return space().read_byte(virtual_offset); -} - - -//------------------------------------------------- -// write_user_memory - -//------------------------------------------------- - -void abc1600_mac_device::write_user_memory(offs_t offset, UINT8 data) -{ - int nonx = 0, wp = 0; - offs_t virtual_offset = translate_address(offset, &nonx, &wp); - - //if (nonx || !wp) return; - - space().write_byte(virtual_offset, data); -} - - -//------------------------------------------------- -// read_supervisor_memory - -//------------------------------------------------- - -UINT8 abc1600_mac_device::read_supervisor_memory(address_space &space, offs_t offset) -{ - UINT8 data = 0; - - if (!A2 && !A1) - { - // _EP - data = page_r(space, offset); - } - else if (!A2 && A1 && A0) - { - // _ES - data = segment_r(space, offset); - } - else if (A2 && A1 && A0) - { - // _CAUSE - data = cause_r(space, offset); - } - - return data; -} - - -//------------------------------------------------- -// write_supervisor_memory - -//------------------------------------------------- - -void abc1600_mac_device::write_supervisor_memory(address_space &space, offs_t offset, UINT8 data) -{ - if (!A2 && !A1) - { - // _WEP - page_w(space, offset, data); - } - else if (!A2 && A1 && A0) - { - // _WES - segment_w(space, offset, data); - } - else if (A2 && !A1 && A0) - { - // W(C) - task_w(space, offset, data); - } -} - - -//------------------------------------------------- -// get_fc - -//------------------------------------------------- - -int abc1600_mac_device::get_fc() -{ - UINT16 fc = m_cpu->get_fc(); - - m_ifc2 = !(!(MAGIC || FC0) || FC2); - - return fc; -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( abc1600_mac_device::read ) -{ - int fc = get_fc(); - - UINT8 data = 0; - - if (!BOOTE && !A19 && !A18 && !A17) - { - // _BOOTCE - data = m_rom->base()[offset & 0x3fff]; - } - else if (A19 && !m_ifc2 && !FC1) - { - data = read_supervisor_memory(space, offset); - } - else - { - data = read_user_memory(offset); - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mac_device::write ) -{ - int fc = get_fc(); - - if (A19 && !m_ifc2 && !FC1) - { - write_supervisor_memory(space, offset, data); - } - else - { - write_user_memory(offset, data); - } -} - - -//------------------------------------------------- -// cause_r - -//------------------------------------------------- - -READ8_MEMBER( abc1600_mac_device::cause_r ) -{ - /* - - bit description - - 0 RSTBUT - 1 1 - 2 DMAOK - 3 X16 - 4 X17 - 5 X18 - 6 X19 - 7 X20 - - */ - - UINT8 data = 0x02; - - // DMA status - data |= m_cause; - - machine().watchdog_reset(); - - return data; -} - - -//------------------------------------------------- -// task_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mac_device::task_w ) -{ - /* - - bit description - - 0 TASKD0* (inverted SEGA5) - 1 TASKD1* (inverted SEGA6) - 2 TASKD2* (inverted SEGA7) - 3 TASKD3* (inverted SEGA8) - 4 - 5 - 6 BOOTE* - 7 MAGIC* - - */ - - m_task = data ^ 0xff; - - if (LOG) logerror("%s: %06x Task %u BOOTE %u MAGIC %u\n", machine().describe_context(), offset, get_current_task(offset), BOOTE, MAGIC); -} - - -//------------------------------------------------- -// segment_r - -//------------------------------------------------- - -READ8_MEMBER( abc1600_mac_device::segment_r ) -{ - /* - - bit description - - 0 SEGD0 - 1 SEGD1 - 2 SEGD2 - 3 SEGD3 - 4 SEGD4 - 5 SEGD5 - 6 SEGD6 - 7 READ_MAGIC - - */ - - offs_t sega = get_segment_address(offset); - UINT8 segd = m_segment_ram[sega]; - - return (READ_MAGIC << 7) | (segd & 0x7f); -} - - -//------------------------------------------------- -// segment_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mac_device::segment_w ) -{ - /* - - bit description - - 0 SEGD0 - 1 SEGD1 - 2 SEGD2 - 3 SEGD3 - 4 SEGD4 - 5 SEGD5 - 6 SEGD6 - 7 0 - - */ - - offs_t sega = get_segment_address(offset); - - m_segment_ram[sega] = data & 0x7f; - - if (LOG) logerror("%s: %06x Task %u Segment %03x : %02x\n", machine().describe_context(), offset, get_current_task(offset), sega, data); -} - - -//------------------------------------------------- -// page_r - -//------------------------------------------------- - -READ8_MEMBER( abc1600_mac_device::page_r ) -{ - /* - - bit description - - 0 X11 - 1 X12 - 2 X13 - 3 X14 - 4 X15 - 5 X16 - 6 X17 - 7 X18 - - 8 X19 - 9 X20 - 10 X20 - 11 X20 - 12 X20 - 13 X20 - 14 _WP - 15 NONX - - */ - - // segment - offs_t sega = get_segment_address(offset); - UINT8 segd = m_segment_ram[sega]; - - // page - offs_t pga = get_page_address(offset, segd); - UINT16 pgd = m_page_ram[pga]; - - UINT8 data = 0; - - if (A0) - { - data = pgd & 0xff; - } - else - { - int x20 = BIT(pgd, 9); - - data = (pgd >> 8) | (x20 << 2) | (x20 << 3) | (x20 << 4) | (x20 << 5); - } - - return data; -} - - -//------------------------------------------------- -// page_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mac_device::page_w ) -{ - /* - - bit description - - 0 X11 - 1 X12 - 2 X13 - 3 X14 - 4 X15 - 5 X16 - 6 X17 - 7 X18 - - 8 X19 - 9 X20 - 10 - 11 - 12 - 13 - 14 _WP - 15 NONX - - */ - - // segment - offs_t sega = get_segment_address(offset); - UINT8 segd = m_segment_ram[sega]; - - // page - offs_t pga = get_page_address(offset, segd); - - if (A0) - { - m_page_ram[pga] = (m_page_ram[pga] & 0xff00) | data; - } - else - { - m_page_ram[pga] = ((data & 0xc3) << 8) | (m_page_ram[pga] & 0xff); - } - - if (LOG) logerror("%s: %06x Task %u Segment %03x Page %03x : %02x -> %04x\n", machine().describe_context(), offset, get_current_task(offset), sega, pga, data, m_page_ram[pga]); -} - - -//------------------------------------------------- -// get_dma_address - -//------------------------------------------------- - -offs_t abc1600_mac_device::get_dma_address(int index, UINT16 offset) -{ - // A0 = DMA15, A1 = BA1, A2 = BA2 - UINT8 dmamap_addr = index | BIT(offset, 15); - UINT8 dmamap = m_dmamap[dmamap_addr]; - - m_cause = (dmamap & 0x1f) << 3; - - return ((dmamap & 0x1f) << 16) | offset; -} - - -//------------------------------------------------- -// dma_mreq_r - DMA memory read -//------------------------------------------------- - -UINT8 abc1600_mac_device::dma_mreq_r(int index, UINT16 offset) -{ - offs_t virtual_offset = get_dma_address(index, offset); - - return space().read_byte(virtual_offset); -} - - -//------------------------------------------------- -// dma_mreq_w - DMA memory write -//------------------------------------------------- - -void abc1600_mac_device::dma_mreq_w(int index, UINT16 offset, UINT8 data) -{ - offs_t virtual_offset = get_dma_address(index, offset); - - space().write_byte(virtual_offset, data); -} - - -//------------------------------------------------- -// dma_iorq_r - DMA I/O read -//------------------------------------------------- - -UINT8 abc1600_mac_device::dma_iorq_r(int index, UINT16 offset) -{ - offs_t virtual_offset = 0x1fe000 | get_dma_address(index, offset); - - return space().read_byte(virtual_offset); -} - - -//------------------------------------------------- -// dma_iorq_w - DMA I/O write -//------------------------------------------------- - -void abc1600_mac_device::dma_iorq_w(int index, UINT16 offset, UINT8 data) -{ - offs_t virtual_offset = 0x1fe000 | get_dma_address(index, offset); - - space().write_byte(virtual_offset, data); -} - - -//------------------------------------------------- -// dmamap_w - DMA map write -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mac_device::dmamap_w ) -{ - /* - - bit description - - 0 X16 - 1 X17 - 2 X18 - 3 X19 - 4 X20 - 5 - 6 - 7 _R/W - - */ - - if (LOG) logerror("DMAMAP %u %02x\n", offset & 7, data); - - m_dmamap[offset & 7] = data; -} diff --git a/src/mess/machine/abc1600mac.h b/src/mess/machine/abc1600mac.h deleted file mode 100644 index c26c2dc9b09..00000000000 --- a/src/mess/machine/abc1600mac.h +++ /dev/null @@ -1,136 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Luxor ABC 1600 Memory Access Controller emulation - -**********************************************************************/ - -#pragma once - -#ifndef __ABC1600_MAC__ -#define __ABC1600_MAC__ - -#include "emu.h" -#include "cpu/m68000/m68000.h" - - - -///************************************************************************* -// MACROS / CONSTANTS -///************************************************************************* - -#define ABC1600_MAC_TAG "mac" - - - -///************************************************************************* -// INTERFACE CONFIGURATION MACROS -///************************************************************************* - -#define MCFG_ABC1600_MAC_ADD(_cpu_tag, _program_map) \ - MCFG_DEVICE_ADD(ABC1600_MAC_TAG, ABC1600_MAC, 0) \ - MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _program_map) \ - downcast(device)->set_cpu_tag(_cpu_tag); - - - -///************************************************************************* -// TYPE DEFINITIONS -///************************************************************************* - -// ======================> abc1600_mac_device - -class abc1600_mac_device : public device_t, - public device_memory_interface -{ -public: - abc1600_mac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - - void set_cpu_tag(const char *cpu_tag) { m_cpu_tag = cpu_tag; } - - virtual DECLARE_ADDRESS_MAP(map, 8); - - DECLARE_READ8_MEMBER( cause_r ); - DECLARE_WRITE8_MEMBER( task_w ); - DECLARE_READ8_MEMBER( segment_r ); - DECLARE_WRITE8_MEMBER( segment_w ); - DECLARE_READ8_MEMBER( page_r ); - DECLARE_WRITE8_MEMBER( page_w ); - DECLARE_WRITE8_MEMBER( dmamap_w ); - - DECLARE_READ8_MEMBER( dma0_mreq_r ) { return dma_mreq_r(DMAMAP_R0_LO, offset); } - DECLARE_WRITE8_MEMBER( dma0_mreq_w ) { dma_mreq_w(DMAMAP_R0_LO, offset, data); } - DECLARE_READ8_MEMBER( dma0_iorq_r ) { return dma_iorq_r(DMAMAP_R0_LO, offset); } - DECLARE_WRITE8_MEMBER( dma0_iorq_w ) { dma_iorq_w(DMAMAP_R0_LO, offset, data); } - DECLARE_READ8_MEMBER( dma1_mreq_r ) { return dma_mreq_r(DMAMAP_R1_LO, offset); } - DECLARE_WRITE8_MEMBER( dma1_mreq_w ) { dma_mreq_w(DMAMAP_R1_LO, offset, data); } - DECLARE_READ8_MEMBER( dma1_iorq_r ) { return dma_iorq_r(DMAMAP_R1_LO, offset); } - DECLARE_WRITE8_MEMBER( dma1_iorq_w ) { dma_iorq_w(DMAMAP_R1_LO, offset, data); } - DECLARE_READ8_MEMBER( dma2_mreq_r ) { return dma_mreq_r(DMAMAP_R2_LO, offset); } - DECLARE_WRITE8_MEMBER( dma2_mreq_w ) { dma_mreq_w(DMAMAP_R2_LO, offset, data); } - DECLARE_READ8_MEMBER( dma2_iorq_r ) { return dma_iorq_r(DMAMAP_R2_LO, offset); } - DECLARE_WRITE8_MEMBER( dma2_iorq_w ) { dma_iorq_w(DMAMAP_R2_LO, offset, data); } - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const; - -private: - enum - { - DMAMAP_R2_LO = 0, - DMAMAP_R2_HI, - DMAMAP_R1_LO = 4, - DMAMAP_R1_HI, - DMAMAP_R0_LO, - DMAMAP_R0_HI - }; - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - int get_current_task(offs_t offset); - offs_t get_segment_address(offs_t offset); - offs_t get_page_address(offs_t offset, UINT8 segd); - offs_t translate_address(offs_t offset, int *nonx, int *wp); - UINT8 read_user_memory(offs_t offset); - void write_user_memory(offs_t offset, UINT8 data); - int get_fc(); - UINT8 read_supervisor_memory(address_space &space, offs_t offset); - void write_supervisor_memory(address_space &space, offs_t offset, UINT8 data); - offs_t get_dma_address(int index, UINT16 offset); - UINT8 dma_mreq_r(int index, UINT16 offset); - void dma_mreq_w(int index, UINT16 offset, UINT8 data); - UINT8 dma_iorq_r(int index, UINT16 offset); - void dma_iorq_w(int index, UINT16 offset, UINT8 data); - - const address_space_config m_space_config; - - required_memory_region m_rom; - optional_shared_ptr m_segment_ram; - optional_shared_ptr m_page_ram; - - const char *m_cpu_tag; - m68000_base_device *m_cpu; - - int m_ifc2; - UINT8 m_task; - UINT8 m_dmamap[8]; - UINT8 m_cause; -}; - - -// device type definition -extern const device_type ABC1600_MAC; - - - -#endif diff --git a/src/mess/machine/abc80kb.c b/src/mess/machine/abc80kb.c deleted file mode 100644 index dd9471f5ee4..00000000000 --- a/src/mess/machine/abc80kb.c +++ /dev/null @@ -1,205 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Luxor ABC-80 keyboard emulation - -**********************************************************************/ - -/* - -PCB Layout ----------- - -KTC 65-01870-001 (dated 1978) -PCB-002B - - |---------------| -|---| CN1 |---------------------------------------------------| -| | -| LS06 LS04 LS04 LS06 LS00 LS123 | -| LS74 PROM MCU 4051 900C | -| | -| | -| | -| | -| | -| | -| | -| | -|-----------------------------------------------------------------------| - -Notes: - All IC's shown. - - MCU - General Instruments 30293B-013 20-04592-013 (?) - PROM - Synertek N82S141N 512x8 bipolar PROM "053" - 900C - Ferranti Interdesign 900C custom (?) - CN1 - keyboard data connector - -*/ - -/* - -PCB Layout ----------- - -KTC A65-01870-001 (dated 1983) -PCB-201C - - |---------------| -|---| CN1 |---------------------------------------------------| -| | -| LS06 LS04 LS04 LS00 LS123 | -| MCU 4051 900C | -| | -| | -| | -| | -| | -| | -| | -| | -|-----------------------------------------------------------------------| - -Notes: - All IC's shown. - - MCU - General Instruments 30293B-047 20-04592-047 (?) - 900C - Ferranti Interdesign 900C custom (?) - CN1 - keyboard data connector - -*/ - -#include "abc80kb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8048_TAG "i8048" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type ABC80_KEYBOARD = &device_creator; - - -//------------------------------------------------- -// ROM( abc80_keyboard ) -//------------------------------------------------- - -ROM_START( abc80_keyboard ) - ROM_REGION( 0x400, I8048_TAG, 0 ) - ROM_LOAD( "053.z5", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *abc80_keyboard_device::device_rom_region() const -{ - return ROM_NAME( abc80_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( abc80_keyboard_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( abc80_keyboard_io, AS_IO, 8, abc80_keyboard_device ) -ADDRESS_MAP_END - - -//------------------------------------------------- -// MACHINE_DRIVER( abc80_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( abc80_keyboard ) - MCFG_CPU_ADD(I8048_TAG, I8048, 4000000) - MCFG_CPU_IO_MAP(abc80_keyboard_io) - MCFG_DEVICE_DISABLE() -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor abc80_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( abc80_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( abc80_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( abc80_keyboard ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor abc80_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( abc80_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// abc80_keyboard_device - constructor -//------------------------------------------------- - -abc80_keyboard_device::abc80_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ABC80_KEYBOARD, "ABC-80 Keyboard", tag, owner, clock, "abc80kb", __FILE__), - m_write_keydown(*this), - m_maincpu(*this, I8048_TAG) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void abc80_keyboard_device::device_start() -{ - // resolve callbacks - m_write_keydown.resolve_safe(); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void abc80_keyboard_device::device_reset() -{ -} - - -//------------------------------------------------- -// data_r - keyboard data read -//------------------------------------------------- - -UINT8 abc80_keyboard_device::data_r() -{ - return 0; -} diff --git a/src/mess/machine/abc80kb.h b/src/mess/machine/abc80kb.h deleted file mode 100644 index d4d9a7fc08b..00000000000 --- a/src/mess/machine/abc80kb.h +++ /dev/null @@ -1,74 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Luxor ABC-80 keyboard emulation - -**********************************************************************/ - -#pragma once - -#ifndef __ABC80_KEYBOARD__ -#define __ABC80_KEYBOARD__ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define ABC80_KEYBOARD_TAG "abc80kb" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_ABC80_KEYBOARD_KEYDOWN_CALLBACK(_write) \ - devcb = &abc80_keyboard_device::set_keydown_wr_callback(*device, DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> abc80_keyboard_device - -class abc80_keyboard_device : public device_t -{ -public: - // construction/destruction - abc80_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_keydown_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_keydown.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - UINT8 data_r(); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - devcb_write_line m_write_keydown; - - required_device m_maincpu; -}; - - -// device type definition -extern const device_type ABC80_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/ac1.c b/src/mess/machine/ac1.c deleted file mode 100644 index e504807ef96..00000000000 --- a/src/mess/machine/ac1.c +++ /dev/null @@ -1,108 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - AC1 video driver by Miodrag Milanovic - - 15/01/2009 Preliminary driver. - -****************************************************************************/ - -#include "emu.h" -#include "machine/z80pio.h" -#include "imagedev/cassette.h" -#include "includes/ac1.h" - -READ8_MEMBER(ac1_state::ac1_port_b_r) -{ - UINT8 data = 0x7f; - - if (m_cassette->input() > 0.03) - data |= 0x80; - - return data; -} - -#define BNOT(x) ((x) ? 0 : 1) - -READ8_MEMBER(ac1_state::ac1_port_a_r) -{ - UINT8 line0 = m_io_line[0]->read(); - UINT8 line1 = m_io_line[1]->read(); - UINT8 line2 = m_io_line[2]->read(); - UINT8 line3 = m_io_line[3]->read(); - UINT8 line4 = m_io_line[4]->read(); - UINT8 line5 = m_io_line[5]->read(); - UINT8 line6 = m_io_line[6]->read(); - - UINT8 SH = BNOT(BIT(line6,0)); - UINT8 CTRL = BNOT(BIT(line6,1)); - UINT8 SPACE = BIT(line6,2); - UINT8 ENTER = BIT(line6,3); - UINT8 BACK = BIT(line6,4); - - UINT8 all = line0 | line1 | line2 | line3 | line4 | line5; - UINT8 s1 = BNOT(BIT(all,0));UINT8 z1 = (line0 !=0) ? 0 : 1; - UINT8 s2 = BNOT(BIT(all,1));UINT8 z2 = (line1 !=0) ? 0 : 1; - UINT8 s3 = BNOT(BIT(all,2));UINT8 z3 = (line2 !=0) ? 0 : 1; - UINT8 s4 = BNOT(BIT(all,3));UINT8 z4 = (line3 !=0) ? 0 : 1; - UINT8 s5 = BNOT(BIT(all,4));UINT8 z5 = (line4 !=0) ? 0 : 1; - UINT8 s6 = BNOT(BIT(all,5));UINT8 z6 = (line5 !=0) ? 0 : 1; - UINT8 s7 = BNOT(BIT(all,6)); - UINT8 s8 = BNOT(BIT(all,7)); - UINT8 tast,td0,td1,td2,td3,td4,td5,td6,dg5; - - /* Additional double keys */ - if (SPACE) { - z1 = 0; s1 = 0; SH = 0; - } - if (ENTER) { - z4 = 0; s6 = 0; CTRL = 0; - } - if (BACK) { - z4 = 0; s1 = 0; CTRL = 0; - } - - tast = BNOT(s1 & s2 & s3 & s4 & s5 &s6 & s7 & s8); - td0 = BNOT(s2 & s4 & s6 & s8); - td1 = BNOT(s3 & s4 & s7 & s8); - td2 = BNOT(s5 & s6 & s7 & s8); - td3 = BNOT(z2 & z4 & z6); - td4 = BNOT(BNOT(BNOT(z1 & z2) & SH) & z5 & z6); - dg5 = BNOT(z3 & z4 & z5 & z6); - td5 = BNOT(BNOT(dg5 & BNOT(SH)) & z1 & z2); - td6 = (dg5 & CTRL); - return td0 + (td1 << 1) +(td2 << 2) +(td3 << 3) +(td4 << 4) +(td5 << 5) +(td6 << 6) +(tast << 7); -} - -WRITE8_MEMBER(ac1_state::ac1_port_a_w) -{ -} - -WRITE8_MEMBER(ac1_state::ac1_port_b_w) -{ - /* - - bit description - - 0 - 1 RTTY receive - 2 RTTY transmit - 3 RTTY PTT - 4 - 5 - 6 cassette out - 7 cassette in - - */ - m_cassette->output((data & 0x40) ? -1.0 : +1.0); -} - -/* Driver initialization */ -DRIVER_INIT_MEMBER(ac1_state,ac1) -{ -} - -void ac1_state::machine_reset() -{ -} diff --git a/src/mess/machine/advision.c b/src/mess/machine/advision.c deleted file mode 100644 index 4f1f19b105e..00000000000 --- a/src/mess/machine/advision.c +++ /dev/null @@ -1,193 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - advision.c - - Machine file to handle emulation of the AdventureVision. - -***************************************************************************/ - -#include "emu.h" -#include "includes/advision.h" -#include "cpu/mcs48/mcs48.h" -#include "sound/dac.h" - -/* - 8048 Ports: - - P1 Bit 0..1 - RAM bank select - Bit 3..7 - Keypad input - - P2 Bit 0..3 - A8-A11 - Bit 4..7 - Sound control/Video write address - - T1 Mirror sync pulse -*/ - -/* Machine Initialization */ - -void advision_state::machine_start() -{ - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - /* configure EA banking */ - m_bank1->configure_entry(0, memregion(I8048_TAG)->base()); - m_bank1->configure_entry(1, m_cart_rom->base()); - m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1"); - m_bank1->set_entry(0); - - /* allocate external RAM */ - m_ext_ram.resize(0x400); - save_item(NAME(m_ext_ram)); - - save_item(NAME(m_ea_bank)); - save_item(NAME(m_rambank)); - save_item(NAME(m_frame_count)); - save_item(NAME(m_frame_start)); - save_item(NAME(m_video_enable)); - save_item(NAME(m_video_bank)); - save_item(NAME(m_led_latch)); - save_item(NAME(m_sound_cmd)); - save_item(NAME(m_sound_d)); - save_item(NAME(m_sound_g)); -} - -void advision_state::machine_reset() -{ - m_ea_bank = 0; - m_rambank = 0x300; - m_frame_start = 0; - m_video_enable = 0; - m_sound_cmd = 0; - - /* enable internal ROM */ - m_maincpu->set_input_line(MCS48_INPUT_EA, CLEAR_LINE); - m_bank1->set_entry(m_ea_bank); - - /* reset sound CPU */ - m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); -} - -/* Bank Switching */ - -WRITE8_MEMBER( advision_state::bankswitch_w ) -{ - m_ea_bank = BIT(data, 2); - m_rambank = (data & 0x03) << 8; - - m_maincpu->set_input_line(MCS48_INPUT_EA, m_ea_bank ? ASSERT_LINE : CLEAR_LINE); - if (m_cart_rom) - m_bank1->set_entry(m_ea_bank); -} - -/* External RAM */ - -READ8_MEMBER( advision_state::ext_ram_r ) -{ - UINT8 data = m_ext_ram[m_rambank + offset]; - - if (!m_video_enable) - { - /* the video hardware interprets reads as writes */ - vh_write(data); - } - - if (m_video_bank == 0x06) - { - m_soundcpu->set_input_line(INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); - } - - return data; -} - -WRITE8_MEMBER( advision_state::ext_ram_w ) -{ - m_ext_ram[m_rambank + offset] = data; -} - -/* Sound */ - -READ8_MEMBER( advision_state::sound_cmd_r ) -{ - return m_sound_cmd; -} - -void advision_state::update_dac() -{ - if (m_sound_g == 0 && m_sound_d == 0) - m_dac->write_unsigned8(0xff); - else if (m_sound_g == 1 && m_sound_d == 1) - m_dac->write_unsigned8(0x80); - else - m_dac->write_unsigned8(0x00); -} - -WRITE8_MEMBER( advision_state::sound_g_w ) -{ - m_sound_g = data & 0x01; - - update_dac(); -} - -WRITE8_MEMBER( advision_state::sound_d_w ) -{ - m_sound_d = data & 0x01; - - update_dac(); -} - -/* Video */ - -WRITE8_MEMBER( advision_state::av_control_w ) -{ - m_sound_cmd = data >> 4; - - if ((m_video_enable == 0x00) && (data & 0x10)) - { - vh_update(m_video_hpos); - - m_video_hpos++; - - if (m_video_hpos > 255) - { - m_video_hpos = 0; - logerror("HPOS OVERFLOW\n"); - } - } - - m_video_enable = data & 0x10; - m_video_bank = (data & 0xe0) >> 5; -} - -READ8_MEMBER( advision_state::vsync_r ) -{ - if (m_frame_start) - { - m_frame_start = 0; - - return 0; - } - else - { - return 1; - } -} - -/* Input */ - -READ8_MEMBER( advision_state::controller_r ) -{ - // Get joystick switches - UINT8 in = m_joy->read(); - UINT8 data = in | 0x0f; - - // Get buttons - if (in & 0x02) data = data & 0xf7; /* Button 3 */ - if (in & 0x08) data = data & 0xcf; /* Button 1 */ - if (in & 0x04) data = data & 0xaf; /* Button 2 */ - if (in & 0x01) data = data & 0x6f; /* Button 4 */ - - return data & 0xf8; -} diff --git a/src/mess/machine/aim65.c b/src/mess/machine/aim65.c deleted file mode 100644 index 3e7d4f2a309..00000000000 --- a/src/mess/machine/aim65.c +++ /dev/null @@ -1,424 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner, Dan Boris, Dirk Best, Robbbert -/****************************************************************************** - - AIM65 - -******************************************************************************/ - - -#include "includes/aim65.h" - - -/****************************************************************************** - Interrupt handling -******************************************************************************/ - -/* STEP/RUN - * - * Switch S2 (STEP/RUN) causes AIM 65 to operate either in the RUN mode or the - * single STEP mode. In the STEP mode, the NMI interrupt line is driven low - * when SYNC and O2 go high during instruction execution if the address lines - * are outside the A000-FFFF range. The NMI interrupt occurs on the high to - * low transition of the NMI line. The Monitor software will trace instructions - * and register, outside the Monitor instruction address range if the trace - * modes are selected and the NMI Interrupt Routine is not bypassed. - */ - - - -/****************************************************************************** - 6821 PIA -******************************************************************************/ - -/* PA0: A0 (Address) - * PA1: A1 (Address) - * PA2: CE1 (Chip enable) - * PA3: CE2 (Chip enable) - * PA4: CE3 (Chip enable) - * PA5: CE4 (Chip enable) - * PA6: CE5 (Chip enable) - * PA7: W (Write enable) - * PB0-6: D0-D6 (Data) - * PB7: CU (Cursor) - */ - -void aim65_state::dl1416_update(dl1416_device *device, int index) -{ - device->ce_w(m_pia_a & (0x04 << index)); - device->wr_w(BIT(m_pia_a, 7)); - device->cu_w(BIT(m_pia_b, 7)); - device->data_w(generic_space(), m_pia_a & 0x03, m_pia_b & 0x7f); -} - -void aim65_state::aim65_pia() -{ - dl1416_update(m_ds1, 0); - dl1416_update(m_ds2, 1); - dl1416_update(m_ds3, 2); - dl1416_update(m_ds4, 3); - dl1416_update(m_ds5, 4); -} - - -WRITE8_MEMBER( aim65_state::aim65_pia_a_w ) -{ - m_pia_a = data; - aim65_pia(); -} - - -WRITE8_MEMBER( aim65_state::aim65_pia_b_w ) -{ - m_pia_b = data; - aim65_pia(); -} - - -WRITE16_MEMBER( aim65_state::aim65_update_ds1) -{ - output_set_digit_value(0 + (offset ^ 3), data); -} - -WRITE16_MEMBER( aim65_state::aim65_update_ds2) -{ - output_set_digit_value(4 + (offset ^ 3), data); -} - -WRITE16_MEMBER( aim65_state::aim65_update_ds3) -{ - output_set_digit_value(8 + (offset ^ 3), data); -} - -WRITE16_MEMBER( aim65_state::aim65_update_ds4) -{ - output_set_digit_value(12 + (offset ^ 3), data); -} - -WRITE16_MEMBER( aim65_state::aim65_update_ds5) -{ - output_set_digit_value(16 + (offset ^ 3), data); -} - - - -/****************************************************************************** - 6532 RIOT -******************************************************************************/ - - -READ8_MEMBER( aim65_state::aim65_riot_b_r ) -{ - static const char *const keynames[] = - { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", - "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" - }; - - UINT8 row, data = 0xff; - - /* scan keyboard rows */ - for (row = 0; row < 8; row++) - { - if (!BIT(m_riot_port_a, row)) - data &= ioport(keynames[row])->read(); - } - - return data; -} - - -WRITE8_MEMBER( aim65_state::aim65_riot_a_w ) -{ - m_riot_port_a = data; -} - - - -/*************************************************************************** - DRIVER INIT -***************************************************************************/ - -void aim65_state::machine_start() -{ - ram_device *ram = m_ram; - address_space &space = m_maincpu->space(AS_PROGRAM); - - // Init ROM sockets - if (m_z24->exists()) - space.install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_z24)); - if (m_z25->exists()) - space.install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_z25)); - if (m_z26->exists()) - space.install_read_handler(0xb000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_z26)); - - // Init RAM - space.install_ram(0x0000, ram->size() - 1, ram->pointer()); - - m_pb_save = 0; -} - - -/* RESET - * - * Pushbutton switch S1 initiates RESET of the AIM65 hardware and software. - * Timer Z4 holds the RES low for at least 15 ms from the time the pushbutton - * is released. RES is routed to the R6502 CPU, the Monitor R6522 (Z32), the - * Monitor R6532 RIOT (Z33), the user R6522 VIA (Z1), and the display R6520 PIA - * (U1). To initiate the device RESET function is also routed to the expansion - * connector for off-board RESET functions. The Monitor performs a software - * reset when the RES line goes high. - */ - - -/****************************************************************************** - Cassette -******************************************************************************/ - -WRITE8_MEMBER( aim65_state::aim65_pb_w ) -{ -/* - d7 = cass out (both decks) - d5 = cass2 motor - d4 = cass1 motor - d2 = tty out (not emulated) - d0/1 = printer data (not emulated) -*/ - - UINT8 bits = data ^ m_pb_save; - m_pb_save = data; - - if (BIT(bits, 7)) - { - m_cassette1->output(BIT(data, 7) ? -1.0 : +1.0); - m_cassette2->output(BIT(data, 7) ? -1.0 : +1.0); - } - - if (BIT(bits, 5)) - { - if (BIT(data, 5)) - m_cassette2->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - else - m_cassette2->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - } - - if (BIT(bits, 4)) - { - if (BIT(data, 4)) - m_cassette1->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - else - m_cassette1->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - } -} - - -READ8_MEMBER( aim65_state::aim65_pb_r ) -{ -/* - d7 = cassette in (deck 1) - d6 = tty in (not emulated) - d3 = kb/tty switch -*/ - - UINT8 data = ioport("switches")->read(); - data |= (m_cassette1->input() > +0.03) ? 0x80 : 0; - data |= 0x40; // TTY must be H if not used. - data |= m_pb_save & 0x37; - return data; -} - - -/****************************************************************************** - Printer -******************************************************************************/ - -#ifdef UNUSED_FUNCTION -/* - -2012-01-24 Printer code removed [Robbbert] - -From here to the end is not compiled. It is the remnants of the old printer -code. Have a look at version 0.114 or 0.115 for the original working code. - -I've left it here for the idly curious. - -The system sends out the pattern of dots to the 'dot-matrix' print-head. - -This is why we can't simply replace it with a Centronics-like 'Printer' -device - the output will be gibberish. -*/ - - - -/* - aim65 thermal printer (20 characters) - 10 heat elements (place on 1 line, space between 2 characters(about 14dots)) - (pa0..pa7,pb0,pb1 1 heat element on) - - cb2 0 motor, heat elements on - cb1 output start!? - ca1 input - - normally printer 5x7 characters - (horizontal movement limits not known, normally 2 dots between characters) - - 3 dots space between lines? -*/ - - -/* Part of aim65_pb_w - - data &= 0x03; - - if (m_flag_b == 0) - { - printerRAM[(m_printer_y * 20) + m_printer_x ] |= (data << 8); - m_flag_b = 1; - } -*/ - - -/* Items for driver state - - emu_timer *m_print_timer; - int m_printer_x; - int m_printer_y; - bool m_printer_dir; - bool m_flag_a; - bool m_flag_b; - bool m_printer_level; - UINT16 *m_printerRAM; -*/ - - -/* Other items from H file - -VIDEO_UPDATE( aim65 ); -*/ - - -/* From 6522 config -DRIVER_MEMBER(aim65_state, aim65_pa_w), // out port A -DRIVER_MEMBER(aim65_state, aim65_printer_on), // out CB2 -*/ - - -/* From Machine Config - MCFG_VIDEO_START_OVERRIDE(aim65_state,aim65) - MCFG_VIDEO_UPDATE(aim65) -*/ - - -TIMER_CALLBACK_MEMBER(aim65_state::aim65_printer_timer) -{ - via6522_device *via_0 = machine().device("via6522_0"); - - via_0->write_cb1(m_printer_level); - via_0->write_cb1(!m_printer_level); - m_printer_level ^= 1; - - if (m_printer_dir) - { - if (m_printer_x > 0) - m_printer_x--; - else - { - m_printer_dir = 0; - m_printer_x++; - m_printer_y++; - } - } - else - { - if (m_printer_x < 9) - m_printer_x++; - else - { - m_printer_dir = 1; - m_printer_x--; - m_printer_y++; - } - } - - if (m_printer_y > 500) m_printer_y = 0; - - m_flag_a=0; - m_flag_b=0; -} - - -WRITE8_MEMBER( aim65_state::aim65_printer_on ) -{ - via6522_device *via_0 = machine().device("via6522_0"); - if (!data) - { - m_printer_x=0; - m_printer_y++; - if (m_printer_y > 500) m_printer_y = 0; - m_flag_a = m_flag_b=0; - via_0->write_cb1(0); - m_print_timer->adjust(attotime::zero, 0, attotime::from_usec(10)); - m_printer_level = 1; - } - else - m_print_timer->reset(); -} - - -WRITE8_MEMBER( aim65_state::aim65_pa_w ) -{ -// All bits are for printer data (not emulated) - if (m_flag_a == 0) - { - m_printerRAM[(m_printer_y * 20) + m_printer_x] |= data; - m_flag_a = 1; - } -} - -VIDEO_START_MEMBER(aim65_state,aim65) -{ - m_print_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aim65_state::aim65_printer_timer),this)); - m_printerRAM = auto_alloc_array(machine(), UINT16, (600 * 10 * 2) / 2); - memset(m_printerRAM, 0, videoram_size); - VIDEO_START_CALL_MEMBER(generic); - m_printer_x = 0; - m_printer_y = 0; - m_printer_dir = 0; - m_flag_a = 0; - m_flag_b = 0; - m_printer_level = 0; -} - -SCREEN_UPDATE( aim65 ) -{ - aim65_state *state = screen.machine().driver_data(); - /* Display printer output */ - bool dir = 1; - UINT8 b,x,pen; - UINT16 y; - - for (y = 0; y<500; y++) - { - for(x = 0; x< 10; x++) - { - if (dir == 1) - data = state->m_printerRAM[y * 10 + x]; - else - data = state->m_printerRAM[(y * 10) + (9 - x)]; - - - for (b = 0; b<10; b++) - { - pen = screen.m_palette->pen(BIT(data, 0) ? 2 : 0); - plot_pixel(bitmap,700 - ((b * 10) + x), y, pen); - data >>= 1; - } - } - - dir ^= 1; - } - return 0; -} - - -#endif diff --git a/src/mess/machine/amigakbd.c b/src/mess/machine/amigakbd.c deleted file mode 100644 index c6d1bb05d34..00000000000 --- a/src/mess/machine/amigakbd.c +++ /dev/null @@ -1,574 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Amiga Keyboard - - We currently emulate the Amiga 500 keyboard controller, which was - also used in later Amiga 2000 keyboards. - - TODO: - Natural keyboard mode doesn't work with shifted characters, - they get sent in the wrong order (core bug?) - - Move 6500/1 to its own CPU core so that it can be shared with - other systems - - Add support for more keyboard controllers (pending on them - getting dumped) - - Amiga 1000 keyboard part numbers (manufactured by Mitsumi): - - - 327063-01 R56-2144 English - - 327063-02 British - - 327063-03 R56-2153 German - - 327063-04 R56-2152 French - - 327063-05 R56-2154 Italian - -***************************************************************************/ - -#include "amigakbd.h" -#include "machine/rescap.h" - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type AMIGAKBD = &device_creator; - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -static ADDRESS_MAP_START( mpu6500_map, AS_PROGRAM, 8, amigakbd_device ) - ADDRESS_MAP_GLOBAL_MASK(0xfff) - AM_RANGE(0x000, 0x03f) AM_RAM - AM_RANGE(0x080, 0x080) AM_READWRITE(port_a_r, port_a_w) - AM_RANGE(0x081, 0x081) AM_READ_PORT("special") AM_WRITE(port_b_w) - AM_RANGE(0x082, 0x082) AM_WRITE(port_c_w) - AM_RANGE(0x083, 0x083) AM_WRITE(port_d_w) - AM_RANGE(0x084, 0x085) AM_WRITE(latch_w) - AM_RANGE(0x086, 0x087) AM_READ(counter_r) - AM_RANGE(0x088, 0x088) AM_WRITE(transfer_latch_w) - AM_RANGE(0x089, 0x089) AM_WRITE(clear_pa0_detect) - AM_RANGE(0x08a, 0x08a) AM_WRITE(clear_pa1_detect) - AM_RANGE(0x08f, 0x08f) AM_READWRITE(control_r, control_w) - AM_RANGE(0x090, 0x0ff) AM_NOP - AM_RANGE(0x800, 0xfff) AM_ROM AM_REGION("mos6570_036", 0) -ADDRESS_MAP_END - -static MACHINE_CONFIG_FRAGMENT( a500_keyboard ) - MCFG_CPU_ADD("mos6570_036", M6502, XTAL_3MHz / 2) - MCFG_CPU_PROGRAM_MAP(mpu6500_map) -MACHINE_CONFIG_END - -machine_config_constructor amigakbd_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( a500_keyboard ); -} - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -ROM_START( mos6570_036 ) - ROM_REGION(0x800, "mos6570_036", 0) - ROM_LOAD("328191-02.ic1", 0x000, 0x800, CRC(4a3fc332) SHA1(83b21d0c8b93fc9b9b3b287fde4ec8f3badac5a2)) -ROM_END - -const rom_entry *amigakbd_device::device_rom_region() const -{ - return ROM_NAME( mos6570_036 ); -} - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( a500_us_keyboard ) - PORT_START("special") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, NULL) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Ctrl") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, NULL) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, amigakbd_device, check_reset, NULL) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - - PORT_START("row_d6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("Unused") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_NAME("Caps Lock") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("(") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_d0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c7") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME(")") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c6") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c5") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c4") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c3") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Unused") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c1") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("row_c0") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("Help") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - -ioport_constructor amigakbd_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( a500_us_keyboard ); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// amigakbd_device - constructor -//------------------------------------------------- - -amigakbd_device::amigakbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, AMIGAKBD, "Amiga 500 Keyboard with 6570-036 MPU", tag, owner, clock, "amigakbd", __FILE__), - m_write_kclk(*this), - m_write_kdat(*this), - m_write_krst(*this), - m_mpu(*this, "mos6570_036"), - m_special(*this, "special"), - m_row_d6(*this, "row_d6"), - m_row_d5(*this, "row_d5"), - m_row_d4(*this, "row_d4"), - m_row_d3(*this, "row_d3"), - m_row_d2(*this, "row_d2"), - m_row_d1(*this, "row_d1"), - m_row_d0(*this, "row_d0"), - m_row_c7(*this, "row_c7"), - m_row_c6(*this, "row_c6"), - m_row_c5(*this, "row_c5"), - m_row_c4(*this, "row_c4"), - m_row_c3(*this, "row_c3"), - m_row_c2(*this, "row_c2"), - m_row_c1(*this, "row_c1"), - m_row_c0(*this, "row_c0"), - m_timer(NULL), - m_watchdog(NULL), - m_reset(NULL), - m_kdat(1), - m_kclk(1), - m_port_c(0xff), - m_port_d(0xff), - m_latch(0xffff), - m_counter(0xffff), - m_control(0x00) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void amigakbd_device::device_start() -{ - // resolve callbacks - m_write_kclk.resolve_safe(); - m_write_kdat.resolve_safe(); - m_write_krst.resolve_safe(); - - // allocate timers - m_timer = timer_alloc(0, NULL); - m_watchdog = timer_alloc(1, NULL); - m_reset = timer_alloc(2, NULL); - - // register for save states - save_item(NAME(m_kdat)); - save_item(NAME(m_kclk)); - save_item(NAME(m_port_c)); - save_item(NAME(m_port_d)); - save_item(NAME(m_latch)); - save_item(NAME(m_counter)); - save_item(NAME(m_control)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void amigakbd_device::device_reset() -{ - // stack starts 0 - m_mpu->set_state_int(M6502_S, 0); - - m_kdat = 1; - m_kclk = 1; - m_port_c = 0xff; - m_port_d = 0xff; - m_latch = 0xffff; // not initialized by hardware - m_counter = 0xffff; // not initialized by hardware - m_control = 0x00; - - m_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL_3MHz / 2)); - m_watchdog->adjust(attotime::from_msec(54)); -} - -void amigakbd_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) -{ - switch (tid) - { - // 6500/1 internal timer - case 0: - switch (m_control & 0x03) - { - // interval timer, pulse width measurement (connected to gnd here) - case 0: - case 3: - if (m_counter-- == 0) - { - // counter overflow - m_control |= COUNTER_OVERFLOW; - m_counter = m_latch; - - // generate interrupt? - update_irqs(); - } - break; - - // pulse generator - case 1: - break; - - // event counter - case 2: - break; - } - break; - - // watchdog - case 1: - m_mpu->reset(); - m_watchdog->adjust(attotime::from_msec(54)); - break; - - // keyboard reset timer - case 2: - m_write_krst(1); - break; - } -} - - -//************************************************************************** -// IMPLEMENTATION -//************************************************************************** - -INPUT_CHANGED_MEMBER( amigakbd_device::check_reset ) -{ - UINT8 keys = m_special->read(); - - // ctrl-amiga-amiga pressed? - if (!BIT(keys, 6) && !BIT(keys, 3) && !BIT(keys, 2)) - { - m_write_krst(0); - m_reset->adjust(PERIOD_OF_555_MONOSTABLE(RES_K(47), CAP_U(10))); - } -} - -void amigakbd_device::update_irqs() -{ - if ((m_control & PA1_INT_ENABLED) && (m_control & PA1_NEGATIVE_EDGE)) - m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - - else if ((m_control & PA0_INT_ENABLED) && (m_control & PA0_POSITIVE_EDGE)) - m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - - else if ((m_control & COUNTER_INT_ENABLED) && (m_control & COUNTER_OVERFLOW)) - m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - - else - m_mpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); -} - -READ8_MEMBER( amigakbd_device::port_a_r ) -{ - UINT8 data = 0xfc; - - // kdat & kclk - data |= m_kdat << 0; - data |= m_kclk << 1; - - // port d rows - if (!BIT(m_port_d, 6)) data &= m_row_d6->read(); - if (!BIT(m_port_d, 5)) data &= m_row_d5->read(); - if (!BIT(m_port_d, 4)) data &= m_row_d4->read(); - if (!BIT(m_port_d, 3)) data &= m_row_d3->read(); - if (!BIT(m_port_d, 2)) data &= m_row_d2->read(); - if (!BIT(m_port_d, 1)) data &= m_row_d1->read(); - if (!BIT(m_port_d, 0)) data &= m_row_d0->read(); - - // port c rows - if (!BIT(m_port_c, 7)) data &= m_row_c7->read(); - if (!BIT(m_port_c, 6)) data &= m_row_c6->read(); - if (!BIT(m_port_c, 5)) data &= m_row_c5->read(); - if (!BIT(m_port_c, 4)) data &= m_row_c4->read(); - if (!BIT(m_port_c, 3)) data &= m_row_c3->read(); - if (!BIT(m_port_c, 2)) data &= m_row_c2->read(); - if (!BIT(m_port_c, 1)) data &= m_row_c1->read(); - if (!BIT(m_port_c, 0)) data &= m_row_c0->read(); - - return data; -} - -WRITE8_MEMBER( amigakbd_device::port_a_w ) -{ - // look for pa0 edge - if (!m_kdat && BIT(data, 0)) - { - m_control |= PA0_POSITIVE_EDGE; - update_irqs(); - } - - // and pa1 edge - if (m_kclk && !BIT(data, 1)) - { - m_control |= PA1_NEGATIVE_EDGE; - update_irqs(); - } - - // update with new values and output - if (m_kdat != BIT(data, 0)) - { - m_kdat = BIT(data, 0); - m_write_kdat(m_kdat); - } - - if (m_kclk != BIT(data, 1)) - { - m_kclk = BIT(data, 1); - m_write_kclk(m_kclk); - } -} - -WRITE8_MEMBER( amigakbd_device::port_b_w ) -{ - // caps lock led - output_set_value("led0", BIT(data, 7)); -} - -WRITE8_MEMBER( amigakbd_device::port_c_w ) -{ - m_port_c = data; -} - -WRITE8_MEMBER( amigakbd_device::port_d_w ) -{ - // reset watchdog on 0 -> 1 transition - if (!BIT(m_port_d, 7) && BIT(data, 7)) - m_watchdog->adjust(attotime::from_msec(54)); - - m_port_d = data; -} - -WRITE8_MEMBER( amigakbd_device::latch_w ) -{ - if (offset == 0) - { - m_latch &= 0x00ff; - m_latch |= data << 8; - } - else - { - m_latch &= 0xff00; - m_latch |= data << 0; - } -} - -READ8_MEMBER( amigakbd_device::counter_r ) -{ - if (!space.debugger_access()) - { - m_control &= ~COUNTER_OVERFLOW; - update_irqs(); - } - - if (offset == 0) - return m_counter >> 8; - else - return m_counter >> 0; -} - -WRITE8_MEMBER( amigakbd_device::transfer_latch_w ) -{ - m_control &= ~COUNTER_OVERFLOW; - update_irqs(); - - m_latch &= 0x00ff; - m_latch |= data << 8; - - m_counter = m_latch; -} - -WRITE8_MEMBER( amigakbd_device::clear_pa0_detect ) -{ - m_control &= ~PA0_POSITIVE_EDGE; - update_irqs(); -} - -WRITE8_MEMBER( amigakbd_device::clear_pa1_detect ) -{ - m_control &= ~PA1_NEGATIVE_EDGE; - update_irqs(); -} - -READ8_MEMBER( amigakbd_device::control_r ) -{ - return m_control; -} - -WRITE8_MEMBER( amigakbd_device::control_w ) -{ - m_control = data; - update_irqs(); -} - -WRITE_LINE_MEMBER( amigakbd_device::kdat_w ) -{ - // detect positive edge - if (state && !m_kdat) - { - m_control |= PA0_POSITIVE_EDGE; - update_irqs(); - } - - m_kdat = state; -} diff --git a/src/mess/machine/amigakbd.h b/src/mess/machine/amigakbd.h deleted file mode 100644 index 68ffdb42200..00000000000 --- a/src/mess/machine/amigakbd.h +++ /dev/null @@ -1,144 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - Amiga Keyboard - - We currently emulate the Amiga 500 keyboard controller, which was - also used in later Amiga 2000 keyboards. - -***************************************************************************/ - -#pragma once - -#ifndef __AMIGAKBD_H__ -#define __AMIGAKBD_H__ - -#include "emu.h" -#include "cpu/m6502/m6502.h" - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_AMIGA_KEYBOARD_KCLK_CALLBACK(_write) \ - devcb = &amigakbd_device::set_kclk_wr_callback(*device, DEVCB_##_write); - -#define MCFG_AMIGA_KEYBOARD_KDAT_CALLBACK(_write) \ - devcb = &amigakbd_device::set_kdat_wr_callback(*device, DEVCB_##_write); - -#define MCFG_AMIGA_KEYBOARD_KRST_CALLBACK(_write) \ - devcb = &amigakbd_device::set_krst_wr_callback(*device, DEVCB_##_write); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> amigakbd_device - -class amigakbd_device : public device_t -{ -public: - // construction/destruction - amigakbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_kclk_wr_callback(device_t &device, _Object object) - { return downcast(device).m_write_kclk.set_callback(object); } - template static devcb_base &set_kdat_wr_callback(device_t &device, _Object object) - { return downcast(device).m_write_kdat.set_callback(object); } - template static devcb_base &set_krst_wr_callback(device_t &device, _Object object) - { return downcast(device).m_write_krst.set_callback(object); } - - DECLARE_WRITE_LINE_MEMBER( kdat_w ); - - // 6500/1 internal - DECLARE_READ8_MEMBER( port_a_r ); - DECLARE_WRITE8_MEMBER( port_a_w ); - DECLARE_READ8_MEMBER( port_b_r ); - DECLARE_WRITE8_MEMBER( port_b_w ); - DECLARE_WRITE8_MEMBER( port_c_w ); - DECLARE_WRITE8_MEMBER( port_d_w ); - DECLARE_WRITE8_MEMBER( latch_w ); - DECLARE_READ8_MEMBER( counter_r ); - DECLARE_WRITE8_MEMBER( transfer_latch_w ); - DECLARE_WRITE8_MEMBER( clear_pa0_detect ); - DECLARE_WRITE8_MEMBER( clear_pa1_detect ); - DECLARE_READ8_MEMBER( control_r ); - DECLARE_WRITE8_MEMBER( control_w ); - - DECLARE_INPUT_CHANGED_MEMBER( check_reset ); - -protected: - // device-level overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - enum - { - // counter modes - COUNTER_INTERVAL = 0x00, - COUNTER_PULSE = 0x01, - COUNTER_EVENT = 0x02, - COUNTER_PWM = 0x03, - - // interrupt enables - PA1_INT_ENABLED = 0x04, - PA0_INT_ENABLED = 0x08, - COUNTER_INT_ENABLED = 0x10, - - // status - PA1_NEGATIVE_EDGE = 0x20, - PA0_POSITIVE_EDGE = 0x40, - COUNTER_OVERFLOW = 0x80 - }; - - void update_irqs(); - - devcb_write_line m_write_kclk; - devcb_write_line m_write_kdat; - devcb_write_line m_write_krst; - - required_device m_mpu; - - required_ioport m_special; - required_ioport m_row_d6; - required_ioport m_row_d5; - required_ioport m_row_d4; - required_ioport m_row_d3; - required_ioport m_row_d2; - required_ioport m_row_d1; - required_ioport m_row_d0; - required_ioport m_row_c7; - required_ioport m_row_c6; - required_ioport m_row_c5; - required_ioport m_row_c4; - required_ioport m_row_c3; - required_ioport m_row_c2; - required_ioport m_row_c1; - required_ioport m_row_c0; - - emu_timer *m_timer; - emu_timer *m_watchdog; - emu_timer *m_reset; - - int m_kdat; - int m_kclk; - - UINT8 m_port_c; - UINT8 m_port_d; - UINT16 m_latch; - UINT16 m_counter; - UINT8 m_control; -}; - -// device type definition -extern const device_type AMIGAKBD; - -#endif // __AMIGAKBD_H__ diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c deleted file mode 100644 index 8dbe941af32..00000000000 --- a/src/mess/machine/amstrad.c +++ /dev/null @@ -1,3332 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Barry Rodewald -/*************************************************************************** - - machine.c - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - -Amstrad hardware consists of: - -- General Instruments AY-3-8912 (audio and keyboard scanning) -- Intel 8255PPI (keyboard, access to AY-3-8912, cassette etc) -- Z80A CPU -- 765 FDC (disc drive interface) -- "Gate Array" (custom chip by Amstrad controlling colour, mode, -rom/ram selection - - -On the Amstrad, any part of the 64k memory can be access by the video -hardware (GA and CRTC - the CRTC specifies the memory address to access, -and the GA fetches 2 bytes of data for each 1us cycle. - -The Z80 must also access the same ram. - -To maintain the screen display, the Z80 is halted on each memory access. - -The result is that timing for opcodes, appears to fall into a nice pattern, -where the time for each opcode can be measured in NOP cycles. NOP cycles is -the name I give to the time taken for one NOP command to execute. - -This happens to be 1us. - -From measurement, there are 64 NOPs per line, with 312 lines per screen. -This gives a total of 19968 NOPs per frame. - -***************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/i8255.h" -#include "machine/mc146818.h" -#include "machine/upd765.h" -#include "bus/centronics/ctronics.h" -#include "bus/cpc/cpc_rom.h" -#include "bus/cpc/mface2.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "includes/amstrad.h" -#include "sound/ay8910.h" -#include "machine/ram.h" - -#define MANUFACTURER_NAME 0x07 -#define TV_REFRESH_RATE 0x10 - -enum { - SYSTEM_CPC, - SYSTEM_ALESTE, - SYSTEM_PLUS, - SYSTEM_GX4000 -}; - - -/* originally from drivers/amstrad.c */ -// &ff,&77,&b3,&51,&a8,&d4,&62,&39,&9c,&46,&2b,&15,&8a,&cd,&ee -// This is the sequence for unlocking the ASIC in the CPC+/GX4000 -// These are outed to port &bc00, after syncing the lock by outing a non-zero value then a zero to &bc00 -// To lock the ASIC again, repeat the sequence without the last &ee -static const UINT8 asic_unlock_seq[15] = -{ - 0xff, 0x77, 0xb3, 0x51, 0xa8, 0xd4, 0x62, 0x39, 0x9c, 0x46, 0x2b, 0x15, 0x8a, 0xcd, 0xee -}; - - - - - -/* Ram configuration */ - -/* pointers to current ram configuration selected for banks */ - -/* the hardware allows selection of 256 ROMs. Rom 0 is usually BASIC and Rom 7 is AMSDOS */ -/* With the CPC hardware, if a expansion ROM is not connected, BASIC rom will be selected instead */ -/* data present on input of ppi, and data written to ppi output */ -#define amstrad_ppi_PortA 0 -#define amstrad_ppi_PortB 1 -#define amstrad_ppi_PortC 2 - - - -/*------------------ - - Ram Management - - ------------------*/ -/* There are 8 different ram configurations which work on the currently selected 64k logical block. - The following tables show the possible ram configurations :*/ -static const int RamConfigurations[8 * 4] = -{ - 0, 1, 2, 3, /* config 0 */ - 0, 1, 2, 7, /* config 1 */ - 4, 5, 6, 7, /* config 2 */ - 0, 3, 2, 7, /* config 3 */ - 0, 4, 2, 3, /* config 4 */ - 0, 5, 2, 3, /* config 5 */ - 0, 6, 2, 3, /* config 6 */ - 0, 7, 2, 3 /* config 7 */ -}; - - - -//static int amstrad_CRTC_CR = 0; /* CR = Cursor Enabled */ - -/* this contains the colours in machine.pens form.*/ -/* this is updated from the eventlist and reflects the current state -of the render colours - these may be different to the current colour palette values */ -/* colours can be changed at any time and will take effect immediatly */ - - - -/* The Amstrad CPC has a fixed palette of 27 colours generated from 3 levels of Red, Green and Blue. -The hardware allows selection of 32 colours, but these extra colours are copies of existing colours.*/ - -static const rgb_t amstrad_palette[32] = -{ - rgb_t(0x060, 0x060, 0x060), /* white */ - rgb_t(0x060, 0x060, 0x060), /* white */ - rgb_t(0x000, 0x0ff, 0x060), /* sea green */ - rgb_t(0x0ff, 0x0ff, 0x060), /* pastel yellow */ - rgb_t(0x000, 0x000, 0x060), /* blue */ - rgb_t(0x0ff, 0x000, 0x060), /* purple */ - rgb_t(0x000, 0x060, 0x060), /* cyan */ - rgb_t(0x0ff, 0x060, 0x060), /* pink */ - rgb_t(0x0ff, 0x000, 0x060), /* purple */ - rgb_t(0x0ff, 0x0ff, 0x060), /* pastel yellow */ - rgb_t(0x0ff, 0x0ff, 0x000), /* bright yellow */ - rgb_t(0x0ff, 0x0ff, 0x0ff), /* bright white */ - rgb_t(0x0ff, 0x000, 0x000), /* bright red */ - rgb_t(0x0ff, 0x000, 0x0ff), /* bright magenta */ - rgb_t(0x0ff, 0x060, 0x000), /* orange */ - rgb_t(0x0ff, 0x060, 0x0ff), /* pastel magenta */ - rgb_t(0x000, 0x000, 0x060), /* blue */ - rgb_t(0x000, 0x0ff, 0x060), /* sea green */ - rgb_t(0x000, 0x0ff, 0x000), /* bright green */ - rgb_t(0x000, 0x0ff, 0x0ff), /* bright cyan */ - rgb_t(0x000, 0x000, 0x000), /* black */ - rgb_t(0x000, 0x000, 0x0ff), /* bright blue */ - rgb_t(0x000, 0x060, 0x000), /* green */ - rgb_t(0x000, 0x060, 0x0ff), /* sky blue */ - rgb_t(0x060, 0x000, 0x060), /* magenta */ - rgb_t(0x060, 0x0ff, 0x060), /* pastel green */ - rgb_t(0x060, 0x0ff, 0x060), /* lime */ - rgb_t(0x060, 0x0ff, 0x0ff), /* pastel cyan */ - rgb_t(0x060, 0x000, 0x000), /* Red */ - rgb_t(0x060, 0x000, 0x0ff), /* mauve */ - rgb_t(0x060, 0x060, 0x000), /* yellow */ - rgb_t(0x060, 0x060, 0x0ff) /* pastel blue */ -}; - - -/* the green brightness is equal to the firmware colour index */ -static const rgb_t amstrad_green_palette[32] = -{ - rgb_t(0x000, 0x07F, 0x000), /*13*/ - rgb_t(0x000, 0x07F, 0x000), /*13*/ - rgb_t(0x000, 0x0BA, 0x000), /*19*/ - rgb_t(0x000, 0x0F5, 0x000), /*25*/ - rgb_t(0x000, 0x009, 0x000), /*1*/ - rgb_t(0x000, 0x044, 0x000), /*7*/ - rgb_t(0x000, 0x062, 0x000), /*10*/ - rgb_t(0x000, 0x09C, 0x000), /*16*/ - rgb_t(0x000, 0x044, 0x000), /*7*/ - rgb_t(0x000, 0x0F5, 0x000), /*25*/ - rgb_t(0x000, 0x0EB, 0x000), /*24*/ - rgb_t(0x000, 0x0FF, 0x000), /*26*/ - rgb_t(0x000, 0x03A, 0x000), /*6*/ - rgb_t(0x000, 0x04E, 0x000), /*8*/ - rgb_t(0x000, 0x093, 0x000), /*15*/ - rgb_t(0x000, 0x0A6, 0x000), /*17*/ - rgb_t(0x000, 0x009, 0x000), /*1*/ - rgb_t(0x000, 0x0BA, 0x000), /*19*/ - rgb_t(0x000, 0x0B0, 0x000), /*18*/ - rgb_t(0x000, 0x0C4, 0x000), /*20*/ - rgb_t(0x000, 0x000, 0x000), /*0*/ - rgb_t(0x000, 0x013, 0x000), /*2*/ - rgb_t(0x000, 0x058, 0x000), /*9*/ - rgb_t(0x000, 0x06B, 0x000), /*11*/ - rgb_t(0x000, 0x027, 0x000), /*4*/ - rgb_t(0x000, 0x0D7, 0x000), /*22*/ - rgb_t(0x000, 0x0CD, 0x000), /*21*/ - rgb_t(0x000, 0x0E1, 0x000), /*23*/ - rgb_t(0x000, 0x01D, 0x000), /*3*/ - rgb_t(0x000, 0x031, 0x000), /*5*/ - rgb_t(0x000, 0x075, 0x000), /*12*/ - rgb_t(0x000, 0x089, 0x000) /*14*/ -}; - - -/******************************************************************* - Prototypes -*******************************************************************/ - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(amstrad_state,amstrad_cpc) -{ - palette.set_pen_colors(0, amstrad_palette, ARRAY_LENGTH(amstrad_palette)); -} - - -PALETTE_INIT_MEMBER(amstrad_state,amstrad_cpc_green) -{ - palette.set_pen_colors(0, amstrad_green_palette, ARRAY_LENGTH(amstrad_green_palette)); -} - - -/* Some games set the 8255 to mode 1 and expect a strobe signal */ -/* on PC2. Apparently PC2 is always low on the CPC. ?!? */ -TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_pc2_low) -{ - m_ppi->pc2_w(0); -} - - -void amstrad_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_PC2_LOW: - amstrad_pc2_low(ptr, param); - break; - case TIMER_VIDEO_UPDATE: - amstrad_video_update_timer(ptr, param); - break; - case TIMER_SET_RESOLUTION: - cb_set_resolution(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in amstrad_state::device_timer"); - } -} - - -/*************************************************************************/ -/* KC Compact - -The palette is defined by a colour rom. The only rom dump that exists (from the KC-Club webpage) -is 2K, which seems correct. In this rom the same 32 bytes of data is repeated throughout the rom. - -When a I/O write is made to "Gate Array" to select the colour, Bit 7 and 6 are used by the -"Gate Array" to define the function, bit 7 = 0, bit 6 = 1. In the Amstrad CPC, bits 4..0 -define the hardware colour number, but in the KC Compact, it seems bits 5..0 -define the hardware colour number allowing 64 colours to be chosen. - -It is possible therefore that the colour rom could be reprogrammed, so that other colour -selections could be chosen allowing 64 different colours to be used. But this has not been tested -and co - -colour rom byte: - -Bit Function -7 not used -6 not used -5,4 Green value -3,2 Red value -1,0 Blue value - -Green value, Red value, Blue value: 0 = 0%, 01/10 = 50%, 11 = 100%. -The 01 case is not used, it is unknown if this produces a different amount of colour. -*/ - -unsigned char amstrad_state::kccomp_get_colour_element(int colour_value) -{ - switch (colour_value) - { - case 0: - return 0x00; - case 1: - return 0x60; - case 2: - return 0x60; - case 3: - return 0xff; - } - - return 0xff; -} - - -/* the colour rom has the same 32 bytes repeated, but it might be possible to put a new rom in -with different data and be able to select the other entries - not tested on a real kc compact yet -and not supported by this driver */ -PALETTE_INIT_MEMBER(amstrad_state,kccomp) -{ - const UINT8 *color_prom = memregion("proms")->base(); - int i; - - color_prom = color_prom+0x018000; - - for (i=0; i<32; i++) - { - palette.set_pen_color(i, - kccomp_get_colour_element((color_prom[i]>>2) & 0x03), - kccomp_get_colour_element((color_prom[i]>>4) & 0x03), - kccomp_get_colour_element((color_prom[i]>>0) & 0x03)); - } -} - - -/******************************************** -Amstrad Plus - -The Amstrad Plus has a 4096 colour palette -*********************************************/ - -PALETTE_INIT_MEMBER(amstrad_state,amstrad_plus) -{ - int i; - - palette.set_pen_colors(0, amstrad_palette, ARRAY_LENGTH(amstrad_palette) / 3); - for ( i = 0; i < 0x1000; i++ ) - { - int r, g, b; - - g = ( i >> 8 ) & 0x0f; - r = ( i >> 4 ) & 0x0f; - b = i & 0x0f; - - r = ( r << 4 ) | ( r ); - g = ( g << 4 ) | ( g ); - b = ( b << 4 ) | ( b ); - - palette.set_pen_color(i, r, g, b); - } -} - - -PALETTE_INIT_MEMBER(amstrad_state,aleste) -{ - int i; - - /* CPC Colour data is stored in the colour ROM (RFCOLDAT.BIN) at 0x140-0x17f */ - unsigned char* pal = memregion("user4")->base(); - - for(i=0; i<32; i++) - { - int r,g,b; - - b = (pal[0x140+i] >> 4) & 0x03; - g = (pal[0x140+i] >> 2) & 0x03; - r = pal[0x140+i] & 0x03; - - r = (r << 6); - g = (g << 6); - b = (b << 6); - - palette.set_pen_color(i, r, g, b); - } - - /* MSX colour palette is 6-bit RGB */ - for(i=0; i<64; i++) - { - int r,g,b; - - r = (i >> 4) & 0x03; - g = (i >> 2) & 0x03; - b = i & 0x03; - - r = (r << 6); - g = (g << 6); - b = (b << 6); - - palette.set_pen_color(i+32, r, g, b); - } -} - - -void amstrad_state::amstrad_init_lookups() -{ - int i; - - for ( i = 0; i < 256; i++ ) - { - m_mode0_lookup[i] = ( ( i & 0x80 ) >> 7 ) | ( ( i & 0x20 ) >> 3 ) | ( ( i & 0x08 ) >> 2 ) | ( ( i & 0x02 ) << 2 ); - m_mode1_lookup[i] = ( ( i & 0x80 ) >> 7 ) | ( ( i & 0x08 ) >> 2 ); - m_mode2_lookup[i] = ( ( i & 0x80 ) >> 7 ); - } -} - - -/* Set the new screen mode (0,1,2,4) from the GateArray */ -void amstrad_state::amstrad_vh_update_mode() -{ - if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) - { - /* select a cpc plus mode */ - switch ( m_gate_array.mrer & 0x03 ) - { - case 0: /* Mode 0: 160x200, 16 colours */ - m_gate_array.mode_lookup = m_mode0_lookup; - m_gate_array.max_colour_ticks = 4; - m_gate_array.ticks_increment = 1; - break; - - case 1: /* Mode 1: 320x200, 4 colous */ - m_gate_array.mode_lookup = m_mode1_lookup; - m_gate_array.max_colour_ticks = 2; - m_gate_array.ticks_increment = 1; - break; - - case 2: /* Mode 2: 640x200, 2 colours */ - m_gate_array.mode_lookup = m_mode2_lookup; - m_gate_array.max_colour_ticks = 1; - m_gate_array.ticks_increment = 1; - break; - - case 3: /* Mode 3: 160x200, 4 colours */ - m_gate_array.mode_lookup = m_mode0_lookup; - m_gate_array.max_colour_ticks = 4; - m_gate_array.ticks_increment = 1; - break; - } - } - else - { - if ( m_aleste_mode & 0x02 ) - { - /* select an aleste mode */ - switch ( m_gate_array.mrer & 0x03 ) - { - case 0: /* Aleste Mode 0 (= Amstrad CPC mode 2): 640x200, 2 colours */ - m_gate_array.mode_lookup = m_mode2_lookup; - m_gate_array.max_colour_ticks = 1; - m_gate_array.ticks_increment = 1; - break; - - case 1: /* Aleste mode 1 (= Amstrad CPC mode 1): 320x200, 4 colours */ - m_gate_array.mode_lookup = m_mode1_lookup; - m_gate_array.max_colour_ticks = 2; - m_gate_array.ticks_increment = 1; - break; - - case 2: /* Aleste mode 2: 4 colours */ - m_gate_array.mode_lookup = m_mode1_lookup; - m_gate_array.max_colour_ticks = 1; - m_gate_array.ticks_increment = 2; - break; - - case 3: /* Aleste mode 3: 16 colours */ - m_gate_array.mode_lookup = m_mode0_lookup; - m_gate_array.max_colour_ticks = 2; - m_gate_array.ticks_increment = 2; - break; - } - } - else - { - /* select an original cpc mode */ - switch ( m_gate_array.mrer & 0x03 ) - { - case 0: /* Mode 0: 160x200, 16 colours */ - m_gate_array.mode_lookup = m_mode0_lookup; - m_gate_array.max_colour_ticks = 4; - m_gate_array.ticks_increment = 1; - break; - - case 1: /* Mode 1: 320x200, 4 colous */ - m_gate_array.mode_lookup = m_mode1_lookup; - m_gate_array.max_colour_ticks = 2; - m_gate_array.ticks_increment = 1; - break; - - case 2: /* Mode 2: 640x200, 2 colours */ - m_gate_array.mode_lookup = m_mode2_lookup; - m_gate_array.max_colour_ticks = 1; - m_gate_array.ticks_increment = 1; - break; - - case 3: /* Mode 3: 160x200, 4 colours */ - m_gate_array.mode_lookup = m_mode0_lookup; - m_gate_array.max_colour_ticks = 4; - m_gate_array.ticks_increment = 1; - break; - } - } - } -} - - -/* -DMA commands - -0RDDh LOAD R,D Load 8 bit data D to PSG register R (0<=R<=15) -1NNNh PAUSE N Pause for N prescaled ticks (0pointer()[m_asic.dma_addr[channel]+1] << 8) + m_ram->pointer()[m_asic.dma_addr[channel]]; -// logerror("DMA #%i: address %04x: command %04x\n",channel,m_asic.dma_addr[channel],command); - switch (command & 0xf000) - { - case 0x0000: // Load PSG register - { - m_ay->address_w(generic_space(), 0, (command & 0x0f00) >> 8); - m_ay->data_w(generic_space(), 0, command & 0x00ff); - m_ay->address_w(generic_space(), 0, m_prev_reg); - } - logerror("DMA %i: LOAD %i, %i\n",channel,(command & 0x0f00) >> 8, command & 0x00ff); - break; - case 0x1000: // Pause for n HSYNCs (0 - 4095) - m_asic.dma_pause[channel] = (command & 0x0fff) - 1; - logerror("DMA %i: PAUSE %i\n",channel,command & 0x0fff); - break; - case 0x2000: // Beginning of repeat loop - m_asic.dma_repeat[channel] = m_asic.dma_addr[channel]; - m_asic.dma_loopcount[channel] = (command & 0x0fff); - logerror("DMA %i: REPEAT %i\n",channel,command & 0x0fff); - break; - case 0x4000: // Control functions - if (command & 0x01) // Loop back to last Repeat instruction - { - if (m_asic.dma_loopcount[channel] > 0) - { - m_asic.dma_addr[channel] = m_asic.dma_repeat[channel]; - logerror("DMA %i: LOOP (%i left)\n",channel,m_asic.dma_loopcount[channel]); - m_asic.dma_loopcount[channel]--; - } - else - logerror("DMA %i: LOOP (end)\n",channel); - } - if (command & 0x10) // Cause interrupt - { - m_plus_irq_cause = channel * 2; - m_asic.ram[0x2c0f] |= (0x40 >> channel); - m_maincpu->set_input_line(0, ASSERT_LINE); - logerror("DMA %i: INT\n",channel); - } - if (command & 0x20) // Stop processing on this channel - { - m_asic.dma_status &= ~(0x01 << channel); - logerror("DMA %i: STOP\n",channel); - } - break; - default: - logerror("DMA: Unknown DMA command - %04x - at address &%04x\n",command,m_asic.dma_addr[channel]); - } - m_asic.dma_addr[channel] += 2; // point to next DMA instruction -} - - -void amstrad_state::amstrad_plus_handle_dma() -{ - if ( m_asic.dma_status & 0x01 ) // DMA channel 0 - { - amstrad_plus_dma_parse( 0 ); - } - - if ( m_asic.dma_status & 0x02 ) // DMA channel 1 - { - amstrad_plus_dma_parse( 1 ); - } - - if ( m_asic.dma_status & 0x04 ) // DMA channel 2 - { - amstrad_plus_dma_parse( 2 ); - } -} - -TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_video_update_timer) -{ - if(param == 1) - { - amstrad_plus_update_video(); - } - else - { - amstrad_update_video(); - } -} - -/* Set the new colour from the GateArray */ -void amstrad_state::amstrad_vh_update_colour(int PenIndex, UINT16 hw_colour_index) -{ - if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) - { - int val; - - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1); - - /* CPC+/GX4000 - normal palette changes through the Gate Array also makes the corresponding change in the ASIC palette */ - val = (amstrad_palette[hw_colour_index] & 0xf00000) >> 16; /* red */ - val |= (amstrad_palette[hw_colour_index] & 0x0000f0) >> 4; /* blue */ - m_asic.ram[0x2400+PenIndex*2] = val; - val = (amstrad_palette[hw_colour_index] & 0x00f000) >> 12; /* green */ - m_asic.ram[0x2401+PenIndex*2] = val; - } - else - { - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); - } - m_GateArray_render_colours[PenIndex] = hw_colour_index; -} - - -void amstrad_state::aleste_vh_update_colour(int PenIndex, UINT16 hw_colour_index) -{ - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); - m_GateArray_render_colours[PenIndex] = hw_colour_index+32; -} - - -void amstrad_state::amstrad_gate_array_get_video_data() -{ - if ( m_aleste_mode & 0x02 ) - { - m_gate_array.address = ( ( m_gate_array.ma & 0x2000 ) << 2 ) | ( ( m_gate_array.ra & 0x06 ) << 11 ) | ( ( m_gate_array.ra & 0x01 ) << 14 ) | ( ( m_gate_array.ma & 0x7ff ) << 1 ); - } - else - { - m_gate_array.address = ( ( m_gate_array.ma & 0x3000 ) << 2 ) | ( ( m_gate_array.ra & 0x07 ) << 11 ) | ( ( m_gate_array.ma & 0x3ff ) << 1 ); - } - m_gate_array.data = m_ram->pointer()[ m_gate_array.address ]; - m_gate_array.colour = m_GateArray_render_colours[ m_gate_array.mode_lookup[m_gate_array.data] ]; - m_gate_array.colour_ticks = m_gate_array.max_colour_ticks; - m_gate_array.ticks = 0; -} - - -void amstrad_state::amstrad_update_video() -{ - attotime now = machine().time(); - - - if ( m_gate_array.draw_p ) - { - UINT32 cycles_passed = (now - m_gate_array.last_draw_time ).as_ticks(XTAL_16MHz); - - while( cycles_passed ) - { - if ( ! m_gate_array.de || ( ( m_aleste_mode & 0x02 ) && ! ( m_aleste_mode & 0x08 ) ) ) - { - *m_gate_array.draw_p = m_GateArray_render_colours[ 16 ]; - } - else - { - *m_gate_array.draw_p = m_gate_array.colour; - m_gate_array.colour_ticks--; - if ( ! m_gate_array.colour_ticks ) - { - m_gate_array.data <<= 1; - m_gate_array.colour = m_GateArray_render_colours[ m_gate_array.mode_lookup[m_gate_array.data] ]; - m_gate_array.colour_ticks = m_gate_array.max_colour_ticks; - } - m_gate_array.ticks += m_gate_array.ticks_increment; - switch( m_gate_array.ticks) - { - case 8: - m_gate_array.data = m_ram->pointer()[ m_gate_array.address + 1 ]; - m_gate_array.colour = m_GateArray_render_colours[ m_gate_array.mode_lookup[m_gate_array.data] ]; - break; - case 16: - m_gate_array.ma += 1; /* If we were synced with the 6845 mc6845_get_ma should return this value */ - amstrad_gate_array_get_video_data(); - break; - } - } - m_gate_array.draw_p++; - cycles_passed--; - m_gate_array.line_ticks++; - if ( m_gate_array.line_ticks > m_gate_array.bitmap->width() ) - { - m_gate_array.draw_p = NULL; - cycles_passed = 0; - } - } - } - - m_gate_array.last_draw_time = now; -} - - -void amstrad_state::amstrad_plus_gate_array_get_video_data() -{ - UINT16 caddr; - UINT16 ma = ( m_gate_array.ma - m_asic.split_ma_started ) + m_asic.split_ma_base; - UINT16 ra = m_gate_array.ra + ( ( m_asic.ram[0x2804] >> 4 ) & 0x07 ); - - if ( ra > 7 ) - { - ma += m_asic.horiz_disp; - } - m_gate_array.address = ( ( ma & 0x3000 ) << 2 ) | ( ( m_gate_array.ra & 0x07 ) << 11 ) | ( ( ma & 0x3ff ) << 1 ); - m_gate_array.data = m_ram->pointer()[ m_gate_array.address ]; - caddr = 0x2400 + m_gate_array.mode_lookup[m_gate_array.data] * 2; - m_gate_array.colour = m_asic.ram[caddr] + ( m_asic.ram[caddr+1] << 8 ); - m_gate_array.colour_ticks = m_gate_array.max_colour_ticks; - m_gate_array.ticks = 0; -} - - -void amstrad_state::amstrad_plus_update_video() -{ - attotime now = machine().time(); - - if ( m_gate_array.draw_p ) - { - UINT32 cycles_passed = (now - m_gate_array.last_draw_time ).as_ticks(XTAL_16MHz); - - while( cycles_passed ) - { - if ( ! m_gate_array.de ) - { - *m_gate_array.draw_p = m_asic.ram[0x2420] + ( m_asic.ram[0x2421] << 8 ); - } - else - { - *m_gate_array.draw_p = m_gate_array.colour; - - if ( m_asic.hscroll ) - { - m_asic.hscroll--; - if ( m_asic.hscroll == 0 ) - amstrad_plus_gate_array_get_video_data(); - } - else - { - m_gate_array.colour_ticks--; - if ( ! m_gate_array.colour_ticks ) - { - UINT16 caddr; - - m_gate_array.data <<= 1; - caddr = 0x2400 + m_gate_array.mode_lookup[m_gate_array.data] * 2; - m_gate_array.colour = m_asic.ram[caddr] + ( m_asic.ram[caddr+1] << 8 ); - m_gate_array.colour_ticks = m_gate_array.max_colour_ticks; - } - m_gate_array.ticks += m_gate_array.ticks_increment; - switch( m_gate_array.ticks) - { - case 8: - { - UINT16 caddr; - - m_gate_array.data = m_ram->pointer()[ m_gate_array.address + 1 ]; - caddr = 0x2400 + m_gate_array.mode_lookup[m_gate_array.data] * 2; - m_gate_array.colour = m_asic.ram[caddr] + ( m_asic.ram[caddr+1] << 8 ); - } - break; - case 16: - m_gate_array.ma += 1; /* If we were synced with the 6845 mc6845_get_ma should return this value */ - amstrad_plus_gate_array_get_video_data(); - break; - } - } - } - m_gate_array.draw_p++; - cycles_passed--; - m_gate_array.line_ticks++; - if ( m_gate_array.line_ticks >= m_gate_array.bitmap->width() ) - { - m_gate_array.draw_p = NULL; - cycles_passed = 0; - } - } - } - - m_gate_array.last_draw_time = now; -} - - -void amstrad_state::amstrad_plus_update_video_sprites() -{ - UINT16 *p = &m_gate_array.bitmap->pix16(m_gate_array.y, m_asic.h_start ); - int i; - - if ( m_gate_array.y < 0 ) - return; - - for ( i = 15 * 8; i >= 0; i -= 8 ) - { - UINT8 xmag = ( m_asic.ram[ 0x2000 + i + 4 ] >> 2 ) & 0x03; - UINT8 ymag = m_asic.ram[ 0x2000 + i + 4 ] & 0x03; - - /* Check if sprite is enabled */ - if ( xmag && ymag ) - { - INT16 spr_x = m_asic.ram[ 0x2000 + i ] + ( m_asic.ram[ 0x2001 + i ] << 8 ); - INT16 spr_y = m_asic.ram[ 0x2002 + i ] + ( m_asic.ram[ 0x2003 + i ] << 8 ); - - xmag -= 1; - ymag -= 1; - - /* Check if sprite would appear on this scanline */ - if ( spr_y <= m_asic.vpos && m_asic.vpos < spr_y + ( 16 << ymag ) && spr_x < ( m_asic.h_end - m_asic.h_start ) && spr_x + ( 16 << xmag ) > 0 ) - { - UINT16 spr_addr = i * 32 + ( ( ( m_asic.vpos - spr_y ) >> ymag ) * 16 ); - int j, k; - - for ( j = 0; j < 16; j++ ) - { - for ( k = 0; k < ( 1 << xmag ); k++ ) - { - INT16 x = spr_x + ( j << xmag ) + k; - - if ( x >= 0 && x < ( m_asic.h_end - m_asic.h_start ) ) - { - UINT8 spr_col = ( m_asic.ram[ spr_addr + j ] & 0x0f ) * 2; - - if ( spr_col ) - p[x] = m_asic.ram[ 0x2420 + spr_col ] + ( m_asic.ram[ 0x2421 + spr_col ] << 8 ); - } - } - } - } - } - } -} - - -WRITE_LINE_MEMBER(amstrad_state::amstrad_hsync_changed) -{ - amstrad_update_video(); - - /* The gate array reacts to de-assertion of the hsycnc 6845 line */ - if ( m_gate_array.hsync && !state ) - { - m_gate_array.hsync_counter++; - /* Advance to next drawing line */ - m_gate_array.y++; - m_gate_array.line_ticks = 0; - if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) - { - m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); - } - else - { - m_gate_array.draw_p = NULL; - } - - if ( m_gate_array.hsync_after_vsync_counter != 0 ) // counters still operate regardless of PRI state - { - m_gate_array.hsync_after_vsync_counter--; - - if (m_gate_array.hsync_after_vsync_counter == 0) - { - if (m_gate_array.hsync_counter >= 32) - { - m_maincpu->set_input_line(0, ASSERT_LINE); - } - m_gate_array.hsync_counter = 0; - } - } - - if ( m_gate_array.hsync_counter >= 52 ) - { - m_gate_array.hsync_counter = 0; - m_maincpu->set_input_line(0, ASSERT_LINE); - } - } - m_gate_array.hsync = state ? 1 : 0; -} - - -WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_hsync_changed) -{ - amstrad_plus_update_video(); - - if ( m_gate_array.hsync && !state ) - { - m_gate_array.hsync_counter++; - /* Advance to next drawing line */ - m_gate_array.y++; - m_gate_array.line_ticks = 0; - if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) - { - m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); - } - else - { - m_gate_array.draw_p = NULL; - } - - if ( m_gate_array.hsync_after_vsync_counter != 0 ) // counters still operate regardless of PRI state - { - m_gate_array.hsync_after_vsync_counter--; - - if (m_gate_array.hsync_after_vsync_counter == 0) - { - if (m_gate_array.hsync_counter >= 32) - { - if( m_asic.pri == 0 || m_asic.enabled == 0) - { - m_maincpu->set_input_line(0, ASSERT_LINE); - } - } - m_gate_array.hsync_counter = 0; - } - } - - if ( m_gate_array.hsync_counter >= 52 ) - { - m_gate_array.hsync_counter = 0; - if ( m_asic.pri == 0 || m_asic.enabled == 0 ) - { - m_maincpu->set_input_line(0, ASSERT_LINE); - } - } - - if ( m_asic.enabled ) - { - // CPC+/GX4000 Programmable Raster Interrupt (disabled if &6800 in ASIC RAM is 0) - if ( m_asic.pri != 0 ) - { - if ( m_asic.pri == m_asic.vpos - 1 ) - { - logerror("PRI: triggered, scanline %d\n",m_asic.pri); - m_maincpu->set_input_line(0, ASSERT_LINE); - m_plus_irq_cause = 0x06; // raster interrupt vector - m_gate_array.hsync_counter &= ~0x20; // ASIC PRI resets the MSB of the raster counter - } - } - // CPC+/GX4000 Split screen registers (disabled if &6801 in ASIC RAM is 0) - if(m_asic.ram[0x2801] != 0) - { - if ( m_asic.ram[0x2801] == m_asic.vpos - 1 ) // split occurs here (hopefully) - { - logerror("SSCR: Split screen occurred at scanline %d\n",m_asic.ram[0x2801]); - } - } - // CPC+/GX4000 DMA channels - amstrad_plus_handle_dma(); // a DMA command is handled at the leading edge of HSYNC (every 64us) - m_asic.vpos++; - } - } - m_gate_array.hsync = state ? 1 : 0; -} - - -WRITE_LINE_MEMBER(amstrad_state::amstrad_vsync_changed) -{ - amstrad_update_video(); - - if ( ! m_gate_array.vsync && state ) - { - /* Reset the amstrad_CRTC_HS_After_VS_Counter */ - m_gate_array.hsync_after_vsync_counter = 3; - - /* Start of new frame */ - m_gate_array.y = -1; - m_asic.de_start = 0; - } - - m_gate_array.vsync = state ? 1 : 0; - - /* Schedule a write to PC2 */ - timer_set(attotime::zero, TIMER_PC2_LOW); -} - - -WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_vsync_changed) -{ - amstrad_plus_update_video(); - - if ( ! m_gate_array.vsync && state ) - { - /* Reset the amstrad_CRTC_HS_After_VS_Counter */ - m_gate_array.hsync_after_vsync_counter = 3; - - /* Start of new frame */ - m_gate_array.y = -1; - m_asic.de_start = 0; - } - - m_gate_array.vsync = state ? 1 : 0; - - /* Schedule a write to PC2 */ - timer_set(attotime::zero, TIMER_PC2_LOW); -} - - -WRITE_LINE_MEMBER(amstrad_state::amstrad_de_changed) -{ - amstrad_update_video(); - - if ( ! m_gate_array.de && state ) - { - /* DE became active, store the starting MA and RA signals */ - mc6845_device *mc6845 = m_crtc; - - if(m_asic.de_start == 0) - m_asic.vpos = 1; - - m_gate_array.ma = mc6845->get_ma(); - m_gate_array.ra = mc6845->get_ra(); -//logerror("y = %d; ma = %02x; ra = %02x, address = %04x\n", m_gate_array.y, m_gate_array.ma, m_gate_array.ra, ( ( m_gate_array.ma & 0x3000 ) << 2 ) | ( ( m_gate_array.ra & 0x07 ) << 11 ) | ( ( m_gate_array.ma & 0x3ff ) << 1 ) ); - amstrad_gate_array_get_video_data(); - m_asic.de_start = 1; - } - - m_gate_array.de = state ? 1 : 0; -} - - -WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_de_changed) -{ - amstrad_plus_update_video(); - - if ( ! m_gate_array.de && state ) - { - /* DE became active, store the starting MA and RA signals */ - m_gate_array.ma = m_crtc->get_ma(); - m_gate_array.ra = m_crtc->get_ra(); - m_asic.h_start = m_gate_array.line_ticks; - if(m_asic.de_start == 0) - m_asic.vpos = 1; - m_asic.de_start = 1; - - /* Start of screen */ - if ( m_asic.vpos == 1 ) - { - m_asic.split_ma_base = 0x0000; - m_asic.split_ma_started = 0x0000; - } - /* Start of split screen section */ - else if ( m_asic.enabled && m_asic.ram[0x2801] != 0 && m_asic.ram[0x2801] == m_asic.vpos - 1 ) - { - m_asic.split_ma_started = m_gate_array.ma; - m_asic.split_ma_base = ( m_asic.ram[0x2802] << 8 ) | m_asic.ram[0x2803]; - } - - m_gate_array.colour = m_asic.ram[0x2420] + ( m_asic.ram[0x2421] << 8 ); - m_asic.hscroll = m_asic.ram[0x2804] & 0x0f; - - if ( m_asic.hscroll == 0 ) - amstrad_plus_gate_array_get_video_data(); - } - - if ( m_gate_array.de && ! state ) - { - m_asic.h_end = m_gate_array.line_ticks; - amstrad_plus_update_video_sprites(); - } - - m_gate_array.de = state ? 1 : 0; -} - - -VIDEO_START_MEMBER(amstrad_state,amstrad) -{ - amstrad_init_lookups(); - - m_gate_array.bitmap = auto_bitmap_ind16_alloc( machine(), m_screen->width(), m_screen->height() ); - m_gate_array.hsync_after_vsync_counter = 3; -} - - -UINT32 amstrad_state::screen_update_amstrad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap( bitmap, *m_gate_array.bitmap, 0, 0, 0, 0, cliprect ); - return 0; -} - - -/* traverses the daisy-chain of expansion devices, looking for the specified device */ -static device_t* get_expansion_device(running_machine &machine, const char* tag) -{ - amstrad_state *state = machine.driver_data(); - cpc_expansion_slot_device* exp_port = state->m_exp; - - while(exp_port != NULL) - { - device_t* temp; - - // first, check if this expansion port has the device we want attached - temp = exp_port->subdevice(tag); - if(temp != NULL) - return temp; - - // if it's not what we're looking for, then check the expansion port on this expansion device. if it exists. - temp = dynamic_cast(exp_port->get_card_device()); - if(temp == NULL) - return NULL; // no device attached - exp_port = temp->subdevice("exp"); - if(exp_port == NULL) - return NULL; // we're at the end of the chain - } - return NULL; -} - -WRITE_LINE_MEMBER(amstrad_state::cpc_romdis) -{ - m_gate_array.romdis = state; - amstrad_rethinkMemory(); -} - - -/*-------------------------- - - Ram and Rom management - - --------------------------*/ -/*----------------- - - Set Lower Rom - - -----------------*/ -void amstrad_state::amstrad_setLowerRom() -{ - UINT8 *bank_base; - - /* b2 : "1" Lower rom area disable or "0" Lower rom area enable */ - if ( m_system_type == SYSTEM_CPC || m_system_type == SYSTEM_ALESTE ) - { - if ((m_gate_array.mrer & (1<<2)) == 0 && m_gate_array.romdis == 0) - { - bank_base = &m_region_maincpu->base()[0x010000]; - } - else - { - if(m_aleste_mode & 0x04) - bank_base = m_Aleste_RamBanks[0]; - else - bank_base = m_AmstradCPC_RamBanks[0]; - } - m_bank1->set_base(bank_base); - m_bank2->set_base(bank_base+0x02000); - } - else // CPC+/GX4000 - { - //address_space &space = state->m_maincpu->space(AS_PROGRAM); - -/* if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) - { - space.install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),this)); - space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),this)); - space.install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),this)); - space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this)); - } - else - { - space.install_read_bank(0x4000, 0x5fff, "bank3"); - space.install_read_bank(0x6000, 0x7fff, "bank4"); - space.install_write_bank(0x4000, 0x5fff, "bank11"); - space.install_write_bank(0x6000, 0x7fff, "bank12"); - } -*/ - if(m_AmstradCPC_RamBanks[0] != NULL) - { - m_bank1->set_base(m_AmstradCPC_RamBanks[0]); - m_bank2->set_base(m_AmstradCPC_RamBanks[0]+0x2000); - m_bank3->set_base(m_AmstradCPC_RamBanks[1]); - m_bank4->set_base(m_AmstradCPC_RamBanks[1]+0x2000); - m_bank5->set_base(m_AmstradCPC_RamBanks[2]); - m_bank6->set_base(m_AmstradCPC_RamBanks[2]+0x2000); - } - - if ( (m_gate_array.mrer & (1<<2)) == 0 && m_gate_array.romdis == 0) - { // ASIC secondary lower ROM selection (bit 5: 1 = enabled) - if ( m_asic.enabled ) - { -// logerror("L-ROM: Lower ROM enabled, cart bank %i\n", m_asic.rmr2 & 0x07 ); - bank_base = &m_region_cart->base()[0x4000 * (m_asic.rmr2 & 0x07)]; - switch( m_asic.rmr2 & 0x18 ) - { - case 0x00: -// logerror("L-ROM: located at &0000\n"); - m_bank1->set_base(bank_base); - m_bank2->set_base(bank_base+0x02000); - break; - case 0x08: -// logerror("L-ROM: located at &4000\n"); - m_bank3->set_base(bank_base); - m_bank4->set_base(bank_base+0x02000); - break; - case 0x10: -// logerror("L-ROM: located at &8000\n"); - m_bank5->set_base(bank_base); - m_bank6->set_base(bank_base+0x02000); - break; - case 0x18: -// logerror("L-ROM: located at &0000, ASIC registers enabled\n"); - m_bank1->set_base(bank_base); - m_bank2->set_base(bank_base+0x02000); - break; - } - } - else - { - m_bank1->set_base(m_region_cart->base()); - m_bank2->set_base(m_region_cart->base() + 0x2000); - } - } - } -} - - -/*----------------- - - Set Upper Rom - - -----------------*/ -void amstrad_state::amstrad_setUpperRom() -{ - UINT8 *bank_base = NULL; - - /* b3 : "1" Upper rom area disable or "0" Upper rom area enable */ - if ( ! ( m_gate_array.mrer & 0x08 ) && m_gate_array.romdis == 0) - { - bank_base = m_Amstrad_ROM_Table[ m_gate_array.upper_bank ]; - } - else - { - if(m_aleste_mode & 0x04) - bank_base = m_Aleste_RamBanks[3]; - else - bank_base = m_AmstradCPC_RamBanks[3]; - } - - if (bank_base) - { - m_bank7->set_base(bank_base); - m_bank8->set_base(bank_base+0x2000); - } -} - - -/*-------------------------- - - Ram and Rom management - - --------------------------*/ - -/* simplified ram configuration - e.g. only correct for 128k machines - -RAM Expansion Bits - 7 6 5 4 3 2 1 0 -CPC6128 1 1 - - - s2 s1 s0 -Dk'tronics 256K Silicon Disk 1 1 1 b1 b0 b2 - - - -"-" - this bit is ignored. The value of this bit is not important. -"0" - this bit must be set to "0" -"1" - this bit must be set to "1" -"b0,b1,b2" - this bit is used to define the logical 64k block that the ram configuration uses -"s0,s1,s2" - this bit is used to define the ram configuration - -The CPC6128 has a 64k ram expansion built-in, giving 128K of RAM in this system. -In the CPC464,CPC664 and KC compact if a ram expansion is not present, then writing to this port has no effect and the ram will be in the same arrangement as if configuration 0 had been selected. -*/ -void amstrad_state::AmstradCPC_GA_SetRamConfiguration() -{ - int ConfigurationIndex = m_GateArray_RamConfiguration & 0x07; - int BankIndex,i; - unsigned char *BankAddr; - UINT8 banknum = (m_GateArray_RamConfiguration & 0x38) >> 3; - -/* if b5 = 0 */ - if(m_ram->size() > 65536) - { - for (i=0;i<4;i++) - { - BankIndex = RamConfigurations[(ConfigurationIndex << 2) + i]; - if(BankIndex > 3) - { - UINT8 maxbank = ((m_ram->size()-65536) / 65536); - BankAddr = m_ram->pointer() + (BankIndex << 14) + ((banknum%maxbank)*0x10000); - } - else - BankAddr = m_ram->pointer() + (BankIndex << 14); - m_Aleste_RamBanks[i] = BankAddr; - m_AmstradCPC_RamBanks[i] = BankAddr; - } - } - else - { - // set normal 64k RAM mapping - for (i=0;i<4;i++) - { - BankAddr = m_ram->pointer() + (i << 14); - m_Aleste_RamBanks[i] = BankAddr; - m_AmstradCPC_RamBanks[i] = BankAddr; - } - } - amstrad_rethinkMemory(); -} - - -/* ASIC RAM */ -/* - ASIC RAM Layout. Always is mapped to &4000-&7fff - - Hardware sprites: 16 sprites, 16x16, basic zooming, 15 colour (12-bit palette) - Pixel data is 0 - 15 for sprite pen number, low 4 bits - &4000 - &400f Pixel data for first line of first sprite - &4010 - &401f Pixel data for second line of first sprite - ... ... - &40f0 - &40ff Pixel data for last (16th) line of first sprite - ... ... - &4100 - &41ff Pixel data for second sprite - &4200 - &42ff Third sprite - ... ... - &4f00 - &4fff Pixel data for last (16th) sprite - - &6000 - &607f Sprite properties (8 bytes each) - +0 Sprite X position LSB - +1 Sprite X position MSB - +2 Sprite Y position LSB (scanline) - +3 Sprite Y position MSB - +4 Sprite zoom - bits 3,2 X magnification, bits 1,0 Y magnification - Magnification: 00 = not displayed, 01 = x1, 10 = x2, 11 = x4 - - Palette: LSB first, presumably GGGGBBBBxxxxRRRR - &6400 - &641f Pen palette (12bpp, 2 bytes each, 16 total) - &6420 - &6421 Border palette (12bpp, 2 bytes) - &6422 - &643f Hardware sprite palette (12bpp, 2 bytes each, 15 total) - - Programmable Raster Interrupt: - &6800 Scanline for IRQ to be triggered after - If 0, raster interrupts and DMA interrupts occur - Otherwise, the PRI interrupt is triggered only - - Hardware split screen: - &6801 Scanline for split to occur at - &6802 LSB of screen address for split (like reg 12 of the 6845) - &6803 MSB of the above (like reg 13 of the 6845) - - Soft Scroll Control Register: - &6804 bits 3-0 - horizontal delay in mode 2 pixels (shifts display to the right) - bits 6-4 - added to the 3 LSBs for the scanline address (shifts display up) - bit 7 - extends the border by two bytes (16 mode 2 pixels), masking the bad data from the horizontal scroll - - Analogue paddle ports: - &6808 - &680f Analogue input, read-only, 6 bit - - PSG DMA channels: - &6c00 DMA channel 0 address LSB - &6c01 DMA channel 0 address MSB - &6c02 DMA channel 0 prescaler - &6c03 unused - &6c04-7 DMA channel 1 - &6c08-b DMA channel 2 - &6c0f Control and Status register - bit 7 - raster interrupt - bit 6 - DMA channel 0 interrupt - bit 5 - DMA channel 1 interrupt - bit 4 - DMA channel 2 interrupt - bit 3 - unused (write 0) - bit 2 - DMA channel 2 enable - bit 1 - DMA channel 1 enable - bit 0 - DMA channel 0 enable - - */ - -WRITE8_MEMBER(amstrad_state::amstrad_plus_asic_4000_w) -{ -// logerror("ASIC: Write to register at &%04x\n",offset+0x4000); - if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) - m_asic.ram[offset] = data & 0x0f; - else - { - UINT8* RAM = (UINT8*)m_bank11->base(); - RAM[offset] = data; - } -} - - -WRITE8_MEMBER(amstrad_state::amstrad_plus_asic_6000_w) -{ - if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) - { - m_asic.ram[offset+0x2000] = data; - if(offset >= 0x0400 && offset < 0x440 && ( offset & 0x01 ) ) // ASIC palette - { - m_asic.ram[ offset + 0x2000 ] = data & 0x0f; - } - if(offset == 0x0800) // Programmable raster interrupt - { - // logerror("ASIC: Wrote %02x to PRI\n",data); - m_asic.pri = data; - } - if(offset >= 0x0801 && offset <= 0x0803) // Split screen registers - { - logerror("ASIC: Split screen at line %i, address &%04x\n",m_asic.ram[0x2801],m_asic.ram[0x2803] + (m_asic.ram[0x2802] << 8)); - } - if(offset == 0x0804) // Soft scroll register - { - } - if(offset == 0x0805) // Interrupt vector register (for IM 2, used by Pang) - { - // high 5 bits go to interrupt vector - int vector; - - if ( m_asic.enabled ) - { - vector = (data & 0xf8) + (m_plus_irq_cause); - m_maincpu->set_input_line_vector(0, vector); - logerror("ASIC: IM 2 vector write %02x, data = &%02x\n",vector,data); - } - m_asic.dma_clear = data & 0x01; - } - // DMA channels - switch(offset) - { - case 0x0c00: - case 0x0c01: - m_asic.dma_addr[0] = (m_asic.ram[0x2c01] << 8) + m_asic.ram[0x2c00]; - m_asic.dma_status &= ~0x01; - logerror("ASIC: DMA 0 address set to &%04x\n",m_asic.dma_addr[0]); - break; - case 0x0c04: - case 0x0c05: - m_asic.dma_addr[1] = (m_asic.ram[0x2c05] << 8) + m_asic.ram[0x2c04]; - m_asic.dma_status &= ~0x02; - logerror("ASIC: DMA 1 address set to &%04x\n",m_asic.dma_addr[1]); - break; - case 0x0c08: - case 0x0c09: - m_asic.dma_addr[2] = (m_asic.ram[0x2c09] << 8) + m_asic.ram[0x2c08]; - m_asic.dma_status &= ~0x04; - logerror("ASIC: DMA 2 address set to &%04x\n",m_asic.dma_addr[2]); - break; - case 0x0c02: - m_asic.dma_prescaler[0] = data + 1; - logerror("ASIC: DMA 0 pause prescaler set to %i\n",data); - break; - case 0x0c06: - m_asic.dma_prescaler[1] = data + 1; - logerror("ASIC: DMA 1 pause prescaler set to %i\n",data); - break; - case 0x0c0a: - m_asic.dma_prescaler[2] = data + 1; - logerror("ASIC: DMA 2 pause prescaler set to %i\n",data); - break; - case 0x0c0f: - m_asic.dma_status = data; - logerror("ASIC: DMA status write - %02x\n",data); - if(data & 0x40) - { - logerror("ASIC: DMA 0 IRQ acknowledge\n"); - m_maincpu->set_input_line(0, CLEAR_LINE); - m_plus_irq_cause = 0x06; - m_asic.ram[0x2c0f] &= ~0x40; - } - if(data & 0x20) - { - logerror("ASIC: DMA 1 IRQ acknowledge\n"); - m_maincpu->set_input_line(0, CLEAR_LINE); - m_plus_irq_cause = 0x06; - m_asic.ram[0x2c0f] &= ~0x20; - } - if(data & 0x10) - { - logerror("ASIC: DMA 2 IRQ acknowledge\n"); - m_maincpu->set_input_line(0, CLEAR_LINE); - m_plus_irq_cause = 0x06; - m_asic.ram[0x2c0f] &= ~0x10; - } - m_asic.ram[0x2c0f] = (m_asic.ram[0x2c0f] & 0xf8) | (data & 0x07); - break; - } - } - else - { - UINT8* RAM = (UINT8*)m_bank12->base(); - RAM[offset] = data; - } -} - - -READ8_MEMBER(amstrad_state::amstrad_plus_asic_4000_r) -{ -// logerror("RAM: read from &%04x\n",offset+0x4000); - if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) - return m_asic.ram[offset]; - else - { - UINT8* RAM = (UINT8*)m_bank3->base(); - return RAM[offset]; - } -} - - -READ8_MEMBER(amstrad_state::amstrad_plus_asic_6000_r) -{ -// logerror("RAM: read from &%04x\n",offset+0x6000); - if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 ) - { - // Analogue ports - if(offset >= 0x0808 && offset < 0x080c) - { - return (m_io_analog[offset & 3]->read() & 0x3f); - } - if(offset == 0x080c || offset == 0x080e) - { - return 0x3f; - } - if(offset == 0x080d || offset == 0x080f) - { - return 0x00; - } - #if 0 - if(offset == 0x0c0f) // DMA status and control - { - int result = 0; - if(m_plus_irq_cause == 0x00) - result |= 0x40; - if(m_plus_irq_cause == 0x02) - result |= 0x20; - if(m_plus_irq_cause == 0x04) - result |= 0x10; - if(m_plus_irq_cause == 0x06) - result |= 0x80; - return result; - } - #endif - return m_asic.ram[offset+0x2000]; - } - else - { - UINT8* RAM = (UINT8*)m_bank4->base(); - return RAM[offset]; - } -} - - -/* used for loading snapshot only ! */ -void amstrad_state::AmstradCPC_PALWrite(int data) -{ - if ((data & 0x0c0)==0x0c0) - { - m_GateArray_RamConfiguration = data; - AmstradCPC_GA_SetRamConfiguration(); - } -} - - -/* ------------------- - - the Gate Array - - ------------------- -The gate array is controlled by I/O. The recommended I/O port address is &7Fxx. -The gate array is selected when bit 15 of the I/O port address is set to "0" and bit 14 of the I/O port address is set to "1". -The values of the other bits are ignored. -However, to avoid conflict with other devices in the system, these bits should be set to "1". - -The function to be performed is selected by writing data to the Gate-Array, bit 7 and 6 of the data define the function selected (see table below). -It is not possible to read from the Gate-Array. - -Bit 7 Bit 6 Function -0 0 Select pen -0 1 Select colour for selected pen -1 0 Select screen mode, rom configuration and interrupt control -1 1 Ram Memory Management (note 1) - -Note 1 : This function is not available in the Gate-Array, but is performed by a device at the same I/O port address location. In the CPC464,CPC664 and KC compact, this function is performed in a memory-expansion (e.g. Dk'Tronics 64K Ram Expansion), if this expansion is not present then the function is not available. In the CPC6128, this function is performed by a PAL located on the main PCB, or a memory-expansion. In the 464+ and 6128+ this function is performed by the ASIC or a memory expansion. Please read the document on Ram Management for more information.*/ - - -void amstrad_state::amstrad_GateArray_write(UINT8 dataToGateArray) -{ -/* Get Bit 7 and 6 of the dataToGateArray = Gate Array function selected */ - switch ((dataToGateArray & 0xc0)>>6) - { -/* Pen selection - ------------- -Bit Value Function Bit Value Function -5 x not used 5 x not used -4 1 Select border 4 0 Select pen -3 x | ignored 3 x | Pen Number -2 x | 2 x | -1 x | 1 x | -0 x | 0 x | -*/ - case 0x00: - /* Select Border Number, get b4 */ - /* if b4 = 0 : Select Pen Number, get b3-b0 */ - m_gate_array.pen_selected = ( dataToGateArray & 0x10 ) ? 0x10 : ( dataToGateArray & 0x0f ); - break; - -/* Colour selection - ---------------- -Even though there is provision for 32 colours, only 27 are possible. -The remaining colours are duplicates of those already in the colour palette. - -Bit Value Function -5 x not used -4 x | Colour number -3 x | -2 x | -1 x | -0 x |*/ - case 0x01: - amstrad_vh_update_colour( m_gate_array.pen_selected, (dataToGateArray & 0x1F)); - break; - -/* Select screen mode and rom configuration - ---------------------------------------- -Bit Value Function -5 x not used -4 x Interrupt generation control -3 1 Upper rom area disable or 0 Upper rom area enable -2 1 Lower rom area disable or 0 Lower rom area enable -1 x | Mode selection -0 x | - -Screen mode selection : The settings for bits 1 and 0 and the corresponding screen mode are given in the table below. ------------------------ -b1 b0 Screen mode -0 0 Mode 0, 160x200 resolution, 16 colours -0 1 Mode 1, 320x200 resolution, 4 colours -1 0 Mode 2, 640x200 resolution, 2 colours -1 1 Mode 3, 160x200 resolution, 4 colours (note 1) - -This mode is not official. From the combinations possible, we can see that 4 modes can be defined, although the Amstrad only has 3. Mode 3 is similar to mode 0, because it has the same resolution, but it is limited to only 4 colours. -Mode changing is synchronised with HSYNC. If the mode is changed, it will take effect from the next HSYNC. - -Rom configuration selection : ------------------------------ -Bit 2 is used to enable or disable the lower rom area. The lower rom area occupies memory addressess &0000-&3fff and is used to access the operating system rom. When the lower rom area is is enabled, reading from &0000-&3FFF will return data in the rom. When a value is written to &0000-&3FFF, it will be written to the ram underneath the rom. When it is disabled, data read from &0000-&3FFF will return the data in the ram. -Similarly, bit 3 controls enabling or disabling of the upper rom area. The upper rom area occupies memory addressess &C000-&FFFF and is BASIC or any expansion roms which may be plugged into a rom board/box. See the document on upper rom selection for more details. When the upper rom area enabled, reading from &c000-&ffff, will return data in the rom. When data is written to &c000-&FFFF, it will be written to the ram at the same address as the rom. When the upper rom area is disabled, and data is read from &c000-&ffff the data returned will be the data in the ram. - -Bit 4 controls the interrupt generation. It can be used to delay interrupts.*/ - case 0x02: - /* If bit 5 is enabled on a CPC Plus/GX4000 when the ASIC is unlocked, sets the lower ROM position and cart bank - b5 = 1, b4b3 = RAM position for lower ROM area and if the ASIC registers are visible at &4000, - b2b1b0 = cartridge bank to read from lower ROM area (0-7 only) */ - if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) - { - if ( m_asic.enabled && (dataToGateArray & 0x20) ) - { - m_asic.rmr2 = dataToGateArray; - } - else - { - m_gate_array.mrer = dataToGateArray; - } - } - else - { - m_gate_array.mrer = dataToGateArray; - } - - /* If bit 4 of the "Select screen mode and rom configuration" register of the Gate-Array is set to "1" - then the interrupt request is cleared and the 6-bit counter is reset to "0". */ - if ( m_gate_array.mrer & 0x10 ) - { - m_gate_array.hsync_counter = 0; - m_maincpu->set_input_line(0, CLEAR_LINE); - } - - /* b3b2 != 0 then change the state of upper or lower rom area and rethink memory */ - if (m_exp) - { - if((dataToGateArray & 0x0c) != 0) - m_exp->romen_w(0); // active low - else - m_exp->romen_w(1); - } - - amstrad_setLowerRom(); - amstrad_setUpperRom(); - - /* b1b0 mode */ - amstrad_vh_update_mode(); - - break; - -/* Ram Memory Management - --------------------- -This function is not available in the Gate-Array, but is performed by a device at the same I/O port address location. -In the CPC464,CPC664 and KC compact, this function is performed in a memory-expansion (e.g. Dk'Tronics 64K Ram Expansion), if this expansion is not present then the function is not available. -In the CPC6128, this function is performed by a PAL located on the main PCB, or a memory-expansion. -In the 464+ and 6128+ this function is performed by the ASIC or a memory expansion. -*/ - case 0x03: - m_GateArray_RamConfiguration = dataToGateArray; - break; - - default: - break; - } -} - - -WRITE8_MEMBER(amstrad_state::aleste_msx_mapper) -{ - int page = (offset & 0x0300) >> 8; - int ramptr = (data & 0x3f) * 0x4000; - int rampage = data & 0x3f; - int function = (data & 0xc0) >> 6; - UINT8 *ram = m_ram->pointer(); - - // It is assumed that functions are all mapped to each port &7cff-&7fff, and b8 and b9 are only used for RAM bank location - switch(function) - { - case 0: // Pen select (same as Gate Array?) - amstrad_GateArray_write(data); - break; - case 1: // Colour select (6-bit palette) - aleste_vh_update_colour( m_gate_array.pen_selected, data & 0x3f ); - break; - case 2: // Screen mode, Upper/Lower ROM select - amstrad_GateArray_write(data); - break; - case 3: // RAM banks - switch(page) - { - case 0: /* 0x0000 - 0x3fff */ - m_bank1->set_base(ram+ramptr); - m_bank2->set_base(ram+ramptr+0x2000); - m_bank9->set_base(ram+ramptr); - m_bank10->set_base(ram+ramptr+0x2000); - m_Aleste_RamBanks[0] = ram+ramptr; - m_aleste_active_page[0] = data; - logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x0000\n",ramptr,rampage); - break; - case 1: /* 0x4000 - 0x7fff */ - m_bank3->set_base(ram+ramptr); - m_bank4->set_base(ram+ramptr+0x2000); - m_bank11->set_base(ram+ramptr); - m_bank12->set_base(ram+ramptr+0x2000); - m_Aleste_RamBanks[1] = ram+ramptr; - m_aleste_active_page[1] = data; - logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x4000\n",ramptr,rampage); - break; - case 2: /* 0x8000 - 0xbfff */ - m_bank5->set_base(ram+ramptr); - m_bank6->set_base(ram+ramptr+0x2000); - m_bank13->set_base(ram+ramptr); - m_bank14->set_base(ram+ramptr+0x2000); - m_Aleste_RamBanks[2] = ram+ramptr; - m_aleste_active_page[2] = data; - logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x8000\n",ramptr,rampage); - break; - case 3: /* 0xc000 - 0xffff */ - m_bank7->set_base(ram+ramptr); - m_bank8->set_base(ram+ramptr+0x2000); - m_bank15->set_base(ram+ramptr); - m_bank16->set_base(ram+ramptr+0x2000); - m_Aleste_RamBanks[3] = ram+ramptr; - m_aleste_active_page[3] = data; - logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0xc000\n",ramptr,rampage); - break; - } - break; - } -} - - -/* CRTC Differences - ---------------- -The following tables list the functions that can be accessed for each type: - -Type 0 -b1 b0 Function Read/Write -0 0 Select internal 6845 register Write Only -0 1 Write to selected internal 6845 register Write Only -1 0 - - -1 1 Read from selected internal 6845 register Read only - -Type 1 -b1 b0 Function Read/Write -0 0 Select internal 6845 register Write Only -0 1 Write to selected internal 6845 register Write Only -1 0 Read Status Register Read Only -1 1 Read from selected internal 6845 register Read only - -Type 2 -b1 b0 Function Read/Write -0 0 Select internal 6845 register Write Only -0 1 Write to selected internal 6845 register Write Only -1 0 - - -1 1 Read from selected internal 6845 register Read only - -Type 3 and 4 -b1 b0 Function Read/Write -0 0 Select internal 6845 register Write Only -0 1 Write to selected internal 6845 register Write Only -1 0 Read from selected internal 6845 register Read Only -1 1 Read from selected internal 6845 register Read only -*/ - -/* I/O port allocation - ------------------- - -Many thanks to Mark Rison for providing the original information. Thankyou to Richard Wilson for his discoveries concerning RAM management I/O decoding. - -This document will explain the decoding of the I/O ports. The port address is not decoded fully which means a hardware device can be accessed through more than one address, in addition, using some addressess can access more than one element of the hardware at the same time. The CPC IN/OUT design differs from the norm in that port numbers are defined using 16 bits, as opposed to the traditional 8 bits. - -IN r,(C)/OUT (C),r instructions: Bits b15-b8 come from the B register, bits b7-b0 come from "r" -IN A,(n)/OUT (n),A instructions: Bits b15-b8 come from the A register, bits b7-b0 come from "n" -Listed below are the internal hardware devices and the bit fields to which they respond. In the table: - -"-" means this bit is ignored, -"0" means the bit must be set to "0" for the hardware device to respond, -"1" means the bit must be set to "1" for the hardware device to respond. -"r1" and "r0" mean a bit used to define a register - -Hardware device Read/Write Port bits - b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 -Gate-Array Write Only 0 1 - - - - - - - - - - - - - - -RAM Configuration Write Only 0 - - - - - - - - - - - - - - - -CRTC Read/Write - 0 - - - - r1 r0 - - - - - - - - -ROM select Write only - - 0 - - - - - - - - - - - - - -Printer port Write only - - - 0 - - - - - - - - - - - - -8255 PPI Read/Write - - - - 0 - r1 r0 - - - - - - - - -Expansion Peripherals Read/Write - - - - - 0 - - - - - - - - - - - -*/ - -READ8_MEMBER(amstrad_state::amstrad_cpc_io_r) -{ - unsigned char data = 0xFF; - unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8); -// m6845_personality_t crtc_type; - int page; - -// crtc_type = ioport("crtc"->read_safe(0)); -// m6845_set_personality(crtc_type); - - if(m_aleste_mode & 0x04) - { - if ((offset & (1<<15)) == 0) // Aleste Mapper is readable? - { - page = (offset & 0x0300) >> 8; - data = m_aleste_active_page[page]; - return data; - } - } - - /* if b14 = 0 : CRTC Read selected */ - if ((offset & (1<<14)) == 0) - { - switch(r1r0) - { - case 0x02: - data = m_crtc->status_r( space, 0 ); -#if 0 - /* CRTC Type 1 : Read Status Register - CRTC Type 3 or 4 : Read from selected internal 6845 register */ - switch(crtc_type) { - case M6845_PERSONALITY_UM6845R: - data = amstrad_CRTC_CR; /* Read Status Register */ - break; - case M6845_PERSONALITY_AMS40489: - case M6845_PERSONALITY_PREASIC: - data = m6845_register_r(0); - break; - default: - break; - } -#endif - break; - case 0x03: - /* All CRTC type : Read from selected internal 6845 register Read only */ - data = m_crtc->register_r( space, (offs_t)0 ); - break; - } - } - -/* if b11 = 0 : 8255 PPI Read selected - bits 9 and 8 then define the PPI function access as shown below: - -b9 b8 | PPI Function Read/Write status -0 0 | Port A data Read/Write -0 1 | Port B data Read/Write -1 0 | Port C data Read/Write -1 1 | Control Write Only -*/ - if ((offset & (1<<11)) == 0) - { - if (r1r0 < 0x03 ) - data = m_ppi->read(space, r1r0); - } - -/* if b10 = 0 : Expansion Peripherals Read selected - -bits b7-b5 are used to select an expansion peripheral. Again, this is done by resetting the peripheral's bit: -Bit | Device -b7 | FDC -b6 | Reserved (was it ever used?) -b5 | Serial port - -In the case of the FDC, bits b8 and b0 are used to select the specific mode of operation; all the other bits (b9,b4-b1) are ignored: -b8 b0 Function Read/Write state -0 0 FDD motor control Write Only -0 1 not used N/A -1 0 Main Status register of FDC (MSR) Read Only -1 1 Data register of FDC Read/Write - -If b10 is reset but none of b7-b5 are reset, user expansion peripherals are selected. -The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which causes the expansion peripherals to reset. - */ - if ( m_system_type != SYSTEM_GX4000 ) - { - if(m_fdc) // if FDC is present (it isn't on a 464) - { - if ( ( offset & (1<<10) ) == 0 ) - { - if ( ( offset & (1<<10) ) == 0 ) - { - int b8b0 = ( ( offset & (1<<8) ) >> (8 - 1) ) | ( offset & 0x01 ); - - switch (b8b0) - { - case 0x02: - data = m_fdc->msr_r(space, 0); - break; - case 0x03: - data = m_fdc->fifo_r(space, 0); - break; - default: - break; - } - } - } - } - } - return data; -} - - -// Handler for checking the ASIC unlocking sequence -void amstrad_state::amstrad_plus_seqcheck(int data) -{ - if(data == 0 && m_prev_data != 0) - { - m_asic.seqptr = 0; // non-zero value followed by zero will sync the locking mechanism - } - if(data == asic_unlock_seq[m_asic.seqptr]) - { - m_asic.seqptr++; - if ( m_asic.seqptr == 14 && m_asic.enabled ) - { - logerror("SYS: ASIC locked\n"); - m_asic.enabled = 0; - } - if ( m_asic.seqptr >= 15 ) // end of sequence - { - logerror("SYS: ASIC unlocked\n"); - m_asic.enabled = 1; - } - } - m_prev_data = data; -} - -WRITE8_MEMBER(amstrad_state::rom_select) -{ - m_gate_array.upper_bank = data; - // expansion devices know the selected ROM by monitoring I/O writes to DFxx - // there are no signals related to which ROM is selected - cpc_expansion_slot_device* exp_port = m_exp; - while(exp_port != NULL) - { - device_cpc_expansion_card_interface* temp; - device_t* temp_dev; - - temp = dynamic_cast(exp_port->get_card_device()); - temp_dev = dynamic_cast(exp_port->get_card_device()); - if(temp != NULL) - { - temp->set_rom_bank(data); - } - exp_port = temp_dev->subdevice("exp"); - } - - amstrad_setUpperRom(); -} - -/* Offset handler for write */ -WRITE8_MEMBER(amstrad_state::amstrad_cpc_io_w) -{ - cpc_multiface2_device* mface2; - - if ((offset & (1<<15)) == 0) - { - if(m_aleste_mode & 0x04) // Aleste mode - { - aleste_msx_mapper(space, offset, data); - } - else - { - /* if b15 = 0 and b14 = 1 : Gate-Array Write Selected*/ - if ((offset & (1<<14)) != 0) - amstrad_GateArray_write(data); - - /* if b15 = 0 : RAM Configuration Write Selected*/ - AmstradCPC_GA_SetRamConfiguration(); - } - } - - /*The Gate-Array and CRTC can't be selected simultaneously, which would otherwise cause potential display corruption.*/ - /* if b14 = 0 : CRTC Write Selected*/ - if ((offset & (1<<14)) == 0) - { - switch ((offset & 0x0300) >> 8) // r1r0 - { - case 0x00: /* Select internal 6845 register Write Only */ - m_crtc->address_w( space, 0, data ); - if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) - amstrad_plus_seqcheck(data); - - /* printer port d7 */ - if (data == 0x0c && m_system_type == SYSTEM_PLUS) - m_printer_bit8_selected = TRUE; - - m_asic.addr_6845 = data; - break; - case 0x01: /* Write to selected internal 6845 register Write Only */ - if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1); - else - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); - m_crtc->register_w( space, 0, data ); - - /* printer port bit 8 */ - if (m_printer_bit8_selected && m_system_type == SYSTEM_PLUS) - { - m_centronics->write_data7(BIT(data, 3)); - m_printer_bit8_selected = FALSE; - } - - if ( m_asic.addr_6845 == 0x01 ) - m_asic.horiz_disp = data; - - break; - default: - break; - } - } - - /* ROM select before GateArrayWrite ?*/ - /* b13 = 0 : ROM select Write Selected*/ - if ((offset & (1<<13)) == 0) - { - rom_select(space,0,data); - } - - /* b12 = 0 : Printer port Write Selected*/ - if(m_system_type != SYSTEM_GX4000) - { - if ((offset & (1<<12)) == 0) - { - /* CPC has a 7-bit data port, bit 8 is the STROBE signal */ - m_centronics->write_data0(BIT(data, 0)); - m_centronics->write_data1(BIT(data, 1)); - m_centronics->write_data2(BIT(data, 2)); - m_centronics->write_data3(BIT(data, 3)); - m_centronics->write_data4(BIT(data, 4)); - m_centronics->write_data5(BIT(data, 5)); - m_centronics->write_data6(BIT(data, 6)); - m_centronics->write_strobe(BIT(data, 7)); - } - } - - /* if b11 = 0 : 8255 PPI Write selected - bits 9 and 8 then define the PPI function access as shown below: - b9 b8 | PPI Function Read/Write status - 0 0 | Port A data Read/Write - 0 1 | Port B data Read/Write - 1 0 | Port C data Read/Write - 1 1 | Control Write Only - */ - if ((offset & (1<<11)) == 0) - { - unsigned int Index = ((offset & 0x0300) >> 8); - - m_ppi->write(space, Index, data); - } - - /* if b10 = 0 : Expansion Peripherals Write selected */ - if ((offset & (1<<10)) == 0) - { -/* bits b7-b5 are used to select an expansion peripheral. This is done by resetting the peripheral's bit: -Bit | Device -b7 | FDC -b6 | Reserved (was it ever used?) -b5 | Serial port - -In the case of the FDC, bits b8 and b0 are used to select the specific mode of operation; -all the other bits (b9,b4-b1) are ignored: -b8 b0 Function Read/Write state -0 0 FDD motor control Write Only -0 1 not used N/A -1 0 Main Status register of FDC (MSR) Read Only -1 1 Data register of FDC Read/Write - -If b10 is reset but none of b7-b5 are reset, user expansion peripherals are selected. -The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which causes the expansion peripherals to reset. -*/ - if(m_system_type != SYSTEM_GX4000) - { - if(m_fdc) // if FDC is present (it isn't on a 464) - { - if ((offset & (1<<7)) == 0) - { - unsigned int b8b0 = ((offset & 0x0100) >> (8 - 1)) | (offset & 0x01); - - switch (b8b0) - { - case 0x00: - case 0x01: - { - /* FDC Motor Control - Bit 0 defines the state of the FDD motor: - * "1" the FDD motor will be active. - * "0" the FDD motor will be in-active.*/ - floppy_image_device *floppy; - floppy = machine().device(":upd765:0")->get_device(); - if(floppy) - floppy->mon_w(!BIT(data, 0)); - floppy = machine().device(":upd765:1")->get_device(); - if(floppy) - floppy->mon_w(!BIT(data, 0)); - break; - } - - case 0x03: /* Write Data register of FDC */ - m_fdc->fifo_w(space, 0,data); - break; - - default: - break; - } - } - } - } - } - - /* Aleste Extend Port: - D0 - VRAM Bank 0/1 (64K) - D1 - MODE 0-Norm ,1-High resolution - D2 - MAPMOD 0-Amstrad ,1-Yamaha mapper - D3 - MAP Page 0/1 (256K) - D4 - 580WI53 - D5 - 0-AY8910 ,1-512WI1 */ - if(offset == 0xfabf) - { - m_aleste_mode = data; - logerror("EXTEND: Port &FABF write 0x%02x\n",data); - m_crtc->set_clock( ( m_aleste_mode & 0x02 ) ? ( XTAL_16MHz / 8 ) : ( XTAL_16MHz / 16 ) ); - } - - mface2 = dynamic_cast(get_expansion_device(machine(),"multiface2")); - if(mface2 != NULL) - { - if(mface2->multiface_io_write(offset, data) != 0) - { - amstrad_rethinkMemory(); - } - } -} - - -/* load CPCEMU style snapshots */ -void amstrad_state::amstrad_handle_snapshot(unsigned char *pSnapshot) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int RegData; - int i; - - /* init Z80 */ - RegData = (pSnapshot[0x011] & 0x0ff) | ((pSnapshot[0x012] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_AF, RegData); - - RegData = (pSnapshot[0x013] & 0x0ff) | ((pSnapshot[0x014] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_BC, RegData); - - RegData = (pSnapshot[0x015] & 0x0ff) | ((pSnapshot[0x016] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_DE, RegData); - - RegData = (pSnapshot[0x017] & 0x0ff) | ((pSnapshot[0x018] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_HL, RegData); - - RegData = (pSnapshot[0x019] & 0x0ff) ; - m_maincpu->set_state_int(Z80_R, RegData); - - RegData = (pSnapshot[0x01a] & 0x0ff); - m_maincpu->set_state_int(Z80_I, RegData); - - if ((pSnapshot[0x01b] & 1)==1) - { - m_maincpu->set_state_int(Z80_IFF1, (UINT64)1); - } - else - { - m_maincpu->set_state_int(Z80_IFF1, (UINT64)0); - } - - if ((pSnapshot[0x01c] & 1)==1) - { - m_maincpu->set_state_int(Z80_IFF2, (UINT64)1); - } - else - { - m_maincpu->set_state_int(Z80_IFF2, (UINT64)0); - } - - RegData = (pSnapshot[0x01d] & 0x0ff) | ((pSnapshot[0x01e] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_IX, RegData); - - RegData = (pSnapshot[0x01f] & 0x0ff) | ((pSnapshot[0x020] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_IY, RegData); - - RegData = (pSnapshot[0x021] & 0x0ff) | ((pSnapshot[0x022] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_SP, RegData); - m_maincpu->set_state_int(STATE_GENSP, RegData); - - RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8); - - m_maincpu->set_state_int(Z80_PC, RegData); -// m_maincpu->set_state_int(REG_SP, RegData); - - RegData = (pSnapshot[0x025] & 0x0ff); - m_maincpu->set_state_int(Z80_IM, RegData); - - RegData = (pSnapshot[0x026] & 0x0ff) | ((pSnapshot[0x027] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_AF2, RegData); - - RegData = (pSnapshot[0x028] & 0x0ff) | ((pSnapshot[0x029] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_BC2, RegData); - - RegData = (pSnapshot[0x02a] & 0x0ff) | ((pSnapshot[0x02b] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_DE2, RegData); - - RegData = (pSnapshot[0x02c] & 0x0ff) | ((pSnapshot[0x02d] & 0x0ff)<<8); - m_maincpu->set_state_int(Z80_HL2, RegData); - - /* init GA */ - for (i=0; i<17; i++) - { - amstrad_GateArray_write(i); - - amstrad_GateArray_write(((pSnapshot[0x02f + i] & 0x01f) | 0x040)); - } - - amstrad_GateArray_write(pSnapshot[0x02e] & 0x01f); - - amstrad_GateArray_write(((pSnapshot[0x040] & 0x03f) | 0x080)); - - AmstradCPC_PALWrite(((pSnapshot[0x041] & 0x03f) | 0x0c0)); - - /* init CRTC */ - for (i=0; i<18; i++) - { - m_crtc->address_w( space, 0, i ); - m_crtc->register_w( space, 0, pSnapshot[0x043+i] & 0xff ); - } - - m_crtc->address_w( space, 0, i ); - - /* upper rom selection */ - m_gate_array.upper_bank = pSnapshot[0x055]; - - /* PPI */ - m_ppi->write(space, 3, pSnapshot[0x059] & 0x0ff); - - m_ppi->write(space, 0, pSnapshot[0x056] & 0x0ff); - m_ppi->write(space, 1, pSnapshot[0x057] & 0x0ff); - m_ppi->write(space, 2, pSnapshot[0x058] & 0x0ff); - - /* PSG */ - for (i=0; i<16; i++) - { - m_ay->address_w(space, 0, i); - m_ay->data_w(space, 0, pSnapshot[0x05b + i] & 0x0ff); - } - - m_ay->address_w(space, 0, pSnapshot[0x05a]); - - { - int MemSize; - int MemorySize; - - MemSize = (pSnapshot[0x06b] & 0x0ff) | ((pSnapshot[0x06c] & 0x0ff)<<8); - - if (MemSize==128) - { - MemorySize = 128*1024; - } - else - { - MemorySize = 64*1024; - } - - memcpy(m_ram->pointer(), &pSnapshot[0x0100], MemorySize); - } - amstrad_rethinkMemory(); -} - - -/* sets up for a machine reset -All hardware is reset and the firmware is completely initialized -Once all tables and jumpblocks have been set up, -control is passed to the default entry in rom 0*/ -void amstrad_state::amstrad_reset_machine() -{ - /* enable lower rom (OS rom) */ - amstrad_GateArray_write(0x089); - - /* set ram config 0 */ - amstrad_GateArray_write(0x0c0); - - // Get manufacturer name and TV refresh rate from PCB link (dipswitch for mess emulation) - m_ppi_port_inputs[amstrad_ppi_PortB] = (((m_io_solder_links->read()&MANUFACTURER_NAME)<<1) | (m_io_solder_links->read()&TV_REFRESH_RATE)); - - if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) - { - memset(m_asic.ram,0,16384); // clear ASIC RAM - } -} - - -/*------------------ - - Rethink Memory - - ------------------*/ -void amstrad_state::amstrad_rethinkMemory() -{ - cpc_multiface2_device* mface2; - /* the following is used for banked memory read/writes and for setting up - * opcode and opcode argument reads */ - - /* bank 0 - 0x0000..0x03fff */ - amstrad_setLowerRom(); - - /* bank 1 - 0x04000..0x07fff */ - if ( m_system_type == SYSTEM_CPC || m_system_type == SYSTEM_ALESTE || m_asic.enabled == 0 ) - { - if(m_aleste_mode & 0x04) - { - m_bank3->set_base(m_Aleste_RamBanks[1]); - m_bank4->set_base(m_Aleste_RamBanks[1]+0x2000); - /* bank 2 - 0x08000..0x0bfff */ - m_bank5->set_base(m_Aleste_RamBanks[2]); - m_bank6->set_base(m_Aleste_RamBanks[2]+0x2000); - } - else - { - m_bank3->set_base(m_AmstradCPC_RamBanks[1]); - m_bank4->set_base(m_AmstradCPC_RamBanks[1]+0x2000); - /* bank 2 - 0x08000..0x0bfff */ - m_bank5->set_base(m_AmstradCPC_RamBanks[2]); - m_bank6->set_base(m_AmstradCPC_RamBanks[2]+0x2000); - } - } - else - { - amstrad_setLowerRom(); - } - - /* bank 3 - 0x0c000..0x0ffff */ - amstrad_setUpperRom(); - - /* other banks */ - if(m_aleste_mode & 0x04) - { - m_bank9->set_base(m_Aleste_RamBanks[0]); - m_bank10->set_base(m_Aleste_RamBanks[0]+0x2000); - m_bank11->set_base(m_Aleste_RamBanks[1]); - m_bank12->set_base(m_Aleste_RamBanks[1]+0x2000); - m_bank13->set_base(m_Aleste_RamBanks[2]); - m_bank14->set_base(m_Aleste_RamBanks[2]+0x2000); - m_bank15->set_base(m_Aleste_RamBanks[3]); - m_bank16->set_base(m_Aleste_RamBanks[3]+0x2000); - } - else - { - m_bank9->set_base(m_AmstradCPC_RamBanks[0]); - m_bank10->set_base(m_AmstradCPC_RamBanks[0]+0x2000); - m_bank11->set_base(m_AmstradCPC_RamBanks[1]); - m_bank12->set_base(m_AmstradCPC_RamBanks[1]+0x2000); - m_bank13->set_base(m_AmstradCPC_RamBanks[2]); - m_bank14->set_base(m_AmstradCPC_RamBanks[2]+0x2000); - m_bank15->set_base(m_AmstradCPC_RamBanks[3]); - m_bank16->set_base(m_AmstradCPC_RamBanks[3]+0x2000); - } - - /* multiface hardware enabled? */ - mface2 = dynamic_cast(get_expansion_device(machine(),"multiface2")); - if(mface2 != NULL) - { - if (mface2->multiface_hardware_enabled()) - { - if((m_gate_array.mrer & 0x04) == 0) - { - mface2->multiface_rethink_memory(); - } - } - } - - /* mappings for other expansion devices */ - if (m_exp) - m_exp->set_mapping(); -} - - -void amstrad_state::kccomp_reset_machine() -{ - /* enable lower rom (OS rom) */ - amstrad_GateArray_write(0x089); - - /* set ram config 0 */ - amstrad_GateArray_write(0x0c0); -} - - -void amstrad_state::screen_eof_amstrad(screen_device &screen, bool state) -{ - // rising edge - if (state) - { - cpc_multiface2_device* mface2 = dynamic_cast(get_expansion_device(machine(),"multiface2")); - - if(mface2 != NULL) - { - mface2->check_button_state(); - } - } -} - - -/* --------------------------------------- - - 27.05.2004 - PSG function selection - - --------------------------------------- -The databus of the PSG is connected to PPI Port A. -Data is read from/written to the PSG through this port. - -The PSG function, defined by the BC1,BC2 and BDIR signals, is controlled by bit 7 and bit 6 of PPI Port C. - -PSG function selection: ------------------------ -Function - -BDIR = PPI Port C Bit 7 and BC1 = PPI Port C Bit 6 - -PPI Port C Bit | PSG Function -BDIR BC1 | -0 0 | Inactive -0 1 | Read from selected PSG register. When function is set, the PSG will make the register data available to PPI Port A -1 0 | Write to selected PSG register. When set, the PSG will take the data at PPI Port A and write it into the selected PSG register -1 1 | Select PSG register. When set, the PSG will take the data at PPI Port A and select a register -*/ -/* PSG function selected */ -void amstrad_state::update_psg() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - if(m_aleste_mode & 0x20) // RTC selected - { - switch(m_aleste_rtc_function) - { - case 0x02: // AS - m_rtc->write(space, 0,m_ppi_port_outputs[amstrad_ppi_PortA]); - break; - case 0x04: // DS write - m_rtc->write(space, 1,m_ppi_port_outputs[amstrad_ppi_PortA]); - break; - case 0x05: // DS read - m_ppi_port_inputs[amstrad_ppi_PortA] = m_rtc->read(space, 1); - break; - } - return; - } - switch (m_Psg_FunctionSelected) - { - case 0: - {/* Inactive */ - } break; - case 1: - {/* b6 = 1 ? : Read from selected PSG register and make the register data available to PPI Port A */ - m_ppi_port_inputs[amstrad_ppi_PortA] = m_ay->data_r(space, 0); - } - break; - case 2: - {/* b7 = 1 ? : Write to selected PSG register and write data to PPI Port A */ - m_ay->data_w(space, 0, m_ppi_port_outputs[amstrad_ppi_PortA]); - } - break; - case 3: - {/* b6 and b7 = 1 ? : The register will now be selected and the user can read from or write to it. The register will remain selected until another is chosen.*/ - m_ay->address_w(space, 0, m_ppi_port_outputs[amstrad_ppi_PortA]); - m_prev_reg = m_ppi_port_outputs[amstrad_ppi_PortA]; - } - break; - default: - { - } break; - } -} - - -/* Read/Write 8255 PPI port A (connected to AY-3-8912 databus) */ -READ8_MEMBER(amstrad_state::amstrad_ppi_porta_r) -{ - update_psg(); - return m_ppi_port_inputs[amstrad_ppi_PortA]; -} - - -WRITE8_MEMBER(amstrad_state::amstrad_ppi_porta_w) -{ - m_ppi_port_outputs[amstrad_ppi_PortA] = data; - update_psg(); -} - - -/* - Read PPI Port B - - ------------------- -Bit Description -7 Cassette read data -6 Parallel/Printer port ready signal ("1" = not ready, "0" = Ready) -5 /EXP signal on expansion port (note 6) -4 50/60 Hz (link on PCB. For this MESS driver I have used the dipswitch feature) (note 5) -3 | PCB links to define manufacturer name. For this MESS driver I have used the dipswitch feature. (note 1) (note 4) -2 | (note 2) -1 | (note 3) -0 VSYNC State from 6845. "1" = VSYNC active, "0" = VSYNC inactive - -Note: - -1 On CPC464,CPC664,CPC6128 and GX4000 this is LK3 on the PCB. On the CPC464+ and CPC6128+ this is LK103 on the PCB. On the KC compact this is "1". -2 On CPC464,CPC664,CPC6128 and GX4000 this is LK2 on the PCB. On the CPC464+ and CPC6128+ this is LK102 on the PCB. On the KC compact this is "0". -3 On CPC464,CPC664,CPC6128 and GX4000 this is LK1 on the PCB. On the CPC464+ and CPC6128+ this is LK101 on the PCB. On the KC compact this is /TEST signal from the expansion port. -4 On the CPC464,CPC664,CPC6128,CPC464+,CPC6128+ and GX4000 bits 3,2 and 1 define the manufacturer name. See below to see the options available. The manufacturer name is defined on the PCB and cannot be changed through software. -5 On the CPC464,CPC664,CPC6128,CPC464+,CPC6128+ and GX4000 bit 4 defines the Screen refresh frequency. "1" = 50 Hz, "0" = 60 Hz. This is defined on the PCB and cannot be changed with software. On the KC compact bit 4 is "1" -6 This bit is connected to /EXP signal on the expansion port. - On the KC Compact this bit is used to define bit 7 of the printer data. - On the CPC, it is possible to use this bit to define bit 7 of the printer data, so a 8-bit printer port is made, with a hardware modification, - On the CPC this can be used by a expansion device to report it's presence. "1" = device connected, "0" = device not connected. This is not always used by all expansion devices. -*/ - -WRITE_LINE_MEMBER(amstrad_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -READ8_MEMBER(amstrad_state::amstrad_ppi_portb_r) -{ - int data = 0; -/* Set b7 with cassette tape input */ - if(m_system_type != SYSTEM_GX4000) - { - if (m_cassette->input() > 0.03) - { - data |= (1<<7); - } - } -/* Set b6 with Parallel/Printer port ready */ - if(m_system_type != SYSTEM_GX4000) - { - data |= m_centronics_busy << 6; - } -/* Set b4-b1 50Hz/60Hz state and manufacturer name defined by links on PCB */ - data |= (m_ppi_port_inputs[amstrad_ppi_PortB] & 0x1e); - -/* Set b0 with VSync state from the CRTC */ - data |= m_gate_array.vsync; - - if(m_aleste_mode & 0x04) - { - if(m_fdc->get_irq() == 0) - data &= ~0x02; - else - data |= 0x02; - } - -//logerror("amstrad_ppi_portb_r\n"); - /* Schedule a write to PC2 */ - timer_set(attotime::zero, TIMER_PC2_LOW); - - return data; -} - - -/* 26-May-2005 - PPI Port C - ----------------------- -Bit Description Usage -7 PSG BDIR | PSG function selection -6 PSG BC1 | -5 Cassette Write data -4 Cassette Motor Control set bit to "1" for motor on, or "0" for motor off -3 | Keyboard line Select keyboard line to be scanned (0-15) -2 | -1 | -0 |*/ - -/* previous_ppi_portc_w value */ - -WRITE8_MEMBER(amstrad_state::amstrad_ppi_portc_w) -{ - int changed_data; - - m_previous_ppi_portc_w = m_ppi_port_outputs[amstrad_ppi_PortC]; -/* Write the data to Port C */ - changed_data = m_previous_ppi_portc_w^data; - - m_ppi_port_outputs[amstrad_ppi_PortC] = data; - -/* get b7 and b6 (PSG Function Selected */ - m_Psg_FunctionSelected = ((data & 0xC0)>>6); - - /* MC146818 function */ - m_aleste_rtc_function = data & 0x07; - - /* Perform PSG function */ - update_psg(); - - /* b5 Cassette Write data */ - if(m_system_type != SYSTEM_GX4000) - { - if ((changed_data & 0x20) != 0) - { - m_cassette->output(((data & 0x20) ? -1.0 : +1.0)); - } - } - - /* b4 Cassette Motor Control */ - if(m_system_type != SYSTEM_GX4000) - { - if ((changed_data & 0x10) != 0) - { - m_cassette->change_state( - ((data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED), - CASSETTE_MASK_MOTOR); - } - } -} - - -/* Additional notes for the AY-3-8912 in the CPC design -Port A of the AY-3-8912 is connected to the keyboard. -The data for a selected keyboard line can be read through Port A, as long as it is defined as input. -The operating system and I believe all programs assume this port has been defined as input. (NWC has found a bug in the Multiface 2 software. The Multiface does not reprogram the input/output state of the AY-3-8912's registers, therefore if port A is programmed as output, the keyboard will be unresponsive and it will not be possible to use the Multiface functions.) -When port B is defined as input (bit 7 of register 7 is set to "0"), a read of this port will return &FF. -*/ - -/* read PSG port A */ -READ8_MEMBER(amstrad_state::amstrad_psg_porta_read) -{ - /* Read CPC Keyboard - If keyboard matrix line 11-15 are selected, the byte is always &ff. - After testing on a real CPC, it is found that these never change, they always return &FF. */ - - if ( ( m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) > 10) - { - return 0xFF; - } - else - { - if(m_aleste_mode == 0x08 && ( m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) == 10) - return 0xff; - - if (m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]) - { - if(m_system_type != SYSTEM_GX4000) - { - if(m_io_ctrltype && (m_io_ctrltype->read() == 1) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) - { - return m_amx_mouse_data; - } - if(m_io_ctrltype && (m_io_ctrltype->read() == 2) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) - { - return (m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F] ? m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read() & 0x80 : 0) | 0x7f; - } - } - - return m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F] ? m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read() : 0; - } - return 0xFF; - } -} - - -/* called when cpu acknowledges int */ -/* reset top bit of interrupt line counter */ -/* this ensures that the next interrupt is no closer than 32 lines */ -IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int) -{ - // DMA interrupts can be automatically cleared if bit 0 of &6805 is set to 0 - if( m_asic.enabled && m_plus_irq_cause != 0x06 && m_asic.dma_clear & 0x01) - { - logerror("IRQ: Not cleared, IRQ was called by DMA [%i]\n",m_plus_irq_cause); - m_asic.ram[0x2c0f] &= ~0x80; // not a raster interrupt, so this bit is reset - return (m_asic.ram[0x2805] & 0xf8) | m_plus_irq_cause; - } - m_maincpu->set_input_line(0, CLEAR_LINE); - m_gate_array.hsync_counter &= 0x1F; - if ( m_asic.enabled ) - { - if(m_plus_irq_cause == 6) // bit 7 is set "if last interrupt acknowledge cycle was caused by a raster interrupt" - m_asic.ram[0x2c0f] |= 0x80; - else - { - m_asic.ram[0x2c0f] &= ~0x80; - m_asic.ram[0x2c0f] &= (0x40 >> m_plus_irq_cause/2); - } - return (m_asic.ram[0x2805] & 0xf8) | m_plus_irq_cause; - } - if(m_system_type != SYSTEM_GX4000) - { - // update AMX mouse inputs (normally done every 1/300th of a second) - if(m_io_ctrltype && m_io_ctrltype->read() == 1) - { - static UINT8 prev_x,prev_y; - UINT8 data_x, data_y; - - m_amx_mouse_data = 0x0f; - data_x = m_io_mouse1 ? m_io_mouse1->read() : 0; - data_y = m_io_mouse2 ? m_io_mouse2->read() : 0; - - if(data_x > prev_x) - m_amx_mouse_data &= ~0x08; - if(data_x < prev_x) - m_amx_mouse_data &= ~0x04; - if(data_y > prev_y) - m_amx_mouse_data &= ~0x02; - if(data_y < prev_y) - m_amx_mouse_data &= ~0x01; - m_amx_mouse_data |= ((m_io_mouse3 ? m_io_mouse3->read() : 0) << 4); - prev_x = data_x; - prev_y = data_y; - - m_amx_mouse_data |= ((m_io_kbrow[9] ? m_io_kbrow[9]->read() : 0) & 0x80); // DEL key - } - } - return 0xFF; -} - - -/* the following timings have been measured! */ -static const UINT8 amstrad_cycle_table_op[256] = { - 4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4, - 12, 12, 8, 8, 4, 4, 8, 4, 12, 12, 8, 8, 4, 4, 8, 4, - 8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4, - 8, 12, 16, 8, 12, 12, 12, 4, 8, 12, 16, 8, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 8, 8, 8, 8, 8, 8, 4, 8, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 4, 12, 20, 8, 16, - 8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16, - 8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16, - 8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16 -}; - -static const UINT8 amstrad_cycle_table_cb[256]= -{ - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4, - 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4 -}; - -static const UINT8 amstrad_cycle_table_ed[256]= -{ - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 12, 12, 12, 20, 4, 12, 4, 8, 12, 12, 12, 20, 4, 12, 4, 8, - 12, 12, 12, 20, 4, 12, 4, 8, 12, 12, 12, 20, 4, 12, 4, 8, - 12, 12, 12, 20, 4, 12, 4, 16, 12, 12, 12, 20, 4, 12, 4, 16, - 12, 12, 12, 20, 4, 12, 4, 4, 12, 12, 12, 20, 4, 12, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 16, 12, 16, 16, 4, 4, 4, 4, 16, 12, 16, 16, 4, 4, 4, 4, - 16, 12, 16, 16, 4, 4, 4, 4, 16, 12, 16, 16, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 -}; - -static const UINT8 amstrad_cycle_table_xy[256]= -{ - 4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4, - 12, 12, 8, 8, 4, 4, 8, 4, 12, 12, 8, 8, 4, 4, 8, 4, - 8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4, - 8, 12, 16, 8, 20, 20, 20, 4, 8, 12, 16, 8, 4, 4, 8, 4, - 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, - 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, - 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, - 16, 16, 16, 16, 16, 16, 4, 16, 4, 4, 4, 4, 4, 4, 16, 4, - 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, - 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, - 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, - 4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4, - 8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 4, 12, 20, 8, 16, - 8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16, - 8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16, - 8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16 -}; - -static const UINT8 amstrad_cycle_table_xycb[256]= -{ - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 -}; - -static const UINT8 amstrad_cycle_table_ex[256]= -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 8, 4, 4, 0, 0, 0, 0, 4, 8, 4, 4, 0, 0, 0, 0, - 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, - 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, - 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, - 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0 -}; - -#define NEXT_ROM_SLOT m_rom_count++; \ - if(slot3 && m_rom_count == 3) m_rom_count++; \ - if(slot7 && m_rom_count == 7) m_rom_count++; - -void amstrad_state::enumerate_roms() -{ - UINT8 m_rom_count = 1; - device_t* romexp; - rom_image_device* romimage; - UINT8 *rom = m_region_maincpu->base(); - char str[20]; - int i; - bool slot3 = false,slot7 = false; - - if (m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000) - { - UINT8 *crt = m_region_cart->base(); - int bank_mask = (m_cart->get_rom_size() / 0x4000) - 1; - - /* ROMs are stored on the inserted cartridge in the Plus/GX4000 */ - for(i=0; i<128; i++) // fill ROM table - m_Amstrad_ROM_Table[i] = &crt[0x4000]; - for(i=128;i<160;i++) - m_Amstrad_ROM_Table[i] = &crt[((i - 128) & bank_mask) * 0x4000]; - m_Amstrad_ROM_Table[7] = &crt[0xc000]; - slot7 = true; - } - else - { - /* slot 0 is always BASIC, as is any unused slot */ - for(i=0; i<256; i++) - m_Amstrad_ROM_Table[i] = &rom[0x014000]; - /* AMSDOS ROM -- TODO: exclude from 464 unless a DDI-1 device is connected */ - m_Amstrad_ROM_Table[7] = &rom[0x018000]; - slot7 = true; - } - - /* MSX-DOS BIOS - Aleste MSX emulation */ - if(m_system_type == SYSTEM_ALESTE) - { - m_Amstrad_ROM_Table[3] = &rom[0x01c000]; - slot3 = true; - } - - /* enumerate expansion ROMs */ - - /* find any expansion devices that have a 'exp_rom' region */ - cpc_expansion_slot_device* exp_port = m_exp; - - while(exp_port != NULL) - { - device_t* temp; - - temp = dynamic_cast(exp_port->get_card_device()); - if(temp != NULL) - { - if(temp->memregion("exp_rom")->base() != NULL) - { - int num = temp->memregion("exp_rom")->bytes() / 0x4000; - for(i=0;imemregion("exp_rom")->base()+0x4000*i; - NEXT_ROM_SLOT - } - } - } - exp_port = temp->subdevice("exp"); - } - - - /* add ROMs from ROMbox expansion */ - romexp = get_expansion_device(machine(),"rom"); - if(romexp) - { - for(i=0;i<8;i++) - { - sprintf(str,"rom%i",i+1); - romimage = romexp->subdevice(str); - if(romimage->base() != NULL) - { - m_Amstrad_ROM_Table[m_rom_count] = romimage->base(); - NEXT_ROM_SLOT - } - } - } - -} - -void amstrad_state::amstrad_common_init() -{ -// address_space &space = m_maincpu->space(AS_PROGRAM); - - m_aleste_mode = 0; - - m_gate_array.mrer = 0; - m_gate_array.vsync = 0; - m_gate_array.hsync = 0; - m_GateArray_RamConfiguration = 0; - m_gate_array.hsync_counter = 2; - -/* space.install_read_bank(0x0000, 0x1fff, "bank1"); - space.install_read_bank(0x2000, 0x3fff, "bank2"); - - space.install_read_bank(0x4000, 0x5fff, "bank3"); - space.install_read_bank(0x6000, 0x7fff, "bank4"); - - space.install_read_bank(0x8000, 0x9fff, "bank5"); - space.install_read_bank(0xa000, 0xbfff, "bank6"); - - space.install_read_bank(0xc000, 0xdfff, "bank7"); - space.install_read_bank(0xe000, 0xffff, "bank8"); - - space.install_write_bank(0x0000, 0x1fff, "bank9"); - space.install_write_bank(0x2000, 0x3fff, "bank10"); - - space.install_write_bank(0x4000, 0x5fff, "bank11"); - space.install_write_bank(0x6000, 0x7fff, "bank12"); - - space.install_write_bank(0x8000, 0x9fff, "bank13"); - space.install_write_bank(0xa000, 0xbfff, "bank14"); - - space.install_write_bank(0xc000, 0xdfff, "bank15"); - space.install_write_bank(0xe000, 0xffff, "bank16"); -*/ - enumerate_roms(); - - m_maincpu->reset(); - if ( m_system_type == SYSTEM_CPC || m_system_type == SYSTEM_ALESTE ) - m_maincpu->set_input_line_vector(0, 0xff); - else - m_maincpu->set_input_line_vector(0, 0x00); - - /* The opcode timing in the Amstrad is different to the opcode - timing in the core for the Z80 CPU. - - The Amstrad hardware issues a HALT for each memory fetch. - This has the effect of stretching the timing for Z80 opcodes, - so that they are all multiple of 4 T states long. All opcode - timings are a multiple of 1us in length. */ - - /* Using the cool code Juergen has provided, I will override - the timing tables with the values for the amstrad */ - m_maincpu->z80_set_cycle_tables( - (const UINT8*)amstrad_cycle_table_op, - (const UINT8*)amstrad_cycle_table_cb, - (const UINT8*)amstrad_cycle_table_ed, - (const UINT8*)amstrad_cycle_table_xy, - (const UINT8*)amstrad_cycle_table_xycb, - (const UINT8*)amstrad_cycle_table_ex); - - /* Juergen is a cool dude! */ -} - -TIMER_CALLBACK_MEMBER(amstrad_state::cb_set_resolution) -{ - rectangle visarea; - attoseconds_t refresh; - int height; - - if ( m_io_solder_links->read() & 0x10 ) - { - /* PAL */ - visarea.set(0, 64 + 640 + 64 - 1, 34, 34 + 15 + 242 + 15 - 1); - height = 312; - } - else - { - /* NTSC */ - visarea.set(0, 64 + 640 + 64 - 1, 16, 16 + 15 + 200 + 15 - 1); - height = 262; - } - refresh = HZ_TO_ATTOSECONDS( XTAL_16MHz ) * 1024 * height; - m_screen->configure( 1024, height, visarea, refresh ); -} - - -MACHINE_START_MEMBER(amstrad_state,amstrad) -{ - m_system_type = SYSTEM_CPC; - m_centronics->write_data7(0); -} - - -MACHINE_RESET_MEMBER(amstrad_state,amstrad) -{ - amstrad_common_init(); - amstrad_reset_machine(); -// amstrad_init_palette(machine()); - - m_gate_array.de = 0; - m_gate_array.draw_p = NULL; - m_gate_array.hsync = 0; - m_gate_array.vsync = 0; - - timer_set(attotime::zero, TIMER_SET_RESOLUTION); -} - - -MACHINE_START_MEMBER(amstrad_state,plus) -{ - m_asic.ram = m_region_user1->base(); // 16kB RAM for ASIC, memory-mapped registers. - m_system_type = SYSTEM_PLUS; - m_centronics->write_data7(0); - - std::string region_tag; - m_region_cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - if (!m_region_cart) // this should never happen, since we make carts mandatory! - m_region_cart = memregion("maincpu"); -} - - -MACHINE_RESET_MEMBER(amstrad_state,plus) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - m_asic.enabled = 0; - m_asic.seqptr = 0; - m_asic.pri = 0; // disable PRI - m_asic.dma_status = 0; // disable all DMA channels - m_asic.dma_addr[0] = 0; - m_asic.dma_prescaler[0] = 0; - m_asic.dma_addr[1] = 0; - m_asic.dma_prescaler[1] = 0; - m_asic.dma_addr[2] = 0; - m_asic.dma_prescaler[2] = 0; - m_asic.dma_clear = 1; // by default, DMA interrupts must be cleared by writing to the DSCR (&6c0f) - m_plus_irq_cause = 6; - - amstrad_common_init(); - amstrad_reset_machine(); - m_asic.ram[0x2805] = 0x01; // interrupt vector is undefined at startup, except that bit 0 is always 1. - AmstradCPC_GA_SetRamConfiguration(); - amstrad_GateArray_write(0x081); // Epyx World of Sports requires upper ROM to be enabled by default - - space.install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),this)); - space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),this)); - space.install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),this)); - space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this)); - - // multiface_init(); - timer_set(attotime::zero, TIMER_SET_RESOLUTION); -} - -MACHINE_START_MEMBER(amstrad_state,gx4000) -{ - m_asic.ram = m_region_user1->base(); // 16kB RAM for ASIC, memory-mapped registers. - m_system_type = SYSTEM_GX4000; - - std::string region_tag; - m_region_cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - if (!m_region_cart) // this should never happen, since we make carts mandatory! - m_region_cart = memregion("maincpu"); -} - -MACHINE_RESET_MEMBER(amstrad_state,gx4000) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - m_asic.enabled = 0; - m_asic.seqptr = 0; - m_asic.pri = 0; // disable PRI - m_asic.dma_status = 0; // disable all DMA channels - m_asic.dma_addr[0] = 0; - m_asic.dma_prescaler[0] = 0; - m_asic.dma_addr[1] = 0; - m_asic.dma_prescaler[1] = 0; - m_asic.dma_addr[2] = 0; - m_asic.dma_prescaler[2] = 0; - m_asic.dma_clear = 1; // by default, DMA interrupts must be cleared by writing to the DSCR (&6c0f) - m_plus_irq_cause = 6; - - amstrad_common_init(); - amstrad_reset_machine(); - m_asic.ram[0x2805] = 0x01; // interrupt vector is undefined at startup, except that bit 0 is always 1. - AmstradCPC_GA_SetRamConfiguration(); - amstrad_GateArray_write(0x081); // Epyx World of Sports requires upper ROM to be enabled by default - // multiface_init(); - space.install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),this)); - space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),this)); - space.install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),this)); - space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this)); - - timer_set(attotime::zero, TIMER_SET_RESOLUTION); -} - -MACHINE_START_MEMBER(amstrad_state,kccomp) -{ - m_system_type = SYSTEM_CPC; - m_centronics->write_data7(0); - - m_gate_array.de = 0; - m_gate_array.draw_p = NULL; - m_gate_array.hsync = 0; - m_gate_array.vsync = 0; - - timer_set(attotime::zero, TIMER_SET_RESOLUTION); -} - - -MACHINE_RESET_MEMBER(amstrad_state,kccomp) -{ - amstrad_common_init(); - kccomp_reset_machine(); - - /* bit 1 = /TEST. When 0, KC compact will enter data transfer - sequence, where another system using the expansion port signals - DATA2,DATA1, /STROBE and DATA7 can transfer 256 bytes of program. - When the program has been transfered, it will be executed. This - is not supported in the driver */ - /* bit 3,4 are tied to +5V, bit 2 is tied to 0V */ - m_ppi_port_inputs[amstrad_ppi_PortB] = (1<<4) | (1<<3) | 2; -} - - -MACHINE_START_MEMBER(amstrad_state,aleste) -{ - m_system_type = SYSTEM_ALESTE; - m_centronics->write_data7(0); -} - -MACHINE_RESET_MEMBER(amstrad_state,aleste) -{ - amstrad_common_init(); - amstrad_reset_machine(); - - timer_set(attotime::zero, TIMER_SET_RESOLUTION); -} - - -/* load snapshot */ -SNAPSHOT_LOAD_MEMBER( amstrad_state,amstrad) -{ - dynamic_buffer snapshot; - - /* get file size */ - if (snapshot_size < 8) - return IMAGE_INIT_FAIL; - - snapshot.resize(snapshot_size); - - /* read whole file */ - image.fread(&snapshot[0], snapshot_size); - - if (memcmp(&snapshot[0], "MV - SNA", 8)) - { - return IMAGE_INIT_FAIL; - } - - amstrad_handle_snapshot(&snapshot[0]); - return IMAGE_INIT_PASS; -} - - -DEVICE_IMAGE_LOAD_MEMBER(amstrad_state, amstrad_plus_cartridge) -{ - UINT32 size = m_cart->common_get_size("rom"); - unsigned char header[12]; - bool is_cpr = FALSE; - logerror("IMG: loading CPC+ cartridge file\n"); - - // check for .CPR header - if (image.software_entry() == NULL) - { - image.fread(header, 12); - if (strncmp((char *)header, "RIFF", 4) != 0) - { - // not a CPR file, so rewind the image at start - image.fseek(0, SEEK_SET); - } - else - { - is_cpr = TRUE; - size -= 12; - } - } - - // alloc ROM - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - - // actually load the cart into ROM - if (image.software_entry() != NULL) - { - logerror("IMG: raw CPC+ cartridge from softlist\n"); - memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size); - } - else if (!is_cpr) - { - // not an RIFF format file, assume raw binary (*.bin) - logerror("IMG: raw CPC+ cartridge file\n"); - if (size % 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Attempt to load a raw binary with some block smaller than 16kB in size"); - return IMAGE_INIT_FAIL; - } - else - image.fread(m_cart->get_rom_base(), size); - } - else - { - // load CPC Plus / GX4000 cartridge image - // Format is RIFF: RIFF header chunk contains "AMS!" - // Chunks should be 16k, but may vary - // Chunks labeled 'cb00' represent Cartridge block 0, and is loaded to &0000-&3fff - // 'cb01' represent Cartridge block 1, and is loaded to &4000-&7fff - // ... and so on. - - UINT32 offset = 0; - UINT8 *crt = m_cart->get_rom_base(); - dynamic_buffer temp_copy; - temp_copy.resize(size); - image.fread(&temp_copy[0], size); - - // RIFF chunk bits - char chunkid[4]; // chunk ID (4 character code - cb00, cb01, cb02... upto cb31 (max 512kB), other chunks are ignored) - char chunklen[4]; // chunk length (always little-endian) - int chunksize; // chunk length, calcaulated from the above - int ramblock; // 16k RAM block chunk is to be loaded into - unsigned int bytes_to_read; // total bytes to read, as mame_feof doesn't react to EOF without trying to go past it. - - // Is RIFF format (*.cpr) - if (strncmp((char*)(header + 8), "AMS!", 4) != 0) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not an Amstrad CPC cartridge image (despite RIFF header)"); - return IMAGE_INIT_FAIL; - } - - bytes_to_read = header[4] + (header[5] << 8) + (header[6] << 16)+ (header[7] << 24); - bytes_to_read -= 4; // account for AMS! header - logerror("CPR: Data to read: %i bytes\n", bytes_to_read); - // read some chunks - while (bytes_to_read > 0) - { - memcpy(chunkid, &temp_copy[offset], 4); - bytes_to_read -= 4; - offset += 4; - - memcpy(chunklen, &temp_copy[offset], 4); - bytes_to_read -= 4; - offset += 4; - - // calculate little-endian value, just to be sure - chunksize = chunklen[0] + (chunklen[1] << 8) + (chunklen[2] << 16) + (chunklen[3] << 24); - - if (strncmp(chunkid, "cb", 2) == 0) - { - // load chunk into RAM - // find out what block this is - ramblock = (chunkid[2] - 0x30) * 10; - ramblock += chunkid[3] - 0x30; - logerror("CPR: Loading chunk into RAM block %i ['%4s']\n", ramblock, chunkid); - - // load block into ROM area (max 512K) - if (ramblock >= 0 && ramblock < 32) - { - if (chunksize > 0x4000) - chunksize = 0x4000; - - memcpy(crt + 0x4000 * ramblock, &temp_copy[offset], chunksize); - bytes_to_read -= chunksize; - offset += chunksize; - logerror("CPR: Loaded %i-byte chunk into RAM block %i\n", chunksize, ramblock); - } - } - else - { - logerror("CPR: Unknown chunk '%4s', skipping %i bytes\n", chunkid, chunksize); - if (chunksize != 0) - { - bytes_to_read -= chunksize; - offset += chunksize; - } - } - } - } - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/apollo.c b/src/mess/machine/apollo.c deleted file mode 100644 index 568a9c08fc8..00000000000 --- a/src/mess/machine/apollo.c +++ /dev/null @@ -1,1042 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Hans Ostermeyer, R. Belmont -/* - * apollo.c - Apollo DS3500 CPU Board - * - * Created on: Jan 20, 2011 - * Author: Hans Ostermeyer - * - * Contains: - * - apollo_config.c - APOLLO DS3500 configuration - * - apollo_csr.c - APOLLO DS3500 CPU Control and Status registers - * - apollo_dma.c - APOLLO DS3500 DMA controllers - * - apollo_pic.c - APOLLO DS3500 PIC8259 controllers - * - apollo_ptm.c - APOLLO DS3500 Programmable Timer 6840 - * - apollo_rtc.c - APOLLO DS3500 RTC MC146818 - * - apollo_sio.c - APOLLO DS3500 SIO - * - apollo_sio2.c - APOLLO DS3500 SIO2 - * - apollo_stdio.c - stdio terminal for mess - * - apollo_3c505.h - Apollo 3C505 Ethernet controller - * - * see also: - * - http://www.bitsavers.org/pdf/apollo/008778-03_DOMAIN_Series_3000_4000_Technical_Reference_Aug87.pdf - * - http://www.freescale.com/files/32bit/doc/inactive/MC68681UM.pdf - * - * SIO usage: - * SIO: ch A keyboard, ch B serial console - * SIO2: modem/printer? - * - */ - -#include "includes/apollo.h" - -#include "bus/isa/omti8621.h" -#include "bus/isa/sc499.h" -#include "bus/isa/3c505.h" - -#define APOLLO_IRQ_VECTOR 0xa0 -#define APOLLO_IRQ_PTM 0 -#define APOLLO_IRQ_SIO1 1 -#define APOLLO_IRQ_PIC_SLAVE 3 -#define APOLLO_IRQ_CTAPE 5 -#define APOLLO_IRQ_FDC 6 -#define APOLLO_IRQ_RTC 8 // DN3000 only -#define APOLLO_IRQ_SIO2 8 // DN3500 -#define APOLLO_IRQ_ETH2 9 -#define APOLLO_IRQ_ETH1 10 -#define APOLLO_IRQ_DIAG 13 -#define APOLLO_IRQ_WIN1 14 - -#define APOLLO_DMA_ETH1 6 -#define APOLLO_DMA_ETH2 3 - -//########################################################################## -// machine/apollo_config.c - APOLLO DS3500 configuration -//########################################################################## - -#undef VERBOSE -#define VERBOSE 0 - -static UINT16 config = 0; - -/*************************************************************************** - apollo_config - check configuration setting - ***************************************************************************/ - -int apollo_config(int mask) -{ - return config & mask ? 1 : 0; -} - -/*************************************************************************** - Input Ports - ***************************************************************************/ - -INPUT_PORTS_START( apollo_config ) - PORT_START( "apollo_config" ) - PORT_CONFNAME(APOLLO_CONF_SERVICE_MODE, 0x00, "Normal/Service" ) - PORT_CONFSETTING(0x00, "Service" ) - PORT_CONFSETTING(APOLLO_CONF_SERVICE_MODE, "Normal " ) - - PORT_CONFNAME(APOLLO_CONF_DISPLAY, APOLLO_CONF_8_PLANES, "Graphics Controller") - PORT_CONFSETTING(APOLLO_CONF_8_PLANES, "8-Plane Color") - PORT_CONFSETTING(APOLLO_CONF_4_PLANES, "4-Plane Color") - PORT_CONFSETTING(APOLLO_CONF_MONO_15I, "15\" Monochrome") -// PORT_CONFSETTING(APOLLO_CONF_MONO_19I, "19\" Monochrome") - - PORT_CONFNAME(APOLLO_CONF_GERMAN_KBD, 0x00, "German Keyboard") - PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) - PORT_CONFSETTING(APOLLO_CONF_GERMAN_KBD, DEF_STR ( On ) ) - - PORT_CONFNAME(APOLLO_CONF_20_YEARS_AGO, APOLLO_CONF_20_YEARS_AGO, "20 Years Ago ...") - PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) - PORT_CONFSETTING(APOLLO_CONF_20_YEARS_AGO, DEF_STR ( On ) ) - - PORT_CONFNAME(APOLLO_CONF_25_YEARS_AGO, APOLLO_CONF_25_YEARS_AGO, "25 Years Ago ...") - PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) - PORT_CONFSETTING(APOLLO_CONF_25_YEARS_AGO, DEF_STR ( On ) ) - -// PORT_CONFNAME(APOLLO_CONF_NODE_ID, APOLLO_CONF_NODE_ID, "Node ID from Disk") -// PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) -// PORT_CONFSETTING(APOLLO_CONF_NODE_ID, DEF_STR ( On ) ) - -// PORT_CONFNAME(APOLLO_CONF_IDLE_SLEEP, 0x00, "Idle Sleep") -// PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) -// PORT_CONFSETTING(APOLLO_CONF_IDLE_SLEEP, DEF_STR ( On ) ) - - PORT_CONFNAME(APOLLO_CONF_TRAP_TRACE, 0x00, "Trap Trace") - PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) - PORT_CONFSETTING(APOLLO_CONF_TRAP_TRACE, DEF_STR ( On ) ) - - PORT_CONFNAME(APOLLO_CONF_FPU_TRACE, 0x00, "FPU Trace") - PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) - PORT_CONFSETTING(APOLLO_CONF_FPU_TRACE, DEF_STR ( On ) ) - -// PORT_CONFNAME(APOLLO_CONF_DISK_TRACE, 0x00, "Disk Trace") -// PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) -// PORT_CONFSETTING(APOLLO_CONF_DISK_TRACE, DEF_STR ( On ) ) - -// PORT_CONFNAME(APOLLO_CONF_NET_TRACE, 0x00, "Network Trace") -// PORT_CONFSETTING(0x00, DEF_STR ( Off ) ) -// PORT_CONFSETTING(APOLLO_CONF_NET_TRACE, DEF_STR ( On ) ) - -INPUT_PORTS_END - -class apollo_config_device : public device_t -{ -public: - apollo_config_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - virtual void device_reset(); -private: - // internal state -}; - -extern const device_type APOLLO_CONF; - -const device_type APOLLO_CONF = &device_creator; - -apollo_config_device::apollo_config_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, APOLLO_CONF, "Apollo Configuration", tag, owner, clock, "apollo_config", __FILE__) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void apollo_config_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void apollo_config_device::device_start() -{ - MLOG1(("start apollo_config")); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void apollo_config_device::device_reset() -{ - MLOG1(("reset apollo_config")); - // load configuration - config = machine().root_device().ioport("apollo_config")->read(); -} - - - -//########################################################################## -// machine/apollo_csr.c - APOLLO DS3500 CPU Control and Status registers -//########################################################################## - -#undef VERBOSE -#define VERBOSE 0 - -#define CPU_CONTROL_REGISTER_ADDRESS 0x010100 - -static UINT16 cpu_status_register = APOLLO_CSR_SR_BIT15 | APOLLO_CSR_SR_SERVICE; -static UINT16 cpu_control_register = 0x0000; - -/*------------------------------------------------- - apollo_csr_get/set_servicemode - -------------------------------------------------*/ - -/*static int apollo_csr_get_servicemode() -{ - return cpu_status_register & APOLLO_CSR_SR_SERVICE ? 0 : 1; -}*/ - -static void apollo_csr_set_servicemode(int mode) -{ - apollo_csr_set_status_register(1, mode ? APOLLO_CSR_SR_SERVICE : 0); -} - -UINT16 apollo_csr_get_control_register(void) -{ - return cpu_control_register; -} - -UINT16 apollo_csr_get_status_register(void) -{ - return cpu_status_register; -} - -void apollo_csr_set_status_register(UINT16 mask, UINT16 data) -{ - UINT16 new_value = (cpu_status_register & ~mask) | (data & mask); - - if (new_value != cpu_status_register) - { - cpu_status_register = new_value; - LOG1(("#### setting CPU Status Register with data=%04x & %04x to %04x", data, mask, cpu_status_register)); - } -} - -/*------------------------------------------------- - DN3000/DN3500 CPU Status Register at 0x8000/0x10000 - -------------------------------------------------*/ - -WRITE16_MEMBER(apollo_state::apollo_csr_status_register_w){ - // To clear bus timeouts or parity conditions from status register, - // write to the status register. This register is readonly. - // in DN3500 bit 15 is always set (undocumented !?) - cpu_status_register &= (APOLLO_CSR_SR_BIT15 | APOLLO_CSR_SR_FP_TRAP | APOLLO_CSR_SR_SERVICE); - SLOG1(("writing CPU Status Register at offset %X = %04x & %04x (%04x)", offset, data, mem_mask, cpu_status_register)); -} - -READ16_MEMBER(apollo_state::apollo_csr_status_register_r){ - SLOG2(("reading CPU Status Register at offset %X = %04x & %04x", offset, cpu_status_register, mem_mask)); - return cpu_status_register & mem_mask; -} - -/*------------------------------------------------- - DN3000/DN3500 CPU Control Register at 0x8100/0x10100 - -------------------------------------------------*/ - -WRITE16_MEMBER(apollo_state::apollo_csr_control_register_w) -{ - int leds; - - if ((mem_mask & APOLLO_CSR_CR_FPU_TRAP_ENABLE) == 0) - { - // FPU Trap enable not involved - } - else if (((data ^ cpu_control_register) & APOLLO_CSR_CR_FPU_TRAP_ENABLE) == 0) - { - // FPU Trap enable remains unchanged - } - else if ((data & APOLLO_CSR_CR_FPU_TRAP_ENABLE) == 0) - { - // enable FPU (i.e. FPU opcodes in CPU) - apollo_set_cpu_has_fpu(m_maincpu, 1); - } - else - { - // disable FPU (i.e. FPU opcodes in CPU) - apollo_set_cpu_has_fpu(m_maincpu, 0); - - if (!apollo_is_dn3000()) - { - // hack: set APOLLO_CSR_SR_FP_TRAP in cpu status register for /sau7/self_test - // APOLLO_CSR_SR_FP_TRAP in status register should be set by next fmove instruction - // cpu_status_register |= APOLLO_CSR_SR_FP_TRAP; - } - } - - cpu_control_register = (cpu_control_register & ~mem_mask) | (data & mem_mask); - - output_set_value("internal_led_1", (cpu_control_register >> 15) & 1); - output_set_value("internal_led_2", (cpu_control_register >> 14) & 1); - output_set_value("internal_led_3", (cpu_control_register >> 13) & 1); - output_set_value("internal_led_4", (cpu_control_register >> 12) & 1); - output_set_value("external_led_a", (cpu_control_register >> 11) & 1); - output_set_value("external_led_b", (cpu_control_register >> 10) & 1); - output_set_value("external_led_c", (cpu_control_register >> 9) & 1); - output_set_value("external_led_d", (cpu_control_register >> 8) & 1); - - leds = ((cpu_control_register >> 8) & 0xff) ^ 0xff; - - SLOG1(("writing CPU Control Register at offset %X = %04x & %04x (%04x - %d%d%d%d %d%d%d%d)", - offset, data, mem_mask, cpu_control_register, - (leds >> 3) & 1,(leds >> 2) & 1, (leds >> 1) & 1, (leds >> 0) & 1, - (leds >> 7) & 1,(leds >> 6) & 1, (leds >> 5) & 1, (leds >> 4) & 1 )); - - if (data & APOLLO_CSR_CR_RESET_DEVICES) - { - // FIXME: reset all devices (but not SIO lines!) - } -} - -READ16_MEMBER(apollo_state::apollo_csr_control_register_r) -{ - SLOG1(("reading CPU Control Register at offset %X = %04x & %04x", offset, cpu_control_register, mem_mask)); - return cpu_control_register & mem_mask; -} - -//########################################################################## -// machine/apollo_dma.c - APOLLO DS3500 DMA -//########################################################################## - -#undef VERBOSE -#define VERBOSE 0 - -static UINT16 address_translation_map[0x400]; - -static UINT16 dma_page_register[16] = - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -static const UINT8 channel2page_register[8] = { 7, 3, 1, 2, 0, 11, 9, 10}; - -static UINT8 dn3000_dma_channel1 = 1; // 1 = memory/ctape, 2 = floppy dma channel -static UINT8 dn3000_dma_channel2 = 5; // 5 = memory dma channel - -/*------------------------------------------------- - DN3000/DN3500 DMA Controller 1 at 0x9000/0x10c00 - -------------------------------------------------*/ - -WRITE8_MEMBER(apollo_state::apollo_dma_1_w){ - SLOG1(("apollo_dma_1_w: writing DMA Controller 1 at offset %02x = %02x", offset, data)); - m_dma8237_1->write(space, offset, data); -} - -READ8_MEMBER(apollo_state::apollo_dma_1_r){ - UINT8 data = m_dma8237_1->read(space, offset); - SLOG1(("apollo_dma_1_r: reading DMA Controller 1 at offset %02x = %02x", offset, data)); - return data; -} - -/*------------------------------------------------- - DN3000/DN3500 DMA Controller 2 at 0x9100/0x10d00 - -------------------------------------------------*/ - -WRITE8_MEMBER(apollo_state::apollo_dma_2_w){ - SLOG1(("apollo_dma_2_w: writing DMA Controller 2 at offset %02x = %02x", offset/2, data)); - m_dma8237_2->write(space, offset / 2, data); -} - -READ8_MEMBER(apollo_state::apollo_dma_2_r){ - // Nasty hack (13-06-15 - ost): - // MD self_test will test wrong DMA register and - // mem-to-mem DMA in am9517a.c is often starting much too late (for MD self_test) - // (8237dma.c was always fast enough to omit these problems) - if (offset == 8) - { - switch (space.device().safe_pcbase()) - { - case 0x00102e22: // DN3000 - case 0x01002f3c: // DN3500 - case 0x010029a6: // DN5500 - offset = 16; - break; - } - } - UINT8 data = m_dma8237_2->read(space, offset / 2); - SLOG1(("apollo_dma_2_r: reading DMA Controller 2 at offset %02x = %02x", offset/2, data)); - return data; -} - -/*************************************************************************** - DN3000 DMA Page Register at 0x9200 - ***************************************************************************/ - -WRITE8_MEMBER(apollo_state::apollo_dma_page_register_w){ - dma_page_register[offset & 0x0f] = data; - SLOG1(("writing DMA Page Register at offset %02x = %02x", offset, data)); -} - -READ8_MEMBER(apollo_state::apollo_dma_page_register_r){ - UINT8 data = dma_page_register[offset & 0x0f]; - SLOG1(("reading DMA Page Register at offset %02x = %02x", offset, data)); - return data; -} - -/*------------------------------------------------- - DN3500 Address Translation Map at 0x017000 - -------------------------------------------------*/ - -WRITE16_MEMBER(apollo_state::apollo_address_translation_map_w){ - address_translation_map[offset & 0x3ff] = data; - SLOG2(("writing Address Translation Map at offset %02x = %04x", offset, data)); -} - -READ16_MEMBER(apollo_state::apollo_address_translation_map_r){ - UINT16 data = address_translation_map[offset & 0x3ff]; - SLOG2(("reading Address Translation Map at offset %02x = %04x", offset, data)); - return data; -} - -READ8_MEMBER(apollo_state::apollo_dma_read_byte){ - UINT8 data; - offs_t page_offset; - - if (apollo_is_dn3000()) { - page_offset = dma_page_register[channel2page_register[dn3000_dma_channel1]] << 16; - } else { - // FIXME: address_translation_map[0x200] ? - page_offset = (((offs_t) address_translation_map[0x200 + (offset >> 10)]) << 10) & 0x7FFFFC00; - offset &= 0x3ff; - } - - data = m_maincpu->space(AS_PROGRAM).read_byte(page_offset + offset); - - if (VERBOSE > 1 || offset < 4 || (offset & 0xff) == 0 || (offset & 0xff) == 0xff) - { - SLOG1(("dma read byte at offset %x+%03x = %02x", page_offset, offset, data)); - } -// logerror(" %02x", data); - return data; -} - -WRITE8_MEMBER(apollo_state::apollo_dma_write_byte){ - offs_t page_offset; - if (apollo_is_dn3000()) { - page_offset = dma_page_register[channel2page_register[dn3000_dma_channel1]] << 16; - } else { - // FIXME: address_translation_map[0x200] ? - page_offset = (((offs_t) address_translation_map[0x200 + (offset >> 10)]) << 10) & 0x7FFFFC00; - offset &= 0x3ff; - } - // FIXME: MSB not available, writing only LSB - m_maincpu->space(AS_PROGRAM).write_byte(page_offset + offset, data); - - if (VERBOSE > 1 || offset < 4 || (offset & 0xff) == 0 || (offset & 0xff) == 0xff) - { - SLOG1(("dma write byte at offset %x+%03x = %02x", page_offset, offset , data)); - } -// logerror(" %02x", data); -} - -READ8_MEMBER(apollo_state::apollo_dma_read_word){ - UINT16 data; - offs_t page_offset; - - if (apollo_is_dn3000()) { - page_offset = dma_page_register[channel2page_register[dn3000_dma_channel2]] << 16; - page_offset &= 0xfffe0000; - offset <<= 1; - } else { - // FIXME: address_translation_map[0x200] ? - page_offset = (((offs_t) address_translation_map[0x200 + (offset >> 9)]) << 10) & 0x7FFFFC00; - offset = (offset << 1) & 0x3ff; - } - - data = m_maincpu->space(AS_PROGRAM).read_byte(page_offset + offset); - - SLOG1(("dma read word at offset %x+%03x = %04x", page_offset, offset , data)); - // FIXME: MSB will get lost - return data; -} - -WRITE8_MEMBER(apollo_state::apollo_dma_write_word){ - offs_t page_offset; - - SLOG1(("dma write word at offset %x = %02x", offset, data)); - - if (apollo_is_dn3000()) { - page_offset = dma_page_register[channel2page_register[dn3000_dma_channel2]] << 16; - page_offset &= 0xfffe0000; - offset <<= 1; - } else { - // FIXME: address_translation_map[0x200] ? - page_offset - = (((offs_t) address_translation_map[0x200 + (offset >> 9)]) - << 10) & 0x7FFFFC00; - offset = (offset << 1) & 0x3ff; - } - - m_maincpu->space(AS_PROGRAM).write_byte(page_offset + offset, data); - SLOG1(("dma write word at offset %x+%03x = %02x", page_offset, offset, data)); -} - -WRITE_LINE_MEMBER(apollo_state::apollo_dma8237_out_eop ) { - CLOG1(("dma out eop state %02x", state)); - m_cur_eop = state == ASSERT_LINE; - if(m_dma_channel != -1) - m_isa->eop_w(m_dma_channel, m_cur_eop ? ASSERT_LINE : CLEAR_LINE ); -} - -WRITE_LINE_MEMBER(apollo_state::apollo_dma_1_hrq_changed ) { - CLOG2(("dma 1 hrq changed state %02x", state)); - m_dma8237_1->dreq0_w(state); - - /* Assert HLDA */ - m_dma8237_1->hack_w(state); - - // cascade mode? - // i8237_hlda_w(get_device_dma8237_2(device), state); -} - -WRITE_LINE_MEMBER(apollo_state::apollo_dma_2_hrq_changed ) { - CLOG2(("dma 2 hrq changed state %02x", state)); - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - /* Assert HLDA */ - m_dma8237_2->hack_w(state); -} - -READ8_MEMBER( apollo_state::pc_dma8237_0_dack_r ) { return m_isa->dack_r(0); } -READ8_MEMBER( apollo_state::pc_dma8237_1_dack_r ) { return m_isa->dack_r(1); } -READ8_MEMBER( apollo_state::pc_dma8237_2_dack_r ) { return m_isa->dack_r(2); } -READ8_MEMBER( apollo_state::pc_dma8237_3_dack_r ) { return m_isa->dack_r(3); } -READ8_MEMBER( apollo_state::pc_dma8237_5_dack_r ) { return m_isa->dack_r(5); } -READ8_MEMBER( apollo_state::pc_dma8237_6_dack_r ) { return m_isa->dack_r(6); } -READ8_MEMBER( apollo_state::pc_dma8237_7_dack_r ) { return m_isa->dack_r(7); } - -WRITE8_MEMBER( apollo_state::pc_dma8237_0_dack_w ){ m_isa->dack_w(0, data); } -WRITE8_MEMBER( apollo_state::pc_dma8237_1_dack_w ){ m_isa->dack_w(1, data); } -WRITE8_MEMBER( apollo_state::pc_dma8237_2_dack_w ){ m_isa->dack_w(2, data); } -WRITE8_MEMBER( apollo_state::pc_dma8237_3_dack_w ){ m_isa->dack_w(3, data); } -WRITE8_MEMBER( apollo_state::pc_dma8237_5_dack_w ){ m_isa->dack_w(5, data); } -WRITE8_MEMBER( apollo_state::pc_dma8237_6_dack_w ){ m_isa->dack_w(6, data); } -WRITE8_MEMBER( apollo_state::pc_dma8237_7_dack_w ){ m_isa->dack_w(7, data); } - -WRITE_LINE_MEMBER( apollo_state::pc_dack0_w ) { select_dma_channel(0, state); } -WRITE_LINE_MEMBER( apollo_state::pc_dack1_w ) { select_dma_channel(1, state); } -WRITE_LINE_MEMBER( apollo_state::pc_dack2_w ) { select_dma_channel(2, state); } -WRITE_LINE_MEMBER( apollo_state::pc_dack3_w ) { select_dma_channel(3, state); } -WRITE_LINE_MEMBER( apollo_state::pc_dack4_w ) { m_dma8237_1->hack_w( state ? 0 : 1); } // it's inverted -WRITE_LINE_MEMBER( apollo_state::pc_dack5_w ) { select_dma_channel(5, state); } -WRITE_LINE_MEMBER( apollo_state::pc_dack6_w ) { select_dma_channel(6, state); } -WRITE_LINE_MEMBER( apollo_state::pc_dack7_w ) { select_dma_channel(7, state); } - -void apollo_state::select_dma_channel(int channel, bool state) -{ - if(!state) { - m_dma_channel = channel; - if(m_cur_eop) - m_isa->eop_w(channel, ASSERT_LINE ); - - } else if(m_dma_channel == channel) { - m_dma_channel = -1; - if(m_cur_eop) - m_isa->eop_w(channel, CLEAR_LINE ); - } -} - -//########################################################################## -// machine/apollo_pic.c - APOLLO DS3500 PIC 8259 controllers -//########################################################################## - -#undef VERBOSE -#define VERBOSE 0 - -void apollo_state::apollo_pic_set_irq_line(int irq, int state) -{ - switch (irq) { - case 0: m_pic8259_master->ir0_w(state); break; - case 1: m_pic8259_master->ir1_w(state); break; - case 2: m_pic8259_master->ir2_w(state); break; - case 3: m_pic8259_master->ir3_w(state); break; - case 4: m_pic8259_master->ir4_w(state); break; - case 5: m_pic8259_master->ir5_w(state); break; - case 6: m_pic8259_master->ir6_w(state); break; - case 7: m_pic8259_master->ir7_w(state); break; - - case 8: m_pic8259_slave->ir0_w(state); break; - case 9: m_pic8259_slave->ir1_w(state); break; - case 10: m_pic8259_slave->ir2_w(state); break; - case 11: m_pic8259_slave->ir3_w(state); break; - case 12: m_pic8259_slave->ir4_w(state); break; - case 13: m_pic8259_slave->ir5_w(state); break; - case 14: m_pic8259_slave->ir6_w(state); break; - case 15: m_pic8259_slave->ir7_w(state); break; - } -} - -IRQ_CALLBACK_MEMBER(apollo_state::apollo_pic_acknowledge) -{ - UINT32 vector = m_pic8259_master->acknowledge(); - if ((vector & 0x0f) == APOLLO_IRQ_PIC_SLAVE) { - vector = m_pic8259_slave->acknowledge(); - } - - // don't log ptm interrupts - if (vector != APOLLO_IRQ_VECTOR+APOLLO_IRQ_PTM) { - MLOG1(("apollo_pic_acknowledge: irq=%d vector=%x", vector & 0x0f, vector)); - } - - if (apollo_is_dn3000()) { - apollo_csr_set_status_register(APOLLO_CSR_SR_INTERRUPT_PENDING, 0); - } else { - // clear bit Interrupt Pending in Cache Status Register - apollo_set_cache_status_register(0x10, 0x00); - } - return vector; -} - -/************************************************************* - * pic8259 configuration - *************************************************************/ - -READ8_MEMBER( apollo_state::apollo_pic8259_get_slave_ack ) -{ - MLOG1(("apollo_pic8259_get_slave_ack: offset=%x", offset)); - - return offset == 3 ? m_pic8259_slave->acknowledge() : 0; -} - -WRITE_LINE_MEMBER( apollo_state::apollo_pic8259_master_set_int_line ) { - static int interrupt_line = -1; - if (state != interrupt_line) { - device_t *device = m_pic8259_master; - DLOG1(("apollo_pic8259_master_set_int_line: %x", state)); - } - interrupt_line = state; - - if (apollo_is_dn3000()) { - apollo_csr_set_status_register(APOLLO_CSR_SR_INTERRUPT_PENDING, - state ? APOLLO_CSR_SR_INTERRUPT_PENDING : 0); - } else { - // set bit Interrupt Pending in Cache Status Register - apollo_set_cache_status_register(0x10, state ? 0x10 : 0x00); - } - - m_maincpu->set_input_line_and_vector(M68K_IRQ_6,state ? ASSERT_LINE : CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); -} - -WRITE_LINE_MEMBER( apollo_state::apollo_pic8259_slave_set_int_line ) { - static int interrupt_line = -1; - if (state != interrupt_line) { - device_t *device = m_pic8259_slave; - DLOG1(("apollo_pic8259_slave_set_int_line: %x", state)); - interrupt_line = state; - apollo_pic_set_irq_line(3, state); - } -} - -//########################################################################## -// machine/apollo_ptm.c - APOLLO DS3500 Programmable Timer 6840 -//########################################################################## - -#undef VERBOSE -#define VERBOSE 0 - -WRITE_LINE_MEMBER(apollo_state::apollo_ptm_timer_tick) -{ - if ((state) && (m_ptm->started())) - { - ptm_counter++; - m_ptm->set_c1( 1); - m_ptm->set_c1( 0); - m_ptm->set_c2(ptm_counter & 1); - - if ((ptm_counter & 1) == 0) - { - m_ptm->set_c3((ptm_counter >> 1) & 1); - } - } -} - -WRITE_LINE_MEMBER(apollo_state::apollo_ptm_irq_function) -{ - apollo_pic_set_irq_line(APOLLO_IRQ_PTM, state); -} - -// Timer 1's input is a 250-kHz (4-microsecond period) signal. -// Timer 2's input is a 125-kHz (8-microsecond period) signal. -// Timer 3's input is a 62.5-kHz (16-microsecond period) signal. -// The Timer 3 input may be prescaled to make the effective input signal have a 128-microsecond period. - - -//########################################################################## -// machine/apollo_rtc.c - APOLLO DS3500 RTC MC146818 -//########################################################################## - -#undef VERBOSE -#define VERBOSE 0 - -/*************************************************************************** - DN3000/DN3500 Realtime Calendar MC146818 at 0x8900/0x10900 - ***************************************************************************/ - -WRITE8_MEMBER(apollo_state::apollo_rtc_w) -{ - m_rtc->write(space, 0, offset); - m_rtc->write(space, 1, data); - if (offset >= 0x0b && offset <= 0x0c) - { - SLOG2(("writing MC146818 at offset %02x = %02x", offset, data)); - } -} - -READ8_MEMBER(apollo_state::apollo_rtc_r) -{ - UINT8 data; - m_rtc->write(space, 0, offset); - data = m_rtc->read(space, 1); - if (offset >= 0x0b && offset <= 0x0c) - { - SLOG2(("reading MC146818 at offset %02x = %02x", offset, data)); - } - return data; -} - -// TODO: this is covering for missing mc146818 functionality -TIMER_CALLBACK_MEMBER( apollo_state::apollo_rtc_timer ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - // FIXME: reading register 0x0c will clear all interrupt flags - if ((apollo_rtc_r(space, 0x0c) & 0x80)) - { - //SLOG2(("apollo_rtc_timer - set_irq_line %d", APOLLO_IRQ_RTC)); - apollo_pic_set_irq_line(APOLLO_IRQ_RTC, 1); - } -} - -//########################################################################## -// machine/apollo_sio.c - DN3000/DS3500 SIO at 0x8400/0x10400 -//########################################################################## - -#undef VERBOSE -#define VERBOSE 0 - -apollo_sio::apollo_sio(const machine_config &mconfig, const char *tag, - device_t *owner, UINT32 clock) : - mc68681_device(mconfig, tag, owner, clock), - m_csrb(0), - m_ip6(0) -{ -} - -void apollo_sio::device_reset() -{ - UINT8 input_data = apollo_get_ram_config_byte(); - ip0_w((input_data & 0x01) ? ASSERT_LINE : CLEAR_LINE); - ip1_w((input_data & 0x02) ? ASSERT_LINE : CLEAR_LINE); - ip2_w((input_data & 0x04) ? ASSERT_LINE : CLEAR_LINE); - ip3_w((input_data & 0x08) ? ASSERT_LINE : CLEAR_LINE); - ip4_w((input_data & 0x10) ? ASSERT_LINE : CLEAR_LINE); - ip5_w((input_data & 0x20) ? ASSERT_LINE : CLEAR_LINE); -// ip6_w((input_data & 0x40) ? ASSERT_LINE : CLEAR_LINE); - - // MC2681 has IP[6] (instead of /IACK on MC68681) - m_ip6 = (input_data & 0x40) ? ASSERT_LINE : CLEAR_LINE; -} - -READ8_MEMBER( apollo_sio::read ) -{ - static int last_read8_offset[2] = { -1, -1 }; - static int last_read8_value[2] = { -1, -1 }; - - static const char * const duart68681_reg_read_names[0x10] = { "MRA", "SRA", - "BRG Test", "RHRA", "IPCR", "ISR", "CTU", "CTL", "MRB", "SRB", - "1X/16X Test", "RHRB", "IVR", "Input Ports", "Start Counter", - "Stop Counter" }; - - int data = mc68681_device::read(space, offset/2, mem_mask); - - switch (offset / 2) - { - case 0x0b: /* RHRB */ - if (m_csrb == 0x77 && data == 0xfe) - { - // special fix for the MD ROM baudrate recognition - // fix data only if CR is entered while baudrate is set to 2000 Baud - - // Receive and transmit clock in diserial.c are not precise enough - // to support the baudrate recognition done in the Apollo MD ROM - // use 0xff instead of 0xfe to set the baudrate recognition for 9600 Bd - // (to prevent that the MD selftest or SK command will hang in Service mode) - data = 0xff; - } - break; - case 0x0d: /* IP */ - // MC2681 has IP[6] (instead of /IACK on MC68681) - data = (data & ~0x40) | (m_ip6 ? 0x40 : 0); - break; - } - - // omit logging if sio is being polled from the boot rom - if ((offset != last_read8_offset[1] || data != last_read8_value[1]) && \ - (offset != last_read8_offset[0] || data != last_read8_value[0])) - { - last_read8_offset[0] = last_read8_offset[1]; - last_read8_value[0] = last_read8_value[1]; - last_read8_offset[1] = offset; - last_read8_value[1] = data; - CLOG2(("reading MC2681 reg %02x (%s) returned %02x", - offset, duart68681_reg_read_names[(offset/2) & 15], data)); - } - - return data; -} - -WRITE8_MEMBER( apollo_sio::write ) -{ - static const char * const duart68681_reg_write_names[0x10] = { "MRA", - "CSRA", "CRA", "THRA", "ACR", "IMR", "CRUR", "CTLR", "MRB", "CSRB", - "CRB", "THRB", "IVR", "OPCR", "Set OP Bits", "Reset OP Bits" }; - - CLOG2(("writing MC2681 reg %02x (%s) with %02x", - offset, duart68681_reg_write_names[(offset/2) & 15], data)); - - switch (offset / 2) { - case 0x09: /* CSRB */ - // remember CSRB to handle MD selftest or SK command - m_csrb = data; - break; -#if 1 - case 0x0b: /* THRB */ - // tee output of SIO1 to stdout - // sad: ceterm will get confused from '\r' - if (apollo_is_dsp3x00() && data != '\r') ::putchar(data); - break; -#endif - } - mc68681_device::write(space, offset/2, data, mem_mask); -} - -// device type definition -const device_type APOLLO_SIO = &device_creator; - -WRITE_LINE_MEMBER(apollo_state::sio_irq_handler) -{ - apollo_pic_set_irq_line(APOLLO_IRQ_SIO1, state); -} - -WRITE8_MEMBER(apollo_state::sio_output) -{ -// CLOG2(("apollo_sio - sio_output %02x", data)); - - if ((data & 0x80) != (sio_output_data & 0x80)) - { - apollo_pic_set_irq_line(APOLLO_IRQ_DIAG, (data & 0x80) ? 1 : 0); - } - - // The counter/timer on the SIO chip is used for the RAM refresh count. - // This is set up in the timer mode to produce a square wave output on output OP3. - // The period of the output is 15 microseconds. - - if ((data & 0x08) != (sio_output_data & 0x08)) - { - m_sio->ip0_w((data & 0x08) ? ASSERT_LINE : CLEAR_LINE); - } - - sio_output_data = data; -} - -//########################################################################## -// machine/apollo_sio2.c - APOLLO DS3500 SIO2 -//########################################################################## - -WRITE_LINE_MEMBER(apollo_state::sio2_irq_handler) -{ - apollo_pic_set_irq_line(APOLLO_IRQ_SIO2, state); -} - -//########################################################################## -// machine/apollo.c - APOLLO DS3500 CPU Board -//########################################################################## - -#undef VERBOSE -#define VERBOSE 0 - -static SLOT_INTERFACE_START(apollo_isa_cards) - SLOT_INTERFACE("wdc", ISA16_OMTI8621) // Combo ESDI/AT floppy controller - SLOT_INTERFACE("ctape", ISA8_SC499) // Archive SC499 cartridge tape - SLOT_INTERFACE("3c505", ISA16_3C505) // 3Com 3C505 Ethernet card -SLOT_INTERFACE_END - -MACHINE_CONFIG_FRAGMENT( common ) - // configuration MUST be reset first ! - MCFG_DEVICE_ADD(APOLLO_CONF_TAG, APOLLO_CONF, 0) - - MCFG_DEVICE_ADD( APOLLO_DMA1_TAG, AM9517A, XTAL_14_31818MHz/3 ) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(apollo_state, apollo_dma_1_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(apollo_state, apollo_dma8237_out_eop)) - MCFG_I8237_IN_MEMR_CB(READ8(apollo_state, apollo_dma_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(apollo_state, apollo_dma_write_byte)) - MCFG_I8237_IN_IOR_0_CB(READ8(apollo_state, pc_dma8237_0_dack_r)) - MCFG_I8237_IN_IOR_1_CB(READ8(apollo_state, pc_dma8237_1_dack_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(apollo_state, pc_dma8237_2_dack_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(apollo_state, pc_dma8237_3_dack_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(apollo_state, pc_dma8237_0_dack_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(apollo_state, pc_dma8237_1_dack_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(apollo_state, pc_dma8237_2_dack_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(apollo_state, pc_dma8237_3_dack_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(apollo_state, pc_dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(apollo_state, pc_dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(apollo_state, pc_dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(apollo_state, pc_dack3_w)) - MCFG_DEVICE_ADD( APOLLO_DMA2_TAG, AM9517A, XTAL_14_31818MHz/3 ) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(apollo_state, apollo_dma_2_hrq_changed)) - MCFG_I8237_IN_MEMR_CB(READ8(apollo_state, apollo_dma_read_word)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(apollo_state, apollo_dma_write_word)) - MCFG_I8237_IN_IOR_1_CB(READ8(apollo_state, pc_dma8237_5_dack_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(apollo_state, pc_dma8237_6_dack_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(apollo_state, pc_dma8237_7_dack_r)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(apollo_state, pc_dma8237_5_dack_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(apollo_state, pc_dma8237_6_dack_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(apollo_state, pc_dma8237_7_dack_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(apollo_state, pc_dack4_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(apollo_state, pc_dack5_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(apollo_state, pc_dack6_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(apollo_state, pc_dack7_w)) - MCFG_PIC8259_ADD( APOLLO_PIC1_TAG, WRITELINE(apollo_state,apollo_pic8259_master_set_int_line), VCC, READ8(apollo_state, apollo_pic8259_get_slave_ack)) - MCFG_PIC8259_ADD( APOLLO_PIC2_TAG, WRITELINE(apollo_state,apollo_pic8259_slave_set_int_line), GND, NULL) - - MCFG_DEVICE_ADD(APOLLO_PTM_TAG, PTM6840, 0) - MCFG_PTM6840_INTERNAL_CLOCK(0) - MCFG_PTM6840_EXTERNAL_CLOCKS(250000, 125000, 62500) - MCFG_PTM6840_IRQ_CB(WRITELINE(apollo_state, apollo_ptm_irq_function)) - MCFG_DEVICE_ADD("ptmclock", CLOCK, 250000) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(apollo_state, apollo_ptm_timer_tick)) - - MCFG_MC146818_ADD( APOLLO_RTC_TAG, XTAL_32_768kHz ) - MCFG_MC146818_UTC( true ) - - MCFG_APOLLO_SIO_ADD( APOLLO_SIO2_TAG, XTAL_3_6864MHz ) - MCFG_APOLLO_SIO_IRQ_CALLBACK(WRITELINE(apollo_state, sio2_irq_handler)) - - MCFG_DEVICE_ADD(APOLLO_ISA_TAG, ISA16, 0) - MCFG_ISA16_CPU(":" MAINCPU) - MCFG_ISA16_BUS_CUSTOM_SPACES() - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir2_w)) // in place of irq 2 on at irq 9 is used - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE(APOLLO_PIC1_TAG, pic8259_device, ir7_w)) - MCFG_ISA_OUT_IRQ10_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir2_w)) - MCFG_ISA_OUT_IRQ11_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ12_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ14_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ15_CB(DEVWRITELINE(APOLLO_PIC2_TAG, pic8259_device, ir7_w)) - MCFG_ISA_OUT_DRQ0_CB(DEVWRITELINE(APOLLO_DMA1_TAG, am9517a_device, dreq0_w)) - MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE(APOLLO_DMA1_TAG, am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE(APOLLO_DMA1_TAG, am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE(APOLLO_DMA1_TAG, am9517a_device, dreq3_w)) - MCFG_ISA_OUT_DRQ5_CB(DEVWRITELINE(APOLLO_DMA2_TAG, am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ6_CB(DEVWRITELINE(APOLLO_DMA2_TAG, am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ7_CB(DEVWRITELINE(APOLLO_DMA2_TAG, am9517a_device, dreq3_w)) - MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa1", apollo_isa_cards, "wdc", false) - MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa2", apollo_isa_cards, "ctape", false) - MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa3", apollo_isa_cards, "3c505", false) - MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa4", apollo_isa_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa5", apollo_isa_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa6", apollo_isa_cards, NULL, false) - MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa7", apollo_isa_cards, NULL, false) - - MCFG_SOFTWARE_LIST_ADD("ctape_list", "apollo_ctape") -MACHINE_CONFIG_END - -// for machines with the keyboard and a graphics head -MACHINE_CONFIG_FRAGMENT( apollo ) - MCFG_FRAGMENT_ADD(common) - MCFG_APOLLO_SIO_ADD( APOLLO_SIO_TAG, XTAL_3_6864MHz ) - MCFG_APOLLO_SIO_IRQ_CALLBACK(WRITELINE(apollo_state, sio_irq_handler)) - MCFG_APOLLO_SIO_OUTPORT_CALLBACK(WRITE8(apollo_state, sio_output)) - MCFG_APOLLO_SIO_A_TX_CALLBACK(DEVWRITELINE(APOLLO_KBD_TAG, apollo_kbd_device, rx_w)) -MACHINE_CONFIG_END - -static DEVICE_INPUT_DEFAULTS_START( apollo_terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - -// for headless machines using a serial console -MACHINE_CONFIG_FRAGMENT( apollo_terminal ) - MCFG_FRAGMENT_ADD(common) - MCFG_APOLLO_SIO_ADD( APOLLO_SIO_TAG, XTAL_3_6864MHz ) - MCFG_APOLLO_SIO_IRQ_CALLBACK(WRITELINE(apollo_state, sio_irq_handler)) - MCFG_APOLLO_SIO_OUTPORT_CALLBACK(WRITE8(apollo_state, sio_output)) - MCFG_APOLLO_SIO_B_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(APOLLO_SIO_TAG, apollo_sio, rx_b_w)) - - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", apollo_terminal) -MACHINE_CONFIG_END - -DRIVER_INIT_MEMBER(apollo_state,apollo) -{ - MLOG1(("driver_init_apollo")); -} - -MACHINE_START_MEMBER(apollo_state,apollo) -{ - MLOG1(("machine_start_apollo")); - - if (apollo_is_dn3000()) - { - //MLOG1(("faking mc146818 interrupts (DN3000 only)")); - // fake mc146818 interrupts (DN3000 only) - m_dn3000_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_state::apollo_rtc_timer),this)); - } -} - -MACHINE_RESET_MEMBER(apollo_state,apollo) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 year = apollo_rtc_r(space, 9); - - m_dma_channel = -1; - m_cur_eop = false; - - MLOG1(("machine_reset_apollo")); - - // set configuration - apollo_csr_set_servicemode(apollo_config(APOLLO_CONF_SERVICE_MODE)); - - // change year according to configuration settings - if (year < 20 && apollo_config(APOLLO_CONF_20_YEARS_AGO)) - { - year+=80; - apollo_rtc_w(space, 9, year); - } - else if (year < 25 && apollo_config(APOLLO_CONF_25_YEARS_AGO)) - { - year += 75; - apollo_rtc_w(space, 9, year); - } - else if (year >= 80 && !apollo_config(APOLLO_CONF_20_YEARS_AGO) - && !apollo_config(APOLLO_CONF_25_YEARS_AGO)) - { - year -=80; - apollo_rtc_w(space, 9, year); - } - - ptm_counter = 0; - sio_output_data = 0xff; - - if (apollo_is_dn3000()) - { - m_dn3000_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); - } -} diff --git a/src/mess/machine/apollo_dbg.c b/src/mess/machine/apollo_dbg.c deleted file mode 100644 index 7111526c17e..00000000000 --- a/src/mess/machine/apollo_dbg.c +++ /dev/null @@ -1,1182 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Hans Ostermeyer -/* - * debug/apollo.c - APOLLO DN3500/DN3000 debug functions - * - * Created on: Nov. 21, 2010 - * Author: Hans Ostermeyer - * - */ - -#define VERBOSE 1 - -#include "includes/apollo.h" -#include "cpu/m68000/m68kcpu.h" - -//------------------------------------------------------ -// TRAP 0 -//------------------------------------------------------ - -static const char* trap0[] = { -/* 0x00 */NULL, NULL, -/* 0x01 */"FIM_$GET_FIM_ADDR", "", -/* 0x02 */NULL, NULL, -/* 0x03 */"DTTY_$RELOAD_FONT", "", -/* 0x04 */"FILE_$UNLOCK_ALL", "", -/* 0x05 */NULL, NULL, -/* 0x06 */NULL, NULL, -/* 0x07 */"PROC2_$MY_PID", "", -/* 0x08 */"SMD_$OP_WAIT_U", "", -/* 0x09 */"TPAD_$RE_RANGE", "", -/* 0x0a */NULL, NULL, -/* 0x0b */NULL, NULL, -/* 0x0c */NULL, NULL, -/* 0x0d */"ACL_$UP", "", -/* 0x0e */"ACL_$DOWN", "", -/* 0x0f */NULL, NULL, -/* 0x10 */"TPAD_$INQ_DTYPE", "", -/* 0x11 */NULL, NULL, -/* 0x12 */"CACHE_$CLEAR", "", -/* 0x13 */"RIP_$ANNOUNCE_NS", "", -/* 0x14 */NULL, NULL, -/* 0x15 */NULL, NULL, -/* 0x16 */NULL, NULL, -/* 0x17 */NULL, NULL, -/* 0x18 */"PROC2_$DELIVER_PENDING", "", -/* 0x19 */"PROC2_$COMPLETE_FORK", "", -/* 0x1a */"PACCT_$STOP", "", -/* 0x1b */"PACCT_$ON", "", -/* 0x1c */"ACL_$GET_LOCAL_LOCKSMITH", "", -/* 0x1d */"ACL_$IS_SUSER", "", -/* 0x1e */NULL, NULL, -/* 0x1f */"SMD_$N_DEVICES", "", -/* 0x20 */"PROC1_$GET_MAXID", "", -/* 0x21 */"THREAD_$DELETE", "", -/* 0x22 */"THREAD_$SELF_OS", "", -/* 0x23 */"THREAD_$NUMBER_THREADS", "", -/* 0x24 */"ACL_$GET_PROTECT_OPTION", "", -/* 0x25 */"ACL_$PROTECT_CHECK", "", -/* 0x26 */"THREAD_$YIELD", "" }; - -//------------------------------------------------------ -// TRAP1 -//------------------------------------------------------ - -static const char* trap1[] = { -/* 0x00 */NULL, NULL, -/* 0x01 */NULL, NULL, -/* 0x02 */"FIM_$INSTALL", "x", -/* 0x03 */"NETWORK_$READ_SERVICE", "x", -/* 0x04 */"PROC1_$GET_CPUT", "x", -/* 0x05 */"SET_LITES_LOC", "x", -/* 0x06 */"TIME_$CLOCK", "x", -/* 0x07 */"ASKNODE_$READ_FAILURE_REC", "x", -/* 0x08 */"CAL_$APPLY_LOCAL_OFFSET", "x", -/* 0x09 */"CAL_$GET_INFO", "x", -/* 0x0a */"CAL_$GET_LOCAL_TIME", "x", -/* 0x0b */"CAL_$REMOVE_LOCAL_OFFSET", "x", -/* 0x0c */"CAL_$SET_DRIFT", "x", -/* 0x0d */"DISK_$GET_ERROR_INFO", "x", -/* 0x0e */NULL, NULL, -/* 0x0f */"MSG_$CLOSE", "x", -/* 0x10 */"PROC2_$WHO_AM_I", "u", -/* 0x11 */"SMD_$CLEAR_KBD_CURSOR", "x", -/* 0x12 */NULL, NULL, -/* 0x13 */NULL, NULL, -/* 0x14 */"SMD_$SEND_RESPONSE", "x", -/* 0x15 */"SMD_$STOP_TP_CURSOR", "x", -/* 0x16 */NULL, NULL, -/* 0x17 */NULL, NULL, -/* 0x18 */"SMD_$UNMAP_DISPLAY_U", "x", -/* 0x19 */"UID_$GEN", "x", -/* 0x1a */"TONE_$TIME", "x", -/* 0x1b */"SMD_$INQ_DISP_TYPE", "x", -/* 0x1c */NULL, NULL, -/* 0x1d */NULL, NULL, -/* 0x1e */NULL, NULL, -/* 0x1f */"TPAD_$SET_CURSOR", "x", -/* 0x20 */NULL, NULL, -/* 0x21 */NULL, NULL, -/* 0x22 */"NAME_$GET_WDIR_UID", "u", -/* 0x23 */"NAME_$GET_NDIR_UID", "u", -/* 0x24 */"NAME_$GET_ROOT_UID", "u", -/* 0x25 */"NAME_$GET_NODE_UID", "u", -/* 0x26 */"NAME_$GET_NODE_DATA_UID", "u", -/* 0x27 */"NAME_$GET_CANNED_ROOT_UID", "u", -/* 0x28 */"MSG_$GET_MY_NET", "x", -/* 0x29 */"MSG_$GET_MY_NODE", "x", -/* 0x2a */NULL, NULL, -/* 0x2b */NULL, NULL, -/* 0x2c */NULL, NULL, -/* 0x2d */NULL, NULL, -/* 0x2e */NULL, NULL, -/* 0x2f */NULL, NULL, -/* 0x30 */"GPU_$INIT", "x", -/* 0x31 */NULL, NULL, -/* 0x32 */"SMD_$INIT_STATE", "x", -/* 0x33 */"SMD_$CLR_TRK_RECT", "x", -/* 0x34 */"PROC2_$GET_SIG_MASK", "x", -/* 0x35 */"FIM_$FRESTORE", "x", -/* 0x36 */"TIME_$GET_TIME_OF_DAY", "x", -/* 0x37 */"PROC1_$GET_LOADAV", "x", -/* 0x38 */"PROC2_$GET_BOOT_FLAGS", "x", -/* 0x39 */NULL, NULL, -/* 0x3a */"PROC2_$SET_TTY", "x", -/* 0x3b */"OS_$SHUTDOWN", "x", -/* 0x3c */"PBU_$FAULTED_UNITS", "x", -/* 0x3d */"PROC2_$GET_CPU_USAGE", "x", -/* 0x3e */NULL, NULL, -/* 0x3f */NULL, NULL, -/* 0x40 */NULL, NULL, -/* 0x41 */"TIME_$GET_ADJUST", "x", -/* 0x42 */"FILE_$SYNC", "x", -/* 0x43 */"XPAGE_$IS_MAPPED", "x", -/* 0x44 */"THREAD_$SUSPEND_FOR_FORK", "x", -/* 0x45 */"THREAD_$RESUME_FOR_FORK", "x" }; - -//------------------------------------------------------ -// TRAP2 -//------------------------------------------------------ - -static const char* trap2[] = { -/* 0x00 */NULL, NULL, -/* 0x01 */NULL, NULL, -/* 0x02 */"FILE_$DELETE", "x,x", -/* 0x03 */"EC2_$WAKEUP", "x,x", -/* 0x04 */NULL, NULL, -/* 0x05 */"ACL_$GET_SID", "x,x", -/* 0x06 */"FILE_$MK_PERMANENT", "x,x", -/* 0x07 */"FILE_$UNLOCK_VOL", "x,x", -/* 0x08 */"CAL_$READ_TIMEZONE", "x,x", -/* 0x09 */"CAL_$SEC_TO_CLOCK", "x,x", -/* 0x0a */"CAL_$WRITE_TIMEZONE", "x,x", -/* 0x0b */"DISK_$UNASSIGN", "x,x", -/* 0x0c */"FILE_$FORCE_UNLOCK", "x,x", -/* 0x0d */"FILE_$FW_FILE", "x,x", -/* 0x0e */"FILE_$MK_IMMUTABLE", "x,x", -/* 0x0f */"FILE_$PURIFY", "x,x", -/* 0x10 */"GET_BUILD_TIME", "x,x", -/* 0x11 */NULL, NULL, -/* 0x12 */NULL, NULL, -/* 0x13 */"MSG_$ALLOCATE", "x,x", -/* 0x14 */"MSG_$OPEN", "x,x", -/* 0x15 */"MSG_$WAIT", "x,x", -/* 0x16 */NULL, NULL, -/* 0x17 */NULL, NULL, -/* 0x18 */"PBU_$DEVICE_INTERRUPTING", "x,x", -/* 0x19 */"PBU_$DISABLE_DEVICE", "x,x", -/* 0x1a */"PBU_$ENABLE_DEVICE", "x,x", -/* 0x1b */"PBU_$FREE_MAP", "x,x", -/* 0x1c */"PROC2_$QUIT", "x,x", -/* 0x1d */"PROC2_$RESUME", "x,x", -/* 0x1e */"PROC2_$SUSPEND", "x,x", -/* 0x1f */NULL, NULL, -/* 0x20 */NULL, NULL, -/* 0x21 */NULL, NULL, -/* 0x22 */NULL, NULL, -/* 0x23 */NULL, NULL, -/* 0x24 */NULL, NULL, -/* 0x25 */NULL, NULL, -/* 0x26 */"SMD_$MAP_DISPLAY_U", "x,x", -/* 0x27 */"SMD_$MOVE_KBD_CURSOR", "x,x", -/* 0x28 */NULL, NULL, -/* 0x29 */"SMD_$RETURN_DISPLAY", "x,x", -/* 0x2a */NULL, NULL, -/* 0x2b */NULL, NULL, -/* 0x2c */NULL, NULL, -/* 0x2d */NULL, NULL, -/* 0x2e */"PEB_$GET_INFO", "x,x", -/* 0x2f */NULL, NULL, -/* 0x30 */"EC2_$GET_VAL", "x,x", -/* 0x31 */"AST_$ADD_ASTES", "x,x", -/* 0x32 */"PBU_$DISSOC", "x,x", -/* 0x33 */"PROC2_$MAKE_ORPHAN", "x,x", -/* 0x34 */"FILE_$DELETE_FORCE", "x,x", -/* 0x35 */"FILE_$DELETE_WHEN_UNLOCKED", "x,x", -/* 0x36 */"FILE_$MK_TEMPORARY", "x,x", -/* 0x37 */NULL, NULL, -/* 0x38 */NULL, NULL, -/* 0x39 */NULL, NULL, -/* 0x3a */NULL, NULL, -/* 0x3b */"SMD_$INQ_KBD_CURSOR", "x,x", -/* 0x3c */"ACL_$ENTER_SUBS", "u,x", -/* 0x3d */NULL, NULL, -/* 0x3e */NULL, NULL, -/* 0x3f */NULL, NULL, -/* 0x40 */NULL, NULL, -/* 0x41 */NULL, NULL, -/* 0x42 */"FILE_$DELETE_FORCE_WHEN_UNLOCKED", "x,x", -/* 0x43 */NULL, NULL, -/* 0x44 */"CT_$ACQUIRE", "x,x", -/* 0x45 */"HINT_$ADD", "x,x", -/* 0x46 */"DIR_$FIX_DIR", "x,x", -/* 0x47 */"NAME_$SET_WDIRUS", "u,x", -/* 0x48 */"NAME_$SET_NDIRUS", "u,x", -/* 0x49 */NULL, NULL, -/* 0x4a */NULL, NULL, -/* 0x4b */"MSG_$CLOSEI", "x,x", -/* 0x4c */"NETWORK_$ADD_PAGE_SERVERS", "x,x", -/* 0x4d */"NETWORK_$ADD_REQUEST_SERVERS", "x,x", -/* 0x4e */"ACL_$ADD_PROJ", "x,x", -/* 0x4f */"ACL_$DELETE_PROJ", "x,x", -/* 0x50 */NULL, NULL, -/* 0x51 */NULL, NULL, -/* 0x52 */"SMD_$SET_TP_REPORTING", "x,x", -/* 0x53 */"SMD_$DISABLE_TRACKING", "x,x", -/* 0x54 */NULL, NULL, -/* 0x55 */NULL, NULL, -/* 0x56 */NULL, NULL, -/* 0x57 */NULL, NULL, -/* 0x58 */"HINT_$ADDI", "x,x", -/* 0x59 */NULL, NULL, -/* 0x5a */NULL, NULL, -/* 0x5b */"PBU_$ALLOCATE_EC", "x,x", -/* 0x5c */"SMD_$SET_DISP_UNIT", "x,x", -/* 0x5d */"SMD_$VIDEO_CTL", "x,x", -/* 0x5e */"SMD_$SET_CURSOR_POS", "x,x", -/* 0x5f */"TERM_$SEND_KBD_STRING", "x,x", -/* 0x60 */"AUDIT_$CONTROL", "x,x", -/* 0x61 */"PROC2_$SIGBLOCK", "x,x", -/* 0x62 */"PROC2_$SIGSETMASK", "x,x", -/* 0x63 */"PROC2_$SIGPAUSE", "x,x", -/* 0x64 */"ACL_$FIPS_CTL", "x,x", -/* 0x65 */"AS_$GET_ADDR", "x,x", -/* 0x66 */"PROC2_$GET_ASID", "x,x", -/* 0x67 */"TTY_$K_FLUSH_INPUT", "x,x", -/* 0x68 */"TTY_$K_FLUSH_OUTPUT", "x,x", -/* 0x69 */"TTY_$K_DRAIN_OUTPUT", "x,x", -/* 0x6a */"PROC2_$DEBUG", "x,x", -/* 0x6b */"PROC2_$UNDEBUG", "x,x", -/* 0x6c */"ACL_$DEF_ACLDATA", "x,x", -/* 0x6d */"PROC2_$OVERRIDE_DEBUG", "x,x", -/* 0x6e */"TIME_$SET_TIME_OF_DAY", "x,x", -/* 0x6f */"CAL_$DECODE_TIME", "x,x", -/* 0x70 */"ACL_$INHERIT_SUBSYS", "x,x", -/* 0x71 */"ACL_$SET_LOCAL_LOCKSMITH", "x,x", -/* 0x72 */NULL, NULL, -/* 0x73 */"SMD_$DISSOC", "x,x", -/* 0x74 */"SMD_$BUSY_WAIT", "x,x", -/* 0x75 */"TTY_$K_OLD_RESET", "x,x", -/* 0x76 */NULL, NULL, -/* 0x77 */NULL, NULL, -/* 0x78 */NULL, NULL, -/* 0x79 */"SCSI_$ABORT_OPERATION", "x,x", -/* 0x7a */"SCSI_$RELEASE", "x,x", -/* 0x7b */"SCSI_$RESET_DEVICE", "x,x", -/* 0x7c */NULL, NULL, -/* 0x7d */"TPAD_$RE_RANGE_UNIT", "x,x", -/* 0x7e */"DISK_$FORMAT_WHOLE", "x,x", -/* 0x7f */NULL, NULL, -/* 0x80 */NULL, NULL, -/* 0x81 */NULL, NULL, -/* 0x82 */NULL, NULL, -/* 0x83 */NULL, NULL, -/* 0x84 */"SMD_$SEND_UNIT_RESPONSE", "x,x", -/* 0x85 */NULL, NULL, -/* 0x86 */"MST_$FW_XTAL", "x,x", -/* 0x87 */"THREAD_$TERMINATE", "x,x", -/* 0x88 */"THREAD_$TERMINATE_ALL", "u,x", -/* 0x89 */"THREAD_$SUSPEND", "x,x", -/* 0x8a */"THREAD_$RESUME", "x,x", -/* 0x8b */"THREAD_$HANDLE_SIGNALS", "x,x", -/* 0x8c */"THREAD_$ABORT", "x,x", -/* 0x8d */"ACL_$SET_PROTECT_OPTION", "x,x", -/* 0x8e */"TTY_$K_SUSPEND_INPUT", "x,x", -/* 0x8f */"TTY_$K_RESUME_INPUT", "x,x", -/* 0x90 */"TTY_$K_SUSPEND_OUTPUT", "x,x", -/* 0x91 */"TTY_$K_RESUME_OUTPUT", "x,x" }; - -//------------------------------------------------------ -// TRAP3 -//------------------------------------------------------ - -static const char* trap3[] = { -/* 0x00 */"PBU2_$DMA_STOP", "x,x,x", -/* 0x01 */NULL, NULL, -/* 0x02 */"FILE_$CREATE", "x,x,x", -/* 0x03 */"FILE_$UNLOCK", "u,x,x", -/* 0x04 */"FILE_$TRUNCATE", "u,x,x", -/* 0x05 */"MST_$UNMAPS", "x,x,x", -/* 0x06 */"VFMT_$WRITE", "s,x,x", -/* 0x07 */"FILE_$ATTRIBUTES", "x,x,x", -/* 0x08 */"FILE_$SET_LEN", "x,x,x", -/* 0x09 */"FILE_$SET_TYPE", "x,x,x", -/* 0x0a */NULL, NULL, -/* 0x0b */NULL, NULL, -/* 0x0c */NULL, NULL, -/* 0x0d */NULL, NULL, -/* 0x0e */"NETWORK_$SET_SERVICE", "x,x,x", -/* 0x0f */"ASKNODE_$WHO", "s,x,x", -/* 0x10 */"FILE_$ACT_ATTRIBUTES", "x,x,x", -/* 0x11 */"FILE_$LOCATE", "x,x,x", -/* 0x12 */"FILE_$NEIGHBORS", "x,x,x", -/* 0x13 */"FILE_$READ_LOCK_ENTRYU", "x,x,x", -/* 0x14 */"FILE_$SET_ACL", "x,x,x", -/* 0x15 */"FILE_$SET_DIRPTR", "x,x,x", -/* 0x16 */"FILE_$SET_TROUBLE", "x,x,x", -/* 0x17 */NULL, NULL, -/* 0x18 */NULL, NULL, -/* 0x19 */NULL, NULL, -/* 0x1a */NULL, NULL, -/* 0x1b */NULL, NULL, -/* 0x1c */"PBU_$DMA_STOP", "x,x,x", -/* 0x1d */"PBU_$SETDOWN", "x,x,x", -/* 0x1e */"PBU_$SETUP", "x,x,x", -/* 0x1f */"PROC2_$LIST", "x,x,x", -/* 0x20 */"FIM_$SINGLE_STEP", "x,x,x", -/* 0x21 */"SMD_$ASSOC", "x,x,x", -/* 0x22 */"SMD_$BORROW_DISPLAY", "x,x,x", -/* 0x23 */NULL, NULL, -/* 0x24 */NULL, NULL, -/* 0x25 */"SMD_$SET_TP_CURSOR", "x,x,x", -/* 0x26 */"TIME_$WAIT", "x,x,x", -/* 0x27 */"RINGLOG_$CNTL", "x,x,x", -/* 0x28 */"SMD_$ALLOC_HDM", "x,x,x", -/* 0x29 */"SMD_$FREE_HDM", "x,x,x", -/* 0x2a */NULL, NULL, -/* 0x2b */"OS_$GET_EC", "x,x,x", -/* 0x2c */"TIME_$GET_EC", "x,x,x", -/* 0x2d */NULL, NULL, -/* 0x2e */"PROC2_$UPID_TO_UID", "x,u,x", -/* 0x2f */"MSG_$GET_EC", "x,x,x", -/* 0x30 */"DISK_$AS_OPTIONS", "x,x,x", -/* 0x31 */"SMD_$GET_EC", "x,x,x", -/* 0x32 */"NAME_$SET_ACL", "x,x,x", -/* 0x33 */"FILE_$SET_REFCNT", "x,x,x", -/* 0x34 */NULL, NULL, -/* 0x35 */"PROC1_$GET_INFO", "x,x,x", -/* 0x36 */NULL, NULL, -/* 0x37 */NULL, NULL, -/* 0x38 */NULL, NULL, -/* 0x39 */NULL, NULL, -/* 0x3a */NULL, NULL, -/* 0x3b */NULL, NULL, -/* 0x3c */"AS_$GET_INFO", "x,x,x", -/* 0x3d */"FILE_$SET_DTM", "x,x,x", -/* 0x3e */"FILE_$SET_DTU", "x,x,x", -/* 0x3f */NULL, NULL, -/* 0x40 */"LOG_$READ", "x,x,x", -/* 0x41 */"PROC2_$SET_PGROUP", "x,x,x", -/* 0x42 */"SMD_$SET_BLANK_TIMEOUT", "x,x,x", -/* 0x43 */"SMD_$INQ_BLANK_TIMEOUT", "x,x,x", -/* 0x44 */"FILE_$REMOVE_WHEN_UNLOCKED", "x,x,x", -/* 0x45 */"CT_$RELEASE", "x,x,x", -/* 0x46 */"PROC2_$UPGID_TO_UID", "x,x,x", -/* 0x47 */"TIME_$GET_ITIMER", "x,x,x", -/* 0x48 */"DIR_$SET_DAD", "x,x,x", -/* 0x49 */NULL, NULL, -/* 0x4a */NULL, NULL, -/* 0x4b */NULL, NULL, -/* 0x4c */NULL, NULL, -/* 0x4d */NULL, NULL, -/* 0x4e */NULL, NULL, -/* 0x4f */"RIP_$TABLE", "x,x,x", -/* 0x50 */"FILE_$LOCATEI", "x,x,x", -/* 0x51 */"MSG_$OPENI", "x,x,x", -/* 0x52 */"MSG_$ALLOCATEI", "x,x,x", -/* 0x53 */"MSG_$WAITI", "x,x,x", -/* 0x54 */"ACL_$SET_PROJ_LIST", "x,x,x", -/* 0x55 */"ACL_$GET_RE_SIDS", "x,x,x", -/* 0x56 */NULL, NULL, -/* 0x57 */"MSG_$SET_HPIPC", "x,x,x", -/* 0x58 */"DIR_$VALIDATE_ROOT_ENTRY", "x,x,x", -/* 0x59 */"SMD_$ENABLE_TRACKING", "x,x,x", -/* 0x5a */"FILE_$READ_LOCK_ENTRYUI", "x,x,x", -/* 0x5b */NULL, NULL, -/* 0x5c */"ROUTE_$SERVICE", "x,x,x", -/* 0x5d */NULL, NULL, -/* 0x5e */NULL, NULL, -/* 0x5f */NULL, NULL, -/* 0x60 */"PBU_$ADVANCE_EC", "x,x,x", -/* 0x61 */"PBU_$RELEASE_EC", "x,x,x", -/* 0x62 */NULL, NULL, -/* 0x63 */"SMD_$GET_IDM_EVENT", "x,x,x", -/* 0x64 */"MSG_$TEST_FOR_MESSAGE", "x,x,x", -/* 0x65 */"SMD_$ADD_TRK_RECT", "x,x,x", -/* 0x66 */"SMD_$DEL_TRK_RECT", "x,x,x", -/* 0x67 */"SMD_$SET_KBD_TYPE", "x,x,x", -/* 0x68 */NULL, NULL, -/* 0x69 */"FILE_$SET_AUDITED", "x,x,x", -/* 0x6a */"PROC2_$ACKNOWLEDGE", "x,x,x", -/* 0x6b */"PROC2_$GET_MY_UPIDS", "x,x,x", -/* 0x6c */"TTY_$K_INQ_INPUT_FLAGS", "x,x,x", -/* 0x6d */"TTY_$K_INQ_OUTPUT_FLAGS", "x,x,x", -/* 0x6e */"TTY_$K_INQ_ECHO_FLAGS", "x,x,x", -/* 0x6f */"TTY_$K_SET_INPUT_BREAK_MODE", "x,x,x", -/* 0x70 */"TTY_$K_INQ_INPUT_BREAK_MODE", "x,x,x", -/* 0x71 */"TTY_$K_SET_PGROUP", "x,x,x", -/* 0x72 */"TTY_$K_INQ_PGROUP", "x,x,x", -/* 0x73 */"TTY_$K_SIMULATE_TERMINAL_INPUT", "x,x,x", -/* 0x74 */"TTY_$K_INQ_FUNC_ENABLED", "x,x,x", -/* 0x75 */"SIO_$K_TIMED_BREAK", "x,x,x", -/* 0x76 */"FILE_$SET_DEVNO", "x,x,x", -/* 0x77 */"XPD_$SET_PTRACE_OPTS", "x,x,x", -/* 0x78 */"XPD_$INQ_PTRACE_OPTS", "x,x,x", -/* 0x79 */"FILE_$SET_MAND_LOCK", "x,x,x", -/* 0x7a */"TIME_$SET_CPU_LIMIT", "x,x,x", -/* 0x7b */"CAL_$WEEKDAY", "x,x,x", -/* 0x7c */"SIO_$K_SIGNAL_WAIT", "x,x,x", -/* 0x7d */"TERM_$SET_DISCIPLINE", "x,x,x", -/* 0x7e */"PROC2_$SET_SERVER", "x,x,x", -/* 0x7f */"PACCT_$START", "x,x,x", -/* 0x80 */"FILE_$SET_DTU_F", "x,x,x", -/* 0x81 */"PROC2_$PGUID_TO_UPGID", "x,x,x", -/* 0x82 */"TERM_$INQ_DISCIPLINE", "x,x,x", -/* 0x83 */"PBU_$DMA_STATUS", "x,x,x", -/* 0x84 */NULL, NULL, -/* 0x85 */"MST_$UNMAPS_AND_FREE_AREA", "x,x,x", -/* 0x86 */"SMD_$ASSOC_CSRS", "x,x,x", -/* 0x87 */"SMD_$INQ_DISP_INFO", "x,x,x", -/* 0x88 */"SMD_$INQ_DISP_UID", "x,x,x", -/* 0x89 */"SMD_$DISPLAY_LOGO", "x,x,x", -/* 0x8a */"TERM_$SET_REAL_LINE_DISCIPLINE", "x,x,x", -/* 0x8b */"TIME_$ADJUST_TIME_OF_DAY", "x,x,x", -/* 0x8c */"PROC2_$UID_TO_UPID", "x,x,x", -/* 0x8d */"PROC2_$SET_SESSION_ID", "x,x,x", -/* 0x8e */"SMD_$GET_UNIT_EVENT", "x,x,x", -/* 0x8f */"TPAD_$SET_UNIT_CURSOR", "x,x,x", -/* 0x90 */"TPAD_$SET_PUNCH_IMPACT", "x,x,x", -/* 0x91 */"TPAD_$INQ_PUNCH_IMPACT", "x,x,x", -/* 0x92 */"TTY_$K_INQ_SESSION_ID", "x,x,x", -/* 0x93 */"TTY_$K_SET_SESSION_ID", "x,x,x", -/* 0x94 */NULL, NULL, -/* 0x95 */NULL, NULL, -/* 0x96 */NULL, NULL, -/* 0x97 */NULL, NULL, -/* 0x98 */"SMD_$SHARE_DEVICE", "x,x,x", -/* 0x99 */"SMD_$SET_UNIT_CURSOR_POS", "x,x,x", -/* 0x9a */"SMD_$CLR_AND_LOAD_TRK_RECT", "x,x,x", -/* 0x9b */"PROC2_$GET_PARM", "x,x,x", -/* 0x9c */NULL, NULL, -/* 0x9d */NULL, NULL, -/* 0x9e */NULL, NULL, -/* 0x9f */"FILE_$CW_READ", "x,x,x", -/* 0xa0 */"FILE_$CW_WRITE", "x,x,x", -/* 0xa1 */"MST_$TRUNC_XTAL", "x,x,x", -/* 0xa2 */"MST_$SET_LEN_XTAL", "x,x,x", -/* 0xa3 */"THREAD_$CREATE", "x,x,x", -/* 0xa4 */"THREAD_$CLEANUP", "x,x,x", -/* 0xa5 */"THREAD_$SET_INH_PTR", "x,x,x", -/* 0xa6 */"SMD_$BORROW_DISPLAY_AND_KBD", "x,x,x", -/* 0xa7 */"THREAD_$CLEANUP_ALL", "x,x,x", -/* 0xa8 */"DIR_$ADD_MOUNT", "x,x,x", -/* 0xa9 */"DIR_$REMOVE_MOUNT", "x,x,x", -/* 0xaa */NULL, NULL, -/* 0xab */"TTY_$K_RESET", "x,x,x", -/* 0xac */"MST_$SHADOW_MAP", "x,x,x", -/* 0xad */NULL, NULL }; - -//------------------------------------------------------ -// TRAP4 -//------------------------------------------------------ - -static const char* trap4[] = { -/* 0x00 */NULL, NULL, -/* 0x01 */"MST_$SET_GUARD", "u,x,x,x", -/* 0x02 */"MST_$UNMAP_GLOBAL", "u,x,x,x", -/* 0x03 */"MST_$GET_UID", "x,u,x,x", -/* 0x04 */"EC2_$WAIT", "x,x,x,x", -/* 0x05 */"FILE_$READ_LOCK_ENTRY", "x,x,x,x", -/* 0x06 */"MST_$UNMAP", "u,x,x,x", -/* 0x07 */"MST_$GROW_AREA", "x,x,x,x", -/* 0x08 */NULL, NULL, -/* 0x09 */NULL, NULL, -/* 0x0a */NULL, NULL, -/* 0x0b */NULL, NULL, -/* 0x0c */"TERM_$CONTROL", "x,x,x,x", -/* 0x0d */"TERM_$READ", "x,s,x,x", -/* 0x0e */"TERM_$WRITE", "x,x,x,x", -/* 0x0f */"DISK_$FORMAT", "x,x,x,x", -/* 0x10 */"DISK_$LV_ASSIGN", "x,x,x,x", -/* 0x11 */"FILE_$FW_PARTIAL", "x,x,x,x", -/* 0x12 */NULL, NULL, -/* 0x13 */NULL, NULL, -/* 0x14 */NULL, NULL, -/* 0x15 */NULL, NULL, -/* 0x16 */NULL, NULL, -/* 0x17 */NULL, NULL, -/* 0x18 */NULL, NULL, -/* 0x19 */NULL, NULL, -/* 0x1a */NULL, NULL, -/* 0x1b */NULL, NULL, -/* 0x1c */NULL, NULL, -/* 0x1d */NULL, NULL, -/* 0x1e */NULL, NULL, -/* 0x1f */NULL, NULL, -/* 0x20 */NULL, NULL, -/* 0x21 */NULL, NULL, -/* 0x22 */NULL, NULL, -/* 0x23 */"PBU_$WAIT", "x,x,x,x", -/* 0x24 */"PBU_$GET_PTR", "x,x,x,x", -/* 0x25 */"PCHIST_$CNTL", "x,x,x,x", -/* 0x26 */"PROC2_$GET_INFO", "u,x,x,x", -/* 0x27 */NULL, NULL, -/* 0x28 */NULL, NULL, -/* 0x29 */NULL, NULL, -/* 0x2a */"SMD_$SIGNAL", "x,x,x,x", -/* 0x2b */NULL, NULL, -/* 0x2c */NULL, NULL, -/* 0x2d */"TERM_$INQUIRE", "x,x,x,x", -/* 0x2e */NULL, NULL, -/* 0x2f */NULL, NULL, -/* 0x30 */NULL, NULL, -/* 0x31 */"TERM_$GET_EC", "x,x,x,x", -/* 0x32 */NULL, NULL, -/* 0x33 */"PBU_$GET_EC", "x,x,x,x", -/* 0x34 */NULL, NULL, -/* 0x35 */NULL, NULL, -/* 0x36 */NULL, NULL, -/* 0x37 */NULL, NULL, -/* 0x38 */"TERM_$READ_COND", "x,x,x,x", -/* 0x39 */NULL, NULL, -/* 0x3a */NULL, NULL, -/* 0x3b */"PBU2_$WIRE", "x,x,x,x", -/* 0x3c */"PROC2_$SET_NAME", "x,x,x,x", -/* 0x3d */"PROC2_$SET_PRIORITY", "x,x,x,x", -/* 0x3e */"PROC2_$GET_EC", "u,x,x,x", -/* 0x3f */"PROC2_$LIST_PGROUP", "x,x,x,x", -/* 0x40 */NULL, NULL, -/* 0x41 */NULL, NULL, -/* 0x42 */NULL, NULL, -/* 0x43 */"CT_$CONTROL", "x,x,x,x", -/* 0x44 */"CT_$WAIT", "x,x,x,x", -/* 0x45 */"DIR_$DROP_DIRU", "x,x,x,x", -/* 0x46 */"DIR_$SET_DEFAULT_ACL", "x,x,x,x", -/* 0x47 */"DIR_$GET_DEFAULT_ACL", "x,x,x,x", -/* 0x48 */"NAME_$READ_DIRS_PS", "x,x,x,x", -/* 0x49 */NULL, NULL, -/* 0x4a */"ACL_$GET_PROJ_LIST", "x,x,x,x", -/* 0x4b */"MST_$CHANGE_RIGHTS", "x,x,x,x", -/* 0x4c */NULL, NULL, -/* 0x4d */"FILE_$READ_LOCK_ENTRYI", "x,x,x,x", -/* 0x4e */"ROUTE_$INCOMING", "x,x,x,x", -/* 0x4f */NULL, NULL, -/* 0x50 */"SMD_$INQ_KBD_TYPE", "x,x,x,x", -/* 0x51 */"ROUTE_$GET_EC", "x,x,x,x", -/* 0x52 */NULL, NULL, -/* 0x53 */"SMD_$DM_COND_EVENT_WAIT", "x,x,x,x", -/* 0x54 */"DISK_$READ_MFG_BADSPOTS", "x,x,x,x", -/* 0x55 */"DISK_$GET_MNT_INFO", "x,x,x,x", -/* 0x56 */"PROC2_$SET_SIG_MASK", "x,x,x,x", -/* 0x57 */"PROC2_$SIGRETURN", "x,x,x,x", -/* 0x58 */"PROC2_$WAIT", "x,x,x,x", -/* 0x59 */"PROC2_$SIGNAL", "x,x,x,x", -/* 0x5a */"PROC2_$SIGNAL_PGROUP", "x,x,x,x", -/* 0x5b */"PROC2_$GET_CR_REC", "x,x,x,x", -/* 0x5c */"TTY_$K_SET_FUNC_CHAR", "x,x,x,x", -/* 0x5d */"TTY_$K_INQ_FUNC_CHAR", "x,x,x,x", -/* 0x5e */"TTY_$K_SET_INPUT_FLAG", "x,x,x,x", -/* 0x5f */"TTY_$K_SET_OUTPUT_FLAG", "x,x,x,x", -/* 0x60 */"TTY_$K_SET_ECHO_FLAG", "x,x,x,x", -/* 0x61 */"TTY_$K_ENABLE_FUNC", "x,x,x,x", -/* 0x62 */"SIO_$K_SET_PARAM", "x,x,x,x", -/* 0x63 */"SIO_$K_INQ_PARAM", "x,x,x,x", -/* 0x64 */"FILE_$SET_MGR_ATTR", "x,x,x,x", -/* 0x65 */"XPD_$GET_REGISTERS", "x,x,x,x", -/* 0x66 */"XPD_$PUT_REGISTERS", "x,x,x,x", -/* 0x67 */"FILE_$RESERVE", "u,x,x,x", -/* 0x68 */NULL, NULL, -/* 0x69 */"ACL_$GET_RES_SIDS", "x,x,x,x", -/* 0x6a */"FILE_$FW_PAGES", "x,x,x,x", -/* 0x6b */"PROC2_$SET_ACCT_INFO", "s,x,x,x", -/* 0x6c */"FILE_$IMPORT_LK", "x,x,x,x", -/* 0x6d */"FILE_$UNLOCK_D", "u,x,x,x", -/* 0x6e */"FILE_$SET_LEN_D", "x,x,x,x", -/* 0x6f */"FILE_$TRUNCATE_D", "x,x,x,x", -/* 0x70 */"FILE_$SET_DTM_F", "x,x,x,x", -/* 0x71 */"TTY_$K_SET_FLAG", "x,x,x,x", -/* 0x72 */NULL, NULL, -/* 0x73 */"MST_$UNMAP_AND_FREE_AREA", "x,x,x,x", -/* 0x74 */NULL, NULL, -/* 0x75 */"PROC2_$NAME_TO_UID", "S,w,u,x", -/* 0x76 */NULL, NULL, -/* 0x77 */NULL, NULL, -/* 0x78 */NULL, NULL, -/* 0x79 */"SCSI_$GET_EC", "x,x,x,x", -/* 0x7a */"SCSI_$GET_INFO", "x,x,x,x", -/* 0x7b */"SCSI_$SETUP", "x,x,x,x", -/* 0x7c */"SCSI_$WIRE", "x,x,x,x", -/* 0x7d */"MSG_$SHARE_SOCKET", "x,x,x,x", -/* 0x7e */"TTY_$K_INQ_DELAY", "x,x,x,x", -/* 0x7f */"TTY_$K_SET_DELAY", "x,x,x,x", -/* 0x80 */NULL, NULL, -/* 0x81 */NULL, NULL, -/* 0x82 */"PROC2_$PGROUP_INFO", "x,x,x,x", -/* 0x83 */"PROC2_$SET_PARM", "x,x,x,x", -/* 0x84 */NULL, NULL, -/* 0x85 */NULL, NULL, -/* 0x86 */"XPAGE_$PAGER_RENDEZVOUS", "x,x,x,x", -/* 0x87 */"FILE_$SET_DEVNO32", "x,x,x,x", -/* 0x88 */"MST_$SET_LIMIT", "x,x,x,x", -/* 0x89 */"THREAD_$SET_PRIORITY", "x,x,x,x", -/* 0x8a */"THREAD_$INFO", "x,x,x,x", -/* 0x8b */"TTY_$K_SET_DELAY_STYLE", "x,x,x,x", -/* 0x8c */"TTY_$K_INQ_DELAY_STYLE", "x,x,x,x" }; - -//------------------------------------------------------ -// TRAP5 -//------------------------------------------------------ - -static const char* trap5[] = { -/* 0x00 */NULL, NULL, -/* 0x01 */"MST_$MAP_AREA", "x,x,x,u,x", -/* 0x02 */NULL, NULL, -/* 0x03 */NULL, NULL, -/* 0x04 */NULL, NULL, -/* 0x05 */"ACL_$RIGHTS", "x,x,x,x,x", -/* 0x06 */NULL, NULL, -/* 0x07 */"ASKNODE_$INFO", "x,x,x,x,x", -/* 0x08 */"DISK_$AS_READ", "x,x,x,x,x", -/* 0x09 */"DISK_$AS_WRITE", "x,x,x,x,x", -/* 0x0a */NULL, NULL, -/* 0x0b */NULL, NULL, -/* 0x0c */NULL, NULL, -/* 0x0d */NULL, NULL, -/* 0x0e */NULL, NULL, -/* 0x0f */NULL, NULL, -/* 0x10 */NULL, NULL, -/* 0x11 */"PBU_$GET_DCTE", "x,x,x,x,x", -/* 0x12 */"PBU_$READ_CSR", "x,x,x,x,x", -/* 0x13 */"PBU_$CONTROL", "x,x,x,x,x", -/* 0x14 */"PBU2_$WIRE_MAP", "x,x,x,x,x", -/* 0x15 */"PBU_$WRITE_CSR", "x,x,x,x,x", -/* 0x16 */"TPAD_$INQUIRE", "x,x,x,x,x", -/* 0x17 */"TPAD_$SET_MODE", "x,x,x,x,x", -/* 0x18 */"VFMT_$MAIN", "x,x,x,x,x", -/* 0x19 */"VOLX_$GET_INFO", "x,x,x,x,x", -/* 0x1a */"VTOC_$GET_UID", "x,x,x,x,x", -/* 0x1b */"NETLOG_$CNTL", "x,x,x,x,x", -/* 0x1c */"PROC2_$GET_UPIDS", "x,x,x,x,x", -/* 0x1d */NULL, NULL, -/* 0x1e */NULL, NULL, -/* 0x1f */"PBU2_$ALLOCATE_MAP", "x,x,x,x,x", -/* 0x20 */"PBU2_$MAP", "x,x,x,x,x", -/* 0x21 */"PBU2_$UNMAP", "x,x,x,x,x", -/* 0x22 */"PBU2_$UNWIRE", "x,x,x,x,x", -/* 0x23 */"MST_$GET_UID_ASID", "x,x,x,x,x", -/* 0x24 */"MST_$INVALIDATE", "x,x,u,x,x", -/* 0x25 */"FILE_$INVALIDATE", "x,x,x,x,x", -/* 0x26 */NULL, NULL, -/* 0x27 */NULL, NULL, -/* 0x28 */NULL, NULL, -/* 0x29 */"MST_$SET_TOUCH_AHEAD_CNT", "x,x,x,x,x", -/* 0x2a */"OS_$CHKSUM", "x,x,x,x,x", -/* 0x2b */"FILE_$GET_SEGMENT_MAP", "x,x,x,x,x", -/* 0x2c */NULL, NULL, -/* 0x2d */"PBU2_$ASSOC", "x,x,x,x,x", -/* 0x2e */"FILE_$UNLOCK_PROC", "x,x,x,x,x", -/* 0x2f */"CT_$READ", "x,x,x,x,x", -/* 0x30 */"CT_$WRITE", "x,x,x,x,x", -/* 0x31 */"DIR_$ADDU", "u,S,w,u,x", -/* 0x32 */"DIR_$DROPU", "x,x,x,x,x", -/* 0x33 */"DIR_$CREATE_DIRU", "x,x,x,x,x", -/* 0x34 */"DIR_$ADD_BAKU", "x,x,x,x,x", -/* 0x35 */NULL, NULL, -/* 0x36 */NULL, NULL, -/* 0x37 */NULL, NULL, -/* 0x38 */"DIR_$ADD_HARD_LINKU", "x,x,x,x,x", -/* 0x39 */NULL, NULL, -/* 0x3a */"RIP_$UPDATE", "x,x,x,x,x", -/* 0x3b */"DIR_$DROP_LINKU", "x,x,x,x,x", -/* 0x3c */"ACL_$CHECK_RIGHTS", "x,x,x,x,x", -/* 0x3d */"DIR_$DROP_HARD_LINKU", "x,x,x,x,x", -/* 0x3e */"ROUTE_$OUTGOING", "x,x,x,x,x", -/* 0x3f */NULL, NULL, -/* 0x40 */NULL, NULL, -/* 0x41 */NULL, NULL, -/* 0x42 */"NET_$GET_INFO", "x,x,x,x,x", -/* 0x43 */"DIR_$GET_ENTRYU", "x,x,x,x,x", -/* 0x44 */"AUDIT_$LOG_EVENT", "x,x,x,x,x", -/* 0x45 */"FILE_$SET_PROT", "x,x,x,x,x", -/* 0x46 */"TTY_$K_GET", "x,x,s,x,x", -/* 0x47 */"TTY_$K_PUT", "x,x,S,w,x", -/* 0x48 */"PROC2_$ALIGN_CTL", "x,x,x,x,x", -/* 0x49 */NULL, NULL, -/* 0x4a */"XPD_$READ_PROC", "x,x,x,x,x", -/* 0x4b */"XPD_$WRITE_PROC", "x,x,x,x,x", -/* 0x4c */"DIR_$SET_DEF_PROTECTION", "x,x,x,x,x", -/* 0x4d */"DIR_$GET_DEF_PROTECTION", "x,x,x,x,x", -/* 0x4e */"ACL_$COPY", "u,u,x,x,x", -/* 0x4f */"ACL_$CONVERT_FUNKY_ACL", "x,x,x,x,x", -/* 0x50 */"DIR_$SET_PROTECTION", "x,x,x,x,x", -/* 0x51 */"FILE_$OLD_AP", "x,x,x,x,x", -/* 0x52 */"ACL_$SET_RE_ALL_SIDS", "x,x,x,x,x", -/* 0x53 */"ACL_$GET_RE_ALL_SIDS", "x,x,x,x,x", -/* 0x54 */"FILE_$EXPORT_LK", "x,x,x,x,x", -/* 0x55 */"FILE_$CHANGE_LOCK_D", "x,x,x,x,x", -/* 0x56 */"XPD_$READ_PROC_ASYNC", "x,x,x,x,x", -/* 0x57 */NULL, NULL, -/* 0x58 */"SMD_$MAP_DISPLAY_MEMORY", "x,x,x,x,x", -/* 0x59 */NULL, NULL, -/* 0x5a */NULL, NULL, -/* 0x5b */NULL, NULL, -/* 0x5c */NULL, NULL, -/* 0x5d */"SCSI_$UNWIRE", "x,x,x,x,x", -/* 0x5e */"SMD_$UNMAP_DISPLAY_MEMORY", "x,x,x,x,x", -/* 0x5f */"SMD_$SET_COLOR_TABLE", "x,x,x,x,x", -/* 0x60 */"RIP_$TABLE_D", "x,x,x,x,x", -/* 0x61 */NULL, NULL, -/* 0x62 */"SMD_$DEVICE_INFO", "x,x,x,x,x", -/* 0x63 */NULL, NULL, -/* 0x64 */NULL, NULL, -/* 0x65 */"THREAD_$GET_STATE", "x,x,x,p,x", -/* 0x66 */"THREAD_$SET_STATE", "x,x,x,p,x", -/* 0x67 */"THREAD_$SET_STACK", "x,u,x,x,x", -/* 0x68 */NULL, NULL }; - -//------------------------------------------------------ -// TRAP7 -//------------------------------------------------------ - -static const char* trap7[] = { -/* 0x00 */"FILE_$LOCK", "u,x,x,x,x,x,x", -/* 0x01 */"VFMT_$WRITE", "s,x,x,x,x,x,x", -/* 0x02 */"MST_$MAP_AREA_AT", "x,x,x,x,x,x,x", -/* 0x03 */NULL, NULL, -/* 0x04 */NULL, NULL, -/* 0x05 */NULL, NULL, -/* 0x06 */NULL, NULL, -/* 0x07 */NULL, NULL, -/* 0x08 */NULL, NULL, -/* 0x09 */NULL, NULL, -/* 0x0a */NULL, NULL, -/* 0x0b */NULL, NULL, -/* 0x0c */NULL, NULL, -/* 0x0d */"VFMT_$ENCODE/VFMT_$FORMAT", "x,x,x,x,x,x,x", -/* 0x0e */"VFMT_$ENCODE/VFMT_$FORMAT", "x,x,x,x,x,x,x", -/* 0x0f */"STOP_$WATCH", "x,x,x,x,x,x,x", -/* 0x10 */NULL, NULL, -/* 0x11 */NULL, NULL, -/* 0x12 */"ASKNODE_$GET_INFO", "x,x,x,x,x,x,x", -/* 0x13 */"DISK_$DIAG_IO", "x,x,x,x,x,x,x", -/* 0x14 */NULL, NULL, -/* 0x15 */NULL, NULL, -/* 0x16 */NULL, NULL, -/* 0x17 */"CT_$DIAG", "x,x,x,x,x,x,x", -/* 0x18 */"TIME_$SET_ITIMER", "x,x,x,x,x,x,x", -/* 0x19 */"OSINFO_$GET_STATS", "x,x,x,x,x,x,x", -/* 0x1a */"DIR_$CNAMEU", "x,x,x,x,x,x,x", -/* 0x1b */"DIR_$DELETE_FILEU", "u,S,w,x,x,x,x", -/* 0x1c */"DIR_$ADD_LINKU", "x,x,x,x,x,x,x", -/* 0x1d */NULL, NULL, -/* 0x1e */NULL, NULL, -/* 0x1f */NULL, NULL, -/* 0x20 */NULL, NULL, -/* 0x21 */"ASKNODE_$WHO_REMOTE", "x,x,x,x,x,x,x", -/* 0x22 */"MST_$REMAP", "x,x,x,x,x,x,x", -/* 0x23 */"DIR_$ROOT_ADDU", "x,x,x,x,x,x,x", -/* 0x24 */NULL, NULL, -/* 0x25 */NULL, NULL, -/* 0x26 */NULL, NULL, -/* 0x27 */NULL, NULL, -/* 0x28 */"ASKNODE_$WHO_NOTOPO", "x,x,x,x,x,x,x", -/* 0x29 */"NET_$OPEN", "x,x,x,x,x,x,x", -/* 0x2a */"NET_$CLOSE", "x,x,x,x,x,x,x", -/* 0x2b */"NET_$IOCTL", "x,x,x,x,x,x,x", -/* 0x2c */"DIR_$FIND_UID", "u,u,x,S,w,x,x", -/* 0x2d */"FILE_$GET_ATTRIBUTES", "u,x,x,x,x,x,-", -/* 0x2e */NULL, NULL, -/* 0x2f */"PCHIST_$UNIX_PROFIL_CNTL", "x,x,x,x,x,x,x", -/* 0x30 */"XPD_$RESTART", "x,x,x,x,x,x,x", -/* 0x31 */"FILE_$GET_ATTR_INFO", "u,x,x,x,x,x,p", -/* 0x32 */"ACL_$PRIM_CREATE", "x,x,x,x,x,x,x", -/* 0x33 */"PROC2_$GET_REGS", "x,x,x,x,x,x,x", -/* 0x34 */"ACL_$CONVERT_TO_9ACL", "x,x,x,x,x,x,x", -/* 0x35 */"ACL_$SET_RES_ALL_SIDS", "x,x,x,x,x,x,x", -/* 0x36 */"ACL_$GET_RES_ALL_SIDS", "x,x,x,x,x,x,x", -/* 0x37 */"FILE_$LOCK_D", "u,x,x,x,x,x,p", -/* 0x38 */"FILE_$CREATE_IT", "x,x,u,x,u,x,u", -/* 0x39 */"ACL_$RIGHTS_CHECK", "x,x,x,x,x,x,x", -/* 0x3a */"RIP_$UPDATE_D", "x,x,x,x,x,x,x", -/* 0x3b */"VOLX_$SWAPON", "x,x,x,x,x,x,x", -/* 0x3c */"MST_$ADDMAP", "x,x,x,x,x,x,x", }; - -//------------------------------------------------------ -// TRAP8 -//------------------------------------------------------ - -static const char* trap8[] = { -/* 0x00 - 0x07 */"MST_$MAP", "u,x,x,x,x,x,x", -/* 0x01 - 0x08 */"MST_$MAP_AT", "x,u,x,x,x,x,x,x", -/* 0x02 - 0x07 */"MST_$MAP_GLOBAL", "u,x,x,x,x,x,x", -/* 0x03 - 0x0A */"VFMT_$WRITE", "s,x,x,x,x,x,x,x,x,x", -/* 0x04 - 0x06 */"VOLX_$DISMOUNT", "x,x,x,x,x,x", -/* 0x05 - 0x06 */"VOLX_$GET_UIDS", "x,x,x,x,x,x", -/* 0x06 - 0x07 */NULL, NULL, -/* 0x07 - 0x07 */"DISK_$PV_ASSIGN", "x,x,x,x,x,x,x", -/* 0x08 - 0x0B */"MSG_$RCV", "x,x,x,x,x,x,x,x,x,x,x", -/* 0x09 - 0x10 */"MSG_$SAR", "x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x0a - 0x0A */"MSG_$SEND", "x,x,x,x,x,x,x,x,x,x", -/* 0x0b - 0x06 */NULL, NULL, -/* 0x0c - 0x07 */"SMD_$LOAD_CRSR_BITMAP", "x,x,x,x,x,x,x", -/* 0x0d - 0x07 */"SMD_$READ_CRSR_BITMAP", "x,x,x,x,x,x,x", -/* 0x0e - 0x0D */"VFMT_$ENCODE/VFMT_$FORMAT", "s,x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x0f - 0x08 */"VFMT_$ENCODE/VFMT_$FORMAT", "s,x,x,x,x,x,x,x", -/* 0x10 - 0x0D */"VFMT_$ENCODE/VFMT_$FORMAT", "s,x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x11 - 0x08 */"VFMT_$ENCODE/VFMT_$FORMAT", "s,x,x,x,x,x,x,x", -/* 0x12 - 0x06 */"CAL_$WRITE_CALENDAR", "x,x,x,x,x,x", -/* 0x13 - 0x08 */"MSG_$RCV_CONTIG", "x,x,x,x,x,x,x,x", -/* 0x14 - 0x06 */"OSINFO_$GET_MMAP", "x,x,x,x,x,x", -/* 0x15 - 0x06 */"ASKNODE_$INTERNET_INFO", "x,x,x,x,x,x", -/* 0x16 - 0x07 */"MST_$GET_VA_INFO", "x,x,x,x,x,x,x", -/* 0x17 - 0x0D */"MSG_$SENDI", "x,x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x18 - 0x0F */"MSG_$RCVI", "x,x,x,x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x19 - 0x0C */"MSG_$RCV_CONTIGI", "x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x1a - 0x11 */"MSG_$SARI", "x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x1b - 0x06 */NULL, NULL, -/* 0x1c - 0x0E */"MSG_$SEND_HW", "x,x,x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x1d - 0x07 */"PBU_$WIRE_SPECIAL", "x,x,x,x,x,x,x", -/* 0x1e - 0x06 */"PBU_$DMA_START", "x,x,x,x,x,x", -/* 0x1f - 0x08 */NULL, NULL, -/* 0x20 - 0x07 */"MST_$MAP_TOP", "x,x,x,x,x,x,x", -/* 0x21 - 0x08 */"NET_$SEND", "x,x,x,x,x,x,x,x", -/* 0x22 - 0x08 */"NET_$RCV", "x,x,x,x,x,x,x,x", -/* 0x23 - 0x08 */"DIR_$DIR_READU", "u,S,w,x,x,x,x,x", -/* 0x24 - 0x07 */"DIR_$READ_LINKU", "x,x,x,x,x,x,x", -/* 0x25 - 0x07 */"PBU2_$DMA_START", "x,x,x,x,x,x,x", -/* 0x26 - 0x09 */NULL, NULL, -/* 0x27 - 0x09 */NULL, NULL, -/* 0x28 - 0x07 */"PROC2_$COMPLETE_VFORK", "x,x,x,x,x,x,x", -/* 0x29 - 0x07 */NULL, NULL, -/* 0x2a - 0x06 */NULL, NULL, -/* 0x2b - 0x0A */"DIR_$RESOLVE", "S,w,u,u,x,x,x,x,x,x", -/* 0x2c - 0x08 */"VOLX_$MOUNT", "x,x,x,x,x,x,x,x", -/* 0x2d - 0x06 */"ACL_$IMAGE", "x,x,x,x,x,x", -/* 0x2e - 0x09 */"DISK_$PV_ASSIGN_N", "x,x,x,x,x,x,x,x,x", -/* 0x2f - 0x07 */"DISK_$AS_XFER_MULTI", "x,x,x,x,x,x,x", -/* 0x30 - 0x07 */"PROC2_$FORK", "x,x,x,x,x,x,x", -/* 0x31 - 0x06 */"SCSI_$DO_COMMAND", "x,x,x,x,x,x", -/* 0x32 - 0x07 */"SCSI_$WAIT", "x,x,x,x,x,x,x", -/* 0x33 - 0x0A */"PROC2_$CREATE", "x,x,x,x,x,x,x,x,x,x", -/* 0x34 - 0x06 */"TPAD_$SET_UNIT_MODE", "x,x,x,x,x,x", -/* 0x35 - 0x06 */"TPAD_$INQUIRE_UNIT", "x,x,x,x,x,x", -/* 0x36 - 0x0B */"SCSI_$DO_SYS_DEVICE_CMD", "x,x,x,x,x,x,x,x,x,x,x", -/* 0x37 - 0x0D */"MSG_$RCV_HW", "x,x,x,x,x,x,x,x,x,x,x,x,x", -/* 0x38 - 0x06 */"VOLX_$VOL_INFO", "x,x,x,x,x,x", -/* 0x39 - 0x08 */"MST_$MAP_XTAL", "x,x,x,x,x,x,x,x", -/* 0x3a - 0x08 */"MST_$MAP_U", "x,u,x,x,x,x,x,x", -/* 0x3b - 0x06 */"MST_$GET_INFO_BY_VA", "x,x,x,x,x,x", -/* 0x3c - 0x06 */"VOLX_$QUOTA_CONTROL", "x,x,x,x,x,x", -/* 0x3d - 0x06 */"VOLX_$READ_QUOTA_TABLE", "x,x,x,x,x,x", -/* 0x3e - 0x06 */"THREAD_$LIST", "x,x,x,x,x,x", -/* 0x3f - 0x07 */"SCSI_$DO_COMMAND_2", "x,x,x,x,x,x,x" }; - -// get parameter string for parameter type and value at addr - -static const char *get_param(m68000_base_device *m68k, UINT32 addr, char type) -{ - UINT32 value = ~0; - - // FIXME: - static char sb[256]; - - int i; - char ch; - int maxlen = sizeof(sb) - 2; - UINT32 value1; - - sb[0] = 0; - - if (!m68k->mmu_tmp_buserror_occurred) - { - value = m68k->read32(addr); - if (!m68k->mmu_tmp_buserror_occurred && (value != ~0)) - { - switch (type) - { - case 'S': // string w/o terminating 0 - value1 = m68k->read32(addr + 4); - if (!m68k->mmu_tmp_buserror_occurred && (value1 != ~0)) - { - maxlen = m68k->read16(value1); - if (maxlen > sizeof(sb) - 2) - { - maxlen = sizeof(sb) - 2; - } - } - case 's': // string - i = 0; - sb[i++] = '"'; - while (i <= maxlen && (ch = m68k->read8(value++)) != 0 - && !m68k->mmu_tmp_buserror_occurred) - { - sb[i++] = ch < 32 ? '.' : ch; - } - sb[i++] = '"'; - sb[i] = 0; - break; - case 'b': // byte (1 byte) - sprintf(sb, "0x%x", m68k->read8(value)); - break; - case 'p': // pointer - sprintf(sb, "0x%x", value); - break; - case 'w': // word (2 byte) - sprintf(sb, "0x%x", m68k->read16(value)); - break; - case 'x': // default (hex 32 bit) - sprintf(sb, "0x%x", m68k->read32(value)); - break; - case 'u': // uid - sprintf(sb, "%08x.%08x", m68k->read32(value), - m68k->read32(value + 4)); - break; - default: - sprintf(sb, "%c", type); - break; - } - } - m68k->mmu_tmp_buserror_occurred = 0; - } - return sb; -} - -// get the svc call string - -static const char* get_svc_call(m68000_base_device *m68k, int trap_no, - int trap_code, char *sb) -{ - UINT32 sp = REG_A(m68k)[7]; - UINT32 pa; - const char * name = NULL; - const char * param = NULL; - - switch (trap_no) - { - case 0: - if (trap_no < sizeof(trap0) / 8) - { - name = trap0[trap_code * 2]; - param = trap0[trap_code * 2 + 1]; - } - break; - case 1: - if (trap_no < sizeof(trap1) / 8) - { - name = trap1[trap_code * 2]; - param = trap1[trap_code * 2 + 1]; - } - break; - case 2: - if (trap_no < sizeof(trap2) / 8) - { - name = trap2[trap_code * 2]; - param = trap2[trap_code * 2 + 1]; - } - break; - case 3: - if (trap_no < sizeof(trap3) / 8) - { - name = trap3[trap_code * 2]; - param = trap3[trap_code * 2 + 1]; - } - break; - case 4: - if (trap_no < sizeof(trap4) / 8) - { - name = trap4[trap_code * 2]; - param = trap4[trap_code * 2 + 1]; - } - break; - case 5: - if (trap_no < sizeof(trap5) / 8) - { - name = trap5[trap_code * 2]; - param = trap5[trap_code * 2 + 1]; - } - break; - case 7: - if (trap_no < sizeof(trap7) / 8) - { - name = trap7[trap_code * 2]; - param = trap7[trap_code * 2 + 1]; - } - break; - case 8: - if (trap_no < sizeof(trap8) / 8) - { - name = trap8[trap_code * 2]; - param = trap8[trap_code * 2 + 1]; - } - break; - } - - sb[0] = '\0'; - - if (name == NULL) - { - strcat(sb, "???"); - } - else - { - strcat(sb, name); - if (param != NULL) - { - int i; - strcat(sb, "("); - for (i = 0, pa = sp + 4; param[i] != '\0'; i++) - { - switch (param[i]) - { - case ',': - strcat(sb, ", "); - pa += 4; - break; - default: - strcat(sb, get_param(m68k, pa, param[i])); - break; - } - } - strcat(sb, ")"); - } - } - return sb; -} - -static const char * disassemble(m68000_base_device *m68k, offs_t pc, char* sb) -{ - UINT8 oprom[10]; - UINT8 opram[10]; - UINT32 options = 0; - - // remember bus error state - UINT32 tmp_buserror_occurred = m68k->mmu_tmp_buserror_occurred; - UINT32 tmp_buserror_address = m68k->mmu_tmp_buserror_address; - - m68k->mmu_tmp_buserror_occurred = 0; - m68k->mmu_tmp_rw = 1; - - int i; - for (i = 0; i < sizeof(oprom); i++) - { - oprom[i] = opram[i] = m68k->read8(pc + i); - if (m68k->mmu_tmp_buserror_occurred) - { - sprintf(sb, "- (apollo_disassemble failed at %08x)", pc + i); - - // restore previous bus error state - m68k->mmu_tmp_buserror_occurred = tmp_buserror_occurred; - m68k->mmu_tmp_buserror_address = tmp_buserror_address; - - return sb; - } - } - m68k->disassemble(sb, pc, oprom, opram, options); - - // restore previous bus error state - m68k->mmu_tmp_buserror_occurred = tmp_buserror_occurred; - m68k->mmu_tmp_buserror_address = tmp_buserror_address; - - return sb; -} - -static const UINT16 *get_data(m68000_base_device *m68k, offs_t addr) -{ - static UINT16 data[4]; - - // remember bus error state - UINT32 tmp_buserror_occurred = m68k->mmu_tmp_buserror_occurred; - UINT32 tmp_buserror_address = m68k->mmu_tmp_buserror_address; - - m68k->mmu_tmp_buserror_occurred = 0; - m68k->mmu_tmp_rw = 1; - - int i; - for (i = 0; i < sizeof(data); i += 2) - { - data[i/2] = m68k->read16(addr + i); - } - - // restore previous bus error state - m68k->mmu_tmp_buserror_occurred = tmp_buserror_occurred; - m68k->mmu_tmp_buserror_address = tmp_buserror_address; - - return data; -} - -//------------------------------------------------- -// instruction_hook - should be called by the CPU core -// before executing each instruction -//------------------------------------------------- - -int apollo_debug_instruction_hook(m68000_base_device *device, offs_t curpc) -{ - // trap data remembered for next rte - static struct { - UINT32 pc; - UINT32 sp; - UINT16 trap_no; - UINT16 trap_code; - } trap = { 0, 0, 0, 0 }; - - if (apollo_config( APOLLO_CONF_TRAP_TRACE | APOLLO_CONF_FPU_TRACE)) - { - UINT32 ppc_save; - UINT16 ir; - m68000_base_device *m68k = device; - m68k->mmu_tmp_buserror_occurred = 0; - - /* Read next instruction */ - ir = (m68k->pref_addr == REG_PC(m68k)) ? m68k->pref_data : m68k->readimm16(REG_PC(m68k)); - - // apollo_cpu_context expects the PC of current opcode in REG_PPC (not the previous PC) - ppc_save = REG_PPC(m68k); - REG_PPC(m68k) = REG_PC(m68k); - - if (m68k->mmu_tmp_buserror_occurred) - { - m68k->mmu_tmp_buserror_occurred = 0; - // give up - } - else if ((ir & 0xff00) == 0xf200 && (apollo_config( APOLLO_CONF_FPU_TRACE))) - { - char sb[256]; - LOG(("%s sp=%08x FPU: %x %s", apollo_cpu_context(device->machine().firstcpu), - REG_A(m68k)[7], ir, disassemble(m68k, REG_PC(m68k), sb))); - } - else if (!m68k->pmmu_enabled) - { - // skip - } - else if (ir == 0x4e73) // RTE - { - const UINT16 *data = get_data(m68k, REG_A(m68k)[7]); - if ( REG_USP(m68k) == 0 && (data[0] & 0x2000) == 0) { - LOG(("%s sp=%08x RTE: sr=%04x pc=%04x%04x v=%04x usp=%08x", - apollo_cpu_context(device->machine().firstcpu), - REG_A(m68k)[7], data[0], data[1], data[2], data[3], REG_USP(m68k))); - } - } - else if ((ir & 0xfff0) == 0x4e40 && (ir & 0x0f) <= 8 && apollo_config(APOLLO_CONF_TRAP_TRACE)) - { - // trap n - trap.pc = REG_PC(m68k); - trap.sp = REG_A(m68k)[7]; - trap.trap_no = ir & 0x0f; - trap.trap_code = REG_D(m68k)[0] & 0xffff; - - char sb[1000]; - LOG(("%s sp=%08x Domain/OS SVC: trap %x 0x%02x: %s", - apollo_cpu_context(device->machine().firstcpu), trap.sp, - trap.trap_no, trap.trap_code, - get_svc_call(m68k, trap.trap_no, trap.trap_code, sb))); - - } - else if (trap.pc == REG_PC(m68k) - 2 && trap.sp == REG_A(m68k)[7]) - { - // rte - char sb[1000]; - LOG(("%s sp=%08x Domain/OS SVC: %s D0=0x%x", - apollo_cpu_context(device->machine().firstcpu), trap.sp, - get_svc_call(m68k, trap.trap_no, trap.trap_code, sb), REG_D(m68k)[0])); - - trap.pc = 0; - trap.sp = 0; - trap.trap_no = 0; - trap.trap_code = 0; - } - // restore previous PC - REG_PPC(m68k) = ppc_save; - } - return 0; -} diff --git a/src/mess/machine/apollo_kbd.c b/src/mess/machine/apollo_kbd.c deleted file mode 100644 index 79fc99c1ad3..00000000000 --- a/src/mess/machine/apollo_kbd.c +++ /dev/null @@ -1,986 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Hans Ostermeyer -/* - * apollo_kbd.c - Apollo keyboard and mouse emulation - * - * Created on: Dec 27, 2010 - * Author: Hans Ostermeyer - * - * see also http://www.bitsavers.org/pdf/apollo/008778-03_DOMAIN_Series_3000_4000_Technical_Reference_Aug87.pdf - * - */ - -#define VERBOSE 0 - -#include "machine/apollo_kbd.h" -#include "sound/beep.h" - -#define LOG(x) { logerror ("%s apollo_kbd: ", m_device->cpu_context()); logerror x; logerror ("\n"); } -#define LOG1(x) { if (VERBOSE > 0) LOG(x)} -#define LOG2(x) { if (VERBOSE > 1) LOG(x)} - -#define MAP_APOLLO_KEYS 1 - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -//const device_type APOLLO_KBD = apollo_kbd_device_config::static_alloc_device_config; - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -#define KBD_MODE_0_COMPATIBILITY 0 -#define KBD_MODE_1_KEYSTATE 1 -#define KBD_MODE_2_RELATIVE_CURSOR_CONTROL 2 -#define KBD_MODE_3_ABSOLUTE_CURSOR_CONTROL 3 - -#define CODE_TABLE_DOWN_CODE 0 -#define CODE_TABLE_UP_CODE 1 -#define CODE_TABLE_UNSHIFTED_CODE 2 -#define CODE_TABLE_SHIFTED_CODE 3 -#define CODE_TABLE_CONTROL_CODE 4 -#define CODE_TABLE_CAPS_LOCK_CODE 5 -#define CODE_TABLE_UP_TRANS_CODE 6 -#define CODE_TABLE_AUTO_REPEAT_CODE 7 -#define CODE_TABLE_ENTRY_SIZE 8 - -#define NOP 0 -#define No 0 -#define Yes 1 - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -// device type definition -const device_type APOLLO_KBD = &device_creator; - -//------------------------------------------------- -// apollo_kbd_device - constructor -//------------------------------------------------- - -apollo_kbd_device::apollo_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, APOLLO_KBD, "Apollo Keyboard", tag, owner, clock, "apollo_kbd", __FILE__), - device_serial_interface(mconfig, *this), - m_tx_w(*this), - m_german_r(*this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void apollo_kbd_device::device_start() -{ - m_device = this; - LOG1(("start apollo_kbd")); - - m_tx_w.resolve_safe(); - m_german_r.resolve_safe(0); - - m_beeper.start(this); - m_mouse.start(this); - - m_io_keyboard1 = machine().root_device().ioport("keyboard1"); - m_io_keyboard2 = machine().root_device().ioport("keyboard2"); - m_io_keyboard3 = machine().root_device().ioport("keyboard3"); - m_io_keyboard4 = machine().root_device().ioport("keyboard4"); - m_io_mouse1 = machine().root_device().ioport("mouse1"); - m_io_mouse2 = machine().root_device().ioport("mouse2"); - m_io_mouse3 = machine().root_device().ioport("mouse3"); - - m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_kbd_device::kbd_scan_timer), this)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void apollo_kbd_device::device_reset() -{ - LOG1(("reset apollo_kbd")); - - m_beeper.reset(); - m_mouse.reset(); - - // init keyboard - m_loopback_mode = 1; - m_mode = KBD_MODE_0_COMPATIBILITY; - m_delay = 500; - m_repeat = 33; - m_last_pressed = 0; - memset(m_keytime, 0, sizeof(m_keytime)); - memset(m_keyon, 0, sizeof(m_keyon)); - - // start timer - m_timer->adjust( attotime::zero, 0, attotime::from_msec(5)); // every 5ms - - // keyboard comms is at 8E1, 1200 baud - set_data_frame(1, 8, PARITY_EVEN, STOP_BITS_1); - set_rcv_rate(1200); - set_tra_rate(1200); - - m_tx_busy = false; - m_xmit_read = m_xmit_write = 0; -} - -void apollo_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - device_serial_interface::device_timer(timer, id, param, ptr); -} - -/*************************************************************************** - cpu_context - return a string describing the current CPU context - ***************************************************************************/ - -const char *apollo_kbd_device::cpu_context() -{ - static char statebuf[64]; /* string buffer containing state description */ - - device_t *cpu = machine().firstcpu; - osd_ticks_t t = osd_ticks(); - int s = t / osd_ticks_per_second(); - int ms = (t % osd_ticks_per_second()) / 1000; - - /* if we have an executing CPU, output data */ - if (cpu != NULL) - { - sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(), - cpu->safe_pcbase(), tag()); - } - else - { - sprintf(statebuf, "%d.%03d", s, ms); - } - return statebuf; -} - -//************************************************************************** -// Beeper -//************************************************************************** - -apollo_kbd_device::beeper::beeper() : - m_device(NULL), - m_beeper(NULL), - m_timer(NULL) -{ -} - -void apollo_kbd_device::beeper::start(apollo_kbd_device *device) -{ - m_device = device; - LOG2(("start apollo_kbd::beeper")); - m_beeper = m_device->machine().device("beep"); - m_timer = m_device->machine().scheduler().timer_alloc(FUNC(static_beeper_callback), this); -} - -void apollo_kbd_device::beeper::reset() -{ - LOG2(("reset apollo_kbd::beeper")); - on(); -} - -void apollo_kbd_device::beeper::off() -{ - m_beeper->set_state(0); -} - -void apollo_kbd_device::beeper::on() -{ - if (keyboard_has_beeper()) - { - m_beeper->set_frequency(1000); - m_beeper->set_state(1); - m_timer->adjust( attotime::from_msec(10), 0, attotime::zero); - } -} - -int apollo_kbd_device::beeper::keyboard_has_beeper() -{ - return true; // driver has no facility to return false here, so go with it -} - -void apollo_kbd_device::beeper::beeper_callback() -{ - off(); -} - -TIMER_CALLBACK( apollo_kbd_device::beeper::static_beeper_callback ) -{ - reinterpret_cast(ptr)->beeper_callback(); -} - -//************************************************************************** -// Mouse -//************************************************************************** - -apollo_kbd_device::mouse::mouse() : - m_device(NULL) -{ -} - -void apollo_kbd_device::mouse::start(apollo_kbd_device *device) -{ - m_device = device; - LOG2(("start apollo_kbd::mouse")); -} - -void apollo_kbd_device::mouse::reset() -{ - LOG2(("reset apollo_kbd::mouse")); - - m_last_b = -1; - m_last_x = 0; - m_last_y = 0; - m_tx_pending = 0; -} - -void apollo_kbd_device::mouse::read_mouse() -{ - if (m_tx_pending > 0) - { - m_tx_pending -= 5; // we will be called every 5ms - } - else - { - int b = m_device->m_io_mouse1->read(); - int x = m_device->m_io_mouse2->read(); - int y = m_device->m_io_mouse3->read(); - - /* sign extend values < 0 */ - if (x & 0x80) - x |= 0xffffff00; - if (y & 0x80) - y |= 0xffffff00; - y = -y; - - if (m_last_b < 0) - { - m_last_b = b; - m_last_x = x; - m_last_y = y; - } - else if (b != m_last_b || x != m_last_x || y != m_last_y) - { - UINT8 mouse_data[4]; - int mouse_data_size; - - int dx = x - m_last_x; - int dy = y - m_last_y; - - LOG2(("read_mouse: b=%02x x=%d y=%d dx=%d dy=%d", b, x, y, dx, dy)); - - if (m_device->m_mode == KBD_MODE_0_COMPATIBILITY) - { - mouse_data[0] = 0xdf; - mouse_data[1] = 0xf0 ^ b; - mouse_data[2] = dx; - mouse_data[3] = dy; - mouse_data_size = 4; - } - else - { - if (m_device->m_mode != KBD_MODE_2_RELATIVE_CURSOR_CONTROL) - { - m_device->set_mode(KBD_MODE_2_RELATIVE_CURSOR_CONTROL); - } - - mouse_data[0] = 0xf0 ^ b; - mouse_data[1] = dx; - mouse_data[2] = dy; - mouse_data_size = 3; - } - - for (int md = 0; md < mouse_data_size; md++) - { - m_device->xmit_char(mouse_data[md]); - } - - // mouse data submitted; update current mouse state - m_last_b = b; - m_last_x += dx; - m_last_y += dy; - m_tx_pending = 100; // mouse data packet will take 40 ms - } - } -} - -/*------------------------------------------------- - keyboard_is_german - check for german keyboard - -------------------------------------------------*/ - -int apollo_kbd_device::keyboard_is_german() -{ - return (m_german_r() == ASSERT_LINE) ? true : false; -} - -void apollo_kbd_device::set_mode(UINT16 mode) -{ - xmit_char(0xff); - xmit_char(mode); - m_mode = mode; -} - -void apollo_kbd_device::tra_complete() // Tx completed sending byte -{ - // is there more waiting to send? - if (m_xmit_read != m_xmit_write) - { - transmit_register_setup(m_xmitring[m_xmit_read++]); - if (m_xmit_read >= XMIT_RING_SIZE) - { - m_xmit_read = 0; - } - } - else - { - m_tx_busy = false; - } -} - -void apollo_kbd_device::rcv_complete() // Rx completed receiving byte -{ - receive_register_extract(); - UINT8 data = get_received_char(); - - kgetchar(data); -} - -void apollo_kbd_device::tra_callback() // Tx send bit -{ - int bit = transmit_register_get_data_bit(); - m_tx_w(bit); -} - -void apollo_kbd_device::input_callback(UINT8 state) -{ -} - -void apollo_kbd_device::xmit_char(UINT8 data) -{ - // if tx is busy it'll pick this up automatically when it completes - if (!m_tx_busy) - { - m_tx_busy = true; - transmit_register_setup(data); - } - else - { - // tx is busy, it'll pick this up next time - m_xmitring[m_xmit_write++] = data; - if (m_xmit_write >= XMIT_RING_SIZE) - { - m_xmit_write = 0; - } - } -} - -/*------------------------------------------------- - putdata - put keyboard data to sio - -------------------------------------------------*/ - -void apollo_kbd_device::putdata(const UINT8 *data, int data_length) -{ - // send data only if no real Apollo keyboard has been connected - if (m_mode > KBD_MODE_1_KEYSTATE) - { - set_mode(KBD_MODE_1_KEYSTATE); - } - - for (int i = 0; i < data_length; i++) - { - xmit_char(data[i]); - } -} - -/*------------------------------------------------- - putstring - put keyboard string to sio - -------------------------------------------------*/ - -void apollo_kbd_device::putstring(const char *data) -{ - putdata((UINT8 *) data, strlen(data)); -} - -void apollo_kbd_device::kgetchar(UINT8 data) -{ - static const UINT8 ff1116_data[] = { 0x00, 0xff, 0x00 }; - - LOG1(("getchar <- %02x", data)); - - if (data == 0xff) - { - m_rx_message = data; - putdata(&data, 1); - m_loopback_mode = 1; - } - else if (data == 0x00) - { - if (m_loopback_mode) - { - set_mode(KBD_MODE_0_COMPATIBILITY); - m_loopback_mode = 0; - } - } - else - { - m_rx_message = m_rx_message << 8 | data; - - switch (m_rx_message) - { - case 0xff00: - putdata(&data, 1); - m_mode = KBD_MODE_0_COMPATIBILITY; - m_loopback_mode = 0; - m_rx_message = 0; - case 0xff01: - putdata(&data, 1); - m_mode = KBD_MODE_1_KEYSTATE; - m_rx_message = 0; - break; - case 0xff11: - putdata(&data, 1); - break; - case 0xff1116: - putdata(ff1116_data, sizeof(ff1116_data)); - m_loopback_mode = 0; - m_rx_message = 0; - break; - case 0xff1117: - m_rx_message = 0; - break; - case 0xff12: - putdata(&data, 1); - break; - case 0xff1221: // receive ID message - m_loopback_mode = 0; - putdata(&data, 1); - if (keyboard_is_german()) - { - putstring("3-A\r2-0\rSD-03863-MS\r"); - } - else - { - putstring("3-@\r2-0\rSD-03863-MS\r"); - } - - if (m_mode == KBD_MODE_0_COMPATIBILITY) - { - set_mode(KBD_MODE_0_COMPATIBILITY); - } - else - { - set_mode(KBD_MODE_1_KEYSTATE); - } - m_rx_message = 0; - break; - case 0xff2181: // beeper on (for 300 ms) - putdata(&data, 1); - m_rx_message = 0; - m_beeper.on(); - break; - case 0xff2182: // beeper off - putdata(&data, 1); - m_rx_message = 0; - m_beeper.off(); - break; - default: - if (m_loopback_mode && data != 0) - { - putdata(&data, 1); - } - break; - } - } -} - -int apollo_kbd_device::push_scancode(UINT8 code, UINT8 repeat) -{ - int n_chars = 0; - UINT16 key_code = 0; - UINT8 caps = BIT(machine().root_device().ioport("keyboard4")->read(),0); - UINT8 shift = BIT(machine().root_device().ioport("keyboard4")->read(),1) | BIT(machine().root_device().ioport("keyboard4")->read(),5); - UINT8 ctrl = BIT(machine().root_device().ioport("keyboard4")->read(),2); - UINT8 numlock = BIT(machine().root_device().ioport("keyboard4")->read(),6); - UINT16 index; - - if (keyboard_is_german()) - { - // map special keys for German keyboard - switch (code) - { - case 0x00: code = 0x68; break; // _ - case 0x0e: code = 0x6b; break; // # - case 0x29: code = 0x69; break; // <> - case 0x42: code = 0x6f; break; // NP- - case 0x46: code = 0x6e; break; // NP+ - case 0x4e: code = 0x73; break; // NP ENTER - } - } - -#if MAP_APOLLO_KEYS - if (numlock) - { - // don't map function keys to Apollo left keypad - switch (code) - { - case 0x52: code = 0x75; break; // F1 - case 0x53: code = 0x76; break; // F2 - case 0x54: code = 0x77; break; // F3 - case 0x55: code = 0x78; break; // F4 - case 0x56: code = 0x79; break; // F5 - case 0x57: code = 0x7a; break; // F6 - case 0x58: code = 0x7b; break; // F7 - case 0x59: code = 0x7c; break; // F8 - case 0x5a: code = 0x7d; break; // F9 - case 0x5b: code = 0x74; break; // F0 = F10 - } - } -#endif - - index = (code & 0x7f) * CODE_TABLE_ENTRY_SIZE; - if (m_mode == KBD_MODE_0_COMPATIBILITY) - { - if (code & 0x80) - { - // skip up code in ASCII mode - } - else if (repeat > 0 - && m_code_table[index + CODE_TABLE_AUTO_REPEAT_CODE] != Yes) - { - // skip repeat in ASCII mode - } - else if (ctrl) - { - key_code = m_code_table[index + CODE_TABLE_CONTROL_CODE]; - } - else if (shift) - { - key_code = m_code_table[index + CODE_TABLE_SHIFTED_CODE]; - } - else if (caps) - { - key_code = m_code_table[index + CODE_TABLE_CAPS_LOCK_CODE]; - } - else - { - key_code = m_code_table[index + CODE_TABLE_UNSHIFTED_CODE]; - } - } - else - { - if (repeat > 0) - { - if (repeat == 1) - { - // auto repeat (but only for first scanned key) - key_code = 0x7f; - } - } - else if (code & 0x80) - { - key_code = m_code_table[index + CODE_TABLE_UP_CODE]; - } - else - { - key_code = m_code_table[index + CODE_TABLE_DOWN_CODE]; - } - } - - if (key_code != 0) - { - LOG2(("scan_code = 0x%02x key_code = 0x%04x",code, key_code)); - if (m_mode > KBD_MODE_1_KEYSTATE) - { - set_mode(KBD_MODE_1_KEYSTATE); - } - - if (key_code & 0xff00) - { - xmit_char(key_code >> 8); - n_chars++; - } - xmit_char(key_code & 0xff); - n_chars++; - } - return n_chars; -} - -void apollo_kbd_device::scan_keyboard() -{ - int x; - int repeat = 0; - - static const char * const keynames[] = { "keyboard1", "keyboard2", "keyboard3", "keyboard4" }; - - for (x = 0; x < 0x80; x++) - { - if (!(machine().root_device().ioport(keynames[x / 32])->read() & (1 << (x % 32)))) - { - // no key pressed - if (m_keyon[x] != 0) - { - // a key has been released - push_scancode(0x80 + x, 0); - m_keytime[x] = 0; - m_keyon[x] = 0; - m_last_pressed = 0; - LOG2(("released key 0x%02x at time %d",x, m_keytime[x])); - } - } - else if (m_keyon[x] == 0) - { - // a key has been pressed - if (push_scancode(x, 0) > 0) - { - m_keytime[x] = m_mode == KBD_MODE_0_COMPATIBILITY ? m_delay : m_repeat; - m_keyon[x] = 1; - m_last_pressed = x; - LOG2(("pushed key 0x%02x at time %d",x, m_keytime[x])); - } - } - else if (m_last_pressed == x) - { - // a key is being held; adjust delay/repeat timers - m_keytime[x] -= 5; - if (m_keytime[x] <= 0) - { - push_scancode(x, ++repeat); - m_keytime[x] = m_repeat; - } - LOG2(("holding key 0x%02x at time %d",x, m_keytime[x])); - } - } -} - -TIMER_CALLBACK_MEMBER(apollo_kbd_device::kbd_scan_timer) -{ - scan_keyboard(); - - // Note: we omit extra traffic while keyboard is in Compatibility mode - if (m_device->m_mode != KBD_MODE_0_COMPATIBILITY) - { - m_mouse.read_mouse(); - } -} - -UINT16 apollo_kbd_device::m_code_table[] = { - /* Key | Keycap | Down | Up |Unshifted|Shifted|Control|Caps Lock|Up Trans|Auto */ - /* Number| Legend | Code | Code|Code | Code | Code |Code | Code |Repeat*/ - - /* B14 ~ ' / ESC */ 0x24, 0xA4, 0x60, 0x7E, 0x1E, 0x60, NOP, No, - /* B1 ESC */ 0x17, 0x97, 0x1B, 0x1B, NOP, 0x1B, NOP, No, - /* B2 ! 1 */ 0x18, 0x98, 0x31, 0x21, NOP, 0x31, NOP, No, - /* B3 @ 2 */ 0x19, 0x99, 0x32, 0x40, NOP, 0x32, NOP, No, - /* B4 # 3 */ 0x1A, 0x9A, 0x33, 0x23, NOP, 0x33, NOP, No, - /* B5 $ 4 */ 0x1B, 0x9B, 0x34, 0x24, NOP, 0x34, NOP, No, - /* B6 % 5 */ 0x1C, 0x9C, 0x35, 0x25, NOP, 0x35, NOP, No, - /* B7 ^ 6 */ 0x1D, 0x9D, 0x36, 0x5E, NOP, 0x36, NOP, No, - /* B8 & 7 */ 0x1E, 0x9E, 0x37, 0x26, NOP, 0x37, NOP, No, - /* B9 * 8 */ 0x1F, 0x9F, 0x38, 0x2A, NOP, 0x38, NOP, No, - /* B10 ( 9 */ 0x20, 0xA0, 0x39, 0x28, NOP, 0x39, NOP, No, - /* B11 ) 0 */ 0x21, 0xA1, 0x30, 0x29, NOP, 0x30, NOP, No, - /* B12 _ - */ 0x22, 0xA2, 0x2D, 0x5F, NOP, 0x2D, NOP, Yes, - /* B13 + = */ 0x23, 0xA3, 0x3D, 0x2B, NOP, 0x3D, NOP, Yes, - /* B14 ~ ' / BS */ 0x24, 0xA4, 0x60, 0x7E, 0x1E, 0x60, NOP, No, - /* B15 BACKSPACE */ 0x25, 0xA5, 0xDE, 0xDE, NOP, 0xDE, NOP, Yes, - - /* C1 TAB */ 0x2C, 0xAC, 0xCA, 0xDA, 0xFA, 0xCA, NOP, No, - /* C2 Q */ 0x2D, 0xAD, 0x71, 0x51, 0x11, 0x51, NOP, No, - /* C3 W */ 0x2E, 0xAE, 0x77, 0x57, 0x17, 0x57, NOP, No, - /* C4 E */ 0x2F, 0xAF, 0x65, 0x45, 0x05, 0x45, NOP, No, - /* C5 R */ 0x30, 0xB0, 0x72, 0x52, 0x12, 0x52, NOP, No, - /* C6 T */ 0x31, 0xB1, 0x74, 0x54, 0x14, 0x54, NOP, No, - /* C7 V */ 0x32, 0xB2, 0x79, 0x59, 0x19, 0x59, NOP, No, - /* C8 U */ 0x33, 0xB3, 0x75, 0x55, 0x15, 0x55, NOP, No, - /* C9 I */ 0x34, 0xB4, 0x69, 0x49, 0x09, 0x49, NOP, No, - /* C10 O */ 0x35, 0xB5, 0x6F, 0x4F, 0x0F, 0x4F, NOP, No, - /* C11 P */ 0x36, 0xB6, 0x70, 0x50, 0x10, 0x50, NOP, No, - /* C12 { [ / Ue */ 0x37, 0xB7, 0x7B, 0x5B, 0x1B, 0x7B, NOP, No, - /* C13 } ] / Oe */ 0x38, 0xB8, 0x7D, 0x5D, 0x1D, 0x7D, NOP, No, - /* D13 RETURN */ 0x52, 0xD2, 0xCB, 0xDB, NOP, 0xCB, NOP, No, - - /* D2 A */ 0x46, 0xC6, 0x61, 0x41, 0x01, 0x41, NOP, No, - /* D3 S */ 0x47, 0xC7, 0x73, 0x53, 0x13, 0x53, NOP, No, - /* D4 D */ 0x48, 0xC8, 0x64, 0x44, 0x04, 0x44, NOP, No, - /* D5 F */ 0x49, 0xC9, 0x66, 0x46, 0x06, 0x46, NOP, No, - /* D6 G */ 0x4A, 0xCA, 0x67, 0x47, 0x07, 0x47, NOP, No, - /* D7 H */ 0x4B, 0xCB, 0x68, 0x48, 0x08, 0x48, NOP, No, - /* D8 J */ 0x4C, 0xCC, 0x6A, 0x4A, 0x0A, 0x4A, NOP, No, - /* D9 K */ 0x4D, 0xCD, 0x6B, 0x4B, 0x0B, 0x4B, NOP, No, - /* D10 L */ 0x4E, 0xCE, 0x6C, 0x4C, 0x0C, 0x4C, NOP, No, - /* D11 : ; */ 0x4F, 0xCF, 0x3B, 0x3A, 0xFB, 0x3B, NOP, No, - /* D12 " ' / Ae */ 0x50, 0xD0, 0x27, 0x22, 0xF8, 0x27, NOP, No, - /* D14 ! \ */ 0x53, 0xD3, 0xC8, 0xC9, NOP, 0xC8, NOP, No, - - /* E2 Z */ 0x60, 0xE0, 0x7A, 0x5A, 0x1A, 0x5A, NOP, No, - /* E3 X */ 0x61, 0xE1, 0x78, 0x58, 0x18, 0x58, NOP, No, - /* E4 C */ 0x62, 0xE2, 0x63, 0x43, 0x03, 0x43, NOP, No, - /* E5 V */ 0x63, 0xE3, 0x76, 0x56, 0x16, 0x56, NOP, No, - /* E6 8 */ 0x64, 0xE4, 0x62, 0x42, 0x02, 0x42, NOP, No, - /* E7 N */ 0x65, 0xE5, 0x6E, 0x4E, 0x0E, 0x4E, NOP, No, - /* E8 M */ 0x66, 0xE6, 0x6D, 0x4D, 0x0D, 0x4D, NOP, No, - /* E9 < , */ 0x67, 0xE7, 0x2C, 0x3C, NOP, 0x2C, NOP, No, - /* E10 > . */ 0x68, 0xE8, 0x2E, 0x3E, NOP, 0x2E, NOP, Yes, - /* E11 ? / */ 0x69, 0xE9, 0xCC, 0xDC, 0xFC, 0xCC, NOP, No, - -// /* B14 ~ ' */ 0x24, 0xA4, 0x60, 0x7E, 0x1E, 0x60, NOP, No, - /* _ */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, - /* F1 (space bar) */ 0x76, 0xF6, 0x20, 0x20, 0x20, 0x20, NOP, Yes, - /* LC0 Home */ 0x27, 0xA7, 0x84, 0x94, 0x84, 0x84, 0xA4, No, -#if !MAP_APOLLO_KEYS - /* C14 DELETE */ 0x3A, 0xBA, 0x7F, 0x7F, NOP, 0x7F, NOP, Yes, -#else - /* E13 POP */ 0x6C, 0xEC, 0x80, 0x90, 0x80, 0x80, 0xA0, No, -#endif - /* LF0 Roll Up */ 0x72, 0xF2, 0x8D, 0x9D, 0x8D, 0x8D, 0xAD, No, - /* LF2 Roll Down */ 0x74, 0xF4, 0x8F, 0x9F, 0x8F, 0x8F, 0xAF, No, - /* LC2 End */ 0x29, 0xA9, 0x86, 0x96, 0x86, 0x86, 0xA6, No, - /* LE0 Cursor left */ 0x59, 0xD9, 0x8A, 0x9A, 0x9A, 0x9A, 0xAA, Yes, - /* LD1 Cursor Up */ 0x41, 0xC1, 0x88, 0x98, 0x88, 0x88, 0xA8, Yes, - /* LE2 Cursor right*/ 0x5B, 0xDB, 0x8C, 0x9C, 0x8C, 0xBE, 0xAC, Yes, - /* LF1 Cursor down */ 0x73, 0xF3, 0x8E, 0x9E, 0x8E, 0x8E, 0xAE, Yes, - -#if !MAP_APOLLO_KEYS - /* Numpad CLR */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, - /* Numpad / */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, - /* Numpad * */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, - /* RD4 - */ 0x58, 0xD8, 0xFE2D, 0xFE5F, NOP, 0xFE2D, NOP, No, - /* RC1 7 */ 0x3C, 0xBC, 0xFE37, 0xFE26, NOP, 0xFE37, NOP, No, - /* RC2 8 */ 0x3D, 0xBD, 0xFE38, 0xFE2A, NOP, 0xFE38, NOP, No, - /* RC3 9 */ 0x3E, 0xBE, 0xFE39, 0xFE28, NOP, 0xFE39, NOP, No, - /* RC4 + */ 0x3F, 0xBF, 0xFE2B, 0xFE3D, NOP, 0xFE2B, NOP, No, - /* RD1 4 */ 0x55, 0xD5, 0xFE34, 0xFE24, NOP, 0xFE34, NOP, No, - /* RD2 5 */ 0x56, 0xD6, 0xFE35, 0xFE25, NOP, 0xFE35, NOP, No, - /* RD3 6 */ 0x57, 0xD7, 0xFE36, 0xFE5E, NOP, 0xFE36, NOP, No, - /* Numpad = */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, - /* RE1 1 */ 0x6E, 0xEE, 0xFE31, 0xFE21, NOP, 0xFE31, NOP, No, - /* RE2 2 */ 0x6F, 0xEF, 0xFE32, 0xFE40, NOP, 0xFE32, NOP, No, - /* RE3 3 */ 0x70, 0xF0, 0xFE33, 0xFE23, NOP, 0xFE33, NOP, No, - /* RF3 ENTER */ 0x7C, 0xFC, 0xFECB, 0xFEDB, NOP, 0xFECB, NOP, No, - /* RF1 0 */ 0x79, 0xF9, 0xFE30, 0xFE29, NOP, 0xFE30, NOP, No, - /* Numpad , */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, - /* RF2 . */ 0x7B, 0xFB, 0xFE2E, 0xFE2E, NOP, 0xFE2E, NOP, No, - /* A0 F0 */ 0x04, 0x84, 0x1C, 0x5C, 0x7C, 0x1C, 0xBC, No, - /* A1 F1 */ 0x05, 0x85, 0xC0, 0xD0, 0xF0, 0xC0, 0xE0, No, - /* A2 F2 */ 0x06, 0x86, 0xC1, 0x01, 0xF1, 0xC1, 0xE1, No, - /* A3 F3 */ 0x07, 0x87, 0xC2, 0x02, 0xF2, 0xC2, 0xE2, No, - /* A4 F4 */ 0x08, 0x88, 0xC3, 0x03, 0xF3, 0xC3, 0xE3, No, - /* A5 F5 */ 0x09, 0x89, 0xC4, 0x04, 0xF4, 0xC4, 0xE4, No, - /* A6 F6 */ 0x0A, 0x8A, 0xC5, 0x05, 0xF5, 0xC5, 0xE5, No, - /* A7 F7 */ 0x0B, 0x8B, 0xC6, 0x06, 0xF6, 0xC6, 0xE6, No, - /* A8 F8 */ 0x0C, 0x8C, 0xC7, 0x07, 0xF7, 0xC7, 0xE7, No, - /* A9 F9 */ 0x0D, 0x8D, 0x1F, 0x2F, 0x3F, 0x1F, 0xBD, No, -#else - /* E13 POP */ 0x6C, 0xEC, 0x80, 0x90, 0x80, 0x80, 0xA0, No, - /* LDO [<-] */ 0x40, 0xC0, 0x87, 0x97, 0x87, 0x87, 0xA7, No, - /* LD2 [->] */ 0x42, 0xC2, 0x89, 0x99, 0x89, 0x89, 0xA9, No, - /* RD4 Numpad - */ 0x58, 0xD8, 0xFE2D, 0xFE5F, NOP, 0xFE2D, NOP, No, - /* LC0 7 Home */ 0x27, 0xA7, 0x84, 0x94, 0x84, 0x84, 0xA4, No, - /* LD1 8 Cursor Up */ 0x41, 0xC1, 0x88, 0x98, 0x88, 0x88, 0xA8, Yes, - /* LF0 9 Roll Up */ 0x72, 0xF2, 0x8D, 0x9D, 0x8D, 0x8D, 0xAD, No, - /* RC4 Numpad + */ 0x3F, 0xBF, 0xFE2B, 0xFE3D, NOP, 0xFE2B, NOP, No, - /* LE0 4 Cursor left */ 0x59, 0xD9, 0x8A, 0x9A, 0x9A, 0x9A, 0xAA, Yes, - /* LE1 NEXT WINDOW */ 0x5A, 0xDA, 0x8B, 0x9B, 0x8B, 0x8B, 0xAB, No, - /* LE2 6 Cursor right*/ 0x5B, 0xDB, 0x8C, 0x9C, 0x8C, 0xBE, 0xAC, Yes, - /* Numpad = */ 0x7C, 0xFC, 0xFEC8, 0xFED8, NOP, 0xFECB, NOP, No, - /* LC2 1 End */ 0x29, 0xA9, 0x86, 0x96, 0x86, 0x86, 0xA6, No, - /* LF1 2 Cursor down */ 0x73, 0xF3, 0x8E, 0x9E, 0x8E, 0x8E, 0xAE, Yes, - /* LF2 3 Roll Down */ 0x74, 0xF4, 0x8F, 0x9F, 0x8F, 0x8F, 0xAF, No, - /* RF3 ENTER */ 0x7C, 0xFC, 0xFECB, 0xFEDB, NOP, 0xFECB, NOP, No, - /* LE1 NEXT WINDOW */ 0x5A, 0xDA, 0x8B, 0x9B, 0x8B, 0x8B, 0xAB, No, - /* Numpad , */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, - /* E13 POP */ 0x6C, 0xEC, 0x80, 0x90, 0x80, 0x80, 0xA0, No, - - /* LC1 F1/SHELL/CMD */ 0x28, 0xA8, 0x85, 0x95, 0x85, 0x85, 0xA5, No, - /* LB0 F2/CUT/COPY */ 0x13, 0x93, 0xB0, 0xB4, 0xB0, 0xB0, 0xB8, No, - /* LB1 F3/UNDO/PASTE */ 0x14, 0x94, 0xB1, 0xB5, 0xB1, 0xB1, 0xB9, No, - /* LB2 F4/MOVE/GROW */ 0x15, 0x95, 0xB2, 0xB6, 0xB2, 0xB2, 0xBA, No, - - /* LAO F5/INS/MARK */ 0x01, 0x81, 0x81, 0x91, 0x81, 0x81, 0xA1, No, - /* LA1 F6/LINE DEL */ 0x02, 0x82, 0x82, 0x92, 0x82, 0x82, 0xA2, No, - /* LA2 F7/CHAR DEL */ 0x03, 0x83, 0x83, 0x93, 0x83, 0x83, 0xA3, Yes, - /* RA0 F8/AGAIN */ 0x0E, 0x8E, 0xCD, 0xE9, 0xCD, 0xCD, 0xED, No, - - /* RA1 F9/READ */ 0x0F, 0x8F, 0xCE, 0xEA, 0xCE, 0xCE, 0xEE, No, - /* RA2 F10/SAVE/EDIT */ 0x10, 0x90, 0xCF, 0xEB, 0xCF, 0xCF, 0xEF, No, -#endif - /* RA3 F11/ABORT/EXIT */ 0x11, 0x91, 0xDD, 0xEC, 0xD0, 0xD0, 0xFD, No, - /* RA4 F12/HELP/HOLD */ 0x12, 0x92, 0xB3, 0xB7, 0xB3, 0xB3, 0xBB, No, - - /* LE1 NEXT WINDOW */ 0x5A, 0xDA, 0x8B, 0x9B, 0x8B, 0x8B, 0xAB, No, - /* LE1 NEXT WINDOW */ 0x5A, 0xDA, 0x8B, 0x9B, 0x8B, 0x8B, 0xAB, No, - - /* D1 CAPS LOCK */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, - /* E1 SHIFT */ 0x5E, 0xDE, NOP, NOP, NOP, NOP, NOP, NOP, - /* DO CTRL */ 0x43, 0xC3, NOP, NOP, NOP, NOP, NOP, NOP, -// FIXME: ALT swapped! - /* ?? ALT_R */ 0x77, 0xF7, 0xfe00, NOP, NOP, NOP, 0xfe01, No, - /* ?? ALT_L */ 0x75, 0xF5, 0xfe02, NOP, NOP, NOP, 0xfe03, No, - /* E12 SHIFT */ 0x6A, 0xEA, NOP, NOP, NOP, NOP, NOP, NOP, -// not yet used: - /* E0 REPEAT */ 0x5D, 0xDD, NOP, NOP, NOP, NOP, NOP, NOP, - /* CAPS LOCK LED*/ 0x7E, 0xFE, NOP, NOP, NOP, NOP, NOP, NOP, -// german kbd: - /* 0x68 B1_DE _ */ 0x17, 0x97, 0x60, 0x7E, 0x1E, 0x60, NOP, No, - /* 0x69 E1a_DE <> */ 0x5F, 0xDF, 0xBE, 0xBE, NOP, 0xBE, NOP, No, - /* 0x6a B14_DE ESC */ 0x16, 0x96, 0x1B, 0x1B, NOP, 0x1B, NOP, No, - /* 0x6b D14_DE # \ */ 0x51, 0xD1, 0xC8, 0xC9, NOP, 0xC8, NOP, No, - - /* 0x6c NPG NP ( */ 0x3F, 0xBF, 0xFE28, 0xFE0E, NOP, 0xFE28, NOP, No, - /* 0x6d NPF NP ) */ 0x58, 0xD8, 0xFE29, 0xFE0F, NOP, 0xFE29, NOP, No, - /* 0x6e NPD NP + */ 0x3B, 0xBB, 0xFE2B, 0xFE26, NOP, 0xFE2B, NOP, No, - /* 0x6f NPC NP - */ 0x54, 0xD4, 0xFE2D, 0xFE7E, NOP, 0xFE2D, NOP, No, - /* 0x70 NPB NP * */ 0x6D, 0xED, 0xFE2A, 0xFE21, NOP, 0xFE2A, NOP, No, - /* 0x71 NPA NP / */ 0x78, 0xF8, 0xFECC, 0xFEC8, NOP, 0xFECC, NOP, No, - /* 0x72 NPP NP . */ 0x7B, 0xFB, 0xFE2E, 0xFE2C, NOP, 0xFE2E, NOP, No, - /* 0x73 NPE ENTER */ 0x7C, 0xFC, 0xFECB, 0xFE3D, NOP, 0xFECB, NOP, No, - - /* 0x74 A0 F0 */ 0x04, 0x84, 0x1C, 0x5C, 0x7C, 0x1C, 0xBC, No, - /* 0x75 A1 F1 */ 0x05, 0x85, 0xC0, 0xD0, 0xF0, 0xC0, 0xE0, No, - /* 0x76 A2 F2 */ 0x06, 0x86, 0xC1, 0x01, 0xF1, 0xC1, 0xE1, No, - /* 0x77 A3 F3 */ 0x07, 0x87, 0xC2, 0x02, 0xF2, 0xC2, 0xE2, No, - /* 0x78 A4 F4 */ 0x08, 0x88, 0xC3, 0x03, 0xF3, 0xC3, 0xE3, No, - /* 0x79 A5 F5 */ 0x09, 0x89, 0xC4, 0x04, 0xF4, 0xC4, 0xE4, No, - /* 0x7a A6 F6 */ 0x0A, 0x8A, 0xC5, 0x05, 0xF5, 0xC5, 0xE5, No, - /* 0x7b A7 F7 */ 0x0B, 0x8B, 0xC6, 0x06, 0xF6, 0xC6, 0xE6, No, - /* 0x7c A8 F8 */ 0x0C, 0x8C, 0xC7, 0x07, 0xF7, 0xC7, 0xE7, No, - /* 0x7d A9 F9 */ 0x0D, 0x8D, 0x1F, 0x2F, 0x3F, 0x1F, 0xBD, No, - - /* Key | Keycap | Down | Up |Unshifted|Shifted|Control|Caps Lock|Up Trans|Auto */ - /* Number| Legend | Code | Code|Code | Code | Code |Code | Code |Repeat*/ -}; - -INPUT_PORTS_START( apollo_kbd ) - - PORT_START( "keyboard1" ) - PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("~ '") PORT_CODE(KEYCODE_TILDE) /* ESC */ - PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) /* ESC */ - PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) /* 1 ! */ - PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) /* 2 " */ - PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) /* 3 # */ - PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) /* 4 $ */ - PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) /* 5 % */ - PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) /* 6 & */ - PORT_BIT( 0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) /* 7 ' */ - PORT_BIT( 0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) /* 8 ( */ - PORT_BIT( 0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) /* 9 ) */ - PORT_BIT( 0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) /* 0 */ - PORT_BIT( 0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) /* - _ */ - PORT_BIT( 0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) /* = + */ - PORT_BIT( 0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ ^") PORT_CODE(KEYCODE_BACKSLASH2) /* ~ ` */ - PORT_BIT( 0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) /* Backspace */ - PORT_BIT( 0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) /* Tab */ - PORT_BIT( 0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) /* Q */ - PORT_BIT( 0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) /* W */ - PORT_BIT( 0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) /* E */ - PORT_BIT( 0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) /* R */ - PORT_BIT( 0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) /* T */ - PORT_BIT( 0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) /* Y */ - PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) /* U */ - PORT_BIT( 0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) /* I */ - PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) /* O */ - PORT_BIT( 0x04000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) /* P */ - PORT_BIT( 0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) /* [ { */ - PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) /* ] } */ - PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) /* Return */ - PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) /* A */ - PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) /* S */ - - PORT_START( "keyboard2" ) - PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) /* D */ - PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) /* F */ - PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) /* G */ - PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) /* H */ - PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) /* J */ - PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) /* K */ - PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) /* L */ - PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) /* ; + */ - PORT_BIT( 0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) /* : * */ - PORT_BIT( 0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) /* \\ | */ - PORT_BIT( 0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) /* Z */ - PORT_BIT( 0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) /* X */ - PORT_BIT( 0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) /* C */ - PORT_BIT( 0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) /* V */ - PORT_BIT( 0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) /* B */ - PORT_BIT( 0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) /* N */ - PORT_BIT( 0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) /* M */ - PORT_BIT( 0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) /* , < */ - PORT_BIT( 0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) /* . > */ - PORT_BIT( 0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) /* / ? */ -//?? - PORT_BIT( 0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("~ '") PORT_CODE(KEYCODE_TILDE) /* Underscore (shifted only?) */ - PORT_BIT( 0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) /* Space */ - PORT_BIT( 0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* Home */ - PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) /* Del */ - PORT_BIT( 0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_PGUP) /* Roll Up */ - PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_PGDN) /* Roll Down */ - PORT_BIT( 0x04000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("End") PORT_CODE(KEYCODE_END) /* End */ - PORT_BIT( 0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) /* Left */ - PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) /* Up */ - PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /* Right */ - PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) /* Down */ -// PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad CLR") PORT_CODE(KEYCODE_NUMLOCK) /* CLR */ - PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MENU") PORT_CODE(KEYCODE_MENU) /* Menu = POP */ - - PORT_START( "keyboard3" ) - PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad /") PORT_CODE(KEYCODE_SLASH_PAD) /* / (numpad) */ - PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad *") PORT_CODE(KEYCODE_ASTERISK) /* * (numpad) */ - PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad -") PORT_CODE(KEYCODE_MINUS_PAD) /* - (numpad) */ - PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 7") PORT_CODE(KEYCODE_7_PAD) /* 7 (numpad) */ - PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 8") PORT_CODE(KEYCODE_8_PAD) /* 8 (numpad) */ - PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 9") PORT_CODE(KEYCODE_9_PAD) /* 9 (numpad) */ - PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad +") PORT_CODE(KEYCODE_PLUS_PAD) /* + (numpad) */ - PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 4") PORT_CODE(KEYCODE_4_PAD) /* 4 (numpad) */ - PORT_BIT( 0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 5") PORT_CODE(KEYCODE_5_PAD) /* 5 (numpad) */ - PORT_BIT( 0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 6") PORT_CODE(KEYCODE_6_PAD) /* 6 (numpad) */ - PORT_BIT( 0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad =") /* = (numpad) */ - PORT_BIT( 0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 1") PORT_CODE(KEYCODE_1_PAD) /* 1 (numpad) */ - PORT_BIT( 0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 2") PORT_CODE(KEYCODE_2_PAD) /* 2 (numpad) */ - PORT_BIT( 0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 3") PORT_CODE(KEYCODE_3_PAD) /* 3 (numpad) */ - PORT_BIT( 0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* Enter (numpad) */ - PORT_BIT( 0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad 0") PORT_CODE(KEYCODE_0_PAD) /* 0 (numpad) */ - PORT_BIT( 0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad ,") /* , (numpad) */ - PORT_BIT( 0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Numpad .") PORT_CODE(KEYCODE_DEL_PAD) /* 2 (numpad) */ - - PORT_BIT( 0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) /* F1 */ - PORT_BIT( 0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) /* F2 */ - PORT_BIT( 0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) /* F3 */ - PORT_BIT( 0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) /* F4 */ - PORT_BIT( 0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) /* F5 */ - PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) /* F6 */ - PORT_BIT( 0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) /* F7 */ - PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) /* F8 */ - PORT_BIT( 0x04000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) /* F9 */ - PORT_BIT( 0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) /* F10 */ - PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) /* F11 */ - PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) /* F12 */ - PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) /* Insert */ -// PORT_BIT( 0x80000000, 0x0000, IPT_UNUSED ) - PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("WIN_R") PORT_CODE(KEYCODE_RWIN) /* Windows Right = Next Window */ - - PORT_START( "keyboard4" ) - - PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) /* Caps lock */ - PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) /* Shift */ - PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) /* Ctrl */ - PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT_L") PORT_CODE(KEYCODE_LALT) /* ALT */ - PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT_R") PORT_CODE(KEYCODE_RALT) /* ALT GR */ - PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) /* Shift */ - PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num Lock") PORT_CODE(KEYCODE_NUMLOCK) /* Num Lock */ - - PORT_START("mouse1") // mouse buttons - PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) - PORT_BIT( 0x00000020, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON3) - PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Center mouse button") PORT_CODE(MOUSECODE_BUTTON2) - - PORT_START("mouse2") // X-axis - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(200) PORT_KEYDELTA(0) PORT_PLAYER(1) - - PORT_START("mouse3") // Y-axis - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(200) PORT_KEYDELTA(0) PORT_PLAYER(1) - -INPUT_PORTS_END diff --git a/src/mess/machine/apollo_kbd.h b/src/mess/machine/apollo_kbd.h deleted file mode 100644 index 151e753f916..00000000000 --- a/src/mess/machine/apollo_kbd.h +++ /dev/null @@ -1,163 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Hans Ostermeyer -/* - * apollo_kbd.h - * - * Created on: Dec 27, 2010 - * Author: Hans Ostermeyer - * - */ - -#pragma once - -#ifndef __APOLLO_KBD_H__ -#define __APOLLO_KBD_H__ - -#include "emu.h" -#include "sound/beep.h" - -// BSD-derived systems get very sad when you party with system reserved names. -#ifdef getchar -#undef getchar -#endif - -#ifdef putchar -#undef putchar -#endif - -//************************************************************************** -// DEVICE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_APOLLO_KBD_TX_CALLBACK(_cb) \ - devcb = &apollo_kbd_device::set_tx_cb(*device, DEVCB_##_cb); - -#define MCFG_APOLLO_KBD_GERMAN_CALLBACK(_cb) \ - devcb = &apollo_kbd_device::set_german_cb(*device, DEVCB_##_cb); - -INPUT_PORTS_EXTERN(apollo_kbd); - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> apollo_kbd_device - -class apollo_kbd_device : public device_t, public device_serial_interface -{ -public: - // construction/destruction - apollo_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_tx_cb(device_t &device, _Object object) { return downcast(device).m_tx_w.set_callback(object); } - template static devcb_base &set_german_cb(device_t &device, _Object object) { return downcast(device).m_german_r.set_callback(object); } - - devcb_write_line m_tx_w; - devcb_read_line m_german_r; - -private: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // serial overrides - virtual void rcv_complete(); // Rx completed receiving byte - virtual void tra_complete(); // Tx completed sending byte - virtual void tra_callback(); // Tx send bit - void input_callback(UINT8 state); - - TIMER_CALLBACK_MEMBER( kbd_scan_timer ); - - const char *cpu_context() ; - - void kgetchar(UINT8 data); - - int keyboard_is_german(); - - void set_mode(UINT16 mode); - void putchar(const UINT8 data); - void putdata(const UINT8 *data, int data_length); - void putstring(const char *data); - - int push_scancode( UINT8 code, UINT8 repeat); - void scan_keyboard(); - void poll_callback(); - static TIMER_CALLBACK( static_poll_callback ); - - // the keyboard beeper - class beeper - { - public: - beeper(); - void start(apollo_kbd_device *device); - void reset(); - void off(); - void on(); - private: - int keyboard_has_beeper(); - void beeper_callback(); - static TIMER_CALLBACK( static_beeper_callback ); - - apollo_kbd_device *m_device; // pointer back to our device - beep_device *m_beeper; // the keyboard beeper device - emu_timer * m_timer; // timer to clock data in - }; - - // the keyboard mouse - class mouse - { - public: - mouse(); - void start(apollo_kbd_device *device); - void reset(); - void read_mouse(); - private: - apollo_kbd_device *m_device; // pointer back to our device - - int m_last_b; // previous mouse button values - int m_last_x; // previous mouse x-axis value - int m_last_y; // previous mouse y-axis value - int m_tx_pending; // mouse data packet is pending - }; - - static const int XMIT_RING_SIZE = 64; - - UINT8 m_xmitring[XMIT_RING_SIZE]; - int m_xmit_read, m_xmit_write; - bool m_tx_busy; - - void xmit_char(UINT8 data); - - beeper m_beeper; - mouse m_mouse; - - apollo_kbd_device *m_device; // pointer to myself (nasty: used for cpu_context) - - ioport_port *m_io_keyboard1; - ioport_port *m_io_keyboard2; - ioport_port *m_io_keyboard3; - ioport_port *m_io_keyboard4; - ioport_port *m_io_mouse1; - ioport_port *m_io_mouse2; - ioport_port *m_io_mouse3; - - /* Receiver */ - UINT32 m_rx_message; - UINT16 m_loopback_mode; - - emu_timer* m_timer; - UINT16 m_mode; - UINT16 m_delay; // key press delay after initial press - UINT16 m_repeat; // key press repeat rate - UINT16 m_last_pressed; // last key pressed, for repeat key handling - int m_keytime[0x80]; // time until next key press (1 ms) - UINT8 m_keyon[0x80]; // is 1 if key is pressed - - static UINT16 m_code_table[]; -}; - -// device type definition -extern const device_type APOLLO_KBD; - -#endif diff --git a/src/mess/machine/appldriv.c b/src/mess/machine/appldriv.c deleted file mode 100644 index 86e2657cf9b..00000000000 --- a/src/mess/machine/appldriv.c +++ /dev/null @@ -1,336 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/********************************************************************* - - appldriv.c - - Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c) - -*********************************************************************/ -#include "emu.h" -#include "appldriv.h" -#include "imagedev/flopdrv.h" -#include "formats/ap2_dsk.h" - -// our parent's device is the Disk II card (Apple II) or main driver (Mac, IIgs) -// either way, get the drive from there. -#define PARENT_FLOPPY_0 "^floppy0" -#define PARENT_FLOPPY_1 "^floppy1" -#define PARENT_FLOPPY_2 "^floppy2" -#define PARENT_FLOPPY_3 "^floppy3" - -INLINE apple525_floppy_image_device *get_device(device_t *device) -{ - assert(device != NULL); - assert(device->type() == FLOPPY_APPLE); - - return (apple525_floppy_image_device *) downcast(device); -} - -static int apple525_enable_mask = 1; - -legacy_floppy_image_device *apple525_get_subdevice(device_t *device, int drive) -{ - switch(drive) { - case 0 : return device->subdevice(PARENT_FLOPPY_0); - case 1 : return device->subdevice(PARENT_FLOPPY_1); - case 2 : return device->subdevice(PARENT_FLOPPY_2); - case 3 : return device->subdevice(PARENT_FLOPPY_3); - } - return NULL; -} - -device_t *apple525_get_device_by_type(device_t *device, int ftype, int drive) -{ - int i; - int cnt = 0; - for (i=0;i<4;i++) { - legacy_floppy_image_device *disk = apple525_get_subdevice(device, i); - if (disk->floppy_get_drive_type()==ftype) { - if (cnt==drive) { - return disk; - } - cnt++; - } - } - return NULL; -} - -void apple525_set_enable_lines(device_t *device,int enable_mask) -{ - apple525_enable_mask = enable_mask; -} - -/* ----------------------------------------------------------------------- */ - -static void apple525_load_current_track(device_t *image) -{ - int len; - apple525_floppy_image_device *disk; - - disk = get_device(image); - len = sizeof(disk->track_data); - - disk->floppy_drive_read_track_data_info_buffer(0, disk->track_data, &len); - disk->track_loaded = 1; - disk->track_dirty = 0; -} - -static void apple525_save_current_track(device_t *image, int unload) -{ - int len; - apple525_floppy_image_device *disk; - - disk = get_device(image); - - if (disk->track_dirty) - { - len = sizeof(disk->track_data); - disk->floppy_drive_write_track_data_info_buffer(0, disk->track_data, &len); - disk->track_dirty = 0; - } - if (unload) - disk->track_loaded = 0; -} - -static void apple525_seek_disk(apple525_floppy_image_device *img, signed int step) -{ - int track; - int pseudo_track; - apple525_floppy_image_device *disk; - - disk = get_device(img); - - apple525_save_current_track(img, FALSE); - - track = img->floppy_drive_get_current_track(); - pseudo_track = (track * 2) + disk->tween_tracks; - - pseudo_track += step; - if (pseudo_track < 0) - pseudo_track = 0; - else if (pseudo_track/2 >= APPLE2_TRACK_COUNT) - pseudo_track = APPLE2_TRACK_COUNT*2-1; - - if (pseudo_track/2 != track) - { - img->floppy_drive_seek(pseudo_track/2 - img->floppy_drive_get_current_track()); - disk->track_loaded = 0; - } - - if (pseudo_track & 1) - disk->tween_tracks = 1; - else - disk->tween_tracks = 0; -} - -static void apple525_disk_set_lines(device_t *device,device_t *image, UINT8 new_state) -{ - apple525_floppy_image_device *cur_disk; - UINT8 old_state; - unsigned int phase; - - cur_disk = get_device(image); - - old_state = cur_disk->state; - cur_disk->state = new_state; - - if ((new_state & 0x0F) > (old_state & 0x0F)) - { - phase = 0; - switch((old_state ^ new_state) & 0x0F) - { - case 1: phase = 0; break; - case 2: phase = 1; break; - case 4: phase = 2; break; - case 8: phase = 3; break; - } - - phase -= cur_disk->floppy_drive_get_current_track() * 2; - if (cur_disk->tween_tracks) - phase--; - phase %= 4; - - switch(phase) - { - case 1: - apple525_seek_disk(cur_disk, +1); - break; - case 3: - apple525_seek_disk(cur_disk, -1); - break; - } - } -} - -int apple525_get_count(device_t *device) -{ - int cnt = 0; - if ((device->subdevice("^" FLOPPY_0)!=NULL) && (device->subdevice("^" FLOPPY_0)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_0))!=NULL)) cnt++; - if ((device->subdevice("^" FLOPPY_1)!=NULL) && (device->subdevice("^" FLOPPY_1)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_1))!=NULL)) cnt++; - if ((device->subdevice("^" FLOPPY_2)!=NULL) && (device->subdevice("^" FLOPPY_2)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_2))!=NULL)) cnt++; - if ((device->subdevice("^" FLOPPY_3)!=NULL) && (device->subdevice("^" FLOPPY_3)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_3))!=NULL)) cnt++; - - return cnt; -} - -void apple525_set_lines(device_t *device, UINT8 lines) -{ - int i, count; - device_t *image; - - count = apple525_get_count(device); - for (i = 0; i < count; i++) - { - if (apple525_enable_mask & (1 << i)) - { - image = apple525_get_device_by_type(device, FLOPPY_TYPE_APPLE, i); - if (image) - apple525_disk_set_lines(device,image, lines); - } - } -} - -/* reads/writes a byte; write_value is -1 for read only */ -static UINT8 apple525_process_byte(device_t *img, int write_value) -{ - UINT8 read_value; - apple525_floppy_image_device *disk; - int spinfract_divisor; - int spinfract_dividend; - apple525_floppy_image_device *config = get_device(img); - device_image_interface *image = dynamic_cast(img); - - disk = get_device(img); - spinfract_dividend = config->get_dividend(); - spinfract_divisor = config->get_divisor(); - - /* no image initialized for that drive ? */ - if (!image->exists()) - return 0xFF; - - /* check the spin count if reading*/ - if (write_value < 0) - { - disk->spin_count++; - disk->spin_count %= spinfract_divisor; - if (disk->spin_count >= spinfract_dividend) - return 0x00; - } - - /* load track if need be */ - if (disk->track_loaded == 0) - apple525_load_current_track(img); - - /* perform the read */ - read_value = disk->track_data[disk->position]; - - /* perform the write, if applicable */ - if (write_value >= 0) - { - disk->track_data[disk->position] = write_value; - disk->track_dirty = 1; - } - - disk->position++; - disk->position %= ARRAY_LENGTH(disk->track_data); - - /* when writing; save the current track after every full sector write */ - if ((write_value >= 0) && ((disk->position % APPLE2_NIBBLE_SIZE) == 0)) - apple525_save_current_track(img, FALSE); - - return read_value; -} - -static device_t *apple525_selected_image(device_t *device) -{ - int i,count; - - count = apple525_get_count(device); - - for (i = 0; i < count; i++) - { - if (apple525_enable_mask & (1 << i)) - return apple525_get_device_by_type(device, FLOPPY_TYPE_APPLE, i); - } - return NULL; -} - -UINT8 apple525_read_data(device_t *device) -{ - device_t *image; - image = apple525_selected_image(device); - return image ? apple525_process_byte(image, -1) : 0xFF; -} - -void apple525_write_data(device_t *device,UINT8 data) -{ - device_t *image; - image = apple525_selected_image(device); - if (image) - apple525_process_byte(image, data); -} - -int apple525_read_status(device_t *device) -{ - int i, count, result = 0; - device_image_interface *image; - - count = apple525_get_count(device); - - for (i = 0; i < count; i++) - { - if (apple525_enable_mask & (1 << i)) - { - image = dynamic_cast(apple525_get_device_by_type(device, FLOPPY_TYPE_APPLE, i)); - if (image && image->is_readonly()) - result = 1; - } - } - return result; -} - -// device type definition -const device_type FLOPPY_APPLE = &device_creator; - -//------------------------------------------------- -// apple525_floppy_image_device - constructor -//------------------------------------------------- - -apple525_floppy_image_device::apple525_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : legacy_floppy_image_device(mconfig, FLOPPY_APPLE, "Apple Disk II", tag, owner, clock, "floppy_apple", __FILE__) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void apple525_floppy_image_device::device_start() -{ - legacy_floppy_image_device::device_start(); - floppy_set_type(FLOPPY_TYPE_APPLE); - - state = 0; - tween_tracks = 0; - track_loaded = 0; - track_dirty = 0; - position = 0; - spin_count = 0; - memset(track_data, 0, sizeof(track_data)); -} - -bool apple525_floppy_image_device::call_load() -{ - int result = legacy_floppy_image_device::call_load(); - floppy_drive_seek(-999); - floppy_drive_seek(+35/2); - return result; -} - -void apple525_floppy_image_device::call_unload() -{ - apple525_save_current_track(this, TRUE); - - legacy_floppy_image_device::call_unload(); -} diff --git a/src/mess/machine/appldriv.h b/src/mess/machine/appldriv.h deleted file mode 100644 index cbda53a42a3..00000000000 --- a/src/mess/machine/appldriv.h +++ /dev/null @@ -1,88 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/********************************************************************* - - appldriv.h - - Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c) - -*********************************************************************/ - -#ifndef APPLDRIV_H -#define APPLDRIV_H - -#include "emu.h" -#include "imagedev/flopdrv.h" -#include "formats/ap2_dsk.h" - -void apple525_set_lines(device_t *device,UINT8 lines); -void apple525_set_enable_lines(device_t *device,int enable_mask); - -UINT8 apple525_read_data(device_t *device); -void apple525_write_data(device_t *device,UINT8 data); -int apple525_read_status(device_t *device); -int apple525_get_count(running_machine &machine); - -class apple525_floppy_image_device : public legacy_floppy_image_device -{ -public: - // construction/destruction - apple525_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual bool call_load(); - virtual void call_unload(); - void set_params(int dividend, int divisor) { m_dividend = dividend; m_divisor = divisor;} - - int get_dividend() { return m_dividend; } - int get_divisor() { return m_divisor; } - - // these elements should be private, but are not yet - unsigned int state : 4; /* bits 0-3 are the phase */ - unsigned int tween_tracks : 1; - unsigned int track_loaded : 1; - unsigned int track_dirty : 1; - int position; - int spin_count; /* simulate drive spin to fool RWTS test at $BD34 */ - UINT8 track_data[APPLE2_NIBBLE_SIZE * APPLE2_SECTOR_COUNT]; - -protected: - virtual void device_start(); - -private: - int m_dividend; - int m_divisor; -}; - -// device type definition -extern const device_type FLOPPY_APPLE; - -#define MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ - downcast(device)->set_params(_dividend,_divisor); - -#define MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(_config,_dividend,_divisor) \ - MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_APPLE, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ - MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_APPLE, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) - -#define MCFG_LEGACY_FLOPPY_APPLE_4_DRIVES_ADD(_config,_dividend,_divisor) \ - MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_APPLE, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ - MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_APPLE, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ - MCFG_DEVICE_ADD(FLOPPY_2, FLOPPY_APPLE, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ - MCFG_DEVICE_ADD(FLOPPY_3, FLOPPY_APPLE, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_LEGACY_FLOPPY_APPLE_PARAMS(_dividend,_divisor) - -#define MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_REMOVE() \ - MCFG_DEVICE_REMOVE(FLOPPY_0) \ - MCFG_DEVICE_REMOVE(FLOPPY_1) - -#endif /* APPLDRIV_H */ diff --git a/src/mess/machine/apple1.c b/src/mess/machine/apple1.c deleted file mode 100644 index 59b360aea7e..00000000000 --- a/src/mess/machine/apple1.c +++ /dev/null @@ -1,404 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels, Colin Howell, R. Belmont -/*************************************************************************** - - machine.c - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - - The Apple I used a Motorola 6820 PIA for its keyboard and display - I/O. The keyboard was mapped to PIA port A, and the display to port - B. - - Port A, the keyboard, was an input port connected to a standard - ASCII-encoded keyboard. The high bit of the port was tied to +5V. - The keyboard strobe signal was connected to the PIA's CA1 control - input so that the keyboard could signal each keypress to the PIA. - The processor could check for a keypress by testing the IRQA1 flag - in the Port A Control Register and then reading the character value - from Port A. - - The keyboard connector also had two special lines, RESET and CLEAR - SCREEN, which were meant to be connected to pushbutton switches on - the keyboard. RESET was tied to the reset inputs for the CPU and - PIA; it allowed the user to stop a program and return control to the - Monitor. CLEAR SCREEN was directly tied to the video hardware and - would clear the display. - - Port B, the display, was an output port which accepted 7-bit ASCII - characters from the PIA and wrote them on the display. The details - of this are described in video/apple1.c. Control line CB2 served - as an output signal to inform the display of a new character. (CB2 - was also connected to line 7 of port B, which was configured as an - input, so that the CPU could more easily check the status of the - write.) The CB1 control input signaled the PIA when the display had - finished writing the character and could accept a new one. - - MAME models the 6821 instead of the earlier 6820 used in the Apple - I, but there is no difference in functionality between the two - chips; the 6821 simply has a better ability to drive electrical - loads. - - The Apple I had an optional cassette interface which plugged into - the expansion connector. This is described below in the "Cassette - interface I/O" section. - -***************************************************************************/ - -#include "emu.h" -#include "includes/apple1.h" -#include "machine/6821pia.h" -#include "cpu/m6502/m6502.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - -/***************************************************************************** -** Structures -*****************************************************************************/ - -/* Use the same keyboard mapping as on a modern keyboard. This is not - the same as the keyboard mapping of the actual teletype-style - keyboards used with the Apple I, but it's less likely to cause - confusion for people who haven't memorized that layout. - - The Backspace key is mapped to the '_' (underscore) character - because the Apple I ROM Monitor used "back-arrow" to erase - characters, rather than backspace, and back-arrow is an earlier - form of the underscore. */ - -#define ESCAPE '\x1b' - -static const UINT8 apple1_unshifted_keymap[] = -{ - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', '-', '=', '[', ']', ';', '\'', - ',', '.', '/', '\\', 'A', 'B', 'C', 'D', - 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', - 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - 'U', 'V', 'W', 'X', 'Y', 'Z', '\r', '_', - ' ', ESCAPE -}; - -static const UINT8 apple1_shifted_keymap[] = -{ - ')', '!', '@', '#', '$', '%', '^', '&', - '*', '(', '_', '+', '[', ']', ':', '"', - '<', '>', '?', '\\', 'A', 'B', 'C', 'D', - 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', - 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - 'U', 'V', 'W', 'X', 'Y', 'Z', '\r', '_', - ' ', ESCAPE -}; - -/* Control key mappings, like the other mappings, conform to a modern - keyboard where possible. Note that the Apple I ROM Monitor ignores - most control characters. */ - -static const UINT8 apple1_control_keymap[] = -{ - '0', '1', '\x00', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', - '8', '9', '\x1f', '=', '\x1b', '\x1d', ';', '\'', - ',', '.', '/', '\x1c', '\x01', '\x02', '\x03', '\x04', - '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', - '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', - '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\r', '_', - '\x00', ESCAPE -}; - - - -/***************************************************************************** -** DRIVER_INIT: driver-specific setup, executed once at MESS startup. -*****************************************************************************/ - -DRIVER_INIT_MEMBER(apple1_state,apple1) -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - /* Set up the handlers for MESS's dynamically-sized RAM. */ - space.install_readwrite_bank(0x0000, m_ram->size() - 1, "bank1"); - membank("bank1")->set_base(m_ram->pointer()); - - /* Poll the keyboard input ports periodically. These include both - ordinary keys and the RESET and CLEAR SCREEN pushbutton - switches. We can't handle these switches in a VBLANK_INT or - PERIODIC_INT because both switches need to be monitored even - while the CPU is suspended during RESET; VBLANK_INT and - PERIODIC_INT callbacks aren't run while the CPU is in this - state. - - A 120-Hz poll rate seems to be fast enough to ensure no - keystrokes are missed. */ - machine().scheduler().timer_pulse(attotime::from_hz(120), timer_expired_delegate(FUNC(apple1_state::apple1_kbd_poll),this)); -} - - -void apple1_state::machine_reset() -{ - /* Reset the display hardware. */ - apple1_vh_dsp_clr(); -} - - -/***************************************************************************** -** apple1_verify_header -*****************************************************************************/ -int apple1_state::apple1_verify_header (UINT8 *data) -{ - /* Verify the format for the snapshot */ - if ((data[0] == 'L') && - (data[1] == 'O') && - (data[2] == 'A') && - (data[3] == 'D') && - (data[4] == ':') && - (data[7] == 'D') && - (data[8] == 'A') && - (data[9] == 'T') && - (data[10]== 'A') && - (data[11]== ':')) - { - return(IMAGE_VERIFY_PASS); - } - else - { - return(IMAGE_VERIFY_FAIL); - } -} - -#define SNAP_HEADER_LEN 12 - -/***************************************************************************** -** snapshot_load_apple1 -** -** Format of the binary snapshot image is: -** -** [ LOAD:xxyyDATA:zzzzzz...] -** -** where xxyy is the binary starting address (in big-endian byte -** order) to load the binary data zzzzzz to. -** -** The image can be of arbitrary length, but it must fit in available -** memory. -*****************************************************************************/ -SNAPSHOT_LOAD_MEMBER( apple1_state,apple1) -{ - UINT64 filesize, datasize; - UINT8 *snapbuf, *snapptr; - UINT16 start_addr, end_addr, addr; - - filesize = image.length(); - - /* Read the snapshot data into a temporary array */ - if (filesize < SNAP_HEADER_LEN) - return IMAGE_INIT_FAIL; - snapbuf = (UINT8*)image.ptr(); - if (!snapbuf) - return IMAGE_INIT_FAIL; - - /* Verify the snapshot header */ - if (apple1_verify_header(snapbuf) == IMAGE_VERIFY_FAIL) - { - logerror("apple1 - Snapshot Header is in incorrect format - needs to be LOAD:xxyyDATA:\n"); - return IMAGE_INIT_FAIL; - } - - datasize = filesize - SNAP_HEADER_LEN; - - /* Extract the starting address to load the snapshot to. */ - start_addr = (snapbuf[5] << 8) | (snapbuf[6]); - logerror("apple1 - LoadAddress is 0x%04x\n", start_addr); - - end_addr = start_addr + datasize - 1; - - if ((start_addr < 0xE000 && end_addr > m_ram->size() - 1) - || end_addr > 0xEFFF) - { - logerror("apple1 - Snapshot won't fit in this memory configuration;\n" - "needs memory from $%04X to $%04X.\n", start_addr, end_addr); - return IMAGE_INIT_FAIL; - } - - /* Copy the data into memory space. */ - for (addr = start_addr, snapptr = snapbuf + SNAP_HEADER_LEN; - addr <= end_addr; - addr++, snapptr++) - m_maincpu->space(AS_PROGRAM).write_byte(addr, *snapptr); - - - return IMAGE_INIT_PASS; -} - - -/***************************************************************************** -** apple1_kbd_poll -** -** Keyboard polling handles both ordinary keys and the special RESET -** and CLEAR SCREEN switches. -** -** For ordinary keys, this implements 2-key rollover to reduce the -** chance of missed keypresses. If we press a key and then press a -** second key while the first hasn't been completely released, as -** might happen during rapid typing, only the second key is -** registered; the first key is ignored. -** -** If multiple newly-pressed keys are found, the one closest to the -** end of the input ports list is counted; the others are ignored. -*****************************************************************************/ -TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_poll) -{ - int port, bit; - int key_pressed; - UINT32 shiftkeys, ctrlkeys; - pia6821_device *pia = machine().device("pia"); - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" }; - - /* This holds the values of all the input ports for ordinary keys - seen during the last scan. */ - - /* First we check the RESET and CLEAR SCREEN pushbutton switches. */ - - /* The RESET switch resets the CPU and the 6820 PIA. */ - if (ioport("KEY5")->read() & 0x0001) - { - if (!m_reset_flag) { - m_reset_flag = 1; - /* using PULSE_LINE does not allow us to press and hold key */ - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - pia->reset(); - } - } - else if (m_reset_flag) { - /* RESET released--allow the processor to continue. */ - m_reset_flag = 0; - m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - } - - /* The CLEAR SCREEN switch clears the video hardware. */ - if (ioport("KEY5")->read() & 0x0002) - { - if (!m_vh_clrscrn_pressed) - { - /* Ignore further video writes, and clear the screen. */ - m_vh_clrscrn_pressed = 1; - apple1_vh_dsp_clr(); - } - } - else if (m_vh_clrscrn_pressed) - { - /* CLEAR SCREEN released--pay attention to video writes again. */ - m_vh_clrscrn_pressed = 0; - } - - /* Now we scan all the input ports for ordinary keys, recording - new keypresses while ignoring keys that were already pressed in - the last scan. */ - - m_kbd_data = 0; - key_pressed = 0; - - /* The keyboard strobe line should always be low when a scan starts. */ - pia->ca1_w(0); - - shiftkeys = ioport("KEY4")->read() & 0x0003; - ctrlkeys = ioport("KEY4")->read() & 0x000c; - - for (port = 0; port < 4; port++) - { - UINT32 portval, newkeys; - - portval = ioport(keynames[port])->read(); - newkeys = portval & ~(m_kbd_last_scan[port]); - - if (newkeys) - { - key_pressed = 1; - for (bit = 0; bit < 16; bit++) { - if (newkeys & 1) - { - m_kbd_data = (ctrlkeys) - ? apple1_control_keymap[port*16 + bit] - : (shiftkeys) - ? apple1_shifted_keymap[port*16 + bit] - : apple1_unshifted_keymap[port*16 + bit]; - } - newkeys >>= 1; - } - } - m_kbd_last_scan[port] = portval; - } - - if (key_pressed) - { - /* The keyboard will pulse its strobe line when a key is - pressed. A 10-usec pulse is typical. */ - pia->ca1_w(1); - machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(apple1_state::apple1_kbd_strobe_end),this)); - } -} - -TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_strobe_end) -{ - pia6821_device *pia = machine().device("pia"); - - /* End of the keyboard strobe pulse. */ - pia->ca1_w(0); -} - - -/***************************************************************************** -** READ/WRITE HANDLERS -*****************************************************************************/ -READ8_MEMBER(apple1_state::apple1_pia0_kbdin) -{ - /* Bit 7 of the keyboard input is permanently wired high. This is - what the ROM Monitor software expects. */ - return m_kbd_data | 0x80; -} - -WRITE8_MEMBER(apple1_state::apple1_pia0_dspout) -{ - /* Send an ASCII character to the video hardware. */ - apple1_vh_dsp_w(data); -} - -WRITE_LINE_MEMBER(apple1_state::apple1_pia0_dsp_write_signal) -{ - device_t *device = machine().device("pia"); - /* PIA output CB2 is inverted to become the DA signal, used to - signal a display write to the video hardware. */ - - /* DA is directly connected to PIA input PB7, so the processor can - read bit 7 of port B to test whether the display has completed - a write. */ - pia6821_device *pia = downcast(device); - pia->portb_w((!state) << 7); - - /* Once DA is asserted, the display will wait until it can perform - the write, when the cursor position is about to be refreshed. - Only then will it assert \RDA to signal readiness for another - write. Thus the write delay depends on the cursor position and - where the display is in the refresh cycle. */ - if (!state) - machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_start),this)); -} - -TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_start) -{ - pia6821_device *pia = machine().device("pia"); - - /* When the display asserts \RDA to signal it is ready, it - triggers a 74123 one-shot to send a 3.5-usec low pulse to PIA - input CB1. The end of this pulse will tell the PIA that the - display is ready for another write. */ - pia->cb1_w(0); - machine().scheduler().timer_set(attotime::from_nsec(3500), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_end),this)); -} - -TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_end) -{ - pia6821_device *pia = machine().device("pia"); - - /* The one-shot pulse has ended; return CB1 to high, so we can do - another display write. */ - pia->cb1_w(1); -} diff --git a/src/mess/machine/apple2.c b/src/mess/machine/apple2.c deleted file mode 100644 index 765f97ad92a..00000000000 --- a/src/mess/machine/apple2.c +++ /dev/null @@ -1,2632 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - apple2.c - - Machine file to handle emulation of the Apple II series. - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "includes/apple2.h" -#include "machine/applefdc.h" -#include "machine/sonydriv.h" -#include "machine/appldriv.h" -#include "imagedev/flopdrv.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" -#include "debugger.h" - -#ifdef MAME_DEBUG -#define VERBOSE 1 -#else -#define VERBOSE 0 -#endif /* MAME_DEBUG */ - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -#define PROFILER_C00X PROFILER_USER2 -#define PROFILER_C01X PROFILER_USER2 -#define PROFILER_C08X PROFILER_USER2 -#define PROFILER_A2INT PROFILER_USER2 - -/* ----------------------------------------------------------------------- - * New Apple II memory manager - * ----------------------------------------------------------------------- */ - -READ8_MEMBER(apple2_state::read_floatingbus) -{ - return apple2_getfloatingbusvalue(); -} - - - -void apple2_state::apple2_setup_memory(const apple2_memmap_config *config) -{ - m_mem_config = *config; - m_current_meminfo = NULL; - apple2_update_memory(); -} - - - -void apple2_state::apple2_update_memory() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - int i, bank; - char rbank[10], wbank[10]; - int full_update = 0; - apple2_meminfo meminfo; - read8_delegate *rh; - write8_delegate *wh; - offs_t begin, end_r, end_w; - UINT8 *rbase, *wbase; - UINT32 offset; - bank_disposition_t bank_disposition; - int wh_nop = 0; - - /* need to build list of current info? */ - if (!m_current_meminfo) - { - for (i = 0; m_mem_config.memmap[i].end; i++) - ; - m_current_meminfo = auto_alloc_array(machine(), apple2_meminfo, i); - full_update = 1; - } - - /* loop through the entire memory map */ - bank = m_mem_config.first_bank; - for (i = 0; m_mem_config.memmap[i].get_meminfo; i++) - { - /* retrieve information on this entry */ - memset(&meminfo, 0, sizeof(meminfo)); - m_mem_config.memmap[i].get_meminfo(machine(),m_mem_config.memmap[i].begin, m_mem_config.memmap[i].end, &meminfo); - - bank_disposition = m_mem_config.memmap[i].bank_disposition; - - /* do we need to memory reading? */ - if (full_update - || (meminfo.read_mem != m_current_meminfo[i].read_mem) - || (meminfo.read_handler != m_current_meminfo[i].read_handler)) - { - rbase = NULL; - sprintf(rbank,"bank%d",bank); - begin = m_mem_config.memmap[i].begin; - end_r = m_mem_config.memmap[i].end; - rh = NULL; - - LOG(("apple2_update_memory(): Updating RD {%06X..%06X} [#%02d] --> %08X\n", - begin, end_r, bank, meminfo.read_mem)); - - /* read handling */ - if (meminfo.read_handler) - { - /* handler */ - rh = meminfo.read_handler; - } - else if (meminfo.read_mem == APPLE2_MEM_FLOATING) - { - /* floating RAM */ - rh = &read_delegates_master[0]; - } - else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_AUX) - { - /* auxillary memory */ - assert(m_mem_config.auxmem); - offset = meminfo.read_mem & APPLE2_MEM_MASK; - rbase = &m_mem_config.auxmem[offset]; - } - else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_SLOT) - { - // slots 1-2 - if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0) - { - rh = &read_delegates_master[1]; - } - else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x200) - { // slot 3 - rh = &read_delegates_master[2]; - } - else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300) - { // slots 4-7 - rh = &read_delegates_master[3]; - } - else - { - printf("ERROR: Unhandled case for APPLE2_MEM_SLOT write_mem = %x!\n", (meminfo.write_mem & APPLE2_MEM_MASK)); - } - } - else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_ROM) - { - /* ROM */ - offset = meminfo.read_mem & APPLE2_MEM_MASK; - rbase = &m_rom[offset % m_rom_length]; - } - else - { - /* RAM */ - if (end_r >= m_ram->size()) - end_r = m_ram->size() - 1; - offset = meminfo.read_mem & APPLE2_MEM_MASK; - if (end_r >= begin) - rbase = &m_ram->pointer()[offset]; - } - - /* install the actual handlers */ - if (begin <= end_r) { - if (rh) { - space.install_read_handler(begin, end_r, *rh); - } else { - space.install_read_bank(begin, end_r, rbank); - } - } - - /* did we 'go past the end?' */ - if (end_r < m_mem_config.memmap[i].end) - space.nop_read(end_r + 1, m_mem_config.memmap[i].end); - - /* set the memory bank */ - if (rbase) - { - membank(rbank)->set_base(rbase); - } - - /* record the current settings */ - m_current_meminfo[i].read_mem = meminfo.read_mem; - m_current_meminfo[i].read_handler = meminfo.read_handler; - } - - /* do we need to memory writing? */ - if (full_update - || (meminfo.write_mem != m_current_meminfo[i].write_mem) - || (meminfo.write_handler != m_current_meminfo[i].write_handler)) - { - wbase = NULL; - if (bank_disposition == A2MEM_MONO) - sprintf(wbank,"bank%d",bank); - else if (bank_disposition == A2MEM_DUAL) - sprintf(wbank,"bank%d",bank+1); - begin = m_mem_config.memmap[i].begin; - end_w = m_mem_config.memmap[i].end; - wh = NULL; - - LOG(("apple2_update_memory(): Updating WR {%06X..%06X} [#%02d] --> %08X\n", - begin, end_w, bank, meminfo.write_mem)); - - /* write handling */ - if (meminfo.write_handler) - { - /* handler */ - wh = meminfo.write_handler; - } - else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_AUX) - { - /* auxillary memory */ - assert(m_mem_config.auxmem); - offset = meminfo.write_mem & APPLE2_MEM_MASK; - wbase = &m_mem_config.auxmem[offset]; - } - else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_SLOT) - { - /* slot RAM/ROM */ - - // slots 1-2 - if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0) - { - wh = &write_delegates_master[0]; - } - else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x200) - { // slot 3 - wh = &write_delegates_master[1]; - } - else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300) - { // slots 4-7 - wh = &write_delegates_master[2]; - } - } - else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_ROM) - { - /* ROM */ - wh_nop = 1; - } - else - { - /* RAM */ - if (end_w >= m_ram->size()) - end_w = m_ram->size() - 1; - offset = meminfo.write_mem & APPLE2_MEM_MASK; - if (end_w >= begin) - wbase = &m_ram->pointer()[offset]; - } - - - /* install the actual handlers */ - if (begin <= end_w) { - if (wh) { - space.install_write_handler(begin, end_w, *wh); - } else { - if (wh_nop) { - space.nop_write(begin, end_w); - } else { - space.install_write_bank(begin, end_w, wbank); - } - } - } - - /* did we 'go past the end?' */ - if (end_w < m_mem_config.memmap[i].end) - space.nop_write(end_w + 1, m_mem_config.memmap[i].end); - - /* set the memory bank */ - if (wbase) - { - membank(wbank)->set_base(wbase); - } - - /* record the current settings */ - m_current_meminfo[i].write_mem = meminfo.write_mem; - m_current_meminfo[i].write_handler = meminfo.write_handler; - } - bank += bank_disposition; - } -} - - - -void apple2_state::apple2_update_memory_postload() -{ - apple2_update_memory(); -} - - - -/* ----------------------------------------------------------------------- - * Apple II memory map - * ----------------------------------------------------------------------- */ - -READ8_MEMBER(apple2_state::apple2_c0xx_r) -{ - if(!space.debugger_access()) - { - read8_delegate handlers[] = - { - read8_delegate(FUNC(apple2_state::apple2_c00x_r), this), - read8_delegate(FUNC(apple2_state::apple2_c01x_r), this), - read8_delegate(FUNC(apple2_state::apple2_c02x_r), this), - read8_delegate(FUNC(apple2_state::apple2_c03x_r), this), - read8_delegate(FUNC(apple2_state::apple2_c03x_r), this), // not called here, handled elsewhere - read8_delegate(FUNC(apple2_state::apple2_c05x_r), this), - read8_delegate(FUNC(apple2_state::apple2_c06x_r), this), - read8_delegate(FUNC(apple2_state::apple2_c07x_r), this) - }; - - offset &= 0x7F; - - /* normal handler */ - if (offset / 0x10 != 4) - { - return handlers[offset / 0x10](space, offset % 0x10, 0); - } - } - - return 0; -} - - - -WRITE8_MEMBER(apple2_state::apple2_c0xx_w) -{ - write8_delegate handlers[] = - { - write8_delegate(FUNC(apple2_state::apple2_c00x_w), this), - write8_delegate(FUNC(apple2_state::apple2_c01x_w), this), - write8_delegate(FUNC(apple2_state::apple2_c02x_w), this), - write8_delegate(FUNC(apple2_state::apple2_c03x_w), this), - write8_delegate(FUNC(apple2_state::apple2_c03x_w), this), // unused - write8_delegate(FUNC(apple2_state::apple2_c05x_w), this), - write8_delegate(FUNC(apple2_state::apple2_c05x_w), this), // unused - write8_delegate(FUNC(apple2_state::apple2_c07x_w), this) - }; - - offset &= 0x7F; - - /* normal handler */ - if (((offset / 0x10) != 4) && (offset / 0x10) != 6) - { - handlers[offset / 0x10](space, offset % 0x10, data, 0); - } -} - -READ8_MEMBER(apple2_state::apple2_c080_r) -{ - if(!space.debugger_access()) - { - device_a2bus_card_interface *slotdevice; - int slot; - - offset &= 0x7F; - slot = offset / 0x10; - - if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS) || (m_machinetype == LASER128)) - { - if (slot == 1) - { - offset &= 0xf; - if (offset >= 8 && offset <= 0xb) - { - return m_acia1->read(space, offset-8); - } - } - else if (slot == 2) - { - offset &= 0xf; - if (offset >= 8 && offset <= 0xb) - { - return m_acia2->read(space, offset-8); - } - } - } - - if ((m_machinetype == APPLE_IICPLUS) && (slot == 6)) - { - offset &= 0xf; - return m_iicpiwm->read(offset); - } - - if ((m_machinetype == LASER128) && (slot == 5)) - { - offset &= 0xf; - UINT8 retval = m_exp_regs[offset]; - - if (offset == 3) - { - retval = m_exp_ram[m_exp_liveptr&m_exp_addrmask]; - m_exp_liveptr++; - m_exp_regs[0] = m_exp_liveptr & 0xff; - m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; - } - - return retval; - } - - if ((m_machinetype == LASER128) && (slot == 6)) - { - offset &= 0xf; - return m_laserudc->read(offset); - } - - /* now identify the device */ - slotdevice = m_a2bus->get_a2bus_card(slot); - - /* and if we can, read from the slot */ - if (slotdevice != NULL) - { - return slotdevice->read_c0nx(space, offset % 0x10); - } - } - - return 0; -} - - -WRITE8_MEMBER(apple2_state::apple2_c080_w) -{ - device_a2bus_card_interface *slotdevice; - int slot; - - offset &= 0x7F; - slot = offset / 0x10; - - if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS) || (m_machinetype == LASER128)) - { - if (slot == 1) - { - offset &= 0xf; - if (offset >= 8 && offset <= 0xb) - { - m_acia1->write(space, offset-8, data); - return; - } - } - else if (slot == 2) - { - offset &= 0xf; - if (offset >= 8 && offset <= 0xb) - { - m_acia2->write(space, offset-8, data); - return; - } - } - } - - if ((m_machinetype == APPLE_IICPLUS) && (slot == 6)) - { - offset &= 0xf; - m_iicpiwm->write(offset, data); - return; - } - - if ((m_machinetype == LASER128) && (slot == 5)) - { - switch (offset & 0xf) - { - case 0: - m_exp_wptr &= ~0xff; - m_exp_wptr |= data; - m_exp_regs[0] = m_exp_wptr & 0xff; - m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; - m_exp_liveptr = m_exp_wptr; - break; - - case 1: - m_exp_wptr &= ~0xff00; - m_exp_wptr |= (data<<8); - m_exp_regs[0] = m_exp_wptr & 0xff; - m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; - m_exp_liveptr = m_exp_wptr; - break; - - case 2: - m_exp_wptr &= ~0xff0000; - m_exp_wptr |= (data<<16); - m_exp_regs[0] = m_exp_wptr & 0xff; - m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; - m_exp_liveptr = m_exp_wptr; - break; - - case 3: - // printf("Write %02x to RAM[%x]\n", data, m_liveptr); - m_exp_ram[(m_exp_liveptr&m_exp_addrmask)] = data; - m_exp_liveptr++; - m_exp_regs[0] = m_exp_liveptr & 0xff; - m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; - m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; - break; - - default: - m_exp_regs[offset] = data; - break; - } - } - - if ((m_machinetype == LASER128) && (slot == 6)) - { - offset &= 0xf; - m_laserudc->write(space, offset, data); - return; - } - - /* now identify the device */ - slotdevice = m_a2bus->get_a2bus_card(slot); - - /* and if we can, write to the slot */ - if (slotdevice != NULL) - { - slotdevice->write_c0nx(space, offset % 0x10, data); - } -} - -/* returns default CnXX slotram for a slot space */ -INT8 apple2_state::apple2_slotram_r(address_space &space, int slotnum, int offset) -{ - if (m_slot_ram) - { - if (!space.debugger_access()) - { -// printf("slotram_r: taking cnxx_slot to -1\n"); - m_a2_cnxx_slot = -1; - apple2_update_memory(); - } - - return m_slot_ram[offset]; - } - - // else fall through to floating bus - return apple2_getfloatingbusvalue(); -} - -READ8_MEMBER(apple2_state::apple2_c1xx_r ) -{ - int slotnum; - device_a2bus_card_interface *slotdevice; - - slotnum = ((offset>>8) & 0xf) + 1; - slotdevice = m_a2bus->get_a2bus_card(slotnum); - - if (slotdevice != NULL) - { - if ((slotdevice->take_c800()) && (!space.debugger_access())) - { -// printf("c1xx_r: taking cnxx_slot to %d\n", slotnum); - m_a2_cnxx_slot = slotnum; - apple2_update_memory(); - } - - return slotdevice->read_cnxx(space, offset&0xff); - } - else - { - return apple2_slotram_r(space, slotnum, offset); - } - - // else fall through to floating bus - // never executed - //return apple2_getfloatingbusvalue(); -} - -WRITE8_MEMBER(apple2_state::apple2_c1xx_w ) -{ - int slotnum; - device_a2bus_card_interface *slotdevice; - - slotnum = ((offset>>8) & 0xf) + 1; - - slotdevice = m_a2bus->get_a2bus_card(slotnum); - - if (slotdevice != NULL) - { - slotdevice->write_cnxx(space, offset&0xff, data); - } - else - { - if (m_slot_ram) - m_slot_ram[offset] = data; - } -} - -READ8_MEMBER(apple2_state::apple2_c3xx_r ) -{ - int slotnum; - device_a2bus_card_interface *slotdevice; - - slotnum = 3; - slotdevice = m_a2bus->get_a2bus_card(slotnum); - - // is a card installed in this slot? - if (slotdevice != NULL) - { - if ((slotdevice->take_c800()) && (!space.debugger_access())) - { -// printf("c3xx_r: taking cnxx_slot to %d\n", slotnum); - m_a2_cnxx_slot = slotnum; - apple2_update_memory(); - } - return slotdevice->read_cnxx(space, offset&0xff); - } - else - { - return apple2_slotram_r(space, slotnum, offset); - } - - // else fall through to floating bus - // never executed - //return apple2_getfloatingbusvalue(); -} - -WRITE8_MEMBER(apple2_state::apple2_c3xx_w ) -{ - int slotnum; - device_a2bus_card_interface *slotdevice; - - slotnum = 3; - slotdevice = m_a2bus->get_a2bus_card(slotnum); - - if (slotdevice != NULL) - { - if ((slotdevice->take_c800()) && (!space.debugger_access())) - { -// printf("c3xx_w: taking cnxx_slot to %d\n", slotnum); - m_a2_cnxx_slot = slotnum; - apple2_update_memory(); - } - slotdevice->write_cnxx(space, offset&0xff, data); - } - else - { - if (m_slot_ram) - m_slot_ram[offset] = data; - } -} - -READ8_MEMBER(apple2_state::apple2_c4xx_r ) -{ - int slotnum; - device_a2bus_card_interface *slotdevice; - - slotnum = ((offset>>8) & 0xf) + 4; - slotdevice = m_a2bus->get_a2bus_card(slotnum); - - // is a card installed in this slot? - if (slotdevice != NULL) - { - if (slotdevice->take_c800() && (m_a2_cnxx_slot != slotnum) && (!space.debugger_access())) - { - m_a2_cnxx_slot = slotnum; - apple2_update_memory(); - } - return slotdevice->read_cnxx(space, offset&0xff); - } - else - { - return apple2_slotram_r(space, slotnum, offset); - } - - // else fall through to floating bus - // never executed - //return apple2_getfloatingbusvalue(); -} - -WRITE8_MEMBER ( apple2_state::apple2_c4xx_w ) -{ - int slotnum; - device_a2bus_card_interface *slotdevice; - - slotnum = ((offset>>8) & 0xf) + 4; - slotdevice = m_a2bus->get_a2bus_card(slotnum); - - if (slotdevice != NULL) - { - if ((slotdevice->take_c800()) && (!space.debugger_access())) - { -// printf("c4xx_w: taking cnxx_slot to %d\n", slotnum); - m_a2_cnxx_slot = slotnum; - apple2_update_memory(); - } - slotdevice->write_cnxx(space, offset&0xff, data); - } - else - { - if (m_slot_ram) - m_slot_ram[offset] = data; - } -} - -READ8_MEMBER(apple2_state::apple2_cfff_r) -{ - // debugger guard - if (!space.debugger_access()) - { -// printf("cfff_r: taking cnxx_slot to -1\n"); - m_a2_cnxx_slot = -1; - apple2_update_memory(); - } - - return apple2_getfloatingbusvalue(); -} - -WRITE8_MEMBER(apple2_state::apple2_cfff_w) -{ - if (!space.debugger_access()) - { -// printf("cfff_w: taking cnxx_slot to -1\n"); - m_a2_cnxx_slot = -1; - apple2_update_memory(); - } -} - -READ8_MEMBER(apple2_state::apple2_c800_r ) -{ - device_a2bus_card_interface *slotdevice; - - slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); - - if (slotdevice != NULL) - { - return slotdevice->read_c800(space, offset&0xfff); - } - - return apple2_getfloatingbusvalue(); -} - -WRITE8_MEMBER(apple2_state::apple2_c800_w ) -{ - device_a2bus_card_interface *slotdevice; - - slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); - - if (slotdevice != NULL) - { - slotdevice->write_c800(space, offset&0xfff, data); - } -} - -READ8_MEMBER(apple2_state::apple2_ce00_r ) -{ - device_a2bus_card_interface *slotdevice; - - slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); - - if (slotdevice != NULL) - { - return slotdevice->read_c800(space, (offset&0xfff) + 0x600); - } - - return apple2_getfloatingbusvalue(); -} - -WRITE8_MEMBER(apple2_state::apple2_ce00_w ) -{ - device_a2bus_card_interface *slotdevice; - - slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); - - if (slotdevice != NULL) - { - slotdevice->write_c800(space, (offset&0xfff)+0x600, data); - } -} - -READ8_MEMBER(apple2_state::apple2_inh_d000_r ) -{ - device_a2bus_card_interface *slotdevice; - - slotdevice = m_a2bus->get_a2bus_card(m_inh_slot); - - if (slotdevice != NULL) - { - return slotdevice->read_inh_rom(space, offset & 0xfff); - } - - return apple2_getfloatingbusvalue(); -} - -WRITE8_MEMBER(apple2_state::apple2_inh_d000_w ) -{ - device_a2bus_card_interface *slotdevice; - - slotdevice = m_a2bus->get_a2bus_card(m_inh_slot); - - if (slotdevice != NULL) - { - return slotdevice->write_inh_rom(space, offset & 0xfff, data); - } -} - -READ8_MEMBER(apple2_state::apple2_inh_e000_r ) -{ - device_a2bus_card_interface *slotdevice; - - slotdevice = m_a2bus->get_a2bus_card(m_inh_slot); - - if (slotdevice != NULL) - { - return slotdevice->read_inh_rom(space, (offset & 0x1fff) + 0x1000); - } - - return apple2_getfloatingbusvalue(); -} - -WRITE8_MEMBER(apple2_state::apple2_inh_e000_w ) -{ - device_a2bus_card_interface *slotdevice; - - slotdevice = m_a2bus->get_a2bus_card(m_inh_slot); - - if (slotdevice != NULL) - { - slotdevice->write_inh_rom(space, (offset & 0x1fff) + 0x1000, data); - } -} - -static void apple2_mem_0000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - meminfo->read_handler = (state->m_flags & VAR_ALTZP) ? &state->read_delegates_0000[0] : &state->read_delegates_0000[1]; - meminfo->write_handler = (state->m_flags & VAR_ALTZP) ? &state->write_delegates_0000[0] : &state->write_delegates_0000[1]; -} - -static void apple2_mem_0200(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_0200[0] : &state->read_delegates_0200[1]; - meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_0200[0] : &state->write_delegates_0200[1]; -} - -static void apple2_mem_0400(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - - if (state->m_flags & VAR_80STORE) - { - meminfo->read_handler = (state->m_flags & VAR_PAGE2) ? &state->read_delegates_0400[0] : &state->read_delegates_0400[1]; - meminfo->write_handler = (state->m_flags & VAR_PAGE2) ? &state->write_delegates_0400[0] : &state->write_delegates_0400[1]; - } - else - { - meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_0400[0] : &state->read_delegates_0400[1]; - meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_0400[0] : &state->write_delegates_0400[1]; - } -} - -static void apple2_mem_0800(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_0800[0] : &state->read_delegates_0800[1]; - meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_0800[0] : &state->write_delegates_0800[1]; -} - -static void apple2_mem_2000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - if ((state->m_flags & (VAR_80STORE|VAR_HIRES)) == (VAR_80STORE|VAR_HIRES)) - { - meminfo->read_handler = (state->m_flags & VAR_PAGE2) ? &state->read_delegates_2000[0] : &state->read_delegates_2000[1]; - meminfo->write_handler = (state->m_flags & VAR_PAGE2) ? &state->write_delegates_2000[0] : &state->write_delegates_2000[1]; - } - else - { - meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_2000[0] : &state->read_delegates_2000[1]; - meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_2000[0] : &state->write_delegates_2000[1]; - } -} - -static void apple2_mem_4000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - meminfo->read_handler = (state->m_flags & VAR_RAMRD) ? &state->read_delegates_4000[0] : &state->read_delegates_4000[1]; - meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_4000[0] : &state->write_delegates_4000[1]; -} - -static void apple2_mem_C000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - meminfo->read_handler = &state->rd_c000; - meminfo->write_handler = &state->wd_c000; -} - -static void apple2_mem_C080(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - - meminfo->read_handler = &state->rd_c080; - meminfo->write_handler = &state->wd_c080; -} - -static void tk2000_mem_C100(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - - if (state->m_flags & VAR_TK2000RAM) - { - meminfo->read_mem = 0x00C100; - meminfo->write_mem = 0x00C100; - } - else - { - meminfo->read_mem = (begin & 0x3fff) | APPLE2_MEM_ROM; - meminfo->write_mem = 0x00C100; - } -} - -static void apple2_mem_CFFF(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - - meminfo->read_handler = &state->rd_cfff; - meminfo->write_handler = &state->wd_cfff; -} - -static void apple2_mem_Cx00(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - if (state->m_flags & VAR_INTCXROM) - { - meminfo->read_mem = (begin & 0x0FFF) | (state->m_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM; - meminfo->write_mem = APPLE2_MEM_FLOATING; - } - else - { - meminfo->read_mem = ((begin & 0x0FFF) - 0x100) | APPLE2_MEM_SLOT; - meminfo->write_mem = ((begin & 0x0FFF) - 0x100) | APPLE2_MEM_SLOT; - } -} - -static void apple2_mem_C300(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - - if (((state->m_flags & (VAR_INTCXROM|VAR_SLOTC3ROM)) != VAR_SLOTC3ROM) && !(state->m_flags_mask & VAR_SLOTC3ROM)) - { - meminfo->read_mem = (begin & 0x0FFF) | (state->m_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM; - meminfo->write_mem = APPLE2_MEM_FLOATING; - } - else - { - meminfo->read_mem = ((begin & 0x0FFF) - 0x100) | APPLE2_MEM_SLOT; - meminfo->write_mem = ((begin & 0x0FFF) - 0x100) | APPLE2_MEM_SLOT; - } -} - -static void apple2_mem_C800(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - if ((state->m_flags & VAR_INTCXROM) || (state->m_a2_cnxx_slot == -1)) - { - meminfo->read_mem = (begin & 0x0FFF) | (state->m_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM; - meminfo->write_mem = APPLE2_MEM_FLOATING; - } - else - { - meminfo->read_handler = &state->rd_c800; - meminfo->write_handler = &state->wd_c800; - } -} - -static void apple2_mem_CE00(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - if ((state->m_flags & VAR_ROMSWITCH) && !strcmp(machine.system().name, "apple2cp")) - { - meminfo->read_mem = APPLE2_MEM_AUX; - meminfo->write_mem = APPLE2_MEM_AUX; - } - else - { - if ((state->m_flags & VAR_INTCXROM) || (state->m_a2_cnxx_slot == -1)) - { - meminfo->read_mem = (begin & 0x0FFF) | (state->m_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM; - meminfo->write_mem = APPLE2_MEM_FLOATING; - } - else - { - meminfo->read_handler = &state->rd_ce00; - meminfo->write_handler = &state->wd_ce00; - } - } -} - -static void apple2_mem_D000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - - if (state->m_inh_slot == -1) - { - if (state->m_flags & VAR_LCRAM) - { - if (state->m_flags & VAR_LCRAM2) - { - meminfo->read_handler = (state->m_flags & VAR_ALTZP) ? &state->read_delegates_c000[0] : &state->read_delegates_c000[1]; - } - else - { - meminfo->read_handler = (state->m_flags & VAR_ALTZP) ? &state->read_delegates_d000[0] : &state->read_delegates_d000[1]; - } - } - else - { - meminfo->read_mem = (state->m_flags & VAR_ROMSWITCH) ? 0x005000 : 0x001000; - meminfo->read_mem |= APPLE2_MEM_ROM; - } - - if (state->m_flags & VAR_LCWRITE) - { - if (state->m_flags & VAR_LCRAM2) - { - meminfo->write_handler = (state->m_flags & VAR_ALTZP) ? &state->write_delegates_c000[0] : &state->write_delegates_c000[1]; - } - else - { - meminfo->write_handler = (state->m_flags & VAR_ALTZP) ? &state->write_delegates_d000[0] : &state->write_delegates_d000[1]; - } - } - else - { - meminfo->write_mem = APPLE2_MEM_FLOATING; - } - } - else - { - meminfo->read_handler = &state->rd_inh_d000; - meminfo->write_handler = &state->wd_inh_d000; - } -} - -static void apple2_mem_E000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2_state *state = machine.driver_data(); - - if (state->m_inh_slot == -1) - { - if (state->m_flags & VAR_LCRAM) - { - meminfo->read_handler = (state->m_flags & VAR_ALTZP) ? &state->read_delegates_e000[0] : &state->read_delegates_e000[1]; - } - else - { - meminfo->read_mem = (state->m_flags & VAR_ROMSWITCH) ? 0x006000 : 0x002000; - meminfo->read_mem |= APPLE2_MEM_ROM; - } - - if (state->m_flags & VAR_LCWRITE) - { - meminfo->write_handler = (state->m_flags & VAR_ALTZP) ? &state->write_delegates_e000[0] : &state->write_delegates_e000[1]; - } - else - { - meminfo->write_mem = APPLE2_MEM_FLOATING; - } - } - else - { - meminfo->read_handler = &state->rd_inh_e000; - meminfo->write_handler = &state->wd_inh_e000; - } -} - - - -static const apple2_memmap_entry apple2_memmap_entries[] = -{ - { 0x0000, 0x01FF, apple2_mem_0000, A2MEM_MONO }, - { 0x0200, 0x03FF, apple2_mem_0200, A2MEM_DUAL }, - { 0x0400, 0x07FF, apple2_mem_0400, A2MEM_DUAL }, - { 0x0800, 0x1FFF, apple2_mem_0800, A2MEM_DUAL }, - { 0x2000, 0x3FFF, apple2_mem_2000, A2MEM_DUAL }, - { 0x4000, 0xBFFF, apple2_mem_4000, A2MEM_DUAL }, - { 0xC000, 0xC07F, apple2_mem_C000, A2MEM_IO }, - { 0xC080, 0xC0FF, apple2_mem_C080, A2MEM_IO }, - { 0xC100, 0xC2FF, apple2_mem_Cx00, A2MEM_MONO }, - { 0xC300, 0xC3FF, apple2_mem_C300, A2MEM_MONO }, - { 0xC400, 0xC7FF, apple2_mem_Cx00, A2MEM_MONO }, - { 0xC800, 0xCDFF, apple2_mem_C800, A2MEM_MONO }, - { 0xCE00, 0xCFFE, apple2_mem_CE00, A2MEM_MONO }, - { 0xCFFF, 0xCFFF, apple2_mem_CFFF, A2MEM_IO }, - { 0xD000, 0xDFFF, apple2_mem_D000, A2MEM_DUAL }, - { 0xE000, 0xFFFF, apple2_mem_E000, A2MEM_DUAL }, - { 0 } -}; - - -static const apple2_memmap_entry tk2000_memmap_entries[] = -{ - { 0x0000, 0x01FF, apple2_mem_0000, A2MEM_MONO }, - { 0x0200, 0x03FF, apple2_mem_0200, A2MEM_DUAL }, - { 0x0400, 0x07FF, apple2_mem_0400, A2MEM_DUAL }, - { 0x0800, 0x1FFF, apple2_mem_0800, A2MEM_DUAL }, - { 0x2000, 0x3FFF, apple2_mem_2000, A2MEM_DUAL }, - { 0x4000, 0xBFFF, apple2_mem_4000, A2MEM_DUAL }, - { 0xC000, 0xC07F, apple2_mem_C000, A2MEM_IO }, - { 0xC080, 0xC0FF, apple2_mem_C080, A2MEM_IO }, - { 0xC100, 0xFFFF, tk2000_mem_C100, A2MEM_DUAL }, - { 0 } -}; - -void apple2_state::apple2_setvar(UINT32 val, UINT32 mask) -{ - LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, - (unsigned int) m_maincpu->pc())); - - assert((val & mask) == val); - - /* apply mask and set */ - val &= m_a2_mask; - val |= m_a2_set; - - /* change the softswitch */ - m_flags &= ~mask; - m_flags |= val; - - // disable flags that don't apply (INTCXROM/SLOTC3ROM on II/II+ for instance) - m_flags &= ~m_flags_mask; - - apple2_update_memory(); -} - - - -/* ----------------------------------------------------------------------- - * Floating bus code - * - * preliminary floating bus video scanner code - look for comments - * with FIX: - * ----------------------------------------------------------------------- */ - -UINT8 apple2_state::apple2_getfloatingbusvalue() -{ - enum - { - // scanner types - kScannerNone = 0, kScannerApple2, kScannerApple2e, - - // scanner constants - kHBurstClock = 53, // clock when Color Burst starts - kHBurstClocks = 4, // clocks per Color Burst duration - kHClock0State = 0x18, // H[543210] = 011000 - kHClocks = 65, // clocks per horizontal scan (including HBL) - kHPEClock = 40, // clock when HPE (horizontal preset enable) goes low - kHPresetClock = 41, // clock when H state presets - kHSyncClock = 49, // clock when HSync starts - kHSyncClocks = 4, // clocks per HSync duration - kNTSCScanLines = 262, // total scan lines including VBL (NTSC) - kNTSCVSyncLine = 224, // line when VSync starts (NTSC) - kPALScanLines = 312, // total scan lines including VBL (PAL) - kPALVSyncLine = 264, // line when VSync starts (PAL) - kVLine0State = 0x100, // V[543210CBA] = 100000000 - kVPresetLine = 256, // line when V state presets - kVSyncLines = 4, // lines per VSync duration - kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? - }; - - // vars - // - int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ - h_clock, h_state, h_0, h_1, h_2, h_3, h_4, h_5, - v_line, v_state, v_A, v_B, v_C, v_0, v_1, v_2, v_3, v_4, /* v_5, */ - _hires, addend0, addend1, addend2, sum, address; - - // video scanner data - // - i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync - - // machine state switches - // - Hires = (m_flags & VAR_HIRES) ? 1 : 0; - Mixed = (m_flags & VAR_MIXED) ? 1 : 0; - Page2 = (m_flags & VAR_PAGE2) ? 1 : 0; - _80Store = (m_flags & VAR_80STORE) ? 1 : 0; - - // calculate video parameters according to display standard - // - ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? - // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? - // ScanCycles = ScanLines * kHClocks; - - // calculate horizontal scanning state - // - h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock - h_state = kHClock0State + h_clock; // H state bits - if (h_clock >= kHPresetClock) // check for horizontal preset - { - h_state -= 1; // correct for state preset (two 0 states) - } - h_0 = (h_state >> 0) & 1; // get horizontal state bits - h_1 = (h_state >> 1) & 1; - h_2 = (h_state >> 2) & 1; - h_3 = (h_state >> 3) & 1; - h_4 = (h_state >> 4) & 1; - h_5 = (h_state >> 5) & 1; - - // calculate vertical scanning state - // - v_line = i / kHClocks; // which vertical scanning line - v_state = kVLine0State + v_line; // V state bits - if ((v_line >= kVPresetLine)) // check for previous vertical state preset - { - v_state -= ScanLines; // compensate for preset - } - v_A = (v_state >> 0) & 1; // get vertical state bits - v_B = (v_state >> 1) & 1; - v_C = (v_state >> 2) & 1; - v_0 = (v_state >> 3) & 1; - v_1 = (v_state >> 4) & 1; - v_2 = (v_state >> 5) & 1; - v_3 = (v_state >> 6) & 1; - v_4 = (v_state >> 7) & 1; - //v_5 = (v_state >> 8) & 1; - - // calculate scanning memory address - // - _hires = Hires; - if (Hires && Mixed && (v_4 & v_2)) - { - _hires = 0; // (address is in text memory) - } - - addend0 = 0x68; // 1 1 0 1 - addend1 = (h_5 << 5) | (h_4 << 4) | (h_3 << 3); - addend2 = (v_4 << 6) | (v_3 << 5) | (v_4 << 4) | (v_3 << 3); - sum = (addend0 + addend1 + addend2) & (0x0F << 3); - - address = 0; - address |= h_0 << 0; // a0 - address |= h_1 << 1; // a1 - address |= h_2 << 2; // a2 - address |= sum; // a3 - aa6 - address |= v_0 << 7; // a7 - address |= v_1 << 8; // a8 - address |= v_2 << 9; // a9 - address |= ((_hires) ? v_A : (1 ^ (Page2 & (1 ^ _80Store)))) << 10; // a10 - address |= ((_hires) ? v_B : (Page2 & (1 ^ _80Store))) << 11; // a11 - if (_hires) // hires? - { - // Y: insert hires only address bits - // - address |= v_C << 12; // a12 - address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 - address |= (Page2 & (1 ^ _80Store)) << 14; // a14 - } - else - { - // N: text, so no higher address bits unless Apple ][, not Apple //e - // - if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) - (kHPEClock <= h_clock) && // Y: HBL? - (h_clock <= (kHClocks - 1))) - { - address |= 1 << 12; // Y: a12 (add $1000 to address!) - } - } - - // update VBL' state - // - if (v_4 & v_3) // VBL? - { - //CMemory::mState &= ~CMemory::kVBLBar; // Y: VBL' is false // FIX: MESS? - } - else - { - //CMemory::mState |= CMemory::kVBLBar; // N: VBL' is true // FIX: MESS? - } - - return m_ram->pointer()[address % m_ram->size()]; // FIX: this seems to work, but is it right!? -} - - - -/* ----------------------------------------------------------------------- - * Machine reset - * ----------------------------------------------------------------------- */ - -void apple2_state::machine_reset() -{ - int need_intcxrom; - - m_reset_flag = 0; - m_rambase = m_ram->pointer(); - apple2_refresh_delegates(); - - need_intcxrom = !strcmp(machine().system().name, "apple2c") - || !strcmp(machine().system().name, "apple2c0") - || !strcmp(machine().system().name, "apple2c3") - || !strcmp(machine().system().name, "apple2c4") - || !strcmp(machine().system().name, "prav8c") - || !strcmp(machine().system().name, "apple2cp") - || !strncmp(machine().system().name, "apple2g", 7); - apple2_setvar(need_intcxrom ? VAR_INTCXROM : 0, ~0); - - // IIgs ROM 0 cannot boot unless language card bank 2 is write-enabled (but read ROM) on startup - // Peter Ferrie reports this is also the default on the IIe/IIc at least - apple2_setvar(VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2); - - m_a2_speaker_state = 0; - - m_a2_cnxx_slot = -1; // bank in ROM at C800 on reset - - m_joystick_x1_time = m_joystick_y1_time = 0; - m_joystick_x2_time = m_joystick_y2_time = 0; - - memset(m_exp_regs, 0, sizeof(UINT8) * 0x10); - m_exp_wptr = m_exp_liveptr = 0; - -} - -int apple2_state::a2_no_ctrl_reset() -{ - return (((m_kbrepeat != NULL) && (m_resetdip == NULL)) || - ((m_resetdip != NULL) && !m_resetdip->read())); -} - -/* ----------------------------------------------------------------------- - * Apple II interrupt; used to force partial updates - * ----------------------------------------------------------------------- */ - -TIMER_DEVICE_CALLBACK_MEMBER(apple2_state::apple2_interrupt) -{ - int scanline = param; - - if((scanline % 8) == 0) - machine().first_screen()->update_partial(machine().first_screen()->vpos()); - if ((m_kbspecial->read() & 0x80) && - (a2_no_ctrl_reset() || (m_kbspecial->read() & 0x08))) - { - if (!m_reset_flag) - { - m_reset_flag = 1; - /* using PULSE_LINE does not allow us to press and hold key */ - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - } - return; - } - - if (m_reset_flag) - { - m_reset_flag = 0; - m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - machine().schedule_soft_reset(); - } -} - - - -/*************************************************************************** - apple2_mainramxx00_r - apple2_mainramxx00_w - apple2_auxramxx00_r - apple2_auxramxx00_w -***************************************************************************/ - -READ8_MEMBER ( apple2_state::apple2_mainram0000_r ) -{ - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_mainram0200_r ) -{ - offset += 0x200; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_mainram0400_r ) -{ - offset += 0x400; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_mainram0800_r ) -{ - offset += 0x800; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_mainram2000_r ) -{ - offset += 0x2000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_mainram4000_r ) -{ - offset += 0x4000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_mainramc000_r ) -{ - offset += 0xc000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_mainramd000_r ) -{ - offset += 0xd000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_mainrame000_r ) -{ - offset += 0xe000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxram0000_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x10000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxram0200_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset+0x200); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x10200; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxram0400_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset+0x400); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x10400; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxram0800_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset+0x800); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x10800; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxram2000_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset+0x2000); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x12000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxram4000_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset+0x4000); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x14000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxramc000_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset+0xc000); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x1c000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxramd000_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset+0xd000); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x1d000; - return m_rambase[offset]; -} - -READ8_MEMBER ( apple2_state::apple2_auxrame000_r ) -{ - if (m_auxslotdevice) - { - return m_auxslotdevice->read_auxram(offset+0xe000); - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return 0xff; - } - - offset += 0x1e000; - return m_rambase[offset]; -} - - -WRITE8_MEMBER ( apple2_state::apple2_mainram0000_w ) -{ - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_mainram0200_w ) -{ - offset += 0x200; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_mainram0400_w ) -{ - offset += 0x400; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_mainram0800_w ) -{ - offset += 0x800; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_mainram2000_w ) -{ - offset += 0x2000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_mainram4000_w ) -{ - offset += 0x4000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_mainramc000_w ) -{ - offset += 0xc000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_mainramd000_w ) -{ - offset += 0xd000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_mainrame000_w ) -{ - offset += 0xe000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxram0000_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x10000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxram0200_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset+0x200, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x10200; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxram0400_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset+0x400, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x10400; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxram0800_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset+0x800, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x10800; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxram2000_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset+0x2000, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x12000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxram4000_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset+0x4000, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x14000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxramc000_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset+0xc000, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x1c000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxramd000_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset+0xd000, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x1d000; - m_rambase[offset] = data; -} - -WRITE8_MEMBER ( apple2_state::apple2_auxrame000_w ) -{ - if (m_auxslotdevice) - { - m_auxslotdevice->write_auxram(offset+0xe000, data); - return; - } - else if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - return; - } - - offset += 0x1e000; - m_rambase[offset] = data; -} - -/*************************************************************************** - apple2_c00x_r -***************************************************************************/ - -READ8_MEMBER ( apple2_state::apple2_c00x_r ) -{ - UINT8 result = 0; - - if(!space.debugger_access()) - { - /* Read the keyboard data and strobe */ - g_profiler.start(PROFILER_C00X); - result = m_transchar | m_strobe; - g_profiler.stop(); - } - - - - return result; -} - - - -/*************************************************************************** - apple2_c00x_w - - C000 80STOREOFF - C001 80STOREON - use 80-column memory mapping - C002 RAMRDOFF - C003 RAMRDON - read from aux 48k - C004 RAMWRTOFF - C005 RAMWRTON - write to aux 48k - C006 INTCXROMOFF - C007 INTCXROMON - C008 ALTZPOFF - C009 ALTZPON - use aux ZP, stack and language card area - C00A SLOTC3ROMOFF - C00B SLOTC3ROMON - use external slot 3 ROM - C00C 80COLOFF - C00D 80COLON - use 80-column display mode - C00E ALTCHARSETOFF - C00F ALTCHARSETON - use alt character set -***************************************************************************/ - -WRITE8_MEMBER ( apple2_state::apple2_c00x_w ) -{ - UINT32 mask; - - mask = 1 << (offset / 2); - apple2_setvar((offset & 1) ? mask : 0, mask); -} - - - -/*************************************************************************** - apple2_c01x_r -***************************************************************************/ - -READ8_MEMBER( apple2_state::apple2_c01x_r ) -{ - UINT8 result = apple2_getfloatingbusvalue() & 0x7F; - - if(!space.debugger_access()) - { - g_profiler.start(PROFILER_C01X); - - LOG(("a2 softswitch_r: %04x\n", offset + 0xc010)); - switch (offset) - { - case 0x00: result |= m_transchar | m_strobe; m_strobe = 0; break; - case 0x01: result |= (m_flags & VAR_LCRAM2) ? 0x80 : 0x00; break; - case 0x02: result |= (m_flags & VAR_LCRAM) ? 0x80 : 0x00; break; - case 0x03: result |= (m_flags & VAR_RAMRD) ? 0x80 : 0x00; break; - case 0x04: result |= (m_flags & VAR_RAMWRT) ? 0x80 : 0x00; break; - case 0x05: result |= (m_flags & VAR_INTCXROM) ? 0x80 : 0x00; break; - case 0x06: result |= (m_flags & VAR_ALTZP) ? 0x80 : 0x00; break; - case 0x07: result |= (m_flags & VAR_SLOTC3ROM) ? 0x80 : 0x00; break; - case 0x08: result |= (m_flags & VAR_80STORE) ? 0x80 : 0x00; break; - case 0x09: result |= !space.machine().first_screen()->vblank() ? 0x80 : 0x00; break; - case 0x0A: result |= (m_flags & VAR_TEXT) ? 0x80 : 0x00; break; - case 0x0B: result |= (m_flags & VAR_MIXED) ? 0x80 : 0x00; break; - case 0x0C: result |= (m_flags & VAR_PAGE2) ? 0x80 : 0x00; break; - case 0x0D: result |= (m_flags & VAR_HIRES) ? 0x80 : 0x00; break; - case 0x0E: result |= (m_flags & VAR_ALTCHARSET) ? 0x80 : 0x00; break; - case 0x0F: result |= (m_flags & VAR_80COL) ? 0x80 : 0x00; break; - } - - g_profiler.stop(); - } - - return result; -} - - - -/*************************************************************************** - apple2_c01x_w -***************************************************************************/ - -WRITE8_MEMBER( apple2_state::apple2_c01x_w ) -{ - /* Clear the keyboard strobe */ - g_profiler.start(PROFILER_C01X); - m_strobe = 0; - g_profiler.stop(); -} - - - -/*************************************************************************** - apple2_c02x_r -***************************************************************************/ - -READ8_MEMBER( apple2_state::apple2_c02x_r ) -{ - if(!space.debugger_access()) - { - apple2_c02x_w(space, offset, 0, 0); - } - return apple2_getfloatingbusvalue(); -} - - - -/*************************************************************************** - apple2_c02x_w -***************************************************************************/ - -WRITE8_MEMBER( apple2_state::apple2_c02x_w ) -{ - switch(offset) - { - case 0x08: - apple2_setvar((m_flags & VAR_ROMSWITCH) ^ VAR_ROMSWITCH, VAR_ROMSWITCH); - break; - } -} - - - -/*************************************************************************** - apple2_c03x_r -***************************************************************************/ - -READ8_MEMBER ( apple2_state::apple2_c03x_r ) -{ - if(!space.debugger_access()) - { - if (!offset) - { - speaker_sound_device *speaker = space.machine().device("a2speaker"); - - m_a2_speaker_state ^= 1; - speaker->level_w(m_a2_speaker_state); - } - } - return apple2_getfloatingbusvalue(); -} - - - -/*************************************************************************** - apple2_c03x_w -***************************************************************************/ - -WRITE8_MEMBER ( apple2_state::apple2_c03x_w ) -{ - apple2_c03x_r(space, offset, 0); -} - - - -/*************************************************************************** - apple2_c05x_r -***************************************************************************/ - -READ8_MEMBER ( apple2_state::apple2_c05x_r ) -{ - if(!space.debugger_access()) - { - UINT32 mask; - - if (m_machinetype == TK2000) - { - if (offset == 0xa) // RAM - { - apple2_setvar(VAR_TK2000RAM, ~0); - } - else if (offset == 0xb) // ROM - { - apple2_setvar(0, ~VAR_TK2000RAM); - } - } - - /* ANx has reverse SET logic */ - if (offset >= 8) - { - offset ^= 1; - } - - mask = 0x100 << (offset / 2); - apple2_setvar((offset & 1) ? mask : 0, mask); - } - return apple2_getfloatingbusvalue(); -} - - - -/*************************************************************************** - apple2_c05x_w -***************************************************************************/ - -WRITE8_MEMBER ( apple2_state::apple2_c05x_w ) -{ - apple2_c05x_r(space, offset, 0); -} - - - -/*************************************************************************** - apple2_c06x_r -***************************************************************************/ - -READ8_MEMBER ( apple2_state::apple2_c06x_r ) -{ - int result = 0; - if(!space.debugger_access()) - { - switch (offset & 0x0F) - { - case 0x00: - /* Cassette input */ - { - if (m_cassette) - { - result = m_cassette->input() > 0.0 ? 0x80 : 0; - } - else - { - result = 0; - } - } - break; - case 0x01: - /* Open-Apple/Joystick button 0 */ - result = apple2_pressed_specialkey(0x10); - break; - case 0x02: - /* Closed-Apple/Joystick button 1 */ - result = apple2_pressed_specialkey(0x20); - break; - case 0x03: - /* Joystick button 2. Later revision motherboards connected this to SHIFT also */ - result = apple2_pressed_specialkey(0x40); - break; - case 0x04: - /* X Joystick 1 axis */ - result = space.machine().time().as_double() < m_joystick_x1_time; - break; - case 0x05: - /* Y Joystick 1 axis */ - result = space.machine().time().as_double() < m_joystick_y1_time; - break; - case 0x06: - /* X Joystick 2 axis */ - result = space.machine().time().as_double() < m_joystick_x2_time; - break; - case 0x07: - /* Y Joystick 2 axis */ - result = space.machine().time().as_double() < m_joystick_y2_time; - break; - default: - /* c060 Empty Cassette head read - * and any other non joystick c06 port returns this according to applewin - */ - return apple2_getfloatingbusvalue(); - } - } - return result ? 0x80 : 0x00; -} - - - -/*************************************************************************** - apple2_c07x_r -***************************************************************************/ - -READ8_MEMBER ( apple2_state::apple2_c07x_r ) -{ - if(!space.debugger_access()) - { - double x_calibration = attotime::from_usec(12).as_double(); - double y_calibration = attotime::from_usec(13).as_double(); - - if (offset == 0) - { - m_joystick_x1_time = machine().time().as_double() + x_calibration * m_joy1x->read(); - m_joystick_y1_time = machine().time().as_double() + y_calibration * m_joy1y->read(); - m_joystick_x2_time = machine().time().as_double() + x_calibration * m_joy2x->read(); - m_joystick_y2_time = machine().time().as_double() + y_calibration * m_joy2y->read(); - } - } - return 0; -} - - - -/*************************************************************************** - apple2_c07x_w -***************************************************************************/ - -WRITE8_MEMBER ( apple2_state::apple2_c07x_w ) -{ - // this a machine with an aux slot? - if (m_auxslotdevice) - { - m_auxslotdevice->write_c07x(space, offset&0xf, data); - } - - // AE RamWorks manual indicates that even if the auxslot card sees the c07x write, - // so does the motherboard and it will trigger the paddles. So always call this. - apple2_c07x_r(space, offset, 0); -} - - - -/* ----------------------------------------------------------------------- - * Floppy disk controller - * ----------------------------------------------------------------------- */ - - -int apple2_state::apple2_fdc_has_35() -{ - return (floppy_get_count(machine())); // - apple525_get_count(machine)) > 0; -} - -int apple2_state::apple2_fdc_has_525() -{ - return 1; //apple525_get_count(machine) > 0; -} - -static void apple2_fdc_set_lines(device_t *device, UINT8 lines) -{ - apple2_state *state = device->machine().driver_data(); - if (state->m_fdc_diskreg & 0x40) - { - if (state->apple2_fdc_has_35()) - { - /* slot 5: 3.5" disks */ - sony_set_lines(device,lines); - } - } - else - { - if (state->apple2_fdc_has_525()) - { - /* slot 6: 5.25" disks */ - apple525_set_lines(device,lines); - } - } -} - - - -static void apple2_fdc_set_enable_lines(device_t *device,int enable_mask) -{ - apple2_state *state = device->machine().driver_data(); - int slot5_enable_mask = 0; - int slot6_enable_mask = 0; - - if (state->m_fdc_diskreg & 0x40) - slot5_enable_mask = enable_mask; - else - slot6_enable_mask = enable_mask; - - if (state->apple2_fdc_has_35()) - { - /* set the 3.5" enable lines */ - sony_set_enable_lines(device,slot5_enable_mask); - } - - if (state->apple2_fdc_has_525()) - { - /* set the 5.25" enable lines */ - apple525_set_enable_lines(device,slot6_enable_mask); - } -} - - - -static UINT8 apple2_fdc_read_data(device_t *device) -{ - apple2_state *state = device->machine().driver_data(); - UINT8 result = 0x00; - - if (state->m_fdc_diskreg & 0x40) - { - if (state->apple2_fdc_has_35()) - { - /* slot 5: 3.5" disks */ - result = sony_read_data(device); - } - } - else - { - if (state->apple2_fdc_has_525()) - { - /* slot 6: 5.25" disks */ - result = apple525_read_data(device); - } - } - return result; -} - - - -static void apple2_fdc_write_data(device_t *device, UINT8 data) -{ - apple2_state *state = device->machine().driver_data(); - if (state->m_fdc_diskreg & 0x40) - { - if (state->apple2_fdc_has_35()) - { - /* slot 5: 3.5" disks */ - sony_write_data(device,data); - } - } - else - { - if (state->apple2_fdc_has_525()) - { - /* slot 6: 5.25" disks */ - apple525_write_data(device,data); - } - } -} - - - -static int apple2_fdc_read_status(device_t *device) -{ - apple2_state *state = device->machine().driver_data(); - int result = 0; - - if (state->m_fdc_diskreg & 0x40) - { - if (state->apple2_fdc_has_35()) - { - /* slot 5: 3.5" disks */ - result = sony_read_status(device); - } - } - else - { - if (state->apple2_fdc_has_525()) - { - /* slot 6: 5.25" disks */ - result = apple525_read_status(device); - } - } - return result; -} - - -void apple2_state::apple2_iwm_setdiskreg(UINT8 data) -{ - m_fdc_diskreg = data & 0xC0; - if (apple2_fdc_has_35()) - sony_set_sel_line( machine().device("fdc"),m_fdc_diskreg & 0x80); -} - - -const applefdc_interface apple2_fdc_interface = -{ - apple2_fdc_set_lines, /* set_lines */ - apple2_fdc_set_enable_lines, /* set_enable_lines */ - - apple2_fdc_read_data, /* read_data */ - apple2_fdc_write_data, /* write_data */ - apple2_fdc_read_status /* read_status */ -}; - - - -/* ----------------------------------------------------------------------- - * Driver init - * ----------------------------------------------------------------------- */ - -void apple2_state::apple2_init_common() -{ - m_inh_slot = -1; - m_flags = 0; - m_fdc_diskreg = 0; - - // do these lookups once at startup - m_rom = memregion("maincpu")->base(); - m_rom_length = memregion("maincpu")->bytes() & ~0xFFF; - m_slot_length = memregion("maincpu")->bytes() - m_rom_length; - m_slot_ram = (m_slot_length > 0) ? &m_rom[m_rom_length] : NULL; - - m_auxslotdevice = NULL; - if (m_machinetype == APPLE_IIE || m_machinetype == TK3000) - { - m_auxslotdevice = m_a2eauxslot->get_a2eauxslot_card(); - } - - /* state save registers */ - save_item(NAME(m_flags)); - machine().save().register_postload(save_prepost_delegate(FUNC(apple2_state::apple2_update_memory_postload), this)); - - /* --------------------------------------------- * - * set up the softswitch mask/set * - * --------------------------------------------- */ - m_a2_mask = ~0; - m_a2_set = 0; - - /* disable VAR_ROMSWITCH if the ROM is only 16k */ - if (memregion("maincpu")->bytes() < 0x8000) - m_a2_mask &= ~VAR_ROMSWITCH; - - if (m_ram->size() <= 64*1024) - m_a2_mask &= ~(VAR_RAMRD | VAR_RAMWRT | VAR_80STORE | VAR_ALTZP | VAR_80COL); - - apple2_refresh_delegates(); -} - -void apple2_state::apple2eplus_init_common(void *apple2cp_ce00_ram) -{ - apple2_memmap_config mem_cfg; - - m_flags_mask = 0; - - apple2_init_common(); - - /* setup memory */ - memset(&mem_cfg, 0, sizeof(mem_cfg)); - mem_cfg.first_bank = 1; - mem_cfg.memmap = apple2_memmap_entries; - mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; - apple2_setup_memory(&mem_cfg); -} - -MACHINE_START_MEMBER(apple2_state,apple2c) -{ - m_machinetype = APPLE_IIC; - - apple2eplus_init_common((void *)NULL); -} - -MACHINE_START_MEMBER(apple2_state,tk3000) -{ - m_machinetype = TK3000; // enhanced IIe clone with Z80 keyboard scanner subcpu - - apple2eplus_init_common((void *)NULL); -} - -MACHINE_START_MEMBER(apple2_state,apple2cp) -{ - void *apple2cp_ce00_ram; - - /* there appears to be some hidden RAM that is swapped in on the Apple - * IIc plus; I have not found any official documentation but the BIOS - * clearly uses this area as writeable memory */ - apple2cp_ce00_ram = auto_alloc_array(machine(), UINT8, 0x200); - memset(apple2cp_ce00_ram, 0, sizeof(UINT8) * 0x200); - - m_machinetype = APPLE_IICPLUS; - - apple2eplus_init_common(apple2cp_ce00_ram); -} - -MACHINE_START_MEMBER(apple2_state,apple2e) -{ - apple2_memmap_config mem_cfg; - - m_flags_mask = 0; - - m_machinetype = APPLE_IIE; - - apple2_init_common(); - - /* setup memory */ - memset(&mem_cfg, 0, sizeof(mem_cfg)); - mem_cfg.first_bank = 1; - mem_cfg.memmap = apple2_memmap_entries; - mem_cfg.auxmem = (UINT8*)NULL; - apple2_setup_memory(&mem_cfg); -} - -MACHINE_START_MEMBER(apple2_state,laser128) -{ - apple2_memmap_config mem_cfg; - - m_flags_mask = 0; - m_machinetype = LASER128; - - apple2_init_common(); - - // 1 MB of expansion RAM in slot 5 - m_exp_ram = auto_alloc_array(machine(), UINT8, 1024*1024); - memset(m_exp_ram, 0xff, 1024*1024); - - m_exp_bankhior = 0xf0; - m_exp_addrmask = 0xfffff; - - // save memory expansion vars - save_item(NAME(m_exp_regs)); - save_item(NAME(m_exp_wptr)); - save_item(NAME(m_exp_liveptr)); - save_item(NAME(m_exp_bankhior)); - save_item(NAME(m_exp_addrmask)); - - /* setup memory */ - memset(&mem_cfg, 0, sizeof(mem_cfg)); - mem_cfg.first_bank = 1; - mem_cfg.memmap = apple2_memmap_entries; - mem_cfg.auxmem = (UINT8*)NULL; - apple2_setup_memory(&mem_cfg); -} - -MACHINE_START_MEMBER(apple2_state,apple2orig) -{ - apple2_memmap_config mem_cfg; - void *apple2cp_ce00_ram = NULL; - - // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states - m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; - - m_machinetype = APPLE_II; - - apple2_init_common(); - - /* setup memory */ - memset(&mem_cfg, 0, sizeof(mem_cfg)); - mem_cfg.first_bank = 1; - mem_cfg.memmap = apple2_memmap_entries; - mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; - apple2_setup_memory(&mem_cfg); -} - -MACHINE_START_MEMBER(apple2_state,space84) -{ - apple2_memmap_config mem_cfg; - void *apple2cp_ce00_ram = NULL; - - // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states - m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; - - m_machinetype = SPACE84; - - apple2_init_common(); - - /* setup memory */ - memset(&mem_cfg, 0, sizeof(mem_cfg)); - mem_cfg.first_bank = 1; - mem_cfg.memmap = apple2_memmap_entries; - mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; - apple2_setup_memory(&mem_cfg); -} - -MACHINE_START_MEMBER(apple2_state,laba2p) -{ - apple2_memmap_config mem_cfg; - void *apple2cp_ce00_ram = NULL; - - // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states - m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; - - m_machinetype = LABA2P; - - apple2_init_common(); - - /* setup memory */ - memset(&mem_cfg, 0, sizeof(mem_cfg)); - mem_cfg.first_bank = 1; - mem_cfg.memmap = apple2_memmap_entries; - mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; - apple2_setup_memory(&mem_cfg); -} - -MACHINE_START_MEMBER(apple2_state,tk2000) -{ - apple2_memmap_config mem_cfg; - - // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states - m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; - - m_machinetype = TK2000; - - apple2_init_common(); - - /* setup memory */ - memset(&mem_cfg, 0, sizeof(mem_cfg)); - mem_cfg.first_bank = 1; - mem_cfg.memmap = tk2000_memmap_entries; - mem_cfg.auxmem = (UINT8*)NULL; - apple2_setup_memory(&mem_cfg); -} - -int apple2_state::apple2_pressed_specialkey(UINT8 key) -{ - return ((m_kbspecial ? m_kbspecial->read() : 0) & key) - || ((m_joybuttons ? m_joybuttons->read() : 0) & key); -} - -void apple2_state::apple2_refresh_delegates() -{ - read_delegates_master[0] = read8_delegate(FUNC(apple2_state::read_floatingbus), this); - read_delegates_master[1] = read8_delegate(FUNC(apple2_state::apple2_c1xx_r), this); - read_delegates_master[2] = read8_delegate(FUNC(apple2_state::apple2_c3xx_r), this); - read_delegates_master[3] = read8_delegate(FUNC(apple2_state::apple2_c4xx_r), this); - write_delegates_master[0] = write8_delegate(FUNC(apple2_state::apple2_c1xx_w), this); - write_delegates_master[1] = write8_delegate(FUNC(apple2_state::apple2_c3xx_w), this); - write_delegates_master[2] = write8_delegate(FUNC(apple2_state::apple2_c4xx_w), this); - - rd_c000 = read8_delegate(FUNC(apple2_state::apple2_c0xx_r), this); - wd_c000 = write8_delegate(FUNC(apple2_state::apple2_c0xx_w), this); - - rd_c080 = read8_delegate(FUNC(apple2_state::apple2_c080_r), this); - wd_c080 = write8_delegate(FUNC(apple2_state::apple2_c080_w), this); - - rd_cfff = read8_delegate(FUNC(apple2_state::apple2_cfff_r), this); - wd_cfff = write8_delegate(FUNC(apple2_state::apple2_cfff_w), this); - - rd_c800 = read8_delegate(FUNC(apple2_state::apple2_c800_r), this); - wd_c800 = write8_delegate(FUNC(apple2_state::apple2_c800_w), this); - - rd_ce00 = read8_delegate(FUNC(apple2_state::apple2_ce00_r), this); - wd_ce00 = write8_delegate(FUNC(apple2_state::apple2_ce00_w), this); - - rd_inh_d000 = read8_delegate(FUNC(apple2_state::apple2_inh_d000_r), this); - wd_inh_d000 = write8_delegate(FUNC(apple2_state::apple2_inh_d000_w), this); - - rd_inh_e000 = read8_delegate(FUNC(apple2_state::apple2_inh_e000_r), this); - wd_inh_e000 = write8_delegate(FUNC(apple2_state::apple2_inh_e000_w), this); - - read_delegates_0000[0] = read8_delegate(FUNC(apple2_state::apple2_auxram0000_r), this); - read_delegates_0000[1] = read8_delegate(FUNC(apple2_state::apple2_mainram0000_r), this); - read_delegates_0200[0] = read8_delegate(FUNC(apple2_state::apple2_auxram0200_r), this); - read_delegates_0200[1] = read8_delegate(FUNC(apple2_state::apple2_mainram0200_r), this); - read_delegates_0400[0] = read8_delegate(FUNC(apple2_state::apple2_auxram0400_r), this); - read_delegates_0400[1] = read8_delegate(FUNC(apple2_state::apple2_mainram0400_r), this); - read_delegates_0800[0] = read8_delegate(FUNC(apple2_state::apple2_auxram0800_r), this); - read_delegates_0800[1] = read8_delegate(FUNC(apple2_state::apple2_mainram0800_r), this); - read_delegates_2000[0] = read8_delegate(FUNC(apple2_state::apple2_auxram2000_r), this); - read_delegates_2000[1] = read8_delegate(FUNC(apple2_state::apple2_mainram2000_r), this); - read_delegates_4000[0] = read8_delegate(FUNC(apple2_state::apple2_auxram4000_r), this); - read_delegates_4000[1] = read8_delegate(FUNC(apple2_state::apple2_mainram4000_r), this); - read_delegates_c000[0] = read8_delegate(FUNC(apple2_state::apple2_auxramc000_r), this); - read_delegates_c000[1] = read8_delegate(FUNC(apple2_state::apple2_mainramc000_r), this); - read_delegates_d000[0] = read8_delegate(FUNC(apple2_state::apple2_auxramd000_r), this); - read_delegates_d000[1] = read8_delegate(FUNC(apple2_state::apple2_mainramd000_r), this); - read_delegates_e000[0] = read8_delegate(FUNC(apple2_state::apple2_auxrame000_r), this); - read_delegates_e000[1] = read8_delegate(FUNC(apple2_state::apple2_mainrame000_r), this); - - write_delegates_0000[0] = write8_delegate(FUNC(apple2_state::apple2_auxram0000_w), this); - write_delegates_0000[1] = write8_delegate(FUNC(apple2_state::apple2_mainram0000_w), this); - write_delegates_0200[0] = write8_delegate(FUNC(apple2_state::apple2_auxram0200_w), this); - write_delegates_0200[1] = write8_delegate(FUNC(apple2_state::apple2_mainram0200_w), this); - write_delegates_0400[0] = write8_delegate(FUNC(apple2_state::apple2_auxram0400_w), this); - write_delegates_0400[1] = write8_delegate(FUNC(apple2_state::apple2_mainram0400_w), this); - write_delegates_0800[0] = write8_delegate(FUNC(apple2_state::apple2_auxram0800_w), this); - write_delegates_0800[1] = write8_delegate(FUNC(apple2_state::apple2_mainram0800_w), this); - write_delegates_2000[0] = write8_delegate(FUNC(apple2_state::apple2_auxram2000_w), this); - write_delegates_2000[1] = write8_delegate(FUNC(apple2_state::apple2_mainram2000_w), this); - write_delegates_4000[0] = write8_delegate(FUNC(apple2_state::apple2_auxram4000_w), this); - write_delegates_4000[1] = write8_delegate(FUNC(apple2_state::apple2_mainram4000_w), this); - write_delegates_c000[0] = write8_delegate(FUNC(apple2_state::apple2_auxramc000_w), this); - write_delegates_c000[1] = write8_delegate(FUNC(apple2_state::apple2_mainramc000_w), this); - write_delegates_d000[0] = write8_delegate(FUNC(apple2_state::apple2_auxramd000_w), this); - write_delegates_d000[1] = write8_delegate(FUNC(apple2_state::apple2_mainramd000_w), this); - write_delegates_e000[0] = write8_delegate(FUNC(apple2_state::apple2_auxrame000_w), this); - write_delegates_e000[1] = write8_delegate(FUNC(apple2_state::apple2_mainrame000_w), this); -} - -READ_LINE_MEMBER(apple2_state::ay3600_shift_r) -{ - // either shift key - if (m_kbspecial->read() & 0x06) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -READ_LINE_MEMBER(apple2_state::ay3600_control_r) -{ - if (m_kbspecial->read() & 0x08) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -static const UINT8 a2_key_remap[0x32][4] = -{ -/* norm shft ctrl both */ - { 0x33,0x23,0x33,0x23 }, /* 3 # 00 */ - { 0x34,0x24,0x34,0x24 }, /* 4 $ 01 */ - { 0x35,0x25,0x35,0x25 }, /* 5 % 02 */ - { 0x36,0x5e,0x35,0x53 }, /* 6 ^ 03 */ - { 0x37,0x26,0x37,0x26 }, /* 7 & 04 */ - { 0x38,0x2a,0x38,0x2a }, /* 8 * 05 */ - { 0x39,0x28,0x39,0x28 }, /* 9 ( 06 */ - { 0x30,0x29,0x30,0x29 }, /* 0 ) 07 */ - { 0x3b,0x3a,0x3b,0x3a }, /* ; : 08 */ - { 0x2d,0x5f,0x2d,0x1f }, /* - _ 09 */ - { 0x51,0x51,0x11,0x11 }, /* q Q 0a */ - { 0x57,0x57,0x17,0x17 }, /* w W 0b */ - { 0x45,0x45,0x05,0x05 }, /* e E 0c */ - { 0x52,0x52,0x12,0x12 }, /* r R 0d */ - { 0x54,0x54,0x14,0x14 }, /* t T 0e */ - { 0x59,0x59,0x19,0x19 }, /* y Y 0f */ - { 0x55,0x55,0x15,0x15 }, /* u U 10 */ - { 0x49,0x49,0x09,0x09 }, /* i I 11 */ - { 0x4f,0x4f,0x0f,0x0f }, /* o O 12 */ - { 0x50,0x50,0x10,0x10 }, /* p P 13 */ - { 0x44,0x44,0x04,0x04 }, /* d D 14 */ - { 0x46,0x46,0x06,0x06 }, /* f F 15 */ - { 0x47,0x47,0x07,0x07 }, /* g G 16 */ - { 0x48,0x48,0x08,0x08 }, /* h H 17 */ - { 0x4a,0x4a,0x0a,0x0a }, /* j J 18 */ - { 0x4b,0x4b,0x0b,0x0b }, /* k K 19 */ - { 0x4c,0x4c,0x0c,0x0c }, /* l L 1a */ - { 0x3d,0x2b,0x3d,0x2b }, /* = + 1b */ - { 0x08,0x08,0x08,0x08 }, /* Left 1c */ - { 0x15,0x15,0x15,0x15 }, /* Right 1d */ - { 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */ - { 0x58,0x58,0x18,0x18 }, /* x X 1f */ - { 0x43,0x43,0x03,0x03 }, /* c C 20 */ - { 0x56,0x56,0x16,0x16 }, /* v V 21 */ - { 0x42,0x42,0x02,0x02 }, /* b B 22 */ - { 0x4e,0x4e,0x0e,0x0e }, /* n N 23 */ - { 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */ - { 0x2c,0x3c,0x2c,0x3c }, /* , < 25 */ - { 0x2e,0x3e,0x2e,0x3e }, /* . > 26 */ - { 0x2f,0x3f,0x2f,0x3f }, /* / ? 27 */ - { 0x53,0x53,0x13,0x13 }, /* s S 28 */ - { 0x32,0x40,0x32,0x00 }, /* 2 @ 29 */ - { 0x31,0x21,0x31,0x31 }, /* 1 ! 2a */ - { 0x9b,0x9b,0x9b,0x9b }, /* Escape 2b */ - { 0x41,0x41,0x01,0x01 }, /* a A 2c */ - { 0x20,0x20,0x20,0x20 }, /* Space 2d */ - { 0x00,0x00,0x00,0x00 }, /* 0x2e unused */ - { 0x00,0x00,0x00,0x00 }, /* 0x2f unused */ - { 0x00,0x00,0x00,0x00 }, /* 0x30 unused */ - { 0x0d,0x0d,0x0d,0x0d }, /* Enter 31 */ -}; - -WRITE_LINE_MEMBER(apple2_state::ay3600_data_ready_w) -{ - if (state == ASSERT_LINE) - { - int mod = 0; - m_lastchar = m_ay3600->b_r(); - - mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; - mod |= (m_kbspecial->read() & 0x08) ? 0x02 : 0x00; - - m_transchar = a2_key_remap[m_lastchar&0x3f][mod]; - - if (m_transchar != 0) - { - m_strobe = 0x80; -// printf("new char = %04x (%02x)\n", m_lastchar&0x3f, m_transchar); - } - } -} - -WRITE_LINE_MEMBER(apple2_state::ay3600_iie_data_ready_w) -{ - if (state == ASSERT_LINE) - { - UINT8 *decode = m_kbdrom->base(); - UINT16 trans; - - m_lastchar = m_ay3600->b_r(); - - trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff - trans |= (m_lastchar & 0x100)>>2; // bring the 0x100 bit down to the 0x40 place - trans <<= 2; // 4 entries per key - trans |= (m_kbspecial->read() & 0x06) ? 0x00 : 0x01; // shift is bit 1 (active low) - trans |= (m_kbspecial->read() & 0x08) ? 0x00 : 0x02; // control is bit 2 (active low) - trans |= (m_kbspecial->read() & 0x01) ? 0x0000 : 0x0200; // caps lock is bit 9 (active low) - - m_transchar = decode[trans]; - m_strobe = 0x80; - -// printf("new char = %04x (%02x)\n", m_lastchar, m_transchar); - } -} diff --git a/src/mess/machine/apple2gs.c b/src/mess/machine/apple2gs.c deleted file mode 100644 index 4f7f64f0f7c..00000000000 --- a/src/mess/machine/apple2gs.c +++ /dev/null @@ -1,2236 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,R. Belmont -/********************************************************************* - - apple2gs.c - - Apple IIgs code - - - Apple IIgs specific softswitches: - - C019 - RDVBLBAR - bits 7 - set during vblank (when at scanline 192 or higher) - - C022 - TBCOLOR - bits 7-4 - text foreground color - bits 3-0 - text background color - - C023 - VGCINT - bit 7 - set for interrupt generated by VGC - - bit 6 - set during one second interrupt - bit 5 - set during scanline interrupt - - bit 4 - set during external interrupt - bit 3 - ??? - bit 2 - set for interrupt every second - - bit 1 - set for scanline interrupt - bit 0 - set for external interrupt - - C025 - KEYMODREG (comes from ?) - bit 7 - option key pressed - bit 6 - command key presssed - bit 5 - modified latch - bit 4 - keypad key pressed - bit 3 - repeating - bit 2 - caps lock latched - bit 1 - control key pressed - bit 0 - shift key pressed - - C027 - KMSTATUS (GLU system status) - bit 7 - set if mouse register full - bit 6 - mouse interupt enable flag - bit 5 - set if data register full - bit 4 - data interrupt enabled - bit 3 - set if key data full - bit 2 - key data interurpt enabled - bit 1 - clear if horizontal mouse data, set if vertical - bit 0 - command register full - - C029 - NEWVIDEO - bit 7 - 1 for Super Hi-Res mode, 0 for old Apple II video modes - bit 6 - 1 to enable memory linearization (2000-9D00 in banks 01/E1), 0 for physical layout - bit 5 - 1 to display double hi-res mode in monochrome, 0 for color - bit 4 - ??? - bit 3 - ??? - bit 2 - ??? - bit 1 - ??? - bit 0 - ??? - - C02D - SLTROMSEL - - C031 - DISKREG - bit 7 - set to select head on 3.5" drive - bit 6 - set to enable 3.5" drive, clear to enable 5.25" drive - - C035 - SHADOW - bit 7 - ??? - bit 6 - set to inhibit I/O and LC operations ($C000-$FFFF) - bit 5 - ??? - bit 4 - set to inhibit shadowing aux hires page - bit 3 - set to inhibit shadowing super hires video - bit 2 - set to inhibit shadowing hires page 2 - bit 1 - set to inhibit shadowing hires page 2 - bit 0 - set to inhibit shadowing text pages - - C036 - CYAREG - bit 7 - clear for slow speed, set for hi speed - bit 6 - ??? - bit 5 - ??? - bit 4 - shadow in all RAM banks - bit 3 - slot 7 motor on - bit 2 - slot 6 motor on - bit 1 - slot 5 motor on - bit 0 - slot 4 motor on - - C041 - INTEN - bit 4 - set to enable quarter second interrupts - bit 3 - set to enable VBL interrupts - bit 2 - set to enable Mega II mouse switch interrupts - bit 1 - set to enable Mega II mouse movement interrupts - bit 0 - set to enable Mega II mouse mouse operation - - C046 - DIAGTYPE/INTFLAG - bit 7 - set if mouse button currently down - bit 6 - set if mouse button down on last read - bit 5 - set for AN3 - bit 4 - set if currently in quarter second interrupt - bit 3 - set if currently in VBL interrupt - bit 2 - set if currently in Mega II mouse switch interrupt - bit 1 - set if currently in Mega II mouse movement interrupt - bit 0 - set if system IRQ line asserted - - C047 - CLRVBLINT - - C068 - STATEREG - bit 7 - ALTZP status - bit 6 - PAGE2 status - bit 5 - RAMRD status - bit 4 - RAMWRT status - bit 3 - !LCRAM status (inverted) - bit 2 - LCRAM2 status - bit 1 - ROMBANK status (unimplemented) - bit 0 - INTCXROM status - -*********************************************************************/ - -#include "emu.h" - -#include "includes/apple2gs.h" -#include "includes/apple2.h" -#include "machine/applefdc.h" -#include "machine/sonydriv.h" -#include "machine/8530scc.h" -#include "imagedev/flopdrv.h" -#include "cpu/g65816/g65816.h" -#include "sound/es5503.h" -#include "machine/ram.h" -#include "debugger.h" - -#define LOG_C0XX 0 -#define LOG_ADB 0 -#define LOG_IRQ 0 - -/* ----------------------------------------------------------------------- - * Apple IIgs clock - * ----------------------------------------------------------------------- */ - -void apple2gs_state::process_clock() -{ - UINT8 operation; - seconds_t current_interval; - - /* update clock_curtime */ - current_interval = machine().time().seconds(); - m_clock_curtime += current_interval - m_clock_curtime_interval; - m_clock_curtime_interval = current_interval; - - switch(m_clock_mode) - { - case CLOCKMODE_IDLE: - m_clock_read = (m_clock_data >> 7); - m_clock_reg1 = (m_clock_data >> 2) & 0x03; - operation = (m_clock_data >> 4) & 0x07; - - if ((m_clock_data & 0x40) == 0x00) - { - switch(operation) - { - case 0x00: - /* read/write seconds register */ - m_clock_mode = CLOCKMODE_TIME; - break; - - case 0x03: - /* internal registers */ - if (m_clock_reg1 & 0x02) - { - m_clock_mode = CLOCKMODE_BRAM2; - m_clock_reg1 = (m_clock_data & 0x07) << 5; - } - else - { - m_clock_mode = CLOCKMODE_INTERNALREGS; - } - break; - - default: - //fatalerror("NYI\n"); - break; - } - } - break; - - case CLOCKMODE_BRAM1: - if (m_clock_read) - m_clock_data = m_clock_bram[m_clock_reg1]; - else - m_clock_bram[m_clock_reg1] = m_clock_data; - m_clock_mode = CLOCKMODE_IDLE; - break; - - case CLOCKMODE_BRAM2: - m_clock_reg1 |= (m_clock_data >> 2) & 0x1F; - m_clock_mode = CLOCKMODE_BRAM1; - break; - - case CLOCKMODE_INTERNALREGS: - switch (m_clock_reg1) - { - case 0x00: - /* test register */ - break; - - case 0x01: - /* write protect register */ - break; - } - m_clock_mode = CLOCKMODE_IDLE; - break; - - case CLOCKMODE_TIME: - if (m_clock_data & 0x40) - { - m_clock_data = m_clock_curtime >> (m_clock_reg1 * 8); - } - else - { - m_clock_curtime &= ~(0xFF << (m_clock_reg1 * 8)); - m_clock_curtime |= m_clock_data << (m_clock_reg1 * 8); - } - m_clock_mode = CLOCKMODE_IDLE; - break; - - default: - //fatalerror("NYI\n"); - break; - } -} - -/* ----------------------------------------------------------------------- - * Interrupts - * ----------------------------------------------------------------------- */ - -const char *apple2gs_state::apple2gs_irq_name(UINT16 irq_mask) -{ - switch(irq_mask) - { - case IRQ_KBD_SRQ: return "IRQ_KBD_SRQ"; - case IRQ_ADB_DATA: return "IRQ_ADB_DATA"; - case IRQ_ADB_MOUSE: return "IRQ_ADB_MOUSE"; - case IRQ_VGC_SCANLINE: return "IRQ_VGC_SCANLINE"; - case IRQ_VGC_SECOND: return "IRQ_VGC_SECOND"; - case IRQ_INTEN_QSECOND: return "IRQ_INTEN_QSECOND"; - case IRQ_INTEN_VBL: return "IRQ_INTEN_VBL"; - case IRQ_DOC: return "IRQ_DOC"; - case IRQ_SLOT: return "IRQ_SLOT"; - } - return NULL; -} - -void apple2gs_state::apple2gs_add_irq(UINT16 irq_mask) -{ - if ((m_pending_irqs & irq_mask) == 0x00) - { - if (LOG_IRQ) - logerror("apple2gs_add_irq(): adding %s\n", apple2gs_irq_name(irq_mask)); - - m_pending_irqs |= irq_mask; - m_maincpu->set_input_line(G65816_LINE_IRQ, m_pending_irqs ? ASSERT_LINE : CLEAR_LINE); - } -} - - - -void apple2gs_state::apple2gs_remove_irq(UINT16 irq_mask) -{ - if (m_pending_irqs & irq_mask) - { - if (LOG_IRQ) - logerror("apple2gs_remove_irq(): removing %s\n", apple2gs_irq_name(irq_mask)); - - m_pending_irqs &= ~irq_mask; - m_maincpu->set_input_line(G65816_LINE_IRQ, m_pending_irqs ? ASSERT_LINE : CLEAR_LINE); - } -} - -WRITE_LINE_MEMBER(apple2gs_state::apple2gs_doc_irq) -{ - if (state) - { - apple2gs_add_irq(IRQ_DOC); - } - else - { - apple2gs_remove_irq(IRQ_DOC); - } -} - - -/* Clock interrupt */ -TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_clock_tick) -{ - if ((m_vgcint & 0x04) && !(m_vgcint & 0x40)) - { - m_vgcint |= 0xc0; - apple2gs_add_irq(IRQ_VGC_SECOND); - } -} - - -/* Quarter-second interrupt */ -TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_qsecond_tick) -{ - if ((m_inten & 0x10) && !(m_intflag & 0x10)) - { - m_intflag |= 0x10; - apple2gs_add_irq(IRQ_INTEN_QSECOND); - } -} - - -/* ----------------------------------------------------------------------- - * ADB - * ----------------------------------------------------------------------- */ - - -#if !RUN_ADB_MICRO -UINT8 apple2gs_state::adb_read_memory(UINT32 address) -{ - if (address < ARRAY_LENGTH(m_adb_memory)) - return m_adb_memory[address]; - else - return 0x00; -} - - - -void apple2gs_state::adb_write_memory(UINT32 address, UINT8 data) -{ - if (address < ARRAY_LENGTH(m_adb_memory)) - m_adb_memory[address] = data; -} - - - -void apple2gs_state::adb_set_mode(UINT8 mode) -{ - m_adb_mode = mode; -} - - - -void apple2gs_state::adb_set_config(UINT8 b1, UINT8 b2, UINT8 b3) -{ - /* ignore for now */ -} - - - -void apple2gs_state::adb_post_response(const UINT8 *bytes, size_t length) -{ - assert(length < ARRAY_LENGTH(m_adb_response_bytes)); - memcpy(m_adb_response_bytes, bytes, length); - - m_adb_state = ADBSTATE_INRESPONSE; - m_adb_response_length = length; - m_adb_response_pos = 0; -} - - - -void apple2gs_state::adb_post_response_1(UINT8 b) -{ - adb_post_response(&b, 1); -} - - - -void apple2gs_state::adb_post_response_2(UINT8 b1, UINT8 b2) -{ - UINT8 b[2]; - b[0] = b1; - b[1] = b2; - adb_post_response(b, 2); -} - - -void apple2gs_state::adb_do_command() -{ - int device; - UINT32 address; - UINT8 val; - - m_adb_state = ADBSTATE_IDLE; - if (LOG_ADB) - logerror("adb_do_command(): adb_command=0x%02x\n", m_adb_command); - - switch(m_adb_command) - { - case 0x00: /* ??? */ - break; - - case 0x03: /* flush keyboard buffer */ - break; - - case 0x04: /* set modes */ - adb_set_mode(m_adb_mode | m_adb_command_bytes[0]); - break; - - case 0x05: /* clear modes */ - adb_set_mode(m_adb_mode & ~m_adb_command_bytes[0]); - break; - - case 0x06: /* set config */ - adb_set_config(m_adb_command_bytes[0], m_adb_command_bytes[1], m_adb_command_bytes[2]); - break; - - case 0x07: /* synchronize */ - adb_set_mode(m_adb_command_bytes[0]); - adb_set_config(m_adb_command_bytes[1], m_adb_command_bytes[2], m_adb_command_bytes[3]); - break; - - case 0x08: /* write memory */ - address = m_adb_command_bytes[0]; - val = m_adb_command_bytes[1]; - adb_write_memory(address, val); - break; - - case 0x09: /* read memory */ - address = (m_adb_command_bytes[1] << 8) | m_adb_command_bytes[0]; - adb_post_response_1(adb_read_memory(address)); - break; - - case 0x0a: /* ??? */ - case 0x0b: /* ??? */ - break; - - case 0x0d: /* get version */ - adb_post_response_1(0x06); - break; - - case 0x0e: /* read available charsets */ - adb_post_response_2(0x01, 0x00); - break; - - case 0x0f: /* read available layouts */ - adb_post_response_2(0x01, 0x00); - break; - - case 0x12: /* mystery command 0x12 */ - case 0x13: /* mystery command 0x13 */ - break; - - case 0xb0: case 0xb1: case 0xb2: case 0xb3: - case 0xb4: case 0xb5: case 0xb6: case 0xb7: - case 0xb8: case 0xb9: case 0xba: case 0xbb: - case 0xbc: case 0xbd: case 0xbe: case 0xbf: - /* send data to device */ - device = m_adb_command & 0x0f; - if (device == m_adb_address_keyboard) - { - } - else if (device == m_adb_address_mouse) - { - } - break; - - case 0xf2: - break; - - default: - fatalerror("ADB command 0x%02x unimplemented\n", m_adb_command); - } - m_adb_kmstatus |= 0x20; -} - - -UINT8 apple2gs_state::adb_read_datareg() -{ - UINT8 result; - - switch(m_adb_state) - { - case ADBSTATE_INRESPONSE: - result = m_adb_response_bytes[m_adb_response_pos++]; - if (m_adb_response_pos >= m_adb_response_length) - { - m_adb_state = ADBSTATE_IDLE; - m_adb_latent_result = result; - m_adb_kmstatus &= ~0x20; - } - break; - - default: - result = 0; //m_adb_latent_result & 0x7f; - break; - } - - if (LOG_ADB) - logerror("adb_read_datareg(): result=0x%02x\n", result); - - return result; -} - - -void apple2gs_state::adb_write_datareg(UINT8 data) -{ - if (LOG_ADB) - logerror("adb_write_datareg(): data=0x%02x\n", data); - - switch(m_adb_state) - { - case ADBSTATE_IDLE: - m_adb_command = data; - m_adb_command_length = 0; - m_adb_command_pos = 0; - -// printf("ADB command %02x\n", data); - switch(data) - { - case 0x00: /* ??? */ - case 0x01: /* abort */ - /* do nothing for now */ - break; - - case 0x03: /* flush keyboard buffer */ - m_adb_command_length = 0; - break; - - case 0x04: /* set modes */ - case 0x05: /* clear modes */ - m_adb_command_length = 1; - break; - - case 0x06: /* set config */ - m_adb_command_length = 3; - break; - - case 0x07: /* synchronize */ - if (m_is_rom3) - m_adb_command_length = 8; // ROM 3 has 8 bytes: mode byte, 3 config bytes, kbd/mouse params, disk eject options - else - m_adb_command_length = 4; // ROM 0/1 has 4 bytes sync - break; - - case 0x08: /* write memory */ - case 0x09: /* read memory */ - m_adb_command_length = 2; - break; - - case 0x0a: /* ??? */ - case 0x0b: /* ??? */ - m_adb_command_length = 0; - break; - - case 0x0d: /* get version */ - m_adb_command_length = 0; - break; - - case 0x0e: /* read available charsets */ - m_adb_command_length = 0; - m_adb_state = ADBSTATE_INCOMMAND; /* HACK */ - break; - - case 0x0f: /* read available layouts */ - m_adb_command_length = 0; - m_adb_state = ADBSTATE_INCOMMAND; /* HACK */ - break; - - case 0x12: /* mystery command 0x12 */ - case 0x13: /* mystery command 0x13 */ - m_adb_command_length = 2; - break; - - case 0x70: /* disable SRQ device 0 */ - case 0x71: /* disable SRQ device 1 */ - case 0x72: /* disable SRQ device 2 */ - case 0x73: /* disable SRQ device 3 */ - /* ignore for now */ - break; - - case 0xb0: case 0xb1: case 0xb2: case 0xb3: - case 0xb4: case 0xb5: case 0xb6: case 0xb7: - case 0xb8: case 0xb9: case 0xba: case 0xbb: - case 0xbc: case 0xbd: case 0xbe: case 0xbf: - /* send data to device */ - m_adb_command_length = 2; - break; - - case 0xf2: - break; - - default: - fatalerror("ADB command 0x%02x unimplemented\n", data); - } - - if (m_adb_command_length > 0) - { - m_adb_state = ADBSTATE_INCOMMAND; - if (LOG_ADB) - logerror("adb_write_datareg(): in command length %u\n", (unsigned) m_adb_command_length); - } - break; - - case ADBSTATE_INCOMMAND: - assert(m_adb_command_pos < ARRAY_LENGTH(m_adb_command_bytes)); -// printf("ADB param %02x\n", data); - m_adb_command_bytes[m_adb_command_pos++] = data; - break; - - case ADBSTATE_INRESPONSE: - m_adb_state = ADBSTATE_IDLE; - break; - } - - /* do command if necessary */ - if ((m_adb_state == ADBSTATE_INCOMMAND) && (m_adb_command_pos >= m_adb_command_length)) - adb_do_command(); -} - -// real rom 3 h/w reads 0x90 when idle, 0x98 when key pressed -// current MESS reads back 0xb0 when idle -UINT8 apple2gs_state::adb_read_kmstatus() -{ - return m_adb_kmstatus; -} - - -void apple2gs_state::adb_write_kmstatus(UINT8 data) -{ - m_adb_kmstatus &= ~0x54; - m_adb_kmstatus |= data & 0x54; -} - - - -UINT8 apple2gs_state::adb_read_mousedata() -{ - UINT8 result = 0x00; - UINT8 absolute; - INT8 delta; - - if (m_adb_kmstatus & 0x80) // mouse register full - { - if (m_adb_kmstatus & 0x02) // H/V mouse data select - { - absolute = m_mouse_y; - delta = m_mouse_dy; - m_adb_kmstatus &= ~0x82; - apple2gs_remove_irq(IRQ_ADB_MOUSE); - } - else - { - absolute = m_mouse_x; - delta = m_mouse_dx; - m_adb_kmstatus |= 0x02; - } - - if (delta > 63) - delta = 63; - else if (delta < -64) - delta = -64; - - result = (absolute & 0x80) | (delta & 0x7F); - } - return result; -} - - -INT8 apple2gs_state::seven_bit_diff(UINT8 v1, UINT8 v2) -{ - v1 -= v2; - if (v1 & 0x40) - v1 |= 0x80; - else - v1 &= ~0x80; - return v1; -} - - - -void apple2gs_state::adb_check_mouse() -{ - UINT8 new_mouse_x, new_mouse_y; - - /* read mouse values */ - if ((m_adb_kmstatus & 0x80) == 0x00) - { - new_mouse_x = m_adb_mousex->read(); - new_mouse_y = m_adb_mousey->read(); - - if ((m_mouse_x != new_mouse_x) || (m_mouse_y != new_mouse_y)) - { - m_mouse_dx = seven_bit_diff(new_mouse_x, m_mouse_x); - m_mouse_dy = seven_bit_diff(new_mouse_y, m_mouse_y); - m_mouse_x = new_mouse_x; - m_mouse_y = new_mouse_y; - - m_adb_kmstatus |= 0x80; - m_adb_kmstatus &= ~0x02; - if (m_adb_kmstatus & 0x40) - apple2gs_add_irq(IRQ_ADB_MOUSE); - } - } -} -#endif - - -void apple2gs_state::apple2gs_set_scanint(UINT8 data) -{ - /* second interrupt */ - if ((m_vgcint & 0x40) && !(data & 0x40)) - { - apple2gs_remove_irq(IRQ_VGC_SECOND); - m_vgcint &= ~0xC0; - } - - /* scanline interrupt */ - if ((m_vgcint & 0x20) && !(data & 0x20)) - { - apple2gs_remove_irq(IRQ_VGC_SCANLINE); - m_vgcint &= ~0xA0; - } - - if (m_pending_irqs & (IRQ_VGC_SECOND | IRQ_VGC_SCANLINE)) - m_vgcint |= 0x80; -} - - -TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_scanline_tick) -{ - int scanline; - - scanline = machine().first_screen()->vpos(); - machine().first_screen()->update_partial(scanline); - - /* check scanline interrupt bits if we're in super hi-res and the current scanline is within the active display area */ - if ((m_newvideo & 0x80) && (scanline >= (BORDER_TOP-1)) && (scanline < (200+BORDER_TOP-1))) - { - UINT8 scb; - - scb = m_slowmem[0x19D00 + scanline - BORDER_TOP + 1]; - - if (scb & 0x40) - { - // scanline int flag is set even when the actual interrupt is disabled - m_vgcint |= 0x20; - - // see if the interrupt is also enabled and trigger it if so - if (m_vgcint & 0x02) - { - m_vgcint |= 0x80; - apple2gs_add_irq(IRQ_VGC_SCANLINE); - } - } - } - - if (scanline == (192+BORDER_TOP)) - { - /* VBL interrupt */ - if ((m_inten & 0x08) && !(m_intflag & 0x08)) - { - m_intflag |= 0x08; - apple2gs_add_irq(IRQ_INTEN_VBL); - } - } - - /* check the mouse status */ - if ((scanline % 8) == 0) - { - #if !RUN_ADB_MICRO - adb_check_mouse(); - #endif - - /* call Apple II interrupt handler */ - if ((machine().first_screen()->vpos() % 8) == 7) - { - //apple2_interrupt(m_maincpu); - /* TODO: check me! */ - machine().first_screen()->update_partial(machine().first_screen()->vpos()); - } - } - - m_scanline_timer->adjust(machine().first_screen()->time_until_pos((scanline+1)%262, 0)); -} - - - -/* ----------------------------------------------------------------------- - * Sound handlers - * ----------------------------------------------------------------------- */ - - -READ8_MEMBER( apple2gs_state::gssnd_r ) -{ - UINT8 ret = 0; - - switch (offset) - { - case 0: // control - ret = m_sndglu_ctrl; - break; - case 1: // data read - ret = m_sndglu_dummy_read; - - if (m_sndglu_ctrl & 0x40) // docram access - { - UINT8 *docram = memregion("es5503")->base(); - m_sndglu_dummy_read = docram[m_sndglu_addr]; - } - else - { - m_sndglu_dummy_read = m_es5503->read(space, m_sndglu_addr); - } - - if (m_sndglu_ctrl & 0x20) // auto-increment - { - m_sndglu_addr++; - } - break; - case 2: // addr l - ret = m_sndglu_addr & 0xff; - break; - case 3: // addr h - ret = (m_sndglu_addr >> 8) & 0xff; - break; - } - - return ret; -} - - - -WRITE8_MEMBER( apple2gs_state::gssnd_w ) -{ - switch (offset) - { - case 0: // control - m_sndglu_ctrl = data & 0x7f; // make sure DOC is never busy - if (!(m_sndglu_ctrl & 0x40)) // clear hi byte of address pointer on DOC access - { - m_sndglu_addr &= 0xff; - } - break; - case 1: // data write - if (m_sndglu_ctrl & 0x40) // docram access - { - UINT8 *docram = memregion("es5503")->base(); - docram[m_sndglu_addr] = data; - } - else - { - m_es5503->write(space, m_sndglu_addr, data); - } - - if (m_sndglu_ctrl & 0x20) // auto-increment - { - m_sndglu_addr++; - } - break; - case 2: // addr l - m_sndglu_addr &= 0xff00; - m_sndglu_addr |= data; - break; - case 3: // addr h - m_sndglu_addr &= 0x00ff; - m_sndglu_addr |= data<<8; - break; - } -} - -/* ----------------------------------------------------------------------- - * IO handlers - * ----------------------------------------------------------------------- */ - -// apple2gs_get_vpos - return the correct vertical counter value for the current scanline, -// keeping borders in mind. - -int apple2gs_state::apple2gs_get_vpos() -{ - int result, scan; - static const UINT8 top_border_vert[BORDER_TOP] = - { - 0xfa, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, - 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfe, 0xfe, 0xff, - - }; - - scan = machine().first_screen()->vpos(); - - if (scan < BORDER_TOP) - { - result = top_border_vert[scan]; - } - else - { - result = scan - BORDER_TOP + 0x100 + 1; - } - - return result; -} - -READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r ) -{ - UINT8 result; - scc8530_t *scc; - - if(space.debugger_access()) - { - return 0; - } - - offset &= 0xFF; - - switch(offset) - { - #if RUN_ADB_MICRO - case 0x00: /* C000 - KEYDATA */ - result = keyglu_816_read(GLU_C000); - break; - - case 0x10: /* C010 - KBDSTRB */ - result = keyglu_816_read(GLU_C010); - break; - #endif - - case 0x19: /* C019 - RDVBLBAR */ - result = (space.machine().first_screen()->vpos() >= (192+BORDER_TOP)) ? 0x80 : 0x00; - break; - - case 0x22: /* C022 - TBCOLOR */ - result = (m_fgcolor << 4) | m_bgcolor; - break; - - case 0x23: /* C023 - VGCINT */ - result = m_vgcint; - break; - - case 0x24: /* C024 - MOUSEDATA */ - #if RUN_ADB_MICRO - result = keyglu_816_read(GLU_MOUSEX); - #else - result = adb_read_mousedata(); - #endif - break; - - case 0x25: /* C025 - KEYMODREG */ - #if RUN_ADB_MICRO - result = keyglu_816_read(GLU_KEYMOD); - #else - - result = 0; - { - UINT8 temp = m_kbspecial->read(); - if (temp & 1) // capslock - { - result |= 4; - } - if (temp & 6) // shift - { - result |= 1; - } - if (temp & 8) // control - { - result |= 2; - } - if (temp & 0x10) // open apple/command - { - result |= 0x40; - } - if (temp & 0x20) // option - { - result |= 0x80; - } - // keypad is a little rough right now - if (m_lastchar >= 0x28 && m_lastchar <= 0x2d) - { - result |= 0x10; - } - else if (m_lastchar >= 0x32 && m_lastchar <= 0x3f) - { - result |= 0x10; - } - else if (m_lastchar >= 0x100 && m_lastchar <= 0x101) - { - result |= 0x10; - } - else if (m_lastchar >= 0x109 && m_lastchar <= 0x10a) - { - result |= 0x10; - } - } -#endif - break; - - case 0x26: /* C026 - DATAREG */ - #if RUN_ADB_MICRO - result = keyglu_816_read(GLU_DATA); - #else - result = adb_read_datareg(); - #endif - break; - - case 0x27: /* C027 - KMSTATUS */ - #if RUN_ADB_MICRO - result = keyglu_816_read(GLU_SYSSTAT); - #else - result = adb_read_kmstatus(); - #endif - break; - - case 0x29: /* C029 - NEWVIDEO */ - result = m_newvideo; - break; - - case 0x2B: /* C02B - LANGSEL */ - result = m_langsel; - break; - - case 0x2D: /* C02D - SLTROMSEL */ - result = m_sltromsel; - break; - - case 0x2E: /* C02E - VERTCNT */ - result = apple2gs_get_vpos() >> 1; - break; - - case 0x2F: /* C02F - HORIZCNT */ - result = space.machine().first_screen()->hpos() / 11; - if (result > 0) - { - result += 0x40; - } - - if (apple2gs_get_vpos() & 1) - { - result |= 0x80; - } - break; - - case 0x31: /* C031 - DISKREG */ - result = m_fdc_diskreg; - break; - - case 0x33: /* C033 - CLOCKDATA */ - result = m_clock_data; - break; - - case 0x34: /* C034 - CLOCKCTL */ - result = m_clock_control; - break; - - case 0x35: /* C035 - SHADOW */ - result = m_shadow; - break; - - case 0x36: /* C036 - CYAREG */ - result = m_cyareg; - break; - - case 0x38: /* C038 - SCCBREG */ - case 0x39: /* C039 - SCCAREG */ - case 0x3A: /* C03A - SCCBDATA */ - case 0x3B: /* C03B - SCCADATA */ - scc = space.machine().device("scc"); - result = scc->reg_r(space, offset & 0x03); - break; - - case 0x3C: /* C03C - SOUNDCTL */ - case 0x3D: /* C03D - SOUNDDATA */ - case 0x3E: /* C03E - SOUNDADRL */ - case 0x3F: /* C03F - SOUNDADRH */ - result = gssnd_r(space, offset & 0x03, mem_mask); - break; - - case 0x41: /* C041 - INTEN */ - result = m_inten; - break; - - case 0x46: /* C046 - INTFLAG */ - result = m_intflag; - break; - - case 0x68: /* C068 - STATEREG */ - result = ((m_flags & VAR_ALTZP) ? 0x80 : 0x00) - | ((m_flags & VAR_PAGE2) ? 0x40 : 0x00) - | ((m_flags & VAR_RAMRD) ? 0x20 : 0x00) - | ((m_flags & VAR_RAMWRT) ? 0x10 : 0x00) - | ((m_flags & VAR_LCRAM) ? 0x00 : 0x08) - | ((m_flags & VAR_LCRAM2) ? 0x04 : 0x00) - | ((m_flags & VAR_INTCXROM)? 0x01 : 0x00); - break; - - case 0x71: case 0x72: case 0x73: - case 0x74: case 0x75: case 0x76: case 0x77: - case 0x78: case 0x79: case 0x7a: case 0x7b: - case 0x7c: case 0x7d: case 0x7e: case 0x7f: - offset |= (memregion("maincpu")->bytes() - 1) & ~0x3FFF; - result = m_rom[offset]; - break; - - case 0x21: /* C021 - MONOCOLOR */ - case 0x2C: /* C02C - CHARROM */ - result = 0x00; - break; - - // slot 6 registers should go to applefdc if slot 6 not "Your Card" - case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7: - case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: - if ((m_sltromsel & (1 << 6)) == 0) - { - result = m_fdc->read(offset); - } - else - { - result = apple2_c0xx_r(space, offset, 0); - } - break; - - default: - if (offset < 0x80) - { - result = apple2_c0xx_r(space, offset, 0); - } - else - { - result = apple2_c080_r(space, offset, 0); - } - break; - } - - if (LOG_C0XX) - logerror("apple2gs_c0xx_r(): offset=0x%02x result=0x%02x\n", offset, result); - - return result; -} - - - -WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) -{ - scc8530_t *scc; - - offset &= 0xFF; - - if (LOG_C0XX) - logerror("apple2gs_c0xx_w(): offset=0x%02x data=0x%02x\n", offset, data); - - switch(offset) - { - #if RUN_ADB_MICRO - case 0x10: - break; - #endif - - case 0x22: /* C022 - TBCOLOR */ - m_fgcolor = (data >> 4) & 0x0F; - m_bgcolor = (data >> 0) & 0x0F; - break; - - case 0x23: /* C023 - VGCINT */ - m_vgcint &= ~0x0F; - m_vgcint |= data & 0x0F; - break; - - case 0x24: /* C024 - MOUSEDATA */ - case 0x25: /* C025 - KEYMODREG */ - case 0x28: /* C028 - ROMBANK */ - case 0x2C: /* C02C - CHARROM */ - case 0x2E: /* C02E - VERTCNT */ - case 0x2F: /* C02F - HORIZCNT */ - /* ignore these writes */ - break; - - case 0x26: /* C026 - DATAREG */ - #if RUN_ADB_MICRO - keyglu_816_write(GLU_COMMAND, data); - #else - adb_write_datareg(data); - #endif - break; - - case 0x27: /* C027 - KMSTATUS */ - #if RUN_ADB_MICRO - keyglu_816_write(GLU_SYSSTAT, data); - #else - adb_write_kmstatus(data); - #endif - break; - - case 0x29: /* C029 - NEWVIDEO */ - m_newvideo = data; - break; - - case 0x2B: /* C02B - LANGSEL */ - m_langsel = data; - break; - - case 0x2D: /* C02D - SLTROMSEL */ - m_sltromsel = data; - apple2_update_memory(); - break; - - case 0x31: /* C031 - DISKREG */ - apple2_iwm_setdiskreg(data); - break; - - case 0x32: /* C032 - SCANINT */ - apple2gs_set_scanint(data); - break; - - case 0x33: /* C033 - CLOCKDATA */ - m_clock_data = data; - break; - - case 0x34: /* C034 - CLOCKCTL */ - m_clock_control = data & 0x7F; - m_bordercolor = data & 0x0F; - if (data & 0x80) - process_clock(); - break; - - case 0x35: /* C035 - SHADOW */ - if (m_shadow != data) - { - m_shadow = data; - apple2_update_memory(); - } - break; - - case 0x36: /* C036 - CYAREG */ - m_cyareg = data & ~0x20; - m_maincpu->set_unscaled_clock((data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7); - break; - - case 0x38: /* C038 - SCCBREG */ - case 0x39: /* C039 - SCCAREG */ - case 0x3A: /* C03A - SCCBDATA */ - case 0x3B: /* C03B - SCCADATA */ - scc = space.machine().device("scc"); - scc->reg_w(space, offset & 0x03, data); - break; - - case 0x3C: /* C03C - SOUNDCTL */ - case 0x3D: /* C03D - SOUNDDATA */ - case 0x3E: /* C03E - SOUNDADRL */ - case 0x3F: /* C03F - SOUNDADRH */ - gssnd_w(space, offset & 0x03, data, mem_mask); - break; - - case 0x41: /* C041 - INTEN */ - m_inten = data & 0x1F; - if ((m_inten & 0x10) == 0x00) - apple2gs_remove_irq(IRQ_INTEN_QSECOND); - if ((m_inten & 0x08) == 0x00) - apple2gs_remove_irq(IRQ_INTEN_VBL); - break; - - case 0x47: /* C047 - CLRVBLINT */ - m_intflag &= ~0x18; - apple2gs_remove_irq(IRQ_INTEN_QSECOND); - apple2gs_remove_irq(IRQ_INTEN_VBL); - break; - - case 0x68: /* C068 - STATEREG */ - apple2_setvar( - ((data & 0x80) ? VAR_ALTZP : 0) | - ((data & 0x40) ? VAR_PAGE2 : 0) | - ((data & 0x20) ? VAR_RAMRD : 0) | - ((data & 0x10) ? VAR_RAMWRT : 0) | - ((data & 0x08) ? 0 : VAR_LCRAM) | - ((data & 0x04) ? VAR_LCRAM2 : 0) | - ((data & 0x01) ? VAR_INTCXROM : 0), - VAR_ALTZP | VAR_PAGE2 | VAR_RAMRD | VAR_RAMWRT | VAR_LCRAM | VAR_LCRAM2 | VAR_INTCXROM); - break; - - // slot 6 registers should go to applefdc if slot 6 not "Your Card" - case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7: - case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: - if ((m_sltromsel & (1 << 6)) == 0) - { - m_fdc->write(offset, data); - } - else - { - apple2_c0xx_w(space, offset, data, 0); - } - break; - - default: - if (offset < 0x80) - { - apple2_c0xx_w(space, offset, data, 0); - } - else - { - apple2_c080_w(space, offset, data, 0); - } - break; - } -} - - - -/* ----------------------------------------------------------------------- - * Memory management - * ----------------------------------------------------------------------- */ - -WRITE8_MEMBER( apple2gs_state::apple2gs_main0400_w ) -{ - offset += 0x000400; - m_rambase[offset] = data; - - if (!(m_shadow & 0x01)) - { - m_slowmem[offset] = data; - } -} - -WRITE8_MEMBER( apple2gs_state::apple2gs_aux0400_w ) -{ - offset += 0x010400; - m_rambase[offset] = data; - - if (!(m_shadow & 0x01)) - { - m_slowmem[offset] = data; - } -} - -WRITE8_MEMBER( apple2gs_state::apple2gs_main2000_w ) -{ - offset += 0x002000; - m_rambase[offset] = data; - - if (!(m_shadow & 0x02)) - { - m_slowmem[offset] = data; - } -} - -WRITE8_MEMBER( apple2gs_state::apple2gs_aux2000_w ) -{ - offset += 0x012000; - m_rambase[offset] = data; - - if (!(m_shadow & 0x12) || !(m_shadow & 0x08)) - { - m_slowmem[offset] = data; - } -} - -WRITE8_MEMBER( apple2gs_state::apple2gs_main4000_w ) -{ - offset += 0x004000; - m_rambase[offset] = data; - - if ((offset >= 0x004000) && (offset <= 0x005FFF)) - { - if (!(m_shadow & 0x04)) - m_slowmem[offset] = data; - } -} - -WRITE8_MEMBER( apple2gs_state::apple2gs_aux4000_w ) -{ - offset += 0x014000; - m_rambase[offset] = data; - - if ((offset >= 0x014000) && (offset <= 0x015FFF)) - { - if (!(m_shadow & 0x14) || !(m_shadow & 0x08)) - m_slowmem[offset] = data; - } - else if ((offset >= 0x016000) && (offset <= 0x019FFF)) - { - if (!(m_shadow & 0x08)) - { - m_slowmem[offset] = data; - - if (offset >= 0x19e00) - { - int color = (offset - 0x19e00) >> 1; - - m_shr_palette[color] = rgb_t( - ((m_slowmem[0x19E00 + (color * 2) + 1] >> 0) & 0x0F) * 17, - ((m_slowmem[0x19E00 + (color * 2) + 0] >> 4) & 0x0F) * 17, - ((m_slowmem[0x19E00 + (color * 2) + 0] >> 0) & 0x0F) * 17); - } - } - } -} - - - -static void apple2gs_mem_000000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - meminfo->read_mem = (state->m_flags & VAR_ALTZP) ? 0x010000 : 0x000000; - meminfo->write_mem = (state->m_flags & VAR_ALTZP) ? 0x010000 : 0x000000; -} - -static void apple2gs_mem_000200(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x010200 : 0x000200; - meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x010200 : 0x000200; -} - -static void apple2gs_mem_000400(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - if (state->m_flags & VAR_80STORE) - { - meminfo->read_mem = (state->m_flags & VAR_PAGE2) ? 0x010400 : 0x000400; - meminfo->write_mem = (state->m_flags & VAR_PAGE2) ? 0x010400 : 0x000400; - meminfo->write_handler = (state->m_flags & VAR_PAGE2) ? &state->write_delegates_2gs0400[0] : &state->write_delegates_2gs0400[1]; - } - else - { - meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x010400 : 0x000400; - meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x010400 : 0x000400; - meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_2gs0400[0] : &state->write_delegates_2gs0400[1]; - } -} - -static void apple2gs_mem_000800(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x010800 : 0x000800; - meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x010800 : 0x000800; -} - -static void apple2gs_mem_002000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - if ((state->m_flags & (VAR_80STORE|VAR_HIRES)) == (VAR_80STORE|VAR_HIRES)) - { - meminfo->read_mem = (state->m_flags & VAR_PAGE2) ? 0x012000 : 0x002000; - meminfo->write_mem = (state->m_flags & VAR_PAGE2) ? 0x012000 : 0x002000; - meminfo->write_handler = (state->m_flags & VAR_PAGE2) ? &state->write_delegates_2gs2000[0] : &state->write_delegates_2gs2000[1]; - } - else - { - meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x012000 : 0x002000; - meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x012000 : 0x002000; - meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_2gs2000[0] : &state->write_delegates_2gs2000[1]; - } -} - -static void apple2gs_mem_004000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x014000 : 0x004000; - meminfo->write_handler = (state->m_flags & VAR_RAMWRT) ? &state->write_delegates_2gs4000[0] : &state->write_delegates_2gs4000[1]; -} - -static void apple2gs_mem_xxD000(running_machine &machine,apple2_meminfo *meminfo, UINT32 lcmem) -{ - apple2gs_state *state = machine.driver_data(); - if (state->m_flags & VAR_LCRAM) - { - if (state->m_flags & VAR_LCRAM2) - meminfo->read_mem = lcmem | 0x00C000; - else - meminfo->read_mem = lcmem | 0x00D000; - } - else - { - meminfo->read_mem = 0x03D000 | APPLE2_MEM_ROM; - } - - if (state->m_flags & VAR_LCWRITE) - { - if (state->m_flags & VAR_LCRAM2) - meminfo->write_mem = lcmem | 0x00C000; - else - meminfo->write_mem = lcmem | 0x00D000; - } - else - { - meminfo->write_mem = APPLE2_MEM_FLOATING; - } -} - -static void apple2gs_mem_xxE000(running_machine &machine,apple2_meminfo *meminfo, UINT32 lcmem) -{ - apple2gs_state *state = machine.driver_data(); - if (state->m_flags & VAR_LCRAM) - meminfo->read_mem = lcmem | 0x00E000; - else - meminfo->read_mem = 0x03E000 | APPLE2_MEM_ROM; - - if (state->m_flags & VAR_LCWRITE) - meminfo->write_mem = lcmem | 0x00E000; - else - meminfo->write_mem = APPLE2_MEM_FLOATING; -} - -static void apple2gs_mem_00D000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - if (state->m_shadow & 0x40) - { - meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x01D000 : 0x00D000; - meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x01D000 : 0x00D000; - } - else - { - apple2gs_mem_xxD000(machine,meminfo, (state->m_flags & VAR_ALTZP) ? 0x010000 : 0x000000); - } -} - -static void apple2gs_mem_00E000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - if (state->m_shadow & 0x40) - { - meminfo->read_mem = (state->m_flags & VAR_RAMRD) ? 0x01E000 : 0x00E000; - meminfo->write_mem = (state->m_flags & VAR_RAMWRT) ? 0x01E000 : 0x00E000; - } - else - { - apple2gs_mem_xxE000(machine,meminfo, (state->m_flags & VAR_ALTZP) ? 0x010000 : 0x000000); - } -} - -static void apple2gs_mem_01D000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - if (state->m_shadow & 0x40) - { - meminfo->read_mem = 0x01D000; - meminfo->write_mem = 0x01D000; - } - else - { - apple2gs_mem_xxD000(machine,meminfo, 0x010000); - } -} - -static void apple2gs_mem_01E000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_state *state = machine.driver_data(); - if (state->m_shadow & 0x40) - { - meminfo->read_mem = 0x01E000; - meminfo->write_mem = 0x01E000; - } - else - { - apple2gs_mem_xxE000(machine,meminfo, 0x010000); - } -} - -static void apple2gs_mem_E0D000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_mem_xxD000(machine,meminfo, 0x000000 | APPLE2_MEM_AUX); -} - -static void apple2gs_mem_E0E000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_mem_xxE000(machine,meminfo, 0x000000 | APPLE2_MEM_AUX); -} - -static void apple2gs_mem_E1D000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_mem_xxD000(machine,meminfo, 0x010000 | APPLE2_MEM_AUX); -} - -static void apple2gs_mem_E1E000(running_machine &machine,offs_t begin, offs_t end, apple2_meminfo *meminfo) -{ - apple2gs_mem_xxE000(machine,meminfo, 0x010000 | APPLE2_MEM_AUX); -} - - - -static const apple2_memmap_entry apple2gs_memmap_entries[] = -{ - { 0x000000, 0x0001FF, apple2gs_mem_000000, A2MEM_MONO }, - { 0x000200, 0x0003FF, apple2gs_mem_000200, A2MEM_DUAL }, - { 0x000400, 0x0007FF, apple2gs_mem_000400, A2MEM_DUAL }, - { 0x000800, 0x001FFF, apple2gs_mem_000800, A2MEM_DUAL }, - { 0x002000, 0x003FFF, apple2gs_mem_002000, A2MEM_DUAL }, - { 0x004000, 0x00BFFF, apple2gs_mem_004000, A2MEM_DUAL }, - { 0x00D000, 0x00DFFF, apple2gs_mem_00D000, A2MEM_DUAL }, - { 0x00E000, 0x00FFFF, apple2gs_mem_00E000, A2MEM_DUAL }, - - { 0x01D000, 0x01DFFF, apple2gs_mem_01D000, A2MEM_DUAL }, - { 0x01E000, 0x01FFFF, apple2gs_mem_01E000, A2MEM_DUAL }, - { 0xE0D000, 0xE0DFFF, apple2gs_mem_E0D000, A2MEM_DUAL }, - { 0xE0E000, 0xE0FFFF, apple2gs_mem_E0E000, A2MEM_DUAL }, - { 0xE1D000, 0xE1DFFF, apple2gs_mem_E1D000, A2MEM_DUAL }, - { 0xE1E000, 0xE1FFFF, apple2gs_mem_E1E000, A2MEM_DUAL }, - - { 0 } -}; - - - -UINT8 *apple2gs_state::apple2gs_getslotmem(offs_t address) -{ - UINT8 *rom; - - address %= 0x00FFFF; - assert(address >= 0xC000); - assert(address <= 0xCFFF); - - rom = m_rom; - rom += 0x030000 % memregion("maincpu")->bytes(); - return &rom[address]; -} - - - -UINT8 apple2gs_state::apple2gs_xxCxxx_r(address_space &space, offs_t address) -{ - UINT8 result; - int slot; - - if ((m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) // shadow all banks and C0xx? - { - result = m_ram->pointer()[address]; - } - else if ((address & 0x000F00) == 0x000000) // accessing C0xx? - { - result = apple2gs_c0xx_r(m_maincpu->space(AS_PROGRAM), address, 0); - } - else - { - device_a2bus_card_interface *slotdevice; - - slot = (address & 0x000F00) / 0x100; - if (slot <= 7) // slots 1-7, it's the slot - { - slotdevice = m_a2bus->get_a2bus_card(slot); - - // is this slot internal or "Your Card"? - if ((m_sltromsel & (1 << slot)) == 0) - { - // accessing a slot mapped to internal, let's put back the internal ROM - m_a2_cnxx_slot = -1; - apple2_update_memory(); - result = *apple2gs_getslotmem(address); - } - else - { - // accessing a slot mapped to "Your Card", C800 should belong to that card - if (slotdevice != NULL) - { - if (slotdevice->take_c800()) - { - m_a2_cnxx_slot = slot; - apple2_update_memory(); - } - result = slotdevice->read_cnxx(space, address&0xff); - } - else - { - result = apple2_getfloatingbusvalue(); - } - } - } - else // C800-CFFF, not cards - { - slotdevice = NULL; - - // if CFFF accessed, reset C800 area to internal ROM - if(!space.debugger_access()) - { - if ((address & 0xfff) == 0xfff) - { - m_a2_cnxx_slot = -1; - apple2_update_memory(); - } - } - - if ( m_a2_cnxx_slot >= 0 && m_a2_cnxx_slot <= 7 ) - { - slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); - } - - if (slotdevice) - { - result = slotdevice->read_c800(space, address&0x7ff); - } - else - { - result = *apple2gs_getslotmem(address); - } - } - } - return result; -} - - - -void apple2gs_state::apple2gs_xxCxxx_w(address_space &space, offs_t address, UINT8 data) -{ - int slot; - - // if CFFF accessed, reset C800 area to internal ROM - if(!space.debugger_access()) - { - if ((address & 0xfff) == 0xfff) - { - m_a2_cnxx_slot = -1; - apple2_update_memory(); - } - } - - if ((m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) - { - m_ram->pointer()[address] = data; - } - else if ((address & 0x000F00) == 0x000000) - { - apple2gs_c0xx_w(m_maincpu->space(AS_PROGRAM), address, data, 0); - } - else - { - device_a2bus_card_interface *slotdevice; - - slot = (address & 0x000F00) / 0x100; - - if (slot <= 7) // slots 1-7, it's the slot - { - slotdevice = m_a2bus->get_a2bus_card(slot); - - // is this slot internal or "Your Card"? - if ((m_sltromsel & (1 << slot)) == 0) - { - // accessing a slot mapped to internal, let's put back the internal ROM - m_a2_cnxx_slot = -1; - apple2_update_memory(); - *apple2gs_getslotmem(address) = data; - } - else - { - // accessing a slot mapped to "Your Card", C800 should belong to that card if it can take it - if (slotdevice != NULL) - { - if (slotdevice->take_c800()) - { - m_a2_cnxx_slot = slot; - apple2_update_memory(); - } - slotdevice->write_cnxx(space, address&0xff, data); - } - // (else slot is your card but there's no card inserted so the write goes nowhere) - } - } - else // C800-CFFF, not cards - { - slotdevice = NULL; - - // if CFFF accessed, reset C800 area to internal ROM - if ((address & 0xfff) == 0xfff) - { - m_a2_cnxx_slot = -1; - apple2_update_memory(); - } - - if ( m_a2_cnxx_slot >= 0 && m_a2_cnxx_slot <= 7 ) - { - slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); - } - - if (slotdevice) - { - slotdevice->write_c800(space, address&0x7ff, data); - } - else - { - *apple2gs_getslotmem(address) = data; - } - } - } -} - - - -READ8_MEMBER( apple2gs_state::apple2gs_00Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0x00C000); } -READ8_MEMBER( apple2gs_state::apple2gs_01Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0x01C000); } -READ8_MEMBER( apple2gs_state::apple2gs_E0Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0xE0C000); } -READ8_MEMBER( apple2gs_state::apple2gs_E1Cxxx_r ) { return apple2gs_xxCxxx_r(space, offset | 0xE1C000); } - -WRITE8_MEMBER( apple2gs_state::apple2gs_00Cxxx_w ) { apple2gs_xxCxxx_w(space, offset | 0x00C000, data); } -WRITE8_MEMBER( apple2gs_state::apple2gs_01Cxxx_w ) { apple2gs_xxCxxx_w(space, offset | 0x01C000, data); } -WRITE8_MEMBER( apple2gs_state::apple2gs_E0Cxxx_w ) { apple2gs_xxCxxx_w(space, offset | 0xE0C000, data); } -WRITE8_MEMBER( apple2gs_state::apple2gs_E1Cxxx_w ) { apple2gs_xxCxxx_w(space, offset | 0xE1C000, data); } - -WRITE8_MEMBER( apple2gs_state::apple2gs_Exxxxx_w ) -{ - m_slowmem[offset] = data; -} - -WRITE8_MEMBER( apple2gs_state::apple2gs_E004xx_w ) { apple2gs_Exxxxx_w(space, offset + 0x00400, data, mem_mask); } -WRITE8_MEMBER( apple2gs_state::apple2gs_E02xxx_w ) { apple2gs_Exxxxx_w(space, offset + 0x02000, data, mem_mask); } -WRITE8_MEMBER( apple2gs_state::apple2gs_E104xx_w ) { apple2gs_Exxxxx_w(space, offset + 0x10400, data, mem_mask); } -WRITE8_MEMBER( apple2gs_state::apple2gs_E12xxx_w ) { apple2gs_Exxxxx_w(space, offset + 0x12000, data, mem_mask); } - -WRITE8_MEMBER( apple2gs_state::apple2gs_slowmem_w ) -{ - m_slowmem[offset] = data; - - if ((offset >= 0x19e00) && (offset < 0x19fff)) - { - int color = (offset - 0x19e00) >> 1; - - m_shr_palette[color] = rgb_t( - ((m_slowmem[0x19E00 + (color * 2) + 1] >> 0) & 0x0F) * 17, - ((m_slowmem[0x19E00 + (color * 2) + 0] >> 4) & 0x0F) * 17, - ((m_slowmem[0x19E00 + (color * 2) + 0] >> 0) & 0x0F) * 17); - } -} - -// Because the bank address multiplexes on the 65816 data bus, reading a memory area -// which doesn't drive the bus results in reading back the bank number. -READ8_MEMBER(apple2gs_state::apple2gs_bank_echo_r) -{ - return m_echo_bank + (offset>>16); -} - -void apple2gs_state::apple2gs_setup_memory() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - offs_t begin, end; - apple2_memmap_config cfg; - - /* allocate memory for E00000-E1FFFF */ - m_slowmem = auto_alloc_array_clear(machine(), UINT8, 128*1024); - save_pointer(m_slowmem, "APPLE2GS_SLOWMEM", 128*1024); - - // install expanded memory - // fair warning: other code assumes banks 0 and 1 are the first 128k of the RAM device, so you must install bank 1 at 0x10000 - // otherwise nothing works :) - if (m_is_rom3) - { - int ramsize = m_ram->size(); - - // ROM 03 hardware: the quoted "1 MB" for a base machine doesn't include banks e0/e1, so map accordingly - space.install_readwrite_bank(0x010000, ramsize - 1, "bank1"); - membank("bank1")->set_base(m_ram->pointer() + 0x010000); - - space.install_read_handler( ramsize, 0xdfffff, read8_delegate(FUNC(apple2gs_state::apple2gs_bank_echo_r),this)); - m_echo_bank = (ramsize >> 16); - } - else - { - int ramsize = m_ram->size()-0x30000; - - // ROM 00/01 hardware: the quoted "256K" for a base machine *does* include banks e0/e1. - space.install_readwrite_bank(0x010000, ramsize - 1 + 0x10000, "bank1"); - membank("bank1")->set_base(m_ram->pointer() + 0x010000); - - space.install_read_handler( ramsize + 0x10000, 0xdfffff, read8_delegate(FUNC(apple2gs_state::apple2gs_bank_echo_r),this)); - m_echo_bank = (ramsize+0x10000) >> 16; - } - - /* install hi memory */ - space.install_read_bank(0xe00000, 0xe1ffff, "bank2"); - space.install_write_handler(0xe00000, 0xe1ffff, write8_delegate(FUNC(apple2gs_state::apple2gs_slowmem_w),this)); - space.install_write_handler(0xe00400, 0xe007ff, write8_delegate(FUNC(apple2gs_state::apple2gs_E004xx_w),this)); - space.install_write_handler(0xe02000, 0xe03fff, write8_delegate(FUNC(apple2gs_state::apple2gs_E02xxx_w),this)); - space.install_write_handler(0xe10400, 0xe107ff, write8_delegate(FUNC(apple2gs_state::apple2gs_E104xx_w),this)); - space.install_write_handler(0xe12000, 0xe13fff, write8_delegate(FUNC(apple2gs_state::apple2gs_E12xxx_w),this)); - membank("bank2")->set_base(m_slowmem); - - /* install alternate ROM bank */ - begin = 0x1000000 - memregion("maincpu")->bytes(); - end = 0xffffff; - space.install_read_bank(begin, end, "bank3"); - membank("bank3")->set_base(m_rom); - - /* install new xxC000-xxCFFF handlers */ - space.install_read_handler(0x00c000, 0x00cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_00Cxxx_r),this)); - space.install_write_handler(0x00c000, 0x00cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_00Cxxx_w),this)); - space.install_read_handler(0x01c000, 0x01cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_01Cxxx_r),this)); - space.install_write_handler(0x01c000, 0x01cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_01Cxxx_w),this)); - space.install_read_handler(0xe0c000, 0xe0cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_E0Cxxx_r),this)); - space.install_write_handler(0xe0c000, 0xe0cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_E0Cxxx_w),this)); - space.install_read_handler(0xe1c000, 0xe1cfff, read8_delegate(FUNC(apple2gs_state::apple2gs_E1Cxxx_r),this)); - space.install_write_handler(0xe1c000, 0xe1cfff, write8_delegate(FUNC(apple2gs_state::apple2gs_E1Cxxx_w),this)); - - - /* install aux memory writes (for shadowing) */ - space.install_write_handler(0x010400, 0x0107FF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux0400_w), this)); - space.install_write_handler(0x012000, 0x013FFF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux2000_w), this)); - space.install_write_handler(0x014000, 0x019FFF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux4000_w), this)); - - /* setup the Apple II memory system */ - memset(&cfg, 0, sizeof(cfg)); - cfg.first_bank = 4; - cfg.memmap = apple2gs_memmap_entries; - cfg.auxmem = m_slowmem; - cfg.auxmem_length = 0x20000; - apple2_setup_memory(&cfg); -} - - - -/* ----------------------------------------------------------------------- - * Driver Init - * ----------------------------------------------------------------------- */ - -READ8_MEMBER(apple2gs_state::apple2gs_read_vector) -{ - return space.read_byte(offset | 0xFF0000); -} - -MACHINE_RESET_MEMBER(apple2gs_state,apple2gs) -{ - apple2gs_refresh_delegates(); - - // call "base class" machine reset to set up m_rambase and the language card - machine_reset(); - - m_cur_slot6_image = NULL; - m_newvideo = 0x00; - m_vgcint = 0x00; - m_langsel = 0x00; - m_sltromsel = 0x00; - m_cyareg = 0x80; - m_inten = 0x00; - m_intflag = 0x00; - m_shadow = 0x00; - m_pending_irqs = 0x00; - m_mouse_x = 0x00; - m_mouse_y = 0x00; - m_mouse_dx = 0x00; - m_mouse_dy = 0x00; - #if !RUN_ADB_MICRO - m_adb_state = ADBSTATE_IDLE; - m_adb_kmstatus = 0x00; - m_adb_command = 0; - m_adb_mode = 0; - m_adb_latent_result = 0; - m_adb_command_length = 0; - m_adb_command_pos = 0; - memset(m_adb_command_bytes, 0, sizeof(m_adb_command_bytes)); - memset(m_adb_response_bytes, 0, sizeof(m_adb_response_bytes)); - m_adb_response_length = 0; - m_adb_response_pos = 0; - memset(m_adb_memory, 0, sizeof(m_adb_memory)); - m_adb_address_keyboard = 2; - m_adb_address_mouse = 3; - #endif - - /* init time */ - m_clock_data = 0; - m_clock_control =0; - m_clock_read = 0; - m_clock_reg1 = 0; - m_clock_mode = CLOCKMODE_IDLE; - m_clock_curtime = 0; - m_clock_curtime_interval = 0; - - m_sndglu_ctrl = 0x00; - m_sndglu_addr = 0; - m_sndglu_dummy_read = 0; - - m_adb_dtime = 0; - m_last_adb_time = 0; -} - -MACHINE_START_MEMBER(apple2gs_state,apple2gscommon) -{ - apple2gs_refresh_delegates(); - - m_machinetype = APPLE_IIGS; - apple2eplus_init_common(NULL); - - /* set up Apple IIgs vectoring */ - m_maincpu->set_read_vector_callback(read8_delegate(FUNC(apple2gs_state::apple2gs_read_vector),this)); - - /* setup globals */ - m_is_rom3 = true; - - machine().device("nvram")->set_base(m_clock_bram, sizeof(m_clock_bram)); - - /* save state stuff. note that the driver takes care of docram. */ - UINT8* ram = m_ram->pointer(); - save_pointer(ram, "APPLE2GS_RAM", m_ram->size()); - - save_item(m_newvideo, "NEWVIDEO"); - save_item(m_bordercolor, "BORDERCOLOR"); - save_item(m_vgcint, "VGCINT"); - save_item(m_langsel, "LANGSEL"); - save_item(m_sltromsel, "SLTROMSEL"); - save_item(m_cyareg, "CYAREG"); - save_item(m_inten, "INTEN"); - save_item(m_intflag, "INTFLAG"); - save_item(m_shadow, "SHADOW"); - save_item(m_pending_irqs, "PENDIRQ"); - save_item(m_mouse_x, "MX"); - save_item(m_mouse_y, "MY"); - save_item(m_mouse_dx, "MDX"); - save_item(m_mouse_dy, "MDY"); - - save_item(m_clock_data, "CLKDATA"); - save_item(m_clock_control, "CLKCTRL"); - save_item(m_clock_read, "CLKRD"); - save_item(m_clock_reg1, "CLKREG1"); - save_item(m_clock_curtime, "CLKCURTIME"); - save_item(m_clock_curtime_interval, "CLKCURTIMEINT"); -// save_item(m_clock_mode, "CLKMODE"); - save_item(NAME(m_clock_bram)); -#if !RUN_ADB_MICRO - save_item(NAME(m_adb_memory)); - save_item(NAME(m_adb_command_bytes)); - save_item(NAME(m_adb_response_bytes)); -// save_item(m_adb_state, "ADB/m_adb_state"); - save_item(m_adb_command, "ADB/m_adb_command"); - save_item(m_adb_mode, "ADB/m_adb_mode"); - save_item(m_adb_kmstatus, "ADB/m_adb_kmstatus"); - save_item(m_adb_latent_result, "ADB/m_adb_latent_result"); - save_item(m_adb_command_length, "ADB/m_adb_command_length"); - save_item(m_adb_command_pos, "ADB/m_adb_command_pos"); - save_item(m_adb_response_length, "ADB/m_adb_response_length"); - save_item(m_adb_response_pos, "ADB/m_adb_response_pos"); - save_item(m_adb_address_keyboard, "ADB/m_adb_address_keyboard"); - save_item(m_adb_address_mouse, "ADB/m_adb_address_mouse"); -#endif - save_item(m_sndglu_ctrl, "SNDGLUCTRL"); - save_item(m_sndglu_addr, "SNDGLUADDR"); - save_item(m_sndglu_dummy_read, "SNDGLUDUMMYRD"); - - save_item(m_echo_bank, "ECHOBANK"); - - m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_clock_tick),this)); - m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); - - m_qsecond_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_qsecond_tick),this)); - m_qsecond_timer->adjust(attotime::from_usec(266700), 0, attotime::from_usec(266700)); - - m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_scanline_tick),this)); - m_scanline_timer->adjust(attotime::never); - - // fire on scanline zero - m_scanline_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); -} - -MACHINE_START_MEMBER(apple2gs_state,apple2gs) -{ - MACHINE_START_CALL_MEMBER(apple2gscommon); - apple2gs_setup_memory(); -} - -MACHINE_START_MEMBER(apple2gs_state,apple2gsr1) -{ - MACHINE_START_CALL_MEMBER(apple2gscommon); - - m_is_rom3 = false; - apple2gs_setup_memory(); -} - -void apple2gs_state::apple2gs_refresh_delegates() -{ - write_delegates_2gs0400[0] = write8_delegate(FUNC(apple2gs_state::apple2gs_aux0400_w), this); - write_delegates_2gs0400[1] = write8_delegate(FUNC(apple2gs_state::apple2gs_main0400_w), this); - write_delegates_2gs2000[0] = write8_delegate(FUNC(apple2gs_state::apple2gs_aux2000_w), this); - write_delegates_2gs2000[1] = write8_delegate(FUNC(apple2gs_state::apple2gs_main2000_w), this); - write_delegates_2gs4000[0] = write8_delegate(FUNC(apple2gs_state::apple2gs_aux4000_w), this); - write_delegates_2gs4000[1] = write8_delegate(FUNC(apple2gs_state::apple2gs_main4000_w), this); -} - -/* ----------------------------------------------------------------------- - * Keym_glu / low-level ADB emulation - * ----------------------------------------------------------------------- */ -#if RUN_ADB_MICRO -UINT8 apple2gs_state::keyglu_mcu_read(UINT8 offset) -{ - UINT8 rv = m_glu_regs[offset]; - -// printf("MCU reads reg %x\n", offset); - - // the command full flag is cleared by the MCU reading - // first the KGS register and then the command register - if ((offset == GLU_COMMAND) && (m_glu_mcu_read_kgs)) - { - m_glu_regs[GLU_KG_STATUS] &= ~KGS_COMMAND_FULL; - m_glu_mcu_read_kgs = false; -// printf("MCU reads COMMAND = %02x (drop command full)\n", rv); - } - - // prime for the next command register read to clear the command full flag - if (offset == GLU_KG_STATUS) - { - m_glu_mcu_read_kgs = true; - } - - return rv; -} - -void apple2gs_state::keyglu_mcu_write(UINT8 offset, UINT8 data) -{ - m_glu_regs[offset] = data; - -// printf("MCU writes %02x to reg %x\n", data, offset); - - switch (offset) - { - case GLU_MOUSEX: - case GLU_MOUSEY: - m_glu_regs[GLU_KG_STATUS] |= KGS_MOUSEX_FULL; - m_glu_mouse_read_stat = false; // signal next read will be mouse X - break; - - case GLU_ANY_KEY_DOWN: // bit 7 is the actual flag here; both MCU programs write either 0x7f or 0xff -// printf("%d to ANY_KEY_DOWN (PC=%x)\n", data, m_adbmicro->pc()); - if (data & 0x80) - { - m_glu_regs[GLU_KG_STATUS] |= KGS_ANY_KEY_DOWN | KGS_KEYSTROBE; - } - break; - - case GLU_DATA: - m_glu_regs[GLU_KG_STATUS] |= KGS_DATA_FULL; - m_glu_816_read_dstat = false; -// printf("MCU writes %02x to DATA\n", data); - break; - } -} - -/* - Keym_glu registers map as follows on the 816: - - C000 = key data + any key down, clears strobe - C010 = clears keystrobe - - C024 MOUSEDATA = reads GLU mouseX and mouseY - C025 KEYMODREG = reads GLU keymod register - C026 DATAREG = writes from the 816 go to COMMAND, reads from DATA - C027 KMSTATUS = GLU system status register - -*/ -UINT8 apple2gs_state::keyglu_816_read(UINT8 offset) -{ - switch (offset) - { - case GLU_C000: - { - UINT8 rv; - rv = m_glu_regs[GLU_KEY_DATA] & 0x7f; - if (m_glu_regs[GLU_KG_STATUS] & KGS_KEYSTROBE) - { - rv |= 0x80; - } - return rv; - } - break; - - case GLU_C010: - { - UINT8 rv; - rv = m_glu_regs[GLU_KEY_DATA] & 0x7f; - if (m_glu_regs[GLU_KG_STATUS] & KGS_KEYSTROBE) - { - rv |= 0x80; - } - m_glu_regs[GLU_KG_STATUS] &= ~KGS_KEYSTROBE; - return rv; - } - break; - - case GLU_MOUSEX: - case GLU_MOUSEY: - if (!m_glu_mouse_read_stat) - { - m_glu_mouse_read_stat = 1; - return m_glu_regs[GLU_MOUSEY]; - } - return m_glu_regs[GLU_MOUSEX]; - - case GLU_SYSSTAT: - // regenerate sysstat bits - m_glu_sysstat &= ~0xab; // mask off read/write bits - if (m_glu_regs[GLU_KG_STATUS] & KGS_COMMAND_FULL) - { - m_glu_sysstat |= 1; - } - if (m_glu_regs[GLU_KG_STATUS] & m_glu_mouse_read_stat) - { - m_glu_sysstat |= 2; - } - if (m_glu_regs[GLU_KG_STATUS] & KGS_KEYSTROBE) - { - m_glu_sysstat |= 8; - } - if (m_glu_regs[GLU_KG_STATUS] & KGS_DATA_FULL) - { - m_glu_sysstat |= 0x20; - } - if (m_glu_regs[GLU_KG_STATUS] & KGS_MOUSEX_FULL) - { - m_glu_sysstat |= 0x80; - } - m_glu_816_read_dstat = true; -// printf("816 gets %02x in sysstat (data avail %02x)\n", m_glu_sysstat, m_glu_sysstat & 0x20); - return m_glu_sysstat; - - case GLU_DATA: - if (m_glu_816_read_dstat) - { - m_glu_816_read_dstat = false; - m_glu_regs[GLU_KG_STATUS] &= ~KGS_DATA_FULL; -// printf("816 reads %02x from DATA\n", m_glu_regs[GLU_DATA]); - } - return m_glu_regs[GLU_DATA]; - - default: - return m_glu_regs[offset]; - break; - } - - return 0xff; -} - -void apple2gs_state::keyglu_816_write(UINT8 offset, UINT8 data) -{ - if (offset < GLU_C000) - { - m_glu_regs[offset&7] = data; - } - - switch (offset) - { - case GLU_C010: - m_glu_regs[GLU_KG_STATUS] &= ~KGS_KEYSTROBE; - break; - - case GLU_COMMAND: -// printf("816 sets COMMAND to %02x (raise command full)\n", data); - m_glu_regs[GLU_KG_STATUS] |= KGS_COMMAND_FULL; - break; - - case GLU_SYSSTAT: - m_glu_sysstat &= 0xab; // clear the non-read-only fields - m_glu_sysstat |= (data & ~0xab); - break; - } -} -#endif diff --git a/src/mess/machine/apple3.c b/src/mess/machine/apple3.c deleted file mode 100644 index 8df76e3de4a..00000000000 --- a/src/mess/machine/apple3.c +++ /dev/null @@ -1,1301 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,R. Belmont -/*************************************************************************** - - machine/apple3.c - - Apple /// - - VIA #0 (D VIA) - CA1: IRQ from the MM58167 RTC - CA2: 1 if key pressed, 0 otherwise - CB1/CB2: connected to VBL - - Port A: Environment register (all bits out) - bit 7: 1 for 1 MHz, 0 for 2 MHz - bit 6: 1 for I/O at C000-CFFF - bit 5: 1 to enable video - bit 4: 1 to enable NMI/Reset - bit 3: 1 to write-protect RAM in system bank C000-FFFF - bit 2: 1 to force primary stack at 0100-01FF - bit 1: 1 for primary ROM, 0 for secondary (Apple III doesn't have a secondary ROM, so this should always be '1' when bit 0 is) - bit 0: 1 to enable ROM in F000-FFFF - - Port B: Zero page high 8 address bits, also MM58167 RTC register select (all bits out) - - VIA #1 (E VIA) - CA1: OR of all 4 slots' IRQ status - CA2: SW1 (Open Apple key?) - CB1: SW3/SCO - CB2: SER - - Port A: - bits 0-2: bank select for $2000-$9FFF range - bit 3: n/c - bit 4: slot 4 IRQ (in) - bit 5: slot 3 IRQ (in) - bit 6: Apple II mode trap output (out) - bit 7: IRQ status (in) (0 = IRQ, 1 = no IRQ) - - Port B: - bits 0-5: 6-bit audio DAC output - bit 6: screen blank - bit 7: OR of NMI from slots - -***************************************************************************/ - -#include "emu.h" -#include "includes/apple3.h" -#include "includes/apple2.h" - -#define LOG_MEMORY 1 -#define LOG_INDXADDR 1 - -#define ENV_SLOWSPEED (0x80) -#define ENV_IOENABLE (0x40) -#define ENV_VIDENABLE (0x20) -#define ENV_NMIENABLE (0x10) -#define ENV_WRITEPROT (0x08) -#define ENV_STACK1XX (0x04) -#define ENV_PRIMARYROM (0x02) -#define ENV_ROMENABLE (0x01) - -READ8_MEMBER(apple3_state::apple3_c0xx_r) -{ - UINT8 result = 0xFF; - device_a2bus_card_interface *slotdevice; - - switch(offset) - { - /* keystrobe */ - case 0x00: case 0x01: case 0x02: case 0x03: - case 0x04: case 0x05: case 0x06: case 0x07: - result = (m_transchar & 0x7f) | m_strobe; - break; - - /* modifier keys */ - case 0x08: case 0x09: case 0x0A: case 0x0B: - case 0x0C: case 0x0D: case 0x0E: case 0x0F: - { - UINT8 tmp = m_kbspecial->read(); - - result = 0x7c | (m_transchar & 0x80); - - if (m_strobe) - { - result |= 1; - } - - if (tmp & 0x06) - { - result |= 0x02; - } - if (tmp & 0x08) - { - result &= ~0x04; - } - if (tmp & 0x01) - { - result &= ~0x08; - } - if (tmp & 0x10) - { - result &= ~0x10; - } - if (tmp & 0x20) - { - result &= ~0x20; - } - } -// printf("modifier = %02x\n", result); - break; - - case 0x10: case 0x11: case 0x12: case 0x13: - case 0x14: case 0x15: case 0x16: case 0x17: - case 0x18: case 0x19: case 0x1A: case 0x1B: - case 0x1C: case 0x1D: case 0x1E: case 0x1F: - m_strobe = 0; - break; - - case 0x20: case 0x21: case 0x22: case 0x23: - case 0x24: case 0x25: case 0x26: case 0x27: - case 0x28: case 0x29: case 0x2A: case 0x2B: - case 0x2C: case 0x2D: case 0x2E: case 0x2F: - m_cnxx_slot = -1; - break; - - case 0x30: case 0x31: case 0x32: case 0x33: - case 0x34: case 0x35: case 0x36: case 0x37: - case 0x38: case 0x39: case 0x3A: case 0x3B: - case 0x3C: case 0x3D: case 0x3E: case 0x3F: - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - break; - - case 0x40: case 0x41: case 0x42: case 0x43: - case 0x44: case 0x45: case 0x46: case 0x47: - case 0x48: case 0x49: case 0x4A: case 0x4B: - case 0x4C: case 0x4D: case 0x4E: case 0x4F: - m_c040_time = 200; - break; - - case 0x50: case 0x51: case 0x52: case 0x53: - case 0x54: case 0x55: case 0x56: case 0x57: - /* graphics softswitches */ - if (offset & 1) - m_flags |= 1 << ((offset - 0x50) / 2); - else - m_flags &= ~(1 << ((offset - 0x50) / 2)); - break; - - case 0x58: - case 0x59: - case 0x5a: - case 0x5b: - case 0x5c: - case 0x5d: - case 0x5e: - case 0x5f: - pdl_handler(offset); - break; - - case 0x60: // joystick switch 0 - case 0x68: - result = (m_joybuttons->read() & 1) ? 0x80 : 0x00; - break; - - case 0x61: // joystick switch 1 (margin switch for Silentype) - case 0x69: - result = (m_joybuttons->read() & 4) ? 0x80 : 0x00; - break; - - case 0x62: // joystick switch 2 - case 0x6a: - result = (m_joybuttons->read() & 2) ? 0x80 : 0x00; - break; - - case 0x63: // joystick switch 3 (serial clock for silentype) - case 0x6b: - result = (m_joybuttons->read() & 8) ? 0x80 : 0x00; - break; - - case 0x66: // paddle A/D conversion done (bit 7 = 1 while counting, 0 when done) - case 0x6e: - result = m_ramp_active ? 0x80 : 0x00; - break; - - case 0x70: case 0x71: case 0x72: case 0x73: - case 0x74: case 0x75: case 0x76: case 0x77: - case 0x78: case 0x79: case 0x7A: case 0x7B: - case 0x7C: case 0x7D: case 0x7E: case 0x7F: - result = m_rtc->read(space, m_via_0_b); - break; - - case 0x90: case 0x91: case 0x92: case 0x93: - case 0x94: case 0x95: case 0x96: case 0x97: - case 0x98: case 0x99: case 0x9a: case 0x9b: - case 0x9c: case 0x9d: case 0x9e: case 0x9f: - slotdevice = m_a2bus->get_a2bus_card(1); - if (slotdevice != NULL) - { - result = slotdevice->read_c0nx(space, offset&0xf); - } - break; - - case 0xa0: case 0xa1: case 0xa2: case 0xa3: - case 0xa4: case 0xa5: case 0xa6: case 0xa7: - case 0xa8: case 0xa9: case 0xaa: case 0xab: - case 0xac: case 0xad: case 0xae: case 0xaf: - slotdevice = m_a2bus->get_a2bus_card(2); - if (slotdevice != NULL) - { - result = slotdevice->read_c0nx(space, offset&0xf); - } - break; - - case 0xb0: case 0xb1: case 0xb2: case 0xb3: - case 0xb4: case 0xb5: case 0xb6: case 0xb7: - case 0xb8: case 0xb9: case 0xba: case 0xbb: - case 0xbc: case 0xbd: case 0xbe: case 0xbf: - slotdevice = m_a2bus->get_a2bus_card(3); - if (slotdevice != NULL) - { - result = slotdevice->read_c0nx(space, offset&0xf); - } - break; - - case 0xc0: case 0xc1: case 0xc2: case 0xc3: - case 0xc4: case 0xc5: case 0xc6: case 0xc7: - case 0xc8: case 0xc9: case 0xca: case 0xcb: - case 0xcc: case 0xcd: case 0xce: case 0xcf: - slotdevice = m_a2bus->get_a2bus_card(4); - if (slotdevice != NULL) - { - result = slotdevice->read_c0nx(space, offset&0xf); - } - break; - - case 0xD0: case 0xD1: case 0xD2: case 0xD3: - case 0xD4: case 0xD5: case 0xD6: case 0xD7: - /* external drive stuff */ - m_fdc->read_c0dx(space, offset&0xf); - result = 0x00; - break; - - case 0xd8: case 0xd9: - m_smoothscr = offset & 1; - break; - - case 0xDB: - apple3_write_charmem(); - break; - - case 0xE0: case 0xE1: - result = m_fdc->read(space, offset&0xf); - m_va = offset & 1; - break; - - case 0xE2: case 0xE3: - result = m_fdc->read(space, offset&0xf); - m_vb = offset & 1; - break; - - case 0xE4: case 0xE5: - result = m_fdc->read(space, offset&0xf); - m_vc = offset & 1; - break; - - case 0xE6: case 0xE7: case 0xE8: case 0xE9: - case 0xEA: case 0xEB: case 0xEC: case 0xED: - case 0xEE: case 0xEF: - result = m_fdc->read(space, offset&0xf); - break; - - case 0xF0: - case 0xF1: - case 0xF2: - case 0xF3: - result = m_acia->read(space, offset & 0x03); - break; - } - return result; -} - - - -WRITE8_MEMBER(apple3_state::apple3_c0xx_w) -{ - device_a2bus_card_interface *slotdevice; - - switch(offset) - { - case 0x10: case 0x11: case 0x12: case 0x13: - case 0x14: case 0x15: case 0x16: case 0x17: - case 0x18: case 0x19: case 0x1A: case 0x1B: - case 0x1C: case 0x1D: case 0x1E: case 0x1F: - m_strobe = 0; - break; - - case 0x20: case 0x21: case 0x22: case 0x23: - case 0x24: case 0x25: case 0x26: case 0x27: - case 0x28: case 0x29: case 0x2A: case 0x2B: - case 0x2C: case 0x2D: case 0x2E: case 0x2F: - m_cnxx_slot = -1; - break; - - case 0x30: case 0x31: case 0x32: case 0x33: - case 0x34: case 0x35: case 0x36: case 0x37: - case 0x38: case 0x39: case 0x3A: case 0x3B: - case 0x3C: case 0x3D: case 0x3E: case 0x3F: - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - break; - - case 0x40: case 0x41: case 0x42: case 0x43: - case 0x44: case 0x45: case 0x46: case 0x47: - case 0x48: case 0x49: case 0x4A: case 0x4B: - case 0x4C: case 0x4D: case 0x4E: case 0x4F: - m_c040_time = 200; - break; - - case 0x50: case 0x51: case 0x52: case 0x53: - case 0x54: case 0x55: case 0x56: case 0x57: - /* graphics softswitches */ - if (offset & 1) - m_flags |= 1 << ((offset - 0x50) / 2); - else - m_flags &= ~(1 << ((offset - 0x50) / 2)); - break; - - case 0x58: - case 0x59: - case 0x5a: - case 0x5b: - case 0x5c: - case 0x5d: - case 0x5e: - case 0x5f: - pdl_handler(offset); - break; - - case 0x70: case 0x71: case 0x72: case 0x73: - case 0x74: case 0x75: case 0x76: case 0x77: - case 0x78: case 0x79: case 0x7A: case 0x7B: - case 0x7C: case 0x7D: case 0x7E: case 0x7F: - m_rtc->write(space, m_via_0_b, data); - break; - - - case 0x90: case 0x91: case 0x92: case 0x93: - case 0x94: case 0x95: case 0x96: case 0x97: - case 0x98: case 0x99: case 0x9a: case 0x9b: - case 0x9c: case 0x9d: case 0x9e: case 0x9f: - slotdevice = m_a2bus->get_a2bus_card(1); - if (slotdevice != NULL) - { - slotdevice->write_c0nx(space, offset&0xf, data); - } - break; - - case 0xa0: case 0xa1: case 0xa2: case 0xa3: - case 0xa4: case 0xa5: case 0xa6: case 0xa7: - case 0xa8: case 0xa9: case 0xaa: case 0xab: - case 0xac: case 0xad: case 0xae: case 0xaf: - slotdevice = m_a2bus->get_a2bus_card(2); - if (slotdevice != NULL) - { - slotdevice->write_c0nx(space, offset&0xf, data); - } - break; - - case 0xb0: case 0xb1: case 0xb2: case 0xb3: - case 0xb4: case 0xb5: case 0xb6: case 0xb7: - case 0xb8: case 0xb9: case 0xba: case 0xbb: - case 0xbc: case 0xbd: case 0xbe: case 0xbf: - slotdevice = m_a2bus->get_a2bus_card(3); - if (slotdevice != NULL) - { - slotdevice->write_c0nx(space, offset&0xf, data); - } - break; - - case 0xc0: case 0xc1: case 0xc2: case 0xc3: - case 0xc4: case 0xc5: case 0xc6: case 0xc7: - case 0xc8: case 0xc9: case 0xca: case 0xcb: - case 0xcc: case 0xcd: case 0xce: case 0xcf: - slotdevice = m_a2bus->get_a2bus_card(4); - if (slotdevice != NULL) - { - slotdevice->write_c0nx(space, offset&0xf, data); - } - break; - - case 0xD0: case 0xD1: case 0xD2: case 0xD3: - case 0xD4: case 0xD5: case 0xD6: case 0xD7: - /* external drive stuff */ - m_fdc->write_c0dx(space, offset&0xf, data); - break; - - case 0xd9: - popmessage("Smooth scroll enabled, contact MESSdev"); - break; - - case 0xDB: - apple3_write_charmem(); - break; - - case 0xE0: case 0xE1: case 0xE2: case 0xE3: - case 0xE4: case 0xE5: case 0xE6: case 0xE7: - case 0xE8: case 0xE9: case 0xEA: case 0xEB: - case 0xEC: case 0xED: case 0xEE: case 0xEF: - m_fdc->write(space, offset&0xf, data); - break; - - case 0xF0: - case 0xF1: - case 0xF2: - case 0xF3: - m_acia->write(space, offset & 0x03, data); - break; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(apple3_state::apple3_interrupt) -{ - m_via_1->write_cb1(machine().first_screen()->vblank()); - m_via_1->write_cb2(machine().first_screen()->vblank()); -} - -UINT8 *apple3_state::apple3_bankaddr(UINT16 bank, offs_t offset) -{ - if (bank != (UINT16) ~0) - { - bank %= m_ram->size() / 0x8000; - if ((bank + 1) == (m_ram->size() / 0x8000)) - bank = 0x02; - } - offset += ((offs_t) bank) * 0x8000; - offset %= m_ram->size(); - return &m_ram->pointer()[offset]; -} - -UINT8 *apple3_state::apple3_get_zpa_addr(offs_t offset) -{ - m_zpa = (((offs_t) m_via_0_b) * 0x100) + offset; - - if (m_via_0_b < 0x20) - return apple3_bankaddr(~0, m_zpa); - else if (m_via_0_b > 0x9F) - return apple3_bankaddr(~0, m_zpa - 0x8000); - else - return apple3_bankaddr(m_via_1_a, m_zpa - 0x2000); -} - -void apple3_state::apple3_update_memory() -{ - UINT16 bank; - UINT8 page; - - if (LOG_MEMORY) - { - logerror("apple3_update_memory(): via_0_b=0x%02x via_1_a=0x0x%02x\n", m_via_0_b, m_via_1_a); - } - - machine().device("maincpu")->set_unscaled_clock((m_via_0_a & ENV_SLOWSPEED) ? 1021800 : 2000000); - - /* bank 2 (0100-01FF) */ - if (!(m_via_0_a & ENV_STACK1XX)) - { - if (m_via_0_b < 0x20) - { - bank = ~0; /* system bank */ - page = m_via_0_b ^ 0x01; - } - else if (m_via_0_b >= 0xA0) - { - bank = ~0; /* system bank */ - page = (m_via_0_b ^ 0x01) - 0x80; - } - else - { - bank = m_via_1_a; - page = (m_via_0_b ^ 0x01) - 0x20; - } - } - else - { - bank = ~0; - page = 0x01; - } - m_bank2 = apple3_bankaddr(bank, ((offs_t) page) * 0x100); - - /* bank 3 (0200-1FFF) */ - m_bank3 = apple3_bankaddr(~0, 0x0200); - - /* bank 4 (2000-9FFF) */ - m_bank4 = apple3_bankaddr(m_via_1_a, 0x0000); - - /* bank 5 (A000-BFFF) */ - m_bank5 = apple3_bankaddr(~0, 0x2000); - - /* bank 8 (C000-C0FF) */ - if (!(m_via_0_a & ENV_IOENABLE)) - { - m_bank8 = apple3_bankaddr(~0, 0x4000); - } - - /* bank 9 (C100-C4FF) */ - if (!(m_via_0_a & ENV_IOENABLE)) - { - m_bank9 = apple3_bankaddr(~0, 0x4100); - } - - /* bank 10 (C500-C7FF) */ - m_bank10 = apple3_bankaddr(~0, 0x4500); - - /* bank 11 (C800-CFFF) */ - if (!(m_via_0_a & ENV_IOENABLE)) - { - m_bank11 = apple3_bankaddr(~0, 0x4800); - } - - /* install bank 6 (D000-EFFF) */ - m_bank6 = apple3_bankaddr(~0, 0x5000); - - /* install bank 7 (F000-FFFF) */ - m_bank7wr = apple3_bankaddr(~0, 0x7000); - if (m_via_0_a & ENV_ROMENABLE) - { - m_bank7rd = memregion("maincpu")->base(); - } - else - { - m_rom_has_been_disabled = true; - m_bank7rd = m_bank7wr; - - // if we had an IRQ waiting for RAM to be paged in... - apple3_irq_update(); - } -} - - - -void apple3_state::apple3_via_out(UINT8 *var, UINT8 data) -{ - if (*var != data) - { - *var = data; - apple3_update_memory(); - } -} - - -WRITE8_MEMBER(apple3_state::apple3_via_0_out_a) -{ - apple3_via_out(&m_via_0_a, data); -} - -WRITE8_MEMBER(apple3_state::apple3_via_0_out_b) -{ -// printf("ZP to %02x\n", data); - apple3_via_out(&m_via_0_b, data); -} - -WRITE8_MEMBER(apple3_state::apple3_via_1_out_a) -{ - apple3_via_out(&m_via_1_a, data); -} - -WRITE8_MEMBER(apple3_state::apple3_via_1_out_b) -{ - m_dac->write_unsigned8(data<<2); - apple3_via_out(&m_via_1_b, data); -} - -void apple3_state::apple3_irq_update() -{ - if (m_acia_irq || m_via_1_irq || m_via_0_irq) - { - // HACK: SOS floppy driver enables ROM at Fxxx *before* trying to - // suppress IRQs. IRQ hits at inopportune time -> bad vector -> system crash. - // This breaks the Confidence Test, but the Confidence Test - // never disables the ROM so checking for that gets us - // working in all cases. - // Bonus points: for some reason this isn't a problem with -debug. - // m6502 heisenbug maybe? - if ((m_via_0_a & ENV_ROMENABLE) && (m_rom_has_been_disabled)) - { - return; - } -// printf(" setting IRQ\n"); - m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - m_via_1->write_pa7(0); // this is active low - } - else - { -// printf(" clearing IRQ\n"); - m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); - m_via_1->write_pa7(1); - } -} - -WRITE_LINE_MEMBER(apple3_state::apple3_acia_irq_func) -{ -// printf("acia IRQ: %d\n", state); - m_acia_irq = state; - apple3_irq_update(); -} - -WRITE_LINE_MEMBER(apple3_state::apple3_via_1_irq_func) -{ -// printf("via 1 IRQ: %d\n", state); - m_via_1_irq = state; - apple3_irq_update(); -} - - -WRITE_LINE_MEMBER(apple3_state::apple3_via_0_irq_func) -{ -// printf("via 0 IRQ: %d\n", state); - m_via_0_irq = state; - apple3_irq_update(); -} - -MACHINE_RESET_MEMBER(apple3_state,apple3) -{ - m_indir_bank = 0; - m_sync = false; - m_speaker_state = 0; - m_speaker->level_w(0); - m_c040_time = 0; - m_strobe = 0; - m_lastchar = 0x0d; - m_rom_has_been_disabled = false; - m_cnxx_slot = -1; - m_analog_sel = 0; - m_ramp_active = false; - - m_fdc->set_floppies_4(floppy0, floppy1, floppy2, floppy3); -} - - - -UINT8 *apple3_state::apple3_get_indexed_addr(offs_t offset) -{ - UINT8 *result = NULL; - - // m_indir_bank is guaranteed to be between 0x80 and 0x8f - if (m_indir_bank == 0x8f) - { - /* get at that special ram under the VIAs */ - if ((offset >= 0xFFD0) && (offset <= 0xFFEF)) - result = apple3_bankaddr(~0, offset & 0x7FFF); - else if (offset < 0x2000) - result = apple3_bankaddr(~0, offset - 0x2000); - else if (offset > 0x9FFF) - result = apple3_bankaddr(~0, offset - 0x8000); - else - result = &m_ram->pointer()[offset - 0x2000]; - } - else - { - result = apple3_bankaddr(m_indir_bank, offset); - } - - return result; -} - -DRIVER_INIT_MEMBER(apple3_state,apple3) -{ - m_enable_mask = 0; - - m_flags = 0; - m_acia_irq = 0; - m_via_0_a = ~0; - m_via_1_a = ~0; - m_via_0_irq = 0; - m_via_1_irq = 0; - m_va = 0; - m_vb = 0; - m_vc = 0; - m_smoothscr = 0; - - // kludge round +12v pull up resistors, which after conversion will bring this low when nothing is plugged in. issue also affects dcd/dsr but those don't affect booting. - m_acia->write_cts(0); - - /* these are here to appease the Apple /// confidence tests */ - m_via_1->write_pa0(1); - m_via_1->write_pa1(1); - m_via_1->write_pa2(1); - m_via_1->write_pa3(1); - m_via_1->write_pa4(1); - m_via_1->write_pa5(1); - m_via_1->write_pa6(1); - m_via_1->write_pa7(1); - - m_via_1->write_pb0(1); - m_via_1->write_pb1(1); - m_via_1->write_pb2(1); - m_via_1->write_pb3(1); - m_via_1->write_pb4(1); - m_via_1->write_pb5(1); - m_via_1->write_pb6(1); - m_via_1->write_pb7(1); - - apple3_update_memory(); - - save_item(NAME(m_acia_irq)); - save_item(NAME(m_via_0_a)); - save_item(NAME(m_via_0_b)); - save_item(NAME(m_via_1_a)); - save_item(NAME(m_via_1_b)); - save_item(NAME(m_via_0_irq)); - save_item(NAME(m_via_1_irq)); - save_item(NAME(m_zpa)); - save_item(NAME(m_last_n)); - save_item(NAME(m_sync)); - save_item(NAME(m_rom_has_been_disabled)); - save_item(NAME(m_indir_bank)); - save_item(NAME(m_cnxx_slot)); - save_item(NAME(m_speaker_state)); - save_item(NAME(m_c040_time)); - save_item(NAME(m_lastchar)); - save_item(NAME(m_strobe)); - save_item(NAME(m_transchar)); - save_item(NAME(m_flags)); - save_item(NAME(m_char_mem)); - save_item(NAME(m_analog_sel)); - save_item(NAME(m_ramp_active)); - save_item(NAME(m_pdl_charge)); - save_item(NAME(m_va)); - save_item(NAME(m_vb)); - save_item(NAME(m_vc)); - save_item(NAME(m_smoothscr)); - - machine().save().register_postload(save_prepost_delegate(FUNC(apple3_state::apple3_postload), this)); -} - -void apple3_state::apple3_postload() -{ - apple3_update_memory(); -} - -READ8_MEMBER(apple3_state::apple3_memory_r) -{ - UINT8 rv = 0xff; - - // (zp), y or (zp,x) read - if (!space.debugger_access()) - { - if ((m_indir_bank & 0x80) && (offset >= 0x100)) - { - UINT8 *test; - test = apple3_get_indexed_addr(offset); - - if (test) - { - return *test; - } - } - } - - if (offset < 0x100) - { - rv = *apple3_get_zpa_addr(offset); - - if ((!m_sync) && (m_via_0_b >= 0x18) && (m_via_0_b <= 0x1F)) - { - // fetch the "X byte" - m_indir_bank = *apple3_bankaddr(~0, m_zpa ^ 0x0C00) & 0x8f; - } - } - else if (offset < 0x200) - { - rv = m_bank2[offset-0x100]; - } - else if (offset < 0x2000) - { - rv = m_bank3[offset-0x200]; - } - else if (offset < 0xa000) - { - rv = m_bank4[offset-0x2000]; - } - else if (offset < 0xc000) - { - rv = m_bank5[offset-0xa000]; - } - else if (offset < 0xc100) - { - if (m_via_0_a & ENV_IOENABLE) - { - if (!space.debugger_access()) - { - rv = apple3_c0xx_r(space, offset-0xc000); - } - } - else - { - rv = m_bank8[offset - 0xc000]; - } - } - else if (offset < 0xc500) - { - if (!(m_via_0_a & ENV_IOENABLE)) - { - rv = m_bank9[offset - 0xc100]; - } - else - { - /* now identify the device */ - device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card((offset>>8) & 0x7); - - if (slotdevice != NULL) - { - if (slotdevice->take_c800()) - { - m_cnxx_slot = ((offset>>8) & 7); - } - - return slotdevice->read_cnxx(space, offset&0xff); - } - } - } - else if (offset < 0xc800) - { - rv = m_bank10[offset - 0xc500]; - } - else if (offset < 0xd000) - { - if (!(m_via_0_a & ENV_IOENABLE)) - { - rv = m_bank11[offset - 0xc800]; - } - else - { - if (offset == 0xcfff) - { - m_cnxx_slot = -1; - } - - if (m_cnxx_slot != -1) - { - device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card(m_cnxx_slot); - - if (slotdevice != NULL) - { - rv = slotdevice->read_c800(space, offset&0x7ff); - } - } - } - } - else if (offset < 0xf000) - { - rv = m_bank6[offset - 0xd000]; - } - else - { - if (offset >= 0xffd0 && offset <= 0xffdf) - { - rv = m_via_0->read(space, offset); - } - else if (offset >= 0xffe0 && offset <= 0xffef) - { - rv = m_via_1->read(space, offset); - } - else - { - rv = m_bank7rd[offset - 0xf000]; - } - } - - return rv; -} - -WRITE8_MEMBER(apple3_state::apple3_memory_w) -{ - if ((m_indir_bank & 0x80) && (offset >= 0x100)) - { - UINT8 *test; - test = apple3_get_indexed_addr(offset); - - if (test) - { - *test = data; - return; - } - } - - if (offset < 0x100) - { - *apple3_get_zpa_addr(offset) = data; - } - else if (offset < 0x200) - { - m_bank2[offset-0x100] = data; - } - else if (offset < 0x2000) - { - m_bank3[offset-0x200] = data; - } - else if (offset < 0xa000) - { - m_bank4[offset-0x2000] = data; - } - else if (offset < 0xc000) - { - m_bank5[offset-0xa000] = data; - } - else if (offset < 0xc100) - { - if (m_via_0_a & ENV_IOENABLE) - { - if (!space.debugger_access()) - { - apple3_c0xx_w(space, offset-0xc000, data); - } - } - else - { - // is this page write protected? - if (!(m_via_0_a & ENV_WRITEPROT)) - { - m_bank8[offset - 0xc000] = data; - } - } - } - else if (offset < 0xc500) - { - if (!(m_via_0_a & ENV_IOENABLE)) - { - if (!(m_via_0_a & ENV_WRITEPROT)) - { - m_bank9[offset - 0xc100] = data; - } - } - else - { - /* now identify the device */ - device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card((offset>>8) & 0x7); - - if (slotdevice != NULL) - { - if (slotdevice->take_c800()) - { - m_cnxx_slot = ((offset>>8) & 7); - } - - slotdevice->write_cnxx(space, offset&0xff, data); - } - } - } - else if (offset < 0xc800) - { - if (!(m_via_0_a & ENV_WRITEPROT)) - { - m_bank10[offset - 0xc500] = data; - } - } - else if (offset < 0xd000) - { - if (!(m_via_0_a & ENV_IOENABLE)) - { - if (!(m_via_0_a & ENV_WRITEPROT)) - { - m_bank11[offset - 0xc800] = data; - } - } - else - { - if (offset == 0xcfff) - { - m_cnxx_slot = -1; - } - - if (m_cnxx_slot != -1) - { - device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card(m_cnxx_slot); - - if (slotdevice != NULL) - { - slotdevice->write_c800(space, offset&0x7ff, data); - } - } - } - } - else if (offset < 0xf000) - { - if (!(m_via_0_a & ENV_WRITEPROT)) - { - m_bank6[offset - 0xd000] = data; - } - } - else - { - if (offset >= 0xffd0 && offset <= 0xffdf) - { - if (!space.debugger_access()) - { - m_via_0->write(space, offset, data); - } - } - else if (offset >= 0xffe0 && offset <= 0xffef) - { - if (!space.debugger_access()) - { - m_via_1->write(space, offset, data); - } - } - else - { - if (!(m_via_0_a & ENV_WRITEPROT)) - { - m_bank7wr[offset - 0xf000] = data; - } - } - } -} - -WRITE_LINE_MEMBER(apple3_state::apple3_sync_w) -{ -// printf("sync: %d\n", state); - m_sync = (state == ASSERT_LINE) ? true : false; - - if (m_sync) - { - m_indir_bank = 0; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(apple3_state::apple3_c040_tick) -{ - if (m_c040_time > 0) - { - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - m_c040_time--; - } -} - -READ_LINE_MEMBER(apple3_state::ay3600_shift_r) -{ - // either shift key - if (m_kbspecial->read() & 0x06) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -READ_LINE_MEMBER(apple3_state::ay3600_control_r) -{ - if (m_kbspecial->read() & 0x08) - { - return ASSERT_LINE; - } - - return CLEAR_LINE; -} - -static const UINT8 key_remap[0x50][4] = -{ -/* norm shft ctrl both */ - { 0x9b,0x9b,0x9b,0x9b }, /* Escape 00 */ - { 0x31,0x21,0x31,0x31 }, /* 1 ! 01 */ - { 0x32,0x40,0x32,0x00 }, /* 2 @ 02 */ - { 0x33,0x23,0x33,0x23 }, /* 3 # 03 */ - { 0x34,0x24,0x34,0x24 }, /* 4 $ 04 */ - { 0x35,0x25,0x35,0x25 }, /* 5 % 05 */ - { 0x36,0x5e,0x35,0x53 }, /* 6 ^ 06 */ - { 0x37,0x26,0x37,0x26 }, /* 7 & 07 */ - { 0x38,0x2a,0x38,0x2a }, /* 8 * 08 */ - { 0x39,0x28,0x39,0x28 }, /* 9 ( 09 */ - { 0x89,0x89,0x89,0x89 }, /* Tab 0a */ - { 0x51,0x51,0x11,0x11 }, /* q Q 0b */ - { 0x57,0x57,0x17,0x17 }, /* w W 0c */ - { 0x45,0x45,0x05,0x05 }, /* e E 0d */ - { 0x52,0x52,0x12,0x12 }, /* r R 0e */ - { 0x54,0x54,0x14,0x14 }, /* t T 0f */ - { 0x59,0x59,0x19,0x19 }, /* y Y 10 */ - { 0x55,0x55,0x15,0x15 }, /* u U 11 */ - { 0x49,0x49,0x09,0x09 }, /* i I 12 */ - { 0x4f,0x4f,0x0f,0x0f }, /* o O 13 */ - { 0x41,0x41,0x01,0x01 }, /* a A 14 */ - { 0x53,0x53,0x13,0x13 }, /* s S 15 */ - { 0x44,0x44,0x04,0x04 }, /* d D 16 */ - { 0x46,0x46,0x06,0x06 }, /* f F 17 */ - { 0x48,0x48,0x08,0x08 }, /* h H 18 */ - { 0x47,0x47,0x07,0x07 }, /* g G 19 */ - { 0x4a,0x4a,0x0a,0x0a }, /* j J 1a */ - { 0x4b,0x4b,0x0b,0x0b }, /* k K 1b */ - { 0x3b,0x3a,0x3b,0x3a }, /* ; : 1c */ - { 0x4c,0x4c,0x0c,0x0c }, /* l L 1d */ - { 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */ - { 0x58,0x58,0x18,0x18 }, /* x X 1f */ - { 0x43,0x43,0x03,0x03 }, /* c C 20 */ - { 0x56,0x56,0x16,0x16 }, /* v V 21 */ - { 0x42,0x42,0x02,0x02 }, /* b B 22 */ - { 0x4e,0x4e,0x0e,0x0e }, /* n N 23 */ - { 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */ - { 0x2c,0x3c,0x2c,0x3c }, /* , < 25 */ - { 0x2e,0x3e,0x2e,0x3e }, /* . > 26 */ - { 0x2f,0x3f,0x2f,0x3f }, /* / ? 27 */ - { 0x00,0x00,0x00,0x00 }, /* 0x28 unused */ - { 0xb9,0xb9,0xb9,0xb9 }, /* 9 (KP) 29 */ - { 0x00,0x00,0x00,0x00 }, /* 0x2a unused */ - { 0xb8,0xb8,0xb8,0xb8 }, /* 8 (KP) 2b */ - { 0x00,0x00,0x00,0x00 }, /* 0x2c unused */ - { 0xb7,0xb7,0xb7,0xb7 }, /* 7 (KP) 2d */ - { 0x5c,0x7c,0x7f,0x1c }, /* \ | 2e */ - { 0x3d,0x2b,0x3d,0x2b }, /* = + 2f */ - { 0x30,0x29,0x30,0x29 }, /* 0 ) 30 */ - { 0x2d,0x5f,0x2d,0x1f }, /* - _ 31 */ - { 0x00,0x00,0x00,0x00 }, /* 0x32 unused */ - { 0xb6,0xb6,0xb6,0xb6 }, /* 6 (KP) 33 */ - { 0x00,0x00,0x00,0x00 }, /* 0x34 unused */ - { 0xb5,0xb5,0xb5,0xb5 }, /* 5 (KP) 35 */ - { 0x00,0x00,0x00,0x00 }, /* 0x36 unused */ - { 0xb4,0xb4,0xb4,0xb4 }, /* 4 (KP) 37 */ - { 0x60,0x7e,0x60,0x7e }, /* ` ~ 38 */ - { 0x5d,0x7d,0x1d,0x1d }, /* ] } 39 */ - { 0x50,0x50,0x10,0x10 }, /* p P 3a */ - { 0x5b,0x7b,0x1b,0x1b }, /* [ { 3b */ - { 0x00,0x00,0x00,0x00 }, /* 0x3c unused */ - { 0xb3,0xb3,0xb3,0xb3 }, /* 3 (KP) 3d */ - { 0xae,0xae,0xae,0xae }, /* . (KP) 3e */ - { 0xb2,0xb2,0xb2,0xb2 }, /* 2 (KP) 3f */ - { 0xb0,0xb0,0xb0,0xb0 }, /* 0 (KP) 40 */ - { 0xb1,0xb1,0xb1,0xb1 }, /* 1 (KP) 41 */ - { 0x0d,0x0d,0x0d,0x0d }, /* Enter 42 */ - { 0x8b,0x8b,0x8b,0x8b }, /* Up 43 */ - { 0x00,0x00,0x00,0x00 }, /* 0x44 unused */ - { 0x27,0x22,0x27,0x22 }, /* ' " 45 */ - { 0x00,0x00,0x00,0x00 }, /* 0x46 unused */ - { 0x00,0x00,0x00,0x00 }, /* 0x47 unused */ - { 0x8d,0x8d,0x8d,0x8d }, /* Ent(KP) 48 */ - { 0xa0,0xa0,0xa0,0xa0 }, /* Space 49 */ - { 0x00,0x00,0x00,0x00 }, /* 0x4a unused */ - { 0xad,0xad,0xad,0xad }, /* - (KP) 4b */ - { 0x95,0x95,0x95,0x95 }, /* Right 4c */ - { 0x8a,0x8a,0x8a,0x8a }, /* Down 4d */ - { 0x88,0x88,0x88,0x88 }, /* Left 4e */ - { 0x00,0x00,0x00,0x00 } /* 0x4f unused */ -}; - -WRITE_LINE_MEMBER(apple3_state::ay3600_data_ready_w) -{ - m_via_1->write_ca2(state); - - if (state == ASSERT_LINE) - { - UINT16 trans; - int mod = 0; - m_lastchar = m_ay3600->b_r(); - - trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff - trans |= (m_lastchar & 0x100)>>2; // bring the 0x100 bit down to the 0x40 place - - mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; - mod |= (m_kbspecial->read() & 0x08) ? 0x02 : 0x00; - - m_transchar = key_remap[trans][mod]; - - if (m_transchar != 0) - { - m_strobe = 0x80; -// printf("new char = %04x (%02x)\n", trans, m_transchar); - } - } -} - -void apple3_state::pdl_handler(int offset) -{ - UINT8 pdlread; - - switch (offset) - { - case 0x58: - m_analog_sel &= ~1; - break; - - case 0x59: - m_analog_sel |= 1; - break; - - case 0x5a: - m_analog_sel &= ~4; - break; - - case 0x5b: - m_analog_sel |= 4; - break; - - case 0x5c: - m_ramp_active = false; - m_pdl_charge = 0; - m_pdltimer->adjust(attotime::from_hz(1000000.0)); - break; - - case 0x5d: - switch (m_analog_sel) - { - case 1: - pdlread = m_joy1x->read(); - break; - - case 2: - pdlread = m_joy1y->read(); - break; - - case 4: - pdlread = m_joy2x->read(); - break; - - case 5: - pdlread = m_joy2y->read(); - break; - - default: - pdlread = 127; - break; - } - - // help the ROM self-test - if (m_pdl_charge > 82) - { - m_pdl_charge += (pdlread*4); - m_pdl_charge -= 93; - } - m_pdltimer->adjust(attotime::from_hz(1000000.0)); - m_ramp_active = true; - break; - - case 0x5e: - m_analog_sel &= ~2; - break; - - case 0x5f: - m_analog_sel |= 2; - break; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(apple3_state::paddle_timer) -{ - if (m_ramp_active) - { - m_pdl_charge--; - - if (m_pdl_charge > 0) - { - m_pdltimer->adjust(attotime::from_hz(1000000.0)); - } - else - { - m_pdltimer->adjust(attotime::never); - m_ramp_active = false; - } - } - else - { - m_pdl_charge++; - m_pdltimer->adjust(attotime::from_hz(1000000.0)); - } -} - -WRITE_LINE_MEMBER(apple3_state::a2bus_irq_w) -{ - UINT8 irq_mask = m_a2bus->get_a2bus_irq_mask(); - - m_via_1->write_ca1(state); - m_via_1->write_pa7(state); - - if (irq_mask & (1<<4)) - { - m_via_1->write_pa4(ASSERT_LINE); - } - else - { - m_via_1->write_pa4(CLEAR_LINE); - } - - if (irq_mask & (1<<3)) - { - m_via_1->write_pa5(ASSERT_LINE); - } - else - { - m_via_1->write_pa5(CLEAR_LINE); - } -} - -WRITE_LINE_MEMBER(apple3_state::a2bus_nmi_w) -{ - m_via_1->write_pb7(state); - - if (m_via_0_a & ENV_NMIENABLE) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, state); - } -} diff --git a/src/mess/machine/applefdc.c b/src/mess/machine/applefdc.c deleted file mode 100644 index dac524308ba..00000000000 --- a/src/mess/machine/applefdc.c +++ /dev/null @@ -1,586 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/********************************************************************* - - applefdc.c - - Implementation of various Apple Floppy Disk Controllers, including - the classic Apple controller and the IWM (Integrated Woz Machine) - chip - - The IWM chip was used as the floppy disk controller for early Macs and the - Apple IIgs, and was eventually superseded by the SWIM chp. - - Nate Woods - Raphael Nabet - - Writing this code would not be possible if it weren't for the work of the - XGS and KEGS emulators which also contain IWM emulations. - - TODO - - Implement the unimplemented IWM modes - - IWM_MODE_CLOCKSPEED - - IWM_MODE_BITCELLTIME - - IWM_MODE_HANDSHAKEPROTOCOL - - IWM_MODE_LATCHMODE - - Investigate the differences between the IWM and the classic Apple II - controller more fully. It is currently unclear what are genuine - differences and what are effectively hacks that "just seem" to work. - - Figure out iwm_readenable2handshake() and iwm_enable2(); they are - hackish at best - - Support the SWIM chip - - Proper timing - - This code was originally IWM specific; we need to clean up IWMisms in - the code - - Make it faster? - - Add sound? - -*********************************************************************/ - -#include "applefdc.h" - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -// logging -#define LOG_APPLEFDC 0 -#define LOG_APPLEFDC_EXTRA 0 - -// mask for FDC lines -#define IWM_MOTOR 0x10 -#define IWM_DRIVE 0x20 -#define IWM_Q6 0x40 -#define IWM_Q7 0x80 - -const device_timer_id TIMER_MOTOR_ONOFF = 1; - - - - - -/*************************************************************************** - IWM MODE - - The IWM mode has the following values: - - Bit 7 Reserved - Bit 6 Reserved - Bit 5 Reserved - Bit 4 ! Clock speed - 0=7MHz; used by Apple IIgs - 1=8MHz; used by Mac (I believe) - Bit 3 ! Bit cell time - 0=4usec/bit (used for 5.25" drives) - 1=2usec/bit (used for 3.5" drives) - Bit 2 Motor-off delay - 0=leave on for 1 sec after system turns it off - 1=turn off immediately - Bit 1 ! Handshake protocol - 0=synchronous (software supplies timing for writing data; used for 5.25" drives) - 1=asynchronous (IWM supplies timing; used for 3.5" drives) - Bit 0 ! Latch mode - 0=read data stays valid for 7usec (used for 5.25" drives) - 1=read data stays valid for full byte time (used for 3.5" drives) - - ***************************************************************************/ - -enum -{ - IWM_MODE_CLOCKSPEED = 0x10, - IWM_MODE_BITCELLTIME = 0x08, - IWM_MODE_MOTOROFFDELAY = 0x04, - IWM_MODE_HANDSHAKEPROTOCOL = 0x02, - IWM_MODE_LATCHMODE = 0x01 -}; - - - -/*************************************************************************** - BASE DEVICE -***************************************************************************/ - -//------------------------------------------------- -// ctor -//------------------------------------------------- - -applefdc_base_device::applefdc_base_device(applefdc_base_device::applefdc_t fdc_type, const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source) -{ - m_type = fdc_type; -} - - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void applefdc_base_device::device_start() -{ - // timer - m_motor_timer = timer_alloc(TIMER_MOTOR_ONOFF); - - // state - m_write_byte = 0x00; - m_lines = 0x00; - m_mode = 0x1F; // default value needed by Lisa 2 - no, I don't know if it is true - m_handshake_hack = 0x00; - - // register save states - save_item(NAME(m_write_byte)); - save_item(NAME(m_lines)); - save_item(NAME(m_mode)); - save_item(NAME(m_handshake_hack)); -} - - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void applefdc_base_device::device_reset(void) -{ - m_handshake_hack = 0x00; - m_write_byte = 0x00; - m_lines = 0x00; - m_mode = 0x1F; /* default value needed by Lisa 2 - no, I don't know if it is true */ - m_motor_timer->reset(); -} - - - -//------------------------------------------------- -// device_timer - device-specific timer callbacks -//------------------------------------------------- - -void applefdc_base_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_MOTOR_ONOFF: - turn_motor_onoff(param != 0); - break; - } -} - - - -//------------------------------------------------- -// get_interface - gets the interface -//------------------------------------------------- - -const applefdc_interface *applefdc_base_device::get_interface() -{ - static const applefdc_interface dummy_interface = {0, }; - - return (static_config() != NULL) - ? (const applefdc_interface *) static_config() - : &dummy_interface; -} - - - -//------------------------------------------------- -// iwm_enable2 - hackish function -//------------------------------------------------- - -int applefdc_base_device::iwm_enable2() -{ - /* R. Nabet : This function looks more like a hack than a real feature of the IWM; */ - /* it is not called from the Mac Plus driver */ - return (m_lines & APPLEFDC_PH1) && (m_lines & APPLEFDC_PH3); -} - - - -//------------------------------------------------- -// iwm_readenable2handshake - hackish function -//------------------------------------------------- - -UINT8 applefdc_base_device::iwm_readenable2handshake() -{ - /* R. Nabet : This function looks more like a hack than a real feature of the IWM; */ - /* it is not called from the Mac Plus driver */ - m_handshake_hack++; - m_handshake_hack %= 4; - return (m_handshake_hack != 0) ? 0xc0 : 0x80; -} - - - -//------------------------------------------------- -// statusreg_r - reads the status register -//------------------------------------------------- - -UINT8 applefdc_base_device::statusreg_r() -{ - UINT8 result; - int status; - const applefdc_interface *intf = get_interface(); - - /* IWM status: - * - * Bit 7 Sense input (write protect for 5.25" drive and general status line for 3.5") - * Bit 6 Reserved - * Bit 5 Drive enable (is 1 if drive is on) - * Bits 4-0 Same as IWM mode bits 4-0 - */ - - status = iwm_enable2() ? 1 : (intf->read_status ? intf->read_status(this) : 0); - - result = (status ? 0x80 : 0x00); - - if (m_type != APPLEFDC_APPLE2) - result |= (((m_lines & IWM_MOTOR) ? 1 : 0) << 5) | m_mode; - return result; -} - - - -//------------------------------------------------- -// iwm_modereg_w - changes the mode register -//------------------------------------------------- - -void applefdc_base_device::iwm_modereg_w(UINT8 data) -{ - m_mode = data & 0x1f; /* write mode register */ - - if (LOG_APPLEFDC_EXTRA) - logerror("iwm_modereg_w: iwm_mode=0x%02x\n", (unsigned) m_mode); -} - - - -//------------------------------------------------- -// read_reg - reads a register -//------------------------------------------------- - -UINT8 applefdc_base_device::read_reg(int lines) -{ - const applefdc_interface *intf = get_interface(); - UINT8 result = 0; - - switch(lines) - { - case 0: - // read data register - if ((m_type != APPLEFDC_APPLE2) && (iwm_enable2() || !(m_lines & IWM_MOTOR))) - { - result = 0xFF; - } - else - { - // Right now, this function assumes latch mode; which is always used for - // 3.5 inch drives. Eventually we should check to see if latch mode is - // off - if (LOG_APPLEFDC) - { - if ((m_mode & IWM_MODE_LATCHMODE) == 0x00) - logerror("applefdc_read_reg(): latch mode off not implemented\n"); - } - - result = (intf->read_data ? intf->read_data(this) : 0x00); - } - break; - - case IWM_Q6: - // read status register - result = statusreg_r(); - break; - - case IWM_Q7: - // Classic Apple II: Read status register - // IWM: Read handshake register - if (m_type == APPLEFDC_APPLE2) - result = statusreg_r(); - else - result = iwm_enable2() ? iwm_readenable2handshake() : 0x80; - break; - } - return result; -} - - - -//------------------------------------------------- -// write_reg - writes a register -//------------------------------------------------- - -void applefdc_base_device::write_reg(UINT8 data) -{ - const applefdc_interface *intf = get_interface(); - - switch(m_lines & (IWM_Q6 | IWM_Q7)) - { - case IWM_Q6 | IWM_Q7: - if (!(m_lines & IWM_MOTOR)) - { - iwm_modereg_w(data); - } - else if (!iwm_enable2()) - { - // Right now, this function assumes latch mode; which is always used for - // 3.5 inch drives. Eventually we should check to see if latch mode is - // off - if (LOG_APPLEFDC) - { - if ((m_mode & IWM_MODE_LATCHMODE) == 0) - logerror("applefdc_write_reg(): latch mode off not implemented\n"); - } - - if (intf->write_data != NULL) - intf->write_data(this, data); - } - break; - } -} - - - -//------------------------------------------------- -// turn_motor_onoff - timer callback for turning -// motor on or off -//------------------------------------------------- - -void applefdc_base_device::turn_motor_onoff(bool status) -{ - const applefdc_interface *intf = get_interface(); - int enable_lines; - - if (status) - { - m_lines |= IWM_MOTOR; - enable_lines = (m_lines & IWM_DRIVE) ? 2 : 1; - } - else - { - m_lines &= ~IWM_MOTOR; - - if (m_type == APPLEFDC_APPLE2) - enable_lines = (m_lines & IWM_DRIVE) ? 2 : 1; - else - enable_lines = 0; - } - - /* invoke callback, if present */ - if (intf->set_enable_lines != NULL) - intf->set_enable_lines(this, enable_lines); - - if (LOG_APPLEFDC_EXTRA) - logerror("iwm_turnmotor_onoff(): Turning motor %s\n", status ? "on" : "off"); -} - - - -//------------------------------------------------- -// iwm_access -//------------------------------------------------- - -void applefdc_base_device::iwm_access(int offset) -{ - static const char *const lines[] = - { - "PH0", - "PH1", - "PH2", - "PH3", - "MOTOR", - "DRIVE", - "Q6", - "Q7" - }; - - const applefdc_interface *intf = get_interface(); - - if (offset & 1) - m_lines |= (1 << (offset >> 1)); - else - m_lines &= ~(1 << (offset >> 1)); - - if (LOG_APPLEFDC_EXTRA) - { - logerror("iwm_access(): %s line %s => %02x\n", - (offset & 1) ? "setting" : "clearing", lines[offset >> 1], m_lines); - } - - if ((offset < 0x08) && (intf->set_lines != NULL)) - intf->set_lines(this, m_lines & 0x0f); - - switch(offset) - { - case 0x08: - /* turn off motor */ - m_motor_timer->adjust( - (m_mode & IWM_MODE_MOTOROFFDELAY) ? attotime::zero : attotime::from_seconds(1), 0); - break; - - case 0x09: - /* turn on motor */ - m_motor_timer->adjust(attotime::zero, 1); - break; - - case 0x0A: - /* turn off IWM_DRIVE */ - if ((m_lines & IWM_MOTOR) && (intf->set_enable_lines != NULL)) - intf->set_enable_lines(this, 1); - break; - - case 0x0B: - /* turn on IWM_DRIVE */ - if ((m_lines & IWM_MOTOR) && (intf->set_enable_lines != NULL)) - intf->set_enable_lines(this, 2); - break; - } -} - - - -//------------------------------------------------- -// read - reads a byte from the FDC -//------------------------------------------------- - -UINT8 applefdc_base_device::read(UINT8 offset) -{ - const applefdc_interface *intf = get_interface(); - UINT8 result = 0; - - // normalize offset - offset &= 0xf; - - if (LOG_APPLEFDC_EXTRA) - logerror("applefdc_r: offset=%i\n", offset); - - iwm_access(offset); - - switch(m_type) - { - case APPLEFDC_APPLE2: - switch(offset) - { - case 0x0C: - if (m_lines & IWM_Q7) - { - if (intf->write_data != NULL) - intf->write_data(this, m_write_byte); - result = 0; - } - else - result = read_reg(0); - break; - - case 0x0D: - result = read_reg(IWM_Q6); - break; - - case 0x0E: - result = read_reg(IWM_Q7); - break; - - case 0x0F: - result = read_reg(IWM_Q7 | IWM_Q6); - break; - } - break; - - case APPLEFDC_IWM: - if ((offset & 1) == 0) - result = read_reg(m_lines & (IWM_Q6 | IWM_Q7)); - break; - - case APPLEFDC_SWIM: - if ((offset & 1) == 0) - result = read_reg(m_lines & (IWM_Q6 | IWM_Q7)); - break; - } - - return result; -} - - - -//------------------------------------------------- -// write - writes a byte to the FDC -//------------------------------------------------- - -void applefdc_base_device::write(UINT8 offset, UINT8 data) -{ - const applefdc_interface *intf = get_interface(); - - /* normalize offset */ - offset &= 15; - - if (LOG_APPLEFDC_EXTRA) - logerror("applefdc_w: offset=%i data=0x%02x\n", offset, data); - - iwm_access(offset); - - switch(m_type) - { - case APPLEFDC_APPLE2: - switch(offset) - { - case 0x0C: - if (m_lines & IWM_Q7) - { - if (intf->write_data != NULL) - intf->write_data(this, m_write_byte); - } - break; - - case 0x0D: - m_write_byte = data; - break; - } - break; - - case APPLEFDC_IWM: - if (offset & 1) - write_reg(data); - break; - - case APPLEFDC_SWIM: - if (offset & 1) - write_reg(data); - break; - } -} - - - -//------------------------------------------------- -// get_lines - accessor -//------------------------------------------------- - -UINT8 applefdc_base_device::get_lines() -{ - return m_lines & 0x0f; -} - - - -/*************************************************************************** - APPLE FDC - Used on Apple II -***************************************************************************/ - -const device_type APPLEFDC = &device_creator; - -applefdc_device::applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : applefdc_base_device(APPLEFDC_APPLE2, mconfig, APPLEFDC, "Apple FDC", tag, owner, clock, "apple_fdc", __FILE__) -{ -} - - - -/*************************************************************************** - IWM - Used on early Macs -***************************************************************************/ - -const device_type IWM = &device_creator; - -iwm_device::iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : applefdc_base_device(APPLEFDC_IWM, mconfig, IWM, "Apple IWM (Integrated Woz Machine)", tag, owner, clock, "iwm", __FILE__) -{ -} diff --git a/src/mess/machine/applefdc.h b/src/mess/machine/applefdc.h deleted file mode 100644 index 38efb9036d2..00000000000 --- a/src/mess/machine/applefdc.h +++ /dev/null @@ -1,163 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/********************************************************************* - - applefdc.h - - Implementation of various Apple Floppy Disk Controllers, including - the classic Apple controller and the IWM (Integrated Woz Machine) - chip - - Nate Woods - Raphael Nabet - R. Belmont - -*********************************************************************/ - -#ifndef __APPLEFDC_H__ -#define __APPLEFDC_H__ - -#include "emu.h" - - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define APPLEFDC_PH0 0x01 -#define APPLEFDC_PH1 0x02 -#define APPLEFDC_PH2 0x04 -#define APPLEFDC_PH3 0x08 - -extern const device_type APPLEFDC; -extern const device_type IWM; -extern const device_type SWIM; - - - -/*************************************************************************** - INTERFACE -***************************************************************************/ - -struct applefdc_interface -{ - void (*set_lines)(device_t *device, UINT8 lines); - void (*set_enable_lines)(device_t *device, int enable_mask); - - UINT8 (*read_data)(device_t *device); - void (*write_data)(device_t *device, UINT8 data); - int (*read_status)(device_t *device); -}; - - - -/*************************************************************************** - BASE DEVICE -***************************************************************************/ - -class applefdc_base_device : public device_t -{ -public: - // read/write handlers - virtual UINT8 read(UINT8 offset); - virtual void write(UINT8 offset, UINT8 data); - - // read/write handlers overloads - UINT8 read(offs_t offset) { return read((UINT8) offset); } - void write(offs_t offset, UINT8 data) { write((UINT8) offset, data); } - DECLARE_READ8_MEMBER( read ) { return read((UINT8) offset); } - DECLARE_WRITE8_MEMBER( write ) { write((UINT8) offset, data); } - - // accessor - UINT8 get_lines(); - -protected: - enum applefdc_t - { - APPLEFDC_APPLE2, /* classic Apple II disk controller (pre-IWM) */ - APPLEFDC_IWM, /* Integrated Woz Machine */ - APPLEFDC_SWIM /* Sander/Woz Integrated Machine */ - }; - - // constructor - applefdc_base_device(applefdc_t fdc_type, const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // other protecteds - virtual void iwm_modereg_w(UINT8 data); - -private: - // data that is constant for the lifetime of the emulation - emu_timer * m_motor_timer; - applefdc_t m_type; - - // data that changes at emulation time - UINT8 m_write_byte; - UINT8 m_lines; /* flags from IWM_MOTOR - IWM_Q7 */ - UINT8 m_mode; /* 0-31; see above */ - UINT8 m_handshake_hack; /* not sure what this is for */ - - // functions - const applefdc_interface *get_interface(); - int iwm_enable2(); - UINT8 iwm_readenable2handshake(); - UINT8 statusreg_r(); - UINT8 read_reg(int lines); - void write_reg(UINT8 data); - void turn_motor_onoff(bool status); - void iwm_access(int offset); -}; - - - -/*************************************************************************** - APPLE FDC - Used on Apple II -***************************************************************************/ - -class applefdc_device : public applefdc_base_device -{ -public: - applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); -}; - - - -/*************************************************************************** - IWM - Used on early Macs -***************************************************************************/ - -class iwm_device : public applefdc_base_device -{ -public: - iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); -}; - - - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_APPLEFDC_ADD(_tag, _intrf) \ - MCFG_DEVICE_ADD(_tag, APPLEFDC, 0) \ - MCFG_DEVICE_CONFIG(_intrf) - -#define MCFG_APPLEFDC_MODIFY(_tag, _intrf) \ - MCFG_DEVICE_MODIFY(_tag) \ - MCFG_DEVICE_CONFIG(_intrf) - -#define MCFG_IWM_ADD(_tag, _intrf) \ - MCFG_DEVICE_ADD(_tag, IWM, 0) \ - MCFG_DEVICE_CONFIG(_intrf) - -#define MCFG_IWM_MODIFY(_tag, _intrf) \ - MCFG_DEVICE_MODIFY(_tag) \ - MCFG_DEVICE_CONFIG(_intrf) - - -#endif /* __APPLEFDC_H__ */ diff --git a/src/mess/machine/apricotkb.c b/src/mess/machine/apricotkb.c deleted file mode 100644 index 6ceb0d6ba4d..00000000000 --- a/src/mess/machine/apricotkb.c +++ /dev/null @@ -1,404 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Apricot keyboard emulation - -*********************************************************************/ - -#include "apricotkb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define UPD7507C_TAG "ic2" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type APRICOT_KEYBOARD = &device_creator; - - -//------------------------------------------------- -// ROM( apricot_keyboard ) -//------------------------------------------------- - -ROM_START( apricot_keyboard ) - ROM_REGION( 0x800, UPD7507C_TAG, 0 ) - ROM_LOAD( "keyboard controller upd7507c.ic2", 0x000, 0x800, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *apricot_keyboard_device::device_rom_region() const -{ - return ROM_NAME( apricot_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( kb_io ) -//------------------------------------------------- - -#ifdef UPD7507_EMULATED -static ADDRESS_MAP_START( apricot_keyboard_io, AS_IO, 8, apricot_keyboard_device ) - AM_RANGE(0x00, 0x00) AM_READ(kb_lo_r) - AM_RANGE(0x01, 0x01) AM_READ(kb_hi_r) - AM_RANGE(0x03, 0x03) AM_WRITE(kb_p3_w) - AM_RANGE(0x04, 0x04) AM_WRITE(kb_y0_w) - AM_RANGE(0x05, 0x05) AM_WRITE(kb_y4_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(kb_p6_r, kb_yc_w) - AM_RANGE(0x07, 0x07) AM_WRITE(kb_y8_w) -ADDRESS_MAP_END -#endif - - -//------------------------------------------------- -// MACHINE_DRIVER( apricot_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( apricot_keyboard ) -#ifdef UPD7507_EMULATED - MCFG_CPU_ADD(UPD7507C_TAG, UPD7507, XTAL_32_768kHz) - MCFG_CPU_IO_MAP(apricot_keyboard_io) -#endif -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor apricot_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( apricot_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( apricot_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( apricot_keyboard ) - PORT_START("Y0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y2") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y6") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y9") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("YA") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("YB") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("YC") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("MODIFIERS") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor apricot_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( apricot_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// apricot_keyboard_device - constructor -//------------------------------------------------- - -apricot_keyboard_device::apricot_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, APRICOT_KEYBOARD, "Apricot Keyboard", tag, owner, clock, "aprikb", __FILE__), - m_write_txd(*this), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_ya(*this, "YA"), - m_yb(*this, "YB"), - m_yc(*this, "YC"), - m_modifiers(*this, "MODIFIERS") -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void apricot_keyboard_device::device_start() -{ - // resolve callbacks - m_write_txd.resolve_safe(); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void apricot_keyboard_device::device_reset() -{ -} - - -//------------------------------------------------- -// read_keyboard - -//------------------------------------------------- - -UINT8 apricot_keyboard_device::read_keyboard() -{ - UINT8 data = 0xff; - - if (!BIT(m_kb_y, 0)) data &= m_y0->read(); - if (!BIT(m_kb_y, 1)) data &= m_y1->read(); - if (!BIT(m_kb_y, 2)) data &= m_y2->read(); - if (!BIT(m_kb_y, 3)) data &= m_y3->read(); - if (!BIT(m_kb_y, 4)) data &= m_y4->read(); - if (!BIT(m_kb_y, 5)) data &= m_y5->read(); - if (!BIT(m_kb_y, 6)) data &= m_y6->read(); - if (!BIT(m_kb_y, 7)) data &= m_y7->read(); - if (!BIT(m_kb_y, 8)) data &= m_y8->read(); - if (!BIT(m_kb_y, 9)) data &= m_y9->read(); - if (!BIT(m_kb_y, 10)) data &= m_ya->read(); - if (!BIT(m_kb_y, 11)) data &= m_yb->read(); - if (!BIT(m_kb_y, 12)) data &= m_yc->read(); - - return data; -} - - -//------------------------------------------------- -// kb_lo_r - -//------------------------------------------------- - -READ8_MEMBER( apricot_keyboard_device::kb_lo_r ) -{ - return read_keyboard() & 0x0f; -} - - -//------------------------------------------------- -// kb_hi_r - -//------------------------------------------------- - -READ8_MEMBER( apricot_keyboard_device::kb_hi_r ) -{ - return read_keyboard() >> 4; -} - - -//------------------------------------------------- -// kb_p6_r - -//------------------------------------------------- - -READ8_MEMBER( apricot_keyboard_device::kb_p6_r ) -{ - /* - - bit description - - P60 - P61 SHIFT - P62 CONTROL - - */ - - UINT8 modifiers = m_modifiers->read(); - - return modifiers << 1; -} - - -//------------------------------------------------- -// kb_p3_w - -//------------------------------------------------- - -WRITE8_MEMBER( apricot_keyboard_device::kb_p3_w ) -{ - // bit 1 controls the IR LEDs -} - - -//------------------------------------------------- -// kb_y0_w - -//------------------------------------------------- - -WRITE8_MEMBER( apricot_keyboard_device::kb_y0_w ) -{ - m_kb_y = (m_kb_y & 0xfff0) | (data & 0x0f); -} - - -//------------------------------------------------- -// kb_y4_w - -//------------------------------------------------- - -WRITE8_MEMBER( apricot_keyboard_device::kb_y4_w ) -{ - m_kb_y = (m_kb_y & 0xff0f) | ((data & 0x0f) << 4); -} - - -//------------------------------------------------- -// kb_y8_w - -//------------------------------------------------- - -WRITE8_MEMBER( apricot_keyboard_device::kb_y8_w ) -{ - m_kb_y = (m_kb_y & 0xf0ff) | ((data & 0x0f) << 8); -} - - -//------------------------------------------------- -// kb_yc_w - -//------------------------------------------------- - -WRITE8_MEMBER( apricot_keyboard_device::kb_yc_w ) -{ - m_kb_y = (m_kb_y & 0xf0ff) | ((data & 0x0f) << 12); -} diff --git a/src/mess/machine/apricotkb.h b/src/mess/machine/apricotkb.h deleted file mode 100644 index 7b3d20a7a48..00000000000 --- a/src/mess/machine/apricotkb.h +++ /dev/null @@ -1,97 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Apricot keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __APRICOT_KEYBOARD__ -#define __APRICOT_KEYBOARD__ - -#include "emu.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define APRICOT_KEYBOARD_TAG "aprikb" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_APRICOT_KEYBOARD_TXD_CALLBACK(_write) \ - devcb = &apricot_keyboard_device::set_tcd_wr_callback(*device, DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> apricot_keyboard_device - -class apricot_keyboard_device : public device_t -{ -public: - // construction/destruction - apricot_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_txd_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_txd.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - UINT8 read_keyboard(); - - DECLARE_READ8_MEMBER( kb_lo_r ); - DECLARE_READ8_MEMBER( kb_hi_r ); - DECLARE_READ8_MEMBER( kb_p6_r ); - DECLARE_WRITE8_MEMBER( kb_p3_w ); - DECLARE_WRITE8_MEMBER( kb_y0_w ); - DECLARE_WRITE8_MEMBER( kb_y4_w ); - DECLARE_WRITE8_MEMBER( kb_y8_w ); - DECLARE_WRITE8_MEMBER( kb_yc_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - devcb_write_line m_write_txd; - - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_ya; - required_ioport m_yb; - required_ioport m_yc; - required_ioport m_modifiers; - - UINT16 m_kb_y; -}; - - -// device type definition -extern const device_type APRICOT_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/apricotkb_hle.c b/src/mess/machine/apricotkb_hle.c deleted file mode 100644 index 6950033c79f..00000000000 --- a/src/mess/machine/apricotkb_hle.c +++ /dev/null @@ -1,286 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - ACT Apricot Keyboard (HLE) - - Keyboard to System: - - 01-60: Key make codes - - 70-7f: Mouse codes - - 80: RAM test failed - - 81-e0: Key break codes - - e9: ROM test failed - - ea: X-on (keyboard ready to receive) - - eb: X-off (keyboard buffer full) - - ec: Reset request - - ed: Time prefix - - ee: Date prefix - - ef: Mouse header - - f0-f9: BCD data - - fa: Invalid clock data - - fb: Acknowledge firmware version/reset - - System to keyboard: - - 01-7f: Character codes for MicroScreen - - 80-cf: Cursor address - - d0: Clear screen - - d1: Cursor left - - d2: Cursor right - - d3: Cursor on - - d4: Cursor off - - d5: Display on - - d6: Display off - - e0: Query - - e1: Time and date request - - e2: Display time/data on MicroScreen - - e3: Set LED prefix - - e4: Set time and date - - e5: Mouse enable - - e6: Mouse disable - - e7: Execute processor diagnostics - - e8: Keyboard reset - - f0-f9: BCD data - - fa: Invalid clock data - -***************************************************************************/ - -#include "apricotkb_hle.h" - - -//************************************************************************** -// CONSTANTS / MACROS -//************************************************************************** - -#define APRICOT_KEY(_key, _index) \ - PORT_BIT(1 << _key, IP_ACTIVE_HIGH, IPT_KEYBOARD) \ - PORT_CHANGED_MEMBER(DEVICE_SELF, apricot_keyboard_hle_device, key_callback, (void *) _index) - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type APRICOT_KEYBOARD_HLE = &device_creator; - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( keyboard ) - PORT_START("keyboard_0") - PORT_BIT(1 << 0, IP_ACTIVE_HIGH, IPT_UNUSED) - APRICOT_KEY( 1, 0) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_NAME("Help") - APRICOT_KEY( 2, 0) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_NAME("Undo") - APRICOT_KEY( 3, 0) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_NAME("Repeat") - APRICOT_KEY( 4, 0) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_NAME("Calc") - APRICOT_KEY( 5, 0) PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) PORT_NAME("Print") - APRICOT_KEY( 6, 0) PORT_CODE(KEYCODE_CANCEL) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) PORT_NAME("Intr") - APRICOT_KEY( 7, 0) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_NAME("Menu") - APRICOT_KEY( 8, 0) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_NAME("Finish") - APRICOT_KEY( 9, 0) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("Function 1") - APRICOT_KEY(10, 0) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_NAME("Function 2") - APRICOT_KEY(11, 0) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_NAME("Function 3") - APRICOT_KEY(12, 0) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_NAME("Function 4") - APRICOT_KEY(13, 0) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_NAME("Function 5") - APRICOT_KEY(14, 0) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_NAME("Function 6") - APRICOT_KEY(15, 0) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('^') - APRICOT_KEY(16, 0) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - APRICOT_KEY(17, 0) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - APRICOT_KEY(18, 0) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - APRICOT_KEY(19, 0) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0xa3) // pound - APRICOT_KEY(20, 0) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - APRICOT_KEY(21, 0) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('$') - APRICOT_KEY(22, 0) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - APRICOT_KEY(23, 0) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - APRICOT_KEY(24, 0) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - APRICOT_KEY(25, 0) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - APRICOT_KEY(26, 0) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - APRICOT_KEY(27, 0) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - APRICOT_KEY(28, 0) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(9) - PORT_BIT(1 << 29, IP_ACTIVE_HIGH, IPT_UNUSED) // actually a dedicated % key - APRICOT_KEY(30, 0) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - APRICOT_KEY(31, 0) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - - PORT_START("keyboard_1") - APRICOT_KEY( 0, 1) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - APRICOT_KEY( 1, 1) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - APRICOT_KEY( 2, 1) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - APRICOT_KEY( 3, 1) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - APRICOT_KEY( 4, 1) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - APRICOT_KEY( 5, 1) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - APRICOT_KEY( 6, 1) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - APRICOT_KEY( 7, 1) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - APRICOT_KEY( 8, 1) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - APRICOT_KEY( 9, 1) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - APRICOT_KEY(10, 1) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - APRICOT_KEY(11, 1) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - APRICOT_KEY(12, 1) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - APRICOT_KEY(13, 1) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - APRICOT_KEY(14, 1) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - APRICOT_KEY(15, 1) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - APRICOT_KEY(16, 1) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("Clear") - APRICOT_KEY(17, 1) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - APRICOT_KEY(18, 1) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - APRICOT_KEY(19, 1) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - APRICOT_KEY(20, 1) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - APRICOT_KEY(21, 1) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - APRICOT_KEY(22, 1) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - APRICOT_KEY(23, 1) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - APRICOT_KEY(24, 1) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - APRICOT_KEY(25, 1) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - APRICOT_KEY(26, 1) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - APRICOT_KEY(27, 1) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - APRICOT_KEY(28, 1) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - APRICOT_KEY(29, 1) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - APRICOT_KEY(30, 1) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - APRICOT_KEY(31, 1) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - - PORT_START("keyboard_2") - APRICOT_KEY( 0, 2) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - APRICOT_KEY( 1, 2) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - APRICOT_KEY( 2, 2) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - APRICOT_KEY( 3, 2) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - APRICOT_KEY( 4, 2) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - APRICOT_KEY( 5, 2) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - APRICOT_KEY( 6, 2) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - APRICOT_KEY( 7, 2) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - APRICOT_KEY( 8, 2) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - APRICOT_KEY( 9, 2) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - APRICOT_KEY(10, 2) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - APRICOT_KEY(11, 2) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - APRICOT_KEY(12, 2) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - APRICOT_KEY(13, 2) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - APRICOT_KEY(14, 2) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - APRICOT_KEY(15, 2) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - APRICOT_KEY(16, 2) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - APRICOT_KEY(17, 2) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - APRICOT_KEY(18, 2) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - APRICOT_KEY(19, 2) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) - APRICOT_KEY(20, 2) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - APRICOT_KEY(21, 2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - APRICOT_KEY(22, 2) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - APRICOT_KEY(23, 2) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - APRICOT_KEY(24, 2) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - APRICOT_KEY(25, 2) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - APRICOT_KEY(26, 2) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("Stop") - APRICOT_KEY(27, 2) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - APRICOT_KEY(28, 2) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - APRICOT_KEY(29, 2) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - APRICOT_KEY(30, 2) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - APRICOT_KEY(31, 2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - - PORT_START("keyboard_3") - APRICOT_KEY( 0, 3) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) -INPUT_PORTS_END - -ioport_constructor apricot_keyboard_hle_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( keyboard ); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// apricot_keyboard_hle_device - constructor -//------------------------------------------------- - -apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, APRICOT_KEYBOARD_HLE, "Apricot Keyboard (HLE)", tag, owner, clock, "apricotkb_hle", __FILE__), - device_serial_interface(mconfig, *this), - m_txd_handler(*this), - m_rxd(1), - m_data_in(0), - m_data_out(0) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void apricot_keyboard_hle_device::device_start() -{ - // resolve callbacks - m_txd_handler.resolve_safe(); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void apricot_keyboard_hle_device::device_reset() -{ - receive_register_reset(); - transmit_register_reset(); - - set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); - set_rcv_rate(7800); - set_tra_rate(7800); -} - -//------------------------------------------------- -// device_timer - device-specific timer -//------------------------------------------------- - -void apricot_keyboard_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - device_serial_interface::device_timer(timer, id, param, ptr); -} - -void apricot_keyboard_hle_device::tra_callback() -{ - m_txd_handler(transmit_register_get_data_bit()); -} - -void apricot_keyboard_hle_device::tra_complete() -{ - if (m_data_out != 0) - { - transmit_register_setup(m_data_out); - m_data_out = 0; - } -} - -void apricot_keyboard_hle_device::rcv_callback() -{ - receive_register_update_bit(m_rxd); -} - -void apricot_keyboard_hle_device::rcv_complete() -{ - receive_register_extract(); - m_data_in = get_received_char(); - - // reset command? send keyboard ready (likely needs a delay, just disable for now) -// if (m_data_in == 0xe8) -// transmit_register_setup(0xfb); -} - -WRITE_LINE_MEMBER( apricot_keyboard_hle_device::rxd_w ) -{ - m_rxd = state; - device_serial_interface::rx_w(m_rxd); -} - -INPUT_CHANGED_MEMBER( apricot_keyboard_hle_device::key_callback ) -{ - UINT32 oldvalue = oldval * field.mask(), newvalue = newval * field.mask(); - UINT32 delta = oldvalue ^ newvalue; - - for (int i = 0; i < 32; i++) - { - if (delta & (1 << i)) - { - UINT8 down = (newvalue & (1 << i)) ? 0x00 : 0x80; - UINT8 scancode = (FPTR) param * 32 + i; - scancode |= down; - transmit_register_setup(scancode); - break; - } - } - -} diff --git a/src/mess/machine/apricotkb_hle.h b/src/mess/machine/apricotkb_hle.h deleted file mode 100644 index e8cea1a516d..00000000000 --- a/src/mess/machine/apricotkb_hle.h +++ /dev/null @@ -1,73 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - ACT Apricot Keyboard (HLE) - -***************************************************************************/ - -#pragma once - -#ifndef __APRICOTKB_HLE__ -#define __APRICOTKB_HLE__ - -#include "emu.h" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_APRICOT_KEYBOARD_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, APRICOT_KEYBOARD_HLE, 0) - -#define MCFG_APRICOT_KEYBOARD_TXD_HANDLER(_write) \ - devcb = &apricot_keyboard_hle_device::set_txd_handler(*device, DEVCB_##_write); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> apricot_keyboard_hle_device - -class apricot_keyboard_hle_device : public device_t, public device_serial_interface -{ -public: - // construction/destruction - apricot_keyboard_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_txd_handler(device_t &device, _Object object) - { return downcast(device).m_txd_handler.set_callback(object); } - - DECLARE_WRITE_LINE_MEMBER(rxd_w); - DECLARE_INPUT_CHANGED_MEMBER(key_callback); - -protected: - // device_t overrides - virtual ioport_constructor device_input_ports() const; - virtual void device_start(); - virtual void device_reset(); - - // device_serial_interface overrides - virtual void tra_callback(); - virtual void tra_complete(); - virtual void rcv_callback(); - virtual void rcv_complete(); - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - devcb_write_line m_txd_handler; - - int m_rxd; - - UINT8 m_data_in; - UINT8 m_data_out; -}; - - -// device type definition -extern const device_type APRICOT_KEYBOARD_HLE; - - -#endif // __APRICOTKB_HLE__ diff --git a/src/mess/machine/at.c b/src/mess/machine/at.c deleted file mode 100644 index ffc817fbaba..00000000000 --- a/src/mess/machine/at.c +++ /dev/null @@ -1,313 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Miodrag Milanovic -/*************************************************************************** - - IBM AT Compatibles - -***************************************************************************/ - -#include "includes/at.h" - -#define LOG_PORT80 0 - -/************************************************************* - * - * pic8259 configuration - * - *************************************************************/ -READ8_MEMBER( at_state::get_slave_ack ) -{ - if (offset==2) // IRQ = 2 - return m_pic8259_slave->acknowledge(); - - return 0x00; -} - -/************************************************************************* - * - * PC Speaker related - * - *************************************************************************/ - -void at_state::at_speaker_set_spkrdata(UINT8 data) -{ - m_at_spkrdata = data ? 1 : 0; - m_speaker->level_w(m_at_spkrdata & m_pit_out2); -} - - - -/************************************************************* - * - * pit8254 configuration - * - *************************************************************/ - -WRITE_LINE_MEMBER( at_state::at_pit8254_out0_changed ) -{ - m_pic8259_master->ir0_w(state); -} - - -WRITE_LINE_MEMBER( at_state::at_pit8254_out2_changed ) -{ - m_pit_out2 = state ? 1 : 0; - m_speaker->level_w(m_at_spkrdata & m_pit_out2); -} - - -/************************************************************************* - * - * PC DMA stuff - * - *************************************************************************/ - -READ8_MEMBER( at_state::at_page8_r ) -{ - UINT8 data = m_at_pages[offset % 0x10]; - - switch(offset % 8) - { - case 1: - data = m_dma_offset[BIT(offset, 3)][2]; - break; - case 2: - data = m_dma_offset[BIT(offset, 3)][3]; - break; - case 3: - data = m_dma_offset[BIT(offset, 3)][1]; - break; - case 7: - data = m_dma_offset[BIT(offset, 3)][0]; - break; - } - return data; -} - - -WRITE8_MEMBER( at_state::at_page8_w ) -{ - m_at_pages[offset % 0x10] = data; - - if (LOG_PORT80 && (offset == 0)) - { - logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, - (unsigned) m_maincpu->pc()); - } - - switch(offset % 8) - { - case 1: - m_dma_offset[BIT(offset, 3)][2] = data; - break; - case 2: - m_dma_offset[BIT(offset, 3)][3] = data; - break; - case 3: - m_dma_offset[BIT(offset, 3)][1] = data; - break; - case 7: - m_dma_offset[BIT(offset, 3)][0] = data; - break; - } -} - - -WRITE_LINE_MEMBER( at_state::pc_dma_hrq_changed ) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - /* Assert HLDA */ - m_dma8237_2->hack_w(state); -} - -READ8_MEMBER(at_state::pc_dma_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space - if(m_dma_channel == -1) - return 0xff; - UINT8 result; - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; - - result = prog_space.read_byte(page_offset + offset); - return result; -} - - -WRITE8_MEMBER(at_state::pc_dma_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space - if(m_dma_channel == -1) - return; - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; - - prog_space.write_byte(page_offset + offset, data); -} - - -READ8_MEMBER(at_state::pc_dma_read_word) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space - if(m_dma_channel == -1) - return 0xff; - UINT16 result; - offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; - - result = prog_space.read_word(page_offset + ( offset << 1 ) ); - m_dma_high_byte = result & 0xFF00; - - return result & 0xFF; -} - - -WRITE8_MEMBER(at_state::pc_dma_write_word) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space - if(m_dma_channel == -1) - return; - offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; - - prog_space.write_word(page_offset + ( offset << 1 ), m_dma_high_byte | data); -} - -READ8_MEMBER( at_state::pc_dma8237_0_dack_r ) { return m_isabus->dack_r(0); } -READ8_MEMBER( at_state::pc_dma8237_1_dack_r ) { return m_isabus->dack_r(1); } -READ8_MEMBER( at_state::pc_dma8237_2_dack_r ) { return m_isabus->dack_r(2); } -READ8_MEMBER( at_state::pc_dma8237_3_dack_r ) { return m_isabus->dack_r(3); } -READ8_MEMBER( at_state::pc_dma8237_5_dack_r ) { UINT16 ret = m_isabus->dack16_r(5); m_dma_high_byte = ret & 0xff00; return ret; } -READ8_MEMBER( at_state::pc_dma8237_6_dack_r ) { UINT16 ret = m_isabus->dack16_r(6); m_dma_high_byte = ret & 0xff00; return ret; } -READ8_MEMBER( at_state::pc_dma8237_7_dack_r ) { UINT16 ret = m_isabus->dack16_r(7); m_dma_high_byte = ret & 0xff00; return ret; } - - -WRITE8_MEMBER( at_state::pc_dma8237_0_dack_w ){ m_isabus->dack_w(0, data); } -WRITE8_MEMBER( at_state::pc_dma8237_1_dack_w ){ m_isabus->dack_w(1, data); } -WRITE8_MEMBER( at_state::pc_dma8237_2_dack_w ){ m_isabus->dack_w(2, data); } -WRITE8_MEMBER( at_state::pc_dma8237_3_dack_w ){ m_isabus->dack_w(3, data); } -WRITE8_MEMBER( at_state::pc_dma8237_5_dack_w ){ m_isabus->dack16_w(5, m_dma_high_byte | data); } -WRITE8_MEMBER( at_state::pc_dma8237_6_dack_w ){ m_isabus->dack16_w(6, m_dma_high_byte | data); } -WRITE8_MEMBER( at_state::pc_dma8237_7_dack_w ){ m_isabus->dack16_w(7, m_dma_high_byte | data); } - -WRITE_LINE_MEMBER( at_state::at_dma8237_out_eop ) -{ - m_cur_eop = state == ASSERT_LINE; - if(m_dma_channel != -1) - m_isabus->eop_w(m_dma_channel, m_cur_eop ? ASSERT_LINE : CLEAR_LINE ); -} - -void at_state::pc_set_dma_channel(int channel, int state) -{ - if(!state) { - m_dma_channel = channel; - if(m_cur_eop) - m_isabus->eop_w(channel, ASSERT_LINE ); - - } else if(m_dma_channel == channel) { - m_dma_channel = -1; - if(m_cur_eop) - m_isabus->eop_w(channel, CLEAR_LINE ); - } -} - -WRITE_LINE_MEMBER( at_state::pc_dack0_w ) { pc_set_dma_channel(0, state); } -WRITE_LINE_MEMBER( at_state::pc_dack1_w ) { pc_set_dma_channel(1, state); } -WRITE_LINE_MEMBER( at_state::pc_dack2_w ) { pc_set_dma_channel(2, state); } -WRITE_LINE_MEMBER( at_state::pc_dack3_w ) { pc_set_dma_channel(3, state); } -WRITE_LINE_MEMBER( at_state::pc_dack4_w ) { m_dma8237_1->hack_w(state ? 0 : 1); } // it's inverted -WRITE_LINE_MEMBER( at_state::pc_dack5_w ) { pc_set_dma_channel(5, state); } -WRITE_LINE_MEMBER( at_state::pc_dack6_w ) { pc_set_dma_channel(6, state); } -WRITE_LINE_MEMBER( at_state::pc_dack7_w ) { pc_set_dma_channel(7, state); } - -READ8_MEMBER( at_state::at_portb_r ) -{ - UINT8 data = m_at_speaker; - data &= ~0xd0; /* AT BIOS don't likes this being set */ - - /* 0x10 is the dram refresh line bit, 15.085us. */ - data |= (machine().time().as_ticks(110000) & 1) ? 0x10 : 0; - - if (m_pit_out2) - data |= 0x20; - else - data &= ~0x20; /* ps2m30 wants this */ - - return data; -} - -WRITE8_MEMBER( at_state::at_portb_w ) -{ - m_at_speaker = data; - m_pit8254->write_gate2(BIT(data, 0)); - at_speaker_set_spkrdata( BIT(data, 1)); - m_channel_check = BIT(data, 3); - m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0)); -} - -READ8_MEMBER( at_state::ps2_portb_r ) -{ - UINT8 data = m_at_speaker; - data &= ~0xd0; /* AT BIOS don't likes this being set */ - - /* 0x10 is the dram refresh line bit, 15.085us. */ - data |= (machine().time().as_ticks(66291) & 1) ? 0x10 : 0; - - if (m_pit_out2) - data |= 0x20; - else - data &= ~0x20; /* ps2m30 wants this */ - - return data; -} - - -/********************************************************** - * - * Init functions - * - **********************************************************/ - -void at_state::init_at_common(int xmsbase) -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - - /* MESS managed RAM */ - membank("bank10")->set_base(m_ram->pointer()); - - if (m_ram->size() > xmsbase) - { - offs_t ram_limit = 0x100000 + m_ram->size() - xmsbase; - space.install_read_bank(0x100000, ram_limit - 1, "bank1"); - space.install_write_bank(0x100000, ram_limit - 1, "bank1"); - membank("bank1")->set_base(m_ram->pointer() + xmsbase); - } -} - -DRIVER_INIT_MEMBER(at_state,atcga) -{ - init_at_common(0xa0000); -} - -DRIVER_INIT_MEMBER(at_state,atvga) -{ - init_at_common(0xa0000); -} - -DRIVER_INIT_MEMBER(at_state,atpci) -{ - init_at_common(0x100000); -} - -DRIVER_INIT_MEMBER(at586_state,at586) -{ -} - -MACHINE_START_MEMBER(at_state,at) -{ -} - -MACHINE_RESET_MEMBER(at_state,at) -{ - m_at_spkrdata = 0; - m_pit_out2 = 1; - m_dma_channel = -1; - m_cur_eop = false; -} diff --git a/src/mess/machine/atarifdc.c b/src/mess/machine/atarifdc.c deleted file mode 100644 index a440181468c..00000000000 --- a/src/mess/machine/atarifdc.c +++ /dev/null @@ -1,796 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/*************************************************************************** - - Atari 400/800 - - Floppy Disk Controller code - - Juergen Buchmueller, June 1998 - -***************************************************************************/ - -#include - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "includes/atari.h" -#include "atarifdc.h" -#include "sound/pokey.h" -#include "machine/6821pia.h" -#include "formats/atari_dsk.h" - -#define VERBOSE_SERIAL 0 -#define VERBOSE_CHKSUM 0 - -/************************************* - * - * Disk stuff - * - *************************************/ - -#define FORMAT_XFD 0 -#define FORMAT_ATR 1 -#define FORMAT_DSK 2 - -/***************************************************************************** - * This is the structure I used in my own Atari 800 emulator some years ago - * Though it's a bit overloaded, I used it as it is the maximum of all - * supported formats: - * XFD no header at all - * ATR 16 bytes header - * DSK this struct - * It is used to determine the format of a XFD image by it's size only - *****************************************************************************/ - -struct atari_dsk_format -{ - UINT8 density; - UINT8 tracks; - UINT8 door; - UINT8 sta1; - UINT8 spt; - UINT8 doublesided; - UINT8 highdensity; - UINT8 seclen_hi; - UINT8 seclen_lo; - UINT8 status; - UINT8 sta2; - UINT8 sta3; - UINT8 sta4; - UINT8 cr; - UINT8 info[65+1]; -}; - -/* combined with the size the image should have */ -struct xfd_format -{ - int size; - atari_dsk_format dsk; -}; - -/* here's a table of known xfd formats */ -static const xfd_format xfd_formats[] = -{ - {35 * 18 * 1 * 128, {0,35,1,0,18,0,0,0,128,255,0,0,0,13,"35 SS/SD"}}, - {35 * 26 * 1 * 128, {1,35,1,0,26,0,4,0,128,255,0,0,0,13,"35 SS/MD"}}, - {(35 * 18 * 1 - 3) * 256 + 3 * 128, {2,35,1,0,18,0,4,1, 0,255,0,0,0,13,"35 SS/DD"}}, - {40 * 18 * 1 * 128, {0,40,1,0,18,0,0,0,128,255,0,0,0,13,"40 SS/SD"}}, - {40 * 26 * 1 * 128, {1,40,1,0,26,0,4,0,128,255,0,0,0,13,"40 SS/MD"}}, - {(40 * 18 * 1 - 3) * 256 + 3 * 128, {2,40,1,0,18,0,4,1, 0,255,0,0,0,13,"40 SS/DD"}}, - {40 * 18 * 2 * 128, {0,40,1,0,18,1,0,0,128,255,0,0,0,13,"40 DS/SD"}}, - {40 * 26 * 2 * 128, {1,40,1,0,26,1,4,0,128,255,0,0,0,13,"40 DS/MD"}}, - {(40 * 18 * 2 - 3) * 256 + 3 * 128, {2,40,1,0,18,1,4,1, 0,255,0,0,0,13,"40 DS/DD"}}, - {77 * 18 * 1 * 128, {0,77,1,0,18,0,0,0,128,255,0,0,0,13,"77 SS/SD"}}, - {77 * 26 * 1 * 128, {1,77,1,0,26,0,4,0,128,255,0,0,0,13,"77 SS/MD"}}, - {(77 * 18 * 1 - 3) * 256 + 3 * 128, {2,77,1,0,18,0,4,1, 0,255,0,0,0,13,"77 SS/DD"}}, - {77 * 18 * 2 * 128, {0,77,1,0,18,1,0,0,128,255,0,0,0,13,"77 DS/SD"}}, - {77 * 26 * 2 * 128, {1,77,1,0,26,1,4,0,128,255,0,0,0,13,"77 DS/MD"}}, - {(77 * 18 * 2 - 3) * 256 + 3 * 128, {2,77,1,0,18,1,4,1, 0,255,0,0,0,13,"77 DS/DD"}}, - {80 * 18 * 2 * 128, {0,80,1,0,18,1,0,0,128,255,0,0,0,13,"80 DS/SD"}}, - {80 * 26 * 2 * 128, {1,80,1,0,26,1,4,0,128,255,0,0,0,13,"80 DS/MD"}}, - {(80 * 18 * 2 - 3) * 256 + 3 * 128, {2,80,1,0,18,1,4,1, 0,255,0,0,0,13,"80 DS/DD"}}, - {0, {0,}} -}; - -/***************************************************************************** - * - * Open a floppy image for drive 'drive' if it is not yet openend - * and a name was given. Determine the image geometry depending on the - * type of image and store the results into the global drv[] structure - * - *****************************************************************************/ - -#define MAXSIZE 5760 * 256 + 80 -static void _atari_load_proc(device_image_interface &image) -{ - atari_fdc_device *atarifdc = static_cast(image.device().owner()); - atarifdc->atari_load_proc(image); -} - -void atari_fdc_device::atari_load_proc(device_image_interface &image) -{ - int id = floppy_get_drive(image); - int size, i; - const char *ext; - - m_drv[id].image = auto_alloc_array(image.device().machine(),UINT8,MAXSIZE); - if (!m_drv[id].image) - return; - - /* tell whether the image is writable */ - m_drv[id].mode = !image.is_readonly(); - /* set up image if it has been created */ - if (image.has_been_created()) - { - int sector; - char buff[256]; - memset(buff, 0, sizeof(buff)); - /* default to 720 sectors */ - for( sector = 0; sector < 720; sector++ ) - image.fwrite(buff, 256); - image.fseek(0, SEEK_SET); - } - - size = image.fread(m_drv[id].image, MAXSIZE); - - if( size <= 0 ) - { - m_drv[id].image = NULL; - return; - } - - - /* re allocate the buffer; we don't want to be too lazy ;) */ - //m_drv[id].image = (UINT8*)image.image_realloc(m_drv[id].image, size); - - ext = image.filetype(); - - // hack alert, this means we can only load ATR via the softlist at the moment, image.filetype reutrns NULL :/ - if (image.software_entry() != NULL) ext="ATR"; - - /* no extension: assume XFD format (no header) */ - if (!ext) - { - m_drv[id].type = FORMAT_XFD; - m_drv[id].header_skip = 0; - } - else - /* XFD extension */ - if( toupper(ext[0])=='X' && toupper(ext[1])=='F' && toupper(ext[2])=='D' ) - { - m_drv[id].type = FORMAT_XFD; - m_drv[id].header_skip = 0; - } - else - /* ATR extension */ - if( toupper(ext[0])=='A' && toupper(ext[1])=='T' && toupper(ext[2])=='R' ) - { - m_drv[id].type = FORMAT_ATR; - m_drv[id].header_skip = 16; - } - else - /* DSK extension */ - if( toupper(ext[0])=='D' && toupper(ext[1])=='S' && toupper(ext[2])=='K' ) - { - m_drv[id].type = FORMAT_DSK; - m_drv[id].header_skip = sizeof(atari_dsk_format); - } - else - { - m_drv[id].type = FORMAT_XFD; - m_drv[id].header_skip = 0; - } - - if( m_drv[id].type == FORMAT_ATR && - (m_drv[id].image[0] != 0x96 || m_drv[id].image[1] != 0x02) ) - { - m_drv[id].type = FORMAT_XFD; - m_drv[id].header_skip = 0; - } - - - switch (m_drv[id].type) - { - /* XFD or unknown format: find a matching size from the table */ - case FORMAT_XFD: - for( i = 0; xfd_formats[i].size; i++ ) - { - if( size == xfd_formats[i].size ) - { - m_drv[id].density = xfd_formats[i].dsk.density; - m_drv[id].tracks = xfd_formats[i].dsk.tracks; - m_drv[id].spt = xfd_formats[i].dsk.spt; - m_drv[id].heads = (xfd_formats[i].dsk.doublesided) ? 2 : 1; - m_drv[id].bseclen = 128; - m_drv[id].seclen = 256 * xfd_formats[i].dsk.seclen_hi + xfd_formats[i].dsk.seclen_lo; - m_drv[id].sectors = m_drv[id].tracks * m_drv[id].heads * m_drv[id].spt; - break; - } - } - break; - /* ATR format: find a size including the 16 bytes header */ - case FORMAT_ATR: - { - int s; - m_drv[id].bseclen = 128; - /* get sectors from ATR header */ - s = (size - 16) / 128; - /* 3 + odd number of sectors ? */ - if ( m_drv[id].image[4] == 128 || (s % 18) == 0 || (s % 26) == 0 || ((s - 3) % 1) != 0 ) - { - m_drv[id].sectors = s; - m_drv[id].seclen = 128; - /* sector size 128 or count not evenly dividable by 26 ? */ - if( m_drv[id].seclen == 128 || (s % 26) != 0 ) - { - /* yup! single density */ - m_drv[id].density = 0; - m_drv[id].spt = 18; - m_drv[id].heads = 1; - m_drv[id].tracks = s / 18; - if( s % 18 != 0 ) - m_drv[id].tracks += 1; - if( m_drv[id].tracks % 2 == 0 && m_drv[id].tracks > 80 ) - { - m_drv[id].heads = 2; - m_drv[id].tracks /= 2; - } - } - else - { - /* yes: medium density */ - m_drv[id].density = 0; - m_drv[id].spt = 26; - m_drv[id].heads = 1; - m_drv[id].tracks = s / 26; - if( s % 26 != 0 ) - m_drv[id].tracks += 1; - if( m_drv[id].tracks % 2 == 0 && m_drv[id].tracks > 80 ) - { - m_drv[id].heads = 2; - m_drv[id].tracks /= 2; - } - } - } - else - { - /* it's double density */ - s = (s - 3) / 2 + 3; - m_drv[id].sectors = s; - m_drv[id].density = 2; - m_drv[id].seclen = 256; - m_drv[id].spt = 18; - m_drv[id].heads = 1; - m_drv[id].tracks = s / 18; - if( s % 18 != 0 ) - m_drv[id].tracks += 1; - if( m_drv[id].tracks % 2 == 0 && m_drv[id].tracks > 80 ) - { - m_drv[id].heads = 2; - m_drv[id].tracks /= 2; - } - } - } - break; - /* DSK format: it's all in the header */ - case FORMAT_DSK: - { - atari_dsk_format *dsk = (atari_dsk_format *) m_drv[id].image; - - m_drv[id].tracks = dsk->tracks; - m_drv[id].spt = dsk->spt; - m_drv[id].heads = (dsk->doublesided) ? 2 : 1; - m_drv[id].seclen = 256 * dsk->seclen_hi + dsk->seclen_lo; - m_drv[id].bseclen = m_drv[id].seclen; - m_drv[id].sectors = m_drv[id].tracks * m_drv[id].heads * m_drv[id].spt; - } - break; - } - logerror("atari opened floppy '%s', %d sectors (%d %s%s) %d bytes/sector\n", - image.filename(), - m_drv[id].sectors, - m_drv[id].tracks, - (m_drv[id].heads == 1) ? "SS" : "DS", - (m_drv[id].density == 0) ? "SD" : (m_drv[id].density == 1) ? "MD" : "DD", - m_drv[id].seclen); - return; -} - - - -/***************************************************************************** - * - * This is a description of the data flow between Atari (A) and the - * Floppy (F) for the supported commands. - * - * A->F DEV CMD AUX1 AUX2 CKS - * '1' 'S' 00 00 get status - * F->A ACK CPL 04 FF E0 00 CKS - * ^ ^ - * | | - * | bit 7 : door closed - * | - * bit7 : MD 128 bytes/sector, 26 sectors/track - * bit5 : DD 256 bytes/sector, 18 sectors/track - * else : SD 128 bytes/sector, 18 sectors/track - * - * A->F DEV CMD AUX1 AUX2 CKS - * '1' 'R' SECL SECH read sector - * F->A ACK command acknowledge - * *** now read the sector - * F->A CPL complete: sector read - * F->A 128/256 byte CKS - * - * A->F DEV CMD AUX1 AUX2 CKS - * '1' 'W' SECL SECH write with verify - * F->A ACK command acknowledge - * A->F 128/256 data CKS - * F->A CPL complete: CKS okay - * execute writing the sector - * F->A CPL complete: sector written - * - * A->F DEV CMD AUX1 AUX2 CKS - * '1' 'P' SECL SECH put sector - * F->A ACK command acknowledge - * A->F 128/256 data CKS - * F->A CPL complete: CKS okay - * execute writing the sector - * F->A CPL complete: sector written - * - * A->F DEV CMD AUX1 AUX2 CKS - * '1' '!' xx xx single density format - * F->A ACK command acknowledge - * execute formatting - * F->A CPL complete: format - * F->A 128/256 byte CKS bad sector table - * - * - * A->F DEV CMD AUX1 AUX2 CKS - * '1' '"' xx xx double density format - * F->A ACK command acknowledge - * execute formatting - * F->A CPL complete: format - * F->A 128/256 byte CKS bad sector table - * - *****************************************************************************/ -static void make_chksum(UINT8 * chksum, UINT8 data) -{ - UINT8 newone; - newone= *chksum + data; - if (newone < *chksum) - newone++; - - if (VERBOSE_CHKSUM) - logerror("atari chksum old $%02x + data $%02x -> new $%02x\n", *chksum, data, newone); - - *chksum = newone; -} - -void atari_fdc_device::clr_serout(int expect_data) -{ - m_serout_chksum = 0; - m_serout_offs = 0; - m_serout_count = expect_data + 1; -} - -void atari_fdc_device::add_serout(int expect_data) -{ - m_serout_chksum = 0; - m_serout_count = expect_data + 1; -} - -void atari_fdc_device::clr_serin(int ser_delay) -{ - pokey_device *pokey = machine().device("pokey"); - m_serin_chksum = 0; - m_serin_offs = 0; - m_serin_count = 0; - pokey->serin_ready(ser_delay * 40); -} - -void atari_fdc_device::add_serin(UINT8 data, int with_checksum) -{ - m_serin_buff[m_serin_count++] = data; - if (with_checksum) - make_chksum(&m_serin_chksum, data); -} - -static void ATTR_PRINTF(1,2) atari_set_frame_message(const char *fmt, ...) -{ - //va_list arg; - //va_start(arg, fmt); - - //vsprintf(atari_frame_message, fmt, arg); - //atari_frame_counter = 30; /* FIXME */ - - //va_end(arg); -} - -void atari_fdc_device::a800_serial_command() -{ - int i, drive, sector, offset; - - if( !m_serout_offs ) - { - if (VERBOSE_SERIAL) - logerror("atari serout command offset = 0\n"); - return; - } - clr_serin(10); - - if (VERBOSE_SERIAL) - { - logerror("atari serout command %d: %02X %02X %02X %02X %02X : %02X ", - m_serout_offs, - m_serout_buff[0], m_serout_buff[1], m_serout_buff[2], - m_serout_buff[3], m_serout_buff[4], m_serout_chksum); - } - - if (m_serout_chksum == 0) - { - if (VERBOSE_SERIAL) - logerror("OK\n"); - - drive = m_serout_buff[0] - '1'; /* drive # */ - /* sector # */ - if (drive < 0 || drive > 3) /* ignore unknown drives */ - { - logerror("atari unsupported drive #%d\n", drive+1); - atari_set_frame_message("DRIVE #%d not supported", drive+1); - return; - } - - /* extract sector number from the command buffer */ - sector = m_serout_buff[2] + 256 * m_serout_buff[3]; - - switch (m_serout_buff[1]) /* command ? */ - { - case 'S': /* status */ - atari_set_frame_message("DRIVE #%d STATUS", drive+1); - - if (VERBOSE_SERIAL) - logerror("atari status\n"); - - add_serin('A',0); - add_serin('C',0); - if (!m_drv[drive].mode) /* read only mode ? */ - { - if (m_drv[drive].spt == 26) - add_serin(0x80,1); /* MD: 0x80 */ - else - if (m_drv[drive].seclen == 128) - add_serin(0x00,1); /* SD: 0x00 */ - else - add_serin(0x20,1); /* DD: 0x20 */ - } - else - { - if (m_drv[drive].spt == 26) - add_serin(0x84,1); /* MD: 0x84 */ - else - if (m_drv[drive].seclen == 128) - add_serin(0x04,1); /* SD: 0x04 */ - else - add_serin(0x24,1); /* DD: 0x24 */ - } - if (m_drv[drive].image) - add_serin(0xff,1); /* door closed: 0xff */ - else - add_serin(0x7f,1); /* door open: 0x7f */ - add_serin(0xe0,1); /* dunno */ - add_serin(0x00,1); /* dunno */ - add_serin(m_serin_chksum,0); - break; - - case 'R': /* read sector */ - if (VERBOSE_SERIAL) - logerror("atari read sector #%d\n", sector); - - if( sector < 1 || sector > m_drv[drive].sectors ) - { - atari_set_frame_message("DRIVE #%d READ SECTOR #%3d - ERR", drive+1, sector); - - if (VERBOSE_SERIAL) - logerror("atari bad sector #\n"); - - add_serin('E',0); - break; - } - add_serin('A',0); /* acknowledge */ - add_serin('C',0); /* completed */ - if (sector < 4) /* sector 1 .. 3 might be different length */ - { - atari_set_frame_message("DRIVE #%d READ SECTOR #%3d - SD", drive+1, sector); - offset = (sector - 1) * m_drv[drive].bseclen + m_drv[drive].header_skip; - for (i = 0; i < 128; i++) - add_serin(m_drv[drive].image[offset++],1); - } - else - { - atari_set_frame_message("DRIVE #%d READ SECTOR #%3d - %cD", drive+1, sector, (m_drv[drive].seclen == 128) ? 'S' : 'D'); - offset = (sector - 1) * m_drv[drive].seclen + m_drv[drive].header_skip; - for (i = 0; i < m_drv[drive].seclen; i++) - add_serin(m_drv[drive].image[offset++],1); - } - add_serin(m_serin_chksum,0); - break; - - case 'W': /* write sector with verify */ - if (VERBOSE_SERIAL) - logerror("atari write sector #%d\n", sector); - - add_serin('A',0); - if (sector < 4) /* sector 1 .. 3 might be different length */ - { - add_serout(m_drv[drive].bseclen); - atari_set_frame_message("DRIVE #%d WRITE SECTOR #%3d - SD", drive+1, sector); - } - else - { - add_serout(m_drv[drive].seclen); - atari_set_frame_message("DRIVE #%d WRITE SECTOR #%3d - %cD", drive+1, sector, (m_drv[drive].seclen == 128) ? 'S' : 'D'); - } - break; - - case 'P': /* put sector (no verify) */ - if (VERBOSE_SERIAL) - logerror("atari put sector #%d\n", sector); - - add_serin('A',0); - if (sector < 4) /* sector 1 .. 3 might be different length */ - { - add_serout(m_drv[drive].bseclen); - atari_set_frame_message("DRIVE #%d PUT SECTOR #%3d - SD", drive+1, sector); - } - else - { - add_serout(m_drv[drive].seclen); - atari_set_frame_message("DRIVE #%d PUT SECTOR #%3d - %cD", drive+1, sector, (m_drv[drive].seclen == 128) ? 'S' : 'D'); - } - break; - - case '!': /* SD format */ - if (VERBOSE_SERIAL) - logerror("atari format SD drive #%d\n", drive+1); - - atari_set_frame_message("DRIVE #%d FORMAT SD", drive+1); - add_serin('A',0); /* acknowledge */ - add_serin('C',0); /* completed */ - for (i = 0; i < 128; i++) - add_serin(0,1); - add_serin(m_serin_chksum,0); - break; - - case '"': /* DD format */ - if (VERBOSE_SERIAL) - logerror("atari format DD drive #%d\n", drive+1); - - atari_set_frame_message("DRIVE #%d FORMAT DD", drive+1); - add_serin('A',0); /* acknowledge */ - add_serin('C',0); /* completed */ - for (i = 0; i < 256; i++) - add_serin(0,1); - add_serin(m_serin_chksum,0); - break; - - default: - if (VERBOSE_SERIAL) - logerror("atari unknown command #%c\n", m_serout_buff[1]); - - atari_set_frame_message("DRIVE #%d UNKNOWN CMD '%c'", drive+1, m_serout_buff[1]); - add_serin('N',0); /* negative acknowledge */ - } - } - else - { - atari_set_frame_message("serial cmd chksum error"); - if (VERBOSE_SERIAL) - logerror("BAD\n"); - - add_serin('E',0); - } - if (VERBOSE_SERIAL) - logerror("atari %d bytes to read\n", m_serin_count); -} - -void atari_fdc_device::a800_serial_write() -{ - int i, drive, sector, offset; - - if (VERBOSE_SERIAL) - { - logerror("atari serout %d bytes written : %02X ", - m_serout_offs, m_serout_chksum); - } - - clr_serin(80); - if (m_serout_chksum == 0) - { - if (VERBOSE_SERIAL) - logerror("OK\n"); - - add_serin('C',0); - /* write the sector */ - drive = m_serout_buff[0] - '1'; /* drive # */ - /* not write protected and image available ? */ - if (m_drv[drive].mode && m_drv[drive].image) - { - /* extract sector number from the command buffer */ - sector = m_serout_buff[2] + 256 * m_serout_buff[3]; - if (sector < 4) /* sector 1 .. 3 might be different length */ - { - offset = (sector - 1) * m_drv[drive].bseclen + m_drv[drive].header_skip; - - if (VERBOSE_SERIAL) - logerror("atari storing 128 byte sector %d at offset 0x%08X", sector, offset ); - - for (i = 0; i < 128; i++) - m_drv[drive].image[offset++] = m_serout_buff[5+i]; - atari_set_frame_message("DRIVE #%d WROTE SECTOR #%3d - SD", drive+1, sector); - } - else - { - offset = (sector - 1) * m_drv[drive].seclen + m_drv[drive].header_skip; - - if (VERBOSE_SERIAL) - logerror("atari storing %d byte sector %d at offset 0x%08X", m_drv[drive].seclen, sector, offset ); - - for (i = 0; i < m_drv[drive].seclen; i++) - m_drv[drive].image[offset++] = m_serout_buff[5+i]; - atari_set_frame_message("DRIVE #%d WROTE SECTOR #%3d - %cD", drive+1, sector, (m_drv[drive].seclen == 128) ? 'S' : 'D'); - } - add_serin('C',0); - } - else - { - add_serin('E',0); - } - } - else - { - if (VERBOSE_SERIAL) - logerror("BAD\n"); - - add_serin('E',0); - } -} - -READ8_MEMBER( atari_fdc_device::serin_r ) -{ - int data = 0x00; - int ser_delay = 0; - - if (m_serin_count) - { - pokey_device *pokey = machine().device("pokey"); - - data = m_serin_buff[m_serin_offs]; - ser_delay = 2 * 40; - if (m_serin_offs < 3) - { - ser_delay = 4 * 40; - if (m_serin_offs < 2) - ser_delay = 200 * 40; - } - m_serin_offs++; - if (--m_serin_count == 0) - m_serin_offs = 0; - else - pokey->serin_ready(ser_delay); - } - - if (VERBOSE_SERIAL) - logerror("atari serin[$%04x] -> $%02x; delay %d\n", m_serin_offs, data, ser_delay); - - return data; -} - -WRITE8_MEMBER( atari_fdc_device::serout_w ) -{ - pia6821_device *pia = machine().device( "pia" ); - - /* ignore serial commands if no floppy image is specified */ - if( !m_drv[0].image ) - return; - if (m_serout_count) - { - /* store data */ - m_serout_buff[m_serout_offs] = data; - - if (VERBOSE_SERIAL) - logerror("atari serout[$%04x] <- $%02x; count %d\n", m_serout_offs, data, m_serout_count); - - m_serout_offs++; - if (--m_serout_count == 0) - { - /* exclusive or written checksum with calculated */ - m_serout_chksum ^= data; - /* if the attention line is high, this should be data */ - if (pia->irq_b_state()) - a800_serial_write(); - } - else - { - make_chksum(&m_serout_chksum, data); - } - } -} - -WRITE_LINE_MEMBER(atari_fdc_device::pia_cb2_w) -{ - if (!state) - { - clr_serout(4); /* expect 4 command bytes + checksum */ - } - else - { - m_serin_delay = 0; - a800_serial_command(); - } -} - -static const floppy_interface atari_floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(atari_only), - "floppy_5_25" -}; - -static MACHINE_CONFIG_FRAGMENT( atari_fdc ) - MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(atari_floppy_interface) -MACHINE_CONFIG_END - -legacy_floppy_image_device *atari_fdc_device::atari_floppy_get_device_child(int drive) -{ - switch(drive) { - case 0 : return subdevice(FLOPPY_0); - case 1 : return subdevice(FLOPPY_1); - case 2 : return subdevice(FLOPPY_2); - case 3 : return subdevice(FLOPPY_3); - } - return NULL; -} - -const device_type ATARI_FDC = &device_creator; - -atari_fdc_device::atari_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ATARI_FDC, "Atari FDC", tag, owner, clock, "atari_fdc", __FILE__), - m_serout_count(0), - m_serout_offs(0), - m_serout_chksum(0), -// m_serout_delay(0), - m_serin_count(0), - m_serin_offs(0), - m_serin_chksum(0), - m_serin_delay(0) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void atari_fdc_device::device_start() -{ - int id; - - memset(m_serout_buff, 0, sizeof(m_serout_buff)); - memset(m_serin_buff, 0, sizeof(m_serin_buff)); - memset(m_drv, 0, sizeof(m_drv)); - - for(id=0;id<4;id++) - { - atari_floppy_get_device_child(id)->floppy_install_load_proc(_atari_load_proc); - } -} - -//------------------------------------------------- -// device_mconfig_additions - return a pointer to -// the device's machine fragment -//------------------------------------------------- - -machine_config_constructor atari_fdc_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( atari_fdc ); -} diff --git a/src/mess/machine/atarifdc.h b/src/mess/machine/atarifdc.h deleted file mode 100644 index 29aea88ad86..00000000000 --- a/src/mess/machine/atarifdc.h +++ /dev/null @@ -1,69 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/* - ataridev.h - -*/ - -#ifndef _ATARIFDC_H -#define _ATARIFDC_H - -#include "imagedev/flopdrv.h" - -class atari_fdc_device : public device_t -{ -public: - atari_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_READ8_MEMBER( serin_r ); - DECLARE_WRITE8_MEMBER( serout_w ); - DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); - void atari_load_proc(device_image_interface &image); - -protected: - // device-level overrides - virtual void device_start(); - virtual machine_config_constructor device_mconfig_additions() const; - -private: - void clr_serout(int expect_data); - void add_serout(int expect_data); - void clr_serin(int ser_delay); - void add_serin(UINT8 data, int with_checksum); - void a800_serial_command(); - void a800_serial_write(); - legacy_floppy_image_device *atari_floppy_get_device_child(int drive); - - struct atari_drive - { - UINT8 *image; /* alloc'd image */ - int type; /* type of image (XFD, ATR, DSK) */ - int mode; /* 0 read only, != 0 read/write */ - int density; /* 0 SD, 1 MD, 2 DD */ - int header_skip; /* number of bytes in format header */ - int tracks; /* number of tracks (35,40,77,80) */ - int heads; /* number of heads (1,2) */ - int spt; /* sectors per track (18,26) */ - int seclen; /* sector length (128,256) */ - int bseclen; /* boot sector length (sectors 1..3) */ - int sectors; /* total sectors, ie. tracks x heads x spt */ - }; - - int m_serout_count; - int m_serout_offs; - UINT8 m_serout_buff[512]; - UINT8 m_serout_chksum; -// int m_serout_delay; - - int m_serin_count; - int m_serin_offs; - UINT8 m_serin_buff[512]; - UINT8 m_serin_chksum; - int m_serin_delay; - - atari_drive m_drv[4]; -}; - -extern const device_type ATARI_FDC; - -#endif /* _ATARIFDC_H */ diff --git a/src/mess/machine/b2m.c b/src/mess/machine/b2m.c deleted file mode 100644 index 2ff9f595aa1..00000000000 --- a/src/mess/machine/b2m.c +++ /dev/null @@ -1,304 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Bashkiria-2M machine driver by Miodrag Milanovic - - 28/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "machine/wd_fdc.h" -#include "machine/pic8259.h" -#include "machine/i8251.h" -#include "includes/b2m.h" -#include "machine/ram.h" -#include "imagedev/flopdrv.h" - -READ8_MEMBER(b2m_state::b2m_keyboard_r) -{ - UINT8 key = 0x00; - if (offset < 0x100) { - if ((offset & 0x01)!=0) { key |= ioport("LINE0")->read(); } - if ((offset & 0x02)!=0) { key |= ioport("LINE1")->read(); } - if ((offset & 0x04)!=0) { key |= ioport("LINE2")->read(); } - if ((offset & 0x08)!=0) { key |= ioport("LINE3")->read(); } - if ((offset & 0x10)!=0) { key |= ioport("LINE4")->read(); } - if ((offset & 0x20)!=0) { key |= ioport("LINE5")->read(); } - if ((offset & 0x40)!=0) { key |= ioport("LINE6")->read(); } - if ((offset & 0x80)!=0) { key |= ioport("LINE7")->read(); } - } else { - if ((offset & 0x01)!=0) { key |= ioport("LINE8")->read(); } - if ((offset & 0x02)!=0) { key |= ioport("LINE9")->read(); } - if ((offset & 0x04)!=0) { key |= ioport("LINE10")->read(); } - } - return key; -} - - -void b2m_state::b2m_set_bank(int bank) -{ - UINT8 *rom; - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - space.install_write_bank(0x0000, 0x27ff, "bank1"); - space.install_write_bank(0x2800, 0x2fff, "bank2"); - space.install_write_bank(0x3000, 0x6fff, "bank3"); - space.install_write_bank(0x7000, 0xdfff, "bank4"); - space.install_write_bank(0xe000, 0xffff, "bank5"); - - rom = memregion("maincpu")->base(); - switch(bank) { - case 0 : - case 1 : - space.unmap_write(0xe000, 0xffff); - - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram + 0x2800); - membank("bank3")->set_base(ram + 0x3000); - membank("bank4")->set_base(ram + 0x7000); - membank("bank5")->set_base(rom + 0x10000); - break; -#if 0 - case 1 : - space.unmap_write(0x3000, 0x6fff); - space.unmap_write(0xe000, 0xffff); - - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram + 0x2800); - membank("bank3")->set_base(rom + 0x12000); - membank("bank4")->set_base(rom + 0x16000); - membank("bank5")->set_base(rom + 0x10000); - break; -#endif - case 2 : - space.unmap_write(0x2800, 0x2fff); - space.unmap_write(0xe000, 0xffff); - - membank("bank1")->set_base(ram); - space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); - membank("bank3")->set_base(ram + 0x10000); - membank("bank4")->set_base(ram + 0x7000); - membank("bank5")->set_base(rom + 0x10000); - break; - case 3 : - space.unmap_write(0x2800, 0x2fff); - space.unmap_write(0xe000, 0xffff); - - membank("bank1")->set_base(ram); - space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); - membank("bank3")->set_base(ram + 0x14000); - membank("bank4")->set_base(ram + 0x7000); - membank("bank5")->set_base(rom + 0x10000); - break; - case 4 : - space.unmap_write(0x2800, 0x2fff); - space.unmap_write(0xe000, 0xffff); - - membank("bank1")->set_base(ram); - space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); - membank("bank3")->set_base(ram + 0x18000); - membank("bank4")->set_base(ram + 0x7000); - membank("bank5")->set_base(rom + 0x10000); - - break; - case 5 : - space.unmap_write(0x2800, 0x2fff); - space.unmap_write(0xe000, 0xffff); - - membank("bank1")->set_base(ram); - space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); - membank("bank3")->set_base(ram + 0x1c000); - membank("bank4")->set_base(ram + 0x7000); - membank("bank5")->set_base(rom + 0x10000); - - break; - case 6 : - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram + 0x2800); - membank("bank3")->set_base(ram + 0x3000); - membank("bank4")->set_base(ram + 0x7000); - membank("bank5")->set_base(ram + 0xe000); - break; - case 7 : - space.unmap_write(0x0000, 0x27ff); - space.unmap_write(0x2800, 0x2fff); - space.unmap_write(0x3000, 0x6fff); - space.unmap_write(0x7000, 0xdfff); - space.unmap_write(0xe000, 0xffff); - - membank("bank1")->set_base(rom + 0x10000); - membank("bank2")->set_base(rom + 0x10000); - membank("bank3")->set_base(rom + 0x10000); - membank("bank4")->set_base(rom + 0x10000); - membank("bank5")->set_base(rom + 0x10000); - break; - } -} - - -WRITE_LINE_MEMBER(b2m_state::bm2_pit_out1) -{ - m_speaker->level_w(state); -} - -WRITE8_MEMBER(b2m_state::b2m_8255_porta_w) -{ - m_b2m_8255_porta = data; -} - -WRITE8_MEMBER(b2m_state::b2m_8255_portb_w) -{ - m_b2m_video_scroll = data; -} - -WRITE8_MEMBER(b2m_state::b2m_8255_portc_w) -{ - m_b2m_8255_portc = data; - b2m_set_bank(m_b2m_8255_portc & 7); - m_b2m_video_page = (m_b2m_8255_portc >> 7) & 1; -} - -READ8_MEMBER(b2m_state::b2m_8255_portb_r) -{ - return m_b2m_video_scroll; -} - -WRITE_LINE_MEMBER( b2m_state::b2m_fdc_drq ) -{ - /* Clears HALT state of CPU when data is ready to read */ - if (state) - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); -} - - -WRITE8_MEMBER(b2m_state::b2m_ext_8255_portc_w) -{ - UINT8 drive = ((data >> 1) & 1) ^ 1; - UINT8 side = (data & 1) ^ 1; - - static const char *names[] = { "fd0", "fd1"}; - floppy_image_device *floppy = NULL; - floppy_connector *con = machine().device(names[drive]); - if(con) - floppy = con->get_device(); - - floppy->mon_w(0); - m_fdc->set_floppy(floppy); - if (m_b2m_drive!=drive) { - m_b2m_drive = drive; - } - - if (m_b2m_side!=side) { - m_b2m_side = side; - floppy->ss_w(side); - } - /* - When bit 5 is set CPU is in HALT state and stay there until - DRQ is triggered from floppy side - */ - - if ((data & 0xf0)==0x20) { - m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - } -} - -READ8_MEMBER(b2m_state::b2m_romdisk_porta_r) -{ - UINT8 *romdisk = memregion("maincpu")->base() + 0x12000; - return romdisk[m_b2m_romdisk_msb*256+m_b2m_romdisk_lsb]; -} - -WRITE8_MEMBER(b2m_state::b2m_romdisk_portb_w) -{ - m_b2m_romdisk_lsb = data; -} - -WRITE8_MEMBER(b2m_state::b2m_romdisk_portc_w) -{ - m_b2m_romdisk_msb = data & 0x7f; -} - -/* Driver initialization */ -DRIVER_INIT_MEMBER(b2m_state,b2m) -{ - m_vblank_state = 0; -} - -WRITE8_MEMBER(b2m_state::b2m_palette_w) -{ - UINT8 b = (3 - ((data >> 6) & 3)) * 0x55; - UINT8 g = (3 - ((data >> 4) & 3)) * 0x55; - UINT8 r = (3 - ((data >> 2) & 3)) * 0x55; - - UINT8 bw = (3 - (data & 3)) * 0x55; - - m_b2m_color[offset & 3] = data; - - if (ioport("MONITOR")->read()==1) { - m_palette->set_pen_color(offset, r, g, b); - } else { - m_palette->set_pen_color(offset, bw, bw, bw); - } -} - -READ8_MEMBER(b2m_state::b2m_palette_r) -{ - return m_b2m_color[offset]; -} - -WRITE8_MEMBER(b2m_state::b2m_localmachine_w) -{ - m_b2m_localmachine = data; -} - -READ8_MEMBER(b2m_state::b2m_localmachine_r) -{ - return m_b2m_localmachine; -} - -void b2m_state::b2m_postload() -{ - b2m_set_bank(m_b2m_8255_portc & 7); -} - -void b2m_state::machine_start() -{ - m_pic = machine().device("pic8259"); - m_fdc = machine().device("fd1793"); - - /* register for state saving */ - save_item(NAME(m_b2m_8255_porta)); - save_item(NAME(m_b2m_video_scroll)); - save_item(NAME(m_b2m_8255_portc)); - save_item(NAME(m_b2m_video_page)); - save_item(NAME(m_b2m_drive)); - save_item(NAME(m_b2m_side)); - save_item(NAME(m_b2m_romdisk_lsb)); - save_item(NAME(m_b2m_romdisk_msb)); - save_pointer(NAME(m_b2m_color), 4); - save_item(NAME(m_b2m_localmachine)); - save_item(NAME(m_vblank_state)); - - machine().save().register_postload(save_prepost_delegate(FUNC(b2m_state::b2m_postload), this)); -} - -INTERRUPT_GEN_MEMBER(b2m_state::b2m_vblank_interrupt) -{ - m_vblank_state++; - if (m_vblank_state>1) m_vblank_state=0; - m_pic->ir0_w(m_vblank_state); -} - -void b2m_state::machine_reset() -{ - m_b2m_side = 0; - m_b2m_drive = 0; - - b2m_set_bank(7); -} diff --git a/src/mess/machine/bbc.c b/src/mess/machine/bbc.c deleted file mode 100644 index 3ffefc8a585..00000000000 --- a/src/mess/machine/bbc.c +++ /dev/null @@ -1,1861 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Gordon Jefferyes, Nigel Barnes -/****************************************************************************** - BBC Model B - - MESS Driver By: - - Gordon Jefferyes - mess_bbc@romvault.com - Nigel Barnes - ngbarnes@hotmail.com - -******************************************************************************/ - -#include -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "sound/tms5220.h" -#include "machine/6522via.h" -#include "machine/wd_fdc.h" -#include "imagedev/flopdrv.h" -#include "includes/bbc.h" -#include "machine/mc146818.h" -#include "bus/centronics/ctronics.h" -#include "imagedev/cassette.h" - - -void bbc_state::check_interrupts() -{ - m_maincpu->set_input_line(M6502_IRQ_LINE, m_via_system_irq || m_via_user_irq || m_acia_irq || m_ACCCON_IRR); -} - -/************************* -Model A memory handling functions -*************************/ - -/* for the model A just address the 4 on board ROM sockets */ -WRITE8_MEMBER(bbc_state::bbc_page_selecta_w) -{ - m_bank4->set_entry(data & 0x03); -} - - -WRITE8_MEMBER(bbc_state::bbc_memorya1_w) -{ - m_region_maincpu->base()[offset]=data; -} - -/************************* -Model B memory handling functions -*************************/ - -/* the model B address all 16 of the ROM sockets */ -WRITE8_MEMBER(bbc_state::bbc_page_selectb_w) -{ - m_rombank = data & 0x0f; - m_bank4->set_entry(m_rombank); -} - - -WRITE8_MEMBER(bbc_state::bbc_memoryb3_w) -{ - if (m_ram->size() == 32*1024) - { - m_region_maincpu->base()[offset + 0x4000] = data; - } - else - { - m_region_maincpu->base()[offset] = data; - } -} - -/* I have setup 3 types of sideways ram: -0: none -1: 128K (bank 8 to 15) Solidisc sideways ram userport bank latch -2: 64K (banks 4 to 7) for Acorn sideways ram FE30 bank latch -3: 128K (banks 8 to 15) for Acown sideways ram FE30 bank latch -*/ -static const unsigned short bbc_SWRAMtype1[16]={0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1}; -static const unsigned short bbc_SWRAMtype2[16]={0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0}; -static const unsigned short bbc_SWRAMtype3[16]={0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1}; - -WRITE8_MEMBER(bbc_state::bbc_memoryb4_w) -{ - switch (m_SWRAMtype) - { - case 1: if (bbc_SWRAMtype1[m_userport]) m_region_opt->base()[(m_userport << 14) + offset] = data; - case 2: if (bbc_SWRAMtype2[m_rombank]) m_region_opt->base()[(m_rombank << 14) + offset] = data; - case 3: if (bbc_SWRAMtype3[m_rombank]) m_region_opt->base()[(m_rombank << 14) + offset] = data; - } -} - -/****************************************/ -/* BBC B Plus memory handling function */ -/****************************************/ - - -/* this function should return true if - the instruction is in the VDU driver address ranged - these are set when: - PC is in the range c000 to dfff - or if pagedRAM set and PC is in the range a000 to afff -*/ -int bbc_state::vdudriverset() -{ - int PC; - PC = machine().device("maincpu")->safe_pc(); // this needs to be set to the 6502 program counter - return (((PC >= 0xc000) && (PC <= 0xdfff)) || ((m_pagedRAM) && ((PC >= 0xa000) && (PC <= 0xafff)))); -} - - -/* the model B Plus addresses all 16 of the ROM sockets plus the extra 12K of ram at 0x8000 - and 20K of shadow ram at 0x3000 */ -WRITE8_MEMBER(bbc_state::bbc_page_selectbp_w) -{ - if ((offset&0x04)==0) - { - m_pagedRAM = (data >> 7) & 0x01; - m_rombank = data & 0x0f; - - if (m_pagedRAM) - { - /* if paged ram then set 8000 to afff to read from the ram 8000 to afff */ - m_bank4->set_entry(0x10); - } - else - { - /* if paged rom then set the rom to be read from 8000 to afff */ - m_bank4->set_entry(m_rombank); - }; - - /* set the rom to be read from b000 to bfff */ - m_bank6->set_entry(m_rombank); - } - else - { - //the video display should now use this flag to display the shadow ram memory - m_vdusel=(data>>7)&0x01; - bbcbp_setvideoshadow(m_vdusel); - //need to make the video display do a full screen refresh for the new memory area - m_bank2->set_base(m_region_maincpu->base() + 0x3000); - } -} - - -/* write to the normal memory from 0x0000 to 0x2fff - the writes to this memory are just done the normal - way */ - -WRITE8_MEMBER(bbc_state::bbc_memorybp1_w) -{ - m_region_maincpu->base()[offset]=data; -} - - -/* the next two function handle reads and write to the shadow video ram area - between 0x3000 and 0x7fff - - when vdusel is set high the video display uses the shadow ram memory - the processor only reads and write to the shadow ram when vdusel is set - and when the instruction being executed is stored in a set range of memory - addresses known as the VDU driver instructions. -*/ - - -DIRECT_UPDATE_MEMBER(bbc_state::bbcbp_direct_handler) -{ - UINT8 *RAM = m_region_maincpu->base(); - if (m_vdusel == 0) - { - // not in shadow ram mode so just read normal ram - m_bank2->set_base(RAM + 0x3000); - } - else - { - if (vdudriverset()) - { - // if VDUDriver set then read from shadow ram - m_bank2->set_base(RAM + 0xb000); - } - else - { - // else read from normal ram - m_bank2->set_base(RAM + 0x3000); - } - } - return address; -} - - -WRITE8_MEMBER(bbc_state::bbc_memorybp2_w) -{ - UINT8 *RAM = m_region_maincpu->base(); - if (m_vdusel==0) - { - // not in shadow ram mode so just write to normal ram - RAM[offset + 0x3000] = data; - } - else - { - if (vdudriverset()) - { - // if VDUDriver set then write to shadow ram - RAM[offset + 0xb000] = data; - } - else - { - // else write to normal ram - RAM[offset + 0x3000] = data; - } - } -} - - -/* if the pagedRAM is set write to RAM between 0x8000 to 0xafff -otherwise this area contains ROM so no write is required */ -WRITE8_MEMBER(bbc_state::bbc_memorybp4_w) -{ - if (m_pagedRAM) - { - m_region_maincpu->base()[offset+0x8000]=data; - } -} - - -/* the BBC B plus 128K had extra ram mapped in replacing the -rom bank 0,1,c and d. -The function memorybp3_128_w handles memory writes from 0x8000 to 0xafff -which could either be sideways ROM, paged RAM, or sideways RAM. -The function memorybp4_128_w handles memory writes from 0xb000 to 0xbfff -which could either be sideways ROM or sideways RAM */ - - -static const unsigned short bbc_b_plus_sideways_ram_banks[16]={ 1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0 }; - - -WRITE8_MEMBER(bbc_state::bbc_memorybp4_128_w) -{ - if (m_pagedRAM) - { - m_region_maincpu->base()[offset+0x8000]=data; - } - else - { - if (bbc_b_plus_sideways_ram_banks[m_rombank]) - { - m_region_opt->base()[offset+(m_rombank<<14)]=data; - } - } -} - -WRITE8_MEMBER(bbc_state::bbc_memorybp6_128_w) -{ - if (bbc_b_plus_sideways_ram_banks[m_rombank]) - { - m_region_opt->base()[offset+(m_rombank<<14)+0x3000]=data; - } -} - - - -/****************************************/ -/* BBC Master functions */ -/****************************************/ - -/* -ROMSEL - &FE30 write Only -B7 RAM 1=Page in ANDY &8000-&8FFF - 0=Page in ROM &8000-&8FFF -B6 Not Used -B5 Not Used -B4 Not Used -B3-B0 Rom/Ram Bank Select - -ACCCON - -b7 IRR 1=Causes an IRQ to the processor -b6 TST 1=Selects &FC00-&FEFF read from OS-ROM -b5 IFJ 1=Internal 1MHz bus - 0=External 1MHz bus -b4 ITU 1=Internal Tube - 0=External Tube -b3 Y 1=Read/Write HAZEL &C000-&DFFF RAM - 0=Read/Write ROM &C000-&DFFF OS-ROM -b2 X 1=Read/Write LYNNE - 0=Read/WRITE main memory &3000-&8000 -b1 E 1=Causes shadow if VDU code - 0=Main all the time -b0 D 1=Display LYNNE as screen - 0=Display main RAM screen - -ACCCON is a read/write register - -HAZEL is the 8K of RAM used by the MOS, filing system, and other Roms at &C000-&DFFF - -ANDY is the name of the 4K of RAM used by the MOS at &8000-&8FFF - -b7:This causes an IRQ to occur. If you set this bit, you must write a routine on IRQ2V to clear it. - -b6:If set, this switches in the ROM at &FD00-&FEFF for reading, writes to these addresses are still directed to the I/O -The MOS will not work properly with this but set. the Masters OS uses this feature to place some of the reset code in this area, -which is run at powerup. - -b3:If set, access to &C000-&DFFF are directed to HAZEL, an 8K bank of RAM. IF clear, then operating system ROM is read. - -b2:If set, read/write access to &3000-&7FFF are directed to the LYNNE, the shadow screen RAM. If clear access is made to the main RAM. - -b1:If set, when the program counter is between &C000 and &DFFF, read/write access is directed to the LYNNE shadow RAM. -if the program counter is anywhere else main ram is accessed. - -*/ - - -READ8_MEMBER(bbc_state::bbcm_ACCCON_read) -{ - logerror("ACCCON read %d\n",offset); - return m_ACCCON; -} - -WRITE8_MEMBER(bbc_state::bbcm_ACCCON_write) -{ - int tempIRR; - m_ACCCON=data; - - logerror("ACCCON write %d %d \n",offset,data); - - tempIRR=m_ACCCON_IRR; - - m_ACCCON_IRR=(data>>7)&1; - m_ACCCON_TST=(data>>6)&1; - m_ACCCON_IFJ=(data>>5)&1; - m_ACCCON_ITU=(data>>4)&1; - m_ACCCON_Y =(data>>3)&1; - m_ACCCON_X =(data>>2)&1; - m_ACCCON_E =(data>>1)&1; - m_ACCCON_D =(data>>0)&1; - - if (tempIRR!=m_ACCCON_IRR) - { - check_interrupts(); - } - - if (m_ACCCON_Y) - { - m_bank7->set_base(m_region_maincpu->base() + 0x9000); - } - else - { - m_bank7->set_base(m_region_os->base()); - } - - bbcbp_setvideoshadow(m_ACCCON_D); - - - if (m_ACCCON_X) - { - m_bank2->set_base(m_region_maincpu->base() + 0xb000); - } - else - { - m_bank2->set_base(m_region_maincpu->base() + 0x3000); - } - - /* ACCCON_TST controls paging of rom reads in the 0xFC00-0xFEFF region */ - /* if 0 the I/O is paged for both reads and writes */ - /* if 1 the ROM is paged in for reads but writes still go to I/O */ - if (m_ACCCON_TST) - { - m_bank8->set_base(m_region_os->base() + 0x3c00); - space.install_read_bank(0xfc00, 0xfeff, "bank8"); - } - else - { - space.install_read_handler(0xfc00, 0xfeff, read8_delegate(FUNC(bbc_state::bbcm_r),this)); - } -} - - -int bbc_state::bbcm_vdudriverset() -{ - int PC; - PC = machine().device("maincpu")->safe_pc(); - return ((PC >= 0xc000) && (PC <= 0xdfff)); -} - - -WRITE8_MEMBER(bbc_state::page_selectbm_w) -{ - m_pagedRAM = (data & 0x80) >> 7; - m_rombank = data & 0x0f; - - if (m_pagedRAM) - { - m_bank4->set_entry(0x10); - m_bank5->set_entry(m_rombank); - } - else - { - m_bank4->set_entry(m_rombank); - m_bank5->set_entry(m_rombank); - } -} - - - -WRITE8_MEMBER(bbc_state::bbc_memorybm1_w) -{ - m_region_maincpu->base()[offset] = data; -} - - -DIRECT_UPDATE_MEMBER(bbc_state::bbcm_direct_handler) -{ - if (m_ACCCON_X) - { - m_bank2->set_base(m_region_maincpu->base() + 0xb000); - } - else - { - if (m_ACCCON_E && bbcm_vdudriverset()) - { - m_bank2->set_base(m_region_maincpu->base() + 0xb000); - } - else - { - m_bank2->set_base(m_region_maincpu->base() + 0x3000); - } - } - - return address; -} - - - -WRITE8_MEMBER(bbc_state::bbc_memorybm2_w) -{ - UINT8 *RAM = m_region_maincpu->base(); - if (m_ACCCON_X) - { - RAM[offset + 0xb000] = data; - } - else - { - if (m_ACCCON_E && bbcm_vdudriverset()) - { - RAM[offset + 0xb000] = data; - } - else - { - RAM[offset + 0x3000] = data; - } - } -} - -static const unsigned short bbc_master_sideways_ram_banks[16]= -{ - 0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0 -}; - - -WRITE8_MEMBER(bbc_state::bbc_memorybm4_w) -{ - if (m_pagedRAM) - { - m_region_maincpu->base()[offset+0x8000] = data; - } - else - { - if (bbc_master_sideways_ram_banks[m_rombank]) - { - m_region_opt->base()[offset+(m_rombank<<14)] = data; - } - } -} - - -WRITE8_MEMBER(bbc_state::bbc_memorybm5_w) -{ - if (bbc_master_sideways_ram_banks[m_rombank]) - { - m_region_opt->base()[offset+(m_rombank<<14)+0x1000] = data; - } -} - - -WRITE8_MEMBER(bbc_state::bbc_memorybm7_w) -{ - if (m_ACCCON_Y) - { - m_region_maincpu->base()[offset+0x9000] = data; - } -} - - - -/****************************************************************************** -&FC00-&FCFF FRED -&FC00-&FC03 Byte-Wide Expansion RAM -&FC08-&FC0F Ample M2000 MIDI Interface (see also FCF0) -&FC10-&FC13 Teletext -&FC14-&FC1F Prestel -&FC20-&FC27 IEEE 488 Interface -&FC28-&FC2F Acorn Expansion, currently unused -&FC30-&FC3F Cambridge Ring Interface -&FC40-&FC47 Winchester Disc Interface -&FC48-&FC7F Acorn Expansion, currently unused -&FC80-&FC8F Test Hardware -&FC90-&FCBF Acorn Expansion, currently unused -&FCC0-&FCFE User Applications -&FCF0-&FCF7 JGH/ETI MIDI Control (see also FC08) -&FCFC-&FCFF Page-Wide Expansion RAM - -&FD00-&FDFF JIM -&FD00-&FDFF Page-wide expansion RAM window -&FD40-&FD4F Torch SASI/SCSI Hard Drive Access -&FDFE-&FDFF Reset Test vector - -&FE00-&FEFF SHEILA Read Write -&FE00-&FE07 6845 CRTC Video controller Video Controller 8 ( 2 bytes x 4 ) -&FE08-&FE0F 6850 ACIA Serial controller Serial Controller 8 ( 2 bytes x 4 ) -&FE10-&FE17 Serial ULA - Serial system chip 8 ( 1 byte x 8 ) -&FE18-&FE1F uPD7002 A to D converter A to D converter 8 ( 4 bytes x 2 ) -&FE20-&FE23 Video ULA - Video system chip 4 ( 2 bytes x 2 ) -&FE24-&FE27 FDC Latch 1770 Control latch 1770 Control latch 4 ( 1 byte x 4 ) -&FE28-&FE2F 1770 registers 1770 Disc Controller 1770 Disc Controller 8 ( 4 bytes x 2 ) -&FE30-&FE33 ROMSEL - ROM Select 4 ( 1 byte x 4 ) -&FE34-&3FE7 ACCCON ACCCON select reg. ACCCON select reg 4 ( 1 byte x 4 ) -&FE38-&FE3F NC - - -&FE40-&FE5F 6522 VIA SYSTEM VIA SYSTEM VIA 32 (16 bytes x 2 ) 1MHz -&FE60-&FE7F 6522 VIA USER VIA USER VIA 32 (16 bytes x 2 ) 1MHz -&FE80-&FE9F 8271 registers 8271 Disk Controller 8271 Disk Controller -&FEA0-&FEBF 68B54 ADLC ECONET controller ECONET controller 32 ( 4 bytes x 8 ) 2MHz -&FEC0-&FEDF 6854 ADLC ECONET controller ECONET controller 32 ( 4 bytes x 8 ) 2MHz -&FEE0-&FEFF Tube ULA Tube system interface Tube system interface 32 (32 bytes x 1 ) 2MHz -******************************************************************************/ - -READ8_MEMBER(bbc_state::bbcm_r) -{ - long myo; - - if (offset<=0x0ff) /* FRED */ - { - return 0xff; - }; - - if ((offset>=0x100) && (offset<=0x1ff)) /* JIM */ - { - return 0xff; - }; - - if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */ - { - myo = offset-0x200; - if ((myo>=0x00) && (myo<=0x06) && (myo+0x01) & 1) return m_mc6845->status_r(space, myo-0x00); /* Video controller */ - if ((myo>=0x01) && (myo<=0x07) && (myo & 1)) return m_mc6845->register_r(space, myo-0x01); - if ((myo>=0x08) && (myo<=0x0e) && (myo+0x01) & 1) return m_acia ? m_acia->status_r(space, myo-0x08) : 0xfe; /* Serial controller */ - if ((myo>=0x09) && (myo<=0x0f) && (myo & 1)) return m_acia ? m_acia->data_r(space, myo-0x09) : 0xfe; - if ((myo>=0x10) && (myo<=0x17)) return 0xfe; /* Serial System Chip */ - if ((myo>=0x18) && (myo<=0x1f)) return m_upd7002 ? m_upd7002->read(space, myo-0x18) : 0xfe; /* A to D converter */ - if ((myo>=0x20) && (myo<=0x23)) return 0xfe; /* VideoULA */ - if ((myo>=0x24) && (myo<=0x27)) return bbcm_wd177xl_read(space, myo - 0x24); /* 177x Control Latch */ - if ((myo>=0x28) && (myo<=0x2f) && (m_wd1770)) return m_wd1770->read(space, myo-0x28); /* 1770 Controller */ - if ((myo>=0x28) && (myo<=0x2f) && (m_wd1772)) return m_wd1772->read(space, myo-0x28); /* 1772 Controller */ - if ((myo>=0x28) && (myo<=0x2f)) return 0xfe; /* No Controller */ - if ((myo>=0x30) && (myo<=0x33)) return 0xfe; - if ((myo>=0x34) && (myo<=0x37)) return bbcm_ACCCON_read(space, myo-0x34); /* ACCCON */ - if ((myo>=0x38) && (myo<=0x3f)) return 0xfe; /* NC ?? */ - if ((myo>=0x40) && (myo<=0x5f)) return m_via6522_0->read(space, myo-0x40); - if ((myo>=0x60) && (myo<=0x7f)) return m_via6522_1 ? m_via6522_1->read(space, myo-0x60) : 0xfe; - if ((myo>=0x80) && (myo<=0x9f)) return 0xfe; - if ((myo>=0xa0) && (myo<=0xbf)) return m_adlc ? m_adlc->read(space, myo & 0x03) : 0xfe; - if ((myo>=0xc0) && (myo<=0xdf)) return 0xfe; - if ((myo>=0xe0) && (myo<=0xff)) return 0xfe; - } - return 0xfe; -} - -WRITE8_MEMBER(bbc_state::bbcm_w) -{ - long myo; - - if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */ - { - myo=offset-0x200; - if ((myo>=0x00) && (myo<=0x06) && (myo+0x01) & 1) m_mc6845->address_w(space, myo-0x00, data); /* Video Controller */ - if ((myo>=0x01) && (myo<=0x07) && (myo & 1)) m_mc6845->register_w(space, myo-0x01, data); - if ((myo>=0x08) && (myo<=0x0e) && (myo+0x01) & 1) if (m_acia) m_acia->control_w(space, myo-0x08, data); /* Serial controller */ - if ((myo>=0x09) && (myo<=0x0f) && (myo & 1)) if (m_acia) m_acia->data_w(space, myo-0x09, data); - if ((myo>=0x10) && (myo<=0x17)) bbc_SerialULA_w(space, myo-0x10, data); /* Serial System Chip */ - if ((myo>=0x18) && (myo<=0x1f) && (m_upd7002)) m_upd7002->write(space, myo-0x18, data); /* A to D converter */ - if ((myo>=0x20) && (myo<=0x23)) bbc_videoULA_w(space, myo-0x20, data); /* VideoULA */ - if ((myo>=0x24) && (myo<=0x27) && (m_wd1770)) bbcm_wd1770l_write(space, myo-0x24, data); /* disc control latch */ - if ((myo>=0x28) && (myo<=0x2f) && (m_wd1770)) m_wd1770->write(space, myo-0x28, data); /* 1770 Controller */ - if ((myo>=0x24) && (myo<=0x27) && (m_wd1772)) bbcm_wd1772l_write(space, myo-0x24, data); /* disc control latch */ - if ((myo>=0x28) && (myo<=0x2f) && (m_wd1772)) m_wd1772->write(space, myo-0x28, data); /* 1772 Controller */ - if ((myo>=0x30) && (myo<=0x33)) page_selectbm_w(space, myo-0x30, data); /* ROMSEL */ - if ((myo>=0x34) && (myo<=0x37)) bbcm_ACCCON_write(space, myo-0x34, data); /* ACCCON */ - //if ((myo>=0x38) && (myo<=0x3f)) /* NC ?? */ - if ((myo>=0x40) && (myo<=0x5f)) m_via6522_0->write(space, myo-0x40, data); - if ((myo>=0x60) && (myo<=0x7f) && (m_via6522_1)) m_via6522_1->write(space, myo-0x60, data); - //if ((myo>=0x80) && (myo<=0x9f)) - if ((myo>=0xa0) && (myo<=0xbf) && (m_adlc)) m_adlc->write(space, myo & 0x03, data); - //if ((myo>=0xc0) && (myo<=0xdf)) - //if ((myo>=0xe0) && (myo<=0xff)) - } -} - - -/****************************************************************************** - -System VIA 6522 - -PA0-PA7 -Port A forms a slow data bus to the keyboard sound and speech processors -PortA Keyboard -D0 Pin 8 -D1 Pin 9 -D2 Pin 10 -D3 Pin 11 -D4 Pin 5 -D5 Pin 6 -D6 Pin 7 -D7 Pin 12 - -PB0-PB2 outputs ---------------- -These 3 outputs form the address to an 8 bit addressable latch. -(IC32 74LS259) - -PB3 output ----------- -This output holds the data to be written to the selected -addressable latch bit. - -PB4 and PB5 inputs ------------------- -These are the inputs from the joystick FIRE buttons. They are -normally at logic 1 with no button pressed and change to 0 -when a button is pressed. - -PB6 and PB7 inputs from the speech processor (model B and B+) -------------------------------------------------------------- -PB6 is the speech processor 'ready' output and PB7 is from the -speech processor 'interrupt' output. - -PB6 and PB7 outputs to Master CMOS RAM/RTC ------------------------------------------- -PB6 operates the 146818 chip enable when set to '1'. PB7 operates -the 146818 address strobe line. - -CA1 input ---------- -This is the vertical sync input from the 6845. CA1 is set up to -interrupt the 6502 every 20ms (50Hz) as a vertical sync from -the video circuitry is detected. The operation system changes -the display flash colours on this interrupt so that they occur -during the screen blanking period. ----------------------------------------------------------------- -This is required for a lot of time function within the machine -and must be triggered every 20ms. (Should check at some point -how this 20ms signal is made, and see if none standard shaped -screen modes change this time period.) - -CB1 input ---------- -The CB1 input is the end of conversion (EOC) signal from the -7002 analogue to digital converter. It can be used to interrupt -the 6502 whenever a conversion is complete. - -CA2 input ---------- -This input comes from the keyboard circuit, and is used to -generate an interrupt whenever a key is pressed. See the -keyboard circuit section for more details. - -CB2 input ---------- -This is the light pen strobe signal (LPSTB) from the light pen. -If also connects to the 6845 video processor, -CB2 can be programmed to interrupt the processor whenever -a light pen strobe occurs. ----------------------------------------------------------------- -CB2 is not needed in the initial emulation -and should be set to logic low, should be mapped through to -a light pen emulator later. - -IRQ output -This connects to the IRQ line of the 6502 - - -The addressable latch -This 8 bit addressable latch is operated from port B lines 0-3. -PB0-PB2 are set to the required address of the output bit to be set. -PB3 is set to the value which should be programmed at that bit. -The function of the 8 output bits from this latch are:- - -B0 - Write Enable to the sound generator IC -B1 - READ select on the speech processor -B2 - WRITE select on the speech processor -B3 - Keyboard write enable -B4,B5 - these two outputs define the number to be added to the -start of screen address in hardware to control hardware scrolling:- -Mode Size Start of screen Number to add B5 B4 -0,1,2 20K &3000 12K 1 1 -3 16K &4000 16K 0 0 -4,5 10K &5800 (or &1800) 22K 1 0 -6 8K &6000 (or &2000) 24K 0 1 -B6 - Operates the CAPS lock LED (Pin 17 keyboard connector) -B7 - Operates the SHIFT lock LED (Pin 16 keyboard connector) -******************************************************************************/ - - -INTERRUPT_GEN_MEMBER(bbc_state::bbcb_keyscan) -{ - static const char *const colnames[] = { - "COL0", "COL1", "COL2", "COL3", "COL4", - "COL5", "COL6", "COL7", "COL8", "COL9", - "COL10", "COL11", "COL12" - }; - - /* only do auto scan if keyboard is not enabled */ - if (m_b3_keyboard == 1) - { - /* KBD IC1 4 bit addressable counter */ - /* KBD IC3 4 to 10 line decoder */ - /* keyboard not enabled so increment counter */ - m_column = (m_column + 1) % 16; - - if (m_column < 13) - { - /* KBD IC4 8 input NAND gate */ - /* set the value of via_system ca2, by checking for any keys - being pressed on the selected m_column */ - if ((ioport(colnames[m_column])->read() | 0x01) != 0xff) - { - m_via6522_0->write_ca2(1); - } - else - { - m_via6522_0->write_ca2(0); - } - } - else - { - m_via6522_0->write_ca2(0); - } - } -} - - -int bbc_state::bbc_keyboard(address_space &space, int data) -{ - int bit; - int row; - int res; - static const char *const colnames[] = { - "COL0", "COL1", "COL2", "COL3", "COL4", - "COL5", "COL6", "COL7", "COL8", "COL9", - "COL10", "COL11", "COL12" - }; - - m_column = data & 0x0f; - row = (data>>4) & 0x07; - - bit = 0; - - if (m_column < 13) - { - res = ioport(colnames[m_column])->read(); - } - else - { - res = 0xff; - } - - /* Normal keyboard result */ - if ((res & (1<write_ca2(1); - } - else - { - m_via6522_0->write_ca2(0); - } - - return (data & 0x7f) | (bit<<7); -} - - -void bbc_state::bbcb_IC32_initialise(bbc_state *state) -{ - m_b0_sound=0x01; // Write Enable to the sound generator IC - m_b1_speech_read=0x01; // READ select on the speech processor - m_b2_speech_write=0x01; // WRITE select on the speech processor - m_b3_keyboard=0x01; // Keyboard write enable - m_b4_video0=0x01; // These two outputs define the number to be added to the start of screen address - m_b5_video1=0x01; // in hardware to control hardware scrolling - m_b6_caps_lock_led=0x01; // Operates the CAPS lock LED - m_b7_shift_lock_led=0x01; // Operates the SHIFT lock LED -} - - -/* This the BBC Masters Real Time Clock and NVRAM IC */ -void bbc_state::MC146818_set(address_space &space) -{ - //logerror ("146181 WR=%d DS=%d AS=%d CE=%d \n",m_MC146818_WR,m_MC146818_DS,m_MC146818_AS,m_MC146818_CE); - //mc146818_device *rtc = space.machine().device("rtc"); - - // if chip enabled - if (m_MC146818_CE) - { - // if data select is set then access the data in the 146818 - if (m_MC146818_DS) - { - if (m_MC146818_WR) - { - m_via_system_porta = m_rtc->read(space, 1); - //logerror("read 146818 data %d \n",m_via_system_porta); - } - else - { - m_rtc->write(space, 1, m_via_system_porta); - //logerror("write 146818 data %d \n",m_via_system_porta); - } - } - - // if address select is set then set the address in the 146818 - if (m_MC146818_AS) - { - m_rtc->write(space, 0, m_via_system_porta); - //logerror("write 146818 address %d \n",m_via_system_porta); - } - } -} - - -WRITE8_MEMBER(bbc_state::bbcb_via_system_write_porta) -{ - //logerror("SYSTEM write porta %d\n",data); - - m_via_system_porta = data; - if (m_b0_sound == 0) - { - //logerror("Doing an unsafe write to the sound chip %d \n",data); - if (m_sn) m_sn->write(space, 0, m_via_system_porta); - } - if (m_b1_speech_read == 0) - { - if (m_tms) m_via_system_porta = m_tms->status_r(space, 0); - //logerror("Doing an unsafe read to the speech chip %d \n",m_via_system_porta); - } - if (m_b2_speech_write == 0) - { - //logerror("Doing an unsafe write to the speech chip %d \n",data); - if (m_tms) m_tms->data_w(space, 0, m_via_system_porta); - } - if (m_b3_keyboard == 0) - { - //logerror("Doing an unsafe write to the keyboard %d \n",data); - m_via_system_porta = bbc_keyboard(space, m_via_system_porta); - } - if (m_rtc) MC146818_set(space); -} - - -WRITE8_MEMBER(bbc_state::bbcb_via_system_write_portb) -{ - int bit, value; - bit = data & 0x07; - value = (data >> 3) & 0x01; - - //logerror("SYSTEM write portb %d %d %d\n",data,bit,value); - - if (value) - { - switch (bit) - { - case 0: - if (m_b0_sound == 0) - { - m_b0_sound = 1; - } - break; - case 1: - if (m_rtc && m_MC146818_WR == 0) - { - /* BBC Master has NVRAM Here */ - m_MC146818_WR = 1; - MC146818_set(space); - } - else - { - if (m_b1_speech_read == 0) - { - /* VSP TMS 5220 */ - m_b1_speech_read = 1; - //logerror("Speech read select TRUE\n"); - if (m_tms) m_tms->rsq_w(TRUE); - } - } - break; - case 2: - if (m_rtc && m_MC146818_DS == 0) - { - /* BBC Master has NVRAM Here */ - m_MC146818_DS = 1; - MC146818_set(space); - } - else - { - if (m_b2_speech_write == 0) - { - /* VSP TMS 5220 */ - m_b2_speech_write = 1; - //logerror("Speech write select TRUE\n"); - if (m_tms) m_tms->wsq_w(TRUE); - } - } - break; - case 3: - if (m_b3_keyboard == 0) - { - m_b3_keyboard = 1; - } - break; - case 4: - if (m_b4_video0 == 0) - { - m_b4_video0 = 1; - } - break; - case 5: - if (m_b5_video1 == 0) - { - m_b5_video1 = 1; - } - break; - case 6: - if (m_b6_caps_lock_led == 0) - { - m_b6_caps_lock_led = 1; - /* call caps lock led update */ - output_set_value("capslock_led", m_b6_caps_lock_led); - } - break; - case 7: - if (m_b7_shift_lock_led == 0) - { - m_b7_shift_lock_led = 1; - /* call shift lock led update */ - output_set_value("shiftlock_led", m_b7_shift_lock_led); - } - break; - } - } - else - { - switch (bit) - { - case 0: - if (m_b0_sound == 1) - { - m_b0_sound = 0; - if (m_sn) m_sn->write(space, 0, m_via_system_porta); - } - break; - case 1: - if (m_rtc && m_MC146818_WR == 1) - { - /* BBC Master has NVRAM Here */ - m_MC146818_WR = 0; - MC146818_set(space); - } - else - { - if (m_b1_speech_read == 1) - { - /* VSP TMS 5220 */ - m_b1_speech_read = 0; - //logerror("Speech read select FALSE\n"); - if (m_tms) m_tms->rsq_w(FALSE); - } - } - break; - case 2: - if (m_rtc && m_MC146818_DS == 1) - { - /* BBC Master has NVRAM Here */ - m_MC146818_DS = 0; - MC146818_set(space); - } - else - { - if (m_b2_speech_write == 1) - { - /* VSP TMS 5220 */ - m_b2_speech_write = 0; - //logerror("Speech write select FALSE\n"); - if (m_tms) m_tms->wsq_w(FALSE); - } - } - break; - case 3: - if (m_b3_keyboard == 1) - { - m_b3_keyboard = 0; - /* *** call keyboard enabled *** */ - m_via_system_porta = bbc_keyboard(space, m_via_system_porta); - } - break; - case 4: - if (m_b4_video0 == 1) - { - m_b4_video0 = 0; - } - break; - case 5: - if (m_b5_video1 == 1) - { - m_b5_video1 = 0; - } - break; - case 6: - if (m_b6_caps_lock_led == 1) - { - m_b6_caps_lock_led = 0; - /* call caps lock led update */ - output_set_value("capslock_led", m_b6_caps_lock_led); - } - break; - case 7: - if (m_b7_shift_lock_led == 1) - { - m_b7_shift_lock_led = 0; - /* call shift lock led update */ - output_set_value("shiftlock_led", m_b7_shift_lock_led); - } - break; - } - } - - - if (m_rtc) - { - //set the Address Select - if (m_MC146818_AS != ((data>>7)&1)) - { - m_MC146818_AS=(data>>7)&1; - MC146818_set(space); - } - - //if CE changes - if (m_MC146818_CE != ((data>>6)&1)) - { - m_MC146818_CE=(data>>6)&1; - MC146818_set(space); - } - } -} - - -READ8_MEMBER(bbc_state::bbcb_via_system_read_porta) -{ - //logerror("SYSTEM read porta %d\n",m_via_system_porta); - return m_via_system_porta; -} - - -READ8_MEMBER(bbc_state::bbcb_via_system_read_portb) -{ - // D4 of portb is joystick fire button 1 - // D5 of portb is joystick fire button 2 - // D6 VSPINT - // D7 VSPRDY - int TMSint = m_tms ? m_tms->intq_r() : 0; - int TMSrdy = m_tms ? m_tms->readyq_r() : 0; - //logerror("TMSint %d\n",TMSint); - //logerror("TMSrdy %d\n",TMSrdy); - return (0xf | ioport("IN0")->read() | (!TMSrdy << 7) | (!TMSint << 6)); -} - - -WRITE_LINE_MEMBER(bbc_state::bbcb_via_system_irq_w) -{ - m_via_system_irq = state; - - check_interrupts(); -} - -/********************************************************************** -USER VIA -Port A output is buffered before being connected to the printer connector. -This means that they can only be operated as output lines. -CA1 is pulled high by a 4K7 resistor. CA1 normally acts as an acknowledge -line when a printer is used. CA2 is buffered so that it has become an open -collector output only. It usually acts as the printer strobe line. -***********************************************************************/ - -/* USER VIA 6522 port B is connected to the BBC user port */ -READ8_MEMBER(bbc_state::bbcb_via_user_read_portb) -{ - return 0xff; -} - -WRITE8_MEMBER(bbc_state::bbcb_via_user_write_portb) -{ - m_userport = data; -} - -WRITE_LINE_MEMBER(bbc_state::bbcb_via_user_irq_w) -{ - m_via_user_irq = state; - - check_interrupts(); -} - - -/************************************** -BBC Joystick Support -**************************************/ - -UPD7002_GET_ANALOGUE(bbc_state::BBC_get_analogue_input) -{ - switch (channel_number) - { - case 0: - return ((0xff - m_joy0->read()) << 8); - case 1: - return ((0xff - m_joy1->read()) << 8); - case 2: - return ((0xff - m_joy2->read()) << 8); - case 3: - return ((0xff - m_joy3->read()) << 8); - } - - return 0; -} - -UPD7002_EOC(bbc_state::BBC_uPD7002_EOC) -{ - m_via6522_0->write_cb1(data); -} - -/*************************************** - BBC 2C199 Serial Interface Cassette -****************************************/ - - -void bbc_state::MC6850_Receive_Clock(int new_clock) -{ - m_rxd_cass = new_clock; - update_acia_rxd(); - - // - // Somehow the "serial processor" generates 16 clock signals towards - // the 6850. Exact details are unknown, faking it with the following - // loop. - // - for (int i = 0; i < 16; i++ ) - { - m_acia->write_rxc(1); - m_acia->write_rxc(0); - } -} - -TIMER_CALLBACK_MEMBER(bbc_state::bbc_tape_timer_cb) -{ - if ( m_cass_out_enabled ) - { - // 0 = 18-18 18-17-1 - // 1 = 9-9-9-9 9-9-9-8-1 - - switch ( m_cass_out_samples_to_go ) - { - case 0: - if ( m_cass_out_phase == 0 ) - { - // get bit value - m_cass_out_bit = m_txd; - if ( m_cass_out_bit ) - { - m_cass_out_phase = 3; - m_cass_out_samples_to_go = 9; - } - else - { - m_cass_out_phase = 1; - m_cass_out_samples_to_go = 18; - } - m_cassette->output( +1.0 ); - } - else - { - // switch phase - m_cass_out_phase--; - m_cass_out_samples_to_go = m_cass_out_bit ? 9 : 18; - m_cassette->output( ( m_cass_out_phase & 1 ) ? +1.0 : -1.0 ); - } - break; - case 1: - if ( m_cass_out_phase == 0 ) - { - m_cassette->output( 0.0 ); - } - break; - } - - m_cass_out_samples_to_go--; - } - else - { - double dev_val = m_cassette->input(); - - // look for edges on the cassette wave - if (((dev_val>=0.0) && (m_last_dev_val<0.0)) || ((dev_val<0.0) && (m_last_dev_val>=0.0))) - { - if (m_wav_len>(9*3)) - { - //this is too long to receive anything so reset the serial IC. This is a hack, this should be done as a timer in the MC6850 code. - logerror ("Cassette length %d\n",m_wav_len); - m_nr_high_tones = 0; - m_dcd_cass = 0; - update_acia_dcd(); - m_len0=0; - m_len1=0; - m_len2=0; - m_len3=0; - m_wav_len=0; - } - - m_len3=m_len2; - m_len2=m_len1; - m_len1=m_len0; - m_len0=m_wav_len; - - m_wav_len=0; - logerror ("cassette %d %d %d %d\n",m_len3,m_len2,m_len1,m_len0); - - if ((m_len0+m_len1)>=(18+18-5)) - { - /* Clock a 0 onto the serial line */ - logerror("Serial value 0\n"); - m_nr_high_tones = 0; - m_dcd_cass = 0; - update_acia_dcd(); - MC6850_Receive_Clock(0); - m_len0=0; - m_len1=0; - m_len2=0; - m_len3=0; - } - - if (((m_len0+m_len1+m_len2+m_len3)<=41) && (m_len3!=0)) - { - /* Clock a 1 onto the serial line */ - logerror("Serial value 1\n"); - m_nr_high_tones++; - if ( m_nr_high_tones > 100 ) - { - m_dcd_cass = 1; - update_acia_dcd(); - } - MC6850_Receive_Clock(1); - m_len0=0; - m_len1=0; - m_len2=0; - m_len3=0; - } - } - - m_wav_len++; - m_last_dev_val=dev_val; - } -} - -WRITE_LINE_MEMBER( bbc_state::write_rxd_serial ) -{ - m_rxd_serial = state; - update_acia_rxd(); -} - -void bbc_state::update_acia_rxd() -{ - m_acia->write_rxd(( m_serproc_data & 0x40 ) ? m_rxd_serial : m_rxd_cass); -} - - -WRITE_LINE_MEMBER( bbc_state::write_dcd_serial ) -{ - m_dcd_serial = state; - update_acia_dcd(); -} - -void bbc_state::update_acia_dcd() -{ - m_acia->write_dcd(( m_serproc_data & 0x40 ) ? m_dcd_serial : m_dcd_cass); -} - - -WRITE_LINE_MEMBER( bbc_state::write_cts_serial ) -{ - m_cts_serial = state; - update_acia_cts(); -} - -void bbc_state::update_acia_cts() -{ - m_acia->write_cts(( m_serproc_data & 0x40 ) ? m_cts_serial : 0); -} - - -WRITE_LINE_MEMBER( bbc_state::bbc_rts_w ) -{ - if ( m_serproc_data & 0x40 ) - { - m_rs232->write_rts(state); - m_cass_out_enabled = 0; - } - else - { - m_cass_out_enabled = state ? 0 : 1; - } -} - - -WRITE_LINE_MEMBER( bbc_state::bbc_txd_w ) -{ - if ( m_serproc_data & 0x40 ) - { - m_rs232->write_txd(state); - } - else - { - m_txd = state; - } -} - - -void bbc_state::BBC_Cassette_motor(unsigned char status) -{ - if (status) - { - m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_tape_timer->adjust(attotime::zero, 0, attotime::from_hz(44100)); - } - else - { - m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - m_tape_timer->reset(); - m_len0 = 0; - m_len1 = 0; - m_len2 = 0; - m_len3 = 0; - m_wav_len = 0; - m_cass_out_phase = 0; - m_cass_out_samples_to_go = 4; - } - output_set_value("motor_led", !status); -} - - -// -// Serial processor control -// x--- ---- - Motor OFF(0)/ON(1) -// -x-- ---- - Cassette(0)/RS243 input(1) -// --xx x--- - Receive baud rate generator control -// ---- -xxx - Transmit baud rate generator control -// These possible settings apply to both the receive -// and transmit baud generator control bits: -// 000 - 16MHz / 13 / 1 - 19200 baud -// 001 - 16MHz / 13 / 16 - 1200 baud -// 010 - 16MHz / 13 / 4 - 4800 baud -// 011 - 16MHz / 13 / 128 - 150 baud -// 100 - 16MHz / 13 / 2 - 9600 baud -// 101 - 16MHz / 13 / 64 - 300 baud -// 110 - 16MHz / 13 / 8 - 2400 baud -// 110 - 16MHz / 13 / 256 - 75 baud -// -WRITE8_MEMBER(bbc_state::bbc_SerialULA_w) -{ - static const int serial_clocks[8] = - { - 1, // 000 - 16, // 001 - 4, // 010 - 128, // 011 - 2, // 100 - 64, // 101 - 8, // 110 - 256 // 111 - }; - - m_serproc_data = data; - update_acia_rxd(); - update_acia_dcd(); - update_acia_cts(); - if (m_cassette) BBC_Cassette_motor(m_serproc_data & 0x80); - - // Set transmit clock rate - m_acia_clock->set_clock_scale( (double) 1 / serial_clocks[ data & 0x07 ] ); -} - -WRITE_LINE_MEMBER(bbc_state::write_acia_clock) -{ - m_acia->write_txc(state); - - if (m_serproc_data & 0x40) - m_acia->write_rxc(state); -} - -/************************************** - i8271 disc control function -***************************************/ - - -WRITE_LINE_MEMBER(bbc_state::bbc_i8271_interrupt) -{ - /* I'm assuming that the nmi is edge triggered */ - /* a interrupt from the fdc will cause a change in line state, and - the nmi will be triggered, but when the state changes because the int - is cleared this will not cause another nmi */ - /* I'll emulate it like this to be sure */ - - if (state!=m_previous_i8271_int_state) - { - if (state) - { - /* I'll pulse it because if I used hold-line I'm not sure - it would clear - to be checked */ - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } - } - - m_previous_i8271_int_state = state; -} - -WRITE_LINE_MEMBER(bbc_state::motor_w) -{ - m_i8271->subdevice("0")->get_device()->mon_w(!state); - m_i8271->subdevice("1")->get_device()->mon_w(!state); -} - - -/************************************** - WD1770 disc control function -***************************************/ - - -/* - B/ B+ drive control: - - Bit Meaning - ----------------- - 7,6 Not used. - 5 Reset drive controller chip. (0 = reset controller, 1 = no reset) - 4 Interrupt Enable (0 = enable int, 1 = disable int) - 3 Double density select (0 = double, 1 = single). - 2 Side select (0 = side 0, 1 = side 1). - 1 Drive select 1. - 0 Drive select 0. -*/ - -/* -density select -single density is as the 8271 disc format -double density is as the 8271 disc format but with 16 sectors per track -*/ - - -/* wd177x_IRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together - wd177x_DRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together - the output of the above two NAND gates are then OR'ED together and sent to the 6502 NMI line. - DRQ and IRQ are active low outputs from wd177x. We use wd177x_DRQ_SET for DRQ = 0, - and wd177x_DRQ_CLR for DRQ = 1. Similarly wd177x_IRQ_SET for IRQ = 0 and wd177x_IRQ_CLR - for IRQ = 1. - - The above means that if IRQ or DRQ are set, a interrupt should be generated. - The nmi_enable decides if interrupts are actually triggered. - The nmi is edge triggered, and triggers on a +ve edge. -*/ - -void bbc_state::bbc_update_fdq_int(int state) -{ - int bbc_state; - - /* if drq or irq is set, and interrupt is enabled */ - if ((m_wd177x_irq_state || m_wd177x_drq_state) && (m_177x_IntEnabled)) - { - /* int trigger */ - bbc_state = 1; - } - else - { - /* do not trigger int */ - bbc_state = 0; - } - /* nmi is edge triggered, and triggers when the state goes from clear->set. - Here we are checking this transition before triggering the nmi */ - if (bbc_state != m_previous_wd177x_int_state) - { - if (bbc_state) - { - /* I'll pulse it because if I used hold-line I'm not sure - it would clear - to be checked */ - m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); - } - } - - m_previous_wd177x_int_state = bbc_state; -} - -WRITE_LINE_MEMBER(bbc_state::bbc_wd177x_intrq_w) -{ - m_wd177x_irq_state = state; - bbc_update_fdq_int(state); -} - -WRITE_LINE_MEMBER(bbc_state::bbc_wd177x_drq_w) -{ - m_wd177x_drq_state = state; - bbc_update_fdq_int(state); -} - -WRITE8_MEMBER(bbc_state::bbc_wd1770_status_w) -{ - floppy_image_device *floppy = NULL; - - m_drive_control = data; - logerror("Drive control %d \n", data); - - // bit 5: reset - if (!BIT(data, 5)) m_wd1770->reset(); - - // bit 0, 1: drive select - if (BIT(data, 0)) floppy = m_wd1770->subdevice("0")->get_device(); - if (BIT(data, 1)) floppy = m_wd1770->subdevice("1")->get_device(); - m_wd1770->set_floppy(floppy); - - // bit 2: side select - if (floppy) - floppy->ss_w(BIT(data, 2)); - - // bit 3: density - m_wd1770->dden_w(BIT(data, 3)); - - // bit 4: interrupt enable - m_177x_IntEnabled = !BIT(data, 4); -} - -/*************************************** -BBC MASTER DISC SUPPORT -***************************************/ - -READ8_MEMBER(bbc_state::bbcm_wd177xl_read) -{ - return m_drive_control; -} - -WRITE8_MEMBER(bbc_state::bbcm_wd1770l_write) -{ - floppy_image_device *floppy = NULL; - - m_drive_control = data; - //logerror("Drive control %d \n", data); - - // bit 2: reset - if (!BIT(data, 2)) m_wd1770->reset(); - - // bit 0, 1, 3: drive select - if (BIT(data, 0)) floppy = m_wd1770->subdevice("0")->get_device(); - if (BIT(data, 1)) floppy = m_wd1770->subdevice("1")->get_device(); - if (BIT(data, 3)) floppy = m_wd1770->subdevice("2")->get_device(); - m_wd1770->set_floppy(floppy); - - // bit 4: side select - if (floppy) - floppy->ss_w(BIT(data, 4)); - - // bit 5: density - m_wd1770->dden_w(BIT(data, 5)); - - m_177x_IntEnabled = 1; -} - -WRITE8_MEMBER(bbc_state::bbcm_wd1772l_write) -{ - floppy_image_device *floppy = NULL; - - m_drive_control = data; - //logerror("Drive control %d \n", data); - - // bit 2: reset - if (!BIT(data, 2)) m_wd1772->reset(); - - // bit 0, 1, 3: drive select - if (BIT(data, 0)) floppy = m_wd1772->subdevice("0")->get_device(); - if (BIT(data, 1)) floppy = m_wd1772->subdevice("1")->get_device(); - if (BIT(data, 3)) floppy = m_wd1772->subdevice("2")->get_device(); - m_wd1772->set_floppy(floppy); - - // bit 4: side select - if (floppy) - floppy->ss_w(BIT(data, 4)); - - // bit 5: density - m_wd1772->dden_w(BIT(data, 5)); - - m_177x_IntEnabled = 1; -} - -/************************************** - BBC B Rom loading functions -***************************************/ - -int bbc_state::bbc_load_cart(device_image_interface &image, generic_slot_device *slot) -{ - UINT32 size = slot->common_get_size("rom"); - - if (size != 0x2000 && size != 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - slot->common_load_rom(slot->get_rom_base(), size, "rom"); - - return IMAGE_INIT_PASS; -} - -/************************************** - BBC Master Rom loading functions -***************************************/ - -int bbc_state::bbcm_load_cart(device_image_interface &image, generic_slot_device *slot) -{ - if (image.software_entry() == NULL) - { - UINT32 filesize = image.length(); - - if (filesize != 0x8000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - slot->rom_alloc(filesize, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - image.fread(slot->get_rom_base(), filesize); - return IMAGE_INIT_PASS; - } - else - { - UINT32 size_lo = image.get_software_region_length("lorom"); - UINT32 size_hi = image.get_software_region_length("uprom"); - - if (size_lo + size_hi != 0x8000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - slot->rom_alloc(size_lo + size_hi, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - memcpy(slot->get_rom_base() + 0, image.get_software_region("uprom"), size_hi); - memcpy(slot->get_rom_base() + size_hi, image.get_software_region("lorom"), size_lo); - } - - return IMAGE_INIT_PASS; -} - - -/************************************** - Machine Initialisation functions -***************************************/ - -DRIVER_INIT_MEMBER(bbc_state,bbc) -{ - m_rxd_cass = 0; - m_nr_high_tones = 0; - m_serproc_data = 0; - m_cass_out_enabled = 0; - m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bbc_state::bbc_tape_timer_cb),this)); - - /* vertical sync pulse from video circuit */ - m_via6522_0->write_ca1(1); - - /* light pen strobe detect (not emulated) */ - m_via6522_0->write_cb2(1); -} - -// setup pointers for optional EPROMs -void bbc_state::bbc_setup_banks(memory_bank *membank, int banks, UINT32 shift, UINT32 size) -{ - std::string region_tag; - memory_region *tmp_reg; - UINT8 *eprom[4]; - if (m_exp1 && (tmp_reg = memregion(region_tag.assign(m_exp1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) - eprom[0] = tmp_reg->base() + shift; - else - eprom[0] = m_region_opt->base() + 0x0000 + shift; - if (m_exp2 && (tmp_reg = memregion(region_tag.assign(m_exp2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) - eprom[1] = tmp_reg->base() + shift; - else - eprom[1] = m_region_opt->base() + 0x4000 + shift; - if (m_exp3 && (tmp_reg = memregion(region_tag.assign(m_exp3->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) - eprom[2] = tmp_reg->base() + shift; - else - eprom[2] = m_region_opt->base() + 0x8000 + shift; - if (m_exp4 && (tmp_reg = memregion(region_tag.assign(m_exp4->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) - eprom[3] = tmp_reg->base() + shift; - else - eprom[3] = m_region_opt->base() + 0xc000 + shift; - - membank->configure_entries(0, 1, eprom[0], size); - membank->configure_entries(1, 1, eprom[1], size); - membank->configure_entries(2, 1, eprom[2], size); - membank->configure_entries(3, 1, eprom[3], size); - - if (banks > 4) - { - for (int i = 0; i < banks - 4; i++) - membank->configure_entries(i + 4, 1, m_region_opt->base() + 0x10000 + shift + i * 0x4000, size); - } -} - -void bbc_state::bbcm_setup_banks(memory_bank *membank, int banks, UINT32 shift, UINT32 size) -{ - std::string region_tag; - memory_region *tmp_reg; - UINT8 *eprom[2]; - if (m_exp1 && (tmp_reg = memregion(region_tag.assign(m_exp1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) - eprom[0] = tmp_reg->base() + shift; - else - eprom[0] = m_region_opt->base() + 0x0000 + shift; - if (m_exp2 && (tmp_reg = memregion(region_tag.assign(m_exp2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()))) - eprom[1] = tmp_reg->base() + shift; - else - eprom[1] = m_region_opt->base() + 0x8000 + shift; - - membank->configure_entries(0, 1, eprom[0], size); - membank->configure_entries(1, 1, eprom[0] + 0x4000, size); - membank->configure_entries(2, 1, eprom[1], size); - membank->configure_entries(3, 1, eprom[1] + 0x4000, size); - - if (banks > 4) - { - for (int i = 0; i < banks - 4; i++) - membank->configure_entries(i + 4, 1, m_region_opt->base() + 0x10000 + shift + i * 0x4000, size); - } -} - -MACHINE_START_MEMBER(bbc_state, bbca) -{ - bbc_setup_banks(m_bank4, 4, 0, 0x4000); -} - -MACHINE_RESET_MEMBER(bbc_state, bbca) -{ - UINT8 *RAM = m_region_maincpu->base(); - - m_bank1->set_base(RAM); - if (m_ram->size() == 32*1024) - { - /* 32K Model A */ - m_bank3->set_base(RAM + 0x4000); - m_memorySize=32; - } - else - { - /* 16K just repeat the lower 16K*/ - m_bank3->set_base(RAM); - m_memorySize=16; - } - - m_bank4->set_entry(0); - m_bank7->set_base(m_region_os->base()); /* bank 7 points at the OS rom from c000 to ffff */ - - bbcb_IC32_initialise(this); -} - -MACHINE_START_MEMBER(bbc_state, bbcb) -{ - m_mc6850_clock = 0; - m_previous_i8271_int_state=0; - m_previous_wd177x_int_state=1; - bbc_setup_banks(m_bank4, 16, 0, 0x4000); -} - -MACHINE_RESET_MEMBER(bbc_state, bbcb) -{ - UINT8 *RAM = m_region_maincpu->base(); - m_Speech = (ioport("BBCCONFIG")->read() >> 0) & 0x01; - m_SWRAMtype = (ioport("BBCCONFIG")->read() >> 3) & 0x03; - m_bank1->set_base(RAM); - m_bank3->set_base(RAM + 0x4000); - m_memorySize=32; - - m_bank4->set_entry(0); - m_bank7->set_base(m_region_os->base()); /* bank 7 points at the OS rom from c000 to ffff */ - - bbcb_IC32_initialise(this); -} - - -MACHINE_START_MEMBER(bbc_state, bbcbp) -{ - m_mc6850_clock = 0; - - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcbp_direct_handler), this)); - - bbc_setup_banks(m_bank4, 16, 0, 0x3000); - m_bank4->configure_entries(16, 1, m_region_maincpu->base() + 0x8000, 0x3000); // additional bank for paged ram - bbc_setup_banks(m_bank6, 16, 0x3000, 0x1000); -} - -MACHINE_RESET_MEMBER(bbc_state, bbcbp) -{ - m_Speech = 1; - m_bank1->set_base(m_region_maincpu->base()); - m_bank2->set_base(m_region_maincpu->base() + 0x03000); /* bank 2 screen/shadow ram from 3000 to 7fff */ - m_bank4->set_entry(0); - m_bank6->set_entry(0); - m_bank7->set_base(m_region_os->base()); /* bank 7 points at the OS rom from c000 to ffff */ - - bbcb_IC32_initialise(this); - - m_previous_wd177x_int_state=1; -} - - -MACHINE_START_MEMBER(bbc_state, bbcm) -{ - m_mc6850_clock = 0; - - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcm_direct_handler), this)); - - bbcm_setup_banks(m_bank4, 16, 0, 0x1000); - m_bank4->configure_entries(16, 1, m_region_maincpu->base() + 0x8000, 0x1000); // additional bank for paged ram - bbcm_setup_banks(m_bank5, 16, 0x1000, 0x3000); - - /* Set ROM/IO bank to point to rom */ - m_bank8->set_base(m_region_os->base() + 0x3c00); - m_maincpu->space(AS_PROGRAM).install_read_bank(0xfc00, 0xfeff, "bank8"); -} - -MACHINE_RESET_MEMBER(bbc_state, bbcm) -{ - m_bank1->set_base(m_region_maincpu->base()); /* bank 1 regular lower ram from 0000 to 2fff */ - m_bank2->set_base(m_region_maincpu->base() + 0x3000); /* bank 2 screen/shadow ram from 3000 to 7fff */ - m_bank4->set_entry(0); - m_bank5->set_entry(0); - m_bank7->set_base(m_region_os->base()); /* bank 6 OS rom of RAM from c000 to dfff */ - - bbcb_IC32_initialise(this); - - m_previous_wd177x_int_state=1; -} diff --git a/src/mess/machine/bebox.c b/src/mess/machine/bebox.c deleted file mode 100644 index d5bceceb0aa..00000000000 --- a/src/mess/machine/bebox.c +++ /dev/null @@ -1,814 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, R. Belmont -/*************************************************************************** - - machine/bebox.c - - BeBox - - Memory map: - - 00000000 - 3FFFFFFF Physical RAM - 40000000 - 7FFFFFFF Motherboard glue registers - 80000000 - 807FFFFF ISA I/O - 81000000 - BF7FFFFF PCI I/O - BFFFFFF0 - BFFFFFFF PCI/ISA interrupt acknowledge - FF000000 - FFFFFFFF ROM/flash - - In ISA space, peripherals are generally in similar places as they are on - standard PC hardware (e.g. - the keyboard is 80000060 and 80000064). The - following table shows more: - - Keyboard/Mouse (Intel 8242) 80000060, 80000064 - Real Time Clock (BQ3285) 80000070, 80000074 - IDE ATA Interface 800001F0-F7, 800003F6-7 - COM2 800002F8-F - GeekPort A/D Control 80000360-1 - GeekPort A/D Data 80000362-3 - GeekPort A/D Rate 80000364 - GeekPort OE 80000366 - Infrared Interface 80000368-A - COM3 80000380-7 - COM4 80000388-F - GeekPort D/A 80000390-3 - GeekPort GPA/GPB 80000394 - Joystick Buttons 80000397 - SuperIO Config (PReP standard) 80000398-9 - MIDI Port 1 800003A0-7 - MIDI Port 2 800003A8-F - Parallel 800003BC-E - Floppy 800003F0-7 - COM1 800003F8-F - AD1848 80000830-4 - - - Interrupt bit masks: - - bit 31 - N/A (used to set/clear masks) - bit 30 - SMI interrupt to CPU 0 (CPU 0 only) - bit 29 - SMI interrupt to CPU 1 (CPU 1 only) - bit 28 - Unused - bit 27 - COM1 (PC IRQ #4) - bit 26 - COM2 (PC IRQ #3) - bit 25 - COM3 - bit 24 - COM4 - bit 23 - MIDI1 - bit 22 - MIDI2 - bit 21 - SCSI - bit 20 - PCI Slot #1 - bit 19 - PCI Slot #2 - bit 18 - PCI Slot #3 - bit 17 - Sound - bit 16 - Keyboard (PC IRQ #1) - bit 15 - Real Time Clock (PC IRQ #8) - bit 14 - PC IRQ #5 - bit 13 - Floppy Disk (PC IRQ #6) - bit 12 - Parallel Port (PC IRQ #7) - bit 11 - PC IRQ #9 - bit 10 - PC IRQ #10 - bit 9 - PC IRQ #11 - bit 8 - Mouse (PC IRQ #12) - bit 7 - IDE (PC IRQ #14) - bit 6 - PC IRQ #15 - bit 5 - PIC8259 - bit 4 - Infrared Controller - bit 3 - Analog To Digital - bit 2 - GeekPort - bit 1 - Unused - bit 0 - Unused - - Be documentation uses PowerPC bit numbering conventions (i.e. - bit #0 is - the most significant bit) - - PCI Devices: - #0 Motorola MPC105 - #11 Intel 82378 PCI/ISA bridge - #12 NCR 53C810 SCSI - - More hardware information at http://www.netbsd.org/Ports/bebox/hardware.html - -***************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "includes/bebox.h" - -/* Components */ -#include "video/pc_vga.h" -#include "bus/lpci/cirrus.h" -#include "cpu/powerpc/ppc.h" -#include "machine/mc146818.h" -#include "machine/ataintf.h" -#include "bus/lpci/pci.h" - -#define LOG_CPUIMASK 1 -#define LOG_UART 1 -#define LOG_INTERRUPTS 1 - -/************************************* - * - * Interrupts and Motherboard Registers - * - *************************************/ - -static void bebox_mbreg32_w(UINT32 *target, UINT64 data, UINT64 mem_mask) -{ - int i; - - for (i = 1; i < 32; i++) - { - if ((data >> (63 - i)) & 1) - { - if ((data >> 63) & 1) - *target |= 0x80000000 >> i; - else - *target &= ~(0x80000000 >> i); - } - } -} - - -READ64_MEMBER(bebox_state::bebox_cpu0_imask_r ) -{ - return ((UINT64) m_cpu_imask[0]) << 32; -} - -READ64_MEMBER(bebox_state::bebox_cpu1_imask_r ) -{ - return ((UINT64) m_cpu_imask[1]) << 32; -} - -READ64_MEMBER(bebox_state::bebox_interrupt_sources_r ) -{ - return ((UINT64) m_interrupts) << 32; -} - -WRITE64_MEMBER(bebox_state::bebox_cpu0_imask_w ) -{ - UINT32 old_imask = m_cpu_imask[0]; - - bebox_mbreg32_w(&m_cpu_imask[0], data, mem_mask); - - if (old_imask != m_cpu_imask[0]) - { - if (LOG_CPUIMASK) - { - logerror("BeBox CPU #0 pc=0x%08X imask=0x%08x\n", - (unsigned) space.device().safe_pc( ), m_cpu_imask[0]); - } - bebox_update_interrupts(); - } -} - -WRITE64_MEMBER(bebox_state::bebox_cpu1_imask_w ) -{ - UINT32 old_imask = m_cpu_imask[1]; - - bebox_mbreg32_w(&m_cpu_imask[1], data, mem_mask); - - if (old_imask != m_cpu_imask[1]) - { - if (LOG_CPUIMASK) - { - logerror("BeBox CPU #1 pc=0x%08X imask=0x%08x\n", - (unsigned) space.device() .safe_pc( ), m_cpu_imask[1]); - } - bebox_update_interrupts(); - } -} - -READ64_MEMBER(bebox_state::bebox_crossproc_interrupts_r ) -{ - UINT32 result; - result = m_crossproc_interrupts; - - /* return a different result depending on which CPU is accessing this handler */ - if (&space != &m_ppc1->space(AS_PROGRAM)) - result |= 0x02000000; - else - result &= ~0x02000000; - - return ((UINT64) result) << 32; -} - -WRITE64_MEMBER(bebox_state::bebox_crossproc_interrupts_w ) -{ - static const struct - { - UINT32 mask; - int cpunum; - int active_high; - int inputline; - } crossproc_map[] = - { - { 0x40000000, 0, 1, 0/*PPC_INPUT_LINE_SMI*/ }, - { 0x20000000, 1, 1, 0/*PPC_INPUT_LINE_SMI*/ }, - { 0x08000000, 0, 0, 0/*PPC_INPUT_LINE_TLBISYNC*/ }, - { 0x04000000, 1, 0, 0/*PPC_INPUT_LINE_TLBISYNC*/ } - }; - int i, line; - UINT32 old_crossproc_interrupts = m_crossproc_interrupts; - cpu_device *cpus[] = { m_ppc1, m_ppc2 }; - - bebox_mbreg32_w(&m_crossproc_interrupts, data, mem_mask); - - for (i = 0; i < ARRAY_LENGTH(crossproc_map); i++) - { - if ((old_crossproc_interrupts ^ m_crossproc_interrupts) & crossproc_map[i].mask) - { - if (m_crossproc_interrupts & crossproc_map[i].mask) - line = crossproc_map[i].active_high ? ASSERT_LINE : CLEAR_LINE; - else - line = crossproc_map[i].active_high ? CLEAR_LINE : ASSERT_LINE; - - if (LOG_INTERRUPTS) - { -/* - logerror("bebox_crossproc_interrupts_w(): CPU #%d %s %s\n", - crossproc_map[i].cpunum, line ? "Asserting" : "Clearing", - (crossproc_map[i].inputline == PPC_INPUT_LINE_SMI) ? "SMI" : "TLBISYNC"); - */ - } - - cpus[crossproc_map[i].cpunum]->set_input_line(crossproc_map[i].inputline, line); - } - } -} - -WRITE64_MEMBER(bebox_state::bebox_processor_resets_w ) -{ - UINT8 b = (UINT8) (data >> 56); - - if (b & 0x20) - { - m_ppc2->set_input_line(INPUT_LINE_RESET, (b & 0x80) ? CLEAR_LINE : ASSERT_LINE); - } -} - - -void bebox_state::bebox_update_interrupts() -{ - UINT32 interrupt; - cpu_device *cpus[] = { m_ppc1, m_ppc2 }; - - for (int cpunum = 0; cpunum < 2; cpunum++) - { - interrupt = m_interrupts & m_cpu_imask[cpunum]; - - if (LOG_INTERRUPTS) - { - logerror("\tbebox_update_interrupts(): CPU #%d [%08X|%08X] IRQ %s\n", cpunum, - m_interrupts, m_cpu_imask[cpunum], interrupt ? "on" : "off"); - } - - cpus[cpunum]->set_input_line(INPUT_LINE_IRQ0, interrupt ? ASSERT_LINE : CLEAR_LINE); - } -} - - -void bebox_state::bebox_set_irq_bit(unsigned int interrupt_bit, int val) -{ - static const char *const interrupt_names[32] = - { - NULL, - NULL, - "GEEKPORT", - "ADC", - "IR", - "PIC8259", - "PCIRQ 15", - "IDE", - "MOUSE", - "PCIRQ 11", - "PCIRQ 10", - "PCIRQ 9", - "PARALLEL", - "FLOPPY", - "PCIRQ 5", - "RTC", - "KEYBOARD", - "SOUND", - "PCI3", - "PCI2", - "PCI1", - "SCSI", - "MIDI2", - "MIDI1", - "COM4", - "COM3", - "COM2", - "COM1", - NULL, - "SMI1", - "SMI0", - NULL - }; - UINT32 old_interrupts; - - if (LOG_INTERRUPTS) - { - /* make sure that we don't shoot ourself in the foot */ - assert_always((interrupt_bit < ARRAY_LENGTH(interrupt_names)) && (interrupt_names[interrupt_bit] != NULL), "Raising invalid interrupt"); - - logerror("bebox_set_irq_bit(): pc[0]=0x%08x pc[1]=0x%08x %s interrupt #%u (%s)\n", - (unsigned) m_ppc1->pc(), - (unsigned) m_ppc2->pc(), - val ? "Asserting" : "Clearing", - interrupt_bit, interrupt_names[interrupt_bit]); - } - - old_interrupts = m_interrupts; - if (val) - m_interrupts |= 1 << interrupt_bit; - else - m_interrupts &= ~(1 << interrupt_bit); - - /* if interrupt values have changed, update the lines */ - if (m_interrupts != old_interrupts) - bebox_update_interrupts(); -} - -/************************************* - * - * Floppy Disk Controller - * - *************************************/ - -WRITE_LINE_MEMBER( bebox_state::fdc_interrupt ) -{ - bebox_set_irq_bit(13, state); - m_pic8259_1->ir6_w(state); -} - -/************************************* - * - * 8259 PIC - * - *************************************/ - -READ64_MEMBER(bebox_state::bebox_interrupt_ack_r ) -{ - UINT32 result; - result = m_pic8259_1->acknowledge(); - bebox_set_irq_bit(5, 0); /* HACK */ - return ((UINT64) result) << 56; -} - - -/************************************************************* - * - * pic8259 configuration - * - *************************************************************/ - -WRITE_LINE_MEMBER(bebox_state::bebox_pic8259_master_set_int_line) -{ - bebox_set_irq_bit(5, state); -} - -WRITE_LINE_MEMBER(bebox_state::bebox_pic8259_slave_set_int_line) -{ - m_pic8259_1->ir2_w(state); -} - -READ8_MEMBER(bebox_state::get_slave_ack) -{ - return m_pic8259_2->acknowledge(); -} - - -/************************************* - * - * Floppy/IDE/ATA - * - *************************************/ - -WRITE_LINE_MEMBER(bebox_state::bebox_ide_interrupt) -{ - bebox_set_irq_bit(7, state); - m_pic8259_1->ir6_w(state); -} - - -/************************************* - * - * Video card (Cirrus Logic CL-GD5430) - * - *************************************/ -/* -static READ64_MEMBER(bebox_state::bebox_video_r ) -{ - UINT64 result = 0; - mem_mask = FLIPENDIAN_INT64(mem_mask); - if (ACCESSING_BITS_0_7) - result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 0, mem_mask >> 0) << 0; - if (ACCESSING_BITS_8_15) - result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 1, mem_mask >> 8) << 8; - if (ACCESSING_BITS_16_23) - result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 2, mem_mask >> 16) << 16; - if (ACCESSING_BITS_24_31) - result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 3, mem_mask >> 24) << 24; - if (ACCESSING_BITS_32_39) - result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 4, mem_mask >> 32) << 32; - if (ACCESSING_BITS_40_47) - result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 5, mem_mask >> 40) << 40; - if (ACCESSING_BITS_48_55) - result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 6, mem_mask >> 48) << 48; - if (ACCESSING_BITS_56_63) - result |= (UINT64)vga_mem_linear_r(space, offset * 8 + 7, mem_mask >> 56) << 56; - return FLIPENDIAN_INT64(result); -} - - -static WRITE64_MEMBER(bebox_state::bebox_video_w ) -{ - data = FLIPENDIAN_INT64(data); - mem_mask = FLIPENDIAN_INT64(mem_mask); - if (ACCESSING_BITS_0_7) - vga_mem_linear_w(space, offset * 8 + 0, data >> 0 , mem_mask >> 0); - if (ACCESSING_BITS_8_15) - vga_mem_linear_w(space, offset * 8 + 1, data >> 8 , mem_mask >> 8); - if (ACCESSING_BITS_16_23) - vga_mem_linear_w(space, offset * 8 + 2, data >> 16, mem_mask >> 16); - if (ACCESSING_BITS_24_31) - vga_mem_linear_w(space, offset * 8 + 3, data >> 24, mem_mask >> 24); - if (ACCESSING_BITS_32_39) - vga_mem_linear_w(space, offset * 8 + 4, data >> 32, mem_mask >> 32); - if (ACCESSING_BITS_40_47) - vga_mem_linear_w(space, offset * 8 + 5, data >> 40, mem_mask >> 40); - if (ACCESSING_BITS_48_55) - vga_mem_linear_w(space, offset * 8 + 6, data >> 48, mem_mask >> 48); - if (ACCESSING_BITS_56_63) - vga_mem_linear_w(space, offset * 8 + 7, data >> 56, mem_mask >> 56); -} -*/ -/************************************* - * - * 8237 DMA - * - *************************************/ - - -READ8_MEMBER(bebox_state::bebox_page_r) -{ - UINT8 data = m_at_pages[offset % 0x10]; - - switch(offset % 8) - { - case 1: - data = m_dma_offset[(offset / 8) & 1][2]; - break; - case 2: - data = m_dma_offset[(offset / 8) & 1][3]; - break; - case 3: - data = m_dma_offset[(offset / 8) & 1][1]; - break; - case 7: - data = m_dma_offset[(offset / 8) & 1][0]; - break; - } - return data; -} - - -WRITE8_MEMBER(bebox_state::bebox_page_w) -{ - m_at_pages[offset % 0x10] = data; - - switch(offset % 8) - { - case 1: - m_dma_offset[(offset / 8) & 1][2] &= 0xFF00; - m_dma_offset[(offset / 8) & 1][2] |= ((UINT16 ) data) << 0; - break; - case 2: - m_dma_offset[(offset / 8) & 1][3] &= 0xFF00; - m_dma_offset[(offset / 8) & 1][3] |= ((UINT16 ) data) << 0; - break; - case 3: - m_dma_offset[(offset / 8) & 1][1] &= 0xFF00; - m_dma_offset[(offset / 8) & 1][1] |= ((UINT16 ) data) << 0; - break; - case 7: - m_dma_offset[(offset / 8) & 1][0] &= 0xFF00; - m_dma_offset[(offset / 8) & 1][0] |= ((UINT16 ) data) << 0; - break; - } -} - - -WRITE8_MEMBER(bebox_state::bebox_80000480_w) -{ - switch(offset % 8) - { - case 1: - m_dma_offset[(offset / 8) & 1][2] &= 0x00FF; - m_dma_offset[(offset / 8) & 1][2] |= ((UINT16 ) data) << 8; - break; - case 2: - m_dma_offset[(offset / 8) & 1][3] &= 0x00FF; - m_dma_offset[(offset / 8) & 1][3] |= ((UINT16 ) data) << 8; - break; - case 3: - m_dma_offset[(offset / 8) & 1][1] &= 0x00FF; - m_dma_offset[(offset / 8) & 1][1] |= ((UINT16 ) data) << 8; - break; - case 7: - m_dma_offset[(offset / 8) & 1][0] &= 0x00FF; - m_dma_offset[(offset / 8) & 1][0] |= ((UINT16 ) data) << 8; - break; - } -} - - -READ8_MEMBER(bebox_state::bebox_80000480_r) -{ - fatalerror("NYI\n"); -} - - -WRITE_LINE_MEMBER(bebox_state::bebox_dma_hrq_changed) -{ - m_ppc1->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - /* Assert HLDA */ - m_dma8237_1->hack_w( state ); -} - - -READ8_MEMBER(bebox_state::bebox_dma_read_byte ) -{ - address_space& prog_space = m_ppc1->space(AS_PROGRAM); // get the right address space - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) - & 0x7FFF0000; - return prog_space.read_byte(page_offset + offset); -} - - -WRITE8_MEMBER(bebox_state::bebox_dma_write_byte ) -{ - address_space& prog_space = m_ppc1->space(AS_PROGRAM); // get the right address space - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) - & 0x7FFF0000; - prog_space.write_byte(page_offset + offset, data); -} - - -READ8_MEMBER(bebox_state::bebox_dma8237_fdc_dack_r){ - return m_smc37c78->dma_r(); -} - - -WRITE8_MEMBER(bebox_state::bebox_dma8237_fdc_dack_w){ - m_smc37c78->dma_w(data); -} - - -WRITE_LINE_MEMBER(bebox_state::bebox_dma8237_out_eop){ - m_smc37c78->tc_w(state); -} - -static void set_dma_channel(running_machine &machine, int channel, int state) -{ - bebox_state *drvstate = machine.driver_data(); - if (!state) drvstate->m_dma_channel = channel; -} - -WRITE_LINE_MEMBER(bebox_state::pc_dack0_w){ set_dma_channel(machine(), 0, state); } -WRITE_LINE_MEMBER(bebox_state::pc_dack1_w){ set_dma_channel(machine(), 1, state); } -WRITE_LINE_MEMBER(bebox_state::pc_dack2_w){ set_dma_channel(machine(), 2, state); } -WRITE_LINE_MEMBER(bebox_state::pc_dack3_w){ set_dma_channel(machine(), 3, state); } - -/************************************* - * - * 8254 PIT - * - *************************************/ - -WRITE_LINE_MEMBER(bebox_state::bebox_timer0_w) -{ - m_pic8259_1->ir0_w(state); -} - - -/************************************* - * - * Flash ROM - * - *************************************/ - -READ8_MEMBER(bebox_state::bebox_flash_r ) -{ - offset = (offset & ~7) | (7 - (offset & 7)); - return m_flash->read(offset); -} - - -WRITE8_MEMBER(bebox_state::bebox_flash_w ) -{ - offset = (offset & ~7) | (7 - (offset & 7)); - m_flash->write(offset, data); -} - -/************************************* - * - * SCSI - * - *************************************/ - - -READ64_MEMBER(bebox_state::scsi53c810_r ) -{ - int reg = offset*8; - UINT64 r = 0; - if (!(mem_mask & U64(0xff00000000000000))) { - r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+0) << 56; - } - if (!(mem_mask & U64(0x00ff000000000000))) { - r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+1) << 48; - } - if (!(mem_mask & U64(0x0000ff0000000000))) { - r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+2) << 40; - } - if (!(mem_mask & U64(0x000000ff00000000))) { - r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+3) << 32; - } - if (!(mem_mask & U64(0x00000000ff000000))) { - r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+4) << 24; - } - if (!(mem_mask & U64(0x0000000000ff0000))) { - r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+5) << 16; - } - if (!(mem_mask & U64(0x000000000000ff00))) { - r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+6) << 8; - } - if (!(mem_mask & U64(0x00000000000000ff))) { - r |= (UINT64)m_lsi53c810->lsi53c810_reg_r(reg+7) << 0; - } - - return r; -} - - -WRITE64_MEMBER(bebox_state::scsi53c810_w ) -{ - int reg = offset*8; - if (!(mem_mask & U64(0xff00000000000000))) { - m_lsi53c810->lsi53c810_reg_w(reg+0, data >> 56); - } - if (!(mem_mask & U64(0x00ff000000000000))) { - m_lsi53c810->lsi53c810_reg_w(reg+1, data >> 48); - } - if (!(mem_mask & U64(0x0000ff0000000000))) { - m_lsi53c810->lsi53c810_reg_w(reg+2, data >> 40); - } - if (!(mem_mask & U64(0x000000ff00000000))) { - m_lsi53c810->lsi53c810_reg_w(reg+3, data >> 32); - } - if (!(mem_mask & U64(0x00000000ff000000))) { - m_lsi53c810->lsi53c810_reg_w(reg+4, data >> 24); - } - if (!(mem_mask & U64(0x0000000000ff0000))) { - m_lsi53c810->lsi53c810_reg_w(reg+5, data >> 16); - } - if (!(mem_mask & U64(0x000000000000ff00))) { - m_lsi53c810->lsi53c810_reg_w(reg+6, data >> 8); - } - if (!(mem_mask & U64(0x00000000000000ff))) { - m_lsi53c810->lsi53c810_reg_w(reg+7, data >> 0); - } -} - - -UINT32 scsi53c810_pci_read(device_t *busdevice, device_t *device, int function, int offset, UINT32 mem_mask) -{ - bebox_state *state = device->machine().driver_data(); - UINT32 result = 0; - - if (function == 0) - { - switch(offset) - { - case 0x00: /* vendor/device ID */ - result = 0x00011000; - break; - - case 0x08: - result = 0x01000000; - break; - - default: - result = state->m_scsi53c810_data[offset / 4]; - break; - } - } - return result; -} - - -void scsi53c810_pci_write(device_t *busdevice, device_t *device, int function, int offset, UINT32 data, UINT32 mem_mask) -{ - bebox_state *state = device->machine().driver_data(); - offs_t addr; - - if (function == 0) - { - state->m_scsi53c810_data[offset / 4] = data; - - switch(offset) - { - case 0x04: - /* command - * - * bit 8: SERR/ Enable - * bit 6: Enable Parity Response - * bit 4: Write and Invalidate Mode - * bit 2: Enable Bus Mastering - * bit 1: Enable Memory Space - * bit 0: Enable IO Space - */ - if (data & 0x02) - { - /* brutal ugly hack; at some point the PCI code should be handling this stuff */ - if (state->m_scsi53c810_data[5] != 0xFFFFFFF0) - { - address_space &space = state->m_ppc1->space(AS_PROGRAM); - - addr = (state->m_scsi53c810_data[5] | 0xC0000000) & ~0xFF; - space.install_readwrite_handler(addr, addr + 0xFF, read64_delegate(FUNC(bebox_state::scsi53c810_r),state), write64_delegate(FUNC(bebox_state::scsi53c810_w),state)); - } - } - break; - } - } -} - - -void bebox_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_GET_DEVICES: - break; - default: - assert_always(FALSE, "Unknown id in bebox_state::device_timer"); - } -} - - -/************************************* - * - * Driver main - * - *************************************/ - -void bebox_state::machine_reset() -{ - timer_set(attotime::zero, TIMER_GET_DEVICES); - - m_ppc1->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - m_ppc2->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - - memcpy(m_flash->space().get_read_ptr(0),memregion("user1")->base(),0x200000); -} - -void bebox_state::machine_start() -{ -} - -DRIVER_INIT_MEMBER(bebox_state,bebox) -{ - address_space &space_0 = m_ppc1->space(AS_PROGRAM); - address_space &space_1 = m_ppc2->space(AS_PROGRAM); - - /* set up boot and flash ROM */ - membank("bank2")->set_base(memregion("user2")->base()); - - /* install MESS managed RAM */ - space_0.install_readwrite_bank(0, m_ram->size() - 1, 0, 0x02000000, "bank3"); - space_1.install_readwrite_bank(0, m_ram->size() - 1, 0, 0x02000000, "bank3"); - membank("bank3")->set_base(m_ram->pointer()); - - /* The following is a verrrry ugly hack put in to support NetBSD for - * NetBSD. When NetBSD/bebox it does most of its work on CPU #0 and then - * lets CPU #1 go. However, it seems that CPU #1 jumps into never-never - * land, crashes, and then goes into NetBSD's crash handler which catches - * it. The current PowerPC core cannot catch this trip into never-never - * land properly, and MESS crashes. In the interim, this "mitten" catches - * the crash - */ - { - static UINT64 ops[2] = - { - /* li r0, 0x0700 */ - /* mtspr ctr, r0 */ - U64(0x380007007C0903A6), - - /* bcctr 0x14, 0 */ - U64(0x4E80042000000000) - }; - space_1.install_read_bank(0x9421FFF0, 0x9421FFFF, "bank1"); - membank("bank1")->set_base(ops); - } -} diff --git a/src/mess/machine/beta.c b/src/mess/machine/beta.c deleted file mode 100644 index ef9ec771805..00000000000 --- a/src/mess/machine/beta.c +++ /dev/null @@ -1,292 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, MetalliC -/********************************************************************* - - beta.h - - Implementation of Beta disk drive support for Spectrum and clones - - 04/05/2008 Created by Miodrag Milanovic - -*********************************************************************/ -/* -BUGS: -- due to original firmware bug random commands can be sent to FDC instead of SEEK - -*/ -#include "emu.h" -#include "formats/trd_dsk.h" -#include "machine/beta.h" - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - - -const device_type BETA_DISK = &device_creator; - -beta_disk_device::beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock, "betadisk", __FILE__) - , m_betadisk_active(0) - , m_wd179x(*this, "wd179x") - , m_floppy0(*this, "wd179x:0") - , m_floppy1(*this, "wd179x:1") - , m_floppy2(*this, "wd179x:2") - , m_floppy3(*this, "wd179x:3") -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void beta_disk_device::device_start() -{ -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void beta_disk_device::device_reset() -{ -} - -int beta_disk_device::is_active() -{ - return m_betadisk_active; -} - -void beta_disk_device::enable() -{ - m_betadisk_active = 1; -} - -void beta_disk_device::disable() -{ - m_betadisk_active = 0; -} - -READ8_MEMBER(beta_disk_device::status_r) -{ - if (m_betadisk_active==1) { - return m_wd179x->status_r(space, 0); - } else { - return 0xff; - } -} - -READ8_MEMBER(beta_disk_device::track_r) -{ - if (m_betadisk_active==1) { - return m_wd179x->track_r(space, 0); - } else { - return 0xff; - } -} - -READ8_MEMBER(beta_disk_device::sector_r) -{ - if (m_betadisk_active==1) { - return m_wd179x->sector_r(space, 0); - } else { - return 0xff; - } -} - -READ8_MEMBER(beta_disk_device::data_r) -{ - if (m_betadisk_active==1) { - return m_wd179x->data_r(space, 0); - } else { - return 0xff; - } -} - -READ8_MEMBER(beta_disk_device::state_r) -{ - if (m_betadisk_active==1) { - UINT8 result = 0x3F; // actually open bus - result |= m_wd179x->drq_r() ? 0x40 : 0; - result |= m_wd179x->intrq_r() ? 0x80 : 0; - return result; - } else { - return 0xff; - } -} - -WRITE8_MEMBER(beta_disk_device::param_w) -{ - if (m_betadisk_active == 1) - { - floppy_connector* connectors[] = { m_floppy0, m_floppy1, m_floppy2, m_floppy3 }; - - floppy_image_device* floppy = connectors[data & 3]->get_device(); - - m_wd179x->set_floppy(floppy); - floppy->ss_w(BIT(data, 4) ? 0 : 1); - m_wd179x->dden_w(BIT(data, 6)); - - // bit 3 connected to pin 23 "HLT" of FDC and via diode to INDEX - //m_wd179x->hlt_w(BIT(data, 3)); // not handled in current wd_fdc - - if (BIT(data, 2) == 0) // reset - { - m_wd179x->reset(); - floppy->mon_w(ASSERT_LINE); - } else { - // HACK, FDD motor and RDY FDC pin controlled by HLD pin of FDC - floppy->mon_w(CLEAR_LINE); - } - } -} - -WRITE8_MEMBER(beta_disk_device::command_w) -{ - if (m_betadisk_active==1) { - m_wd179x->cmd_w(space, 0, data); - } -} - -WRITE8_MEMBER(beta_disk_device::track_w) -{ - if (m_betadisk_active==1) { - m_wd179x->track_w(space, 0, data); - } -} - -WRITE8_MEMBER(beta_disk_device::sector_w) -{ - if (m_betadisk_active==1) { - m_wd179x->sector_w(space, 0, data); - } -} - -WRITE8_MEMBER(beta_disk_device::data_w) -{ - if (m_betadisk_active==1) { - m_wd179x->data_w(space, 0, data); - } -} - -FLOPPY_FORMATS_MEMBER(beta_disk_device::floppy_formats) - FLOPPY_TRD_FORMAT -FLOPPY_FORMATS_END - -static SLOT_INTERFACE_START( beta_disk_floppies ) - SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) - SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) - SLOT_INTERFACE( "drive2", FLOPPY_525_QD ) - SLOT_INTERFACE( "drive3", FLOPPY_525_QD ) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_FRAGMENT( beta_disk ) - MCFG_KR1818VG93_ADD("wd179x", XTAL_8MHz / 8) - MCFG_FLOPPY_DRIVE_ADD("wd179x:0", beta_disk_floppies, "drive0", beta_disk_device::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd179x:1", beta_disk_floppies, "drive1", beta_disk_device::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd179x:2", beta_disk_floppies, "drive2", beta_disk_device::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("wd179x:3", beta_disk_floppies, "drive3", beta_disk_device::floppy_formats) -MACHINE_CONFIG_END - -ROM_START( beta_disk ) - ROM_REGION( 0x60000, "beta", 0 ) - ROM_LOAD( "trd501.rom", 0x00000, 0x4000, CRC(3e3cdd4c) SHA1(8303ba0cc79daa6c04cd1e6ce27e8b6886a3f0de)) - - ROM_LOAD( "trd503zxvgs.rom",0x00000, 0x4000, CRC(b90ee684) SHA1(c78e1b36812fb2b3e7a62e66049c850d27de74a6)) - ROM_LOAD( "trd503m.rom", 0x00000, 0x4000, CRC(2f97fe06) SHA1(6b9decc07d5d7322c6c283f5fe950f530a42d70d)) - ROM_LOAD( "trd503[a].rom", 0x00000, 0x4000, CRC(c43d717f) SHA1(0a74bd34538a03d0e1d214b425d95c14ad10c8c4)) - ROM_LOAD( "trd503[a2].rom", 0x00000, 0x4000, CRC(121889b0) SHA1(c9d69cf3a0219f6e37e7eb5046961fa8fa8eb2c6)) - ROM_LOAD( "trd503[a3].rom", 0x00000, 0x4000, CRC(1c5a25b1) SHA1(4a6fbabd82a6a8f3986ac77e7157d1a2551ed40d)) - ROM_LOAD( "trd503beta3.rom",0x00000, 0x4000, CRC(561662f2) SHA1(4cea8a361eb848cf0ad59605c83d57c30521cfd5)) - ROM_LOAD( "trd503beta4.rom",0x00000, 0x4000, CRC(23dbc387) SHA1(74b80d3f07dc95e9f09b83c3df4724f063f47116)) - ROM_LOAD( "trd503all.rom", 0x00000, 0x4000, CRC(4c0187ab) SHA1(21f611e5e0bbf5d6450606e30b470f7c2c9640f1)) - ROM_LOAD( "trd503aut.rom", 0x00000, 0x4000, CRC(7ff90178) SHA1(2261144bdb5046cb8013f744a5b0721be8577dc7)) - ROM_LOAD( "trd503ext.rom", 0x00000, 0x4000, CRC(abb139e7) SHA1(3c1736857655a48375d30b3865963090ba635635)) - ROM_LOAD( "trd503kay.rom", 0x00000, 0x4000, CRC(77baccbb) SHA1(9c5fb89b57643f723246453809dad3f669bf59a3)) - ROM_LOAD( "trd503xbios.rom",0x00000, 0x4000, CRC(8be427cc) SHA1(78f423fd200e720aa6b857f00969fa1f8c7da20e)) - ROM_LOAD( "trd503[a4].rom", 0x00000, 0x4000, CRC(c2387608) SHA1(93e0b92a3f38b59cc006d22f9c9299f5377b15e5)) - - - ROM_LOAD( "trd504.rom", 0x00000, 0x4000, CRC(ba310874) SHA1(05e55e37df8eee6c68601ba9cf6c92195852ce3f)) - ROM_LOAD( "trd504s.rom", 0x00000, 0x4000, CRC(c5ca0423) SHA1(cb2da2c4575bc54454e4f97073c5bb37505487fe)) - ROM_LOAD( "trd504s2.rom", 0x00000, 0x4000, CRC(1e9b59aa) SHA1(d6eb0eeb429c70d1f8f9a23ca4e2feb5f73d3120)) - ROM_LOAD( "trd504s3.rom", 0x00000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db)) - - - ROM_LOAD( "trd504tm.rom", 0x00000, 0x4000, CRC(2334b8c6) SHA1(2fd8944e067140324e998b59aab766f16eb5c7fb)) - ROM_LOAD( "trd504t.rom", 0x00000, 0x4000, CRC(e212d1e0) SHA1(745e9caf576e64a5386ad845256d28593d34cc40)) - ROM_LOAD( "trd504tb2.rom", 0x00000, 0x4000, CRC(8d943e6b) SHA1(bf6ab329791258f02c5f695b0c7448998b709435)) - ROM_LOAD( "trd504s4.rom", 0x00000, 0x4000, CRC(522ebbd6) SHA1(eede6a988ed453e506b27a8d09470e0a8d97d1aa)) - ROM_LOAD( "trd504f.rom", 0x00000, 0x4000, CRC(ab3100d8) SHA1(33646525ae1c579cddc0dd84d3218095950965b8)) - ROM_LOAD( "trd504em.rom", 0x00000, 0x4000, CRC(0d3f8b43) SHA1(d6783983a16b17b79337c22e9460e1cfde3744ae)) - ROM_LOAD( "trd504-1.rom", 0x00000, 0x4000, CRC(da170c65) SHA1(80f0fe79cbf393ac91ff971d31ff9eab0c9a959e)) - ROM_LOAD( "trd504m.rom", 0x00000, 0x4000, CRC(2f2cb630) SHA1(40b1f87f8be4e09630d7eb7c14561dde0b85c0c9)) - ROM_LOAD( "trd504em[a].rom",0x00000, 0x4000, CRC(fcbf11e8) SHA1(8050d371d7049e0c3e946964643396a39aa5ab0f)) - ROM_LOAD( "trd5043.rom", 0x00000, 0x4000, CRC(165d5ef8) SHA1(99d25234154e4a8b3ad5e06f260b6c41c253b333)) - - ROM_LOAD( "trd505.rom", 0x00000, 0x4000, CRC(fdff3810) SHA1(0a0e284d4764a542aa3e5d7c43d0291036e16c35)) - ROM_LOAD( "trd505[a].rom", 0x00000, 0x4000, CRC(03b76c8f) SHA1(ef2a07767d3b229aa4573dcfee905156a83bc32d)) - ROM_LOAD( "trd505h.rom", 0x00000, 0x4000, CRC(9ba15549) SHA1(5908784cdfb782066bde08f186f0bbb6f6b80545)) - ROM_LOAD( "trd505d.rom", 0x00000, 0x4000, CRC(31e4be08) SHA1(dd08bdea8b5caa35569f49770e380d16bb37502b)) - ROM_LOAD( "trd505[a2].rom", 0x00000, 0x4000, CRC(a102e726) SHA1(a3f0ef7b7d8b3022f306be8d9e8a51ae699097df)) - - ROM_LOAD( "trd56661.rom", 0x00000, 0x4000, CRC(8528c789) SHA1(1332a01137bd537fee696ba7adddc0a15b3237c4)) - ROM_LOAD( "trd5666hte.rom", 0x00000, 0x4000, CRC(03841161) SHA1(4e523768231130947a81247e116fc049bd6da963)) - ROM_LOAD( "trd5613.rom", 0x00000, 0x4000, CRC(d66cda49) SHA1(dac3c8396fc4f85b5673076cc647afbe439ad17a)) - - ROM_LOAD( "trd512.rom", 0x00000, 0x4000, CRC(b615d6c4) SHA1(4abb90243f66df19caa84f82d0b880a6ce344eca)) - ROM_LOAD( "trd512f.rom", 0x00000, 0x4000, CRC(edb74f8c) SHA1(c5b2cd18926dde4a68bcd8c360ba33d6c11b8801)) - - ROM_LOAD( "trd513f.rom", 0x00000, 0x4000, CRC(6b1c17f3) SHA1(5c14c0c389e29521cb59672d93d3e8a74f0184cc)) - ROM_LOAD( "trd513fm.rom", 0x00000, 0x4000, CRC(bad0c0a0) SHA1(da88e756302f83991774730012601ebf3c61aed9)) - ROM_LOAD( "trd513p.rom", 0x00000, 0x4000, CRC(eb3196fe) SHA1(7c85b9b562d288155677f20f5e41e679c073379b)) - - ROM_LOAD( "trd604.rom", 0x00000, 0x4000, CRC(d8882a8c) SHA1(282eb7bc819aad2a12fd954e76f7838a4e1a7929)) - ROM_LOAD( "trd604m.rom", 0x00000, 0x4000, CRC(e73394cb) SHA1(5b1336e8534513df0a71f8fedca38bc67174f03c)) - - ROM_LOAD( "trd605r.rom", 0x00000, 0x4000, CRC(f8816a47) SHA1(98c9b63835e559f38f6a8d1344992f02cb899add)) - ROM_LOAD( "trd605e.rom", 0x00000, 0x4000, CRC(56d3c2db) SHA1(adc21492d216da1aca4119972f2110a23fdd23a7)) - ROM_LOAD( "trd605h.rom", 0x00000, 0x4000, CRC(53bb1b4a) SHA1(fc899901fd59c84c9aa6c402b67d76b225ab8e5b)) - ROM_LOAD( "trd605e-2.rom", 0x00000, 0x4000, CRC(a064b7f2) SHA1(46ac75e88375d313fdd5e873800bf82c179eb226)) - ROM_LOAD( "trd605e-3.rom", 0x00000, 0x4000, CRC(cff3d06b) SHA1(0fca9c61cb94a4cab78118c66ba54ce6bc6dcf65)) - - ROM_LOAD( "trd606h.rom", 0x00000, 0x4000, CRC(6b44fdd7) SHA1(4ca7ea2bc0e62c98c9ba86a304aee3cbf88d6b09)) - - ROM_LOAD( "trd607m.rom", 0x00000, 0x4000, CRC(5a062f03) SHA1(bbd68481c76e8a3f2f26847faa72c42df013b617)) - - ROM_LOAD( "trd608.rom", 0x00000, 0x4000, CRC(5c998d53) SHA1(c65a972e75e627336c44ea184cb9ae81dfa2069b)) - ROM_LOAD( "trd608-2.rom", 0x00000, 0x4000, CRC(3541b280) SHA1(2b93c1887f485639ec15860b5503dc7efb6d31d6)) - ROM_LOAD( "trd608-3.rom", 0x00000, 0x4000, CRC(d3e91d69) SHA1(5e367d3601d07bd2af1d6255561a5983c0e9fb5d)) - - ROM_LOAD( "trd609.rom", 0x00000, 0x4000, CRC(91028924) SHA1(fa5433f73aab93c58c891ceee2cdfed0a979dfbb)) - ROM_LOAD( "trd609e.rom", 0x00000, 0x4000, CRC(46312c8c) SHA1(0ce69fe76e17a875c287e3725f6209f1c59d8bd9)) - - ROM_LOAD( "trd610e.rom", 0x00000, 0x4000, CRC(95395ca4) SHA1(8cda2efbf2360cd675ea8b04b43cf1746fb41f35)) - - ROM_LOAD( "trd701.rom", 0x00000, 0x4000, CRC(47f39c0d) SHA1(53d8b8959c321618caaef5aeb270e530e8f8ada3)) - - //Default for now - ROM_LOAD( "trd503.rom", 0x00000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c)) -ROM_END - - -//------------------------------------------------- -// device_mconfig_additions - return a pointer to -// the device's machine fragment -//------------------------------------------------- - -machine_config_constructor beta_disk_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( beta_disk ); -} - -//------------------------------------------------- -// device_rom_region - return a pointer to the -// the device's ROM definitions -//------------------------------------------------- - -const rom_entry *beta_disk_device::device_rom_region() const -{ - return ROM_NAME(beta_disk ); -} diff --git a/src/mess/machine/beta.h b/src/mess/machine/beta.h deleted file mode 100644 index 4afe62c771c..00000000000 --- a/src/mess/machine/beta.h +++ /dev/null @@ -1,69 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, MetalliC -/********************************************************************* - - beta.h - - Implementation of Beta disk drive support for Spectrum and clones - - 04/05/2008 Created by Miodrag Milanovic - -*********************************************************************/ -#ifndef __BETA_H__ -#define __BETA_H__ - -#include "machine/wd_fdc.h" - - -#define BETA_DISK_TAG "beta" - -class beta_disk_device : public device_t -{ -public: - beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~beta_disk_device() {} - - DECLARE_READ8_MEMBER(status_r); - DECLARE_READ8_MEMBER(track_r); - DECLARE_READ8_MEMBER(sector_r); - DECLARE_READ8_MEMBER(data_r); - DECLARE_READ8_MEMBER(state_r); - - DECLARE_WRITE8_MEMBER(param_w); - DECLARE_WRITE8_MEMBER(command_w); - DECLARE_WRITE8_MEMBER(track_w); - DECLARE_WRITE8_MEMBER(sector_w); - DECLARE_WRITE8_MEMBER(data_w); - DECLARE_FLOPPY_FORMATS(floppy_formats); - - int is_active(); - void enable(); - void disable(); - - UINT8 m_betadisk_active; - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - -private: - required_device m_wd179x; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; -}; - -extern const device_type BETA_DISK; - - -#define MCFG_BETA_DISK_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, BETA_DISK, 0) - -#define MCFG_BETA_DISK_REMOVE(_tag) \ - MCFG_DEVICE_REMOVE(_tag) - -#endif /* __BETA_H__ */ diff --git a/src/mess/machine/bk.c b/src/mess/machine/bk.c deleted file mode 100644 index 605b66dc74b..00000000000 --- a/src/mess/machine/bk.c +++ /dev/null @@ -1,168 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - BK machine driver by Miodrag Milanovic - - 10/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "imagedev/cassette.h" -#include "machine/i8255.h" -#include "includes/bk.h" - - -TIMER_CALLBACK_MEMBER(bk_state::keyboard_callback) -{ - UINT8 code, i, j; - static const char *const keynames[] = { - "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", - "LINE7", "LINE8", "LINE9", "LINE10", "LINE11" - }; - - for(i = 1; i < 12; i++) - { - code = ioport(keynames[i-1])->read(); - if (code != 0) - { - for(j = 0; j < 8; j++) - { - if (code == (1 << j)) - { - m_key_code = j + i*8; - break; - } - } - if ((ioport("LINE0")->read() & 4) == 4) - { - if (i==6 || i==7) - { - m_key_code -= 16; - } - - } - if ((ioport("LINE0")->read() & 4) == 4) - { - if (i>=8 && i<=11) - { - m_key_code += 32; - } - } - m_key_pressed = 0x40; - if ((ioport("LINE0")->read() & 2) == 0) - { - m_key_irq_vector = 0x30; - } - else - { - m_key_irq_vector = 0xBC; - } - m_maincpu->set_input_line(0, ASSERT_LINE); - break; - } - } -} - - -void bk_state::machine_start() -{ - machine().scheduler().timer_pulse(attotime::from_hz(2400), timer_expired_delegate(FUNC(bk_state::keyboard_callback),this)); -} - -IRQ_CALLBACK_MEMBER(bk_state::bk0010_irq_callback) -{ - device.execute().set_input_line(0, CLEAR_LINE); - return m_key_irq_vector; -} - -void bk_state::machine_reset() -{ - m_kbd_state = 0; - m_scrool = 01330; -} - -READ16_MEMBER(bk_state::bk_key_state_r) -{ - return m_kbd_state; -} -READ16_MEMBER(bk_state::bk_key_code_r) -{ - m_kbd_state &= ~0x80; // mark reading done - m_key_pressed = 0; - return m_key_code; -} -READ16_MEMBER(bk_state::bk_vid_scrool_r) -{ - return m_scrool; -} - -READ16_MEMBER(bk_state::bk_key_press_r) -{ - double level = m_cassette->input(); - UINT16 cas; - if (level < 0) - { - cas = 0x00; - } - else - { - cas = 0x20; - } - - return 0x8080 | m_key_pressed | cas; -} - -WRITE16_MEMBER(bk_state::bk_key_state_w) -{ - m_kbd_state = (m_kbd_state & ~0x40) | (data & 0x40); -} - -WRITE16_MEMBER(bk_state::bk_vid_scrool_w) -{ - m_scrool = data; -} - -WRITE16_MEMBER(bk_state::bk_key_press_w) -{ -} - -READ16_MEMBER(bk_state::bk_floppy_cmd_r) -{ - return 0; -} - -WRITE16_MEMBER(bk_state::bk_floppy_cmd_w) -{ - if ((data & 1) == 1) - { - m_drive = 0; - } - if ((data & 2) == 2) - { - m_drive = 1; - } - if ((data & 4) == 4) - { - m_drive = 2; - } - if ((data & 8) == 8) - { - m_drive = 3; - } - if (data == 0) - { - m_drive = -1; - } -} - -READ16_MEMBER(bk_state::bk_floppy_data_r) -{ - return 0; -} - -WRITE16_MEMBER(bk_state::bk_floppy_data_w) -{ -} diff --git a/src/mess/machine/c65_old.c b/src/mess/machine/c65_old.c deleted file mode 100644 index 3a582cfb0ae..00000000000 --- a/src/mess/machine/c65_old.c +++ /dev/null @@ -1,1339 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/*************************************************************************** - commodore c65 home computer - peter.trauner@jk.uni-linz.ac.at - documention - www.funet.fi - ***************************************************************************/ - -#include "emu.h" - -#include "includes/c65.h" -#include "cpu/m6502/m4510.h" -#include "sound/mos6581.h" -#include "machine/mos6526.h" -#include "bus/cbmiec/cbmiec.h" -#include "machine/ram.h" -#include "video/vic4567.h" -#include "imagedev/cassette.h" -#include "crsshair.h" -#include "formats/cbm_tap.h" - -#define VERBOSE_LEVEL 0 -#define DBG_LOG( MACHINE, N, M, A ) \ - do { \ - if(VERBOSE_LEVEL >= N) \ - { \ - if( M ) \ - logerror("%11.6f: %-24s", MACHINE.time().as_double(), (char*) M ); \ - logerror A; \ - } \ - } while (0) - - - -/*********************************************** - - Input Reading - Common Components - -***********************************************/ - -/* These are needed by c64, c65 and c128, each machine has also additional specific -components in its INTERRUPT_GEN */ - -/* keyboard lines */ -UINT8 c64_keyline[10]; - -void cbm_common_init(void) -{ - int i; - - for (i = 0; i < ARRAY_LENGTH(c64_keyline); i++) - c64_keyline[i] = 0xff; -} - -static TIMER_CALLBACK( lightpen_tick ) -{ - if (((machine.root_device().ioport("CTRLSEL")->read() & 0x07) == 0x04) || ((machine.root_device().ioport("CTRLSEL")->read() & 0x07) == 0x06)) - { - /* enable lightpen crosshair */ - crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); - } - else - { - /* disable lightpen crosshair */ - crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); - } -} - -void cbm_common_interrupt( device_t *device ) -{ - int value, i; - int controller1 = device->machine().root_device().ioport("CTRLSEL")->read() & 0x07; - int controller2 = device->machine().root_device().ioport("CTRLSEL")->read() & 0x70; - static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; - - /* Lines 0-7 : common keyboard */ - for (i = 0; i < 8; i++) - { - value = 0xff; - value &= ~device->machine().root_device().ioport(c64ports[i])->read(); - - /* Shift Lock is mapped on Left Shift */ - if ((i == 1) && (device->machine().root_device().ioport("SPECIAL")->read() & 0x40)) - value &= ~0x80; - - c64_keyline[i] = value; - } - - - value = 0xff; - switch(controller1) - { - case 0x00: - value &= ~device->machine().root_device().ioport("JOY1_1B")->read(); /* Joy1 Directions + Button 1 */ - break; - - case 0x01: - if (device->machine().root_device().ioport("OTHER")->read() & 0x40) /* Paddle2 Button */ - value &= ~0x08; - if (device->machine().root_device().ioport("OTHER")->read() & 0x80) /* Paddle1 Button */ - value &= ~0x04; - break; - - case 0x02: - if (device->machine().root_device().ioport("OTHER")->read() & 0x02) /* Mouse Button Left */ - value &= ~0x10; - if (device->machine().root_device().ioport("OTHER")->read() & 0x01) /* Mouse Button Right */ - value &= ~0x01; - break; - - case 0x03: - value &= ~(device->machine().root_device().ioport("JOY1_2B")->read() & 0x1f); /* Joy1 Directions + Button 1 */ - break; - - case 0x04: -/* was there any input on the lightpen? where is it mapped? */ -// if (device->machine().root_device().ioport("OTHER")->read() & 0x04) /* Lightpen Signal */ -// value &= ?? ; - break; - - case 0x07: - break; - - default: - logerror("Invalid Controller 1 Setting %d\n", controller1); - break; - } - - c64_keyline[8] = value; - - - value = 0xff; - switch(controller2) - { - case 0x00: - value &= ~device->machine().root_device().ioport("JOY2_1B")->read(); /* Joy2 Directions + Button 1 */ - break; - - case 0x10: - if (device->machine().root_device().ioport("OTHER")->read() & 0x10) /* Paddle4 Button */ - value &= ~0x08; - if (device->machine().root_device().ioport("OTHER")->read() & 0x20) /* Paddle3 Button */ - value &= ~0x04; - break; - - case 0x20: - if (device->machine().root_device().ioport("OTHER")->read() & 0x02) /* Mouse Button Left */ - value &= ~0x10; - if (device->machine().root_device().ioport("OTHER")->read() & 0x01) /* Mouse Button Right */ - value &= ~0x01; - break; - - case 0x30: - value &= ~(device->machine().root_device().ioport("JOY2_2B")->read() & 0x1f); /* Joy2 Directions + Button 1 */ - break; - - case 0x40: -/* was there any input on the lightpen? where is it mapped? */ -// if (device->machine().root_device().ioport("OTHER")->read() & 0x04) /* Lightpen Signal */ -// value &= ?? ; - break; - - case 0x70: - break; - - default: - logerror("Invalid Controller 2 Setting %d\n", controller2); - break; - } - - c64_keyline[9] = value; - -// vic2_frame_interrupt does nothing so this is not necessary -// vic2_frame_interrupt (device); - - /* check if lightpen has been chosen as input: if so, enable crosshair */ - device->machine().scheduler().timer_set(attotime::zero, FUNC(lightpen_tick)); - - set_led_status (device->machine(), 1, device->machine().root_device().ioport("SPECIAL")->read() & 0x40 ? 1 : 0); /* Shift Lock */ - set_led_status (device->machine(), 0, device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ? 1 : 0); /* Joystick Swap */ -} - - -/*********************************************** - - CIA Common Handlers - -***********************************************/ - -/* These are shared by c64, c65 and c128. c65 and c128 also have additional specific -components (to select/read additional keyboard lines) */ - -/* - * CIA 0 - Port A - * bits 7-0 keyboard line select - * bits 7,6: paddle select( 01 port a, 10 port b) - * bit 4: joystick a fire button - * bits 3,2: Paddles port a fire button - * bits 3-0: joystick a direction - * - * CIA 0 - Port B - * bits 7-0: keyboard raw values - * bit 4: joystick b fire button, lightpen select - * bits 3,2: paddle b fire buttons (left,right) - * bits 3-0: joystick b direction - * - * flag cassette read input, serial request in - * irq to irq connected - */ - -UINT8 cbm_common_cia0_port_a_r( device_t *device, UINT8 output_b ) -{ - UINT8 value = 0xff; - - if (!(output_b & 0x80)) - { - UINT8 t = 0xff; - if (!(c64_keyline[7] & 0x80)) t &= ~0x80; - if (!(c64_keyline[6] & 0x80)) t &= ~0x40; - if (!(c64_keyline[5] & 0x80)) t &= ~0x20; - if (!(c64_keyline[4] & 0x80)) t &= ~0x10; - if (!(c64_keyline[3] & 0x80)) t &= ~0x08; - if (!(c64_keyline[2] & 0x80)) t &= ~0x04; - if (!(c64_keyline[1] & 0x80)) t &= ~0x02; - if (!(c64_keyline[0] & 0x80)) t &= ~0x01; - value &= t; - } - - if (!(output_b & 0x40)) - { - UINT8 t = 0xff; - if (!(c64_keyline[7] & 0x40)) t &= ~0x80; - if (!(c64_keyline[6] & 0x40)) t &= ~0x40; - if (!(c64_keyline[5] & 0x40)) t &= ~0x20; - if (!(c64_keyline[4] & 0x40)) t &= ~0x10; - if (!(c64_keyline[3] & 0x40)) t &= ~0x08; - if (!(c64_keyline[2] & 0x40)) t &= ~0x04; - if (!(c64_keyline[1] & 0x40)) t &= ~0x02; - if (!(c64_keyline[0] & 0x40)) t &= ~0x01; - value &= t; - } - - if (!(output_b & 0x20)) - { - UINT8 t = 0xff; - if (!(c64_keyline[7] & 0x20)) t &= ~0x80; - if (!(c64_keyline[6] & 0x20)) t &= ~0x40; - if (!(c64_keyline[5] & 0x20)) t &= ~0x20; - if (!(c64_keyline[4] & 0x20)) t &= ~0x10; - if (!(c64_keyline[3] & 0x20)) t &= ~0x08; - if (!(c64_keyline[2] & 0x20)) t &= ~0x04; - if (!(c64_keyline[1] & 0x20)) t &= ~0x02; - if (!(c64_keyline[0] & 0x20)) t &= ~0x01; - value &= t; - } - - if (!(output_b & 0x10)) - { - UINT8 t = 0xff; - if (!(c64_keyline[7] & 0x10)) t &= ~0x80; - if (!(c64_keyline[6] & 0x10)) t &= ~0x40; - if (!(c64_keyline[5] & 0x10)) t &= ~0x20; - if (!(c64_keyline[4] & 0x10)) t &= ~0x10; - if (!(c64_keyline[3] & 0x10)) t &= ~0x08; - if (!(c64_keyline[2] & 0x10)) t &= ~0x04; - if (!(c64_keyline[1] & 0x10)) t &= ~0x02; - if (!(c64_keyline[0] & 0x10)) t &= ~0x01; - value &= t; - } - - if (!(output_b & 0x08)) - { - UINT8 t = 0xff; - if (!(c64_keyline[7] & 0x08)) t &= ~0x80; - if (!(c64_keyline[6] & 0x08)) t &= ~0x40; - if (!(c64_keyline[5] & 0x08)) t &= ~0x20; - if (!(c64_keyline[4] & 0x08)) t &= ~0x10; - if (!(c64_keyline[3] & 0x08)) t &= ~0x08; - if (!(c64_keyline[2] & 0x08)) t &= ~0x04; - if (!(c64_keyline[1] & 0x08)) t &= ~0x02; - if (!(c64_keyline[0] & 0x08)) t &= ~0x01; - value &= t; - } - - if (!(output_b & 0x04)) - { - UINT8 t = 0xff; - if (!(c64_keyline[7] & 0x04)) t &= ~0x80; - if (!(c64_keyline[6] & 0x04)) t &= ~0x40; - if (!(c64_keyline[5] & 0x04)) t &= ~0x20; - if (!(c64_keyline[4] & 0x04)) t &= ~0x10; - if (!(c64_keyline[3] & 0x04)) t &= ~0x08; - if (!(c64_keyline[2] & 0x04)) t &= ~0x04; - if (!(c64_keyline[1] & 0x04)) t &= ~0x02; - if (!(c64_keyline[0] & 0x04)) t &= ~0x01; - value &= t; - } - - if (!(output_b & 0x02)) - { - UINT8 t = 0xff; - if (!(c64_keyline[7] & 0x02)) t &= ~0x80; - if (!(c64_keyline[6] & 0x02)) t &= ~0x40; - if (!(c64_keyline[5] & 0x02)) t &= ~0x20; - if (!(c64_keyline[4] & 0x02)) t &= ~0x10; - if (!(c64_keyline[3] & 0x02)) t &= ~0x08; - if (!(c64_keyline[2] & 0x02)) t &= ~0x04; - if (!(c64_keyline[1] & 0x02)) t &= ~0x02; - if (!(c64_keyline[0] & 0x02)) t &= ~0x01; - value &= t; - } - - if (!(output_b & 0x01)) - { - UINT8 t = 0xff; - if (!(c64_keyline[7] & 0x01)) t &= ~0x80; - if (!(c64_keyline[6] & 0x01)) t &= ~0x40; - if (!(c64_keyline[5] & 0x01)) t &= ~0x20; - if (!(c64_keyline[4] & 0x01)) t &= ~0x10; - if (!(c64_keyline[3] & 0x01)) t &= ~0x08; - if (!(c64_keyline[2] & 0x01)) t &= ~0x04; - if (!(c64_keyline[1] & 0x01)) t &= ~0x02; - if (!(c64_keyline[0] & 0x01)) t &= ~0x01; - value &= t; - } - - if ( device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ) - value &= c64_keyline[8]; - else - value &= c64_keyline[9]; - - return value; -} - -UINT8 cbm_common_cia0_port_b_r( device_t *device, UINT8 output_a ) -{ - UINT8 value = 0xff; - - if (!(output_a & 0x80)) value &= c64_keyline[7]; - if (!(output_a & 0x40)) value &= c64_keyline[6]; - if (!(output_a & 0x20)) value &= c64_keyline[5]; - if (!(output_a & 0x10)) value &= c64_keyline[4]; - if (!(output_a & 0x08)) value &= c64_keyline[3]; - if (!(output_a & 0x04)) value &= c64_keyline[2]; - if (!(output_a & 0x02)) value &= c64_keyline[1]; - if (!(output_a & 0x01)) value &= c64_keyline[0]; - - if ( device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ) - value &= c64_keyline[9]; - else - value &= c64_keyline[8]; - - return value; -} - - -/*********************************************** - - CBM Cartridges - -***********************************************/ - - -/* All the cartridge specific code has been moved - to machine/ drivers. Once more informations - surface about the cart expansions for systems - in c65.c, c128.c, cbmb.c and pet.c, the shared - code could be refactored to have here the - common functions */ - - - -/*********************************************** - - CBM Datasette Tapes - -***********************************************/ - -#if 0 -const cassette_interface cbm_cassette_interface = -{ - cbm_cassette_formats, - NULL, - (cassette_state) (CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED), - NULL -}; -#endif - - -/*UINT8 *c65_basic; */ -/*UINT8 *c65_kernal; */ -/*UINT8 *c65_dos; */ -/*UINT8 *c65_monitor; */ -/*UINT8 *c65_graphics; */ - - -void c65_state::c65_nmi( ) -{ - if (m_nmilevel != (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq) /* KEY_RESTORE */ - { - m_maincpu->set_input_line(INPUT_LINE_NMI, (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq); - - m_nmilevel = (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq; - } -} - - -/*********************************************** - - CIA Interfaces - -***********************************************/ - -/* - * CIA 0 - Port A keyboard line select - * CIA 0 - Port B keyboard line read - * - * flag cassette read input, serial request in - * irq to irq connected - * - * see machine/cbm.c - */ - -READ8_MEMBER(c65_state::c65_cia0_port_a_r) -{ - UINT8 cia0portb = m_cia0->pb_r(space, 0); - - return cbm_common_cia0_port_a_r(m_cia0, cia0portb); -} - -READ8_MEMBER(c65_state::c65_cia0_port_b_r) -{ - UINT8 value = 0xff; - UINT8 cia0porta = m_cia0->pa_r(space, 0); - - value &= cbm_common_cia0_port_b_r(m_cia0, cia0porta); - - if (!(m_6511_port & 0x02)) - value &= m_keyline; - - return value; -} - -WRITE8_MEMBER(c65_state::c65_cia0_port_b_w) -{ -// was there lightpen support in c65 video chip? -// vic3_device *vic3 = machine().device("vic3"); -// vic3->lightpen_write(data & 0x10); -} - -void c65_state::c65_irq( int level ) -{ - if (level != m_old_level) - { - DBG_LOG(machine(), 3, "mos4510", ("irq %s\n", level ? "start" : "end")); - m_maincpu->set_input_line(M4510_IRQ_LINE, level); - m_old_level = level; - } -} - -/* is this correct for c65 as well as c64? */ -WRITE_LINE_MEMBER(c65_state::c65_cia0_interrupt) -{ - m_cia0_irq = state; - c65_irq(state || m_vicirq); -} - -/* is this correct for c65 as well as c64? */ -WRITE_LINE_MEMBER(c65_state::c65_vic_interrupt) -{ -#if 1 - if (state != m_vicirq) - { - c65_irq (state || m_cia0_irq); - m_vicirq = state; - } -#endif -} - -/* - * CIA 1 - Port A - * bit 7 serial bus data input - * bit 6 serial bus clock input - * bit 5 serial bus data output - * bit 4 serial bus clock output - * bit 3 serial bus atn output - * bit 2 rs232 data output - * bits 1-0 vic-chip system memory bank select - * - * CIA 1 - Port B - * bit 7 user rs232 data set ready - * bit 6 user rs232 clear to send - * bit 5 user - * bit 4 user rs232 carrier detect - * bit 3 user rs232 ring indicator - * bit 2 user rs232 data terminal ready - * bit 1 user rs232 request to send - * bit 0 user rs232 received data - * - * flag restore key or rs232 received data input - * irq to nmi connected ? - */ -READ8_MEMBER(c65_state::c65_cia1_port_a_r) -{ - UINT8 value = 0xff; - - if (!m_iec->clk_r()) - value &= ~0x40; - - if (!m_iec->data_r()) - value &= ~0x80; - - return value; -} - -WRITE8_MEMBER(c65_state::c65_cia1_port_a_w) -{ - static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000}; - - m_iec->atn_w(!BIT(data, 3)); - m_iec->clk_w(!BIT(data, 4)); - m_iec->data_w(!BIT(data, 5)); - - m_vicaddr = m_memory + helper[data & 0x03]; -} - -WRITE_LINE_MEMBER(c65_state::c65_cia1_interrupt) -{ - m_cia1_irq = state; - c65_nmi(); -} - -/*********************************************** - - Memory Handlers - -***********************************************/ - -/* processor has only 1 mega address space !? */ -/* and system 8 megabyte */ -/* dma controller and bankswitch hardware ?*/ -READ8_MEMBER( c65_state::c65_read_mem ) -{ - UINT8 result; - if (offset <= 0x0ffff) - result = m_memory[offset]; - else - result = space.read_byte(offset); - return result; -} - -WRITE8_MEMBER( c65_state::c65_write_mem ) -{ - if (offset <= 0x0ffff) - m_memory[offset] = data; - else - space.write_byte(offset, data); -} - -/* dma chip at 0xd700 - used: - writing banknumber to offset 2 - writing hibyte to offset 1 - writing lobyte to offset 0 - cpu holded, dma transfer(data at address) executed, cpu activated - - command data: - 0 command (0 copy, 3 fill) - 1,2 length - 3,4,5 source - 6,7,8 dest - 9 subcommand - 10 mod - - version 1: - seldom copy (overlapping) from 0x402002 to 0x402008 - (making place for new line in basic area) - for whats this bit 0x400000, or is this really the address? - maybe means add counter to address for access, - so allowing up or down copies, and reordering copies - - version 2: - cmd 0x30 used for this -*/ -void c65_state::c65_dma_port_w( int offset, int value ) -{ - PAIR pair, src, dst, len; - UINT8 cmd, fill; - int i; - address_space &space = m_maincpu->space(AS_PROGRAM); - - switch (offset & 3) - { - case 2: - case 1: - m_dma.data[offset & 3] = value; - break; - case 0: - pair.b.h3 = 0; - pair.b.h2 = m_dma.data[2]; - pair.b.h = m_dma.data[1]; - pair.b.l = m_dma.data[0]=value; - cmd = c65_read_mem(space, pair.d++); - len.w.h = 0; - len.b.l = c65_read_mem(space, pair.d++); - len.b.h = c65_read_mem(space, pair.d++); - src.b.h3 = 0; - fill = src.b.l = c65_read_mem(space, pair.d++); - src.b.h = c65_read_mem(space, pair.d++); - src.b.h2 = c65_read_mem(space, pair.d++); - dst.b.h3 = 0; - dst.b.l = c65_read_mem(space, pair.d++); - dst.b.h = c65_read_mem(space, pair.d++); - dst.b.h2 = c65_read_mem(space, pair.d++); - - switch (cmd) - { - case 0: - if (src.d == 0x3ffff) m_dump_dma = 1; - if (m_dump_dma) - DBG_LOG(space.machine(), 1,"dma copy job", - ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", - len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), - c65_read_mem(space, pair.d + 1) ) ); - if ((m_dma.version == 1) - && ( (src.d&0x400000) || (dst.d & 0x400000))) - { - if (!(src.d & 0x400000)) - { - dst.d &= ~0x400000; - for (i = 0; i < len.w.l; i++) - c65_write_mem(space, dst.d--, c65_read_mem(space, src.d++)); - } - else if (!(dst.d & 0x400000)) - { - src.d &= ~0x400000; - for (i = 0; i < len.w.l; i++) - c65_write_mem(space, dst.d++, c65_read_mem(space, src.d--)); - } - else - { - src.d &= ~0x400000; - dst.d &= ~0x400000; - for (i = 0; i < len.w.l; i++) - c65_write_mem(space, --dst.d, c65_read_mem(space, --src.d)); - } - } - else - { - for (i = 0; i < len.w.l; i++) - c65_write_mem(space, dst.d++, c65_read_mem(space, src.d++)); - } - break; - case 3: - DBG_LOG(space.machine(), 3,"dma fill job", - ("len:%.4x value:%.2x dst:%.6x sub:%.2x modrm:%.2x\n", - len.w.l, fill, dst.d, c65_read_mem(space, pair.d), - c65_read_mem(space, pair.d + 1))); - for (i = 0; i < len.w.l; i++) - c65_write_mem(space, dst.d++, fill); - break; - case 0x30: - DBG_LOG(space.machine(), 1,"dma copy down", - ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", - len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), - c65_read_mem(space, pair.d + 1) ) ); - for (i = 0; i < len.w.l; i++) - c65_write_mem(space, dst.d--,c65_read_mem(space, src.d--)); - break; - default: - DBG_LOG(space.machine(), 1,"dma job", - ("cmd:%.2x len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", - cmd,len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), - c65_read_mem(space, pair.d + 1))); - } - break; - default: - DBG_LOG(space.machine(), 1, "dma chip write", ("%.3x %.2x\n", offset, value)); - break; - } -} - -int c65_state::c65_dma_port_r( int offset ) -{ - /* offset 3 bit 7 in progress ? */ - DBG_LOG(machine(), 2, "dma chip read", ("%.3x\n", offset)); - return 0x7f; -} - -void c65_state::c65_6511_port_w( int offset, int value ) -{ - if (offset == 7) - { - m_6511_port = value; - } - DBG_LOG(machine(), 2, "r6511 write", ("%.2x %.2x\n", offset, value)); -} - -int c65_state::c65_6511_port_r( int offset ) -{ - int data = 0xff; - - if (offset == 7) - { - if (ioport("SPECIAL")->read() & 0x20) - data &= ~1; - } - DBG_LOG(machine(), 2, "r6511 read", ("%.2x\n", offset)); - - return data; -} - -/* one docu states custom 4191 disk controller - (for 2 1MB MFM disk drives, 1 internal, the other extern (optional) 1565 - with integrated 512 byte buffer - - 0->0 reset ? - - 0->1, 0->0, wait until 2 positiv, 1->0 ??? - - 0->0, 0 not 0 means no drive ???, other system entries - - - reg 0 write/read - 0,1 written - bit 1 set - bit 2 set - bit 3 set - bit 4 set - - - reg 0 read - bit 0 - bit 1 - bit 2 - 0..2 ->$1d4 - - reg 1 write - $01 written - $18 written - $46 written - $80 written - $a1 written - $01 written, dec - $10 written - - reg 2 read/write?(lsr) - bit 2 - bit 4 - bit 5 busy waiting until zero, then reading reg 7 - bit 6 operation not activ flag!? or set overflow pin used - bit 7 busy flag? - - reg 3 read/write?(rcr) - bit 1 - bit 3 - bit 7 busy flag? - - reg 4 - track?? - 0 written - read -> $1d2 - cmp #$50 - bcs - - - reg 5 - sector ?? - 1 written - read -> $1d3 - cmp #$b bcc - - - reg 6 - head ?? - 0 written - read -> $1d1 - cmp #2 bcc - - reg 7 read - #4e written - 12 times 0, a1 a1 a1 fe written - - reg 8 read - #ff written - 16 times #ff written - - reg 9 - #60 written - -might use the set overflow input - -$21a6c 9a6c format -$21c97 9c97 write operation -$21ca0 9ca0 get byte? -$21cab 9cab read reg 7 -$21caf 9caf write reg 7 -$21cb3 -*/ - -#define FDC_LOST 4 -#define FDC_CRC 8 -#define FDC_RNF 0x10 -#define FDC_BUSY 0x80 -#define FDC_IRQ 0x200 - -#define FDC_CMD_MOTOR_SPIN_UP 0x10 - -#if 0 -void c65_state::c65_fdc_state(void) -{ - switch (m_fdc.state) - { - case FDC_CMD_MOTOR_SPIN_UP: - if (machine().time() - m_fdc.time) - { - m_fdc.state = 0; - m_fdc.status &= ~FDC_BUSY; - } - break; - } -} -#endif - -void c65_state::c65_fdc_w( int offset, int data ) -{ - DBG_LOG(machine(), 1, "fdc write", ("%.5x %.2x %.2x\n", machine().device("maincpu")->safe_pc(), offset, data)); - switch (offset & 0xf) - { - case 0: - m_fdc.reg[0] = data; - break; - case 1: - m_fdc.reg[1] = data; - switch (data & 0xf9) - { - case 0x20: // wait for motor spin up - m_fdc.status &= ~(FDC_IRQ|FDC_LOST|FDC_CRC|FDC_RNF); - m_fdc.status |= FDC_BUSY; - m_fdc.time = machine().time(); - m_fdc.state = FDC_CMD_MOTOR_SPIN_UP; - break; - case 0: // cancel - m_fdc.status &= ~(FDC_BUSY); - m_fdc.state = 0; - break; - case 0x80: // buffered write - case 0x40: // buffered read - case 0x81: // unbuffered write - case 0x41: // unbuffered read - case 0x30:case 0x31: // step - break; - } - break; - case 2: case 3: // read only - break; - case 4: - m_fdc.reg[offset & 0xf] = data; - m_fdc.track = data; - break; - case 5: - m_fdc.reg[offset & 0xf] = data; - m_fdc.sector = data; - break; - case 6: - m_fdc.reg[offset & 0xf] = data; - m_fdc.head = data; - break; - case 7: - m_fdc.buffer[m_fdc.cpu_pos++] = data; - break; - default: - m_fdc.reg[offset & 0xf] = data; - break; - } -} - -int c65_state::c65_fdc_r( int offset ) -{ - UINT8 data = 0; - switch (offset & 0xf) - { - case 0: - data = m_fdc.reg[0]; - break; - case 1: - data = m_fdc.reg[1]; - break; - case 2: - data = m_fdc.status; - break; - case 3: - data = m_fdc.status >> 8; - break; - case 4: - data = m_fdc.track; - break; - case 5: - data = m_fdc.sector; - break; - case 6: - data = m_fdc.head; - break; - case 7: - data = m_fdc.buffer[m_fdc.cpu_pos++]; - break; - default: - data = m_fdc.reg[offset & 0xf]; - break; - } - DBG_LOG(machine(), 1, "fdc read", ("%.5x %.2x %.2x\n", machine().device("maincpu")->safe_pc(), offset, data)); - return data; -} - -/* version 1 ramcheck - write 0:0 - read write read write 80000,90000,f0000 - write 0:8 - read write read write 80000,90000,f0000 - - version 2 ramcheck??? - read 0: - write 0:0 - read 0: - first read and second read bit 0x80 set --> nothing - write 0:0 - read 0 - write 0:ff -*/ - -READ8_MEMBER( c65_state::c65_ram_expansion_r ) -{ - UINT8 data = 0xff; - if (m_ram->size() > (128 * 1024)) - data = m_expansion_ram.reg; - return data; -} - -WRITE8_MEMBER( c65_state::c65_ram_expansion_w ) -{ - offs_t expansion_ram_begin; - offs_t expansion_ram_end; - - if (m_ram->size() > (128 * 1024)) - { - m_expansion_ram.reg = data; - - expansion_ram_begin = 0x80000; - expansion_ram_end = 0x80000 + (m_ram->size() - 128*1024) - 1; - - if (data == 0x00) { - space.install_readwrite_bank(expansion_ram_begin, expansion_ram_end,"bank16"); - membank("bank16")->set_base(m_ram->pointer() + 128*1024); - } else { - space.nop_readwrite(expansion_ram_begin, expansion_ram_end); - } - } -} - -WRITE8_MEMBER( c65_state::c65_write_io ) -{ - mos6581_device *sid_0 = machine().device("sid_r"); - mos6581_device *sid_1 = machine().device("sid_l"); - vic3_device *vic3 = machine().device("vic3"); - - switch (offset & 0xf00) - { - case 0x000: - if (offset < 0x80) - vic3->port_w(space, offset & 0x7f, data); - else if (offset < 0xa0) - c65_fdc_w(offset & 0x1f, data); - else - { - c65_ram_expansion_w(space, offset & 0x1f, data, mem_mask); - /*ram expansion crtl optional */ - } - break; - case 0x100: - case 0x200: - case 0x300: - vic3->palette_w(space, offset - 0x100, data); - break; - case 0x400: - if (offset<0x420) /* maybe 0x20 */ - sid_0->write(space, offset & 0x3f, data); - else if (offset<0x440) - sid_1->write(space, offset & 0x3f, data); - else - DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset, data)); - break; - case 0x500: - DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset, data)); - break; - case 0x600: - c65_6511_port_w(offset & 0xff,data); - break; - case 0x700: - c65_dma_port_w(offset & 0xff, data); - break; - } -} - -WRITE8_MEMBER( c65_state::c65_write_io_dc00 ) -{ - switch (offset & 0xf00) - { - case 0x000: - m_cia0->write(space, offset, data); - break; - case 0x100: - m_cia1->write(space, offset, data); - break; - case 0x200: - case 0x300: - DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset+0xc00, data)); - break; - } -} - -READ8_MEMBER( c65_state::c65_read_io ) -{ - mos6581_device *sid_0 = machine().device("sid_r"); - mos6581_device *sid_1 = machine().device("sid_l"); - vic3_device *vic3 = machine().device("vic3"); - - switch (offset & 0xf00) - { - case 0x000: - if (offset < 0x80) - return vic3->port_r(space, offset & 0x7f); - if (offset < 0xa0) - return c65_fdc_r(offset & 0x1f); - else - { - return c65_ram_expansion_r(space, offset & 0x1f, mem_mask); - /*return; ram expansion crtl optional */ - } - case 0x100: - case 0x200: - case 0x300: - /* read only !? */ - DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); - break; - case 0x400: - if (offset < 0x420) - return sid_0->read(space, offset & 0x3f); - if (offset < 0x440) - return sid_1->read(space, offset & 0x3f); - DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); - break; - case 0x500: - DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); - break; - case 0x600: - return c65_6511_port_r(offset&0xff); - case 0x700: - return c65_dma_port_r(offset&0xff); - } - return 0xff; -} - -READ8_MEMBER( c65_state::c65_read_io_dc00 ) -{ - switch (offset & 0x300) - { - case 0x000: - return m_cia0->read(space, offset); - case 0x100: - return m_cia1->read(space, offset); - case 0x200: - case 0x300: - DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset+0xc00)); - break; - } - return 0xff; -} - - -/* -d02f: - init a5 96 written (seems to be switch to c65 or vic3 mode) - go64 0 written -*/ - -/* bit 1 external sync enable (genlock) - bit 2 palette enable - bit 6 vic3 c65 character set */ -WRITE8_MEMBER(c65_state::c65_bankswitch_interface) -{ - DBG_LOG(machine(), 2, "c65 bankswitch", ("%.2x\n",data)); - - if (m_io_on) - { - if (data & 1) - { - membank("bank8")->set_base(m_colorram + 0x400); - membank("bank9")->set_base(m_colorram + 0x400); - m_maincpu->space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8"); - m_maincpu->space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9"); - } - else - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0dc00, 0x0dfff, read8_delegate(FUNC(c65_state::c65_read_io_dc00),this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x0dc00, 0x0dfff, write8_delegate(FUNC(c65_state::c65_write_io_dc00),this)); - } - } - - m_io_dc00_on = !(data & 1); -#if 0 - /* cartridge roms !?*/ - if (data & 0x08) - membank("bank1")->set_base(m_roml); - else - membank("bank1")->set_base(m_memory + 0x8000); - - if (data & 0x10) - membank("bank2")->set_base(m_basic); - else - membank("bank2")->set_base(m_memory + 0xa000); -#endif - if ((m_old_value^data) & 0x20) - { - /* bankswitching faulty when doing actual page */ - if (data & 0x20) - membank("bank3")->set_base(m_basic); - else - membank("bank3")->set_base(m_memory + 0xc000); - } - m_charset_select = data & 0x40; -#if 0 - /* cartridge roms !?*/ - if (data & 0x80) - membank("bank8")->set_base(m_kernal); - else - membank("bank6")->set_base(m_memory + 0xe000); -#endif - m_old_value = data; -} - -void c65_state::c65_bankswitch( ) -{ - int data, loram, hiram, charen; - - data = 0x00; // machine().device("maincpu")->get_port(); - if (data == m_old_data) - return; - - DBG_LOG(machine(), 1, "bankswitch", ("%d\n", data & 7)); - loram = (data & 1) ? 1 : 0; - hiram = (data & 2) ? 1 : 0; - charen = (data & 4) ? 1 : 0; - - if ((!m_game && m_exrom) || (loram && hiram && !m_exrom)) - membank("bank1")->set_base(m_roml); - else - membank("bank1")->set_base(m_memory + 0x8000); - - if ((!m_game && m_exrom && hiram) || (!m_exrom)) - membank("bank2")->set_base(m_romh); - else if (loram && hiram) - membank("bank2")->set_base(m_basic); - else - membank("bank2")->set_base(m_memory + 0xa000); - - if ((!m_game && m_exrom) || (charen && (loram || hiram))) - { - m_io_on = 1; - membank("bank6")->set_base(m_colorram); - membank("bank7")->set_base(m_colorram); - - if (m_io_dc00_on) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0dc00, 0x0dfff, read8_delegate(FUNC(c65_state::c65_read_io_dc00),this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x0dc00, 0x0dfff, write8_delegate(FUNC(c65_state::c65_write_io_dc00),this)); - } - else - { - m_maincpu->space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8"); - m_maincpu->space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9"); - membank("bank8")->set_base(m_colorram + 0x400); - membank("bank9")->set_base(m_colorram + 0x400); - } - m_maincpu->space(AS_PROGRAM).install_read_handler(0x0d000, 0x0d7ff, read8_delegate(FUNC(c65_state::c65_read_io),this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x0d000, 0x0d7ff, write8_delegate(FUNC(c65_state::c65_write_io),this)); - } - else - { - m_io_on = 0; - membank("bank5")->set_base(m_memory + 0xd000); - membank("bank7")->set_base(m_memory + 0xd800); - membank("bank9")->set_base(m_memory + 0xdc00); - if (!charen && (loram || hiram)) - { - membank("bank4")->set_base(m_chargen); - membank("bank6")->set_base(m_chargen + 0x800); - membank("bank8")->set_base(m_chargen + 0xc00); - } - else - { - membank("bank4")->set_base(m_memory + 0xd000); - membank("bank6")->set_base(m_memory + 0xd800); - membank("bank8")->set_base(m_memory + 0xdc00); - } - m_maincpu->space(AS_PROGRAM).install_read_bank(0x0d000, 0x0d7ff, "bank4"); - m_maincpu->space(AS_PROGRAM).install_write_bank(0x0d000, 0x0d7ff, "bank5"); - } - - if (!m_game && m_exrom) - { - membank("bank10")->set_base(m_romh); - } - else - { - if (hiram) - { - membank("bank10")->set_base(m_kernal); - } - else - { - membank("bank10")->set_base(m_memory + 0xe000); - } - } - m_old_data = data; -} - -#ifdef UNUSED_FUNCTION -void c65_state::c65_colorram_write( int offset, int value ) -{ - m_colorram[offset & 0x7ff] = value | 0xf0; -} -#endif - -/* - * only 14 address lines - * a15 and a14 portlines - * 0x1000-0x1fff, 0x9000-0x9fff char rom - */ -READ8_MEMBER(c65_state::c65_dma_read) -{ - if (!m_game && m_exrom) - { - if (offset < 0x3000) - return m_memory[offset]; - return m_romh[offset & 0x1fff]; - } - if ((m_vicaddr == m_memory) || (m_vicaddr == m_memory + 0x8000)) - { - if (offset < 0x1000) - return m_vicaddr[offset & 0x3fff]; - if (offset < 0x2000) { - if (m_charset_select) - return m_chargen[offset & 0xfff]; - else - return m_chargen[offset & 0xfff]; - } - return m_vicaddr[offset & 0x3fff]; - } - return m_vicaddr[offset & 0x3fff]; -} - -READ8_MEMBER(c65_state::c65_dma_read_color) -{ - if (m_c64mode) - return m_colorram[offset & 0x3ff] & 0xf; - return m_colorram[offset & 0x7ff]; -} - -void c65_state::c65_common_driver_init( ) -{ - m_memory = auto_alloc_array_clear(machine(), UINT8, 0x10000); - membank("bank11")->set_base(m_memory + 0x00000); - membank("bank12")->set_base(m_memory + 0x08000); - membank("bank13")->set_base(m_memory + 0x0a000); - membank("bank14")->set_base(m_memory + 0x0c000); - membank("bank15")->set_base(m_memory + 0x0e000); - - cbm_common_init(); - m_keyline = 0xff; - - m_pal = 0; - m_charset_select = 0; - m_6511_port = 0xff; - m_vicirq = 0; - m_old_data = -1; - - /* C65 had no datasette port */ - m_tape_on = 0; - m_game = 1; - m_exrom = 1; - - /*memset(m_memory + 0x40000, 0, 0x800000 - 0x40000); */ -} - -DRIVER_INIT_MEMBER(c65_state,c65) -{ - m_dma.version = 2; - c65_common_driver_init(); -} - -DRIVER_INIT_MEMBER(c65_state,c65pal) -{ - m_dma.version = 1; - c65_common_driver_init(); - m_pal = 1; -} - -MACHINE_START_MEMBER(c65_state,c65) -{ - /* clear upper memory */ - memset(m_ram->pointer() + 128*1024, 0xff, m_ram->size() - 128*1024); - -//removed cbm_drive_0_config (SERIAL, 10); -//removed cbm_drive_1_config (SERIAL, 11); - m_vicaddr = m_memory; - - m_c64mode = 0; - - c65_bankswitch_interface(m_maincpu->space(AS_PROGRAM),0,0xff); - c65_bankswitch(); -} - - -INTERRUPT_GEN_MEMBER(c65_state::c65_frame_interrupt) -{ - int value; - - c65_nmi(); - - /* common keys input ports */ - cbm_common_interrupt(&device); - - /* c65 specific: function keys input ports */ - value = 0xff; - - value &= ~ioport("FUNCT")->read(); - m_keyline = value; -} diff --git a/src/mess/machine/cbm_snqk.c b/src/mess/machine/cbm_snqk.c deleted file mode 100644 index e066aa8e262..00000000000 --- a/src/mess/machine/cbm_snqk.c +++ /dev/null @@ -1,100 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*********************************************** - - CBM Quickloads - - ***********************************************/ - -#include "emu.h" -#include "machine/cbm_snqk.h" - -/* prg file format - * sfx file format - * sda file format - * 0 lsb 16bit address - * 2 chip data */ - -/* p00 file format (p00 .. p63, s00 .. s63, ..) - * 0x0000 C64File - * 0x0007 0 - * 0x0008 Name in commodore encoding? - * 0x0018 0 0 - * 0x001a lsb 16bit address - * 0x001c data */ - - -int general_cbm_loadsnap( device_image_interface &image, const char *file_type, int snapshot_size, - address_space &space, offs_t offset, void (*cbm_sethiaddress)(address_space &space, UINT16 hiaddress) ) -{ - char buffer[7]; - dynamic_buffer data; - UINT32 bytesread; - UINT16 address = 0; - int i; - - if (!file_type) - goto error; - - if (!core_stricmp(file_type, "prg")) - { - /* prg files */ - } - else if (!core_stricmp(file_type, "p00")) - { - /* p00 files */ - if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer)) - goto error; - if (memcmp(buffer, "C64File", sizeof(buffer))) - goto error; - image.fseek(26, SEEK_SET); - snapshot_size -= 26; - } - else if (!core_stricmp(file_type, "t64")) - { - /* t64 files - for GB64 Single T64s loading to x0801 - header is always the same size */ - if (image.fread( buffer, sizeof(buffer)) != sizeof(buffer)) - goto error; - if (memcmp(buffer, "C64 tape image file", sizeof(buffer))) - goto error; - image.fseek(94, SEEK_SET); - snapshot_size -= 94; - } - else - { - goto error; - } - - image.fread( &address, 2); - address = LITTLE_ENDIANIZE_INT16(address); - if (!core_stricmp(file_type, "t64")) - address = 2049; - snapshot_size -= 2; - - data.resize(snapshot_size); - - bytesread = image.fread( &data[0], snapshot_size); - if (bytesread != snapshot_size) - goto error; - - for (i = 0; i < snapshot_size; i++) - space.write_byte(address + i + offset, data[i]); - - cbm_sethiaddress(space, address + snapshot_size); - return IMAGE_INIT_PASS; - -error: - return IMAGE_INIT_FAIL; -} - -void cbm_quick_sethiaddress( address_space &space, UINT16 hiaddress ) -{ - space.write_byte(0xae, hiaddress & 0xff); - space.write_byte(0x31, hiaddress & 0xff); - space.write_byte(0x2f, hiaddress & 0xff); - space.write_byte(0x2d, hiaddress & 0xff); - space.write_byte(0xaf, hiaddress >> 8); - space.write_byte(0x32, hiaddress >> 8); - space.write_byte(0x30, hiaddress >> 8); - space.write_byte(0x2e, hiaddress >> 8); -} diff --git a/src/mess/machine/cbm_snqk.h b/src/mess/machine/cbm_snqk.h deleted file mode 100644 index 3abfbf36309..00000000000 --- a/src/mess/machine/cbm_snqk.h +++ /dev/null @@ -1,21 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/*********************************************** - - CBM Quickloads - - ***********************************************/ - -#ifndef __CBM_SNQK_H__ -#define __CBM_SNQK_H__ - -#include "imagedev/snapquik.h" - -#define CBM_QUICKLOAD_DELAY_SECONDS 3 - -int general_cbm_loadsnap( device_image_interface &image, const char *file_type, int snapshot_size, - address_space &space, offs_t offset, void (*cbm_sethiaddress)(address_space &space, UINT16 hiaddress) ); - -void cbm_quick_sethiaddress( address_space &space, UINT16 hiaddress ); - -#endif /* __CBM_SNQK_H__ */ diff --git a/src/mess/machine/coco.c b/src/mess/machine/coco.c deleted file mode 100644 index f1177b8d9e8..00000000000 --- a/src/mess/machine/coco.c +++ /dev/null @@ -1,1387 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco.c - - TRS-80 Radio Shack Color Computer Family - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - - References: - There are two main references for the info for this driver - - Tandy Color Computer Unravelled Series - (http://www.giftmarket.org/unravelled/unravelled.shtml) - - Assembly Language Programming For the CoCo 3 by Laurence A. Tepolt - - Kevin K. Darlings GIME reference - (http://www.cris.com/~Alxevans/gime.txt) - - Sock Masters's GIME register reference - (http://www.axess.com/twilight/sock/gime.html) - - Robert Gault's FAQ - (http://home.att.net/~robert.gault/Coco/FAQ/FAQ_main.htm) - - Discussions with L. Curtis Boyle (LCB) and John Kowalski (JK) - - TODO: - - Implement unimplemented SAM registers - - Choose and implement more appropriate ratios for the speed up poke - - Handle resets correctly - - In the CoCo, all timings should be exactly relative to each other. This - table shows how all clocks are relative to each other (info: JK): - - Main CPU Clock 0.89 MHz - - Horizontal Sync Interrupt 15.7 kHz/63.5us (57 clock cycles) - - Vertical Sync Interrupt 60 Hz (14934 clock cycles) - - Composite Video Color Carrier 3.58 MHz/279ns (1/4 clock cycles) - - It is also noting that the CoCo 3 had two sets of VSync interrupts. To quote - John Kowalski: - - One other thing to mention is that the old vertical interrupt and the new - vertical interrupt are not the same.. The old one is triggered by the - video's vertical sync pulse, but the new one is triggered on the next scan - line *after* the last scan line of the active video display. That is : new - vertical interrupt triggers somewheres around scan line 230 of the 262 line - screen (if a 200 line graphics mode is used, a bit earlier if a 192 line - mode is used and a bit later if a 225 line mode is used). The old vsync - interrupt triggers on scanline zero. - - 230 is just an estimate [(262-200)/2+200]. I don't think the active part - of the screen is exactly centered within the 262 line total. I can - research that for you if you want an exact number for scanlines before the - screen starts and the scanline that the v-interrupt triggers..etc. - -Added bi-directional bitbanger support. Also fixed reading PIA 1, port A. The -DAC and bitbanger values written should be reflected in the read. - tim lindner, October 2010 - -***************************************************************************/ - -#include "includes/coco.h" -#include "cpu/m6809/m6809.h" -#include "debug/debugcpu.h" - - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -#define LOG_INTERRUPTS 0 - - - -//************************************************************************** -// BODY -//************************************************************************** - -//------------------------------------------------- -// ctor -//------------------------------------------------- - -coco_state::coco_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MAINCPU_TAG), - m_pia_0(*this, PIA0_TAG), - m_pia_1(*this, PIA1_TAG), - m_dac(*this, DAC_TAG), - m_wave(*this, WAVE_TAG), - m_cococart(*this, CARTRIDGE_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, "cassette"), - m_rs232(*this, RS232_TAG), - m_vhd_0(*this, VHD0_TAG), - m_vhd_1(*this, VHD1_TAG), - m_beckerport(*this, DWSOCK_TAG), - m_beckerportconfig(*this, BECKERPORT_TAG) -{ -} - - -//------------------------------------------------- -// analog_port_start -//------------------------------------------------- - -void coco_state::analog_port_start(analog_input_t *analog, const char *rx_tag, const char *ry_tag, const char *lx_tag, const char *ly_tag, const char *buttons_tag) -{ - analog->m_input[0][0] = ioport(rx_tag); - analog->m_input[0][1] = ioport(ry_tag); - analog->m_input[1][0] = ioport(lx_tag); - analog->m_input[1][1] = ioport(ly_tag); - analog->m_buttons = ioport(buttons_tag); -} - - - -//------------------------------------------------- -// device_start -//------------------------------------------------- - -void coco_state::device_start() -{ - /* call base device_start */ - driver_device::device_start(); - - /* look up keyboard ports */ - for (int i = 0; i < ARRAY_LENGTH(m_keyboard); i++) - { - char name[32]; - snprintf(name, ARRAY_LENGTH(name), "row%d", i); - m_keyboard[i] = ioport(name); - } - - /* look up analog ports */ - analog_port_start(&m_joystick, JOYSTICK_RX_TAG, JOYSTICK_RY_TAG, - JOYSTICK_LX_TAG, JOYSTICK_LY_TAG, JOYSTICK_BUTTONS_TAG); - analog_port_start(&m_rat_mouse, RAT_MOUSE_RX_TAG, RAT_MOUSE_RY_TAG, - RAT_MOUSE_LX_TAG, RAT_MOUSE_LY_TAG, RAT_MOUSE_BUTTONS_TAG); - analog_port_start(&m_diecom_lightgun, DIECOM_LIGHTGUN_RX_TAG, DIECOM_LIGHTGUN_RY_TAG, - DIECOM_LIGHTGUN_LX_TAG, DIECOM_LIGHTGUN_LY_TAG, DIECOM_LIGHTGUN_BUTTONS_TAG); - - /* look up miscellaneous controls */ - m_joystick_type_control = ioport(CTRL_SEL_TAG); - m_joystick_hires_control = ioport(HIRES_INTF_TAG); - - /* timers */ - m_hiresjoy_transition_timer[0] = timer_alloc(TIMER_HIRES_JOYSTICK_X); - m_hiresjoy_transition_timer[1] = timer_alloc(TIMER_HIRES_JOYSTICK_Y); - m_diecom_lightgun_timer = timer_alloc(TIMER_DIECOM_LIGHTGUN); - - /* cart base update */ - m_cococart->set_cart_base_update(cococart_base_update_delegate(FUNC(coco_state::update_cart_base), this)); - - /* save state support */ - save_item(NAME(m_dac_output)); - save_item(NAME(m_hiresjoy_ca)); - save_item(NAME(m_dclg_previous_bit)); - save_item(NAME(m_dclg_output_h)); - save_item(NAME(m_dclg_output_v)); - save_item(NAME(m_dclg_state)); - save_item(NAME(m_dclg_timer)); - save_item(NAME(m_vhd_select)); - - /* set up disassembly override */ - if (m_maincpu->debug()) - { - m_maincpu->debug()->set_dasm_override(dasm_override); - } - - // miscellaneous - m_in_floating_bus_read = false; -} - - - -//------------------------------------------------- -// device_reset -//------------------------------------------------- - -void coco_state::device_reset() -{ - /* call base device_start */ - driver_device::device_reset(); - - /* reset state */ - m_dac_output = 0; - m_analog_audio_level = 0; - m_hiresjoy_ca = false; - m_dclg_previous_bit = false; - m_dclg_output_h = 0; - m_dclg_output_v = 0; - m_dclg_state = 0; - m_dclg_timer = 0; - m_vhd_select = 0; -} - - - -//------------------------------------------------- -// device_timer -//------------------------------------------------- - -void coco_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_HIRES_JOYSTICK_X: - case TIMER_HIRES_JOYSTICK_Y: - case TIMER_DIECOM_LIGHTGUN: - poll_keyboard(); - break; - } -} - - - -//------------------------------------------------- -// floating_bus_read -//------------------------------------------------- -// -// From Darren A on the CoCo list: -// -// Whenever you read from an un-mapped hardware address or from an -// address where some of the bits are undefined (like the GIME's palette -// and MMU registers), the value obtained for those undefined bits is -// predictable on the CoCo. -// -// There are two possibilites which depend on the addressing mode you use -// to read from such an address. If you use the "no-offset" indexed mode -// (as in LDA ,X) the undefined bits will come from the first byte of the -// next instruction. For any other addressing mode, the undefined bits -// will come from the byte at $FFFF (LSB of the Reset vector). -// -// When you use BASIC's PEEK command to read from an un-mapped address -// (such as $FF70), you get a value of 126. This is because PEEK reads -// the address with a LDA ,X instruction, so the value returned is the -// opcode of the next instruction (JMP Extended = $7E = 126). If you -// patch the PEEK command to use a 5-bit offset (LDA 0,X), the value -// returned for an un-mapped address will instead come from $FFFF (27 on -// a CoCo 3 or 39 on a CoCo 1/2). -// -// The reason for this behavior is that the 6809 normally does a VMA -// cycle just before reading the instruction's effective address. The -// exception is the "no-offset" indexed mode in which case the next -// instruction byte is read just prior to the effective address. During -// a VMA cycle the address bus goes to Hi Impedance and the R/W line is -// HI. This has the effect of loading the value from $FFFF onto the data -// bus. This stale data from the previous cycle supplies the value for -// the undefined bits. -// -// Here is a small routine which will demonstrate this behavior: -// -// ldx #$FF70 -// lda ,x -// ldb $FF70 -// std $400 -// rts -// -// On a CoCo 3, you should end up with the value $F61B at $400-401. On a -// CoCo 1/2 you should get $F627 instead. -//------------------------------------------------- - -UINT8 coco_state::floating_bus_read(void) -{ - UINT8 result; - - // this method calls program.read_byte() - therefore we run the risk of a stack overflow if we don't check for - // a reentrant invocation - if (m_in_floating_bus_read) - { - // not sure what should really happen in this extremely degenerate scenario (the PC is probably - // in $FFxx never-never land), but I guess 0xFF is as good as anything. - result = 0xFF; - } - else - { - // prevent stack overflows - m_in_floating_bus_read = true; - - // set up the ability to read address spaces - address_space &program = m_maincpu->space(AS_PROGRAM); - - // get the previous and current PC - UINT16 prev_pc = m_maincpu->pcbase(); - UINT16 pc = m_maincpu->pc(); - - // get the byte; and skip over header bytes - UINT8 byte = program.read_byte(prev_pc); - if ((byte == 0x10) || (byte == 0x11)) - byte = program.read_byte(++prev_pc); - - // check to see if the opcode specifies the indexed addressing mode, and the secondary byte - // specifies no-offset - bool is_nooffset_indexed = (((byte & 0xF0) == 0x60) || ((byte & 0xF0) == 0xA0) || ((byte & 0xF0) == 0xE0)) - && ((program.read_byte(prev_pc + 1) & 0xBF) == 0x84); - - // finally read the byte - result = program.read_byte(is_nooffset_indexed ? pc : 0xFFFF); - - // we're done reading - m_in_floating_bus_read = false; - } - return result; -} - - - -/*************************************************************************** - PIA0 ($FF00-$FF1F) (Chip U8) - - PIA0 PA0-PA7 - Keyboard/Joystick read - PIA0 PB0-PB7 - Keyboard write - PIA0 CA1 - MC6847 HS (Horizontal Sync) - PIA0 CA2 - SEL1 (Used by sound mux and joystick) - PIA0 CB1 - MC6847 FS (Field Sync) - PIA0 CB2 - SEL2 (Used by sound mux and joystick) -***************************************************************************/ - -//------------------------------------------------- -// ff00_write -//------------------------------------------------- - -READ8_MEMBER( coco_state::ff00_read ) -{ - return m_pia_0->read(space, offset, mem_mask); -} - - - -//------------------------------------------------- -// ff00_write -//------------------------------------------------- - -WRITE8_MEMBER( coco_state::ff00_write ) -{ - m_pia_0->write(space, offset, data, mem_mask); -} - - - -//------------------------------------------------- -// pia0_pa_w -//------------------------------------------------- - -WRITE8_MEMBER( coco_state::pia0_pa_w ) -{ - poll_keyboard(); -} - - - -//------------------------------------------------- -// pia0_pb_w -//------------------------------------------------- - -WRITE8_MEMBER( coco_state::pia0_pb_w ) -{ - poll_keyboard(); -} - - - -//------------------------------------------------- -// pia0_ca2_w -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco_state::pia0_ca2_w ) -{ - update_sound(); // analog mux SEL1 is tied to PIA0 CA2 - poll_keyboard(); -} - - - -//------------------------------------------------- -// pia0_cb2_w -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco_state::pia0_cb2_w ) -{ - update_sound(); // analog mux SEL2 is tied to PIA0 CB2 - poll_keyboard(); -} - - - -//------------------------------------------------- -// pia0_irq_a -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco_state::pia0_irq_a ) -{ - recalculate_irq(); -} - - - -//------------------------------------------------- -// pia0_irq_b -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco_state::pia0_irq_b ) -{ - recalculate_irq(); -} - - - -/*************************************************************************** - PIA1 ($FF20-$FF3F) (Chip U4) - - PIA1 PA0 - CASSDIN - PIA1 PA1 - RS232 OUT (CoCo), Printer Strobe (Dragon) - PIA1 PA2-PA7 - DAC - PIA1 PB0 - RS232 IN - PIA1 PB1 - Single bit sound - PIA1 PB2 - RAMSZ (32/64K, 16K, and 4K three position switch) - PIA1 PB3 - M6847 CSS - PIA1 PB4 - M6847 INT/EXT and M6847 GM0 - PIA1 PB5 - M6847 GM1 - PIA1 PB6 - M6847 GM2 - PIA1 PB7 - M6847 A/G - PIA1 CA1 - CD (Carrier Detect; NYI) - PIA1 CA2 - CASSMOT (Cassette Motor) - PIA1 CB1 - CART (Cartridge Detect) - PIA1 CB2 - SNDEN (Sound Enable) -***************************************************************************/ - -//------------------------------------------------- -// ff20_read -//------------------------------------------------- - -READ8_MEMBER( coco_state::ff20_read ) -{ - return m_pia_1->read(space, offset, mem_mask); -} - - - -//------------------------------------------------- -// ff20_write -//------------------------------------------------- - -WRITE8_MEMBER( coco_state::ff20_write ) -{ - /* write to the PIA */ - m_pia_1->write(space, offset, data, mem_mask); - - /* we have to do this to do something that approximates the cartridge Q line behavior */ - m_cococart->twiddle_q_lines(); -} - - - -//------------------------------------------------- -// pia1_pa_r -//------------------------------------------------- - -READ8_MEMBER( coco_state::pia1_pa_r ) -{ - // Port A: we need to specify the values of all the lines, regardless of whether - // they are in input or output mode in the DDR - return (m_cassette->input() >= 0 ? 0x01 : 0x00) - | (dac_output() << 2); -} - - - -//------------------------------------------------- -// pia1_pb_r - this handles the reading of the -// memory sense switch (PB2) for the CoCo 1 and -// serial-in (PB0) -//------------------------------------------------- - -READ8_MEMBER( coco_state::pia1_pb_r ) -{ - // Port B: lines in output mode are handled automatically by the PIA object. - // We only need to specify the input lines here - UINT32 ram_size = m_ram->size(); - - // For the CoCo 1, the logic has been changed to only select 64K rams - // if there is more than 16K of memory, as the Color Basic 1.0 rom - // can only configure 4K or 16K ram banks (as documented in "Color - // Basic Unreveled"), doing this allows this allows the coco driver - // to access 32K of ram, and also allows the cocoe driver to access - // the full 64K, as this uses Color Basic 1.2, which can configure 64K rams - bool memory_sense = (ram_size >= 0x4000 && ram_size <= 0x7FFF) - || (ram_size >= 0x8000 && (m_pia_0->b_output() & 0x40)); - - // serial in (PB0) - bool serial_in = (m_rs232 != NULL) && (m_rs232->rxd_r() ? true : false); - - // composite the results - return (memory_sense ? 0x04 : 0x00) - | (serial_in ? 0x01 : 0x00); -} - - - -//------------------------------------------------- -// pia1_pa_w -//------------------------------------------------- - -WRITE8_MEMBER( coco_state::pia1_pa_w ) -{ - pia1_pa_changed(data); -} - - - -//------------------------------------------------- -// pia1_pb_w -//------------------------------------------------- - -WRITE8_MEMBER( coco_state::pia1_pb_w ) -{ - pia1_pb_changed(data); -} - - - -//------------------------------------------------- -// pia1_ca2_w -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco_state::pia1_ca2_w ) -{ - m_cassette->change_state( - state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, - CASSETTE_MASK_MOTOR); -} - - - -//------------------------------------------------- -// pia1_cb2_w -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco_state::pia1_cb2_w ) -{ - update_sound(); // SOUND_ENABLE is connected to PIA1 CB2 -} - - - -//------------------------------------------------- -// pia1_firq_a -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco_state::pia1_firq_a ) -{ - recalculate_firq(); -} - - - -//------------------------------------------------- -// pia1_firq_b -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco_state::pia1_firq_b ) -{ - recalculate_firq(); -} - - - -/*************************************************************************** - CPU INTERRUPTS - - The Dragon/CoCo2 have two PIAs. These PIAs can trigger interrupts. PIA0 - is set up to trigger IRQ on the CPU, and PIA1 can trigger FIRQ. Each PIA - has two output lines, and an interrupt will be triggered if either of these - lines are asserted. - - ----- IRQ - 6809 |-<----------- PIA0 - | - | - | - | - | - |-<----------- PIA1 - ----- - -***************************************************************************/ - -//------------------------------------------------- -// irq_get_line - gets the value of the FIRQ line -// passed into the CPU -//------------------------------------------------- - -bool coco_state::irq_get_line(void) -{ - return m_pia_0->irq_a_state() || m_pia_0->irq_b_state(); -} - - - -//------------------------------------------------- -// recalculate_irq -//------------------------------------------------- - -void coco_state::recalculate_irq(void) -{ - bool line = irq_get_line(); - if (LOG_INTERRUPTS) - logerror("recalculate_irq(): line=%d\n", line ? 1 : 0); - m_maincpu->set_input_line(M6809_IRQ_LINE, line ? ASSERT_LINE : CLEAR_LINE); -} - - - -//------------------------------------------------- -// firq_get_line - gets the value of the FIRQ line -// passed into the CPU -//------------------------------------------------- - -bool coco_state::firq_get_line(void) -{ - return m_pia_1->irq_a_state() || m_pia_1->irq_b_state(); -} - - - -//------------------------------------------------- -// recalculate_firq -//------------------------------------------------- - -void coco_state::recalculate_firq(void) -{ - bool line = firq_get_line(); - if (LOG_INTERRUPTS) - logerror("recalculate_firq(): line=%d\n", line ? 1 : 0); - m_maincpu->set_input_line(M6809_FIRQ_LINE, line ? ASSERT_LINE : CLEAR_LINE); -} - - - -/*************************************************************************** - SOUND / KEYBOARD / JOYSTICK - - The sound MUX has 4 possible settings, depend on SELA and SELB inputs: - - 00 - DAC (digital - analog converter) - 01 - CSN (cassette) - 10 - SND input from cartridge (NYI because we only support the FDC) - 11 - Grounded (0) - - Source - Tandy Color Computer Service Manual - - Note on the Dragon Alpha state 11, selects the AY-3-8912, this is currently - un-implemented - phs. - -***************************************************************************/ - -//------------------------------------------------- -// soundmux_status -//------------------------------------------------- - -coco_state::soundmux_status_t coco_state::soundmux_status(void) -{ - return (soundmux_status_t) ( - (snden() ? SOUNDMUX_ENABLE : 0) | - (sel1() ? SOUNDMUX_SEL1 : 0) | - (sel2() ? SOUNDMUX_SEL2 : 0)); -} - - - -//------------------------------------------------- -// update_sound -//------------------------------------------------- - -void coco_state::update_sound(void) -{ - /* PB1 will drive the sound output. This is a rarely - * used single bit sound mode. It is always connected thus - * cannot be disabled. - * - * Source: Page 31 of the Tandy Color Computer Serice Manual - */ - UINT8 single_bit_sound = (m_pia_1->b_output() & 0x02) ? 0x80 : 0x00; - - /* determine the sound mux status */ - soundmux_status_t status = soundmux_status(); - - /* the SC77526 DAC chip internally biases the AC-coupled sound inputs for Cassette and Cartridge at the midpoint of the 3.9v output range */ - bool bCassSoundEnable = (status == (SOUNDMUX_ENABLE | SOUNDMUX_SEL1)); - bool bCartSoundEnable = (status == (SOUNDMUX_ENABLE | SOUNDMUX_SEL2)); - UINT8 cassette_sound = (bCassSoundEnable ? 0x40 : 0); - UINT8 cart_sound = (bCartSoundEnable ? 0x40 : 0); - - /* determine the value to send to the DAC (this is used by the Joystick read as well as audio out) */ - m_dac_output = (m_pia_1->a_output() & 0xFC) >> 2; - UINT8 dac_sound = (status == SOUNDMUX_ENABLE ? m_dac_output << 1 : 0); - - /* The CoCo uses a single DAC for both audio output and joystick axis position measurement. - * To avoid introducing artifacts while reading the axis positions, some software will disable - * the audio output while using the DAC to read the joystick. On a real CoCo, there is a low-pass - * filter (C57 on the CoCo 3) which will hold the audio level for very short periods of time, - * preventing the introduction of artifacts while the joystick value is being read. We are not going - * to simulate the exponential decay of a capacitor here. Instead, we will store and hold the last - * used analog audio output value while the audio is disabled, to avoid introducing artifacts in - * software such as Tandy's Popcorn and Sock Master's Donkey Kong. - */ - if ((status & SOUNDMUX_ENABLE) != 0) - { - m_analog_audio_level = dac_sound + cassette_sound + cart_sound; - } - - m_dac->write_unsigned8(single_bit_sound + m_analog_audio_level); - - /* determine the cassette sound status */ - cassette_state cas_sound = bCassSoundEnable ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED; - m_cassette->change_state(cas_sound, CASSETTE_MASK_SPEAKER); - - /* determine the cartridge sound status */ - m_cococart->cart_set_line(COCOCART_LINE_SOUND_ENABLE, bCartSoundEnable ? COCOCART_LINE_VALUE_ASSERT : COCOCART_LINE_VALUE_CLEAR); -} - - - -//------------------------------------------------- -// joystick_type - returns the type of joystick -// in the specified port -//------------------------------------------------- - -coco_state::joystick_type_t coco_state::joystick_type(int index) -{ - assert((index == 0) || (index == 1)); - return (m_joystick_type_control != NULL) - ? (joystick_type_t) ((m_joystick_type_control->read() >> (index * 4)) & 0x0F) - : JOYSTICK_NONE; -} - - - -//------------------------------------------------- -// hires_interface_type -//------------------------------------------------- - -coco_state::hires_type_t coco_state::hires_interface_type(void) -{ - return (m_joystick_hires_control != NULL) - ? (hires_type_t) m_joystick_hires_control->read() - : HIRES_NONE; -} - - - -//------------------------------------------------- -// is_joystick_hires -//------------------------------------------------- - -bool coco_state::is_joystick_hires(int joystick_index) -{ - bool result; - assert((joystick_index == 0) || (joystick_index == 1)); - - switch(hires_interface_type()) - { - case HIRES_RIGHT: - case HIRES_RIGHT_COCOMAX3: - result = (joystick_index == 0); - break; - - case HIRES_LEFT: - case HIRES_LEFT_COCOMAX3: - result = (joystick_index == 1); - break; - - default: - result = false; - break; - } - return result; -} - - - -//------------------------------------------------- -// poll_joystick -//------------------------------------------------- - -void coco_state::poll_joystick(bool *joyin, UINT8 *buttons) -{ - static const analog_input_t s_empty = {}; - static const int joy_rat_table[] = {15, 24, 42, 33 }; - static const int dclg_table[] = {0, 14, 30, 49 }; - - /* identify the joystick and axis */ - int joystick_axis = sel1() ? 1 : 0; - int joystick = sel2() ? 1 : 0; - - /* determine the JOYIN value */ - const analog_input_t *analog; - bool joyin_value; - UINT8 joyval; - int dclg_vpos; - switch(joystick_type(joystick)) - { - case JOYSTICK_NORMAL: - analog = &m_joystick; - - /* is any Hi-Res Interface turned on? prepare masks to check it */ - if (is_joystick_hires(joystick)) - { - /* hi-res joystick or hi-res CoCo3Max joystick */ - attotime remaining = m_hiresjoy_transition_timer[joystick_axis]->remaining(); - joyin_value = remaining.is_zero() || remaining.is_never(); - } - else - { - /* conventional joystick */ - joyval = analog->input(joystick, joystick_axis); - joyin_value = (dac_output() <= (joyval >> 2)); - } - break; - - case JOYSTICK_RAT_MOUSE: - analog = &m_rat_mouse; - joyval = analog->input(joystick, joystick_axis); - joyin_value = dac_output() <= joy_rat_table[joyval]; - break; - - case JOYSTICK_DIECOM_LIGHT_GUN: - analog = &m_diecom_lightgun; - - /* get the vertical position of the lightgun */ - dclg_vpos = analog->input(joystick, 1); - - if (machine().first_screen()->vpos() == dclg_vpos) - { - /* if gun is pointing at the current scan line, set hit bit and cache horizontal timer value */ - m_dclg_output_h |= 0x02; - m_dclg_timer = analog->input(joystick, 0) << 1; - } - - joyin_value = (dac_output() <= dclg_table[(joystick_axis ? m_dclg_output_h : m_dclg_output_v) & 0x03]); - - if (m_dclg_state == 7) - { - /* while in state 7, prepare to check next video frame for a hit */ - attotime dclg_time = machine().first_screen()->time_until_pos(dclg_vpos, 0); - m_diecom_lightgun_timer->adjust(dclg_time); - } - break; - - default: /* None */ - analog = &s_empty; - joyin_value = false; - break; - } - - *joyin = joyin_value; - *buttons = analog->buttons(); -} - - - -//------------------------------------------------- -// poll_keyboard -//------------------------------------------------- - -void coco_state::poll_keyboard(void) -{ - UINT8 pia0_pb = m_pia_0->b_output(); - UINT8 pia0_pb_z = m_pia_0->port_b_z_mask(); - - UINT8 pia0_pa = 0x7F; - UINT8 pia0_pa_z = 0x7F; - - /* poll the keyboard, and update PA6-PA0 accordingly*/ - for (int i = 0; i < ARRAY_LENGTH(m_keyboard); i++) - { - int value = m_keyboard[i]->read(); - if ((value | pia0_pb) != 0xFF) - { - pia0_pa &= ~(0x01 << i); - } - if ((value | pia0_pb_z) != 0xFF) - { - pia0_pa_z &= ~(0x01 << i); - } - } - - /* hires joystick */ - poll_hires_joystick(); - - /* poll the joystick (*/ - bool joyin; - UINT8 buttons; - poll_joystick(&joyin, &buttons); - - /* PA7 comes from JOYIN */ - pia0_pa |= joyin ? 0x80 : 0x00; - - /* mask out the buttons */ - pia0_pa &= ~buttons; - pia0_pa_z &= ~buttons; - - /* and write the result to PIA0 */ - update_keyboard_input(pia0_pa, pia0_pa_z); -} - - - -//------------------------------------------------- -// update_keyboard_input - writes to PIA0 PA, but -// on the CoCo 3 controls a GIME input -//------------------------------------------------- - -void coco_state::update_keyboard_input(UINT8 value, UINT8 z) -{ - m_pia_0->set_a_input(value, z); -} - - - -//------------------------------------------------- -// update_cassout - called when CASSOUT changes -//------------------------------------------------- - -void coco_state::update_cassout(int cassout) -{ - m_cassette->output((cassout - 0x20) / 32.0); -} - - - -//------------------------------------------------- -// diecom_lightgun_clock - called the diecom -// lightgun undergoes a high to low transition -//------------------------------------------------- - -void coco_state::diecom_lightgun_clock(void) -{ - /* clock Diecom Light gun interface on a high to low transistion */ - m_dclg_state++; - m_dclg_state &= 0x0f; - - /* clear hit bit for every transistion */ - m_dclg_output_h &= ~0x02; - - if (m_dclg_state > 7) - { - /* Bit shift timer data on state 8 thru 15 */ - if (((m_dclg_timer >> (m_dclg_state - 8 + 1)) & 0x01) == 1) - m_dclg_output_v |= 0x01; - else - m_dclg_output_v &= ~0x01; - - /* Bit 9 of timer is only avaiable if state == 8*/ - if (m_dclg_state == 8 && (((m_dclg_timer >> 9) & 0x01) == 1)) - m_dclg_output_v |= 0x02; - else - m_dclg_output_v &= ~0x02; - } - - /* During state 15, this bit is high. */ - if (m_dclg_state == 15) - m_dclg_output_h |= 0x01; - else - m_dclg_output_h &= ~0x01; -} - - - -//------------------------------------------------- -// update_prinout - called when PRINOUT changes -//------------------------------------------------- - -void coco_state::update_prinout(bool prinout) -{ - if ((joystick_type(0) == JOYSTICK_DIECOM_LIGHT_GUN) || (joystick_type(1) == JOYSTICK_DIECOM_LIGHT_GUN)) - { - /* printer port is connected to diecom light gun */ - if (m_dclg_previous_bit && !prinout) - { - diecom_lightgun_clock(); - } - m_dclg_previous_bit = prinout; - } - else - { - /* output bitbanger if present (only on CoCos) */ - if (m_rs232 != NULL) - { - m_rs232->write_txd(prinout ? 1 : 0); - } - } -} - - - -//------------------------------------------------- -// pia1_pa_changed - called when PIA1 PA changes -//------------------------------------------------- - -void coco_state::pia1_pa_changed(UINT8 data) -{ - update_sound(); // DAC is connected to PIA1 PA2-PA7 - poll_keyboard(); - update_cassout(dac_output()); - update_prinout(data & 0x02 ? true : false); -} - - - -//------------------------------------------------- -// pia1_pb_changed - called when PIA1 PB changes -//------------------------------------------------- - -void coco_state::pia1_pb_changed(UINT8 data) -{ - update_sound(); // singe_bit_sound is connected to PIA1 PB1 -} - - - -//------------------------------------------------- -// keyboard_changed -//------------------------------------------------- - -INPUT_CHANGED_MEMBER(coco_state::keyboard_changed) -{ - poll_keyboard(); -} - - - -//------------------------------------------------- -// joystick_mode_changed -//------------------------------------------------- - -INPUT_CHANGED_MEMBER(coco_state::joystick_mode_changed) -{ - poll_keyboard(); -} - -//------------------------------------------------- -// poll_hires_joystick -//------------------------------------------------- - -void coco_state::poll_hires_joystick(void) -{ - bool newvalue; - bool is_cocomax3; - int joystick_index, axis; - - /* we do different things based on the type of hires interface */ - switch(hires_interface_type()) - { - case HIRES_RIGHT: - newvalue = (dac_output() >= 0x20); - joystick_index = 0; - is_cocomax3 = false; - break; - - case HIRES_RIGHT_COCOMAX3: - newvalue = (m_pia_0->a_output() & 0x04); - joystick_index = 0; - is_cocomax3 = true; - break; - - case HIRES_LEFT: - newvalue = (dac_output() >= 0x20); - joystick_index = 1; - is_cocomax3 = false; - break; - - case HIRES_LEFT_COCOMAX3: - newvalue = (m_pia_0->a_output() & 0x08); - joystick_index = 1; - is_cocomax3 = true; - break; - - default: - newvalue = true; - joystick_index = -1; - is_cocomax3 = false; - break; - } - - /* if the joystick isn't selected, newvalue is true */ - newvalue = newvalue || (joystick_index < 0) || (joystick_type(joystick_index) != JOYSTICK_NORMAL); - - /* make the transition */ - for (axis = 0; axis <= 1; axis++) - { - if (m_hiresjoy_ca && !newvalue) - { - /* hi to lo */ - double value = m_joystick.input(joystick_index, axis) / 255.0; - value *= is_cocomax3 ? 2500.0 : 4160.0; - value += is_cocomax3 ? 400.0 : 592.0; - attotime duration = m_maincpu->clocks_to_attotime((UINT64) value) * 8; - m_hiresjoy_transition_timer[axis]->adjust(duration); - } - else if (!m_hiresjoy_ca && newvalue) - { - /* lo to hi */ - m_hiresjoy_transition_timer[axis]->reset(); - } - } - m_hiresjoy_ca = newvalue; -} - - - -/*************************************************************************** - VHD - ***************************************************************************/ - -//------------------------------------------------- -// current_vhd -//------------------------------------------------- - -coco_vhd_image_device *coco_state::current_vhd(void) -{ - switch(m_vhd_select) - { - case 0: return m_vhd_0; - case 1: return m_vhd_1; - default: return NULL; - } -} - - - -//------------------------------------------------- -// ff60_read -//------------------------------------------------- - -READ8_MEMBER( coco_state::ff60_read ) -{ - UINT8 result; - - if ((current_vhd() != NULL) && (offset >= 32) && (offset <= 37)) - { - result = current_vhd()->read(offset - 32); - } - else - { - result = floating_bus_read(); - } - - return result; -} - - - -//------------------------------------------------- -// ff60_write -//------------------------------------------------- - -WRITE8_MEMBER( coco_state::ff60_write ) -{ - if ((current_vhd() != NULL) && (offset >= 32) && (offset <= 37)) - { - current_vhd()->write(offset - 32, data); - } - else if (offset == 38) - { - /* writes to $FF86 will switch the VHD */ - m_vhd_select = data; - } -} - - - -/*************************************************************************** - CARTRIDGE & CASSETTE - ***************************************************************************/ - -//------------------------------------------------- -// ff40_read -//------------------------------------------------- - -READ8_MEMBER( coco_state::ff40_read ) -{ - if (offset >= 1 && offset <= 2 && m_beckerportconfig && m_beckerportconfig->read() == 1) - { - return m_beckerport->read(space, offset-1, mem_mask); - } - - return m_cococart->read(space, offset, mem_mask); -} - - - -//------------------------------------------------- -// ff40_write -//------------------------------------------------- - -WRITE8_MEMBER( coco_state::ff40_write ) -{ - if (offset >= 1 && offset <= 2 && m_beckerportconfig && m_beckerportconfig->read() == 1) - { - return m_beckerport->write(space, offset-1, data, mem_mask); - } - - m_cococart->write(space, offset, data, mem_mask); -} - - - -//------------------------------------------------- -// cart_w -//------------------------------------------------- - -void coco_state::cart_w(bool state) -{ - m_pia_1->cb1_w(state); -} - -/*************************************************************************** - DISASSEMBLY OVERRIDE (OS9 syscalls) - ***************************************************************************/ - -static const char *const os9syscalls[] = -{ - "F$Link", /* Link to Module */ - "F$Load", /* Load Module from File */ - "F$UnLink", /* Unlink Module */ - "F$Fork", /* Start New Process */ - "F$Wait", /* Wait for Child Process to Die */ - "F$Chain", /* Chain Process to New Module */ - "F$Exit", /* Terminate Process */ - "F$Mem", /* Set Memory Size */ - "F$Send", /* Send Signal to Process */ - "F$Icpt", /* Set Signal Intercept */ - "F$Sleep", /* Suspend Process */ - "F$SSpd", /* Suspend Process */ - "F$ID", /* Return Process ID */ - "F$SPrior", /* Set Process Priority */ - "F$SSWI", /* Set Software Interrupt */ - "F$PErr", /* Print Error */ - "F$PrsNam", /* Parse Pathlist Name */ - "F$CmpNam", /* Compare Two Names */ - "F$SchBit", /* Search Bit Map */ - "F$AllBit", /* Allocate in Bit Map */ - "F$DelBit", /* Deallocate in Bit Map */ - "F$Time", /* Get Current Time */ - "F$STime", /* Set Current Time */ - "F$CRC", /* Generate CRC */ - "F$GPrDsc", /* get Process Descriptor copy */ - "F$GBlkMp", /* get System Block Map copy */ - "F$GModDr", /* get Module Directory copy */ - "F$CpyMem", /* Copy External Memory */ - "F$SUser", /* Set User ID number */ - "F$UnLoad", /* Unlink Module by name */ - "F$Alarm", /* Color Computer Alarm Call (system wide) */ - NULL, - NULL, - "F$NMLink", /* Color Computer NonMapping Link */ - "F$NMLoad", /* Color Computer NonMapping Load */ - NULL, - NULL, - "F$TPS", /* Return System's Ticks Per Second */ - "F$TimAlm", /* COCO individual process alarm call */ - "F$VIRQ", /* Install/Delete Virtual IRQ */ - "F$SRqMem", /* System Memory Request */ - "F$SRtMem", /* System Memory Return */ - "F$IRQ", /* Enter IRQ Polling Table */ - "F$IOQu", /* Enter I/O Queue */ - "F$AProc", /* Enter Active Process Queue */ - "F$NProc", /* Start Next Process */ - "F$VModul", /* Validate Module */ - "F$Find64", /* Find Process/Path Descriptor */ - "F$All64", /* Allocate Process/Path Descriptor */ - "F$Ret64", /* Return Process/Path Descriptor */ - "F$SSvc", /* Service Request Table Initialization */ - "F$IODel", /* Delete I/O Module */ - "F$SLink", /* System Link */ - "F$Boot", /* Bootstrap System */ - "F$BtMem", /* Bootstrap Memory Request */ - "F$GProcP", /* Get Process ptr */ - "F$Move", /* Move Data (low bound first) */ - "F$AllRAM", /* Allocate RAM blocks */ - "F$AllImg", /* Allocate Image RAM blocks */ - "F$DelImg", /* Deallocate Image RAM blocks */ - "F$SetImg", /* Set Process DAT Image */ - "F$FreeLB", /* Get Free Low Block */ - "F$FreeHB", /* Get Free High Block */ - "F$AllTsk", /* Allocate Process Task number */ - "F$DelTsk", /* Deallocate Process Task number */ - "F$SetTsk", /* Set Process Task DAT registers */ - "F$ResTsk", /* Reserve Task number */ - "F$RelTsk", /* Release Task number */ - "F$DATLog", /* Convert DAT Block/Offset to Logical */ - "F$DATTmp", /* Make temporary DAT image (Obsolete) */ - "F$LDAXY", /* Load A [X,[Y]] */ - "F$LDAXYP", /* Load A [X+,[Y]] */ - "F$LDDDXY", /* Load D [D+X,[Y]] */ - "F$LDABX", /* Load A from 0,X in task B */ - "F$STABX", /* Store A at 0,X in task B */ - "F$AllPrc", /* Allocate Process Descriptor */ - "F$DelPrc", /* Deallocate Process Descriptor */ - "F$ELink", /* Link using Module Directory Entry */ - "F$FModul", /* Find Module Directory Entry */ - "F$MapBlk", /* Map Specific Block */ - "F$ClrBlk", /* Clear Specific Block */ - "F$DelRAM", /* Deallocate RAM blocks */ - "F$GCMDir", /* Pack module directory */ - "F$AlHRam", /* Allocate HIGH RAM Blocks */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "F$RegDmp", /* Ron Lammardo's debugging register dump call */ - "F$NVRAM", /* Non Volatile RAM (RTC battery backed static) read/write */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "I$Attach", /* Attach I/O Device */ - "I$Detach", /* Detach I/O Device */ - "I$Dup", /* Duplicate Path */ - "I$Create", /* Create New File */ - "I$Open", /* Open Existing File */ - "I$MakDir", /* Make Directory File */ - "I$ChgDir", /* Change Default Directory */ - "I$Delete", /* Delete File */ - "I$Seek", /* Change Current Position */ - "I$Read", /* Read Data */ - "I$Write", /* Write Data */ - "I$ReadLn", /* Read Line of ASCII Data */ - "I$WritLn", /* Write Line of ASCII Data */ - "I$GetStt", /* Get Path Status */ - "I$SetStt", /* Set Path Status */ - "I$Close", /* Close Path */ - "I$DeletX" /* Delete from current exec dir */ -}; - - -offs_t coco_state::dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) -{ - unsigned call; - unsigned result = 0; - - /* check for SWI2 instruction */ - if ((oprom[0] == 0x10) && (oprom[1] == 0x3F)) - { - call = oprom[2]; - if ((call < ARRAY_LENGTH(os9syscalls)) && os9syscalls[call]) - { - sprintf(buffer, "OS9 %s", os9syscalls[call]); - result = 3; - } - } - return result; -} diff --git a/src/mess/machine/coco12.c b/src/mess/machine/coco12.c deleted file mode 100644 index e2f3fbdb521..00000000000 --- a/src/mess/machine/coco12.c +++ /dev/null @@ -1,119 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco12.c - - TRS-80 Radio Shack Color Computer 1/2 Family - -***************************************************************************/ - -#include "includes/coco12.h" - -//------------------------------------------------- -// device_start -//------------------------------------------------- - -void coco12_state::device_start() -{ - coco_state::device_start(); - configure_sam(); -} - - - -//------------------------------------------------- -// configure_sam -//------------------------------------------------- - -void coco12_state::configure_sam() -{ - cococart_slot_device *cart = m_cococart; - UINT8 *ram = m_ram->pointer(); - UINT32 ram_size = m_ram->size(); - UINT8 *rom = memregion(MAINCPU_TAG)->base(); - UINT8 *cart_rom = cart->get_cart_base(); - - m_sam->configure_bank(0, ram, ram_size, false); // $0000-$7FFF - m_sam->configure_bank(1, &rom[0x0000], 0x2000, true); // $8000-$9FFF - m_sam->configure_bank(2, &rom[0x2000], 0x2000, true); // $A000-$BFFF - m_sam->configure_bank(3, cart_rom, 0x4000, true); // $C000-$FEFF - - // $FF00-$FF1F - m_sam->configure_bank(4, read8_delegate(FUNC(coco12_state::ff00_read), this), write8_delegate(FUNC(coco12_state::ff00_write), this)); - - // $FF20-$FF3F - m_sam->configure_bank(5, read8_delegate(FUNC(coco12_state::ff20_read), this), write8_delegate(FUNC(coco12_state::ff20_write), this)); - - // $FF40-$FF5F - m_sam->configure_bank(6, read8_delegate(FUNC(coco12_state::ff40_read), this), write8_delegate(FUNC(coco12_state::ff40_write), this)); - - // $FF60-$FFBF - m_sam->configure_bank(7, read8_delegate(FUNC(coco12_state::ff60_read), this), write8_delegate(FUNC(coco12_state::ff60_write), this)); -} - - -//------------------------------------------------- -// horizontal_sync -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco12_state::horizontal_sync ) -{ - m_pia_0->ca1_w(state); - m_sam->hs_w(state); -} - - - -//------------------------------------------------- -// field_sync -//------------------------------------------------- - -WRITE_LINE_MEMBER( coco12_state::field_sync ) -{ - m_pia_0->cb1_w(state); -} - - - -//------------------------------------------------- -// sam_read -//------------------------------------------------- - -READ8_MEMBER( coco12_state::sam_read ) -{ - UINT8 data = m_ram->read(offset); - m_vdg->as_w(data & 0x80 ? ASSERT_LINE : CLEAR_LINE); - m_vdg->inv_w(data & 0x40 ? ASSERT_LINE : CLEAR_LINE); - return data; -} - - - -//------------------------------------------------- -// pia1_pb_changed -//------------------------------------------------- - -void coco12_state::pia1_pb_changed(UINT8 data) -{ - /* call inherited function */ - coco_state::pia1_pb_changed(data); - - m_vdg->css_w(data & 0x08); - m_vdg->intext_w(data & 0x10); - m_vdg->gm0_w(data & 0x10); - m_vdg->gm1_w(data & 0x20); - m_vdg->gm2_w(data & 0x40); - m_vdg->ag_w(data & 0x80); -} - - - -//------------------------------------------------- -// update_cart_base -//------------------------------------------------- - -void coco12_state::update_cart_base(UINT8 *cart_base) -{ - m_sam->configure_bank(3, cart_base, 0x4000, true); // $C000-$FEFF -} diff --git a/src/mess/machine/coco3.c b/src/mess/machine/coco3.c deleted file mode 100644 index 40624853dec..00000000000 --- a/src/mess/machine/coco3.c +++ /dev/null @@ -1,167 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco3.c - - TRS-80 Radio Shack Color Computer 3 - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - - The Dragon/CoCo2 have two PIAs. These PIAs can trigger interrupts. PIA0 - is set up to trigger IRQ on the CPU, and PIA1 can trigger FIRQ. Each PIA - has two output lines, and an interrupt will be triggered if either of these - lines are asserted. - - ----- IRQ - 6809 |-<----------- PIA0 - | - | - | - | - | - |-<----------- PIA1 - ----- - - The CoCo 3 still supports these interrupts, but the GIME can chose whether - "old school" interrupts are generated, or the new ones generated by the GIME - - ----- IRQ - 6809 |-<----------- PIA0 - | | ------ - | -<-------<-------| | - | |GIME| - | -<-------<-------| | - | FIRQ | ------ - |-<----------- PIA1 - ----- - - In an email discussion with JK, he informs me that when GIME interrupts are - enabled, this actually does not prevent PIA interrupts. Apparently JeffV's - CoCo 3 emulator did not handle this properly. - -***************************************************************************/ - -#include "includes/coco3.h" - -//------------------------------------------------- -// ff20_write -//------------------------------------------------- - -WRITE8_MEMBER( coco3_state::ff20_write ) -{ - coco_state::ff20_write(space, offset, data, mem_mask); - - if (offset == 0x02) - m_gime->ff22_write(data); -} - - - -//------------------------------------------------- -// ff40_read -//------------------------------------------------- - -READ8_MEMBER( coco3_state::ff40_read ) -{ - UINT8 result = 0x00; - if (m_gime->spare_chip_select_enabled()) - result = coco_state::ff40_read(space, offset, mem_mask); - return result; -} - - - -//------------------------------------------------- -// ff40_write -//------------------------------------------------- - -WRITE8_MEMBER( coco3_state::ff40_write ) -{ - if (m_gime->spare_chip_select_enabled()) - coco_state::ff40_write(space, offset, data, mem_mask); -} - - - -//------------------------------------------------- -// firq_get_line -//------------------------------------------------- - -bool coco3_state::firq_get_line(void) -{ - return coco_state::firq_get_line() || m_gime->firq_r(); -} - - - -//------------------------------------------------- -// irq_get_line -//------------------------------------------------- - -bool coco3_state::irq_get_line(void) -{ - return coco_state::irq_get_line() || m_gime->irq_r(); -} - - - -//------------------------------------------------- -// update_keyboard_input -//------------------------------------------------- - -void coco3_state::update_keyboard_input(UINT8 value, UINT8 z) -{ - coco_state::update_keyboard_input(value, z); - m_gime->set_il1(value == 0xFF); -} - - - -//------------------------------------------------- -// cart_w -//------------------------------------------------- - -void coco3_state::cart_w(bool state) -{ - coco_state::cart_w(state); - m_gime->set_il0(state); -} - - - -//------------------------------------------------- -// update_cart_base -//------------------------------------------------- - -void coco3_state::update_cart_base(UINT8 *cart_base) -{ - m_gime->update_cart_rom(); -} - - - -//------------------------------------------------- -// screen_update -//------------------------------------------------- - -UINT32 coco3_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - bool result; - if (!strcmp(screen.tag(), ":" COMPOSITE_SCREEN_TAG)) - { - /* composite screen */ - result = m_gime->update_composite(bitmap, cliprect); - } - else if (!strcmp(screen.tag(), ":" RGB_SCREEN_TAG)) - { - /* rgb screen */ - result = m_gime->update_rgb(bitmap, cliprect); - } - else - { - fatalerror("Called screen_update() with invalid tag '%s'\n", screen.tag()); - } - return result; -} diff --git a/src/mess/machine/coco_vhd.c b/src/mess/machine/coco_vhd.c deleted file mode 100644 index 0510ce469ff..00000000000 --- a/src/mess/machine/coco_vhd.c +++ /dev/null @@ -1,281 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco_vhd.c - - Color Computer Virtual Hard Drives - -**************************************************************************** - - Technical specs on the Virtual Hard Disk interface - - Address Description - ------- ----------- - FF80 Logical record number (high byte) - FF81 Logical record number (middle byte) - FF82 Logical record number (low byte) - FF83 Command/status register - FF84 Buffer address (high byte) - FF85 Buffer address (low byte) - - Set the other registers, and then issue a command to FF83 as follows: - - 0 = read 256-byte sector at LRN - 1 = write 256-byte sector at LRN - 2 = flush write cache (Closes and then opens the image file) - - Error values: - - 0 = no error - -1 = power-on state (before the first command is received) - -2 = invalid command - 2 = VHD image does not exist - 4 = Unable to open VHD image file - 5 = access denied (may not be able to write to VHD image) - - IMPORTANT: The I/O buffer must NOT cross an 8K MMU bank boundary. - - ***************************************************************************/ - -#include "emu.h" -#include "coco_vhd.h" -#include "includes/coco.h" -#include "machine/ram.h" - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define VERBOSE 1 - -#define VHDSTATUS_OK 0x00 -#define VHDSTATUS_NO_VHD_ATTACHED 0x02 -#define VHDSTATUS_ACCESS_DENIED 0x05 -#define VHDSTATUS_UNKNOWN_COMMAND 0xFE -#define VHDSTATUS_POWER_ON_STATE 0xFF - -#define VHDCMD_READ 0 -#define VHDCMD_WRITE 1 -#define VHDCMD_FLUSH 2 - - -/*************************************************************************** - CORE IMPLEMENTATION -***************************************************************************/ - -const device_type COCO_VHD = &device_creator; - -//------------------------------------------------- -// coco_vhd_image_device - constructor -//------------------------------------------------- - -coco_vhd_image_device::coco_vhd_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, COCO_VHD, "Virtual Hard Disk", tag, owner, clock, "coco_vhd_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// coco_vhd_image_device - destructor -//------------------------------------------------- - -coco_vhd_image_device::~coco_vhd_image_device() -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void coco_vhd_image_device::device_config_complete() -{ - // set brief and instance name - update_names(); -} - - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void coco_vhd_image_device::device_start() -{ - m_status = VHDSTATUS_NO_VHD_ATTACHED; - m_cpu = machine().device(MAINCPU_TAG); - m_cpu_space = &m_cpu->space(AS_PROGRAM); -} - - - -//------------------------------------------------- -// call_load -//------------------------------------------------- - -bool coco_vhd_image_device::call_load() -{ - m_status = VHDSTATUS_POWER_ON_STATE; - m_logical_record_number = 0; - m_buffer_address = 0; - return IMAGE_INIT_PASS; -} - - - -//------------------------------------------------- -// coco_vhd_readwrite -//------------------------------------------------- - -void coco_vhd_image_device::coco_vhd_readwrite(UINT8 data) -{ - int result, i; - UINT32 bytes_to_read; - UINT32 bytes_to_write; - UINT64 seek_position; - UINT64 total_size; - char buffer[1024]; - - /* access the image */ - if (!exists()) - { - m_status = VHDSTATUS_NO_VHD_ATTACHED; - return; - } - - /* perform the seek */ - seek_position = ((UINT64) 256) * m_logical_record_number; - total_size = length(); - result = fseek(MIN(seek_position, total_size), SEEK_SET); - if (result < 0) - { - m_status = VHDSTATUS_ACCESS_DENIED; - return; - } - - /* expand the disk, if necessary */ - if (data == VHDCMD_WRITE) - { - while(total_size < seek_position) - { - memset(buffer, 0, sizeof(buffer)); - - bytes_to_write = (UINT32) MIN(seek_position - total_size, (UINT64) sizeof(buffer)); - result = fwrite(buffer, bytes_to_write); - if (result != bytes_to_write) - { - m_status = VHDSTATUS_ACCESS_DENIED; - return; - } - - total_size += bytes_to_write; - } - } - - switch(data) - { - case VHDCMD_READ: /* Read sector */ - memset(buffer, 0, 256); - if (total_size > seek_position) - { - bytes_to_read = (UINT32) MIN((UINT64) 256, total_size - seek_position); - result = fread(buffer, bytes_to_read); - if (result != bytes_to_read) - { - m_status = VHDSTATUS_ACCESS_DENIED; - return; - } - } - - /* write the bytes to memory */ - for (i = 0; i < 256; i++) - m_cpu_space->write_byte(m_buffer_address + i, buffer[i]); - - m_status = VHDSTATUS_OK; - break; - - case VHDCMD_WRITE: /* Write Sector */ - /* read the bytes from memory */ - for (i = 0; i < 256; i++) - buffer[i] = m_cpu_space->read_byte(m_buffer_address + i); - - /* and write to disk */ - result = fwrite(buffer, 256); - if (result != 256) - { - m_status = VHDSTATUS_ACCESS_DENIED; - return; - } - - m_status = VHDSTATUS_OK; - break; - - case VHDCMD_FLUSH: /* Flush file cache */ - m_status = VHDSTATUS_OK; - break; - - default: - m_status = VHDSTATUS_UNKNOWN_COMMAND; - break; - } -} - - - -UINT8 coco_vhd_image_device::read(offs_t offset) -{ - UINT8 result = 0; - - switch(offset) - { - case 0xff83 - 0xff80: - if (VERBOSE) - logerror("vhd: Status read: %d\n", m_status); - result = m_status; - break; - } - return result; -} - - - -void coco_vhd_image_device::write(offs_t offset, UINT8 data) -{ - int pos; - - switch(offset) - { - case 0xff80 - 0xff80: - case 0xff81 - 0xff80: - case 0xff82 - 0xff80: - pos = ((0xff82 - 0xff80) - offset) * 8; - m_logical_record_number &= ~(0xFF << pos); - m_logical_record_number += data << pos; - if (VERBOSE) - logerror("vhd: LRN write: %6.6X\n", m_logical_record_number); - break; - - case 0xff83 - 0xff80: - coco_vhd_readwrite(data); - if (VERBOSE) - logerror("vhd: Command: %d\n", data); - break; - - case 0xff84 - 0xff80: - m_buffer_address &= 0xFFFF00FF; - m_buffer_address += data << 8; - if (VERBOSE) - logerror("vhd: BA write: %X (%2.2X..)\n", m_buffer_address, data); - break; - - case 0xff85 - 0xff80: - m_buffer_address &= 0xFFFFFF00; - m_buffer_address += data; - if (VERBOSE) - logerror("vhd: BA write: %X (..%2.2X)\n", m_buffer_address, data); - break; - } -} diff --git a/src/mess/machine/coco_vhd.h b/src/mess/machine/coco_vhd.h deleted file mode 100644 index 3d4819cb8f5..00000000000 --- a/src/mess/machine/coco_vhd.h +++ /dev/null @@ -1,73 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - coco_vhd.h - - Color Computer Virtual Hard Drives - -***************************************************************************/ - -#ifndef COCOVHD_H -#define COCOVHD_H - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -// ======================> coco_vhd_image_device - -class coco_vhd_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - coco_vhd_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ~coco_vhd_image_device(); - - // image-level overrides - virtual bool call_load(); - - virtual iodevice_t image_type() const { return IO_HARDDISK; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "vhd"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - // specific implementation - DECLARE_READ8_MEMBER(read) { return read(offset); } - DECLARE_WRITE8_MEMBER(write) { write(offset, data); } - UINT8 read(offs_t offset); - void write(offs_t offset, UINT8 data); - -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - - void coco_vhd_readwrite(UINT8 data); - -private: - cpu_device * m_cpu; - address_space * m_cpu_space; - UINT32 m_logical_record_number; - UINT32 m_buffer_address; - UINT8 m_status; -}; - -// device type definition -extern const device_type COCO_VHD; - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_COCO_VHD_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, COCO_VHD, 0) -#endif /* COCOVHD_H */ diff --git a/src/mess/machine/coleco.c b/src/mess/machine/coleco.c deleted file mode 100644 index e95e6786903..00000000000 --- a/src/mess/machine/coleco.c +++ /dev/null @@ -1,177 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mike Balfour, Ben Bruscella, Sean Young -#include "emu.h" -#include "machine/coleco.h" - -// ColecoVision Controller -static INPUT_PORTS_START( ctrl1 ) - PORT_START("STD_KEYPAD1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 (pad 1)") PORT_CODE(KEYCODE_0_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1 (pad 1)") PORT_CODE(KEYCODE_1_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2 (pad 1)") PORT_CODE(KEYCODE_2_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3 (pad 1)") PORT_CODE(KEYCODE_3_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4 (pad 1)") PORT_CODE(KEYCODE_4_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5 (pad 1)") PORT_CODE(KEYCODE_5_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6 (pad 1)") PORT_CODE(KEYCODE_6_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7 (pad 1)") PORT_CODE(KEYCODE_7_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8 (pad 1)") PORT_CODE(KEYCODE_8_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 (pad 1)") PORT_CODE(KEYCODE_9_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("# (pad 1)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("* (pad 1)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0xb000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - - PORT_START("STD_JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) - PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x00) -INPUT_PORTS_END - -static INPUT_PORTS_START( ctrl2 ) - PORT_START("STD_KEYPAD2") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("# (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("* (pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0xb000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - - PORT_START("STD_JOY2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) - PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x00) -INPUT_PORTS_END - - -// Super Action Controller -static INPUT_PORTS_START( sac1 ) - PORT_START("SAC_KEYPAD1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 (SAC pad 1)") PORT_CODE(KEYCODE_0_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1 (SAC pad 1)") PORT_CODE(KEYCODE_1_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2 (SAC pad 1)") PORT_CODE(KEYCODE_2_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3 (SAC pad 1)") PORT_CODE(KEYCODE_3_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4 (SAC pad 1)") PORT_CODE(KEYCODE_4_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5 (SAC pad 1)") PORT_CODE(KEYCODE_5_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6 (SAC pad 1)") PORT_CODE(KEYCODE_6_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7 (SAC pad 1)") PORT_CODE(KEYCODE_7_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8 (SAC pad 1)") PORT_CODE(KEYCODE_8_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 (SAC pad 1)") PORT_CODE(KEYCODE_9_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("# (SAC pad 1)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("* (SAC pad 1)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Blue Action Button P1") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Purple Action Button P1") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Orange Action Button P1") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - - PORT_START("SAC_JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Yellow Action Button P1") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) - - PORT_START("SAC_SLIDE1") // SAC P1 slider - PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_J) PORT_CODE_INC(KEYCODE_L) PORT_REVERSE PORT_RESET PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x02) -INPUT_PORTS_END - -static INPUT_PORTS_START( sac2 ) - PORT_START("SAC_KEYPAD2") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("# (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("* (SAC pad 2)") PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Blue Action Button P2") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Purple Action Button P2") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Orange Action Button P2") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - - PORT_START("SAC_JOY2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Yellow Action Button P2") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) - - PORT_START("SAC_SLIDE2") // SAC P2 slider - PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_RESET PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x20) -INPUT_PORTS_END - - -// Driving Controller -static INPUT_PORTS_START( driv1 ) - PORT_START("DRIV_WHEEL1") - PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_J) PORT_CODE_INC(KEYCODE_L) PORT_REVERSE PORT_RESET PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x03) - - PORT_START("DRIV_PEDAL1") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x03) - PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0x07, EQUALS, 0x03) -INPUT_PORTS_END - -static INPUT_PORTS_START( driv2 ) - PORT_START("DRIV_WHEEL2") - PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_RESET PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x30) - - PORT_START("DRIV_PEDAL2") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x30) - PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0x70, EQUALS, 0x30) -INPUT_PORTS_END - - -// Roller Controller -static INPUT_PORTS_START( roller ) - PORT_START("ROLLER_X") // Roller Controller X Axis - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_J) PORT_CODE_INC(KEYCODE_L) PORT_REVERSE PORT_RESET PORT_CONDITION("CTRLSEL", 0x80, EQUALS, 0x80) - - PORT_START("ROLLER_Y") // Roller Controller Y Axis - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_RESET PORT_CONDITION("CTRLSEL", 0x80, EQUALS, 0x80) -INPUT_PORTS_END - - -INPUT_PORTS_START( coleco ) - PORT_START("CTRLSEL") /* Select Controller Type */ - PORT_CONFNAME( 0x07, 0x00, "Port 1 Controller" ) - PORT_CONFSETTING( 0x01, DEF_STR( None ) ) - PORT_CONFSETTING( 0x00, "ColecoVision Controller" ) - PORT_CONFSETTING( 0x02, "Super Action Controller" ) - PORT_CONFSETTING( 0x03, "Driving Controller" ) - PORT_CONFNAME( 0x70, 0x00, "Port 2 Controller" ) - PORT_CONFSETTING( 0x10, DEF_STR( None ) ) - PORT_CONFSETTING( 0x00, "ColecoVision Controller" ) - PORT_CONFSETTING( 0x20, "Super Action Controller" ) - PORT_CONFSETTING( 0x30, "Driving Controller" ) - PORT_CONFNAME( 0x80, 0x00, "Extra Controller" ) - PORT_CONFSETTING( 0x00, DEF_STR( None ) ) - PORT_CONFSETTING( 0x80, "Roller Controller" ) - - PORT_INCLUDE( ctrl1 ) - PORT_INCLUDE( ctrl2 ) - PORT_INCLUDE( sac1 ) - PORT_INCLUDE( sac2 ) - PORT_INCLUDE( driv1 ) - PORT_INCLUDE( driv2 ) - PORT_INCLUDE( roller ) -INPUT_PORTS_END diff --git a/src/mess/machine/coleco.h b/src/mess/machine/coleco.h deleted file mode 100644 index b6022b164c9..00000000000 --- a/src/mess/machine/coleco.h +++ /dev/null @@ -1,10 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mike Balfour, Ben Bruscella, Sean Young -#pragma once - -#ifndef __COLECO_CONTROLLERS__ -#define __COLECO_CONTROLLERS__ - -INPUT_PORTS_EXTERN( coleco ); - -#endif diff --git a/src/mess/machine/compiskb.c b/src/mess/machine/compiskb.c deleted file mode 100644 index 1fe9e356ec8..00000000000 --- a/src/mess/machine/compiskb.c +++ /dev/null @@ -1,378 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Telenova Compis keyboard emulation - -*********************************************************************/ - -#include "compiskb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8748_TAG "i8748" -#define SPEAKER_TAG "speaker" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type COMPIS_KEYBOARD = &device_creator; - - -//------------------------------------------------- -// ROM( compis_keyboard ) -//------------------------------------------------- - -ROM_START( compis_keyboard ) - ROM_REGION( 0x800, I8748_TAG, 0 ) - ROM_LOAD( "cmpkey13.u1", 0x000, 0x800, CRC(3f87d138) SHA1(c04e2d325b9c04818bc7c47c3bf32b13862b11ec) ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *compis_keyboard_device::device_rom_region() const -{ - return ROM_NAME( compis_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( compis_keyboard_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( compis_keyboard_io, AS_IO, 8, compis_keyboard_device ) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_r, bus_w) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(p1_r) AM_WRITENOP - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(p2_r) AM_WRITENOP - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_NOP - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_NOP -ADDRESS_MAP_END - - -//------------------------------------------------- -// MACHINE_DRIVER( compis_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( compis_keyboard ) - MCFG_CPU_ADD(I8748_TAG, I8748, XTAL_2MHz) - MCFG_CPU_IO_MAP(compis_keyboard_io) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor compis_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( compis_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( compis_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( compis_keyboard ) - PORT_START("Y1") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u_UMLAUT " " U_UMLAUT) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00FC) PORT_CHAR(0x00DC) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TABR") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TABL") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y2") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("'' *") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('*') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS !") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS ?") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS |") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 000") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) // 49 - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) // 52 - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y3") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) // 41 - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y4") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) // 4b - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y5") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y6") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y7") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(o_UMLAUT " " O_UMLAUT) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INPASSA") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S" O_UMLAUT "K") PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UTPL" A_RING "NA") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS S") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad C") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xe2\x8c\xab") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y8") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) //TODO utf8 - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AVBRYT") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("START-STOP") PORT_CODE(KEYCODE_PAUSE) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_RING " " A_RING) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y9") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMPIS +") - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_UMLAUT " " A_UMLAUT) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC2\xB4 `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('`') - PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("SPECIAL") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xe2\x87\xa9") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xe2\x87\xa7\xe2\x87\xa7") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xe2\x87\xa7") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor compis_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( compis_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// compis_keyboard_device - constructor -//------------------------------------------------- - -compis_keyboard_device::compis_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, COMPIS_KEYBOARD, "Compis Keyboard", tag, owner, clock, "compiskb", __FILE__), - m_maincpu(*this, I8748_TAG), - m_speaker(*this, SPEAKER_TAG), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_special(*this, "SPECIAL"), - m_out_tx_handler(*this), - m_bus(0xff), - m_keylatch(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void compis_keyboard_device::device_start() -{ - // resolve callbacks - m_out_tx_handler.resolve_safe(); - m_out_tx_handler(1); -} - - -//------------------------------------------------- -// si_w - serial input write -//------------------------------------------------- - -WRITE_LINE_MEMBER( compis_keyboard_device::si_w ) -{ - m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); -} - - -//------------------------------------------------- -// bus_r - -//------------------------------------------------- - -READ8_MEMBER( compis_keyboard_device::bus_r ) -{ - // HACK this should be handled in mcs48.c - return m_bus; -} - - -//------------------------------------------------- -// bus_w - -//------------------------------------------------- - -WRITE8_MEMBER( compis_keyboard_device::bus_w ) -{ - /* - - bit description - - 0 keyboard row bit 0 - 1 keyboard row bit 1 - 2 keyboard row bit 2 - 3 keyboard row bit 3 - 4 - 5 speaker - 6 CAPS LED - 7 data out - - */ - - m_bus = data; - - // keyboard column - m_keylatch = (data & 0x0f); - - // speaker - m_speaker->level_w(BIT(data, 5)); - - // LEDs - output_set_led_value(LED_CAPS, BIT(data, 6)); - - // serial data out - m_out_tx_handler(BIT(data, 7)); -} - - -//------------------------------------------------- -// bus_w - -//------------------------------------------------- - -READ8_MEMBER( compis_keyboard_device::p1_r ) -{ - UINT8 data = 0xff; - - switch (m_keylatch) - { - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; - } - - return data; -} - - -//------------------------------------------------- -// p2_r - -//------------------------------------------------- - -READ8_MEMBER( compis_keyboard_device::p2_r ) -{ - UINT8 data = 0xff; - - switch (m_keylatch) - { - case 1: data &= m_y1->read() >> 8; break; - case 2: data &= m_y2->read() >> 8; break; - case 3: data &= m_y3->read() >> 8; break; - case 4: data &= m_y4->read() >> 8; break; - case 5: data &= m_y5->read() >> 8; break; - case 6: data &= m_y6->read() >> 8; break; - case 7: data &= m_y7->read() >> 8; break; - case 8: data &= m_y8->read() >> 8; break; - case 9: data &= m_y9->read() >> 8; break; - } - - data &= m_special->read(); - - return data; -} diff --git a/src/mess/machine/compiskb.h b/src/mess/machine/compiskb.h deleted file mode 100644 index 1872c3506c2..00000000000 --- a/src/mess/machine/compiskb.h +++ /dev/null @@ -1,90 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Telenova Compis keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __COMPIS_KEYBOARD__ -#define __COMPIS_KEYBOARD__ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "sound/speaker.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(_devcb) \ - devcb = &compis_keyboard_device::set_out_tx_handler(*device, DEVCB_##_devcb); - - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> compis_keyboard_device - -class compis_keyboard_device : public device_t -{ -public: - // construction/destruction - compis_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_out_tx_handler(device_t &device, _Object object) { return downcast(device).m_out_tx_handler.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_WRITE_LINE_MEMBER( si_w ); - - DECLARE_READ8_MEMBER( bus_r ); - DECLARE_WRITE8_MEMBER( bus_w ); - DECLARE_READ8_MEMBER( p1_r ); - DECLARE_READ8_MEMBER( p2_r ); - -protected: - // device-level overrides - virtual void device_start(); - -private: - enum - { - LED_CAPS - }; - - required_device m_maincpu; - required_device m_speaker; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_special; - devcb_write_line m_out_tx_handler; - - UINT8 m_bus; - UINT8 m_keylatch; -}; - - -// device type definition -extern const device_type COMPIS_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/concept.c b/src/mess/machine/concept.c deleted file mode 100644 index 7beeb8fe1d7..00000000000 --- a/src/mess/machine/concept.c +++ /dev/null @@ -1,401 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet, Brett Wyer -/* - Corvus Concept driver - - Raphael Nabet, Brett Wyer, 2003-2005 -*/ - -#include "emu.h" -#include "includes/concept.h" - - -#define VERBOSE 1 - -#define LOG(x) do { if (VERBOSE > 0) logerror x; } while (0) -#define VLOG(x) do { if (VERBOSE > 1) logerror x; } while (0) - - -/* interrupt priority encoder */ -enum -{ - IOCINT_level = 1, /* serial lines (CTS, DSR & DCD) and I/O ports */ - SR1INT_level, /* serial port 1 acia */ - OMINT_level, /* omninet */ - SR0INT_level, /* serial port 0 acia */ - TIMINT_level, /* via */ - KEYINT_level, /* keyboard acia */ - NMIINT_level /* reserved */ -}; - -/* Clock interface */ - -/* Omninet */ -/*static int ready;*/ /* ready line from monochip, role unknown */ - -/* Via */ - - -void concept_state::machine_start() -{ - /* initialize int state */ - m_pending_interrupts = 0; - - /* initialize clock interface */ - m_clock_enable = FALSE /*TRUE*/; - - save_item(NAME(m_pending_interrupts)); - save_item(NAME(m_clock_enable)); - save_item(NAME(m_clock_address)); -} - - -void concept_state::machine_reset() -{ - // OS will not boot if TDRE is clear on ACIA 0; this fixes that - m_acia0->write_cts(CLEAR_LINE); - m_acia1->write_cts(CLEAR_LINE); -} - -void concept_state::video_start() -{ -} - -UINT32 concept_state::screen_update_concept(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* resolution is 720*560 */ - UINT16 *videoram = m_videoram; - int x, y; - UINT16 *line; - - for (y = 0; y < 560; y++) - { - line = &bitmap.pix16(560-1-y); - for (x = 0; x < 720; x++) - line[720-1-x] = (videoram[(x+48+y*768)>>4] & (0x8000 >> ((x+48+y*768) & 0xf))) ? 1 : 0; - } - return 0; -} - -void concept_state::concept_set_interrupt(int level, int state) -{ - int interrupt_mask; - int final_level; - - if (state) - m_pending_interrupts |= 1 << level; - else - m_pending_interrupts &= ~ (1 << level); - - for (final_level = 7, interrupt_mask = m_pending_interrupts; (final_level > 0) && ! (interrupt_mask & 0x80); final_level--, interrupt_mask <<= 1) - ; - - if (final_level) - /* assert interrupt */ - m_maincpu->set_input_line_and_vector(M68K_IRQ_1 + final_level - 1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - else - { - /* clear all interrupts */ - m_maincpu->set_input_line_and_vector(M68K_IRQ_1 + level - 1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); - } -} - -/* - VIA port A - - 0: omninet ready (I) - 1: CTS0 (I) - 2: CTS1 (I) - 3: DSR0 (I) - 4: DSR1 (I) - 5: DCD0 (I) - 6: DCD1 (I) - 7: IOX (O) -*/ -READ8_MEMBER(concept_state::via_in_a) -{ - LOG(("via_in_a: VIA port A (Omninet and COMM port status) read\n")); - return 1; /* omninet ready always 1 */ -} - -WRITE8_MEMBER(concept_state::via_out_a) -{ - LOG(("via_out_a: VIA port A status written: data=0x%2.2x\n", data)); - /*iox = (data & 0x80) != 0;*/ -} - -/* - VIA port B - - 0: video off (O) - 1: video address 17 (O) - 2: video address 18 (O) - 3: monitor orientation (I) - 4: CH rate select DC0 (serial port line) (O) - 5: CH rate select DC1 (serial port line) (O) - 6: boot switch 0 (I) - 7: boot switch 1 (I) -*/ -READ8_MEMBER(concept_state::via_in_b) -{ - UINT8 status; - - status = ((ioport("DSW0")->read() & 0x80) >> 1) | ((ioport("DSW0")->read() & 0x40) << 1); - LOG(("via_in_b: VIA port B (DIP switches, Video, Comm Rate) - status: 0x%2.2x\n", status)); - return status; -} - -WRITE8_MEMBER(concept_state::via_out_b) -{ - VLOG(("via_out_b: VIA port B (Video Control and COMM rate select) written: data=0x%2.2x\n", data)); -} - -/* - VIA CB2: used as sound output -*/ - -WRITE_LINE_MEMBER(concept_state::via_out_cb2) -{ -// LOG(("via_out_cb2: Sound control written: data=0x%2.2x\n", state)); - m_speaker->level_w(state); -} - -/* - VIA irq -> 68k level 5 -*/ -WRITE_LINE_MEMBER(concept_state::via_irq_func) -{ - concept_set_interrupt(TIMINT_level, state); -} - -READ16_MEMBER(concept_state::concept_io_r) -{ - if (! ACCESSING_BITS_0_7) - return 0; - - switch ((offset >> 8) & 7) - { - case 0: - /* I/O slot regs */ - switch ((offset >> 4) & 7) - { - case 1: // IO1 registers - case 2: // IO2 registers - case 3: // IO3 registers - case 4: // IO4 registers - { - int slot = ((offset >> 4) & 7); - device_a2bus_card_interface *card = m_a2bus->get_a2bus_card(slot); - - if (card) - { - return card->read_c0nx(space, offset & 0x0f); - } - - return 0xff; - } - break; - - default: // ??? - logerror("concept_io_r: Slot I/O memory accessed for unknown purpose at address 0x03%4.4x\n", offset << 1); - break; - } - break; - - case 1: // IO1 ROM - case 2: // IO2 ROM - case 3: // IO3 ROM - case 4: // IO4 ROM - { - int slot = (offset >> 8) & 7; - device_a2bus_card_interface *card = m_a2bus->get_a2bus_card(slot); - - if (card) - { - return card->read_cnxx(space, offset & 0xff); - } - } - break; - - case 5: - /* slot status */ - LOG(("concept_io_r: Slot status read at address 0x03%4.4x\n", offset << 1)); - break; - - case 6: - /* calendar R/W */ - VLOG(("concept_io_r: Calendar read at address 0x03%4.4x\n", offset << 1)); - if (!m_clock_enable) - return m_mm58274->read(space, m_clock_address); - break; - - case 7: - /* I/O ports */ - switch ((offset >> 4) & 7) - { - case 0: - /* NKBP keyboard */ - return m_kbdacia->read(space, (offset & 3)); - - case 1: - /* NSR0 data comm port 0 */ - return m_acia0->read(space, (offset & 3)); - - case 2: - /* NSR1 data comm port 1 */ - return m_acia1->read(space, (offset & 3)); - - case 3: - /* NVIA versatile system interface */ -// LOG(("concept_io_r: VIA read at address 0x03%4.4x\n", offset << 1)); - { - via6522_device *via_0 = machine().device("via6522_0"); - return via_0->read(space, offset & 0xf); - } - - case 4: - /* NCALM clock calendar address and strobe register */ - /* write-only? */ - LOG(("concept_io_r: NCALM clock/calendar read at address 0x03%4.4x\n", offset << 1)); - break; - - case 5: - /* NOMNI omninet strobe */ - logerror("concept_io_r: NOMNI Omninet Transporter register read at address 0x03%4.4x\n", offset << 1); - break; - - case 6: - /* NOMOFF reset omninet interrupt flip-flop */ - logerror("concept_io_r: NOMOFF Omninet interrupt flip-flop read at address 0x03%4.4x\n", offset << 1); - break; - - case 7: - /* NIOSTRB external I/O ROM strobe (disables interface RAM) */ - logerror("concept_io_r: NIOSTRB External I/O ROM strobe read at address 0x03%4.4x\n", offset << 1); - break; - } - break; - } - - return 0; -} - -WRITE16_MEMBER(concept_state::concept_io_w) -{ - if (! ACCESSING_BITS_0_7) - return; - - data &= 0xff; - - switch ((offset >> 8) & 7) - { - case 0: - /* I/O slot regs */ - switch ((offset >> 4) & 7) - { - case 1: // IO1 registers - case 2: // IO2 registers - case 3: // IO3 registers - case 4: // IO4 registers - { - int slot = (offset >> 4) & 7; - device_a2bus_card_interface *card = m_a2bus->get_a2bus_card(slot); - - if (card) - { - return card->write_c0nx(space, offset & 0x0f, data); - } - } - break; - - default: // ??? - logerror("concept_io_w: Slot I/O memory written for unknown purpose at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); - break; - } - break; - - case 1: // IO1 ROM - case 2: // IO2 ROM - case 3: // IO3 ROM - case 4: // IO4 ROM - { - int slot = (offset >> 8) & 7; - device_a2bus_card_interface *card = m_a2bus->get_a2bus_card(slot); - - if (card) - { - return card->write_cnxx(space, offset & 0xff, data); - } - } - break; - - case 5: - /* slot status */ - logerror("concept_io_w: Slot status written at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); - break; - - case 6: - /* calendar R/W */ - LOG(("concept_io_w: Calendar written to at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data)); - if (!m_clock_enable) - m_mm58274->write(space, m_clock_address, data & 0xf); - break; - - case 7: - /* I/O ports */ - switch ((offset >> 4) & 7) - { - case 0: - /* NKBP keyboard */ - m_kbdacia->write(space, (offset & 3), data); - break; - - case 1: - /* NSR0 data comm port 0 */ - m_acia0->write(space, (offset & 3), data); - break; - - case 2: - /* NSR1 data comm port 1 */ - m_acia1->write(space, (offset & 3), data); - break; - - case 3: - /* NVIA versatile system interface */ - { - via6522_device *via_0 = machine().device("via6522_0"); - via_0->write(space, offset & 0xf, data); - } - break; - - case 4: - /* NCALM clock calendar address and strobe register */ - if (m_clock_enable != ((data & 0x10) != 0)) - { - m_clock_enable = ((data & 0x10) != 0); - if (! m_clock_enable) - /* latch address when enable goes low */ - m_clock_address = data & 0x0f; - } - /*volume_control = (data & 0x20) != 0;*/ - /*alt_map = (data & 0x40) != 0;*/ - break; - - case 5: - /* NOMNI omninet strobe */ - logerror("concept_io_w: NOMNI Omninet Transporter register written at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); - break; - - case 6: - /* NOMOFF reset omninet interrupt flip-flop */ - logerror("concept_io_w: NOMOFF Omninet flip-flop reset at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); - break; - - case 7: - /* NIOSTRB external I/O ROM strobe */ - logerror("concept_io_w: NIOSTRB External I/O ROM strobe written at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data); - break; - } - break; - } -} diff --git a/src/mess/machine/cuda.c b/src/mess/machine/cuda.c deleted file mode 100644 index 5c4964653b1..00000000000 --- a/src/mess/machine/cuda.c +++ /dev/null @@ -1,567 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/* - Apple "Cuda" ADB/system controller MCU - Emulation by R. Belmont - - Port definitions, primarily from the schematics. - - Port A: - - x------- O ADB data line out - -x------ I ADB data line in - --x----- I "1" for passive or soft power, "off sense" for secure - ---x---- O DFAC latch - ----x--- O "Fast Reset" - -----x-- I Keyboard power switch - ------x- I 1 for secure or passive power, chassis switch for soft - -------x ? 1 for passive, power supply control on secure/soft power, input on secure/soft also? - - Port B: - - x------- O DFAC bit clock - -x------ B DFAC data I/O (used in both directions) - --x----- B VIA shift register data (used in both directions) - ---x---- O VIA clock - ----x--- I VIA TIP - -----x-- I VIA BYTEACK - ------x- O VIA TREQ - -------x I +5v sense - - Port C: - x--- O 680x0 reset - -x-- ? 680x0 IPL 2 (used in both directions) - --x- ? IPL 1/pull up for passive power, trickle sense for soft and secure - ---x ? IPL 0 for passive power, pull-up for soft power, file server switch for secure power -*/ - - -//#define CUDA_SUPER_VERBOSE - -#include "emu.h" -#include "cuda.h" -#include "cpu/m6805/m6805.h" -#include "sound/asc.h" -#include "includes/mac.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define CUDA_CPU_TAG "cuda" - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type CUDA = &device_creator; - -ROM_START( cuda ) - ROM_REGION(0x4400, CUDA_CPU_TAG, 0) - ROM_LOAD( "341s0060.bin", 0x1100, 0x1100, CRC(0f5e7b4a) SHA1(972b3778146d9787b18c3a9874d505cf606b3e15) ) - ROM_LOAD( "341s0788.bin", 0x2200, 0x1100, CRC(df6e1b43) SHA1(ec23cc6214c472d61b98964928c40589517a3172) ) - ROM_LOAD( "341s0417.bin", 0x3300, 0x1100, CRC(571f24c9) SHA1(a2ae12492389a00e5f4b1ef19b267d6f3a8eadc3) ) -ROM_END - -//------------------------------------------------- -// ADDRESS_MAP -//------------------------------------------------- - -static ADDRESS_MAP_START( cuda_map, AS_PROGRAM, 8, cuda_device ) - AM_RANGE(0x0000, 0x0002) AM_READWRITE(ports_r, ports_w) - AM_RANGE(0x0004, 0x0006) AM_READWRITE(ddr_r, ddr_w) - AM_RANGE(0x0007, 0x0007) AM_READWRITE(pll_r, pll_w) - AM_RANGE(0x0008, 0x0008) AM_READWRITE(timer_ctrl_r, timer_ctrl_w) - AM_RANGE(0x0009, 0x0009) AM_READWRITE(timer_counter_r, timer_counter_w) - AM_RANGE(0x0012, 0x0012) AM_READWRITE(onesec_r, onesec_w) - AM_RANGE(0x0090, 0x00ff) AM_RAM // work RAM and stack - AM_RANGE(0x0100, 0x01ff) AM_READWRITE(pram_r, pram_w) - AM_RANGE(0x0f00, 0x1fff) AM_ROM AM_REGION(CUDA_CPU_TAG, 0) -ADDRESS_MAP_END - -//------------------------------------------------- -// MACHINE_CONFIG -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( cuda ) - MCFG_CPU_ADD(CUDA_CPU_TAG, M68HC05EG, XTAL_32_768kHz*192) // 32.768 kHz input clock, can be PLL'ed to x128 = 4.1 MHz under s/w control - MCFG_CPU_PROGRAM_MAP(cuda_map) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor cuda_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( cuda ); -} - -const rom_entry *cuda_device::device_rom_region() const -{ - return ROM_NAME( cuda ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data) -{ -// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->pc()); - - switch (offset) - { - case 0: // port A -/* printf("PORT A ADB:%d DFAC:%d PFW:%d\n", - (data & 0x80) ? 1 : 0, - (data & 0x10) ? 1 : 0, - (data & 0x01) ? 1 : 0);*/ - - if ((data & 0x80) != last_adb) - { -/* if (data & 0x80) - { - printf("CU ADB: 1->0 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time); - } - else - { - printf("CU ADB: 0->1 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time); - }*/ - - // allow the linechange handler to override us - adb_in = (data & 0x80) ? true : false; - - m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time); - write_linechange(((data & 0x80) >> 7) ^ 1); - - last_adb = data & 0x80; - last_adb_time = machine().time().as_ticks(1000000); - } - break; - - case 1: // port B - { - if (treq != ((data>>1)&1)) - { - #ifdef CUDA_SUPER_VERBOSE - printf("CU-> TREQ: %d (PC=%x)\n", (data>>1)&1, m_maincpu->pc()); - #endif - treq = (data>>1) & 1; - } - if (via_data != ((data>>5)&1)) - { - #ifdef CUDA_SUPER_VERBOSE - printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->pc()); - #endif - via_data = (data>>5) & 1; - write_via_data(via_data); - } - if (via_clock != ((data>>4)&1)) - { - #ifdef CUDA_SUPER_VERBOSE - printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc()); - #endif - via_clock = (data>>4) & 1; - write_via_clock(via_clock); - } - } - break; - - case 2: // port C - if ((data & 8) != reset_line) - { - #ifdef CUDA_SUPER_VERBOSE - printf("680x0 reset: %d -> %d (PC=%x)\n", (ports[2] & 8)>>3, (data & 8)>>3, m_maincpu->pc()); - #endif - reset_line = (data & 8); - // falling edge, should reset the machine too - if ((ports[2] & 8) && !(data&8)) - { - write_reset(ASSERT_LINE); - write_reset(CLEAR_LINE); - - // if PRAM's waiting to be loaded, transfer it now - if (!pram_loaded) - { -// memcpy(pram, disk_pram, 0x100); - pram_loaded = true; - } - } - } - break; - } -} - -READ8_MEMBER( cuda_device::ddr_r ) -{ - return ddrs[offset]; -} - -WRITE8_MEMBER( cuda_device::ddr_w ) -{ -// printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, m_maincpu->pc()); - - send_port(space, offset, ports[offset] & data); - - ddrs[offset] = data; -} - -READ8_MEMBER( cuda_device::ports_r ) -{ - UINT8 incoming = 0; - - switch (offset) - { - case 0: // port A - if (cuda_controls_power) - { - incoming = 0x20; // pull up + chassis switch (which is 0 = on) - } - else - { - incoming = 0x02 | 0x01; // pull-up + PFW - } - - if (adb_in) - { - incoming |= 0x40; - } - break; - - case 1: // port B -// printf("Read: byteack %d tip %d via_data %d\n", byteack, tip, via_data); - incoming |= 0x01; // +5v sense - incoming |= byteack<<2; - incoming |= tip<<3; - incoming |= via_data<<5; - incoming |= 0xc0; // show DFAC lines high - break; - - case 2: // port C - if (cuda_controls_power) - { - incoming = 0x02 | 0x01; // soft power: trickle sense + pull-up - } - else - { - incoming = 0x02 | 0x01; // secure power: pull-up + file server - } - break; - } - - // apply data direction registers - incoming &= (ddrs[offset] ^ 0xff); - // add in ddr-masked version of port writes - incoming |= (ports[offset] & ddrs[offset]); - - // HACK: don't know how this works on h/w... - if (!offset) - { - incoming |= 0x01; - } - -// printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], m_maincpu->pc()); - - return incoming; -} - -WRITE8_MEMBER( cuda_device::ports_w ) -{ - send_port(space, offset, data); - - ports[offset] = data; -} - -READ8_MEMBER( cuda_device::pll_r ) -{ - return pll_ctrl; -} - -WRITE8_MEMBER( cuda_device::pll_w ) -{ - #ifdef CUDA_SUPER_VERBOSE - if (pll_ctrl != data) - { - static const int clocks[4] = { 524288, 1048576, 2097152, 4194304 }; - printf("PLL ctrl: clock %d TCS:%d BCS:%d AUTO:%d BWC:%d PLLON:%d (PC=%x)\n", clocks[data&3], - (data & 0x80) ? 1 : 0, - (data & 0x40) ? 1 : 0, - (data & 0x20) ? 1 : 0, - (data & 0x10) ? 1 : 0, - (data & 0x08) ? 1 : 0, m_maincpu->pc()); - } - #endif - pll_ctrl = data; -} - -READ8_MEMBER( cuda_device::timer_ctrl_r ) -{ - return timer_ctrl; -} - -WRITE8_MEMBER( cuda_device::timer_ctrl_w ) -{ - static const attotime rates[4][5] = - { - { attotime::from_seconds(1), attotime::from_msec(31.3f), attotime::from_msec(15.6f), attotime::from_msec(7.8f), attotime::from_msec(3.9f) }, - { attotime::from_seconds(2), attotime::from_msec(62.5f), attotime::from_msec(31.3f), attotime::from_msec(15.6f), attotime::from_msec(7.8f) }, - { attotime::from_seconds(4), attotime::from_msec(125.0f), attotime::from_msec(62.5f), attotime::from_msec(31.3f), attotime::from_msec(15.6f) }, - { attotime::from_seconds(8), attotime::from_msec(250.0f), attotime::from_msec(125.1f), attotime::from_msec(62.5f), attotime::from_msec(31.3f) }, - }; - -// printf("%02x to timer control (PC=%x)\n", data, m_maincpu->pc()); - - if (data & 0x50) - { - m_prog_timer->adjust(rates[data & 3][(pll_ctrl&3)+1], 1, rates[data&3][(pll_ctrl&3)+1]); - ripple_counter = timer_counter; - } - else - { - m_prog_timer->adjust(attotime::never); - } - - if ((timer_ctrl & 0x80) && !(data & 0x80)) - { - m_maincpu->set_input_line(M68HC05EG_INT_TIMER, CLEAR_LINE); - timer_ctrl &= ~0x80; - } - else if ((timer_ctrl & 0x40) && !(data & 0x40)) - { - m_maincpu->set_input_line(M68HC05EG_INT_TIMER, CLEAR_LINE); - timer_ctrl &= ~0x40; - } - - timer_ctrl &= 0xc0; - timer_ctrl |= (data & ~0xc0); -} - -READ8_MEMBER( cuda_device::timer_counter_r ) -{ - return timer_counter; -} - -WRITE8_MEMBER( cuda_device::timer_counter_w ) -{ -// printf("%02x to timer counter (PC=%x)\n", data, m_maincpu->pc()); - timer_counter = data; - ripple_counter = timer_counter; -} - -READ8_MEMBER( cuda_device::onesec_r ) -{ - return onesec; -} - -WRITE8_MEMBER( cuda_device::onesec_w ) -{ - m_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); - - if ((onesec & 0x40) && !(data & 0x40)) - { - m_maincpu->set_input_line(M68HC05EG_INT_CPI, CLEAR_LINE); - } - - onesec = data; -} - -READ8_MEMBER( cuda_device::pram_r ) -{ - return pram[offset]; -} - -WRITE8_MEMBER( cuda_device::pram_w ) -{ - pram[offset] = data; -} - -//------------------------------------------------- -// cuda_device - constructor -//------------------------------------------------- - -cuda_device::cuda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, CUDA, "Apple Cuda", tag, owner, clock, "cuda", __FILE__), - device_nvram_interface(mconfig, *this), - write_reset(*this), - write_linechange(*this), - write_via_clock(*this), - write_via_data(*this), - m_maincpu(*this, CUDA_CPU_TAG) -{ -} - -//------------------------------------------------- -// static_set_type - configuration helper to set -// the chip type -//------------------------------------------------- - -void cuda_device::static_set_type(device_t &device, int type) -{ - cuda_device &cuda = downcast(device); - cuda.rom_offset = type; -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void cuda_device::device_start() -{ - write_reset.resolve_safe(); - write_linechange.resolve_safe(); - write_via_clock.resolve_safe(); - write_via_data.resolve_safe(); - - m_timer = timer_alloc(0, NULL); - m_prog_timer = timer_alloc(1, NULL); - save_item(NAME(ddrs[0])); - save_item(NAME(ddrs[1])); - save_item(NAME(ddrs[2])); - save_item(NAME(ports[0])); - save_item(NAME(ports[1])); - save_item(NAME(ports[2])); - save_item(NAME(pll_ctrl)); - save_item(NAME(timer_ctrl)); - save_item(NAME(timer_counter)); - save_item(NAME(ripple_counter)); - save_item(NAME(onesec)); - save_item(NAME(treq)); - save_item(NAME(byteack)); - save_item(NAME(tip)); - save_item(NAME(via_data)); - save_item(NAME(via_clock)); - save_item(NAME(adb_in)); - save_item(NAME(reset_line)); - save_item(NAME(m_adb_dtime)); - save_item(NAME(pram_loaded)); - save_item(NAME(pram)); - save_item(NAME(disk_pram)); - - UINT8 *rom = device().machine().root_device().memregion(device().subtag(CUDA_CPU_TAG).c_str())->base(); - - if (rom) - { - memcpy(rom, rom+rom_offset, 0x1100); - } -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void cuda_device::device_reset() -{ - ddrs[0] = ddrs[1] = ddrs[2] = 0; - ports[0] = ports[1] = ports[2] = 0; - - m_timer->adjust(attotime::never); - m_prog_timer->adjust(attotime::never); - - cuda_controls_power = false; // set to hard power control - adb_in = true; // line is pulled up to +5v, so nothing plugged in would read as "1" - reset_line = 0; - tip = 0; - treq = 0; - byteack = 0; - via_data = 0; - via_clock = 0; - pll_ctrl = 0; - timer_ctrl = 0; - timer_counter = 32; - last_adb_time = m_maincpu->total_cycles(); - onesec = 0; - last_adb = 0; -} - -void cuda_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if (id == 0) - { - onesec |= 0x40; - - if (onesec & 0x10) - { - m_maincpu->set_input_line(M68HC05EG_INT_CPI, ASSERT_LINE); - } - } - else - { - timer_ctrl |= 0x80; - - if (timer_ctrl & 0x20) - { - m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE); - } - - ripple_counter--; - if (ripple_counter <= 0) - { - timer_ctrl |= 0x40; - - ripple_counter = timer_counter; - - if (timer_ctrl & 0x10) - { - m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE); - } - } - } -} - -// the 6805 program clears PRAM on startup (on h/w it's always running once a battery is inserted) -// we deal with that by loading pram from disk to a secondary buffer and then slapping it into "live" -// once the cuda reboots the 68k -void cuda_device::nvram_default() -{ - memset(pram, 0, 0x100); - memset(disk_pram, 0, 0x100); - - pram[0x1] = 0x10; - pram[0x2] = 0x4f; - pram[0x3] = 0x48; - pram[0x8] = 0x13; - pram[0x9] = 0x88; - pram[0xb] = 0xcc; - pram[0xc] = 0x4e; - pram[0xd] = 0x75; - pram[0xe] = 0x4d; - pram[0xf] = 0x63; - pram[0x10] = 0xa8; - pram[0x14] = 0xcc; - pram[0x15] = 0x0a; - pram[0x16] = 0xcc; - pram[0x17] = 0x0a; - pram[0x1d] = 0x02; - pram[0x1e] = 0x63; - pram[0x4a] = 0x90; - pram[0x4b] = 0xc7; - pram[0x57] = 0x29; - pram[0x58] = 0x80; - pram[0x59] = 0x68; - pram[0x5a] = 0x80; - pram[0x5b] = 0x80; - pram[0x6f] = 0x28; - pram[0x77] = 0x01; - pram[0x78] = 0xff; - pram[0x79] = 0xff; - pram[0x7a] = 0xff; - pram[0x7b] = 0xdf; - pram[0xb8] = 0x35; - pram[0xb9] = 0x80; - pram_loaded = false; -} - -void cuda_device::nvram_read(emu_file &file) -{ - file.read(disk_pram, 0x100); - pram_loaded = false; -} - -void cuda_device::nvram_write(emu_file &file) -{ - file.write(pram, 0x100); -} diff --git a/src/mess/machine/cuda.h b/src/mess/machine/cuda.h deleted file mode 100644 index 2cdc32f7ff9..00000000000 --- a/src/mess/machine/cuda.h +++ /dev/null @@ -1,141 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -#pragma once - -#ifndef __CUDA_H__ -#define __CUDA_H__ - -#include "emu.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define CUDA_TAG "cuda" - -#define CUDA_341S0060 0x1100 // v2.40 (Most common: Performa/Quadra 6xx, PowerMac x200, x400, x500, Pippin, Gossamer G3) -#define CUDA_341S0788 0x2200 // v2.37 (LC 475/575/Quadra 605, Quadra 660AV/840AV, PowerMac x200) -#define CUDA_341S0417 0x3300 // v2.35 (Color Classic) - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CUDA_ADD(_type) \ - MCFG_DEVICE_ADD(CUDA_TAG, CUDA, 0) \ - MCFG_CUDA_TYPE(_type) - -#define MCFG_CUDA_REPLACE(_type) \ - MCFG_DEVICE_REPLACE(CUDA_TAG, CUDA, 0) \ - MCFG_CUDA_TYPE(_type) - -#define MCFG_CUDA_REMOVE() \ - MCFG_DEVICE_REMOVE(CUDA_TAG) - -#define MCFG_CUDA_TYPE(_type) \ - cuda_device::static_set_type(*device, _type); - -#define MCFG_CUDA_REMOVE() \ - MCFG_DEVICE_REMOVE(CUDA_TAG) - -#define MCFG_CUDA_RESET_CALLBACK(_cb) \ - devcb = &cuda_device::set_reset_cb(*device, DEVCB_##_cb); - -#define MCFG_CUDA_LINECHANGE_CALLBACK(_cb) \ - devcb = &cuda_device::set_linechange_cb(*device, DEVCB_##_cb); - -#define MCFG_CUDA_VIA_CLOCK_CALLBACK(_cb) \ - devcb = &cuda_device::set_via_clock_cb(*device, DEVCB_##_cb); - -#define MCFG_CUDA_VIA_DATA_CALLBACK(_cb) \ - devcb = &cuda_device::set_via_data_cb(*device, DEVCB_##_cb); - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> cuda_device - -class cuda_device : public device_t, public device_nvram_interface -{ -public: - // construction/destruction - cuda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // inline configuration helpers - static void static_set_type(device_t &device, int type); - - // device_config_nvram_interface overrides - virtual void nvram_default(); - virtual void nvram_read(emu_file &file); - virtual void nvram_write(emu_file &file); - - DECLARE_READ8_MEMBER( ddr_r ); - DECLARE_WRITE8_MEMBER( ddr_w ); - DECLARE_READ8_MEMBER( ports_r ); - DECLARE_WRITE8_MEMBER( ports_w ); - DECLARE_READ8_MEMBER( pll_r ); - DECLARE_WRITE8_MEMBER( pll_w ); - DECLARE_READ8_MEMBER( timer_ctrl_r ); - DECLARE_WRITE8_MEMBER( timer_ctrl_w ); - DECLARE_READ8_MEMBER( timer_counter_r ); - DECLARE_WRITE8_MEMBER( timer_counter_w ); - DECLARE_READ8_MEMBER( onesec_r ); - DECLARE_WRITE8_MEMBER( onesec_w ); - DECLARE_READ8_MEMBER( pram_r ); - DECLARE_WRITE8_MEMBER( pram_w ); - - // VIA interface routines - UINT8 get_treq() { return treq; } - void set_tip(UINT8 val) { tip = val; } - void set_byteack(UINT8 val) { byteack = val; } - UINT8 get_via_data() { return via_data; } - void set_via_data(UINT8 dat) { via_data = dat; } - UINT8 get_via_clock() { return via_clock; } - void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; } - int get_adb_dtime() { return m_adb_dtime; } - - int rom_offset; - - template static devcb_base &set_reset_cb(device_t &device, _Object wr) { return downcast(device).write_reset.set_callback(wr); } - template static devcb_base &set_linechange_cb(device_t &device, _Object wr) { return downcast(device).write_linechange.set_callback(wr); } - template static devcb_base &set_via_clock_cb(device_t &device, _Object wr) { return downcast(device).write_via_clock.set_callback(wr); } - template static devcb_base &set_via_data_cb(device_t &device, _Object wr) { return downcast(device).write_via_data.set_callback(wr); } - - devcb_write_line write_reset, write_linechange, write_via_clock, write_via_data; - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual machine_config_constructor device_mconfig_additions() const; - virtual const rom_entry *device_rom_region() const; - - required_device m_maincpu; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - UINT8 ddrs[3]; - UINT8 ports[3]; - UINT8 pll_ctrl; - UINT8 timer_ctrl; - UINT8 timer_counter, ripple_counter; - UINT8 onesec; - UINT8 treq, byteack, tip, via_data, via_clock, last_adb; - UINT64 last_adb_time; - bool cuda_controls_power; - bool adb_in; - int reset_line; - int m_adb_dtime; - emu_timer *m_timer, *m_prog_timer; - UINT8 pram[0x100], disk_pram[0x100]; - bool pram_loaded; - - void send_port(address_space &space, UINT8 offset, UINT8 data); -}; - -// device type definition -extern const device_type CUDA; - -#endif diff --git a/src/mess/machine/cx4data.inc b/src/mess/machine/cx4data.inc deleted file mode 100644 index b7d1610a304..00000000000 --- a/src/mess/machine/cx4data.inc +++ /dev/null @@ -1,200 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:byuu, Nach -/*************************************************************************** - - cx4data.c - - Code based on original work by zsKnight, anomie and Nach. - This implementation is based on C++ "cx4*.cpp" by byuu - (up to date with source v 0.49). - -***************************************************************************/ - -static const UINT8 CX4_immediate_data[48] = -{ - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x80, 0xff, 0xff, 0x7f, - 0x00, 0x80, 0x00, 0xff, 0x7f, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0xff, - 0x00, 0x00, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x01, 0x00, 0xff, 0xfe, 0x00 -}; - -static const UINT16 CX4_wave_data[40] = -{ - 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, - 0x0200, 0x0202, 0x0204, 0x0206, 0x0208, 0x020a, 0x020c, 0x020e, - 0x0400, 0x0402, 0x0404, 0x0406, 0x0408, 0x040a, 0x040c, 0x040e, - 0x0600, 0x0602, 0x0604, 0x0606, 0x0608, 0x060a, 0x060c, 0x060e, - 0x0800, 0x0802, 0x0804, 0x0806, 0x0808, 0x080a, 0x080c, 0x080e -}; - -static const UINT32 CX4_sin_table[256] = -{ - 0x000000, 0x000324, 0x000648, 0x00096c, 0x000c8f, 0x000fb2, 0x0012d5, 0x0015f6, - 0x001917, 0x001c37, 0x001f56, 0x002273, 0x002590, 0x0028aa, 0x002bc4, 0x002edb, - 0x0031f1, 0x003505, 0x003817, 0x003b26, 0x003e33, 0x00413e, 0x004447, 0x00474d, - 0x004a50, 0x004d50, 0x00504d, 0x005347, 0x00563e, 0x005931, 0x005c22, 0x005f0e, - 0x0061f7, 0x0064dc, 0x0067bd, 0x006a9b, 0x006d74, 0x007049, 0x007319, 0x0075e5, - 0x0078ad, 0x007b70, 0x007e2e, 0x0080e7, 0x00839c, 0x00864b, 0x0088f5, 0x008b9a, - 0x008e39, 0x0090d3, 0x009368, 0x0095f6, 0x00987f, 0x009b02, 0x009d7f, 0x009ff6, - 0x00a267, 0x00a4d2, 0x00a736, 0x00a994, 0x00abeb, 0x00ae3b, 0x00b085, 0x00b2c8, - 0x00b504, 0x00b73a, 0x00b968, 0x00bb8f, 0x00bdae, 0x00bfc7, 0x00c1d8, 0x00c3e2, - 0x00c5e4, 0x00c7de, 0x00c9d1, 0x00cbbb, 0x00cd9f, 0x00cf7a, 0x00d14d, 0x00d318, - 0x00d4db, 0x00d695, 0x00d848, 0x00d9f2, 0x00db94, 0x00dd2d, 0x00debe, 0x00e046, - 0x00e1c5, 0x00e33c, 0x00e4aa, 0x00e60f, 0x00e76b, 0x00e8bf, 0x00ea09, 0x00eb4b, - 0x00ec83, 0x00edb2, 0x00eed8, 0x00eff5, 0x00f109, 0x00f213, 0x00f314, 0x00f40b, - 0x00f4fa, 0x00f5de, 0x00f6ba, 0x00f78b, 0x00f853, 0x00f912, 0x00f9c7, 0x00fa73, - 0x00fb14, 0x00fbac, 0x00fc3b, 0x00fcbf, 0x00fd3a, 0x00fdab, 0x00fe13, 0x00fe70, - 0x00fec4, 0x00ff0e, 0x00ff4e, 0x00ff84, 0x00ffb1, 0x00ffd3, 0x00ffec, 0x00fffb, - 0x000000, 0xfffcdb, 0xfff9b7, 0xfff693, 0xfff370, 0xfff04d, 0xffed2a, 0xffea09, - 0xffe6e8, 0xffe3c8, 0xffe0a9, 0xffdd8c, 0xffda6f, 0xffd755, 0xffd43b, 0xffd124, - 0xffce0e, 0xffcafa, 0xffc7e8, 0xffc4d9, 0xffc1cc, 0xffbec1, 0xffbbb8, 0xffb8b2, - 0xffb5af, 0xffb2af, 0xffafb2, 0xffacb8, 0xffa9c1, 0xffa6ce, 0xffa3dd, 0xffa0f1, - 0xff9e08, 0xff9b23, 0xff9842, 0xff9564, 0xff928b, 0xff8fb6, 0xff8ce6, 0xff8a1a, - 0xff8752, 0xff848f, 0xff81d1, 0xff7f18, 0xff7c63, 0xff79b4, 0xff770a, 0xff7465, - 0xff71c6, 0xff6f2c, 0xff6c97, 0xff6a09, 0xff6780, 0xff64fd, 0xff6280, 0xff6009, - 0xff5d98, 0xff5b2d, 0xff58c9, 0xff566b, 0xff5414, 0xff51c4, 0xff4f7a, 0xff4d37, - 0xff4afb, 0xff48c5, 0xff4697, 0xff4470, 0xff4251, 0xff4038, 0xff3e27, 0xff3c1e, - 0xff3a1b, 0xff3821, 0xff362e, 0xff3444, 0xff3260, 0xff3085, 0xff2eb2, 0xff2ce7, - 0xff2b24, 0xff296a, 0xff27b7, 0xff260d, 0xff246b, 0xff22d2, 0xff2141, 0xff1fb9, - 0xff1e3a, 0xff1cc3, 0xff1b55, 0xff19f0, 0xff1894, 0xff1740, 0xff15f6, 0xff14b4, - 0xff137c, 0xff124d, 0xff1127, 0xff100a, 0xff0ef6, 0xff0dec, 0xff0ceb, 0xff0bf4, - 0xff0b05, 0xff0a21, 0xff0945, 0xff0874, 0xff07ac, 0xff06ed, 0xff0638, 0xff058d, - 0xff04eb, 0xff0453, 0xff03c4, 0xff0340, 0xff02c5, 0xff0254, 0xff01ec, 0xff018f, - 0xff013b, 0xff00f1, 0xff00b1, 0xff007b, 0xff004e, 0xff002c, 0xff0013, 0xff0004 -}; - -static const INT16 CX4_SinTable[512] = -{ - 0, 402, 804, 1206, 1607, 2009, 2410, 2811, - 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, - 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, - 9512, 9896, 10278, 10659, 11039, 11416, 11793, 12167, - 12539, 12910, 13278, 13645, 14010, 14372, 14732, 15090, - 15446, 15800, 16151, 16499, 16846, 17189, 17530, 17869, - 18204, 18537, 18868, 19195, 19519, 19841, 20159, 20475, - 20787, 21097, 21403, 21706, 22005, 22301, 22594, 22884, - 23170, 23453, 23732, 24007, 24279, 24547, 24812, 25073, - 25330, 25583, 25832, 26077, 26319, 26557, 26790, 27020, - 27245, 27466, 27684, 27897, 28106, 28310, 28511, 28707, - 28898, 29086, 29269, 29447, 29621, 29791, 29956, 30117, - 30273, 30425, 30572, 30714, 30852, 30985, 31114, 31237, - 31357, 31471, 31581, 31685, 31785, 31881, 31971, 32057, - 32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568, - 32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765, - 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, - 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, - 32138, 32057, 31971, 31881, 31785, 31685, 31581, 31471, - 31357, 31237, 31114, 30985, 30852, 30714, 30572, 30425, - 30273, 30117, 29956, 29791, 29621, 29447, 29269, 29086, - 28898, 28707, 28511, 28310, 28106, 27897, 27684, 27466, - 27245, 27020, 26790, 26557, 26319, 26077, 25832, 25583, - 25330, 25073, 24812, 24547, 24279, 24007, 23732, 23453, - 23170, 22884, 22594, 22301, 22005, 21706, 21403, 21097, - 20787, 20475, 20159, 19841, 19519, 19195, 18868, 18537, - 18204, 17869, 17530, 17189, 16846, 16499, 16151, 15800, - 15446, 15090, 14732, 14372, 14010, 13645, 13278, 12910, - 12539, 12167, 11793, 11416, 11039, 10659, 10278, 9896, - 9512, 9126, 8739, 8351, 7961, 7571, 7179, 6786, - 6392, 5997, 5602, 5205, 4808, 4409, 4011, 3611, - 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, - 0, -402, -804, -1206, -1607, -2009, -2410, -2811, - -3211, -3611, -4011, -4409, -4808, -5205, -5602, -5997, - -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, - -9512, -9896, -10278, -10659, -11039, -11416, -11793, -12167, - -12539, -12910, -13278, -13645, -14010, -14372, -14732, -15090, - -15446, -15800, -16151, -16499, -16846, -17189, -17530, -17869, - -18204, -18537, -18868, -19195, -19519, -19841, -20159, -20475, - -20787, -21097, -21403, -21706, -22005, -22301, -22594, -22884, - -23170, -23453, -23732, -24007, -24279, -24547, -24812, -25073, - -25330, -25583, -25832, -26077, -26319, -26557, -26790, -27020, - -27245, -27466, -27684, -27897, -28106, -28310, -28511, -28707, - -28898, -29086, -29269, -29447, -29621, -29791, -29956, -30117, - -30273, -30425, -30572, -30714, -30852, -30985, -31114, -31237, - -31357, -31471, -31581, -31685, -31785, -31881, -31971, -32057, - -32138, -32214, -32285, -32351, -32413, -32469, -32521, -32568, - -32610, -32647, -32679, -32706, -32728, -32745, -32758, -32765, - -32767, -32765, -32758, -32745, -32728, -32706, -32679, -32647, - -32610, -32568, -32521, -32469, -32413, -32351, -32285, -32214, - -32138, -32057, -31971, -31881, -31785, -31685, -31581, -31471, - -31357, -31237, -31114, -30985, -30852, -30714, -30572, -30425, - -30273, -30117, -29956, -29791, -29621, -29447, -29269, -29086, - -28898, -28707, -28511, -28310, -28106, -27897, -27684, -27466, - -27245, -27020, -26790, -26557, -26319, -26077, -25832, -25583, - -25330, -25073, -24812, -24547, -24279, -24007, -23732, -23453, - -23170, -22884, -22594, -22301, -22005, -21706, -21403, -21097, - -20787, -20475, -20159, -19841, -19519, -19195, -18868, -18537, - -18204, -17869, -17530, -17189, -16846, -16499, -16151, -15800, - -15446, -15090, -14732, -14372, -14010, -13645, -13278, -12910, - -12539, -12167, -11793, -11416, -11039, -10659, -10278, -9896, - -9512, -9126, -8739, -8351, -7961, -7571, -7179, -6786, - -6392, -5997, -5602, -5205, -4808, -4409, -4011, -3611, - -3211, -2811, -2410, -2009, -1607, -1206, -804, -402 -}; - -static const INT16 CX4_CosTable[512] = -{ - 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, - 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, - 32138, 32057, 31971, 31881, 31785, 31685, 31581, 31471, - 31357, 31237, 31114, 30985, 30852, 30714, 30572, 30425, - 30273, 30117, 29956, 29791, 29621, 29447, 29269, 29086, - 28898, 28707, 28511, 28310, 28106, 27897, 27684, 27466, - 27245, 27020, 26790, 26557, 26319, 26077, 25832, 25583, - 25330, 25073, 24812, 24547, 24279, 24007, 23732, 23453, - 23170, 22884, 22594, 22301, 22005, 21706, 21403, 21097, - 20787, 20475, 20159, 19841, 19519, 19195, 18868, 18537, - 18204, 17869, 17530, 17189, 16846, 16499, 16151, 15800, - 15446, 15090, 14732, 14372, 14010, 13645, 13278, 12910, - 12539, 12167, 11793, 11416, 11039, 10659, 10278, 9896, - 9512, 9126, 8739, 8351, 7961, 7571, 7179, 6786, - 6392, 5997, 5602, 5205, 4808, 4409, 4011, 3611, - 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, - 0, -402, -804, -1206, -1607, -2009, -2410, -2811, - -3211, -3611, -4011, -4409, -4808, -5205, -5602, -5997, - -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, - -9512, -9896, -10278, -10659, -11039, -11416, -11793, -12167, - -12539, -12910, -13278, -13645, -14010, -14372, -14732, -15090, - -15446, -15800, -16151, -16499, -16846, -17189, -17530, -17869, - -18204, -18537, -18868, -19195, -19519, -19841, -20159, -20475, - -20787, -21097, -21403, -21706, -22005, -22301, -22594, -22884, - -23170, -23453, -23732, -24007, -24279, -24547, -24812, -25073, - -25330, -25583, -25832, -26077, -26319, -26557, -26790, -27020, - -27245, -27466, -27684, -27897, -28106, -28310, -28511, -28707, - -28898, -29086, -29269, -29447, -29621, -29791, -29956, -30117, - -30273, -30425, -30572, -30714, -30852, -30985, -31114, -31237, - -31357, -31471, -31581, -31685, -31785, -31881, -31971, -32057, - -32138, -32214, -32285, -32351, -32413, -32469, -32521, -32568, - -32610, -32647, -32679, -32706, -32728, -32745, -32758, -32765, - -32767, -32765, -32758, -32745, -32728, -32706, -32679, -32647, - -32610, -32568, -32521, -32469, -32413, -32351, -32285, -32214, - -32138, -32057, -31971, -31881, -31785, -31685, -31581, -31471, - -31357, -31237, -31114, -30985, -30852, -30714, -30572, -30425, - -30273, -30117, -29956, -29791, -29621, -29447, -29269, -29086, - -28898, -28707, -28511, -28310, -28106, -27897, -27684, -27466, - -27245, -27020, -26790, -26557, -26319, -26077, -25832, -25583, - -25330, -25073, -24812, -24547, -24279, -24007, -23732, -23453, - -23170, -22884, -22594, -22301, -22005, -21706, -21403, -21097, - -20787, -20475, -20159, -19841, -19519, -19195, -18868, -18537, - -18204, -17869, -17530, -17189, -16846, -16499, -16151, -15800, - -15446, -15090, -14732, -14372, -14010, -13645, -13278, -12910, - -12539, -12167, -11793, -11416, -11039, -10659, -10278, -9896, - -9512, -9126, -8739, -8351, -7961, -7571, -7179, -6786, - -6392, -5997, -5602, -5205, -4808, -4409, -4011, -3611, - -3211, -2811, -2410, -2009, -1607, -1206, -804, -402, - 0, 402, 804, 1206, 1607, 2009, 2410, 2811, - 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, - 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, - 9512, 9896, 10278, 10659, 11039, 11416, 11793, 12167, - 12539, 12910, 13278, 13645, 14010, 14372, 14732, 15090, - 15446, 15800, 16151, 16499, 16846, 17189, 17530, 17869, - 18204, 18537, 18868, 19195, 19519, 19841, 20159, 20475, - 20787, 21097, 21403, 21706, 22005, 22301, 22594, 22884, - 23170, 23453, 23732, 24007, 24279, 24547, 24812, 25073, - 25330, 25583, 25832, 26077, 26319, 26557, 26790, 27020, - 27245, 27466, 27684, 27897, 28106, 28310, 28511, 28707, - 28898, 29086, 29269, 29447, 29621, 29791, 29956, 30117, - 30273, 30425, 30572, 30714, 30852, 30985, 31114, 31237, - 31357, 31471, 31581, 31685, 31785, 31881, 31971, 32057, - 32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568, - 32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765 -}; diff --git a/src/mess/machine/cx4fn.inc b/src/mess/machine/cx4fn.inc deleted file mode 100644 index 2b5a302a227..00000000000 --- a/src/mess/machine/cx4fn.inc +++ /dev/null @@ -1,331 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:byuu, Nach -/*************************************************************************** - - cx4fn.c - - Code based on original work by zsKnight, anomie and Nach. - This implementation is based on C++ "cx4*.cpp" by byuu. - (up to date with source v 0.49). - -***************************************************************************/ - -#include -#define CX4_Tan(a) (CX4_CosTable[a] ? ((((INT32)CX4_SinTable[a]) << 16) / CX4_CosTable[a]) : 0x80000000) -#define CX4_sar(b, n) ((b) >> (n)) -#ifdef PI -#undef PI -#endif -#define PI 3.1415926535897932384626433832795 - -//Wireframe Helpers -static void CX4_C4TransfWireFrame(void) -{ - cx4.c4x = (double)cx4.C4WFXVal; - cx4.c4y = (double)cx4.C4WFYVal; - cx4.c4z = (double)cx4.C4WFZVal - 0x95; - - //Rotate X - cx4.tanval = -(double)cx4.C4WFX2Val * PI * 2 / 128; - cx4.c4y2 = cx4.c4y * cos(cx4.tanval) - cx4.c4z * sin(cx4.tanval); - cx4.c4z2 = cx4.c4y * sin(cx4.tanval) + cx4.c4z * cos(cx4.tanval); - - //Rotate Y - cx4.tanval = -(double)cx4.C4WFY2Val * PI * 2 / 128; - cx4.c4x2 = cx4.c4x * cos(cx4.tanval) + cx4.c4z2 * sin(cx4.tanval); - cx4.c4z = cx4.c4x * -sin(cx4.tanval) + cx4.c4z2 * cos(cx4.tanval); - - //Rotate Z - cx4.tanval = -(double)cx4.C4WFDist * PI * 2 / 128; - cx4.c4x = cx4.c4x2 * cos(cx4.tanval) - cx4.c4y2 * sin(cx4.tanval); - cx4.c4y = cx4.c4x2 * sin(cx4.tanval) + cx4.c4y2 * cos(cx4.tanval); - - //Scale - cx4.C4WFXVal = (INT16)(cx4.c4x * cx4.C4WFScale / (0x90 * (cx4.c4z + 0x95)) * 0x95); - cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / (0x90 * (cx4.c4z + 0x95)) * 0x95); -} - -static void CX4_C4CalcWireFrame(void) -{ - cx4.C4WFXVal = cx4.C4WFX2Val - cx4.C4WFXVal; - cx4.C4WFYVal = cx4.C4WFY2Val - cx4.C4WFYVal; - - if(abs(cx4.C4WFXVal) > abs(cx4.C4WFYVal)) - { - cx4.C4WFDist = abs(cx4.C4WFXVal) + 1; - cx4.C4WFYVal = (256 * (long)cx4.C4WFYVal) / abs(cx4.C4WFXVal); - cx4.C4WFXVal = (cx4.C4WFXVal < 0) ? -256 : 256; - } - else if(cx4.C4WFYVal != 0) - { - cx4.C4WFDist = abs(cx4.C4WFYVal) + 1; - cx4.C4WFXVal = (256 * (long)cx4.C4WFXVal) / abs(cx4.C4WFYVal); - cx4.C4WFYVal = (cx4.C4WFYVal < 0) ? -256 : 256; - } - else - { - cx4.C4WFDist = 0; - } -} - -static void CX4_C4TransfWireFrame2(void) -{ - cx4.c4x = (double)cx4.C4WFXVal; - cx4.c4y = (double)cx4.C4WFYVal; - cx4.c4z = (double)cx4.C4WFZVal; - - //Rotate X - cx4.tanval = -(double)cx4.C4WFX2Val * PI * 2 / 128; - cx4.c4y2 = cx4.c4y * cos(cx4.tanval) - cx4.c4z * sin(cx4.tanval); - cx4.c4z2 = cx4.c4y * sin(cx4.tanval) + cx4.c4z * cos(cx4.tanval); - - //Rotate Y - cx4.tanval = -(double)cx4.C4WFY2Val * PI * 2 / 128; - cx4.c4x2 = cx4.c4x * cos(cx4.tanval) + cx4.c4z2 * sin(cx4.tanval); - cx4.c4z = cx4.c4x * -sin(cx4.tanval) + cx4.c4z2 * cos(cx4.tanval); - - //Rotate Z - cx4.tanval = -(double)cx4.C4WFDist * PI * 2 / 128; - cx4.c4x = cx4.c4x2 * cos(cx4.tanval) - cx4.c4y2 * sin(cx4.tanval); - cx4.c4y = cx4.c4x2 * sin(cx4.tanval) + cx4.c4y2 * cos(cx4.tanval); - - //Scale - cx4.C4WFXVal = (INT16)(cx4.c4x * cx4.C4WFScale / 0x100); - cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / 0x100); -} - -static void CX4_C4DrawWireFrame(running_machine &machine) -{ - UINT32 line = CX4_readl(0x1f80); - UINT32 point1, point2; - INT16 X1, Y1, Z1; - INT16 X2, Y2, Z2; - UINT8 Color; - INT32 i; - - address_space &space = machine.device("maincpu")->space(AS_PROGRAM); - for(i = cx4.ram[0x0295]; i > 0; i--, line += 5) - { - if(space.read_byte(line) == 0xff && - space.read_byte(line + 1) == 0xff) - { - INT32 tmp = line - 5; - while(space.read_byte(tmp + 2) == 0xff && - space.read_byte(tmp + 3) == 0xff && - (tmp + 2) >= 0) - { - tmp -= 5; - } - point1 = (CX4_read(0x1f82) << 16) | - (space.read_byte(tmp + 2) << 8) | - space.read_byte(tmp + 3); - } - else - { - point1 = (CX4_read(0x1f82) << 16) | - (space.read_byte(line) << 8) | - space.read_byte(line + 1); - } - point2 = (CX4_read(0x1f82) << 16) | - (space.read_byte(line + 2) << 8) | - space.read_byte(line + 3); - - X1=(space.read_byte(point1 + 0) << 8) | - space.read_byte(point1 + 1); - Y1=(space.read_byte(point1 + 2) << 8) | - space.read_byte(point1 + 3); - Z1=(space.read_byte(point1 + 4) << 8) | - space.read_byte(point1 + 5); - X2=(space.read_byte(point2 + 0) << 8) | - space.read_byte(point2 + 1); - Y2=(space.read_byte(point2 + 2) << 8) | - space.read_byte(point2 + 3); - Z2=(space.read_byte(point2 + 4) << 8) | - space.read_byte(point2 + 5); - Color = space.read_byte(line + 4); - CX4_C4DrawLine(X1, Y1, Z1, X2, Y2, Z2, Color); - } -} - -static void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color) -{ - INT32 i; - - //Transform coordinates - cx4.C4WFXVal = (INT16)X1; - cx4.C4WFYVal = (INT16)Y1; - cx4.C4WFZVal = Z1; - cx4.C4WFScale = CX4_read(0x1f90); - cx4.C4WFX2Val = CX4_read(0x1f86); - cx4.C4WFY2Val = CX4_read(0x1f87); - cx4.C4WFDist = CX4_read(0x1f88); - CX4_C4TransfWireFrame2(); - X1 = (cx4.C4WFXVal + 48) << 8; - Y1 = (cx4.C4WFYVal + 48) << 8; - - cx4.C4WFXVal = (INT16)X2; - cx4.C4WFYVal = (INT16)Y2; - cx4.C4WFZVal = Z2; - CX4_C4TransfWireFrame2(); - X2 = (cx4.C4WFXVal + 48) << 8; - Y2 = (cx4.C4WFYVal + 48) << 8; - - //Get line info - cx4.C4WFXVal = (INT16)(X1 >> 8); - cx4.C4WFYVal = (INT16)(Y1 >> 8); - cx4.C4WFX2Val = (INT16)(X2 >> 8); - cx4.C4WFY2Val = (INT16)(Y2 >> 8); - CX4_C4CalcWireFrame(); - X2 = (INT16)cx4.C4WFXVal; - Y2 = (INT16)cx4.C4WFYVal; - - //Render line - for(i = cx4.C4WFDist ? cx4.C4WFDist : 1; i > 0; i--) - { - if(X1 > 0xff && Y1 > 0xff && X1 < 0x6000 && Y1 < 0x6000) - { - UINT16 addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + (((X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2; - UINT8 bit = 0x80 >> ((X1 >> 8) & 7); - cx4.ram[addr + 0x300] &= ~bit; - cx4.ram[addr + 0x301] &= ~bit; - if(Color & 1) - { - cx4.ram[addr + 0x300] |= bit; - } - if(Color & 2) - { - cx4.ram[addr + 0x301] |= bit; - } - } - X1 += X2; - Y1 += Y2; - } -} - -static void CX4_C4DoScaleRotate(int row_padding) -{ - INT16 A, B, C, D; - INT32 x, y; - - //Calculate Pixel Resolution - UINT8 w = CX4_read(0x1f89) & ~7; - UINT8 h = CX4_read(0x1f8c) & ~7; - - INT32 Cx = (INT16)CX4_readw(0x1f83); - INT32 Cy = (INT16)CX4_readw(0x1f86); - - INT32 LineX, LineY; - UINT32 X, Y; - UINT8 byte; - INT32 outidx = 0; - UINT8 bit = 0x80; - - //Calculate matrix - INT32 XScale = CX4_readw(0x1f8f); - INT32 YScale = CX4_readw(0x1f92); - - if(XScale & 0x8000) - { - XScale = 0x7fff; - } - if(YScale & 0x8000) - { - YScale = 0x7fff; - } - - if(CX4_readw(0x1f80) == 0) - { //no rotation - A = (INT16)XScale; - B = 0; - C = 0; - D = (INT16)YScale; - } - else if(CX4_readw(0x1f80) == 128) - { //90 degree rotation - A = 0; - B = (INT16)(-YScale); - C = (INT16)XScale; - D = 0; - } - else if(CX4_readw(0x1f80) == 256) - { //180 degree rotation - A = (INT16)(-XScale); - B = 0; - C = 0; - D = (INT16)(-YScale); - } - else if(CX4_readw(0x1f80) == 384) - { //270 degree rotation - A = 0; - B = (INT16)YScale; - C = (INT16)(-XScale); - D = 0; - } - else - { - A = (INT16) CX4_sar(CX4_CosTable[CX4_readw(0x1f80) & 0x1ff] * XScale, 15); - B = (INT16)(-CX4_sar(CX4_SinTable[CX4_readw(0x1f80) & 0x1ff] * YScale, 15)); - C = (INT16) CX4_sar(CX4_SinTable[CX4_readw(0x1f80) & 0x1ff] * XScale, 15); - D = (INT16) CX4_sar(CX4_CosTable[CX4_readw(0x1f80) & 0x1ff] * YScale, 15); - } - - //Clear the output RAM - memset(cx4.ram, 0, (w + row_padding / 4) * h / 2); - - //Calculate start position (i.e. (Ox, Oy) = (0, 0)) - //The low 12 bits are fractional, so (Cx<<12) gives us the Cx we want in - //the function. We do Cx*A etc normally because the matrix parameters - //already have the fractional parts. - LineX = (Cx << 12) - Cx * A - Cx * B; - LineY = (Cy << 12) - Cy * C - Cy * D; - - //Start loop - for(y = 0; y < h; y++) - { - X = LineX; - Y = LineY; - for(x = 0; x < w; x++) - { - if((X >> 12) >= w || (Y >> 12) >= h) - { - byte = 0; - } - else - { - UINT32 addr = (Y >> 12) * w + (X >> 12); - byte = CX4_read(0x600 + (addr >> 1)); - if(addr & 1) - { - byte >>= 4; - } - } - - //De-bitplanify - if(byte & 1) { cx4.ram[outidx ] |= bit; } - if(byte & 2) { cx4.ram[outidx + 1] |= bit; } - if(byte & 4) { cx4.ram[outidx + 16] |= bit; } - if(byte & 8) { cx4.ram[outidx + 17] |= bit; } - - bit >>= 1; - if(!bit) - { - bit = 0x80; - outidx += 32; - } - - X += A; //Add 1 to output x => add an A and a C - Y += C; - } - outidx += 2 + row_padding; - if(outidx & 0x10) - { - outidx &= ~0x10; - } - else - { - outidx -= w * 4 + row_padding; - } - LineX += B; //Add 1 to output y => add a B and a D - LineY += D; - } -} diff --git a/src/mess/machine/cx4oam.inc b/src/mess/machine/cx4oam.inc deleted file mode 100644 index abf74defea2..00000000000 --- a/src/mess/machine/cx4oam.inc +++ /dev/null @@ -1,308 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:byuu, Nach -/*************************************************************************** - - cx4oam.c - - Code based on original work by zsKnight, anomie and Nach. - This implementation is based on C++ "cx4*.cpp" by byuu - (up to date with source v 0.49). - -***************************************************************************/ - -//Build OAM -static void CX4_op00_00(running_machine &machine) -{ - INT32 i; - - UINT32 oamptr = cx4.ram[0x626] << 2; - UINT16 globalx, globaly; - UINT32 oamptr2; - INT16 sprx, spry; - UINT8 sprname, sprattr; - UINT8 sprcount; - UINT8 offset; - UINT32 srcptr; - - for(i = 0x1fd; i > oamptr && i >= 0; i -= 4) - { - //clear oam-to-be - if(i >= 0) - { - cx4.ram[i] = 0xe0; - } - } - - globalx = CX4_readw(0x621); - globaly = CX4_readw(0x623); - oamptr2 = 0x200 + (cx4.ram[0x626] >> 2); - - if(!cx4.ram[0x620]) - { - return; - } - - sprcount = 128 - cx4.ram[0x626]; - offset = (cx4.ram[0x626] & 3) * 2; - srcptr = 0x220; - - address_space &space = machine.device("maincpu")->space(AS_PROGRAM); - for(i = cx4.ram[0x620]; i > 0 && sprcount > 0; i--, srcptr += 16) - { - UINT32 spraddr = CX4_readl(srcptr + 7); - - sprx = CX4_readw(srcptr) - globalx; - spry = CX4_readw(srcptr + 2) - globaly; - sprname = cx4.ram[srcptr + 5]; - sprattr = cx4.ram[srcptr + 4] | cx4.ram[srcptr + 6]; - - if(space.read_byte(spraddr)) - { - INT16 x, y; - INT32 sprcnt; - for(sprcnt = space.read_byte(spraddr++); sprcnt > 0 && sprcount > 0; sprcnt--, spraddr += 4) - { - x = (INT8)space.read_byte(spraddr + 1); - if(sprattr & 0x40) - { - x = -x - ((space.read_byte(spraddr) & 0x20) ? 16 : 8); - } - x += sprx; - if(x >= -16 && x <= 272) - { - y = (INT8)space.read_byte(spraddr + 2); - if(sprattr & 0x80) - { - y = -y - ((space.read_byte(spraddr) & 0x20) ? 16 : 8); - } - y += spry; - if(y >= -16 && y <= 224) - { - cx4.ram[oamptr ] = (UINT8)x; - cx4.ram[oamptr + 1] = (UINT8)y; - cx4.ram[oamptr + 2] = sprname + space.read_byte(spraddr + 3); - cx4.ram[oamptr + 3] = sprattr ^ (space.read_byte(spraddr) & 0xc0); - cx4.ram[oamptr2] &= ~(3 << offset); - if(x & 0x100) - { - cx4.ram[oamptr2] |= 1 << offset; - } - if(space.read_byte(spraddr) & 0x20) - { - cx4.ram[oamptr2] |= 2 << offset; - } - oamptr += 4; - sprcount--; - offset = (offset + 2) & 6; - if(!offset) - { - oamptr2++; - } - } - } - } - } - else if(sprcount > 0) - { - cx4.ram[oamptr ] = (UINT8)sprx; - cx4.ram[oamptr + 1] = (UINT8)spry; - cx4.ram[oamptr + 2] = sprname; - cx4.ram[oamptr + 3] = sprattr; - cx4.ram[oamptr2] &= ~(3 << offset); - if(sprx & 0x100) - { - cx4.ram[oamptr2] |= 3 << offset; - } - else - { - cx4.ram[oamptr2] |= 2 << offset; - } - oamptr += 4; - sprcount--; - offset = (offset + 2) & 6; - if(!offset) - { - oamptr2++; - } - } - } -} - -//Scale and Rotate -static void CX4_op00_03(void) -{ - CX4_C4DoScaleRotate(0); -} - -//Transform Lines -static void CX4_op00_05(running_machine &machine) -{ - INT32 i; - UINT32 ptr = 0, ptr2 = 0; - - cx4.C4WFX2Val = CX4_read(0x1f83); - cx4.C4WFY2Val = CX4_read(0x1f86); - cx4.C4WFDist = CX4_read(0x1f89); - cx4.C4WFScale = CX4_read(0x1f8c); - - //Transform Vertices - for(i = CX4_readw(0x1f80); i > 0; i--, ptr += 0x10) - { - cx4.C4WFXVal = CX4_readw(ptr + 1); - cx4.C4WFYVal = CX4_readw(ptr + 5); - cx4.C4WFZVal = CX4_readw(ptr + 9); - CX4_C4TransfWireFrame(); - - //Displace - CX4_writew(machine, ptr + 1, cx4.C4WFXVal + 0x80); - CX4_writew(machine, ptr + 5, cx4.C4WFYVal + 0x50); - } - - CX4_writew(machine, 0x600, 23); - CX4_writew(machine, 0x602, 0x60); - CX4_writew(machine, 0x605, 0x40); - CX4_writew(machine, 0x600 + 8, 23); - CX4_writew(machine, 0x602 + 8, 0x60); - CX4_writew(machine, 0x605 + 8, 0x40); - - ptr = 0xb02; - - for(i = CX4_readw(0xb00); i > 0; i--, ptr += 2, ptr2 += 8) - { - cx4.C4WFXVal = CX4_readw((CX4_read(ptr + 0) << 4) + 1); - cx4.C4WFYVal = CX4_readw((CX4_read(ptr + 0) << 4) + 5); - cx4.C4WFX2Val = CX4_readw((CX4_read(ptr + 1) << 4) + 1); - cx4.C4WFY2Val = CX4_readw((CX4_read(ptr + 1) << 4) + 5); - CX4_C4CalcWireFrame(); - CX4_writew(machine, ptr2 + 0x600, cx4.C4WFDist ? cx4.C4WFDist : 1); - CX4_writew(machine, ptr2 + 0x602, cx4.C4WFXVal); - CX4_writew(machine, ptr2 + 0x605, cx4.C4WFYVal); - } -} - -//Scale and Rotate -static void CX4_op00_07(void) -{ - CX4_C4DoScaleRotate(64); -} - -//Draw Wireframe -static void CX4_op00_08(running_machine &machine) -{ - CX4_C4DrawWireFrame(machine); -} - -//Disintegrate -static void CX4_op00_0b(running_machine &machine) -{ - UINT8 width, height; - UINT32 startx, starty; - UINT32 srcptr; - UINT32 x, y; - INT32 scalex, scaley; - INT32 cx, cy; - INT32 i, j; - - width = CX4_read(0x1f89); - height = CX4_read(0x1f8c); - cx = CX4_readw(0x1f80); - cy = CX4_readw(0x1f83); - - scalex = (INT16)CX4_readw(0x1f86); - scaley = (INT16)CX4_readw(0x1f8f); - startx = -cx * scalex + (cx << 8); - starty = -cy * scaley + (cy << 8); - srcptr = 0x600; - - for(i = 0; i < (width * height) >> 1; i++) - { - CX4_write(machine, i, 0); - } - - for(y = starty, i = 0;i < height; i++, y += scaley) - { - for(x = startx, j = 0;j < width; j++, x += scalex) - { - if((x >> 8) < width && (y >> 8) < height && (y >> 8) * width + (x >> 8) < 0x2000) - { - UINT8 pixel = (j & 1) ? (cx4.ram[srcptr] >> 4) : (cx4.ram[srcptr]); - INT32 index = (y >> 11) * width * 4 + (x >> 11) * 32 + ((y >> 8) & 7) * 2; - UINT8 mask = 0x80 >> ((x >> 8) & 7); - - if(pixel & 1) cx4.ram[index ] |= mask; - if(pixel & 2) cx4.ram[index + 1] |= mask; - if(pixel & 4) cx4.ram[index + 16] |= mask; - if(pixel & 8) cx4.ram[index + 17] |= mask; - } - if(j & 1) - { - srcptr++; - } - } - } -} - -//Bitplane Wave -static void CX4_op00_0c(running_machine &machine) -{ - int i, j; - UINT32 destptr = 0; - UINT32 waveptr = CX4_read(0x1f83); - UINT16 mask1 = 0xc0c0; - UINT16 mask2 = 0x3f3f; - - for(j = 0; j < 0x10; j++) - { - do - { - INT16 height = -((INT8)CX4_read(waveptr + 0xb00)) - 16; - for(i = 0; i < 40; i++) - { - UINT16 temp = CX4_readw(destptr + CX4_wave_data[i]) & mask2; - if(height >= 0) - { - if(height < 8) - { - temp |= mask1 & CX4_readw(0xa00 + height * 2); - } - else - { - temp |= mask1 & 0xff00; - } - } - CX4_writew(machine, destptr + CX4_wave_data[i], temp); - height++; - } - waveptr = (waveptr + 1) & 0x7f; - mask1 = (mask1 >> 2) | (mask1 << 6); - mask2 = (mask2 >> 2) | (mask2 << 6); - } while(mask1 != 0xc0c0); - destptr += 16; - - do - { - INT16 height = -((INT8)CX4_read(waveptr + 0xb00)) - 16; - for(i = 0; i < 40; i++) - { - UINT16 temp = CX4_readw(destptr + CX4_wave_data[i]) & mask2; - if(height >= 0) - { - if(height < 8) - { - temp |= mask1 & CX4_readw(0xa10 + height * 2); - } - else - { - temp |= mask1 & 0xff00; - } - } - CX4_writew(machine, destptr + CX4_wave_data[i], temp); - height++; - } - waveptr = (waveptr + 1) & 0x7f; - mask1 = (mask1 >> 2) | (mask1 << 6); - mask2 = (mask2 >> 2) | (mask2 << 6); - } while(mask1 != 0xc0c0); - destptr += 16; - } -} diff --git a/src/mess/machine/cx4ops.inc b/src/mess/machine/cx4ops.inc deleted file mode 100644 index 02b97bc944d..00000000000 --- a/src/mess/machine/cx4ops.inc +++ /dev/null @@ -1,278 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:byuu, Nach -/*************************************************************************** - - cx4ops.c - - Code based on original work by zsKnight, anomie and Nach. - This implementation is based on C++ "cx4*.cpp" by byuu - (up to date with source v 0.49). - -***************************************************************************/ - -//Sprite Functions -static void CX4_op00(running_machine& machine) -{ - switch(cx4.reg[0x4d]) - { - case 0x00: CX4_op00_00(machine); break; - case 0x03: CX4_op00_03(); break; - case 0x05: CX4_op00_05(machine); break; - case 0x07: CX4_op00_07(); break; - case 0x08: CX4_op00_08(machine); break; - case 0x0b: CX4_op00_0b(machine); break; - case 0x0c: CX4_op00_0c(machine); break; - } -} - -//Draw Wireframe -static void CX4_op01(running_machine& machine) -{ - memset(cx4.ram + 0x300, 0, 2304); - CX4_C4DrawWireFrame(machine); -} - -//Propulsion -static void CX4_op05(running_machine &machine) -{ - INT32 temp = 0x10000; - if(CX4_readw(0x1f83)) - { - temp = CX4_sar((temp / CX4_readw(0x1f83)) * CX4_readw(0x1f81), 8); - } - CX4_writew(machine, 0x1f80, temp); -} - -//Set Vector length -static void CX4_op0d(running_machine &machine) -{ - cx4.C41FXVal = CX4_readw(0x1f80); - cx4.C41FYVal = CX4_readw(0x1f83); - cx4.C41FDistVal = CX4_readw(0x1f86); - cx4.tanval = sqrt(((double)cx4.C41FYVal) * ((double)cx4.C41FYVal) + ((double)cx4.C41FXVal) * ((double)cx4.C41FXVal)); - cx4.tanval = (double)cx4.C41FDistVal / cx4.tanval; - cx4.C41FYVal = (INT16)(((double)cx4.C41FYVal * cx4.tanval) * 0.99); - cx4.C41FXVal = (INT16)(((double)cx4.C41FXVal * cx4.tanval) * 0.98); - CX4_writew(machine, 0x1f89, cx4.C41FXVal); - CX4_writew(machine, 0x1f8c, cx4.C41FYVal); -} - -//Triangle -static void CX4_op10(void) -{ - cx4.r0 = CX4_ldr(0); - cx4.r1 = CX4_ldr(1); - - cx4.r4 = cx4.r0 & 0x1ff; - if(cx4.r1 & 0x8000) - { - cx4.r1 |= ~0x7fff; - } - - CX4_mul(CX4_cos(cx4.r4), cx4.r1, &cx4.r5, &cx4.r2); - cx4.r5 = (cx4.r5 >> 16) & 0xff; - cx4.r2 = (cx4.r2 << 8) + cx4.r5; - - CX4_mul(CX4_sin(cx4.r4), cx4.r1, &cx4.r5, &cx4.r3); - cx4.r5 = (cx4.r5 >> 16) & 0xff; - cx4.r3 = (cx4.r3 << 8) + cx4.r5; - - CX4_str(0, cx4.r0); - CX4_str(1, cx4.r1); - CX4_str(2, cx4.r2); - CX4_str(3, cx4.r3); - CX4_str(4, cx4.r4); - CX4_str(5, cx4.r5); -} - -//Triangle -static void CX4_op13(void) -{ - cx4.r0 = CX4_ldr(0); - cx4.r1 = CX4_ldr(1); - - cx4.r4 = cx4.r0 & 0x1ff; - - CX4_mul(CX4_cos(cx4.r4), cx4.r1, &cx4.r5, &cx4.r2); - cx4.r5 = (cx4.r5 >> 8) & 0xffff; - cx4.r2 = (cx4.r2 << 16) + cx4.r5; - - CX4_mul(CX4_sin(cx4.r4), cx4.r1, &cx4.r5, &cx4.r3); - cx4.r5 = (cx4.r5 >> 8) & 0xffff; - cx4.r3 = (cx4.r3 << 16) + cx4.r5; - - CX4_str(0, cx4.r0); - CX4_str(1, cx4.r1); - CX4_str(2, cx4.r2); - CX4_str(3, cx4.r3); - CX4_str(4, cx4.r4); - CX4_str(5, cx4.r5); -} - -//Pythagorean -static void CX4_op15(running_machine &machine) -{ - double temp = 0.0; - cx4.C41FXVal = CX4_readw(0x1f80); - cx4.C41FYVal = CX4_readw(0x1f83); - temp = sqrt((double)cx4.C41FXVal * (double)cx4.C41FXVal + (double)cx4.C41FYVal * (double)cx4.C41FYVal); - cx4.C41FDist = (INT16)temp; - CX4_writew(machine, 0x1f80, cx4.C41FDist); -} - -//Calculate distance -static void CX4_op1f(running_machine &machine) -{ - cx4.C41FXVal = CX4_readw(0x1f80); - cx4.C41FYVal = CX4_readw(0x1f83); - if(!cx4.C41FXVal) - { - cx4.C41FAngleRes = (cx4.C41FYVal > 0) ? 0x080 : 0x180; - } - else - { - cx4.tanval = ((double)cx4.C41FYVal) / ((double)cx4.C41FXVal); - cx4.C41FAngleRes = (INT16)(atan(cx4.tanval) / (PI * 2) * 512); - cx4.C41FAngleRes = cx4.C41FAngleRes; - if(cx4.C41FXVal < 0) - { - cx4.C41FAngleRes += 0x100; - } - cx4.C41FAngleRes &= 0x1ff; - } - CX4_writew(machine, 0x1f86, cx4.C41FAngleRes); -} - -//Trapezoid -static void CX4_op22(void) -{ - INT16 angle1 = CX4_readw(0x1f8c) & 0x1ff; - INT16 angle2 = CX4_readw(0x1f8f) & 0x1ff; - INT32 tan1 = CX4_Tan(angle1); - INT32 tan2 = CX4_Tan(angle2); - INT16 y = CX4_readw(0x1f83) - CX4_readw(0x1f89); - INT16 left, right; - INT32 j; - - for(j = 0; j < 225; j++, y++) - { - if(y >= 0) - { - left = CX4_sar((INT32)tan1 * y, 16) - CX4_readw(0x1f80) + CX4_readw(0x1f86); - right = CX4_sar((INT32)tan2 * y, 16) - CX4_readw(0x1f80) + CX4_readw(0x1f86) + CX4_readw(0x1f93); - - if(left < 0 && right < 0) - { - left = 1; - right = 0; - } - else if(left < 0) - { - left = 0; - } - else if(right < 0) - { - right = 0; - } - - if(left > 255 && right > 255) - { - left = 255; - right = 254; - } - else if(left > 255) - { - left = 255; - } - else if(right > 255) - { - right = 255; - } - } - else - { - left = 1; - right = 0; - } - cx4.ram[j + 0x800] = (UINT8)left; - cx4.ram[j + 0x900] = (UINT8)right; - } -} - -//Multiply -static void CX4_op25(void) -{ - cx4.r0 = CX4_ldr(0); - cx4.r1 = CX4_ldr(1); - CX4_mul(cx4.r0, cx4.r1, &cx4.r0, &cx4.r1); - CX4_str(0, cx4.r0); - CX4_str(1, cx4.r1); -} - -//Transform Coords -static void CX4_op2d(running_machine &machine) -{ - cx4.C4WFXVal = CX4_readw(0x1f81); - cx4.C4WFYVal = CX4_readw(0x1f84); - cx4.C4WFZVal = CX4_readw(0x1f87); - cx4.C4WFX2Val = CX4_read (0x1f89); - cx4.C4WFY2Val = CX4_read (0x1f8a); - cx4.C4WFDist = CX4_read (0x1f8b); - cx4.C4WFScale = CX4_readw(0x1f90); - CX4_C4TransfWireFrame2(); - CX4_writew(machine, 0x1f80, cx4.C4WFXVal); - CX4_writew(machine, 0x1f83, cx4.C4WFYVal); -} - -//Sum -static void CX4_op40(void) -{ - UINT32 i; - cx4.r0 = 0; - for(i=0;i<0x800;i++) - { - cx4.r0 += cx4.ram[i]; - } - CX4_str(0, cx4.r0); -} - -//Square -static void CX4_op54(void) -{ - cx4.r0 = CX4_ldr(0); - CX4_mul(cx4.r0, cx4.r0, &cx4.r1, &cx4.r2); - CX4_str(1, cx4.r1); - CX4_str(2, cx4.r2); -} - -//Immediate Register -static void CX4_op5c(void) -{ - CX4_str(0, 0x000000); - CX4_immediate_reg(0); -} - -//Immediate Register (Multiple) -static void CX4_op5e(void) { CX4_immediate_reg( 0); } -static void CX4_op60(void) { CX4_immediate_reg( 3); } -static void CX4_op62(void) { CX4_immediate_reg( 6); } -static void CX4_op64(void) { CX4_immediate_reg( 9); } -static void CX4_op66(void) { CX4_immediate_reg(12); } -static void CX4_op68(void) { CX4_immediate_reg(15); } -static void CX4_op6a(void) { CX4_immediate_reg(18); } -static void CX4_op6c(void) { CX4_immediate_reg(21); } -static void CX4_op6e(void) { CX4_immediate_reg(24); } -static void CX4_op70(void) { CX4_immediate_reg(27); } -static void CX4_op72(void) { CX4_immediate_reg(30); } -static void CX4_op74(void) { CX4_immediate_reg(33); } -static void CX4_op76(void) { CX4_immediate_reg(36); } -static void CX4_op78(void) { CX4_immediate_reg(39); } -static void CX4_op7a(void) { CX4_immediate_reg(42); } -static void CX4_op7c(void) { CX4_immediate_reg(45); } - -//Immediate ROM -static void CX4_op89(void) -{ - CX4_str(0, 0x054336); - CX4_str(1, 0xffffff); -} diff --git a/src/mess/machine/cybiko.c b/src/mess/machine/cybiko.c deleted file mode 100644 index 6da702b34c3..00000000000 --- a/src/mess/machine/cybiko.c +++ /dev/null @@ -1,492 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/* - - Cybiko Wireless Inter-tainment System - - (c) 2001-2007 Tim Schuerewegen - - Cybiko Classic (V1) - Cybiko Classic (V2) - Cybiko Xtreme - -*/ - -#include "includes/cybiko.h" - -#define LOG_LEVEL 1 -#define _logerror(level,x) do { if (LOG_LEVEL > level) logerror x; } while (0) - -#define RAMDISK_SIZE (512 * 1024) - - -//////////////////////// -// DRIVER INIT & EXIT // -//////////////////////// - -DRIVER_INIT_MEMBER(cybiko_state,cybiko) -{ - _logerror( 0, ("init_cybikov1\n")); - m_maincpu->space(AS_PROGRAM).install_ram(0x200000, 0x200000 + m_ram->size() - 1, 0, 0x200000 - m_ram->size(), m_ram->pointer()); -} - -DRIVER_INIT_MEMBER(cybiko_state,cybikoxt) -{ - _logerror( 0, ("init_cybikoxt\n")); - m_maincpu->space(AS_PROGRAM).install_ram(0x400000, 0x400000 + m_ram->size() - 1, 0, 0x200000 - m_ram->size(), m_ram->pointer()); -} - -QUICKLOAD_LOAD_MEMBER( cybiko_state, cybiko ) -{ - image.fread(m_flash1->get_ptr(), MIN(image.length(), 0x84000)); - - return IMAGE_INIT_PASS; -} - -QUICKLOAD_LOAD_MEMBER( cybiko_state, cybikoxt ) -{ - address_space &dest = m_maincpu->space(AS_PROGRAM); - UINT32 size = MIN(image.length(), RAMDISK_SIZE); - - dynamic_buffer buffer(size); - image.fread(&buffer[0], size); - for (int byte = 0; byte < size; byte++) - dest.write_byte(0x400000 + byte, buffer[byte]); - - return IMAGE_INIT_PASS; -} - -/////////////////// -// MACHINE START // -/////////////////// - -void cybiko_state::machine_start() -{ - _logerror( 0, ("machine_start_cybikov1\n")); - // serial port - cybiko_rs232_init(); - // other - machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybiko),this)); - - int nvram_size = RAMDISK_SIZE; - - if (m_ram->size() < nvram_size) - { - nvram_size = m_ram->size(); - } - - m_nvram->set_base(m_ram->pointer(), nvram_size); -} - -/////////////////// -// MACHINE RESET // -/////////////////// - -void cybiko_state::machine_reset() -{ - _logerror( 0, ("machine_reset_cybikov1\n")); - cybiko_rs232_reset(); -} - -////////////////// -// MACHINE STOP // -////////////////// - -void cybiko_state::machine_stop_cybiko() -{ - _logerror( 0, ("machine_stop_cybikov1\n")); - // serial port - cybiko_rs232_exit(); -} - -/////////// -// RS232 // -/////////// - - -void cybiko_state::cybiko_rs232_init() -{ - _logerror( 0, ("cybiko_rs232_init\n")); - memset( &m_rs232, 0, sizeof(m_rs232)); -// machine().scheduler().timer_pulse(TIME_IN_HZ( 10), FUNC(rs232_timer_callback)); -} - -void cybiko_state::cybiko_rs232_exit() -{ - _logerror( 0, ("cybiko_rs232_exit\n")); -} - -void cybiko_state::cybiko_rs232_reset() -{ - _logerror( 0, ("cybiko_rs232_reset\n")); -} - -void cybiko_state::cybiko_rs232_write_byte( int data ) -{ -// printf( "%c", data); -} - -void cybiko_state::cybiko_rs232_pin_sck( int data ) -{ - _logerror( 3, ("cybiko_rs232_pin_sck (%d)\n", data)); - // clock high-to-low - if ((m_rs232.pin.sck == 1) && (data == 0)) - { - // transmit - if (m_rs232.pin.txd) m_rs232.tx_byte = m_rs232.tx_byte | (1 << m_rs232.tx_bits); - m_rs232.tx_bits++; - if (m_rs232.tx_bits == 8) - { - m_rs232.tx_bits = 0; - cybiko_rs232_write_byte(m_rs232.tx_byte); - m_rs232.tx_byte = 0; - } - // receive - m_rs232.pin.rxd = (m_rs232.rx_byte >> m_rs232.rx_bits) & 1; - m_rs232.rx_bits++; - if (m_rs232.rx_bits == 8) - { - m_rs232.rx_bits = 0; - m_rs232.rx_byte = 0; - } - } - // save sck - m_rs232.pin.sck = data; -} - -void cybiko_state::cybiko_rs232_pin_txd( int data ) -{ - _logerror( 3, ("cybiko_rs232_pin_txd (%d)\n", data)); - m_rs232.pin.txd = data; -} - -int cybiko_state::cybiko_rs232_pin_rxd() -{ - _logerror( 3, ("cybiko_rs232_pin_rxd\n")); - return m_rs232.pin.rxd; -} - -int cybiko_state::cybiko_rs232_rx_queue() -{ - return 0; -} - -///////////////////////// -// READ/WRITE HANDLERS // -///////////////////////// - -READ16_MEMBER( cybiko_state::cybiko_lcd_r ) -{ - UINT16 data = 0; - if (ACCESSING_BITS_8_15) data |= (m_crtc->reg_idx_r(space, offset) << 8); - if (ACCESSING_BITS_0_7) data |= (m_crtc->reg_dat_r(space, offset) << 0); - return data; -} - -WRITE16_MEMBER( cybiko_state::cybiko_lcd_w ) -{ - if (ACCESSING_BITS_8_15) m_crtc->reg_idx_w(space, offset, (data >> 8) & 0xff); - if (ACCESSING_BITS_0_7) m_crtc->reg_dat_w(space, offset, (data >> 0) & 0xff); -} - -int cybiko_state::cybiko_key_r( offs_t offset, int mem_mask) -{ - UINT16 data = 0xFFFF; - for (UINT8 i = 0; i < 15; i++) - { - if (m_input[i] && !BIT(offset, i)) - data &= ~m_input[i]->read(); - } - if (data != 0xFFFF) - { - _logerror( 1, ("cybiko_key_r (%08X/%04X) %04X\n", offset, mem_mask, data)); - } - return data; -} - -READ16_MEMBER( cybiko_state::cybikov1_key_r ) -{ - return cybiko_key_r(offset, mem_mask); -} - -READ16_MEMBER( cybiko_state::cybikov2_key_r ) -{ - UINT16 data = cybiko_key_r(offset, mem_mask); - if (!BIT(offset, 0)) - data |= 0x0002; // or else [esc] does not work in "lost in labyrinth" - return data; -} - -READ16_MEMBER( cybiko_state::cybikoxt_key_r ) -{ - return cybiko_key_r(offset, mem_mask); -} - -#if 0 -READ16_MEMBER( cybiko_state::cybikov1_io_reg_r ) -{ - UINT16 data = 0; -#if 0 - _logerror( 2, ("cybikov1_io_reg_r (%08X)\n", offset)); - switch (offset) - { - // keyboard - case h8_device::PORT_1: - { - if (!BIT(ioport("A1")->read(), 1)) - data |= (1 << 3); // "esc" key - } - break; - // serial dataflash - case h8_device::PORT_3: - { - if (m_flash1->so_r()) - data |= H8S_P3_RXD1; - } - break; - // rs232 - case h8_device::PORT_5: - { - if (cybiko_rs232_pin_rxd()) - data |= H8S_P5_RXD2; - } - break; - // real-time clock - case h8_device::PORT_F: - { - data = H8S_PF_PF2; - if (m_rtc->sda_r()) - data |= H8S_PF_PF0; - } - break; - // serial 2 - case H8S_IO_SSR2 : - { - if (cybiko_rs232_rx_queue()) - data |= H8S_SSR_RDRF; - } - break; - } -#endif - return data; -} - -READ16_MEMBER( cybiko_state::cybikov2_io_reg_r ) -{ - UINT16 data = 0; -#if 0 - _logerror( 2, ("cybikov2_io_reg_r (%08X)\n", offset)); - switch (offset) - { - // keyboard - case h8_device::PORT_1 : - { - if (!BIT(ioport("A1")->read(), 1)) - data |= (1 << 3); // "esc" key - } - break; - // serial dataflash - case h8_device::PORT_3 : - { - if (m_flash1->so_r()) - data |= H8S_P3_RXD1; - } - break; - // rs232 - case h8_device::PORT_5 : - { - if (cybiko_rs232_pin_rxd()) - data |= H8S_P5_RXD2; - } - break; - // real-time clock - case h8_device::PORT_F : - { - data = H8S_PF_PF2; - if (m_rtc->sda_r()) - data |= H8S_PF_PF0; - } - break; - // serial 2 - case H8S_IO_SSR2 : - { - if (cybiko_rs232_rx_queue()) - data |= H8S_SSR_RDRF; - } - break; - } -#endif - return data; -} - -READ16_MEMBER( cybiko_state::cybikoxt_io_reg_r ) -{ - UINT16 data = 0; -#if 0 - _logerror( 2, ("cybikoxt_io_reg_r (%08X)\n", offset)); - switch (offset) - { - // rs232 - case h8_device::PORT_3 : - { - if (cybiko_rs232_pin_rxd()) - data |= H8S_P3_RXD1; - } - break; - // ... - case h8_device::PORT_A : - { - data |= (1 << 6); // recharge batteries (xtreme) - data |= (1 << 7); // on/off key (xtreme) - } - break; - // real-time clock - case h8_device::PORT_F : - { - if (m_rtc->sda_r()) - data |= H8S_PF_PF6; - } - break; - // serial 1 - case H8S_IO_SSR1 : - { - if (cybiko_rs232_rx_queue()) - data |= H8S_SSR_RDRF; - } - break; - } -#endif - return data; -} - -WRITE16_MEMBER( cybiko_state::cybikov1_io_reg_w ) -{ -#if 0 - _logerror( 2, ("cybikov1_io_reg_w (%08X/%02X)\n", offset, data)); - switch (offset) - { - // speaker - case H8S_IO_P1DR : - { - m_speaker->level_w((data & H8S_P1_TIOCB1) ? 1 : 0); - } - break; - // serial dataflash - case H8S_IO_P3DR : - { - m_flash1->cs_w ((data & H8S_P3_SCK0) ? 0 : 1); - m_flash1->si_w ((data & H8S_P3_TXD1) ? 1 : 0); - m_flash1->sck_w((data & H8S_P3_SCK1) ? 1 : 0); - } - break; - // rs232 - case H8S_IO_P5DR : - { - cybiko_rs232_pin_txd((data & H8S_P5_TXD2) ? 1 : 0); - cybiko_rs232_pin_sck((data & H8S_P5_SCK2) ? 1 : 0); - } - break; - // real-time clock - case H8S_IO_PFDR : - { - m_rtc->scl_w((data & H8S_PF_PF1) ? 1 : 0); - } - break; - // real-time clock - case H8S_IO_PFDDR : - { - m_rtc->sda_w((data & H8S_PF_PF0) ? 0 : 1); - } - break; - } -#endif -} - -WRITE16_MEMBER( cybiko_state::cybikov2_io_reg_w ) -{ -#if 0 - _logerror( 2, ("cybikov2_io_reg_w (%08X/%02X)\n", offset, data)); - switch (offset) - { - // speaker - case H8S_IO_P1DR : - { - m_speaker->level_w((data & H8S_P1_TIOCB1) ? 1 : 0); - } - break; - // serial dataflash - case H8S_IO_P3DR : - { - m_flash1->cs_w ((data & H8S_P3_SCK0) ? 0 : 1); - m_flash1->si_w ((data & H8S_P3_TXD1) ? 1 : 0); - m_flash1->sck_w((data & H8S_P3_SCK1) ? 1 : 0); - } - break; - // rs232 - case H8S_IO_P5DR : - { - cybiko_rs232_pin_txd((data & H8S_P5_TXD2) ? 1 : 0); - cybiko_rs232_pin_sck((data & H8S_P5_SCK2) ? 1 : 0); - } - break; - // real-time clock - case H8S_IO_PFDR : - { - m_rtc->scl_w((data & H8S_PF_PF1) ? 1 : 0); - } - break; - // real-time clock - case H8S_IO_PFDDR : - { - m_rtc->sda_w((data & H8S_PF_PF0) ? 0 : 1); - } - break; - } -#endif -} - -WRITE16_MEMBER( cybiko_state::cybikoxt_io_reg_w ) -{ -#if 0 - _logerror( 2, ("cybikoxt_io_reg_w (%08X/%02X)\n", offset, data)); - switch (offset) - { - // speaker - case H8S_IO_P1DR : - { - m_speaker->level_w((data & H8S_P1_TIOCB1) ? 1 : 0); - } - break; - // rs232 - case H8S_IO_P3DR : - { - cybiko_rs232_pin_txd((data & H8S_P3_TXD1) ? 1 : 0); - cybiko_rs232_pin_sck((data & H8S_P3_SCK1) ? 1 : 0); - } - break; - // real-time clock - case H8S_IO_PFDR : - { - m_rtc->scl_w((data & H8S_PF_PF1) ? 1 : 0); - } - break; - // real-time clock - case H8S_IO_PFDDR : - { - m_rtc->sda_w((data & H8S_PF_PF6) ? 0 : 1); - } - break; - } -#endif -} -#endif - -// Cybiko Xtreme writes following byte pairs to 0x200003/0x200000 -// 00/01, 00/C0, 0F/32, 0D/03, 0B/03, 09/50, 07/D6, 05/00, 04/00, 20/00, 23/08, 27/01, 2F/08, 2C/02, 2B/08, 28/01 -// 04/80, 05/02, 00/C8, 00/C8, 00/C0, 1B/2C, 00/01, 00/C0, 1B/6C, 0F/10, 0D/07, 0B/07, 09/D2, 07/D6, 05/00, 04/00, -// 20/00, 23/08, 27/01, 2F/08, 2C/02, 2B/08, 28/01, 37/08, 34/04, 33/08, 30/03, 04/80, 05/02, 1B/6C, 00/C8 -WRITE16_MEMBER( cybiko_state::cybiko_usb_w ) -{ - if (ACCESSING_BITS_8_15) _logerror( 2, ("[%08X] <- %02X\n", 0x200000 + offset * 2 + 0, (data >> 8) & 0xFF)); - if (ACCESSING_BITS_0_7) _logerror( 2, ("[%08X] <- %02X\n", 0x200000 + offset * 2 + 1, (data >> 0) & 0xFF)); -} diff --git a/src/mess/machine/dai.c b/src/mess/machine/dai.c deleted file mode 100644 index 9ea8258f805..00000000000 --- a/src/mess/machine/dai.c +++ /dev/null @@ -1,216 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha, Nathan Woods -/*************************************************************************** - - machine/dai.c - - Functions to emulate general aspects of DAI (RAM, ROM, interrupts, I/O ports) - - Krzysztof Strzecha - Nathan Woods - -***************************************************************************/ - -#include "emu.h" -#include "includes/dai.h" - -#define DEBUG_DAI_PORTS 0 - -#define LOG_DAI_PORT_R(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port read : %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0) -#define LOG_DAI_PORT_W(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port write: %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0) - -void dai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BOOTSTRAP: - m_maincpu->set_pc(0xc000); - break; - case TIMER_TMS5501: - m_tms5501->xi7_w((ioport("IN8")->read() & 0x04) ? 1:0); - timer_set(attotime::from_hz(100), TIMER_TMS5501); - break; - default: - assert_always(FALSE, "Unknown id in dai_state::device_timer"); - } -} - - -/* Discrete I/O devices */ - - -/* Memory */ - -WRITE8_MEMBER(dai_state::dai_stack_interrupt_circuit_w) -{ - m_tms5501->sens_w(1); - m_tms5501->sens_w(0); -} - -void dai_state::dai_update_memory(int dai_rom_bank) -{ - membank("bank2")->set_entry(dai_rom_bank); -} - - -READ8_MEMBER(dai_state::dai_keyboard_r) -{ - UINT8 data = 0x00; - static const char *const keynames[] = { "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7" }; - - for (int i = 0; i < 8; i++) - { - if (m_keyboard_scan_mask & (1 << i)) - data |= ioport(keynames[i])->read(); - } - - return data; -} - -WRITE8_MEMBER(dai_state::dai_keyboard_w) -{ - m_keyboard_scan_mask = data; -} - -IRQ_CALLBACK_MEMBER(dai_state::int_ack) -{ - return m_tms5501->get_vector(); -} - -void dai_state::machine_start() -{ - membank("bank2")->configure_entries(0, 4, memregion("maincpu")->base() + 0x010000, 0x1000); - timer_set(attotime::zero, TIMER_BOOTSTRAP); - timer_set(attotime::from_hz(100), TIMER_TMS5501); - - memset(m_ram->pointer(), 0, m_ram->size()); -} - -void dai_state::machine_reset() -{ - membank("bank1")->set_base(m_ram->pointer()); -} - -/*************************************************************************** - - Discrete Devices IO - - FD00 POR1: IN bit 0 - - bit 1 - - bit 2 PIPGE: Page signal - bit 3 PIDTR: Serial output ready - bit 4 PIBU1: Button on paddle 1 (1 = closed) - bit 5 PIBU1: Button on paddle 2 (1 = closed) - bit 6 PIRPI: Random data - bit 7 PICAI: Cassette input data - - FD01 PDLST: IN Single pulse used to trigger paddle timer circuit - - FD04 POR1: OUT bit 0-3 Volume oscillator channel 0 - bit 4-7 Volume oscillator channel 1 - - FD05 POR1: OUT bit 0-3 Volume oscillator channel 2 - bit 4-7 Volume random noise generator - - FD06 POR0: OUT bit 0 POCAS: Cassette data output - bit 1-2 PDLMSK: Paddle select - bit 3 PDPNA: Paddle enable - bit 4 POCM1: Cassette 1 motor control (0 = run) - bit 5 POCM2: Cassette 2 motor control (0 = run) - bit 6-7 ROM bank switching -***************************************************************************/ - -READ8_MEMBER(dai_state::dai_io_discrete_devices_r) -{ - UINT8 data = 0x00; - - switch(offset & 0x000f) { - case 0x00: - data = ioport("IN8")->read(); - data |= 0x08; // serial ready - if (machine().rand()&0x01) - data |= 0x40; // random number generator - if (m_cassette->input() > 0.01) - data |= 0x80; // tape input - break; - - default: - data = 0xff; - LOG_DAI_PORT_R (offset, data, "discrete devices - unmapped"); - - break; - } - return data; -} - -WRITE8_MEMBER(dai_state::dai_io_discrete_devices_w) -{ - switch(offset & 0x000f) { - case 0x04: - m_sound->set_volume(space, offset, data); - LOG_DAI_PORT_W (offset, data&0x0f, "discrete devices - osc. 0 volume"); - LOG_DAI_PORT_W (offset, (data&0xf0)>>4, "discrete devices - osc. 1 volume"); - break; - - case 0x05: - m_sound->set_volume(space, offset, data); - LOG_DAI_PORT_W (offset, data&0x0f, "discrete devices - osc. 2 volume"); - LOG_DAI_PORT_W (offset, (data&0xf0)>>4, "discrete devices - noise volume"); - break; - - case 0x06: - m_paddle_select = (data&0x06)>>2; - m_paddle_enable = (data&0x08)>>3; - m_cassette_motor[0] = (data&0x10)>>4; - m_cassette_motor[1] = (data&0x20)>>5; - m_cassette->change_state(m_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_cassette->output((data & 0x01) ? -1.0 : 1.0); - dai_update_memory ((data&0xc0)>>6); - LOG_DAI_PORT_W (offset, (data&0x06)>>2, "discrete devices - paddle select"); - LOG_DAI_PORT_W (offset, (data&0x08)>>3, "discrete devices - paddle enable"); - LOG_DAI_PORT_W (offset, (data&0x10)>>4, "discrete devices - cassette motor 1"); - LOG_DAI_PORT_W (offset, (data&0x20)>>5, "discrete devices - cassette motor 2"); - LOG_DAI_PORT_W (offset, (data&0xc0)>>6, "discrete devices - ROM bank"); - break; - - default: - LOG_DAI_PORT_W (offset, data, "discrete devices - unmapped"); - break; - } -} - -/*************************************************************************** - - PIT8253 - - Offset need to be shifted by 1 to right, because the PIT is - connected to A1 and A2 - -***************************************************************************/ - -READ8_MEMBER(dai_state::dai_pit_r) -{ - return m_pit->read(space, (offset >> 1) & 3); -} - -WRITE8_MEMBER(dai_state::dai_pit_w) -{ - m_pit->write(space, (offset >> 1) & 3, data); -} - -/*************************************************************************** - - AMD 9911 mathematical coprocesor - -***************************************************************************/ - -READ8_MEMBER(dai_state::dai_amd9511_r) -{ - /* optional and no present at this moment */ - return 0xff; -} - -WRITE8_MEMBER(dai_state::dai_amd9511_w) -{ - logerror ("Writing to AMD9511 math chip, %04x, %02x\n", offset, data); -} diff --git a/src/mess/machine/dccons.c b/src/mess/machine/dccons.c deleted file mode 100644 index 48f4bd372a6..00000000000 --- a/src/mess/machine/dccons.c +++ /dev/null @@ -1,196 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese, R. Belmont -/* - - dc.c - Sega Dreamcast hardware - - MESS (DC home console) hardware overrides (GD-ROM drive etc) - - c230048 - 5 is written, want 6 - c0d9d9e - where bad happens, from routine @ c0da260 - - c0d9d8e - R0 on return is the value to put in - - cfffee0 - stack location when bad happens - - TODO: - - gdrom_alt_status is identical to normal status except that "but it does not clear DMA status information when it is accessed" - -*/ - -#include "emu.h" -#include "cdrom.h" -#include "debugger.h" -#include "includes/dc.h" -#include "cpu/sh4/sh4.h" -#include "sound/aica.h" -#include "includes/dccons.h" - -#define ATAPI_CYCLES_PER_SECTOR (5000) // TBD for Dreamcast - -WRITE_LINE_MEMBER(dc_cons_state::ata_interrupt) -{ - if (state) - dc_sysctrl_regs[SB_ISTEXT] |= IST_EXT_GDROM; - else - dc_sysctrl_regs[SB_ISTEXT] &= ~IST_EXT_GDROM; - - dc_update_interrupt_status(); -} - -TIMER_CALLBACK_MEMBER(dc_cons_state::atapi_xfer_end ) -{ - UINT8 sector_buffer[ 4096 ]; - - atapi_timer->adjust(attotime::never); - - printf("atapi_xfer_end atapi_xferlen = %d\n", atapi_xferlen ); - - //osd_printf_debug("ATAPI: xfer_end. xferlen = %d\n", atapi_xferlen); - - m_ata->write_dmack(1); - - while (atapi_xferlen > 0 ) - { - struct sh4_ddt_dma ddtdata; - - // get a sector from the SCSI device - for (int i = 0; i < 2048/2; i++) - { - int d = m_ata->read_dma(); - sector_buffer[ i*2 ] = d & 0xff; - sector_buffer[ (i*2)+1 ] = d >> 8; - } - - atapi_xferlen -= 2048; - - // perform the DMA - ddtdata.destination = atapi_xferbase; // destination address - ddtdata.length = 2048/4; - ddtdata.size = 4; - ddtdata.buffer = sector_buffer; - ddtdata.direction=1; // 0 source to buffer, 1 buffer to destination - ddtdata.channel= 0; - ddtdata.mode= -1; // copy from/to buffer - printf("ATAPI: DMA one sector to %x, %x remaining\n", atapi_xferbase, atapi_xferlen); - m_maincpu->sh4_dma_ddt(&ddtdata); - - atapi_xferbase += 2048; - } - - m_ata->write_dmack(0); - - g1bus_regs[SB_GDST]=0; - dc_sysctrl_regs[SB_ISTNRM] |= IST_DMA_GDROM; - dc_update_interrupt_status(); -} - -void dc_cons_state::dreamcast_atapi_init() -{ - atapi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dc_cons_state::atapi_xfer_end),this)); - atapi_timer->adjust(attotime::never); - save_item(NAME(atapi_xferlen)); - save_item(NAME(atapi_xferbase)); -} - -/* - - GDROM regsters: - - 5f7018: alternate status/device control - 5f7080: data - 5f7084: error/features - 5f7088: interrupt reason/sector count - 5f708c: sector number - 5f7090: byte control low - 5f7094: byte control high - 5f7098: drive select - 5f709c: status/command - -c002910 - ATAPI packet writes -c002796 - aux status read after that -c000776 - DMA triggered to c008000 - -*/ - -READ32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_r ) -{ - switch(offset) - { - case SB_GDSTARD: - printf("G1CTRL: GDSTARD %08x\n", atapi_xferbase); // Hello Kitty reads here - debugger_break(machine()); - return atapi_xferbase; - case SB_GDST: - break; - case SB_GDLEND: - //debugger_break(machine()); - return atapi_xferlen; // TODO: check me - default: - printf("G1CTRL: Unmapped read %08x\n", 0x5f7400+offset*4); - debugger_break(machine()); - } - return g1bus_regs[offset]; -} - -WRITE32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_w ) -{ - g1bus_regs[offset] = data; // 5f7400+reg*4=dat -// osd_printf_verbose("G1CTRL: [%08x=%x] write %" I64FMT "x to %x, mask %" I64FMT "x\n", 0x5f7400+reg*4, dat, data, offset, mem_mask); - switch (offset) - { - case SB_GDST: - if (data & 1 && g1bus_regs[SB_GDEN] == 1) // 0 -> 1 - { - if (g1bus_regs[SB_GDDIR] == 0) - { - printf("G1CTRL: unsupported transfer\n"); - return; - } - - atapi_xferbase = g1bus_regs[SB_GDSTAR]; - //atapi_timer->adjust(m_maincpu->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048)))); - /* 12x * 75 Hz = 0,00(1) secs per sector */ - /* TODO: make DMA to be single step */ - atapi_timer->adjust(attotime::from_usec(1111*atapi_xferlen/2048)); -// atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80; - } - break; - - case SB_GDLEN: - atapi_xferlen = data; - break; - -/* - The following register is involved in BIOS checksum protection system. - current understanding of its functioning based on several hardware tests: - - after power on system is in "protected state": - - access to G1 ATA register area (5F70XX) is locked, ie GD-ROM in Dreamcast or cartridge/DIMM in arcade systems is not accessible; - - *any* data readed via G1 data bus (ie BIOS) is summed internally by chipset; - - write to GD_UNLOCK (5F74E4) register set "last address" of checksummed area; - - then readed address matches with "last address" - calculated summ compared with some hardcoded value - if values match - system becomes in "unlocked state": - - G1 ATA registers unlocked; - - by write to GD_UNLOCK register system can be switched back to "protected state" - - if values doesn't match - system switch to "locked state": - - similar to protected, but data summing seems not performed anymore, - at least write to GD_UNLOCK and "pumping" through G1 bus data chunk with valid checksumm have no effect; - - the only exit from this state - power off/on or reset; - - actual checksum algorithm is unknown, but its supposed to be simple and weak, - known few modded BIOSes which succesfully passes this CRC check, because of good luck - - all described above works the same way in all HOLLY/CLX2-based systems - Dreamcast, Naomi 1/2, Atomiswave, SystemSP -*/ - case GD_UNLOCK: - if (data==0 || data==0x001fffff || data==0x42fe) - { -// atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80; - printf("Unlocking GD-ROM! %x\n", data); - } - break; - } -} diff --git a/src/mess/machine/dec_lk201.c b/src/mess/machine/dec_lk201.c deleted file mode 100644 index b110b45cfe3..00000000000 --- a/src/mess/machine/dec_lk201.c +++ /dev/null @@ -1,760 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont, M. Burke -/* - DEC LK-201 keyboard - Emulation by R. Belmont & M. Burke - - This is the later "cost-reduced" 6805 version; there's also an 8048 version. - The LK-201 mechanical elements are described in US Patent 4,467,150 -*/ - -/* LK201-AA keyboard matrix (8048 version with updates) - Source: VCB02 Technical Reference. - - KBD controller scan matrix (PORT 1): 8 x BCD IN => 18 DECIMAL OUT - - Keyboard itself: - 18 x IN (KEYBOARD DRIVE) KBD 17... KBD 0 => - 8 OUT (keyboard data @ D7..D0) - - to => PORT 0 @ KBD controller. - -________|D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 -..KBD17:|[R] |F19 |[R] |F20|PF4|N- | N,| Enter -........| | | | | | NOTE1) -........| |G22 | |G23|E23|D23|C23| A23 ---------|----|----|----|---|---|---|---|--- -..KBD16:|F18 |PF3 |[R] |N9 |C:D|N6 |N3 |N. -........|G21 |E22 | |D22|B17|C22|B22|A22 ---------|----|----|----|---|---|---|---|--- -..KBD15:|F17 |PF2 |[R] |N8 |N5 |C:R| N2|N0 -........| | | | | | | |NOTE 2) -........|G20 |E21 | |D21|C21|B18|B21| ---------|----|----|----|---|---|---|---|--- - KBD14:|PF1 |Next|Rem-|C:U|N7 |N4 |N1 |N0 -........| |Scrn|move|...| | | | -........|E20 |D18 |E18 |C17|D20|C20|B20|A20 ---------|----|----|----|---|---|---|---|--- -..KBD13:|Ins.|--- |'Do'|Prev { |" |[R]|[R] -........|Here|- | Scrn| [ |' | | -........|E17 |E11 |G16 |D17|D11|C11| | ---------|----|----|----|---|---|---|---|--- -..KBD12:|Find|+ |Help|Se-| } |Re-|C:L| | -........| |= | |lect ] |turn...| \ -........|E16 |E12 |G15 |D16 D12|C13|B16|C12 ---------|----|----|----|---|---|---|---|--- -..KBD11:Addtnl -........|Scrn| 2 |....| | | | |< -........|G99 |E02 |....|D00|D02|C02|B02|B00 ---------|----|----|----|---|---|---|---|--- -..KBD_2: [R] |[R] |[R] |~ |! |Q |A |Z -........|..............|...|1 -........|..............|E00 E01 D01 C01 B01 ---------|----|----|----|---|---|---|---|--- -..KBD_1: Ctrl|Lock|Comp|[R] -........|C99 |C00 |A99 | ---------|----|----|----|---|---|---|---|--- -..KBD_0: Shift -........|B99,B11 - ---- - [R] = Reserved - NOTE 1) N0-N9, N-, N. and N, refer to numeric keypad - NOTE 2) N0 can be divided into 2 keys. - Normally only the N0 keyswitch is implemented as a double-sized key. - NOTE 3) Return key occupies 2 positions that are - decoded as the Return (C13) key. - - C:D - Cursor down (B17) - C:U - Cursor up (C17) - C:R - Cursor right (B18) - C:L - Cursor left (B16) - */ - -#include "emu.h" -#include "dec_lk201.h" -#include "cpu/m6805/m6805.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LK201_CPU_TAG "lk201_cpu" -#define LK201_SPK_TAG "beeper" - -//------------------------------------------------- -// SERIAL COMMUNICATIONS INTERFACE -//------------------------------------------------- - -#define SCI_BAUD 0 // Baud rate register -#define BAUD_SCR 0x07 // SCI baud rate select -#define BAUD_SCP 0x30 // SCI prescaler select - -#define SCI_SCCR1 1 // Control register 1 -#define SCCR1_WAKE 0x08 // Wakeup method -#define SCCR1_M 0x10 // Character length -#define SCCR1_T8 0x40 // Transmit bit 8 -#define SCCR1_R8 0x80 // Receive bit 8 - -#define SCI_SCCR2 2 // Control register 2 -#define SCCR2_SBK 0x01 // Send break -#define SCCR2_RWU 0x02 // Receiver wakeup enable -#define SCCR2_RE 0x04 // Receiver enable -#define SCCR2_TE 0x08 // Transmitter enable -#define SCCR2_ILIE 0x10 // Idle line interrupt enable -#define SCCR2_RIE 0x20 // Receiver interrupt enable -#define SCCR2_TCIE 0x40 // Transmit complete interrupt enable -#define SCCR2_TIE 0x80 // Transmit interrupt enable - -#define SCI_SCSR 3 // Status register -#define SCSR_FE 0x02 // Receiver framing error -#define SCSR_NF 0x04 // Receiver noise -#define SCSR_OR 0x08 // Receiver overrun -#define SCSR_IDLE 0x10 // Receiver idle -#define SCSR_RDRF 0x20 // Receive data register full -#define SCSR_TC 0x40 // Transmit complete -#define SCSR_TDRE 0x80 // Transmit data register empty -#define SCSR_INT (SCSR_IDLE | SCSR_RDRF| \ - SCSR_TC | SCSR_TDRE) // Interrupt sources - -#define SCI_SCDR 4 // Data register - -//------------------------------------------------- -// SERIAL PERIPHERAL INTERFACE -//------------------------------------------------- - -#define SPI_SPCR 0 // Control register -#define SPCR_SPR 0x03 // SPI clock rate select -#define SPCR_CPHA 0x04 // Clock phase -#define SPCR_CPOL 0x08 // Clock polarity -#define SPCR_MSTR 0x10 // Master mode select -#define SPCR_DWOM 0x20 // Port D wire-or mode option -#define SPCR_SPE 0x40 // Serial peripheral system enable -#define SPCR_SPIE 0x80 // Serial peripheral interrupt enable - -#define SPI_SPSR 1 // Status register -#define SPSR_MODF 0x10 // Mode fault flag -#define SPSR_WCOL 0x40 // Write collision -#define SPSR_SPIF 0x80 // SPI transfer complete - -#define SPI_SPDR 2 // Data I/O Register - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type LK201 = &device_creator; - -ROM_START( lk201 ) - ROM_REGION(0x2000, LK201_CPU_TAG, 0) - ROM_LOAD( "23-001s9-00.bin", 0x0000, 0x2000, CRC(be293c51) SHA1(a11ae004d2d6055d7279da3560c3e56610a19fdb) ) -ROM_END - -//------------------------------------------------- -// ADDRESS_MAP -//------------------------------------------------- - -static ADDRESS_MAP_START( lk201_map, AS_PROGRAM, 8, lk201_device ) - AM_RANGE(0x0000, 0x0002) AM_READWRITE(ports_r, ports_w) - AM_RANGE(0x0004, 0x0006) AM_READWRITE(ddr_r, ddr_w) - AM_RANGE(0x000a, 0x000c) AM_READWRITE(spi_r, spi_w) - AM_RANGE(0x000d, 0x0011) AM_READWRITE(sci_r, sci_w) - AM_RANGE(0x0050, 0x00ff) AM_RAM - AM_RANGE(0x0100, 0x1fff) AM_ROM AM_REGION(LK201_CPU_TAG, 0x100) -ADDRESS_MAP_END - -//------------------------------------------------- -// MACHINE_CONFIG -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( lk201 ) - MCFG_CPU_ADD(LK201_CPU_TAG, M68HC05EG, 2000000) // actually 68HC05C4 - MCFG_CPU_PROGRAM_MAP(lk201_map) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(LK201_SPK_TAG, BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor lk201_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( lk201 ); -} - -const rom_entry *lk201_device::device_rom_region() const -{ - return ROM_NAME( lk201 ); -} - -//------------------------------------------------- -// INPUT_PORTS( lk201 ) -//------------------------------------------------- - -/* [Foreign language caps] are referenced in software titles. Please leave them in. - - DEC omitted terms like 'Interrupt', 'Break' and 'Data / Talk' on some keyboards, - so Fn numbers are definitely important for end users. - - === CURRENT SPECIAL KEYS === - [PC-AT] ......=> [DEC] - LEFT CONTROL..=> Control - LEFT ALT .....=> Compose - - RIGHT ALT ....=> Help - RIGHT CONTROL => Do - ============================================================================================== - === (PC - AT ) keys above cursor block === - * KEYCODE_INSERT * KEYCODE_HOME * KEYCODE_PGUP - * KEYCODE_DEL... * KEYCODE_END * KEYCODE_PGDN - - === (DEC LK 201 layout above cursor) === - * Find ........| Insert Here | Remove - * Select.........| Prev ..... | Next - ============================================================================================== - === CURRENT NUM PAD ASSIGNMENTS === - [PF1] to [PF4] are mapped to NUM LOCK, SLASH etc. (=> 4 keys on top on num pad). - Num pad '+' gives ',' on the DEC. - ',' translates to '.' (=> more or less the layout of model 'LK-201-AG') - - Switch between 'full' and 'partial keyboard emulation' with Scroll Lock. -*/ - -INPUT_PORTS_START( lk201 ) - -#ifndef KEYBOARD_WORKAROUND - PORT_START("KBD0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) - - PORT_START("KBD1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Compose") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) - - PORT_START("KBD2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tilde") PORT_CODE(KEYCODE_TILDE) // E00 - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("<") PORT_CODE(KEYCODE_BACKSLASH2) // B00 - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Hold Screen (F1)") PORT_CODE(KEYCODE_F1) - - PORT_START("KBD4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Setup (F3)") PORT_CODE(KEYCODE_PAUSE) // SET UP = Pause on PC - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Print Screen (F2)") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break (F5)") PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Data / Talk (F4)") PORT_CODE(KEYCODE_F4) - - PORT_START("KBD6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Interrupt (F6) [X]") PORT_CODE(KEYCODE_F6) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Resume (F7) [Fortsetzen]") PORT_CODE(KEYCODE_F7) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cancel (F8) [Zuruecknehmen]") PORT_CODE(KEYCODE_F8) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Exit (F10) [Fertig]") PORT_CODE(KEYCODE_F10) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Main Screen (F9) [Hauptbild]") PORT_CODE(KEYCODE_F9) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC (F11)") PORT_CODE(KEYCODE_F11) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LF (F13)") PORT_CODE(KEYCODE_F13) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS (F12)") PORT_CODE(KEYCODE_F12) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD11") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // FIXME - duplicate "Return" - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete set_input_line(M68HC05EG_INT_CPI, 1); - } - else - { - m_maincpu->set_input_line(M68HC05EG_INT_CPI, 0); - } -} - -READ8_MEMBER( lk201_device::ddr_r ) -{ - return ddrs[offset]; -} - -WRITE8_MEMBER( lk201_device::ddr_w ) -{ -// printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, m_maincpu->pc()); - - send_port(space, offset, ports[offset] & data); - - ddrs[offset] = data; -} - -READ8_MEMBER( lk201_device::ports_r ) -{ - UINT8 incoming = 0; - - // apply data direction registers - incoming &= (ddrs[offset] ^ 0xff); - // add in ddr-masked version of port writes - incoming |= (ports[offset] & ddrs[offset]); - -// printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], m_maincpu->pc()); - - return incoming; -} - -WRITE8_MEMBER( lk201_device::ports_w ) -{ - send_port(space, offset, data); - - ports[offset] = data; -} - -void lk201_device::send_port(address_space &space, UINT8 offset, UINT8 data) -{ -// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->pc()); - - switch (offset) - { - case 0: // port A - break; - - case 1: // port B - break; - - case 2: // port C - // Check for keyboard read strobe - if (((data & 0x40) == 0) && (ports[offset] & 0x40)) - { -#ifndef KEYBOARD_WORKAROUND - if (ports[0] & 0x1) kbd_data = m_kbd0->read(); - if (ports[0] & 0x2) kbd_data = m_kbd1->read(); - if (ports[0] & 0x4) kbd_data = m_kbd2->read(); - if (ports[0] & 0x8) kbd_data = m_kbd3->read(); - if (ports[0] & 0x10) kbd_data = m_kbd4->read(); - if (ports[0] & 0x20) kbd_data = m_kbd5->read(); - if (ports[0] & 0x40) kbd_data = m_kbd6->read(); - if (ports[0] & 0x80) kbd_data = m_kbd7->read(); - if (ports[1] & 0x1) kbd_data = m_kbd8->read(); - if (ports[1] & 0x2) kbd_data = m_kbd9->read(); - if (ports[1] & 0x4) kbd_data = m_kbd10->read(); - if (ports[1] & 0x8) kbd_data = m_kbd11->read(); - if (ports[1] & 0x10) kbd_data = m_kbd12->read(); - if (ports[1] & 0x20) kbd_data = m_kbd13->read(); - if (ports[1] & 0x40) kbd_data = m_kbd14->read(); - if (ports[1] & 0x80) kbd_data = m_kbd15->read(); - if (ports[2] & 0x1) kbd_data = m_kbd16->read(); - if (ports[2] & 0x2) kbd_data = m_kbd17->read(); - } - // Check for LED update strobe - if (((data & 0x80) == 0) && (ports[offset] & 0x80)) - { - // Lower nibble contains the LED values (1 = on, 0 = off) - output_set_value("led_wait" , (led_data & 0x1) == 0); - output_set_value("led_compose", (led_data & 0x2) == 0); - output_set_value("led_hold" , (led_data & 0x4) == 0); - output_set_value("led_lock" , (led_data & 0x8) == 0); - } -#endif - - break; - } -} - -READ8_MEMBER( lk201_device::sci_r ) -{ - UINT8 incoming = 0; - - switch (offset) - { - case SCI_BAUD: // Baud rate - break; - - case SCI_SCCR1: // Control 1 - break; - - case SCI_SCCR2: // Control 2 - incoming = sci_ctl2; - break; - - case SCI_SCSR: // Status - incoming = sci_status; - break; - - case SCI_SCDR: // Data - incoming = get_received_char(); - sci_status &= ~SCSR_RDRF; - m_maincpu->set_input_line(M68HC05EG_INT_CPI, 0); - update_interrupts(); - break; - } - -// printf("SCI read @ %x = %02x (PC=%x)\n", offset, incoming, m_maincpu->pc()); - - return incoming; -} - -WRITE8_MEMBER( lk201_device::sci_w ) -{ - switch (offset) - { - case SCI_BAUD: // Baud rate - break; - - case SCI_SCCR1: // Control 1 - break; - - case SCI_SCCR2: // Control 2 - sci_ctl2 = data; - update_interrupts(); - break; - - case SCI_SCSR: // Status - break; - - case SCI_SCDR: // Data -// printf("LK201: sending %02x\n", data); - transmit_register_setup(data); - sci_status &= ~(SCSR_TC | SCSR_TDRE); - m_maincpu->set_input_line(M68HC05EG_INT_CPI, 0); - update_interrupts(); - break; - } - -// printf("SCI %02x to %x (PC=%x)\n", data, offset, m_maincpu->pc()); -} - -READ8_MEMBER( lk201_device::spi_r ) -{ - UINT8 incoming = 0; - - switch (offset) - { - case SPI_SPCR: // Control - break; - - case SPI_SPSR: // Status - incoming = spi_status; - spi_status &= ~SPSR_SPIF; - break; - - case SPI_SPDR: // Data I/O - incoming = spi_data; - break; - } - -// printf("SPI read @ %x = %02x (PC=%x)\n", offset, incoming, m_maincpu->pc()); - - return incoming; -} - -WRITE8_MEMBER( lk201_device::spi_w ) -{ - switch (offset) - { - case SPI_SPCR: // Control - break; - - case SPI_SPSR: // Status (read only) - break; - - case SPI_SPDR: // Data I/O - spi_data = data; - - // Transfer only allowed if transfer complete flag has been acknowleged - if ((spi_status & SPSR_SPIF) == 0) - { - // Data out - led_data = data; - - // Data in - spi_data = kbd_data; - - // Indicate transfer complete - spi_status |= SPSR_SPIF; - } - break; - } - -// printf("SPI %02x to %x (PC=%x)\n", data, offset, m_maincpu->pc()); -} diff --git a/src/mess/machine/dec_lk201.h b/src/mess/machine/dec_lk201.h deleted file mode 100644 index 34f25e32dae..00000000000 --- a/src/mess/machine/dec_lk201.h +++ /dev/null @@ -1,117 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont, M. Burke -#pragma once - -#ifndef __LK201_H__ -#define __LK201_H__ - -#include "emu.h" -#include "sound/beep.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LK_CMD_LEDS_ON 0x13 /* light LEDs - 1st param: led bitmask */ -#define LK_CMD_LEDS_OFF 0x11 /* turn off LEDs */ - -#define LK_CMD_DIS_KEYCLK 0x99 /* disable the keyclick */ -#define LK_CMD_ENB_KEYCLK 0x1b /* enable the keyclick - 1st param: volume */ -//#define LK_CMD_DIS_CTLCLK 0xb9 /* disable the Ctrl keyclick */ -//#define LK_CMD_ENB_CTLCLK 0xbb /* enable the Ctrl keyclick */ -#define LK_CMD_SOUND_CLK 0x9f /* emit a keyclick - 1st param: volume */ -#define LK_CMD_DIS_BELL 0xa1 /* disable the bell */ -#define LK_CMD_ENB_BELL 0x23 /* enable the bell - 1st param: volume */ -#define LK_CMD_BELL 0xa7 /* emit a bell - 1st param: volume */ - -#define LK_CMD_POWER_UP 0xfd /* init power-up sequence */ - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_LK201_TX_HANDLER(_cb) \ - devcb = &lk201_device::set_tx_handler(*device, DEVCB_##_cb); - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> lk201_device - -class lk201_device : public device_t, public device_serial_interface -{ -public: - // construction/destruction - lk201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_READ8_MEMBER( ddr_r ); - DECLARE_WRITE8_MEMBER( ddr_w ); - DECLARE_READ8_MEMBER( ports_r ); - DECLARE_WRITE8_MEMBER( ports_w ); - DECLARE_READ8_MEMBER( sci_r ); - DECLARE_WRITE8_MEMBER( sci_w ); - DECLARE_READ8_MEMBER( spi_r ); - DECLARE_WRITE8_MEMBER( spi_w ); - - template static devcb_base &set_tx_handler(device_t &device, _Object wr) { return downcast(device).m_tx_handler.set_callback(wr); } - -protected: - // device-level overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual const rom_entry *device_rom_region() const; - virtual ioport_constructor device_input_ports() const; - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // device_serial overrides - virtual void rcv_complete(); // Rx completed receiving byte - virtual void tra_complete(); // Tx completed sending byte - virtual void tra_callback(); // Tx send bit - -private: - UINT8 ddrs[3]; - UINT8 ports[3]; - UINT8 led_data; - UINT8 kbd_data; - - UINT8 sci_ctl2; - UINT8 sci_status; - //UINT8 sci_data; - - UINT8 spi_status; - UINT8 spi_data; - - required_device m_maincpu; - required_device m_speaker; - - required_ioport m_kbd0; - required_ioport m_kbd1; - required_ioport m_kbd2; - required_ioport m_kbd3; - required_ioport m_kbd4; - required_ioport m_kbd5; - required_ioport m_kbd6; - required_ioport m_kbd7; - required_ioport m_kbd8; - required_ioport m_kbd9; - required_ioport m_kbd10; - required_ioport m_kbd11; - required_ioport m_kbd12; - required_ioport m_kbd13; - required_ioport m_kbd14; - required_ioport m_kbd15; - required_ioport m_kbd16; - required_ioport m_kbd17; - - void send_port(address_space &space, UINT8 offset, UINT8 data); - void update_interrupts(); - - devcb_write_line m_tx_handler; -}; - -// device type definition -extern const device_type LK201; - -#endif diff --git a/src/mess/machine/dgn_beta.c b/src/mess/machine/dgn_beta.c deleted file mode 100644 index 57de97d32f5..00000000000 --- a/src/mess/machine/dgn_beta.c +++ /dev/null @@ -1,1144 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - machine\dgn_beta.c (machine.c) - - Moved out of dragon.c, 2005-05-05, P.Harvey-Smith. - - I decided to move this out of the main Dragon/CoCo source files, as - the Beta is so radically different from the other Dragon machines that - this made more sense (to me at least). - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - - References: - Disassembly of Dragon Beta ROM, examination of only (known) surviving board. - - TODO: - Pretty much everything ! - - Display working with 6845 taking data from rom. - - 2005-05-10 - Memory banking seems to be working, as documented in code comments below. - - 2005-05-31 - CPU#2 now executes code correctly to do transfers from WD2797. - - 2005-06-03 - - When fed a standard OS-9 boot disk it reads in the boot file and attempts - to start it, not being able to find init, it fails. Hopefully I will - soon have an image of a Beta boot disk. - - 2005-11-29 - - Major track tracing excersise on scans of bare beta board, reveal where a - whole bunch of the PIA lines go, especially the IRQs, most of them go back - to the IRQ line on the main CPU. - - 2005-12-07 - - First booted to OS9 prompt, did not execute startup scripts. - - 2005-12-08 - - Fixed density setting on WD2797, so density of read data is now - correctlty set as required by OS-9. This was the reason startup - script was not being executed as Beta disks have a single denisty - boot track, however the rest of the disk is double density. - Booted completely to OS-9, including running startup script. - - 2006-09-27 - - Clean up of IRQ/FIRQ handling code allows correct booting again. - -***************************************************************************/ - -#include -#include "emu.h" -#include "debug/debugcon.h" -#include "cpu/m6809/m6809.h" -#include "machine/6821pia.h" -#include "includes/dgn_beta.h" -#include "machine/mos6551.h" -#include "imagedev/flopdrv.h" - -#include "debug/debugcpu.h" -#include "debug/debugcon.h" -#include "machine/ram.h" - -#define VERBOSE 0 - - -#define LOG_BANK_UPDATE(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_DEFAULT_TASK(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_PAGE_WRITE(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_HALT(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_TASK(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_KEYBOARD(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_VIDEO(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_DISK(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_INTS(x) do { if (VERBOSE) logerror x; } while (0) - - -/* Debugging commands and handlers. */ -static offs_t dgnbeta_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); -static void execute_beta_dat_log(running_machine &machine, int ref, int params, const char *param[]); -static void execute_beta_key_dump(running_machine &machine, int ref, int params, const char *param[]); - -//static int DMA_NMI; /* DMA cpu has received an NMI */ - -#define INVALID_KEYROW -1 /* no ketrow selected */ -#define NO_KEY_PRESSED 0x7F /* retrurned by hardware if no key pressed */ - -// Info for bank switcher -struct bank_info_entry -{ - write8_delegate func; // Pointer to write handler - offs_t start; // Offset of start of block - offs_t end; // offset of end of block -}; - -static const struct bank_info_entry bank_info[] = -{ - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b0_w),(dgn_beta_state*)0), 0x0000, 0x0fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b1_w),(dgn_beta_state*)0), 0x1000, 0x1fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b2_w),(dgn_beta_state*)0), 0x2000, 0x2fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b3_w),(dgn_beta_state*)0), 0x3000, 0x3fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b4_w),(dgn_beta_state*)0), 0x4000, 0x4fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b5_w),(dgn_beta_state*)0), 0x5000, 0x5fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b6_w),(dgn_beta_state*)0), 0x6000, 0x6fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b7_w),(dgn_beta_state*)0), 0x7000, 0x7fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b8_w),(dgn_beta_state*)0), 0x8000, 0x8fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_b9_w),(dgn_beta_state*)0), 0x9000, 0x9fff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bA_w),(dgn_beta_state*)0), 0xA000, 0xAfff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bB_w),(dgn_beta_state*)0), 0xB000, 0xBfff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bC_w),(dgn_beta_state*)0), 0xC000, 0xCfff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bD_w),(dgn_beta_state*)0), 0xD000, 0xDfff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bE_w),(dgn_beta_state*)0), 0xE000, 0xEfff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bF_w),(dgn_beta_state*)0), 0xF000, 0xFBff }, - { write8_delegate(FUNC(dgn_beta_state::dgnbeta_ram_bG_w),(dgn_beta_state*)0), 0xFF00, 0xFfff } -}; - -#define is_last_page(page) (((page==LastPage) || (page==LastPage+1)) ? 1 : 0) - -// -// Memory pager, maps machine's 1Mb total address space into the 64K addressable by the 6809. -// This is in some way similar to the system used on the CoCo 3, except the beta uses 4K -// pages (instead of 8K on the CoCo), and has 16 task registers instead of the 2 on the CoCo. -// -// Each block of 16 page registers (1 for each task), is paged in at $FE00-$FE0F, the bottom -// 4 bits of the PIA register at $FCC0 seem to contain which task is active. -// bit 6 of the same port seems to enable the memory paging -// -// For the purpose of this driver any block that is not ram, and is not a known ROM block, -// is mapped to the first page of the boot rom, I do not know what happens in the real -// hardware, however this does allow the boot rom to correctly size the RAM. -// this should probably be considdered a hack ! -// - -void dgn_beta_state::UpdateBanks(int first, int last) -{ - address_space &space_0 = m_maincpu->space(AS_PROGRAM); - address_space &space_1 = machine().device(DMACPU_TAG)->memory().space(AS_PROGRAM); - int Page; - UINT8 *readbank; - int bank_start; - int bank_end; - int MapPage; - char page_num[10]; - - LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,space_0.device().safe_pc())); - for(Page=first;Page<=last;Page++) - { - sprintf(page_num,"bank%d",Page+1); - - bank_start = bank_info[Page].start; - bank_end = bank_info[Page].end; - - // bank16 and bank17 are mapped to the same page with a hole for the IO memory - if (!is_last_page(Page)) - MapPage = m_PageRegs[m_TaskReg][Page].value; - else - MapPage = m_PageRegs[m_TaskReg][LastPage].value; - - // - // Map block, $00-$BF are ram, $FC-$FF are Boot ROM - // - if ((MapPage*4) < ((m_ram->size() / 1024)-1)) // Block is ram - { - if (!is_last_page(Page)) - { - readbank = &m_ram->pointer()[MapPage*RamPageSize]; - if(m_LogDatWrites) - debug_console_printf(machine(), "Mapping page %X, pageno=%X, mess_ram)[%X]\n",Page,MapPage,(MapPage*RamPageSize)); - } - else - { - readbank = &m_ram->pointer()[(MapPage*RamPageSize)-256]; - logerror("Error RAM in Last page !\n"); - } - write8_delegate func = bank_info[Page].func; - if (!func.isnull()) func.late_bind(*this); - space_0.install_write_handler(bank_start, bank_end, func); - space_1.install_write_handler(bank_start, bank_end, func); - } - else // Block is rom, or undefined - { - if (MapPage>0xfB) - { - if (Page!=IOPage+1) - readbank=&m_system_rom[(MapPage-0xFC)*0x1000]; - else - readbank=&m_system_rom[0x3F00]; - } - else - readbank=m_system_rom; - - space_0.unmap_write(bank_start, bank_end); - space_1.unmap_write(bank_start, bank_end); - } - - m_PageRegs[m_TaskReg][Page].memory=readbank; - membank(page_num)->set_base(readbank); - - LOG_BANK_UPDATE(("UpdateBanks:MapPage=$%02X readbank=$%X\n",MapPage,(int)(FPTR)readbank)); - LOG_BANK_UPDATE(("PageRegsSet Task=%X Page=%x\n",m_TaskReg,Page)); - //LOG_BANK_UPDATE(("%X)\n",membank(Page+1))); - LOG_BANK_UPDATE(("memory_install_write8_handler CPU=0\n")); - LOG_BANK_UPDATE(("memory_install_write8_handler CPU=1\n")); - } -} - -// -void dgn_beta_state::SetDefaultTask() -{ -// UINT8 *videoram = m_videoram; - int Idx; - - LOG_DEFAULT_TASK(("SetDefaultTask()\n")); - //if (VERBOSE) debug_console_printf(machine())->set_base("Set Default task\n"); - - m_TaskReg=NoPagingTask; - - /* Reset ram pages */ - for(Idx=0;Idxpointer()[TextVidBasePage*RamPageSize]; -} - -// Return the value of a page register -READ8_MEMBER(dgn_beta_state::dgn_beta_page_r) -{ - return m_PageRegs[m_PIATaskReg][offset].value; -} - -// Write to a page register, writes to the register, and then checks to see -// if memory banking is active, if it is, it calls UpdateBanks, to actually -// setup the mappings. - -WRITE8_MEMBER(dgn_beta_state::dgn_beta_page_w ) -{ - m_PageRegs[m_PIATaskReg][offset].value=data; - - LOG_PAGE_WRITE(("PageRegWrite : task=$%X offset=$%X value=$%X\n",m_PIATaskReg,offset,data)); - - if (m_EnableMapRegs) - { - UpdateBanks(offset,offset); - if (offset==15) - UpdateBanks(offset+1,offset+1); - } -} - -/*********************** Memory bank write handlers ************************/ -/* These actually write the data to the memory, and not to the page regs ! */ -void dgn_beta_state::dgn_beta_bank_memory(int offset, int data, int bank) -{ - m_PageRegs[m_TaskReg][bank].memory[offset]=data; -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b0_w ) -{ - dgn_beta_bank_memory(offset,data,0); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b1_w ) -{ - dgn_beta_bank_memory(offset,data,1); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b2_w ) -{ - dgn_beta_bank_memory(offset,data,2); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b3_w ) -{ - dgn_beta_bank_memory(offset,data,3); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b4_w ) -{ - dgn_beta_bank_memory(offset,data,4); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b5_w ) -{ - dgn_beta_bank_memory(offset,data,5); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b6_w ) -{ - dgn_beta_bank_memory(offset,data,6); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b7_w ) -{ - dgn_beta_bank_memory(offset,data,7); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b8_w ) -{ - dgn_beta_bank_memory(offset,data,8); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b9_w ) -{ - dgn_beta_bank_memory(offset,data,9); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bA_w ) -{ - dgn_beta_bank_memory(offset,data,10); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bB_w ) -{ - dgn_beta_bank_memory(offset,data,11); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bC_w ) -{ - dgn_beta_bank_memory(offset,data,12); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bD_w ) -{ - dgn_beta_bank_memory(offset,data,13); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bE_w ) -{ - dgn_beta_bank_memory(offset,data,14); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bF_w ) -{ - dgn_beta_bank_memory(offset,data,15); -} - -WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bG_w ) -{ - dgn_beta_bank_memory(offset,data,16); -} - -/* -The keyrow being scanned for any key is the lest significant bit -of the output shift register that is zero, most of the time there should -only be one row active e.g. - -Shifter Row being scanned -1111111110 0 -1111111101 1 -1111111011 2 - -etc. - -Returns row number or -1 if none selected. - -2006-12-03, P.Harvey-Smith, modified to scan from msb to lsb, and stop at -first row with zero, as the beta_test fills the shifter with zeros, rather -than using a walking zero as the OS-9 driver does. This meant that SelectKeyrow -never moved past the first row, by scanning for the last active row -the beta_test rom works, and it does not break the OS-9 driver :) -*/ -int dgn_beta_state::SelectedKeyrow(dgn_beta_state *state, int Rows) -{ - int Idx; - int Row; /* Row selected */ - int Mask; /* Mask to test row */ - int Found; /* Set true when found */ - - Row=INVALID_KEYROW; /* Pretend no rows selected */ - Mask=0x200; /* Start with row 9 */ - Found=0; /* Start with not found */ - Idx=9; - - while ((Mask>0) && !Found) - { - if((~Rows & Mask) && !Found) - { - Row=Idx; /* Get row */ - Found=1; /* Mark as found */ - } - Idx=Idx-1; /* Decrement row count */ - Mask=Mask>>1; /* Select next bit */ - } - - return Row; -} - -/* GetKeyRow, returns the value of a keyrow, checking for invalid rows */ -/* and returning no key pressed if row is invalid */ -int dgn_beta_state::GetKeyRow(dgn_beta_state *state, int RowNo) -{ - if(RowNo==INVALID_KEYROW) - return NO_KEY_PRESSED; /* row is invalid, so return no key down */ - else - return m_Keyboard[RowNo]; /* Else return keyboard data */ -} - -/*********************************** PIA Handlers ************************/ -/* PIA #0 at $FC20-$FC23 I46 - This handles:- - The Printer port, side A, - PB0 R16 (pullup) -> Printer Port (PL1) - PB1 Printer Port - PB2 Keyboard (any key). - PB3 D4 -> R37 -> TR1 switching circuit -> PL5 - PB4 Keyboard Data out, clocked by CB2. - positive edge clocks data out of the input shift register. - PB5 Keyboard data in, clocked by PB4. - PB6 R79 -> I99/6/7416 -> PL9/26/READY (from floppy) - PB7 Printer port - CB1 I36/39/6845(Horz Sync) - CB2 Keyboard (out) Low loads input shift reg -*/ -READ8_MEMBER(dgn_beta_state::d_pia0_pa_r) -{ - return 0; -} - -WRITE8_MEMBER(dgn_beta_state::d_pia0_pa_w) -{ -} - -READ8_MEMBER(dgn_beta_state::d_pia0_pb_r) -{ - int RetVal; - int Idx; - int Selected; - static const char *const keynames[] = { - "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", - "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" - }; - - LOG_KEYBOARD(("PB Read\n")); - - m_KAny_next = 0; - - Selected = SelectedKeyrow(this, m_RowShifter); - - /* Scan the whole keyboard, if output shifter is all low */ - /* This actually scans in the keyboard */ - if(m_RowShifter == 0x00) - { - for(Idx=0; Idxread(); - - if(m_Keyboard[Idx] != 0x7F) - m_KAny_next = 1; - } - } - else /* Just scan current row, from previously read values */ - { - if(GetKeyRow(this, Selected) != NO_KEY_PRESSED) - m_KAny_next = 1; - } - - RetVal = (m_KInDat_next<<5) | (m_KAny_next<<2); - - LOG_KEYBOARD(("FC22=$%02X KAny=%d\n", RetVal, m_KAny_next)); - - return RetVal; -} - -WRITE8_MEMBER(dgn_beta_state::d_pia0_pb_w) -{ - int InClkState; - //int OutClkState; - - LOG_KEYBOARD(("PB Write\n")); - - InClkState = data & KInClk; - //OutClkState = data & KOutClk; - - LOG_KEYBOARD(("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(m_d_pia0_pb_last & KInClk),m_Keyrow)); - - /* Input clock bit has changed state */ - if ((InClkState) != (m_d_pia0_pb_last & KInClk)) - { - /* Clock in bit */ - if(InClkState) - { - m_KInDat_next=(~m_Keyrow & 0x40)>>6; - m_Keyrow = ((m_Keyrow<<1) | 0x01) & 0x7F ; - LOG_KEYBOARD(("Keyrow=$%02X KInDat_next=%X\n",m_Keyrow,m_KInDat_next)); - } - } - - m_d_pia0_pb_last=data; -} - -WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_cb2_w) -{ - int RowNo; - LOG_KEYBOARD(("\nCB2 Write\n")); - - /* load keyrow on rising edge of CB2 */ - if((state==1) && (m_d_pia0_cb2_last==0)) - { - RowNo=SelectedKeyrow(this, m_RowShifter); - m_Keyrow=GetKeyRow(this, RowNo); - - /* Output clock rising edge, clock CB2 value into rowshifterlow to high transition */ - /* In the beta the shift registers are a cmos 4015, and a cmos 4013 in series */ - m_RowShifter = (m_RowShifter<<1) | ((m_d_pia0_pb_last & KOutDat)>>4); - m_RowShifter &= 0x3FF; - LOG_KEYBOARD(("Rowshifter=$%02X Keyrow=$%02X\n",m_RowShifter,m_Keyrow)); - if (VERBOSE) debug_console_printf(machine(), "rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",m_RowShifter,RowNo,m_Keyrow); - } - - m_d_pia0_cb2_last=state; -} - - -WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_irq_a) -{ - cpu0_recalc_irq(state); -} - -WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_irq_b) -{ - cpu0_recalc_firq(state); -} - -/* PIA #1 at $FC24-$FC27 I63 - This handles :- - Mouse + Disk Select on side A - Halt on DMA CPU PA7 - Beeper PB0 - Halt on main CPU PB1 - Character set select PB6 - Baud rate PB1..PB5 ???? -*/ - -READ8_MEMBER(dgn_beta_state::d_pia1_pa_r) -{ - return 0; -} - -WRITE8_MEMBER(dgn_beta_state::d_pia1_pa_w) -{ - int HALT_DMA; - - /* Only play with halt line if halt bit changed since last write */ - if((data & 0x80) != m_d_pia1_pa_last) - { - /* Bit 7 of $FF24, seems to control HALT on second CPU (through an inverter) */ - if(data & 0x80) - HALT_DMA = ASSERT_LINE; - else - HALT_DMA = CLEAR_LINE; - - LOG_HALT(("DMA_CPU HALT=%d\n", HALT_DMA)); - machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, HALT_DMA); - - /* CPU un-halted let it run ! */ - if (HALT_DMA == CLEAR_LINE) - m_maincpu->yield(); - - m_d_pia1_pa_last = data & 0x80; - } - - /* Drive selects are binary encoded on PA0 & PA1 */ - floppy_image_device *floppy = NULL; - - switch (~data & 0x03) - { - case 0: floppy = m_floppy0->get_device(); break; - case 1: floppy = m_floppy1->get_device(); break; - case 2: floppy = m_floppy2->get_device(); break; - case 3: floppy = m_floppy3->get_device(); break; - } - - m_fdc->set_floppy(floppy); - - // not connected: bit 5 = ENP - m_fdc->dden_w(BIT(data, 6)); - LOG_DISK(("Set density %s\n", BIT(data, 6) ? "low" : "high")); -} - -READ8_MEMBER(dgn_beta_state::d_pia1_pb_r) -{ - return 0; -} - -WRITE8_MEMBER(dgn_beta_state::d_pia1_pb_w) -{ - int HALT_CPU; - - /* Only play with halt line if halt bit changed since last write */ - if((data & 0x02) != m_d_pia1_pb_last) - { - /* Bit 1 of $FF26, seems to control HALT on primary CPU */ - if(data & 0x02) - HALT_CPU = CLEAR_LINE; - else - HALT_CPU = ASSERT_LINE; - - LOG_HALT(("MAIN_CPU HALT=%d\n", HALT_CPU)); - m_maincpu->set_input_line(INPUT_LINE_HALT, HALT_CPU); - - m_d_pia1_pb_last = data & 0x02; - - /* CPU un-halted let it run ! */ - if (HALT_CPU == CLEAR_LINE) - machine().device(DMACPU_TAG)->execute().yield(); - } -} - -WRITE_LINE_MEMBER(dgn_beta_state::d_pia1_irq_a) -{ - cpu0_recalc_irq(state); -} - -WRITE_LINE_MEMBER(dgn_beta_state::d_pia1_irq_b) -{ - cpu0_recalc_irq(state); -} - -/* PIA #2 at FCC0-FCC3 I28 - This handles :- - DAT task select PA0..PA3 - - DMA CPU NMI PA7 - - Graphics control PB0..PB7 ??? - VSYNC intutrupt CB2 -*/ -READ8_MEMBER(dgn_beta_state::d_pia2_pa_r) -{ - return 0; -} - -WRITE8_MEMBER(dgn_beta_state::d_pia2_pa_w) -{ - int OldTask; - int OldEnableMap; - int NMI; - - LOG_TASK(("FCC0 write : $%02X\n", data)); - - /* Bit 7 of $FFC0, seems to control NMI on second CPU */ - NMI=(data & 0x80); - - /* only take action if NMI changed */ - if(NMI != m_DMA_NMI_LAST) - { - LOG_INTS(("cpu1 NMI : %d\n", NMI)); - if(!NMI) - { - machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - logerror("device_yield()\n"); - machine().device(DMACPU_TAG)->execute().yield(); /* Let DMA CPU run */ - } - else - { - machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - } - - m_DMA_NMI_LAST = NMI; /* Save it for next time */ - } - - OldEnableMap = m_EnableMapRegs; - /* Bit 6 seems to enable memory paging */ - if(data & 0x40) - m_EnableMapRegs = 0; - else - m_EnableMapRegs = 1; - - /* Bits 0..3 seem to control which task register is selected */ - OldTask = m_PIATaskReg; - m_PIATaskReg = data & 0x0F; - - LOG_TASK(("OldTask=$%02X EnableMapRegs=%d OldEnableMap=%d\n", OldTask, m_EnableMapRegs, OldEnableMap)); - - // Maping was enabled or disabled, select apropreate task reg - // and map it in - if (m_EnableMapRegs != OldEnableMap) - { - if(m_EnableMapRegs) - m_TaskReg = m_PIATaskReg; - else - m_TaskReg = NoPagingTask; - - UpdateBanks(0, IOPage + 1); - } - else - { - // Update ram banks only if task reg changed and mapping enabled - if ((m_PIATaskReg != OldTask) && (m_EnableMapRegs)) - { - m_TaskReg = m_PIATaskReg; - UpdateBanks(0, IOPage + 1); - } - } - LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n", m_TaskReg, m_PIATaskReg)); -} - -READ8_MEMBER(dgn_beta_state::d_pia2_pb_r) -{ - return 0; -} - -WRITE8_MEMBER(dgn_beta_state::d_pia2_pb_w) -{ - /* Update top video address lines */ - dgnbeta_vid_set_gctrl(data); -} - -WRITE_LINE_MEMBER(dgn_beta_state::d_pia2_irq_a) -{ - cpu0_recalc_irq(state); -} - -WRITE_LINE_MEMBER(dgn_beta_state::d_pia2_irq_b) -{ - cpu0_recalc_irq(state); -} - -/************************************ Recalculate CPU inturrupts ****************************/ -/* CPU 0 */ -void dgn_beta_state::cpu0_recalc_irq(int state) -{ - pia6821_device *pia_0 = machine().device( PIA_0_TAG ); - pia6821_device *pia_1 = machine().device( PIA_1_TAG ); - pia6821_device *pia_2 = machine().device( PIA_2_TAG ); - UINT8 pia0_irq_a = pia_0->irq_a_state(); - UINT8 pia1_irq_a = pia_1->irq_a_state(); - UINT8 pia1_irq_b = pia_1->irq_b_state(); - UINT8 pia2_irq_a = pia_2->irq_a_state(); - UINT8 pia2_irq_b = pia_2->irq_b_state(); - UINT8 IRQ; - - if (pia0_irq_a || pia1_irq_a || pia1_irq_b || pia2_irq_a || pia2_irq_b) - IRQ = ASSERT_LINE; - else - IRQ = CLEAR_LINE; - - m_maincpu->set_input_line(M6809_IRQ_LINE, IRQ); - LOG_INTS(("cpu0 IRQ : %d\n", IRQ)); -} - -void dgn_beta_state::cpu0_recalc_firq(int state) -{ - pia6821_device *pia_0 = machine().device( PIA_0_TAG ); - UINT8 pia0_irq_b = pia_0->irq_b_state(); - UINT8 FIRQ; - - if (pia0_irq_b) - FIRQ = ASSERT_LINE; - else - FIRQ = CLEAR_LINE; - - m_maincpu->set_input_line(M6809_FIRQ_LINE, FIRQ); - - LOG_INTS(("cpu0 FIRQ : %d\n", FIRQ)); -} - -/* CPU 1 */ - -void dgn_beta_state::cpu1_recalc_firq(int state) -{ - machine().device(DMACPU_TAG)->execute().set_input_line(M6809_FIRQ_LINE, state); - LOG_INTS(("cpu1 FIRQ : %d\n",state)); -} - -/********************************************************************************************/ -/* Dragon Beta onboard FDC */ -/********************************************************************************************/ - -/* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */ -WRITE_LINE_MEMBER( dgn_beta_state::dgnbeta_fdc_intrq_w ) -{ - device_t *device = machine().device(PIA_2_TAG); - LOG_DISK(("dgnbeta_fdc_intrq_w(%d)\n", state)); - if(m_wd2797_written) - downcast(device)->ca1_w(state); -} - -/* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */ -WRITE_LINE_MEMBER( dgn_beta_state::dgnbeta_fdc_drq_w ) -{ - LOG_DISK(("dgnbeta_fdc_drq_w(%d)\n", state)); - cpu1_recalc_firq(state); -} - -READ8_MEMBER( dgn_beta_state::dgnbeta_wd2797_r ) -{ - return m_fdc->read(space, offset & 0x03); -} - -WRITE8_MEMBER( dgn_beta_state::dgnbeta_wd2797_w ) -{ - m_wd2797_written = 1; - m_fdc->write(space, offset & 0x03, data); -} - -/* Scan physical keyboard into Keyboard array */ -/* gonna try and sync this more closely with hardware as keyboard being scanned */ -/* on *EVERY* vblank ! */ -void dgn_beta_state::ScanInKeyboard(void) -{ -#if 0 - int Idx; - int Row; - static const char *const keynames[] = { - "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", - "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" - }; - - LOG_KEYBOARD(("Scanning Host keyboard\n")); - - for(Idx=0; Idxread(); - - else - Row = 0x7f; - - m_Keyboard[Idx]=Row; - LOG_KEYBOARD(("Keyboard[%d]=$%02X\n",Idx,Row)); - - if (Row != 0x7F) - { - LOG_KEYBOARD(("Found Pressed Key\n")); - } - } -#endif -} - -/* VBlank inturrupt */ -void dgn_beta_state::dgn_beta_frame_interrupt (int data) -{ - pia6821_device *pia_2 = machine().device( PIA_2_TAG ); - - /* Set PIA line, so it recognises inturrupt */ - if (!data) - pia_2->cb2_w(ASSERT_LINE); - else - pia_2->cb2_w(CLEAR_LINE); - -// LOG_VIDEO(("Vblank\n")); - ScanInKeyboard(); -} - -#ifdef UNUSED_FUNCTION -void dgn_beta_state::dgn_beta_line_interrupt (int data) -{ -// /* Set PIA line, so it recognises inturrupt */ -// if (data) -// { -// pia_0_cb1_w(machine, 0,ASSERT_LINE); -// } -// else -// { -// pia_0_cb1_w(machine, 0,CLEAR_LINE); -// } -} -#endif - - -/********************************* Machine/Driver Initialization ****************************************/ -void dgn_beta_state::machine_reset() -{ - pia6821_device *pia_0 = machine().device( PIA_0_TAG ); - pia6821_device *pia_1 = machine().device( PIA_1_TAG ); - pia6821_device *pia_2 = machine().device( PIA_2_TAG ); - - logerror("dgn_beta_state::machine_reset()\n"); - - m_system_rom = memregion(MAINCPU_TAG)->base(); - - /* Make sure CPU 1 is started out halted ! */ - machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - - /* Reset to task 0, and map banks disabled, so standard memory map */ - /* with ram at $0000-$BFFF, ROM at $C000-FBFF, IO at $FC00-$FEFF */ - /* and ROM at $FF00-$FFFF */ - m_TaskReg = 0; - m_PIATaskReg = 0; - m_EnableMapRegs = 0; - memset(m_PageRegs, 0, sizeof(m_PageRegs)); /* Reset page registers to 0 */ - SetDefaultTask(); - - /* Set pullups on all PIA port A, to match what hardware does */ - pia_0->set_port_a_z_mask(0xFF); - pia_1->set_port_a_z_mask(0xFF); - pia_2->set_port_a_z_mask(0xFF); - - m_d_pia1_pa_last = 0x00; - m_d_pia1_pb_last = 0x00; - m_RowShifter = 0x00; /* shift register to select row */ - m_Keyrow = 0x00; /* Keyboard row being shifted out */ - m_d_pia0_pb_last = 0x00; /* Last byte output to pia0 port b */ - m_d_pia0_cb2_last = 0x00; /* Last state of CB2 */ - - m_KInDat_next = 0x00; /* Next data bit to input */ - m_KAny_next = 0x00; /* Next value for KAny */ - - m_DMA_NMI_LAST = 0x80; /* start with DMA NMI inactive, as pulled up */ -// DMA_NMI = CLEAR_LINE; /* start with DMA NMI inactive */ - - m_videoram.set_target(m_ram->pointer(),m_videoram.bytes()); /* Point video ram at the start of physical ram */ - - m_wd2797_written=0; - - m_maincpu->reset(); -} - -void dgn_beta_state::machine_start() -{ - logerror("MACHINE_START( dgnbeta )\n"); - - if (machine().device(MAINCPU_TAG)->debug()) { - machine().device(MAINCPU_TAG)->debug()->set_dasm_override(dgnbeta_dasm_override); - } - - /* setup debug commands */ - if (machine().debug_flags & DEBUG_FLAG_ENABLED) - { - debug_console_register_command(machine(), "beta_dat_log", CMDFLAG_NONE, 0, 0, 0, execute_beta_dat_log); - debug_console_register_command(machine(), "beta_key_dump", CMDFLAG_NONE, 0, 0, 0, execute_beta_key_dump); - } - m_LogDatWrites=0; -} - - -/*************************************************************************** - OS9 Syscalls for disassembly -****************************************************************************/ - - -static const char *const os9syscalls[] = -{ - "F$Link", /* Link to Module */ - "F$Load", /* Load Module from File */ - "F$UnLink", /* Unlink Module */ - "F$Fork", /* Start New Process */ - "F$Wait", /* Wait for Child Process to Die */ - "F$Chain", /* Chain Process to New Module */ - "F$Exit", /* Terminate Process */ - "F$Mem", /* Set Memory Size */ - "F$Send", /* Send Signal to Process */ - "F$Icpt", /* Set Signal Intercept */ - "F$Sleep", /* Suspend Process */ - "F$SSpd", /* Suspend Process */ - "F$ID", /* Return Process ID */ - "F$SPrior", /* Set Process Priority */ - "F$SSWI", /* Set Software Interrupt */ - "F$PErr", /* Print Error */ - "F$PrsNam", /* Parse Pathlist Name */ - "F$CmpNam", /* Compare Two Names */ - "F$SchBit", /* Search Bit Map */ - "F$AllBit", /* Allocate in Bit Map */ - "F$DelBit", /* Deallocate in Bit Map */ - "F$Time", /* Get Current Time */ - "F$STime", /* Set Current Time */ - "F$CRC", /* Generate CRC */ - "F$GPrDsc", /* get Process Descriptor copy */ - "F$GBlkMp", /* get System Block Map copy */ - "F$GModDr", /* get Module Directory copy */ - "F$CpyMem", /* Copy External Memory */ - "F$SUser", /* Set User ID number */ - "F$UnLoad", /* Unlink Module by name */ - "F$Alarm", /* Color Computer Alarm Call (system wide) */ - NULL, - NULL, - "F$NMLink", /* Color Computer NonMapping Link */ - "F$NMLoad", /* Color Computer NonMapping Load */ - NULL, - NULL, - "F$TPS", /* Return System's Ticks Per Second */ - "F$TimAlm", /* COCO individual process alarm call */ - "F$VIRQ", /* Install/Delete Virtual IRQ */ - "F$SRqMem", /* System Memory Request */ - "F$SRtMem", /* System Memory Return */ - "F$IRQ", /* Enter IRQ Polling Table */ - "F$IOQu", /* Enter I/O Queue */ - "F$AProc", /* Enter Active Process Queue */ - "F$NProc", /* Start Next Process */ - "F$VModul", /* Validate Module */ - "F$Find64", /* Find Process/Path Descriptor */ - "F$All64", /* Allocate Process/Path Descriptor */ - "F$Ret64", /* Return Process/Path Descriptor */ - "F$SSvc", /* Service Request Table Initialization */ - "F$IODel", /* Delete I/O Module */ - "F$SLink", /* System Link */ - "F$Boot", /* Bootstrap System */ - "F$BtMem", /* Bootstrap Memory Request */ - "F$GProcP", /* Get Process ptr */ - "F$Move", /* Move Data (low bound first) */ - "F$AllRAM", /* Allocate RAM blocks */ - "F$AllImg", /* Allocate Image RAM blocks */ - "F$DelImg", /* Deallocate Image RAM blocks */ - "F$SetImg", /* Set Process DAT Image */ - "F$FreeLB", /* Get Free Low Block */ - "F$FreeHB", /* Get Free High Block */ - "F$AllTsk", /* Allocate Process Task number */ - "F$DelTsk", /* Deallocate Process Task number */ - "F$SetTsk", /* Set Process Task DAT registers */ - "F$ResTsk", /* Reserve Task number */ - "F$RelTsk", /* Release Task number */ - "F$DATLog", /* Convert DAT Block/Offset to Logical */ - "F$DATTmp", /* Make temporary DAT image (Obsolete) */ - "F$LDAXY", /* Load A [X,[Y]] */ - "F$LDAXYP", /* Load A [X+,[Y]] */ - "F$LDDDXY", /* Load D [D+X,[Y]] */ - "F$LDABX", /* Load A from 0,X in task B */ - "F$STABX", /* Store A at 0,X in task B */ - "F$AllPrc", /* Allocate Process Descriptor */ - "F$DelPrc", /* Deallocate Process Descriptor */ - "F$ELink", /* Link using Module Directory Entry */ - "F$FModul", /* Find Module Directory Entry */ - "F$MapBlk", /* Map Specific Block */ - "F$ClrBlk", /* Clear Specific Block */ - "F$DelRAM", /* Deallocate RAM blocks */ - "F$GCMDir", /* Pack module directory */ - "F$AlHRam", /* Allocate HIGH RAM Blocks */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "F$RegDmp", /* Ron Lammardo's debugging register dump call */ - "F$NVRAM", /* Non Volatile RAM (RTC battery backed static) read/write */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "I$Attach", /* Attach I/O Device */ - "I$Detach", /* Detach I/O Device */ - "I$Dup", /* Duplicate Path */ - "I$Create", /* Create New File */ - "I$Open", /* Open Existing File */ - "I$MakDir", /* Make Directory File */ - "I$ChgDir", /* Change Default Directory */ - "I$Delete", /* Delete File */ - "I$Seek", /* Change Current Position */ - "I$Read", /* Read Data */ - "I$Write", /* Write Data */ - "I$ReadLn", /* Read Line of ASCII Data */ - "I$WritLn", /* Write Line of ASCII Data */ - "I$GetStt", /* Get Path Status */ - "I$SetStt", /* Set Path Status */ - "I$Close", /* Close Path */ - "I$DeletX" /* Delete from current exec dir */ -}; - - -static offs_t dgnbeta_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) -{ - unsigned call; - unsigned result = 0; - - if ((oprom[0] == 0x10) && (oprom[1] == 0x3F)) - { - call = oprom[2]; - if ((call < ARRAY_LENGTH(os9syscalls)) && os9syscalls[call]) - { - sprintf(buffer, "OS9 %s", os9syscalls[call]); - result = 3; - } - } - return result; -} - -static void execute_beta_dat_log(running_machine &machine, int ref, int params, const char *param[]) -{ - dgn_beta_state *state = machine.driver_data(); - state->m_LogDatWrites=!state->m_LogDatWrites; - - debug_console_printf(machine, "DAT register write info set : %d\n",state->m_LogDatWrites); -} - -static void execute_beta_key_dump(running_machine &machine, int ref, int params, const char *param[]) -{ - dgn_beta_state *state = machine.driver_data(); - int Idx; - - for(Idx=0;Idxm_Keyboard[Idx]); - } -} diff --git a/src/mess/machine/dgnalpha.c b/src/mess/machine/dgnalpha.c deleted file mode 100644 index a146e1e3aae..00000000000 --- a/src/mess/machine/dgnalpha.c +++ /dev/null @@ -1,377 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - dgnalpha.c - - Dragon Alpha - - The Dragon Alpha was a prototype in development when Dragon Data went bust, - it is basically an enhanced Dragon 64, with built in modem, disk system, and - graphical boot rom. - - It has the following extra hardware :- - A third 6821 PIA mapped between FF24 and FF27 - An AY-8912, connected to the PIA. - - Port A of the PIA is connected as follows :- - - b0 BDIR of AY8912 - b1 BC1 of AY8912 - b2 Rom select, High= boot rom, low=BASIC rom - b3..7 not used. - - Port B - b0..7 connected to D0..7 of the AY8912. - - CB1 DRQ of WD2797. - - /irqa - /irqb both connected to 6809 FIRQ. - - - The analog outputs of the AY-8912 are connected to the standard sound multiplexer. - The AY8912 output port is used as follows :- - - b0..b3 /DS0../DS3 for the drive interface (through an inverter first). - b4 /motor for the drive interface (through an inverter first). - b5..b7 not used as far as I can tell. - - A 6850 for the modem. - - A WD2797, used as an internal disk interface, this is however connected in a slightly strange - way that I am yet to completely determine. - 19/10/2004, WD2797 is mapped between FF2C and FF2F, however the order of the registers is - reversed so the command Register is at the highest address instead of the lowest. The Data - request pin is connected to CB1(pin 18) of PIA2, to cause an firq, the INTRQ, is connected via - an inverter to the 6809's NMI. - - All these are as yet un-emulated. - - 29-Oct-2004, AY-8912 is now emulated. - 30-Oct-2004, Internal disk interface now emulated, Normal DragonDos rom replaced with a re-assembled - version, that talks to the alpha hardware (verified on a clone of the real machine). - -Dragon Alpha code added 21-Oct-2004, - Phill Harvey-Smith (afra@aurigae.demon.co.uk) - - Added AY-8912 and FDC code 30-Oct-2004. - -Fixed Dragon Alpha NMI enable/disable, following circuit traces on a real machine. - P.Harvey-Smith, 11-Aug-2005. - -Re-implemented Alpha NMI enable/disable, using direct PIA reads, rather than -keeping track of it in a variable in the driver. - P.Harvey-Smith, 25-Sep-2006. - -***************************************************************************/ - -#include "includes/dgnalpha.h" -#include "sound/ay8910.h" -#include "imagedev/flopdrv.h" - -//------------------------------------------------- -// device_start -//------------------------------------------------- - -void dragon_alpha_state::device_start(void) -{ - dragon_state::device_start(); - save_item(NAME(m_just_reset)); -} - - - -//------------------------------------------------- -// device_reset -//------------------------------------------------- - -void dragon_alpha_state::device_reset(void) -{ - dragon_state::device_reset(); - m_just_reset = 1; -} - - - -/*************************************************************************** - MODEM -***************************************************************************/ - -//------------------------------------------------- -// modem_r -//------------------------------------------------- - -UINT8 dragon_alpha_state::modem_r(offs_t offset) -{ - return 0xFF; -} - - - -//------------------------------------------------- -// modem_w -//------------------------------------------------- - -void dragon_alpha_state::modem_w(offs_t offset, UINT8 data) -{ -} - - - -/*************************************************************************** - PIA1 -***************************************************************************/ - -//------------------------------------------------- -// ff20_read -//------------------------------------------------- - -READ8_MEMBER( dragon_alpha_state::ff20_read ) -{ - UINT8 result = 0x00; - - switch(offset & 0x0f) - { - case 0: case 1: case 2: case 3: - result = dragon_state::ff20_read(space, offset, mem_mask); - break; - - case 4: case 5: case 6: case 7: - result = m_pia_2->read(space, offset, mem_mask); - break; - - case 8: case 9: case 10: case 11: - result = modem_r(offset); - break; - - case 12: - result = m_fdc->data_r(space, 0); - break; - - case 13: - result = m_fdc->sector_r(space, 0); - break; - - case 14: - result = m_fdc->track_r(space, 0); - break; - - case 15: - result = m_fdc->status_r(space, 0); - break; - } - - return result; -} - - - -//------------------------------------------------- -// ff20_write -//------------------------------------------------- - -WRITE8_MEMBER( dragon_alpha_state::ff20_write ) -{ - switch(offset & 0x0f) - { - case 0: case 1: case 2: case 3: - dragon_state::ff20_write(space, offset, data, mem_mask); - break; - - case 4: case 5: case 6: case 7: - m_pia_2->write(space, offset, data, mem_mask); - break; - - case 8: case 9: case 10: case 11: - modem_w(offset, data); - break; - - case 12: - m_fdc->data_w(space, 0, data); - break; - case 13: - m_fdc->sector_w(space, 0, data); - break; - case 14: - m_fdc->track_w(space, 0, data); - break; - case 15: - m_fdc->cmd_w(space, 0, data); - break; - } -} - - -/*************************************************************************** - PIA2 ($FF24-$FF28) on Dragon Alpha/Professional - - PIA2 PA0 bcdir to AY-8912 - PIA2 PA1 bc0 to AY-8912 - PIA2 PA2 Rom switch, 0=basic rom, 1=boot rom. - PIA2 PA3-PA7 Unknown/unused ? - PIA2 PB0-PB7 connected to D0..7 of the AY8912. - CB1 DRQ from WD2797 disk controler. -***************************************************************************/ - -//------------------------------------------------- -// pia2_pa_w -//------------------------------------------------- - -WRITE8_MEMBER( dragon_alpha_state::pia2_pa_w ) -{ - UINT8 ddr = ~m_pia_2->port_b_z_mask(); - - /* If bit 2 of the pia2 ddra is 1 then this pin is an output so use it */ - /* to control the paging of the boot and basic roms */ - /* Otherwise it set as an input, with an internal pull-up so it should */ - /* always be high (enabling boot rom) */ - /* PIA FIXME if (pia_get_ddr_a(2) & 0x04) */ - if(ddr & 0x04) - { - page_rom(data & 0x04 ? true : false); /* bit 2 controls boot or basic rom */ - } - - /* Bits 0 and 1 for pia2 port a control the BCDIR and BC1 lines of the */ - /* AY-8912 */ - switch (data & 0x03) - { - case 0x00: /* Inactive, do nothing */ - break; - case 0x01: /* Write to selected port */ - m_ay8912->data_w(space, 0, m_pia_2->b_output()); - break; - case 0x02: /* Read from selected port */ - m_pia_2->portb_w(m_ay8912->data_r(space, 0)); - break; - case 0x03: /* Select port to write to */ - m_ay8912->address_w(space, 0, m_pia_2->b_output()); - break; - } -} - - - -//------------------------------------------------- -// pia1_firq_a -//------------------------------------------------- - -WRITE_LINE_MEMBER( dragon_alpha_state::pia2_firq_a ) -{ - recalculate_firq(); -} - - - -//------------------------------------------------- -// pia1_firq_b -//------------------------------------------------- - -WRITE_LINE_MEMBER( dragon_alpha_state::pia2_firq_b ) -{ - recalculate_firq(); -} - - - -/*************************************************************************** - CPU INTERRUPTS -***************************************************************************/ - -//------------------------------------------------- -// firq_get_line - gets the value of the FIRQ line -// passed into the CPU -//------------------------------------------------- - -bool dragon_alpha_state::firq_get_line(void) -{ - return dragon_state::firq_get_line() || m_pia_2->irq_a_state() || m_pia_2->irq_b_state(); -} - - - -/*************************************************************************** - AY8912 -***************************************************************************/ - -//------------------------------------------------- -// psg_porta_read -//------------------------------------------------- - -READ8_MEMBER( dragon_alpha_state::psg_porta_read ) -{ - return 0; -} - - - -//------------------------------------------------- -// psg_porta_read -//------------------------------------------------- - -WRITE8_MEMBER( dragon_alpha_state::psg_porta_write ) -{ - /* Bits 0..3 are the drive select lines for the internal floppy interface */ - /* Bit 4 is the motor on, in the real hardware these are inverted on their way to the drive */ - /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */ - - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - if (BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - - // todo: turning the motor on with bit 4 isn't giving the drive enough - // time to spin up, how does it work in hardware? - if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0); - if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0); - if (m_floppy2->get_device()) m_floppy2->get_device()->mon_w(0); - if (m_floppy3->get_device()) m_floppy3->get_device()->mon_w(0); - - m_fdc->dden_w(BIT(data, 5)); -} - -/*************************************************************************** - FDC -***************************************************************************/ - -//------------------------------------------------- -// fdc_intrq_w - The NMI line on the Alpha is gated -// through IC16 (early PLD), and is gated by pia2 CA2 -//------------------------------------------------- - -WRITE_LINE_MEMBER( dragon_alpha_state::fdc_intrq_w ) -{ - if (state) - { - if (m_just_reset) - { - m_just_reset = 0; - } - else - { - if (m_pia_2->ca2_output_z()) - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - } - } - else - { - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - } -} - - - -//------------------------------------------------- -// fdc_drq_w - The DRQ line goes through pia2 CB1, -// in exactly the same way as DRQ from DragonDos -// does for pia1 CB1 -//------------------------------------------------- - -WRITE_LINE_MEMBER( dragon_alpha_state::fdc_drq_w ) -{ - m_pia_2->cb1_w(state ? ASSERT_LINE : CLEAR_LINE); -} diff --git a/src/mess/machine/dmv_keyb.c b/src/mess/machine/dmv_keyb.c deleted file mode 100644 index 1fe0f2f8f43..00000000000 --- a/src/mess/machine/dmv_keyb.c +++ /dev/null @@ -1,313 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/********************************************************************** - - Decision Mate V keyboard emulation - -*********************************************************************/ - -#include "dmv_keyb.h" - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type DMV_KEYBOARD = &device_creator; - - -//*************************************************************************** -// IMPLEMENTATION -//*************************************************************************** - -ROM_START( dmv_keyboard ) - ROM_REGION( 0x400, "mcu", 0 ) - ROM_LOAD( "dmv_kbmcu.bin", 0x0000, 0x0400, CRC(14e376de) SHA1 (ed09048ef03c602dba17ad6fcfe125c082c9bb17)) -ROM_END - - -static ADDRESS_MAP_START( dmv_keyboard_io, AS_IO, 8, dmv_keyboard_device ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(port1_r) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(port2_r, port2_w) -ADDRESS_MAP_END - - -static MACHINE_CONFIG_FRAGMENT( dmv_keyboard ) - MCFG_CPU_ADD("mcu", I8741, XTAL_6MHz) - MCFG_CPU_IO_MAP(dmv_keyboard_io) -MACHINE_CONFIG_END - - -INPUT_PORTS_START( dmv_keyboard ) - PORT_START("COL.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("COL.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("00") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("COL.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("CLR") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("COL.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("COL.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("COL.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("COL.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) PORT_NAME("Backspace") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - - PORT_START("COL.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F14") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) PORT_NAME("Enter") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13") - - PORT_START("COL.8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("COL.9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F16") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F18") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - - PORT_START("COL.10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F19") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("COL.11") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F15") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F17") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - - PORT_START("COL.12") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F20") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("COL.13") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("COL.14") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("COL.15") - PORT_DIPNAME( 0x07, 0x00, "Lanuguage Code" ) - PORT_DIPSETTING( 0x00, "US English" ) - PORT_DIPSETTING( 0x01, "UK/Int. English" ) - PORT_DIPSETTING( 0x02, "Danish" ) - PORT_DIPSETTING( 0x03, "German" ) - PORT_DIPSETTING( 0x04, "Swedish/Finnish" ) - PORT_DIPSETTING( 0x05, "Norwegian" ) - PORT_DIPSETTING( 0x06, "Spanish" ) - PORT_DIPSETTING( 0x07, "Italian" ) - PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor dmv_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( dmv_keyboard ); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// dmv_keyboard_device - constructor -//------------------------------------------------- - -dmv_keyboard_device::dmv_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, DMV_KEYBOARD, "Decision Mate V Keyboard", tag, owner, clock, "dmv_keyboard", __FILE__), - m_maincpu(*this, "mcu"), - m_keyboard(*this, "COL") -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void dmv_keyboard_device::device_start() -{ -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void dmv_keyboard_device::device_reset() -{ - m_col = 0; - m_sd_data_state = 1; - m_sd_poll_state = 1; -} - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor dmv_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( dmv_keyboard ); -} - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *dmv_keyboard_device::device_rom_region() const -{ - return ROM_NAME( dmv_keyboard ); -} - - -//------------------------------------------------- -// port1_r - -//------------------------------------------------- - -READ8_MEMBER( dmv_keyboard_device::port1_r ) -{ - return m_keyboard[m_col]->read(); -} - -//------------------------------------------------- -// port2_r -//------------------------------------------------- - -READ8_MEMBER( dmv_keyboard_device::port2_r ) -{ - return ((m_sd_data_state | m_sd_poll_state) << 7) | m_col; -} - -//------------------------------------------------- -// port2_w -//------------------------------------------------- - -WRITE8_MEMBER( dmv_keyboard_device::port2_w ) -{ - /* - P2.0 col 0 - P2.1 col 1 - P2.2 col 2 - P2.3 col 3 - P2.7 SDATA - */ - - m_col = data & 0x0f; - m_sd_data_state = BIT(data, 7); -} - -//------------------------------------------------- -// sd_poll_w -//------------------------------------------------- - -DECLARE_WRITE_LINE_MEMBER(dmv_keyboard_device::sd_poll_w) -{ - if (m_sd_poll_state && !state) - m_maincpu->upi41_master_w(m_maincpu->space(), 0, 0); - - m_sd_poll_state = state; -} - -//------------------------------------------------- -// sd_poll_r -//------------------------------------------------- - -DECLARE_READ_LINE_MEMBER(dmv_keyboard_device::sd_poll_r) -{ - return m_sd_data_state; -} diff --git a/src/mess/machine/dmv_keyb.h b/src/mess/machine/dmv_keyb.h deleted file mode 100644 index a20f59a27d4..00000000000 --- a/src/mess/machine/dmv_keyb.h +++ /dev/null @@ -1,71 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/********************************************************************** - - Decision Mate V keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __DMV_KEYBOARD__ -#define __DMV_KEYBOARD__ - - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_DMV_KEYBOARD_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, DMV_KEYBOARD, 0) - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> dmv_keyboard_device - -class dmv_keyboard_device : public device_t -{ -public: - // construction/destruction - dmv_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_WRITE_LINE_MEMBER(sd_poll_w); - DECLARE_READ_LINE_MEMBER(sd_poll_r); - - DECLARE_READ8_MEMBER( port1_r ); - DECLARE_READ8_MEMBER( port2_r ); - DECLARE_WRITE8_MEMBER( port2_w ); - -protected: - // device-level overrides - virtual void device_config_complete() { m_shortname = "dmv_keyb"; } - virtual void device_start(); - virtual void device_reset(); - -private: - required_device m_maincpu; - required_ioport_array<16> m_keyboard; - - UINT8 m_col; - int m_sd_data_state; - int m_sd_poll_state; -}; - - -// device type definition -extern const device_type DMV_KEYBOARD; - - -#endif diff --git a/src/mess/machine/docg3.c b/src/mess/machine/docg3.c deleted file mode 100644 index e0701987b7b..00000000000 --- a/src/mess/machine/docg3.c +++ /dev/null @@ -1,842 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/* - - M-Systems DiskOnChip G3 - Flash Disk with MLC NAND and M-Systems? x2 Technology - - (c) 2009 Tim Schuerewegen - -*/ - -#include "emu.h" -#include "machine/docg3.h" - -#define VERBOSE_LEVEL ( 0 ) - -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%s: %s", machine.describe_context(), buf ); - } -} - - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -// device type definition -const device_type DISKONCHIP_G3 = &device_creator; - -//------------------------------------------------- -// diskonchip_g3_device - constructor -//------------------------------------------------- - -diskonchip_g3_device::diskonchip_g3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, DISKONCHIP_G3, "DiskOnChip G3", tag, owner, clock, "diskonchip_g3", __FILE__), - device_nvram_interface(mconfig, *this) -{ -} - - -UINT32 diskonchip_g3_device::g3_offset_data_1() -{ -// printf( "block %d pages %d page %d planes %d plane %d user_data_size %d extra_area_size %d\n", doc->block, doc->pages, doc->page, doc->planes, doc->plane, doc->user_data_size, doc->extra_area_size); - return ((((m_block * m_pages) + m_page) * m_planes) + m_plane) * (m_user_data_size + m_extra_area_size); -} - -UINT32 diskonchip_g3_device::g3_offset_data_2() -{ - return ((((m_block * m_pages) + m_page) * m_planes) + m_plane) * 16; -} - -UINT32 diskonchip_g3_device::g3_offset_data_3() -{ - return m_block * 8; -} - -UINT8 diskonchip_g3_device::g3_read_data() -{ - UINT8 data = 0; - UINT32 offset; - if (m_test == 0) - { - // read page data (512 + 16) - if (m_transfer_offset >= (m_user_data_size + m_extra_area_size)) - { - m_transfer_offset = m_transfer_offset - (m_user_data_size + m_extra_area_size); - m_plane++; - } - offset = g3_offset_data_1() + m_transfer_offset; - data = m_data[0][offset]; - } - else if (m_test == 1) - { - // read ??? (0x28 bytes) - if (m_transfer_offset < 0x20) - { - offset = g3_offset_data_1() + (m_user_data_size + m_extra_area_size) + (m_user_data_size - 16) + m_transfer_offset; - data = m_data[0][offset]; - } - else if (m_transfer_offset < 0x28) - { - offset = g3_offset_data_3() + m_transfer_offset - 0x20; - data = m_data[2][offset]; - } - else - { - data = 0xFF; - } - } - else if (m_test == 2) - { - // read erase block status - data = 0x00; - } - m_transfer_offset++; - return data; -} - -READ16_MEMBER( diskonchip_g3_device::sec_1_r ) -{ - UINT16 data; - if (m_sec_2[0x1B] & 0x40) - { - data = g3_read_data(); - m_sec_2[0x1B] &= ~0x40; - } - else - { - data = (g3_read_data() << 0) | (g3_read_data() << 8); - } - verboselog( machine(), 9, "(DOC) %08X -> %04X\n", 0x0800 + (offset << 1), data); - return data; -} - -void diskonchip_g3_device::g3_write_data(UINT8 data) -{ - UINT32 offset; - if (m_test == 3) - { - // read page data (512 + 16) - if (m_transfer_offset >= (m_user_data_size + m_extra_area_size)) - { - m_transfer_offset = m_transfer_offset - (m_user_data_size + m_extra_area_size); - m_plane++; - } - if (m_transfer_offset == 0) - { - const UINT8 xxx[] = { 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - offset = g3_offset_data_2(); - memcpy( m_data[1] + offset, xxx, 16); - } - offset = g3_offset_data_1() + m_transfer_offset; - m_data[0][offset] = data; - } - m_transfer_offset++; -} - -WRITE16_MEMBER( diskonchip_g3_device::sec_1_w ) -{ - verboselog( machine(), 9, "(DOC) %08X <- %04X\n", 0x0800 + (offset << 1), data); - if (m_sec_2[0x1B] & 0x40) - { - g3_write_data(data); - m_sec_2[0x1B] &= ~0x40; - } - else - { - g3_write_data((data >> 0) & 0xFF); - g3_write_data((data >> 8) & 0xFF); - } -} - -// #define DoC_G3_IO 0x0800 -// #define DoC_G3_ChipID 0x1000 -// #define DoC_G3_DeviceIdSelect 0x100a -// #define DoC_G3_Ctrl 0x100c -// #define DoC_G3_CtrlConfirm 0x1072 -// #define DoC_G3_ReadAddress 0x101a -// #define DoC_G3_FlashSelect 0x1032 -// #define DoC_G3_FlashCmd 0x1034 -// #define DoC_G3_FlashAddr 0x1036 -// #define DoC_G3_FlashCtrl 0x1038 -// #define DoC_G3_Nop 0x103e - -UINT16 diskonchip_g3_device::sec_2_read_1000() -{ - if (m_device == 0) - { - return 0x0200; - } - else - { - return 0x008C; - } -} - -UINT16 diskonchip_g3_device::sec_2_read_1074() -{ - if (m_device == 0) - { - return 0xFDFF; - } - else - { - return 0x02B3; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_1042() -{ - UINT8 data; - if ((m_block == 0) && (m_page == 0) && (m_transfersize == 0x27)) - { - data = 0x07; - } - else - { - UINT32 offset = g3_offset_data_2() + 0x02; - data = m_data[1][offset]; //0x07; //data & ~(1 << 7); - if ((m_sec_2[0x41] & 0x10) == 0) - { - data = data & ~0x20; - } - if ((m_sec_2[0x41] & 0x08) == 0) - { - data = data & ~0x80; - } - if (m_test != 0) - { - data = 0x00; - } - } - return data; -} - -UINT8 diskonchip_g3_device::sec_2_read_1046() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x06; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_1048() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x08; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_1049() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x09; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_104A() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x0A; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_104B() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x0B; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_104C() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x0C; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_104D() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x0D; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_104E() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x0E; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_104F() -{ - if (m_test == 0) - { - UINT32 offset = g3_offset_data_2() + 0x0F; - return m_data[1][offset]; - } - else - { - return 0x00; - } -} - -UINT8 diskonchip_g3_device::sec_2_read_100E() -{ - return 0x81; -} - -UINT8 diskonchip_g3_device::sec_2_read_1014() -{ - return 0x01; -} - -UINT8 diskonchip_g3_device::sec_2_read_1022() -{ - return 0x85; -} - -UINT8 diskonchip_g3_device::sec_2_read_1038() -{ - // bit 0 = ? - // bit 1 = ? error 0x7C - // bit 2 = ? error 0x73 - // bit 3 = ? - // bit 4 = ? - // bit 5 = ? - // bit 6 = ? - // bit 7 = ? - if (m_device == 0) - { - return 0x19; - } - else - { - return 0x38; - } -} - -UINT16 diskonchip_g3_device::sec_2_read16(UINT32 offset) -{ - UINT16 data = (m_sec_2[offset+0] << 0) + (m_sec_2[offset+1] << 8); - switch (0x1000 + offset) - { - // ? - case 0x1000 : data = sec_2_read_1000(); break; - // ? - case 0x100E : data = sec_2_read_100E(); break; - // ? - case 0x1014 : data = sec_2_read_1014(); break; - // ? - case 0x1022 : data = sec_2_read_1022(); break; - // flash control - case 0x1038 : data = sec_2_read_1038(); break; - // flash ? - case 0x1042 : data = sec_2_read_1042(); break; - // ? - case 0x1046 : data = sec_2_read_1046(); break; - // ? - case 0x1048 : data = (sec_2_read_1048() << 0) + (sec_2_read_1049() << 8); break; - case 0x104A : data = (sec_2_read_104A() << 0) + (sec_2_read_104B() << 8); break; - case 0x104C : data = (sec_2_read_104C() << 0) + (sec_2_read_104D() << 8); break; - case 0x104E : data = (sec_2_read_104E() << 0) + (sec_2_read_104F() << 8); break; - // ? - case 0x1074 : data = sec_2_read_1074(); break; - } - verboselog( machine(), 9, "(DOC) %08X -> %04X\n", 0x1000 + offset, data); - return data; -} - -UINT8 diskonchip_g3_device::sec_2_read8(UINT32 offset) -{ - UINT8 data = m_sec_2[offset]; - switch (0x1000 + offset) - { - // ? - case 0x100E : data = sec_2_read_100E(); break; - // ? - case 0x1014 : data = sec_2_read_1014(); break; - // ? - case 0x1022 : data = sec_2_read_1022(); break; - // flash control - case 0x1038 : data = sec_2_read_1038(); break; - // flash ? - case 0x1042 : data = sec_2_read_1042(); break; - // ? - case 0x1046 : data = sec_2_read_1046(); break; - // ? - case 0x1048 : data = sec_2_read_1048(); break; - case 0x1049 : data = sec_2_read_1049(); break; - case 0x104A : data = sec_2_read_104A(); break; - case 0x104B : data = sec_2_read_104B(); break; - case 0x104C : data = sec_2_read_104C(); break; - case 0x104D : data = sec_2_read_104D(); break; - case 0x104E : data = sec_2_read_104E(); break; - case 0x104F : data = sec_2_read_104F(); break; - } - verboselog( machine(), 9, "(DOC) %08X -> %02X\n", 0x1000 + offset, data); - return data; -} - -void diskonchip_g3_device::sec_2_write_100C(UINT8 data) -{ - const char *mode_name[] = { "reset", "normal", "deep power down" }; - UINT32 mode = data & 3; - verboselog( machine(), 5, "mode %d (%s)\n", mode, mode_name[mode]); - if (mode == 0) - { - m_sec_2[0x04] = 00; - } -} - -void diskonchip_g3_device::sec_2_write_1032(UINT8 data) -{ - verboselog( machine(), 5, "flash select %02X\n", data); - if ((data == 0x12) || (data == 0x27)) - { - m_transfer_offset = 0; - m_plane = 0; - m_block = 0; - m_page = 0; - } -} - -void diskonchip_g3_device::g3_erase_block() -{ - UINT32 offset; - int i, j; - const UINT8 xxx[] = { 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0xCE, 0x00, 0xCF, 0x72, 0xFC, 0x1B, 0xA9, 0xC7, 0xB9, 0x00 }; - verboselog( machine(), 5, "erase block %04X\n", m_block); - for (i=0;i> 7); - if (block >= m_blocks) fatalerror( "DOCG3: invalid block (%d)\n", block); - plane = (m_data_1036 >> 6) & 1; - page = (m_data_1036 >> 0) & 0x3F; - verboselog( machine(), 5, "flash address %d - %06X (plane %d block %04X page %04X)\n", m_address_count, m_data_1036, plane, block, page); - if (m_address_count == 1) - { - m_plane = 0; - m_block = block; - m_page = page; - } - } - } - else if (m_sec_2[0x34] == 0x80) - { - m_data_1036 |= data << (8 * m_data_1036_count++); - if (m_data_1036_count == 4) - { - UINT32 block, page, plane, unk; - block = (m_data_1036 >> 15); - plane = (m_data_1036 >> 14) & 1; - page = (m_data_1036 >> 8) & 0x3F; - unk = (m_data_1036 >> 0) & 0xFF; - verboselog( machine(), 5, "flash address %d - %08X (plane %d block %04X page %04X unk %02X)\n", m_address_count, m_data_1036, plane, block, page, unk); - if (m_address_count == 1) - { - m_plane = 0; - m_block = block; - m_page = page; - m_transfer_offset = 0; - } - } - } - else if (m_sec_2[0x34] == 0x05) - { - m_transfer_offset = data << 2; - verboselog( machine(), 5, "flash transfer offset %04X\n", m_transfer_offset); - } -} - -void diskonchip_g3_device::sec_2_write_1040(UINT16 data) -{ - m_transfersize = (data & 0x3FF); - verboselog( machine(), 5, "flash transfer size %04X\n", m_transfersize); -} - -void diskonchip_g3_device::sec_2_write_100A(UINT8 data) -{ - m_device = data & 3; - verboselog( machine(), 5, "select device %d\n", m_device); -} - -void diskonchip_g3_device::sec_2_write16(UINT32 offset, UINT16 data) -{ - m_sec_2[offset+0] = (data >> 0) & 0xFF; - m_sec_2[offset+1] = (data >> 8) & 0xFF; - verboselog( machine(), 9, "(DOC) %08X <- %04X\n", 0x1000 + offset, data); - switch (0x1000 + offset) - { - // ? - case 0x100C : sec_2_write_100C(data); break; - // Device ID Select Register - case 0x100A : sec_2_write_100A(data); break; - // flash select - case 0x1032 : sec_2_write_1032(data); break; - // flash command - case 0x1034 : sec_2_write_1034(data); break; - // flash address - case 0x1036 : sec_2_write_1036(data); break; - // ? - case 0x1040 : sec_2_write_1040(data); break; - } -} - -void diskonchip_g3_device::sec_2_write8(UINT32 offset, UINT8 data) -{ - m_sec_2[offset] = data; - verboselog( machine(), 9, "(DOC) %08X <- %02X\n", 0x1000 + offset, data); - switch (0x1000 + offset) - { - // ? - case 0x100C : sec_2_write_100C(data); break; - // Device ID Select Register - case 0x100A : sec_2_write_100A(data); break; - // flash select - case 0x1032 : sec_2_write_1032(data); break; - // flash command - case 0x1034 : sec_2_write_1034(data); break; - // flash address - case 0x1036 : sec_2_write_1036(data); break; - } -} - -READ16_MEMBER( diskonchip_g3_device::sec_2_r ) -{ - if (mem_mask == 0xffff) - { - return sec_2_read16(offset * 2); - } - else if (mem_mask == 0x00ff) - { - return sec_2_read8(offset * 2 + 0) << 0; - } - else if (mem_mask == 0xff00) - { - return sec_2_read8( offset * 2 + 1) << 8; - } - else - { - verboselog( machine(), 0, "diskonchip_g3_sec_2_r: unknown mem_mask %08X\n", mem_mask); - return 0; - } -} - -WRITE16_MEMBER( diskonchip_g3_device::sec_2_w ) -{ - if (mem_mask == 0xffff) - { - sec_2_write16(offset * 2, data); - } - else if (mem_mask == 0x00ff) - { - sec_2_write8(offset * 2 + 0, (data >> 0) & 0xFF); - } - else if (mem_mask == 0xff00) - { - sec_2_write8(offset * 2 + 1, (data >> 8) & 0xFF); - } - else - { - verboselog( machine(), 0, "diskonchip_g3_sec_2_w: unknown mem_mask %08X\n", mem_mask); - } -} - -READ16_MEMBER( diskonchip_g3_device::sec_3_r ) -{ - UINT16 data = 0; - verboselog( machine(), 9, "(DOC) %08X -> %04X\n", 0x1800 + (offset << 1), data); - return data; -} - -WRITE16_MEMBER( diskonchip_g3_device::sec_3_w ) -{ - verboselog( machine(), 9, "(DOC) %08X <- %02X\n", 0x1800 + (offset << 1), data); -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- -void diskonchip_g3_device::device_start() -{ - verboselog( machine(), 9, "(DOC) device start\n"); - - switch (m_size) - { - case 64 : - { - m_planes = 2; - m_blocks = 1024; - m_pages = 64; - m_user_data_size = 512; - m_extra_area_size = 16; - } - break; - } - - m_data_size[0] = m_planes * m_blocks * m_pages * (m_user_data_size + m_extra_area_size); - m_data_size[1] = m_planes * m_blocks * m_pages * 16; - m_data_size[2] = m_blocks * 8; - - m_device = 0; - m_block = 0; - m_page = 0; - m_transfersize = 0; - m_plane = 0; - m_test = 0; - - memset(m_sec_2, 0, sizeof(m_sec_2)); - - m_data[0] = auto_alloc_array( machine(), UINT8, m_data_size[0]); - memset(m_data[0], 0, sizeof(UINT8) * m_data_size[0]); - m_data[1] = auto_alloc_array( machine(), UINT8, m_data_size[1]); - memset(m_data[1], 0, sizeof(UINT8) * m_data_size[1]); - m_data[2] = auto_alloc_array( machine(), UINT8, m_data_size[2]); - memset(m_data[2], 0, sizeof(UINT8) * m_data_size[2]); - -// diskonchip_load( device, "diskonchip"); - - save_item( NAME(m_planes)); - save_item( NAME(m_blocks)); - save_item( NAME(m_pages)); - save_item( NAME(m_user_data_size)); - save_item( NAME(m_extra_area_size)); - save_pointer( NAME(m_data[0]), m_data_size[0]); - save_pointer( NAME(m_data[1]), m_data_size[1]); - save_pointer( NAME(m_data[2]), m_data_size[2]); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void diskonchip_g3_device::device_reset() -{ - verboselog( machine(), 9, "(DOC) device reset\n"); -} - -//------------------------------------------------- -// nvram_default - called to initialize NVRAM to -// its default state -//------------------------------------------------- - -void diskonchip_g3_device::nvram_default() -{ - memset(m_data[0], 0xFF, m_data_size[0]); - memset(m_data[1], 0x00, m_data_size[1]); - memset(m_data[2], 0xFF, m_data_size[2]); -} - -//------------------------------------------------- -// nvram_read - called to read NVRAM from the -// .nv file -//------------------------------------------------- - -void diskonchip_g3_device::nvram_read(emu_file &file) -{ - file.read(m_data[0], m_data_size[0]); - file.read(m_data[1], m_data_size[1]); - file.read(m_data[2], m_data_size[2]); -} - -//------------------------------------------------- -// nvram_write - called to write NVRAM to the -// .nv file -//------------------------------------------------- - -void diskonchip_g3_device::nvram_write(emu_file &file) -{ - file.write(m_data[0], m_data_size[0]); - file.write(m_data[1], m_data_size[1]); - file.write(m_data[2], m_data_size[2]); -} diff --git a/src/mess/machine/docg3.h b/src/mess/machine/docg3.h deleted file mode 100644 index 0a00b446500..00000000000 --- a/src/mess/machine/docg3.h +++ /dev/null @@ -1,103 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/* - - M-Systems DiskOnChip G3 - Flash Disk with MLC NAND and M-Systems? x2 Technology - - (c) 2009 Tim Schuerewegen - -*/ - -#ifndef __DOCG3_H__ -#define __DOCG3_H__ - -#define MCFG_DISKONCHIP_G3_ADD(_tag, _size) \ - MCFG_DEVICE_ADD(_tag, DISKONCHIP_G3, 0) \ - static_cast(device)->set_size(_size); - -// ======================> diskonchip_g3_device - -class diskonchip_g3_device : public device_t, - public device_nvram_interface -{ -public: - // construction/destruction - diskonchip_g3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - void set_size(int _size) { m_size = _size; } -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // device_nvram_interface overrides - virtual void nvram_default(); - virtual void nvram_read(emu_file &file); - virtual void nvram_write(emu_file &file); -public: - DECLARE_READ16_MEMBER( sec_1_r ); - DECLARE_WRITE16_MEMBER( sec_1_w ); - DECLARE_READ16_MEMBER( sec_2_r ); - DECLARE_WRITE16_MEMBER( sec_2_w ); - DECLARE_READ16_MEMBER( sec_3_r ); - DECLARE_WRITE16_MEMBER( sec_3_w ); -private: - UINT32 g3_offset_data_1(); - UINT32 g3_offset_data_2(); - UINT32 g3_offset_data_3(); - UINT8 g3_read_data(); - void g3_write_data(UINT8 data); - UINT16 sec_2_read_1000(); - UINT16 sec_2_read_1074(); - UINT8 sec_2_read_1042(); - UINT8 sec_2_read_1046(); - UINT8 sec_2_read_1048(); - UINT8 sec_2_read_1049(); - UINT8 sec_2_read_104A(); - UINT8 sec_2_read_104B(); - UINT8 sec_2_read_104C(); - UINT8 sec_2_read_104D(); - UINT8 sec_2_read_104E(); - UINT8 sec_2_read_104F(); - UINT8 sec_2_read_100E(); - UINT8 sec_2_read_1014(); - UINT8 sec_2_read_1022(); - UINT8 sec_2_read_1038(); - UINT16 sec_2_read16(UINT32 offset); - UINT8 sec_2_read8(UINT32 offset); - void sec_2_write_100C(UINT8 data); - void sec_2_write_1032(UINT8 data); - void g3_erase_block(); - void sec_2_write_1034(UINT8 data); - void sec_2_write_1036(UINT8 data); - void sec_2_write_1040(UINT16 data); - void sec_2_write_100A(UINT8 data); - void sec_2_write16(UINT32 offset, UINT16 data); - void sec_2_write8(UINT32 offset, UINT8 data); - - int m_size; - - UINT32 m_planes; - UINT32 m_blocks; - UINT32 m_pages; - UINT32 m_user_data_size; - UINT32 m_extra_area_size; - UINT8 *m_data[3]; - UINT32 m_data_size[3]; - UINT8 m_sec_2[0x800]; - UINT32 m_data_1036; - UINT32 m_data_1036_count; - UINT32 m_transfer_offset; - UINT8 m_device; - UINT32 m_block; - UINT32 m_page; - UINT32 m_plane; - UINT32 m_transfersize; - UINT8 m_test; - UINT32 m_address_count; -}; - -// device type definition -extern const device_type DISKONCHIP_G3; - -#endif /* __DOCG3_H__ */ diff --git a/src/mess/machine/dragon.c b/src/mess/machine/dragon.c deleted file mode 100644 index 12c902d5c93..00000000000 --- a/src/mess/machine/dragon.c +++ /dev/null @@ -1,153 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - dragon.h - - Dragon Family - -Dragon Alpha code added 21-Oct-2004, - Phill Harvey-Smith (afra@aurigae.demon.co.uk) - - Added AY-8912 and FDC code 30-Oct-2004. - -Fixed Dragon Alpha NMI enable/disable, following circuit traces on a real machine. - P.Harvey-Smith, 11-Aug-2005. - -Re-implemented Alpha NMI enable/disable, using direct PIA reads, rather than -keeping track of it in a variable in the driver. - P.Harvey-Smith, 25-Sep-2006. - -Radically re-wrote memory emulation code for CoCo 1/2 & Dragon machines, the -new code emulates the memory mapping of the SAM, dependent on what size of -RAM chips it is programed to use, including proper mirroring of the RAM. - -Replaced the kludged emulation of the cart line, with a timer based trigger -this is set to toggle at 1Hz, this seems to be good enough to trigger the -cartline, but is so slow in real terms that it should have very little -impact on the emulation speed. - -Re-factored the code common to all machines, and separated the code different, -into callbacks/functions unique to the machines, in preperation for splitting -the code for individual machine types into separate files, I have preposed, that -the CoCo 1/2 should stay in coco.c, and that the coco3 and dragon specifc code -should go into coco3.c and dragon.c which should (hopefully) make the code -easier to manage. - P.Harvey-Smith, Dec 2006-Feb 2007 - -***************************************************************************/ - -#include "includes/dragon.h" - - -/*************************************************************************** - DRAGON32 -***************************************************************************/ - -//------------------------------------------------- -// pia1_pa_changed - called when PIA1 PA changes -//------------------------------------------------- - -void dragon_state::pia1_pa_changed(UINT8 data) -{ - /* call inherited function */ - coco12_state::pia1_pa_changed(data); - - /* if strobe bit is high send data from pia0 port b to dragon parallel printer */ - if (data & 0x02) - { - UINT8 output = m_pia_1->b_output(); - m_printer->output(output); - } -} - - -/*************************************************************************** - DRAGON64 -***************************************************************************/ - -//------------------------------------------------- -// ff00_read -//------------------------------------------------- - -READ8_MEMBER( dragon64_state::ff00_read ) -{ - UINT8 result = 0x00; - - switch(offset & 0x07) - { - case 0: case 1: case 2: case 3: - result = dragon_state::ff00_read(space, offset, mem_mask); - break; - - case 4: case 5: case 6: case 7: - result = m_acia->read(space, offset, mem_mask); - break; - } - return result; -} - - - -//------------------------------------------------- -// ff00_write -//------------------------------------------------- - -WRITE8_MEMBER( dragon64_state::ff00_write ) -{ - switch(offset & 0x07) - { - case 0: case 1: case 2: case 3: - dragon_state::ff00_write(space, offset, data, mem_mask); - break; - - case 4: case 5: case 6: case 7: - m_acia->write(space, offset, data, mem_mask); - break; - } -} - - - -//------------------------------------------------- -// pia1_pb_changed -//------------------------------------------------- - -void dragon64_state::pia1_pb_changed(UINT8 data) -{ - dragon_state::pia1_pb_changed(data); - - UINT8 ddr = ~m_pia_1->port_b_z_mask(); - - /* If bit 2 of the pia1 ddrb is 1 then this pin is an output so use it */ - /* to control the paging of the 32k and 64k basic roms */ - /* Otherwise it set as an input, with an EXTERNAL pull-up so it should */ - /* always be high (enabling 32k basic rom) */ - if (ddr & 0x04) - { - page_rom(data & 0x04 ? true : false); - logerror("pia1_pb_changed\n"); - } -} - - - -//------------------------------------------------- -// page_rom - Controls rom paging in Dragon 64, -// and Dragon Alpha. -// -// On 64, switches between the two versions of the -// basic rom mapped in at 0x8000 -// -// On the alpha switches between the -// Boot/Diagnostic rom and the basic rom -//------------------------------------------------- - -void dragon64_state::page_rom(bool romswitch) -{ - offs_t offset = romswitch - ? 0x0000 // This is the 32k mode basic(64)/boot rom(alpha) - : 0x8000; // This is the 64k mode basic(64)/basic rom(alpha) - m_sam->set_bank_offset(1, offset); // 0x8000-0x9FFF - m_sam->set_bank_offset(2, offset); // 0xA000-0xBFFF -} diff --git a/src/mess/machine/egret.c b/src/mess/machine/egret.c deleted file mode 100644 index 079a2504536..00000000000 --- a/src/mess/machine/egret.c +++ /dev/null @@ -1,489 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/* - Apple "Egret" ADB/system controller MCU - Emulation by R. Belmont - - Port definitions, primarily from the schematics. - - Port A: - - x------- O ADB data line out - -x------ I ADB data line in - --x----- I System type. 0 = hardware power switch, 1 = Egret controls power on/off - ---x---- O DFAC latch - ----x--- O ? (asserted briefly when resetting 680x0) - -----x-- I Keyboard power switch - ------x- ? PSU enable OUT for system type 0, otherwise chassis power switch IN - -------x ? Control panel enable IN for system type 0 (e.g. LC), power supply enable OUT for type 1 - - Port B: - - x------- O DFAC bit clock - -x------ ? DFAC data I/O (used in both directions) - --x----- ? VIA shift register data (used in both directions) - ---x---- O VIA clock - ----x--- I VIA SYS_SESSION - -----x-- I VIA VIA_FULL - ------x- O VIA XCEIVER SESSION - -------x I +5v sense - - Port C: - x--- O 680x0 reset - -x-- ? 680x0 IPL 2 (used in both directions) - --xx ? IPL 1/0 for hardware power switch, trickle sense (bit 1) and pulled up to +5v (bit 0) if Egret controls the PSU -*/ - - -//#define EGRET_SUPER_VERBOSE - -#include "emu.h" -#include "egret.h" -#include "cpu/m6805/m6805.h" -#include "sound/asc.h" -#include "includes/mac.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define EGRET_CPU_TAG "egret" - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type EGRET = &device_creator; - -ROM_START( egret ) - ROM_REGION(0x4400, EGRET_CPU_TAG, 0) - ROM_LOAD( "341s0851.bin", 0x1100, 0x1100, CRC(ea9ea6e4) SHA1(8b0dae3ec66cdddbf71567365d2c462688aeb571) ) - ROM_LOAD( "341s0850.bin", 0x2200, 0x1100, CRC(4906ecd0) SHA1(95e08ba0c5d4b242f115f104aba9905dbd3fd87c) ) - ROM_LOAD( "344s0100.bin", 0x3300, 0x1100, CRC(59e2b6b6) SHA1(540e752b7da521f1bdb16e0ad7c5f46ddc92d4e9) ) -ROM_END - -//------------------------------------------------- -// ADDRESS_MAP -//------------------------------------------------- - -static ADDRESS_MAP_START( egret_map, AS_PROGRAM, 8, egret_device ) - AM_RANGE(0x0000, 0x0002) AM_READWRITE(ports_r, ports_w) - AM_RANGE(0x0004, 0x0006) AM_READWRITE(ddr_r, ddr_w) - AM_RANGE(0x0007, 0x0007) AM_READWRITE(pll_r, pll_w) - AM_RANGE(0x0008, 0x0008) AM_READWRITE(timer_ctrl_r, timer_ctrl_w) - AM_RANGE(0x0009, 0x0009) AM_READWRITE(timer_counter_r, timer_counter_w) - AM_RANGE(0x0012, 0x0012) AM_READWRITE(onesec_r, onesec_w) - AM_RANGE(0x0090, 0x00ff) AM_RAM // work RAM and stack - AM_RANGE(0x0100, 0x01ff) AM_READWRITE(pram_r, pram_w) - AM_RANGE(0x0f00, 0x1fff) AM_ROM AM_REGION(EGRET_CPU_TAG, 0) -ADDRESS_MAP_END - -//------------------------------------------------- -// MACHINE_CONFIG -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( egret ) - MCFG_CPU_ADD(EGRET_CPU_TAG, M68HC05EG, XTAL_32_768kHz*192) // 32.768 kHz input clock, can be PLL'ed to x128 = 4.1 MHz under s/w control - MCFG_CPU_PROGRAM_MAP(egret_map) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor egret_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( egret ); -} - -const rom_entry *egret_device::device_rom_region() const -{ - return ROM_NAME( egret ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data) -{ - switch (offset) - { - case 0: // port A -/* printf("ADB:%d DFAC:%d PowerEnable:%d\n", - (data & 0x80) ? 1 : 0, - (data & 0x10) ? 1 : 0, - (data & 0x02) ? 1 : 0);*/ - - if ((data & 0x80) != last_adb) - { -/* if (data & 0x80) - { - printf("EG ADB: 1->0 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time); - } - else - { - printf("EG ADB: 0->1 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time); - }*/ - - // allow the linechange handler to override us - adb_in = (data & 0x80) ? true : false; - - m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time); - write_linechange(((data & 0x80) >> 7) ^ 1); - - last_adb = data & 0x80; - last_adb_time = machine().time().as_ticks(1000000); - } - break; - - case 1: // port B - { - if (xcvr_session != ((data>>1)&1)) - { - #ifdef EGRET_SUPER_VERBOSE - printf("EG-> XCVR_SESSION: %d (PC=%x)\n", (data>>1)&1, m_maincpu->pc()); - #endif - xcvr_session = (data>>1) & 1; - } - if (via_data != ((data>>5)&1)) - { - #ifdef EGRET_SUPER_VERBOSE - printf("EG-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->pc()); - #endif - via_data = (data>>5) & 1; - write_via_data(via_data); - } - if (via_clock != ((data>>4)&1)) - { - #ifdef EGRET_SUPER_VERBOSE - printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc()); - #endif - via_clock = (data>>4) & 1; - write_via_clock(via_clock^1); - } - } - break; - - case 2: // port C - if ((data & 8) != reset_line) - { - #ifdef EGRET_SUPER_VERBOSE - printf("680x0 reset: %d -> %d\n", (ports[2] & 8)>>3, (data & 8)>>3); - #endif - reset_line = (data & 8); - - // falling edge, should reset the machine too - if ((ports[2] & 8) && !(data&8)) - { - // if PRAM's waiting to be loaded, transfer it now - if (!pram_loaded) - { - memcpy(pram, disk_pram, 0x100); - pram_loaded = true; - } - } - - write_reset((reset_line & 8) ? ASSERT_LINE : CLEAR_LINE); - } - break; - } -} - -READ8_MEMBER( egret_device::ddr_r ) -{ - return ddrs[offset]; -} - -WRITE8_MEMBER( egret_device::ddr_w ) -{ -/* printf("%02x to DDR %c\n", data, 'A' + offset);*/ - - send_port(space, offset, ports[offset] & data); - - ddrs[offset] = data; -} - -READ8_MEMBER( egret_device::ports_r ) -{ - UINT8 incoming = 0; - - switch (offset) - { - case 0: // port A - incoming |= adb_in ? 0x40 : 0; - - if (egret_controls_power) - { - incoming |= 0x02; // indicate soft power, indicate chassis switch on - } - else - { - //incoming |= 0x01; // enable control panel enabled - } - break; - - case 1: // port B - incoming |= 0x01; // always show +5v active - incoming |= via_full<<2; - incoming |= sys_session<<3; - incoming |= via_data<<5; - incoming |= 0x40; // show DFAC line high - break; - - case 2: // port C - if (egret_controls_power) - { - incoming |= 0x3; // trickle sense active, bit 0 pulled up as per schematics - } - break; - } - - // apply data direction registers - incoming &= (ddrs[offset] ^ 0xff); - // add in ddr-masked version of port writes - incoming |= (ports[offset] & ddrs[offset]); - - return incoming; -} - -WRITE8_MEMBER( egret_device::ports_w ) -{ - send_port(space, offset, data); - - ports[offset] = data; -} - -READ8_MEMBER( egret_device::pll_r ) -{ - return pll_ctrl; -} - -WRITE8_MEMBER( egret_device::pll_w ) -{ - #ifdef EGRET_SUPER_VERBOSE - if (pll_ctrl != data) - { - static const int clocks[4] = { 524288, 1048576, 2097152, 4194304 }; - printf("PLL ctrl: clock %d TCS:%d BCS:%d AUTO:%d BWC:%d PLLON:%d\n", clocks[data&3], - (data & 0x80) ? 1 : 0, - (data & 0x40) ? 1 : 0, - (data & 0x20) ? 1 : 0, - (data & 0x10) ? 1 : 0, - (data & 0x08) ? 1 : 0); - } - #endif - pll_ctrl = data; -} - -READ8_MEMBER( egret_device::timer_ctrl_r ) -{ - return timer_ctrl; -} - -WRITE8_MEMBER( egret_device::timer_ctrl_w ) -{ -// printf("%02x to timer control\n", data); - timer_ctrl = data; -} - -READ8_MEMBER( egret_device::timer_counter_r ) -{ - return timer_counter; -} - -WRITE8_MEMBER( egret_device::timer_counter_w ) -{ -// printf("%02x to timer/counter\n", data); - timer_counter = data; -} - -READ8_MEMBER( egret_device::onesec_r ) -{ - return onesec; -} - -WRITE8_MEMBER( egret_device::onesec_w ) -{ -// printf("%02x to one-second control\n", data); - - m_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); - - if ((onesec & 0x40) && !(data & 0x40)) - { - m_maincpu->set_input_line(M68HC05EG_INT_CPI, CLEAR_LINE); - } - - onesec = data; -} - -READ8_MEMBER( egret_device::pram_r ) -{ - return pram[offset]; -} - -WRITE8_MEMBER( egret_device::pram_w ) -{ - pram[offset] = data; -} - -//------------------------------------------------- -// egret_device - constructor -//------------------------------------------------- - -egret_device::egret_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, EGRET, "Apple Egret", tag, owner, clock, "egret", __FILE__), - device_nvram_interface(mconfig, *this), - write_reset(*this), - write_linechange(*this), - write_via_clock(*this), - write_via_data(*this), - m_maincpu(*this, EGRET_CPU_TAG) -{ -} - -//------------------------------------------------- -// static_set_type - configuration helper to set -// the chip type -//------------------------------------------------- - -void egret_device::static_set_type(device_t &device, int type) -{ - egret_device &egret = downcast(device); - egret.rom_offset = type; -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void egret_device::device_start() -{ - write_reset.resolve_safe(); - write_linechange.resolve_safe(); - write_via_clock.resolve_safe(); - write_via_data.resolve_safe(); - - m_timer = timer_alloc(0, NULL); - save_item(NAME(ddrs[0])); - save_item(NAME(ddrs[1])); - save_item(NAME(ddrs[2])); - save_item(NAME(ports[0])); - save_item(NAME(ports[1])); - save_item(NAME(ports[2])); - save_item(NAME(pll_ctrl)); - save_item(NAME(timer_ctrl)); - save_item(NAME(timer_counter)); - save_item(NAME(onesec)); - save_item(NAME(xcvr_session)); - save_item(NAME(via_full)); - save_item(NAME(sys_session)); - save_item(NAME(via_data)); - save_item(NAME(via_clock)); - save_item(NAME(adb_in)); - save_item(NAME(reset_line)); - save_item(NAME(m_adb_dtime)); - save_item(NAME(pram_loaded)); - save_item(NAME(pram)); - save_item(NAME(disk_pram)); - - UINT8 *rom = device().machine().root_device().memregion(device().subtag(EGRET_CPU_TAG).c_str())->base(); - - if (rom) - { - memcpy(rom, rom+rom_offset, 0x1100); - } -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void egret_device::device_reset() -{ - ddrs[0] = ddrs[1] = ddrs[2] = 0; - ports[0] = ports[1] = ports[2] = 0; - - m_timer->adjust(attotime::never); - - egret_controls_power = false; // set to hard power control - adb_in = true; // line is pulled up to +5v, so nothing plugged in would read as "1" - reset_line = 0; - xcvr_session = 0; - via_full = 0; - sys_session = 0; - via_data = 0; - via_clock = 0; - pll_ctrl = 0; - timer_ctrl = 0; - timer_counter = 0; - last_adb_time = m_maincpu->total_cycles(); - onesec = 0; - last_adb = 0; -} - -void egret_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - onesec |= 0x40; - - if (onesec & 0x10) - { - m_maincpu->set_input_line(M68HC05EG_INT_CPI, ASSERT_LINE); - } -} - -// the 6805 program clears PRAM on startup (on h/w it's always running once a battery is inserted) -// we deal with that by loading pram from disk to a secondary buffer and then slapping it into "live" -// once the Egret reboots the 68k -void egret_device::nvram_default() -{ - memset(pram, 0, 0x100); - memset(disk_pram, 0, 0x100); - - // IIsi and IIvx both default PRAM to this, it seems a reasonable default for Egret systems - pram[0x1] = 0x80; - pram[0x2] = 0x4f; - pram[0x3] = 0x48; - pram[0x8] = 0x13; - pram[0x9] = 0x88; - pram[0xb] = 0x4c; - pram[0xc] = 0x4e; - pram[0xd] = 0x75; - pram[0xe] = 0x4d; - pram[0xf] = 0x63; - pram[0x10] = 0xa8; - pram[0x14] = 0xcc; - pram[0x15] = 0x0a; - pram[0x16] = 0xcc; - pram[0x17] = 0x0a; - pram[0x1d] = 0x02; - pram[0x1e] = 0x63; - pram[0x6f] = 0x28; - pram[0x70] = 0x83; - pram[0x71] = 0x26; - pram[0x77] = 0x01; - pram[0x78] = 0xff; - pram[0x79] = 0xff; - pram[0x7a] = 0xff; - pram[0x7b] = 0xdf; - pram[0x7d] = 0x09; - pram[0xf3] = 0x12; - pram[0xf9] = 0x01; - pram[0xf3] = 0x12; - pram[0xfb] = 0x8d; - pram_loaded = false; -} - -void egret_device::nvram_read(emu_file &file) -{ - file.read(disk_pram, 0x100); - pram_loaded = false; -} - -void egret_device::nvram_write(emu_file &file) -{ - file.write(pram, 0x100); -} diff --git a/src/mess/machine/egret.h b/src/mess/machine/egret.h deleted file mode 100644 index cca418b62a5..00000000000 --- a/src/mess/machine/egret.h +++ /dev/null @@ -1,140 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -#pragma once - -#ifndef __EGRET_H__ -#define __EGRET_H__ - -#include "emu.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define EGRET_TAG "egret" - -#define EGRET_341S0851 0x1100 -#define EGRET_341S0850 0x2200 -#define EGRET_344S0100 0x3300 - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_EGRET_ADD(_type) \ - MCFG_DEVICE_ADD(EGRET_TAG, EGRET, 0) \ - MCFG_EGRET_TYPE(_type) - -#define MCFG_EGRET_REPLACE(_type) \ - MCFG_DEVICE_REPLACE(EGRET_TAG, EGRET, 0) \ - MCFG_EGRET_TYPE(_type) - -#define MCFG_EGRET_TYPE(_type) \ - egret_device::static_set_type(*device, _type); - -#define MCFG_EGRET_REMOVE() \ - MCFG_DEVICE_REMOVE(EGRET_TAG) - -#define MCFG_EGRET_RESET_CALLBACK(_cb) \ - devcb = &egret_device::set_reset_cb(*device, DEVCB_##_cb); - -#define MCFG_EGRET_LINECHANGE_CALLBACK(_cb) \ - devcb = &egret_device::set_linechange_cb(*device, DEVCB_##_cb); - -#define MCFG_EGRET_VIA_CLOCK_CALLBACK(_cb) \ - devcb = &egret_device::set_via_clock_cb(*device, DEVCB_##_cb); - -#define MCFG_EGRET_VIA_DATA_CALLBACK(_cb) \ - devcb = &egret_device::set_via_data_cb(*device, DEVCB_##_cb); - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> egret_device - -class egret_device : public device_t, public device_nvram_interface -{ -public: - // construction/destruction - egret_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // inline configuration helpers - static void static_set_type(device_t &device, int type); - - // device_config_nvram_interface overrides - virtual void nvram_default(); - virtual void nvram_read(emu_file &file); - virtual void nvram_write(emu_file &file); - - DECLARE_READ8_MEMBER( ddr_r ); - DECLARE_WRITE8_MEMBER( ddr_w ); - DECLARE_READ8_MEMBER( ports_r ); - DECLARE_WRITE8_MEMBER( ports_w ); - DECLARE_READ8_MEMBER( pll_r ); - DECLARE_WRITE8_MEMBER( pll_w ); - DECLARE_READ8_MEMBER( timer_ctrl_r ); - DECLARE_WRITE8_MEMBER( timer_ctrl_w ); - DECLARE_READ8_MEMBER( timer_counter_r ); - DECLARE_WRITE8_MEMBER( timer_counter_w ); - DECLARE_READ8_MEMBER( onesec_r ); - DECLARE_WRITE8_MEMBER( onesec_w ); - DECLARE_READ8_MEMBER( pram_r ); - DECLARE_WRITE8_MEMBER( pram_w ); - - // interface routines - UINT8 get_xcvr_session() { return xcvr_session; } - void set_via_full(UINT8 val) { via_full = val; } - void set_sys_session(UINT8 val) { sys_session = val; } - UINT8 get_via_data() { return via_data; } - void set_via_data(UINT8 dat) { via_data = dat; } - UINT8 get_via_clock() { return via_clock; } - void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; } - int get_adb_dtime() { return m_adb_dtime; } - - int rom_offset; - - template static devcb_base &set_reset_cb(device_t &device, _Object wr) { return downcast(device).write_reset.set_callback(wr); } - template static devcb_base &set_linechange_cb(device_t &device, _Object wr) { return downcast(device).write_linechange.set_callback(wr); } - template static devcb_base &set_via_clock_cb(device_t &device, _Object wr) { return downcast(device).write_via_clock.set_callback(wr); } - template static devcb_base &set_via_data_cb(device_t &device, _Object wr) { return downcast(device).write_via_data.set_callback(wr); } - - devcb_write_line write_reset, write_linechange, write_via_clock, write_via_data; - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual machine_config_constructor device_mconfig_additions() const; - virtual const rom_entry *device_rom_region() const; - - required_device m_maincpu; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - UINT8 ddrs[3]; - UINT8 ports[3]; - UINT8 pll_ctrl; - UINT8 timer_ctrl; - UINT8 timer_counter; - UINT8 onesec; - UINT8 xcvr_session, via_full, sys_session, via_data, via_clock, last_adb; - UINT64 last_adb_time; - bool egret_controls_power; - bool adb_in; - int reset_line; - int m_adb_dtime; - emu_timer *m_timer; - UINT8 pram[0x100], disk_pram[0x100]; - bool pram_loaded; - - void send_port(address_space &space, UINT8 offset, UINT8 data); -}; - -// device type definition -extern const device_type EGRET; - -#endif diff --git a/src/mess/machine/einstein.c b/src/mess/machine/einstein.c deleted file mode 100644 index a2582ee93e3..00000000000 --- a/src/mess/machine/einstein.c +++ /dev/null @@ -1,208 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Dirk Best, Phill Harvey-Smith -/*************************************************************************** - - Tatung Einstein - - -***************************************************************************/ - -#include "emu.h" -#include "includes/einstein.h" - -/**************************************************************** - EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT -****************************************************************/ - - -const device_type EINSTEIN_KEYBOARD_DAISY = &device_creator; - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// z80ctc_device - constructor -//------------------------------------------------- - -einstein_keyboard_daisy_device::einstein_keyboard_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, EINSTEIN_KEYBOARD_DAISY, "Einstein keyboard daisy chain", tag, owner, clock, "einstein_keyboard", __FILE__), - device_z80daisy_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void einstein_keyboard_daisy_device::device_start() -{ -} - -//************************************************************************** -// DAISY CHAIN INTERFACE -//************************************************************************** - -//------------------------------------------------- -// z80daisy_irq_state - return the overall IRQ -// state for this device -//------------------------------------------------- - -int einstein_keyboard_daisy_device::z80daisy_irq_state() -{ - einstein_state *einstein = device().machine().driver_data(); - - if (einstein->m_interrupt & einstein->m_interrupt_mask & EINSTEIN_KEY_INT) - return Z80_DAISY_INT; - - return 0; -} - - -//------------------------------------------------- -// z80daisy_irq_ack - acknowledge an IRQ and -// return the appropriate vector -//------------------------------------------------- - -int einstein_keyboard_daisy_device::z80daisy_irq_ack() -{ - return 0xf7; -} - -//------------------------------------------------- -// z80daisy_irq_reti - clear the interrupt -// pending state to allow other interrupts through -//------------------------------------------------- - -void einstein_keyboard_daisy_device::z80daisy_irq_reti() -{ -} - -const device_type EINSTEIN_ADC_DAISY = &device_creator; - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// z80ctc_device - constructor -//------------------------------------------------- - -einstein_adc_daisy_device::einstein_adc_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, EINSTEIN_ADC_DAISY, "Einstein ADC daisy chain", tag, owner, clock, "einstein_adc_daisy", __FILE__), - device_z80daisy_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void einstein_adc_daisy_device::device_start() -{ -} - -//************************************************************************** -// DAISY CHAIN INTERFACE -//************************************************************************** - -//------------------------------------------------- -// z80daisy_irq_state - return the overall IRQ -// state for this device -//------------------------------------------------- - -int einstein_adc_daisy_device::z80daisy_irq_state() -{ - einstein_state *einstein = device().machine().driver_data(); - - if (einstein->m_interrupt & einstein->m_interrupt_mask & EINSTEIN_ADC_INT) - return Z80_DAISY_INT; - - return 0; -} - - -//------------------------------------------------- -// z80daisy_irq_ack - acknowledge an IRQ and -// return the appropriate vector -//------------------------------------------------- - -int einstein_adc_daisy_device::z80daisy_irq_ack() -{ - return 0xfb; -} - -//------------------------------------------------- -// z80daisy_irq_reti - clear the interrupt -// pending state to allow other interrupts through -//------------------------------------------------- - -void einstein_adc_daisy_device::z80daisy_irq_reti() -{ -} - - -const device_type EINSTEIN_FIRE_DAISY = &device_creator; - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// z80ctc_device - constructor -//------------------------------------------------- - -einstein_fire_daisy_device::einstein_fire_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, EINSTEIN_FIRE_DAISY, "Einstein fire button daisy chain", tag, owner, clock, "einstein_fire_daisy", __FILE__), - device_z80daisy_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void einstein_fire_daisy_device::device_start() -{ -} - -//************************************************************************** -// DAISY CHAIN INTERFACE -//************************************************************************** - -//------------------------------------------------- -// z80daisy_irq_state - return the overall IRQ -// state for this device -//------------------------------------------------- - -int einstein_fire_daisy_device::z80daisy_irq_state() -{ - einstein_state *einstein = device().machine().driver_data(); - - if (einstein->m_interrupt & einstein->m_interrupt_mask & EINSTEIN_FIRE_INT) - return Z80_DAISY_INT; - - return 0; -} - - -//------------------------------------------------- -// z80daisy_irq_ack - acknowledge an IRQ and -// return the appropriate vector -//------------------------------------------------- - -int einstein_fire_daisy_device::z80daisy_irq_ack() -{ - return 0xfd; -} - -//------------------------------------------------- -// z80daisy_irq_reti - clear the interrupt -// pending state to allow other interrupts through -//------------------------------------------------- - -void einstein_fire_daisy_device::z80daisy_irq_reti() -{ -} diff --git a/src/mess/machine/electron.c b/src/mess/machine/electron.c deleted file mode 100644 index 8510fe7f454..00000000000 --- a/src/mess/machine/electron.c +++ /dev/null @@ -1,417 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/****************************************************************************** - Acorn Electron driver - - MESS Driver By: - - Wilbert Pol - -******************************************************************************/ - -#include "emu.h" -#include "includes/electron.h" -#include "sound/beep.h" -#include "imagedev/cassette.h" - -void electron_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_TAPE_HANDLER: - electron_tape_timer_handler(ptr, param); - break; - case TIMER_SETUP_BEEP: - setup_beep(ptr, param); - break; - case TIMER_SCANLINE_INTERRUPT: - electron_scanline_interrupt(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in electron_state::device_timer"); - } -} - - -void electron_state::electron_tape_start() -{ - if (m_ula.tape_running ) - { - return; - } - m_ula.tape_steps = 0; - m_ula.tape_value = 0x80808080; - m_ula.high_tone_set = 0; - m_ula.bit_count = 0; - m_ula.tape_running = 1; - m_tape_timer->adjust(attotime::zero, 0, attotime::from_hz(4800)); -} - -void electron_state::electron_tape_stop() -{ - m_ula.tape_running = 0; - m_tape_timer->reset(); -} - -#define TAPE_LOW 0x00; -#define TAPE_HIGH 0xFF; - -TIMER_CALLBACK_MEMBER(electron_state::electron_tape_timer_handler) -{ - if ( m_ula.cassette_motor_mode ) - { - double tap_val; - tap_val = m_cassette->input(); - if ( tap_val < -0.5 ) - { - m_ula.tape_value = ( m_ula.tape_value << 8 ) | TAPE_LOW; - m_ula.tape_steps++; - } - else if ( tap_val > 0.5 ) - { - m_ula.tape_value = ( m_ula.tape_value << 8 ) | TAPE_HIGH; - m_ula.tape_steps++; - } - else - { - m_ula.tape_steps = 0; - m_ula.bit_count = 0; - m_ula.high_tone_set = 0; - m_ula.tape_value = 0x80808080; - } - if ( m_ula.tape_steps > 2 && ( m_ula.tape_value == 0x0000FFFF || m_ula.tape_value == 0x00FF00FF ) ) - { - m_ula.tape_steps = 0; - switch( m_ula.bit_count ) - { - case 0: /* start bit */ - m_ula.start_bit = ( ( m_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); - //logerror( "++ Read start bit: %d\n", m_ula.start_bit ); - if ( m_ula.start_bit ) - { - if ( m_ula.high_tone_set ) - { - m_ula.bit_count--; - } - } - else - { - m_ula.high_tone_set = 0; - } - break; - case 1: case 2: case 3: case 4: - case 5: case 6: case 7: case 8: - //logerror( "++ Read regular bit: %d\n", m_ula.tape_value == 0x0000FFFF ? 0 : 1 ); - m_ula.tape_byte = ( m_ula.tape_byte >> 1 ) | ( m_ula.tape_value == 0x0000FFFF ? 0 : 0x80 ); - break; - case 9: /* stop bit */ - m_ula.stop_bit = ( ( m_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); - //logerror( "++ Read stop bit: %d\n", m_ula.stop_bit ); - if ( m_ula.start_bit && m_ula.stop_bit && m_ula.tape_byte == 0xFF && ! m_ula.high_tone_set ) - { - electron_interrupt_handler( INT_SET, INT_HIGH_TONE ); - m_ula.high_tone_set = 1; - } - else if ( ! m_ula.start_bit && m_ula.stop_bit ) - { - //logerror( "-- Byte read from tape: %02x\n", m_ula.tape_byte ); - electron_interrupt_handler( INT_SET, INT_RECEIVE_FULL ); - } - else - { - logerror( "Invalid start/stop bit combination detected: %d,%d\n", m_ula.start_bit, m_ula.stop_bit ); - } - break; - } - m_ula.bit_count = ( m_ula.bit_count + 1 ) % 10; - } - } -} - -READ8_MEMBER(electron_state::electron_read_keyboard) -{ - UINT8 data = 0; - - //logerror( "PC=%04x: keyboard read from paged rom area, address: %04x", activecpu_get_pc(), offset ); - for (int i = 0; i < 14; i++) - { - if (!(offset & 1)) - data |= m_keybd[i]->read() & 0x0f; - - offset = offset >> 1; - } - //logerror( ", data: %02x\n", data ); - return data; -} - -READ8_MEMBER(electron_state::electron_jim_r) -{ - return 0xff; -} - -WRITE8_MEMBER(electron_state::electron_jim_w) -{ -} - -READ8_MEMBER(electron_state::electron_1mhz_r) -{ - return 0xff; -} - -WRITE8_MEMBER(electron_state::electron_1mhz_w) -{ -} - -READ8_MEMBER(electron_state::electron_ula_r) -{ - UINT8 data = ((UINT8 *)memregion("user1")->base())[0x43E00 + offset]; - switch ( offset & 0x0f ) - { - case 0x00: /* Interrupt status */ - data = m_ula.interrupt_status; - m_ula.interrupt_status &= ~0x02; - break; - case 0x01: /* Unknown */ - break; - case 0x04: /* Casette data shift register */ - electron_interrupt_handler(INT_CLEAR, INT_RECEIVE_FULL ); - data = m_ula.tape_byte; - break; - } - logerror( "ULA: read offset %02x: %02x\n", offset, data ); - return data; -} - -static const int electron_palette_offset[4] = { 0, 4, 5, 1 }; -static const UINT16 electron_screen_base[8] = { 0x3000, 0x3000, 0x3000, 0x4000, 0x5800, 0x5800, 0x6000, 0x5800 }; - -WRITE8_MEMBER(electron_state::electron_ula_w) -{ - int i = electron_palette_offset[(( offset >> 1 ) & 0x03)]; - logerror( "ULA: write offset %02x <- %02x\n", offset & 0x0f, data ); - switch( offset & 0x0f ) - { - case 0x00: /* Interrupt control */ - m_ula.interrupt_control = data; - break; - case 0x01: /* Unknown */ - break; - case 0x02: /* Screen start address #1 */ - m_ula.screen_start = ( m_ula.screen_start & 0x7e00 ) | ( ( data & 0xe0 ) << 1 ); - logerror( "screen_start changed to %04x\n", m_ula.screen_start ); - break; - case 0x03: /* Screen start addres #2 */ - m_ula.screen_start = ( m_ula.screen_start & 0x1c0 ) | ( ( data & 0x3f ) << 9 ); - logerror( "screen_start changed to %04x\n", m_ula.screen_start ); - break; - case 0x04: /* Cassette data shift register */ - break; - case 0x05: /* Interrupt clear and paging */ - /* rom page requests are honoured when currently bank 0-7 or 12-15 is switched in, - * or when 8-11 is currently switched in only switching to bank 8-15 is allowed. - * - * Rompages 10 and 11 both select the Basic ROM. - * Rompages 8 and 9 both select the keyboard. - */ - if ( ( ( m_ula.rompage & 0x0C ) != 0x08 ) || ( data & 0x08 ) ) - { - m_ula.rompage = data & 0x0f; - if ( m_ula.rompage == 8 || m_ula.rompage == 9 ) - { - m_ula.rompage = 8; - space.install_read_handler( 0x8000, 0xbfff, read8_delegate(FUNC(electron_state::electron_read_keyboard),this)); - } - else - { - space.install_read_bank( 0x8000, 0xbfff, "bank2"); - } - membank("bank2")->set_entry(m_ula.rompage); - } - if ( data & 0x10 ) - { - electron_interrupt_handler( INT_CLEAR, INT_DISPLAY_END ); - } - if ( data & 0x20 ) - { - electron_interrupt_handler( INT_CLEAR, INT_RTC ); - } - if ( data & 0x40 ) - { - electron_interrupt_handler( INT_CLEAR, INT_HIGH_TONE ); - } - if ( data & 0x80 ) - { - } - break; - case 0x06: /* Counter divider */ - if ( m_ula.communication_mode == 0x01) - { - m_beeper->set_frequency( 1000000 / ( 16 * ( data + 1 ) ) ); - } - break; - case 0x07: /* Misc. */ - m_ula.communication_mode = ( data >> 1 ) & 0x03; - switch( m_ula.communication_mode ) - { - case 0x00: /* cassette input */ - m_beeper->set_state( 0 ); - electron_tape_start(); - break; - case 0x01: /* sound generation */ - m_beeper->set_state( 1 ); - electron_tape_stop(); - break; - case 0x02: /* cassette output */ - m_beeper->set_state( 0 ); - electron_tape_stop(); - break; - case 0x03: /* not used */ - m_beeper->set_state( 0 ); - electron_tape_stop(); - break; - } - m_ula.screen_mode = ( data >> 3 ) & 0x07; - m_ula.screen_base = electron_screen_base[ m_ula.screen_mode ]; - m_ula.screen_size = 0x8000 - m_ula.screen_base; - m_ula.vram = (UINT8 *)space.get_read_ptr(m_ula.screen_base ); - logerror( "ULA: screen mode set to %d\n", m_ula.screen_mode ); - m_ula.cassette_motor_mode = ( data >> 6 ) & 0x01; - m_cassette->change_state(m_ula.cassette_motor_mode ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MOTOR_DISABLED ); - m_ula.capslock_mode = ( data >> 7 ) & 0x01; - break; - case 0x08: case 0x0A: case 0x0C: case 0x0E: - // video_update - m_ula.current_pal[i+10] = (m_ula.current_pal[i+10] & 0x01) | (((data & 0x80) >> 5) | ((data & 0x08) >> 1)); - m_ula.current_pal[i+8] = (m_ula.current_pal[i+8] & 0x01) | (((data & 0x40) >> 4) | ((data & 0x04) >> 1)); - m_ula.current_pal[i+2] = (m_ula.current_pal[i+2] & 0x03) | ((data & 0x20) >> 3); - m_ula.current_pal[i] = (m_ula.current_pal[i] & 0x03) | ((data & 0x10) >> 2); - break; - case 0x09: case 0x0B: case 0x0D: case 0x0F: - // video_update - m_ula.current_pal[i+10] = (m_ula.current_pal[i+10] & 0x06) | ((data & 0x08) >> 3); - m_ula.current_pal[i+8] = (m_ula.current_pal[i+8] & 0x06) | ((data & 0x04) >> 2); - m_ula.current_pal[i+2] = (m_ula.current_pal[i+2] & 0x04) | (((data & 0x20) >> 4) | ((data & 0x02) >> 1)); - m_ula.current_pal[i] = (m_ula.current_pal[i] & 0x04) | (((data & 0x10) >> 3) | ((data & 0x01))); - break; - } -} - -void electron_state::electron_interrupt_handler(int mode, int interrupt) -{ - if ( mode == INT_SET ) - { - m_ula.interrupt_status |= interrupt; - } - else - { - m_ula.interrupt_status &= ~interrupt; - } - if ( m_ula.interrupt_status & m_ula.interrupt_control & ~0x83 ) - { - m_ula.interrupt_status |= 0x01; - m_maincpu->set_input_line(0, ASSERT_LINE ); - } - else - { - m_ula.interrupt_status &= ~0x01; - m_maincpu->set_input_line(0, CLEAR_LINE ); - } -} - -/************************************** - Machine Initialisation functions -***************************************/ - -TIMER_CALLBACK_MEMBER(electron_state::setup_beep) -{ - m_beeper->set_state( 0 ); - m_beeper->set_frequency( 300 ); -} - -void electron_state::machine_reset() -{ - membank("bank2")->set_entry(0); - - m_ula.communication_mode = 0x04; - m_ula.screen_mode = 0; - m_ula.cassette_motor_mode = 0; - m_ula.capslock_mode = 0; - m_ula.screen_mode = 0; - m_ula.screen_start = 0x3000; - m_ula.screen_base = 0x3000; - m_ula.screen_size = 0x8000 - 0x3000; - m_ula.screen_addr = 0; - m_ula.tape_running = 0; - m_ula.vram = (UINT8 *)m_maincpu->space(AS_PROGRAM).get_read_ptr(m_ula.screen_base); -} - -void electron_state::machine_start() -{ - UINT8 *lo_rom, *up_rom; - std::string region_tag; - memory_region *cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - if (cart_rom) - up_rom = cart_rom->base(); - else - up_rom = memregion("user1")->base() + 12 * 0x4000; - if (cart_rom && cart_rom->bytes() > 0x4000) - lo_rom = cart_rom->base() + 0x4000; - else - lo_rom = memregion("user1")->base(); - - membank("bank2")->configure_entries(0, 1, lo_rom, 0x4000); - membank("bank2")->configure_entries(1, 11, memregion("user1")->base() + 0x04000, 0x4000); - membank("bank2")->configure_entries(12, 1, up_rom, 0x4000); - membank("bank2")->configure_entries(13, 3, memregion("user1")->base() + 0x34000, 0x4000); - - m_ula.interrupt_status = 0x82; - m_ula.interrupt_control = 0x00; - timer_set(attotime::zero, TIMER_SETUP_BEEP); - m_tape_timer = timer_alloc(TIMER_TAPE_HANDLER); -} - -DEVICE_IMAGE_LOAD_MEMBER( electron_state, electron_cart ) -{ - if (image.software_entry() == NULL) - { - UINT32 filesize = image.length(); - - if (filesize != 16384) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only size 16384 is supported"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(filesize, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - image.fread(m_cart->get_rom_base(), filesize); - return IMAGE_INIT_PASS; - } - else - { - int upsize = image.get_software_region_length("uprom"); - int losize = image.get_software_region_length("lorom"); - - if (upsize != 16384 && upsize != 0) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size for uprom"); - return IMAGE_INIT_FAIL; - } - - if (losize != 16384 && losize != 0) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size for lorom"); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(upsize + losize, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - - if (upsize) - memcpy(m_cart->get_rom_base(), image.get_software_region("uprom"), upsize); - - if (losize) - memcpy(m_cart->get_rom_base() + upsize, image.get_software_region("lorom"), losize); - - return IMAGE_INIT_PASS; - } -} diff --git a/src/mess/machine/esqpanel.c b/src/mess/machine/esqpanel.c deleted file mode 100644 index 1c4dee54248..00000000000 --- a/src/mess/machine/esqpanel.c +++ /dev/null @@ -1,253 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/* - Ensoniq panel/display device -*/ -#include "emu.h" -#include "esqpanel.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type ESQPANEL1x22 = &device_creator; -const device_type ESQPANEL2x40 = &device_creator; -const device_type ESQPANEL2x40_SQ1 = &device_creator; - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// esqpanel_device - constructor -//------------------------------------------------- - -esqpanel_device::esqpanel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : - device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_serial_interface(mconfig, *this), - m_write_tx(*this), - m_write_analog(*this) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void esqpanel_device::device_start() -{ - m_write_tx.resolve_safe(); - m_write_analog.resolve_safe(); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void esqpanel_device::device_reset() -{ - // panel comms is at 62500 baud (double the MIDI rate), 8N2 - set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2); - set_rcv_rate(62500); - set_tra_rate(62500); - - m_tx_busy = false; - m_xmit_read = m_xmit_write = 0; - m_bCalibSecondByte = false; - m_bButtonLightSecondByte = false; -} - -void esqpanel_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - device_serial_interface::device_timer(timer, id, param, ptr); -} - -void esqpanel_device::rcv_complete() // Rx completed receiving byte -{ - receive_register_extract(); - UINT8 data = get_received_char(); - -// if (data >= 0xe0) printf("Got %02x from motherboard (second %s)\n", data, m_bCalibSecondByte ? "yes" : "no"); - - send_to_display(data); - - if (m_bCalibSecondByte) - { -// printf("second byte is %02x\n", data); - if (data == 0xfd) // calibration request - { -// printf("let's send reply!\n"); - xmit_char(0xff); // this is the correct response for "calibration OK" - } - m_bCalibSecondByte = false; - } - else if (m_bButtonLightSecondByte) - { - // Lights on the Buttons, on the VFX-SD: - // Number Button - // 0 1-6 - // 1 8 - // 2 6 - // 3 4 - // 4 2 - // 5 Compare - // 6 1 - // 7 Presets - // 8 7-12 - // 9 9 - // a 7 - // b 5 - // c 3 - // d Sounds - // e 0 - // f Cart -// int lightNumber = data & 0x3f; - - // Light states: - // 0 = Off - // 2 = On - // 3 = Blinking -// int lightState = (data & 0xc0) >> 6; - - // TODO: do something with the button information! - // printf("Setting light %d to %s\n", lightNumber, lightState == 3 ? "Blink" : lightState == 2 ? "On" : "Off"); - m_bButtonLightSecondByte = false; - } - else if (data == 0xfb) // request calibration - { - m_bCalibSecondByte = true; - } - else if (data == 0xff) // button light state command - { - m_bButtonLightSecondByte = true; - } - else - { - // EPS wants a throwaway reply byte for each byte sent to the KPC - // VFX-SD and SD-1 definitely don't :) - if (m_eps_mode) - { - if (data == 0xe7) - { - xmit_char(0x00); // actual value of response is never checked - } - else if (data == 0x71) - { - xmit_char(0x00); // actual value of response is never checked - } - else - { - xmit_char(data); // actual value of response is never checked - } - } - } -} - -void esqpanel_device::tra_complete() // Tx completed sending byte -{ -// printf("panel Tx complete\n"); - // is there more waiting to send? - if (m_xmit_read != m_xmit_write) - { - transmit_register_setup(m_xmitring[m_xmit_read++]); - if (m_xmit_read >= XMIT_RING_SIZE) - { - m_xmit_read = 0; - } - } - else - { - m_tx_busy = false; - } -} - -void esqpanel_device::tra_callback() // Tx send bit -{ - m_write_tx(transmit_register_get_data_bit()); -} - -void esqpanel_device::xmit_char(UINT8 data) -{ -// printf("Panel: xmit %02x\n", data); - - // if tx is busy it'll pick this up automatically when it completes - if (!m_tx_busy) - { - m_tx_busy = true; - transmit_register_setup(data); - } - else - { - // tx is busy, it'll pick this up next time - m_xmitring[m_xmit_write++] = data; - if (m_xmit_write >= XMIT_RING_SIZE) - { - m_xmit_write = 0; - } - } -} - -void esqpanel_device::set_analog_value(offs_t offset, UINT16 value) -{ - m_write_analog(offset, value); -} - -/* panel with 1x22 VFD display used in the EPS-16 and EPS-16 Plus */ - -static MACHINE_CONFIG_FRAGMENT(esqpanel1x22) - MCFG_ESQ1x22_ADD("vfd") -MACHINE_CONFIG_END - -machine_config_constructor esqpanel1x22_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( esqpanel1x22 ); -} - -esqpanel1x22_device::esqpanel1x22_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - esqpanel_device(mconfig, ESQPANEL1x22, "Ensoniq front panel with 1x22 VFD", tag, owner, clock, "esqpanel122", __FILE__), - m_vfd(*this, "vfd") -{ - m_eps_mode = true; -} - -/* panel with 2x40 VFD display used in the ESQ-1, VFX-SD, SD-1, and others */ - -static MACHINE_CONFIG_FRAGMENT(esqpanel2x40) - MCFG_ESQ2x40_ADD("vfd") -MACHINE_CONFIG_END - -machine_config_constructor esqpanel2x40_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( esqpanel2x40 ); -} - -esqpanel2x40_device::esqpanel2x40_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - esqpanel_device(mconfig, ESQPANEL2x40, "Ensoniq front panel with 2x40 VFD", tag, owner, clock, "esqpanel240", __FILE__), - m_vfd(*this, "vfd") -{ - m_eps_mode = false; -} - -/* panel with 2x16? LCD display used in the SQ and MR series, plus probably more */ - -static MACHINE_CONFIG_FRAGMENT(esqpanel2x40_sq1) - MCFG_ESQ2x40_SQ1_ADD("vfd") -MACHINE_CONFIG_END - -machine_config_constructor esqpanel2x40_sq1_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( esqpanel2x40_sq1 ); -} - -esqpanel2x40_sq1_device::esqpanel2x40_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - esqpanel_device(mconfig, ESQPANEL2x40, "Ensoniq front panel with 2x16 LCD", tag, owner, clock, "esqpanel240_sq1", __FILE__), - m_vfd(*this, "vfd") -{ - m_eps_mode = false; -} diff --git a/src/mess/machine/esqpanel.h b/src/mess/machine/esqpanel.h deleted file mode 100644 index 2cd913e0856..00000000000 --- a/src/mess/machine/esqpanel.h +++ /dev/null @@ -1,140 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -#pragma once - -#ifndef __ESQPANEL_H__ -#define __ESQPANEL_H__ - -#include "emu.h" -#include "machine/esqvfd.h" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_ESQPANEL1x22_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, ESQPANEL1x22, 0) - -#define MCFG_ESQPANEL1x22_REPLACE(_tag) \ - MCFG_DEVICE_REPLACE(_tag, ESQPANEL1x22, 0) - -#define MCFG_ESQPANEL1x22_REMOVE(_tag) \ - MCFG_DEVICE_REMOVE(_tag) - -#define MCFG_ESQPANEL2x40_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, ESQPANEL2x40, 0) - -#define MCFG_ESQPANEL2x40_REPLACE(_tag) \ - MCFG_DEVICE_REPLACE(_tag, ESQPANEL2x40, 0) - -#define MCFG_ESQPANEL_2x40_REMOVE(_tag) \ - MCFG_DEVICE_REMOVE(_tag) - -#define MCFG_ESQPANEL2x40_SQ1_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, ESQPANEL2x40_SQ1, 0) - -#define MCFG_ESQPANEL2x40_SQ1_REPLACE(_tag) \ - MCFG_DEVICE_REPLACE(_tag, ESQPANEL2x40_SQ1, 0) - -#define MCFG_ESQPANEL2x40_SQ1_REMOVE(_tag) \ - MCFG_DEVICE_REMOVE(_tag) - -#define MCFG_ESQPANEL_TX_CALLBACK(_write) \ - devcb = &esqpanel_device::set_tx_wr_callback(*device, DEVCB_##_write); - -#define MCFG_ESQPANEL_ANALOG_CALLBACK(_write) \ - devcb = &esqpanel_device::set_analog_wr_callback(*device, DEVCB_##_write); - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> esqpanel_device - -class esqpanel_device : public device_t, public device_serial_interface -{ -public: - // construction/destruction - esqpanel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - template static devcb_base &set_tx_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_tx.set_callback(object); } - template static devcb_base &set_analog_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_analog.set_callback(object); } - - virtual void send_to_display(UINT8 data) = 0; - - void xmit_char(UINT8 data); - void set_analog_value(offs_t offset, UINT16 value); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // serial overrides - virtual void rcv_complete(); // Rx completed receiving byte - virtual void tra_complete(); // Tx completed sending byte - virtual void tra_callback(); // Tx send bit - - bool m_eps_mode; - -private: - static const int XMIT_RING_SIZE = 16; - - bool m_bCalibSecondByte; - bool m_bButtonLightSecondByte; - - devcb_write_line m_write_tx; - devcb_write16 m_write_analog; - UINT8 m_xmitring[XMIT_RING_SIZE]; - int m_xmit_read, m_xmit_write; - bool m_tx_busy; -}; - -class esqpanel1x22_device : public esqpanel_device { -public: - esqpanel1x22_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - required_device m_vfd; - - virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); } - -protected: - virtual machine_config_constructor device_mconfig_additions() const; - -private: -}; - -class esqpanel2x40_device : public esqpanel_device { -public: - esqpanel2x40_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - required_device m_vfd; - - virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); } - -protected: - virtual machine_config_constructor device_mconfig_additions() const; - -private: -}; - -class esqpanel2x40_sq1_device : public esqpanel_device { -public: - esqpanel2x40_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - required_device m_vfd; - - virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); } - -protected: - virtual machine_config_constructor device_mconfig_additions() const; - -private: -}; - -extern const device_type ESQPANEL1x22; -extern const device_type ESQPANEL2x40; -extern const device_type ESQPANEL2x40_SQ1; - -#endif diff --git a/src/mess/machine/esqvfd.c b/src/mess/machine/esqvfd.c deleted file mode 100644 index e103ef6e972..00000000000 --- a/src/mess/machine/esqvfd.c +++ /dev/null @@ -1,405 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/* - Ensoniq Vacuum Fluorescent Displays (VFDs) - Emulation by R. Belmont -*/ - -#include "esqvfd.h" -#include "esq1by22.lh" -#include "esq2by40.lh" - -const device_type ESQ1x22 = &device_creator; -const device_type ESQ2x40 = &device_creator; -const device_type ESQ2x40_SQ1 = &device_creator; - -// adapted from bfm_bd1, rearranged to work with ASCII data used by the Ensoniq h/w -static const UINT16 font[]= -{ // FEDC BA98 7654 3210 - 0x0000, // 0000 0000 0000 0000 (space) - 0x0000, // 0000 0000 0000 0000 ! (not defined) - 0x0009, // 0000 0000 0000 1001 ". - 0xC62A, // 1100 0110 0010 1010 #. - 0xC62D, // 1100 0110 0010 1101 $. - 0x0000, // 0000 0000 0000 0000 % (not defined) - 0x0000, // 0000 0000 0000 0000 & (not defined) - 0x0040, // 0000 0000 1000 0000 '. - 0x0880, // 0000 1000 1000 0000 (. - 0x0050, // 0000 0000 0101 0000 ). - 0xCCD8, // 1100 1100 1101 1000 *. - 0xC408, // 1100 0100 0000 1000 +. - 0x0000, // 0000 0000 0000 0000 , (not defined) - 0xC000, // 1100 0000 0000 0000 -. - 0x1000, // 0001 0000 0000 0000 . - 0x0090, // 0000 0000 1001 0000 / - 0x22B7, // 0010 0010 1011 0111 0. - 0x0408, // 0000 0100 0000 1000 1. - 0xE206, // 1110 0010 0000 0110 2. - 0x4226, // 0100 0010 0010 0110 3. - 0xC023, // 1100 0000 0010 0011 4. - 0xC225, // 1100 0010 0010 0101 5. - 0xE225, // 1110 0010 0010 0101 6. - 0x0026, // 0000 0000 0010 0110 7. - 0xE227, // 1110 0010 0010 0111 8. - 0xC227, // 1100 0010 0010 0111 9. - 0x0000, // 0000 0000 0000 0000 : (not defined) - 0x0000, // 0000 0000 0000 0000 ; (not defined) - 0x0290, // 0000 0010 1001 0000 <. - 0xC200, // 1100 0010 0000 0000 =. - 0x0A40, // 0000 1010 0100 0000 >. - 0x0000, // 0000 0000 0000 0000 ? (not defined) - 0xA626, // 1010 0110 0010 0110 @. - 0xE027, // 1110 0000 0010 0111 A. - 0x462E, // 0100 0110 0010 1110 B. - 0x2205, // 0010 0010 0000 0101 C. - 0x062E, // 0000 0110 0010 1110 D. - 0xA205, // 1010 0010 0000 0101 E. - 0xA005, // 1010 0000 0000 0101 F. - 0x6225, // 0110 0010 0010 0101 G. - 0xE023, // 1110 0000 0010 0011 H. - 0x060C, // 0000 0110 0000 1100 I. - 0x2222, // 0010 0010 0010 0010 J. - 0xA881, // 1010 1000 1000 0001 K. - 0x2201, // 0010 0010 0000 0001 L. - 0x20E3, // 0010 0000 1110 0011 M. - 0x2863, // 0010 1000 0110 0011 N. - 0x2227, // 0010 0010 0010 0111 O. - 0xE007, // 1110 0000 0000 0111 P. - 0x2A27, // 0010 1010 0010 0111 Q. - 0xE807, // 1110 1000 0000 0111 R. - 0xC225, // 1100 0010 0010 0101 S. - 0x040C, // 0000 0100 0000 1100 T. - 0x2223, // 0010 0010 0010 0011 U. - 0x2091, // 0010 0000 1001 0001 V. - 0x2833, // 0010 1000 0011 0011 W. - 0x08D0, // 0000 1000 1101 0000 X. - 0x04C0, // 0000 0100 1100 0000 Y. - 0x0294, // 0000 0010 1001 0100 Z. - 0x2205, // 0010 0010 0000 0101 [. - 0x0840, // 0000 1000 0100 0000 \. - 0x0226, // 0000 0010 0010 0110 ]. - 0x0810, // 0000 1000 0001 0000 ^. - 0x0200, // 0000 0010 0000 0000 _ - 0x0040, // 0000 0000 0100 0000 ` - 0xE027, // 1110 0000 0010 0111 A. - 0x462E, // 0100 0110 0010 1110 B. - 0x2205, // 0010 0010 0000 0101 C. - 0x062E, // 0000 0110 0010 1110 D. - 0xA205, // 1010 0010 0000 0101 E. - 0xA005, // 1010 0000 0000 0101 F. - 0x6225, // 0110 0010 0010 0101 G. - 0xE023, // 1110 0000 0010 0011 H. - 0x060C, // 0000 0110 0000 1100 I. - 0x2222, // 0010 0010 0010 0010 J. - 0xA881, // 1010 1000 1000 0001 K. - 0x2201, // 0010 0010 0000 0001 L. - 0x20E3, // 0010 0000 1110 0011 M. - 0x2863, // 0010 1000 0110 0011 N. - 0x2227, // 0010 0010 0010 0111 O. - 0xE007, // 1110 0000 0000 0111 P. - 0x2A27, // 0010 1010 0010 0111 Q. - 0xE807, // 1110 1000 0000 0111 R. - 0xC225, // 1100 0010 0010 0101 S. - 0x040C, // 0000 0100 0000 1100 T. - 0x2223, // 0010 0010 0010 0011 U. - 0x2091, // 0010 0000 1001 0001 V. - 0x2833, // 0010 1000 0011 0011 W. - 0x08D0, // 0000 1000 1101 0000 X. - 0x04C0, // 0000 0100 1100 0000 Y. - 0x0294, // 0000 0010 1001 0100 Z. - 0x2205, // 0010 0010 0000 0101 [. - 0x0408, // 0000 0100 0000 1000 | - 0x0226, // 0000 0010 0010 0110 ]. - 0x0810, // 0000 1000 0001 0000 ~. - 0x0000, // 0000 0000 0000 0000 (DEL) -}; - -esqvfd_t::esqvfd_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : - device_t(mconfig, type, name, tag, owner, clock, shortname, source) -{ -} - -void esqvfd_t::device_start() -{ -} - -void esqvfd_t::device_reset() -{ - m_cursx = m_cursy = 0; - m_savedx = m_savedy = 0; - m_curattr = AT_NORMAL; - m_lastchar = 0; - memset(m_chars, 0, sizeof(m_chars)); - memset(m_attrs, 0, sizeof(m_attrs)); - memset(m_dirty, 1, sizeof(m_attrs)); -} - -void esqvfd_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ -} - -// why isn't the font just stored in this order? -UINT32 esqvfd_t::conv_segments(UINT16 segin) -{ - UINT32 segout = 0; - - if ( segin & 0x0004 ) segout |= 0x0001; - if ( segin & 0x0002 ) segout |= 0x0002; - if ( segin & 0x0020 ) segout |= 0x0004; - if ( segin & 0x0200 ) segout |= 0x0008; - if ( segin & 0x2000 ) segout |= 0x0010; - if ( segin & 0x0001 ) segout |= 0x0020; - if ( segin & 0x8000 ) segout |= 0x0040; - if ( segin & 0x4000 ) segout |= 0x0080; - if ( segin & 0x0008 ) segout |= 0x0100; - if ( segin & 0x0400 ) segout |= 0x0200; - if ( segin & 0x0010 ) segout |= 0x0400; - if ( segin & 0x0040 ) segout |= 0x0800; - if ( segin & 0x0080 ) segout |= 0x1000; - if ( segin & 0x0800 ) segout |= 0x2000; - if ( segin & 0x1000 ) segout |= 0x4000; - - return segout; -} - -// generic display update; can override from child classes if not good enough -void esqvfd_t::update_display() -{ - for (int row = 0; row < m_rows; row++) - { - for (int col = 0; col < m_cols; col++) - { - if (m_dirty[row][col]) - { - UINT32 segdata = conv_segments(font[m_chars[row][col]]); - - // force bottom bar on all underlined chars - if (m_attrs[row][col] & AT_UNDERLINE) - { - segdata |= 0x0008; - } - - output_set_indexed_value("vfd", (row*m_cols) + col, segdata); - - m_dirty[row][col] = 0; - } - } - } -} - -/* 2x40 VFD display used in the ESQ-1, VFX-SD, SD-1, and others */ - -static MACHINE_CONFIG_FRAGMENT(esq2x40) - MCFG_DEFAULT_LAYOUT(layout_esq2by40) -MACHINE_CONFIG_END - -machine_config_constructor esq2x40_t::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( esq2x40 ); -} - -void esq2x40_t::write_char(int data) -{ - // ESQ-1 sends (cursor move) 0xfa 0xYY to mark YY characters as underlined at the current cursor location - if (m_lastchar == 0xfa) - { - for (int i = 0; i < data; i++) - { - m_attrs[m_cursy][m_cursx + i] |= AT_UNDERLINE; - m_dirty[m_cursy][m_cursx + i] = 1; - } - - m_lastchar = 0; - update_display(); - return; - } - - m_lastchar = data; - - if ((data >= 0x80) && (data < 0xd0)) - { - m_cursy = ((data & 0x7f) >= 40) ? 1 : 0; - m_cursx = (data & 0x7f) % 40; - } - else if (data >= 0xd0) - { - switch (data) - { - case 0xd0: // blink start - m_curattr = AT_BLINK; - break; - - case 0xd1: // blink stop (cancel all attribs on VFX+) - m_curattr = 0; //&= ~AT_BLINK; - break; - - case 0xd3: // start underline - m_curattr |= AT_UNDERLINE; - break; - - case 0xd6: // clear screen - m_cursx = m_cursy = 0; - memset(m_chars, 0, sizeof(m_chars)); - memset(m_attrs, 0, sizeof(m_attrs)); - memset(m_dirty, 1, sizeof(m_dirty)); - break; - - case 0xf5: // save cursor position - m_savedx = m_cursx; - m_savedy = m_cursy; - break; - - case 0xf6: // restore cursor position - m_cursx = m_savedx; - m_cursy = m_savedy; - m_curattr = m_attrs[m_cursy][m_cursx]; - break; - - default: -// printf("Unknown control code %02x\n", data); - break; - } - } - else - { - if ((data >= 0x20) && (data <= 0x5f)) - { - m_chars[m_cursy][m_cursx] = data - ' '; - m_attrs[m_cursy][m_cursx] = m_curattr; - m_dirty[m_cursy][m_cursx] = 1; - m_cursx++; - - if (m_cursx >= 39) - { - m_cursx = 39; - } - } - } - - update_display(); -} - -esq2x40_t::esq2x40_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : esqvfd_t(mconfig, ESQ2x40, "Ensoniq 2x40 VFD", tag, owner, clock, "esq2x40", __FILE__) -{ - m_rows = 2; - m_cols = 40; -} - -/* 1x22 display from the VFX (not right, but it'll do for now) */ - -static MACHINE_CONFIG_FRAGMENT(esq1x22) - MCFG_DEFAULT_LAYOUT(layout_esq1by22) -MACHINE_CONFIG_END - -machine_config_constructor esq1x22_t::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( esq1x22 ); -} - -void esq1x22_t::write_char(int data) -{ - if (data >= 0x60) - { - switch (data) - { - case 'f': // clear screen - m_cursx = m_cursy = 0; - memset(m_chars, 0, sizeof(m_chars)); - memset(m_attrs, 0, sizeof(m_attrs)); - memset(m_dirty, 1, sizeof(m_dirty)); - break; - - default: - printf("Unhandled control code %02x\n", data); - break; - } - } - else - { - if ((data >= 0x20) && (data <= 0x5f)) - { - m_chars[0][m_cursx] = data - ' '; - m_dirty[0][m_cursx] = 1; - m_cursx++; - - if (m_cursx >= 23) - { - m_cursx = 23; - } - } - } - - update_display(); -} - -esq1x22_t::esq1x22_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : esqvfd_t(mconfig, ESQ1x22, "Ensoniq 1x22 VFD", tag, owner, clock, "esq1x22", __FILE__) -{ - m_rows = 1; - m_cols = 22; -} - -/* SQ-1 display, I think it's really an LCD but we'll deal with it for now */ -machine_config_constructor esq2x40_sq1_t::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( esq2x40 ); // we use the normal 2x40 layout -} - -void esq2x40_sq1_t::write_char(int data) -{ - if (data == 0x09) // musical note - { - data = '^'; // approximate for now - } - - if (m_Wait87Shift) - { - m_cursy = (data >> 4) & 0xf; - m_cursx = data & 0xf; - m_Wait87Shift = false; - } - else if (m_Wait88Shift) - { - m_Wait88Shift = false; - } - else if ((data >= 0x20) && (data <= 0x7f)) - { - m_chars[m_cursy][m_cursx] = data - ' '; - m_attrs[m_cursy][m_cursx] = m_curattr; - m_dirty[m_cursy][m_cursx] = 1; - m_cursx++; - - if (m_cursx >= 39) - { - m_cursx = 39; - } - - update_display(); - } - else if (data == 0x83) - { - m_cursx = m_cursy = 0; - memset(m_chars, 0, sizeof(m_chars)); - memset(m_attrs, 0, sizeof(m_attrs)); - memset(m_dirty, 1, sizeof(m_dirty)); - } - else if (data == 0x87) - { - m_Wait87Shift = true; - } - else if (data == 0x88) - { - m_Wait88Shift = true; - } - else - { -// printf("SQ-1 unhandled display char %02x\n", data); - } -} - -esq2x40_sq1_t::esq2x40_sq1_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : esqvfd_t(mconfig, ESQ2x40_SQ1, "Ensoniq 2x40 VFD (SQ-1 variant)", tag, owner, clock, "esq2x40_sq1", __FILE__) -{ - m_rows = 2; - m_cols = 40; - m_Wait87Shift = false; - m_Wait88Shift = false; -} diff --git a/src/mess/machine/esqvfd.h b/src/mess/machine/esqvfd.h deleted file mode 100644 index 8db9d054ab4..00000000000 --- a/src/mess/machine/esqvfd.h +++ /dev/null @@ -1,99 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -#ifndef ESQVFD_H -#define ESQVFD_H - -#include "emu.h" - -#define MCFG_ESQ1x22_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, ESQ1x22, 60) - -#define MCFG_ESQ1x22_REMOVE(_tag) \ - MCFG_DEVICE_REMOVE(_tag) - -#define MCFG_ESQ2x40_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, ESQ2x40, 60) - -#define MCFG_ESQ2x40_REMOVE(_tag) \ - MCFG_DEVICE_REMOVE(_tag) - -#define MCFG_ESQ2x40_SQ1_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, ESQ2x40_SQ1, 60) - -#define MCFG_ESQ2x40_SQ1_REMOVE(_tag) \ - MCFG_DEVICE_REMOVE(_tag) - -class esqvfd_t : public device_t { -public: - esqvfd_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - DECLARE_WRITE8_MEMBER( write ) { write_char(data); } - - virtual void write_char(int data) = 0; - virtual void update_display(); - - UINT32 conv_segments(UINT16 segin); - -protected: - static const UINT8 AT_NORMAL = 0x00; - static const UINT8 AT_BOLD = 0x01; - static const UINT8 AT_UNDERLINE = 0x02; - static const UINT8 AT_BLINK = 0x04; - static const UINT8 AT_BLINKED = 0x80; // set when character should be blinked off - - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - int m_cursx, m_cursy; - int m_savedx, m_savedy; - int m_rows, m_cols; - UINT8 m_curattr; - UINT8 m_lastchar; - UINT8 m_chars[2][40]; - UINT8 m_attrs[2][40]; - UINT8 m_dirty[2][40]; -}; - -class esq1x22_t : public esqvfd_t { -public: - esq1x22_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual void write_char(int data); - -protected: - virtual machine_config_constructor device_mconfig_additions() const; - -private: -}; - -class esq2x40_t : public esqvfd_t { -public: - esq2x40_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual void write_char(int data); - -protected: - virtual machine_config_constructor device_mconfig_additions() const; - -private: -}; - -class esq2x40_sq1_t : public esqvfd_t { -public: - esq2x40_sq1_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual void write_char(int data); - -protected: - virtual machine_config_constructor device_mconfig_additions() const; - -private: - bool m_Wait87Shift, m_Wait88Shift; -}; - -extern const device_type ESQ1x22; -extern const device_type ESQ2x40; -extern const device_type ESQ2x40_SQ1; - -#endif diff --git a/src/mess/machine/fm_scsi.c b/src/mess/machine/fm_scsi.c deleted file mode 100644 index a63795db0c2..00000000000 --- a/src/mess/machine/fm_scsi.c +++ /dev/null @@ -1,427 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/* - * - * Implementation of Fujitsu FMR-50, FMR-60 and FM-Towns SCSI hardware - * - * - - info from Toshiya Takeda's e-FMR50 source (the Towns uses the same controller?) - 0xc30 = Data register - 0xc32 = Status register (read) - bit 7 = REQ - bit 6 = I/O - bit 5 = MSG - bit 4 = C/D - bit 3 = BUSY - bit 1 = INT - bit 0 = PERR - 0xc32 = Control register (write) - bit 7 = WEN - bit 6 = IMSK - bit 4 = ATN - bit 2 = SEL - bit 1 = DMAE - bit 0 = RST -*/ -#include "emu.h" -#include "fm_scsi.h" -#include "debugger.h" - -/* - * Device config - */ - -const device_type FMSCSI = &device_creator; - -/* - * Device - */ - -fmscsi_device::fmscsi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : legacy_scsi_host_adapter(mconfig, FMSCSI, "FM-SCSI", tag, owner, clock, "fmscsi", __FILE__), - m_irq_handler(*this), - m_drq_handler(*this) -{ -} - -void fmscsi_device::device_start() -{ - m_input_lines = 0; - m_output_lines = 0; - m_data = 0; - m_command_index = 0; - m_last_id = 0; - m_target = 0; - m_phase = SCSI_PHASE_BUS_FREE; - - m_irq_handler.resolve_safe(); - m_drq_handler.resolve_safe(); - - // allocate read timer - m_transfer_timer = timer_alloc(TIMER_TRANSFER); - m_phase_timer = timer_alloc(TIMER_PHASE); -} - -void fmscsi_device::device_reset() -{ - m_input_lines = 0; - m_output_lines = 0; - m_data = 0; - m_command_index = 0; - m_last_id = 0; - m_target = 0; - m_result_length = 0; - m_result_index = 0; - stop_transfer(); - set_input_line(FMSCSI_LINE_INT,0); - m_irq_handler(0); - - m_phase = SCSI_PHASE_BUS_FREE; -} - -// get the length of a SCSI command based on it's command byte type -int fmscsi_device::get_scsi_cmd_len(UINT8 cbyte) -{ - int group; - - group = (cbyte>>5) & 7; - - if (group == 0) return 6; - if (group == 1 || group == 2) return 10; - if (group == 5) return 12; - - fatalerror("fmscsi: Unknown SCSI command group %d\n", group); - - // never executed - //return 6; -} - -void fmscsi_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_TRANSFER: - set_input_line(FMSCSI_LINE_REQ,1); - //logerror("FMSCSI: timer triggered: %i/%i\n",m_result_index,m_result_length); - if(m_output_lines & FMSCSI_LINE_DMAE) - { - m_drq_handler(1); - } - break; - case TIMER_PHASE: - set_phase(param); - break; - } -} - -void fmscsi_device::stop_transfer() -{ - m_transfer_timer->adjust(attotime::never); // stop timer - m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS); - if(m_output_lines & FMSCSI_LINE_DMAE) - { - m_drq_handler(0); - } - logerror("FMSCSI: Stopping transfer : (%i/%i)\n",m_result_index,m_result_length); -} - -UINT8 fmscsi_device::fmscsi_data_r(void) -{ - // read from data bus - // ACK is automatic on accessing the data bus, so REQ will go low. - set_input_line(FMSCSI_LINE_REQ,0); - - if(m_phase == SCSI_PHASE_DATAIN) - { - m_data = m_buffer[m_result_index % 512]; - //logerror("FMSCSI: DATAIN phase read data %02x\n",m_data); - m_result_index++; - if(m_result_index % 512 == 0) - read_data(m_buffer,512); // read next sector - - if(m_result_index >= m_result_length) - { - // end of data transfer - stop_transfer(); - } - return m_data; - } - - if(m_phase == SCSI_PHASE_MESSAGE_IN) - { - m_data = 0; // command complete message - m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_BUS_FREE); - m_command_index = 0; - return m_data; - } - - if(m_phase == SCSI_PHASE_STATUS) - { - m_data = get_status(); - // no command complete message? - m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_MESSAGE_IN); - m_command_index = 0; - //set_input_line(FMSCSI_LINE_REQ,1); // raise REQ yet again - return m_data; - } - - return m_data; -} - -void fmscsi_device::fmscsi_data_w(UINT8 data) -{ - int phase; - - // write to data bus - m_data = data; - //logerror("FMSCSI: data write %02x\n",data); - - // ACK is automatic on accessing the data bus, so REQ will go low. - set_input_line(FMSCSI_LINE_REQ,0); - - if(m_phase == SCSI_PHASE_BUS_FREE) - { - // select target - switch(data & 0x7f) - { - case 0x01: m_target = 0; break; - case 0x02: m_target = 1; break; - case 0x04: m_target = 2; break; - case 0x08: m_target = 3; break; - case 0x10: m_target = 4; break; - } - } - if(m_phase == SCSI_PHASE_DATAOUT) - { - m_buffer[m_result_index % 512] = m_data; - m_result_index++; - if(m_result_index % 512 == 0) - write_data(m_buffer,512); // write buffer to disc - if(m_result_index >= m_result_length) - { - // end of data transfer - m_transfer_timer->adjust(attotime::never); // stop timer - m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS); - if(m_output_lines & FMSCSI_LINE_DMAE) - { - m_drq_handler(0); - } - logerror("FMSCSI: Stopping transfer : (%i/%i)\n",m_result_index,m_result_length); - } - } - if(m_phase == SCSI_PHASE_COMMAND) - { - m_command[m_command_index] = data; - logerror("FMSCSI: writing command byte %02x [%i]\n",data,m_command_index); - m_command_index++; - if(m_command_index >= get_scsi_cmd_len(m_command[0])) - { - // command complete - send_command(m_command,m_command_index); - m_result_length = get_length(); - phase = legacy_scsi_host_adapter::get_phase(); - m_phase_timer->adjust(attotime::from_usec(800),phase); - - logerror("FMSCSI: Command %02x sent, result length = %i\n",m_command[0],m_result_length); - } - else - { - m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_COMMAND); - } - } - if(m_phase == SCSI_PHASE_MESSAGE_OUT) - { - m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_STATUS); - } -} - -void fmscsi_device::set_phase(int phase) -{ - m_phase = phase; - logerror("FMSCSI: phase set to %i\n",m_phase); - // set input lines accordingly - switch(phase) - { - case SCSI_PHASE_BUS_FREE: - set_input_line(FMSCSI_LINE_BSY,0); - set_input_line(FMSCSI_LINE_CD,0); - set_input_line(FMSCSI_LINE_MSG,0); - set_input_line(FMSCSI_LINE_IO,0); - //set_input_line(FMSCSI_LINE_REQ,0); - break; - case SCSI_PHASE_COMMAND: - set_input_line(FMSCSI_LINE_BSY,1); - set_input_line(FMSCSI_LINE_CD,1); - set_input_line(FMSCSI_LINE_MSG,0); - set_input_line(FMSCSI_LINE_IO,0); - set_input_line(FMSCSI_LINE_REQ,1); - break; - case SCSI_PHASE_STATUS: - set_input_line(FMSCSI_LINE_CD,1); - set_input_line(FMSCSI_LINE_MSG,0); - set_input_line(FMSCSI_LINE_IO,1); - set_input_line(FMSCSI_LINE_REQ,1); - break; - case SCSI_PHASE_DATAIN: - set_input_line(FMSCSI_LINE_CD,0); - set_input_line(FMSCSI_LINE_MSG,0); - set_input_line(FMSCSI_LINE_IO,1); - set_input_line(FMSCSI_LINE_REQ,1); - // start transfer timer - m_transfer_timer->adjust(attotime::zero,0,attotime::from_hz(3000000)); // arbitrary value for now - read_data(m_buffer,512); - m_result_index = 0; - logerror("FMSCSI: Starting transfer in (%i)\n",m_result_length); - break; - case SCSI_PHASE_DATAOUT: - set_input_line(FMSCSI_LINE_CD,0); - set_input_line(FMSCSI_LINE_MSG,0); - set_input_line(FMSCSI_LINE_IO,0); - set_input_line(FMSCSI_LINE_REQ,1); - // start transfer timer - m_transfer_timer->adjust(attotime::zero,0,attotime::from_hz(3000000)); // arbitrary value for now - m_result_index = 0; - logerror("FMSCSI: Starting transfer out (%i)\n",m_result_length); - break; - case SCSI_PHASE_MESSAGE_IN: - set_input_line(FMSCSI_LINE_CD,1); - set_input_line(FMSCSI_LINE_MSG,1); - set_input_line(FMSCSI_LINE_IO,1); - set_input_line(FMSCSI_LINE_REQ,1); - break; - case SCSI_PHASE_MESSAGE_OUT: - set_input_line(FMSCSI_LINE_CD,1); - set_input_line(FMSCSI_LINE_MSG,1); - set_input_line(FMSCSI_LINE_IO,0); - set_input_line(FMSCSI_LINE_REQ,1); - break; - } -} - -int fmscsi_device::get_phase(void) -{ - return m_phase; -} - -void fmscsi_device::set_input_line(UINT8 line, UINT8 state) -{ - if(line == FMSCSI_LINE_REQ) - { - if(state != 0 && !(m_input_lines & FMSCSI_LINE_REQ)) // low to high - { - if(m_output_lines & FMSCSI_LINE_IMSK && m_phase != SCSI_PHASE_DATAIN && m_phase != SCSI_PHASE_DATAOUT) - { - set_input_line(FMSCSI_LINE_INT,1); - m_irq_handler(1); - logerror("FMSCSI: IRQ high\n"); - } - } - if(state == 0 && (m_input_lines & FMSCSI_LINE_REQ)) // high to low - { - if(m_output_lines & FMSCSI_LINE_IMSK && m_phase != SCSI_PHASE_DATAIN && m_phase != SCSI_PHASE_DATAOUT) - { - set_input_line(FMSCSI_LINE_INT,0); - m_irq_handler(0); - logerror("FMSCSI: IRQ low\n"); - } - } - } - if(state != 0) - m_input_lines |= line; - else - m_input_lines &= ~line; -// logerror("FMSCSI: input line %02x set to %i\n",line,state); -} - -UINT8 fmscsi_device::get_input_line(UINT8 line) -{ - return m_input_lines & line; -} - -void fmscsi_device::set_output_line(UINT8 line, UINT8 state) -{ - if(line == FMSCSI_LINE_RST && state != 0) - { - device_reset(); - logerror("FMSCSI: reset\n"); - } - - if(line == FMSCSI_LINE_SEL) - { - if(state != 0 && !(m_output_lines & FMSCSI_LINE_SEL)) // low to high transition - { - if (select(m_target)) - { - m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_COMMAND); - m_data = 0x08; - } - } - } - - if(line == FMSCSI_LINE_ATN) - { - if(state != 0) - m_phase_timer->adjust(attotime::from_usec(800),SCSI_PHASE_MESSAGE_OUT); - } - - if(state != 0) - m_output_lines |= line; - else - m_output_lines &= ~line; -// logerror("FMSCSI: output line %02x set to %i\n",line,state); -} - -UINT8 fmscsi_device::get_output_line(UINT8 line) -{ - return m_output_lines & line; -} - -UINT8 fmscsi_device::fmscsi_status_r(void) -{ - // status inputs - return m_input_lines; -} - -void fmscsi_device::fmscsi_control_w(UINT8 data) -{ - // control outputs - set_output_line(FMSCSI_LINE_RST,data & FMSCSI_LINE_RST); - set_output_line(FMSCSI_LINE_DMAE,data & FMSCSI_LINE_DMAE); - set_output_line(FMSCSI_LINE_IMSK,data & FMSCSI_LINE_IMSK); - set_output_line(FMSCSI_LINE_ATN,data & FMSCSI_LINE_ATN); - set_output_line(FMSCSI_LINE_WEN,data & FMSCSI_LINE_WEN); - set_output_line(FMSCSI_LINE_SEL,data & FMSCSI_LINE_SEL); - logerror("FMSCSI: control write %02x\n",data); -} - -READ8_MEMBER( fmscsi_device::fmscsi_r ) -{ - switch(offset & 0x03) - { - case 0x00: - return fmscsi_data_r(); - case 0x01: - return fmscsi_status_r(); - case 0x02: - return 0x80; // Linux uses this port to detect the ability to do word transfers. We'll tell it that it doesn't for now. - default: - logerror("FMSCSI: Unknown read at offset %i\n",offset); - } - return 0; -} - -WRITE8_MEMBER( fmscsi_device::fmscsi_w ) -{ - switch(offset & 0x03) - { - case 0x00: - fmscsi_data_w(data); - break; - case 0x01: - fmscsi_control_w(data); - break; - default: - logerror("FMSCSI: Unknown write 0x%02x at offset %i\n",data,offset); - } -} diff --git a/src/mess/machine/fm_scsi.h b/src/mess/machine/fm_scsi.h deleted file mode 100644 index 12ca5ded55d..00000000000 --- a/src/mess/machine/fm_scsi.h +++ /dev/null @@ -1,103 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/* - * fm_scsi.h - * - * SCSI controller used in Fujitsu FMR-50, FMR-60, and FM-Towns - * - */ - -#ifndef FM_SCSI_H_ -#define FM_SCSI_H_ - -#include "machine/legscsi.h" - -// SCSI input lines (from target) -#define FMSCSI_LINE_REQ 0x80 -#define FMSCSI_LINE_IO 0x40 -#define FMSCSI_LINE_MSG 0x20 -#define FMSCSI_LINE_CD 0x10 -#define FMSCSI_LINE_BSY 0x08 -#define FMSCSI_LINE_EX 0x04 -#define FMSCSI_LINE_INT 0x02 -#define FMSCSI_LINE_PERR 0x01 - -// SCSI output lines (to target) -#define FMSCSI_LINE_WEN 0x80 -#define FMSCSI_LINE_IMSK 0x40 -#define FMSCSI_LINE_RMSK 0x20 -#define FMSCSI_LINE_ATN 0x10 -#define FMSCSI_LINE_WRD 0x08 -#define FMSCSI_LINE_SEL 0x04 -#define FMSCSI_LINE_DMAE 0x02 -#define FMSCSI_LINE_RST 0x01 - -#define MCFG_FMSCSI_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, FMSCSI, 0) - -#define MCFG_FMSCSI_IRQ_HANDLER(_devcb) \ - devcb = &fmscsi_device::set_irq_handler(*device, DEVCB_##_devcb); -#define MCFG_FMSCSI_DRQ_HANDLER(_devcb) \ - devcb = &fmscsi_device::set_drq_handler(*device, DEVCB_##_devcb); - -class fmscsi_device : public legacy_scsi_host_adapter -{ -public: - // construction/destruction - fmscsi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // static configuration helpers - template static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast(device).m_irq_handler.set_callback(object); } - template static devcb_base &set_drq_handler(device_t &device, _Object object) { return downcast(device).m_drq_handler.set_callback(object); } - - // any publically accessible interfaces needed for runtime - UINT8 fmscsi_data_r(void); - void fmscsi_data_w(UINT8 data); - UINT8 fmscsi_status_r(void); - void fmscsi_control_w(UINT8 data); - DECLARE_READ8_MEMBER( fmscsi_r ); - DECLARE_WRITE8_MEMBER( fmscsi_w ); - - void set_phase(int phase); - int get_phase(void); - void set_input_line(UINT8 line, UINT8 state); - UINT8 get_input_line(UINT8 line); - void set_output_line(UINT8 line, UINT8 state); - UINT8 get_output_line(UINT8 line); - -protected: - // device-level overrides (none are required, but these are common) - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - // internal device state goes here - static const device_timer_id TIMER_TRANSFER = 0; - static const device_timer_id TIMER_PHASE = 1; - - int get_scsi_cmd_len(UINT8 cbyte); - void stop_transfer(); - - devcb_write_line m_irq_handler; - devcb_write_line m_drq_handler; - - UINT8 m_command[32]; - //UINT8 m_result[32]; - UINT8 m_command_index; - int m_result_length; - UINT32 m_result_index; - UINT8 m_input_lines; - UINT8 m_output_lines; - UINT8 m_data; - UINT8 m_last_id; - UINT8 m_phase; - UINT8 m_target; - UINT8 m_buffer[512]; - emu_timer* m_transfer_timer; - emu_timer* m_phase_timer; -}; - -extern const device_type FMSCSI; - -#endif /* FM_SCSI_H_ */ diff --git a/src/mess/machine/galaxy.c b/src/mess/machine/galaxy.c deleted file mode 100644 index 2356a193b7e..00000000000 --- a/src/mess/machine/galaxy.c +++ /dev/null @@ -1,211 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha, Miodrag Milanovic -/*************************************************************************** - - machine.c - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - -***************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "includes/galaxy.h" - -/*************************************************************************** - I/O devices -***************************************************************************/ - -READ8_MEMBER(galaxy_state::galaxy_keyboard_r) -{ - if (offset == 0) - { - double level = m_cassette->input(); - return (level > 0) ? 0xfe : 0xff; - } - else - { - return m_io_ports[(offset>>3) & 0x07]->read() & (0x01<<(offset & 0x07)) ? 0xfe : 0xff; - } -} - -WRITE8_MEMBER(galaxy_state::galaxy_latch_w) -{ - double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000; - m_latch_value = data; - m_cassette->output(val); -} - - - -/*************************************************************************** - Interrupts -***************************************************************************/ - -INTERRUPT_GEN_MEMBER(galaxy_state::galaxy_interrupt) -{ - device.execute().set_input_line(0, HOLD_LINE); -} - -IRQ_CALLBACK_MEMBER(galaxy_state::galaxy_irq_callback) -{ - galaxy_set_timer(); - m_interrupts_enabled = TRUE; - return 0xff; -} - -/*************************************************************************** - Snapshot files (GAL) -***************************************************************************/ - -#define GALAXY_SNAPSHOT_V1_SIZE 8268 -#define GALAXY_SNAPSHOT_V2_SIZE 8244 - -void galaxy_state::galaxy_setup_snapshot (const UINT8 * data, UINT32 size) -{ - switch (size) - { - case GALAXY_SNAPSHOT_V1_SIZE: - m_maincpu->set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); - m_maincpu->set_state_int(Z80_BC, data[0x04] | data[0x05] << 8); - m_maincpu->set_state_int(Z80_DE, data[0x08] | data[0x09] << 8); - m_maincpu->set_state_int(Z80_HL, data[0x0c] | data[0x0d] << 8); - m_maincpu->set_state_int(Z80_IX, data[0x10] | data[0x11] << 8); - m_maincpu->set_state_int(Z80_IY, data[0x14] | data[0x15] << 8); - m_maincpu->set_state_int(Z80_PC, data[0x18] | data[0x19] << 8); - m_maincpu->set_state_int(Z80_SP, data[0x1c] | data[0x1d] << 8); - m_maincpu->set_state_int(Z80_AF2, data[0x20] | data[0x21] << 8); - m_maincpu->set_state_int(Z80_BC2, data[0x24] | data[0x25] << 8); - m_maincpu->set_state_int(Z80_DE2, data[0x28] | data[0x29] << 8); - m_maincpu->set_state_int(Z80_HL2, data[0x2c] | data[0x2d] << 8); - m_maincpu->set_state_int(Z80_IFF1, data[0x30]); - m_maincpu->set_state_int(Z80_IFF2, data[0x34]); - m_maincpu->set_state_int(Z80_HALT, data[0x38]); - m_maincpu->set_state_int(Z80_IM, data[0x3c]); - m_maincpu->set_state_int(Z80_I, data[0x40]); - m_maincpu->set_state_int(Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80)); - - memcpy (m_ram->pointer(), data + 0x084c, (m_ram->size() < 0x1800) ? m_ram->size() : 0x1800); - - break; - case GALAXY_SNAPSHOT_V2_SIZE: - m_maincpu->set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); - m_maincpu->set_state_int(Z80_BC, data[0x02] | data[0x03] << 8); - m_maincpu->set_state_int(Z80_DE, data[0x04] | data[0x05] << 8); - m_maincpu->set_state_int(Z80_HL, data[0x06] | data[0x07] << 8); - m_maincpu->set_state_int(Z80_IX, data[0x08] | data[0x09] << 8); - m_maincpu->set_state_int(Z80_IY, data[0x0a] | data[0x0b] << 8); - m_maincpu->set_state_int(Z80_PC, data[0x0c] | data[0x0d] << 8); - m_maincpu->set_state_int(Z80_SP, data[0x0e] | data[0x0f] << 8); - m_maincpu->set_state_int(Z80_AF2, data[0x10] | data[0x11] << 8); - m_maincpu->set_state_int(Z80_BC2, data[0x12] | data[0x13] << 8); - m_maincpu->set_state_int(Z80_DE2, data[0x14] | data[0x15] << 8); - m_maincpu->set_state_int(Z80_HL2, data[0x16] | data[0x17] << 8); - - m_maincpu->set_state_int(Z80_IFF1, data[0x18] & 0x01); - m_maincpu->set_state_int(Z80_IFF2, (UINT64)0); - - m_maincpu->set_state_int(Z80_HALT, (UINT64)0); - - m_maincpu->set_state_int(Z80_IM, (data[0x18] >> 1) & 0x03); - - m_maincpu->set_state_int(Z80_I, data[0x19]); - m_maincpu->set_state_int(Z80_R, data[0x1a]); - - memcpy (m_ram->pointer(), data + 0x0834, (m_ram->size() < 0x1800) ? m_ram->size() : 0x1800); - - break; - } - - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); -} - -SNAPSHOT_LOAD_MEMBER( galaxy_state, galaxy ) -{ - UINT8* snapshot_data; - - switch (snapshot_size) - { - case GALAXY_SNAPSHOT_V1_SIZE: - case GALAXY_SNAPSHOT_V2_SIZE: - snapshot_data = auto_alloc_array(machine(), UINT8, snapshot_size); - break; - default: - return IMAGE_INIT_FAIL; - } - - image.fread( snapshot_data, snapshot_size); - - galaxy_setup_snapshot(snapshot_data, snapshot_size); - - return IMAGE_INIT_PASS; -} - - -/*************************************************************************** - Driver Initialization -***************************************************************************/ - -DRIVER_INIT_MEMBER(galaxy_state,galaxy) -{ - static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; - - address_space &space = m_maincpu->space(AS_PROGRAM); - space.install_readwrite_bank( 0x2800, 0x2800 + m_ram->size() - 1, "bank1"); - membank("bank1")->set_base(m_ram->pointer()); - - if (m_ram->size() < (6 + 48) * 1024) - { - space.nop_readwrite( 0x2800 + m_ram->size(), 0xffff); - } - - for ( int i = 0; i < 8; i++ ) - { - m_io_ports[i] = ioport( keynames[i] ); - } -} - -/*************************************************************************** - Machine Initialization -***************************************************************************/ - -MACHINE_RESET_MEMBER(galaxy_state,galaxy) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - /* ROM 2 enable/disable */ - if (ioport("ROM2")->read()) { - space.install_read_bank(0x1000, 0x1fff, "bank10"); - } else { - space.nop_read(0x1000, 0x1fff); - } - space.nop_write(0x1000, 0x1fff); - - if (ioport("ROM2")->read()) - membank("bank10")->set_base(memregion("maincpu")->base() + 0x1000); - - m_interrupts_enabled = TRUE; -} - -DRIVER_INIT_MEMBER(galaxy_state,galaxyp) -{ - DRIVER_INIT_CALL(galaxy); -} - -MACHINE_RESET_MEMBER(galaxy_state,galaxyp) -{ - UINT8 *ROM = memregion("maincpu")->base(); - address_space &space = m_maincpu->space(AS_PROGRAM); - - ROM[0x0037] = 0x29; - ROM[0x03f9] = 0xcd; - ROM[0x03fa] = 0x00; - ROM[0x03fb] = 0xe0; - - space.install_read_bank(0xe000, 0xefff, "bank11"); - space.nop_write(0xe000, 0xefff); - membank("bank11")->set_base(memregion("maincpu")->base() + 0xe000); - m_interrupts_enabled = TRUE; -} diff --git a/src/mess/machine/gamecom.c b/src/mess/machine/gamecom.c deleted file mode 100644 index 148a0585928..00000000000 --- a/src/mess/machine/gamecom.c +++ /dev/null @@ -1,629 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Robbbert - -#include "includes/gamecom.h" - - - -static const int gamecom_timer_limit[8] = { 2, 1024, 2048, 4096, 8192, 16384, 32768, 65536 }; - -TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_clock_timer_callback) -{ - UINT8 val = m_p_ram[SM8521_CLKT] + 1; - m_p_ram[SM8521_CLKT] = ( m_p_ram[SM8521_CLKT] & 0xC0 ) | (val & 0x3f); - m_maincpu->set_input_line(sm8500_cpu_device::CK_INT, ASSERT_LINE ); -} - -void gamecom_state::machine_reset() -{ - UINT8 *rom = m_region_kernel->base(); - m_bank1->set_base(rom); - m_bank2->set_base(rom); - m_bank3->set_base(rom); - m_bank4->set_base(rom); - - m_cart_ptr = NULL; - m_lch_reg = 0x07; - m_lcv_reg = 0x27; - m_lcdc_reg = 0xb0; - - std::string region_tag; - m_cart1_rom = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - m_cart2_rom = memregion(region_tag.assign(m_cart2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); -} - -void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data) -{ - if (data < 0x20) - { - /* select internal ROM bank */ - switch (mmu) - { - case 1: m_bank1->set_base(m_region_kernel->base() + (data << 13)); break; - case 2: m_bank2->set_base(m_region_kernel->base() + (data << 13)); break; - case 3: m_bank3->set_base(m_region_kernel->base() + (data << 13)); break; - case 4: m_bank4->set_base(m_region_kernel->base() + (data << 13)); break; - } - } - else - { - /* select cartridge bank */ - if (m_cart_ptr) - { - switch (mmu) - { - case 1: m_bank1->set_base(m_cart_ptr + (data << 13)); break; - case 2: m_bank2->set_base(m_cart_ptr + (data << 13)); break; - case 3: m_bank3->set_base(m_cart_ptr + (data << 13)); break; - case 4: m_bank4->set_base(m_cart_ptr + (data << 13)); break; - } - } - } -} - -void gamecom_state::handle_stylus_press( int column ) -{ - UINT16 data = m_io_grid[column]->read(); - if (data) - { - UINT16 stylus_y = data ^ 0x3ff; - m_p_ram[SM8521_P0] = stylus_y; - m_p_ram[SM8521_P1] = ( m_p_ram[SM8521_P1] & 0xFC ) | ( stylus_y >> 8 ); - } - else - { - m_p_ram[SM8521_P0] = 0xFF; - m_p_ram[SM8521_P1] |= 3; - } -} - -void gamecom_state::handle_input_press(UINT16 mux_data) -{ - switch( mux_data ) - { - case 0xFFFB: - /* column #0 */ - /* P0 bit 0 cleared => 01 */ - /* P0 bit 1 cleared => 0E */ - /* P0 bit 2 cleared => 1B */ - /* P0 bit 3 cleared => etc */ - /* P0 bit 4 cleared => */ - /* P0 bit 5 cleared => */ - /* P0 bit 6 cleared => */ - /* P0 bit 7 cleared => */ - /* P1 bit 0 cleared => */ - /* P1 bit 1 cleared => */ - handle_stylus_press(0); - break; - case 0xFFF7: /* column #1 */ - handle_stylus_press(1); - break; - case 0xFFEF: /* column #2 */ - handle_stylus_press(2); - break; - case 0xFFDF: /* column #3 */ - handle_stylus_press(3); - break; - case 0xFFBF: /* column #4 */ - handle_stylus_press(4); - break; - case 0xFF7F: /* column #5 */ - handle_stylus_press(5); - break; - case 0xFEFF: /* column #6 */ - handle_stylus_press(6); - break; - case 0xFDFF: /* column #7 */ - handle_stylus_press(7); - break; - case 0xFBFF: /* column #8 */ - handle_stylus_press(8); - break; - case 0xF7FF: /* column #9 */ - handle_stylus_press(9); - break; - case 0xEFFF: /* column #10 */ - handle_stylus_press(10); - break; - case 0xDFFF: /* column #11 */ - handle_stylus_press(11); - break; - case 0xBFFF: /* column #12 */ - handle_stylus_press(12); - break; - case 0x7FFF: /* keys #1 */ - /* P0 bit 0 cleared => 83 (up) */ - /* P0 bit 1 cleared => 84 (down) */ - /* P0 bit 2 cleared => 85 (left) */ - /* P0 bit 3 cleared => 86 (right) */ - /* P0 bit 4 cleared => 87 (menu) */ - /* P0 bit 5 cleared => 8A (pause) */ - /* P0 bit 6 cleared => 89 (sound) */ - /* P0 bit 7 cleared => 8B (button A) */ - /* P1 bit 0 cleared => 8C (button B) */ - /* P1 bit 1 cleared => 8D (button C) */ - m_p_ram[SM8521_P0] = m_io_in0->read(); - m_p_ram[SM8521_P1] = (m_p_ram[SM8521_P1] & 0xFC) | ( m_io_in1->read() & 3 ); - break; - case 0xFFFF: /* keys #2 */ - /* P0 bit 0 cleared => 88 (power) */ - /* P0 bit 1 cleared => 8E (button D) */ - /* P0 bit 2 cleared => A0 */ - /* P0 bit 3 cleared => A0 */ - /* P0 bit 4 cleared => A0 */ - /* P0 bit 5 cleared => A0 */ - /* P0 bit 6 cleared => A0 */ - /* P0 bit 7 cleared => A0 */ - /* P1 bit 0 cleared => A0 */ - /* P1 bit 1 cleared => A0 */ - m_p_ram[SM8521_P0] = (m_p_ram[SM8521_P0] & 0xFC) | ( m_io_in2->read() & 3 ); - m_p_ram[SM8521_P1] = 0xFF; - break; - } -} - -WRITE8_MEMBER( gamecom_state::gamecom_pio_w ) -{ - offset += 0x14; - m_p_ram[offset] = data; - switch (offset) - { - case SM8521_P1: - case SM8521_P2: - handle_input_press(m_p_ram[SM8521_P1] | (m_p_ram[SM8521_P2] << 8)); - break; - case SM8521_P3: - /* P3 bit7 clear, bit6 set -> enable cartridge port #0? */ - /* P3 bit6 clear, bit7 set -> enable cartridge port #1? */ - switch (data & 0xc0) - { - case 0x40: m_cart_ptr = m_cart1_rom->base(); break; - case 0x80: m_cart_ptr = m_cart2_rom->base(); break; - default: m_cart_ptr = NULL; break; - } - return; - } -} - -READ8_MEMBER( gamecom_state::gamecom_pio_r ) -{ - return m_p_ram[offset + 0x14]; -} - -READ8_MEMBER( gamecom_state::gamecom_internal_r ) -{ -// ToDo: Read from vblank bit -// if(SM8521_LCV == offset + 0x20) -// popmessage("Read from vblank bit, TODO"); - - return m_p_ram[offset + 0x20]; -} - -/* TODO: preliminary, proper formula not yet understood (and manual doesn't help much either) */ -void gamecom_state::recompute_lcd_params() -{ - int vblank_period,hblank_period; - int H_timing,V_timing; - int pixel_clock; - attoseconds_t refresh; - - if(m_lch_reg != 7) - popmessage("LCH = %02x!",m_lch_reg); - - if((m_lcdc_reg & 0xf) != 0) - popmessage("LCDC = %02x!",m_lcdc_reg); - - if(m_lcv_reg != 0x27) - popmessage("LCV = %02x!",m_lcv_reg); - - H_timing = ((m_lch_reg & 0x1f) + 1) * 200/4; - V_timing = (m_lcv_reg & 0x1f); - pixel_clock = (XTAL_11_0592MHz / 2); // TODO: divisor actually settable - - rectangle visarea(0, 200-1, 0, 160-1); // TODO: check settings - - vblank_period = (V_timing + 160); - hblank_period = (H_timing + 200); - - refresh = HZ_TO_ATTOSECONDS(pixel_clock) * (hblank_period) * vblank_period; - machine().first_screen()->configure((hblank_period), (vblank_period), visarea, refresh ); -} - -WRITE8_MEMBER( gamecom_state::gamecom_internal_w ) -{ - offset += 0x20; - switch( offset ) - { - case SM8521_MMU0: /* disable bootstrap ROM? most likely not written to on game.com */ - logerror( "Write to MMU0\n" ); - break; - case SM8521_MMU1: - gamecom_set_mmu(1, data); - break; - case SM8521_MMU2: - gamecom_set_mmu(2, data); - break; - case SM8521_MMU3: - gamecom_set_mmu(3, data); - break; - case SM8521_MMU4: - gamecom_set_mmu(4, data); - break; - - /* Video hardware and DMA */ - case SM8521_DMBR: - data &= 0x7f; - break; - case SM8521_TM0D: - m_timer[0].check_value = data; - return; - case SM8521_TM0C: - m_timer[0].enabled = data & 0x80; - m_timer[0].state_limit = gamecom_timer_limit[data & 0x07] >> 1; - m_timer[0].state_count = 0; - m_p_ram[SM8521_TM0D] = 0; - break; - case SM8521_TM1D: - m_timer[1].check_value = data; - return; - case SM8521_TM1C: - m_timer[1].enabled = data & 0x80; - m_timer[1].state_limit = gamecom_timer_limit[data & 0x07] >> 1; - m_timer[1].state_count = 0; - m_p_ram[SM8521_TM1D] = 0; - break; - case SM8521_CLKT: /* bit 6-7 */ - if ( data & 0x80 ) - { - /* timer run */ - if ( data & 0x40 ) - { - /* timer resolution 1 minute */ - m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(60)); - } - else - { - /* TImer resolution 1 second */ - m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); - } - } - else - { - /* disable timer reset */ - m_clock_timer->enable( 0 ); - data &= 0xC0; - } - break; - - case SM8521_LCDC: - m_lcdc_reg = data; - recompute_lcd_params(); - break; - - case SM8521_LCH: - /* - --x- ---- Horizontal DOT size (160 / 200) - ---x xxxx H-Timing bits - */ - m_lch_reg = data; - recompute_lcd_params(); - break; - - case SM8521_LCV: - /* - x--- ---- V-blank bit (R) - -xx- ---- V-line size bits (100 / 160 / 200 / undef) - ---x xxxx V-Blank width bits - */ - m_lcv_reg = data; - recompute_lcd_params(); - break; - - /* Sound */ - case SM8521_SGC: - /* - x--- ---- enable sound output - ---- x--- enable DAC - ---- -x-- enable SG2 - ---- --x- enable SG1 - ---- ---x enable SG0 - */ - m_sound.sgc = data; - break; - case SM8521_SG0L: - m_sound.sg0l = data; - break; - case SM8521_SG1L: - m_sound.sg1l = data; - break; - case SM8521_SG0TH: - m_sound.sg0t = ( m_sound.sg0t & 0xFF ) | ( data << 8 ); - break; - case SM8521_SG0TL: - m_sound.sg0t = ( m_sound.sg0t & 0xFF00 ) | data; - break; - case SM8521_SG1TH: - m_sound.sg1t = ( m_sound.sg1t & 0xFF ) | ( data << 8 ); - break; - case SM8521_SG1TL: - m_sound.sg1t = ( m_sound.sg1t & 0xFF00 ) | data; - break; - case SM8521_SG2L: - m_sound.sg2l = data; - break; - case SM8521_SG2TH: - m_sound.sg2t = ( m_sound.sg2t & 0xFF ) | ( data << 8 ); - break; - case SM8521_SG2TL: - m_sound.sg2t = ( m_sound.sg2t & 0xFF00 ) | data; - break; - case SM8521_SGDA: - m_sound.sgda = data; - if((m_sound.sgc & 0x88) == 0x88) - m_dac->write_unsigned8(data); - break; - - case SM8521_SG0W0: - case SM8521_SG0W1: - case SM8521_SG0W2: - case SM8521_SG0W3: - case SM8521_SG0W4: - case SM8521_SG0W5: - case SM8521_SG0W6: - case SM8521_SG0W7: - case SM8521_SG0W8: - case SM8521_SG0W9: - case SM8521_SG0W10: - case SM8521_SG0W11: - case SM8521_SG0W12: - case SM8521_SG0W13: - case SM8521_SG0W14: - case SM8521_SG0W15: - m_sound.sg0w[offset - SM8521_SG0W0] = data; - break; - case SM8521_SG1W0: - case SM8521_SG1W1: - case SM8521_SG1W2: - case SM8521_SG1W3: - case SM8521_SG1W4: - case SM8521_SG1W5: - case SM8521_SG1W6: - case SM8521_SG1W7: - case SM8521_SG1W8: - case SM8521_SG1W9: - case SM8521_SG1W10: - case SM8521_SG1W11: - case SM8521_SG1W12: - case SM8521_SG1W13: - case SM8521_SG1W14: - case SM8521_SG1W15: - m_sound.sg1w[offset - SM8521_SG1W0] = data; - break; - - /* Reserved addresses */ - case SM8521_18: case SM8521_1B: - case SM8521_29: case SM8521_2A: case SM8521_2F: - case SM8521_33: case SM8521_3E: case SM8521_3F: - case SM8521_41: case SM8521_43: case SM8521_45: case SM8521_4B: - case SM8521_4F: - case SM8521_55: case SM8521_56: case SM8521_57: case SM8521_58: - case SM8521_59: case SM8521_5A: case SM8521_5B: case SM8521_5C: - case SM8521_5D: - logerror( "%X: Write to reserved address (0x%02X). Value written: 0x%02X\n", m_maincpu->pc(), offset, data ); - break; - } - m_p_ram[offset] = data; -} - - -/* The manual is not conclusive as to which bit of the DMVP register (offset 0x3D) determines - which page for source or destination is used */ -WRITE8_MEMBER( gamecom_state::gamecom_handle_dma ) -{ - UINT8 dmc = m_p_ram[SM8521_DMC]; - m_dma.overwrite_mode = dmc & 0x01; - m_dma.transfer_mode = dmc & 0x06; - m_dma.decrement_x = dmc & 0x08; - m_dma.decrement_y = dmc & 0x10; - m_dma.enabled = dmc & 0x80; - if ( !m_dma.enabled ) - { - return; - } - - m_dma.width_x = m_p_ram[SM8521_DMDX]; - m_dma.width_x_count = 0; - m_dma.width_y = m_p_ram[SM8521_DMDY]; - m_dma.width_y_count = 0; - m_dma.source_x = m_p_ram[SM8521_DMX1]; - m_dma.source_x_current = m_dma.source_x; - m_dma.source_y = m_p_ram[SM8521_DMY1]; - m_dma.source_width = ( m_p_ram[SM8521_LCH] & 0x20 ) ? 50 : 40; - m_dma.dest_x = m_p_ram[SM8521_DMX2]; - m_dma.dest_x_current = m_dma.dest_x; - m_dma.dest_y = m_p_ram[SM8521_DMY2]; - m_dma.dest_width = ( m_p_ram[SM8521_LCH] & 0x20 ) ? 50 : 40; - m_dma.palette[0] = m_p_ram[SM8521_DMPL] & 0x03; - m_dma.palette[1] = ( m_p_ram[SM8521_DMPL] >> 2 ) & 3; - m_dma.palette[2] = ( m_p_ram[SM8521_DMPL] >> 4 ) & 3; - m_dma.palette[3] = m_p_ram[SM8521_DMPL] >> 6; - m_dma.source_mask = 0x1FFF; - m_dma.dest_mask = 0x1FFF; -// logerror("DMA: width %Xx%X, source (%X,%X), dest (%X,%X), transfer_mode %X, banks %X \n", m_dma.width_x, m_dma.width_y, m_dma.source_x, m_dma.source_y, m_dma.dest_x, m_dma.dest_y, m_dma.transfer_mode, m_p_ram[SM8521_DMVP] ); -// logerror( " Palette: %d, %d, %d, %d\n", m_dma.palette[0], m_dma.palette[1], m_dma.palette[2], m_dma.palette[3] ); - switch( m_dma.transfer_mode ) - { - case 0x00: - /* VRAM->VRAM */ - m_dma.source_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; - m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; - break; - case 0x02: - /* ROM->VRAM */ -// logerror( "DMA DMBR = %X\n", m_p_ram[SM8521_DMBR] ); - m_dma.source_width = 64; - m_dma.source_mask = 0x3FFF; - if (m_p_ram[SM8521_DMBR] < 16) - m_dma.source_bank = m_region_kernel->base() + (m_p_ram[SM8521_DMBR] << 14); - else - if (m_cart_ptr) - m_dma.source_bank = m_cart_ptr + (m_p_ram[SM8521_DMBR] << 14); - - m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; - break; - case 0x04: - /* Extend RAM->VRAM */ - m_dma.source_width = 64; - m_dma.source_bank = &m_p_nvram[0x0000]; - m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; - break; - case 0x06: - /* VRAM->Extend RAM */ - m_dma.source_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; - m_dma.dest_width = 64; - m_dma.dest_bank = &m_p_nvram[0x0000]; - break; - } - m_dma.source_current = m_dma.source_width * m_dma.source_y; - m_dma.source_current += m_dma.source_x >> 2; - m_dma.dest_current = m_dma.dest_width * m_dma.dest_y; - m_dma.dest_current += m_dma.dest_x >> 2; - m_dma.source_line = m_dma.source_current; - m_dma.dest_line = m_dma.dest_current; - m_dma.state_count = 0; - - unsigned y_count, x_count; - - for( y_count = 0; y_count <= m_dma.width_y; y_count++ ) - { - for( x_count = 0; x_count <= m_dma.width_x; x_count++ ) - { - UINT16 src_addr = m_dma.source_current & m_dma.source_mask; - UINT16 dest_addr = m_dma.dest_current & m_dma.dest_mask; - UINT8 dest_adj = (3 - (m_dma.dest_x_current & 3)) << 1; - UINT8 src_adj = (3 - (m_dma.source_x_current & 3)) << 1; - - /* handle DMA for 1 pixel */ - // Get new pixel - UINT8 source_pixel = (m_dma.source_bank[src_addr] >> src_adj) & 3; - - // If overwrite mode, write new pixel - if ( m_dma.overwrite_mode || source_pixel) - { - // Get 4 pixels and remove the one about to be replaced - UINT8 other_pixels = m_dma.dest_bank[dest_addr] & ~(3 << dest_adj); - // Get palette of new pixel and place into the hole - m_dma.dest_bank[dest_addr] = other_pixels | (m_dma.palette[ source_pixel ] << dest_adj); - } - - /* Advance a pixel */ - if ( m_dma.decrement_x ) - { - m_dma.source_x_current--; - if ( ( m_dma.source_x_current & 0x03 ) == 0x03 ) - m_dma.source_current--; - } - else - { - m_dma.source_x_current++; - if ( ( m_dma.source_x_current & 0x03 ) == 0x00 ) - m_dma.source_current++; - } - m_dma.dest_x_current++; - if ( ( m_dma.dest_x_current & 0x03 ) == 0x00 ) - m_dma.dest_current++; - } - - /* Advance a line */ - m_dma.source_x_current = m_dma.source_x; - m_dma.dest_x_current = m_dma.dest_x; - if ( m_dma.decrement_y ) - m_dma.source_line -= m_dma.source_width; - else - m_dma.source_line += m_dma.source_width; - m_dma.source_current = m_dma.source_line; - m_dma.dest_line += m_dma.dest_width; - m_dma.dest_current = m_dma.dest_line; - } - m_dma.enabled = 0; - m_maincpu->set_input_line(sm8500_cpu_device::DMA_INT, ASSERT_LINE ); -} - -WRITE8_MEMBER( gamecom_state::gamecom_update_timers ) -{ - if ( m_timer[0].enabled ) - { - m_timer[0].state_count += data; - while ( m_timer[0].state_count >= m_timer[0].state_limit ) - { - m_timer[0].state_count -= m_timer[0].state_limit; - m_p_ram[SM8521_TM0D]++; - if ( m_p_ram[SM8521_TM0D] >= m_timer[0].check_value ) - { - m_p_ram[SM8521_TM0D] = 0; - m_maincpu->set_input_line(sm8500_cpu_device::TIM0_INT, ASSERT_LINE ); - } - } - } - if ( m_timer[1].enabled ) - { - m_timer[1].state_count += data; - while ( m_timer[1].state_count >= m_timer[1].state_limit ) - { - m_timer[1].state_count -= m_timer[1].state_limit; - m_p_ram[SM8521_TM1D]++; - if ( m_p_ram[SM8521_TM1D] >= m_timer[1].check_value ) - { - m_p_ram[SM8521_TM1D] = 0; - m_maincpu->set_input_line(sm8500_cpu_device::TIM1_INT, ASSERT_LINE ); - } - } - } -} - -DRIVER_INIT_MEMBER(gamecom_state,gamecom) -{ - m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_clock_timer_callback),this)); - m_p_ram = m_region_maincpu->base(); // required here because pio_w gets called before machine_reset -} - -int gamecom_state::common_load(device_image_interface &image, generic_slot_device *slot) -{ - UINT32 size = slot->common_get_size("rom"); - UINT32 load_offset = 0; - - if (size != 0x008000 && size != 0x040000 && size != 0x080000 - && size != 0x100000 && size != 0x1c0000 && size != 0x200000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - if (size == 0x1c0000) - load_offset = 0x40000; - - // in order to simplify banked access from the driver, we always allocate 0x200000, - slot->rom_alloc(0x200000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - // we load what we have - slot->common_load_rom(slot->get_rom_base() + load_offset, size, "rom"); - // and then we mirror the content, instead of masking out larger accesses - UINT8 *crt = slot->get_rom_base(); - if (size < 0x010000) { memcpy(crt + 0x008000, crt, 0x008000); } /* ->64KB */ - if (size < 0x020000) { memcpy(crt + 0x010000, crt, 0x010000); } /* ->128KB */ - if (size < 0x040000) { memcpy(crt + 0x020000, crt, 0x020000); } /* ->256KB */ - if (size < 0x080000) { memcpy(crt + 0x040000, crt, 0x040000); } /* ->512KB */ - if (size < 0x100000) { memcpy(crt + 0x080000, crt, 0x080000); } /* ->1MB */ - if (size < 0x1c0000) { memcpy(crt + 0x100000, crt, 0x100000); } /* -> >=1.8MB */ - - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 ) -{ - return common_load(image, m_cart1); -} - -DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 ) -{ - return common_load(image, m_cart2); -} diff --git a/src/mess/machine/gamepock.c b/src/mess/machine/gamepock.c deleted file mode 100644 index ecc94d723d5..00000000000 --- a/src/mess/machine/gamepock.c +++ /dev/null @@ -1,224 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#include "emu.h" -#include "sound/speaker.h" -#include "cpu/upd7810/upd7810.h" -#include "includes/gamepock.h" - - -void gamepock_state::hd44102ch_w( int which, int c_d, UINT8 data ) -{ - if ( c_d ) - { - UINT8 y; - /* Data */ - m_hd44102ch[which].ram[ m_hd44102ch[which].address ] = data; - - /* Increment/decrement Y counter */ - y = ( m_hd44102ch[which].address & 0x3F ) + m_hd44102ch[which].y_inc; - if ( y == 0xFF ) - { - y = 49; - } - if ( y == 50 ) - { - y = 0; - } - m_hd44102ch[which].address = ( m_hd44102ch[which].address & 0xC0 ) | y; - } - else - { - /* Command */ - switch ( data ) - { - case 0x38: /* Display off */ - m_hd44102ch[which].enabled = 0; - break; - case 0x39: /* Display on */ - m_hd44102ch[which].enabled = 1; - break; - case 0x3A: /* Y decrement mode */ - m_hd44102ch[which].y_inc = 0xFF; - break; - case 0x3B: /* Y increment mode */ - m_hd44102ch[which].y_inc = 0x01; - break; - case 0x3E: /* Display start page #0 */ - case 0x7E: /* Display start page #1 */ - case 0xBE: /* Display start page #2 */ - case 0xFE: /* Display start page #3 */ - m_hd44102ch[which].start_page = data & 0xC0; - break; - default: - if ( ( data & 0x3F ) < 50 ) - { - m_hd44102ch[which].address = data; - } - break; - } - } -} - - -void gamepock_state::hd44102ch_init( int which ) -{ - memset( &m_hd44102ch[which], 0, sizeof( HD44102CH ) ); - m_hd44102ch[which].y_inc = 0x01; -} - - -void gamepock_state::lcd_update() -{ - /* Check whether HD44102CH #1 is enabled */ - if ( m_port_a & 0x08 ) - { - hd44102ch_w( 0, m_port_a & 0x04, m_port_b ); - } - - /* Check whether HD44102CH #2 is enabled */ - if ( m_port_a & 0x10 ) - { - hd44102ch_w( 1, m_port_a & 0x04, m_port_b ); - } - - /* Check whether HD44102CH #3 is enabled */ - if ( m_port_a & 0x20 ) - { - hd44102ch_w( 2, m_port_a & 0x04, m_port_b ); - } -} - - -WRITE8_MEMBER( gamepock_state::port_a_w ) -{ - UINT8 old_port_a = m_port_a; - - m_port_a = data; - - if ( ! ( old_port_a & 0x02 ) && ( m_port_a & 0x02 ) ) - { - lcd_update(); - } -} - - -WRITE8_MEMBER( gamepock_state::port_b_w ) -{ - m_port_b = data; -} - - -READ8_MEMBER( gamepock_state::port_b_r ) -{ - logerror("gamepock_port_b_r: not implemented\n"); - return 0xFF; -} - - -READ8_MEMBER( gamepock_state::port_c_r ) -{ - UINT8 data = 0xFF; - - if ( m_port_a & 0x80 ) - { - data &= ioport("IN0")->read(); - } - - if ( m_port_a & 0x40 ) - { - data &= ioport("IN1")->read(); - } - - return data; -} - - -void gamepock_state::machine_reset() -{ - hd44102ch_init( 0 ); - hd44102ch_init( 1 ); - hd44102ch_init( 2 ); - - if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000,0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); - -} - -UINT32 gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 ad; - int i,j; - - /* Handle HD44102CH #0 */ - ad = m_hd44102ch[0].start_page; - for ( i = 0; i < 4; i++ ) - { - for ( j = 0; j < 50; j++ ) - { - bitmap.pix16(i * 8 + 0, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x80 ) ? 0 : 1; - } - ad += 0x40; - } - - /* Handle HD44102CH #1 */ - ad = m_hd44102ch[1].start_page; - for ( i = 4; i < 8; i++ ) - { - for ( j = 0; j < 50; j++ ) - { - bitmap.pix16(i * 8 + 0, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x80 ) ? 0 : 1; - } - ad += 0x40; - } - - /* Handle HD44102CH #2 */ - ad = m_hd44102ch[2].start_page; - for ( i = 0; i < 4; i++ ) - { - for ( j = 0; j < 25; j++ ) - { - bitmap.pix16(i * 8 + 0, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; - } - for ( j = 25; j < 50; j++ ) - { - bitmap.pix16(32 + i * 8 + 0, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 1, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 2, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 3, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 4, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 5, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 6, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 7, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; - } - ad += 0x40; - } - - return 0; -} - -/* This is called whenever the T0 pin switches state */ -WRITE_LINE_MEMBER(gamepock_state::gamepock_to_w) -{ - m_speaker->level_w(state & 1); -} diff --git a/src/mess/machine/gb.c b/src/mess/machine/gb.c deleted file mode 100644 index 187cea04d72..00000000000 --- a/src/mess/machine/gb.c +++ /dev/null @@ -1,757 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - gb.c - - Machine file to handle emulation of the Nintendo Game Boy. - -Cardridge port pinouts: -Pin Name Description -1 VCC +5 VDC -2 PHI CPU clock ? -3 /WR Write -4 /RD Read -5 /CS SRAM select -6 A0 Address 0 -7 A1 Address 1 -8 A2 Address 2 -9 A3 Address 3 -10 A4 Address 4 -11 A5 Address 5 -12 A6 Address 6 -13 A7 Address 7 -14 A8 Address 8 -15 A9 Address 9 -16 A10 Address 10 -17 A11 Address 11 -18 A12 Address 12 -19 A13 Address 13 -20 A14 Address 14 -21 A15 Address 15 -22 D0 Data 0 -23 D1 Data 1 -24 D2 Data 2 -25 D3 Data 3 -26 D4 Data 4 -27 D5 Data 5 -28 D6 Data 6 -29 D7 Data 7 -30 /RST Reset -31 AUDIOIN Never used ? -32 GND Ground - - -TODO: -- YongYong mapper: - - During start there are 2 writes to 5000 and 5003, it is still unknown what these do. -- Story of La Sa Ma mapper: - - This should display the Gowin logo on boot on both DMG and CGB (Not implemented yet) -- ATV Racing/Rocket Games mapper: - - How did this overlay the official Nintendo logo at BIOS check time? (Some Sachen titles use a similar trick) - - - Changes: - - 13/2/2002 AK - MBC2 and MBC3 support and added NVRAM support. - 23/2/2002 AK - MBC5 support, and MBC2 RAM support. - 13/3/2002 AK - Tidied up the MBC code, window layer now has it's - own palette. Tidied init code. - 15/3/2002 AK - More init code tidying with a slight hack to stop - sound when the machine starts. - 19/3/2002 AK - Changed NVRAM code to the new battery_* functions. - 24/3/2002 AK - Added MBC1 mode switching, and partial MBC3 RTC support. - 28/3/2002 AK - Improved LCD status timing and interrupts. - Free memory when we shutdown instead of leaking. - 31/3/2002 AK - Handle IO memory reading so we return 0xFF for registers - that are unsupported. - 7/4/2002 AK - Free memory from battery load/save. General tidying. - 13/4/2002 AK - Ok, don't free memory when we shutdown as that causes - a crash on reset. - 28/4/2002 AK - General code tidying. - Fixed MBC3's RAM/RTC banking. - Added support for games with more than 128 ROM banks. - 12/6/2002 AK - Rewrote the way bg and sprite palettes are handled. - The window layer no longer has it's own palette. - Added Super Game Boy support. - 13/6/2002 AK - Added Game Boy Color support. - - 17/5/2004 WP - Added Megaduck/Cougar Boy support. - 13/6/2005 WP - Added support for bootstrap rom banking. - -***************************************************************************/ -#define __MACHINE_GB_C - -#include "emu.h" -#include "includes/gb.h" - - -/* RAM layout defines */ -#define CGB_START_VRAM_BANKS 0x0000 -#define CGB_START_RAM_BANKS ( 2 * 8 * 1024 ) - -#define JOYPAD m_gb_io[0x00] /* Joystick: 1.1.P15.P14.P13.P12.P11.P10 */ -#define SIODATA m_gb_io[0x01] /* Serial IO data buffer */ -#define SIOCONT m_gb_io[0x02] /* Serial IO control register */ -#define DIVREG m_gb_io[0x04] /* Divider register (???) */ -#define TIMECNT m_gb_io[0x05] /* Timer counter. Gen. int. when it overflows */ -#define TIMEMOD m_gb_io[0x06] /* New value of TimeCount after it overflows */ -#define TIMEFRQ m_gb_io[0x07] /* Timer frequency and start/stop switch */ - - - -/* - Prototypes -*/ - - -#ifdef MAME_DEBUG -/* #define V_GENERAL*/ /* Display general debug information */ -/* #define V_BANK*/ /* Display bank switching debug information */ -#endif - -//------------------------- -// handle save state -//------------------------- - -void gb_state::save_gb_base() -{ - save_item(NAME(m_gb_io)); - save_item(NAME(m_divcount)); - save_item(NAME(m_shift)); - save_item(NAME(m_shift_cycles)); - save_item(NAME(m_triggering_irq)); - save_item(NAME(m_reloading)); - save_item(NAME(m_sio_count)); - save_item(NAME(m_bios_disable)); - if (m_cartslot) - m_cartslot->save_ram(); -} - -void gb_state::save_gbc_only() -{ - save_item(NAME(m_gbc_rambank)); -} - -void gb_state::save_sgb_only() -{ - save_item(NAME(m_sgb_packets)); - save_item(NAME(m_sgb_bitcount)); - save_item(NAME(m_sgb_bytecount)); - save_item(NAME(m_sgb_start)); - save_item(NAME(m_sgb_rest)); - save_item(NAME(m_sgb_controller_no)); - save_item(NAME(m_sgb_controller_mode)); - save_item(NAME(m_sgb_data)); -} - - -void gb_state::gb_init_regs() -{ - /* Initialize the registers */ - SIODATA = 0x00; - SIOCONT = 0x7E; - - gb_io_w(m_maincpu->space(AS_PROGRAM), 0x05, 0x00); /* TIMECNT */ - gb_io_w(m_maincpu->space(AS_PROGRAM), 0x06, 0x00); /* TIMEMOD */ -} - - -void gb_state::gb_init() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - m_custom->sound_w(space, 0x16, 0x00); /* Initialize sound hardware */ - - m_divcount = 0; - m_triggering_irq = 0; - m_gb_io[0x07] = 0xF8; /* Upper bits of TIMEFRQ register are set to 1 */ -} - - -void gb_state::machine_start() -{ - /* Allocate the serial timer, and disable it */ - m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); - m_gb_serial_timer->enable( 0 ); - - save_gb_base(); -} - -MACHINE_START_MEMBER(gb_state,gbc) -{ - /* Allocate the serial timer, and disable it */ - m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); - m_gb_serial_timer->enable( 0 ); - - for (int i = 0; i < 8; i++) - m_gbc_rammap[i] = m_ram->pointer() + CGB_START_RAM_BANKS + i * 0x1000; - - save_gb_base(); - save_gbc_only(); -} - - -MACHINE_START_MEMBER(gb_state,sgb) -{ - m_sgb_packets = -1; - - /* Allocate the serial timer, and disable it */ - m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); - m_gb_serial_timer->enable( 0 ); - - save_gb_base(); - save_sgb_only(); - - if (m_cartslot && m_cartslot->get_sgb_hack()) { - dynamic_cast(m_lcd.target())->set_sgb_hack(TRUE); - } -} - -void gb_state::machine_reset() -{ - gb_init(); - - /* Enable BIOS rom */ - m_bios_disable = 0; - - m_divcount = 0x0004; -} - -MACHINE_RESET_MEMBER(gb_state,gbc) -{ - gb_init(); - - gb_init_regs(); - - /* Enable BIOS rom */ - m_bios_disable = 0; - - for (int i = 0; i < 8; i++) - memset(m_gbc_rammap[i], 0, 0x1000); -} - -MACHINE_RESET_MEMBER(gb_state,sgb) -{ - gb_init(); - - gb_init_regs(); - - /* Enable BIOS rom */ - m_bios_disable = 0; - - m_divcount = 0x0004; -} - - -WRITE8_MEMBER(gb_state::gb_io_w) -{ - static const UINT8 timer_shifts[4] = {10, 4, 6, 8}; - - switch (offset) - { - case 0x00: /* JOYP - Joypad */ - JOYPAD = 0xCF | data; - if (!(data & 0x20)) - JOYPAD &= (m_inputs->read() >> 4) | 0xF0; - if (!(data & 0x10)) - JOYPAD &= m_inputs->read() | 0xF0; - return; - case 0x01: /* SB - Serial transfer data */ - break; - case 0x02: /* SC - SIO control */ - switch( data & 0x81 ) - { - case 0x00: - case 0x01: - case 0x80: /* enabled & external clock */ - m_sio_count = 0; - break; - case 0x81: /* enabled & internal clock */ - SIODATA = 0xFF; - m_sio_count = 8; - m_gb_serial_timer->adjust(m_maincpu->cycles_to_attotime(512), 0, m_maincpu->cycles_to_attotime(512)); - m_gb_serial_timer->enable( 1 ); - break; - } - break; - case 0x04: /* DIV - Divider register */ - /* Force increment of TIMECNT register */ - if ( m_divcount >= 16 ) - gb_timer_increment(); - m_divcount = 0; - return; - case 0x05: /* TIMA - Timer counter */ - /* Check if the counter is being reloaded in this cycle */ - if ( m_reloading && ( m_divcount & ( m_shift_cycles - 1 ) ) == 4 ) - { - data = TIMECNT; - } - break; - case 0x06: /* TMA - Timer module */ - /* Check if the counter is being reloaded in this cycle */ - if ( m_reloading && ( m_divcount & ( m_shift_cycles - 1 ) ) == 4 ) - { - TIMECNT = data; - } - break; - case 0x07: /* TAC - Timer control */ - data |= 0xF8; - /* Check if timer is just disabled or the timer frequency is changing */ - if ( ( ! ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) ) || ( ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) && ( data & 0x03 ) != ( TIMEFRQ & 0x03 ) ) ) - { - /* Check if TIMECNT should be incremented */ - if ( ( m_divcount & ( m_shift_cycles - 1 ) ) >= ( m_shift_cycles >> 1 ) ) - { - gb_timer_increment(); - } - } - m_shift = timer_shifts[data & 0x03]; - m_shift_cycles = 1 << m_shift; - break; - case 0x0F: /* IF - Interrupt flag */ - data &= 0x1F; - m_maincpu->set_if( data ); - break; - } - - m_gb_io[offset] = data; -} - -WRITE8_MEMBER(gb_state::gb_io2_w) -{ - if (offset == 0x10) - { - /* disable BIOS ROM */ - m_bios_disable = 1; - //printf("here again?\n"); - } - else - m_lcd->video_w(space, offset, data); -} - -#ifdef MAME_DEBUG -static const char *const sgbcmds[32] = -{ - "PAL01 ", - "PAL23 ", - "PAL03 ", - "PAL12 ", - "ATTR_BLK", - "ATTR_LIN", - "ATTR_DIV", - "ATTR_CHR", - "SOUND ", - "SOU_TRN ", - "PAL_SET ", - "PAL_TRN ", - "ATRC_EN ", - "TEST_EN ", - "ICON_EN ", - "DATA_SND", - "DATA_TRN", - "MLT_REG ", - "JUMP ", - "CHR_TRN ", - "PCT_TRN ", - "ATTR_TRN", - "ATTR_SET", - "MASK_EN ", - "OBJ_TRN ", - "????????", - "????????", - "????????", - "????????", - "????????", - "????????", - "????????" -}; -#endif - -WRITE8_MEMBER(gb_state::sgb_io_w) -{ - UINT8 *sgb_data = m_sgb_data; - - switch( offset ) - { - case 0x00: - switch (data & 0x30) - { - case 0x00: /* start condition */ - if (m_sgb_start) - logerror("SGB: Start condition before end of transfer ??\n"); - m_sgb_bitcount = 0; - m_sgb_start = 1; - m_sgb_rest = 0; - JOYPAD = 0x0F & ((m_inputs->read() >> 4) | m_inputs->read() | 0xF0); - break; - case 0x10: /* data true */ - if (m_sgb_rest) - { - /* We should test for this case , but the code below won't - work with the current setup */ -#if 0 - if (m_sgb_bytecount == 16) - { - logerror("SGB: end of block is not zero!"); - m_sgb_start = 0; - } -#endif - sgb_data[m_sgb_bytecount] >>= 1; - sgb_data[m_sgb_bytecount] |= 0x80; - m_sgb_bitcount++; - if (m_sgb_bitcount == 8) - { - m_sgb_bitcount = 0; - m_sgb_bytecount++; - } - m_sgb_rest = 0; - } - JOYPAD = 0x1F & ((m_inputs->read() >> 4) | 0xF0); - break; - case 0x20: /* data false */ - if (m_sgb_rest) - { - if( m_sgb_bytecount == 16 && m_sgb_packets == -1 ) - { -#ifdef MAME_DEBUG - logerror("SGB: %s (%02X) pkts: %d data: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", - sgbcmds[sgb_data[0] >> 3],sgb_data[0] >> 3, sgb_data[0] & 0x07, sgb_data[1], sgb_data[2], sgb_data[3], - sgb_data[4], sgb_data[5], sgb_data[6], sgb_data[7], - sgb_data[8], sgb_data[9], sgb_data[10], sgb_data[11], - sgb_data[12], sgb_data[13], sgb_data[14], sgb_data[15]); -#endif - m_sgb_packets = sgb_data[0] & 0x07; - m_sgb_start = 0; - } - if (m_sgb_bytecount == (m_sgb_packets << 4)) - { - switch (sgb_data[0] >> 3) - { - case 0x11: /* MLT_REQ - Multi controller request */ - if (sgb_data[1] == 0x00) - m_sgb_controller_mode = 0; - else if (sgb_data[1] == 0x01) - m_sgb_controller_mode = 2; - break; - default: - dynamic_cast(m_lcd.target())->sgb_io_write_pal(sgb_data[0] >> 3, &sgb_data[0]); - break; - } - m_sgb_start = 0; - m_sgb_bytecount = 0; - m_sgb_packets = -1; - } - if( m_sgb_start ) - { - sgb_data[m_sgb_bytecount] >>= 1; - m_sgb_bitcount++; - if (m_sgb_bitcount == 8) - { - m_sgb_bitcount = 0; - m_sgb_bytecount++; - } - } - m_sgb_rest = 0; - } - JOYPAD = 0x2F & (m_inputs->read() | 0xF0); - break; - case 0x30: /* rest condition */ - if (m_sgb_start) - m_sgb_rest = 1; - if (m_sgb_controller_mode) - { - m_sgb_controller_no++; - if (m_sgb_controller_no == m_sgb_controller_mode) - m_sgb_controller_no = 0; - JOYPAD = 0x3F - m_sgb_controller_no; - } - else - JOYPAD = 0x3F; - - /* Hack to let cartridge know it's running on an SGB */ - if ( (sgb_data[0] >> 3) == 0x1F ) - JOYPAD = 0x3E; - break; - } - return; - default: - /* we didn't handle the write, so pass it to the GB handler */ - gb_io_w( space, offset, data ); - return; - } - - m_gb_io[offset] = data; -} - -/* Interrupt Enable register */ -READ8_MEMBER(gb_state::gb_ie_r) -{ - return m_maincpu->get_ie(); -} - -WRITE8_MEMBER(gb_state::gb_ie_w) -{ - m_maincpu->set_ie( data & 0x1F ); -} - -/* IO read */ -READ8_MEMBER(gb_state::gb_io_r) -{ - switch(offset) - { - case 0x04: - return ( m_divcount >> 8 ) & 0xFF; - case 0x00: - case 0x01: - case 0x02: - case 0x03: - case 0x05: - case 0x06: - case 0x07: - return m_gb_io[offset]; - case 0x0F: - /* Make sure the internal states are up to date */ - return 0xE0 | m_maincpu->get_if(); - default: - /* It seems unsupported registers return 0xFF */ - return 0xFF; - } -} - - -TIMER_CALLBACK_MEMBER(gb_state::gb_serial_timer_proc) -{ - /* Shift in a received bit */ - SIODATA = (SIODATA << 1) | 0x01; - /* Decrement number of handled bits */ - m_sio_count--; - /* If all bits done, stop timer and trigger interrupt */ - if ( ! m_sio_count ) - { - SIOCONT &= 0x7F; - m_gb_serial_timer->enable( 0 ); - m_maincpu->set_input_line(SIO_INT, ASSERT_LINE); - } -} - -void gb_state::gb_timer_check_irq() -{ - m_reloading = 0; - if ( m_triggering_irq ) - { - m_triggering_irq = 0; - if ( TIMECNT == 0 ) - { - TIMECNT = TIMEMOD; - m_maincpu->set_input_line(TIM_INT, ASSERT_LINE); - m_reloading = 1; - } - } -} - -void gb_state::gb_timer_increment() -{ - gb_timer_check_irq(); - - TIMECNT += 1; - if ( TIMECNT == 0 ) - { - m_triggering_irq = 1; - } -} - -WRITE8_MEMBER( gb_state::gb_timer_callback ) -{ - UINT16 old_gb_divcount = m_divcount; - m_divcount += data; - - gb_timer_check_irq(); - - if ( TIMEFRQ & 0x04 ) - { - UINT16 old_count = old_gb_divcount >> m_shift; - UINT16 new_count = m_divcount >> m_shift; - if ( data > m_shift_cycles ) - { - gb_timer_increment(); - old_count++; - } - if ( new_count != old_count ) - { - gb_timer_increment(); - } - if ( new_count << m_shift < m_divcount ) - { - gb_timer_check_irq(); - } - } -} - -WRITE8_MEMBER(gb_state::gbc_io2_w) -{ - switch( offset ) - { - case 0x0D: /* KEY1 - Prepare speed switch */ - m_maincpu->set_speed(data); - return; - case 0x10: /* BFF - Bios disable */ - m_bios_disable = 1; - return; - case 0x16: /* RP - Infrared port */ - break; - case 0x30: /* SVBK - RAM bank select */ - m_gbc_rambank = data & 0x7; - if (!m_gbc_rambank) - m_gbc_rambank = 1; - m_rambank->set_base(m_gbc_rammap[m_gbc_rambank]); - break; - default: - break; - } - m_lcd->video_w(space, offset, data); -} - -READ8_MEMBER(gb_state::gbc_io2_r) -{ - switch( offset ) - { - case 0x0D: /* KEY1 */ - return m_maincpu->get_speed(); - case 0x16: /* RP - Infrared port */ - break; - case 0x30: /* SVBK - RAM bank select */ - return m_gbc_rambank; - default: - break; - } - return m_lcd->video_r(space, offset); -} - -/**************************************************************************** - - Megaduck routines - - ****************************************************************************/ - -MACHINE_START_MEMBER(megaduck_state,megaduck) -{ - /* Allocate the serial timer, and disable it */ - m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); - m_gb_serial_timer->enable( 0 ); - - save_gb_base(); -} - -MACHINE_RESET_MEMBER(megaduck_state,megaduck) -{ - /* We may have to add some more stuff here, if not then it can be merged back into gb */ - gb_init(); - - m_bios_disable = 1; -} - -/* - Map megaduck video related area on to regular Game Boy video area - - Different locations of the video registers: - Register Game Boy MegaDuck - LCDC FF40 FF10 (See different bit order below) - STAT FF41 FF11 - SCY FF42 FF12 - SCX FF43 FF13 - LY FF44 FF18 - LYC FF45 FF19 - DMA FF46 FF1A - BGP FF47 FF1B - OBP0 FF48 FF14 - OBP1 FF49 FF15 - WY FF4A FF16 - WX FF4B FF17 - Unused FF4C FF4C (?) - Unused FF4D FF4D (?) - Unused FF4E FF4E (?) - Unused FF4F FF4F (?) - - Different LCDC register - - Game Boy MegaDuck - 0 6 - BG & Window Display : 0 - Off, 1 - On - 1 0 - OBJ Display: 0 - Off, 1 - On - 2 1 - OBJ Size: 0 - 8x8, 1 - 8x16 - 3 2 - BG Tile Map Display: 0 - 9800, 1 - 9C00 - 4 4 - BG & Window Tile Data Select: 0 - 8800, 1 - 8000 - 5 5 - Window Display: 0 - Off, 1 - On - 6 3 - Window Tile Map Display Select: 0 - 9800, 1 - 9C00 - 7 7 - LCD Operation - - **************/ - -READ8_MEMBER(megaduck_state::megaduck_video_r) -{ - UINT8 data; - - if ((offset & 0x0C) && ((offset & 0x0C) ^ 0x0C)) - { - offset ^= 0x0C; - } - data = m_lcd->video_r(space, offset); - if ( offset ) - return data; - return BITSWAP8(data,7,0,5,4,6,3,2,1); -} - -WRITE8_MEMBER(megaduck_state::megaduck_video_w) -{ - if (!offset) - { - data = BITSWAP8(data,7,3,5,4,2,1,0,6); - } - if ((offset & 0x0C) && ((offset & 0x0C) ^ 0x0C)) - { - offset ^= 0x0C; - } - m_lcd->video_w(space, offset, data); -} - -/* Map megaduck audio offset to game boy audio offsets */ - -static const UINT8 megaduck_sound_offsets[16] = { 0, 2, 1, 3, 4, 6, 5, 7, 8, 9, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; - -WRITE8_MEMBER(megaduck_state::megaduck_sound_w1) -{ - m_custom->sound_w(space, megaduck_sound_offsets[offset], data); -} - -READ8_MEMBER(megaduck_state::megaduck_sound_r1) -{ - return m_custom->sound_r(space, megaduck_sound_offsets[offset]); -} - -WRITE8_MEMBER(megaduck_state::megaduck_sound_w2) -{ - switch(offset) - { - case 0x00: m_custom->sound_w(space, 0x10, data); break; - case 0x01: m_custom->sound_w(space, 0x12, data); break; - case 0x02: m_custom->sound_w(space, 0x11, data); break; - case 0x03: m_custom->sound_w(space, 0x13, data); break; - case 0x04: m_custom->sound_w(space, 0x14, data); break; - case 0x05: m_custom->sound_w(space, 0x16, data); break; - case 0x06: m_custom->sound_w(space, 0x15, data); break; - case 0x07: - case 0x08: - case 0x09: - case 0x0A: - case 0x0B: - case 0x0C: - case 0x0D: - case 0x0E: - case 0x0F: - break; - } -} - -READ8_MEMBER(megaduck_state::megaduck_sound_r2) -{ - return m_custom->sound_r(space, 0x10 + megaduck_sound_offsets[offset]); -} diff --git a/src/mess/machine/genpc.c b/src/mess/machine/genpc.c deleted file mode 100644 index 44dbcd00d20..00000000000 --- a/src/mess/machine/genpc.c +++ /dev/null @@ -1,954 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Miodrag Milanovic -/*************************************************************************** - - machine/genpc.c - - -***************************************************************************/ - -#include "emu.h" -#include "includes/genpc.h" - -#include "machine/i8255.h" -#include "machine/pic8259.h" -#include "machine/pit8253.h" -#include "sound/speaker.h" -#include "machine/ram.h" -#include "imagedev/cassette.h" - -#define VERBOSE_PIO 0 /* PIO (keyboard controller) */ - -#define PIO_LOG(N,M,A) \ - do { \ - if(VERBOSE_PIO>=N) \ - { \ - if( M ) \ - logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - - -/************************************************************************* - * - * PC DMA stuff - * - *************************************************************************/ - -READ8_MEMBER( ibm5160_mb_device::pc_page_r) -{ - return 0xff; -} - - -WRITE8_MEMBER( ibm5160_mb_device::pc_page_w) -{ - switch(offset % 4) - { - case 1: - m_dma_offset[2] = data; - break; - case 2: - m_dma_offset[3] = data; - break; - case 3: - m_dma_offset[0] = m_dma_offset[1] = data; - break; - } -} - - -WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dma_hrq_changed ) -{ - m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE); - - /* Assert HLDA */ - m_dma8237->hack_w(state); -} - - -READ8_MEMBER( ibm5160_mb_device::pc_dma_read_byte ) -{ - if(m_dma_channel == -1) - return 0xff; - address_space &spaceio = m_maincpu->space(AS_PROGRAM); - offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0x0F0000; - return spaceio.read_byte( page_offset + offset); -} - - -WRITE8_MEMBER( ibm5160_mb_device::pc_dma_write_byte ) -{ - if(m_dma_channel == -1) - return; - address_space &spaceio = m_maincpu->space(AS_PROGRAM); - offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0x0F0000; - - spaceio.write_byte( page_offset + offset, data); -} - - -READ8_MEMBER( ibm5160_mb_device::pc_dma8237_1_dack_r ) -{ - return m_isabus->dack_r(1); -} - -READ8_MEMBER( ibm5160_mb_device::pc_dma8237_2_dack_r ) -{ - return m_isabus->dack_r(2); -} - - -READ8_MEMBER( ibm5160_mb_device::pc_dma8237_3_dack_r ) -{ - return m_isabus->dack_r(3); -} - - -WRITE8_MEMBER( ibm5160_mb_device::pc_dma8237_1_dack_w ) -{ - m_isabus->dack_w(1,data); -} - -WRITE8_MEMBER( ibm5160_mb_device::pc_dma8237_2_dack_w ) -{ - m_isabus->dack_w(2,data); -} - - -WRITE8_MEMBER( ibm5160_mb_device::pc_dma8237_3_dack_w ) -{ - m_isabus->dack_w(3,data); -} - - -WRITE8_MEMBER( ibm5160_mb_device::pc_dma8237_0_dack_w ) -{ - m_u73_q2 = 0; - m_dma8237->dreq0_w( m_u73_q2 ); -} - - -WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dma8237_out_eop ) -{ - m_cur_eop = state == ASSERT_LINE; - if(m_dma_channel != -1 && m_cur_eop) - m_isabus->eop_w(m_dma_channel, m_cur_eop ? ASSERT_LINE : CLEAR_LINE ); -} - -void ibm5160_mb_device::pc_select_dma_channel(int channel, bool state) -{ - if(!state) { - m_dma_channel = channel; - if(m_cur_eop) - m_isabus->eop_w(channel, ASSERT_LINE ); - - } else if(m_dma_channel == channel) { - m_dma_channel = -1; - if(m_cur_eop) - m_isabus->eop_w(channel, CLEAR_LINE ); - } -} - -WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dack0_w ) { pc_select_dma_channel(0, state); } -WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dack1_w ) { pc_select_dma_channel(1, state); } -WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dack2_w ) { pc_select_dma_channel(2, state); } -WRITE_LINE_MEMBER( ibm5160_mb_device::pc_dack3_w ) { pc_select_dma_channel(3, state); } - -/************************************************************* - * - * pic8259 configuration - * - *************************************************************/ - -WRITE_LINE_MEMBER(ibm5160_mb_device::pc_speaker_set_spkrdata) -{ - m_pc_spkrdata = state ? 1 : 0; - m_speaker->level_w(m_pc_spkrdata & m_pit_out2); -} - - -/************************************************************* - * - * pit8253 configuration - * - *************************************************************/ - -WRITE_LINE_MEMBER( ibm5160_mb_device::pc_pit8253_out1_changed ) -{ - /* Trigger DMA channel #0 */ - if ( m_out1 == 0 && state == 1 && m_u73_q2 == 0 ) - { - m_u73_q2 = 1; - m_dma8237->dreq0_w( m_u73_q2 ); - } - m_out1 = state; -} - - -WRITE_LINE_MEMBER( ibm5160_mb_device::pc_pit8253_out2_changed ) -{ - m_pit_out2 = state ? 1 : 0; - m_speaker->level_w(m_pc_spkrdata & m_pit_out2); -} - - -/********************************************************** - * - * PPI8255 interface - * - * - * PORT A (input) - * - * Directly attached to shift register which stores data - * received from the keyboard. - * - * PORT B (output) - * 0 - PB0 - TIM2GATESPK - Enable/disable counting on timer 2 of the 8253 - * 1 - PB1 - SPKRDATA - Speaker data - * 2 - PB2 - - Enable receiving data from the keyboard when keyboard is not locked. - * 3 - PB3 - - Dipsswitch set selector - * 4 - PB4 - ENBRAMPCK - Enable ram parity check - * 5 - PB5 - ENABLEI/OCK - Enable expansion I/O check - * 6 - PB6 - - Connected to keyboard clock signal - * 0 = ignore keyboard signals - * 1 = accept keyboard signals - * 7 - PB7 - - Clear/disable shift register and IRQ1 line - * 0 = normal operation - * 1 = clear and disable shift register and clear IRQ1 flip flop - * - * PORT C - * 0 - PC0 - - Dipswitch 0/4 SW1 - * 1 - PC1 - - Dipswitch 1/5 SW1 - * 2 - PC2 - - Dipswitch 2/6 SW1 - * 3 - PC3 - - Dipswitch 3/7 SW1 - * 4 - PC4 - SPK - Speaker/cassette data - * 5 - PC5 - I/OCHCK - Expansion I/O check result - * 6 - PC6 - T/C2OUT - Output of 8253 timer 2 - * 7 - PC7 - PCK - Parity check result - * - * IBM5150 SW1: - * 0 - OFF - One or more floppy drives - * ON - Diskless operation - * 1 - OFF - 8087 present - * ON - No 8087 present - * 2+3 - Used to determine on board memory configuration - * OFF OFF - 64KB - * ON OFF - 48KB - * OFF ON - 32KB - * ON ON - 16KB - * 4+5 - Used to select display - * OFF OFF - Monochrome - * ON OFF - CGA, 80 column - * OFF ON - CGA, 40 column - * ON ON - EGA/VGA display - * 6+7 - Used to select number of disk drives - * OFF OFF - four disk drives - * ON OFF - three disk drives - * OFF ON - two disk drives - * ON ON - one disk drive - * - **********************************************************/ -WRITE_LINE_MEMBER( ibm5150_mb_device::keyboard_clock_w ) -{ - if (!m_ppi_keyboard_clear && !state && !m_ppi_shift_enable) - { - m_ppi_shift_enable = m_ppi_shift_register & 0x01; - - m_ppi_shift_register >>= 1; - m_ppi_shift_register |= m_ppi_data_signal << 7; - - m_pic8259->ir1_w(m_ppi_shift_enable); - m_pc_kbdc->data_write_from_mb(!m_ppi_shift_enable); - } -} - -WRITE_LINE_MEMBER( ec1841_mb_device::keyboard_clock_w ) -{ - if (!m_ppi_keyboard_clear && !state && !m_ppi_shift_enable) - { - m_ppi_shift_enable = m_ppi_shift_register & 0x01; - - m_ppi_shift_register >>= 1; - m_ppi_shift_register |= m_ppi_data_signal << 7; - - m_pic8259->ir1_w(m_ppi_shift_enable); - m_pc_kbdc->data_write_from_mb(!m_ppi_shift_enable); - } -} - -WRITE_LINE_MEMBER( ibm5160_mb_device::keyboard_clock_w ) -{ - if (!m_ppi_keyboard_clear && !state && !m_ppi_shift_enable) - { - m_ppi_shift_enable = m_ppi_shift_register & 0x01; - - m_ppi_shift_register >>= 1; - m_ppi_shift_register |= m_ppi_data_signal << 7; - - m_pic8259->ir1_w(m_ppi_shift_enable); - m_pc_kbdc->data_write_from_mb(!BIT(m_ppi_portb, 2) && !m_ppi_shift_enable); - } -} - - -WRITE_LINE_MEMBER( ibm5160_mb_device::keyboard_data_w ) -{ - m_ppi_data_signal = state; -} - -READ8_MEMBER (ibm5160_mb_device::pc_ppi_porta_r) -{ - int data = 0xFF; - /* KB port A */ - if (m_ppi_keyboard_clear) - { - /* 0 0 - no floppy drives - * 1 Not used - * 2-3 The number of memory banks on the system board - * 4-5 Display mode - * 11 = monochrome - * 10 - color 80x25 - * 01 - color 40x25 - * 6-7 The number of floppy disk drives - */ - data = ioport("DSW0")->read(); - } - else - { - data = m_ppi_shift_register; - } - PIO_LOG(1,"PIO_A_r",("$%02x\n", data)); - return data; -} - - -READ8_MEMBER ( ibm5160_mb_device::pc_ppi_portc_r ) -{ - int data=0xff; - - data&=~0x80; // no parity error - data&=~0x40; // no error on expansion board - /* KB port C: equipment flags */ - if (m_ppi_portc_switch_high) - { - /* read hi nibble of S2 */ - data = (data & 0xf0) | ((ioport("DSW0")->read() >> 4) & 0x0f); - PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data)); - } - else - { - /* read lo nibble of S2 */ - data = (data & 0xf0) | (ioport("DSW0")->read() & 0x0f); - PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data)); - } - - if ( m_ppi_portb & 0x01 ) - { - data = ( data & ~0x10 ) | ( m_pit_out2 ? 0x10 : 0x00 ); - } - data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); - - return data; -} - - -WRITE8_MEMBER( ibm5160_mb_device::pc_ppi_portb_w ) -{ - /* PPI controller port B*/ - m_ppi_portb = data; - m_ppi_portc_switch_high = data & 0x08; - m_ppi_keyboard_clear = data & 0x80; - m_ppi_keyb_clock = data & 0x40; - m_pit8253->write_gate2(BIT(data, 0)); - pc_speaker_set_spkrdata( data & 0x02 ); - - /* If PB7 is set clear the shift register and reset the IRQ line */ - if ( m_ppi_keyboard_clear ) - { - m_ppi_shift_register = 0; - m_ppi_shift_enable = 0; - m_pic8259->ir1_w(m_ppi_shift_enable); - } - - m_pc_kbdc->data_write_from_mb(!BIT(m_ppi_portb, 2) && !m_ppi_shift_enable); - m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; - m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); -} - - -/********************************************************** - * - * NMI handling - * - **********************************************************/ - -WRITE8_MEMBER( ibm5160_mb_device::nmi_enable_w ) -{ - m_nmi_enabled = BIT(data,7); - m_isabus->set_nmi_state(m_nmi_enabled); -} -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -const device_type IBM5160_MOTHERBOARD = &device_creator; - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -static MACHINE_CONFIG_FRAGMENT( ibm5160_mb_config ) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL_14_31818MHz/12) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL_14_31818MHz/12) /* dram refresh */ - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(ibm5160_mb_device, pc_pit8253_out1_changed)) - MCFG_PIT8253_CLK2(XTAL_14_31818MHz/12) /* pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(ibm5160_mb_device, pc_pit8253_out2_changed)) - - MCFG_DEVICE_ADD( "dma8237", AM9517A, XTAL_14_31818MHz/3 ) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(ibm5160_mb_device, pc_dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(ibm5160_mb_device, pc_dma8237_out_eop)) - MCFG_I8237_IN_MEMR_CB(READ8(ibm5160_mb_device, pc_dma_read_byte)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(ibm5160_mb_device, pc_dma_write_byte)) - MCFG_I8237_IN_IOR_1_CB(READ8(ibm5160_mb_device, pc_dma8237_1_dack_r)) - MCFG_I8237_IN_IOR_2_CB(READ8(ibm5160_mb_device, pc_dma8237_2_dack_r)) - MCFG_I8237_IN_IOR_3_CB(READ8(ibm5160_mb_device, pc_dma8237_3_dack_r)) - MCFG_I8237_OUT_IOW_0_CB(WRITE8(ibm5160_mb_device, pc_dma8237_0_dack_w)) - MCFG_I8237_OUT_IOW_1_CB(WRITE8(ibm5160_mb_device, pc_dma8237_1_dack_w)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8(ibm5160_mb_device, pc_dma8237_2_dack_w)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8(ibm5160_mb_device, pc_dma8237_3_dack_w)) - MCFG_I8237_OUT_DACK_0_CB(WRITELINE(ibm5160_mb_device, pc_dack0_w)) - MCFG_I8237_OUT_DACK_1_CB(WRITELINE(ibm5160_mb_device, pc_dack1_w)) - MCFG_I8237_OUT_DACK_2_CB(WRITELINE(ibm5160_mb_device, pc_dack2_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(ibm5160_mb_device, pc_dack3_w)) - - MCFG_PIC8259_ADD( "pic8259", INPUTLINE(":maincpu", 0), VCC, NULL ) - - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) - MCFG_I8255_IN_PORTA_CB(READ8(ibm5160_mb_device, pc_ppi_porta_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(ibm5160_mb_device, pc_ppi_portb_w)) - MCFG_I8255_IN_PORTC_CB(READ8(ibm5160_mb_device, pc_ppi_portc_r)) - - MCFG_DEVICE_ADD("isa", ISA8, 0) - MCFG_ISA8_CPU(":maincpu") - MCFG_ISA_OUT_IRQ2_CB(DEVWRITELINE("pic8259", pic8259_device, ir2_w)) - MCFG_ISA_OUT_IRQ3_CB(DEVWRITELINE("pic8259", pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ4_CB(DEVWRITELINE("pic8259", pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ5_CB(DEVWRITELINE("pic8259", pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ6_CB(DEVWRITELINE("pic8259", pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ7_CB(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) - MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("dma8237", am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("dma8237", am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("dma8237", am9517a_device, dreq3_w)) - - MCFG_DEVICE_ADD("pc_kbdc", PC_KBDC, 0) - MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(ibm5160_mb_device, keyboard_clock_w)) - MCFG_PC_KBDC_OUT_DATA_CB(WRITELINE(ibm5160_mb_device, keyboard_data_w)) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor ibm5160_mb_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( ibm5160_mb_config ); -} - - -static INPUT_PORTS_START( ibm5160_mb ) - PORT_START("DSW0") /* IN1 */ - PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives") - PORT_DIPSETTING( 0x00, "1" ) - PORT_DIPSETTING( 0x40, "2" ) - PORT_DIPSETTING( 0x80, "3" ) - PORT_DIPSETTING( 0xc0, "4" ) - PORT_DIPNAME( 0x30, 0x30, "Graphics adapter") - PORT_DIPSETTING( 0x00, "EGA/VGA" ) - PORT_DIPSETTING( 0x10, "Color 40x25" ) - PORT_DIPSETTING( 0x20, "Color 80x25" ) - PORT_DIPSETTING( 0x30, "Monochrome" ) - PORT_DIPNAME( 0x0c, 0x0c, "RAM banks") - PORT_DIPSETTING( 0x00, "1 - 16/ 64/256K" ) - PORT_DIPSETTING( 0x04, "2 - 32/128/512K" ) - PORT_DIPSETTING( 0x08, "3 - 48/192/576K" ) - PORT_DIPSETTING( 0x0c, "4 - 64/256/640K" ) - PORT_DIPNAME( 0x02, 0x00, "8087 installed") - PORT_DIPSETTING( 0x00, DEF_STR(No) ) - PORT_DIPSETTING( 0x02, DEF_STR(Yes) ) - PORT_DIPNAME( 0x01, 0x01, "Boot from floppy") - PORT_DIPSETTING( 0x01, DEF_STR(Yes) ) - PORT_DIPSETTING( 0x00, DEF_STR(No) ) -INPUT_PORTS_END -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor ibm5160_mb_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( ibm5160_mb ); -} - - -void ibm5160_mb_device::static_set_cputag(device_t &device, const char *tag) -{ - ibm5160_mb_device &board = downcast(device); - board.m_cputag = tag; -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// ibm5160_mb_device - constructor -//------------------------------------------------- - -ibm5160_mb_device::ibm5160_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, IBM5160_MOTHERBOARD, "IBM5160_MOTHERBOARD", tag, owner, clock, "ibm5160_mb", __FILE__), - m_maincpu(*owner, "maincpu"), - m_pic8259(*this, "pic8259"), - m_dma8237(*this, "dma8237"), - m_pit8253(*this, "pit8253"), - m_ppi8255(*this, "ppi8255"), - m_speaker(*this, "speaker"), - m_isabus(*this, "isa"), - m_pc_kbdc(*this, "pc_kbdc"), - m_ram(*this, ":" RAM_TAG) -{ -} - -void ibm5160_mb_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) -{ - int buswidth = m_maincpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - if(!rhandler.isnull()) m_maincpu->space(AS_IO).install_read_handler(start, end, mask, mirror, rhandler, 0); - if(!whandler.isnull()) m_maincpu->space(AS_IO).install_write_handler(start, end, mask, mirror, whandler, 0); - break; - case 16: - if(!rhandler.isnull()) m_maincpu->space(AS_IO).install_read_handler(start, end, mask, mirror, rhandler, 0xffff); - if(!whandler.isnull()) m_maincpu->space(AS_IO).install_write_handler(start, end, mask, mirror, whandler, 0xffff); - break; - default: - fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth); - } -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void ibm5160_mb_device::device_start() -{ - install_device(0x0000, 0x000f, 0, 0, read8_delegate(FUNC(am9517a_device::read), (am9517a_device*)m_dma8237), write8_delegate(FUNC(am9517a_device::write), (am9517a_device*)m_dma8237) ); - install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) ); - install_device(0x0040, 0x0043, 0, 0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit8253), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit8253) ); - install_device(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255) ); - install_device(0x0080, 0x0087, 0, 0, read8_delegate(FUNC(ibm5160_mb_device::pc_page_r), this), write8_delegate(FUNC(ibm5160_mb_device::pc_page_w),this) ); - install_device(0x00a0, 0x00a1, 0, 0, read8_delegate(), write8_delegate(FUNC(ibm5160_mb_device::nmi_enable_w),this)); - /* MESS managed RAM */ - if ( m_ram->pointer() ) - membank( "bank10" )->set_base( m_ram->pointer() ); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void ibm5160_mb_device::device_reset() -{ - m_u73_q2 = 0; - m_out1 = 2; // initial state of pit output is undefined - m_pc_spkrdata = 0; - m_pit_out2 = 1; - m_dma_channel = -1; - m_cur_eop = false; - memset(m_dma_offset,0,sizeof(m_dma_offset)); - m_ppi_portc_switch_high = 0; - m_ppi_speaker = 0; - m_ppi_keyboard_clear = 0; - m_ppi_keyb_clock = 0; - m_ppi_portb = 0; - m_ppi_clock_signal = 0; - m_ppi_data_signal = 0; - m_ppi_shift_register = 0; - m_ppi_shift_enable = 0; - m_nmi_enabled = 0; - m_speaker->level_w(0); -} - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -const device_type IBM5150_MOTHERBOARD = &device_creator; - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** -static MACHINE_CONFIG_FRAGMENT( ibm5150_mb_config ) - MCFG_FRAGMENT_ADD(ibm5160_mb_config) - - MCFG_DEVICE_MODIFY("pc_kbdc") - MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(ibm5150_mb_device, keyboard_clock_w)) - - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor ibm5150_mb_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( ibm5150_mb_config ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// ibm5150_mb_device - constructor -//------------------------------------------------- - -ibm5150_mb_device::ibm5150_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : ibm5160_mb_device(mconfig, tag, owner, clock), - m_cassette(*this, "cassette") -{ -} - -void ibm5150_mb_device::device_start() -{ - ibm5160_mb_device::device_start(); -} -void ibm5150_mb_device::device_reset() -{ - ibm5160_mb_device::device_reset(); -} - -READ8_MEMBER (ibm5150_mb_device::pc_ppi_porta_r) -{ - int data = 0xFF; - /* KB port A */ - if (m_ppi_keyboard_clear) - { - /* 0 0 - no floppy drives - * 1 Not used - * 2-3 The number of memory banks on the system board - * 4-5 Display mode - * 11 = monochrome - * 10 - color 80x25 - * 01 - color 40x25 - * 6-7 The number of floppy disk drives - */ - data = ioport("DSW0")->read() & 0xF3; - switch ( m_ram->size() ) - { - case 16 * 1024: - data |= 0x00; - break; - case 32 * 1024: /* Need to verify if this is correct */ - data |= 0x04; - break; - case 48 * 1024: /* Need to verify if this is correct */ - data |= 0x08; - break; - default: - data |= 0x0C; - break; - } - } - else - { - data = m_ppi_shift_register; - } - PIO_LOG(1,"PIO_A_r",("$%02x\n", data)); - return data; -} - - -READ8_MEMBER ( ibm5150_mb_device::pc_ppi_portc_r ) -{ - int data=0xff; - - data&=~0x80; // no parity error - data&=~0x40; // no error on expansion board - /* KB port C: equipment flags */ - if (m_ppi_portc_switch_high) - { - /* read hi nibble of SW2 */ - data = data & 0xf0; - - switch ( m_ram->size() - 64 * 1024 ) - { - case 64 * 1024: data |= 0x00; break; - case 128 * 1024: data |= 0x02; break; - case 192 * 1024: data |= 0x04; break; - case 256 * 1024: data |= 0x06; break; - case 320 * 1024: data |= 0x08; break; - case 384 * 1024: data |= 0x0A; break; - case 448 * 1024: data |= 0x0C; break; - case 512 * 1024: data |= 0x0E; break; - case 576 * 1024: data |= 0x01; break; - case 640 * 1024: data |= 0x03; break; - case 704 * 1024: data |= 0x05; break; - case 768 * 1024: data |= 0x07; break; - case 832 * 1024: data |= 0x09; break; - case 896 * 1024: data |= 0x0B; break; - case 960 * 1024: data |= 0x0D; break; - } - if ( m_ram->size() > 960 * 1024 ) - data |= 0x0D; - - PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data)); - } - else - { - /* read lo nibble of S2 */ - data = (data & 0xf0) | (ioport("DSW0")->read() & 0x0f); - PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data)); - } - - if ( ! ( m_ppi_portb & 0x08 ) ) - { - double tap_val = m_cassette->input(); - - if ( tap_val < 0 ) - { - data &= ~0x10; - } - else - { - data |= 0x10; - } - } - else - { - if ( m_ppi_portb & 0x01 ) - { - data = ( data & ~0x10 ) | ( m_pit_out2 ? 0x10 : 0x00 ); - } - } - data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); - - return data; -} - - -WRITE8_MEMBER( ibm5150_mb_device::pc_ppi_portb_w ) -{ - /* KB controller port B */ - m_ppi_portb = data; - m_ppi_portc_switch_high = data & 0x08; - m_ppi_keyboard_clear = data & 0x80; - m_ppi_keyb_clock = data & 0x40; - m_pit8253->write_gate2(BIT(data, 0)); - pc_speaker_set_spkrdata( data & 0x02 ); - - m_cassette->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - - /* If PB7 is set clear the shift register and reset the IRQ line */ - if ( m_ppi_keyboard_clear ) - { - m_ppi_shift_register = 0; - m_ppi_shift_enable = 0; - m_pic8259->ir1_w(m_ppi_shift_enable); - } - - m_pc_kbdc->data_write_from_mb(!m_ppi_shift_enable); - m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; - m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); -} - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -const device_type EC1841_MOTHERBOARD = &device_creator; - -static MACHINE_CONFIG_FRAGMENT( ec1841_mb_config ) - MCFG_FRAGMENT_ADD(ibm5160_mb_config) - - MCFG_DEVICE_MODIFY("pc_kbdc") - MCFG_PC_KBDC_OUT_CLOCK_CB(WRITELINE(ec1841_mb_device, keyboard_clock_w)) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor ec1841_mb_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( ec1841_mb_config ); -} - -static INPUT_PORTS_START( ec1841_mb ) - PORT_START("DSW0") /* SA1 */ - PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives") - PORT_DIPSETTING( 0x00, "1" ) - PORT_DIPSETTING( 0x40, "2" ) - PORT_DIPSETTING( 0x80, "3" ) - PORT_DIPSETTING( 0xc0, "4" ) - PORT_DIPNAME( 0x30, 0x20, "Graphics adapter") - PORT_DIPSETTING( 0x00, "Reserved" ) - PORT_DIPSETTING( 0x10, "Color 40x25" ) - PORT_DIPSETTING( 0x20, "Color 80x25" ) - PORT_DIPSETTING( 0x30, "Monochrome" ) - PORT_BIT( 0x08, 0x08, IPT_UNUSED ) - /* BIOS does not support booting from QD floppies */ - PORT_DIPNAME( 0x04, 0x04, "Floppy type") - PORT_DIPSETTING( 0x00, "80 tracks" ) - PORT_DIPSETTING( 0x04, "40 tracks" ) - PORT_DIPNAME( 0x02, 0x00, "8087 installed") - PORT_DIPSETTING( 0x00, DEF_STR(No) ) - PORT_DIPSETTING( 0x02, DEF_STR(Yes) ) - PORT_DIPNAME( 0x01, 0x01, "Boot from floppy") - PORT_DIPSETTING( 0x01, DEF_STR(Yes) ) - PORT_DIPSETTING( 0x00, DEF_STR(No) ) - - PORT_START("SA2") - PORT_DIPNAME( 0x04, 0x04, "Speech synthesizer") - PORT_DIPSETTING( 0x00, "Installed" ) - PORT_DIPSETTING( 0x04, "Not installed" ) -INPUT_PORTS_END - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor ec1841_mb_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( ec1841_mb ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// ec1841_mb_device - constructor -//------------------------------------------------- - -ec1841_mb_device::ec1841_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : ibm5160_mb_device(mconfig, tag, owner, clock) -{ -} - -void ec1841_mb_device::device_start() -{ - ibm5160_mb_device::device_start(); -} -void ec1841_mb_device::device_reset() -{ - ibm5160_mb_device::device_reset(); -} - -// kbd interface is 5150-like but PB2 controls access to second bank of DIP switches (SA2). -WRITE8_MEMBER( ec1841_mb_device::pc_ppi_portb_w ) -{ - /* KB controller port B */ - m_ppi_portb = data; - m_ppi_portc_switch_high = data & 0x04; - m_ppi_keyboard_clear = data & 0x80; - m_ppi_keyb_clock = data & 0x40; - m_pit8253->write_gate2(BIT(data, 0)); - pc_speaker_set_spkrdata( data & 0x02 ); - - /* If PB7 is set clear the shift register and reset the IRQ line */ - if ( m_ppi_keyboard_clear ) - { - m_ppi_shift_register = 0; - m_ppi_shift_enable = 0; - m_pic8259->ir1_w(m_ppi_shift_enable); - } - - m_pc_kbdc->data_write_from_mb(!m_ppi_shift_enable); - m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; - m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); -} - -READ8_MEMBER ( ec1841_mb_device::pc_ppi_portc_r ) -{ - int data=0xff; - - data&=~0x80; // no parity error - data&=~0x40; // no error on expansion board - - if (m_ppi_portc_switch_high) - { - data = (data & 0xf0) | (ioport("SA2")->read() & 0x0f); - } - - data = ( data & ~0x20 ) | ( m_pit_out2 ? 0x20 : 0x00 ); - - return data; -} - -pc_noppi_mb_device::pc_noppi_mb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : ibm5160_mb_device(mconfig, tag, owner, clock) -{ -} - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -static MACHINE_CONFIG_FRAGMENT( pc_noppi_mb_config ) - MCFG_FRAGMENT_ADD(ibm5160_mb_config) - - MCFG_DEVICE_REMOVE("pc_kbdc") - MCFG_DEVICE_REMOVE("ppi8255") -MACHINE_CONFIG_END - -static INPUT_PORTS_START( pc_noppi_mb ) -INPUT_PORTS_END - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor pc_noppi_mb_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pc_noppi_mb_config ); -} - -ioport_constructor pc_noppi_mb_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc_noppi_mb ); -} - -void pc_noppi_mb_device::device_start() -{ - install_device(0x0000, 0x000f, 0, 0, read8_delegate(FUNC(am9517a_device::read), (am9517a_device*)m_dma8237), write8_delegate(FUNC(am9517a_device::write), (am9517a_device*)m_dma8237) ); - install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) ); - install_device(0x0040, 0x0043, 0, 0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit8253), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit8253) ); - install_device(0x0080, 0x0087, 0, 0, read8_delegate(FUNC(ibm5160_mb_device::pc_page_r), this), write8_delegate(FUNC(ibm5160_mb_device::pc_page_w),this) ); - install_device(0x00a0, 0x00a1, 0, 0, read8_delegate(), write8_delegate(FUNC(ibm5160_mb_device::nmi_enable_w),this)); - /* MESS managed RAM */ - if ( m_ram->pointer() ) - membank( "bank10" )->set_base( m_ram->pointer() ); -} - -const device_type PCNOPPI_MOTHERBOARD = &device_creator; diff --git a/src/mess/machine/hec2hrp.c b/src/mess/machine/hec2hrp.c deleted file mode 100644 index 55db5bdfe5f..00000000000 --- a/src/mess/machine/hec2hrp.c +++ /dev/null @@ -1,822 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:JJ Stacino -///////////////////////////////////////////////////////////////////////// -// HEC2HRP.C in machine -/* Hector 2HR+ - Victor - Hector 2HR - Hector HRX - Hector MX40c - Hector MX80c - Hector 1 - Interact - - 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com - 31/06/2009 Video - Robbbert - - 29/10/2009 Update skeleton to functional machine - by yo_fr (jj.stac @ aliceadsl.fr) - - => add Keyboard, - => add color, - => add cassette, - => add sn76477 sound and 1bit sound, - => add joysticks (stick, pot, fire) - => add BR/HR switching - => add bank switch for HRX - => add device MX80c and bank switching for the ROM - 03/01/2010 Update and clean prog by yo_fr (jj.stac @ aliceadsl.fr) - => add the port mapping for keyboard - 28/09/2010 add the DISK II support by yo_fr (jj.stac @ aliceadsl.fr) - => Note that actually the DISK II boot (loading CPM : OK) but do not run (don't run the CPM...). - 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M runnig! JJStacino - 11/11/2011 : add the minidisque support -3 pouces 1/2 driver- JJStacino (jj.stac @ aliceadsl.fr) - 19/02/2012 : few adjustment for the hrp and hr machine - JJStacino - - don't forget to keep some information about these machines, see DChector project : http://dchector.free.fr/ made by DanielCoulom - (and thank's to Daniel!) and Yves site : http://hectorvictor.free.fr/ (thank's too Yves!) - - TODO : Add the cartridge function, - Adjust the one shot and A/D timing (sn76477) -*/ - -#include "emu.h" -#include "imagedev/cassette.h" -#include "imagedev/printer.h" -#include "sound/wave.h" /* for K7 sound*/ -#include "sound/discrete.h" /* for 1 Bit sound*/ -#include "machine/upd765.h" /* for floppy disc controller */ - -#include "formats/hect_tap.h" -#include "includes/hec2hrp.h" - -#ifndef DEBUG_TRACE_COM_HECTOR -//#define DEBUG_TRACE_COM_HECTOR 1 -#endif - - -/* machine List -hec2hrp -victor -hec2hr -hec2hrx -hec2mdhrx -hec2mx80 -hec2mx40 -*/ - -/* Helper function*/ -int hec2hrp_state::isHectorWithDisc2() -{ -return ((strncmp(machine().system().name , "hec2hrx" , 7)==0) || - (strncmp(machine().system().name , "hec2mx40" , 8)==0) || - (strncmp(machine().system().name , "hec2mx80" , 8)==0)); -} - -int hec2hrp_state::isHectorWithMiniDisc() -{ -return ((strncmp(machine().system().name , "hec2mdhrx", 9)==0)); -} - -int hec2hrp_state::isHectorHR() -{ -return ((strncmp(machine().system().name , "hec2hr" , 6)==0) || //Aviable for hr & hrp - (strncmp(machine().system().name , "hec2mdhrx", 9)==0) || - (strncmp(machine().system().name , "victor" , 6)==0) || - (strncmp(machine().system().name , "hec2mx40" , 8)==0) || - (strncmp(machine().system().name , "hec2mx80" , 8)==0)); -} - -int hec2hrp_state::isHectoreXtend() -{ -return ((strncmp(machine().system().name , "hec2mdhrx", 9)==0) || - (strncmp(machine().system().name , "hec2hrx" , 7)==0) || - (strncmp(machine().system().name , "hec2mx40" , 8)==0) || - (strncmp(machine().system().name , "hec2mx80" , 8)==0)); -} - -/* Cassette timer*/ -TIMER_CALLBACK_MEMBER(hec2hrp_state::Callback_CK) -{ -/* To generate the CK signal (K7)*/ - m_CK_signal++; -} - -WRITE8_MEMBER( hec2hrp_state::minidisc_control_w ) -{ - floppy_image_device *floppy = NULL; - - if (BIT(data, 6)) floppy = m_floppy0->get_device(); - // bit 7 = drive 2? - - m_minidisc_fdc->set_floppy(floppy); - - if (floppy) - { - // don't know where the motor on signal is - floppy->mon_w(0); - floppy->ss_w(BIT(data, 4)); - } - - membank("bank2")->set_entry(BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC); -} - -WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) -{ - if (offset==0x00) { /* 0x800 et 0x000=> video page, HR*/ - if (isHectoreXtend()) - membank("bank1")->set_entry(HECTOR_BANK_VIDEO); - if (m_flag_clk ==1) - { - m_flag_clk=0; - m_maincpu->set_unscaled_clock(XTAL_5MHz); /* increase CPU*/ - } - } - if (offset==0x04) { /* 0x804 => video page, BR*/ - m_hector_flag_hr=0; - if (isHectoreXtend()) - membank("bank1")->set_entry(HECTOR_BANK_VIDEO); - if (m_flag_clk ==0) - { - m_flag_clk=1; - m_maincpu->set_unscaled_clock(XTAL_1_75MHz); /* slowdown CPU*/ - } - } - if (offset==0x08) { /* 0x808 => base page, HR*/ - if (isHectoreXtend()) - membank("bank1")->set_entry(HECTOR_BANK_PROG); - if (m_flag_clk ==1) - { - m_flag_clk=0; - m_maincpu->set_unscaled_clock(XTAL_5MHz); /* increase CPU*/ - } - - } - if (offset==0x0c) { /* 0x80c => base page, BR*/ - m_hector_flag_hr=0; - if (isHectoreXtend()) - membank("bank1")->set_entry(HECTOR_BANK_PROG); - if (m_flag_clk ==0) - { - m_flag_clk=1; - m_maincpu->set_unscaled_clock(XTAL_1_75MHz); /* slowdown CPU*/ - } - } -} - -WRITE8_MEMBER(hec2hrp_state::hector_keyboard_w) -{ - /*nothing to do => read function manage the value*/ -} - -READ8_MEMBER(hec2hrp_state::hector_keyboard_r) -{ - UINT8 data = 0xff; - - if (offset ==7) /* Only when joy reading*/ - { - /* Read special key for analog joystick emulation only (button and pot are analog signal!) and the reset */ - data=m_keyboard[8]->read(); - - if (data & 0x01) /* Reset machine ! (on ESC key)*/ - { - m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - if (isHectorHR()) /* aviable for HR and up */ - { - m_hector_flag_hr=1; - if (isHectoreXtend()) - { - membank("bank1")->set_entry(HECTOR_BANK_PROG); - membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); - } - //RESET DISC II unit - if (isHectorWithDisc2() ) - hector_disc2_reset(); - - /* floppy md master reset */ - if (isHectorWithMiniDisc()) - m_minidisc_fdc->reset(); - } - - else /* aviable for BR machines */ - m_hector_flag_hr=0; - - - /*Common flag*/ - m_hector_flag_80c = 0; - m_flag_clk = 0; - } - - m_actions = 0; - if (data & 0x02) /* Fire(0)*/ - m_actions += 1; - - if (data & 0x04) /* Fire(1)*/ - m_actions += 2; - - if (data & 0x08) /* Pot(0)+*/ - m_pot0 += 1; - if (m_pot0>128) m_pot0 = 128; - - if (data & 0x10) /* Pot(0)-*/ - m_pot0 -= 1; - - if (m_pot0>250) m_pot0 = 0; - - if (data & 0x20) /* Pot(1)+*/ - m_pot1 += 1; - if (m_pot1>128) m_pot1 = 128; - - if (data & 0x40) /* Pot(1)-*/ - m_pot1 -= 1; - - if (m_pot1>250) m_pot1 = 0; - } - - /* in all case return the request value*/ - return m_keyboard[offset]->read(); -} - -WRITE8_MEMBER(hec2hrp_state::hector_sn_2000_w) -{ - Mise_A_Jour_Etat(0x2000+ offset, data); - Update_Sound(space, data); -} -WRITE8_MEMBER(hec2hrp_state::hector_sn_2800_w) -{ - Mise_A_Jour_Etat(0x2800+ offset, data); - Update_Sound(space, data); -} -READ8_MEMBER(hec2hrp_state::hector_cassette_r) -{ - double level; - UINT8 value=0; - - if ((m_state3000 & 0x38) != 0x38 ) /* Selon Sb choix cassette ou timer (74153)*/ - { - m_Data_K7 = 0x00; /* No cassette => clear bit*/ - switch (m_state3000 & 0x38 ) - { - case 0x08: value = (m_actions & 1) ? 0x80 : 0; break; - case 0x10: value = m_pot0; break; - case 0x20: value = (m_actions & 2) ? 0x80 : 0; break; - case 0x28: value = m_pot1; break; - default: value = 0; break; - } - } - else - { - if (m_write_cassette == 0) - { - /* Accee a la cassette*/ - level = m_cassette->input(); - - /* Travail du 741 en trigger*/ - if (level < -0.08) - m_cassette_bit = 0x00; - if (level > +0.08) - m_cassette_bit = 0x01; - } - /* Programme du sn7474 (bascule) : Changement ??tat bit Data K7 ?? chaque front montant de m_cassette_bit*/ - if ((m_cassette_bit != m_cassette_bit_mem) && (m_cassette_bit !=0)) - { - if (m_Data_K7 == 0x00) - m_Data_K7 = 0x80;/* En poids fort*/ - else - m_Data_K7 = 0x00; - } - value = ( m_CK_signal & 0x7F ) + m_Data_K7; - m_cassette_bit_mem = m_cassette_bit; /* Memorisation etat bit cassette*/ - } - return value; -} -WRITE8_MEMBER(hec2hrp_state::hector_sn_3000_w) -{ - m_state3000 = data & 0xf8; /* except bit 0 to 2*/ - if ((data & 7) != m_oldstate3000 ) - { - /* Update sn76477 only when necessary!*/ - Mise_A_Jour_Etat(0x3000, data & 7 ); - Update_Sound(space, data & 7); - } - m_oldstate3000 = data & 7; -} - -/* Color Interface */ -WRITE8_MEMBER(hec2hrp_state::hector_color_a_w) -{ - if (data & 0x40) - { - /* Bit 6 => motor ON/OFF => for cassette state!*/ - if (m_write_cassette==0) - { - m_cassette->change_state( - CASSETTE_MOTOR_ENABLED , - CASSETTE_MASK_MOTOR); - // m_cassette->set_state((cassette_state)(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED )); - } - } - else - { /* stop motor*/ - m_cassette->set_state(CASSETTE_STOPPED); - m_write_cassette=0; - m_counter_write =0; - } - if (((data & 0x80) != (m_oldstate1000 & 0x80)) && ((m_oldstate1000 & 7)==(data & 7)) ) /* Bit7 had change but not the color statement*/ - { - /* Bit 7 => Write bit for cassette!*/ - m_counter_write +=1; - - if (m_counter_write > 5) - { - /* Wait several cycle before lauch the record to prevent somes bugs*/ - m_counter_write = 6; - if (m_write_cassette==0) - { /* C'est la 1er fois => record*/ - m_cassette->change_state( - CASSETTE_MOTOR_ENABLED , - CASSETTE_MASK_MOTOR); - m_cassette->set_state(CASSETTE_RECORD); - m_write_cassette=1; - } - } - /* cassette data */ - m_cassette->output(((data & 0x80) == 0x80) ? -1.0 : +1.0); - } - - /* Other bit : color definition*/ - m_hector_color[0] = data & 0x07 ; - m_hector_color[2] = ((data >> 3) & 0x07) | (m_hector_color[2] & 0x40); - - m_oldstate1000=data; /* For next step*/ -} - -WRITE8_MEMBER(hec2hrp_state::hector_color_b_w) -{ - discrete_device *discrete = machine().device("discrete"); - m_hector_color[1] = data & 0x07; - m_hector_color[3] = (data >> 3) & 0x07; - - /* Half light on color 2 only on HR machines:*/ - if (data & 0x40) m_hector_color[2] |= 8; else m_hector_color[2] &= 7; - - /* Play bit*/ - discrete->write(space, NODE_01, (data & 0x80) ? 0:1 ); -} - - -/******************************************************************************** - Port Handling -********************************************************************************/ - -/******************* READ PIO 8255 *******************/ -READ8_MEMBER(hec2hrp_state::hector_io_8255_r) -{ - /* 8255 in mode 0 */ - UINT8 data =0; - UINT8 data_l=0; - UINT8 data_h=0; - - - if ((offset & 0x3) == 0x0) /* Port A */ - data = m_hector_port_a; - - if ((offset & 0x3) == 0x1) /* Port B */ - { - data = m_hector_port_b; - #ifdef DEBUG_TRACE_COM_HECTOR - printf("\nLecture data par Hector %x (portB)",data); - #endif - } - - if ((offset & 0x3) == 0x2) /* Port C */ - { - data_l = (m_hector_port_c_l & 0x0f); - data_h = (m_hector_port_c_h & 0xf0); - - if (BIT(m_hector_port_cmd, 0)) /* Quartet inf en entree ?*/ - data_l = (m_hector_port_c_l & 0x0f); /*no change*/ - - if (BIT(m_hector_port_cmd, 3)) /* Quartet sup en entree ?*/ - { - m_hector_port_c_h = (m_hector_port_c_h & 0x0c0); /* Clear bits 4 & 5*/ - - if (m_hector_disc2_data_w_ready != 0x00) - m_hector_port_c_h = m_hector_port_c_h + 0x010; // PC4 (data write ready from Disc II to Hector) - - if (m_hector_disc2_data_r_ready != 0x00) - m_hector_port_c_h = m_hector_port_c_h + 0x020; // PC5 (data read ready from Hector to Disc2) - - m_hector_port_c_h = m_hector_port_c_h & 0x07F; // PC7 (printer busy=0) - data_h = m_hector_port_c_h; - } - data= data_l + data_h; - } - return data; // Return the value! -} - -/******************* WRITE PIO 8255 *******************/ - -WRITE8_MEMBER(hec2hrp_state::hector_io_8255_w) -{ - /* 8255 in mode 0 */ - if ((offset & 0x3) == 0x0) /* Port A => to printer or Disc II*/ - { - m_hector_port_a = data; - /* Port A => to printer*/ - /* Caution : The strobe connection to the printer seems not be used - So, all what is send to the Disc2 unit will be printed too! */ - - if (BIT(m_hector_port_c_l, 0)) { // PC0 (bit X0)= strobe printer ! - printer_image_device *printer = machine().device("printer"); - printer->output(m_hector_port_a); - } - -#ifdef DEBUG_TRACE_COM_HECTOR - printf("\nEcriture data par Hector %x (dans portA)",data); -#endif - } - - if ((offset & 0x3) == 0x1) /* Port B */ - m_hector_port_b = data; - - - if ((offset & 0x3) == 0x2) /* Port C => depending cmd word */ - { - if (!BIT(m_hector_port_cmd, 0)) /* cmd -> Quartet inf en sortie ?*/ - { - m_hector_port_c_l = data & 0x0f; - // Utilizing bits port C : PC0 for the printer : strobe! - if (BIT(m_hector_port_c_l , 0)) // PC0 (bit X0)= true - { - /* Port A => to printer*/ - //printer_output(machine().device("printer"), m_hector_port_a); - } - // Utilizing bits port C : PC1 // PC2 for the communication with disc2 - if (!BIT(m_hector_port_c_l , 1)) // PC1 (bit X1)= true - { - // Lecture effectuee => RAZ memoire donnee m_hector_disc2_data_write dispo - m_hector_port_b = m_hector_disc2_data_write; // Mep sur port B si 2eme 74374 existant ! - m_hector_disc2_data_w_ready = 0x00; - #ifdef DEBUG_TRACE_COM_HECTOR - printf("\nEcriture port B vers m_hector_disc2_data_write suite a PC1"); - #endif - } - if (!BIT(m_hector_port_c_l, 2)) // PC2 (bit X2)= true - { - m_hector_disc2_data_read = m_hector_port_a; /* mise en place de l'info presente sur le port A */ - m_hector_disc2_data_r_ready = 0x08; /* memorisation de l'info */ - #ifdef DEBUG_TRACE_COM_HECTOR - printf("\nEcriture port A pour m_hector_disc2_data_read suite a PC2"); - #endif - } - } - if (!BIT(m_hector_port_cmd, 3)) /* cmd -> Quartet sup en sortie ?*/ - m_hector_port_c_h = (data & 0xf0); - } - - if ((offset & 0x3) == 0x3) /* Port commande */ - { - m_hector_port_cmd = data; - } -} -/* End of 8255 managing */ - - -/******************* Ecriture PIO specifique machine MX40 *******************/ -WRITE8_MEMBER(hec2hrp_state::hector_mx40_io_port_w) -{ -/* Bank switching on several address */ - if ((offset &0x0ff) == 0x40) /* Port page 0*/ - membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); - if ((offset &0x0ff) == 0x41) /* Port page 1*/ - { - membank("bank2")->set_entry(HECTORMX_BANK_PAGE1); - m_hector_flag_80c=0; - } - if ((offset &0x0ff) == 0x44) /* Port page 2 => 42 pour MX80*/ - membank("bank2")->set_entry(HECTORMX_BANK_PAGE2); - if ((offset &0x0ff) == 0x49) /* Port screen resolution*/ - m_hector_flag_80c=0;/* No 80c in 40c !*/ -} - -/******************* Ecriture PIO specifique machine MX80 *******************/ -WRITE8_MEMBER(hec2hrp_state::hector_mx80_io_port_w) -{ - if ((offset &0x0ff) == 0x40) /* Port page 0*/ - membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); - if ((offset &0x0ff) == 0x41) /* Port page 1*/ - { - membank("bank2")->set_entry(HECTORMX_BANK_PAGE1); - m_hector_flag_80c=0; - } - if ((offset &0x0ff) == 0x42) /* Port page 2 => port different du MX40*/ - membank("bank2")->set_entry(HECTORMX_BANK_PAGE2); - if ((offset &0x0ff) == 0x49) /* Port screen resolution*/ - m_hector_flag_80c=1; -} - -/******************************************************************************** - sound managment -********************************************************************************/ - -void hec2hrp_state::Mise_A_Jour_Etat(int Adresse, int Value ) -{ -/* Adjust value depending on I/O main CPU request*/ -switch(Adresse ) -{ - case 0x2000: - /* Modification AU0 / AU8*/ - { /* AU0*/ - m_AU[ 0] = ((Value & 0x080 )==0) ? 0 : 1 ; - /* AU8 : 0*/ - m_AU[ 8] = ((Value & 0x040 )==0) ? 0 : 1 ; - break; - } - case 0x2001: - /* Modification AU1 / AU9*/ - { /* AU1*/ - m_AU[ 1] = ((Value & 0x080 )==0) ? 0 : 1 ; - /* AU9*/ - m_AU[ 9] = ((Value & 0x040 )==0) ? 0 : 1 ; - break; - } - case 0x2002: - /* Modification AU2 / AU10*/ - { /* AU2*/ - m_AU[ 2] = ((Value & 0x080 )==0) ? 0 : 1 ; - /* AU10*/ - m_AU[10] = ((Value & 0x040 )==0) ? 0 : 1 ; - break; - } - case 0x2003: - /* Modification AU3 / AU11*/ - { /* AU3*/ - m_AU[ 3] = ((Value & 0x080 )==0) ? 0 : 1 ; - /* AU11*/ - m_AU[11] = ((Value & 0x040 )==0) ? 0 : 1 ; - break; - } - case 0x2800: - /* Modification AU4 / AU12*/ - { /* AU4*/ - m_AU[ 4] = ((Value & 0x080 )==0) ? 0 : 1 ; - /* AU8*/ - m_AU[12] = ((Value & 0x040 )==0) ? 0 : 1 ; - break; - } - case 0x2801: - /* Modification AU5 / AU13*/ - { /* AU5*/ - m_AU[ 5] = ((Value & 0x080 )==0) ? 0 : 1 ; - /* AU13*/ - m_AU[13] = ((Value & 0x040 )==0) ? 0 : 1 ; - break; - } - case 0x2802: - { /* Modification AU6 / AU14*/ - /* AU6*/ - m_AU[ 6] = ((Value & 0x080 )==0) ? 0 : 1 ; - /* AU14*/ - m_AU[14] = ((Value & 0x040 )==0) ? 0 : 1 ; - break; - } - case 0x2803: - /* Modification AU7 / AU15*/ - { /* AU7*/ - m_AU[ 7] = ((Value & 0x080 )==0) ? 0 : 1 ; - /* AU15*/ - m_AU[15] = ((Value & 0x040 )==0) ? 0 : 1 ; - break; - } - case 0x3000: - /* Mixer modification*/ - { - m_ValMixer = (Value & 7) ; - break; - } - default: break; -} /*switch*/ -} - - -void hec2hrp_state::Init_Value_SN76477_Hector() -{ - /* Remplissage des valeurs de resistance et capacite d'Hector*/ - - /* Decay R*/ - m_Pin_Value[7][1] = RES_K(680.0); /*680K */ - m_Pin_Value[7][0] = RES_K(252.325); /* 142.325 (680 // 180KOhm)*/ - - /* Capa A/D*/ - m_Pin_Value[8][0] = CAP_U(0.47); /* 0.47uf*/ - m_Pin_Value[8][1] = CAP_U(1.47); /* 1.47*/ - - /* ATTACK R*/ - m_Pin_Value[10][1]= RES_K(180.0); /* 180*/ - m_Pin_Value[10][0]= RES_K(32.054); /* 32.054 (180 // 39 KOhm)*/ - - /* Version 3 : Ajuste pour les frequences mesurees : - // 4 0 SOUND 255 Hz => ajuste a l'oreille - // 4 4 SOUND 65 Hz => ajuste a l'oreille - // 4 8 SOUND 17 Hz => ajuste a l'oreille - // 4 12 SOUND 4,3 Hz => ajuste a l'oreille*/ - /* SLF C Version 3*/ - m_Pin_Value[21][0]= CAP_U(0.1); /*CAPU(0.1) */ - m_Pin_Value[21][1]= CAP_U(1.1); /*1.1*/ - - /*SLF R Version 3*/ - m_Pin_Value[20][1]= RES_K(180); //180 vu - m_Pin_Value[20][0]= RES_K(37.268); //37.268 (47//180 KOhms) - - /* Capa VCO*/ - /* Version 3 : Ajust?? pour les frequences mesur??es : - // 0 0 SOUND 5,5KHz => 5,1KHz - // 0 16 SOUND 1,3KHz => 1,2KHz - // 0 32 SOUND 580Hz => 570Hz - // 0 48 SOUND 132Hz => 120Hz*/ - m_Pin_Value[17][0] = CAP_N(47.0) ; /*47,0 mesure ok */ - m_Pin_Value[17][1] = CAP_N(580.0) ; /*580 mesure ok */ - /* R VCO Version 3*/ - m_Pin_Value[18][1] = RES_K(1400.0 );/*1300 mesure ok // au lieu de 1Mohm*/ - m_Pin_Value[18][0] = RES_K( 203.548 );/*223 mesure ok // au lieu de 193.548 (1000 // 240KOhm)*/ - - /* VCO Controle*/ - m_Pin_Value[16][0] = 0.0; /* Volts */ - m_Pin_Value[16][1] = 1.41; /* 2 = 10/15eme de 5V*/ - - /* Pitch*/ - m_Pin_Value[19][0] = 0.0; /*Volts */ - m_Pin_Value[19][1] = 1.41; - - m_Pin_Value[22][0] = 0; /* TOR */ - m_Pin_Value[22][1] = 1; - - /* R OneShot*/ - m_Pin_Value[24][1] = RES_K(100); - m_Pin_Value[24][0] = RES_K(1000); /*RES_M(1) infini sur Hector car non connectee*/ - - /* Capa OneShot*/ - m_Pin_Value[23][0] = 1.0; - m_Pin_Value[23][1] = 0.0; /* Valeur Bidon sur Hector car mise au 5Volts sans capa*/ - - /* Enabled*/ - m_Pin_Value[9][0] = 0; - m_Pin_Value[9][1] = 1; - - /* Volume*/ - m_Pin_Value[11][0] = 128; /* Rapport 50% et 100% 128*/ - m_Pin_Value[11][1] = 255; /* 255*/ - - /* Noise filter*/ - m_Pin_Value[6][0] = CAP_U(0.390); /* 0.390*/ - m_Pin_Value[6][1] = CAP_U(08.60); /* 0.48*/ - - /* Valeur corrige par rapport au schema :*/ - m_Pin_Value[5][1] = RES_K(3.30 ) ; /* 330Kohm*/ - m_Pin_Value[5][0] = RES_K(1.76 ) ; /* 76 Kohm*/ - - /* Noise pas commande par le bus audio !*/ - /* Seule la valeur [0] est documentee !*/ - m_Pin_Value[4][0] = RES_K(47) ; /* 47 K ohm*/ - m_Pin_Value[12][0] = RES_K(100); /* 100K ohm*/ - m_Pin_Value[3][0] = 0 ; /* NC*/ - - /* Gestion du type d'enveloppe*/ - m_Pin_Value[ 1][0] = 0; - m_Pin_Value[ 1][1] = 1; - - m_Pin_Value[28][0] = 0; - m_Pin_Value[28][1] = 1; - - /* Initialisation a 0 des pin du SN*/ - m_AU[0]=0; - m_AU[1]=0; - m_AU[2]=0; - m_AU[3]=0; - m_AU[4]=0; - m_AU[5]=0; - m_AU[6]=0; - m_AU[7]=0; - m_AU[8]=0; - m_AU[9]=0; - m_AU[10]=0; - m_AU[11]=0; - m_AU[12]=0; - m_AU[13]=0; - m_AU[14]=0; - m_AU[15]=0; - m_ValMixer = 0; -} - -void hec2hrp_state::Update_Sound(address_space &space, UINT8 data) -{ - /* keep device*/ - /* MIXER*/ - m_sn->mixer_a_w(((m_ValMixer & 0x04)==4) ? 1 : 0); - m_sn->mixer_b_w(((m_ValMixer & 0x01)==1) ? 1 : 0); - m_sn->mixer_c_w(((m_ValMixer & 0x02)==2) ? 1 : 0);/* Revu selon mesure electronique sur HRX*/ - - /* VCO oscillateur*/ - if (m_AU[12]==1) - m_sn->vco_res_w(m_Pin_Value[18][m_AU[10]]/12.0); /* en non AU11*/ - else - m_sn->vco_res_w(m_Pin_Value[18][m_AU[10]]); /* en non AU11*/ - - m_sn->vco_cap_w(m_Pin_Value[17][m_AU[2 ]]); - m_sn->pitch_voltage_w(m_Pin_Value[19][m_AU[15]]); - m_sn->vco_voltage_w(m_Pin_Value[16][m_AU[15]]); - m_sn->vco_w(m_Pin_Value[22][m_AU[12]]); /* VCO Select Ext/SLF*/ - - /* SLF*/ - m_sn->slf_res_w(m_Pin_Value[20][m_AU[ 9]]);/*AU10*/ - m_sn->slf_cap_w(m_Pin_Value[21][m_AU[1 ]]); - - /* One Shot*/ - m_sn->one_shot_res_w(m_Pin_Value[24][ 0]); /* NC*/ - m_sn->one_shot_cap_w(m_Pin_Value[23][m_AU[13]]); - - /* Ampli value*/ - m_sn->amplitude_res_w(m_Pin_Value[11][m_AU[5]]); - - /* Attack / Decay*/ - m_sn->attack_res_w(m_Pin_Value[10][m_AU[ 8]]); - m_sn->decay_res_w(m_Pin_Value[7 ][m_AU[11]]);/*AU9*/ - m_sn->attack_decay_cap_w(m_Pin_Value[8][m_AU[0]]); - - /* Filtre*/ - m_sn->noise_filter_res_w(m_Pin_Value[5][m_AU[4]]); - m_sn->noise_filter_cap_w(m_Pin_Value[6][m_AU[3]]); - - /* Clock Extern Noise*/ - m_sn->noise_clock_res_w(m_Pin_Value[4][0]); /* fix*/ - m_sn->feedback_res_w(m_Pin_Value[12][0]); /*fix*/ - - /* Envelope*/ - m_sn->envelope_1_w(m_Pin_Value[1 ][m_AU[6]]); - m_sn->envelope_2_w(m_Pin_Value[28][m_AU[7]]); - - /* En dernier on lance (ou pas !)*/ - m_sn->enable_w(m_Pin_Value[9][m_AU[14]]); -} - -void hec2hrp_state::hector_reset(int hr, int with_D2 ) -{ - // Initialization Hector - m_hector_flag_hr = hr; - m_flag_clk = 0; - m_write_cassette = 0; - m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - - // Initialization Disc II - if (with_D2==1) - - { - upd765a_device *fdc = machine().device("upd765"); - m_disc2cpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - fdc->reset(); - } -} - -void hec2hrp_state::hector_init() -{ - m_pot0 = m_pot1 = 0x40; - - /* For Cassette synchro*/ - m_Cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hec2hrp_state::Callback_CK),this)); - m_Cassette_timer->adjust(attotime::from_msec(100), 0, attotime::from_usec(64));/* => real synchro scan speed for 15,624Khz*/ - - /* Sound sn76477*/ - Init_Value_SN76477_Hector(); /*init R/C value*/ -} - - -/* sound hardware */ - -static DISCRETE_SOUND_START( hec2hrp ) - DISCRETE_INPUT_LOGIC(NODE_01) - DISCRETE_OUTPUT(NODE_01, 5000) -DISCRETE_SOUND_END - -MACHINE_CONFIG_FRAGMENT( hector_audio ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(0, "mono", 0.25) /* Sound level for cassette, as it is in mono => output channel=0*/ - - MCFG_SOUND_ADD("sn76477", SN76477, 0) - MCFG_SN76477_NOISE_PARAMS(RES_K(47), RES_K(330), CAP_P(390)) // noise + filter - MCFG_SN76477_DECAY_RES(RES_K(680)) // decay_res - MCFG_SN76477_ATTACK_PARAMS(CAP_U(47), RES_K(180)) // attack_decay_cap + attack_res - MCFG_SN76477_AMP_RES(RES_K(33)) // amplitude_res - MCFG_SN76477_FEEDBACK_RES(RES_K(100)) // feedback_res - MCFG_SN76477_VCO_PARAMS(2, CAP_N(47), RES_K(1000)) // VCO volt + cap + res - MCFG_SN76477_PITCH_VOLTAGE(2) // pitch_voltage - MCFG_SN76477_SLF_PARAMS(CAP_U(0.1), RES_K(180)) // slf caps + res - MCFG_SN76477_ONESHOT_PARAMS(CAP_U(1.00001), RES_K(10000)) // oneshot caps + res - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.1) - - MCFG_SOUND_ADD("discrete", DISCRETE, 0) /* Son 1bit*/ - MCFG_DISCRETE_INTF(hec2hrp) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - -MACHINE_CONFIG_END diff --git a/src/mess/machine/hecdisk2.c b/src/mess/machine/hecdisk2.c deleted file mode 100644 index 16cc67300c9..00000000000 --- a/src/mess/machine/hecdisk2.c +++ /dev/null @@ -1,148 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:JJ Stacino -/*******************************************************/ -/************ HECDISK2.C in machine ******************/ -/*******************************************************/ - -/* Lecteur de disquette DISK II pour les machines : - Hector HRX - Hector MX40c - Hector MX80c - - JJStacino jj.stacino@aliceadsl.fr - - 15/02/2010 : Start of the disc2 project! JJStacino - 26/09/2010 : first sending with bug2 (the first "dir" command finih with a crash of the Z80 disc II proc) JJStacino - 01/11/2010 : first time ending boot sequence, probleme on the CP/M lauch JJStacino - 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M runnig! JJStacino - 28/11/2010 : Found at Bratislava that the disk writing with TRANS X: is NOT WORKING (the exchange Hector=>Disc2 ok) -*/ - -#include "emu.h" - -#include "sound/wave.h" /* for K7 sound*/ -#include "sound/discrete.h" /* for 1 Bit sound*/ -#include "machine/upd765.h" /* for floppy disc controller */ -#include "formats/hect_dsk.h" -#include "cpu/z80/z80.h" - -#include "includes/hec2hrp.h" - -/* Callback uPD request */ - -/* How uPD765 works: - * First we send at uPD the string of command (p.e. 9 bytes for read starting by 0x46) on port 60h - between each byte, check the authorization of the uPD by reading the status register - * When the command is finish, the data arrive with DMA interrupt, then: - If read: in port 70 to retrieve the data, - If write: in port 70 send the data - * When all data had been send the uPD launch an INT - * The Z80 Disc2 writes in FF12 a flag - * if the flag is set, end of DMA function, - * At this point the Z80 can read the RESULT in port 61h -*/ - -/*****************************************************************************/ -/**** Management of the interrupts (NMI and INT)between uPD765 and Z80 ******/ -/*****************************************************************************/ - -/* upd765 INT is connected to interrupt of Z80 within a RNMI hardware authorization */ -WRITE_LINE_MEMBER( hec2hrp_state::disc2_fdc_interrupt ) -{ - m_IRQ_current_state = state; - m_disc2cpu->set_input_line(INPUT_LINE_IRQ0, state && m_hector_disc2_RNMI ? ASSERT_LINE : CLEAR_LINE); -} - -/* upd765 DRQ is connected to NMI of Z80 within a RNMI hardware authorization */ -WRITE_LINE_MEMBER( hec2hrp_state::disc2_fdc_dma_irq ) -{ - m_NMI_current_state = state; - m_disc2cpu->set_input_line(INPUT_LINE_NMI, state && m_hector_disc2_RNMI ? ASSERT_LINE : CLEAR_LINE); -} - -// RESET the disc2 Unit ! -void hec2hrp_state::hector_disc2_reset() -{ - // Initialization Disc2 unit - m_disc2cpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - machine().device("upd765")->reset(); - // Select ROM memory to cold restart - membank("bank3")->set_entry(DISCII_BANK_ROM); - - // Clear the Hardware's buffers - m_hector_disc2_data_r_ready=0x0; /* =ff when PC2 = true and data in read buffer (state->m_hector_disc2_data_read) */ - m_hector_disc2_data_w_ready=0x0; /* =ff when Disc 2 Port 40 had send a data in write buffer (state->m_hector_disc2_data_write) */ - m_hector_disc2_data_read=0; /* Data send by Hector to Disc 2 when PC2=true */ - m_hector_disc2_data_write=0; /* Data send by Disc 2 to Hector when Write Port I/O 40 */ - m_hector_disc2_RNMI = 0; /* State of I/O 50 D5 = authorization for INT / NMI */ - m_IRQ_current_state=0; /* Clear the IRQ active request */ - m_NMI_current_state=0; /* Clear the DMA active request */ -} - -/*****************************************************************************/ -/******************** Port handling of the Z80 Disc II unit *****************/ -/*****************************************************************************/ -READ8_MEMBER( hec2hrp_state::hector_disc2_io00_port_r) -{ - /* Switch Disc 2 to RAM to let full RAM acces */ - membank("bank3")->set_entry(DISCII_BANK_RAM); - return 0; -} -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io00_port_w) -{ - /* Switch Disc 2 to RAM to let full RAM acces */ - membank("bank3")->set_entry(DISCII_BANK_RAM); -} -READ8_MEMBER( hec2hrp_state::hector_disc2_io20_port_r) -{ - // You can implemente the 8251 chip communication here ! - return 0; -} -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io20_port_w) -{ - // You can implemente the 8251 chip communication here ! -} -READ8_MEMBER( hec2hrp_state::hector_disc2_io30_port_r) -{ - return m_hector_disc2_data_r_ready; -} -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io30_port_w) -{ - // Nothing here ! -} - -READ8_MEMBER( hec2hrp_state::hector_disc2_io40_port_r) -{ - /* Read data send by Hector, by Disc2*/ - m_hector_disc2_data_r_ready = 0x00; /* Clear memory info read ready*/ - return m_hector_disc2_data_read; /* send the data !*/ -} - -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io40_port_w) /* Write data send by Disc2, to Hector*/ -{ - m_hector_disc2_data_write = data; /* Memorization data*/ - m_hector_disc2_data_w_ready = 0x80; /* Memorization data write ready in D7*/ -} - -READ8_MEMBER( hec2hrp_state::hector_disc2_io50_port_r) /*Read memory info write ready*/ -{ - return m_hector_disc2_data_w_ready; -} - -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io50_port_w) /* I/O Port to the stuff of Disc2*/ -{ - upd765a_device *fdc = machine().device("upd765"); - - /* FDC Motor Control - Bit 0/1 defines the state of the FDD 0/1 motor */ - machine().device("upd765:0")->get_device()->mon_w(BIT(data, 0)); // Moteur floppy A: - machine().device("upd765:1")->get_device()->mon_w(BIT(data, 1)); // Moteur floppy B: - - /* Write bit TC uPD765 on D4 of port I/O 50 */ - fdc->tc_w(BIT(data, 4)); - - - /* Authorization interrupt and NMI with RNMI signal*/ - m_hector_disc2_RNMI = BIT(data, 5); - m_disc2cpu->set_input_line(INPUT_LINE_IRQ0, m_IRQ_current_state && m_hector_disc2_RNMI ? ASSERT_LINE : CLEAR_LINE); - m_disc2cpu->set_input_line(INPUT_LINE_NMI, m_NMI_current_state && m_hector_disc2_RNMI ? ASSERT_LINE : CLEAR_LINE); -} diff --git a/src/mess/machine/hp48.c b/src/mess/machine/hp48.c deleted file mode 100644 index 6c6ad253001..00000000000 --- a/src/mess/machine/hp48.c +++ /dev/null @@ -1,1176 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2008 - - Hewlett Packard HP48 S/SX & G/GX/G+ and HP49 G - -**********************************************************************/ - -#include "emu.h" -#include "sound/dac.h" -#include "cpu/saturn/saturn.h" - -#include "machine/nvram.h" - -#include "includes/hp48.h" - - -/*************************************************************************** - DEBUGGING -***************************************************************************/ - - -#define VERBOSE 0 -#define VERBOSE_SERIAL 0 - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG_SERIAL(x) do { if (VERBOSE_SERIAL) logerror x; } while (0) - - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -/* state field in hp48_module */ -#define HP48_MODULE_UNCONFIGURED 0 -#define HP48_MODULE_MASK_KNOWN 1 -#define HP48_MODULE_CONFIGURED 2 - -/*************************************************************************** - GLOBAL VARIABLES & CONSTANTS -***************************************************************************/ - -/* current HP48 model */ - -#define HP48_G_SERIES ((m_model==HP48_G) || (m_model==HP48_GX) || (m_model==HP48_GP)) -#define HP48_S_SERIES ((m_model==HP48_S) || (m_model==HP48_SX)) -#define HP48_X_SERIES ((m_model==HP48_SX) || (m_model==HP48_GX)) -#define HP48_GX_MODEL ((m_model==HP48_GX) || (m_model==HP48_GP)) -#define HP49_G_MODEL ((m_model==HP49_G)) - -static const char *const hp48_module_names[6] = -{ "HDW (I/O)", "NCE2 (RAM)", "CE1", "CE2", "NCE3", "NCE1 (ROM)" }; - -/* values returned by C=ID */ -static const UINT8 hp48_module_mask_id[6] = { 0x00, 0x03, 0x05, 0x07, 0x01, 0x00 }; -static const UINT8 hp48_module_addr_id[6] = { 0x19, 0xf4, 0xf6, 0xf8, 0xf2, 0x00 }; - - - - - -/*************************************************************************** - FUNCTIONS -***************************************************************************/ - -void hp48_state::hp48_pulse_irq( int irq_line) -{ - m_maincpu->set_input_line(irq_line, ASSERT_LINE ); - m_maincpu->set_input_line(irq_line, CLEAR_LINE ); -} - - -/* ---------------- serial --------------------- */ - -#define RS232_DELAY attotime::from_usec( 300 ) - -/* end of receive event */ -TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_recv_cb) -{ - LOG_SERIAL(( "%f hp48_rs232_byte_recv_cb: end of receive, data=%02x\n", - machine().time().as_double(), param )); - - m_io[0x14] = param & 0xf; /* receive zone */ - m_io[0x15] = param >> 4; - m_io[0x11] &= ~2; /* clear byte receiving */ - m_io[0x11] |= 1; /* set byte received */ - - /* interrupt */ - if ( m_io[0x10] & 2 ) - { - hp48_pulse_irq( SATURN_IRQ_LINE ); - } -} - -/* outside world initiates a receive event */ -void hp48_state::hp48_rs232_start_recv_byte( UINT8 data ) -{ - LOG_SERIAL(( "%f hp48_rs232_start_recv_byte: start receiving, data=%02x\n", - machine().time().as_double(), data )); - - m_io[0x11] |= 2; /* set byte receiving */ - - /* interrupt */ - if ( m_io[0x10] & 1 ) - { - hp48_pulse_irq( SATURN_IRQ_LINE ); - } - - /* schedule end of reception */ - machine().scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_recv_cb),this), data); -} - - -/* end of send event */ -TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_sent_cb) -{ - //device_image_interface *xmodem = dynamic_cast(machine().device("rs232_x")); - //device_image_interface *kermit = dynamic_cast(machine().device("rs232_k")); - - LOG_SERIAL(( "%f hp48_rs232_byte_sent_cb: end of send, data=%02x\n", - machine().time().as_double(), param )); - - m_io[0x12] &= ~3; /* clear byte sending and buffer full */ - - /* interrupt */ - if ( m_io[0x10] & 4 ) - { - hp48_pulse_irq( SATURN_IRQ_LINE ); - } - - /* protocol action */ - //if ( xmodem && xmodem->exists() ) xmodem_receive_byte( &xmodem->device(), param ); - //else if ( kermit && kermit->exists() ) kermit_receive_byte( &kermit->device(), param ); -} - -/* CPU initiates a send event */ -void hp48_state::hp48_rs232_send_byte( ) -{ - UINT8 data = HP48_IO_8(0x16); /* byte to send */ - - LOG_SERIAL(( "%s %f hp48_rs232_send_byte: start sending, data=%02x\n", - machine().describe_context(), machine().time().as_double(), data )); - - /* set byte sending and send buffer full */ - m_io[0x12] |= 3; - - /* schedule transmission */ - machine().scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_sent_cb),this), data); -} - - - - -/* ------ Saturn's IN / OUT registers ---------- */ - - -/* CPU sets OUT register (keyboard + beeper) */ -WRITE32_MEMBER( hp48_state::hp48_reg_out ) -{ - LOG(( "%s %f hp48_reg_out: %03x\n", - machine().describe_context(), machine().time().as_double(), data )); - - /* bits 0-8: keyboard lines */ - m_out = data & 0x1ff; - - /* bits 9-10: unused */ - - /* bit 11: beeper */ - m_dac->write_unsigned8((data & 0x800) ? 0x80 : 00 ); -} - -int hp48_state::hp48_get_in( ) -{ - int in = 0; - - /* regular keys */ - if ( (m_out >> 0) & 1 ) in |= ioport( "LINE0" )->read(); - if ( (m_out >> 1) & 1 ) in |= ioport( "LINE1" )->read(); - if ( (m_out >> 2) & 1 ) in |= ioport( "LINE2" )->read(); - if ( (m_out >> 3) & 1 ) in |= ioport( "LINE3" )->read(); - if ( (m_out >> 4) & 1 ) in |= ioport( "LINE4" )->read(); - if ( (m_out >> 5) & 1 ) in |= ioport( "LINE5" )->read(); - if ( (m_out >> 6) & 1 ) in |= ioport( "LINE6" )->read(); - if ( (m_out >> 7) & 1 ) in |= ioport( "LINE7" )->read(); - if ( (m_out >> 8) & 1 ) in |= ioport( "LINE8" )->read(); - - /* on key */ - in |= ioport( "ON" )->read(); - - return in; -} - -/* CPU reads IN register (keyboard) */ -READ32_MEMBER( hp48_state::hp48_reg_in ) -{ - int in = hp48_get_in(); - LOG(( "%s %f hp48_reg_in: %04x\n", - machine().describe_context(), machine().time().as_double(), in )); - return in; -} - -/* key detect */ -void hp48_state::hp48_update_kdn( ) -{ - int in = hp48_get_in(); - - /* interrupt on raising edge */ - if ( in && !m_kdn ) - { - LOG(( "%f hp48_update_kdn: interrupt\n", machine().time().as_double() )); - m_io[0x19] |= 8; /* service request */ - hp48_pulse_irq( SATURN_WAKEUP_LINE ); - hp48_pulse_irq( SATURN_IRQ_LINE ); - } - - m_kdn = (in!=0); -} - -/* periodic keyboard polling, generates an interrupt */ -TIMER_CALLBACK_MEMBER(hp48_state::hp48_kbd_cb) -{ - /* NMI for ON key */ - if ( ioport( "ON" )->read() ) - { - LOG(( "%f hp48_kbd_cb: keyboard interrupt, on key\n", - machine().time().as_double() )); - m_io[0x19] |= 8; /* set service request */ - hp48_pulse_irq( SATURN_WAKEUP_LINE ); - hp48_pulse_irq( SATURN_NMI_LINE ); - return; - } - - /* regular keys */ - hp48_update_kdn(); -} - -/* RSI opcode */ -WRITE_LINE_MEMBER( hp48_state::hp48_rsi ) -{ - LOG(( "%s %f hp48_rsi\n", machine().describe_context(), machine().time().as_double() )); - - /* enables interrupts on key repeat - (normally, there is only one interrupt, when the key is pressed) - */ - m_kdn = 0; -} - - -/* ------------- annonciators ------------ */ - -void hp48_state::hp48_update_annunciators() -{ - /* bit 0: left shift - bit 1: right shift - bit 2: alpha - bit 3: alert - bit 4: busy - bit 5: transmit - bit 7: master enable - */ - int markers = HP48_IO_8(0xb); - output_set_value( "lshift0", (markers & 0x81) == 0x81 ); - output_set_value( "rshift0", (markers & 0x82) == 0x82 ); - output_set_value( "alpha0", (markers & 0x84) == 0x84 ); - output_set_value( "alert0", (markers & 0x88) == 0x88 ); - output_set_value( "busy0", (markers & 0x90) == 0x90 ); - output_set_value( "transmit0", (markers & 0xb0) == 0xb0 ); -} - - -/* ------------- I/O registers ----------- */ - -/* Some part of the I/O registers are simple r/w registers. We store them in hp48_io. - Special cases are registers that: - - have a different meaning on read and write - - perform some action on read / write - */ - -WRITE8_MEMBER(hp48_state::hp48_io_w) -{ - LOG(( "%s %f hp48_io_w: off=%02x data=%x\n", - space.machine().describe_context(), space.machine().time().as_double(), offset, data )); - - switch( offset ) - { - /* CRC register */ - case 0x04: m_crc = (m_crc & 0xfff0) | data; break; - case 0x05: m_crc = (m_crc & 0xff0f) | (data << 4); break; - case 0x06: m_crc = (m_crc & 0xf0ff) | (data << 8); break; - case 0x07: m_crc = (m_crc & 0x0fff) | (data << 12); break; - - /* annunciators */ - case 0x0b: - case 0x0c: - m_io[offset] = data; - hp48_update_annunciators(); - break; - - /* cntrl ROM */ - case 0x29: - { - int old_cntrl = m_io[offset] & 8; - m_io[offset] = data; - if ( old_cntrl != (data & 8) ) - { - hp48_apply_modules(); - } - break; - } - - /* timers */ - case 0x37: m_timer1 = data; break; - case 0x38: m_timer2 = (m_timer2 & 0xfffffff0) | data; break; - case 0x39: m_timer2 = (m_timer2 & 0xffffff0f) | (data << 4); break; - case 0x3a: m_timer2 = (m_timer2 & 0xfffff0ff) | (data << 8); break; - case 0x3b: m_timer2 = (m_timer2 & 0xffff0fff) | (data << 12); break; - case 0x3c: m_timer2 = (m_timer2 & 0xfff0ffff) | (data << 16); break; - case 0x3d: m_timer2 = (m_timer2 & 0xff0fffff) | (data << 20); break; - case 0x3e: m_timer2 = (m_timer2 & 0xf0ffffff) | (data << 24); break; - case 0x3f: m_timer2 = (m_timer2 & 0x0fffffff) | (data << 28); break; - - /* cards */ - case 0x0e: - LOG(( "%s: card control write %02x\n", space.machine().describe_context(), data )); - - /* bit 0: software interrupt */ - if ( data & 1 ) - { - LOG(( "%f hp48_io_w: software interrupt requested\n", - space.machine().time().as_double() )); - hp48_pulse_irq( SATURN_IRQ_LINE ); - data &= ~1; - } - - /* XXX not implemented - bit 1: card test? - */ - - m_io[0x0e] = data; - break; - - case 0x0f: - LOG(( "%s: card info write %02x\n", space.machine().describe_context(), data )); - m_io[0x0f] = data; - break; - - /* serial */ - case 0x13: - m_io[0x11] &= ~4; /* clear error status */ - break; - case 0x16: - /* first nibble of sent data */ - m_io[offset] = data; - break; - case 0x17: - /* second nibble of sent data */ - m_io[offset] = data; - hp48_rs232_send_byte(); - break; - - /* XXX not implemented: - - - 0x0d: RS232c speed: - bits 0-2: speed - 000 = 1200 bauds - 010 = 2400 bauds - 100 = 4800 bauds - 110 = 9600 bauds - bit 3: ? - - - 0x1a: I/R input - bit 0: irq - bit 1: irq enable - bit 2: 1=RS232c mode 0=direct mode - bit 3: receiving - - - 0x1c: I/R output control - bit 0: buffer full - bit 1: transmitting - bit 2: irq enable on buffer empty - bit 3: led on (direct mode) - on HP49 G, flash ROM write enable - - - 0x1d: I/R output buffer - */ - - default: m_io[offset] = data; - } - -} - - -READ8_MEMBER(hp48_state::hp48_io_r) -{ - UINT8 data = 0; - - switch( offset ) - { - /* CRC register */ - case 0x04: data = m_crc & 0xf; break; - case 0x05: data = (m_crc >> 4) & 0xf; break; - case 0x06: data = (m_crc >> 8) & 0xf; break; - case 0x07: data = (m_crc >> 12) & 0xf; break; - - /* battery test */ - case 0x08: - data = 0; - if ( m_io[0x9] & 8 ) /* test enable */ - { - /* XXX not implemented: - bit 3: battery in port 2 - bit 2: battery in port 1 - */ - switch ( ioport( "BATTERY" )->read() ) - { - case 1: data = 2; break; /* low */ - case 2: data = 3; break; /* low | critical */ - } - } - break; - - /* remaining lines in main bitmap */ - case 0x28: - case 0x29: - { - int last_line = HP48_IO_8(0x28) & 0x3f; /* last line of main bitmap before menu */ - int cur_line = space.machine().first_screen()->vpos(); - if ( last_line <= 1 ) last_line = 0x3f; - data = ( cur_line >= 0 && cur_line <= last_line ) ? last_line - cur_line : 0; - if ( offset == 0x29 ) - { - data >>= 4; - data |= HP48_IO_4(0x29) & 0xc; - } - else - { - data &= 0xf; - } - break; - } - - /* timers */ - case 0x37: data = m_timer1; break; - case 0x38: data = m_timer2 & 0xf; break; - case 0x39: data = (m_timer2 >> 4) & 0xf; break; - case 0x3a: data = (m_timer2 >> 8) & 0xf; break; - case 0x3b: data = (m_timer2 >> 12) & 0xf; break; - case 0x3c: data = (m_timer2 >> 16) & 0xf; break; - case 0x3d: data = (m_timer2 >> 20) & 0xf; break; - case 0x3e: data = (m_timer2 >> 24) & 0xf; break; - case 0x3f: data = (m_timer2 >> 28) & 0xf; break; - - /* serial */ - case 0x15: - { - /* second nibble of received data */ - - //device_image_interface *xmodem = dynamic_cast(space.machine().device("rs232_x")); - //device_image_interface *kermit = dynamic_cast(space.machine().device("rs232_k")); - - m_io[0x11] &= ~1; /* clear byte received */ - data = m_io[offset]; - - /* protocol action */ - //if ( xmodem && xmodem->exists() ) xmodem_byte_transmitted( &xmodem->device() ); - //else if ( kermit && kermit->exists() ) kermit_byte_transmitted( &kermit->device() ); - break; - } - - /* cards */ - case 0x0e: /* detection */ - data = m_io[0x0e]; - LOG(( "%s: card control read %02x\n", space.machine().describe_context(), data )); - break; - case 0x0f: /* card info */ - data = 0; - if ( HP48_G_SERIES ) - { - if ( m_port_size[1] ) data |= 1; - if ( m_port_size[0] ) data |= 2; - if ( m_port_size[1] && m_port_write[1] ) data |= 4; - if ( m_port_size[0] && m_port_write[0] ) data |= 8; - } - else - { - if ( m_port_size[0] ) data |= 1; - if ( m_port_size[1] ) data |= 2; - if ( m_port_size[0] && m_port_write[0] ) data |= 4; - if ( m_port_size[1] && m_port_write[1] ) data |= 8; - } - LOG(( "%s: card info read %02x\n", space.machine().describe_context(), data )); - break; - - - default: data = m_io[offset]; - } - - LOG(( "%s %f hp48_io_r: off=%02x data=%x\n", - space.machine().describe_context(), space.machine().time().as_double(), offset, data )); - return data; -} - - -/* ---------- bank switcher --------- */ - -READ8_MEMBER(hp48_state::hp48_bank_r) -{ - /* HP48 GX - bit 0: ignored - bits 2-5: bank number - bit 6: enable - */ - - /* HP49 G - bit 0: ignored - bits 1-2: select bank 0x00000-0x3ffff - bits 3-6: select bank 0x40000-0x7ffff - */ - offset &= 0x7e; - if ( m_bank_switch != offset ) - { - LOG(( "%s %f hp48_bank_r: off=%03x\n", space.machine().describe_context(), space.machine().time().as_double(), offset )); - m_bank_switch = offset; - hp48_apply_modules(); - } - return 0; -} - - -WRITE8_MEMBER(hp48_state::hp49_bank_w) -{ - offset &= 0x7e; - if ( m_bank_switch != offset ) - { - LOG(( "%05x %f hp49_bank_w: off=%03x\n", space.device().safe_pcbase(), space.machine().time().as_double(), offset )); - m_bank_switch = offset; - hp48_apply_modules(); - } -} - - - -/* ---------------- timers --------------- */ - -TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer1_cb) -{ - if ( !(m_io[0x2f] & 1) ) return; /* timer enable */ - - m_timer1 = (m_timer1 - 1) & 0xf; - - /* wake-up on carry */ - if ( (m_io[0x2e] & 4) && (m_timer1 == 0xf) ) - { - LOG(( "wake-up on timer1\n" )); - m_io[0x2e] |= 8; /* set service request */ - m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( SATURN_WAKEUP_LINE ); - } - /* interrupt on carry */ - if ( (m_io[0x2e] & 2) && (m_timer1 == 0xf) ) - { - LOG(( "generate timer1 interrupt\n" )); - m_io[0x2e] |= 8; /* set service request */ - m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( SATURN_NMI_LINE ); - } -} - -TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer2_cb) -{ - if ( !(m_io[0x2f] & 1) ) return; /* timer enable */ - - m_timer2 = (m_timer2 - 1) & 0xffffffff; - - /* wake-up on carry */ - if ( (m_io[0x2f] & 4) && (m_timer2 == 0xffffffff) ) - { - LOG(( "wake-up on timer2\n" )); - m_io[0x2f] |= 8; /* set service request */ - m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( SATURN_WAKEUP_LINE ); - } - /* interrupt on carry */ - if ( (m_io[0x2f] & 2) && (m_timer2 == 0xffffffff) ) - { - LOG(( "generate timer2 interrupt\n" )); - m_io[0x2f] |= 8; /* set service request */ - m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( SATURN_NMI_LINE ); - } -} - - - - -/* --------- memory controller ----------- */ - -/* - Clark (S series) and York (G series) CPUs have 6 daisy-chained modules - - - <-- highest --------- priority ------------- lowest --> - - CPU --------------------------------------------------- - | | | | | | - HDW NCE2 CE1 CE2 NCE3 NCE1 - - - However, controller usage is different in both series: - - - controller 48 S series 48 G series 49 G series - (Clark CPU) (York CPU) (York CPU) - - HDW 32B I/O RAM 32B I/O RAM 32B I/O RAM - NCE2 32KB RAM 32/128KB RAM 256KB RAM - CE1 port1 bank switcher bank switcher - CE2 port2 port1 128KB RAM - NCE3 unused port2 128KB RAM - NCE1 256KB ROM 512KB ROM 2MB flash ROM - - - - NCE1 (ROM) cannot be configured, it is always visible at addresses - 00000-7ffff not covered by higher priority modules. - - - only the address of HDW (I/O) can be configured, its size is constant - (64 nibbles) - - - other modules can have their address & size set - - */ - - -/* remap all modules according to hp48_modules */ -void hp48_state::hp48_apply_modules() -{ - int i; - int nce3_enable = 1; - address_space& space = m_maincpu->space(AS_PROGRAM); - - m_io_addr = 0x100000; - - /* NCE1 (ROM) is a bit special, so treat it separately */ - space.unmap_readwrite( 0, 0xfffff, 0, 0 ); - if ( HP49_G_MODEL ) - { - int bank_lo = (m_bank_switch >> 5) & 3; - int bank_hi = (m_bank_switch >> 1) & 15; - LOG(( "hp48_apply_modules: low ROM bank is %i\n", bank_lo )); - LOG(( "hp48_apply_modules: high ROM bank is %i\n", bank_hi )); - space.install_read_bank( 0x00000, 0x3ffff, 0, 0x80000, "bank5" ); - space.install_read_bank( 0x40000, 0x7ffff, 0, 0x80000, "bank6" ); - if ( m_rom ) - { - membank("bank5")->set_base( m_rom + bank_lo * 0x40000 ); - membank("bank6")->set_base( m_rom + bank_hi * 0x40000 ); - } - } - else if ( HP48_G_SERIES ) - { - /* port 2 bank switch */ - if ( m_port_size[1] > 0 ) - { - int off = (m_bank_switch << 16) % m_port_size[1]; - LOG(( "hp48_apply_modules: port 2 offset is %i\n", off )); - m_modules[HP48_NCE3].data = m_port_data[1] + off; - } - - /* ROM A19 (hi 256 KB) / NCE3 (port 2) control switch */ - if ( m_io[0x29] & 8 ) - { - /* A19 */ - LOG(( "hp48_apply_modules: A19 enabled, NCE3 disabled\n" )); - nce3_enable = 0; - space.install_read_bank( 0, 0xfffff, 0, 0, "bank5" ); - } - else - { - /* NCE3 */ - nce3_enable = m_bank_switch >> 6; - LOG(( "hp48_apply_modules: A19 disabled, NCE3 %s\n", nce3_enable ? "enabled" : "disabled" )); - space.install_read_bank( 0, 0x7ffff, 0, 0x80000, "bank5" ); - } - if ( m_rom ) - membank("bank5")->set_base( m_rom ); - } - else - { - space.install_read_bank( 0, 0x7ffff, 0, 0x80000, "bank5" ); - if ( m_rom ) - membank("bank5")->set_base( m_rom ); - } - - - /* from lowest to highest priority */ - for ( i = 4; i >= 0; i-- ) - { - UINT32 select_mask = m_modules[i].mask; - UINT32 nselect_mask = ~select_mask & 0xfffff; - UINT32 base = m_modules[i].base; - UINT32 off_mask = m_modules[i].off_mask; - UINT32 mirror = nselect_mask & ~off_mask; - UINT32 end = base + (off_mask & nselect_mask); - char bank[10]; - sprintf(bank,"bank%d",i); - - if ( m_modules[i].state != HP48_MODULE_CONFIGURED ) continue; - - if ( (i == 4) && !nce3_enable ) continue; - - /* our code assumes that the 20-bit select_mask is all 1s followed by all 0s */ - if ( nselect_mask & (nselect_mask+1) ) - { - logerror( "hp48_apply_modules: invalid mask %05x for module %s\n", - select_mask, hp48_module_names[i] ); - continue; - } - - if (m_modules[i].data) - space.install_read_bank( base, end, 0, mirror, bank ); - else - { - if (!m_modules[i].read.isnull()) - space.install_read_handler( base, end, 0, mirror, m_modules[i].read ); - } - - if (m_modules[i].isnop) - space.nop_write(base, end, 0, mirror); - else - { - if (m_modules[i].data) - { - space.install_write_bank( base, end, 0, mirror, bank ); - } - else - { - if (!m_modules[i].write.isnull()) - space.install_write_handler( base, end, 0, mirror, m_modules[i].write ); - } - } - - LOG(( "hp48_apply_modules: module %s configured at %05x-%05x, mirror %05x\n", - hp48_module_names[i], base, end, mirror )); - - if ( m_modules[i].data ) - { - membank( bank )->set_base( m_modules[i].data ); - } - - if ( i == 0 ) - { - m_io_addr = base; - } - } -} - - -/* reset the configuration */ -void hp48_state::hp48_reset_modules( ) -{ - int i; - /* fixed size for HDW */ - m_modules[HP48_HDW].state = HP48_MODULE_MASK_KNOWN; - m_modules[HP48_HDW].mask = 0xfffc0; - /* unconfigure NCE2, CE1, CE2, NCE3 */ - for ( i = 1; i < 5; i++ ) - { - m_modules[i].state = HP48_MODULE_UNCONFIGURED; - } - - /* fixed configuration for NCE1 */ - m_modules[HP48_NCE1].state = HP48_MODULE_CONFIGURED; - m_modules[HP48_NCE1].base = 0; - m_modules[HP48_NCE1].mask = 0; - - hp48_apply_modules(); -} - - -/* RESET opcode */ -WRITE_LINE_MEMBER( hp48_state::hp48_mem_reset ) -{ - LOG(( "%s %f hp48_mem_reset\n", machine().describe_context(), machine().time().as_double() )); - hp48_reset_modules(); -} - - -/* CONFIG opcode */ -WRITE32_MEMBER( hp48_state::hp48_mem_config ) -{ - int i; - - LOG(( "%s %f hp48_mem_config: %05x\n", machine().describe_context(), machine().time().as_double(), data )); - - /* find the highest priority unconfigured module (except non-configurable NCE1)... */ - for ( i = 0; i < 5; i++ ) - { - /* ... first call sets the address mask */ - if ( m_modules[i].state == HP48_MODULE_UNCONFIGURED ) - { - m_modules[i].mask = data & 0xff000; - m_modules[i].state = HP48_MODULE_MASK_KNOWN; - break; - } - - /* ... second call sets the base address */ - if ( m_modules[i].state == HP48_MODULE_MASK_KNOWN ) - { - m_modules[i].base = data & m_modules[i].mask; - m_modules[i].state = HP48_MODULE_CONFIGURED; - LOG(( "hp48_mem_config: module %s configured base=%05x, mask=%05x\n", - hp48_module_names[i], m_modules[i].base, m_modules[i].mask )); - hp48_apply_modules(); - break; - } - } -} - - -/* UNCFG opcode */ -WRITE32_MEMBER( hp48_state::hp48_mem_unconfig ) -{ - int i; - LOG(( "%s %f hp48_mem_unconfig: %05x\n", machine().describe_context(), machine().time().as_double(), data )); - - /* find the highest priority fully configured module at address v (except NCE1)... */ - for ( i = 0; i < 5; i++ ) - { - /* ... and unconfigure it */ - if ( m_modules[i].state == HP48_MODULE_CONFIGURED && - (m_modules[i].base == (data & m_modules[i].mask)) ) - { - m_modules[i].state = i> 0 ? HP48_MODULE_UNCONFIGURED : HP48_MODULE_MASK_KNOWN; - LOG(( "hp48_mem_unconfig: module %s\n", hp48_module_names[i] )); - hp48_apply_modules(); - break; - } - } -} - - -/* C=ID opcode */ -READ32_MEMBER( hp48_state::hp48_mem_id ) -{ - int i; - int data = 0; /* 0 = everything is configured */ - - /* find the highest priority unconfigured module (except NCE1)... */ - for ( i = 0; i < 5; i++ ) - { - /* ... mask need to be configured */ - if ( m_modules[i].state == HP48_MODULE_UNCONFIGURED ) - { - data = hp48_module_mask_id[i] | (m_modules[i].mask & ~0xff); - break; - } - - /* ... address need to be configured */ - if ( m_modules[i].state == HP48_MODULE_MASK_KNOWN ) - { - data = hp48_module_addr_id[i] | (m_modules[i].base & ~0x3f); - break; - } - } - - LOG(( "%s %f hp48_mem_id = %02x\n", - machine().describe_context(), machine().time().as_double(), data )); - - return data; /* everything is configured */ -} - - - -/* --------- CRC ---------- */ - -/* each memory read by the CPU updates the internal CRC state */ -WRITE32_MEMBER( hp48_state::hp48_mem_crc ) -{ - /* no CRC for I/O RAM */ - if ( offset >= m_io_addr && offset < m_io_addr + 0x40 ) return; - - m_crc = (m_crc >> 4) ^ (((m_crc ^ data) & 0xf) * 0x1081); -} - - - -/* ------ utilities ------- */ - - -/* decodes size bytes into 2*size nibbles (least significant first) */ -void hp48_state::hp48_decode_nibble( UINT8* dst, UINT8* src, int size ) -{ - int i; - for ( i=size-1; i >= 0; i-- ) - { - dst[2*i+1] = src[i] >> 4; - dst[2*i] = src[i] & 0xf; - } -} - -/* inverse of hp48_decode_nibble */ -void hp48_state::hp48_encode_nibble( UINT8* dst, UINT8* src, int size ) -{ - int i; - for ( i=0; i < size; i++ ) - { - dst[i] = (src[2*i] & 0xf) | (src[2*i+1] << 4); - } -} - - - -/* ----- card images ------ */ -const device_type HP48_PORT = &device_creator; - -/* helper for load and create */ -void hp48_port_image_device::hp48_fill_port() -{ - hp48_state *state = machine().driver_data(); - int size = state->m_port_size[m_port]; - LOG(( "hp48_fill_port: %s module=%i size=%i rw=%i\n", tag(), m_module, size, state->m_port_write[m_port] )); - state->m_port_data[m_port] = global_alloc_array(UINT8, 2 * size); - memset( state->m_port_data[m_port], 0, 2 * size ); - state->m_modules[m_module].off_mask = 2 * (( size > 128 * 1024 ) ? 128 * 1024 : size) - 1; - state->m_modules[m_module].read = read8_delegate(); - state->m_modules[m_module].write = write8_delegate(); - state->m_modules[m_module].isnop = state->m_port_write[m_port] ? 0 : 1; - state->m_modules[m_module].data = state->m_port_data[m_port]; - state->hp48_apply_modules(); -} - -/* helper for start and unload */ -void hp48_port_image_device::hp48_unfill_port() -{ - hp48_state *state = machine().driver_data(); - LOG(( "hp48_unfill_port\n" )); - state->m_modules[m_module].off_mask = 0x00fff; /* 2 KB */ - state->m_modules[m_module].read = read8_delegate(); - state->m_modules[m_module].write = write8_delegate(); - state->m_modules[m_module].data = NULL; - state->m_modules[m_module].isnop = 1; - state->m_port_size[m_port] = 0; -} - - -bool hp48_port_image_device::call_load() -{ - hp48_state *state = machine().driver_data(); - int size = length(); - if ( size == 0 ) size = m_max_size; /* default size */ - LOG(( "hp48_port_image load: size=%i\n", size )); - - /* check size */ - if ( (size < 32*1024) || (size > m_max_size) || (size & (size-1)) ) - { - logerror( "hp48: image size for %s should be a power of two between %i and %i\n", tag(), 32*1024, m_max_size ); - return IMAGE_INIT_FAIL; - } - - state->m_port_size[m_port] = size; - state->m_port_write[m_port] = !is_readonly(); - hp48_fill_port( ); - fread(state->m_port_data[m_port], state->m_port_size[m_port] ); - state->hp48_decode_nibble( state->m_port_data[m_port], state->m_port_data[m_port], state->m_port_size[m_port] ); - return IMAGE_INIT_PASS; -} - -bool hp48_port_image_device::call_create(int format_type, option_resolution *format_options) -{ - hp48_state *state = machine().driver_data(); - int size = m_max_size; - LOG(( "hp48_port_image create: size=%i\n", size )); - /* XXX defaults to max_size; get user-specified size instead */ - - /* check size */ - /* size must be a power of 2 between 32K and max_size */ - if ( (size < 32*1024) || (size > m_max_size) || (size & (size-1)) ) - { - logerror( "hp48: image size for %s should be a power of two between %i and %i\n", tag(), 32*1024, m_max_size ); - return IMAGE_INIT_FAIL; - } - - state->m_port_size[m_port] = size; - state->m_port_write[m_port] = 1; - hp48_fill_port(); - return IMAGE_INIT_PASS; -} - -void hp48_port_image_device::call_unload() -{ - hp48_state *state = machine().driver_data(); - LOG(( "hp48_port image unload: %s size=%i rw=%i\n", - tag(), state->m_port_size[m_port], state->m_port_write[m_port] )); - if ( state->m_port_write[m_port] ) - { - state->hp48_encode_nibble( state->m_port_data[m_port], state->m_port_data[m_port], state->m_port_size[m_port] ); - fseek( 0, SEEK_SET ); - fwrite( state->m_port_data[m_port], state->m_port_size[m_port] ); - } - global_free_array( state->m_port_data[m_port] ); - hp48_unfill_port(); - state->hp48_apply_modules(); -} - -void hp48_port_image_device::device_start() -{ - LOG(("hp48_port_image start\n")); - hp48_unfill_port(); -} - -hp48_port_image_device::hp48_port_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, HP48_PORT, "HP48 memory card", tag, owner, clock, "hp48_port_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -void hp48_port_image_device::device_config_complete() -{ - update_names(HP48_PORT, "port", "p"); -} - -/*************************************************************************** - MACHINES -***************************************************************************/ - -DRIVER_INIT_MEMBER(hp48_state,hp48) -{ - int i; - LOG(( "hp48: driver init called\n" )); - for ( i = 0; i < 6; i++ ) - { - m_modules[i].off_mask = 0x00fff; /* 2 KB */ - m_modules[i].read = read8_delegate(); - m_modules[i].write = write8_delegate(); - m_modules[i].data = NULL; - m_modules[i].isnop = 0; - } - m_port_size[0] = 0; - m_port_size[1] = 0; - m_rom = NULL; -} - -void hp48_state::machine_reset() -{ - LOG(( "hp48: machine reset called\n" )); - m_bank_switch = 0; - hp48_reset_modules(); - hp48_update_annunciators(); -} - -void hp48_state::hp48_machine_start( hp48_models model ) -{ - UINT8 *ram; - int ram_size, rom_size, i; - - LOG(( "hp48_machine_start: model %i\n", model )); - - m_model = model; - - /* internal RAM */ - ram_size = - HP49_G_MODEL ? (512 * 1024) : - HP48_GX_MODEL ? (128 * 1024) : (32 * 1024); - - ram = auto_alloc_array(machine(), UINT8, 2 * ram_size); - machine().device("nvram")->set_base(ram, 2 * ram_size); - - - /* ROM load */ - rom_size = - HP49_G_MODEL ? (2048 * 1024) : - HP48_S_SERIES ? (256 * 1024) : (512 * 1024); - m_rom = auto_alloc_array(machine(), UINT8, 2 * rom_size); - hp48_decode_nibble( m_rom, memregion( "maincpu" )->base(), rom_size ); - - /* init state */ - memset( ram, 0, 2 * ram_size ); - memset( m_io, 0, sizeof( m_io ) ); - m_out = 0; - m_kdn = 0; - m_crc = 0; - m_timer1 = 0; - m_timer2 = 0; - m_bank_switch = 0; - - /* I/O RAM */ - m_modules[HP48_HDW].off_mask = 0x0003f; /* 32 B */ - m_modules[HP48_HDW].read = read8_delegate(FUNC(hp48_state::hp48_io_r),this); - m_modules[HP48_HDW].write = write8_delegate(FUNC(hp48_state::hp48_io_w),this); - - /* internal RAM */ - if ( HP49_G_MODEL ) - { - m_modules[HP48_NCE2].off_mask = 2 * 256 * 1024 - 1; - m_modules[HP48_NCE2].data = ram; - m_modules[HP48_CE2].off_mask = 2 * 128 * 1024 - 1; - m_modules[HP48_CE2].data = ram + 2 * 256 * 1024; - m_modules[HP48_NCE3].off_mask = 2 * 128 * 1024 - 1; - m_modules[HP48_NCE3].data = ram + 2 * (128+256) * 1024; - } - else - { - m_modules[HP48_NCE2].off_mask = 2 * ram_size - 1; - m_modules[HP48_NCE2].data = ram; - } - - /* bank switcher */ - if ( HP48_G_SERIES ) - { - m_modules[HP48_CE1].off_mask = 0x00fff; /* 2 KB */ - m_modules[HP48_CE1].read = read8_delegate(FUNC(hp48_state::hp48_bank_r),this); - m_modules[HP48_CE1].write = HP49_G_MODEL ? write8_delegate(FUNC(hp48_state::hp49_bank_w),this) : write8_delegate(); - } - - /* timers */ - machine().scheduler().timer_pulse(attotime::from_hz( 16 ), timer_expired_delegate(FUNC(hp48_state::hp48_timer1_cb),this)); - machine().scheduler().timer_pulse(attotime::from_hz( 8192 ), timer_expired_delegate(FUNC(hp48_state::hp48_timer2_cb),this)); - - /* 1ms keyboard polling */ - machine().scheduler().timer_pulse(attotime::from_msec( 1 ), timer_expired_delegate(FUNC(hp48_state::hp48_kbd_cb),this)); - - /* save state */ - save_item(NAME(m_out) ); - save_item(NAME(m_kdn) ); - save_item(NAME(m_io_addr) ); - save_item(NAME(m_crc) ); - save_item(NAME(m_timer1) ); - save_item(NAME(m_timer2) ); - save_item(NAME(m_bank_switch) ); - for ( i = 0; i < 6; i++ ) - { - save_item(m_modules[i].state, "globals/m_modules[i].state", i); - save_item(m_modules[i].base, "globals/m_modules[i].base", i); - save_item(m_modules[i].mask, "globals/m_modules[i].mask", i); - } - save_item(NAME(m_io) ); - machine().save().register_postload( save_prepost_delegate(FUNC(hp48_state::hp48_update_annunciators), this )); - machine().save().register_postload( save_prepost_delegate(FUNC(hp48_state::hp48_apply_modules), this )); - -} - - -MACHINE_START_MEMBER(hp48_state,hp48s) -{ - hp48_machine_start( HP48_S ); -} - - -MACHINE_START_MEMBER(hp48_state,hp48sx) -{ - hp48_machine_start( HP48_SX ); -} - - -MACHINE_START_MEMBER(hp48_state,hp48g) -{ - hp48_machine_start( HP48_G ); -} - -MACHINE_START_MEMBER(hp48_state,hp48gx) -{ - hp48_machine_start( HP48_GX ); -} - -MACHINE_START_MEMBER(hp48_state,hp48gp) -{ - hp48_machine_start( HP48_GP ); -} - -MACHINE_START_MEMBER(hp48_state,hp49g) -{ - hp48_machine_start( HP49_G ); -} diff --git a/src/mess/machine/ie15_kbd.c b/src/mess/machine/ie15_kbd.c deleted file mode 100644 index f98eb316092..00000000000 --- a/src/mess/machine/ie15_kbd.c +++ /dev/null @@ -1,325 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/*************************************************************************** - - 15WWW-97-006 keyboard, normally used with 15IE-00-013. - Irisha can use it too. - -***************************************************************************/ - -#include "machine/ie15_kbd.h" - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - - -ie15_keyboard_device::ie15_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source) - , m_io_kbd0(*this, "TERM_LINE0") - , m_io_kbd1(*this, "TERM_LINE1") - , m_io_kbd2(*this, "TERM_LINE2") - , m_io_kbd3(*this, "TERM_LINE3") - , m_io_kbdc(*this, "TERM_LINEC") - , m_keyboard_cb(*this) -{ -} - -ie15_keyboard_device::ie15_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, IE15_KEYBOARD, "15WWW-97-006 Keyboard", tag, owner, clock, "ie15_keyboard", __FILE__) - , m_io_kbd0(*this, "TERM_LINE0") - , m_io_kbd1(*this, "TERM_LINE1") - , m_io_kbd2(*this, "TERM_LINE2") - , m_io_kbd3(*this, "TERM_LINE3") - , m_io_kbdc(*this, "TERM_LINEC") - , m_keyboard_cb(*this) -{ -} - -UINT8 ie15_keyboard_device::row_number(UINT32 code) -{ - if BIT(code,0) return 0; - if BIT(code,1) return 1; - if BIT(code,2) return 2; - if BIT(code,3) return 3; - if BIT(code,4) return 4; - if BIT(code,5) return 5; - if BIT(code,6) return 6; - if BIT(code,7) return 7; - if BIT(code,8) return 8; - if BIT(code,9) return 9; - if BIT(code,10) return 10; - if BIT(code,11) return 11; - if BIT(code,12) return 12; - if BIT(code,13) return 13; - if BIT(code,14) return 14; - if BIT(code,15) return 15; - return 0; -} - -UINT16 ie15_keyboard_device::keyboard_handler(UINT16 last_code, UINT8 *scan_line) -{ - int i; - UINT32 code = 0; - UINT16 key_code = 0; - UINT16 retVal = 0; - UINT8 ctrl = BIT(m_io_kbdc->read(), 0); - UINT8 shift = BIT(m_io_kbdc->read(), 1); - - i = *scan_line; - { - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - - if (code != 0) - { - if (!m_ruslat) - i += 4; - if (shift) - i += 8; - i <<= 4; - if (code < 0x10000) { - key_code = m_rom [i + row_number(code)]; - } else { - key_code = m_rom [i + row_number(code >> 16)*2 + 256]; - } - if (ctrl) { - key_code &= 0x1f; - } - retVal = key_code; - } else { - *scan_line += 1; - if (*scan_line==4) { - *scan_line = 0; - } - } - } - - // setup mode toggle - if (BIT(m_io_kbdc->read(), 2)) { - retVal |= (IE_KB_SDV << 8); - } - // aux keyboard flag - if (code & 0xe0e000) { - retVal |= (IE_KB_DK << 8); - } - // shift - if (shift) { - retVal |= (IE_KB_NR << 8); - } - // SI/SO handling - if ((key_code & 127) == IE_KB_SI) { - m_ruslat = 0; - } - if ((key_code & 127) == IE_KB_SO) { - m_ruslat = 1; - } - - return retVal; -} - -void ie15_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - UINT16 new_code; - new_code = keyboard_handler(m_last_code, &m_scan_line); - if ((m_last_code != new_code) /* && (new_code) */) - send_key(new_code); - m_last_code = new_code; -} - -/*************************************************************************** - VIDEO HARDWARE -***************************************************************************/ - -ROM_START( ie15_keyboard ) - ROM_REGION( 0x200, "ie15kbd", 0 ) - ROM_LOAD( "15bbb.rt5", 0x000, 0x200, CRC(e6a4226e) SHA1(0ee46f5be1b01fa917a6d483bb51463106ae441f) ) -ROM_END - -const rom_entry *ie15_keyboard_device::device_rom_region() const -{ - return ROM_NAME( ie15_keyboard ); -} - -static MACHINE_CONFIG_FRAGMENT( ie15_keyboard ) -MACHINE_CONFIG_END - -machine_config_constructor ie15_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME(ie15_keyboard); -} - -void ie15_keyboard_device::device_start() -{ - m_keyboard_cb.resolve_safe(); - m_timer = timer_alloc(); - m_rom = (UINT8*)memregion("ie15kbd")->base(); -} - -void ie15_keyboard_device::device_reset() -{ - m_last_code = 0; - m_scan_line = 0; - m_ruslat = 0; - m_timer->adjust(attotime::from_hz(10000), 0, attotime::from_hz(10000)); -} - -/* -Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 Y10 Y11 Y12 Y13 Y14 Y15 Y16 Y17 Y18 Y19 Y20 Y21 Y22 Y23 Y24 --- -;+ 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 -= 7 8 9 ?????? ???? ?????? ?????? ?????? f1 f2 f3 -??J ??C ??U ??K ??E ??N ??G ??[ ??] ??Z ??H :* 4 5 6 ???? ???? ????1 ??1 ????2 f4 f5 f6 -??F ??Y ??W ??A ??P ??R ??O ??L ??D ??V ??\ .> ???? 1 2 3 ?????? ?????? ?????? f7 f8 f9 -??Q ??^ ??S ??M ??I ??T ??X ??B ??@ ,< /? _ SPC 0 , fA fB fC - -rom: - -00000000 3b 31 32 33 34 35 36 37 38 39 30 2d 00 37 38 39 |;1234567890-.789| rus + upper -00000010 6a 63 75 6b 65 6e 67 7b 7d 7a 68 3a 00 34 35 36 |jcukeng{}zh:.456| -00000020 66 79 77 61 70 72 6f 6c 64 76 7c 2e 7f 31 32 33 |fywaproldv|..123| -00000030 71 7e 73 6d 69 74 78 62 60 2c 2f 7f 20 30 30 2c |q~smitxb`,/. 00,| - -00000040 3b 31 32 33 34 35 36 37 38 39 30 2d 00 37 38 39 |;1234567890-.789| lat + upper -00000050 4a 43 55 4b 45 4e 47 5b 5d 5a 48 3a 00 34 35 36 |JCUKENG[]ZH:.456| -00000060 46 59 57 41 50 52 4f 4c 44 56 5c 2e 7f 31 32 33 |FYWAPROLDV\..123| -00000070 51 5e 53 4d 49 54 58 42 40 2c 2f 5f 20 30 30 2c |Q^SMITXB@,/_ 00,| - -00000080 2b 21 22 23 24 25 26 27 28 29 30 3d 00 37 38 39 |+!"#$%&'()0=.789| rus + lower -00000090 4a 43 55 4b 45 4e 47 5b 5d 5a 48 2a 00 34 35 36 |JCUKENG[]ZH*.456| -000000a0 46 59 57 41 50 52 4f 4c 44 56 5c 3e 7f 31 32 33 |FYWAPROLDV\>.123| -000000b0 51 5e 53 4d 49 54 58 42 40 3c 3f 5f 20 30 30 2c |Q^SMITXB@.123| -000000f0 71 7e 73 6d 69 74 78 62 60 3c 3f 7f 20 30 30 2c |q~smitxb`') - PORT_BIT(0x001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x010000, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x020000, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRD") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRM") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRS") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT(0x200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("TERM_LINE3") - PORT_BIT(0x000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // PORT_CHAR('`') PORT_CHAR('@') // XXX - PORT_BIT(0x000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('_') // XXX - PORT_BIT(0x001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x004000, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lat (SO)") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Rus (SI)") PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x040000, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x080000, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x100000, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgDn") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_BIT(0x400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Next SetUp") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - - PORT_START("TERM_LINEC") - PORT_BIT(0x000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) -// PORT_BIT(0x000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SetUp") PORT_CODE(KEYCODE_RSHIFT) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - PORT_BIT(0x000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SetUp") PORT_CODE(KEYCODE_PRTSCR) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) -INPUT_PORTS_END - -ioport_constructor ie15_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(ie15_keyboard); -} - -const device_type IE15_KEYBOARD = &device_creator; diff --git a/src/mess/machine/ie15_kbd.h b/src/mess/machine/ie15_kbd.h deleted file mode 100644 index 49967d68eff..00000000000 --- a/src/mess/machine/ie15_kbd.h +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -#ifndef __IE15_KEYBOARD_H__ -#define __IE15_KEYBOARD_H__ - -#include "emu.h" - -#define IE_KB_ACK 1 - -#define IE_KB_RED 0x01 -#define IE_KB_SDV 0x02 -#define IE_KB_DUP 0x08 -#define IE_KB_LIN 0x10 -#define IE_KB_DK 0x20 -#define IE_KB_PCH 0x40 -#define IE_KB_NR 0x80 - -#define IE_KB_RED_BIT 0 -#define IE_KB_SDV_BIT 1 -#define IE_KB_DUP_BIT 3 -#define IE_KB_LIN_BIT 4 -#define IE_KB_DK_BIT 5 -#define IE_KB_PCH_BIT 6 -#define IE_KB_NR_BIT 7 - -#define IE_KB_SI 0x0f -#define IE_KB_SO 0x0e - - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_IE15_KEYBOARD_CB(_devcb) \ - devcb = &ie15_keyboard_device::set_keyboard_callback(*device, DEVCB_##_devcb); - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -class ie15_keyboard_device : - public device_t -{ -public: - ie15_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - ie15_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_keyboard_callback(device_t &device, _Object object) { return downcast(device).m_keyboard_cb.set_callback(object); } - - virtual ioport_constructor device_input_ports() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual const rom_entry *device_rom_region() const; - -protected: - required_ioport m_io_kbd0; - required_ioport m_io_kbd1; - required_ioport m_io_kbd2; - required_ioport m_io_kbd3; - required_ioport m_io_kbdc; - - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void send_key(UINT16 code) { m_keyboard_cb((offs_t)0, code); } - emu_timer *m_timer; - -private: - virtual UINT16 keyboard_handler(UINT16 last_code, UINT8 *scan_line); - UINT8 row_number(UINT32 code); - UINT16 m_last_code; - UINT8 m_scan_line; - UINT8 m_ruslat; - UINT8 *m_rom; - - devcb_write16 m_keyboard_cb; -}; - -extern const device_type IE15_KEYBOARD; - -#endif /* __IE15_KEYBOARD_H__ */ diff --git a/src/mess/machine/intv.c b/src/mess/machine/intv.c deleted file mode 100644 index 391abbd4150..00000000000 --- a/src/mess/machine/intv.c +++ /dev/null @@ -1,532 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,Frank Palazzolo -#include "emu.h" -#include "video/stic.h" -#include "includes/intv.h" -#include "cpu/cp1610/cp1610.h" - - - -WRITE16_MEMBER( intv_state::intvkbd_dualport16_w ) -{ - unsigned char *RAM; - - COMBINE_DATA(&m_intvkbd_dualport_ram[offset]); - - /* copy the LSB over to the 6502 OP RAM, in case they are opcodes */ - RAM = m_region_keyboard->base(); - RAM[offset] = (UINT8) (data >> 0); -} - -READ8_MEMBER( intv_state::intvkbd_dualport8_lsb_r ) -{ - return (UINT8) (m_intvkbd_dualport_ram[offset] >> 0); -} - -WRITE8_MEMBER( intv_state::intvkbd_dualport8_lsb_w ) -{ - unsigned char *RAM; - - m_intvkbd_dualport_ram[offset] &= ~0x00FF; - m_intvkbd_dualport_ram[offset] |= ((UINT16) data) << 0; - - /* copy over to the 6502 OP RAM, in case they are opcodes */ - RAM = m_region_keyboard->base(); - RAM[offset] = data; -} - - - -READ8_MEMBER( intv_state::intvkbd_dualport8_msb_r ) -{ - unsigned char rv; - - if (offset < 0x100) - { - switch (offset) - { - case 0x000: - rv = m_io_test->read() & 0x80; - logerror("TAPE: Read %02x from 0x40%02x - XOR Data?\n",rv,offset); - break; - case 0x001: - rv = (m_io_test->read() & 0x40) << 1; - logerror("TAPE: Read %02x from 0x40%02x - Sense 1?\n",rv,offset); - break; - case 0x002: - rv = (m_io_test->read() & 0x20) << 2; - logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset); - break; - case 0x003: - rv = (m_io_test->read() & 0x10) << 3; - logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset); - break; - case 0x004: - rv = (m_io_test->read() & 0x08) << 4; - logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset); - break; - case 0x005: - rv = (m_io_test->read() & 0x04) << 5; - logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset); - break; - case 0x006: - if (m_sr1_int_pending) - rv = 0x00; - else - rv = 0x80; - logerror("TAPE: Read %02x from 0x40%02x - SR1 Int Pending\n",rv,offset); - break; - case 0x007: - if (m_tape_int_pending) - rv = 0x00; - else - rv = 0x80; - logerror("TAPE: Read %02x from 0x40%02x - Tape? Int Pending\n",rv,offset); - break; - case 0x060: /* Keyboard Read */ - rv = 0xff; - if (m_intvkbd_keyboard_col < 10) - rv = m_intv_keyboard[m_intvkbd_keyboard_col]->read(); - break; - case 0x80: - rv = 0x00; - logerror("TAPE: Read %02x from 0x40%02x, clear tape int pending\n",rv,offset); - m_tape_int_pending = 0; - break; - case 0xa0: - rv = 0x00; - logerror("TAPE: Read %02x from 0x40%02x, clear SR1 int pending\n",rv,offset); - m_sr1_int_pending = 0; - break; - case 0xc0: - case 0xc1: - case 0xc2: - case 0xc3: - case 0xc4: - case 0xc5: - case 0xc6: - case 0xc7: - case 0xc8: - case 0xc9: - case 0xca: - case 0xcb: - case 0xcc: - case 0xcd: - case 0xce: - case 0xcf: - /* TMS9927 regs */ - rv = intvkbd_tms9927_r(space, offset-0xc0); - break; - default: - rv = (m_intvkbd_dualport_ram[offset]&0x0300)>>8; - logerror("Unknown read %02x from 0x40%02x\n",rv,offset); - break; - } - return rv; - } - else - return (m_intvkbd_dualport_ram[offset]&0x0300)>>8; -} - -static const char *const tape_motor_mode_desc[8] = -{ - "IDLE", "IDLE", "IDLE", "IDLE", - "EJECT", "PLAY/RECORD", "REWIND", "FF" -}; - -WRITE8_MEMBER( intv_state::intvkbd_dualport8_msb_w ) -{ - unsigned int mask; - - if (offset < 0x100) - { - switch (offset) - { - case 0x020: - m_tape_motor_mode &= 3; - if (data & 1) - m_tape_motor_mode |= 4; - logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]); - break; - case 0x021: - m_tape_motor_mode &= 5; - if (data & 1) - m_tape_motor_mode |= 2; - logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]); - break; - case 0x022: - m_tape_motor_mode &= 6; - if (data & 1) - m_tape_motor_mode |= 1; - logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]); - break; - case 0x023: - case 0x024: - case 0x025: - case 0x026: - case 0x027: - m_tape_unknown_write[offset - 0x23] = (data & 1); - break; - case 0x040: - m_tape_unknown_write[5] = (data & 1); - break; - case 0x041: - if (data & 1) - logerror("TAPE: Tape Interrupts Enabled\n"); - else - logerror("TAPE: Tape Interrupts Disabled\n"); - m_tape_interrupts_enabled = (data & 1); - break; - case 0x042: - if (data & 1) - logerror("TAPE: Cart Bus Interrupts Disabled\n"); - else - logerror("TAPE: Cart Bus Interrupts Enabled\n"); - break; - case 0x043: - if (data & 0x01) - m_intvkbd_text_blanked = 0; - else - m_intvkbd_text_blanked = 1; - break; - case 0x044: - m_intvkbd_keyboard_col &= 0x0e; - m_intvkbd_keyboard_col |= (data&0x01); - break; - case 0x045: - m_intvkbd_keyboard_col &= 0x0d; - m_intvkbd_keyboard_col |= ((data&0x01)<<1); - break; - case 0x046: - m_intvkbd_keyboard_col &= 0x0b; - m_intvkbd_keyboard_col |= ((data&0x01)<<2); - break; - case 0x047: - m_intvkbd_keyboard_col &= 0x07; - m_intvkbd_keyboard_col |= ((data&0x01)<<3); - break; - case 0x80: - logerror("TAPE: Write to 0x40%02x, clear tape int pending\n",offset); - m_tape_int_pending = 0; - break; - case 0xa0: - logerror("TAPE: Write to 0x40%02x, clear SR1 int pending\n",offset); - m_sr1_int_pending = 0; - break; - case 0xc0: - case 0xc1: - case 0xc2: - case 0xc3: - case 0xc4: - case 0xc5: - case 0xc6: - case 0xc7: - case 0xc8: - case 0xc9: - case 0xca: - case 0xcb: - case 0xcc: - case 0xcd: - case 0xce: - case 0xcf: - /* TMS9927 regs */ - intvkbd_tms9927_w(space, offset-0xc0, data); - break; - default: - logerror("%04X: Unknown write %02x to 0x40%02x\n",space.device().safe_pc(),data,offset); - break; - } - } - else - { - mask = m_intvkbd_dualport_ram[offset] & 0x00ff; - m_intvkbd_dualport_ram[offset] = mask | ((data<<8)&0x0300); - } -} - - -READ16_MEMBER( intv_state::intv_stic_r ) -{ - if (m_bus_copy_mode || !m_stic->read_stic_handshake()) - return m_stic->read(space, offset, mem_mask); - else - return offset; -} - -WRITE16_MEMBER( intv_state::intv_stic_w ) -{ - if (m_bus_copy_mode || !m_stic->read_stic_handshake()) - m_stic->write(space, offset, data, mem_mask); -} - - -READ16_MEMBER( intv_state::intv_gram_r ) -{ - //logerror("read: %d = GRAM(%d)\n",state->m_gram[offset],offset); - if (m_bus_copy_mode || !m_stic->read_stic_handshake()) - return m_stic->gram_read(space, offset, mem_mask); - else - return offset; -} - -WRITE16_MEMBER( intv_state::intv_gram_w ) -{ - if (m_bus_copy_mode || !m_stic->read_stic_handshake()) - m_stic->gram_write(space, offset, data, mem_mask); -} - -READ16_MEMBER( intv_state::intv_ram8_r ) -{ - //logerror("%x = ram8_r(%x)\n",state->m_ram8[offset],offset); - return (int)m_ram8[offset]; -} - -WRITE16_MEMBER( intv_state::intv_ram8_w ) -{ - //logerror("ram8_w(%x) = %x\n",offset,data); - m_ram8[offset] = data&0xff; -} - -READ16_MEMBER( intv_state::intv_ram16_r ) -{ - //logerror("%x = ram16_r(%x)\n",state->m_ram16[offset],offset); - return (int)m_ram16[offset]; -} - -WRITE16_MEMBER( intv_state::intv_ram16_w ) -{ - //logerror("%g: WRITING TO GRAM offset = %d\n",machine.time(),offset); - //logerror("ram16_w(%x) = %x\n",offset,data); - m_ram16[offset] = data & 0xffff; -} - -READ8_MEMBER( intv_state::intvkb_iocart_r ) -{ - if (m_iocart1->exists()) - return m_iocart1->read_rom(space, offset, mem_mask); - else if (m_iocart2->exists()) - return m_iocart2->read_rom(space, offset, mem_mask); - else - return m_region_keyboard->u8(offset + 0xe000); -} - - -/* Set Reset and INTR/INTRM Vector */ -void intv_state::machine_reset() -{ - m_maincpu->set_input_line_vector(CP1610_RESET, 0x1000); - - /* These are actually the same vector, and INTR is unused */ - m_maincpu->set_input_line_vector(CP1610_INT_INTRM, 0x1004); - m_maincpu->set_input_line_vector(CP1610_INT_INTR, 0x1004); - - /* Set initial PC */ - m_maincpu->set_state_int(CP1610_R7, 0x1000); -} - -void intv_state::machine_start() -{ - // TODO: split these for intvkbd & intvecs?? - for (int i = 0; i < 4; i++) - { - char str[8]; - sprintf(str, "KEYPAD%i", i + 1); - m_keypad[i] = ioport(str); - } - for (int i = 0; i < 4; i++) - { - char str[6]; - sprintf(str, "DISC%i", i + 1); - m_disc[i] = ioport(str); - } - for (int i = 0; i < 4; i++) - { - char str[7]; - sprintf(str, "DISCX%i", i + 1); - m_discx[i] = ioport(str); - sprintf(str, "DISCY%i", i + 1); - m_discy[i] = ioport(str); - } - - save_item(NAME(m_bus_copy_mode)); - save_item(NAME(m_backtab_row)); - save_item(NAME(m_ram16)); - save_item(NAME(m_sr1_int_pending)); - save_item(NAME(m_ram8)); - - // intvkbd - if (m_is_keybd) - { - for (int i = 0; i < 10; i++) - { - char str[5]; - sprintf(str, "ROW%i", i); - m_intv_keyboard[i] = ioport(str); - } - - save_item(NAME(m_intvkbd_text_blanked)); - save_item(NAME(m_intvkbd_keyboard_col)); - save_item(NAME(m_tape_int_pending)); - save_item(NAME(m_tape_interrupts_enabled)); - save_item(NAME(m_tape_unknown_write)); - save_item(NAME(m_tape_motor_mode)); - save_item(NAME(m_tms9927_num_rows)); - save_item(NAME(m_tms9927_cursor_col)); - save_item(NAME(m_tms9927_cursor_row)); - save_item(NAME(m_tms9927_last_row)); - } - - if (m_cart && m_cart->exists()) - { - // RAM - switch (m_cart->get_type()) - { - case INTV_RAM: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xd000, 0xd7ff, read16_delegate(FUNC(intv_cart_slot_device::read_ram),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_ram),(intv_cart_slot_device*)m_cart)); - break; - case INTV_GFACT: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x8800, 0x8fff, read16_delegate(FUNC(intv_cart_slot_device::read_ram),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_ram),(intv_cart_slot_device*)m_cart)); - break; - case INTV_VOICE: - m_cart->late_subslot_setup(); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0080, 0x0081, read16_delegate(FUNC(intv_cart_slot_device::read_speech),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_speech),(intv_cart_slot_device*)m_cart)); - - // passthru for RAM-equipped carts - m_maincpu->space(AS_PROGRAM).install_write_handler(0x8800, 0x8fff, write16_delegate(FUNC(intv_cart_slot_device::write_88),(intv_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd000, 0xd7ff, write16_delegate(FUNC(intv_cart_slot_device::write_d0),(intv_cart_slot_device*)m_cart)); - break; - case INTV_ECS: - m_cart->late_subslot_setup(); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x00f0, 0x00ff, read16_delegate(FUNC(intv_cart_slot_device::read_ay),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_ay),(intv_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x4000, 0x47ff, read16_delegate(FUNC(intv_cart_slot_device::read_ram),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_ram),(intv_cart_slot_device*)m_cart)); - - m_maincpu->space(AS_PROGRAM).install_write_handler(0x2000, 0x2fff, write16_delegate(FUNC(intv_cart_slot_device::write_rom20),(intv_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x7000, 0x7fff, write16_delegate(FUNC(intv_cart_slot_device::write_rom70),(intv_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000, 0xefff, write16_delegate(FUNC(intv_cart_slot_device::write_rome0),(intv_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xf000, 0xffff, write16_delegate(FUNC(intv_cart_slot_device::write_romf0),(intv_cart_slot_device*)m_cart)); - - // passthru for Intellivoice expansion - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0080, 0x0081, read16_delegate(FUNC(intv_cart_slot_device::read_speech),(intv_cart_slot_device*)m_cart), write16_delegate(FUNC(intv_cart_slot_device::write_speech),(intv_cart_slot_device*)m_cart)); - - // passthru for RAM-equipped carts - m_maincpu->space(AS_PROGRAM).install_write_handler(0x8800, 0x8fff, write16_delegate(FUNC(intv_cart_slot_device::write_88),(intv_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0xd000, 0xd7ff, write16_delegate(FUNC(intv_cart_slot_device::write_d0),(intv_cart_slot_device*)m_cart)); - break; - } - - m_cart->save_ram(); - } -} - - -TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt_complete) -{ - m_maincpu->set_input_line(CP1610_INT_INTRM, CLEAR_LINE); - m_bus_copy_mode = 0; -} - -TIMER_CALLBACK_MEMBER(intv_state::intv_btb_fill) -{ - UINT8 row = m_backtab_row; - //m_maincpu->adjust_icount(-STIC_ROW_FETCH); - - for (int column = 0; column < STIC_BACKTAB_WIDTH; column++) - m_stic->write_to_btb(row, column, m_ram16[column + row * STIC_BACKTAB_WIDTH]); - - m_backtab_row += 1; -} - -INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt) -{ - int delay = m_stic->read_row_delay(); - m_maincpu->set_input_line(CP1610_INT_INTRM, ASSERT_LINE); - m_sr1_int_pending = 1; - m_bus_copy_mode = 1; - m_backtab_row = 0; - - m_maincpu->adjust_icount(-(12*STIC_ROW_BUSRQ+STIC_FRAME_BUSRQ)); // Account for stic cycle stealing - timer_set(m_maincpu->cycles_to_attotime(STIC_VBLANK_END), TIMER_INTV_INTERRUPT_COMPLETE); - for (int row = 0; row < STIC_BACKTAB_HEIGHT; row++) - { - timer_set(m_maincpu->cycles_to_attotime(STIC_FIRST_FETCH-STIC_FRAME_BUSRQ+STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*delay + (STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*STIC_CARD_HEIGHT - STIC_ROW_BUSRQ)*row), TIMER_INTV_BTB_FILL); - } - - if (delay == 0) - { - m_maincpu->adjust_icount(-STIC_ROW_BUSRQ); // extra row fetch occurs if vertical delay == 0 - } - - m_stic->screenrefresh(); -} - -/* hand 0 == left, 1 == right, 2 == ECS hand controller 1, 3 == ECS hand controller 2 */ -UINT8 intv_state::intv_control_r(int hand) -{ - static const UINT8 keypad_table[] = - { - 0xFF, 0x3F, 0x9F, 0x5F, 0xD7, 0xB7, 0x77, 0xDB, - 0xBB, 0x7B, 0xDD, 0xBD, 0x7D, 0xDE, 0xBE, 0x7E - }; - - static const UINT8 disc_table[] = - { - 0xF3, 0xE3, 0xE7, 0xF7, 0xF6, 0xE6, 0xEE, 0xFE, - 0xFC, 0xEC, 0xED, 0xFD, 0xF9, 0xE9, 0xEB, 0xFB - }; - - static const UINT8 discyx_table[5][5] = - { - { 0xE3, 0xF3, 0xFB, 0xEB, 0xE9 }, - { 0xE7, 0xE3, 0xFB, 0xE9, 0xF9 }, - { 0xF7, 0xF7, 0xFF, 0xFD, 0xFD }, - { 0xF6, 0xE6, 0xFE, 0xEC, 0xED }, - { 0xE6, 0xEE, 0xFE, 0xFC, 0xEC } - }; - - int x, y; - UINT8 rv = 0xFF; - - /* keypad */ - x = m_keypad[hand]->read(); - for (y = 0; y < 16; y++) - { - if (x & (1 << y)) - { - rv &= keypad_table[y]; - } - } - - switch ((m_io_options->read() >> hand) & 1) - { - case 0: /* disc == digital */ - default: - - x = m_disc[hand]->read(); - for (y = 0; y < 16; y++) - { - if (x & (1 << y)) - { - rv &= disc_table[y]; - } - } - break; - - case 1: /* disc == _fake_ analog */ - - x = m_discx[hand]->read(); - y = m_discy[hand]->read(); - rv &= discyx_table[y / 32][x / 32]; - } - - return rv; -} - -READ8_MEMBER( intv_state::intv_left_control_r ) -{ - return intv_control_r(0); -} - -READ8_MEMBER( intv_state::intv_right_control_r ) -{ - return intv_control_r(1); -} diff --git a/src/mess/machine/isbc_215g.c b/src/mess/machine/isbc_215g.c deleted file mode 100644 index 000c620d1a7..00000000000 --- a/src/mess/machine/isbc_215g.c +++ /dev/null @@ -1,433 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -// Currently only emulates Shugart SA1000 interface disks (aka ST506) -// despite the controller supporting many different disk types (hard sectored, onboard controllers, ANSI X3T9) -// Xenix supports the Quantum Q540 CHS 512,8,9 with 1024B sectors - -// TODO: multibus - -#include "isbc_215g.h" - -const device_type ISBC_215G = &device_creator; - -isbc_215g_device::isbc_215g_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, ISBC_215G, "ISBC 215G Winchester Disk Controller", tag, owner, clock, "isbc_215g", __FILE__), - m_dmac(*this, "u84"), - m_hdd0(*this, "drive0"), - m_hdd1(*this, "drive1"), - m_sbx1(*this, "sbx1"), - m_sbx2(*this, "sbx2"), - m_out_irq_func(*this) -{ -} - -void isbc_215g_device::find_sector() -{ - //sector id - // 0/6-7: sector type - 0-data, 1-alternate, 2-bad, 3-invalid - // 0/4-5: size - 128<> 4) & 3); - - if(!m_geom[m_drive]) - return; - - if(m_cyl[m_drive] != cyl) - return; - - if((m_idcompare[3] != m_head) || (m_head > m_geom[m_drive]->heads)) - return; - - if(m_idcompare[2] > m_geom[m_drive]->sectors) - return; - - if(bps != m_geom[m_drive]->sectorbytes) - return; - - if(m_idcompare[0] >> 6) - return; - - m_idfound = true; - m_lba[m_drive] = (cyl * m_geom[m_drive]->heads + m_head) * m_geom[m_drive]->sectors + m_idcompare[2]; - m_secoffset = 0; - return; -} - -UINT16 isbc_215g_device::read_sector() -{ - UINT16 wps = 64 << ((m_idcompare[0] >> 4) & 3); - harddisk_image_device *drive = (m_drive ? m_hdd1 : m_hdd0); - if(!m_secoffset) - hard_disk_read(drive->get_hard_disk_file(), m_lba[m_drive], m_sector); - if(m_secoffset >= wps) - return 0; - return m_sector[m_secoffset++]; -} - -bool isbc_215g_device::write_sector(UINT16 data) -{ - UINT16 wps = 64 << ((m_idcompare[0] >> 4) & 3); - harddisk_image_device *drive = (m_drive ? m_hdd1 : m_hdd0); - if(m_secoffset >= wps) - return true; - m_sector[m_secoffset++] = data; - if(m_secoffset == wps) - { - hard_disk_write(drive->get_hard_disk_file(), m_lba[m_drive], m_sector); - return true; - } - return false; -} - -READ16_MEMBER(isbc_215g_device::io_r) -{ - UINT16 data = 0; - switch(offset) - { - case 0x00: - //read status - // 0: gnd - // 1: drive ready - // 2: seek done - // 3: sector sync found - // 4: fault - // 5: bus ack - // 6: sector id not found or bad ecc - // 7: timeout - // 8: sbx 1 present - // 9: sbx 1 int 0 - // a: sbx 1 int 1 - // b: sbx 1 opt 0 - // c: sbx 1 opt 1 - // d: illegal req/vendor 2 - // e: drive req - // f: index latch - data |= (!m_idfound) << 6; - data |= (m_sbx1->get_card_device() ? 0 : 1) << 8; - data |= m_isbx_irq[0] << 9; - data |= m_isbx_irq[1] << 10; - data |= ((m_index--) <= 0) ? 0x8000 : 0; // fake an index pulse - break; - case 0x04: - //read status 2 - // 0: sbx 2 present - // 1: sbx 2 int 0 - // 2: sbx 2 int 1 - // 3: sbx 2 opt 0 - // 4: sbx 2 opt 1 - // 5: vendor bit 0 - // 6: track 0/busy - // 7: wp - data |= m_sbx2->get_card_device() ? 0 : 1; - data |= m_isbx_irq[2] << 1; - data |= m_isbx_irq[3] << 2; - data |= (!m_cyl[m_drive]) ? 0 : 0x40; - break; - case 0x08: - //cmd data bus - break; - case 0x0c: - // reset channel 2 - if(space.debugger_access()) // reading this is bad - break; - m_dmac->sel_w(1); - m_dmac->ca_w(1); - m_dmac->ca_w(0); - m_dmac->sel_w(0); - break; - case 0x10: - //pit ch 0 - break; - case 0x11: - //pit ch 1 - break; - case 0x12: - //pit ch 2 - break; - case 0x14: - //read buffer - if(m_rdgate && !m_amsrch && m_geom[m_drive]) - data = read_sector(); - break; - case 0x18: - //vendor bit 1,3-4 - data |= 3<<4 | 2; - break; - default: - logerror("isbc_215g: invalid port read 0x80%02x\n", offset*2); - break; - } - return data; -} - -WRITE16_MEMBER(isbc_215g_device::io_w) -{ - switch(offset) - { - case 0x00: - //control, 0x8002 doesn't set gates or search - // 0: wr gate - // 1: rd gate - // 2: address mark search - // 3: cmd bus enable - // 4: drive sel/head sel 2 - // 5: safe/head sel 1 - // 6: b ack - // 7: drive reg addr 0/step dir - // 8: drive reg addr 1 - // 9: cmd/rd - // a: para/head sel 0 - m_wrgate = data & 1; - m_rdgate = (data >> 1) & 1; - m_amsrch = (data >> 2) & 1; - if(m_wrgate && (m_rdgate || m_amsrch)) - logerror("isbc_215g: both write gate and read gate and/or address search enabled\n"); - else if(m_rdgate && m_amsrch) - find_sector(); - else if(m_amsrch) - logerror("isbc_215g: address search without read gate\n"); - case 0x01: - m_stepdir = (data & 0x80) ? 1 : 0; - break; - case 0x04: - //clear index and id latch - m_index = 10; - m_idfound = false; - break; - case 0x08: - //cmd data bus/head sel - m_head = data & 7; - m_out_irq_func((data & 0x100) ? 1 : 0); - break; - case 0x0c: - //unit select - // 0: step/wr - // 1: sbx 1 opt 0/1 (sbx2?) - // 2: sbx 2 opt 0/1 - // 3: unit select 0 - // 4: unit select 1 - // 5: extr 2 - // 6: format - // 7: format wr gate - if(!m_step && (data & 1) && m_geom[m_drive]) - { - if(m_cyl[m_drive] && !m_stepdir) - m_cyl[m_drive]--; - else if((m_cyl[m_drive] < m_geom[m_drive]->cylinders) && m_stepdir) - m_cyl[m_drive]++; - } - m_step = data & 1; - m_drive = (data >> 3) & 1; // shugart interface, two drives only - if(((data >> 1) & 1) != m_fdctc) - { - m_fdctc = !m_fdctc; - m_sbx2->opt0_w(m_fdctc); - } - if((data & 0xc0) == 0xc0) // low-level format - { - if(!m_format) - m_format_bytes = 5; // sync + sector id - m_format = true; - } - else - m_format = false; - break; - case 0x10: - //pit ch 0 - break; - case 0x11: - //pit ch 1 - break; - case 0x12: - //pit ch 2 - break; - case 0x13: - //pit control - break; - case 0x14: - //write buffer - if(m_wrgate) - { - if(m_format) - { - m_format_bytes -= 2; - if(m_format_bytes <= 0) - { - m_dmac->ext1_w(1); - m_dmac->ext1_w(0); - m_format_bytes = 5; - } - } - else - { - if(m_geom[m_drive]) - { - if(write_sector(data)) - { - m_dmac->ext1_w(1); - m_dmac->ext1_w(0); - } - } - } - } - break; - case 0x18: - //sector id/format - m_idcompare[1] = data & 0xff; - m_idcompare[0] = data >> 8; - break; - case 0x1c: - //sector id low - m_idcompare[3] = data & 0xff; - m_idcompare[2] = data >> 8; - break; - default: - logerror("isbc_215g: invalid port write 0x80%02x\n", offset*2); - break; - } -} - -READ16_MEMBER(isbc_215g_device::mem_r) -{ - // XXX: hack to permit debugger to disassemble rom - if(space.debugger_access() && (offset < 0x1fff)) - return m_dmac->space(AS_IO).read_word_unaligned(offset*2); - - switch(offset) - { - case 0x7fffb: - return 1; - case 0x7fffc: - return 0; - case 0x7fffd: - return m_wakeup; - default: - return m_maincpu_mem->read_word_unaligned(offset*2, mem_mask); - } -} - -WRITE16_MEMBER(isbc_215g_device::mem_w) -{ - m_maincpu_mem->write_word_unaligned(offset*2, data, mem_mask); -} - -static ADDRESS_MAP_START(isbc_215g_mem, AS_PROGRAM, 16, isbc_215g_device) - AM_RANGE(0x00000, 0xfffff) AM_READWRITE(mem_r, mem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(isbc_215g_io, AS_IO, 16, isbc_215g_device) - AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("i8089", 0) - AM_RANGE(0x4000, 0x47ff) AM_MIRROR(0x3800) AM_RAM - AM_RANGE(0x8000, 0x8039) AM_MIRROR(0x3fc0) AM_READWRITE(io_r, io_w) - AM_RANGE(0xc070, 0xc08f) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) - AM_RANGE(0xc0b0, 0xc0bf) AM_DEVREADWRITE8("sbx1", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) - AM_RANGE(0xc0d0, 0xc0df) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs0_r, mcs0_w, 0x00ff) - AM_RANGE(0xc0e0, 0xc0ef) AM_DEVREADWRITE8("sbx2", isbx_slot_device, mcs1_r, mcs1_w, 0x00ff) -ADDRESS_MAP_END - -WRITE_LINE_MEMBER(isbc_215g_device::isbx_irq_00_w) -{ - m_isbx_irq[0] = state ? true : false; -} - -WRITE_LINE_MEMBER(isbc_215g_device::isbx_irq_01_w) -{ - m_isbx_irq[1] = state ? true : false; -} - -WRITE_LINE_MEMBER(isbc_215g_device::isbx_irq_10_w) -{ - m_isbx_irq[2] = state ? true : false; -} - -WRITE_LINE_MEMBER(isbc_215g_device::isbx_irq_11_w) -{ - m_isbx_irq[3] = state ? true : false; -} - -static MACHINE_CONFIG_FRAGMENT( isbc_215g ) - MCFG_CPU_ADD("u84", I8089, XTAL_15MHz / 3) - MCFG_CPU_PROGRAM_MAP(isbc_215g_mem) - MCFG_CPU_IO_MAP(isbc_215g_io) - MCFG_I8089_DATABUS_WIDTH(16) - - MCFG_HARDDISK_ADD("drive0") - MCFG_HARDDISK_ADD("drive1") - - MCFG_ISBX_SLOT_ADD("sbx1", 0, isbx_cards, NULL) - MCFG_ISBX_SLOT_MINTR0_CALLBACK(WRITELINE(isbc_215g_device, isbx_irq_00_w)) - MCFG_ISBX_SLOT_MINTR1_CALLBACK(WRITELINE(isbc_215g_device, isbx_irq_01_w)) - MCFG_ISBX_SLOT_ADD("sbx2", 0, isbx_cards, "fdc_218a") - MCFG_ISBX_SLOT_MINTR0_CALLBACK(WRITELINE(isbc_215g_device, isbx_irq_10_w)) - MCFG_ISBX_SLOT_MINTR1_CALLBACK(WRITELINE(isbc_215g_device, isbx_irq_11_w)) -MACHINE_CONFIG_END - -machine_config_constructor isbc_215g_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( isbc_215g ); -} - -ROM_START( isbc_215g ) - ROM_REGION( 0x4000, "i8089", ROMREGION_ERASEFF ) - ROM_LOAD16_BYTE( "174581.001.bin", 0x0000, 0x2000, CRC(ccdbc7ab) SHA1(5c2ebdde1b0252124177221ba9cacdb6d925a24d)) - ROM_LOAD16_BYTE( "174581.002.bin", 0x0001, 0x2000, CRC(6190fa67) SHA1(295dd4e75f699aaf93227cc4876cee8accae383a)) -ROM_END - -const rom_entry *isbc_215g_device::device_rom_region() const -{ - return ROM_NAME( isbc_215g ); -} - -void isbc_215g_device::device_reset() -{ - if(m_hdd0->get_hard_disk_file()) - m_geom[0] = hard_disk_get_info(m_hdd0->get_hard_disk_file()); - else - m_geom[0] = 0; - if(m_hdd1->get_hard_disk_file()) - m_geom[1] = hard_disk_get_info(m_hdd1->get_hard_disk_file()); - else - m_geom[1] = 0; - - m_reset = false; - m_fdctc = false; - m_isbx_irq[0] = m_isbx_irq[1] = m_isbx_irq[2] = m_isbx_irq[3] = false; -} - -void isbc_215g_device::device_start() -{ - m_maincpu_mem = &machine().device(m_maincpu_tag)->space(AS_PROGRAM); - m_cyl[0] = m_cyl[1] = 0; - m_lba[0] = m_lba[1] = 0; - m_idcompare[0] = m_idcompare[1] = m_idcompare[2] = m_idcompare[3] = 0; - m_index = 10; - m_idfound = false; - m_drive = 0; - m_head = 0; - m_stepdir = false; - m_step = false; - m_format = false; - m_wrgate = false; - m_rdgate = false; - m_format_bytes = 0; - m_out_irq_func.resolve_safe(); - -} - -WRITE8_MEMBER(isbc_215g_device::write) -{ - if(!offset) - { - data &= 3; - if(!data && (m_reset == 2)) - m_dmac->reset(); - m_out_irq_func(0); - m_dmac->ca_w(data == 1); - m_dmac->ca_w(0); - m_reset = data; - } -} diff --git a/src/mess/machine/isbc_215g.h b/src/mess/machine/isbc_215g.h deleted file mode 100644 index f636de93cb9..00000000000 --- a/src/mess/machine/isbc_215g.h +++ /dev/null @@ -1,77 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl - -#ifndef ISBC_215G_H_ -#define ISBC_215G_H_ - -#include "emu.h" -#include "cpu/i8089/i8089.h" -#include "bus/isbx/isbx.h" -#include "imagedev/harddriv.h" - -class isbc_215g_device : public device_t -{ -public: - isbc_215g_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual machine_config_constructor device_mconfig_additions() const; - const rom_entry *device_rom_region() const; - - DECLARE_WRITE8_MEMBER(write); - DECLARE_READ16_MEMBER(io_r); - DECLARE_WRITE16_MEMBER(io_w); - DECLARE_READ16_MEMBER(mem_r); - DECLARE_WRITE16_MEMBER(mem_w); - - DECLARE_WRITE_LINE_MEMBER(isbx_irq_00_w); - DECLARE_WRITE_LINE_MEMBER(isbx_irq_01_w); - DECLARE_WRITE_LINE_MEMBER(isbx_irq_10_w); - DECLARE_WRITE_LINE_MEMBER(isbx_irq_11_w); - - static void static_set_wakeup_addr(device_t &device, UINT32 wakeup) { downcast(device).m_wakeup = wakeup; } - static void static_set_maincpu_tag(device_t &device, const char *maincpu_tag) { downcast(device).m_maincpu_tag = maincpu_tag; } - template static devcb_base &static_set_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_func.set_callback(object); } - -protected: - virtual void device_start(); - virtual void device_reset(); - -private: - void find_sector(); - UINT16 read_sector(); - bool write_sector(UINT16 data); - - required_device m_dmac; - required_device m_hdd0; - required_device m_hdd1; - required_device m_sbx1; - required_device m_sbx2; - - devcb_write_line m_out_irq_func; - - int m_reset; - UINT16 m_wakeup, m_secoffset, m_sector[512]; - const char *m_maincpu_tag; - address_space *m_maincpu_mem; - UINT32 m_lba[2]; - UINT16 m_cyl[2]; - UINT8 m_idcompare[4], m_drive, m_head, m_index; - INT8 m_format_bytes; - bool m_idfound, m_stepdir, m_wrgate, m_rdgate, m_amsrch; - - bool m_isbx_irq[4], m_fdctc, m_step, m_format; - - const struct hard_disk_info* m_geom[2]; -}; - -#define MCFG_ISBC_215_ADD(_tag, _wakeup, _maincpu_tag) \ - MCFG_DEVICE_ADD(_tag, ISBC_215G, 0) \ - isbc_215g_device::static_set_wakeup_addr(*device, _wakeup); \ - isbc_215g_device::static_set_maincpu_tag(*device, _maincpu_tag); - -#define MCFG_ISBC_215_IRQ(_irq_line) \ - devcb = &isbc_215g_device::static_set_irq_callback(*device, DEVCB_##_irq_line); - -extern const device_type ISBC_215G; - -#endif /* ISBC_215G_H_ */ diff --git a/src/mess/machine/k7659kb.c b/src/mess/machine/k7659kb.c deleted file mode 100644 index 5b46d8a9814..00000000000 --- a/src/mess/machine/k7659kb.c +++ /dev/null @@ -1,311 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/********************************************************************** - - K7659 keyboard emulation - -*********************************************************************/ - -#include "k7659kb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type K7659_KEYBOARD = &device_creator; - - - -//------------------------------------------------- -// ROM( k7659_keyboard ) -//------------------------------------------------- - -ROM_START( k7659_keyboard ) - ROM_REGION(0x0800, "k7659",0) - ROM_LOAD ("k7659n.bin", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *k7659_keyboard_device::device_rom_region() const -{ - return ROM_NAME( k7659_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( kb_io ) -//------------------------------------------------- - - - -//------------------------------------------------- -// DISCRETE_SOUND_START( k7659kb ) -//------------------------------------------------- - - - -//------------------------------------------------- -// MACHINE_DRIVER( k7659_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( k7659_keyboard ) - -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor k7659_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( k7659_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( k7659_keyboard ) -//------------------------------------------------- - -static INPUT_PORTS_START( k7659_keyboard ) - PORT_START("A1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) - PORT_START("A2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xff) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) - PORT_START("A3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) - PORT_START("A4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 /") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_START("A5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". :") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR('0') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('|') PORT_CHAR('\\') PORT_CHAR(0x1c) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_START("A6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('~') PORT_CHAR('?') PORT_CHAR(0x1e) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("} ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('}') PORT_CHAR(']') PORT_CHAR(0x1d) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("{ [") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('{') PORT_CHAR('[') PORT_CHAR(0x1b) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('<') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ *") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('*') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("# '") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') PORT_CHAR('\'') PORT_CHAR(0x1f) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_COLON) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(0x1e) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) - PORT_START("A7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(">") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('>') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("04") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x04) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("01") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x01) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(' ') PORT_CHAR('`') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) PORT_CHAR(0x1b) PORT_CHAR(0x1f) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("13") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x13) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("06") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x06) - PORT_START("A8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_START("A9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_END) PORT_CHAR(0x0c) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x7f) PORT_CHAR(0x1e) PORT_CHAR(0x1f) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F01") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x05) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F02") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x18) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F03") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x13) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F04") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x04) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F06") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x03) - PORT_START("A10") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F07") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x1a) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F08") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x17) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F09") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x07) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x14) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x19) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x02) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F13") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x0b) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F14") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x11) - PORT_START("A11") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F05") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x12) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(0x1a) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(0x0a) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(0x15) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(0x08) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E95") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0xff) - PORT_START("A12") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor k7659_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( k7659_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// k7659_keyboard_device - constructor -//------------------------------------------------- - -k7659_keyboard_device::k7659_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, K7659_KEYBOARD, "K7659 Keyboard", tag, owner, clock, "k7659kb", __FILE__) -{} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void k7659_keyboard_device::device_start() -{ - m_timer = timer_alloc(); - // state saving - //save_item(NAME(m_y)); - //save_item(NAME(m_so)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void k7659_keyboard_device::device_reset() -{ - m_lookup = 0; - m_p_rom = memregion("k7659")->base(); - m_timer->adjust(attotime::from_hz(200), 0, attotime::from_hz(200)); -} - -void k7659_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - UINT8 retVal = 0;//m_lookup; - UINT8 a1 = ioport("A1")->read(); - UINT8 a2 = ioport("A2")->read(); - UINT8 a3 = ioport("A3")->read(); - UINT8 a4 = ioport("A4")->read(); - UINT8 a5 = ioport("A5")->read(); - UINT8 a6 = ioport("A6")->read(); - UINT8 a7 = ioport("A7")->read(); - UINT8 a8 = ioport("A8")->read(); - UINT8 a9 = ioport("A9")->read(); - UINT8 a10 = ioport("A10")->read(); - UINT8 a11 = ioport("A11")->read(); - UINT8 a12 = ioport("A12")->read(); - UINT16 code = 0; - if (a1) - code = 0x10 + key_pos(a1); - else if (a2) - code = 0x20 + key_pos(a2); - else if (a3) - code = 0x30 + key_pos(a3); - else if (a4) - code = 0x40 + key_pos(a4); - else if (a5) - code = 0x50 + key_pos(a5); - else if (a6) - code = 0x60 + key_pos(a6); - else if (a7) - code = 0x70 + key_pos(a7); - else if (a9) - code = 0x80 + key_pos(a9); - else if (a10) - code = 0x90 + key_pos(a10); - else if (a11) - code = 0xA0 + key_pos(a11); - - if (code) - { - if (BIT(a8,6) || BIT(a8,7)) - code |= 0x100; - else - if (BIT(a12,6)) - code |= 0x200; - - m_lookup = m_p_rom[code]; - retVal = m_lookup | 0x80; - } - m_key = retVal; -} - -UINT8 k7659_keyboard_device::key_pos(UINT8 val) -{ - if (BIT(val,0)) return 1; - if (BIT(val,1)) return 2; - if (BIT(val,2)) return 3; - if (BIT(val,3)) return 4; - if (BIT(val,4)) return 5; - if (BIT(val,5)) return 6; - if (BIT(val,6)) return 7; - if (BIT(val,7)) return 8; - return 0; -} - -READ8_MEMBER(k7659_keyboard_device::read) -{ - return m_key; -} diff --git a/src/mess/machine/k7659kb.h b/src/mess/machine/k7659kb.h deleted file mode 100644 index 2dc4db24747..00000000000 --- a/src/mess/machine/k7659kb.h +++ /dev/null @@ -1,75 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/********************************************************************** - - K7659 keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __K7659_KEYBOARD__ -#define __K7659_KEYBOARD__ - - -#include "emu.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define K7659_KEYBOARD_TAG "k7659kb" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_K7659_KEYBOARD_ADD() \ - MCFG_DEVICE_ADD(K7659_KEYBOARD_TAG, K7659_KEYBOARD, 0) - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> k7659_keyboard_device - -class k7659_keyboard_device : public device_t -{ -public: - // construction/destruction - k7659_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_READ8_MEMBER(read); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - emu_timer *m_timer; - -private: - UINT8 key_pos(UINT8 val); - UINT8 m_lookup; - UINT8 m_key; - const UINT8 *m_p_rom; -}; - - -// device type definition -extern const device_type K7659_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/kay_kbd.c b/src/mess/machine/kay_kbd.c deleted file mode 100644 index 2568bd8af9c..00000000000 --- a/src/mess/machine/kay_kbd.c +++ /dev/null @@ -1,517 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/****************************************************************************** - * - * kay_kbd.c - * - * Kaypro II Serial Keyboard - * - * Most of this is copied from the old kaypro.c, - * rather than re-inventing the wheel. - * - * Juergen Buchmueller, July 1998 - * Benjamin C. W. Sittler, July 1998 (new keyboard table) - * - * Converted to a serial device (as far as MESS will allow) - * by Robbbert, April 2009. - * - ******************************************************************************/ - -#include "emu.h" -#include "sound/beep.h" -#include "includes/kaypro.h" - - -/* - * The KAYPRO keyboard has roughly the following layout: - * - * [up] [down] [left] [right] - * [ESC] [1!] [2@] [3#] [4$] [5%] [6^] [7&] [8*] [9(] [0)] [-_] [=+] [`~] [BACK SPACE] - * [TAB] [qQ] [wW] [eE] [rR] [tT] [yY] [uU] [iI] [oO] [pP] [[{] []}] [DEL] - *[CTRL] [CAPS LOCK] [aA] [sS] [dD] [fF] [gG] [hH] [jJ] [kK] [lL] [;:] ['"] [RETURN] [\|] - * [SHIFT] [zZ] [xX] [cC] [vV] [bB] [nN] [mM] [,<] [.>] [/?] [SHIFT] [LINE FEED] - * [ SPACE ] - * - * [7] [8] [9] [-] - * [4] [5] [6] [,] - * [1] [2] [3] - * [ 0 ] [.] [ENTER] - * - * Notes on Appearance - * ------------------- - * The RETURN key is shaped like a backwards "L". The keypad ENTER key is actually - * oriented vertically, not horizontally. The alpha keys are marked with the uppercase letters - * only. Other keys with two symbols have the shifted symbol printed above the unshifted symbol. - * The keypad is actually located to the right of the main keyboard; it is shown separately here - * as a convenience to users of narrow listing windows. The arrow keys are actually marked with - * arrow graphics pointing in the appropriate directions. The F and J keys are specially shaped, - * since they are the "home keys" for touch-typing. The CAPS LOCK key has a build-in red indicator - * which is lit when CAPS LOCK is pressed once, and extinguished when the key is pressed again. - * - * Technical Notes - * --------------- - * The keyboard interfaces to the computer using a serial protocol. Modifier keys are handled - * inside the keyboards, as is the CAPS LOCK key. The arrow keys and the numeric keypad send - * non-ASCII codes which are not affected by the modifier keys. The remaining keys send the - * appropriate ASCII values. - * - * The keyboard has a built-in buzzer which is activated briefly by a non-modifier keypress, - * producing a "clicking" sound for user feedback. Additionally, this buzzer can be activated - * for a longer period by sending a 0x04 byte to the keyboard. This is used by the ROM soft - * terminal to alert the user in case of a BEL. - * - * 2008-05 FP: - * Small note about natural keyboard support: currently, - * - "Line Feed" is mapped to the 'End' key - * - "Keypad ," is not mapped - */ - -struct kay_kbd_t -{ - beep_device *beeper; - UINT8 buff[16]; - UINT8 head; - UINT8 tail; - UINT8 beep_on; - UINT8 control_status; - UINT8 keyrows[10]; - int lastrow; - int mask; - int key; - int repeat; - int repeater; -}; - -INPUT_PORTS_START( kay_kbd ) - PORT_START("ROW0") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - - PORT_START("ROW1") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - - PORT_START("ROW2") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - - PORT_START("ROW3") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - - PORT_START("ROW4") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("ROW5") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - - PORT_START("ROW6") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) - - PORT_START("ROW7") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - - PORT_START("ROW8") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - - PORT_START("ROW9") - PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0xf0, 0x00, IPT_UNUSED) -INPUT_PORTS_END - -static void kay_kbd_in( running_machine &machine, UINT8 data ); - -static const UINT8 keyboard[8][10][8] = { - { /* normal */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0','-','=','`', 8, 9}, - {'q','w','e','r','t','y','u','i'}, - {'o','p','[',']', 13,127, 0, 0}, - {'a','s','d','f','g','h','j','k'}, - {'l',';', 39, 92, 0,'z','x','c'}, - {'v','b','n','m',',','.','/', 0}, - { 10, 32, 228, 211, 195, 178, 177, 192}, - { 193, 194, 208, 209, 210, 225, 226, 227}, - { 241, 242, 243, 244, 0, 0, 0, 0}, - }, - { /* Shift */ - { 27,'!','@','#','$','%','^','&'}, - {'*','(',')','_','+','~', 8, 9}, - {'Q','W','E','R','T','Y','U','I'}, - {'O','P','{','}', 13,127, 0, 0}, - {'A','S','D','F','G','H','J','K'}, - {'L',':','"','|', 0,'Z','X','C'}, - {'V','B','N','M','<','>','?', 0}, - { 10, 32, 228, 211, 195, 178, 177, 192}, - { 193, 194, 208, 209, 210, 225, 226, 227}, - { 241, 242, 243, 244, 0, 0, 0, 0}, - }, - { /* Control */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0','-','=','`', 8, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,';', 39, 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10, 32, 228, 211, 195, 178, 177, 192}, - { 193, 194, 208, 209, 210, 225, 226, 227}, - { 241, 242, 243, 244, 0, 0, 0, 0}, - }, - { /* Shift+Control */ - { 27,'!', 0,'#','$','%', 30,'&'}, - {'*','(',')', 31,'+','~', 8, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,':','"', 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10, 32, 228, 211, 195, 178, 177, 192}, - { 193, 194, 208, 209, 210, 225, 226, 227}, - { 241, 242, 243, 244, 0, 0, 0, 0}, - }, - { /* CapsLock */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0','-','=','`', 8, 9}, - {'Q','W','E','R','T','Y','U','I'}, - {'O','P','[',']', 13,127, 0, 0}, - {'A','S','D','F','G','H','J','K'}, - {'L',';', 39, 92, 0,'Z','X','C'}, - {'V','B','N','M',',','.','/', 0}, - { 10, 32, 228, 211, 195, 178, 177, 192}, - { 193, 194, 208, 209, 210, 225, 226, 227}, - { 241, 242, 243, 244, 0, 0, 0, 0}, - }, - { /* Shift+CapsLock */ - { 27,'!','@','#','$','%','^','&'}, - {'*','(',')','_','+','~', 8, 9}, - {'Q','W','E','R','T','Y','U','I'}, - {'O','P','{','}', 13,127, 0, 0}, - {'A','S','D','F','G','H','J','K'}, - {'L',':','"','|', 0,'Z','X','C'}, - {'V','B','N','M','<','>','?', 0}, - { 10, 32, 228, 211, 195, 178, 177, 192}, - { 193, 194, 208, 209, 210, 225, 226, 227}, - { 241, 242, 243, 244, 0, 0, 0, 0}, - }, - { /* Control+CapsLock */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0','-','=','`', 8, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,';', 39, 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10, 32, 228, 211, 195, 178, 177, 192}, - { 193, 194, 208, 209, 210, 225, 226, 227}, - { 241, 242, 243, 244, 0, 0, 0, 0}, - }, - { /* Shift+Control+CapsLock */ - { 27,'!', 0,'#','$','%', 30,'&'}, - {'*','(',')', 31,'+','~', 8, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,':','"', 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10, 32, 228, 211, 195, 178, 177, 192}, - { 193, 194, 208, 209, 210, 225, 226, 227}, - { 241, 242, 243, 244, 0, 0, 0, 0}, - }, -}; - -MACHINE_RESET_MEMBER(kaypro_state,kay_kbd) -{ - kay_kbd_t *kbd = m_kbd = auto_alloc_clear(machine(), kay_kbd_t); - - /* disable CapsLock LED initially */ - set_led_status(machine(), 1, 1); - set_led_status(machine(), 1, 0); - kbd->beeper = machine().device("beeper"); - kbd->beep_on = 1; - kbd->control_status = 0x14; - kbd->beeper->set_state(0); - kbd->beeper->set_frequency(950); /* piezo-device needs to be measured */ - kbd->head = kbd->tail = 0; /* init buffer */ -} - -/****************************************************** - * vertical blank interrupt - * used to scan keyboard; newly pressed keys - * are stuffed into a keyboard buffer; - * also drives keyboard LEDs and - * and handles autorepeating keys - ******************************************************/ -INTERRUPT_GEN_MEMBER(kaypro_state::kay_kbd_interrupt) -{ - kay_kbd_t *kbd = m_kbd; - int mod, row, col, chg, newval; - UINT8 *keyrows = kbd->keyrows; - - if( kbd->repeat ) - { - if( !--kbd->repeat ) - kbd->repeater = 4; - } - else - if( kbd->repeater ) - { - kbd->repeat = kbd->repeater; - } - - row = 9; - newval = machine().root_device().ioport("ROW9")->read(); - chg = keyrows[row] ^ newval; - - if (!chg) { newval = machine().root_device().ioport("ROW8")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) { newval = machine().root_device().ioport("ROW7")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) { newval = machine().root_device().ioport("ROW6")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) { newval = machine().root_device().ioport("ROW5")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) { newval = machine().root_device().ioport("ROW4")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) { newval = machine().root_device().ioport("ROW3")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) { newval = machine().root_device().ioport("ROW2")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) { newval = machine().root_device().ioport("ROW1")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) { newval = machine().root_device().ioport("ROW0")->read(); chg = keyrows[--row] ^ newval; } - if (!chg) --row; - - if (row >= 0) - { - kbd->repeater = 0x00; - kbd->mask = 0x00; - kbd->key = 0x00; - kbd->lastrow = row; - /* CapsLock LED */ - if( row == 3 && chg == 0x80 ) - set_led_status(machine(), 1, (kbd->keyrows[3] & 0x80) ? 0 : 1); - - if (newval & chg) /* key(s) pressed ? */ - { - mod = 0; - - /* Shift modifier */ - if ( (keyrows[5] & 0x10) || (keyrows[6] & 0x80) ) - mod |= 1; - - /* Control modifier */ - if (keyrows[3] & 0x40) - mod |= 2; - - /* CapsLock modifier */ - if (keyrows[3] & 0x80) - mod |= 4; - - /* find newval key */ - kbd->mask = 0x01; - for (col = 0; col < 8; col ++) - { - if (chg & kbd->mask) - { - newval &= kbd->mask; - kbd->key = keyboard[mod][row][col]; - break; - } - kbd->mask <<= 1; - } - if( kbd->key ) /* normal key */ - { - kbd->repeater = 30; - kay_kbd_in(machine(), kbd->key); - } - else - if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */ - kay_kbd_in(machine(), 0); - keyrows[row] |= newval; - } - else - { - kbd->keyrows[row] = newval; - } - kbd->repeat = kbd->repeater; - } - else if ( kbd->key && (keyrows[kbd->lastrow] & kbd->mask) && kbd->repeat == 0 ) - { - kay_kbd_in(machine(), kbd->key); - } -} - -#if 0 - -/****************************************************** - * kaypro_const_w (write console status ;) - * bit - * 0 flush keyboard buffer - ******************************************************/ -static WRITE8_HANDLER ( kaypro2_const_w ) -{ - if (data & 1) - kbd->head = kbd->tail = 0; -} - -#endif - -/****************************************************** - * stuff character into the keyboard buffer - * releases CPU if it was waiting for a key - * sounds bell if buffer would overflow - ******************************************************/ -static void kay_kbd_in( running_machine &machine, UINT8 data ) -{ - kaypro_state *state = machine.driver_data(); - kay_kbd_t *kbd = state->m_kbd; - UINT8 kbd_head_old; - - kbd_head_old = kbd->head; - kbd->buff[kbd->head] = data; - kbd->head = (kbd->head + 1) % sizeof(kbd->buff); - /* will the buffer overflow ? */ - if (kbd->head == kbd->tail) - { - kbd->head = kbd_head_old; - kay_kbd_d_w(machine, 4); - } - else - kay_kbd_d_w(machine, 1); -} - - -UINT8 kay_kbd_c_r( running_machine &machine ) -{ -/* d4 transmit buffer empty - 1=ok to send - d2 appears to be receive buffer empty - 1=ok to receive - d0 keyboard buffer empty - 1=key waiting to be used */ - - kaypro_state *state = machine.driver_data(); - kay_kbd_t *kbd = state->m_kbd; - UINT8 data = kbd->control_status; - - if( kbd->head != kbd->tail ) - data++; - - return data; -} - -UINT8 kay_kbd_d_r( running_machine &machine ) -{ -/* return next key in buffer */ - - kaypro_state *state = machine.driver_data(); - kay_kbd_t *kbd = state->m_kbd; - UINT8 data = 0; - - if (kbd->tail != kbd->head) - { - data = kbd->buff[kbd->tail]; - kbd->tail = (kbd->tail + 1) % sizeof(kbd->buff); - } - - return data; -} - -static TIMER_CALLBACK( kay_kbd_beepoff ) -{ - kaypro_state *state = machine.driver_data(); - kay_kbd_t *kbd = state->m_kbd; - kbd->beeper->set_state(0); - kbd->control_status |= 4; -} - -void kay_kbd_d_w( running_machine &machine, UINT8 data ) -{ -/* Beeper control - lengths need verifying - 01 - keyclick - 02 - short beep - 04 - standard bell beep - 08 - mute - 16 - unmute */ - - kaypro_state *state = machine.driver_data(); - kay_kbd_t *kbd = state->m_kbd; - UINT16 length = 0; - - if (data & 0x10) - kbd->beep_on = 1; - else - if (data & 0x08) - kbd->beep_on = 0; - else - if (kbd->beep_on) - { - if (data & 0x04) - length = 400; - else - if (data & 0x02) - length = 200; - else - if (data & 0x01) - length = 4; - - if (length) - { - kbd->control_status &= 0xfb; - machine.scheduler().timer_set(attotime::from_msec(length), FUNC(kay_kbd_beepoff)); - kbd->beeper->set_state(1); - } - } -} diff --git a/src/mess/machine/kaypro.c b/src/mess/machine/kaypro.c deleted file mode 100644 index 9b9c3a7bab7..00000000000 --- a/src/mess/machine/kaypro.c +++ /dev/null @@ -1,292 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert - - -#include "includes/kaypro.h" - - - - -/*********************************************************** - - PIO - - Port B is unused on both PIOs - -************************************************************/ - -WRITE_LINE_MEMBER( kaypro_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -READ8_MEMBER( kaypro_state::pio_system_r ) -{ - UINT8 data = 0; - - /* centronics busy */ - data |= m_centronics_busy << 3; - - /* PA7 is pulled high */ - data |= 0x80; - - return data; -} - -WRITE8_MEMBER( kaypro_state::kayproii_pio_system_w ) -{ -/* d7 bank select - d6 disk drive motors - (0=on) - d5 double-density enable (0=double density) - d4 Centronics strobe - d2 side select (1=side 1) - d1 drive B - d0 drive A */ - - membank("bankr0")->set_entry(BIT(data, 7)); - membank("bank3")->set_entry(BIT(data, 7)); - m_is_motor_off = BIT(data, 6); - - m_floppy = NULL; - if (BIT(data, 0)) - m_floppy = m_floppy0->get_device(); - else - if (BIT(data, 1)) - m_floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(m_floppy); - m_fdc->dden_w(BIT(data, 5)); - - if (m_floppy) - { - m_floppy->mon_w(BIT(data, 6)); // motor on - m_floppy->ss_w(!BIT(data, 2)); // signal exists even though drives are single sided - } - - output_set_value("ledA", BIT(data, 0)); /* LEDs in artwork */ - output_set_value("ledB", BIT(data, 1)); - - m_centronics->write_strobe(BIT(data, 4)); - - m_system_port = data; -} - -WRITE8_MEMBER( kaypro_state::kaypro4_pio_system_w ) -{ - kayproii_pio_system_w(space, offset, data); - - /* side select */ - m_floppy->ss_w(BIT(data, 2)); -} - -/*********************************************************** - - KAYPRO2X SYSTEM PORT - - The PIOs were replaced by a few standard 74xx chips - -************************************************************/ - -READ8_MEMBER( kaypro_state::kaypro2x_system_port_r ) -{ - UINT8 data = m_centronics_busy << 6; - return (m_system_port & 0xbf) | data; -} - -WRITE8_MEMBER( kaypro_state::kaypro2x_system_port_w ) -{ -/* d7 bank select - d6 alternate character set (write only) - d5 double-density enable - d4 disk drive motors (1=on) - d3 Centronics strobe - d2 side select (appears that 0=side 1?) - d1 drive B - d0 drive A */ - - membank("bankr0")->set_entry(BIT(data, 7)); - membank("bank3")->set_entry(BIT(data, 7)); - m_is_motor_off = !BIT(data, 4); - - m_floppy = NULL; - if (!BIT(data, 0)) - m_floppy = m_floppy0->get_device(); - else - if (m_floppy1 && (!BIT(data, 1))) - m_floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(m_floppy); - m_fdc->dden_w(BIT(data, 5)); - - if (m_floppy) - { - m_floppy->mon_w(!BIT(data, 4)); // motor on - m_floppy->ss_w(!BIT(data, 2)); - } - - output_set_value("ledA", BIT(data, 0)); /* LEDs in artwork */ - output_set_value("ledB", BIT(data, 1)); - - m_centronics->write_strobe(BIT(data, 3)); - - m_system_port = data; -} - - -/*********************************************************************** - - SIO - - On Kaypro2x, Channel B on both SIOs is hardwired to 300 baud. - - Both devices on sio2 (printer and modem) are not emulated. - -************************************************************************/ - -/* Set baud rate. bits 0..3 Rx and Tx are tied together. Baud Rate Generator is a AY-5-8116, SMC8116, WD1943, etc. - 00h 50 - 11h 75 - 22h 110 - 33h 134.5 - 44h 150 - 55h 300 - 66h 600 - 77h 1200 - 88h 1800 - 99h 2000 - AAh 2400 - BBh 3600 - CCh 4800 - DDh 7200 - EEh 9600 - FFh 19200 */ - - -READ8_MEMBER(kaypro_state::kaypro_sio_r) -{ - if (offset == 1) - return kay_kbd_d_r(machine()); - else - if (offset == 3) - return kay_kbd_c_r(machine()); - else - return m_sio->cd_ba_r(space, offset); -} - -WRITE8_MEMBER(kaypro_state::kaypro_sio_w) -{ - if (offset == 1) - kay_kbd_d_w(machine(), data); - else - m_sio->cd_ba_w(space, offset, data); -} - - -/************************************************************************************* - - Floppy DIsk - - If DRQ or IRQ is set, and cpu is halted, the NMI goes low. - Since the HALT occurs last (and has no callback mechanism), we need to set - a short delay, to give time for the processor to execute the HALT before NMI - becomes active. - -*************************************************************************************/ - -void kaypro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - bool halt; - switch (id) - { - case TIMER_FLOPPY: - halt = (bool)m_maincpu->state_int(Z80_HALT); - if (m_is_motor_off) - { - timer_set(attotime::from_hz(10), TIMER_FLOPPY); - break; - } - if ((halt) && (m_fdc_rq & 3) && (m_fdc_rq < 0x80)) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - m_fdc_rq |= 0x80; - } - else - if ((m_fdc_rq == 0x80) || ((!halt) && BIT(m_fdc_rq, 7))) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - m_fdc_rq &= 0x7f; - } - timer_set(attotime::from_hz(1e5), TIMER_FLOPPY); - - break; - default: - assert_always(FALSE, "Unknown id in kaypro_state::device_timer"); - } -} - -WRITE_LINE_MEMBER( kaypro_state::fdc_intrq_w ) -{ - m_fdc_rq = (m_fdc_rq & 0x82) | state; -} - -WRITE_LINE_MEMBER( kaypro_state::fdc_drq_w ) -{ - m_fdc_rq = (m_fdc_rq & 0x81) | (state << 1); -} - - -/*********************************************************** - - Machine - -************************************************************/ -MACHINE_START_MEMBER( kaypro_state,kayproii ) -{ - m_pio_s->strobe_a(0); -} - -MACHINE_RESET_MEMBER( kaypro_state,kaypro ) -{ - MACHINE_RESET_CALL_MEMBER(kay_kbd); - membank("bankr0")->set_entry(1); // point at rom - membank("bankw0")->set_entry(0); // always write to ram - membank("bank3")->set_entry(1); // point at video ram - m_system_port = 0x80; - m_fdc_rq = 0; - m_maincpu->reset(); - timer_set(attotime::from_hz(1), TIMER_FLOPPY); /* kick-start the nmi timer */ -} - - -/*********************************************************** - - Quickload - - This loads a .COM file to address 0x100 then jumps - there. Sometimes .COM has been renamed to .CPM to - prevent windows going ballistic. These can be loaded - as well. - -************************************************************/ - -QUICKLOAD_LOAD_MEMBER( kaypro_state, kaypro ) -{ - UINT8 *RAM = memregion("rambank")->base(); - UINT16 i; - UINT8 data; - - /* Load image to the TPA (Transient Program Area) */ - for (i = 0; i < quickload_size; i++) - { - if (image.fread( &data, 1) != 1) return IMAGE_INIT_FAIL; - - RAM[i+0x100] = data; - } - - membank("bankr0")->set_entry(0); - membank("bank3")->set_entry(0); - RAM[0x80]=0; // clear out command tail - RAM[0x81]=0; - m_maincpu->set_pc(0x100); // start program - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/kb_7007_3.h b/src/mess/machine/kb_7007_3.h deleted file mode 100644 index 3324de839f6..00000000000 --- a/src/mess/machine/kb_7007_3.h +++ /dev/null @@ -1,122 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/* - * MC 7007 keyboard, variant 3, used by mc1502. - * - * Rus/Lat key is mapped to RAlt. - */ - -INPUT_PORTS_START( mc7007_3_keyboard ) - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Scroll Lock") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) // PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) // PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) // PORT_CODE(KEYCODE_PGUP) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) /* ??2 */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') /* ??? */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) /* ??? */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) /* ??? */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_RALT) /* ??? */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) // PORT_CODE(KEYCODE_INSERT) /* ??? */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL_PAD) /* ???? */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) /* ???? */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) // PORT_CODE(KEYCODE_END) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) // PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) // PORT_CODE(KEYCODE_PGDN) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) // PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) // PORT_CODE(KEYCODE_RIGHT) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') /* keypad */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_PRTSCR) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor up") PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - - PORT_START("Y10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - - PORT_START("Y11") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - - PORT_START("Y12") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) -INPUT_PORTS_END diff --git a/src/mess/machine/kb_poisk1.h b/src/mess/machine/kb_poisk1.h deleted file mode 100644 index ece8ee0c0c9..00000000000 --- a/src/mess/machine/kb_poisk1.h +++ /dev/null @@ -1,252 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/* - * Poisk-1 keyboard - * - * F4 - toggles key click - * RCtrl - toggles Latin/Cyrillic layout - * Keypad / - Pause key - * F11 - XXX - * F12 - XXX - */ - -INPUT_PORTS_START( poisk1_keyboard_v89 ) - PORT_START("Y1") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') // 0x55 - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?56?") // 0x56 - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) -/*-12*/ PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-12 - ?") /* PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') */ - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') -/*-11*/ PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-11 - %") /* PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') */ - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - - PORT_START("Y2") -/*-15*/ PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-15 - !") /* PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') */ - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) /* ??? */ - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) -/*-13*/ PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-13 - ;") /* PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') */ - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) -/*-2*/ PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-2 - .") /* PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') */ -/*-3*/ PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-3 - _") /* PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') */ - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') // 0x54 - - PORT_START("Y3") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("Y4") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) -/*-1*/ PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-1 - *") /* PORT_CODE(KEYCODE_8) PORT_CHAR('*') PORT_CHAR('8') */ - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) /* ??2 */ -/*-9*/ PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-9 - :") /* PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') */ -/*-10*/ PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-10 - ,") /* PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') */ - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("Y5") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_UNUSED ) -/*?*/ PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) /* ???? */ - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - - PORT_START("Y6") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) -/*?*/ PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_RALT) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?dc?") // 0xdc = SHIFT2 - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_RALT) // 0xdb = Rus/Lat - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?59?") // 0x59 - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y7") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?5a?") // 0x5a - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("Y8") -/*-6*/ PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-6 - -") /* PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') */ - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') /* ??? */ - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') -/*-7*/ PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-7 - )") /* PORT_CODE(KEYCODE_0) PORT_CHAR(')') PORT_CHAR('0') */ - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock") -/*-4*/ PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-4 - (") /* PORT_CODE(KEYCODE_9) PORT_CHAR('(') PORT_CHAR('9') */ - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') -/*-5*/ PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-5 - \"") /* PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('"') PORT_CHAR('\'') */ -/*-8*/ PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?-8 - /") /* PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') */ - -#if 0 - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_PRTSCR) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x000, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x000, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x000, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT( 0x000, IP_ACTIVE_LOW, IPT_KEYBOARD ) -#endif - -INPUT_PORTS_END - -INPUT_PORTS_START( poisk1_keyboard_v91 ) - PORT_START("Y1") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("+ / CYRILLIC YO") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(")") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - - PORT_START("Y2") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("*") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("(") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - - PORT_START("Y3") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("Y4") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Pause") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("Y5") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UKRAINIAN XXX") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - - PORT_START("Y6") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Ctrl/Cyril") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Alt") PORT_CODE(KEYCODE_LALT) - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Alt") PORT_CODE(KEYCODE_RALT) - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y7") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- / UKRAINIAN XXX") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock") - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("Y8") - PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') /* ??? */ - PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("!") PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') - PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UKRAINIAN XXX") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("%") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') -INPUT_PORTS_END diff --git a/src/mess/machine/kc.c b/src/mess/machine/kc.c deleted file mode 100644 index ad707f9dbc6..00000000000 --- a/src/mess/machine/kc.c +++ /dev/null @@ -1,788 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/* Core includes */ -#include "emu.h" -#include "includes/kc.h" - -#define KC_DEBUG 0 -#define LOG(x) do { if (KC_DEBUG) logerror x; } while (0) - -struct kcc_header -{ - UINT8 name[10]; - UINT8 reserved[6]; - UINT8 number_addresses; - UINT8 load_address_l; - UINT8 load_address_h; - UINT8 end_address_l; - UINT8 end_address_h; - UINT8 execution_address_l; - UINT8 execution_address_h; - UINT8 pad[128-2-2-2-1-16]; -}; - -/* appears to work a bit.. */ -/* load file, then type: MENU and it should now be displayed. */ -/* now type name that has appeared! */ - -/* load snapshot */ -QUICKLOAD_LOAD_MEMBER( kc_state,kc) -{ - struct kcc_header *header; - UINT16 addr; - UINT16 datasize; - UINT16 execution_address; - UINT16 i; - - /* get file size */ - UINT64 size = image.length(); - - if (size == 0) - return IMAGE_INIT_FAIL; - - dynamic_buffer data(size); - image.fread( &data[0], size); - - header = (struct kcc_header *) &data[0]; - addr = (header->load_address_l & 0x0ff) | ((header->load_address_h & 0x0ff)<<8); - datasize = ((header->end_address_l & 0x0ff) | ((header->end_address_h & 0x0ff)<<8)) - addr; - execution_address = (header->execution_address_l & 0x0ff) | ((header->execution_address_h & 0x0ff)<<8); - - if (datasize > size - 128) - { - osd_printf_info("Invalid snapshot size: expected 0x%04x, found 0x%04x\n", datasize, (UINT32)size - 128); - datasize = size - 128; - } - - address_space &space = m_maincpu->space( AS_PROGRAM ); - - for (i=0; inumber_addresses >= 3 ) - { - // if specified, jumps to the quickload start address - m_maincpu->set_pc(execution_address); - } - - logerror("Snapshot loaded at: 0x%04x-0x%04x, execution address: 0x%04x\n", addr, addr + datasize - 1, execution_address); - - return IMAGE_INIT_PASS; -} - - -//************************************************************************** -// MODULE SYSTEM EMULATION -//************************************************************************** - -// The KC85/4 and KC85/3 are "modular systems". These computers can be expanded with modules. - -READ8_MEMBER( kc_state::expansion_read ) -{ - UINT8 result = 0xff; - - // assert MEI line of first slot - m_expansions[0]->mei_w(ASSERT_LINE); - - for (int i=0; i<3; i++) - m_expansions[i]->read(offset, result); - - return result; -} - -WRITE8_MEMBER( kc_state::expansion_write ) -{ - // assert MEI line of first slot - m_expansions[0]->mei_w(ASSERT_LINE); - - for (int i=0; i<3; i++) - m_expansions[i]->write(offset, data); -} - -/* - port xx80 - - - xx is module id. - - Only addressess divisible by 4 are checked. - If module does not exist, 0x0ff is returned. - - When xx80 is read, if a module exists a id will be returned. - Id's for known modules are listed above. -*/ - -READ8_MEMBER( kc_state::expansion_io_read ) -{ - UINT8 result = 0xff; - - // assert MEI line of first slot - m_expansions[0]->mei_w(ASSERT_LINE); - - if ((offset & 0xff) == 0x80) - { - UINT8 slot_id = (offset>>8) & 0xff; - - if (slot_id == 0x08 || slot_id == 0x0c) - result = m_expansions[(slot_id - 8) >> 2]->module_id_r(); - else - m_expansions[2]->io_read(offset, result); - } - else - { - for (int i=0; i<3; i++) - m_expansions[i]->io_read(offset, result); - } - - return result; -} - -WRITE8_MEMBER( kc_state::expansion_io_write ) -{ - // assert MEI line of first slot - m_expansions[0]->mei_w(ASSERT_LINE); - - if ((offset & 0xff) == 0x80) - { - UINT8 slot_id = (offset>>8) & 0xff; - - if (slot_id == 0x08 || slot_id == 0x0c) - m_expansions[(slot_id - 8) >> 2]->control_w(data); - else - m_expansions[2]->io_write(offset, data); - } - else - { - for (int i=0; i<3; i++) - m_expansions[i]->io_write(offset, data); - } -} - -// module read/write handlers -READ8_MEMBER ( kc_state::expansion_4000_r ){ return expansion_read(space, offset + 0x4000); } -WRITE8_MEMBER( kc_state::expansion_4000_w ){ expansion_write(space, offset + 0x4000, data); } -READ8_MEMBER ( kc_state::expansion_8000_r ){ return expansion_read(space, offset + 0x8000); } -WRITE8_MEMBER( kc_state::expansion_8000_w ){ expansion_write(space, offset + 0x8000, data); } -READ8_MEMBER ( kc_state::expansion_c000_r ){ return expansion_read(space, offset + 0xc000); } -WRITE8_MEMBER( kc_state::expansion_c000_w ){ expansion_write(space, offset + 0xc000, data); } -READ8_MEMBER ( kc_state::expansion_e000_r ){ return expansion_read(space, offset + 0xe000); } -WRITE8_MEMBER( kc_state::expansion_e000_w ){ expansion_write(space, offset + 0xe000, data); } - - -//************************************************************************** -// CASSETTE EMULATION -//************************************************************************** - -/* - The cassette motor is controlled by bit 6 of PIO port A. - The cassette read data is connected to /ASTB input of the PIO. - A edge from the cassette therefore will trigger a interrupt - from the PIO. - The duration between two edges can be timed and the data-bit - identified. - - I have used a timer to feed data into /ASTB. The timer is only - active when the cassette motor is on. -*/ - -void kc_state::update_cassette(int state) -{ - int astb = (state & m_ardy) ? 0 : 1; - - // if state is changed updates the /ASTB line - if (m_astb ^ astb) - { - m_z80pio->strobe_a(astb); - - m_astb = astb; - - // FIXME: temporary for allow kc85_2-3 to load cassette - if ((m_cassette->get_state() & 0x03) == CASSETTE_PLAY) - m_z80pio->data_write(0, m_pio_data[0]); - } -} - -TIMER_CALLBACK_MEMBER(kc_state::kc_cassette_oneshot_timer) -{ - update_cassette(0); - - m_cassette_oneshot_timer->reset(); -} - -// timer used for polling data from cassette input -// enabled only when cassette motor is on -TIMER_CALLBACK_MEMBER(kc_state::kc_cassette_timer_callback) -{ - // read cassette data - int bit = (m_cassette->input() > 0.0038) ? 1 : 0; - - // generates a pulse when the cassette input changes state - if (bit ^ m_cassette_in) - { - update_cassette(1); - m_cassette_in = bit; - m_cassette_oneshot_timer->adjust(attotime::from_double(TIME_OF_74LS123(RES_K(10), CAP_N(1)))); - } -} - -void kc_state::cassette_set_motor(int motor_state) -{ - /* set new motor state in cassette device */ - m_cassette->change_state(motor_state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - if (motor_state) - { - /* start timer */ - m_cassette_timer->adjust(attotime::zero, 0, KC_CASSETTE_TIMER_FREQUENCY); - } - else - { - /* stop timer */ - m_cassette_timer->reset(); - } -} - -/* - pin 2 = gnd - pin 3 = read - pin 1 = k1 ?? modulating signal - pin 4 = k0 ?? signal?? - pin 5 = motor on - - - Tape signals: - K0, K1 ?? - MOTON motor control - ASTB read? - - T1-T4 give 4 bit a/d tone sound? - K1, K0 are mixed with tone. - - Cassette read goes into ASTB of PIO. - From this, KC must be able to detect the length - of the pulses and can read the data. - - - Tape write: clock comes from CTC? - truck signal resets, 5v signal for set. - output gives k0 and k1. - -*/ - - - -//************************************************************************** -// KC85 bankswitch -//************************************************************************** - -/* update status of memory area 0x0000-0x03fff */ -void kc_state::update_0x00000() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - /* access ram? */ - if (m_pio_data[0] & (1<<1)) - { - LOG(("ram0 enabled\n")); - - /* yes; set address of bank */ - space.install_read_bank(0x0000, 0x3fff, "bank1"); - membank("bank1")->set_base(m_ram_base); - - /* write protect ram? */ - if ((m_pio_data[0] & (1<<3)) == 0) - { - /* yes */ - LOG(("ram0 write protected\n")); - - /* ram is enabled and write protected */ - space.unmap_write(0x0000, 0x3fff); - } - else - { - LOG(("ram0 write enabled\n")); - - /* ram is enabled and write enabled */ - space.install_write_bank(0x0000, 0x3fff, "bank1"); - } - } - else - { - LOG(("Module at 0x0000\n")); - - space.install_read_handler (0x0000, 0x3fff, 0, 0, read8_delegate(FUNC(kc_state::expansion_read), this), 0); - space.install_write_handler(0x0000, 0x3fff, 0, 0, write8_delegate(FUNC(kc_state::expansion_write), this), 0); - } -} - -/* update status of memory area 0x4000-0x07fff */ -void kc_state::update_0x04000() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - LOG(("Module at 0x4000\n")); - - space.install_read_handler (0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(kc_state::expansion_4000_r), this), 0); - space.install_write_handler(0x4000, 0x7fff, 0, 0, write8_delegate(FUNC(kc_state::expansion_4000_w), this), 0); - -} - - -/* update memory address 0x0c000-0x0e000 */ -void kc_state::update_0x0c000() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - if ((m_pio_data[0] & (1<<7)) && memregion("basic")->base() != NULL) - { - /* BASIC takes next priority */ - LOG(("BASIC rom 0x0c000\n")); - - membank("bank4")->set_base(memregion("basic")->base()); - space.install_read_bank(0xc000, 0xdfff, "bank4"); - space.unmap_write(0xc000, 0xdfff); - } - else - { - LOG(("Module at 0x0c000\n")); - - space.install_read_handler (0xc000, 0xdfff, 0, 0, read8_delegate(FUNC(kc_state::expansion_c000_r), this), 0); - space.install_write_handler(0xc000, 0xdfff, 0, 0, write8_delegate(FUNC(kc_state::expansion_c000_w), this), 0); - } -} - -/* update memory address 0x0e000-0x0ffff */ -void kc_state::update_0x0e000() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - if (m_pio_data[0] & (1<<0)) - { - /* enable CAOS rom in memory range 0x0e000-0x0ffff */ - LOG(("CAOS rom 0x0e000\n")); - /* read will access the rom */ - membank("bank5")->set_base(memregion("caos")->base() + 0x2000); - space.install_read_bank(0xe000, 0xffff, "bank5"); - space.unmap_write(0xe000, 0xffff); - } - else - { - LOG(("Module at 0x0e000\n")); - - space.install_read_handler (0xe000, 0xffff, 0, 0, read8_delegate(FUNC(kc_state::expansion_e000_r), this), 0); - space.install_write_handler(0xe000, 0xffff, 0, 0, write8_delegate(FUNC(kc_state::expansion_e000_w), this), 0); - } -} - - -/* update status of memory area 0x08000-0x0ffff */ -void kc_state::update_0x08000() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - if (m_pio_data[0] & (1<<2)) - { - /* IRM enabled */ - LOG(("IRM enabled\n")); - - membank("bank3")->set_base(m_video_ram); - space.install_readwrite_bank(0x8000, 0xbfff, "bank3"); - } - else - { - LOG(("Module at 0x8000!\n")); - - space.install_read_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(kc_state::expansion_8000_r), this), 0); - space.install_write_handler(0x8000, 0xbfff, 0, 0, write8_delegate(FUNC(kc_state::expansion_8000_w), this), 0); - } -} - - -/* update status of memory area 0x4000-0x07fff */ -void kc85_4_state::update_0x04000() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - /* access ram? */ - if (m_port_86_data & (1<<0)) - { - LOG(("RAM4 enabled\n")); - - /* yes */ - space.install_read_bank(0x4000, 0x7fff, "bank2"); - /* set address of bank */ - membank("bank2")->set_base(m_ram_base + 0x4000); - - /* write protect ram? */ - if ((m_port_86_data & (1<<1)) == 0) - { - /* yes */ - LOG(("ram4 write protected\n")); - - /* ram is enabled and write protected */ - space.nop_write(0x4000, 0x7fff); - } - else - { - LOG(("ram4 write enabled\n")); - - /* ram is enabled and write enabled */ - space.install_write_bank(0x4000, 0x7fff, "bank2"); - } - } - else - { - LOG(("Module at 0x4000\n")); - - space.install_read_handler (0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(kc_state::expansion_4000_r), this), 0); - space.install_write_handler(0x4000, 0x7fff, 0, 0, write8_delegate(FUNC(kc_state::expansion_4000_w), this), 0); - } - -} - -/* update memory address 0x0c000-0x0e000 */ -void kc85_4_state::update_0x0c000() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - if (m_port_86_data & (1<<7)) - { - /* CAOS rom takes priority */ - LOG(("CAOS rom 0x0c000\n")); - - membank("bank4")->set_base(memregion("caos")->base()); - space.install_read_bank(0xc000, 0xdfff, "bank4"); - space.unmap_write(0xc000, 0xdfff); - } - else - { - if (m_pio_data[0] & (1<<7)) - { - /* BASIC takes next priority */ - LOG(("BASIC rom 0x0c000\n")); - - int bank = memregion("basic")->bytes() == 0x8000 ? (m_port_86_data>>5) & 0x03 : 0; - - membank("bank4")->set_base(memregion("basic")->base() + (bank << 13)); - space.install_read_bank(0xc000, 0xdfff, "bank4"); - space.unmap_write(0xc000, 0xdfff); - } - else - { - LOG(("Module at 0x0c000\n")); - - space.install_read_handler (0xc000, 0xdfff, 0, 0, read8_delegate(FUNC(kc_state::expansion_c000_r), this), 0); - space.install_write_handler(0xc000, 0xdfff, 0, 0, write8_delegate(FUNC(kc_state::expansion_c000_w), this), 0); - } - } -} - -void kc85_4_state::update_0x08000() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - if (m_pio_data[0] & (1<<2)) - { - /* IRM enabled - has priority over RAM8 enabled */ - LOG(("IRM enabled\n")); - - UINT8* ram_page = m_video_ram + ((BIT(m_port_84_data, 2)<<15) | (BIT(m_port_84_data, 1)<<14)); - - membank("bank3")->set_base(ram_page); - space.install_readwrite_bank(0x8000, 0xa7ff, "bank3"); - - membank("bank6")->set_base(m_video_ram + 0x2800); - space.install_readwrite_bank(0xa800, 0xbfff, "bank6"); - } - else if (m_pio_data[1] & (1<<5)) - { - LOG(("RAM8 enabled\n")); - - int ram8_block; - UINT8 *mem_ptr; - - /* ram8 block chosen */ - - if (m_ram->size() == 64 * 1024) - { - // kc85_4 64K RAM - ram8_block = ((m_port_84_data)>>4) & 0x01; - mem_ptr = m_ram_base + 0x8000 + (ram8_block<<14); - } - else - { - // kc85_5 256K RAM - ram8_block = ((m_port_84_data)>>4) & 0x0f; - mem_ptr = m_ram_base + (ram8_block<<14); - } - - membank("bank3")->set_base(mem_ptr); - membank("bank6")->set_base(mem_ptr + 0x2800); - space.install_read_bank(0x8000, 0xa7ff, "bank3"); - space.install_read_bank(0xa800, 0xbfff, "bank6"); - - /* write protect RAM8 ? */ - if ((m_pio_data[1] & (1<<6)) == 0) - { - /* ram8 is enabled and write protected */ - LOG(("RAM8 write protected\n")); - - space.nop_write(0x8000, 0xa7ff); - space.nop_write(0xa800, 0xbfff); - } - else - { - LOG(("RAM8 write enabled\n")); - - /* ram8 is enabled and write enabled */ - space.install_write_bank(0x8000, 0xa7ff, "bank3"); - space.install_write_bank(0xa800, 0xbfff, "bank6"); - } - } - else - { - LOG(("Module at 0x8000\n")); - - space.install_read_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(kc_state::expansion_8000_r), this), 0); - space.install_write_handler(0x8000, 0xbfff, 0, 0, write8_delegate(FUNC(kc_state::expansion_8000_w), this), 0); - } -} - -//************************************************************************** -// KC85 Z80PIO Interface -//************************************************************************** - - -/* PIO PORT A: port 0x088: - -bit 7: ROM C (BASIC) -bit 6: Tape Motor on -bit 5: LED -bit 4: K OUT -bit 3: WRITE PROTECT RAM 0 -bit 2: IRM -bit 1: ACCESS RAM 0 -bit 0: CAOS ROM E -*/ - -READ8_MEMBER( kc_state::pio_porta_r ) -{ - return m_pio_data[0]; -} - -WRITE8_MEMBER( kc_state::pio_porta_w ) -{ - if (m_pio_data[0] != data) // to avoid a severe slowdown during cassette loading - { - m_pio_data[0] = data; - - update_0x00000(); - update_0x08000(); - update_0x0c000(); - update_0x0e000(); - - cassette_set_motor(BIT(data, 6)); - } -} - - -/* PIO PORT B: port 0x089: -bit 7: BLINK ENABLE -bit 6: WRITE PROTECT RAM 8 -bit 5: ACCESS RAM 8 -bit 4: TONE 4 -bit 3: TONE 3 -bit 2: TONE 2 -bit 1: TONE 1 -bit 0: TRUCK */ - -READ8_MEMBER( kc_state::pio_portb_r ) -{ - return m_pio_data[1]; -} - -WRITE8_MEMBER( kc_state::pio_portb_w ) -{ - m_pio_data[1] = data; - - update_0x08000(); - - /* 16 speaker levels */ - m_speaker_level = (data>>1) & 0x0f; - - speaker_update(); -} - -/* port 0x84/0x85: - -bit 7: RAF3 -bit 6: RAF2 -bit 5: RAF1 -bit 4: RAF0 -bit 3: FPIX. high resolution -bit 2: BLA1 .access screen -bit 1: BLA0 .pixel/color -bit 0: BILD .display screen 0 or 1 -*/ - -WRITE8_MEMBER( kc85_4_state::kc85_4_84_w ) -{ - LOG(("0x84 W: %02x\n", data)); - - m_port_84_data = data; - - video_control_w(data); - - update_0x08000(); -} - -READ8_MEMBER( kc85_4_state::kc85_4_84_r ) -{ - return m_port_84_data; -} - - -/* port 0x86/0x87: - -bit 7: ROCC -bit 6: ROF1 -bit 5: ROF0 -bit 4-2 are not connected -bit 1: WRITE PROTECT RAM 4 -bit 0: ACCESS RAM 4 -*/ - -WRITE8_MEMBER( kc85_4_state::kc85_4_86_w ) -{ - LOG(("0x86 W: %02x\n", data)); - - m_port_86_data = data; - - update_0x0c000(); - update_0x04000(); -} - -READ8_MEMBER( kc85_4_state::kc85_4_86_r ) -{ - return m_port_86_data; -} - -/*****************************************************************/ - - -/* callback for ardy output from PIO */ -/* used in KC85/4 & KC85/3 cassette interface */ -WRITE_LINE_MEMBER( kc_state::pio_ardy_cb) -{ - m_ardy = state & 0x01; -} - -/* callback for brdy output from PIO */ -/* used in KC85/4 & KC85/3 keyboard interface */ -WRITE_LINE_MEMBER( kc_state::pio_brdy_cb) -{ - m_brdy = state & 0x01; -} - -/* used in cassette write -> K0 */ -WRITE_LINE_MEMBER( kc_state::ctc_zc0_callback ) -{ - if (state) - { - m_k0_line^=1; - speaker_update(); - } -} - -/* used in cassette write -> K1 */ -WRITE_LINE_MEMBER( kc_state::ctc_zc1_callback) -{ - if (state) - { - m_k1_line^=1; - speaker_update(); - - // K1 line is also cassette output - m_cassette->output((m_k1_line & 1) ? +1 : -1); - } - -} - -TIMER_DEVICE_CALLBACK_MEMBER(kc_state::kc_scanline) -{ - int scanline = (int)param; - - /* set clock input for channel 0 and 1 to ctc */ - m_z80ctc->trg0(1); - m_z80ctc->trg0(0); - m_z80ctc->trg1(1); - m_z80ctc->trg1(0); - - if (scanline == 256) - { - /* set clock input for channel 2 and 3 to ctc */ - m_z80ctc->trg2(1); - m_z80ctc->trg2(0); - m_z80ctc->trg3(1); - m_z80ctc->trg3(0); - } -} - -void kc_state::speaker_update() -{ - /* this might not be correct, the range might be logarithmic and not linear! */ - m_speaker->level_w(m_k0_line ? (m_speaker_level | (m_k1_line ? 0x01 : 0)) : 0); -} - -/* keyboard callback */ -WRITE_LINE_MEMBER( kc_state::keyboard_cb ) -{ - m_z80pio->strobe_b(state & m_brdy); - - // FIXME: understand why the PIO fail to acknowledge the irq on kc85_2/3 - m_z80pio->data_write(1, m_pio_data[1]); -} - - -void kc_state::machine_start() -{ - m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kc_state::kc_cassette_timer_callback),this)); - m_cassette_oneshot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kc_state::kc_cassette_oneshot_timer),this)); - - m_ram_base = m_ram->pointer(); - - m_expansions[0] = machine().device("m8"); - m_expansions[1] = machine().device("mc"); - m_expansions[2] = machine().device("exp"); -} - -void kc_state::machine_reset() -{ - m_pio_data[0] = 0x0f; - m_pio_data[1] = 0xf1; - - update_0x00000(); - update_0x04000(); - update_0x08000(); - update_0x0c000(); - update_0x0e000(); - - // set low resolution at reset - m_high_resolution = 0; - - cassette_set_motor(0); - - /* this is temporary. Normally when a Z80 is reset, it will - execute address 0. It appears the KC85 series pages the rom - at address 0x0000-0x01000 which has a single jump in it, - can't see yet where it disables it later!!!! so for now - here will be a override */ - m_maincpu->set_pc(0x0f000); -} - -void kc85_4_state::machine_reset() -{ - kc_state::machine_reset(); - - m_port_84_data = 0x00; - m_port_86_data = 0x00; -} diff --git a/src/mess/machine/kc_keyb.c b/src/mess/machine/kc_keyb.c deleted file mode 100644 index 740d0dc7fce..00000000000 --- a/src/mess/machine/kc_keyb.c +++ /dev/null @@ -1,614 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/********************************************************************* - - kc_keyb.c - - KC85_2/3/4/5 Keyboard emulation - -********************************************************************** - - E-mail from Torsten Paul about the keyboard: - - Torsten.Paul@gmx.de - -"> I hope that you will be able to help me so I can add keyboard -> emulation to it. -> -Oh yes the keyboard caused me a lot of trouble too. I still don't -understand it completely. -A first dirty but working keyboard support is quite easy because -of the good and modular system rom. Most programs use the supplied -routines to read keyboard input so patching the right memory address -with the keycode that is originally supplied by the interrupt -routines for keyboard input will work. So if you first want to -have a simple start to get other things to work you can try this. - - * write keycode (ascii) to address IX+0dh (0x1fd) - * set bit 0 at address IX+08h (0x1f8) - simply writing 01h - worked for me but some other bits are used too - this bit is reset if the key is read by the system - -> From the schematics I see that the keyboard is linked to the CTC and PIO, -> but I don't understand it fully. -> Please can you tell me more about how the keyboard is scanned? -> -The full emulation is quite tricky and I still have some programs that -behave odd. (A good hint for a correct keyboard emulation is Digger ;-). - -Ok, now the technical things: - -The keyboard of the KC is driven by a remote control circuit that is -originally designed for infrared remote control. This one was named -U807 and I learned there should be a similar chip called SAB 3021 -available but I never found the specs on the web. The SAB 3021 was -produced by Valvo which doesn't exist anymore (bought by Phillips -if I remember correctly). If you have more luck finding the specs -I'm still interested. -There also was a complementary chip for the recieving side but that -was not used in the KC unfortunately. They choosed to measure the -pulses sent by the U807 via PIO and CTC. - -Anyway here is what I know about the protocol: - -The U807 sends impulses with equal length. The information is -given by the time between two impulses. Short time means bit is 1 -long time mean bit is 0. The impulses are modulated by a 62.5 kHz -Signal but that's not interesting for the emulator. -The timing comes from a base clock of 4 MHz that is divided -multiple times: - -4 MHz / 64 - 62.5 kHz -> used for filtered amplification -62.5 kHz / 64 - 976 Hz -> 1.024 ms -976 / 7 - 140 Hz -> 7.2 ms -976 / 5 - 195 Hz -> 5.1 ms - -short - 5.12 ms - 1 bit -long - 7.168 ms - 0 bit - - +-+ +-+ +-+ +-+ - | | | | | | | | - +--+ +-----+ +-------+ +-----+ +--.... - - | | |---0---| |--1--| - ^ - | - Startbit = shift key - -The keyboard can have 64 keys with an additional key that is used by -the KC as shift key. This additional key is directly connected to the -chip and changes the startbit. All other keys are arranged in a matrix. - -The chip sends full words of 7 bits (including the startbit) at least -twice for each keypress with a spacing of 14 * 1.024 ms. If the key -is still pressed the double word is repeated after 19 * 1.024 ms. - -The impulses trigger the pio interrupt line for channel B that -triggers the time measurement by the CTC channel 3." - - -********************************************************************** - - - The CTC timer 3 count is initialised at 0x08f and counts down. - - The pulses are connected into PIO /BSTB and generate a interrupt - on a positive edge. A pulse will not get through if BRDY from PIO is - not true! - - Then the interrupt occurs, the CTC count is read. The time between - pulses is therefore measured by the CTC. - - The time is checked and depending on the value the KC detects - a 1 or 0 bit sent from the keyboard. - - Summary From code below: - - 0x065<=count<0x078 -> 0 bit "short pulse" - 0x042<=count<0x065 -> 1 bit "long pulse" - count<0x014 -> ignore - count>=0x078 -> ignore - 0x014<=count<0x042 -> signal end of code "very long pulse" - - codes are sent bit 0, bit 1, bit 2...bit 7. bit 0 is the state - of the shift key. - - Torsten's e-mail indicates "short pulse" for 1 bit, and "long - pulse" for 0 bit, but I found this to be incorrect. However, - the timings are correct. - - - Keyboard reading procedure extracted from KC85/4 system rom: - -0345 f5 push af -0346 db8f in a,(#8f) ; get CTC timer 3 count -0348 f5 push af -0349 3ea7 ld a,#a7 ; channel 3, enable int, select counter mode, control word - ; write, software reset, time constant follows -034b d38f out (#8f),a -034d 3e8f ld a,#8f ; time constant -034f d38f out (#8f),a -0351 f1 pop af - -0352 fb ei -0353 b7 or a ; count is over -0354 284d jr z,#03a3 ; - - ;; check count is in range -0356 fe14 cp #14 -0358 3849 jr c,#03a3 ; -035a fe78 cp #78 -035c 3045 jr nc,#03a3 ; - - ;; at this point, time must be between #14 and #77 to be valid - - ;; if >=#65, then carry=0, and a 0 bit has been detected - -035e fe65 cp #65 -0360 303d jr nc,#039f ; (61) - - ;; if <#65, then a 1 bit has been detected. carry is set with the addition below. - ;; a carry will be generated if the count is >#42 - - ;; therefore for a 1 bit to be generated, then #42<=time<#65 - ;; must be true. - -0362 c6be add a,#be -0364 3839 jr c,#039f ; (57) - - ;; this code appears to take the transmitted scan-code - ;; and converts it into a useable code by the os??? -0366 e5 push hl -0367 d5 push de - ;; convert hardware scan-code into os code -0368 dd7e0c ld a,(ix+#0c) -036b 1f rra -036c ee01 xor #01 -036e dd6e0e ld l,(ix+#0e) -0371 dd660f ld h,(ix+#0f) -0374 1600 ld d,#00 -0376 5f ld e,a -0377 19 add hl,de -0378 7e ld a,(hl) -0379 d1 pop de -037a e1 pop hl - - ;; shift lock pressed? -037b ddcb087e bit 7,(ix+#08) -037f 200a jr nz,#038b - ;; no. - - ;; alpha char? -0381 fe40 cp #40 -0383 3806 jr c,#038b -0385 fe80 cp #80 -0387 3002 jr nc,#038b - ;; yes, it is a alpha char - ;; force to lower case -0389 ee20 xor #20 - -038b ddbe0d cp (ix+#0d) ;; same as stored? -038e 201d jr nz,#03ad - - ;; yes - must be held for a certain time before it can repeat? -0390 f5 push af -0391 3ae0b7 ld a,(#b7e0) -0394 ddbe0a cp (ix+#0a) -0397 3811 jr c,#03aa -0399 f1 pop af - -039a dd340a inc (ix+#0a) ;; incremenent repeat count? -039d 1804 jr #03a3 - - ;; update scan-code received so far - -039f ddcb0c1e rr (ix+#0c) ; shift in 0 or 1 bit depending on what has been selected - -03a3 db89 in a,(#89) ; used to clear brdy -03a5 d389 out (#89),a -03a7 f1 pop af -03a8 ed4d reti - -03aa f1 pop af -03ab 1808 jr #03b5 - -;; clear count -03ad dd360a00 ld (ix+#0a),#00 - -;; shift lock? -03b1 fe16 cp #16 -03b3 2809 jr z,#03be - -;; store char -03b5 dd770d ld (ix+#0d),a -03b8 ddcb08c6 set 0,(ix+#08) -03bc 18e5 jr #03a3 - -;; toggle shift lock on/off -03be dd7e08 ld a,(ix+#08) -03c1 ee80 xor #80 -03c3 dd7708 ld (ix+#08),a -;; shift/lock was last key pressed -03c6 3e16 ld a,#16 -03c8 18eb jr #03b5 - -03ca b7 or a -03cb ddcb0846 bit 0,(ix+#08) -03cf c8 ret z -03d0 dd7e0d ld a,(ix+#0d) -03d3 37 scf -03d4 c9 ret -03d5 cdcae3 call #e3ca -03d8 d0 ret nc -03d9 ddcb0886 res 0,(ix+#08) -03dd c9 ret -03de cdcae3 call #e3ca -03e1 d0 ret nc -03e2 fe03 cp #03 -03e4 37 scf -03e5 c8 ret z -03e6 a7 and a -03e7 c9 ret - - - Keyboard reading procedure extracted from KC85/3 rom: - - -019a f5 push af -019b db8f in a,(#8f) -019d f5 push af -019e 3ea7 ld a,#a7 -01a0 d38f out (#8f),a -01a2 3e8f ld a,#8f -01a4 d38f out (#8f),a -01a6 f1 pop af -01a7 ddcb085e bit 3,(ix+#08) -01ab ddcb089e res 3,(ix+#08) -01af 2055 jr nz,#0206 ; (85) - -01b1 fe65 cp #65 -01b3 3054 jr nc,#0209 - - - ;; count>=#65 = 0 bit - ;; #44<=count<#65 = 1 bit - ;; count<#44 = end of code - -01b5 fe44 cp #44 -01b7 3053 jr nc,#020c -01b9 e5 push hl -01ba d5 push de -01bb ddcb0c3e srl (ix+#0c) -01bf dd7e08 ld a,(ix+#08) -01c2 e680 and #80 -01c4 07 rlca -01c5 ddae0c xor (ix+#0c) -01c8 2600 ld h,#00 -01ca dd5e0e ld e,(ix+#0e) -01cd dd560f ld d,(ix+#0f) -01d0 6f ld l,a -01d1 19 add hl,de -01d2 7e ld a,(hl) -01d3 d1 pop de -01d4 e1 pop hl -01d5 ddbe0d cp (ix+#0d) -01d8 2811 jr z,#01eb ; (17) -01da dd770d ld (ix+#0d),a -01dd ddcb08a6 res 4,(ix+#08) -01e1 ddcb08c6 set 0,(ix+#08) -01e5 dd360a00 ld (ix+#0a),#00 -01e9 181b jr #0206 ; (27) -01eb dd340a inc (ix+#0a) -01ee ddcb0866 bit 4,(ix+#08) -01f2 200c jr nz,#0200 ; (12) -01f4 ddcb0a66 bit 4,(ix+#0a) -01f8 280c jr z,#0206 ; (12) -01fa ddcb08e6 set 4,(ix+#08) -01fe 18e1 jr #01e1 ; (-31) -0200 ddcb0a4e bit 1,(ix+#0a) -0204 20db jr nz,#01e1 ; (-37) -0206 f1 pop af -0207 ed4d reti -0209 b7 or a -020a 1801 jr #020d ; (1) -020c 37 scf -020d ddcb0c1e rr (ix+#0c) -0211 18f3 jr #0206 ; (-13) - -*********************************************************************/ - - -#include "emu.h" -#include "kc_keyb.h" - -#define VERBOSE 0 -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -const device_type KC_KEYBOARD = &device_creator; - -//************************************************************************** -// Input Ports -//************************************************************************** - -// this is a fake keyboard layout. The keys are converted into codes -// which are transmitted by the keyboard to the base-unit. key code can -// be calculated as (line*8)+bit_index - -static INPUT_PORTS_START( kc_keyboard ) - // start of keyboard scan-codes - // codes 0-7 - PORT_START("KEY0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - // codes 8-15 - PORT_START("KEY1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('^') PORT_CHAR(0x00AC) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clr") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - // codes 16-23 - PORT_START("KEY2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('@') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - // codes 24-31 - PORT_START("KEY3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Brk") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - // codes 32-39 - PORT_START("KEY4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - // codes 40-47 - PORT_START("KEY5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x08, 0x00, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - // codes 48-56 - PORT_START("KEY6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('|') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('+') PORT_CHAR(';') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - // codes 56-63 - PORT_START("KEY7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - // end of keyboard scan-codes - PORT_START("SHIFT") - // has a single shift key. Mapped here to left and right shift. - // shift is connected to the MOC pin of the U807 - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) -INPUT_PORTS_END - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// kc_keyboard_device - constructor -//------------------------------------------------- -kc_keyboard_device::kc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, KC_KEYBOARD, "KC Keyboard", tag, owner, clock, "kc_keyboard", __FILE__), - m_write_out(*this) -{ -} - -//------------------------------------------------- -// kc_keyboard_device - destructor -//------------------------------------------------- - -kc_keyboard_device::~kc_keyboard_device() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void kc_keyboard_device::device_start() -{ - // resolve callbacks - m_write_out.resolve_safe(); - - m_timer_transmit_pulse = timer_alloc(TIMER_TRANSMIT_PULSE); - - m_timer_transmit_pulse->adjust(attotime::from_usec(1024), 0, attotime::from_usec(1024)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void kc_keyboard_device::device_reset() -{ - // set initial state - m_write_out(CLEAR_LINE); - - m_transmit_buffer.pulse_sent = 0; - m_transmit_buffer.pulse_count = 0; - - memset(&m_transmit_buffer, 0, sizeof(m_transmit_buffer)); -} - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor kc_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( kc_keyboard ); -} - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void kc_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_TRANSMIT_PULSE: - if (m_transmit_buffer.pulse_sent < m_transmit_buffer.pulse_count) - { - // byte containing pulse state - int pulse_byte_count = m_transmit_buffer.pulse_sent>>3; - // bit within byte containing pulse state - int pulse_bit_count = 7 - (m_transmit_buffer.pulse_sent & 0x07); - - // get current pulse state - int pulse_state = (m_transmit_buffer.data[pulse_byte_count]>>pulse_bit_count) & 0x01; - - LOG(("KC keyboard sending pulse: %02x\n", pulse_state)); - - // send pulse - m_write_out(pulse_state ? ASSERT_LINE : CLEAR_LINE); - - // update counts - m_transmit_buffer.pulse_sent++; - } - else - { - // if there is nothing to send, rescan the keyboard - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7" }; - - m_transmit_buffer.pulse_sent = 0; - m_transmit_buffer.pulse_count = 0; - - // scan all lines (excluding shift) - for (int i=0; i<8; i++) - { - UINT8 keyboard_line_data = ioport(keynames[i])->read(); - - // scan through each bit - for (int b=0; b<8; b++) - { - // is pressed? - if ((keyboard_line_data & (1<>3; - int pulse_bit_count = 7-(m_transmit_buffer.pulse_count & 0x07); - - if (pulse_state) - m_transmit_buffer.data[pulse_byte_count] |= (1< end of time for bit - add_pulse_to_transmit_buffer(1); -} - - -//------------------------------------------------- -// begin pulse transmit -//------------------------------------------------- - -void kc_keyboard_device::transmit_scancode(UINT8 scan_code) -{ - // initial pulse -> start of code - add_pulse_to_transmit_buffer(1); - - // state of shift key - add_bit((ioport("SHIFT")->read() & 0x01)^0x01); - - for (int i=0; i<6; i++) - { - // each bit in turn - add_bit(scan_code & (1< kc_keyboard_device - -class kc_keyboard_device : public device_t -{ -public: - // construction/destruction - kc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ~kc_keyboard_device(); - - template static devcb_base &set_out_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_out.set_callback(object); } - - // optional information overrides - virtual ioport_constructor device_input_ports() const; - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - void add_pulse_to_transmit_buffer(int pulse_state, int pulse_number = 1); - void add_bit(int bit); - void transmit_scancode(UINT8 scan_code); - -private: - static const device_timer_id TIMER_TRANSMIT_PULSE = 1; - - // internal state - emu_timer * m_timer_transmit_pulse; - devcb_write_line m_write_out; - - // pulses to transmit - struct - { - UINT8 data[KC_TRANSMIT_BUFFER_LENGTH>>3]; - int pulse_sent; - int pulse_count; - } m_transmit_buffer; -}; - -// device type definition -extern const device_type KC_KEYBOARD; - -#endif /* __KC_KEYB_H__ */ diff --git a/src/mess/machine/kramermc.c b/src/mess/machine/kramermc.c deleted file mode 100644 index 503dbf711f5..00000000000 --- a/src/mess/machine/kramermc.c +++ /dev/null @@ -1,42 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Kramer MC machine driver by Miodrag Milanovic - - 13/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "machine/z80pio.h" -#include "includes/kramermc.h" - - -READ8_MEMBER(kramermc_state::kramermc_port_a_r) -{ - return 0xff; -} - -READ8_MEMBER(kramermc_state::kramermc_port_b_r) -{ - static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; - - return ioport(keynames[m_key_row])->read(); -} - -WRITE8_MEMBER(kramermc_state::kramermc_port_a_w) -{ - m_key_row = ((data >> 1) & 0x07); -} - -/* Driver initialization */ -DRIVER_INIT_MEMBER(kramermc_state,kramermc) -{ -} - -void kramermc_state::machine_reset() -{ - m_key_row = 0; -} diff --git a/src/mess/machine/lisa.c b/src/mess/machine/lisa.c deleted file mode 100644 index 2e2b2bb6bc6..00000000000 --- a/src/mess/machine/lisa.c +++ /dev/null @@ -1,1927 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - experimental LISA driver - - This driver runs most ROM test code successfully, and it loads the boot - file, but it locks when booting from Lisa OS (probably because of floppy - write bug). MacWorks boots fine, though (I think it looks when we - attempt to write to floppy, too). - - TODO : - * fix floppy write bug - * *** Boot and run LisaTest !!! *** - * finish MMU (does not switch to bank 0 on 68k trap) --- fixed in June 2003??? - * support hard disk to boot office system - * finish keyboard/mouse support - * finish clock support - * write SCC support - * finalize sound support (involves adding new features to the 6522 VIA core) - * fix warm-reset (I think I need to use a callback when 68k RESET - instruction is called) - * write support for additionnal hardware (hard disk, etc...) - * emulate LISA1 (?) - * optimize MMU emulation ! - - DONE (just a reminder to uplift my spirit) : - * the lion's share of MMU (spring 2000) - * video hardware (except contrast control) (spring 2000) - * LISA2/Mac XL floppy hardware (november 2000) - - Credits : - * the lisaemu project () has gathered much - hardware information (books, schematics...) without which this driver - could never have been written - * The driver raised the interest of several MESS regulars (Paul Lunga, - Dennis Munsie...) who supported my feeble efforts - - Raphael Nabet, 2000-2003 -*/ - -#include "includes/lisa.h" - - -/* - pointers with RAM & ROM location -*/ - -/* up to 2MB of 68k RAM (normally 1MB or 512kb), generally 16kb of ROM */ - -/* offsets in "maincpu" */ -#define RAM_OFFSET 0x004000 -#define ROM_OFFSET 0x000000 - -/* 1kb of RAM for 6504 floppy disk controller (shared with 68000), and 4kb of -ROM (8kb on some boards, but then only one 4kb bank is selected, according to -the drive type (TWIGGY or 3.5'')) */ - -/* special ROM (includes S/N) */ - - -/* - MMU regs -*/ - - - - - -/* - parity logic - only hard errors are emulated for now, since - a) the ROMs power-up test only tests hard errors - b) most memory boards do not use soft errors (i.e. they only generate 1 - parity bit to detect errors, instead of generating several ECC bits to - fix errors) -*/ - - - - -/* - video -*/ - - -/* - 2 vias : one is used for communication with COPS ; the other may be used to interface - a hard disk -*/ - -/* - floppy disk interface -*/ - - - - -/* - lisa model identification -*/ -enum lisa_model_t -{ - /*lisa1,*/ /* twiggy floppy drive */ - lisa2, /* 3.5'' Sony floppy drive */ - lisa210, /* modified I/O board, and internal 10Meg drive */ - mac_xl /* same as above with modified video */ -}; - - - -/* - protos -*/ - - - - - -/* - Interrupt handling -*/ - -void lisa_state::field_interrupts() -{ - if (m_parity_error_pending) - return; /* don't touch anything... */ - -#if 0 - if (RSIR) - // serial interrupt - m_maincpu->set_input_line_and_vector(M68K_IRQ_6, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - else if (int0) - // external interrupt - m_maincpu->set_input_line_and_vector(M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - else if (int1) - // external interrupt - m_maincpu->set_input_line_and_vector(M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - else if (int2) - // external interrupt - m_maincpu->set_input_line_and_vector(M68K_IRQ_3, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - else -#endif - if (m_KBIR) - /* COPS VIA interrupt */ - m_maincpu->set_input_line_and_vector(M68K_IRQ_2, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - else if (m_FDIR || m_VTIR) - /* floppy disk or VBl */ - m_maincpu->set_input_line_and_vector(M68K_IRQ_1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - else - /* clear all interrupts */ - m_maincpu->set_input_line_and_vector(M68K_IRQ_1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); -} - -void lisa_state::set_parity_error_pending(int value) -{ -#if 1 - /* does not work well due to bugs in 68k cores */ - m_parity_error_pending = value; - if (m_parity_error_pending) - { - m_maincpu->set_input_line_and_vector(M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - } - else - { - m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE); - } -#else - /* work-around... */ - if ((! m_parity_error_pending) && value) - { - m_parity_error_pending = 1; - m_maincpu->set_input_line_and_vector(M68K_IRQ_7, PULSE_LINE, M68K_INT_ACK_AUTOVECTOR); - } - else if (m_parity_error_pending && (! value)) - { - m_parity_error_pending = 0; - field_interrupts(); - } -#endif -} - -void lisa_state::set_VTIR(int value) -{ - if (m_VTIR != value) - { - m_VTIR = value; - if (m_VTIR==1) - field_interrupts(); - } -} - - - -/* - keyboard interface (COPS simulation; our COPS CPU core is too broken and too esoteric to emulate this correctly, I tried) -*/ - -void lisa_state::COPS_send_data_if_possible() -{ - if ((! m_hold_COPS_data) && m_fifo_size && (! m_COPS_Ready)) - { -// printf("COPsim: sending %02x to VIA\n", m_fifo_data[m_fifo_head]); - - UINT8 data = m_fifo_data[m_fifo_head];/* output data */ - m_via0->write_pa0((data>>0)&1); - m_via0->write_pa1((data>>1)&1); - m_via0->write_pa2((data>>2)&1); - m_via0->write_pa3((data>>3)&1); - m_via0->write_pa4((data>>4)&1); - m_via0->write_pa5((data>>5)&1); - m_via0->write_pa6((data>>6)&1); - m_via0->write_pa7((data>>7)&1); - - if (m_fifo_head == m_mouse_data_offset) - m_mouse_data_offset = -1; /* we just phased out the mouse data in buffer */ - m_fifo_head = (m_fifo_head+1) & 0x7; - m_fifo_size--; - m_via0->write_ca1(1); /* pulse ca1 so that VIA reads it */ - m_via0->write_ca1(0); /* BTW, I have no idea how a real COPS does it ! */ - } -} - -/* send data (queue it into the FIFO if needed) */ -void lisa_state::COPS_queue_data(const UINT8 *data, int len) -{ -#if 0 - if (m_fifo_size + len <= 8) -#else - /* trash old data */ - while (m_fifo_size > 8 - len) - { - if (m_fifo_head == m_mouse_data_offset) - m_mouse_data_offset = -1; /* we just phased out the mouse data in buffer */ - m_fifo_head = (m_fifo_head+1) & 0x7; - m_fifo_size--; - } -#endif - - { -// printf("Adding %d bytes of data to FIFO\n", len); - - while (len--) - { - m_fifo_data[m_fifo_tail] = * (data++); - m_fifo_tail = (m_fifo_tail+1) & 0x7; - m_fifo_size++; - } - - // do not try to send immediately here, the VIA is set to latch mode so - // sending too soon after a command can result in the DDR not yet being - // returned to input and the first byte gets trashed - } -} - -/* - scan_keyboard() - - scan the keyboard, and add key transition codes to buffer as needed -*/ -/* shamelessly stolen from machine/mac.c :-) */ - -/* keyboard matrix to detect transition */ - -void lisa_state::scan_keyboard() -{ - int i, j; - UINT8 keycode; - UINT8 keybuf[8] = { m_io_line0->read(), m_io_line1->read(), m_io_line2->read(), m_io_line3->read(), - m_io_line4->read(), m_io_line5->read(), m_io_line6->read(), m_io_line7->read() }; - - if (! m_COPS_force_unplug) - for (i=0; i<8; i++) - { - if (keybuf[i] != m_key_matrix[i]) - { /* if state has changed, find first bit which has changed */ - /*logerror("keyboard state changed, %d %X\n", i, keybuf);*/ - - for (j=0; j<16; j++) - { - if (((keybuf[i] ^ m_key_matrix[i]) >> j) & 1) - { - /* update key_matrix */ - m_key_matrix[i] = (m_key_matrix[i] & ~ (1 << j)) | (keybuf[i] & (1 << j)); - - /* create key code */ - keycode = (i << 4) | j; - if (keybuf[i] & (1 << j)) - { /* key down */ - keycode |= 0x80; - } -#if 0 - if (keycode == m_NMIcode) - { /* generate NMI interrupt */ - m_maincpu->set_input_line(M68K_IRQ_7, PULSE_LINE); - m_maincpu->set_input_line_vector(M68K_IRQ_7, M68K_INT_ACK_AUTOVECTOR); - } -#endif - COPS_queue_data(&keycode, 1); - } - } - } - } -} - -/* handle mouse moves */ -/* shamelessly stolen from machine/mac.c :-) */ -TIMER_CALLBACK_MEMBER(lisa_state::handle_mouse) -{ - int diff_x = 0, diff_y = 0; - int new_mx, new_my; - -#if 0 - if (m_COPS_force_unplug) - return; /* ???? */ -#endif - - new_mx = m_io_mouse_x->read(); - new_my = m_io_mouse_y->read(); - - /* see if it moved in the x coord */ - if (new_mx != m_last_mx) - { - diff_x = new_mx - m_last_mx; - - /* check for wrap */ - if (diff_x > 0x80) - diff_x = 0x100-diff_x; - if (diff_x < -0x80) - diff_x = -0x100-diff_x; - - m_last_mx = new_mx; - } - /* see if it moved in the y coord */ - if (new_my != m_last_my) - { - diff_y = new_my - m_last_my; - - /* check for wrap */ - if (diff_y > 0x80) - diff_y = 0x100-diff_y; - if (diff_y < -0x80) - diff_y = -0x100-diff_y; - - m_last_my = new_my; - } - - /* update any remaining count and then return */ - if (diff_x || diff_y) - { - if (m_mouse_data_offset != -1) - { - m_fifo_data[m_mouse_data_offset] += diff_x; - m_fifo_data[(m_mouse_data_offset+1) & 0x7] += diff_y; - } - else - { -#if 0 - if (m_fifo_size <= 5) -#else - /* trash old data */ - while (m_fifo_size > 5) - { - m_fifo_head = (m_fifo_head+1) & 0x7; - m_fifo_size--; - } -#endif - - { - /*logerror("Adding 3 bytes of mouse data to FIFO\n");*/ - - m_fifo_data[m_fifo_tail] = 0; - m_mouse_data_offset = m_fifo_tail = (m_fifo_tail+1) & 0x7; - m_fifo_data[m_fifo_tail] = diff_x; - m_fifo_tail = (m_fifo_tail+1) & 0x7; - m_fifo_data[m_fifo_tail] = diff_y; - m_fifo_tail = (m_fifo_tail+1) & 0x7; - m_fifo_size += 3; - - /*logerror("handle_mouse : trying to send data to VIA\n");*/ - COPS_send_data_if_possible(); - } - /* else, mouse data is lost forever (correct ??) */ - } - } -} - -/* read command from the VIA port A */ -TIMER_CALLBACK_MEMBER(lisa_state::read_COPS_command) -{ - int command; - address_space &space = m_maincpu->space(AS_PROGRAM); - - m_COPS_Ready = 0; - m_via0->write_pb6(m_COPS_Ready); - - /*logerror("read_COPS_command : trying to send data to VIA\n");*/ - COPS_send_data_if_possible(); - - /* some pull-ups allow the COPS to read 1s when the VIA port is not set as output */ - command = (m_COPS_command | (~ m_via0->read(space, via6522_device::VIA_DDRA))) & 0xff; - -// printf("Dropping Ready, command = %02x\n", command); - - if (command & 0x80) - return; /* NOP */ - - if (command & 0xF0) - { /* commands with 4-bit immediate operand */ - int immediate = command & 0xf; - - switch ((command & 0xF0) >> 4) - { - case 0x1: /* write clock data */ - if (m_clock_regs.clock_write_ptr != -1) - { - switch (m_clock_regs.clock_write_ptr) - { - case 0: - case 1: - case 2: - case 3: - case 4: - /* alarm */ - m_clock_regs.alarm &= ~ (0xf << (4 * (4 - m_clock_regs.clock_write_ptr))); - m_clock_regs.alarm |= immediate << (4 * (4 - m_clock_regs.clock_write_ptr)); - break; - case 5: - /* year */ - m_clock_regs.years = immediate; - break; - case 6: - /* day */ - m_clock_regs.days1 = immediate; - break; - case 7: - /* day */ - m_clock_regs.days2 = immediate; - break; - case 8: - /* day */ - m_clock_regs.days3 = immediate; - break; - case 9: - /* hours */ - m_clock_regs.hours1 = immediate; - break; - case 10: - /* hours */ - m_clock_regs.hours2 = immediate; - break; - case 11: - /* minutes */ - m_clock_regs.minutes1 = immediate; - break; - case 12: - /* minutes */ - m_clock_regs.minutes1 = immediate; - break; - case 13: - /* seconds */ - m_clock_regs.seconds1 = immediate; - break; - case 14: - /* seconds */ - m_clock_regs.seconds2 = immediate; - break; - case 15: - /* tenth */ - m_clock_regs.tenths = immediate; - break; - } - m_clock_regs.clock_write_ptr++; - if (m_clock_regs.clock_write_ptr == 16) - m_clock_regs.clock_write_ptr = -1; - } - - break; - - case 0x2: /* set clock mode */ - if (immediate & 0x8) - { /* start setting the clock */ - m_clock_regs.clock_write_ptr = 0; - } - else - { /* clock write disabled */ - m_clock_regs.clock_write_ptr = -1; - } - - if (! (immediate & 0x4)) - { /* enter sleep mode */ - /* ... */ - } - else - { /* wake up */ - /* should never happen */ - } - - m_clock_regs.clock_mode = (clock_mode_t)(immediate & 0x3); - break; - -#if 0 - /* LED commands - not implemented in production LISAs */ - case 0x3: /* write 4 keyboard LEDs */ - keyboard_leds = (keyboard_leds & 0x0f) | (immediate << 4); - break; - - case 0x4: /* write next 4 keyboard LEDs */ - keyboard_leds = (keyboard_leds & 0xf0) | immediate; - break; -#endif - - case 0x5: /* set high nibble of NMI character to nnnn */ - m_NMIcode = (m_NMIcode & 0x0f) | (immediate << 4); - break; - - case 0x6: /* set low nibble of NMI character to nnnn */ - m_NMIcode = (m_NMIcode & 0xf0) | immediate; - break; - - case 0x7: /* send mouse command */ - if (immediate & 0x8) - m_mouse_timer->adjust(attotime::zero, 0, attotime::from_msec((immediate & 0x7)*4)); /* enable mouse */ - else - m_mouse_timer->reset(); - break; - } - } - else - { /* operand-less commands */ - switch (command) - { - case 0x0: /*Turn I/O port on (???) */ - - break; - - case 0x1: /*Turn I/O port off (???) */ - - break; - - case 0x2: /* Read clock data */ - { - /* format and send reply */ - - UINT8 reply[7]; - - reply[0] = 0x80; - reply[1] = 0xE0 | m_clock_regs.years; - reply[2] = (m_clock_regs.days1 << 4) | m_clock_regs.days2; - reply[3] = (m_clock_regs.days3 << 4) | m_clock_regs.hours1; - reply[4] = (m_clock_regs.hours2 << 4) | m_clock_regs.minutes1; - reply[5] = (m_clock_regs.minutes2 << 4) | m_clock_regs.seconds1; - reply[6] = (m_clock_regs.seconds2 << 4) | m_clock_regs.tenths; - - COPS_queue_data(reply, 7); - } - break; - } - } -} - -/* this timer callback raises the COPS Ready line, which tells the COPS is about to read a command */ -TIMER_CALLBACK_MEMBER(lisa_state::set_COPS_ready) -{ - m_COPS_Ready = 1; - m_via0->write_pb6(m_COPS_Ready); - - /* impulsion width : +/- 20us */ - machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(lisa_state::read_COPS_command),this)); -} - -void lisa_state::reset_COPS() -{ - int i; - - m_fifo_size = 0; - m_fifo_head = 0; - m_fifo_tail = 0; - m_mouse_data_offset = -1; - - for (i=0; i<8; i++) - m_key_matrix[i] = 0; - - m_mouse_timer->reset(); -} - -void lisa_state::unplug_keyboard() -{ - static const UINT8 cmd[2] = - { - 0x80, /* RESET code */ - 0xFD /* keyboard unplugged */ - }; - - COPS_queue_data(cmd, 2); -} - -void lisa_state::plug_keyboard() -{ - /* - possible keyboard IDs according to Lisa Hardware Manual and boot ROM source code - - 2 MSBs : "mfg code" (-> 0x80 for Keytronics, 0x00 for "APD") - 6 LSBs : - 0x0x : "old US keyboard" - 0x3f : US keyboard - 0x3d : Canadian keyboard - 0x2f : UK - 0x2e : German - 0x2d : French - 0x27 : Swiss-French - 0x26 : Swiss-German - unknown : spanish, US dvorak, italian & swedish - */ - - static const UINT8 cmd[2] = - { - 0x80, /* RESET code */ - 0x3f /* keyboard ID - US for now */ - }; - - COPS_queue_data(cmd, 2); -} - - -/* called at power-up */ -void lisa_state::init_COPS() -{ - m_COPS_Ready = 0; - m_via0->write_pb6(m_COPS_Ready); - - reset_COPS(); -} - - - -/* VIA1 accessors (COPS, sound, and 2 hard disk lines) */ - -/* - PA0-7 (I/O) : VIA <-> COPS data bus - CA1 (I) : COPS sending valid data - CA2 (O) : VIA -> COPS handshake -*/ -WRITE8_MEMBER(lisa_state::COPS_via_out_a) -{ -// printf("VIA A = %02x\n", data); - m_COPS_command = data; -} - -WRITE_LINE_MEMBER(lisa_state::COPS_via_out_ca2) -{ - m_hold_COPS_data = state; - - /*logerror("COPS CA2 line state : %d\n", val);*/ - - /*logerror("COPS_via_out_ca2 : trying to send data to VIA\n");*/ - COPS_send_data_if_possible(); -} - -/* - PB7 (O) : CR* ("Controller Reset", used by hard disk interface) ??? - PB6 (I) : CRDY ("COPS ready") : set low by the COPS for 20us when it is reading a command - from the data bus (command latched at low-to-high transition) - PB5 (I/O) : PR* ; as output : "parity error latch reset" (only when CR* and RESET* are - inactive) ; as input : low when CR* or RESET are low. - PB4 (I) : FDIR (floppy disk interrupt request - the fdc shared RAM should not be accessed - unless this bit is 1) - PB1-3 (O) : sound volume - PB0 (O) : forces disconnection of keyboard and mouse (allows to retrive keyboard ID, etc.) - - CB1 : not used - CB2 (O) : sound output -*/ - -WRITE8_MEMBER(lisa_state::COPS_via_out_b) -{ - /* pull-up */ - data |= (~ m_via0->read(space, via6522_device::VIA_DDRA)) & 0x01; - - if (data & 0x01) - { - if (m_COPS_force_unplug) - { - m_COPS_force_unplug = 0; - plug_keyboard(); - } - } - else - { - if (! m_COPS_force_unplug) - { - m_COPS_force_unplug = 1; - unplug_keyboard(); - //reset_COPS(state); - } - } -} - -WRITE_LINE_MEMBER(lisa_state::COPS_via_out_cb2) -{ - m_speaker->level_w(state); -} - -void lisa_state::COPS_via_irq_func(int val) -{ - if (m_KBIR != val) - { - m_KBIR = val; - field_interrupts(); - } -} - -/* VIA2 accessors (hard disk, and a few floppy disk lines) */ - -/* - PA0-7 (I/O) : VIA <-> hard disk data bus (cf PB3) - CA1 (I) : hard disk BSY line - CA2 (O) : hard disk PSTRB* line -*/ - -/* - PB7 (O) : WCNT line : set contrast latch on low-to-high transition ? - PB6 (I) : floppy disk DISK DIAG line - PB5 (I) : hard disk data DD0-7 current parity (does not depend on PB2) - PB4 (O) : hard disk CMD* line - PB3 (O) : hard disk DR/W* line ; controls the direction of the drivers on the data bus - PB2 (O) : when low, disables hard disk interface drivers - PB1 (I) : hard disk BSY line - PB0 (I) : hard disk OCD (Open Cable Detect) line : 0 when hard disk attached - CB1 : not used - CB2 (I) : current parity latch value -*/ - - - -/* - LISA video emulation -*/ - -void lisa_state::video_start() -{ -} - -/* - Video update -*/ -UINT32 lisa_state::screen_update_lisa(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 *v; - int x, y; - /* resolution is 720*364 on lisa, vs 608*431 on mac XL */ - int resx = (m_features.has_mac_xl_video) ? 608 : 720; /* width */ - int resy = (m_features.has_mac_xl_video) ? 431 : 364; /* height */ - - UINT8 line_buffer[720]; - - v = m_videoram_ptr; - - for (y = 0; y < resy; y++) - { - for (x = 0; x < resx; x++) -// line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> ((x+y*resx) & 0xf))) ? 0 : 1; - line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> (x & 0xf))) ? 0 : 1; - draw_scanline8(bitmap, 0, y, resx, line_buffer, m_palette->pens()); - } - return 0; -} - -#if 0 // we can execute directly out of read handlers now, so this shouldn't be necessary any more. #if 0'd for documentation until we get everything working. -DIRECT_UPDATE_HANDLER (lisa_OPbaseoverride) -{ - lisa_state *state = machine.driver_data(); - /* upper 7 bits -> segment # */ - int segment = (address >> 17) & 0x7f; - int the_seg = m_seg; - - address &= 0xffffff; - - printf("lisa: logical address %x\n", address); - - if (m_setup) - { - if (address & 0x004000) - { -// the_seg = 0; /* correct ??? */ - } - else - { - if (address & 0x008000) - { /* MMU register : BUS error ??? */ - printf("illegal opbase address %lX\n", (long) address); - } - else - { /* system ROMs */ - direct.explicit_configure((address & 0xffc000), (address & 0xffc000) + 0x003fff, 0xffffff, m_rom_ptr - (address & 0x3fff)); - } - - return -1; - } - - } - - if (m_maincpu->state_int(M68K_SR) & 0x2000) - { - /* supervisor mode -> force register file 0 */ - the_seg = 0; - } - - { - int seg_offset = address & 0x01ffff; - - /* add relevant origin -> address */ - offs_t mapped_address = (m_mmu_regs[the_seg][segment].sorg + seg_offset) & 0x1fffff; - - switch ((mmu_entry_t)m_mmu_regs[the_seg][segment].type) - { - case RAM_r: - case RAM_rw: - if (seg_offset > m_mmu_regs[the_seg][segment].slim) - { - /* out of segment limits : bus error */ - printf("illegal opbase address%lX\n", (long) address); - } - direct.explicit_configure((address & 0xffc000), (address & 0xffc000) + 0x003fff, 0xffffff, m_ram_ptr + mapped_address - address); - printf("RAM\n"); - break; - - case RAM_stack_r: - case RAM_stack_rw: /* stack : bus error ??? */ - case IO: /* I/O : bus error ??? */ - case invalid: /* unmapped segment */ - /* bus error */ - printf("illegal opbase address%lX\n", (long) address); - break; - - case special_IO: - direct.explicit_configure((address & 0xffc000), (address & 0xffc000) + 0x003fff, 0xffffff, m_rom_ptr + (mapped_address & 0x003fff) - address); - printf("ROM\n"); - break; - } - } - - return -1; -} -#endif - -/* should save PRAM to file */ -/* TODO : save time difference with host clock, set default date, etc */ -void lisa_state::nvram_init(nvram_device &nvram, void *data, size_t size) -{ - memset(data, 0x00, size); - - { - /* Now we copy the host clock into the Lisa clock */ - system_time systime; - machine().base_datetime(systime); - - m_clock_regs.alarm = 0xfffffL; - /* The clock count starts on 1st January 1980 */ - m_clock_regs.years = (systime.local_time.year - 1980) & 0xf; - m_clock_regs.days1 = (systime.local_time.day + 1) / 100; - m_clock_regs.days2 = ((systime.local_time.day + 1) / 10) % 10; - m_clock_regs.days3 = (systime.local_time.day + 1) % 10; - m_clock_regs.hours1 = systime.local_time.hour / 10; - m_clock_regs.hours2 = systime.local_time.hour % 10; - m_clock_regs.minutes1 = systime.local_time.minute / 10; - m_clock_regs.minutes2 = systime.local_time.minute % 10; - m_clock_regs.seconds1 = systime.local_time.second / 10; - m_clock_regs.seconds2 = systime.local_time.second % 10; - m_clock_regs.tenths = 0; - - m_clock_regs.clock_mode = timer_disable; - m_clock_regs.clock_write_ptr = -1; - } -#if 0 - UINT32 temp32; - SINT8 temp8; - temp32 = (m_clock_regs.alarm << 12) | (m_clock_regs.years << 8) | (m_clock_regs.days1 << 4) - | m_clock_regs.days2; - - temp32 = (m_clock_regs.days3 << 28) | (m_clock_regs.hours1 << 24) | (m_clock_regs.hours2 << 20) - | (m_clock_regs.minutes1 << 16) | (m_clock_regs.minutes2 << 12) - | (m_clock_regs.seconds1 << 8) | (m_clock_regs.seconds2 << 4) | m_clock_regs.tenths; - - temp8 = clock_mode; /* clock mode */ - - temp8 = m_clock_regs.clock_write_ptr; /* clock byte to be written next (-1 if clock write disabled) */ -#endif - -} - - -#ifdef UNUSED_FUNCTION -void lisa_state::init_lisa1(void) -{ - m_model = lisa1; - m_features.has_fast_timers = 0; - m_features.floppy_hardware = twiggy; - m_features.has_double_sided_floppy = 1; - m_features.has_mac_xl_video = 0; -} -#endif - -DRIVER_INIT_MEMBER(lisa_state,lisa2) -{ - m_ram_ptr = memregion("maincpu")->base() + RAM_OFFSET; - m_rom_ptr = memregion("maincpu")->base() + ROM_OFFSET; - m_model = lisa2; - m_features.has_fast_timers = 0; - m_features.floppy_hardware = sony_lisa2; - m_features.has_double_sided_floppy = 0; - m_features.has_mac_xl_video = 0; - - m_bad_parity_table = auto_alloc_array(machine(), UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ -} - -DRIVER_INIT_MEMBER(lisa_state,lisa210) -{ - m_ram_ptr = memregion("maincpu")->base() + RAM_OFFSET; - m_rom_ptr = memregion("maincpu")->base() + ROM_OFFSET; - m_model = lisa210; - m_features.has_fast_timers = 1; - m_features.floppy_hardware = sony_lisa210; - m_features.has_double_sided_floppy = 0; - m_features.has_mac_xl_video = 0; - - m_bad_parity_table = auto_alloc_array(machine(), UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ -} - -DRIVER_INIT_MEMBER(lisa_state,mac_xl) -{ - m_ram_ptr = memregion("maincpu")->base() + RAM_OFFSET; - m_rom_ptr = memregion("maincpu")->base() + ROM_OFFSET; - m_model = mac_xl; - m_features.has_fast_timers = 1; - m_features.floppy_hardware = sony_lisa210; - m_features.has_double_sided_floppy = 0; - m_features.has_mac_xl_video = 1; - - m_bad_parity_table = auto_alloc_array(machine(), UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ -} - -void lisa_state::machine_start() -{ - m_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lisa_state::handle_mouse),this)); - - /* read command every ms (don't know the real value) */ - machine().scheduler().timer_pulse(attotime::from_msec(1), timer_expired_delegate(FUNC(lisa_state::set_COPS_ready),this)); - - m_nvram->set_base(m_fdc_ram, 1024); -} - -void lisa_state::machine_reset() -{ - m_ram_ptr = memregion("maincpu")->base() + RAM_OFFSET; - m_rom_ptr = memregion("maincpu")->base() + ROM_OFFSET; - m_videoROM_ptr = memregion("gfx1")->base(); - -// m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate_create_static(lisa_OPbaseoverride, *machine())); -// m68k_set_reset_callback(m_maincpu, /*lisa_reset_instr_callback*/NULL); - - /* init MMU */ - m_setup = 1; - m_seg = 0; - - /* init parity */ - m_diag2 = 0; - m_test_parity = 0; - m_parity_error_pending = 0; - - m_bad_parity_count = 0; - memset(m_bad_parity_table, 0, 0x40000); /* Clear */ - - /* init video */ - - m_VTMSK = 0; - set_VTIR(0); - - m_video_address_latch = 0; - m_videoram_ptr = (UINT16 *) m_ram_ptr; - - m_FDIR = 0; - m_via0->write_pb4(m_FDIR); - - /* tell there is no hard disk : */ - m_via1->write_pb0(1); - - /* keep busy high to work around a bug??? */ - //m_via1->write_pb1(1); - - m_DISK_DIAG = 0; - m_via1->write_pb6(m_DISK_DIAG); - - /* reset COPS keyboard/mouse controller */ - init_COPS(); - - { - COPS_via_out_ca2(0); /* VIA core forgets to do so */ - } - - /* initialize floppy */ - { - if (m_features.floppy_hardware == sony_lisa2) - { - sony_set_enable_lines(m_fdc, 1); /* on lisa2, drive unit 1 is always selected (?) */ - } - } - - /* reset 68k to pick up proper vectors from MMU */ - m_maincpu->reset(); -} - -INTERRUPT_GEN_MEMBER(lisa_state::lisa_interrupt) -{ - if ((++m_frame_count) == 6) - { /* increment clock every 1/10s */ - m_frame_count = 0; - - if (m_clock_regs.clock_mode != clock_timer_disable) - { - if ((++m_clock_regs.tenths) == 10) - { - m_clock_regs.tenths = 0; - - if (m_clock_regs.clock_mode != timer_disable) - { - if (m_clock_regs.alarm == 0) - { - /* generate reset (should cause a VIA interrupt...) */ - static const UINT8 cmd[2] = - { - 0x80, /* RESET code */ - 0xFC /* timer time-out */ - }; - COPS_queue_data(cmd, 2); - - m_clock_regs.alarm = 0xfffffL; - } - else - { - m_clock_regs.alarm--; - } - } - - if ((++m_clock_regs.seconds2) == 10) - { - m_clock_regs.seconds2 = 0; - - if ((++m_clock_regs.seconds1) == 6) - { - m_clock_regs.seconds1 = 0; - - if ((++m_clock_regs.minutes2) == 10) - { - m_clock_regs.minutes2 = 0; - - if ((++m_clock_regs.minutes1) == 6) - { - m_clock_regs.minutes1 = 0; - - if ((++m_clock_regs.hours2) == 10) - { - m_clock_regs.hours2 = 0; - - m_clock_regs.hours1++; - } - - if ((m_clock_regs.hours1*10 + m_clock_regs.hours2) == 24) - { - m_clock_regs.hours1 = m_clock_regs.hours2 = 0; - - if ((++m_clock_regs.days3) == 10) - { - m_clock_regs.days3 = 0; - - if ((++m_clock_regs.days2) == 10) - { - m_clock_regs.days2 = 0; - - m_clock_regs.days1++; - } - } - - if ((m_clock_regs.days1*100 + m_clock_regs.days2*10 + m_clock_regs.days3) == - ((m_clock_regs.years % 4) ? 366 : 367)) - { - m_clock_regs.days1 = m_clock_regs.days2 = m_clock_regs.days3 = 0; - - m_clock_regs.years = (m_clock_regs.years + 1) & 0xf; - } - } - } - } - } - } - } - } - } - - /* set VBI */ - if (m_VTMSK) - set_VTIR(1); - else - set_VTIR(0); - - /* do keyboard scan */ - scan_keyboard(); -} - -/* - Lots of fun with the Lisa fdc hardware - - The iwm floppy select line is connected to the drive SEL line in Lisa2 (which is why Lisa 2 - cannot support 2 floppy drives)... -*/ - -void lisa_state::lisa_fdc_ttl_glue_access(offs_t offset) -{ - switch ((offset & 0x000E) >> 1) - { - case 0: - /*stop = offset & 1;*/ /* stop/run motor pulse generation */ - break; - case 2: - /*MT0 = offset & 1;*/ /* ???? */ - break; - case 3: - /* enable/disable the motor on Lisa 1 */ - /* can disable the motor on Lisa 2/10, too (although it is not useful) */ - /* On lisa 2, commands the loading of the speed register on lisalite board */ - if (m_features.floppy_hardware == sony_lisa2) - { - int oldMT1 = m_MT1; - m_MT1 = offset & 1; - if (m_MT1 && ! oldMT1) - { - m_PWM_floppy_motor_speed = (m_PWM_floppy_motor_speed << 1) & 0xff; - if (m_fdc->get_lines() & APPLEFDC_PH0) - m_PWM_floppy_motor_speed |= 1; - sony_set_speed(((256-m_PWM_floppy_motor_speed) * 1.3) + 237); - } - } - /*else - m_MT1 = offset & 1;*/ - break; - case 4: - /*DIS = offset & 1;*/ /* forbids access from the 68000 to our RAM */ - break; - case 5: - /*HDS = offset & 1;*/ /* head select (-> disk side) on twiggy */ -#if 0 - if (m_features.floppy_hardware == twiggy) - twiggy_set_head_line(offset & 1); - else -#endif - if (m_features.floppy_hardware == sony_lisa210) - sony_set_sel_line(m_fdc, offset & 1); - break; - case 6: - m_DISK_DIAG = offset & 1; - m_via1->write_pb6(m_DISK_DIAG); - break; - case 7: - m_FDIR = offset & 1; /* Interrupt request to 68k */ - m_via0->write_pb4(m_FDIR); - field_interrupts(); - break; - } -} - -READ8_MEMBER(lisa_state::lisa_fdc_io_r) -{ - int answer=0; - - switch ((offset & 0x0030) >> 4) - { - case 0: /* IWM */ - answer = m_fdc->read(offset); - break; - - case 1: /* TTL glue */ - lisa_fdc_ttl_glue_access(offset); - answer = 0; /* ??? */ - break; - - case 2: /* pulses the PWM LOAD line (bug!) */ - answer = 0; /* ??? */ - break; - - case 3: /* not used */ - answer = 0; /* ??? */ - break; - } - - return answer; -} - -WRITE8_MEMBER(lisa_state::lisa_fdc_io_w) -{ - switch ((offset & 0x0030) >> 4) - { - case 0: /* IWM */ - m_fdc->write(offset, data); - break; - - case 1: /* TTL glue */ - lisa_fdc_ttl_glue_access(offset); - break; - - case 2: /* writes the PWM register */ - /* the written value is used to generate the motor speed control signal */ -#if 0 - if (m_features.floppy_hardware == twiggy) - twiggy_set_speed((256-data) * 1.3 /* ??? */ + 237 /* ??? */); - else -#endif - if (m_features.floppy_hardware == sony_lisa210) - sony_set_speed(((256-data) * 1.3) + 237); - break; - - case 3: /* not used */ - break; - } -} - -READ8_MEMBER(lisa_state::lisa_fdc_r) -{ - if (! (offset & 0x1000)) - { - if (! (offset & 0x0800)) - if (! (offset & 0x0400)) - return m_fdc_ram[offset & 0x03ff]; - else - return lisa_fdc_io_r(space, offset & 0x03ff); - else - return 0; /* ??? */ - } - else - return m_fdc_rom[offset & 0x0fff]; -} - -READ8_MEMBER(lisa_state::lisa210_fdc_r) -{ - if (! (offset & 0x1000)) - { - if (! (offset & 0x0400)) - if (! (offset & 0x0800)) - return m_fdc_ram[offset & 0x03ff]; - else - return lisa_fdc_io_r(space, offset & 0x03ff); - else - return 0; /* ??? */ - } - else - return m_fdc_rom[offset & 0x0fff]; -} - -WRITE8_MEMBER(lisa_state::lisa_fdc_w) -{ - if (! (offset & 0x1000)) - { - if (! (offset & 0x0800)) - { - if (! (offset & 0x0400)) - m_fdc_ram[offset & 0x03ff] = data; - else - lisa_fdc_io_w(space, offset & 0x03ff, data); - } - } -} - -WRITE8_MEMBER(lisa_state::lisa210_fdc_w) -{ - if (! (offset & 0x1000)) - { - if (! (offset & 0x0400)) - { - if (! (offset & 0x0800)) - m_fdc_ram[offset & 0x03ff] = data; - else - lisa_fdc_io_w(space, offset & 0x03ff, data); - } - } -} - -READ16_MEMBER(lisa_state::lisa_r) -{ - int answer=0; - - /* segment register set */ - int the_seg = m_seg; - - /* upper 7 bits -> segment # */ - int segment = (offset >> 16) & 0x7f; - - /*logerror("read, logical address%lX\n", offset);*/ - - if (m_setup) - { /* special setup mode */ - if (offset & 0x002000) - { - the_seg = 0; // TRUSTED by Lisa Hardware Manual section 2.3.3 and MMU startup test - } - else - { - if (offset & 0x004000) - { /* read MMU register */ - /*logerror("read from segment registers (%X:%X) ", the_seg, segment);*/ - if (offset & 0x000004) - { /* sorg register */ - answer = m_real_mmu_regs[the_seg][segment].sorg; - /*logerror("sorg, data = %X\n", answer);*/ - } - else - { /* slim register */ - answer = m_real_mmu_regs[the_seg][segment].slim; - /*logerror("slim, data = %X\n", answer);*/ - } - } - else - { /* system ROMs */ - answer = ((UINT16*)m_rom_ptr)[(offset & 0x001fff)]; - /*logerror("dst address in ROM (setup mode)\n");*/ - } - - return answer; - } - } - - if (m_maincpu->state_int(M68K_SR) & 0x2000) - /* supervisor mode -> force register file 0 */ - the_seg = 0; - - { - /* offset in segment */ - int seg_offset = (offset & 0x00ffff) << 1; - - /* add relevant origin -> address */ - offs_t address = (m_mmu_regs[the_seg][segment].sorg + seg_offset) & 0x1fffff; - - /*logerror("read, logical address%lX\n", offset); - logerror("physical address%lX\n", address);*/ - - switch (m_mmu_regs[the_seg][segment].type) - { - case RAM_stack_r: - case RAM_stack_rw: - if (address <= m_mmu_regs[the_seg][segment].slim) - { - /* out of segment limits : bus error */ - - } - answer = *(UINT16 *)(m_ram_ptr + address); - - if (m_bad_parity_count && m_test_parity - && (m_bad_parity_table[address >> 3] & (0x3 << (address & 0x7)))) - { - m_mem_err_addr_latch = address >> 5; - set_parity_error_pending(1); - } - - break; - - case RAM_r: - case RAM_rw: - if (address > m_mmu_regs[the_seg][segment].slim) - { - /* out of segment limits : bus error */ - - } - answer = *(UINT16 *)(m_ram_ptr + address); - - if (m_bad_parity_count && m_test_parity - && (m_bad_parity_table[address >> 3] & (0x3 << (address & 0x7)))) - { - m_mem_err_addr_latch = address >> 5; - set_parity_error_pending(1); - } - - break; - - case IO: - answer = lisa_IO_r(space, (address & 0x00ffff) >> 1, mem_mask); - - break; - - case invalid: /* unmapped segment */ - /* bus error */ - - answer = 0; - - break; - - case special_IO: - if (! (address & 0x008000)) - answer = *(UINT16 *)(m_rom_ptr + (address & 0x003fff)); - else - { /* read serial number from ROM */ - /* this has to be be the least efficient way to read a ROM :-) */ - /* this emulation is not guaranteed accurate */ - - /* problem : due to collisions with video, timings of the LISA CPU - are slightly different from timings of a bare 68k */ - /* so we use a kludge... */ - int time_in_frame = machine().first_screen()->vpos(); - - /* the BOOT ROM only reads 56 bits, so there must be some wrap-around for - videoROM_address <= 56 */ - /* pixel clock 20MHz, memory access rate 1.25MHz, horizontal clock 22.7kHz - according to Apple, which must stand for 1.25MHz/55 = 22727kHz, vertical - clock approximately 60Hz, which means there are about 380 lines, including VBlank */ - /* The values are different on the Mac XL, and I don't know the correct values - for sure. */ - - /* Something appears to be wrong with the timings, since we expect to read the - 2nd half when v-syncing, i.e. for lines beyond the 431th or 364th one (provided - there are no additionnal margins). - This is caused by the fact that 68k timings are wrong (memory accesses are - interlaced with the video hardware, which is not emulated). */ - if (m_features.has_mac_xl_video) - { - if ((time_in_frame >= 374) && (time_in_frame <= 392)) /* these values have not been tested */ - answer = m_videoROM_ptr[m_videoROM_address|0x80] << 8; - else - answer = m_videoROM_ptr[m_videoROM_address] << 8; - } - else - { - if ((time_in_frame >= 364) && (time_in_frame <= 375)) - { - answer = m_videoROM_ptr[m_videoROM_address|0x80] << 8; - logerror("reading1 %06X=%04x %s time=%d\n", address, answer, machine().describe_context(), time_in_frame); - } - else - { - answer = m_videoROM_ptr[m_videoROM_address] << 8; - logerror("reading2 %06X=%04x %s time=%d\n", address, answer, machine().describe_context(), time_in_frame); - } - } - - - m_videoROM_address = (m_videoROM_address + 1) & 0x7f; - if (m_videoROM_address == ((m_features.has_mac_xl_video) ? 48 : 56)) { - logerror("loop %d\n", m_videoROM_address); - m_videoROM_address = 0; - } - - } - - break; - } - } - - /*logerror("result %X\n", answer);*/ - - return answer; -} - -WRITE16_MEMBER(lisa_state::lisa_w) -{ - /* segment register set */ - int the_seg = m_seg; - - /* upper 7 bits -> segment # */ - int segment = (offset >> 16) & 0x7f; - - - if (m_setup) - { - if (offset & 0x002000) - { - the_seg = 0; // TRUSTED by Lisa Hardware Manual section 2.3.3 and MMU startup test - } - else - { - if (offset & 0x004000) - { /* write to MMU register */ - logerror("write to segment registers (%X:%X) ", the_seg, segment); - if (offset & 0x000004) - { /* sorg register */ - logerror("sorg, data = %X\n", data); - m_real_mmu_regs[the_seg][segment].sorg = data & 0xFFF; - m_mmu_regs[the_seg][segment].sorg = (data & 0x0fff) << 9; - } - else - { /* slim register */ - logerror("slim, data = %X\n", data); - m_real_mmu_regs[the_seg][segment].slim = data & 0xFFF; - m_mmu_regs[the_seg][segment].slim = (~ (data << 9)) & 0x01ffff; - switch ((data & 0x0f00) >> 8) - { - case 0x4: - /*logerror("type : RAM stack r\n");*/ - m_mmu_regs[the_seg][segment].type = RAM_stack_r; - break; - case 0x5: - /*logerror("type : RAM r\n");*/ - m_mmu_regs[the_seg][segment].type = RAM_r; - break; - case 0x6: - /*logerror("type : RAM stack rw\n");*/ - m_mmu_regs[the_seg][segment].type = RAM_stack_rw; - break; - case 0x7: - /*logerror("type : RAM rw\n");*/ - m_mmu_regs[the_seg][segment].type = RAM_rw; - break; - case 0x8: - case 0x9: /* not documented, but used by ROMs (?) */ - /*logerror("type : I/O\n");*/ - m_mmu_regs[the_seg][segment].type = IO; - break; - case 0xC: - /*logerror("type : invalid\n");*/ - m_mmu_regs[the_seg][segment].type = invalid; - break; - case 0xF: - logerror("type : special I/O\n"); - m_mmu_regs[the_seg][segment].type = special_IO; - break; - default: /* "unpredictable results" */ - logerror("type : unknown\n"); - m_mmu_regs[the_seg][segment].type = invalid; - break; - } - } - } - else - { /* system ROMs : read-only ??? */ - /* bus error ??? */ - } - return; - } - } - - if (m_maincpu->state_int(M68K_SR) & 0x2000) - /* supervisor mode -> force register file 0 */ - the_seg = 0; - - { - /* offset in segment */ - int seg_offset = (offset & 0x00ffff) << 1; - - /* add relevant origin -> address */ - offs_t address = (m_mmu_regs[the_seg][segment].sorg + seg_offset) & 0x1fffff; - - switch (m_mmu_regs[the_seg][segment].type) - { - case RAM_stack_rw: - if (address <= m_mmu_regs[the_seg][segment].slim) - { - /* out of segment limits : bus error */ - - } - COMBINE_DATA((UINT16 *) (m_ram_ptr + address)); - if (m_diag2) - { - if ((ACCESSING_BITS_0_7) - && ! (m_bad_parity_table[address >> 3] & (0x1 << (address & 0x7)))) - { - m_bad_parity_table[address >> 3] |= 0x1 << (address & 0x7); - m_bad_parity_count++; - } - if ((ACCESSING_BITS_8_15) - && ! (m_bad_parity_table[address >> 3] & (0x2 << (address & 0x7)))) - { - m_bad_parity_table[address >> 3] |= 0x2 << (address & 0x7); - m_bad_parity_count++; - } - } - else if (m_bad_parity_table[address >> 3] & (0x3 << (address & 0x7))) - { - if ((ACCESSING_BITS_0_7) - && (m_bad_parity_table[address >> 3] & (0x1 << (address & 0x7)))) - { - m_bad_parity_table[address >> 3] &= ~ (0x1 << (address & 0x7)); - m_bad_parity_count--; - } - if ((ACCESSING_BITS_8_15) - && (m_bad_parity_table[address >> 3] & (0x2 << (address & 0x7)))) - { - m_bad_parity_table[address >> 3] &= ~ (0x2 << (address & 0x7)); - m_bad_parity_count--; - } - } - break; - - case RAM_rw: - if (address > m_mmu_regs[the_seg][segment].slim) - { - /* out of segment limits : bus error */ - - } - COMBINE_DATA((UINT16 *) (m_ram_ptr + address)); - if (m_diag2) - { - if ((ACCESSING_BITS_0_7) - && ! (m_bad_parity_table[address >> 3] & (0x1 << (address & 0x7)))) - { - m_bad_parity_table[address >> 3] |= 0x1 << (address & 0x7); - m_bad_parity_count++; - } - if ((ACCESSING_BITS_8_15) - && ! (m_bad_parity_table[address >> 3] & (0x2 << (address & 0x7)))) - { - m_bad_parity_table[address >> 3] |= 0x2 << (address & 0x7); - m_bad_parity_count++; - } - } - else if (m_bad_parity_table[address >> 3] & (0x3 << (address & 0x7))) - { - if ((ACCESSING_BITS_0_7) - && (m_bad_parity_table[address >> 3] & (0x1 << (address & 0x7)))) - { - m_bad_parity_table[address >> 3] &= ~ (0x1 << (address & 0x7)); - m_bad_parity_count--; - } - if ((ACCESSING_BITS_8_15) - && (m_bad_parity_table[address >> 3] & (0x2 << (address & 0x7)))) - { - m_bad_parity_table[address >> 3] &= ~ (0x2 << (address & 0x7)); - m_bad_parity_count--; - } - } - break; - - case IO: - lisa_IO_w(space, (address & 0x00ffff) >> 1, data, mem_mask); - break; - - case RAM_stack_r: /* read-only */ - case RAM_r: /* read-only */ - case special_IO: /* system ROMs : read-only ??? */ - case invalid: /* unmapped segment */ - /* bus error */ - - break; - } - } -} - - -/**************************************************************************************\ -* I/O Slot Memory * -* * -* 000000 - 001FFF Slot 0 Low Decode * -* 002000 - 003FFF Slot 0 High Decode * -* 004000 - 005FFF Slot 1 Low Decode * -* 006000 - 007FFF Slot 1 High Decode * -* 008000 - 009FFF Slot 2 Low Decode * -* 00A000 - 00BFFF Slot 2 High Decode * -* 00C000 - 00CFFF Floppy Disk Controller shared RAM * -* 00c001-00c7ff floppy disk control * -* 00D000 - 00DFFF I/O Board Devices * -* 00d000-00d3ff serial ports control * -* 00d800-00dbff paralel port * -* 00dc00-00dfff keyboard/mouse cops via * -* 00E000 - 00FFFF CPU Board Devices * -* 00e000-00e01e cpu board control * -* 00e01f-00e7ff unused * -* 00e8xx-video address latch * -* 00f0xx memory error address latch * -* 00f8xx status register * -* * -\**************************************************************************************/ - -void lisa_state::cpu_board_control_access(offs_t offset) -{ - switch ((offset & 0x03ff) << 1) - { - case 0x0002: /* Set DIAG1 Latch */ - case 0x0000: /* Reset DIAG1 Latch */ - break; - case 0x0006: /* Set Diag2 Latch */ - m_diag2 = 1; - break; - case 0x0004: /* ReSet Diag2 Latch */ - m_diag2 = 0; - break; - case 0x000A: /* SEG1 Context Selection bit SET */ - /*logerror("seg bit 0 set\n");*/ - m_seg |= 1; - break; - case 0x0008: /* SEG1 Context Selection bit RESET */ - /*logerror("seg bit 0 clear\n");*/ - m_seg &= ~1; - break; - case 0x000E: /* SEG2 Context Selection bit SET */ - /*logerror("seg bit 1 set\n");*/ - m_seg |= 2; - break; - case 0x000C: /* SEG2 Context Selection bit RESET */ - /*logerror("seg bit 1 clear\n");*/ - m_seg &= ~2; - break; - case 0x0010: /* SETUP register SET */ - logerror("setup SET %s\n", machine().describe_context()); - m_setup = 1; - break; - case 0x0012: /* SETUP register RESET */ - logerror("setup UNSET %s\n", machine().describe_context()); - m_setup = 0; - break; - case 0x001A: /* Enable Vertical Retrace Interrupt */ - logerror("enable retrace %s\n", machine().describe_context()); - m_VTMSK = 1; - break; - case 0x0018: /* Disable Vertical Retrace Interrupt */ - logerror("disable retrace %s\n", machine().describe_context()); - m_VTMSK = 0; - set_VTIR(2); - break; - case 0x0016: /* Enable Soft Error Detect. */ - case 0x0014: /* Disable Soft Error Detect. */ - break; - case 0x001E: /* Enable Hard Error Detect */ - m_test_parity = 1; - break; - case 0x001C: /* Disable Hard Error Detect */ - m_test_parity = 0; - set_parity_error_pending(0); - break; - } -} - -READ16_MEMBER(lisa_state::lisa_IO_r) -{ - int answer=0; - - switch ((offset & 0x7000) >> 12) - { - case 0x0: - /* Slot 0 Low */ - break; - - case 0x1: - /* Slot 0 High */ - break; - - case 0x2: - /* Slot 1 Low */ - break; - - case 0x3: - /* Slot 1 High */ - break; - - case 0x4: - /* Slot 2 Low */ - break; - - case 0x5: - /* Slot 2 High */ - break; - - case 0x6: - if (! (offset & 0x800)) - { - if (! (offset & 0x400)) - { - /*if (ACCESSING_BITS_0_7)*/ /* Geez, who cares ? */ - answer = m_fdc_ram[offset & 0x03ff] & 0xff; /* right ??? */ - } - } - else - { - /* I/O Board Devices */ - switch ((offset & 0x0600) >> 9) - { - case 0: /* serial ports control */ - answer = m_scc->reg_r(space, offset&7); - break; - - case 2: /* parallel port */ - /* 1 VIA located at 0xD901 */ - if (ACCESSING_BITS_0_7) - answer = m_via1->read(space, (offset >> 2) & 0xf); - break; - - case 3: /* keyboard/mouse cops via */ - /* 1 VIA located at 0xDD81 */ - if (ACCESSING_BITS_0_7) - answer = m_via0->read(space, offset & 0xf); - break; - } - } - break; - - case 0x7: - /* CPU Board Devices */ - switch ((offset & 0x0C00) >> 10) - { - case 0x0: /* cpu board control */ - cpu_board_control_access(offset & 0x03ff); - break; - - case 0x1: /* Video Address Latch */ - answer = m_video_address_latch; - break; - - case 0x2: /* Memory Error Address Latch */ - answer = m_mem_err_addr_latch; - break; - - case 0x3: /* Status Register */ - answer = 0; - if (! m_parity_error_pending) - answer |= 0x02; - if (m_VTIR<=1) -// GFE : needs to be in phase with Serial NUM - { - int time_in_frame = machine().first_screen()->vpos(); - if (m_features.has_mac_xl_video) - { - if ((time_in_frame >= 374) && (time_in_frame <= 392)) /* these values have not been tested */ - { /* if VSyncing, read ROM 2nd half ? */ - } - else - { - m_VTIR=0; - answer |= 0x04; - } - } - else - { - logerror("read status time=%x\n", time_in_frame); - if ((time_in_frame >= 364) && (time_in_frame <= 383)) /* these values are approximative */ - { /* if VSyncing, read ROM 2nd half ? */ - } - else - { - m_VTIR=0; - answer |= 0x04; - } - } - - } - else - answer |= 0x04; - /* huh... we need to emulate some other bits */ - logerror("read status %s val=%x\n", machine().describe_context(), answer); - - break; - } - break; - } - - return answer; -} - -WRITE16_MEMBER(lisa_state::lisa_IO_w) -{ - switch ((offset & 0x7000) >> 12) - { - case 0x0: - /* Slot 0 Low */ - break; - - case 0x1: - /* Slot 0 High */ - break; - - case 0x2: - /* Slot 1 Low */ - break; - - case 0x3: - /* Slot 1 High */ - break; - - case 0x4: - /* Slot 2 Low */ - break; - - case 0x5: - /* Slot 2 High */ - break; - - case 0x6: - if (! (offset & 0x0800)) - { - /* Floppy Disk Controller shared RAM */ - if (! (offset & 0x0400)) - { - if (ACCESSING_BITS_0_7) - m_fdc_ram[offset & 0x03ff] = data & 0xff; - } - } - else - { - /* I/O Board Devices */ - switch ((offset & 0x0600) >> 9) - { - case 0: /* serial ports control */ - m_scc->reg_w(space, offset&7, data); - break; - - case 2: /* paralel port */ - if (ACCESSING_BITS_0_7) - m_via1->write(space, (offset >> 2) & 0xf, data & 0xff); - break; - - case 3: /* keyboard/mouse cops via */ - if (ACCESSING_BITS_0_7) - m_via0->write(space, offset & 0xf, data & 0xff); - break; - } - } - break; - - case 0x7: - /* CPU Board Devices */ - switch ((offset & 0x0C00) >> 10) - { - case 0x0: /* cpu board control */ - cpu_board_control_access(offset & 0x03ff); - break; - - case 0x1: /* Video Address Latch */ - /*logerror("video address latch write offs=%X, data=%X\n", offset, data);*/ - COMBINE_DATA(& m_video_address_latch); - m_videoram_ptr = ((UINT16 *)m_ram_ptr) + ((m_video_address_latch << 6) & 0xfc000); - /*logerror("video address latch %X -> base address %X\n", m_video_address_latch, - (m_video_address_latch << 7) & 0x1f8000);*/ - break; - } - break; - } -} diff --git a/src/mess/machine/llc.c b/src/mess/machine/llc.c deleted file mode 100644 index b208071b3c2..00000000000 --- a/src/mess/machine/llc.c +++ /dev/null @@ -1,180 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - LLC driver by Miodrag Milanovic - - 17/04/2009 Preliminary driver. - -****************************************************************************/ - - -#include "includes/llc.h" - - -// LLC1 BASIC keyboard -READ8_MEMBER(llc_state::llc1_port2_b_r) -{ - UINT8 retVal = 0; - - if (m_term_status) - { - retVal = m_term_status; - m_term_status = 0; - } - else - retVal = m_term_data; - - return retVal; -} - -READ8_MEMBER(llc_state::llc1_port2_a_r) -{ - return 0; -} - -// LLC1 Monitor keyboard -READ8_MEMBER(llc_state::llc1_port1_a_r) -{ - UINT8 data = 0; - if (!BIT(m_porta, 4)) - data = ioport("X4")->read(); - if (!BIT(m_porta, 5)) - data = ioport("X5")->read(); - if (!BIT(m_porta, 6)) - data = ioport("X6")->read(); - if (data & 0xf0) - data = (data >> 4) | 0x80; - - data |= (m_porta & 0x70); - - // do not repeat key - if (data & 15) - { - if (data == m_llc1_key) - data &= 0x70; - else - m_llc1_key = data; - } - else - if ((data & 0x70) == (m_llc1_key & 0x70)) - m_llc1_key = 0; - - return data; -} - -WRITE8_MEMBER(llc_state::llc1_port1_a_w) -{ - m_porta = data; -} - -WRITE8_MEMBER(llc_state::llc1_port1_b_w) -{ - static UINT8 count = 0, digit = 0; - - if (data == 0) - { - digit = 0; - count = 0; - } - else - count++; - - if (count == 1) - output_set_digit_value(digit, data & 0x7f); - else - if (count == 3) - { - count = 0; - digit++; - } -} - -DRIVER_INIT_MEMBER(llc_state,llc1) -{ -} - -MACHINE_RESET_MEMBER(llc_state,llc1) -{ - m_term_status = 0; - m_llc1_key = 0; -} - -MACHINE_START_MEMBER(llc_state,llc1) -{ -} - -/* Driver initialization */ -DRIVER_INIT_MEMBER(llc_state,llc2) -{ - m_p_videoram.set_target( m_ram->pointer() + 0xc000,m_p_videoram.bytes()); -} - -MACHINE_RESET_MEMBER(llc_state,llc2) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(memregion("maincpu")->base()); - - space.unmap_write(0x4000, 0x5fff); - membank("bank2")->set_base(memregion("maincpu")->base() + 0x4000); - - space.unmap_write(0x6000, 0xbfff); - membank("bank3")->set_base(memregion("maincpu")->base() + 0x6000); - - space.install_write_bank(0xc000, 0xffff, "bank4"); - membank("bank4")->set_base(m_ram->pointer() + 0xc000); - -} - -WRITE8_MEMBER(llc_state::llc2_rom_disable_w) -{ - address_space &mem_space = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - mem_space.install_write_bank(0x0000, 0xbfff, "bank1"); - membank("bank1")->set_base(ram); - - mem_space.install_write_bank(0x4000, 0x5fff, "bank2"); - membank("bank2")->set_base(ram + 0x4000); - - mem_space.install_write_bank(0x6000, 0xbfff, "bank3"); - membank("bank3")->set_base(ram + 0x6000); - - mem_space.install_write_bank(0xc000, 0xffff, "bank4"); - membank("bank4")->set_base(ram + 0xc000); - -} - -WRITE8_MEMBER(llc_state::llc2_basic_enable_w) -{ - address_space &mem_space = m_maincpu->space(AS_PROGRAM); - if (data & 0x02) - { - mem_space.unmap_write(0x4000, 0x5fff); - membank("bank2")->set_base(memregion("maincpu")->base() + 0x10000); - } - else - { - mem_space.install_write_bank(0x4000, 0x5fff, "bank2"); - membank("bank2")->set_base(m_ram->pointer() + 0x4000); - } - -} - -READ8_MEMBER(llc_state::llc2_port1_b_r) -{ - return 0; -} - -WRITE8_MEMBER(llc_state::llc2_port1_b_w) -{ - m_speaker->level_w(BIT(data, 6)); - m_rv = BIT(data, 5); -} - -READ8_MEMBER(llc_state::llc2_port2_a_r) -{ - return 0; // bit 2 low or hangs on ^Z^X^C sequence -} diff --git a/src/mess/machine/lviv.c b/src/mess/machine/lviv.c deleted file mode 100644 index e2fd86c293f..00000000000 --- a/src/mess/machine/lviv.c +++ /dev/null @@ -1,321 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/*************************************************************************** - - machine.c - - Functions to emulate general aspects of PK-01 Lviv (RAM, ROM, interrupts, - I/O ports) - - Krzysztof Strzecha - -***************************************************************************/ - -#include "emu.h" -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "includes/lviv.h" -#include "sound/speaker.h" -#include "machine/ram.h" - -#define LVIV_SNAPSHOT_SIZE 82219 - - - - - -void lviv_state::lviv_update_memory () -{ - UINT8 *ram = m_ram->pointer(); - - if (m_ppi_port_outputs[0][2] & 0x02) - { - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram + 0x4000); - } - else - { - membank("bank1")->set_base(ram + 0x8000); - membank("bank2")->set_base(ram + 0xc000); - } -} - -INPUT_CHANGED_MEMBER(lviv_state::lviv_reset) -{ - machine().schedule_soft_reset(); -} - -READ8_MEMBER(lviv_state::lviv_ppi_0_porta_r) -{ - return 0xff; -} - -READ8_MEMBER(lviv_state::lviv_ppi_0_portb_r) -{ - return 0xff; -} - -READ8_MEMBER(lviv_state::lviv_ppi_0_portc_r) -{ - UINT8 data = m_ppi_port_outputs[0][2] & 0x0f; - if (m_cassette->input() > 0.038) - data |= 0x10; - if (m_ppi_port_outputs[0][0] & ioport("JOY")->read()) - data |= 0x80; - return data; -} - -WRITE8_MEMBER(lviv_state::lviv_ppi_0_porta_w) -{ - m_ppi_port_outputs[0][0] = data; -} - -WRITE8_MEMBER(lviv_state::lviv_ppi_0_portb_w) -{ - m_ppi_port_outputs[0][1] = data; - lviv_update_palette(data&0x7f); -} - -WRITE8_MEMBER(lviv_state::lviv_ppi_0_portc_w)/* tape in/out, video memory on/off */ -{ - m_ppi_port_outputs[0][2] = data; - if (m_ppi_port_outputs[0][1]&0x80) - m_speaker->level_w(data & 0x01); - m_cassette->output((data & 0x01) ? -1.0 : 1.0); - lviv_update_memory(); -} - -READ8_MEMBER(lviv_state::lviv_ppi_1_porta_r) -{ - return 0xff; -} - -READ8_MEMBER(lviv_state::lviv_ppi_1_portb_r)/* keyboard reading */ -{ - return ((m_ppi_port_outputs[1][0] & 0x01) ? 0xff : ioport("KEY0")->read()) & - ((m_ppi_port_outputs[1][0] & 0x02) ? 0xff : ioport("KEY1")->read()) & - ((m_ppi_port_outputs[1][0] & 0x04) ? 0xff : ioport("KEY2")->read()) & - ((m_ppi_port_outputs[1][0] & 0x08) ? 0xff : ioport("KEY3")->read()) & - ((m_ppi_port_outputs[1][0] & 0x10) ? 0xff : ioport("KEY4")->read()) & - ((m_ppi_port_outputs[1][0] & 0x20) ? 0xff : ioport("KEY5")->read()) & - ((m_ppi_port_outputs[1][0] & 0x40) ? 0xff : ioport("KEY6")->read()) & - ((m_ppi_port_outputs[1][0] & 0x80) ? 0xff : ioport("KEY7")->read()); -} - -READ8_MEMBER(lviv_state::lviv_ppi_1_portc_r)/* keyboard reading */ -{ - return ((m_ppi_port_outputs[1][2] & 0x01) ? 0xff : ioport("KEY8")->read()) & - ((m_ppi_port_outputs[1][2] & 0x02) ? 0xff : ioport("KEY9" )->read()) & - ((m_ppi_port_outputs[1][2] & 0x04) ? 0xff : ioport("KEY10")->read()) & - ((m_ppi_port_outputs[1][2] & 0x08) ? 0xff : ioport("KEY11")->read()); -} - -WRITE8_MEMBER(lviv_state::lviv_ppi_1_porta_w)/* kayboard scaning */ -{ - m_ppi_port_outputs[1][0] = data; -} - -WRITE8_MEMBER(lviv_state::lviv_ppi_1_portb_w) -{ - m_ppi_port_outputs[1][1] = data; -} - -WRITE8_MEMBER(lviv_state::lviv_ppi_1_portc_w)/* kayboard scaning */ -{ - m_ppi_port_outputs[1][2] = data; -} - - -/* I/O */ -READ8_MEMBER(lviv_state::lviv_io_r) -{ - if (m_startup_mem_map) - { - return 0; /* ??? */ - } - else - { - switch ((offset >> 4) & 0x3) - { - case 0: - return machine().device("ppi8255_0")->read(space, offset & 3); - - case 1: - return machine().device("ppi8255_1")->read(space, offset & 3); - - case 2: - case 3: - default: - /* reserved for extension? */ - return 0; /* ??? */ - } - } -} - -WRITE8_MEMBER(lviv_state::lviv_io_w) -{ - address_space &cpuspace = m_maincpu->space(AS_PROGRAM); - if (m_startup_mem_map) - { - UINT8 *ram = m_ram->pointer(); - - m_startup_mem_map = 0; - - cpuspace.install_write_bank(0x0000, 0x3fff, "bank1"); - cpuspace.install_write_bank(0x4000, 0x7fff, "bank2"); - cpuspace.install_write_bank(0x8000, 0xbfff, "bank3"); - cpuspace.unmap_write(0xC000, 0xffff); - - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram + 0x4000); - membank("bank3")->set_base(ram + 0x8000); - membank("bank4")->set_base(memregion("maincpu")->base() + 0x010000); - } - else - { - switch ((offset >> 4) & 0x3) - { - case 0: - machine().device("ppi8255_0")->write(space, offset & 3, data); - break; - - case 1: - machine().device("ppi8255_1")->write(space, offset & 3, data); - break; - - case 2: - case 3: - /* reserved for extension? */ - break; - } - } -} - - -void lviv_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *mem; - - m_video_ram = m_ram->pointer() + 0xc000; - - m_startup_mem_map = 1; - - space.unmap_write(0x0000, 0x3fff); - space.unmap_write(0x4000, 0x7fff); - space.unmap_write(0x8000, 0xbfff); - space.unmap_write(0xC000, 0xffff); - - mem = memregion("maincpu")->base(); - membank("bank1")->set_base(mem + 0x010000); - membank("bank2")->set_base(mem + 0x010000); - membank("bank3")->set_base(mem + 0x010000); - membank("bank4")->set_base(mem + 0x010000); - - /*machine().scheduler().timer_pulse(TIME_IN_NSEC(200), FUNC(lviv_draw_pixel));*/ - - /*memset(m_ram->pointer(), 0, sizeof(unsigned char)*0xffff);*/ -} - - -/******************************************************************************* -Lviv snapshot files (SAV) -------------------------- - -00000 - 0000D: 'LVOV/DUMP/2.0/' (like LVT-header) -0000E - 0000F: 'H+' (something additional) -00010 00h -00011 - 0C010: RAM (0000 - BFFF) -0C011 - 10010: ROM (C000 - FFFF) -10011 - 14010: Video RAM (4000 - 7FFF) -14011 - 14110: Ports map (00 - FF) -14111 - 1411C: Registers (B,C,D,E,H,L,A,F,SP,PC) -1411D - 1412A: ??? (something additional) -*******************************************************************************/ - -void lviv_state::lviv_setup_snapshot (UINT8 * data) -{ - unsigned char lo,hi; - - /* Set registers */ - lo = data[0x14112] & 0x0ff; - hi = data[0x14111] & 0x0ff; - m_maincpu->set_state_int(I8085_BC, (hi << 8) | lo); - lo = data[0x14114] & 0x0ff; - hi = data[0x14113] & 0x0ff; - m_maincpu->set_state_int(I8085_DE, (hi << 8) | lo); - lo = data[0x14116] & 0x0ff; - hi = data[0x14115] & 0x0ff; - m_maincpu->set_state_int(I8085_HL, (hi << 8) | lo); - lo = data[0x14118] & 0x0ff; - hi = data[0x14117] & 0x0ff; - m_maincpu->set_state_int(I8085_AF, (hi << 8) | lo); - lo = data[0x14119] & 0x0ff; - hi = data[0x1411a] & 0x0ff; - m_maincpu->set_state_int(I8085_SP, (hi << 8) | lo); - lo = data[0x1411b] & 0x0ff; - hi = data[0x1411c] & 0x0ff; - m_maincpu->set_state_int(I8085_PC, (hi << 8) | lo); - - /* Memory dump */ - memcpy (m_ram->pointer(), data+0x0011, 0xc000); - memcpy (m_ram->pointer()+0xc000, data+0x10011, 0x4000); - - /* Ports */ - m_ppi_port_outputs[0][0] = data[0x14011+0xc0]; - m_ppi_port_outputs[0][1] = data[0x14011+0xc1]; - lviv_update_palette(m_ppi_port_outputs[0][1]&0x7f); - m_ppi_port_outputs[0][2] = data[0x14011+0xc2]; - lviv_update_memory(); -} - -void lviv_state::dump_registers() -{ - logerror("PC = %04x\n", (unsigned) m_maincpu->state_int(I8085_PC)); - logerror("SP = %04x\n", (unsigned) m_maincpu->state_int(I8085_SP)); - logerror("AF = %04x\n", (unsigned) m_maincpu->state_int(I8085_AF)); - logerror("BC = %04x\n", (unsigned) m_maincpu->state_int(I8085_BC)); - logerror("DE = %04x\n", (unsigned) m_maincpu->state_int(I8085_DE)); - logerror("HL = %04x\n", (unsigned) m_maincpu->state_int(I8085_HL)); -} - -int lviv_state::lviv_verify_snapshot (UINT8 * data, UINT32 size) -{ - const char* tag = "LVOV/DUMP/2.0/"; - - if( strncmp( tag, (char*)data, strlen(tag) ) ) - { - logerror("Not a Lviv snapshot\n"); - return IMAGE_VERIFY_FAIL; - } - - if (size != LVIV_SNAPSHOT_SIZE) - { - logerror ("Incomplete snapshot file\n"); - return IMAGE_VERIFY_FAIL; - } - - logerror("returning ID_OK\n"); - return IMAGE_VERIFY_PASS; -} - -SNAPSHOT_LOAD_MEMBER( lviv_state, lviv ) -{ - dynamic_buffer lviv_snapshot_data(LVIV_SNAPSHOT_SIZE); - - image.fread( &lviv_snapshot_data[0], LVIV_SNAPSHOT_SIZE); - - if(lviv_verify_snapshot(&lviv_snapshot_data[0], snapshot_size) == IMAGE_VERIFY_FAIL) - { - return IMAGE_INIT_FAIL; - } - - lviv_setup_snapshot (&lviv_snapshot_data[0]); - - dump_registers(); - - logerror("Snapshot file loaded\n"); - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/lynx.c b/src/mess/machine/lynx.c deleted file mode 100644 index b68b2b6c0d3..00000000000 --- a/src/mess/machine/lynx.c +++ /dev/null @@ -1,2144 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - PeT mess@utanet.at 2000,2001 -******************************************************************************/ - -#include "emu.h" -#include "includes/lynx.h" -#include "cpu/m6502/m65sc02.h" - - -#define PAD_UP 0x80 -#define PAD_DOWN 0x40 -#define PAD_LEFT 0x20 -#define PAD_RIGHT 0x10 - - -/**************************************** - - Graphics Drawing - -****************************************/ - -/* modes from blitter command */ -enum { - BACKGROUND = 0, - BACKGROUND_NO_COLL, - BOUNDARY_SHADOW, - BOUNDARY, - NORMAL_SPRITE, - NO_COLL, - XOR_SPRITE, - SHADOW -}; - -UINT8 lynx_state::lynx_read_ram(UINT16 address) -{ - UINT8 result = 0x00; - if (address <= 0xfbff) - result = m_mem_0000[address - 0x0000]; - else if (address <= 0xfcff) - result = m_mem_fc00[address - 0xfc00]; - else if (address <= 0xfdff) - result = m_mem_fd00[address - 0xfd00]; - else if (address <= 0xfff7) - result = m_mem_fe00[address - 0xfe00]; - else if (address >= 0xfffa) - result = m_mem_fffa[address - 0xfffa]; - return result; -} - -void lynx_state::lynx_write_ram(UINT16 address, UINT8 data) -{ - if (address <= 0xfbff) - m_mem_0000[address - 0x0000] = data; - else if (address <= 0xfcff) - m_mem_fc00[address - 0xfc00] = data; - else if (address <= 0xfdff) - m_mem_fd00[address - 0xfd00] = data; - else if (address <= 0xfff7) - m_mem_fe00[address - 0xfe00] = data; - else if (address >= 0xfffa) - m_mem_fffa[address - 0xfffa] = data; -} - -/* The pen numbers range from '0' to 'F. Pen numbers '1' through 'D' are always collidable and opaque. The other -ones have different behavior depending on the sprite type: there are 8 types of sprites, each has different -characteristics relating to some or all of their pen numbers. - -* Shadow Error: The hardware is missing an inverter in the 'shadow' generator. This causes sprite types that -did not invoke shadow to now invoke it and vice versa. The only actual functionality loss is that 'exclusive or' -sprites and 'background' sprites will have shadow enabled. - -The sprite types relate to specific hardware functions according to the following table: - - - -------------------------- SHADOW - | ----------------------- BOUNDARY_SHADOW - | | -------------------- NORMAL_SPRITE - | | | ----------------- BOUNDARY - | | | | -------------- BACKGROUND (+ shadow, due to bug in 'E' pen) - | | | | | ----------- BACKGROUND_NO_COLL - | | | | | | -------- NO_COLL - | | | | | | | ----- XOR_SPRITE (+ shadow, due to bug in 'E' pen) - | | | | | | | | - 1 0 1 0 1 1 1 1 F is opaque - 0 0 1 1 0 0 0 0 E is collideable - 0 0 1 1 0 0 0 0 0 is opaque and collideable - 1 1 1 1 0 0 0 1 allow collision detect - 1 1 1 1 1 0 0 1 allow coll. buffer access - 0 0 0 0 0 0 0 1 exclusive-or the data -*/ - -inline void lynx_state::lynx_plot_pixel(const int mode, const INT16 x, const int y, const int color) -{ - UINT8 back; - UINT16 screen; - UINT16 colbuf; - - m_blitter.everon = TRUE; - screen = m_blitter.screen + y * 80 + x / 2; - colbuf = m_blitter.colbuf + y * 80 + x / 2; - - /* a note on timing: The hardware packs the pixel data and updates the screen and collision buffer a byte at a time. - Thus the buffer update for two pixels takes 3 memory accesses for a normal sprite (write to screen buffer, read/write to collision buffer). - +1 memory access for palette fetch? - */ - - switch (mode&0x7) - { - case NORMAL_SPRITE: - /* A sprite may be set to 'normal'. This means that pen number '0' will be transparent and - non-collideable. All other pens will be opaque and collideable */ - if (color == 0) - break; - if (!(x & 0x01)) /* Upper nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0x0f) | (color << 4)); - m_blitter.memory_accesses++; - - if(m_blitter.sprite_collide && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); - m_blitter.memory_accesses += 2; - if ((back >> 4) > m_blitter.fred) - m_blitter.fred = back >> 4; - } - m_blitter.memory_accesses++; - } - else /* Lower nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0xf0) | color); - - if(m_blitter.sprite_collide && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); - if ((back & 0x0f) > m_blitter.fred) - m_blitter.fred = back >> 4; - } - } - break; - - case BOUNDARY: - /* A sprite may be set to 'boundary'. This is a 'normal' sprite with the exception that pen - number 'F' is transparent (and still collideable). */ - if (color == 0) - break; - if (!(x & 0x01)) /* Upper nibble */ - { - if (color != 0x0f) - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0x0f) | (color << 4)); - m_blitter.memory_accesses++; - } - if(m_blitter.sprite_collide && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); - if ((back >> 4) > m_blitter.fred) - m_blitter.fred = back >> 4; - m_blitter.memory_accesses += 2; - } - m_blitter.memory_accesses++; - } - else /* Lower nibble */ - { - if (color != 0x0f) - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0xf0) | color); - } - if(m_blitter.sprite_collide && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); - if ((back & 0x0f) > m_blitter.fred) - m_blitter.fred = back >> 4; - } - } - break; - - case SHADOW: - /* A sprite may be set to 'shadow'. This is a 'normal' sprite with the exception that pen - number 'E' is non-collideable (but still opaque) */ - if (color == 0) - break; - if (!(x & 0x01)) /* Upper nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0x0f) | (color << 4)); - m_blitter.memory_accesses++; - - if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); - if ((back >> 4) > m_blitter.fred) - m_blitter.fred = back >> 4; - m_blitter.memory_accesses += 2; - } - m_blitter.memory_accesses++; - } - else /* Lower nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0xf0) | color); - - if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); - if ((back & 0x0f) > m_blitter.fred) - m_blitter.fred = back >> 4; - } - } - break; - - case BOUNDARY_SHADOW: - /* This sprite is a 'normal' sprite with the characteristics of both 'boundary' - and 'shadow'. That is, pen number 'F' is transparent (and still collideable) and - pen number 'E' is non-collideable (but still opaque). */ - if (color == 0) - break; - if (!(x & 0x01)) /* Upper nibble */ - { - if (color != 0x0f) - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0x0f) | (color << 4)); - m_blitter.memory_accesses++; - } - if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); - if ((back >> 4) > m_blitter.fred) - m_blitter.fred = back >> 4; - m_blitter.memory_accesses += 2; - } - m_blitter.memory_accesses++; - } - else /* Lower nibble */ - { - if (color != 0x0f) - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0xf0) | color); - } - if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); - if ((back & 0x0f) > m_blitter.fred) - m_blitter.fred = back >> 4; - } - } - break; - - case BACKGROUND: - /* A sprite may be set to 'background'. This sprite will overwrite the contents of the video and - collision buffers. Pens '0' and 'F' are no longer transparent. This sprite is used to initialize - the buffers at the start of a 'painting'. Additionally, no collision detection is done, and no write - to the collision depository occurs. The 'E' error will cause the pen number 'E' to be non-collideable - and therefore not clear the collision buffer */ - if (!(x & 0x01)) /* Upper nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0x0f) | (color << 4)); - m_blitter.memory_accesses++; - - if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); - m_blitter.memory_accesses++; - } - m_blitter.memory_accesses++; - } - else /* Lower nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0xf0) | color); - - if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); - } - } - break; - - case BACKGROUND_NO_COLL: - /* This is a 'background' sprite with the exception that no activity occurs in the collision buffer */ - if (!(x & 0x01)) /* Upper nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0x0f) | (color << 4)); - m_blitter.memory_accesses++; - m_blitter.memory_accesses++; - } - else /* Lower nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0xf0) | color); - } - break; - - case NO_COLL: - /* A sprite may be set to 'non-collideable'. This means that it will have no affect on the contents of - the collision buffer and all other collision activities are overridden (pen 'F' is not collideable). */ - if (color == 0) - break; - if (!(x & 0x01)) /* Upper nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0x0f) | (color << 4)); - m_blitter.memory_accesses++; - m_blitter.memory_accesses++; - } - else /* Lower nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, (back & 0xf0) | color); - } - break; - - case XOR_SPRITE: - /* This is a 'normal' sprite with the exception that the data from the video buffer is exclusive-ored - with the sprite data and written back out to the video buffer. Collision activity is 'normal'. The 'E' - error will cause the pen number 'E' to be non-collideable and therefore not react with the collision - buffer */ - if (color == 0) - break; - if (!(x & 0x01)) /* Upper nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, back^(color << 4)); - m_blitter.memory_accesses += 2; - if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0xf0) | (m_blitter.spritenr << 4)); - if ((back >> 4) > m_blitter.fred) - m_blitter.fred = back >> 4; - m_blitter.memory_accesses += 2; - } - m_blitter.memory_accesses++; - } - else /* Lower nibble */ - { - back = lynx_read_ram(screen); - lynx_write_ram(screen, back^color); - if (m_blitter.sprite_collide && (color != 0x0e) && !(m_blitter.no_collide)) - { - back = lynx_read_ram(colbuf); - lynx_write_ram(colbuf, (back & ~0x0f) | (m_blitter.spritenr)); - if ((back & 0x0f) > m_blitter.fred) - m_blitter.fred = back >> 4; - } - } - break; - } -} - -void lynx_state::lynx_blit_do_work( const int y, const int xdir, const int bits_per_pixel, const int mask ) -{ - int next_line_addr,i,j; - int xi, bits, color; - UINT16 width_accum, buffer; - - next_line_addr = lynx_read_ram(m_blitter.bitmap); // offset to second sprite line - width_accum = (xdir == 1) ? m_blitter.width_offset : 0; - m_blitter.memory_accesses++; - - for (xi = m_blitter.x_pos - m_blitter.xoff, bits = 0, buffer = 0, j = 1; j < next_line_addr;j++) - { - buffer = (buffer << 8) | lynx_read_ram(m_blitter.bitmap + j); - bits += 8; // current bits in buffer - m_blitter.memory_accesses++; - - for ( ; bits > bits_per_pixel; bits -= bits_per_pixel) // last data packet at end of scanline is not rendered (qix, blulght) - { - color = m_blitter.color[(buffer >> (bits - bits_per_pixel)) & mask]; - width_accum += m_blitter.width; - for (i = 0; i < (width_accum>>8); i++, xi += xdir) - { - if ((xi >= 0) && (xi < 160)) - { - lynx_plot_pixel(m_blitter.mode, xi, y, color); - } - } - width_accum &= 0xff; - } - } -} - -void lynx_state::lynx_blit_rle_do_work( const INT16 y, const int xdir, const int bits_per_pixel, const int mask ) -{ - int i; - int xi; - int buffer, bits, j; - int literal_data, count, color; - UINT16 width_accum; - - width_accum = (xdir == 1) ? m_blitter.width_offset : 0; - for( bits = 0, j = 0, buffer = 0, xi = m_blitter.x_pos - m_blitter.xoff; ; ) /* through the rle entries */ - { - if (bits < 5 + bits_per_pixel) /* under 7 bits no complete entry */ - { - j++; - if (j >= lynx_read_ram(m_blitter.bitmap)) - return; - - bits += 8; - buffer = (buffer << 8) | lynx_read_ram(m_blitter.bitmap + j); - m_blitter.memory_accesses++; - } - - literal_data = (buffer >> (bits - 1)) & 0x01; - bits--; - count = (buffer >> (bits - 4)) & 0x0f; // repeat count (packed) or pixel count (literal) - bits -= 4; - - if (literal_data) /* count of different pixels */ - { - for ( ; count >= 0; count--) - { - if (bits < bits_per_pixel) - { - j++; - if (j >= lynx_read_ram(m_blitter.bitmap)) - return; - bits += 8; - buffer = (buffer << 8) | lynx_read_ram(m_blitter.bitmap + j); - m_blitter.memory_accesses++; - } - - color = m_blitter.color[(buffer >> (bits - bits_per_pixel)) & mask]; - bits -= bits_per_pixel; - width_accum += m_blitter.width; - for (i = 0; i < (width_accum>>8); i++, xi += xdir) - { - if ((xi >= 0) && (xi < 160)) - lynx_plot_pixel(m_blitter.mode, xi, y, color); - } - width_accum &= 0xff; - } - } - else /* count of same pixels */ - { - if (count == 0) // 4 bit count value of zero indicates end-of-line in a packed sprite - return; - - if (bits < bits_per_pixel) - { - j++; - if (j >= lynx_read_ram(m_blitter.bitmap)) - return; - bits += 8; - buffer = (buffer << 8) | lynx_read_ram(m_blitter.bitmap + j); - m_blitter.memory_accesses++; - } - - color = m_blitter.color[(buffer >> (bits - bits_per_pixel)) & mask]; - bits -= bits_per_pixel; - - for ( ; count>=0; count--) - { - width_accum += m_blitter.width; - for (i = 0; i < (width_accum >> 8); i++, xi += xdir) - { - if ((xi >= 0) && (xi < 160)) - lynx_plot_pixel(m_blitter.mode, xi, y, color); - } - width_accum &= 0xff; - } - } - } -} - -void lynx_state::lynx_blit_lines() -{ - static const int lynx_color_masks[4] = { 0x01, 0x03, 0x07, 0x0f }; - INT16 y; - int i; - int ydir = 0, xdir = 0; - int flip = 0; - - m_blitter.everon = FALSE; - - switch (m_blitter.spr_ctl1 & 0x03) /* Initial drawing direction */ - { - case 0: // Down/Right (quadrant 0) - xdir = 1; - ydir = 1; - flip = 0; - break; - case 1: // Down/Left (blockout) (quadrant 3) - xdir = -1; - ydir = 1; - flip = 3; - break; - case 2: // Up/Right (fat bobby) (quadrant 1) - xdir = 1; - ydir = -1; - flip = 1; - break; - case 3: // Up/Left (quadrant 2) - xdir = -1; - ydir = -1; - flip = 2; - break; - } - - if (m_blitter.spr_ctl0 & 0x20) /* Horizontal Flip */ - { - xdir *= -1; - } - - if (m_blitter.spr_ctl0 & 0x10) /* Vertical Flip */ - { - ydir *= -1; - } - - // Set height accumulator based on drawing direction - m_blitter.height_accumulator = (ydir == 1) ? m_blitter.height_offset : 0x00; - - // loop through lines, next line offset of zero indicates end of sprite - for (y = m_blitter.y_pos - m_blitter.yoff; (i = lynx_read_ram(m_blitter.bitmap)); m_blitter.bitmap += i) - { - m_blitter.memory_accesses++; - - if (i == 1) // draw next quadrant - { - // centered sprites sprdemo3, fat bobby, blockout - switch (flip & 0x03) - { - case 0: - case 2: - ydir *= -1; - m_blitter.y_pos += ydir; - break; - case 1: - case 3: - xdir *= -1; - m_blitter.x_pos += xdir; - break; - } - flip++; - y = m_blitter.y_pos - m_blitter.yoff; - m_blitter.height_accumulator = (ydir == 1) ? m_blitter.height_offset : 0x00; - continue; - } - - m_blitter.height_accumulator += m_blitter.height; - for (int j = 0; j < (m_blitter.height_accumulator >> 8); j++, y += ydir) - { - if (y >= 0 && y < 102) - { - if (m_blitter.use_rle) - lynx_blit_rle_do_work(y, xdir, m_blitter.line_color + 1, lynx_color_masks[m_blitter.line_color]); - else - lynx_blit_do_work(y, xdir, m_blitter.line_color + 1, lynx_color_masks[m_blitter.line_color]); - } - m_blitter.width += (INT16)m_blitter.stretch; - if (m_blitter.vstretch) // doesn't seem to be used - { - m_blitter.height += (INT16)m_blitter.stretch; - logerror("vertical stretch enabled"); - } - m_blitter.tilt_accumulator += m_blitter.tilt; - m_blitter.x_pos += (m_blitter.tilt_accumulator>>8); - m_blitter.tilt_accumulator &= 0xff; - } - m_blitter.height_accumulator &= 0xff; - } -} - -void lynx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BLITTER: - lynx_blitter_timer(ptr, param); - break; - case TIMER_SHOT: - lynx_timer_shot(ptr, param); - break; - case TIMER_UART_LOOPBACK: - lynx_uart_loopback_timer(ptr, param); - break; - case TIMER_UART: - lynx_uart_timer(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in lynx_state::device_timer"); - } -} - -TIMER_CALLBACK_MEMBER(lynx_state::lynx_blitter_timer) -{ - m_blitter.busy=0; // blitter finished - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); -} - -/* - control 0 - bit 7,6: 00 2 color - 01 4 color - 11 8 colors? - 11 16 color - bit 5,4: 00 right down - 01 right up - 10 left down - 11 left up - -#define SHADOW (0x07) -#define XORSHADOW (0x06) -#define NONCOLLIDABLE (0x05) -#define NORMAL (0x04) -#define BOUNDARY (0x03) -#define BOUNDARYSHADOW (0x02) -#define BKGRNDNOCOL (0x01) -#define BKGRND (0x00) - - control 1 - bit 7: 0 bitmap rle encoded - 1 not encoded - bit 3: 0 color info with command - 1 no color info with command - -#define RELHVST (0x30) -#define RELHVS (0x20) -#define RELHV (0x10) - -#define SKIPSPRITE (0x04) - -#define DUP (0x02) -#define DDOWN (0x00) -#define DLEFT (0x01) -#define DRIGHT (0x00) - - - coll -#define DONTCOLLIDE (0x20) - - word next - word data - word x - word y - word width - word height - - pixel c0 90 20 0000 datapointer x y 0100 0100 color (8 colorbytes) - 4 bit direct? - datapointer 2 10 0 - 98 (0 colorbytes) - - box c0 90 20 0000 datapointer x y width height color - datapointer 2 10 0 - - c1 98 00 4 bit direct without color bytes (raycast) - - 40 10 20 4 bit rle (sprdemo2) - - line c1 b0 20 0000 datapointer x y 0100 0100 stretch tilt:x/y color (8 color bytes) - or - line c0 b0 20 0000 datapointer x y 0100 0100 stretch tilt:x/y color - datapointer 2 11 0 - - text ?(04) 90 20 0000 datapointer x y width height color - datapointer 2 10 0 - - stretch: hsize adder - tilt: hpos adder - -*/ - -void lynx_state::lynx_blitter() -{ - static const int lynx_colors[4] = { 2, 4, 8, 16 }; - UINT8 palette_offset; - UINT8 coldep; - int colors; - - m_blitter.busy = 1; // blitter working - m_blitter.memory_accesses = 0; - - // Last SCB is indicated by zero in the high byte of SCBNEXT - while (m_blitter.scb_next & 0xff00) - { - m_blitter.stretch = 0; - m_blitter.tilt = 0; - m_blitter.tilt_accumulator = 0; - - m_blitter.scb = m_blitter.scb_next; // current scb - m_blitter.scb_next = lynx_read_ram(m_blitter.scb + SCB_SCBNEXT) | (lynx_read_ram(m_blitter.scb + SCB_SCBNEXT + 1) << 8); // next scb - m_blitter.spr_ctl0 = lynx_read_ram(m_blitter.scb + SCB_SPRCTL0); - m_blitter.spr_ctl1 = lynx_read_ram(m_blitter.scb + SCB_SPRCTL1); - m_blitter.spr_coll = lynx_read_ram(m_blitter.scb + SCB_SPRCOLL); - m_blitter.memory_accesses += 5; - - if(!(m_blitter.spr_ctl1 & 0x04)) // sprite will be processed (if sprite is skipped first 5 bytes are still copied to suzy) - { - m_blitter.bitmap = lynx_read_ram(m_blitter.scb + SCB_SPRDLINE) | (lynx_read_ram(m_blitter.scb + SCB_SPRDLINE + 1) << 8); - m_blitter.x_pos = lynx_read_ram(m_blitter.scb + SCB_HPOSSTRT) | (lynx_read_ram(m_blitter.scb + SCB_HPOSSTRT + 1) << 8); - m_blitter.y_pos = lynx_read_ram(m_blitter.scb + SCB_VPOSSTRT) | (lynx_read_ram(m_blitter.scb + SCB_VPOSSTRT + 1) << 8); - m_blitter.memory_accesses += 6; - - switch(m_blitter.spr_ctl1 & 0x30) // reload sprite scaling - { - case 0x30: // width, height, tilt, stretch - m_blitter.tilt = lynx_read_ram(m_blitter.scb + SCB_TILT) | (lynx_read_ram(m_blitter.scb + SCB_TILT + 1) << 8); - m_blitter.memory_accesses+=2; - case 0x20: // width, height, stretch - m_blitter.stretch = lynx_read_ram(m_blitter.scb + SCB_STRETCH) | (lynx_read_ram(m_blitter.scb + SCB_STRETCH + 1) << 8); - m_blitter.memory_accesses+=2; - case 0x10: // width, height - m_blitter.width = lynx_read_ram(m_blitter.scb + SCB_SPRHSIZ) | (lynx_read_ram(m_blitter.scb + SCB_SPRHSIZ + 1) << 8); - m_blitter.height = lynx_read_ram(m_blitter.scb + SCB_SPRVSIZ) | (lynx_read_ram(m_blitter.scb + SCB_SPRVSIZ + 1) << 8); - m_blitter.memory_accesses+=4; - } - - if(!(m_blitter.spr_ctl1 & 0x08)) // reload palette - { - if (m_blitter.spr_ctl1 & 0x30) - palette_offset = 0x0b + 2*(((m_blitter.spr_ctl1 & 0x30)>>4) + 1); // palette data offset depends on width, height, etc. reloading - else - palette_offset = 0x0b; - - colors = lynx_colors[m_blitter.spr_ctl0 >> 6]; - - for (int i = 0; i < colors / 2; i++) - { - m_blitter.color[i * 2] = lynx_read_ram(m_blitter.scb + palette_offset + i) >> 4; - m_blitter.color[i * 2 + 1 ] = lynx_read_ram(m_blitter.scb + palette_offset + i) & 0x0f; - m_blitter.memory_accesses++; - } - } - } - - - if (!(m_blitter.spr_ctl1 & 0x04)) // if 0, we skip this sprite - { - m_blitter.colpos = m_blitter.scb + (m_suzy.data[COLLOFFL] | (m_suzy.data[COLLOFFH]<<8)); - m_blitter.mode = m_blitter.spr_ctl0 & 0x07; - m_blitter.use_rle = m_blitter.spr_ctl1 & 0x80 ? 0 : 1; - m_blitter.line_color = (m_blitter.spr_ctl0 >> 6) & 0x03; - - m_blitter.sprite_collide = !(m_blitter.spr_coll & 0x20); - m_blitter.spritenr = m_blitter.spr_coll & 0x0f; - m_blitter.fred = 0; - - /* Draw Sprite */ - lynx_blit_lines(); - - if (m_blitter.sprite_collide && !(m_blitter.no_collide)) - { - switch (m_blitter.mode) - { - case BOUNDARY_SHADOW: - case BOUNDARY: - case NORMAL_SPRITE: - case XOR_SPRITE: - case SHADOW: - lynx_write_ram(m_blitter.colpos, m_blitter.fred); - break; - } - } - - if (m_suzy.data[SPRGO] & 0x04) // Everon enabled - { - coldep = lynx_read_ram(m_blitter.colpos); - if (!m_blitter.everon) - coldep |= 0x80; - else - coldep &= 0x7f; - lynx_write_ram(m_blitter.colpos, coldep); - } - } - } - - timer_set(m_maincpu->cycles_to_attotime(m_blitter.memory_accesses), TIMER_BLITTER); -} - - -/**************************************** - - Suzy Emulation - -****************************************/ - - -/* Math bugs of the original hardware: - -- in signed multiply, the hardware thinks that 8000 is a positive number -- in signed multiply, the hardware thinks that 0 is a negative number. This is not an immediate -problem for a multiply by zero, since the answer will be re-negated to the correct polarity of -zero. However, since it will set the sign flag, you can not depend on the sign flag to be correct -if you just load the lower byte after a multiply by zero. -- in divide, the remainder will have 2 possible errors, depending on its actual value (no further -notes on these errors available) */ - -void lynx_state::lynx_divide() -{ - UINT32 left; - UINT16 right; - UINT32 res, mod; - /* - Hardware divide: - EFGH - * NP - ---------------- - ABCD - Remainder (JK)LM - */ - - left = m_suzy.data[MATH_H] | (m_suzy.data[MATH_G] << 8) | (m_suzy.data[MATH_F] << 16) | (m_suzy.data[MATH_E] << 24); - right = m_suzy.data[MATH_P] | (m_suzy.data[MATH_N] << 8); - - m_suzy.accumulate_overflow = FALSE; - if (right == 0) - { - m_suzy.accumulate_overflow = TRUE; /* during divisions, this bit is used to detect denominator = 0 */ - res = 0xffffffff; - mod = 0; //? - } - else - { - res = left / right; - mod = left % right; - } -// logerror("coprocessor %8x / %8x = %4x\n", left, right, res); - m_suzy.data[MATH_D] = res & 0xff; - m_suzy.data[MATH_C] = res >> 8; - m_suzy.data[MATH_B] = res >> 16; - m_suzy.data[MATH_A] = res >> 24; - - m_suzy.data[MATH_M] = mod & 0xff; - m_suzy.data[MATH_L] = mod >> 8; - m_suzy.data[MATH_K] = 0; // documentation states the hardware sets these to zero on divides - m_suzy.data[MATH_J] = 0; -} - -void lynx_state::lynx_multiply() -{ - UINT16 left, right; - UINT32 res, accu; - /* - Hardware multiply: - AB - * CD - ---------------- - EFGH - Accumulate JKLM - */ - m_suzy.accumulate_overflow = FALSE; - - left = m_suzy.data[MATH_B] | (m_suzy.data[MATH_A] << 8); - right = m_suzy.data[MATH_D] | (m_suzy.data[MATH_C] << 8); - - res = left * right; - - if (m_suzy.signed_math) - { - if (!(m_sign_AB + m_sign_CD)) /* different signs */ - res = (res ^ 0xffffffff) + 1; - } - - m_suzy.data[MATH_H] = res & 0xff; - m_suzy.data[MATH_G] = res >> 8; - m_suzy.data[MATH_F] = res >> 16; - m_suzy.data[MATH_E] = res >> 24; - - if (m_suzy.accumulate) - { - accu = m_suzy.data[MATH_M] | m_suzy.data[MATH_L] << 8 | m_suzy.data[MATH_K] << 16 | m_suzy.data[MATH_J] << 24; - accu += res; - - if (accu < res) - m_suzy.accumulate_overflow = TRUE; - - m_suzy.data[MATH_M] = accu; - m_suzy.data[MATH_L] = accu >> 8; - m_suzy.data[MATH_K] = accu >> 16; - m_suzy.data[MATH_J] = accu >> 24; - } -} - -READ8_MEMBER(lynx_state::suzy_read) -{ - UINT8 value = 0, input; - - switch (offset) - { - case TILTACUML: - return m_blitter.tilt_accumulator & 0xff; - case TILTACUMH: - return m_blitter.tilt_accumulator>>8; - case HOFFL: - return m_blitter.xoff & 0xff; - case HOFFH: - return m_blitter.xoff>>8; - case VOFFL: - return m_blitter.yoff & 0xff; - case VOFFH: - return m_blitter.yoff>>8; - case VIDBASL: - return m_blitter.screen & 0xff; - case VIDBASH: - return m_blitter.screen>>8; - case COLLBASL: - return m_blitter.colbuf & 0xff; - case COLLBASH: - return m_blitter.colbuf>>8; - case SCBNEXTL: - return m_blitter.scb_next & 0xff; - case SCBNEXTH: - return m_blitter.scb_next>>8; - case SPRDLINEL: - return m_blitter.bitmap & 0xff; - case SPRDLINEH: - return m_blitter.bitmap>>8; - case HPOSSTRTL: - return m_blitter.x_pos & 0xff; - case HPOSSTRTH: - return m_blitter.x_pos>>8; - case VPOSSTRTL: - return m_blitter.y_pos & 0xff; - case VPOSSTRTH: - return m_blitter.y_pos>>8; - case SPRHSIZL: - return m_blitter.width & 0xff; - case SPRHSIZH: - return m_blitter.width>>8; - case SPRVSIZL: - return m_blitter.height & 0xff; - case SPRVSIZH: - return m_blitter.height>>8; - case STRETCHL: - return m_blitter.stretch & 0xff; - case STRETCHH: - return m_blitter.stretch>>8; - case TILTL: - return m_blitter.tilt & 0xff; - case TILTH: - return m_blitter.tilt>>8; - // case SPRDOFFL: - // case SPRVPOSL: - // case COLLOFFL: - case VSIZACUML: - return m_blitter.height_accumulator & 0xff; - case VSIZACUMH: - return m_blitter.height_accumulator>>8; - case HSIZOFFL: - return m_blitter.width_offset & 0xff; - case HSIZOFFH: - return m_blitter.width_offset>>8; - case VSIZOFFL: - return m_blitter.height_offset & 0xff; - case VSIZOFFH: - return m_blitter.height_offset>>8; - case SCBADRL: - return m_blitter.scb & 0xff; - case SCBADRH: - return m_blitter.scb>>8; - //case PROCADRL: - case SUZYHREV: - return 0x01; // must not be 0 for correct power up - case SPRSYS: - // math busy, last carry, unsafe access, and stop on current sprite bits not implemented. - if (m_suzy.accumulate_overflow) - value |= 0x40; - if (m_blitter.vstretch) - value |= 0x10; - if (m_blitter.lefthanded) - value |= 0x08; - if (m_blitter.busy) - value |= 0x01; - break; - case JOYSTICK: - input = ioport("JOY")->read(); - switch (m_rotate) - { - case 1: - value = input; - input &= 0x0f; - if (value & PAD_UP) input |= PAD_LEFT; - if (value & PAD_LEFT) input |= PAD_DOWN; - if (value & PAD_DOWN) input |= PAD_RIGHT; - if (value & PAD_RIGHT) input |= PAD_UP; - break; - case 2: - value = input; - input &= 0x0f; - if (value & PAD_UP) input |= PAD_RIGHT; - if (value & PAD_RIGHT) input |= PAD_DOWN; - if (value & PAD_DOWN) input |= PAD_LEFT; - if (value & PAD_LEFT) input |= PAD_UP; - break; - } - if (m_blitter.lefthanded) - { - value = input & 0x0f; - if (input & PAD_UP) value |= PAD_DOWN; - if (input & PAD_DOWN) value |= PAD_UP; - if (input & PAD_LEFT) value |= PAD_RIGHT; - if (input & PAD_RIGHT) value |= PAD_LEFT; - } - else - value = input; - break; - case SWITCHES: - value = ioport("PAUSE")->read(); - break; - case RCART: - if (m_cart->exists()) - value = m_cart->read_rom(space, (m_suzy.high * m_granularity) + m_suzy.low); - else - value = 0; - m_suzy.low = (m_suzy.low + 1) & (m_granularity - 1); - break; - //case RCART_BANK1: /* we need bank 1 emulation!!! */ - case SPRCTL0: - case SPRCTL1: - case SPRCOLL: - case SPRINIT: - case SUZYBUSEN: - case SPRGO: - logerror("read from write only register %x\n", offset); - value = 0; - break; - default: - value = m_suzy.data[offset]; - } - //logerror("suzy read %.2x %.2x\n",offset,value); - return value; -} - -WRITE8_MEMBER(lynx_state::suzy_write) -{ - m_suzy.data[offset] = data; - //logerror("suzy write %.2x %.2x\n",offset,data); - /* Additional effects of a write */ - /* Even addresses are the LSB. Any CPU write to an LSB in 0x00-0x7f will set the MSB to 0. */ - /* This in particular holds for math quantities: Writing to B (0x54), D (0x52), - F (0x62), H (0x60), K (0x6e) or M (0x6c) will force a '0' to be written to A (0x55), - C (0x53), E (0x63), G (0x61), J (0x6f) or L (0x6d) respectively */ - if ((offset < 0x80) && !(offset & 0x01)) - m_suzy.data[offset + 1] = 0; - - switch(offset) - { - //case TMPADRL: - //case TMPADRH: - case TILTACUML: - m_blitter.tilt_accumulator = data; // upper byte forced to zero see above. - break; - case TILTACUMH: - m_blitter.tilt_accumulator &= 0xff; - m_blitter.tilt_accumulator |= data<<8; - break; - case HOFFL: - m_blitter.xoff = data; - break; - case HOFFH: - m_blitter.xoff &= 0xff; - m_blitter.xoff |= data<<8; - break; - case VOFFL: - m_blitter.yoff = data; - break; - case VOFFH: - m_blitter.yoff &= 0xff; - m_blitter.yoff |= data<<8; - break; - case VIDBASL: - m_blitter.screen = data; - break; - case VIDBASH: - m_blitter.screen &= 0xff; - m_blitter.screen |= data<<8; - break; - case COLLBASL: - m_blitter.colbuf = data; - break; - case COLLBASH: - m_blitter.colbuf &= 0xff; - m_blitter.colbuf |= data<<8; - break; - case SCBNEXTL: - m_blitter.scb_next = data; - break; - case SCBNEXTH: - m_blitter.scb_next &= 0xff; - m_blitter.scb_next |= data<<8; - break; - case SPRDLINEL: - m_blitter.bitmap = data; - break; - case SPRDLINEH: - m_blitter.bitmap &= 0xff; - m_blitter.bitmap |= data<<8; - break; - case HPOSSTRTL: - m_blitter.x_pos = data; - case HPOSSTRTH: - m_blitter.x_pos &= 0xff; - m_blitter.x_pos |= data<<8; - case VPOSSTRTL: - m_blitter.y_pos = data; - case VPOSSTRTH: - m_blitter.y_pos &= 0xff; - m_blitter.y_pos |= data<<8; - case SPRHSIZL: - m_blitter.width = data; - break; - case SPRHSIZH: - m_blitter.width &= 0xff; - m_blitter.width |= data<<8; - break; - case SPRVSIZL: - m_blitter.height = data; - break; - case SPRVSIZH: - m_blitter.height &= 0xff; - m_blitter.height |= data<<8; - break; - case STRETCHL: - m_blitter.stretch = data; - break; - case STRETCHH: - m_blitter.stretch &= 0xff; - m_blitter.stretch |= data<<8; - break; - case TILTL: - m_blitter.tilt = data; - break; - case TILTH: - m_blitter.tilt &= 0xff; - m_blitter.tilt |= data<<8; - break; - // case SPRDOFFL: - // case SPRVPOSL: - // case COLLOFFL: - case VSIZACUML: - m_blitter.height_accumulator = data; - break; - case VSIZACUMH: - m_blitter.height_accumulator &= 0xff; - m_blitter.height_accumulator |= data<<8; - break; - case HSIZOFFL: - m_blitter.width_offset = data; - break; - case HSIZOFFH: - m_blitter.width_offset &= 0xff; - m_blitter.width_offset |= data<<8; - break; - case VSIZOFFL: - m_blitter.height_offset = data; - break; - case VSIZOFFH: - m_blitter.height_offset &= 0xff; - m_blitter.height_offset |= data<<8; - break; - case SCBADRL: - m_blitter.scb = data; - break; - case SCBADRH: - m_blitter.scb &= 0xff; - m_blitter.scb |= data<<8; - break; - //case PROCADRL: - - /* Writing to M (0x6c) will also clear the accumulator overflow bit */ - case MATH_M: - m_suzy.accumulate_overflow = FALSE; - break; - case MATH_C: - /* If we are going to perform a signed multiplication, we store the sign and convert the number - to an unsigned one */ - if (m_suzy.signed_math) - { - UINT16 factor, temp; - factor = m_suzy.data[MATH_D] | (m_suzy.data[MATH_C] << 8); - if ((factor - 1) & 0x8000) /* here we use -1 to cover the math bugs on the sign of 0 and 0x8000 */ - { - temp = (factor ^ 0xffff) + 1; - m_sign_CD = - 1; - m_suzy.data[MATH_D] = temp & 0xff; - m_suzy.data[MATH_C] = temp >> 8; - } - else - m_sign_CD = 1; - } - break; - case MATH_D: - /* Documentation states that writing to the MATH_D will set MATH_C to zero but not update the sign flag. - Implementing the sign detection as described in the documentation causes Stun Runners to not work. - Either the sign error in the docs is not as described or writing to the lower byte does update the sign flag. - Here I assume the sign flag gets updated. */ - if (data) - m_sign_CD = 1; - break; - /* Writing to A will start a 16 bit multiply */ - /* If we are going to perform a signed multiplication, we also store the sign and convert the - number to an unsigned one */ - case MATH_A: - if (m_suzy.signed_math) - { - UINT16 factor, temp; - factor = m_suzy.data[MATH_B] | (m_suzy.data[MATH_A] << 8); - if ((factor - 1) & 0x8000) /* here we use -1 to cover the math bugs on the sign of 0 and 0x8000 */ - { - temp = (factor ^ 0xffff) + 1; - m_sign_AB = - 1; - m_suzy.data[MATH_B] = temp & 0xff; - m_suzy.data[MATH_A] = temp >> 8; - } - else - m_sign_AB = 1; - } - lynx_multiply(); - break; - /* Writing to E will start a 16 bit divide */ - case MATH_E: - lynx_divide(); - break; - case SPRCTL0: - m_blitter.spr_ctl0 = data; - break; - case SPRCTL1: - m_blitter.spr_ctl1 = data; - break; - case SPRCOLL: - m_blitter.spr_coll = data; - break; - case SUZYBUSEN: - logerror("write to SUSYBUSEN %x \n", data); - break; - case SPRSYS: - m_suzy.signed_math = (data & 0x80) ? 1:0; - m_suzy.accumulate = (data & 0x40) ? 1:0; - m_blitter.no_collide = (data & 0x20) ? 1:0; - m_blitter.vstretch = (data & 0x10) ? 1:0; - m_blitter.lefthanded = (data & 0x08) ? 1:0; - // unsafe access clear and sprite engine stop request are not enabled - if (data & 0x02) logerror("sprite engine stop request\n"); - break; - case SPRGO: - if ((data & 0x01) && m_suzy.data[SUZYBUSEN]) - { - //m_blitter.time = machine().time(); - lynx_blitter(); - } - break; - case JOYSTICK: - case SWITCHES: - logerror("warning: write to read-only button registers\n"); - break; - } -} - - -/**************************************** - - Mikey emulation - -****************************************/ - -/* - 0xfd0a r sync signal? - 0xfd81 r interrupt source bit 2 vertical refresh - 0xfd80 w interrupt quit - 0xfd87 w bit 1 !clr bit 0 blocknumber clk - 0xfd8b w bit 1 blocknumber hi B - 0xfd94 w 0 - 0xfd95 w 4 - 0xfda0-f rw farben 0..15 - 0xfdb0-f rw bit0..3 farben 0..15 -*/ - - -/* -DISPCTL EQU $FD92 ; set to $D by INITMIKEY - -; B7..B4 0 -; B3 1 EQU color -; B2 1 EQU 4 bit mode -; B1 1 EQU flip screen -; B0 1 EQU video DMA enabled -*/ - -void lynx_state::lynx_draw_line() -{ - int x, y; - UINT16 j; // clipping needed! - UINT8 byte; - UINT16 *line; - - - // calculate y: first three lines are vblank, - y = 101-m_timer[2].counter; - // Documentation states lower two bits of buffer address are ignored (thus 0xfffc mask) - j = (m_mikey.disp_addr & 0xfffc) + y * 160 / 2; - - if (m_mikey.data[0x92] & 0x02) - { - j -= 160 * 102 / 2 - 1; - line = &m_bitmap_temp.pix16(102 - 1 - y); - for (x = 160 - 2; x >= 0; j++, x -= 2) - { - byte = lynx_read_ram(j); - line[x + 1] = m_lynx_palette[(byte >> 4) & 0x0f]; - line[x + 0] = m_lynx_palette[(byte >> 0) & 0x0f]; - } - } - else - { - line = &m_bitmap_temp.pix16(y); - for (x = 0; x < 160; j++, x += 2) - { - byte = lynx_read_ram(j); - line[x + 0] = m_lynx_palette[(byte >> 4) & 0x0f]; - line[x + 1] = m_lynx_palette[(byte >> 0) & 0x0f]; - } - } -} - -/**************************************** - - Timers - -****************************************/ - -/* -HCOUNTER EQU TIMER0 -VCOUNTER EQU TIMER2 -SERIALRATE EQU TIMER4 - -TIM_BAKUP EQU 0 ; backup-value (count+1) -TIM_CNTRL1 EQU 1 ; timer-control register -TIM_CNT EQU 2 ; current counter -TIM_CNTRL2 EQU 3 ; dynamic control - -; TIM_CNTRL1 -TIM_IRQ EQU %10000000 ; enable interrupt (not TIMER4 !) -TIM_RESETDONE EQU %01000000 ; reset timer done -TIM_MAGMODE EQU %00100000 ; nonsense in Lynx !! -TIM_RELOAD EQU %00010000 ; enable reload -TIM_COUNT EQU %00001000 ; enable counter -TIM_LINK EQU %00000111 -; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1 -TIM_64us EQU %00000110 -TIM_32us EQU %00000101 -TIM_16us EQU %00000100 -TIM_8us EQU %00000011 -TIM_4us EQU %00000010 -TIM_2us EQU %00000001 -TIM_1us EQU %00000000 - -;TIM_CNTRL2 (read-only) -; B7..B4 unused -TIM_DONE EQU %00001000 ; set if timer's done; reset with TIM_RESETDONE -TIM_LAST EQU %00000100 ; last clock (??) -TIM_BORROWIN EQU %00000010 -TIM_BORROWOUT EQU %00000001 -*/ - -#define NR_LYNX_TIMERS 8 - - - - -void lynx_state::lynx_timer_init(int which) -{ - memset(&m_timer[which], 0, sizeof(LYNX_TIMER)); - m_timer[which].timer = timer_alloc(TIMER_SHOT); - - save_item(NAME(m_timer[which].bakup), which); - save_item(NAME(m_timer[which].cntrl1), which); - save_item(NAME(m_timer[which].cntrl2), which); - save_item(NAME(m_timer[which].counter), which); - save_item(NAME(m_timer[which].timer_active), which); -} - -void lynx_state::lynx_timer_signal_irq(int which) -{ - if ((m_timer[which].cntrl1 & 0x80) && (which != 4)) // if interrupts are enabled and timer != 4 - { - m_mikey.data[0x81] |= (1 << which); // set interupt poll register - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_maincpu->set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); - } - switch (which) // count down linked timers - { - case 0: - switch (m_timer[2].counter) - { - case 104: - break; - case 103: - m_mikey.vb_rest = 1; - break; - case 102: - m_mikey.disp_addr = m_mikey.data[0x94] | (m_mikey.data[0x95] << 8); - break; - case 101: - m_mikey.vb_rest = 0; - lynx_draw_line(); - break; - default: - lynx_draw_line(); - } - lynx_timer_count_down(2); - break; - case 2: - copybitmap(m_bitmap, m_bitmap_temp, 0, 0, 0, 0, machine().first_screen()->cliprect()); - lynx_timer_count_down(4); - break; - case 1: - lynx_timer_count_down(3); - break; - case 3: - lynx_timer_count_down(5); - break; - case 5: - lynx_timer_count_down(7); - break; - case 7: - m_sound->count_down(0); - break; - } -} - -void lynx_state::lynx_timer_count_down(int which) -{ - if ((m_timer[which].cntrl1 & 0x0f) == 0x0f) // count and linking enabled - { - if (m_timer[which].counter > 0) - { - m_timer[which].counter--; - //m_timer[which].borrow_in = 1; - return; - } - if (m_timer[which].counter == 0) - { - if (m_timer[which].cntrl2 & 0x01) // borrow out - { - lynx_timer_signal_irq(which); - if (m_timer[which].cntrl1 & 0x10) // if reload enabled - { - m_timer[which].counter = m_timer[which].bakup; - } - else - { - m_timer[which].cntrl2 |= 8; // set timer done - } - m_timer[which].cntrl2 &= ~0x01; // clear borrow out - } - else - m_timer[which].cntrl2 |= 0x01; // set borrow out - return; - } - } - else - { - //m_timer[which].borrow_in = 0; - m_timer[which].cntrl2 &= ~0x01; - } -} - -UINT32 lynx_state::lynx_time_factor(int val) -{ - switch(val) - { - case 0: return 1000000; - case 1: return 500000; - case 2: return 250000; - case 3: return 125000; - case 4: return 62500; - case 5: return 31250; - case 6: return 15625; - default: fatalerror("invalid value\n"); - } -} - -TIMER_CALLBACK_MEMBER(lynx_state::lynx_timer_shot) -{ - lynx_timer_signal_irq(param); - if (!(m_timer[param].cntrl1 & 0x10)) // if reload not enabled - { - m_timer[param].timer_active = 0; - m_timer[param].cntrl2 |= 8; // set timer done - } - else - { - attotime t = (attotime::from_hz(lynx_time_factor(m_timer[param].cntrl1 & 0x07)) * (m_timer[param].bakup + 1)); - m_timer[param].timer->adjust(t, param); - } -} - -UINT8 lynx_state::lynx_timer_read(int which, int offset) -{ - UINT8 value = 0; - - switch (offset) - { - case 0: - value = m_timer[which].bakup; - break; - case 1: - value = m_timer[which].cntrl1; - break; - case 2: - if ((m_timer[which].cntrl1 & 0x07) == 0x07) // linked timer - { - value = m_timer[which].counter; - } - else - { - if ( m_timer[which].timer_active ) - { - value = (UINT8) (m_timer[which].timer->remaining().as_ticks(1000000>>(m_timer[which].cntrl1 & 0x07))); - value -= value ? 1 : 0; - } - } - break; - - case 3: - value = m_timer[which].cntrl2; - break; - } - // logerror("timer %d read %x %.2x\n", which, offset, value); - return value; -} - -void lynx_state::lynx_timer_write(int which, int offset, UINT8 data) -{ - //logerror("timer %d write %x %.2x\n", which, offset, data); - attotime t; - - if ( m_timer[which].timer_active && ((m_timer[which].cntrl1 & 0x07) != 0x07)) - { - m_timer[which].counter = (UINT8) (m_timer[which].timer->remaining().as_ticks(1000000>>(m_timer[which].cntrl1 & 0x07))); - m_timer[which].counter -= (m_timer[which].counter) ? 1 : 0; - } - - switch (offset) - { - case 0: - m_timer[which].bakup = data; - break; - case 1: - m_timer[which].cntrl1 = data; - if (data & 0x40) // reset timer done - m_timer[which].cntrl2 &= ~0x08; - break; - case 2: - m_timer[which].counter = data; - break; - case 3: - m_timer[which].cntrl2 = (m_timer[which].cntrl2 & ~0x08) | (data & 0x08); - break; - } - - /* Update timers */ - //if ( offset < 3 ) - //{ - m_timer[which].timer->reset(); - m_timer[which].timer_active = 0; - if ((m_timer[which].cntrl1 & 0x08) && !(m_timer[which].cntrl2 & 0x08)) // if enable count - { - if ((m_timer[which].cntrl1 & 0x07) != 0x07) // if not set to link mode - { - t = (attotime::from_hz(lynx_time_factor(m_timer[which].cntrl1 & 0x07)) * (m_timer[which].counter + 1)); - m_timer[which].timer->adjust(t, which); - m_timer[which].timer_active = 1; - } - } - //} -} - - -/**************************************** - - UART Emulation - -****************************************/ - - -void lynx_state::lynx_uart_reset() -{ - memset(&m_uart, 0, sizeof(m_uart)); -} - -TIMER_CALLBACK_MEMBER(lynx_state::lynx_uart_loopback_timer) -{ - m_uart.received = FALSE; -} - -TIMER_CALLBACK_MEMBER(lynx_state::lynx_uart_timer) -{ - if (m_uart.buffer_loaded) - { - m_uart.data_to_send = m_uart.buffer; - m_uart.buffer_loaded = FALSE; - timer_set(attotime::from_usec(11*16), TIMER_UART); - } - else - { - m_uart.sending = FALSE; - m_uart.received = TRUE; - m_uart.data_received = m_uart.data_to_send; - timer_set(attotime::from_usec(11*16), TIMER_UART_LOOPBACK); - if (m_uart.serctl & 0x40) - { - m_mikey.data[0x81] |= 0x10; - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_maincpu->set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); - } - } - - if (m_uart.serctl & 0x80) - { - m_mikey.data[0x81] |= 0x10; - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_maincpu->set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); - } -} - -READ8_MEMBER(lynx_state::lynx_uart_r) -{ - UINT8 value = 0x00; - switch (offset) - { - case 0x8c: - if (!m_uart.buffer_loaded) - value |= 0x80; - if (m_uart.received) - value |= 0x40; - if (!m_uart.sending) - value |= 0x20; - break; - - case 0x8d: - value = m_uart.data_received; - break; - } - logerror("uart read %.2x %.2x\n", offset, value); - return value; -} - -WRITE8_MEMBER(lynx_state::lynx_uart_w) -{ - logerror("uart write %.2x %.2x\n", offset, data); - switch (offset) - { - case 0x8c: - m_uart.serctl = data; - break; - - case 0x8d: - if (m_uart.sending) - { - m_uart.buffer = data; - m_uart.buffer_loaded = TRUE; - } - else - { - m_uart.sending = TRUE; - m_uart.data_to_send = data; - // timing not accurate, baude rate should be calculated from timer 4 backup value and clock rate - timer_set(attotime::from_usec(11*16), TIMER_UART); - } - break; - } -} - - -/**************************************** - - Mikey memory handlers - -****************************************/ - - -READ8_MEMBER(lynx_state::mikey_read) -{ - UINT8 direction, value = 0x00; - - switch (offset) - { - case 0x00: case 0x01: case 0x02: case 0x03: - case 0x04: case 0x05: case 0x06: case 0x07: - case 0x08: case 0x09: case 0x0a: case 0x0b: - case 0x0c: case 0x0d: case 0x0e: case 0x0f: - case 0x10: case 0x11: case 0x12: case 0x13: - case 0x14: case 0x15: case 0x16: case 0x17: - case 0x18: case 0x19: case 0x1a: case 0x1b: - case 0x1c: case 0x1d: case 0x1e: case 0x1f: - value = lynx_timer_read(offset >> 2, offset & 0x03); - break; - - case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: - case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: - case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: - case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x50: - value = m_sound->read(space, offset); - break; - - case 0x80: - case 0x81: - value = m_mikey.data[0x81]; // both registers access the same interupt status byte - // logerror( "mikey read %.2x %.2x\n", offset, value ); - break; - - case 0x84: - case 0x85: - value = 0x00; - break; - - case 0x86: - value = 0x80; - break; - - case 0x88: - value = 0x01; - break; - - case 0x8b: - direction = m_mikey.data[0x8a]; - value |= (direction & 0x01) ? (m_mikey.data[offset] & 0x01) : 0x01; // External Power input - value |= (direction & 0x02) ? (m_mikey.data[offset] & 0x02) : 0x00; // Cart Address Data output (0 turns cart power on) - value |= (direction & 0x04) ? (m_mikey.data[offset] & 0x04) : 0x04; // noexp input - // REST read returns actual rest state anded with rest output bit - value |= (direction & 0x08) ? (((m_mikey.data[offset] & 0x08) && (m_mikey.vb_rest)) ? 0x00 : 0x08) : 0x00; // rest output - value |= (direction & 0x10) ? (m_mikey.data[offset] & 0x10) : 0x10; // audin input - /* Hack: we disable COMLynx */ - value |= 0x04; - /* B5, B6 & B7 are not used */ - break; - - case 0x8c: - case 0x8d: - value = lynx_uart_r(space, offset, mem_mask); - break; - - default: - value = m_mikey.data[offset]; - //logerror( "mikey read %.2x %.2x\n", offset, value ); - } - return value; -} - -WRITE8_MEMBER(lynx_state::mikey_write) -{ - switch (offset) - { - case 0x00: case 0x01: case 0x02: case 0x03: - case 0x04: case 0x05: case 0x06: case 0x07: - case 0x08: case 0x09: case 0x0a: case 0x0b: - case 0x0c: case 0x0d: case 0x0e: case 0x0f: - case 0x10: case 0x11: case 0x12: case 0x13: - case 0x14: case 0x15: case 0x16: case 0x17: - case 0x18: case 0x19: case 0x1a: case 0x1b: - case 0x1c: case 0x1d: case 0x1e: case 0x1f: - lynx_timer_write(offset >> 2, offset & 3, data); - return; - - case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: - case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f: - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: - case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f: - case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x50: - m_sound->write(space, offset, data); - return; - - case 0x80: - m_mikey.data[0x81] &= ~data; // clear interrupt source - // logerror("mikey write %.2x %.2x\n", offset, data); - if (!m_mikey.data[0x81]) - m_maincpu->set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE); - break; - - /* Is this correct? */ // Notes say writing to register will result in interupt being triggered. - case 0x81: - m_mikey.data[0x81] |= data; - if (data) - { - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_maincpu->set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); - logerror("direct write to interupt register\n"); - } - break; - - case 0x87: - m_mikey.data[offset] = data; - if (data & 0x02) // Power (1 = on) - { - if (data & 0x01) // Cart Address Strobe - { - m_suzy.high <<= 1; - if (m_mikey.data[0x8b] & 0x02) - m_suzy.high |= 1; - m_suzy.high &= 0xff; - m_suzy.low = 0; - } - } - else - { - m_suzy.high = 0; - m_suzy.low = 0; - } - break; - - case 0x8c: case 0x8d: - lynx_uart_w(space, offset, data); - break; - - case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7: - case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf: - case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7: - case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf: - m_mikey.data[offset] = data; - - /* RED = 0xb- & 0x0f, GREEN = 0xa- & 0x0f, BLUE = (0xb- & 0xf0) >> 4 */ - m_lynx_palette[offset & 0x0f] = m_palette->pen( - ((m_mikey.data[0xb0 + (offset & 0x0f)] & 0x0f)) | - ((m_mikey.data[0xa0 + (offset & 0x0f)] & 0x0f) << 4) | - ((m_mikey.data[0xb0 + (offset & 0x0f)] & 0xf0) << 4)); - break; - - /* TODO: properly implement these writes */ - case 0x8b: - m_mikey.data[offset] = data; - if (m_mikey.data[0x8a] & 0x10) - logerror("Trying to enable bank 1 write. %d\n", m_mikey.data[offset] & 0x10); - break; - - //case 0x90: // SDONEACK - Suzy Done Acknowledge - case 0x91: // CPUSLEEP - CPU Bus Request Disable - m_mikey.data[offset] = data; - if (!data && m_blitter.busy) - { - m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - /* A write of '0' to this address will reset the CPU bus request flip flop */ - } - break; - case 0x94: case 0x95: - m_mikey.data[offset]=data; - break; - case 0x9c: case 0x9d: case 0x9e: - m_mikey.data[offset]=data; - logerror("Mtest%d write: %x\n", offset&0x3, data); - break; - - default: - m_mikey.data[offset]=data; - //logerror("mikey write %.2x %.2x\n",offset,data); - break; - } -} - -/**************************************** - - Init / Config - -****************************************/ - -READ8_MEMBER(lynx_state::lynx_memory_config_r) -{ - return m_memory_config; -} - -WRITE8_MEMBER(lynx_state::lynx_memory_config_w) -{ - /* bit 7: hispeed, uses page mode accesses (4 instead of 5 cycles ) - * when these are safe in the cpu */ - m_memory_config = data; - - if (data & 1) - { - space.install_readwrite_bank(0xfc00, 0xfcff, "bank1"); - membank("bank1")->set_base(m_mem_fc00); - } - else - space.install_readwrite_handler(0xfc00, 0xfcff, read8_delegate(FUNC(lynx_state::suzy_read),this), write8_delegate(FUNC(lynx_state::suzy_write),this)); - - if (data & 2) - { - space.install_readwrite_bank(0xfd00, 0xfdff, "bank2"); - membank("bank2")->set_base(m_mem_fd00); - } - else - space.install_readwrite_handler(0xfd00, 0xfdff, read8_delegate(FUNC(lynx_state::mikey_read),this), write8_delegate(FUNC(lynx_state::mikey_write),this)); - - membank("bank3")->set_entry((data & 4) ? 1 : 0); - membank("bank4")->set_entry((data & 8) ? 1 : 0); -} - -void lynx_state::machine_reset() -{ - lynx_memory_config_w(m_maincpu->space(AS_PROGRAM), 0, 0); - - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_maincpu->set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE); - - memset(&m_suzy, 0, sizeof(m_suzy)); - memset(&m_mikey, 0, sizeof(m_mikey)); - - m_suzy.data[0x88] = 0x01; - m_suzy.data[0x90] = 0x00; - m_suzy.data[0x91] = 0x00; - m_mikey.data[0x80] = 0x00; - m_mikey.data[0x81] = 0x00; - m_mikey.data[0x88] = 0x01; - m_mikey.data[0x8a] = 0x00; - m_mikey.data[0x8c] = 0x00; - m_mikey.data[0x90] = 0x00; - m_mikey.data[0x92] = 0x00; - - lynx_uart_reset(); - - // hack to allow current object loading to work -#if 0 - lynx_timer_write( this, 0, 0, 160 ); // set backup value (hpos) = 160 - lynx_timer_write( this, 0, 1, 0x10 | 0x8 | 0 ); // enable count, enable reload, 1us period - lynx_timer_write( this, 2, 0, 105 ); // set backup value (vpos) = 102 - lynx_timer_write( this, 2, 1, 0x10 | 0x8 | 7 ); // enable count, enable reload, link -#endif - - render_target *target = machine().render().first_target(); - target->set_view(m_rotate); -} - -void lynx_state::lynx_postload() -{ - lynx_memory_config_w(m_maincpu->space(AS_PROGRAM), 0, m_memory_config); -} - -void lynx_state::machine_start() -{ - m_bitmap_temp.allocate(160,102,0,0); - - // save driver variables - save_item(NAME(m_memory_config)); - save_item(NAME(m_sign_AB)); - save_item(NAME(m_sign_CD)); - save_item(NAME(m_lynx_palette)); - save_item(NAME(m_rotate)); - // save blitter variables - save_item(NAME(m_blitter.screen)); - save_item(NAME(m_blitter.colbuf)); - save_item(NAME(m_blitter.colpos)); - save_item(NAME(m_blitter.xoff)); - save_item(NAME(m_blitter.yoff)); - save_item(NAME(m_blitter.mode)); - save_item(NAME(m_blitter.spr_coll)); - save_item(NAME(m_blitter.spritenr)); - save_item(NAME(m_blitter.x_pos)); - save_item(NAME(m_blitter.y_pos)); - save_item(NAME(m_blitter.width)); - save_item(NAME(m_blitter.height)); - save_item(NAME(m_blitter.tilt_accumulator)); - save_item(NAME(m_blitter.width_accumulator)); - save_item(NAME(m_blitter.height_accumulator)); - save_item(NAME(m_blitter.width_offset)); - save_item(NAME(m_blitter.height_offset)); - save_item(NAME(m_blitter.stretch)); - save_item(NAME(m_blitter.tilt)); - save_item(NAME(m_blitter.color)); - save_item(NAME(m_blitter.bitmap)); - save_item(NAME(m_blitter.use_rle)); - save_item(NAME(m_blitter.line_color)); - save_item(NAME(m_blitter.spr_ctl0)); - save_item(NAME(m_blitter.spr_ctl1)); - save_item(NAME(m_blitter.scb)); - save_item(NAME(m_blitter.scb_next)); - save_item(NAME(m_blitter.sprite_collide)); - save_item(NAME(m_blitter.everon)); - save_item(NAME(m_blitter.fred)); - save_item(NAME(m_blitter.memory_accesses)); - save_item(NAME(m_blitter.no_collide)); - save_item(NAME(m_blitter.vstretch)); - save_item(NAME(m_blitter.lefthanded)); - save_item(NAME(m_blitter.busy)); - // save suzy variables - save_item(NAME(m_suzy.data)); - save_item(NAME(m_suzy.high)); - save_item(NAME(m_suzy.low)); - save_item(NAME(m_suzy.signed_math)); - save_item(NAME(m_suzy.accumulate)); - save_item(NAME(m_suzy.accumulate_overflow)); - // save mikey variables - save_item(NAME(m_mikey.data)); - save_item(NAME(m_mikey.disp_addr)); - save_item(NAME(m_mikey.vb_rest)); - // save uart variables - save_item(NAME(m_uart.serctl)); - save_item(NAME(m_uart.data_received)); - save_item(NAME(m_uart.data_to_send)); - save_item(NAME(m_uart.buffer)); - save_item(NAME(m_uart.received)); - save_item(NAME(m_uart.sending)); - save_item(NAME(m_uart.buffer_loaded)); - - machine().save().register_postload(save_prepost_delegate(FUNC(lynx_state::lynx_postload), this)); - - membank("bank3")->configure_entry(0, memregion("maincpu")->base() + 0x0000); - membank("bank3")->configure_entry(1, m_mem_fe00); - membank("bank4")->configure_entry(0, memregion("maincpu")->base() + 0x01fa); - membank("bank4")->configure_entry(1, m_mem_fffa); - - for (int i = 0; i < NR_LYNX_TIMERS; i++) - lynx_timer_init(i); -} - - -/**************************************** - - Image handling - -****************************************/ - -int lynx_state::lynx_verify_cart (char *header, int kind) -{ - if (kind) - { - if (strncmp("BS93", &header[6], 4)) - { - logerror("This is not a valid Lynx image\n"); - return IMAGE_VERIFY_FAIL; - } - } - else - { - if (strncmp("LYNX", &header[0], 4)) - { - if (!strncmp("BS93", &header[6], 4)) - { - logerror("This image is probably a Quickload image with .lnx extension\n"); - logerror("Try to load it with -quickload\n"); - } - else - logerror("This is not a valid Lynx image\n"); - return IMAGE_VERIFY_FAIL; - } - } - - return IMAGE_VERIFY_PASS; -} - -DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart ) -{ - /* Lynx carts have 19 address lines, the upper 8 used for bank select. The lower - 11 bits are used to address data within the selected bank. Valid bank sizes are 256, - 512, 1024 or 2048 bytes. Commercial roms use all 256 banks.*/ - UINT32 size = m_cart->common_get_size("rom"); - UINT16 gran = 0; - - if (image.software_entry() == NULL) - { - // check for lnx header - const char *filetype = image.filetype(); - if (!core_stricmp(filetype, "lnx")) - { - // 64 byte header - // LYNX - // intelword lower counter size - // 0 0 1 0 - // 32 chars name - // 22 chars manufacturer - UINT8 header[0x40]; - image.fread(header, 0x40); - - // Check the image - if (lynx_verify_cart((char*)header, LYNX_CART) == IMAGE_VERIFY_FAIL) - return IMAGE_INIT_FAIL; - - /* 2008-10 FP: According to Handy source these should be page_size_bank0. Are we using - it correctly in MESS? Moreover, the next two values should be page_size_bank1. We should - implement this as well */ - gran = header[4] | (header[5] << 8); - - logerror ("%s %dkb cartridge with %dbyte granularity from %s\n", header + 10, size / 1024, gran, header + 42); - size -= 0x40; - } - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - // set-up granularity - if (image.software_entry() == NULL) - { - const char *filetype = image.filetype(); - if (!core_stricmp(filetype, "lnx")) // from header - m_granularity = gran; - else if (!core_stricmp(filetype, "lyx")) - { - /* 2008-10 FP: FIXME: .lyx file don't have an header, hence they miss "lynx_granularity" - (see above). What if bank 0 has to be loaded elsewhere? And what about bank 1? - These should work with most .lyx files, but we need additional info on raw cart images */ - if (size == 0x20000) - m_granularity = 0x0200; - else if (size == 0x80000) - m_granularity = 0x0800; - else - m_granularity = 0x0400; - } - } - else - { - if (size > 0xffff) // 64,128,256,512k cartridges - m_granularity = size >> 8; - else - m_granularity = 0x400; // Homebrew roms not using all 256 banks (T-Tris) (none currently in softlist) - } - - // set-up rotation from softlist - if (image.software_entry() != NULL) - { - const char *rotate = image.get_feature("rotation"); - m_rotate = 0; - if (rotate) - { - if (!core_stricmp(rotate, "RIGHT")) - m_rotate = 1; - else if (!core_stricmp(rotate, "LEFT")) - m_rotate = 2; - } - - } - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/m20_8086.c b/src/mess/machine/m20_8086.c deleted file mode 100644 index 5c817b17edf..00000000000 --- a/src/mess/machine/m20_8086.c +++ /dev/null @@ -1,119 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#include "m20_8086.h" -#include "machine/ram.h" - -const device_type M20_8086 = &device_creator; - -m20_8086_device::m20_8086_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, M20_8086, "Olivetti M20 8086 Adapter", tag, owner, clock, "m20_8086", __FILE__), - m_8086(*this, "8086"), - m_maincpu(*this, ":maincpu"), - m_pic(*this, ":i8259"), - m_8086_halt(true) -{ -} - -void m20_8086_device::device_start() -{ - UINT8* ram = machine().device("ram")->pointer(); - m_8086->space(AS_PROGRAM).install_readwrite_bank(0x00000, machine().device("ram")->size() - 0x4001, "mainram"); - membank("highram")->set_base(ram); - membank("mainram")->set_base(&ram[0x4000]); - membank("vram")->set_base(memshare(":p_videoram")->ptr()); - membank("vram2")->set_base(memshare(":p_videoram")->ptr()); -} - -void m20_8086_device::device_reset() -{ - m_8086_halt = true; - m_nvi = m_vi = 0; - m_8086->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); -} - -ROM_START( m20_8086 ) - ROM_REGION(0x4000, "8086", 0) - ROM_LOAD("apb-1086-2.0.bin", 0x0000, 0x4000, CRC(8c05be93) SHA1(2bb424afd874cc6562e9642780eaac2391308053)) -ROM_END - - -const rom_entry *m20_8086_device::device_rom_region() const -{ - return ROM_NAME( m20_8086 ); -} - -static ADDRESS_MAP_START(i86_prog, AS_PROGRAM, 16, m20_8086_device) - AM_RANGE(0xe0000, 0xe3fff) AM_RAMBANK("vram2") - AM_RANGE(0xf0000, 0xf3fff) AM_RAMBANK("highram") - AM_RANGE(0xf4000, 0xf7fff) AM_RAMBANK("vram") - AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("8086",0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(i86_io, AS_IO, 16, m20_8086_device) - AM_RANGE(0x4000, 0x4fff) AM_READWRITE(z8000_io_r, z8000_io_w) - AM_RANGE(0x7ffa, 0x7ffd) AM_WRITE(handshake_w) -ADDRESS_MAP_END - -static MACHINE_CONFIG_FRAGMENT( m20_8086 ) - MCFG_CPU_ADD("8086", I8086, XTAL_24MHz/3) - MCFG_CPU_PROGRAM_MAP(i86_prog) - MCFG_CPU_IO_MAP(i86_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(m20_8086_device, int_cb) -MACHINE_CONFIG_END - -machine_config_constructor m20_8086_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( m20_8086 ); -} - -READ16_MEMBER(m20_8086_device::z8000_io_r) -{ - return m_maincpu->space(AS_IO).read_word(offset << 1, mem_mask); -} - -WRITE16_MEMBER(m20_8086_device::z8000_io_w) -{ - m_maincpu->space(AS_IO).write_word(offset << 1, data, mem_mask); -} - -IRQ_CALLBACK_MEMBER(m20_8086_device::int_cb) -{ - if(m_nvi) - { - m_nvi = false; - m_8086->set_input_line(INPUT_LINE_IRQ0, m_vi ? ASSERT_LINE : CLEAR_LINE); - return 0xff; - } - else - return m_pic->acknowledge() << 1; -} - -WRITE_LINE_MEMBER(m20_8086_device::nvi_w) -{ - m_nvi = state; - m_8086->set_input_line(INPUT_LINE_IRQ0, (state || m_vi) ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE_LINE_MEMBER(m20_8086_device::vi_w) -{ - m_vi = state; - m_8086->set_input_line(INPUT_LINE_IRQ0, (state || m_nvi) ? ASSERT_LINE : CLEAR_LINE); -} - -WRITE16_MEMBER(m20_8086_device::handshake_w) -{ - if(!offset) - { - m_8086->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - m_8086_halt = true; - } - else - { - m_8086->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_8086->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_8086_halt = false; - } -} diff --git a/src/mess/machine/m20_8086.h b/src/mess/machine/m20_8086.h deleted file mode 100644 index 148ba808c0a..00000000000 --- a/src/mess/machine/m20_8086.h +++ /dev/null @@ -1,40 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#ifndef M20_8086_H_ -#define M20_8086_H_ - -#include "emu.h" -#include "cpu/i86/i86.h" -#include "machine/pic8259.h" - -class m20_8086_device : public device_t -{ -public: - m20_8086_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - - DECLARE_READ16_MEMBER(z8000_io_r); - DECLARE_WRITE16_MEMBER(z8000_io_w); - DECLARE_WRITE_LINE_MEMBER(vi_w); - DECLARE_WRITE_LINE_MEMBER(nvi_w); - DECLARE_WRITE16_MEMBER(handshake_w); - IRQ_CALLBACK_MEMBER(int_cb); - bool halted() { return m_8086_halt; } - required_device m_8086; - -protected: - void device_start(); - void device_reset(); - -private: - required_device m_maincpu; - required_device m_pic; - bool m_8086_halt; - int m_nvi, m_vi; -}; - -extern const device_type M20_8086; - -#endif /* M20_8086_H_ */ diff --git a/src/mess/machine/m20_kbd.c b/src/mess/machine/m20_kbd.c deleted file mode 100644 index ecccffae775..00000000000 --- a/src/mess/machine/m20_kbd.c +++ /dev/null @@ -1,225 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -// TODO: dump 8048 mcu - -#include "machine/m20_kbd.h" - -m20_keyboard_device::m20_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, M20_KEYBOARD, "M20 Keyboard", tag, owner, 0, "m20_keyboard", __FILE__) -{ -} - -void m20_keyboard_device::write(UINT8 data) -{ - switch(data) - { - case 0x03: - send_key(2); - break; - case 0x80: - send_key(0x80); - break; - } - return; -} - -UINT8 m20_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) -{ - int i = *scan_line, j; - UINT8 code = 0, state = m_state[i]; - - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - - *scan_line = (*scan_line + 1) % 9; - - if(m_state[i] == code) - return 0; - - m_state[i] = code; - code = (state ^ code) & code; - - if(!code) - return 0; - - for(j = 0; j < 8; j++) - if((code >> j) == 1) - break; - - if(i >= 6) - code = 0xc0 + ((i - 6) << 3) + j; - else - code = (i << 3) + j; - - state = m_io_kbd9->read(); - if(state && (i <= 8)) - { - switch(state) - { - case 1: - code += 0x90; - break; - case 2: - code += 0x60; - break; - case 4: - case 8: - code += 0x30; - break; - } - } - - return code; -} - -// Italian layout -static INPUT_PORTS_START( m20_keyboard ) - PORT_START("TERM_LINE0") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_LALT) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - - PORT_START("TERM_LINE1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("TERM_LINE2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("TERM_LINE3") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa0 0") PORT_CODE(KEYCODE_0) PORT_CHAR(0x85) PORT_CHAR('0') // a_GRAVE - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc2\xa3 1") PORT_CODE(KEYCODE_1) PORT_CHAR(0x9c) PORT_CHAR('1') // POUND - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(e_ACUTE " 2") PORT_CODE(KEYCODE_2) PORT_CHAR(0x82) PORT_CHAR('2') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\" 3") PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') - - PORT_START("TERM_LINE4") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' 4") PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("( 5") PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_ 6") PORT_CODE(KEYCODE_6) PORT_CHAR('_') PORT_CHAR('6') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa8 7") PORT_CODE(KEYCODE_7) PORT_CHAR(0x8a) PORT_CHAR('7') // e_GRAVE - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ 8") PORT_CODE(KEYCODE_8) PORT_CHAR('^') PORT_CHAR('8') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa7 9") PORT_CODE(KEYCODE_9) PORT_CHAR(0x87) PORT_CHAR('9') // c_CEDILLA - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(") \xc2\xb0") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR(0xa7) // DEGREE - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('+') - - PORT_START("TERM_LINE5") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xac =") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x8d) PORT_CHAR('=') // i_GRAVE - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("$ &") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('$') PORT_CHAR('&') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xb9 %") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x8a) PORT_CHAR('%') // u_GRAVE - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("* \xc2\xa7") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('*') PORT_CHAR(0xf5) // SECTION - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; .") PORT_CODE(KEYCODE_STOP) PORT_CHAR(';') PORT_CHAR('.') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": /") PORT_CODE(KEYCODE_SLASH) PORT_CHAR(':') PORT_CHAR('/') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xb2") PORT_CODE(KEYCODE_RALT) PORT_CHAR(0x95) - - PORT_START("TERM_LINE6") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S2") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - - PORT_START("TERM_LINE7") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - - PORT_START("TERM_LINE8") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - - PORT_START("TERM_LINE9") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("COMMAND") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) - - PORT_START("TERM_LINEC") - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_1200, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_1200, "1200") - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_NONE, "None") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_2, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_2, "2") -INPUT_PORTS_END - -ioport_constructor m20_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(m20_keyboard); -} - -void m20_keyboard_device::device_start() -{ - serial_keyboard_device::device_start(); - memset(m_state, '\0', sizeof(m_state)); - set_rcv_rate(1200); -} - -void m20_keyboard_device::rcv_complete() -{ - receive_register_extract(); - write(get_received_char()); -} - -const device_type M20_KEYBOARD = &device_creator; diff --git a/src/mess/machine/m20_kbd.h b/src/mess/machine/m20_kbd.h deleted file mode 100644 index a3b9e770e77..00000000000 --- a/src/mess/machine/m20_kbd.h +++ /dev/null @@ -1,26 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#ifndef M20KBD_H_ -#define M20KBD_H_ - -#include "bus/rs232/keyboard.h" - -class m20_keyboard_device : public serial_keyboard_device -{ -public: - m20_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ioport_constructor device_input_ports() const; - -protected: - virtual void device_start(); - virtual void rcv_complete(); - -private: - void write(UINT8 data); - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); - UINT8 m_state[16]; -}; - -extern const device_type M20_KEYBOARD; - -#endif /* M20KBD_H_ */ diff --git a/src/mess/machine/m24_kbd.c b/src/mess/machine/m24_kbd.c deleted file mode 100644 index 5cc05a95b16..00000000000 --- a/src/mess/machine/m24_kbd.c +++ /dev/null @@ -1,292 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#include "m24_kbd.h" - -const device_type M24_KEYBOARD = &device_creator; - -ROM_START( m24_keyboard ) - ROM_REGION(0x800, "mcu", 0) - ROM_LOAD("m24_8049_int.bin", 0x0000, 0x800, CRC(ef26ca15) SHA1(b5076d40c255e17dc93478e2254ea19aff4918b3)) -ROM_END - - -const rom_entry *m24_keyboard_device::device_rom_region() const -{ - return ROM_NAME( m24_keyboard ); -} - -static ADDRESS_MAP_START( m24_keyboard_io, AS_IO, 8, m24_keyboard_device ) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(p2_r) AM_WRITENOP - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) -ADDRESS_MAP_END - -static MACHINE_CONFIG_FRAGMENT( m24_keyboard ) - MCFG_CPU_ADD("mcu", I8049, XTAL_6MHz) - MCFG_CPU_IO_MAP(m24_keyboard_io) -MACHINE_CONFIG_END - -machine_config_constructor m24_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( m24_keyboard ); -} - -INPUT_PORTS_START( m24_keyboard ) - PORT_START("ROW.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - - PORT_START("ROW.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - - PORT_START("ROW.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - - PORT_START("ROW.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - - PORT_START("ROW.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - - PORT_START("ROW.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - - PORT_START("ROW.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("ROW.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("ROW.8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - - PORT_START("ROW.9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - - PORT_START("ROW.10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW.11") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW.12") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW.13") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW.14") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW.15") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x2A") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - - PORT_START("MOUSEBTN") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left Btn") PORT_CODE(MOUSECODE_BUTTON1) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Middle Btn") PORT_CODE(MOUSECODE_BUTTON3) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right Btn") PORT_CODE(MOUSECODE_BUTTON2) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -ioport_constructor m24_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( m24_keyboard ); -} - -m24_keyboard_device::m24_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, M24_KEYBOARD, "Olivetti M24 Keyboard", tag, owner, clock, "m24_kbd", __FILE__), - m_rows(*this, "ROW"), - m_mousebtn(*this, "MOUSEBTN"), - m_out_data(*this), - m_mcu(*this, "mcu") -{ -} - -void m24_keyboard_device::device_start() -{ - m_out_data.resolve_safe(); - m_out_data(1); - m_reset_timer = timer_alloc(); -} - -void m24_keyboard_device::device_reset() -{ - m_kbcdata = true; -} - -void m24_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_out_data(1); -} - -READ8_MEMBER( m24_keyboard_device::p1_r ) -{ - return m_p1 | (m_kbcdata ? 0 : 2); -} - -WRITE8_MEMBER( m24_keyboard_device::p1_w ) -{ - // bit 3 and 4 are leds and bits 6 and 7 are jumpers to ground - m_p1 = data & ~0xc0; - if(m_p1 & 4) - m_p1 |= 2; - else - m_p1 &= ~2; - m_out_data(!BIT(data, 2)); -} - -READ8_MEMBER( m24_keyboard_device::p2_r ) -{ - return (m_keypress << 7) | m_mousebtn->read(); -} - -READ8_MEMBER( m24_keyboard_device::t0_r ) -{ - return 0; -} - -READ8_MEMBER( m24_keyboard_device::t1_r ) -{ - return 0; -} - -WRITE8_MEMBER( m24_keyboard_device::bus_w ) -{ - UINT8 col = m_rows[(data >> 3) & 0xf]->read(); - m_keypress = (col & (1 << (data & 7))) ? 1 : 0; -} - -WRITE_LINE_MEMBER( m24_keyboard_device::clock_w ) -{ - m_mcu->set_input_line(MCS48_INPUT_IRQ, !state); - if(!state) - m_reset_timer->adjust(attotime::from_msec(50)); - else - { - m_reset_timer->adjust(attotime::never); - m_mcu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - } -} - -WRITE_LINE_MEMBER( m24_keyboard_device::data_w ) -{ - m_kbcdata = state; -} diff --git a/src/mess/machine/m24_kbd.h b/src/mess/machine/m24_kbd.h deleted file mode 100644 index 8057c87e053..00000000000 --- a/src/mess/machine/m24_kbd.h +++ /dev/null @@ -1,47 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#ifndef M24KBD_H_ -#define M24KBD_H_ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" - -#define MCFG_M24_KEYBOARD_OUT_DATA_HANDLER(_devcb) \ - devcb = &m24_keyboard_device::set_out_data_handler(*device, DEVCB_##_devcb); - -class m24_keyboard_device : public device_t -{ -public: - m24_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_out_data_handler(device_t &device, _Object object) { return downcast(device).m_out_data.set_callback(object); } - - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - void device_start(); - void device_reset(); - void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - DECLARE_WRITE8_MEMBER(bus_w); - DECLARE_READ8_MEMBER(p1_r); - DECLARE_WRITE8_MEMBER(p1_w); - DECLARE_READ8_MEMBER(p2_r); - DECLARE_READ8_MEMBER(t0_r); - DECLARE_READ8_MEMBER(t1_r); - DECLARE_WRITE_LINE_MEMBER(clock_w); - DECLARE_WRITE_LINE_MEMBER(data_w); -private: - required_ioport_array<16> m_rows; - required_ioport m_mousebtn; - UINT8 m_p1; - bool m_keypress, m_kbcdata; - devcb_write_line m_out_data; - required_device m_mcu; - emu_timer *m_reset_timer; -}; - -extern const device_type M24_KEYBOARD; - -#endif /* M24KBD_H_ */ diff --git a/src/mess/machine/m24_z8000.c b/src/mess/machine/m24_z8000.c deleted file mode 100644 index d89034b4736..00000000000 --- a/src/mess/machine/m24_z8000.c +++ /dev/null @@ -1,229 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#include "m24_z8000.h" - -const device_type M24_Z8000 = &device_creator; - -m24_z8000_device::m24_z8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, M24_Z8000, "Olivetti M24 Z8000 Adapter", tag, owner, clock, "m24_z8000", __FILE__), - m_z8000(*this, "z8000"), - m_maincpu(*this, ":maincpu"), - m_pic(*this, ":mb:pic8259"), - m_halt_out(*this), - m_z8000_halt(true) -{ -} - -void m24_z8000_device::device_start() -{ - m_halt_out.resolve_safe(); -} - -void m24_z8000_device::device_reset() -{ - m_z8000_halt = true; - m_z8000_mem = false; - m_timer_irq = false; - m_irq = 0; - m_z8000->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); -} - -ROM_START( m24_z8000 ) - ROM_REGION(0x4000, "z8000", 0) - ROM_LOAD("m24apb.bin", 0x0000, 0x4000, CRC(3b3d2895) SHA1(ff048cf61b090b147be7e29a929a0be7b3ac8409)) -ROM_END - - -const rom_entry *m24_z8000_device::device_rom_region() const -{ - return ROM_NAME( m24_z8000 ); -} - -static ADDRESS_MAP_START(z8000_prog, AS_PROGRAM, 16, m24_z8000_device) - AM_RANGE(0x40000, 0x43fff) AM_ROM AM_REGION("z8000", 0) - AM_RANGE(0x50000, 0x53fff) AM_ROM AM_REGION("z8000", 0) - AM_RANGE(0x70000, 0x73fff) AM_ROM AM_REGION("z8000", 0) - AM_RANGE(0x00000, 0xfffff) AM_READWRITE(pmem_r, pmem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(z8000_data, AS_DATA, 16, m24_z8000_device) - AM_RANGE(0x40000, 0x43fff) AM_ROM AM_REGION("z8000", 0) - AM_RANGE(0x70000, 0x73fff) AM_ROM AM_REGION("z8000", 0) - AM_RANGE(0x00000, 0xfffff) AM_READWRITE(dmem_r, dmem_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START(z8000_io, AS_IO, 16, m24_z8000_device) - AM_RANGE(0x0080, 0x0081) AM_WRITE8(irqctl_w, 0x00ff) - AM_RANGE(0x00a0, 0x00a1) AM_WRITE8(serctl_w, 0x00ff) - AM_RANGE(0x00c0, 0x00c1) AM_DEVREADWRITE8("i8251", i8251_device, data_r, data_w, 0x00ff) - AM_RANGE(0x00c2, 0x00c3) AM_DEVREADWRITE8("i8251", i8251_device, status_r, control_w, 0x00ff) - AM_RANGE(0x0120, 0x0127) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0x00ff) - AM_RANGE(0x80c0, 0x80c1) AM_READWRITE8(handshake_r, handshake_w, 0x00ff) - AM_RANGE(0x8000, 0x83ff) AM_READWRITE(i86_io_r, i86_io_w) -ADDRESS_MAP_END - -static MACHINE_CONFIG_FRAGMENT( m24_z8000 ) - MCFG_CPU_ADD("z8000", Z8001, XTAL_8MHz/2) - MCFG_CPU_PROGRAM_MAP(z8000_prog) - MCFG_CPU_DATA_MAP(z8000_data) - MCFG_CPU_IO_MAP(z8000_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(m24_z8000_device, int_cb) - MCFG_Z8000_MO(WRITELINE(m24_z8000_device, mo_w)) - - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(19660000/15) - MCFG_PIT8253_OUT0_HANDLER(NULL) //8251 - MCFG_PIT8253_CLK1(19660000/15) - MCFG_PIT8253_OUT1_HANDLER(NULL) - MCFG_PIT8253_CLK2(19660000/15) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(m24_z8000_device, timer_irq_w)) - - MCFG_DEVICE_ADD("i8251", I8251, 0) -MACHINE_CONFIG_END - -machine_config_constructor m24_z8000_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( m24_z8000 ); -} - -const UINT8 m24_z8000_device::pmem_table[16][4] = - {{0, 1, 2, 3}, {1, 2, 3, 255}, {4, 5, 6, 7}, {46, 40, 41, 42}, - {255, 255, 255, 255}, {255, 255, 255, 47}, {1, 2, 3, 255}, {255, 255, 255, 255}, - {1, 2, 8, 9}, {5, 6, 10, 11}, {1, 2, 8, 9}, {12, 13, 14, 15}, - {16, 17, 18, 19}, {20, 21, 22, 23}, {24, 25, 26, 27}, {28, 29, 30, 31}}; - -READ16_MEMBER(m24_z8000_device::pmem_r) -{ - UINT16 ret; - UINT8 hostseg; - offset <<= 1; - if(!m_z8000_mem) - return memregion(subtag("z8000").c_str())->u16(offset >> 1); - - hostseg = pmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; - if(hostseg == 255) - return 0; - offset = (offset & 0x3fff) | (hostseg << 14); - if((hostseg >= 40) && (hostseg <= 47)) - offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); // move A6/A7 so CGA framebuffer appears linear - ret = m_maincpu->space(AS_PROGRAM).read_word(offset, (mem_mask << 8) | (mem_mask >> 8)); - return (ret << 8) | (ret >> 8); -} - -WRITE16_MEMBER(m24_z8000_device::pmem_w) -{ - UINT8 hostseg; - data = (data << 8) | (data >> 8); - offset <<= 1; - hostseg = pmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; - if(hostseg == 255) - return; - offset = (offset & 0x3fff) | (hostseg << 14); - if((hostseg >= 40) && (hostseg <= 47)) - offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); - m_maincpu->space(AS_PROGRAM).write_word(offset, data, (mem_mask << 8) | (mem_mask >> 8)); -} - -const UINT8 m24_z8000_device::dmem_table[16][4] = - {{0, 1, 2, 3}, {4, 5, 6, 7}, {4, 5, 6, 7}, {46, 40, 41, 42}, - {255, 255, 255, 255}, {1, 2, 3, 47}, {1, 2, 3, 255}, {255, 255, 255, 255}, - {5, 6, 10, 11}, {5, 6, 10, 11}, {1, 2, 8, 9}, {12, 13, 14, 15}, - {16, 17, 18, 19}, {20, 21, 22, 23}, {24, 25, 26, 27}, {28, 29, 30, 31}}; - -READ16_MEMBER(m24_z8000_device::dmem_r) -{ - UINT16 ret; - UINT8 hostseg; - offset <<= 1; - hostseg = dmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; - if(hostseg == 255) - return 0; - offset = (offset & 0x3fff) | (hostseg << 14); - if((hostseg >= 40) && (hostseg <= 47)) - offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); - ret = m_maincpu->space(AS_PROGRAM).read_word(offset, (mem_mask << 8) | (mem_mask >> 8)); - return (ret << 8) | (ret >> 8); -} - -WRITE16_MEMBER(m24_z8000_device::dmem_w) -{ - UINT8 hostseg; - data = (data << 8) | (data >> 8); - offset <<= 1; - hostseg = dmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; - if(hostseg == 255) - return; - offset = (offset & 0x3fff) | (hostseg << 14); - if((hostseg >= 40) && (hostseg <= 47)) - offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); - m_maincpu->space(AS_PROGRAM).write_word(offset, data, (mem_mask << 8) | (mem_mask >> 8)); -} - -READ16_MEMBER(m24_z8000_device::i86_io_r) -{ - UINT16 ret = m_maincpu->space(AS_IO).read_word(offset << 1, (mem_mask << 8) | (mem_mask >> 8)); - return (ret << 8) | (ret >> 8); -} - -WRITE16_MEMBER(m24_z8000_device::i86_io_w) -{ - data = (data << 8) | (data >> 8); - m_maincpu->space(AS_IO).write_word(offset << 1, data, (mem_mask << 8) | (mem_mask >> 8)); -} - -WRITE8_MEMBER(m24_z8000_device::irqctl_w) -{ - m_irq = data; -} - -WRITE8_MEMBER(m24_z8000_device::serctl_w) -{ - m_z8000_mem = (data & 0x20) ? true : false; -} - -IRQ_CALLBACK_MEMBER(m24_z8000_device::int_cb) -{ - if (!irqline) - { - m_z8000->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); - return 0xff; // NVI, value ignored - } - else - return m_pic->acknowledge(); -} - -READ8_MEMBER(m24_z8000_device::handshake_r) -{ - return 0; -} - -WRITE8_MEMBER(m24_z8000_device::handshake_w) -{ - m_handshake = data; - if(data & 1) - { - m_z8000->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_z8000->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - m_z8000->mi_w(CLEAR_LINE); - m_z8000_halt = false; - } - else - { - m_z8000->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_z8000_halt = true; - m_z8000_mem = false; - m_halt_out(CLEAR_LINE); - } -} - -WRITE_LINE_MEMBER(m24_z8000_device::mo_w) -{ - m_z8000->mi_w(state ? ASSERT_LINE : CLEAR_LINE); - m_halt_out(state); -} - -WRITE_LINE_MEMBER(m24_z8000_device::timer_irq_w) -{ - m_timer_irq = state ? true : false; - m_z8000->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); -} diff --git a/src/mess/machine/m24_z8000.h b/src/mess/machine/m24_z8000.h deleted file mode 100644 index 7f0e08e0b5e..00000000000 --- a/src/mess/machine/m24_z8000.h +++ /dev/null @@ -1,56 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#ifndef M24_Z8000_H_ -#define M24_Z8000_H_ - -#include "emu.h" -#include "cpu/z8000/z8000.h" -#include "machine/i8251.h" -#include "machine/pit8253.h" -#include "machine/pic8259.h" - -#define MCFG_M24_Z8000_HALT(_devcb) \ - devcb = &m24_z8000_device::set_halt_callback(*device, DEVCB_##_devcb); - -class m24_z8000_device : public device_t -{ -public: - m24_z8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - template static devcb_base &set_halt_callback(device_t &device, _Object object) { return downcast(device).m_halt_out.set_callback(object); } - - DECLARE_READ16_MEMBER(pmem_r); - DECLARE_WRITE16_MEMBER(pmem_w); - DECLARE_READ16_MEMBER(dmem_r); - DECLARE_WRITE16_MEMBER(dmem_w); - DECLARE_READ16_MEMBER(i86_io_r); - DECLARE_WRITE16_MEMBER(i86_io_w); - DECLARE_WRITE8_MEMBER(irqctl_w); - DECLARE_WRITE8_MEMBER(serctl_w); - DECLARE_READ8_MEMBER(handshake_r); - DECLARE_WRITE8_MEMBER(handshake_w); - DECLARE_WRITE_LINE_MEMBER(mo_w); - DECLARE_WRITE_LINE_MEMBER(timer_irq_w); - IRQ_CALLBACK_MEMBER(int_cb); - bool halted() { return m_z8000_halt; } - - required_device m_z8000; -protected: - void device_start(); - void device_reset(); - -private: - required_device m_maincpu; - required_device m_pic; - devcb_write_line m_halt_out; - static const UINT8 pmem_table[16][4]; - static const UINT8 dmem_table[16][4]; - UINT8 m_handshake, m_irq; - bool m_z8000_halt, m_z8000_mem, m_timer_irq; -}; - -extern const device_type M24_Z8000; - -#endif /* M24_Z8000_H_ */ diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c deleted file mode 100644 index 098bcede238..00000000000 --- a/src/mess/machine/mac.c +++ /dev/null @@ -1,3294 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/**************************************************************************** - - machine/mac.c - - Mac hardware - Mac 128k, 512k, 512ke, Plus, SE, Classic, II, PowerBook (SCSI, SCC, ADB, etc) - - Nate Woods - Ernesto Corvi - Raphael Nabet - R. Belmont - - Mac Model Feature Summary: - CPU FDC Kbd/Mouse PRAM Video - - Mac 128k 68k IWM orig orig Original - - Mac 512k 68k IWM orig orig Original - - Mac 512ke 68k IWM orig orig Original - - Mac Plus 68k IWM orig ext Original - - Mac SE 68k IWM MacII ADB ext Original - - Mac Classic 68k SWIM MacII ADB ext Original - - Mac Portable 68k (16 MHz) SWIM ADB-PMU PMU 640x400 B&W - - PowerBook 100 68k (16 MHz) SWIM ADB-PMU PMU 640x400 B&W - - Mac II 020 IWM MacII ADB ext NuBus card - - Mac IIx 030 SWIM MacII ADB ext NuBus card - - Mac IIfx 030 SWIM IOP ADB ext NuBus card - - Mac SE/30 030 SWIM MacII ADB ext Internal fake NuBus card - - Mac IIcx 030 SWIM MacII ADB ext NuBus card - - Mac IIci 030 SWIM MacII ADB ext Internal "RBV" type - - Mac IIsi 030 SWIM Egret ADB n/a Internal "RBV" type - - PowerBook 140/145(B) 030 (16/25 MHz) SWIM ADB-PMU PMU 640x400 B&W (passive matrix) - - PowerBook 170 030 (25 MHz) SWIM ADB-PMU PMU 640x400 B&W (active matrix) - - Mac IIvx/IIvi 030 SWIM Egret ADB n/a Internal "VASP" type - - Mac LC 020 SWIM Egret ADB n/a Internal "V8" type - - Mac LC II 030 SWIM Egret ADB n/a Internal "V8" type - - Mac LC III 030 SWIM Egret ADB n/a Internal "Sonora" type - - Mac Classic II 030 SWIM Egret ADB n/a Internal "Eagle" type (V8 clone) - - Mac Color Classic 030 SWIM Cuda ADB n/a Internal "Spice" type (V8 clone) - - Mac Quadra 700 040 (25 MHz) SWIM II MacII ADB ext Internal "DAFB" type - - Mac Quadra 900 040 (33 MHz) SWIM II IOP ADB ext Internal "DAFB" type - - Notes: - - The Mac Plus boot code seems to check to see the extent of ROM - mirroring to determine if SCSI is available. If the ROM is mirrored, - then SCSI is not available. Thanks to R. Belmont for making this - discovery. - - On the SE and most later Macs, the first access to ROM turns off the overlay. - However, the Mac II/IIx/IIcx (and others?) have the old-style VIA overlay control bit! - - The Mac II can have either a 68551 PMMU fitted or an Apple custom that handles 24 vs. 32 - bit addressing mode. The ROM is *not* 32-bit clean so Mac OS normally runs in 24 bit mode, - but A/UX can run 32. - - There are 5 known kinds of host-side ADB hardware: - * "Mac II ADB" used in the SE, II, IIx, IIcx, SE/30, IIci, Quadra 610, Quadra 650, Quadra 700, - Quadra 800, Centris 610 and Centris 650. This is a bit-banger using the VIA and a simple PIC. - * "PMU ADB" used in the Mac Portable and all 680x0-based PowerBooks. - * "Egret ADB" used in the IIsi, IIvi, IIvx, Classic II, LC, LC II, LC III, Performa 460, - and Performa 600. This is a 68HC05 with a different internal ROM than CUDA. - * "IOP ADB" (ADB driven by a 6502 coprocessor, similar to Lisa) used in the IIfx, - Quadra 900, and Quadra 950. - * "Cuda ADB" (Apple's CUDA chip, which is a 68HC05 MCU) used in the Color Classic, LC 520, - LC 55x, LC 57x, LC 58x, Quadra 630, Quadra 660AV, Quadra 840AV, PowerMac 6100/7100/8100, - IIci, and PowerMac 5200. - - TODO: - - Call the RTC timer - - Egret version spotting: - 341S0850 - 0x???? (1.01, earlier) - LC, LC II - 341S0851 - 0x0101 (1.01, later) - Classic II, IIsi, IIvx/IIvi, LC III - 344S0100 - 0x0100 (1.00) - Some (early production?) IIsi - - Cuda version spotting: - 341S0262 - 0x0003f200 (3.02) - some PMac 6500, Bondi blue iMac - 341S0285 - No version (x.xx) - PMac 4400 + Mac clones ("Cuda Lite" with 768 bytes more ROM + PS/2 keyboard/mouse support) - 341S0060 - 0x00020028 (2.40) - Performa/Quadra 6xx, PMac 6200, x400, some x500, Pippin, "Gossamer" G3, others? - (verified found in PMac 5500-225, G3-333) - 341S0788 - 0x00020025 (2.37) - LC 475/575/Quadra 605, Quadra 660AV/840AV, PMac 7200 - 341S0417 - 0x00020023 (2.35) - Color Classic - - Caboose version spotting: - 341S0853 - 0x0100 (1.00) - Quadra 950 - - PG&E (68HC05 PMU) version spotting: - (find the text "BORG" in the system ROM, the next 32768 bytes are the PG&E image. - offset +4 in the image is the version byte). - 01 - PowerBook Duo 210/230/250 - 02 - PowerBook 540c, PBDuo 270C, PBDuo 280/280C - 03 - PowerBook 150 - 08 - PB190cs, PowerBook 540c PPC update, all PowerPC PowerBooks through WallStreet G3s - -****************************************************************************/ - -#include "emu.h" -#include "includes/mac.h" -#include "machine/applefdc.h" -#include "machine/sonydriv.h" -#include "debug/debugcpu.h" -#include "debugger.h" - -#define AUDIO_IS_CLASSIC (m_model <= MODEL_MAC_CLASSIC) -#define MAC_HAS_VIA2 ((m_model >= MODEL_MAC_II) && (m_model != MODEL_MAC_IIFX)) - -#define INTS_RBV ((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIVI)) || ((m_model >= MODEL_MAC_LC) && (m_model <= MODEL_MAC_LC_580)) - -#ifdef MAME_DEBUG -#define LOG_ADB 0 -#define LOG_VIA 0 -#define LOG_MAC_IWM 0 -#define LOG_GENERAL 0 -#define LOG_KEYBOARD 0 -#define LOG_MEMORY 0 -#else -#define LOG_ADB 0 -#define LOG_VIA 0 -#define LOG_MAC_IWM 0 -#define LOG_GENERAL 0 -#define LOG_KEYBOARD 0 -#define LOG_MEMORY 0 -#endif - -extern TIMER_CALLBACK(mac_adb_tick); // macadb.c -extern TIMER_CALLBACK(mac_pmu_tick); // macadb.c - -static offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); - -// returns non-zero if this Mac has ADB -int mac_state::has_adb() -{ - return m_model >= MODEL_MAC_SE; -} - -// handle disk enable lines -void mac_fdc_set_enable_lines(device_t *device, int enable_mask) -{ - mac_state *mac = device->machine().driver_data(); - - if (mac->m_model != MODEL_MAC_SE) - { - sony_set_enable_lines(device, enable_mask); - } - else - { - if (enable_mask) - { - sony_set_enable_lines(device, mac->m_drive_select ? 1 : 2); - } - else - { - sony_set_enable_lines(device, enable_mask); - } - } -} - -void mac_state::mac_install_memory(offs_t memory_begin, offs_t memory_end, - offs_t memory_size, void *memory_data, int is_rom, const char *bank) -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - offs_t memory_mask; - - memory_size = MIN(memory_size, (memory_end + 1 - memory_begin)); - memory_mask = memory_size - 1; - - if (!is_rom) - { - space.install_readwrite_bank(memory_begin, memory_end, memory_mask, 0, bank); - } - else - { - space.unmap_write(memory_begin, memory_end, memory_mask, 0); - space.install_read_bank(memory_begin, memory_end, memory_mask, 0, bank); - } - - membank(bank)->set_base(memory_data); - - if (LOG_MEMORY) - { - printf("mac_install_memory(): bank=%s range=[0x%06x...0x%06x] mask=0x%06x ptr=0x%p\n", - bank, memory_begin, memory_end, memory_mask, memory_data); - } -} - - - -/* - Interrupt handling -*/ - -void mac_state::field_interrupts() -{ - int take_interrupt = -1; - - if (m_model < MODEL_MAC_PORTABLE) - { - if ((m_scc_interrupt) || (m_scsi_interrupt)) - { - take_interrupt = 2; - } - else if (m_via_interrupt) - { - take_interrupt = 1; - } - } - else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100)) - { - if ((m_scc_interrupt) || (m_asc_interrupt)) - { - take_interrupt = 2; - } - else if (m_via_interrupt) - { - take_interrupt = 1; - } - } - else if ((m_model < MODEL_MAC_POWERMAC_6100) && (m_model != MODEL_MAC_IIFX)) - { - if (m_scc_interrupt) - { - take_interrupt = 4; - } - else if (m_via2_interrupt) - { - take_interrupt = 2; - } - else if (m_via_interrupt) - { - take_interrupt = 1; - } - } - else - { - return; // no interrupts for PowerPC yet - } - - if (m_last_taken_interrupt > -1) - { - m_maincpu->set_input_line(m_last_taken_interrupt, CLEAR_LINE); - m_last_taken_interrupt = -1; - } - - if (take_interrupt > -1) - { - m_maincpu->set_input_line(take_interrupt, ASSERT_LINE); - m_last_taken_interrupt = take_interrupt; - } -} - -WRITE_LINE_MEMBER(mac_state::set_scc_interrupt) -{ - m_scc_interrupt = state; - this->field_interrupts(); -} - -void mac_state::set_via_interrupt(int value) -{ - m_via_interrupt = value; - this->field_interrupts(); -} - - -void mac_state::set_via2_interrupt(int value) -{ - m_via2_interrupt = value; - this->field_interrupts(); -} - -WRITE_LINE_MEMBER(mac_state::mac_asc_irq) -{ - if (INTS_RBV) - { - if (state == ASSERT_LINE) - { - m_rbv_regs[3] |= 0x10; // any VIA 2 interrupt | sound interrupt - rbv_recalc_irqs(); - } - else - { - m_rbv_regs[3] &= ~0x10; - rbv_recalc_irqs(); - } - } - else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100)) - { -// m_asc_interrupt = state; -// field_interrupts(); - } - else if ((m_model >= MODEL_MAC_II) && (m_model != MODEL_MAC_IIFX)) - { - m_via2->write_cb1(state^1); - } -} - -WRITE16_MEMBER ( mac_state::mac_autovector_w ) -{ - if (LOG_GENERAL) - logerror("mac_autovector_w: offset=0x%08x data=0x%04x\n", offset, data); - - /* This should throw an exception */ - - /* Not yet implemented */ -} - -READ16_MEMBER ( mac_state::mac_autovector_r ) -{ - if (LOG_GENERAL) - logerror("mac_autovector_r: offset=0x%08x\n", offset); - - /* This should throw an exception */ - - /* Not yet implemented */ - return 0; -} - -void mac_state::set_scc_waitrequest(int waitrequest) -{ - if (LOG_GENERAL) - logerror("set_scc_waitrequest: waitrequest=%i\n", waitrequest); - - /* Not Yet Implemented */ -} - -void mac_state::v8_resize() -{ - offs_t memory_size; - UINT8 *memory_data; - int is_rom; - - is_rom = (m_overlay) ? 1 : 0; - - // get what memory we're going to map - if (is_rom) - { - /* ROM mirror */ - memory_size = memregion("bootrom")->bytes(); - memory_data = memregion("bootrom")->base(); - is_rom = TRUE; - } - else - { - /* RAM */ - memory_size = m_ram->size(); - memory_data = m_ram->pointer(); - is_rom = FALSE; - } - -// printf("mac_v8_resize: memory_size = %x, ctrl bits %02x (overlay %d = %s)\n", memory_size, m_rbv_regs[1] & 0xe0, m_overlay, is_rom ? "ROM" : "RAM"); - - if (is_rom) - { - mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); - } - else - { - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT32 onboard_amt, simm_amt, simm_size; - static const UINT32 simm_sizes[4] = { 0, 2*1024*1024, 4*1024*1024, 8*1024*1024 }; - - // force unmap of entire RAM region - space.unmap_write(0, 0x9fffff, 0x9fffff, 0); - - // LC and Classic II have 2 MB built-in, all other V8-style machines have 4 MB - // we reserve the first 2 or 4 MB of mess_ram for the onboard, - // RAM above that mark is the SIMM - onboard_amt = ((m_model == MODEL_MAC_LC) || (m_model == MODEL_MAC_CLASSIC_II)) ? 2*1024*1024 : 4*1024*1024; - simm_amt = (m_rbv_regs[1]>>6) & 3; // size of SIMM RAM window - simm_size = memory_size - onboard_amt; // actual amount of RAM available for SIMMs - - // installing SIMM RAM? - if (simm_amt != 0) - { -// printf("mac_v8_resize: SIMM region size is %x, SIMM size is %x, onboard size is %x\n", simm_sizes[simm_amt], simm_size, onboard_amt); - - if ((simm_amt > 0) && (simm_size > 0)) - { -// mac_install_memory(0x000000, simm_sizes[simm_amt]-1, simm_sizes[simm_amt], memory_data + onboard_amt, is_rom, "bank1"); - mac_install_memory(0x000000, simm_size-1, simm_size, memory_data + onboard_amt, is_rom, "bank1"); - } - - // onboard RAM sits immediately above the SIMM, if any - if (simm_sizes[simm_amt] + onboard_amt <= 0x800000) - { - mac_install_memory(simm_sizes[simm_amt], simm_sizes[simm_amt] + onboard_amt - 1, onboard_amt, memory_data, is_rom, "bank2"); - } - - // a mirror of the first 2 MB of on board RAM always lives at 0x800000 - mac_install_memory(0x800000, 0x9fffff, 0x200000, memory_data, is_rom, "bank3"); - } - else - { -// printf("mac_v8_resize: SIMM off, mobo RAM at 0 and top\n"); - - mac_install_memory(0x000000, onboard_amt-1, onboard_amt, memory_data, is_rom, "bank1"); - mac_install_memory(0x900000, 0x9fffff, 0x200000, memory_data+0x100000, is_rom, "bank3"); - } - } -} - -void mac_state::set_memory_overlay(int overlay) -{ - offs_t memory_size; - UINT8 *memory_data; - int is_rom; - - /* normalize overlay */ - overlay = overlay ? TRUE : FALSE; - - if (overlay != m_overlay) - { - /* set up either main RAM area or ROM mirror at 0x000000-0x3fffff */ - if (overlay) - { - /* ROM mirror */ - memory_size = memregion("bootrom")->bytes(); - memory_data = memregion("bootrom")->base(); - is_rom = TRUE; - } - else - { - /* RAM */ - memory_size = m_ram->size(); - memory_data = m_ram->pointer(); - is_rom = FALSE; - } - - /* install the memory */ - if (((m_model >= MODEL_MAC_LC) && (m_model <= MODEL_MAC_COLOR_CLASSIC) && ((m_model != MODEL_MAC_LC_III) && (m_model != MODEL_MAC_LC_III_PLUS))) || (m_model == MODEL_MAC_CLASSIC_II)) - { - m_overlay = overlay; - v8_resize(); - } - else if ((m_model == MODEL_MAC_IICI) || (m_model == MODEL_MAC_IISI)) - { - // ROM is OK to flood to 3fffffff - if (is_rom) - { - mac_install_memory(0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1"); - } - else // RAM: be careful not to populate ram B with a mirror or the ROM will get confused - { - mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); - } - } - else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100) || (m_model == MODEL_MAC_IIVX) || (m_model == MODEL_MAC_IIFX)) - { - address_space& space = m_maincpu->space(AS_PROGRAM); - space.unmap_write(0x000000, 0x9fffff, 0x9fffff, 0); - mac_install_memory(0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); - } - else if ((m_model == MODEL_MAC_PB140) || (m_model == MODEL_MAC_PB160) || ((m_model >= MODEL_MAC_PBDUO_210) && (m_model <= MODEL_MAC_PBDUO_270c))) - { - address_space& space = m_maincpu->space(AS_PROGRAM); - space.unmap_write(0x000000, 0xffffff, 0xffffff, 0); - mac_install_memory(0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); - } - else if ((m_model >= MODEL_MAC_II) && (m_model <= MODEL_MAC_SE30)) - { - mac_install_memory(0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1"); - } - else if ((m_model == MODEL_MAC_LC_III) || (m_model == MODEL_MAC_LC_III_PLUS) || (m_model >= MODEL_MAC_LC_475 && m_model <= MODEL_MAC_LC_580)) // up to 36 MB - { - mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); - } - else if (m_model == MODEL_MAC_QUADRA_700) - { - mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); - } - else - { - mac_install_memory(0x00000000, 0x003fffff, memory_size, memory_data, is_rom, "bank1"); - } - - m_overlay = overlay; - - if (LOG_GENERAL) - logerror("mac_set_memory_overlay: overlay=%i\n", overlay); - } -} - - - -/* - R Nabet 000531 : added keyboard code -*/ - -/* ************************************************************************* - * non-ADB keyboard support - * - * The keyboard uses a i8021 (?) microcontroller. - * It uses a bidirectional synchonous serial line, connected to the VIA (SR feature) - * - * Our emulation is more a hack than anything else - the keyboard controller is - * not emulated, instead we interpret keyboard commands directly. I made - * many guesses, which may be wrong - * - * todo : - * * find the correct model number for the Mac Plus keyboard ? - * * emulate original Macintosh keyboards (2 layouts : US and international) - * - * references : - * * IM III-29 through III-32 and III-39 through III-42 - * * IM IV-250 - * *************************************************************************/ - -/* - scan_keyboard() - - scan the keyboard, and returns key transition code (or NULL ($7B) if none) -*/ -#ifndef MAC_USE_EMULATED_KBD -int mac_state::scan_keyboard() -{ - int i, j; - int keybuf = 0; - int keycode; - ioport_port *ports[7] = { m_key0, m_key1, m_key2, m_key3, m_key4, m_key5, m_key6 }; - - if (m_keycode_buf_index) - { - return m_keycode_buf[--m_keycode_buf_index]; - } - - for (i=0; i<7; i++) - { - keybuf = ports[i]->read(); - - if (keybuf != m_key_matrix[i]) - { - /* if state has changed, find first bit which has changed */ - if (LOG_KEYBOARD) - logerror("keyboard state changed, %d %X\n", i, keybuf); - - for (j=0; j<16; j++) - { - if (((keybuf ^ m_key_matrix[i]) >> j) & 1) - { - /* update m_key_matrix */ - m_key_matrix[i] = (m_key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j)); - - if (i < 4) - { - /* create key code */ - keycode = (i << 5) | (j << 1) | 0x01; - if (! (keybuf & (1 << j))) - { - /* key up */ - keycode |= 0x80; - } - return keycode; - } - else if (i < 6) - { - /* create key code */ - keycode = ((i & 3) << 5) | (j << 1) | 0x01; - - if ((keycode == 0x05) || (keycode == 0x0d) || (keycode == 0x11) || (keycode == 0x1b)) - { - /* these keys cause shift to be pressed (for compatibility with mac 128/512) */ - if (keybuf & (1 << j)) - { - /* key down */ - if (! (m_key_matrix[3] & 0x0100)) - { - /* shift key is really up */ - m_keycode_buf[0] = keycode; - m_keycode_buf[1] = 0x79; - m_keycode_buf_index = 2; - return 0x71; /* "presses" shift down */ - } - } - else - { /* key up */ - if (! (m_key_matrix[3] & 0x0100)) - { - /* shift key is really up */ - m_keycode_buf[0] = keycode | 0x80; - m_keycode_buf[1] = 0x79; - m_keycode_buf_index = 2; - return 0xF1; /* "releases" shift */ - } - } - } - - if (! (keybuf & (1 << j))) - { - /* key up */ - keycode |= 0x80; - } - m_keycode_buf[0] = keycode; - m_keycode_buf_index = 1; - return 0x79; - } - else /* i == 6 */ - { - /* create key code */ - keycode = (j << 1) | 0x01; - if (! (keybuf & (1 << j))) - { - /* key up */ - keycode |= 0x80; - } - m_keycode_buf[0] = keycode; - m_keycode_buf_index = 1; - return 0x79; - } - } - } - } - } - - return 0x7B; /* return NULL */ -} - -/* - power-up init -*/ -void mac_state::keyboard_init() -{ - int i; - - /* init flag */ - m_kbd_comm = FALSE; - m_kbd_receive = FALSE; - m_kbd_shift_reg=0; - m_kbd_shift_count=0; - - /* clear key matrix */ - for (i=0; i<7; i++) - { - m_key_matrix[i] = 0; - } - - /* purge transmission buffer */ - m_keycode_buf_index = 0; -} -#endif - -/******************* Keyboard <-> VIA communication ***********************/ - -#ifdef MAC_USE_EMULATED_KBD - -WRITE_LINE_MEMBER(mac_state::mac_kbd_clk_in) -{ - printf("CLK: %d\n", state^1); - m_via1->write_cb1(state ? 0 : 1); -} - -WRITE_LINE_MEMBER(mac_state::mac_via_out_cb2) -{ - printf("Sending %d to kbd (PC=%x)\n", data, m_maincpu->pc()); - m_mackbd->data_w((data & 1) ? ASSERT_LINE : CLEAR_LINE); -} - -#else // keyboard HLE - -TIMER_CALLBACK_MEMBER(mac_state::kbd_clock) -{ - int i; - - if (m_kbd_comm == TRUE) - { - for (i=0; i<8; i++) - { - /* Put data on CB2 if we are sending*/ - if (m_kbd_receive == FALSE) - m_via1->write_cb2(m_kbd_shift_reg&0x80?1:0); - m_kbd_shift_reg <<= 1; - m_via1->write_cb1(0); - m_via1->write_cb1(1); - } - if (m_kbd_receive == TRUE) - { - m_kbd_receive = FALSE; - /* Process the command received from mac */ - keyboard_receive(m_kbd_shift_reg & 0xff); - } - else - { - /* Communication is over */ - m_kbd_comm = FALSE; - } - } -} - -void mac_state::kbd_shift_out(int data) -{ - if (m_kbd_comm == TRUE) - { - m_kbd_shift_reg = data; - machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(mac_state::kbd_clock),this)); - } -} - -WRITE_LINE_MEMBER(mac_state::mac_via_out_cb2) -{ - if (m_kbd_comm == FALSE && state == 0) - { - /* Mac pulls CB2 down to initiate communication */ - m_kbd_comm = TRUE; - m_kbd_receive = TRUE; - machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(mac_state::kbd_clock),this)); - } - if (m_kbd_comm == TRUE && m_kbd_receive == TRUE) - { - /* Shift in what mac is sending */ - m_kbd_shift_reg = (m_kbd_shift_reg & ~1) | state; - } -} - -/* - called when inquiry times out (1/4s) -*/ -TIMER_CALLBACK_MEMBER(mac_state::inquiry_timeout_func) -{ - if (LOG_KEYBOARD) - logerror("keyboard enquiry timeout\n"); - kbd_shift_out(0x7B); /* always send NULL */ -} - -/* - called when a command is received from the mac -*/ -void mac_state::keyboard_receive(int val) -{ - switch (val) - { - case 0x10: - /* inquiry - returns key transition code, or NULL ($7B) if time out (1/4s) */ - if (LOG_KEYBOARD) - logerror("keyboard command : inquiry\n"); - - m_inquiry_timeout->adjust( - attotime(0, DOUBLE_TO_ATTOSECONDS(0.25)), 0); - break; - - case 0x14: - /* instant - returns key transition code, or NULL ($7B) */ - if (LOG_KEYBOARD) - logerror("keyboard command : instant\n"); - - kbd_shift_out(scan_keyboard()); - break; - - case 0x16: - /* model number - resets keyboard, return model number */ - if (LOG_KEYBOARD) - logerror("keyboard command : model number\n"); - - { /* reset */ - int i; - - /* clear key matrix */ - for (i=0; i<7; i++) - { - m_key_matrix[i] = 0; - } - - /* purge transmission buffer */ - m_keycode_buf_index = 0; - } - - /* format : 1 if another device (-> keypad ?) connected | next device (-> keypad ?) number 1-8 - | keyboard model number 1-8 | 1 */ - /* keyboards : - 3 : mac 512k, US and international layout ? Mac plus ??? - other values : Apple II keyboards ? - */ - /* keypads : - ??? : standard keypad (always available on Mac Plus) ??? - */ - kbd_shift_out(0x17); /* probably wrong */ - break; - - case 0x36: - /* test - resets keyboard, return ACK ($7D) or NAK ($77) */ - if (LOG_KEYBOARD) - logerror("keyboard command : test\n"); - - kbd_shift_out(0x7D); /* ACK */ - break; - - default: - if (LOG_KEYBOARD) - logerror("unknown keyboard command 0x%X\n", val); - - kbd_shift_out(0); - break; - } -} -#endif - -/* ************************************************************************* - * Mouse - * *************************************************************************/ - -void mac_state::mouse_callback() -{ - int new_mx, new_my; - int x_needs_update = 0, y_needs_update = 0; - - new_mx = m_mouse1->read(); - new_my = m_mouse2->read(); - - /* see if it moved in the x coord */ - if (new_mx != last_mx) - { - int diff = new_mx - last_mx; - - /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; - - count_x += diff; - - last_mx = new_mx; - } - /* see if it moved in the y coord */ - if (new_my != last_my) - { - int diff = new_my - last_my; - - /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; - - count_y += diff; - - last_my = new_my; - } - - /* update any remaining count and then return */ - if (count_x) - { - if (count_x < 0) - { - count_x++; - m_mouse_bit_x = 0; - x_needs_update = 2; - } - else - { - count_x--; - m_mouse_bit_x = 1; - x_needs_update = 1; - } - } - else if (count_y) - { - if (count_y < 0) - { - count_y++; - m_mouse_bit_y = 1; - y_needs_update = 1; - } - else - { - count_y--; - m_mouse_bit_y = 0; - y_needs_update = 2; - } - } - - if (x_needs_update || y_needs_update) - /* assert Port B External Interrupt on the SCC */ - scc_mouse_irq(x_needs_update, y_needs_update ); -} - -/* ************************************************************************* - * SCSI - * *************************************************************************/ - -/* - -From http://www.mac.m68k-linux.org/devel/plushw.php - -The address of each register is computed as follows: - - $580drn - - where r represents the register number (from 0 through 7), - n determines whether it a read or write operation - (0 for reads, or 1 for writes), and - d determines whether the DACK signal to the NCR 5380 is asserted. - (0 for not asserted, 1 is for asserted) - -Here's an example of the address expressed in binary: - - 0101 1000 0000 00d0 0rrr 000n - -Note: Asserting the DACK signal applies only to write operations to - the output data register and read operations from the input - data register. - - Symbolic Memory - Location Location NCR 5380 Internal Register - - scsiWr+sODR+dackWr $580201 Output Data Register with DACK - scsiWr+sODR $580001 Output Data Register - scsiWr+sICR $580011 Initiator Command Register - scsiWr+sMR $580021 Mode Register - scsiWr+sTCR $580031 Target Command Register - scsiWr+sSER $580041 Select Enable Register - scsiWr+sDMAtx $580051 Start DMA Send - scsiWr+sTDMArx $580061 Start DMA Target Receive - scsiWr+sIDMArx $580071 Start DMA Initiator Receive - - scsiRd+sIDR+dackRd $580260 Current SCSI Data with DACK - scsiRd+sCDR $580000 Current SCSI Data - scsiRd+sICR $580010 Initiator Command Register - scsiRd+sMR $580020 Mode Registor - scsiRd+sTCR $580030 Target Command Register - scsiRd+sCSR $580040 Current SCSI Bus Status - scsiRd+sBSR $580050 Bus and Status Register - scsiRd+sIDR $580060 Input Data Register - scsiRd+sRESET $580070 Reset Parity/Interrupt - */ - -READ16_MEMBER ( mac_state::macplus_scsi_r ) -{ - int reg = (offset>>3) & 0xf; - -// logerror("macplus_scsi_r: offset %x mask %x\n", offset, mem_mask); - - if ((reg == 6) && (offset == 0x130)) - { - reg = R5380_CURDATA_DTACK; - } - - return m_ncr5380->ncr5380_read_reg(reg)<<8; -} - -READ32_MEMBER (mac_state::macii_scsi_drq_r) -{ - switch (mem_mask) - { - case 0xff000000: - return m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<24; - - case 0xffff0000: - return (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<24) | (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<16); - - case 0xffffffff: - return (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<24) | (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<16) | (m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK)<<8) | m_ncr5380->ncr5380_read_reg(R5380_CURDATA_DTACK); - - default: - logerror("macii_scsi_drq_r: unknown mem_mask %08x\n", mem_mask); - } - - return 0; -} - -WRITE32_MEMBER (mac_state::macii_scsi_drq_w) -{ - switch (mem_mask) - { - case 0xff000000: - m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>24); - break; - - case 0xffff0000: - m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>24); - m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>16); - break; - - case 0xffffffff: - m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>24); - m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>16); - m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data>>8); - m_ncr5380->ncr5380_write_reg(R5380_OUTDATA_DTACK, data&0xff); - break; - - default: - logerror("macii_scsi_drq_w: unknown mem_mask %08x\n", mem_mask); - break; - } -} - -WRITE16_MEMBER ( mac_state::macplus_scsi_w ) -{ - int reg = (offset>>3) & 0xf; - -// logerror("macplus_scsi_w: data %x offset %x mask %x\n", data, offset, mem_mask); - - if ((reg == 0) && (offset == 0x100)) - { - reg = R5380_OUTDATA_DTACK; - } - - m_ncr5380->ncr5380_write_reg(reg, data); -} - -WRITE16_MEMBER ( mac_state::macii_scsi_w ) -{ - int reg = (offset>>3) & 0xf; - -// logerror("macplus_scsi_w: data %x offset %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); - - if ((reg == 0) && (offset == 0x100)) - { - reg = R5380_OUTDATA_DTACK; - } - - m_ncr5380->ncr5380_write_reg(reg, data>>8); -} - -WRITE_LINE_MEMBER(mac_state::mac_scsi_irq) -{ -/* mac_state *mac = machine.driver_data(); - - if ((mac->m_scsiirq_enable) && ((mac->m_model == MODEL_MAC_SE) || (mac->m_model == MODEL_MAC_CLASSIC))) - { - mac->m_scsi_interrupt = state; - mac->field_interrupts(); - }*/ -} - -WRITE_LINE_MEMBER(mac_state::irq_539x_1_w) -{ - if (state) // make sure a CB1 transition occurs - { - m_via2->write_cb2(0); - m_via2->write_cb2(1); - } -} - -WRITE_LINE_MEMBER(mac_state::drq_539x_1_w) -{ - m_dafb_scsi1_drq = state; -} - -/* ************************************************************************* - * SCC - * - * Serial Communications Controller - * *************************************************************************/ - -void mac_state::scc_mouse_irq(int x, int y) -{ - scc8530_t *scc = machine().device("scc"); - static int lasty = 0; - static int lastx = 0; - - if (x && y) - { - if (m_last_was_x) { - scc->set_status(0x0a); - if(x == 2) { - if(lastx) { - scc->set_reg_a(0, 0x04); - m_mouse_bit_x = 0; - } else { - scc->set_reg_a(0, 0x0C); - m_mouse_bit_x = 1; - } - } else { - if(lastx) { - scc->set_reg_a(0, 0x04); - m_mouse_bit_x = 1; - } else { - scc->set_reg_a(0, 0x0C); - m_mouse_bit_x = 0; - } - } - lastx = !lastx; - } else { - scc->set_status(0x02); - if(y == 2) { - if(lasty) { - scc->set_reg_b(0, 0x04); - m_mouse_bit_y = 0; - } else { - scc->set_reg_b(0, 0x0C); - m_mouse_bit_y = 1; - } - } else { - if(lasty) { - scc->set_reg_b(0, 0x04); - m_mouse_bit_y = 1; - } else { - scc->set_reg_b(0, 0x0C); - m_mouse_bit_y = 0; - } - } - lasty = !lasty; - } - - m_last_was_x ^= 1; - } - else - { - if (x) { - scc->set_status(0x0a); - if(x == 2) { - if(lastx) { - scc->set_reg_a(0, 0x04); - m_mouse_bit_x = 0; - } else { - scc->set_reg_a(0, 0x0C); - m_mouse_bit_x = 1; - } - } else { - if(lastx) { - scc->set_reg_a(0, 0x04); - m_mouse_bit_x = 1; - } else { - scc->set_reg_a(0, 0x0C); - m_mouse_bit_x = 0; - } - } - lastx = !lastx; - } else { - scc->set_status(0x02); - if(y == 2) { - if(lasty) { - scc->set_reg_b(0, 0x04); - m_mouse_bit_y = 0; - } else { - scc->set_reg_b(0, 0x0C); - m_mouse_bit_y = 1; - } - } else { - if(lasty) { - scc->set_reg_b(0, 0x04); - m_mouse_bit_y = 1; - } else { - scc->set_reg_b(0, 0x0C); - m_mouse_bit_y = 0; - } - } - lasty = !lasty; - } - } - - this->set_scc_interrupt(1); -} - - - -READ16_MEMBER ( mac_state::mac_scc_r ) -{ - scc8530_t *scc = space.machine().device("scc"); - UINT16 result; - - result = scc->reg_r(space, offset); - return (result << 8) | result; -} - - - -WRITE16_MEMBER ( mac_state::mac_scc_w ) -{ - scc8530_t *scc = space.machine().device("scc"); - scc->reg_w(space, offset, data); -} - -WRITE16_MEMBER ( mac_state::mac_scc_2_w ) -{ - scc8530_t *scc = space.machine().device("scc"); - scc->reg_w(space, offset, data >> 8); -} - -/* ********************************** * - * IWM Code specific to the Mac Plus * - * ********************************** */ - -READ16_MEMBER ( mac_state::mac_iwm_r ) -{ - /* The first time this is called is in a floppy test, which goes from - * $400104 to $400126. After that, all access to the floppy goes through - * the disk driver in the MacOS - * - * I just thought this would be on interest to someone trying to further - * this driver along - */ - - UINT16 result = 0; - applefdc_base_device *fdc = space.machine().device("fdc"); - - result = fdc->read(offset >> 8); - - if (LOG_MAC_IWM) - printf("mac_iwm_r: offset=0x%08x mem_mask %04x = %02x (PC %x)\n", offset, mem_mask, result, space.device().safe_pc()); - - return (result << 8) | result; -} - -WRITE16_MEMBER ( mac_state::mac_iwm_w ) -{ - applefdc_base_device *fdc = space.machine().device("fdc"); - - if (LOG_MAC_IWM) - printf("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, space.device().safe_pc()); - - if (ACCESSING_BITS_0_7) - fdc->write((offset >> 8), data & 0xff); - else - fdc->write((offset >> 8), data>>8); -} - -WRITE_LINE_MEMBER(mac_state::mac_adb_via_out_cb2) -{ -// printf("VIA OUT CB2 = %x\n", state); - if (ADB_IS_EGRET) - { - m_egret->set_via_data(state & 1); - } - else if (ADB_IS_CUDA) - { - m_cuda->set_via_data(state & 1); - } - else - { - if (state) - m_adb_command |= 1; - else - m_adb_command &= ~1; - } -} - -/* ************************************************************************* - * VIA - * ************************************************************************* - * - * - * PORT A - * - * bit 7 R SCC Wait/Request - * bit 6 W Main/Alternate screen buffer select - * bit 5 W Floppy Disk Line Selection - * bit 4 W Overlay/Normal memory mapping - * bit 3 W Main/Alternate sound buffer - * bit 2-0 W Sound Volume - * - * - * PORT B - * - * bit 7 W Sound enable - * bit 6 R Video beam in display - * bit 5 (pre-ADB) R Mouse Y2 - * (ADB) W ADB ST1 - * bit 4 (pre-ADB) R Mouse X2 - * (ADB) W ADB ST0 - * bit 3 (pre-ADB) R Mouse button (active low) - * (ADB) R ADB INT - * bit 2 W Real time clock enable - * bit 1 W Real time clock data clock - * bit 0 RW Real time clock data - * - */ - -#define PA6 0x40 -#define PA4 0x10 -#define PA2 0x04 -#define PA1 0x02 - -READ8_MEMBER(mac_state::mac_via_in_a) -{ -// printf("VIA1 IN_A (PC %x)\n", m_maincpu->safe_pc()); - - switch (m_model) - { - case MODEL_MAC_CLASSIC: - case MODEL_MAC_II: - case MODEL_MAC_II_FDHD: - case MODEL_MAC_IIX: - case MODEL_MAC_POWERMAC_6100: - case MODEL_MAC_POWERMAC_7100: - case MODEL_MAC_POWERMAC_8100: - return 0x81; // bit 0 must be set on most Macs to avoid attempting to boot from AppleTalk - - case MODEL_MAC_SE30: - return 0x81 | PA6; - - case MODEL_MAC_LC: - case MODEL_MAC_LC_II: - case MODEL_MAC_IIVX: - return 0x81 | PA6 | PA4 | PA2; - - case MODEL_MAC_IICI: - return 0x81 | PA6 | PA2 | PA1; - - case MODEL_MAC_IISI: - return 0x81 | PA4 | PA2 | PA1; - - case MODEL_MAC_IIFX: - return 0x81 | PA6 | PA4 | PA1; - - case MODEL_MAC_IICX: - return 0x81 | PA6; - - case MODEL_MAC_PB140: // since the ASICs are different, these are allowed to "collide" - case MODEL_MAC_PB160: - case MODEL_MAC_CLASSIC_II: - case MODEL_MAC_QUADRA_800: - return 0x81 | PA4 | PA1; - - case MODEL_MAC_QUADRA_700: - return 0x81 | PA6; - - case MODEL_MAC_QUADRA_900: - return 0x81 | PA6 | PA4; - - case MODEL_MAC_COLOR_CLASSIC: - return 0x81 | PA1; - - default: - return 0x80; - } -} - -READ8_MEMBER(mac_state::mac_via_in_a_pmu) -{ -// printf("VIA1 IN_A (PC %x)\n", m_maincpu->safe_pc()); - - #if LOG_ADB -// printf("Read PM data %x\n", m_pm_data_recv); - #endif - return m_pm_data_recv; -} - -READ8_MEMBER(mac_state::mac_via_in_b) -{ - int val = 0; - /* video beam in display (! VBLANK && ! HBLANK basically) */ - if (machine().first_screen()) - { - if (machine().first_screen()->vpos() >= MAC_V_VIS) - val |= 0x40; - } - - if (ADB_IS_BITBANG_CLASS) - { - val |= m_adb_state<<4; - - if (!m_adb_irq_pending) - { - val |= 0x08; - } - - val |= m_rtc->data_r(); - } - else if (ADB_IS_EGRET) - { - val |= m_egret->get_xcvr_session()<<3; - } - else if (ADB_IS_CUDA) - { - val |= m_cuda->get_treq()<<3; - } - else - { - if (m_mouse_bit_y) /* Mouse Y2 */ - val |= 0x20; - if (m_mouse_bit_x) /* Mouse X2 */ - val |= 0x10; - if ((m_mouse0->read() & 0x01) == 0) - val |= 0x08; - - val |= m_rtc->data_r(); - } - -// printf("VIA1 IN_B = %02x (PC %x)\n", val, m_maincpu->safe_pc()); - - return val; -} - -READ8_MEMBER(mac_state::mac_via_in_b_via2pmu) -{ - int val = 0; - // TODO: is this valid for VIA2 PMU machines? - /* video beam in display (! VBLANK && ! HBLANK basically) */ - if (machine().first_screen()) - { - if (machine().first_screen()->vpos() >= MAC_V_VIS) - val |= 0x40; - } - -// printf("VIA1 IN_B = %02x (PC %x)\n", val, m_maincpu->safe_pc()); - - return val; -} - -READ8_MEMBER(mac_state::mac_via_in_b_pmu) -{ - int val = 0; -// printf("Read VIA B: PM_ACK %x\n", m_pm_ack); - val = 0x80 | 0x04 | m_pm_ack; // SCC wait/request (bit 2 must be set at 900c1a or startup tests always fail) - -// printf("VIA1 IN_B = %02x (PC %x)\n", val, m_maincpu->safe_pc()); - - return val; -} - -WRITE8_MEMBER(mac_state::mac_via_out_a) -{ - mac_sound_device *sound = machine().device("custom"); - device_t *fdc = machine().device("fdc"); -// printf("VIA1 OUT A: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - - set_scc_waitrequest((data & 0x80) >> 7); - m_screen_buffer = (data & 0x40) >> 6; - sony_set_sel_line(fdc,(data & 0x20) >> 5); - if (m_model == MODEL_MAC_SE) // on SE this selects which floppy drive (0 = upper, 1 = lower) - { - m_drive_select = ((data & 0x10) >> 4); - } - - if (m_model < MODEL_MAC_SE) // SE no longer has dual buffers - { - sound->set_sound_buffer((data & 0x08) >> 3); - } - - if (m_model < MODEL_MAC_II) - { - sound->set_volume(data & 0x07); - } - - /* Early Mac models had VIA A4 control overlaying. In the Mac SE (and - * possibly later models), overlay was set on reset, but cleared on the - * first access to the ROM. */ - if (m_model < MODEL_MAC_SE) - { - set_memory_overlay((data & 0x10) >> 4); - } -} - -WRITE8_MEMBER(mac_state::mac_via_out_a_pmu) -{ -// printf("VIA1 OUT A: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - - #if LOG_ADB -// printf("%02x to PM\n", data); - #endif - m_pm_data_send = data; - return; -} - -WRITE8_MEMBER(mac_state::mac_via_out_b) -{ - mac_sound_device *sound = machine().device("custom"); -// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - - if (AUDIO_IS_CLASSIC) - { - sound->enable_sound((data & 0x80) == 0); - } - - m_rtc->ce_w((data & 0x04)>>2); - m_rtc->data_w(data & 0x01); - m_rtc->clk_w((data >> 1) & 0x01); -} - -WRITE8_MEMBER(mac_state::mac_via_out_b_bbadb) -{ -// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - - // SE and Classic have SCSI enable/disable here - if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC)) - { - m_scsiirq_enable = (data & 0x40) ? 0 : 1; -// printf("VIAB & 0x40 = %02x, IRQ enable %d\n", data & 0x40, m_scsiirq_enable); - } - - if (m_model == MODEL_MAC_SE30) - { - // 0x40 = 0 means enable vblank on SE/30 - m_se30_vbl_enable = (data & 0x40) ? 0 : 1; - - // clear the interrupt if we disabled it - if (!m_se30_vbl_enable) - { - nubus_slot_interrupt(0xe, 0); - } - } - - mac_adb_newaction((data & 0x30) >> 4); - - m_rtc->ce_w((data & 0x04)>>2); - m_rtc->data_w(data & 0x01); - m_rtc->clk_w((data >> 1) & 0x01); -} - -WRITE8_MEMBER(mac_state::mac_via_out_b_egadb) -{ -// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - - #if LOG_ADB - printf("68K: New Egret state: SS %d VF %d (PC %x)\n", (data>>5)&1, (data>>4)&1, space.device().safe_pc()); - #endif - m_egret->set_via_full((data&0x10) ? 1 : 0); - m_egret->set_sys_session((data&0x20) ? 1 : 0); -} - -WRITE8_MEMBER(mac_state::mac_via_out_b_cdadb) -{ -// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - - #if LOG_ADB - printf("68K: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, space.device().safe_pc()); - #endif - m_cuda->set_byteack((data&0x10) ? 1 : 0); - m_cuda->set_tip((data&0x20) ? 1 : 0); -} - -WRITE8_MEMBER(mac_state::mac_via_out_b_via2pmu) -{ -// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); -} - -WRITE8_MEMBER(mac_state::mac_via_out_b_pmu) -{ -// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - - device_t *fdc = machine().device("fdc"); - - sony_set_sel_line(fdc,(data & 0x20) >> 5); - m_drive_select = ((data & 0x10) >> 4); - - if ((data & 1) && !(m_pm_req & 1)) - { - #if LOG_ADB - printf("PM: 68k dropping /REQ\n"); - #endif - - if (m_pm_state == 0) // do this in receive state only - { - m_pm_data_recv = 0xff; - m_pm_ack |= 2; - - // check if length byte matches - if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2))) - { - pmu_exec(); - #if LOG_ADB - printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]); - #endif - } - } - } - else if (!(data & 1) && (m_pm_req & 1)) - { - if (m_pm_state == 0) - { - #if LOG_ADB - printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send); - #endif - m_pm_ack &= ~2; // clear, we're waiting for more bytes - m_pm_cmd[m_pm_dptr++] = m_pm_data_send; - } - else // receiving, so this is different - { - m_pm_data_recv = m_pm_out[m_pm_sptr++]; - m_pm_slen--; - m_pm_ack |= 2; // raise ACK to indicate available byte - #if LOG_ADB - printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv); - #endif - - // another byte to send? - if (m_pm_slen) - { - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - } - else - { - m_pm_state = 0; // back to receive state - m_pmu_send_timer->adjust(attotime::never); - } - } - } - - m_pm_req = data & 1; -} - -WRITE_LINE_MEMBER(mac_state::mac_via_irq) -{ - /* interrupt the 68k (level 1) */ - set_via_interrupt(state); -} - -READ16_MEMBER ( mac_state::mac_via_r ) -{ - UINT16 data; - - offset >>= 8; - offset &= 0x0f; - - if (LOG_VIA) - logerror("mac_via_r: offset=0x%02x\n", offset); - data = m_via1->read(space, offset); - - m_maincpu->adjust_icount(m_via_cycles); - - return (data & 0xff) | (data << 8); -} - -WRITE16_MEMBER ( mac_state::mac_via_w ) -{ - offset >>= 8; - offset &= 0x0f; - - if (LOG_VIA) - logerror("mac_via_w: offset=0x%02x data=0x%08x\n", offset, data); - - if (ACCESSING_BITS_0_7) - m_via1->write(space, offset, data & 0xff); - if (ACCESSING_BITS_8_15) - m_via1->write(space, offset, (data >> 8) & 0xff); - - m_maincpu->adjust_icount(m_via_cycles); -} - -/* ************************************************************************* - * VIA 2 (on Mac IIs, PowerBooks > 100, and PowerMacs) - * *************************************************************************/ - -WRITE_LINE_MEMBER(mac_state::mac_via2_irq) -{ - set_via2_interrupt(state); -} - -READ16_MEMBER ( mac_state::mac_via2_r ) -{ - int data; - - offset >>= 8; - offset &= 0x0f; - - data = m_via2->read(space, offset); - - if (LOG_VIA) - logerror("mac_via2_r: offset=0x%02x = %02x (PC=%x)\n", offset*2, data, space.device().safe_pc()); - - return (data & 0xff) | (data << 8); -} - -WRITE16_MEMBER ( mac_state::mac_via2_w ) -{ - offset >>= 8; - offset &= 0x0f; - - if (LOG_VIA) - logerror("mac_via2_w: offset=%x data=0x%08x mask=%x (PC=%x)\n", offset, data, mem_mask, space.device().safe_pc()); - - if (ACCESSING_BITS_0_7) - m_via2->write(space, offset, data & 0xff); - if (ACCESSING_BITS_8_15) - m_via2->write(space, offset, (data >> 8) & 0xff); -} - - -READ8_MEMBER(mac_state::mac_via2_in_a) -{ - UINT8 result; - - if ((m_model == MODEL_MAC_QUADRA_700) || (m_model == MODEL_MAC_QUADRA_900) || (m_model == MODEL_MAC_QUADRA_950)) - { - result = 0x80 | m_nubus_irq_state; - } - else - { - result = 0xc0 | m_nubus_irq_state; - } - - return result; -} - -READ8_MEMBER(mac_state::mac_via2_in_a_pmu) -{ - return m_pm_data_recv; -} - -READ8_MEMBER(mac_state::mac_via2_in_b) -{ -// logerror("VIA2 IN B (PC %x)\n", m_maincpu->safe_pc()); - - if ((m_model == MODEL_MAC_LC) || (m_model == MODEL_MAC_LC_II) || (m_model == MODEL_MAC_CLASSIC_II)) - { - return 0x4f; - } - - if ((m_model == MODEL_MAC_SE30) || (m_model == MODEL_MAC_IIX)) - { - return 0x87; // bits 3 and 6 are tied low on SE/30 - } - - return 0xcf; // indicate no NuBus transaction error -} - -READ8_MEMBER(mac_state::mac_via2_in_b_pmu) -{ -// logerror("VIA2 IN B (PC %x)\n", m_maincpu->safe_pc()); - - if (m_pm_ack == 2) - { - return 0xcf; - } - else - { - return 0xcd; - } -} - -WRITE8_MEMBER(mac_state::mac_via2_out_a) -{ -// logerror("VIA2 OUT A: %02x (PC %x)\n", data, m_maincpu->safe_pc()); -} - -WRITE8_MEMBER(mac_state::mac_via2_out_a_pmu) -{ -// logerror("VIA2 OUT A: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - m_pm_data_send = data; -} - -WRITE8_MEMBER(mac_state::mac_via2_out_b) -{ -// logerror("VIA2 OUT B: %02x (PC %x)\n", data, m_maincpu->safe_pc()); - - // chain 60.15 Hz to VIA1 - m_via1->write_ca1(data>>7); - - if (m_model == MODEL_MAC_II) - { - m68000_base_device *m68k = downcast(m_maincpu.target()); - m68k->set_hmmu_enable((data & 0x8) ? M68K_HMMU_DISABLE : M68K_HMMU_ENABLE_II); - } -} - -WRITE8_MEMBER(mac_state::mac_via2_out_b_pmu) -{ -// logerror("VIA2 OUT B PMU: %02x (PC %x)\n", data, m_maincpu->pc()); - - if ((data & 4) && !(m_pm_req & 4)) - { - #if LOG_ADB - printf("PM: 68k dropping /REQ\n"); - #endif - - if (m_pm_state == 0) // do this in receive state only - { - m_pm_data_recv = 0xff; - m_pm_ack |= 2; - - // check if length byte matches - if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2))) - { - pmu_exec(); - #if LOG_ADB - printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]); - #endif - } - } - } - else if (!(data & 4) && (m_pm_req & 4)) - { - if (m_pm_state == 0) - { - #if LOG_ADB - printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send); - #endif - m_pm_ack &= ~2; // clear, we're waiting for more bytes - m_pm_cmd[m_pm_dptr++] = m_pm_data_send; - } - else // receiving, so this is different - { - m_pm_data_recv = m_pm_out[m_pm_sptr++]; - m_pm_slen--; - m_pm_ack |= 2; // raise ACK to indicate available byte - #if LOG_ADB - printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv); - #endif - - // another byte to send? - if (m_pm_slen) - { - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - } - else - { - m_pm_state = 0; // back to receive state - m_pmu_send_timer->adjust(attotime::never); - } - } - } - - m_pm_req = data & 4; -} - -// This signal is generated internally on RBV, V8, Sonora, VASP, Eagle, etc. -TIMER_CALLBACK_MEMBER(mac_state::mac_6015_tick) -{ - m_via1->write_ca1(0); - m_via1->write_ca1(1); -} - -/* ************************************************************************* - * Main - * *************************************************************************/ - -void mac_state::machine_start() -{ - if (has_adb()) - { - this->m_adb_timer = machine().scheduler().timer_alloc(FUNC(mac_adb_tick)); - this->m_adb_timer->adjust(attotime::never); - - // also allocate PMU timer - if (ADB_IS_PM_CLASS) - { - m_pmu_send_timer = machine().scheduler().timer_alloc(FUNC(mac_pmu_tick)); - this->m_adb_timer->adjust(attotime::never); - m_pmu_int_status = 0; - } - } - - if (machine().first_screen()) - { - this->m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_scanline_tick),this)); - this->m_scanline_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); - } - - m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_6015_tick),this)); - m_6015_timer->adjust(attotime::never); -} - -void mac_state::machine_reset() -{ - // stop 60.15 Hz timer - m_6015_timer->adjust(attotime::never); - - m_rbv_vbltime = 0; - - if (m_model >= MODEL_MAC_POWERMAC_6100 && m_model <= MODEL_MAC_POWERMAC_8100) - { - m_awacs->set_dma_base(m_maincpu->space(AS_PROGRAM), 0x10000, 0x12000); - } - - // start 60.15 Hz timer for most systems - if (((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIVI)) || (m_model >= MODEL_MAC_LC)) - { - m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); - } - - // we use the CPU clock divided by the VIA clock (783360 Hz) rounded up as - // an approximation for the right number of wait states. this yields good - // results - it's towards the end of the worst-case delay on h/w. - switch (m_maincpu->clock()) - { - case 7833600: // C7M on classic Macs - m_via_cycles = -10; - break; - - case 7833600*2: // "16 MHz" Macs - m_via_cycles = -30; - break; - - case 20000000: // 20 MHz Macs - m_via_cycles = -40; - break; - - case 25000000: // 25 MHz Macs - m_via_cycles = -50; - break; - - case 7833600*4: // 32 MHz Macs (these are C7M * 4 like IIvx) - m_via_cycles = -60; - break; - - case 33000000: // 33 MHz Macs ('040s) - m_via_cycles = -64; - break; - - case 40000000: // 40 MHz Macs - m_via_cycles = -80; - break; - - case 60000000: // 60 MHz PowerMac - m_via_cycles = -120; - break; - - case 66000000: // 66 MHz PowerMac - m_via_cycles = -128; - break; - - default: - fatalerror("mac: unknown clock\n"); - } - - // clear PMU response timer - if (ADB_IS_PM_CLASS) - { - this->m_adb_timer->adjust(attotime::never); - } - - // default to 32-bit mode on LC - if (m_model == MODEL_MAC_LC) - { - m68000_base_device *m68k = downcast(m_maincpu.target()); - m68k->set_hmmu_enable(M68K_HMMU_DISABLE); - } - - m_last_taken_interrupt = -1; - - /* setup the memory overlay */ - if (m_model < MODEL_MAC_POWERMAC_6100) // no overlay for PowerPC - { - m_overlay = -1; // insure no match - this->set_memory_overlay(1); - } - - /* setup videoram */ - this->m_screen_buffer = 1; - - /* setup 'classic' sound */ - if (machine().device("custom") != NULL) - { - machine().device("custom")->set_sound_buffer(0); - } - else if (MAC_HAS_VIA2) // prime CB1 for ASC and slot interrupts - { - m_via2_ca1_hack = 1; - m_via2->write_ca1(1); - m_via2->write_cb1(1); - } - - if (has_adb()) - { - this->adb_reset(); - } - - if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC)) - { - machine().device("custom")->set_sound_buffer(1); - - // classic will fail RAM test and try to boot appletalk if RAM is not all zero - memset(m_ram->pointer(), 0, m_ram->size()); - } - - m_scsi_interrupt = 0; - if ((m_maincpu->debug()) && (m_model < MODEL_MAC_POWERMAC_6100)) - { - m_maincpu->debug()->set_dasm_override(mac_dasm_override); - } - - m_drive_select = 0; - m_scsiirq_enable = 0; - m_via2_vbl = 0; - m_se30_vbl_enable = 0; - m_nubus_irq_state = 0xff; -#ifndef MAC_USE_EMULATED_KBD - m_keyboard_reply = 0; - m_kbd_comm = 0; - m_kbd_receive = 0; - m_kbd_shift_reg = 0; - m_kbd_shift_count = 0; -#endif - m_mouse_bit_x = m_mouse_bit_y = 0; - m_pm_data_send = m_pm_data_recv = m_pm_ack = m_pm_req = m_pm_dptr = 0; - m_pm_state = 0; - m_last_taken_interrupt = 0; -} - -WRITE_LINE_MEMBER(mac_state::cuda_reset_w) -{ - if ((state == ASSERT_LINE) && (m_model < MODEL_MAC_POWERMAC_6100)) - { - set_memory_overlay(0); - set_memory_overlay(1); - } - - m_maincpu->set_input_line(INPUT_LINE_RESET, state); -} - -void mac_state::mac_state_load() -{ - int overlay; - overlay = m_overlay; - if (m_model < MODEL_MAC_POWERMAC_6100) // no overlay for PowerPC - { - m_overlay = -1; - set_memory_overlay(overlay); - } -} - - -DIRECT_UPDATE_MEMBER(mac_state::overlay_opbaseoverride) -{ - if (m_overlay != -1) - { - if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100)) - { - if ((address >= 0x900000) && (address <= 0x9fffff)) - { - set_memory_overlay(0); // kill the overlay - } - } - else if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC)) - { - if ((address >= 0x400000) && (address <= 0x4fffff)) - { - set_memory_overlay(0); // kill the overlay - } - } - else if ((m_model == MODEL_MAC_LC) || (m_model == MODEL_MAC_LC_II) || (m_model == MODEL_MAC_CLASSIC_II) || (m_model == MODEL_MAC_COLOR_CLASSIC)) - { - if (((address >= 0xa00000) && (address <= 0xafffff)) || ((address >= 0x40a00000) && (address <= 0x40afffff))) - { - set_memory_overlay(0); // kill the overlay - } - } - else - { - if ((address >= 0x40000000) && (address <= 0x4fffffff)) - { - set_memory_overlay(0); // kill the overlay - } - } - } - - return address; -} - -READ32_MEMBER(mac_state::mac_read_id) -{ -// printf("Mac read ID reg @ PC=%x\n", m_maincpu->pc()); - - switch (m_model) - { - case MODEL_MAC_LC_III: - return 0xa55a0001; // 25 MHz LC III - - case MODEL_MAC_LC_III_PLUS: - return 0xa55a0003; // 33 MHz LC III+ - - case MODEL_MAC_LC_475: - return 0xa55a2221; - - case MODEL_MAC_LC_520: - return 0xa55a0100; - - case MODEL_MAC_LC_550: - return 0xa55a0101; - - case MODEL_MAC_LC_575: - return 0xa55a222e; - - case MODEL_MAC_POWERMAC_6100: - return 0xa55a3011; - - case MODEL_MAC_POWERMAC_7100: - return 0xa55a3012; - - case MODEL_MAC_POWERMAC_8100: - return 0xa55a3013; - - case MODEL_MAC_PBDUO_210: - return 0xa55a1004; - - case MODEL_MAC_PBDUO_230: - return 0xa55a1005; - - case MODEL_MAC_PBDUO_250: - return 0xa55a1006; - - case MODEL_MAC_QUADRA_605: - return 0xa55a2225; - - case MODEL_MAC_QUADRA_610: - case MODEL_MAC_QUADRA_650: - case MODEL_MAC_QUADRA_800: - return 0xa55a2bad; - - case MODEL_MAC_QUADRA_660AV: - case MODEL_MAC_QUADRA_840AV: - return 0xa55a2830; - - default: - return 0; - } -} - -void mac_state::mac_driver_init(model_t model) -{ - m_overlay = 1; - m_scsi_interrupt = 0; - m_model = model; - - if (model < MODEL_MAC_PORTABLE) - { - /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */ - mac_install_memory(0x600000, 0x6fffff, m_ram->size(), m_ram->pointer(), FALSE, "bank2"); - - /* set up ROM at 0x400000-0x4fffff (-0x5fffff for mac 128k/512k/512ke) */ - mac_install_memory(0x400000, (model >= MODEL_MAC_PLUS) ? 0x4fffff : 0x5fffff, - memregion("bootrom")->bytes(), memregion("bootrom")->base(), TRUE, "bank3"); - } - - m_overlay = -1; - if (m_model < MODEL_MAC_POWERMAC_6100) // no overlay for PowerPC - { - set_memory_overlay(1); - } - - memset(m_ram->pointer(), 0, m_ram->size()); - - if ((model == MODEL_MAC_SE) || (model == MODEL_MAC_CLASSIC) || (model == MODEL_MAC_CLASSIC_II) || (model == MODEL_MAC_LC) || (model == MODEL_MAC_COLOR_CLASSIC) || (model >= MODEL_MAC_LC_475 && model <= MODEL_MAC_LC_580) || - (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || (model == MODEL_MAC_LC_III_PLUS) || ((m_model >= MODEL_MAC_II) && (m_model <= MODEL_MAC_SE30)) || - (model == MODEL_MAC_PORTABLE) || (model == MODEL_MAC_PB100) || (model == MODEL_MAC_PB140) || (model == MODEL_MAC_PB160) || (model == MODEL_MAC_PBDUO_210) || (model >= MODEL_MAC_QUADRA_700 && model <= MODEL_MAC_QUADRA_800)) - { - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mac_state::overlay_opbaseoverride), this)); - } - - /* setup keyboard */ -#ifndef MAC_USE_EMULATED_KBD - keyboard_init(); - m_inquiry_timeout = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::inquiry_timeout_func),this)); -#else - /* clear key matrix for macadb */ - for (int i=0; i<7; i++) - { - m_key_matrix[i] = 0; - } -#endif - - /* save state stuff */ - machine().save().register_postload(save_prepost_delegate(FUNC(mac_state::mac_state_load), this)); -} - -#define MAC_DRIVER_INIT(label, model) \ -DRIVER_INIT_MEMBER(mac_state,label) \ -{ \ - mac_driver_init(model); \ -} - -MAC_DRIVER_INIT(mac128k512k, MODEL_MAC_128K512K) -MAC_DRIVER_INIT(mac512ke, MODEL_MAC_512KE) -MAC_DRIVER_INIT(macplus, MODEL_MAC_PLUS) -MAC_DRIVER_INIT(macse, MODEL_MAC_SE) -MAC_DRIVER_INIT(macclassic, MODEL_MAC_CLASSIC) -MAC_DRIVER_INIT(maclc, MODEL_MAC_LC) -MAC_DRIVER_INIT(maclc2, MODEL_MAC_LC_II) -MAC_DRIVER_INIT(maclc3, MODEL_MAC_LC_III) -MAC_DRIVER_INIT(maclc3plus, MODEL_MAC_LC_III_PLUS) -MAC_DRIVER_INIT(maciici, MODEL_MAC_IICI) -MAC_DRIVER_INIT(maciisi, MODEL_MAC_IISI) -MAC_DRIVER_INIT(macii, MODEL_MAC_II) -MAC_DRIVER_INIT(macse30, MODEL_MAC_SE30) -MAC_DRIVER_INIT(macclassic2, MODEL_MAC_CLASSIC_II) -MAC_DRIVER_INIT(maclrcclassic, MODEL_MAC_COLOR_CLASSIC) -MAC_DRIVER_INIT(macpm6100, MODEL_MAC_POWERMAC_6100) -MAC_DRIVER_INIT(macpm7100, MODEL_MAC_POWERMAC_7100) -MAC_DRIVER_INIT(macpm8100, MODEL_MAC_POWERMAC_8100) -MAC_DRIVER_INIT(macprtb, MODEL_MAC_PORTABLE) -MAC_DRIVER_INIT(macpb100, MODEL_MAC_PB100) -MAC_DRIVER_INIT(macpb140, MODEL_MAC_PB140) -MAC_DRIVER_INIT(macpb160, MODEL_MAC_PB160) -MAC_DRIVER_INIT(maciivx, MODEL_MAC_IIVX) -MAC_DRIVER_INIT(maciifx, MODEL_MAC_IIFX) -MAC_DRIVER_INIT(macpd210, MODEL_MAC_PBDUO_210) -MAC_DRIVER_INIT(macquadra700, MODEL_MAC_QUADRA_700) -MAC_DRIVER_INIT(maciicx, MODEL_MAC_IICX) -MAC_DRIVER_INIT(maciifdhd, MODEL_MAC_II_FDHD) -MAC_DRIVER_INIT(maciix, MODEL_MAC_IIX) -MAC_DRIVER_INIT(maclc520, MODEL_MAC_LC_520) - -void mac_state::nubus_slot_interrupt(UINT8 slot, UINT32 state) -{ - static const UINT8 masks[8] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80 }; - UINT8 mask = 0x3f; - - // quadra 700/900/950 use the top 2 bits of the interrupt register for ethernet and video - if ((m_model == MODEL_MAC_QUADRA_700) || (m_model == MODEL_MAC_QUADRA_900) || (m_model == MODEL_MAC_QUADRA_950)) - { - mask = 0xff; - } - - slot -= 9; - - if (state) - { - m_nubus_irq_state &= ~masks[slot]; - } - else - { - m_nubus_irq_state |= masks[slot]; - } - - if ((m_model != MODEL_MAC_IIFX) && (!INTS_RBV)) - { - if ((m_nubus_irq_state & mask) != mask) - { - // HACK: sometimes we miss an ack (possible misbehavior in the VIA?) - if (m_via2_ca1_hack == 0) - { - m_via2->write_ca1(1); - } - m_via2_ca1_hack = 0; - m_via2->write_ca1(0); - } - else - { - m_via2_ca1_hack = 1; - m_via2->write_ca1(1); - } - } - - if (INTS_RBV) - { - m_rbv_regs[2] &= ~0x38; - m_rbv_regs[2] |= (m_nubus_irq_state & 0x38); - rbv_recalc_irqs(); - } -} - -void mac_state::vblank_irq() -{ - /* handle ADB keyboard/mouse */ - if (has_adb()) - { - this->adb_vblank(); - } - -#ifndef MAC_USE_EMULATED_KBD - /* handle keyboard */ - if (m_kbd_comm == TRUE && m_kbd_receive == FALSE) - { - int keycode = scan_keyboard(); - - if (keycode != 0x7B) - { - /* if key pressed, send the code */ - - logerror("keyboard enquiry successful, keycode %X\n", keycode); - - m_inquiry_timeout->reset(); - kbd_shift_out(keycode); - } - } -#endif - - /* signal VBlank on CA1 input on the VIA */ - if ((m_model < MODEL_MAC_II) || (m_model == MODEL_MAC_PB140) || (m_model == MODEL_MAC_PB160) || (m_model == MODEL_MAC_QUADRA_700)) - { - ca1_data ^= 1; - m_via1->write_ca1(ca1_data); - } - - if (++irq_count == 60) - { - irq_count = 0; - - ca2_data ^= 1; - /* signal 1 Hz irq on CA2 input on the VIA */ - m_via1->write_ca2(ca2_data); - } - - // handle SE/30 vblank IRQ - if (m_model == MODEL_MAC_SE30) - { - if (m_se30_vbl_enable) - { - m_via2_vbl ^= 1; - if (!m_via2_vbl) - { - this->nubus_slot_interrupt(0xe, 1); - } - } - } -} - -TIMER_CALLBACK_MEMBER(mac_state::mac_scanline_tick) -{ - int scanline; - - if (machine().device("custom") != NULL) - { - machine().device("custom")->sh_updatebuffer(); - } - - if (m_rbv_vbltime > 0) - { - m_rbv_vbltime--; - - if (m_rbv_vbltime == 0) - { - m_rbv_regs[2] |= 0x40; - rbv_recalc_irqs(); - } - } - - scanline = machine().first_screen()->vpos(); - if (scanline == MAC_V_VIS) - vblank_irq(); - - /* check for mouse changes at 10 irqs per frame */ - if (m_model <= MODEL_MAC_PLUS) - { - if (!(scanline % 10)) - mouse_callback(); - } - - m_scanline_timer->adjust(machine().first_screen()->time_until_pos((scanline+1) % MAC_V_TOTAL, 0)); -} - -WRITE_LINE_MEMBER(mac_state::nubus_irq_9_w) -{ - nubus_slot_interrupt(9, state); -} - -WRITE_LINE_MEMBER(mac_state::nubus_irq_a_w) -{ - nubus_slot_interrupt(0xa, state); -} - -WRITE_LINE_MEMBER(mac_state::nubus_irq_b_w) -{ - nubus_slot_interrupt(0xb, state); -} - -WRITE_LINE_MEMBER(mac_state::nubus_irq_c_w) -{ - nubus_slot_interrupt(0xc, state); -} - -WRITE_LINE_MEMBER(mac_state::nubus_irq_d_w) -{ - nubus_slot_interrupt(0xd, state); -} - -WRITE_LINE_MEMBER(mac_state::nubus_irq_e_w) -{ - nubus_slot_interrupt(0xe, state); -} - -/* ************************************************************************* - * Trap Tracing - * - * This is debug code that will output diagnostics regarding OS traps called - * *************************************************************************/ - -const char *lookup_trap(UINT16 opcode) -{ - static const struct - { - UINT16 trap; - const char *name; - } traps[] = - { - { 0xA000, "_Open" }, - { 0xA001, "_Close" }, - { 0xA002, "_Read" }, - { 0xA003, "_Write" }, - { 0xA004, "_Control" }, - { 0xA005, "_Status" }, - { 0xA006, "_KillIO" }, - { 0xA007, "_GetVolInfo" }, - { 0xA008, "_Create" }, - { 0xA009, "_Delete" }, - { 0xA00A, "_OpenRF" }, - { 0xA00B, "_Rename" }, - { 0xA00C, "_GetFileInfo" }, - { 0xA00D, "_SetFileInfo" }, - { 0xA00E, "_UnmountVol" }, - { 0xA00F, "_MountVol" }, - { 0xA010, "_Allocate" }, - { 0xA011, "_GetEOF" }, - { 0xA012, "_SetEOF" }, - { 0xA013, "_FlushVol" }, - { 0xA014, "_GetVol" }, - { 0xA015, "_SetVol" }, - { 0xA016, "_FInitQueue" }, - { 0xA017, "_Eject" }, - { 0xA018, "_GetFPos" }, - { 0xA019, "_InitZone" }, - { 0xA01B, "_SetZone" }, - { 0xA01C, "_FreeMem" }, - { 0xA01F, "_DisposePtr" }, - { 0xA020, "_SetPtrSize" }, - { 0xA021, "_GetPtrSize" }, - { 0xA023, "_DisposeHandle" }, - { 0xA024, "_SetHandleSize" }, - { 0xA025, "_GetHandleSize" }, - { 0xA027, "_ReallocHandle" }, - { 0xA029, "_HLock" }, - { 0xA02A, "_HUnlock" }, - { 0xA02B, "_EmptyHandle" }, - { 0xA02C, "_InitApplZone" }, - { 0xA02D, "_SetApplLimit" }, - { 0xA02E, "_BlockMove" }, - { 0xA02F, "_PostEvent" }, - { 0xA030, "_OSEventAvail" }, - { 0xA031, "_GetOSEvent" }, - { 0xA032, "_FlushEvents" }, - { 0xA033, "_VInstall" }, - { 0xA034, "_VRemove" }, - { 0xA035, "_OffLine" }, - { 0xA036, "_MoreMasters" }, - { 0xA038, "_WriteParam" }, - { 0xA039, "_ReadDateTime" }, - { 0xA03A, "_SetDateTime" }, - { 0xA03B, "_Delay" }, - { 0xA03C, "_CmpString" }, - { 0xA03D, "_DrvrInstall" }, - { 0xA03E, "_DrvrRemove" }, - { 0xA03F, "_InitUtil" }, - { 0xA040, "_ResrvMem" }, - { 0xA041, "_SetFilLock" }, - { 0xA042, "_RstFilLock" }, - { 0xA043, "_SetFilType" }, - { 0xA044, "_SetFPos" }, - { 0xA045, "_FlushFile" }, - { 0xA047, "_SetTrapAddress" }, - { 0xA049, "_HPurge" }, - { 0xA04A, "_HNoPurge" }, - { 0xA04B, "_SetGrowZone" }, - { 0xA04C, "_CompactMem" }, - { 0xA04D, "_PurgeMem" }, - { 0xA04E, "_AddDrive" }, - { 0xA04F, "_RDrvrInstall" }, - { 0xA050, "_CompareString" }, - { 0xA051, "_ReadXPRam" }, - { 0xA052, "_WriteXPRam" }, - { 0xA054, "_UprString" }, - { 0xA055, "_StripAddress" }, - { 0xA056, "_LowerText" }, - { 0xA057, "_SetAppBase" }, - { 0xA058, "_InsTime" }, - { 0xA059, "_RmvTime" }, - { 0xA05A, "_PrimeTime" }, - { 0xA05B, "_PowerOff" }, - { 0xA05C, "_MemoryDispatch" }, - { 0xA05D, "_SwapMMUMode" }, - { 0xA05E, "_NMInstall" }, - { 0xA05F, "_NMRemove" }, - { 0xA060, "_FSDispatch" }, - { 0xA061, "_MaxBlock" }, - { 0xA063, "_MaxApplZone" }, - { 0xA064, "_MoveHHi" }, - { 0xA065, "_StackSpace" }, - { 0xA067, "_HSetRBit" }, - { 0xA068, "_HClrRBit" }, - { 0xA069, "_HGetState" }, - { 0xA06A, "_HSetState" }, - { 0xA06C, "_InitFS" }, - { 0xA06D, "_InitEvents" }, - { 0xA06E, "_SlotManager" }, - { 0xA06F, "_SlotVInstall" }, - { 0xA070, "_SlotVRemove" }, - { 0xA071, "_AttachVBL" }, - { 0xA072, "_DoVBLTask" }, - { 0xA075, "_SIntInstall" }, - { 0xA076, "_SIntRemove" }, - { 0xA077, "_CountADBs" }, - { 0xA078, "_GetIndADB" }, - { 0xA079, "_GetADBInfo" }, - { 0xA07A, "_SetADBInfo" }, - { 0xA07B, "_ADBReInit" }, - { 0xA07C, "_ADBOp" }, - { 0xA07D, "_GetDefaultStartup" }, - { 0xA07E, "_SetDefaultStartup" }, - { 0xA07F, "_InternalWait" }, - { 0xA080, "_GetVideoDefault" }, - { 0xA081, "_SetVideoDefault" }, - { 0xA082, "_DTInstall" }, - { 0xA083, "_SetOSDefault" }, - { 0xA084, "_GetOSDefault" }, - { 0xA085, "_PMgrOp" }, - { 0xA086, "_IOPInfoAccess" }, - { 0xA087, "_IOPMsgRequest" }, - { 0xA088, "_IOPMoveData" }, - { 0xA089, "_SCSIAtomic" }, - { 0xA08A, "_Sleep" }, - { 0xA08B, "_CommToolboxDispatch" }, - { 0xA08D, "_DebugUtil" }, - { 0xA08F, "_DeferUserFn" }, - { 0xA090, "_SysEnvirons" }, - { 0xA092, "_EgretDispatch" }, - { 0xA094, "_ServerDispatch" }, - { 0xA09E, "_PowerMgrDispatch" }, - { 0xA09F, "_PowerDispatch" }, - { 0xA0A4, "_HeapDispatch" }, - { 0xA0AC, "_FSMDispatch" }, - { 0xA0AE, "_VADBProc" }, - { 0xA0DD, "_PPC" }, - { 0xA0FE, "_TEFindWord" }, - { 0xA0FF, "_TEFindLine" }, - { 0xA11A, "_GetZone" }, - { 0xA11D, "_MaxMem" }, - { 0xA11E, "_NewPtr" }, - { 0xA122, "_NewHandle" }, - { 0xA126, "_HandleZone" }, - { 0xA128, "_RecoverHandle" }, - { 0xA12F, "_PPostEvent" }, - { 0xA146, "_GetTrapAddress" }, - { 0xA148, "_PtrZone" }, - { 0xA162, "_PurgeSpace" }, - { 0xA166, "_NewEmptyHandle" }, - { 0xA193, "_Microseconds" }, - { 0xA198, "_HWPriv" }, - { 0xA1AD, "_Gestalt" }, - { 0xA200, "_HOpen" }, - { 0xA207, "_HGetVInfo" }, - { 0xA208, "_HCreate" }, - { 0xA209, "_HDelete" }, - { 0xA20A, "_HOpenRF" }, - { 0xA20B, "_HRename" }, - { 0xA20C, "_HGetFileInfo" }, - { 0xA20D, "_HSetFileInfo" }, - { 0xA20E, "_HUnmountVol" }, - { 0xA210, "_AllocContig" }, - { 0xA214, "_HGetVol" }, - { 0xA215, "_HSetVol" }, - { 0xA22E, "_BlockMoveData" }, - { 0xA241, "_HSetFLock" }, - { 0xA242, "_HRstFLock" }, - { 0xA247, "_SetOSTrapAddress" }, - { 0xA256, "_StripText" }, - { 0xA260, "_HFSDispatch" }, - { 0xA285, "_IdleUpdate" }, - { 0xA28A, "_SlpQInstall" }, - { 0xA31E, "_NewPtrClear" }, - { 0xA322, "_NewHandleClear" }, - { 0xA346, "_GetOSTrapAddress" }, - { 0xA3AD, "_NewGestalt" }, - { 0xA456, "_UpperText" }, - { 0xA458, "_InsXTime" }, - { 0xA485, "_IdleState" }, - { 0xA48A, "_SlpQRemove" }, - { 0xA51E, "_NewPtrSys" }, - { 0xA522, "_NewHandleSys" }, - { 0xA562, "_PurgeSpaceSys" }, - { 0xA5AD, "_ReplaceGestalt" }, - { 0xA647, "_SetToolBoxTrapAddress" }, - { 0xA656, "_StripUpperText" }, - { 0xA685, "_SerialPower" }, - { 0xA71E, "_NewPtrSysClear" }, - { 0xA722, "_NewHandleSysClear" }, - { 0xA746, "_GetToolBoxTrapAddress" }, - { 0xA7AD, "_GetGestaltProcPtr" }, - { 0xA800, "_SoundDispatch" }, - { 0xA801, "_SndDisposeChannel" }, - { 0xA802, "_SndAddModifier" }, - { 0xA803, "_SndDoCommand" }, - { 0xA804, "_SndDoImmediate" }, - { 0xA805, "_SndPlay" }, - { 0xA806, "_SndControl" }, - { 0xA807, "_SndNewChannel" }, - { 0xA808, "_InitProcMenu" }, - { 0xA809, "_GetControlVariant" }, - { 0xA80A, "_GetWVariant" }, - { 0xA80B, "_PopUpMenuSelect" }, - { 0xA80C, "_RGetResource" }, - { 0xA811, "_TESelView" }, - { 0xA812, "_TEPinScroll" }, - { 0xA813, "_TEAutoView" }, - { 0xA814, "_SetFractEnable" }, - { 0xA815, "_SCSIDispatch" }, - { 0xA817, "_CopyMask" }, - { 0xA819, "_XMunger" }, - { 0xA81A, "_HOpenResFile" }, - { 0xA81B, "_HCreateResFile" }, - { 0xA81D, "_InvalMenuBar" }, - { 0xA821, "_MaxSizeRsrc" }, - { 0xA822, "_ResourceDispatch" }, - { 0xA823, "_AliasDispatch" }, - { 0xA824, "_HFSUtilDispatch" }, - { 0xA825, "_MenuDispatch" }, - { 0xA826, "_InsertMenuItem" }, - { 0xA827, "_HideDialogItem" }, - { 0xA828, "_ShowDialogItem" }, - { 0xA82A, "_ComponentDispatch" }, - { 0xA833, "_ScrnBitMap" }, - { 0xA834, "_SetFScaleDisable" }, - { 0xA835, "_FontMetrics" }, - { 0xA836, "_GetMaskTable" }, - { 0xA837, "_MeasureText" }, - { 0xA838, "_CalcMask" }, - { 0xA839, "_SeedFill" }, - { 0xA83A, "_ZoomWindow" }, - { 0xA83B, "_TrackBox" }, - { 0xA83C, "_TEGetOffset" }, - { 0xA83D, "_TEDispatch" }, - { 0xA83E, "_TEStyleNew" }, - { 0xA847, "_FracCos" }, - { 0xA848, "_FracSin" }, - { 0xA849, "_FracSqrt" }, - { 0xA84A, "_FracMul" }, - { 0xA84B, "_FracDiv" }, - { 0xA84D, "_FixDiv" }, - { 0xA84E, "_GetItemCmd" }, - { 0xA84F, "_SetItemCmd" }, - { 0xA850, "_InitCursor" }, - { 0xA851, "_SetCursor" }, - { 0xA852, "_HideCursor" }, - { 0xA853, "_ShowCursor" }, - { 0xA854, "_FontDispatch" }, - { 0xA855, "_ShieldCursor" }, - { 0xA856, "_ObscureCursor" }, - { 0xA858, "_BitAnd" }, - { 0xA859, "_BitXOr" }, - { 0xA85A, "_BitNot" }, - { 0xA85B, "_BitOr" }, - { 0xA85C, "_BitShift" }, - { 0xA85D, "_BitTst" }, - { 0xA85E, "_BitSet" }, - { 0xA85F, "_BitClr" }, - { 0xA860, "_WaitNextEvent" }, - { 0xA861, "_Random" }, - { 0xA862, "_ForeColor" }, - { 0xA863, "_BackColor" }, - { 0xA864, "_ColorBit" }, - { 0xA865, "_GetPixel" }, - { 0xA866, "_StuffHex" }, - { 0xA867, "_LongMul" }, - { 0xA868, "_FixMul" }, - { 0xA869, "_FixRatio" }, - { 0xA86A, "_HiWord" }, - { 0xA86B, "_LoWord" }, - { 0xA86C, "_FixRound" }, - { 0xA86D, "_InitPort" }, - { 0xA86E, "_InitGraf" }, - { 0xA86F, "_OpenPort" }, - { 0xA870, "_LocalToGlobal" }, - { 0xA871, "_GlobalToLocal" }, - { 0xA872, "_GrafDevice" }, - { 0xA873, "_SetPort" }, - { 0xA874, "_GetPort" }, - { 0xA875, "_SetPBits" }, - { 0xA876, "_PortSize" }, - { 0xA877, "_MovePortTo" }, - { 0xA878, "_SetOrigin" }, - { 0xA879, "_SetClip" }, - { 0xA87A, "_GetClip" }, - { 0xA87B, "_ClipRect" }, - { 0xA87C, "_BackPat" }, - { 0xA87D, "_ClosePort" }, - { 0xA87E, "_AddPt" }, - { 0xA87F, "_SubPt" }, - { 0xA880, "_SetPt" }, - { 0xA881, "_EqualPt" }, - { 0xA882, "_StdText" }, - { 0xA883, "_DrawChar" }, - { 0xA884, "_DrawString" }, - { 0xA885, "_DrawText" }, - { 0xA886, "_TextWidth" }, - { 0xA887, "_TextFont" }, - { 0xA888, "_TextFace" }, - { 0xA889, "_TextMode" }, - { 0xA88A, "_TextSize" }, - { 0xA88B, "_GetFontInfo" }, - { 0xA88C, "_StringWidth" }, - { 0xA88D, "_CharWidth" }, - { 0xA88E, "_SpaceExtra" }, - { 0xA88F, "_OSDispatch" }, - { 0xA890, "_StdLine" }, - { 0xA891, "_LineTo" }, - { 0xA892, "_Line" }, - { 0xA893, "_MoveTo" }, - { 0xA894, "_Move" }, - { 0xA895, "_ShutDown" }, - { 0xA896, "_HidePen" }, - { 0xA897, "_ShowPen" }, - { 0xA898, "_GetPenState" }, - { 0xA899, "_SetPenState" }, - { 0xA89A, "_GetPen" }, - { 0xA89B, "_PenSize" }, - { 0xA89C, "_PenMode" }, - { 0xA89D, "_PenPat" }, - { 0xA89E, "_PenNormal" }, - { 0xA89F, "_Moof" }, - { 0xA8A0, "_StdRect" }, - { 0xA8A1, "_FrameRect" }, - { 0xA8A2, "_PaintRect" }, - { 0xA8A3, "_EraseRect" }, - { 0xA8A4, "_InverRect" }, - { 0xA8A5, "_FillRect" }, - { 0xA8A6, "_EqualRect" }, - { 0xA8A7, "_SetRect" }, - { 0xA8A8, "_OffsetRect" }, - { 0xA8A9, "_InsetRect" }, - { 0xA8AA, "_SectRect" }, - { 0xA8AB, "_UnionRect" }, - { 0xA8AD, "_PtInRect" }, - { 0xA8AE, "_EmptyRect" }, - { 0xA8AF, "_StdRRect" }, - { 0xA8B0, "_FrameRoundRect" }, - { 0xA8B1, "_PaintRoundRect" }, - { 0xA8B2, "_EraseRoundRect" }, - { 0xA8B3, "_InverRoundRect" }, - { 0xA8B4, "_FillRoundRect" }, - { 0xA8B5, "_ScriptUtil" }, - { 0xA8B6, "_StdOval" }, - { 0xA8B7, "_FrameOval" }, - { 0xA8B8, "_PaintOval" }, - { 0xA8B9, "_EraseOval" }, - { 0xA8BA, "_InvertOval" }, - { 0xA8BB, "_FillOval" }, - { 0xA8BC, "_SlopeFromAngle" }, - { 0xA8BD, "_StdArc" }, - { 0xA8BE, "_FrameArc" }, - { 0xA8BF, "_PaintArc" }, - { 0xA8C0, "_EraseArc" }, - { 0xA8C1, "_InvertArc" }, - { 0xA8C2, "_FillArc" }, - { 0xA8C3, "_PtToAngle" }, - { 0xA8C4, "_AngleFromSlope" }, - { 0xA8C5, "_StdPoly" }, - { 0xA8C6, "_FramePoly" }, - { 0xA8C7, "_PaintPoly" }, - { 0xA8C8, "_ErasePoly" }, - { 0xA8C9, "_InvertPoly" }, - { 0xA8CA, "_FillPoly" }, - { 0xA8CB, "_OpenPoly" }, - { 0xA8CC, "_ClosePoly" }, - { 0xA8CD, "_KillPoly" }, - { 0xA8CE, "_OffsetPoly" }, - { 0xA8CF, "_PackBits" }, - { 0xA8D0, "_UnpackBits" }, - { 0xA8D1, "_StdRgn" }, - { 0xA8D2, "_FrameRgn" }, - { 0xA8D3, "_PaintRgn" }, - { 0xA8D4, "_EraseRgn" }, - { 0xA8D5, "_InverRgn" }, - { 0xA8D6, "_FillRgn" }, - { 0xA8D7, "_BitMapToRegion" }, - { 0xA8D8, "_NewRgn" }, - { 0xA8D9, "_DisposeRgn" }, - { 0xA8DA, "_OpenRgn" }, - { 0xA8DB, "_CloseRgn" }, - { 0xA8DC, "_CopyRgn" }, - { 0xA8DD, "_SetEmptyRgn" }, - { 0xA8DE, "_SetRecRgn" }, - { 0xA8DF, "_RectRgn" }, - { 0xA8E0, "_OffsetRgn" }, - { 0xA8E1, "_InsetRgn" }, - { 0xA8E2, "_EmptyRgn" }, - { 0xA8E3, "_EqualRgn" }, - { 0xA8E4, "_SectRgn" }, - { 0xA8E5, "_UnionRgn" }, - { 0xA8E6, "_DiffRgn" }, - { 0xA8E7, "_XOrRgn" }, - { 0xA8E8, "_PtInRgn" }, - { 0xA8E9, "_RectInRgn" }, - { 0xA8EA, "_SetStdProcs" }, - { 0xA8EB, "_StdBits" }, - { 0xA8EC, "_CopyBits" }, - { 0xA8ED, "_StdTxMeas" }, - { 0xA8EE, "_StdGetPic" }, - { 0xA8EF, "_ScrollRect" }, - { 0xA8F0, "_StdPutPic" }, - { 0xA8F1, "_StdComment" }, - { 0xA8F2, "_PicComment" }, - { 0xA8F3, "_OpenPicture" }, - { 0xA8F4, "_ClosePicture" }, - { 0xA8F5, "_KillPicture" }, - { 0xA8F6, "_DrawPicture" }, - { 0xA8F7, "_Layout" }, - { 0xA8F8, "_ScalePt" }, - { 0xA8F9, "_MapPt" }, - { 0xA8FA, "_MapRect" }, - { 0xA8FB, "_MapRgn" }, - { 0xA8FC, "_MapPoly" }, - { 0xA8FD, "_PrGlue" }, - { 0xA8FE, "_InitFonts" }, - { 0xA8FF, "_GetFName" }, - { 0xA900, "_GetFNum" }, - { 0xA901, "_FMSwapFont" }, - { 0xA902, "_RealFont" }, - { 0xA903, "_SetFontLock" }, - { 0xA904, "_DrawGrowIcon" }, - { 0xA905, "_DragGrayRgn" }, - { 0xA906, "_NewString" }, - { 0xA907, "_SetString" }, - { 0xA908, "_ShowHide" }, - { 0xA909, "_CalcVis" }, - { 0xA90A, "_CalcVBehind" }, - { 0xA90B, "_ClipAbove" }, - { 0xA90C, "_PaintOne" }, - { 0xA90D, "_PaintBehind" }, - { 0xA90E, "_SaveOld" }, - { 0xA90F, "_DrawNew" }, - { 0xA910, "_GetWMgrPort" }, - { 0xA911, "_CheckUpDate" }, - { 0xA912, "_InitWindows" }, - { 0xA913, "_NewWindow" }, - { 0xA914, "_DisposeWindow" }, - { 0xA915, "_ShowWindow" }, - { 0xA916, "_HideWindow" }, - { 0xA917, "_GetWRefCon" }, - { 0xA918, "_SetWRefCon" }, - { 0xA919, "_GetWTitle" }, - { 0xA91A, "_SetWTitle" }, - { 0xA91B, "_MoveWindow" }, - { 0xA91C, "_HiliteWindow" }, - { 0xA91D, "_SizeWindow" }, - { 0xA91E, "_TrackGoAway" }, - { 0xA91F, "_SelectWindow" }, - { 0xA920, "_BringToFront" }, - { 0xA921, "_SendBehind" }, - { 0xA922, "_BeginUpDate" }, - { 0xA923, "_EndUpDate" }, - { 0xA924, "_FrontWindow" }, - { 0xA925, "_DragWindow" }, - { 0xA926, "_DragTheRgn" }, - { 0xA927, "_InvalRgn" }, - { 0xA928, "_InvalRect" }, - { 0xA929, "_ValidRgn" }, - { 0xA92A, "_ValidRect" }, - { 0xA92B, "_GrowWindow" }, - { 0xA92C, "_FindWindow" }, - { 0xA92D, "_CloseWindow" }, - { 0xA92E, "_SetWindowPic" }, - { 0xA92F, "_GetWindowPic" }, - { 0xA930, "_InitMenus" }, - { 0xA931, "_NewMenu" }, - { 0xA932, "_DisposeMenu" }, - { 0xA933, "_AppendMenu" }, - { 0xA934, "_ClearMenuBar" }, - { 0xA935, "_InsertMenu" }, - { 0xA936, "_DeleteMenu" }, - { 0xA937, "_DrawMenuBar" }, - { 0xA938, "_HiliteMenu" }, - { 0xA939, "_EnableItem" }, - { 0xA93A, "_DisableItem" }, - { 0xA93B, "_GetMenuBar" }, - { 0xA93C, "_SetMenuBar" }, - { 0xA93D, "_MenuSelect" }, - { 0xA93E, "_MenuKey" }, - { 0xA93F, "_GetItmIcon" }, - { 0xA940, "_SetItmIcon" }, - { 0xA941, "_GetItmStyle" }, - { 0xA942, "_SetItmStyle" }, - { 0xA943, "_GetItmMark" }, - { 0xA944, "_SetItmMark" }, - { 0xA945, "_CheckItem" }, - { 0xA946, "_GetMenuItemText" }, - { 0xA947, "_SetMenuItemText" }, - { 0xA948, "_CalcMenuSize" }, - { 0xA949, "_GetMenuHandle" }, - { 0xA94A, "_SetMFlash" }, - { 0xA94B, "_PlotIcon" }, - { 0xA94C, "_FlashMenuBar" }, - { 0xA94D, "_AppendResMenu" }, - { 0xA94E, "_PinRect" }, - { 0xA94F, "_DeltaPoint" }, - { 0xA950, "_CountMItems" }, - { 0xA951, "_InsertResMenu" }, - { 0xA952, "_DeleteMenuItem" }, - { 0xA953, "_UpdtControl" }, - { 0xA954, "_NewControl" }, - { 0xA955, "_DisposeControl" }, - { 0xA956, "_KillControls" }, - { 0xA957, "_ShowControl" }, - { 0xA958, "_HideControl" }, - { 0xA959, "_MoveControl" }, - { 0xA95A, "_GetControlReference" }, - { 0xA95B, "_SetControlReference" }, - { 0xA95C, "_SizeControl" }, - { 0xA95D, "_HiliteControl" }, - { 0xA95E, "_GetControlTitle" }, - { 0xA95F, "_SetControlTitle" }, - { 0xA960, "_GetControlValue" }, - { 0xA961, "_GetControlMinimum" }, - { 0xA962, "_GetControlMaximum" }, - { 0xA963, "_SetControlValue" }, - { 0xA964, "_SetControlMinimum" }, - { 0xA965, "_SetControlMaximum" }, - { 0xA966, "_TestControl" }, - { 0xA967, "_DragControl" }, - { 0xA968, "_TrackControl" }, - { 0xA969, "_DrawControls" }, - { 0xA96A, "_GetControlAction" }, - { 0xA96B, "_SetControlAction" }, - { 0xA96C, "_FindControl" }, - { 0xA96E, "_Dequeue" }, - { 0xA96F, "_Enqueue" }, - { 0xA970, "_GetNextEvent" }, - { 0xA971, "_EventAvail" }, - { 0xA972, "_GetMouse" }, - { 0xA973, "_StillDown" }, - { 0xA974, "_Button" }, - { 0xA975, "_TickCount" }, - { 0xA976, "_GetKeys" }, - { 0xA977, "_WaitMouseUp" }, - { 0xA978, "_UpdtDialog" }, - { 0xA97B, "_InitDialogs" }, - { 0xA97C, "_GetNewDialog" }, - { 0xA97D, "_NewDialog" }, - { 0xA97E, "_SelectDialogItemText" }, - { 0xA97F, "_IsDialogEvent" }, - { 0xA980, "_DialogSelect" }, - { 0xA981, "_DrawDialog" }, - { 0xA982, "_CloseDialog" }, - { 0xA983, "_DisposeDialog" }, - { 0xA984, "_FindDialogItem" }, - { 0xA985, "_Alert" }, - { 0xA986, "_StopAlert" }, - { 0xA987, "_NoteAlert" }, - { 0xA988, "_CautionAlert" }, - { 0xA98B, "_ParamText" }, - { 0xA98C, "_ErrorSound" }, - { 0xA98D, "_GetDialogItem" }, - { 0xA98E, "_SetDialogItem" }, - { 0xA98F, "_SetDialogItemText" }, - { 0xA990, "_GetDialogItemText" }, - { 0xA991, "_ModalDialog" }, - { 0xA992, "_DetachResource" }, - { 0xA993, "_SetResPurge" }, - { 0xA994, "_CurResFile" }, - { 0xA995, "_InitResources" }, - { 0xA996, "_RsrcZoneInit" }, - { 0xA997, "_OpenResFile" }, - { 0xA998, "_UseResFile" }, - { 0xA999, "_UpdateResFile" }, - { 0xA99A, "_CloseResFile" }, - { 0xA99B, "_SetResLoad" }, - { 0xA99C, "_CountResources" }, - { 0xA99D, "_GetIndResource" }, - { 0xA99E, "_CountTypes" }, - { 0xA99F, "_GetIndType" }, - { 0xA9A0, "_GetResource" }, - { 0xA9A1, "_GetNamedResource" }, - { 0xA9A2, "_LoadResource" }, - { 0xA9A3, "_ReleaseResource" }, - { 0xA9A4, "_HomeResFile" }, - { 0xA9A5, "_SizeRsrc" }, - { 0xA9A6, "_GetResAttrs" }, - { 0xA9A7, "_SetResAttrs" }, - { 0xA9A8, "_GetResInfo" }, - { 0xA9A9, "_SetResInfo" }, - { 0xA9AA, "_ChangedResource" }, - { 0xA9AB, "_AddResource" }, - { 0xA9AC, "_AddReference" }, - { 0xA9AD, "_RmveResource" }, - { 0xA9AE, "_RmveReference" }, - { 0xA9AF, "_ResError" }, - { 0xA9B0, "_WriteResource" }, - { 0xA9B1, "_CreateResFile" }, - { 0xA9B2, "_SystemEvent" }, - { 0xA9B3, "_SystemClick" }, - { 0xA9B4, "_SystemTask" }, - { 0xA9B5, "_SystemMenu" }, - { 0xA9B6, "_OpenDeskAcc" }, - { 0xA9B7, "_CloseDeskAcc" }, - { 0xA9B8, "_GetPattern" }, - { 0xA9B9, "_GetCursor" }, - { 0xA9BA, "_GetString" }, - { 0xA9BB, "_GetIcon" }, - { 0xA9BC, "_GetPicture" }, - { 0xA9BD, "_GetNewWindow" }, - { 0xA9BE, "_GetNewControl" }, - { 0xA9BF, "_GetRMenu" }, - { 0xA9C0, "_GetNewMBar" }, - { 0xA9C1, "_UniqueID" }, - { 0xA9C2, "_SysEdit" }, - { 0xA9C3, "_KeyTranslate" }, - { 0xA9C4, "_OpenRFPerm" }, - { 0xA9C5, "_RsrcMapEntry" }, - { 0xA9C6, "_SecondsToDate" }, - { 0xA9C7, "_DateToSeconds" }, - { 0xA9C8, "_SysBeep" }, - { 0xA9C9, "_SysError" }, - { 0xA9CA, "_PutIcon" }, - { 0xA9CB, "_TEGetText" }, - { 0xA9CC, "_TEInit" }, - { 0xA9CD, "_TEDispose" }, - { 0xA9CE, "_TETextBox" }, - { 0xA9CF, "_TESetText" }, - { 0xA9D0, "_TECalText" }, - { 0xA9D1, "_TESetSelect" }, - { 0xA9D2, "_TENew" }, - { 0xA9D3, "_TEUpdate" }, - { 0xA9D4, "_TEClick" }, - { 0xA9D5, "_TECopy" }, - { 0xA9D6, "_TECut" }, - { 0xA9D7, "_TEDelete" }, - { 0xA9D8, "_TEActivate" }, - { 0xA9D9, "_TEDeactivate" }, - { 0xA9DA, "_TEIdle" }, - { 0xA9DB, "_TEPaste" }, - { 0xA9DC, "_TEKey" }, - { 0xA9DD, "_TEScroll" }, - { 0xA9DE, "_TEInsert" }, - { 0xA9DF, "_TESetAlignment" }, - { 0xA9E0, "_Munger" }, - { 0xA9E1, "_HandToHand" }, - { 0xA9E2, "_PtrToXHand" }, - { 0xA9E3, "_PtrToHand" }, - { 0xA9E4, "_HandAndHand" }, - { 0xA9E5, "_InitPack" }, - { 0xA9E6, "_InitAllPacks" }, - { 0xA9EF, "_PtrAndHand" }, - { 0xA9F0, "_LoadSeg" }, - { 0xA9F1, "_UnLoadSeg" }, - { 0xA9F2, "_Launch" }, - { 0xA9F3, "_Chain" }, - { 0xA9F4, "_ExitToShell" }, - { 0xA9F5, "_GetAppParms" }, - { 0xA9F6, "_GetResFileAttrs" }, - { 0xA9F7, "_SetResFileAttrs" }, - { 0xA9F8, "_MethodDispatch" }, - { 0xA9F9, "_InfoScrap" }, - { 0xA9FA, "_UnloadScrap" }, - { 0xA9FB, "_LoadScrap" }, - { 0xA9FC, "_ZeroScrap" }, - { 0xA9FD, "_GetScrap" }, - { 0xA9FE, "_PutScrap" }, - { 0xA9FF, "_Debugger" }, - { 0xAA00, "_OpenCPort" }, - { 0xAA01, "_InitCPort" }, - { 0xAA02, "_CloseCPort" }, - { 0xAA03, "_NewPixMap" }, - { 0xAA04, "_DisposePixMap" }, - { 0xAA05, "_CopyPixMap" }, - { 0xAA06, "_SetPortPix" }, - { 0xAA07, "_NewPixPat" }, - { 0xAA08, "_DisposePixPat" }, - { 0xAA09, "_CopyPixPat" }, - { 0xAA0A, "_PenPixPat" }, - { 0xAA0B, "_BackPixPat" }, - { 0xAA0C, "_GetPixPat" }, - { 0xAA0D, "_MakeRGBPat" }, - { 0xAA0E, "_FillCRect" }, - { 0xAA0F, "_FillCOval" }, - { 0xAA10, "_FillCRoundRect" }, - { 0xAA11, "_FillCArc" }, - { 0xAA12, "_FillCRgn" }, - { 0xAA13, "_FillCPoly" }, - { 0xAA14, "_RGBForeColor" }, - { 0xAA15, "_RGBBackColor" }, - { 0xAA16, "_SetCPixel" }, - { 0xAA17, "_GetCPixel" }, - { 0xAA18, "_GetCTable" }, - { 0xAA19, "_GetForeColor" }, - { 0xAA1A, "_GetBackColor" }, - { 0xAA1B, "_GetCCursor" }, - { 0xAA1C, "_SetCCursor" }, - { 0xAA1D, "_AllocCursor" }, - { 0xAA1E, "_GetCIcon" }, - { 0xAA1F, "_PlotCIcon" }, - { 0xAA20, "_OpenCPicture" }, - { 0xAA21, "_OpColor" }, - { 0xAA22, "_HiliteColor" }, - { 0xAA23, "_CharExtra" }, - { 0xAA24, "_DisposeCTable" }, - { 0xAA25, "_DisposeCIcon" }, - { 0xAA26, "_DisposeCCursor" }, - { 0xAA27, "_GetMaxDevice" }, - { 0xAA28, "_GetCTSeed" }, - { 0xAA29, "_GetDeviceList" }, - { 0xAA2A, "_GetMainDevice" }, - { 0xAA2B, "_GetNextDevice" }, - { 0xAA2C, "_TestDeviceAttribute" }, - { 0xAA2D, "_SetDeviceAttribute" }, - { 0xAA2E, "_InitGDevice" }, - { 0xAA2F, "_NewGDevice" }, - { 0xAA30, "_DisposeGDevice" }, - { 0xAA31, "_SetGDevice" }, - { 0xAA32, "_GetGDevice" }, - { 0xAA35, "_InvertColor" }, - { 0xAA36, "_RealColor" }, - { 0xAA37, "_GetSubTable" }, - { 0xAA38, "_UpdatePixMap" }, - { 0xAA39, "_MakeITable" }, - { 0xAA3A, "_AddSearch" }, - { 0xAA3B, "_AddComp" }, - { 0xAA3C, "_SetClientID" }, - { 0xAA3D, "_ProtectEntry" }, - { 0xAA3E, "_ReserveEntry" }, - { 0xAA3F, "_SetEntries" }, - { 0xAA40, "_QDError" }, - { 0xAA41, "_SetWinColor" }, - { 0xAA42, "_GetAuxWin" }, - { 0xAA43, "_SetControlColor" }, - { 0xAA44, "_GetAuxiliaryControlRecord" }, - { 0xAA45, "_NewCWindow" }, - { 0xAA46, "_GetNewCWindow" }, - { 0xAA47, "_SetDeskCPat" }, - { 0xAA48, "_GetCWMgrPort" }, - { 0xAA49, "_SaveEntries" }, - { 0xAA4A, "_RestoreEntries" }, - { 0xAA4B, "_NewColorDialog" }, - { 0xAA4C, "_DelSearch" }, - { 0xAA4D, "_DelComp" }, - { 0xAA4E, "_SetStdCProcs" }, - { 0xAA4F, "_CalcCMask" }, - { 0xAA50, "_SeedCFill" }, - { 0xAA51, "_CopyDeepMask" }, - { 0xAA52, "_HFSPinaforeDispatch" }, - { 0xAA53, "_DictionaryDispatch" }, - { 0xAA54, "_TextServicesDispatch" }, - { 0xAA56, "_SpeechRecognitionDispatch" }, - { 0xAA57, "_DockingDispatch" }, - { 0xAA59, "_MixedModeDispatch" }, - { 0xAA5A, "_CodeFragmentDispatch" }, - { 0xAA5C, "_OCEUtils" }, - { 0xAA5D, "_DigitalSignature" }, - { 0xAA5E, "_TBDispatch" }, - { 0xAA60, "_DeleteMCEntries" }, - { 0xAA61, "_GetMCInfo" }, - { 0xAA62, "_SetMCInfo" }, - { 0xAA63, "_DisposeMCInfo" }, - { 0xAA64, "_GetMCEntry" }, - { 0xAA65, "_SetMCEntries" }, - { 0xAA66, "_MenuChoice" }, - { 0xAA67, "_ModalDialogMenuSetup" }, - { 0xAA68, "_DialogDispatch" }, - { 0xAA73, "_ControlDispatch" }, - { 0xAA74, "_AppearanceDispatch" }, - { 0xAA7E, "_SysDebugDispatch" }, - { 0xAA80, "_AVLTreeDispatch" }, - { 0xAA81, "_FileMappingDispatch" }, - { 0xAA90, "_InitPalettes" }, - { 0xAA91, "_NewPalette" }, - { 0xAA92, "_GetNewPalette" }, - { 0xAA93, "_DisposePalette" }, - { 0xAA94, "_ActivatePalette" }, - { 0xAA95, "_NSetPalette" }, - { 0xAA96, "_GetPalette" }, - { 0xAA97, "_PmForeColor" }, - { 0xAA98, "_PmBackColor" }, - { 0xAA99, "_AnimateEntry" }, - { 0xAA9A, "_AnimatePalette" }, - { 0xAA9B, "_GetEntryColor" }, - { 0xAA9C, "_SetEntryColor" }, - { 0xAA9D, "_GetEntryUsage" }, - { 0xAA9E, "_SetEntryUsage" }, - { 0xAAA1, "_CopyPalette" }, - { 0xAAA2, "_PaletteDispatch" }, - { 0xAAA3, "_CodecDispatch" }, - { 0xAAA4, "_ALMDispatch" }, - { 0xAADB, "_CursorDeviceDispatch" }, - { 0xAAF2, "_ControlStripDispatch" }, - { 0xAAF3, "_ExpansionManager" }, - { 0xAB1D, "_QDExtensions" }, - { 0xABC3, "_NQDMisc" }, - { 0xABC9, "_IconDispatch" }, - { 0xABCA, "_DeviceLoop" }, - { 0xABEB, "_DisplayDispatch" }, - { 0xABED, "_DragDispatch" }, - { 0xABF1, "_GestaltValueDispatch" }, - { 0xABF2, "_ThreadDispatch" }, - { 0xABF6, "_CollectionMgr" }, - { 0xABF8, "_StdOpcodeProc" }, - { 0xABFC, "_TranslationDispatch" }, - { 0xABFF, "_DebugStr" } - }; - - int i; - - for (i = 0; i < ARRAY_LENGTH(traps); i++) - { - if (traps[i].trap == opcode) - return traps[i].name; - } - return NULL; -} - - - -static offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options) -{ - UINT16 opcode; - unsigned result = 0; - const char *trap; - - opcode = oprom[0]<<8 | oprom[1]; - if ((opcode & 0xF000) == 0xA000) - { - trap = lookup_trap(opcode); - if (trap) - { - strcpy(buffer, trap); - result = 2; - } - } - return result; -} - - - -#ifdef MAC_TRACETRAP -void mac_state::mac_tracetrap(const char *cpu_name_local, int addr, int trap) -{ - struct sonycscodeentry - { - int csCode; - const char *name; - }; - - static const sonycscodeentry cscodes[] = - { - { 1, "KillIO" }, - { 5, "VerifyDisk" }, - { 6, "FormatDisk" }, - { 7, "EjectDisk" }, - { 8, "SetTagBuffer" }, - { 9, "TrackCacheControl" }, - { 23, "ReturnDriveInfo" } - }; - - static const char *const scsisels[] = - { - "SCSIReset", /* $00 */ - "SCSIGet", /* $01 */ - "SCSISelect", /* $02 */ - "SCSICmd", /* $03 */ - "SCSIComplete", /* $04 */ - "SCSIRead", /* $05 */ - "SCSIWrite", /* $06 */ - NULL, /* $07 */ - "SCSIRBlind", /* $08 */ - "SCSIWBlind", /* $09 */ - "SCSIStat", /* $0A */ - "SCSISelAtn", /* $0B */ - "SCSIMsgIn", /* $0C */ - "SCSIMsgOut", /* $0D */ - }; - - int i, a0, a7, d0, d1; - int csCode, ioVRefNum, ioRefNum, ioCRefNum, ioCompletion, ioBuffer, ioReqCount, ioPosOffset; - char *s; - unsigned char *mem; - char buf[256]; - const char *trapstr; - - trapstr = lookup_trap(trap); - if (trapstr) - strcpy(buf, trapstr); - else - sprintf(buf, "Trap $%04x", trap); - - s = &buf[strlen(buf)]; - mem = mac_ram_ptr; - a0 = M68K_A0); - a7 = cpu_get_reg(M68K_A7); - d0 = cpu_get_reg(M68K_D0); - d1 = cpu_get_reg(M68K_D1); - - switch(trap) - { - case 0xa004: /* _Control */ - ioVRefNum = *((INT16*) (mem + a0 + 22)); - ioCRefNum = *((INT16*) (mem + a0 + 24)); - csCode = *((UINT16*) (mem + a0 + 26)); - sprintf(s->state().state_int(" ioVRefNum=%i ioCRefNum=%i csCode=%i", ioVRefNum, ioCRefNum, csCode); - - for (i = 0; i < ARRAY_LENGTH(cscodes); i++) - { - if (cscodes[i].csCode == csCode) - { - strcat(s, "="); - strcat(s, cscodes[i].name); - break; - } - } - break; - - case 0xa002: /* _Read */ - ioCompletion = (*((INT16*) (mem + a0 + 12)) << 16) + *((INT16*) (mem + a0 + 14)); - ioVRefNum = *((INT16*) (mem + a0 + 22)); - ioRefNum = *((INT16*) (mem + a0 + 24)); - ioBuffer = (*((INT16*) (mem + a0 + 32)) << 16) + *((INT16*) (mem + a0 + 34)); - ioReqCount = (*((INT16*) (mem + a0 + 36)) << 16) + *((INT16*) (mem + a0 + 38)); - ioPosOffset = (*((INT16*) (mem + a0 + 46)) << 16) + *((INT16*) (mem + a0 + 48)); - sprintf(s, " ioCompletion=0x%08x ioVRefNum=%i ioRefNum=%i ioBuffer=0x%08x ioReqCount=%i ioPosOffset=%i", - ioCompletion, ioVRefNum, ioRefNum, ioBuffer, ioReqCount, ioPosOffset); - break; - - case 0xa04e: /* _AddDrive */ - sprintf(s, " drvrRefNum=%i drvNum=%i qEl=0x%08x", (int) (INT16) d0, (int) (INT16) d1, a0); - break; - - case 0xa9a0: /* _GetResource */ - /* HACKHACK - the 'type' output assumes that the host is little endian - * since this is just trace code it isn't much of an issue - */ - sprintf(s, " type='%c%c%c%c' id=%i", (char) mem[a7+3], (char) mem[a7+2], - (char) mem[a7+5], (char) mem[a7+4], *((INT16*) (mem + a7))); - break; - - case 0xa815: /* _SCSIDispatch */ - i = *((UINT16*) (mem + a7)); - if (i < ARRAY_LENGTH(scsisels)) - if (scsisels[i]) - sprintf(s, " (%s)", scsisels[i]); - break; - } - - logerror("mac_trace_trap: %s at 0x%08x: %s\n",cpu_name_local, addr, buf); -} -#endif diff --git a/src/mess/machine/macadb.c b/src/mess/machine/macadb.c deleted file mode 100644 index 76a8a010b57..00000000000 --- a/src/mess/machine/macadb.c +++ /dev/null @@ -1,1430 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - macadb.c - handles various aspects of ADB on the Mac. - -***************************************************************************/ - -#include "emu.h" -#include "includes/mac.h" - -#define LOG_ADB 0 -#define LOG_ADB_MCU_CMD 0 -#define LOG_ADB_TALK_LISTEN 0 - -// ADB states -#define ADB_STATE_NEW_COMMAND (0) -#define ADB_STATE_XFER_EVEN (1) -#define ADB_STATE_XFER_ODD (2) -#define ADB_STATE_IDLE (3) -#define ADB_STATE_NOTINIT (4) - -// ADB commands -#define ADB_CMD_RESET (0) -#define ADB_CMD_FLUSH (1) - -// ADB line states -enum -{ - // receive states - LST_IDLE = 0, - LST_ATTENTION, - LST_BIT0, - LST_BIT1, - LST_BIT2, - LST_BIT3, - LST_BIT4, - LST_BIT5, - LST_BIT6, - LST_BIT7, - LST_TSTOP, - LST_WAITT1T, - LST_RCVSTARTBIT, - LST_SRQNODATA, - - // send states - LST_TSTOPSTART, - LST_TSTOPSTARTa, - LST_STARTBIT, - LST_SENDBIT0, - LST_SENDBIT0a, - LST_SENDBIT1, - LST_SENDBIT1a, - LST_SENDBIT2, - LST_SENDBIT2a, - LST_SENDBIT3, - LST_SENDBIT3a, - LST_SENDBIT4, - LST_SENDBIT4a, - LST_SENDBIT5, - LST_SENDBIT5a, - LST_SENDBIT6, - LST_SENDBIT6a, - LST_SENDBIT7, - LST_SENDBIT7a, - LST_SENDSTOP, - LST_SENDSTOPa -}; - -/* ************************************************************************* - * High-level ADB primitives used by all lower-level implementations - * *************************************************************************/ - -#if LOG_ADB -static const char *const adb_statenames[4] = { "NEW", "EVEN", "ODD", "IDLE" }; -#endif - -int mac_state::adb_pollkbd(int update) -{ - int i, j, keybuf, report, codes[2], result; - ioport_port *ports[6] = { m_key0, m_key1, m_key2, m_key3, m_key4, m_key5 }; - - codes[0] = codes[1] = 0xff; // key up - report = result = 0; - - for (i = 0; i < 6; i++) - { - keybuf = ports[i]->read(); - - // any changes in this row? - if ((keybuf != m_key_matrix[i]) && (report < 2)) - { - // check each column bit - for (j=0; j<16; j++) - { - if (((keybuf ^ m_key_matrix[i]) >> j) & 1) - { - // update m_key_matrix - if (update) - { - m_key_matrix[i] = (m_key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j)); - } - - codes[report] = (i<<4)|j; - - // key up? - if (!(keybuf & (1 << j))) - { - codes[report] |= 0x80; - } - - // update modifier state - if (update) - { - if (((i<<4)|j) == 0x39) - { - if (codes[report] & 0x80) - { - m_adb_modifiers &= ~0x20; - } - else - { - m_adb_modifiers |= 0x20; - } - } - if (((i<<4)|j) == 0x36) - { - if (codes[report] & 0x80) - { - m_adb_modifiers &= ~0x8; - } - else - { - m_adb_modifiers |= 0x08; - } - } - if (((i<<4)|j) == 0x38) - { - if (codes[report] & 0x80) - { - m_adb_modifiers &= ~0x4; - } - else - { - m_adb_modifiers |= 0x04; - } - } - if (((i<<4)|j) == 0x3a) - { - if (codes[report] & 0x80) - { - m_adb_modifiers &= ~0x2; - } - else - { - m_adb_modifiers |= 0x02; - } - } - if (((i<<4)|j) == 0x37) - { - if (codes[report] & 0x80) - { - m_adb_modifiers &= ~0x1; - } - else - { - m_adb_modifiers |= 0x01; - } - } - } - - // we run out of keys we can track? - report++; - if (report == 2) - { - break; - } - } - } - - // we run out of keys we can track? - if (report == 2) - { - break; - } - } - } - -// printf("ADB keyboard: update %d keys %02x %02x\n", update, codes[0], codes[1]); - - // figure out if there was a change - if ((m_adb_currentkeys[0] != codes[0]) || (m_adb_currentkeys[1] != codes[1])) - { - result = 1; - - // if we want to update the current read, do so - if (update) - { - if(m_adb_currentkeys[0] != codes[0]) { - m_adb_keybuf[m_adb_keybuf_end] = codes[0]; - m_adb_keybuf_end = (m_adb_keybuf_end+1) % kADBKeyBufSize; - } - if(m_adb_currentkeys[1] != codes[1]) { - m_adb_keybuf[m_adb_keybuf_end] = codes[1]; - m_adb_keybuf_end = (m_adb_keybuf_end+1) % kADBKeyBufSize; - } - m_adb_currentkeys[0] = codes[0]; - m_adb_currentkeys[1] = codes[1]; - } - } - - return result; -} - -int mac_state::adb_pollmouse() -{ - int NewX, NewY, NewButton; - - if (!m_adb_mouse_initialized) - { - return 0; - } - - NewButton = m_mouse0->read() & 0x01; - NewX = m_mouse2->read(); - NewY = m_mouse1->read(); - - if ((NewX != m_adb_lastmousex) || (NewY != m_adb_lastmousey) || (NewButton != m_adb_lastbutton)) - { - return 1; - } - - return 0; -} - -void mac_state::adb_accummouse( UINT8 *MouseX, UINT8 *MouseY ) -{ - int MouseCountX = 0, MouseCountY = 0; - int NewX, NewY; - - NewX = ioport("MOUSE2")->read(); - NewY = ioport("MOUSE1")->read(); - - /* see if it moved in the x coord */ - if (NewX != m_adb_lastmousex) - { - int diff = NewX - m_adb_lastmousex; - - /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; - - MouseCountX += diff; - m_adb_lastmousex = NewX; - } - - /* see if it moved in the y coord */ - if (NewY != m_adb_lastmousey) - { - int diff = NewY - m_adb_lastmousey; - - /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; - - MouseCountY += diff; - m_adb_lastmousey = NewY; - } - - m_adb_lastbutton = m_mouse0->read() & 0x01; - - *MouseX = (UINT8)MouseCountX; - *MouseY = (UINT8)MouseCountY; -} - -void mac_state::adb_talk() -{ - int addr, reg; - - addr = (m_adb_command>>4); - reg = (m_adb_command & 3); - -// printf("Mac sent %x (cmd %d addr %d reg %d mr %d kr %d)\n", mac->m_adb_command, (mac->m_adb_command>>2)&3, addr, reg, m_adb_mouseaddr, m_adb_keybaddr); - - if (m_adb_waiting_cmd) - { - switch ((m_adb_command>>2)&3) - { - case 0: - case 1: - switch (reg) - { - case ADB_CMD_RESET: - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("ADB RESET: reg %x address %x\n", reg, addr); - #endif - m_adb_direction = 0; - m_adb_send = 0; - break; - - case ADB_CMD_FLUSH: - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("ADB FLUSH: reg %x address %x\n", reg, addr); - #endif - - m_adb_direction = 0; - m_adb_send = 0; - break; - - default: // reserved/unused - break; - } - break; - - case 2: // listen - m_adb_datasize = 0; - if ((addr == m_adb_keybaddr) || (addr == m_adb_mouseaddr)) - { - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("ADB LISTEN: reg %x address %x\n", reg, addr); - #endif - m_adb_direction = 1; // input from Mac - m_adb_command = 0; - m_adb_listenreg = reg; - m_adb_listenaddr = addr; - if ((ADB_IS_EGRET) || (ADB_IS_CUDA)) - { - m_adb_stream_ptr = 0; - memset(m_adb_buffer, 0, sizeof(m_adb_buffer)); - } - } - else - { - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("ADB LISTEN to unknown device, timing out\n"); - #endif - m_adb_direction = 0; - } - break; - - case 3: // talk - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("ADB TALK: reg %x address %x (K %x M %x)\n", reg, addr, m_adb_keybaddr, m_adb_mouseaddr); - #endif - - // keep track of what device the Mac last TALKed to - m_adb_last_talk = addr; - - m_adb_direction = 0; // output to Mac - if (addr == m_adb_mouseaddr) - { - UINT8 mouseX, mouseY; - - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("Talking to mouse, register %x\n", reg); - #endif - - switch (reg) - { - // read mouse - case 0: - if (m_adb_srq_switch) - { - m_adb_srq_switch = 0; - mouseX = mouseY = 0; - } - else - { - this->adb_accummouse(&mouseX, &mouseY); - } - m_adb_buffer[0] = (m_adb_lastbutton & 0x01) ? 0x00 : 0x80; - m_adb_buffer[0] |= mouseX & 0x7f; - m_adb_buffer[1] = mouseY & 0x7f; - m_adb_datasize = 2; - break; - - // get ID/handler - case 3: - m_adb_buffer[0] = 0x60 | (m_adb_mouseaddr&0xf); // SRQ enable, no exceptional event - m_adb_buffer[1] = 0x01; // handler 1 - m_adb_datasize = 2; - - m_adb_mouse_initialized = 1; - break; - - default: - break; - } - - if (adb_pollkbd(0)) - { - m_adb_srqflag = true; - } - } - else if (addr == m_adb_keybaddr) - { - int kbd_has_data = 1; - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("Talking to keyboard, register %x\n", reg); - #endif - - switch (reg) - { - // read keyboard - case 0: - if (m_adb_srq_switch) - { - m_adb_srq_switch = 0; - } - else - { - kbd_has_data = this->adb_pollkbd(1); - } - -/* if (m_adb_currentkeys[0] != 0xff) - { - printf("Keys[0] = %02x\n", m_adb_currentkeys[0]); - } - if (m_adb_currentkeys[1] != 0xff) - { - printf("Keys[1] = %02x\n", m_adb_currentkeys[1]); - }*/ - - if(kbd_has_data) - { - if(m_adb_keybuf_start == m_adb_keybuf_end) - { - // printf("%s: buffer empty\n", __func__); - m_adb_buffer[0] = 0xff; - m_adb_buffer[1] = 0xff; - } - else - { - m_adb_buffer[1] = m_adb_keybuf[m_adb_keybuf_start]; - m_adb_keybuf_start = (m_adb_keybuf_start+1) % kADBKeyBufSize; - if(m_adb_keybuf_start != m_adb_keybuf_end) - { - m_adb_buffer[0] = m_adb_keybuf[m_adb_keybuf_start]; - m_adb_keybuf_start = (m_adb_keybuf_start+1) % kADBKeyBufSize; - } - else - { - m_adb_buffer[0] = 0xff; - } - } - m_adb_datasize = 2; - } - break; - - // read modifier keys - case 2: - { - this->adb_pollkbd(1); - m_adb_buffer[0] = m_adb_modifiers; - m_adb_buffer[1] = 0xff; - m_adb_datasize = 2; - } - break; - - // get ID/handler - case 3: - m_adb_buffer[0] = 0x60 | (m_adb_keybaddr&0xf); // SRQ enable, no exceptional event - m_adb_buffer[1] = 0x01; // handler 1 - m_adb_datasize = 2; - - m_adb_keybinitialized = 1; - break; - - default: - break; - } - - if (adb_pollmouse()) - { - m_adb_srqflag = true; - } - } - else - { - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("ADB: talking to unconnected device %d (K %d M %d)\n", addr, m_adb_keybaddr, m_adb_mouseaddr); - #endif - m_adb_buffer[0] = m_adb_buffer[1] = 0; - m_adb_datasize = 0; - - if ((adb_pollkbd(0)) || (adb_pollmouse())) - { - m_adb_srqflag = true; - } - } - break; - } - - m_adb_waiting_cmd = 0; - } - else - { - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("Got LISTEN data %02x %02x for device %x reg %x\n", m_adb_command, m_adb_buffer[1], m_adb_listenaddr, m_adb_listenreg); - #endif - - m_adb_direction = 0; - - if (m_adb_listenaddr == m_adb_mouseaddr) - { - if ((m_adb_listenreg == 3) && (m_adb_command > 0) && (m_adb_command < 16)) - { - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("MOUSE: moving to address %x\n", m_adb_command); - #endif - m_adb_mouseaddr = m_adb_command&0x0f; - } - } - else if (m_adb_listenaddr == m_adb_keybaddr) - { - if ((m_adb_listenreg == 3) && (m_adb_command > 0) && (m_adb_command < 16)) - { - #if LOG_ADB || LOG_ADB_TALK_LISTEN - printf("KEYBOARD: moving to address %x\n", m_adb_command); - #endif - m_adb_keybaddr = m_adb_command&0x0f; - } - } - } -} - -TIMER_CALLBACK(mac_adb_tick) -{ - mac_state *mac = machine.driver_data(); - - if ((ADB_IS_EGRET_NONCLASS) || (ADB_IS_CUDA_NONCLASS)) - { - switch (mac->m_adb_linestate) - { - case LST_SRQNODATA: - mac->set_adb_line(ASSERT_LINE); - mac->m_adb_linestate = LST_IDLE; - break; - - case LST_TSTOPSTART: - mac->set_adb_line(ASSERT_LINE); - mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); - mac->m_adb_linestate++; - break; - - case LST_TSTOPSTARTa: - mac->set_adb_line(CLEAR_LINE); - mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); - mac->m_adb_linestate++; - break; - - case LST_STARTBIT: - mac->set_adb_line(ASSERT_LINE); - mac->m_adb_timer->adjust(attotime::from_ticks(105, 1000000)); - mac->m_adb_linestate++; - break; - - case LST_SENDBIT0: - case LST_SENDBIT1: - case LST_SENDBIT2: - case LST_SENDBIT3: - case LST_SENDBIT4: - case LST_SENDBIT5: - case LST_SENDBIT6: - case LST_SENDBIT7: - mac->set_adb_line(CLEAR_LINE); - if (mac->m_adb_buffer[mac->m_adb_stream_ptr] & 0x80) - { -// printf("1 "); - mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); - } - else - { -// printf("0 "); - mac->m_adb_timer->adjust(attotime::from_ticks(105, 1000000)); - } - mac->m_adb_linestate++; - break; - - case LST_SENDBIT0a: - case LST_SENDBIT1a: - case LST_SENDBIT2a: - case LST_SENDBIT3a: - case LST_SENDBIT4a: - case LST_SENDBIT5a: - case LST_SENDBIT6a: - mac->set_adb_line(ASSERT_LINE); - if (mac->m_adb_buffer[mac->m_adb_stream_ptr] & 0x80) - { - mac->m_adb_timer->adjust(attotime::from_ticks(105, 1000000)); - } - else - { - mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); - } - mac->m_adb_buffer[mac->m_adb_stream_ptr] <<= 1; - mac->m_adb_linestate++; - break; - - case LST_SENDBIT7a: - mac->set_adb_line(ASSERT_LINE); - if (mac->m_adb_buffer[mac->m_adb_stream_ptr] & 0x80) - { -// printf(" "); - mac->m_adb_timer->adjust(attotime::from_ticks(105, 1000000)); - } - else - { -// printf(" "); - mac->m_adb_timer->adjust(attotime::from_ticks(57, 1000000)); - } - - mac->m_adb_stream_ptr++; - if (mac->m_adb_stream_ptr == mac->m_adb_datasize) - { - mac->m_adb_linestate++; - } - else - { - mac->m_adb_linestate = LST_SENDBIT0; - } - break; - - case LST_SENDSTOP: - mac->set_adb_line(CLEAR_LINE); - mac->m_adb_timer->adjust(attotime::from_ticks((57*2), 1000000)); - mac->m_adb_linestate++; - break; - - case LST_SENDSTOPa: - mac->set_adb_line(ASSERT_LINE); - mac->m_adb_timer->adjust(attotime::never); - mac->m_adb_linestate = LST_IDLE; - break; - } - } - else - { - // do one clock transition on CB1 to advance the VIA shifter - mac->m_adb_extclock ^= 1; - mac->m_via1->write_cb1(mac->m_adb_extclock); - - if (mac->m_adb_direction) - { - mac->m_adb_command <<= 1; - } - else - { - mac->m_via1->write_cb2((mac->m_adb_send & 0x80)>>7); - mac->m_adb_send <<= 1; - } - - mac->m_adb_extclock ^= 1; - mac->m_via1->write_cb1(mac->m_adb_extclock); - - mac->m_adb_timer_ticks--; - if (!mac->m_adb_timer_ticks) - { - mac->m_adb_timer->adjust(attotime::never); - - if ((mac->m_adb_direction) && (ADB_IS_BITBANG)) - { - mac->adb_talk(); - if((mac->m_adb_last_talk == 2) && mac->m_adb_datasize) { - mac->m_adb_timer_ticks = 8; - mac->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - } - } - } - else - { - mac->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - } - } -} - -void mac_state::mac_adb_newaction(int state) -{ - if (state != m_adb_state) - { - #if LOG_ADB - printf("New ADB state: %s\n", adb_statenames[state]); - #endif - - m_adb_state = state; - m_adb_timer_ticks = 8; - - switch (state) - { - case ADB_STATE_NEW_COMMAND: - m_adb_command = m_adb_send = 0; - m_adb_direction = 1; // Mac is shifting us a command - m_adb_waiting_cmd = 1; // we're going to get a command - m_adb_irq_pending = 0; - m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - break; - - case ADB_STATE_XFER_EVEN: - case ADB_STATE_XFER_ODD: - if (m_adb_datasize > 0) - { - int i; - - // is something trying to send to the Mac? - if (m_adb_direction == 0) - { - // set up the byte - m_adb_send = m_adb_buffer[0]; - m_adb_datasize--; - - // move down the rest of the buffer, if any - for (i = 0; i < m_adb_datasize; i++) - { - m_adb_buffer[i] = m_adb_buffer[i+1]; - } - } - - } - else - { - m_adb_send = 0; - m_adb_irq_pending = 1; - } - - m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - break; - - case ADB_STATE_IDLE: - m_adb_irq_pending = 0; - break; - } - } -} - -TIMER_CALLBACK(mac_pmu_tick) -{ - mac_state *mac = machine.driver_data(); - - // state 10 means this is in response to an ADB command - if (mac->m_pm_state == 10) - { - #if LOG_ADB - printf("PM: was state 10, chunk-chunking CB1\n"); - #endif - mac->m_pm_state = 0; - - // tick CB1, which should cause a PMU interrupt on PMU machines - mac->m_adb_extclock ^= 1; - mac->m_via1->write_cb1(mac->m_adb_extclock); - mac->m_adb_extclock ^= 1; - mac->m_via1->write_cb1(mac->m_adb_extclock); - } - else - { - #if LOG_ADB - printf("PM: timer tick, lowering ACK\n"); - #endif - mac->m_pm_ack &= ~2; // lower ACK to handshake next step - } -} - -void mac_state::pmu_one_byte_reply(UINT8 result) -{ - m_pm_out[0] = m_pm_out[1] = 1; // length - m_pm_out[2] = result; - m_pm_slen = 3; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); -} - -void mac_state::pmu_three_byte_reply(UINT8 result1, UINT8 result2, UINT8 result3) -{ - m_pm_out[0] = m_pm_out[1] = 3; // length - m_pm_out[2] = result1; - m_pm_out[3] = result2; - m_pm_out[4] = result3; - m_pm_slen = 5; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); -} - -void mac_state::pmu_exec() -{ - m_pm_sptr = 0; // clear send pointer - m_pm_slen = 0; // and send length - m_pm_dptr = 0; // and receive pointer - -// printf("PMU: Command %02x\n", mac->m_pm_cmd[0]); - switch (m_pm_cmd[0]) - { - case 0x10: // subsystem power and clock ctrl - break; - - case 0x20: // send ADB command (PMU must issue an IRQ on completion) - #if 0 - printf("PMU: Send ADB %02x %02x cmd %02x flag %02x data %02x %02x\n", - m_pm_cmd[0], // 0x20 - m_pm_cmd[1], // ??? - m_pm_cmd[2], // adb flags (2 for autopoll active, 3 to reset bus?) - m_pm_cmd[3], // length of ADB data - m_pm_cmd[4], // adb data - m_pm_cmd[5]); - #endif - - #if 0 - m_pm_state = 10; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - if (ADB_IS_PM_VIA1_CLASS) - { - m_pmu_int_status = 0x1; - } - else if (ADB_IS_PM_VIA2_CLASS) - { - m_pmu_int_status = 0x10; - } - else - { - fatalerror("mac: unknown ADB PMU type\n"); - } - m_pmu_last_adb_command = m_pm_cmd[2]; - m_adb_command = m_pm_cmd[2]; - m_adb_waiting_cmd = 1; - adb_talk(); - - if ((m_pm_cmd[2] & 0xf) == 0xb) // LISTEN register 3 (remap) - { - m_adb_waiting_cmd = 0; - m_adb_command = mac->m_pm_cmd[5]; - adb_talk(); - } - #else - if (((m_pm_cmd[2] == 0xfc) || (m_pm_cmd[2] == 0x2c)) && (m_pm_cmd[3] == 4)) - { -// printf("PMU: request to poll ADB, returning nothing\n"); - m_pm_slen = 0; - m_pmu_int_status = 0; - } - else - { - m_pm_state = 10; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - if (ADB_IS_PM_VIA1_CLASS) - { - m_pmu_int_status = 0x1; - } - else if (ADB_IS_PM_VIA2_CLASS) - { - m_pmu_int_status = 0x10; - } - else - { - fatalerror("mac: unknown ADB PMU type\n"); - } - m_pmu_last_adb_command = m_pm_cmd[2]; - } - - m_adb_command = m_pm_cmd[2]; - m_adb_waiting_cmd = 1; - adb_talk(); - #endif - break; - - case 0x21: // turn ADB auto-poll off (does this need a reply?) - break; - - case 0x28: // read ADB - if (m_adb_datasize > 0) - { - m_adb_datasize = 1; // hack - - m_pm_out[0] = m_pm_out[1] = 3 + m_adb_datasize; - m_pm_out[2] = 0; -// m_pm_out[3] = m_pmu_last_adb_command; - m_pm_out[3] = 0; - m_pm_out[4] = m_adb_datasize; - for (int i = 0; i < m_adb_datasize; i++) - { - m_pm_out[5+i] = 0; //mac->m_adb_buffer[i]; - } - m_pm_slen = 5 + m_adb_datasize; - } - else - { - m_pm_out[0] = m_pm_out[1] = 4; - m_pm_out[2] = 0; - m_pm_out[3] = 0; -// m_pm_out[3] = m_pmu_last_adb_command; - m_pm_out[4] = 1; // length of following data - m_pm_out[5] = 0; - m_pm_slen = 6; - } -/* printf("ADB packet: "); - for (int i = 0; i < m_pm_slen; i++) - { - printf("%02x ", m_pm_out[i]); - } - printf("\n");*/ - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(1000))); - break; - - case 0x31: // write first 20 bytes of PRAM - { - for (int i = 0; i < 20; i++) - { - m_adb_pram[i] = m_pm_cmd[1+i]; - } - } - break; - - case 0x32: // write extended PRAM byte(s). cmd[2] = address, cmd[3] = length, cmd[4...] = data - if ((m_pm_cmd[2] + m_pm_cmd[3]) < 0x100) - { - int i; - - for (i = 0; i < m_pm_cmd[3]; i++) - { - m_adb_pram[m_pm_cmd[2] + i] = m_pm_cmd[4+i]; - } - } - break; - - case 0x38: // read time - { - m_pm_out[0] = m_pm_out[1] = 4; - m_pm_out[2] = 0x63; // famous Mac RTC value of 8/27/56 8:35:00 PM - m_pm_out[3] = 0x0b; - m_pm_out[4] = 0xd1; - m_pm_out[5] = 0x78; - m_pm_slen = 6; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - } - break; - - case 0x39: // read first 20 bytes of PRAM - { - int i; - - m_pm_out[0] = m_pm_out[1] = 20; - for (i = 0; i < 20; i++) - { - m_pm_out[2 + i] = m_adb_pram[i]; - } - m_pm_slen = 22; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - } - break; - - case 0x3a: // read extended PRAM byte(s). cmd[2] = address, cmd[3] = length - if ((m_pm_cmd[2] + m_pm_cmd[3]) < 0x100) - { - int i; - - m_pm_out[0] = m_pm_out[1] = m_pm_cmd[3]; - for (i = 0; i < m_pm_cmd[3]; i++) - { - m_pm_out[2 + i] = m_adb_pram[m_pm_cmd[2] + i]; - } - m_pm_slen = m_pm_out[0] + 2; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - } - break; - - case 0x40: // set screen contrast - break; - - case 0x41: - break; - - case 0x58: // read internal modem status - pmu_one_byte_reply(0); - break; - - case 0x60: // set low power warning and cutoff battery levels - break; - - case 0x68: // read battery/charger level - pmu_three_byte_reply(255, 255, 255); - break; - - case 0x69: // read battery/charger instantaneous level and status - pmu_three_byte_reply(255, 255, 255); - break; - - case 0x6b: // read extended battery/charger level and status (wants an 8 byte reply) - m_pm_out[0] = m_pm_out[1] = 8; // length - m_pm_out[2] = 255; - m_pm_out[3] = 255; - m_pm_out[4] = 255; - m_pm_out[5] = 255; - m_pm_out[6] = 255; - m_pm_out[7] = 255; - m_pm_out[8] = 255; - m_pm_out[9] = 255; - m_pm_slen = 10; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - break; - - case 0x6c: // read battery ID - pmu_one_byte_reply(1); - break; - - case 0x78: // read interrupt flag - if (ADB_IS_PM_VIA2_CLASS) // PB 140/170 use a "leaner" PMU protocol where you get the data for a PMU interrupt here - { - #if 0 - if ((m_pmu_int_status&0xf0) == 0x10) - { - if (m_adb_datasize > 0) - { - m_adb_datasize = 1; // hack - m_pm_out[0] = m_pm_out[1] = 2 + m_adb_datasize; - m_pm_out[2] = m_pmu_int_status; // ADB status in low nibble - m_pm_out[3] = m_pmu_last_adb_command; // ADB command that was sent - for (int i = 0; i < m_adb_datasize; i++) - { - m_pm_out[4+i] = 0; //m_adb_buffer[i]; - } - m_pm_slen = 4 + m_adb_datasize; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(1500))); - -/* printf("ADB packet: "); - for (int i = 0; i < m_pm_slen; i++) - { - printf("%02x ", m_pm_out[i]); - } - printf("\n");*/ - } - else - { - m_pm_out[0] = m_pm_out[1] = 2; - m_pm_out[2] = m_pmu_int_status; // ADB status in low nibble - m_pm_out[3] = m_pmu_last_adb_command; // ADB command that was sent OR 0x80 for extra error-ness - m_pm_out[4] = 0; // return data - m_pm_slen = 4; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(1500))); - } - } - else - { - pmu_one_byte_reply(mac, m_pmu_int_status); - } - #else - if ((m_pmu_int_status&0xf0) == 0x10) - { - m_pm_out[0] = m_pm_out[1] = 2; - m_pm_out[2] = m_pmu_int_status; // ADB status in low nibble - m_pm_out[3] = m_pmu_last_adb_command; // ADB command that was sent OR 0x80 for extra error-ness - m_pm_out[4] = 0; // return data - m_pm_slen = 4; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(1500))); - } - else - { - pmu_one_byte_reply(m_pmu_int_status); - } - #endif - } - else - { - pmu_one_byte_reply(m_pmu_int_status); - } - - m_pmu_int_status = 0; - break; - - case 0x90: // sound power control - break; - - case 0x98: // read sound power state - pmu_one_byte_reply(1); - break; - - case 0xd8: // read A/D converter (not sure what this does) - pmu_one_byte_reply(0); - break; - - case 0xe0: // write PMU internal RAM - break; - - case 0xe8: // read PMU internal RAM (just return zeroes) - { - int i; - - m_pm_out[0] = m_pm_out[1] = m_pm_cmd[4]; -// printf("PMU read at %x\n", m_pm_cmd[2] | (m_pm_cmd[3]<<8)); - - // note: read at 0xEE00 0 = target disk mode, 0xff = normal bootup - // (actually 0x00EE, the 50753 port 6) - - for (i = 0; i < m_pm_cmd[4]; i++) - { - m_pm_out[2 + i] = 0xff; - } - m_pm_slen = m_pm_out[0] + 2; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - } - break; - - case 0xec: // PMU self-test (send 1 count byte + reply) - pmu_one_byte_reply(0); - break; - - default: - fatalerror("PMU: Unhandled command %02x\n", m_pm_cmd[0]); - } - - if (m_pm_slen > 0) - { - m_pm_state = 1; - } -} - -void mac_state::adb_vblank() -{ - if ((m_adb_state == ADB_STATE_IDLE) || ((ADB_IS_PM_CLASS) && (m_pmu_poll))) - { - if (this->adb_pollmouse()) - { - // if the mouse was the last TALK, we can just send the new data - // otherwise we need to pull SRQ - if ((m_adb_last_talk == m_adb_mouseaddr) && !(ADB_IS_PM_CLASS)) - { - // repeat last TALK to get updated data - m_adb_waiting_cmd = 1; - this->adb_talk(); - - m_adb_timer_ticks = 8; - this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - } - #if 0 - else if (ADB_IS_PM_CLASS) - { - m_adb_waiting_cmd = 1; - this->adb_talk(); - m_pm_state = 10; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - if (ADB_IS_PM_VIA1_CLASS) - { - m_pmu_int_status = 0x1; - } - else if (ADB_IS_PM_VIA2_CLASS) - { - m_pmu_int_status = 0x10; - } - } - #endif - else - { - m_adb_irq_pending = 1; - m_adb_command = m_adb_send = 0; - m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ - this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - m_adb_srq_switch = 1; - } - } - else if (this->adb_pollkbd(0)) - { - if ((m_adb_last_talk == m_adb_keybaddr) && !(ADB_IS_PM_CLASS)) - { - // repeat last TALK to get updated data - m_adb_waiting_cmd = 1; - this->adb_talk(); - - m_adb_timer_ticks = 8; - this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - } - #if 0 - else if (ADB_IS_PM_CLASS) - { - m_adb_waiting_cmd = 1; - this->adb_talk(); - m_pm_state = 10; - m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(200))); - m_pmu_int_status = 0x1; - } - #endif - else - { - m_adb_irq_pending = 1; - m_adb_command = m_adb_send = 0; - m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ - this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100))); - m_adb_srq_switch = 1; - } - } - } -} - -void mac_state::adb_reset() -{ - int i; - - m_adb_srq_switch = 0; - m_adb_irq_pending = 0; // no interrupt - m_adb_timer_ticks = 0; - m_adb_command = 0; - m_adb_extclock = 0; - m_adb_send = 0; - m_adb_waiting_cmd = 0; - m_adb_streaming = MCU_STREAMING_NONE; - m_adb_state = 0; - m_adb_srqflag = false; - m_pmu_poll = 0; - if (ADB_IS_BITBANG_CLASS) - { - m_adb_state = ADB_STATE_NOTINIT; - } - m_adb_direction = 0; - m_adb_datasize = 0; - m_adb_last_talk = -1; - - m_adb_linestate = 0; - - // mouse - m_adb_mouseaddr = 3; - m_adb_lastmousex = m_adb_lastmousey = m_adb_lastbutton = 0; - m_adb_mouse_initialized = 0; - - // keyboard - m_adb_keybaddr = 2; - m_adb_keybinitialized = 0; - m_adb_currentkeys[0] = m_adb_currentkeys[1] = 0xff; - m_adb_modifiers = 0xff; - for (i=0; i<7; i++) - { - m_key_matrix[i] = 0; - } - m_adb_keybuf_start = 0; - m_adb_keybuf_end = 0; -} - -WRITE_LINE_MEMBER(mac_state::adb_linechange_w) -{ - int dtime = 0; -/* static const char *states[] = - { - "idle", - "attention", - "bit0", - "bit1", - "bit2", - "bit3", - "bit4", - "bit5", - "bit6", - "bit7", - "tstop", - "waitt1t", - "rcvstartbit", - "srqnodata" - };*/ - - if (ADB_IS_EGRET) - { - dtime = m_egret->get_adb_dtime(); - } - else if (ADB_IS_CUDA) - { - dtime = m_cuda->get_adb_dtime(); - } - -/* if (m_adb_linestate <= 12) - { - printf("linechange: %d -> %d, time %d (state %d = %s)\n", state^1, state, dtime, m_adb_linestate, states[m_adb_linestate]); - } - else - { - printf("linechange: %d -> %d, time %d (state %d)\n", state^1, state, dtime, m_adb_linestate); - }*/ - - if ((m_adb_direction) && (m_adb_linestate == LST_TSTOP)) - { - if (m_adb_stream_ptr & 1) // odd byte, can't end here - { -// printf("critical linechange: odd, cont\n"); - m_adb_linestate = LST_BIT0; - } - else - { - if (dtime < 90) - { -// printf("critical linechange: even, and it's another bit\n"); - m_adb_linestate = LST_BIT0; - } - } - } - - switch (m_adb_linestate) - { - case LST_IDLE: - if ((state) && (dtime >= 4500)) // reset - { -// printf("ADB RESET\n"); - } - else if ((state) && (dtime >= 1200)) // attention - { -// printf("ADB ATTENTION\n"); - m_adb_waiting_cmd = 1; - m_adb_direction = 0; - m_adb_linestate++; - } - break; - - case LST_ATTENTION: - if ((!state) && (dtime >= 90)) // Tsync - { -// printf("ADB Tsync\n"); - m_adb_command = 0; - m_adb_linestate++; - } - break; - - case LST_BIT0: - case LST_BIT1: - case LST_BIT2: - case LST_BIT3: - case LST_BIT4: - case LST_BIT5: - case LST_BIT6: - case LST_BIT7: - if (!state) - { - if (dtime >= 90) // "1" bit - { - m_adb_command |= 1; - } -// printf("ADB bit %d\n", m_adb_command & 1); - - if (m_adb_linestate != LST_BIT7) - { - m_adb_command <<= 1; - } - else - { - if (m_adb_direction) - { -// printf("listen byte[%d] = %02x\n", m_adb_stream_ptr, m_adb_command); - m_adb_buffer[m_adb_stream_ptr++] = m_adb_command; - m_adb_command = 0; - } - } - - m_adb_linestate++; - } - break; - - case LST_TSTOP: - if (state) - { -// printf("ADB TSTOP, command byte %02x\n", m_adb_command); - - if (m_adb_direction) - { - m_adb_command = m_adb_buffer[0]; - } - - m_adb_srqflag = false; - adb_talk(); - - if (!m_adb_srqflag) - { - set_adb_line(ASSERT_LINE); - } - else - { - set_adb_line(CLEAR_LINE); - } - - if (m_adb_datasize > 0) - { -/* printf("Device has %d bytes of data: ", m_adb_datasize); - for (int i = 0; i < m_adb_datasize; i++) - { - printf("%02x ", m_adb_buffer[i]); - }*/ - m_adb_linestate = LST_TSTOPSTART; // T1t - m_adb_timer->adjust(attotime::from_ticks(324/4, 1000000)); - m_adb_stream_ptr = 0; - } - else if (m_adb_direction) // if direction is set, we LISTENed to a valid device - { - m_adb_linestate = LST_WAITT1T; - } - else // no valid device targetted, time out - { - if (m_adb_srqflag) - { - m_adb_linestate = LST_SRQNODATA; - m_adb_timer->adjust(attotime::from_ticks(486, 1000000)); // SRQ time - } - else - { - m_adb_linestate = LST_IDLE; - } - } - } - break; - - case LST_WAITT1T: - if ((!state) && (dtime >= 300)) // T1t - { -// printf("ADB T1t\n"); - m_adb_linestate++; - } - break; - - case LST_RCVSTARTBIT: - if ((!state) && (dtime >= 90)) // start - { -// printf("ADB start\n"); - m_adb_linestate = LST_BIT0; - m_adb_command = 0; - } - break; - } -} - -void mac_state::set_adb_line(int linestate) -{ - if (ADB_IS_EGRET) - { - m_egret->set_adb_line(linestate); - } - else if (ADB_IS_CUDA) - { - m_cuda->set_adb_line(linestate); - } -} diff --git a/src/mess/machine/mackbd.c b/src/mess/machine/mackbd.c deleted file mode 100644 index 7244b16866f..00000000000 --- a/src/mess/machine/mackbd.c +++ /dev/null @@ -1,329 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/* - Apple Macintosh original/512/Plus keyboard - Emulation by R. Belmont - - Port definitions from "IM Underground Volume 1" - http://bitsavers.org/pdf/apple/mac/IM_Underground_Vol_1_1985.pdf - - Key matrix for keyboard: - - Cols 0 1 2 3 4 5 6 7 8 Rows - G B T 5 0 P ; . n/a 0 - H n/a Y 6 8 I K M Enter 1 - F V R 4 - [ ' N Backsp 2 - D C E 3 7 U J / ` 3 - S X W 2 9 O L , Space 4 - A Z Q 1 = ] Ret \ Tab 5 - - Port 0: - - x------- Clock to Mac - -x------ Caps Lock - --x----- Row 5 readback (tied to Vcc for keypad) - ---x---- Row 4 readback - ----x--- Row 3 readback - -----x-- Row 2 readback - ------x- Row 1 readback - -------x Row 0 readback - - Port 1: - - x------- Column 8 strobe - -x------ Column 7 strobe - --x----- Column 6 strobe - ---x---- Column 5 strobe - ----x--- Column 4 strobe - -----x-- Column 3 strobe - ------x- Column 2 strobe - -------x Column 1 strobe - - Port 2: - x--- Command/Apple - -x-- Shift - --x- Column 0 strobe - ---x Data to Mac - - The T1 line is "Option". - - There is a later M0110 keyboard version which uses a GI PIC1657; we do not have a dump of that version. -*/ - - -#include "emu.h" -#include "mackbd.h" -#include "cpu/mcs48/mcs48.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define MACKBD_CPU_TAG "mackbd" - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type MACKBD = &device_creator; - -ROM_START( mackbd ) - ROM_REGION(0x800, MACKBD_CPU_TAG, 0) - // original Mac keyboard and optional external keypad - ROM_LOAD( "ip8021h_2173.bin", 0x000000, 0x000400, CRC(5fbd9a94) SHA1(32a3b58afb445a8675b12a4de3aec2fa00c99222) ) - // Mac Plus all-in-one keyboard (not yet supported) - ROM_LOAD( "341-0332-a.bin", 0x000400, 0x000400, CRC(6554f5b6) SHA1(a80404a122d74721cda13b285c412057c2c78bd7) ) -ROM_END - -//------------------------------------------------- -// ADDRESS_MAP -//------------------------------------------------- - -static ADDRESS_MAP_START( mackbd_map, AS_PROGRAM, 8, mackbd_device ) - AM_RANGE(0x0000, 0x03ff) AM_ROM AM_REGION(MACKBD_CPU_TAG, 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( mackbd_io_map, AS_IO, 8, mackbd_device ) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(p0_r) - AM_RANGE(0x2f, 0x36) AM_WRITE(p0_w) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_r, p2_w) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) -ADDRESS_MAP_END - -//------------------------------------------------- -// MACHINE_CONFIG -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( mackbd ) - MCFG_CPU_ADD(MACKBD_CPU_TAG, I8021, 3000000) // "the approximate clock rate of the MPU is 3 MHz" - MCFG_CPU_PROGRAM_MAP(mackbd_map) - MCFG_CPU_IO_MAP(mackbd_io_map) -MACHINE_CONFIG_END - -static INPUT_PORTS_START( mackbd ) - PORT_START("COL0") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - - PORT_START("COL1") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN) - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - - PORT_START("COL2") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START("COL3") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - - PORT_START("COL4") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - - PORT_START("COL5") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - - PORT_START("COL6") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') PORT_NAME("Return") - - PORT_START("COL7") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - - PORT_START("COL8") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN) - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN) - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - - PORT_START("MODS") - PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Option") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Command") PORT_CODE(KEYCODE_LCONTROL) -INPUT_PORTS_END - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor mackbd_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( mackbd ); -} - -const rom_entry *mackbd_device::device_rom_region() const -{ - return ROM_NAME( mackbd ); -} - -ioport_constructor mackbd_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( mackbd ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// mackbd_device - constructor -//------------------------------------------------- - -mackbd_device::mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, MACKBD, "Macintosh keyboard", tag, owner, clock, "mackbd", __FILE__), - m_maincpu(*this, MACKBD_CPU_TAG), - m_clkout_handler(*this), - m_dataout_handler(*this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void mackbd_device::device_start() -{ - m_clkout_handler.resolve_safe(); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void mackbd_device::device_reset() -{ - p0 = p1 = p2 = 0; - p0 = 0x3f; - data_from_mac = data_to_mac = 0; -} - -void mackbd_device::scan_kbd_col(int col) -{ - char tempcol[8]; - UINT16 keydata; - - // read the selected col - sprintf(tempcol, "COL%d", col); - keydata = ioport(tempcol)->read(); - - p0 &= ~0x3f; - p0 |= (keydata & 0x3f); - - // set modifier bits in p2 - p2 = ioport("MODS")->read() & 0xc; -} - -READ8_MEMBER(mackbd_device::p0_r) -{ - UINT8 ret = p0; - - // capslock - if (ioport("MODS")->read() & 0x1) - { - ret |= 0x40; - } - - return ret; -} - -WRITE8_MEMBER(mackbd_device::p0_w) -{ - if (!(data & 2)) - { - scan_kbd_col(0); - } - - if (data & 0x80) - { - m_clkout_handler(ASSERT_LINE); - } - else - { - m_clkout_handler(CLEAR_LINE); -// machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10)); - } -} - -READ8_MEMBER(mackbd_device::p1_r) -{ - return p1; -} - -WRITE8_MEMBER(mackbd_device::p1_w) -{ - data ^= 0xff; - if (data & 0x01) scan_kbd_col(1); - if (data & 0x02) scan_kbd_col(2); - if (data & 0x04) scan_kbd_col(3); - if (data & 0x08) scan_kbd_col(4); - if (data & 0x10) scan_kbd_col(5); - if (data & 0x20) scan_kbd_col(6); - if (data & 0x40) scan_kbd_col(7); - if (data & 0x80) scan_kbd_col(8); -} - -READ8_MEMBER(mackbd_device::p2_r) -{ - return p2 | data_from_mac; -} - -WRITE8_MEMBER(mackbd_device::p2_w) -{ - // prevent key scan accesses to the port from messing with the data line (how does this work on h/w?) - if (m_maincpu->pc() != 0x19e && m_maincpu->pc() != 0x1a3) - { - data_to_mac = data_from_mac = (data & 1); -// printf("data to/from mac = %d (PC=%x)\n", data_to_mac, m_maincpu->pc()); - } -} - -READ8_MEMBER(mackbd_device::t1_r) -{ - return (ioport("MODS")->read() & 0x2) ? 0xff : 0x00; -} - -WRITE_LINE_MEMBER(mackbd_device::data_w) -{ - data_from_mac = (state == ASSERT_LINE) ? 1 : 0; -} diff --git a/src/mess/machine/mackbd.h b/src/mess/machine/mackbd.h deleted file mode 100644 index cb8090b9bdb..00000000000 --- a/src/mess/machine/mackbd.h +++ /dev/null @@ -1,79 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -#pragma once - -#ifndef __MACKBD_H__ -#define __MACKBD_H__ - -#include "emu.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_MACKBD_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, MACKBD, 0) - -#define MCFG_MACKBD_REPLACE(_tag) \ - MCFG_DEVICE_REPLACE(_tag, MACKBD, 0) - -#define MCFG_MACKBD_REMOVE(_tag) \ - MCFG_DEVICE_REMOVE(_tag) - -#define MCFG_MACKBD_CLKOUT_HANDLER(_devcb) \ - devcb = &mackbd_device::set_clkout_handler(*device, DEVCB_##_devcb); - -#define MCFG_MACKBD_DATAOUT_HANDLER(_devcb) \ - devcb = &mackbd_device::set_dataout_handler(*device, DEVCB_##_devcb); - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> mackbd_device - -class mackbd_device : public device_t -{ -public: - // static config helper - template static devcb_base &set_clkout_handler(device_t &device, _Object object) { return downcast(device).m_clkout_handler.set_callback(object); } - template static devcb_base &set_dataout_handler(device_t &device, _Object object) { return downcast(device).m_dataout_handler.set_callback(object); } - - // construction/destruction - mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_READ8_MEMBER(p0_r); - DECLARE_WRITE8_MEMBER(p0_w); - DECLARE_READ8_MEMBER(p1_r); - DECLARE_WRITE8_MEMBER(p1_w); - DECLARE_READ8_MEMBER(p2_r); - DECLARE_WRITE8_MEMBER(p2_w); - DECLARE_READ8_MEMBER(t1_r); - - DECLARE_WRITE_LINE_MEMBER(data_w); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual machine_config_constructor device_mconfig_additions() const; - virtual const rom_entry *device_rom_region() const; - virtual ioport_constructor device_input_ports() const; - - required_device m_maincpu; - -private: - UINT8 p0, p1, p2, data_from_mac, data_to_mac; - - devcb_write_line m_clkout_handler; - devcb_write_line m_dataout_handler; - - void scan_kbd_col(int col); -}; - -// device type definition -extern const device_type MACKBD; - -#endif diff --git a/src/mess/machine/macpci.c b/src/mess/machine/macpci.c deleted file mode 100644 index 705f686f056..00000000000 --- a/src/mess/machine/macpci.c +++ /dev/null @@ -1,228 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/**************************************************************************** - - machine/pcimac.c - - PCI-based Power Macintosh hardware - - R. Belmont - -****************************************************************************/ - -#include "emu.h" -#include "machine/8530scc.h" -#include "cpu/m68000/m68000.h" -#include "machine/applefdc.h" -#include "machine/sonydriv.h" -#include "includes/macpci.h" -#include "debug/debugcpu.h" -#include "machine/ram.h" -#include "debugger.h" - -#define LOG_ADB 0 -#define LOG_VIA 0 - - - -/* VIA1 Handlers */ - -WRITE_LINE_MEMBER(macpci_state::mac_via_irq) -{ -} - -READ8_MEMBER(macpci_state::mac_via_in_a) -{ -// printf("VIA1 IN_A (PC %x)\n", mac->m_maincpu->pc()); - - return 0x80; -} - -READ8_MEMBER(macpci_state::mac_via_in_b) -{ - int val = 0; - val |= m_cuda->get_treq()<<3; - -// printf("VIA1 IN B = %02x (PC %x)\n", val, m_maincpu->pc()); - - return val; -} - -WRITE8_MEMBER(macpci_state::mac_via_out_a) -{ -// printf("VIA1 OUT A: %02x (PC %x)\n", data, m_maincpu->pc()); -} - -WRITE8_MEMBER(macpci_state::mac_via_out_b) -{ -// printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->pc()); - - #if LOG_ADB - printf("PPC: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, m_maincpu->pc()); - #endif - m_cuda->set_byteack((data&0x10) ? 1 : 0); - m_cuda->set_tip((data&0x20) ? 1 : 0); -} - -READ16_MEMBER ( macpci_state::mac_via_r ) -{ - UINT16 data; - - offset >>= 8; - offset &= 0x0f; - - if (LOG_VIA) - printf("mac_via_r: offset=0x%02x (PC=%x)\n", offset, m_maincpu->pc()); - data = m_via1->read(space, offset); - - m_maincpu->adjust_icount(m_via_cycles); - - return data | (data<<8); -} - -WRITE16_MEMBER ( macpci_state::mac_via_w ) -{ - offset >>= 8; - offset &= 0x0f; - - if (LOG_VIA) - printf("mac_via_w: offset=0x%02x data=0x%08x (PC=%x)\n", offset, data, m_maincpu->pc()); - - if (ACCESSING_BITS_0_7) - m_via1->write(space, offset, data & 0xff); - if (ACCESSING_BITS_8_15) - m_via1->write(space, offset, (data >> 8) & 0xff); - - m_maincpu->adjust_icount(m_via_cycles); -} - -READ_LINE_MEMBER(macpci_state::mac_adb_via_in_cb2) -{ - UINT8 ret; - ret = m_cuda->get_via_data(); - #if LOG_ADB - printf("PPC: Read VIA_DATA %x\n", ret); - #endif - - return ret; -} - -WRITE_LINE_MEMBER(macpci_state::mac_adb_via_out_cb2) -{ - m_cuda->set_via_data(state); -} - -void macpci_state::machine_start() -{ - m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macpci_state::mac_6015_tick),this)); - m_6015_timer->adjust(attotime::never); -} - -void macpci_state::machine_reset() -{ - m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); - - m_via_cycles = -256; // for a 66 MHz PowerMac - - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); -} - -WRITE_LINE_MEMBER(macpci_state::cuda_reset_w) -{ - m_maincpu->set_input_line(INPUT_LINE_RESET, state); -} - -WRITE_LINE_MEMBER(macpci_state::cuda_adb_linechange_w) -{ -} - -void macpci_state::mac_driver_init(model_t model) -{ - m_model = model; - - memset(m_ram->pointer(), 0, m_ram->size()); -} - -#define MAC_DRIVER_INIT(label, model) \ -DRIVER_INIT_MEMBER(macpci_state,label) \ -{ \ - mac_driver_init(model ); \ -} - -MAC_DRIVER_INIT(pippin, PCIMODEL_MAC_PIPPIN) - -READ32_MEMBER(macpci_state::mac_read_id) -{ - printf("Mac read ID reg @ PC=%x\n", m_maincpu->pc()); - - switch (m_model) - { - case PCIMODEL_MAC_PIPPIN: - return 0xa55a7001; - - default: - return 0; - } -} - -/* 8530 SCC interface */ - -READ16_MEMBER ( macpci_state::mac_scc_r ) -{ - scc8530_t *scc = space.machine().device("scc"); - UINT16 result; - - result = scc->reg_r(space, offset); - return (result << 8) | result; -} - -WRITE16_MEMBER ( macpci_state::mac_scc_w ) -{ - scc8530_t *scc = space.machine().device("scc"); - scc->reg_w(space, offset, data); -} - -WRITE16_MEMBER ( macpci_state::mac_scc_2_w ) -{ - scc8530_t *scc = space.machine().device("scc"); - scc->reg_w(space, offset, data >> 8); -} - -READ8_MEMBER(macpci_state::mac_5396_r) -{ - if (offset < 0x100) - { - return m_539x_1->read(space, offset>>4); - } - else // pseudo-DMA: read from the FIFO - { - return m_539x_1->read(space, 2); - } - - // never executed - //return 0; -} - -WRITE8_MEMBER(macpci_state::mac_5396_w) -{ - if (offset < 0x100) - { - m_539x_1->write(space, offset>>4, data); - } - else // pseudo-DMA: write to the FIFO - { - m_539x_1->write(space, 2, data); - } -} - -WRITE_LINE_MEMBER(macpci_state::irq_539x_1_w) -{ -} - -WRITE_LINE_MEMBER(macpci_state::drq_539x_1_w) -{ -} - -TIMER_CALLBACK_MEMBER(macpci_state::mac_6015_tick) -{ -} diff --git a/src/mess/machine/macrtc.c b/src/mess/machine/macrtc.c deleted file mode 100644 index dd047014c0f..00000000000 --- a/src/mess/machine/macrtc.c +++ /dev/null @@ -1,365 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - macrtc.c - the real-time clock & NVRAM chip used in early 680x0 Macs, - Apple part numbers 343-0040 (original) and 343-0042 (with extended PRAM) - - The IIgs has this chip also, but the VGC contains a relatively - sophisticated logic block that offloads the low-level serial comms - from the CPU, which makes it look quite different to software. - -***************************************************************************/ - -#include "emu.h" -#include "macrtc.h" - -#ifdef MAME_DEBUG -#define LOG_RTC 0 -#else -#define LOG_RTC 0 -#endif - -enum -{ - RTC_STATE_NORMAL, - RTC_STATE_WRITE, - RTC_STATE_XPCOMMAND, - RTC_STATE_XPWRITE -}; - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -// device type definition -const device_type RTC3430042 = &device_creator; - - -//------------------------------------------------- -// rtc4543_device - constructor -//------------------------------------------------- - -rtc3430042_device::rtc3430042_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, RTC3430042, "Apple 343-0042 clock/PRAM", tag, owner, clock, "rtc3430042", __FILE__), - device_rtc_interface(mconfig, *this), - device_nvram_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void rtc3430042_device::device_start() -{ - // allocate timers - m_clock_timer = timer_alloc(); - m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); - - // state saving -} - -void rtc3430042_device::device_reset() -{ - set_current_time(machine()); - - m_rtc_rTCEnb = 0; - m_rtc_rTCClk = 0; - m_rtc_bit_count = 0; - m_rtc_data_dir = 0; - m_rtc_data_out = 0; - m_rtc_cmd = 0; - m_rtc_write_protect = 0; - m_rtc_state = 0; - - ce_w(1); - m_rtc_state = RTC_STATE_NORMAL; -} - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void rtc3430042_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - advance_seconds(); -} - -//------------------------------------------------- -// rtc_clock_updated - called by the RTC base class when the time changes -//------------------------------------------------- - -void rtc3430042_device::rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second) -{ - struct tm cur_time, mac_reference; - UINT32 seconds; - - cur_time.tm_sec = second; - cur_time.tm_min = minute; - cur_time.tm_hour = hour; - cur_time.tm_mday = day; - cur_time.tm_mon = month-1; - cur_time.tm_year = year+100; // assumes post-2000 current system time - cur_time.tm_isdst = 0; - - /* The count starts on 1st January 1904 */ - mac_reference.tm_sec = 0; - mac_reference.tm_min = 0; - mac_reference.tm_hour = 0; - mac_reference.tm_mday = 1; - mac_reference.tm_mon = 0; - mac_reference.tm_year = 4; - mac_reference.tm_isdst = 0; - - seconds = difftime(mktime(&cur_time), mktime(&mac_reference)); - - if (LOG_RTC) - logerror("second count 0x%lX\n", (unsigned long) seconds); - - m_rtc_seconds[0] = seconds & 0xff; - m_rtc_seconds[1] = (seconds >> 8) & 0xff; - m_rtc_seconds[2] = (seconds >> 16) & 0xff; - m_rtc_seconds[3] = (seconds >> 24) & 0xff; -} - -/* write the rTCEnb state */ -WRITE_LINE_MEMBER( rtc3430042_device::ce_w ) -{ - if (state && (! m_rtc_rTCEnb)) - { - /* rTCEnb goes high (inactive) */ - m_rtc_rTCEnb = 1; - /* abort current transmission */ - m_rtc_data_byte = m_rtc_bit_count = m_rtc_data_dir = m_rtc_data_out = 0; - m_rtc_state = RTC_STATE_NORMAL; - } - else if ((!state) && m_rtc_rTCEnb) - { - /* rTCEnb goes low (active) */ - m_rtc_rTCEnb = 0; - /* abort current transmission */ - m_rtc_data_byte = m_rtc_bit_count = m_rtc_data_dir = m_rtc_data_out = 0; - m_rtc_state = RTC_STATE_NORMAL; - } - - m_rtc_rTCEnb = state; -} - -WRITE_LINE_MEMBER( rtc3430042_device::clk_w ) -{ - if ((!state) && (m_rtc_rTCClk)) - { - rtc_shift_data(m_data_latch & 0x01); - } - - m_rtc_rTCClk = state; -} - -READ_LINE_MEMBER( rtc3430042_device::data_r ) -{ - return m_rtc_data_out; -} - -WRITE_LINE_MEMBER( rtc3430042_device::data_w ) -{ - m_data_latch = state; -} - -/* shift data (called on rTCClk high-to-low transition (?)) */ -void rtc3430042_device::rtc_shift_data(int data) -{ - if (m_rtc_rTCEnb) - /* if enable line inactive (high), do nothing */ - return; - - if (m_rtc_data_dir) - { /* RTC -> VIA transmission */ - m_rtc_data_out = (m_rtc_data_byte >> --m_rtc_bit_count) & 0x01; - if (LOG_RTC) - logerror("RTC shifted new data %d\n", m_rtc_data_out); - } - else - { /* VIA -> RTC transmission */ - m_rtc_data_byte = (m_rtc_data_byte << 1) | (data ? 1 : 0); - - if (++m_rtc_bit_count == 8) - { /* if one byte received, send to command interpreter */ - rtc_execute_cmd(m_rtc_data_byte); - } - } -} - -/* Executes a command. -Called when the first byte after "enable" is received, and when the data byte after a write command -is received. */ -void rtc3430042_device::rtc_execute_cmd(int data) -{ - int i; - - if (LOG_RTC) - printf("rtc_execute_cmd: data=%x, state=%x\n", data, m_rtc_state); - - if (m_rtc_state == RTC_STATE_XPCOMMAND) - { - m_rtc_xpaddr = ((m_rtc_cmd & 7)<<5) | ((data&0x7c)>>2); - if ((m_rtc_cmd & 0x80) != 0) - { - // read command - if (LOG_RTC) - printf("RTC: Reading extended address %x = %x\n", m_rtc_xpaddr, m_pram[m_rtc_xpaddr]); - - m_rtc_data_dir = 1; - m_rtc_data_byte = m_pram[m_rtc_xpaddr]; - m_rtc_state = RTC_STATE_NORMAL; - } - else - { - // write command - m_rtc_state = RTC_STATE_XPWRITE; - m_rtc_data_byte = 0; - m_rtc_bit_count = 0; - } - } - else if (m_rtc_state == RTC_STATE_XPWRITE) - { - if (LOG_RTC) - printf("RTC: writing %x to extended address %x\n", data, m_rtc_xpaddr); - m_pram[m_rtc_xpaddr] = data; - m_rtc_state = RTC_STATE_NORMAL; - } - else if (m_rtc_state == RTC_STATE_WRITE) - { - m_rtc_state = RTC_STATE_NORMAL; - - /* Writing an RTC register */ - i = (m_rtc_cmd >> 2) & 0x1f; - if (m_rtc_write_protect && (i != 13)) - /* write-protection : only write-protect can be written again */ - return; - switch(i) - { - case 0: case 1: case 2: case 3: /* seconds register */ - case 4: case 5: case 6: case 7: /* ??? (not described in IM III) */ - { - /* after various tries, I assumed m_rtc_seconds[4+i] is mapped to m_rtc_seconds[i] */ - if (LOG_RTC) - logerror("RTC clock write, address = %X, data = %X\n", i, (int) m_rtc_data_byte); - m_rtc_seconds[i & 3] = m_rtc_data_byte; - - // TODO: call the base class's time set here - } - break; - - case 8: case 9: case 10: case 11: /* RAM address $10-$13 */ - if (LOG_RTC) - printf("PRAM write, address = %X, data = %X\n", i, (int) m_rtc_data_byte); - m_pram[i] = m_rtc_data_byte; - break; - - case 12: - /* Test register - do nothing */ - if (LOG_RTC) - logerror("RTC write to test register, data = %X\n", (int) m_rtc_data_byte); - break; - - case 13: - /* Write-protect register */ - if (LOG_RTC) - printf("RTC write to write-protect register, data = %X\n", (int) m_rtc_data_byte&0x80); - m_rtc_write_protect = (m_rtc_data_byte & 0x80) ? TRUE : FALSE; - break; - - case 16: case 17: case 18: case 19: /* RAM address $00-$0f */ - case 20: case 21: case 22: case 23: - case 24: case 25: case 26: case 27: - case 28: case 29: case 30: case 31: - if (LOG_RTC) - printf("PRAM write, address = %X, data = %X\n", i, (int) m_rtc_data_byte); - m_pram[i] = m_rtc_data_byte; - break; - - default: - printf("Unknown RTC write command : %X, data = %d\n", (int) m_rtc_cmd, (int) m_rtc_data_byte); - break; - } - } - else - { - // always save this byte to m_rtc_cmd - m_rtc_cmd = m_rtc_data_byte; - - if ((m_rtc_cmd & 0x78) == 0x38) // extended command - { - m_rtc_state = RTC_STATE_XPCOMMAND; - m_rtc_data_byte = 0; - m_rtc_bit_count = 0; - } - else - { - if (m_rtc_cmd & 0x80) - { - m_rtc_state = RTC_STATE_NORMAL; - - /* Reading an RTC register */ - m_rtc_data_dir = 1; - i = (m_rtc_cmd >> 2) & 0x1f; - switch(i) - { - case 0: case 1: case 2: case 3: - case 4: case 5: case 6: case 7: - m_rtc_data_byte = m_rtc_seconds[i & 3]; - if (LOG_RTC) - printf("RTC clock read, address = %X -> data = %X\n", i, m_rtc_data_byte); - break; - - case 8: case 9: case 10: case 11: - if (LOG_RTC) - printf("PRAM read, address = %X data = %x\n", i, m_pram[i]); - m_rtc_data_byte = m_pram[i]; - break; - - case 16: case 17: case 18: case 19: - case 20: case 21: case 22: case 23: - case 24: case 25: case 26: case 27: - case 28: case 29: case 30: case 31: - if (LOG_RTC) - printf("PRAM read, address = %X data = %x\n", i, m_pram[i]); - m_rtc_data_byte = m_pram[i]; - break; - - default: - if (LOG_RTC) - logerror("Unknown RTC read command : %X\n", (int) m_rtc_cmd); - m_rtc_data_byte = 0; - break; - } - } - else - { - /* Writing an RTC register */ - /* wait for extra data byte */ - if (LOG_RTC) - logerror("RTC write, waiting for data byte : %X\n", (int) m_rtc_cmd); - m_rtc_state = RTC_STATE_WRITE; - m_rtc_data_byte = 0; - m_rtc_bit_count = 0; - } - } - } -} - -void rtc3430042_device::nvram_default() -{ - memset(m_pram, 0, 0x100); -} - -void rtc3430042_device::nvram_read(emu_file &file) -{ - file.read(m_pram, 0x100); -} - -void rtc3430042_device::nvram_write(emu_file &file) -{ - file.write(m_pram, 0x100); -} diff --git a/src/mess/machine/macrtc.h b/src/mess/machine/macrtc.h deleted file mode 100644 index d830b743c1e..00000000000 --- a/src/mess/machine/macrtc.h +++ /dev/null @@ -1,101 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/********************************************************************** - - macrtc.h - Apple 343-0042 real time clock and battery RAM - by R. Belmont - -**********************************************************************/ - -#pragma once - -#ifndef __RTC3430042_H__ -#define __RTC3430042_H__ - -#include "emu.h" - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_RTC3430042_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, RTC3430042, _clock) - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> rtc3430042_device - -class rtc3430042_device : public device_t, - public device_rtc_interface, - public device_nvram_interface -{ -public: - // construction/destruction - rtc3430042_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_WRITE_LINE_MEMBER( ce_w ); - DECLARE_WRITE_LINE_MEMBER( clk_w ); - DECLARE_READ_LINE_MEMBER( data_r ); - DECLARE_WRITE_LINE_MEMBER( data_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // device_rtc_interface overrides - virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second); - virtual bool rtc_feature_leap_year() { return true; } - - // device_nvram_interface overrides - virtual void nvram_default(); - virtual void nvram_read(emu_file &file); - virtual void nvram_write(emu_file &file); - -private: - /* state of rTCEnb and rTCClk lines */ - UINT8 m_rtc_rTCEnb; - UINT8 m_rtc_rTCClk; - - /* serial transmit/receive register : bits are shifted in/out of this byte */ - UINT8 m_rtc_data_byte; - /* serial transmitted/received bit count */ - UINT8 m_rtc_bit_count; - /* direction of the current transfer (0 : VIA->RTC, 1 : RTC->VIA) */ - UINT8 m_rtc_data_dir; - /* when rtc_data_dir == 1, state of rTCData as set by RTC (-> data bit seen by VIA) */ - UINT8 m_rtc_data_out; - - /* set to 1 when command in progress */ - UINT8 m_rtc_cmd; - - /* write protect flag */ - UINT8 m_rtc_write_protect; - - /* internal seconds register */ - UINT8 m_rtc_seconds[/*8*/4]; - /* 20-byte long PRAM, or 256-byte long XPRAM */ - UINT8 m_pram[256]; - /* current extended address and RTC state */ - UINT8 m_rtc_xpaddr; - UINT8 m_rtc_state; - UINT8 m_data_latch; - - // timers - emu_timer *m_clock_timer; - - void rtc_shift_data(int data); - void rtc_execute_cmd(int data); -}; - - -// device type definition -extern const device_type RTC3430042; - -#endif diff --git a/src/mess/machine/mbc55x.c b/src/mess/machine/mbc55x.c deleted file mode 100644 index 18704e33f0a..00000000000 --- a/src/mess/machine/mbc55x.c +++ /dev/null @@ -1,414 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phill Harvey-Smith -/* - machine/mbc55x.c - - Machine driver for the Sanyo MBC-550 and MBC-555. - - Phill Harvey-Smith - 2011-01-29. -*****************************************************************************/ - -#include "includes/mbc55x.h" - - -/*-------------------------------------------------------------------------*/ -/* Defines, constants, and global variables */ -/*-------------------------------------------------------------------------*/ - -/* Debugging */ - -#define DEBUG_SET(flags) ((state->m_debug_machine & (flags))==(flags)) - -#define DEBUG_NONE 0x0000000 -#define DMA_BREAK 0x0000001 -#define DECODE_BIOS 0x0000002 -#define DECODE_BIOS_RAW 0x0000004 -#define DECODE_DOS21 0x0000008 - -#define LOG_KEYBOARD 1 - -static void decode_dos21(device_t *device,offs_t pc); -//static void mbc55x_recalculate_ints(running_machine &machine); -static void mbc55x_debug(running_machine &machine, int ref, int params, const char *param[]); -static int instruction_hook(device_t &device, offs_t curpc); -//static void fdc_reset(running_machine &machine); -//static void set_disk_int(running_machine &machine, int state); - -/* 8255 Configuration */ - -READ8_MEMBER( mbc55x_state::ppi8255_r ) -{ - return m_ppi->read(space, offset>>1); -} - -WRITE8_MEMBER( mbc55x_state::ppi8255_w ) -{ - m_ppi->write(space, offset>>1, data); -} - -READ8_MEMBER( mbc55x_state::mbc55x_ppi_porta_r ) -{ - return 0xff; -} - -READ8_MEMBER( mbc55x_state::mbc55x_ppi_portb_r ) -{ - return 0xff; -} - -READ8_MEMBER( mbc55x_state::mbc55x_ppi_portc_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_porta_w ) -{ -} - -WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_portb_w ) -{ -} - -WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_portc_w ) -{ - floppy_image_device *floppy = NULL; - - switch (data & 0x03) - { - case 0: floppy = m_floppy0->get_device(); break; - case 1: floppy = m_floppy1->get_device(); break; - case 2: floppy = m_floppy2->get_device(); break; - case 3: floppy = m_floppy3->get_device(); break; - } - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(BIT(data, 2)); - } -} - -/* Serial port USART, unimplemented as yet */ - -READ8_MEMBER( mbc55x_state::mbc55x_usart_r ) -{ - return 0; -} - -WRITE8_MEMBER( mbc55x_state::mbc55x_usart_w ) -{ -} - -/* PIC 8259 Configuration */ - -READ8_MEMBER(mbc55x_state::mbcpic8259_r) -{ - return m_pic->read(space, offset>>1); -} - -WRITE8_MEMBER(mbc55x_state::mbcpic8259_w) -{ - m_pic->write(space, offset>>1, data); -} - -READ8_MEMBER(mbc55x_state::mbcpit8253_r) -{ - return m_pit->read(space, offset >> 1); -} - -WRITE8_MEMBER(mbc55x_state::mbcpit8253_w) -{ - m_pit->write(space, offset >> 1, data); -} - -WRITE_LINE_MEMBER( mbc55x_state::pit8253_t2 ) -{ - m_kb_uart->write_txc(state); - m_kb_uart->write_rxc(state); -} - -/* Video ram page register */ - -READ8_MEMBER( mbc55x_state::vram_page_r ) -{ - return m_vram_page; -} - -WRITE8_MEMBER( mbc55x_state::vram_page_w ) -{ - logerror("%s : set vram page to %02X\n", machine().describe_context(),data); - - m_vram_page=data; -} - -READ8_MEMBER(mbc55x_state::mbc55x_disk_r) -{ - return m_fdc->read(space, offset>>1); -} - -WRITE8_MEMBER(mbc55x_state::mbc55x_disk_w) -{ - m_fdc->write(space, offset>>1, data); -} - - -/* - Keyboard emulation - -*/ - -void mbc55x_state::keyboard_reset() -{ - logerror("keyboard_reset()\n"); - - memset(m_keyboard.keyrows,0xFF,MBC55X_KEYROWS); - m_keyboard.key_special=0; - - // Setup timer to scan keyboard. - m_keyboard.keyscan_timer->adjust(attotime::zero, 0, attotime::from_hz(50)); -} - -void mbc55x_state::scan_keyboard() -{ - UINT8 keyrow; - UINT8 row; - UINT8 bitno; - UINT8 mask; - - char key; - static const char *const keynames[] = - { - "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", - "KEY5", "KEY6", "KEY7", "KEY8", "KEY9", - "KEY10" - }; - - static const char keyvalues_normal[MBC55X_KEYROWS][8] = - { - { '1', '2', '3', '4' , '5', '6', '7', '8' }, - { '9', '0', '-', '=', '\\', 'q', 'w', 'e' }, - { 'r', 't', 'y', 'u', 'i', 'o', 'p', '[' }, - { ']', 'a', 's', 'd', 'f', 'g', 'h', 'j' }, - { 'k', 'l', ';', '\'', '`', 0x0D, 'z', 'x' }, - { 'c', 'v', 'b', 'n', 'm', ',', '.', '/', }, - { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', } - - }; - - static const char keyvalues_shift[MBC55X_KEYROWS][8] = - { - { '!', '@', '#', '$' , '%', '^', '&', '*' }, - { '(', ')', '_', '+', '|', 'Q', 'W', 'E' }, - { 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{' }, - { '}', 'A', 'S', 'D', 'F', 'G', 'H', 'J' }, - { 'K', 'L', ':', '"', '~', 0x0d, 'Z', 'X' }, - { 'C', 'V', 'B', 'N', 'M', ',', '?', '/' }, - { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } - }; - - // First read shift, control and graph - - m_keyboard.key_special = ioport(KEY_SPECIAL_TAG)->read(); - - for(row=0; rowread(); - - for(mask=0x80, bitno=7;mask>0;mask=mask>>1, bitno-=1) - { - if(!(keyrow & mask) && (m_keyboard.keyrows[row] & mask)) - { - if(m_keyboard.key_special & (KEY_BIT_LSHIFT | KEY_BIT_RSHIFT)) - key=keyvalues_shift[row][bitno]; - else - key=keyvalues_normal[row][bitno]; - - if (LOG_KEYBOARD) logerror("keypress %c\n",key); - m_kb_uart->receive_character(key); - } - } - - m_keyboard.keyrows[row]=keyrow; - } -} - -TIMER_CALLBACK_MEMBER(mbc55x_state::keyscan_callback) -{ - scan_keyboard(); -} - -READ8_MEMBER(mbc55x_state::mbc55x_kb_usart_r) -{ - UINT8 result = 0; - offset>>=1; - - switch (offset) - { - case 0: //logerror("%s read kb_uart\n",machine().describe_context()); - result = m_kb_uart->data_r(space,0); - break; - - case 1: - result = m_kb_uart->status_r(space,0); - if (m_keyboard.key_special & KEY_BIT_CTRL) // Parity error used to flag control down - result |= i8251_device::I8251_STATUS_PARITY_ERROR; - break; - } - - return result; -} - -WRITE8_MEMBER(mbc55x_state::mbc55x_kb_usart_w) -{ - offset>>=1; - - switch (offset) - { - case 0 : m_kb_uart->data_w(space, 0, data); break; - case 1 : m_kb_uart->control_w(space, 0, data); break; - } -} - -void mbc55x_state::set_ram_size() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - int ramsize = m_ram->size(); - int nobanks = ramsize / RAM_BANK_SIZE; - char bank[10]; - int bankno; - UINT8 *ram = &m_ram->pointer()[0]; - UINT8 *map_base; - int bank_base; - - - logerror("Ramsize is %d bytes\n",ramsize); - logerror("RAM_BANK_SIZE=%d, nobanks=%d\n",RAM_BANK_SIZE,nobanks); - - // Main memory mapping - - for(bankno=0; banknoset_base(map_base); - space.install_readwrite_bank(bank_base, bank_base+(RAM_BANK_SIZE-1), bank); - logerror("Mapping bank %d at %05X to RAM\n",bankno,bank_base); - } - else - { - space.nop_readwrite(bank_base, bank_base+(RAM_BANK_SIZE-1)); - logerror("Mapping bank %d at %05X to NOP\n",bankno,bank_base); - } - } - - // Graphics red and blue plane memory mapping, green is in main memory - membank(RED_PLANE_TAG)->set_base(&m_video_mem[RED_PLANE_OFFSET]); - space.install_readwrite_bank(RED_PLANE_MEMBASE, RED_PLANE_MEMBASE+(COLOUR_PLANE_SIZE-1), RED_PLANE_TAG); - membank(BLUE_PLANE_TAG)->set_base(&m_video_mem[BLUE_PLANE_OFFSET]); - space.install_readwrite_bank(BLUE_PLANE_MEMBASE, BLUE_PLANE_MEMBASE+(COLOUR_PLANE_SIZE-1), BLUE_PLANE_TAG); -} - -DRIVER_INIT_MEMBER(mbc55x_state,mbc55x) -{ -} - -void mbc55x_state::machine_reset() -{ - set_ram_size(); - keyboard_reset(); -} - -void mbc55x_state::machine_start() -{ - /* init cpu */ -// mbc55x_cpu_init(); - - - /* setup debug commands */ - if (machine().debug_flags & DEBUG_FLAG_ENABLED) - { - debug_console_register_command(machine(), "mbc55x_debug", CMDFLAG_NONE, 0, 0, 1, mbc55x_debug); - - /* set up the instruction hook */ - m_maincpu->debug()->set_instruction_hook(instruction_hook); - } - - m_debug_machine=DEBUG_NONE; - - // Allocate keyscan timer - m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mbc55x_state::keyscan_callback),this)); -} - - -static void mbc55x_debug(running_machine &machine, int ref, int params, const char *param[]) -{ - mbc55x_state *state = machine.driver_data(); - if(params>0) - { - int temp; - sscanf(param[0],"%d",&temp); state->m_debug_machine = temp; - } - else - { - debug_console_printf(machine,"Error usage : mbc55x_debug \n"); - debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_machine); - } -} - -/*----------------------------------------------- - instruction_hook - per-instruction hook ------------------------------------------------*/ - -static int instruction_hook(device_t &device, offs_t curpc) -{ - mbc55x_state *state = device.machine().driver_data(); - address_space &space = device.memory().space(AS_PROGRAM); - UINT8 *addr_ptr; - - addr_ptr = (UINT8*)space.get_read_ptr(curpc); - - if ((addr_ptr !=NULL) && (addr_ptr[0]==0xCD)) - { -// logerror("int %02X called\n",addr_ptr[1]); - - if(DEBUG_SET(DECODE_DOS21) && (addr_ptr[1]==0x21)) - decode_dos21(&device,curpc); - } - - return 0; -} - -static void decode_dos21(device_t *device,offs_t pc) -{ - mbc55x_state *state = device->machine().driver_data(); - - UINT16 ax = state->m_maincpu->state_int(I8086_AX); - UINT16 bx = state->m_maincpu->state_int(I8086_BX); - UINT16 cx = state->m_maincpu->state_int(I8086_CX); - UINT16 dx = state->m_maincpu->state_int(I8086_DX); - UINT16 cs = state->m_maincpu->state_int(I8086_CS); - UINT16 ds = state->m_maincpu->state_int(I8086_DS); - UINT16 es = state->m_maincpu->state_int(I8086_ES); - UINT16 ss = state->m_maincpu->state_int(I8086_SS); - - UINT16 si = state->m_maincpu->state_int(I8086_SI); - UINT16 di = state->m_maincpu->state_int(I8086_DI); - UINT16 bp = state->m_maincpu->state_int(I8086_BP); - - logerror("=======================================================================\n"); - logerror("DOS Int 0x21 call at %05X\n",pc); - logerror("AX=%04X, BX=%04X, CX=%04X, DX=%04X\n",ax,bx,cx,dx); - logerror("CS=%04X, DS=%04X, ES=%04X, SS=%04X\n",cs,ds,es,ss); - logerror("SI=%04X, DI=%04X, BP=%04X\n",si,di,bp); - logerror("=======================================================================\n"); - - if((ax & 0xff00)==0x0900) - debugger_break(device->machine()); -} diff --git a/src/mess/machine/mbee.c b/src/mess/machine/mbee.c deleted file mode 100644 index e2f6b08a94a..00000000000 --- a/src/mess/machine/mbee.c +++ /dev/null @@ -1,745 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - microbee.c - - machine driver - Originally written by Juergen Buchmueller, Jan 2000 - - Rewritten by Robbbert (see notes in driver file). - -****************************************************************************/ - -#include "includes/mbee.h" -#include "machine/z80bin.h" - - -void mbee_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_MBEE_NEWKB: - timer_newkb(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in mbee_state::device_timer"); - } -} - - -/*********************************************************** - - PIO - -************************************************************/ - -WRITE_LINE_MEMBER( mbee_state::pio_ardy ) -{ - m_centronics->write_strobe((state) ? 0 : 1); -} - -WRITE8_MEMBER( mbee_state::pio_port_b_w ) -{ -/* PIO port B - d5..d2 not emulated - d7 interrupt from network or rtc or vsync or not used (see config switch) - d6 speaker - d5 rs232 output (1=mark) - d4 rs232 input (0=mark) - d3 rs232 CTS (0=clear to send) - d2 rs232 clock or DTR - d1 cass out and (on new keyboard) keyboard irq - d0 cass in */ - - m_cassette->output(BIT(data, 1) ? -1.0 : +1.0); - m_speaker->level_w(BIT(data, 6)); -} - -READ8_MEMBER( mbee_state::pio_port_b_r ) -{ - UINT8 data = 0; - - if (m_cassette->input() > 0.03) - data |= 1; - - data |= 8; // CTS held high via resistor. If low, the disk-based models think a mouse is plugged in. - - switch (m_io_config->read() & 0xc0) - { - case 0x00: - data |= (UINT8)m_b7_vs << 7; - break; - case 0x40: - data |= (UINT8)m_b7_rtc << 7; - break; - case 0x80: - data |= 0x80; - break; - } - data |= (UINT8)m_b2 << 1; // key pressed on new keyboard - - return data; -} - -/************************************************************************************* - - Floppy Disk - - The callback is quite simple, no interrupts are used. - If either IRQ or DRQ activate, they set bit 7 of inport 0x48. - -*************************************************************************************/ - -WRITE_LINE_MEMBER( mbee_state::fdc_intrq_w ) -{ - m_fdc_rq = (m_fdc_rq & 2) | state; -} - -WRITE_LINE_MEMBER( mbee_state::fdc_drq_w ) -{ - m_fdc_rq = (m_fdc_rq & 1) | (state << 1); -} - -READ8_MEMBER( mbee_state::fdc_status_r ) -{ -/* d7 indicate if IRQ or DRQ is occurring (1=happening) - d6..d0 not used */ - - return m_fdc_rq ? 0xff : 0x7f; -} - -WRITE8_MEMBER( mbee_state::fdc_motor_w ) -{ -/* d7..d4 not used - d3 density (1=MFM) - d2 side (1=side 1) - d1..d0 drive select (0 to 3) */ - - floppy_image_device *floppy = NULL; - floppy = m_floppy0->get_device(); - floppy->mon_w(0); // motor on always - floppy = m_floppy1->get_device(); - floppy->mon_w(0); // motor on always - - if ((data&3)==0) - floppy = m_floppy0->get_device(); - else - if ((data&3)==1) - floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - m_fdc->dden_w(!BIT(data, 3)); // /Q output of ic29 - - if (floppy) - { - floppy->ss_w(BIT(data, 2)); // inverted on the board - } -} - -/*********************************************************** - - 256TC Keyboard - -************************************************************/ - - -TIMER_CALLBACK_MEMBER( mbee_state::timer_newkb ) -{ - /* Keyboard scanner is a Mostek M3870 chip. Its speed of operation is determined by a 15k resistor on - pin 2 (XTL2) and is therefore 2MHz. If a key change is detected (up or down), the /strobe - line activates, sending a high to bit 1 of port 2 (one of the pio input lines). The next read of - port 18 will clear this line, and read the key scancode. It will also signal the 3870 that the key - data has been read, on pin 38 (/extint). The 3870 can cache up to 9 keys. With no rom dump - available, the following is a guess. - - The 3870 (MK3870) 8-bit microcontroller is a single chip implementation of Fairchild F8 (Mostek 3850). - It includes up to 4 KB of mask-programmable ROM, 64 bytes of scratchpad RAM and up to 64 bytes - of executable RAM. The MCU also integrates 32-bit I/O and a programmable timer. */ - - UINT8 i, j, pressed; - - // find what has changed - for (i = 0; i < 15; i++) - { - pressed = m_io_newkb[i]->read(); - if (pressed != m_mbee256_was_pressed[i]) - { - // get scankey value - for (j = 0; j < 8; j++) - { - if (BIT(pressed^m_mbee256_was_pressed[i], j)) - { - // put it in the queue - UINT8 code = (i << 3) | j | (BIT(pressed, j) ? 0x80 : 0); - m_mbee256_q[m_mbee256_q_pos] = code; - if (m_mbee256_q_pos < 19) m_mbee256_q_pos++; - } - } - m_mbee256_was_pressed[i] = pressed; - } - } - - // if anything queued, cause an interrupt - if (m_mbee256_q_pos) - m_b2 = 1; // set irq - - if (m_b2) - m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); - - timer_set(attotime::from_hz(50), TIMER_MBEE_NEWKB); -} - -READ8_MEMBER( mbee_state::port18_r ) -{ - UINT8 i, data = m_mbee256_q[0]; // get oldest key - - if (m_mbee256_q_pos) - { - m_mbee256_q_pos--; - for (i = 0; i < m_mbee256_q_pos; i++) m_mbee256_q[i] = m_mbee256_q[i+1]; // ripple queue - } - - m_b2 = 0; // clear irq - return data; -} - - -/*********************************************************** - - 256TC Change CPU speed - -************************************************************/ - -READ8_MEMBER( mbee_state::speed_low_r ) -{ - m_maincpu->set_unscaled_clock(3375000); - return 0xff; -} - -READ8_MEMBER( mbee_state::speed_high_r ) -{ - m_maincpu->set_unscaled_clock(6750000); - return 0xff; -} - - - -/*********************************************************** - - 256TC Real Time Clock - -************************************************************/ - -WRITE8_MEMBER( mbee_state::port04_w ) // address -{ - m_rtc->write(space, 0, data); -} - -WRITE8_MEMBER( mbee_state::port06_w ) // write -{ - m_rtc->write(space, 1, data); -} - -READ8_MEMBER( mbee_state::port07_r ) // read -{ - return m_rtc->read(space, 1); -} - -// See it work: Run mbeett, choose RTC in the config switches, run the F3 test, press Esc. -WRITE_LINE_MEMBER( mbee_state::rtc_irq_w ) -{ - m_b7_rtc = (state) ? 0 : 1; // inverted by IC15 (pins 8,9,10) - - if ((m_io_config->read() & 0xc0) == 0x40) // RTC selected in config menu - m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); -} - - -/*********************************************************** - - 256TC Memory Banking - - Selection of ROM, RAM, and video access by the CPU is controlled by U39, - a PAL14L8. When read as an ordinary rom it is 16k in size. The dumper has - arranged the pins as (bit0,1,..) (input = 1,23,2,3,4,5,6,7,8,9,10,11,14,13) - and (output = 22,21,20,19,18,17,16,15). The prom is also used to control - the refresh required by the dynamic rams, however we ignore this function. - - b_mask = total dynamic ram (1=64k; 3=128k; 7=256k) - - Certain software (such as the PJB system) constantly switch banks around, - causing slowness. Therefore this function only changes the banks that need - changing, leaving the others as is. - -************************************************************/ - -void mbee_state::setup_banks(UINT8 data, bool first_time, UINT8 b_mask) -{ - data &= 0x3f; // (bits 0-5 are referred to as S0-S5) - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT8 *prom = memregion("pals")->base(); - UINT8 b_data = BITSWAP8(data, 7,5,3,2,4,6,1,0) & 0x3b; // arrange data bits to S0,S1,-,S4,S2,S3 - UINT8 b_bank, b_byte, b_byte_t, b_addr, p_bank = 1; - UINT16 b_vid; - char banktag[10]; - - if (first_time || (b_data != m_bank_array[0])) // if same data as last time, leave now - { - m_bank_array[0] = b_data; - - for (b_bank = 0; b_bank < 16; b_bank++) - { - b_vid = b_bank << 12; - b_addr = BITSWAP8(b_bank, 7,4,5,3,1,2,6,0) & 0x1f; // arrange address bits to A12,-,A14,A13,A15 - - // Calculate read-bank - b_byte_t = prom[b_addr | (b_data << 8) | 0x82]; // read-bank (RDS and MREQ are low, RFSH is high) - b_byte = BITSWAP8(b_byte_t, 7,5,0,3,6,2,1,4); // rearrange so that bits 0-2 are rambank, bit 3 = rom select, bit 4 = video select, others not used - - if (first_time || (b_byte != m_bank_array[p_bank])) - { - m_bank_array[p_bank] = b_byte; - - if (!BIT(data, 5)) - b_byte &= 0xfb; // U42/1 - S17 only valid if S5 is on - - mem.unmap_read (b_vid, b_vid + 0xfff); - - if (!BIT(b_byte, 4)) - { - // select video - mem.install_read_handler (b_vid, b_vid + 0x7ff, read8_delegate(FUNC(mbee_state::video_low_r), this)); - mem.install_read_handler (b_vid + 0x800, b_vid + 0xfff, read8_delegate(FUNC(mbee_state::video_high_r), this)); - } - else - { - sprintf(banktag, "bankr%d", b_bank); - mem.install_read_bank( b_vid, b_vid+0xfff, banktag ); - - if (!BIT(b_byte, 3)) - membank(banktag)->set_entry(64 + (b_bank & 3)); // read from rom - else - membank(banktag)->set_entry((b_bank & 7) | ((b_byte & b_mask) << 3)); // ram - } - } - p_bank++; - - // Calculate write-bank - b_byte_t = prom[b_addr | (b_data << 8) | 0xc0]; // write-bank (XWR and MREQ are low, RFSH is high) - b_byte = BITSWAP8(b_byte_t, 7,5,0,3,6,2,1,4); // rearrange so that bits 0-2 are rambank, bit 3 = rom select, bit 4 = video select, others not used - - if (first_time || (b_byte != m_bank_array[p_bank])) - { - m_bank_array[p_bank] = b_byte; - - if (!BIT(data, 5)) - b_byte &= 0xfb; // U42/1 - S17 only valid if S5 is on - - mem.unmap_write (b_vid, b_vid + 0xfff); - - if (!BIT(b_byte, 4)) - { - // select video - mem.install_write_handler (b_vid, b_vid + 0x7ff, write8_delegate(FUNC(mbee_state::video_low_w), this)); - mem.install_write_handler (b_vid + 0x800, b_vid + 0xfff, write8_delegate(FUNC(mbee_state::video_high_w), this)); - } - else - { - sprintf(banktag, "bankw%d", b_bank); - mem.install_write_bank( b_vid, b_vid+0xfff, banktag ); - - if (!BIT(b_byte, 3)) - membank(banktag)->set_entry(64); // write to rom dummy area - else - membank(banktag)->set_entry((b_bank & 7) | ((b_byte & b_mask) << 3)); // ram - } - } - p_bank++; - } - } -} - -WRITE8_MEMBER( mbee_state::mbee256_50_w ) -{ - setup_banks(data, 0, 7); -} - -/*********************************************************** - - 128k Memory Banking - - The only difference to the 256TC is that bit 5 switches - between rom2 and rom3. Since neither of these is dumped, - this bit is not emulated. If it was, this scheme is used: - - Low - rom2 occupies C000-FFFF - High - ram = C000-DFFF, rom3 = E000-FFFF. - -************************************************************/ - -WRITE8_MEMBER( mbee_state::mbee128_50_w ) -{ - setup_banks(data, 0, 3); -} - -/*********************************************************** - - ROM Banking on older models - - Set A to 0 or 1 then read the port to switch between the - halves of the Telcom ROM. - - Output the PAK number to choose an optional PAK ROM. - - The bios will support 256 PAKs, although normally only - 8 are available in hardware. Each PAK is normally a 4K - ROM. If 8K ROMs are used, the 2nd half becomes PAK+8, - thus 16 PAKs in total. This is used in the PC85 models. - -************************************************************/ - -WRITE8_MEMBER( mbee_state::port0a_w ) -{ - m_0a = data; - - if (m_pak) - m_pak->set_entry(data & 15); -} - -READ8_MEMBER( mbee_state::telcom_low_r ) -{ -/* Read of port 0A - set Telcom rom to first half */ - if (m_telcom) - m_telcom->set_entry(0); - - return m_0a; -} - -READ8_MEMBER( mbee_state::telcom_high_r ) -{ -/* Read of port 10A - set Telcom rom to 2nd half */ - if (m_telcom) - m_telcom->set_entry(1); - - return m_0a; -} - - -/*********************************************************** - - Machine - -************************************************************/ - -/* - On reset or power on, a circuit forces rom 8000-8FFF to appear at 0000-0FFF, while ram is disabled. - It gets set back to normal on the first attempt to write to memory. (/WR line goes active). -*/ - - -void mbee_state::machine_reset_common() -{ - m_fdc_rq = 0; - m_08 = 0; - m_0a = 0; - m_0b = 0; - m_1c = 0; - - if (m_basic) - m_basic->set_entry(0); - - if (m_telcom) - m_telcom->set_entry(0); -} - -MACHINE_RESET_MEMBER( mbee_state, mbee ) -{ - machine_reset_common(); - m_maincpu->set_pc(0x8000); -} - -MACHINE_RESET_MEMBER( mbee_state, mbee56 ) -{ - machine_reset_common(); - m_maincpu->set_pc(0xE000); -} - -MACHINE_RESET_MEMBER( mbee_state, mbee128 ) -{ - machine_reset_common(); - setup_banks(0, 1, 3); // set banks to default - m_maincpu->set_pc(0x8000); -} - -MACHINE_RESET_MEMBER( mbee_state, mbee256 ) -{ - m_mbee256_q_pos = 0; - machine_reset_common(); - setup_banks(0, 1, 7); // set banks to default - m_maincpu->set_pc(0x8000); -} - -MACHINE_RESET_MEMBER( mbee_state, mbeett ) -{ - m_mbee256_q_pos = 0; - machine_reset_common(); - m_maincpu->set_pc(0x8000); -} - -DRIVER_INIT_MEMBER( mbee_state, mbee ) -{ - m_size = 0x8000; - m_has_oldkb = 1; -} - -DRIVER_INIT_MEMBER( mbee_state, mbeeic ) -{ - UINT8 *RAM = memregion("pakrom")->base(); - m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); - m_pak->set_entry(0); - - m_size = 0x8000; - m_has_oldkb = 1; -} - -DRIVER_INIT_MEMBER( mbee_state, mbeepc ) -{ - UINT8 *RAM = memregion("telcomrom")->base(); - m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000); - - RAM = memregion("pakrom")->base(); - m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); - m_pak->set_entry(0); - - m_size = 0x8000; - m_has_oldkb = 1; -} - -DRIVER_INIT_MEMBER( mbee_state, mbeepc85 ) -{ - UINT8 *RAM = memregion("telcomrom")->base(); - m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000); - - RAM = memregion("pakrom")->base(); - m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); - m_pak->set_entry(5); - - m_size = 0x8000; - m_has_oldkb = 1; -} - -DRIVER_INIT_MEMBER( mbee_state, mbeeppc ) -{ - UINT8 *RAM = memregion("basicrom")->base(); - m_basic->configure_entries(0, 2, &RAM[0x0000], 0x2000); - - RAM = memregion("telcomrom")->base(); - m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000); - - RAM = memregion("pakrom")->base(); - m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); - m_pak->set_entry(5); - - m_size = 0x8000; - m_has_oldkb = 1; -} - -DRIVER_INIT_MEMBER( mbee_state, mbee56 ) -{ - m_size = 0xe000; - m_has_oldkb = 1; -} - -DRIVER_INIT_MEMBER( mbee_state, mbee128 ) -{ - UINT8 *RAM = memregion("rams")->base(); - UINT8 *ROM = memregion("roms")->base(); - char banktag[10]; - - for (UINT8 b_bank = 0; b_bank < 16; b_bank++) - { - sprintf(banktag, "bankr%d", b_bank); - membank(banktag)->configure_entries(0, 32, &RAM[0x0000], 0x1000); // RAM banks - membank(banktag)->configure_entries(64, 4, &ROM[0x0000], 0x1000); // rom - - sprintf(banktag, "bankw%d", b_bank); - membank(banktag)->configure_entries(0, 32, &RAM[0x0000], 0x1000); // RAM banks - membank(banktag)->configure_entries(64, 1, &ROM[0x4000], 0x1000); // dummy rom - } - - m_size = 0x8000; - m_has_oldkb = 1; -} - -DRIVER_INIT_MEMBER( mbee_state, mbee256 ) -{ - UINT8 *RAM = memregion("rams")->base(); - UINT8 *ROM = memregion("roms")->base(); - char banktag[10]; - - for (UINT8 b_bank = 0; b_bank < 16; b_bank++) - { - sprintf(banktag, "bankr%d", b_bank); - membank(banktag)->configure_entries(0, 64, &RAM[0x0000], 0x1000); // RAM banks - membank(banktag)->configure_entries(64, 4, &ROM[0x0000], 0x1000); // rom - - sprintf(banktag, "bankw%d", b_bank); - membank(banktag)->configure_entries(0, 64, &RAM[0x0000], 0x1000); // RAM banks - membank(banktag)->configure_entries(64, 1, &ROM[0x4000], 0x1000); // dummy rom - } - - timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB); /* kick-start timer for kbd */ - - m_size = 0x8000; - m_has_oldkb = 0; -} - -DRIVER_INIT_MEMBER( mbee_state, mbeett ) -{ - UINT8 *RAM = memregion("telcomrom")->base(); - m_telcom->configure_entries(0, 2, &RAM[0x0000], 0x1000); - - RAM = memregion("pakrom")->base(); - m_pak->configure_entries(0, 16, &RAM[0x0000], 0x2000); - m_pak->set_entry(5); - - timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB); /* kick-start timer for kbd */ - - m_size = 0x8000; - m_has_oldkb = 0; -} - - -/*********************************************************** - - Quickload - - These load the standard BIN format, as well - as BEE, COM and MWB files. - -************************************************************/ - -QUICKLOAD_LOAD_MEMBER( mbee_state, mbee ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT16 i, j; - UINT8 data, sw = m_io_config->read() & 1; /* reading the config switch: 1 = autorun */ - - if (!core_stricmp(image.filetype(), "mwb")) - { - /* mwb files - standard basic files */ - for (i = 0; i < quickload_size; i++) - { - j = 0x8c0 + i; - - if (image.fread(&data, 1) != 1) - { - image.message("Unexpected EOF"); - return IMAGE_INIT_FAIL; - } - - if ((j < m_size) || (j > 0xefff)) - space.write_byte(j, data); - else - { - image.message("Not enough memory in this microbee"); - return IMAGE_INIT_FAIL; - } - } - - if (sw) - { - space.write_word(0xa2,0x801e); /* fix warm-start vector to get around some copy-protections */ - m_maincpu->set_pc(0x801e); - } - else - space.write_word(0xa2,0x8517); - } - else if (!core_stricmp(image.filetype(), "com")) - { - /* com files - most com files are just machine-language games with a wrapper and don't need cp/m to be present */ - for (i = 0; i < quickload_size; i++) - { - j = 0x100 + i; - - if (image.fread(&data, 1) != 1) - { - image.message("Unexpected EOF"); - return IMAGE_INIT_FAIL; - } - - if ((j < m_size) || (j > 0xefff)) - space.write_byte(j, data); - else - { - image.message("Not enough memory in this microbee"); - return IMAGE_INIT_FAIL; - } - } - - if (sw) m_maincpu->set_pc(0x100); - } - else if (!core_stricmp(image.filetype(), "bee")) - { - /* bee files - machine-language games that start at 0900 */ - for (i = 0; i < quickload_size; i++) - { - j = 0x900 + i; - - if (image.fread(&data, 1) != 1) - { - image.message("Unexpected EOF"); - return IMAGE_INIT_FAIL; - } - - if ((j < m_size) || (j > 0xefff)) - space.write_byte(j, data); - else - { - image.message("Not enough memory in this microbee"); - return IMAGE_INIT_FAIL; - } - } - - if (sw) m_maincpu->set_pc(0x900); - } - - return IMAGE_INIT_PASS; -} - - -/*------------------------------------------------- - QUICKLOAD_LOAD_MEMBER( mbee_state, mbee_z80bin ) --------------------------------------------------*/ - -QUICKLOAD_LOAD_MEMBER( mbee_state, mbee_z80bin ) -{ - UINT16 execute_address, start_addr, end_addr; - int autorun; - address_space &space = m_maincpu->space(AS_PROGRAM); - - /* load the binary into memory */ - if (z80bin_load_file(&image, space, file_type, &execute_address, &start_addr, &end_addr) == IMAGE_INIT_FAIL) - return IMAGE_INIT_FAIL; - - /* is this file executable? */ - if (execute_address != 0xffff) - { - /* check to see if autorun is on */ - autorun = m_io_config->read() & 1; - - space.write_word(0xa6, execute_address); /* fix the EXEC command */ - - if (autorun) - { - space.write_word(0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */ - m_maincpu->set_pc(execute_address); - } - else - { - space.write_word(0xa2, 0x8517); - } - } - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/mboard.c b/src/mess/machine/mboard.c deleted file mode 100644 index 1ea5963a3ab..00000000000 --- a/src/mess/machine/mboard.c +++ /dev/null @@ -1,568 +0,0 @@ -// license:??? -// copyright-holders:Ralf Schaefer, Cowering -/********************************************************************** - - Mephisto Chess Computers - -**********************************************************************/ -#include "emu.h" -#include "includes/mboard.h" -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -#define IsPiece(x) ((m_board[x] >=1) && (m_board[x] <=12)) - -const int mboard_state::start_board[64] = -{ - BR, BN, BB, BQ, BK, BB, BN, BR, - BP, BP, BP, BP, BP, BP, BP, BP, - EM, EM, EM, EM, EM, EM, EM, EM, - EM, EM, EM, EM, EM, EM, EM, EM, - EM, EM, EM, EM, EM, EM, EM, EM, - EM, EM, EM, EM, EM, EM, EM, EM, - WP, WP, WP, WP, WP, WP, WP, WP, - WR, WN, WB, WQ, WK, WB, WN, WR -}; - -UINT8 mboard_state::border_pieces[12] = {WK,WQ,WR,WB,WN,WP,BK,BQ,BR,BB,BN,BP,}; - - -int mboard_state::get_first_bit(UINT8 data) -{ - int i; - - for (i = 0; i < 8; i++) - if (BIT(data, i)) - return i; - - return NOT_VALID; -} - - -inline UINT8 mboard_state::pos_to_num(UINT8 val) -{ - switch (val) - { - case 0xfe: return 7; - case 0xfd: return 6; - case 0xfb: return 5; - case 0xf7: return 4; - case 0xef: return 3; - case 0xdf: return 2; - case 0xbf: return 1; - case 0x7f: return 0; - default: return 0xff; - } -} - -int mboard_state::get_first_cleared_bit(UINT8 data) -{ - int i; - - for (i=0;i<8;i++) - if (!BIT(data, i)) - return i; - - return NOT_VALID; -} - -UINT8 mboard_state::read_board() -{ - UINT8 i_18, i_AH; - UINT8 data; - - data = 0xff; - -/* - -Example board scan: -Starting postion and pawn on E2 is lifted - - -mask: 7f 0111 1111 Line 8 -data: 0 0000 0000 all fields occupied -mask: bf 1011 1111 Line 7 -data: 0 0000 0000 all fields occupied -mask: df 1101 1111 Line 6 -data: ff 1111 1111 all fields empty -mask: ef 1110 1111 Line 5 -data: ff 1111 1111 all fields empty -mask: f7 1111 0111 Line 4 -data: ff 1111 1111 all fields empty -mask: fb 1111 1011 Line 3 -data: ff 1111 1111 all fields empty -mask: fd 1111 1101 Line 2 -data: 10 0001 0000 E2 is empty rest is occupied -mask: fe 1111 1110 Line 1 -data: 0 0000 0000 all fields occupied - - -*/ - -/* looking for cleared bit in mask Line18_REED => current line */ - - if (data && Line18_REED) - { - i_18 = get_first_cleared_bit(Line18_REED); - - if (i_18 == NOT_VALID) - printf("No cleared bit in mask Line18_REED!\n"); - else - { - /* looking for a piece in this line and clear bit in data if found */ - - for (i_AH = 0; i_AH < 8; i_AH = i_AH + 1) - if (IsPiece(64 - (i_18 * 8 + 8 - i_AH))) - data &= ~(1 << i_AH); // clear bit - - read_board_flag = TRUE; - } - } - - return data; -} - - -void mboard_state::write_board(UINT8 data) -{ - Line18_REED=data; - - if (read_board_flag && !strcmp(machine().system().name,"glasgow") ) //HACK - Line18_LED = 0; - else - Line18_LED = data; - - read_board_flag = FALSE; - - if (data == 0xff) - mboard_key_selector = 0; -} - - - -void mboard_state::write_LED(UINT8 data) -{ - int i; - UINT8 i_AH, i_18; - UINT8 LED; - - mboard_lcd_invert = 1; -/* - -Example: turn led E2 on - -mask: fd 1111 1101 Line 2 -data: 10 0001 0000 Line E - -*/ - - for (i=0; i < 64; i++) /* all LED's off */ - output_set_led_value(i, 0); - - if (Line18_LED) - { - for (i_AH = 0; i_AH < 8; i_AH++) /* turn LED on depending on bit masks */ - { - if (BIT(data,i_AH)) - { - for (i_18 = 0; i_18 < 8; i_18++) - { - LED = (i_18*8 + 8-i_AH-1); - if (!(Line18_LED & (1 << i_18))) /* cleared bit */ - output_set_led_value(LED, 1); - //else - // output_set_led_value(LED, 0); - } - } - } - } - -} - - - -READ8_MEMBER(mboard_state::mboard_read_board_8) -{ - UINT8 data; - - data=read_board(); - logerror("Read Board Port Data = %d\n ",data); - return data; -} - -READ16_MEMBER(mboard_state::mboard_read_board_16) -{ - UINT8 data; - - data=read_board(); - return data << 8; -} - -READ32_MEMBER(mboard_state::mboard_read_board_32) -{ - UINT8 data; - - data=read_board(); - return data<<24; -} - -WRITE8_MEMBER(mboard_state::mboard_write_board_8) -{ - write_board(data); - logerror("Write Board Port Data = %02x\n",data); -} - -WRITE16_MEMBER(mboard_state::mboard_write_board_16) -{ - if (data & 0xff) write_board(data); - logerror("write board 16 %08x\n",data); - write_board(data>>8); -} - -WRITE32_MEMBER(mboard_state::mboard_write_board_32) -{ -// data |= data << 24; -//printf("write board %08x %08x\n",offset,data); - logerror("write board 32 o: %08x d: %08x\n",offset,data); - if (offset) write_board(data); - else write_board(data>>24); -} - -WRITE8_MEMBER(mboard_state::mboard_write_LED_8) -{ - write_LED(data); - space.device().execute().spin_until_time(attotime::from_usec(7)); -} - -WRITE16_MEMBER(mboard_state::mboard_write_LED_16) -{ - write_LED(data >> 8); - space.device().execute().spin_until_time(attotime::from_usec(9)); -} - -WRITE32_MEMBER(mboard_state::mboard_write_LED_32) -{ -// data = data | data << 24; -//printf("write LED %08x %08x\n",offset,data); - if (offset) write_LED(data); - else write_LED(data >> 24); - logerror("write LED 32 o: %08x d: %08x\n",offset,data); -// space.device().execute().spin_until_time(ATTOTIME_IN_USEC(20)); -} - - -/* save states callback */ - -void mboard_state::board_presave() -{ - int i; - for (i=0;i<64;i++) - save_board[i]=m_board[i]; -} - -void mboard_state::board_postload() -{ - int i; - for (i=0;i<64;i++) - m_board[i]=save_board[i]; - -} - -void mboard_state::mboard_savestate_register() -{ - save_item(NAME(save_board)); - machine().save().register_postload(save_prepost_delegate(FUNC(mboard_state::board_postload),this)); - machine().save().register_presave(save_prepost_delegate(FUNC(mboard_state::board_presave),this)); -} - -void mboard_state::mboard_set_board() -{ - read_board_flag = TRUE; - int i; - for (i=0;i<64;i++) - m_board[i]=start_board[i]; -} - -void mboard_state::clear_board() -{ - int i; - for (i=0;i<64;i++) - m_board[i]=EM; -} - -void mboard_state::set_artwork() -{ - int i; - for (i=0;i<64;i++) - output_set_indexed_value("P", i, m_board[i]); -} - -void mboard_state::mboard_set_border_pieces() -{ - int i; - for (i=0;i<12;i++) - output_set_indexed_value("Q", i, border_pieces[i]); -} - -TIMER_DEVICE_CALLBACK_MEMBER(mboard_state::mboard_update_artwork ) -{ - check_board_buttons(); - set_artwork(); - mboard_set_border_pieces(); -} - -void mboard_state::check_board_buttons() -{ - int field; - int i; - UINT8 port_input=0; - UINT8 data = 0xff; - static UINT8 board_row = 0; - static UINT16 mouse_down = 0; - UINT8 pos2num_res = 0; - board_row++; - board_row &= 7; - int click_on_border_piece=FALSE; - - -/* check click on border pieces */ - i=0; - port_input = m_b_black->read(); - if (port_input) - { - i=get_first_bit(port_input)+6; - click_on_border_piece=TRUE; - } - - port_input = m_b_white->read(); - if (port_input) - { - i=get_first_bit(port_input); - click_on_border_piece=TRUE; - } - - if (click_on_border_piece) - { - if (!mouse_down) - { - if (border_pieces[i] > 12 ) /* second click on selected border piece */ - { - mouse_hold_border_piece=FALSE; - border_pieces[i]=border_pieces[i]-12; - mouse_hold_from=0; - mouse_hold_piece=0; - } - else if (!mouse_hold_piece) /*select border piece */ - { - if (mouse_hold_border_piece) - border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12; - - mouse_hold_from=i; - mouse_hold_piece=border_pieces[i]; - border_pieces[i]=border_pieces[i]+12; - mouse_hold_border_piece=TRUE; - } - - mouse_down = board_row + 1; - - } - return; - } - - -/* check click on board */ - data = m_line[board_row]->read(); - - if ((data != 0xff) && (!mouse_down) ) - { - pos2num_res = pos_to_num(data); - field=64-(board_row*8+8-pos2num_res); - - - if (!(pos2num_res < 8)) - logerror("Position out of bound!"); - - else if ((mouse_hold_piece) && (!IsPiece(field))) - { - /* Moving a piece onto a blank */ - m_board[field] = mouse_hold_piece; - - if (mouse_hold_border_piece) - { - border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12; - }else if ( field != mouse_hold_from ) /* Put a selected piece back to the source field */ - m_board[mouse_hold_from] = 0; - - - mouse_hold_from = 0; - mouse_hold_piece = 0; - mouse_hold_border_piece=FALSE; - } - else if ((!mouse_hold_piece) ) - { - /* Picking up a piece */ - - if (IsPiece(field)) - { - mouse_hold_from = field; - mouse_hold_piece = m_board[field]; - m_board[field] = m_board[field]+12; - } - - } - - mouse_down = board_row + 1; - } - else if ((data == 0xff) && (mouse_down == (board_row + 1))) /* Wait for mouse to be released */ - mouse_down = 0; - -/* check click on border - remove selected piece*/ - if (m_line10->read()) - { - if (mouse_hold_piece) - { - if (mouse_hold_border_piece) - border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12; - else - m_board[mouse_hold_from] = 0; - - mouse_hold_from = 0; - mouse_hold_piece = 0; - mouse_hold_border_piece = FALSE; - } - - return; - } - -/* check additional buttons */ - if (data == 0xff) - { - port_input = m_b_buttons->read(); - if (port_input==0x01) - { - clear_board(); - return; - }else if (port_input==0x02) - { - mboard_set_board(); - return; - } - - - } - -} - -extern INPUT_PORTS_START( chessboard ) - - PORT_START("LINE.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE.1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE.3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE.4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE.5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE.6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE.7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("LINE10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_WHITE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_BLACK") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_BUTTONS") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("MOUSE_X") - PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) - - PORT_START("MOUSE_Y") - PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) - - PORT_START("BUTTON_L") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("left button") - - PORT_START("BUTTON_R") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("right button") - - -INPUT_PORTS_END diff --git a/src/mess/machine/mc80.c b/src/mess/machine/mc80.c deleted file mode 100644 index d96f2c3cbaa..00000000000 --- a/src/mess/machine/mc80.c +++ /dev/null @@ -1,134 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - MC-80.xx by Miodrag Milanovic - - 15/05/2009 Initial implementation - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -#include "includes/mc80.h" - -/*****************************************************************************/ -/* Implementation for MC80.2x */ -/*****************************************************************************/ - -IRQ_CALLBACK_MEMBER(mc80_state::mc8020_irq_callback) -{ - return 0x00; -} - -MACHINE_RESET_MEMBER(mc80_state,mc8020) -{ -} - -WRITE_LINE_MEMBER( mc80_state::ctc_z0_w ) -{ -} - -WRITE_LINE_MEMBER( mc80_state::ctc_z1_w ) -{ -} - -WRITE_LINE_MEMBER(mc80_state::ctc_z2_w) -{ - downcast(machine().device("z80ctc"))->trg0(state); - downcast(machine().device("z80ctc"))->trg1(state); -} - -READ8_MEMBER( mc80_state::mc80_port_b_r ) -{ - return 0; -} - -READ8_MEMBER( mc80_state::mc80_port_a_r ) -{ - return 0; -} - -WRITE8_MEMBER( mc80_state::mc80_port_a_w ) -{ -} - -WRITE8_MEMBER( mc80_state::mc80_port_b_w ) -{ -} - -/*****************************************************************************/ -/* Implementation for MC80.3x */ -/*****************************************************************************/ - -WRITE8_MEMBER( mc80_state::mc8030_zve_write_protect_w ) -{ -} - -WRITE8_MEMBER( mc80_state::mc8030_vis_w ) -{ - // reg C - // 7 6 5 4 -- module - // 3 - 0 left half, 1 right half - // 2 1 0 - // ===== - // 0 0 0 - dark - // 0 0 1 - light - // 0 1 0 - in reg pixel - // 0 1 1 - negate in reg pixel - // 1 0 x - operation code in B reg - // reg B - // - UINT16 addr = ((offset & 0xff00) >> 2) | ((offset & 0x08) << 2) | (data >> 3); - static const UINT8 val[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; - int c = offset & 1; - m_p_videoram[addr] = m_p_videoram[addr] | (val[data & 7]*c); -} - -WRITE8_MEMBER( mc80_state::mc8030_eprom_prog_w ) -{ -} - -IRQ_CALLBACK_MEMBER(mc80_state::mc8030_irq_callback ) -{ - return 0x20; -} - -MACHINE_RESET_MEMBER(mc80_state,mc8030) -{ -} - -READ8_MEMBER( mc80_state::zve_port_a_r ) -{ - return 0xff; -} - -READ8_MEMBER( mc80_state::zve_port_b_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( mc80_state::zve_port_a_w ) -{ -} - -WRITE8_MEMBER( mc80_state::zve_port_b_w ) -{ -} - -READ8_MEMBER( mc80_state::asp_port_a_r ) -{ - return 0xff; -} - -READ8_MEMBER( mc80_state::asp_port_b_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( mc80_state::asp_port_a_w ) -{ -} - -WRITE8_MEMBER( mc80_state::asp_port_b_w ) -{ -} diff --git a/src/mess/machine/mega32x.c b/src/mess/machine/mega32x.c deleted file mode 100644 index 8c60160097d..00000000000 --- a/src/mess/machine/mega32x.c +++ /dev/null @@ -1,1957 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -/* Megadrive / Genesis 32X emulation */ - -/* - - Fix 32X support (not used by any arcade systems?) - - this seems to require far greater sync and timing accuracy on rom / ram access than MAME can provide - - split NTSC / PAL drivers - - 36greatju: missing backup ram, has issues with golfer select due of that - - bcracers: write to undefined PWM register? - - fifa96 / nbajamte: dies on the gameplay, waiting for a comm change that never occurs; - - marsch1: doesn't boot, Master / Slave communicates through SCI - - nbajamte: missing I2C hookup, startup fails due of that (same I2C type as plain MD version); - - nflquart: black screen, missing h irq? - - sangoku4: black screen after the Sega logo - - soulstar: OSD and player sprite isn't drawn; - - tempo: intro is too fast, mostly noticeable with the PWM sound that cuts off too early when it gets to the title screen; - - tmek: gameplay is clearly too fast - - vrdxu: has 3d geometry bugs, caused by a SH-2 DRC bug; - - vrdxu: crashes if you attempt to enter into main menu; - - wwfraw: writes fb data to the cart area and expects it to be read back, kludging the cart area to be writeable makes the 32x gfxs to appear, why? - - wwfwre: no 32x gfxs - - xmen: black screen after that you choose the level, needs bare minimum SH-2 SCI support - - -32x Marsch tests documentation (keep start pressed at start-up for individual tests): - -MD side check: -#1 Communication Check -#2 FM Bit -#3 Irq Register -#4 Bank Control Register -#5 DREQ Control FULL bit -#6 DREQ SRC Address -#7 DREQ DST Address -#8 DREQ SIZE Address -#9 SEGA TV Register -#10 H IRQ Vector -#11 PWM Control Register -#12 PWM Frequency Register -#13 PWM Lch Pulse Width Register -#14 PWM Rch Pulse Width Register -#15 PWM MONO Pulse Width Register -32x side check: -#16 SH-2 Master Communication Check -#17 SH-2 Slave Communication Check -#18 SH-2 Master FM Bit -#19 SH-2 Slave FM Bit -#20 SH-2 Master IRQ Mask Register -#21 SH-2 Slave IRQ Mask Register -#22 SH-2 Master H Counter Register -#23 SH-2 Slave H Counter Register -#24 SH-2 Master PWM Timer Register -#25 SH-2 Slave PWM Timer Register -#26 SH-2 Master PWM Cont. Register -#27 SH-2 Slave PWM Cont. Register -#28 SH-2 Master PWM Freq. Register -#29 SH-2 Slave PWM Freq. Register -#30 SH-2 Master PWM Lch Register -#31 SH-2 Slave PWM Lch Register -#32 SH-2 Master PWM Rch Register -#33 SH-2 Slave PWM Rch Register -#34 SH-2 Master PWM Mono Register -#35 SH-2 Slave PWM Mono Register -#36 SH-2 Master ROM Read Check -#37 SH-2 Slave ROM Read Check -#38 SH-2 Serial Communication (ERROR - returns a Timeout Error) -MD & 32x check: -#39 MD&SH-2 Master Communication -#40 MD&SH-2 Slave Communication -#41 MD&SH-2 Master FM Bit R/W -#42 MD&SH-2 Slave FM Bit R/W -#43 MD&SH-2 Master DREQ CTL -#44 MD&SH-2 Slave DREQ CTL -#45 MD&SH-2 Master DREQ SRC address -#46 MD&SH-2 Slave DREQ SRC address -#47 MD&SH-2 Master DREQ DST address -#48 MD&SH-2 Slave DREQ DST address -#49 MD&SH-2 Master DREQ SIZE address -#50 MD&SH-2 Slave DREQ SIZE address -#51 SH-2 Master V IRQ -#52 SH-2 Slave V IRQ -#53 SH2 Master H IRQ (MD 0) -#54 SH2 Slave H IRQ (MD 0) -#55 SH2 Master H IRQ (MD 1) -#56 SH2 Slave H IRQ (MD 1) -#57 SH2 Master H IRQ (MD 2) -#58 SH2 Slave H IRQ (MD 2) -MD VDP check: -#59 Bitmap Mode Register -#60 Shift Register -#61 Auto Fill Length Register -#62 Auto Fill Start Address Register -#63 V Blank BIT -#64 H Blank BIT -#65 Palette Enable BIT -SH-2 VDP check: -#66 Frame Swap BIT -#67 SH-2 Master Bitmap MD -#68 SH-2 Slave Bitmap MD -#69 SH-2 Master Shift -#70 SH-2 Slave Shift -#71 SH-2 Master Fill SIZE -#72 SH-2 Slave Fill SIZE -#73 SH-2 Master Fill START -#74 SH-2 Slave Fill START -#75 SH-2 Master V Blank Bit -#76 SH-2 Slave V Blank Bit -#77 SH-2 Master H Blank Bit -#78 SH-2 Slave H Blank Bit -#79 SH-2 Master Palette Enable Bit -#80 SH-2 Slave Palette Enable Bit -#81 SH-2 Master Frame Swap Bit -#82 SH-2 Slave Frame Swap Bit -Framebuffer Check: -#83 MD Frame Buffer 0 -#84 MD Frame Buffer 1 -#85 SH-2 Master Frame Buffer 0 -#86 SH-2 Slave Frame Buffer 0 -#87 SH-2 Master Frame Buffer 1 -#88 SH-2 Slave Frame Buffer 1 -#89 MD Frame Buffer 0 Overwrite -#90 MD Frame Buffer 1 Overwrite -#91 MD Frame Buffer 0 Byte Write -#92 MD Frame Buffer 1 Byte Write -#93 SH-2 Master Frame Buffer 0 Overwrite -#94 SH-2 Slave Frame Buffer 0 Overwrite -#95 SH-2 Master Frame Buffer 1 Overwrite -#96 SH-2 Slave Frame Buffer 1 Overwrite -#97 SH-2 Master Frame Buffer 0 Byte Write -#98 SH-2 Slave Frame Buffer 0 Byte Write -#99 SH-2 Master Frame Buffer 1 Byte Write -#100 SH-2 Slave Frame Buffer 1 Byte Write -#101 MD Frame Buffer 0 Fill Data -#102 MD Frame Buffer 1 Fill Data -#103 MD Frame Buffer 0 Fill Length & Address -#104 MD Frame Buffer 1 Fill Length & Address -#105 SH-2 Master Frame Buffer 0 Fill Data -#106 SH-2 Slave Frame Buffer 0 Fill Data -#107 SH-2 Master Frame Buffer 1 Fill Data -#108 SH-2 Slave Frame Buffer 1 Fill Data -#109 SH-2 Master Frame Buffer 0 Fill Address -#110 SH-2 Slave Frame Buffer 0 Fill Address -#111 SH-2 Master Frame Buffer 1 Fill Address -#112 SH-2 Slave Frame Buffer 1 Fill Address -#113 MD Palette R/W (Blank Mode) -#114 MD Palette R/W (Display Mode) -#115 MD Palette R/W (Fill Mode) -#116 SH-2 Master Palette R/W (Blank Mode) -#117 SH-2 Slave Palette R/W (Blank Mode) -#118 SH-2 Master Palette R/W (Display Mode) -#119 SH-2 Slave Palette R/W (Display Mode) -#120 SH-2 Master Palette R/W (Fill Mode) -#121 SH-2 Slave Palette R/W (Fill Mode) -MD or SH-2 DMA check: -#122 SH-2 Master CPU Write DMA (68S) (ERROR) -#123 SH-2 Slave CPU Write DMA (68S) (ERROR) -#124 MD ROM to VRAM DMA (asserts after this) ------ -#127 SH-2 Master ROM to SDRAM DMA -#128 SH-2 Slave ROM to SDRAM DMA -#129 SH-2 Master ROM to Frame DMA -#130 SH-2 Slave ROM to Frame DMA -#131 SH-2 Master SDRAM to Frame DMA -#132 SH-2 Slave SDRAM to Frame DMA -#133 SH-2 Master Frame to SDRAM DMA -#134 SH-2 Slave Frame to SDRAM DMA -Sound Test (these don't explicitly fails): -#135 MD 68k Monaural Sound -#136 MD 68k L Sound -#137 MD 68k R Sound -#138 MD 68k L -> R Sound -#139 MD 68k R -> L Sound -#140 SH-2 Master Monaural Sound -#141 SH-2 Master L Sound -#142 SH-2 Master R Sound -#143 SH-2 Master L -> R Pan -#144 SH-2 Master R -> L Pan -#145 SH-2 Slave Monaural Sound -#146 SH-2 Slave L Sound -#147 SH-2 Slave R Sound -#148 SH-2 Slave L -> R Pan -#149 SH-2 Slave R -> L Pan -#150 SH-2 Master PWM Interrupt -#151 SH-2 Slave PWM Interrupt -#152 SH-2 Master PWM DMA Write (!) -#153 SH-2 Slave PWM DMA Write (!) -#154 Z80 PWM Monaural Sound (!) -#155 Z80 PWM L Sound (!) -#156 Z80 PWM R Sound (!) -GFX check (these don't explicitly fails): -#157 Direct Color Mode -#158 Packed Pixel Mode -#159 Runlength Mode -#160 Runlength Mode -#161 Runlength Mode - -*/ -#include "emu.h" -#include "machine/mega32x.h" - - -const device_type SEGA_32X_NTSC = &device_creator; -const device_type SEGA_32X_PAL = &device_creator; - -sega_32x_device::sega_32x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - m_master_cpu(*this, "32x_master_sh2"), - m_slave_cpu(*this, "32x_slave_sh2"), - m_lch_pwm(*this, "lch_pwm"), - m_rch_pwm(*this, "rch_pwm"), - m_sh2_shared(*this, "sh2_shared"), - m_palette(*this) -{ -} - -sega_32x_ntsc_device::sega_32x_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : sega_32x_device(mconfig, SEGA_32X_NTSC, "sega_32x_ntsc", tag, owner, clock, "sega_32x_ntsc", __FILE__) -{ -} - -sega_32x_pal_device::sega_32x_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : sega_32x_device(mconfig, SEGA_32X_PAL, "sega_32x_pal", tag, owner, clock, "sega_32x_pal", __FILE__) -{ -} - -//------------------------------------------------- -// static_set_palette_tag: Set the tag of the -// palette device -//------------------------------------------------- - -void sega_32x_device::static_set_palette_tag(device_t &device, const char *tag) -{ - downcast(device).m_palette.set_tag(tag); -} - -TIMER_CALLBACK( _32x_pwm_callback ); - - - -READ16_MEMBER( sega_32x_device::_32x_68k_palette_r ) -{ - return m_32x_palette[offset]; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_palette_w ) -{ - int r,g,b, p; - - COMBINE_DATA(&m_32x_palette[offset]); - data = m_32x_palette[offset]; - - r = ((data >> 0) & 0x1f); - g = ((data >> 5) & 0x1f); - b = ((data >> 10) & 0x1f); - p = ((data >> 15) & 0x01); // priority 'through' bit - - m_32x_palette_lookup[offset] = (r << 10) | (g << 5) | (b << 0) | (p << 15); - - m_palette->set_pen_color(offset+0x40,pal5bit(r),pal5bit(g),pal5bit(b)); - -} - -READ16_MEMBER( sega_32x_device::_32x_68k_dram_r ) -{ - return m_32x_access_dram[offset]; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_dram_w ) -{ - if ((mem_mask&0xffff) == 0xffff) - { - // 16-bit accesses are normal - COMBINE_DATA(&m_32x_access_dram[offset]); - } - else - { - // 8-bit writes act as if they were going to the overwrite region! - // bc-racers and world series baseball rely on this! - // (tested on real hw) - - if ((mem_mask & 0xffff) == 0xff00) - { - if ((data & 0xff00) != 0x0000) - { - m_32x_access_dram[offset] = (data & 0xff00) | (m_32x_access_dram[offset] & 0x00ff); - } - } - else if ((mem_mask & 0xffff) == 0x00ff) - { - if ((data & 0x00ff) != 0x0000) - { - m_32x_access_dram[offset] = (data & 0x00ff) | (m_32x_access_dram[offset] & 0xff00); - } - } - } -} - -READ16_MEMBER( sega_32x_device::_32x_68k_dram_overwrite_r ) -{ - return m_32x_access_dram[offset]; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_dram_overwrite_w ) -{ - //COMBINE_DATA(&m_32x_access_dram[offset+0x10000]); - - if (ACCESSING_BITS_8_15) - { - if (data & 0xff00) - { - m_32x_access_dram[offset] = (m_32x_access_dram[offset]&0x00ff) | (data & 0xff00); - } - } - - if (ACCESSING_BITS_0_7) - { - if (data & 0x00ff) - { - m_32x_access_dram[offset] = (m_32x_access_dram[offset]&0xff00) | (data & 0x00ff); - } - } -} - -/**********************************************************************************************/ -// 68k side a15112 -// FIFO -/**********************************************************************************************/ - - - - -/* - -15106 DREQ - - ---- ---- F--- -K0R - - F = Fifo FULL - K = 68k CPU Write mode (0 = no, 1 = CPU write) - 0 = always 0? no, marsch test wants it to be latched or 1 - R = RV (0 = no operation, 1 = DMA Start allowed) <-- RV bit actually affects memory mapping, this is misleading.. it just sets the memory up in a suitable way to use the genesis VDP DMA - -*/ - - - - -READ16_MEMBER( sega_32x_device::_32x_68k_a15106_r ) -{ - UINT16 retval; - - retval = m_a15106_reg; - - if (m_fifo_block_a_full && m_fifo_block_b_full) retval |= 0x8080; - - return retval; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_a15106_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_a15106_reg = data & 0x7; - - if (m_a15106_reg & 0x1) /* NBA Jam TE relies on this */ - { - // install the game rom in the normal 0x000000-0x03fffff space used by the genesis - this allows VDP DMA operations to work as they have to be from this area or RAM - // it should also UNMAP the banked rom area... - space.install_rom(0x0000100, 0x03fffff, space.machine().root_device().memregion("gamecart")->base() + 0x100); - } - else - { - // we should be careful and map back any rom overlay (hint) and backup ram too I think... - - // this is actually blank / nop area - // we should also map the banked area back (we don't currently unmap it tho) - space.install_rom(0x0000100, 0x03fffff, space.machine().root_device().memregion("maincpu")->base()+0x100); - } - - if((m_a15106_reg & 4) == 0) // clears the FIFO state - { - m_current_fifo_block = m_fifo_block_a; - m_current_fifo_readblock = m_fifo_block_b; - m_current_fifo_write_pos = 0; - m_current_fifo_read_pos = 0; - m_fifo_block_a_full = 0; - m_fifo_block_b_full = 0; - } - - //printf("_32x_68k_a15106_w %04x\n", data); - /* - if (m_a15106_reg & 0x4) - printf(" --- 68k Write Mode enabled\n"); - else - printf(" --- 68k Write Mode disabled\n"); - - if (m_a15106_reg & 0x1) - printf(" --- DMA Start Allowed \n"); - else - printf(" --- DMA Start No Operation\n"); - - */ - } -} - - - -READ16_MEMBER( sega_32x_device::_32x_dreq_common_r ) -{ - address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); - - switch (offset) - { - case 0x00/2: // a15108 / 4008 - case 0x02/2: // a1510a / 400a - return m_dreq_src_addr[offset&1]; - - case 0x04/2: // a1510c / 400c - case 0x06/2: // a1510e / 400e - return m_dreq_dst_addr[offset&1]; - - case 0x08/2: // a15110 / 4010 - return m_dreq_size; - - case 0x0a/2: // a15112 / 4012 - if (&space == &_68kspace) - { - printf("attempting to READ FIFO with 68k!\n"); - return 0xffff; - } - - UINT16 retdat = m_current_fifo_readblock[m_current_fifo_read_pos]; - - m_current_fifo_read_pos++; - - // printf("reading FIFO!\n"); - - if (m_current_fifo_readblock == m_fifo_block_a && !m_fifo_block_a_full) - printf("Fifo block a isn't filled!\n"); - - if (m_current_fifo_readblock == m_fifo_block_b && !m_fifo_block_b_full) - printf("%08x Fifo block b isn't filled!\n",space.device().safe_pc()); - - - if (m_current_fifo_read_pos==4) - { - if (m_current_fifo_readblock == m_fifo_block_a) - { - m_fifo_block_a_full = 0; - - if (m_fifo_block_b_full) - { - m_current_fifo_readblock = m_fifo_block_b; - m_current_fifo_block = m_fifo_block_a; - } - - m_current_fifo_read_pos = 0; - } - else if (m_current_fifo_readblock == m_fifo_block_b) - { - m_fifo_block_b_full = 0; - - if (m_fifo_block_a_full) - { - m_current_fifo_readblock = m_fifo_block_a; - m_current_fifo_block = m_fifo_block_b; - } - - m_current_fifo_read_pos = 0; - } - } - - return retdat; - } - - return 0x0000; -} - -WRITE16_MEMBER( sega_32x_device::_32x_dreq_common_w ) -{ - address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); - - switch (offset) - { - case 0x00/2: // a15108 / 4008 - case 0x02/2: // a1510a / 400a - if (&space != &_68kspace) - { - printf("attempting to WRITE DREQ SRC with SH2!\n"); - return; - } - - m_dreq_src_addr[offset&1] = ((offset&1) == 0) ? (data & 0xff) : (data & 0xfffe); - - //if((m_dreq_src_addr[0]<<16)|m_dreq_src_addr[1]) - // printf("DREQ set SRC = %08x\n",(m_dreq_src_addr[0]<<16)|m_dreq_src_addr[1]); - - break; - - case 0x04/2: // a1510c / 400c - case 0x06/2: // a1510e / 400e - if (&space != &_68kspace) - { - printf("attempting to WRITE DREQ DST with SH2!\n"); - return; - } - - m_dreq_dst_addr[offset&1] = ((offset&1) == 0) ? (data & 0xff) : (data & 0xffff); - - //if((m_dreq_dst_addr[0]<<16)|m_dreq_dst_addr[1]) - // printf("DREQ set DST = %08x\n",(m_dreq_dst_addr[0]<<16)|m_dreq_dst_addr[1]); - - break; - - case 0x08/2: // a15110 / 4010 - if (&space != &_68kspace) - { - printf("attempting to WRITE DREQ SIZE with SH2!\n"); - return; - } - - m_dreq_size = data & 0xfffc; - - // if(m_dreq_size) - // printf("DREQ set SIZE = %04x\n",m_dreq_size); - - break; - - case 0x0a/2: // a15112 / 4012 - FIFO Write (68k only!) - if (&space != &_68kspace) - { - printf("attempting to WRITE FIFO with SH2!\n"); - return; - } - - if (m_current_fifo_block==m_fifo_block_a && m_fifo_block_a_full) - { - printf("attempt to write to Full Fifo block a!\n"); - return; - } - - if (m_current_fifo_block==m_fifo_block_b && m_fifo_block_b_full) - { - printf("attempt to write to Full Fifo block b!\n"); - return; - } - - if((m_a15106_reg & 4) == 0) - { - printf("attempting to WRITE FIFO with 68S cleared!\n"); // corpse32 - return; - } - - m_current_fifo_block[m_current_fifo_write_pos] = data; - m_current_fifo_write_pos++; - - if (m_current_fifo_write_pos==4) - { - if (m_current_fifo_block==m_fifo_block_a) - { - m_fifo_block_a_full = 1; - if (!m_fifo_block_b_full) - { - m_current_fifo_block = m_fifo_block_b; - m_current_fifo_readblock = m_fifo_block_a; - // incase we have a stalled DMA in progress, let the SH2 know there is data available - m_master_cpu->sh2_notify_dma_data_available(); - m_slave_cpu->sh2_notify_dma_data_available(); - - } - m_current_fifo_write_pos = 0; - } - else - { - m_fifo_block_b_full = 1; - - if (!m_fifo_block_a_full) - { - m_current_fifo_block = m_fifo_block_a; - m_current_fifo_readblock = m_fifo_block_b; - // incase we have a stalled DMA in progress, let the SH2 know there is data available - m_master_cpu->sh2_notify_dma_data_available(); - m_slave_cpu->sh2_notify_dma_data_available(); - - } - - m_current_fifo_write_pos = 0; - } - } - - break; - } -} - - - - -READ16_MEMBER( sega_32x_device::_32x_68k_a1511a_r ) -{ - return m_sega_tv; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_a1511a_w ) -{ - m_sega_tv = data & 1; - - printf("SEGA TV register set = %04x\n",data); -} - -/* -000070 H interrupt vector can be overwritten apparently -*/ - - - -READ16_MEMBER( sega_32x_device::_32x_68k_m_hint_vector_r ) -{ - return m_hint_vector[offset]; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_m_hint_vector_w ) -{ - m_hint_vector[offset] = data; -} - -// returns MARS, the system ID of the 32x -READ16_MEMBER( sega_32x_device::_32x_68k_MARS_r ) -{ - switch (offset) - { - case 0: - return 0x4d41; - - case 1: - return 0x5253; - } - - return 0x0000; -} - - -/**********************************************************************************************/ -// 68k side a15100 -// control register - used to enable 32x etc. -/**********************************************************************************************/ - - - -READ16_MEMBER( sega_32x_device::_32x_68k_a15100_r ) -{ - return (m_32x_access_auth<<15) | 0x0080; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_a15100_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_a15100_reg = (m_a15100_reg & 0xff00) | (data & 0x00ff); - - if (data & 0x02) - { - m_master_cpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - m_slave_cpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - } - - if (data & 0x01) - { - m_32x_adapter_enabled = 1; - space.install_rom(0x0880000, 0x08fffff, space.machine().root_device().memregion("gamecart")->base()); // 'fixed' 512kb rom bank - - space.install_read_bank(0x0900000, 0x09fffff, "bank12"); // 'bankable' 1024kb rom bank - space.machine().root_device().membank("bank12")->set_base(space.machine().root_device().memregion("gamecart")->base()+((m_32x_68k_a15104_reg&0x3)*0x100000) ); - - space.install_rom(0x0000000, 0x03fffff, space.machine().root_device().memregion("32x_68k_bios")->base()); - - /* VDP area */ - space.install_readwrite_handler(0x0a15180, 0x0a1518b, read16_delegate(FUNC(sega_32x_device::_32x_common_vdp_regs_r), this), write16_delegate(FUNC(sega_32x_device::_32x_common_vdp_regs_w),this)); // common / shared VDP regs - space.install_readwrite_handler(0x0a15200, 0x0a153ff, read16_delegate(FUNC(sega_32x_device::_32x_68k_palette_r), this), write16_delegate(FUNC(sega_32x_device::_32x_68k_palette_w),this)); // access to 'palette' xRRRRRGGGGGBBBBB - space.install_readwrite_handler(0x0840000, 0x085ffff, read16_delegate(FUNC(sega_32x_device::_32x_68k_dram_r), this), write16_delegate(FUNC(sega_32x_device::_32x_68k_dram_w),this)); // access to 'display ram' (framebuffer) - space.install_readwrite_handler(0x0860000, 0x087ffff, read16_delegate(FUNC(sega_32x_device::_32x_68k_dram_overwrite_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_dram_overwrite_w),this)); // access to 'display ram' (framebuffer) - - - - space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector - } - else - { - m_32x_adapter_enabled = 0; - - space.install_rom(0x0000000, 0x03fffff, space.machine().root_device().memregion("gamecart")->base()); - space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector - } - } - - if (ACCESSING_BITS_8_15) - { - m_a15100_reg = (m_a15100_reg & 0x00ff) | (data & 0xff00); - m_32x_access_auth = (data & 0x8000)>>15; - } -} - -/**********************************************************************************************/ -// 68k side a15102 -// command interrupt to SH2 -/**********************************************************************************************/ - - - -READ16_MEMBER( sega_32x_device::_32x_68k_a15102_r ) -{ - //printf("_32x_68k_a15102_r\n"); - return m_32x_68k_a15102_reg; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_a15102_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_32x_68k_a15102_reg = data & 3; - - if (data&0x1) - { - if (m_sh2_master_cmdint_enable) m_master_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,ASSERT_LINE); - else printf("master cmdint when masked!\n"); - } - - if (data&0x2) - { - if (m_sh2_slave_cmdint_enable) m_slave_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,ASSERT_LINE); - else printf("slave cmdint when masked!\n"); - } - } -} - -/**********************************************************************************************/ -// 68k side a15104 -// ROM banking for 68k rom -/**********************************************************************************************/ - - -READ16_MEMBER( sega_32x_device::_32x_68k_a15104_r ) -{ - return m_32x_68k_a15104_reg; -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_a15104_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_32x_68k_a15104_reg = (m_32x_68k_a15104_reg & 0xff00) | (data & 0x00ff); - } - - if (ACCESSING_BITS_8_15) - { - m_32x_68k_a15104_reg = (m_32x_68k_a15104_reg & 0x00ff) | (data & 0xff00); - } - - space.machine().root_device().membank("bank12")->set_base(space.machine().root_device().memregion("gamecart")->base()+((m_32x_68k_a15104_reg&0x3)*0x100000) ); -} - -/**********************************************************************************************/ -// 68k side a15120 - a1512f -// Communication Port 0 -// access from the SH2 via 4020 - 402f -/**********************************************************************************************/ - - -/**********************************************************************************************/ - -// reads -READ16_MEMBER( sega_32x_device::_32x_68k_m_commsram_r ) -{ - if (_32X_COMMS_PORT_SYNC) space.machine().scheduler().synchronize(); - return m_commsram[offset]; -} - -// writes -WRITE16_MEMBER( sega_32x_device::_32x_68k_m_commsram_w ) -{ - COMBINE_DATA(&m_commsram[offset]); - if (_32X_COMMS_PORT_SYNC) space.machine().scheduler().synchronize(); -} - -/**********************************************************************************************/ -// 68k side a15130 - a1513f -// PWM registers -// access from the SH2 via 4030 - 403f -/**********************************************************************************************/ - -/* -TODO: -- noticeable static noise on Virtua Fighter Sega logo at start-up -- Understand if Speaker OFF makes the FIFO to advance or not -*/ - - - - -void sega_32x_device::calculate_pwm_timer() -{ - if(m_pwm_tm_reg == 0) { m_pwm_tm_reg = 16; } // zero gives max range - if(m_pwm_cycle == 0) { m_pwm_cycle = 4095; } // zero gives max range - - /* if both RMD and LMD are set to OFF or pwm cycle register is one, then PWM timer ticks doesn't occur */ - if(m_pwm_cycle == 1 || ((m_pwm_ctrl & 0xf) == 0)) - m_32x_pwm_timer->adjust(attotime::never); - else - { - m_pwm_timer_tick = 0; - m_lch_fifo_state = m_rch_fifo_state = 0x4000; - m_lch_index_r = m_rch_index_r = 0; - m_lch_index_w = m_rch_index_w = 0; - m_32x_pwm_timer->adjust(attotime::from_hz((PWM_CLOCK) / (m_pwm_cycle - 1))); - } -} - - -void sega_32x_device::handle_pwm_callback() -{ - if(m_lch_index_r < PWM_FIFO_SIZE) - { - switch(m_pwm_ctrl & 3) - { - case 0: m_lch_index_r++; /*Speaker OFF*/ break; - case 1: m_lch_pwm->write_signed16(m_cur_lch[m_lch_index_r++]); break; - case 2: m_rch_pwm->write_signed16(m_cur_lch[m_lch_index_r++]); break; - case 3: popmessage("Undefined PWM Lch value 3, contact MESSdev"); break; - } - - m_lch_index_w = 0; - } - - m_lch_fifo_state = (m_lch_index_r == PWM_FIFO_SIZE) ? 0x4000 : 0x0000; - - if(m_rch_index_r < PWM_FIFO_SIZE) - { - switch((m_pwm_ctrl & 0xc) >> 2) - { - case 0: m_rch_index_r++; /*Speaker OFF*/ break; - case 1: m_rch_pwm->write_signed16(m_cur_rch[m_rch_index_r++]); break; - case 2: m_lch_pwm->write_signed16(m_cur_rch[m_rch_index_r++]); break; - case 3: popmessage("Undefined PWM Rch value 3, contact MESSdev"); break; - } - - m_rch_index_w = 0; - } - - m_rch_fifo_state = (m_rch_index_r == PWM_FIFO_SIZE) ? 0x4000 : 0x0000; - - m_pwm_timer_tick++; - - if(m_pwm_timer_tick == m_pwm_tm_reg) - { - m_pwm_timer_tick = 0; - if(sh2_master_pwmint_enable) { m_master_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,ASSERT_LINE); } - if(sh2_slave_pwmint_enable) { m_slave_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,ASSERT_LINE); } - } - - m_32x_pwm_timer->adjust(attotime::from_hz((PWM_CLOCK) / (m_pwm_cycle - 1))); -} - -TIMER_CALLBACK( _32x_pwm_callback ) -{ - sega_32x_device* _32xdev = (sega_32x_device*)ptr; - _32xdev->handle_pwm_callback(); -} - -READ16_MEMBER( sega_32x_device::_32x_pwm_r ) -{ - switch(offset) - { - case 0x00/2: return m_pwm_ctrl; //control register - case 0x02/2: return m_pwm_cycle_reg; // cycle register - case 0x04/2: return m_lch_fifo_state; // l ch - case 0x06/2: return m_rch_fifo_state; // r ch - case 0x08/2: return m_lch_fifo_state & m_rch_fifo_state; // mono ch - } - - printf("Read at undefined PWM register %02x\n",offset); - return 0xffff; -} - -WRITE16_MEMBER( sega_32x_device::_32x_pwm_w ) -{ - switch(offset) - { - case 0x00/2: - m_pwm_ctrl = data & 0xffff; - m_pwm_tm_reg = (m_pwm_ctrl & 0xf00) >> 8; - calculate_pwm_timer(); - break; - case 0x02/2: - m_pwm_cycle = m_pwm_cycle_reg = data & 0xfff; - calculate_pwm_timer(); - break; - case 0x04/2: - if(m_lch_index_w < PWM_FIFO_SIZE) - { - m_cur_lch[m_lch_index_w++] = ((data & 0xfff) << 4) | (data & 0xf); - m_lch_index_r = 0; - } - - m_lch_fifo_state = (m_lch_index_w == PWM_FIFO_SIZE) ? 0x8000 : 0x0000; - break; - case 0x06/2: - if(m_rch_index_w < PWM_FIFO_SIZE) - { - m_cur_rch[m_rch_index_w++] = ((data & 0xfff) << 4) | (data & 0xf); - m_rch_index_r = 0; - } - - m_rch_fifo_state = (m_rch_index_w == PWM_FIFO_SIZE) ? 0x8000 : 0x0000; - - break; - case 0x08/2: - if(m_lch_index_w < PWM_FIFO_SIZE) - { - m_cur_lch[m_lch_index_w++] = ((data & 0xfff) << 4) | (data & 0xf); - m_lch_index_r = 0; - } - - if(m_rch_index_w < PWM_FIFO_SIZE) - { - m_cur_rch[m_rch_index_w++] = ((data & 0xfff) << 4) | (data & 0xf); - m_rch_index_r = 0; - } - - m_lch_fifo_state = (m_lch_index_w == PWM_FIFO_SIZE) ? 0x8000 : 0x0000; - m_rch_fifo_state = (m_rch_index_w == PWM_FIFO_SIZE) ? 0x8000 : 0x0000; - - break; - default: - printf("Write at undefined PWM register %02x %04x\n",offset,data); - break; - } -} - -WRITE16_MEMBER( sega_32x_device::_32x_68k_pwm_w ) -{ - if(offset == 0/2) - _32x_pwm_w(space,offset,(data & 0x7f) | (m_pwm_ctrl & 0xff80),mem_mask); - else - _32x_pwm_w(space,offset,data,mem_mask); -} - -/**********************************************************************************************/ -// 68k side a15180 -// framebuffer control -// also accessed from the SH2 @ 4100 -/**********************************************************************************************/ - -UINT16 sega_32x_device::get_hposition(void) -{ - attotime time_elapsed_since_megadriv_scanline_timer; - UINT16 value4; - - time_elapsed_since_megadriv_scanline_timer = machine().device(":md_scan_timer")->time_elapsed(); - - if (time_elapsed_since_megadriv_scanline_timer.attoseconds() < (ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines)) - { - value4 = (UINT16)(MAX_HPOSITION*((double)(time_elapsed_since_megadriv_scanline_timer.attoseconds()) / (double)(ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines))); - } - else /* in some cases (probably due to rounding errors) we get some stupid results (the odd huge value where the time elapsed is much higher than the scanline time??!).. hopefully by clamping the result to the maximum we limit errors */ - { - value4 = MAX_HPOSITION; - } - - return value4; -} - -READ16_MEMBER( sega_32x_device::_32x_common_vdp_regs_r ) -{ - // what happens if the z80 accesses it, what authorization do we use? - - int ntsc; - -// printf("_32x_68k_a15180_r (a15180) %04x\n",mem_mask); - - // read needs authorization too I think, undefined behavior otherwise - switch (offset) - { - case 0x00: - - // the flag is inverted compared to the megadrive - ntsc = m_32x_pal ? 0 : 1; - - return (ntsc << 15) | - (m_32x_videopriority << 7) | - (m_32x_240mode << 6) | - (m_32x_displaymode << 0); - - case 0x02/2: - return m_32x_screenshift; - - case 0x04/2: - return m_32x_autofill_length; - - case 0x06/2: - return m_32x_autofill_address; - - case 0x08/2: - return m_32x_autofill_data; - - case 0x0a/2: - UINT16 retdata = m_32x_a1518a_reg; - UINT16 hpos = get_hposition(); - int megadrive_hblank_flag = 0; - - if (m_32x_vblank_flag) retdata |= 0x8000; - - if (hpos>400) megadrive_hblank_flag = 1; - if (hpos>460) megadrive_hblank_flag = 0; - - if (megadrive_hblank_flag) retdata |= 0x4000; - - if (m_32x_vblank_flag) { retdata |= 2; } // framebuffer approval (TODO: condition is unknown at current time) - - if (megadrive_hblank_flag && m_32x_vblank_flag) { retdata |= 0x2000; } // palette approval (TODO: active high or low?) - - return retdata; - } - - return 0x0000; -} - - -void sega_32x_device::_32x_check_framebuffer_swap(bool enabled) -{ - // this logic should be correct, but makes things worse? - // enabled = (genesis_scanline_counter >= megadrive_irq6_scanline) from video/315_5313.c - //if (enabled) - { - m_32x_a1518a_reg = m_32x_fb_swap & 1; - - - - if (m_32x_fb_swap & 1) - { - m_32x_access_dram = m_32x_dram0; - m_32x_display_dram = m_32x_dram1; - } - else - { - m_32x_display_dram = m_32x_dram0; - m_32x_access_dram = m_32x_dram1; - } - } -} - - -WRITE16_MEMBER( sega_32x_device::_32x_common_vdp_regs_w ) -{ - // what happens if the z80 accesses it, what authorization do we use? which address space do we get?? the z80 *can* write here and to the framebuffer via the window - - address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); - - if (&space!= &_68kspace) - { - if (m_32x_access_auth!=1) - return; - } - - if (&space== &_68kspace) - { - if (m_32x_access_auth!=0) - return; - } - - - switch (offset) - { - case 0x00: - //printf("_32x_68k_a15180_w (a15180) %04x %04x source m_32x_access_auth %04x\n",data,mem_mask, m_32x_access_auth); - - if (ACCESSING_BITS_0_7) - { - m_32x_videopriority = (data & 0x80) >> 7; - m_32x_240mode = (data & 0x40) >> 6; - m_32x_displaymode = (data & 0x03) >> 0; - } - break; - - case 0x02/2: - if (ACCESSING_BITS_0_7) - { - m_32x_screenshift = data & 1; // allows 1 pixel shifting - } - if (ACCESSING_BITS_8_15) - { - } - break; - - case 0x04/2: - if (ACCESSING_BITS_0_7) - { - m_32x_autofill_length = data & 0xff; - } - - if (ACCESSING_BITS_8_15) - { - } - break; - - case 0x06/2: - if (ACCESSING_BITS_0_7) - { - m_32x_autofill_address = (m_32x_autofill_address & 0xff00) | (data & 0x00ff); - } - - if (ACCESSING_BITS_8_15) - { - m_32x_autofill_address = (m_32x_autofill_address & 0x00ff) | (data & 0xff00); - } - break; - - case 0x08/2: - if (ACCESSING_BITS_0_7) - { - m_32x_autofill_data = (m_32x_autofill_data & 0xff00) | (data & 0x00ff); - } - - if (ACCESSING_BITS_8_15) - { - m_32x_autofill_data = (m_32x_autofill_data & 0x00ff) | (data & 0xff00); - } - - // do the fill - shouldn't be instant.. - { - int i; - for (i=0; i> 15; - } - - if (ACCESSING_BITS_0_7) - { - m_sh2_hint_in_vbl = data & 0x80; - m_sh2_master_vint_enable = data & 0x8; - m_sh2_master_hint_enable = data & 0x4; - m_sh2_master_cmdint_enable = data & 0x2; - sh2_master_pwmint_enable = data & 0x1; - - //if (m_sh2_master_hint_enable) printf("m_sh2_master_hint_enable enable!\n"); - //if (sh2_master_pwmint_enable) printf("sh2_master_pwn_enable enable!\n"); - - _32x_check_irqs(); - } -} - -/* SLAVE */ - -READ16_MEMBER( sega_32x_device::_32x_sh2_slave_4000_r ) -{ - UINT16 retvalue = 0x0200; - retvalue |= m_32x_access_auth << 15; - retvalue |= m_sh2_hint_in_vbl; - retvalue |= m_sh2_slave_vint_enable; - retvalue |= m_sh2_slave_hint_enable; - retvalue |= m_sh2_slave_cmdint_enable; - retvalue |= sh2_slave_pwmint_enable; - - return retvalue; -} - - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4000_w ) -{ - if (ACCESSING_BITS_8_15) - { - m_32x_access_auth = (data &0x8000) >> 15; - } - - if (ACCESSING_BITS_0_7) - { - m_sh2_hint_in_vbl = data & 0x80; - m_sh2_slave_vint_enable = data & 0x8; - m_sh2_slave_hint_enable = data & 0x4; - m_sh2_slave_cmdint_enable = data & 0x2; - sh2_slave_pwmint_enable = data & 0x1; - - //if (m_sh2_slave_hint_enable) printf("m_sh2_slave_hint_enable enable!\n"); - //if (sh2_slave_pwmint_enable) printf("sh2_slave_pwm_enable enable!\n"); - - _32x_check_irqs(); - } -} - -/**********************************************************************************************/ -// SH2 side 4002 -// Reserved ( Stand By Change Register ) -// Shouldn't be used -/**********************************************************************************************/ - -READ16_MEMBER( sega_32x_device::_32x_sh2_common_4002_r ) -{ - printf("reading 4002!\n"); - return 0x0000; -} - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4002_w ) -{ - printf("write 4002!\n"); -} - - -/**********************************************************************************************/ -// SH2 side 4004 -// H Count Register (H Interrupt) -// 0 = every line -/**********************************************************************************************/ -READ16_MEMBER( sega_32x_device::_32x_sh2_common_4004_r ) -{ - return m_32x_hcount_reg; -} - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4004_w ) -{ - m_32x_hcount_reg = data & 0xff; -} - - -/**********************************************************************************************/ -// SH2 side 4006 -// DReq Control Register -/**********************************************************************************************/ - -READ16_MEMBER( sega_32x_device::_32x_sh2_common_4006_r ) -{ - //printf("DREQ read!\n"); // tempo reads it, shut up for now - return _32x_68k_a15106_r(space,offset,mem_mask); -} - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4006_w ) -{ - printf("DREQ write!\n"); //register is read only on SH-2 side -} - - -/**********************************************************************************************/ -// SH2 side 4014 -// VRES (md reset button interrupt) clear -/**********************************************************************************************/ - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4014_w ){ m_master_cpu->set_input_line(SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} -WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4014_w ) { m_slave_cpu->set_input_line(SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} - -/**********************************************************************************************/ -// SH2 side 4016 -// VINT (vertical interrupt) clear -/**********************************************************************************************/ - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4016_w ){ m_sh2_master_vint_pending = 0; _32x_check_irqs(); } -WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4016_w ) { m_sh2_slave_vint_pending = 0; _32x_check_irqs(); } - -/**********************************************************************************************/ -// SH2 side 4018 -// HINT (horizontal interrupt) clear -/**********************************************************************************************/ - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4018_w ){ m_master_cpu->set_input_line(SH2_HINT_IRQ_LEVEL,CLEAR_LINE);} -WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4018_w ) { m_slave_cpu->set_input_line(SH2_HINT_IRQ_LEVEL,CLEAR_LINE);} - -/**********************************************************************************************/ -// SH2 side 401A -// HINT (control register interrupt) clear -// Note: flag cleared here is a guess, according to After Burner behaviour -/**********************************************************************************************/ - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401a_w ){ m_32x_68k_a15102_reg &= ~1; m_master_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,CLEAR_LINE);} -WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401a_w ) { m_32x_68k_a15102_reg &= ~2; m_slave_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,CLEAR_LINE);} - -/**********************************************************************************************/ -// SH2 side 401C -// PINT (PWM timer interrupt) clear -/**********************************************************************************************/ - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401c_w ){ m_master_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,CLEAR_LINE);} -WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401c_w ) { m_slave_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,CLEAR_LINE);} - -/**********************************************************************************************/ -// SH2 side 401E -// ?? unknown / unused -/**********************************************************************************************/ - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401e_w ) -{ - printf("_32x_sh2_master_401e_w\n"); -} - -WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401e_w ) -{ - printf("_32x_sh2_slave_401e_w\n"); -} - -/**********************************************************************************************/ -// SH2 side 4020 - 402f -// SH2 -> 68k Comms ports, -// access at a15120 - a1512f on 68k -// these just map through to the 68k functions -/**********************************************************************************************/ - -/* handled directly */ - -/**********************************************************************************************/ -// SH2 side 4030 -// PWM Control Register -/**********************************************************************************************/ - -/**********************************************************************************************/ -// SH2 side 4032 -// Cycle Register -/**********************************************************************************************/ - - -/**********************************************************************************************/ -// SH2 side 4034 -// LCH Pulse Width Register -/**********************************************************************************************/ - -/**********************************************************************************************/ -// SH2 side 4036 -// RCH Pulse Width Register -/**********************************************************************************************/ - -/**********************************************************************************************/ -// SH2 side 4038 -// Mono Pulse Width Register -/**********************************************************************************************/ - -/* 4100 - 43ff are VDP registers, you need permission to access them - ensure this is true for all! */ - -/**********************************************************************************************/ -// SH2 side 4200 - 43ff -// palette -// maps through to 68k at a15200 - a153ff -/**********************************************************************************************/ - -/* handled directly */ - -/**********************************************************************************************/ -// SH2 side 4000000 - 401ffff -// framebuffer -// maps through to 68k at 840000 - 85ffff -/**********************************************************************************************/ - -/* handled directly */ - -/**********************************************************************************************/ -// SH2 side 4020000 - 403ffff -// framebuffer overwrite -// maps through to 68k at 860000 - 87ffff -/**********************************************************************************************/ - -/* handled directly */ - -/**********************************************************************************************/ -// SH2 access Macros -/**********************************************************************************************/ - - -/* the 32x treats everything as 16-bit registers, so we remap the 32-bit read & writes - to 2x 16-bit handlers here (TODO: nuke this eventually) */ - -#define _32X_MAP_READHANDLERS(NAMEA,NAMEB) \ -READ32_MEMBER( sega_32x_device::_32x_sh2_##NAMEA##_##NAMEB##_r ) \ -{ \ - UINT32 retvalue = 0x00000000; \ - if (ACCESSING_BITS_16_31) \ - { \ - UINT16 ret = _32x_sh2_##NAMEA##_r(space,0,(mem_mask>>16)&0xffff); \ - retvalue |= ret << 16; \ - } \ - if (ACCESSING_BITS_0_15) \ - { \ - UINT16 ret = _32x_sh2_##NAMEB##_r(space,0,(mem_mask>>0)&0xffff); \ - retvalue |= ret << 0; \ - } \ - \ - return retvalue; \ -} -#define _32X_MAP_WRITEHANDLERS(NAMEA,NAMEB) \ -WRITE32_MEMBER( sega_32x_device::_32x_sh2_##NAMEA##_##NAMEB##_w) \ -{ \ - if (ACCESSING_BITS_16_31) \ - { \ - _32x_sh2_##NAMEA##_w(space,0,(data>>16)&0xffff,(mem_mask>>16)&0xffff); \ - } \ - if (ACCESSING_BITS_0_15) \ - { \ - _32x_sh2_##NAMEB##_w(space,0,(data>>0)&0xffff,(mem_mask>>0)&0xffff); \ - } \ -} - - - -/**********************************************************************************************/ -// SH2 access for Memory Map -/**********************************************************************************************/ - -_32X_MAP_READHANDLERS(master_4000,common_4002) // _32x_sh2_master_4000_common_4002_r -_32X_MAP_WRITEHANDLERS(master_4000,common_4002) // _32x_sh2_master_4000_common_4002_w - -_32X_MAP_READHANDLERS(slave_4000,common_4002) // _32x_sh2_slave_4000_common_4002_r -_32X_MAP_WRITEHANDLERS(slave_4000,common_4002) // _32x_sh2_slave_4000_common_4002_w - -_32X_MAP_READHANDLERS(common_4004,common_4006) -_32X_MAP_WRITEHANDLERS(common_4004,common_4006) - -_32X_MAP_WRITEHANDLERS(master_4014,master_4016) // _32x_sh2_master_4014_master_4016_w -_32X_MAP_WRITEHANDLERS(master_4018,master_401a) // _32x_sh2_master_4018_master_401a_w -_32X_MAP_WRITEHANDLERS(master_401c,master_401e) // _32x_sh2_master_401c_master_401e_w - -_32X_MAP_WRITEHANDLERS(slave_4014,slave_4016) // _32x_sh2_slave_4014_slave_4016_w -_32X_MAP_WRITEHANDLERS(slave_4018,slave_401a) // _32x_sh2_slave_4018_slave_401a_w -_32X_MAP_WRITEHANDLERS(slave_401c,slave_401e) // _32x_sh2_slave_401c_slave_401e_w - - - -/**********************************************************************************************/ -// SH2 memory maps -/**********************************************************************************************/ - -ADDRESS_MAP_START( sh2_main_map, AS_PROGRAM, 32, sega_32x_device ) - AM_RANGE(0x00000000, 0x00003fff) AM_ROMBANK("masterbios") - - AM_RANGE(0x00004000, 0x00004003) AM_READWRITE(_32x_sh2_master_4000_common_4002_r, _32x_sh2_master_4000_common_4002_w ) - AM_RANGE(0x00004004, 0x00004007) AM_READWRITE(_32x_sh2_common_4004_common_4006_r, _32x_sh2_common_4004_common_4006_w) - - AM_RANGE(0x00004008, 0x00004013) AM_READWRITE16(_32x_dreq_common_r, _32x_dreq_common_w, 0xffffffff ) - - AM_RANGE(0x00004014, 0x00004017) AM_READNOP AM_WRITE(_32x_sh2_master_4014_master_4016_w ) // IRQ clear - AM_RANGE(0x00004018, 0x0000401b) AM_READNOP AM_WRITE(_32x_sh2_master_4018_master_401a_w ) // IRQ clear - AM_RANGE(0x0000401c, 0x0000401f) AM_READNOP AM_WRITE(_32x_sh2_master_401c_master_401e_w ) // IRQ clear - - AM_RANGE(0x00004020, 0x0000402f) AM_READWRITE16(_32x_68k_m_commsram_r, _32x_68k_m_commsram_w, 0xffffffff ) - AM_RANGE(0x00004030, 0x0000403f) AM_READWRITE16(_32x_pwm_r, _32x_pwm_w, 0xffffffff ) - - AM_RANGE(0x00004100, 0x0000410b) AM_READWRITE16(_32x_common_vdp_regs_r, _32x_common_vdp_regs_w , 0xffffffff) - AM_RANGE(0x00004200, 0x000043ff) AM_READWRITE16(_32x_68k_palette_r, _32x_68k_palette_w, 0xffffffff) - - AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE16(_32x_68k_dram_r, _32x_68k_dram_w, 0xffffffff) - AM_RANGE(0x04020000, 0x0403ffff) AM_READWRITE16(_32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w, 0xffffffff) - - AM_RANGE(0x06000000, 0x0603ffff) AM_RAM AM_SHARE("sh2_shared") - AM_RANGE(0x02000000, 0x023fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // program is writeable (wwfraw) - - AM_RANGE(0x22000000, 0x223fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // cart mirror (fifa96) - - AM_RANGE(0xc0000000, 0xc0000fff) AM_RAM -ADDRESS_MAP_END - -ADDRESS_MAP_START( sh2_slave_map, AS_PROGRAM, 32, sega_32x_device ) - AM_RANGE(0x00000000, 0x00003fff) AM_ROMBANK("slavebios") - - AM_RANGE(0x00004000, 0x00004003) AM_READWRITE(_32x_sh2_slave_4000_common_4002_r, _32x_sh2_slave_4000_common_4002_w ) - AM_RANGE(0x00004004, 0x00004007) AM_READWRITE(_32x_sh2_common_4004_common_4006_r, _32x_sh2_common_4004_common_4006_w) - - AM_RANGE(0x00004008, 0x00004013) AM_READWRITE16(_32x_dreq_common_r, _32x_dreq_common_w, 0xffffffff ) - - AM_RANGE(0x00004014, 0x00004017) AM_READNOP AM_WRITE(_32x_sh2_slave_4014_slave_4016_w ) // IRQ clear - AM_RANGE(0x00004018, 0x0000401b) AM_READNOP AM_WRITE(_32x_sh2_slave_4018_slave_401a_w ) // IRQ clear - AM_RANGE(0x0000401c, 0x0000401f) AM_READNOP AM_WRITE(_32x_sh2_slave_401c_slave_401e_w ) // IRQ clear - - AM_RANGE(0x00004020, 0x0000402f) AM_READWRITE16(_32x_68k_m_commsram_r, _32x_68k_m_commsram_w, 0xffffffff ) - AM_RANGE(0x00004030, 0x0000403f) AM_READWRITE16(_32x_pwm_r, _32x_pwm_w, 0xffffffff ) - - AM_RANGE(0x00004100, 0x0000410b) AM_READWRITE16(_32x_common_vdp_regs_r, _32x_common_vdp_regs_w , 0xffffffff) - AM_RANGE(0x00004200, 0x000043ff) AM_READWRITE16(_32x_68k_palette_r, _32x_68k_palette_w, 0xffffffff) - - AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE16(_32x_68k_dram_r, _32x_68k_dram_w, 0xffffffff) - AM_RANGE(0x04020000, 0x0403ffff) AM_READWRITE16(_32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w, 0xffffffff) - - AM_RANGE(0x06000000, 0x0603ffff) AM_RAM AM_SHARE("sh2_shared") - AM_RANGE(0x02000000, 0x023fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // program is writeable (wwfraw) - - AM_RANGE(0x22000000, 0x223fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // cart mirror (fifa96) - - AM_RANGE(0xc0000000, 0xc0000fff) AM_RAM -ADDRESS_MAP_END - -/****************************************** END 32X related *************************************/ - - - - -void sega_32x_device::_32x_check_irqs() -{ - if (m_sh2_master_vint_enable && m_sh2_master_vint_pending) m_master_cpu->set_input_line(SH2_VINT_IRQ_LEVEL,ASSERT_LINE); - else m_master_cpu->set_input_line(SH2_VINT_IRQ_LEVEL,CLEAR_LINE); - - if (m_sh2_slave_vint_enable && m_sh2_slave_vint_pending) m_slave_cpu->set_input_line(SH2_VINT_IRQ_LEVEL,ASSERT_LINE); - else m_slave_cpu->set_input_line(SH2_VINT_IRQ_LEVEL,CLEAR_LINE); -} - -void sega_32x_device::_32x_interrupt_cb(int scanline, int irq6) -{ - if (scanline == irq6) - { - m_32x_vblank_flag = 1; - m_sh2_master_vint_pending = 1; - m_sh2_slave_vint_pending = 1; - _32x_check_irqs(); - } - - _32x_check_framebuffer_swap(scanline >= irq6); - - m_32x_hcount_compare_val++; - - if (m_32x_hcount_compare_val >= m_32x_hcount_reg) - { - m_32x_hcount_compare_val = -1; - - if (scanline < 224 || m_sh2_hint_in_vbl) - { - if (m_sh2_master_hint_enable) - m_master_cpu->set_input_line(SH2_HINT_IRQ_LEVEL, ASSERT_LINE); - if (m_sh2_slave_hint_enable) - m_slave_cpu->set_input_line(SH2_HINT_IRQ_LEVEL, ASSERT_LINE); - } - } -} - - -SH2_DMA_FIFO_DATA_AVAILABLE_CB(sega_32x_device::_32x_fifo_available_callback) -{ - if (src==0x4012) - { - if (m_current_fifo_readblock==m_fifo_block_a && m_fifo_block_a_full) - return 1; - - if (m_current_fifo_readblock==m_fifo_block_b && m_fifo_block_b_full) - return 1; - - return 0; - } - - return 1; -} - - - -void sega_32x_device::_32x_render_videobuffer_to_screenbuffer_helper(int scanline) -{ - int x; - - /* render 32x output to a buffer */ - if (m_32x_displaymode != 0) - { - if (m_32x_displaymode==1) - { - UINT32 lineoffs; - int start; - - lineoffs = m_32x_display_dram[scanline]; - - if (m_32x_screenshift == 0) start=0; - else start = -1; - - for (x=start;x<320;x++) - { - UINT16 coldata; - coldata = m_32x_display_dram[lineoffs]; - - { - if (x>=0) - { - m_32x_linerender[x] = m_32x_palette_lookup[(coldata & 0xff00)>>8]; - } - - x++; - - if (x>=0) - { - m_32x_linerender[x] = m_32x_palette_lookup[(coldata & 0x00ff)]; - } - } - - lineoffs++; - - } - } - else if (m_32x_displaymode==3) // mode 3 = RLE (used by BRUTAL intro) - { - UINT32 lineoffs; - int start; - - lineoffs = m_32x_display_dram[scanline]; - - if (m_32x_screenshift == 0) start=0; - else start = -1; - - x = start; - while (x<320) - { - UINT16 coldata, length, l; - coldata = m_32x_display_dram[lineoffs]; - length = ((coldata & 0xff00)>>8)+1; - coldata = (coldata & 0x00ff)>>0; - for (l=0;l=0) - { - m_32x_linerender[x] = m_32x_palette_lookup[(coldata)]; - } - x++; - } - - lineoffs++; - - } - } - else // MODE 2 - 15bpp mode, not used by any commercial games? - { - UINT32 lineoffs; - int start; - - lineoffs = m_32x_display_dram[scanline]; - - if (m_32x_screenshift == 0) start=0; - else start = -1; - - x = start; - while (x<320) - { - UINT16 coldata; - coldata = m_32x_display_dram[lineoffs&0xffff]; - - // need to swap red and blue around for MAME - { - int r = ((coldata >> 0) & 0x1f); - int g = ((coldata >> 5) & 0x1f); - int b = ((coldata >> 10) & 0x1f); - int p = ((coldata >> 15) & 0x01); // priority 'through' bit - - coldata = (r << 10) | (g << 5) | (b << 0) | (p << 15); - - } - - if (x>=0) - m_32x_linerender[x] = coldata; - - x++; - lineoffs++; - } - } - } -} - -void sega_32x_device::_32x_render_videobuffer_to_screenbuffer(int x, UINT32 priority, UINT16 &lineptr) -{ - if (m_32x_displaymode != 0) - { - if (!m_32x_videopriority) - { - if (priority && !(m_32x_linerender[x] & 0x8000)) - lineptr = m_32x_linerender[x] & 0x7fff; - if (m_32x_linerender[x] & 0x8000) - lineptr = m_32x_linerender[x] & 0x7fff; - } - else - { - if (priority && m_32x_linerender[x] & 0x8000) - lineptr = m_32x_linerender[x] & 0x7fff; - if (!(m_32x_linerender[x] & 0x8000)) - lineptr = m_32x_linerender[x] & 0x7fff; - } - } -} - -#if 0 -// for now we just use the regular loading because we have 2 different BIOS roms, and you can't use -bios within a device for obvious reasons -ROM_START( 32x ) - ROM_REGION( 0x400000, "32x_master_sh2", 0 ) - ROM_REGION( 0x400000, "32x_slave_sh2", 0 ) -ROM_END - -const rom_entry *sega_32x_device::device_rom_region() const -{ - return ROM_NAME( 32x ); -} -#endif - - -// brutal needs high levels of interleave or the background animations don't work -// and some stages simply freeze the game, the is not good for performance however. -// -// some games appear to dislike 'perfect' levels of interleave, probably due to -// non-emulated cache, ram waitstates and other issues? -#define _32X_INTERLEAVE_LEVEL \ - MCFG_QUANTUM_TIME(attotime::from_hz(1800000)) - -static MACHINE_CONFIG_FRAGMENT( _32x_ntsc ) - -#ifndef _32X_SWAP_MASTER_SLAVE_HACK - MCFG_CPU_ADD("32x_master_sh2", SH2, (MASTER_CLOCK_NTSC*3)/7 ) - MCFG_CPU_PROGRAM_MAP(sh2_main_map) - MCFG_SH2_IS_SLAVE(0) - MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) -#endif - - MCFG_CPU_ADD("32x_slave_sh2", SH2, (MASTER_CLOCK_NTSC*3)/7 ) - MCFG_CPU_PROGRAM_MAP(sh2_slave_map) - MCFG_SH2_IS_SLAVE(1) - MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) - -#ifdef _32X_SWAP_MASTER_SLAVE_HACK - MCFG_CPU_ADD("32x_master_sh2", SH2, (MASTER_CLOCK_NTSC*3)/7 ) - MCFG_CPU_PROGRAM_MAP(sh2_main_map) - MCFG_SH2_IS_SLAVE(0) - MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) -#endif - - MCFG_DAC_ADD("lch_pwm") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":lspeaker", 0.40) - - MCFG_DAC_ADD("rch_pwm") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":rspeaker", 0.40) - - _32X_INTERLEAVE_LEVEL -MACHINE_CONFIG_END - -static MACHINE_CONFIG_FRAGMENT( _32x_pal ) - -#ifndef _32X_SWAP_MASTER_SLAVE_HACK - MCFG_CPU_ADD("32x_master_sh2", SH2, (MASTER_CLOCK_PAL*3)/7 ) - MCFG_CPU_PROGRAM_MAP(sh2_main_map) - MCFG_SH2_IS_SLAVE(0) - MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) -#endif - - MCFG_CPU_ADD("32x_slave_sh2", SH2, (MASTER_CLOCK_PAL*3)/7 ) - MCFG_CPU_PROGRAM_MAP(sh2_slave_map) - MCFG_SH2_IS_SLAVE(1) - MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) - -#ifdef _32X_SWAP_MASTER_SLAVE_HACK - MCFG_CPU_ADD("32x_master_sh2", SH2, (MASTER_CLOCK_PAL*3)/7 ) - MCFG_CPU_PROGRAM_MAP(sh2_main_map) - MCFG_SH2_IS_SLAVE(0) - MCFG_SH2_FIFO_DATA_AVAIL_CB(sega_32x_device, _32x_fifo_available_callback) -#endif - - MCFG_DAC_ADD("lch_pwm") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":lspeaker", 0.40) - - MCFG_DAC_ADD("rch_pwm") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":rspeaker", 0.40) - - _32X_INTERLEAVE_LEVEL -MACHINE_CONFIG_END - - - -machine_config_constructor sega_32x_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( _32x_ntsc ); -} - -machine_config_constructor sega_32x_pal_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( _32x_pal ); -} - - -void sega_32x_device::device_start() -{ - m_32x_pwm_timer = machine().scheduler().timer_alloc(FUNC(_32x_pwm_callback), (void*)this); - m_32x_pwm_timer->adjust(attotime::never); - - m_32x_dram0 = auto_alloc_array(machine(), UINT16, 0x40000/2); - m_32x_dram1 = auto_alloc_array(machine(), UINT16, 0x40000/2); - - memset(m_32x_dram0, 0x00, 0x40000); - memset(m_32x_dram1, 0x00, 0x40000); - - m_32x_palette_lookup = auto_alloc_array(machine(), UINT16, 0x200/2); - m_32x_palette = auto_alloc_array(machine(), UINT16, 0x200/2); - - memset(m_32x_palette_lookup, 0x00, 0x200); - memset(m_32x_palette, 0x00, 0x200); - - m_32x_display_dram = m_32x_dram0; - m_32x_access_dram = m_32x_dram1; -} - -void sega_32x_device::device_reset() -{ - /* Interrupts are masked / disabled at first */ - m_sh2_master_vint_enable = m_sh2_slave_vint_enable = 0; - m_sh2_master_hint_enable = m_sh2_slave_hint_enable = 0; - m_sh2_master_cmdint_enable = m_sh2_slave_cmdint_enable = 0; - sh2_master_pwmint_enable = sh2_slave_pwmint_enable = 0; - m_sh2_master_vint_pending = m_sh2_slave_vint_pending = 0; - m_sh2_hint_in_vbl = 0; - - // start in a reset state - m_sh2_are_running = 0; - - m_32x_a1518a_reg = 0x00; // inital value - m_32x_68k_a15104_reg = 0x00; - - m_32x_autofill_length = 0; - m_32x_autofill_address = 0; - m_32x_autofill_data = 0; - m_32x_screenshift = 0; - m_32x_videopriority = 0; // MD priority - m_32x_displaymode = 0; - m_32x_240mode = 0; - - m_current_fifo_block = m_fifo_block_a; - m_current_fifo_readblock = m_fifo_block_b; - m_current_fifo_write_pos = 0; - m_current_fifo_read_pos = 0; - m_fifo_block_a_full = 0; - m_fifo_block_b_full = 0; - - m_32x_hcount_compare_val = -1; - m_32x_hcount_reg = 0; - - m_32x_fb_swap = 0; - - m_pwm_tm_reg = 0; - m_pwm_cycle = 0; - m_pwm_ctrl = 0; - - m_lch_index_w = 0; - m_rch_index_w = 0; - - m_total_scanlines = 262; - -// moved from init - - m_32x_adapter_enabled = 0; - m_32x_access_auth = 0; - - if (m_32x_adapter_enabled == 0) - { - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_rom(0x0000000, 0x03fffff, machine().root_device().memregion(":gamecart")->base()); - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector - }; - - - m_a15100_reg = 0x0000; - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15100, 0xa15101, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_w),this)); // framebuffer control regs - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15102, 0xa15103, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_w),this)); // send irq to sh2 - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15104, 0xa15105, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_w),this)); // 68k BANK rom set - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15106, 0xa15107, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_w),this)); // dreq stuff - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15108, 0xa15113, read16_delegate(FUNC(sega_32x_device::_32x_dreq_common_r),this), write16_delegate(FUNC(sega_32x_device::_32x_dreq_common_w),this)); // dreq src / dst / length /fifo - - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa1511a, 0xa1511b, read16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_w),this)); // SEGA TV - - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15120, 0xa1512f, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_commsram_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_commsram_w),this)); // comms reg 0-7 - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15130, 0xa1513f, read16_delegate(FUNC(sega_32x_device::_32x_pwm_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_pwm_w),this)); - - machine().device(":maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0a130ec, 0x0a130ef, read16_delegate(FUNC(sega_32x_device::_32x_68k_MARS_r),this)); // system ID - - - -// checking if these help brutal, they don't. - m_master_cpu->sh2drc_set_options(SH2DRC_COMPATIBLE_OPTIONS); - m_slave_cpu->sh2drc_set_options(SH2DRC_COMPATIBLE_OPTIONS); - - UINT32 *cart = (UINT32 *)memregion(":gamecart_sh2")->base(); - - m_master_cpu->sh2drc_add_fastram(0x06000000, 0x0603ffff, 0, &m_sh2_shared[0]); - m_master_cpu->sh2drc_add_fastram(0x02000000, 0x023fffff, 0, cart); - m_master_cpu->sh2drc_add_fastram(0x22000000, 0x223fffff, 0, cart); - m_slave_cpu->sh2drc_add_fastram(0x06000000, 0x0603ffff, 0, &m_sh2_shared[0]); - m_slave_cpu->sh2drc_add_fastram(0x02000000, 0x023fffff, 0, cart); - m_slave_cpu->sh2drc_add_fastram(0x22000000, 0x223fffff, 0, cart); - - -// install these now, otherwise we'll get the following (incorrect) warnings on startup.. -// SH-2 device ':sega32x:32x_slave_sh2': program space memory map entry 0-3FFF references non-existant region ':slave' -// SH-2 device ':sega32x:32x_master_sh2': program space memory map entry 0-3FFF references non-existant region ':master' - UINT8* masterbios = (UINT8*)machine().root_device().memregion(":master")->base(); - UINT8* slavebios = (UINT8*)machine().root_device().memregion(":slave")->base(); - membank("masterbios")->configure_entries(0, 1, masterbios, 0x4000); - membank("slavebios")->configure_entries(0, 1, slavebios, 0x4000); - membank("masterbios")->set_entry(0); - membank("slavebios")->set_entry(0); -} - -// if the system has a 32x, the extra CPUs are paused at start -void sega_32x_device::pause_cpu() -{ - m_master_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_slave_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); -} diff --git a/src/mess/machine/mega32x.h b/src/mess/machine/mega32x.h deleted file mode 100644 index fd9ed2131a8..00000000000 --- a/src/mess/machine/mega32x.h +++ /dev/null @@ -1,235 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -/* 32X */ - - -// Fifa96 needs the CPUs swapped for the gameplay to enter due to some race conditions -// when using the DRC core. Needs further investigation, the non-DRC core works either -// way -#define _32X_SWAP_MASTER_SLAVE_HACK -#define _32X_COMMS_PORT_SYNC 0 -#define MAX_HPOSITION 480 -/* need to make some pwm stuff part of device */ -#define PWM_FIFO_SIZE m_pwm_tm_reg // guess, Marsch calls this register as FIFO width -#define PWM_CLOCK m_32x_pal ? ((MASTER_CLOCK_PAL*3) / 7) : ((MASTER_CLOCK_NTSC*3) / 7) - - - -#define SH2_VRES_IRQ_LEVEL 14 -#define SH2_VINT_IRQ_LEVEL 12 -#define SH2_HINT_IRQ_LEVEL 10 -#define SH2_CINT_IRQ_LEVEL 8 -#define SH2_PINT_IRQ_LEVEL 6 - -#define MASTER_CLOCK_NTSC 53693175 -#define MASTER_CLOCK_PAL 53203424 - -#include "cpu/sh2/sh2.h" -#include "cpu/sh2/sh2comn.h" -#include "sound/dac.h" - -class sega_32x_device : public device_t -{ -public: - sega_32x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - required_device m_master_cpu; - required_device m_slave_cpu; - required_device m_lch_pwm; - required_device m_rch_pwm; - - required_shared_ptr m_sh2_shared; - - void pause_cpu(); - - // set some variables at start, depending on region (shall be moved to a device interface?) - void set_framerate(int rate) { m_framerate = rate; } - void set_32x_pal(bool pal) { m_32x_pal = pal ? 1 : 0; } - void set_total_scanlines(int total) { m_base_total_scanlines = total; } // this get set at start only - void update_total_scanlines(bool mode3) { m_total_scanlines = mode3 ? (m_base_total_scanlines * 2) : m_base_total_scanlines; } // this gets set at each EOF - - // static configuration - static void static_set_palette_tag(device_t &device, const char *tag); - - DECLARE_READ32_MEMBER( _32x_sh2_master_4000_common_4002_r ); - DECLARE_READ32_MEMBER( _32x_sh2_slave_4000_common_4002_r ); - DECLARE_READ32_MEMBER( _32x_sh2_common_4004_common_4006_r ); - DECLARE_WRITE32_MEMBER( _32x_sh2_master_4000_common_4002_w ); - DECLARE_WRITE32_MEMBER( _32x_sh2_slave_4000_common_4002_w ); - DECLARE_WRITE32_MEMBER( _32x_sh2_common_4004_common_4006_w ); - DECLARE_WRITE32_MEMBER( _32x_sh2_master_4014_master_4016_w ); - DECLARE_WRITE32_MEMBER( _32x_sh2_master_4018_master_401a_w ); - DECLARE_WRITE32_MEMBER( _32x_sh2_master_401c_master_401e_w ); - DECLARE_WRITE32_MEMBER( _32x_sh2_slave_4014_slave_4016_w ); - DECLARE_WRITE32_MEMBER( _32x_sh2_slave_4018_slave_401a_w ); - DECLARE_WRITE32_MEMBER( _32x_sh2_slave_401c_slave_401e_w ); - - - DECLARE_READ16_MEMBER( _32x_68k_palette_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_palette_w ); - DECLARE_READ16_MEMBER( _32x_68k_dram_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_dram_w ); - DECLARE_READ16_MEMBER( _32x_68k_dram_overwrite_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_dram_overwrite_w ); - DECLARE_READ16_MEMBER( _32x_68k_a15106_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_a15106_w ); - DECLARE_READ16_MEMBER( _32x_dreq_common_r ); - DECLARE_WRITE16_MEMBER( _32x_dreq_common_w ); - DECLARE_READ16_MEMBER( _32x_68k_a1511a_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_a1511a_w ); - DECLARE_READ16_MEMBER( _32x_68k_m_hint_vector_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_m_hint_vector_w ); - DECLARE_READ16_MEMBER( _32x_68k_MARS_r ); - DECLARE_READ16_MEMBER( _32x_68k_a15100_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_a15100_w ); - DECLARE_READ16_MEMBER( _32x_68k_a15102_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_a15102_w ); - DECLARE_READ16_MEMBER( _32x_68k_a15104_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_a15104_w ); - DECLARE_READ16_MEMBER( _32x_68k_m_commsram_r ); - DECLARE_WRITE16_MEMBER( _32x_68k_m_commsram_w ); - DECLARE_READ16_MEMBER( _32x_pwm_r ); - DECLARE_WRITE16_MEMBER( _32x_pwm_w ); - DECLARE_WRITE16_MEMBER( _32x_68k_pwm_w ); - DECLARE_READ16_MEMBER( _32x_common_vdp_regs_r ); - DECLARE_WRITE16_MEMBER( _32x_common_vdp_regs_w ); - DECLARE_READ16_MEMBER( _32x_sh2_master_4000_r ); - DECLARE_WRITE16_MEMBER( _32x_sh2_master_4000_w ); - DECLARE_READ16_MEMBER( _32x_sh2_slave_4000_r ); - DECLARE_WRITE16_MEMBER( _32x_sh2_slave_4000_w ); - DECLARE_READ16_MEMBER( _32x_sh2_common_4002_r ); - DECLARE_WRITE16_MEMBER( _32x_sh2_common_4002_w ); - DECLARE_READ16_MEMBER( _32x_sh2_common_4004_r ); - DECLARE_WRITE16_MEMBER( _32x_sh2_common_4004_w ); - DECLARE_READ16_MEMBER( _32x_sh2_common_4006_r ); - DECLARE_WRITE16_MEMBER( _32x_sh2_common_4006_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_master_4014_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_slave_4014_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_master_4016_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_slave_4016_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_master_4018_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_slave_4018_w ) ; - DECLARE_WRITE16_MEMBER( _32x_sh2_master_401a_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_slave_401a_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_master_401c_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_slave_401c_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_master_401e_w ); - DECLARE_WRITE16_MEMBER( _32x_sh2_slave_401e_w ); - - SH2_DMA_FIFO_DATA_AVAILABLE_CB(_32x_fifo_available_callback); - - void _32x_render_videobuffer_to_screenbuffer_helper(int scanline); - void _32x_render_videobuffer_to_screenbuffer(int x, UINT32 priority, UINT16 &lineptr); - int sh2_master_pwmint_enable, sh2_slave_pwmint_enable; - - void _32x_check_framebuffer_swap(bool enabled); - void _32x_check_irqs(); - void _32x_interrupt_cb(int scanline, int irq6); - - /* our main vblank handler resets this */ - int m_32x_hcount_compare_val; - int m_32x_vblank_flag; - int m_sh2_are_running; - int m_32x_240mode; - UINT16 m_32x_a1518a_reg; - - void handle_pwm_callback(); - void calculate_pwm_timer(); - UINT16 m_pwm_ctrl, m_pwm_cycle, m_pwm_tm_reg; - UINT16 m_cur_lch[0x10],m_cur_rch[0x10]; - UINT16 m_pwm_cycle_reg; //used for latching - UINT8 m_pwm_timer_tick; - UINT8 m_lch_index_r, m_rch_index_r, m_lch_index_w, m_rch_index_w; - UINT16 m_lch_fifo_state, m_rch_fifo_state; - - - UINT16 get_hposition(void); - - emu_timer *m_32x_pwm_timer; - -protected: - virtual void device_start(); - virtual void device_reset(); - - // optional information overrides -// virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - -private: - - int m_32x_displaymode; - int m_32x_videopriority; - UINT32 m_32x_linerender[320+258]; // tmp buffer (bigger than it needs to be to simplify RLE decode) - -// virtual void device_config_complete(); - int m_32x_adapter_enabled; - int m_32x_access_auth; - int m_32x_screenshift; - - UINT16 m_32x_68k_a15104_reg; - int m_sh2_master_vint_enable, m_sh2_slave_vint_enable; - int m_sh2_master_hint_enable, m_sh2_slave_hint_enable; - int m_sh2_master_cmdint_enable, m_sh2_slave_cmdint_enable; - int m_sh2_hint_in_vbl; - int m_sh2_master_vint_pending; - int m_sh2_slave_vint_pending; - int m_32x_fb_swap; - int m_32x_hcount_reg; - - UINT16 m_32x_autofill_length; - UINT16 m_32x_autofill_address; - UINT16 m_32x_autofill_data; - UINT16 m_a15106_reg; - UINT16 m_dreq_src_addr[2],m_dreq_dst_addr[2],m_dreq_size; - UINT8 m_sega_tv; - UINT16 m_hint_vector[2]; - UINT16 m_a15100_reg; - int m_32x_68k_a15102_reg; - - int m_32x_pal; - int m_framerate; - int m_base_total_scanlines; - int m_total_scanlines; - - UINT16 m_commsram[8]; - - UINT16* m_32x_dram0; - UINT16* m_32x_dram1; - UINT16 *m_32x_display_dram, *m_32x_access_dram; - UINT16* m_32x_palette; - UINT16* m_32x_palette_lookup; - - UINT16 m_fifo_block_a[4]; - UINT16 m_fifo_block_b[4]; - UINT16* m_current_fifo_block; - UINT16* m_current_fifo_readblock; - int m_current_fifo_write_pos; - int m_current_fifo_read_pos; - int m_fifo_block_a_full; - int m_fifo_block_b_full; - - required_device m_palette; -}; - - -class sega_32x_ntsc_device : public sega_32x_device -{ - public: - sega_32x_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -}; - -class sega_32x_pal_device : public sega_32x_device -{ - public: - sega_32x_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - protected: - virtual machine_config_constructor device_mconfig_additions() const; -}; - - -extern const device_type SEGA_32X_NTSC; -extern const device_type SEGA_32X_PAL; - -#define MCFG_SEGA_32X_PALETTE(_palette_tag) \ - sega_32x_device::static_set_palette_tag(*device, "^" _palette_tag); diff --git a/src/mess/machine/megacd.c b/src/mess/machine/megacd.c deleted file mode 100644 index c416bf73d89..00000000000 --- a/src/mess/machine/megacd.c +++ /dev/null @@ -1,1914 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -#include "emu.h" -#include "machine/megacd.h" -#include "machine/nvram.h" -#include "megacd.lh" - - -const device_type SEGA_SEGACD_US = &device_creator; -const device_type SEGA_SEGACD_JAPAN = &device_creator; -const device_type SEGA_SEGACD_EUROPE = &device_creator; - - -/* Callback when the genesis enters interrupt code */ -IRQ_CALLBACK_MEMBER(sega_segacd_device::segacd_sub_int_callback) -{ - if (irqline==2) - { - // clear this bit - m_a12000_halt_reset_reg &= ~0x0100; - m_scdcpu->set_input_line(2, CLEAR_LINE); - } - - return (0x60+irqline*4)/4; // vector address -} - - -TIMER_DEVICE_CALLBACK_MEMBER( sega_segacd_device::irq3_timer_callback ) -{ - CHECK_SCD_LV3_INTERRUPT - m_irq3_timer->adjust(SEGACD_IRQ3_TIMER_SPEED); -} - - -TIMER_DEVICE_CALLBACK_MEMBER( sega_segacd_device::stamp_timer_callback ) -{ - //printf("stamp_timer_callback\n"); - - CHECK_SCD_LV1_INTERRUPT - - segacd_conversion_active = 0; - - // this ends up as 0 after processing (soniccd bonus stage) - segacd_imagebuffer_vdot_size = 0; -} - - -static ADDRESS_MAP_START( segacd_map, AS_PROGRAM, 16, sega_segacd_device ) - AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_SHARE("prgram") - AM_RANGE(0x080000, 0x0bffff) AM_READWRITE(segacd_sub_dataram_part1_r, segacd_sub_dataram_part1_w) AM_SHARE("dataram") - AM_RANGE(0x0c0000, 0x0dffff) AM_READWRITE(segacd_sub_dataram_part2_r, segacd_sub_dataram_part2_w) //AM_SHARE("dataram2") - - AM_RANGE(0xfe0000, 0xfe3fff) AM_READWRITE8(backupram_r, backupram_w, 0x00ff) // backup RAM, odd bytes only! - - AM_RANGE(0xff0000, 0xff001f) AM_DEVWRITE8("rfsnd", rf5c68_device, rf5c68_w, 0x00ff) // PCM, RF5C164 - AM_RANGE(0xff0020, 0xff003f) AM_DEVREAD8("rfsnd", rf5c68_device, rf5c68_r, 0x00ff) - AM_RANGE(0xff2000, 0xff3fff) AM_DEVREADWRITE8("rfsnd", rf5c68_device, rf5c68_mem_r, rf5c68_mem_w,0x00ff) // PCM, RF5C164 - - AM_RANGE(0xff8000 ,0xff8001) AM_READWRITE(segacd_sub_led_ready_r, segacd_sub_led_ready_w) - AM_RANGE(0xff8002 ,0xff8003) AM_READWRITE(segacd_sub_memory_mode_r, segacd_sub_memory_mode_w) - - AM_RANGE(0xff8004 ,0xff8005) AM_DEVREADWRITE("tempcdc",lc89510_temp_device, segacd_cdc_mode_address_r, segacd_cdc_mode_address_w) - AM_RANGE(0xff8006 ,0xff8007) AM_DEVREADWRITE("tempcdc",lc89510_temp_device,segacd_cdc_data_r, segacd_cdc_data_w) - AM_RANGE(0xff8008, 0xff8009) AM_DEVREAD("tempcdc",lc89510_temp_device, cdc_data_sub_r) - AM_RANGE(0xff800a, 0xff800b) AM_READWRITE(segacd_dmaaddr_r,segacd_dmaaddr_w) // DMA Address (not CDC, used in conjunction with) - AM_RANGE(0xff800c, 0xff800d) AM_READWRITE(segacd_stopwatch_timer_r, segacd_stopwatch_timer_w)// Stopwatch timer - AM_RANGE(0xff800e ,0xff800f) AM_READWRITE(segacd_comms_flags_r, segacd_comms_flags_subcpu_w) - AM_RANGE(0xff8010 ,0xff801f) AM_READWRITE(segacd_comms_sub_part1_r, segacd_comms_sub_part1_w) - AM_RANGE(0xff8020 ,0xff802f) AM_READWRITE(segacd_comms_sub_part2_r, segacd_comms_sub_part2_w) - AM_RANGE(0xff8030, 0xff8031) AM_READWRITE(segacd_irq3timer_r, segacd_irq3timer_w) // Timer W/INT3 - AM_RANGE(0xff8032, 0xff8033) AM_DEVREADWRITE("tempcdc",lc89510_temp_device,segacd_irq_mask_r,segacd_irq_mask_w) - AM_RANGE(0xff8034, 0xff8035) AM_DEVREADWRITE("tempcdc",lc89510_temp_device,segacd_cdfader_r,segacd_cdfader_w) // CD Fader - AM_RANGE(0xff8036, 0xff8037) AM_DEVREADWRITE("tempcdc",lc89510_temp_device,segacd_cdd_ctrl_r,segacd_cdd_ctrl_w) - AM_RANGE(0xff8038, 0xff8041) AM_DEVREAD8("tempcdc",lc89510_temp_device,segacd_cdd_rx_r,0xffff) - AM_RANGE(0xff8042, 0xff804b) AM_DEVWRITE8("tempcdc",lc89510_temp_device,segacd_cdd_tx_w,0xffff) - AM_RANGE(0xff804c, 0xff804d) AM_READWRITE8(font_color_r, font_color_w, 0x00ff) - AM_RANGE(0xff804e, 0xff804f) AM_RAM AM_SHARE("font_bits") - AM_RANGE(0xff8050, 0xff8057) AM_READ(font_converted_r) - AM_RANGE(0xff8058, 0xff8059) AM_READWRITE(segacd_stampsize_r, segacd_stampsize_w) // Stamp size - AM_RANGE(0xff805a, 0xff805b) AM_READWRITE(segacd_stampmap_base_address_r, segacd_stampmap_base_address_w) // Stamp map base address - AM_RANGE(0xff805c, 0xff805d) AM_READWRITE(segacd_imagebuffer_vcell_size_r, segacd_imagebuffer_vcell_size_w)// Image buffer V cell size - AM_RANGE(0xff805e, 0xff805f) AM_READWRITE(segacd_imagebuffer_start_address_r, segacd_imagebuffer_start_address_w) // Image buffer start address - AM_RANGE(0xff8060, 0xff8061) AM_READWRITE(segacd_imagebuffer_offset_r, segacd_imagebuffer_offset_w) - AM_RANGE(0xff8062, 0xff8063) AM_READWRITE(segacd_imagebuffer_hdot_size_r, segacd_imagebuffer_hdot_size_w) // Image buffer H dot size - AM_RANGE(0xff8064, 0xff8065) AM_READWRITE(segacd_imagebuffer_vdot_size_r, segacd_imagebuffer_vdot_size_w ) // Image buffer V dot size - AM_RANGE(0xff8066, 0xff8067) AM_WRITE(segacd_trace_vector_base_address_w)// Trace vector base address -// AM_RANGE(0xff8068, 0xff8069) // Subcode address - -// AM_RANGE(0xff8100, 0xff817f) // Subcode buffer area -// AM_RANGE(0xff8180, 0xff81ff) // mirror of subcode buffer area - -ADDRESS_MAP_END - - -// the tiles in RAM are 8x8 tiles -// they are referenced in the cell look-up map as either 16x16 or 32x32 tiles (made of 4 / 16 8x8 tiles) - -#define SEGACD_BYTES_PER_TILE16 (128) -#define SEGACD_BYTES_PER_TILE32 (512) - -#define SEGACD_NUM_TILES16 (0x40000/SEGACD_BYTES_PER_TILE16) -#define SEGACD_NUM_TILES32 (0x40000/SEGACD_BYTES_PER_TILE32) - -#define _16x16_SEQUENCE_1 { STEP8(0, 4), STEP8(512, 4) }, -#define _16x16_SEQUENCE_1_FLIP { STEP8(512+28, -4), STEP8(28, -4) }, - -#define _16x16_SEQUENCE_2 { STEP16(0, 32) }, -#define _16x16_SEQUENCE_2_FLIP { STEP16(15*32, -32) }, - - -#define _16x16_START \ -{ \ - 16,16, \ - SEGACD_NUM_TILES16, \ - 4, \ - { 0,1,2,3 }, -#define _16x16_END \ - 8*128 \ -}; -#define _32x32_START \ -{ \ - 32,32, \ - SEGACD_NUM_TILES32, \ - 4, \ - { 0,1,2,3 }, - -#define _32x32_END \ - 8*512 \ -}; - -#define _32x32_SEQUENCE_1 { STEP8(0, 4), STEP8(1024, 4), STEP8(2048, 4), STEP8(3072, 4) }, -#define _32x32_SEQUENCE_1_FLIP { STEP8(3072+28, -4), STEP8(2048+28, -4), STEP8(1024+28, -4), STEP8(28, -4) }, - -#define _32x32_SEQUENCE_2 { STEP32(0, 32) }, -#define _32x32_SEQUENCE_2_FLIP { STEP32(31*32, -32) }, - - -/* 16x16 decodes */ -static const gfx_layout sega_16x16_r00_f0_layout = -_16x16_START - _16x16_SEQUENCE_1 - _16x16_SEQUENCE_2 -_16x16_END - -static const gfx_layout sega_16x16_r01_f0_layout = -_16x16_START - _16x16_SEQUENCE_2 - _16x16_SEQUENCE_1_FLIP -_16x16_END - -static const gfx_layout sega_16x16_r10_f0_layout = -_16x16_START - _16x16_SEQUENCE_1_FLIP - _16x16_SEQUENCE_2_FLIP -_16x16_END - -static const gfx_layout sega_16x16_r11_f0_layout = -_16x16_START - _16x16_SEQUENCE_2_FLIP - _16x16_SEQUENCE_1 -_16x16_END - -static const gfx_layout sega_16x16_r00_f1_layout = -_16x16_START - _16x16_SEQUENCE_1_FLIP - _16x16_SEQUENCE_2 -_16x16_END - -static const gfx_layout sega_16x16_r01_f1_layout = -_16x16_START - _16x16_SEQUENCE_2 - _16x16_SEQUENCE_1 -_16x16_END - -static const gfx_layout sega_16x16_r10_f1_layout = -_16x16_START - _16x16_SEQUENCE_1 - _16x16_SEQUENCE_2_FLIP -_16x16_END - -static const gfx_layout sega_16x16_r11_f1_layout = -_16x16_START - _16x16_SEQUENCE_2_FLIP - _16x16_SEQUENCE_1_FLIP -_16x16_END - -/* 32x32 decodes */ -static const gfx_layout sega_32x32_r00_f0_layout = -_32x32_START - _32x32_SEQUENCE_1 - _32x32_SEQUENCE_2 -_32x32_END - -static const gfx_layout sega_32x32_r01_f0_layout = -_32x32_START - _32x32_SEQUENCE_2 - _32x32_SEQUENCE_1_FLIP -_32x32_END - -static const gfx_layout sega_32x32_r10_f0_layout = -_32x32_START - _32x32_SEQUENCE_1_FLIP - _32x32_SEQUENCE_2_FLIP -_32x32_END - -static const gfx_layout sega_32x32_r11_f0_layout = -_32x32_START - _32x32_SEQUENCE_2_FLIP - _32x32_SEQUENCE_1 -_32x32_END - -static const gfx_layout sega_32x32_r00_f1_layout = -_32x32_START - _32x32_SEQUENCE_1_FLIP - _32x32_SEQUENCE_2 -_32x32_END - -static const gfx_layout sega_32x32_r01_f1_layout = -_32x32_START - _32x32_SEQUENCE_2 - _32x32_SEQUENCE_1 -_32x32_END - -static const gfx_layout sega_32x32_r10_f1_layout = -_32x32_START - _32x32_SEQUENCE_1 - _32x32_SEQUENCE_2_FLIP -_32x32_END - -static const gfx_layout sega_32x32_r11_f1_layout = -_32x32_START - _32x32_SEQUENCE_2_FLIP - _32x32_SEQUENCE_1_FLIP -_32x32_END - -static GFXDECODE_START( segacd ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r00_f0_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r01_f0_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r10_f0_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r11_f0_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r00_f1_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r11_f1_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r10_f1_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_16x16_r01_f1_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r00_f0_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r01_f0_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r10_f0_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r11_f0_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r00_f1_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r11_f1_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r10_f1_layout, 0, 0 ) - GFXDECODE_DEVICE_RAM( "dataram", 0, sega_32x32_r01_f1_layout, 0, 0 ) -GFXDECODE_END - - -static MACHINE_CONFIG_FRAGMENT( segacd_fragment ) - - MCFG_CPU_ADD("segacd_68k", M68000, SEGACD_CLOCK ) /* 12.5 MHz */ - MCFG_CPU_PROGRAM_MAP(segacd_map) - MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(DEVICE_SELF, sega_segacd_device,segacd_sub_int_callback) - - MCFG_DEVICE_ADD("cdc", LC89510, 0) // cd controller - - // temporary until things are cleaned up - MCFG_DEVICE_ADD("tempcdc", LC89510_TEMP, 0) // cd controller - MCFG_SEGACD_HACK_SET_CDC_DO_DMA( sega_segacd_device, SegaCD_CDC_Do_DMA ) // hack - - MCFG_TIMER_ADD_NONE("sw_timer") //stopwatch timer - MCFG_TIMER_DRIVER_ADD("stamp_timer", sega_segacd_device, stamp_timer_callback) - MCFG_TIMER_DRIVER_ADD("irq3_timer", sega_segacd_device, irq3_timer_callback) - MCFG_TIMER_DRIVER_ADD("dma_timer", sega_segacd_device, dma_timer_callback) - - MCFG_DEFAULT_LAYOUT( layout_megacd ) - - MCFG_RF5C68_ADD("rfsnd", SEGACD_CLOCK) // RF5C164! - MCFG_SOUND_ROUTE( 0, ":lspeaker", 0.50 ) - MCFG_SOUND_ROUTE( 1, ":rspeaker", 0.50 ) - - MCFG_NVRAM_ADD_0FILL("backupram") - - MCFG_QUANTUM_PERFECT_CPU("segacd_68k") // perfect sync to the fastest cpu -MACHINE_CONFIG_END - - - -machine_config_constructor sega_segacd_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( segacd_fragment ); -} - - -sega_segacd_device::sega_segacd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_gfx_interface(mconfig, *this, GFXDECODE_NAME( segacd )), - m_scdcpu(*this, "segacd_68k"), - m_rfsnd(*this, "rfsnd"), - m_lc89510_temp(*this, "tempcdc"), - m_stopwatch_timer(*this, "sw_timer"), - m_stamp_timer(*this, "stamp_timer"), - m_irq3_timer(*this, "irq3_timer"), - m_dma_timer(*this, "dma_timer"), - m_prgram(*this, "prgram"), - m_dataram(*this, "dataram"), - m_font_bits(*this, "font_bits") -{ -} - -sega_segacd_us_device::sega_segacd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : sega_segacd_device(mconfig, SEGA_SEGACD_US, "sega_segacd_us", tag, owner, clock, "sega_segacd_us", __FILE__) -{ -} - -sega_segacd_japan_device::sega_segacd_japan_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : sega_segacd_device(mconfig, SEGA_SEGACD_JAPAN, "sega_segacd_japan", tag, owner, clock, "sega_segacd_japan", __FILE__) -{ -} - -sega_segacd_europe_device::sega_segacd_europe_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : sega_segacd_device(mconfig, SEGA_SEGACD_EUROPE, "sega_segacd_europe", tag, owner, clock, "sega_segacd_europe", __FILE__) -{ -} - - -inline void sega_segacd_device::write_pixel(UINT8 pix, int pixeloffset) -{ - int shift = 12-(4*(pixeloffset&0x3)); - UINT16 datamask = (0x000f) << shift; - - int offset = pixeloffset>>3; - if (pixeloffset&4) offset++; - - offset &=0x1ffff; - - switch (segacd_memory_priority_mode) - { - case 0x00: // normal write, just write the data - m_dataram[offset] = m_dataram[offset] &~ datamask; - m_dataram[offset] |= pix << shift; - break; - - case 0x01: // underwrite, only write if the existing data is 0 - if ((m_dataram[offset]&datamask) == 0x0000) - { - m_dataram[offset] = m_dataram[offset] &~ datamask; - m_dataram[offset] |= pix << shift; - } - break; - - case 0x02: // overwrite, only write non-zero data - if (pix) - { - m_dataram[offset] = m_dataram[offset] &~ datamask; - m_dataram[offset] |= pix << shift; - } - break; - - default: - case 0x03: - pix = machine().rand() & 0x000f; - m_dataram[offset] = m_dataram[offset] &~ datamask; - m_dataram[offset] |= pix << shift; - break; - - } -} - -// 1meg / 2meg swap is interleaved swap, not half/half of the ram? -// Wily Beamish and Citizen X appear to rely on this -// however, it breaks the megacdj bios (megacd2j still works!) -// (maybe that's a timing issue instead?) -UINT16 sega_segacd_device::segacd_1meg_mode_word_read(int offset, UINT16 mem_mask) -{ - offset *= 2; - - if ((offset&0x20000)) - offset +=1; - - offset &=0x1ffff; - - return m_dataram[offset]; -} - - -void sega_segacd_device::segacd_1meg_mode_word_write(int offset, UINT16 data, UINT16 mem_mask, int use_pm) -{ - offset *= 2; - - if ((offset&0x20000)) - offset +=1; - - offset &=0x1ffff; - - if (use_pm) - { - // priority mode can apply when writing with the double up buffer mode - // Jaguar XJ220 relies on this - switch (segacd_memory_priority_mode) - { - case 0x00: // normal write, just write the data - COMBINE_DATA(&m_dataram[offset]); - break; - - case 0x01: // underwrite, only write if the existing data is 0 - if (ACCESSING_BITS_8_15) - { - if ((m_dataram[offset]&0xf000) == 0x0000) m_dataram[offset] |= (data)&0xf000; - if ((m_dataram[offset]&0x0f00) == 0x0000) m_dataram[offset] |= (data)&0x0f00; - } - if (ACCESSING_BITS_0_7) - { - if ((m_dataram[offset]&0x00f0) == 0x0000) m_dataram[offset] |= (data)&0x00f0; - if ((m_dataram[offset]&0x000f) == 0x0000) m_dataram[offset] |= (data)&0x000f; - } - break; - - case 0x02: // overwrite, only write non-zero data - if (ACCESSING_BITS_8_15) - { - if ((data)&0xf000) m_dataram[offset] = (m_dataram[offset] & 0x0fff) | ((data)&0xf000); - if ((data)&0x0f00) m_dataram[offset] = (m_dataram[offset] & 0xf0ff) | ((data)&0x0f00); - } - if (ACCESSING_BITS_0_7) - { - if ((data)&0x00f0) m_dataram[offset] = (m_dataram[offset] & 0xff0f) | ((data)&0x00f0); - if ((data)&0x000f) m_dataram[offset] = (m_dataram[offset] & 0xfff0) | ((data)&0x000f); - } - break; - - default: - case 0x03: // invalid? - COMBINE_DATA(&m_dataram[offset]); - break; - - } - } - else - { - COMBINE_DATA(&m_dataram[offset]); - } -} - - - - -WRITE16_MEMBER( sega_segacd_device::scd_a12000_halt_reset_w ) -{ - UINT16 old_halt = m_a12000_halt_reset_reg; - - COMBINE_DATA(&m_a12000_halt_reset_reg); - - if (ACCESSING_BITS_0_7) - { - // reset line - if (m_a12000_halt_reset_reg & 0x0001) - { - m_scdcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - if (!(old_halt&0x0001)) printf("clear reset slave\n"); - } - else - { - m_scdcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - if ((old_halt&0x0001)) printf("assert reset slave\n"); - } - - // request BUS - if (m_a12000_halt_reset_reg & 0x0002) - { - m_scdcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - if (!(old_halt&0x0002)) printf("halt slave\n"); - } - else - { - m_scdcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - if ((old_halt&0x0002)) printf("resume slave\n"); - } - } - - if (ACCESSING_BITS_8_15) - { - if (m_a12000_halt_reset_reg & 0x0100) - { - CHECK_SCD_LV2_INTERRUPT - } - - if (m_a12000_halt_reset_reg & 0x8000) - { - // not writable.. but can read irq mask here? - //printf("m_a12000_halt_reset_reg & 0x8000 set\n"); // irq2 mask? - } - - - } -} - -READ16_MEMBER( sega_segacd_device::scd_a12000_halt_reset_r ) -{ - return m_a12000_halt_reset_reg; -} - - -/******************************************************************************** - MEMORY MODE CONTROL - - main / sub sides differ! -********************************************************************************/ - -// -// we might need a delay on the segacd_maincpu_has_ram_access registers, as they actually indicate requests being made -// so probably don't change instantly... -// - - -READ16_MEMBER( sega_segacd_device::scd_a12002_memory_mode_r ) -{ - int temp = scd_rammode; - int temp2 = 0; - - temp2 |= (scd_mode_dmna_ret_flags>>(temp*4))&0x7; - - return (segacd_ram_writeprotect_bits << 8) | - (segacd_4meg_prgbank << 6) | - temp2; - -} - - -/* I'm still not 100% clear how this works, the sources I have are a bit vague, - it might still be incorrect in both modes - - for a simple way to swap blocks of ram between cpus this is stupidly convoluted - - */ - -// DMNA = Decleration Mainram No Access (bit 0) -// RET = Return access (bit 1) - - -WRITE8_MEMBER( sega_segacd_device::scd_a12002_memory_mode_w_8_15 ) -{ - if (data & 0xff00) - { - printf("write protect bits set %02x\n", data); - } - - segacd_ram_writeprotect_bits = data; -} - - -WRITE8_MEMBER( sega_segacd_device::scd_a12002_memory_mode_w_0_7 ) -{ - //printf("scd_a12002_memory_mode_w_0_7 %04x\n",data); - - segacd_4meg_prgbank = (data&0x00c0)>>6; - - if (scd_rammode&0x2) - { // ==0x2 (1 meg mode) - if (!(data&2)) // check DMNA bit - { - scd_mode_dmna_ret_flags |= 0x2200; - } - } - else // == 0x0 (2 meg mode) - { - if (data&2) // check DMNA bit - { - scd_rammode = 1; - } - } -} - - -WRITE16_MEMBER( sega_segacd_device::scd_a12002_memory_mode_w ) -{ - if (ACCESSING_BITS_8_15) - scd_a12002_memory_mode_w_8_15(space, 0, data>>8, mem_mask>>8); - - if (ACCESSING_BITS_0_7) - scd_a12002_memory_mode_w_0_7(space, 0, data&0xff, mem_mask&0xff); -} - - - - -READ16_MEMBER( sega_segacd_device::segacd_sub_memory_mode_r ) -{ - int temp = scd_rammode; - int temp2 = 0; - - temp2 |= (scd_mode_dmna_ret_flags>>(temp*4))&0x7; - - return (segacd_ram_writeprotect_bits << 8) | - (segacd_memory_priority_mode << 3) | - temp2; -} - - -WRITE8_MEMBER( sega_segacd_device::segacd_sub_memory_mode_w_8_15 ) -{ - /* setting write protect bits from sub-cpu has no effect? */ -} - - - -WRITE8_MEMBER( sega_segacd_device::segacd_sub_memory_mode_w_0_7 ) -{ - segacd_memory_priority_mode = (data&0x0018)>>3; - - // If the mode bit is 0 then we're requesting a change to - // 2Meg mode? - - //printf("segacd_sub_memory_mode_w_0_7 %04x\n",data); - - if (!(data&4)) // check ram mode bit - { // == 0x0 - 2 meg mode - scd_mode_dmna_ret_flags &= 0xddff; - - if (data&1) // check RET - { - // If RET is set and the Mode bit in the write is set to 2M then we want to change to 2M mode - // If we're already in 2M mode it has no effect - scd_rammode = 0; - - } - else - { - // == 0x4 - 1 meg mode - - int temp = scd_rammode; - if (temp&2) // check ram mode - { // == 0x2 - 1 meg mode - scd_mode_dmna_ret_flags &= 0xffde; - scd_rammode = temp &1; - } - } - } - else - { // == 0x4 - 1 meg mode - data &=1; - int temp = data; - int scd_rammode_old = scd_rammode; - data |=2; - - temp ^= scd_rammode_old; - scd_rammode = data; - - if (scd_rammode_old & 2) - { // == 0x2 - already in 1 meg mode - if (temp & 1) // ret bit - { - scd_mode_dmna_ret_flags &= 0xddff; - } - } - else - { // == 0x0 - currently in 2 meg mode - scd_mode_dmna_ret_flags &= 0xddff; - } - } -} - -WRITE16_MEMBER( sega_segacd_device::segacd_sub_memory_mode_w ) -{ - //printf("segacd_sub_memory_mode_w %04x %04x\n", data, mem_mask); - - - if (ACCESSING_BITS_8_15) - segacd_sub_memory_mode_w_8_15(space, 0, data>>8, mem_mask>>8); - - if (ACCESSING_BITS_0_7) - segacd_sub_memory_mode_w_0_7(space, 0, data&0xff, mem_mask&0xff); -} - - -/******************************************************************************** - END MEMORY MODE CONTROL -********************************************************************************/ - -/******************************************************************************** - COMMUNICATION FLAGS - - main / sub sides differ in which bits are write only -********************************************************************************/ - - -READ16_MEMBER( sega_segacd_device::segacd_comms_flags_r ) -{ - return segacd_comms_flags; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_comms_flags_subcpu_w ) -{ - if (ACCESSING_BITS_8_15) // Dragon's Lair - { - segacd_comms_flags = (segacd_comms_flags & 0xff00) | ((data >> 8) & 0x00ff); - } - - // flashback needs low bits to take priority in word writes - if (ACCESSING_BITS_0_7) - { - segacd_comms_flags = (segacd_comms_flags & 0xff00) | (data & 0x00ff); - } -} - -WRITE16_MEMBER( sega_segacd_device::segacd_comms_flags_maincpu_w ) -{ - if (ACCESSING_BITS_8_15) - { - segacd_comms_flags = (segacd_comms_flags & 0x00ff) | (data & 0xff00); - } - - // flashback needs low bits to take priority in word writes - if (ACCESSING_BITS_0_7) - { - segacd_comms_flags = (segacd_comms_flags & 0x00ff) | ((data << 8) & 0xff00); - } -} - -READ16_MEMBER( sega_segacd_device::scd_4m_prgbank_ram_r ) -{ - UINT16 realoffset = ((segacd_4meg_prgbank * 0x20000)/2) + offset; - return m_prgram[realoffset]; - -} - -WRITE16_MEMBER( sega_segacd_device::scd_4m_prgbank_ram_w ) -{ - UINT16 realoffset = ((segacd_4meg_prgbank * 0x20000)/2) + offset; - - // todo: - // check for write protection? (or does that only apply to writes on the SubCPU side? - - COMBINE_DATA(&m_prgram[realoffset]); - -} - - - -READ16_MEMBER( sega_segacd_device::segacd_comms_main_part1_r ) -{ - return segacd_comms_part1[offset]; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_comms_main_part1_w ) -{ - COMBINE_DATA(&segacd_comms_part1[offset]); -} - -READ16_MEMBER( sega_segacd_device::segacd_comms_main_part2_r ) -{ - return segacd_comms_part2[offset]; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_comms_main_part2_w ) -{ - printf("Sega CD main CPU attempting to write to read only comms regs\n"); -} - - -READ16_MEMBER( sega_segacd_device::segacd_comms_sub_part1_r ) -{ - return segacd_comms_part1[offset]; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_comms_sub_part1_w ) -{ - printf("Sega CD sub CPU attempting to write to read only comms regs\n"); -} - -READ16_MEMBER( sega_segacd_device::segacd_comms_sub_part2_r ) -{ - return segacd_comms_part2[offset]; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_comms_sub_part2_w ) -{ - COMBINE_DATA(&segacd_comms_part2[offset]); -} - - -READ16_MEMBER( sega_segacd_device::segacd_main_dataram_part1_r ) -{ - if ((scd_rammode&2)==RAM_MODE_2MEG) - { - // is this correct? - if (!(scd_rammode&1)) - { - //printf("segacd_main_dataram_part1_r in mode 0 %08x %04x\n", offset*2, m_dataram[offset]); - - return m_dataram[offset]; - - } - else - { - //printf("Illegal: segacd_main_dataram_part1_r in mode 0 without permission\n"); - return 0xffff; - } - - } - else if ((scd_rammode&2)==RAM_MODE_1MEG) - { - if (offset<0x20000/2) - { - // wordram accees - //printf("Unspported: segacd_main_dataram_part1_r (word RAM) in mode 1\n"); - - // ret bit set by sub cpu determines which half of WorkRAM we have access to? - if (scd_rammode&1) - { - return segacd_1meg_mode_word_read(offset+0x20000/2, mem_mask); - } - else - { - return segacd_1meg_mode_word_read(offset+0x00000/2, mem_mask); - } - - } - else - { - // converts data stored in bitmap format (in dataram) to be read out as tiles (for dma->vram purposes) - // used by Heart of the Alien - - if(offset<0x30000/2) /* 0x20000 - 0x2ffff */ // 512x256 bitmap. tiles - offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,8,7,6,5,4,3,2,1,14,13,12,11,10,9,0); - else if(offset<0x38000/2) /* 0x30000 - 0x37fff */ // 512x128 bitmap. tiles - offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,7,6,5,4,3,2,1,13,12,11,10,9,8,0); - else if(offset<0x3c000/2) /* 0x38000 - 0x3bfff */ // 512x64 bitmap. tiles - offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,13,6,5,4,3,2,1,12,11,10,9,8,7,0); - else /* 0x3c000 - 0x3dfff and 0x3e000 - 0x3ffff */ // 512x32 bitmap (x2) -> tiles - offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,13,12,5,4,3,2,1,11,10,9,8,7,6,0); - - offset &=0xffff; - // HOTA cares about this - if (!(scd_rammode&1)) - { - return segacd_1meg_mode_word_read(offset+0x00000/2, mem_mask); - } - else - { - return segacd_1meg_mode_word_read(offset+0x20000/2, mem_mask); - } - } - } - - return 0x0000; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_main_dataram_part1_w ) -{ - if ((scd_rammode&2)==RAM_MODE_2MEG) - { - // is this correct? - if (!(scd_rammode&1)) - { - COMBINE_DATA(&m_dataram[offset]); - segacd_mark_tiles_dirty(offset); - } - else - { - //printf("Illegal: segacd_main_dataram_part1_w in mode 0 without permission\n"); - } - - } - else if ((scd_rammode&2)==RAM_MODE_1MEG) - { - if (offset<0x20000/2) - { - //printf("Unspported: segacd_main_dataram_part1_w (word RAM) in mode 1\n"); - // wordram accees - - // ret bit set by sub cpu determines which half of WorkRAM we have access to? - if (scd_rammode&1) - { - segacd_1meg_mode_word_write(offset+0x20000/2, data, mem_mask, 0); - } - else - { - segacd_1meg_mode_word_write(offset+0x00000/2, data, mem_mask, 0); - } - } - else - { - // printf("Unspported: segacd_main_dataram_part1_w (Cell rearranged RAM) in mode 1 (illega?)\n"); // is this legal?? - } - } -} - -READ16_MEMBER( sega_segacd_device::scd_hint_vector_r ) -{ -// printf("read HINT offset %d\n", offset); - - switch (offset&1) - { - case 0x00: - //return 0x00ff; // doesn't make much sense.. - return 0xffff; - case 0x01: - return segacd_hint_register; - } - - return 0; - -} - -READ16_MEMBER( sega_segacd_device::scd_a12006_hint_register_r ) -{ - return segacd_hint_register; -} - -WRITE16_MEMBER( sega_segacd_device::scd_a12006_hint_register_w ) -{ - COMBINE_DATA(&segacd_hint_register); -} - - -void sega_segacd_device::segacd_mark_tiles_dirty(int offset) -{ - m_gfx[0]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); - m_gfx[1]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); - m_gfx[2]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); - m_gfx[3]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); - m_gfx[4]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); - m_gfx[5]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); - m_gfx[6]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); - m_gfx[7]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16)); - - m_gfx[8]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); - m_gfx[9]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); - m_gfx[10]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); - m_gfx[11]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); - m_gfx[12]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); - m_gfx[13]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); - m_gfx[14]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); - m_gfx[15]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32)); -} - - -// mame specific.. map registers to which tilemap cache we use -int sega_segacd_device::segacd_get_active_stampmap_tilemap(void) -{ - return (segacd_stampsize & 0x6)>>1; -} - - - -void sega_segacd_device::SCD_GET_TILE_INFO_16x16_1x1( int& tile_region, int& tileno, int tile_index ) -{ - tile_region = 0; // 16x16 tiles - int tile_base = (segacd_stampmap_base_address & 0xff80) * 4; - - int tiledat = m_dataram[((tile_base>>1)+tile_index) & 0x1ffff]; - tileno = tiledat & 0x07ff; - int xflip = tiledat & 0x8000; - int roll = (tiledat & 0x6000)>>13; - - if (xflip) tile_region += 4; - tile_region+=roll; -} - -void sega_segacd_device::SCD_GET_TILE_INFO_32x32_1x1( int& tile_region, int& tileno, int tile_index ) -{ - tile_region = 8; // 32x32 tiles - int tile_base = (segacd_stampmap_base_address & 0xffe0) * 4; - - int tiledat = m_dataram[((tile_base>>1)+tile_index) & 0x1ffff]; - tileno = (tiledat & 0x07fc)>>2; - int xflip = tiledat & 0x8000; - int roll = (tiledat & 0x6000)>>13; - - if (xflip) tile_region += 4; - tile_region+=roll; -} - - -void sega_segacd_device::SCD_GET_TILE_INFO_16x16_16x16( int& tile_region, int& tileno, int tile_index ) -{ - tile_region = 0; // 16x16 tiles - int tile_base = (0x8000) * 4; // fixed address in this mode - - int tiledat = m_dataram[((tile_base>>1)+tile_index) & 0x1ffff]; - tileno = tiledat & 0x07ff; - int xflip = tiledat & 0x8000; - int roll = (tiledat & 0x6000)>>13; - - if (xflip) tile_region += 4; - tile_region+=roll; -} - - -void sega_segacd_device::SCD_GET_TILE_INFO_32x32_16x16( int& tile_region, int& tileno, int tile_index ) -{ - tile_region = 8; // 32x32 tiles - int tile_base = (segacd_stampmap_base_address & 0xe000) * 4; - - int tiledat = m_dataram[((tile_base>>1)+tile_index) & 0x1ffff]; - tileno = (tiledat & 0x07fc)>>2; - int xflip = tiledat & 0x8000; - int roll = (tiledat & 0x6000)>>13; - - if (xflip) tile_region += 4; - tile_region+=roll; -} - -/* Tilemap callbacks (we don't actually use the tilemaps due to the excessive overhead */ - - - -TILE_GET_INFO_MEMBER( sega_segacd_device::get_stampmap_16x16_1x1_tile_info ) -{ - int tile_region, tileno; - SCD_GET_TILE_INFO_16x16_1x1(tile_region,tileno,(int)tile_index); - SET_TILE_INFO_MEMBER(tile_region, tileno, 0, 0); -} - -TILE_GET_INFO_MEMBER( sega_segacd_device::get_stampmap_32x32_1x1_tile_info ) -{ - int tile_region, tileno; - SCD_GET_TILE_INFO_32x32_1x1(tile_region,tileno,(int)tile_index); - SET_TILE_INFO_MEMBER(tile_region, tileno, 0, 0); -} - - -TILE_GET_INFO_MEMBER( sega_segacd_device::get_stampmap_16x16_16x16_tile_info ) -{ - int tile_region, tileno; - SCD_GET_TILE_INFO_16x16_16x16(tile_region,tileno,(int)tile_index); - SET_TILE_INFO_MEMBER(tile_region, tileno, 0, 0); -} - -TILE_GET_INFO_MEMBER( sega_segacd_device::get_stampmap_32x32_16x16_tile_info ) -{ - int tile_region, tileno; - SCD_GET_TILE_INFO_32x32_16x16(tile_region,tileno,(int)tile_index); - SET_TILE_INFO_MEMBER(tile_region, tileno, 0, 0); -} - -// non-tilemap functions to get a pixel from a 'tilemap' based on the above, but looking up each pixel, as to avoid the heavy cache bitmap - -inline UINT8 sega_segacd_device::get_stampmap_16x16_1x1_tile_info_pixel(int xpos, int ypos) -{ - const int tilesize = 4; // 0xf pixels - const int tilemapsize = 0x0f; - - int wraparound = segacd_stampsize&1; - - int xtile = xpos / (1<tilemapsize) return 0; - if (xtile<0) return 0; - - if (ytile>tilemapsize) return 0; - if (ytile<0) return 0; - } - - int tile_index = (ytile * (tilemapsize+1)) + xtile; - - int tile_region, tileno; - SCD_GET_TILE_INFO_16x16_1x1(tile_region,tileno,(int)tile_index); - - tileno %= m_gfx[tile_region]->elements(); - - if (tileno==0) return 0x00; - - const UINT8* srcdata = m_gfx[tile_region]->get_data(tileno); - return srcdata[((ypos&((1<tilemapsize) return 0; - if (xtile<0) return 0; - - if (ytile>tilemapsize) return 0; - if (ytile<0) return 0; - } - - int tile_index = (ytile * (tilemapsize+1)) + xtile; - - int tile_region, tileno; - SCD_GET_TILE_INFO_32x32_1x1(tile_region,tileno,(int)tile_index); - - tileno %= m_gfx[tile_region]->elements(); - - if (tileno==0) return 0x00; // does this apply in this mode? - - const UINT8* srcdata = m_gfx[tile_region]->get_data(tileno); - return srcdata[((ypos&((1<tilemapsize) return 0; - if (xtile<0) return 0; - - if (ytile>tilemapsize) return 0; - if (ytile<0) return 0; - } - - int tile_index = (ytile * (tilemapsize+1)) + xtile; - - int tile_region, tileno; - SCD_GET_TILE_INFO_16x16_16x16(tile_region,tileno,(int)tile_index); - - tileno %= m_gfx[tile_region]->elements(); - - if (tileno==0) return 0x00; // does this apply in this mode - - const UINT8* srcdata = m_gfx[tile_region]->get_data(tileno); - return srcdata[((ypos&((1<tilemapsize) return 0; - if (xtile<0) return 0; - - if (ytile>tilemapsize) return 0; - if (ytile<0) return 0; - } - - int tile_index = (ytile * (tilemapsize+1)) + xtile; - - int tile_region, tileno; - SCD_GET_TILE_INFO_32x32_16x16(tile_region,tileno,(int)tile_index); - - tileno %= m_gfx[tile_region]->elements(); - - if (tileno==0) return 0x00; - - const UINT8* srcdata = m_gfx[tile_region]->get_data(tileno); - return srcdata[((ypos&((1<reset(); - else - printf("Stopwatch timer %04x\n",data); -} - -READ16_MEMBER( sega_segacd_device::segacd_stopwatch_timer_r ) -{ - INT32 result = (m_stopwatch_timer->time_elapsed() * ATTOSECONDS_TO_HZ(ATTOSECONDS_IN_USEC(30.72))).as_double(); - - return result & 0xfff; -} - - - - - - - -READ16_MEMBER( sega_segacd_device::segacd_sub_led_ready_r ) -{ - UINT16 retdata = 0x0000; - - if (ACCESSING_BITS_0_7) - { - retdata |= segacd_ready; - } - - if (ACCESSING_BITS_8_15) - { - retdata |= segacd_redled << 8; - retdata |= segacd_greenled << 9; - } - - return retdata; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_sub_led_ready_w ) -{ - if (ACCESSING_BITS_0_7) - { - if ((data&0x01) == 0x00) - { - // reset CD unit - } - } - - if (ACCESSING_BITS_8_15) - { - segacd_redled = (data >> 8)&1; - segacd_greenled = (data >> 9)&1; - - output_set_value("red_led",segacd_redled ^ 1); - output_set_value("green_led",segacd_greenled ^ 1); - - //popmessage("%02x %02x",segacd_greenled,segacd_redled); - } -} - - - -READ16_MEMBER( sega_segacd_device::segacd_sub_dataram_part1_r ) -{ - if ((scd_rammode&2)==RAM_MODE_2MEG) - { - // is this correct? - if (scd_rammode&1) - return m_dataram[offset]; - else - { - //printf("Illegal: segacd_sub_dataram_part1_r in mode 0 without permission\n"); - return 0x0000; - } - } - else if ((scd_rammode&2)==RAM_MODE_1MEG) - { -// printf("Unspported: segacd_sub_dataram_part1_r in mode 1 (Word RAM Expander - 1 Byte Per Pixel)\n"); - UINT16 data; - - if (scd_rammode&1) - { - data = segacd_1meg_mode_word_read(offset/2+0x00000/2, 0xffff); - } - else - { - data = segacd_1meg_mode_word_read(offset/2+0x20000/2, 0xffff); - } - - if (offset&1) - { - return ((data & 0x00f0) << 4) | ((data & 0x000f) << 0); - } - else - { - return ((data & 0xf000) >> 4) | ((data & 0x0f00) >> 8); - } - - - } - - return 0x0000; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_sub_dataram_part1_w ) -{ - if ((scd_rammode&2)==RAM_MODE_2MEG) - { - // is this correct? - if (scd_rammode&1) - { - COMBINE_DATA(&m_dataram[offset]); - segacd_mark_tiles_dirty(offset); - } - else - { - //printf("Illegal: segacd_sub_dataram_part1_w in mode 0 without permission\n"); - } - } - else if ((scd_rammode&2)==RAM_MODE_1MEG) - { - //if (mem_mask==0xffff) - // printf("Unspported: segacd_sub_dataram_part1_w in mode 1 (Word RAM Expander - 1 Byte Per Pixel) %04x %04x\n", data, mem_mask); - - data = (data & 0x000f) | (data & 0x0f00)>>4; - mem_mask = (mem_mask & 0x000f) | (mem_mask & 0x0f00)>>4; - -// data = ((data & 0x00f0) >>4) | (data & 0xf000)>>8; -// mem_mask = ((mem_mask & 0x00f0)>>4) | ((mem_mask & 0xf000)>>8); - - - if (!(offset&1)) - { - data <<=8; - mem_mask <<=8; - } - - if (scd_rammode&1) - { - segacd_1meg_mode_word_write(offset/2+0x00000/2, data , mem_mask, 1); - } - else - { - segacd_1meg_mode_word_write(offset/2+0x20000/2, data, mem_mask, 1); - } - - // printf("Unspported: segacd_sub_dataram_part1_w in mode 1 (Word RAM Expander - 1 Byte Per Pixel) %04x\n", data); - } -} - -READ16_MEMBER( sega_segacd_device::segacd_sub_dataram_part2_r ) -{ - if ((scd_rammode&2)==RAM_MODE_2MEG) - { - //printf("ILLEGAL segacd_sub_dataram_part2_r in mode 0\n"); // not mapped to anything in mode 0 - return 0x0000; - } - else if ((scd_rammode&2)==RAM_MODE_1MEG) - { - //printf("Unsupported: segacd_sub_dataram_part2_r in mode 1 (Word RAM)\n"); - // ret bit set by sub cpu determines which half of WorkRAM we have access to? - if (scd_rammode&1) - { - return segacd_1meg_mode_word_read(offset+0x00000/2, mem_mask); - } - else - { - return segacd_1meg_mode_word_read(offset+0x20000/2, mem_mask); - } - - } - - return 0x0000; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_sub_dataram_part2_w ) -{ - if ((scd_rammode&2)==RAM_MODE_2MEG) - { - printf("ILLEGAL segacd_sub_dataram_part2_w in mode 0\n"); // not mapped to anything in mode 0 - } - else if ((scd_rammode&2)==RAM_MODE_1MEG) - { - //printf("Unsupported: segacd_sub_dataram_part2_w in mode 1 (Word RAM)\n"); - // ret bit set by sub cpu determines which half of WorkRAM we have access to? - if (scd_rammode&1) - { - segacd_1meg_mode_word_write(offset+0x00000/2, data, mem_mask, 0); - } - else - { - segacd_1meg_mode_word_write(offset+0x20000/2, data, mem_mask, 0); - } - - } -} - - - -READ16_MEMBER( sega_segacd_device::segacd_stampsize_r ) -{ - UINT16 retdata = 0x0000; - - retdata |= segacd_conversion_active<<15; - - retdata |= segacd_stampsize & 0x7; - - return retdata; - -} - -WRITE16_MEMBER( sega_segacd_device::segacd_stampsize_w ) -{ - //printf("segacd_stampsize_w %04x %04x\n",data, mem_mask); - if (ACCESSING_BITS_0_7) - { - segacd_stampsize = data & 0x07; - //if (data & 0xf8) - // printf(" unused bits (LSB) set in stampsize!\n"); - - //if (data&1) printf(" Repeat On\n"); - //else printf(" Repeat Off\n"); - - //if (data&2) printf(" 32x32 dots\n"); - //else printf(" 16x16 dots\n"); - - //if (data&4) printf(" 16x16 screens\n"); - //else printf(" 1x1 screen\n"); - } - - if (ACCESSING_BITS_8_15) - { - //if (data&0xff00) printf(" unused bits (MSB) set in stampsize!\n"); - } -} - -// these functions won't cope if -// -// the lower 3 bits of segacd_imagebuffer_hdot_size are set - -// this really needs to be doing it's own lookups rather than depending on the inefficient MAME cache.. -inline UINT8 sega_segacd_device::read_pixel_from_stampmap(bitmap_ind16* srcbitmap, int x, int y) -{ -/* - if (!srcbitmap) - { - return machine.rand(); - } - - if (x >= srcbitmap->width) return 0; - if (y >= srcbitmap->height) return 0; - - UINT16* cacheptr = &srcbitmap->pix16(y, x); - - return cacheptr[0] & 0xf; -*/ - - switch (segacd_get_active_stampmap_tilemap()&3) - { - case 0x00: return get_stampmap_16x16_1x1_tile_info_pixel( x, y ); - case 0x01: return get_stampmap_32x32_1x1_tile_info_pixel( x, y ); - case 0x02: return get_stampmap_16x16_16x16_tile_info_pixel( x, y ); - case 0x03: return get_stampmap_32x32_16x16_tile_info_pixel( x, y ); - } - - return 0; -} - - - - - -// this triggers the conversion operation, which will cause an IRQ1 when finished -WRITE16_MEMBER( sega_segacd_device::segacd_trace_vector_base_address_w ) -{ - if ((scd_rammode&2)==RAM_MODE_1MEG) - { - printf("ILLEGAL: segacd_trace_vector_base_address_w %04x %04x in mode 1!\n",data,mem_mask); - } - - //printf("segacd_trace_vector_base_address_w %04x %04x\n",data,mem_mask); - - { - int base = (data & 0xfffe) * 4; - - //printf("actual base = %06x\n", base + 0x80000); - - // nasty nasty nasty - //segacd_mark_stampmaps_dirty(); - - segacd_conversion_active = 1; - - // todo: proper time calculation - m_stamp_timer->adjust(attotime::from_nsec(30000)); - - - - int line; - //bitmap_ind16 *srcbitmap = segacd_stampmap[segacd_get_active_stampmap_tilemap(->pixmap()]); - bitmap_ind16 *srcbitmap = 0; - UINT32 bufferstart = ((segacd_imagebuffer_start_address&0xfff8)*2)<<3; - - for (line=0;line>1]; - tilemapyoffs = m_dataram[(currbase+0x2)>>1]; - deltax = m_dataram[(currbase+0x4)>>1]; // x-zoom - deltay = m_dataram[(currbase+0x6)>>1]; // rotation - - //printf("%06x: %04x (%d) %04x (%d) %04x %04x\n", currbase, tilemapxoffs, tilemapxoffs>>3, tilemapyoffs, tilemapyoffs>>3, deltax, deltay); - - int xbase = tilemapxoffs * 256; - int ybase = tilemapyoffs * 256; - int count; - - for (count=0;count<(segacd_imagebuffer_hdot_size);count++) - { - //int i; - UINT8 pix = 0x0; - - pix = read_pixel_from_stampmap(srcbitmap, xbase>>(3+8), ybase>>(3+8)); - - xbase += deltax; - ybase += deltay; - - // clamp to 24-bits, seems to be required for all the intro effects to work - xbase &= 0xffffff; - ybase &= 0xffffff; - - int countx = count + (segacd_imagebuffer_offset&0x7); - - UINT32 offset; - - offset = bufferstart+((((segacd_imagebuffer_vcell_size+1)*0x10)*(countx>>3))<<3); - - offset+= ((line*2)<<3); - offset+=(segacd_imagebuffer_offset&0x38)<<1; - - offset+=countx & 0x7; - - write_pixel( pix, offset ); - - segacd_mark_tiles_dirty(offset>>3); - segacd_mark_tiles_dirty((offset>>3)+1); - - } - - } - } - -} - -// actually just the low 8 bits? -READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_vdot_size_r ) -{ - return segacd_imagebuffer_vdot_size; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_vdot_size_w ) -{ - //printf("segacd_imagebuffer_vdot_size_w %04x %04x\n",data,mem_mask); - COMBINE_DATA(&segacd_imagebuffer_vdot_size); -} - - -// basically the 'tilemap' base address, for the 16x16 / 32x32 source tiles -READ16_MEMBER( sega_segacd_device::segacd_stampmap_base_address_r ) -{ - // different bits are valid in different modes, but I'm guessing the register - // always returns all the bits set, even if they're not used? - return segacd_stampmap_base_address; - -} - -WRITE16_MEMBER( sega_segacd_device::segacd_stampmap_base_address_w ) -{ // WORD ACCESS - - // low 3 bitsa aren't used, are they stored? - COMBINE_DATA(&segacd_stampmap_base_address); -} - -// destination for 'rendering' the section of the tilemap(stampmap) requested -READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_start_address_r ) -{ - return segacd_imagebuffer_start_address; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_start_address_w ) -{ - COMBINE_DATA(&segacd_imagebuffer_start_address); - - //int base = (segacd_imagebuffer_start_address & 0xfffe) * 4; - //printf("segacd_imagebuffer_start_address_w %04x %04x (actual base = %06x)\n", data, segacd_imagebuffer_start_address, base); -} - -READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_offset_r ) -{ - return segacd_imagebuffer_offset; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_offset_w ) -{ - COMBINE_DATA(&segacd_imagebuffer_offset); -// printf("segacd_imagebuffer_offset_w %04x\n", segacd_imagebuffer_offset); -} - -READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_vcell_size_r ) -{ - return segacd_imagebuffer_vcell_size; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_vcell_size_w ) -{ - COMBINE_DATA(&segacd_imagebuffer_vcell_size); -} - - -READ16_MEMBER( sega_segacd_device::segacd_imagebuffer_hdot_size_r ) -{ - return segacd_imagebuffer_hdot_size; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_imagebuffer_hdot_size_w ) -{ - COMBINE_DATA(&segacd_imagebuffer_hdot_size); -} - - - -READ16_MEMBER( sega_segacd_device::segacd_irq3timer_r ) -{ - return m_irq3_timer_reg; // always returns value written, not current counter! -} - - -WRITE16_MEMBER( sega_segacd_device::segacd_irq3timer_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_irq3_timer_reg = data & 0xff; - - // time = reg * 30.72 us - - if (m_irq3_timer_reg) - m_irq3_timer->adjust(SEGACD_IRQ3_TIMER_SPEED); - else - m_irq3_timer->adjust(attotime::never); - - //printf("segacd_irq3timer_w %02x\n", segacd_m_irq3_timer_reg); - } -} - - -READ8_MEMBER( sega_segacd_device::backupram_r ) -{ - return m_backupram[offset]; -} - -WRITE8_MEMBER( sega_segacd_device::backupram_w ) -{ - m_backupram[offset] = data; -} - -READ8_MEMBER( sega_segacd_device::font_color_r ) -{ - return m_font_color; -} - -WRITE8_MEMBER( sega_segacd_device::font_color_w ) -{ - m_font_color = data; -} - -READ16_MEMBER( sega_segacd_device::font_converted_r ) -{ - int scbg = (m_font_color & 0x0f); - int scfg = (m_font_color & 0xf0)>>4; - UINT16 retdata = 0; - int bit; - - for (bit=0;bit<4;bit++) - { - if (*m_font_bits&((0x1000>>offset*4)<memory().space(AS_PROGRAM); - - m_backupram.resize(0x2000); - subdevice("backupram")->set_base(&m_backupram[0], 0x2000); - - segacd_4meg_prgbank = 0; - - space.unmap_readwrite (0x020000,0x3fffff); - - space.install_read_handler (0x0020000, 0x003ffff, read16_delegate(FUNC(sega_segacd_device::scd_4m_prgbank_ram_r),this) ); - space.install_write_handler (0x0020000, 0x003ffff, write16_delegate(FUNC(sega_segacd_device::scd_4m_prgbank_ram_w),this) ); - - - space.install_readwrite_handler(0x200000, 0x23ffff, read16_delegate(FUNC(sega_segacd_device::segacd_main_dataram_part1_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_main_dataram_part1_w),this)); // RAM shared with sub - space.install_readwrite_handler(0xa12000, 0xa12001, read16_delegate(FUNC(sega_segacd_device::scd_a12000_halt_reset_r),this), write16_delegate(FUNC(sega_segacd_device::scd_a12000_halt_reset_w),this)); // sub-cpu control - space.install_readwrite_handler(0xa12002, 0xa12003, read16_delegate(FUNC(sega_segacd_device::scd_a12002_memory_mode_r),this), write16_delegate(FUNC(sega_segacd_device::scd_a12002_memory_mode_w),this)); // memory mode / write protect - //space.install_readwrite_handler(0xa12004, 0xa12005, read16_delegate(FUNC(sega_segacd_device::segacd_cdc_mode_address_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_cdc_mode_address_w),this)); - space.install_readwrite_handler(0xa12006, 0xa12007, read16_delegate(FUNC(sega_segacd_device::scd_a12006_hint_register_r),this), write16_delegate(FUNC(sega_segacd_device::scd_a12006_hint_register_w),this)); // where HINT points on main CPU - //space.install_read_handler (0xa12008, 0xa12009, read16_delegate(FUNC(sega_segacd_device::cdc_data_main_r),this)); - - - space.install_readwrite_handler(0xa1200c, 0xa1200d, read16_delegate(FUNC(sega_segacd_device::segacd_stopwatch_timer_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_stopwatch_timer_w),this)); // starblad - - space.install_readwrite_handler(0xa1200e, 0xa1200f, read16_delegate(FUNC(sega_segacd_device::segacd_comms_flags_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_comms_flags_maincpu_w),this)); // communication flags block - - space.install_readwrite_handler(0xa12010, 0xa1201f, read16_delegate(FUNC(sega_segacd_device::segacd_comms_main_part1_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_comms_main_part1_w),this)); - space.install_readwrite_handler(0xa12020, 0xa1202f, read16_delegate(FUNC(sega_segacd_device::segacd_comms_main_part2_r),this), write16_delegate(FUNC(sega_segacd_device::segacd_comms_main_part2_w),this)); - - - - space.install_read_handler (0x0000070, 0x0000073, read16_delegate(FUNC(sega_segacd_device::scd_hint_vector_r),this) ); - - segacd_stampmap[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(sega_segacd_device::get_stampmap_16x16_1x1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 16, 16); - segacd_stampmap[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(sega_segacd_device::get_stampmap_32x32_1x1_tile_info),this), TILEMAP_SCAN_ROWS, 32, 32, 8, 8); - segacd_stampmap[2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(sega_segacd_device::get_stampmap_16x16_16x16_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 256, 256); // 128kb! - segacd_stampmap[3] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(sega_segacd_device::get_stampmap_32x32_16x16_tile_info),this), TILEMAP_SCAN_ROWS, 32, 32, 128, 128); // 32kb! - - // todo register save state stuff -} - -READ16_MEMBER( sega_segacd_device::segacd_dmaaddr_r ) -{ - return m_dmaaddr; -} - -WRITE16_MEMBER( sega_segacd_device::segacd_dmaaddr_w ) -{ - COMBINE_DATA(&m_dmaaddr); -} - -void sega_segacd_device::device_reset() -{ - m_scdcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - m_scdcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - - segacd_hint_register = 0xffff; // -1 - - m_a12000_halt_reset_reg = 0x0000; - - scd_rammode = 0; - scd_mode_dmna_ret_flags = 0x5421; - - m_lc89510_temp->reset_cd(); - m_dmaaddr = 0; - m_dma_timer->adjust(attotime::zero); - - m_total_scanlines = 262; - - // HACK!!!! timegal, anettfut, roadaven end up with the SubCPU waiting in a loop for *something* - // overclocking the CPU, even at the point where the game is hung, allows them to continue and boot - // I'm not sure what the source of this timing problem is, it's not using IRQ3 or StopWatch at the - // time. Changing the CDHock timer to 50hz from 75hz also stops the hang, but then the video is - // too slow and has bad sound. -- Investigate! - - m_scdcpu->set_clock_scale(1.5000f); - - - // initialize some stuff on reset - - segacd_ram_writeprotect_bits = 0; - segacd_4meg_prgbank = 0; - segacd_memory_priority_mode = 0; - segacd_stampsize = 0; - - segacd_imagebuffer_vdot_size = 0; - segacd_imagebuffer_vcell_size = 0; - segacd_imagebuffer_hdot_size = 0; - - segacd_conversion_active = 0; - segacd_stampmap_base_address = 0; - segacd_imagebuffer_start_address = 0; - segacd_imagebuffer_offset = 0; - - segacd_comms_flags = 0x0000; - - segacd_redled = 0; - segacd_greenled = 0; - segacd_ready = 1; // actually set 100ms after startup? - m_irq3_timer_reg = 0; - - m_stamp_timer->adjust(attotime::never); - m_irq3_timer->adjust(attotime::never); - -} - - -// todo: tidy up -TIMER_DEVICE_CALLBACK_MEMBER( sega_segacd_device::dma_timer_callback ) -{ - // todo: accurate timing of this! - - #define RATE 256 - m_lc89510_temp->CDC_Do_DMA(machine(), RATE); - - // timed reset of flags - scd_mode_dmna_ret_flags |= 0x0021; - - m_dma_timer->adjust(attotime::from_hz(m_framerate) / m_total_scanlines); - -} - -// todo: tidy up, too many CDC internals here -void sega_segacd_device::SegaCD_CDC_Do_DMA(int &dmacount, UINT8 *CDC_BUFFER, UINT16 &dma_addrc, UINT16 &destination ) -{ - int length = dmacount; - UINT16 *dest; - int srcoffset = 0; - int dstoffset = 0; - address_space& space = m_scdcpu->space(AS_PROGRAM); - - bool PCM_DMA = false; - - if (destination==DMA_PCM) - { - dstoffset = (m_dmaaddr & 0x03FF) << 2; - PCM_DMA = true; - } - else - { - dstoffset = (m_dmaaddr & 0xFFFF) << 3; - } - - - while (dmacount--) - { - UINT16 data = (CDC_BUFFER[dma_addrc+srcoffset]<<8) | CDC_BUFFER[dma_addrc+srcoffset+1]; - - if (destination==DMA_PRG) - { - dest = m_prgram; - } - else if (destination==DMA_WRAM) - { - dest = m_dataram; - } - else if (destination==DMA_PCM) - { - dest = 0;//fatalerror("PCM RAM DMA unimplemented!\n"); - } - else - { - fatalerror("Unknown DMA Destination!!\n"); - } - - if (PCM_DMA) - { - m_rfsnd->rf5c68_mem_w(space, dstoffset & 0xfff, data >> 8); - m_rfsnd->rf5c68_mem_w(space, (dstoffset+1) & 0xfff, data); - // printf("PCM_DMA writing %04x %04x\n",0xff2000+(dstoffset*2), data); - } - else - { - if (dest) - { - if (destination==DMA_WRAM) - { - if ((scd_rammode&2)==RAM_MODE_2MEG) - { - dstoffset &= 0x3ffff; - - dest[dstoffset/2] = data; - - segacd_mark_tiles_dirty(dstoffset/2); - } - else - { - dstoffset &= 0x1ffff; - - if (!(scd_rammode & 1)) - { - segacd_1meg_mode_word_write((dstoffset+0x20000)/2, data, 0xffff, 0); - } - else - { - segacd_1meg_mode_word_write((dstoffset+0x00000)/2, data, 0xffff, 0); - } - } - - } - else - { - // main ram - dest[dstoffset/2] = data; - } - - } - } - - srcoffset += 2; - dstoffset += 2; - } - - - if (PCM_DMA) - { - m_dmaaddr += length >> 1; - } - else - { - m_dmaaddr += length >> 2; - } -} diff --git a/src/mess/machine/megacd.h b/src/mess/machine/megacd.h deleted file mode 100644 index 84ed0b399c5..00000000000 --- a/src/mess/machine/megacd.h +++ /dev/null @@ -1,254 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -/* Sega CD / Mega CD */ - -#include "cpu/m68000/m68000.h" -#include "machine/lc89510.h" -#include "machine/megacdcd.h" -#include "sound/rf5c68.h" - -#define SEGACD_CLOCK 12500000 - -#define RAM_MODE_2MEG (0) -#define RAM_MODE_1MEG (2) - -#define DMA_PCM (0x0400) -#define DMA_PRG (0x0500) -#define DMA_WRAM (0x0700) - -// irq3 timer -#define CHECK_SCD_LV3_INTERRUPT \ - if (m_lc89510_temp->get_segacd_irq_mask() & 0x08) \ - { \ - m_scdcpu->set_input_line(3, HOLD_LINE); \ - } -// from master -#define CHECK_SCD_LV2_INTERRUPT \ - if (m_lc89510_temp->get_segacd_irq_mask() & 0x04) \ - { \ - m_scdcpu->set_input_line(2, HOLD_LINE); \ - } - -// gfx convert -#define CHECK_SCD_LV1_INTERRUPT \ - if (m_lc89510_temp->get_segacd_irq_mask() & 0x02) \ - { \ - m_scdcpu->set_input_line(1, HOLD_LINE); \ - } - -#define SEGACD_IRQ3_TIMER_SPEED (attotime::from_nsec(m_irq3_timer_reg*30720)) - - -class sega_segacd_device : public device_t, public device_gfx_interface -{ -public: - sega_segacd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - required_device m_scdcpu; - required_device m_rfsnd; - required_device m_lc89510_temp; - required_device m_stopwatch_timer; - required_device m_stamp_timer; - required_device m_irq3_timer; - required_device m_dma_timer; - //required_device m_hock_timer; - - required_shared_ptr m_prgram; - required_shared_ptr m_dataram; - required_shared_ptr m_font_bits; - - // can't use a memshare because it's 8-bit RAM in a 16-bit address space - std::vector m_backupram; - - UINT8 m_font_color; - - UINT16 scd_rammode; - UINT32 scd_mode_dmna_ret_flags ; - - tilemap_t *segacd_stampmap[4]; - - - UINT8 segacd_ram_writeprotect_bits; - int segacd_4meg_prgbank;// = 0; // which bank the MainCPU can see of the SubCPU PrgRAM - int segacd_memory_priority_mode;// = 0; - int segacd_stampsize; - - UINT16 segacd_hint_register; - UINT16 segacd_imagebuffer_vdot_size; - UINT16 segacd_imagebuffer_vcell_size; - UINT16 segacd_imagebuffer_hdot_size; - - int segacd_conversion_active;// = 0; - UINT16 segacd_stampmap_base_address; - UINT16 segacd_imagebuffer_start_address; - UINT16 segacd_imagebuffer_offset; - - - UINT16 segacd_comms_flags;// = 0x0000; - UINT16 segacd_comms_part1[0x8]; - UINT16 segacd_comms_part2[0x8]; - - int segacd_redled;// = 0; - int segacd_greenled;// = 0; - int segacd_ready;// = 1; // actually set 100ms after startup? - UINT8 m_irq3_timer_reg; - - - TIMER_DEVICE_CALLBACK_MEMBER( irq3_timer_callback ); - TIMER_DEVICE_CALLBACK_MEMBER( stamp_timer_callback ); - - UINT16 handle_segacd_sub_int_callback(int irqline); - - inline void write_pixel(UINT8 pix, int pixeloffset); - UINT16 segacd_1meg_mode_word_read(int offset, UINT16 mem_mask); - void segacd_1meg_mode_word_write(int offset, UINT16 data, UINT16 mem_mask, int use_pm); - - DECLARE_READ16_MEMBER( segacd_dmaaddr_r ); - DECLARE_WRITE16_MEMBER( segacd_dmaaddr_w ); - UINT16 m_dmaaddr; - - UINT16 m_a12000_halt_reset_reg; - - int m_framerate; - int m_base_total_scanlines; - int m_total_scanlines; - - void segacd_mark_tiles_dirty(int offset); - int segacd_get_active_stampmap_tilemap(void); - - // set some variables at start, depending on region (shall be moved to a device interface?) - void set_framerate(int rate) { m_framerate = rate; } - void set_total_scanlines(int total) { m_base_total_scanlines = total; } // this gets set at start only - void update_total_scanlines(bool mode3) { m_total_scanlines = mode3 ? (m_base_total_scanlines * 2) : m_base_total_scanlines; } // this gets set at each EOF - - void SCD_GET_TILE_INFO_16x16_1x1( int& tile_region, int& tileno, int tile_index ); - void SCD_GET_TILE_INFO_32x32_1x1( int& tile_region, int& tileno, int tile_index ); - void SCD_GET_TILE_INFO_16x16_16x16( int& tile_region, int& tileno, int tile_index ); - void SCD_GET_TILE_INFO_32x32_16x16( int& tile_region, int& tileno, int tile_index ); - - TILE_GET_INFO_MEMBER( get_stampmap_16x16_1x1_tile_info ); - TILE_GET_INFO_MEMBER( get_stampmap_32x32_1x1_tile_info ); - TILE_GET_INFO_MEMBER( get_stampmap_16x16_16x16_tile_info ); - TILE_GET_INFO_MEMBER( get_stampmap_32x32_16x16_tile_info ); - - UINT8 get_stampmap_16x16_1x1_tile_info_pixel(int xpos, int ypos); - UINT8 get_stampmap_32x32_1x1_tile_info_pixel(int xpos, int ypos); - UINT8 get_stampmap_16x16_16x16_tile_info_pixel(int xpos, int ypos); - UINT8 get_stampmap_32x32_16x16_tile_info_pixel(int xpos, int ypos); - - WRITE16_MEMBER( scd_a12000_halt_reset_w ); - READ16_MEMBER( scd_a12000_halt_reset_r ); - READ16_MEMBER( scd_a12002_memory_mode_r ); - WRITE8_MEMBER( scd_a12002_memory_mode_w_8_15 ); - WRITE8_MEMBER( scd_a12002_memory_mode_w_0_7 ); - WRITE16_MEMBER( scd_a12002_memory_mode_w ); - READ16_MEMBER( segacd_sub_memory_mode_r ); - WRITE8_MEMBER( segacd_sub_memory_mode_w_8_15 ); - WRITE8_MEMBER( segacd_sub_memory_mode_w_0_7 ); - WRITE16_MEMBER( segacd_sub_memory_mode_w ); - - READ16_MEMBER( segacd_comms_flags_r ); - WRITE16_MEMBER( segacd_comms_flags_subcpu_w ); - WRITE16_MEMBER( segacd_comms_flags_maincpu_w ); - READ16_MEMBER( scd_4m_prgbank_ram_r ); - WRITE16_MEMBER( scd_4m_prgbank_ram_w ); - READ16_MEMBER( segacd_comms_main_part1_r ); - WRITE16_MEMBER( segacd_comms_main_part1_w ); - READ16_MEMBER( segacd_comms_main_part2_r ); - WRITE16_MEMBER( segacd_comms_main_part2_w ); - READ16_MEMBER( segacd_comms_sub_part1_r ); - WRITE16_MEMBER( segacd_comms_sub_part1_w ); - READ16_MEMBER( segacd_comms_sub_part2_r ); - WRITE16_MEMBER( segacd_comms_sub_part2_w ); - - - - READ16_MEMBER( segacd_main_dataram_part1_r ); - WRITE16_MEMBER( segacd_main_dataram_part1_w ); - - READ16_MEMBER( scd_hint_vector_r ); - READ16_MEMBER( scd_a12006_hint_register_r ); - WRITE16_MEMBER( scd_a12006_hint_register_w ); - - - WRITE16_MEMBER( segacd_stopwatch_timer_w ); - READ16_MEMBER( segacd_stopwatch_timer_r ); - READ16_MEMBER( segacd_sub_led_ready_r ); - WRITE16_MEMBER( segacd_sub_led_ready_w ); - READ16_MEMBER( segacd_sub_dataram_part1_r ); - WRITE16_MEMBER( segacd_sub_dataram_part1_w ); - READ16_MEMBER( segacd_sub_dataram_part2_r ); - WRITE16_MEMBER( segacd_sub_dataram_part2_w ); - - - READ16_MEMBER( segacd_stampsize_r ); - WRITE16_MEMBER( segacd_stampsize_w ); - - UINT8 read_pixel_from_stampmap(bitmap_ind16* srcbitmap, int x, int y); - - WRITE16_MEMBER( segacd_trace_vector_base_address_w ); - READ16_MEMBER( segacd_imagebuffer_vdot_size_r ); - WRITE16_MEMBER( segacd_imagebuffer_vdot_size_w ); - READ16_MEMBER( segacd_stampmap_base_address_r ); - WRITE16_MEMBER( segacd_stampmap_base_address_w ); - READ16_MEMBER( segacd_imagebuffer_start_address_r ); - WRITE16_MEMBER( segacd_imagebuffer_start_address_w ); - READ16_MEMBER( segacd_imagebuffer_offset_r ); - WRITE16_MEMBER( segacd_imagebuffer_offset_w ); - READ16_MEMBER( segacd_imagebuffer_vcell_size_r ); - WRITE16_MEMBER( segacd_imagebuffer_vcell_size_w ); - READ16_MEMBER( segacd_imagebuffer_hdot_size_r ); - WRITE16_MEMBER( segacd_imagebuffer_hdot_size_w ); - READ16_MEMBER( segacd_irq3timer_r ); - WRITE16_MEMBER( segacd_irq3timer_w ); - READ8_MEMBER( backupram_r ); - WRITE8_MEMBER( backupram_w ); - READ8_MEMBER( font_color_r ); - WRITE8_MEMBER( font_color_w ); - READ16_MEMBER( font_converted_r ); - TIMER_DEVICE_CALLBACK_MEMBER( dma_timer_callback ); - IRQ_CALLBACK_MEMBER(segacd_sub_int_callback); - - void SegaCD_CDC_Do_DMA( int &dmacount, UINT8 *CDC_BUFFER, UINT16 &dma_addrc, UINT16 &destination ); - -protected: - virtual void device_start(); - virtual void device_reset(); - - // optional information overrides -// virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; -private: -// virtual void device_config_complete(); - -}; - - -class sega_segacd_us_device : public sega_segacd_device -{ - public: - sega_segacd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - protected: - -}; - -class sega_segacd_japan_device : public sega_segacd_device -{ - public: - sega_segacd_japan_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - protected: -// virtual machine_config_constructor device_mconfig_additions() const; -}; - -class sega_segacd_europe_device : public sega_segacd_device -{ - public: - sega_segacd_europe_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - protected: -// virtual machine_config_constructor device_mconfig_additions() const; -}; - - -extern const device_type SEGA_SEGACD_US; -extern const device_type SEGA_SEGACD_JAPAN; -extern const device_type SEGA_SEGACD_EUROPE; diff --git a/src/mess/machine/megacdcd.c b/src/mess/machine/megacdcd.c deleted file mode 100644 index 617d3615393..00000000000 --- a/src/mess/machine/megacdcd.c +++ /dev/null @@ -1,1331 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -/* CD controller code from megacd.c, used by Sega CD / Mega CD */ - -/* todo: cleanup(!!), make more generic, unifiy implementation with NeoCD, turn into a device and move to the proper lc89510.c file - currently this is a bit of a mix of system specific bits, incomplete implementations etc. as well as a rather kludgy combination - of the CDC and drive emulation. */ - - -#include "emu.h" -#include "machine/megacdcd.h" - -const device_type LC89510_TEMP = &device_creator; - -lc89510_temp_device::lc89510_temp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, LC89510_TEMP, "lc89510_temp_device", tag, owner, clock, "lc89510_temp", __FILE__) -{ - segacd_dma_callback = segacd_dma_delegate(FUNC(lc89510_temp_device::Fake_CDC_Do_DMA), this); - type1_interrupt_callback = interrupt_delegate(FUNC(lc89510_temp_device::dummy_interrupt_callback), this); - type2_interrupt_callback = interrupt_delegate(FUNC(lc89510_temp_device::dummy_interrupt_callback), this); - type3_interrupt_callback = interrupt_delegate(FUNC(lc89510_temp_device::dummy_interrupt_callback), this); - - is_neoCD = false; - - nff0002 = 0; - for (int i=0;i<10;i++) - CDD_TX[i] = 0; - for (int i=0;i<10;i++) - CDD_RX[i] = 0; - NeoCDCommsWordCount = 0; - NeoCD_StatusHack = 0; - SCD_CURLBA = 0; - - CDC_REG0 = 0; - - segacd_irq_mask = 0; -} - -void lc89510_temp_device::dummy_interrupt_callback(void) -{ -} - -void lc89510_temp_device::set_CDC_Do_DMA(device_t &device,segacd_dma_delegate new_segacd_dma_callback) -{ - lc89510_temp_device &dev = downcast(device); - dev.segacd_dma_callback = new_segacd_dma_callback; -} - -void lc89510_temp_device::set_type1_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback) -{ - lc89510_temp_device &dev = downcast(device); - dev.type1_interrupt_callback = interrupt_callback; -} - -void lc89510_temp_device::set_type2_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback) -{ - lc89510_temp_device &dev = downcast(device); - dev.type2_interrupt_callback = interrupt_callback; -} - -void lc89510_temp_device::set_type3_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback) -{ - lc89510_temp_device &dev = downcast(device); - dev.type3_interrupt_callback = interrupt_callback; -} - -void lc89510_temp_device::set_is_neoCD(device_t &device, bool is_neoCD) -{ - lc89510_temp_device &dev = downcast(device); - dev.is_neoCD = is_neoCD; -} - -// HACK for DMA handling, this gets replaced -void lc89510_temp_device::Fake_CDC_Do_DMA(int &dmacount, UINT8 *CDC_BUFFER, UINT16 &dma_addrc, UINT16 &destination ) -{ - fatalerror("Fake_CDC_Do_DMA\n"); -} - -void lc89510_temp_device::device_start() -{ - segacd_dma_callback.bind_relative_to(*owner()); - type1_interrupt_callback.bind_relative_to(*owner()); - type2_interrupt_callback.bind_relative_to(*owner()); - type3_interrupt_callback.bind_relative_to(*owner()); - - m_cdda = (cdda_device*)subdevice("cdda"); -} - -void lc89510_temp_device::device_reset() -{ -} - - -inline int lc89510_temp_device::to_bcd(int val, bool byte) -{ - if (val > 99) val = 99; - - if (byte) return (((val) / 10) << 4) + ((val) % 10); - else return (((val) / 10) << 8) + ((val) % 10); -} - - - -void lc89510_temp_device::set_data_audio_mode(void) -{ - if (CURRENT_TRACK_IS_DATA) - { - SET_CDD_DATA_MODE - } - else - { - SET_CDD_AUDIO_MODE - //fatalerror("CDDA unsupported\n"); - } -} - -void lc89510_temp_device::CDD_DoChecksum(void) -{ - int checksum = - CDD_RX[0] + - CDD_RX[1] + - CDD_RX[2] + - CDD_RX[3] + - CDD_RX[4] + - CDD_RX[5] + - CDD_RX[6] + - CDD_RX[7] + - CDD_RX[8]; - - if (is_neoCD) checksum += 0x5; // why?? - checksum &= 0xf; - checksum ^= 0xf; - - CDD_RX[9] = checksum; -} - -bool lc89510_temp_device::CDD_Check_TX_Checksum(void) -{ - int checksum = - CDD_TX[0] + - CDD_TX[1] + - CDD_TX[2] + - CDD_TX[3] + - CDD_TX[4] + - CDD_TX[5] + - CDD_TX[6] + - CDD_TX[7] + - CDD_TX[8]; - - if (is_neoCD) checksum += 0x5; // why?? - checksum &= 0xf; - checksum ^= 0xf; - - if (CDD_TX[9] == checksum) - return true; - - return false; -} - -// converts our 16-bit working regs to 8-bit regs and checksums them -void lc89510_temp_device::CDD_Export(bool neocd_hack) -{ - if (!neocd_hack) - CDD_RX[0] = (CDD_STATUS & 0xff00)>>8; - else - { - // printf("was %02x returning %02x\n", (CDD_STATUS & 0xff00)>>8, NeoCD_StatusHack); - CDD_RX[0] = NeoCD_StatusHack; - } - - CDD_RX[1] = (CDD_STATUS & 0x00ff)>>0; - CDD_RX[2] = (CDD_MIN & 0xff00)>>8; - CDD_RX[3] = (CDD_MIN & 0x00ff)>>0; - CDD_RX[4] = (CDD_SEC & 0xff00)>>8; - CDD_RX[5] = (CDD_SEC & 0x00ff)>>0; - CDD_RX[6] = (CDD_FRAME & 0xff00)>>8; - CDD_RX[7] = (CDD_FRAME & 0x00ff)>>0; - CDD_RX[8] = (CDD_EXT & 0x00ff)>>0; - /* 9 = checksum */ - - CDD_DoChecksum(); - - CDD_CONTROL &= ~4; // Clear HOCK bit - -} - - - - - - -void lc89510_temp_device::CDD_GetStatus(void) -{ - UINT16 s = (CDD_STATUS & 0x0f00); - - if ((s == 0x0200) || (s == 0x0700) || (s == 0x0e00)) - CDD_STATUS = (SCD_STATUS & 0xff00) | (CDD_STATUS & 0x00ff); -} - - -void lc89510_temp_device::CDD_Stop(running_machine &machine) -{ - CLEAR_CDD_RESULT - STOP_CDC_READ - SCD_STATUS = CDD_STOPPED; - CDD_STATUS = 0x0000; - SET_CDD_DATA_MODE - m_cdda->stop_audio(); //stop any pending CD-DA - - //neocd - NeoCD_StatusHack = 0x0E; - - -} - - -void lc89510_temp_device::CDD_GetPos(void) -{ - CLEAR_CDD_RESULT - UINT32 msf; - CDD_STATUS &= 0xFF; - if(segacd.cd == NULL) // no CD is there, bail out - return; - CDD_STATUS |= SCD_STATUS; - msf = lba_to_msf_alt(SCD_CURLBA+150); - CDD_MIN = to_bcd(((msf & 0x00ff0000)>>16),false); - CDD_SEC = to_bcd(((msf & 0x0000ff00)>>8),false); - CDD_FRAME = to_bcd(((msf & 0x000000ff)>>0),false); -} - -void lc89510_temp_device::CDD_GetTrackPos(void) -{ - CLEAR_CDD_RESULT - int elapsedlba; - UINT32 msf; - CDD_STATUS &= 0xFF; - // UINT32 end_msf = ; - if(segacd.cd == NULL) // no CD is there, bail out - return; - CDD_STATUS |= SCD_STATUS; - elapsedlba = SCD_CURLBA - segacd.toc->tracks[ cdrom_get_track(segacd.cd, SCD_CURLBA) ].logframeofs; - msf = lba_to_msf_alt (elapsedlba); - //popmessage("%08x %08x",SCD_CURLBA,segacd.toc->tracks[ cdrom_get_track(segacd.cd, SCD_CURLBA) + 1 ].logframeofs); - CDD_MIN = to_bcd(((msf & 0x00ff0000)>>16),false); - CDD_SEC = to_bcd(((msf & 0x0000ff00)>>8),false); - CDD_FRAME = to_bcd(((msf & 0x000000ff)>>0),false); -} - -void lc89510_temp_device::CDD_GetTrack(void) -{ - CLEAR_CDD_RESULT - CDD_STATUS &= 0xFF; - if(segacd.cd == NULL) // no CD is there, bail out - return; - CDD_STATUS |= SCD_STATUS; - SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; - CDD_MIN = to_bcd(SCD_CURTRK, false); -} - -void lc89510_temp_device::CDD_Length(void) -{ - CLEAR_CDD_RESULT - CDD_STATUS &= 0xFF; - if(segacd.cd == NULL) // no CD is there, bail out - return; - CDD_STATUS |= SCD_STATUS; - - UINT32 startlba = (segacd.toc->tracks[cdrom_get_last_track(segacd.cd)].logframeofs); - UINT32 startmsf = lba_to_msf_alt( startlba ); - - CDD_MIN = to_bcd((startmsf&0x00ff0000)>>16,false); - CDD_SEC = to_bcd((startmsf&0x0000ff00)>>8,false); - CDD_FRAME = to_bcd((startmsf&0x000000ff)>>0,false); -} - - -void lc89510_temp_device::CDD_FirstLast(void) -{ - CLEAR_CDD_RESULT - CDD_STATUS &= 0xFF; - if(segacd.cd == NULL) // no CD is there, bail out - return; - CDD_STATUS |= SCD_STATUS; - CDD_MIN = 1; // first - CDD_SEC = to_bcd(cdrom_get_last_track(segacd.cd),false); // last -} - -void lc89510_temp_device::CDD_GetTrackAdr(void) -{ - CLEAR_CDD_RESULT - - int track = (CDD_TX[5] & 0xF) + (CDD_TX[4] & 0xF) * 10; - int last_track = cdrom_get_last_track(segacd.cd); - - CDD_STATUS &= 0xFF; - if(segacd.cd == NULL) // no CD is there, bail out - return; - CDD_STATUS |= SCD_STATUS; - - if (track > last_track) - track = last_track; - - if (track < 1) - track = 1; - - UINT32 startlba = (segacd.toc->tracks[track-1].logframeofs); - UINT32 startmsf = lba_to_msf_alt( startlba+150 ); - - CDD_MIN = to_bcd((startmsf&0x00ff0000)>>16,false); - CDD_SEC = to_bcd((startmsf&0x0000ff00)>>8,false); - CDD_FRAME = to_bcd((startmsf&0x000000ff)>>0,false); - CDD_EXT = track % 10; - - if (segacd.toc->tracks[track - 1].trktype != CD_TRACK_AUDIO) - CDD_FRAME |= 0x0800; -} - -// verify what this is.. the NeoCd emu code only checked the track type but -// checked it where we put CDD_EXT, not CDD_FRAME (RX[7] vs RX[8] in Export) -void lc89510_temp_device::CDD_GetTrackType(void) -{ - CLEAR_CDD_RESULT - - int track = (CDD_TX[5] & 0xF) + (CDD_TX[4] & 0xF) * 10; - int last_track = cdrom_get_last_track(segacd.cd); - - CDD_STATUS &= 0xFF; - if(segacd.cd == NULL) // no CD is there, bail out - return; - CDD_STATUS |= SCD_STATUS; - - if (track > last_track) - track = last_track; - - if (track < 1) - track = 1; - - if (segacd.toc->tracks[track - 1].trktype != CD_TRACK_AUDIO) - { - CDD_EXT = 0x08; - CDD_FRAME |= 0x0800; - } - - - -} - -UINT32 lc89510_temp_device::getmsf_from_regs(void) -{ - UINT32 msf = 0; - - msf = ((CDD_TX[3] & 0xF) + (CDD_TX[2] & 0xF) * 10) << 16; - msf |= ((CDD_TX[5] & 0xF) + (CDD_TX[4] & 0xF) * 10) << 8; - msf |= ((CDD_TX[7] & 0xF) + (CDD_TX[6] & 0xF) * 10) << 0; - - return msf; -} - -void lc89510_temp_device::CDD_Play(running_machine &machine) -{ - CLEAR_CDD_RESULT - UINT32 msf = getmsf_from_regs(); - SCD_CURLBA = msf_to_lba(msf)-150; - if(segacd.cd == NULL) // no CD is there, bail out - return; - UINT32 end_msf = segacd.toc->tracks[ cdrom_get_track(segacd.cd, SCD_CURLBA) + 1 ].logframeofs; - SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; - LC8951UpdateHeader(); - SCD_STATUS = CDD_PLAYINGCDDA; - CDD_STATUS = 0x0102; - set_data_audio_mode(); - printf("%d Track played\n",SCD_CURTRK); - CDD_MIN = to_bcd(SCD_CURTRK, false); - if(!(CURRENT_TRACK_IS_DATA)) - m_cdda->start_audio(SCD_CURLBA, end_msf - SCD_CURLBA); - SET_CDC_READ - - - NeoCD_StatusHack = 1; - -} - - -void lc89510_temp_device::CDD_Seek(void) -{ - CLEAR_CDD_RESULT - UINT32 msf = getmsf_from_regs(); - SCD_CURLBA = msf_to_lba(msf)-150; - if(segacd.cd == NULL) // no CD is there, bail out - return; - SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; - LC8951UpdateHeader(); - STOP_CDC_READ - SCD_STATUS = CDD_READY; - CDD_STATUS = 0x0200; - set_data_audio_mode(); -} - - -void lc89510_temp_device::CDD_Pause(running_machine &machine) -{ - CLEAR_CDD_RESULT - STOP_CDC_READ - SCD_STATUS = CDD_READY; - CDD_STATUS = SCD_STATUS; - SET_CDD_DATA_MODE - - //segacd.current_frame = cdda_get_audio_lba( machine.device( "cdda" ) ); - //if(!(CURRENT_TRACK_IS_DATA)) - m_cdda->pause_audio(1); - - - NeoCD_StatusHack = 4; - - -} - -void lc89510_temp_device::CDD_Resume(running_machine &machine) -{ - CLEAR_CDD_RESULT - STOP_CDC_READ - if(segacd.cd == NULL) // no CD is there, bail out - return; - SCD_CURTRK = cdrom_get_track(segacd.cd, SCD_CURLBA)+1; - SCD_STATUS = CDD_PLAYINGCDDA; - CDD_STATUS = 0x0102; - set_data_audio_mode(); - CDD_MIN = to_bcd (SCD_CURTRK, false); - SET_CDC_READ - //if(!(CURRENT_TRACK_IS_DATA)) - m_cdda->pause_audio(0); - - NeoCD_StatusHack = 1; -} - - -void lc89510_temp_device::CDD_FF(running_machine &machine) -{ - fatalerror("Fast Forward unsupported\n"); -} - - -void lc89510_temp_device::CDD_RW(running_machine &machine) -{ - fatalerror("Fast Rewind unsupported\n"); -} - - -void lc89510_temp_device::CDD_Open(void) -{ - fatalerror("Close Tray unsupported\n"); - /* TODO: re-read CD-ROM buffer here (Mega CD has multi disc games iirc?) */ -} - - -void lc89510_temp_device::CDD_Close(void) -{ - fatalerror("Open Tray unsupported\n"); - /* TODO: clear CD-ROM buffer here */ -} - - -void lc89510_temp_device::CDD_Init(void) -{ - CLEAR_CDD_RESULT - STOP_CDC_READ - SCD_STATUS = CDD_READY; - CDD_STATUS = SCD_STATUS; - CDD_SEC = 1; - CDD_FRAME = 1; -} - - -void lc89510_temp_device::CDD_Default(void) -{ - CLEAR_CDD_RESULT - CDD_STATUS = SCD_STATUS; - - - NeoCD_StatusHack = 9; -} - - -void lc89510_temp_device::CDD_Reset(void) -{ - CLEAR_CDD_RESULT - CDD_CONTROL = CDD_STATUS = 0; - - for (int i = 0; i < 10; i++) - CDD_RX[i] = CDD_TX[i] = 0; - - CDD_DoChecksum(); - - SCD_CURTRK = SCD_CURLBA = 0; - SCD_STATUS = CDD_READY; -} - -void lc89510_temp_device::CDC_Reset(void) -{ - memset(CDC_BUFFER, 0x00, ((16 * 1024 * 2) + SECTOR_SIZE)); - - LC8951RegistersW[REG_W_DACL] = LC8951RegistersW[REG_W_DACH] = LC8951RegistersW[REG_W_DBCL] = LC8951RegistersW[REG_W_DBCH] = LC8951RegistersW[REG_W_PTH] = LC8951RegistersW[REG_W_PTL] = LC8951RegistersW[REG_W_SBOUT] = LC8951RegistersW[REG_W_IFCTRL] = LC8951RegistersW[REG_W_CTRL0] = LC8951RegistersW[REG_W_CTRL1] = - LC8951RegistersW[REG_W_CTRL2] = LC8951RegistersR[REG_R_HEAD1] = LC8951RegistersR[REG_R_HEAD2] = LC8951RegistersR[REG_R_HEAD3] = LC8951RegistersR[REG_R_STAT0] = LC8951RegistersR[REG_R_STAT1] = LC8951RegistersR[REG_R_STAT2] = CDC_DECODE = 0; - - LC8951RegistersR[REG_R_IFSTAT] = 0xFF; - int wa = SECTOR_SIZE * 2; - LC8951RegistersW[REG_W_WAL] = wa & 0xff; LC8951RegistersW[REG_W_WAH] = (wa >> 8) &0xff; - LC8951RegistersR[REG_R_HEAD0] = 0x01; - LC8951RegistersR[REG_R_STAT3] = 0x80; - - LC8951UpdateHeader(); -} - - -void lc89510_temp_device::lc89510_Reset(void) -{ - CDD_Reset(); - CDC_Reset(); - - CDC_REG0 = CDC_REG1 = SCD_STATUS_CDC = CDD_DONE = 0; -} - - -void lc89510_temp_device::CDC_Do_DMA(running_machine& machine, int rate) -{ - UINT32 length; - - UINT16 destination = CDC_REG0 & 0x0700; - - if (!(SCD_DMA_ENABLED)) - return; - - if ((destination == READ_MAIN) || (destination==READ_SUB)) - { - CDC_REG0 |= 0x4000; - return; - } - - int dma_count_register = LC8951RegistersW[REG_W_DBCL] | (LC8951RegistersW[REG_W_DBCH]<<8); - - if (dma_count_register <= (rate * 2)) - { - length = (dma_count_register + 1) >> 1; - CDC_End_Transfer(machine); - } - else - length = rate; - - - int dmacount = length; - - UINT16 dma_addrc = LC8951RegistersW[REG_W_DACL] | (LC8951RegistersW[REG_W_DACH]<<8); - - // HACK - segacd_dma_callback(dmacount, CDC_BUFFER, dma_addrc, destination ); - - - dma_addrc += length*2; - LC8951RegistersW[REG_W_DACL] = dma_addrc & 0xff; LC8951RegistersW[REG_W_DACH] = (dma_addrc >> 8) & 0xff; - - if (SCD_DMA_ENABLED) - dma_count_register -= length*2; - else - dma_count_register = 0; - - LC8951RegistersW[REG_W_DBCL] = dma_count_register & 0xff; LC8951RegistersW[REG_W_DBCH] = (dma_count_register>>8) & 0xff; - -} - - - - -UINT16 lc89510_temp_device::CDC_Host_r(running_machine& machine, UINT16 type) -{ - UINT16 destination = CDC_REG0 & 0x0700; - - if (SCD_DMA_ENABLED) - { - if (destination == type) - { - int dma_count_register = LC8951RegistersW[REG_W_DBCL] | (LC8951RegistersW[REG_W_DBCH]<<8); - - dma_count_register -= 2; - - if (dma_count_register <= 0) - { - if (type==READ_SUB) dma_count_register = 0; - - CDC_End_Transfer(machine); - } - - LC8951RegistersW[REG_W_DBCL] = dma_count_register & 0xff; LC8951RegistersW[REG_W_DBCH] = (dma_count_register>>8) & 0xff; - - UINT16 dma_addrc = LC8951RegistersW[REG_W_DACL] | (LC8951RegistersW[REG_W_DACH]<<8); - - UINT16 data = (CDC_BUFFER[dma_addrc]<<8) | CDC_BUFFER[dma_addrc+1]; - dma_addrc += 2; - - LC8951RegistersW[REG_W_DACL] = dma_addrc & 0xff; LC8951RegistersW[REG_W_DACH] = (dma_addrc >> 8) & 0xff; - - - return data; - } - } - - return 0; -} - - - - -UINT8 lc89510_temp_device::CDC_Reg_r(void) -{ - int reg = CDC_REG0 & 0xF; - UINT8 ret = 0; - - - UINT16 decoderegs = 0x73F2; - - if ((decoderegs>>reg)&1) - CDC_DECODE |= (1 << reg); - - - CDC_REG0 = (CDC_REG0 & 0xFFF0) | ((reg+1)&0xf); - - switch (reg) - { - case REG_R_COMIN: ret = 0/*COMIN*/; break; - case REG_R_IFSTAT: ret = LC8951RegistersR[REG_R_IFSTAT]; break; - case REG_R_DBCL: ret = LC8951RegistersW[REG_W_DBCL]; break; - case REG_R_DBCH: -// LC8951RegistersR[REG_R_DBCH] &= 0x0F; // NeoCD? -// LC8951RegistersR[REG_R_DBCH] |= (LC8951RegistersR[REG_R_IFSTAT] & 0x40) ? 0x00 : 0xF0; // NeoCD? - ret = LC8951RegistersW[REG_W_DBCH]; break; - case REG_R_HEAD0: ret = LC8951RegistersR[REG_R_HEAD0]; break; - case REG_R_HEAD1: ret = LC8951RegistersR[REG_R_HEAD1]; break; - case REG_R_HEAD2: ret = LC8951RegistersR[REG_R_HEAD2]; break; - case REG_R_HEAD3: ret = LC8951RegistersR[REG_R_HEAD3]; break; - case REG_R_PTL: ret = LC8951RegistersW[REG_W_PTL]; break; - case REG_R_PTH: ret = LC8951RegistersW[REG_W_PTH]; break; - case REG_R_WAL: ret = LC8951RegistersW[REG_W_WAL]; break; - case REG_R_WAH: ret = LC8951RegistersW[REG_W_WAH]; break; - case REG_R_STAT0: ret = LC8951RegistersR[REG_R_STAT0]; break; - case REG_R_STAT1: ret = LC8951RegistersR[REG_R_STAT1]; - // LC8951RegistersR[REG_R_IFSTAT] |= 0x20; // NeoCD? // reset DECI - break; - case REG_R_STAT2: ret = LC8951RegistersR[REG_R_STAT2]; break; - case REG_R_STAT3: ret = LC8951RegistersR[REG_R_STAT3]; - - LC8951RegistersR[REG_R_IFSTAT] |= 0x20; // SegaCD? // reset DECI - if (!is_neoCD) - { - if ((LC8951RegistersW[REG_W_CTRL0] & 0x80) && (LC8951RegistersW[REG_W_IFCTRL] & 0x20)) - { - if ((CDC_DECODE & decoderegs) == decoderegs) - LC8951RegistersR[REG_R_STAT3] = 0x80; - } - } - break; - - } - - - return ret; -} - -void lc89510_temp_device::CDC_Reg_w(UINT8 data) -{ - int reg = CDC_REG0 & 0xF; - - int changers0[0x10] = { 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0}; - - if (changers0[reg]) - CDC_REG0 = (CDC_REG0 & 0xFFF0) | (reg+1); - - switch (reg) - { - case REG_W_SBOUT: - LC8951RegistersW[REG_W_SBOUT] = data; - break; - - case REG_W_IFCTRL: - LC8951RegistersW[REG_W_IFCTRL] = data; - - if (!(LC8951RegistersW[REG_W_IFCTRL] & 0x02)) - { - LC8951RegistersW[REG_W_DBCL] = 0; LC8951RegistersW[REG_W_DBCH] = 0; - STOP_CDC_DMA; - LC8951RegistersR[REG_R_IFSTAT] |= 0x08; - } - break; - - case REG_W_DBCL: LC8951RegistersW[REG_W_DBCL] = data; break; - case REG_W_DBCH: LC8951RegistersW[REG_W_DBCH] = data; break; - case REG_W_DACL: LC8951RegistersW[REG_W_DACL] = data; break; - case REG_W_DACH: LC8951RegistersW[REG_W_DACH] = data; break; - - case REG_W_DTTRG: - if (!is_neoCD) - { - if (LC8951RegistersW[REG_W_IFCTRL] & 0x02) - { - LC8951RegistersR[REG_R_IFSTAT] &= ~0x08; - SET_CDC_DMA; - CDC_REG0 &= ~0x8000; - } - } - else - { - LC8951RegistersW[REG_W_DTTRG] = ~0x00; - LC8951RegistersR[REG_R_IFSTAT] &= ~0x08; - } - break; - - case REG_W_DTACK: - //if (!is_neoCD) - { - LC8951RegistersR[REG_R_IFSTAT] |= 0x40; - } - //else - //{ - // LC8951RegistersW[REG_W_DTACK] = ~0x00; - // LC8951RegistersR[REG_R_IFSTAT] &= ~0x40; - //} - break; - case REG_W_WAL: LC8951RegistersW[REG_W_WAL] = data; break; - case REG_W_WAH: LC8951RegistersW[REG_W_WAH] = data; break; - case REG_W_CTRL0: LC8951RegistersW[REG_W_CTRL0] = data; break; - case REG_W_CTRL1: LC8951RegistersW[REG_W_CTRL1] = data; - //LC8951UpdateHeader(); // NeoCD - break; - case REG_W_PTL: LC8951RegistersW[REG_W_PTL] = data; break; - case REG_W_PTH: LC8951RegistersW[REG_W_PTH] = data; break; - case REG_W_CTRL2: LC8951RegistersW[REG_W_CTRL2] = data; break; - case REG_W_RESET: CDC_Reset(); break; - } -} - - - -void lc89510_temp_device::CDD_Process(running_machine& machine, int reason) -{ - CDD_Export(); - CHECK_SCD_LV4_INTERRUPT -} - -void lc89510_temp_device::CDD_Handle_TOC_Commands(void) -{ - int subcmd = CDD_TX[3]; - CDD_STATUS = (CDD_STATUS & 0xFF00) | subcmd; - - switch (subcmd) - { - case TOCCMD_CURPOS: CDD_GetPos(); break; - case TOCCMD_TRKPOS: CDD_GetTrackPos(); break; - case TOCCMD_CURTRK: CDD_GetTrack(); break; - case TOCCMD_LENGTH: CDD_Length(); break; - case TOCCMD_FIRSTLAST: CDD_FirstLast(); break; - case TOCCMD_TRACKADDR: CDD_GetTrackAdr(); break; - case 6: CDD_GetTrackType(); break; // NGCD, might be wrong, make sure Sega CD doesn't hate it - default: CDD_GetStatus(); break; - } -} - -static const char *const CDD_import_cmdnames[] = -{ - "Get Status", // 0 - "Stop ALL", // 1 - "Handle TOC", // 2 - "Play", // 3 - "Seek", // 4 - " (5)", // 5 - "Pause", // 6 - "Resume", // 7 - "FF", // 8 - "RWD", // 9 - "INIT", // A - " (b)", // B - "Close Tray", // C - "Open Tray", // D - " (e)", // E - " (f)" // F -}; - -bool lc89510_temp_device::CDD_Import(running_machine& machine) -{ - // don't execute the command if the checksum isn't valid - if (!CDD_Check_TX_Checksum()) - { - printf("invalid checksum\n"); - return false; - } - - if(CDD_TX[0] != 2 && CDD_TX[0] != 0) - printf("%s\n",CDD_import_cmdnames[CDD_TX[0]]); - - switch (CDD_TX[0]) - { - case CMD_STATUS: CDD_GetStatus(); break; - case CMD_STOPALL: CDD_Stop(machine); break; - case CMD_GETTOC: CDD_Handle_TOC_Commands(); break; - case CMD_READ: CDD_Play(machine); break; - case CMD_SEEK: CDD_Seek(); break; - case CMD_STOP: CDD_Pause(machine); break; - case CMD_RESUME: CDD_Resume(machine); break; - case CMD_FF: CDD_FF(machine); break; - case CMD_RW: CDD_RW(machine); break; - case CMD_INIT: CDD_Init(); break; - case CMD_CLOSE: CDD_Open(); break; - case CMD_OPEN: CDD_Close(); break; - default: CDD_Default(); break; - } - - CDD_DONE = 1; - return true; -} - - -/************************************************************** - CDC Stuff ******** -**************************************************************/ - - - -WRITE16_MEMBER( lc89510_temp_device::segacd_cdc_mode_address_w ) -{ - COMBINE_DATA(&CDC_REG0); -} - -READ16_MEMBER( lc89510_temp_device::segacd_cdc_mode_address_r ) -{ - return CDC_REG0; -} - -WRITE16_MEMBER( lc89510_temp_device::segacd_cdc_data_w ) -{ - COMBINE_DATA(&CDC_REG1); - - if (ACCESSING_BITS_0_7) - CDC_Reg_w(data); -} - -READ16_MEMBER( lc89510_temp_device::segacd_cdc_data_r ) -{ - UINT16 retdat = 0x0000; - - if (ACCESSING_BITS_0_7) - retdat |= CDC_Reg_r(); - - return retdat; -} - - -READ16_MEMBER( lc89510_temp_device::cdc_data_sub_r ) -{ - return CDC_Host_r(space.machine(), READ_SUB); -} - -READ16_MEMBER( lc89510_temp_device::cdc_data_main_r ) -{ - return CDC_Host_r(space.machine(), READ_MAIN); -} - - - - -READ16_MEMBER( lc89510_temp_device::segacd_irq_mask_r ) -{ - return segacd_irq_mask; -} - -WRITE16_MEMBER( lc89510_temp_device::segacd_irq_mask_w ) -{ - if (ACCESSING_BITS_0_7) - { - UINT16 control = CDD_CONTROL; - - // printf("segacd_irq_mask_w %04x %04x (CDD control is %04x)\n",data, mem_mask, control); - - if (data & 0x10) - { - if (control & 0x04) - { - if (!(segacd_irq_mask & 0x10)) - { - segacd_irq_mask = data & 0x7e; - CDD_Process(space.machine(), 0); - return; - } - } - } - - segacd_irq_mask = data & 0x7e; - } - else - { - printf("segacd_irq_mask_w only MSB written\n"); - - } -} - -READ16_MEMBER( lc89510_temp_device::segacd_cdd_ctrl_r ) -{ - return CDD_CONTROL; -} - - -WRITE16_MEMBER( lc89510_temp_device::segacd_cdd_ctrl_w ) -{ - if (ACCESSING_BITS_0_7) - { - UINT16 control = CDD_CONTROL; - - - //printf("segacd_cdd_ctrl_w %04x %04x (control %04x irq %04x\n", data, mem_mask, control, segacd_irq_mask); - - data &=0x4; // only HOCK bit is writable - - if (data & 0x4) - { - if (!(control & 0x4)) - { - if (segacd_irq_mask&0x10) - { - CDD_Process(space.machine(), 1); - } - } - } - - CDD_CONTROL |= data; - } - else - { - printf("segacd_cdd_ctrl_w only MSB written\n"); - } -} - - -// mapped as serial -UINT8 lc89510_temp_device::neocd_cdd_rx_r() -{ - UINT8 ret = 0; - - if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { - ret = CDD_RX[NeoCDCommsWordCount] & 0x0F; - } - - if (bNeoCDCommsClock) { - ret |= 0x10; - } - - return ret; -} - -// mapped like 'ram' -READ8_MEMBER( lc89510_temp_device::segacd_cdd_rx_r ) -{ - return CDD_RX[offset]; -} - -// mapped as serial -void lc89510_temp_device::neocd_cdd_tx_w(UINT8 data) -{ - //printf("neocd_cdd_tx_w %d, %02x\n", NeoCDCommsWordCount, data); - - if (NeoCDCommsWordCount >= 0 && NeoCDCommsWordCount < 10) { - CDD_TX[NeoCDCommsWordCount] = data & 0x0F; - } -} - -WRITE8_MEMBER( lc89510_temp_device::segacd_cdd_tx_w ) -{ - CDD_TX[offset] = data; - - if(offset == 9) - { - CDD_Import(space.machine()); - } -} - - - - - - -READ16_MEMBER( lc89510_temp_device::segacd_cdfader_r ) -{ - return 0; -} - -WRITE16_MEMBER( lc89510_temp_device::segacd_cdfader_w ) -{ - static double cdfader_vol; - if(data & 0x800f) - printf("CD Fader register write %04x\n",data); - - cdfader_vol = (double)((data & 0x3ff0) >> 4); - - if(data & 0x4000) - cdfader_vol = 100.0; - else - cdfader_vol = (cdfader_vol / 1024.0) * 100.0; - - //printf("%f\n",cdfader_vol); - - m_cdda->set_volume(cdfader_vol); -} - -void lc89510_temp_device::reset_cd(void) -{ - /* init cd-rom device */ - - lc89510_Reset(); - - { - cdrom_image_device *cddevice = machine().device("cdrom"); - if ( cddevice ) - { - segacd.cd = cddevice->get_cdrom_file(); - if ( segacd.cd ) - { - segacd.toc = cdrom_get_toc( segacd.cd ); - m_cdda->set_cdrom(segacd.cd); - m_cdda->stop_audio(); //stop any pending CD-DA - } - } - } - - - -// if (segacd.cd) -// printf("cd found\n"); -} - - - -TIMER_DEVICE_CALLBACK_MEMBER( lc89510_temp_device::segacd_access_timer_callback ) -{ - if (!is_neoCD) - { - if (CDD_DONE) - { - CDD_DONE = 0; - CDD_Export(); - CHECK_SCD_LV4_INTERRUPT_A - } - } - else - { - if (nff0002 & 0x0050) - { - type2_interrupt_callback(); - } - } - - if (SCD_READ_ENABLED) // if (nff0002 & 0x0050) if (nff0002 & 0x0500); - { - set_data_audio_mode(); - Read_LBA_To_Buffer(machine()); - } - -} - - - - -static MACHINE_CONFIG_FRAGMENT( lc89510_temp_fragment ) - MCFG_TIMER_DRIVER_ADD_PERIODIC("hock_timer", lc89510_temp_device, segacd_access_timer_callback, attotime::from_hz(75)) - - MCFG_SOUND_ADD( "cdda", CDDA, 0 ) - MCFG_SOUND_ROUTE( 0, ":lspeaker", 0.50 ) // TODO: accurate volume balance - MCFG_SOUND_ROUTE( 1, ":rspeaker", 0.50 ) -MACHINE_CONFIG_END - -machine_config_constructor lc89510_temp_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( lc89510_temp_fragment ); -} - -/* Neo CD */ - - - - - - - - - - -void lc89510_temp_device::NeoCDCommsReset() -{ - bNeoCDCommsClock = true; - - memset(CDD_TX, 0, sizeof(CDD_TX)); - memset(CDD_RX, 0, sizeof(CDD_RX)); - - NeoCDCommsWordCount = 0; - - NeoCD_StatusHack = 9; - - - nff0016 = 0; -} - - - - -void lc89510_temp_device::NeoCDCommsControl(UINT8 clock, UINT8 send) -{ - if (clock && !bNeoCDCommsClock) { - NeoCDCommsWordCount++; - if (NeoCDCommsWordCount >= 10) { - NeoCDCommsWordCount = 0; - - if (send) - { - if (CDD_TX[0]) - { - if (!CDD_Import(machine())) - return; - - CDD_Export(true); // true == neocd hack, - } - - } - - } - } - bNeoCDCommsClock = clock; -} - - -void lc89510_temp_device::LC8951UpdateHeader() // neocd -{ - if (LC8951RegistersW[REG_W_CTRL1] & 1) { - // HEAD registers have sub-header - - LC8951RegistersR[REG_R_HEAD0] = 0; // HEAD0 - LC8951RegistersR[REG_R_HEAD1] = 0; // HEAD1 - LC8951RegistersR[REG_R_HEAD2] = 0; // HEAD2 - LC8951RegistersR[REG_R_HEAD3] = 0; // HEAD3 - - } else { - // HEAD registers have header - UINT32 msf = lba_to_msf_alt(SCD_CURLBA+150); - - LC8951RegistersR[REG_R_HEAD0] = to_bcd (((msf & 0x00ff0000)>>16), true); // HEAD0 - LC8951RegistersR[REG_R_HEAD1] = to_bcd (((msf & 0x0000ff00)>>8), true); // HEAD1 - LC8951RegistersR[REG_R_HEAD2] = to_bcd (((msf & 0x000000ff)>>0), true); // HEAD2 - LC8951RegistersR[REG_R_HEAD3] = 0x1; // HEAD3 - } -} - -char* lc89510_temp_device::LC8915InitTransfer(int NeoCDDMACount) -{ - if (!LC8951RegistersW[REG_W_DTTRG]) { - //bprintf(PRINT_ERROR, _T(" LC8951 DTTRG status invalid\n")); - return NULL; - } - if (!(LC8951RegistersW[REG_W_IFCTRL] & 0x02)) { - //bprintf(PRINT_ERROR, _T(" LC8951 DOUTEN status invalid\n")); - return NULL; - } - if (((LC8951RegistersW[REG_W_DACH] << 8) | LC8951RegistersW[REG_W_DACL]) + (NeoCDDMACount << 1) > LC89510_EXTERNAL_BUFFER_SIZE) { - //bprintf(PRINT_ERROR, _T(" DMA transfer exceeds current sector in LC8951 external buffer\n")); - - return NULL; - } - - char* addr = (char*)CDC_BUFFER + ((LC8951RegistersW[REG_W_DACH] << 8) | LC8951RegistersW[REG_W_DACL]); - return addr; -} - -void lc89510_temp_device::LC8915EndTransfer() -{ - LC8951RegistersW[REG_W_DTTRG] = 0x00; // reset DTTRG - - LC8951RegistersR[REG_R_IFSTAT] |= 0x48; // set DTEI & DTBSY - if (LC8951RegistersW[REG_W_IFCTRL] & 0x40) { - // trigger DTE interrupt - - // the Neo Geo CD doesn't use the DTE interrupt - // nIRQAcknowledge &= ~0x20; - // NeoCDIRQUpdate(0); - - } -} - - -void lc89510_temp_device::CDC_End_Transfer(running_machine& machine) -{ - STOP_CDC_DMA - CDC_REG0 |= 0x8000; - CDC_REG0 &= ~0x4000; - LC8951RegistersR[REG_R_IFSTAT] |= 0x08; - - if (LC8951RegistersW[REG_W_IFCTRL] & 0x40) - { - LC8951RegistersR[REG_R_IFSTAT] &= ~0x40; - CHECK_SCD_LV5_INTERRUPT - } -} - - - - - - -void lc89510_temp_device::scd_ctrl_checks(running_machine& machine) -{ - LC8951RegistersR[REG_R_STAT0] = 0x80; - - (LC8951RegistersW[REG_W_CTRL0] & 0x10) ? (LC8951RegistersR[REG_R_STAT2] = LC8951RegistersW[REG_W_CTRL1] & 0x08) : (LC8951RegistersR[REG_R_STAT2] = LC8951RegistersW[REG_W_CTRL1] & 0x0C); - (LC8951RegistersW[REG_W_CTRL0] & 0x02) ? (LC8951RegistersR[REG_R_STAT3] = 0x20) : (LC8951RegistersR[REG_R_STAT3] = 0x00); - - if (LC8951RegistersW[REG_W_IFCTRL] & 0x20) - { - if (is_neoCD) - { - type1_interrupt_callback(); - } - else - { - // todo: make callback - CHECK_SCD_LV5_INTERRUPT - } - - - - LC8951RegistersR[REG_R_IFSTAT] &= ~0x20; - CDC_DECODE = 0; - } -} - -void lc89510_temp_device::scd_advance_current_readpos(void) -{ - SCD_CURLBA++; - - int pt = LC8951RegistersW[REG_W_PTL] | (LC8951RegistersW[REG_W_PTH] << 8); - int wa = LC8951RegistersW[REG_W_WAL] | (LC8951RegistersW[REG_W_WAH] << 8); - - wa += SECTOR_SIZE; - pt += SECTOR_SIZE; - - wa &= 0x7fff; - pt &= 0x7fff; - - LC8951RegistersW[REG_W_PTL] = pt & 0xff; LC8951RegistersW[REG_W_PTH] = (pt >> 8) &0xff; - LC8951RegistersW[REG_W_WAL] = wa & 0xff; LC8951RegistersW[REG_W_WAH] = (wa >> 8) &0xff; - -} - -int lc89510_temp_device::Read_LBA_To_Buffer(running_machine& machine) -{ - bool data_track = false; - if (CDD_CONTROL & 0x0100) data_track = true; - - if (data_track) - cdrom_read_data(segacd.cd, SCD_CURLBA, SCD_BUFFER, CD_TRACK_MODE1); - - LC8951UpdateHeader(); - - if (!data_track) - { - scd_advance_current_readpos(); - } - - if (LC8951RegistersW[REG_W_CTRL0] & 0x80) - { - if (LC8951RegistersW[REG_W_CTRL0] & 0x04) - { - if (data_track) - { - scd_advance_current_readpos(); - - int pt = LC8951RegistersW[REG_W_PTL] | (LC8951RegistersW[REG_W_PTH] << 8); - - memcpy(&CDC_BUFFER[pt + 4], SCD_BUFFER, 2048); - CDC_BUFFER[pt+0] = LC8951RegistersR[REG_R_HEAD0]; - CDC_BUFFER[pt+1] = LC8951RegistersR[REG_R_HEAD1]; - CDC_BUFFER[pt+2] = LC8951RegistersR[REG_R_HEAD2]; - CDC_BUFFER[pt+3] = LC8951RegistersR[REG_R_HEAD3]; - - - if (is_neoCD) - { - // This simulates the protection used by the NeoCDZ, a number of games (samsrpg for example) - // will not be recognized unless this happens. Is this part of the CDC error correction - // mechanism? - char *buffer_hack = (char*)&CDC_BUFFER[pt]; - if (buffer_hack[4 + 64] == 'g' && !strncmp(buffer_hack + 4, "Copyright by SNK", 16)) - { - buffer_hack[4 + 64] = 'f'; - } - } - - } - else - { - int pt = LC8951RegistersW[REG_W_PTL] | (LC8951RegistersW[REG_W_PTH] << 8); - - memcpy(&CDC_BUFFER[pt], SCD_BUFFER, SECTOR_SIZE); - } - } - - scd_ctrl_checks(machine); - - - } - - - return 0; -} - - - - - - -void lc89510_temp_device::nff0002_set(UINT16 wordValue) -{ - nff0002 = wordValue; -} - -void lc89510_temp_device::nff0016_set(UINT16 wordValue) -{ - nff0016 = wordValue; -} - -UINT16 lc89510_temp_device::nff0016_r(void) { return nff0016; } diff --git a/src/mess/machine/megacdcd.h b/src/mess/machine/megacdcd.h deleted file mode 100644 index 9804c372031..00000000000 --- a/src/mess/machine/megacdcd.h +++ /dev/null @@ -1,317 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood - -#include "sound/cdda.h" -#include "imagedev/chd_cd.h" - - -typedef device_delegate segacd_dma_delegate; - -typedef device_delegate interrupt_delegate; - - -#define READ_MAIN (0x0200) -#define READ_SUB (0x0300) - -#define REG_W_SBOUT (0x0) -#define REG_W_IFCTRL (0x1) -#define REG_W_DBCL (0x2) -#define REG_W_DBCH (0x3) -#define REG_W_DACL (0x4) -#define REG_W_DACH (0x5) -#define REG_W_DTTRG (0x6) -#define REG_W_DTACK (0x7) -#define REG_W_WAL (0x8) -#define REG_W_WAH (0x9) -#define REG_W_CTRL0 (0xA) -#define REG_W_CTRL1 (0xB) -#define REG_W_PTL (0xC) -#define REG_W_PTH (0xD) -#define REG_W_CTRL2 (0xE) -#define REG_W_RESET (0xF) - -#define REG_R_COMIN (0x0) -#define REG_R_IFSTAT (0x1) -#define REG_R_DBCL (0x2) -#define REG_R_DBCH (0x3) -#define REG_R_HEAD0 (0x4) -#define REG_R_HEAD1 (0x5) -#define REG_R_HEAD2 (0x6) -#define REG_R_HEAD3 (0x7) -#define REG_R_PTL (0x8) -#define REG_R_PTH (0x9) -#define REG_R_WAL (0xa) -#define REG_R_WAH (0xb) -#define REG_R_STAT0 (0xc) -#define REG_R_STAT1 (0xd) -#define REG_R_STAT2 (0xe) -#define REG_R_STAT3 (0xf) - -#define CMD_STATUS (0x0) -#define CMD_STOPALL (0x1) -#define CMD_GETTOC (0x2) -#define CMD_READ (0x3) -#define CMD_SEEK (0x4) -// (0x5) -#define CMD_STOP (0x6) -#define CMD_RESUME (0x7) -#define CMD_FF (0x8) -#define CMD_RW (0x9) -#define CMD_INIT (0xa) -// (0xb) -#define CMD_CLOSE (0xc) -#define CMD_OPEN (0xd) -// (0xe) -// (0xf) - - -#define TOCCMD_CURPOS (0x0) -#define TOCCMD_TRKPOS (0x1) -#define TOCCMD_CURTRK (0x2) -#define TOCCMD_LENGTH (0x3) -#define TOCCMD_FIRSTLAST (0x4) -#define TOCCMD_TRACKADDR (0x5) - - - - -#define SECTOR_SIZE (2352) - -#define SET_CDD_DATA_MODE \ - CDD_CONTROL |= 0x0100; -#define SET_CDD_AUDIO_MODE \ - CDD_CONTROL &= ~0x0100; -#define STOP_CDC_READ \ - SCD_STATUS_CDC &= ~0x01; -#define SET_CDC_READ \ - SCD_STATUS_CDC |= 0x01; -#define SET_CDC_DMA \ - SCD_STATUS_CDC |= 0x08; -#define STOP_CDC_DMA \ - SCD_STATUS_CDC &= ~0x08; -#define SCD_READ_ENABLED \ - (SCD_STATUS_CDC & 1) - -#define SCD_DMA_ENABLED \ - (SCD_STATUS_CDC & 0x08) - -#define CLEAR_CDD_RESULT \ - CDD_MIN = CDD_SEC = CDD_FRAME = CDD_EXT = 0; -#define CHECK_SCD_LV5_INTERRUPT \ - if (segacd_irq_mask & 0x20) \ - { \ - machine.device(":segacd:segacd_68k")->execute().set_input_line(5, HOLD_LINE); \ - } -#define CHECK_SCD_LV4_INTERRUPT \ - if (segacd_irq_mask & 0x10) \ - { \ - machine.device(":segacd:segacd_68k")->execute().set_input_line(4, HOLD_LINE); \ - } -#define CHECK_SCD_LV4_INTERRUPT_A \ - if (segacd_irq_mask & 0x10) \ - { \ - machine().device(":segacd:segacd_68k")->execute().set_input_line(4, HOLD_LINE); \ - } - - -#define CURRENT_TRACK_IS_DATA \ - (segacd.toc->tracks[SCD_CURTRK - 1].trktype != CD_TRACK_AUDIO) - -#define CDD_PLAYINGCDDA 0x0100 -#define CDD_READY 0x0400 -#define CDD_STOPPED 0x0900 - - -#define MCFG_SEGACD_HACK_SET_CDC_DO_DMA( _class, _method) \ - lc89510_temp_device::set_CDC_Do_DMA(*device, segacd_dma_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); -#define MCFG_SEGACD_HACK_SET_NEOCD \ - lc89510_temp_device::set_is_neoCD(*device, true); -#define MCFG_SET_TYPE1_INTERRUPT_CALLBACK( _class, _method) \ - lc89510_temp_device::set_type1_interrupt_callback(*device, interrupt_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); -#define MCFG_SET_TYPE2_INTERRUPT_CALLBACK( _class, _method) \ - lc89510_temp_device::set_type2_interrupt_callback(*device, interrupt_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); -#define MCFG_SET_TYPE3_INTERRUPT_CALLBACK( _class, _method) \ - lc89510_temp_device::set_type3_interrupt_callback(*device, interrupt_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0)); -/* neocd */ - -#define CD_FRAMES_MINUTE (60 * 75) -#define CD_FRAMES_SECOND ( 75) -#define CD_FRAMES_PREGAP ( 2 * 75) - -#define SEK_IRQSTATUS_NONE (0x0000) -#define SEK_IRQSTATUS_AUTO (0x2000) -#define SEK_IRQSTATUS_ACK (0x1000) - -#define LC89510_EXTERNAL_BUFFER_SIZE ((32 * 1024 * 2) + SECTOR_SIZE) - -class lc89510_temp_device : public device_t -{ -public: - lc89510_temp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // HACK for DMA handling - segacd_dma_delegate segacd_dma_callback; - interrupt_delegate type1_interrupt_callback; - interrupt_delegate type2_interrupt_callback; - interrupt_delegate type3_interrupt_callback; - - void Fake_CDC_Do_DMA(int &dmacount, UINT8 *CDC_BUFFER, UINT16 &dma_addrc, UINT16 &destination ); - static void set_CDC_Do_DMA(device_t &device,segacd_dma_delegate new_segacd_dma_callback); - - void dummy_interrupt_callback(void); - static void set_type1_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback); - static void set_type2_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback); - static void set_type3_interrupt_callback(device_t &device,interrupt_delegate interrupt_callback); - - - static void set_is_neoCD(device_t &device, bool is_neoCD); - - - // HACK for neoCD handling - bool is_neoCD; - - - struct segacd_t - { - cdrom_file *cd; - const cdrom_toc *toc; - UINT32 current_frame; - }; - - - segacd_t segacd; - - UINT8 SCD_BUFFER[2560]; - - UINT32 SCD_STATUS; - UINT32 SCD_STATUS_CDC; - INT32 SCD_CURLBA; - UINT8 SCD_CURTRK; - - - UINT16 CDC_DECODE; - UINT16 CDC_REG0; - UINT16 CDC_REG1; - - UINT8 CDC_BUFFER[LC89510_EXTERNAL_BUFFER_SIZE]; - - - UINT8 CDD_RX[10]; - UINT8 CDD_TX[10]; - - UINT32 CDD_STATUS; - UINT32 CDD_MIN; - UINT32 CDD_SEC; - UINT32 CDD_FRAME; - UINT32 CDD_EXT; - - UINT16 CDD_CONTROL; - - INT16 CDD_DONE; - - inline int to_bcd(int val, bool byte); - void set_data_audio_mode(void); - void CDD_DoChecksum(void); - bool CDD_Check_TX_Checksum(void); - void CDD_Export(bool neocd_hack = false); - void scd_ctrl_checks(running_machine& machine); - void scd_advance_current_readpos(void); - int Read_LBA_To_Buffer(running_machine& machine); - void CDD_GetStatus(void); - void CDD_Stop(running_machine &machine); - void CDD_GetPos(void); - void CDD_GetTrackPos(void); - void CDD_GetTrack(void); - void CDD_Length(void); - void CDD_FirstLast(void); - void CDD_GetTrackAdr(void); - void CDD_GetTrackType(void); - UINT32 getmsf_from_regs(void); - void CDD_Play(running_machine &machine); - void CDD_Seek(void); - void CDD_Pause(running_machine &machine); - void CDD_Resume(running_machine &machine); - void CDD_FF(running_machine &machine); - void CDD_RW(running_machine &machine); - void CDD_Open(void); - void CDD_Close(void); - void CDD_Init(void); - void CDD_Default(void); - void CDD_Reset(void); - void CDC_Reset(void); - void lc89510_Reset(void); - void CDC_End_Transfer(running_machine& machine); - void CDC_Do_DMA(running_machine& machine, int rate); - UINT16 CDC_Host_r(running_machine& machine, UINT16 type); - UINT8 CDC_Reg_r(void); - void CDC_Reg_w(UINT8 data); - void CDD_Process(running_machine& machine, int reason); - void CDD_Handle_TOC_Commands(void); - bool CDD_Import(running_machine& machine); - READ16_MEMBER( segacd_irq_mask_r ); - WRITE16_MEMBER( segacd_irq_mask_w ); - READ16_MEMBER( segacd_cdd_ctrl_r ); - WRITE16_MEMBER( segacd_cdd_ctrl_w ); - READ8_MEMBER( segacd_cdd_rx_r ); - WRITE8_MEMBER( segacd_cdd_tx_w ); - READ16_MEMBER( segacd_cdfader_r ); - WRITE16_MEMBER( segacd_cdfader_w ); - - void reset_cd(void); - - WRITE16_MEMBER( segacd_cdc_mode_address_w ); - READ16_MEMBER( segacd_cdc_mode_address_r ); - WRITE16_MEMBER( segacd_cdc_data_w ); - READ16_MEMBER( segacd_cdc_data_r ); - READ16_MEMBER( cdc_data_sub_r ); - READ16_MEMBER( cdc_data_main_r ); - - TIMER_DEVICE_CALLBACK_MEMBER( segacd_access_timer_callback ); - - UINT16 get_segacd_irq_mask(void) { return segacd_irq_mask; } - UINT16 segacd_irq_mask; - cdda_device* m_cdda; - - /* NeoCD */ - UINT16 nff0002; - UINT16 nff0016; - - - INT32 LC8951RegistersR[16]; - INT32 LC8951RegistersW[16]; - - - - bool bNeoCDCommsClock; - - INT32 NeoCDCommsWordCount; - - INT32 NeoCD_StatusHack; - - - - - void NeoCDCommsControl(UINT8 clock, UINT8 send); - void LC8951UpdateHeader(); - char* LC8915InitTransfer(int NeoCDDMACount); - void LC8915EndTransfer(); - - void neocd_cdd_tx_w(UINT8 data); - UINT8 neocd_cdd_rx_r(); - void NeoCDCommsReset(); - - - UINT16 nff0016_r(void); - void nff0016_set(UINT16 wordValue); - void nff0002_set(UINT16 wordValue); - -protected: - virtual void device_start(); - virtual void device_reset(); - virtual machine_config_constructor device_mconfig_additions() const; -private: - - -}; - -extern const device_type LC89510_TEMP; diff --git a/src/mess/machine/microdrv.c b/src/mess/machine/microdrv.c deleted file mode 100644 index 803f1d921d8..00000000000 --- a/src/mess/machine/microdrv.c +++ /dev/null @@ -1,197 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************* - - microdrv.c - - MESS interface to the Sinclair Microdrive image abstraction code - -*********************************************************************/ - -#include "emu.h" -#include "microdrv.h" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define LOG 0 - -#define MDV_SECTOR_COUNT 255 -#define MDV_SECTOR_LENGTH 686 -#define MDV_IMAGE_LENGTH (MDV_SECTOR_COUNT * MDV_SECTOR_LENGTH) - -#define MDV_PREAMBLE_LENGTH 12 -#define MDV_GAP_LENGTH 120 - -#define MDV_OFFSET_HEADER_PREAMBLE 0 -#define MDV_OFFSET_HEADER MDV_OFFSET_HEADER_PREAMBLE + MDV_PREAMBLE_LENGTH -#define MDV_OFFSET_DATA_PREAMBLE 28 -#define MDV_OFFSET_DATA MDV_OFFSET_DATA_PREAMBLE + MDV_PREAMBLE_LENGTH -#define MDV_OFFSET_GAP 566 - -#define MDV_BITRATE 120000 // invalid, from ZX microdrive - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -// device type definition -const device_type MICRODRIVE = &device_creator; - -//------------------------------------------------- -// microdrive_image_device - constructor -//------------------------------------------------- - -microdrive_image_device::microdrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, MICRODRIVE, "Microdrive", tag, owner, clock, "microdrive_image", __FILE__), - device_image_interface(mconfig, *this), - m_write_comms_out(*this) -{ -} - -//------------------------------------------------- -// microdrive_image_device - destructor -//------------------------------------------------- - -microdrive_image_device::~microdrive_image_device() -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void microdrive_image_device::device_config_complete() -{ - // set brief and instance name - update_names(); -} - - -void microdrive_image_device::device_start() -{ - // resolve callbacks - m_write_comms_out.resolve_safe(); - - // allocate track buffers - m_left = auto_alloc_array(machine(), UINT8, MDV_IMAGE_LENGTH / 2); - m_right = auto_alloc_array(machine(), UINT8, MDV_IMAGE_LENGTH / 2); - - // allocate timers - m_bit_timer = timer_alloc(); - m_bit_timer->adjust(attotime::zero, 0, attotime::from_hz(MDV_BITRATE)); - m_bit_timer->enable(0); - - m_clk = 0; - m_comms_in = 0; - m_comms_out = 0; -} - -bool microdrive_image_device::call_load() -{ - if (length() != MDV_IMAGE_LENGTH) - return IMAGE_INIT_FAIL; - - for (int i = 0; i < MDV_IMAGE_LENGTH / 2; i++) - { - fread(m_left, 1); - fread(m_right, 1); - } - - m_bit_offset = 0; - m_byte_offset = 0; - - return IMAGE_INIT_PASS; -} - -void microdrive_image_device::call_unload() -{ - memset(m_left, 0, MDV_IMAGE_LENGTH / 2); - memset(m_right, 0, MDV_IMAGE_LENGTH / 2); -} - -void microdrive_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - m_bit_offset++; - - if (m_bit_offset == 8) - { - m_bit_offset = 0; - m_byte_offset++; - - if (m_byte_offset == MDV_IMAGE_LENGTH) - { - m_byte_offset = 0; - } - } -} - -WRITE_LINE_MEMBER( microdrive_image_device::clk_w ) -{ - if (LOG) logerror("Microdrive '%s' CLK: %u\n", tag(), state); - if (!m_clk && state) - { - m_comms_out = m_comms_in; - if (LOG) logerror("Microdrive '%s' COMMS OUT: %u\n", tag(), m_comms_out); - m_write_comms_out(m_comms_out); - m_bit_timer->enable(m_comms_out); - } - m_clk = state; -} - -WRITE_LINE_MEMBER( microdrive_image_device::comms_in_w ) -{ - if (LOG) logerror("Microdrive '%s' COMMS IN: %u\n", tag(), state); - m_comms_in = state; -} - -WRITE_LINE_MEMBER( microdrive_image_device::erase_w ) -{ - if (LOG) logerror("Microdrive '%s' ERASE: %u\n", tag(), state); - m_erase = state; -} - -WRITE_LINE_MEMBER( microdrive_image_device::read_write_w ) -{ - if (LOG) logerror("Microdrive '%s' READ/WRITE: %u\n", tag(), state); - m_read_write = state; -} - -WRITE_LINE_MEMBER( microdrive_image_device::data1_w ) -{ - if (m_comms_out && !m_read_write) - { - // TODO - } -} - -WRITE_LINE_MEMBER( microdrive_image_device::data2_w ) -{ - if (m_comms_out && !m_read_write) - { - // TODO - } -} - -READ_LINE_MEMBER( microdrive_image_device::data1_r ) -{ - int data = 0; - if (m_comms_out && m_read_write) - { - data = BIT(m_left[m_byte_offset], 7 - m_bit_offset); - } - return data; -} - -READ_LINE_MEMBER( microdrive_image_device::data2_r ) -{ - int data = 0; - if (m_comms_out && m_read_write) - { - data = BIT(m_right[m_byte_offset], 7 - m_bit_offset); - } - return data; -} diff --git a/src/mess/machine/microdrv.h b/src/mess/machine/microdrv.h deleted file mode 100644 index 7d8913aae00..00000000000 --- a/src/mess/machine/microdrv.h +++ /dev/null @@ -1,104 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************* - - microdrv.h - - MESS interface to the Sinclair Microdrive image abstraction code - -*********************************************************************/ - -#pragma once - -#ifndef __MICRODRV__ -#define __MICRODRV__ - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MDV_1 "mdv1" -#define MDV_2 "mdv2" - - -#define MCFG_MICRODRIVE_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, MICRODRIVE, 0) - -#define MCFG_MICRODRIVE_COMMS_OUT_CALLBACK(_write) \ - devcb = µdrive_image_device::set_comms_out_wr_callback(*device, DEVCB_##_write); - - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -// ======================> microdrive_image_device - -class microdrive_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - microdrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ~microdrive_image_device(); - - template static devcb_base &set_comms_out_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_comms_out.set_callback(object); } - - // image-level overrides - virtual bool call_load(); - virtual void call_unload(); - virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); } - - virtual iodevice_t image_type() const { return IO_CASSETTE; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 0; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return "ql_cass"; } - virtual const char *file_extensions() const { return "mdv"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - // specific implementation - DECLARE_WRITE_LINE_MEMBER( clk_w ); - DECLARE_WRITE_LINE_MEMBER( comms_in_w ); - DECLARE_WRITE_LINE_MEMBER( erase_w ); - DECLARE_WRITE_LINE_MEMBER( read_write_w ); - DECLARE_WRITE_LINE_MEMBER( data1_w ); - DECLARE_WRITE_LINE_MEMBER( data2_w ); - DECLARE_READ_LINE_MEMBER ( data1_r ); - DECLARE_READ_LINE_MEMBER ( data2_r ); -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -private: - devcb_write_line m_write_comms_out; - - int m_clk; - int m_comms_in; - int m_comms_out; - int m_erase; - int m_read_write; - - UINT8 *m_left; - UINT8 *m_right; - - int m_bit_offset; - int m_byte_offset; - - emu_timer *m_bit_timer; -}; - - -// device type definition -extern const device_type MICRODRIVE; - - - -#endif diff --git a/src/mess/machine/micropolis.c b/src/mess/machine/micropolis.c deleted file mode 100644 index 73b1b58178e..00000000000 --- a/src/mess/machine/micropolis.c +++ /dev/null @@ -1,344 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - micropolis.c - - by Robbbert, August 2011. - -This is a rough implementation of the Micropolis floppy-disk controller -as used for the Exidy Sorcerer. Since there is no documentation, coding -was done by looking at the Z80 code, and supplying the expected values. - -Currently, only reading of disks is supported. - -ToDo: -- Rewrite to be a standard device able to be used in a general way -- Fix bug where if you run a program on drive B,C,D then exit, you - get a disk error. -- Enable the ability to write to disk when above bug gets fixed. -- When the controller is reset via command 5, what exactly gets reset? - - -Ports: -BE00 and BE01 can be used as command registers (they are identical), - and they are also used as status registers (different). - -BE02 and BE03 - read data, write data - -***************************************************************************/ - - -#include "emu.h" -#include "machine/micropolis.h" - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - - -#define STAT_RFC 0x20 -#define STAT_TRACK0 0x08 -#define STAT_READY 0x80 - -#define VERBOSE 0 /* General logging */ -#define VERBOSE_DATA 0 /* Logging of each byte during read and write */ - -/* structure describing a single density track */ -#define TRKSIZE_SD 16*270 - -#if 0 -static const UINT8 track_SD[][2] = { - { 1, 0xff}, /* 1 * FF (marker) */ - { 1, 0x00}, /* 1 byte, track number (00-4C) */ - { 1, 0x01}, /* 1 byte, sector number (00-0F) */ - {10, 0x00}, /* 10 bytes of zeroes */ - {256, 0xe5}, /* 256 bytes of sector data */ - { 1, 0xb7}, /* 1 byte, CRC */ -}; -#endif - -/*************************************************************************** - MAME DEVICE INTERFACE -***************************************************************************/ - -const device_type MICROPOLIS = &device_creator; - -micropolis_device::micropolis_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, MICROPOLIS, "MICROPOLIS", tag, owner, clock, "micropolis", __FILE__), - m_read_dden(*this), - m_write_intrq(*this), - m_write_drq(*this), - m_data(0), - m_drive_num(0), - m_track(0), - m_sector(0), - m_command(0), - m_status(0), - m_write_cmd(0), - m_data_offset(0), - m_data_count(0), - m_sector_length(0), - m_drive(NULL) -{ - for (int i = 0; i < 6144; i++) - m_buffer[i] = 0; - - for (int i = 0; i < 4; i++) - m_floppy_drive_tags[i] = NULL; -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void micropolis_device::device_start() -{ - m_read_dden.resolve_safe(1); - m_write_intrq.resolve_safe(); - m_write_drq.resolve_safe(); - - save_item(NAME(m_data)); - save_item(NAME(m_drive_num)); - save_item(NAME(m_track)); - save_item(NAME(m_sector)); - save_item(NAME(m_command)); - save_item(NAME(m_status)); - save_item(NAME(m_write_cmd)); - save_item(NAME(m_buffer)); - save_item(NAME(m_data_offset)); - save_item(NAME(m_data_count)); - save_item(NAME(m_sector_length)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void micropolis_device::device_reset() -{ - for (int i = 0; i < 4; i++) - { - if (m_floppy_drive_tags[i]) - { - legacy_floppy_image_device *img = siblingdevice(m_floppy_drive_tags[i]); - - if (img) - { - img->floppy_drive_set_controller(this); - //img->floppy_drive_set_index_pulse_callback(wd17xx_index_pulse_callback); - img->floppy_drive_set_rpm(300.); - } - } - } - - set_drive(0); - - m_drive_num = 0; - m_sector = 0; - m_track = 0; - m_sector_length = 270; - m_status = STAT_TRACK0; -} - - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - - -/* read a sector */ -void micropolis_device::read_sector() -{ - m_data_offset = 0; - m_data_count = m_sector_length; - - /* read data */ - m_drive->floppy_drive_read_sector_data(0, m_sector, (char *)m_buffer, m_sector_length); -} - - -void micropolis_device::write_sector() -{ -#if 0 - /* at this point, the disc is write enabled, and data - * has been transfered into our buffer - now write it to - * the disc image or to the real disc - */ - - /* find sector */ - m_data_count = m_sector_length; - - /* write data */ - m_drive->floppy_drive_write_sector_data(0, m_sector, (char *)m_buffer, m_sector_length, m_write_cmd & 0x01); -#endif -} - - - - -/*************************************************************************** - INTERFACE -***************************************************************************/ - -/* select a drive */ -void micropolis_device::set_drive(UINT8 drive) -{ - if (VERBOSE) - logerror("micropolis_set_drive: $%02x\n", drive); - - if (m_floppy_drive_tags[drive]) - m_drive = siblingdevice(m_floppy_drive_tags[drive]); -} - - -/*************************************************************************** - DEVICE HANDLERS -***************************************************************************/ - - -/* read the FDC status register. */ -READ8_MEMBER( micropolis_device::status_r ) -{ - static int inv = 0; - - if (offset) - return m_status | m_drive_num; - else - { - // FIXME - find out what controls current sector - m_sector = (m_sector + 3 + inv) & 15; - read_sector(); - inv ^= 1; - return (m_status & STAT_READY) | m_sector; - } -} - - -/* read the FDC data register */ -READ8_MEMBER( micropolis_device::data_r ) -{ - if (m_data_offset >= m_sector_length) - m_data_offset = 0; - - return m_buffer[m_data_offset++]; -} - -/* write the FDC command register */ -WRITE8_MEMBER( micropolis_device::command_w ) -{ -/* List of commands: -Command (bits 5,6,7) Options (bits 0,1,2,3,4) -0 Not used -1 Drive/head select bits 0,1 select drive 0-3; bit 4 chooses a side -2 INT sector control bit 0 LO = disable; HI = enable -3 Step bit 0 LO step out; HI = step in (increment track number) -4 Set Write -5 Reset controller -6 Not used -7 Not used */ - - int direction = 0; - - switch (data >> 5) - { - case 1: - m_drive_num = data & 3; - m_drive->floppy_mon_w(1); // turn off the old drive - set_drive(m_drive_num); // select new drive - m_drive->floppy_mon_w(0); // turn it on - break; - case 2: // not emulated, not used in sorcerer - break; - case 3: - if (BIT(data, 0)) - { - if (m_track < 77) - { - m_track++; - direction = 1; - } - } - else - { - if (m_track) - { - m_track--; - direction = -1; - } - } - break; - case 4: // not emulated, to be done - break; - case 5: // not emulated, to be done - break; - } - - - m_status = STAT_RFC; - - if (BIT(data, 5)) - m_status |= STAT_READY; - - m_drive->floppy_drive_set_ready_state(1,0); - - - if (!m_track) - m_status |= STAT_TRACK0; - - m_drive->floppy_drive_seek(direction); -} - - -/* write the FDC data register */ -WRITE8_MEMBER( micropolis_device::data_w ) -{ - if (m_data_count > 0) - { - /* put byte into buffer */ - if (VERBOSE_DATA) - logerror("micropolis_info buffered data: $%02X at offset %d.\n", data, m_data_offset); - - m_buffer[m_data_offset++] = data; - - if (--m_data_count < 1) - { - write_sector(); - - m_data_offset = 0; - } - } - else - { - if (VERBOSE) - logerror("%s: micropolis_data_w $%02X\n", space.machine().describe_context(), data); - } - m_data = data; -} - -READ8_MEMBER( micropolis_device::read ) -{ - UINT8 data = 0; - - switch (offset & 0x03) - { - case 0: data = status_r(space, 0); break; - case 1: data = status_r(space, 1); break; - case 2: - case 3: data = data_r(space, 0); break; - } - - return data; -} - -WRITE8_MEMBER( micropolis_device::write ) -{ - switch (offset & 0x03) - { - case 0: - case 1: command_w(space, 0, data); break; - case 2: - case 3: data_w(space, 0, data); break; - } -} diff --git a/src/mess/machine/micropolis.h b/src/mess/machine/micropolis.h deleted file mode 100644 index b7ef89dee2b..00000000000 --- a/src/mess/machine/micropolis.h +++ /dev/null @@ -1,111 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/********************************************************************* - - micropolis.h - - Implementations of the Micropolis - floppy disk controller for the Sorcerer - -*********************************************************************/ - -#ifndef __MICROPOLIS_H__ -#define __MICROPOLIS_H__ - -#include "imagedev/flopdrv.h" - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -#define MCFG_MICROPOLIS_DRIVE_TAGS(_tag1, _tag2, _tag3, _tag4) \ - micropolis_device::set_drive_tags(*device, _tag1, _tag2, _tag3, _tag4); - -#define MCFG_MICROPOLIS_DEFAULT_DRIVE4_TAGS \ - MCFG_MICROPOLIS_DRIVE_TAGS(FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3) - -#define MCFG_MICROPOLIS_DDEN_CALLBACK(_read) \ - devcb = µpolis_device::set_dden_rd_callback(*device, DEVCB_##_read); - -#define MCFG_MICROPOLIS_INTRQ_CALLBACK(_write) \ - devcb = µpolis_device::set_intrq_wr_callback(*device, DEVCB_##_write); - -#define MCFG_MICROPOLIS_DRQ_CALLBACK(_write) \ - devcb = µpolis_device::set_drq_wr_callback(*device, DEVCB_##_write); - -/*************************************************************************** - MACROS -***************************************************************************/ - -class micropolis_device : public device_t -{ -public: - micropolis_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~micropolis_device() {} - - template static devcb_base &set_dden_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_dden.set_callback(object); } - template static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_intrq.set_callback(object); } - template static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_drq.set_callback(object); } - - static void set_drive_tags(device_t &device, const char *tag1, const char *tag2, const char *tag3, const char *tag4) - { - micropolis_device &dev = downcast(device); - dev.m_floppy_drive_tags[0] = tag1; - dev.m_floppy_drive_tags[1] = tag2; - dev.m_floppy_drive_tags[2] = tag3; - dev.m_floppy_drive_tags[3] = tag4; - } - - void set_drive(UINT8 drive); // set current drive (0-3) - - DECLARE_READ8_MEMBER( status_r ); - DECLARE_READ8_MEMBER( data_r ); - - DECLARE_WRITE8_MEMBER( command_w ); - DECLARE_WRITE8_MEMBER( data_w ); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - // internal state - - devcb_read_line m_read_dden; - devcb_write_line m_write_intrq; - devcb_write_line m_write_drq; - - const char *m_floppy_drive_tags[4]; - - /* register */ - UINT8 m_data; - UINT8 m_drive_num; - UINT8 m_track; - UINT8 m_sector; - UINT8 m_command; - UINT8 m_status; - - UINT8 m_write_cmd; /* last write command issued */ - - UINT8 m_buffer[6144]; /* I/O buffer (holds up to a whole track) */ - UINT32 m_data_offset; /* offset into I/O buffer */ - INT32 m_data_count; /* transfer count from/into I/O buffer */ - - UINT32 m_sector_length; /* sector length (byte) */ - - /* this is the drive currently selected */ - legacy_floppy_image_device *m_drive; - - void read_sector(); - void write_sector(); -}; - -extern const device_type MICROPOLIS; - - -#endif /* __MICROPOLIS_H__ */ diff --git a/src/mess/machine/microtan.c b/src/mess/machine/microtan.c deleted file mode 100644 index 4fca3fe18ca..00000000000 --- a/src/mess/machine/microtan.c +++ /dev/null @@ -1,855 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/****************************************************************************** - * Microtan 65 - * - * machine driver - * - * Juergen Buchmueller , Jul 2000 - * - * Thanks go to Geoff Macdonald - * for his site http:://www.geo255.redhotant.com - * and to Fabrice Frances - * for his site http://www.ifrance.com/oric/microtan.html - * - *****************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "includes/microtan.h" - -/* Components */ -#include "cpu/m6502/m6502.h" -#include "machine/6522via.h" -#include "machine/mos6551.h" -#include "sound/ay8910.h" - -/* Devices */ -#include "imagedev/cassette.h" -//#include "imagedev/snapquik.h" - - -#ifndef VERBOSE -#define VERBOSE 0 -#endif - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - - - - -static const char keyboard[8][9][8] = { - { /* normal */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0','-','=','`',127, 9}, - {'q','w','e','r','t','y','u','i'}, - {'o','p','[',']', 13,127, 0, 0}, - {'a','s','d','f','g','h','j','k'}, - {'l',';', 39, 92, 0,'z','x','c'}, - {'v','b','n','m',',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Shift */ - { 27,'!','@','#','$','%','^','&'}, - {'*','(',')','_','+','~',127, 9}, - {'Q','W','E','R','T','Y','U','I'}, - {'O','P','{','}', 13,127, 0, 0}, - {'A','S','D','F','G','H','J','K'}, - {'L',':','"','|', 0,'Z','X','C'}, - {'V','B','N','M','<','>','?', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Control */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0','-','=','`',127, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,';', 39, 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Shift+Control */ - { 27,'!', 0,'#','$','%', 30,'&'}, - {'*','(',')', 31,'+','~',127, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,':','"', 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* CapsLock */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0','-','=','`',127, 9}, - {'Q','W','E','R','T','Y','U','I'}, - {'O','P','[',']', 13,127, 0, 0}, - {'A','S','D','F','G','H','J','K'}, - {'L',';', 39, 92, 0,'Z','X','C'}, - {'V','B','N','M',',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Shift+CapsLock */ - { 27,'!','@','#','$','%','^','&'}, - {'*','(',')','_','+','~',127, 9}, - {'Q','W','E','R','T','Y','U','I'}, - {'O','P','{','}', 13,127, 0, 0}, - {'A','S','D','F','G','H','J','K'}, - {'L',':','"','|', 0,'Z','X','C'}, - {'V','B','N','M','<','>','?', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Control+CapsLock */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0','-','=','`',127, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,';', 39, 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Shift+Control+CapsLock */ - { 27,'!', 0,'#','$','%', 30,'&'}, - {'*','(',')', 31,'+','~',127, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,':','"', 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, -}; - -UINT8 microtan_state::read_dsw() -{ - UINT8 result; - switch(machine().phase()) - { - case MACHINE_PHASE_RESET: - case MACHINE_PHASE_RUNNING: - result = ioport("DSW")->read(); - break; - - default: - result = 0x00; - break; - } - return result; -} - -void microtan_state::microtan_set_irq_line() -{ - /* The 6502 IRQ line is active low and probably driven - by open collector outputs (guess). Since MAME/MESS use - a non-0 value for ASSERT_LINE we OR the signals here */ - m_maincpu->set_input_line(0, m_via_0_irq_line | m_via_1_irq_line | m_kbd_irq_line); -} - -/************************************************************** - * VIA callback functions for VIA #0 - **************************************************************/ -READ8_MEMBER(microtan_state::via_0_in_a) -{ - int data = ioport("JOY")->read(); - LOG(("microtan_via_0_in_a %02X\n", data)); - return data; -} - -WRITE8_MEMBER(microtan_state::via_0_out_a) -{ - LOG(("microtan_via_0_out_a %02X\n", data)); -} - -WRITE8_MEMBER(microtan_state::via_0_out_b) -{ - LOG(("microtan_via_0_out_b %02X\n", data)); - /* bit #7 is the cassette output signal */ - m_cassette->output(data & 0x80 ? +1.0 : -1.0); -} - -WRITE_LINE_MEMBER(microtan_state::via_0_out_ca2) -{ - LOG(("microtan_via_0_out_ca2 %d\n", state)); -} - -WRITE_LINE_MEMBER(microtan_state::via_0_out_cb2) -{ - LOG(("microtan_via_0_out_cb2 %d\n", state)); -} - -WRITE_LINE_MEMBER(microtan_state::via_0_irq) -{ - LOG(("microtan_via_0_irq %d\n", state)); - m_via_0_irq_line = state; - microtan_set_irq_line(); -} - -/************************************************************** - * VIA callback functions for VIA #1 - **************************************************************/ - -WRITE8_MEMBER(microtan_state::via_1_out_a) -{ - LOG(("microtan_via_1_out_a %02X\n", data)); -} - -WRITE8_MEMBER(microtan_state::via_1_out_b) -{ - LOG(("microtan_via_1_out_b %02X\n", data)); -} - -WRITE_LINE_MEMBER(microtan_state::via_1_out_ca2) -{ - LOG(("microtan_via_1_out_ca2 %d\n", state)); -} - -WRITE_LINE_MEMBER(microtan_state::via_1_out_cb2) -{ - LOG(("microtan_via_1_out_cb2 %d\n", state)); -} - -WRITE_LINE_MEMBER(microtan_state::via_1_irq) -{ - LOG(("microtan_via_1_irq %d\n", state)); - m_via_1_irq_line = state; - microtan_set_irq_line(); -} - -void microtan_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_READ_CASSETTE: - microtan_read_cassette(ptr, param); - break; - case TIMER_PULSE_NMI: - microtan_pulse_nmi(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in microtan_state::device_timer"); - } -} - - -TIMER_CALLBACK_MEMBER(microtan_state::microtan_read_cassette) -{ - double level = m_cassette->input(); - - LOG(("microtan_read_cassette: %g\n", level)); - if (level < -0.07) - m_via6522_0->write_cb2(0); - else if (level > +0.07) - m_via6522_0->write_cb2(1); -} - -READ8_MEMBER(microtan_state::microtan_sound_r) -{ - int data = 0xff; - LOG(("microtan_sound_r: -> %02x\n", data)); - return data; -} - -WRITE8_MEMBER(microtan_state::microtan_sound_w) -{ - LOG(("microtan_sound_w: <- %02x\n", data)); -} - - -READ8_MEMBER(microtan_state::microtan_bffx_r) -{ - int data = 0xff; - switch( offset & 3 ) - { - case 0: /* BFF0: read enables chunky graphics */ - m_chunky_graphics = 1; - LOG(("microtan_bff0_r: -> %02x (chunky graphics on)\n", data)); - break; - case 1: /* BFF1: read undefined (?) */ - LOG(("microtan_bff1_r: -> %02x\n", data)); - break; - case 2: /* BFF2: read undefined (?) */ - LOG(("microtan_bff2_r: -> %02x\n", data)); - break; - default: /* BFF3: read keyboard ASCII value */ - data = m_keyboard_ascii; - LOG(("microtan_bff3_r: -> %02x (keyboard ASCII)\n", data)); - } - return data; -} - - -/* This callback is called one clock cycle after BFF2 is written (delayed nmi) */ -TIMER_CALLBACK_MEMBER(microtan_state::microtan_pulse_nmi) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -WRITE8_MEMBER(microtan_state::microtan_bffx_w) -{ - switch( offset & 3 ) - { - case 0: /* BFF0: write reset keyboard interrupt flag */ - /* This removes bit 7 from the ASCII value of the last key pressed. */ - LOG(("microtan_bff0_w: %d <- %02x (keyboard IRQ clear )\n", offset, data)); - m_keyboard_ascii &= ~0x80; - m_kbd_irq_line = CLEAR_LINE; - microtan_set_irq_line(); - break; - case 1: /* BFF1: write delayed NMI */ - LOG(("microtan_bff1_w: %d <- %02x (delayed NMI)\n", offset, data)); - timer_set(m_maincpu->cycles_to_attotime(8), TIMER_PULSE_NMI); - break; - case 2: /* BFF2: write keypad column write (what is this meant for?) */ - LOG(("microtan_bff2_w: %d <- %02x (keypad column)\n", offset, data)); - m_keypad_column = data; - break; - default: /* BFF3: write disable chunky graphics */ - LOG(("microtan_bff3_w: %d <- %02x (chunky graphics off)\n", offset, data)); - m_chunky_graphics = 0; - } -} - -void microtan_state::store_key(int key) -{ - LOG(("microtan: store key '%c'\n", key)); - m_keyboard_ascii = key | 0x80; - m_kbd_irq_line = ASSERT_LINE; - microtan_set_irq_line(); -} - -INTERRUPT_GEN_MEMBER(microtan_state::microtan_interrupt) -{ - int mod, row, col, chg, newvar; - static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" }; - - if( m_repeat ) - { - if( !--m_repeat ) - m_repeater = 4; - } - else if( m_repeater ) - { - m_repeat = m_repeater; - } - - - row = 9; - newvar = ioport("ROW8")->read(); - chg = m_keyrows[--row] ^ newvar; - - while ( !chg && row > 0) - { - newvar = ioport(keynames[row - 1])->read(); - chg = m_keyrows[--row] ^ newvar; - } - if (!chg) - --row; - - if (row >= 0) - { - m_repeater = 0x00; - m_mask = 0x00; - m_key = 0x00; - m_lastrow = row; - /* CapsLock LED */ - if( row == 3 && chg == 0x80 ) - set_led_status(machine(), 1, (m_keyrows[3] & 0x80) ? 0 : 1); - - if (newvar & chg) /* key(s) pressed ? */ - { - mod = 0; - - /* Shift modifier */ - if ( (m_keyrows[5] & 0x10) || (m_keyrows[6] & 0x80) ) - mod |= 1; - - /* Control modifier */ - if (m_keyrows[3] & 0x40) - mod |= 2; - - /* CapsLock modifier */ - if (m_keyrows[3] & 0x80) - mod |= 4; - - /* find newvar key */ - m_mask = 0x01; - for (col = 0; col < 8; col ++) - { - if (chg & m_mask) - { - newvar &= m_mask; - m_key = keyboard[mod][row][col]; - break; - } - m_mask <<= 1; - } - if( m_key ) /* normal key */ - { - m_repeater = 30; - store_key(m_key); - } - else - if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */ - store_key(0); - m_keyrows[row] |= newvar; - } - else - { - m_keyrows[row] = newvar; - } - m_repeat = m_repeater; - } - else - if ( m_key && (m_keyrows[m_lastrow] & m_mask) && m_repeat == 0 ) - { - store_key(m_key); - } -} - -DRIVER_INIT_MEMBER(microtan_state,microtan) -{ - UINT8 *dst = memregion("gfx2")->base(); - int i; - address_space &space = m_maincpu->space(AS_PROGRAM); - - for (i = 0; i < 256; i++) - { - switch (i & 3) - { - case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; - case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; - case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; - case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; - } - dst += 4; - switch ((i >> 2) & 3) - { - case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; - case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; - case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; - case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; - } - dst += 4; - switch ((i >> 4) & 3) - { - case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; - case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; - case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; - case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; - } - dst += 4; - switch ((i >> 6) & 3) - { - case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; - case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; - case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; - case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; - } - dst += 4; - } - - switch (read_dsw() & 3) - { - case 0: // 1K only :) - space.nop_readwrite(0x0400, 0xbbff); - break; - case 1: // +7K TANEX - space.install_ram(0x0400, 0x1fff,NULL); - space.nop_readwrite(0x2000, 0xbbff); - break; - default: // +7K TANEX + 40K TANRAM - space.install_ram(0x0400, 0xbbff, NULL); - break; - } - - m_timer = timer_alloc(TIMER_READ_CASSETTE); - - m_via6522_0->write_ca1(1); - m_via6522_0->write_ca2(1); - - m_via6522_0->write_pb0(1); - m_via6522_0->write_pb1(1); - m_via6522_0->write_pb2(1); - m_via6522_0->write_pb3(1); - m_via6522_0->write_pb4(1); - m_via6522_0->write_pb5(1); - m_via6522_0->write_pb6(1); - m_via6522_0->write_pb7(1); - m_via6522_0->write_cb1(1); - m_via6522_0->write_cb2(1); - - m_via6522_1->write_pa0(1); - m_via6522_1->write_pa1(1); - m_via6522_1->write_pa2(1); - m_via6522_1->write_pa3(1); - m_via6522_1->write_pa4(1); - m_via6522_1->write_pa5(1); - m_via6522_1->write_pa6(1); - m_via6522_1->write_pa7(1); - m_via6522_1->write_ca1(1); - m_via6522_1->write_ca2(1); - - m_via6522_1->write_pb0(1); - m_via6522_1->write_pb1(1); - m_via6522_1->write_pb2(1); - m_via6522_1->write_pb3(1); - m_via6522_1->write_pb4(1); - m_via6522_1->write_pb5(1); - m_via6522_1->write_pb6(1); - m_via6522_1->write_pb7(1); - m_via6522_1->write_cb1(1); - m_via6522_1->write_cb2(1); -} - -void microtan_state::machine_reset() -{ - int i; - static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" }; - - for (i = 1; i < 10; i++) - { - m_keyrows[i] = ioport(keynames[i-1])->read(); - } - set_led_status(machine(), 1, (m_keyrows[3] & 0x80) ? 0 : 1); -} - -int microtan_state::microtan_verify_snapshot(UINT8 *data, int size) -{ - if (size == 8263) - { - logerror("microtan_snapshot_id: magic size %d found\n", size); - return IMAGE_VERIFY_PASS; - } - else - { - if (4 + data[2] + 256 * data[3] + 1 + 16 + 16 + 16 + 1 + 1 + 16 + 16 + 64 + 7 == size) - { - logerror("microtan_snapshot_id: header RAM size + structures matches filesize %d\n", size); - return IMAGE_VERIFY_PASS; - } - } - - return IMAGE_VERIFY_FAIL; -} - -int microtan_state::parse_intel_hex(UINT8 *snapshot_buff, char *src) -{ - char line[128]; - int /*row = 0,*/ column = 0, last_addr = 0, last_size = 0; - - while (*src) - { - if (*src == '\r' || *src == '\n') - { - if (column) - { - unsigned int size, addr, null, b[32], cs, n; - - line[column] = '\0'; - /*row++;*/ - n = sscanf(line, ":%02x%04x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - &size, &addr, &null, - &b[ 0], &b[ 1], &b[ 2], &b[ 3], &b[ 4], &b[ 5], &b[ 6], &b[ 7], - &b[ 8], &b[ 9], &b[10], &b[11], &b[12], &b[13], &b[14], &b[15], - &b[16], &b[17], &b[18], &b[19], &b[20], &b[21], &b[22], &b[23], - &b[24], &b[25], &b[26], &b[27], &b[28], &b[29], &b[30], &b[31], - &cs); - if (n == 0) - { - logerror("parse_intel_hex: malformed line [%s]\n", line); - } - else if (n == 1) - { - logerror("parse_intel_hex: only size found [%s]\n", line); - } - else if (n == 2) - { - logerror("parse_intel_hex: only size and addr found [%s]\n", line); - } - else if (n == 3) - { - logerror("parse_intel_hex: only size, addr and null found [%s]\n", line); - } - else - if (null != 0) - { - logerror("parse_intel_hex: warning null byte is != 0 [%s]\n", line); - } - else - { - int i, sum; - - n -= 3; - - sum = size + (addr & 0xff) + ((addr >> 8) & 0xff); - if (n != 32 + 1) - cs = b[n-1]; - - last_addr = addr; - last_size = n-1; - logerror("parse_intel_hex: %04X", addr); - for (i = 0; i < n-1; i++) - { - sum += b[i]; - snapshot_buff[addr++] = b[i]; - } - logerror("-%04X checksum %02X+%02X = %02X\n", addr-1, cs, sum & 0xff, (cs + sum) & 0xff); - } - } - column = 0; - } - else - { - line[column++] = *src; - } - src++; - } - /* register preset? */ - if (last_size == 7) - { - logerror("parse_intel_hex: registers (?) at %04X\n", last_addr); - memcpy(&snapshot_buff[8192+64], &snapshot_buff[last_addr], last_size); - } - return IMAGE_INIT_PASS; -} - -int microtan_state::parse_zillion_hex(UINT8 *snapshot_buff, char *src) -{ - char line[128]; - int parsing = 0, /*row = 0,*/ column = 0; - - while (*src) - { - if (parsing) - { - if (*src == '}') - parsing = 0; - else - { - if (*src == '\r' || *src == '\n') - { - if (column) - { - unsigned int addr, b[8], n; - - line[column] = '\0'; - /*row++;*/ - n = sscanf(line, "%x %x %x %x %x %x %x %x %x", &addr, &b[0], &b[1], &b[2], &b[3], &b[4], &b[5], &b[6], &b[7]); - if (n == 0) - { - logerror("parse_zillion_hex: malformed line [%s]\n", line); - } - else if (n == 1) - { - logerror("parse_zillion_hex: only addr found [%s]\n", line); - } - else - { - int i; - - logerror("parse_zillion_hex: %04X", addr); - for (i = 0; i < n-1; i++) - snapshot_buff[addr++] = b[i]; - logerror("-%04X\n", addr-1); - } - } - column = 0; - } - else - { - line[column++] = *src; - } - } - } - else - { - if (*src == '\r' || *src == '\n') - { - if (column) - { - int addr, n; - - /*row++;*/ - line[column] = '\0'; - n = sscanf(line, "G%x", (unsigned int *) &addr); - if (n == 1 && !snapshot_buff[8192+64+0] && !snapshot_buff[8192+64+1]) - { - logerror("microtan_hexfile_init: go addr %04X\n", addr); - snapshot_buff[8192+64+0] = addr & 0xff; - snapshot_buff[8192+64+1] = (addr >> 8) & 0xff; - } - } - column = 0; - } - else - { - line[column++] = *src; - } - if (*src == '{') - { - parsing = 1; - column = 0; - } - } - src++; - } - return IMAGE_INIT_PASS; -} - -void microtan_state::microtan_set_cpu_regs(const UINT8 *snapshot_buff, int base) -{ - logerror("microtan_snapshot_copy: PC:%02X%02X P:%02X A:%02X X:%02X Y:%02X SP:1%02X", - snapshot_buff[base+1], snapshot_buff[base+0], snapshot_buff[base+2], snapshot_buff[base+3], - snapshot_buff[base+4], snapshot_buff[base+5], snapshot_buff[base+6]); - m_maincpu->set_state_int(M6502_PC, snapshot_buff[base+0] + 256 * snapshot_buff[base+1]); - m_maincpu->set_state_int(M6502_P, snapshot_buff[base+2]); - m_maincpu->set_state_int(M6502_A, snapshot_buff[base+3]); - m_maincpu->set_state_int(M6502_X, snapshot_buff[base+4]); - m_maincpu->set_state_int(M6502_Y, snapshot_buff[base+5]); - m_maincpu->set_state_int(M6502_S, snapshot_buff[base+6]); -} - -void microtan_state::microtan_snapshot_copy(UINT8 *snapshot_buff, int snapshot_size) -{ - UINT8 *RAM = memregion("maincpu")->base(); - address_space &space = m_maincpu->space(AS_PROGRAM); - ay8910_device *ay8910 = machine().device("ay8910.1"); - - /* check for .DMP file format */ - if (snapshot_size == 8263) - { - int i, base; - /********** DMP format - * Lower 8k of RAM (0000 to 1fff) - * 64 bytes of chunky graphics bits (first byte bit is for character at 0200, bit 1=0201, etc) - * 7 bytes of CPU registers (PCL, PCH, PSW, A, IX, IY, SP) - */ - logerror("microtan_snapshot_copy: magic size %d found, assuming *.DMP format\n", snapshot_size); - - base = 0; - /* 8K of RAM from 0000 to 1fff */ - memcpy(RAM, &snapshot_buff[base], 8192); - base += 8192; - /* 64 bytes of chunky graphics info */ - for (i = 0; i < 32*16; i++) - { - m_chunky_buffer[i] = (snapshot_buff[base+i/8] >> (i&7)) & 1; - } - base += 64; - microtan_set_cpu_regs(snapshot_buff, base); - } - else - { - int i, ramend, base; - /********** M65 format ************************************ - * 2 bytes: File version - * 2 bytes: RAM size - * n bytes: RAM (0000 to RAM Size) - * 16 bytes: 1st 6522 (0xbfc0 to 0xbfcf) - * 16 bytes: 2ns 6522 (0xbfe0 to 0xbfef) - * 16 bytes: Microtan IO (0xbff0 to 0xbfff) - * 1 byte : Invaders sound (0xbc04) - * 1 byte : Chunky graphics state (0=off, 1=on) - * 16 bytes: 1st AY8910 registers - * 16 bytes: 2nd AY8910 registers - * 64 bytes: Chunky graphics bits (first byte bit 0 is for character at 0200, bit 1=0201, etc) - * 7 bytes: CPU registers (PCL, PCH, PSW, A, IX, IY, SP) - */ - ramend = snapshot_buff[2] + 256 * snapshot_buff[3]; - if (2 + 2 + ramend + 1 + 16 + 16 + 16 + 1 + 1 + 16 + 16 + 64 + 7 != snapshot_size) - { - logerror("microtan_snapshot_copy: size %d doesn't match RAM size %d + structure size\n", snapshot_size, ramend+1); - return; - } - - logerror("microtan_snapshot_copy: size %d found, assuming *.M65 format\n", snapshot_size); - base = 4; - memcpy(RAM, &snapshot_buff[base], snapshot_buff[2] + 256 * snapshot_buff[3] + 1); - base += ramend + 1; - - /* first set of VIA6522 registers */ - for (i = 0; i < 16; i++ ) - m_via6522_0->write(space, i, snapshot_buff[base++]); - - /* second set of VIA6522 registers */ - for (i = 0; i < 16; i++ ) - m_via6522_1->write(space, i, snapshot_buff[base++]); - - /* microtan IO bff0-bfff */ - for (i = 0; i < 16; i++ ) - { - RAM[0xbff0+i] = snapshot_buff[base++]; - if (i < 4) - microtan_bffx_w(space, i, RAM[0xbff0+i]); - } - - microtan_sound_w(space, 0, snapshot_buff[base++]); - m_chunky_graphics = snapshot_buff[base++]; - - /* first set of AY8910 registers */ - for (i = 0; i < 16; i++ ) - { - ay8910->address_w(generic_space(), 0, i); - ay8910->data_w(generic_space(), 0, snapshot_buff[base++]); - } - - /* second set of AY8910 registers */ - for (i = 0; i < 16; i++ ) - { - ay8910->address_w(generic_space(), 0, i); - ay8910->data_w(generic_space(), 0, snapshot_buff[base++]); - } - - for (i = 0; i < 32*16; i++) - { - m_chunky_buffer[i] = (snapshot_buff[base+i/8] >> (i&7)) & 1; - } - base += 64; - - microtan_set_cpu_regs(snapshot_buff, base); - } -} - -SNAPSHOT_LOAD_MEMBER( microtan_state, microtan ) -{ - UINT8 *snapshot_buff; - - snapshot_buff = (UINT8*)image.ptr(); - if (!snapshot_buff) - return IMAGE_INIT_FAIL; - - if (microtan_verify_snapshot(snapshot_buff, snapshot_size)==IMAGE_VERIFY_FAIL) - return IMAGE_INIT_FAIL; - - microtan_snapshot_copy(snapshot_buff, snapshot_size); - return IMAGE_INIT_PASS; -} - -QUICKLOAD_LOAD_MEMBER( microtan_state, microtan ) -{ - int snapshot_size = 8263; /* magic size */ - dynamic_buffer snapshot_buff(snapshot_size, 0); - std::vector buff(quickload_size + 1); - int rc; - - image.fread(&buff[0], quickload_size); - - buff[quickload_size] = '\0'; - - if (buff[0] == ':') - rc = parse_intel_hex(&snapshot_buff[0], &buff[0]); - else - rc = parse_zillion_hex(&snapshot_buff[0], &buff[0]); - if (rc == IMAGE_INIT_PASS) - microtan_snapshot_copy(&snapshot_buff[0], snapshot_size); - return rc; -} diff --git a/src/mess/machine/mikro80.c b/src/mess/machine/mikro80.c deleted file mode 100644 index 30eea2124bf..00000000000 --- a/src/mess/machine/mikro80.c +++ /dev/null @@ -1,105 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Mikro-80 machine driver by Miodrag Milanovic - - 10/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "includes/mikro80.h" - -/* Driver initialization */ -DRIVER_INIT_MEMBER(mikro80_state,mikro80) -{ - /* set initialy ROM to be visible on first bank */ - UINT8 *RAM = m_region_maincpu->base(); - memset(RAM,0x0000,0x0800); // make frist page empty by default - m_bank1->configure_entries(1, 2, RAM, 0x0000); - m_bank1->configure_entries(0, 2, RAM, 0xf800); - m_key_mask = 0x7f; -} - -DRIVER_INIT_MEMBER(mikro80_state,radio99) -{ - DRIVER_INIT_CALL(mikro80); - m_key_mask = 0xff; -} - -READ8_MEMBER(mikro80_state::mikro80_8255_portb_r) -{ - UINT8 key = 0xff; - if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_line0->read(); } - if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_line1->read(); } - if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_line2->read(); } - if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_line3->read(); } - if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_line4->read(); } - if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_line5->read(); } - if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_line6->read(); } - if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_line7->read(); } - return key & m_key_mask; -} - -READ8_MEMBER(mikro80_state::mikro80_8255_portc_r) -{ - return m_io_line8->read(); -} - -WRITE8_MEMBER(mikro80_state::mikro80_8255_porta_w) -{ - m_keyboard_mask = data ^ 0xff; -} - -WRITE8_MEMBER(mikro80_state::mikro80_8255_portc_w) -{ -} - -void mikro80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_RESET: - m_bank1->set_entry(0); - break; - default: - assert_always(FALSE, "Unknown id in mikro80_state::device_timer"); - } -} - -void mikro80_state::machine_reset() -{ - timer_set(attotime::from_usec(10), TIMER_RESET); - m_bank1->set_entry(1); - m_keyboard_mask = 0; -} - - -READ8_MEMBER(mikro80_state::mikro80_keyboard_r) -{ - return m_ppi8255->read(space, offset^0x03); -} - -WRITE8_MEMBER(mikro80_state::mikro80_keyboard_w) -{ - m_ppi8255->write(space, offset^0x03, data); -} - - -WRITE8_MEMBER(mikro80_state::mikro80_tape_w) -{ - m_cassette->output(data & 0x01 ? 1 : -1); -} - - -READ8_MEMBER(mikro80_state::mikro80_tape_r) -{ - double level = m_cassette->input(); - if (level < 0) { - return 0x00; - } - return 0xff; -} diff --git a/src/mess/machine/mm1kb.c b/src/mess/machine/mm1kb.c deleted file mode 100644 index 3b74ca8650d..00000000000 --- a/src/mess/machine/mm1kb.c +++ /dev/null @@ -1,298 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Nokia MikroMikko 1 keyboard emulation - -*********************************************************************/ - -#include "mm1kb.h" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type MM1_KEYBOARD = &device_creator; - - -//------------------------------------------------- -// ROM( mm1_keyboard ) -//------------------------------------------------- - -ROM_START( mm1_keyboard ) - ROM_REGION( 0x200, "keyboard", 0 ) - ROM_LOAD( "mmi6349-1j.bin", 0x0000, 0x0200, CRC(4ab3bf03) SHA1(925c9ee22db13566416cdbc505c03d4116ff8d5f) ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *mm1_keyboard_t::device_rom_region() const -{ - return ROM_NAME( mm1_keyboard ); -} - - -//------------------------------------------------- -// MACHINE_DRIVER( mm1_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( mm1_keyboard ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor mm1_keyboard_t::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( mm1_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( mm1_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( mm1_keyboard ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC2\xB4 '") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00B4) PORT_CHAR('`') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x96") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_RING " " A_RING) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00E5) PORT_CHAR(0x00C5) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('~') PORT_CHAR('^') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LF") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') PORT_CHAR('*') - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(a_UMLAUT " " A_UMLAUT) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00E4) PORT_CHAR(0x00C4) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(o_UMLAUT " " O_UMLAUT) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00F6) PORT_CHAR(0x00D6) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("SPECIAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor mm1_keyboard_t::device_input_ports() const -{ - return INPUT_PORTS_NAME( mm1_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// mm1_keyboard_t - constructor -//------------------------------------------------- - -mm1_keyboard_t::mm1_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, MM1_KEYBOARD, "MikroMikko 1 keyboard", tag, owner, clock, "mm1kb", __FILE__), - m_write_kbst(*this), - m_speaker(*this, "speaker"), - m_rom(*this, "keyboard"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_special(*this, "SPECIAL"), - m_sense(0), - m_drive(0), - m_data(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void mm1_keyboard_t::device_start() -{ - // resolve callbacks - m_write_kbst.resolve_safe(); - - // allocate timers - m_scan_timer = timer_alloc(); - m_scan_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); - - // state saving - save_item(NAME(m_sense)); - save_item(NAME(m_drive)); - save_item(NAME(m_data)); -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void mm1_keyboard_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - UINT8 data = 0xff; - - switch (m_drive) - { - case 0: data = m_y0->read(); break; - case 1: data = m_y1->read(); break; - case 2: data = m_y2->read(); break; - case 3: data = m_y3->read(); break; - case 4: data = m_y4->read(); break; - case 5: data = m_y5->read(); break; - case 6: data = m_y6->read(); break; - case 7: data = m_y7->read(); break; - case 8: data = m_y8->read(); break; - case 9: data = m_y9->read(); break; - } - - UINT8 special = m_special->read(); - int ctrl = BIT(special, 0); - int shift = BIT(special, 2) & BIT(special, 1); - UINT8 keydata = 0xff; - - if (!BIT(data, m_sense)) - { - // get key data from PROM - keydata = m_rom->base()[(ctrl << 8) | (shift << 7) | (m_drive << 3) | (m_sense)]; - } - - if (m_data != keydata) - { - // latch key data - m_data = keydata; - - if (keydata != 0xff) - { - // strobe in key data - m_write_kbst(1); - m_write_kbst(0); - } - } - - if (keydata == 0xff) - { - // increase scan counters - m_sense++; - - if (m_sense == 8) - { - m_sense = 0; - m_drive++; - - if (m_drive == 10) - { - m_drive = 0; - } - } - } -} diff --git a/src/mess/machine/mm1kb.h b/src/mess/machine/mm1kb.h deleted file mode 100644 index 00e8ddebf73..00000000000 --- a/src/mess/machine/mm1kb.h +++ /dev/null @@ -1,86 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Nokia MikroMikko 1 keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __MM1_KEYBOARD__ -#define __MM1_KEYBOARD__ - -#include "emu.h" -#include "sound/speaker.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_MM1_KEYBOARD_KBST_CALLBACK(_write) \ - devcb = &mm1_keyboard_t::set_kbst_wr_callback(*device, DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> mm1_keyboard_t - -class mm1_keyboard_t : public device_t -{ -public: - // construction/destruction - mm1_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_kbst_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_kbst.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_READ8_MEMBER( read ) { return m_data; } - - DECLARE_WRITE_LINE_MEMBER( bell_w ) { m_speaker->level_w(state); } - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - devcb_write_line m_write_kbst; - - required_device m_speaker; - required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_special; - - int m_sense; - int m_drive; - UINT8 m_data; - - emu_timer *m_scan_timer; -}; - - -// device type definition -extern const device_type MM1_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/ms7004.c b/src/mess/machine/ms7004.c deleted file mode 100644 index bacd74a303a..00000000000 --- a/src/mess/machine/ms7004.c +++ /dev/null @@ -1,500 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/* - Electronika MS 7004 keyboard (DEC LK-201 workalike with extra keys - for Cyrillic characters). - - To do: - - debug keymap - - receive data from host (not used by KSM but used by other boards) - - connect LEDs and speaker -*/ - -#include "emu.h" -#include "ms7004.h" - -#define VERBOSE_DBG 1 /* general debug messages */ - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \ - logerror A; \ - } \ - } while (0) - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define MS7004_CPU_TAG "i8048" -#define MS7004_SPK_TAG "beeper" - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type MS7004 = &device_creator; - -ROM_START( ms7004 ) - ROM_REGION (0x800, MS7004_CPU_TAG, 0) - ROM_LOAD ("mc7004_keyboard_original.rom", 0x0000, 0x800, CRC(69fcab53) SHA1(2d7cc7cd182f2ee09ecf2c539e33db3c2195f778)) -ROM_END - -//------------------------------------------------- -// ADDRESS_MAP -//------------------------------------------------- - -static ADDRESS_MAP_START( ms7004_map, AS_IO, 8, ms7004_device ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r) - AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE("i8243", i8243_device, i8243_prog_w) -ADDRESS_MAP_END - -//------------------------------------------------- -// MACHINE_CONFIG -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( ms7004 ) - MCFG_CPU_ADD(MS7004_CPU_TAG, I8048, XTAL_4_608MHz) - MCFG_CPU_IO_MAP(ms7004_map) - - MCFG_I8243_ADD("i8243", NOOP, WRITE8(ms7004_device, i8243_port_w)) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MS7004_SPK_TAG, BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor ms7004_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( ms7004 ); -} - -const rom_entry *ms7004_device::device_rom_region() const -{ - return ROM_NAME( ms7004 ); -} - -//------------------------------------------------- -// INPUT_PORTS( ms7004 ) -//------------------------------------------------- -/* -bit sig XSn ????n ---- --- --- --- -0 8 16 15 -1 9 15 14 -2 10 14 13 -3 11 13 12 -4 12 19 16 -5 13 12 11 -6 14 11 10 -7 15 10 9 -8 16 9 8 -9 17 8 7 -10 18 7 6 -11 19 6 5 -12 20 3 1 -13 21 1 2 -14 22 4 3 -15 23 5 4 - -0xc9 KEY_LANGLE_RANGLE '?????????????????? ??????????????' -0xbc KEY_DELETE ???? -0xbd KEY_RETURN ???? -0xbf KEY_TILDE '; +' -0xc4 - '??' -0xca - '/ ?' -0xed KEY_PERIOD '?? @' -0xf1 - '_' -<...> - -0x56 KEY_F1 ???????? ???????? -0x57 KEY_F2 ???????????? ?????????? -0x58 KEY_F3 ?????????? -0x59 KEY_F4 ?????? ???????????? -0x5a KEY_F5 ??5 - -0x64 KEY_F6 ???????????? -0x65 KEY_F7 ?????????????? -0x66 KEY_F8 ?????????? -0x67 KEY_F9 ???????????? ???????? -0x69 KEY_F10 ?????????? - -0x71 KEY_F11 ??11 (????2) -0x72 KEY_F12 ??12 (????) -0x73 KEY_F13 ??13 (????) -0x74 KEY_F14 ?????? ?????????????? - -0x7c KEY_HELP ???? -0x7d KEY_MENU ?????? - -0x80 KEY_F17 ??17 -0x81 KEY_F18 ??18 -0x82 KEY_F19 ??19 -0x83 KEY_F20 ??20 - -0xb0 KEY_LOCK ?????? -0xae KEY_SHIFT ???? -0xaf KEY_CTRL ???? - -0xb1 KEY_META ?????? -0xb2 - ??????/?????? - -0x8a KEY_FIND ???? -0x8b KEY_INSERT_HERE ?????? -0x8c KEY_REMOVE ???????? -0x8d KEY_SELECT ???????? -0x8e KEY_PREV_SCREEN ???????? ???????? -0x8f KEY_NEXT_SCREEN ???????? ???????? - -nothing sends '@' or '`' - -`/~ sends ^/~ -2/@ sends 2/" -6/^ sends 6/& -7/& sends 7/' -8/ * sends 8/( -9/( sends 9/) -0/) sends 0/0 --/_ sends _/_ -+/= sends -/= -;/: sends ;/+ -'/" sends :/ * - -F10 sends ^C -F11 sends ESC -F12 sends ^H -*/ -INPUT_PORTS_START( ms7004 ) - PORT_START("KBD12") // vertical row 1 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Print Screen (F2)") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Hold Screen (F1)") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // '{' / '|' - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) // '+' - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) // what - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) - - PORT_START("KBD13") // vertical row 2 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Setup (F3)") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Data / Talk (F4)") PORT_CODE(KEYCODE_F4) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_ESC) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Compose") PORT_CODE(KEYCODE_LALT) - - PORT_START("KBD14") // vertical row 3 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break (F5)") PORT_CODE(KEYCODE_F5) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tilde") PORT_CODE(KEYCODE_TILDE) // ^ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD15") // vertical row 4 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD11") // vertical row 5 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Interrupt (F6)") PORT_CODE(KEYCODE_F6) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("KBD10") // vertical row 6 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Resume (F7)") PORT_CODE(KEYCODE_F7) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - - PORT_START("KBD9") // vertical row 7 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cancel (F8)") PORT_CODE(KEYCODE_F8) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Main Screen (F9)") PORT_CODE(KEYCODE_F9) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) - - PORT_START("KBD8") // vertical row 8 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Exit (F10)") PORT_CODE(KEYCODE_F10) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) // '@' - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - - PORT_START("KBD7") // vertical row 9 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC (F11)") PORT_CODE(KEYCODE_F11) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - - PORT_START("KBD6") // vertical row 10 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS (F12)") PORT_CODE(KEYCODE_F12) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LF (F13)") PORT_CODE(KEYCODE_PRTSCR) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // '}' - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) // ':' - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) // '??' - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - - PORT_START("KBD5") // vertical row 11 - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Additional Options (F14)") PORT_CODE(KEYCODE_PAUSE) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete i8243_p2_w(space, offset, data); -} - - -//------------------------------------------------- -// prog_w - -//------------------------------------------------- - -WRITE8_MEMBER( ms7004_device::i8243_port_w ) -{ - int sense = 0; - - DBG_LOG(2,0,( "%s: 8243 port %d data %02xH\n", - tag(), offset + 4, data)); - - if (data) { - switch(offset << 4 | data) { - case 0x01: sense = m_kbd0->read(); break; - case 0x02: sense = m_kbd1->read(); break; - case 0x04: sense = m_kbd2->read(); break; - case 0x08: sense = m_kbd3->read(); break; - case 0x11: sense = m_kbd4->read(); break; - case 0x12: sense = m_kbd5->read(); break; - case 0x14: sense = m_kbd6->read(); break; - case 0x18: sense = m_kbd7->read(); break; - case 0x21: sense = m_kbd8->read(); break; - case 0x22: sense = m_kbd9->read(); break; - case 0x24: sense = m_kbd10->read(); break; - case 0x28: sense = m_kbd11->read(); break; - case 0x31: sense = m_kbd12->read(); break; - case 0x32: sense = m_kbd13->read(); break; - case 0x34: sense = m_kbd14->read(); break; - case 0x38: sense = m_kbd15->read(); break; - } - m_keylatch = BIT(sense, (m_p1 & 7)); - DBG_LOG(2,0,( "%s: row %d col %02x t1 %d\n", - tag(), (m_p1 & 7), (offset << 4 | data), m_keylatch)); - } -} - - -//------------------------------------------------- -// t1_r - -//------------------------------------------------- - -READ8_MEMBER( ms7004_device::t1_r ) -{ - if (!BIT(m_p1,4)) - return m_keylatch; - else - return 0; -} diff --git a/src/mess/machine/ms7004.h b/src/mess/machine/ms7004.h deleted file mode 100644 index bf0dd1a3aee..00000000000 --- a/src/mess/machine/ms7004.h +++ /dev/null @@ -1,85 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -#pragma once - -#ifndef __MS7004_H__ -#define __MS7004_H__ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/i8243.h" -#include "sound/beep.h" - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_MS7004_TX_HANDLER(_cb) \ - devcb = &ms7004_device::set_tx_handler(*device, DEVCB_##_cb); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> ms7004_device - -class ms7004_device : public device_t //, public device_serial_interface -{ -public: - // construction/destruction - ms7004_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_tx_handler(device_t &device, _Object wr) { return downcast(device).m_tx_handler.set_callback(wr); } - - DECLARE_WRITE8_MEMBER( p1_w ); - DECLARE_WRITE8_MEMBER( p2_w ); - DECLARE_READ8_MEMBER( t1_r ); - DECLARE_WRITE8_MEMBER( i8243_port_w ); - -protected: - // device-level overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual const rom_entry *device_rom_region() const; - virtual ioport_constructor device_input_ports() const; - virtual void device_start(); - virtual void device_reset(); - -private: - required_device m_maincpu; - required_device m_speaker; - required_device m_i8243; - - required_ioport m_kbd0; - required_ioport m_kbd1; - required_ioport m_kbd2; - required_ioport m_kbd3; - required_ioport m_kbd4; - required_ioport m_kbd5; - required_ioport m_kbd6; - required_ioport m_kbd7; - required_ioport m_kbd8; - required_ioport m_kbd9; - required_ioport m_kbd10; - required_ioport m_kbd11; - required_ioport m_kbd12; - required_ioport m_kbd13; - required_ioport m_kbd14; - required_ioport m_kbd15; - - int m_keylatch; // keyboard row latch - UINT8 m_p1; - UINT8 m_p2; - - devcb_write_line m_tx_handler; -}; - -// device type definition -extern const device_type MS7004; - -#endif diff --git a/src/mess/machine/msx.c b/src/mess/machine/msx.c deleted file mode 100644 index 92add704ebe..00000000000 --- a/src/mess/machine/msx.c +++ /dev/null @@ -1,531 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/* - * msx.c: MSX emulation - * - * Copyright (C) 2004 Sean Young - * - * Todo: - * - * - fix mouse support - * - cassette support doesn't work - * - Ensure changing cartridge after boot works - * - wd2793, nms8255 - */ - -#include "includes/msx.h" - -#define VERBOSE 0 - - -void msx_state::msx_irq_source(int source, int level) -{ - assert(source >= 0 && source < ARRAY_LENGTH(m_irq_state)); - - m_irq_state[source] = level; - check_irq(); -} - - -void msx_state::check_irq() -{ - int state = CLEAR_LINE; - - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) - { - if (m_irq_state[i] != CLEAR_LINE) - { - state = ASSERT_LINE; - } - } - - m_maincpu->set_input_line(0, state); -} - - -void msx_state::machine_reset() -{ - msx_memory_reset (); - msx_memory_map_all (); - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) - { - m_irq_state[i] = CLEAR_LINE; - } - check_irq(); -} - - -void msx_state::machine_start() -{ - m_port_c_old = 0xff; -} - - -static const UINT8 cc_op[0x100] = { - 4+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, 4+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, - 8+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,12+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, - 7+1,10+1,16+1, 6+1, 4+1, 4+1, 7+1, 4+1, 7+1,11+1,16+1, 6+1, 4+1, 4+1, 7+1, 4+1, - 7+1,10+1,13+1, 6+1,11+1,11+1,10+1, 4+1, 7+1,11+1,13+1, 6+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 7+1, 7+1, 7+1, 7+1, 7+1, 7+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 5+1,10+1,10+1,10+1,10+1,11+1, 7+1,11+1, 5+1,10+1,10+1, 0 ,10+1,17+1, 7+1,11+1, - 5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 0 , 7+1,11+1, - 5+1,10+1,10+1,19+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1, 4+1,10+1, 0 , 7+1,11+1, - 5+1,10+1,10+1, 4+1,10+1,11+1, 7+1,11+1, 5+1, 6+1,10+1, 4+1,10+1, 0 , 7+1,11+1 -}; - -static const UINT8 cc_cb[0x100] = { - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2 -}; - -static const UINT8 cc_ed[0x100] = { - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, -12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2, -12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2, -12+2,12+2,15+2,20+2, 8+2,14+2, 8+2,18+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2,18+2, -12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 8+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, -16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2,16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2, -16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2,16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2 -}; - -static const UINT8 cc_xy[0x100] = { - 4+4+2,10+4+2, 7+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, 4+4+2,11+4+2, 7+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, - 8+4+2,10+4+2, 7+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2,12+4+2,11+4+2, 7+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, - 7+4+2,10+4+2,16+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, 7+4+2,11+4+2,16+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, - 7+4+2,10+4+2,13+4+2, 6+4+2,23 +2,23 +2,19 +2, 4+4+2, 7+4+2,11+4+2,13+4+2, 6+4+2, 4+4+2, 4+4+2, 7+4+2, 4+4+2, - 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, - 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, - 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, -19 +2,19 +2,19 +2,19 +2,19 +2,19 +2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, - 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, - 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, - 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, - 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, - 5+4+2,10+4+2,10+4+2,10+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2,10+4+2,10+4+2, 0 ,10+4+2,17+4+2, 7+4+2,11+4+2, - 5+4+2,10+4+2,10+4+2,11+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 4+4+2,10+4+2,11+4+2,10+4+2, 4 +1, 7+4+2,11+4+2, - 5+4+2,10+4+2,10+4+2,19+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 4+4+2,10+4+2, 4+4+2,10+4+2, 4 +1, 7+4+2,11+4+2, - 5+4+2,10+4+2,10+4+2, 4+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 6+4+2,10+4+2, 4+4+2,10+4+2, 4 +1, 7+4+2,11+4+2 -}; - -static const UINT8 cc_xycb[0x100] = { -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, -20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, -20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, -20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2 -}; - -/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */ -static const UINT8 cc_ex[0x100] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DJNZ */ - 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NZ/JR Z */ - 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NC/JR C */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, /* LDIR/CPIR/INIR/OTIR LDDR/CPDR/INDR/OTDR */ - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2+1 -}; - - -void msx_state::driver_start() -{ - m_maincpu->set_input_line_vector(0, 0xff); - - msx_memory_init(); - - m_maincpu->z80_set_cycle_tables( cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex ); - - save_item(NAME(m_psg_b)); - save_item(NAME(m_mouse)); - save_item(NAME(m_mouse_stat)); - save_item(NAME(m_rtc_latch)); - save_item(NAME(m_kanji_latch)); - save_item(NAME(m_slot_expanded)); - save_item(NAME(m_primary_slot)); - save_item(NAME(m_secondary_slot)); - save_item(NAME(m_port_c_old)); - save_item(NAME(m_keylatch)); - save_item(NAME(m_current_switched_device)); - save_item(NAME(m_irq_state)); - - machine().save().register_postload(save_prepost_delegate(FUNC(msx_state::post_load), this)); -} - -void msx_state::post_load() -{ - for (int page = 0; page < 4; page++) - { - int slot_primary = (m_primary_slot >> (page * 2)) & 3; - int slot_secondary = (m_secondary_slot[slot_primary] >> (page * 2)) & 3; - - m_current_page[page] = m_all_slots[slot_primary][slot_secondary][page]; - } -} - -INTERRUPT_GEN_MEMBER(msx_state::msx_interrupt) -{ - m_mouse[0] = m_io_mouse0->read(); - m_mouse_stat[0] = -1; - m_mouse[1] = m_io_mouse1->read(); - m_mouse_stat[1] = -1; -} - -/* -** The I/O functions -*/ - - -READ8_MEMBER(msx_state::msx_psg_port_a_r) -{ - UINT8 data; - - data = (m_cassette->input() > 0.0038 ? 0x80 : 0); - - if ( (m_psg_b ^ m_io_dsw->read() ) & 0x40) - { - /* game port 2 */ - UINT8 inp = m_io_joy1->read(); - if ( !(inp & 0x80) ) - { - /* joystick */ - data |= ( inp & 0x7f ); - } - else - { - /* mouse */ - data |= ( inp & 0x70 ); - if (m_mouse_stat[1] < 0) - data |= 0xf; - else - data |= ~(m_mouse[1] >> (4*m_mouse_stat[1]) ) & 15; - } - } - else - { - /* game port 1 */ - UINT8 inp = m_io_joy0->read(); - if ( !(inp & 0x80) ) - { - /* joystick */ - data |= ( inp & 0x7f ); - } - else - { - /* mouse */ - data |= ( inp & 0x70 ); - if (m_mouse_stat[0] < 0) - data |= 0xf; - else - data |= ~(m_mouse[0] >> (4*m_mouse_stat[0]) ) & 15; - } - } - - return data; -} - -READ8_MEMBER(msx_state::msx_psg_port_b_r) -{ - return m_psg_b; -} - -WRITE8_MEMBER(msx_state::msx_psg_port_a_w) -{ -} - -WRITE8_MEMBER(msx_state::msx_psg_port_b_w) -{ - /* Arabic or kana mode led */ - if ( (data ^ m_psg_b) & 0x80) - set_led_status (machine(), 2, !(data & 0x80) ); - - if ( (m_psg_b ^ data) & 0x10) - { - if (++m_mouse_stat[0] > 3) m_mouse_stat[0] = -1; - } - if ( (m_psg_b ^ data) & 0x20) - { - if (++m_mouse_stat[1] > 3) m_mouse_stat[1] = -1; - } - - m_psg_b = data; -} - - -/* -** RTC functions -*/ - -WRITE8_MEMBER( msx_state::msx_rtc_latch_w ) -{ - m_rtc_latch = data & 15; -} - -WRITE8_MEMBER( msx_state::msx_rtc_reg_w ) -{ - m_rtc->write(space, m_rtc_latch, data); -} - -READ8_MEMBER( msx_state::msx_rtc_reg_r ) -{ - return m_rtc->read(space, m_rtc_latch); -} - - -/* -** The PPI functions -*/ - -WRITE8_MEMBER( msx_state::msx_ppi_port_a_w ) -{ - m_primary_slot = data; - - if (VERBOSE) - logerror ("write to primary slot select: %02x\n", m_primary_slot); - msx_memory_map_all (); -} - -WRITE8_MEMBER( msx_state::msx_ppi_port_c_w ) -{ - m_keylatch = data & 0x0f; - - /* caps lock */ - if ( BIT(m_port_c_old ^ data, 6) ) - set_led_status (machine(), 1, !BIT(data, 6) ); - - /* key click */ - if ( BIT(m_port_c_old ^ data, 7) ) - m_dac->write_signed8(BIT(data, 7) ? 0x7f : 0); - - /* cassette motor on/off */ - if ( BIT(m_port_c_old ^ data, 4) ) - m_cassette->change_state(BIT(data, 4) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - - /* cassette signal write */ - if ( BIT(m_port_c_old ^ data, 5) ) - m_cassette->output(BIT(data, 5) ? -1.0 : 1.0); - - m_port_c_old = data; -} - -READ8_MEMBER( msx_state::msx_ppi_port_b_r ) -{ - UINT8 result = 0xff; - int row, data; - ioport_port *keynames[] = { m_io_key0, m_io_key1, m_io_key2, m_io_key3, m_io_key4, m_io_key5 }; - - row = m_keylatch; - if (row <= 10) - { - data = keynames[row / 2]->read(); - - if (BIT(row, 0)) - data >>= 8; - result = data & 0xff; - } - return result; -} - -/************************************************************************ - * - * New memory emulation !! - * - ***********************************************************************/ - -void msx_state::install_slot_pages(device_t &owner, UINT8 prim, UINT8 sec, UINT8 page, UINT8 numpages, device_t *device) -{ - msx_state &msx = downcast(owner); - msx_internal_slot_interface *internal_slot = dynamic_cast(device); - - for ( int i = page; i < MIN(page + numpages, 4); i++ ) - { - msx.m_all_slots[prim][sec][i] = internal_slot; - } - if ( sec ) - { - msx.m_slot_expanded[prim] = true; - } -} - -void msx_state::msx_memory_init() -{ - int count_populated_pages = 0; - - // Populate all unpopulated slots with the dummy interface - for ( int prim = 0; prim < 4; prim++ ) - { - for ( int sec = 0; sec < 4; sec++ ) - { - for ( int page = 0; page < 4; page++ ) - { - if ( m_all_slots[prim][sec][page] == NULL ) - { - m_all_slots[prim][sec][page] = &m_empty_slot; - } - else - { - count_populated_pages++; - } - } - } - } - - if ( count_populated_pages == 0 ) { - fatalerror("No msx slot layout defined for this system!\n"); - } -} - -void msx_state::msx_memory_reset () -{ - m_primary_slot = 0; - - for (int prim=0; prim<4; prim++) - { - m_secondary_slot[prim] = 0; - } -} - -void msx_state::msx_memory_map_page (UINT8 page) -{ - int slot_primary = (m_primary_slot >> (page * 2)) & 3; - int slot_secondary = (m_secondary_slot[slot_primary] >> (page * 2)) & 3; - - m_current_page[page] = m_all_slots[slot_primary][slot_secondary][page]; -} - -void msx_state::msx_memory_map_all () -{ - for (UINT8 i=0; i<4; i++) - msx_memory_map_page (i); -} - -READ8_MEMBER( msx_state::msx_mem_read ) -{ - return m_current_page[offset >> 14]->read(space, offset); -} - -WRITE8_MEMBER( msx_state::msx_mem_write ) -{ - m_current_page[offset >> 14]->write(space, offset, data); -} - -WRITE8_MEMBER( msx_state::msx_sec_slot_w ) -{ - int slot = m_primary_slot >> 6; - if (m_slot_expanded[slot]) - { - if (VERBOSE) - logerror ("write to secondary slot %d select: %02x\n", slot, data); - - m_secondary_slot[slot] = data; - msx_memory_map_all (); - } - else - m_current_page[3]->write(space, 0xffff, data); -} - -READ8_MEMBER( msx_state::msx_sec_slot_r ) -{ - int slot = m_primary_slot >> 6; - - if (m_slot_expanded[slot]) - { - return ~m_secondary_slot[slot]; - } - else - { - return m_current_page[3]->read(space, 0xffff); - } -} - -READ8_MEMBER( msx_state::msx_kanji_r ) -{ - UINT8 result = 0xff; - - if (offset && m_region_kanji) - { - int latch = m_kanji_latch; - result = m_region_kanji->u8(latch++); - - m_kanji_latch &= ~0x1f; - m_kanji_latch |= latch & 0x1f; - } - return result; -} - -WRITE8_MEMBER( msx_state::msx_kanji_w ) -{ - if (offset) - m_kanji_latch = (m_kanji_latch & 0x007E0) | ((data & 0x3f) << 11); - else - m_kanji_latch = (m_kanji_latch & 0x1f800) | ((data & 0x3f) << 5); -} - -READ8_MEMBER( msx_state::msx_switched_r ) -{ - // Read from selected switched device - return this->space().read_byte( (m_current_switched_device << 8) | offset ); -} - -WRITE8_MEMBER( msx_state::msx_switched_w ) -{ - if (offset == 0) - { - // Select switched device - m_current_switched_device = data; - } - else - { - // Write to selected switched device - this->space().write_byte( (m_current_switched_device << 8) | offset, data ); - } -} diff --git a/src/mess/machine/msx_matsushita.c b/src/mess/machine/msx_matsushita.c deleted file mode 100644 index dd00841f5eb..00000000000 --- a/src/mess/machine/msx_matsushita.c +++ /dev/null @@ -1,168 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#include "emu.h" -#include "msx_matsushita.h" - - -const device_type MSX_MATSUSHITA = &device_creator; - - -msx_matsushita_device::msx_matsushita_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : msx_switched_device(mconfig, MSX_MATSUSHITA, "Matsushita switched device", tag, owner, clock, "msx_matsushita", __FILE__) - , m_io_config(*this, "CONFIG") - , m_nvram(*this, "nvram") - , m_turbo_out_cb(*this) - , m_address(0) - , m_nibble1(0) - , m_nibble2(0) - , m_pattern(0) -{ -} - - -UINT8 msx_matsushita_device::get_id() -{ - return 0x08; -} - - -static MACHINE_CONFIG_FRAGMENT( matsushita ) - MCFG_NVRAM_ADD_0FILL("nvram") -MACHINE_CONFIG_END - - -machine_config_constructor msx_matsushita_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( matsushita ); -} - - -static INPUT_PORTS_START( matsushita ) - PORT_START("CONFIG") - PORT_CONFNAME( 0x80, 0x00, "Firmware switch") - PORT_CONFSETTING( 0x00, "On" ) - PORT_CONFSETTING( 0x80, "Off" ) - PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED) -INPUT_PORTS_END - - -ioport_constructor msx_matsushita_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( matsushita ); -} - - -void msx_matsushita_device::device_start() -{ - msx_switched_device::device_start(); - - m_turbo_out_cb.resolve_safe(); - - m_sram.resize(0x800); - - m_nvram->set_base(&m_sram[0], 0x000); -} - - -READ8_MEMBER(msx_matsushita_device::io_read) -{ - switch (offset) - { - case 0x00: - return ~get_id(); - - case 0x01: - return m_io_config->read(); - - case 0x03: - { - UINT8 result = (((m_pattern & 0x80) ? m_nibble1 : m_nibble2) << 4) | ((m_pattern & 0x40) ? m_nibble1 : m_nibble2); - m_pattern = (m_pattern << 2) | (m_pattern >> 6); - return result; - } - - case 0x09: // Data - if (m_address < m_sram.size()) - { - return m_sram[m_address]; - } - break; - - default: - logerror("msx_matsushita: unhandled read from offset %02x\n", offset); - break; - } - - return 0xFF; -} - - -/* - 03 <- 10 - 04 <- fe - 4x read 04 and store at CC46-CC49 - - 03 <- 10 - 04 <- ce - 4x read 04 and store at CC4A-CC4D - - 03 <- 10 - 04 <- fe - 4x read 04 and store at CC4E-CC51 - - - 03 <- 10 - 04 <- fc - 4x read 04 and store at CC46-CC49 - - 03 <- 10 - 04 <- cc - 4x read 04 and store at CC4A-CC4D - - 03 <- 10 - 04 <- fc - 4x read 04 and store at CC4E-CC51 - -*/ - - -WRITE8_MEMBER(msx_matsushita_device::io_write) -{ - switch (offset) - { - // bit 0: CPU clock select - // 0 - 5.369317 MHz - // 1 - 3.579545 MHz - case 0x01: - m_turbo_out_cb((data & 1) ? ASSERT_LINE : CLEAR_LINE); - break; - - case 0x03: - m_nibble1 = data & 0x0f; - m_nibble2 = data >> 4; - break; - - case 0x04: - m_pattern = data; - break; - - case 0x07: // Address low - m_address = (m_address & 0xff00) | data; - break; - - case 0x08: // Address high - m_address = (m_address & 0xff) | (data << 8); - break; - - case 0x09: // Data - if (m_address < m_sram.size()) - { - m_sram[m_address] = data; - } - break; - - default: - logerror("msx_matsushita: unhandled write %02x to offset %02x\n", data, offset); - break; - } -} diff --git a/src/mess/machine/msx_matsushita.h b/src/mess/machine/msx_matsushita.h deleted file mode 100644 index 8406d5b29e7..00000000000 --- a/src/mess/machine/msx_matsushita.h +++ /dev/null @@ -1,48 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#ifndef __MSX_MATSUSHITA_H -#define __MSX_MATSUSHITA_H - - -#include "msx_switched.h" -#include "machine/nvram.h" - - -extern const device_type MSX_MATSUSHITA; - - -#define MCFG_MSX_MATSUSHITA_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, MSX_MATSUSHITA, 0) - -#define MCFG_MSX_MATSUSHITA_TURBO_CB(_devcb) \ - devcb = &msx_matsushita_device::set_turbo_callback(*device, DEVCB_##_devcb); - - -class msx_matsushita_device : public msx_switched_device -{ -public: - msx_matsushita_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_turbo_callback(device_t &device, _Object object) { return downcast(device).m_turbo_out_cb.set_callback(object); } - - virtual void device_start(); - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - virtual UINT8 get_id(); - - virtual DECLARE_READ8_MEMBER(io_read); - virtual DECLARE_WRITE8_MEMBER(io_write); - -private: - required_ioport m_io_config; - required_device m_nvram; - devcb_write_line m_turbo_out_cb; - UINT16 m_address; - dynamic_buffer m_sram; - UINT8 m_nibble1; - UINT8 m_nibble2; - UINT8 m_pattern; -}; - -#endif diff --git a/src/mess/machine/msx_s1985.c b/src/mess/machine/msx_s1985.c deleted file mode 100644 index 762b82afa8f..00000000000 --- a/src/mess/machine/msx_s1985.c +++ /dev/null @@ -1,65 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#include "emu.h" -#include "msx_s1985.h" - - -const device_type MSX_S1985 = &device_creator; - - -msx_s1985_device::msx_s1985_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : msx_switched_device(mconfig, MSX_S1985, "MSX-Engine S1985", tag, owner, clock, "msx_s1985", __FILE__) - , m_6_1(0) - , m_6_2(0) - , m_7(0) -{ -} - - -UINT8 msx_s1985_device::get_id() -{ - return 0xFE; -} - - -READ8_MEMBER(msx_s1985_device::io_read) -{ - switch (offset) - { - case 0: - return ~get_id(); - - case 7: - { - UINT8 data = (m_7 & 0x80) ? m_6_2 : m_6_1; - m_7 = ( m_7 << 1 ) | ( m_7 >> 7 ); - return data; - } - - default: - printf("msx_s1985: unhandled read from offset %02x\n", offset); - break; - } - - return 0xFF; -} - - -WRITE8_MEMBER(msx_s1985_device::io_write) -{ - switch (offset) - { - case 6: - m_6_2 = m_6_1; - m_6_1 = data; - break; - - case 7: - m_7 = data; - break; - - default: - printf("msx_s1985: unhandled write %02x to offset %02x\n", data, offset); - break; - } -} diff --git a/src/mess/machine/msx_s1985.h b/src/mess/machine/msx_s1985.h deleted file mode 100644 index 98ecdcf631d..00000000000 --- a/src/mess/machine/msx_s1985.h +++ /dev/null @@ -1,33 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#ifndef __MSX_S1985_H -#define __MSX_S1985_H - - -#include "msx_switched.h" - - -extern const device_type MSX_S1985; - - -#define MCFG_MSX_S1985_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, MSX_S1985, 0) - - -class msx_s1985_device : public msx_switched_device -{ -public: - msx_s1985_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual UINT8 get_id(); - - virtual DECLARE_READ8_MEMBER(io_read); - virtual DECLARE_WRITE8_MEMBER(io_write); - -private: - UINT8 m_6_1; - UINT8 m_6_2; - UINT8 m_7; -}; - -#endif diff --git a/src/mess/machine/msx_switched.c b/src/mess/machine/msx_switched.c deleted file mode 100644 index f810f2c2dc2..00000000000 --- a/src/mess/machine/msx_switched.c +++ /dev/null @@ -1,22 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#include "emu.h" -#include "msx_switched.h" - - -msx_switched_device::msx_switched_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source) -{ -} - - -void msx_switched_device::device_start() -{ - address_space &space = dynamic_cast(owner())->space(); - - // Install IO read/write handlers - UINT16 start = ( get_id() << 8 ) | 0x00; - UINT16 end = ( get_id() << 8 ) | 0x0f; - space.install_read_handler(start, end, read8_delegate(FUNC(msx_switched_device::io_read), this)); - space.install_write_handler(start, end, write8_delegate(FUNC(msx_switched_device::io_write), this)); -} diff --git a/src/mess/machine/msx_switched.h b/src/mess/machine/msx_switched.h deleted file mode 100644 index 681ffaaa680..00000000000 --- a/src/mess/machine/msx_switched.h +++ /dev/null @@ -1,21 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#ifndef __MSX_SWITCHED_H -#define __MSX_SWITCHED_H - - -class msx_switched_device : public device_t -{ -public: - msx_switched_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - virtual UINT8 get_id() = 0; - - virtual DECLARE_READ8_MEMBER(io_read) = 0; - virtual DECLARE_WRITE8_MEMBER(io_write) = 0; - -protected: - virtual void device_start(); -}; - -#endif diff --git a/src/mess/machine/msx_systemflags.c b/src/mess/machine/msx_systemflags.c deleted file mode 100644 index ee443f79471..00000000000 --- a/src/mess/machine/msx_systemflags.c +++ /dev/null @@ -1,40 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#include "emu.h" -#include "msx_systemflags.h" - - -const device_type MSX_SYSTEMFLAGS = &device_creator; - - -msx_systemflags_device::msx_systemflags_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, MSX_SYSTEMFLAGS, "MSX System Flags", tag, owner, clock, "msx_systemflags", __FILE__) - , m_initial_value(0xff) - , m_system_flags(0xff) -{ -} - - -void msx_systemflags_device::device_start() -{ - m_system_flags = m_initial_value; - - save_item(NAME(m_system_flags)); - - // Install IO read/write handlers - address_space &space = machine().device("maincpu")->space(AS_IO); - space.install_write_handler(0xf4, 0xf4, write8_delegate(FUNC(msx_systemflags_device::write), this)); - space.install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(msx_systemflags_device::read), this)); -} - - -READ8_MEMBER(msx_systemflags_device::read) -{ - return m_system_flags; -} - - -WRITE8_MEMBER(msx_systemflags_device::write) -{ - m_system_flags = data; -} diff --git a/src/mess/machine/msx_systemflags.h b/src/mess/machine/msx_systemflags.h deleted file mode 100644 index 616ea57f5da..00000000000 --- a/src/mess/machine/msx_systemflags.h +++ /dev/null @@ -1,39 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#ifndef __MSX_SYSTEMFLAGS_H -#define __MSX_SYSTEMFLAGS_H - -/* -Some MSX2+ and TurboR machines have a 'system flags' I/O port ($F4). -The value in this register is cleared on power up, but it keeps it's -value during a reset of the system. -*/ - -extern const device_type MSX_SYSTEMFLAGS; - - -#define MCFG_MSX_SYSTEMFLAGS_ADD(_tag, _initial_value) \ - MCFG_DEVICE_ADD(_tag, MSX_SYSTEMFLAGS, 0) \ - msx_systemflags_device::set_initial_value(*device, _initial_value); - - -class msx_systemflags_device : public device_t -{ -public: - msx_systemflags_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // static configuration helpers - static void set_initial_value(device_t &device, UINT8 initial_value) { dynamic_cast(device).m_initial_value = initial_value; } - - DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); - -protected: - virtual void device_start(); - -private: - UINT8 m_initial_value; - UINT8 m_system_flags; -}; - -#endif diff --git a/src/mess/machine/mtx.c b/src/mess/machine/mtx.c deleted file mode 100644 index 0594ec6c086..00000000000 --- a/src/mess/machine/mtx.c +++ /dev/null @@ -1,414 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Lee Ward, Dirk Best, Curt Coder -/************************************************************************* - - Memotech MTX 500, MTX 512 and RS 128 - -**************************************************************************/ - -#include "emu.h" -#include "formats/imageutl.h" -#include "includes/mtx.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" -#include "imagedev/snapquik.h" -#include "bus/centronics/ctronics.h" -#include "machine/z80ctc.h" -#include "machine/z80dart.h" -#include "video/tms9928a.h" -#include "sound/sn76496.h" - -/*************************************************************************** - READ/WRITE HANDLERS -***************************************************************************/ - -/*------------------------------------------------- - mtx_strobe_r - centronics strobe --------------------------------------------------*/ - -READ8_MEMBER(mtx_state::mtx_strobe_r) -{ - /* set STROBE low */ - m_centronics->write_strobe(FALSE); - - return 0xff; -} - -/*------------------------------------------------- - mtx_bankswitch_w - bankswitch --------------------------------------------------*/ - -/* - There are two memory models on the MTX, the standard one and a - CBM mode. In standard mode, the memory map is defined as: - - 0x0000 - 0x1fff OSROM - 0x2000 - 0x3fff Paged ROM - 0x4000 - 0x7fff Paged RAM - 0x8000 - 0xbfff Paged RAM - 0xc000 - 0xffff RAM - - Banks are selected by output port 0. Bits 0-3 define the RAM page - and bits 4-6 the ROM page. - - CBM mode is selected by bit 7 of output port 0. ROM is replaced - by RAM in this mode. -*/ - -void mtx_state::bankswitch(UINT8 data) -{ - /* - - bit description - - 0 P0 - 1 P1 - 2 P2 - 3 P3 - 4 R0 - 5 R1 - 6 R2 - 7 RELCPMH - - */ - address_space &program = m_maincpu->space(AS_PROGRAM); - ram_device *messram = m_ram; - -// UINT8 cbm_mode = data >> 7 & 0x01; - UINT8 rom_page = data >> 4 & 0x07; - UINT8 ram_page = data >> 0 & 0x0f; - - /* set rom bank (switches between basic and assembler rom or cartridges) */ - membank("bank2")->set_entry(rom_page); - - /* set ram bank, for invalid pages a nop-handler will be installed */ - if (ram_page >= messram->size()/0x8000) - { - program.nop_readwrite(0x4000, 0x7fff); - program.nop_readwrite(0x8000, 0xbfff); - } - else if (ram_page + 1 == messram->size()/0x8000) - { - program.nop_readwrite(0x4000, 0x7fff); - program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - membank("bank4")->set_entry(ram_page); - } - else - { - program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); - program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - membank("bank3")->set_entry(ram_page); - membank("bank4")->set_entry(ram_page); - } -} - -WRITE8_MEMBER(mtx_state::mtx_bankswitch_w) -{ - bankswitch(data); -} - -/*------------------------------------------------- - mtx_sound_strobe_r - sound strobe --------------------------------------------------*/ - -READ8_MEMBER(mtx_state::mtx_sound_strobe_r) -{ - m_sn->write(space, 0, m_sound_latch); - return 0xff; -} - -/*------------------------------------------------- - mtx_sound_latch_w - sound latch write --------------------------------------------------*/ - -WRITE8_MEMBER(mtx_state::mtx_sound_latch_w) -{ - m_sound_latch = data; -} - -/*------------------------------------------------- - mtx_cst_w - cassette write --------------------------------------------------*/ - -WRITE8_MEMBER(mtx_state::mtx_cst_w) -{ - m_cassette->output( BIT(data, 0) ? -1 : 1); -} - -/*------------------------------------------------- - mtx_prt_r - centronics status --------------------------------------------------*/ - -WRITE_LINE_MEMBER(mtx_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER(mtx_state::write_centronics_fault) -{ - m_centronics_fault = state; -} - -WRITE_LINE_MEMBER(mtx_state::write_centronics_perror) -{ - m_centronics_perror = state; -} - -WRITE_LINE_MEMBER(mtx_state::write_centronics_select) -{ - m_centronics_select = state; -} - -READ8_MEMBER(mtx_state::mtx_prt_r) -{ - /* - - bit description - - 0 BUSY - 1 ERROR - 2 PE - 3 SLCT - 4 - 5 - 6 - 7 - - */ - - UINT8 data = 0; - - /* reset STROBE to high */ - m_centronics->write_strobe( TRUE); - - data |= m_centronics_busy << 0; - data |= m_centronics_fault << 1; - data |= m_centronics_perror << 2; - data |= m_centronics_select << 3; - - return data; -} - -/*------------------------------------------------- - mtx_sense_w - keyboard sense write --------------------------------------------------*/ - -WRITE8_MEMBER(mtx_state::mtx_sense_w) -{ - m_key_sense = data; -} - -/*------------------------------------------------- - mtx_key_lo_r - keyboard low read --------------------------------------------------*/ - -READ8_MEMBER(mtx_state::mtx_key_lo_r) -{ - UINT8 data = 0xff; - - if (!(m_key_sense & 0x01)) data &= ioport("ROW0")->read(); - if (!(m_key_sense & 0x02)) data &= ioport("ROW1")->read(); - if (!(m_key_sense & 0x04)) data &= ioport("ROW2")->read(); - if (!(m_key_sense & 0x08)) data &= ioport("ROW3")->read(); - if (!(m_key_sense & 0x10)) data &= ioport("ROW4")->read(); - if (!(m_key_sense & 0x20)) data &= ioport("ROW5")->read(); - if (!(m_key_sense & 0x40)) data &= ioport("ROW6")->read(); - if (!(m_key_sense & 0x80)) data &= ioport("ROW7")->read(); - - return data; -} - -/*------------------------------------------------- - mtx_key_lo_r - keyboard high read --------------------------------------------------*/ - -READ8_MEMBER(mtx_state::mtx_key_hi_r) -{ - UINT8 data = ioport("country_code")->read(); - - if (!(m_key_sense & 0x01)) data &= ioport("ROW0")->read() >> 8; - if (!(m_key_sense & 0x02)) data &= ioport("ROW1")->read() >> 8; - if (!(m_key_sense & 0x04)) data &= ioport("ROW2")->read() >> 8; - if (!(m_key_sense & 0x08)) data &= ioport("ROW3")->read() >> 8; - if (!(m_key_sense & 0x10)) data &= ioport("ROW4")->read() >> 8; - if (!(m_key_sense & 0x20)) data &= ioport("ROW5")->read() >> 8; - if (!(m_key_sense & 0x40)) data &= ioport("ROW6")->read() >> 8; - if (!(m_key_sense & 0x80)) data &= ioport("ROW7")->read() >> 8; - - return data; -} - -/*------------------------------------------------- - hrx_address_w - HRX video RAM address --------------------------------------------------*/ - -WRITE8_MEMBER(mtx_state::hrx_address_w) -{ - if (offset) - { - /* - - bit description - - 0 A8 - 1 A9 - 2 A10 - 3 - 4 - 5 attribute memory write enable - 6 ASCII memory write enable - 7 cycle (0=read/1=write) - - */ - } - else - { - /* - - bit description - - 0 A0 - 1 A1 - 2 A2 - 3 A3 - 4 A4 - 5 A5 - 6 A6 - 7 A7 - - */ - } -} - -/*------------------------------------------------- - hrx_data_r - HRX data read --------------------------------------------------*/ - -READ8_MEMBER(mtx_state::hrx_data_r) -{ - return 0; -} - -/*------------------------------------------------- - hrx_data_w - HRX data write --------------------------------------------------*/ - -WRITE8_MEMBER(mtx_state::hrx_data_w) -{ -} - -/*------------------------------------------------- - hrx_attr_r - HRX attribute read --------------------------------------------------*/ - -READ8_MEMBER(mtx_state::hrx_attr_r) -{ - return 0; -} - -/*------------------------------------------------- - hrx_attr_r - HRX attribute write --------------------------------------------------*/ - -WRITE8_MEMBER(mtx_state::hrx_attr_w) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ -} - -/*************************************************************************** - SNAPSHOT -***************************************************************************/ - -// this only works for some of the files, nothing which tries to load -// more data from tape. todo: tapes which autorun after loading -SNAPSHOT_LOAD_MEMBER( mtx_state, mtx ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - void *ptr; - UINT8 header[18]; - - // read header - image.fread(&header, sizeof(header)); - - // verify first byte - if (header[0] != 0xff) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, NULL); - return IMAGE_INIT_FAIL; - } - - // get tape name - char tape_name[16]; - memcpy(&tape_name, &header[1], 15); - tape_name[15] = '\0'; - image.message("Loading '%s'", tape_name); - - // start of system variables area - UINT16 system_variables_base = pick_integer_le(header, 16, 2); - - // write system variables - UINT16 system_variables_size = 0; - - if (system_variables_base != 0) - { - ptr = program.get_write_ptr(system_variables_base); - system_variables_size = 0xfb4b - system_variables_base; - image.fread(ptr, system_variables_size); - } - - // write actual image data - UINT16 data_size = snapshot_size - 18 - system_variables_size; - - ptr = program.get_write_ptr(0x4000); - image.fread(ptr, 0x4000); - - // if we cross the page boundary, get a new write pointer and write the rest - if (data_size > 0x4000) - { - ptr = program.get_write_ptr(0x8000); - image.fread(ptr, 0x4000); - } - - logerror("snapshot name = '%s', system_size = 0x%04x, data_size = 0x%04x\n", tape_name, system_variables_size, data_size); - - return IMAGE_INIT_PASS; -} - -/*************************************************************************** - MACHINE INITIALIZATION -***************************************************************************/ - -/*------------------------------------------------- - MACHINE_START( mtx512 ) --------------------------------------------------*/ - -MACHINE_START_MEMBER(mtx_state,mtx512) -{ - ram_device *messram = m_ram; - - /* configure memory */ - membank("bank1")->set_base(memregion("user1")->base()); - membank("bank2")->configure_entries(0, 8, memregion("user2")->base(), 0x2000); - membank("bank3")->configure_entries(0, messram->size()/0x4000/2, messram->pointer(), 0x4000); - membank("bank4")->configure_entries(0, messram->size()/0x4000/2, messram->pointer() + messram->size()/2, 0x4000); -} - -MACHINE_RESET_MEMBER(mtx_state,mtx512) -{ - /* bank switching */ - bankswitch(0); -} diff --git a/src/mess/machine/mz700.c b/src/mess/machine/mz700.c deleted file mode 100644 index a3a9f3514fa..00000000000 --- a/src/mess/machine/mz700.c +++ /dev/null @@ -1,616 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Dirk Best -/****************************************************************************** - * Sharp MZ700 - * - * Reference: http://sharpmz.computingmuseum.com - * - *****************************************************************************/ - -#include "emu.h" -#include "includes/mz700.h" -#include "cpu/z80/z80.h" -#include "machine/pit8253.h" -#include "machine/i8255.h" -#include "machine/z80pio.h" -#include "machine/74145.h" -#include "sound/speaker.h" -#include "imagedev/cassette.h" -#include "machine/ram.h" - -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define LOG(N,M,A,mac) \ - do { \ - if(VERBOSE>=N) \ - { \ - if( M ) \ - logerror("%11.6f: %-24s",mac.time().as_double(), (const char*)M ); \ - logerror A; \ - } \ - } while (0) - - -/*************************************************************************** - INITIALIZATION -***************************************************************************/ - -DRIVER_INIT_MEMBER(mz_state,mz700) -{ - m_mz700 = TRUE; - m_mz700_mode = TRUE; - - m_videoram = auto_alloc_array(machine(), UINT8, 0x800); - memset(m_videoram, 0, sizeof(UINT8) * 0x800); - m_colorram = auto_alloc_array(machine(), UINT8, 0x800); - memset(m_colorram, 0, sizeof(UINT8) * 0x800); -} - -DRIVER_INIT_MEMBER(mz_state,mz800) -{ - m_mz700 = FALSE; - m_mz700_mode = FALSE; - - /* video ram */ - m_videoram = auto_alloc_array(machine(), UINT8, 0x4000); - memset(m_videoram, 0, sizeof(UINT8) * 0x4000); - m_colorram = m_videoram + 0x800; - - /* character generator ram */ - m_cgram = auto_alloc_array(machine(), UINT8, 0x1000); - memset(m_cgram, 0, sizeof(UINT8) * 0x1000); -} - -void mz_state::machine_start() -{ - /* reset memory map to defaults */ - mz700_bank_4_w(m_maincpu->space(AS_PROGRAM), 0, 0); -} - - -/*************************************************************************** - MMIO -***************************************************************************/ - -READ8_MEMBER(mz_state::mz700_e008_r) -{ - UINT8 data = 0; - - data |= m_other_timer; - data |= ioport("JOY")->read(); - data |= machine().first_screen()->hblank() << 7; - - LOG(1, "mz700_e008_r", ("%02X\n", data), machine()); - - return data; -} - -WRITE8_MEMBER(mz_state::mz700_e008_w) -{ - m_pit->write_gate0(BIT(data, 0)); -} - - -/*************************************************************************** - BANK SWITCHING -***************************************************************************/ - -READ8_MEMBER(mz_state::mz800_bank_0_r) -{ - UINT8 *videoram = m_videoram; - address_space &spc = m_maincpu->space(AS_PROGRAM); - - /* switch in cgrom */ - spc.install_read_bank(0x1000, 0x1fff, "bank2"); - spc.nop_write(0x1000, 0x1fff); - membank("bank2")->set_base(memregion("monitor")->base() + 0x1000); - - if (m_mz700_mode) - { - /* cgram from 0xc000 to 0xcfff */ - spc.install_read_bank(0xc000, 0xcfff, "bank6"); - spc.install_write_handler(0xc000, 0xcfff, write8_delegate(FUNC(mz_state::mz800_cgram_w),this)); - membank("bank6")->set_base(m_cgram); - } - else - { - if (m_hires_mode) - { - /* vram from 0x8000 to 0xbfff */ - spc.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - membank("bank4")->set_base(videoram); - } - else - { - /* vram from 0x8000 to 0x9fff */ - spc.install_readwrite_bank(0x8000, 0x9fff, "bank4"); - membank("bank4")->set_base(videoram); - - /* ram from 0xa000 to 0xbfff */ - spc.install_readwrite_bank(0xa000, 0xbfff, "bank5"); - membank("bank5")->set_base(m_ram->pointer() + 0xa000); - } - } - - return 0xff; -} - -WRITE8_MEMBER(mz_state::mz700_bank_0_w) -{ - address_space &spc = m_maincpu->space(AS_PROGRAM); - - spc.install_readwrite_bank(0x0000, 0x0fff, "bank1"); - membank("bank1")->set_base(m_ram->pointer()); -} - -WRITE8_MEMBER(mz_state::mz800_bank_0_w) -{ - address_space &spc = m_maincpu->space(AS_PROGRAM); - - spc.install_readwrite_bank(0x0000, 0x7fff, "bank1"); - membank("bank1")->set_base(m_ram->pointer()); -} - -READ8_MEMBER(mz_state::mz800_bank_1_r) -{ - address_space &spc = m_maincpu->space(AS_PROGRAM); - - /* switch in ram from 0x1000 to 0x1fff */ - spc.install_readwrite_bank(0x1000, 0x1fff, "bank2"); - membank("bank2")->set_base(m_ram->pointer() + 0x1000); - - if (m_mz700_mode) - { - /* ram from 0xc000 to 0xcfff */ - spc.install_readwrite_bank(0xc000, 0xcfff, "bank6"); - membank("bank6")->set_base(m_ram->pointer() + 0xc000); - } - else - { - /* ram from 0x8000 to 0xbfff */ - spc.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - membank("bank4")->set_base(m_ram->pointer() + 0x8000); - } - - return 0xff; -} - -WRITE8_MEMBER(mz_state::mz700_bank_1_w) -{ - address_space &spc = m_maincpu->space(AS_PROGRAM); - - if (m_mz700_mode) - { - /* switch in ram when not locked */ - if (!m_mz700_ram_lock) - { - spc.install_readwrite_bank(0xd000, 0xffff, "bank7"); - membank("bank7")->set_base(m_ram->pointer() + 0xd000); - m_mz700_ram_vram = FALSE; - } - } - else - { - /* switch in ram when not locked */ - if (!m_mz800_ram_lock) - { - spc.install_readwrite_bank(0xe000, 0xffff, "bank8"); - membank("bank8")->set_base(m_ram->pointer() + 0xe000); - m_mz800_ram_monitor = FALSE; - } - } -} - -WRITE8_MEMBER(mz_state::mz700_bank_2_w) -{ - address_space &spc = m_maincpu->space(AS_PROGRAM); - - spc.install_read_bank(0x0000, 0x0fff, "bank1"); - spc.nop_write(0x0000, 0x0fff); - membank("bank1")->set_base(memregion("monitor")->base()); -} - -WRITE8_MEMBER(mz_state::mz700_bank_3_w) -{ - UINT8 *videoram = m_videoram; - address_space &spc = m_maincpu->space(AS_PROGRAM); - - if (m_mz700_mode) - { - if (!m_mz700_ram_lock) - { - /* switch in videoram */ - spc.install_readwrite_bank(0xd000, 0xd7ff, "bank7"); - membank("bank7")->set_base(videoram); - - /* switch in colorram */ - spc.install_readwrite_bank(0xd800, 0xdfff, "bank9"); - membank("bank9")->set_base(m_colorram); - - m_mz700_ram_vram = TRUE; - - /* switch in memory mapped i/o devices */ - if (m_mz700) - { - spc.install_readwrite_handler(0xe000, 0xfff3, 0, 0x1ff0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi)); - spc.install_readwrite_handler(0xe004, 0xfff7, 0, 0x1ff0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit)); - spc.install_readwrite_handler(0xe008, 0xfff8, 0, 0x1ff0, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this)); - } - else - { - spc.install_readwrite_handler(0xe000, 0xe003, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi)); - spc.install_readwrite_handler(0xe004, 0xe007, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit)); - spc.install_readwrite_handler(0xe008, 0xe008, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this)); - } - } - } - else - { - if (!m_mz800_ram_lock) - { - /* switch in mz800 monitor rom if not locked */ - spc.install_read_bank(0xe000, 0xffff, "bank8"); - spc.nop_write(0xe000, 0xffff); - membank("bank8")->set_base(memregion("monitor")->base() + 0x2000); - m_mz800_ram_monitor = TRUE; - } - } -} - -WRITE8_MEMBER(mz_state::mz700_bank_4_w) -{ - UINT8 *videoram = m_videoram; - address_space &spc = m_maincpu->space(AS_PROGRAM); - - if (m_mz700_mode) - { - m_mz700_ram_lock = FALSE; /* reset lock */ - mz700_bank_2_w(space, 0, 0); /* switch in monitor rom */ - mz700_bank_3_w(space, 0, 0); /* switch in videoram, colorram, and mmio */ - - /* rest is ram is always ram in mz700 mode */ - spc.install_readwrite_bank(0x1000, 0xcfff, "bank2"); - membank("bank2")->set_base(m_ram->pointer() + 0x1000); - } - else - { - /* monitor rom and cgrom */ - spc.install_read_bank(0x0000, 0x1fff, "bank1"); - spc.nop_write(0x0000, 0x1fff); - membank("bank1")->set_base(memregion("monitor")->base()); - - /* ram from 0x2000 to 0x7fff */ - spc.install_readwrite_bank(0x2000, 0x7fff, "bank3"); - membank("bank3")->set_base(m_ram->pointer()); - - if (m_hires_mode) - { - /* vram from 0x8000 to 0xbfff */ - spc.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - membank("bank4")->set_base(videoram); - } - else - { - /* vram from 0x8000 to 0x9fff */ - spc.install_readwrite_bank(0x8000, 0x9fff, "bank4"); - membank("bank4")->set_base(videoram); - - /* ram from 0xa000 to 0xbfff */ - spc.install_readwrite_bank(0xa000, 0xbfff, "bank5"); - membank("bank5")->set_base(m_ram->pointer() + 0xa000); - } - - /* ram from 0xc000 to 0xdfff */ - spc.install_readwrite_bank(0xc000, 0xdfff, "bank6"); - membank("bank6")->set_base(m_ram->pointer() + 0xc000); - - /* mz800 monitor rom from 0xe000 to 0xffff */ - spc.install_read_bank(0xe000, 0xffff, "bank8"); - spc.nop_write(0xe000, 0xffff); - membank("bank8")->set_base(memregion("monitor")->base() + 0x2000); - m_mz800_ram_monitor = TRUE; - - m_mz800_ram_lock = FALSE; /* reset lock? */ - } -} - -WRITE8_MEMBER(mz_state::mz700_bank_5_w) -{ - address_space &spc = m_maincpu->space(AS_PROGRAM); - - if (m_mz700_mode) - { - /* prevent access from 0xd000 to 0xffff */ - m_mz700_ram_lock = TRUE; - spc.nop_readwrite(0xd000, 0xffff); - } - else - { - /* prevent access from 0xe000 to 0xffff */ - m_mz800_ram_lock = TRUE; - spc.nop_readwrite(0xe000, 0xffff); - } -} - -WRITE8_MEMBER(mz_state::mz700_bank_6_w) -{ - if (m_mz700_mode) - { - m_mz700_ram_lock = FALSE; - - /* restore access */ - if (m_mz700_ram_vram) - mz700_bank_3_w(space, 0, 0); - else - mz700_bank_1_w(space, 0, 0); - } - else - { - m_mz800_ram_lock = FALSE; - - /* restore access from 0xe000 to 0xffff */ - if (m_mz800_ram_monitor) - mz700_bank_3_w(space, 0, 0); - else - mz700_bank_1_w(space, 0, 0); - } -} - - -/************************ PIT ************************************************/ - -/* Timer 0 is the clock for the speaker output */ - -WRITE_LINE_MEMBER(mz_state::pit_out0_changed) -{ - if((m_prev_state==0) && (state==1)) { - m_speaker_level ^= 1; - } - m_prev_state = state; - m_speaker->level_w(m_speaker_level); -} - -/* timer 2 is the AM/PM (12 hour) interrupt */ -WRITE_LINE_MEMBER(mz_state::pit_irq_2) -{ - if (!m_intmsk) - m_maincpu->set_input_line(0, state); -} - - -/*************************************************************************** - 8255 PPI -***************************************************************************/ - -READ8_MEMBER(mz_state::pio_port_b_r) -{ - device_t *device = machine().device("ls145"); - int key_line = dynamic_cast(device)->read(); - const char *const keynames[10] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9" }; - int i; - UINT8 res = 0; - - for(i=0;i<10;i++) - { - if(key_line & (1 << i)) - res |= ioport(keynames[i])->read(); - } - - return res; -} - -/* - * bit 7 in vertical blank - * bit 6 in NE556 output - * bit 5 in tape data (RDATA) - * bit 4 in motor (1 = on) - */ -READ8_MEMBER(mz_state::pio_port_c_r) -{ - UINT8 data = 0; - - /* note: this is actually connected to Q output of the motor-control flip-flop (see below) */ - if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED) - data |= 0x10; - - if ((m_cassette)->input() > 0.0038) - data |= 0x20; /* set the RDATA status */ - - data |= m_cursor_timer << 6; - data |= machine().first_screen()->vblank() << 7; - - LOG(2,"mz700_pio_port_c_r",("%02X\n", data),machine()); - - return data; -} - - -WRITE8_MEMBER(mz_state::pio_port_a_w) -{ - device_t *device = machine().device("ls145"); - timer_device *timer = machine().device("cursor"); - - LOG(2,"mz700_pio_port_a_w",("%02X\n", data),machine()); - - /* the ls145 is connected to PA0-PA3 */ - dynamic_cast(device)->write(data & 0x07); - - /* ne556 reset is connected to PA7 */ - timer->enable(BIT(data, 7)); -} - - -WRITE8_MEMBER(mz_state::pio_port_c_w) -{ - /* - * bit 3 out motor control (0 = on) - * bit 2 out INTMSK - * bit 1 out tape data (WDATA) - * bit 0 out unused - */ - -// UINT8 state = cassette_get_state(m_cassette); -// UINT8 action = ((~pio_port_c_output & 8) & (data & 8)); /* detect low-to-high transition */ - - /* The motor control circuit consists of a resistor, capacitor, invertor, nand-gate, and D flip-flop. - The sense input from the cassette player goes low whenever play, rewind or fast-forward is pressed. - This connects to most of the above components. - The Q output enables the motor, and also connects to Bit 4 (input). - Bit 3 outputs a string of pulses to the Clock pin, and therefore cannot be used to control - the motor directly. - For the moment, the user can use the UI to select play, stop, etc. - If you load from the command-line or the software-picker, type in L immediately. */ -#if 0 - - m_cassette->change_state( - ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, - CASSETTE_MOTOR_DISABLED); - -#endif - - LOG(2,"mz700_pio_port_c_w",("%02X\n", data),machine()); - - m_cassette->output((data & 0x02) ? +1.0 : -1.0); -} - - -/****************************************************************************** - * Sharp MZ800 - * - * - ******************************************************************************/ - -//static UINT8 mz800_display_mode = 0; -//static UINT8 mz800_port_e8 = 0; - - -/*************************************************************************** - Z80 PIO -***************************************************************************/ - -WRITE_LINE_MEMBER(mz_state::mz800_z80pio_irq) -{ - m_maincpu->set_input_line(0, state); -} - -WRITE_LINE_MEMBER(mz_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -WRITE_LINE_MEMBER(mz_state::write_centronics_perror) -{ - m_centronics_perror = state; -} - -READ8_MEMBER(mz_state::mz800_z80pio_port_a_r) -{ - UINT8 result = 0; - - result |= m_centronics_busy; - result |= m_centronics_perror << 1; - result |= machine().first_screen()->hblank() << 5; - - return result; -} - -WRITE8_MEMBER(mz_state::mz800_z80pio_port_a_w) -{ - m_centronics->write_init(BIT(data, 6)); - m_centronics->write_strobe(BIT(data, 7)); -} - -/* port CE */ -READ8_MEMBER(mz_state::mz800_crtc_r) -{ - UINT8 data = 0x00; - LOG(1,"mz800_crtc_r",("%02X\n",data),machine()); - return data; -} - - -/* port EA */ -READ8_MEMBER(mz_state::mz800_ramdisk_r) -{ - UINT8 *mem = memregion("user1")->base(); - UINT8 data = mem[m_mz800_ramaddr]; - LOG(2,"mz800_ramdisk_r",("[%04X] -> %02X\n", m_mz800_ramaddr, data),machine()); - if (m_mz800_ramaddr++ == 0) - LOG(1,"mz800_ramdisk_r",("address wrap 0000\n"),machine()); - return data; -} - -/* port CC */ -WRITE8_MEMBER(mz_state::mz800_write_format_w) -{ - LOG(1,"mz800_write_format_w",("%02X\n", data),machine()); -} - -/* port CD */ -WRITE8_MEMBER(mz_state::mz800_read_format_w) -{ - LOG(1,"mz800_read_format_w",("%02X\n", data),machine()); -} - -/* port CE - * bit 3 1: MZ700 mode 0: MZ800 mode - * bit 2 1: 640 horizontal 0: 320 horizontal - * bit 1 1: 4bpp/2bpp 0: 2bpp/1bpp - * bit 0 ??? - */ -WRITE8_MEMBER(mz_state::mz800_display_mode_w) -{ - m_mz700_mode = BIT(data, 3); - m_hires_mode = BIT(data, 2); - m_screennum = data & 0x03; - - /* change memory maps if we switched mode */ -// if (BIT(data, 3) != m_mz700_mode) -// { -// logerror("mz800_display_mode_w: switching mode to %s\n", (BIT(data, 3) ? "mz700" : "mz800")); -// m_mz700_mode = BIT(data, 3); -// mz700_bank_4_w(*m_maincpu->&space(AS_PROGRAM), 0, 0); -// } -} - -/* port CF */ -WRITE8_MEMBER(mz_state::mz800_scroll_border_w) -{ - LOG(1,"mz800_scroll_border_w",("%02X\n", data),machine()); -} - -/* port EA */ -WRITE8_MEMBER(mz_state::mz800_ramdisk_w) -{ - UINT8 *mem = memregion("user1")->base(); - LOG(2,"mz800_ramdisk_w",("[%04X] <- %02X\n", m_mz800_ramaddr, data),machine()); - mem[m_mz800_ramaddr] = data; - if (m_mz800_ramaddr++ == 0) - LOG(1,"mz800_ramdisk_w",("address wrap 0000\n"),machine()); -} - -/* port EB */ -WRITE8_MEMBER(mz_state::mz800_ramaddr_w) -{ - m_mz800_ramaddr = (m_maincpu->state_int(Z80_BC) & 0xff00) | (data & 0xff); - LOG(1,"mz800_ramaddr_w",("%04X\n", m_mz800_ramaddr),machine()); -} - -/* port F0 */ -WRITE8_MEMBER(mz_state::mz800_palette_w) -{ - if (data & 0x40) - { - m_mz800_palette_bank = data & 3; - LOG(1,"mz800_palette_w",("bank: %d\n", m_mz800_palette_bank),machine()); - } - else - { - int idx = (data >> 4) & 3; - int val = data & 15; - LOG(1,"mz800_palette_w",("palette[%d] <- %d\n", idx, val),machine()); - m_mz800_palette[idx] = val; - } -} diff --git a/src/mess/machine/mz80.c b/src/mess/machine/mz80.c deleted file mode 100644 index 66abbff2e00..00000000000 --- a/src/mess/machine/mz80.c +++ /dev/null @@ -1,84 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - MZ80 driver by Miodrag Milanovic - - 22/11/2008 Preliminary driver. - -****************************************************************************/ - -#include "includes/mz80.h" - - -/* Driver initialization */ -DRIVER_INIT_MEMBER(mz80_state,mz80k) -{ -} - -void mz80_state::machine_reset() -{ - m_mz80k_tempo_strobe = 0; - m_mz80k_vertical = 0; - m_mz80k_cursor_cnt = 0; - m_mz80k_keyboard_line = 0; -} - - -READ8_MEMBER( mz80_state::mz80k_8255_portb_r ) -{ - char kbdrow[8]; - sprintf(kbdrow,"LINE%d", m_mz80k_keyboard_line); - if (m_mz80k_keyboard_line > 9) - return 0xff; - else - return ioport(kbdrow)->read(); -} - -READ8_MEMBER( mz80_state::mz80k_8255_portc_r ) -{ - UINT8 val = 0; - val |= m_mz80k_vertical ? 0x80 : 0x00; - val |= ((m_mz80k_cursor_cnt & 0x3f) > 31) ? 0x40 : 0x00; - val |= (m_cassette->get_state() & CASSETTE_MASK_UISTATE)== CASSETTE_PLAY ? 0x10 : 0x00; - - if (m_cassette->input() > 0.00) - val |= 0x20; - - return val; -} - -WRITE8_MEMBER( mz80_state::mz80k_8255_porta_w ) -{ - m_mz80k_keyboard_line = data & 0x0f; -} - -WRITE8_MEMBER( mz80_state::mz80k_8255_portc_w ) -{ -// logerror("mz80k_8255_portc_w %02x\n",data); -} - - -WRITE_LINE_MEMBER( mz80_state::pit_out0_changed ) -{ - if(!m_prev_state && state) - m_speaker_level++; - - m_prev_state = state; - m_speaker->level_w(BIT(m_speaker_level, 1)); -} - -WRITE_LINE_MEMBER( mz80_state::pit_out2_changed ) -{ - m_maincpu->set_input_line(0, HOLD_LINE); -} - -READ8_MEMBER( mz80_state::mz80k_strobe_r ) -{ - return 0x7e | (UINT8)m_mz80k_tempo_strobe; -} - -WRITE8_MEMBER( mz80_state::mz80k_strobe_w ) -{ - m_pit->write_gate0(BIT(data, 0)); -} diff --git a/src/mess/machine/nc.c b/src/mess/machine/nc.c deleted file mode 100644 index 07041c5c787..00000000000 --- a/src/mess/machine/nc.c +++ /dev/null @@ -1,87 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Wilbert Pol, Kevin Thacker -/*************************************************************************** - - nc.c - -***************************************************************************/ - -#include "emu.h" -#include "includes/nc.h" -#include "machine/i8251.h" - -/*************************************************************************************************/ -/* PCMCIA Ram Card management */ - -/* the data is stored as a simple memory dump, there is no header or other information */ -/* stores size of actual file on filesystem */ - - -/* this is not a real register, it is used to record card status */ -/* ==0, card not inserted, !=0 card is inserted */ - -// set pcmcia card present state -void nc_state::set_card_present_state(int state) -{ - m_card_status = state; -} - - -// this mask will prevent overwrites from end of data -int nc_state::card_calculate_mask(int size) -{ - /* memory block is visible as 16k blocks */ - /* mask can only operate on power of two sizes */ - /* memory cards normally in power of two sizes */ - /* maximum of 64 16k blocks can be accessed using memory paging of nc computer */ - /* max card size is therefore 1mb */ - for (int i = 14; i < 20; i++) - { - if (size < (1 << i)) - return 0x03f >> (19 - i); - } - - return 0x03f; -} - - -// load pcmcia card data -DEVICE_IMAGE_LOAD_MEMBER( nc_state, nc_pcmcia_card ) -{ - UINT32 size = m_card->common_get_size("rom"); - - m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_card->common_load_rom(m_card->get_rom_base(), size, "rom"); - - set_card_present_state(1); - m_membank_card_ram_mask = card_calculate_mask(size); - - return IMAGE_INIT_PASS; -} - - -// save pcmcia card data back -DEVICE_IMAGE_UNLOAD_MEMBER( nc_state, nc_pcmcia_card ) -{ - // if there is no data to write, quit - if (!m_card_size) - return; - - logerror("attempting card save\n"); - - // write data - image.fwrite(m_card_ram, m_card_size); - - logerror("write succeeded!\r\n"); - - // set card not present state - set_card_present_state(0); - m_card_size = 0; -} - -DRIVER_INIT_MEMBER( nc_state, nc ) -{ - // set card not present state - set_card_present_state(0); - m_card_size = 0; -} diff --git a/src/mess/machine/nes.c b/src/mess/machine/nes.c deleted file mode 100644 index c5cd79575ee..00000000000 --- a/src/mess/machine/nes.c +++ /dev/null @@ -1,208 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Brad Oliver,Fabio Priuli -/***************************************************************************** - - nes.c - - Nintendo Entertainment System (Famicom) - - ****************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "includes/nes.h" - -/*************************************************************************** - FUNCTIONS -***************************************************************************/ - -// to be probably removed (it does nothing since a long time) -int nes_state::nes_ppu_vidaccess( int address, int data ) -{ - return data; -} - -//------------------------------------------------- -// machine_reset -//------------------------------------------------- - -void nes_state::machine_reset() -{ - // Reset the mapper variables. Will also mark the char-gen ram as dirty - if (m_cartslot) - m_cartslot->pcb_reset(); - - m_maincpu->reset(); -} - -//------------------------------------------------- -// machine_start -//------------------------------------------------- - -void nes_state::machine_start() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - // CIRAM (Character Internal RAM) - // NES has 2KB of internal RAM which can be used to fill the 4x1KB banks of PPU RAM at $2000-$2fff - // Line A10 is exposed to the carts, so that games can change CIRAM mapping in PPU (we emulate this with the set_nt_mirroring - // function). CIRAM can also be disabled by the game (if e.g. VROM or cart RAM has to be used in PPU... - m_ciram = auto_alloc_array(machine(), UINT8, 0x800); - // other pointers got set in the loading routine, because they 'belong' to the cart itself - - m_io_disksel = ioport("FLIPDISK"); - - if (m_cartslot && m_cartslot->m_cart) - { - // Set up memory handlers - space.install_read_handler(0x4100, 0x5fff, read8_delegate(FUNC(nes_cart_slot_device::read_l), (nes_cart_slot_device *)m_cartslot)); - space.install_write_handler(0x4100, 0x5fff, write8_delegate(FUNC(nes_cart_slot_device::write_l), (nes_cart_slot_device *)m_cartslot)); - space.install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(nes_cart_slot_device::read_m), (nes_cart_slot_device *)m_cartslot)); - space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(nes_cart_slot_device::write_m), (nes_cart_slot_device *)m_cartslot)); - space.install_read_bank(0x8000, 0x9fff, "prg0"); - space.install_read_bank(0xa000, 0xbfff, "prg1"); - space.install_read_bank(0xc000, 0xdfff, "prg2"); - space.install_read_bank(0xe000, 0xffff, "prg3"); - space.install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(nes_cart_slot_device::write_h), (nes_cart_slot_device *)m_cartslot)); - - m_ppu->space(AS_PROGRAM).install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(device_nes_cart_interface::chr_r),m_cartslot->m_cart), write8_delegate(FUNC(device_nes_cart_interface::chr_w),m_cartslot->m_cart)); - m_ppu->space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(device_nes_cart_interface::nt_r),m_cartslot->m_cart), write8_delegate(FUNC(device_nes_cart_interface::nt_w),m_cartslot->m_cart)); - m_ppu->set_scanline_callback(ppu2c0x_scanline_delegate(FUNC(device_nes_cart_interface::scanline_irq),m_cartslot->m_cart)); - m_ppu->set_hblank_callback(ppu2c0x_hblank_delegate(FUNC(device_nes_cart_interface::hblank_irq),m_cartslot->m_cart)); - m_ppu->set_latch(ppu2c0x_latch_delegate(FUNC(device_nes_cart_interface::ppu_latch),m_cartslot->m_cart)); - - // install additional handlers (read_h, read_ex, write_ex) - if (m_cartslot->get_pcb_id() == STD_EXROM || m_cartslot->get_pcb_id() == STD_NROM368 || m_cartslot->get_pcb_id() == STD_DISKSYS - || m_cartslot->get_pcb_id() == GG_NROM || m_cartslot->get_pcb_id() == CAMERICA_ALADDIN || m_cartslot->get_pcb_id() == SUNSOFT_DCS - || m_cartslot->get_pcb_id() == BANDAI_DATACH || m_cartslot->get_pcb_id() == BANDAI_KARAOKE || m_cartslot->get_pcb_id() == BTL_2A03_PURITANS || m_cartslot->get_pcb_id() == AVE_MAXI15 - || m_cartslot->get_pcb_id() == KAISER_KS7022 || m_cartslot->get_pcb_id() == KAISER_KS7031 || m_cartslot->get_pcb_id() == BMC_VT5201 - || m_cartslot->get_pcb_id() == UNL_LH32 || m_cartslot->get_pcb_id() == UNL_LH10 || m_cartslot->get_pcb_id() == UNL_2708 - || m_cartslot->get_pcb_id() == UNL_43272 || m_cartslot->get_pcb_id() == BMC_G63IN1 || m_cartslot->get_pcb_id() == BMC_8157 - || m_cartslot->get_pcb_id() == BMC_GOLD150 || m_cartslot->get_pcb_id() == BMC_CH001 - || m_cartslot->get_pcb_id() == BMC_70IN1 || m_cartslot->get_pcb_id() == BMC_800IN1) - { - logerror("read_h installed!\n"); - space.install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(nes_cart_slot_device::read_h), (nes_cart_slot_device *)m_cartslot)); - } - - if (m_cartslot->get_pcb_id() == BTL_SMB2JB || m_cartslot->get_pcb_id() == UNL_AC08 || m_cartslot->get_pcb_id() == UNL_SMB2J || m_cartslot->get_pcb_id() == BTL_09034A) - { - logerror("write_ex installed!\n"); - space.install_write_handler(0x4020, 0x40ff, write8_delegate(FUNC(nes_cart_slot_device::write_ex), (nes_cart_slot_device *)m_cartslot)); - } - - if (m_cartslot->get_pcb_id() == KAISER_KS7017 || m_cartslot->get_pcb_id() == UNL_603_5052 || m_cartslot->get_pcb_id() == STD_DISKSYS) - { - logerror("write_ex & read_ex installed!\n"); - space.install_read_handler(0x4020, 0x40ff, read8_delegate(FUNC(nes_cart_slot_device::read_ex), (nes_cart_slot_device *)m_cartslot)); - space.install_write_handler(0x4020, 0x40ff, write8_delegate(FUNC(nes_cart_slot_device::write_ex), (nes_cart_slot_device *)m_cartslot)); - } - - m_cartslot->pcb_start(m_ciram); - m_cartslot->m_cart->pcb_reg_postload(machine()); - } - - // register saves - save_item(NAME(m_last_frame_flip)); - save_pointer(NAME(m_ciram), 0x800); -} - - -//------------------------------------------------- -// INPUTS -//------------------------------------------------- - -READ8_MEMBER(nes_state::nes_in0_r) -{ - UINT8 ret = 0x40; - ret |= m_ctrl1->read_bit0(); - ret |= m_ctrl1->read_bit34(); - return ret; -} - -READ8_MEMBER(nes_state::nes_in1_r) -{ - UINT8 ret = 0x40; - ret |= m_ctrl2->read_bit0(); - ret |= m_ctrl2->read_bit34(); - return ret; -} - -WRITE8_MEMBER(nes_state::nes_in0_w) -{ - m_ctrl1->write(data); - m_ctrl2->write(data); -} - - -READ8_MEMBER(nes_state::fc_in0_r) -{ - UINT8 ret = 0x40; - // bit 0 to controller port - ret |= m_ctrl1->read_bit0(); - - // expansion port bits (in the original FC, P2 controller was hooked to these lines - // too, so in principle some homebrew hardware modification could use the same - // connection with P1 controller too) - ret |= m_ctrl1->read_exp(0); - ret |= m_ctrl2->read_exp(0); - - // at the same time, we might have a standard joypad connected to the expansion port which - // shall be read as P3 (this is needed here to avoid implementing the expansion port as a - // different device compared to the standard control port... it might be changed later) - ret |= (m_exp->read_bit0() << 1); - // finally, read the expansion port as expected - ret |= m_exp->read_exp(0); - return ret; -} - -READ8_MEMBER(nes_state::fc_in1_r) -{ - UINT8 ret = 0x40; - // bit 0 to controller port - ret |= m_ctrl2->read_bit0(); - - // expansion port bits (in the original FC, P2 controller was hooked to these lines - // too, so in principle some homebrew hardware modification could use the same - // connection with P1 controller too) - ret |= m_ctrl1->read_exp(1); - ret |= m_ctrl2->read_exp(1); - - // finally, read the expansion port as expected (standard pad cannot be hooked as P4, so - // no read_bit0 here) - ret |= m_exp->read_exp(1); - return ret; -} - -WRITE8_MEMBER(nes_state::fc_in0_w) -{ - m_ctrl1->write(data); - m_ctrl2->write(data); - m_exp->write(data); -} - - -DRIVER_INIT_MEMBER(nes_state,famicom) -{ - // setup alt input handlers for additional FC input devices - address_space &space = machine().device("maincpu")->space(AS_PROGRAM); - space.install_read_handler(0x4016, 0x4016, read8_delegate(FUNC(nes_state::fc_in0_r), this)); - space.install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(nes_state::fc_in0_w), this)); - space.install_read_handler(0x4017, 0x4017, read8_delegate(FUNC(nes_state::fc_in1_r), this)); -} - -NESCTRL_BRIGHTPIXEL_CB(nes_state::bright_pixel) -{ - // get the pixel at the gun position - UINT32 pix = m_ppu->get_pixel(x, y); - - // get the color base from the ppu - UINT32 color_base = m_ppu->get_colorbase(); - - // check if the cursor is over a bright pixel - if ((pix == color_base + 0x20) || (pix == color_base + 0x30) || - (pix == color_base + 0x33) || (pix == color_base + 0x34)) - return true; - else - return false; -} diff --git a/src/mess/machine/nextkbd.c b/src/mess/machine/nextkbd.c deleted file mode 100644 index 7ff946b7916..00000000000 --- a/src/mess/machine/nextkbd.c +++ /dev/null @@ -1,456 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert - -#include "nextkbd.h" - -const device_type NEXTKBD = &device_creator; - -DEVICE_ADDRESS_MAP_START(amap, 32, nextkbd_device) - AM_RANGE(0x0, 0x3) AM_READWRITE8(status_snd_r, ctrl_snd_w, 0xff000000) - AM_RANGE(0x0, 0x3) AM_READWRITE8(status_kms_r, ctrl_kms_w, 0x00ff0000) - AM_RANGE(0x0, 0x3) AM_READWRITE8(status_dma_r, ctrl_dma_w, 0x0000ff00) - AM_RANGE(0x0, 0x3) AM_READWRITE8(status_cmd_r, ctrl_cmd_w, 0x000000ff) - AM_RANGE(0x4, 0x7) AM_READWRITE(cdata_r, cdata_w) - AM_RANGE(0x8, 0xb) AM_READWRITE(kmdata_r, kmdata_w) -ADDRESS_MAP_END - -nextkbd_device::nextkbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, NEXTKBD, "NEXTKBD", tag, owner, clock, "nextkbd", __FILE__), - int_change_cb(*this), - int_power_cb(*this), - int_nmi_cb(*this), - mousex(*this, "mousex"), - mousey(*this, "mousey"), - mousebtn(*this, "mousebtn") -{ -} - -void nextkbd_device::device_start() -{ - int_change_cb.resolve_safe(); - int_power_cb.resolve_safe(); - int_nmi_cb.resolve_safe(); - - poll_timer = timer_alloc(0); - - save_item(NAME(ctrl_snd)); - save_item(NAME(ctrl_kms)); - save_item(NAME(ctrl_dma)); - save_item(NAME(ctrl_cmd)); - save_item(NAME(cdata)); - save_item(NAME(kmdata)); - save_item(NAME(fifo_ir)); - save_item(NAME(fifo_iw)); - save_item(NAME(fifo_size)); - save_item(NAME(fifo)); - save_item(NAME(modifiers_state)); - save_item(NAME(prev_mousex)); - save_item(NAME(prev_mousey)); - save_item(NAME(prev_mousebtn)); -} - -void nextkbd_device::device_reset() -{ - ctrl_snd = 0x00; - ctrl_kms = 0x00; - ctrl_dma = 0x00; - ctrl_cmd = 0x00; - cdata = 0; - kmdata = 0; - fifo_ir = 0; - fifo_iw = 0; - fifo_size = 0; - memset(fifo, 0, sizeof(fifo)); - modifiers_state = 0; - nmi_active = false; - prev_mousex = 0; - prev_mousey = 0; - prev_mousebtn = 0; - km_address = 0; - poll_timer->adjust(attotime::from_hz(200), 0, attotime::from_hz(200)); -} - -void nextkbd_device::send() -{ - if(ctrl_kms & C_KBD_DATA) - return; - - kmdata = fifo_pop(); - ctrl_kms |= C_KBD_DATA; - if(!(ctrl_kms & C_KBD_INTERRUPT)) { - ctrl_kms |= C_KBD_INTERRUPT; - int_change_cb(true); - } -} - -void nextkbd_device::update_mouse(bool force_update) -{ - UINT32 cur_mousex = mousex->read(); - UINT32 cur_mousey = mousey->read(); - UINT32 cur_mousebtn = mousebtn->read(); - - if(!force_update && cur_mousex == prev_mousex && cur_mousey == prev_mousey && cur_mousebtn == prev_mousebtn) - return; - - INT32 deltax = -(cur_mousex - prev_mousex); - INT32 deltay = -(cur_mousey - prev_mousey); - - if(deltax >= 128) - deltax -= 256; - if(deltax < -128) - deltax += 256; - if(deltay >= 128) - deltay -= 256; - if(deltay < -128) - deltay += 256; - - prev_mousex = cur_mousex; - prev_mousey = cur_mousey; - prev_mousebtn = cur_mousebtn; - - if(deltax < -0x40) - deltax = -0x40; - if(deltax > 0x3f) - deltax = 0x3f; - if(deltay < -0x40) - deltay = -0x40; - if(deltay > 0x3f) - deltay = 0x3f; - - UINT32 base = ((deltax & 0x7f) << 1) | ((deltay & 0x7f) << 9) | cur_mousebtn; - fifo_push(km_address | D_SECONDARY | base); - send(); -} - -void nextkbd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if(!fifo_empty()) - send(); - - update_mouse(false); -} - -void nextkbd_device::fifo_push(UINT32 val) -{ - if(fifo_size == FIFO_SIZE) - return; - - fifo_size++; - fifo[fifo_iw++] = val; - if(fifo_iw == FIFO_SIZE) - fifo_iw = 0; -} - -UINT32 nextkbd_device::fifo_pop() -{ - if(fifo_size == 0) - return 0; - - fifo_size--; - UINT32 res = fifo[fifo_ir++]; - if(fifo_ir == FIFO_SIZE) - fifo_ir = 0; - - return res; -} - -bool nextkbd_device::fifo_empty() const -{ - return !fifo_size; -} - -READ8_MEMBER( nextkbd_device::status_snd_r ) -{ - logerror("%s: status_snd_r %02x (%08x)\n", tag(), ctrl_snd, (unsigned int)space.device().safe_pc()); - return ctrl_snd; -} - -READ8_MEMBER( nextkbd_device::status_kms_r ) -{ - logerror("%s: status_kms_r %02x (%08x)\n", tag(), ctrl_kms, (unsigned int)space.device().safe_pc()); - return ctrl_kms; -} - -READ8_MEMBER( nextkbd_device::status_dma_r ) -{ - logerror("%s: status_dma_r %02x (%08x)\n", tag(), ctrl_dma, (unsigned int)space.device().safe_pc()); - return ctrl_dma; -} - -READ8_MEMBER( nextkbd_device::status_cmd_r ) -{ - logerror("%s: status_cmd_r %02x (%08x)\n", tag(), ctrl_cmd, (unsigned int)space.device().safe_pc()); - return ctrl_cmd; -} - -READ32_MEMBER( nextkbd_device::cdata_r ) -{ - logerror("%s: cdata_r %08x @ %08x (%08x)\n", tag(), cdata, mem_mask, (unsigned int)space.device().safe_pc()); - return cdata; -} - -READ32_MEMBER( nextkbd_device::kmdata_r ) -{ - UINT8 old = ctrl_kms; - ctrl_kms &= ~(C_KBD_INTERRUPT|C_KBD_DATA); - if(old & C_KBD_INTERRUPT) - int_change_cb(false); - logerror("%s: kmdata_r %08x @ %08x (%08x)\n", tag(), kmdata, mem_mask, (unsigned int)space.device().safe_pc()); - return kmdata; -} - -WRITE8_MEMBER( nextkbd_device::ctrl_snd_w ) -{ - UINT8 old = ctrl_snd; - ctrl_snd = (ctrl_snd & ~C_SOUND_WMASK) | (data & C_SOUND_WMASK); - UINT8 diff = old ^ ctrl_snd; - - logerror("%s: ctrl_snd_w %02x | %02x (%08x)\n", tag(), ctrl_snd, diff, (unsigned int)space.device().safe_pc()); -} - -WRITE8_MEMBER( nextkbd_device::ctrl_kms_w ) -{ - UINT8 old = ctrl_kms; - ctrl_kms = (ctrl_kms & ~C_KMS_WMASK) | (data & C_KMS_WMASK); - UINT8 diff = old ^ ctrl_kms; - - logerror("%s: ctrl_kms_w %02x | %02x (%08x)\n", tag(), ctrl_kms, diff, (unsigned int)space.device().safe_pc()); -} - -WRITE8_MEMBER( nextkbd_device::ctrl_dma_w ) -{ - UINT8 old = ctrl_dma; - ctrl_dma = (ctrl_dma & ~C_WMASK) | (data & C_WMASK); - UINT8 diff = old ^ ctrl_dma; - - logerror("%s: ctrl_dma_w %02x | %02x (%08x)\n", tag(), ctrl_dma, diff, (unsigned int)space.device().safe_pc()); -} - -WRITE8_MEMBER( nextkbd_device::ctrl_cmd_w ) -{ - ctrl_cmd = data; - logerror("%s: ctrl_cmd_w %02x (%08x)\n", tag(), ctrl_cmd, (unsigned int)space.device().safe_pc()); -} - -WRITE32_MEMBER( nextkbd_device::cdata_w ) -{ - COMBINE_DATA(&cdata); - logerror("%s: cdata_w %08x @ %08x (%08x)\n", tag(), data, mem_mask, (unsigned int)space.device().safe_pc()); - handle_command(); -} - -WRITE32_MEMBER( nextkbd_device::kmdata_w ) -{ - logerror("%s: kmdata_w %08x @ %08x (%08x)\n", tag(), data, mem_mask, (unsigned int)space.device().safe_pc()); -} - -INPUT_CHANGED_MEMBER( nextkbd_device::update ) -{ - int bank = (int)(FPTR)param; - switch(bank) { - case 0: case 1: case 2: { - int index; - for(index=0; index < 32; index++) - if(field.mask() & (1 << index)) - break; - assert(index != 32); - index += bank*32; - UINT16 val = index | modifiers_state | D_KBD_VALID; - if(!newval) - val |= D_KBD_KEYDOWN; - if(val == 0x8826 || val == 0x884a) { - nmi_active = true; - int_nmi_cb(true); - } else if(nmi_active) { - nmi_active = false; - int_nmi_cb(false); - } - fifo_push(val | D_MASTER | km_address); - send(); - break; - } - - case 3: - if(newval) - modifiers_state |= field.mask(); - else - modifiers_state &= ~field.mask(); - fifo_push(modifiers_state | D_MASTER | km_address); - - send(); - break; - - case 4: - if(field.mask() & 1) - int_power_cb(newval & 1); - break; - } -} - -void nextkbd_device::handle_fifo_command() -{ - logerror("%s: Fifo command %08x?\n", tag(), cdata); - fifo_ir = 0; - fifo_iw = 0; - fifo_size = 0; - memset(fifo, 0, sizeof(fifo)); - if(ctrl_kms & C_KBD_INTERRUPT) - int_change_cb(false); - ctrl_kms &= ~(C_KBD_INTERRUPT|C_KBD_DATA); -} - -void nextkbd_device::handle_kbd_command() -{ - switch(cdata >> 24) { - case 0x00: - logerror("%s: Keyboard LED control %06x?\n", tag(), cdata & 0xffffff); - ctrl_kms |= C_KBD_DATA; // Hmmmm. The rom wants it, but I'm not sure if data is actually expected - break; - - case 0xef: - logerror("%s: Set keyboard/mouse address to %d\n", tag(), (cdata >> 17) & 7); - km_address = ((cdata >> 17) & 7) << 25; - ctrl_kms |= C_KBD_DATA; // Hmmmm. The rom wants it, but I'm not sure if data is actually expected - break; - - default: - logerror("%s: Unhandled keyboard command %02x.%06x\n", tag(), cdata >> 24, cdata & 0xffffff); - break; - } -} - -void nextkbd_device::handle_command() -{ - switch(ctrl_cmd) { - case 0xc5: - handle_kbd_command(); - break; - - case 0xc6: - handle_fifo_command(); - break; - - default: - logerror("%s: Unhandled command %02x.%08x\n", tag(), ctrl_cmd, cdata); - break; - } -} - -static INPUT_PORTS_START(nextkbd_keymap) - PORT_START("0") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) - PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) - PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x02000000, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) - PORT_BIT(0x04000000, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) - PORT_BIT(0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 0) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - - PORT_START("1") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) // Keypad = ? - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) - PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x01000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x04000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x08000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x10000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x20000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x40000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x80000000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 1) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START("2") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0xfffe0000, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 2) - - PORT_START("modifiers") - PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_NAME("Control") - PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("Shift (Left)") - PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("Shift (Right)") - PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_LWIN) PORT_NAME("Command (Left)") - PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_RWIN) PORT_NAME("Command (Right)") - PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_NAME("Alt (Left)") - PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Alt (Right)") - PORT_BIT(0xffff80ff, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 3) - - PORT_START("special") - PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 4) PORT_CODE(KEYCODE_HOME) PORT_NAME("Power") - PORT_BIT(0xfffffffe, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CHANGED_MEMBER(DEVICE_SELF, nextkbd_device, update, 4) - - PORT_START("mousex") - PORT_BIT( 0x00ff, 0, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(1) - - PORT_START("mousey") - PORT_BIT( 0x00ff, 0, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(1) - - PORT_START("mousebtn") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) -INPUT_PORTS_END - -ioport_constructor nextkbd_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(nextkbd_keymap); -} diff --git a/src/mess/machine/nextkbd.h b/src/mess/machine/nextkbd.h deleted file mode 100644 index e0be0c7836c..00000000000 --- a/src/mess/machine/nextkbd.h +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -#ifndef __NEXTKBD_H__ -#define __NEXTKBD_H__ - -#include "emu.h" - -#define MCFG_NEXTKBD_INT_CHANGE_CALLBACK(_write) \ - devcb = &nextkbd_device::set_int_change_wr_callback(*device, DEVCB_##_write); - -#define MCFG_NEXTKBD_INT_POWER_CALLBACK(_write) \ - devcb = &nextkbd_device::set_int_power_wr_callback(*device, DEVCB_##_write); - -#define MCFG_NEXTKBD_INT_NMI_CALLBACK(_write) \ - devcb = &nextkbd_device::set_int_nmi_wr_callback(*device, DEVCB_##_write); - -class nextkbd_device : public device_t { -public: - nextkbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_int_change_wr_callback(device_t &device, _Object object) { return downcast(device).int_change_cb.set_callback(object); } - template static devcb_base &set_int_power_wr_callback(device_t &device, _Object object) { return downcast(device).int_power_cb.set_callback(object); } - template static devcb_base &set_int_nmi_wr_callback(device_t &device, _Object object) { return downcast(device).int_nmi_cb.set_callback(object); } - - DECLARE_ADDRESS_MAP(amap, 32); - - DECLARE_READ8_MEMBER(status_snd_r); - DECLARE_READ8_MEMBER(status_kms_r); - DECLARE_READ8_MEMBER(status_dma_r); - DECLARE_READ8_MEMBER(status_cmd_r); - DECLARE_READ32_MEMBER(cdata_r); - DECLARE_READ32_MEMBER(kmdata_r); - - DECLARE_WRITE8_MEMBER(ctrl_snd_w); - DECLARE_WRITE8_MEMBER(ctrl_kms_w); - DECLARE_WRITE8_MEMBER(ctrl_dma_w); - DECLARE_WRITE8_MEMBER(ctrl_cmd_w); - DECLARE_WRITE32_MEMBER(cdata_w); - DECLARE_WRITE32_MEMBER(kmdata_w); - - bool int_level_get(); - - DECLARE_INPUT_CHANGED_MEMBER(update); - -protected: - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual ioport_constructor device_input_ports() const; - -private: - // Big thanks to the previous emulator for that information - enum { - C_SOUND_OUT_ENABLE = 0x80, // rw - C_SOUND_OUT_REQUEST = 0x40, // r - C_SOUND_OUT_UNDERRUN = 0x20, // rw - C_SOUND_IN_ENABLE = 0x08, // rw - C_SOUND_IN_REQUEST = 0x04, // r - C_SOUND_IN_OVERRUN = 0x02, // rw - C_SOUND_WMASK = 0xaa, - - C_KBD_INTERRUPT = 0x80, // r - C_KBD_DATA = 0x40, // r - C_KBD_OVERRUN = 0x20, // rw - C_KBD_NMI = 0x10, // rw? - C_KMS_INTERRUPT = 0x08, // r - C_KMS_DATA = 0x04, // r - C_KMS_OVERRUN = 0x02, // rw - C_KMS_WMASK = 0x22, - - C_SDMA_OUT_PENDING = 0x80, // r - C_SDMA_OUT_RUNNING = 0x40, // r - C_CDMA_PENDING = 0x20, // r - C_CDMA_RUNNING = 0x10, // r - C_KMS_ENABLE = 0x02, // rw - C_LOOPBACK = 0x01, // rw - C_WMASK = 0x03, - - D_ERROR = 0x40000000, - D_USER = 0x20000000, - D_MASTER = 0x10000000, - D_SECONDARY = 0x01000000, - D_VERSION_OLD = 0x00000000, - D_VERSION_NEW = 0x00010000, - D_VERSION_DIGITAL = 0x00020000, - - D_KBD_VALID = 0x00008000, - D_KBD_KEYDOWN = 0x00000080 - }; - - enum { FIFO_SIZE = 32 }; - - devcb_write_line int_change_cb, int_power_cb, int_nmi_cb; - required_ioport mousex; - required_ioport mousey; - required_ioport mousebtn; - - emu_timer *poll_timer; - bool nmi_active; - - UINT32 cdata, kmdata, fifo_ir, fifo_iw, fifo_size; - UINT32 fifo[FIFO_SIZE]; - UINT32 km_address; - UINT32 prev_mousex, prev_mousey, prev_mousebtn; - UINT16 modifiers_state; - UINT8 ctrl_snd, ctrl_kms, ctrl_dma, ctrl_cmd; - - void fifo_push(UINT32 val); - UINT32 fifo_pop(); - bool fifo_empty() const; - - void update_mouse(bool force_update); - void send(); - void handle_fifo_command(); - void handle_kbd_command(); - void handle_command(); -}; - -extern const device_type NEXTKBD; - -#endif diff --git a/src/mess/machine/nextmo.c b/src/mess/machine/nextmo.c deleted file mode 100644 index 20cfba9aa6c..00000000000 --- a/src/mess/machine/nextmo.c +++ /dev/null @@ -1,198 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert - -#include "emu.h" -#include "nextmo.h" - -const device_type NEXTMO = &device_creator; - -DEVICE_ADDRESS_MAP_START(map, 8, nextmo_device) - AM_RANGE(0x04, 0x04) AM_READWRITE(r4_r, r4_w) - AM_RANGE(0x05, 0x05) AM_READWRITE(r5_r, r5_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(r6_r, r6_w) - AM_RANGE(0x07, 0x07) AM_READWRITE(r7_r, r7_w) - AM_RANGE(0x08, 0x08) AM_READWRITE(r8_r, r8_w) - AM_RANGE(0x09, 0x09) AM_READWRITE(r9_r, r9_w) - AM_RANGE(0x0a, 0x0a) AM_READWRITE(ra_r, ra_w) - AM_RANGE(0x0b, 0x0b) AM_READWRITE(rb_r, rb_w) - AM_RANGE(0x10, 0x17) AM_READWRITE(r10_r, r10_w) -ADDRESS_MAP_END - -nextmo_device::nextmo_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, NEXTMO, "NeXT Magneto-optical drive", tag, owner, clock, "nextmo", __FILE__), - r4(0), - irq_cb(*this), - drq_cb(*this) -{ -} - -void nextmo_device::device_start() -{ - irq_cb.resolve_safe(); - drq_cb.resolve_safe(); -} - -void nextmo_device::device_reset() -{ -} - -READ8_MEMBER(nextmo_device::r4_r) -{ - logerror("nextmo: r4_r %02x (%08x)\n", r4, space.device().safe_pc()); - return r4; -} - -WRITE8_MEMBER(nextmo_device::r4_w) -{ - if(r4 & 1) - device_reset(); - r4 = (r4 & (~data & 0xfc)) | (data & 3); - logerror("nextmo: r4_w %02x (%08x)\n", r4, space.device().safe_pc()); -} - -READ8_MEMBER(nextmo_device::r5_r) -{ - logerror("nextmo: r5_r %02x (%08x)\n", r5, space.device().safe_pc()); - return r5; -} - -WRITE8_MEMBER(nextmo_device::r5_w) -{ - r5 = data; - logerror("nextmo: r5_w %02x (%08x)\n", r5, space.device().safe_pc()); -} - -READ8_MEMBER(nextmo_device::r6_r) -{ - logerror("nextmo: r6_r %02x (%08x)\n", r6, space.device().safe_pc()); - return r6; -} - -WRITE8_MEMBER(nextmo_device::r6_w) -{ - r6 = data; - logerror("nextmo: r6_w %02x (%08x)\n", r6, space.device().safe_pc()); -} - -READ8_MEMBER(nextmo_device::r7_r) -{ - logerror("nextmo: r7_r %02x (%08x)\n", r7, space.device().safe_pc()); - return r7; -} - -WRITE8_MEMBER(nextmo_device::r7_w) -{ - r7 = data; - logerror("nextmo: r7_w %02x (%08x)\n", r7, space.device().safe_pc()); - if(r7 & 0xc0) { - logerror("nextmo: start dma %02x %02x\n", r6, r7); - sector_pos = 0; - if(!drq_cb.isnull()) - drq_cb(true); - } -} - -UINT8 nextmo_device::dma_r() -{ - UINT8 r = 0; - if(r7 & 0x80) - r = sector[sector_pos++]; - check_dma_end(); - return r; -} - -void nextmo_device::dma_w(UINT8 data) -{ - if(r7 & 0x40) - sector[sector_pos++] = data; - check_dma_end(); -} - -void nextmo_device::check_dma_end() -{ - int limit; - if(r7 & 0x40) - limit = r6 & 0x20 ? 0x510 : 0x400; - else - limit = r6 & 0x20 ? 0x400 : 0x510; - if(sector_pos == limit) { - if(!drq_cb.isnull()) - drq_cb(false); - if(r7 & 0x40) { - if(r6 & 0x20) - check_ecc(); - else - compute_ecc(); - } - r7 &= 0x3f; - r4 |= 0x08; - } -} - -READ8_MEMBER(nextmo_device::r8_r) -{ - logerror("nextmo: r8_r (%08x)\n", space.device().safe_pc()); - return 0x00; -} - -WRITE8_MEMBER(nextmo_device::r8_w) -{ - logerror("nextmo: r8_w %02x (%08x)\n", data, space.device().safe_pc()); -} - -READ8_MEMBER(nextmo_device::r9_r) -{ - logerror("nextmo: r9_r (%08x)\n", space.device().safe_pc()); - return 0x00; -} - -WRITE8_MEMBER(nextmo_device::r9_w) -{ - logerror("nextmo: r9_w %02x (%08x)\n", data, space.device().safe_pc()); -} - -READ8_MEMBER(nextmo_device::ra_r) -{ - logerror("nextmo: ra_r (%08x)\n", space.device().safe_pc()); - return 0x00; -} - -WRITE8_MEMBER(nextmo_device::ra_w) -{ - logerror("nextmo: ra_w %02x (%08x)\n", data, space.device().safe_pc()); -} - -READ8_MEMBER(nextmo_device::rb_r) -{ - logerror("nextmo: rb_r (%08x)\n", space.device().safe_pc()); - return 0x24; -} - -WRITE8_MEMBER(nextmo_device::rb_w) -{ - logerror("nextmo: rb_w %02x (%08x)\n", data, space.device().safe_pc()); -} - -READ8_MEMBER(nextmo_device::r10_r) -{ - logerror("nextmo: r10_r %d (%08x)\n", offset, space.device().safe_pc()); - return 0x00; -} - -WRITE8_MEMBER(nextmo_device::r10_w) -{ - logerror("nextmo: r10_w %d, %02x (%08x)\n", offset, data, space.device().safe_pc()); -} - -void nextmo_device::check_ecc() -{ - logerror("nextmo: check_ecc\n"); - for(int i=0; i<0x400; i++) - sector[i] = i; -} - -void nextmo_device::compute_ecc() -{ - logerror("nextmo: compute_ecc\n"); - memset(sector+0x400, 0, 0x110); -} diff --git a/src/mess/machine/nextmo.h b/src/mess/machine/nextmo.h deleted file mode 100644 index 427d9d81862..00000000000 --- a/src/mess/machine/nextmo.h +++ /dev/null @@ -1,61 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Olivier Galibert -#ifndef NEXTMO_H -#define NEXTMO_H - -#define MCFG_NEXTMO_IRQ_CALLBACK(_write) \ - devcb = &nextmo_device::set_irq_wr_callback(*device, DEVCB_##_write); - -#define MCFG_NEXTMO_DRQ_CALLBACK(_write) \ - devcb = &nextmo_device::set_drq_wr_callback(*device, DEVCB_##_write); - -class nextmo_device : public device_t -{ -public: - nextmo_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).irq_cb.set_callback(object); } - template static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast(device).drq_cb.set_callback(object); } - - DECLARE_ADDRESS_MAP(map, 32); - - DECLARE_READ8_MEMBER(r4_r); - DECLARE_WRITE8_MEMBER(r4_w); - DECLARE_READ8_MEMBER(r5_r); - DECLARE_WRITE8_MEMBER(r5_w); - DECLARE_READ8_MEMBER(r6_r); - DECLARE_WRITE8_MEMBER(r6_w); - DECLARE_READ8_MEMBER(r7_r); - DECLARE_WRITE8_MEMBER(r7_w); - DECLARE_READ8_MEMBER(r8_r); - DECLARE_WRITE8_MEMBER(r8_w); - DECLARE_READ8_MEMBER(r9_r); - DECLARE_WRITE8_MEMBER(r9_w); - DECLARE_READ8_MEMBER(ra_r); - DECLARE_WRITE8_MEMBER(ra_w); - DECLARE_READ8_MEMBER(rb_r); - DECLARE_WRITE8_MEMBER(rb_w); - DECLARE_READ8_MEMBER(r10_r); - DECLARE_WRITE8_MEMBER(r10_w); - - UINT8 dma_r(); - void dma_w(UINT8 data); - -protected: - virtual void device_start(); - virtual void device_reset(); - -private: - UINT8 sector[0x510]; - UINT8 r4, r5, r6, r7; - devcb_write_line irq_cb, drq_cb; - int sector_pos; - - void check_dma_end(); - void check_ecc(); - void compute_ecc(); -}; - -extern const device_type NEXTMO; - -#endif diff --git a/src/mess/machine/ngen_kb.c b/src/mess/machine/ngen_kb.c deleted file mode 100644 index 4c901ea5d41..00000000000 --- a/src/mess/machine/ngen_kb.c +++ /dev/null @@ -1,231 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -// Convergent NGEN keyboard device - -#include "ngen_kb.h" - -ngen_keyboard_device::ngen_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, NGEN_KEYBOARD, "NGEN Keyboard", tag, owner, 0, "ngen_keyboard", __FILE__), - m_keys_down(false) -{ -} - - -void ngen_keyboard_device::write(UINT8 data) -{ - // To be figured out - // Code 0x92 is sent on startup, perhaps resets the keyboard MCU - // Codes 0xAx and 0xBx appear to control the keyboard LEDs, lower nibbles controlling the state of the LEDs - // When setting an error code via the LEDs, 0xB0 then 0xAE is sent (presumably for error code 0xE0), - // so that means that 0xAx controls the Overtype, Lock, F1 and F2 LEDs, and 0xBx controls the F3, F8, F9 and F10 LEDs. - logerror("KB: received character %02x\n",data); - switch(data) - { - case 0x92: // reset(?) - m_last_reset = true; - break; - } -} - -UINT8 ngen_keyboard_device::row_number(UINT8 code) -{ - if BIT(code,0) return 0; - if BIT(code,1) return 1; - if BIT(code,2) return 2; - if BIT(code,3) return 3; - if BIT(code,4) return 4; - if BIT(code,5) return 5; - if BIT(code,6) return 6; - if BIT(code,7) return 7; - return 0; -} - -UINT8 ngen_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) -{ - int i; - UINT8 code = 0; - UINT8 key_code = 0; - UINT8 retVal = 0x00; - UINT8 shift = BIT(m_io_kbdc->read(), 1); - UINT8 caps = BIT(m_io_kbdc->read(), 2); - UINT8 ctrl = BIT(m_io_kbdc->read(), 0); - i = *scan_line; - { - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - else - if (i == 9) code = m_io_kbd9->read(); - - if (code != 0) - { - if (i==0 && shift==0) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - if (i==0 && shift==1) { - key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers - } - if (i==1 && shift==0) { - if (row_number(code) < 4) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i==1 && shift==1) { - if (row_number(code) < 4) { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i>=2 && i<=4 && (shift ^ caps)==0 && ctrl==0) { - key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters - } - if (i>=2 && i<=4 && (shift ^ caps)==1 && ctrl==0) { - key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters - } - if (i>=2 && i<=5 && ctrl==1) { - key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters - } - if (i==5 && shift==1 && ctrl==0) { - if (row_number(code)<7) { - if (row_number(code)<3) { - key_code = (caps ? 0x60 : 0x40) + row_number(code) + (i-2)*8; // for big letters - } else { - key_code = 0x60 + row_number(code) + (i-2)*8; // for upper symbols letters - } - } else { - key_code = 0x40 + row_number(code) + (i-2)*8; // for DEL it is switched - } - } - if (i==5 && shift==0 && ctrl==0) { - if (row_number(code)<7) { - if (row_number(code)<3) { - key_code = (caps ? 0x40 : 0x60) + row_number(code) + (i-2)*8; // for small letters - } else { - key_code = 0x40 + row_number(code) + (i-2)*8; // for lower symbols letters - } - } else { - key_code = 0x60 + row_number(code) + (i-2)*8; // for DEL it is switched - } - } - - if (i==6) { - switch(row_number(code)) - { -/* case 0: key_code = 0x11; break; - case 1: key_code = 0x12; break; - case 2: key_code = 0x13; break; - case 3: key_code = 0x14; break;*/ - case 4: key_code = 0x20; break; // Space - case 5: key_code = 0x0A; break; // LineFeed - case 6: key_code = 0x09; break; // TAB - case 7: key_code = 0x0D; break; // Enter - } - } - if (i==7) - { - switch(row_number(code)) - { - case 0: key_code = 0x1B; break; // Escape - case 1: key_code = 0x08; break; // Backspace - } - } - else - if (i==8) - { - key_code = row_number(code)+0x81; - if (ctrl) key_code+=0x10; - if (shift) key_code+=0x20; - } - else - if (i==9) - { - key_code = row_number(code)+0x89; - if (ctrl) key_code+=0x10; - if (shift) key_code+=0x20; - } - m_keys_down = true; - m_last_reset = false; - retVal = key_code; - } - else - { - *scan_line += 1; - if (*scan_line==10) - *scan_line = 0; - if(m_keys_down) - { - retVal = 0xc0; - m_keys_down = false; - } - } - } - return retVal; -} - -static INPUT_PORTS_START( ngen_keyboard ) - PORT_INCLUDE(generic_keyboard) - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_19200, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_19200, "19200") // TODO: Based on the RAM refresh timer (~78kHz) to be 19530Hz - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_NONE, "None") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_2, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_2, "2") -INPUT_PORTS_END - - -ioport_constructor ngen_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(ngen_keyboard); -} - -void ngen_keyboard_device::device_start() -{ - serial_keyboard_device::device_start(); - set_rcv_rate(19200); -} - -void ngen_keyboard_device::device_reset() -{ - serial_keyboard_device::device_reset(); - m_keys_down = false; - m_last_reset = true; -} - -void ngen_keyboard_device::rcv_complete() -{ - receive_register_extract(); - write(get_received_char()); -} - -const device_type NGEN_KEYBOARD = &device_creator; diff --git a/src/mess/machine/ngen_kb.h b/src/mess/machine/ngen_kb.h deleted file mode 100644 index 4daa72422f4..00000000000 --- a/src/mess/machine/ngen_kb.h +++ /dev/null @@ -1,33 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -// Convergent NGEN keyboard - -#ifndef NGEN_KB_H_ -#define NGEN_KB_H_ - -#include "bus/rs232/keyboard.h" - -class ngen_keyboard_device : public serial_keyboard_device -{ -public: - ngen_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ioport_constructor device_input_ports() const; - virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) { device_serial_interface::rx_w(state); } - -protected: - virtual void device_start(); - virtual void device_reset(); - virtual void rcv_complete(); - -private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); - UINT8 row_number(UINT8 code); - void write(UINT8 data); - - bool m_keys_down; - bool m_last_reset; -}; - -extern const device_type NGEN_KEYBOARD; - -#endif /* NGENKB_H_ */ diff --git a/src/mess/machine/ondra.c b/src/mess/machine/ondra.c deleted file mode 100644 index ca9d927217d..00000000000 --- a/src/mess/machine/ondra.c +++ /dev/null @@ -1,101 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Ondra driver by Miodrag Milanovic - - 08/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "includes/ondra.h" - - -READ8_MEMBER(ondra_state::ondra_keyboard_r) -{ - UINT8 retVal = 0x00; - double valcas = m_cassette->input(); - - if ( valcas < 0.00) { - retVal = 0x80; - } - - switch ( offset & 0x0f ) - { - case 0: retVal |= m_line0->read(); break; - case 1: retVal |= m_line1->read(); break; - case 2: retVal |= m_line2->read(); break; - case 3: retVal |= m_line3->read(); break; - case 4: retVal |= m_line4->read(); break; - case 5: retVal |= m_line5->read(); break; - case 6: retVal |= m_line6->read(); break; - case 7: retVal |= m_line7->read(); break; - case 8: retVal |= m_line8->read(); break; - case 9: retVal |= m_line9->read(); break; - default: retVal |= 0x1f; break; - } - - return retVal; -} - -void ondra_state::ondra_update_banks() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *mem = m_region_maincpu->base(); - - if (m_bank1_status==0) { - space.unmap_write(0x0000, 0x3fff); - m_bank1->set_base(mem + 0x010000); - } else { - space.install_write_bank(0x0000, 0x3fff, "bank1"); - m_bank1->set_base(m_ram->pointer() + 0x0000); - } - m_bank2->set_base(m_ram->pointer() + 0x4000); - if (m_bank2_status==0) { - space.install_readwrite_bank(0xe000, 0xffff, "bank3"); - m_bank3->set_base(m_ram->pointer() + 0xe000); - } else { - space.unmap_write(0xe000, 0xffff); - space.install_read_handler (0xe000, 0xffff, read8_delegate(FUNC(ondra_state::ondra_keyboard_r),this)); - } -} - -WRITE8_MEMBER(ondra_state::ondra_port_03_w) -{ - m_video_enable = data & 1; - m_bank1_status = (data >> 1) & 1; - m_bank2_status = (data >> 2) & 1; - ondra_update_banks(); - m_cassette->output(((data >> 3) & 1) ? -1.0 : +1.0); -} - -WRITE8_MEMBER(ondra_state::ondra_port_09_w) -{ -} - -WRITE8_MEMBER(ondra_state::ondra_port_0a_w) -{ -} - -TIMER_CALLBACK_MEMBER(ondra_state::nmi_check_callback) -{ - if ((m_nmi->read() & 1) == 1) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } -} - -void ondra_state::machine_reset() -{ - m_bank1_status = 0; - m_bank2_status = 0; - ondra_update_banks(); -} - -void ondra_state::machine_start() -{ - machine().scheduler().timer_pulse(attotime::from_hz(10), timer_expired_delegate(FUNC(ondra_state::nmi_check_callback),this)); -} diff --git a/src/mess/machine/orao.c b/src/mess/machine/orao.c deleted file mode 100644 index 5540d9092fb..00000000000 --- a/src/mess/machine/orao.c +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Orao machine driver by Miodrag Milanovic - - 23/02/2008 Sound support added. - 22/02/2008 Preliminary driver. - -****************************************************************************/ - -#include "emu.h" -#include "sound/dac.h" -#include "imagedev/cassette.h" -#include "includes/orao.h" - - -/* Driver initialization */ -DRIVER_INIT_MEMBER(orao_state,orao) -{ - memset(m_memory,0xff,0x6000); -} - -DRIVER_INIT_MEMBER(orao_state,orao103) -{ - memset(m_memory,0xff,0x6000); -} - -void orao_state::machine_reset() -{ -} - -READ8_MEMBER(orao_state::orao_io_r) -{ - double level; - - switch(offset) { - /* Keyboard*/ - case 0x07FC : return m_line[0]->read(); - case 0x07FD : return m_line[1]->read(); - case 0x07FA : return m_line[2]->read(); - case 0x07FB : return m_line[3]->read(); - case 0x07F6 : return m_line[4]->read(); - case 0x07F7 : return m_line[5]->read(); - case 0x07EE : return m_line[6]->read(); - case 0x07EF : return m_line[7]->read(); - case 0x07DE : return m_line[8]->read(); - case 0x07DF : return m_line[9]->read(); - case 0x07BE : return m_line[10]->read(); - case 0x07BF : return m_line[11]->read(); - case 0x077E : return m_line[12]->read(); - case 0x077F : return m_line[13]->read(); - case 0x06FE : return m_line[14]->read(); - case 0x06FF : return m_line[15]->read(); - case 0x05FE : return m_line[16]->read(); - case 0x05FF : return m_line[17]->read(); - case 0x03FE : return m_line[18]->read(); - case 0x03FF : return m_line[19]->read(); - /* Tape */ - case 0x07FF : - level = m_cassette->input(); - if (level < 0) { - return 0x00; - } - return 0xff; - } - - - return 0xff; -} - - -WRITE8_MEMBER(orao_state::orao_io_w) -{ - if (offset == 0x0800) - { - m_speaker->level_w(m_beep); - m_beep ^= 1; - } -} diff --git a/src/mess/machine/orion.c b/src/mess/machine/orion.c deleted file mode 100644 index 4556778597b..00000000000 --- a/src/mess/machine/orion.c +++ /dev/null @@ -1,594 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Orion machine driver by Miodrag Milanovic - - 22/04/2008 Orion Pro added - 02/04/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" -#include "includes/orion.h" - -#define SCREEN_WIDTH_384 48 -#define SCREEN_WIDTH_480 60 -#define SCREEN_WIDTH_512 64 - - - -READ8_MEMBER(orion_state::orion_romdisk_porta_r) -{ - UINT16 addr = (m_romdisk_msb << 8) | m_romdisk_lsb; - if (m_cart->exists() && addr < m_cart->get_rom_size()) - return m_cart->read_rom(space, addr); - else - return 0xff; -} - -WRITE8_MEMBER(orion_state::orion_romdisk_portb_w) -{ - m_romdisk_lsb = data; -} - -WRITE8_MEMBER(orion_state::orion_romdisk_portc_w) -{ - m_romdisk_msb = data; -} - -MACHINE_START_MEMBER(orion_state,orion128) -{ - m_video_mode_mask = 7; -} - -READ8_MEMBER(orion_state::orion128_system_r) -{ - return m_ppi8255_2->read(space, offset & 3); -} - -WRITE8_MEMBER(orion_state::orion128_system_w) -{ - m_ppi8255_2->write(space, offset & 3, data); -} - -READ8_MEMBER(orion_state::orion128_romdisk_r) -{ - return m_ppi8255_1->read(space, offset & 3); -} - -WRITE8_MEMBER(orion_state::orion128_romdisk_w) -{ - m_ppi8255_1->write(space, offset & 3, data); -} - -void orion_state::orion_set_video_mode(int width) -{ - rectangle visarea(0, width-1, 0, 255); - machine().first_screen()->configure(width, 256, visarea, machine().first_screen()->frame_period().attoseconds()); -} - -WRITE8_MEMBER(orion_state::orion128_video_mode_w) -{ - if ((data & 0x80)!=(m_orion128_video_mode & 0x80)) - { - if ((data & 0x80)==0x80) - { - if (m_video_mode_mask == 31) - { - m_orion128_video_width = SCREEN_WIDTH_512; - orion_set_video_mode(512); - } - else - { - m_orion128_video_width = SCREEN_WIDTH_480; - orion_set_video_mode(480); - } - } - else - { - m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(384); - } - } - - m_orion128_video_mode = data; -} - -WRITE8_MEMBER(orion_state::orion128_video_page_w) -{ - if (m_orion128_video_page != data) - { - if ((data & 0x80)!=(m_orion128_video_page & 0x80)) - { - if ((data & 0x80)==0x80) - { - if (m_video_mode_mask == 31) - { - m_orion128_video_width = SCREEN_WIDTH_512; - orion_set_video_mode(512); - } - else - { - m_orion128_video_width = SCREEN_WIDTH_480; - orion_set_video_mode(480); - } - } - else - { - m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(384); - } - } - } - m_orion128_video_page = data; -} - - -WRITE8_MEMBER(orion_state::orion128_memory_page_w) -{ - if (data!=m_orion128_memory_page ) - { - m_bank1->set_base(m_ram->pointer() + (data & 3) * 0x10000); - m_orion128_memory_page = (data & 3); - } -} - -MACHINE_RESET_MEMBER(orion_state,orion128) -{ - m_orion128_video_page = 0; - m_orion128_video_mode = 0; - m_orion128_memory_page = -1; - m_bank1->set_base(m_region_maincpu->base() + 0xf800); - m_bank2->set_base(m_ram->pointer() + 0xf000); - m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(384); - radio86_init_keyboard(); -} - -WRITE8_MEMBER(orion_state::orion_disk_control_w) -{ - floppy_connector *names[] = { m_fd0, m_fd1, m_fd2, m_fd3}; - floppy_image_device *floppy = names[data & 3]->get_device(); - - m_fdc->set_floppy(floppy); - floppy->mon_w(0); - floppy->ss_w(((data & 0x10) >> 4) ^ 1); -} - -READ8_MEMBER(orion_state::orion128_floppy_r) -{ - switch(offset) - { - case 0x0 : - case 0x10 : return m_fdc->status_r(space, 0); - case 0x1 : - case 0x11 : return m_fdc->track_r(space, 0); - case 0x2 : - case 0x12 : return m_fdc->sector_r(space, 0); - case 0x3 : - case 0x13 : return m_fdc->data_r(space, 0); - } - return 0xff; -} - -WRITE8_MEMBER(orion_state::orion128_floppy_w) -{ - switch(offset) - { - case 0x0 : - case 0x10 : m_fdc->cmd_w(space, 0,data); break; - case 0x1 : - case 0x11 : m_fdc->track_w(space, 0,data);break; - case 0x2 : - case 0x12 : m_fdc->sector_w(space, 0,data);break; - case 0x3 : - case 0x13 : m_fdc->data_w(space, 0,data);break; - case 0x4 : - case 0x14 : - case 0x20 : orion_disk_control_w(space, offset, data);break; - } -} -READ8_MEMBER(orion_state::orionz80_floppy_rtc_r) -{ - if ((offset >= 0x60) && (offset <= 0x6f)) - { - return m_rtc->read(space,offset-0x60); - } - else - { - return orion128_floppy_r(space,offset); - } -} - -WRITE8_MEMBER(orion_state::orionz80_floppy_rtc_w) -{ - if ((offset >= 0x60) && (offset <= 0x6f)) - { - m_rtc->write(space,offset-0x60,data); - } - else - { - orion128_floppy_w(space,offset,data); - } -} - - -MACHINE_START_MEMBER(orion_state,orionz80) -{ - m_video_mode_mask = 7; -} - -WRITE8_MEMBER(orion_state::orionz80_sound_w) -{ - if (m_speaker_data == 0) - { - m_speaker_data = data; - } - else - { - m_speaker_data = 0; - } - m_speaker->level_w(m_speaker_data); - -} - -WRITE8_MEMBER(orion_state::orionz80_sound_fe_w) -{ - m_speaker->level_w(BIT(data, 4)); -} - - -void orion_state::orionz80_switch_bank() -{ - UINT8 bank_select; - UINT8 segment_select; - address_space &space = m_maincpu->space(AS_PROGRAM); - - bank_select = (m_orionz80_dispatcher & 0x0c) >> 2; - segment_select = m_orionz80_dispatcher & 0x03; - - space.install_write_bank(0x0000, 0x3fff, "bank1"); - if ((m_orionz80_dispatcher & 0x80)==0) - { // dispatcher on - m_bank1->set_base(m_ram->pointer() + 0x10000 * bank_select + segment_select * 0x4000 ); - } - else - { // dispatcher off - m_bank1->set_base(m_ram->pointer() + 0x10000 * m_orionz80_memory_page); - } - - m_bank2->set_base(m_ram->pointer() + 0x4000 + 0x10000 * m_orionz80_memory_page); - - if ((m_orionz80_dispatcher & 0x20) == 0) - { - space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this)); - space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this)); - space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orionz80_floppy_rtc_w),this)); - space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this)); - space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this)); - space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orionz80_floppy_rtc_r),this)); - - space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this)); - space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionz80_memory_page_w),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(orion_state::orionz80_dispatcher_w),this)); - space.unmap_write(0xfc00, 0xfeff); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); - - m_bank3->set_base(m_ram->pointer() + 0xf000); - m_bank5->set_base(m_region_maincpu->base() + 0xf800); - - } - else - { - /* if it is full memory access */ - m_bank3->set_base(m_ram->pointer() + 0xf000 + 0x10000 * m_orionz80_memory_page); - m_bank4->set_base(m_ram->pointer() + 0xf400 + 0x10000 * m_orionz80_memory_page); - m_bank5->set_base(m_ram->pointer() + 0xf800 + 0x10000 * m_orionz80_memory_page); - } -} - -WRITE8_MEMBER(orion_state::orionz80_memory_page_w) -{ - m_orionz80_memory_page = data & 7; - orionz80_switch_bank(); -} - -WRITE8_MEMBER(orion_state::orionz80_dispatcher_w) -{ - m_orionz80_dispatcher = data; - orionz80_switch_bank(); -} - -MACHINE_RESET_MEMBER(orion_state,orionz80) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.unmap_write(0x0000, 0x3fff); - space.install_write_bank(0x4000, 0xefff, "bank2"); - space.install_write_bank(0xf000, 0xf3ff, "bank3"); - - space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this)); - space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this)); - space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orionz80_floppy_rtc_w),this)); - space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this)); - space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this)); - space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orionz80_floppy_rtc_r),this)); - - space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this)); - space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionz80_memory_page_w),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(orion_state::orionz80_dispatcher_w),this)); - space.unmap_write(0xfc00, 0xfeff); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); - - - m_bank1->set_base(m_region_maincpu->base() + 0xf800); - m_bank2->set_base(m_ram->pointer() + 0x4000); - m_bank3->set_base(m_ram->pointer() + 0xf000); - m_bank5->set_base(m_region_maincpu->base() + 0xf800); - - - m_orion128_video_page = 0; - m_orion128_video_mode = 0; - m_orionz80_memory_page = 0; - m_orionz80_dispatcher = 0; - m_speaker_data = 0; - m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(384); - radio86_init_keyboard(); -} - -INTERRUPT_GEN_MEMBER(orion_state::orionz80_interrupt) -{ - if ((m_orionz80_dispatcher & 0x40)==0x40) - { - device.execute().set_input_line(0, HOLD_LINE); - } -} - -READ8_MEMBER(orion_state::orionz80_io_r) -{ - if (offset == 0xFFFD) - { - return m_ay8912->data_r(space, 0); - } - return 0xff; -} - -WRITE8_MEMBER(orion_state::orionz80_io_w) -{ - switch (offset & 0xff) - { - case 0xf8 : orion128_video_mode_w(space,0,data);break; - case 0xf9 : orionz80_memory_page_w(space,0,data);break; - case 0xfa : orion128_video_page_w(space,0,data);break; - case 0xfb : orionz80_dispatcher_w(space,0,data);break; - case 0xfe : orionz80_sound_fe_w(space,0,data);break; - case 0xff : orionz80_sound_w(space,0,data);break; - } - switch(offset) - { - case 0xfffd : m_ay8912->address_w(space, 0, data); - break; - case 0xbffd : - case 0xbefd : m_ay8912->data_w(space, 0, data); - break; - } -} - - - - - - - -void orion_state::orionpro_bank_switch() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int page = m_orionpro_page & 7; // we have only 8 pages - int is128 = (m_orionpro_dispatcher & 0x80) ? 1 : 0; - UINT8 *ram = m_ram->pointer(); - - if (is128==1) - { - page = m_orionpro_128_page & 7; - } - space.install_write_bank(0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x2000, 0x3fff, "bank2"); - space.install_write_bank(0x4000, 0x7fff, "bank3"); - space.install_write_bank(0x8000, 0xbfff, "bank4"); - space.install_write_bank(0xc000, 0xefff, "bank5"); - space.install_write_bank(0xf000, 0xf3ff, "bank6"); - space.install_write_bank(0xf400, 0xf7ff, "bank7"); - space.install_write_bank(0xf800, 0xffff, "bank8"); - - - if ((m_orionpro_dispatcher & 0x01)==0x00) - { // RAM0 segment disabled - m_bank1->set_base(ram + 0x10000 * page); - m_bank2->set_base(ram + 0x10000 * page + 0x2000); - } - else - { - m_bank1->set_base(ram + (m_orionpro_ram0_segment & 31) * 0x4000); - m_bank2->set_base(ram + (m_orionpro_ram0_segment & 31) * 0x4000 + 0x2000); - } - if ((m_orionpro_dispatcher & 0x10)==0x10) - { // ROM1 enabled - space.unmap_write(0x0000, 0x1fff); - m_bank1->set_base(m_region_maincpu->base() + 0x20000); - } - if ((m_orionpro_dispatcher & 0x08)==0x08) - { // ROM2 enabled - space.unmap_write(0x2000, 0x3fff); - m_bank2->set_base(m_region_maincpu->base() + 0x22000 + (m_orionpro_rom2_segment & 7) * 0x2000); - } - - if ((m_orionpro_dispatcher & 0x02)==0x00) - { // RAM1 segment disabled - m_bank3->set_base(ram + 0x10000 * page + 0x4000); - } - else - { - m_bank3->set_base(ram + (m_orionpro_ram1_segment & 31) * 0x4000); - } - - if ((m_orionpro_dispatcher & 0x04)==0x00) - { // RAM2 segment disabled - m_bank4->set_base(ram + 0x10000 * page + 0x8000); - } - else - { - m_bank4->set_base(ram + (m_orionpro_ram2_segment & 31) * 0x4000); - } - - m_bank5->set_base(ram + 0x10000 * page + 0xc000); - - if (is128) - { - m_bank6->set_base(ram + 0x10000 * 0 + 0xf000); - - space.install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),this)); - space.install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),this)); - space.unmap_write(0xf600, 0xf6ff); - space.install_write_handler(0xf700, 0xf7ff, write8_delegate(FUNC(orion_state::orion128_floppy_w),this)); - space.install_read_handler(0xf400, 0xf4ff, read8_delegate(FUNC(orion_state::orion128_system_r),this)); - space.install_read_handler(0xf500, 0xf5ff, read8_delegate(FUNC(orion_state::orion128_romdisk_r),this)); - space.unmap_read(0xf600, 0xf6ff); - space.install_read_handler(0xf700, 0xf7ff, read8_delegate(FUNC(orion_state::orion128_floppy_r),this)); - - space.install_write_handler(0xf800, 0xf8ff, write8_delegate(FUNC(orion_state::orion128_video_mode_w),this)); - space.install_write_handler(0xf900, 0xf9ff, write8_delegate(FUNC(orion_state::orionpro_memory_page_w),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(orion_state::orion128_video_page_w),this)); - space.unmap_write(0xfb00, 0xfeff); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),this)); - - - m_bank8->set_base(ram + 0x10000 * 0 + 0xf800); - } - else - { - if ((m_orionpro_dispatcher & 0x40)==0x40) - { // FIX F000 enabled - m_bank6->set_base(ram + 0x10000 * 0 + 0xf000); - m_bank7->set_base(ram + 0x10000 * 0 + 0xf400); - m_bank8->set_base(ram + 0x10000 * 0 + 0xf800); - } - else - { - m_bank6->set_base(ram + 0x10000 * page + 0xf000); - m_bank7->set_base(ram + 0x10000 * page + 0xf400); - m_bank8->set_base(ram + 0x10000 * page + 0xf800); - } - } -} - -WRITE8_MEMBER(orion_state::orionpro_memory_page_w) -{ - m_orionpro_128_page = data; - orionpro_bank_switch(); -} - -MACHINE_RESET_MEMBER(orion_state,orionpro) -{ - radio86_init_keyboard(); - - m_orion128_video_page = 0; - m_orion128_video_mode = 0; - m_orionpro_ram0_segment = 0; - m_orionpro_ram1_segment = 0; - m_orionpro_ram2_segment = 0; - - m_orionpro_page = 0; - m_orionpro_128_page = 0; - m_orionpro_rom2_segment = 0; - - m_orionpro_dispatcher = 0x50; - orionpro_bank_switch(); - - m_speaker_data = 0; - m_orion128_video_width = SCREEN_WIDTH_384; - orion_set_video_mode(384); - - m_video_mode_mask = 31; - m_orionpro_pseudo_color = 0; -} - -READ8_MEMBER(orion_state::orionpro_io_r) -{ - switch (offset & 0xff) - { - case 0x00 : return 0x56; - case 0x04 : return m_orionpro_ram0_segment; - case 0x05 : return m_orionpro_ram1_segment; - case 0x06 : return m_orionpro_ram2_segment; - case 0x08 : return m_orionpro_page; - case 0x09 : return m_orionpro_rom2_segment; - case 0x0a : return m_orionpro_dispatcher; - case 0x10 : return m_fdc->status_r(space, 0); - case 0x11 : return m_fdc->track_r(space, 0); - case 0x12 : return m_fdc->sector_r(space, 0); - case 0x13 : return m_fdc->data_r(space, 0); - case 0x18 : - case 0x19 : - case 0x1a : - case 0x1b : - return orion128_system_r(space,(offset & 0xff)-0x18); - case 0x28 : return orion128_romdisk_r(space,0); - case 0x29 : return orion128_romdisk_r(space,1); - case 0x2a : return orion128_romdisk_r(space,2); - case 0x2b : return orion128_romdisk_r(space,3); - } - if (offset == 0xFFFD) - { - return m_ay8912->data_r(space, 0); - } - return 0xff; -} - -WRITE8_MEMBER(orion_state::orionpro_io_w) -{ - switch (offset & 0xff) - { - case 0x04 : m_orionpro_ram0_segment = data; orionpro_bank_switch(); break; - case 0x05 : m_orionpro_ram1_segment = data; orionpro_bank_switch(); break; - case 0x06 : m_orionpro_ram2_segment = data; orionpro_bank_switch(); break; - case 0x08 : m_orionpro_page = data; orionpro_bank_switch(); break; - case 0x09 : m_orionpro_rom2_segment = data; orionpro_bank_switch(); break; - case 0x0a : m_orionpro_dispatcher = data; orionpro_bank_switch(); break; - case 0x10 : m_fdc->cmd_w(space, 0,data); break; - case 0x11 : m_fdc->track_w(space, 0,data);break; - case 0x12 : m_fdc->sector_w(space, 0,data);break; - case 0x13 : m_fdc->data_w(space, 0,data);break; - case 0x14 : orion_disk_control_w(space, 9, data);break; - case 0x18 : - case 0x19 : - case 0x1a : - case 0x1b : - orion128_system_w(space,(offset & 0xff)-0x18,data); break; - case 0x28 : orion128_romdisk_w(space,0,data); break; - case 0x29 : orion128_romdisk_w(space,1,data); break; - case 0x2a : orion128_romdisk_w(space,2,data); break; - case 0x2b : orion128_romdisk_w(space,3,data); break; - case 0xf8 : orion128_video_mode_w(space,0,data);break; - case 0xf9 : m_orionpro_128_page = data; orionpro_bank_switch(); break; - case 0xfa : orion128_video_page_w(space,0,data);break; - case 0xfc : m_orionpro_pseudo_color = data;break; - case 0xfe : orionz80_sound_fe_w(space,0,data);break; - case 0xff : orionz80_sound_w(space,0,data);break; - } - switch(offset) - { - case 0xfffd : m_ay8912->address_w(space, 0, data); - break; - case 0xbffd : - case 0xbefd : m_ay8912->data_w(space, 0, data); - break; - } -} diff --git a/src/mess/machine/osborne1.c b/src/mess/machine/osborne1.c deleted file mode 100644 index 84cf5f2db46..00000000000 --- a/src/mess/machine/osborne1.c +++ /dev/null @@ -1,513 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - -There are three IRQ sources: -- IRQ0 -- IRQ1 = IRQA from the video PIA -- IRQ2 = IRQA from the IEEE488 PIA - -Interrupt handling on the Osborne-1 is a bit awkward. When an interrupt is -taken by the Z80 the ROMMODE is enabled on each fetch of an instruction -byte. During execution of an instruction the previous ROMMODE setting seems -to be used. Side effect of this is that when an interrupt is taken and the -stack pointer is pointing to 0000-3FFF then the return address will still -be written to RAM if RAM was switched in. - -***************************************************************************/ - -#include "includes/osborne1.h" - -#define RAMMODE (0x01) - - -WRITE8_MEMBER( osborne1_state::osborne1_0000_w ) -{ - /* Check whether regular RAM is enabled */ - if ( ! m_bank2_enabled || ( m_in_irq_handler && m_bankswitch == RAMMODE ) ) - { - m_ram->pointer()[ offset ] = data; - } -} - - -WRITE8_MEMBER( osborne1_state::osborne1_1000_w ) -{ - /* Check whether regular RAM is enabled */ - if ( ! m_bank2_enabled || ( m_in_irq_handler && m_bankswitch == RAMMODE ) ) - { - m_ram->pointer()[ 0x1000 + offset ] = data; - } -} - - -READ8_MEMBER( osborne1_state::osborne1_2000_r ) -{ - UINT8 data = 0xFF; - - /* Check whether regular RAM is enabled */ - if ( ! m_bank2_enabled ) - { - data = m_ram->pointer()[ 0x2000 + offset ]; - } - else - { - switch( offset & 0x0F00 ) - { - case 0x100: /* Floppy */ - data = m_fdc->read( space, offset & 0x03 ); - break; - case 0x200: /* Keyboard */ - /* Row 0 */ - if ( offset & 0x01 ) data &= m_row0->read(); - /* Row 1 */ - if ( offset & 0x02 ) data &= m_row1->read(); - /* Row 2 */ - if ( offset & 0x04 ) data &= m_row3->read(); - /* Row 3 */ - if ( offset & 0x08 ) data &= m_row4->read(); - /* Row 4 */ - if ( offset & 0x10 ) data &= m_row5->read(); - /* Row 5 */ - if ( offset & 0x20 ) data &= m_row2->read(); - /* Row 6 */ - if ( offset & 0x40 ) data &= m_row6->read(); - /* Row 7 */ - if ( offset & 0x80 ) data &= m_row7->read(); - break; - case 0x900: /* IEEE488 PIA */ - data = m_pia0->read(space, offset & 0x03 ); - break; - case 0xA00: /* Serial */ - break; - case 0xC00: /* Video PIA */ - data = m_pia1->read(space, offset & 0x03 ); - break; - } - } - return data; -} - - -WRITE8_MEMBER( osborne1_state::osborne1_2000_w ) -{ - /* Check whether regular RAM is enabled */ - if ( ! m_bank2_enabled ) - { - m_ram->pointer()[ 0x2000 + offset ] = data; - } - else - { - if ( m_in_irq_handler && m_bankswitch == RAMMODE ) - { - m_ram->pointer()[ 0x2000 + offset ] = data; - } - /* Handle writes to the I/O area */ - switch( offset & 0x0F00 ) - { - case 0x100: /* Floppy */ - m_fdc->write(space, offset & 0x03, data ); - break; - case 0x900: /* IEEE488 PIA */ - m_pia0->write(space, offset & 0x03, data ); - break; - case 0xA00: /* Serial */ - break; - case 0xC00: /* Video PIA */ - m_pia1->write(space, offset & 0x03, data ); - break; - } - } -} - - -WRITE8_MEMBER( osborne1_state::osborne1_3000_w ) -{ - /* Check whether regular RAM is enabled */ - if ( ! m_bank2_enabled || ( m_in_irq_handler && m_bankswitch == RAMMODE ) ) - { - m_ram->pointer()[ 0x3000 + offset ] = data; - } -} - - -WRITE8_MEMBER( osborne1_state::osborne1_videoram_w ) -{ - /* Check whether the video attribute section is enabled */ - if ( m_bank3_enabled ) - data |= 0x7F; - - m_bank4_ptr[offset] = data; -} - - -WRITE8_MEMBER( osborne1_state::osborne1_bankswitch_w ) -{ - switch( offset ) - { - case 0x00: - m_bank2_enabled = 1; - m_bank3_enabled = 0; - break; - case 0x01: - m_bank2_enabled = 0; - m_bank3_enabled = 0; - break; - case 0x02: - m_bank2_enabled = 1; - m_bank3_enabled = 1; - break; - case 0x03: - m_bank2_enabled = 1; - m_bank3_enabled = 0; - break; - } - if ( m_bank2_enabled ) - { - m_bank1->set_base(m_region_maincpu->base() ); - m_bank2->set_base(m_empty_4K ); - m_bank3->set_base(m_empty_4K ); - } - else - { - m_bank1->set_base(m_ram->pointer() ); - m_bank2->set_base(m_ram->pointer() + 0x1000 ); - m_bank3->set_base(m_ram->pointer() + 0x3000 ); - } - m_bank4_ptr = m_ram->pointer() + ( ( m_bank3_enabled ) ? 0x10000 : 0xF000 ); - m_bank4->set_base(m_bank4_ptr ); - m_bankswitch = offset; - m_in_irq_handler = 0; -} - - -DIRECT_UPDATE_MEMBER(osborne1_state::osborne1_opbase) -{ - if ( ( address & 0xF000 ) == 0x2000 ) - { - if ( ! m_bank2_enabled ) - { - direct.explicit_configure(0x2000, 0x2fff, 0x0fff, m_ram->pointer() + 0x2000); - return ~0; - } - } - return address; -} - - -WRITE_LINE_MEMBER( osborne1_state::ieee_pia_irq_a_func ) -{ - m_pia_0_irq_state = state; - m_maincpu->set_input_line(0, ( m_pia_1_irq_state ) ? ASSERT_LINE : CLEAR_LINE); -} - - -READ8_MEMBER( osborne1_state::ieee_pia_pb_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 EOI - 4 - 5 DAV - 6 NDAC - 7 NRFD - - */ - - UINT8 data = 0; - - data |= m_ieee->eoi_r() << 3; - data |= m_ieee->dav_r() << 5; - data |= m_ieee->ndac_r() << 6; - data |= m_ieee->nrfd_r() << 7; - - return data; -} - - -WRITE8_MEMBER( osborne1_state::ieee_pia_pb_w ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 EOI - 4 ATN - 5 DAV - 6 NDAC - 7 NRFD - - */ - - m_ieee->eoi_w(BIT(data, 3)); - m_ieee->atn_w(BIT(data, 4)); - m_ieee->dav_w(BIT(data, 5)); - m_ieee->ndac_w(BIT(data, 6)); - m_ieee->nrfd_w(BIT(data, 7)); -} - - -WRITE_LINE_MEMBER( osborne1_state::video_pia_out_cb2_dummy ) -{ -} - - -WRITE8_MEMBER( osborne1_state::video_pia_port_a_w ) -{ - m_fdc->dden_w(BIT(data, 0)); - - data -= 0xea; // remove bias - - m_new_start_x = (data >> 1); - if (m_new_start_x) - m_new_start_x--; - - //logerror("Video pia port a write: %02X, density set to %s\n", data, data & 1 ? "FM" : "MFM" ); -} - - -WRITE8_MEMBER( osborne1_state::video_pia_port_b_w ) -{ - m_new_start_y = data & 0x1F; - m_beep_state = BIT(data, 5); - - if (BIT(data, 6)) - { - m_fdc->set_floppy(m_floppy0); - m_floppy0->mon_w(0); - } - else if (BIT(data, 7)) - { - m_fdc->set_floppy(m_floppy1); - m_floppy1->mon_w(0); - } - else - { - m_fdc->set_floppy(NULL); - } - - //logerror("Video pia port b write: %02X\n", data ); -} - - -WRITE_LINE_MEMBER( osborne1_state::video_pia_irq_a_func ) -{ - m_pia_1_irq_state = state; - m_maincpu->set_input_line(0, ( m_pia_1_irq_state ) ? ASSERT_LINE : CLEAR_LINE); -} - - -//static const struct aica6850_interface osborne1_6850_config = -//{ -// 10, /* tx_clock */ -// 10, /* rx_clock */ -// NULL, /* rx_pin */ -// NULL, /* tx_pin */ -// NULL, /* cts_pin */ -// NULL, /* rts_pin */ -// NULL, /* dcd_pin */ -// NULL /* int_callback */ -//}; - - -void osborne1_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_VIDEO: - osborne1_video_callback(ptr, param); - break; - case TIMER_SETUP: - setup_osborne1(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in osborne1_state::device_timer"); - } -} - - -TIMER_CALLBACK_MEMBER(osborne1_state::osborne1_video_callback) -{ - int y = machine().first_screen()->vpos(); - UINT8 ra=0,chr,gfx,dim; - UINT16 x,ma; - - /* Check for start of frame */ - if ( y == 0 ) - { - /* Clear CA1 on video PIA */ - m_pia1->ca1_w(0); - } - if ( y == 240 ) - { - /* Set CA1 on video PIA */ - m_pia1->ca1_w(1); - } - if ( y < 240 ) - { - ra = y % 10; - /* Draw a line of the display */ - ma = (m_new_start_y + (y/10)) * 128 + m_new_start_x; - UINT16 *p = &m_bitmap.pix16(y); - - for ( x = 0; x < 52; x++ ) - { - chr = m_ram->pointer()[ 0xF000 + ( (ma+x) & 0xFFF ) ]; - dim = m_ram->pointer()[ 0x10000 + ( (ma+x) & 0xFFF ) ] & 0x80; - - if ( (chr & 0x80) && (ra == 9) ) - gfx = 0xFF; - else - gfx = m_p_chargen[ (ra << 7) | ( chr & 0x7F ) ]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7) ? ( dim ? 2 : 1 ) : 0; - *p++ = BIT(gfx, 6) ? ( dim ? 2 : 1 ) : 0; - *p++ = BIT(gfx, 5) ? ( dim ? 2 : 1 ) : 0; - *p++ = BIT(gfx, 4) ? ( dim ? 2 : 1 ) : 0; - *p++ = BIT(gfx, 3) ? ( dim ? 2 : 1 ) : 0; - *p++ = BIT(gfx, 2) ? ( dim ? 2 : 1 ) : 0; - *p++ = BIT(gfx, 1) ? ( dim ? 2 : 1 ) : 0; - *p++ = BIT(gfx, 0) ? ( dim ? 2 : 1 ) : 0; - } - } - - if ( (ra==2) || (ra== 6) ) - { - m_beep->set_state( m_beep_state ); - } - else - { - m_beep->set_state( 0 ); - } - - m_video_timer->adjust(machine().first_screen()->time_until_pos(y + 1, 0 )); -} - -TIMER_CALLBACK_MEMBER(osborne1_state::setup_osborne1) -{ - m_beep->set_state( 0 ); - m_beep->set_frequency( 300 /* 60 * 240 / 2 */ ); - m_pia1->ca1_w(0); -} - -void osborne1_state::machine_reset() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - /* Initialize memory configuration */ - osborne1_bankswitch_w( space, 0x00, 0 ); - - m_pia_0_irq_state = FALSE; - m_pia_1_irq_state = FALSE; - m_in_irq_handler = 0; - - m_p_chargen = memregion( "chargen" )->base(); - - memset( m_ram->pointer() + 0x10000, 0xFF, 0x1000 ); - - space.set_direct_update_handler(direct_update_delegate(FUNC(osborne1_state::osborne1_opbase), this)); -} - - -DRIVER_INIT_MEMBER(osborne1_state,osborne1) -{ - m_empty_4K = auto_alloc_array(machine(), UINT8, 0x1000 ); - memset( m_empty_4K, 0xFF, 0x1000 ); - - /* Configure the 6850 ACIA */ -// acia6850_config( 0, &osborne1_6850_config ); - m_video_timer = timer_alloc(TIMER_VIDEO); - m_video_timer->adjust(machine().first_screen()->time_until_pos(1, 0 )); - - timer_set(attotime::zero, TIMER_SETUP); -} - - -void osborne1_state::video_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); -} - -UINT32 osborne1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - -/**************************************************************** - Osborne1 specific daisy chain code -****************************************************************/ - -const device_type OSBORNE1_DAISY = &device_creator; - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// z80ctc_device - constructor -//------------------------------------------------- -osborne1_daisy_device::osborne1_daisy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, OSBORNE1_DAISY, "Osborne 1 daisy", tag, owner, clock, "osborne1_daisy", __FILE__), - device_z80daisy_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void osborne1_daisy_device::device_start() -{ -} - -//************************************************************************** -// DAISY CHAIN INTERFACE -//************************************************************************** - -//------------------------------------------------- -// z80daisy_irq_state - return the overall IRQ -// state for this device -//------------------------------------------------- - -int osborne1_daisy_device::z80daisy_irq_state() -{ - osborne1_state *state = machine().driver_data(); - return ( state->m_pia_1_irq_state ? Z80_DAISY_INT : 0 ); -} - - -//------------------------------------------------- -// z80daisy_irq_ack - acknowledge an IRQ and -// return the appropriate vector -//------------------------------------------------- - -int osborne1_daisy_device::z80daisy_irq_ack() -{ - osborne1_state *state = machine().driver_data(); - /* Enable ROM and I/O when IRQ is acknowledged */ - UINT8 old_bankswitch = state->m_bankswitch; - address_space& space = state->m_maincpu->space(AS_PROGRAM); - - state->osborne1_bankswitch_w( space, 0, 0 ); - state->m_bankswitch = old_bankswitch; - state->m_in_irq_handler = 1; - return 0xF8; -} - -//------------------------------------------------- -// z80daisy_irq_reti - clear the interrupt -// pending state to allow other interrupts through -//------------------------------------------------- - -void osborne1_daisy_device::z80daisy_irq_reti() -{ -} diff --git a/src/mess/machine/p2000t.c b/src/mess/machine/p2000t.c deleted file mode 100644 index 224e2e462ae..00000000000 --- a/src/mess/machine/p2000t.c +++ /dev/null @@ -1,157 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels -/********************************************************************** - - machine.c - - Functions to emulate general aspects of the machine (RAM, ROM, interrups, - I/O ports) - -**********************************************************************/ - -#include "includes/p2000t.h" - -#define P2000M_101F_CASDAT 0x01 -#define P2000M_101F_CASCMD 0x02 -#define P2000M_101F_CASREW 0x04 -#define P2000M_101F_CASFOR 0x08 -#define P2000M_101F_KEYINT 0x40 -#define P2000M_101F_PRNOUT 0x80 - -#define P2000M_202F_PINPUT 0x01 -#define P2000M_202F_PREADY 0x02 -#define P2000M_202F_STRAPN 0x04 -#define P2000M_202F_CASENB 0x08 -#define P2000M_202F_CASPOS 0x10 -#define P2000M_202F_CASEND 0x20 -#define P2000M_202F_CASCLK 0x40 -#define P2000M_202F_CASDAT 0x80 - -#define P2000M_303F_VIDEO 0x01 - -#define P2000M_707F_DISA 0x01 - -/* - Keyboard port 0x0x - - If the keyboard interrupt is enabled, all keyboard matrix rows are - connected and reading from either of these ports will give the - keyboard status (FF=no key pressed) - - If the keyboard interrupt is disabled, reading one of these ports - will read the corresponding keyboard matrix row -*/ -READ8_MEMBER( p2000t_state::p2000t_port_000f_r ) -{ - if (m_port_101f & P2000M_101F_KEYINT) - { - return ( - m_keyboard[0]->read() & m_keyboard[1]->read() & - m_keyboard[2]->read() & m_keyboard[3]->read() & - m_keyboard[4]->read() & m_keyboard[5]->read() & - m_keyboard[6]->read() & m_keyboard[7]->read() & - m_keyboard[8]->read() & m_keyboard[9]->read()); - } - else - if (offset < 10) - { - return m_keyboard[offset]->read(); - } - else - return 0xff; -} - - -/* - Input port 0x2x - - bit 0 - Printer input - bit 1 - Printer ready - bit 2 - Strap N (daisy/matrix) - bit 3 - Cassette write enabled - bit 4 - Cassette in position - bit 5 - Begin/end of tape - bit 6 - Cassette read clock - bit 7 - Cassette read data -*/ -READ8_MEMBER( p2000t_state::p2000t_port_202f_r ) -{ - return (0xff); -} - - -/* - Output Port 0x1x - - bit 0 - Cassette write data - bit 1 - Cassette write command - bit 2 - Cassette rewind - bit 3 - Cassette forward - bit 4 - Unused - bit 5 - Unused - bit 6 - Keyboard interrupt enable - bit 7 - Printer output -*/ -WRITE8_MEMBER( p2000t_state::p2000t_port_101f_w ) -{ - m_port_101f = data; -} - -/* - Scroll Register 0x3x (P2000T only) - - bit 0 - / - bit 1 - | - bit 2 - | Index of the first character - bit 3 - | to be displayed - bit 4 - | - bit 5 - | - bit 6 - \ - bit 7 - Video disable (0 = enabled) -*/ -WRITE8_MEMBER( p2000t_state::p2000t_port_303f_w ) -{ - m_port_303f = data; -} - -/* - Beeper 0x5x - - bit 0 - Beeper - bit 1 - Unused - bit 2 - Unused - bit 3 - Unused - bit 4 - Unused - bit 5 - Unused - bit 6 - Unused - bit 7 - Unused -*/ -WRITE8_MEMBER( p2000t_state::p2000t_port_505f_w ) -{ - m_speaker->level_w(BIT(data, 0)); -} - -/* - DISAS 0x7x (P2000M only) - - bit 0 - Unused - bit 1 - DISAS enable - bit 2 - Unused - bit 3 - Unused - bit 4 - Unused - bit 5 - Unused - bit 6 - Unused - bit 7 - Unused - - When the DISAS is active, the CPU has the highest priority and - video refresh is disabled when the CPU accesses video memory - -*/ -WRITE8_MEMBER( p2000t_state::p2000t_port_707f_w ) -{ - m_port_707f = data; -} - -WRITE8_MEMBER( p2000t_state::p2000t_port_888b_w ) {} -WRITE8_MEMBER( p2000t_state::p2000t_port_8c90_w ) {} -WRITE8_MEMBER( p2000t_state::p2000t_port_9494_w ) {} diff --git a/src/mess/machine/partner.c b/src/mess/machine/partner.c deleted file mode 100644 index a336ad83c9b..00000000000 --- a/src/mess/machine/partner.c +++ /dev/null @@ -1,362 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Partner driver by Miodrag Milanovic - - 09/06/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "includes/radio86.h" -#include "includes/partner.h" -#include "imagedev/flopdrv.h" -#include "machine/ram.h" - - -/* Driver initialization */ -DRIVER_INIT_MEMBER(partner_state,partner) -{ - m_tape_value = 0x80; -} - -void partner_state::partner_window_1(UINT8 bank_num, UINT16 offset,UINT8 *rom) -{ - char bank[10]; - sprintf(bank,"bank%d",bank_num); - switch(m_win_mem_page) { - case 2 : // FDD BIOS - membank(bank)->set_base(rom + 0x16000 + offset); - break; - case 4 : // MCPG BIOS - membank(bank)->set_base(rom + 0x14000 + offset); - break; - default : // BIOS - membank(bank)->set_base(rom + 0x10000 + offset); - break; - } -} - -void partner_state::partner_window_2(UINT8 bank_num, UINT16 offset,UINT8 *rom) -{ - char bank[10]; - sprintf(bank,"bank%d",bank_num); - switch(m_win_mem_page) { - case 4 : // MCPG FONT - membank(bank)->set_base(rom + 0x18000 + offset); - break; - default : // BIOS - membank(bank)->set_base(rom + 0x10000 + offset); - break; - } -} - -READ8_MEMBER(partner_state::partner_floppy_r){ - if (offset<0x100) { - switch(offset & 3) { - case 0x00 : return m_fdc->status_r(space, 0); - case 0x01 : return m_fdc->track_r(space, 0); - case 0x02 : return m_fdc->sector_r(space, 0); - default : - return m_fdc->data_r(space, 0); - } - } else { - return 0; - } -} - -WRITE8_MEMBER(partner_state::partner_floppy_w){ - if (offset<0x100) { - switch(offset & 3) { - case 0x00 : m_fdc->cmd_w(space, 0,data); break; - case 0x01 : m_fdc->track_w(space, 0,data);break; - case 0x02 : m_fdc->sector_w(space, 0,data);break; - default : m_fdc->data_w(space, 0,data);break; - } - } else { - floppy_image_device *floppy0 = m_fdc->subdevice("0")->get_device(); - floppy_image_device *floppy1 = m_fdc->subdevice("1")->get_device(); - - if (((data >> 6) & 1)==1) { - m_fdc->set_floppy(floppy0); - floppy0->mon_w(0); - floppy0->ss_w(data >> 7); - } - else - floppy0->mon_w(1); - - if (((data >> 3) & 1)==1) { - m_fdc->set_floppy(floppy1); - floppy1->mon_w(0); - floppy1->ss_w(data >> 7); - } - else - floppy1->mon_w(1); - } -} - -void partner_state::partner_iomap_bank(UINT8 *rom) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - switch(m_win_mem_page) { - case 2 : - // FDD - space.install_write_handler(0xdc00, 0xddff, write8_delegate(FUNC(partner_state::partner_floppy_w),this)); - space.install_read_handler (0xdc00, 0xddff, read8_delegate(FUNC(partner_state::partner_floppy_r),this)); - break; - case 4 : - // Timer - break; - default : // BIOS - membank("bank11")->set_base(rom + 0x10000); - break; - } -} -void partner_state::partner_bank_switch() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *rom = memregion("maincpu")->base(); - UINT8 *ram = m_ram->pointer(); - - space.install_write_bank(0x0000, 0x07ff, "bank1"); - space.install_write_bank(0x0800, 0x3fff, "bank2"); - space.install_write_bank(0x4000, 0x5fff, "bank3"); - space.install_write_bank(0x6000, 0x7fff, "bank4"); - space.install_write_bank(0x8000, 0x9fff, "bank5"); - space.install_write_bank(0xa000, 0xb7ff, "bank6"); - space.install_write_bank(0xb800, 0xbfff, "bank7"); - space.install_write_bank(0xc000, 0xc7ff, "bank8"); - space.install_write_bank(0xc800, 0xcfff, "bank9"); - space.install_write_bank(0xd000, 0xd7ff, "bank10"); - space.unmap_write(0xdc00, 0xddff); - space.install_read_bank (0xdc00, 0xddff, "bank11"); - space.unmap_write(0xe000, 0xe7ff); - space.unmap_write(0xe800, 0xffff); - - // BANK 1 (0x0000 - 0x07ff) - if (m_mem_page==0) { - space.unmap_write(0x0000, 0x07ff); - membank("bank1")->set_base(rom + 0x10000); - } else { - if (m_mem_page==7) { - membank("bank1")->set_base(ram + 0x8000); - } else { - membank("bank1")->set_base(ram + 0x0000); - } - } - - // BANK 2 (0x0800 - 0x3fff) - if (m_mem_page==7) { - membank("bank2")->set_base(ram + 0x8800); - } else { - membank("bank2")->set_base(ram + 0x0800); - } - - // BANK 3 (0x4000 - 0x5fff) - if (m_mem_page==7) { - membank("bank3")->set_base(ram + 0xC000); - } else { - if (m_mem_page==10) { - //window 1 - space.unmap_write(0x4000, 0x5fff); - partner_window_1(3, 0, rom); - } else { - membank("bank3")->set_base(ram + 0x4000); - } - } - - // BANK 4 (0x6000 - 0x7fff) - if (m_mem_page==7) { - membank("bank4")->set_base(ram + 0xe000); - } else { - membank("bank4")->set_base(ram + 0x6000); - } - - // BANK 5 (0x8000 - 0x9fff) - switch (m_mem_page) { - case 5: - case 10: - //window 2 - space.unmap_write(0x8000, 0x9fff); - partner_window_2(5, 0, rom); - break; - case 8: - case 9: - //window 1 - space.unmap_write(0x8000, 0x9fff); - partner_window_1(5, 0, rom); - break; - case 7: - membank("bank5")->set_base(ram + 0x0000); - break; - default: - membank("bank5")->set_base(ram + 0x8000); - break; - } - - // BANK 6 (0xa000 - 0xb7ff) - switch (m_mem_page) { - case 5: - case 10: - //window 2 - space.unmap_write(0xa000, 0xb7ff); - partner_window_2(6, 0, rom); - break; - case 6: - case 8: - //BASIC - space.unmap_write(0xa000, 0xb7ff); - membank("bank6")->set_base(rom + 0x12000); // BASIC - break; - case 7: - membank("bank6")->set_base(ram + 0x2000); - break; - default: - membank("bank6")->set_base(ram + 0xa000); - break; - } - - // BANK 7 (0xb800 - 0xbfff) - switch (m_mem_page) { - case 4: - case 5: - case 10: - //window 2 - space.unmap_write(0xb800, 0xbfff); - partner_window_2(7, 0x1800, rom); - break; - case 6: - case 8: - //BASIC - space.unmap_write(0xb800, 0xbfff); - membank("bank7")->set_base(rom + 0x13800); // BASIC - break; - case 7: - membank("bank7")->set_base(ram + 0x3800); - break; - default: - membank("bank7")->set_base(ram + 0xb800); - break; - } - - // BANK 8 (0xc000 - 0xc7ff) - switch (m_mem_page) { - case 7: - membank("bank8")->set_base(ram + 0x4000); - break; - case 8: - case 10: - space.unmap_write(0xc000, 0xc7ff); - membank("bank8")->set_base(rom + 0x10000); - break; - default: - membank("bank8")->set_base(ram + 0xc000); - break; - } - - // BANK 9 (0xc800 - 0xcfff) - switch (m_mem_page) { - case 7: - membank("bank9")->set_base(ram + 0x4800); - break; - case 8: - case 9: - // window 2 - space.unmap_write(0xc800, 0xcfff); - partner_window_2(9, 0, rom); - break; - case 10: - space.unmap_write(0xc800, 0xcfff); - membank("bank9")->set_base(rom + 0x10800); - break; - default: - membank("bank9")->set_base(ram + 0xc800); - break; - } - - // BANK 10 (0xd000 - 0xd7ff) - switch (m_mem_page) { - case 7: - membank("bank10")->set_base(ram + 0x5000); - break; - case 8: - case 9: - // window 2 - space.unmap_write(0xd000, 0xd7ff); - partner_window_2(10, 0x0800, rom); - break; - default: - membank("bank10")->set_base(ram + 0xd000); - break; - } - - // BANK 11 (0xdc00 - 0xddff) - partner_iomap_bank(rom); - - // BANK 12 (0xe000 - 0xe7ff) - if (m_mem_page==1) { - membank("bank12")->set_base(rom + 0x10000); - } else { - //window 1 - partner_window_1(12, 0, rom); - } - - // BANK 13 (0xe800 - 0xffff) - switch (m_mem_page) { - case 3: - case 4: - case 5: - // window 1 - partner_window_1(13, 0x800, rom); - break; - default: - // BIOS - membank("bank13")->set_base(rom + 0x10800); - break; - } -} - -WRITE8_MEMBER(partner_state::partner_win_memory_page_w) -{ - m_win_mem_page = ~data; - partner_bank_switch(); -} - -WRITE8_MEMBER(partner_state::partner_mem_page_w) -{ - m_mem_page = (data >> 4) & 0x0f; - partner_bank_switch(); -} - -I8275_DRAW_CHARACTER_MEMBER(partner_state::display_pixels) -{ - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const UINT8 *charmap = m_charmap + 0x400 * (gpa * 2 + hlgt); - UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; - if(linecount == 8) - pixels = 0; - if (vsp) { - pixels = 0; - } - if (lten) { - pixels = 0xff; - } - if (rvv) { - pixels ^= 0xff; - } - for(i=0;i<6;i++) { - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1]; - } -} - -MACHINE_RESET_MEMBER(partner_state,partner) -{ - m_mem_page = 0; - m_win_mem_page = 0; - partner_bank_switch(); -} diff --git a/src/mess/machine/pc1251.c b/src/mess/machine/pc1251.c deleted file mode 100644 index bd0cd4ff25e..00000000000 --- a/src/mess/machine/pc1251.c +++ /dev/null @@ -1,128 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#include "emu.h" -#include "cpu/sc61860/sc61860.h" - -#include "includes/pocketc.h" -#include "includes/pc1251.h" - -/* C-CE while reset, program will not be destroyed! */ - - - -WRITE8_MEMBER(pc1251_state::pc1251_outa) -{ - m_outa = data; -} - -WRITE8_MEMBER(pc1251_state::pc1251_outb) -{ - m_outb = data; -} - -WRITE8_MEMBER(pc1251_state::pc1251_outc) -{ -} - -READ8_MEMBER(pc1251_state::pc1251_ina) -{ - int data = m_outa; - - if (m_outb & 0x01) - { - data |= ioport("KEY0")->read(); - - /* At Power Up we fake a 'CL' pressure */ - if (m_power) - data |= 0x02; // problem with the deg lcd - } - - if (m_outb & 0x02) - data |= ioport("KEY1")->read(); - - if (m_outb & 0x04) - data |= ioport("KEY2")->read(); - - if (m_outa & 0x01) - data |= ioport("KEY3")->read(); - - if (m_outa & 0x02) - data |= ioport("KEY4")->read(); - - if (m_outa & 0x04) - data |= ioport("KEY5")->read(); - - if (m_outa & 0x08) - data |= ioport("KEY6")->read(); - - if (m_outa & 0x10) - data |= ioport("KEY7")->read(); - - if (m_outa & 0x20) - data |= ioport("KEY8")->read(); - - if (m_outa & 0x40) - data |= ioport("KEY9")->read(); - - return data; -} - -READ8_MEMBER(pc1251_state::pc1251_inb) -{ - int data = m_outb; - - if (m_outb & 0x08) - data |= (ioport("MODE")->read() & 0x07); - - return data; -} - -READ_LINE_MEMBER(pc1251_state::pc1251_brk) -{ - return (ioport("EXTRA")->read() & 0x01); -} - -READ_LINE_MEMBER(pc1251_state::pc1251_reset) -{ - return (ioport("EXTRA")->read() & 0x02); -} - -void pc1251_state::machine_start() -{ - UINT8 *ram = memregion("maincpu")->base() + 0x8000; - UINT8 *cpu = m_maincpu->internal_ram(); - - machine().device("cpu_nvram")->set_base(cpu, 96); - machine().device("ram_nvram")->set_base(ram, 0x4800); -} - -MACHINE_START_MEMBER(pc1251_state,pc1260 ) -{ - UINT8 *ram = memregion("maincpu")->base() + 0x4000; - UINT8 *cpu = m_maincpu->internal_ram(); - - machine().device("cpu_nvram")->set_base(cpu, 96); - machine().device("ram_nvram")->set_base(ram, 0x2800); -} - -void pc1251_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_POWER_UP: - m_power = 0; - break; - default: - assert_always(FALSE, "Unknown id in pc1251_state::device_timer"); - } -} - -DRIVER_INIT_MEMBER(pc1251_state,pc1251) -{ - int i; - UINT8 *gfx = memregion("gfx1")->base(); - for (i=0; i<128; i++) gfx[i]=i; - - m_power = 1; - timer_set(attotime::from_seconds(1), TIMER_POWER_UP); -} diff --git a/src/mess/machine/pc1350.c b/src/mess/machine/pc1350.c deleted file mode 100644 index 6559e08041e..00000000000 --- a/src/mess/machine/pc1350.c +++ /dev/null @@ -1,135 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#include "emu.h" -#include "cpu/sc61860/sc61860.h" - -#include "includes/pocketc.h" -#include "includes/pc1350.h" -#include "machine/ram.h" - - - -WRITE8_MEMBER(pc1350_state::pc1350_outa) -{ - m_outa=data; -} - -WRITE8_MEMBER(pc1350_state::pc1350_outb) -{ - m_outb=data; -} - -WRITE8_MEMBER(pc1350_state::pc1350_outc) -{ -} - -READ8_MEMBER(pc1350_state::pc1350_ina) -{ - int data = m_outa; - int t = pc1350_keyboard_line_r(space,0); - - if (t & 0x01) - data |= ioport("KEY0")->read(); - - if (t & 0x02) - data |= ioport("KEY1")->read(); - - if (t & 0x04) - data |= ioport("KEY2")->read(); - - if (t & 0x08) - data |= ioport("KEY3")->read(); - - if (t & 0x10) - data |= ioport("KEY4")->read(); - - if (t & 0x20) - data |= ioport("KEY5")->read(); - - if (m_outa & 0x01) - data |= ioport("KEY6")->read(); - - if (m_outa & 0x02) - data |= ioport("KEY7")->read(); - - if (m_outa & 0x04) - { - data |= ioport("KEY8")->read(); - - /* At Power Up we fake a 'CLS' pressure */ - if (m_power) - data |= 0x08; - } - - if (m_outa & 0x08) - data |= ioport("KEY9")->read(); - - if (m_outa & 0x10) - data |= ioport("KEY10")->read(); - - if (m_outa & 0xc0) - data |= ioport("KEY11")->read(); - - // missing lshift - - return data; -} - -READ8_MEMBER(pc1350_state::pc1350_inb) -{ - return m_outb; -} - -READ_LINE_MEMBER(pc1350_state::pc1350_brk) -{ - return (ioport("EXTRA")->read() & 0x01); -} - -void pc1350_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_POWER_UP: - m_power=0; - break; - default: - assert_always(FALSE, "Unknown id in pc1350_state::device_timer"); - } -} - -void pc1350_state::machine_start() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - m_power = 1; - timer_set(attotime::from_seconds(1), TIMER_POWER_UP); - - space.install_readwrite_bank(0x6000, 0x6fff, "bank1"); - membank("bank1")->set_base(&m_ram->pointer()[0x0000]); - - if (m_ram->size() >= 0x3000) - { - space.install_readwrite_bank(0x4000, 0x5fff, "bank2"); - membank("bank2")->set_base(&m_ram->pointer()[0x1000]); - } - else - { - space.nop_readwrite(0x4000, 0x5fff); - } - - if (m_ram->size() >= 0x5000) - { - space.install_readwrite_bank(0x2000, 0x3fff, "bank3"); - membank("bank3")->set_base(&m_ram->pointer()[0x3000]); - } - else - { - space.nop_readwrite(0x2000, 0x3fff); - } - - UINT8 *ram = memregion("maincpu")->base() + 0x2000; - UINT8 *cpu = m_maincpu->internal_ram(); - - machine().device("cpu_nvram")->set_base(cpu, 96); - machine().device("ram_nvram")->set_base(ram, 0x5000); -} diff --git a/src/mess/machine/pc1401.c b/src/mess/machine/pc1401.c deleted file mode 100644 index 7cb7fb08308..00000000000 --- a/src/mess/machine/pc1401.c +++ /dev/null @@ -1,240 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#include "emu.h" -#include "cpu/sc61860/sc61860.h" - -#include "includes/pocketc.h" -#include "includes/pc1401.h" -#include "machine/ram.h" - -/* C-CE while reset, program will not be destroyed! */ - -/* error codes -1 syntax error -2 calculation error -3 illegal function argument -4 too large a line number -5 next without for - return without gosub -6 memory overflow -7 print using error -8 i/o device error -9 other errors*/ - - - -WRITE8_MEMBER(pc1401_state::pc1401_outa) -{ - m_outa = data; -} - -WRITE8_MEMBER(pc1401_state::pc1401_outb) -{ - m_outb = data; -} - -WRITE8_MEMBER(pc1401_state::pc1401_outc) -{ - //logerror("%g outc %.2x\n", machine.time().as_double(), data); - m_portc = data; -} - -READ8_MEMBER(pc1401_state::pc1401_ina) -{ - int data = m_outa; - - if (m_outb & 0x01) - data |= ioport("KEY0")->read(); - - if (m_outb & 0x02) - data |= ioport("KEY1")->read(); - - if (m_outb & 0x04) - data |= ioport("KEY2")->read(); - - if (m_outb & 0x08) - data |= ioport("KEY3")->read(); - - if (m_outb & 0x10) - data |= ioport("KEY4")->read(); - - if (m_outb & 0x20) - { - data |= ioport("KEY5")->read(); - - /* At Power Up we fake a 'C-CE' pressure */ - if (m_power) - data |= 0x01; - } - - if (m_outa & 0x01) - data |= ioport("KEY6")->read(); - - if (m_outa & 0x02) - data |= ioport("KEY7")->read(); - - if (m_outa & 0x04) - data |= ioport("KEY8")->read(); - - if (m_outa & 0x08) - data |= ioport("KEY9")->read(); - - if (m_outa & 0x10) - data |= ioport("KEY10")->read(); - - if (m_outa & 0x20) - data |= ioport("KEY11")->read(); - - if (m_outa & 0x40) - data |= ioport("KEY12")->read(); - - return data; -} - -READ8_MEMBER(pc1401_state::pc1401_inb) -{ - int data=m_outb; - - if (ioport("EXTRA")->read() & 0x04) - data |= 0x01; - - return data; -} - -READ_LINE_MEMBER(pc1401_state::pc1401_brk) -{ - return (ioport("EXTRA")->read() & 0x01); -} - -READ_LINE_MEMBER(pc1401_state::pc1401_reset) -{ - return (ioport("EXTRA")->read() & 0x02); -} - -void pc1401_state::machine_start() -{ - UINT8 *ram = memregion("maincpu")->base() + 0x2000; - UINT8 *cpu = m_maincpu->internal_ram(); - - machine().device("cpu_nvram")->set_base(cpu, 96); - machine().device("ram_nvram")->set_base(ram, 0x2800); -} - -void pc1401_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_POWER_UP: - m_power = 0; - break; - default: - assert_always(FALSE, "Unknown id in pc1401_state::device_timer"); - } -} - -DRIVER_INIT_MEMBER(pc1401_state,pc1401) -{ - int i; - UINT8 *gfx=memregion("gfx1")->base(); -#if 0 - static const char sucker[]={ - /* this routine dump the memory (start 0) - in an endless loop, - the pc side must be started before this - its here to allow verification of the decimal data - in mame disassembler - */ -#if 1 - 18,4,/*lip xl */ - 2,0,/*lia 0 startaddress low */ - 219,/*exam */ - 18,5,/*lip xh */ - 2,0,/*lia 0 startaddress high */ - 219,/*exam */ -/*400f x: */ - /* dump internal rom */ - 18,5,/*lip 4 */ - 89,/*ldm */ - 218,/*exab */ - 18,4,/*lip 5 */ - 89,/*ldm */ - 4,/*ix for increasing x */ - 0,0,/*lii,0 */ - 18,20,/*lip 20 */ - 53, /* */ - 18,20,/* lip 20 */ - 219,/*exam */ -#else - 18,4,/*lip xl */ - 2,255,/*lia 0 */ - 219,/*exam */ - 18,5,/*lip xh */ - 2,255,/*lia 0 */ - 219,/*exam */ -/*400f x: */ - /* dump external memory */ - 4, /*ix */ - 87,/* ldd */ -#endif - 218,/*exab */ - - - - 0,4,/*lii 4 */ - - /*a: */ - 218,/* exab */ - 90,/* sl */ - 218,/* exab */ - 18,94,/* lip 94 */ - 96,252,/* anma 252 */ - 2,2, /*lia 2 */ - 196,/* adcm */ - 95,/* outf */ - /*b: */ - 204,/*inb */ - 102,128,/*tsia 0x80 */ -#if 0 - 41,4,/* jnzm b */ -#else - /* input not working reliable! */ - /* so handshake removed, PC side must run with disabled */ - /* interrupt to not lose data */ - 78,20, /*wait 20 */ -#endif - - 218,/* exab */ - 90,/* sl */ - 218,/* exab */ - 18,94,/* lip 94 */ - 96,252,/*anma 252 */ - 2,0,/* lia 0 */ - 196,/*adcm */ - 95,/* outf */ - /*c: */ - 204,/*inb */ - 102,128,/*tsia 0x80 */ -#if 0 - 57,4,/* jzm c */ -#else - 78,20, /*wait 20 */ -#endif - - 65,/*deci */ - 41,34,/*jnzm a */ - - 41,41,/*jnzm x: */ - - 55,/* rtn */ - }; - - for (i=0; i>9]=data; - switch( (offset>>9) ){ - case 0/*0x3800*/: - // output - logerror ("asic write %.4x %.2x\n",offset, data); - break; - case 1/*0x3a00*/: - logerror ("asic write %.4x %.2x\n",offset, data); - break; - case 2/*0x3c00*/: - membank("bank1")->set_base(memregion("user1")->base()+((data&7)<<14)); - logerror ("asic write %.4x %.2x\n",offset, data); - break; - case 3/*0x3e00*/: break; - } -} - -READ8_MEMBER(pc1403_state::pc1403_asic_read) -{ - UINT8 data=m_asic[offset>>9]; - switch( (offset>>9) ){ - case 0: case 1: case 2: - logerror ("asic read %.4x %.2x\n",offset, data); - break; - } - return data; -} - -WRITE8_MEMBER(pc1403_state::pc1403_outa) -{ - m_outa=data; -} - -READ8_MEMBER(pc1403_state::pc1403_ina) -{ - UINT8 data=m_outa; - - if (m_asic[3] & 0x01) - data |= ioport("KEY0")->read(); - - if (m_asic[3] & 0x02) - data |= ioport("KEY1")->read(); - - if (m_asic[3] & 0x04) - data |= ioport("KEY2")->read(); - - if (m_asic[3] & 0x08) - data |= ioport("KEY3")->read(); - - if (m_asic[3] & 0x10) - data |= ioport("KEY4")->read(); - - if (m_asic[3] & 0x20) - data |= ioport("KEY5")->read(); - - if (m_asic[3] & 0x40) - data |= ioport("KEY6")->read(); - - if (m_outa & 0x01) - { - data |= ioport("KEY7")->read(); - - /* At Power Up we fake a 'C-CE' pressure */ - if (m_power) - data |= 0x02; - } - - if (m_outa & 0x02) - data |= ioport("KEY8")->read(); - - if (m_outa & 0x04) - data |= ioport("KEY9")->read(); - - if (m_outa & 0x08) - data |= ioport("KEY10")->read(); - - if (m_outa & 0x10) - data |= ioport("KEY11")->read(); - - if (m_outa & 0x20) - data |= ioport("KEY12")->read(); - - if (m_outa & 0x40) - data |= ioport("KEY13")->read(); - - return data; -} - -#if 0 -READ8_MEMBER(pc1403_state::pc1403_inb) -{ - int data = m_outb; - - if (ioport("KEY13")->read()) - data |= 1; - - return data; -} -#endif - -WRITE8_MEMBER(pc1403_state::pc1403_outc) -{ - m_portc = data; -// logerror("%g pc %.4x outc %.2x\n", device->machine().time().as_double(), device->m_maincpu->safe_pc(), data); -} - - -READ_LINE_MEMBER(pc1403_state::pc1403_brk) -{ - return (ioport("EXTRA")->read() & 0x01); -} - -READ_LINE_MEMBER(pc1403_state::pc1403_reset) -{ - return (ioport("EXTRA")->read() & 0x02); -} - -void pc1403_state::machine_start() -{ - UINT8 *ram = memregion("maincpu")->base() + 0x8000; - UINT8 *cpu = m_maincpu->internal_ram(); - - machine().device("cpu_nvram")->set_base(cpu, 96); - machine().device("ram_nvram")->set_base(ram, 0x8000); -} - -void pc1403_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_POWER_UP: - m_power=0; - break; - default: - assert_always(FALSE, "Unknown id in pc1403_state::device_timer"); - } -} - -DRIVER_INIT_MEMBER(pc1403_state,pc1403) -{ - int i; - UINT8 *gfx=memregion("gfx1")->base(); - - for (i=0; i<128; i++) gfx[i]=i; - - m_power = 1; - timer_set(attotime::from_seconds(1), TIMER_POWER_UP); - - membank("bank1")->set_base(memregion("user1")->base()); -} diff --git a/src/mess/machine/pc1512kb.c b/src/mess/machine/pc1512kb.c deleted file mode 100644 index 6d4ef54e134..00000000000 --- a/src/mess/machine/pc1512kb.c +++ /dev/null @@ -1,506 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Amstrad PC1512 Keyboard emulation - -**********************************************************************/ - -#include "pc1512kb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8048_TAG "ic801" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type PC1512_KEYBOARD = &device_creator; - - -//------------------------------------------------- -// ROM( pc1512_keyboard ) -//------------------------------------------------- - -ROM_START( pc1512_keyboard ) - ROM_REGION( 0x400, I8048_TAG, 0 ) - ROM_LOAD( "40042.ic801", 0x000, 0x400, CRC(607edaf6) SHA1(4422c6475596c3881c11b6a6266811c336d55d19) ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *pc1512_keyboard_device::device_rom_region() const -{ - return ROM_NAME( pc1512_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( pc1512_keyboard_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( pc1512_keyboard_io, AS_IO, 8, pc1512_keyboard_device ) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(kb_bus_r) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kb_p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(kb_p2_r, kb_p2_w) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(kb_t0_r) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(kb_t1_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// MACHINE_DRIVER( pc1512_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( pc1512_keyboard ) - MCFG_CPU_ADD(I8048_TAG, I8048, XTAL_6MHz) - MCFG_CPU_IO_MAP(pc1512_keyboard_io) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor pc1512_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pc1512_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( pc1512_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( pc1512_keyboard ) - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\'') PORT_CHAR('|') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('?') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('@') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('#') PORT_CHAR('~') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_PRTSCR) - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Num Lock") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break Scroll Lock") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 Pg Up") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) - - PORT_START("Y10") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 Pg Dn") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del " UTF8_RIGHT) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - - PORT_START("Y11") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) - - PORT_START("COM") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor pc1512_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc1512_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc1512_keyboard_device - constructor -//------------------------------------------------- - -pc1512_keyboard_device::pc1512_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PC1512_KEYBOARD, "Amstrad PC1512 Keyboard", tag, owner, clock, "pc1512kb", __FILE__), - m_maincpu(*this, I8048_TAG), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_y11(*this, "Y11"), - m_com(*this, "COM"), - m_write_clock(*this), - m_write_data(*this), - m_data_in(1), - m_clock_in(1), - m_kb_y(0xffff), - m_joy_com(1), - m_m1(1), - m_m2(1) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc1512_keyboard_device::device_start() -{ - // allocate timers - m_reset_timer = timer_alloc(); - - // resolve callbacks - m_write_clock.resolve_safe(); - m_write_data.resolve_safe(); - - // state saving - save_item(NAME(m_data_in)); - save_item(NAME(m_clock_in)); - save_item(NAME(m_kb_y)); - save_item(NAME(m_joy_com)); - save_item(NAME(m_m1)); - save_item(NAME(m_m2)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void pc1512_keyboard_device::device_reset() -{ - m_maincpu->set_input_line(MCS48_INPUT_EA, CLEAR_LINE); -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void pc1512_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if (!m_clock_in) - { - m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - } -} - - -//------------------------------------------------- -// data_w - keyboard data input -//------------------------------------------------- - -WRITE_LINE_MEMBER( pc1512_keyboard_device::data_w ) -{ - m_data_in = state; -} - - -//------------------------------------------------- -// clock_w - keyboard clock input -//------------------------------------------------- - -WRITE_LINE_MEMBER( pc1512_keyboard_device::clock_w ) -{ - if (m_clock_in != state) - { - if (!state) - { - m_reset_timer->adjust(attotime::from_msec(10)); - } - else - { - m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); - } - } - - m_clock_in = state; -} - - -//------------------------------------------------- -// m1_w - mouse button 1 -//------------------------------------------------- - -WRITE_LINE_MEMBER( pc1512_keyboard_device::m1_w ) -{ - m_m1 = state; -} - - -//------------------------------------------------- -// m2_w - mouse button 2 -//------------------------------------------------- - -WRITE_LINE_MEMBER( pc1512_keyboard_device::m2_w ) -{ - m_m2 = state; -} - - -//------------------------------------------------- -// kb_bus_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_keyboard_device::kb_bus_r ) -{ - /* - - bit description - - 0 X1 - 1 X2 - 2 X3 - 3 X4 - 4 X5 - 5 X6 - 6 X7 - 7 X8 - - */ - - UINT8 data = 0xff; - - if (!BIT(m_kb_y, 0)) data &= m_y1->read(); - if (!BIT(m_kb_y, 1)) data &= m_y2->read(); - if (!BIT(m_kb_y, 2)) data &= m_y3->read(); - if (!BIT(m_kb_y, 3)) data &= m_y4->read(); - if (!BIT(m_kb_y, 4)) data &= m_y5->read(); - if (!BIT(m_kb_y, 5)) data &= m_y6->read(); - if (!BIT(m_kb_y, 6)) data &= m_y7->read(); - if (!BIT(m_kb_y, 7)) data &= m_y8->read(); - if (!BIT(m_kb_y, 8)) data &= m_y9->read(); - if (!BIT(m_kb_y, 9)) data &= m_y10->read(); - if (!BIT(m_kb_y, 10)) data &= m_y11->read(); - if (!m_joy_com) data &= m_com->read(); - - return data; -} - - -//------------------------------------------------- -// kb_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_keyboard_device::kb_p1_w ) -{ - /* - - bit description - - 0 Y1 - 1 Y2 - 2 Y3 - 3 Y4 - 4 Y5 - 5 Y6 - 6 Y7 - 7 Y8 - - */ - - m_kb_y = (m_kb_y & 0xff00) | data; -} - - -//------------------------------------------------- -// kb_p2_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_keyboard_device::kb_p2_r ) -{ - /* - - bit description - - 0 SERIAL DATA - 1 SERIAL CLOCK - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - UINT8 data = 0; - - data |= m_data_in; - data |= m_clock_in << 1; - - return data; -} - - -//------------------------------------------------- -// kb_p2_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_keyboard_device::kb_p2_w ) -{ - /* - - bit description - - 0 SERIAL DATA - 1 SERIAL CLOCK - 2 CAPS LED - 3 NUM LED - 4 Y9 - 5 Y10 - 6 Y11 - 7 joystick COM - - */ - - // keyboard data - m_write_data(BIT(data, 0)); - - // keyboard clock - m_write_clock(BIT(data, 1)); - - // CAPS LOCK - output_set_led_value(LED_CAPS, BIT(data, 2)); - - // NUM LOCK - output_set_led_value(LED_NUM, BIT(data, 3)); - - // keyboard row - m_kb_y = (((data >> 4) & 0x07) << 8) | (m_kb_y & 0xff); - - // joystick common - m_joy_com = BIT(data, 7); -} - - -//------------------------------------------------- -// kb_t0_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_keyboard_device::kb_t0_r ) -{ - return m_m1; -} - - -//------------------------------------------------- -// kb_t1_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_keyboard_device::kb_t1_r ) -{ - return m_m2; -} diff --git a/src/mess/machine/pc1512kb.h b/src/mess/machine/pc1512kb.h deleted file mode 100644 index a5012b69b8a..00000000000 --- a/src/mess/machine/pc1512kb.h +++ /dev/null @@ -1,118 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Amstrad PC1512 Keyboard emulation - -**********************************************************************/ - -#pragma once - -#ifndef __PC1512_KEYBOARD__ -#define __PC1512_KEYBOARD__ - - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define PC1512_KEYBOARD_TAG "pc1512_keyboard" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_PC1512_KEYBOARD_CLOCK_CALLBACK(_write) \ - devcb = &pc1512_keyboard_device::set_clock_wr_callback(*device, DEVCB_##_write); - -#define MCFG_PC1512_KEYBOARD_DATA_CALLBACK(_write) \ - devcb = &pc1512_keyboard_device::set_data_wr_callback(*device, DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> pc1512_keyboard_device - -class pc1512_keyboard_device : public device_t -{ -public: - // construction/destruction - pc1512_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_clock_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clock.set_callback(object); } - template static devcb_base &set_data_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_data.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_WRITE_LINE_MEMBER( data_w ); - DECLARE_WRITE_LINE_MEMBER( clock_w ); - DECLARE_WRITE_LINE_MEMBER( m1_w ); - DECLARE_WRITE_LINE_MEMBER( m2_w ); - - DECLARE_READ8_MEMBER( kb_bus_r ); - DECLARE_WRITE8_MEMBER( kb_p1_w ); - DECLARE_READ8_MEMBER( kb_p2_r ); - DECLARE_WRITE8_MEMBER( kb_p2_w ); - DECLARE_READ8_MEMBER( kb_t0_r ); - DECLARE_READ8_MEMBER( kb_t1_r ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - enum - { - LED_CAPS = 0, - LED_NUM - }; - - required_device m_maincpu; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_y11; - required_ioport m_com; - - devcb_write_line m_write_clock; - devcb_write_line m_write_data; - - int m_data_in; - int m_clock_in; - int m_kb_y; - int m_joy_com; - int m_m1; - int m_m2; - - emu_timer *m_reset_timer; -}; - - -// device type definition -extern const device_type PC1512_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/pc9801_118.c b/src/mess/machine/pc9801_118.c deleted file mode 100644 index 5549ad8dedc..00000000000 --- a/src/mess/machine/pc9801_118.c +++ /dev/null @@ -1,228 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-118 sound card - - YMF288 + some extra ports - - TODO: - - preliminary, presumably needs CS-4231 too - - joystick code should be shared between -26, -86 and -118 - -***************************************************************************/ - -#include "emu.h" -#include "machine/pc9801_118.h" -#include "machine/pic8259.h" -#include "sound/2608intf.h" - -#define MAIN_CLOCK_X1 XTAL_1_9968MHz - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -// device type definition -const device_type PC9801_118 = &device_creator; - - -READ8_MEMBER(pc9801_118_device::opn_porta_r) -{ - if(m_joy_sel & 0x80) - return ioport(m_joy_sel & 0x40 ? "OPN3_PA2" : "OPN3_PA1")->read(); - - return 0xff; -} - -WRITE8_MEMBER(pc9801_118_device::opn_portb_w){ m_joy_sel = data; } - -WRITE_LINE_MEMBER(pc9801_118_device::pc9801_sound_irq) -{ - /* TODO: seems to die very often */ - machine().device(":pic8259_slave")->ir4_w(state); -} - -static MACHINE_CONFIG_FRAGMENT( pc9801_118_config ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opn3", YM2608, MAIN_CLOCK_X1*4) // actually YMF288, unknown clock / divider - MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc9801_118_device, pc9801_sound_irq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_118_device, opn_porta_r)) - //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) - //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_118_device, opn_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor pc9801_118_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pc9801_118_config ); -} - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( pc9801_118 ) - PORT_START("OPN3_PA1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Up") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Down") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Left") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Right") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPN3_PA2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Up") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Down") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Left") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Right") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPN3_DSW") - PORT_CONFNAME( 0x01, 0x00, "PC-9801-118: Port Base" ) - PORT_CONFSETTING( 0x00, "0x088" ) - PORT_CONFSETTING( 0x01, "0x188" ) -INPUT_PORTS_END - -ioport_constructor pc9801_118_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc9801_118 ); -} - -// RAM -ROM_START( pc9801_118 ) - ROM_REGION( 0x100000, "opn3", ROMREGION_ERASE00 ) -ROM_END - -const rom_entry *pc9801_118_device::device_rom_region() const -{ - return ROM_NAME( pc9801_118 ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_118_device - constructor -//------------------------------------------------- - -pc9801_118_device::pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PC9801_118, "pc9801_118", tag, owner, clock, "pc9801_118", __FILE__), -// m_maincpu(*owner, "maincpu"), - m_opn3(*this, "opn3") -{ -} - - -//------------------------------------------------- -// device_validity_check - perform validity checks -// on this device -//------------------------------------------------- - -void pc9801_118_device::device_validity_check(validity_checker &valid) const -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_118_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) -{ - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0); - break; - case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff); - break; - case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff); - break; - default: - fatalerror("PC-9801-118: Bus width %d not supported\n", buswidth); - } -} - - -void pc9801_118_device::device_start() -{ -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void pc9801_118_device::device_reset() -{ - UINT16 port_base = (ioport("OPN3_DSW")->read() & 1) << 8; - install_device(port_base + 0x0088, port_base + 0x008f, 0, 0, read8_delegate(FUNC(pc9801_118_device::pc9801_118_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_w), this) ); - install_device(0xa460, 0xa463, 0, 0, read8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_r), this), write8_delegate(FUNC(pc9801_118_device::pc9801_118_ext_w), this) ); - m_ext_reg = 1; // TODO: enabled or disabled? -} - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - - -READ8_MEMBER(pc9801_118_device::pc9801_118_r) -{ - if(((offset & 5) == 0) || m_ext_reg) - return m_opn3->read(space, offset >> 1); - else // odd - { - //printf("PC9801-118: Read to undefined port [%02x]\n",offset+0x188); - return 0xff; - } -} - - -WRITE8_MEMBER(pc9801_118_device::pc9801_118_w) -{ - if(((offset & 5) == 0) || m_ext_reg) - m_opn3->write(space, offset >> 1,data); - //else // odd - // printf("PC9801-118: Write to undefined port [%02x] %02x\n",offset+0x188,data); -} - -READ8_MEMBER( pc9801_118_device::pc9801_118_ext_r ) -{ - if(offset == 0) - { - printf("OPN3 EXT read ID [%02x]\n",offset); - return 0x80 | (m_ext_reg & 1); - } - - printf("OPN3 EXT read unk [%02x]\n",offset); - return 0xff; -} - -WRITE8_MEMBER( pc9801_118_device::pc9801_118_ext_w ) -{ - if(offset == 0) - { - m_ext_reg = data & 1; - /* TODO: apparently writing a 1 doubles the available channels (and presumably enables CS-4231 too) */ - if(data) - printf("PC-9801-118: extended register %02x write\n",data); - return; - } - - printf("OPN3 EXT write unk %02x -> [%02x]\n",data,offset); -} diff --git a/src/mess/machine/pc9801_118.h b/src/mess/machine/pc9801_118.h deleted file mode 100644 index 210a1c4fa07..00000000000 --- a/src/mess/machine/pc9801_118.h +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-118 - -***************************************************************************/ - - -#pragma once - -#ifndef __PC9801_118DEV_H__ -#define __PC9801_118DEV_H__ - -#include "machine/pic8259.h" -#include "sound/2608intf.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> pc9801_118_device - -class pc9801_118_device : public device_t -{ -public: - // construction/destruction - pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_READ8_MEMBER(opn_porta_r); - DECLARE_WRITE8_MEMBER(opn_portb_w); - DECLARE_READ8_MEMBER(pc9801_118_r); - DECLARE_WRITE8_MEMBER(pc9801_118_w); - DECLARE_READ8_MEMBER(pc9801_118_ext_r); - DECLARE_WRITE8_MEMBER(pc9801_118_ext_w); - DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); - -// required_device m_maincpu; - required_device m_opn3; - virtual const rom_entry *device_rom_region() const; -protected: - // device-level overrides - virtual void device_validity_check(validity_checker &valid) const; - virtual void device_start(); - virtual void device_reset(); - void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler); - -private: - UINT8 m_joy_sel; - UINT8 m_ext_reg; -}; - - -// device type definition -extern const device_type PC9801_118; - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - - - -#endif diff --git a/src/mess/machine/pc9801_26.c b/src/mess/machine/pc9801_26.c deleted file mode 100644 index 2f0b0351c7c..00000000000 --- a/src/mess/machine/pc9801_26.c +++ /dev/null @@ -1,194 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-26 sound card - - Legacy sound card for PC-98xx family, composed by a single YM2203 - - TODO: - - joystick code should be shared between -26, -86 and -118 - -***************************************************************************/ - -#include "emu.h" -#include "machine/pc9801_26.h" -#include "machine/pic8259.h" -#include "sound/2203intf.h" - -#define MAIN_CLOCK_X1 XTAL_1_9968MHz - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -// device type definition -const device_type PC9801_26 = &device_creator; - - - -READ8_MEMBER(pc9801_26_device::opn_porta_r) -{ - if(m_joy_sel & 0x80) - return ioport(m_joy_sel & 0x40 ? "OPN_PA2" : "OPN_PA1")->read(); - - return 0xff; -} - -WRITE8_MEMBER(pc9801_26_device::opn_portb_w){ m_joy_sel = data; } - -WRITE_LINE_MEMBER(pc9801_26_device::pc9801_sound_irq) -{ - /* TODO: seems to die very often */ - machine().device(":pic8259_slave")->ir4_w(state); -} - -static MACHINE_CONFIG_FRAGMENT( pc9801_26_config ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider - MCFG_YM2203_IRQ_HANDLER(WRITELINE(pc9801_26_device, pc9801_sound_irq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_26_device, opn_porta_r)) - //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) - //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_26_device, opn_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor pc9801_26_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pc9801_26_config ); -} - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( pc9801_26 ) - PORT_START("OPN_PA1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Up") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Down") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Left") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Right") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPN_PA2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Up") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Down") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Left") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Right") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPN_DSW") - PORT_CONFNAME( 0x01, 0x01, "PC-9801-26: Port Base" ) - PORT_CONFSETTING( 0x00, "0x088" ) - PORT_CONFSETTING( 0x01, "0x188" ) -INPUT_PORTS_END - -ioport_constructor pc9801_26_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc9801_26 ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_26_device - constructor -//------------------------------------------------- - -pc9801_26_device::pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PC9801_26, "pc9801_26", tag, owner, clock, "pc9801_26", __FILE__), -// m_maincpu(*owner, "maincpu"), - m_opn(*this, "opn") -{ -} - - -//------------------------------------------------- -// device_validity_check - perform validity checks -// on this device -//------------------------------------------------- - -void pc9801_26_device::device_validity_check(validity_checker &valid) const -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_26_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) -{ - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0); - break; - case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff); - break; - case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff); - break; - default: - fatalerror("PC-9801-26: Bus width %d not supported\n", buswidth); - } -} - - -void pc9801_26_device::device_start() -{ -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void pc9801_26_device::device_reset() -{ - UINT16 port_base = (ioport("OPN_DSW")->read() & 1) << 8; - install_device(port_base + 0x0088, port_base + 0x008b, 0, 0, read8_delegate(FUNC(pc9801_26_device::pc9801_26_r), this), write8_delegate(FUNC(pc9801_26_device::pc9801_26_w), this) ); -} - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - - -READ8_MEMBER(pc9801_26_device::pc9801_26_r) -{ - if((offset & 1) == 0) - { - return offset & 4 ? 0xff : m_opn->read(space, offset >> 1); - } - else // odd - { - printf("Read to undefined port [%02x]\n",offset+0x188); - return 0xff; - } -} - - -WRITE8_MEMBER(pc9801_26_device::pc9801_26_w) -{ - if((offset & 5) == 0) - m_opn->write(space, offset >> 1, data); - else // odd - printf("PC9801-26: Write to undefined port [%02x] %02x\n",offset+0x188,data); -} diff --git a/src/mess/machine/pc9801_26.h b/src/mess/machine/pc9801_26.h deleted file mode 100644 index 7f6ab795020..00000000000 --- a/src/mess/machine/pc9801_26.h +++ /dev/null @@ -1,67 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - -Template for skeleton device - -***************************************************************************/ - - -#pragma once - -#ifndef __PC9801_26DEV_H__ -#define __PC9801_26DEV_H__ - -#include "machine/pic8259.h" -#include "sound/2203intf.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> pc9801_26_device - -class pc9801_26_device : public device_t -{ -public: - // construction/destruction - pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_READ8_MEMBER(opn_porta_r); - DECLARE_WRITE8_MEMBER(opn_portb_w); - DECLARE_READ8_MEMBER(pc9801_26_r); - DECLARE_WRITE8_MEMBER(pc9801_26_w); - DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); - -// required_device m_maincpu; - required_device m_opn; -protected: - // device-level overrides - virtual void device_validity_check(validity_checker &valid) const; - virtual void device_start(); - virtual void device_reset(); - void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler); - -private: - UINT8 m_joy_sel; - -}; - - -// device type definition -extern const device_type PC9801_26; - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - - - -#endif diff --git a/src/mess/machine/pc9801_86.c b/src/mess/machine/pc9801_86.c deleted file mode 100644 index 1416e01fd4b..00000000000 --- a/src/mess/machine/pc9801_86.c +++ /dev/null @@ -1,227 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-86 sound card - - Almost the same thing as PC-9801-86, but this one has YM2608 instead of - YM2203 - - TODO: - - joystick code should be shared between -26, -86 and -118 - -***************************************************************************/ - -#include "emu.h" -#include "machine/pc9801_86.h" -#include "machine/pic8259.h" -#include "sound/2608intf.h" - -#define MAIN_CLOCK_X1 XTAL_1_9968MHz - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -// device type definition -const device_type PC9801_86 = &device_creator; - - -READ8_MEMBER(pc9801_86_device::opn_porta_r) -{ - if(m_joy_sel & 0x80) - return ioport(m_joy_sel & 0x40 ? "OPNA_PA2" : "OPNA_PA1")->read(); - - return 0xff; -} - -WRITE8_MEMBER(pc9801_86_device::opn_portb_w){ m_joy_sel = data; } - -WRITE_LINE_MEMBER(pc9801_86_device::pc9801_sound_irq) -{ - /* TODO: seems to die very often */ - machine().device(":pic8259_slave")->ir4_w(state); -} - -static MACHINE_CONFIG_FRAGMENT( pc9801_86_config ) - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("opna", YM2608, MAIN_CLOCK_X1*4) // unknown clock / divider - MCFG_YM2608_IRQ_HANDLER(WRITELINE(pc9801_86_device, pc9801_sound_irq)) - MCFG_AY8910_PORT_A_READ_CB(READ8(pc9801_86_device, opn_porta_r)) - //MCFG_AY8910_PORT_B_READ_CB(READ8(pc9801_state, opn_portb_r)) - //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(pc9801_state, opn_porta_w)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(pc9801_86_device, opn_portb_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor pc9801_86_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pc9801_86_config ); -} - -// RAM -ROM_START( pc9801_86 ) - ROM_REGION( 0x100000, "opna", ROMREGION_ERASE00 ) -ROM_END - -const rom_entry *pc9801_86_device::device_rom_region() const -{ - return ROM_NAME( pc9801_86 ); -} - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( pc9801_86 ) - PORT_START("OPNA_PA1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Up") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Down") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Left") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Right") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPNA_PA2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Up") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Down") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Left") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Right") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2") - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("OPNA_DSW") - PORT_CONFNAME( 0x01, 0x01, "PC-9801-86: Port Base" ) - PORT_CONFSETTING( 0x00, "0x088" ) - PORT_CONFSETTING( 0x01, "0x188" ) -INPUT_PORTS_END - -ioport_constructor pc9801_86_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc9801_86 ); -} - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_86_device - constructor -//------------------------------------------------- - -pc9801_86_device::pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PC9801_86, "pc9801_86", tag, owner, clock, "pc9801_86", __FILE__), -// m_maincpu(*owner, "maincpu"), - m_opna(*this, "opna") -{ -} - - -//------------------------------------------------- -// device_validity_check - perform validity checks -// on this device -//------------------------------------------------- - -void pc9801_86_device::device_validity_check(validity_checker &valid) const -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_86_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler) -{ - int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; - switch(buswidth) - { - case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0); - break; - case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff); - break; - case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff); - break; - default: - fatalerror("PC-9801-86: Bus width %d not supported\n", buswidth); - } -} - - -void pc9801_86_device::device_start() -{ -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void pc9801_86_device::device_reset() -{ - UINT16 port_base = (ioport("OPNA_DSW")->read() & 1) << 8; - install_device(port_base + 0x0088, port_base + 0x008f, 0, 0, read8_delegate(FUNC(pc9801_86_device::pc9801_86_r), this), write8_delegate(FUNC(pc9801_86_device::pc9801_86_w), this) ); -// install_device(0xa460, 0xa463, 0, 0, read8_delegate(FUNC(pc9801_86_device::pc9801_86_ext_r), this), write8_delegate(FUNC(pc9801_86_device::pc9801_86_ext_w), this) ); - -} - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - - -READ8_MEMBER(pc9801_86_device::pc9801_86_r) -{ - if((offset & 1) == 0) - return m_opna->read(space, offset >> 1); - else // odd - { - printf("PC9801-86: Read to undefined port [%02x]\n",offset+0x188); - return 0xff; - } -} - - -WRITE8_MEMBER(pc9801_86_device::pc9801_86_w) -{ - if((offset & 1) == 0) - m_opna->write(space, offset >> 1,data); - else // odd - printf("PC9801-86: Write to undefined port [%02x] %02x\n",offset+0x188,data); -} - -#if 0 -READ8_MEMBER( pc9801_86_device::pc9801_86_ext_r ) -{ - if(offset == 0) - { - printf("OPNA EXT read ID [%02x]\n",offset); - return 0xff; - } - - printf("OPNA EXT read unk [%02x]\n",offset); - return 0xff; -} - -WRITE8_MEMBER( pc9801_86_device::pc9801_86_ext_w ) -{ - if(offset == 0) - { - printf("OPNA EXT write mask %02x -> [%02x]\n",data,offset); - return; - } - - printf("OPNA EXT write unk %02x -> [%02x]\n",data,offset); -} -#endif diff --git a/src/mess/machine/pc9801_86.h b/src/mess/machine/pc9801_86.h deleted file mode 100644 index 633a2282dfd..00000000000 --- a/src/mess/machine/pc9801_86.h +++ /dev/null @@ -1,69 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - NEC PC-9801-86 - -***************************************************************************/ - - -#pragma once - -#ifndef __PC9801_86DEV_H__ -#define __PC9801_86DEV_H__ - -#include "machine/pic8259.h" -#include "sound/2608intf.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> pc9801_86_device - -class pc9801_86_device : public device_t -{ -public: - // construction/destruction - pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_READ8_MEMBER(opn_porta_r); - DECLARE_WRITE8_MEMBER(opn_portb_w); - DECLARE_READ8_MEMBER(pc9801_86_r); - DECLARE_WRITE8_MEMBER(pc9801_86_w); - DECLARE_WRITE_LINE_MEMBER(pc9801_sound_irq); -// DECLARE_READ8_MEMBER(pc9801_86_ext_r); -// DECLARE_WRITE8_MEMBER(pc9801_86_ext_w); - -// required_device m_maincpu; - required_device m_opna; - virtual const rom_entry *device_rom_region() const; -protected: - // device-level overrides - virtual void device_validity_check(validity_checker &valid) const; - virtual void device_start(); - virtual void device_reset(); - void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler); - -private: - UINT8 m_joy_sel; - -}; - - -// device type definition -extern const device_type PC9801_86; - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - - - -#endif diff --git a/src/mess/machine/pc9801_cbus.c b/src/mess/machine/pc9801_cbus.c deleted file mode 100644 index 2e3f6b59670..00000000000 --- a/src/mess/machine/pc9801_cbus.c +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/********************************************************************** - - CCBUS Slot interface for PC-98xx family - -**********************************************************************/ - -#include "pc9801_cbus.h" - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -const device_type PC9801CBUS_SLOT = &device_creator; - - - -//************************************************************************** -// DEVICE PC9801 CARD INTERFACE -//************************************************************************** - -#if 0 -//------------------------------------------------- -// device_pc9801cbus_card_interface - constructor -//------------------------------------------------- - -device_pc9801cbus_card_interface::device_pc9801cbus_card_interface(const machine_config &mconfig, device_t &device) - : device_slot_card_interface(mconfig, device) -{ -} - - -//------------------------------------------------- -// ~device_pc9801cbus_card_interface - destructor -//------------------------------------------------- - -device_pc9801cbus_card_interface::~device_pc9801cbus_card_interface() -{ -} -#endif - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_slot_device - constructor -//------------------------------------------------- - -pc9801_slot_device::pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, PC9801CBUS_SLOT, "PC-9801 sound cbus slot", tag, owner, clock, "pc9801_slot", __FILE__), - device_slot_interface(mconfig, *this) -{ -} - - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void pc9801_slot_device::device_config_complete() -{ - // ... -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_slot_device::device_start() -{ -// m_card = dynamic_cast(get_card_device()); -} diff --git a/src/mess/machine/pc9801_cbus.h b/src/mess/machine/pc9801_cbus.h deleted file mode 100644 index b8d874dcf7a..00000000000 --- a/src/mess/machine/pc9801_cbus.h +++ /dev/null @@ -1,77 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/********************************************************************** - - -**********************************************************************/ - -#pragma once - -#ifndef __PC9801_SLOTCBUS__ -#define __PC9801_SLOTCBUS__ - -#include "emu.h" - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - - -#define MCFG_PC9801CBUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, PC9801CBUS_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - - - - -//class pc9801_slot_device; - -#if 0 -class device_pc9801_slot_card_interface : public device_slot_card_interface -{ - friend class pc9801_slot_device; - -public: - // construction/destruction - device_pc9801_slot_card_interface(const machine_config &mconfig, device_t &device); - virtual ~device_pc9801_card_interface(); -}; -#endif - -// ======================> pc9801_slot_device - -class pc9801_slot_device : public device_t, - public device_slot_interface -{ -public: - // construction/destruction - pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // device-level overrides - virtual void device_start(); - virtual void device_config_complete(); -//private: -// device_pc9801_slot_card_interface *m_card; - -}; - - -// device type definition -extern const device_type PC9801CBUS_SLOT; - - - -#endif diff --git a/src/mess/machine/pc9801_kbd.c b/src/mess/machine/pc9801_kbd.c deleted file mode 100644 index 260bd9f6b3d..00000000000 --- a/src/mess/machine/pc9801_kbd.c +++ /dev/null @@ -1,313 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - PC-9801 Keyboard simulation - - TODO: - - key repeat - - - Verify untested keys: - STOP, COPY, and vf-1 through vf-5 - - - Problems with natural keyboard (most nonprinting keys don't work) - -***************************************************************************/ - -#include "emu.h" -#include "machine/pc9801_kbd.h" - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -// device type definition -const device_type PC9801_KBD = &device_creator; - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// pc9801_kbd_device - constructor -//------------------------------------------------- - -pc9801_kbd_device::pc9801_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, PC9801_KBD, "pc9801_kbd", tag, owner, clock, "pc9801_kbd_", __FILE__), - m_write_irq(*this) -{ -} - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -INPUT_CHANGED_MEMBER(pc9801_kbd_device::key_stroke) -{ - if(newval && !oldval) - m_rx_buf[(UINT8)(FPTR)(param) & 0x7f] = 1; - - if(oldval && !newval) - m_rx_buf[(UINT8)(FPTR)(param) & 0x7f] = 2; -} - -static INPUT_PORTS_START( pc9801_kbd ) - PORT_START("KEY0") // 0x00 - 0x07 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x00) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x01) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x02) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x03) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x04) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x05) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x06) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x07) - - PORT_START("KEY1") // 0x08 - 0x0f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x08) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x09) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- / =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ / `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('`') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xC2\xA5 / \xC2\xA6") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x0f) - - PORT_START("KEY2") // 0x10 - 0x17 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x10) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x11) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x12) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x13) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x14) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x15) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x16) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x17) - - PORT_START("KEY3") // 0x18 - 0x1f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x18) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x19) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ / ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('~') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ / {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x1f) - - PORT_START("KEY4") // 0x20 - 0x27 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x20) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x21) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x22) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x23) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x24) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x25) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; / +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x26) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": / *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x27) - - PORT_START("KEY5") // 0x28 - 0x2f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] / }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x28) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x29) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x2f) - - // i feel like PORT_CHAR(UCHAR_MAMEKEY(INVALID)) shouldn't work... - PORT_START("KEY6") // 0x30 - 0x37 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", / <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x30) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". / >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x31) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ / ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x32) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CHAR(UCHAR_MAMEKEY(INVALID)) PORT_CHAR('_') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x33) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x34) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("XFER") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x35) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ROLL DOWN") PORT_CODE(KEYCODE_PGDN) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x36) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ROLL UP") PORT_CODE(KEYCODE_PGUP) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x37) - - PORT_START("KEY7") // 0x38 - 0x3f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x38) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x39) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME / CLR") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HELP") PORT_CODE(KEYCODE_END) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x3f) - - PORT_START("KEY8") // 0x40 - 0x47 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x40) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x41) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x42) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x43) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x44) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x45) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x46) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x47) - - PORT_START("KEY9") // 0x48 - 0x4f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x48) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x49) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= (PAD)") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", (PAD)") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x4f) - - PORT_START("KEYA") // 0x50 - 0x57 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x50) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("NFER") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x51) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF1?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x52) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF2?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x53) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF3?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x54) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF4?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x55) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("VF5?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x56) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 2-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x57) - - PORT_START("KEYB") // 0x58 - 0x5f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-1") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x58) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-2") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x59) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-3") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-4") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-5") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-6") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-7") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 3-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x5f) - - PORT_START("KEYC") // 0x60 - 0x67 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("STOP?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x60) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("COPY?") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x61) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x62) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x63) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x64) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x65) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x66) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x67) - - PORT_START("KEYD") // 0x68 - 0x6f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x68) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x69) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 5-5") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 5-6") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 5-7") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 5-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x6f) - - PORT_START("KEYE") // 0x70 - 0x77 - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x70) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x71) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xe3\x82\xab\xe3\x83\x8a / KANA LOCK") PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x72) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH / ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x73) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x74) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 6-6") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x75) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 6-7") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x76) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 6-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x77) - - PORT_START("KEYF") // 0x78 - 0x7f - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-1") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x78) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-2") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x79) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-3") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7a) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-4") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7b) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-5") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7c) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-6") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7d) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-7") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7e) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_kbd_device, key_stroke, 0x7f) -INPUT_PORTS_END - -ioport_constructor pc9801_kbd_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pc9801_kbd ); -} - -//------------------------------------------------- -// device_validity_check - perform validity checks -// on this device -//------------------------------------------------- - -void pc9801_kbd_device::device_validity_check(validity_checker &valid) const -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pc9801_kbd_device::device_start() -{ - m_write_irq.resolve_safe(); - - m_rxtimer = timer_alloc(RX_TIMER); - m_rxtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void pc9801_kbd_device::device_reset() -{ - int i; - - for(i=0;i<0x80;i++) - m_rx_buf[i] = 0; - - m_keyb_tx = 0xff; - m_keyb_rx = 0; -} - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void pc9801_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if(id == RX_TIMER) - { - int i; - - /* key up */ - for(i=0;i<0x80;i++) - { - if(m_rx_buf[i] == 2) - { - m_keyb_tx = i | 0x80; - m_write_irq(ASSERT_LINE); - m_rx_buf[i] = 0; - return; - } - } - - /* key down */ - for(i=0x7f;i>=0;i--) - { - if(m_rx_buf[i] == 1) - { - m_keyb_tx = i; - m_write_irq(ASSERT_LINE); - m_rx_buf[i] = 0; - return; - } - } - } -} - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -READ8_MEMBER( pc9801_kbd_device::rx_r ) -{ - m_write_irq(CLEAR_LINE); - if(!offset) - return m_keyb_tx; - return 1 | 4 | 2; -} - -WRITE8_MEMBER( pc9801_kbd_device::tx_w ) -{ - m_keyb_rx = data; -} diff --git a/src/mess/machine/pc9801_kbd.h b/src/mess/machine/pc9801_kbd.h deleted file mode 100644 index 2b87773ff12..00000000000 --- a/src/mess/machine/pc9801_kbd.h +++ /dev/null @@ -1,72 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Angelo Salese -/*************************************************************************** - - PC-9801 Keyboard simulation - -***************************************************************************/ - -#pragma once - -#ifndef __PC9801_KBDDEV_H__ -#define __PC9801_KBDDEV_H__ - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_PC9801_KBD_IRQ_CALLBACK(_write) \ - devcb = &pc9801_kbd_device::set_irq_wr_callback(*device, DEVCB_##_write); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> pc9801_kbd_device - -class pc9801_kbd_device : public device_t -{ -public: - // construction/destruction - pc9801_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_irq.set_callback(object); } - - virtual ioport_constructor device_input_ports() const; - - // I/O operations - DECLARE_WRITE8_MEMBER( tx_w ); - DECLARE_READ8_MEMBER( rx_r ); - DECLARE_INPUT_CHANGED_MEMBER(key_stroke); - -protected: - // device-level overrides - virtual void device_validity_check(validity_checker &valid) const; - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - devcb_write_line m_write_irq; - - static const device_timer_id RX_TIMER = 1; - emu_timer * m_rxtimer; - UINT8 m_rx_buf[0x80]; - UINT8 m_keyb_tx; - UINT8 m_keyb_rx; -}; - - -// device type definition -extern const device_type PC9801_KBD; - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - - - -#endif diff --git a/src/mess/machine/pcd_kbd.c b/src/mess/machine/pcd_kbd.c deleted file mode 100644 index 4c1aa9f0ea5..00000000000 --- a/src/mess/machine/pcd_kbd.c +++ /dev/null @@ -1,264 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#include "pcd_kbd.h" - -const device_type PCD_KEYBOARD = &device_creator; - -ROM_START( pcd_keyboard ) - ROM_REGION(0x1000, "mcu", 0) - ROM_LOAD("pcd_keyboard.bin", 0x0000, 0x1000, CRC(d227d6cb) SHA1(3d6140764d3d043428c941826370ebf1597c63bd)) - ROM_FILL(0x526,1,0x03) // make the PCX video happy, TODO: figure out what's really happening - ROM_FILL(0x1e1,1,0x50) // fix csum -ROM_END - - -const rom_entry *pcd_keyboard_device::device_rom_region() const -{ - return ROM_NAME( pcd_keyboard ); -} - -static ADDRESS_MAP_START( pcd_keyboard_map, AS_PROGRAM, 8, pcd_keyboard_device ) - AM_RANGE(0x000, 0xfff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pcd_keyboard_io, AS_IO, 8, pcd_keyboard_device ) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(bus_r) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r) -ADDRESS_MAP_END - -static MACHINE_CONFIG_FRAGMENT( pcd_keyboard ) - MCFG_CPU_ADD("mcu", I8035, 5760000*2) // FIXME: the mc2661 baud rate calculation - MCFG_CPU_PROGRAM_MAP(pcd_keyboard_map) - MCFG_CPU_IO_MAP(pcd_keyboard_io) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -machine_config_constructor pcd_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pcd_keyboard ); -} - -INPUT_PORTS_START( pcd_keyboard ) - PORT_START("ROW.0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW.1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x79") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("ROW.2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // shifted is U+00A7 section sign - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_PLUSMINUS) - - PORT_START("ROW.3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x7C") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - - PORT_START("ROW.4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x7A") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x60") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x1F") - - PORT_START("ROW.5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x65") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - - PORT_START("ROW.6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SEITE") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x06") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x1D") - - PORT_START("ROW.7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DRUCK") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x18") - - PORT_START("ROW.8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L" O_UMLAUT "CHEN") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x05") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("EINF" U_UMLAUT "GEN") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - - PORT_START("ROW.9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("{") PORT_CODE(KEYCODE_COLON) PORT_CHAR('{') PORT_CHAR(0x00D6) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x78") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x11") - - PORT_START("ROW.10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x6A") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("?") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('?') PORT_CHAR('~') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(0x00DC) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("}") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('}') PORT_CHAR(0x00C4) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D2") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("ROW.11") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x6F") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CE") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x70") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ZEILE") - - PORT_START("ROW.12") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x10") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HILFE") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x77") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_MULTIPLY) PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) - - PORT_START("ROW.13") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TABL") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x16") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP/LEFT") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x12") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - - PORT_START("ROW.14") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TABR") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x71") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x04") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_DIVIDE) PORT_CODE(KEYCODE_SLASH_PAD) - - PORT_START("ROW.15") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('\'') PORT_CHAR('`') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("#") PORT_CHAR('#') PORT_CHAR('^') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D1") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x0C") - - PORT_START("ROW.16") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_PAUSE) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x3C") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x7E") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) -INPUT_PORTS_END - - -ioport_constructor pcd_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( pcd_keyboard ); -} - -pcd_keyboard_device::pcd_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PCD_KEYBOARD, "PC-D Keyboard", tag, owner, clock, "pcd_kbd", __FILE__), - m_rows(*this, "ROW"), - m_p1(0), - m_out_tx_handler(*this) -{ -} - -void pcd_keyboard_device::device_start() -{ - m_out_tx_handler.resolve_safe(); - m_out_tx_handler(1); -} - -READ8_MEMBER( pcd_keyboard_device::bus_r ) -{ - if(m_p1 & 0x10) - return m_rows[16]->read(); - return m_rows[m_p1 & 0xf]->read(); -} - -READ8_MEMBER( pcd_keyboard_device::p1_r ) -{ - return m_p1; -} - -WRITE8_MEMBER( pcd_keyboard_device::p1_w ) -{ - m_p1 = data; - m_out_tx_handler(BIT(data, 5)); -} - -READ8_MEMBER( pcd_keyboard_device::t0_r ) -{ - return m_t0; -} - -WRITE_LINE_MEMBER( pcd_keyboard_device::t0_w ) -{ - m_t0 = state; -} diff --git a/src/mess/machine/pcd_kbd.h b/src/mess/machine/pcd_kbd.h deleted file mode 100644 index 7ec9e2bc70e..00000000000 --- a/src/mess/machine/pcd_kbd.h +++ /dev/null @@ -1,40 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#ifndef PCD_KBD_H_ -#define PCD_KBD_H_ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "sound/speaker.h" - -#define MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(_devcb) \ - devcb = &pcd_keyboard_device::set_out_tx_handler(*device, DEVCB_##_devcb); - -class pcd_keyboard_device : public device_t -{ -public: - pcd_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_out_tx_handler(device_t &device, _Object object) { return downcast(device).m_out_tx_handler.set_callback(object); } - - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - void device_start(); - - DECLARE_READ8_MEMBER( bus_r ); - DECLARE_READ8_MEMBER( p1_r ); - DECLARE_WRITE8_MEMBER( p1_w ); - DECLARE_READ8_MEMBER( t0_r ); - DECLARE_WRITE_LINE_MEMBER( t0_w ); -private: - required_ioport_array<17> m_rows; - UINT8 m_p1; - bool m_t0; - devcb_write_line m_out_tx_handler; -}; - -extern const device_type PCD_KEYBOARD; - -#endif /* PCD_KBD_H_ */ diff --git a/src/mess/machine/pce.c b/src/mess/machine/pce.c deleted file mode 100644 index 6aeba853933..00000000000 --- a/src/mess/machine/pce.c +++ /dev/null @@ -1,250 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Charles MacDonald, Wilbert Pol, Angelo Salese -/************************************************************ - -PC Engine CD HW notes: - -TODO: -- Dragon Ball Z: ADPCM dies after the first upload; -- Dragon Slayer - The Legend of Heroes: black screen; -- Mirai Shonen Conan: dies at new game selection; -- Snatcher: black screen after Konami logo, tries set up CD-DA - while transferring data? -- Steam Heart's: needs transfer ready irq to get past the - gameplay hang, don't know exactly when it should fire -- Steam Heart's: bad ADPCM irq, dialogue is cutted due of it; - -============================================================= - -CD Interface Register 0x00 - CDC status -x--- ---- busy signal --x-- ---- request signal ----x ---- cd signal ----- x--- i/o signal - -CD Interface Register 0x03 - BRAM lock / CD status --x-- ---- acknowledge signal ---x- ---- done signal ----x ---- bram signal ----- x--- ADPCM 2 ----- -x-- ADPCM 1 ----- --x- CDDA left/right speaker select - -CD Interface Register 0x05 - CD-DA Volume low 8-bit port - -CD Interface Register 0x06 - CD-DA Volume high 8-bit port - -CD Interface Register 0x07 - BRAM unlock / CD status -x--- ---- Enables BRAM - -CD Interface Register 0x0c - ADPCM status -x--- ---- ADPCM is reading data ----- x--- ADPCM playback (0) stopped (1) currently playing ----- -x-- pending ADPCM data write ----- ---x ADPCM playback (1) stopped (0) currently playing - -CD Interface Register 0x0d - ADPCM address control -x--- ---- ADPCM reset --x-- ---- ADPCM play ---x- ---- ADPCM repeat ----x ---- ADPCM set length ----- x--- ADPCM set read address ----- --xx ADPCM set write address -(note: some games reads bit 5 and wants it to be low otherwise they hangs, surely NOT an ADPCM repeat flag read because it doesn't make sense) - -CD Interface Register 0x0e - ADPCM playback rate - -CD Interface Register 0x0f - ADPCM fade in/out register ----- xxxx command setting: -0x00 ADPCM/CD-DA Fade-in -0x01 CD-DA fade-in -0x08 CD-DA fade-out (short) ADPCM fade-in -0x09 CD-DA fade-out (long) -0x0a ADPCM fade-out (long) -0x0c CD-DA fade-out (short) ADPCM fade-in -0x0d CD-DA fade-out (short) -0x0e ADPCM fade-out (short) - -*************************************************************/ - -#include "emu.h" -#include "cpu/h6280/h6280.h" -#include "includes/pce.h" - - -/* joystick related data*/ - -#define JOY_CLOCK 0x01 -#define JOY_RESET 0x02 - - - -DRIVER_INIT_MEMBER(pce_state,mess_pce) -{ - m_io_port_options = PCE_JOY_SIG | CONST_SIG; -} - -DRIVER_INIT_MEMBER(pce_state,tg16) -{ - m_io_port_options = TG_16_JOY_SIG | CONST_SIG; -} - -DRIVER_INIT_MEMBER(pce_state,sgx) -{ - m_io_port_options = PCE_JOY_SIG | CONST_SIG; -} - -MACHINE_START_MEMBER(pce_state,pce) -{ - if (m_cd) - m_cd->late_setup(); - - // saving is only partially supported: it should be fine with cart games - // OTOH CD states are saved but not correctly restored! - save_item(NAME(m_io_port_options)); - save_item(NAME(m_acard)); - save_item(NAME(m_joystick_port_select)); - save_item(NAME(m_joystick_data_select)); - save_item(NAME(m_joy_6b_packet)); -} - -MACHINE_RESET_MEMBER(pce_state,mess_pce) -{ - for (int joy_i = 0; joy_i < 5; joy_i++) - m_joy_6b_packet[joy_i] = 0; - - /* Note: Arcade Card BIOS contents are the same as System 3, only internal HW differs. - We use a category to select between modes (some games can be run in either S-CD or A-CD modes) */ - m_acard = m_a_card->read() & 1; - - if (m_cartslot->get_type() == PCE_CDSYS3J) - { - m_sys3_card = 1; - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087fff, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),this),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),this)); - } - - if (m_cartslot->get_type() == PCE_CDSYS3U) - { - m_sys3_card = 3; - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087fff, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),this),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),this)); - } -} - -/* todo: how many input ports does the PCE have? */ -WRITE8_MEMBER(pce_state::mess_pce_joystick_w) -{ - int joy_i; - UINT8 joy_type = m_joy_type->read(); - - m_maincpu->io_set_buffer(data); - - /* bump counter on a low-to-high transition of bit 1 */ - if ((!m_joystick_data_select) && (data & JOY_CLOCK)) - { - m_joystick_port_select = (m_joystick_port_select + 1) & 0x07; - } - - /* do we want buttons or direction? */ - m_joystick_data_select = data & JOY_CLOCK; - - /* clear counter if bit 2 is set */ - if (data & JOY_RESET) - { - m_joystick_port_select = 0; - - for (joy_i = 0; joy_i < 5; joy_i++) - { - if (((joy_type >> (joy_i*2)) & 3) == 2) - m_joy_6b_packet[joy_i] ^= 1; - } - } -} - -READ8_MEMBER(pce_state::mess_pce_joystick_r) -{ - UINT8 joy_type = m_joy_type->read(); - UINT8 ret, data; - - if (m_joystick_port_select <= 4) - { - switch ((joy_type >> (m_joystick_port_select*2)) & 3) - { - case 0: //2-buttons pad - data = m_joy[m_joystick_port_select]->read(); - break; - case 2: //6-buttons pad - /* - Two packets: - 1st packet: directions + I, II, Run, Select - 2nd packet: 6 buttons "header" (high 4 bits active low) + III, IV, V, VI - Note that six buttons pad just doesn't work with (almost?) every single 2-button-only games, it's really just an after-thought and it is like this - on real HW. - */ - data = m_joy6b[m_joystick_port_select]->read() >> (m_joy_6b_packet[m_joystick_port_select]*8); - break; - default: - data = 0xff; - break; - } - } - else - data = 0xff; - - - if (m_joystick_data_select) - data >>= 4; - - ret = (data & 0x0f) | m_io_port_options; -#ifdef UNIFIED_PCE - ret &= ~0x40; -#endif - - return (ret); -} - - -WRITE8_MEMBER(pce_state::pce_cd_intf_w) -{ - m_cd->update(); - - if (offset & 0x200 && m_sys3_card && m_acard) // route Arcade Card handling ports - return m_cd->acard_w(space, offset, data); - - m_cd->intf_w(space, offset, data); - - m_cd->update(); -} - -READ8_MEMBER(pce_state::pce_cd_intf_r) -{ - m_cd->update(); - - if (offset & 0x200 && m_sys3_card && m_acard) // route Arcade Card handling ports - return m_cd->acard_r(space, offset); - - if ((offset & 0xc0) == 0xc0 && m_sys3_card) //System 3 Card header handling - { - switch (offset & 0xcf) - { - case 0xc1: return 0xaa; - case 0xc2: return 0x55; - case 0xc3: return 0x00; - case 0xc5: return (m_sys3_card & 2) ? 0x55 : 0xaa; - case 0xc6: return (m_sys3_card & 2) ? 0xaa : 0x55; - case 0xc7: return 0x03; - } - } - - return m_cd->intf_r(space, offset); -} - - -READ8_MEMBER(pce_state::pce_cd_acard_wram_r) -{ - return pce_cd_intf_r(space, 0x200 | (offset & 0x6000) >> 9); -} - -WRITE8_MEMBER(pce_state::pce_cd_acard_wram_w) -{ - pce_cd_intf_w(space, 0x200 | (offset & 0x6000) >> 9, data); -} diff --git a/src/mess/machine/pce220_ser.c b/src/mess/machine/pce220_ser.c deleted file mode 100644 index 59aaf593e73..00000000000 --- a/src/mess/machine/pce220_ser.c +++ /dev/null @@ -1,307 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/**************************************************************************** - - pce220_ser.c - - Sharp PC-E220/PC-G850V Serial I/O - -****************************************************************************/ - -#include "emu.h" -#include "pce220_ser.h" - -// SIO configuration -#define SIO_BAUD_RATE 1200 -#define SIO_EOT_BYTE 0x1a -#define SIO_DATA_BIT 8 // number of data bit -#define SIO_PARITY 0 // 0=none 1=odd 2=even -#define SIO_STOP_BIT 1 // number of stop bit - -//SIO states -enum -{ - SIO_WAIT = 0, - SIO_SEND_START, - SIO_SEND_BIT0, - SIO_SEND_BIT1, - SIO_SEND_BIT2, - SIO_SEND_BIT3, - SIO_SEND_BIT4, - SIO_SEND_BIT5, - SIO_SEND_BIT6, - SIO_SEND_BIT7, - SIO_SEND_PARITY, - SIO_SEND_STOP1, - SIO_SEND_STOP2 -}; - -// device type definition -const device_type PCE220SERIAL = &device_creator; - -//------------------------------------------------- -// pce220_serial_device - constructor -//------------------------------------------------- - -pce220_serial_device::pce220_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PCE220SERIAL, "Sharp PC-E220 serial", tag, owner, clock, "pce220_serial", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// pce220_serial_device - destructor -//------------------------------------------------- - -pce220_serial_device::~pce220_serial_device() -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void pce220_serial_device::device_start() -{ - m_send_timer = timer_alloc(TIMER_SEND); - m_receive_timer = timer_alloc(TIMER_RECEIVE); - m_send_timer->reset(); - m_receive_timer->reset(); -} - - -//------------------------------------------------- -// device_reset - reset up the device -//------------------------------------------------- - -void pce220_serial_device::device_reset() -{ - m_state = SIO_WAIT; - m_bytes_count = 0; - m_dout = m_busy = m_xout = 0; - m_din = m_xin = m_ack = 0; -} - - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void pce220_serial_device::device_config_complete() -{ - // set brief and instance name - update_names(); -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void pce220_serial_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if (id == TIMER_SEND && m_enabled) - { - //send data - if (m_bytes_count <= length()) - { - switch(m_state) - { - case SIO_WAIT: - m_ack = 1; //data send request - //waits until is ready to receive - if(!m_busy) - return; - break; - case SIO_SEND_START: - //send start bit - m_xin = 1; - break; - case SIO_SEND_BIT0: - case SIO_SEND_BIT1: - case SIO_SEND_BIT2: - case SIO_SEND_BIT3: - case SIO_SEND_BIT4: - case SIO_SEND_BIT5: - case SIO_SEND_BIT6: - case SIO_SEND_BIT7: - m_xin = BIT(~m_current_byte, m_state - SIO_SEND_BIT0); - break; - case SIO_SEND_PARITY: - m_xin = calc_parity(m_current_byte); - break; - case SIO_SEND_STOP1: - case SIO_SEND_STOP2: - //stop bit - m_xin = m_ack = 0; - break; - } - - if (m_state == (SIO_SEND_PARITY + SIO_STOP_BIT)) - { - //next byte - m_bytes_count++; - popmessage("Send %d/%d bytes\n", m_bytes_count , (UINT32)length()); - m_state = SIO_WAIT; - if (m_bytes_count < length()) - fread(&m_current_byte, 1); - else - m_current_byte = SIO_EOT_BYTE; - } - else - { - m_state = get_next_state(); - } - - } - else - { - m_din = m_xin = m_ack = 0; - } - } - else if (id == TIMER_RECEIVE && m_enabled) - { - //receive data - switch(m_state) - { - case SIO_WAIT: - //wait send request - if(m_busy) - return; - m_ack = 1; //acknowledge - break; - case SIO_SEND_START: - //wait for the start bit - if (!m_xout) - return; - break; - case SIO_SEND_BIT0: - case SIO_SEND_BIT1: - case SIO_SEND_BIT2: - case SIO_SEND_BIT3: - case SIO_SEND_BIT4: - case SIO_SEND_BIT5: - case SIO_SEND_BIT6: - case SIO_SEND_BIT7: - m_current_byte |= ((~m_xout)&1) << (m_state - SIO_SEND_BIT0); - break; - case SIO_SEND_PARITY: - if (m_xout != calc_parity(m_current_byte)) - logerror("SIO %s: byte %d has wrong parity!\n", tag(), m_bytes_count); - break; - case SIO_SEND_STOP1: - case SIO_SEND_STOP2: - //receive stop bit - m_ack = 0; - break; - } - - if (m_state == (SIO_SEND_PARITY + SIO_STOP_BIT)) - { - //next byte - m_bytes_count++; - popmessage("Received %d bytes\n", m_bytes_count); - m_state = SIO_WAIT; - if (m_current_byte != SIO_EOT_BYTE) - fwrite(&m_current_byte, 1); - m_current_byte = 0; - } - else - { - m_state = get_next_state(); - } - } - else - { - m_din = m_xin = m_ack = 0; - } -} - -/*------------------------------------------------- - DEVICE_IMAGE_LOAD( pce220_serial ) --------------------------------------------------*/ - -bool pce220_serial_device::call_load() -{ - m_state = SIO_WAIT; - m_bytes_count = 0; - m_send_timer->adjust(attotime::from_hz(SIO_BAUD_RATE), 0, attotime::from_hz(SIO_BAUD_RATE)); - - //read the first byte - fread(&m_current_byte, 1); - - return IMAGE_INIT_PASS; -} - -/*------------------------------------------------- - DEVICE_IMAGE_CREATE( pce220_serial ) --------------------------------------------------*/ - -bool pce220_serial_device::call_create(int format_type, option_resolution *format_options) -{ - m_state = SIO_WAIT; - m_bytes_count = 0; - m_current_byte = 0; - m_receive_timer->adjust(attotime::from_hz(SIO_BAUD_RATE), 0, attotime::from_hz(SIO_BAUD_RATE)); - - return IMAGE_INIT_PASS; -} - - -/*------------------------------------------------- - DEVICE_IMAGE_UNLOAD( pce220_serial ) --------------------------------------------------*/ - -void pce220_serial_device::call_unload() -{ - m_send_timer->reset(); - m_receive_timer->reset(); - m_state = SIO_WAIT; - m_bytes_count = 0; - m_current_byte = 0; -} - - -/*------------------------------------------------- - calculate the byte parity --------------------------------------------------*/ - -int pce220_serial_device::calc_parity(UINT8 data) -{ - UINT8 count = 0; - - while(data != 0) - { - count++; - data &= (data-1); - } - - return (count ^ BIT(SIO_PARITY, 1)) & 1; -} - - -/*------------------------------------------------- - returns the next SIO state basing on the - configuration --------------------------------------------------*/ - -int pce220_serial_device::get_next_state() -{ - switch(m_state) - { - case SIO_SEND_BIT6: - if (SIO_DATA_BIT == 8) - return SIO_SEND_BIT7; - //fall through - case SIO_SEND_BIT7: - return (SIO_PARITY ? SIO_SEND_PARITY : SIO_SEND_STOP1); - case SIO_SEND_STOP1: - case SIO_SEND_STOP2: - return (SIO_STOP_BIT == 2 ? SIO_SEND_STOP2 : SIO_SEND_STOP1); - default: - return m_state + 1; - } -} diff --git a/src/mess/machine/pce220_ser.h b/src/mess/machine/pce220_ser.h deleted file mode 100644 index ec52e5c0476..00000000000 --- a/src/mess/machine/pce220_ser.h +++ /dev/null @@ -1,95 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/**************************************************************************** - - pce220_ser.h - - Sharp PC-E220/PC-G850V Serial I/O - -****************************************************************************/ - -#ifndef __PCE220_SER_H__ -#define __PCE220_SER_H__ - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -// ======================> pce220_serial_device - -class pce220_serial_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - pce220_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ~pce220_serial_device(); - - // image-level overrides - virtual bool call_load(); - virtual void call_unload(); - virtual bool call_create(int format_type, option_resolution *format_options); - - virtual iodevice_t image_type() const { return IO_SERIAL; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "txt,ihx"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - // specific implementation - UINT8 in_xin(void) { return m_xin & 0x01; } - UINT8 in_din(void) { return m_din & 0x01; } - UINT8 in_ack(void) { return m_ack & 0x01; } - void out_busy(UINT8 state) { m_busy = state & 0x01; } - void out_dout(UINT8 state) { m_dout = state & 0x01; } - void out_xout(UINT8 state) { m_xout = state & 0x01; } - void enable_interface(UINT8 state) { m_enabled = state & 0x01; } - -protected: - // internal helpers - int calc_parity(UINT8 data); - int get_next_state(); - - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_config_complete(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - // internal device state - static const device_timer_id TIMER_SEND = 0; - static const device_timer_id TIMER_RECEIVE = 1; - - emu_timer* m_send_timer; // timer for send data - emu_timer* m_receive_timer; // timer for receive data - UINT8 m_state; // transfer status - UINT32 m_bytes_count; // number of bytes transferred - UINT8 m_current_byte; // byte in transfer - UINT8 m_enabled; // enable/disable - - UINT8 m_busy; // CTS - UINT8 m_dout; // DTR - UINT8 m_xout; // TXD - UINT8 m_xin; // RXD - UINT8 m_din; // DSR - UINT8 m_ack; // RTS -}; - -// device type definition -extern const device_type PCE220SERIAL; - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ -#define PCE220SERIAL_TAG "serial" - -#define MCFG_PCE220_SERIAL_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, PCE220SERIAL, 0) -#endif /* __PCE220_SER_H__ */ diff --git a/src/mess/machine/pce_cd.c b/src/mess/machine/pce_cd.c deleted file mode 100644 index d9b9e5441ea..00000000000 --- a/src/mess/machine/pce_cd.c +++ /dev/null @@ -1,1519 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/************************************************************ - -PC Engine CD HW notes: - -TODO: -- Dragon Ball Z: ADPCM dies after the first upload; -- Dragon Slayer - The Legend of Heroes: black screen; -- Mirai Shonen Conan: dies at new game selection; -- Snatcher: black screen after Konami logo, tries set up CD-DA - while transferring data? -- Steam Heart's: needs transfer ready irq to get past the - gameplay hang, don't know exactly when it should fire -- Steam Heart's: bad ADPCM irq, dialogue is cutted due of it; - -============================================================= - -CD Interface Register 0x00 - CDC status -x--- ---- busy signal --x-- ---- request signal ----x ---- cd signal ----- x--- i/o signal - -CD Interface Register 0x03 - BRAM lock / CD status --x-- ---- acknowledge signal ---x- ---- done signal ----x ---- bram signal ----- x--- ADPCM 2 ----- -x-- ADPCM 1 ----- --x- CDDA left/right speaker select - -CD Interface Register 0x05 - CD-DA Volume low 8-bit port - -CD Interface Register 0x06 - CD-DA Volume high 8-bit port - -CD Interface Register 0x07 - BRAM unlock / CD status -x--- ---- Enables BRAM - -CD Interface Register 0x0c - ADPCM status -x--- ---- ADPCM is reading data ----- x--- ADPCM playback (0) stopped (1) currently playing ----- -x-- pending ADPCM data write ----- ---x ADPCM playback (1) stopped (0) currently playing - -CD Interface Register 0x0d - ADPCM address control -x--- ---- ADPCM reset --x-- ---- ADPCM play ---x- ---- ADPCM repeat ----x ---- ADPCM set length ----- x--- ADPCM set read address ----- --xx ADPCM set write address -(note: some games reads bit 5 and wants it to be low otherwise they hangs, surely NOT an ADPCM repeat flag read because it doesn't make sense) - -CD Interface Register 0x0e - ADPCM playback rate - -CD Interface Register 0x0f - ADPCM fade in/out register ----- xxxx command setting: -0x00 ADPCM/CD-DA Fade-in -0x01 CD-DA fade-in -0x08 CD-DA fade-out (short) ADPCM fade-in -0x09 CD-DA fade-out (long) -0x0a ADPCM fade-out (long) -0x0c CD-DA fade-out (short) ADPCM fade-in -0x0d CD-DA fade-out (short) -0x0e ADPCM fade-out (short) - -*************************************************************/ - -#include "emu.h" -#include "coreutil.h" -#include "machine/pce_cd.h" - - -#define PCE_CD_CLOCK 9216000 - - -const device_type PCE_CD = &device_creator; - - -pce_cd_device::pce_cd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PCE_CD, "PCE CD Add-on", tag, owner, clock, "pcecd", __FILE__), - m_maincpu(*this, ":maincpu"), - m_msm(*this, "msm5205"), - m_cdda(*this, "cdda"), - m_nvram(*this, "bram"), - m_cdrom(*this, "cdrom") -{ -} - -void pce_cd_device::device_start() -{ - /* Initialize BRAM */ - m_bram = auto_alloc_array(machine(), UINT8, PCE_BRAM_SIZE * 2); - memset(m_bram, 0, PCE_BRAM_SIZE); - memset(m_bram + PCE_BRAM_SIZE, 0xff, PCE_BRAM_SIZE); - m_bram_locked = 1; - - m_nvram->set_base(m_bram, PCE_BRAM_SIZE); - - /* set up adpcm related things */ - m_adpcm_ram = auto_alloc_array_clear(machine(), UINT8, PCE_ADPCM_RAM_SIZE); - m_adpcm_clock_divider = 1; - - /* Set up cd command buffer */ - m_command_buffer = auto_alloc_array_clear(machine(), UINT8, PCE_CD_COMMAND_BUFFER_SIZE); - m_command_buffer_index = 0; - - /* Set up Arcade Card RAM buffer */ - m_acard_ram = auto_alloc_array_clear(machine(), UINT8, PCE_ACARD_RAM_SIZE); - - m_data_buffer = auto_alloc_array_clear(machine(), UINT8, 8192); - m_data_buffer_size = 0; - m_data_buffer_index = 0; - - m_subcode_buffer = auto_alloc_array(machine(), UINT8, 96); - - m_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::data_timer_callback),this)); - m_data_timer->adjust(attotime::never); - m_adpcm_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_dma_timer_callback),this)); - m_adpcm_dma_timer->adjust(attotime::never); - - m_cdda_fadeout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::cdda_fadeout_callback),this)); - m_cdda_fadeout_timer->adjust(attotime::never); - m_cdda_fadein_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::cdda_fadein_callback),this)); - m_cdda_fadein_timer->adjust(attotime::never); - - m_adpcm_fadeout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_fadeout_callback),this)); - m_adpcm_fadeout_timer->adjust(attotime::never); - m_adpcm_fadein_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_cd_device::adpcm_fadein_callback),this)); - m_adpcm_fadein_timer->adjust(attotime::never); - - // m_cd_file pointer is setup at a later stage because it is still empty when this function is called - - // TODO: add proper restore for the cd data... - save_item(NAME(m_regs)); - save_pointer(NAME(m_bram), PCE_BRAM_SIZE * 2); - save_pointer(NAME(m_adpcm_ram), PCE_ADPCM_RAM_SIZE); - save_item(NAME(m_bram_locked)); - save_item(NAME(m_adpcm_read_ptr)); - save_item(NAME(m_adpcm_read_buf)); - save_item(NAME(m_adpcm_write_ptr)); - save_item(NAME(m_adpcm_write_buf)); - save_item(NAME(m_adpcm_length)); - save_item(NAME(m_adpcm_clock_divider)); - save_item(NAME(m_msm_start_addr)); - save_item(NAME(m_msm_end_addr)); - save_item(NAME(m_msm_half_addr)); - save_item(NAME(m_msm_nibble)); - save_item(NAME(m_msm_idle)); - save_item(NAME(m_msm_repeat)); - save_item(NAME(m_scsi_BSY)); - save_item(NAME(m_scsi_SEL)); - save_item(NAME(m_scsi_CD)); - save_item(NAME(m_scsi_IO)); - save_item(NAME(m_scsi_MSG)); - save_item(NAME(m_scsi_REQ)); - save_item(NAME(m_scsi_ACK)); - save_item(NAME(m_scsi_ATN)); - save_item(NAME(m_scsi_RST)); - save_item(NAME(m_scsi_last_RST)); - save_item(NAME(m_cd_motor_on)); - save_item(NAME(m_selected)); - save_pointer(NAME(m_command_buffer), PCE_CD_COMMAND_BUFFER_SIZE); - save_item(NAME(m_command_buffer_index)); - save_item(NAME(m_status_sent)); - save_item(NAME(m_message_after_status)); - save_item(NAME(m_message_sent)); - save_pointer(NAME(m_data_buffer), 8192); - save_item(NAME(m_data_buffer_size)); - save_item(NAME(m_data_buffer_index)); - save_item(NAME(m_data_transferred)); - save_pointer(NAME(m_acard_ram), PCE_ACARD_RAM_SIZE); - save_item(NAME(m_acard_latch)); - save_item(NAME(m_acard_ctrl)); - save_item(NAME(m_acard_base_addr)); - save_item(NAME(m_acard_addr_offset)); - save_item(NAME(m_acard_addr_inc)); - save_item(NAME(m_acard_shift)); - save_item(NAME(m_acard_shift_reg)); - save_item(NAME(m_current_frame)); - save_item(NAME(m_end_frame)); - save_item(NAME(m_last_frame)); - save_item(NAME(m_cdda_status)); - save_item(NAME(m_cdda_play_mode)); - save_pointer(NAME(m_subcode_buffer), 96); - save_item(NAME(m_end_mark)); - save_item(NAME(m_cdda_volume)); - save_item(NAME(m_adpcm_volume)); -} - -void pce_cd_device::device_reset() -{ - m_adpcm_read_buf = 0; - m_adpcm_write_buf = 0; - - // TODO: add CD-DA stop command here - //m_cdda_status = PCE_CD_CDDA_OFF; - //m_cdda->stop_audio(); - - memset(m_regs, 0, sizeof(m_regs)); - - m_regs[0x0c] |= PCE_CD_ADPCM_STOP_FLAG; - m_regs[0x0c] &= ~PCE_CD_ADPCM_PLAY_FLAG; - //m_regs[0x03] = (m_regs[0x03] & ~0x0c) | (PCE_CD_SAMPLE_STOP_PLAY); - m_msm_idle = 1; - - m_scsi_RST = 0; - m_scsi_last_RST = 0; - m_scsi_SEL = 0; - m_scsi_BSY = 0; - m_selected = 0; - m_scsi_ATN = 0; - m_end_mark = 0; -} - - -void pce_cd_device::late_setup() -{ - // at device start, the cdrom is not 'ready' yet, so we postpone this part of the initialization at machine_start in the driver - m_cd_file = m_cdrom->get_cdrom_file(); - if (m_cd_file) - { - m_toc = cdrom_get_toc(m_cd_file); - m_cdda->set_cdrom(m_cd_file); - m_last_frame = cdrom_get_track_start(m_cd_file, cdrom_get_last_track(m_cd_file) - 1); - m_last_frame += m_toc->tracks[cdrom_get_last_track(m_cd_file) - 1].frames; - m_end_frame = m_last_frame; - } - - // MSM5205 might be initialized after PCE CD as well... - m_msm->change_clock_w((PCE_CD_CLOCK / 6) / m_adpcm_clock_divider); -} - -void pce_cd_device::nvram_init(nvram_device &nvram, void *data, size_t size) -{ - static const UINT8 init[8] = { 0x48, 0x55, 0x42, 0x4d, 0x00, 0xa0, 0x10, 0x80 }; - - memset(data, 0x00, size); - memcpy(data, init, sizeof(init)); -} - -// TODO: left and right speaker tags should be passed from the parent config, instead of using the hard-coded ones below!?! -static MACHINE_CONFIG_FRAGMENT( pce_cd ) - MCFG_NVRAM_ADD_CUSTOM_DRIVER("bram", pce_cd_device, nvram_init) - - MCFG_CDROM_ADD("cdrom") - MCFG_CDROM_INTERFACE("pce_cdrom") - - MCFG_SOUND_ADD( "msm5205", MSM5205, PCE_CD_CLOCK / 6 ) - MCFG_MSM5205_VCLK_CB(WRITELINE(pce_cd_device, msm5205_int)) /* interrupt function */ - MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* 1/48 prescaler, 4bit data */ - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "^:lspeaker", 0.50 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "^:rspeaker", 0.50 ) - - MCFG_SOUND_ADD( "cdda", CDDA, 0 ) - MCFG_SOUND_ROUTE( 0, "^:lspeaker", 1.00 ) - MCFG_SOUND_ROUTE( 1, "^:rspeaker", 1.00 ) -MACHINE_CONFIG_END - - -machine_config_constructor pce_cd_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pce_cd ); -} - - -void pce_cd_device::adpcm_stop(UINT8 irq_flag) -{ - m_regs[0x0c] |= PCE_CD_ADPCM_STOP_FLAG; - m_regs[0x0c] &= ~PCE_CD_ADPCM_PLAY_FLAG; - //m_regs[0x03] = (m_regs[0x03] & ~0x0c) | (PCE_CD_SAMPLE_STOP_PLAY); - if (irq_flag) - set_irq_line(PCE_CD_IRQ_SAMPLE_FULL_PLAY, ASSERT_LINE); - m_regs[0x0d] &= ~0x60; - m_msm_idle = 1; -} - -void pce_cd_device::adpcm_play() -{ - m_regs[0x0c] &= ~PCE_CD_ADPCM_STOP_FLAG; - m_regs[0x0c] |= PCE_CD_ADPCM_PLAY_FLAG; - set_irq_line(PCE_CD_IRQ_SAMPLE_FULL_PLAY, CLEAR_LINE); - m_regs[0x03] = (m_regs[0x03] & ~0x0c); - m_msm_idle = 0; -} - - -/* Callback for new data from the MSM5205. - The PCE cd unit actually divides the clock signal supplied to - the MSM5205. Currently we can only use static clocks for the - MSM5205. - */ -WRITE_LINE_MEMBER( pce_cd_device::msm5205_int ) -{ - UINT8 msm_data; - - // popmessage("%08x %08x %08x %02x %02x",m_msm_start_addr,m_msm_end_addr,m_msm_half_addr,m_regs[0x0c],m_regs[0x0d]); - - if (m_msm_idle) - return; - - /* Supply new ADPCM data */ - msm_data = (m_msm_nibble) ? (m_adpcm_ram[m_msm_start_addr] & 0x0f) : ((m_adpcm_ram[m_msm_start_addr] & 0xf0) >> 4); - - m_msm->data_w(msm_data); - m_msm_nibble ^= 1; - - if (m_msm_nibble == 0) - { - m_msm_start_addr++; - - if (m_msm_start_addr == m_msm_half_addr) - { - //set_irq_line(PCE_CD_IRQ_SAMPLE_FULL_PLAY, CLEAR_LINE); - //set_irq_line(PCE_CD_IRQ_SAMPLE_HALF_PLAY, ASSERT_LINE); - } - - if (m_msm_start_addr > m_msm_end_addr) - { - //set_irq_line(PCE_CD_IRQ_SAMPLE_HALF_PLAY, CLEAR_LINE); - //set_irq_line(PCE_CD_IRQ_SAMPLE_FULL_PLAY, CLEAR_LINE); - adpcm_stop(1); - m_msm->reset_w(1); - } - } -} - -#define SCSI_STATUS_OK 0x00 -#define SCSI_CHECK_CONDITION 0x02 - -void pce_cd_device::reply_status_byte(UINT8 status) -{ - logerror("Setting CD in reply_status_byte\n"); - m_scsi_CD = m_scsi_IO = m_scsi_REQ = 1; - m_scsi_MSG = 0; - m_message_after_status = 1; - m_status_sent = m_message_sent = 0; - - if (status == SCSI_STATUS_OK) - { - m_regs[0x01] = 0x00; - } - else - { - m_regs[0x01] = 0x01; - } -} - -/* 0x00 - TEST UNIT READY */ -void pce_cd_device::test_unit_ready() -{ - logerror("test unit ready\n"); - if (m_cd_file) - { - logerror("Sending STATUS_OK status\n"); - reply_status_byte(SCSI_STATUS_OK); - } - else - { - logerror("Sending CHECK_CONDITION status\n"); - reply_status_byte(SCSI_CHECK_CONDITION); - } -} - -/* 0x08 - READ (6) */ -void pce_cd_device::read_6() -{ - UINT32 frame = ((m_command_buffer[1] & 0x1f) << 16) | (m_command_buffer[2] << 8) | m_command_buffer[3]; - UINT32 frame_count = m_command_buffer[4]; - printf("%08x %08x\n",frame,frame_count); - - /* Check for presence of a CD */ - if (!m_cd_file) - { - reply_status_byte(SCSI_CHECK_CONDITION); - return; - } - - if (m_cdda_status != PCE_CD_CDDA_OFF) - { - m_cdda_status = PCE_CD_CDDA_OFF; - m_cdda->stop_audio(); - m_end_mark = 0; - } - - m_current_frame = frame; - m_end_frame = frame + frame_count; - - if (frame_count == 0) - { - /* Star Breaker uses this */ - popmessage("Read Sector frame count == 0, contact MESSdev"); - reply_status_byte(SCSI_STATUS_OK); - } - else - { - m_data_timer->adjust(attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND), 0, attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND)); - } - - /* TODO: correct place? */ - set_irq_line(PCE_CD_IRQ_TRANSFER_READY, ASSERT_LINE); -} - -/* 0xD8 - SET AUDIO PLAYBACK START POSITION (NEC) */ -void pce_cd_device::nec_set_audio_start_position() -{ - UINT32 frame = 0; - - if (!m_cd_file) - { - /* Throw some error here */ - reply_status_byte(SCSI_CHECK_CONDITION); - return; - } - - switch (m_command_buffer[9] & 0xC0) - { - case 0x00: - popmessage("CD-DA set start mode 0x00, contact MESSdev"); - frame = (m_command_buffer[3] << 16) | (m_command_buffer[4] << 8) | m_command_buffer[5]; - break; - case 0x40: - { - UINT8 m,s,f; - - m = bcd_2_dec(m_command_buffer[2]); - s = bcd_2_dec(m_command_buffer[3]); - f = bcd_2_dec(m_command_buffer[4]); - - frame = f + 75 * (s + m * 60); - // PCE tries to be clever here and set (start of track + track pregap size) to skip the pregap - // (I guess it wants the TOC to have the real start sector for data tracks and the start of the pregap for audio?) - frame -= m_toc->tracks[cdrom_get_track(m_cd_file, frame)].pregap; - break; - } - case 0x80: - frame = m_toc->tracks[ bcd_2_dec(m_command_buffer[2]) - 1 ].logframeofs; - break; - default: - popmessage("CD-DA set start mode 0xc0, contact MESSdev"); - //assert(NULL == nec_set_audio_start_position); - break; - } - - m_current_frame = frame; - - if (m_cdda_status == PCE_CD_CDDA_PAUSED) - { - m_cdda_status = PCE_CD_CDDA_OFF; - m_cdda->stop_audio(); - m_end_frame = m_last_frame; - m_end_mark = 0; - } - else - { - if (m_command_buffer[1] & 0x03) - { - m_cdda_status = PCE_CD_CDDA_PLAYING; - m_end_frame = m_last_frame; //get the end of the CD - m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); - m_cdda_play_mode = (m_command_buffer[1] & 0x02) ? 2 : 3; // mode 2 sets IRQ at end - m_end_mark = (m_command_buffer[1] & 0x02) ? 1 : 0; - } - else - { - m_cdda_status = PCE_CD_CDDA_PLAYING; - m_end_frame = m_toc->tracks[ cdrom_get_track(m_cd_file, m_current_frame) + 1 ].logframeofs; //get the end of THIS track - m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); - m_end_mark = 0; - m_cdda_play_mode = 3; - } - } - - reply_status_byte(SCSI_STATUS_OK); - set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE); -} - -/* 0xD9 - SET AUDIO PLAYBACK END POSITION (NEC) */ -void pce_cd_device::nec_set_audio_stop_position() -{ - UINT32 frame = 0; - - if (!m_cd_file) - { - /* Throw some error here */ - reply_status_byte(SCSI_CHECK_CONDITION); - return; - } - - switch (m_command_buffer[9] & 0xC0) - { - case 0x00: - popmessage("CD-DA set end mode 0x00, contact MESSdev"); - frame = (m_command_buffer[3] << 16) | (m_command_buffer[4] << 8) | m_command_buffer[5]; - break; - case 0x40: - { - UINT8 m,s,f; - - m = bcd_2_dec(m_command_buffer[2]); - s = bcd_2_dec(m_command_buffer[3]); - f = bcd_2_dec(m_command_buffer[4]); - - frame = f + 75 * (s + m * 60); - // if (frame >= 525) // TODO: seven seconds gap? O_o - // frame -= 525; - break; - } - case 0x80: - frame = m_toc->tracks[ bcd_2_dec(m_command_buffer[2]) - 1 ].logframeofs; - break; - default: - popmessage("CD-DA set end mode 0xc0, contact MESSdev"); - //assert(NULL == nec_set_audio_start_position); - break; - } - - m_end_frame = frame; - m_cdda_play_mode = m_command_buffer[1] & 0x03; - - if (m_cdda_play_mode) - { - if (m_cdda_status == PCE_CD_CDDA_PAUSED) - { - m_cdda->pause_audio(0); - } - else - { - //printf("%08x %08x\n",m_current_frame,m_end_frame - m_current_frame); - m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); - m_end_mark = 1; - } - m_cdda_status = PCE_CD_CDDA_PLAYING; - } - else - { - m_cdda_status = PCE_CD_CDDA_OFF; - m_cdda->stop_audio(); - m_end_frame = m_last_frame; - m_end_mark = 0; -// assert(NULL == nec_set_audio_stop_position); - } - - reply_status_byte(SCSI_STATUS_OK); - set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE); -} - -/* 0xDA - PAUSE (NEC) */ -void pce_cd_device::nec_pause() -{ - /* If no cd mounted throw an error */ - if (!m_cd_file) - { - reply_status_byte(SCSI_CHECK_CONDITION); - return; - } - - /* If there was no cdda playing, throw an error */ - if (m_cdda_status == PCE_CD_CDDA_OFF) - { - reply_status_byte(SCSI_CHECK_CONDITION); - return; - } - - m_cdda_status = PCE_CD_CDDA_PAUSED; - m_current_frame = m_cdda->get_audio_lba(); - m_cdda->pause_audio(1); - reply_status_byte(SCSI_STATUS_OK); -} - -/* 0xDD - READ SUBCHANNEL Q (NEC) */ -void pce_cd_device::nec_get_subq() -{ - /* WP - I do not have access to chds with subchannel information yet, so I'm faking something here */ - UINT32 msf_abs, msf_rel, track, frame; - - if (!m_cd_file) - { - /* Throw some error here */ - reply_status_byte(SCSI_CHECK_CONDITION); - return; - } - - frame = m_current_frame; - - switch (m_cdda_status) - { - case PCE_CD_CDDA_PAUSED: - m_data_buffer[0] = 2; - frame = m_cdda->get_audio_lba(); - break; - case PCE_CD_CDDA_PLAYING: - m_data_buffer[0] = 0; - frame = m_cdda->get_audio_lba(); - break; - default: - m_data_buffer[0] = 3; - break; - } - - msf_abs = lba_to_msf_alt(frame); - track = cdrom_get_track(m_cd_file, frame); - msf_rel = lba_to_msf_alt(frame - cdrom_get_track_start(m_cd_file, track)); - - m_data_buffer[1] = 0x01 | ((cdrom_get_track_type(m_cd_file, cdrom_get_track(m_cd_file, track+1)) == CD_TRACK_AUDIO) ? 0x00 : 0x40); - m_data_buffer[2] = dec_2_bcd(track+1); /* track */ - m_data_buffer[3] = 1; /* index */ - m_data_buffer[4] = dec_2_bcd((msf_rel >> 16) & 0xFF);/* M (relative) */ - m_data_buffer[5] = dec_2_bcd((msf_rel >> 8) & 0xFF); /* S (relative) */ - m_data_buffer[6] = dec_2_bcd(msf_rel & 0xFF); /* F (relative) */ - m_data_buffer[7] = dec_2_bcd((msf_abs >> 16) & 0xFF);/* M (absolute) */ - m_data_buffer[8] = dec_2_bcd((msf_abs >> 8) & 0xFF); /* S (absolute) */ - m_data_buffer[9] = dec_2_bcd(msf_abs & 0xFF); /* F (absolute) */ - m_data_buffer_size = 10; - - m_data_buffer_index = 0; - m_data_transferred = 1; - m_scsi_IO = 1; - m_scsi_CD = 0; -} - -/* 0xDE - GET DIR INFO (NEC) */ -void pce_cd_device::nec_get_dir_info() -{ - UINT32 frame, msf, track = 0; - const cdrom_toc *toc; - logerror("nec get dir info\n"); - - if (!m_cd_file) - { - /* Throw some error here */ - reply_status_byte(SCSI_CHECK_CONDITION); - } - - toc = cdrom_get_toc(m_cd_file); - - switch (m_command_buffer[1]) - { - case 0x00: /* Get first and last track numbers */ - m_data_buffer[0] = dec_2_bcd(1); - m_data_buffer[1] = dec_2_bcd(toc->numtrks); - m_data_buffer_size = 2; - break; - case 0x01: /* Get total disk size in MSF format */ - frame = toc->tracks[toc->numtrks-1].logframeofs; - frame += toc->tracks[toc->numtrks-1].frames; - msf = lba_to_msf(frame + 150); - - m_data_buffer[0] = (msf >> 16) & 0xFF; /* M */ - m_data_buffer[1] = (msf >> 8) & 0xFF; /* S */ - m_data_buffer[2] = msf & 0xFF; /* F */ - m_data_buffer_size = 3; - break; - case 0x02: /* Get track information */ - if (m_command_buffer[2] == 0xAA) - { - frame = toc->tracks[toc->numtrks-1].logframeofs; - frame += toc->tracks[toc->numtrks-1].frames; - m_data_buffer[3] = 0x04; /* correct? */ - } else - { - track = MAX(bcd_2_dec(m_command_buffer[2]), 1); - frame = toc->tracks[track-1].logframeofs; - // PCE wants the start sector for data tracks to *not* include the pregap - if (toc->tracks[track-1].trktype != CD_TRACK_AUDIO) - { - frame += toc->tracks[track-1].pregap; - } - m_data_buffer[3] = (toc->tracks[track-1].trktype == CD_TRACK_AUDIO) ? 0x00 : 0x04; - } - logerror("track = %d, frame = %d\n", track, frame); - msf = lba_to_msf(frame + 150); - m_data_buffer[0] = (msf >> 16) & 0xFF; /* M */ - m_data_buffer[1] = (msf >> 8) & 0xFF; /* S */ - m_data_buffer[2] = msf & 0xFF; /* F */ - m_data_buffer_size = 4; - break; - default: -// assert(pce_cd_nec_get_dir_info == NULL); // Not implemented yet - break; - } - - m_data_buffer_index = 0; - m_data_transferred = 1; - m_scsi_IO = 1; - m_scsi_CD = 0; -} - -void pce_cd_device::end_of_list() -{ - reply_status_byte(SCSI_CHECK_CONDITION); -} - -typedef void (pce_cd_device::*command_handler_func)(); - -void pce_cd_device::handle_data_output() -{ - static const struct { - UINT8 command_byte; - UINT8 command_size; - command_handler_func command_handler; - } pce_cd_commands[] = { - { 0x00, 6, &pce_cd_device::test_unit_ready }, /* TEST UNIT READY */ - { 0x08, 6, &pce_cd_device::read_6 }, /* READ (6) */ - { 0xD8,10, &pce_cd_device::nec_set_audio_start_position }, /* NEC SET AUDIO PLAYBACK START POSITION */ - { 0xD9,10, &pce_cd_device::nec_set_audio_stop_position }, /* NEC SET AUDIO PLAYBACK END POSITION */ - { 0xDA,10, &pce_cd_device::nec_pause }, /* NEC PAUSE */ - { 0xDD,10, &pce_cd_device::nec_get_subq }, /* NEC GET SUBCHANNEL Q */ - { 0xDE,10, &pce_cd_device::nec_get_dir_info }, /* NEC GET DIR INFO */ - { 0xFF, 1, &pce_cd_device::end_of_list } /* end of list marker */ - }; - - if (m_scsi_REQ && m_scsi_ACK) - { - /* Command byte received */ - logerror("Command byte $%02X received\n", m_regs[0x01]); - - /* Check for buffer overflow */ - assert(m_command_buffer_index < PCE_CD_COMMAND_BUFFER_SIZE); - - m_command_buffer[m_command_buffer_index] = m_regs[0x01]; - m_command_buffer_index++; - m_scsi_REQ = 0; - } - - if (! m_scsi_REQ && ! m_scsi_ACK && m_command_buffer_index) - { - int i = 0; - - logerror("Check if command done\n"); - - for(i = 0; m_command_buffer[0] > pce_cd_commands[i].command_byte; i++); - - /* Check for unknown commands */ - if (m_command_buffer[0] != pce_cd_commands[i].command_byte) - { - logerror("Unrecognized command: %02X\n", m_command_buffer[0]); - if (m_command_buffer[0] == 0x03) - popmessage("CD command 0x03 issued (Request Sense), contact MESSdev"); - } - assert(m_command_buffer[0] == pce_cd_commands[i].command_byte); - - if (m_command_buffer_index == pce_cd_commands[i].command_size) - { - //printf("%02x command issued\n",m_command_buffer[0]); - (this->*pce_cd_commands[i].command_handler)(); - m_command_buffer_index = 0; - } - else - { - m_scsi_REQ = 1; - } - } -} - -void pce_cd_device::handle_data_input() -{ - if (m_scsi_CD) - { - /* Command / Status byte */ - if (m_scsi_REQ && m_scsi_ACK) - { - logerror("status sent\n"); - m_scsi_REQ = 0; - m_status_sent = 1; - } - - if (! m_scsi_REQ && ! m_scsi_ACK && m_status_sent) - { - m_status_sent = 0; - if (m_message_after_status) - { - logerror("message after status\n"); - m_message_after_status = 0; - m_scsi_MSG = m_scsi_REQ = 1; - m_regs[0x01] = 0; - } - } - } - else - { - /* Data */ - if (m_scsi_REQ && m_scsi_ACK) - { - m_scsi_REQ = 0; - } - - if (! m_scsi_REQ && ! m_scsi_ACK) - { - if (m_data_buffer_index == m_data_buffer_size) - { - set_irq_line(PCE_CD_IRQ_TRANSFER_READY, CLEAR_LINE); - if (m_data_transferred) - { - m_data_transferred = 0; - reply_status_byte(SCSI_STATUS_OK); - set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE); - } - } - else - { - logerror("Transfer byte %02x from offset %d %d\n",m_data_buffer[m_data_buffer_index] , m_data_buffer_index, m_current_frame); - m_regs[0x01] = m_data_buffer[m_data_buffer_index]; - m_data_buffer_index++; - m_scsi_REQ = 1; - } - } - } -} - -void pce_cd_device::handle_message_output() -{ - if (m_scsi_REQ && m_scsi_ACK) - m_scsi_REQ = 0; -} - -void pce_cd_device::handle_message_input() -{ - if (m_scsi_REQ && m_scsi_ACK) - { - m_scsi_REQ = 0; - m_message_sent = 1; - } - - if (! m_scsi_REQ && ! m_scsi_ACK && m_message_sent) - { - m_message_sent = 0; - m_scsi_BSY = 0; - } -} - -/* Update internal CD statuses */ -void pce_cd_device::update() -{ - /* Check for reset of CD unit */ - if (m_scsi_RST != m_scsi_last_RST) - { - if (m_scsi_RST) - { - logerror("Performing CD reset\n"); - /* Reset internal data */ - m_scsi_BSY = m_scsi_SEL = m_scsi_CD = m_scsi_IO = 0; - m_scsi_MSG = m_scsi_REQ = m_scsi_ATN = 0; - m_cd_motor_on = 0; - m_selected = 0; - m_cdda_status = PCE_CD_CDDA_OFF; - m_cdda->stop_audio(); - m_adpcm_dma_timer->adjust(attotime::never); // stop ADPCM DMA here - } - m_scsi_last_RST = m_scsi_RST; - } - - /* Check if bus can be freed */ - if (! m_scsi_SEL && ! m_scsi_BSY && m_selected) - { - logerror("freeing bus\n"); - m_selected = 0; - m_scsi_CD = m_scsi_MSG = m_scsi_IO = m_scsi_REQ = 0; - set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, CLEAR_LINE); - } - - /* Select the CD device */ - if (m_scsi_SEL) - { - if (! m_selected) - { - m_selected = 1; - logerror("Setting CD in device selection\n"); - m_scsi_BSY = m_scsi_REQ = m_scsi_CD = 1; - m_scsi_MSG = m_scsi_IO = 0; - } - } - - if (m_scsi_ATN) - { - } - else - { - /* Check for data and message phases */ - if (m_scsi_BSY) - { - if (m_scsi_MSG) - { - /* message phase */ - if (m_scsi_IO) - { - handle_message_input(); - } - else - { - handle_message_output(); - } - } - else - { - /* data phase */ - if (m_scsi_IO) - { - /* Reading data from target */ - handle_data_input(); - } - else - { - /* Sending data to target */ - handle_data_output(); - } - } - } - } - - /* FIXME: presumably CD-DA needs an irq interface for this */ - if (m_cdda->audio_ended() && m_end_mark == 1) - { - switch (m_cdda_play_mode & 3) - { - case 1: m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame); m_end_mark = 1; break; //play with repeat - case 2: set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE); m_end_mark = 0; break; //irq when finished - case 3: m_end_mark = 0; break; //play without repeat - } - } -} - -void pce_cd_device::set_irq_line(int num, int state) -{ - if (state == ASSERT_LINE) - m_regs[0x03] |= num; - else - m_regs[0x03] &= ~num; - - if (m_regs[0x02] & m_regs[0x03] & 0x7c) - { - //printf("IRQ PEND = %02x MASK = %02x IRQ ENABLE %02X\n",m_regs[0x02] & m_regs[0x03] & 0x7c,m_regs[0x02] & 0x7c,m_regs[0x03] & 0x7c); - m_maincpu->set_input_line(1, ASSERT_LINE); - } - else - { - m_maincpu->set_input_line(1, CLEAR_LINE); - } -} - -TIMER_CALLBACK_MEMBER(pce_cd_device::data_timer_callback) -{ - if (m_data_buffer_index == m_data_buffer_size) - { - /* Read next data sector */ - logerror("read sector %d\n", m_current_frame); - if (! cdrom_read_data(m_cd_file, m_current_frame, m_data_buffer, CD_TRACK_MODE1)) - { - logerror("Mode1 CD read failed for frame #%d\n", m_current_frame); - } - else - { - logerror("Successfully read mode1 frame #%d\n", m_current_frame); - } - - m_data_buffer_index = 0; - m_data_buffer_size = 2048; - m_current_frame++; - - m_scsi_IO = 1; - m_scsi_CD = 0; - - if (m_current_frame == m_end_frame) - { - /* We are done, disable the timer */ - logerror("Last frame read from CD\n"); - m_data_transferred = 1; - m_data_timer->adjust(attotime::never); - } - else - { - m_data_transferred = 0; - } - } -} - -WRITE8_MEMBER(pce_cd_device::bram_w) -{ - if (!m_bram_locked) - { - m_bram[offset & (PCE_BRAM_SIZE - 1)] = data; - } -} - -READ8_MEMBER(pce_cd_device::bram_r) -{ - return m_bram[(offset & (PCE_BRAM_SIZE - 1)) + m_bram_locked * PCE_BRAM_SIZE]; -} - -void pce_cd_device::set_adpcm_ram_byte(UINT8 val) -{ - if (m_adpcm_write_buf > 0) - { - m_adpcm_write_buf--; - } - else - { - m_adpcm_ram[m_adpcm_write_ptr] = val; - m_adpcm_write_ptr = ((m_adpcm_write_ptr + 1) & 0xffff); - //TODO: length + 1 - } -} - -TIMER_CALLBACK_MEMBER(pce_cd_device::cdda_fadeout_callback) -{ - m_cdda_volume -= 0.1; - - if (m_cdda_volume <= 0) - { - m_cdda_volume = 0.0; - m_cdda->set_volume(0.0); - m_cdda_fadeout_timer->adjust(attotime::never); - } - else - { - m_cdda->set_volume(m_cdda_volume); - m_cdda_fadeout_timer->adjust(attotime::from_usec(param), param); - } -} - -TIMER_CALLBACK_MEMBER(pce_cd_device::cdda_fadein_callback) -{ - m_cdda_volume += 0.1; - - if (m_cdda_volume >= 100.0) - { - m_cdda_volume = 100.0; - m_cdda->set_volume(100.0); - m_cdda_fadein_timer->adjust(attotime::never); - } - else - { - m_cdda->set_volume(m_cdda_volume); - m_cdda_fadein_timer->adjust(attotime::from_usec(param), param); - } -} - -TIMER_CALLBACK_MEMBER(pce_cd_device::adpcm_fadeout_callback) -{ - m_adpcm_volume -= 0.1; - - if (m_adpcm_volume <= 0) - { - m_adpcm_volume = 0.0; - m_msm->set_volume(0.0); - m_adpcm_fadeout_timer->adjust(attotime::never); - } - else - { - m_msm->set_volume(m_adpcm_volume); - m_adpcm_fadeout_timer->adjust(attotime::from_usec(param), param); - } -} - -TIMER_CALLBACK_MEMBER(pce_cd_device::adpcm_fadein_callback) -{ - m_adpcm_volume += 0.1; - - if (m_adpcm_volume >= 100.0) - { - m_adpcm_volume = 100.0; - m_msm->set_volume(100.0); - m_adpcm_fadein_timer->adjust(attotime::never); - } - else - { - m_msm->set_volume(m_adpcm_volume); - m_adpcm_fadein_timer->adjust(attotime::from_usec(param), param); - } -} - - -WRITE8_MEMBER(pce_cd_device::intf_w) -{ - logerror("%04X: write to CD interface offset %02X, data %02X\n", space.device().safe_pc(), offset, data); - - switch (offset & 0xf) - { - case 0x00: /* CDC status */ - /* select device (which bits??) */ - m_scsi_SEL = 1; - update(); - m_scsi_SEL = 0; - m_adpcm_dma_timer->adjust(attotime::never); // stop ADPCM DMA here - /* any write here clears CD transfer irqs */ - set_irq_line(0x70, CLEAR_LINE); - break; - case 0x01: /* CDC command / status / data */ - break; - case 0x02: /* ADPCM / CD control / IRQ enable/disable */ - /* bit 6 - transfer ready irq */ - /* bit 5 - transfer done irq */ - /* bit 4 - BRAM irq? */ - /* bit 3 - ADPCM FULL irq */ - /* bit 2 - ADPCM HALF irq */ - m_scsi_ACK = data & 0x80; - /* Update mask register now otherwise it won't catch the irq enable/disable change */ - m_regs[0x02] = data; - /* Don't set or reset any irq lines, but just verify the current state */ - set_irq_line(0, 0); - break; - case 0x03: /* BRAM lock / CD status / IRQ - Read Only register */ - break; - case 0x04: /* CD reset */ - m_scsi_RST = data & 0x02; - break; - case 0x05: /* Convert PCM data / PCM data */ - case 0x06: /* PCM data */ - break; - case 0x07: /* BRAM unlock / CD status */ - if (data & 0x80) - m_bram_locked = 0; - break; - case 0x08: /* ADPCM address (LSB) / CD data */ - break; - case 0x09: /* ADPCM address (MSB) */ - break; - case 0x0A: /* ADPCM RAM data port */ - set_adpcm_ram_byte(data); - break; - case 0x0B: /* ADPCM DMA control */ - if (data & 0x03) - { - /* Start CD to ADPCM transfer */ - m_adpcm_dma_timer->adjust(attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND * 2048), 0, attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND * 2048)); - m_regs[0x0c] |= 4; - } - break; - case 0x0C: /* ADPCM status */ - break; - case 0x0D: /* ADPCM address control */ - if ((m_regs[0x0D] & 0x80) && !(data & 0x80)) // ADPCM reset - { - /* Reset ADPCM hardware */ - m_adpcm_read_ptr = 0; - m_adpcm_write_ptr = 0; - m_msm_start_addr = 0; - m_msm_end_addr = 0; - m_msm_half_addr = 0; - m_msm_nibble = 0; - adpcm_stop(0); - m_msm->reset_w(1); - } - - if ((data & 0x40) && ((m_regs[0x0D] & 0x40) == 0)) // ADPCM play - { - m_msm_start_addr = (m_adpcm_read_ptr); - m_msm_end_addr = (m_adpcm_read_ptr + m_adpcm_length) & 0xffff; - m_msm_half_addr = (m_adpcm_read_ptr + (m_adpcm_length / 2)) & 0xffff; - m_msm_nibble = 0; - adpcm_play(); - m_msm->reset_w(0); - - //popmessage("%08x %08x",m_adpcm_read_ptr,m_adpcm_length); - } - else if ((data & 0x40) == 0) - { - /* used by Buster Bros to cancel an in-flight sample */ - adpcm_stop(0); - m_msm->reset_w(1); - } - - m_msm_repeat = BIT(data, 5); - - if (data & 0x10) //ADPCM set length - { - m_adpcm_length = (m_regs[0x09] << 8) | m_regs[0x08]; - } - if (data & 0x08) //ADPCM set read address - { - m_adpcm_read_ptr = (m_regs[0x09] << 8) | m_regs[0x08]; - m_adpcm_read_buf = 2; - } - if ((data & 0x02) == 0x02) //ADPCM set write address - { - m_adpcm_write_ptr = (m_regs[0x09] << 8) | m_regs[0x08]; - m_adpcm_write_buf = data & 1; - } - break; - case 0x0E: /* ADPCM playback rate */ - m_adpcm_clock_divider = 0x10 - (data & 0x0f); - m_msm->change_clock_w((PCE_CD_CLOCK / 6) / m_adpcm_clock_divider); - break; - case 0x0F: /* ADPCM and CD audio fade timer */ - /* TODO: timers needs HW tests */ - if (m_regs[0xf] != data) - { - switch (data & 0xf) - { - case 0x00: //CD-DA / ADPCM enable (100 msecs) - m_cdda_volume = 0.0; - m_cdda_fadein_timer->adjust(attotime::from_usec(100), 100); - m_adpcm_volume = 0.0; - m_adpcm_fadein_timer->adjust(attotime::from_usec(100), 100); - m_cdda_fadeout_timer->adjust(attotime::never); - m_adpcm_fadeout_timer->adjust(attotime::never); - break; - case 0x01: //CD-DA enable (100 msecs) - m_cdda_volume = 0.0; - m_cdda_fadein_timer->adjust(attotime::from_usec(100), 100); - m_cdda_fadeout_timer->adjust(attotime::never); - break; - case 0x08: //CD-DA short (1500 msecs) fade out / ADPCM enable - m_cdda_volume = 100.0; - m_cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500); - m_adpcm_volume = 0.0; - m_adpcm_fadein_timer->adjust(attotime::from_usec(100), 100); - m_cdda_fadein_timer->adjust(attotime::never); - m_adpcm_fadeout_timer->adjust(attotime::never); - break; - case 0x09: //CD-DA long (5000 msecs) fade out - m_cdda_volume = 100.0; - m_cdda_fadeout_timer->adjust(attotime::from_usec(5000), 5000); - m_cdda_fadein_timer->adjust(attotime::never); - break; - case 0x0a: //ADPCM long (5000 msecs) fade out - m_adpcm_volume = 100.0; - m_adpcm_fadeout_timer->adjust(attotime::from_usec(5000), 5000); - m_adpcm_fadein_timer->adjust(attotime::never); - break; - case 0x0c: //CD-DA short (1500 msecs) fade out / ADPCM enable - m_cdda_volume = 100.0; - m_cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500); - m_adpcm_volume = 0.0; - m_adpcm_fadein_timer->adjust(attotime::from_usec(100), 100); - m_cdda_fadein_timer->adjust(attotime::never); - m_adpcm_fadeout_timer->adjust(attotime::never); - break; - case 0x0d: //CD-DA short (1500 msecs) fade out - m_cdda_volume = 100.0; - m_cdda_fadeout_timer->adjust(attotime::from_usec(1500), 1500); - m_cdda_fadein_timer->adjust(attotime::never); - break; - case 0x0e: //ADPCM short (1500 msecs) fade out - m_adpcm_volume = 100.0; - m_adpcm_fadeout_timer->adjust(attotime::from_usec(1500), 1500); - m_adpcm_fadein_timer->adjust(attotime::never); - break; - default: - popmessage("CD-DA / ADPCM Fade effect mode %02x, contact MESSdev",data & 0x0f); - break; - } - } - break; - default: - return; - } - m_regs[offset & 0xf] = data; -} - -TIMER_CALLBACK_MEMBER(pce_cd_device::clear_ack) -{ - update(); - m_scsi_ACK = 0; - update(); - if (m_scsi_CD) - { - m_regs[0x0B] &= 0xFC; - } -} - -UINT8 pce_cd_device::get_cd_data_byte() -{ - UINT8 data = m_regs[0x01]; - if (m_scsi_REQ && !m_scsi_ACK && !m_scsi_CD) - { - if (m_scsi_IO) - { - m_scsi_ACK = 1; - machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(15), timer_expired_delegate(FUNC(pce_cd_device::clear_ack),this)); - } - } - return data; -} - - -TIMER_CALLBACK_MEMBER(pce_cd_device::adpcm_dma_timer_callback) -{ - if (m_scsi_REQ && !m_scsi_ACK && !m_scsi_CD && m_scsi_IO) - { - m_adpcm_ram[m_adpcm_write_ptr] = get_cd_data_byte(); - m_adpcm_write_ptr = (m_adpcm_write_ptr + 1) & 0xFFFF; - - m_regs[0x0c] &= ~4; - } -} - -UINT8 pce_cd_device::get_adpcm_ram_byte() -{ - if (m_adpcm_read_buf > 0) - { - m_adpcm_read_buf--; - return 0; - } - else - { - UINT8 res; - - res = m_adpcm_ram[m_adpcm_read_ptr]; - m_adpcm_read_ptr = ((m_adpcm_read_ptr + 1) & 0xffff); - - return res; - } -} - -READ8_MEMBER(pce_cd_device::intf_r) -{ - UINT8 data = m_regs[offset & 0x0F]; - - logerror("%04X: read from CD interface offset %02X\n", space.device().safe_pc(), offset ); - - switch (offset & 0xf) - { - case 0x00: /* CDC status */ - data &= 0x07; - data |= m_scsi_BSY ? 0x80 : 0; - data |= m_scsi_REQ ? 0x40 : 0; - data |= m_scsi_MSG ? 0x20 : 0; - data |= m_scsi_CD ? 0x10 : 0; - data |= m_scsi_IO ? 0x08 : 0; - break; - case 0x01: /* CDC command / status / data */ - break; - case 0x02: /* ADPCM / CD control */ - break; - case 0x03: /* BRAM lock / CD status */ - /* bit 4 set when CD motor is on */ - /* bit 2 set when less than half of the ADPCM data is remaining ?? */ - m_bram_locked = 1; - data = data & 0x6E; - data |= (m_cd_motor_on ? 0x10 : 0); - m_regs[0x03] ^= 0x02; /* TODO: get rid of this hack */ - break; - case 0x04: /* CD reset */ - break; - case 0x05: /* Convert PCM data / PCM data */ - data = m_cdda->get_channel_volume((m_regs[0x03] & 2) ? 0 : 1) & 0xff; - break; - case 0x06: /* PCM data */ - data = m_cdda->get_channel_volume((m_regs[0x03] & 2) ? 0 : 1) >> 8; - break; - case 0x07: /* BRAM unlock / CD status */ - data = (m_bram_locked ? (data & 0x7f) : (data | 0x80)); - break; - case 0x08: /* ADPCM address (LSB) / CD data */ - data = get_cd_data_byte(); - break; - case 0x0A: /* ADPCM RAM data port */ - data = get_adpcm_ram_byte(); - break; - case 0x0B: /* ADPCM DMA control */ - break; - case 0x0C: /* ADPCM status */ - break; - case 0x0D: /* ADPCM address control */ - break; - /* These are read-only registers */ - case 0x09: /* ADPCM address (MSB) */ - case 0x0E: /* ADPCM playback rate */ - case 0x0F: /* ADPCM and CD audio fade timer */ - return 0; - default: - data = 0xFF; - break; - } - - return data; -} - - -/* - -PC Engine Arcade Card emulation - -*/ - -READ8_MEMBER(pce_cd_device::acard_r) -{ - UINT8 r_num; - - if ((offset & 0x2e0) == 0x2e0) - { - switch (offset & 0x2ef) - { - case 0x2e0: return (m_acard_shift >> 0) & 0xff; - case 0x2e1: return (m_acard_shift >> 8) & 0xff; - case 0x2e2: return (m_acard_shift >> 16) & 0xff; - case 0x2e3: return (m_acard_shift >> 24) & 0xff; - case 0x2e4: return (m_acard_shift_reg); - case 0x2e5: return m_acard_latch; - case 0x2ee: return 0x10; - case 0x2ef: return 0x51; - } - - return 0; - } - - r_num = (offset & 0x30) >> 4; - - switch (offset & 0x0f) - { - case 0x00: - case 0x01: - { - UINT8 res; - if (m_acard_ctrl[r_num] & 2) - res = m_acard_ram[(m_acard_base_addr[r_num] + m_acard_addr_offset[r_num]) & 0x1fffff]; - else - res = m_acard_ram[m_acard_base_addr[r_num] & 0x1fffff]; - - if (m_acard_ctrl[r_num] & 0x1) - { - if (m_acard_ctrl[r_num] & 0x10) - { - m_acard_base_addr[r_num] += m_acard_addr_inc[r_num]; - m_acard_base_addr[r_num] &= 0xffffff; - } - else - { - m_acard_addr_offset[r_num] += m_acard_addr_inc[r_num]; - } - } - - return res; - } - case 0x02: return (m_acard_base_addr[r_num] >> 0) & 0xff; - case 0x03: return (m_acard_base_addr[r_num] >> 8) & 0xff; - case 0x04: return (m_acard_base_addr[r_num] >> 16) & 0xff; - case 0x05: return (m_acard_addr_offset[r_num] >> 0) & 0xff; - case 0x06: return (m_acard_addr_offset[r_num] >> 8) & 0xff; - case 0x07: return (m_acard_addr_inc[r_num] >> 0) & 0xff; - case 0x08: return (m_acard_addr_inc[r_num] >> 8) & 0xff; - case 0x09: return m_acard_ctrl[r_num]; - default: return 0; - } -} - -WRITE8_MEMBER(pce_cd_device::acard_w) -{ - UINT8 w_num; - - if ((offset & 0x2e0) == 0x2e0) - { - switch (offset & 0x0f) - { - case 0: m_acard_shift = (data & 0xff) | (m_acard_shift & 0xffffff00); break; - case 1: m_acard_shift = (data << 8) | (m_acard_shift & 0xffff00ff); break; - case 2: m_acard_shift = (data << 16) | (m_acard_shift & 0xff00ffff); break; - case 3: m_acard_shift = (data << 24) | (m_acard_shift & 0x00ffffff); break; - case 4: - { - m_acard_shift_reg = data & 0x0f; - - if (m_acard_shift_reg != 0) - { - m_acard_shift = (m_acard_shift_reg < 8) ? - (m_acard_shift << m_acard_shift_reg) - : (m_acard_shift >> (16 - m_acard_shift_reg)); - } - } - break; - case 5: m_acard_latch = data; break; - } - } - else - { - w_num = (offset & 0x30) >> 4; - - switch (offset & 0x0f) - { - case 0x00: - case 0x01: - if (m_acard_ctrl[w_num] & 2) - m_acard_ram[(m_acard_base_addr[w_num] + m_acard_addr_offset[w_num]) & 0x1fffff] = data; - else - m_acard_ram[m_acard_base_addr[w_num] & 0x1FFFFF] = data; - - if (m_acard_ctrl[w_num] & 0x1) - { - if (m_acard_ctrl[w_num] & 0x10) - { - m_acard_base_addr[w_num] += m_acard_addr_inc[w_num]; - m_acard_base_addr[w_num] &= 0xffffff; - } - else - { - m_acard_addr_offset[w_num] += m_acard_addr_inc[w_num]; - } - } - - break; - - case 0x02: m_acard_base_addr[w_num] = (data & 0xff) | (m_acard_base_addr[w_num] & 0xffff00); break; - case 0x03: m_acard_base_addr[w_num] = (data << 8) | (m_acard_base_addr[w_num] & 0xff00ff); break; - case 0x04: m_acard_base_addr[w_num] = (data << 16) | (m_acard_base_addr[w_num] & 0x00ffff); break; - case 0x05: m_acard_addr_offset[w_num] = (data & 0xff) | (m_acard_addr_offset[w_num] & 0xff00); break; - case 0x06: - m_acard_addr_offset[w_num] = (data << 8) | (m_acard_addr_offset[w_num] & 0x00ff); - - if ((m_acard_ctrl[w_num] & 0x60) == 0x40) - { - m_acard_base_addr[w_num] += m_acard_addr_offset[w_num] + ((m_acard_ctrl[w_num] & 0x08) ? 0xff0000 : 0); - m_acard_base_addr[w_num] &= 0xffffff; - } - break; - case 0x07: m_acard_addr_inc[w_num] = (data & 0xff) | (m_acard_addr_inc[w_num] & 0xff00); break; - case 0x08: m_acard_addr_inc[w_num] = (data << 8) | (m_acard_addr_inc[w_num] & 0x00ff); break; - case 0x09: m_acard_ctrl[w_num] = data & 0x7f; break; - case 0x0a: - if ((m_acard_ctrl[w_num] & 0x60) == 0x60) - { - m_acard_base_addr[w_num] += m_acard_addr_offset[w_num]; - m_acard_base_addr[w_num] &= 0xffffff; - } - break; - } - } -} diff --git a/src/mess/machine/pce_cd.h b/src/mess/machine/pce_cd.h deleted file mode 100644 index d50bbe27153..00000000000 --- a/src/mess/machine/pce_cd.h +++ /dev/null @@ -1,188 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#ifndef __PCE_CD_H -#define __PCE_CD_H - -/*************************************************************************** - TYPE DEFINITIONS - ***************************************************************************/ - -#include "imagedev/chd_cd.h" -#include "machine/nvram.h" -#include "sound/cdda.h" -#include "sound/msm5205.h" - -#define PCE_BRAM_SIZE 0x800 -#define PCE_ADPCM_RAM_SIZE 0x10000 -#define PCE_ACARD_RAM_SIZE 0x200000 -#define PCE_CD_COMMAND_BUFFER_SIZE 0x100 - -#define PCE_CD_IRQ_TRANSFER_READY 0x40 -#define PCE_CD_IRQ_TRANSFER_DONE 0x20 -#define PCE_CD_IRQ_BRAM 0x10 /* ??? */ -#define PCE_CD_IRQ_SAMPLE_FULL_PLAY 0x08 -#define PCE_CD_IRQ_SAMPLE_HALF_PLAY 0x04 - -#define PCE_CD_ADPCM_PLAY_FLAG 0x08 -#define PCE_CD_ADPCM_STOP_FLAG 0x01 - -#define PCE_CD_DATA_FRAMES_PER_SECOND 75 - -enum { - PCE_CD_CDDA_OFF = 0, - PCE_CD_CDDA_PLAYING, - PCE_CD_CDDA_PAUSED -}; - - - -// ======================> pce_cd_device - -class pce_cd_device : public device_t -{ -public: - // construction/destruction - pce_cd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ~pce_cd_device() {} - - // device-level overrides - virtual void device_start(); - virtual machine_config_constructor device_mconfig_additions() const; - virtual void device_reset(); - - void update(); - - void late_setup(); - - DECLARE_WRITE8_MEMBER(bram_w); - DECLARE_WRITE8_MEMBER(intf_w); - DECLARE_WRITE8_MEMBER(acard_w); - DECLARE_WRITE_LINE_MEMBER(msm5205_int); - DECLARE_READ8_MEMBER(bram_r); - DECLARE_READ8_MEMBER(intf_r); - DECLARE_READ8_MEMBER(acard_r); - - void nvram_init(nvram_device &nvram, void *data, size_t size); - -private: - void adpcm_stop(UINT8 irq_flag); - void adpcm_play(); - void reply_status_byte(UINT8 status); - void test_unit_ready(); - void read_6(); - void nec_set_audio_start_position(); - void nec_set_audio_stop_position(); - void nec_pause(); - void nec_get_subq(); - void nec_get_dir_info(); - void end_of_list(); - void handle_data_output(); - void handle_data_input(); - void handle_message_output(); - void handle_message_input(); - void set_irq_line(int num, int state); - void set_adpcm_ram_byte(UINT8 val); - UINT8 get_cd_data_byte(); - UINT8 get_adpcm_ram_byte(); - - TIMER_CALLBACK_MEMBER(data_timer_callback); - TIMER_CALLBACK_MEMBER(cdda_fadeout_callback); - TIMER_CALLBACK_MEMBER(cdda_fadein_callback); - TIMER_CALLBACK_MEMBER(adpcm_fadeout_callback); - TIMER_CALLBACK_MEMBER(adpcm_fadein_callback); - TIMER_CALLBACK_MEMBER(clear_ack); - TIMER_CALLBACK_MEMBER(adpcm_dma_timer_callback); - - required_device m_maincpu; - - UINT8 m_regs[16]; - UINT8 *m_bram; - UINT8 *m_adpcm_ram; - int m_bram_locked; - int m_adpcm_read_ptr; - UINT8 m_adpcm_read_buf; - int m_adpcm_write_ptr; - UINT8 m_adpcm_write_buf; - int m_adpcm_length; - int m_adpcm_clock_divider; - UINT32 m_msm_start_addr; - UINT32 m_msm_end_addr; - UINT32 m_msm_half_addr; - UINT8 m_msm_nibble; - UINT8 m_msm_idle; - UINT8 m_msm_repeat; - - /* SCSI signals */ - int m_scsi_BSY; /* Busy. Bus in use */ - int m_scsi_SEL; /* Select. Initiator has won arbitration and has selected a target */ - int m_scsi_CD; /* Control/Data. Target is sending control (data) information */ - int m_scsi_IO; /* Input/Output. Target is sending (receiving) information */ - int m_scsi_MSG; /* Message. Target is sending or receiving a message */ - int m_scsi_REQ; /* Request. Target is requesting a data transfer */ - int m_scsi_ACK; /* Acknowledge. Initiator acknowledges that it is ready for a data transfer */ - int m_scsi_ATN; /* Attention. Initiator has a message ready for the target */ - int m_scsi_RST; /* Reset. Initiator forces all targets and any other initiators to do a warm reset */ - int m_scsi_last_RST; /* To catch setting of RST signal */ - int m_cd_motor_on; - int m_selected; - UINT8 *m_command_buffer; - int m_command_buffer_index; - int m_status_sent; - int m_message_after_status; - int m_message_sent; - UINT8 *m_data_buffer; - int m_data_buffer_size; - int m_data_buffer_index; - int m_data_transferred; - - /* Arcade Card specific */ - UINT8 *m_acard_ram; - UINT8 m_acard_latch; - UINT8 m_acard_ctrl[4]; - UINT32 m_acard_base_addr[4]; - UINT16 m_acard_addr_offset[4]; - UINT16 m_acard_addr_inc[4]; - UINT32 m_acard_shift; - UINT8 m_acard_shift_reg; - - UINT32 m_current_frame; - UINT32 m_end_frame; - UINT32 m_last_frame; - UINT8 m_cdda_status; - UINT8 m_cdda_play_mode; - UINT8 *m_subcode_buffer; - UINT8 m_end_mark; - - required_device m_msm; - required_device m_cdda; - required_device m_nvram; - required_device m_cdrom; - - cdrom_file *m_cd_file; - const cdrom_toc* m_toc; - emu_timer *m_data_timer; - emu_timer *m_adpcm_dma_timer; - - emu_timer *m_cdda_fadeout_timer; - emu_timer *m_cdda_fadein_timer; - double m_cdda_volume; - emu_timer *m_adpcm_fadeout_timer; - emu_timer *m_adpcm_fadein_timer; - double m_adpcm_volume; -}; - - - -// device type definition -extern const device_type PCE_CD; - - -/*************************************************************************** - DEVICE CONFIGURATION MACROS - ***************************************************************************/ - -#define MCFG_PCE_CD_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, PCE_CD, 0) - - -#endif diff --git a/src/mess/machine/pecom.c b/src/mess/machine/pecom.c deleted file mode 100644 index ecf002799f0..00000000000 --- a/src/mess/machine/pecom.c +++ /dev/null @@ -1,179 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Pecom driver by Miodrag Milanovic - - 08/11/2008 Preliminary driver. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/cosmac/cosmac.h" -#include "sound/cdp1869.h" -#include "includes/pecom.h" - -TIMER_CALLBACK_MEMBER(pecom_state::reset_tick) -{ - m_reset = 1; -} - -void pecom_state::machine_start() -{ - static const char *const keynames[] = { - "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", - "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15", "LINE16", - "LINE17", "LINE18", "LINE19", "LINE20", "LINE21", "LINE22", "LINE23", "LINE24","LINE25" - }; - - for ( int i = 0; i < 26; i++ ) - { - m_io_ports[i] = ioport(keynames[i]); - } - - m_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pecom_state::reset_tick),this)); -} - -void pecom_state::machine_reset() -{ - UINT8 *rom = memregion(CDP1802_TAG)->base(); - address_space &space = m_cdp1802->space(AS_PROGRAM); - - - space.unmap_write(0x0000, 0x3fff); - space.install_write_bank(0x4000, 0x7fff, "bank2"); - space.unmap_write(0xf000, 0xf7ff); - space.unmap_write(0xf800, 0xffff); - space.install_read_bank (0xf000, 0xf7ff, "bank3"); - space.install_read_bank (0xf800, 0xffff, "bank4"); - m_bank1->set_base(rom + 0x8000); - m_bank2->set_base(m_ram->pointer() + 0x4000); - m_bank3->set_base(rom + 0xf000); - m_bank4->set_base(rom + 0xf800); - - m_reset = 0; - m_dma = 0; - m_reset_timer->adjust(attotime::from_msec(5)); -} - -READ8_MEMBER(pecom_state::pecom_cdp1869_charram_r) -{ - return m_cdp1869->char_ram_r(space, offset); -} - -WRITE8_MEMBER(pecom_state::pecom_cdp1869_charram_w) -{ - return m_cdp1869->char_ram_w(space, offset, data); -} - -READ8_MEMBER(pecom_state::pecom_cdp1869_pageram_r) -{ - return m_cdp1869->page_ram_r(space, offset); -} - -WRITE8_MEMBER(pecom_state::pecom_cdp1869_pageram_w) -{ - return m_cdp1869->page_ram_w(space, offset, data); -} - -WRITE8_MEMBER(pecom_state::pecom_bank_w) -{ - address_space &space2 = m_cdp1802->space(AS_PROGRAM); - UINT8 *rom = memregion(CDP1802_TAG)->base(); - m_cdp1802->space(AS_PROGRAM).install_write_bank(0x0000, 0x3fff, "bank1"); - m_bank1->set_base(m_ram->pointer() + 0x0000); - - if (data==2) - { - space2.install_read_handler (0xf000, 0xf7ff, read8_delegate(FUNC(pecom_state::pecom_cdp1869_charram_r),this)); - space2.install_write_handler(0xf000, 0xf7ff, write8_delegate(FUNC(pecom_state::pecom_cdp1869_charram_w),this)); - space2.install_read_handler (0xf800, 0xffff, read8_delegate(FUNC(pecom_state::pecom_cdp1869_pageram_r),this)); - space2.install_write_handler(0xf800, 0xffff, write8_delegate(FUNC(pecom_state::pecom_cdp1869_pageram_w),this)); - } - else - { - space2.unmap_write(0xf000, 0xf7ff); - space2.unmap_write(0xf800, 0xffff); - space2.install_read_bank (0xf000, 0xf7ff, "bank3"); - space2.install_read_bank (0xf800, 0xffff, "bank4"); - m_bank3->set_base(rom + 0xf000); - m_bank4->set_base(rom + 0xf800); - } -} - -READ8_MEMBER(pecom_state::pecom_keyboard_r) -{ - /* - INP command BUS -> M(R(X)) BUS -> D - so on each input, address is also set, 8 lower bits are used as input for keyboard - Address is available on address bus during reading of value from port, and that is - used to determine keyboard line reading - */ - UINT16 addr = m_cdp1802->state_int(COSMAC_R0 + m_cdp1802->state_int(COSMAC_X)); - /* just in case somone is reading non existing ports */ - if (addr<0x7cca || addr>0x7ce3) return 0; - return m_io_ports[addr - 0x7cca]->read() & 0x03; -} - -/* CDP1802 Interface */ - -READ_LINE_MEMBER(pecom_state::clear_r) -{ - return m_reset; -} - -READ_LINE_MEMBER(pecom_state::ef2_r) -{ - int shift = BIT(m_io_cnt->read(), 1); - double cas = m_cassette->input(); - - return (cas > 0.0) | shift; -} - -/* -static COSMAC_EF_READ( pecom64_ef_r ) -{ - int flags = 0x0f; - double valcas = (cassette_device_image(device->machine()));->input() - UINT8 val = device->machine().root_device().ioport("CNT")->read(); - - if ((val & 0x04)==0x04 && pecom_prev_caps_state==0) - { - pecom_caps_state = (pecom_caps_state==4) ? 0 : 4; // Change CAPS state - } - pecom_prev_caps_state = val & 0x04; - if (valcas!=0.0) - { // If there is any cassette signal - val = (val & 0x0D); // remove EF2 from SHIFT - flags -= EF2; - if ( valcas > 0.00) flags += EF2; - } - flags -= (val & 0x0b) + pecom_caps_state; - return flags; -} -*/ -WRITE_LINE_MEMBER(pecom_state::q_w) -{ - m_cassette->output(state ? -1.0 : +1.0); -} - -WRITE8_MEMBER(pecom_state::sc_w ) -{ - switch (data) - { - case COSMAC_STATE_CODE_S0_FETCH: - // not connected - break; - - case COSMAC_STATE_CODE_S1_EXECUTE: - break; - - case COSMAC_STATE_CODE_S2_DMA: - // DMA acknowledge clears the DMAOUT request - m_cdp1802->set_input_line(COSMAC_INPUT_LINE_DMAOUT, CLEAR_LINE); - break; - - case COSMAC_STATE_CODE_S3_INTERRUPT: - break; - } -} diff --git a/src/mess/machine/pk8020.c b/src/mess/machine/pk8020.c deleted file mode 100644 index e065aac7fd7..00000000000 --- a/src/mess/machine/pk8020.c +++ /dev/null @@ -1,908 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - PK-8020 driver by Miodrag Milanovic - based on work of Sergey Erokhin from pk8020.narod.ru - - 18/07/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/pk8020.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/flopdrv.h" - - -READ8_MEMBER(pk8020_state::keyboard_r) -{ - UINT8 retVal=0x00; - UINT8 line = 0; - if (offset & 0x100) line=8; - - if (offset & 0x0001) retVal|=m_io_port[line]->read(); - line++; - if (offset & 0x0002) retVal|=m_io_port[line]->read(); - line++; - if (offset & 0x0004) retVal|=m_io_port[line]->read(); - line++; - if (offset & 0x0008) retVal|=m_io_port[line]->read(); - line++; - if (offset & 0x0010) retVal|=m_io_port[line]->read(); - line++; - if (offset & 0x0020) retVal|=m_io_port[line]->read(); - line++; - if (offset & 0x0040) retVal|=m_io_port[line]->read(); - line++; - if (offset & 0x0080) retVal|=m_io_port[line]->read(); - line++; - - return retVal; -} - -READ8_MEMBER(pk8020_state::sysreg_r) -{ - return m_ram->pointer()[offset]; -} -WRITE8_MEMBER(pk8020_state::sysreg_w) -{ - if (BIT(offset,7)==0) { - pk8020_set_bank(data >> 2); - } else if (BIT(offset,6)==0) { - // Color - m_color = data; - } else if (BIT(offset,2)==0) { - // Palette set - UINT8 number = data & 0x0f; - UINT8 color = data >> 4; - UINT8 i = (color & 0x08) ? 0x3F : 0; - UINT8 r = ((color & 0x04) ? 0xC0 : 0) + i; - UINT8 g = ((color & 0x02) ? 0xC0 : 0) + i; - UINT8 b = ((color & 0x01) ? 0xC0 : 0) + i; - m_palette->set_pen_color( number, rgb_t(r,g,b) ); - } -} - -READ8_MEMBER(pk8020_state::text_r) -{ - if (m_attr == 3) m_text_attr=m_ram->pointer()[0x40400+offset]; - return m_ram->pointer()[0x40000+offset]; -} - -WRITE8_MEMBER(pk8020_state::text_w) -{ - UINT8 *ram = m_ram->pointer(); - ram[0x40000+offset] = data; - switch (m_attr) { - case 0: break; - case 1: ram[0x40400+offset]=0x01;break; - case 2: ram[0x40400+offset]=0x00;break; - case 3: ram[0x40400+offset]=m_text_attr;break; - } -} - -READ8_MEMBER(pk8020_state::gzu_r) -{ - UINT8 *addr = m_ram->pointer() + 0x10000 + (m_video_page_access * 0xC000); - UINT8 p0 = addr[offset]; - UINT8 p1 = addr[offset + 0x4000]; - UINT8 p2 = addr[offset + 0x8000]; - UINT8 retVal = 0; - if(m_color & 0x80) { - // Color mode - if (!(m_color & 0x10)) { - p0 ^= 0xff; - } - if (!(m_color & 0x20)) { - p1 ^= 0xff; - } - if (!(m_color & 0x40)) { - p2 ^= 0xff; - } - retVal = (p0 & p1 & p2) ^ 0xff; - } else { - // Plane mode - if (m_color & 0x10) { - retVal |= p0; - } - if (m_color & 0x20) { - retVal |= p1; - } - if (m_color & 0x40) { - retVal |= p2; - } - } - return retVal; -} - -WRITE8_MEMBER(pk8020_state::gzu_w) -{ - UINT8 *addr = m_ram->pointer() + 0x10000 + (m_video_page_access * 0xC000); - UINT8 *plane_0 = addr; - UINT8 *plane_1 = addr + 0x4000; - UINT8 *plane_2 = addr + 0x8000; - - if(m_color & 0x80) - { - // Color mode - plane_0[offset] = (plane_0[offset] & ~data) | ((m_color & 2) ? data : 0); - plane_1[offset] = (plane_1[offset] & ~data) | ((m_color & 4) ? data : 0); - plane_2[offset] = (plane_2[offset] & ~data) | ((m_color & 8) ? data : 0); - } else { - // Plane mode - UINT8 mask = (m_color & 1) ? data : 0; - if (!(m_color & 0x02)) { - plane_0[offset] = (plane_0[offset] & ~data) | mask; - } - if (!(m_color & 0x04)) { - plane_1[offset] = (plane_1[offset] & ~data) | mask; - } - if (!(m_color & 0x08)) { - plane_2[offset] = (plane_2[offset] & ~data) | mask; - } - } -} - -READ8_MEMBER(pk8020_state::devices_r) -{ - switch(offset & 0x38) - { - case 0x00: return m_pit8253->read(space, offset & 3); - case 0x08: return m_ppi8255_3->read(space,offset & 3); - case 0x10: switch(offset & 1) { - case 0 : return m_rs232->data_r(space,0); - case 1 : return m_rs232->status_r(space,0); - } - break; - case 0x18: return m_wd1793->read(space, offset & 0x03); - case 0x20: switch(offset & 1) { - case 0 : return m_lan->data_r(space,0); - case 1 : return m_lan->status_r(space,0); - } - break; - case 0x28: return m_pic8259->read(space, offset & 1); - case 0x30: return m_ppi8255_2->read(space,offset & 3); - case 0x38: return m_ppi8255_1->read(space,offset & 3); - } - return 0xff; -} - -WRITE8_MEMBER(pk8020_state::devices_w) -{ - switch(offset & 0x38) - { - case 0x00: m_pit8253->write(space, offset & 3, data); break; - case 0x08: m_ppi8255_3->write(space,offset & 3,data); break; - case 0x10: switch(offset & 1) { - case 0 : m_rs232->data_w(space,0,data); break; - case 1 : m_rs232->control_w(space,0,data); break; - } - break; - case 0x18: - m_wd1793->write(space, offset & 0x03, data); - break; - case 0x20: switch(offset & 1) { - case 0 : m_lan->data_w(space,0,data); break; - case 1 : m_lan->control_w(space,0,data); break; - } - break; - case 0x28: m_pic8259->write(space, offset & 1,data);break; - case 0x30: m_ppi8255_2->write(space,offset & 3,data); break; - case 0x38: m_ppi8255_1->write(space,offset & 3,data); break; - } -} - -void pk8020_state::pk8020_set_bank(UINT8 data) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *mem = m_region_maincpu->base(); - UINT8 *ram = m_ram->pointer(); - - switch(data & 0x1F) { - case 0x00 : - { - // ROM - space.install_read_bank (0x0000, 0x37ff, "bank1"); - space.install_write_bank(0x0000, 0x37ff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // Keyboard - space.install_read_handler (0x3800, 0x39ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0x3800, 0x39ff, "bank3"); - membank("bank3")->set_base(ram + 0x3800); - // System reg - space.install_read_handler (0x3a00, 0x3aff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0x3a00, 0x3aff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0x3b00, 0x3bff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0x3b00, 0x3bff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0x3c00, 0x3fff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0x3c00, 0x3fff, write8_delegate(FUNC(pk8020_state::text_w),this)); - // RAM - space.install_read_bank (0x4000, 0xffff, "bank4"); - space.install_write_bank(0x4000, 0xffff, "bank5"); - membank("bank4")->set_base(ram + 0x4000); - membank("bank5")->set_base(ram + 0x4000); - } - break; - case 0x01 : { - // ROM - space.install_read_bank (0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x0000, 0x1fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x2000, 0xffff, "bank3"); - space.install_write_bank(0x2000, 0xffff, "bank4"); - membank("bank3")->set_base(ram + 0x2000); - membank("bank4")->set_base(ram + 0x2000); - } - break; - case 0x02 : { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x4000, 0xffff, "bank3"); - space.install_write_bank(0x4000, 0xffff, "bank4"); - membank("bank3")->set_base(ram + 0x4000); - membank("bank4")->set_base(ram + 0x4000); - } - break; - case 0x03 : { - // RAM - space.install_read_bank (0x0000, 0xffff, "bank1"); - space.install_write_bank(0x0000, 0xffff, "bank2"); - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram); - } - break; - case 0x04 : - case 0x05 : - { - // ROM - space.install_read_bank (0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x0000, 0x1fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x2000, 0xf7ff, "bank3"); - space.install_write_bank(0x2000, 0xf7ff, "bank4"); - membank("bank3")->set_base(ram + 0x2000); - membank("bank4")->set_base(ram + 0x2000); - // Keyboard - space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0xf800, 0xf9ff, "bank5"); - membank("bank5")->set_base(ram + 0xf800); - // System reg - space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); - } - break; - case 0x06 : - { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x4000, 0xf7ff, "bank3"); - space.install_write_bank(0x4000, 0xf7ff, "bank4"); - membank("bank3")->set_base(ram + 0x4000); - membank("bank4")->set_base(ram + 0x4000); - // Keyboard - space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0xf800, 0xf9ff, "bank5"); - membank("bank5")->set_base(ram + 0xf800); - // System reg - space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); - } - break; - case 0x07 : - { - // RAM - space.install_read_bank (0x0000, 0xf7ff, "bank1"); - space.install_write_bank(0x0000, 0xf7ff, "bank2"); - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram); - // Keyboard - space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0xf800, 0xf9ff, "bank3"); - membank("bank3")->set_base(ram + 0xf800); - // System reg - space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); - } - break; - case 0x08 : - { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // Keyboard - space.install_read_handler (0x3800, 0x39ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0x3800, 0x39ff, "bank3"); - membank("bank3")->set_base(ram + 0x3800); - // System reg - space.install_read_handler (0x3a00, 0x3aff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0x3a00, 0x3aff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0x3b00, 0x3bff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0x3b00, 0x3bff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0x3c00, 0x3fff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0x3c00, 0x3fff, write8_delegate(FUNC(pk8020_state::text_w),this)); - // RAM - space.install_read_bank (0x4000, 0xbfff, "bank4"); - space.install_write_bank(0x4000, 0xbfff, "bank5"); - membank("bank4")->set_base(ram + 0x4000); - membank("bank5")->set_base(ram + 0x4000); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - - } - break; - case 0x09 : - { - // ROM - space.install_read_bank (0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x0000, 0x1fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x2000, 0xbfff, "bank3"); - space.install_write_bank(0x2000, 0xbfff, "bank4"); - membank("bank3")->set_base(ram + 0x2000); - membank("bank4")->set_base(ram + 0x2000); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x0A : - { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x4000, 0xbfff, "bank3"); - space.install_write_bank(0x4000, 0xbfff, "bank4"); - membank("bank3")->set_base(ram + 0x4000); - membank("bank4")->set_base(ram + 0x4000); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x0B : - { - // RAM - space.install_read_bank (0x0000, 0xbfff, "bank1"); - space.install_write_bank(0x0000, 0xbfff, "bank2"); - membank("bank1")->set_base(ram + 0x0000); - membank("bank2")->set_base(ram + 0x0000); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x0C : - case 0x0D : - { - // ROM - space.install_read_bank (0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x0000, 0x1fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x2000, 0x3fff, "bank3"); - space.install_write_bank(0x2000, 0x3fff, "bank4"); - membank("bank3")->set_base(ram + 0x2000); - membank("bank4")->set_base(ram + 0x2000); - // Video RAM - space.install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - // RAM - space.install_read_bank (0x8000, 0xfdff, "bank5"); - space.install_write_bank(0x8000, 0xfdff, "bank6"); - membank("bank5")->set_base(ram + 0x8000); - membank("bank6")->set_base(ram + 0x8000); - // Devices - space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // System reg - space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - } - break; - case 0x0E : - { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // Video RAM - space.install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - // RAM - space.install_read_bank (0x8000, 0xfdff, "bank5"); - space.install_write_bank(0x8000, 0xfdff, "bank6"); - membank("bank5")->set_base(ram + 0x8000); - membank("bank6")->set_base(ram + 0x8000); - // Devices - space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // System reg - space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - } - break; - case 0x0F : - { - // RAM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(ram + 0x0000); - membank("bank2")->set_base(ram + 0x0000); - // Video RAM - space.install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - // RAM - space.install_read_bank (0x8000, 0xfdff, "bank3"); - space.install_write_bank(0x8000, 0xfdff, "bank4"); - membank("bank3")->set_base(ram + 0x8000); - membank("bank4")->set_base(ram + 0x8000); - // Devices - space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // System reg - space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - } - break; - case 0x10 : - { - // ROM - space.install_read_bank (0x0000, 0x5fff, "bank1"); - space.install_write_bank(0x0000, 0x5fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x6000, 0xf7ff, "bank3"); - space.install_write_bank(0x6000, 0xf7ff, "bank4"); - membank("bank3")->set_base(ram + 0x6000); - membank("bank4")->set_base(ram + 0x6000); - // Keyboard - space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0xf800, 0xf9ff, "bank5"); - membank("bank5")->set_base(ram + 0xf800); - // System reg - space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); - } - break; - case 0x11 : - { - // ROM - space.install_read_bank (0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x0000, 0x1fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x2000, 0xf7ff, "bank3"); - space.install_write_bank(0x2000, 0xf7ff, "bank4"); - membank("bank3")->set_base(ram + 0x2000); - membank("bank4")->set_base(ram + 0x2000); - // Keyboard - space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0xf800, 0xf9ff, "bank5"); - membank("bank5")->set_base(ram + 0xf800); - // System reg - space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); - } - break; - case 0x12 : - { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x4000, 0xf7ff, "bank3"); - space.install_write_bank(0x4000, 0xf7ff, "bank4"); - membank("bank3")->set_base(ram + 0x4000); - membank("bank4")->set_base(ram + 0x4000); - // Keyboard - space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0xf800, 0xf9ff, "bank5"); - membank("bank5")->set_base(ram + 0xf800); - // System reg - space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); - } - break; - case 0x13 : - { - // RAM - space.install_read_bank (0x0000, 0xf7ff, "bank1"); - space.install_write_bank(0x0000, 0xf7ff, "bank2"); - membank("bank1")->set_base(ram + 0x0000); - membank("bank2")->set_base(ram + 0x0000); - // Keyboard - space.install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),this)); - space.install_write_bank(0xf800, 0xf9ff, "bank3"); - membank("bank3")->set_base(ram + 0xf800); - // System reg - space.install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Devices - space.install_read_handler (0xfb00, 0xfbff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfb00, 0xfbff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // Text Video Memory - space.install_read_handler (0xfc00, 0xffff, read8_delegate(FUNC(pk8020_state::text_r),this)); - space.install_write_handler(0xfc00, 0xffff, write8_delegate(FUNC(pk8020_state::text_w),this)); - } - break; - case 0x14 : - { - // ROM - space.install_read_bank (0x0000, 0x5fff, "bank1"); - space.install_write_bank(0x0000, 0x5fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x6000, 0xfdff, "bank3"); - space.install_write_bank(0x6000, 0xfdff, "bank4"); - membank("bank3")->set_base(ram + 0x6000); - membank("bank4")->set_base(ram + 0x6000); - // Devices - space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // System reg - space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - } - break; - case 0x15 : - { - // ROM - space.install_read_bank (0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x0000, 0x1fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x2000, 0xfdff, "bank3"); - space.install_write_bank(0x2000, 0xfdff, "bank4"); - membank("bank3")->set_base(ram + 0x2000); - membank("bank4")->set_base(ram + 0x2000); - // Devices - space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // System reg - space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - } - break; - case 0x16 : - { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x4000, 0xfdff, "bank3"); - space.install_write_bank(0x4000, 0xfdff, "bank4"); - membank("bank3")->set_base(ram + 0x4000); - membank("bank4")->set_base(ram + 0x4000); - // Devices - space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // System reg - space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - } - break; - case 0x17 : - { - // RAM - space.install_read_bank (0x0000, 0xfdff, "bank1"); - space.install_write_bank(0x0000, 0xfdff, "bank2"); - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram); - // Devices - space.install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),this)); - space.install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),this)); - // System reg - space.install_read_handler (0xff00, 0xffff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - } - break; - case 0x18 : - { - // ROM - space.install_read_bank (0x0000, 0x5fff, "bank1"); - space.install_write_bank(0x0000, 0x5fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x6000, 0xbeff, "bank3"); - space.install_write_bank(0x6000, 0xbeff, "bank4"); - membank("bank3")->set_base(ram + 0x6000); - membank("bank4")->set_base(ram + 0x6000); - // System reg - space.install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x19 : - { - // ROM - space.install_read_bank (0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x0000, 0x1fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x2000, 0xbeff, "bank3"); - space.install_write_bank(0x2000, 0xbeff, "bank4"); - membank("bank3")->set_base(ram + 0x2000); - membank("bank4")->set_base(ram + 0x2000); - // System reg - space.install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x1A : - { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x4000, 0xbeff, "bank3"); - space.install_write_bank(0x4000, 0xbeff, "bank4"); - membank("bank3")->set_base(ram + 0x4000); - membank("bank4")->set_base(ram + 0x4000); - // System reg - space.install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x1B : - { - // RAM - space.install_read_bank (0x0000, 0xbeff, "bank1"); - space.install_write_bank(0x0000, 0xbeff, "bank2"); - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram); - // System reg - space.install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),this)); - space.install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),this)); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x1C : - { - // ROM - space.install_read_bank (0x0000, 0x5fff, "bank1"); - space.install_write_bank(0x0000, 0x5fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x6000, 0xbfff, "bank3"); - space.install_write_bank(0x6000, 0xbfff, "bank4"); - membank("bank3")->set_base(ram + 0x6000); - membank("bank4")->set_base(ram + 0x6000); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x1D : - { - // ROM - space.install_read_bank (0x0000, 0x1fff, "bank1"); - space.install_write_bank(0x0000, 0x1fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x2000, 0xbfff, "bank3"); - space.install_write_bank(0x2000, 0xbfff, "bank4"); - membank("bank3")->set_base(ram + 0x2000); - membank("bank4")->set_base(ram + 0x2000); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x1E : - { - // ROM - space.install_read_bank (0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x0000, 0x3fff, "bank2"); - membank("bank1")->set_base(mem + 0x10000); - membank("bank2")->set_base(ram + 0x0000); - // RAM - space.install_read_bank (0x4000, 0xbfff, "bank3"); - space.install_write_bank(0x4000, 0xbfff, "bank4"); - membank("bank3")->set_base(ram + 0x4000); - membank("bank4")->set_base(ram + 0x4000); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - case 0x1F : - { - // RAM - space.install_read_bank (0x0000, 0xbfff, "bank1"); - space.install_write_bank(0x0000, 0xbfff, "bank2"); - membank("bank1")->set_base(ram); - membank("bank2")->set_base(ram); - // Video RAM - space.install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),this)); - space.install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),this)); - } - break; - - } -} - -READ8_MEMBER(pk8020_state::pk8020_porta_r) -{ - return 0xf0 | (m_takt <<1) | (m_text_attr)<<3; -} - -WRITE8_MEMBER(pk8020_state::pk8020_portc_w) -{ - m_video_page_access =(data>>6) & 3; - m_attr = (data >> 4) & 3; - m_wide = (data >> 3) & 1; - m_font = (data >> 2) & 1; - m_video_page = (data & 3); - - - m_portc_data = data; -} - -WRITE8_MEMBER(pk8020_state::pk8020_portb_w) -{ - floppy_image_device *floppy = NULL; - - // Turn all motors off - if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(1); - if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(1); - if (m_floppy2->get_device()) m_floppy2->get_device()->mon_w(1); - if (m_floppy3->get_device()) m_floppy3->get_device()->mon_w(1); - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - if (BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_wd1793->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(BIT(data, 4)); - } - - // todo: at least bit 5 and bit 7 is connected to something too... -} - -READ8_MEMBER(pk8020_state::pk8020_portc_r) -{ - return m_portc_data; -} - - -WRITE8_MEMBER(pk8020_state::pk8020_2_portc_w) -{ - m_sound_gate = BIT(data,3); - - m_speaker->level_w(m_sound_gate ? m_sound_level : 0); -} - -WRITE_LINE_MEMBER(pk8020_state::pk8020_pit_out0) -{ - m_sound_level = state; - - m_speaker->level_w(m_sound_gate ? m_sound_level : 0); -} - - -WRITE_LINE_MEMBER(pk8020_state::pk8020_pit_out1) -{ -} - - -void pk8020_state::machine_start() -{ - static const char *const keynames[] = { - "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", - "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15" - }; - - for ( int i = 0; i < 16; i++ ) - { - m_io_port[i] = ioport(keynames[i]); - } -} - -void pk8020_state::machine_reset() -{ - pk8020_set_bank(0); - - m_sound_gate = 0; - m_sound_level = 0; -} - -INTERRUPT_GEN_MEMBER(pk8020_state::pk8020_interrupt) -{ - m_takt ^= 1; - m_pic8259->ir4_w(1); -} diff --git a/src/mess/machine/pmd85.c b/src/mess/machine/pmd85.c deleted file mode 100644 index d5435443d26..00000000000 --- a/src/mess/machine/pmd85.c +++ /dev/null @@ -1,838 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/*************************************************************************** - - machine.c - - Functions to emulate general aspects of PMD-85 (RAM, ROM, interrupts, - I/O ports) - - Krzysztof Strzecha - -***************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "includes/pmd85.h" -#include "machine/pit8253.h" - - -enum {PMD85_LED_1, PMD85_LED_2, PMD85_LED_3}; -enum {PMD85_1, PMD85_2, PMD85_2A, PMD85_2B, PMD85_3, ALFA, MATO, C2717}; - - - -void pmd85_state::pmd851_update_memory() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - if (m_startup_mem_map) - { - UINT8 *mem = m_region_maincpu->base(); - - space.unmap_write(0x0000, 0x0fff); - space.nop_write(0x1000, 0x1fff); - space.unmap_write(0x2000, 0x2fff); - space.nop_write(0x3000, 0x3fff); - - space.nop_read(0x1000, 0x1fff); - space.nop_read(0x3000, 0x3fff); - - m_bank1->set_base(mem + 0x010000); - m_bank3->set_base(mem + 0x010000); - m_bank5->set_base(ram + 0xc000); - - m_bank6->set_base(mem + 0x010000); - m_bank7->set_base(mem + 0x010000); - m_bank8->set_base(ram + 0xc000); - } - else - { - space.install_write_bank(0x0000, 0x0fff, "bank1"); - space.install_write_bank(0x1000, 0x1fff, "bank2"); - space.install_write_bank(0x2000, 0x2fff, "bank3"); - space.install_write_bank(0x3000, 0x3fff, "bank4"); - space.install_write_bank(0x4000, 0x7fff, "bank5"); - - space.install_read_bank(0x1000, 0x1fff, "bank2"); - space.install_read_bank(0x3000, 0x3fff, "bank4"); - - m_bank1->set_base(ram); - m_bank2->set_base(ram + 0x1000); - m_bank3->set_base(ram + 0x2000); - m_bank4->set_base(ram + 0x3000); - m_bank5->set_base(ram + 0x4000); - } -} - -void pmd85_state::pmd852a_update_memory() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - if (m_startup_mem_map) - { - UINT8 *mem = m_region_maincpu->base(); - - space.unmap_write(0x0000, 0x0fff); - space.unmap_write(0x2000, 0x2fff); - - m_bank1->set_base(mem + 0x010000); - m_bank2->set_base(ram + 0x9000); - m_bank3->set_base(mem + 0x010000); - m_bank4->set_base(ram + 0xb000); - m_bank5->set_base(ram + 0xc000); - m_bank6->set_base(mem + 0x010000); - m_bank7->set_base(ram + 0x9000); - m_bank8->set_base(mem + 0x010000); - m_bank9->set_base(ram + 0xb000); - m_bank10->set_base(ram + 0xc000); - - } - else - { - space.install_write_bank(0x0000, 0x0fff, "bank1"); - space.install_write_bank(0x2000, 0x2fff, "bank3"); - - m_bank1->set_base(ram); - m_bank2->set_base(ram + 0x1000); - m_bank3->set_base(ram + 0x2000); - m_bank4->set_base(ram + 0x5000); - m_bank5->set_base(ram + 0x4000); - } -} - -void pmd85_state::pmd853_update_memory() -{ - UINT8 *mem = m_region_maincpu->base(); - UINT8 *ram = m_ram->pointer(); - - if (m_startup_mem_map) - { - m_bank1->set_base(mem + 0x010000); - m_bank2->set_base(mem + 0x010000); - m_bank3->set_base(mem + 0x010000); - m_bank4->set_base(mem + 0x010000); - m_bank5->set_base(mem + 0x010000); - m_bank6->set_base(mem + 0x010000); - m_bank7->set_base(mem + 0x010000); - m_bank8->set_base(mem + 0x010000); - m_bank9->set_base(ram); - m_bank10->set_base(ram + 0x2000); - m_bank11->set_base(ram + 0x4000); - m_bank12->set_base(ram + 0x6000); - m_bank13->set_base(ram + 0x8000); - m_bank14->set_base(ram + 0xa000); - m_bank15->set_base(ram + 0xc000); - m_bank16->set_base(ram + 0xe000); - } - else - { - m_bank1->set_base(ram); - m_bank2->set_base(ram + 0x2000); - m_bank3->set_base(ram + 0x4000); - m_bank4->set_base(ram + 0x6000); - m_bank5->set_base(ram + 0x8000); - m_bank6->set_base(ram + 0xa000); - m_bank7->set_base(ram + 0xc000); - m_bank8->set_base(m_pmd853_memory_mapping ? mem + 0x010000 : ram + 0xe000); - } -} - -void pmd85_state::alfa_update_memory() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - if (m_startup_mem_map) - { - UINT8 *mem = m_region_maincpu->base(); - - space.unmap_write(0x0000, 0x0fff); - space.unmap_write(0x1000, 0x33ff); - space.nop_write(0x3400, 0x3fff); - - m_bank1->set_base(mem + 0x010000); - m_bank2->set_base(mem + 0x011000); - m_bank4->set_base(ram + 0xc000); - m_bank5->set_base(mem + 0x010000); - m_bank6->set_base(mem + 0x011000); - m_bank7->set_base(ram + 0xc000); - } - else - { - space.install_write_bank(0x0000, 0x0fff, "bank1"); - space.install_write_bank(0x1000, 0x33ff, "bank2"); - space.install_write_bank(0x3400, 0x3fff, "bank3"); - - m_bank1->set_base(ram); - m_bank2->set_base(ram + 0x1000); - m_bank3->set_base(ram + 0x3400); - m_bank4->set_base(ram + 0x4000); - } -} - -void pmd85_state::mato_update_memory() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - if (m_startup_mem_map) - { - UINT8 *mem = m_region_maincpu->base(); - - space.unmap_write(0x0000, 0x3fff); - - m_bank1->set_base(mem + 0x010000); - m_bank2->set_base(ram + 0xc000); - m_bank3->set_base(mem + 0x010000); - m_bank4->set_base(ram + 0xc000); - } - else - { - space.install_write_bank(0x0000, 0x3fff, "bank1"); - - m_bank1->set_base(ram); - m_bank2->set_base(ram + 0x4000); - } -} - -void pmd85_state::c2717_update_memory() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8 *mem = m_region_maincpu->base(); - UINT8 *ram = m_ram->pointer(); - - if (m_startup_mem_map) - { - space.unmap_write(0x0000, 0x3fff); - - m_bank1->set_base(mem + 0x010000); - m_bank2->set_base(ram + 0x4000); - m_bank3->set_base(mem + 0x010000); - m_bank4->set_base(ram + 0xc000); - } - else - { - space.install_write_bank(0x0000, 0x3fff, "bank1"); - m_bank1->set_base(ram); - m_bank2->set_base(ram + 0x4000); - } -} - -/******************************************************************************* - - Motherboard 8255 (PMD-85.1, PMD-85.2, PMD-85.3, Didaktik Alfa) - -------------------------------------------------------------- - keyboard, speaker, LEDs - -*******************************************************************************/ - -READ8_MEMBER(pmd85_state::pmd85_ppi_0_porta_r) -{ - return 0xff; -} - -READ8_MEMBER(pmd85_state::pmd85_ppi_0_portb_r) -{ - return m_io_port[(m_ppi_port_outputs[0][0] & 0x0f)]->read() & m_io_port[15]->read(); -} - -READ8_MEMBER(pmd85_state::pmd85_ppi_0_portc_r) -{ - return 0xff; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_porta_w) -{ - m_ppi_port_outputs[0][0] = data; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_portb_w) -{ - m_ppi_port_outputs[0][1] = data; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_portc_w) -{ - m_ppi_port_outputs[0][2] = data; - set_led_status(machine(), PMD85_LED_2, (data & 0x08) ? 1 : 0); - set_led_status(machine(), PMD85_LED_3, (data & 0x04) ? 1 : 0); -} - -/******************************************************************************* - - Motherboard 8255 (Mato) - ----------------------- - keyboard, speaker, LEDs, tape - -*******************************************************************************/ - -READ8_MEMBER(pmd85_state::mato_ppi_0_portb_r) -{ - int i; - UINT8 data = 0xff; - - for (i = 0; i < 8; i++) - { - if (!BIT(m_ppi_port_outputs[0][0], i)) - data &= m_io_port[i]->read(); - } - return data; -} - -READ8_MEMBER(pmd85_state::mato_ppi_0_portc_r) -{ - return m_io_port[8]->read() | 0x8f; -} - -WRITE8_MEMBER(pmd85_state::mato_ppi_0_portc_w) -{ - m_ppi_port_outputs[0][2] = data; - set_led_status(machine(), PMD85_LED_2, BIT(data, 3)); - set_led_status(machine(), PMD85_LED_3, BIT(data, 2)); -} - -/******************************************************************************* - - I/O board 8255 - -------------- - GPIO/0 (K3 connector), GPIO/1 (K4 connector) - -*******************************************************************************/ - -READ8_MEMBER(pmd85_state::pmd85_ppi_1_porta_r) -{ - return 0xff; -} - -READ8_MEMBER(pmd85_state::pmd85_ppi_1_portb_r) -{ - return 0xff; -} - -READ8_MEMBER(pmd85_state::pmd85_ppi_1_portc_r) -{ - return 0xff; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_porta_w) -{ - m_ppi_port_outputs[1][0] = data; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_portb_w) -{ - m_ppi_port_outputs[1][1] = data; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_portc_w) -{ - m_ppi_port_outputs[1][2] = data; -} - -/******************************************************************************* - - I/O board 8255 - -------------- - IMS-2 (K5 connector) - - - 8251 - cassette recorder and V.24/IFSS (selectable by switch) - - - external interfaces connector (K2) - -*******************************************************************************/ - -READ8_MEMBER(pmd85_state::pmd85_ppi_2_porta_r) -{ - return 0xff; -} - -READ8_MEMBER(pmd85_state::pmd85_ppi_2_portb_r) -{ - return 0xff; -} - -READ8_MEMBER(pmd85_state::pmd85_ppi_2_portc_r) -{ - return 0xff; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_porta_w) -{ - m_ppi_port_outputs[2][0] = data; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_portb_w) -{ - m_ppi_port_outputs[2][1] = data; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_portc_w) -{ - m_ppi_port_outputs[2][2] = data; -} - -/******************************************************************************* - - I/O board 8251 - -------------- - cassette recorder and V.24/IFSS (selectable by switch) - -*******************************************************************************/ - -/******************************************************************************* - - I/O board external interfaces connector (K2) - -------------------------------------------- - -*******************************************************************************/ - - - -/******************************************************************************* - - ROM Module 8255 - --------------- - port A - data read - ports B, C - address select - -*******************************************************************************/ - -READ8_MEMBER(pmd85_state::pmd85_ppi_3_porta_r) -{ - if (memregion("user1")->base() != NULL) - return memregion("user1")->base()[m_ppi_port_outputs[3][1] | (m_ppi_port_outputs[3][2] << 8)]; - else - return 0; -} - -READ8_MEMBER(pmd85_state::pmd85_ppi_3_portb_r) -{ - return 0xff; -} - -READ8_MEMBER(pmd85_state::pmd85_ppi_3_portc_r) -{ - return 0xff; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_porta_w) -{ - m_ppi_port_outputs[3][0] = data; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_portb_w) -{ - m_ppi_port_outputs[3][1] = data; -} - -WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_portc_w) -{ - m_ppi_port_outputs[3][2] = data; -} - -/******************************************************************************* - - I/O ports (PMD-85.1, PMD-85.2, PMD-85.3, Didaktik Alfa) - ------------------------------------------------------- - - I/O board - 1xxx11aa external interfaces connector (K2) - - 0xxx11aa I/O board interfaces - 000111aa 8251 (casette recorder, V24) - 010011aa 8255 (GPIO/0, GPIO/1) - 010111aa 8253 - 011111aa 8255 (IMS-2) - - Motherboard - 1xxx01aa 8255 (keyboard, speaker, LEDs) - PMD-85.3 memory banking - - ROM Module - 1xxx10aa 8255 (ROM reading) - -*******************************************************************************/ - -READ8_MEMBER(pmd85_state::pmd85_io_r) -{ - if (m_startup_mem_map) - { - return 0xff; - } - - switch (offset & 0x0c) - { - case 0x04: /* Motherboard */ - switch (offset & 0x80) - { - case 0x80: /* Motherboard 8255 */ - return m_ppi8255_0->read(space, offset & 0x03); - } - break; - case 0x08: /* ROM module connector */ - switch (m_model) - { - case PMD85_1: - case PMD85_2: - case PMD85_2A: - case C2717: - case PMD85_3: - if (m_rom_module_present) - { - switch (offset & 0x80) - { - case 0x80: /* ROM module 8255 */ - return m_ppi8255_3->read(space, offset & 0x03); - } - } - break; - } - break; - case 0x0c: /* I/O board */ - switch (offset & 0x80) - { - case 0x00: /* I/O board interfaces */ - switch (offset & 0x70) - { - case 0x10: /* 8251 (casette recorder, V24) */ - switch (offset & 0x01) - { - case 0x00: return m_uart->data_r(space, offset & 0x01); - case 0x01: return m_uart->status_r(space, offset & 0x01); - } - break; - case 0x40: /* 8255 (GPIO/0, GPIO/1) */ - return m_ppi8255_1->read(space, offset & 0x03); - case 0x50: /* 8253 */ - return m_pit8253->read(space, offset & 0x03); - case 0x70: /* 8255 (IMS-2) */ - return m_ppi8255_2->read(space, offset & 0x03); - } - break; - case 0x80: /* external interfaces */ - break; - } - break; - } - - logerror ("Reading from unmapped port: %02x\n", offset); - return 0xff; -} - -WRITE8_MEMBER(pmd85_state::pmd85_io_w) -{ - if (m_startup_mem_map) - { - m_startup_mem_map = 0; - (this->*update_memory)(); - } - - switch (offset & 0x0c) - { - case 0x04: /* Motherboard */ - switch (offset & 0x80) - { - case 0x80: /* Motherboard 8255 */ - m_ppi8255_0->write(space, offset & 0x03, data); - /* PMD-85.3 memory banking */ - if ((offset & 0x03) == 0x03) - { - m_pmd853_memory_mapping = data & 0x01; - (this->*update_memory)(); - } - break; - } - break; - case 0x08: /* ROM module connector */ - switch (m_model) - { - case PMD85_1: - case PMD85_2: - case PMD85_2A: - case C2717: - case PMD85_3: - if (m_rom_module_present) - { - switch (offset & 0x80) - { - case 0x80: /* ROM module 8255 */ - m_ppi8255_3->write(space, offset & 0x03, data); - break; - } - } - break; - } - break; - case 0x0c: /* I/O board */ - switch (offset & 0x80) - { - case 0x00: /* I/O board interfaces */ - switch (offset & 0x70) - { - case 0x10: /* 8251 (casette recorder, V24) */ - switch (offset & 0x01) - { - case 0x00: m_uart->data_w(space, offset & 0x01, data); break; - case 0x01: m_uart->control_w(space, offset & 0x01, data); break; - } - break; - case 0x40: /* 8255 (GPIO/0, GPIO/0) */ - m_ppi8255_1->write(space, offset & 0x03, data); - break; - case 0x50: /* 8253 */ - m_pit8253->write(space, offset & 0x03, data); - logerror ("8253 writing. Address: %02x, Data: %02x\n", offset, data); - break; - case 0x70: /* 8255 (IMS-2) */ - m_ppi8255_2->write(space, offset & 0x03, data); - break; - } - break; - case 0x80: /* external interfaces */ - break; - } - break; - } -} - -/******************************************************************************* - - I/O ports (Mato) - ---------------- - - Motherboard - 1xxx01aa 8255 (keyboard, speaker, LEDs, tape) - -*******************************************************************************/ - -READ8_MEMBER(pmd85_state::mato_io_r) -{ - if (m_startup_mem_map) - { - return 0xff; - } - - switch (offset & 0x0c) - { - case 0x04: /* Motherboard */ - switch (offset & 0x80) - { - case 0x80: /* Motherboard 8255 */ - return m_ppi8255_0->read(space, offset & 0x03); - } - break; - } - - logerror ("Reading from unmapped port: %02x\n", offset); - return 0xff; -} - -WRITE8_MEMBER(pmd85_state::mato_io_w) -{ - if (m_startup_mem_map) - { - m_startup_mem_map = 0; - (this->*update_memory)(); - } - - switch (offset & 0x0c) - { - case 0x04: /* Motherboard */ - switch (offset & 0x80) - { - case 0x80: /* Motherboard 8255 */ - return m_ppi8255_0->write(space, offset & 0x03, data); - } - break; - } -} - -void pmd85_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_CASSETTE: - pmd85_cassette_timer_callback(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in pmd85_state::device_timer"); - } -} - -WRITE_LINE_MEMBER(pmd85_state::write_cas_tx) -{ - m_cas_tx = state; -} - -TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback) -{ - int data; - int current_level; - - if (!(m_io_dsw0->read() & 0x02)) /* V.24 / Tape Switch */ - { - /* tape reading */ - if (m_cassette->get_state()&CASSETTE_PLAY) - { - switch (m_model) - { - case PMD85_1: - if (m_clk_level_tape) - { - m_previous_level = (m_cassette->input() > 0.038) ? 1 : 0; - m_clk_level_tape = 0; - } - else - { - current_level = (m_cassette->input() > 0.038) ? 1 : 0; - - if (m_previous_level!=current_level) - { - data = (!m_previous_level && current_level) ? 1 : 0; - - m_uart->write_rxd(data); - - m_clk_level_tape = 1; - } - } - - m_uart->write_rxc(m_clk_level_tape); - return; - case PMD85_2: - case PMD85_2A: - case C2717: - case PMD85_3: - case ALFA: - /* not hardware data decoding */ - return; - } - } - - /* tape writing */ - if (m_cassette->get_state()&CASSETTE_RECORD) - { - data = m_cas_tx; - data ^= m_clk_level_tape; - m_cassette->output(data&0x01 ? 1 : -1); - - m_clk_level_tape = m_clk_level_tape ? 0 : 1; - m_uart->write_txc(m_clk_level_tape); - - return; - } - - m_clk_level_tape = 1; - - m_clk_level = m_clk_level ? 0 : 1; - m_uart->write_txc(m_clk_level); - } -} - -INPUT_CHANGED_MEMBER(pmd85_state::pmd85_reset) -{ - machine().schedule_soft_reset(); -} - -void pmd85_state::pmd85_common_driver_init() -{ - static const char *const keynames[] = { - "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", - "KEY8", "KEY9", "KEY10", "KEY11", "KEY12", "KEY13", "KEY14", "KEY15" - }; - - for ( int i = 0; i < 16; i++ ) - { - m_io_port[i] = ioport( keynames[i] ); - } - - m_previous_level = 0; - m_clk_level = m_clk_level_tape = 1; - m_cassette_timer = timer_alloc(TIMER_CASSETTE); - m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(2400)); -} - -DRIVER_INIT_MEMBER(pmd85_state,pmd851) -{ - m_model = PMD85_1; - update_memory = &pmd85_state::pmd851_update_memory; - pmd85_common_driver_init(); -} - -DRIVER_INIT_MEMBER(pmd85_state,pmd852a) -{ - m_model = PMD85_2A; - update_memory = &pmd85_state::pmd852a_update_memory; - pmd85_common_driver_init(); -} - -DRIVER_INIT_MEMBER(pmd85_state,pmd853) -{ - m_model = PMD85_3; - update_memory = &pmd85_state::pmd853_update_memory; - pmd85_common_driver_init(); -} - -DRIVER_INIT_MEMBER(pmd85_state,alfa) -{ - m_model = ALFA; - update_memory = &pmd85_state::alfa_update_memory; - pmd85_common_driver_init(); -} - -DRIVER_INIT_MEMBER(pmd85_state,mato) -{ - m_model = MATO; - update_memory = &pmd85_state::mato_update_memory; - - static const char *const keynames[] = { - "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", "KEY8" - }; - - for ( int i = 0; i < 9; i++ ) - { - m_io_port[i] = ioport( keynames[i] ); - } - for ( int i = 9; i < 16; i++ ) - { - m_io_port[i] = NULL; - } -} - -DRIVER_INIT_MEMBER(pmd85_state,c2717) -{ - m_model = C2717; - update_memory = &pmd85_state::c2717_update_memory; - pmd85_common_driver_init(); -} - -void pmd85_state::machine_reset() -{ - int i, j; - - /* checking for Rom Module */ - switch (m_model) - { - case PMD85_1: - case PMD85_2A: - case PMD85_3: - case C2717: - m_rom_module_present = (m_io_dsw0->read() & 0x01) ? 1 : 0; - break; - case ALFA: - case MATO: - break; - } - - for (i = 0; i < 4; i++) - for (j = 0; j < 3; j++) - m_ppi_port_outputs[i][j] = 0; - - /* memory initialization */ - memset(m_ram->pointer(), 0, sizeof(unsigned char)*0x10000); - m_pmd853_memory_mapping = 1; - m_startup_mem_map = 1; - (this->*update_memory)(); -} diff --git a/src/mess/machine/poly88.c b/src/mess/machine/poly88.c deleted file mode 100644 index 47db0168f92..00000000000 --- a/src/mess/machine/poly88.c +++ /dev/null @@ -1,332 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Poly-88 machine by Miodrag Milanovic - - 18/05/2009 Initial implementation - -****************************************************************************/ - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "imagedev/cassette.h" -#include "includes/poly88.h" - - -void poly88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_USART: - poly88_usart_timer_callback(ptr, param); - break; - case TIMER_KEYBOARD: - keyboard_callback(ptr, param); - break; - case TIMER_CASSETTE: - poly88_cassette_timer_callback(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in poly88_state::device_timer"); - } -} - - -TIMER_CALLBACK_MEMBER(poly88_state::poly88_usart_timer_callback) -{ - m_int_vector = 0xe7; - m_maincpu->set_input_line(0, HOLD_LINE); -} - -WRITE8_MEMBER(poly88_state::poly88_baud_rate_w) -{ - logerror("poly88_baud_rate_w %02x\n",data); - m_usart_timer = timer_alloc(TIMER_USART); - m_usart_timer->adjust(attotime::zero, 0, attotime::from_hz(300)); - -} - -UINT8 poly88_state::row_number(UINT8 code) { - if BIT(code,0) return 0; - if BIT(code,1) return 1; - if BIT(code,2) return 2; - if BIT(code,3) return 3; - if BIT(code,4) return 4; - if BIT(code,5) return 5; - if BIT(code,6) return 6; - if BIT(code,7) return 7; - return 0; -} - -TIMER_CALLBACK_MEMBER(poly88_state::keyboard_callback) -{ - int i; - UINT8 code; - UINT8 key_code = 0; - UINT8 shift = m_linec->read() & 0x02 ? 1 : 0; - UINT8 ctrl = m_linec->read() & 0x01 ? 1 : 0; - - for(i = 0; i < 7; i++) - { - switch ( i ) - { - case 0: code = m_line0->read(); break; - case 1: code = m_line1->read(); break; - case 2: code = m_line2->read(); break; - case 3: code = m_line3->read(); break; - case 4: code = m_line4->read(); break; - case 5: code = m_line5->read(); break; - case 6: code = m_line6->read(); break; - default: code = 0; - } - if (code != 0) - { - if (i==0 && shift==0) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - if (i==0 && shift==1) { - key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers - } - if (i==1 && shift==0) { - if (row_number(code) < 4) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i==1 && shift==1) { - if (row_number(code) < 4) { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i>=2 && i<=4 && shift==1 && ctrl==0) { - key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters - } - if (i>=2 && i<=4 && shift==0 && ctrl==0) { - key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters - } - if (i>=2 && i<=4 && ctrl==1) { - key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters - } - if (i==5 && shift==1 && ctrl==0) { - if (row_number(code)<7) { - key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters - } else { - key_code = 0x40 + row_number(code) + (i-2)*8; // for signs it is switched - } - } - if (i==5 && shift==0 && ctrl==0) { - if (row_number(code)<7) { - key_code = 0x40 + row_number(code) + (i-2)*8; // for small letters - } else { - key_code = 0x60 + row_number(code) + (i-2)*8; // for signs it is switched - } - } - if (i==5 && shift==0 && ctrl==1) { - key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl - } - if (i==6) { - switch(row_number(code)) - { - case 0: key_code = 0x11; break; - case 1: key_code = 0x12; break; - case 2: key_code = 0x13; break; - case 3: key_code = 0x14; break; - case 4: key_code = 0x20; break; // Space - case 5: key_code = 0x0D; break; // Enter - case 6: key_code = 0x09; break; // TAB - case 7: key_code = 0x0A; break; // LF - } - } - } - } - if (key_code==0 && m_last_code !=0){ - m_int_vector = 0xef; - m_maincpu->set_input_line(0, HOLD_LINE); - } else { - m_last_code = key_code; - } - - timer_set(attotime::from_hz(24000), TIMER_KEYBOARD); -} - -IRQ_CALLBACK_MEMBER(poly88_state::poly88_irq_callback) -{ - return m_int_vector; -} - -WRITE_LINE_MEMBER(poly88_state::write_cas_tx) -{ - m_cas_tx = state; -} - -TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) -{ - int data; - int current_level; - -// if (!(ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ - //{ - /* tape reading */ - if (m_cassette->get_state()&CASSETTE_PLAY) - { - if (m_clk_level_tape) - { - m_previous_level = (m_cassette->input() > 0.038) ? 1 : 0; - m_clk_level_tape = 0; - } - else - { - current_level = (m_cassette->input() > 0.038) ? 1 : 0; - - if (m_previous_level!=current_level) - { - data = (!m_previous_level && current_level) ? 1 : 0; -//data = current_level; - m_uart->write_rxd(data); - - m_clk_level_tape = 1; - } - } - - m_uart->write_rxc(m_clk_level_tape); - } - - /* tape writing */ - if (m_cassette->get_state()&CASSETTE_RECORD) - { - data = m_cas_tx; - data ^= m_clk_level_tape; - m_cassette->output(data&0x01 ? 1 : -1); - - m_clk_level_tape = m_clk_level_tape ? 0 : 1; - m_uart->write_txc(m_clk_level_tape); - - return; - } - - m_clk_level_tape = 1; - - m_clk_level = m_clk_level ? 0 : 1; - m_uart->write_txc(m_clk_level); -// } -} - - -DRIVER_INIT_MEMBER(poly88_state,poly88) -{ - m_previous_level = 0; - m_clk_level = m_clk_level_tape = 1; - m_cassette_timer = timer_alloc(TIMER_CASSETTE); - m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(600)); - - timer_set(attotime::from_hz(24000), TIMER_KEYBOARD); -} - -void poly88_state::machine_reset() -{ - m_intr = 0; - m_last_code = 0; -} - -INTERRUPT_GEN_MEMBER(poly88_state::poly88_interrupt) -{ - m_int_vector = 0xf7; - device.execute().set_input_line(0, HOLD_LINE); -} - -WRITE_LINE_MEMBER(poly88_state::poly88_usart_rxready) -{ - //drvm_int_vector = 0xe7; - //execute().set_input_line(0, HOLD_LINE); -} - -READ8_MEMBER(poly88_state::poly88_keyboard_r) -{ - UINT8 retVal = m_last_code; - m_maincpu->set_input_line(0, CLEAR_LINE); - m_last_code = 0x00; - return retVal; -} - -WRITE8_MEMBER(poly88_state::poly88_intr_w) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); -} - -SNAPSHOT_LOAD_MEMBER( poly88_state, poly88 ) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8* data= auto_alloc_array(machine(), UINT8, snapshot_size); - UINT16 recordNum; - UINT16 recordLen; - UINT16 address; - UINT8 recordType; - - int pos = 0x300; - char name[9]; - int i = 0; - int theend = 0; - - image.fread( data, snapshot_size); - - while (posset_state_int(I8085_PC, address); - theend = 1; - break; - case 4 : - /* 04 Data ( used by Assembler ) */ - logerror("ASM load unsupported\n"); - theend = 1; - break; - case 5 : - /* 05 BASIC program file */ - logerror("BASIC load unsupported\n"); - theend = 1; - break; - case 6 : - /* 06 End ( used by Assembler? ) */ - theend = 1; - break; - default: break; - } - - if (theend) { - break; - } - pos+=recordLen; - } - machine().device("uart")->reset(); - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/pp01.c b/src/mess/machine/pp01.c deleted file mode 100644 index b171a21d7bd..00000000000 --- a/src/mess/machine/pp01.c +++ /dev/null @@ -1,199 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - PP-01 driver by Miodrag Milanovic - - 08/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "includes/pp01.h" - - -WRITE8_MEMBER(pp01_state::pp01_video_write_mode_w) -{ - m_video_write_mode = data & 0x0f; -} - -void pp01_state::pp01_video_w(UINT8 block,UINT16 offset,UINT8 data,UINT8 part) -{ - UINT16 addroffset = part ? 0x1000 : 0x0000; - UINT8 *ram = m_ram->pointer(); - - if (BIT(m_video_write_mode,3)) { - // Copy mode - if(BIT(m_video_write_mode,0)) { - ram[0x6000+offset+addroffset] = data; - } else { - ram[0x6000+offset+addroffset] = 0; - } - if(BIT(m_video_write_mode,1)) { - ram[0xa000+offset+addroffset] = data; - } else { - ram[0xa000+offset+addroffset] = 0; - } - if(BIT(m_video_write_mode,2)) { - ram[0xe000+offset+addroffset] = data; - } else { - ram[0xe000+offset+addroffset] = 0; - } - } else { - if (block==0) { - ram[0x6000+offset+addroffset] = data; - } - if (block==1) { - ram[0xa000+offset+addroffset] = data; - } - if (block==2) { - ram[0xe000+offset+addroffset] = data; - } - } -} - -WRITE8_MEMBER(pp01_state::pp01_video_r_1_w) -{ - pp01_video_w(0,offset,data,0); -} -WRITE8_MEMBER(pp01_state::pp01_video_g_1_w) -{ - pp01_video_w(1,offset,data,0); -} -WRITE8_MEMBER(pp01_state::pp01_video_b_1_w) -{ - pp01_video_w(2,offset,data,0); -} - -WRITE8_MEMBER(pp01_state::pp01_video_r_2_w) -{ - pp01_video_w(0,offset,data,1); -} -WRITE8_MEMBER(pp01_state::pp01_video_g_2_w) -{ - pp01_video_w(1,offset,data,1); -} -WRITE8_MEMBER(pp01_state::pp01_video_b_2_w) -{ - pp01_video_w(2,offset,data,1); -} - - -void pp01_state::pp01_set_memory(UINT8 block, UINT8 data) -{ - UINT8 *mem = memregion("maincpu")->base(); - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT16 startaddr = block*0x1000; - UINT16 endaddr = ((block+1)*0x1000)-1; - UINT8 blocknum = block + 1; - char bank[10]; - sprintf(bank,"bank%d",blocknum); - if (data>=0xE0 && data<=0xEF) { - // This is RAM - space.install_read_bank (startaddr, endaddr, bank); - switch(data) { - case 0xe6 : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_r_1_w),this)); - break; - case 0xe7 : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_r_2_w),this)); - break; - case 0xea : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_g_1_w),this)); - break; - case 0xeb : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_g_2_w),this)); - break; - case 0xee : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_b_1_w),this)); - break; - case 0xef : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_b_2_w),this)); - break; - - default : - space.install_write_bank(startaddr, endaddr, bank); - break; - } - - membank(bank)->set_base(m_ram->pointer() + (data & 0x0F)* 0x1000); - } else if (data>=0xF8) { - space.install_read_bank (startaddr, endaddr, bank); - space.unmap_write(startaddr, endaddr); - membank(bank)->set_base(mem + ((data & 0x0F)-8)* 0x1000+0x10000); - } else { - logerror("%02x %02x\n",block,data); - space.unmap_readwrite (startaddr, endaddr); - } -} - -void pp01_state::machine_reset() -{ - int i; - memset(m_memory_block,0xff,16); - for(i=0;i<16;i++) { - m_memory_block[i] = 0xff; - pp01_set_memory(i, 0xff); - } -} - -WRITE8_MEMBER(pp01_state::pp01_mem_block_w) -{ - m_memory_block[offset] = data; - pp01_set_memory(offset, data); -} - -READ8_MEMBER(pp01_state::pp01_mem_block_r) -{ - return m_memory_block[offset]; -} - -void pp01_state::machine_start() -{ -} - - -WRITE_LINE_MEMBER(pp01_state::pp01_pit_out0) -{ -} - -WRITE_LINE_MEMBER(pp01_state::pp01_pit_out1) -{ -} - -READ8_MEMBER(pp01_state::pp01_8255_porta_r) -{ - return m_video_scroll; -} -WRITE8_MEMBER(pp01_state::pp01_8255_porta_w) -{ - m_video_scroll = data; -} - -READ8_MEMBER(pp01_state::pp01_8255_portb_r) -{ - static const char *const keynames[] = { - "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", - "LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF" - }; - - return (ioport(keynames[m_key_line])->read() & 0x3F) | (ioport("LINEALL")->read() & 0xC0); -} -WRITE8_MEMBER(pp01_state::pp01_8255_portb_w) -{ - //logerror("pp01_8255_portb_w %02x\n",data); - -} - -WRITE8_MEMBER(pp01_state::pp01_8255_portc_w) -{ - if BIT(data, 4) - m_key_line = data & 0x0f; - else - m_speaker->level_w(BIT(data, 0)); -} - -READ8_MEMBER(pp01_state::pp01_8255_portc_r) -{ - return 0xff; -} diff --git a/src/mess/machine/primo.c b/src/mess/machine/primo.c deleted file mode 100644 index 1295fe14b8d..00000000000 --- a/src/mess/machine/primo.c +++ /dev/null @@ -1,358 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/******************************************************************************* - - primo.c - - Functions to emulate general aspects of Microkey Primo computers - (RAM, ROM, interrupts, I/O ports) - - Krzysztof Strzecha - -*******************************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "includes/primo.h" - -/* Components */ -#include "cpu/z80/z80.h" -#include "bus/cbmiec/cbmiec.h" -#include "sound/speaker.h" - -/* Devices */ -#include "imagedev/cassette.h" -#include "imagedev/snapquik.h" - - - -/******************************************************************************* - - Interrupt callback - -*******************************************************************************/ - -INTERRUPT_GEN_MEMBER(primo_state::primo_vblank_interrupt) -{ - if (m_nmi) - device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -/******************************************************************************* - - Memory banking - -*******************************************************************************/ - -void primo_state::primo_update_memory() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - switch (m_port_FD & 0x03) - { - case 0x00: /* Original ROM */ - space.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000); - break; - case 0x01: /* EPROM extension 1 */ - space.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(m_cart2_rom->base()); - break; - case 0x02: /* RAM */ - space.install_write_bank(0x0000, 0x3fff, "bank1"); - membank("bank1")->set_base(memregion("maincpu")->base()); - break; - case 0x03: /* EPROM extension 2 */ - space.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(m_cart1_rom->base()); - break; - } - logerror ("Memory update: %02x\n", m_port_FD); -} - -/******************************************************************************* - - IO read/write handlers - -*******************************************************************************/ - -READ8_MEMBER(primo_state::primo_be_1_r) -{ - UINT8 data = 0x00; - static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" }; - - // bit 7, 6 - not used - - // bit 5 - VBLANK - data |= (machine().first_screen()->vblank()) ? 0x20 : 0x00; - - // bit 4 - I4 (external bus) - - // bit 3 - I3 (external bus) - - // bit 2 - cassette - data |= (m_cassette->input() < 0.1) ? 0x04 : 0x00; - - // bit 1 - reset button - data |= (ioport("RESET")->read()) ? 0x02 : 0x00; - - // bit 0 - keyboard - data |= (ioport(portnames[(offset & 0x0030) >> 4])->read() >> (offset&0x000f)) & 0x0001 ? 0x01 : 0x00; - - return data; -} - -READ8_MEMBER(primo_state::primo_be_2_r) -{ - UINT8 data = 0xff; - - // bit 7, 6 - not used - - // bit 5 - SCLK - if (!m_iec->clk_r()) - data &= ~0x20; - - // bit 4 - SDATA - if (!m_iec->data_r()) - data &= ~0x10; - - // bit 3 - SRQ - if (!m_iec->srq_r()) - data &= ~0x08; - - // bit 2 - joystic 2 (not implemeted yet) - - // bit 1 - ATN - if (!m_iec->atn_r()) - data &= ~0x02; - - // bit 0 - joystic 1 (not implemeted yet) - - logerror ("IOR BE-2 data:%02x\n", data); - return data; -} - -WRITE8_MEMBER(primo_state::primo_ki_1_w) -{ - // bit 7 - NMI generator enable/disable - m_nmi = (data & 0x80) ? 1 : 0; - - // bit 6 - joystick register shift (not emulated) - - // bit 5 - V.24 (2) / tape control (not emulated) - - // bit 4 - speaker - m_speaker->level_w(BIT(data, 4)); - - // bit 3 - display buffer - if (data & 0x08) - m_video_memory_base |= 0x2000; - else - m_video_memory_base &= 0xdfff; - - // bit 2 - V.24 (1) / tape control (not emulated) - - // bit 1, 0 - cassette output - switch (data & 0x03) - { - case 0: - m_cassette->output(-1.0); - break; - case 1: - case 2: - m_cassette->output(0.0); - break; - case 3: - m_cassette->output(1.0); - break; - } -} - -WRITE8_MEMBER(primo_state::primo_ki_2_w) -{ - // bit 7, 6 - not used - - // bit 5 - SCLK - m_iec->clk_w(!BIT(data, 5)); - - // bit 4 - SDATA - m_iec->data_w(!BIT(data, 4)); - - // bit 3 - not used - - // bit 2 - SRQ - m_iec->srq_w(!BIT(data, 2)); - - // bit 1 - ATN - m_iec->atn_w(!BIT(data, 1)); - - // bit 0 - not used - -// logerror ("IOW KI-2 data:%02x\n", data); -} - -WRITE8_MEMBER(primo_state::primo_FD_w) -{ - if (!ioport("MEMORY_EXPANSION")->read()) - { - m_port_FD = data; - primo_update_memory(); - } -} - -/******************************************************************************* - - Driver initialization - -*******************************************************************************/ - -void primo_state::primo_common_driver_init (primo_state *state) -{ - m_port_FD = 0x00; -} - -DRIVER_INIT_MEMBER(primo_state,primo32) -{ - primo_common_driver_init(this); - m_video_memory_base = 0x6800; -} - -DRIVER_INIT_MEMBER(primo_state,primo48) -{ - primo_common_driver_init(this); - m_video_memory_base = 0xa800; -} - -DRIVER_INIT_MEMBER(primo_state,primo64) -{ - primo_common_driver_init(this); - m_video_memory_base = 0xe800; -} - -/******************************************************************************* - - Machine initialization - -*******************************************************************************/ - -void primo_state::primo_common_machine_init () -{ - if (ioport("MEMORY_EXPANSION")->read()) - m_port_FD = 0x00; - primo_update_memory(); - machine().device("maincpu")->set_clock_scale(ioport("CPU_CLOCK")->read() ? 1.5 : 1.0); -} - -void primo_state::machine_start() -{ - std::string region_tag; - m_cart1_rom = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - m_cart2_rom = memregion(region_tag.assign(m_cart2->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); -} - -void primo_state::machine_reset() -{ - primo_common_machine_init(); -} - -MACHINE_RESET_MEMBER(primo_state,primob) -{ - primo_common_machine_init(); - -//removed cbm_drive_0_config(SERIAL, 8); -//removed cbm_drive_1_config(SERIAL, 9); -} - -/******************************************************************************* - - Snapshot files (.pss) - -*******************************************************************************/ - -void primo_state::primo_setup_pss (UINT8* snapshot_data, UINT32 snapshot_size) -{ - /* Z80 registers */ - m_maincpu->set_state_int(Z80_BC, snapshot_data[4] + snapshot_data[5]*256); - m_maincpu->set_state_int(Z80_DE, snapshot_data[6] + snapshot_data[7]*256); - m_maincpu->set_state_int(Z80_HL, snapshot_data[8] + snapshot_data[9]*256); - m_maincpu->set_state_int(Z80_AF, snapshot_data[10] + snapshot_data[11]*256); - m_maincpu->set_state_int(Z80_BC2, snapshot_data[12] + snapshot_data[13]*256); - m_maincpu->set_state_int(Z80_DE2, snapshot_data[14] + snapshot_data[15]*256); - m_maincpu->set_state_int(Z80_HL2, snapshot_data[16] + snapshot_data[17]*256); - m_maincpu->set_state_int(Z80_AF2, snapshot_data[18] + snapshot_data[19]*256); - m_maincpu->set_state_int(Z80_PC, snapshot_data[20] + snapshot_data[21]*256); - m_maincpu->set_state_int(Z80_SP, snapshot_data[22] + snapshot_data[23]*256); - m_maincpu->set_state_int(Z80_I, snapshot_data[24]); - m_maincpu->set_state_int(Z80_R, snapshot_data[25]); - m_maincpu->set_state_int(Z80_IX, snapshot_data[26] + snapshot_data[27]*256); - m_maincpu->set_state_int(Z80_IY, snapshot_data[28] + snapshot_data[29]*256); - - - /* IO ports */ - - // KI-1 bit 7 - NMI generator enable/disable - m_nmi = (snapshot_data[30] & 0x80) ? 1 : 0; - - // KI-1 bit 4 - speaker - m_speaker->level_w(BIT(snapshot_data[30], 4)); - - - /* memory */ - for (int i = 0; i < 0xc000; i++) - m_maincpu->space(AS_PROGRAM).write_byte(i + 0x4000, snapshot_data[i + 38]); -} - -SNAPSHOT_LOAD_MEMBER( primo_state, primo ) -{ - dynamic_buffer snapshot_data(snapshot_size); - - if (image.fread(&snapshot_data[0], snapshot_size) != snapshot_size) - { - return IMAGE_INIT_FAIL; - } - - if (strncmp((char *)&snapshot_data[0], "PS01", 4)) - { - return IMAGE_INIT_FAIL; - } - - primo_setup_pss(&snapshot_data[0], snapshot_size); - - return IMAGE_INIT_PASS; -} - -/******************************************************************************* - - Quicload files (.pp) - -*******************************************************************************/ - - -void primo_state::primo_setup_pp(UINT8* quickload_data, UINT32 quickload_size) -{ - UINT16 load_addr; - UINT16 start_addr; - - load_addr = quickload_data[0] + quickload_data[1]*256; - start_addr = quickload_data[2] + quickload_data[3]*256; - - for (int i = 4; i < quickload_size; i++) - m_maincpu->space(AS_PROGRAM).write_byte(start_addr+i-4, quickload_data[i]); - - m_maincpu->set_state_int(Z80_PC, start_addr); - - logerror ("Quickload .pp l: %04x r: %04x s: %04x\n", load_addr, start_addr, quickload_size-4); -} - -QUICKLOAD_LOAD_MEMBER( primo_state, primo ) -{ - dynamic_buffer quickload_data(quickload_size); - - if (image.fread(&quickload_data[0], quickload_size) != quickload_size) - { - return IMAGE_INIT_FAIL; - } - - primo_setup_pp(&quickload_data[0], quickload_size); - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/prof80mmu.c b/src/mess/machine/prof80mmu.c deleted file mode 100644 index ebdccf33004..00000000000 --- a/src/mess/machine/prof80mmu.c +++ /dev/null @@ -1,127 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Conitec PROF-80 Memory Management Unit emulation - -**********************************************************************/ - -#include "prof80mmu.h" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type PROF80_MMU = &device_creator; - - -DEVICE_ADDRESS_MAP_START( z80_program_map, 8, prof80_mmu_device ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(program_r, program_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( program_map, AS_PROGRAM, 8, prof80_mmu_device ) -ADDRESS_MAP_END - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// prof80_mmu_device - constructor -//------------------------------------------------- - -prof80_mmu_device::prof80_mmu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PROF80_MMU, "PROF80_MMU", tag, owner, clock, "prof80_mmu", __FILE__), - device_memory_interface(mconfig, *this), - m_program_space_config("program", ENDIANNESS_LITTLE, 8, 20, 0, *ADDRESS_MAP_NAME(program_map)) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void prof80_mmu_device::device_start() -{ - // state saving - save_item(NAME(m_blk)); - save_item(NAME(m_enabled)); -} - - -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *prof80_mmu_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == AS_PROGRAM) ? &m_program_space_config : NULL; -} - - -//------------------------------------------------- -// par_w - -//------------------------------------------------- - -WRITE8_MEMBER( prof80_mmu_device::par_w ) -{ - int bank = offset >> 12; - - m_blk[bank] = (data & 0x0f) ^ 0x0f; -} - - -//------------------------------------------------- -// mme_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( prof80_mmu_device::mme_w ) -{ - m_enabled = (state == 1); -} - - -//------------------------------------------------- -// program_r - program space read -//------------------------------------------------- - -READ8_MEMBER( prof80_mmu_device::program_r ) -{ - if (m_enabled) - { - int bank = offset >> 12; - offset |= m_blk[bank] << 16; - } - else - { - offset |= 0xf0000; - } - - return this->space(AS_PROGRAM).read_byte(offset); -} - - -//------------------------------------------------- -// program_w - program space write -//------------------------------------------------- - -WRITE8_MEMBER( prof80_mmu_device::program_w ) -{ - if (m_enabled) - { - int bank = offset >> 12; - offset |= m_blk[bank] << 16; - } - else - { - offset |= 0xf0000; - } - - this->space(AS_PROGRAM).write_byte(offset, data); -} diff --git a/src/mess/machine/prof80mmu.h b/src/mess/machine/prof80mmu.h deleted file mode 100644 index 89e64f72579..00000000000 --- a/src/mess/machine/prof80mmu.h +++ /dev/null @@ -1,68 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Conitec PROF-80 Memory Management Unit emulation - -**********************************************************************/ - -#pragma once - -#ifndef __PROF80_MMU__ -#define __PROF80_MMU__ - -#include "emu.h" - - - -///************************************************************************* -// INTERFACE CONFIGURATION MACROS -///************************************************************************* - -#define MCFG_PROF80_MMU_ADD(_tag, _program_map) \ - MCFG_DEVICE_ADD(_tag, PROF80_MMU, 0) \ - MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _program_map) - - - -///************************************************************************* -// TYPE DEFINITIONS -///************************************************************************* - -// ======================> prof80_mmu_device - -class prof80_mmu_device : public device_t, - public device_memory_interface -{ -public: - prof80_mmu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual DECLARE_ADDRESS_MAP(z80_program_map, 8); - - DECLARE_WRITE8_MEMBER( par_w ); - DECLARE_WRITE_LINE_MEMBER( mme_w ); - -protected: - // device-level overrides - virtual void device_start(); - - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; - - DECLARE_READ8_MEMBER( program_r ); - DECLARE_WRITE8_MEMBER( program_w ); - -private: - const address_space_config m_program_space_config; - - UINT8 m_blk[16]; - bool m_enabled; -}; - - -// device type definition -extern const device_type PROF80_MMU; - - - -#endif diff --git a/src/mess/machine/psion_pack.c b/src/mess/machine/psion_pack.c deleted file mode 100644 index 98f26eb5673..00000000000 --- a/src/mess/machine/psion_pack.c +++ /dev/null @@ -1,323 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/**************************************************************************** - - psion_pack.c - - Psion Organiser II Datapack emulation - - - Datapack pinout from Psion's documentation - __ __ - SD1 1 | \/ | 2 SD0 - SD3 3 | | 4 SD2 - SD5 5 | | 6 SD4 - SD7 7 | | 8 SD6 - SMR 9 | | 10 SCLK - SOE_B 11 | | 12 SS_B - GND 13 | | 14 SPGM_B - SVCC 15 |______| 16 SVPP - -****************************************************************************/ - -#include "emu.h" -#include "psion_pack.h" - -// Datapack control lines -#define DP_LINE_CLOCK 0x01 -#define DP_LINE_RESET 0x02 -#define DP_LINE_PROGRAM 0x04 -#define DP_LINE_OUTPUT_ENABLE 0x08 -#define DP_LINE_SLOT_SELECT 0x10 - -// Datapack ID -#define DP_ID_EPROM 0x02 -#define DP_ID_PAGED 0x04 -#define DP_ID_WRITE 0x08 -#define DP_ID_BOOT 0x10 -#define DP_ID_COPY 0x20 - -#define OPK_HEAD_SIZE 6 - - -static OPTION_GUIDE_START( datapack_option_guide ) - OPTION_INT('S', "size", "Datapack size" ) - OPTION_INT('R', "ram", "RAM/EPROM" ) - OPTION_INT('P', "paged", "Paged" ) - OPTION_INT('W', "protect", "Write-protected" ) - OPTION_INT('B', "boot", "Bootable" ) - OPTION_INT('C', "copy", "Copyable" ) -OPTION_GUIDE_END - -static const char *datapack_option_spec = - "S1/2/4/[8]/16;R0/[1];P[0]/1;W[0]/1;B[0]/1;C0/[1]"; - - -// device type definition -const device_type PSION_DATAPACK = &device_creator; - -//------------------------------------------------- -// datapack_device - constructor -//------------------------------------------------- - -datapack_device::datapack_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PSION_DATAPACK, "Psion Datapack", tag, owner, clock, "datapack", __FILE__), - device_image_interface(mconfig, *this) -{ -} - - -//------------------------------------------------- -// datapack_device - destructor -//------------------------------------------------- - -datapack_device::~datapack_device() -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void datapack_device::device_start() -{ - call_unload(); -} - - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void datapack_device::device_config_complete() -{ - m_formatlist.append(*global_alloc(image_device_format("opk", "Psion Datapack image", "opk", datapack_option_spec))); - - // set brief and instance name - update_names(); -} - - -//------------------------------------------------- -// option_guide for create new image -//------------------------------------------------- - -const option_guide *datapack_device::create_option_guide() const -{ - return datapack_option_guide; -} - - -/*------------------------------------------------- - update the internal state --------------------------------------------------*/ - -void datapack_device::update() -{ - UINT32 pack_addr = m_counter + ((m_id & DP_ID_PAGED) ? (m_page << 8) : 0); - - // if the datapack is 128k or more is treated as segmented - if (m_size >= 0x10) - pack_addr += (m_segment << 14); - - if (pack_addr < (m_size << 13)) - { - if ((m_control & DP_LINE_OUTPUT_ENABLE) && !(m_control & DP_LINE_RESET)) - { - // write data - if (software_entry() == NULL && (m_id & DP_ID_WRITE)) - { - fseek(pack_addr + OPK_HEAD_SIZE, SEEK_SET); - fwrite(&m_data, 1); - } - } - else if ((m_control & DP_LINE_OUTPUT_ENABLE) && (m_control & DP_LINE_RESET)) - { - // write datapack segment - if (m_size <= 0x10) - m_segment = m_data & 0x07; - else if (m_size <= 0x20) - m_segment = m_data & 0x0f; - else if (m_size <= 0x40) - m_segment = m_data & 0x1f; - else if (m_size <= 0x80) - m_segment = m_data & 0x3f; - else - m_segment = m_data; - } - else if (!(m_control & DP_LINE_OUTPUT_ENABLE) && !(m_control & DP_LINE_RESET)) - { - // read data - if ((pack_addr + OPK_HEAD_SIZE) < length()) - { - fseek(pack_addr + OPK_HEAD_SIZE, SEEK_SET); - fread(&m_data, 1); - } - else - { - m_data = 0xff; - } - } - else if (!(m_control & DP_LINE_OUTPUT_ENABLE) && (m_control & DP_LINE_RESET)) - { - // read datapack ID - if (m_id & DP_ID_EPROM) - m_data = m_id; - else - m_data = 0x01; // for identify RAM pack - } - } -} - - -/*------------------------------------------------- - read datapack data lines --------------------------------------------------*/ - -UINT8 datapack_device::data_r() -{ - return (!(m_control & DP_LINE_SLOT_SELECT)) ? m_data : 0; -} - - -/*------------------------------------------------- - write datapack data lines --------------------------------------------------*/ - -void datapack_device::data_w(UINT8 data) -{ - if (is_loaded()) - { - m_data = data; - - // updates the internal state - if (!(data & DP_LINE_SLOT_SELECT)) - update(); - } -} - - -/*------------------------------------------------- - read datapack control lines --------------------------------------------------*/ - -UINT8 datapack_device::control_r() -{ - return m_control; -} - - -/*------------------------------------------------- - write datapack control lines --------------------------------------------------*/ - -void datapack_device::control_w(UINT8 data) -{ - if (is_loaded()) - { - if ((m_control & DP_LINE_CLOCK) != (data & DP_LINE_CLOCK)) - { - // increments the counter - m_counter++; - - if (m_counter >= ((m_id & DP_ID_PAGED) ? 0x100 : (m_size << 13))) - m_counter = 0; - } - - if ((m_control & DP_LINE_PROGRAM) && !(data & DP_LINE_PROGRAM)) - { - // increments the page - m_page++; - - if (m_page >= (m_size << 5)) - m_page = 0; - } - - if (data & DP_LINE_RESET) - { - // reset counter and page - m_counter = 0; - m_page = 0; - } - - m_control = data; - - // updates the internal state - if (!(data & DP_LINE_SLOT_SELECT)) - update(); - } -} - - -/*------------------------------------------------- - DEVICE_IMAGE_LOAD( datapack ) --------------------------------------------------*/ - -bool datapack_device::call_load() -{ - UINT8 data[0x10]; - - fread(data, 0x10); - - // check the OPK head - if(strncmp((const char*)data, "OPK", 3)) - return IMAGE_INIT_FAIL; - - // get datapack ID and size - m_id = data[OPK_HEAD_SIZE + 0]; - m_size = data[OPK_HEAD_SIZE + 1]; - - return IMAGE_INIT_PASS; -} - - -/*------------------------------------------------- - DEVICE_IMAGE_CREATE( datapack ) --------------------------------------------------*/ - -bool datapack_device::call_create(int format_type, option_resolution *create_args) -{ - static const UINT8 opk_head[6] = {'O', 'P', 'K', 0x00, 0x00, 0x00}; - - if (create_args != NULL) - { - m_id = 0x40; - m_id |= (option_resolution_lookup_int(create_args, 'R')) ? 0x00 : 0x02; - m_id |= (option_resolution_lookup_int(create_args, 'P')) ? 0x04 : 0x00; - m_id |= (option_resolution_lookup_int(create_args, 'W')) ? 0x00 : 0x08; - m_id |= (option_resolution_lookup_int(create_args, 'B')) ? 0x00 : 0x10; - m_id |= (option_resolution_lookup_int(create_args, 'C')) ? 0x20 : 0x00; - m_size = option_resolution_lookup_int(create_args, 'S'); - } - else - { - // 64k RAM datapack by default - m_id = 0x7c; - m_size = 0x08; - } - - fwrite(opk_head, 6); - fwrite(&m_id, 1); - fwrite(&m_size, 1); - - return IMAGE_INIT_PASS; -} - - -/*------------------------------------------------- - DEVICE_IMAGE_UNLOAD( datapack ) --------------------------------------------------*/ - -void datapack_device::call_unload() -{ - m_id = 0; - m_size = 0; - m_counter = 0; - m_page = 0; - m_segment = 0; - m_control = 0; - m_data = 0; -} diff --git a/src/mess/machine/psion_pack.h b/src/mess/machine/psion_pack.h deleted file mode 100644 index 47ff33d8383..00000000000 --- a/src/mess/machine/psion_pack.h +++ /dev/null @@ -1,79 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/**************************************************************************** - - psion_pack.h - -****************************************************************************/ - -#ifndef __PSION_PACK_H__ -#define __PSION_PACK_H__ - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -// ======================> datapack_device - -class datapack_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - datapack_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ~datapack_device(); - - // image-level overrides - virtual bool call_load(); - virtual void call_unload(); - virtual bool call_create(int format_type, option_resolution *create_args); - virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); } - - virtual iodevice_t image_type() const { return IO_CARTSLOT; } - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return "psion_pack"; } - virtual const char *file_extensions() const { return "opk"; } - virtual const option_guide *create_option_guide() const; - - // specific implementation - UINT8 data_r(); - void data_w(UINT8 data); - UINT8 control_r(); - void control_w(UINT8 data); - -protected: - // internal helper - void update(); - - // device-level overrides - virtual void device_start(); - virtual void device_config_complete(); - -private: - // internal device state - UINT8 m_id; //datapack ID - UINT8 m_size; //size in 8k blocks - UINT8 m_data; //data lines - UINT8 m_control; //control lines - UINT16 m_counter; //address counter - UINT8 m_page; //active page (only for paged Datapack) - UINT8 m_segment; //active segment (only for segmented Datapack) -}; - - -// device type definition -extern const device_type PSION_DATAPACK; - - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_PSION_DATAPACK_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, PSION_DATAPACK, 0) -#endif /* __PSION_PACK_H__ */ diff --git a/src/mess/machine/psxcd.c b/src/mess/machine/psxcd.c deleted file mode 100644 index 6bcf6f04e6a..00000000000 --- a/src/mess/machine/psxcd.c +++ /dev/null @@ -1,1234 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:smf,R. Belmont,pSXAuthor,Carl -#include "emu.h" -#include "psxcd.h" -#include "debugger.h" - -#define VERBOSE_LEVEL ( 0 ) - -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine& machine, int n_level, const char *s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%s: %s", machine.describe_context(), buf ); - } -} - -enum cdrom_events -{ - event_cmd_complete=0, - event_read_sector, - event_play_sector, - event_change_disk -}; - -enum intr_status -{ - intr_nointr=0, - intr_dataready, - intr_acknowledge, - intr_complete, - intr_dataend, - intr_diskerror -}; - -enum mode_flags -{ - mode_double_speed=0x80, - mode_adpcm=0x40, - mode_size=0x20, - mode_size2=0x10, - mode_size_mask=0x30, - mode_channel=0x08, - mode_report=0x04, - mode_autopause=0x02, - mode_cdda=0x01 -}; - -enum status_f -{ - status_playing=0x80, - status_seeking=0x40, - status_reading=0x20, - status_shellopen=0x10, - status_invalid=0x08, - status_seekerror=0x04, - status_standby=0x02, - status_error=0x01 -}; - -struct subheader -{ - UINT8 file, channel, submode, coding; -}; - -enum submode_flags -{ - submode_eof=0x80, - submode_realtime=0x40, - submode_form=0x20, - submode_trigger=0x10, - submode_data=0x08, - submode_audio=0x04, - submode_video=0x02, - submode_eor=0x01 -}; - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type PSXCD = &device_creator; - -psxcd_device::psxcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - cdrom_image_device(mconfig, PSXCD, "PSX Cdrom", tag, owner, clock, "psx_cd", __FILE__), - m_irq_handler(*this) -{ - static_set_interface(*this, "psx_cdrom"); -} - - -void psxcd_device::device_start() -{ - cdrom_image_device::device_start(); - m_irq_handler.resolve_safe(); - - m_maincpu = machine().device("maincpu"); - m_spu = machine().device("spu"); - - unsigned int sysclk=m_maincpu->clock()/2; - start_read_delay=(sysclk/60); - read_sector_cycles=(sysclk/75); - preread_delay=(read_sector_cycles>>2)-500; - - m_sysclock = sysclk; - - res_queue = NULL; - rdp = 0; - status=status_shellopen; - mode=0; - - for (int i = 0; i < MAX_PSXCD_TIMERS; i++) - { - m_timers[i] = timer_alloc(i); - m_timerinuse[i] = false; - } - - save_item(NAME(cmdbuf)); - save_item(NAME(mode)); - save_item(NAME(secbuf)); - save_item(NAME(filter_file)); - save_item(NAME(filter_channel)); - save_item(NAME(lastsechdr)); - save_item(NAME(status)); - save_item(NAME(rdp)); - save_item(NAME(m_cursec)); - save_item(NAME(sectail)); - save_item(NAME(m_transcurr)); - save_item(NAME(m_transbuf)); - save_item(NAME(loc.w)); - save_item(NAME(curpos.w)); - save_item(NAME(open)); - save_item(NAME(m_mute)); - save_item(NAME(m_dmaload)); - save_item(NAME(next_read_event)); - save_item(NAME(next_sector_t)); - save_item(NAME(autopause_sector)); - save_item(NAME(m_param_count)); -} - -void psxcd_device::device_stop() -{ - for (int i = 0; i < MAX_PSXCD_TIMERS; i++) - { - if(m_timerinuse[i] && m_timers[i]->ptr()) - global_free((command_result *)m_timers[i]->ptr()); - } - while(res_queue) - { - command_result *res = res_queue->next; - global_free(res_queue); - res_queue = res; - } -} - -void psxcd_device::device_reset() -{ - next_read_event = -1; - stop_read(); - - for (int i = 0; i < MAX_PSXCD_TIMERS; i++) - { - if(m_timerinuse[i] && m_timers[i]->ptr()) - global_free((command_result *)m_timers[i]->ptr()); - m_timers[i]->adjust(attotime::never, 0, attotime::never); - m_timerinuse[i] = false; - } - open = true; - if(m_cdrom_handle) - add_system_event(event_change_disk, m_sysclock, NULL); - - while(res_queue) - { - command_result *res = res_queue->next; - global_free(res_queue); - res_queue = res; - } - - m_param_count = 0; - m_regs.sr = 0x18; - m_regs.ir = 0; - m_regs.imr = 0x1f; - sectail = 0; - m_cursec = 0; - m_mute = false; - m_dmaload = false; - m_int1 = NULL; - curpos.w = 0; -} - -bool psxcd_device::call_load() -{ - bool ret = cdrom_image_device::call_load(); - open = true; - if(ret == IMAGE_INIT_PASS) - add_system_event(event_change_disk, m_sysclock, NULL); // 1 sec to spin up the disk - return ret; -} - -void psxcd_device::call_unload() -{ - stop_read(); - cdrom_image_device::call_unload(); - open = true; - status = status_shellopen; - send_result(intr_diskerror); -} - -READ8_MEMBER( psxcd_device::read ) -{ - UINT8 ret = 0; - switch (offset & 3) - { - /* - x--- ---- command/parameter busy flag - -x-- ---- data fifo full (active low) - --x- ---- response fifo empty (active low) - ---x ---- parameter fifo full (active low) - ---- x--- parameter fifo empty (active high) - ---- --xx cmd mode - */ - case 0: - ret = m_regs.sr; - break; - - case 1: - if ((res_queue) && (rdp < res_queue->sz)) - { - ret = res_queue->data[rdp++]; - if(rdp == res_queue->sz) - m_regs.sr &= ~0x20; - else - m_regs.sr |= 0x20; - } - else - ret = 0; - break; - - case 2: - if(!m_dmaload) - ret = 0; - else - { - ret = m_transbuf[m_transcurr++]; - if(m_transcurr >= raw_sector_size) - { - m_dmaload = false; - m_regs.sr &= ~0x40; - } - } - break; - - case 3: - if(m_regs.sr & 1) - ret = m_regs.ir | 0xe0; - else - ret = m_regs.imr | 0xe0; - break; - } - - verboselog(machine(), 2, "psxcd: read byte %08x = %02x\n",offset,ret); - - return ret; -} - -WRITE8_MEMBER( psxcd_device::write ) -{ - verboselog(machine(), 2, "psxcd: write byte %08x = %02x\n",offset,data); - - switch ((offset & 3) | ((m_regs.sr & 3) << 4)) - { - case 0x00: - case 0x10: - case 0x20: - case 0x30: - m_regs.sr = (m_regs.sr & ~3) | (data & 3); - break; - - case 0x01: - write_command(data); - break; - - case 0x11: - case 0x21: - break; - - case 0x31: - m_regs.vol.rr = data; - break; - - case 0x02: - cmdbuf[m_param_count] = data; - m_param_count++; - break; - - case 0x12: - m_regs.imr = data & 0x1f; - break; - - case 0x22: - m_regs.vol.ll = data; - break; - - case 0x32: - m_regs.vol.rl = data; - break; - /* - x--- ---- unknown - -x-- ---- Reset parameter FIFO - --x- ---- unknown (used on transitions, so it certainly resets something) - ---x ---- Command start - ---- -xxx Response received - */ - case 0x03: - if((data & 0x80) && !m_dmaload) - { - m_dmaload = true; - memcpy(m_transbuf, secbuf[m_cursec], raw_sector_size); - m_regs.sr |= 0x40; - - m_cursec++; - m_cursec %= sector_buffer_size; - - switch(mode & mode_size_mask) - { - case 0x00: - default: - m_transcurr = 24; - break; - case 0x10: - m_transcurr = 24; - break; - case 0x20: - m_transcurr = 12; - break; - } -#if (VERBOSE_LEVEL > 0) - char str[1024]; - for (int i=0; i<12; i++) - sprintf(&str[i*4], "%02x ", m_transbuf[i+12]); - verboselog(machine(), 1, "psxcd: request data=%s\n",str); -#endif - } - else if(!(data & 0x80)) - { - m_dmaload = false; - m_regs.sr &= ~0x40; - } - break; - - case 0x13: - if(data & 0x1f) - { - m_regs.ir &= ~(data & 0x1f); - - if(res_queue && !m_regs.ir) - { - command_result *res = res_queue; - if(res == m_int1) - m_int1 = NULL; - - res_queue = res->next; - global_free(res); - m_regs.sr &= ~0x20; - rdp = 0; - if(res_queue) - { - m_regs.sr |= 0x20; - m_regs.ir = res_queue->res; - } - verboselog(machine(), 1, "psxcd: nextres\n"); - } - } - if(data & 0x40) - m_param_count = 0; - break; - - case 0x23: - m_regs.vol.lr = data; - break; - - case 0x33: - break; - } -} - -const psxcd_device::cdcmd psxcd_device::cmd_table[]= -{ - &psxcd_device::cdcmd_sync, - &psxcd_device::cdcmd_nop, - &psxcd_device::cdcmd_setloc, - &psxcd_device::cdcmd_play, - &psxcd_device::cdcmd_forward, - &psxcd_device::cdcmd_backward, - &psxcd_device::cdcmd_readn, - &psxcd_device::cdcmd_standby, - &psxcd_device::cdcmd_stop, - &psxcd_device::cdcmd_pause, - &psxcd_device::cdcmd_init, - &psxcd_device::cdcmd_mute, - &psxcd_device::cdcmd_demute, - &psxcd_device::cdcmd_setfilter, - &psxcd_device::cdcmd_setmode, - &psxcd_device::cdcmd_getparam, - &psxcd_device::cdcmd_getlocl, - &psxcd_device::cdcmd_getlocp, - &psxcd_device::cdcmd_unknown12, - &psxcd_device::cdcmd_gettn, - &psxcd_device::cdcmd_gettd, - &psxcd_device::cdcmd_seekl, - &psxcd_device::cdcmd_seekp, - &psxcd_device::cdcmd_illegal17, - &psxcd_device::cdcmd_illegal18, - &psxcd_device::cdcmd_test, - &psxcd_device::cdcmd_id, - &psxcd_device::cdcmd_reads, - &psxcd_device::cdcmd_reset, - &psxcd_device::cdcmd_illegal1d, - &psxcd_device::cdcmd_readtoc -}; - -void psxcd_device::write_command(UINT8 byte) -{ - if(byte > 31) - illegalcmd(byte); - else - (this->*cmd_table[byte])(); - m_param_count = 0; -} - -void psxcd_device::cdcmd_sync() -{ - verboselog(machine(), 1, "psxcd: sync\n"); - - stop_read(); - send_result(intr_acknowledge); -} - -void psxcd_device::cdcmd_nop() -{ - verboselog(machine(), 1, "psxcd: nop\n"); - - if (!open) - status &= ~status_shellopen; - - send_result(intr_complete); -} - -void psxcd_device::cdcmd_setloc() -{ - verboselog(machine(), 1, "psxcd: setloc %08x:%08x:%08x\n", cmdbuf[0], cmdbuf[1], cmdbuf[2]); - - stop_read(); - - - CDPOS l; - l.b[M]=bcd_to_decimal(cmdbuf[0]); - l.b[S]=bcd_to_decimal(cmdbuf[1]); - l.b[F]=bcd_to_decimal(cmdbuf[2]); - - if ((l.b[M]>0) || (l.b[S]>=2)) - loc.w=l.w; - else - verboselog(machine(), 0, "psxcd: setloc out of range: %02d:%02d:%02d\n",l.b[M],l.b[S],l.b[F]); - - send_result(intr_complete); -} - -void psxcd_device::cdcmd_play() -{ - if(cmdbuf[0] && m_param_count) - loc.w = lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, bcd_to_decimal(cmdbuf[0]) - 1)); - - curpos.w = loc.w; - if (!curpos.w) - curpos.b[S] = 2; - - verboselog(machine(), 1, "psxcd: play %02x %02x %02x => %d\n", decimal_to_bcd(loc.b[M]), decimal_to_bcd(loc.b[S]), decimal_to_bcd(loc.b[F]), msf_to_lba_ps(loc.w)); - - stop_read(); - start_play(); - send_result(intr_complete); -} - -void psxcd_device::cdcmd_forward() -{ - verboselog(machine(), 1, "psxcd: forward\n"); -} - -void psxcd_device::cdcmd_backward() -{ - verboselog(machine(), 1, "psxcd: backward\n"); -} - -void psxcd_device::cdcmd_readn() -{ - if(!open) - { - verboselog(machine(), 1, "psxcd: readn\n"); - - curpos.w=loc.w; - - stop_read(); - start_read(); - } else - { - send_result(intr_diskerror, NULL, 0, 0x80); - } -} - -void psxcd_device::cdcmd_standby() -{ - verboselog(machine(), 1, "psxcd: standby\n"); - - stop_read(); - send_result(intr_acknowledge); -} - -void psxcd_device::cdcmd_stop() -{ - verboselog(machine(), 1, "psxcd: stop\n"); - - stop_read(); - send_result(intr_acknowledge); -} - -void psxcd_device::cdcmd_pause() -{ - verboselog(machine(), 1, "psxcd: pause\n"); - - stop_read(); - - send_result(intr_acknowledge); -} - -void psxcd_device::cdcmd_init() -{ - verboselog(machine(), 1, "psxcd: init\n"); - - stop_read(); - mode=0; - m_regs.sr |= 0x10; - - send_result(intr_acknowledge); -} - -void psxcd_device::cdcmd_mute() -{ - verboselog(machine(), 1, "psxcd: mute\n"); - - m_mute = true; - send_result(intr_complete); -} - -void psxcd_device::cdcmd_demute() -{ - verboselog(machine(), 1, "psxcd: demute\n"); - - m_mute = false; - send_result(intr_complete); -} - -void psxcd_device::cdcmd_setfilter() -{ - verboselog(machine(), 1, "psxcd: setfilter %08x,%08x\n",cmdbuf[0],cmdbuf[1]); - - filter_file=cmdbuf[0]; - filter_channel=cmdbuf[1]; - - send_result(intr_acknowledge); -} - -void psxcd_device::cdcmd_setmode() -{ - verboselog(machine(), 1, "psxcd: setmode %08x\n",cmdbuf[0]); - - mode=cmdbuf[0]; - send_result(intr_complete); -} - -void psxcd_device::cdcmd_getparam() -{ - unsigned char data[6]= - { - status, - mode, - filter_file, - filter_channel, - 0, - 0 - }; - - verboselog(machine(), 1, "psxcd: getparam [%02x %02x %02x %02x %02x %02x]\n", - data[0], data[1], data[2], data[3], data[4], data[5]); - - send_result(intr_complete,data,6); -} - -UINT32 psxcd_device::sub_loc(CDPOS src1, CDPOS src2) -{ - CDPOS dst; - int f=src1.b[F]-src2.b[F], - s=src1.b[S]-src2.b[S], - m=src1.b[M]-src2.b[M]; - while (f<0) { s--; f+=75; } - while (s<0) { m--; s+=60; } - - if (m<0) - m=s=f=0; - - dst.b[M]=m; - dst.b[S]=s; - dst.b[F]=f; - - return dst.w; -} - -void psxcd_device::cdcmd_getlocl() -{ - verboselog(machine(), 1, "psxcd: getlocl [%02x %02x %02x %02x %02x %02x %02x %02x]\n", - lastsechdr[0], lastsechdr[1], lastsechdr[2], lastsechdr[3], - lastsechdr[4], lastsechdr[5], lastsechdr[6], lastsechdr[7]); - - send_result(intr_complete,lastsechdr,8); -} - -void psxcd_device::cdcmd_getlocp() -{ - CDPOS tloc, start; - UINT8 track = cdrom_get_track(m_cdrom_handle, msf_to_lba_ps(loc.w)) + 1; - start.w = (track == 1) ? 0x000200 : lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, track - 1)); - tloc.w = sub_loc(loc, start); - - unsigned char data[8]= - { - decimal_to_bcd(track), // track - 0x01, // index - decimal_to_bcd(tloc.b[M]), // min - decimal_to_bcd(tloc.b[S]), // sec - decimal_to_bcd(tloc.b[F]), // frame - decimal_to_bcd(loc.b[M]), // amin - decimal_to_bcd(loc.b[S]), // asec - decimal_to_bcd(loc.b[F]) // aframe - }; - - verboselog(machine(), 1, "psxcd: getlocp [%02x %02x %02x %02x %02x %02x %02x %02x]\n", - data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); - - send_result(intr_complete,data,8); -} - -void psxcd_device::cdcmd_gettn() -{ - verboselog(machine(), 1, "psxcd: gettn\n"); - - - if(!open) - { - unsigned char data[3]= - { - status, - decimal_to_bcd(1), - decimal_to_bcd(cdrom_get_last_track(m_cdrom_handle)) - }; - - send_result(intr_complete,data,3); - } - else - { - send_result(intr_diskerror, NULL, 0, 0x80); - } -} - -void psxcd_device::cdcmd_gettd() -{ - UINT8 track = bcd_to_decimal(cmdbuf[0]); - UINT8 last = cdrom_get_last_track(m_cdrom_handle); - if(track <= last) - { - CDPOS trkstart; - if(!track) // length of disk - trkstart.w = lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, 0xaa)); - else - trkstart.w = lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, track - 1)); - - unsigned char data[3]= - { - status, - decimal_to_bcd(trkstart.b[M]), - decimal_to_bcd(trkstart.b[S]) - }; - - verboselog(machine(), 1, "psxcd: gettd %02x [%02x %02x %02x]\n", cmdbuf[0], data[0], data[1], data[2]); - - send_result(intr_acknowledge,data,3); - } - else - { - send_result(intr_diskerror, NULL, 0, 0x80); - } -} - -void psxcd_device::cdcmd_seekl() -{ - verboselog(machine(), 1, "psxcd: seekl [%02d:%02d:%02d]\n", loc.b[M], loc.b[S], loc.b[F]); - - curpos.w=loc.w; - - send_result(intr_acknowledge); -} - -void psxcd_device::cdcmd_seekp() -{ - verboselog(machine(), 1, "psxcd: seekp\n"); - - curpos.w=loc.w; - - send_result(intr_acknowledge); -} - -void psxcd_device::cdcmd_test() -{ - verboselog(machine(), 1, "psxcd: test %02x\n", cmdbuf[0]); - - switch(cmdbuf[0]) - { - case 0x20: - { - static UINT8 data[4]= - { - 0x95, - 0x07, - 0x06, - 0xff - }; - - send_result(intr_complete,data,4); - break; - } - - default: - verboselog(machine(), 0, "psxcd: unimplemented test cmd %02x\n", cmdbuf[0]); - cmd_complete(prepare_result(intr_diskerror, NULL, 0, 0x10)); - break; - } -} - -void psxcd_device::cdcmd_id() -{ - verboselog(machine(), 1, "psxcd: id\n"); - - if (!open) - { - UINT8 cdid[8]; - int irq; - memset(cdid, '\0', 8); - - send_result(intr_complete); - if(cdrom_get_track_type(m_cdrom_handle, 0) == CD_TRACK_AUDIO) - { - irq = intr_diskerror; - cdid[0] = status | status_invalid; - cdid[1] = 0x90; - } - else - { - irq = intr_acknowledge; - cdid[0] = status; - cdid[4] = 'S'; - cdid[5] = 'C'; - cdid[6] = 'E'; - cdid[7] = 'A'; - } - send_result(irq,cdid,8,default_irq_delay*3); - } - else - { - send_result(intr_diskerror, NULL, 0, 0x80); - } -} - -void psxcd_device::cdcmd_reads() -{ - if(!open) - { - verboselog(machine(), 1, "psxcd: reads\n"); - - curpos.w=loc.w; - - stop_read(); - start_read(); - } else - { - send_result(intr_diskerror, NULL, 0, 0x80); - } -} - -void psxcd_device::cdcmd_reset() -{ - verboselog(machine(), 1, "psxcd: reset\n"); -} - -void psxcd_device::cdcmd_readtoc() -{ - verboselog(machine(), 1, "psxcd: readtoc\n"); - - send_result(intr_complete); - send_result(intr_acknowledge, NULL, 0, default_irq_delay*3); // ? -} - -void psxcd_device::cdcmd_unknown12() -{ - verboselog(machine(), 1, "psxcd: unknown 12\n"); - // set session? readt? - if(cmdbuf[0] == 1) - send_result(intr_complete); - else - send_result(intr_diskerror, NULL, 0, 0x40); -} - -void psxcd_device::cdcmd_illegal17() -{ - illegalcmd(0x17); // set clock? -} - -void psxcd_device::cdcmd_illegal18() -{ - illegalcmd(0x18); // get clock? -} - -void psxcd_device::cdcmd_illegal1d() -{ - illegalcmd(0x1d); // read q subchannel -} - -void psxcd_device::illegalcmd(UINT8 cmd) -{ - verboselog(machine(), 0, "psxcd: unimplemented cd command %02x\n", cmd); - - send_result(intr_diskerror, NULL, 0, 0x40); -} - -void psxcd_device::cmd_complete(command_result *res) -{ - command_result *rf; - - verboselog(machine(), 1, "psxcd: irq [%d]\n", res->res); - - if (res_queue) - { - for (rf=res_queue; rf->next; rf=rf->next); - rf->next=res; - } - else - { - res_queue = res; - m_regs.ir = res_queue->res; - if(m_regs.ir & m_regs.imr) - m_irq_handler(1); - m_regs.sr |= 0x20; - } - res->next = NULL; -} - -psxcd_device::command_result *psxcd_device::prepare_result(UINT8 res, UINT8 *data, int sz, UINT8 errcode) -{ - command_result *cr=global_alloc(command_result); - - cr->res=res; - if (sz) - { - assert(szdata)); - memcpy(cr->data,data,sz); - cr->sz=sz; - } else - { - if((res == intr_diskerror) && errcode) - { - cr->data[0] = status | status_error; - cr->data[1] = errcode; - cr->sz = 2; - } - else - { - cr->data[0]=status; - cr->sz=1; - } - } - status &= ~status_error; - - return cr; -} - -void psxcd_device::send_result(UINT8 res, UINT8 *data, int sz, int delay, UINT8 errcode) -{ - // Avoid returning results after sector read results - - // delay the sector read slightly if necessary - - UINT64 systime = m_maincpu->total_cycles(); - if ((next_read_event != -1) && ((systime+delay)>(next_sector_t))) - { - UINT32 hz = m_sysclock / (delay + 2000); - m_timers[next_read_event]->adjust(attotime::from_hz(hz), 0, attotime::never); - } - - add_system_event(event_cmd_complete, delay, prepare_result(res, data, sz, errcode)); -} - -void psxcd_device::start_dma(UINT8 *mainram, UINT32 size) -{ - UINT32 sector_size; - verboselog(machine(), 1, "psxcd: start dma %d bytes at %d\n", size, m_transcurr); - - if(!m_dmaload) - return; - - switch(mode & mode_size_mask) - { - case 0x00: - default: - sector_size = 2048 + 24; - break; - case 0x10: - sector_size = 2328 + 12; - break; - case 0x20: - sector_size = 2340 + 12; - break; - } - - if(size > (sector_size - m_transcurr)) - size = (sector_size - m_transcurr); - - memcpy(mainram, &m_transbuf[m_transcurr], size); - m_transcurr += size; - - if(sector_size <= m_transcurr) - { - m_dmaload = false; - m_regs.sr &= ~0x40; - } -} - -void psxcd_device::read_sector() -{ - next_read_event=-1; - - if (status & status_reading) - { - bool isend = false; - UINT32 sector = msf_to_lba_ps(curpos.w); - UINT8 *buf = secbuf[sectail]; - if (cdrom_read_data(m_cdrom_handle, sector, buf, CD_TRACK_RAW_DONTCARE)) - { - subheader *sub=(subheader *)(buf+16); - memcpy(lastsechdr, buf+12, 8); - - verboselog(machine(), 2, "psxcd: subheader file=%02x chan=%02x submode=%02x coding=%02x [%02x%02x%02x%02x]\n", - sub->file, sub->channel, sub->submode, sub->coding, buf[0xc], buf[0xd], buf[0xe], buf[0xf]); - - if ((mode & mode_adpcm) && (sub->submode & submode_audio)) - { - if ((sub->submode & submode_eof) && (mode & mode_autopause)) - { - isend=true; - //printf("end of file\n"); - } - if((!(mode & mode_channel) || - ((sub->file == filter_file) && (sub->channel == filter_channel))) && !m_mute) - m_spu->play_xa(0,buf+16); - } - else - { - if(!m_int1) - m_cursec = sectail; - - m_int1 = prepare_result(intr_dataready); - cmd_complete(m_int1); - sectail++; - sectail %= sector_buffer_size; - } - - curpos.b[F]++; - if (curpos.b[F]==75) - { - curpos.b[F]=0; - curpos.b[S]++; - if (curpos.b[S]==60) - { - curpos.b[S]=0; - curpos.b[M]++; - } - } - - loc.w=curpos.w; - } - else - isend = true; - - if (! isend) - { - unsigned int cyc=read_sector_cycles; - if (mode&mode_double_speed) cyc>>=1; - - next_sector_t+=cyc; - - next_read_event = add_system_event(event_read_sector, cyc, NULL); - } else - { - verboselog(machine(), 1, "psxcd: autopause xa\n"); - - cmd_complete(prepare_result(intr_dataend)); - stop_read(); - } - } -} - -void psxcd_device::play_sector() -{ - next_read_event=-1; - - if (status&status_playing) - { - UINT32 sector = msf_to_lba_ps(curpos.w); - - if(cdrom_read_data(m_cdrom_handle, sector, secbuf[sectail], CD_TRACK_AUDIO)) - { - if(!m_mute) - m_spu->play_cdda(0, secbuf[sectail]); - } - else - { - if(!cdrom_read_data(m_cdrom_handle, sector, secbuf[sectail], CD_TRACK_RAW_DONTCARE)) - { - stop_read(); // assume we've reached the end - cmd_complete(prepare_result(intr_dataend)); - return; - } - } - - curpos.b[F]++; - if (curpos.b[F]==75) - { - curpos.b[F]=0; - curpos.b[S]++; - if (curpos.b[S]==60) - { - curpos.b[S]=0; - curpos.b[M]++; - } - } - - loc.w=curpos.w; - sector++; - sectail++; - sectail %= sector_buffer_size; - - if (mode&mode_autopause) - { - if (sector>=autopause_sector) - { - verboselog(machine(), 1, "psxcd: autopause cdda\n"); - - stop_read(); - cmd_complete(prepare_result(intr_dataend)); - return; - } - } - - if ((mode&mode_report) && !(sector & 15)) // slow the int rate - { - command_result *res=global_alloc(command_result); - UINT8 track = cdrom_get_track(m_cdrom_handle, sector) + 1; - res->res=intr_dataready; - - res->data[0]=status; - res->data[1]=decimal_to_bcd(track); - res->data[2]=1; - if(sector & 0x10) - { - CDPOS tloc, start; - start.w = (track == 1) ? 0x000200 : lba_to_msf_ps(cdrom_get_track_start(m_cdrom_handle, track - 1)); - tloc.w = sub_loc(loc, start); - res->data[3]=decimal_to_bcd(tloc.b[M]); - res->data[4]=decimal_to_bcd(tloc.b[S]) | 0x80; - res->data[5]=decimal_to_bcd(tloc.b[F]); - } - else - { - res->data[3]=decimal_to_bcd(loc.b[M]); - res->data[4]=decimal_to_bcd(loc.b[S]); - res->data[5]=decimal_to_bcd(loc.b[F]); - } - - res->sz=8; - - cmd_complete(res); - } - - unsigned int cyc=read_sector_cycles; - - next_sector_t+=cyc>>1; - - next_read_event = add_system_event(event_play_sector, next_sector_t - m_maincpu->total_cycles(), NULL); - } -} - -void psxcd_device::start_read() -{ - UINT32 sector = msf_to_lba_ps(curpos.w); - - assert((status&(status_reading|status_playing))==0); - - if(!(mode & mode_cdda) && (cdrom_get_track_type(m_cdrom_handle, cdrom_get_track(m_cdrom_handle, sector + 150)) == CD_TRACK_AUDIO)) - { - stop_read(); - cmd_complete(prepare_result(intr_diskerror, NULL, 0, 0x40)); - return; - } - send_result(intr_complete); - status |= status_reading; - - m_cursec=sectail=0; - - unsigned int cyc=read_sector_cycles; - if (mode&mode_double_speed) cyc>>=1; - - INT64 systime=m_maincpu->total_cycles(); - - systime+=start_read_delay; - - next_sector_t=systime+cyc; - next_read_event = add_system_event(event_read_sector, start_read_delay+preread_delay, NULL); -} - -void psxcd_device::start_play() -{ - UINT8 track = cdrom_get_track(m_cdrom_handle, msf_to_lba_ps(curpos.w) + 150); - - if(cdrom_get_track_type(m_cdrom_handle, track) != CD_TRACK_AUDIO) - verboselog(machine(), 0, "psxcd: playing data track\n"); - - status|=status_playing; - - m_cursec=sectail=0; - - if (mode&mode_autopause) - { - autopause_sector = cdrom_get_track_start(m_cdrom_handle, track) + cdrom_get_toc(m_cdrom_handle)->tracks[track].frames; -// printf("pos=%d auto=%d\n",pos,autopause_sector); - } - - unsigned int cyc=read_sector_cycles; - - next_sector_t=m_maincpu->total_cycles()+cyc; - - next_sector_t+=cyc>>1; - - next_read_event = add_system_event(event_play_sector, next_sector_t - m_maincpu->total_cycles(), NULL); -} - -void psxcd_device::stop_read() -{ - if (status & (status_reading|status_playing)) - verboselog(machine(), 1, "psxcd: stop read\n"); - - status&=~(status_reading|status_playing); - - if (next_read_event != -1) - { - m_timers[next_read_event]->adjust(attotime::never, 0, attotime::never); - m_timerinuse[next_read_event] = false; - next_read_event = -1; - } - - UINT32 sector=msf_to_lba_ps(curpos.w); - m_spu->flush_xa(sector); - m_spu->flush_cdda(sector); -} - -void psxcd_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) -{ - if (!m_timerinuse[tid]) - { - verboselog(machine(), 0, "psxcd: timer fired for free event\n"); - return; - } - - m_timerinuse[tid] = false; - switch (param) - { - case event_cmd_complete: - { - verboselog(machine(), 1, "psxcd: event cmd complete\n"); - - cmd_complete((command_result *)ptr); - break; - } - - case event_read_sector: - read_sector(); - break; - - case event_play_sector: - play_sector(); - break; - - case event_change_disk: - open = false; - status |= status_standby; - break; - } -} - -int psxcd_device::add_system_event(int type, UINT64 t, command_result *ptr) -{ - // t is in maincpu clock cycles - UINT32 hz = m_sysclock / t; - for(int i = 0; i < MAX_PSXCD_TIMERS; i++) - { - if(!m_timerinuse[i]) - { - m_timers[i]->adjust(attotime::from_hz(hz), type, attotime::never); - m_timers[i]->set_ptr(ptr); - m_timerinuse[i] = true; - return i; - } - } - fatalerror("psxcd: out of timers\n"); -} diff --git a/src/mess/machine/psxcd.h b/src/mess/machine/psxcd.h deleted file mode 100644 index 3239ea8ef2c..00000000000 --- a/src/mess/machine/psxcd.h +++ /dev/null @@ -1,161 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:smf,R. Belmont,pSXAuthor,Carl -#ifndef _included_psxcdrom_ -#define _included_psxcdrom_ - -#include "imagedev/chd_cd.h" -#include "sound/spu.h" - -#define MAX_PSXCD_TIMERS (4) - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_PSXCD_ADD(_tag, _devname) \ - MCFG_DEVICE_ADD(_tag, PSXCD, 0) - -#define MCFG_PSXCD_IRQ_HANDLER(_devcb) \ - devcb = &psxcd_device::set_irq_handler(*device, DEVCB_##_devcb); - -class psxcd_device : public cdrom_image_device -{ -public: - psxcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // static configuration helpers - template static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast(device).m_irq_handler.set_callback(object); } - static void static_set_devname(device_t &device, const char *devname); - virtual bool call_load(); - virtual void call_unload(); - - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( read ); - void start_dma(UINT8 *mainram, UINT32 size); - -protected: - virtual void device_start(); - virtual void device_stop(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - void write_command(UINT8 byte); - - typedef void (psxcd_device::*cdcmd)(); - struct command_result - { - UINT8 data[32], sz, res; - command_result *next; - }; - union CDPOS { - UINT8 b[4]; - UINT32 w; - }; - - void cdcmd_sync(); - void cdcmd_nop(); - void cdcmd_setloc(); - void cdcmd_play(); - void cdcmd_forward(); - void cdcmd_backward(); - void cdcmd_readn(); - void cdcmd_standby(); - void cdcmd_stop(); - void cdcmd_pause(); - void cdcmd_init(); - void cdcmd_mute(); - void cdcmd_demute(); - void cdcmd_setfilter(); - void cdcmd_setmode(); - void cdcmd_getparam(); - void cdcmd_getlocl(); - void cdcmd_getlocp(); - void cdcmd_gettn(); - void cdcmd_gettd(); - void cdcmd_seekl(); - void cdcmd_seekp(); - void cdcmd_test(); - void cdcmd_id(); - void cdcmd_reads(); - void cdcmd_reset(); - void cdcmd_readtoc(); - void cdcmd_unknown12(); - void cdcmd_illegal17(); - void cdcmd_illegal18(); - void cdcmd_illegal1d(); - - static const cdcmd cmd_table[31]; - void illegalcmd(UINT8 cmd); - - void cmd_complete(command_result *res); - void send_result(UINT8 res, UINT8 *data=NULL, int sz=0, int delay=default_irq_delay, UINT8 errcode = 0); - command_result *prepare_result(UINT8 res, UINT8 *data=NULL, int sz=0, UINT8 errcode = 0); - - void start_read(); - void start_play(); - void stop_read(); - void read_sector(); - void play_sector(); - UINT32 sub_loc(CDPOS src1, CDPOS src2); - int add_system_event(int type, UINT64 t, command_result *ptr); - - UINT8 bcd_to_decimal(const UINT8 bcd) { return ((bcd>>4)*10)+(bcd&0xf); } - UINT8 decimal_to_bcd(const UINT8 dec) { return ((dec/10)<<4)|(dec%10); } - UINT32 msf_to_lba_ps(UINT32 msf) { msf = msf_to_lba(msf); return (msf>150)?(msf-150):msf; } - UINT32 lba_to_msf_ps(UINT32 lba) { return lba_to_msf_alt(lba+150); } - - static const unsigned int sector_buffer_size=16, default_irq_delay=16000; //480; //8000; //2000<<2; - static const unsigned int raw_sector_size=2352; - - UINT8 cmdbuf[64], mode, secbuf[sector_buffer_size][raw_sector_size]; - UINT8 filter_file, filter_channel, lastsechdr[8], status; - int rdp; - UINT8 m_cursec, sectail; - UINT16 m_transcurr; - UINT8 m_transbuf[raw_sector_size]; - command_result *res_queue, *m_int1; - - struct { - UINT8 sr, ir, imr; - struct { - UINT8 ll, lr, rl, rr; - } vol; - } m_regs; - - CDPOS loc, curpos; - -#ifdef LSB_FIRST - enum { - M = 2, - S = 1, - F = 0 - }; -#else - enum { - M = 1, - S = 2, - F = 3 - }; -#endif - - bool open, m_mute, m_dmaload; - device_timer_id next_read_event; - INT64 next_sector_t; - unsigned int autopause_sector, start_read_delay, read_sector_cycles, preread_delay; - - UINT32 m_param_count; - UINT32 m_sysclock; - emu_timer *m_timers[MAX_PSXCD_TIMERS]; - bool m_timerinuse[MAX_PSXCD_TIMERS]; - - - devcb_write_line m_irq_handler; - cpu_device *m_maincpu; - spu_device *m_spu; -}; - -// device type definition -extern const device_type PSXCD; - -#endif diff --git a/src/mess/machine/qimi.c b/src/mess/machine/qimi.c deleted file mode 100644 index e1a55134b69..00000000000 --- a/src/mess/machine/qimi.c +++ /dev/null @@ -1,181 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Phill Harvey-Smith -/********************************************************************** - - QJump/Quanta QL Internal Mouse Interface emulation - -**********************************************************************/ - -#include "qimi.h" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type QIMI = &device_creator; - - -//------------------------------------------------- -// INPUT_CHANGED_MEMBER( mouse_x_changed ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( qimi_t::mouse_x_changed ) -{ - if (newval > oldval) - { - m_status |= ST_X_DIR; - } - else - { - m_status &= ~ST_X_DIR; - } - - m_status |= ST_X_INT; - - if (m_extint_en) - { - m_write_extint(ASSERT_LINE); - } -} - - -//------------------------------------------------- -// INPUT_CHANGED_MEMBER( mouse_y_changed ) -//------------------------------------------------- - -INPUT_CHANGED_MEMBER( qimi_t::mouse_y_changed ) -{ - if (newval < oldval) - { - m_status |= ST_Y_DIR; - } - else - { - m_status &= ~ST_Y_DIR; - } - - m_status |= ST_Y_INT; - - if (m_extint_en) - { - m_write_extint(ASSERT_LINE); - } -} - - -//------------------------------------------------- -// INPUT_PORTS( qimi ) -//------------------------------------------------- - -INPUT_PORTS_START( qimi ) - PORT_START("mouse_x") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_CHANGED_MEMBER(DEVICE_SELF, qimi_t, mouse_x_changed, 0) - - PORT_START("mouse_y") - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_CHANGED_MEMBER(DEVICE_SELF, qimi_t, mouse_y_changed, 0) - - PORT_START("mouse_buttons") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Right Mouse Button") PORT_CODE(MOUSECODE_BUTTON2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Left Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) - PORT_BIT( 0xcf, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor qimi_t::device_input_ports() const -{ - return INPUT_PORTS_NAME( qimi ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// qimi_t - constructor -//------------------------------------------------- - -qimi_t::qimi_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, QIMI, "QL Internal Mouse Interface", tag, owner, clock, "qimi", __FILE__), - m_write_extint(*this), - m_buttons(*this, "mouse_buttons"), - m_status(0), - m_extint_en(false) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void qimi_t::device_start() -{ - // resolve callbacks - m_write_extint.resolve_safe(); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void qimi_t::device_reset() -{ - m_status = 0; - m_extint_en = false; -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -UINT8 qimi_t::read(address_space &space, offs_t offset, UINT8 data) -{ - switch (offset) - { - // button status - case 0x1bf9c: - data = m_buttons->read(); - break; - - // direction status - case 0x1bfbc: - data = m_status; - break; - - case 0x1bfbe: - m_status &= ~(ST_Y_INT | ST_X_INT); - m_extint_en = true; - - m_write_extint(CLEAR_LINE); - break; - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( qimi_t::write ) -{ - // write to 0x1bfbe resets int status - if (offset == 0x1bfbe) - { - m_status &= ~(ST_Y_INT | ST_X_INT); - m_extint_en = true; - - m_write_extint(CLEAR_LINE); - } -} diff --git a/src/mess/machine/qimi.h b/src/mess/machine/qimi.h deleted file mode 100644 index bf513da9042..00000000000 --- a/src/mess/machine/qimi.h +++ /dev/null @@ -1,78 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Phill Harvey-Smith -/********************************************************************** - - QJump/Quanta QL Internal Mouse Interface emulation - -**********************************************************************/ - -#pragma once - -#ifndef __QIMI__ -#define __QIMI__ - -#include "emu.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_QIMI_EXTINT_CALLBACK(_write) \ - devcb = &qimi_t::set_exting_wr_callback(*device, DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> qimi_t - -class qimi_t : public device_t -{ -public: - // construction/destruction - qimi_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_exting_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_extint.set_callback(object); } - - // optional information overrides - virtual ioport_constructor device_input_ports() const; - - UINT8 read(address_space &space, offs_t offset, UINT8 data); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_INPUT_CHANGED_MEMBER( mouse_x_changed ); - DECLARE_INPUT_CHANGED_MEMBER( mouse_y_changed ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - enum - { - ST_Y_DIR = 0x01, - ST_X_INT = 0x04, - ST_X_DIR = 0x10, - ST_Y_INT = 0x20 - }; - - devcb_write_line m_write_extint; - - required_ioport m_buttons; - - UINT8 m_status; - bool m_extint_en; -}; - - -// device type definition -extern const device_type QIMI; - - - -#endif diff --git a/src/mess/machine/qx10kbd.c b/src/mess/machine/qx10kbd.c deleted file mode 100644 index 1a4c7364c06..00000000000 --- a/src/mess/machine/qx10kbd.c +++ /dev/null @@ -1,301 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -// TODO: dump 8049 mcu; key repeat - -#include "machine/qx10kbd.h" - -qx10_keyboard_device::qx10_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, QX10_KEYBOARD, "QX10 Keyboard", tag, owner, 0, "qx10_keyboard", __FILE__), - m_io_kbd8(*this, "TERM_LINE8"), - m_io_kbd9(*this, "TERM_LINE9"), - m_io_kbda(*this, "TERM_LINEA"), - m_io_kbdb(*this, "TERM_LINEB"), - m_io_kbdd(*this, "TERM_LINED"), - m_io_kbde(*this, "TERM_LINEE"), - m_io_kbdf(*this, "TERM_LINEF") -{ -} - -void qx10_keyboard_device::write(UINT8 data) -{ - switch(data & 0xe0) - { - default: - break; - case 0x00: // set repeat start - break; - case 0x20: // set repeat interval - break; - case 0x40: // set LED - break; - case 0x60: // get LED - send_key(0); - break; - case 0x80: // get SW - break; - case 0xa0: // set repeat - break; - case 0xc0: // enable keyboard - break; - case 0xe0: - if(!(data & 1)) - send_key(0); - break; - } - return; -} - -UINT8 qx10_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) -{ - int i = *scan_line, j; - UINT8 code = 0; - - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - else - if (i == 9) code = m_io_kbd9->read(); - else - if (i == 10) code = m_io_kbda->read(); - else - if (i == 11) code = m_io_kbdb->read(); - else - if (i == 12) code = m_io_kbdc->read(); - else - if (i == 13) code = m_io_kbdd->read(); - else - if (i == 14) code = m_io_kbde->read(); - else - if (i == 15) code = m_io_kbdf->read(); - - *scan_line = (*scan_line + 1) % 16; - - if(m_state[i] == code) - return 0; - - m_state[i] = code; - - if(!code) - return 0; - - for(j = 0; j < 8; j++) - if((code >> j) == 1) break; - - return (j << 4) + i; -} - -static INPUT_PORTS_START( qx10_keyboard ) - PORT_START("TERM_LINE0") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RSHIFT") - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RCTRL") PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH SHIFT") - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LCTRL") PORT_CODE(KEYCODE_LCONTROL) - - PORT_START("TERM_LINE1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4/UNDO") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS LOCK/(H6)") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB REL") - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3/COPY DISK") PORT_CODE(KEYCODE_F3) - - PORT_START("TERM_LINE2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5/(H1)") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2/HELP") PORT_CODE(KEYCODE_F2) - - PORT_START("TERM_LINE3") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6/STORE") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1/STOP") PORT_CODE(KEYCODE_F1) - - PORT_START("TERM_LINE4") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F7/RETRIEVE") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MAR SEL") - - PORT_START("TERM_LINE5") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F8/PRINT") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER (PAD)") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC/^") PORT_CODE(KEYCODE_ESC) - - PORT_START("TERM_LINE6") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F9/INDEX") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - - PORT_START("TERM_LINE7") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F10/MAIL") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - - PORT_START("TERM_LINE8") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(H2)") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= (PAD)") - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB SET") - - PORT_START("TERM_LINE9") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK/MENU") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - - PORT_START("TERM_LINEA") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PAUSE/CALC") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - - PORT_START("TERM_LINEB") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SCRN DUMP/SCHED") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@/1/2 1/4") - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("=") - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - - PORT_START("TERM_LINEC") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HELP/DRAW") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(H5)") - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/]") - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - - PORT_START("TERM_LINEE") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BOLD") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF3/STYLE") - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INSERT") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-7") - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - - PORT_START("TERM_LINEF") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF1/ITALIC") - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF2/SIZE") - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("`/DEC TAB") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("? /") - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL/WORD") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS/LINE") - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_1200, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_1200, "1200") - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_EVEN, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_EVEN, "Even") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_1, "1") -INPUT_PORTS_END - -ioport_constructor qx10_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(qx10_keyboard); -} - -void qx10_keyboard_device::device_start() -{ - serial_keyboard_device::device_start(); - memset(m_state, '\0', sizeof(m_state)); - set_rcv_rate(1200); -} - -void qx10_keyboard_device::rcv_complete() -{ - receive_register_extract(); - write(get_received_char()); -} - -const device_type QX10_KEYBOARD = &device_creator; diff --git a/src/mess/machine/qx10kbd.h b/src/mess/machine/qx10kbd.h deleted file mode 100644 index 46bf99083c0..00000000000 --- a/src/mess/machine/qx10kbd.h +++ /dev/null @@ -1,35 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#ifndef QX10KBD_H_ -#define QX10KBD_H_ - -#include "bus/rs232/keyboard.h" - -class qx10_keyboard_device : public serial_keyboard_device -{ -public: - qx10_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ioport_constructor device_input_ports() const; - -protected: - virtual void device_start(); - virtual void rcv_complete(); - -private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); - void write(UINT8 data); - - required_ioport m_io_kbd8; - required_ioport m_io_kbd9; - required_ioport m_io_kbda; - required_ioport m_io_kbdb; - required_ioport m_io_kbdd; - required_ioport m_io_kbde; - required_ioport m_io_kbdf; - - UINT8 m_state[16]; -}; - -extern const device_type QX10_KEYBOARD; - -#endif /* QX10KBD_H_ */ diff --git a/src/mess/machine/radio86.c b/src/mess/machine/radio86.c deleted file mode 100644 index 0f1f9360aa0..00000000000 --- a/src/mess/machine/radio86.c +++ /dev/null @@ -1,234 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Radio-86RK machine driver by Miodrag Milanovic - - 06/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "machine/i8255.h" -#include "includes/radio86.h" - - - -void radio86_state::radio86_init_keyboard() -{ - m_keyboard_mask = 0; - m_tape_value = 0x10; -} - -/* Driver initialization */ -DRIVER_INIT_MEMBER(radio86_state,radio86) -{ - /* set initialy ROM to be visible on first bank */ - UINT8 *RAM = m_region_maincpu->base(); - memset(RAM,0x0000,0x1000); // make frist page empty by default - m_bank1->configure_entries(1, 2, RAM, 0x0000); - m_bank1->configure_entries(0, 2, RAM, 0xf800); - radio86_init_keyboard(); -} - -DRIVER_INIT_MEMBER(radio86_state,radioram) -{ - DRIVER_INIT_CALL(radio86); - m_radio_ram_disk = auto_alloc_array(machine(), UINT8, 0x20000); - memset(m_radio_ram_disk,0,0x20000); -} -READ8_MEMBER(radio86_state::radio86_8255_portb_r2) -{ - UINT8 key = 0xff; - if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_line0->read(); } - if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_line1->read(); } - if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_line2->read(); } - if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_line3->read(); } - if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_line4->read(); } - if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_line5->read(); } - if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_line6->read(); } - if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_line7->read(); } - return key; -} - -READ8_MEMBER(radio86_state::radio86_8255_portc_r2) -{ - double level = m_cassette->input(); - UINT8 dat = m_io_line8->read(); - if (level < 0) { - dat ^= m_tape_value; - } - return dat; -} - -WRITE8_MEMBER(radio86_state::radio86_8255_porta_w2) -{ - m_keyboard_mask = data ^ 0xff; -} - -WRITE8_MEMBER(radio86_state::radio86_8255_portc_w2) -{ - m_cassette->output(data & 0x01 ? 1 : -1); -} - - -READ8_MEMBER(radio86_state::rk7007_8255_portc_r) -{ - double level = m_cassette->input(); - UINT8 key = 0xff; - if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_cline0->read(); } - if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_cline1->read(); } - if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_cline2->read(); } - if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_cline3->read(); } - if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_cline4->read(); } - if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_cline5->read(); } - if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_cline6->read(); } - if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_cline7->read(); } - key &= 0xe0; - if (level < 0) { - key ^= m_tape_value; - } - return key; -} - -WRITE_LINE_MEMBER(radio86_state::hrq_w) -{ - /* HACK - this should be connected to the BUSREQ line of Z80 */ - m_maincpu->set_input_line(INPUT_LINE_HALT, state); - - /* HACK - this should be connected to the BUSACK line of Z80 */ - m_dma8257->hlda_w(state); -} - -READ8_MEMBER(radio86_state::memory_read_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.read_byte(offset); -} - -WRITE8_MEMBER(radio86_state::memory_write_byte) -{ - address_space& prog_space = m_maincpu->space(AS_PROGRAM); - return prog_space.write_byte(offset, data); -} - -void radio86_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_RESET: - m_bank1->set_entry(0); - break; - default: - assert_always(FALSE, "Unknown id in radio86_state::device_timer"); - } -} - - -READ8_MEMBER(radio86_state::radio_cpu_state_r) -{ - return space.device().state().state_int(I8085_STATUS); -} - -READ8_MEMBER(radio86_state::radio_io_r) -{ - return m_maincpu->space(AS_PROGRAM).read_byte((offset << 8) + offset); -} - -WRITE8_MEMBER(radio86_state::radio_io_w) -{ - m_maincpu->space(AS_PROGRAM).write_byte((offset << 8) + offset,data); -} - -MACHINE_RESET_MEMBER(radio86_state,radio86) -{ - timer_set(attotime::from_usec(10), TIMER_RESET); - m_bank1->set_entry(1); - - m_keyboard_mask = 0; - m_disk_sel = 0; -} - - -WRITE8_MEMBER(radio86_state::radio86_pagesel) -{ - m_disk_sel = data; -} - -READ8_MEMBER(radio86_state::radio86rom_romdisk_porta_r) -{ - UINT16 addr = (m_romdisk_msb << 8) | m_romdisk_lsb; - if (m_cart->exists() && addr < m_cart->get_rom_size()) - return m_cart->read_rom(space, addr); - else - return 0xff; -} - -READ8_MEMBER(radio86_state::radio86ram_romdisk_porta_r) -{ - UINT8 *romdisk = m_region_maincpu->base() + 0x10000; - if ((m_disk_sel & 0x0f) ==0) { - return romdisk[m_romdisk_msb*256+m_romdisk_lsb]; - } else { - if (m_disk_sel==0xdf) { - return m_radio_ram_disk[m_romdisk_msb*256+m_romdisk_lsb + 0x10000]; - } else { - return m_radio_ram_disk[m_romdisk_msb*256+m_romdisk_lsb]; - } - } -} - -WRITE8_MEMBER(radio86_state::radio86_romdisk_portb_w) -{ - m_romdisk_lsb = data; -} - -WRITE8_MEMBER(radio86_state::radio86_romdisk_portc_w) -{ - m_romdisk_msb = data; -} - -WRITE8_MEMBER(radio86_state::mikrosha_8255_font_page_w) -{ - m_mikrosha_font_page = (data > 7) & 1; -} - -I8275_DRAW_CHARACTER_MEMBER(radio86_state::display_pixels) -{ - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const UINT8 *charmap = m_charmap; - UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; - if(linecount == 8) - pixels = 0; - if (vsp) { - pixels = 0; - } - if (lten) { - pixels = 0xff; - } - if (rvv) { - pixels ^= 0xff; - } - for(i=0;i<6;i++) { - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; - } -} - -static const rgb_t radio86_palette[3] = { - rgb_t(0x00, 0x00, 0x00), // black - rgb_t(0xa0, 0xa0, 0xa0), // white - rgb_t(0xff, 0xff, 0xff) // highlight -}; - -PALETTE_INIT_MEMBER(radio86_state,radio86) -{ - palette.set_pen_colors(0, radio86_palette, ARRAY_LENGTH(radio86_palette)); -} - -void radio86_state::video_start() -{ - m_charmap = memregion("gfx1")->base(); -} diff --git a/src/mess/machine/rm380z.c b/src/mess/machine/rm380z.c deleted file mode 100644 index 082dbf6ff75..00000000000 --- a/src/mess/machine/rm380z.c +++ /dev/null @@ -1,278 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol,Gabriele D'Antona - -/* - -RM 380Z machine - -*/ - - -#include "includes/rm380z.h" - - -/* - -PORT0 write in COS 4.0B/M: - -bit0: 1=reset keyboard latch (?) -bit1: ? -bit2: ? -bit3: ? -bit4: ? -bit5: 40/80 cols switch (?) -bit6: 0=write to char RAM/1=write to attribute RAM -bit7: 1=map ROM at 0000-0fff/0=RAM - -*/ - -WRITE8_MEMBER( rm380z_state::port_write ) -{ - switch ( offset ) - { - case 0xFC: // PORT0 - //printf("FBFCw[%2.2x] FBFD [%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",data,m_fbfd,m_fbfe,m_maincpu->safe_pc(),writenum); - m_port0 = data; - if (data&0x01) - { - //printf("WARNING: bit0 of port0 reset\n"); - m_port0_kbd=0; - } - m_port1&=~0x01; //? - - config_videomode(); - config_memory_map(); - break; - - case 0xFD: // screen line counter (?) - //printf("FBFC [%2.2x] FBFDw[%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,data,m_fbfe,m_maincpu->safe_pc(),writenum); - - m_old_old_fbfd=m_old_fbfd; - m_old_fbfd=m_fbfd; - m_fbfd=data; - - writenum++; - - check_scroll_register(); - - break; - - case 0xFE: // line on screen to write to divided by 2 - //printf("FBFC [%2.2x] FBFD [%2.2x] FBFEw[%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,m_fbfd,data,m_maincpu->safe_pc(),writenum); - m_fbfe=data; - break; - - case 0xFF: // user I/O port - //printf("write of [%x] to FBFF\n",data); - //logerror("%s: Write %02X to user I/O port\n", machine().describe_context(), data ); - break; - - default: - printf("unknown port [%2.2x] write of [%2.2x]\n",offset,data); - } -} - -READ8_MEMBER( rm380z_state::port_read ) -{ - UINT8 data = 0xFF; - - switch ( offset ) - { - case 0xFC: // PORT0 - //m_port0_kbd=getKeyboard(); - data = m_port0_kbd; - //if (m_port0_kbd!=0) m_port0_kbd=0; - //m_port0_kbd=0; - //printf("read of port0 (kbd) from PC [%x]\n",m_maincpu->safe_pc()); - break; - - case 0xFD: // "counter" (?) - //printf("%s: Read from counter FBFD\n", machine().describe_context()); - data = 0x00; - break; - - case 0xFE: // PORT1 - data = m_port1; - //printf("read of port1 from PC [%x]\n",m_maincpu->safe_pc()); - break; - - case 0xFF: // user port - //printf("%s: Read from user port\n", machine().describe_context()); - break; - - default: - printf("read from unknown port [%2.2x]\n",offset); - } - - return data; -} - -WRITE8_MEMBER( rm380z_state::port_write_1b00 ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - port_write(program,offset+0xfc,data); -} - -READ8_MEMBER( rm380z_state::port_read_1b00 ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - return port_read(program,offset+0xfc); -} - -READ8_MEMBER( rm380z_state::hiram_read ) -{ - return hiram[offset]; -} - -WRITE8_MEMBER( rm380z_state::hiram_write ) -{ - hiram[offset]=data; -} - -READ8_MEMBER( rm380z_state::rm380z_portlow_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( rm380z_state::rm380z_portlow_w ) -{ - //printf("port write [%x] [%x] at PC [%x]\n",offset,data,m_maincpu->safe_pc()); -} - -READ8_MEMBER( rm380z_state::rm380z_porthi_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( rm380z_state::rm380z_porthi_w ) -{ - //printf("port write [%x] [%x]\n",offset+0xc5,data); -} - - -#define LINE_SUBDIVISION 82 -#define HORZ_LINES 100 -#define TIMER_SPEED 50*HORZ_LINES*LINE_SUBDIVISION - -// -// this simulates line+frame blanking -// according to the System manual, "frame blanking bit (bit 6) of port1 becomes high -// for about 4.5 milliseconds every 20 milliseconds" -// - -TIMER_CALLBACK_MEMBER(rm380z_state::static_vblank_timer) -{ - //printf("timer callback called at [%f]\n",machine().time().as_double()); - - - m_rasterlineCtr++; - m_rasterlineCtr%=(HORZ_LINES*LINE_SUBDIVISION); - - // frame blanking - if (m_rasterlineCtr>=((HORZ_LINES-22)*LINE_SUBDIVISION)) - { - m_port1|=0x40; - } - else - { - m_port1&=~0x40; - } - - // line blanking - if ((m_rasterlineCtr%LINE_SUBDIVISION)>80) - { - m_port1|=0x80; - } - else - { - m_port1&=~0x80; - } -} - -WRITE8_MEMBER( rm380z_state::keyboard_put ) -{ - if (data) - { - m_port0_kbd = data; - m_port1 |= 1; - } -} - -// -// ports c0-cf are related to the floppy disc controller -// c0-c3: wd1771 -// c4-c8: disk drive port0 -// -// CP/M booting: -// from the service manual: "the B command reads a sector from drive 0, track 0, sector 1 into memory -// at 0x0080 to 0x00FF, then jumps to it if there is no error." -// - -WRITE8_MEMBER( rm380z_state::disk_0_control ) -{ - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - // don't know how motor on is connected - floppy->mon_w(0); - floppy->ss_w(BIT(data, 5)); - } -} - -void rm380z_state::machine_start() -{ - machine().scheduler().timer_pulse(attotime::from_hz(TIMER_SPEED), timer_expired_delegate(FUNC(rm380z_state::static_vblank_timer),this)); -} - -void rm380z_state::machine_reset() -{ - m_port0=0x00; - m_port0_kbd=0x00; - m_port1=0x00; - m_fbfd=0x00; - m_fbfe=0x00; - m_old_fbfd=0x00; - m_old_old_fbfd=0x00; - writenum=0; - - m_videomode=RM380Z_VIDEOMODE_80COL; - m_old_videomode=m_videomode; - m_rasterlineCtr=0; - - // note: from COS 4.0 videos, screen seems to show garbage at the beginning - memset(m_mainVideoram,0,RM380Z_VIDEORAM_SIZE); - - memset(m_vramattribs,0,RM380Z_SCREENSIZE); - memset(m_vramchars,0,RM380Z_SCREENSIZE); - memset(m_vram,0,RM380Z_SCREENSIZE); - - config_memory_map(); - machine().device("wd1771")->reset(); - - init_graphic_chars(); -} - -void rm380z_state::config_memory_map() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT8 *rom = memregion(RM380Z_MAINCPU_TAG)->base(); - UINT8* m_ram_p = m_messram->pointer(); - - if ( RM380Z_PORTS_ENABLED_HIGH ) - { - program.install_ram( 0x0000, 0xDFFF, m_ram_p ); - } - else - { - program.install_rom( 0x0000, 0x0FFF, rom ); - program.install_readwrite_handler(0x1BFC, 0x1BFF,read8_delegate(FUNC(rm380z_state::port_read_1b00), this),write8_delegate(FUNC(rm380z_state::port_write_1b00), this) ); - program.install_rom( 0x1C00, 0x1DFF, rom + 0x1400 ); - program.install_ram( 0x4000, 0xDFFF, m_ram_p ); - } -} diff --git a/src/mess/machine/rmnimbus.c b/src/mess/machine/rmnimbus.c deleted file mode 100644 index b8b2d79218b..00000000000 --- a/src/mess/machine/rmnimbus.c +++ /dev/null @@ -1,1718 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phill Harvey-Smith, Carl -/* - machine/rmnimbus.c - - Machine driver for the Research Machines Nimbus. - - Phill Harvey-Smith - 2009-11-29. - -*/ - -/* - - SCSI/SASI drives supported by RM Nimbus machines - -Native SCSI - format with HDFORM.EXE - -Drive Capacity Tracks Heads Sec/Track Blocks -RO652-20 20MB 306 4 34 41616 -ST225N 20MB 615 4 17 41721 -ST125N 20MB 407 4 26 41921 -8425S-30 20MB 41004 -CP3020 20MB 623 2 33 41118 -ST225NP 20MB 615 4 17 41720 -CP3040 40MB 1026 2 40 82080 - -Via Xebec S1410 SASI to MFM bridge board - format with WINFORM.EXE -NP05-10S 8MB 160 6 17 16320 -NP04-20T 16MB 320 6 17 32640 -NP03-20 15MB 306 6 17 31212 -R352-10 10MB 306 4 17 20808 -NP04-50 40MB 699 7 17 83181 -NP04-55 44MB 754 7 17 89726 - -Via Adaptec ACB4070 SCSI to RLL bridge board - format with ADAPT.EXE -NEC D5147 60MB 615 8 26 127920 -ST227R 60MB 820 6 26 127920 - -After formating, the drives need to have a partition table put on them with -STAMP.EXE and then formatted in the normal way for a dos system drive with -Format /s. - -The tracks, heads and sectors/track can be used with chdman createhd -to create a blank hard disk which can then be formatted with the RM tools. -The important thing when doing this is to make sure that if using the Native -SCSI tools, that the disk has the same number of blocks as specified above, -even if you have to use unusual geometry to do so ! -Currently, only the ST225N and ST125N can be formatted as the other native -drives and Xebec board expect the WRITE BUFFER (0x3B) and READ BUFFER (0x3C) -with mode 0 commands to be implemented and the Adaptec board uses unknown -command 0xE4. - - -for example: - -chdman createhd -o ST125N.chd -chs 41921,1,1 -ss 512 -(the actual geometry can't be used because the block count won't match) - -*/ - -#include "debugger.h" -#include "debug/debugcon.h" -#include "imagedev/flopdrv.h" -#include "includes/rmnimbus.h" - - - -/*-------------------------------------------------------------------------*/ -/* Defines, constants, and global variables */ -/*-------------------------------------------------------------------------*/ - -/* External int vectors for chained interrupts */ -#define EXTERNAL_INT_DISK 0x80 -#define EXTERNAL_INT_MSM5205 0x84 -#define EXTERNAL_INT_MOUSE_YU 0x88 -#define EXTERNAL_INT_MOUSE_YD 0x89 -#define EXTERNAL_INT_MOUSE_XL 0x8A -#define EXTERNAL_INT_MOUSE_XR 0x8B -#define EXTERNAL_INT_PC8031_8C 0x8c -#define EXTERNAL_INT_PC8031_8E 0x8E -#define EXTERNAL_INT_PC8031_8F 0x8F - -#define HDC_DRQ_MASK 0x40 -#define FDC_SIDE() ((m_nimbus_drives.reg400 & 0x10) >> 4) -#define FDC_MOTOR() ((m_nimbus_drives.reg400 & 0x20) >> 5) -#define FDC_DRIVE() (fdc_driveno(m_nimbus_drives.reg400 & 0x0f)) -#define HDC_DRQ_ENABLED() ((m_nimbus_drives.reg400 & 0x40) ? 1 : 0) -#define FDC_DRQ_ENABLED() ((m_nimbus_drives.reg400 & 0x80) ? 1 : 0) - -/* 8031/8051 Peripheral controller */ - -#define IPC_OUT_ADDR 0X01 -#define IPC_OUT_READ_PEND 0X02 -#define IPC_OUT_BYTE_AVAIL 0X04 - -#define IPC_IN_ADDR 0X01 -#define IPC_IN_BYTE_AVAIL 0X02 -#define IPC_IN_READ_PEND 0X04 - -/* IO unit */ - -#define DISK_INT_ENABLE 0x01 -#define MSM5205_INT_ENABLE 0x04 -#define MOUSE_INT_ENABLE 0x08 -#define PC8031_INT_ENABLE 0x10 - -enum -{ - MOUSE_PHASE_STATIC = 0, - MOUSE_PHASE_POSITIVE, - MOUSE_PHASE_NEGATIVE -}; - -#define MOUSE_INT_ENABLED(state) (((state)->m_iou_reg092 & MOUSE_INT_ENABLE) ? 1 : 0) - -#define LINEAR_ADDR(seg,ofs) ((seg<<4)+ofs) - -#define OUTPUT_SEGOFS(mess,seg,ofs) logerror("%s=%04X:%04X [%08X]\n",mess,seg,ofs,((seg<<4)+ofs)) - -#define LOG_SIO 0 -#define LOG_DISK_HDD 0 -#define LOG_DISK 0 -#define LOG_PC8031 0 -#define LOG_PC8031_186 0 -#define LOG_PC8031_PORT 0 -#define LOG_IOU 0 -#define LOG_RAM 0 - -/* Debugging */ - -#define DEBUG_SET(flags) ((m_debug_machine & (flags))==(flags)) -#define DEBUG_SET_STATE(flags) ((state->m_debug_machine & (flags))==(flags)) - -#define DEBUG_NONE 0x0000000 -#define DECODE_BIOS 0x0000002 -#define DECODE_BIOS_RAW 0x0000004 -#define DECODE_DOS21 0x0000008 - -/* Nimbus sub-bios structures for debugging */ - -struct t_area_params -{ - UINT16 ofs_brush; - UINT16 seg_brush; - UINT16 ofs_data; - UINT16 seg_data; - UINT16 count; -}; - -struct t_plot_string_params -{ - UINT16 ofs_font; - UINT16 seg_font; - UINT16 ofs_data; - UINT16 seg_data; - UINT16 x; - UINT16 y; - UINT16 length; -}; - -struct t_nimbus_brush -{ - UINT16 style; - UINT16 style_index; - UINT16 colour1; - UINT16 colour2; - UINT16 transparency; - UINT16 boundary_spec; - UINT16 boundary_colour; - UINT16 save_colour; -}; - - -static void nimbus_debug(running_machine &machine, int ref, int params, const char *param[]); - -static int instruction_hook(device_t &device, offs_t curpc); -static void decode_subbios(device_t *device,offs_t pc, UINT8 raw_flag); -static void decode_dos21(device_t *device,offs_t pc); -static void decode_dssi_generic(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); -static void decode_dssi_f_fill_area(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); -static void decode_dssi_f_plot_character_string(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); -static void decode_dssi_f_set_new_clt(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); -static void decode_dssi_f_plonk_char(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); -static void decode_dssi_f_rw_sectors(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); - -void rmnimbus_state::external_int(UINT8 vector, bool state) -{ - if(!state && (vector != m_vector)) - return; - - m_vector = vector; - - m_maincpu->int0_w(state); -} - -READ8_MEMBER(rmnimbus_state::cascade_callback) -{ - m_maincpu->int0_w(0); - return m_vector; -} - -void rmnimbus_state::machine_reset() -{ - /* CPU */ - iou_reset(); - fdc_reset(); - hdc_reset(); - pc8031_reset(); - rmni_sound_reset(); - memory_reset(); - mouse_js_reset(); - - /* USER VIA 6522 port B is connected to the BBC user port */ - m_via->write_pb0(1); - m_via->write_pb1(1); - m_via->write_pb2(1); - m_via->write_pb3(1); - m_via->write_pb4(1); - m_via->write_pb5(1); - m_via->write_pb6(1); - m_via->write_pb7(1); -} - -void rmnimbus_state::machine_start() -{ - m_nimbus_mouse.m_mouse_timer=timer_alloc(TIMER_MOUSE); - - /* setup debug commands */ - if (machine().debug_flags & DEBUG_FLAG_ENABLED) - { - debug_console_register_command(machine(), "nimbus_debug", CMDFLAG_NONE, 0, 0, 1, nimbus_debug); - - /* set up the instruction hook */ - m_maincpu->debug()->set_instruction_hook(instruction_hook); - } - - m_debug_machine=DEBUG_NONE; - m_fdc->dden_w(0); -} - -static void nimbus_debug(running_machine &machine, int ref, int params, const char *param[]) -{ - rmnimbus_state *state = machine.driver_data(); - if(params>0) - { - int temp; - sscanf(param[0],"%d",&temp); state->m_debug_machine = temp; - } - else - { - debug_console_printf(machine,"Error usage : nimbus_debug \n"); - debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_machine); - } -} - -/*----------------------------------------------- - instruction_hook - per-instruction hook ------------------------------------------------*/ - -static int instruction_hook(device_t &device, offs_t curpc) -{ - rmnimbus_state *state = device.machine().driver_data(); - address_space &space = device.memory().space(AS_PROGRAM); - UINT8 *addr_ptr; - - addr_ptr = (UINT8*)space.get_read_ptr(curpc); - - if ((addr_ptr !=NULL) && (addr_ptr[0]==0xCD)) - { - if(DEBUG_SET_STATE(DECODE_BIOS) && (addr_ptr[1]==0xF0)) - { - if(DEBUG_SET_STATE(DECODE_BIOS_RAW)) - decode_subbios(&device,curpc,1); - else - decode_subbios(&device,curpc,0); - } - - if(DEBUG_SET_STATE(DECODE_DOS21) && (addr_ptr[1]==0x21)) - decode_dos21(&device,curpc); - } - - return 0; -} - -#define set_type(type_name) sprintf(type_str,type_name) -#define set_drv(drv_name) sprintf(drv_str,drv_name) -#define set_func(func_name) sprintf(func_str,func_name) - -static void decode_subbios(device_t *device,offs_t pc, UINT8 raw_flag) -{ - char type_str[80]; - char drv_str[80]; - char func_str[80]; - - void (*dump_dssi)(device_t *,UINT16, UINT16 ,UINT8) = NULL; - - device_t *cpu = device->machine().device(MAINCPU_TAG); - - UINT16 ax = cpu->state().state_int(I8086_AX); - UINT16 bx = cpu->state().state_int(I8086_BX); - UINT16 cx = cpu->state().state_int(I8086_CX); - UINT16 ds = cpu->state().state_int(I8086_DS); - UINT16 si = cpu->state().state_int(I8086_SI); - - // *** TEMP Don't show f_enquire_display_line calls ! - if((cx==6) && (ax==43)) - return; - // *** END TEMP - - if(!raw_flag) - { - logerror("=======================================================================\n"); - logerror("Sub-bios call at %08X, AX=%04X, BX=%04X, CX=%04X, DS:SI=%04X:%04X\n",pc,ax,bx,cx,ds,si); - } - - set_type("invalid"); - set_drv("invalid"); - set_func("invalid"); - - switch (cx) - { - case 0 : - { - set_type("t_mummu"); - set_drv("d_mummu"); - - switch (ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_add_type_code"); break; - case 2 : set_func("f_del_typc_code"); break; - case 3 : set_func("f_get_TCB"); break; - case 4 : set_func("f_add_driver_code"); break; - case 5 : set_func("f_del_driver_code"); break; - case 6 : set_func("f_get_DCB"); break; - case 7 : set_func("f_get_copyright"); break; - } - }; break; - - case 1 : - { - set_type("t_character"); - set_drv("d_printer"); - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_get_output_status"); break; - case 2 : set_func("f_output_character"); break; - case 3 : set_func("f_get_input_status"); break; - case 4 : set_func("f_get_and_remove"); break; - case 5 : set_func("f_get_no_remove"); break; - case 6 : set_func("f_get_last_and_remove"); break; - case 7 : set_func("f_get_last_no_remove"); break; - case 8 : set_func("f_set_IO_parameters"); break; - } - }; break; - - case 2 : - { - set_type("t_disk"); - - switch(bx) - { - case 0 : set_drv("d_floppy"); break; - case 1 : set_drv("d_winchester"); break; - case 2 : set_drv("d_tape"); break; - case 3 : set_drv("d_rompack"); break; - case 4 : set_drv("d_eeprom"); break; - } - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_initialise_unit"); break; - case 2 : set_func("f_pseudo_init_unit"); break; - case 3 : set_func("f_get_device_status"); break; - case 4 : set_func("f_read_n_sectors"); dump_dssi=&decode_dssi_f_rw_sectors; break; - case 5 : set_func("f_write_n_sectors"); dump_dssi=&decode_dssi_f_rw_sectors; break; - case 6 : set_func("f_verify_n_sectors"); break; - case 7 : set_func("f_media_check"); break; - case 8 : set_func("f_recalibrate"); break; - case 9 : set_func("f_motors_off"); break; - } - dump_dssi=&decode_dssi_f_rw_sectors; - - }; break; - - case 3 : - { - set_type("t_piconet"); - set_drv("d_piconet"); - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_get_slave_status"); break; - case 2 : set_func("f_get_slave_map"); break; - case 3 : set_func("f_change_slave_addr"); break; - case 4 : set_func("f_read_slave_control"); break; - case 5 : set_func("f_write_slave_control"); break; - case 6 : set_func("f_send_data_byte"); break; - case 7 : set_func("f_request_data_byte"); break; - case 8 : set_func("f_send_data_block"); break; - case 9 : set_func("f_request_data_block"); break; - case 10 : set_func("f_reset_slave"); break; - - } - }; break; - - case 4 : - { - set_type("t_tick"); - set_drv("d_tick"); - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_ticks_per_second"); break; - case 2 : set_func("f_link_tick_routine"); break; - case 3 : set_func("f_unlink_tick_routine"); break; - } - }; break; - - case 5 : - { - set_type("t_graphics_input"); - - switch(bx) - { - case 0 : set_drv("d_mouse"); break; - case 1 : set_drv("d_joystick_1"); break; - case 2 : set_drv("d_joystick_2"); break; - } - - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_graphics_input_cold_start"); break; - case 2 : set_func("f_graphics_input_device_off"); break; - case 3 : set_func("f_return_button_status"); break; - case 4 : set_func("f_return_switch_and_button_stat"); break; - case 5 : set_func("f_start_tracking"); break; - case 6 : set_func("f_stop_tracking"); break; - case 7 : set_func("f_enquire_position"); break; - case 8 : set_func("f_set_position"); break; - - case 10 : set_func("f_return_button_press_info"); break; - case 11 : set_func("f_return_button_release_info"); break; - case 12 : set_func("f_set_gain/f_set_squeaks_per_pixel_ratio"); break; - case 13 : set_func("f_enquire_graphics_in_misc_data"); break; - } - }; break; - - case 6 : - { - set_type("t_graphics_output"); - set_drv("d_ngc_screen"); - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_graphics_output_cold_start"); break; - case 2 : set_func("f_graphics_output_warm_start"); break; - case 3 : set_func("f_graphics_output_off"); break; - case 4 : set_func("f_reinit_graphics_output"); break; - case 5 : set_func("f_polymarker"); break; - case 6 : set_func("f_polyline"); dump_dssi=&decode_dssi_f_fill_area; break; - case 7 : set_func("f_fill_area"); dump_dssi=&decode_dssi_f_fill_area; break; - case 8 : set_func("f_flood_fill_area"); break; - case 9 : set_func("f_plot_character_string"); dump_dssi=&decode_dssi_f_plot_character_string; break; - case 10 : set_func("f_define_graphics_clipping_area"); break; - case 11 : set_func("f_enquire_clipping_area_limits"); break; - case 12 : set_func("f_select_graphics_clipping_area"); break; - case 13 : set_func("f_enq_selctd_graphics_clip_area"); break; - case 14 : set_func("f_set_clt_element"); break; - case 15 : set_func("f_enquire_clt_element"); break; - case 16 : set_func("f_set_new_clt"); dump_dssi=&decode_dssi_f_set_new_clt; break; - case 17 : set_func("f_enquire_clt_contents"); break; - case 18 : set_func("f_define_dithering_pattern"); break; - case 19 : set_func("f_enquire_dithering_pattern"); break; - case 20 : set_func("f_draw_sprite"); break; - case 21 : set_func("f_move_sprite"); break; - case 22 : set_func("f_erase_sprite"); break; - case 23 : set_func("f_read_pixel"); break; - case 24 : set_func("f_read_to_limit"); break; - case 25 : set_func("f_read_area_pixel"); break; - case 26 : set_func("f_write_area_pixel"); break; - case 27 : set_func("f_copy_area_pixel"); break; - - case 29 : set_func("f_read_area_word"); break; - case 30 : set_func("f_write_area_word"); break; - case 31 : set_func("f_copy_area_word"); break; - case 32 : set_func("f_swap_area_word"); break; - case 33 : set_func("f_set_border_colour"); break; - case 34 : set_func("f_enquire_border_colour"); break; - case 35 : set_func("f_enquire_miscellaneous_data"); break; - case 36 : set_func("f_circle"); break; - - case 38 : set_func("f_arc_of_ellipse"); break; - case 39 : set_func("f_isin"); break; - case 40 : set_func("f_icos"); break; - case 41 : set_func("f_define_hatching_pattern"); break; - case 42 : set_func("f_enquire_hatching_pattern"); break; - case 43 : set_func("f_enquire_display_line"); break; - case 44 : set_func("f_plonk_logo"); break; - } - }; break; - - case 7 : - { - set_type("t_zend"); - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - } - }; break; - - case 8 : - { - set_type("t_zep"); - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - } - }; break; - - case 9 : - { - set_type("t_raw_console"); - - switch(bx) - { - case 0 : - { - set_drv("d_screen"); - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_plonk_char"); dump_dssi=decode_dssi_f_plonk_char; break; - case 2 : set_func("f_plonk_cursor"); break; - case 3 : set_func("f_kill_cursor"); break; - case 4 : set_func("f_scroll"); break; - case 5 : set_func("f_width"); dump_dssi=decode_dssi_generic;break; - case 6 : set_func("f_get_char_set"); break; - case 7 : set_func("f_set_char_set"); break; - case 8 : set_func("f_reset_char_set"); break; - case 9 : set_func("f_set_plonk_parameters"); break; - case 10 : set_func("f_set_cursor_flash_rate"); break; - } - }; break; - - case 1 : - { - set_drv("d_keyboard"); - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_init_keyboard"); break; - case 2 : set_func("f_get_last_key_code"); break; - case 3 : set_func("f_get_bitmap"); break; - } - }; break; - } - }; break; - - case 10 : - { - set_type("t_acoustics"); - - switch(bx) - { - case 0 : - { - set_drv("d_sound"); - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_sound_enable"); break; - case 2 : set_func("f_play_note"); break; - case 3 : set_func("f_get_queue_status"); break; - } - }; break; - - case 1 : - { - set_drv("d_voice"); - - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - case 1 : set_func("f_talk"); break; - case 2 : set_func("f_wait_and_talk"); break; - case 3 : set_func("f_test_talking"); break; - } - } - } - }; break; - - case 11 : - { - set_type("t_hard_sums"); - switch(ax) - { - case 0 : set_func("f_get_version_number"); break; - } - }; break; - } - - if(raw_flag) - { - if(dump_dssi!=NULL) - dump_dssi(device,ds,si,raw_flag); - } - else - { - logerror("Type=%s, Driver=%s, Function=%s\n",type_str,drv_str,func_str); - - if(dump_dssi!=NULL) - dump_dssi(device,ds,si,raw_flag); - logerror("=======================================================================\n"); - } -} - -static inline void *get_dssi_ptr(address_space &space, UINT16 ds, UINT16 si) -{ - int addr; - - addr=((ds<<4)+si); -// OUTPUT_SEGOFS("DS:SI",ds,si); - - return space.get_read_ptr(addr); -} - -static void decode_dssi_generic(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) -{ - rmnimbus_state *state = device->machine().driver_data(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - UINT16 *params; - int count; - - if(raw_flag) - return; - - params=(UINT16 *)get_dssi_ptr(space,ds,si); - - for(count=0; count<10; count++) - logerror("%04X ",params[count]); - - logerror("\n"); -} - - -static void decode_dssi_f_fill_area(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) -{ - rmnimbus_state *state = device->machine().driver_data(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - - UINT16 *addr_ptr; - t_area_params *area_params; - t_nimbus_brush *brush; - int cocount; - - area_params = (t_area_params *)get_dssi_ptr(space,ds,si); - - if (!raw_flag) - OUTPUT_SEGOFS("SegBrush:OfsBrush",area_params->seg_brush,area_params->ofs_brush); - - brush=(t_nimbus_brush *)space.get_read_ptr(LINEAR_ADDR(area_params->seg_brush,area_params->ofs_brush)); - - if(raw_flag) - { - logerror("\tdw\t%04X, %04X, %04X, %04X, %04X, %04X, %04X, %04X, %04X, ", - brush->style,brush->style_index,brush->colour1,brush->colour2, - brush->transparency,brush->boundary_spec,brush->boundary_colour,brush->save_colour, - area_params->count); - } - else - { - logerror("Brush params\n"); - logerror("Style=%04X, StyleIndex=%04X\n",brush->style,brush->style_index); - logerror("Colour1=%04X, Colour2=%04X\n",brush->colour1,brush->colour2); - logerror("transparency=%04X, boundry_spec=%04X\n",brush->transparency,brush->boundary_spec); - logerror("boundry colour=%04X, save colour=%04X\n",brush->boundary_colour,brush->save_colour); - - - OUTPUT_SEGOFS("SegData:OfsData",area_params->seg_data,area_params->ofs_data); - } - - addr_ptr = (UINT16 *)space.get_read_ptr(LINEAR_ADDR(area_params->seg_data,area_params->ofs_data)); - for(cocount=0; cocount < area_params->count; cocount++) - { - if(raw_flag) - { - if(cocount!=(area_params->count-1)) - logerror("%04X, %04X, ",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); - else - logerror("%04X, %04X ",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); - } - else - logerror("x=%d y=%d\n",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); - } - - if(raw_flag) - logerror("\n"); -} - -static void decode_dssi_f_plot_character_string(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) -{ - rmnimbus_state *state = device->machine().driver_data(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - - UINT8 *char_ptr; - t_plot_string_params *plot_string_params; - int charno; - - if(raw_flag) - return; - - plot_string_params=(t_plot_string_params *)get_dssi_ptr(space,ds,si); - - OUTPUT_SEGOFS("SegFont:OfsFont",plot_string_params->seg_font,plot_string_params->ofs_font); - OUTPUT_SEGOFS("SegData:OfsData",plot_string_params->seg_data,plot_string_params->ofs_data); - - logerror("x=%d, y=%d, length=%d\n",plot_string_params->x,plot_string_params->y,plot_string_params->length); - - char_ptr=(UINT8*)space.get_read_ptr(LINEAR_ADDR(plot_string_params->seg_data,plot_string_params->ofs_data)); - - if (plot_string_params->length==0xFFFF) - logerror("%s",char_ptr); - else - for(charno=0;charnolength;charno++) - logerror("%c",char_ptr[charno]); - - logerror("\n"); -} - -static void decode_dssi_f_set_new_clt(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) -{ - rmnimbus_state *state = device->machine().driver_data(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - UINT16 *new_colours; - int colour; - new_colours=(UINT16 *)get_dssi_ptr(space,ds,si); - - if(raw_flag) - return; - - OUTPUT_SEGOFS("SegColours:OfsColours",ds,si); - - for(colour=0;colour<16;colour++) - logerror("colour #%02X=%04X\n",colour,new_colours[colour]); - -} - -static void decode_dssi_f_plonk_char(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) -{ - rmnimbus_state *state = device->machine().driver_data(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - UINT16 *params; - params=(UINT16 *)get_dssi_ptr(space,ds,si); - - if(raw_flag) - return; - - OUTPUT_SEGOFS("SegParams:OfsParams",ds,si); - - logerror("plonked_char=%c\n",params[0]); -} - -static void decode_dssi_f_rw_sectors(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) -{ - rmnimbus_state *state = device->machine().driver_data(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - UINT16 *params; - int param_no; - - if(raw_flag) - return; - - params=(UINT16 *)get_dssi_ptr(space,ds,si); - - for(param_no=0;param_no<16;param_no++) - logerror("%04X ",params[param_no]); - - logerror("\n"); -} - -static void decode_dos21(device_t *device,offs_t pc) -{ - device_t *cpu = device->machine().device(MAINCPU_TAG); - - UINT16 ax = cpu->state().state_int(I8086_AX); - UINT16 bx = cpu->state().state_int(I8086_BX); - UINT16 cx = cpu->state().state_int(I8086_CX); - UINT16 dx = cpu->state().state_int(I8086_DX); - UINT16 cs = cpu->state().state_int(I8086_CS); - UINT16 ds = cpu->state().state_int(I8086_DS); - UINT16 es = cpu->state().state_int(I8086_ES); - UINT16 ss = cpu->state().state_int(I8086_SS); - - UINT16 si = cpu->state().state_int(I8086_SI); - UINT16 di = cpu->state().state_int(I8086_DI); - UINT16 bp = cpu->state().state_int(I8086_BP); - - logerror("=======================================================================\n"); - logerror("DOS Int 0x21 call at %05X\n",pc); - logerror("AX=%04X, BX=%04X, CX=%04X, DX=%04X\n",ax,bx,cx,dx); - logerror("CS=%04X, DS=%04X, ES=%04X, SS=%04X\n",cs,ds,es,ss); - logerror("SI=%04X, DI=%04X, BP=%04X\n",si,di,bp); - logerror("=======================================================================\n"); -} - - -/* - The Nimbus has 3 banks of memory each of which can be either 16x4164 or 16x41256 giving - 128K or 512K per bank. These banks are as follows : - - bank0 on nimbus motherboard. - bank1 first half of expansion card. - bank2 second half of expansion card. - - The valid combinations are : - - bank0 bank1 bank2 total - 128K 128K - 128K 128K 256K - 128K 128K 128K 384K - 128K 512K 640K (1) - 512K 128K 640K (2) - 512K 512K 1024K - 512K 512K 512K 1536K - - It will be noted that there are two possible ways of getting 640K, we emulate method 2 - (above). - - To allow for the greatest flexibility, the Nimbus allows 4 methods of mapping the - banks of ram into the 1M addressable by the 81086. - - With only 128K banks present, they are mapped into the first 3 blocks of 128K in - the memory map giving a total of up to 384K. - - If any of the blocks are 512K, then the block size is set to 512K and the map arranged - so that the bottom block is a 512K block (if both 512K and 128K blocks are available). - - This is all determined by the value written to port 80 :- - - port80 = 0x07 start end - block0 0x00000 0x1FFFF - block1 0x20000 0x3FFFF - block2 0x40000 0x5FFFF - - port80 = 0x1F - block0 0x00000 0x7FFFF - block1 0x80000 0xEFFFF (0x9FFFF if 128K (2)) - - port80 = 0x0F - block1 0x00000 0x7FFFF - block0 0x80000 0xEFFFF (0x9FFFF if 128K (1)) - - port80 = 0x17 - block1 0x00000 0x7FFFF - block2 0x80000 0xEFFFF - -*/ - -struct nimbus_meminfo -{ - offs_t start; /* start address of bank */ - offs_t end; /* End address of bank */ -}; - -static const struct nimbus_meminfo memmap[] = -{ - { 0x00000, 0x1FFFF }, - { 0x20000, 0x3FFFF }, - { 0x40000, 0x5FFFF }, - { 0x60000, 0x7FFFF }, - { 0x80000, 0x9FFFF }, - { 0xA0000, 0xBFFFF }, - { 0xC0000, 0xDFFFF }, - { 0xE0000, 0xEFFFF } -}; - -struct nimbus_block -{ - int blockbase; - int blocksize; -}; - -typedef nimbus_block nimbus_blocks[3]; - -static const nimbus_blocks ramblocks[] = -{ - {{ 0, 128 }, { 000, 000 }, { 000, 000 }} , - {{ 0, 128 }, { 128, 128 }, { 000, 000 }} , - {{ 0, 128 }, { 128, 128 }, { 256, 128 }} , - {{ 0, 512 }, { 000, 000 }, { 000, 000 }} , - {{ 0, 512 }, { 512, 128 }, { 000, 000 }} , - {{ 0, 512 }, { 512, 512 }, { 000, 000 }} , - {{ 0, 512 }, { 512, 512 }, { 1024, 512 } } -}; - -void rmnimbus_state::nimbus_bank_memory() -{ - address_space &space = machine().device( MAINCPU_TAG)->memory().space( AS_PROGRAM ); - int ramsize = m_ram->size(); - int ramblock = 0; - int blockno; - char bank[10]; - UINT8 *ram = &m_ram->pointer()[0]; - UINT8 *map_blocks[3]; - UINT8 *map_base; - int map_blockno; - int block_ofs; - - UINT8 ramsel = (m_mcu_reg080 & 0x1F); - - // Invalid ramsel, return. - if((ramsel & 0x07)!=0x07) - return; - - switch (ramsize / 1024) - { - case 128 : ramblock=0; break; - case 256 : ramblock=1; break; - case 384 : ramblock=2; break; - case 512 : ramblock=3; break; - case 640 : ramblock=4; break; - case 1024 : ramblock=5; break; - case 1536 : ramblock=6; break; - } - - map_blocks[0] = ram; - map_blocks[1] = (ramblocks[ramblock][1].blocksize==0) ? NULL : &ram[ramblocks[ramblock][1].blockbase*1024]; - map_blocks[2] = (ramblocks[ramblock][2].blocksize==0) ? NULL : &ram[ramblocks[ramblock][2].blockbase*1024]; - - //if(LOG_RAM) logerror("\n\nmcu_reg080=%02X, ramblock=%d, map_blocks[0]=%X, map_blocks[1]=%X, map_blocks[2]=%X\n",m_mcu_reg080,ramblock,(int)map_blocks[0],(int)map_blocks[1],(int)map_blocks[2]); - - for(blockno=0;blockno<8;blockno++) - { - sprintf(bank,"bank%d",blockno); - - switch (ramsel) - { - case 0x07 : (blockno<3) ? map_blockno=blockno : map_blockno=-1; break; - case 0x1F : (blockno<4) ? map_blockno=0 : map_blockno=1; break; - case 0x0F : (blockno<4) ? map_blockno=1 : map_blockno=0; break; - case 0x17 : (blockno<4) ? map_blockno=1 : map_blockno=2; break; - default : map_blockno=-1; - } - block_ofs=(ramsel==0x07) ? 0 : ((blockno % 4)*128); - - - if(LOG_RAM) logerror("mapped %s",bank); - - if((map_blockno>-1) && (block_ofs < ramblocks[ramblock][map_blockno].blocksize) && - (map_blocks[map_blockno]!=NULL)) - { - map_base=(ramsel==0x07) ? map_blocks[map_blockno] : &map_blocks[map_blockno][block_ofs*1024]; - - membank(bank)->set_base(map_base); - space.install_readwrite_bank(memmap[blockno].start, memmap[blockno].end, bank); - //if(LOG_RAM) logerror(", base=%X\n",(int)map_base); - } - else - { - space.nop_readwrite(memmap[blockno].start, memmap[blockno].end); - if(LOG_RAM) logerror("NOP\n"); - } - } -} - -READ8_MEMBER(rmnimbus_state::nimbus_mcu_r) -{ - return m_mcu_reg080; -} - -WRITE8_MEMBER(rmnimbus_state::nimbus_mcu_w) -{ - m_mcu_reg080=data; - - nimbus_bank_memory(); -} - -void rmnimbus_state::memory_reset() -{ - m_mcu_reg080=0x07; - nimbus_bank_memory(); -} - -/* - -Z80SIO, used for the keyboard interface - -*/ - -/* Z80 SIO/2 */ - -WRITE_LINE_MEMBER(rmnimbus_state::sio_interrupt) -{ - if(LOG_SIO) - logerror("SIO Interrupt state=%02X\n",state); - - external_int(m_z80sio->m1_r(), state); -} - -/* Floppy disk */ - -void rmnimbus_state::fdc_reset() -{ - m_nimbus_drives.reg400=0; - m_scsi_ctrl_out->write(0); -} - -WRITE_LINE_MEMBER(rmnimbus_state::nimbus_fdc_intrq_w) -{ - if(LOG_DISK) - logerror("nimbus_drives_intrq = %d\n",state); - - if(m_iou_reg092 & DISK_INT_ENABLE) - { - external_int(EXTERNAL_INT_DISK,state); - } -} - -WRITE_LINE_MEMBER(rmnimbus_state::nimbus_fdc_drq_w) -{ - if(LOG_DISK) - logerror("nimbus_drives_drq_w(%d)\n", state); - - m_maincpu->drq1_w(state && FDC_DRQ_ENABLED()); -} - -UINT8 rmnimbus_state::fdc_driveno(UINT8 drivesel) -{ - switch (drivesel) - { - case 0x01: return 0; - case 0x02: return 1; - case 0x04: return 2; - case 0x08: return 3; - case 0x10: return 4; - case 0x20: return 5; - case 0x40: return 6; - case 0x80: return 7; - default: return 0; - } -} - -/* - 0x410 read bits - - 0 Ready from floppy - 1 Index pulse from floppy - 2 Motor on from floppy - 3 MSG from HDD - 4 !BSY from HDD - 5 !I/O from HDD - 6 !C/D - 7 !REQ from HDD -*/ - -READ8_MEMBER(rmnimbus_state::scsi_r) -{ - int result = 0; - - int pc=space.device().safe_pc(); - char drive[5]; - floppy_image_device *floppy; - - sprintf(drive, "%d", FDC_DRIVE()); - floppy = m_fdc->subdevice(drive)->get_device(); - - switch(offset*2) - { - case 0x00 : - result |= m_scsi_req << 7; - result |= m_scsi_cd << 6; - result |= m_scsi_io << 5; - result |= m_scsi_bsy << 4; - result |= !m_scsi_msg << 3; - if(floppy) - { - result |= FDC_MOTOR() << 2; - result |= (!floppy->idx_r()) << 1; - result |= floppy->ready_r() << 0; - } - break; - case 0x08 : - result = m_scsi_data_in->read(); - hdc_post_rw(); - default: - break; - } - - if(LOG_DISK_HDD) - logerror("Nimbus HDCR at pc=%08X from %04X data=%02X\n",pc,(offset*2)+0x410,result); - - return result; -} - -/* - 0x400 write bits - - 0 drive 0 select - 1 drive 1 select - 2 drive 2 select - 3 drive 3 select - 4 side select - 5 fdc motor on - 6 hdc drq enabled - 7 fdc drq enabled -*/ -WRITE8_MEMBER(rmnimbus_state::fdc_ctl_w) -{ - UINT8 reg400_old = m_nimbus_drives.reg400; - char drive[5]; - floppy_image_device *floppy; - - m_nimbus_drives.reg400 = data; - - sprintf(drive, "%d", FDC_DRIVE()); - floppy = m_fdc->subdevice(drive)->get_device(); - - m_fdc->set_floppy(floppy); - if(floppy) - { - floppy->ss_w(FDC_SIDE()); - floppy->mon_w(!FDC_MOTOR()); - } - - // if we enable hdc drq with a pending condition, act on it - if((data & HDC_DRQ_MASK) && (~reg400_old & HDC_DRQ_MASK)) - hdc_drq(true); -} - -/* - 0x410 write bits - - 0 SCSI reset - 1 SCSI SEL - 2 SCSI IRQ Enable -*/ - -WRITE8_MEMBER(rmnimbus_state::scsi_w) -{ - int pc=space.device().safe_pc(); - - if(LOG_DISK_HDD) - logerror("Nimbus HDCW at %05X write of %02X to %04X\n",pc,data,(offset*2)+0x410); - - switch(offset*2) - { - case 0x00 : - m_scsi_ctrl_out->write(data); - break; - - case 0x08 : - m_scsi_data_out->write(data); - hdc_post_rw(); - break; - } -} - -void rmnimbus_state::hdc_reset() -{ - m_scsi_iena = 0; - m_scsi_msg = 0; - m_scsi_bsy = 0; - m_scsi_io = 0; - m_scsi_cd = 0; - m_scsi_req = 0; -} - -void rmnimbus_state::check_scsi_irq() -{ - nimbus_fdc_intrq_w(m_scsi_io && m_scsi_cd && m_scsi_req && m_scsi_iena); -} - -WRITE_LINE_MEMBER(rmnimbus_state::write_scsi_iena) -{ - m_scsi_iena = state; - check_scsi_irq(); -} - -void rmnimbus_state::hdc_post_rw() -{ - if(m_scsi_req) - m_scsibus->write_ack(1); -} - -void rmnimbus_state::hdc_drq(bool state) -{ - m_maincpu->drq1_w(HDC_DRQ_ENABLED() && !m_scsi_cd && state); -} - -WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_bsy ) -{ - m_scsi_bsy = state; -} - -WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_cd ) -{ - m_scsi_cd = state; - check_scsi_irq(); -} - -WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_io ) -{ - m_scsi_io = state; - - if (m_scsi_io) - { - m_scsi_data_out->write(0); - } - check_scsi_irq(); -} - -WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_msg ) -{ - m_scsi_msg = state; -} - -WRITE_LINE_MEMBER( rmnimbus_state::write_scsi_req ) -{ - int last = m_scsi_req; - m_scsi_req = state; - - if (state) - { - if (!m_scsi_cd && !last) - { - hdc_drq(true); - } - } - else - { - hdc_drq(false); - m_scsibus->write_ack(0); - } - check_scsi_irq(); -} - -/* 8031/8051 Peripheral controler 80186 side */ - -void rmnimbus_state::pc8031_reset() -{ - logerror("peripheral controler reset\n"); - - memset(&m_ipc_interface,0,sizeof(m_ipc_interface)); -} - - -#if 0 -void rmnimbus_state::ipc_dumpregs() -{ - logerror("in_data=%02X, in_status=%02X, out_data=%02X, out_status=%02X\n", - m_ipc_interface.ipc_in, m_ipc_interface.status_in, - m_ipc_interface.ipc_out, m_ipc_interface.status_out); - -} -#endif - -READ8_MEMBER(rmnimbus_state::nimbus_pc8031_r) -{ - int pc=space.device().safe_pc(); - UINT8 result; - - switch(offset*2) - { - case 0x00 : result=m_ipc_interface.ipc_out; - m_ipc_interface.status_in &= ~IPC_IN_READ_PEND; - m_ipc_interface.status_out &= ~IPC_OUT_BYTE_AVAIL; - break; - - case 0x02 : result=m_ipc_interface.status_out; - break; - - default : result=0; break; - } - - if(LOG_PC8031_186) - logerror("Nimbus PCIOR %08X read of %04X returns %02X\n",pc,(offset*2)+0xC0,result); - - return result; -} - -WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_w) -{ - int pc=space.device().safe_pc(); - - switch(offset*2) - { - case 0x00 : m_ipc_interface.ipc_in=data; - m_ipc_interface.status_in |= IPC_IN_BYTE_AVAIL; - m_ipc_interface.status_in &= ~IPC_IN_ADDR; - m_ipc_interface.status_out |= IPC_OUT_READ_PEND; - break; - - case 0x02 : m_ipc_interface.ipc_in=data; - m_ipc_interface.status_in |= IPC_IN_BYTE_AVAIL; - m_ipc_interface.status_in |= IPC_IN_ADDR; - m_ipc_interface.status_out |= IPC_OUT_READ_PEND; - break; - } - - if(LOG_PC8031_186) - logerror("Nimbus PCIOW %08X write of %02X to %04X\n",pc,data,(offset*2)+0xC0); - -} - -/* 8031/8051 Peripheral controler 8031/8051 side */ - -READ8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_r) -{ - int pc=space.device().safe_pc(); - UINT8 result = 0; - - switch (offset & 0x01) - { - case 0x00 : result=m_ipc_interface.ipc_in; - m_ipc_interface.status_out &= ~IPC_OUT_READ_PEND; - m_ipc_interface.status_in &= ~IPC_IN_BYTE_AVAIL; - break; - - case 0x01 : result=m_ipc_interface.status_in; - break; - } - - if(((offset==2) || (offset==3)) && (m_iou_reg092 & PC8031_INT_ENABLE)) - external_int(EXTERNAL_INT_PC8031_8C, true); - - if(LOG_PC8031) - logerror("8031: PCIOR %04X read of %04X returns %02X\n",pc,offset,result); - - return result; -} - -WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_w) -{ - int pc=space.device().safe_pc(); - - if(LOG_PC8031) - logerror("8031 PCIOW %04X write of %02X to %04X\n",pc,data,offset); - - switch(offset & 0x03) - { - case 0x00 : m_ipc_interface.ipc_out=data; - m_ipc_interface.status_out |= IPC_OUT_BYTE_AVAIL; - m_ipc_interface.status_out &= ~IPC_OUT_ADDR; - m_ipc_interface.status_in |= IPC_IN_READ_PEND; - break; - - case 0x01 : m_ipc_interface.ipc_out=data; - m_ipc_interface.status_out |= IPC_OUT_BYTE_AVAIL; - m_ipc_interface.status_out |= IPC_OUT_ADDR; - m_ipc_interface.status_in |= IPC_IN_READ_PEND; - break; - - case 0x02 : m_ipc_interface.ipc_out=data; - m_ipc_interface.status_out |= IPC_OUT_BYTE_AVAIL; - m_ipc_interface.status_out &= ~IPC_OUT_ADDR; - m_ipc_interface.status_in |= IPC_IN_READ_PEND; - if(m_iou_reg092 & PC8031_INT_ENABLE) - external_int(EXTERNAL_INT_PC8031_8F, true); - break; - - case 0x03 : m_ipc_interface.ipc_out=data; - //m_ipc_interface.status_out |= IPC_OUT_BYTE_AVAIL; - m_ipc_interface.status_out |= IPC_OUT_ADDR; - m_ipc_interface.status_in |= IPC_IN_READ_PEND; - if(m_iou_reg092 & PC8031_INT_ENABLE) - external_int(EXTERNAL_INT_PC8031_8E, true); - break; - } -} - -READ8_MEMBER(rmnimbus_state::nimbus_pc8031_port_r) -{ - int pc=space.device().safe_pc(); - UINT8 result = 0; - - if(LOG_PC8031_PORT) - logerror("8031: PCPORTR %04X read of %04X returns %02X\n",pc,offset,result); - - switch(offset) - { - case 0x01: - result = (m_eeprom_bits & ~4) | (m_eeprom->do_read() << 2); - break; - } - - return result; -} - -WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_port_w) -{ - int pc=space.device().safe_pc(); - - switch (offset) - { - case 0x01: - m_eeprom->cs_write((data & 8) ? 1 : 0); - - if(!(data & 8)) - m_eeprom_state = 0; - else if(!(data & 2) || (m_eeprom_state == 2)) - m_eeprom_state = 2; - else if((data & 8) && (!(m_eeprom_bits & 8))) - m_eeprom_state = 1; - else if((!(data & 1)) && (m_eeprom_bits & 1) && (m_eeprom_state == 1)) - m_eeprom_state = 2; //wait until 1 clk after cs rises to set di else it's seen as a start bit - - m_eeprom->di_write(((data & 2) && (m_eeprom_state == 2)) ? 1 : 0); - m_eeprom->clk_write((data & 1) ? 1 : 0); - m_eeprom_bits = data; - break; - } - - if(LOG_PC8031_PORT) - logerror("8031 PCPORTW %04X write of %02X to %04X\n",pc,data,offset); -} - - - -/* IO Unit */ -READ8_MEMBER(rmnimbus_state::nimbus_iou_r) -{ - int pc=space.device().safe_pc(); - UINT8 result=0; - - if(offset==0) - { - result=m_iou_reg092; - } - - if(LOG_IOU) - logerror("Nimbus IOUR %08X read of %04X returns %02X\n",pc,(offset*2)+0x92,result); - - return result; -} - -WRITE8_MEMBER(rmnimbus_state::nimbus_iou_w) -{ - int pc=space.device().safe_pc(); - - if(LOG_IOU) - logerror("Nimbus IOUW %08X write of %02X to %04X\n",pc,data,(offset*2)+0x92); - - if(offset==0) - { - m_iou_reg092=data; - m_msm->reset_w((data & MSM5205_INT_ENABLE) ? 0 : 1); - } -} - -void rmnimbus_state::iou_reset() -{ - m_iou_reg092=0x00; - m_eeprom_state = 0; -} - -/* - Sound hardware : AY8910 - - I believe that the IO ports of the 8910 are used to control the ROMPack ports, however - this is currently un-implemented (and may never be as I don't have any rompacks!). - - The registers are mapped as so : - - Address 0xE0 0xE2 - Read Data ???? - Write Register Address Data - -*/ - -void rmnimbus_state::rmni_sound_reset() -{ - m_msm->reset_w(1); - - m_last_playmode = MSM5205_S48_4B; - m_msm->playmode_w(m_last_playmode); - - m_ay8910_a=0; -} - -WRITE8_MEMBER(rmnimbus_state::nimbus_sound_ay8910_porta_w) -{ - m_msm->data_w(data); - - // Mouse code needs a copy of this. - m_ay8910_a=data; -} - -WRITE8_MEMBER(rmnimbus_state::nimbus_sound_ay8910_portb_w) -{ - if ((data & 0x07) != m_last_playmode) - { - m_last_playmode = (data & 0x07); - m_msm->playmode_w(m_last_playmode); - } -} - -WRITE_LINE_MEMBER(rmnimbus_state::nimbus_msm5205_vck) -{ - if(m_iou_reg092 & MSM5205_INT_ENABLE) - external_int(EXTERNAL_INT_MSM5205,state); -} - -static const int MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } }; -static const int MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } }; -//static const int MOUSE_XYA[4] = { 1, 1, 0, 0 }; -//static const int MOUSE_XYB[4] = { 0, 1, 1, 0 }; - -void rmnimbus_state::mouse_js_reset() -{ - m_nimbus_mouse.m_mouse_px=0; - m_nimbus_mouse.m_mouse_py=0; - m_nimbus_mouse.m_mouse_x=128; - m_nimbus_mouse.m_mouse_y=128; - m_nimbus_mouse.m_mouse_pc=0; - m_nimbus_mouse.m_mouse_pcx=0; - m_nimbus_mouse.m_mouse_pcy=0; - m_nimbus_mouse.m_intstate_x=0; - m_nimbus_mouse.m_intstate_y=0; - m_nimbus_mouse.m_reg0a4=0xC0; - - // Setup timer to poll the mouse - m_nimbus_mouse.m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(1000)); -} - -void rmnimbus_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - UINT8 x = 0; - UINT8 y = 0; -// int pc=m_maincpu->pc(); - - UINT8 intstate_x; - UINT8 intstate_y; - int xint; - int yint; - - m_nimbus_mouse.m_reg0a4 = m_io_mouse_button->read() | 0xC0; - x = m_io_mousex->read(); - y = m_io_mousey->read(); - - UINT8 mxa; - UINT8 mxb; - UINT8 mya; - UINT8 myb; - - //logerror("poll_mouse()\n"); - - if (x == m_nimbus_mouse.m_mouse_x) - { - m_nimbus_mouse.m_mouse_px = MOUSE_PHASE_STATIC; - } - else if (x > m_nimbus_mouse.m_mouse_x) - { - m_nimbus_mouse.m_mouse_px = MOUSE_PHASE_POSITIVE; - } - else if (x < m_nimbus_mouse.m_mouse_x) - { - m_nimbus_mouse.m_mouse_px = MOUSE_PHASE_NEGATIVE; - } - - if (y == m_nimbus_mouse.m_mouse_y) - { - m_nimbus_mouse.m_mouse_py = MOUSE_PHASE_STATIC; - } - else if (y > m_nimbus_mouse.m_mouse_y) - { - m_nimbus_mouse.m_mouse_py = MOUSE_PHASE_POSITIVE; - } - else if (y < m_nimbus_mouse.m_mouse_y) - { - m_nimbus_mouse.m_mouse_py = MOUSE_PHASE_NEGATIVE; - } - - switch (m_nimbus_mouse.m_mouse_px) - { - case MOUSE_PHASE_STATIC : break; - case MOUSE_PHASE_POSITIVE : m_nimbus_mouse.m_mouse_pcx++; break; - case MOUSE_PHASE_NEGATIVE : m_nimbus_mouse.m_mouse_pcx--; break; - } - m_nimbus_mouse.m_mouse_pcx &= 0x03; - - switch (m_nimbus_mouse.m_mouse_py) - { - case MOUSE_PHASE_STATIC : break; - case MOUSE_PHASE_POSITIVE : m_nimbus_mouse.m_mouse_pcy++; break; - case MOUSE_PHASE_NEGATIVE : m_nimbus_mouse.m_mouse_pcy--; break; - } - m_nimbus_mouse.m_mouse_pcy &= 0x03; - -// mxb = MOUSE_XYB[state.m_mouse_px][state->m_mouse_pcx]; // XB -// mxa = MOUSE_XYA[state.m_mouse_px][state->m_mouse_pcx]; // XA -// mya = MOUSE_XYA[state.m_mouse_py][state->m_mouse_pcy]; // YA -// myb = MOUSE_XYB[state.m_mouse_py][state->m_mouse_pcy]; // YB - - mxb = MOUSE_XYB[1][m_nimbus_mouse.m_mouse_pcx]; // XB - mxa = MOUSE_XYA[1][m_nimbus_mouse.m_mouse_pcx]; // XA - mya = MOUSE_XYA[1][m_nimbus_mouse.m_mouse_pcy]; // YA - myb = MOUSE_XYB[1][m_nimbus_mouse.m_mouse_pcy]; // YB - - if ((m_nimbus_mouse.m_mouse_py!=MOUSE_PHASE_STATIC) || (m_nimbus_mouse.m_mouse_px!=MOUSE_PHASE_STATIC)) - { -// logerror("mouse_px=%02X, mouse_py=%02X, mouse_pcx=%02X, mouse_pcy=%02X\n", -// state.m_mouse_px,state->m_mouse_py,state->m_mouse_pcx,state->m_mouse_pcy); - -// logerror("mxb=%02x, mxa=%02X (mxb ^ mxa)=%02X, (ay8910_a & 0xC0)=%02X, (mxb ^ mxa) ^ ((ay8910_a & 0x80) >> 7)=%02X\n", -// mxb,mxa, (mxb ^ mxa) , (state.m_ay8910_a & 0xC0), (mxb ^ mxa) ^ ((state->m_ay8910_a & 0x40) >> 6)); - } - - intstate_x = (mxb ^ mxa) ^ ((m_ay8910_a & 0x40) >> 6); - intstate_y = (myb ^ mya) ^ ((m_ay8910_a & 0x80) >> 7); - - if (MOUSE_INT_ENABLED(this)) - { - if ((intstate_x==1) && (m_nimbus_mouse.m_intstate_x==0)) -// if (intstate_x!=state.m_intstate_x) - { - xint=mxa ? EXTERNAL_INT_MOUSE_XR : EXTERNAL_INT_MOUSE_XL; - - external_int(xint, true); - -// logerror("Xint:%02X, mxb=%02X\n",xint,mxb); - } - - if ((intstate_y==1) && (m_nimbus_mouse.m_intstate_y==0)) -// if (intstate_y!=state.m_intstate_y) - { - yint=myb ? EXTERNAL_INT_MOUSE_YU : EXTERNAL_INT_MOUSE_YD; - - external_int(yint, true); -// logerror("Yint:%02X, myb=%02X\n",yint,myb); - } - } - else - { - m_nimbus_mouse.m_reg0a4 &= 0xF0; - m_nimbus_mouse.m_reg0a4 |= ( mxb & 0x01) << 3; // XB - m_nimbus_mouse.m_reg0a4 |= (~mxb & 0x01) << 2; // XA - m_nimbus_mouse.m_reg0a4 |= (~myb & 0x01) << 1; // YA - m_nimbus_mouse.m_reg0a4 |= ( myb & 0x01) << 0; // YB - } - - m_nimbus_mouse.m_mouse_x = x; - m_nimbus_mouse.m_mouse_y = y; - - if ((m_nimbus_mouse.m_mouse_py!=MOUSE_PHASE_STATIC) || (m_nimbus_mouse.m_mouse_px!=MOUSE_PHASE_STATIC)) - { -// logerror("pc=%05X, reg0a4=%02X, reg092=%02X, ay_a=%02X, x=%02X, y=%02X, px=%02X, py=%02X, intstate_x=%02X, intstate_y=%02X\n", -// pc,state.m_reg0a4,state->m_iou_reg092,state->m_ay8910_a,state->m_mouse_x,state->m_mouse_y,state->m_mouse_px,state->m_mouse_py,intstate_x,intstate_y); - } - - m_nimbus_mouse.m_intstate_x=intstate_x; - m_nimbus_mouse.m_intstate_y=intstate_y; -} - -READ8_MEMBER(rmnimbus_state::nimbus_mouse_js_r) -{ - /* - - bit description - - 0 JOY 0-Up or mouse XB - 1 JOY 0-Down or mouse XA - 2 JOY 0-Left or mouse YA - 3 JOY 0-Right or mouse YB - 4 JOY 0-b0 or mouse rbutton - 5 JOY 0-b1 or mouse lbutton - 6 ?? always reads 1 - 7 ?? always reads 1 - - */ - UINT8 result; - //int pc=m_maincpu->_pc(); - - if (m_io_config->read() & 0x01) - { - result=m_nimbus_mouse.m_reg0a4; - //logerror("mouse_js_r: pc=%05X, result=%02X\n",pc,result); - } - else - { - result = m_io_joystick0->read(); - } - - return result; -} - -WRITE8_MEMBER(rmnimbus_state::nimbus_mouse_js_w) -{ -} - -/********************************************************************** -Paralell printer / User port. -The Nimbus paralell printer port card is almost identical to the circuit -in the BBC micro, so I have borrowed the driver code from the BBC :) - -Port A output is buffered before being connected to the printer connector. -This means that they can only be operated as output lines. -CA1 is pulled high by a 4K7 resistor. CA1 normally acts as an acknowledge -line when a printer is used. CA2 is buffered so that it has become an open -collector output only. It usially acts as the printer strobe line. -***********************************************************************/ - -/* USER VIA 6522 port B is connected to the BBC user port */ -WRITE8_MEMBER(rmnimbus_state::nimbus_via_write_portb) -{ -} diff --git a/src/mess/machine/rmnkbd.c b/src/mess/machine/rmnkbd.c deleted file mode 100644 index 30987c6701e..00000000000 --- a/src/mess/machine/rmnkbd.c +++ /dev/null @@ -1,209 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#include "machine/rmnkbd.h" - -rmnimbus_keyboard_device::rmnimbus_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, RMNIMBUS_KEYBOARD, "RM Nimbus Keyboard", tag, owner, 0, "rmnimbus_keyboard", __FILE__), - m_io_kbd8(*this, "TERM_LINE8"), - m_io_kbd9(*this, "TERM_LINE9"), - m_io_kbda(*this, "TERM_LINEA") -{ -} - -UINT8 rmnimbus_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) -{ - int i = *scan_line, j; - UINT8 code = 0, change; - - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - else - if (i == 9) code = m_io_kbd9->read(); - else - if (i == 10) code = m_io_kbda->read(); - - *scan_line = (*scan_line + 1) % 11; - code = ~code; - - if(m_state[i] == code) - return 0; - - change = (m_state[i] ^ code); - - for(j = 0; j < 8; j++) - if((change >> j) == 1) break; - - change = (1 << j); - m_state[i] ^= change; - - return ((change & code) ? 0 : 0x80) | ((i << 3) + j); -} - -static INPUT_PORTS_START( rmnimbus_keyboard ) - PORT_START("TERM_LINE0") /* Key row 0 scancodes 00..07 */ - //PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - - PORT_START("TERM_LINE1") /* Key row 1 scancodes 08..0F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) - - PORT_START("TERM_LINE2") /* Key row 2 scancodes 10..17 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - - PORT_START("TERM_LINE3") /* Key row 3 scancodes 18..1F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0D) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) // Ether control - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - - PORT_START("TERM_LINE4") /* Key row 4 scancodes 20..27 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - - PORT_START("TERM_LINE5") /* Key row 5 scancodes 28..2F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("#") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSLASH") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TILDE") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - - - PORT_START("TERM_LINE6") /* Key row 6 scancodes 30..37 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRSCR") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - - PORT_START("TERM_LINE7") /* Key row 7 scancodes 38..3F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - - - PORT_START("TERM_LINE8") /* Key row 8 scancodes 40..47 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLK") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SCRLK") PORT_CODE(KEYCODE_SCRLOCK) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - - PORT_START("TERM_LINE9") /* Key row 9 scancodes 48..4F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP8") PORT_CODE(KEYCODE_8_PAD) //PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP9") PORT_CODE(KEYCODE_9_PAD) //PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP-") PORT_CODE(KEYCODE_MINUS_PAD) //PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP4") PORT_CODE(KEYCODE_4_PAD) //PORT_CHAR('4') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) //PORT_CHAR('5') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) //PORT_CHAR('6') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) //PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) //PORT_CHAR('1') - - PORT_START("TERM_LINEA") /* Key row 10 scancodes 50..57 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP2") PORT_CODE(KEYCODE_2_PAD) //PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP3") PORT_CODE(KEYCODE_3_PAD) //PORT_CHAR('3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP0") PORT_CODE(KEYCODE_0_PAD) //PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP.") PORT_CODE(KEYCODE_DEL_PAD) //PORT_CHAR('.') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - //PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - //PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - - PORT_START("TERM_LINEC") - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_9600, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_9600, "9600") - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_NONE, "None") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_1, "1") -INPUT_PORTS_END - -ioport_constructor rmnimbus_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(rmnimbus_keyboard); -} - -void rmnimbus_keyboard_device::device_start() -{ - serial_keyboard_device::device_start(); - memset(m_state, '\0', sizeof(m_state)); -} - -const device_type RMNIMBUS_KEYBOARD = &device_creator; diff --git a/src/mess/machine/rmnkbd.h b/src/mess/machine/rmnkbd.h deleted file mode 100644 index 2c299f19b15..00000000000 --- a/src/mess/machine/rmnkbd.h +++ /dev/null @@ -1,28 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl -#ifndef RMNKBD_H_ -#define RMNKBD_H_ - -#include "bus/rs232/keyboard.h" - -class rmnimbus_keyboard_device : public serial_keyboard_device -{ -public: - rmnimbus_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ioport_constructor device_input_ports() const; - -protected: - virtual void device_start(); - -private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); - - required_ioport m_io_kbd8; - required_ioport m_io_kbd9; - required_ioport m_io_kbda; - UINT8 m_state[11]; -}; - -extern const device_type RMNIMBUS_KEYBOARD; - -#endif /* RMNKBD_H_ */ diff --git a/src/mess/machine/rx01.c b/src/mess/machine/rx01.c deleted file mode 100644 index e916be7a1fb..00000000000 --- a/src/mess/machine/rx01.c +++ /dev/null @@ -1,260 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/********************************************************************** - - DEC RX01 floppy drive controller - -**********************************************************************/ - -/* - - TODO: - - Create also unibus and qbus devices that contain this controller on them -*/ - -#include "emu.h" -#include "machine/rx01.h" -#include "formats/basicdsk.h" - -static LEGACY_FLOPPY_OPTIONS_START( rx01 ) - LEGACY_FLOPPY_OPTION(rx01, "img", "RX01 image", basicdsk_identify_default, basicdsk_construct_default, NULL, - HEADS([1]) - TRACKS([77]) - SECTORS([26]) - SECTOR_LENGTH([128]) - FIRST_SECTOR_ID([1])) -LEGACY_FLOPPY_OPTIONS_END - - -static const floppy_interface rx01_floppy_interface = -{ - FLOPPY_STANDARD_8_SSSD, - LEGACY_FLOPPY_OPTIONS_NAME(rx01), - "floppy_8" -}; - - -MACHINE_CONFIG_FRAGMENT( rx01 ) - MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(rx01_floppy_interface) -MACHINE_CONFIG_END - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type RX01 = &device_creator; - -//------------------------------------------------- -// rx01_device - constructor -//------------------------------------------------- - -rx01_device::rx01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, RX01, "RX01", tag, owner, clock, "rx01", __FILE__) -{ -} - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor rx01_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( rx01 ); -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void rx01_device::device_start() -{ - m_image[0] = subdevice(FLOPPY_0); - m_image[1] = subdevice(FLOPPY_1); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void rx01_device::device_reset() -{ - for(int i=0;i<2;i++) - { - m_image[i]->floppy_mon_w(0); // turn it on - m_image[i]->floppy_drive_set_controller(this); - m_image[i]->floppy_drive_set_rpm(360.); - } - m_rxes = 0; - m_rxcs = 0; - m_rxdb = 0; -} - -//------------------------------------------------- -// read -//------------------------------------------------- - -READ16_MEMBER( rx01_device::read ) -{ - switch(offset & 1) { - case 0: return status_read(); - default: return data_read(); - } - -} - - -//------------------------------------------------- -// write -//------------------------------------------------- - -WRITE16_MEMBER( rx01_device::write ) -{ - switch(offset & 1) { - case 0: command_write(data); break; - case 1: data_write(data); break; - } -} - -void rx01_device::command_write(UINT16 data) -{ - printf("command_write %04x\n",data); - m_unit = BIT(data,4); - m_interrupt = BIT(data,6); - - m_image[m_unit]->floppy_drive_set_ready_state(1,0); - - - if (BIT(data,14)) // Initialize - { - printf("initialize\n"); - m_state = RX01_INIT; - } - else if (BIT(data,1)) // If GO bit is selected - { - m_rxcs &= ~(1<<5); // Clear done bit - m_buf_pos = 0; // Point to start of buffer - switch((data >> 1) & 7) { - case 0: // Fill Buffer - m_rxcs |= (1<<7); // Set TR Bit - m_state = RX01_FILL; - break; - case 1: // Empty Buffer - m_state = RX01_EMPTY; - break; - case 2: // Write Sector - case 3: // Read Sector - case 6: // Write Deleted Data Sector - m_rxes &= ~(1<<6 | 1<<1 | 1<<0);// Reset bits 0, 1 and 6 - m_state = RX01_SET_SECTOR; - break; - case 4: // Not Used - m_state = RX01_COMPLETE; - break; - case 5: // Read Status - m_state = RX01_COMPLETE; - m_rxdb = m_rxes; - break; - case 7: // Read Error Register - m_state = RX01_COMPLETE; - // set ready signal according to current drive status - m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7; - break; - } - } - machine().scheduler().timer_set(attotime::from_msec(100), FUNC(command_execution_callback), 0, this); -} - -UINT16 rx01_device::status_read() -{ - //printf("status_read %04x\n",m_rxcs); - return m_rxcs; -} - -void rx01_device::data_write(UINT16 data) -{ -// printf("data_write %04x\n",data); - // data can be written only if TR is set - if (BIT(m_rxcs,7)) m_rxdb = data; - machine().scheduler().timer_set(attotime::from_msec(100), FUNC(command_execution_callback), 0, this); -} - -UINT16 rx01_device::data_read() -{ - if (m_state==RX01_EMPTY && BIT(m_rxcs,7)) m_rxcs &= (1<<7); // clear TR bit; -// printf("data_read %04x\n",m_rxdb); - return m_rxdb; -} - -void rx01_device::service_command() -{ - printf("service_command %d\n",m_state); - m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7; - switch(m_state) { - case RX01_FILL : - m_buffer[m_buf_pos] = m_rxdb & 0xff; - m_buf_pos++; - if (m_buf_pos<128) - { - m_rxcs |= (1<<7); // Set TR Bit - } else { - //finished - } - break; - case RX01_EMPTY : - if (m_buf_pos>=128) - { - //finished - } else { - m_buffer[m_buf_pos] = m_rxdb & 0xff; - m_buf_pos++; - m_rxcs |= (1<<7); // Set TR Bit - } - break; - case RX01_SET_SECTOR: - m_rxsa = m_rxdb & 0x1f; - m_rxcs |= (1<<7); // Set TR Bit - m_state = RX01_SET_TRACK; - break; - case RX01_SET_TRACK: - m_rxta = m_rxdb & 0x7f; - m_rxcs |= (1<<7); // Set TR Bit - m_state = RX01_TRANSFER; - position_head(); - break; - case RX01_TRANSFER: - break; - case RX01_COMPLETE: - break; - case RX01_INIT: - m_rxes |= (1<<2); // Set init done flag - m_rxcs |= (1<<5); // Set operation done - break; - } -} - -void rx01_device::position_head() -{ - int cur_track = m_image[m_unit]->floppy_drive_get_current_track(); - int dir = (cur_track < m_rxta) ? +1 : -1; - - while (m_rxta != cur_track) - { - cur_track += dir; - - m_image[m_unit]->floppy_drive_seek(dir); - } -} - -void rx01_device::read_sector() -{ - /* read data */ - m_image[m_unit]->floppy_drive_read_sector_data(0, m_rxsa, (char *)m_buffer, 128); -} - -void rx01_device::write_sector(int ddam) -{ - /* write data */ - m_image[m_unit]->floppy_drive_write_sector_data(0, m_rxsa, (char *)m_buffer, 128, ddam); -} diff --git a/src/mess/machine/rx01.h b/src/mess/machine/rx01.h deleted file mode 100644 index 577fb92b5f4..00000000000 --- a/src/mess/machine/rx01.h +++ /dev/null @@ -1,85 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/********************************************************************** - - DEC RX01 floppy drive controller - -**********************************************************************/ - -#pragma once - -#ifndef __RX01__ -#define __RX01__ - -#include "imagedev/flopdrv.h" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_RX01_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, RX01, 0) - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> rx01_device - -class rx01_device : public device_t -{ -public: - // construction/destruction - rx01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_READ16_MEMBER( read ); - DECLARE_WRITE16_MEMBER( write ); - - // optional information overrides - virtual machine_config_constructor device_mconfig_additions() const; -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - void command_write(UINT16 data); - UINT16 status_read(); - - void data_write(UINT16 data); - UINT16 data_read(); - - void service_command(); - static TIMER_CALLBACK( command_execution_callback ) { reinterpret_cast(ptr)->service_command(); } - - void position_head(); - void read_sector(); - void write_sector(int ddam); -private: - enum rx01_state { - RX01_FILL, - RX01_EMPTY, - RX01_SET_SECTOR, - RX01_SET_TRACK, - RX01_TRANSFER, - RX01_COMPLETE, - RX01_INIT - }; - - legacy_floppy_image_device *m_image[2]; - UINT8 m_buffer[128]; - int m_buf_pos; - - UINT16 m_rxcs; // Command and Status Register - UINT16 m_rxdb; // Data Buffer Register - UINT16 m_rxta; // RX Track Address - UINT16 m_rxsa; // RX Sector Address - UINT16 m_rxes; // RX Error and Status - int m_unit; - int m_interrupt; - rx01_state m_state; -}; - -// device type definition -extern const device_type RX01; - -#endif diff --git a/src/mess/machine/samcoupe.c b/src/mess/machine/samcoupe.c deleted file mode 100644 index 682d81d906c..00000000000 --- a/src/mess/machine/samcoupe.c +++ /dev/null @@ -1,336 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Lee Hammerton, Dirk Best -/*************************************************************************** - - Miles Gordon Technology SAM Coupe - -***************************************************************************/ - -#include "emu.h" -#include "includes/samcoupe.h" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define LMPR_RAM0 0x20 /* If bit set ram is paged into bank 0, else its rom0 */ -#define LMPR_ROM1 0x40 /* If bit set rom1 is paged into bank 3, else its ram */ -#define HMPR_MCNTRL 0x80 /* If set external RAM is enabled */ - - -/*************************************************************************** - MEMORY BANKING -***************************************************************************/ - -READ8_MEMBER(samcoupe_state::sam_bank1_r) -{ - if (sam_bank_read_ptr[0]) - return sam_bank_read_ptr[0][offset]; - - return 0xff; -} - -WRITE8_MEMBER(samcoupe_state::sam_bank1_w) -{ - if (sam_bank_write_ptr[0]) - sam_bank_write_ptr[0][offset] = data; -} - - -READ8_MEMBER(samcoupe_state::sam_bank2_r) -{ - if (sam_bank_read_ptr[1]) - return sam_bank_read_ptr[1][offset]; - - return 0xff; -} - -WRITE8_MEMBER(samcoupe_state::sam_bank2_w) -{ - if (sam_bank_write_ptr[1]) - sam_bank_write_ptr[1][offset] = data; -} - - -READ8_MEMBER(samcoupe_state::sam_bank3_r) -{ - if (sam_bank_read_ptr[2]) - return sam_bank_read_ptr[2][offset]; - - return 0xff; -} - -WRITE8_MEMBER(samcoupe_state::sam_bank3_w) -{ - if (sam_bank_write_ptr[2]) - sam_bank_write_ptr[2][offset] = data; -} - - -READ8_MEMBER(samcoupe_state::sam_bank4_r) -{ - if (sam_bank_read_ptr[3]) - return sam_bank_read_ptr[3][offset]; - - return 0xff; -} - -WRITE8_MEMBER(samcoupe_state::sam_bank4_w) -{ - if (sam_bank_write_ptr[3]) - sam_bank_write_ptr[3][offset] = data; -} - -void samcoupe_state::samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memory, int is_readonly) -{ - sam_bank_read_ptr[bank_num-1] = memory; - if (!is_readonly) - sam_bank_write_ptr[bank_num-1] = memory; - else - sam_bank_write_ptr[bank_num-1] = NULL; - - // installing banks on the fly is too slow (20% speed in Manic Miner gameplay vs 300% speed) -#if 0 - char bank[10]; - sprintf(bank,"bank%d",bank_num); - if (memory) - { - membank(bank)->set_base(memory); - space.install_read_bank (((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF, bank); - if (is_readonly) { - space.unmap_write(((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF); - } else { - space.install_write_bank(((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF, bank); - } - } else { - space.nop_readwrite(((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF); - } -#endif -} - - -void samcoupe_state::samcoupe_install_ext_mem(address_space &space) -{ - UINT8 *mem; - - /* bank 3 */ - if (m_lext >> 6 < m_ram->size() >> 20) - mem = &m_ram->pointer()[(m_ram->size() & 0xfffff) + (m_lext >> 6) * 0x100000 + (m_lext & 0x3f) * 0x4000]; - else - mem = NULL; - - samcoupe_update_bank(space, 3, mem, FALSE); - - /* bank 4 */ - if (m_hext >> 6 < m_ram->size() >> 20) - mem = &m_ram->pointer()[(m_ram->size() & 0xfffff) + (m_hext >> 6) * 0x100000 + (m_hext & 0x3f) * 0x4000]; - else - mem = NULL; - - samcoupe_update_bank(space, 4, mem, FALSE); -} - - -void samcoupe_state::samcoupe_update_memory(address_space &space) -{ - const int PAGE_MASK = ((m_ram->size() & 0xfffff) / 0x4000) - 1; - UINT8 *rom = m_region_maincpu->base(); - UINT8 *memory; - int is_readonly; - - /* BANK1 */ - if (m_lmpr & LMPR_RAM0) /* Is ram paged in at bank 1 */ - { - if ((m_lmpr & 0x1F) <= PAGE_MASK) - memory = &m_ram->pointer()[(m_lmpr & PAGE_MASK) * 0x4000]; - else - memory = NULL; /* Attempt to page in non existant ram region */ - is_readonly = FALSE; - } - else - { - memory = rom; /* Rom0 paged in */ - is_readonly = TRUE; - } - samcoupe_update_bank(space, 1, memory, is_readonly); - - - /* BANK2 */ - if (((m_lmpr + 1) & 0x1f) <= PAGE_MASK) - memory = &m_ram->pointer()[((m_lmpr + 1) & PAGE_MASK) * 0x4000]; - else - memory = NULL; /* Attempt to page in non existant ram region */ - samcoupe_update_bank(space, 2, memory, FALSE); - - /* only update bank 3 and 4 when external memory is not enabled */ - if (m_hmpr & HMPR_MCNTRL) - { - samcoupe_install_ext_mem(space); - } - else - { - /* BANK3 */ - if ((m_hmpr & 0x1F) <= PAGE_MASK ) - memory = &m_ram->pointer()[(m_hmpr & PAGE_MASK)*0x4000]; - else - memory = NULL; /* Attempt to page in non existant ram region */ - samcoupe_update_bank(space, 3, memory, FALSE); - - - /* BANK4 */ - if (m_lmpr & LMPR_ROM1) /* Is Rom1 paged in at bank 4 */ - { - memory = rom + 0x4000; - is_readonly = TRUE; - } - else - { - if (((m_hmpr + 1) & 0x1f) <= PAGE_MASK) - memory = &m_ram->pointer()[((m_hmpr + 1) & PAGE_MASK) * 0x4000]; - else - memory = NULL; /* Attempt to page in non existant ram region */ - is_readonly = FALSE; - } - samcoupe_update_bank(space, 4, memory, FALSE); - } - - /* video memory location */ - if (m_vmpr & 0x40) /* if bit set in 2 bank screen mode */ - m_videoram = &m_ram->pointer()[((m_vmpr & 0x1e) & PAGE_MASK) * 0x4000]; - else - m_videoram = &m_ram->pointer()[((m_vmpr & 0x1f) & PAGE_MASK) * 0x4000]; -} - - -WRITE8_MEMBER(samcoupe_state::samcoupe_ext_mem_w) -{ - address_space &space_program = m_maincpu->space(AS_PROGRAM); - - if (offset & 1) - m_hext = data; - else - m_lext = data; - - /* external RAM enabled? */ - if (m_hmpr & HMPR_MCNTRL) - { - samcoupe_install_ext_mem(space_program); - } -} - - -/*************************************************************************** - REAL TIME CLOCK -***************************************************************************/ - -READ8_MEMBER(samcoupe_state::samcoupe_rtc_r) -{ - address_space &spaceio = m_maincpu->space(AS_IO); - return m_rtc->read(spaceio, offset >> 12); -} - - -WRITE8_MEMBER(samcoupe_state::samcoupe_rtc_w) -{ - address_space &spaceio = m_maincpu->space(AS_IO); - m_rtc->write(spaceio, offset >> 12, data); -} - - -/*************************************************************************** - MOUSE -***************************************************************************/ - -TIMER_CALLBACK_MEMBER(samcoupe_state::samcoupe_mouse_reset) -{ - m_mouse_index = 0; -} - -UINT8 samcoupe_state::samcoupe_mouse_r() -{ - UINT8 result; - - /* on a read, reset the timer */ - m_mouse_reset->adjust(attotime::from_usec(50)); - - /* update when we are about to read the first real values */ - if (m_mouse_index == 2) - { - /* update values */ - int mouse_x = m_io_mouse_x->read(); - int mouse_y = m_io_mouse_y->read(); - - int mouse_dx = m_mouse_x - mouse_x; - int mouse_dy = m_mouse_y - mouse_y; - - m_mouse_x = mouse_x; - m_mouse_y = mouse_y; - - /* button state */ - m_mouse_data[2] = m_mouse_buttons->read(); - - /* y-axis */ - m_mouse_data[3] = (mouse_dy & 0xf00) >> 8; - m_mouse_data[4] = (mouse_dy & 0x0f0) >> 4; - m_mouse_data[5] = (mouse_dy & 0x00f) >> 0; - - /* x-axis */ - m_mouse_data[6] = (mouse_dx & 0xf00) >> 8; - m_mouse_data[7] = (mouse_dx & 0x0f0) >> 4; - m_mouse_data[8] = (mouse_dx & 0x00f) >> 0; - } - - /* get current value */ - result = m_mouse_data[m_mouse_index++]; - - /* reset if we are at the end */ - if (m_mouse_index == sizeof(m_mouse_data)) - m_mouse_index = 1; - - return result; -} - -void samcoupe_state::machine_start() -{ - m_mouse_reset = timer_alloc(TIMER_MOUSE_RESET); - - /* schedule our video updates */ - m_video_update_timer = timer_alloc(TIMER_VIDEO_UPDATE); - m_video_update_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); -} - -/*************************************************************************** - RESET -***************************************************************************/ - -void samcoupe_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - address_space &spaceio = m_maincpu->space(AS_IO); - - /* initialize state */ - m_lmpr = 0x0f; /* ROM0 paged in, ROM1 paged out RAM Banks */ - m_hmpr = 0x01; - m_vmpr = 0x81; - m_line_int = 0xff; /* line interrupts disabled */ - m_status = 0x1f; /* no interrupts active */ - - /* initialize mouse */ - m_mouse_index = 0; - m_mouse_data[0] = 0xff; - m_mouse_data[1] = 0xff; - - if (m_config->read() & 0x01) - { - /* install RTC */ - spaceio.install_readwrite_handler(0xef, 0xef, 0xffff, 0xff00, read8_delegate(FUNC(samcoupe_state::samcoupe_rtc_r),this), write8_delegate(FUNC(samcoupe_state::samcoupe_rtc_w),this)); - } - else - { - /* no RTC support */ - spaceio.unmap_readwrite(0xef, 0xef, 0xffff, 0xff00); - } - - /* initialize memory */ - samcoupe_update_memory(space); -} diff --git a/src/mess/machine/sgi.c b/src/mess/machine/sgi.c deleted file mode 100644 index 797f27eb58b..00000000000 --- a/src/mess/machine/sgi.c +++ /dev/null @@ -1,562 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/********************************************************************* - - sgi.c - - Silicon Graphics MC (Memory Controller) code - -*********************************************************************/ - -#include "emu.h" -#include "sgi.h" - -#define VERBOSE_LEVEL ( 2 ) - -#if 0 -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%08x: %s", (unsigned) machine.device("maincpu")->safe_pc(), buf ); - } -} -#endif - -const device_type SGI_MC = &device_creator; - -sgi_mc_device::sgi_mc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, SGI_MC, "SGI Memory Controller", tag, owner, clock, "sgi_mc", __FILE__), - m_tUpdateTimer(NULL), - m_nCPUControl0(0), - m_nCPUControl1(0), - m_nWatchdog(0), - m_nSysID(0), - m_nRPSSDiv(0), - m_nRefCntPreload(0), - m_nRefCnt(0), - m_nGIO64ArbParam(0), - m_nArbCPUTime(0), - m_nArbBurstTime(0), - m_nMemCfg0(0), - m_nMemCfg1(0), - m_nCPUMemAccCfg(0), - m_nGIOMemAccCfg(0), - m_nCPUErrorAddr(0), - m_nCPUErrorStatus(0), - m_nGIOErrorAddr(0), - m_nGIOErrorStatus(0), - m_nSysSemaphore(0), - m_nGIOLock(0), - m_nEISALock(0), - m_nGIO64TransMask(0), - m_nGIO64Subst(0), - m_nDMAIntrCause(0), - m_nDMAControl(0), - m_nDMATLBEntry0Hi(0), - m_nDMATLBEntry0Lo(0), - m_nDMATLBEntry1Hi(0), - m_nDMATLBEntry1Lo(0), - m_nDMATLBEntry2Hi(0), - m_nDMATLBEntry2Lo(0), - m_nDMATLBEntry3Hi(0), - m_nDMATLBEntry3Lo(0), - m_nRPSSCounter(0), - m_nDMAMemAddr(0), - m_nDMALineCntWidth(0), - m_nDMALineZoomStride(0), - m_nDMAGIO64Addr(0), - m_nDMAMode(0), - m_nDMAZoomByteCnt(0), - m_nDMARunning(0) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void sgi_mc_device::device_start() -{ - // if Indigo2, ID appropriately - if (!strcmp(machine().system().name, "ip244415")) - { - m_nSysID = 0x11; // rev. B MC, EISA bus present - } - - timer_init(); - - save_item(NAME(m_nCPUControl0)); - save_item(NAME(m_nCPUControl1)); - save_item(NAME(m_nWatchdog)); - save_item(NAME(m_nSysID)); - save_item(NAME(m_nRPSSDiv)); - save_item(NAME(m_nRefCntPreload)); - save_item(NAME(m_nRefCnt)); - save_item(NAME(m_nGIO64ArbParam)); - save_item(NAME(m_nArbCPUTime)); - save_item(NAME(m_nArbBurstTime)); - save_item(NAME(m_nMemCfg0)); - save_item(NAME(m_nMemCfg1)); - save_item(NAME(m_nCPUMemAccCfg)); - save_item(NAME(m_nGIOMemAccCfg)); - save_item(NAME(m_nCPUErrorAddr)); - save_item(NAME(m_nCPUErrorStatus)); - save_item(NAME(m_nGIOErrorAddr)); - save_item(NAME(m_nGIOErrorStatus)); - save_item(NAME(m_nSysSemaphore)); - save_item(NAME(m_nGIOLock)); - save_item(NAME(m_nEISALock)); - save_item(NAME(m_nGIO64TransMask)); - save_item(NAME(m_nGIO64Subst)); - save_item(NAME(m_nDMAIntrCause)); - save_item(NAME(m_nDMAControl)); - save_item(NAME(m_nDMATLBEntry0Hi)); - save_item(NAME(m_nDMATLBEntry0Lo)); - save_item(NAME(m_nDMATLBEntry1Hi)); - save_item(NAME(m_nDMATLBEntry1Lo)); - save_item(NAME(m_nDMATLBEntry2Hi)); - save_item(NAME(m_nDMATLBEntry2Lo)); - save_item(NAME(m_nDMATLBEntry3Hi)); - save_item(NAME(m_nDMATLBEntry3Lo)); - save_item(NAME(m_nRPSSCounter)); - save_item(NAME(m_nDMAMemAddr)); - save_item(NAME(m_nDMALineCntWidth)); - save_item(NAME(m_nDMALineZoomStride)); - save_item(NAME(m_nDMAGIO64Addr)); - save_item(NAME(m_nDMAMode)); - save_item(NAME(m_nDMAZoomByteCnt)); - save_item(NAME(m_nDMARunning)); -} - -READ32_MEMBER( sgi_mc_device::read ) -{ - offset <<= 2; - switch( offset ) - { - case 0x0000: - case 0x0004: - //verboselog( space.machine(), 3, "CPU Control 0 Read: %08x (%08x)\n", m_nCPUControl0, mem_mask ); - return m_nCPUControl0; - case 0x0008: - case 0x000c: - //verboselog( space.machine(), 2, "CPU Control 1 Read: %08x (%08x)\n", m_nCPUControl1, mem_mask ); - return m_nCPUControl1; - case 0x0010: - case 0x0014: - //verboselog( space.machine(), 2, "Watchdog Timer Read: %08x (%08x)\n", m_nWatchdog, mem_mask ); - return m_nWatchdog; - case 0x0018: - case 0x001c: - //verboselog( space.machine(), 2, "System ID Read: %08x (%08x)\n", m_nSysID, mem_mask ); - return m_nSysID; - case 0x0028: - case 0x002c: - //verboselog( space.machine(), 2, "RPSS Divider Read: %08x (%08x)\n", m_nRPSSDiv, mem_mask ); - return m_nRPSSDiv; - case 0x0030: - case 0x0034: - //verboselog( space.machine(), 2, "R4000 EEPROM Read\n" ); - return 0; - case 0x0040: - case 0x0044: - //verboselog( space.machine(), 2, "Refresh Count Preload Read: %08x (%08x)\n", m_nRefCntPreload, mem_mask ); - return m_nRefCntPreload; - case 0x0048: - case 0x004c: - //verboselog( space.machine(), 2, "Refresh Count Read: %08x (%08x)\n", m_nRefCnt, mem_mask ); - return m_nRefCnt; - case 0x0080: - case 0x0084: - //verboselog( space.machine(), 2, "GIO64 Arbitration Param Read: %08x (%08x)\n", m_nGIO64ArbParam, mem_mask ); - return m_nGIO64ArbParam; - case 0x0088: - case 0x008c: - //verboselog( space.machine(), 2, "Arbiter CPU Time Read: %08x (%08x)\n", m_nArbCPUTime, mem_mask ); - return m_nArbCPUTime; - case 0x0098: - case 0x009c: - //verboselog( space.machine(), 2, "Arbiter Long Burst Time Read: %08x (%08x)\n", m_nArbBurstTime, mem_mask ); - return m_nArbBurstTime; - case 0x00c0: - case 0x00c4: - //verboselog( space.machine(), 3, "Memory Configuration Register 0 Read: %08x (%08x)\n", m_nMemCfg0, mem_mask ); - return m_nMemCfg0; - case 0x00c8: - case 0x00cc: - //verboselog( space.machine(), 3, "Memory Configuration Register 1 Read: %08x (%08x)\n", m_nMemCfg1, mem_mask ); - return m_nMemCfg1; - case 0x00d0: - case 0x00d4: - //verboselog( space.machine(), 2, "CPU Memory Access Config Params Read: %08x (%08x)\n", m_nCPUMemAccCfg, mem_mask ); - return m_nCPUMemAccCfg; - case 0x00d8: - case 0x00dc: - //verboselog( space.machine(), 2, "GIO Memory Access Config Params Read: %08x (%08x)\n", m_nGIOMemAccCfg, mem_mask ); - return m_nGIOMemAccCfg; - case 0x00e0: - case 0x00e4: - //verboselog( space.machine(), 2, "CPU Error Address Read: %08x (%08x)\n", m_nCPUErrorAddr, mem_mask ); - return m_nCPUErrorAddr; - case 0x00e8: - case 0x00ec: - //verboselog( space.machine(), 2, "CPU Error Status Read: %08x (%08x)\n", m_nCPUErrorStatus, mem_mask ); - return m_nCPUErrorStatus; - case 0x00f0: - case 0x00f4: - //verboselog( space.machine(), 2, "GIO Error Address Read: %08x (%08x)\n", m_nGIOErrorAddr, mem_mask ); - return m_nGIOErrorAddr; - case 0x00f8: - case 0x00fc: - //verboselog( space.machine(), 2, "GIO Error Status Read: %08x (%08x)\n", m_nGIOErrorStatus, mem_mask ); - return m_nGIOErrorStatus; - case 0x0100: - case 0x0104: - //verboselog( space.machine(), 2, "System Semaphore Read: %08x (%08x)\n", m_nSysSemaphore, mem_mask ); - return m_nSysSemaphore; - case 0x0108: - case 0x010c: - //verboselog( space.machine(), 2, "GIO Lock Read: %08x (%08x)\n", m_nGIOLock, mem_mask ); - return m_nGIOLock; - case 0x0110: - case 0x0114: - //verboselog( space.machine(), 2, "EISA Lock Read: %08x (%08x)\n", m_nEISALock, mem_mask ); - return m_nEISALock; - case 0x0150: - case 0x0154: - //verboselog( space.machine(), 2, "GIO64 Translation Address Mask Read: %08x (%08x)\n", m_nGIO64TransMask, mem_mask ); - return m_nGIO64TransMask; - case 0x0158: - case 0x015c: - //verboselog( space.machine(), 2, "GIO64 Translation Address Substitution Bits Read: %08x (%08x)\n", m_nGIO64Subst, mem_mask ); - return m_nGIO64Subst; - case 0x0160: - case 0x0164: - //verboselog( space.machine(), 2, "DMA Interrupt Cause: %08x (%08x)\n", m_nDMAIntrCause, mem_mask ); - return m_nDMAIntrCause; - case 0x0168: - case 0x016c: - //verboselog( space.machine(), 2, "DMA Control Read: %08x (%08x)\n", m_nDMAControl, mem_mask ); - return m_nDMAControl; - case 0x0180: - case 0x0184: - //verboselog( space.machine(), 2, "DMA TLB Entry 0 High Read: %08x (%08x)\n", m_nDMATLBEntry0Hi, mem_mask ); - return m_nDMATLBEntry0Hi; - case 0x0188: - case 0x018c: - //verboselog( space.machine(), 2, "DMA TLB Entry 0 Low Read: %08x (%08x)\n", m_nDMATLBEntry0Lo, mem_mask ); - return m_nDMATLBEntry0Lo; - case 0x0190: - case 0x0194: - //verboselog( space.machine(), 2, "DMA TLB Entry 1 High Read: %08x (%08x)\n", m_nDMATLBEntry1Hi, mem_mask ); - return m_nDMATLBEntry1Hi; - case 0x0198: - case 0x019c: - //verboselog( space.machine(), 2, "DMA TLB Entry 1 Low Read: %08x (%08x)\n", m_nDMATLBEntry1Lo, mem_mask ); - return m_nDMATLBEntry1Lo; - case 0x01a0: - case 0x01a4: - //verboselog( space.machine(), 2, "DMA TLB Entry 2 High Read: %08x (%08x)\n", m_nDMATLBEntry2Hi, mem_mask ); - return m_nDMATLBEntry2Hi; - case 0x01a8: - case 0x01ac: - //verboselog( space.machine(), 2, "DMA TLB Entry 2 Low Read: %08x (%08x)\n", m_nDMATLBEntry2Lo, mem_mask ); - return m_nDMATLBEntry2Lo; - case 0x01b0: - case 0x01b4: - //verboselog( space.machine(), 2, "DMA TLB Entry 3 High Read: %08x (%08x)\n", m_nDMATLBEntry3Hi, mem_mask ); - return m_nDMATLBEntry3Hi; - case 0x01b8: - case 0x01bc: - //verboselog( space.machine(), 2, "DMA TLB Entry 3 Low Read: %08x (%08x)\n", m_nDMATLBEntry3Lo, mem_mask ); - return m_nDMATLBEntry3Lo; - case 0x1000: - case 0x1004: - //verboselog( space.machine(), 2, "RPSS 100ns Counter Read: %08x (%08x)\n", m_nRPSSCounter, mem_mask ); - return m_nRPSSCounter; - case 0x2000: - case 0x2004: - case 0x2008: - case 0x200c: - //verboselog( space.machine(), 0, "DMA Memory Address Read: %08x (%08x)\n", m_nDMAMemAddr, mem_mask ); - return m_nDMAMemAddr; - case 0x2010: - case 0x2014: - //verboselog( space.machine(), 0, "DMA Line Count and Width Read: %08x (%08x)\n", m_nDMALineCntWidth, mem_mask ); - return m_nDMALineCntWidth; - case 0x2018: - case 0x201c: - //verboselog( space.machine(), 0, "DMA Line Zoom and Stride Read: %08x (%08x)\n", m_nDMALineZoomStride, mem_mask ); - return m_nDMALineZoomStride; - case 0x2020: - case 0x2024: - case 0x2028: - case 0x202c: - //verboselog( space.machine(), 0, "DMA GIO64 Address Read: %08x (%08x)\n", m_nDMAGIO64Addr, mem_mask ); - return m_nDMAGIO64Addr; - case 0x2030: - case 0x2034: - //verboselog( space.machine(), 0, "DMA Mode Write: %08x (%08x)\n", m_nDMAMode, mem_mask ); - return m_nDMAMode; - case 0x2038: - case 0x203c: - //verboselog( space.machine(), 0, "DMA Zoom Count Read: %08x (%08x)\n", m_nDMAZoomByteCnt, mem_mask ); - return m_nDMAZoomByteCnt; -// case 0x2040: -// case 0x2044: -// //verboselog( space.machine(), 2, "DMA Start Write: %08x (%08x)\n", data, mem_mask ); - // Start DMA -// m_nDMARunning = 1; -// break; - case 0x2048: - case 0x204c: - //verboselog( space.machine(), 0, "VDMA Running Read: %08x (%08x)\n", m_nDMARunning, mem_mask ); - if( m_nDMARunning == 1 ) - { - m_nDMARunning = 0; - return 0x00000040; - } - else - { - return 0; - } - } - //verboselog( space.machine(), 0, "Unmapped MC read: 0x%08x (%08x)\n", 0x1fa00000 + offset, mem_mask ); - return 0; -} - -WRITE32_MEMBER( sgi_mc_device::write ) -{ - offset <<= 2; - switch( offset ) - { - case 0x0000: - case 0x0004: - //verboselog( space.machine(), 2, "CPU Control 0 Write: %08x (%08x)\n", data, mem_mask ); - m_nCPUControl0 = data; - break; - case 0x0008: - case 0x000c: - //verboselog( space.machine(), 2, "CPU Control 1 Write: %08x (%08x)\n", data, mem_mask ); - m_nCPUControl1 = data; - break; - case 0x0010: - case 0x0014: - //verboselog( space.machine(), 2, "Watchdog Timer Clear" ); - m_nWatchdog = 0; - break; - case 0x0028: - case 0x002c: - //verboselog( space.machine(), 2, "RPSS Divider Write: %08x (%08x)\n", data, mem_mask ); - m_nRPSSDiv = data; - break; - case 0x0030: - case 0x0034: - //verboselog( space.machine(), 2, "R4000 EEPROM Write\n" ); - break; - case 0x0040: - case 0x0044: - //verboselog( space.machine(), 2, "Refresh Count Preload Write: %08x (%08x)\n", data, mem_mask ); - m_nRefCntPreload = data; - break; - case 0x0080: - case 0x0084: - //verboselog( space.machine(), 2, "GIO64 Arbitration Param Write: %08x (%08x)\n", data, mem_mask ); - m_nGIO64ArbParam = data; - break; - case 0x0088: - case 0x008c: - //verboselog( space.machine(), 3, "Arbiter CPU Time Write: %08x (%08x)\n", data, mem_mask ); - m_nArbCPUTime = data; - break; - case 0x0098: - case 0x009c: - //verboselog( space.machine(), 3, "Arbiter Long Burst Time Write: %08x (%08x)\n", data, mem_mask ); - m_nArbBurstTime = data; - break; - case 0x00c0: - case 0x00c4: - //verboselog( space.machine(), 3, "Memory Configuration Register 0 Write: %08x (%08x)\n", data, mem_mask ); - m_nMemCfg0 = data; - break; - case 0x00c8: - case 0x00cc: - //verboselog( space.machine(), 3, "Memory Configuration Register 1 Write: %08x (%08x)\n", data, mem_mask ); - m_nMemCfg1 = data; - break; - case 0x00d0: - case 0x00d4: - //verboselog( space.machine(), 2, "CPU Memory Access Config Params Write: %08x (%08x)\n", data, mem_mask ); - m_nCPUMemAccCfg = data; - break; - case 0x00d8: - case 0x00dc: - //verboselog( space.machine(), 2, "GIO Memory Access Config Params Write: %08x (%08x)\n", data, mem_mask ); - m_nGIOMemAccCfg = data; - break; - case 0x00e8: - case 0x00ec: - //verboselog( space.machine(), 2, "CPU Error Status Clear\n" ); - m_nCPUErrorStatus = 0; - break; - case 0x00f8: - case 0x00fc: - //verboselog( space.machine(), 2, "GIO Error Status Clear\n" ); - m_nGIOErrorStatus = 0; - break; - case 0x0100: - case 0x0104: - //verboselog( space.machine(), 2, "System Semaphore Write: %08x (%08x)\n", data, mem_mask ); - m_nSysSemaphore = data; - break; - case 0x0108: - case 0x010c: - //verboselog( space.machine(), 2, "GIO Lock Write: %08x (%08x)\n", data, mem_mask ); - m_nGIOLock = data; - break; - case 0x0110: - case 0x0114: - //verboselog( space.machine(), 2, "EISA Lock Write: %08x (%08x)\n", data, mem_mask ); - m_nEISALock = data; - break; - case 0x0150: - case 0x0154: - //verboselog( space.machine(), 2, "GIO64 Translation Address Mask Write: %08x (%08x)\n", data, mem_mask ); - m_nGIO64TransMask = data; - break; - case 0x0158: - case 0x015c: - //verboselog( space.machine(), 2, "GIO64 Translation Address Substitution Bits Write: %08x (%08x)\n", data, mem_mask ); - m_nGIO64Subst = data; - break; - case 0x0160: - case 0x0164: - //verboselog( space.machine(), 0, "DMA Interrupt Cause Write: %08x (%08x)\n", data, mem_mask ); - m_nDMAIntrCause = data; - break; - case 0x0168: - case 0x016c: - //verboselog( space.machine(), 0, "DMA Control Write: %08x (%08x)\n", data, mem_mask ); - m_nDMAControl = data; - break; - case 0x0180: - case 0x0184: - //verboselog( space.machine(), 0, "DMA TLB Entry 0 High Write: %08x (%08x)\n", data, mem_mask ); - m_nDMATLBEntry0Hi = data; - break; - case 0x0188: - case 0x018c: - //verboselog( space.machine(), 0, "DMA TLB Entry 0 Low Write: %08x (%08x)\n", data, mem_mask ); - m_nDMATLBEntry0Lo = data; - break; - case 0x0190: - case 0x0194: - //verboselog( space.machine(), 0, "DMA TLB Entry 1 High Write: %08x (%08x)\n", data, mem_mask ); - m_nDMATLBEntry1Hi = data; - break; - case 0x0198: - case 0x019c: - //verboselog( space.machine(), 0, "DMA TLB Entry 1 Low Write: %08x (%08x)\n", data, mem_mask ); - m_nDMATLBEntry1Lo = data; - break; - case 0x01a0: - case 0x01a4: - //verboselog( space.machine(), 0, "DMA TLB Entry 2 High Write: %08x (%08x)\n", data, mem_mask ); - m_nDMATLBEntry2Hi = data; - break; - case 0x01a8: - case 0x01ac: - //verboselog( space.machine(), 0, "DMA TLB Entry 2 Low Write: %08x (%08x)\n", data, mem_mask ); - m_nDMATLBEntry2Lo = data; - break; - case 0x01b0: - case 0x01b4: - //verboselog( space.machine(), 0, "DMA TLB Entry 3 High Write: %08x (%08x)\n", data, mem_mask ); - m_nDMATLBEntry3Hi = data; - break; - case 0x01b8: - case 0x01bc: - //verboselog( space.machine(), 0, "DMA TLB Entry 3 Low Write: %08x (%08x)\n", data, mem_mask ); - m_nDMATLBEntry3Lo = data; - break; - case 0x2000: - case 0x2004: - //verboselog( space.machine(), 0, "DMA Memory Address Write: %08x (%08x)\n", data, mem_mask ); - m_nDMAMemAddr = data; - break; - case 0x2008: - case 0x200c: - //verboselog( space.machine(), 0, "DMA Memory Address + Default Params Write: %08x (%08x)\n", data, mem_mask ); - m_nDMAMemAddr = data; - break; - case 0x2010: - case 0x2014: - //verboselog( space.machine(), 0, "DMA Line Count and Width Write: %08x (%08x)\n", data, mem_mask ); - m_nDMALineCntWidth = data; - break; - case 0x2018: - case 0x201c: - //verboselog( space.machine(), 0, "DMA Line Zoom and Stride Write: %08x (%08x)\n", data, mem_mask ); - m_nDMALineZoomStride = data; - break; - case 0x2020: - case 0x2024: - //verboselog( space.machine(), 0, "DMA GIO64 Address Write: %08x (%08x)\n", data, mem_mask ); - m_nDMAGIO64Addr = data; - break; - case 0x2028: - case 0x202c: - //verboselog( space.machine(), 0, "DMA GIO64 Address Write + Start DMA: %08x (%08x)\n", data, mem_mask ); - m_nDMAGIO64Addr = data; - // Start DMA - m_nDMARunning = 1; - break; - case 0x2030: - case 0x2034: - //verboselog( space.machine(), 0, "DMA Mode Write: %08x (%08x)\n", data, mem_mask ); - m_nDMAMode = data; - break; - case 0x2038: - case 0x203c: - //verboselog( space.machine(), 0, "DMA Zoom Count + Byte Count Write: %08x (%08x)\n", data, mem_mask ); - m_nDMAZoomByteCnt = data; - break; - case 0x2040: - case 0x2044: - //verboselog( space.machine(), 0, "DMA Start Write: %08x (%08x)\n", data, mem_mask ); - // Start DMA - m_nDMARunning = 1; - break; - case 0x2070: - case 0x2074: - //verboselog( space.machine(), 0, "DMA GIO64 Address Write + Default Params Write + Start DMA: %08x (%08x)\n", data, mem_mask ); - m_nDMAGIO64Addr = data; - // Start DMA - m_nDMARunning = 1; - break; - default: - //verboselog( space.machine(), 0, "Unmapped MC write: 0x%08x: %08x (%08x)\n", 0x1fa00000 + offset, data, mem_mask ); - break; - } -} - -void sgi_mc_device::update() -{ - m_nRPSSCounter += 1000; -} - -TIMER_CALLBACK_MEMBER(sgi_mc_device::update_callback) -{ - update(); -} - -void sgi_mc_device::timer_init() -{ - m_tUpdateTimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sgi_mc_device::update_callback), this)); - m_tUpdateTimer->adjust(attotime::from_hz(10000), 0, attotime::from_hz(10000)); -} diff --git a/src/mess/machine/sgi.h b/src/mess/machine/sgi.h deleted file mode 100644 index ec5d203ba70..00000000000 --- a/src/mess/machine/sgi.h +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/********************************************************************* - - sgi.h - - Silicon Graphics MC (Memory Controller) code - -*********************************************************************/ - -#ifndef _SGIMC_H -#define _SGIMC_H - -class sgi_mc_device : public device_t -{ -public: - sgi_mc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~sgi_mc_device() {} - -DECLARE_READ32_MEMBER(read); -DECLARE_WRITE32_MEMBER(write); - -protected: - // device-level overrides - virtual void device_start(); - -private: - // internal state - emu_timer *m_tUpdateTimer; - UINT32 m_nCPUControl0; - UINT32 m_nCPUControl1; - UINT32 m_nWatchdog; - UINT32 m_nSysID; - UINT32 m_nRPSSDiv; - UINT32 m_nRefCntPreload; - UINT32 m_nRefCnt; - UINT32 m_nGIO64ArbParam; - UINT32 m_nArbCPUTime; - UINT32 m_nArbBurstTime; - UINT32 m_nMemCfg0; - UINT32 m_nMemCfg1; - UINT32 m_nCPUMemAccCfg; - UINT32 m_nGIOMemAccCfg; - UINT32 m_nCPUErrorAddr; - UINT32 m_nCPUErrorStatus; - UINT32 m_nGIOErrorAddr; - UINT32 m_nGIOErrorStatus; - UINT32 m_nSysSemaphore; - UINT32 m_nGIOLock; - UINT32 m_nEISALock; - UINT32 m_nGIO64TransMask; - UINT32 m_nGIO64Subst; - UINT32 m_nDMAIntrCause; - UINT32 m_nDMAControl; - UINT32 m_nDMATLBEntry0Hi; - UINT32 m_nDMATLBEntry0Lo; - UINT32 m_nDMATLBEntry1Hi; - UINT32 m_nDMATLBEntry1Lo; - UINT32 m_nDMATLBEntry2Hi; - UINT32 m_nDMATLBEntry2Lo; - UINT32 m_nDMATLBEntry3Hi; - UINT32 m_nDMATLBEntry3Lo; - UINT32 m_nRPSSCounter; - UINT32 m_nDMAMemAddr; - UINT32 m_nDMALineCntWidth; - UINT32 m_nDMALineZoomStride; - UINT32 m_nDMAGIO64Addr; - UINT32 m_nDMAMode; - UINT32 m_nDMAZoomByteCnt; - UINT32 m_nDMARunning; - - void update(); - TIMER_CALLBACK_MEMBER(update_callback); - void timer_init(); -}; - -extern const device_type SGI_MC; - - -#endif /* _SGIMC_H */ diff --git a/src/mess/machine/smartmed.c b/src/mess/machine/smartmed.c deleted file mode 100644 index 32e9c53bcaa..00000000000 --- a/src/mess/machine/smartmed.c +++ /dev/null @@ -1,791 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/* - smartmed.c: SmartMedia Flash ROM emulation - - The SmartMedia is a Flash ROM in a fancy card. It is used in a variety of - digital devices (still cameras...) and can be interfaced with a computer. - - References: - Datasheets for various SmartMedia chips were found on Samsung and Toshiba's - sites (http://www.toshiba.com/taec and - http://www.samsung.com/Products/Semiconductor/Flash/FlashCard/SmartMedia) - - TODO: - * support multi-plane mode? - * use HD-format images instead of our experimental custom format? - - Raphael Nabet 2004 -*/ - -#include "emu.h" -#include "smartmed.h" - - -#define MAX_SMARTMEDIA 1 - -/* machine-independent big-endian 32-bit integer */ -struct UINT32BE -{ - UINT8 bytes[4]; -}; - -INLINE UINT32 get_UINT32BE(UINT32BE word) -{ - return (word.bytes[0] << 24) | (word.bytes[1] << 16) | (word.bytes[2] << 8) | word.bytes[3]; -} - -#ifdef UNUSED_FUNCTION -INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) -{ - word->bytes[0] = (data >> 24) & 0xff; - word->bytes[1] = (data >> 16) & 0xff; - word->bytes[2] = (data >> 8) & 0xff; - word->bytes[3] = data & 0xff; -} -#endif - -/* SmartMedia image header */ -struct SM_disk_image_header -{ - UINT8 version; - UINT32BE page_data_size; - UINT32BE page_total_size; - UINT32BE num_pages; - UINT32BE log2_pages_per_block; -}; - -struct disk_image_format_2_header -{ - UINT8 data1[3]; - UINT8 padding1[256-3]; - UINT8 data2[16]; - UINT8 data3[16]; - UINT8 padding2[768-32]; -}; - -enum -{ - header_len = sizeof(SM_disk_image_header) -}; - - -const device_type NAND = &device_creator; - -nand_device::nand_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, NAND, "NAND Flash Memory", tag, owner, clock, "nand", __FILE__), - m_page_data_size(0), - m_page_total_size(0), - m_num_pages(0), - m_log2_pages_per_block(0), - m_pagereg(NULL), - m_id_len(0), - m_col_address_cycles(0), - m_row_address_cycles(0), - m_sequential_row_read(0), - m_write_rnb(*this) -{ - memset(m_id, 0, sizeof(m_id)); -} - -nand_device::nand_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - m_page_data_size(0), - m_page_total_size(0), - m_num_pages(0), - m_log2_pages_per_block(0), - m_pagereg(NULL), - m_id_len(0), - m_col_address_cycles(0), - m_row_address_cycles(0), - m_sequential_row_read(0), - m_write_rnb(*this) -{ - memset(m_id, 0, sizeof(m_id)); -} - -/* - Init a SmartMedia image -*/ -void nand_device::device_start() -{ - m_data_ptr = NULL; - m_data_uid_ptr = NULL; - m_mode = SM_M_INIT; - m_pointer_mode = SM_PM_A; - m_page_addr = 0; - m_byte_addr = 0; - m_status = 0xC0; - m_accumulated_status = 0; - m_mp_opcode = 0; - m_mode_3065 = 0; - m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); - - #ifdef SMARTMEDIA_IMAGE_SAVE - m_image_format = 0; - #endif - m_write_rnb.resolve_safe(); -} - -/* - Load a SmartMedia image -*/ -bool smartmedia_image_device::smartmedia_format_1() -{ - SM_disk_image_header custom_header; - int bytes_read; - - bytes_read = fread(&custom_header, sizeof(custom_header)); - if (bytes_read != sizeof(custom_header)) - { - return IMAGE_INIT_FAIL; - } - - if (custom_header.version > 1) - { - return IMAGE_INIT_FAIL; - } - - m_page_data_size = get_UINT32BE(custom_header.page_data_size); - m_page_total_size = get_UINT32BE(custom_header.page_total_size); - m_num_pages = get_UINT32BE(custom_header.num_pages); - m_log2_pages_per_block = get_UINT32BE(custom_header.log2_pages_per_block); - m_data_ptr = auto_alloc_array(machine(), UINT8, m_page_total_size*m_num_pages); - m_data_uid_ptr = auto_alloc_array(machine(), UINT8, 256 + 16); - m_mode = SM_M_INIT; - m_pointer_mode = SM_PM_A; - m_page_addr = 0; - m_byte_addr = 0; - m_status = 0x40; - if (!is_readonly()) - m_status |= 0x80; - m_accumulated_status = 0; - m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); - memset( m_id, 0, sizeof( m_id)); - m_id_len = 0; - m_col_address_cycles = 1; - m_row_address_cycles = (m_num_pages > 0x10000) ? 3 : 2; - m_sequential_row_read = 1; - - if (custom_header.version == 0) - { - m_id_len = 2; - fread(m_id, m_id_len); - fread(&m_mp_opcode, 1); - } - else if (custom_header.version == 1) - { - m_id_len = 3; - fread(m_id, m_id_len); - fread(&m_mp_opcode, 1); - fread(m_data_uid_ptr, 256 + 16); - } - fread(m_data_ptr, m_page_total_size*m_num_pages); - - #ifdef SMARTMEDIA_IMAGE_SAVE - m_image_format = 1; - #endif - - return IMAGE_INIT_PASS; -} - -int smartmedia_image_device::detect_geometry( UINT8 id1, UINT8 id2) -{ - int result = FALSE; - - switch (id1) - { - case 0xEC : - { - switch (id2) - { - case 0xA4 : m_page_data_size = 0x0100; m_num_pages = 0x00800; m_page_total_size = 0x0108; m_log2_pages_per_block = 0; result = TRUE; break; - case 0x6E : m_page_data_size = 0x0100; m_num_pages = 0x01000; m_page_total_size = 0x0108; m_log2_pages_per_block = 0; result = TRUE; break; - case 0xEA : m_page_data_size = 0x0100; m_num_pages = 0x02000; m_page_total_size = 0x0108; m_log2_pages_per_block = 4; result = TRUE; break; - case 0xE3 : m_page_data_size = 0x0200; m_num_pages = 0x02000; m_page_total_size = 0x0210; m_log2_pages_per_block = 4; result = TRUE; break; - case 0xE6 : m_page_data_size = 0x0200; m_num_pages = 0x04000; m_page_total_size = 0x0210; m_log2_pages_per_block = 4; result = TRUE; break; - case 0x73 : m_page_data_size = 0x0200; m_num_pages = 0x08000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; - case 0x75 : m_page_data_size = 0x0200; m_num_pages = 0x10000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; - case 0x76 : m_page_data_size = 0x0200; m_num_pages = 0x20000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; - case 0x79 : m_page_data_size = 0x0200; m_num_pages = 0x40000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; - } - } - break; - case 0x98 : - { - switch (id2) - { - case 0x75 : m_page_data_size = 0x0200; m_num_pages = 0x10000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = TRUE; break; - } - } - break; - } - - return result; -} - -bool smartmedia_image_device::smartmedia_format_2() -{ - disk_image_format_2_header custom_header; - int bytes_read, i, j; - - bytes_read = fread(&custom_header, sizeof(custom_header)); - if (bytes_read != sizeof(custom_header)) - { - return IMAGE_INIT_FAIL; - } - - if ((custom_header.data1[0] != 0xEC) && (custom_header.data1[0] != 0x98)) - { - return IMAGE_INIT_FAIL; - } - - if (!detect_geometry(custom_header.data1[0], custom_header.data1[1])) - { - return IMAGE_INIT_FAIL; - } - - m_data_ptr = auto_alloc_array(machine(), UINT8, m_page_total_size*m_num_pages); - m_data_uid_ptr = auto_alloc_array(machine(), UINT8, 256 + 16); - m_mode = SM_M_INIT; - m_pointer_mode = SM_PM_A; - m_page_addr = 0; - m_byte_addr = 0; - m_status = 0x40; - if (!is_readonly()) - m_status |= 0x80; - m_accumulated_status = 0; - m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); - m_id_len = 3; - memcpy( m_id, custom_header.data1, m_id_len); - m_mp_opcode = 0; - m_col_address_cycles = 1; - m_row_address_cycles = (m_num_pages > 0x10000) ? 3 : 2; - m_sequential_row_read = 1; - - for (i=0;i<8;i++) - { - memcpy( m_data_uid_ptr + i * 32, custom_header.data2, 16); - for (j=0;j<16;j++) m_data_uid_ptr[i*32+16+j] = custom_header.data2[j] ^ 0xFF; - } - memcpy( m_data_uid_ptr + 256, custom_header.data3, 16); - - fread(m_data_ptr, m_page_total_size*m_num_pages); - - #ifdef SMARTMEDIA_IMAGE_SAVE - m_image_format = 2; - #endif - - return IMAGE_INIT_PASS; -} - -bool smartmedia_image_device::call_load() -{ - int result; - UINT64 position; - // try format 1 - position = ftell(); - result = smartmedia_format_1(); - if (result != IMAGE_INIT_PASS) - { - // try format 2 - fseek( position, SEEK_SET); - result = smartmedia_format_2(); - } - return result; -} - -/* - Unload a SmartMedia image -*/ -void smartmedia_image_device::call_unload() -{ - #ifdef SMARTMEDIA_IMAGE_SAVE - if (!is_readonly()) - { - if (m_image_format == 1) - { - SM_disk_image_header custom_header; - int bytes_read; - fseek( 0, SEEK_SET); - bytes_read = fread( &custom_header, sizeof( custom_header)); - if (bytes_read == sizeof( custom_header)) - { - if (custom_header.version == 0) - { - fseek( 2 + 1, SEEK_CUR); - fwrite( m_data_ptr, m_page_total_size * m_num_pages); - } - else if (custom_header.version == 1) - { - fseek( 3 + 1 + 256 + 16, SEEK_CUR); - fwrite( m_data_ptr, m_page_total_size * m_num_pages); - } - } - } - else if (m_image_format == 2) - { - fseek( sizeof( disk_image_format_2_header), SEEK_SET); - fwrite( m_data_ptr, m_page_total_size * m_num_pages); - } - } - #endif - - m_page_data_size = 0; - m_page_total_size = 0; - m_num_pages = 0; - m_log2_pages_per_block = 0; - m_data_ptr = NULL; - m_data_uid_ptr = NULL; - m_mode = SM_M_INIT; - m_pointer_mode = SM_PM_A; - m_page_addr = 0; - m_byte_addr = 0; - m_status = 0xC0; - m_accumulated_status = 0; - m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); - memset( m_id, 0, sizeof( m_id)); - m_id_len = 0; - m_mp_opcode = 0; - m_mode_3065 = 0; - m_col_address_cycles = 0; - m_row_address_cycles = 0; - m_sequential_row_read = 0; - - #ifdef SMARTMEDIA_IMAGE_SAVE - m_image_format = 0; - #endif - - return; -} - -int nand_device::is_present() -{ - return m_num_pages != 0; -} - -int nand_device::is_protected() -{ - return (m_status & 0x80) == 0; -} - -int nand_device::is_busy() -{ - return (m_status & 0x40) == 0; -} - -void nand_device::set_data_ptr(void *ptr) -{ - m_data_ptr = (UINT8 *)ptr; -} - -/* - write a byte to SmartMedia command port -*/ -void nand_device::command_w(UINT8 data) -{ - if (!is_present()) - return; - - switch (data) - { - case 0xff: // Reset - m_mode = SM_M_INIT; - m_pointer_mode = SM_PM_A; - m_status = (m_status & 0x80) | 0x40; - m_accumulated_status = 0; - m_mode_3065 = 0; - if (!m_write_rnb.isnull()) - { - m_write_rnb( 0); - m_write_rnb( 1); - } - break; - case 0x00: // Read (1st cycle) - m_mode = SM_M_READ; - m_pointer_mode = SM_PM_A; - m_page_addr = 0; - m_addr_load_ptr = 0; - break; - case 0x01: - if (m_page_data_size != 512) - { - logerror("smartmedia: unsupported upper data field select (256-byte pages)\n"); - m_mode = SM_M_INIT; - } - else - { - m_mode = SM_M_READ; - m_pointer_mode = SM_PM_B; - m_page_addr = 0; - m_addr_load_ptr = 0; - } - break; - case 0x50: - if (m_page_data_size > 512) - { - logerror("smartmedia: unsupported spare area select\n"); - m_mode = SM_M_INIT; - } - else - { - m_mode = SM_M_READ; - m_pointer_mode = SM_PM_C; - m_page_addr = 0; - m_addr_load_ptr = 0; - } - break; - case 0x80: // Page Program (1st cycle) - m_mode = SM_M_PROGRAM; - m_page_addr = 0; - m_addr_load_ptr = 0; - m_program_byte_count = 0; - memset(m_pagereg, 0xff, m_page_total_size); - break; - case 0x10: // Page Program (2nd cycle) - case 0x15: - if ((m_mode != SM_M_PROGRAM) && (m_mode != SM_M_RANDOM_DATA_INPUT)) - { - logerror("smartmedia: illegal page program confirm command\n"); - m_mode = SM_M_INIT; - } - else - { - int i; - m_status = (m_status & 0x80) | m_accumulated_status; - //logerror( "smartmedia: program, page_addr %08X\n", m_page_addr); - for (i=0; i; - -smartmedia_image_device::smartmedia_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : nand_device(mconfig, SMARTMEDIA, "SmartMedia Flash ROM", tag, owner, clock, "smartmedia", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -void smartmedia_image_device::device_config_complete() -{ - update_names(); -} diff --git a/src/mess/machine/smartmed.h b/src/mess/machine/smartmed.h deleted file mode 100644 index 4f15cf35a0f..00000000000 --- a/src/mess/machine/smartmed.h +++ /dev/null @@ -1,239 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/* - smartmed.h: header file for smartmed.c -*/ - -#ifndef __SMARTMEDIA_H__ -#define __SMARTMEDIA_H__ - -#include "formats/imageutl.h" - -//#define SMARTMEDIA_IMAGE_SAVE - -#define MCFG_NAND_TYPE(_type) \ - nand_device::set_nand_type(*device, _type); - -#define MCFG_NAND_RNB_CALLBACK(_write) \ - devcb = &nand_device::set_rnb_wr_callback(*device, DEVCB_##_write); - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -enum sm_mode_t -{ - SM_M_INIT, // initial state - SM_M_READ, // read page data - SM_M_PROGRAM, // program page data - SM_M_ERASE, // erase block data - SM_M_READSTATUS,// read status - SM_M_READID, // read ID - SM_M_30, - SM_M_RANDOM_DATA_INPUT, - SM_M_RANDOM_DATA_OUTPUT -}; - -enum pointer_sm_mode_t -{ - SM_PM_A, // accessing first 256-byte half of 512-byte data field - SM_PM_B, // accessing second 256-byte half of 512-byte data field - SM_PM_C // accessing spare field -}; - - -// "Sequential Row Read is available only on K9F5608U0D_Y,P,V,F or K9F5608D0D_Y,P" -enum -{ - NAND_CHIP_K9F5608U0D = 0, // K9F5608U0D - NAND_CHIP_K9F5608U0D_J, // K9F5608U0D-Jxxx - NAND_CHIP_K9F5608U0B, // K9F5608U0B - NAND_CHIP_K9F1G08U0B, // K9F1G08U0B - NAND_CHIP_K9LAG08U0M // K9LAG08U0M -}; - -// ======================> nand_device -class nand_device : public device_t -{ -public: - // construction/destruction - nand_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - nand_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - template static devcb_base &set_rnb_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_rnb.set_callback(object); } - - static void set_nand_type(device_t &device, int type) - { - nand_device &dev = downcast(device); - switch (type) - { - case NAND_CHIP_K9F5608U0D: - dev.m_id_len = 2; - dev.m_id[0] = 0xec; - dev.m_id[1] = 0x75; - dev.m_page_data_size = 512; - dev.m_page_total_size = 512 + 16; - dev.m_log2_pages_per_block = compute_log2(32); - dev.m_num_pages = 32 * 2048; - dev.m_col_address_cycles = 1; - dev.m_row_address_cycles = 2; - dev.m_sequential_row_read = 1; - break; - case NAND_CHIP_K9F5608U0D_J: - case NAND_CHIP_K9F5608U0B: - dev.m_id_len = 2; - dev.m_id[0] = 0xec; - dev.m_id[1] = 0x75; - dev.m_page_data_size = 512; - dev.m_page_total_size = 512 + 16; - dev.m_log2_pages_per_block = compute_log2(32); - dev.m_num_pages = 32 * 2048; - dev.m_col_address_cycles = 1; - dev.m_row_address_cycles = 2; - dev.m_sequential_row_read = 0; - break; - case NAND_CHIP_K9F1G08U0B: - dev.m_id_len = 5; - dev.m_id[0] = 0xec; - dev.m_id[1] = 0xf1; - dev.m_id[2] = 0x00; - dev.m_id[3] = 0x95; - dev.m_id[4] = 0x40; - dev.m_page_data_size = 2048; - dev.m_page_total_size = 2048 + 64; - dev.m_log2_pages_per_block = compute_log2(64); - dev.m_num_pages = 64 * 1024; - dev.m_col_address_cycles = 2; - dev.m_row_address_cycles = 2; - dev.m_sequential_row_read = 0; - break; - case NAND_CHIP_K9LAG08U0M: - dev.m_id_len = 5; - dev.m_id[0] = 0xec; - dev.m_id[1] = 0xd5; - dev.m_id[2] = 0x55; - dev.m_id[3] = 0x25; - dev.m_id[4] = 0x68; - dev.m_page_data_size = 2048; - dev.m_page_total_size = 2048 + 64; - dev.m_log2_pages_per_block = compute_log2(128); - dev.m_num_pages = 128 * 8192; - dev.m_col_address_cycles = 2; - dev.m_row_address_cycles = 3; - dev.m_sequential_row_read = 0; - break; - default: - printf("Unknown NAND type!\n"); - dev.m_id_len = 0; - dev.m_page_data_size = 0; - dev.m_page_total_size = 0; - dev.m_log2_pages_per_block = 0; - dev.m_num_pages = 0; - dev.m_col_address_cycles = 0; - dev.m_row_address_cycles = 0; - dev.m_sequential_row_read = 0; - break; - } - } - - int is_present(); - int is_protected(); - int is_busy(); - - UINT8 data_r(); - void command_w(UINT8 data); - void address_w(UINT8 data); - void data_w(UINT8 data); - - void read(int offset, void *data, int size); - - void set_data_ptr(void *ptr); -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - int m_page_data_size; // 256 for a 2MB card, 512 otherwise - int m_page_total_size;// 264 for a 2MB card, 528 otherwise - int m_num_pages; // 8192 for a 4MB card, 16184 for 8MB, 32768 for 16MB, - // 65536 for 32MB, 131072 for 64MB, 262144 for 128MB... - // 0 means no card loaded - int m_log2_pages_per_block; // log2 of number of pages per erase block (usually 4 or 5) - - UINT8 *m_data_ptr; // FEEPROM data area - UINT8 *m_data_uid_ptr; - - sm_mode_t m_mode; // current operation mode - pointer_sm_mode_t m_pointer_mode; // pointer mode - - unsigned int m_page_addr; // page address pointer - int m_byte_addr; // byte address pointer - int m_addr_load_ptr; // address load pointer - - int m_status; // current status - int m_accumulated_status; // accumulated status - - UINT8 *m_pagereg; // page register used by program command - UINT8 m_id[5]; // chip ID - UINT8 m_mp_opcode; // multi-plane operation code - - int m_mode_3065; - - // Palm Z22 NAND has 512 + 16 byte pages but, for some reason, Palm OS writes 512 + 64 bytes when - // programming a page, so we need to keep track of the number of bytes written so we can ignore the - // last 48 (64 - 16) bytes or else the first 48 bytes get overwritten - int m_program_byte_count; - - int m_id_len; - int m_col_address_cycles; - int m_row_address_cycles; - int m_sequential_row_read; - - devcb_write_line m_write_rnb; - - #ifdef SMARTMEDIA_IMAGE_SAVE - int m_image_format; - #endif -}; - - - -class smartmedia_image_device : public nand_device, - public device_image_interface -{ -public: - // construction/destruction - smartmedia_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_MEMCARD; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 0; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return "sm_memc"; } - virtual const char *file_extensions() const { return "smc"; } - virtual const option_guide *create_option_guide() const { return NULL; } - - virtual bool call_load(); - virtual void call_unload(); - virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); } - -protected: - // device-level overrides - virtual void device_config_complete(); - - bool smartmedia_format_1(); - bool smartmedia_format_2(); - int detect_geometry( UINT8 id1, UINT8 id2); -}; - - -// device type definition -extern const device_type NAND; -extern const device_type SMARTMEDIA; - - -#endif /* __SMARTMEDIA_H__ */ diff --git a/src/mess/machine/sms.c b/src/mess/machine/sms.c deleted file mode 100644 index 32081091088..00000000000 --- a/src/mess/machine/sms.c +++ /dev/null @@ -1,1521 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Charles MacDonald,Mathis Rosenhauer,Brad Oliver,Michael Luong,Fabio Priuli,Enik Land -#include "emu.h" -#include "crsshair.h" -#include "video/315_5124.h" -#include "sound/sn76496.h" -#include "sound/2413intf.h" -#include "includes/sms.h" - -#define VERBOSE 0 -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - -#define ENABLE_NONE 0x00 -#define ENABLE_EXPANSION 0x01 -#define ENABLE_CARD 0x02 -#define ENABLE_CART 0x04 -#define ENABLE_BIOS 0x08 -#define ENABLE_EXT_RAM 0x10 - - -void sms_state::lphaser_hcount_latch() -{ - /* A delay seems to occur when the Light Phaser latches the - VDP hcount, then an offset is added here to the hpos. */ - m_vdp->hcount_latch_at_hpos(m_main_scr->hpos() + m_lphaser_x_offs); -} - - -WRITE_LINE_MEMBER(sms_state::sms_ctrl1_th_input) -{ - // Check if TH of controller port 1 is set to input (1) - if (m_io_ctrl_reg & 0x02) - { - if (state == 0) - { - m_ctrl1_th_latch = 1; - } - else - { - // State is 1. If changed from 0, hcount is latched. - if (m_ctrl1_th_state == 0) - lphaser_hcount_latch(); - } - m_ctrl1_th_state = state; - } -} - - -WRITE_LINE_MEMBER(sms_state::sms_ctrl2_th_input) -{ - // Check if TH of controller port 2 is set to input (1) - if (m_io_ctrl_reg & 0x08) - { - if (state == 0) - { - m_ctrl2_th_latch = 1; - } - else - { - // State is 1. If changed from 0, hcount is latched. - if (m_ctrl2_th_state == 0) - lphaser_hcount_latch(); - } - m_ctrl2_th_state = state; - } -} - - -WRITE_LINE_MEMBER(sms_state::gg_ext_th_input) -{ - if (!(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) - return; - - // The EXT port act as the controller port 2 on SMS compatibility mode. - sms_ctrl2_th_input(state); -} - - -void sms_state::sms_get_inputs() -{ - bool port_dd_has_th_input = true; - - UINT8 data1 = 0xff; - UINT8 data2 = 0xff; - - m_port_dc_reg = 0xff; - m_port_dd_reg = 0xff; - - // The bit order of the emulated controller port tries to follow its - // physical pins numbering. For register bits whose order differs, - // it's necessary move the equivalent controller bits to match. - - if (m_is_gamegear) - { - // Assume the Japanese Game Gear behaves as the - // Japanese Master System, regarding TH input. - if (m_is_gg_region_japan) - port_dd_has_th_input = false; - - // For Game Gear, this function is used only if SMS mode is - // enabled, else only register $dc receives input data, through - // direct read of the m_port_gg_dc I/O port. - - data1 = m_port_gg_dc->read(); - m_port_dc_reg &= ~0x03f | data1; - - data2 = m_port_gg_ext->port_r(); - } - else - { - // Sega Mark III does not have TH lines connected. - // The Japanese Master System does not set port $dd with TH input. - if (m_is_mark_iii || m_is_smsj) - port_dd_has_th_input = false; - - data1 = m_port_ctrl1->port_r(); - m_port_dc_reg &= ~0x0f | data1; // Up, Down, Left, Right - m_port_dc_reg &= ~0x10 | (data1 >> 1); // TL (Button 1) - m_port_dc_reg &= ~0x20 | (data1 >> 2); // TR (Button 2) - - data2 = m_port_ctrl2->port_r(); - } - - m_port_dc_reg &= ~0xc0 | (data2 << 6); // Up, Down - m_port_dd_reg &= ~0x03 | (data2 >> 2); // Left, Right - m_port_dd_reg &= ~0x04 | (data2 >> 3); // TL (Button 1) - m_port_dd_reg &= ~0x08 | (data2 >> 4); // TR (Button 2) - - if (port_dd_has_th_input) - { - m_port_dd_reg &= ~0x40 | data1; // TH ctrl1 - m_port_dd_reg &= ~0x80 | (data2 << 1); // TH ctrl2 - } -} - - -WRITE8_MEMBER(sms_state::sms_io_control_w) -{ - bool latch_hcount = false; - UINT8 ctrl1_port_data = 0xff; - UINT8 ctrl2_port_data = 0xff; - - if (m_is_gamegear && !(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) - { - m_io_ctrl_reg = data; - return; - } - - // Controller Port 1: - - // check if TR or TH are set to output (0). - if ((data & 0x03) != 0x03) - { - if (!(data & 0x01)) // TR set to output - { - ctrl1_port_data &= ~0x80 | (data << 3); - } - if (!(data & 0x02)) // TH set to output - { - ctrl1_port_data &= ~0x40 | (data << 1); - } - if (!m_is_gamegear) - m_port_ctrl1->port_w(ctrl1_port_data); - } - // check if TH is set to input (1). - if (data & 0x02) - { - if (!m_is_gamegear) - ctrl1_port_data &= ~0x40 | m_port_ctrl1->port_r(); - - // check if TH input level is high (1) and was output/low (0) - if ((ctrl1_port_data & 0x40) && !(m_io_ctrl_reg & 0x22)) - latch_hcount = true; - } - - // Controller Port 2: - - // check if TR or TH are set to output (0). - if ((data & 0x0c) != 0x0c) - { - if (!(data & 0x04)) // TR set to output - { - ctrl2_port_data &= ~0x80 | (data << 1); - } - if (!(data & 0x08)) // TH set to output - { - ctrl2_port_data &= ~0x40 | (data >> 1); - } - if (!m_is_gamegear) - m_port_ctrl2->port_w(ctrl2_port_data); - else - m_port_gg_ext->port_w(ctrl2_port_data); - } - // check if TH is set to input (1). - if (data & 0x08) - { - if (!m_is_gamegear) - ctrl2_port_data &= ~0x40 | m_port_ctrl2->port_r(); - else - ctrl2_port_data &= ~0x40 | m_port_gg_ext->port_r(); - - // check if TH input level is high (1) and was output/low (0) - if ((ctrl2_port_data & 0x40) && !(m_io_ctrl_reg & 0x88)) - latch_hcount = true; - } - - if (latch_hcount) - { - m_vdp->hcount_latch(); - } - m_io_ctrl_reg = data; -} - - -READ8_MEMBER(sms_state::sms_count_r) -{ - if (offset & 0x01) - return m_vdp->hcount_read(*m_space, offset); - else - return m_vdp->vcount_read(*m_space, offset); -} - - -/* - Check if the pause button is pressed. - If the gamegear is in sms mode, check if the start button is pressed. - */ -WRITE_LINE_MEMBER(sms_state::sms_pause_callback) -{ - bool pause_pressed = false; - - if (!m_is_mark_iii) - { - // clear TH latch of the controller ports - m_ctrl1_th_latch = 0; - m_ctrl2_th_latch = 0; - } - - if (m_is_gamegear) - { - if (!(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) - return; - - if (!(m_port_start->read() & 0x80)) - pause_pressed = true; - } - else - { - if (!(m_port_pause->read() & 0x80)) - pause_pressed = true; - } - - if (pause_pressed) - { - if (!m_paused) - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - - m_paused = 1; - } - else - m_paused = 0; -} - - -READ8_MEMBER(sms_state::sms_input_port_dc_r) -{ - if (m_is_mark_iii) - { - sms_get_inputs(); - return m_port_dc_reg; - } - - if (m_is_gamegear) - { - // If SMS mode is disabled, just return the data read from the - // input port. Its mapped port bits match the bits of register $dc. - if (!(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) - return m_port_gg_dc->read(); - } - else - { - // Return if the I/O chip is disabled (1). This check isn't performed - // for the Game Gear because has no effect on it (even in SMS mode?). - if (m_mem_ctrl_reg & IO_CHIP) - return 0xff; - } - - sms_get_inputs(); - - // Check if TR of controller port 1 is set to output (0) - if (!(m_io_ctrl_reg & 0x01)) - { - // Read TR state set through IO control port - m_port_dc_reg &= ~0x20 | ((m_io_ctrl_reg & 0x10) << 1); - } - - return m_port_dc_reg; -} - - -READ8_MEMBER(sms_state::sms_input_port_dd_r) -{ - if (m_is_mark_iii) - { - sms_get_inputs(); - return m_port_dd_reg; - } - - if (m_is_gamegear) - { - if (!(m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())) - return 0xff; - } - else - { - // Return if the I/O chip is disabled (1). This check isn't performed - // for the Game Gear because has no effect on it (even in SMS mode?). - if (m_mem_ctrl_reg & IO_CHIP) - return 0xff; - } - - sms_get_inputs(); - - // Check if TR of controller port 2 is set to output (0) - if (!(m_io_ctrl_reg & 0x04)) - { - // Read TR state set through IO control port - m_port_dd_reg &= ~0x08 | ((m_io_ctrl_reg & 0x40) >> 3); - } - - if (m_is_smsj || (m_is_gamegear && m_is_gg_region_japan)) - { - // For Japanese Master System, set upper 4 bits with TH/TR - // direction bits of IO control register, according to Enri's - // docs ( http://www43.tok2.com/home/cmpslv/Sms/EnrSms.htm ). - // This makes the console incapable of using the Light Phaser. - // Assume the same for a Japanese Game Gear. - m_port_dd_reg &= ~0x10 | ((m_io_ctrl_reg & 0x01) << 4); - m_port_dd_reg &= ~0x20 | ((m_io_ctrl_reg & 0x04) << 3); - m_port_dd_reg &= ~0x40 | ((m_io_ctrl_reg & 0x02) << 5); - m_port_dd_reg &= ~0x80 | ((m_io_ctrl_reg & 0x08) << 4); - return m_port_dd_reg; - } - - // Reset Button - if ( m_port_reset ) - { - m_port_dd_reg &= ~0x10 | (m_port_reset->read() & 0x01) << 4; - } - - // Check if TH of controller port 1 is set to output (0) - if (!(m_io_ctrl_reg & 0x02)) - { - // Read TH state set through IO control port - m_port_dd_reg &= ~0x40 | ((m_io_ctrl_reg & 0x20) << 1); - } - else // TH set to input (1) - { - if (m_ctrl1_th_latch) - { - m_port_dd_reg &= ~0x40; - m_ctrl1_th_latch = 0; - } - } - - // Check if TH of controller port 2 is set to output (0) - if (!(m_io_ctrl_reg & 0x08)) - { - // Read TH state set through IO control port - m_port_dd_reg &= ~0x80 | (m_io_ctrl_reg & 0x80); - } - else // TH set to input (1) - { - if (m_ctrl2_th_latch) - { - m_port_dd_reg &= ~0x80; - m_ctrl2_th_latch = 0; - } - } - - return m_port_dd_reg; -} - - -WRITE8_MEMBER(sms_state::sms_audio_control_w) -{ - if (m_has_fm) - { - if (m_is_smsj) - m_audio_control = data & 0x03; - else - m_audio_control = data & 0x01; - } -} - - -READ8_MEMBER(sms_state::sms_audio_control_r) -{ - if (m_has_fm) - // The register reference on SMSPower states that just the - // first bit written is returned on reads (even for smsj?). - return m_audio_control & 0x01; - else - return sms_input_port_dc_r(space, offset); -} - - -WRITE8_MEMBER(sms_state::sms_ym2413_register_port_w) -{ - if (m_has_fm && (m_audio_control & 0x01)) - m_ym->write(space, 0, data & 0x3f); -} - - -WRITE8_MEMBER(sms_state::sms_ym2413_data_port_w) -{ - if (m_has_fm && (m_audio_control & 0x01)) - { - //logerror("data_port_w %x %x\n", offset, data); - m_ym->write(space, 1, data); - } -} - - -WRITE8_MEMBER(sms_state::sms_psg_w) -{ - // On Japanese SMS, if FM is enabled, PSG must be explicitly enabled too. - if (m_is_smsj && (m_audio_control & 0x01) && !(m_audio_control & 0x02)) - return; - - m_psg_sms->write(space, offset, data, mem_mask); -} - - -WRITE8_MEMBER(sms_state::gg_psg_w) -{ - m_psg_gg->write(space, offset, data, mem_mask); -} - - -WRITE8_MEMBER(sms_state::gg_psg_stereo_w) -{ - if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) - return; - - m_psg_gg->stereo_w(space, offset, data, mem_mask); -} - - -READ8_MEMBER(sms_state::gg_input_port_00_r) -{ - if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) - return 0xff; - else - { - UINT8 data = (m_is_gg_region_japan ? 0x00 : 0x40) | (m_port_start->read() & 0x80); - - //logerror("port $00 read, val: %02x, pc: %04x\n", data, activecpu_get_pc()); - return data; - } -} - - -READ8_MEMBER(sms_state::sms_sscope_r) -{ - int sscope = m_port_scope->read(); - - if ( sscope ) - { - // Scope is attached - return m_sscope_state; - } - - return read_ram(space, 0x3ff8 + offset); -} - - -WRITE8_MEMBER(sms_state::sms_sscope_w) -{ - write_ram(space, 0x3ff8 + offset, data); - - int sscope = m_port_scope->read(); - - if ( sscope ) - { - // Scope is attached - m_sscope_state = data; - - // There are occurrences when Sega Scope's state changes after VBLANK, or at - // active screen. Most cases are solid-color frames of scene transitions, but - // one exception is the first frame of Zaxxon 3-D's title screen. In that - // case, this method is enough for setting the intended state for the frame. - // No information found about a minimum time need for switch open/closed lens. - if (m_main_scr->vpos() < (m_main_scr->height() >> 1)) - { - m_frame_sscope_state = m_sscope_state; - } - } -} - - -READ8_MEMBER(sms_state::read_ram) -{ - if (m_mem_device_enabled & ENABLE_EXT_RAM) - { - UINT8 data = 0xff; - - if (m_mem_device_enabled & ENABLE_CART) - data &= m_cartslot->read_ram(space, offset); - if (m_mem_device_enabled & ENABLE_CARD) - data &= m_cardslot->read_ram(space, offset); - if (m_mem_device_enabled & ENABLE_EXPANSION) - data &= m_expslot->read_ram(space, offset); - - return data; - } - else - { - return m_mainram[offset & 0x1fff]; - } -} - - -WRITE8_MEMBER(sms_state::write_ram) -{ - if (m_mem_device_enabled & ENABLE_EXT_RAM) - { - if (m_mem_device_enabled & ENABLE_CART) - m_cartslot->write_ram(space, offset, data); - if (m_mem_device_enabled & ENABLE_CARD) - m_cardslot->write_ram(space, offset, data); - if (m_mem_device_enabled & ENABLE_EXPANSION) - m_expslot->write_ram(space, offset, data); - } - else - { - m_mainram[offset & 0x1fff] = data; - } -} - - -READ8_MEMBER(sms_state::sms_mapper_r) -{ - return read_ram(space, 0x3ffc + offset); -} - - -WRITE8_MEMBER(sms_state::sms_mapper_w) -{ - m_mapper[offset] = data; - write_ram(space, 0x3ffc + offset, data); - - switch (offset) - { - case 0: // Control RAM/ROM - if (!(data & 0x08) && (m_mem_device_enabled & ENABLE_BIOS)) // BIOS ROM - { - if (!m_has_bios_0400 && !m_has_bios_2000) - { - m_bios_page[2] = m_mapper[3]; - } - } - if (m_mem_device_enabled & ENABLE_CART) // CART ROM/RAM - { - m_cartslot->write_mapper(space, offset, data); - } - if (m_mem_device_enabled & ENABLE_CARD) // CARD ROM/RAM - { - m_cardslot->write_mapper(space, offset, data); - } - if (m_mem_device_enabled & ENABLE_EXPANSION) // expansion slot - { - m_expslot->write_mapper(space, offset, data); - } - break; - - case 1: // Select 16k ROM bank for 0400-3fff - case 2: // Select 16k ROM bank for 4000-7fff - case 3: // Select 16k ROM bank for 8000-bfff - if (m_mem_device_enabled & ENABLE_BIOS) - { - if (!m_has_bios_0400 && !m_has_bios_2000) - { - m_bios_page[offset - 1] = data & (m_bios_page_count - 1); - } - } - if (m_mem_device_enabled & ENABLE_CART) - { - m_cartslot->write_mapper(space, offset, data); - } - if (m_mem_device_enabled & ENABLE_CARD) - { - m_cardslot->write_mapper(space, offset, data); - } - if (m_mem_device_enabled & ENABLE_EXPANSION) - { - m_expslot->write_mapper(space, offset, data); - } - break; - } -} - - -UINT8 sms_state::read_bus(address_space &space, unsigned int page, UINT16 base_addr, UINT16 offset) -{ - if (m_is_gamegear) - { - // Game Gear BIOS behavior, according to Charles MacDonald: "it uses the first - // 1K. The rest of the space is mapped to the cartridge, regardless of the slot - // that's selected. This allows the BIOS to check for the 'TMR SEGA' string at - // 1FF0/3FF0/7FF0, but it can't do a checksum since the first 1K of ROM is - // unavailable. Anyway, once the BIOS decides to run the game, it disables - // itself, and the first 1K is assigned to the cartridge ROM like normal." - - if ((m_mem_device_enabled & ENABLE_BIOS) && page == 3) - return m_BIOS[(m_bios_page[page] * 0x4000) + (offset & 0x3fff)]; - if (m_mem_device_enabled & ENABLE_CART) - return m_cartslot->read_cart(space, base_addr + offset); - } - else if (m_mem_device_enabled != ENABLE_NONE) - { - UINT8 data = 0xff; - - // SMS2 behavior described by Charles MacDonald's SMS notes: - // "If the BIOS is enabled at the same time the cartridge slot is, - // the data from both sources are logically ANDed together when read." - - if (m_mem_device_enabled & ENABLE_BIOS) - data &= m_BIOS[(m_bios_page[page] * 0x4000) + (offset & 0x3fff)]; - if (m_mem_device_enabled & ENABLE_CART) - data &= m_cartslot->read_cart(space, base_addr + offset); - if (m_mem_device_enabled & ENABLE_CARD) - data &= m_cardslot->read_cart(space, base_addr + offset); - if (m_mem_device_enabled & ENABLE_EXPANSION) - data &= m_expslot->read(space, base_addr + offset); - - return data; - } - return m_region_maincpu->base()[offset]; -} - - -READ8_MEMBER(sms_state::read_0000) -{ - if (offset < 0x400) - { - return read_bus(space, 3, 0x0000, offset); - } - else - { - return read_bus(space, 0, 0x0000, offset); - } -} - -READ8_MEMBER(sms_state::read_4000) -{ - return read_bus(space, 1, 0x4000, offset); -} - -READ8_MEMBER(sms_state::read_8000) -{ - return read_bus(space, 2, 0x8000, offset); -} - -WRITE8_MEMBER(sms_state::write_cart) -{ - if (m_mem_device_enabled & ENABLE_CART) - m_cartslot->write_cart(space, offset, data); - if (m_mem_device_enabled & ENABLE_CARD) - m_cardslot->write_cart(space, offset, data); - if (m_mem_device_enabled & ENABLE_EXPANSION) - m_expslot->write(space, offset, data); -} - - -READ8_MEMBER(smssdisp_state::store_cart_peek) -{ - if (m_mem_device_enabled != ENABLE_NONE) - { - UINT8 data = 0xff; - - if (m_mem_device_enabled & ENABLE_CART) - data &= m_cartslot->read_cart(space, 0x6000 + (offset & 0x1fff)); - - return data; - } - else - { - return m_region_maincpu->base()[offset]; - } -} - -WRITE8_MEMBER(sms_state::sms_mem_control_w) -{ - m_mem_ctrl_reg = data; - - logerror("memory control reg write %02x, pc: %04x\n", data, space.device().safe_pc()); - - setup_media_slots(); -} - - -WRITE8_MEMBER(sms_state::gg_sio_w) -{ - if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) - return; - - logerror("*** write %02X to SIO register #%d\n", data, offset); - - m_gg_sio[offset & 0x07] = data; - switch (offset & 7) - { - case 0x00: /* Parallel Data */ - break; - - case 0x01: /* Data Direction / NMI Enable */ - break; - - case 0x02: /* Serial Output */ - break; - - case 0x03: /* Serial Input */ - break; - - case 0x04: /* Serial Control / Status */ - break; - } -} - - -READ8_MEMBER(sms_state::gg_sio_r) -{ - if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) - return 0xff; - - logerror("*** read SIO register #%d\n", offset); - - switch (offset & 7) - { - case 0x00: /* Parallel Data */ - break; - - case 0x01: /* Data Direction / NMI Enable */ - break; - - case 0x02: /* Serial Output */ - break; - - case 0x03: /* Serial Input */ - break; - - case 0x04: /* Serial Control / Status */ - break; - } - - return m_gg_sio[offset]; -} - - -void sms_state::setup_enabled_slots() -{ - m_mem_device_enabled = ENABLE_NONE; - - if (m_is_mark_iii) - { - // Mark III uses the card slot by default, but has hardware method - // (/CART pin) that prioritizes the cartridge slot if it has media - // inserted. Japanese 3-D cartridges do not connect the /CART pin, - // to not disable the card adaptor used by the 3-D glasses. - if (m_cartslot && m_cartslot->exists()) - { - m_mem_device_enabled |= ENABLE_CART; - logerror("Cartridge ROM/RAM enabled.\n"); - } - else if (m_cardslot && m_cardslot->exists()) - { - m_mem_device_enabled |= ENABLE_CARD; - logerror("Card ROM port enabled.\n"); - } - return; - } - - if (!(m_mem_ctrl_reg & IO_EXPANSION) && m_expslot && m_expslot->m_device) - { - m_mem_device_enabled |= ENABLE_EXPANSION; - logerror("Expansion port enabled.\n"); - } - - if (!(m_mem_ctrl_reg & IO_CARD) && m_cardslot && m_cardslot->exists()) - { - m_mem_device_enabled |= ENABLE_CARD; - logerror("Card ROM port enabled.\n"); - } - - if ((m_is_gamegear || !(m_mem_ctrl_reg & IO_CARTRIDGE)) && m_cartslot && m_cartslot->exists()) - { - m_mem_device_enabled |= ENABLE_CART; - logerror("Cartridge ROM/RAM enabled.\n"); - } - - if (!(m_mem_ctrl_reg & IO_BIOS_ROM) && m_BIOS) - { - m_mem_device_enabled |= ENABLE_BIOS; - logerror("BIOS enabled.\n"); - } -} - - -void sms_state::setup_media_slots() -{ - setup_enabled_slots(); - - if (m_mem_device_enabled == ENABLE_NONE) - return; - - // Setup cartridge RAM - if (!m_is_mark_iii && (m_mem_ctrl_reg & IO_WORK_RAM)) // Work RAM disabled (1). - { - m_mem_device_enabled |= ENABLE_EXT_RAM; - } - else if (m_has_jpn_sms_cart_slot && (m_mem_device_enabled & ENABLE_CART)) - { - // a bunch of SG1000 carts (compatible with SG1000 Mark III) use their own RAM... - // TODO: are BASIC and Music actually compatible with Mark III?? - if (m_cartslot->get_type() == SEGA8_BASIC_L3 || - m_cartslot->get_type() == SEGA8_MUSIC_EDITOR || - m_cartslot->get_type() == SEGA8_DAHJEE_TYPEA || - m_cartslot->get_type() == SEGA8_DAHJEE_TYPEB) - { - m_mem_device_enabled |= ENABLE_EXT_RAM; - } - } - - // Set offset for Light Phaser - if (!m_is_mark_iii) - { - m_lphaser_x_offs = -1; // same value returned for ROMs without custom offset. - - if (m_mem_device_enabled & ENABLE_CART) - m_lphaser_x_offs = m_cartslot->m_cart->get_lphaser_xoffs(); - else if (m_mem_device_enabled & ENABLE_CARD) - m_lphaser_x_offs = m_cardslot->m_cart->get_lphaser_xoffs(); - else if (m_mem_device_enabled & ENABLE_EXPANSION) - m_lphaser_x_offs = m_expslot->m_device->get_lphaser_xoffs(); - - if (m_lphaser_x_offs == -1) - m_lphaser_x_offs = 36; - } -} - - -void sms_state::setup_bios() -{ - m_BIOS = memregion("user1")->base(); - m_bios_page_count = (m_BIOS ? memregion("user1")->bytes() / 0x4000 : 0); - - if (m_BIOS == NULL || m_BIOS[0] == 0x00) - { - m_BIOS = NULL; - m_has_bios_0400 = 0; - m_has_bios_2000 = 0; - m_has_bios_full = 0; - } - - if (m_BIOS) - { - m_bios_page[3] = 0; - m_bios_page[0] = 0; - m_bios_page[1] = (1 < m_bios_page_count) ? 1 : 0; - m_bios_page[2] = (2 < m_bios_page_count) ? 2 : 0; - } - - if (!m_is_mark_iii) - { - m_mem_ctrl_reg = (IO_EXPANSION | IO_CARTRIDGE | IO_CARD); - if (!m_BIOS) - { - m_mem_ctrl_reg &= ~(IO_CARTRIDGE); - m_mem_ctrl_reg |= IO_BIOS_ROM; - } - } -} - -MACHINE_START_MEMBER(sms_state,sms) -{ - char str[7]; - - m_cartslot = machine().device("slot"); - m_cardslot = machine().device("mycard"); - m_expslot = machine().device("exp"); - m_space = &m_maincpu->space(AS_PROGRAM); - - if (m_mainram == NULL) - { - m_mainram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_mainram), 0x2000); - - // alibaba and blockhol are ports of games for the MSX system. The - // MSX bios usually initializes callback "vectors" at the top of RAM. - // The code in alibaba does not do this so the IRQ vector only contains - // the "call $4010" without a following RET statement. That is basically - // a bug in the program code. The only way this cartridge could have run - // successfully on a real unit is if the RAM would be initialized with - // a F0 pattern on power up; F0 = RET P. - // This initialization breaks some Game Gear games though (e.g. - // tempojr), suggesting that not all systems had the same initialization. - // This also breaks some homebrew softwares (e.g. Nine Pixels). - // For the moment we apply this to systems that have the Japanese SMS - // cartridge slot. - if (m_has_jpn_sms_cart_slot) - { - memset(m_mainram, 0xf0, 0x2000); - } - } - - save_item(NAME(m_paused)); - save_item(NAME(m_mapper)); - save_item(NAME(m_port_dc_reg)); - save_item(NAME(m_port_dd_reg)); - save_item(NAME(m_mem_device_enabled)); - - if (m_has_fm) - { - save_item(NAME(m_audio_control)); - } - - if (!m_is_mark_iii) - { - save_item(NAME(m_mem_ctrl_reg)); - save_item(NAME(m_bios_page)); - save_item(NAME(m_io_ctrl_reg)); - save_item(NAME(m_ctrl1_th_latch)); - save_item(NAME(m_ctrl2_th_latch)); - save_item(NAME(m_ctrl1_th_state)); - save_item(NAME(m_ctrl2_th_state)); - save_item(NAME(m_lphaser_x_offs)); - } - - if (m_is_gamegear) - { - save_item(NAME(m_gg_sio)); - } - - if (m_is_sdisp) - { - machine().save().register_postload(save_prepost_delegate(FUNC(sms_state::store_post_load), this)); - - save_item(NAME(m_store_control)); - save_item(NAME(m_store_cart_selection_data)); - - m_slots[0] = m_cartslot; - for (int i = 1; i < 16; i++) - { - sprintf(str,"slot%i",i + 1); - m_slots[i] = machine().device(str); - } - for (int i = 0; i < 16; i++) - { - sprintf(str,"slot%i",i + 16 + 1); - m_cards[i] = machine().device(str); - } - } - - if (m_cartslot) - m_cartslot->save_ram(); -} - -MACHINE_RESET_MEMBER(sms_state,sms) -{ - if (m_has_fm) - m_audio_control = 0x00; - - if (!m_is_mark_iii) - { - m_io_ctrl_reg = 0xff; - m_ctrl1_th_latch = 0; - m_ctrl2_th_latch = 0; - m_ctrl1_th_state = 1; - m_ctrl2_th_state = 1; - } - - if (m_is_gamegear) - { - if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) - m_vdp->set_sega315_5124_compatibility_mode(true); - - /* Initialize SIO stuff for GG */ - m_gg_sio[0] = 0x7f; - m_gg_sio[1] = 0xff; - m_gg_sio[2] = 0x00; - m_gg_sio[3] = 0xff; - m_gg_sio[4] = 0x00; - } - - if (m_is_sdisp) - { - m_store_control = 0; - m_store_cart_selection_data = 0; - store_select_cart(m_store_cart_selection_data); - } - - setup_bios(); - setup_media_slots(); -} - -READ8_MEMBER(smssdisp_state::sms_store_cart_select_r) -{ - return m_store_cart_selection_data; -} - - -WRITE8_MEMBER(smssdisp_state::sms_store_cart_select_w) -{ - store_select_cart(data); - m_store_cart_selection_data = data; - setup_media_slots(); -} - - -void sms_state::store_post_load() -{ - store_select_cart(m_store_cart_selection_data); -} - - -// There are two known models of the Store Display Unit: -// -// - the one with 16 cart slots and 3 card slots; -// - the one with 16 cart slots and 16 card slots. -// -// On front panel of both models there are only 16 game switches, -// that seems to change the active cart/card slot pair or, for the 4th -// game switch onward of the 16-3 model, the active cart slot only. - -void sms_state::store_select_cart(UINT8 data) -{ - UINT8 slot = data >> 4; - UINT8 slottype = data & 0x08; - - // The SMS Store Display Unit only uses the logical cartridge slot to - // map the active cartridge or card slot, of its multiple ones. - if (slottype == 0) - m_cartslot = m_slots[slot]; - else - m_cartslot = m_cards[slot]; - - logerror("switching in part of %s slot #%d\n", slottype ? "card" : "cartridge", slot); -} - -WRITE8_MEMBER(smssdisp_state::sms_store_control_w) -{ - int led_number = data >> 4; - int led_column = led_number / 4; - int led_line = led_number % 4; - int game_number = (4 * led_column) + (3 - led_line); - - logerror("0x%04X: sms_store_control write 0x%02X\n", space.device().safe_pc(), data); - logerror("sms_store_control: LED #%d activated for game #%d\n", led_number, game_number); - - if (data & 0x02) - { - m_maincpu->resume(SUSPEND_REASON_HALT); - } - else - { - /* Pull reset line of CPU #0 low */ - m_maincpu->reset(); - m_maincpu->suspend(SUSPEND_REASON_HALT, 1); - } - m_store_control = data; -} - -WRITE_LINE_MEMBER(smssdisp_state::sms_store_int_callback) -{ - if ( m_store_control & 0x01 ) - { - m_control_cpu->set_input_line( 0, state ); - } - else - { - m_maincpu->set_input_line( 0, state ); - } -} - -DRIVER_INIT_MEMBER(sms_state,sg1000m3) -{ - m_is_mark_iii = 1; - m_has_fm = 1; - m_has_jpn_sms_cart_slot = 1; -} - - -DRIVER_INIT_MEMBER(sms_state,sms1) -{ - m_has_bios_full = 1; -} - - -DRIVER_INIT_MEMBER(sms_state,smsj) -{ - m_is_smsj = 1; - m_has_bios_2000 = 1; - m_has_fm = 1; - m_has_jpn_sms_cart_slot = 1; -} - - -DRIVER_INIT_MEMBER(sms_state,sms1krfm) -{ - m_has_bios_2000 = 1; - m_has_fm = 1; - m_has_jpn_sms_cart_slot = 1; -} - - -DRIVER_INIT_MEMBER(sms_state,sms1kr) -{ - m_has_bios_2000 = 1; - m_has_jpn_sms_cart_slot = 1; -} - - -DRIVER_INIT_MEMBER(sms_state,smskr) -{ - m_has_bios_full = 1; - // Despite having a Japanese cartridge slot, this version is detected as Export region. - m_has_jpn_sms_cart_slot = 1; -} - - -DRIVER_INIT_MEMBER(smssdisp_state,smssdisp) -{ - m_is_sdisp = 1; -} - - -DRIVER_INIT_MEMBER(sms_state,gamegear) -{ - m_is_gamegear = 1; - m_has_bios_0400 = 1; -} - - -DRIVER_INIT_MEMBER(sms_state,gamegeaj) -{ - m_is_gamegear = 1; - m_has_bios_0400 = 1; - m_is_gg_region_japan = 1; -} - - -VIDEO_START_MEMBER(sms_state,sms1) -{ - m_left_lcd = machine().device("left_lcd"); - m_right_lcd = machine().device("right_lcd"); - - m_main_scr->register_screen_bitmap(m_prevleft_bitmap); - m_main_scr->register_screen_bitmap(m_prevright_bitmap); - save_item(NAME(m_prevleft_bitmap)); - save_item(NAME(m_prevright_bitmap)); - save_item(NAME(m_sscope_state)); - save_item(NAME(m_frame_sscope_state)); - - // Allow sscope screens to have crosshair, useful for the game missil3d - crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_ALL); -} - - -VIDEO_RESET_MEMBER(sms_state,sms1) -{ - if (m_port_scope->read()) - { - UINT8 sscope_binocular_hack = m_port_scope_binocular->read(); - - if (sscope_binocular_hack & 0x01) - m_prevleft_bitmap.fill(rgb_t::black); - if (sscope_binocular_hack & 0x02) - m_prevright_bitmap.fill(rgb_t::black); - } - - m_sscope_state = 0; - m_frame_sscope_state = 0; -} - - -READ32_MEMBER(sms_state::sms_pixel_color) -{ - bitmap_rgb32 &vdp_bitmap = m_vdp->get_bitmap(); - int beam_x = m_main_scr->hpos(); - int beam_y = m_main_scr->vpos(); - - return vdp_bitmap.pix32(beam_y, beam_x); -} - - -void sms_state::screen_vblank_sms1(screen_device &screen, bool state) -{ - // on falling edge - if (!state) - { - // Most of the 3-D games usually set Sega Scope's state for next frame - // soon after the active area of current frame was drawn, but before - // it is displayed by the screen update function. That function needs to - // check the state used at the time of frame drawing, to display it on - // the correct side. So here, when the frame is about to be drawn, the - // Sega Scope's state is stored, to be checked by that function. - m_frame_sscope_state = m_sscope_state; - } -} - - -UINT32 sms_state::screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT8 sscope = 0; - UINT8 sscope_binocular_hack; - UINT8 occluded_view = 0; - - if (&screen != m_main_scr) - { - sscope = m_port_scope->read(); - if (!sscope) - { - // without SegaScope, both LCDs for glasses go black - occluded_view = 1; - } - else if (&screen == m_left_lcd) - { - // with SegaScope, state 0 = left screen OFF, right screen ON - if (!(m_frame_sscope_state & 0x01)) - occluded_view = 1; - } - else // it's right LCD - { - // with SegaScope, state 1 = left screen ON, right screen OFF - if (m_frame_sscope_state & 0x01) - occluded_view = 1; - } - } - - if (!occluded_view) - { - m_vdp->screen_update(screen, bitmap, cliprect); - - // HACK: fake 3D->2D handling (if enabled, it repeats each frame twice on the selected lens) - // save a copy of current bitmap for the binocular hack - if (sscope) - { - sscope_binocular_hack = m_port_scope_binocular->read(); - - if (&screen == m_left_lcd) - { - if (sscope_binocular_hack & 0x01) - copybitmap(m_prevleft_bitmap, bitmap, 0, 0, 0, 0, cliprect); - } - else // it's right LCD - { - if (sscope_binocular_hack & 0x02) - copybitmap(m_prevright_bitmap, bitmap, 0, 0, 0, 0, cliprect); - } - } - } - else - { - // HACK: fake 3D->2D handling (if enabled, it repeats each frame twice on the selected lens) - // use the copied bitmap for the binocular hack - if (sscope) - { - sscope_binocular_hack = m_port_scope_binocular->read(); - - if (&screen == m_left_lcd) - { - if (sscope_binocular_hack & 0x01) - { - copybitmap(bitmap, m_prevleft_bitmap, 0, 0, 0, 0, cliprect); - return 0; - } - } - else // it's right LCD - { - if (sscope_binocular_hack & 0x02) - { - copybitmap(bitmap, m_prevright_bitmap, 0, 0, 0, 0, cliprect); - return 0; - } - } - } - bitmap.fill(rgb_t::black, cliprect); - } - - return 0; -} - -UINT32 sms_state::screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_vdp->screen_update(screen, bitmap, cliprect); - return 0; -} - -VIDEO_START_MEMBER(sms_state,gamegear) -{ - m_prev_bitmap_copied = false; - m_main_scr->register_screen_bitmap(m_prev_bitmap); - m_main_scr->register_screen_bitmap(m_gg_sms_mode_bitmap); - m_line_buffer = auto_alloc_array(machine(), int, 160 * 4); - - save_item(NAME(m_prev_bitmap_copied)); - save_item(NAME(m_prev_bitmap)); - save_item(NAME(m_gg_sms_mode_bitmap)); - save_pointer(NAME(m_line_buffer), 160 * 4); -} - -VIDEO_RESET_MEMBER(sms_state,gamegear) -{ - if (m_prev_bitmap_copied) - { - m_prev_bitmap.fill(rgb_t::black); - m_prev_bitmap_copied = false; - } - if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) - { - m_gg_sms_mode_bitmap.fill(rgb_t::black); - memset(m_line_buffer, 0, 160 * 4 * sizeof(int)); - } -} - - -void sms_state::screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - bitmap_rgb32 &vdp_bitmap = m_vdp->get_bitmap(); - const rectangle visarea = screen.visible_area(); - - /* Plot positions relative to visarea minimum values */ - const int plot_min_x = cliprect.min_x - visarea.min_x; - const int plot_max_x = MIN(cliprect.max_x - visarea.min_x, 159); // avoid m_line_buffer overflow. - const int plot_min_y = cliprect.min_y - visarea.min_y; - const int plot_max_y = cliprect.max_y - visarea.min_y; - - /* For each group of 3 SMS pixels, a group of 2 GG pixels is processed. - In case the cliprect coordinates may map any region of the visible area, - take in account the remaining position, if any, of the first group. */ - const int plot_x_first_group = plot_min_x - (plot_min_x % 2); - const int plot_y_first_group = plot_min_y - (plot_min_y % 2); - - /* Calculation of the minimum scaled value for X */ - const int visarea_xcenter = visarea.xcenter(); - const int sms_offset_min_x = ((int) (visarea_xcenter - cliprect.min_x) / 2) * 3; - const int sms_min_x = visarea_xcenter - sms_offset_min_x; - - /* Calculation of the minimum scaled value for Y */ - const int visarea_ycenter = visarea.ycenter(); - const int sms_offset_min_y = ((int) (visarea_ycenter - cliprect.min_y) / 2) * 3; - const int sms_min_y = visarea_ycenter - sms_offset_min_y; - - int sms_y = sms_min_y; - int y_min_i = plot_min_y - plot_y_first_group; - - /* Auxiliary variable for vertical scaling */ - int sms_y2 = sms_y - 1; - - for (int plot_y_group = plot_y_first_group; plot_y_group <= plot_max_y; plot_y_group += 2) - { - const int y_max_i = MIN(1, plot_max_y - plot_y_group); - - for (int y_i = y_min_i; y_i <= y_max_i; y_i++) - { - /* Include additional lines that have influence over what appears on the LCD */ - const int sms_min_y2 = sms_y + y_i - 1; - const int sms_max_y2 = sms_y + y_i + 2; - - /* Process lines, but skip those already processed before */ - for (sms_y2 = MAX(sms_min_y2, sms_y2); sms_y2 <= sms_max_y2; sms_y2++) - { - int *combineline_buffer = m_line_buffer + (sms_y2 & 0x03) * 160; - - if (sms_y2 >= vdp_bitmap.cliprect().min_y && sms_y2 <= vdp_bitmap.cliprect().max_y) - { - UINT32 *vdp_buffer = &vdp_bitmap.pix32(sms_y2); - - int sms_x = sms_min_x; - int x_min_i = plot_min_x - plot_x_first_group; - - /* Do horizontal scaling */ - for (int plot_x_group = plot_x_first_group; plot_x_group <= plot_max_x; plot_x_group += 2) - { - const int x_max_i = MIN(1, plot_max_x - plot_x_group); - - for (int x_i = x_min_i; x_i <= x_max_i; x_i++) - { - int combined = 0; - - if (sms_x + x_i >= vdp_bitmap.cliprect().min_x && sms_x + x_i + 1 <= vdp_bitmap.cliprect().max_x) - { - switch (x_i) - { - case 0: - /* Take red and green from first pixel, and blue from second pixel */ - combined = (vdp_buffer[sms_x] & 0x00ffff00) | (vdp_buffer[sms_x + 1] & 0x000000ff); - break; - case 1: - /* Take red from second pixel, and green and blue from third pixel */ - combined = (vdp_buffer[sms_x + 1] & 0x00ff0000) | (vdp_buffer[sms_x + 2] & 0x0000ffff); - break; - } - } - - combineline_buffer[plot_x_group + x_i] = combined; - } - - sms_x += 3; - x_min_i = 0; - } - } - else - { - memset(combineline_buffer, 0, 160 * sizeof(int)); - } - } - - /* Do vertical scaling for a screen with 192 or 224 lines - Lines 0-2 and 221-223 have no effect on the output on the GG screen. - We will calculate the gamegear lines as follows: - GG_0 = 1/6 * SMS_3 + 1/3 * SMS_4 + 1/3 * SMS_5 + 1/6 * SMS_6 - GG_1 = 1/6 * SMS_4 + 1/3 * SMS_5 + 1/3 * SMS_6 + 1/6 * SMS_7 - GG_2 = 1/6 * SMS_6 + 1/3 * SMS_7 + 1/3 * SMS_8 + 1/6 * SMS_9 - GG_3 = 1/6 * SMS_7 + 1/3 * SMS_8 + 1/3 * SMS_9 + 1/6 * SMS_10 - GG_4 = 1/6 * SMS_9 + 1/3 * SMS_10 + 1/3 * SMS_11 + 1/6 * SMS_12 - ..... - GG_142 = 1/6 * SMS_216 + 1/3 * SMS_217 + 1/3 * SMS_218 + 1/6 * SMS_219 - GG_143 = 1/6 * SMS_217 + 1/3 * SMS_218 + 1/3 * SMS_219 + 1/6 * SMS_220 - */ - { - int *line1, *line2, *line3, *line4; - - /* Setup our source lines */ - line1 = m_line_buffer + ((sms_y + y_i - 1) & 0x03) * 160; - line2 = m_line_buffer + ((sms_y + y_i - 0) & 0x03) * 160; - line3 = m_line_buffer + ((sms_y + y_i + 1) & 0x03) * 160; - line4 = m_line_buffer + ((sms_y + y_i + 2) & 0x03) * 160; - - UINT32 *p_bitmap = &bitmap.pix32(visarea.min_y + plot_y_group + y_i, visarea.min_x); - - for (int plot_x = plot_min_x; plot_x <= plot_max_x; plot_x++) - { - rgb_t c1 = line1[plot_x]; - rgb_t c2 = line2[plot_x]; - rgb_t c3 = line3[plot_x]; - rgb_t c4 = line4[plot_x]; - p_bitmap[plot_x] = - rgb_t( - ( c1.r() / 6 + c2.r() / 3 + c3.r() / 3 + c4.r() / 6 ), - ( c1.g() / 6 + c2.g() / 3 + c3.g() / 3 + c4.g() / 6 ), - ( c1.b() / 6 + c2.b() / 3 + c3.b() / 3 + c4.b() / 6 ) - ); - } - } - } - - sms_y += 3; - y_min_i = 0; - } -} - - -UINT32 sms_state::screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - bitmap_rgb32 *source_bitmap; - - if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) - { - screen_gg_sms_mode_scaling(screen, m_gg_sms_mode_bitmap, cliprect); - source_bitmap = &m_gg_sms_mode_bitmap; - } - else - { - source_bitmap = &m_vdp->get_bitmap(); - } - - if (!m_port_persist->read()) - { - copybitmap(bitmap, *source_bitmap, 0, 0, 0, 0, cliprect); - if (m_prev_bitmap_copied) - { - m_prev_bitmap.fill(rgb_t::black); - m_prev_bitmap_copied = false; - } - } - else if (!m_prev_bitmap_copied) - { - copybitmap(bitmap, *source_bitmap, 0, 0, 0, 0, cliprect); - copybitmap(m_prev_bitmap, *source_bitmap, 0, 0, 0, 0, cliprect); - m_prev_bitmap_copied = true; - } - else - { - // HACK: fake LCD persistence effect - // (it would be better to generalize this in the core, to be used for all LCD systems) - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) - { - UINT32 *linedst = &bitmap.pix32(y); - UINT32 *line0 = &source_bitmap->pix32(y); - UINT32 *line1 = &m_prev_bitmap.pix32(y); - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - { - UINT32 color0 = line0[x]; - UINT32 color1 = line1[x]; - UINT16 r0 = (color0 >> 16) & 0x000000ff; - UINT16 g0 = (color0 >> 8) & 0x000000ff; - UINT16 b0 = (color0 >> 0) & 0x000000ff; - UINT16 r1 = (color1 >> 16) & 0x000000ff; - UINT16 g1 = (color1 >> 8) & 0x000000ff; - UINT16 b1 = (color1 >> 0) & 0x000000ff; - UINT8 r = (UINT8)((r0 + r1) >> 1); - UINT8 g = (UINT8)((g0 + g1) >> 1); - UINT8 b = (UINT8)((b0 + b1) >> 1); - linedst[x] = (r << 16) | (g << 8) | b; - } - } - copybitmap(m_prev_bitmap, *source_bitmap, 0, 0, 0, 0, cliprect); - } - return 0; -} diff --git a/src/mess/machine/snescx4.c b/src/mess/machine/snescx4.c deleted file mode 100644 index a4a200452a2..00000000000 --- a/src/mess/machine/snescx4.c +++ /dev/null @@ -1,257 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Fabio Priuli, byuu, Nach -/*************************************************************************** - - snescx4.c - - File to handle emulation of the SNES "CX4" add-on chip. - - Code based on original work by zsKnight, anomie and Nach. - This implementation is based on C++ "cx4*.cpp" by byuu - (up to date with source v 0.49). - -***************************************************************************/ - -#include "emu.h" -#include "machine/snescx4.h" - -static CX4 cx4; - -static UINT16 CX4_readw(UINT16 addr); -static UINT32 CX4_readl(UINT16 addr); - -static void CX4_writew(running_machine &machine, UINT16 addr, UINT16 data); -//static void CX4_writel(running_machine &machine, UINT16 addr, UINT32 data); - -static void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color); - -#include "machine/cx4data.inc" -#include "machine/cx4fn.inc" - -static UINT32 CX4_ldr(UINT8 r) -{ - UINT16 addr = 0x0080 + (r * 3); - return (cx4.reg[addr + 0] << 0) - | (cx4.reg[addr + 1] << 8) - | (cx4.reg[addr + 2] << 16); -} - -static void CX4_str(UINT8 r, UINT32 data) -{ - UINT16 addr = 0x0080 + (r * 3); - cx4.reg[addr + 0] = (data >> 0); - cx4.reg[addr + 1] = (data >> 8); - cx4.reg[addr + 2] = (data >> 16); -} - -static void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh) -{ - INT64 rx = x & 0xffffff; - INT64 ry = y & 0xffffff; - if(rx & 0x800000)rx |= ~0x7fffff; - if(ry & 0x800000)ry |= ~0x7fffff; - - rx *= ry; - - *rl = (rx) & 0xffffff; - *rh = (rx >> 24) & 0xffffff; -} - -static UINT32 CX4_sin(UINT32 rx) -{ - cx4.r0 = rx & 0x1ff; - if(cx4.r0 & 0x100) - { - cx4.r0 ^= 0x1ff; - } - if(cx4.r0 & 0x080) - { - cx4.r0 ^= 0x0ff; - } - if(rx & 0x100) - { - return CX4_sin_table[cx4.r0 + 0x80]; - } - else - { - return CX4_sin_table[cx4.r0]; - } -} - -static UINT32 CX4_cos(UINT32 rx) -{ - return CX4_sin(rx + 0x080); -} - -static void CX4_immediate_reg(UINT32 start) -{ - UINT32 i = 0; - cx4.r0 = CX4_ldr(0); - for(i = start; i < 48; i++) - { - if((cx4.r0 & 0x0fff) < 0x0c00) - { - cx4.ram[cx4.r0 & 0x0fff] = CX4_immediate_data[i]; - } - cx4.r0++; - } - CX4_str(0, cx4.r0); -} - -static void CX4_transfer_data(running_machine &machine) -{ - UINT32 src; - UINT16 dest, count; - UINT32 i; - - src = (cx4.reg[0x40]) | (cx4.reg[0x41] << 8) | (cx4.reg[0x42] << 16); - count = (cx4.reg[0x43]) | (cx4.reg[0x44] << 8); - dest = (cx4.reg[0x45]) | (cx4.reg[0x46] << 8); - - address_space &space = machine.device("maincpu")->space(AS_PROGRAM); - for(i=0;i> 2; - return; - } - - switch(data) - { - case 0x00: CX4_op00(machine); break; - case 0x01: CX4_op01(machine); break; - case 0x05: CX4_op05(machine); break; - case 0x0d: CX4_op0d(machine); break; - case 0x10: CX4_op10(); break; - case 0x13: CX4_op13(); break; - case 0x15: CX4_op15(machine); break; - case 0x1f: CX4_op1f(machine); break; - case 0x22: CX4_op22(); break; - case 0x25: CX4_op25(); break; - case 0x2d: CX4_op2d(machine); break; - case 0x40: CX4_op40(); break; - case 0x54: CX4_op54(); break; - case 0x5c: CX4_op5c(); break; - case 0x5e: CX4_op5e(); break; - case 0x60: CX4_op60(); break; - case 0x62: CX4_op62(); break; - case 0x64: CX4_op64(); break; - case 0x66: CX4_op66(); break; - case 0x68: CX4_op68(); break; - case 0x6a: CX4_op6a(); break; - case 0x6c: CX4_op6c(); break; - case 0x6e: CX4_op6e(); break; - case 0x70: CX4_op70(); break; - case 0x72: CX4_op72(); break; - case 0x74: CX4_op74(); break; - case 0x76: CX4_op76(); break; - case 0x78: CX4_op78(); break; - case 0x7a: CX4_op7a(); break; - case 0x7c: CX4_op7c(); break; - case 0x89: CX4_op89(); break; - } - } -} - -#ifdef UNUSED_FUNCTION -void CX4_writeb(running_machine &machine, UINT16 addr, UINT8 data) -{ - CX4_write(machine, addr, data); -} -#endif - -static void CX4_writew(running_machine &machine, UINT16 addr, UINT16 data) -{ - CX4_write(machine, addr + 0, data >> 0); - CX4_write(machine, addr + 1, data >> 8); -} - -#ifdef UNUSED_FUNCTION -void CX4_writel(running_machine &machine, UINT16 addr, UINT32 data) -{ - CX4_write(machine, addr + 0, data >> 0); - CX4_write(machine, addr + 1, data >> 8); - CX4_write(machine, addr + 2, data >> 16); -} -#endif - -UINT8 CX4_read(UINT32 addr) -{ - addr &= 0x1fff; - - if(addr < 0x0c00) - { - return cx4.ram[addr]; - } - - if(addr >= 0x1f00) - { - return cx4.reg[addr & 0xff]; - } - - return 0xff; -} - -#ifdef UNUSED_FUNCTION -UINT8 CX4_readb(UINT16 addr) -{ - return CX4_read(addr); -} -#endif - -static UINT16 CX4_readw(UINT16 addr) -{ - return CX4_read(addr) | (CX4_read(addr + 1) << 8); -} - -static UINT32 CX4_readl(UINT16 addr) -{ - return CX4_read(addr) | (CX4_read(addr + 1) << 8) | (CX4_read(addr + 2) << 16); -} - -#ifdef UNUSED_FUNCTION -void CX4_reset() -{ - memset(cx4.ram, 0, 0x0c00); - memset(cx4.reg, 0, 0x0100); -} -#endif diff --git a/src/mess/machine/snescx4.h b/src/mess/machine/snescx4.h deleted file mode 100644 index 1adca638a39..00000000000 --- a/src/mess/machine/snescx4.h +++ /dev/null @@ -1,29 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Fabio Priuli, byuu, Nach -/*************************************************************************** - - snescx4.h - - Code based on original work by zsKnight, anomie and Nach. - This implementation is based on C++ "cx4*.cpp" by byuu - (up to date with source v 0.49). - -***************************************************************************/ - -struct CX4 -{ - UINT8 ram[0x0c00]; - UINT8 reg[0x0100]; - UINT32 r0, r1, r2, r3, r4, r5, r6, r7, - r8, r9, r10, r11, r12, r13, r14, r15; - - INT16 C4WFXVal, C4WFYVal, C4WFZVal, C4WFX2Val, C4WFY2Val, C4WFDist, C4WFScale; - INT16 C41FXVal, C41FYVal, C41FAngleRes, C41FDist, C41FDistVal; - - double tanval; - double c4x, c4y, c4z; - double c4x2, c4y2, c4z2; -}; - -UINT8 CX4_read(UINT32 addr); -void CX4_write(running_machine &machine, UINT32 addr, UINT8 data); diff --git a/src/mess/machine/sonydriv.c b/src/mess/machine/sonydriv.c deleted file mode 100644 index 31c88e4f988..00000000000 --- a/src/mess/machine/sonydriv.c +++ /dev/null @@ -1,572 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/********************************************************************* - - sonydriv.c - - Apple/Sony 3.5" floppy drive emulation (to be interfaced with iwm.c) - - Nate Woods, Raphael Nabet, R. Belmont - - This floppy drive was present in all variants of Lisa 2 (including Mac XL), - all Apple IIgs and IIc Plus machines, and in all Macintoshes in production - before 1988, when SWIM and SuperDrive were introduced. - - There were three major variants : - - A single-sided 400k unit which was used on Lisa 2/Mac XL, and Macintosh - 128k/512k. This unit needs the computer to send the proper pulses to - control the drive motor rotation. It can be connected to all early - Macintosh (but not Mac Classic?) as an external unit. - - A double-sided 800k unit which was used on Macintosh Plus, 512ke, and - early SE and II*. This unit generates its own drive motor rotation - control signals. It can be connected to earlier (and later) Macintosh as - an external or internal unit. Some Lisa2/10 and Mac XL were upgraded to - use it, too, but a fdc ROM upgrade was required. - - A double-sided 1440k unit. This is fully back compatible with the 800k - drive, and adds 1440k MFM capability. This drive, called FDHD or - SuperDrive by Apple, came in automatic and manual-inject versions. - - TODO : - * support for other image formats? - * should we support more than 2 floppy disk units? (Mac SE supported 3 drives) - -*********************************************************************/ - -#include "emu.h" -#include "machine/applefdc.h" -#include "sonydriv.h" -#include "formats/ap_dsk35.h" -#include "imagedev/flopdrv.h" - - -#ifdef MAME_DEBUG -#define LOG_SONY 1 -#define LOG_SONY_EXTRA 0 -#else -#define LOG_SONY 0 -#define LOG_SONY_EXTRA 0 -#endif - -/* - These lines are normally connected to the PHI0-PHI3 lines of the IWM -*/ -enum -{ - SONY_CA0 = 0x01, - SONY_CA1 = 0x02, - SONY_CA2 = 0x04, - SONY_LSTRB = 0x08 -}; - -/* - Structure that describes the state of a floppy drive, and the associated - disk image -*/ -struct floppy_t -{ - device_t *img; - emu_file *fd; - - unsigned int disk_switched : 1; /* disk-in-place status bit */ - unsigned int head : 1; /* active head (-> floppy side) */ - unsigned int step : 1; - int motor_on; - - unsigned int loadedtrack_valid : 1; /* is data in track buffer valid ? */ - unsigned int loadedtrack_dirty : 1; /* has data in track buffer been modified? */ - size_t loadedtrack_size; /* size of loaded track */ - size_t loadedtrack_pos; /* position within loaded track */ - UINT8 *loadedtrack_data; /* pointer to track buffer */ - - int is_fdhd; /* is drive an FDHD? */ - int is_400k; /* drive is single-sided, which means 400K */ -}; - -struct sonydriv_t -{ - int lines; /* four lines SONY_CA0 - SONY_LSTRB */ - - int floppy_enable; /* whether a drive is enabled or not (-> enable line) */ - int floppy_select; /* which drive is enabled */ - - int sel_line; /* one single line Is 0 or 1 */ - - unsigned int rotation_speed; /* drive rotation speed - ignored if ext_speed_control == 0 */ - floppy_t floppy[2]; /* data for two floppy disk units */ -}; -static sonydriv_t sony; - -/* bit of code used in several places - I am unsure why it is here */ -static int sony_enable2(void) -{ - return (sony.lines & SONY_CA1) && (sony.lines & SONY_LSTRB); -} - -static void load_track_data(device_t *device,int floppy_select) -{ - int track_size; - legacy_floppy_image_device *cur_image; - UINT8 *new_data; - floppy_t *f; - - f = &sony.floppy[floppy_select]; - cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, floppy_select); - - floppy_image_legacy *fimg = cur_image->flopimg_get_image(); - - if (!fimg) - { - return; - } - - track_size = floppy_get_track_size(fimg, f->head, cur_image->floppy_drive_get_current_track()); - if (f->loadedtrack_data) auto_free(device->machine(),f->loadedtrack_data); - new_data = auto_alloc_array(device->machine(),UINT8,track_size); - if (!new_data) - { - return; - } - - cur_image->floppy_drive_read_track_data_info_buffer(f->head, new_data, &track_size); - f->loadedtrack_valid = 1; - f->loadedtrack_dirty = 0; - f->loadedtrack_size = track_size; - f->loadedtrack_data = new_data; - f->loadedtrack_pos = 0; -} - - - -static void save_track_data(device_t *device, int floppy_select) -{ - legacy_floppy_image_device *cur_image; - floppy_t *f; - int len; - - f = &sony.floppy[floppy_select]; - cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, floppy_select); - - if (f->loadedtrack_dirty) - { - len = f->loadedtrack_size; - cur_image->floppy_drive_write_track_data_info_buffer(f->head, f->loadedtrack_data, &len); - f->loadedtrack_dirty = 0; - } -} - - - -UINT8 sony_read_data(device_t *device) -{ - UINT8 result = 0; - legacy_floppy_image_device *cur_image; - floppy_t *f; - - if (sony_enable2() || (! sony.floppy_enable)) - return 0xFF; /* right ??? */ - - f = &sony.floppy[sony.floppy_select]; - cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select); - if (!cur_image->exists()) - return 0xFF; - - if (!f->loadedtrack_valid) - load_track_data(device, sony.floppy_select); - - if (!f->loadedtrack_data) - { - return 0xFF; - } - - result = sony_fetchtrack(f->loadedtrack_data, f->loadedtrack_size, &f->loadedtrack_pos); - return result; -} - - - -void sony_write_data(device_t *device,UINT8 data) -{ - device_image_interface *cur_image; - floppy_t *f; - - f = &sony.floppy[sony.floppy_select]; - cur_image = dynamic_cast(floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select)); - if (!cur_image->exists()) - return; - - if (!f->loadedtrack_valid) - load_track_data(device,sony.floppy_select); - - if (!f->loadedtrack_data) - { - return; - } - - sony_filltrack(f->loadedtrack_data, f->loadedtrack_size, &f->loadedtrack_pos, data); - f->loadedtrack_dirty = 1; -} - - - -static int sony_rpm(floppy_t *f, legacy_floppy_image_device *cur_image) -{ - int result = 0; - /* - * The Mac floppy controller was interesting in that its speed was adjusted - * while the thing was running. On the tracks closer to the rim, it was - * sped up so that more data could be placed on it. Hence, this function - * has different results depending on the track number - * - * The Mac Plus (and probably the other Macs that use the IWM) verify that - * the speed of the floppy drive is within a certain range depending on - * what track the floppy is at. These RPM values are just guesses and are - * probably not fully accurate, but they are within the range that the Mac - * Plus expects and thus are probably in the right ballpark. - * - * Note - the timing values are the values returned by the Mac Plus routine - * that calculates the speed; I'm not sure what units they are in - */ - - if ((f->is_400k) && (sony.rotation_speed)) - { - /* 400k unit : rotation speed should be controlled by computer */ - result = sony.rotation_speed; - } - else - { /* 800k unit : rotation speed controlled by drive */ -#if 1 /* Mac Plus */ - static const int speeds[] = - { - 500, /* 00-15: timing value 117B (acceptable range {1135-11E9} */ - 550, /* 16-31: timing value ???? (acceptable range {12C6-138A} */ - 600, /* 32-47: timing value ???? (acceptable range {14A7-157F} */ - 675, /* 48-63: timing value ???? (acceptable range {16F2-17E2} */ - 750 /* 64-79: timing value ???? (acceptable range {19D0-1ADE} */ - }; -#else /* Lisa 2 */ - /* 237 + 1.3*(256-reg) */ - static const int speeds[] = - { - 293, /* 00-15: timing value ???? (acceptable range {0330-0336} */ - 322, /* 16-31: timing value ???? (acceptable range {02ED-02F3} */ - 351, /* 32-47: timing value ???? (acceptable range {02A7-02AD} */ - 394, /* 48-63: timing value ???? (acceptable range {0262-0266} */ - 439 /* 64-79: timing value ???? (acceptable range {021E-0222} */ - }; -#endif - if (cur_image && cur_image->exists()) - result = speeds[cur_image->floppy_drive_get_current_track() / 16]; - } - return result; -} - -int sony_read_status(device_t *device) -{ - int result = 1; - int action; - floppy_t *f; - legacy_floppy_image_device *cur_image; - - action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2); - - if (LOG_SONY_EXTRA) - { - printf("sony.status(): action=%x pc=0x%08x%s\n", - action, (int) device->machine().firstcpu->pc(), sony.floppy_enable ? "" : " (no drive enabled)"); - } - - if ((! sony_enable2()) && sony.floppy_enable) - { - f = &sony.floppy[sony.floppy_select]; - cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select); - if (!cur_image->exists()) - cur_image = NULL; - - switch(action) { - case 0x00: /* Step direction */ - result = f->step; - break; - case 0x01: /* Lower head activate */ - if (f->head != 0) - { - save_track_data(device,sony.floppy_select); - f->head = 0; - f->loadedtrack_valid = 0; - } - result = 0; - break; - case 0x02: /* Disk in place */ - result = cur_image ? 0 : 1; /* 0=disk 1=nodisk */ - break; - case 0x03: /* Upper head activate (not on 400k) */ - if ((f->head != 1) && !(f->is_400k)) - { - save_track_data(device,sony.floppy_select); - f->head = 1; - f->loadedtrack_valid = 0; - } - result = 0; - break; - case 0x04: /* Disk is stepping 0=stepping 1=not stepping*/ - result = 1; - break; - case 0x05: /* Drive is SuperDrive: 0 = 400/800k, 1 = SuperDrive */ - result = f->is_fdhd ? 1: 0; - break; - case 0x06: /* Disk is locked 0=locked 1=unlocked */ - if (cur_image) - result = cur_image->floppy_wpt_r(); - else - result = 0; - break; - case 0x08: /* Motor on 0=on 1=off */ - result = f->motor_on; - break; - case 0x09: /* Number of sides: 0=single sided, 1=double sided */ - if (cur_image) - { - floppy_image_legacy *fimg = cur_image->flopimg_get_image(); - if (fimg) - { - result = floppy_get_heads_per_disk(fimg) - 1; - f->is_400k = result ? 0 : 1; - } - } - break; - case 0x0a: /* At track 0: 0=track zero 1=not track zero */ - logerror("%s sony.status(): reading Track 0\n", device->machine().describe_context()); - if (cur_image) - result = cur_image->floppy_tk00_r(); - else - result = 0; - break; - case 0x0b: /* Disk ready: 0=ready, 1=not ready */ - result = 0; - break; - case 0x0c: /* Disk switched */ - { - if (cur_image) - { - if (!cur_image->floppy_dskchg_r()) - { - f->disk_switched = 1; - } - } - result = f->disk_switched; - } - break; - case 0x0d: /* Unknown */ - /* I'm not sure what this one does, but the Mac Plus executes the - * following code that uses this status: - * - * 417E52: moveq #$d, D0 ; Status 0x0d - * 417E54: bsr 4185fe ; Query IWM status - * 417E58: bmi 417e82 ; If result=1, then skip - * - * This code is called in the Sony driver's open method, and - * _AddDrive does not get called if this status 0x0d returns 1. - * Hence, we are returning 0 - */ - result = 0; - break; - case 0x0e: /* Tachometer */ - /* (time in seconds) / (60 sec/minute) * (rounds/minute) * (60 pulses) * (2 pulse phases) */ - if (cur_image) - { - result = ((int) (device->machine().time().as_double() / 60.0 * sony_rpm(f, cur_image) * 60.0 * 2.0)) & 1; - } - break; - case 0x0f: /* 400k/800k: Drive installed: 0=drive connected, 1=drive not connected */ - /* FDHD: Inserted disk density: 0=HD, 1=DD */ - if (f->is_fdhd) - { - result = 1; - } - else - { - result = 0; - } - break; - default: - if (LOG_SONY) - logerror("sony_status(): unknown action\n"); - break; - } - } - - return result; -} - -static void sony_doaction(device_t *device) -{ - int action; - floppy_t *f; - legacy_floppy_image_device *cur_image; - - action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | ((sony.lines & SONY_CA2) >> 2) | (sony.sel_line << 1); - - if (LOG_SONY) - { - logerror("%s sony_doaction(): action=%d %s\n", - device->machine().describe_context(), action, (sony.floppy_enable) ? "" : " (MOTOR OFF)"); - } - - if (sony.floppy_enable) - { - f = &sony.floppy[sony.floppy_select]; - cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select); - if (!cur_image->exists()) - cur_image = NULL; - - switch(action) - { - case 0x00: /* Set step inward (higher tracks) */ - f->step = 0; - break; - case 0x01: /* Set step outward (lower tracks) */ - f->step = 1; - break; - case 0x03: /* Reset diskswitched */ - f->disk_switched = 0; - break; - case 0x04: /* Step disk */ - if (cur_image) - { - save_track_data(device,sony.floppy_select); - if (f->step) - cur_image->floppy_drive_seek(-1); - else - cur_image->floppy_drive_seek(+1); - f->loadedtrack_valid = 0; - } - break; - case 0x08: /* Turn motor on */ - f->motor_on = CLEAR_LINE; - if (cur_image) - cur_image->floppy_mon_w(f->motor_on); - break; - case 0x09: /* Turn motor off */ - f->motor_on = ASSERT_LINE; - if (cur_image) - cur_image->floppy_mon_w(f->motor_on); - break; - case 0x0d: /* Eject disk */ - if (cur_image) - cur_image->unload(); - break; - default: - if (LOG_SONY) - logerror("sony_doaction(): unknown action %d\n", action); - break; - } - } -} - -void sony_set_lines(device_t *device,UINT8 lines) -{ - int old_sony_lines = sony.lines; - - sony.lines = lines & 0x0F; - - { - //int action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2); - //printf("sony.set_lines: %02x, action now %d\n", lines&0xf, action); - } - - /* have we just set LSTRB ? */ - if ((sony.lines & ~old_sony_lines) & SONY_LSTRB) - { - /* if so, write drive reg */ - sony_doaction(device); - } - - if (LOG_SONY_EXTRA) - logerror("sony.set_lines(): %d\n", lines); -} - -void sony_set_enable_lines(device_t *device,int enable_mask) -{ - switch (enable_mask) - { - case 0: - default: /* well, we have to do something, right ? */ - sony.floppy_enable = 0; - break; - case 1: - sony.floppy_enable = 1; - sony.floppy_select = 0; - break; - case 2: - sony.floppy_enable = 1; - sony.floppy_select = 1; - break; - } - - if (LOG_SONY_EXTRA) - logerror("sony.set_enable_lines(): %d\n", enable_mask); -} - -void sony_set_sel_line(device_t *device,int sel) -{ - sony.sel_line = sel ? 1 : 0; - - { - //int action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2); - //printf("sony.set_sel_line: %d, action now %d\n", sony.sel_line, action); - } - - if (LOG_SONY_EXTRA) - logerror("sony.set_sel_line(): %s line IWM_SEL\n", sony.sel_line ? "setting" : "clearing"); -} - -void sony_set_speed(int speed) -{ - sony.rotation_speed = speed; -} - -// device type definition -const device_type FLOPPY_SONY = &device_creator; - -//------------------------------------------------- -// sonydriv_floppy_image_device - constructor -//------------------------------------------------- - -sonydriv_floppy_image_device::sonydriv_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : legacy_floppy_image_device(mconfig, FLOPPY_SONY, "Floppy Disk [Sony]", tag, owner, clock, "floppy_sonny", __FILE__) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void sonydriv_floppy_image_device::device_start() -{ - legacy_floppy_image_device::device_start(); - floppy_set_type(FLOPPY_TYPE_SONY); - - sony.floppy[0].is_fdhd = 0; - sony.floppy[1].is_fdhd = 0; - sony.floppy[0].is_400k = 0; - sony.floppy[1].is_400k = 0; - sony.floppy[0].loadedtrack_data = NULL; - sony.floppy[1].loadedtrack_data = NULL; - sony.floppy[0].head = 0; - sony.floppy[1].head = 0; - sony.rotation_speed = 0; -} - -void sonydriv_floppy_image_device::call_unload() -{ - int id; - device_t *fdc; - - /* locate the FDC */ - fdc = machine().device("fdc"); - - id = floppy_get_drive_by_type(this,FLOPPY_TYPE_SONY); - save_track_data(fdc, id); - memset(&sony.floppy[id], 0, sizeof(sony.floppy[id])); - - legacy_floppy_image_device::call_unload(); -} diff --git a/src/mess/machine/sonydriv.h b/src/mess/machine/sonydriv.h deleted file mode 100644 index 52ecca6697a..00000000000 --- a/src/mess/machine/sonydriv.h +++ /dev/null @@ -1,71 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/********************************************************************* - - sonydriv.h - - Apple/Sony 3.5" floppy drive emulation (to be interfaced with applefdc.c) - -*********************************************************************/ - -#ifndef SONYDRIV_H -#define SONYDRIV_H - -#include "imagedev/flopdrv.h" - -#if 0 -enum -{ - SONY_FLOPPY_ALLOW400K = 0x0001, - SONY_FLOPPY_ALLOW800K = 0x0002, - - SONY_FLOPPY_SUPPORT2IMG = 0x4000, - SONY_FLOPPY_EXT_SPEED_CONTROL = 0x8000 // means the speed is controlled by computer -}; -#endif - -void sony_set_lines(device_t *device,UINT8 lines); -void sony_set_enable_lines(device_t *device,int enable_mask); -void sony_set_sel_line(device_t *device,int sel); - -void sony_set_speed(int speed); - -UINT8 sony_read_data(device_t *device); -void sony_write_data(device_t *device,UINT8 data); -int sony_read_status(device_t *device); - -class sonydriv_floppy_image_device : public legacy_floppy_image_device -{ -public: - // construction/destruction - sonydriv_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual void call_unload(); -protected: - virtual void device_start(); -}; - -// device type definition -extern const device_type FLOPPY_SONY; - -#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(_config) \ - MCFG_DEVICE_ADD(FLOPPY_0, FLOPPY_SONY, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_DEVICE_ADD(FLOPPY_1, FLOPPY_SONY, 0) \ - MCFG_DEVICE_CONFIG(_config) - -#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(_config) \ - MCFG_DEVICE_ADD(FLOPPY_2, FLOPPY_SONY, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_DEVICE_ADD(FLOPPY_3, FLOPPY_SONY, 0) \ - MCFG_DEVICE_CONFIG(_config) - -#define MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_MODIFY(_config) \ - MCFG_DEVICE_MODIFY(FLOPPY_0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_DEVICE_MODIFY(FLOPPY_1) \ - MCFG_DEVICE_CONFIG(_config) - - - -#endif /* SONYDRIV_H */ diff --git a/src/mess/machine/sorcerer.c b/src/mess/machine/sorcerer.c deleted file mode 100644 index 25fb66015e3..00000000000 --- a/src/mess/machine/sorcerer.c +++ /dev/null @@ -1,492 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker, Robbbert -/****************************************************************************** - - Exidy Sorcerer machine functions - -*******************************************************************************/ - -#include "includes/sorcerer.h" -#include "machine/z80bin.h" - -#if SORCERER_USING_RS232 - -/* The serial code (which was never connected to the outside) is disabled for now. */ - -/* timer for sorcerer serial chip transmit and receive */ - -TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_serial_tc) -{ - /* if rs232 is enabled, uart is connected to clock defined by bit6 of port fe. - Transmit and receive clocks are connected to the same clock */ - - /* if rs232 is disabled, receive clock is linked to cassette hardware */ - if (m_fe & 0x80) - { - /* connect to rs232 */ - } -} -#endif - - -void sorcerer_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_SERIAL: -#if SORCERER_USING_RS232 - sorcerer_serial_tc(ptr, param); -#endif - break; - case TIMER_CASSETTE: - sorcerer_cassette_tc(ptr, param); - break; - case TIMER_RESET: - sorcerer_reset(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in sorcerer_state::device_timer"); - } -} - - -/* timer to read cassette waveforms */ - -TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_cassette_tc) -{ - UINT8 cass_ws = 0; - switch (m_fe & 0xc0) /*/ bit 7 low indicates cassette */ - { - case 0x00: /* Cassette 300 baud */ - - /* loading a tape - this is basically the same as the super80. - We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */ - - m_cass_data.input.length++; - - cass_ws = ((((m_fe & 0x20) ? m_cassette2 : m_cassette1))->input() > +0.02) ? 1 : 0; - - if (cass_ws != m_cass_data.input.level) - { - m_cass_data.input.level = cass_ws; - m_cass_data.input.bit = ((m_cass_data.input.length < 0x6) || (m_cass_data.input.length > 0x20)) ? 1 : 0; - m_cass_data.input.length = 0; - m_uart->set_input_pin(AY31015_SI, m_cass_data.input.bit); - } - - /* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies. - Synchronisation of the frequency pulses to the uart is extremely important. */ - - m_cass_data.output.length++; - if (!(m_cass_data.output.length & 0x1f)) - { - cass_ws = m_uart->get_output_pin(AY31015_SO); - if (cass_ws != m_cass_data.output.bit) - { - m_cass_data.output.bit = cass_ws; - m_cass_data.output.length = 0; - } - } - - if (!(m_cass_data.output.length & 3)) - { - if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 4))) - { - m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit - ((m_fe & 0x20) ? m_cassette2 : m_cassette1)->output(m_cass_data.output.level ? -1.0 : +1.0); - } - } - return; - - case 0x40: /* Cassette 1200 baud */ - /* loading a tape */ - m_cass_data.input.length++; - - cass_ws = ((((m_fe & 0x20) ? m_cassette2 : m_cassette1))->input() > +0.02) ? 1 : 0; - - if (cass_ws != m_cass_data.input.level || m_cass_data.input.length == 10) - { - m_cass_data.input.bit = ((m_cass_data.input.length < 10) || (m_cass_data.input.length > 0x20)) ? 1 : 0; - if ( cass_ws != m_cass_data.input.level ) - { - m_cass_data.input.length = 0; - m_cass_data.input.level = cass_ws; - } - m_uart->set_input_pin(AY31015_SI, m_cass_data.input.bit); - } - - /* saving a tape - convert the serial stream from the uart, into 600 and 1200 Hz frequencies. */ - - m_cass_data.output.length++; - if (!(m_cass_data.output.length & 7)) - { - cass_ws = m_uart->get_output_pin(AY31015_SO); - if (cass_ws != m_cass_data.output.bit) - { - m_cass_data.output.bit = cass_ws; - m_cass_data.output.length = 0; - } - } - - if (!(m_cass_data.output.length & 7)) - { - if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 8))) - { - m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit - ((m_fe & 0x20) ? m_cassette2 : m_cassette1)->output(m_cass_data.output.level ? -1.0 : +1.0); - } - } - return; - } -} - - -/* after the first 4 bytes have been read from ROM, switch the ram back in */ -TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_reset) -{ - membank("boot")->set_entry(0); -} - -WRITE8_MEMBER(sorcerer_state::sorcerer_fc_w) -{ - m_uart->set_transmit_data(data); -} - - -WRITE8_MEMBER(sorcerer_state::sorcerer_fd_w) -{ - /* Translate data to control signals */ - - m_uart->set_input_pin(AY31015_CS, 0); - m_uart->set_input_pin(AY31015_NB1, BIT(data, 0)); - m_uart->set_input_pin(AY31015_NB2, BIT(data, 1)); - m_uart->set_input_pin(AY31015_TSB, BIT(data, 2)); - m_uart->set_input_pin(AY31015_EPS, BIT(data, 3)); - m_uart->set_input_pin(AY31015_NP, BIT(data, 4)); - m_uart->set_input_pin(AY31015_CS, 1); -} - -WRITE8_MEMBER(sorcerer_state::sorcerer_fe_w) -{ - UINT8 changed_bits = (m_fe ^ data) & 0xf0; - m_fe = data; - - /* bits 0..3 */ - m_keyboard_line = data & 0x0f; - - if (!changed_bits) return; - - /* bits 4..5 */ - /* does user want to hear the sound? */ - - if (!BIT(data, 7)) // cassette operations - { -#if SORCERER_USING_RS232 - m_serial_timer->adjust(attotime::zero); -#endif - - bool sound = BIT(m_iop_config->read(), 3); - - m_cassette1->change_state( - (BIT(data,4) & sound) ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); - - m_cassette2->change_state( - (BIT(data,5) & sound) ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); - - /* cassette 1 motor */ - m_cassette1->change_state( - (BIT(data,4)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - /* cassette 2 motor */ - m_cassette2->change_state( - (BIT(data,5)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - - if (data & 0x30) - m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(19200)); - else - m_cassette_timer->adjust(attotime::zero); - } -#if SORCERER_USING_RS232 - else - { - m_serial_timer->adjust(attotime::zero, 0, attotime::from_hz(19200)); - m_cassette_timer->adjust(attotime::zero); - } -#endif - - // bit 6 baud rate */ - if (BIT(changed_bits, 6)) - { - m_uart->set_receiver_clock(BIT(data, 6) ? 19200.0 : 4800.0); - m_uart->set_transmitter_clock(BIT(data, 6) ? 19200.0 : 4800.0); - } -} - -WRITE8_MEMBER(sorcerer_state::sorcerer_ff_w) -{ - /// TODO: create a sorcerer parallel slot with a 7 bit and 8 bit centronics adapter as two of the options - /// TODO: figure out what role FE plays http://www.trailingedge.com/exidy/exidych7.html - m_centronics->write_data0(BIT(data, 0)); - m_centronics->write_data1(BIT(data, 1)); - m_centronics->write_data2(BIT(data, 2)); - m_centronics->write_data3(BIT(data, 3)); - m_centronics->write_data4(BIT(data, 4)); - m_centronics->write_data5(BIT(data, 5)); - m_centronics->write_data6(BIT(data, 6)); - - /* reading the config switch */ - switch (m_iop_config->read() & 0x02) - { - case 0: /* 7-bit port */ - /* bit 7 = strobe, bit 6..0 = data */ - m_centronics->write_data7(0); - m_centronics->write_strobe(BIT(data, 7)); - break; - - case 2: /* 8-bit port */ - /* hardware strobe driven from port select, bit 7..0 = data */ - m_centronics->write_data7(BIT(data, 7)); - m_centronics->write_strobe(0); - m_centronics->write_strobe(1); - break; - } -} - -READ8_MEMBER(sorcerer_state::sorcerer_fc_r) -{ - UINT8 data = m_uart->get_received_data(); - m_uart->set_input_pin(AY31015_RDAV, 0); - m_uart->set_input_pin(AY31015_RDAV, 1); - return data; -} - -READ8_MEMBER(sorcerer_state::sorcerer_fd_r) -{ - /* set unused bits high */ - UINT8 data = 0xe0; - - m_uart->set_input_pin(AY31015_SWE, 0); - data |= m_uart->get_output_pin(AY31015_TBMT) ? 0x01 : 0; - data |= m_uart->get_output_pin(AY31015_DAV ) ? 0x02 : 0; - data |= m_uart->get_output_pin(AY31015_OR ) ? 0x04 : 0; - data |= m_uart->get_output_pin(AY31015_FE ) ? 0x08 : 0; - data |= m_uart->get_output_pin(AY31015_PE ) ? 0x10 : 0; - m_uart->set_input_pin(AY31015_SWE, 1); - - return data; -} - -READ8_MEMBER(sorcerer_state::sorcerer_fe_r) -{ - /* bits 6..7 - - hardware handshakes from user port - - not emulated - - tied high, allowing PARIN and PAROUT bios routines to run */ - - UINT8 data = 0xc0; - - /* bit 5 - vsync */ - data |= m_iop_vs->read(); - - /* bits 4..0 - keyboard data */ - data |= m_iop_x[m_keyboard_line]->read(); - - return data; -} - -/****************************************************************************** - Snapshot Handling -******************************************************************************/ - -SNAPSHOT_LOAD_MEMBER( sorcerer_state,sorcerer) -{ - UINT8 *RAM = memregion(m_maincpu->tag())->base(); - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 header[28]; - unsigned char s_byte; - - /* check size */ - if (snapshot_size != 0x1001c) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Snapshot must be 65564 bytes"); - image.message("Snapshot must be 65564 bytes"); - return IMAGE_INIT_FAIL; - } - - /* get the header */ - image.fread( &header, sizeof(header)); - - /* write it to ram */ - for (int i = 0; i < 0xc000; i++) - { - image.fread( &s_byte, 1); - space.write_byte(i, s_byte); - } - image.fread( RAM+0xc000, 0x4000); - - /* patch CPU registers */ - m_maincpu->set_state_int(Z80_I, header[0]); - m_maincpu->set_state_int(Z80_HL2, header[1] | (header[2] << 8)); - m_maincpu->set_state_int(Z80_DE2, header[3] | (header[4] << 8)); - m_maincpu->set_state_int(Z80_BC2, header[5] | (header[6] << 8)); - m_maincpu->set_state_int(Z80_AF2, header[7] | (header[8] << 8)); - m_maincpu->set_state_int(Z80_HL, header[9] | (header[10] << 8)); - m_maincpu->set_state_int(Z80_DE, header[11] | (header[12] << 8)); - m_maincpu->set_state_int(Z80_BC, header[13] | (header[14] << 8)); - m_maincpu->set_state_int(Z80_IY, header[15] | (header[16] << 8)); - m_maincpu->set_state_int(Z80_IX, header[17] | (header[18] << 8)); - m_maincpu->set_state_int(Z80_IFF1, header[19]&2 ? 1 : 0); - m_maincpu->set_state_int(Z80_IFF2, header[19]&4 ? 1 : 0); - m_maincpu->set_state_int(Z80_R, header[20]); - m_maincpu->set_state_int(Z80_AF, header[21] | (header[22] << 8)); - m_maincpu->set_state_int(STATE_GENSP, header[23] | (header[24] << 8)); - m_maincpu->set_state_int(Z80_IM, header[25]); - m_maincpu->set_pc(header[26] | (header[27] << 8)); - - return IMAGE_INIT_PASS; -} - -void sorcerer_state::machine_start() -{ - m_cassette_timer = timer_alloc(TIMER_CASSETTE); -#if SORCERER_USING_RS232 - m_serial_timer = timer_alloc(TIMER_SERIAL); -#endif - - UINT16 endmem = 0xbfff; - - address_space &space = m_maincpu->space(AS_PROGRAM); - /* configure RAM */ - switch (m_ram->size()) - { - case 8*1024: - space.unmap_readwrite(0x2000, endmem); - break; - - case 16*1024: - space.unmap_readwrite(0x4000, endmem); - break; - - case 32*1024: - space.unmap_readwrite(0x8000, endmem); - break; - } - - if (m_cart->exists()) - space.install_read_handler(0xc000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -MACHINE_START_MEMBER(sorcerer_state,sorcererd) -{ - m_cassette_timer = timer_alloc(TIMER_CASSETTE); -#if SORCERER_USING_RS232 - m_serial_timer = timer_alloc(TIMER_SERIAL); -#endif - - UINT16 endmem = 0xbbff; - - address_space &space = m_maincpu->space(AS_PROGRAM); - /* configure RAM */ - switch (m_ram->size()) - { - case 8*1024: - space.unmap_readwrite(0x2000, endmem); - break; - - case 16*1024: - space.unmap_readwrite(0x4000, endmem); - break; - - case 32*1024: - space.unmap_readwrite(0x8000, endmem); - break; - } - - if (m_cart->exists()) - space.install_read_handler(0xc000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); -} - -void sorcerer_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - /* Initialize cassette interface */ - m_cass_data.output.length = 0; - m_cass_data.output.level = 1; - m_cass_data.input.length = 0; - m_cass_data.input.bit = 1; - - m_fe = 0xff; - sorcerer_fe_w(space, 0, 0, 0xff); - - membank("boot")->set_entry(1); - timer_set(attotime::from_usec(10), TIMER_RESET); -} - - -/*------------------------------------------------- - QUICKLOAD_LOAD_MEMBER( sorcerer_state, sorcerer ) --------------------------------------------------*/ - -QUICKLOAD_LOAD_MEMBER( sorcerer_state, sorcerer ) -{ - UINT16 execute_address, start_address, end_address; - int autorun; - address_space &space = m_maincpu->space(AS_PROGRAM); - - /* load the binary into memory */ - if (z80bin_load_file(&image, space, file_type, &execute_address, &start_address, &end_address) == IMAGE_INIT_FAIL) - return IMAGE_INIT_FAIL; - - /* is this file executable? */ - if (execute_address != 0xffff) - { - /* check to see if autorun is on (I hate how this works) */ - autorun = m_iop_config->read() & 1; - - if ((execute_address >= 0xc000) && (execute_address <= 0xdfff) && (space.read_byte(0xdffa) != 0xc3)) - return IMAGE_INIT_FAIL; /* can't run a program if the cartridge isn't in */ - - /* Since Exidy Basic is by Microsoft, it needs some preprocessing before it can be run. - 1. A start address of 01D5 indicates a basic program which needs its pointers fixed up. - 2. If autorunning, jump to C689 (command processor), else jump to C3DD (READY prompt). - Important addresses: - 01D5 = start (load) address of a conventional basic program - C858 = an autorun basic program will have this exec address on the tape - C3DD = part of basic that displays READY and lets user enter input */ - - if ((start_address == 0x1d5) || (execute_address == 0xc858)) - { - UINT8 i; - static const UINT8 data[]={ - 0xcd, 0x26, 0xc4, // CALL C426 ;set up other pointers - 0x21, 0xd4, 1, // LD HL,01D4 ;start of program address (used by C689) - 0x36, 0, // LD (HL),00 ;make sure dummy end-of-line is there - 0xc3, 0x89, 0xc6 // JP C689 ;run program - }; - - for (i = 0; i < ARRAY_LENGTH(data); i++) - space.write_byte(0xf01f + i, data[i]); - - if (!autorun) - space.write_word(0xf028,0xc3dd); - - /* tell BASIC where program ends */ - space.write_byte(0x1b7, end_address & 0xff); - space.write_byte(0x1b8, (end_address >> 8) & 0xff); - - if ((execute_address != 0xc858) && autorun) - space.write_word(0xf028, execute_address); - - m_maincpu->set_pc(0xf01f); - } - else - { - if (autorun) - m_maincpu->set_pc(execute_address); - } - - } - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/spec_snqk.c b/src/mess/machine/spec_snqk.c deleted file mode 100644 index 2bdbd725683..00000000000 --- a/src/mess/machine/spec_snqk.c +++ /dev/null @@ -1,2565 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/*************************************************************************** - - mess/machine/spec_snqk.c - - TODO: - - - Implement the following snapshot formats - .89C (Tezxas) - .SLT (Various emulators) - .SZX (Spectaculator) - .ZLS (ZX-Live!) - .ZX (ZXSpectr) - .ZX82 (Speculator '97) - .ZXS (ZX32) - - - Implement the following quickload formats - .$? (HoBeta) - .__? (SpecEm) - .BAS (BASin) - .H/.B (Roman ZX) - .RAW (Various emulators) - .SCR variants - - - Cleanup of the .Z80 format - -***************************************************************************/ - -#include "emu.h" -#include "ui/ui.h" -#include "cpu/z80/z80.h" -#include "includes/spectrum.h" -#include "sound/ay8910.h" -#include "machine/spec_snqk.h" - -#define LOAD_REG(_cpu, _reg, _data) \ - do { \ - _cpu->set_state_int(_reg, (_data)); \ - } while (0) - -#define EXEC_NA "N/A" - -/*------------------------------------------------- - log_quickload - logs and displays useful - data for the end user --------------------------------------------------*/ - -static void log_quickload(running_machine &machine, const char *type, UINT32 start, UINT32 length, UINT32 exec, const char *exec_format) -{ - std::string tempstring; - - logerror("Loading %04X bytes of RAM at %04X\n", length, start); - - strcatprintf(tempstring,"Quickload type: %s Length: %d bytes\n", type, length); - strcatprintf(tempstring,"Start: 0x%04X End: 0x%04X Exec: ", start, start + length - 1); - - logerror("Quickload loaded.\n"); - if (!core_stricmp(exec_format, EXEC_NA)) - tempstring.append("N/A"); - else - { - logerror("Execution can resume with "); - logerror(exec_format, exec); - logerror("\n"); - strcatprintf(tempstring,exec_format, exec); - } - - machine.ui().popup_time(10, "%s", tempstring.c_str()); -} - -/******************************************************************* - * - * Update the memory and paging of the spectrum being emulated - * - * if port_7ffd_data is -1 then machine is 48K - no paging - * if port_1ffd_data is -1 then machine is 128K - * if neither port is -1 then machine is +2a/+3 - * - * Note: the 128K .SNA and .Z80 file formats do not store the - * port 1FFD setting so it is necessary to calculate the appropriate - * value for the ROM paging. - * - *******************************************************************/ -static void spectrum_update_paging(running_machine &machine) -{ - spectrum_state *state = machine.driver_data(); - if (state->m_port_7ffd_data == -1) - return; - if (state->m_port_1ffd_data == -1) - state->spectrum_128_update_memory(); - - else - { - if (BIT(state->m_port_7ffd_data, 4)) - /* Page in Spec 48K basic ROM */ - state->m_port_1ffd_data = 0x04; - else - state->m_port_1ffd_data = 0x00; - state->spectrum_plus3_update_memory(); - } -} - -/* Page in the 48K Basic ROM. Used when running 48K snapshots on a 128K machine. */ -static void spectrum_page_basicrom(running_machine &machine) -{ - spectrum_state *state = machine.driver_data(); - if (state->m_port_7ffd_data == -1) - return; - state->m_port_7ffd_data |= 0x10; - spectrum_update_paging(machine); -} - - -SNAPSHOT_LOAD_MEMBER( spectrum_state,spectrum) -{ - dynamic_buffer snapshot_data(snapshot_size); - - image.fread(&snapshot_data[0], snapshot_size); - - if (!core_stricmp(file_type, "sna")) - { - if ((snapshot_size != SNA48_SIZE) && (snapshot_size != SNA128_SIZE_1) && (snapshot_size != SNA128_SIZE_2)) - { - logerror("Invalid .SNA file size.\n"); - goto error; - } - spectrum_setup_sna(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "sp")) - { - if ((snapshot_data[0] != 'S' && snapshot_data[1] != 'P') && (snapshot_size != SP_NEW_SIZE_16K && snapshot_size != SP_NEW_SIZE_48K)) - { - if (snapshot_size != SP_OLD_SIZE) - { - logerror("Invalid .SP file size.\n"); - goto error; - } - } - spectrum_setup_sp(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "ach")) - { - if (snapshot_size != ACH_SIZE) - { - logerror("Invalid .ACH file size.\n"); - goto error; - } - spectrum_setup_ach(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "prg")) - { - if (snapshot_size != PRG_SIZE) - { - logerror("Invalid .PRG file size.\n"); - goto error; - } - spectrum_setup_prg(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "plusd")) - { - if ((snapshot_size != PLUSD48_SIZE) && (snapshot_size != PLUSD128_SIZE)) - { - logerror("Invalid .PLUSD file size.\n"); - goto error; - } - spectrum_setup_plusd(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "sem")) - { - if (snapshot_data[0] != 0x05 && snapshot_data[1] != 'S' && \ - snapshot_data[2] != 'P' && snapshot_data[3] != 'E' && \ - snapshot_data[4] != 'C' && snapshot_data[5] != '1') - { - if (snapshot_size != SEM_SIZE) - { - logerror("Invalid .SEM file size.\n"); - goto error; - } - } - spectrum_setup_sem(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "sit")) - { - if (snapshot_size != SIT_SIZE) - { - logerror("Invalid .SIT file size.\n"); - goto error; - } - spectrum_setup_sit(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "zx")) - { - if (snapshot_size != ZX_SIZE) - { - logerror("Invalid .ZX file size.\n"); - goto error; - } - spectrum_setup_zx(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "snp")) - { - if (snapshot_size != SNP_SIZE) - { - logerror("Invalid .SNP file size.\n"); - goto error; - } - spectrum_setup_snp(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "snx")) - { - if (snapshot_data[0] != 'X' && snapshot_data[1] != 'S' && \ - snapshot_data[2] != 'N' && snapshot_data[3] != 'A') - { - logerror("Invalid .SNX file size.\n"); - goto error; - } - spectrum_setup_snx(machine(), &snapshot_data[0], snapshot_size); - } - else if (!core_stricmp(file_type, "frz")) - { - if (snapshot_size != FRZ_SIZE) - { - logerror("Invalid .FRZ file size.\n"); - goto error; - } - spectrum_setup_frz(machine(), &snapshot_data[0], snapshot_size); - } - else - { - spectrum_setup_z80(machine(), &snapshot_data[0], snapshot_size); - } - - return IMAGE_INIT_PASS; - -error: - return IMAGE_INIT_FAIL; -} - -/******************************************************************* - * - * Load a .SP file. - * - * There are two kinds of .SP files: "old" and "new". - * - * The old version is always 49184 bytes long and is created - * by a leaked copy of the VGASpec emulator. - * - * Subsequently Pedro Gimeno (the author of VGASpec) renamed it - * to "Spectrum" (but it's colloquially known as the "Spanish - * Spectrum emulator") and extended the header to break backward - * compatibility: the new format supports both 16K and 48K - * images and it's 16422 or 49190 bytes long. - * - * http://www.formauri.es/personal/pgimeno/spec/spec.html - * - * The formats are defined as follows: - * - * Offset Size Description (all registers stored with LSB first) - * ------------------- ------- ------------------------------------------------- - * VGASPEC SPECTRUM - * ------------------- ------- ------------------------------------------------- - * N/A 0 2 "SP" (signature) - * N/A 2 2 Program length - * N/A 4 2 Program location - * 0 6 2 BC - * 2 8 2 DE - * 4 10 2 HL - * 6 12 2 AF - * 8 14 2 IX - * 10 16 2 IY - * 12 18 2 BC' - * 14 20 2 DE' - * 16 22 2 HL' - * 18 24 2 AF' - * 20 26 1 R - * 21 27 1 I - * 22 28 2 SP - * 24 30 2 PC - * 26 32 2 0x00 (reserved for future use) - * 28 34 1 Border color - * 29 35 1 0x00 (reserved for future use) - * 30 36 2 Status word - * 32 38 16384/ RAM dump - * 49152 - * - * Status word: - * Bit Description - * ------- --------------------------------------------------- - * 15-8 Reserved for future use - * 7-6 Reserved for internal use (0) - * 5 Status of the flash attribute: 0=normal/1=inverse - * 4 Interrupt pending for execution - * 3 If 1, IM 0; if 0, bit 1 determines interrupt mode - * (Spectrum v0.99e had this behaviour reversed, - * and this bit was not used in versions previous - * to v 0.99e) - * 2 IFF2: 0=DI/1=EI - * 1 Interrupt mode (if bit 3 reset): 0=IM1/1=IM2 - * 0 IFF1: 0=DI/1=EI - * - *******************************************************************/ -static void spectrum_border_update(running_machine &machine, int data) -{ -#if 0 - spectrum_EventList_Reset(machine); - spectrum_border_set_last_color(machine, data); - spectrum_border_force_redraw(machine); -#endif -} - -void spectrum_setup_sp(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i, SP_OFFSET; - UINT8 intr; - UINT16 start, size, data, status; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - if (snapsize == SP_NEW_SIZE_16K || snapsize == SP_NEW_SIZE_48K) - { - SP_OFFSET = 0; - start = (snapdata[SP_OFFSET + 5] << 8) | snapdata[SP_OFFSET + 4]; - size = (snapdata[SP_OFFSET + 3] << 8) | snapdata[SP_OFFSET + 2]; - } - else - { - SP_OFFSET = SP_OLD_HDR - SP_NEW_HDR; - start = BASE_RAM; - size = 3*SPECTRUM_BANK; - } - - data = (snapdata[SP_OFFSET + 13] << 8) | snapdata[SP_OFFSET + 12]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[SP_OFFSET + 7] << 8) | snapdata[SP_OFFSET + 6]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[SP_OFFSET + 9] << 8) | snapdata[SP_OFFSET + 8]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[SP_OFFSET + 11] << 8) | snapdata[SP_OFFSET + 10]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[SP_OFFSET + 25] << 8) | snapdata[SP_OFFSET + 24]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[SP_OFFSET + 19] << 8) | snapdata[SP_OFFSET + 18]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[SP_OFFSET + 21] << 8) | snapdata[SP_OFFSET + 20]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[SP_OFFSET + 23] << 8) | snapdata[SP_OFFSET + 22]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[SP_OFFSET + 15] << 8) | snapdata[SP_OFFSET + 14]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[SP_OFFSET + 17] << 8) | snapdata[SP_OFFSET + 16]; - LOAD_REG(cpu, Z80_IY, data); - - - data = snapdata[SP_OFFSET + 26]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[SP_OFFSET + 27]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[SP_OFFSET + 29] << 8) | snapdata[SP_OFFSET + 28]; - LOAD_REG(cpu, Z80_SP, data); - - data = (snapdata[SP_OFFSET + 31] << 8) | snapdata[SP_OFFSET + 30]; - LOAD_REG(cpu, Z80_PC, data); - - - status = (snapdata[SP_OFFSET + 37] << 8) | snapdata[SP_OFFSET + 36]; - - data = (BIT(status, 3) << 1) | BIT(status, 1); - switch(data) - { - case 0: // case 2: in version 0.99e of the emulator - LOAD_REG(cpu, Z80_IM, 1); - break; - case 1: // case 3: in version 0.99e of the emulator - LOAD_REG(cpu, Z80_IM, 2); - break; - case 2: // case 0: in version 0.99e of the emulator - case 3: // case 1: in version 0.99e of the emulator - LOAD_REG(cpu, Z80_IM, (UINT64)0); - } - - data = BIT(status, 0); - LOAD_REG(cpu, Z80_IFF1, data); - - data = BIT(status, 2); - LOAD_REG(cpu, Z80_IFF2, data); - - intr = BIT(status, 4) ? ASSERT_LINE : CLEAR_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - data = BIT(status, 5); - state->m_flash_invert = data; - logerror("FLASH state: %s\n", data ? "PAPER on INK" : "INK on PAPER"); - - /* Memory dump */ - logerror("Loading %04X bytes of RAM at %04X\n", size, start); - for (i = 0; i < size; i++) - space.write_byte(start + i, snapdata[SP_OFFSET + SP_NEW_HDR + i]); - - /* Set border color */ - data = snapdata[SP_OFFSET + 34] & 0x07; - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - spectrum_page_basicrom(machine); - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); -} - -/******************************************************************* - * - * Load a .SNA file. - * - * This format was used by Arnt Gulbrandsen for its JPP - * emulator, and it's based on the format used by the Mirage - * Microdriver, a Microdrive backup accessory. - * - * http://www.worldofspectrum.org/infoseekid.cgi?id=1000266 - * - * The 48K image is always 49179 bytes long. - * - * .SNA snapshots save the PC on the top of the stack, thus - * deleting the original bytes: not a good feature for a snapshot... - * - * It's been reported that snapshots saved at critical moments would - * subsequently crash on restore due to the fact that the stack was full - * or pointed to a ROM address. A workaround for this situation is to - * store 0x0000 into the word where the PC was located. - * - * For sake of fidelity, the code that zeroes the top of the stack has - * been written but commented out. - * - * Later, the format has been extended to store the whole Spectrum 128 status. - * - * 48K format as follows: - * - * Offset Size Description (all registers stored with LSB first) - * ------- ------- ------------------------------------------------- - * 0 1 I - * 1 2 HL' - * 3 2 DE' - * 5 2 BC' - * 7 2 AF' - * 9 2 HL - * 11 2 DE - * 13 2 BC - * 15 2 IY - * 17 2 IX - * 19 1 IFF1/2: bit 0 contains IFF1, bit 2 contains IFF2 (0=DI/1=EI) - * 20 1 R - * 21 2 AF - * 23 2 SP - * 25 1 Interrupt mode (0=IM0/1=IM1/2=IM2) - * 26 1 Border color - * 27 49152 RAM dump - * - * PC is stored on stack. - * - * 128K format as follows: - * - * Offset Size Description (all registers stored with LSB first) - * ------- ------- ------------------------------------------------- - * 0 1 I - * 1 2 HL' - * 3 2 DE' - * 5 2 BC' - * 7 2 AF' - * 9 2 HL - * 11 2 DE - * 13 2 BC - * 15 2 IY - * 17 2 IX - * 19 1 IFF1/2: bit 0 contains IFF1, bit 2 contains IFF2 (0=DI/1=EI) - * 20 1 R - * 21 2 AF - * 23 2 SP - * 25 1 Interrupt mode (0=IM0/1=IM1/2=IM2) - * 26 1 Border color - * 27 16384 RAM bank 5 (0x4000-0x7fff) - * 16411 16384 RAM bank 2 (0x8000-0xbfff) - * 32795 16384 RAM bank n (0xc000-0xffff - currently paged bank) - * 49179 2 PC - * 49181 1 Port 0x7FFD data - * 49182 1 TR-DOS rom paged (0=no/1=yes) - * 49183 81920/ Remaining RAM banks in ascending order - * 98304 - * - * PC is NOT stored on stack. - * - * The bank in 0xc000 is always included even if it is page 2 or 5 - * in which case it is included twice. - * - *******************************************************************/ -void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i, j, usedbanks[8]; - long bank_offset; - UINT8 intr; - UINT16 data, addr; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - if ((snapsize != SNA48_SIZE) && (state->m_port_7ffd_data == -1)) - { - logerror("Can't load 128K .SNA file into 48K machine\n"); - return; - } - - - data = (snapdata[SNA48_OFFSET + 22] << 8) | snapdata[SNA48_OFFSET + 21]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[SNA48_OFFSET + 14] << 8) | snapdata[SNA48_OFFSET + 13]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[SNA48_OFFSET + 12] << 8) | snapdata[SNA48_OFFSET + 11]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[SNA48_OFFSET + 10] << 8) | snapdata[SNA48_OFFSET + 9]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[SNA48_OFFSET + 8] << 8) | snapdata[SNA48_OFFSET + 7]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[SNA48_OFFSET + 6] << 8) | snapdata[SNA48_OFFSET + 5]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[SNA48_OFFSET + 4] << 8) | snapdata[SNA48_OFFSET + 3]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[SNA48_OFFSET + 2] << 8) | snapdata[SNA48_OFFSET + 1]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[SNA48_OFFSET + 18] << 8) | snapdata[SNA48_OFFSET + 17]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[SNA48_OFFSET + 16] << 8) | snapdata[SNA48_OFFSET + 15]; - LOAD_REG(cpu, Z80_IY, data); - - - data = snapdata[SNA48_OFFSET + 20]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[SNA48_OFFSET + 0]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[SNA48_OFFSET + 24] << 8) | snapdata[SNA48_OFFSET + 23]; - LOAD_REG(cpu, Z80_SP, data); - - - data = snapdata[SNA48_OFFSET + 25] & 0x03; - if (data == 3) - data = 2; - LOAD_REG(cpu, Z80_IM, data); - - data = snapdata[SNA48_OFFSET + 19]; - LOAD_REG(cpu, Z80_IFF1, BIT(data, 0)); - LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); - - intr = BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - if (snapsize == SNA48_SIZE) - /* 48K Snapshot */ - spectrum_page_basicrom(machine); - else - { - /* 128K Snapshot */ - state->m_port_7ffd_data = snapdata[SNA128_OFFSET + 2]; - logerror ("Port 7FFD:%02X\n", state->m_port_7ffd_data); - if (snapdata[SNA128_OFFSET + 3]) - { - /* TODO: page TR-DOS ROM when supported */ - } - spectrum_update_paging(machine); - } - - if (snapsize == SNA48_SIZE) - { - /* Memory dump */ - logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[SNA48_HDR + i]); - - /* Get PC from stack */ - addr = cpu->state_int(Z80_SP); - - if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2) - logerror("Corrupted SP out of range:%04X", addr); - else - logerror("Fetching PC from the stack at SP:%04X\n", addr); - - data = (space.read_byte(addr + 1) << 8) | space.read_byte(addr + 0); - LOAD_REG(cpu, Z80_PC, data); - -#if 0 - space.write_byte(addr + 0, 0); // It's been reported that zeroing these locations fixes the loading - space.write_byte(addr + 1, 0); // of a few images that were snapshot at a "wrong" instant -#endif - - addr += 2; - logerror("Fixing SP:%04X\n", addr); - cpu->set_state_int(Z80_SP, addr); - - /* Set border color */ - data = snapdata[SNA48_OFFSET + 26] & 0x07; - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); - } - else - { - /* Set up other RAM banks */ - for (i = 0; i < 8; i++) - usedbanks[i] = 0; - - usedbanks[5] = 1; /* 0x4000-0x7fff */ - usedbanks[2] = 1; /* 0x8000-0xbfff */ - usedbanks[state->m_port_7ffd_data & 0x07] = 1; /* Banked memory */ - - logerror("Loading %05X bytes of RAM at %04X\n", 8*SPECTRUM_BANK, BASE_RAM); - logerror("Loading bank 5 from offset:0001B\n"); - logerror("Loading bank 2 from offset:0401B\n"); - logerror("Loading bank %d from offset:0801B\n", snapdata[SNA128_OFFSET + 2] & 0x07); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[SNA48_HDR + i]); - - bank_offset = SNA48_SIZE + SNA128_HDR; - for (i = 0; i < 8; i++) - { - if (!usedbanks[i]) - { - logerror("Loading bank %d from offset:%05lX\n", i, bank_offset); - state->m_port_7ffd_data &= 0xf8; - state->m_port_7ffd_data += i; - spectrum_update_paging(machine); - for (j = 0; j < SPECTRUM_BANK; j++) - space.write_byte(j + 3*SPECTRUM_BANK, snapdata[bank_offset + j]); - bank_offset += SPECTRUM_BANK; - } - } - - /* program counter */ - data = (snapdata[SNA128_OFFSET + 1] << 8) | snapdata[SNA128_OFFSET + 0]; - LOAD_REG(cpu, Z80_PC, data); - - /* Set border color */ - data = snapdata[SNA48_OFFSET + 26] & 0x07; - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - data = state->m_port_7ffd_data & 0x07; - - /* Reset paging */ - state->m_port_7ffd_data = snapdata[SNA128_OFFSET + 2]; - spectrum_update_paging(machine); - - //logerror("Snapshot loaded.\nExecution resuming at bank:%d %s\n", data, cpu_get_reg_string(cpu, Z80_PC)); - } -} - -/******************************************************************* - * - * Load a .ACH file. - * - * .ACH files were produced by a commercial Archimedes - * (hence the name) emulator called !Speccy. - * - * The files are always 65792 bytes long and store both - * a copy of the ROM and the whole 48K RAM. - * - * - * Offset Size Description (all registers stored with LSB first - * except when noted with *BE*) - * ------- ------- ------------------------------------------------- - * 0 4 A - * 4 4 F - * 8 4 B - * 12 4 C - * 16 4 D - * 20 4 E - * 24 4 H - * 28 4 L - * 32 4 PC - * 36 4 0x00 (reserved for future use) - * 40 4 SP - * 44 104 0x00 (reserved for future use) - * 148 4 R - * 152 4 0x00 (reserved for future use) - * 156 4 Border color - * 160 4 0x00 (reserved for future use) - * 164 2 Interrupt mode (0=IM0/1=IM1/2=IM2) - * 166 24 0x00 (reserved for future use) - * 190 1 I - * 191 1 IFF1/2: (0=DI/1=EI) - * 192 44 0x00 (reserved for future use) - * 236 4 AF' *BE* - * 240 4 BC' *BE* - * 244 2 DE' *BE* - * 246 2 HL' *BE* - * 248 4 IX - * 252 4 IY - * 256 16384 ROM dump - * 16640 49152 RAM dump - * - *******************************************************************/ -void spectrum_setup_ach(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i; - UINT8 intr; - UINT16 data; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - data = (snapdata[ACH_OFFSET + 0] << 8) | snapdata[ACH_OFFSET + 4]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[ACH_OFFSET + 8] << 8) | snapdata[ACH_OFFSET + 12]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[ACH_OFFSET + 16] << 8) | snapdata[ACH_OFFSET + 20]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[ACH_OFFSET + 24] << 8) | snapdata[ACH_OFFSET + 28]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[ACH_OFFSET + 236] << 8) | snapdata[ACH_OFFSET + 237]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[ACH_OFFSET + 240] << 8) | snapdata[ACH_OFFSET + 241]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[ACH_OFFSET + 244] << 8) | snapdata[ACH_OFFSET + 245]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[ACH_OFFSET + 246] << 8) | snapdata[ACH_OFFSET + 247]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[ACH_OFFSET + 249] << 8) | snapdata[ACH_OFFSET + 248]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[ACH_OFFSET + 253] << 8) | snapdata[ACH_OFFSET + 252]; - LOAD_REG(cpu, Z80_IY, data); - - data = snapdata[ACH_OFFSET + 148]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[ACH_OFFSET + 190]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[ACH_OFFSET + 41] << 8) | snapdata[ACH_OFFSET + 40]; - LOAD_REG(cpu, Z80_SP, data); - - data = (snapdata[ACH_OFFSET + 33] << 8) | snapdata[ACH_OFFSET + 32]; - LOAD_REG(cpu, Z80_PC, data); - - data = snapdata[ACH_OFFSET + 164] & 0x03; - if (data == 3) - data = 0; - LOAD_REG(cpu, Z80_IM, data); - - data = snapdata[ACH_OFFSET + 191] ? 1 : 0; - LOAD_REG(cpu, Z80_IFF1, data); - LOAD_REG(cpu, Z80_IFF2, data); - - intr = snapdata[ACH_OFFSET + 191] ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - logerror("Skipping the 16K ROM dump at offset:%04X\n", ACH_OFFSET + 256); - - /* Memory dump */ - logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[ACH_HDR + SPECTRUM_BANK + i]); - - /* Set border color */ - data = snapdata[ACH_OFFSET + 156] & 0x07; - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - spectrum_page_basicrom(machine); - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); -} - -/******************************************************************* - * - * Load a .PRG file. - * - * .PRG files were produced by an irish emulator called SpecEm - * written by Kevin Phair (thanks for the help, Kevin!) - * - * http://code.google.com/p/specem/ - * - * The files are always 49408 bytes long and use some stack space - * to store registers. - * - * The header actually mimics the file descriptor format used by - * the DISCiPLE/+D interface. - * - * Offset Size Description (all registers stored with LSB first - * except when noted with *BE*) - * ------- ------- ------------------------------------------------- - * 0 1 File type (always 0x05, corresponding to "48K Snapshot" - * 1 10 Program name (padded with 0x20) - * 11 2 Number of sectors occupied by the file *BE* - * 13 1 Track number of the first sector of the file - * 14 1 Sector number of the first sector of the file - * 15 195 Sector allocation bitmap - * 210 10 0x00 (reserved for future use) - * 220 2 IY - * 222 2 IX - * 224 2 DE' - * 226 2 BC' - * 228 2 HL' - * 230 2 AF' - * 232 2 DE - * 234 2 BC - * 236 2 HL - * 238 1 Junk created when saving I via LD A,I/PUSH AF - * 239 1 I - * 240 2 SP - * 242 14 0x00 (reserved for future use) - * 256 49152 RAM dump - * - * IFF1/2, R, AF and PC are stored on the stack. Due to a bug in the - * BIOS, the snapshots created with the DISCiPLE have the AF' register - * replaced with the AF register. - * - * It's unknown (but likely possible) that the snapshots could - * suffer from the same "top of the stack" bug as well as .SNA images. - * - *******************************************************************/ -void spectrum_setup_prg(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i; - UINT8 intr; - UINT16 addr, data; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - data = snapdata[PRG_OFFSET + 0]; - if (data != 0x05) - logerror("Wrong DISCiPLE/+D file type: %02X instead of 05\n", data); - - data = (snapdata[PRG_OFFSET + 235] << 8) | snapdata[PRG_OFFSET + 234]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[PRG_OFFSET + 233] << 8) | snapdata[PRG_OFFSET + 232]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[PRG_OFFSET + 237] << 8) | snapdata[PRG_OFFSET + 236]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[PRG_OFFSET + 231] << 8) | snapdata[PRG_OFFSET + 230]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[PRG_OFFSET + 227] << 8) | snapdata[PRG_OFFSET + 226]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[PRG_OFFSET + 225] << 8) | snapdata[PRG_OFFSET + 224]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[PRG_OFFSET + 229] << 8) | snapdata[PRG_OFFSET + 228]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[PRG_OFFSET + 223] << 8) | snapdata[PRG_OFFSET + 222]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[PRG_OFFSET + 221] << 8) | snapdata[PRG_OFFSET + 220]; - LOAD_REG(cpu, Z80_IY, data); - - data = snapdata[PRG_OFFSET + 239]; - LOAD_REG(cpu, Z80_I, data); - - LOAD_REG(cpu, Z80_IM, (data == 0x00 || data == 0x3f) ? 1 : 2); - - /* Memory dump */ - logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[PRG_HDR + i]); - - addr = (snapdata[PRG_OFFSET + 241] << 8) | snapdata[PRG_OFFSET + 240]; - if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 6) - logerror("Corrupted SP out of range:%04X", addr); - else - logerror("Fetching registers IFF1/2, R, AF and PC from the stack at SP:%04X\n", addr); - - data = space.read_byte(addr + 0); // IFF1/2: (bit 2, 0=DI/1=EI) - LOAD_REG(cpu, Z80_IFF1, BIT(data, 2)); - LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); - - intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - data = space.read_byte(addr + 1); - LOAD_REG(cpu, Z80_R, data); - - data = (space.read_byte(addr + 3) << 8) | space.read_byte(addr + 2); - LOAD_REG(cpu, Z80_AF, data); - - data = (space.read_byte(addr + 5) << 8) | space.read_byte(addr + 4); - LOAD_REG(cpu, Z80_PC, data); - -#if 0 - space.write_byte(addr + 0, 0); // It's been reported that zeroing these locations fixes the loading - space.write_byte(addr + 1, 0); // of a few images that were snapshot at a "wrong" instant - space.write_byte(addr + 2, 0); - space.write_byte(addr + 3, 0); - space.write_byte(addr + 4, 0); - space.write_byte(addr + 5, 0); -#endif - - addr += 6; - logerror("Fixing SP:%04X\n", addr); - cpu->set_state_int(Z80_SP, addr); - - /* Set border color */ - data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - spectrum_page_basicrom(machine); - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); -} - -/******************************************************************* - * - * Load a .PLUSD file. - * - * .PLUSD files are the snapshots produced by the DISCiPLE or - * the +D disk interface, thus share the same internal organization - * of the .PRG files, with a couple of notable exceptions: - * - * 1) The filesystem metadata is missing - * 2) Spectrum 128 snapshots (file type 9) are allowed - * - * A commented disassembly of both BIOSes is avilable at: - * - * http://www.biehold.nl/rudy/ - * - * 48K snapshots are 49174 bytes long, 128K snapshots are 131095 - * bytes long. - * - * Philip Kendall's FUSE emulator at http://fuse-emulator.sourceforge.net - * supports this format, but no extension is officially provided. - * Therefore I have used .PLUSD - corrections are welcome! - * - * 48K snapshot format - * ------------------- - * - * Offset Size Description (all registers stored with LSB first - * ------- ------- ------------------------------------------------- - * 0 2 IY - * 2 2 IX - * 4 2 DE' - * 6 2 BC' - * 8 2 HL' - * 10 2 AF' - * 12 2 DE - * 14 2 BC - * 16 2 HL - * 18 1 Junk created when saving I via LD A,I/PUSH AF - * 19 1 I - * 20 2 SP - * 22 49152 RAM dump - * - * 128K snapshot format - * -------------------- - * - * Offset Size Description (all registers stored with LSB first - * ------- ------- ------------------------------------------------- - * 0 2 IY - * 2 2 IX - * 4 2 DE' - * 6 2 BC' - * 8 2 HL' - * 10 2 AF' - * 12 2 DE - * 14 2 BC - * 16 2 HL - * 18 1 Junk created when saving I via LD A,I/PUSH AF - * 19 1 I - * 20 2 SP - * 22 1 Port 0x7FFD data - * 23 131072 RAM dump - * - * The 8 RAM banks are stored in the order 0-7. - * - * IFF1/2, R, AF and PC are stored on the stack. Due to a bug in the - * BIOS, the snapshots created with the DISCiPLE have the AF' register - * replaced with the AF register. - * - * It's unknown (but likely possible) that the snapshots could - * suffer from the same "top of the stack" bug as well as .SNA images. - * - *******************************************************************/ -void spectrum_setup_plusd(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i, j; - UINT8 intr; - UINT16 addr = 0, data; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - data = (snapdata[PLUSD_OFFSET + 15] << 8) | snapdata[PLUSD_OFFSET + 14]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[PLUSD_OFFSET + 13] << 8) | snapdata[PLUSD_OFFSET + 12]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[PLUSD_OFFSET + 17] << 8) | snapdata[PLUSD_OFFSET + 16]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[PLUSD_OFFSET + 11] << 8) | snapdata[PLUSD_OFFSET + 10]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[PLUSD_OFFSET + 7] << 8) | snapdata[PLUSD_OFFSET + 6]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[PLUSD_OFFSET + 5] << 8) | snapdata[PLUSD_OFFSET + 4]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[PLUSD_OFFSET + 9] << 8) | snapdata[PLUSD_OFFSET + 8]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[PLUSD_OFFSET + 3] << 8) | snapdata[PLUSD_OFFSET + 2]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[PLUSD_OFFSET + 1] << 8) | snapdata[PLUSD_OFFSET + 0]; - LOAD_REG(cpu, Z80_IY, data); - - data = snapdata[PLUSD_OFFSET + 19]; - LOAD_REG(cpu, Z80_I, data); - - LOAD_REG(cpu, Z80_IM, (data == 0x00 || data == 0x3f) ? 1 : 2); - - if (snapsize == PLUSD48_SIZE) - { - spectrum_page_basicrom(machine); - - /* Memory dump */ - logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[PLUSD48_HDR + i]); - } - else - { - logerror("Loading %05X bytes of RAM at %04X\n", 8*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 8; i++) - { - switch (i) - { - case 5: addr = SPECTRUM_BANK; - break; - case 2: addr = 2*SPECTRUM_BANK; - break; - case 0: - case 1: - case 3: - case 4: - case 6: - case 7: addr = 3*SPECTRUM_BANK; - state->m_port_7ffd_data &= 0xf8; - state->m_port_7ffd_data += i; - spectrum_update_paging(machine); - break; - }; - logerror("Loading bank %d from offset:%05X\n", i, PLUSD128_HDR + i*SPECTRUM_BANK); - for (j = 0; j < SPECTRUM_BANK; j++) - space.write_byte(j + addr, snapdata[j + PLUSD128_HDR + i*SPECTRUM_BANK]); - } - state->m_port_7ffd_data = snapdata[PLUSD_OFFSET + 22]; - logerror ("Port 7FFD:%02X\n", state->m_port_7ffd_data); - logerror ("Paging bank:%d\n", state->m_port_7ffd_data & 0x07); - spectrum_update_paging(machine); - } - - addr = (snapdata[PLUSD_OFFSET + 21] << 8) | snapdata[PLUSD_OFFSET + 20]; - if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 6) - logerror("Corrupted SP out of range:%04X", addr); - else - logerror("Fetching registers IFF1/2, R, AF and PC from the stack at SP:%04X\n", addr); - - data = space.read_byte(addr + 0); // IFF1/2: (bit 2, 0=DI/1=EI) - LOAD_REG(cpu, Z80_IFF1, BIT(data, 2)); - LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); - - intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - data = space.read_byte(addr + 1); - LOAD_REG(cpu, Z80_R, data); - - data = (space.read_byte(addr + 3) << 8) | space.read_byte(addr + 2); - LOAD_REG(cpu, Z80_AF, data); - - data = (space.read_byte(addr + 5) << 8) | space.read_byte(addr + 4); - LOAD_REG(cpu, Z80_PC, data); - -#if 0 - space.write_byte(addr + 0, 0); // It's been reported that zeroing these locations fixes the loading - space.write_byte(addr + 1, 0); // of a few images that were snapshot at a "wrong" instant - space.write_byte(addr + 2, 0); - space.write_byte(addr + 3, 0); - space.write_byte(addr + 4, 0); - space.write_byte(addr + 5, 0); -#endif - - addr += 6; - logerror("Fixing SP:%04X\n", addr); - cpu->set_state_int(Z80_SP, addr); - - /* Set border color */ - data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - //if (snapsize == PLUSD48_SIZE) - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); - //else - //logerror("Snapshot loaded.\nExecution resuming at bank:%d %s\n", state->m_port_7ffd_data & 0x07, cpu_get_reg_string(cpu, Z80_PC)); -} - -/******************************************************************* - * - * Load a .SEM file. - * - * .SEM files were produced by a german emulator called SpecEmu - * written by Bernd Waschke. - * - * The files are usually 49192 bytes long unless optional POKE - * blocks are stored at the end of the file. - * - * Offset Size Description (all registers stored with LSB first) - * ------- ------- ------------------------------------------------- - * 0 1 0x05 (signature length) - * 1 5 "SPEC1" (signature) - * 6 49152 RAM dump - * 49158 2 AF - * 49160 2 BC - * 49162 2 DE - * 49164 2 HL - * 49166 2 AF' - * 49168 2 BC' - * 49170 2 DE' - * 49172 2 HL' - * 49174 2 PC - * 49176 2 SP - * 49178 2 IX - * 49180 2 IY - * 49182 2 I - * 49184 2 R - * 49186 2 IFF1 (0=DI/1=EI) - * 49188 2 IFF2 (0=DI/1=EI) - * 49190 2 Interrupt mode (0=IM0/1=IM1/2=IM2) - * - * Following these data, there are optional POKE blocks - * - *******************************************************************/ -void spectrum_setup_sem(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i; - UINT8 intr; - UINT16 data; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - data = (snapdata[SEM_OFFSET + 1] << 8) | snapdata[SEM_OFFSET + 0]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[SEM_OFFSET + 3] << 8) | snapdata[SEM_OFFSET + 2]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[SEM_OFFSET + 5] << 8) | snapdata[SEM_OFFSET + 4]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[SEM_OFFSET + 7] << 8) | snapdata[SEM_OFFSET + 6]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[SEM_OFFSET + 9] << 8) | snapdata[SEM_OFFSET + 8]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[SEM_OFFSET + 11] << 8) | snapdata[SEM_OFFSET + 10]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[SEM_OFFSET + 13] << 8) | snapdata[SEM_OFFSET + 12]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[SEM_OFFSET + 15] << 8) | snapdata[SEM_OFFSET + 14]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[SEM_OFFSET + 21] << 8) | snapdata[SEM_OFFSET + 20]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[SEM_OFFSET + 23] << 8) | snapdata[SEM_OFFSET + 22]; - LOAD_REG(cpu, Z80_IY, data); - - - data = snapdata[SEM_OFFSET + 26]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[SEM_OFFSET + 24]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[SEM_OFFSET + 19] << 8) | snapdata[SEM_OFFSET + 18]; - LOAD_REG(cpu, Z80_SP, data); - - data = (snapdata[SEM_OFFSET + 17] << 8) | snapdata[SEM_OFFSET + 16]; - LOAD_REG(cpu, Z80_PC, data); - - data = snapdata[SEM_OFFSET + 32]; - LOAD_REG(cpu, Z80_IM, data); - - data = snapdata[SEM_OFFSET + 28]; - LOAD_REG(cpu, Z80_IFF1, BIT(data, 0)); - data = snapdata[SEM_OFFSET + 30]; - LOAD_REG(cpu, Z80_IFF2, BIT(data, 0)); - - intr = BIT(snapdata[SEM_OFFSET + 30], 0) ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - /* Memory dump */ - logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[SEM_SIGNATURE + i]); - - /* Set border color */ - data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - spectrum_page_basicrom(machine); - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); - -/* TODO: Decode the optional POKE bank at the end of the image */ - -} - -/******************************************************************* - * - * Load a .SIT file. - * - * .SIT files were produced by a spanish emulator called Sinclair - * written by Pedro M. R. Salas. - * - * http://www.ugr.es/~pedrom/sinclair.htm - * - * The files are always 65564 bytes long and store both ROM and RAM. - * - * Offset Size Description (all registers stored with LSB first) - * ------- ------- ------------------------------------------------- - * 0 2 BC - * 2 2 DE - * 4 2 HL - * 6 2 AF - * 8 2 IX - * 10 2 IY - * 12 2 SP - * 14 2 PC - * 16 1 R - * 17 1 I - * 18 2 BC' - * 20 2 DE' - * 22 2 HL' - * 24 2 AF' - * 26 1 Interrupt mode (0=IM0/1=IM1/2=IM2) - * 27 1 Border color - * 28 16384 ROM dump - * 16412 49152 RAM dump - * - *******************************************************************/ -void spectrum_setup_sit(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i; - UINT8 intr; - UINT16 data; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - data = (snapdata[SIT_OFFSET + 7] << 8) | snapdata[SIT_OFFSET + 6]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[SIT_OFFSET + 1] << 8) | snapdata[SIT_OFFSET + 0]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[SIT_OFFSET + 3] << 8) | snapdata[SIT_OFFSET + 2]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[SIT_OFFSET + 5] << 8) | snapdata[SIT_OFFSET + 4]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[SIT_OFFSET + 25] << 8) | snapdata[SIT_OFFSET + 24]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[SIT_OFFSET + 19] << 8) | snapdata[SIT_OFFSET + 18]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[SIT_OFFSET + 21] << 8) | snapdata[SIT_OFFSET + 20]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[SIT_OFFSET + 23] << 8) | snapdata[SIT_OFFSET + 22]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[SIT_OFFSET + 9] << 8) | snapdata[SIT_OFFSET + 8]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[SIT_OFFSET + 11] << 8) | snapdata[SIT_OFFSET + 10]; - LOAD_REG(cpu, Z80_IY, data); - - - data = snapdata[SIT_OFFSET + 16]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[SIT_OFFSET + 17]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[SIT_OFFSET + 13] << 8) | snapdata[SIT_OFFSET + 12]; - LOAD_REG(cpu, Z80_SP, data); - - data = (snapdata[SIT_OFFSET + 15] << 8) | snapdata[SIT_OFFSET + 14]; - LOAD_REG(cpu, Z80_PC, data); - - data = snapdata[SIT_OFFSET + 26]; - LOAD_REG(cpu, Z80_IM, data); - - data = 0x01; // .SIT snapshots don't specify whether interrupts are enabled or not, so I assume they are. - LOAD_REG(cpu, Z80_IFF1, data); - LOAD_REG(cpu, Z80_IFF2, data); - - intr = data ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - /* Memory dump */ - logerror("Skipping the 16K ROM dump at offset:%04X\n", SIT_OFFSET + 28); - logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[SIT_HDR + SPECTRUM_BANK + i]); - - /* Set border color */ - data = snapdata[SIT_OFFSET + 27] & 0x07; - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - spectrum_page_basicrom(machine); - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); -} - -/******************************************************************* - * - * Load a .ZX file. - * - * .ZX files were produced by the Amiga emulator called KGB - * - * The files are usually 49486 bytes and store at the beginning - * of the file the last 132 bytes of the ROM. - * - * Offset Size Description (all registers stored with MSB first) - * ------- ------- ------------------------------------------------- - * 0 132 Last 132 bytes of ROM dump - * 132 49152 RAM dump - * 49284 132 0x00 (reserved for future use) - * 49416 10 Various KGB settings - * 49426 1 IFF1/2: (0=DI/1=EI) - * 49427 2 Reserved (must be 0x0003) - * 49429 1 KGB ColorMode (0=BW/1=Color) - * 49430 4 0x00 (reserved for future use) - * 49434 2 BC - * 49436 2 BC' - * 49438 2 DE - * 49440 2 DE' - * 49442 2 HL - * 49444 2 HL' - * 49446 2 IX - * 49448 2 IY - * 49450 1 I - * 49451 1 R - * 49452 3 0x00 (reserved for future use) - * 49455 1 A' - * 49456 1 0x00 (reserved for future use) - * 49457 1 A - * 49458 1 0x00 (reserved for future use) - * 49459 1 F' - * 49460 1 0x00 (reserved for future use) - * 49461 1 F - * 49462 2 0x00 (reserved for future use) - * 49464 2 PC - * 49466 2 0x00 (reserved for future use) - * 49468 2 SP - * 49470 2 KGB Soundmode (0=Simple/1=Pitch/2=RomOnly) - * 49472 2 KGB HaltMode (0=NoHalt/1=Halt) - * 49474 2 Interrupt mode (-1=IM0/0=IM1/1=IM2) - * 49476 10 0x00 (reserved for future use) - * - *******************************************************************/ -void spectrum_setup_zx(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i; - UINT8 intr; - UINT16 data, mode; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - logerror("Skipping last 132 bytes of the 16K ROM dump at offset:0000\n"); - - data = (snapdata[ZX_OFFSET + 173] << 8) | snapdata[ZX_OFFSET + 177]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[ZX_OFFSET + 150] << 8) | snapdata[ZX_OFFSET + 151]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[ZX_OFFSET + 154] << 8) | snapdata[ZX_OFFSET + 155]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[ZX_OFFSET + 158] << 8) | snapdata[ZX_OFFSET + 159]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[ZX_OFFSET + 171] << 8) | snapdata[ZX_OFFSET + 175]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[ZX_OFFSET + 152] << 8) | snapdata[ZX_OFFSET + 153]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[ZX_OFFSET + 156] << 8) | snapdata[ZX_OFFSET + 157]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[ZX_OFFSET + 160] << 8) | snapdata[ZX_OFFSET + 161]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[ZX_OFFSET + 162] << 8) | snapdata[ZX_OFFSET + 163]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[ZX_OFFSET + 164] << 8) | snapdata[ZX_OFFSET + 165]; - LOAD_REG(cpu, Z80_IY, data); - - - data = snapdata[ZX_OFFSET + 167]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[ZX_OFFSET + 166]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[ZX_OFFSET + 184] << 8) | snapdata[ZX_OFFSET + 185]; - LOAD_REG(cpu, Z80_SP, data); - - data = (snapdata[ZX_OFFSET + 180] << 8) | snapdata[ZX_OFFSET + 181]; - LOAD_REG(cpu, Z80_PC, data); - - mode = (snapdata[ZX_OFFSET + 190] << 8) | snapdata[ZX_OFFSET + 191]; - switch (mode) - { - case 0xffff: - LOAD_REG(cpu, Z80_IM, (UINT64)0); - break; - case 0x00: - LOAD_REG(cpu, Z80_IM, 1); - break; - case 0x01: - LOAD_REG(cpu, Z80_IM, 2); - break; - default: - logerror("Invalid IM:%04X\n", mode); - } - - data = BIT(snapdata[ZX_OFFSET + 142], 0); - LOAD_REG(cpu, Z80_IFF1, data); - LOAD_REG(cpu, Z80_IFF2, data); - - intr = BIT(snapdata[ZX_OFFSET + 142], 0) ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - /* Memory dump */ - logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[132 + i]); - - /* Set border color */ - data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - spectrum_page_basicrom(machine); - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); -} - -/******************************************************************* - * - * Load a .SNP file. - * - * .SNP files were produced by a polish emulator called Nuclear ZX - * written by Radovan Garabik and Lubomir Salanci. - * - * http://korpus.juls.savba.sk/~garabik/old/zx.html - * - * The files are always 49183 bytes long. - * - * Offset Size Description (all registers stored with LSB first) - * ------- ------- ------------------------------------------------- - * 0 49152 RAM dump - * 49152 2 AF - * 49154 1 Border color - * 49155 1 0x00 (reserved for future use) - * 49156 2 BC - * 49158 2 DE - * 49160 2 HL - * 49162 2 PC - * 49164 2 SP - * 49166 2 IX - * 49168 2 IY - * 49170 1 0x00 (reserved for IFF2 but not implemented) - * 49171 1 IFF1 (0=DI/other=EI) - * 49172 1 Interrupt mode (0=IM0/1=IM1/2=IM2) - * 49173 1 R - * 49174 1 I - * 49175 2 AF' - * 49177 2 BC' - * 49179 2 DE' - * 49181 2 HL' - * - *******************************************************************/ -void spectrum_setup_snp(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i; - UINT8 intr; - UINT16 data; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - data = (snapdata[SNP_OFFSET + 1] << 8) | snapdata[SNP_OFFSET + 0]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[SNP_OFFSET + 5] << 8) | snapdata[SNP_OFFSET + 4]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[SNP_OFFSET + 7] << 8) | snapdata[SNP_OFFSET + 6]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[SNP_OFFSET + 9] << 8) | snapdata[SNP_OFFSET + 8]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[SNP_OFFSET + 24] << 8) | snapdata[SNP_OFFSET + 23]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[SNP_OFFSET + 26] << 8) | snapdata[SNP_OFFSET + 25]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[SNP_OFFSET + 28] << 8) | snapdata[SNP_OFFSET + 27]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[SNP_OFFSET + 30] << 8) | snapdata[SNP_OFFSET + 29]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[SNP_OFFSET + 15] << 8) | snapdata[SNP_OFFSET + 14]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[SNP_OFFSET + 17] << 8) | snapdata[SNP_OFFSET + 16]; - LOAD_REG(cpu, Z80_IY, data); - - - data = snapdata[SNP_OFFSET + 21]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[SNP_OFFSET + 22]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[SNP_OFFSET + 13] << 8) | snapdata[SNP_OFFSET + 12]; - LOAD_REG(cpu, Z80_SP, data); - - data = (snapdata[SNP_OFFSET + 11] << 8) | snapdata[SNP_OFFSET + 10]; - LOAD_REG(cpu, Z80_PC, data); - - - data = snapdata[SNP_OFFSET + 20] & 0x03; - LOAD_REG(cpu, Z80_IM, data); - - data = BIT(snapdata[SNP_OFFSET + 19], 0); - LOAD_REG(cpu, Z80_IFF1, data); - LOAD_REG(cpu, Z80_IFF2, data); - - intr = BIT(snapdata[SNP_OFFSET + 19], 0) ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - /* Memory dump */ - logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 3*SPECTRUM_BANK; i++) - space.write_byte(BASE_RAM + i, snapdata[i]); - - /* Set border color */ - data = snapdata[SNP_OFFSET + 2] & 0x07; - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - spectrum_page_basicrom(machine); - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); -} - -/******************************************************************* - * - * Load a .SNX file. - * - * .SNX files were produced by an Atari ST emulator called Specci - * written by Christian Gandler - * - * http://cd.textfiles.com/crawlycrypt1/apps/misc/zx_sp207/ - * - * The header is an extension of the .SNA format and the RAM dump - * is compressed with a simple run-length algorithm. - * - * Offset Size Description (all registers stored with LSB first - * except when noted with *BE*) - * ------- ------- ------------------------------------------------- - * 0 4 "XSNA" (signature) - * 4 2 Header length *BE* - * 6 1 I - * 7 2 HL' - * 9 2 DE' - * 11 2 BC' - * 13 2 AF' - * 15 2 HL - * 17 2 DE - * 19 2 BC - * 21 2 IY - * 23 2 IX - * 25 1 IFF1/2: bit 0 contains IFF1, bit 2 contains IFF2 (0=DI/1=EI) - * 26 1 R - * 27 2 AF - * 29 2 SP - * 31 1 Interrupt Mode (0=IM0/1=IM1/2=IM2) - * 32 1 Border color - * 33 1 Specci settings: Interface 1 (0=no/1=yes) - * 34 1 Specci settings: FLASH emulation (0=no/1=yes) - * 35 1 Specci settings: Attributes emulation (0=no/1=yes) - * 36 1 Specci settings: Bit 7 - Keyboard (0=QWERTY/1=QWERTZ) - * Bit 6 - ULA emulation (0=no/1=yes) - * Bit 0,1 - Joystick interface - * 00 = Kempston - * 01 = IF2 Left - * 10 = IF2 Right - * 11 = Cursor/AGF/Protek - * 37 1 Specci settings: R register emulation (0=no/1=yes) - * Bit 7 - EAR bit (0=Issue 3/1=Issue 2) - * 38 1 Specci settings: Interrupt frequency (0=50 Hz/1=100 Hz) - * 39 1 Specci settings: RS232 redirection (0=RS232/1=Centronics) - * 40 1 Specci settings: Sound emulation - * Bit 4,7 - Frequency (0..4) for mode 2 - * Bit 0,3 - Mode (0=off/1=direct/2=interrupt) - * 41 1 Specci settings: Border emulation (0=off/1=direct/2=interrupt) - * 42 1 Specci settings: IM2 hardware vector (0..255) - * 43 ????? RAM dump - * - * PC is stored on stack. - * - * The RAM dump is divided into short or long datablocks: - * if the block is composed of the same byte, it is replaced by - * a compressed version. The format of the various blocks follows: - * - * Uncompressed short block - * ------------------------ - * Offset Size Description - * ------- ------- ------------------------------------------------- - * 0 1 Marker byte. Values between 0xe0 and 0xef. - * Low nibble is (block length - 1). - * 1 ????? Data block - * - * Compressed short block - * ---------------------- - * Offset Size Description - * ------- ------- ------------------------------------------------- - * 0 1 Marker byte. Values between 0xf0 and 0xff. - * Low nibble is (block length - 1). - * 1 1 Filler byte. This byte is repeated for the whole - * length of the block. - * - * Uncompressed long block - * ----------------------- - * Offset Size Description - * ------- ------- ------------------------------------------------- - * 0 2 Block length in big endian format. - * Values between 0x0000 and 0xdfff. - * 2 1 Uncompressed block flag: 0xff. - * 3 ????? Data block - * - * Compressed long block - * --------------------- - * Offset Size Description - * ------- ------- ------------------------------------------------- - * 0 2 Block length in big endian format. - * Values between 0x0000 and 0xdfff. - * 2 1 Compressed block flag: 0x00. - * 3 1 Filler byte. This byte is repeated for the whole - * length of the block. - * - *******************************************************************/ -static void spectrum_snx_decompress_block(address_space &space, UINT8 *source, UINT16 dest, UINT16 size) -{ - UINT8 counthi, countlo, compress, fill; - UINT16 block = 0, count, i, j, numbytes; - - i = SNX_HDR - 1; - numbytes = 0; - - while (numbytes < size) - { - counthi = source[++i]; - if (counthi >= 0xe0) - { - count = (counthi & 0x0f) + 1; // Short block - if ((counthi & 0xf0) == 0xf0) - compress = SNX_COMPRESSED; - else - compress = SNX_UNCOMPRESSED; - logerror("Block:%05d Type:Short Compr:%s Offset:%04X Len:%04X ", block++, compress == SNX_COMPRESSED ? "Y" : "N", i-1, count); - } - else - { - countlo = source[++i]; - count = (counthi << 8) | countlo; // Long block - compress = source[++i]; - logerror("Block:%05d Type:Long Compr:%s Offset:%04X Len:%04X ", block++, compress == SNX_COMPRESSED ? "Y" : "N", i-3, count); - } - - if (compress == SNX_COMPRESSED) - { - fill = source[++i]; - logerror("Dest:%04X Filler:%02X\n", BASE_RAM + numbytes, fill); - for(j = 0; j < count; j++) - space.write_byte(BASE_RAM + numbytes + j, fill); - numbytes += count; - } - else - { - logerror("Dest:%04X\n", BASE_RAM + numbytes); - j = 0; - while (j < count) - space.write_byte(BASE_RAM + numbytes + j++, source[++i]); - numbytes += count; - } - } -} - -void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - UINT8 intr; - UINT16 data, addr; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - data = (snapdata[SNX_OFFSET + 4] << 8) | snapdata[SNX_OFFSET + 5]; - if (data != 0x25) - logerror("Corrupted header length: %02X instead of 0x25\n", data); - - data = (snapdata[SNX_OFFSET + 28] << 8) | snapdata[SNX_OFFSET + 27]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[SNX_OFFSET + 20] << 8) | snapdata[SNX_OFFSET + 19]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[SNX_OFFSET + 18] << 8) | snapdata[SNX_OFFSET + 17]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[SNX_OFFSET + 16] << 8) | snapdata[SNX_OFFSET + 15]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[SNX_OFFSET + 14] << 8) | snapdata[SNX_OFFSET + 13]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[SNX_OFFSET + 12] << 8) | snapdata[SNX_OFFSET + 11]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[SNX_OFFSET + 10] << 8) | snapdata[SNX_OFFSET + 9]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[SNX_OFFSET + 8] << 8) | snapdata[SNX_OFFSET + 7]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[SNX_OFFSET + 24] << 8) | snapdata[SNX_OFFSET + 23]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[SNX_OFFSET + 22] << 8) | snapdata[SNX_OFFSET + 21]; - LOAD_REG(cpu, Z80_IY, data); - - - data = snapdata[SNX_OFFSET + 26]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[SNX_OFFSET + 6]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[SNX_OFFSET + 30] << 8) | snapdata[SNX_OFFSET + 29]; - LOAD_REG(cpu, Z80_SP, data); - - - data = snapdata[SNX_OFFSET + 31] & 0x03; - if (data == 3) - data = 2; - LOAD_REG(cpu, Z80_IM, data); - - data = snapdata[SNX_OFFSET + 25]; - LOAD_REG(cpu, Z80_IFF1, BIT(data, 0)); - LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); - - intr = BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - /* Memory dump */ - logerror("Uncompressing %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - spectrum_snx_decompress_block(space, snapdata, BASE_RAM, 3*SPECTRUM_BANK); - - /* get pc from stack */ - addr = cpu->state_int(Z80_SP); - - if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2) - logerror("Corrupted SP out of range:%04X", addr); - else - logerror("Fetching PC from the stack at SP:%04X\n", addr); - - LOAD_REG(cpu, Z80_PC, (space.read_byte(addr + 1) << 8) | space.read_byte(addr + 0)); - -#if 0 - space.write_byte(addr + 0, 0); // It's been reported that zeroing these locations fixes the loading - space.write_byte(addr + 1, 0); // of a few images that were snapshot at a "wrong" instant -#endif - - addr += 2; - logerror("Fixed the stack at SP:%04X\n", addr); - cpu->set_state_int(Z80_SP, addr); - - /* Set border color */ - data = snapdata[SNX_OFFSET + 32] & 0x07; - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - spectrum_page_basicrom(machine); - -/* TODO: Enable/disable IF1 as per snapdata[SNX_OFFSET + 33] */ - -/* TODO: Enable/disable joysticks as per snapdata[SNX_OFFSET + 36] */ - -/* TODO: Enable selection of Issue 2/3 config switch as per snapdata[SNX_OFFSET + 37] */ - - //logerror("Snapshot loaded.\nExecution resuming at %s\n", cpu_get_reg_string(cpu, Z80_PC)); -} - -/******************************************************************* - * - * Load a .FRZ file. - * - * .FRZ files were produced by the czech Amiga emulator CBSpeccy - * written by the CodeBusters. Kudos to Dmitriy Zhivilov and - * Ian Greenway for having reverse-engineered and shared the - * description of this format. - * - * The original specs of this format were published on a - * russian electronics magazine. - * - * The format is always 131114 bytes long and supports only - * Spectrum 128K images. - * - * Offset Size Description (all registers stored with MSB first) - * ------- ------- ------------------------------------------------- - * 0 1 0x00 (reserved for future use) - * 1 1 Port 0x7FFD data - * 2 2 HL' - * 4 2 HL - * 6 2 DE' - * 8 2 DE - * 10 2 BC' - * 12 2 BC - * 14 2 AF' - * 16 2 AF - * 18 7 Emulation disk registers and T-states - * 25 1 R - * 26 2 PC - * 28 2 SP - * 30 1 I - * 31 1 0xFF (reserved for future use) - * 32 1 0x00 (reserved for future use) - * 33 1 Interrupt mode (0=IM0/1=IM1/2=IM2) - * 34 3 0x00 (reserved for future use) - * 37 1 IFF1: bit 2 contains IFF1 (0=DI/1=EI) - * 38 2 IY - * 40 2 IX - * 42 131072 RAM dump - * - * The 8 16K banks are stored in the order 5, 2, 0, 1, 3, 4, 6, 7 - * - *******************************************************************/ -void spectrum_setup_frz(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - int i, j; - UINT8 intr; - UINT16 addr, data; - spectrum_state *state = machine.driver_data(); - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - if (state->m_port_7ffd_data == -1) - { - logerror("Can't load 128K .FRZ file into 48K machine\n"); - return; - } - - data = (snapdata[FRZ_OFFSET + 16] << 8) | snapdata[FRZ_OFFSET + 17]; - LOAD_REG(cpu, Z80_AF, data); - - data = (snapdata[FRZ_OFFSET + 12] << 8) | snapdata[FRZ_OFFSET + 13]; - LOAD_REG(cpu, Z80_BC, data); - - data = (snapdata[FRZ_OFFSET + 8] << 8) | snapdata[FRZ_OFFSET + 9]; - LOAD_REG(cpu, Z80_DE, data); - - data = (snapdata[FRZ_OFFSET + 4] << 8) | snapdata[FRZ_OFFSET + 5]; - LOAD_REG(cpu, Z80_HL, data); - - - data = (snapdata[FRZ_OFFSET + 14] << 8) | snapdata[FRZ_OFFSET + 15]; - LOAD_REG(cpu, Z80_AF2, data); - - data = (snapdata[FRZ_OFFSET + 10] << 8) | snapdata[FRZ_OFFSET + 11]; - LOAD_REG(cpu, Z80_BC2, data); - - data = (snapdata[FRZ_OFFSET + 6] << 8) | snapdata[FRZ_OFFSET + 7]; - LOAD_REG(cpu, Z80_DE2, data); - - data = (snapdata[FRZ_OFFSET + 2] << 8) | snapdata[FRZ_OFFSET + 3]; - LOAD_REG(cpu, Z80_HL2, data); - - - data = (snapdata[FRZ_OFFSET + 40] << 8) | snapdata[FRZ_OFFSET + 41]; - LOAD_REG(cpu, Z80_IX, data); - - data = (snapdata[FRZ_OFFSET + 38] << 8) | snapdata[FRZ_OFFSET + 39]; - LOAD_REG(cpu, Z80_IY, data); - - - data = snapdata[FRZ_OFFSET + 25]; - LOAD_REG(cpu, Z80_R, data); - - data = snapdata[FRZ_OFFSET + 30]; - LOAD_REG(cpu, Z80_I, data); - - - data = (snapdata[FRZ_OFFSET + 28] << 8) | snapdata[FRZ_OFFSET + 29]; - LOAD_REG(cpu, Z80_SP, data); - - data = (snapdata[FRZ_OFFSET + 26] << 8) | snapdata[FRZ_OFFSET + 27]; - LOAD_REG(cpu, Z80_PC, data); - - - data = snapdata[FRZ_OFFSET + 33]; - LOAD_REG(cpu, Z80_IM, data); - - data = snapdata[FRZ_OFFSET + 37]; - LOAD_REG(cpu, Z80_IFF1, BIT(data, 2)); - LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); - - intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; - cpu->set_input_line(INPUT_LINE_IRQ0, intr); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - /* Memory dump */ - addr = 0; - static const UINT8 banks[] = { 5, 2, 0, 1, 3, 4, 6, 7 }; - logerror("Loading %05X bytes of RAM at %04X\n", 8*SPECTRUM_BANK, BASE_RAM); - for (i = 0; i < 8; i++) - { - switch (banks[i]) - { - case 5: addr = SPECTRUM_BANK; - break; - case 2: addr = 2*SPECTRUM_BANK; - break; - case 0: - case 1: - case 3: - case 4: - case 6: - case 7: addr = 3*SPECTRUM_BANK; - state->m_port_7ffd_data &= 0xf8; - state->m_port_7ffd_data += banks[i]; - spectrum_update_paging(machine); - break; - }; - logerror("Loading bank %d from offset:%05X\n", banks[i], FRZ_HDR + i*SPECTRUM_BANK); - for (j = 0; j < SPECTRUM_BANK; j++) - space.write_byte(j + addr, snapdata[j + FRZ_HDR + i*SPECTRUM_BANK]); - } - state->m_port_7ffd_data = snapdata[FRZ_OFFSET + 1]; - logerror ("Port 7FFD:%02X\n", state->m_port_7ffd_data); - logerror ("Paging bank:%d\n", state->m_port_7ffd_data & 0x07); - spectrum_update_paging(machine); - - /* Set border color */ - data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - //logerror("Snapshot loaded.\nExecution resuming at bank:%d %s\n", state->m_port_7ffd_data & 0x07, cpu_get_reg_string(cpu, Z80_PC)); -} - -static void spectrum_z80_decompress_block(address_space &space, UINT8 *source, UINT16 dest, UINT16 size) -{ - UINT8 ch; - int i; - - do - { - /* get byte */ - ch = source[0]; - - /* either start 0f 0x0ed, 0x0ed, xx yy or single 0x0ed */ - if (ch == 0x0ed) - { - if (source[1] == 0x0ed) - { - /* 0x0ed, 0x0ed, xx yy - repetition */ - UINT8 count; - UINT8 data; - - count = source[2]; - - if (count == 0) - return; - - data = source[3]; - - source += 4; - - if (count > size) - count = size; - - size -= count; - - for (i = 0; i < count; i++) - { - space.write_byte(dest, data); - dest++; - } - } - else - { - /* single 0x0ed */ - space.write_byte(dest, ch); - dest++; - source++; - size--; - } - } - else - { - /* not 0x0ed */ - space.write_byte(dest, ch); - dest++; - source++; - size--; - } - } - while (size > 0); -} - -static SPECTRUM_Z80_SNAPSHOT_TYPE spectrum_identify_z80 (UINT8 *snapdata, UINT32 snapsize) -{ - UINT8 lo, hi, data; - - if (snapsize < 30) - return SPECTRUM_Z80_SNAPSHOT_INVALID; /* Invalid file */ - - lo = snapdata[6] & 0x0ff; - hi = snapdata[7] & 0x0ff; - if (hi || lo) - return SPECTRUM_Z80_SNAPSHOT_48K_OLD; /* V1.45 - 48K only */ - - lo = snapdata[30] & 0x0ff; - hi = snapdata[31] & 0x0ff; - data = snapdata[34] & 0x0ff; /* Hardware mode */ - - if ((hi == 0) && (lo == 23)) - { /* V2.01 */ /* V2.01 format */ - switch (data) - { - case 0: - case 1: return SPECTRUM_Z80_SNAPSHOT_48K; - case 2: return SPECTRUM_Z80_SNAPSHOT_SAMRAM; - case 3: - case 4: return SPECTRUM_Z80_SNAPSHOT_128K; - case 128: return SPECTRUM_Z80_SNAPSHOT_TS2068; - } - } - - if ((hi == 0) && (lo == 54)) - { /* V3.0x */ /* V2.01 format */ - switch (data) - { - case 0: - case 1: - case 3: return SPECTRUM_Z80_SNAPSHOT_48K; - case 2: return SPECTRUM_Z80_SNAPSHOT_SAMRAM; - case 4: - case 5: - case 6: return SPECTRUM_Z80_SNAPSHOT_128K; - case 128: return SPECTRUM_Z80_SNAPSHOT_TS2068; - } - } - - return SPECTRUM_Z80_SNAPSHOT_INVALID; -} - -/* now supports 48k & 128k .Z80 files */ -void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsize) -{ - spectrum_state *state = machine.driver_data(); - int i; - UINT8 lo, hi, data; - SPECTRUM_Z80_SNAPSHOT_TYPE z80_type; - cpu_device *cpu = state->m_maincpu; - address_space &space = cpu->space(AS_PROGRAM); - - z80_type = spectrum_identify_z80(snapdata, snapsize); - - switch (z80_type) - { - case SPECTRUM_Z80_SNAPSHOT_INVALID: - logerror("Invalid .Z80 file\n"); - return; - case SPECTRUM_Z80_SNAPSHOT_48K_OLD: - case SPECTRUM_Z80_SNAPSHOT_48K: - logerror("48K .Z80 file\n"); - if (!strcmp(machine.system().name,"ts2068")) - logerror("48K .Z80 file in TS2068\n"); - break; - case SPECTRUM_Z80_SNAPSHOT_128K: - logerror("128K .Z80 file\n"); - if (state->m_port_7ffd_data == -1) - { - logerror("Not a 48K .Z80 file\n"); - return; - } - if (!strcmp(machine.system().name,"ts2068")) - { - logerror("Not a TS2068 .Z80 file\n"); - return; - } - break; - case SPECTRUM_Z80_SNAPSHOT_TS2068: - logerror("TS2068 .Z80 file\n"); - if (strcmp(machine.system().name,"ts2068")) - logerror("Not a TS2068 machine\n"); - break; - case SPECTRUM_Z80_SNAPSHOT_SAMRAM: - logerror("Hardware not supported - .Z80 file\n"); - return; - } - - /* AF */ - hi = snapdata[0] & 0x0ff; - lo = snapdata[1] & 0x0ff; - cpu->set_state_int(Z80_AF, (hi << 8) | lo); - /* BC */ - lo = snapdata[2] & 0x0ff; - hi = snapdata[3] & 0x0ff; - cpu->set_state_int(Z80_BC, (hi << 8) | lo); - /* HL */ - lo = snapdata[4] & 0x0ff; - hi = snapdata[5] & 0x0ff; - cpu->set_state_int(Z80_HL, (hi << 8) | lo); - - /* SP */ - lo = snapdata[8] & 0x0ff; - hi = snapdata[9] & 0x0ff; - cpu->set_state_int(Z80_SP, (hi << 8) | lo); - - /* I */ - cpu->set_state_int(Z80_I, (snapdata[10] & 0x0ff)); - - /* R */ - data = (snapdata[11] & 0x07f) | ((snapdata[12] & 0x01) << 7); - cpu->set_state_int(Z80_R, data); - - /* Set border color */ - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | ((snapdata[12] & 0x0e) >> 1); - spectrum_border_update(machine, (snapdata[12] & 0x0e) >> 1); - - lo = snapdata[13] & 0x0ff; - hi = snapdata[14] & 0x0ff; - cpu->set_state_int(Z80_DE, (hi << 8) | lo); - - lo = snapdata[15] & 0x0ff; - hi = snapdata[16] & 0x0ff; - cpu->set_state_int(Z80_BC2, (hi << 8) | lo); - - lo = snapdata[17] & 0x0ff; - hi = snapdata[18] & 0x0ff; - cpu->set_state_int(Z80_DE2, (hi << 8) | lo); - - lo = snapdata[19] & 0x0ff; - hi = snapdata[20] & 0x0ff; - cpu->set_state_int(Z80_HL2, (hi << 8) | lo); - - hi = snapdata[21] & 0x0ff; - lo = snapdata[22] & 0x0ff; - cpu->set_state_int(Z80_AF2, (hi << 8) | lo); - - lo = snapdata[23] & 0x0ff; - hi = snapdata[24] & 0x0ff; - cpu->set_state_int(Z80_IY, (hi << 8) | lo); - - lo = snapdata[25] & 0x0ff; - hi = snapdata[26] & 0x0ff; - cpu->set_state_int(Z80_IX, (hi << 8) | lo); - - /* Interrupt Flip/Flop */ - if (snapdata[27] == 0) - { - cpu->set_state_int(Z80_IFF1, (UINT64)0); - /* cpu->set_state_int(Z80_IRQ_STATE, 0); */ - } - else - { - cpu->set_state_int(Z80_IFF1, 1); - /* cpu->set_state_int(Z80_IRQ_STATE, 1); */ - } - - cpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); -// cpu->set_input_line(INPUT_LINE_NMI, data); - cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - /* IFF2 */ - if (snapdata[28] != 0) - { - data = 1; - } - else - { - data = 0; - } - cpu->set_state_int(Z80_IFF2, data); - - /* Interrupt Mode */ - cpu->set_state_int(Z80_IM, (snapdata[29] & 0x03)); - - if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K_OLD) - { - lo = snapdata[6] & 0x0ff; - hi = snapdata[7] & 0x0ff; - cpu->set_state_int(Z80_PC, (hi << 8) | lo); - - spectrum_page_basicrom(machine); - - if ((snapdata[12] & 0x020) == 0) - { - logerror("Not compressed\n"); /* not compressed */ - for (i = 0; i < 49152; i++) - space.write_byte(i + 16384, snapdata[30 + i]); - } - else - { - logerror("Compressed\n"); /* compressed */ - spectrum_z80_decompress_block(space, snapdata + 30, 16384, 49152); - } - } - else - { - UINT8 *pSource; - int header_size; - - header_size = 30 + 2 + ((snapdata[30] & 0x0ff) | ((snapdata[31] & 0x0ff) << 8)); - - lo = snapdata[32] & 0x0ff; - hi = snapdata[33] & 0x0ff; - cpu->set_state_int(Z80_PC, (hi << 8) | lo); - - if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine.system().name,"ts2068"))) - { - ay8910_device *ay8912 = machine.device("ay8912"); - - /* Only set up sound registers for 128K machine or TS2068! */ - for (i = 0; i < 16; i++) - { - ay8912->address_w(state->generic_space(), 0, i); - ay8912->data_w(state->generic_space(), 0, snapdata[39 + i]); - } - ay8912->address_w(state->generic_space(), 0, snapdata[38]); - } - - pSource = snapdata + header_size; - - if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K) - /* Ensure 48K Basic ROM is used */ - spectrum_page_basicrom(machine); - - do - { - unsigned short length; - UINT8 page; - int Dest = 0; - - length = (pSource[0] & 0x0ff) | ((pSource[1] & 0x0ff) << 8); - page = pSource[2]; - - if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K || z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) - { - switch (page) - { - case 4: Dest = 0x08000; break; - case 5: Dest = 0x0c000; break; - case 8: Dest = 0x04000; break; - default: Dest = 0; break; - } - } - else - { - /* 3 = bank 0, 4 = bank 1 ... 10 = bank 7 */ - if ((page >= 3) && (page <= 10)) - { - /* Page the appropriate bank into 0xc000 - 0xfff */ - state->m_port_7ffd_data = page - 3; - spectrum_update_paging(machine); - Dest = 0x0c000; - } - else - /* Other values correspond to ROM pages */ - Dest = 0x0; - } - - if (Dest != 0) - { - if (length == 0x0ffff) - { - /* block is uncompressed */ - logerror("Not compressed\n"); - - /* not compressed */ - for (i = 0; i < 16384; i++) - space.write_byte(i + Dest, pSource[i]); - } - else - { - logerror("Compressed\n"); - - /* block is compressed */ - spectrum_z80_decompress_block(space, &pSource[3], Dest, 16384); - } - } - - /* go to next block */ - pSource += (3 + length); - } - while ((pSource - snapdata) < snapsize); - - if ((state->m_port_7ffd_data != -1) && (z80_type != SPECTRUM_Z80_SNAPSHOT_48K)) - { - /* Set up paging */ - state->m_port_7ffd_data = (snapdata[35] & 0x0ff); - spectrum_update_paging(machine); - } - if ((z80_type == SPECTRUM_Z80_SNAPSHOT_48K) && !strcmp(machine.system().name,"ts2068")) - { - state->m_port_f4_data = 0x03; - state->m_port_ff_data = 0x00; - state->ts2068_update_memory(); - } - if (z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068 && !strcmp(machine.system().name,"ts2068")) - { - state->m_port_f4_data = snapdata[35]; - state->m_port_ff_data = snapdata[36]; - state->ts2068_update_memory(); - } - } -} - -QUICKLOAD_LOAD_MEMBER( spectrum_state,spectrum) -{ - dynamic_buffer quickload_data(quickload_size); - - image.fread(&quickload_data[0], quickload_size); - - if (!core_stricmp(file_type, "scr")) - { - if ((quickload_size != SCR_SIZE) && (quickload_size != SCR_BITMAP)) - { - logerror("Invalid .SCR file size.\n"); - goto error; - } - spectrum_setup_scr(machine(), &quickload_data[0], quickload_size); - } - else if (!core_stricmp(file_type, "raw")) - { - if (quickload_size != RAW_SIZE) - { - logerror("Invalid .RAW file size.\n"); - goto error; - } - spectrum_setup_raw(machine(), &quickload_data[0], quickload_size); - } - - return IMAGE_INIT_PASS; - -error: - return IMAGE_INIT_FAIL; -} - -/******************************************************************* - * - * Load a .SCR file. - * - * .SCR files are just a binary dump of the ZX Spectrum's - * display file, which is 256x192 pixels large. - * - * These file are created using the Sinclair BASIC command - * - * SAVE "filename" SCREEN$ - * - * where the keyword "SCREEN$" is a shortcut for "CODE 16384,6912" - * i.e. the loading address and the length of the data. - * - * The format is organized as follows: - * - * Offset Size Description - * -------- ------- ------------------------------------------------- - * 0 6144 Screen bitmap - * 6144 768 Screen attributes - * - * Some utilities and emulators support a B&W version of this - * format, which stores only the bitmap. These files can't be - * produced using the SAVE SCREEN$ command - rather they're - * created by the command - * - * SAVE "filename" CODE 16384,6144 - * - *******************************************************************/ -void spectrum_setup_scr(running_machine &machine, UINT8 *quickdata, UINT32 quicksize) -{ - int i; - address_space &space = machine.driver_data()->m_maincpu->space(AS_PROGRAM); - - for (i = 0; i < quicksize; i++) - space.write_byte(i + BASE_RAM, quickdata[i]); - - log_quickload(machine, quicksize == SCR_SIZE ? "SCREEN$" : "SCREEN$ (Mono)", BASE_RAM, quicksize, 0, EXEC_NA); -} - -/******************************************************************* - * - * Load a .RAW file. - * - * .RAW files are a binary dump of the ZX Spectrum RAM - * and are created using the Sinclair BASIC command - * - * SAVE *"b" CODE 16384,49152 - * - * which copies the whole RAM to the Interface 1's RS232 interface. - * The resulting file is always 49161 bytes long. - * - * The format is organized as follows: - * - * Offset Size Description (all registers stored with LSB first) - * ------- ------- ------------------------------------------------- - * 0 1 0x03 (BYTES file type) - * 1 2 Image size - * 3 2 Image start address - * 5 4 0xFF - * - * Since the size and the start address are encoded in the header, - * it would be possible to create .RAW images of any part of the RAM. - * However, no image of such type has ever surfaced. - * - *******************************************************************/ -void spectrum_setup_raw(running_machine &machine, UINT8 *quickdata, UINT32 quicksize) -{ - int i; - UINT8 data; - UINT16 start, len; - spectrum_state *state = machine.driver_data(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - - start = (quickdata[RAW_OFFSET + 4] << 8) | quickdata[RAW_OFFSET + 3]; - len = (quickdata[RAW_OFFSET + 2] << 8) | quickdata[RAW_OFFSET + 1]; - - for (i = 0; i < len; i++) - space.write_byte(i + start, quickdata[i + RAW_HDR]); - - /* Set border color */ - data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. - state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | data; - spectrum_border_update(machine, data); - logerror("Border color:%02X\n", data); - - log_quickload(machine, "BYTES", start, len, 0, EXEC_NA); -} diff --git a/src/mess/machine/spec_snqk.h b/src/mess/machine/spec_snqk.h deleted file mode 100644 index 6eec8f90ade..00000000000 --- a/src/mess/machine/spec_snqk.h +++ /dev/null @@ -1,181 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/***************************************************************************** - * - * machine/spec_snqk.h - * - ****************************************************************************/ - -#ifndef __SPEC_SNQK_H__ -#define __SPEC_SNQK_H__ - -#include "imagedev/snapquik.h" - -void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_sp(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_ach(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_prg(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_plusd(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_sem(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_sit(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_zx(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_snp(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); -void spectrum_setup_frz(running_machine &machine, UINT8 *snapdata, UINT32 snapsize); - -void spectrum_setup_scr(running_machine &machine, UINT8 *quickdata, UINT32 quicksize); -void spectrum_setup_raw(running_machine &machine, UINT8 *quickdata, UINT32 quicksize); - -#define BASE_RAM 0x4000 -#define SPECTRUM_BANK 0x4000 - -/***************************************************************************** - * - * .SNA format (used by JPP) - * - ****************************************************************************/ -#define SNA48_OFFSET 0 -#define SNA48_HDR 27 -#define SNA48_SIZE (SNA48_HDR + 3*SPECTRUM_BANK) - -#define SNA128_OFFSET (SNA48_HDR + 3*SPECTRUM_BANK) -#define SNA128_HDR 4 -#define SNA128_SIZE_1 (SNA48_HDR + 3*SPECTRUM_BANK + SNA128_HDR + 5*SPECTRUM_BANK) -#define SNA128_SIZE_2 (SNA48_HDR + 3*SPECTRUM_BANK + SNA128_HDR + 6*SPECTRUM_BANK) - -/***************************************************************************** - * - * .SP format (used by VGASPEC and Spanish Spectrum emulator) - * - ****************************************************************************/ -#define SP_OLD_HDR 32 -#define SP_NEW_HDR 38 -#define SP_OLD_SIZE (SP_OLD_HDR + 3*SPECTRUM_BANK) -#define SP_NEW_SIZE_16K (SP_NEW_HDR + 1*SPECTRUM_BANK) -#define SP_NEW_SIZE_48K (SP_NEW_HDR + 3*SPECTRUM_BANK) - -/***************************************************************************** - * - * .ACH format (used by !Speccy) - * - ****************************************************************************/ -#define ACH_OFFSET 0 -#define ACH_HDR 256 -#define ACH_SIZE (ACH_HDR + BASE_RAM + 3*SPECTRUM_BANK) - -/***************************************************************************** - * - * .PRG format (used by SpecEm) - * - ****************************************************************************/ -#define PRG_OFFSET 0 -#define PRG_HDR 256 -#define PRG_SIZE (PRG_HDR + 3*SPECTRUM_BANK) - -/***************************************************************************** - * - * .PLUSD format (used by FUSE) - * - ****************************************************************************/ -#define PLUSD_OFFSET 0 -#define PLUSD48_HDR 22 -#define PLUSD48_SIZE (PLUSD48_HDR + 3*SPECTRUM_BANK) - -#define PLUSD128_HDR 23 -#define PLUSD128_SIZE (PLUSD128_HDR + 8*SPECTRUM_BANK) - -/***************************************************************************** - * - * .SEM format (used by SpecEmu) - * - ****************************************************************************/ -#define SEM_SIGNATURE 6 -#define SEM_OFFSET 49158 -#define SEM_HDR 34 -#define SEM_SIZE (SEM_SIGNATURE + 3*SPECTRUM_BANK + SEM_HDR) - -/***************************************************************************** - * - * .SIT format (used by Sinclair) - * - ****************************************************************************/ -#define SIT_OFFSET 0 -#define SIT_HDR 28 -#define SIT_SIZE (SIT_HDR + BASE_RAM + 3*SPECTRUM_BANK) - -/***************************************************************************** - * - * .ZX format (used by KGB) - * - ****************************************************************************/ -#define ZX_OFFSET 49284 -#define ZX_HDR 202 -#define ZX_SIZE (132 + 3*SPECTRUM_BANK + ZX_HDR) - -/***************************************************************************** - * - * .SNP format (used by Nuclear ZX) - * - ****************************************************************************/ -#define SNP_OFFSET 49152 -#define SNP_HDR 31 -#define SNP_SIZE (3*SPECTRUM_BANK + SNP_HDR) - -/***************************************************************************** - * - * .SNX format (used by Specci) - * - ****************************************************************************/ -#define SNX_OFFSET 0 -#define SNX_HDR 43 - -#define SNX_COMPRESSED 0xff -#define SNX_UNCOMPRESSED 0x00 - -/***************************************************************************** - * - * .FRZ format (used by CBSpeccy, ZX-Live and ASp) - * - ****************************************************************************/ -#define FRZ_OFFSET 0 -#define FRZ_HDR 42 -#define FRZ_SIZE (FRZ_HDR + 8*SPECTRUM_BANK) - -enum SPECTRUM_SNAPSHOT_TYPE -{ - SPECTRUM_SNAPSHOT_NONE, - SPECTRUM_SNAPSHOT_SNA, - SPECTRUM_SNAPSHOT_Z80, - SPECTRUM_SNAPSHOT_SP, - SPECTRUM_TAPEFILE_TAP -}; - -enum SPECTRUM_Z80_SNAPSHOT_TYPE { - SPECTRUM_Z80_SNAPSHOT_INVALID, - SPECTRUM_Z80_SNAPSHOT_48K_OLD, - SPECTRUM_Z80_SNAPSHOT_48K, - SPECTRUM_Z80_SNAPSHOT_SAMRAM, - SPECTRUM_Z80_SNAPSHOT_128K, - SPECTRUM_Z80_SNAPSHOT_TS2068 -}; - -/***************************************************************************** - * - * .SCR format (used by many emulators) - * - ****************************************************************************/ -#define SCR_BITMAP 6144 -#define SCR_ATTR 768 -#define SCR_SIZE (SCR_BITMAP + SCR_ATTR) - -/***************************************************************************** - * - * .RAW format (used by many emulators) - * - ****************************************************************************/ -#define RAW_OFFSET 0 -#define RAW_HDR 9 -#define RAW_SIZE (RAW_HDR + 3*SPECTRUM_BANK) - -#endif /* __SPEC_SNQK_H__ */ diff --git a/src/mess/machine/special.c b/src/mess/machine/special.c deleted file mode 100644 index 4bbcdbf4dd9..00000000000 --- a/src/mess/machine/special.c +++ /dev/null @@ -1,397 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Specialist machine driver by Miodrag Milanovic - - 20/03/2008 Cassette support - 15/03/2008 Preliminary driver. - -****************************************************************************/ - - - -#include "includes/special.h" - - -/* Driver initialization */ -DRIVER_INIT_MEMBER(special_state,special) -{ - /* set initialy ROM to be visible on first bank */ - UINT8 *RAM = m_region_maincpu->base(); - memset(RAM,0x0000,0x3000); // make first page empty by default - m_bank1->configure_entries(1, 2, RAM, 0x0000); - m_bank1->configure_entries(0, 2, RAM, 0xc000); -} - -READ8_MEMBER( special_state::specialist_8255_porta_r ) -{ - if (m_io_line0->read()!=0xff) return 0xfe; - if (m_io_line1->read()!=0xff) return 0xfd; - if (m_io_line2->read()!=0xff) return 0xfb; - if (m_io_line3->read()!=0xff) return 0xf7; - if (m_io_line4->read()!=0xff) return 0xef; - if (m_io_line5->read()!=0xff) return 0xdf; - if (m_io_line6->read()!=0xff) return 0xbf; - if (m_io_line7->read()!=0xff) return 0x7f; - return 0xff; -} - -READ8_MEMBER( special_state::specialist_8255_portb_r ) -{ - UINT8 dat = 0xff; - - if ((m_specialist_8255_porta & 0x01)==0) dat &= m_io_line0->read(); - if ((m_specialist_8255_porta & 0x02)==0) dat &= m_io_line1->read(); - if ((m_specialist_8255_porta & 0x04)==0) dat &= m_io_line2->read(); - if ((m_specialist_8255_porta & 0x08)==0) dat &= m_io_line3->read(); - if ((m_specialist_8255_porta & 0x10)==0) dat &= m_io_line4->read(); - if ((m_specialist_8255_porta & 0x20)==0) dat &= m_io_line5->read(); - if ((m_specialist_8255_porta & 0x40)==0) dat &= m_io_line6->read(); - if ((m_specialist_8255_porta & 0x80)==0) dat &= m_io_line7->read(); - if ((m_specialist_8255_portc & 0x01)==0) dat &= m_io_line8->read(); - if ((m_specialist_8255_portc & 0x02)==0) dat &= m_io_line9->read(); - if ((m_specialist_8255_portc & 0x04)==0) dat &= m_io_line10->read(); - if ((m_specialist_8255_portc & 0x08)==0) dat &= m_io_line11->read(); - - // shift key - if BIT(~m_io_line12->read(), 0) - dat &= 0xfd; - - // cassette - if (m_cassette->input() > 0.01) - dat &= 0xfe; - - // strobe if a key is pressed - if (dat < 0xfc) dat &= 0x7f; - - return dat; -} - -READ8_MEMBER( special_state::specimx_8255_portb_r ) -{ - UINT8 dat = 0xff; - - if ((m_specialist_8255_porta & 0x01)==0) dat &= m_io_line0->read(); - if ((m_specialist_8255_porta & 0x02)==0) dat &= m_io_line1->read(); - if ((m_specialist_8255_porta & 0x04)==0) dat &= m_io_line2->read(); - if ((m_specialist_8255_porta & 0x08)==0) dat &= m_io_line3->read(); - if ((m_specialist_8255_porta & 0x10)==0) dat &= m_io_line4->read(); - if ((m_specialist_8255_porta & 0x20)==0) dat &= m_io_line5->read(); - if ((m_specialist_8255_porta & 0x40)==0) dat &= m_io_line6->read(); - if ((m_specialist_8255_porta & 0x80)==0) dat &= m_io_line7->read(); - if ((m_specialist_8255_portc & 0x01)==0) dat &= m_io_line8->read(); - if ((m_specialist_8255_portc & 0x02)==0) dat &= m_io_line9->read(); - if ((m_specialist_8255_portc & 0x04)==0) dat &= m_io_line10->read(); - if ((m_specialist_8255_portc & 0x08)==0) dat &= m_io_line11->read(); - - // shift key - if BIT(~m_io_line12->read(), 0) - dat &= 0xfd; - - // cassette - if (m_cassette->input() > 0.01) - dat &= 0xfe; - - return dat; -} - -READ8_MEMBER( special_state::specialist_8255_portc_r ) -{ - if (m_io_line8->read()!=0xff) return 0x0e; - if (m_io_line9->read()!=0xff) return 0x0d; - if (m_io_line10->read()!=0xff) return 0x0b; - if (m_io_line11->read()!=0xff) return 0x07; - return 0x0f; -} - -WRITE8_MEMBER( special_state::specialist_8255_porta_w ) -{ - m_specialist_8255_porta = data; -} - -WRITE8_MEMBER( special_state::specialist_8255_portb_w ) -{ - m_specialist_8255_portb = data; -} - -WRITE8_MEMBER( special_state::specialist_8255_portc_w ) -{ - m_specialist_8255_portc = data; - - m_cassette->output(BIT(data, 7) ? 1 : -1); - - m_dac->write_unsigned8(BIT(data, 5)); //beeper -} - -void special_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_RESET: - m_bank1->set_entry(0); - break; - case TIMER_PIT8253_GATES: - { - m_pit->write_gate0(0); - m_pit->write_gate1(0); - m_pit->write_gate2(0); - break; - } - default: - assert_always(FALSE, "Unknown id in special_state::device_timer"); - } -} - - -MACHINE_RESET_MEMBER(special_state,special) -{ - timer_set(attotime::from_usec(10), TIMER_RESET); - m_bank1->set_entry(1); -} - - -/* - Specialist MX -*/ -WRITE8_MEMBER( special_state::video_memory_w ) -{ - m_ram->pointer()[0x9000 + offset] = data; - m_specimx_colorram[offset] = m_specimx_color; -} - -WRITE8_MEMBER( special_state::specimx_video_color_w ) -{ - m_specimx_color = data; -} - -READ8_MEMBER( special_state::specimx_video_color_r ) -{ - return m_specimx_color; -} - -void special_state::specimx_set_bank(offs_t i, UINT8 data) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - UINT8 *ram = m_ram->pointer(); - - space.install_write_bank(0xc000, 0xffbf, "bank3"); - space.install_write_bank(0xffc0, 0xffdf, "bank4"); - m_bank4->set_base(ram + 0xffc0); - switch(i) - { - case 0 : - space.install_write_bank(0x0000, 0x8fff, "bank1"); - space.install_write_handler(0x9000, 0xbfff, write8_delegate(FUNC(special_state::video_memory_w), this)); - - m_bank1->set_base(ram); - m_bank2->set_base(ram + 0x9000); - m_bank3->set_base(ram + 0xc000); - break; - case 1 : - space.install_write_bank(0x0000, 0x8fff, "bank1"); - space.install_write_bank(0x9000, 0xbfff, "bank2"); - - m_bank1->set_base(ram + 0x10000); - m_bank2->set_base(ram + 0x19000); - m_bank3->set_base(ram + 0x1c000); - break; - case 2 : - space.unmap_write(0x0000, 0x8fff); - space.unmap_write(0x9000, 0xbfff); - - m_bank1->set_base(m_region_maincpu->base() + 0x10000); - m_bank2->set_base(m_region_maincpu->base() + 0x19000); - - if (data & 0x80) - m_bank3->set_base(ram + 0x1c000); - else - m_bank3->set_base(ram + 0xc000); - - break; - } -} - -WRITE8_MEMBER( special_state::specimx_select_bank ) -{ - specimx_set_bank(offset, data); -} - -MACHINE_START_MEMBER(special_state,specimx) -{ - m_drive = 0; -} - -MACHINE_RESET_MEMBER(special_state,specimx) -{ - specimx_set_bank(2, 0); // Initiali load ROM disk - timer_set(attotime::zero, TIMER_PIT8253_GATES); -} - -READ8_MEMBER( special_state::specimx_disk_ctrl_r ) -{ - return 0xff; -} - -WRITE_LINE_MEMBER( special_state::fdc_drq ) -{ - /* Clears HALT state of CPU when data is ready to read */ - if(state) { - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - } -} - -WRITE8_MEMBER( special_state::specimx_disk_ctrl_w ) -{ - static const char *names[] = { "fd0", "fd1"}; - floppy_image_device *floppy = NULL; - floppy_connector *con = machine().device(names[m_drive & 1]); - if(con) - floppy = con->get_device(); - - m_fdc->set_floppy(floppy); - floppy->mon_w(0); - - switch(offset) - { - case 0 : - m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - break; - case 2 : - floppy->ss_w(data & 1); - break; - case 3 : - m_drive = data & 1; - break; - } -} - -/* - Erik -*/ - -void special_state::erik_set_bank() -{ - UINT8 bank1 = m_RR_register & 3; - UINT8 bank2 = (m_RR_register >> 2) & 3; - UINT8 bank3 = (m_RR_register >> 4) & 3; - UINT8 bank4 = (m_RR_register >> 6) & 3; - UINT8 *mem = m_region_maincpu->base(); - UINT8 *ram = m_ram->pointer(); - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.install_write_bank(0x0000, 0x3fff, "bank1"); - space.install_write_bank(0x4000, 0x8fff, "bank2"); - space.install_write_bank(0x9000, 0xbfff, "bank3"); - space.install_write_bank(0xc000, 0xefff, "bank4"); - space.install_write_bank(0xf000, 0xf7ff, "bank5"); - space.install_write_bank(0xf800, 0xffff, "bank6"); - - switch(bank1) - { - case 1: - case 2: - case 3: - m_bank1->set_base(ram + 0x10000*(bank1-1)); - break; - case 0: - space.unmap_write(0x0000, 0x3fff); - m_bank1->set_base(mem + 0x10000); - break; - } - switch(bank2) - { - case 1: - case 2: - case 3: - m_bank2->set_base(ram + 0x10000*(bank2-1) + 0x4000); - break; - case 0: - space.unmap_write(0x4000, 0x8fff); - m_bank2->set_base(mem + 0x14000); - break; - } - switch(bank3) - { - case 1: - case 2: - case 3: - m_bank3->set_base(ram + 0x10000*(bank3-1) + 0x9000); - break; - case 0: - space.unmap_write(0x9000, 0xbfff); - m_bank3->set_base(mem + 0x19000); - break; - } - switch(bank4) - { - case 1: - case 2: - case 3: - m_bank4->set_base(ram + 0x10000*(bank4-1) + 0x0c000); - m_bank5->set_base(ram + 0x10000*(bank4-1) + 0x0f000); - m_bank6->set_base(ram + 0x10000*(bank4-1) + 0x0f800); - break; - case 0: - space.unmap_write(0xc000, 0xefff); - m_bank4->set_base(mem + 0x1c000); - space.unmap_write(0xf000, 0xf7ff); - space.nop_read(0xf000, 0xf7ff); - space.install_readwrite_handler(0xf800, 0xf803, 0, 0x7fc, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi)); - break; - } -} - -DRIVER_INIT_MEMBER(special_state,erik) -{ - m_erik_color_1 = 0; - m_erik_color_2 = 0; - m_erik_background = 0; -} - -MACHINE_RESET_MEMBER(special_state,erik) -{ - m_RR_register = 0x00; - m_RC_register = 0x00; - erik_set_bank(); -} - -READ8_MEMBER( special_state::erik_rr_reg_r ) -{ - return m_RR_register; -} - -WRITE8_MEMBER( special_state::erik_rr_reg_w ) -{ - m_RR_register = data; - erik_set_bank(); -} - -READ8_MEMBER( special_state::erik_rc_reg_r ) -{ - return m_RC_register; -} - -WRITE8_MEMBER( special_state::erik_rc_reg_w ) -{ - m_RC_register = data; - m_erik_color_1 = m_RC_register & 7; - m_erik_color_2 = (m_RC_register >> 3) & 7; - m_erik_background = BIT(m_RC_register, 6) + BIT(m_RC_register, 7) * 4; -} - -READ8_MEMBER( special_state::erik_disk_reg_r ) -{ - return 0xff; -} - -WRITE8_MEMBER( special_state::erik_disk_reg_w ) -{ -/* - wd17xx_set_side (m_fdc,data & 1); - wd17xx_set_drive(m_fdc,(data >> 1) & 1); - wd17xx_dden_w(m_fdc, BIT(data, 2)); - floppy_mon_w(floppy_get_device(machine(), BIT(data, 1)), 0); - floppy_mon_w(floppy_get_device(machine(), BIT(data, 1) ^ 1), 1); - floppy_drive_set_ready_state(floppy_get_device(machine(), BIT(data, 1)), 1, 1);*/ -} diff --git a/src/mess/machine/super80.c b/src/mess/machine/super80.c deleted file mode 100644 index b77c04b68fd..00000000000 --- a/src/mess/machine/super80.c +++ /dev/null @@ -1,240 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/* Super80.c written by Robbbert, 2005-2009. See driver source for documentation. */ - -#include "includes/super80.h" -#include "machine/z80bin.h" - -/**************************** PIO ******************************************************************************/ - - -WRITE8_MEMBER( super80_state::pio_port_a_w ) -{ - m_keylatch = data; - m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); // refresh kbd int -} - -READ8_MEMBER( super80_state::pio_port_b_r ) -{ - UINT8 data = 0xff; - - for (int i = 0; i < 8; i++) - { - if (!BIT(m_keylatch, i)) - data &= m_io_keyboard[i]->read(); - } - - m_key_pressed = 3; - - return data; -} - -/**************************** CASSETTE ROUTINES *****************************************************************/ - -void super80_state::super80_cassette_motor( UINT8 data ) -{ - if (data) - m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - else - m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - - /* does user want to hear the sound? */ - if BIT(m_io_config->read(), 3) - m_cassette->change_state(CASSETTE_SPEAKER_ENABLED,CASSETTE_MASK_SPEAKER); - else - m_cassette->change_state(CASSETTE_SPEAKER_MUTED,CASSETTE_MASK_SPEAKER); -} - -/********************************************* TIMER ************************************************/ - - -// If normal keyboard scan has stopped, then do a scan to allow the interrupt key sequence -TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_k ) -{ - if (m_key_pressed) - m_key_pressed--; - else - if (!m_key_pressed) - m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); -} - -/* cassette load circuit - This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage, - and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint. - - The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop. - The "read-any-system" cassette circuit is a CA3140 op-amp, the smarts being done in software. - - bit 0 = original system (U79 and U1) - bit 1 = MDS fast system - bit 2 = CA3140 */ -TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_p ) -{ - UINT8 cass_ws=0; - - m_cass_data[1]++; - cass_ws = ((m_cassette)->input() > +0.03) ? 4 : 0; - - if (cass_ws != m_cass_data[0]) - { - if (cass_ws) m_cass_data[3] ^= 2; // the MDS flipflop - m_cass_data[0] = cass_ws; - m_cass_data[2] = ((m_cass_data[1] < 0x0d) ? 1 : 0) | cass_ws | m_cass_data[3]; - m_cass_data[1] = 0; - } -} - -/* after the first 4 bytes have been read from ROM, switch the ram back in */ -TIMER_CALLBACK_MEMBER(super80_state::super80_reset) -{ - membank("boot")->set_entry(0); -} - -TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_h ) -{ - UINT8 go_fast = 0; - if ( (!BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 1)) ) /* bit 2 of port F0 is low, OR user turned on config switch */ - go_fast++; - - /* code to slow down computer to 1 MHz by halting cpu on every second frame */ - if (!go_fast) - { - if (!m_int_sw) - m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); // if going, stop it - - m_int_sw++; - if (m_int_sw > 1) - { - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); // if stopped, start it - m_int_sw = 0; - } - } - else - { - if (m_int_sw < 8) // @2MHz, reset just once - { - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - m_int_sw = 8; // ...not every time - } - } -} - -/*************************************** PRINTER ********************************************************/ - -/* The Super80 had an optional I/O card that plugged into the S-100 slot. The card had facility for running - an 8-bit Centronics printer, and a serial device at 300, 600, or 1200 baud. The I/O address range - was selectable via 4 dipswitches. The serial parameters (baud rate, parity, stop bits, etc) was - chosen with more dipswitches. Regretably, no parameters could be set by software. Currently, the - Centronics printer is emulated; the serial side of things may be done later, as will the dipswitches. - - The most commonly used I/O range is DC-DE (DC = centronics, DD = serial data, DE = serial control - All the home-brew roms use this, except for super80e which uses BC-BE. */ - -/**************************** I/O PORTS *****************************************************************/ - -READ8_MEMBER( super80_state::port3e_r ) -{ - return 0xF8 | (m_fdc->intrq_r() << 0) | (m_fdc->drq_r() << 1) | 4; -} - -// UFDC board can support 4 drives; we support 2 -WRITE8_MEMBER( super80_state::port3f_w ) -{ - // m_fdc->58(BIT(data, 0)); 5/8 pin not emulated in wd_fdc - m_fdc->enmf_w(BIT(data,1)); - - floppy_image_device *floppy = NULL; - if (BIT(data, 2)) floppy = m_floppy0->get_device(); - if (BIT(data, 3)) floppy = m_floppy1->get_device(); - //if (BIT(data, 4)) floppy = m_floppy2->get_device(); - //if (BIT(data, 5)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(!BIT(data, 6)); - } - - m_fdc->dden_w(BIT(data, 7)); -} - -READ8_MEMBER( super80_state::super80_f2_r ) -{ - UINT8 data = m_io_dsw->read() & 0xf0; // dip switches on pcb - data |= m_cass_data[2]; // bit 0 = output of U1, bit 1 = MDS cass state, bit 2 = current wave_state - data |= 0x08; // bit 3 - not used - return data; -} - -WRITE8_MEMBER( super80_state::super80_dc_w ) -{ - /* hardware strobe driven from port select, bit 7..0 = data */ - m_cent_data_out->write(space, 0, data); - m_centronics->write_strobe(0); - m_centronics->write_strobe(1); -} - - -WRITE8_MEMBER( super80_state::super80_f0_w ) -{ - UINT8 bits = data ^ m_last_data; - m_portf0 = data; - m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */ - if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ - m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */ - - m_last_data = data; -} - -WRITE8_MEMBER( super80_state::super80r_f0_w ) -{ - UINT8 bits = data ^ m_last_data; - m_portf0 = data | 0x14; - m_speaker->level_w(BIT(data, 3)); /* bit 3 - speaker */ - if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ - m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */ - - m_last_data = data; -} - -/**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/ - -void super80_state::machine_reset() -{ - m_portf0 = 0xff; - m_keylatch = 0xff; - m_key_pressed = 0; - m_palette_index = 0; - machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(super80_state::super80_reset),this)); - membank("boot")->set_entry(1); -} - -DRIVER_INIT_MEMBER( super80_state,super80 ) -{ - UINT8 *RAM = memregion("maincpu")->base(); - membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); -} - - -/*------------------------------------------------- - QUICKLOAD_LOAD_MEMBER( super80_state, super80 ) --------------------------------------------------*/ - -QUICKLOAD_LOAD_MEMBER( super80_state, super80 ) -{ - UINT16 exec_addr, start_addr, end_addr; - - /* load the binary into memory */ - if (z80bin_load_file(&image, m_maincpu->space(AS_PROGRAM), file_type, &exec_addr, &start_addr, &end_addr) == IMAGE_INIT_FAIL) - return IMAGE_INIT_FAIL; - - /* is this file executable? */ - if (exec_addr != 0xffff) - /* check to see if autorun is on */ - if BIT(m_io_config->read(), 0) - m_maincpu->set_pc(exec_addr); - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/svi318.c b/src/mess/machine/svi318.c deleted file mode 100644 index 89ea87ce0e8..00000000000 --- a/src/mess/machine/svi318.c +++ /dev/null @@ -1,767 +0,0 @@ -// license:??? -// copyright-holders:Sean Young,Tomas Karlsson -/* -** Spectravideo SVI-318 and SVI-328 -** -** Sean Young, Tomas Karlsson -** -*/ - -#include "emu.h" -#include "video/mc6845.h" -#include "includes/svi318.h" -#include "cpu/z80/z80.h" -#include "video/tms9928a.h" -#include "imagedev/flopdrv.h" -#include "formats/svi_cas.h" -#include "sound/ay8910.h" - -enum { - SVI_INTERNAL = 0, - SVI_CART = 1, - SVI_EXPRAM2 = 2, - SVI_EXPRAM3 = 3 -}; - - -/* Serial ports */ - -WRITE_LINE_MEMBER(svi318_state::ins8250_interrupt) -{ - if (m_bank_low != SVI_CART) - m_maincpu->set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE)); -} - -#if 0 -static INS8250_REFRESH_CONNECT( svi318_com_refresh_connected ) -{ - /* Motorola MC14412 modem */ - ins8250_handshake_in(device, UART8250_HANDSHAKE_IN_CTS|UART8250_HANDSHAKE_IN_DSR|UART8250_INPUTS_RING_INDICATOR|UART8250_INPUTS_DATA_CARRIER_DETECT); -} -#endif - -/* Cartridge */ - -bool svi318_state::cart_verify(UINT8 *ROM) -{ - if (ROM[0] != 0xf3 || ROM[1] != 0x31) - return false; - - return true; -} - -DEVICE_IMAGE_LOAD_MEMBER( svi318_state, svi318_cart ) -{ - UINT32 size = m_cart->common_get_size("rom"); - - if (size > 0x8000) - { - logerror("Cart image %s larger than expected. Please report the issue.\n", image.filename()); - return IMAGE_INIT_FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - if (image.software_entry() == NULL && !cart_verify(m_cart->get_rom_base())) - return IMAGE_INIT_FAIL; - - return IMAGE_INIT_PASS; -} - - - -/* PPI */ - -/* - PPI Port A Input (address 98H) - Bit Name Description - 1 TA Joystick 1, /SENSE - 2 TB Joystick 1, EOC - 3 TC Joystick 2, /SENSE - 4 TD Joystick 2, EOC - 5 TRIGGER1 Joystick 1, Trigger - 6 TRIGGER2 Joystick 2, Trigger - 7 /READY Cassette, Ready - 8 CASR Cassette, Read data -*/ - -READ8_MEMBER(svi318_state::ppi_port_a_r) -{ - int data = 0x0f; - - if (m_cassette->input() > 0.0038) - data |= 0x80; - if (!m_cassette->exists()) - data |= 0x40; - - data |= m_buttons->read() & 0x30; - - return data; -} - -/* - PPI Port B Input (address 99H) - Bit Name Description - 1 IN0 Keyboard, Column status of selected line - 2 IN1 Keyboard, Column status of selected line - 3 IN2 Keyboard, Column status of selected line - 4 IN3 Keyboard, Column status of selected line - 5 IN4 Keyboard, Column status of selected line - 6 IN5 Keyboard, Column status of selected line - 7 IN6 Keyboard, Column status of selected line - 8 IN7 Keyboard, Column status of selected line -*/ - -READ8_MEMBER(svi318_state::ppi_port_b_r) -{ - if (m_keyboard_row <= 10) - return m_line[m_keyboard_row]->read(); - else - return 0xff; -} - -/* - PPI Port C Output (address 97H) - Bit Name Description - 1 KB0 Keyboard, Line select 0 - 2 KB1 Keyboard, Line select 1 - 3 KB2 Keyboard, Line select 2 - 4 KB3 Keyboard, Line select 3 - 5 CASON Cassette, Motor relay control (0=on, 1=off) - 6 CASW Cassette, Write data - 7 CASAUD Cassette, Audio out (pulse) - 8 SOUND Keyboard, Click sound bit (pulse) -*/ - -WRITE8_MEMBER(svi318_state::ppi_port_c_w) -{ - int val; - - /* key click */ - val = (data & 0x80) ? 0x3e : 0; - val += (data & 0x40) ? 0x3e : 0; - m_dac->write_signed8(val); - - /* cassette motor on/off */ - if (m_cassette->exists()) - { - m_cassette->change_state( - (data & 0x10) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, - CASSETTE_MOTOR_DISABLED); - } - - /* cassette signal write */ - m_cassette->output((data & 0x20) ? -1.0 : +1.0); - - m_keyboard_row = data & 0x0f; -} - -WRITE8_MEMBER(svi318_state::ppi_w) -{ - m_ppi->write(space, offset + 2, data); -} - - -/* PSG */ - -/* - PSG Port A Input - Bit Name Description - 1 FWD1 Joystick 1, Forward - 2 BACK1 Joystick 1, Back - 3 LEFT1 Joystick 1, Left - 4 RIGHT1 Joystick 1, Right - 5 FWD2 Joystick 2, Forward - 6 BACK2 Joystick 2, Back - 7 LEFT2 Joystick 2, Left - 8 RIGHT2 Joystick 2, Right -*/ - -READ8_MEMBER(svi318_state::psg_port_a_r) -{ - return m_joysticks->read(); -} - -/* - PSG Port B Output - Bit Name Description - 1 /CART Memory bank 11, ROM 0000-7FFF (Cartridge /CCS1, /CCS2) - 2 /BK21 Memory bank 21, RAM 0000-7FFF - 3 /BK22 Memory bank 22, RAM 8000-FFFF - 4 /BK31 Memory bank 31, RAM 0000-7FFF - 5 /BK32 Memory bank 32, RAM 8000-7FFF - 6 CAPS Caps-Lock diod - 7 /ROMEN0 Memory bank 12, ROM 8000-BFFF* (Cartridge /CCS3) - 8 /ROMEN1 Memory bank 12, ROM C000-FFFF* (Cartridge /CCS4) - - * The /CART signal must be active for any effect and all banks - with RAM are disabled. -*/ - -WRITE8_MEMBER(svi318_state::psg_port_b_w) -{ - if ((m_bank_switch ^ data) & 0x20) - set_led_status(machine(), 0, !(data & 0x20)); - - m_bank_switch = data; - set_banks(); -} - -/* Disk drives */ - -WRITE_LINE_MEMBER(svi318_state::fdc_intrq_w) -{ - m_irq = state; -} - -WRITE_LINE_MEMBER(svi318_state::fdc_drq_w) -{ - m_drq = state; -} - -WRITE8_MEMBER(svi318_state::fdc_drive_motor_w) -{ - m_floppy = NULL; - - if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); - if (BIT(data, 1)) m_floppy = m_floppy1->get_device(); - - m_fd1793->set_floppy(m_floppy); - - if (m_floppy0->get_device()) - m_floppy0->get_device()->mon_w(!BIT(data, 2)); - - if (m_floppy1->get_device()) - m_floppy1->get_device()->mon_w(!BIT(data, 3)); -} - -WRITE8_MEMBER(svi318_state::fdc_density_side_w) -{ - m_fd1793->dden_w(BIT(data, 0)); - - if (m_floppy) - m_floppy->ss_w(BIT(data, 1)); -} - -READ8_MEMBER(svi318_state::fdc_irqdrq_r) -{ - UINT8 result = 0; - - result |= m_drq << 6; - result |= m_irq << 7; - - return result; -} - -MC6845_UPDATE_ROW( svi318_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - for (int i = 0; i < x_count; i++) - { - UINT8 data = m_svi806_gfx[m_svi806_ram[(ma + i) & 0x7ff] * 16 + ra]; - - if (i == cursor_x) - { - data = 0xff; - } - - for (int j = 0; j < 8; j++) - { - bitmap.pix32(y, i * 8 + j) = palette[TMS9928A_PALETTE_SIZE + BIT(data, 7)]; - data = data << 1; - } - } -} - - -WRITE8_MEMBER(svi318_state::svi806_ram_enable_w) -{ - m_svi806_ram_enabled = (data & 0x01); - set_banks(); -} - - -/* Init functions */ - -static const UINT8 cc_op[0x100] = { - 4+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, 4+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, - 8+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,12+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, - 7+1,10+1,16+1, 6+1, 4+1, 4+1, 7+1, 4+1, 7+1,11+1,16+1, 6+1, 4+1, 4+1, 7+1, 4+1, - 7+1,10+1,13+1, 6+1,11+1,11+1,10+1, 4+1, 7+1,11+1,13+1, 6+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 7+1, 7+1, 7+1, 7+1, 7+1, 7+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, - 5+1,10+1,10+1,10+1,10+1,11+1, 7+1,11+1, 5+1,10+1,10+1, 0+1,10+1,17+1, 7+1,11+1, - 5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 0+1, 7+1,11+1, - 5+1,10+1,10+1,19+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1, 4+1,10+1, 0+1, 7+1,11+1, - 5+1,10+1,10+1, 4+1,10+1,11+1, 7+1,11+1, 5+1, 6+1,10+1, 4+1,10+1, 0+1, 7+1,11+1 -}; - -static const UINT8 cc_cb[0x100] = { - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,12+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2 -}; - -static const UINT8 cc_ed[0x100] = { - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, -12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2, -12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 9+2, -12+2,12+2,15+2,20+2, 8+2,14+2, 8+2,18+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2,18+2, -12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 8+2,12+2,12+2,15+2,20+2, 8+2,14+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, -16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2,16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2, -16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2,16+2,16+2,16+2,16+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, - 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2 -}; - -static const UINT8 cc_xy[0x100] = { - 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2,15+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2,15+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, - 4+2,14+2,20+2,10+2, 9+2, 9+2, 9+2, 4+2, 4+2,15+2,20+2,10+2, 9+2, 9+2, 9+2, 4+2, - 4+2, 4+2, 4+2, 4+2,23+2,23+2,19+2, 4+2, 4+2,15+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, - 9+2, 9+2, 9+2, 9+2, 9+2, 9+2,19+2, 9+2, 9+2, 9+2, 9+2, 9+2, 9+2, 9+2,19+2, 9+2, -19+2,19+2,19+2,19+2,19+2,19+2, 4+2,19+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, 4+2, 4+2, 4+2, 4+2, 9+2, 9+2,19+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 0+2, 4+2, 4+2, 4+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, - 4+2,14+2, 4+2,23+2, 4+2,15+2, 4+2, 4+2, 4+2, 8+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, - 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2,10+2, 4+2, 4+2, 4+2, 4+2, 4+2, 4+2 -}; - -static const UINT8 cc_xycb[0x100] = { -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, -20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, -20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, -20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2, -23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2 -}; - -/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */ -static const UINT8 cc_ex[0x100] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DJNZ */ - 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NZ/JR Z */ - 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NC/JR C */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0+1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, /* LDIR/CPIR/INIR/OTIR LDDR/CPDR/INDR/OTDR */ - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2+1 -}; - - -DRIVER_INIT_MEMBER(svi318_state, svi318) -{ - /* z80 stuff */ - m_maincpu->z80_set_cycle_tables(cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex); - - m_maincpu->set_input_line_vector(0, 0xff); - - /* memory */ - m_empty_bank = auto_alloc_array(machine(), UINT8, 0x8000); - memset(m_empty_bank, 0xff, 0x8000); - - m_bank_low_ptr = m_empty_bank; - m_bank_high1_ptr = m_empty_bank; - m_bank_high2_ptr = m_empty_bank; -} - -DRIVER_INIT_MEMBER(svi318_state, svi328_806) -{ - DRIVER_INIT_CALL(svi318); - m_svi806_present = 1; -} - -void svi318_state::machine_start() -{ - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - m_bios_rom = memregion("maincpu"); - - // 80 column card start - if (m_svi806_present) - { - // 2K RAM, but allocating 4KB to make banking easier - // The upper 2KB will be set to FFs and will never be written to - m_svi806_ram.resize(0x1000); - save_item(NAME(m_svi806_ram)); - memset(&m_svi806_ram[0], 0x00, 0x800); - memset(&m_svi806_ram[0x800], 0xff, 0x800); - - m_svi806_gfx = memregion("gfx1")->base(); - - // Set SVI-806 80 column card palette - m_palette->set_pen_color(TMS9928A_PALETTE_SIZE, 0, 0, 0); /* Monochrome black */ - m_palette->set_pen_color(TMS9928A_PALETTE_SIZE+1, 0, 224, 0); /* Monochrome green */ - } - - // register for savestates - save_item(NAME(m_drq)); - save_item(NAME(m_irq)); - - save_item(NAME(m_bank_switch)); - save_item(NAME(m_bank_low)); - save_item(NAME(m_bank_high)); - save_item(NAME(m_bank_low_read_only)); - save_item(NAME(m_bank_high1_read_only)); - save_item(NAME(m_bank_high2_read_only)); - save_item(NAME(m_keyboard_row)); - save_item(NAME(m_centronics_busy)); - - save_item(NAME(m_svi806_present)); - save_item(NAME(m_svi806_ram_enabled)); - - machine().save().register_postload(save_prepost_delegate(FUNC(svi318_state::postload), this)); -} - -void svi318_state::machine_reset() -{ - m_keyboard_row = 0; - m_centronics_busy = 0; - m_svi806_present = 0; - m_svi806_ram_enabled = 0; - m_drq = 0; - m_irq = 0; - - m_bank_low = 0; - m_bank_high = 0; - m_bank_low_read_only = 0; - m_bank_high1_read_only = 0; - m_bank_high2_read_only = 0; - - m_bank_switch = 0xff; - set_banks(); -} - -/* Memory */ - -WRITE8_MEMBER(svi318_state::writemem1) -{ - if (m_bank_low_read_only) - return; - - m_bank_low_ptr[offset] = data; -} - -WRITE8_MEMBER(svi318_state::writemem2) -{ - if (m_bank_high1_read_only) - return; - - m_bank_high1_ptr[offset] = data; -} - -WRITE8_MEMBER(svi318_state::writemem3) -{ - if (m_bank_high2_read_only) - return; - - m_bank_high2_ptr[offset] = data; -} - -WRITE8_MEMBER(svi318_state::writemem4) -{ - if (m_svi806_ram_enabled) - { - if (offset < 0x800) - m_svi806_ram[offset] = data; - } - else - { - if (m_bank_high2_read_only) - return; - - m_bank_high2_ptr[0x3000 + offset] = data; - } -} - -void svi318_state::set_banks() -{ - const UINT8 v = m_bank_switch; - UINT8 *ram = m_ram->pointer(); - UINT32 ram_size = m_ram->size(); - - m_bank_low = (v & 1) ? ((v & 2) ? ((v & 8) ? SVI_INTERNAL : SVI_EXPRAM3) : SVI_EXPRAM2) : SVI_CART; - m_bank_high = (v & 4) ? ((v & 16) ? SVI_INTERNAL : SVI_EXPRAM3) : SVI_EXPRAM2; - - m_bank_low_ptr = m_empty_bank; - m_bank_low_read_only = 1; - - switch (m_bank_low) - { - case SVI_INTERNAL: - m_bank_low_ptr = m_bios_rom->base(); - break; - case SVI_CART: - if (m_cart_rom) - m_bank_low_ptr = m_cart_rom->base(); - break; - case SVI_EXPRAM2: - if (ram_size >= 64 * 1024) - { - m_bank_low_ptr = ram + ram_size - 64 * 1024; - m_bank_low_read_only = 0; - } - break; - case SVI_EXPRAM3: - if (ram_size > 128 * 1024) - { - m_bank_low_ptr = ram + ram_size - 128 * 1024; - m_bank_low_read_only = 0; - } - break; - } - - m_bank_high1_ptr = m_empty_bank; - m_bank_high1_read_only = 1; - m_bank_high2_ptr = m_empty_bank; - m_bank_high2_read_only = 1; - - switch (m_bank_high) - { - case SVI_INTERNAL: - if (ram_size == 16 * 1024) - { - m_bank_high2_ptr = ram; - m_bank_high2_read_only = 0; - } - else - { - m_bank_high1_ptr = ram; - m_bank_high1_read_only = 0; - m_bank_high2_ptr = ram + 0x4000; - m_bank_high2_read_only = 0; - } - break; - case SVI_EXPRAM2: - if (ram_size > 64 * 1024) - { - m_bank_high1_ptr = ram + ram_size - 64 * 1024 + 32 * 1024; - m_bank_high1_read_only = 0; - m_bank_high2_ptr = ram + ram_size - 64 * 1024 + 48 * 1024; - m_bank_high2_read_only = 0; - } - break; - case SVI_EXPRAM3: - if (ram_size > 128 * 1024) - { - m_bank_high1_ptr = ram + ram_size - 128 * 1024 + 32 * 1024; - m_bank_high1_read_only = 0; - m_bank_high2_ptr = ram + ram_size - 128 * 1024 + 48 * 1024; - m_bank_high2_read_only = 0; - } - break; - } - - /* Check for special CART based banking */ - if (m_bank_low == SVI_CART && (v & 0xc0 ) != 0xc0) - { - m_bank_high1_ptr = m_empty_bank; - m_bank_high1_read_only = 1; - m_bank_high2_ptr = m_empty_bank; - m_bank_high2_read_only = 1; - - if (m_cart_rom && !(v & 0x80)) - m_bank_high2_ptr = m_cart_rom->base() + 0x4000; - if (m_cart_rom && !(v & 0x40)) - m_bank_high1_ptr = m_cart_rom->base(); - } - - m_bank1->set_base(m_bank_low_ptr); - m_bank2->set_base(m_bank_high1_ptr); - m_bank3->set_base(m_bank_high2_ptr); - - /* SVI-806 80 column card specific banking */ - if (m_svi806_present) - { - if (m_svi806_ram_enabled) - m_bank4->set_base(&m_svi806_ram[0]); - else - m_bank4->set_base(m_bank_high2_ptr + 0x3000); - } -} - -void svi318_state::postload() -{ - set_banks(); -} - - -/* External I/O */ - -WRITE_LINE_MEMBER(svi318_state::write_centronics_busy) -{ - m_centronics_busy = state; -} - -READ8_MEMBER(svi318_state::io_ext_r) -{ - if (m_bank_low == SVI_CART) - return 0xff; - - switch (offset) - { - case 0x12: - return 0xfe | m_centronics_busy; - - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - return m_ins8250_0->ins8250_r(space, offset & 7); - - case 0x28: - case 0x29: - case 0x2a: - case 0x2b: - case 0x2c: - case 0x2d: - case 0x2e: - case 0x2f: - return m_ins8250_1->ins8250_r(space, offset & 7); - - case 0x30: - return m_fd1793->status_r(space, 0); - - case 0x31: - return m_fd1793->track_r(space, 0); - - case 0x32: - return m_fd1793->sector_r(space, 0); - - case 0x33: - return m_fd1793->data_r(space, 0); - - case 0x34: - return fdc_irqdrq_r(space, 0); - - case 0x51: - return m_crtc->register_r(space, offset); - } - - return 0xff; -} - -WRITE8_MEMBER(svi318_state::io_ext_w) -{ - if (m_bank_low == SVI_CART) - return; - - switch (offset) - { - case 0x10: - m_cent_data_out->write(space, 0, data); - break; - - case 0x11: - m_centronics->write_strobe(BIT(data, 0)); - break; - - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - m_ins8250_0->ins8250_w(space, offset & 7, data); - break; - - case 0x28: - case 0x29: - case 0x2A: - case 0x2B: - case 0x2C: - case 0x2D: - case 0x2E: - case 0x2F: - m_ins8250_1->ins8250_w(space, offset & 7, data); - break; - - case 0x30: - m_fd1793->cmd_w(space, 0, data); - break; - case 0x31: - m_fd1793->track_w(space, 0, data); - break; - case 0x32: - m_fd1793->sector_w(space, 0, data); - break; - case 0x33: - m_fd1793->data_w(space, 0, data); - break; - case 0x34: - fdc_drive_motor_w(space, 0, data); - break; - case 0x38: - fdc_density_side_w(space, 0, data); - break; - - case 0x50: - m_crtc->address_w(space, offset, data); - break; - case 0x51: - m_crtc->register_w(space, offset, data); - break; - - case 0x58: - svi806_ram_enable_w(space, 0, data); - break; - } -} diff --git a/src/mess/machine/swim.c b/src/mess/machine/swim.c deleted file mode 100644 index 9e1506ad9ab..00000000000 --- a/src/mess/machine/swim.c +++ /dev/null @@ -1,222 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/********************************************************************* - - swim.c - - Implementation of the Apple SWIM FDC controller; used on (less) - early Macs - -*********************************************************************/ - -#include "machine/swim.h" - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define LOG_SWIM 0 - -enum -{ - SWIM_MODE_IWM, - SWIM_MODE_SWIM, - SWIM_MODE_SWIM2, - SWIM_MODE_SWIM3 -}; - - -/*************************************************************************** - DEVICE -***************************************************************************/ - -const device_type SWIM = &device_creator; - -//------------------------------------------------- -// ctor -//------------------------------------------------- - -swim_device::swim_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : applefdc_base_device(APPLEFDC_SWIM, mconfig, SWIM, "Apple SWIM (Steve Woz Integrated Machine)", tag, owner, clock, "swim", __FILE__) -{ -} - - - -//------------------------------------------------- -// device_start - device-specific start -//------------------------------------------------- - -void swim_device::device_start() -{ - // call inherited version - applefdc_base_device::device_start(); - - m_swim_mode = SWIM_MODE_IWM; - m_swim_magic_state = 0x00; - m_parm_offset = 0x00; - memset(m_ism_regs, 0, sizeof(m_ism_regs)); - memset(m_parms, 0, sizeof(m_parms)); -} - - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void swim_device::device_reset() -{ - // call inherited version - applefdc_base_device::device_reset(); - - static UINT8 swim_default_parms[16] = - { - 0x38, 0x18, 0x41, 0x2e, 0x2e, 0x18, 0x18, 0x1b, - 0x1b, 0x2f, 0x2f, 0x19, 0x19, 0x97, 0x1b, 0x57 - }; - - for (int i = 0; i < 16; i++) - { - m_parms[i] = swim_default_parms[i]; - } - - m_swim_magic_state = 0; - m_swim_mode = SWIM_MODE_IWM; - m_parm_offset = 0; -} - - - -//------------------------------------------------- -// read - reads a byte from the FDC -//------------------------------------------------- - -UINT8 swim_device::read(UINT8 offset) -{ - UINT8 result = 0; - - if (m_swim_mode == SWIM_MODE_IWM) - { - // IWM mode - result = applefdc_base_device::read(offset); - } - else if (m_swim_mode >= SWIM_MODE_SWIM) - { - // reading parameter RAM? - if ((offset & 7) == 3) - { - result = m_parms[m_parm_offset++]; - m_parm_offset &= 0xf; - } - else - { - result = m_ism_regs[offset&7]; - } - - if (LOG_SWIM) - logerror("SWIM: read %02x from offset %x\n", result, offset & 7); - } - return result; -} - - - -//------------------------------------------------- -// write - write a byte to the FDC -//------------------------------------------------- - -void swim_device::write(UINT8 offset, UINT8 data) -{ - if (m_swim_mode == SWIM_MODE_IWM) - { - // IWM mode - applefdc_base_device::write(offset, data); - } - else if (m_swim_mode >= SWIM_MODE_SWIM) - { - if (LOG_SWIM) - logerror("SWIM: write %02x to offset %x\n", data, offset & 7); - - switch (offset & 7) - { - case 2: // write CRC - break; - - case 3: // write parameter - m_parms[m_parm_offset++] = data; - m_parm_offset &= 0xf; - break; - - case 6: // write zeros to status (also zeroes parameter RAM pointer) - m_ism_regs[6] &= ~data; - m_parm_offset = 0; - - if (data == 0xf8) // magic "revert to IWM" value - { - if (LOG_SWIM) - logerror("SWIM: reverting to IWM\n"); - m_swim_mode = SWIM_MODE_IWM; - } - break; - - case 7: // write ones to status - m_ism_regs[6] |= data; - break; - - default: - m_ism_regs[offset & 7] = data; - break; - - } - } -} - - - -//------------------------------------------------- -// iwm_modereg_w - changes the mode register -//------------------------------------------------- - -void swim_device::iwm_modereg_w(UINT8 data) -{ - // SWIM mode is unlocked by writing 1/0/1/1 in a row to bit 6 (which is unused on IWM) - // when SWIM mode engages, the IWM is disconnected from both the 68k and the drives, - // and the ISM is substituted. - - switch (m_swim_magic_state) - { - case 0: - case 2: - case 3: - if (data & 0x40) - { - m_swim_magic_state++; - } - else - { - m_swim_magic_state = 0; - } - break; - case 1: - if (!(data & 0x40)) - { - m_swim_magic_state++; - } - else - { - m_swim_magic_state = 0; - } - break; - } - - if (m_swim_magic_state == 4) - { - m_swim_magic_state = 0; - m_swim_mode = SWIM_MODE_SWIM; - } - - // call inherited version - applefdc_base_device::iwm_modereg_w(data); -} diff --git a/src/mess/machine/swim.h b/src/mess/machine/swim.h deleted file mode 100644 index 752f5404f47..00000000000 --- a/src/mess/machine/swim.h +++ /dev/null @@ -1,63 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/********************************************************************* - - swim.h - - Implementation of the Apple SWIM FDC controller; used on (less) - early Macs - -*********************************************************************/ - -#ifndef __SWIM_H__ -#define __SWIM_H__ - -#include "machine/applefdc.h" - - -/*************************************************************************** - DEVICE -***************************************************************************/ - -extern const device_type SWIM; - -class swim_device : public applefdc_base_device -{ -public: - swim_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // read/write - virtual UINT8 read(UINT8 offset); - virtual void write(UINT8 offset, UINT8 data); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // other overrides - virtual void iwm_modereg_w(UINT8 data); - -private: - UINT8 m_swim_mode; - UINT8 m_swim_magic_state; - UINT8 m_parm_offset; - UINT8 m_ism_regs[8]; - UINT8 m_parms[16]; -}; - - - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_SWIM_ADD(_tag, _intrf) \ - MCFG_DEVICE_ADD(_tag, SWIM, 0) \ - MCFG_DEVICE_CONFIG(_intrf) - -#define MCFG_SWIM_MODIFY(_tag, _intrf) \ - MCFG_DEVICE_MODIFY(_tag) \ - MCFG_DEVICE_CONFIG(_intrf) - -#endif // __SWIM_H__ diff --git a/src/mess/machine/swtpc09.c b/src/mess/machine/swtpc09.c deleted file mode 100644 index 29bae501462..00000000000 --- a/src/mess/machine/swtpc09.c +++ /dev/null @@ -1,859 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robert Justice -/*************************************************************************** - swtpc09 machine file - Robert Justice ,2009-2014 - -****************************************************************************/ - -#include "emu.h" -#include "includes/swtpc09.h" - -#define DMAC_IRQ 0x01 // interrupt handler IDs -#define ACIA_IRQ 0x02 -#define PTM_IRQ 0x04 -#define PIA_IRQ 0x08 -#define FDC_IRQ 0x10 -#define VIA_IRQ 0x20 - -#define FLEX_DMF2 1 // system type flags -#define UNIFLEX_DMF2 2 -#define UNIFLEX_DMF3 3 -#define FLEX_DC4_PIAIDE 4 - -#define VERBOSE 0 - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - - -/******* MC6840 PTM on MPID Board *******/ - -/* 6840 PTM handlers */ -WRITE8_MEMBER( swtpc09_state::ptm_o1_callback ) -{ - pia6821_device *pia = machine().device("pia"); - - m_pia_counter++; - //pia_counter = pia_counter && 0xff; - if (m_pia_counter & 0x80) pia->ca1_w(1); -} - -WRITE8_MEMBER( swtpc09_state::ptm_o3_callback ) -{ - //ptm6840_device *ptm = machine().device("ptm"); - /* the output from timer3 is the input clock for timer2 */ - //m_ptm->set_c2(data); -} - -WRITE_LINE_MEMBER( swtpc09_state::ptm_irq ) -{ - if (state) - swtpc09_irq_handler(PTM_IRQ, ASSERT_LINE); - else - swtpc09_irq_handler(PTM_IRQ, CLEAR_LINE); -} - -/******* MC6821 PIA on MPID Board *******/ -/* Read/Write handlers for pia */ - -READ8_MEMBER( swtpc09_state::pia0_a_r ) -{ - return m_pia_counter; -} - -READ8_MEMBER( swtpc09_state::pia0_ca1_r ) -{ - return 0; -} - -WRITE_LINE_MEMBER( swtpc09_state::pia0_irq_a ) -{ - pia6821_device *pia = machine().device("pia"); - - if ( pia->irq_a_state()) - swtpc09_irq_handler(PIA_IRQ, ASSERT_LINE); - else - swtpc09_irq_handler(PIA_IRQ, CLEAR_LINE); - -} - - -/******* MC6850 ACIA on MPS2 *******/ - -WRITE_LINE_MEMBER( swtpc09_state::acia_interrupt ) -{ - if (state) - { - swtpc09_irq_handler(ACIA_IRQ, ASSERT_LINE); - LOG(("swtpc09_acia_irq_assert\n")); - } - else - { - swtpc09_irq_handler(ACIA_IRQ, CLEAR_LINE); - LOG(("swtpc09_acia_irq_clear\n")); - } -} - -/*********************************************************************/ -/* DMF2 Floppy Controller Board */ -/*********************************************************************/ - -/* DMF2 dma extended address register */ -READ8_MEMBER ( swtpc09_state::dmf2_dma_address_reg_r ) -{ - return m_fdc_dma_address_reg; -} - -WRITE8_MEMBER ( swtpc09_state::dmf2_dma_address_reg_w ) -{ - m_fdc_dma_address_reg = data; - - // bit 4 controls a gate enable/disable for DMF2 fdc irq line - if ((m_fdc_dma_address_reg & 0x10) && (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2)) - swtpc09_irq_handler(FDC_IRQ, CLEAR_LINE); //then clear the irq to cpu - - LOG(("swtpc09_dmf2_dma_address_reg_w %02X\n", data)); -} - -/* DMF2 fdc control register */ -READ8_MEMBER ( swtpc09_state::dmf2_control_reg_r ) -{ - //LOG(("swtpc09_dmf2_control_reg_r $%02X\n", m_fdc_status)); - return m_fdc_status; -} - -WRITE8_MEMBER ( swtpc09_state::dmf2_control_reg_w ) -{ - LOG(("swtpc09_dmf2_control_reg_w $%02X\n", data)); - - floppy_image_device *floppy = NULL; - - if (!BIT(data, 0)) floppy = m_floppy0->get_device(); - if (!BIT(data, 1)) floppy = m_floppy1->get_device(); - if (!BIT(data, 2)) floppy = m_floppy2->get_device(); - if (!BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(!BIT(data, 4)); - } - - m_fdc->dden_w(!BIT(data, 5)); -} - -/* FDC controller dma transfer */ -void swtpc09_state::swtpc09_fdc_dma_transfer() -{ - UINT8 *RAM = memregion("maincpu")->base(); - UINT32 offset; - address_space &space = m_maincpu->space(AS_PROGRAM); - - offset = (m_fdc_dma_address_reg & 0x0f)<<16; - - if (m_m6844_channel[0].active == 1) //active dma transfer - { - if (!(m_m6844_channel[0].control & 0x01)) // dma write to memory - { - UINT8 data = m_fdc->data_r(space, 0); - - LOG(("swtpc09_dma_write_mem %05X %02X\n", m_m6844_channel[0].address + offset, data)); - RAM[m_m6844_channel[0].address + offset] = data; - } - else - { - UINT8 data = RAM[m_m6844_channel[0].address + offset]; - - m_fdc->data_w(space, 0, data); - //LOG(("swtpc09_dma_read_mem %04X %02X\n", m_m6844_channel[0].address, data)); - } - - m_m6844_channel[0].address++; - m_m6844_channel[0].counter--; - - if (m_m6844_channel[0].counter == 0) // dma transfer has finished - { - m_m6844_channel[0].control |= 0x80; // set dend flag - if (m_m6844_interrupt & 0x01) // interrupt for channel 0 is enabled? - { - m_m6844_interrupt |= 0x80; // set bit 7 to indicate active interrupt - swtpc09_irq_handler(DMAC_IRQ, ASSERT_LINE); - } - } - } - -} - -/* common interrupt handler */ -void swtpc09_state::swtpc09_irq_handler(UINT8 peripheral, UINT8 state) -{ - LOG(("swtpc09_irq_handler peripheral:%02X state:%02X\n", peripheral, state)); - - switch (state) - { - case ASSERT_LINE: - m_interrupt |= peripheral; - break; - - case CLEAR_LINE: - m_interrupt &= (~peripheral & 0x3f); - break; - } - - if (!m_active_interrupt && m_interrupt) //no active interrupt and it needs to be asserted - { - m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); - m_active_interrupt=TRUE; - LOG(("swtpc09_irq_assert %02X\n", peripheral)); - } - else if (m_active_interrupt && !m_interrupt) //active interrupt and it needs to be cleared - { - m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); - LOG(("swtpc09_irq_clear %02X\n", peripheral)); - m_active_interrupt=FALSE; - } -} - -/* handlers for fdc */ -WRITE_LINE_MEMBER( swtpc09_state::fdc_intrq_w ) -{ - LOG(("swtpc09_fdc_intrq_w %02X\n", state)); - if ( m_system_type == UNIFLEX_DMF3 ) //IRQ from 1791 is connect into VIA ca2 - { - if (state) - { - m_fdc_status |= 0x40; - m_via->write_cb2(0); //fdc interrupt is connected to CA1 - m_dmf3_via_porta &= 0xfb; //clear pa3 - //m_via->write_porta(m_dmf3_via_porta); //and connected to PA3 - //swtpc09_irq_handler(FDC_IRQ, ASSERT_LINE); - } - else - { - m_fdc_status &= ~0x40; - m_via->write_cb2(1); - m_dmf3_via_porta |= 0x04; //and connected to PA3 - //m_via->write_porta(m_dmf3_via_porta); //and connected to PA3 - //swtpc09_irq_handler(FDC_IRQ, CLEAR_LINE); - } - } - else if ( m_system_type == FLEX_DC4_PIAIDE ) //for dc4 emulate irq jumper out - { - if (state) - { - m_fdc_status |= 0x40; - } - else - { - m_fdc_status &= ~0x40; - } - } - else //for dmf2 it is connected directly to cpu via a gate - { - if (state) - { - m_fdc_status |= 0x40; - if (!(m_fdc_dma_address_reg & 0x10)) // is dmf2 fdc irq enabled - { - LOG(("swtpc09_fdc_int ** assert\n")); - swtpc09_irq_handler(FDC_IRQ, ASSERT_LINE); - } - } - else - { - m_fdc_status &= ~0x40; - if (!(m_fdc_dma_address_reg & 0x10)) // is dmf2 fdc irq enabled - { - LOG(("swtpc09_fdc_int ** clear\n")); - swtpc09_irq_handler(FDC_IRQ, CLEAR_LINE); - } - } - } -} - -WRITE_LINE_MEMBER( swtpc09_state::fdc_drq_w ) -{ - if (m_system_type == FLEX_DC4_PIAIDE) //for dc4 no dma - { - if (state) - { - m_fdc_status |= 0x80; - } - else - m_fdc_status &= 0x7f; - } - else - { - if (state) - { - m_fdc_status |= 0x80; - swtpc09_fdc_dma_transfer(); - } - else - m_fdc_status &= 0x7f; - } -} - -/*********************************************************************/ -/* DMF3 Board */ -/*********************************************************************/ - -/* via on dmf3 board */ -READ8_MEMBER( swtpc09_state::dmf3_via_read_porta ) -{ - return m_dmf3_via_porta; -} - -READ8_MEMBER( swtpc09_state::dmf3_via_read_portb ) -{ - return 0xff; -} - -WRITE8_MEMBER( swtpc09_state::dmf3_via_write_porta ) -{ - m_dmf3_via_porta &= data; -} - -//WRITE_LINE_MEMBER( swtpc09_state::dmf3_via_write_ca1 ) -//{ -// return m_via_ca1_input; -// LOG(("swtpc09_dmf3_via_write_ca1 %02X\n", state)); - -//} - -WRITE_LINE_MEMBER( swtpc09_state::dmf3_via_irq ) -{ - if (state) - swtpc09_irq_handler(VIA_IRQ, ASSERT_LINE); - else - swtpc09_irq_handler(VIA_IRQ, CLEAR_LINE); -} - -/* DMF3 dma extended address register */ -READ8_MEMBER ( swtpc09_state::dmf3_dma_address_reg_r ) -{ - return m_fdc_dma_address_reg; -} - -WRITE8_MEMBER ( swtpc09_state::dmf3_dma_address_reg_w ) -{ - m_fdc_dma_address_reg = data; - LOG(("swtpc09_dmf3_dma_address_reg_w %02X\n", data)); -} - -/* DMF3 fdc control register */ -READ8_MEMBER ( swtpc09_state::dmf3_control_reg_r ) -{ - //LOG(("swtpc09_dmf3_control_reg_r $%02X\n", m_fdc_status)); - return m_fdc_status; -} - -WRITE8_MEMBER ( swtpc09_state::dmf3_control_reg_w ) -{ - LOG(("swtpc09_dmf3_control_reg_w $%02X\n", data)); - - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - if (BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(BIT(data, 4)); - } - - m_fdc->dden_w(BIT(data, 5)); -} - -// DC4 drive select - -WRITE8_MEMBER ( swtpc09_state::dc4_control_reg_w ) -{ - LOG(("swtpc09_dc4_control_reg_w $%02X\n", data)); - - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - if (BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); -} - - -/******* MC6821 PIA on IDE Board *******/ -/* Read/Write handlers for pia ide */ -/* TODO: update and finish this off */ - -READ8_MEMBER( swtpc09_state::piaide_a_r ) -{ - return m_piaide_porta; -} - -READ8_MEMBER( swtpc09_state::piaide_b_r ) -{ - return m_piaide_portb; -} - -WRITE8_MEMBER( swtpc09_state::piaide_a_w ) -{ - m_piaide_porta = data; -} - -WRITE8_MEMBER( swtpc09_state::piaide_b_w ) -{ - int tempidedata; - - m_piaide_portb = data; - - if ((data & 0x40)&&(!(data&0x20))) //cs0=0 cs1=1 bit 5&6 - { - if (!(data & 0x02)) //rd line bit 1 - { - tempidedata = m_ide->read_cs0(space, (data&0x1c)>>2, 0xffff); - LOG(("swtpc09_ide_bus_r: offset $%02X data %04X\n", (data&0x1c)>>2, tempidedata)); - m_piaide_porta = tempidedata & 0x00ff; - } - else if (!(data & 0x01)) //wr line bit 0 - { - m_ide->write_cs0(space, (data&0x1c)>>2, m_piaide_porta, 0xffff); - LOG(("swtpc09_ide_bus_w: offset $%02X data %04X\n", (data&0x1c)>>2, m_piaide_porta)); - } - } - else if ((data & 0x20)&&(!(data&0x40))) //cs0=1 cs1=0 bit 5&6 - { - if (!(data & 0x02)) //rd line bit 1 - { - tempidedata = m_ide->read_cs1(space, (data&0x1c)>>2, 0xffff); - LOG(("swtpc09_ide_bus_r: offset $%02X data %04X\n", (data&0x1c)>>2, tempidedata)); - m_piaide_porta = tempidedata & 0x00ff; - } - else if (!(data & 0x01)) //wr line bit 0 - { - m_ide->write_cs1(space, (data&0x1c)>>2, m_piaide_porta, 0xffff); - LOG(("swtpc09_ide_bus_w: offset $%02X data %04X\n", (data&0x1c)>>2, m_piaide_porta)); - } - } -} - - -/* DAT ram write handler (Dynamic Address Translator) */ -/* This creates the address map when a page is mapped in */ -/* memory map is created based on system_type flag */ -/* this is accommodate the different cards installed */ - -WRITE8_MEMBER(swtpc09_state::dat_w) -{ - UINT8 a16_to_a19, a12_to_a15; - UINT8 *RAM = memregion("maincpu")->base(); - UINT32 physical_address, logical_address; - - address_space &mem = m_maincpu->space(AS_PROGRAM); - - fd1793_t *fdc = machine().device("fdc"); - pia6821_device *pia = machine().device("pia"); - ptm6840_device *ptm = machine().device("ptm"); - acia6850_device *acia = machine().device("acia"); - via6522_device *via = machine().device("via"); - pia6821_device *piaide = machine().device("piaide"); - - a16_to_a19 = data & 0xf0; - a12_to_a15 = ~data & 0x0f; //lower 4 bits are inverted - physical_address = ((a16_to_a19 + a12_to_a15) << 12); - logical_address = offset << 12; - LOG(("swtpc09_dat_bank_unmap Logical address:%04X\n", offset << 12 )); - LOG(("swtpc09_dat_bank_set dat:%02X Logical address:%04X Physical address:%05X\n", data, offset << 12, physical_address )); - - - // unmap page to be changed - mem.unmap_readwrite(offset << 12, (offset << 12)+0x0fff); - - // map in new page - if (a12_to_a15 == 0x0e) // 0xE000 address range to be mapped in at this page - { - if (m_system_type == FLEX_DMF2) // if flex/sbug, map in acia at 0xE004 - { - mem.nop_readwrite(logical_address+0x000, logical_address+0x003); - mem.install_readwrite_handler(logical_address+0x004, logical_address+0x004, read8_delegate(FUNC(acia6850_device::status_r), acia), write8_delegate(FUNC(acia6850_device::control_w),acia)); - mem.install_readwrite_handler(logical_address+0x005, logical_address+0x005, read8_delegate(FUNC(acia6850_device::data_r), acia), write8_delegate(FUNC(acia6850_device::data_w),acia)); - mem.nop_readwrite(logical_address+0x006, logical_address+0x07f); - mem.install_readwrite_handler(logical_address+0x080, logical_address+0x08f, read8_delegate(FUNC(pia6821_device::read), pia), write8_delegate(FUNC(pia6821_device::write), pia)); - mem.install_readwrite_handler(logical_address+0x090, logical_address+0x09f, read8_delegate(FUNC(ptm6840_device::read), ptm), write8_delegate(FUNC(ptm6840_device::write), ptm)); - mem.nop_readwrite(logical_address+0x0a0, logical_address+0xfff); - } - else if (m_system_type == FLEX_DC4_PIAIDE) // if flex/sbug and dc4 and piaide - { - mem.nop_readwrite(logical_address+0x000, logical_address+0x003); - mem.install_readwrite_handler(logical_address+0x004, logical_address+0x004, read8_delegate(FUNC(acia6850_device::status_r), acia), write8_delegate(FUNC(acia6850_device::control_w),acia)); - mem.install_readwrite_handler(logical_address+0x005, logical_address+0x005, read8_delegate(FUNC(acia6850_device::data_r), acia), write8_delegate(FUNC(acia6850_device::data_w),acia)); - mem.install_write_handler(logical_address+0x014, logical_address+0x014, write8_delegate(FUNC(swtpc09_state::dc4_control_reg_w),this)); - mem.install_readwrite_handler(logical_address+0x018, logical_address+0x01b, read8_delegate(FUNC(fd1793_t::read), fdc), write8_delegate(FUNC(fd1793_t::write),fdc)); - //mem.nop_readwrite(logical_address+0x01c, logical_address+0x05f); - mem.install_readwrite_handler(logical_address+0x060, logical_address+0x06f, read8_delegate(FUNC(pia6821_device::read), piaide), write8_delegate(FUNC(pia6821_device::write), piaide)); - //mem.nop_readwrite(logical_address+0x070, logical_address+0x07f); - mem.install_readwrite_handler(logical_address+0x080, logical_address+0x08f, read8_delegate(FUNC(pia6821_device::read), pia), write8_delegate(FUNC(pia6821_device::write), pia)); - mem.install_readwrite_handler(logical_address+0x090, logical_address+0x09f, read8_delegate(FUNC(ptm6840_device::read), ptm), write8_delegate(FUNC(ptm6840_device::write), ptm)); - //mem.nop_readwrite(logical_address+0x0a0, logical_address+0x7ff); - mem.install_rom(logical_address+0x800, logical_address+0xfff, &RAM[0xe800]); //piaide rom - } - else // assume unibug, map in acia at 0xE000 - { - mem.install_readwrite_handler(logical_address+0x000, logical_address+0x000, read8_delegate(FUNC(acia6850_device::status_r), acia), write8_delegate(FUNC(acia6850_device::control_w), acia)); - mem.install_readwrite_handler(logical_address+0x001, logical_address+0x001, read8_delegate(FUNC(acia6850_device::data_r), acia), write8_delegate(FUNC(acia6850_device::data_w), acia)); - mem.nop_readwrite(logical_address+0x002, logical_address+0x07f); - mem.install_readwrite_handler(logical_address+0x080, logical_address+0x08f, read8_delegate(FUNC(pia6821_device::read), pia), write8_delegate(FUNC(pia6821_device::write), pia)); - mem.install_readwrite_handler(logical_address+0x090, logical_address+0x09f, read8_delegate(FUNC(ptm6840_device::read), ptm), write8_delegate(FUNC(ptm6840_device::write), ptm)); - mem.nop_readwrite(logical_address+0x0a0, logical_address+0xfff); - } - } - else if (a12_to_a15 == 0x0f) // 0xF000 address range to be mapped in at this page - { - if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2) // if DMF2 conroller this is the map - { - mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this)); - mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_t::read), fdc), write8_delegate(FUNC(fd1793_t::write),fdc)); - mem.install_readwrite_handler(logical_address+0x024, logical_address+0x03f, read8_delegate(FUNC(swtpc09_state::dmf2_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_control_reg_w),this)); - mem.install_readwrite_handler(logical_address+0x040, logical_address+0x041, read8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_w),this)); - //mem.nop_readwrite(logical_address+0x042, logical_address+0x7ff); - mem.install_rom(logical_address+0x800, logical_address+0xfff, &RAM[0xf800]); - mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this)); - } - else if (m_system_type == FLEX_DC4_PIAIDE) // 2k ram for piaide on s09 board - { - //mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this)); - //mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_t::read), fdc), write8_delegate(FUNC(fd1793_t::write),fdc)); - //mem.install_readwrite_handler(logical_address+0x024, logical_address+0x03f, read8_delegate(FUNC(swtpc09_state::dmf2_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_control_reg_w),this)); - //mem.install_readwrite_handler(logical_address+0x040, logical_address+0x041, read8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf2_dma_address_reg_w),this)); - mem.install_ram(logical_address+0x000, logical_address+0x7ff, &RAM[0xf000]); - mem.install_rom(logical_address+0x800, logical_address+0xfff, &RAM[0xf800]); - mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this)); - } - else // assume DMF3 controller - { - mem.install_readwrite_handler(logical_address+0x000, logical_address+0x01f, read8_delegate(FUNC(swtpc09_state::m6844_r),this), write8_delegate(FUNC(swtpc09_state::m6844_w),this)); - mem.install_readwrite_handler(logical_address+0x020, logical_address+0x023, read8_delegate(FUNC(fd1793_t::read), fdc), write8_delegate(FUNC(fd1793_t::write),fdc)); - mem.install_readwrite_handler(logical_address+0x024, logical_address+0x024, read8_delegate(FUNC(swtpc09_state::dmf3_control_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf3_control_reg_w),this)); - mem.install_readwrite_handler(logical_address+0x025, logical_address+0x025, read8_delegate(FUNC(swtpc09_state::dmf3_dma_address_reg_r),this), write8_delegate(FUNC(swtpc09_state::dmf3_dma_address_reg_w),this)); - //mem.nop_readwrite(logical_address+0x030, logical_address+0x03f); - mem.install_readwrite_handler(logical_address+0x040, logical_address+0x04f, read8_delegate(FUNC(via6522_device::read), via), write8_delegate(FUNC(via6522_device::write), via)); - //mem.nop_readwrite(logical_address+0x050, logical_address+0x7ff); - mem.install_rom(logical_address+0x800, logical_address+0xfff, &RAM[0xf800]); - mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this)); - } - } - else if (offset==0x0f) // then we need to leave in top part of ram and dat write - { - mem.install_ram(logical_address, logical_address+0x0eff, 0, 0, &RAM[physical_address]); - mem.install_rom(logical_address+0xf00, logical_address+0xfff, 0, 0, &RAM[0xff00]); - mem.install_write_handler(logical_address+0xff0, logical_address+0xfff, write8_delegate(FUNC(swtpc09_state::dat_w),this)); - - } - else // all the rest is treated as ram, 1MB ram emulated - { - mem.install_ram(logical_address, logical_address+0x0fff, &RAM[physical_address]); - } - -// unused code to limit to 256k ram -// else if (!(a12_to_a15 & 0x0c) ) // limit ram to 256k || a12_to_a15 == 0x02 -// { -// memory_install_ram(space, logical_address, logical_address+0x0fff, 0, 0, &RAM[physical_address]); -// } -// -// else // all the rest is treated as unallocated -// { -// memory_nop_readwrite(space, logical_address, logical_address+0x0fff, 0, 0); -// } - -} - -/* MC6844 DMA controller I/O */ - -READ8_MEMBER( swtpc09_state::m6844_r ) -{ - UINT8 result = 0; - - - /* switch off the offset we were given */ - switch (offset) - { - /* upper byte of address */ - case 0x00: - case 0x04: - case 0x08: - case 0x0c: - result = m_m6844_channel[offset / 4].address >> 8; - break; - - /* lower byte of address */ - case 0x01: - case 0x05: - case 0x09: - case 0x0d: - result = m_m6844_channel[offset / 4].address & 0xff; - break; - - /* upper byte of counter */ - case 0x02: - case 0x06: - case 0x0a: - case 0x0e: - result = m_m6844_channel[offset / 4].counter >> 8; - break; - - /* lower byte of counter */ - case 0x03: - case 0x07: - case 0x0b: - case 0x0f: - result = m_m6844_channel[offset / 4].counter & 0xff; - break; - - /* channel control */ - case 0x10: - case 0x11: - case 0x12: - case 0x13: - result = m_m6844_channel[offset - 0x10].control; - - /* a read here clears the DMA end flag */ - m_m6844_channel[offset - 0x10].control &= ~0x80; - if (m_m6844_interrupt & 0x80) // if interrupt is active, then clear - { - swtpc09_irq_handler(0x01, CLEAR_LINE); - m_m6844_interrupt &= 0x7f; // clear interrupt indication bit 7 - LOG(("swtpc09_6844_r interrupt cleared \n")); - } - break; - - /* priority control */ - case 0x14: - result = m_m6844_priority; - break; - - /* interrupt control */ - case 0x15: - result = m_m6844_interrupt; - break; - - /* chaining control */ - case 0x16: - result = m_m6844_chain; - break; - - /* 0x17-0x1f not used */ - default: break; - } - //LOG(("swtpc09_6844_r %02X %02X\n", offset, result & 0xff)); - - if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2) // if DMF2 controller data bus is inverted to 6844 - { - return ~result & 0xff; - } - else - { - return result & 0xff; - } -} - - -WRITE8_MEMBER( swtpc09_state::m6844_w ) -{ - int i; - - if (m_system_type == UNIFLEX_DMF2 || m_system_type == FLEX_DMF2) // if DMF2 controller data bus is inverted to 6844 - data = ~data & 0xff; - - LOG(("swtpc09_6844_w %02X %02X\n", offset, data)); - /* switch off the offset we were given */ - switch (offset) - { - /* upper byte of address */ - case 0x00: - case 0x04: - case 0x08: - case 0x0c: - m_m6844_channel[offset / 4].address = (m_m6844_channel[offset / 4].address & 0xff) | (data << 8); - break; - - /* lower byte of address */ - case 0x01: - case 0x05: - case 0x09: - case 0x0d: - m_m6844_channel[offset / 4].address = (m_m6844_channel[offset / 4].address & 0xff00) | (data & 0xff); - break; - - /* upper byte of counter */ - case 0x02: - case 0x06: - case 0x0a: - case 0x0e: - m_m6844_channel[offset / 4].counter = (m_m6844_channel[offset / 4].counter & 0xff) | (data << 8); - break; - - /* lower byte of counter */ - case 0x03: - case 0x07: - case 0x0b: - case 0x0f: - m_m6844_channel[offset / 4].counter = (m_m6844_channel[offset / 4].counter & 0xff00) | (data & 0xff); - break; - - /* channel control */ - case 0x10: - case 0x11: - case 0x12: - case 0x13: - m_m6844_channel[offset - 0x10].control = (m_m6844_channel[offset - 0x10].control & 0xc0) | (data & 0x3f); - break; - - /* priority control */ - case 0x14: - m_m6844_priority = data; - - /* update each channel */ - for (i = 0; i < 4; i++) - { - /* if we're going active... */ - if (!m_m6844_channel[i].active && (data & (1 << i))) - { - /* mark us active */ - m_m6844_channel[i].active = 1; - LOG(("swtpc09_dma_channel active %02X\n", i)); - - /* set the DMA busy bit and clear the DMA end bit */ - m_m6844_channel[i].control |= 0x40; - m_m6844_channel[i].control &= ~0x80; - - /* set the starting address, counter, and time */ - m_m6844_channel[i].start_address = m_m6844_channel[i].address; - m_m6844_channel[i].start_counter = m_m6844_channel[i].counter; - - - /* generate and play the sample */ - //play_cvsd(space->machine, i); - } - - /* if we're going inactive... */ - else if (m_m6844_channel[i].active && !(data & (1 << i))) - { - /* mark us inactive */ - m_m6844_channel[i].active = 0; - } - } - break; - - /* interrupt control */ - case 0x15: - m_m6844_interrupt = (m_m6844_interrupt & 0x80) | (data & 0x7f); - LOG(("swtpc09_m_m6844_interrupt_w %02X\n", m_m6844_interrupt)); - break; - - /* chaining control */ - case 0x16: - m_m6844_chain = data; - break; - - /* 0x17-0x1f not used */ - default: break; - } -} - - -DRIVER_INIT_MEMBER( swtpc09_state, swtpc09 ) -{ - int i; - m_pia_counter = 0; // init ptm/pia counter to 0 - m_term_data = 0; // terminal keyboard input - m_fdc_status = 0; // for floppy controller - m_system_type = FLEX_DMF2; - m_interrupt = 0; - m_active_interrupt = FALSE; - - /* reset the 6844 */ - for (i = 0; i < 4; i++) - { - m_m6844_channel[i].active = 0; - m_m6844_channel[i].control = 0x00; - } - m_m6844_priority = 0x00; - m_m6844_interrupt = 0x00; - m_m6844_chain = 0x00; - -} - -DRIVER_INIT_MEMBER( swtpc09_state, swtpc09i ) -{ - int i; - m_pia_counter = 0; // init ptm/pia counter to 0 - m_term_data = 0; // terminal keyboard input - m_fdc_status = 0; // for floppy controller - m_system_type = FLEX_DC4_PIAIDE; - m_interrupt = 0; - m_active_interrupt = FALSE; - - /* reset the 6844 */ - for (i = 0; i < 4; i++) - { - m_m6844_channel[i].active = 0; - m_m6844_channel[i].control = 0x00; - } - m_m6844_priority = 0x00; - m_m6844_interrupt = 0x00; - m_m6844_chain = 0x00; - -} - -DRIVER_INIT_MEMBER( swtpc09_state, swtpc09u ) -{ - int i; - m_pia_counter = 0; //init ptm/pia counter to 0 - m_term_data = 0; //terminal keyboard input - m_fdc_status = 0; // for floppy controller - m_system_type = UNIFLEX_DMF2; - m_interrupt = 0; - m_active_interrupt = FALSE; - - /* reset the 6844 */ - for (i = 0; i < 4; i++) - { - m_m6844_channel[i].active = 0; - m_m6844_channel[i].control = 0x00; - } - m_m6844_priority = 0x00; - m_m6844_interrupt = 0x00; - m_m6844_chain = 0x00; - -} - -DRIVER_INIT_MEMBER( swtpc09_state, swtpc09d3 ) -{ - int i; - m_pia_counter = 0; //init ptm/pia counter to 0 - m_term_data = 0; //terminal keyboard input - m_fdc_status = 0; // for floppy controller - m_via_ca1_input = 0; - m_system_type = UNIFLEX_DMF3; - m_interrupt = 0; - m_active_interrupt = FALSE; - - - /* reset the 6844 */ - for (i = 0; i < 4; i++) - { - m_m6844_channel[i].active = 0; - m_m6844_channel[i].control = 0x00; - } - m_m6844_priority = 0x00; - m_m6844_interrupt = 0x00; - m_m6844_chain = 0x00; - -} diff --git a/src/mess/machine/tandy2kb.c b/src/mess/machine/tandy2kb.c deleted file mode 100644 index b6c7dd18db3..00000000000 --- a/src/mess/machine/tandy2kb.c +++ /dev/null @@ -1,432 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Tandy 2000 keyboard emulation - -*********************************************************************/ - -#include "tandy2kb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8048_TAG "m1" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type TANDY2K_KEYBOARD = &device_creator; - - - -//------------------------------------------------- -// ROM( tandy2k_keyboard ) -//------------------------------------------------- - -ROM_START( tandy2k_keyboard ) - ROM_REGION( 0x400, I8048_TAG, 0 ) - ROM_LOAD( "keyboard.m1", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *tandy2k_keyboard_device::device_rom_region() const -{ - return ROM_NAME( tandy2k_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( kb_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( tandy2k_keyboard_io, AS_IO, 8, tandy2k_keyboard_device ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kb_p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(kb_p1_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// MACHINE_DRIVER( tandy2k_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( tandy2k_keyboard ) - MCFG_CPU_ADD(I8048_TAG, I8048, 1000000) // ? - MCFG_CPU_IO_MAP(tandy2k_keyboard_io) - MCFG_DEVICE_DISABLE() // TODO -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor tandy2k_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( tandy2k_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( tandy2k_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( tandy2k_keyboard ) - PORT_START("Y0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y2") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y6") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y9") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y10") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("Y11") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor tandy2k_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( tandy2k_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// tandy2k_keyboard_device - constructor -//------------------------------------------------- - -tandy2k_keyboard_device::tandy2k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, TANDY2K_KEYBOARD, "Tandy 2000 Keyboard", tag, owner, clock, "tandy2kb", __FILE__), - m_maincpu(*this, I8048_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_y11(*this, "Y11"), - m_write_clock(*this), - m_write_data(*this), - m_keylatch(0xffff), - m_clock(0), - m_data(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void tandy2k_keyboard_device::device_start() -{ - // resolve callbacks - m_write_clock.resolve_safe(); - m_write_data.resolve_safe(); - - // state saving - save_item(NAME(m_keylatch)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void tandy2k_keyboard_device::device_reset() -{ -} - - -//------------------------------------------------- -// power_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( tandy2k_keyboard_device::power_w ) -{ - // TODO -} - - -//------------------------------------------------- -// reset_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( tandy2k_keyboard_device::reset_w ) -{ - if (!state) - { - device_reset(); - } -} - - -//------------------------------------------------- -// busy_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( tandy2k_keyboard_device::busy_w ) -{ - m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); -} - - -//------------------------------------------------- -// data_r - -//------------------------------------------------- - -READ_LINE_MEMBER( tandy2k_keyboard_device::data_r ) -{ - return m_data; -} - - -//------------------------------------------------- -// kb_p1_r - -//------------------------------------------------- - -READ8_MEMBER( tandy2k_keyboard_device::kb_p1_r ) -{ - /* - - bit description - - 0 X0 - 1 X1 - 2 X2 - 3 X3 - 4 X4 - 5 X5 - 6 X6 - 7 X7 - - */ - - UINT8 data = 0xff; - - if (!BIT(m_keylatch, 0)) data &= m_y0->read(); - if (!BIT(m_keylatch, 1)) data &= m_y1->read(); - if (!BIT(m_keylatch, 2)) data &= m_y2->read(); - if (!BIT(m_keylatch, 3)) data &= m_y3->read(); - if (!BIT(m_keylatch, 4)) data &= m_y4->read(); - if (!BIT(m_keylatch, 5)) data &= m_y5->read(); - if (!BIT(m_keylatch, 6)) data &= m_y6->read(); - if (!BIT(m_keylatch, 7)) data &= m_y7->read(); - if (!BIT(m_keylatch, 8)) data &= m_y8->read(); - if (!BIT(m_keylatch, 9)) data &= m_y9->read(); - if (!BIT(m_keylatch, 10)) data &= m_y10->read(); - if (!BIT(m_keylatch, 11)) data &= m_y11->read(); - - return ~data; -} - - -//------------------------------------------------- -// kb_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( tandy2k_keyboard_device::kb_p1_w ) -{ - /* - - bit description - - 0 Y0 - 1 Y1 - 2 Y2 - 3 Y3 - 4 Y4 - 5 Y5 - 6 Y6 - 7 Y7 - - */ - - // keyboard row - m_keylatch = (m_keylatch & 0xff00) | data; -} - - -//------------------------------------------------- -// kb_p2_w - -//------------------------------------------------- - -WRITE8_MEMBER( tandy2k_keyboard_device::kb_p2_w ) -{ - /* - - bit description - - 0 Y8 - 1 Y9 - 2 Y10 - 3 Y11 - 4 LED 2 - 5 LED 1 - 6 CLOCK - 7 DATA - - */ - - // keyboard row - m_keylatch = ((data & 0x0f) << 8) | (m_keylatch & 0xff); - - // led output - output_set_led_value(LED_2, !BIT(data, 4)); - output_set_led_value(LED_1, !BIT(data, 5)); - - // keyboard clock - int clock = BIT(data, 6); - - if (m_clock != clock) - { - m_clock = clock; - - m_write_clock(m_clock); - } - - // keyboard data - int kbddat = BIT(data, 7); - - if (m_data != kbddat) - { - m_data = kbddat; - - m_write_data(m_data); - } -} diff --git a/src/mess/machine/tandy2kb.h b/src/mess/machine/tandy2kb.h deleted file mode 100644 index 9a2d65d373f..00000000000 --- a/src/mess/machine/tandy2kb.h +++ /dev/null @@ -1,110 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Tandy 2000 keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __TANDY2K_KEYBOARD__ -#define __TANDY2K_KEYBOARD__ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define TANDY2K_KEYBOARD_TAG "tandy2kb" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_TANDY2000_KEYBOARD_CLOCK_CALLBACK(_write) \ - devcb = &tandy2k_keyboard_device::set_clock_wr_callback(*device, DEVCB_##_write); - -#define MCFG_TANDY2000_KEYBOARD_DATA_CALLBACK(_write) \ - devcb = &tandy2k_keyboard_device::set_data_wr_callback(*device, DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> tandy2k_keyboard_device - -class tandy2k_keyboard_device : public device_t -{ -public: - // construction/destruction - tandy2k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_clock_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clock.set_callback(object); } - template static devcb_base &set_data_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_data.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_WRITE_LINE_MEMBER( power_w ); - DECLARE_WRITE_LINE_MEMBER( reset_w ); - DECLARE_WRITE_LINE_MEMBER( busy_w ); - DECLARE_READ_LINE_MEMBER( data_r ); - - // not really public - DECLARE_READ8_MEMBER( kb_p1_r ); - DECLARE_WRITE8_MEMBER( kb_p1_w ); - DECLARE_WRITE8_MEMBER( kb_p2_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - enum - { - LED_1 = 0, - LED_2 - }; - - required_device m_maincpu; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_y11; - - devcb_write_line m_write_clock; - devcb_write_line m_write_data; - - UINT16 m_keylatch; - - int m_clock; - int m_data; -}; - - -// device type definition -extern const device_type TANDY2K_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/teleprinter.c b/src/mess/machine/teleprinter.c deleted file mode 100644 index 1c72a536883..00000000000 --- a/src/mess/machine/teleprinter.c +++ /dev/null @@ -1,237 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -#include "teleprinter.h" - -#define KEYBOARD_TAG "keyboard" - -static const UINT8 teleprinter_font[128*8] = -{ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00, - 0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00, - 0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07, - 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07, - 0x38,0x38,0x38,0x38,0x07,0x07,0x07,0x07, - 0x3f,0x3f,0x3f,0x3f,0x07,0x07,0x07,0x07, - 0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x38, - 0x07,0x07,0x07,0x07,0x38,0x38,0x38,0x38, - 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, - 0x3f,0x3f,0x3f,0x3f,0x38,0x38,0x38,0x38, - 0x00,0x00,0x00,0x00,0x3f,0x3f,0x3f,0x3f, - 0x07,0x07,0x07,0x07,0x3f,0x3f,0x3f,0x3f, - 0x38,0x38,0x38,0x38,0x3f,0x3f,0x3f,0x3f, - 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, - 0x00,0x00,0x00,0x00,0x2a,0x15,0x2a,0x15, - 0x2a,0x15,0x2a,0x15,0x00,0x00,0x00,0x00, - 0x3f,0x3f,0x3f,0x3f,0x2a,0x15,0x2a,0x15, - 0x2a,0x15,0x2a,0x15,0x3f,0x3f,0x3f,0x3f, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00, - 0x14,0x14,0x14,0x00,0x00,0x00,0x00,0x00, - 0x14,0x14,0x3e,0x14,0x3e,0x14,0x14,0x00, - 0x08,0x3c,0x0a,0x1c,0x28,0x1e,0x08,0x00, - 0x06,0x26,0x10,0x08,0x04,0x32,0x30,0x00, - 0x08,0x14,0x14,0x0c,0x2a,0x12,0x2c,0x00, - 0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x00, - 0x10,0x08,0x04,0x04,0x04,0x08,0x10,0x00, - 0x04,0x08,0x10,0x10,0x10,0x08,0x04,0x00, - 0x00,0x08,0x2a,0x1c,0x2a,0x08,0x00,0x00, - 0x00,0x08,0x08,0x3e,0x08,0x08,0x00,0x00, - 0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x00, - 0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, - 0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00, - 0x1c,0x22,0x32,0x2a,0x26,0x22,0x1c,0x00, - 0x08,0x0c,0x08,0x08,0x08,0x08,0x1c,0x00, - 0x1c,0x22,0x20,0x18,0x04,0x02,0x3e,0x00, - 0x3e,0x20,0x10,0x18,0x20,0x22,0x1c,0x00, - 0x10,0x18,0x14,0x12,0x3e,0x10,0x10,0x00, - 0x3e,0x02,0x1e,0x20,0x20,0x22,0x1c,0x00, - 0x10,0x08,0x04,0x1c,0x22,0x22,0x1c,0x00, - 0x3e,0x20,0x10,0x08,0x04,0x04,0x04,0x00, - 0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c,0x00, - 0x1c,0x22,0x22,0x1c,0x10,0x08,0x04,0x00, - 0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00, - 0x00,0x00,0x08,0x00,0x08,0x08,0x04,0x00, - 0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00, - 0x00,0x00,0x3e,0x00,0x3e,0x00,0x00,0x00, - 0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00, - 0x1c,0x22,0x20,0x10,0x08,0x00,0x08,0x00, - 0x1c,0x22,0x32,0x2a,0x3a,0x02,0x3c,0x00, - 0x08,0x14,0x22,0x22,0x3e,0x22,0x22,0x00, - 0x1e,0x22,0x22,0x1e,0x22,0x22,0x1e,0x00, - 0x1c,0x22,0x02,0x02,0x02,0x22,0x1c,0x00, - 0x1e,0x24,0x24,0x24,0x24,0x24,0x1e,0x00, - 0x3e,0x02,0x02,0x1e,0x02,0x02,0x3e,0x00, - 0x3e,0x02,0x02,0x1e,0x02,0x02,0x02,0x00, - 0x1c,0x22,0x02,0x02,0x32,0x22,0x3c,0x00, - 0x22,0x22,0x22,0x3e,0x22,0x22,0x22,0x00, - 0x1c,0x08,0x08,0x08,0x08,0x08,0x1c,0x00, - 0x38,0x10,0x10,0x10,0x10,0x12,0x0c,0x00, - 0x22,0x12,0x0a,0x06,0x0a,0x12,0x22,0x00, - 0x02,0x02,0x02,0x02,0x02,0x02,0x3e,0x00, - 0x22,0x36,0x2a,0x2a,0x22,0x22,0x22,0x00, - 0x22,0x22,0x26,0x2a,0x32,0x22,0x22,0x00, - 0x1c,0x22,0x22,0x22,0x22,0x22,0x1c,0x00, - 0x1e,0x22,0x22,0x1e,0x02,0x02,0x02,0x00, - 0x1c,0x22,0x22,0x22,0x2a,0x12,0x2c,0x00, - 0x1e,0x22,0x22,0x1e,0x0a,0x12,0x22,0x00, - 0x1c,0x22,0x02,0x1c,0x20,0x22,0x1c,0x00, - 0x3e,0x08,0x08,0x08,0x08,0x08,0x08,0x00, - 0x22,0x22,0x22,0x22,0x22,0x22,0x1c,0x00, - 0x22,0x22,0x22,0x14,0x14,0x08,0x08,0x00, - 0x22,0x22,0x22,0x2a,0x2a,0x2a,0x14,0x00, - 0x22,0x22,0x14,0x08,0x14,0x22,0x22,0x00, - 0x22,0x22,0x22,0x14,0x08,0x08,0x08,0x00, - 0x3e,0x20,0x10,0x08,0x04,0x02,0x3e,0x00, - 0x0e,0x02,0x02,0x02,0x02,0x02,0x0e,0x00, - 0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00, - 0x38,0x20,0x20,0x20,0x20,0x20,0x38,0x00, - 0x08,0x1c,0x2a,0x08,0x08,0x08,0x08,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00, - 0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x1c,0x20,0x3c,0x22,0x3c,0x00, - 0x02,0x02,0x1e,0x22,0x22,0x22,0x1e,0x00, - 0x00,0x00,0x3c,0x02,0x02,0x02,0x3c,0x00, - 0x20,0x20,0x3c,0x22,0x22,0x22,0x3c,0x00, - 0x00,0x00,0x1c,0x22,0x3e,0x02,0x1c,0x00, - 0x18,0x04,0x0e,0x04,0x04,0x04,0x04,0x00, - 0x00,0x00,0x3c,0x22,0x22,0x3c,0x20,0x18, - 0x02,0x02,0x1e,0x22,0x22,0x22,0x22,0x00, - 0x08,0x00,0x0c,0x08,0x08,0x08,0x1c,0x00, - 0x10,0x00,0x18,0x10,0x10,0x10,0x12,0x0c, - 0x02,0x02,0x22,0x12,0x0e,0x16,0x22,0x00, - 0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x00, - 0x00,0x00,0x16,0x2a,0x2a,0x2a,0x2a,0x00, - 0x00,0x00,0x1a,0x26,0x22,0x22,0x22,0x00, - 0x00,0x00,0x1c,0x22,0x22,0x22,0x1c,0x00, - 0x00,0x00,0x1e,0x22,0x22,0x1e,0x02,0x02, - 0x00,0x00,0x3c,0x22,0x22,0x3c,0x20,0x20, - 0x00,0x00,0x34,0x0c,0x04,0x04,0x04,0x00, - 0x00,0x00,0x3c,0x02,0x1c,0x20,0x1e,0x00, - 0x08,0x08,0x1c,0x08,0x08,0x08,0x10,0x00, - 0x00,0x00,0x22,0x22,0x22,0x32,0x2c,0x00, - 0x00,0x00,0x22,0x22,0x22,0x14,0x08,0x00, - 0x00,0x00,0x22,0x22,0x2a,0x2a,0x14,0x00, - 0x00,0x00,0x22,0x14,0x08,0x14,0x22,0x00, - 0x00,0x00,0x22,0x22,0x14,0x08,0x04,0x02, - 0x00,0x00,0x3e,0x10,0x08,0x04,0x3e,0x00, - 0x10,0x08,0x08,0x04,0x08,0x08,0x10,0x00, - 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00, - 0x04,0x08,0x08,0x10,0x08,0x08,0x04,0x00, - 0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x2a,0x15,0x2a,0x15,0x2a,0x15,0x2a,0x15 -}; - -teleprinter_device::teleprinter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : generic_terminal_device(mconfig, TELEPRINTER, "Teleprinter", tag, owner, clock, "teleprinter", __FILE__) -{ -} - -void teleprinter_device::scroll_line() -{ - memmove(m_buffer,m_buffer+TELEPRINTER_WIDTH,(TELEPRINTER_HEIGHT-1)*TELEPRINTER_WIDTH); - memset(m_buffer + TELEPRINTER_WIDTH*(TELEPRINTER_HEIGHT-1),0x20,TELEPRINTER_WIDTH); -} - -void teleprinter_device::write_char(UINT8 data) { - m_buffer[(TELEPRINTER_HEIGHT-1)*TELEPRINTER_WIDTH+m_x_pos] = data; - m_x_pos++; - if (m_x_pos >= TELEPRINTER_WIDTH) - { - m_x_pos = 0; - scroll_line(); - } -} - -void teleprinter_device::clear() { - memset(m_buffer,0,TELEPRINTER_WIDTH*TELEPRINTER_HEIGHT); - m_x_pos = 0; -} - -void teleprinter_device::term_write(UINT8 data) -{ - switch(data) { - case 10: m_x_pos = 0; - scroll_line(); - break; - case 13: m_x_pos = 0; break; - case 9: m_x_pos = (m_x_pos & 0xf8) + 8; - if (m_x_pos >= TELEPRINTER_WIDTH) - m_x_pos = TELEPRINTER_WIDTH-1; - - break; - case 16: break; - default: write_char(data); break; - } -} - -/*************************************************************************** - VIDEO HARDWARE -***************************************************************************/ -UINT32 teleprinter_device::tp_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT8 code; - int y, c, x, b; - - for (y = 0; y < TELEPRINTER_HEIGHT; y++) - { - for (c = 0; c < 8; c++) - { - int horpos = 0; - for (x = 0; x < TELEPRINTER_WIDTH; x++) - { - code = teleprinter_font[(m_buffer[y*TELEPRINTER_WIDTH + x] & 0x7f) *8 + c]; - for (b = 0; b < 8; b++) - { - bitmap.pix32(y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 0x00ffffff; - } - } - } - } - return 0; -} - -/*************************************************************************** - VIDEO HARDWARE -***************************************************************************/ -MACHINE_CONFIG_FRAGMENT( generic_teleprinter ) - MCFG_SCREEN_ADD(TELEPRINTER_SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(TELEPRINTER_WIDTH*8, TELEPRINTER_HEIGHT*8) - MCFG_SCREEN_VISIBLE_AREA(0, TELEPRINTER_WIDTH*8-1, 0, TELEPRINTER_HEIGHT*8-1) - MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, teleprinter_device, tp_update) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(generic_terminal_device, kbd_put)) -MACHINE_CONFIG_END - -machine_config_constructor teleprinter_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME(generic_teleprinter); -} - -/*------------------------------------------------- - device_reset - device-specific reset --------------------------------------------------*/ - -void teleprinter_device::device_reset() -{ - clear(); - generic_terminal_device::device_reset(); -} - -const device_type TELEPRINTER = &device_creator; diff --git a/src/mess/machine/teleprinter.h b/src/mess/machine/teleprinter.h deleted file mode 100644 index 0f0cad4c924..00000000000 --- a/src/mess/machine/teleprinter.h +++ /dev/null @@ -1,42 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -#ifndef __TELEPRINTER_H__ -#define __TELEPRINTER_H__ - -#include "machine/terminal.h" - -#define TELEPRINTER_WIDTH 80 -#define TELEPRINTER_HEIGHT 50 - - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ -#define TELEPRINTER_TAG "teleprinter" -#define TELEPRINTER_SCREEN_TAG "tty_screen" - -#define MCFG_GENERIC_TELEPRINTER_KEYBOARD_CB(_devcb) \ - devcb = &generic_terminal_device::set_keyboard_callback(*device, DEVCB_##_devcb); - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -class teleprinter_device : public generic_terminal_device -{ -public: - teleprinter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - UINT32 tp_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect); -protected: - virtual void term_write(UINT8 data); - virtual void device_reset(); - virtual machine_config_constructor device_mconfig_additions() const; -private: - void scroll_line(); - void write_char(UINT8 data); - void clear(); -}; - -extern const device_type TELEPRINTER; - -#endif /* __TELEPRINTER_H__ */ diff --git a/src/mess/machine/thomflop.c b/src/mess/machine/thomflop.c deleted file mode 100644 index 3927f7219af..00000000000 --- a/src/mess/machine/thomflop.c +++ /dev/null @@ -1,1914 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Thomson 8-bit computers - -**********************************************************************/ - -#include "includes/thomson.h" -#include "machine/wd_fdc.h" - - -#define VERBOSE 0 /* 0, 1 or 2 */ - -#define PRINT(x) osd_printf_info x - -#define LOG(x) do { if (VERBOSE > 0) logerror x; } while (0) -#define VLOG(x) do { if (VERBOSE > 1) logerror x; } while (0) - - - - -/******************* 3''1/2 & 5''1/4 disk format ********************/ - -/* - single density sector format: - - data bytes - - id field 00 6 byte synchro - FE 1 id field mark - 1 track - 1 side - 1 sector - 00 1 log sector size (0->128, 1->256, 2->512,...) - 2 CRC (unemulated) - FF 12 spaces - data field 00 6 bytes synchro - FB 1 data field mark - E5 128 actual data (set to E5 when formatting) - 2 CRC (unemulated) - FF 22 ? spaces - - - - double density sector format: - - data bytes - - id field 00 12 bit synchro - A1 3 byte synchro - FE 1 id field mark - 1 track - 1 side - 1 sector - 01 1 log sector size (0->128, 1->256, 2->512,...) - 2 CRC (unemulated) - 4E/F7 22 spaces - data field 00 12 bit synchro - A1 3 bytes synchro - FB 1 data field mark - E5 256 actual data (set to E5 when formatting) - 2 CRC (unemulated) - 4E/F7 74 ? spaces - - => at most 392 bytes / sector - => at most 6272 bytes / track - - Notes: - - the BIOS puts 4E bytes as spaces after id and data fields - - some protected games expect F7 bytes (instead of 4E) after id fields -*/ - -#define THOM_SIZE_ID 32 -#define THOM_SIZE_DATA_LO (128+80) -#define THOM_SIZE_DATA_HI (256+80) -#define THOM_SIZE_SYNCHRO 12 - -static int motor_on; - - -/* build an identifier, with header & space */ -int thomson_state::thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size ) -{ - if ( sector_size == 128 ) - { - /* single density */ - memset( dst, 0x00, 6 ); /* synchro bytes */ - dst[ 7 ] = 0xfe; /* address field mark */ - dst[ 8 ] = id.C; - dst[ 9 ] = id.H; - dst[ 10 ] = id.N; - dst[ 11 ] = id.R; - dst[ 12 ] = 0; /* TODO: CRC */ - dst[ 13 ] = 0; /* TODO: CRC */ - memset( dst + 14, 0xff, 12 ); /* end mark */ - return 36; - } - else - { - /* double density */ - memset( dst, 0xa1, 3 ); /* synchro bytes */ - dst[ 3 ] = 0xfe; /* address field mark */ - dst[ 4 ] = id.C; - dst[ 5 ] = id.H; - dst[ 6 ] = id.N; - dst[ 7 ] = id.R; - dst[ 8 ] = 0; /* TODO: CRC */ - dst[ 9 ] = 0; /* TODO: CRC */ - memset( dst + 10, 0xf7, 22 ); /* end mark */ - return 32; - } -} - - - -/* build a sector, with header & space */ -int thomson_state::thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, UINT8* dst, int sector_size ) -{ - if ( sector_size == 128 ) - { - /* single density */ - memset( dst, 0x00, 6 ); /* synchro bytes */ - dst[ 6 ] = 0xfb; /* data field mark */ - img->floppy_drive_read_sector_data - ( id.H, id.data_id, dst + 7, sector_size ); - dst[ sector_size + 7 ] = 0; /* TODO: CRC */ - dst[ sector_size + 8 ] = 0; /* TODO: CRC */ - memset( dst + sector_size + 9, 0xff, 22 ); /* end mark */ - return sector_size + 31; - } - else - { - /* double density */ - memset( dst, 0xa1, 3 ); /* synchro bytes */ - dst[ 3 ] = 0xfb; /* data field mark */ - img->floppy_drive_read_sector_data - ( id.H, id.data_id, dst + 4, sector_size ); - dst[ sector_size + 4 ] = 0; /* TODO: CRC */ - dst[ sector_size + 5 ] = 0; /* TODO: CRC */ - memset( dst + sector_size + 6, 0xF7, 74 ); /* end mark */ - return sector_size + 80; - } -} - - - -/* build a whole track */ -int thomson_state::thom_floppy_make_track( legacy_floppy_image_device* img, UINT8* dst, int sector_size, int side ) -{ - UINT8 space = ( sector_size == 128 ) ? 0xff : 0; - UINT8* org = dst; - chrn_id id; - int nb; - - /* go to start of track */ - while ( ! img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) ) - { - if ( ! img->floppy_drive_get_next_id( side, &id ) ) - return 0; - } - - /* for each sector... */ - for ( nb = 0; nb < 16; nb++ ) - { - if ( ! img->floppy_drive_get_next_id( side, &id ) ) - break; - - memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO; - dst += thom_floppy_make_addr( id, dst, sector_size ); - memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO; - dst += thom_floppy_make_sector( img, id, dst, sector_size ); - - if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) ) - break; - } - return dst - org; -} - - - -/******************* QDD disk format ********************/ - -/* - sector format: - - data bytes - - id field 16 17 synchro - A5 1 id field mark - 1 sector (1-400) hi byte - 1 sector (1-400) low byte - 1 check-sum (sum modulo 256 of 3 last bytes) - - data field 16 10 synchro - 5A 1 data field mark - FF 128 actual data (set to FF when formatting) - 1 check-sum (sum modulo 256 of 129 last bytes) - - - there are 400 sectors numbered from 1 -*/ - -#define THOM_QDD_SYNCH_DISK 100 -#define THOM_QDD_SYNCH_ADDR 17 -#define THOM_QDD_SYNCH_DATA 10 - -#define THOM_QDD_SIZE_ID ( 4 + THOM_QDD_SYNCH_ADDR ) -#define THOM_QDD_SIZE_DATA ( 130 + THOM_QDD_SYNCH_DATA ) - - -/* build an identifier, with header */ -int thomson_state::thom_qdd_make_addr( int sector, UINT8* dst ) -{ - dst[ 0 ] = 0xa5; - dst[ 1 ] = sector >> 8; - dst[ 2 ] = sector & 0xff; - dst[ 3 ] = dst[ 0 ] + dst[ 1 ] + dst[ 2 ]; - return 4; -} - - - -/* build a sector, with header */ -int thomson_state::thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, UINT8* dst ) -{ - int i; - dst[ 0 ] = 0x5a; - img->floppy_drive_read_sector_data ( 0, sector, dst + 1, 128 ); - dst[ 129 ] = 0; - for ( i = 0; i < 129; i++ ) - dst[ 129 ] += dst[ i ]; - return 130; -} - - - -/* build a whole disk */ -int thomson_state::thom_qdd_make_disk ( legacy_floppy_image_device* img, UINT8* dst ) -{ - UINT8* org = dst; - int i; - - memset( dst, 0x16, THOM_QDD_SYNCH_DISK ); dst += THOM_QDD_SYNCH_DISK; - - for ( i = 1; i <= 400; i++ ) - { - memset( dst, 0x16, THOM_QDD_SYNCH_ADDR ); dst += THOM_QDD_SYNCH_ADDR; - dst += thom_qdd_make_addr( i, dst ); - memset( dst, 0x16, THOM_QDD_SYNCH_DATA ); dst += THOM_QDD_SYNCH_DATA; - dst += thom_qdd_make_sector( img, i, dst ); - } - - memset( dst, 0x16, THOM_QDD_SYNCH_DISK ); dst += THOM_QDD_SYNCH_DISK; - - return dst - org; -} - - - -/*********************** CD 90-640 controller ************************/ - -/* 5''1/4 two-sided double-density - used in TO7, TO7/70, MO5 computers - based on a WD2793 (or lower ?) chip -*/ - - - -static UINT8 to7_5p14_select; - - - -READ8_MEMBER( thomson_state::to7_5p14_r ) -{ - wd2793_t *fdc = machine().device("wd2793"); - - if ( offset < 4 ) - return fdc->read(space, offset ); - else if ( offset == 8 ) - return to7_5p14_select; - else - logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); - return 0; -} - - - -WRITE8_MEMBER( thomson_state::to7_5p14_w ) -{ - wd2793_t *fdc = machine().device("wd2793"); - if ( offset < 4 ) - fdc->write(space, offset, data ); - else if ( offset == 8 ) - { - /* drive select */ - floppy_image_device *floppy = NULL; - - if (BIT(data, 1)) floppy = fdc->subdevice("0")->get_device(); - if (BIT(data, 2)) floppy = fdc->subdevice("1")->get_device(); - - fdc->set_floppy(floppy); - - if (floppy) - { - thom_floppy_active( 0 ); - floppy->mon_w(0); - floppy->ss_w(BIT(data, 0)); - } - } - else - logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n", - machine().time().as_double(), m_maincpu->pc(), offset, data ); -} - - - -void thomson_state::to7_5p14_reset() -{ - wd2793_t *fdc = machine().device("wd2793"); - LOG(( "to7_5p14_reset: CD 90-640 controller\n" )); - fdc->reset(); -} - - - -void thomson_state::to7_5p14_init() -{ - LOG(( "to7_5p14_init: CD 90-640 controller\n" )); - save_item(NAME(to7_5p14_select)); -} - - - -/*********************** CD 90-015 controller ************************/ - -/* 5''1/4 one-sided single-density (up to 4 one-sided drives) - used in TO7, TO7/70, MO5 computers - based on HD 46503 S chip, but we actually use a MC 6843 instead - (seems they are clone) -*/ - - - -static UINT8 to7_5p14sd_select; - - - -READ8_MEMBER( thomson_state::to7_5p14sd_r ) -{ - if ( offset < 8 ) - return m_mc6843->read( space, offset ); - else if ( offset >= 8 && offset <= 9 ) - return to7_5p14sd_select; - else - logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); - return 0; -} - - - -WRITE8_MEMBER( thomson_state::to7_5p14sd_w ) -{ - if ( offset < 8 ) - m_mc6843->write( space, offset, data ); - else if ( offset >= 8 && offset <= 9 ) - { - /* drive select */ - int drive = -1, side = 0; - - if ( data & 1 ) - { - drive = 0; - side = 0; - } - else if ( data & 2 ) - { - drive = 1; - side = 1; - } - else if ( data & 4 ) - { - drive = 2; - side = 0; - } - else if ( data & 8 ) - { - drive = 3; - side = 1; - } - - to7_5p14sd_select = data; - - if ( drive != -1 ) - { - thom_floppy_active( 0 ); - m_mc6843->set_drive( drive ); - m_mc6843->set_side( side ); - LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n", - machine().time().as_double(), m_maincpu->pc(), data, drive, side )); - } - } - else - logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n", - machine().time().as_double(), m_maincpu->pc(), offset, data ); -} - -void thomson_state::to7_5p14_index_pulse_callback( device_t *controller,legacy_floppy_image_device *image, int state ) -{ - m_mc6843->set_index_pulse( state ); -} - -void thomson_state::to7_5p14sd_reset() -{ - int i; - LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" )); - for ( i = 0; i < floppy_get_count( machine() ); i++ ) - { - legacy_floppy_image_device * img = floppy_get_device( machine(), i ); - if (img) { - img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 ); - img->floppy_drive_set_rpm( 300. ); - img->floppy_drive_seek( - img->floppy_drive_get_current_track() ); - } - } -} - - -void thomson_state::to7_5p14sd_init() -{ - LOG(( "to7_5p14sd_init: CD 90-015 controller\n" )); - save_item(NAME(to7_5p14sd_select)); -} - - -/*********************** CQ 90-028 controller ************************/ - -/* QDD 2''8 controller - used in TO7, TO7/70, MO5 computers - it is based on a MC6852 SSDA - - Note: the MC6852 is only partially emulated, most features are not used in - the controller and are ignored. -*/ - - - -/* MC6852 status */ -#define QDD_S_RDA 0x01 /* receiver data available */ -#define QDD_S_TDRA 0x02 /* transitter data register available */ -#define QDD_S_NDCD 0x04 /* data carrier detect, negated (unused) */ -#define QDD_S_NCTS 0x08 /* clear-to-send, negated write-protect */ -#define QDD_S_TUF 0x10 /* transmitter underflow (unused) */ -#define QDD_S_OVR 0x20 /* receiver overrun (unused) */ -#define QDD_S_PE 0x40 /* receiver parity error (unused) */ -#define QDD_S_IRQ 0x80 /* interrupt request */ -#define QDD_S_ERR (QDD_S_TUF | QDD_S_OVR | QDD_S_PE | QDD_S_NDCD | QDD_S_NCTS) - - -/* MC6852 control */ -#define QDD_C1_RIE 0x20 /* interrupt on reveive */ -#define QDD_C1_TIE 0x10 /* interrupt on transmit */ -#define QDD_C1_CLRSYNC 0x08 /* clear receiver sync char (unused) */ -#define QDD_C1_STRIPSYNC 0x04 /* strips sync from received (unused) */ -#define QDD_C1_TRESET 0x02 /* transmitter reset */ -#define QDD_C1_RRESET 0x01 /* receiver reset */ -#define QDD_C2_EIE 0x80 /* interrupt on error */ -#define QDD_C2_TSYNC 0x40 /* underflow = ff if 0 / sync if 1 (unused) */ -#define QDD_C2_BLEN 0x04 /* transfer byte length (unused) */ -#define QDD_C3_CLRTUF 0x08 /* clear underflow */ -#define QDD_C3_CLRCTS 0x04 /* clear CTS */ -#define QDD_C3_SYNCLEN 0x02 /* sync byte length (unused) */ -#define QDD_C3_SYNCMODE 0x01 /* external / internal sync mode (unused) */ - - -/* a track is actually the whole disk = 400 128-byte sectors + headers */ -#define QDD_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 - - -struct to7qdd_t -{ - /* MC6852 registers */ - UINT8 status; - UINT8 ctrl1; - UINT8 ctrl2; - UINT8 ctrl3; - - /* extra registers */ - UINT8 drive; - - /* internal state */ - UINT8 data[QDD_MAXBUF]; /* enough for a whole track */ - UINT32 data_idx; /* byte position in track */ - UINT32 start_idx; /* start of write position */ - UINT32 data_size; /* track length */ - UINT8 data_crc; /* checksum when writing */ - UINT8 index_pulse; /* one pulse per track */ - -}; - -static to7qdd_t * to7qdd; - - - -void thomson_state::to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state ) -{ - to7qdd->index_pulse = state; - - if ( state ) - { - /* rewind to disk start */ - to7qdd->data_idx = 0; - to7qdd->start_idx = 0; - to7qdd->data_size = 0; - } - - VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", machine().time().as_double(), state )); -} - - - -legacy_floppy_image_device * thomson_state::to7_qdd_image() -{ - return floppy_get_device( machine(), 0 ); -} - - - -/* update MC6852 status register */ -void thomson_state::to7_qdd_stat_update() -{ - /* byte-ready */ - to7qdd->status |= QDD_S_RDA | QDD_S_TDRA; - if ( ! to7qdd->drive ) - to7qdd->status |= QDD_S_PE; - - /* write-protect */ - if (to7_qdd_image()->floppy_wpt_r() == CLEAR_LINE) - to7qdd->status |= QDD_S_NCTS; - - /* sticky reset conditions */ - if ( to7qdd->ctrl1 & QDD_C1_RRESET ) - to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); - if ( to7qdd->ctrl1 & QDD_C1_TRESET ) - to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF); - - /* irq update */ - - if ( ( (to7qdd->ctrl1 & QDD_C1_RIE) && !(to7qdd->status & QDD_S_RDA ) ) || - ( (to7qdd->ctrl1 & QDD_C1_TIE) && !(to7qdd->status & QDD_S_TDRA) ) || - ( (to7qdd->ctrl2 & QDD_C2_EIE) && !(to7qdd->status & QDD_S_ERR ) ) ) - to7qdd->status &= ~QDD_S_IRQ; - - if ( ( (to7qdd->ctrl1 & QDD_C1_RIE) && (to7qdd->status & QDD_S_RDA ) ) || - ( (to7qdd->ctrl1 & QDD_C1_TIE) && (to7qdd->status & QDD_S_TDRA) ) || - ( (to7qdd->ctrl2 & QDD_C2_EIE) && (to7qdd->status & QDD_S_ERR ) ) ) - to7qdd->status |= QDD_S_IRQ; -} - - - -UINT8 thomson_state::to7_qdd_read_byte() -{ - UINT8 data; - - /* rebuild disk if needed */ - if ( !to7qdd->data_size ) - { - to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data ); - assert( to7qdd->data_idx < sizeof( to7qdd->data ) ); - } - - if ( to7qdd->data_idx >= to7qdd->data_size ) - data = 0; - else - data = to7qdd->data[ to7qdd->data_idx ]; - - VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", - machine().time().as_double(), m_maincpu->pc(), - to7qdd->data_idx, to7qdd->data_size, data )); - - to7qdd->data_idx++; - to7qdd->start_idx = to7qdd->data_idx; - - return data; -} - - - -/* This is quite complex: bytes are written one at a time by the CPU and we - must detect the following patterns: - * CPU write id field and data field => format - * CPU write data field after it has read an id field => sector write - */ -void thomson_state::to7_qdd_write_byte( UINT8 data ) -{ - int i; - - /* rebuild disk if needed */ - if ( !to7qdd->data_size ) - { - to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data ); - assert( to7qdd->data_idx < sizeof( to7qdd->data ) ); - } - - if ( ( to7qdd->start_idx != to7qdd->data_idx || /* field in construction */ - data==0xA5 || data==0x5A ) && /* first byte of tentative field */ - to7qdd->data_idx data_size ) - { - /* this is the first byte of the field */ - if ( to7qdd->start_idx == to7qdd->data_idx ) - to7qdd->data_crc = 0; - - /* accumulate bytes */ - to7qdd->data[ to7qdd->data_idx ] = data; - to7qdd->data_idx++; - - VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", - machine().time().as_double(), m_maincpu->pc(), data, - to7qdd->start_idx, to7qdd->data_idx )); - - /* end of tentative id field */ - if ( to7qdd->data_idx == to7qdd->start_idx + 4 && - to7qdd->data[ to7qdd->start_idx ] == 0xA5 && - to7qdd->data[ to7qdd->start_idx + 3 ] == to7qdd->data_crc ) - { - /* got an id field => format */ - int sector = (int) to7qdd->data[ to7qdd->start_idx + 1 ] * 256 + (int) to7qdd->data[ to7qdd->start_idx + 2 ]; - UINT8 filler = 0xff; - - LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", - machine().time().as_double(), m_maincpu->pc(), sector )); - - to7_qdd_image()->floppy_drive_format_sector( - 0, sector, 0, 0, sector, 128, filler ); - thom_floppy_active( 1 ); - to7qdd->start_idx = to7qdd->data_idx; - } - - /* end of tentative data field */ - else if ( to7qdd->data_idx == to7qdd->start_idx + 130 && - to7qdd->data[ to7qdd->start_idx ] == 0x5A && - to7qdd->data[ to7qdd->start_idx + 129 ] == to7qdd->data_crc ) - { - /* look backwards for previous id field */ - for ( i = to7qdd->start_idx - 3; i >= 0; i-- ) - { - if ( to7qdd->data[ i ] == 0xA5 && - ( ( to7qdd->data[ i ] + to7qdd->data[ i + 1 ] + - to7qdd->data[ i + 2 ] ) & 0xff - ) == to7qdd->data[ i + 3 ] ) - break; - } - - if ( i >= 0 ) - { - /* got an id & a data field => write */ - int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ]; - - LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", - machine().time().as_double(), m_maincpu->pc(), sector )); - - to7_qdd_image()->floppy_drive_write_sector_data( 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 ); - thom_floppy_active( 1 ); - } - - to7qdd->start_idx = to7qdd->data_idx; - } - - else to7qdd->data_crc += data; - } -} - - - -READ8_MEMBER( thomson_state::to7_qdd_r ) -{ - switch ( offset ) - { - case 0: /* MC6852 status */ - to7_qdd_stat_update(); - VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n", - machine().time().as_double(), m_maincpu->pc(), to7qdd->status, - to7qdd->status & QDD_S_IRQ ? 1 : 0, - to7qdd->status & QDD_S_PE ? 1 : 0, - to7qdd->status & QDD_S_OVR ? 1 : 0, - to7qdd->status & QDD_S_TUF ? 1 : 0, - to7qdd->status & QDD_S_TDRA ? 1 : 0, - to7qdd->status & QDD_S_RDA ? 1 : 0, - to7qdd->status & QDD_S_NCTS ? 1 : 0 )); - return to7qdd->status; - - case 1: /* MC6852 data input => read byte from disk */ - to7qdd->status &= ~(QDD_S_RDA | QDD_S_PE | QDD_S_OVR); - to7_qdd_stat_update(); - return to7_qdd_read_byte(); - - case 8: /* floppy status */ - { - UINT8 data = 0; - device_image_interface* img = dynamic_cast(to7_qdd_image()); - if ( ! img->exists() ) - data |= 0x40; /* disk present */ - if ( to7qdd->index_pulse ) - data |= 0x80; /* disk start */ - VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); - return data; - } - - default: - logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::to7_qdd_w ) -{ - switch ( offset ) - { - case 0: /* MC6852 control 1 */ - /* reset */ - if ( data & QDD_C1_RRESET ) - to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); - if ( data & QDD_C1_TRESET ) - to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF); - - to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 ); - to7_qdd_stat_update(); - VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n", - machine().time().as_double(), m_maincpu->pc(), data, - data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-', - data & QDD_C1_STRIPSYNC ? "strip-sync " : "", - data & QDD_C1_CLRSYNC ? "clear-sync " : "", - data & QDD_C1_RIE ? 'r' : '-', - data & QDD_C1_TIE ? 't' : '-' )); - break; - - case 1: - switch ( to7qdd->ctrl1 >> 6 ) - { - case 0: /* MC6852 control 2 */ - { -#if 0 - /* most of these are unused now */ - static const int bit[8] = { 6, 6, 7, 8, 7, 7, 8, 8 }; - static const int par[8] = { 2, 1, 0, 0, 2, 1, 2, 1 }; - static const char *const parname[3] = { "none", "odd", "even" }; - int bits, parity; - bits = bit[ (data >> 3) & 7 ]; - parity = par[ (data >> 3) & 7 ]; - to7_qdd_stat_update(space.machine()); - VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n", - machine().time().as_double(), m_maincpu->pc(), data, - bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2, - data & QDD_C2_TSYNC ? "sync" : "ff", - data & QDD_C2_EIE ? "irq-err" : "" )); -#endif - to7qdd->ctrl2 = data; - break; - } - - case 1: /* MC6852 control 3 */ - to7qdd->ctrl3 = data; - /* reset just once each write, not sticky */ - if ( data & QDD_C3_CLRTUF ) - to7qdd->status &= ~QDD_S_TUF; - if ( data & QDD_C3_CLRCTS ) - to7qdd->status &= ~QDD_S_NCTS; - to7_qdd_stat_update(); - VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", - machine().time().as_double(), m_maincpu->pc(), data, - data & QDD_C3_CLRTUF ? "clr-tuf " : "", - data & QDD_C3_CLRCTS ? "clr-cts " : "", - data & QDD_C3_SYNCLEN ? 1 : 2, - data & QDD_C3_SYNCMODE ? "ext" : "int" )); - break; - - case 2: /* MC6852 sync code => write byte to disk */ - to7_qdd_write_byte( data ); - break; - - case 3: /* MC6852 data out => does not seem to be used */ - VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); - break; - - } - break; - - case 8: /* set drive */ - to7qdd->drive = data; - VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); - break; - - case 12: /* motor pulse ? */ - thom_floppy_active( 0 ); - VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); - break; - - default: - logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", machine().time().as_double(), m_maincpu->pc(), offset, data ); - } -} - - - -void thomson_state::to7_qdd_reset() -{ - int i; - LOG(( "to7_qdd_reset: CQ 90-028 controller\n" )); - - for ( i = 0; i < floppy_get_count( machine() ); i++ ) - { - legacy_floppy_image_device * img = floppy_get_device( machine(), i ); - if (img) { - img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 ); - - motor_on = CLEAR_LINE; - img->floppy_mon_w( motor_on); - - /* pulse each time the whole-disk spiraling track ends */ - /* at 90us per byte read, the disk can be read in 6s */ - img->floppy_drive_set_rpm( 60. / 6. ); - } - } - - to7qdd->ctrl1 |= QDD_C1_TRESET | QDD_C1_RRESET; /* reset */ - to7qdd->ctrl2 &= 0x7c; /* clear EIE, PC2-PC1 */ - to7qdd->ctrl3 &= 0xfe; /* internal sync */ - to7qdd->drive = 0; - to7_qdd_stat_update(); -} - - - -void thomson_state::to7_qdd_init() -{ - LOG(( "to7_qdd_init: CQ 90-028 controller\n" )); - - to7qdd = auto_alloc(machine(), to7qdd_t); - - save_item(NAME(to7qdd->status)); - save_item(NAME(to7qdd->ctrl1)); - save_item(NAME(to7qdd->ctrl2)); - save_item(NAME(to7qdd->ctrl3)); - save_item(NAME(to7qdd->drive)); - save_item(NAME(to7qdd->data_idx)); - save_item(NAME(to7qdd->start_idx)); - save_item(NAME(to7qdd->data_size)); - save_item(NAME(to7qdd->data_crc)); - save_item(NAME(to7qdd->index_pulse)); - save_item(NAME(to7qdd->data)); -} - - - -/********************** THMFC1 controller *************************/ - -/* custom Thomson Gate-array for 3''1/2, 5''1/4 (double density only) & QDD - */ - - - -/* types of high-level operations */ -#define THMFC1_OP_RESET 0 -#define THMFC1_OP_WRITE_SECT 1 -#define THMFC1_OP_READ_ADDR 2 -#define THMFC1_OP_READ_SECT 3 - - -/* STAT0 flags */ -#define THMFC1_STAT0_SYNCHRO 0x01 /* bit clock synchronized */ -#define THMFC1_STAT0_BYTE_READY_OP 0x02 /* byte ready (high-level operation) */ -#define THMFC1_STAT0_CRC_ERROR 0x04 -#define THMFC1_STAT0_FINISHED 0x08 -#define THMFC1_STAT0_FINISHING 0x10 /* (unemulated) */ -#define THMFC1_STAT0_BYTE_READY_POL 0x80 /* polling mode */ - - -/*#define THOM_MAXBUF (THOM_SIZE_ID+THOM_SIZE_DATA_HI+2*THOM_SIZE_SYNCHRO)*17*/ -#define THOM_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 - - -struct thmfc1_t -{ - UINT8 op; - UINT8 sector; /* target sector, in [1,16] */ - UINT32 sector_id; - UINT8 track; /* current track, in [0,79] */ - UINT8 side; /* current side, 0 or 1 */ - UINT8 drive; /* 0 to 3 */ - UINT16 sector_size; /* 128 or 256 (512, 1024 not supported) */ - UINT8 formatting; - UINT8 ipl; /* index pulse / QDD start */ - UINT8 wsync; /* synchronization word */ - - UINT8 data[THOM_MAXBUF]; /* enough for a whole track */ - UINT32 data_idx; /* reading / writing / formatting pos */ - UINT32 data_size; /* bytes to read / write */ - UINT32 data_finish; /* when to raise the finished flag */ - UINT32 data_raw_idx; /* byte index for raw track reading */ - UINT32 data_raw_size; /* size of track already cached in data */ - UINT8 data_crc; /* check-sum of written data */ - - UINT8 stat0; /* status register */ - -}; - -static thmfc1_t * thmfc1; - - -static emu_timer* thmfc_floppy_cmd; - - - -legacy_floppy_image_device * thomson_state::thmfc_floppy_image() -{ - return floppy_get_device( machine(), thmfc1->drive ); -} - - - -int thomson_state::thmfc_floppy_is_qdd ( legacy_floppy_image_device *image ) -{ - if (image==NULL) return 0; - if (!image->exists()) return 0; - return image->length()==51200; // idf QDD -} - - - -void thomson_state::thmfc_floppy_index_pulse_cb ( device_t *controller,legacy_floppy_image_device *image, int state ) -{ - if ( image != thmfc_floppy_image()) - return; - - if ( thmfc_floppy_is_qdd(image)) - { - /* pulse each time the whole-disk spiraling track ends */ - image->floppy_drive_set_rpm( 16.92f /* 423/25 */ ); - thmfc1->ipl = state; - if ( state ) - { - thmfc1->data_raw_size = 0; - thmfc1->data_raw_idx = 0; - thmfc1->data_idx = 0; - } - } - else - { - image->floppy_drive_set_rpm( 300. ); - thmfc1->ipl = state; - if ( state ) - thmfc1->data_raw_idx = 0; - } - - VLOG(( "%f thmfc_floppy_index_pulse_cb: state=%i\n", machine().time().as_double(), state )); -} - - - -int thomson_state::thmfc_floppy_find_sector( chrn_id* dst ) -{ - legacy_floppy_image_device* img = thmfc_floppy_image(); - chrn_id id; - int r = 0; - - /* scan track, try 4 revolutions */ - while ( r < 4 ) - { - if ( img->floppy_drive_get_next_id( thmfc1->side, &id ) ) - { - if ( id.C == thmfc1->track && - id.R == thmfc1->sector && - (128 << id.N) == thmfc1->sector_size - /* check side ? id.H == thmfc1->side */ ) - { - if ( dst ) - memcpy( dst, &id, sizeof( chrn_id ) ); - thmfc1->stat0 = THMFC1_STAT0_BYTE_READY_POL; - LOG (( "thmfc_floppy_find_sector: sector found C=%i H=%i R=%i N=%i\n", id.C, id.H, id.R, id.N )); - return 1; - } - } - - if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) ) - r++; - } - - thmfc1->stat0 = THMFC1_STAT0_CRC_ERROR | THMFC1_STAT0_FINISHED; - LOG (( "thmfc_floppy_find_sector: sector not found drive=%i track=%i sector=%i\n", floppy_get_drive(img), thmfc1->track, thmfc1->sector )); - return 0; -} - - - -/* complete command (by read, write, or timeout) */ -void thomson_state::thmfc_floppy_cmd_complete() -{ - LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n", - machine().time().as_double(), thmfc1->op, thmfc1->data_idx, - thmfc1->data_finish - 1, thmfc1->data_size - 1 )); - - if ( thmfc1->op == THMFC1_OP_WRITE_SECT ) - { - legacy_floppy_image_device * img = thmfc_floppy_image(); - img->floppy_drive_write_sector_data( thmfc1->side, thmfc1->sector_id, thmfc1->data + 3, thmfc1->data_size - 3, 0 ); - thom_floppy_active( 1 ); - } - thmfc1->op = THMFC1_OP_RESET; - thmfc1->stat0 |= THMFC1_STAT0_FINISHED; - thmfc1->data_idx = 0; - thmfc1->data_size = 0; - thmfc_floppy_cmd->adjust(attotime::never); -} - - - -TIMER_CALLBACK_MEMBER( thomson_state::thmfc_floppy_cmd_complete_cb ) -{ - thmfc_floppy_cmd_complete(); -} - - - -/* intelligent read: show just one field, skip header */ -UINT8 thomson_state::thmfc_floppy_read_byte() -{ - UINT8 data = thmfc1->data[ thmfc1->data_idx ]; - - VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n", - machine().time().as_double(), m_maincpu->pc(), - thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1, - data )); - - if ( thmfc1->data_idx >= thmfc1->data_size - 1 ) - thmfc_floppy_cmd_complete(); - else - thmfc1->data_idx++; - - if ( thmfc1->data_idx >= thmfc1->data_finish ) - thmfc1->stat0 |= THMFC1_STAT0_FINISHED; - - return data; -} - - - -/* dumb read: show whole track with field headers and gaps */ -UINT8 thomson_state::thmfc_floppy_raw_read_byte() -{ - UINT8 data; - - /* rebuild track if needed */ - if ( ! thmfc1->data_raw_size ) - { - if ( thmfc_floppy_is_qdd(thmfc_floppy_image())) - /* QDD: track = whole disk */ - thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); - else - { - thmfc1->data_raw_idx = 0; - thmfc1->data_raw_size = thom_floppy_make_track( thmfc_floppy_image(), thmfc1->data, - thmfc1->sector_size, thmfc1->side ); - } - assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) ); - } - - if ( thmfc1->data_raw_idx >= thmfc1->data_raw_size ) - data = 0; - else - data = thmfc1->data[ thmfc1->data_raw_idx ]; - - VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n", - machine().time().as_double(), m_maincpu->pc(), - thmfc1->data_raw_idx, thmfc1->data_raw_size, data )); - - thmfc1->data_raw_idx++; - - return data; -} - - - -/* QDD writing / formating */ -void thomson_state::thmfc_floppy_qdd_write_byte( UINT8 data ) -{ - int i; - - if ( thmfc1->formatting && - ( thmfc1->data_idx || data==0xA5 || data==0x5A ) && - thmfc1->data_raw_idx < THOM_MAXBUF ) - { - if ( ! thmfc1->data_raw_size ) - { - thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); - assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) ); - } - - /* accumulate bytes to form a field */ - thmfc1->data[ thmfc1->data_raw_idx ] = data; - thmfc1->data_raw_idx++; - - if ( ! thmfc1->data_idx ) - { - /* start */ - thmfc1->data_crc = 0; - thmfc1->data_idx = thmfc1->data_raw_idx; - } - - VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n", - machine().time().as_double(), m_maincpu->pc(), data, - thmfc1->data_idx,thmfc1->data_raw_idx )); - - if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 && - thmfc1->data[ thmfc1->data_idx - 1 ] == 0xA5 && - thmfc1->data[ thmfc1->data_idx + 2 ] == thmfc1->data_crc ) - { - /* got an id field => format */ - int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ]; - UINT8 filler = 0xff; - - LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", machine().time().as_double(), m_maincpu->pc(), sector )); - - thmfc_floppy_image()->floppy_drive_format_sector( 0, sector, 0, 0, sector, 128, filler ); - thom_floppy_active( 1 ); - thmfc1->data_idx = 0; - } - - else if ( thmfc1->data_raw_idx == thmfc1->data_idx + 129 && - thmfc1->data[ thmfc1->data_idx - 1 ] == 0x5A && - thmfc1->data[ thmfc1->data_idx + 128 ] == thmfc1->data_crc ) - { - /* look backwards for previous id field */ - for ( i = thmfc1->data_idx - 4; i >= 0; i-- ) - { - if ( thmfc1->data[ i ] == 0xA5 && - ( ( thmfc1->data[ i ] + thmfc1->data[ i + 1 ] + - thmfc1->data[ i + 2 ] ) & 0xff - ) == thmfc1->data[ i + 3 ] ) - break; - } - - if ( i >= 0 ) - { - /* got an id & a data field => write */ - legacy_floppy_image_device * img = thmfc_floppy_image(); - int sector = (int) thmfc1->data[ i + 1 ] * 256 + - (int) thmfc1->data[ i + 2 ]; - - LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n", - machine().time().as_double(), m_maincpu->pc(), sector )); - - img->floppy_drive_write_sector_data( 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 ); - thom_floppy_active( 1 ); - } - - thmfc1->data_idx = 0; - - } - else - thmfc1->data_crc += data; - } - else - { - thmfc1->data_raw_idx++; - VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); - } - -} - - - -/* intelligent writing */ -void thomson_state::thmfc_floppy_write_byte( UINT8 data ) -{ - VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", - machine().time().as_double(), m_maincpu->pc(), - thmfc1->data_idx, thmfc1->data_size - 1, data )); - - thmfc1->data_raw_size = 0; - thmfc1->data[ thmfc1->data_idx ] = data; - if ( thmfc1->data_idx >= thmfc1->data_size - 1 ) - thmfc_floppy_cmd_complete(); - else - thmfc1->data_idx++; -} - -/* intelligent formatting */ -void thomson_state::thmfc_floppy_format_byte( UINT8 data ) -{ - VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); - - thmfc1->data_raw_size = 0; - - /* accumulate bytes to form an id field */ - if ( thmfc1->data_idx || data==0xA1 ) - { - static const UINT8 header[] = { 0xa1, 0xa1, 0xa1, 0xfe }; - thmfc1->data[ thmfc1->data_idx ] = data; - thmfc1->data_idx++; - if ( thmfc1->data_idx > 11 ) - { - if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) ) - { - /* got id field => format */ - legacy_floppy_image_device * img = thmfc_floppy_image(); - UINT8 track = thmfc1->data[4]; - UINT8 side = thmfc1->data[5]; - UINT8 sector = thmfc1->data[6]; - UINT8 length = thmfc1->data[7]; /* actually, log length */ - UINT8 filler = 0xe5; /* standard Thomson filler */ - chrn_id id; - if ( thmfc_floppy_find_sector( &id ) ) - { - img->floppy_drive_format_sector( side, thmfc1->sector_id, track, thmfc1->side, sector, length, filler ); - thom_floppy_active( 1 ); - } - } - - thmfc1->data_idx = 0; - } - - } -} - - - -READ8_MEMBER( thomson_state::thmfc_floppy_r ) -{ - switch ( offset ) - { - case 0: /* STAT0 */ - thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL; - VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", machine().time().as_double(), m_maincpu->pc(), thmfc1->stat0 )); - return thmfc1->stat0; - - case 1: /* STAT1 */ - { - UINT8 data = 0; - legacy_floppy_image_device * img = thmfc_floppy_image(); - int flags = img->floppy_drive_get_flag_state(-1 ); - if ( thmfc_floppy_is_qdd(img) ) - { - if ( ! img->exists() ) - data |= 0x40; /* disk present */ - if ( ! thmfc1->ipl ) - data |= 0x02; /* disk start */ - data |= 0x08; /* connected */ - } - else - { - if ( thmfc1->ipl ) - data |= 0x40; - if ( img->exists() ) - data |= 0x20; /* disk change (?) */ - - data |= !img->floppy_tk00_r() << 3; - - if ( flags & FLOPPY_DRIVE_READY ) - data |= 0x02; - } - if (!motor_on) - data |= 0x10; - if (!img->floppy_wpt_r()) - data |= 0x04; - VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); - return data; - } - - case 3: /* RDATA */ - - if ( thmfc1->op == THMFC1_OP_READ_SECT || thmfc1->op == THMFC1_OP_READ_ADDR ) - return thmfc_floppy_read_byte(); - else - return thmfc_floppy_raw_read_byte(); - - case 6: - return 0; - - case 8: - { - /* undocumented => emulate TO7 QDD controller ? */ - UINT8 data = thmfc1->ipl << 7; - VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); - return data; - } - - default: - logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::thmfc_floppy_w ) -{ - switch ( offset ) { - case 0: /* CMD0 */ - { - int wsync = (data >> 4) & 1; - int qdd = thmfc_floppy_is_qdd(thmfc_floppy_image()); - chrn_id id; - thmfc1->formatting = (data >> 2) & 1; - LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n", - machine().time().as_double(), m_maincpu->pc(), data, - (BIT(data, 5) ? "FM" : "MFM"), - wsync, (data >> 3) & 1, - thmfc1->formatting, data & 3 )); - - /* abort previous command, if any */ - thmfc1->op = THMFC1_OP_RESET; - thmfc_floppy_cmd->adjust(attotime::never); - - switch ( data & 3 ) - { - case THMFC1_OP_RESET: - thmfc1->stat0 = THMFC1_STAT0_FINISHED; - break; - - case THMFC1_OP_WRITE_SECT: - if ( qdd ) - logerror( "thmfc_floppy_w: smart operation 1 not supported for QDD\n" ); - else if ( thmfc_floppy_find_sector( &id ) ) - { - thmfc1->sector_id = id.data_id; - thmfc1->data_idx = 0; - thmfc1->data_size = thmfc1->sector_size + 3; /* A1 A1 FB */ - thmfc1->data_finish = thmfc1->sector_size + 3; - thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; - thmfc1->op = THMFC1_OP_WRITE_SECT; - thmfc_floppy_cmd->adjust(attotime::from_msec( 10 )); - } - break; - - case THMFC1_OP_READ_ADDR: - if ( qdd ) - logerror( "thmfc_floppy_w: smart operation 2 not supported for QDD\n" ); - else if ( thmfc_floppy_find_sector( &id ) ) - { - thmfc1->data_size = - thom_floppy_make_addr( id, thmfc1->data, thmfc1->sector_size ); - assert( thmfc1->data_size < sizeof( thmfc1->data ) ); - thmfc1->data_finish = 10; - thmfc1->data_idx = 1; - thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; - thmfc1->op = THMFC1_OP_READ_ADDR; - thmfc_floppy_cmd->adjust(attotime::from_msec( 1 )); - } - break; - - case THMFC1_OP_READ_SECT: - if ( qdd ) - logerror( "thmfc_floppy_w: smart operation 3 not supported for QDD\n" ); - else if ( thmfc_floppy_find_sector( &id ) ) - { - thmfc1->data_size = thom_floppy_make_sector - ( thmfc_floppy_image(), id, thmfc1->data, thmfc1->sector_size ); - assert( thmfc1->data_size < sizeof( thmfc1->data ) ); - thmfc1->data_finish = thmfc1->sector_size + 4; - thmfc1->data_idx = 1; - thmfc1->stat0 |= THMFC1_STAT0_BYTE_READY_OP; - thmfc1->op = THMFC1_OP_READ_SECT; - thmfc_floppy_cmd->adjust(attotime::from_msec( 10 )); - } - break; - } - - /* synchronize to word, if needed (QDD only) */ - if ( wsync && qdd ) { - if ( ! thmfc1->data_raw_size ) - thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); - while ( thmfc1->data_raw_idx < thmfc1->data_raw_size && - thmfc1->data[ thmfc1->data_raw_idx ] != thmfc1->wsync ) - { - thmfc1->data_raw_idx++; - } - } - } - - break; - - - case 1: /* CMD1 */ - thmfc1->data_raw_size = 0; - thmfc1->sector_size = 128 << ( (data >> 5) & 3); - thmfc1->side = (data >> 4) & 1; - if ( thmfc1->sector_size > 256 ) - { - logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n", - m_maincpu->pc(), thmfc1->sector_size ); - thmfc1->sector_size = 256; - } - - LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n", - machine().time().as_double(), m_maincpu->pc(), data, - thmfc1->sector_size, (data >> 1) & 7, thmfc1->side )); - break; - - - case 2: /* CMD2 */ - { - legacy_floppy_image_device * img; - int seek = 0, motor; - thmfc1->drive = data & 2; - - img = thmfc_floppy_image(); - if ( thmfc_floppy_is_qdd(img)) - { - motor = !(data & 0x40); - /* no side select & no seek for QDD */ - } - else - { - if ( data & 0x10 ) - seek = (data & 0x20) ? 1 : -1; - motor = (data >> 2) & 1; - thmfc1->drive |= 1 ^ ((data >> 6) & 1); - img = thmfc_floppy_image(); - } - - thom_floppy_active( 0 ); - - LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n", - machine().time().as_double(), m_maincpu->pc(), data, - thmfc1->drive, seek, motor )); - - if ( seek ) - { - thmfc1->data_raw_size = 0; - img->floppy_drive_seek( seek ); - } - - /* in real life, to keep the motor running, it is sufficient to - set motor to 1 every few seconds. - instead of counting, we assume the motor is always running... - */ - motor_on = CLEAR_LINE /* motor */; - img->floppy_mon_w(motor_on); - } - break; - - - case 3: /* WDATA */ - thmfc1->wsync = data; - if ( thmfc_floppy_is_qdd(thmfc_floppy_image())) - thmfc_floppy_qdd_write_byte( data ); - else if ( thmfc1->op==THMFC1_OP_WRITE_SECT ) - thmfc_floppy_write_byte( data ); - else if ( thmfc1->formatting ) - thmfc_floppy_format_byte( data ); - else - { - /* TODO: implement other forms of raw track writing */ - LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n", - machine().time().as_double(), m_maincpu->pc(), data )); - } - break; - - - case 4: /* WCLK (unemulated) */ - /* clock configuration: FF for data, 0A for synchro */ - LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n", - machine().time().as_double(), m_maincpu->pc(), data, - (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" )); - break; - - case 5: /* WSECT */ - thmfc1->sector = data; - LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n", - machine().time().as_double(), m_maincpu->pc(), data )); - break; - - case 6: /* WTRCK */ - thmfc1->track = data; - LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", - machine().time().as_double(), m_maincpu->pc(), data, - thmfc_floppy_image()->floppy_drive_get_current_track())); - break; - - case 7: /* WCELL */ - /* precompensation (unemulated) */ - LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n", - machine().time().as_double(), m_maincpu->pc(), data )); - break; - - default: - logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n", - machine().time().as_double(), m_maincpu->pc(), offset, data ); - } -} - - - -void thomson_state::thmfc_floppy_reset() -{ - int i; - LOG(( "thmfc_floppy_reset: THMFC1 controller\n" )); - - for ( i = 0; i < floppy_get_count( machine() ); i++ ) - { - legacy_floppy_image_device * img = floppy_get_device( machine(), i ); - if (img) { - img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 ); - img->floppy_drive_seek( - img->floppy_drive_get_current_track() ); - } - } - - thmfc1->op = THMFC1_OP_RESET; - thmfc1->track = 0; - thmfc1->sector = 0; - thmfc1->side = 0; - thmfc1->drive = 0; - thmfc1->sector_size = 256; - thmfc1->formatting = 0; - thmfc1->stat0 = 0; - thmfc1->data_idx = 0; - thmfc1->data_size = 0; - thmfc1->data_raw_idx = 0; - thmfc1->data_raw_size = 0; - thmfc1->data_crc = 0; - thmfc1->wsync = 0; - thmfc_floppy_cmd->adjust(attotime::never); -} - - - -void thomson_state::thmfc_floppy_init() -{ - LOG(( "thmfc_floppy_init: THMFC1 controller\n" )); - - thmfc1 = auto_alloc(machine(), thmfc1_t); - memset(thmfc1, 0, sizeof(thmfc1_t)); - - thmfc_floppy_cmd = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thmfc_floppy_cmd_complete_cb),this)); - - save_item(NAME(thmfc1->op)); - save_item(NAME(thmfc1->sector)); - save_item(NAME(thmfc1->sector_id)); - save_item(NAME(thmfc1->track)); - save_item(NAME(thmfc1->side)); - save_item(NAME(thmfc1->drive)); - save_item(NAME(thmfc1->sector_size)); - save_item(NAME(thmfc1->formatting)); - save_item(NAME(thmfc1->ipl)); - save_item(NAME(thmfc1->data_idx)); - save_item(NAME(thmfc1->data_size)); - save_item(NAME(thmfc1->data_finish)); - save_item(NAME(thmfc1->stat0)); - save_item(NAME(thmfc1->data_raw_idx)); - save_item(NAME(thmfc1->data_raw_size)); - save_item(NAME(thmfc1->data_crc)); - save_item(NAME(thmfc1->wsync)); - save_item(NAME(thmfc1->data)); -} - - - -/*********************** Network ************************/ - -/* The network extension is built as an external floppy controller. - It uses the same ROM and I/O space, and so, it is natural to have the - toplevel network emulation here! -*/ - -/* NOTE: This is work in progress! - For the moment, only hand-checks works: the TO7 can take the line, then - perform a DKBOOT request. We do not have the server emulated yet, so, - no way to answer the request. -*/ - -TIMER_CALLBACK_MEMBER( thomson_state::ans4 ) -{ - LOG(( "%f ans4\n", machine().time().as_double() )); - m_mc6854->set_cts( 0 ); -} - -TIMER_CALLBACK_MEMBER( thomson_state::ans3 ) -{ - LOG(( "%f ans3\n", machine().time().as_double() )); - m_mc6854->set_cts( 1 ); - machine().scheduler().timer_set( attotime::from_usec( 100 ), timer_expired_delegate(FUNC(thomson_state::ans4),this)); -} - -TIMER_CALLBACK_MEMBER( thomson_state::ans2 ) -{ - LOG(( "%f ans2\n", machine().time().as_double() )); - m_mc6854->set_cts( 0 ); - machine().scheduler().timer_set( attotime::from_usec( 100 ), timer_expired_delegate(FUNC(thomson_state::ans3),this)); -} - -TIMER_CALLBACK_MEMBER( thomson_state::ans ) -{ - LOG(( "%f ans\n", machine().time().as_double() )); - m_mc6854->set_cts( 1 ); - machine().scheduler().timer_set( attotime::from_usec( 100 ), timer_expired_delegate(FUNC(thomson_state::ans2),this)); -} -/* consigne DKBOOT - - MO5 BASIC - $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $01 $00<$41 $00 $FF $20 - $3D $4C $01 $60 $20 $3C $4F $01 $05 $20 $3F $9C $19 $25 $03 $11 - $93 $15 $10 $25 $32 $8A $7E $FF $E1 $FD $E9 $41>$00 $00 $00 $00 - $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 - - TO7/70 BASIC - $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $02 $00<$20 $42 $41 $53 - $49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30 - $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00 - $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 - - TO7 BASIC - $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$20 $42 $41 $53 - $49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30 - $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00 - $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 - - TO7 LOGO - $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$00 $00 $00 $00 - $00 $20 $4C $4F $47 $4F $04 $00 $00 $00 $00 $00 $00 $00 $00 $00 - $00 $00 $00 $00 $00 $00 $AA $FF $01 $16 $00 $C8>$00 $00 $00 $00 - $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 - - -*/ - -MC6854_OUT_FRAME_CB(thomson_state::to7_network_got_frame) -{ - LOG(( "%f to7_network_got_frame:", machine().time().as_double() )); - for ( int i = 0; i < length; i++ ) - LOG(( " $%02X", data[i] )); - LOG(( "\n" )); - - if ( data[1] == 0xff ) - { - LOG(( "to7_network_got_frame: %i phones %i\n", data[2], data[0] )); - machine().scheduler().timer_set( attotime::from_usec( 100 ), timer_expired_delegate(FUNC(thomson_state::ans), this)); - m_mc6854->set_cts( 0 ); - } - else if ( ! data[1] ) - { - char name[33]; - memcpy( name, data + 12, 32 ); - name[32] = 0; - for (int i=0;i<32;i++) - { - if ( name[i]<32 || name[i]>=127 ) - name[i]=' '; - } - LOG(( "to7_network_got_frame: DKBOOT system=%s appli=\"%s\"\n", - (data[10] == 0) ? "TO7" : (data[10] == 1) ? "MO5" : - (data[10] == 2) ? "TO7/70" : "?", name )); - } -} - - -void thomson_state::to7_network_init() -{ - LOG(( "to7_network_init: NR 07-005 network extension\n" )); - logerror( "to7_network_init: network not handled!\n" ); -} - - - -void thomson_state::to7_network_reset() -{ - LOG(( "to7_network_reset: NR 07-005 network extension\n" )); - m_mc6854->set_cts( 0 ); - m_mc6854->set_cts( 1 ); -} - - - -READ8_MEMBER( thomson_state::to7_network_r ) -{ - if ( offset < 4 ) - return m_mc6854->read( space, offset ); - - if ( offset == 8 ) - { - /* network ID of the computer */ - UINT8 id = m_io_fconfig->read() >> 3; - VLOG(( "%f $%04x to7_network_r: read id $%02X\n", machine().time().as_double(), m_maincpu->pc(), id )); - return id; - } - - logerror( "%f $%04x to7_network_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); - return 0; -} - - - -WRITE8_MEMBER( thomson_state::to7_network_w ) -{ - if ( offset < 4 ) - m_mc6854->write( space, offset, data ); - else - { - logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n", - machine().time().as_double(), m_maincpu->pc(), offset, data ); - } -} - - - -/*********************** TO7 dispatch ************************/ - -/* The TO7, TO7/70, MO5 and MO6 can use a variety of floppy controllers. - We use a PORT_CONFSETTING to chose the current controller, and dispatch - here. - - NOTE: you need to reset the computer after changing the floppy controller! - - The CD 90-351 controller seems similar to the THMFC1 gate-array - => we reuse the THMFC code! -*/ - - - -UINT8 to7_controller_type; -UINT8 to7_floppy_bank; - - -void thomson_state::to7_floppy_init( void* base ) -{ - m_flopbank->configure_entries( 0, TO7_NB_FLOP_BANK, base, 0x800 ); - save_item(NAME(to7_controller_type)); - save_item(NAME(to7_floppy_bank)); - to7_5p14sd_init(); - to7_5p14_init(); - to7_qdd_init(); - thmfc_floppy_init(); - to7_network_init(); -} - - - -void thomson_state::to7_floppy_reset() -{ - to7_controller_type = (m_io_fconfig->read() ) & 7; - - switch ( to7_controller_type ) - { - case 1: - to7_floppy_bank = 1; - to7_5p14sd_reset(); - break; - - case 2: - to7_floppy_bank = 2; - to7_5p14_reset(); - break; - - case 3: - to7_floppy_bank = 3; - thmfc_floppy_reset(); - break; - - case 4: - to7_floppy_bank = 7; - to7_qdd_reset(); - break; - - case 5: - to7_floppy_bank = 8; - to7_network_reset(); - break; - - default: - to7_floppy_bank = 0; - break; - } - - m_flopbank->set_entry( to7_floppy_bank ); -} - - - -READ8_MEMBER( thomson_state::to7_floppy_r ) -{ - switch ( to7_controller_type ) - { - case 1: - return to7_5p14sd_r( space, offset, mem_mask ); - - case 2: - return to7_5p14_r( space, offset, mem_mask ); - - case 3: - return thmfc_floppy_r( space, offset ); - - case 4: - return to7_qdd_r( space, offset, mem_mask ); - - case 5: - return to7_network_r( space, offset, mem_mask ); - } - - return 0; -} - - - -WRITE8_MEMBER( thomson_state::to7_floppy_w ) -{ - switch ( to7_controller_type ) - { - case 1: - to7_5p14sd_w( space, offset, data, mem_mask ); - return; - - case 2: - to7_5p14_w( space, offset, data, mem_mask ); - break; - - case 3: - if ( offset == 8 ) - { - to7_floppy_bank = 3 + (data & 3); - m_flopbank->set_entry( to7_floppy_bank ); - VLOG (( "to7_floppy_w: set CD 90-351 ROM bank to %i\n", data & 3 )); - } - else - thmfc_floppy_w( space, offset, data ); - break; - - case 4: - to7_qdd_w( space, offset, data, mem_mask ); - break; - - case 5: - to7_network_w( space, offset, data, mem_mask ); - break; - } -} - - - -/*********************** TO9 ************************/ - -/* the internal controller is WD2793-based (so, similar to to7_5p14) - we also emulate external controllers -*/ - - - -void thomson_state::to9_floppy_init( void* int_base, void* ext_base ) -{ - to7_floppy_init( ext_base ); - m_flopbank->configure_entry( TO7_NB_FLOP_BANK, int_base); -} - - - -void thomson_state::to9_floppy_reset() -{ - to7_floppy_reset(); - if ( THOM_FLOPPY_EXT ) - { - LOG(( "to9_floppy_reset: external controller\n" )); - } - else - { - LOG(( "to9_floppy_reset: internal controller\n" )); - to7_5p14_reset(); - m_flopbank->set_entry( TO7_NB_FLOP_BANK ); - } -} - - - -READ8_MEMBER( thomson_state::to9_floppy_r ) -{ - if ( THOM_FLOPPY_EXT ) - return to7_floppy_r( space, offset ); - else - return to7_5p14_r( space, offset, mem_mask ); -} - -WRITE8_MEMBER( thomson_state::to9_floppy_w ) -{ - if ( THOM_FLOPPY_EXT ) - to7_floppy_w( space, offset, data ); - else - to7_5p14_w( space, offset, data, mem_mask ); -} - -void thomson_state::thomson_index_callback(legacy_floppy_image_device *device, int state) -{ - switch ( to7_controller_type ) - { - case 1: - to7_5p14_index_pulse_callback(NULL, device, state); - break; - - case 2: - break; - - case 3: - thmfc_floppy_index_pulse_cb(NULL, device, state); - break; - - case 4: - to7_qdd_index_pulse_cb(NULL, device, state); - break; - - default: - break; - } -} diff --git a/src/mess/machine/thomflop.h b/src/mess/machine/thomflop.h deleted file mode 100644 index 5c85f9e0d43..00000000000 --- a/src/mess/machine/thomflop.h +++ /dev/null @@ -1,36 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Thomson 8-bit computers - -**********************************************************************/ - -#ifndef THOMFLOP_H_ -#define THOMFLOP_H_ - -#include "image.h" -#include "imagedev/flopdrv.h" -#include "machine/mc6843.h" -#include "machine/mc6854.h" - -extern UINT8 to7_controller_type; /* set during init */ -extern UINT8 to7_floppy_bank; - -/* number of external floppy controller ROM banks */ -#define TO7_NB_FLOP_BANK 9 - -/* external floppy / network controller active */ -#define THOM_FLOPPY_EXT (to7_controller_type >= 1) - -/* internal floppy controller active (no or network extension) */ -#define THOM_FLOPPY_INT (to7_controller_type == 0 || to7_controller_type > 4) - - -/* external controllers */ -/* TO9 internal (WD2793) & external controllers */ -/* TO8 internal (THMFC1) controller */ - -#endif /* THOMFLOP_H_ */ diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c deleted file mode 100644 index 240b004141a..00000000000 --- a/src/mess/machine/thomson.c +++ /dev/null @@ -1,4794 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Thomson 8-bit computers - -**********************************************************************/ - -#include "emu.h" -#include "machine/thomflop.h" -#include "formats/thom_dsk.h" -#include "includes/thomson.h" -#include "machine/6821pia.h" -#include "machine/ram.h" - -#define VERBOSE 0 -#define VERBOSE_IRQ 0 -#define VERBOSE_KBD 0 /* TO8 / TO9 / TO9+ keyboard */ -#define VERBOSE_BANK 0 -#define VERBOSE_VIDEO 0 /* video & lightpen */ -#define VERBOSE_IO 0 /* serial & parallel I/O */ -#define VERBOSE_MIDI 0 - -#define PRINT(x) osd_printf_info x - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) -#define VLOG(x) do { if (VERBOSE > 1) logerror x; } while (0) -#define LOG_IRQ(x) do { if (VERBOSE_IRQ) logerror x; } while (0) -#define LOG_KBD(x) do { if (VERBOSE_KBD) logerror x; } while (0) -#define LOG_BANK(x) do { if (VERBOSE_BANK) logerror x; } while (0) -#define LOG_VIDEO(x) do { if (VERBOSE_VIDEO) logerror x; } while (0) -#define LOG_IO(x) do { if (VERBOSE_IO) logerror x; } while (0) -#define LOG_MIDI(x) do { if (VERBOSE_MIDI) logerror x; } while (0) - -/* This set to 1 handle the .k7 files without passing through .wav */ -/* It must be set accordingly in formats/thom_cas.c */ -#define K7_SPEED_HACK 0 - - -/*-------------- TO7 ------------*/ - - -/* On the TO7 & compatible (TO7/70,TO8,TO9, but not MO5,MO6), bits are coded - in FM format with a 1.1 ms period (900 bauds): - - 0 is 5 periods at 4.5 kHz - - 1 is 7 periods at 6.3 kHz - - Moreover, a byte is represented using 11 bits: - - one 0 start bit - - eight data bits (low bit first) - - two 1 stop bits - - There are also long (1 s) sequences of 1 bits to re-synchronize the - cassette at places the motor can be cut off and back on (e.g., between - files). - - The computer outputs a modulated wave that is directly put on the cassette. - However, the input is demodulated by the cassette-reader before being - sent to the computer: we got 0 when the signal is around 4.5 kHz and - 1 when the signal is around 6.3 kHz. -*/ - -#define TO7_BIT_LENGTH 0.001114 - -/* 1-bit cassette input to the computer - inside the controller, two frequency filters (adjusted to 6.3 and 4.5 kHz) - and a comparator demodulate the raw signal into 0s and 1s. -*/ -int thomson_state::to7_get_cassette() -{ - if ( m_cassette->exists() ) - { - cassette_image* cass = m_cassette->get_image(); - cassette_state state = m_cassette->get_state(); - double pos = m_cassette->get_position(); - int bitpos = pos / TO7_BIT_LENGTH; - - if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) - return 1; - - if ( K7_SPEED_HACK && m_to7_k7_bits ) - { - /* hack, feed existing bits */ - if ( bitpos >= m_to7_k7_bitsize ) - bitpos = m_to7_k7_bitsize -1; - VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n", - m_maincpu->pc(), machine().time().as_double(), state, pos, bitpos, - m_to7_k7_bits[ bitpos ] )); - return m_to7_k7_bits[ bitpos ]; - } - else - { - /* demodulate wave signal on-the-fly */ - /* we simply count sign changes... */ - int k, chg; - INT8 data[40]; - cassette_get_samples( cass, 0, pos, TO7_BIT_LENGTH * 15. / 14., 40, 1, data, 0 ); - - for ( k = 1, chg = 0; k < 40; k++ ) - { - if ( data[ k - 1 ] >= 0 && data[ k ] < 0 ) - chg++; - if ( data[ k - 1 ] <= 0 && data[ k ] > 0 ) - chg++; - } - k = ( chg >= 13 ) ? 1 : 0; - VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n", - m_maincpu->pc(), machine().time().as_double(), state, pos, bitpos, - k, chg )); - return k; - } - - } - else - return 0; -} - - - -/* 1-bit cassette output */ -void thomson_state::to7_set_cassette( int data ) -{ - m_cassette->output(data ? 1. : -1. ); -} - - - -WRITE_LINE_MEMBER( thomson_state::to7_set_cassette_motor ) -{ - cassette_state cassstate = m_cassette->get_state(); - double pos = m_cassette->get_position(); - - LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n", - m_maincpu->pc(), machine().time().as_double(), state ? "off" : "on", - (int) (pos / TO7_BIT_LENGTH) )); - - if ( (cassstate & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !state && pos > 0.3 ) - { - /* rewind a little before starting the motor */ - m_cassette->seek(-0.3, SEEK_CUR ); - } - - m_cassette->change_state(state ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR ); -} - - - -/*-------------- MO5 ------------*/ - - -/* Each byte is represented as 8 bits without start or stop bit (unlike TO7). - Bits are coded in MFM, and the MFM signal is directly fed to the - computer which has to decode it in software (unlike TO7). - A 1 bit is one period at 1200 Hz; a 0 bit is one half-period at 600 Hz. - Bit-order is most significant bit first (unlike TO7). - - Double-density MO6 cassettes follow the exact same mechanism, but with - at double frequency (perdiods at 2400 Hz, and half-perdios at 1200 Hz). -*/ - - -#define MO5_BIT_LENGTH 0.000833 -#define MO5_HBIT_LENGTH (MO5_BIT_LENGTH / 2.) - - -int thomson_state::mo5_get_cassette() -{ - if ( m_cassette->exists() ) - { - cassette_image* cass = m_cassette->get_image(); - cassette_state state = m_cassette->get_state(); - double pos = m_cassette->get_position(); - INT32 hbit; - - if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) - return 1; - - cassette_get_sample( cass, 0, pos, 0, &hbit ); - hbit = hbit >= 0; - - VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", - m_maincpu->pc(), machine().time().as_double(), state, pos, - (int) (pos / MO5_HBIT_LENGTH), hbit )); - return hbit; - } - else - return 0; -} - - - -void thomson_state::mo5_set_cassette( int data ) -{ - m_cassette->output(data ? 1. : -1. ); -} - - - -WRITE_LINE_MEMBER( thomson_state::mo5_set_cassette_motor ) -{ - cassette_state cassstate = m_cassette->get_state(); - double pos = m_cassette->get_position(); - - LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n", - m_maincpu->pc(), machine().time().as_double(), state ? "off" : "on", - (int) (pos / MO5_HBIT_LENGTH) )); - - if ( (cassstate & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !state && pos > 0.3 ) - { - /* rewind a little before starting the motor */ - m_cassette->seek(-0.3, SEEK_CUR ); - } - - m_cassette->change_state(state ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR ); -} - - - - -/*************************** utilities ********************************/ - - - -/* ------------ IRQs ------------ */ - - -void thomson_state::thom_set_irq( int line, int state ) -{ - int old = m_thom_irq; - - if ( state ) - m_thom_irq |= 1 << line; - else - m_thom_irq &= ~(1 << line); - - if ( !old && m_thom_irq ) - LOG_IRQ(( "%f thom_set_irq: irq line up %i\n", machine().time().as_double(), line )); - if ( old && !m_thom_irq ) - LOG_IRQ(( "%f thom_set_irq: irq line down %i\n", machine().time().as_double(), line )); - - m_maincpu->set_input_line(M6809_IRQ_LINE, m_thom_irq ? ASSERT_LINE : CLEAR_LINE); -} - - - -void thomson_state::thom_set_firq ( int line, int state ) -{ - int old = m_thom_firq; - - if ( state ) - m_thom_firq |= 1 << line; - else - m_thom_firq &= ~(1 << line); - - if ( !old && m_thom_firq ) - LOG_IRQ(( "%f thom_set_firq: firq line up %i\n", machine().time().as_double(), line )); - if ( old && !m_thom_firq ) - LOG_IRQ(( "%f thom_set_firq: firq line down %i\n", machine().time().as_double(), line )); - - m_maincpu->set_input_line(M6809_FIRQ_LINE, m_thom_firq ? ASSERT_LINE : CLEAR_LINE); -} - - - -void thomson_state::thom_irq_reset() -{ - m_thom_irq = 0; - m_thom_firq = 0; - m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE ); - m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE ); -} - - - -void thomson_state::thom_irq_init() -{ - save_item(NAME(m_thom_irq)); - save_item(NAME(m_thom_firq)); -} - - - -void thomson_state::thom_irq_0( int state ) -{ - thom_set_irq( 0, state ); -} - -WRITE_LINE_MEMBER( thomson_state::thom_dev_irq_0 ) -{ - thom_irq_0( state ); -} - - - -WRITE_LINE_MEMBER( thomson_state::thom_irq_1 ) -{ - thom_set_irq ( 1, state ); -} - -void thomson_state::thom_irq_3( int state ) -{ - thom_set_irq ( 3, state ); -} - -WRITE_LINE_MEMBER( thomson_state::thom_firq_1 ) -{ - thom_set_firq ( 1, state ); -} - -void thomson_state::thom_firq_2( int state ) -{ - thom_set_firq ( 2, state ); -} - -void thomson_state::thom_irq_4( int state ) -{ - thom_set_irq ( 4, state ); -} - - -/* - current IRQ usage: - - line 0 => 6846 interrupt - line 1 => 6821 interrupts (shared for all 6821) - line 2 => TO8 lightpen interrupt (from gate-array) - line 3 => TO9 keyboard interrupt (from 6850 ACIA) - line 4 => MIDI interrupt (from 6850 ACIA) -*/ - - - -/* ------------ LED ------------ */ - - - -void thomson_state::thom_set_caps_led( int led ) -{ - output_set_value( "led0", led ); -} - -/* ------------ 6850 defines ------------ */ - -#define ACIA_6850_RDRF 0x01 /* Receive data register full */ -#define ACIA_6850_TDRE 0x02 /* Transmit data register empty */ -#define ACIA_6850_dcd 0x04 /* Data carrier detect, active low */ -#define ACIA_6850_cts 0x08 /* Clear to send, active low */ -#define ACIA_6850_FE 0x10 /* Framing error */ -#define ACIA_6850_OVRN 0x20 /* Receiver overrun */ -#define ACIA_6850_PE 0x40 /* Parity error */ -#define ACIA_6850_irq 0x80 /* Interrupt request, active low */ - - - -/***************************** TO7 / T9000 *************************/ - -DEVICE_IMAGE_LOAD_MEMBER( thomson_state, to7_cartridge ) -{ - int i,j; - UINT8* pos = memregion("maincpu" )->base() + 0x10000; - offs_t size; - char name[129]; - - if (image.software_entry() == NULL) - size = image.length(); - else - size = image.get_software_region_length("rom"); - - /* get size & number of 16-KB banks */ - if ( size <= 0x04000 ) - m_thom_cart_nb_banks = 1; - else if ( size == 0x08000 ) - m_thom_cart_nb_banks = 2; - else if ( size == 0x10000 ) - m_thom_cart_nb_banks = 4; - else - { - std::string errmsg; - strprintf(errmsg,"Invalid cartridge size %u", size); - image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); - return IMAGE_INIT_FAIL; - } - - if (image.software_entry() == NULL) - { - if ( image.fread( pos, size ) != size ) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Read error"); - return IMAGE_INIT_FAIL; - } - } - else - { - memcpy(pos, image.get_software_region("rom"), size); - } - - /* extract name */ - for ( i = 0; i < size && pos[i] != ' '; i++ ); - for ( i++, j = 0; i + j < size && j < 128 && pos[i+j] >= 0x20; j++) - name[j] = pos[i+j]; - name[j] = 0; - - /* sanitize name */ - for ( i = 0; name[i]; i++) - { - if ( name[i] < ' ' || name[i] >= 127 ) - name[i] = '?'; - } - - PRINT (( "to7_cartridge_load: cartridge \"%s\" banks=%i, size=%i\n", name, m_thom_cart_nb_banks, size )); - - return IMAGE_INIT_PASS; -} - - - -void thomson_state::to7_update_cart_bank() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - int bank = 0; - if ( m_thom_cart_nb_banks ) - { - bank = m_thom_cart_bank % m_thom_cart_nb_banks; - if ( bank != m_old_cart_bank && m_old_cart_bank < 0 ) - { - space.install_read_handler(0x0000, 0x0003, read8_delegate(FUNC(thomson_state::to7_cartridge_r),this) ); - } - } - if ( bank != m_old_cart_bank ) - { - m_cartbank->set_entry( bank ); - m_old_cart_bank = bank; - LOG_BANK(( "to7_update_cart_bank: CART is cartridge bank %i\n", bank )); - } -} - - - -void thomson_state::to7_update_cart_bank_postload() -{ - to7_update_cart_bank(); -} - - - -/* write signal to 0000-1fff generates a bank switch */ -WRITE8_MEMBER( thomson_state::to7_cartridge_w ) -{ - if ( offset >= 0x2000 ) - return; - - m_thom_cart_bank = offset & 3; - to7_update_cart_bank(); -} - - - -/* read signal to 0000-0003 generates a bank switch */ -READ8_MEMBER( thomson_state::to7_cartridge_r ) -{ - UINT8* pos = memregion( "maincpu" )->base() + 0x10000; - UINT8 data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; - if ( !space.debugger_access() ) - { - m_thom_cart_bank = offset & 3; - to7_update_cart_bank(); - } - return data; -} - - - -/* ------------ 6846 (timer, I/O) ------------ */ - - - -WRITE8_MEMBER( thomson_state::to7_timer_port_out ) -{ - thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - thom_set_caps_led( (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */ - thom_set_border_color( ((data & 0x10) ? 1 : 0) | /* bits 4-6: border color */ - ((data & 0x20) ? 2 : 0) | - ((data & 0x40) ? 4 : 0) ); -} - - - -WRITE8_MEMBER( thomson_state::to7_timer_cp2_out ) -{ - m_buzzer->write_unsigned8(data ? 0x80 : 0); /* 1-bit buzzer */ -} - - - -READ8_MEMBER( thomson_state::to7_timer_port_in ) -{ - int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; - int cass = to7_get_cassette() ? 0x80 : 0; - return lightpen | cass; -} - - - -WRITE8_MEMBER( thomson_state::to7_timer_tco_out ) -{ - /* 1-bit cassette output */ - to7_set_cassette( data ); -} - - -/* ------------ lightpen automaton ------------ */ - - -void thomson_state::to7_lightpen_cb( int step ) -{ - if ( ! m_to7_lightpen ) - return; - - LOG_VIDEO(( "%f to7_lightpen_cb: step=%i\n", machine().time().as_double(), step )); - m_pia_sys->cb1_w( 1 ); - m_pia_sys->cb1_w( 0 ); - m_to7_lightpen_step = step; -} - - - -/* ------------ video ------------ */ - - - -void thomson_state::to7_set_init( int init ) -{ - /* INIT signal wired to system PIA 6821 */ - - LOG_VIDEO(( "%f to7_set_init: init=%i\n", machine().time().as_double(), init )); - m_pia_sys->ca1_w( init ); -} - - - -/* ------------ system PIA 6821 ------------ */ - - - -WRITE_LINE_MEMBER( thomson_state::to7_sys_cb2_out ) -{ - m_to7_lightpen = !state; -} - - - -WRITE8_MEMBER( thomson_state::to7_sys_portb_out ) -{ - /* value fetched in to7_sys_porta_in */ -} - - - -#define TO7_LIGHTPEN_DECAL 17 /* horizontal lightpen shift, stored in $60D2 */ - - - -READ8_MEMBER( thomson_state::to7_sys_porta_in ) -{ - if ( m_to7_lightpen ) - { - /* lightpen hi */ - return to7_lightpen_gpl( TO7_LIGHTPEN_DECAL, m_to7_lightpen_step ) >> 8; - } - else - { - /* keyboard */ - int keyline = m_pia_sys->b_output(); - UINT8 val = 0xff; - int i; - - for ( i = 0; i < 8; i++ ) - { - if ( ! (keyline & (1 << i)) ) - val &= m_io_keyboard[i]->read(); - } - return val; - } -} - - - -READ8_MEMBER( thomson_state::to7_sys_portb_in ) -{ - /* lightpen low */ - return to7_lightpen_gpl( TO7_LIGHTPEN_DECAL, m_to7_lightpen_step ) & 0xff; -} - - - -/* ------------ CC 90-232 I/O extension ------------ */ - -/* Features: - - 6821 PIA - - serial RS232: bit-banging? - - parallel CENTRONICS: a printer (-prin) is emulated - - usable on TO7(/70), MO5(E) only; not on TO9 and higher - - Note: it seems impossible to connect both a serial & a parallel device - because the Data Transmit Ready bit is shared in an incompatible way! -*/ - -const device_type TO7_IO_LINE = &device_creator; - -//------------------------------------------------- -// to7_io_line_device - constructor -//------------------------------------------------- - -to7_io_line_device::to7_io_line_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, TO7_IO_LINE, "T07 Serial source", tag, owner, clock, "to7_io_line", __FILE__), - m_pia_io(*this, THOM_PIA_IO), - m_rs232(*this, "rs232"), - m_last_low(0) -{ -} - -static MACHINE_CONFIG_FRAGMENT( to7_io_line ) - /// THIS PIO is part of CC 90-232 expansion - MCFG_DEVICE_ADD(THOM_PIA_IO, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(to7_io_line_device, porta_in)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(to7_io_line_device, porta_out)) - MCFG_PIA_WRITEPB_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) - MCFG_PIA_CB2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) - MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("^", thomson_state, thom_firq_1)) - MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("^", thomson_state, thom_firq_1)) - - MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(WRITELINE(to7_io_line_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(WRITELINE(to7_io_line_device, write_cts)) - MCFG_RS232_DSR_HANDLER(WRITELINE(to7_io_line_device, write_dsr)) - - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(THOM_PIA_IO, pia6821_device, cb1_w)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(to7_io_line_device, write_centronics_busy)) - - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - -MACHINE_CONFIG_END - -machine_config_constructor to7_io_line_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( to7_io_line ); -} - -void to7_io_line_device::device_start() -{ - m_rs232->write_dtr(0); -} - -WRITE8_MEMBER( to7_io_line_device::porta_out ) -{ - int txd = (data >> 0) & 1; - int rts = (data >> 1) & 1; - - LOG_IO(( "%s %f to7_io_porta_out: txd=%i, rts=%i\n", machine().describe_context(), machine().time().as_double(), txd, rts )); - - m_rs232->write_txd(txd); - m_rs232->write_rts(rts); -} - - - -WRITE_LINE_MEMBER(to7_io_line_device::write_rxd ) -{ - m_rxd = state; -} - -WRITE_LINE_MEMBER(to7_io_line_device::write_dsr ) -{ - if (!state) m_last_low = 0; - - m_dsr = state; -} - -WRITE_LINE_MEMBER(to7_io_line_device::write_cts ) -{ - m_pia_io->ca1_w(state); - m_cts = state; -} - -WRITE_LINE_MEMBER(to7_io_line_device::write_centronics_busy ) -{ - if (!state) m_last_low = 1; - - m_centronics_busy = state; -} - - -READ8_MEMBER( to7_io_line_device::porta_in ) -{ - LOG_IO(( "%s %f to7_io_porta_in: select=%i cts=%i, dsr=%i, rd=%i\n", machine().describe_context(), machine().time().as_double(), m_centronics_busy, m_cts, m_dsr, m_rxd )); - - /// HACK: without high impedance we can't tell whether a device is driving a line high or if it's being pulled up. - /// so assume the last device to drive it low is active. - int dsr; - if (m_last_low == 0) - dsr = m_dsr; - else - dsr = !m_centronics_busy; - - return (0x1f /* not required when converted to write_pa */) | (m_cts << 5) | (dsr << 6) | (m_rxd << 7); -} - - - -/* ------------ RF 57-932 RS232 extension ------------ */ - -/* Features: - - SY 6551 ACIA. - - higher transfer rates than the CC 90-232 - - usable on all computer, including TO9 and higher - */ - - - -/* ------------ MD 90-120 MODEM extension (not functional) ------------ */ - -/* Features: - - 6850 ACIA - - 6821 PIA - - asymetric 1200/ 75 bauds (reversable) - - TODO! - */ - - -WRITE_LINE_MEMBER( thomson_state::to7_modem_cb ) -{ - LOG(( "to7_modem_cb: called %i\n", state )); -} - - - -WRITE_LINE_MEMBER( thomson_state::to7_modem_tx_w ) -{ - m_to7_modem_tx = state; -} - - -WRITE_LINE_MEMBER( thomson_state::write_acia_clock ) -{ - m_acia6850->write_txc(state); - m_acia6850->write_rxc(state); -} - -void thomson_state::to7_modem_reset() -{ - LOG (( "to7_modem_reset called\n" )); - m_acia->write_rxd(0); - m_to7_modem_tx = 0; - /* pia_reset() is called in machine_reset */ - /* acia_6850 has no reset (?) */ -} - - - -void thomson_state::to7_modem_init() -{ - LOG (( "to7_modem_init: MODEM not implemented!\n" )); - save_item(NAME(m_to7_modem_tx)); -} - - - -/* ------------ dispatch MODEM / speech extension ------------ */ - -READ8_MEMBER( thomson_state::to7_modem_mea8000_r ) -{ - if ( space.debugger_access() ) - { - return 0; - } - - if ( m_io_mconfig->read() & 1 ) - { - return m_mea8000->read(space, offset); - } - else - { - switch (offset) - { - case 0: - return m_acia->status_r(space, offset ); - - case 1: - return m_acia->data_r(space, offset ); - - default: - return 0; - } - } -} - - - -WRITE8_MEMBER( thomson_state::to7_modem_mea8000_w ) -{ - if ( m_io_mconfig->read() & 1 ) - { - m_mea8000->write(space, offset, data); - } - else - { - switch (offset) - { - case 0: - m_acia->control_w( space, offset, data ); - break; - - case 1: - m_acia->data_w( space, offset, data ); - break; - } - } -} - - - -/* ------------ SX 90-018 (model 2) music & game extension ------------ */ - -/* features: - - 6821 PIA - - two 8-position, 2-button game pads - - 2-button mouse (exclusive with pads) - do not confuse with the TO9-specific mouse - - 6-bit DAC sound - - extends the CM 90-112 (model 1) with one extra button per pad and a mouse -*/ - - - -#define TO7_GAME_POLL_PERIOD attotime::from_usec( 500 ) - - -/* The mouse is a very simple phase quadrature one. - Each axis provides two 1-bit signals, A and B, that are toggled by the - axis rotation. The two signals are not in phase, so that whether A is - toggled before B or B before A gives the direction of rotation. - This is similar Atari & Amiga mouses. - Returns: 0 0 0 0 0 0 YB XB YA XA - */ -UINT8 thomson_state::to7_get_mouse_signal() -{ - UINT8 xa, xb, ya, yb; - UINT16 dx = m_io_mouse_x->read(); /* x axis */ - UINT16 dy = m_io_mouse_y->read(); /* y axis */ - xa = ((dx + 1) & 3) <= 1; - xb = (dx & 3) <= 1; - ya = ((dy + 1) & 3) <= 1; - yb = (dy & 3) <= 1; - return xa | (ya << 1) | (xb << 2) | (yb << 3); -} - - - -void thomson_state::to7_game_sound_update() -{ - m_dac->write_unsigned8(m_to7_game_mute ? 0 : (m_to7_game_sound << 2) ); -} - - - -READ8_MEMBER( thomson_state::to7_game_porta_in ) -{ - UINT8 data; - if ( m_io_config->read() & 1 ) - { - /* mouse */ - data = to7_get_mouse_signal() & 0x0c; /* XB, YB */ - data |= m_io_mouse_button->read() & 3; /* buttons */ - } - else - { - /* joystick */ - data = m_io_game_port_directions->read(); - /* bit 0=0 => P1 up bit 4=0 => P2 up - bit 1=0 => P1 down bit 5=0 => P2 down - bit 2=0 => P1 left bit 6=0 => P2 left - bit 3=0 => P1 right bit 7=0 => P2 right - */ - /* remove impossible combinations: up+down, left+right */ - if ( ! ( data & 0x03 ) ) - data |= 0x03; - if ( ! ( data & 0x0c ) ) - data |= 0x0c; - if ( ! ( data & 0x30 ) ) - data |= 0x30; - if ( ! ( data & 0xc0 ) ) - data |= 0xc0; - if ( ! ( data & 0x03 ) ) - data |= 0x03; - if ( ! ( data & 0x0c ) ) - data |= 0x0c; - if ( ! ( data & 0x30 ) ) - data |= 0x30; - if ( ! ( data & 0xc0 ) ) - data |= 0xc0; - } - return data; -} - - - -READ8_MEMBER( thomson_state::to7_game_portb_in ) -{ - UINT8 data; - if ( m_io_config->read() & 1 ) - { - /* mouse */ - UINT8 mouse = to7_get_mouse_signal(); - data = 0; - if ( mouse & 1 ) - data |= 0x04; /* XA */ - if ( mouse & 2 ) - data |= 0x40; /* YA */ - } - else - { - /* joystick */ - /* bits 6-7: action buttons A (0=pressed) */ - /* bits 2-3: action buttons B (0=pressed) */ - /* bits 4-5: unused (ouput) */ - /* bits 0-1: unknown! */ - data = m_io_game_port_buttons->read(); - } - return data; -} - - - -WRITE8_MEMBER( thomson_state::to7_game_portb_out ) -{ - /* 6-bit DAC sound */ - m_to7_game_sound = data & 0x3f; - to7_game_sound_update(); -} - - - -WRITE_LINE_MEMBER( thomson_state::to7_game_cb2_out ) -{ - /* undocumented */ - /* some TO8 games (e.g.: F15) seem to write here a lot */ -} - - - -/* this should be called periodically */ -TIMER_CALLBACK_MEMBER(thomson_state::to7_game_update_cb) -{ - if ( m_io_config->read() & 1 ) - { - /* mouse */ - UINT8 mouse = to7_get_mouse_signal(); - m_pia_game->ca1_w( (mouse & 1) ? 1 : 0 ); /* XA */ - m_pia_game->ca2_w( (mouse & 2) ? 1 : 0 ); /* YA */ - } - else - { - /* joystick */ - UINT8 in = m_io_game_port_buttons->read(); - m_pia_game->cb2_w( (in & 0x80) ? 1 : 0 ); /* P2 action A */ - m_pia_game->ca2_w( (in & 0x40) ? 1 : 0 ); /* P1 action A */ - m_pia_game->cb1_w( (in & 0x08) ? 1 : 0 ); /* P2 action B */ - m_pia_game->ca1_w( (in & 0x04) ? 1 : 0 ); /* P1 action B */ - /* TODO: - it seems that CM 90-112 behaves differently - - ca1 is P1 action A, i.e., in & 0x40 - - ca2 is P2 action A, i.e., in & 0x80 - - cb1, cb2 are not connected (should not be a problem) - */ - /* Note: the MO6 & MO5NR have slightly different connections - (see mo6_game_update_cb) - */ - } -} - - - -void thomson_state::to7_game_init() -{ - LOG (( "to7_game_init called\n" )); - m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::to7_game_update_cb),this)); - m_to7_game_timer->adjust(TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD); - save_item(NAME(m_to7_game_sound)); - save_item(NAME(m_to7_game_mute)); -} - - - -void thomson_state::to7_game_reset() -{ - LOG (( "to7_game_reset called\n" )); - m_pia_game->ca1_w( 0 ); - m_to7_game_sound = 0; - m_to7_game_mute = 0; - to7_game_sound_update(); -} - - - -/* ------------ MIDI extension ------------ */ - -/* IMPORTANT NOTE: - The following is experimental and not compiled in by default. - It relies on the existence of an hypothetical "character device" API able - to transmit bytes between the MESS driver and the outside world - (using, e.g., character device special files on some UNIX). -*/ - -/* Features an EF 6850 ACIA - - MIDI protocol is a serial asynchronous protocol - Each 8-bit byte is transmitted as: - - 1 start bit - - 8 data bits - - 1 stop bits - 320 us per transmitted byte => 31250 baud - - Emulation is based on the Motorola 6850 documentation, not EF 6850. - - We do not emulate the seral line but pass bytes directly between the - 6850 registers and the MIDI device. -*/ - - -READ8_MEMBER( thomson_state::to7_midi_r ) -{ - logerror( "to7_midi_r: not implemented\n" ); - return 0; -} - - - -WRITE8_MEMBER( thomson_state::to7_midi_w ) -{ - logerror( "to7_midi_w: not implemented\n" ); -} - - - -void thomson_state::to7_midi_reset() -{ - logerror( "to7_midi_reset: not implemented\n" ); -} - - - -void thomson_state::to7_midi_init() -{ - logerror( "to7_midi_init: not implemented\n" ); -} - - - -/* ------------ init / reset ------------ */ - - - -MACHINE_RESET_MEMBER( thomson_state, to7 ) -{ - LOG (( "to7: machine reset called\n" )); - - /* subsystems */ - thom_irq_reset(); - to7_game_reset(); - to7_floppy_reset(); - to7_modem_reset(); - to7_midi_reset(); - - /* video */ - thom_set_video_mode( THOM_VMODE_TO770 ); - m_thom_init_cb = &thomson_state::to7_set_init; - m_thom_lightpen_cb = &thomson_state::to7_lightpen_cb; - thom_set_lightpen_callback( 3 ); - thom_set_mode_point( 0 ); - thom_set_border_color( 0 ); - m_pia_sys->cb1_w( 0 ); - - /* memory */ - m_old_cart_bank = -1; - to7_update_cart_bank(); - /* thom_cart_bank not reset */ - - /* lightpen */ - m_to7_lightpen = 0; -} - - - -MACHINE_START_MEMBER( thomson_state, to7 ) -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8* mem = memregion("maincpu")->base(); - UINT8* ram = m_ram->pointer(); - - LOG (( "to7: machine start called\n" )); - - /* subsystems */ - thom_irq_init(); - to7_game_init(); - to7_floppy_init(mem + 0x20000); - to7_modem_init(); - to7_midi_init(); - - /* memory */ - m_thom_cart_bank = 0; - m_thom_vram = ram; - m_basebank->configure_entry( 0, ram + 0x4000); - m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - m_basebank->set_entry( 0 ); - m_vrambank->set_entry( 0 ); - m_cartbank->set_entry( 0 ); - - space.unmap_readwrite(0x8000, 0xdfff); - - if ( m_ram->size() > 24*1024 ) - { - /* install 16 KB or 16 KB + 8 KB memory extensions */ - /* BASIC instruction to see free memory: ?FRE(0) */ - int extram = m_ram->size() - 24*1024; - space.install_write_bank(0x8000, 0x8000 + extram - 1, m_rambank); - space.install_read_bank(0x8000, 0x8000 + extram - 1, m_rambank); - m_rambank->configure_entry( 0, ram + 0x6000); - m_rambank->set_entry( 0 ); - } - - /* force 2 topmost color bits to 1 */ - memset( m_thom_vram + 0x2000, 0xc0, 0x2000 ); - - /* save-state */ - save_item(NAME(m_thom_cart_nb_banks)); - save_item(NAME(m_thom_cart_bank)); - save_item(NAME(m_to7_lightpen)); - save_item(NAME(m_to7_lightpen_step)); - save_pointer(NAME((mem + 0x10000)), 0x10000 ); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to7_update_cart_bank_postload),this)); -} - - - -/***************************** TO7/70 *************************/ - - - -/* ------------ system PIA 6821 ------------ */ - - - -WRITE_LINE_MEMBER( thomson_state::to770_sys_cb2_out ) -{ - /* video overlay: black pixels are transparent and show TV image underneath */ - LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", m_maincpu->pc(), state )); -} - - - -READ8_MEMBER( thomson_state::to770_sys_porta_in ) -{ - /* keyboard */ - int keyline = m_pia_sys->b_output() & 7; - - return m_io_keyboard[7 - keyline]->read(); -} - - - -void thomson_state::to770_update_ram_bank() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8 portb = m_pia_sys->port_b_z_mask(); - int bank; - - switch (portb & 0xf8) - { - /* 2 * 16 KB internal RAM */ - case 0xf0: bank = 0; break; - case 0xe8: bank = 1; break; - - /* 4 * 16 KB extended RAM */ - case 0x18: bank = 2; break; - case 0x98: bank = 3; break; - case 0x58: bank = 4; break; - case 0xd8: bank = 5; break; - - /* none selected */ - case 0xf8: return; - - default: - logerror( "to770_update_ram_bank unknown bank $%02X\n", portb & 0xf8 ); - return; - } - - if ( bank != m_old_ram_bank ) - { - if ( m_ram->size() == 128*1024 || bank < 2 ) - { - m_rambank->set_entry( bank ); - } - else - { - /* RAM size is 48 KB only and unavailable bank - * requested */ - space.nop_readwrite(0xa000, 0xdfff); - } - m_old_ram_bank = bank; - LOG_BANK(( "to770_update_ram_bank: RAM bank change %i\n", bank )); - } -} - - - -void thomson_state::to770_update_ram_bank_postload() -{ - to770_update_ram_bank(); -} - - - -WRITE8_MEMBER( thomson_state::to770_sys_portb_out ) -{ - to770_update_ram_bank(); -} - - - -/* ------------ 6846 (timer, I/O) ------------ */ - - - -WRITE8_MEMBER( thomson_state::to770_timer_port_out ) -{ - thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - thom_set_caps_led( (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */ - thom_set_border_color( ((data & 0x10) ? 1 : 0) | /* 4-bit border color */ - ((data & 0x20) ? 2 : 0) | - ((data & 0x40) ? 4 : 0) | - ((data & 0x04) ? 0 : 8) ); -} - - -/* ------------ gate-array ------------ */ - - - -READ8_MEMBER( thomson_state::to770_gatearray_r ) -{ - struct thom_vsignal v = thom_get_vsignal(); - struct thom_vsignal l = thom_get_lightpen_vsignal( TO7_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 0 ); - int count, inil, init, lt3; - count = m_to7_lightpen ? l.count : v.count; - inil = m_to7_lightpen ? l.inil : v.inil; - init = m_to7_lightpen ? l.init : v.init; - lt3 = m_to7_lightpen ? l.lt3 : v.lt3; - - switch ( offset ) - { - case 0: return (count >> 8) & 0xff; - case 1: return count & 0xff; - case 2: return (lt3 << 7) | (inil << 6); - case 3: return (init << 7); - default: - logerror( "$%04x to770_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::to770_gatearray_w ) -{ - if ( ! offset ) - m_to7_lightpen = data & 1; -} - - - -/* ------------ init / reset ------------ */ - - - -MACHINE_RESET_MEMBER( thomson_state, to770 ) -{ - LOG (( "to770: machine reset called\n" )); - - /* subsystems */ - thom_irq_reset(); - to7_game_reset(); - to7_floppy_reset(); - to7_modem_reset(); - to7_midi_reset(); - - /* video */ - thom_set_video_mode( THOM_VMODE_TO770 ); - m_thom_init_cb = &thomson_state::to7_set_init; - m_thom_lightpen_cb = &thomson_state::to7_lightpen_cb; - thom_set_lightpen_callback( 3 ); - thom_set_mode_point( 0 ); - thom_set_border_color( 8 ); - m_pia_sys->cb1_w( 0 ); - - /* memory */ - m_old_ram_bank = -1; - m_old_cart_bank = -1; - to7_update_cart_bank(); - to770_update_ram_bank(); - /* thom_cart_bank not reset */ - - /* lightpen */ - m_to7_lightpen = 0; -} - - - -MACHINE_START_MEMBER( thomson_state, to770 ) -{ - UINT8* mem = memregion("maincpu")->base(); - UINT8* ram = m_ram->pointer(); - - LOG (( "to770: machine start called\n" )); - - /* subsystems */ - thom_irq_init(); - to7_game_init(); - to7_floppy_init( mem + 0x20000 ); - to7_modem_init(); - to7_midi_init(); - - /* memory */ - m_thom_cart_bank = 0; - m_thom_vram = ram; - m_basebank->configure_entry( 0, ram + 0x4000); - m_rambank->configure_entries( 0, 6, ram + 0x8000, 0x4000 ); - m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - m_basebank->set_entry( 0 ); - m_rambank->set_entry( 0 ); - m_vrambank->set_entry( 0 ); - m_cartbank->set_entry( 0 ); - - /* save-state */ - save_item(NAME(m_thom_cart_nb_banks)); - save_item(NAME(m_thom_cart_bank)); - save_item(NAME(m_to7_lightpen)); - save_item(NAME(m_to7_lightpen_step)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to770_update_ram_bank_postload), this)); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to7_update_cart_bank_postload), this)); -} - - - -/***************************** MO5 *************************/ - - - -/* ------------ lightpen automaton ------------ */ - - - -void thomson_state::mo5_lightpen_cb( int step ) -{ - /* MO5 signals ca1 (TO7 signals cb1) */ - if ( ! m_to7_lightpen ) - return; - - m_pia_sys->ca1_w( 1 ); - m_pia_sys->ca1_w( 0 ); - m_to7_lightpen_step = step; -} - - -/* ------------ periodic interrupt ------------ */ - -/* the MO5 & MO6 do not have a MC 6846 timer, - they have a fixed 50 Hz timer instead -*/ - - -TIMER_CALLBACK_MEMBER(thomson_state::mo5_periodic_cb) -{ - /* pulse */ - m_pia_sys->cb1_w( 1 ); - m_pia_sys->cb1_w( 0 ); -} - - - -void thomson_state::mo5_init_timer() -{ - /* time is a little faster than 50 Hz to match video framerate */ - m_mo5_periodic_timer->adjust(attotime::zero, 0, attotime::from_usec( 19968 )); -} - - - -/* ------------ system PIA 6821 ------------ */ - - - -WRITE8_MEMBER( thomson_state::mo5_sys_porta_out ) -{ - thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - thom_set_border_color( (data >> 1) & 15 ); /* bit 1-4: border color */ - mo5_set_cassette( (data & 0x40) ? 1 : 0 ); /* bit 6: cassette output */ -} - - - -READ8_MEMBER( thomson_state::mo5_sys_porta_in ) -{ - return - (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ - ((m_io_lightpen_button->read() & 1) ? 0x20 : 0) - /* bit 5: lightpen button */; -} - - - -WRITE8_MEMBER( thomson_state::mo5_sys_portb_out ) -{ - m_buzzer->write_unsigned8((data & 1) ? 0x80 : 0); /* 1-bit buzzer */ -} - - - -READ8_MEMBER( thomson_state::mo5_sys_portb_in ) -{ - UINT8 portb = m_pia_sys->b_output(); - int col = (portb >> 1) & 7; /* key column */ - int lin = 7 - ((portb >> 4) & 7); /* key line */ - - return ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; -} - - - -/* ------------ gate-array ------------ */ - - - -#define MO5_LIGHTPEN_DECAL 12 - - - -READ8_MEMBER( thomson_state::mo5_gatearray_r ) -{ - struct thom_vsignal v = thom_get_vsignal(); - struct thom_vsignal l = thom_get_lightpen_vsignal( MO5_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 0 ); - int count, inil, init, lt3; - count = m_to7_lightpen ? l.count : v.count; - inil = m_to7_lightpen ? l.inil : v.inil; - init = m_to7_lightpen ? l.init : v.init; - lt3 = m_to7_lightpen ? l.lt3 : v.lt3; - - switch ( offset ) { - case 0: return (count >> 8) & 0xff; - case 1: return count & 0xff; - case 2: return (lt3 << 7) | (inil << 6); - case 3: return (init << 7); - default: - logerror( "$%04x mo5_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::mo5_gatearray_w ) -{ - if ( ! offset ) - m_to7_lightpen = data & 1; -} - - - -/* ------------ cartridge / extended RAM ------------ */ - - - -DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge ) -{ - UINT8* pos = memregion("maincpu")->base() + 0x10000; - UINT64 size, i; - int j; - char name[129]; - - if (image.software_entry() == NULL) - size = image.length(); - else - size = image.get_software_region_length("rom"); - - /* get size & number of 16-KB banks */ - if ( size > 32 && size <= 0x04000 ) - m_thom_cart_nb_banks = 1; - else if ( size == 0x08000 ) - m_thom_cart_nb_banks = 2; - else if ( size == 0x10000 ) - m_thom_cart_nb_banks = 4; - else - { - std::string errmsg; - strprintf(errmsg,"Invalid cartridge size %d", (int)size); - image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); - return IMAGE_INIT_FAIL; - } - - if (image.software_entry() == NULL) - { - if ( image.fread(pos, size ) != size ) - { - image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Read error"); - return IMAGE_INIT_FAIL; - } - } - else - { - memcpy(pos, image.get_software_region("rom"), size); - } - - /* extract name */ - i = size - 32; - while ( i < size && !pos[i] ) i++; - for ( j = 0; i < size && pos[i] >= 0x20; j++, i++) - name[j] = pos[i]; - name[j] = 0; - - /* sanitize name */ - for ( j = 0; name[j]; j++) - { - if ( name[j] < ' ' || name[j] >= 127 ) name[j] = '?'; - } - - PRINT (( "mo5_cartridge_load: cartridge \"%s\" banks=%i, size=%u\n", name, m_thom_cart_nb_banks, (unsigned) size )); - - return IMAGE_INIT_PASS; -} - - - -void thomson_state::mo5_update_cart_bank() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - int rom_is_ram = m_mo5_reg_cart & 4; - int bank = 0; - int bank_is_read_only = 0; - - - if ( rom_is_ram && m_thom_cart_nb_banks == 4 ) - { - /* 64 KB ROM from "JANE" cartridge */ - bank = m_mo5_reg_cart & 3; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) - { - space.install_read_bank( 0xb000, 0xefff, m_cartbank); - space.nop_write( 0xb000, 0xefff); - } - LOG_BANK(( "mo5_update_cart_bank: CART is cartridge bank %i (A7CB style)\n", bank )); - } - } - else if ( rom_is_ram ) - { - /* 64 KB RAM from network extension */ - bank = 4 + ( m_mo5_reg_cart & 3 ); - bank_is_read_only = (( m_mo5_reg_cart & 8 ) == 0); - - if ( bank != m_old_cart_bank || bank_is_read_only != m_old_cart_bank_was_read_only) - { - if ( bank_is_read_only ) - { - space.install_read_bank( 0xb000, 0xefff, m_cartbank); - space.nop_write( 0xb000, 0xefff ); - } - else - { - space.install_readwrite_bank( 0xb000, 0xefff, m_cartbank); - } - LOG_BANK(( "mo5_update_cart_bank: CART is nanonetwork RAM bank %i (%s)\n", - m_mo5_reg_cart & 3, - bank_is_read_only ? "read-only":"read-write")); - m_old_cart_bank_was_read_only = bank_is_read_only; - } - } - else - { - /* regular cartridge bank switch */ - if ( m_thom_cart_nb_banks ) - { - bank = m_thom_cart_bank % m_thom_cart_nb_banks; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 0 ) - { - space.install_read_bank( 0xb000, 0xefff, m_cartbank); - space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo5_cartridge_w),this) ); - space.install_read_handler( 0xbffc, 0xbfff, read8_delegate(FUNC(thomson_state::mo5_cartridge_r),this) ); - } - LOG_BANK(( "mo5_update_cart_bank: CART is cartridge bank %i\n", bank )); - } - } - else - { - /* internal ROM */ - if ( m_old_cart_bank != 0 ) - { - space.install_read_bank( 0xb000, 0xefff, m_cartbank); - space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo5_cartridge_w),this) ); - LOG_BANK(( "mo5_update_cart_bank: CART is internal\n")); - } - } - } - if ( bank != m_old_cart_bank ) - { - m_cartbank->set_entry( bank ); - m_old_cart_bank = bank; - } -} - - - -void thomson_state::mo5_update_cart_bank_postload() -{ - mo5_update_cart_bank(); -} - - - -/* write signal to b000-cfff generates a bank switch */ -WRITE8_MEMBER( thomson_state::mo5_cartridge_w ) -{ - if ( offset >= 0x2000 ) - return; - - m_thom_cart_bank = offset & 3; - mo5_update_cart_bank(); -} - - - -/* read signal to bffc-bfff generates a bank switch */ -READ8_MEMBER( thomson_state::mo5_cartridge_r ) -{ - UINT8* pos = memregion( "maincpu" )->base() + 0x10000; - UINT8 data = pos[offset + 0xbffc + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; - if ( !space.debugger_access() ) - { - m_thom_cart_bank = offset & 3; - mo5_update_cart_bank(); - } - return data; -} - - - -/* 0xa7cb bank-switch register */ -WRITE8_MEMBER( thomson_state::mo5_ext_w ) -{ - m_mo5_reg_cart = data; - mo5_update_cart_bank(); -} - - - -/* ------------ init / reset ------------ */ - - - -MACHINE_RESET_MEMBER( thomson_state, mo5 ) -{ - LOG (( "mo5: machine reset called\n" )); - - /* subsystems */ - thom_irq_reset(); - m_pia_sys->set_port_a_z_mask(0x5f ); - to7_game_reset(); - to7_floppy_reset(); - to7_modem_reset(); - to7_midi_reset(); - mo5_init_timer(); - - /* video */ - thom_set_video_mode( THOM_VMODE_MO5 ); - m_thom_lightpen_cb = &thomson_state::mo5_lightpen_cb; - thom_set_lightpen_callback( 3 ); - thom_set_mode_point( 0 ); - thom_set_border_color( 0 ); - m_pia_sys->ca1_w( 0 ); - - /* memory */ - m_old_cart_bank = -1; - mo5_update_cart_bank(); - /* mo5_reg_cart not reset */ - /* thom_cart_bank not reset */ - - /* lightpen */ - m_to7_lightpen = 0; -} - - - -MACHINE_START_MEMBER( thomson_state, mo5 ) -{ - UINT8* mem = memregion("maincpu")->base(); - UINT8* ram = m_ram->pointer(); - - LOG (( "mo5: machine start called\n" )); - - /* subsystems */ - thom_irq_init(); - to7_game_init(); - to7_floppy_init( mem + 0x20000 ); - to7_modem_init(); - to7_midi_init(); - m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo5_periodic_cb),this)); - - /* memory */ - m_thom_cart_bank = 0; - m_mo5_reg_cart = 0; - m_thom_vram = ram; - m_basebank->configure_entry( 0, ram + 0x4000); - m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - m_cartbank->configure_entries( 4, 4, ram + 0xc000, 0x4000 ); - m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - m_basebank->set_entry( 0 ); - m_cartbank->set_entry( 0 ); - m_vrambank->set_entry( 0 ); - - /* save-state */ - save_item(NAME(m_thom_cart_nb_banks)); - save_item(NAME(m_thom_cart_bank)); - save_item(NAME(m_to7_lightpen)); - save_item(NAME(m_to7_lightpen_step)); - save_item(NAME(m_mo5_reg_cart)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo5_update_cart_bank_postload), this)); -} - - - -/***************************** TO9 *************************/ - - - -/* ------------ IEEE extension ------------ */ - - - -/* TODO: figure out what this extension is... IEEE-488 ??? */ - - - -WRITE8_MEMBER( thomson_state::to9_ieee_w ) -{ - logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", m_maincpu->pc(), machine().time().as_double(), data, offset ); -} - - - -READ8_MEMBER( thomson_state::to9_ieee_r ) -{ - logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", m_maincpu->pc(), machine().time().as_double(), offset ); - return 0; -} - - - -/* ------------ system gate-array ------------ */ - - - -#define TO9_LIGHTPEN_DECAL 8 - - - -READ8_MEMBER( thomson_state::to9_gatearray_r ) -{ - struct thom_vsignal v = thom_get_vsignal(); - struct thom_vsignal l = thom_get_lightpen_vsignal( TO9_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 0 ); - int count, inil, init, lt3; - count = m_to7_lightpen ? l.count : v.count; - inil = m_to7_lightpen ? l.inil : v.inil; - init = m_to7_lightpen ? l.init : v.init; - lt3 = m_to7_lightpen ? l.lt3 : v.lt3; - - switch ( offset ) - { - case 0: return (count >> 8) & 0xff; - case 1: return count & 0xff; - case 2: return (lt3 << 7) | (inil << 6); - case 3: return (v.init << 7) | (init << 6); /* != TO7/70 */ - default: - logerror( "$%04x to9_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::to9_gatearray_w ) -{ - if ( ! offset ) - m_to7_lightpen = data & 1; -} - - - -/* ------------ video gate-array ------------ */ - - - -/* style: 0 => TO9, 1 => TO8/TO9, 2 => MO6 */ -void thomson_state::to9_set_video_mode( UINT8 data, int style ) -{ - switch ( data & 0x7f ) - { - case 0x00: - if ( style == 2 ) - thom_set_video_mode( THOM_VMODE_MO5 ); - else if ( style == 1 ) - thom_set_video_mode( THOM_VMODE_TO770 ); - else - thom_set_video_mode( THOM_VMODE_TO9 ); - break; - - // undocumented, but tested on a real TO8D - case 0x20: thom_set_video_mode( THOM_VMODE_MO5_ALT ); break; - - case 0x21: thom_set_video_mode( THOM_VMODE_BITMAP4 ); break; - - case 0x41: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT ); break; - - // also undocumented but tested - case 0x59: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT_HALF ); break; - - case 0x2a: - if ( style==0 ) - thom_set_video_mode( THOM_VMODE_80_TO9 ); - else - thom_set_video_mode( THOM_VMODE_80 ); - break; - - case 0x7b: thom_set_video_mode( THOM_VMODE_BITMAP16 ); break; - - case 0x24: thom_set_video_mode( THOM_VMODE_PAGE1 ); break; - - case 0x25: thom_set_video_mode( THOM_VMODE_PAGE2 ); break; - - case 0x26: thom_set_video_mode( THOM_VMODE_OVERLAY ); break; - - // undocumented 160x200 variant of overlay - case 0x3e: thom_set_video_mode( THOM_VMODE_OVERLAY_HALF ); break; - - case 0x3f: thom_set_video_mode( THOM_VMODE_OVERLAY3 ); break; - - default: - logerror( "to9_set_video_mode: unknown mode $%02X tr=%i phi=%i mod=%i\n", data, (data >> 5) & 3, (data >> 3) & 2, data & 7 ); - } -} - - - -READ8_MEMBER( thomson_state::to9_vreg_r ) -{ - switch ( offset ) - { - case 0: /* palette data */ - { - UINT8 c = m_to9_palette_data[ m_to9_palette_idx ]; - if ( !space.debugger_access() ) - { - m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; - } - return c; - } - - case 1: /* palette address */ - return m_to9_palette_idx; - - case 2: - case 3: - return 0; - - default: - logerror( "to9_vreg_r: invalid read offset %i\n", offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::to9_vreg_w ) -{ - LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", m_maincpu->pc(), machine().time().as_double(), offset, 0xe7da + offset, data )); - - switch ( offset ) - { - case 0: /* palette data */ - { - UINT16 color, idx; - m_to9_palette_data[ m_to9_palette_idx ] = data; - idx = m_to9_palette_idx / 2; - color = m_to9_palette_data[ 2 * idx + 1 ]; - color = m_to9_palette_data[ 2 * idx ] | (color << 8); - thom_set_palette( idx ^ 8, color & 0x1fff ); - m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; - } - break; - - case 1: /* palette address */ - m_to9_palette_idx = data & 31; - break; - - case 2: /* video mode */ - to9_set_video_mode( data, 0 ); - break; - - case 3: /* border color */ - thom_set_border_color( data & 15 ); - break; - - default: - logerror( "to9_vreg_w: invalid write offset %i data=$%02X\n", offset, data ); - } -} - - - -void thomson_state::to9_palette_init() -{ - m_to9_palette_idx = 0; - memset( m_to9_palette_data, 0, sizeof( m_to9_palette_data ) ); - save_item(NAME(m_to9_palette_idx)); - save_item(NAME(m_to9_palette_data)); -} - - - -/* ------------ RAM / ROM banking ------------ */ - - -void thomson_state::to9_update_cart_bank() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - int bank = 0; - int slot = ( m_mc6846->get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */ - - switch ( slot ) - { - case 0: - /* BASIC (64 KB) */ - bank = 4 + m_to9_soft_bank; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 4) - { - space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); - } - LOG_BANK(( "to9_update_cart_bank: CART is BASIC bank %i\n", m_to9_soft_bank )); - } - break; - case 1: - /* software 1 (32 KB) */ - bank = 8 + (m_to9_soft_bank & 1); - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 4) - { - space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); - } - LOG_BANK(( "to9_update_cart_bank: CART is software 1 bank %i\n", m_to9_soft_bank )); - } - break; - case 2: - /* software 2 (32 KB) */ - bank = 10 + (m_to9_soft_bank & 1); - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 4) - { - space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); - } - LOG_BANK(( "to9_update_cart_bank: CART is software 2 bank %i\n", m_to9_soft_bank )); - } - break; - case 3: - /* external cartridge */ - if ( m_thom_cart_nb_banks ) - { - bank = m_thom_cart_bank % m_thom_cart_nb_banks; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) - { - space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); - space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to9_cartridge_w),this) ); - space.install_read_handler( 0x0000, 0x0003, read8_delegate(FUNC(thomson_state::to9_cartridge_r),this) ); - } - LOG_BANK(( "to9_update_cart_bank: CART is cartridge bank %i\n", m_thom_cart_bank )); - } - } - else - { - if ( m_old_cart_bank != 0 ) - { - space.nop_read( 0x0000, 0x3fff); - LOG_BANK(( "to9_update_cart_bank: CART is unmapped\n")); - } - } - break; - } - if ( bank != m_old_cart_bank ) - { - m_cartbank->set_entry( bank ); - m_old_cart_bank = bank; - } -} - - - -void thomson_state::to9_update_cart_bank_postload() -{ - to9_update_cart_bank(); -} - - - -/* write signal to 0000-1fff generates a bank switch */ -WRITE8_MEMBER( thomson_state::to9_cartridge_w ) -{ - int slot = ( m_mc6846->get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */ - - if ( offset >= 0x2000 ) - return; - - if ( slot == 3 ) - m_thom_cart_bank = offset & 3; - else - m_to9_soft_bank = offset & 3; - to9_update_cart_bank(); -} - - - -/* read signal to 0000-0003 generates a bank switch */ -READ8_MEMBER( thomson_state::to9_cartridge_r ) -{ - UINT8* pos = memregion( "maincpu" )->base() + 0x10000; - UINT8 data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; - if ( !space.debugger_access() ) - { - m_thom_cart_bank = offset & 3; - to9_update_cart_bank(); - } - return data; -} - - - -void thomson_state::to9_update_ram_bank() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8 port = m_mc6846->get_output_port(); - UINT8 portb = m_pia_sys->port_b_z_mask(); - UINT8 disk = ((port >> 2) & 1) | ((port >> 5) & 2); /* bits 6,2: RAM bank */ - int bank; - - switch ( portb & 0xf8 ) - { - /* TO7/70 compatible */ - case 0xf0: bank = 0; break; - case 0xe8: bank = 1; break; - case 0x18: bank = 2; break; - case 0x98: bank = 3; break; - case 0x58: bank = 4; break; - case 0xd8: bank = 5; break; - - /* 64 KB of virtual disk */ - case 0xf8: bank = 6 + disk ; break; - - /* none selected */ - case 0: return; - - default: - logerror( "to9_update_ram_bank: unknown RAM bank pia=$%02X disk=%i\n", portb & 0xf8, disk ); - return; - } - - if ( m_old_ram_bank != bank ) - { - if ( m_ram->size() == 192*1024 || bank < 6 ) - { - m_rambank->set_entry( bank ); - } - else - { - space.nop_readwrite( 0xa000, 0xdfff); - } - m_old_ram_bank = bank; - LOG_BANK(( "to9_update_ram_bank: bank %i selected (pia=$%02X disk=%i)\n", bank, portb & 0xf8, disk )); - } -} - - - -void thomson_state::to9_update_ram_bank_postload() -{ - to9_update_ram_bank(); -} - - - -/* ------------ keyboard (6850 ACIA + 6805 CPU) ------------ */ - -/* The 6805 chip scans the keyboard and sends ASCII codes to the 6909. - Data between the 6809 and 6805 is serialized at 9600 bauds. - On the 6809 side, a 6850 ACIA is used. - We do not emulate the seral line but pass bytes directly between the - keyboard and the 6850 registers. - Note that the keyboard protocol uses the parity bit as an extra data bit. -*/ - - - -/* normal mode: polling interval */ -#define TO9_KBD_POLL_PERIOD attotime::from_msec( 10 ) - -/* peripherial mode: time between two bytes, and after last byte */ -#define TO9_KBD_BYTE_SPACE attotime::from_usec( 300 ) -#define TO9_KBD_END_SPACE attotime::from_usec( 9100 ) - -/* first and subsequent repeat periods, in TO9_KBD_POLL_PERIOD units */ -#define TO9_KBD_REPEAT_DELAY 80 /* 800 ms */ -#define TO9_KBD_REPEAT_PERIOD 7 /* 70 ms */ - - - -/* quick keyboard scan */ -int thomson_state::to9_kbd_ktest() -{ - int line, bit; - UINT8 port; - - for ( line = 0; line < 10; line++ ) - { - port = m_io_keyboard[line]->read(); - - if ( line == 7 || line == 9 ) - port |= 1; /* shift & control */ - - for ( bit = 0; bit < 8; bit++ ) - { - if ( ! (port & (1 << bit)) ) - return 1; - } - } - return 0; -} - - - -void thomson_state::to9_kbd_update_irq() -{ - if ( (m_to9_kbd_intr & 4) && (m_to9_kbd_status & ACIA_6850_RDRF) ) - m_to9_kbd_status |= ACIA_6850_irq; /* byte received interrupt */ - - if ( (m_to9_kbd_intr & 4) && (m_to9_kbd_status & ACIA_6850_OVRN) ) - m_to9_kbd_status |= ACIA_6850_irq; /* overrun interrupt */ - - if ( (m_to9_kbd_intr & 3) == 1 && (m_to9_kbd_status & ACIA_6850_TDRE) ) - m_to9_kbd_status |= ACIA_6850_irq; /* ready to transmit interrupt */ - - thom_irq_3( m_to9_kbd_status & ACIA_6850_irq ); -} - - - -READ8_MEMBER( thomson_state::to9_kbd_r ) -{ - /* ACIA 6850 registers */ - - switch ( offset ) - { - case 0: /* get status */ - /* bit 0: data received */ - /* bit 1: ready to transmit data (always 1) */ - /* bit 2: data carrier detect (ignored) */ - /* bit 3: clear to send (ignored) */ - /* bit 4: framing error (ignored) */ - /* bit 5: overrun */ - /* bit 6: parity error */ - /* bit 7: interrupt */ - - LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n", - m_maincpu->pc(), machine().time().as_double(), m_to9_kbd_status, - (m_to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0, - (m_to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0, - (m_to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0, - (m_to9_kbd_status & ACIA_6850_PE) ? 1 : 0, - (m_to9_kbd_status & ACIA_6850_irq) ? 1 : 0 )); - return m_to9_kbd_status; - - case 1: /* get input data */ - if ( !space.debugger_access() ) - { - m_to9_kbd_status &= ~(ACIA_6850_irq | ACIA_6850_PE); - if ( m_to9_kbd_overrun ) - m_to9_kbd_status |= ACIA_6850_OVRN; - else - m_to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF); - m_to9_kbd_overrun = 0; - LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", m_maincpu->pc(), machine().time().as_double(), m_to9_kbd_in )); - to9_kbd_update_irq(); - } - return m_to9_kbd_in; - - default: - logerror( "$%04x to9_kbd_r: invalid offset %i\n", m_maincpu->pc(), offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::to9_kbd_w ) -{ - /* ACIA 6850 registers */ - - switch ( offset ) - { - case 0: /* set control */ - /* bits 0-1: clock divide (ignored) or reset */ - if ( (data & 3) == 3 ) - { - /* reset */ - m_to9_kbd_overrun = 0; - m_to9_kbd_status = ACIA_6850_TDRE; - m_to9_kbd_intr = 0; - LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", m_maincpu->pc(), machine().time().as_double(), data )); - } - else - { - /* bits 2-4: parity */ - if ( (data & 0x18) == 0x10 ) - m_to9_kbd_parity = 2; - else - m_to9_kbd_parity = (data >> 2) & 1; - /* bits 5-6: interrupt on transmit */ - /* bit 7: interrupt on receive */ - m_to9_kbd_intr = data >> 5; - - LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n", - m_maincpu->pc(), machine().time().as_double(), - data, m_to9_kbd_parity, m_to9_kbd_intr >> 2, - (m_to9_kbd_intr & 3) ? 1 : 0 )); - } - to9_kbd_update_irq(); - break; - - case 1: /* output data */ - m_to9_kbd_status &= ~(ACIA_6850_irq | ACIA_6850_TDRE); - to9_kbd_update_irq(); - /* TODO: 1 ms delay here ? */ - m_to9_kbd_status |= ACIA_6850_TDRE; /* data transmit ready again */ - to9_kbd_update_irq(); - - switch ( data ) - { - case 0xF8: - /* reset */ - m_to9_kbd_caps = 1; - m_to9_kbd_periph = 0; - m_to9_kbd_pad = 0; - break; - - case 0xF9: m_to9_kbd_caps = 1; break; - case 0xFA: m_to9_kbd_caps = 0; break; - case 0xFB: m_to9_kbd_pad = 1; break; - case 0xFC: m_to9_kbd_pad = 0; break; - case 0xFD: m_to9_kbd_periph = 1; break; - case 0xFE: m_to9_kbd_periph = 0; break; - - default: - logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", m_maincpu->pc(), machine().time().as_double(), data ); - } - - thom_set_caps_led( !m_to9_kbd_caps ); - - LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n", - m_maincpu->pc(), machine().time().as_double(), data, - m_to9_kbd_caps, m_to9_kbd_pad, m_to9_kbd_periph )); - - break; - - default: - logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", m_maincpu->pc(), offset, data ); - } -} - - - -/* send a key to the CPU, 8-bit + parity bit (0=even, 1=odd) - note: parity is not used as a checksum but to actually transmit a 9-th bit - of information! -*/ -void thomson_state::to9_kbd_send( UINT8 data, int parity ) -{ - if ( m_to9_kbd_status & ACIA_6850_RDRF ) - { - /* overrun will be set when the current valid byte is read */ - m_to9_kbd_overrun = 1; - LOG_KBD(( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", machine().time().as_double(), data, parity )); - } - else - { - /* valid byte */ - m_to9_kbd_in = data; - m_to9_kbd_status |= ACIA_6850_RDRF; /* raise data received flag */ - if ( m_to9_kbd_parity == 2 || m_to9_kbd_parity == parity ) - m_to9_kbd_status &= ~ACIA_6850_PE; /* parity OK */ - else - m_to9_kbd_status |= ACIA_6850_PE; /* parity error */ - LOG_KBD(( "%f to9_kbd_send: data=$%02X, parity=%i, status=$%02X\n", machine().time().as_double(), data, parity, m_to9_kbd_status )); - } - to9_kbd_update_irq(); -} - - - -/* keycode => TO9 code (extended ASCII), shifted and un-shifted */ -static const int to9_kbd_code[80][2] = -{ - { 145, 150 }, { '_', '6' }, { 'Y', 'Y' }, { 'H', 'H' }, - { 11, 11 }, { 9, 9 }, { 30, 12 }, { 'N', 'N' }, - - { 146, 151 }, { '(', '5' }, { 'T', 'T' }, { 'G', 'G' }, - { '=', '+' }, { 8, 8 }, { 28, 28 }, { 'B', 'B' }, - - { 147, 152 }, { '\'', '4' }, { 'R', 'R' }, { 'F', 'F' }, - { 22, 22 }, { 155, 155 }, { 29, 127 }, { 'V', 'V' }, - - { 148, 153 }, { '"', '3' }, { 'E', 'E' }, { 'D', 'D' }, - { 161, 161 }, { 158, 158 }, - { 154, 154 }, { 'C', 'C' }, - - { 144, 149 }, { 128, '2' }, { 'Z', 'Z' }, { 'S', 'S' }, - { 162, 162 }, { 156, 156 }, - { 164, 164 }, { 'X', 'X' }, - - { '#', '@' }, { '*', '1' }, { 'A', 'A' }, { 'Q', 'Q' }, - { '[', '{' }, { 159, 159 }, { 160, 160 }, { 'W', 'W' }, - - { 2, 2 }, { 129, '7' }, { 'U', 'U' }, { 'J', 'J' }, - { ' ', ' ' }, { 163, 163 }, { 165, 165 }, - { ',', '?' }, - - { 0, 0 }, { '!', '8' }, { 'I', 'I' }, { 'K', 'K' }, - { '$', '&' }, { 10, 10 }, { ']', '}' }, { ';', '.' }, - - { 0, 0 }, { 130, '9' }, { 'O', 'O' }, { 'L', 'L' }, - { '-', '\\' }, { 132, '%' }, { 13, 13 }, { ':', '/' }, - - { 0, 0 }, { 131, '0' }, { 'P', 'P' }, { 'M', 'M' }, - { ')', 134 }, { '^', 133 }, { 157, 157 }, { '>', '<' } -}; - - - -/* returns the ASCII code for the key, or 0 for no key */ -int thomson_state::to9_kbd_get_key() -{ - int control = ! (m_io_keyboard[7]->read() & 1); - int shift = ! (m_io_keyboard[9]->read() & 1); - int key = -1, line, bit; - UINT8 port; - - for ( line = 0; line < 10; line++ ) - { - port = m_io_keyboard[line]->read(); - - if ( line == 7 || line == 9 ) - port |= 1; /* shift & control */ - - /* TODO: correct handling of simultaneous keystokes: - return the new key preferably & disable repeat - */ - for ( bit = 0; bit < 8; bit++ ) - { - if ( ! (port & (1 << bit)) ) - key = line * 8 + bit; - } - } - - if ( key == -1 ) - { - m_to9_kbd_last_key = 0xff; - m_to9_kbd_key_count = 0; - return 0; - } - else if ( key == 64 ) - { - /* caps lock */ - if ( m_to9_kbd_last_key == key ) - return 0; /* no repeat */ - - m_to9_kbd_last_key = key; - m_to9_kbd_caps = !m_to9_kbd_caps; - thom_set_caps_led( !m_to9_kbd_caps ); - return 0; - } - else - { - int asc; - asc = to9_kbd_code[key][shift]; - if ( ! asc ) return 0; - - /* keypad */ - if ( ! m_to9_kbd_pad ) { - if ( asc >= 154 && asc <= 163 ) - asc += '0' - 154; - else if ( asc == 164 ) - asc = '.'; - else if ( asc == 165 ) - asc = 13; - } - - /* shifted letter */ - if ( asc >= 'A' && asc <= 'Z' && ( ! m_to9_kbd_caps ) && ( ! shift ) ) - asc += 'a' - 'A'; - - /* control */ - if ( control ) - asc &= ~0x40; - - if ( key == m_to9_kbd_last_key ) - { - /* repeat */ - m_to9_kbd_key_count++; - if ( m_to9_kbd_key_count < TO9_KBD_REPEAT_DELAY || (m_to9_kbd_key_count - TO9_KBD_REPEAT_DELAY) % TO9_KBD_REPEAT_PERIOD ) - return 0; - LOG_KBD(( "to9_kbd_get_key: repeat key $%02X '%c'\n", asc, asc )); - return asc; - } - else - { - m_to9_kbd_last_key = key; - m_to9_kbd_key_count = 0; - LOG_KBD(( "to9_kbd_get_key: key down $%02X '%c'\n", asc, asc )); - return asc; - } - } -} - - - -TIMER_CALLBACK_MEMBER(thomson_state::to9_kbd_timer_cb) -{ - if ( m_to9_kbd_periph ) - { - /* peripherial mode: every 10 ms we send 4 bytes */ - - switch ( m_to9_kbd_byte_count ) - { - case 0: /* key */ - to9_kbd_send( to9_kbd_get_key(), 0 ); - break; - - case 1: /* x axis */ - { - int newx = m_io_mouse_x->read(); - UINT8 data = ( (newx - m_to9_mouse_x) & 0xf ) - 8; - to9_kbd_send( data, 1 ); - m_to9_mouse_x = newx; - break; - } - - case 2: /* y axis */ - { - int newy = m_io_mouse_y->read(); - UINT8 data = ( (newy - m_to9_mouse_y) & 0xf ) - 8; - to9_kbd_send( data, 1 ); - m_to9_mouse_y = newy; - break; - } - - case 3: /* axis overflow & buttons */ - { - int b = m_io_mouse_button->read(); - UINT8 data = 0; - if ( b & 1 ) data |= 1; - if ( b & 2 ) data |= 4; - to9_kbd_send( data, 1 ); - break; - } - - } - - m_to9_kbd_byte_count = ( m_to9_kbd_byte_count + 1 ) & 3; - m_to9_kbd_timer->adjust(m_to9_kbd_byte_count ? TO9_KBD_BYTE_SPACE : TO9_KBD_END_SPACE); - } - else - { - int key = to9_kbd_get_key(); - /* keyboard mode: send a byte only if a key is down */ - if ( key ) - to9_kbd_send( key, 0 ); - m_to9_kbd_timer->adjust(TO9_KBD_POLL_PERIOD); - } -} - - - -void thomson_state::to9_kbd_reset() -{ - LOG(( "to9_kbd_reset called\n" )); - m_to9_kbd_overrun = 0; /* no byte lost */ - m_to9_kbd_status = ACIA_6850_TDRE; /* clear to transmit */ - m_to9_kbd_intr = 0; /* interrupt disabled */ - m_to9_kbd_caps = 1; - m_to9_kbd_periph = 0; - m_to9_kbd_pad = 0; - m_to9_kbd_byte_count = 0; - thom_set_caps_led( !m_to9_kbd_caps ); - m_to9_kbd_key_count = 0; - m_to9_kbd_last_key = 0xff; - to9_kbd_update_irq(); - m_to9_kbd_timer->adjust(TO9_KBD_POLL_PERIOD); -} - - - -void thomson_state::to9_kbd_init() -{ - LOG(( "to9_kbd_init called\n" )); - m_to9_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::to9_kbd_timer_cb),this)); - save_item(NAME(m_to9_kbd_parity)); - save_item(NAME(m_to9_kbd_intr)); - save_item(NAME(m_to9_kbd_in)); - save_item(NAME(m_to9_kbd_status)); - save_item(NAME(m_to9_kbd_overrun)); - save_item(NAME(m_to9_kbd_last_key)); - save_item(NAME(m_to9_kbd_key_count)); - save_item(NAME(m_to9_kbd_caps)); - save_item(NAME(m_to9_kbd_periph)); - save_item(NAME(m_to9_kbd_pad)); - save_item(NAME(m_to9_kbd_byte_count)); - save_item(NAME(m_to9_mouse_x)); - save_item(NAME(m_to9_mouse_y)); -} - - -/* ------------ system PIA 6821 ------------ */ - -/* afaik, P2-P7 are not connected, so, the warning about undefined 0xf0 can be safely ignored */ - - -READ8_MEMBER( thomson_state::to9_sys_porta_in ) -{ - UINT8 ktest = to9_kbd_ktest(); - - LOG_KBD(( "to9_sys_porta_in: ktest=%i\n", ktest )); - - return ktest; -} - - - -WRITE8_MEMBER( thomson_state::to9_sys_porta_out ) -{ - m_centronics->write_data1(BIT(data, 1)); - m_centronics->write_data2(BIT(data, 2)); - m_centronics->write_data3(BIT(data, 3)); - m_centronics->write_data4(BIT(data, 4)); - m_centronics->write_data5(BIT(data, 5)); - m_centronics->write_data6(BIT(data, 6)); - m_centronics->write_data7(BIT(data, 7)); -} - - - -WRITE8_MEMBER( thomson_state::to9_sys_portb_out ) -{ - m_centronics->write_data0(BIT(data, 0)); - m_centronics->write_strobe(BIT(data, 1)); - - to9_update_ram_bank(); - - if ( data & 4 ) /* bit 2: video overlay (TODO) */ - LOG(( "to9_sys_portb_out: video overlay not handled\n" )); -} - - - -/* ------------ 6846 (timer, I/O) ------------ */ - - - -WRITE8_MEMBER( thomson_state::to9_timer_port_out ) -{ - thom_set_mode_point( data & 1 ); /* bit 0: video bank */ - to9_update_ram_bank(); - to9_update_cart_bank(); -} - - -/* ------------ init / reset ------------ */ - - - -MACHINE_RESET_MEMBER( thomson_state, to9 ) -{ - LOG (( "to9: machine reset called\n" )); - - /* subsystems */ - thom_irq_reset(); - m_pia_sys->set_port_a_z_mask( 0xfe ); - to7_game_reset(); - to9_floppy_reset(); - to9_kbd_reset(); - to7_modem_reset(); - to7_midi_reset(); - - /* video */ - thom_set_video_mode( THOM_VMODE_TO9 ); - m_thom_lightpen_cb = &thomson_state::to7_lightpen_cb; - thom_set_lightpen_callback( 3 ); - thom_set_border_color( 8 ); - thom_set_mode_point( 0 ); - m_pia_sys->cb1_w( 0 ); - - /* memory */ - m_old_ram_bank = -1; - m_old_cart_bank = -1; - m_to9_soft_bank = 0; - to9_update_cart_bank(); - to9_update_ram_bank(); - /* thom_cart_bank not reset */ - - /* lightpen */ - m_to7_lightpen = 0; -} - - - -MACHINE_START_MEMBER( thomson_state, to9 ) -{ - UINT8* mem = memregion("maincpu")->base(); - UINT8* ram = m_ram->pointer(); - - LOG (( "to9: machine start called\n" )); - - /* subsystems */ - thom_irq_init(); - to7_game_init(); - to9_floppy_init( mem + 0xe000, mem + 0x40000 ); - to9_kbd_init(); - to9_palette_init(); - to7_modem_init(); - to7_midi_init(); - - /* memory */ - m_thom_vram = ram; - m_thom_cart_bank = 0; - m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - m_cartbank->configure_entries( 0, 12, mem + 0x10000, 0x4000 ); - m_basebank->configure_entry( 0, ram + 0x4000); - m_rambank->configure_entries( 0, 10, ram + 0x8000, 0x4000 ); - m_vrambank->set_entry( 0 ); - m_cartbank->set_entry( 0 ); - m_basebank->set_entry( 0 ); - m_rambank->set_entry( 0 ); - - /* save-state */ - save_item(NAME(m_thom_cart_nb_banks)); - save_item(NAME(m_thom_cart_bank)); - save_item(NAME(m_to7_lightpen)); - save_item(NAME(m_to7_lightpen_step)); - save_item(NAME(m_to9_soft_bank)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to9_update_ram_bank_postload), this)); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to9_update_cart_bank_postload), this)); -} - - - -/***************************** TO8 *************************/ - - -/* ------------ keyboard (6804) ------------ */ - -/* The 6804 chip scans the keyboard and sends keycodes to the 6809. - Data is serialized using variable pulse length encoding. - Unlike the TO9, there is no decoding chip on the 6809 side, only - 1-bit PIA ports (6821 & 6846). The 6809 does the decoding. - - We do not emulate the 6804 but pass serialized data directly through the - PIA ports. - - Note: if we conform to the (scarce) documentation the CPU tend to lock - waitting for keyboard input. - The protocol documentation is pretty scarce and does not account for these - behaviors! - The emulation code contains many hacks (delays, timeouts, spurious - pulses) to improve the stability. - This works well, but is not very accurate. -*/ - - - -/* polling interval */ -#define TO8_KBD_POLL_PERIOD attotime::from_msec( 1 ) - -/* first and subsequent repeat periods, in TO8_KBD_POLL_PERIOD units */ -#define TO8_KBD_REPEAT_DELAY 800 /* 800 ms */ -#define TO8_KBD_REPEAT_PERIOD 70 /* 70 ms */ - -/* timeout waiting for CPU */ -#define TO8_KBD_TIMEOUT attotime::from_msec( 100 ) - - - -/* quick keyboard scan */ -int thomson_state::to8_kbd_ktest() -{ - int line, bit; - UINT8 port; - - if ( m_io_config->read() & 2 ) - return 0; /* disabled */ - - for ( line = 0; line < 10; line++ ) - { - port = m_io_keyboard[line]->read(); - - if ( line == 7 || line == 9 ) - port |= 1; /* shift & control */ - - for ( bit = 0; bit < 8; bit++ ) - { - if ( ! (port & (1 << bit)) ) - return 1; - } - } - - return 0; -} - - - -/* keyboard scan & return keycode (or -1) */ -int thomson_state::to8_kbd_get_key() -{ - int control = (m_io_keyboard[7]->read() & 1) ? 0 : 0x100; - int shift = (m_io_keyboard[9]->read() & 1) ? 0 : 0x080; - int key = -1, line, bit; - UINT8 port; - - if ( m_io_config->read() & 2 ) - return -1; /* disabled */ - - for ( line = 0; line < 10; line++ ) - { - port = m_io_keyboard[line]->read(); - - if ( line == 7 || line == 9 ) - port |= 1; /* shift & control */ - - /* TODO: correct handling of simultaneous keystokes: - return the new key preferably & disable repeat - */ - for ( bit = 0; bit < 8; bit++ ) - { - if ( ! (port & (1 << bit)) ) - key = line * 8 + bit; - } - } - - if ( key == -1 ) - { - m_to8_kbd_last_key = 0xff; - m_to8_kbd_key_count = 0; - return -1; - } - else if ( key == 64 ) - { - /* caps lock */ - if ( m_to8_kbd_last_key == key ) - return -1; /* no repeat */ - m_to8_kbd_last_key = key; - m_to8_kbd_caps = !m_to8_kbd_caps; - if ( m_to8_kbd_caps ) - key |= 0x080; /* auto-shift */ - thom_set_caps_led( !m_to8_kbd_caps ); - return key; - } - else if ( key == m_to8_kbd_last_key ) - { - /* repeat */ - m_to8_kbd_key_count++; - if ( m_to8_kbd_key_count < TO8_KBD_REPEAT_DELAY || (m_to8_kbd_key_count - TO8_KBD_REPEAT_DELAY) % TO8_KBD_REPEAT_PERIOD ) - return -1; - return key | shift | control; - } - else - { - m_to8_kbd_last_key = key; - m_to8_kbd_key_count = 0; - return key | shift | control; - } -} - - -/* steps: - 0 = idle, key polling - 1 = wait for ack to go down (key to send) - 99-117 = key data transmit - 91-117 = signal - 255 = timeout -*/ - -/* keyboard automaton */ -void thomson_state::to8_kbd_timer_func() -{ - attotime d; - - LOG_KBD(( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", machine().time().as_double(), m_to8_kbd_step, m_to8_kbd_ack, m_to8_kbd_data )); - - if( ! m_to8_kbd_step ) - { - /* key polling */ - int k = to8_kbd_get_key(); - /* if not in transfer, send pulse from time to time - (helps avoiding CPU lock) - */ - if ( ! m_to8_kbd_ack ) - m_mc6846->set_input_cp1(0); - m_mc6846->set_input_cp1(1); - - if ( k == -1 ) - d = TO8_KBD_POLL_PERIOD; - else - { - /* got key! */ - LOG_KBD(( "to8_kbd_timer_cb: got key $%03X\n", k )); - m_to8_kbd_data = k; - m_to8_kbd_step = 1; - d = attotime::from_usec( 100 ); - } - } - else if ( m_to8_kbd_step == 255 ) - { - /* timeout */ - m_to8_kbd_last_key = 0xff; - m_to8_kbd_key_count = 0; - m_to8_kbd_step = 0; - m_mc6846->set_input_cp1(1); - d = TO8_KBD_POLL_PERIOD; - } - else if ( m_to8_kbd_step == 1 ) - { - /* schedule timeout waiting for ack to go down */ - m_mc6846->set_input_cp1(0); - m_to8_kbd_step = 255; - d = TO8_KBD_TIMEOUT; - } - else if ( m_to8_kbd_step == 117 ) - { - /* schedule timeout waiting for ack to go up */ - m_mc6846->set_input_cp1(0); - m_to8_kbd_step = 255; - d = TO8_KBD_TIMEOUT; - } - else if ( m_to8_kbd_step & 1 ) - { - /* send silence between bits */ - m_mc6846->set_input_cp1(0); - d = attotime::from_usec( 100 ); - m_to8_kbd_step++; - } - else - { - /* send bit */ - int bpos = 8 - ( (m_to8_kbd_step - 100) / 2); - int bit = (m_to8_kbd_data >> bpos) & 1; - m_mc6846->set_input_cp1(1); - d = attotime::from_usec( bit ? 56 : 38 ); - m_to8_kbd_step++; - } - m_to8_kbd_timer->adjust(d); -} - - - -TIMER_CALLBACK_MEMBER(thomson_state::to8_kbd_timer_cb) -{ - to8_kbd_timer_func(); -} - - - -/* cpu <-> keyboard hand-check */ -void thomson_state::to8_kbd_set_ack( int data ) -{ - if ( data == m_to8_kbd_ack ) - return; - m_to8_kbd_ack = data; - - if ( data ) - { - double len = m_to8_kbd_signal->elapsed( ).as_double() * 1000. - 2.; - LOG_KBD(( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", machine().time().as_double(), len )); - if ( m_to8_kbd_data == 0xfff ) - { - /* end signal from CPU */ - if ( len >= 0.6 && len <= 0.8 ) - { - LOG (( "%f to8_kbd_set_ack: INIT signal\n", machine().time().as_double() )); - m_to8_kbd_last_key = 0xff; - m_to8_kbd_key_count = 0; - m_to8_kbd_caps = 1; - /* send back signal: TODO returned codes ? */ - m_to8_kbd_data = 0; - m_to8_kbd_step = 0; - m_to8_kbd_timer->adjust(attotime::from_msec( 1 )); - } - else - { - m_to8_kbd_step = 0; - m_to8_kbd_timer->adjust(TO8_KBD_POLL_PERIOD); - if ( len >= 1.2 && len <= 1.4 ) - { - LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", machine().time().as_double() )); - m_to8_kbd_caps = 1; - } - else if ( len >= 1.8 && len <= 2.0 ) - { - LOG (( "%f to8_kbd_set_ack: CAPS off signal\n", machine().time().as_double() )); - m_to8_kbd_caps = 0; - } - } - thom_set_caps_led( !m_to8_kbd_caps ); - } - else - { - /* end key transmission */ - m_to8_kbd_step = 0; - m_to8_kbd_timer->adjust(TO8_KBD_POLL_PERIOD); - } - } - - else - { - if ( m_to8_kbd_step == 255 ) - { - /* CPU accepts key */ - m_to8_kbd_step = 99; - m_to8_kbd_timer->adjust(attotime::from_usec( 400 )); - } - else - { - /* start signal from CPU */ - m_to8_kbd_data = 0xfff; - m_to8_kbd_step = 91; - m_to8_kbd_timer->adjust(attotime::from_usec( 400 )); - m_to8_kbd_signal->adjust(attotime::never); - } - LOG_KBD(( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", machine().time().as_double(), m_to8_kbd_data )); - } -} - - - -void thomson_state::to8_kbd_reset() -{ - m_to8_kbd_last_key = 0xff; - m_to8_kbd_key_count = 0; - m_to8_kbd_step = 0; - m_to8_kbd_data = 0; - m_to8_kbd_ack = 1; - m_to8_kbd_caps = 1; - thom_set_caps_led( !m_to8_kbd_caps ); - to8_kbd_timer_func(); -} - - - -void thomson_state::to8_kbd_init() -{ - m_to8_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::to8_kbd_timer_cb),this)); - m_to8_kbd_signal = machine().scheduler().timer_alloc(FUNC_NULL); - save_item(NAME(m_to8_kbd_ack)); - save_item(NAME(m_to8_kbd_data)); - save_item(NAME(m_to8_kbd_step)); - save_item(NAME(m_to8_kbd_last_key)); - save_item(NAME(m_to8_kbd_key_count)); - save_item(NAME(m_to8_kbd_caps)); -} - - - -/* ------------ RAM / ROM banking ------------ */ - -void thomson_state::to8_update_floppy_bank() -{ - int bank = (m_to8_reg_sys1 & 0x80) ? to7_floppy_bank : (m_to8_bios_bank + TO7_NB_FLOP_BANK); - - if ( bank != m_old_floppy_bank ) - { - LOG_BANK(( "to8_update_floppy_bank: floppy ROM is %s bank %i\n", - (m_to8_reg_sys1 & 0x80) ? "external" : "internal", - bank % TO7_NB_FLOP_BANK )); - m_flopbank->set_entry( bank ); - m_old_floppy_bank = bank; - } -} - - - -void thomson_state::to8_update_floppy_bank_postload() -{ - to8_update_floppy_bank(); -} - - - -void thomson_state::to8_update_ram_bank() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - UINT8 bank = 0; - - if ( m_to8_reg_sys1 & 0x10 ) - { - bank = m_to8_reg_ram & 31; - } - else - { - UINT8 portb = m_pia_sys->port_b_z_mask(); - - switch ( portb & 0xf8 ) - { - /* in compatibility mode, banks 5 and 6 are reversed wrt TO7/70 */ - case 0xf0: bank = 2; break; - case 0xe8: bank = 3; break; - case 0x18: bank = 4; break; - case 0x58: bank = 5; break; - case 0x98: bank = 6; break; - case 0xd8: bank = 7; break; - case 0xf8: return; - default: - logerror( "to8_update_ram_bank: unknown RAM bank=$%02X\n", portb & 0xf8 ); - return; - } - } - - /* due to addressing distortion, the 16 KB banked memory space is - split into two 8 KB spaces: - - 0xa000-0xbfff maps to 0x2000-0x3fff in 16 KB bank - - 0xc000-0xdfff maps to 0x0000-0x1fff in 16 KB bank - this is important if we map a bank that is also reachable by another, - undistorted space, such as cartridge, page 0 (video), or page 1 - */ - if ( bank != m_old_ram_bank) - { - if (m_ram->size() == 512*1024 || m_to8_data_vpage < 16) - { - m_datalobank->set_entry( bank ); - m_datahibank->set_entry( bank ); - } - else - { - /* RAM size is 256 KB only and unavailable - * bank requested */ - space.nop_readwrite( 0xa000, 0xbfff); - space.nop_readwrite( 0xc000, 0xdfff); - } - m_to8_data_vpage = bank; - m_old_ram_bank = bank; - LOG_BANK(( "to8_update_ram_bank: select bank %i (%s style)\n", bank, (m_to8_reg_sys1 & 0x10) ? "new" : "old")); - } -} - - - -void thomson_state::to8_update_ram_bank_postload() -{ - to8_update_ram_bank(); -} - - - -void thomson_state::to8_update_cart_bank() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - int bank = 0; - int bank_is_read_only = 0; - - if ( m_to8_reg_cart & 0x20 ) - { - /* RAM space */ - m_to8_cart_vpage = m_to8_reg_cart & 31; - bank = 8 + m_to8_cart_vpage; - bank_is_read_only = (( m_to8_reg_cart & 0x40 ) == 0); - if ( bank != m_old_cart_bank ) - { - /* mapping to VRAM */ - if (m_ram->size() == 512*1024 || m_to8_cart_vpage < 16) - { - if (m_to8_cart_vpage < 4) - { - if (m_old_cart_bank < 8 || m_old_cart_bank > 11) - { - space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); - if ( bank_is_read_only ) - { - space.nop_write( 0x0000, 0x3fff); - } - else - { - space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_vcart_w),this)); - } - } - } - else - { - if (m_old_cart_bank < 12) - { - if ( bank_is_read_only ) - { - space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); - space.nop_write( 0x0000, 0x3fff); - } - else - { - space.install_readwrite_bank(0x0000, 0x3fff, m_cartbank); - } - } - } - } - else - { - /* RAM size is 256 KB only and unavailable - * bank requested */ - space.nop_readwrite( 0x0000, 0x3fff); - } - LOG_BANK(( "to8_update_cart_bank: CART is RAM bank %i (%s)\n", - m_to8_cart_vpage, - bank_is_read_only ? "read-only":"read-write")); - } - else - { - if ( bank_is_read_only != m_old_cart_bank_was_read_only ) - { - if ( bank_is_read_only ) - { - space.nop_write( 0x0000, 0x3fff); - } - else - { - if (m_to8_cart_vpage < 4) - { - space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_vcart_w),this)); - } - else - { - space.install_readwrite_bank( 0x0000, 0x3fff, m_cartbank ); - } - } - LOG_BANK(( "to8_update_cart_bank: update CART bank %i write status to %s\n", - m_to8_cart_vpage, - bank_is_read_only ? "read-only":"read-write")); - } - } - m_old_cart_bank_was_read_only = bank_is_read_only; - } - else - { - if ( m_to8_soft_select ) - { - /* internal software ROM space */ - bank = 4 + m_to8_soft_bank; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 4 || m_old_cart_bank > 7 ) - { - space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); - space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_cartridge_w),this) ); - } - LOG_BANK(( "to8_update_cart_bank: CART is internal bank %i\n", m_to8_soft_bank )); - } - } - else - { - /* external cartridge ROM space */ - if ( m_thom_cart_nb_banks ) - { - bank = m_thom_cart_bank % m_thom_cart_nb_banks; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) - { - space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); - space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_cartridge_w),this) ); - space.install_read_handler( 0x0000, 0x0003, read8_delegate(FUNC(thomson_state::to8_cartridge_r),this) ); - } - LOG_BANK(( "to8_update_cart_bank: CART is external cartridge bank %i\n", bank )); - } - } - else - { - if ( m_old_cart_bank != 0 ) - { - space.nop_read( 0x0000, 0x3fff); - LOG_BANK(( "to8_update_cart_bank: CART is unmapped\n")); - } - } - } - } - if ( bank != m_old_cart_bank ) - { - m_cartbank->set_entry( bank ); - m_old_cart_bank = bank; - } -} - - - -void thomson_state::to8_update_cart_bank_postload() -{ - to8_update_cart_bank(); -} - - - -/* ROM bank switch */ -WRITE8_MEMBER( thomson_state::to8_cartridge_w ) -{ - if ( offset >= 0x2000 ) - return; - - if ( m_to8_soft_select ) - m_to8_soft_bank = offset & 3; - else - m_thom_cart_bank = offset & 3; - - to8_update_cart_bank(); -} - - - -/* read signal to 0000-0003 generates a bank switch */ -READ8_MEMBER( thomson_state::to8_cartridge_r ) -{ - UINT8* pos = memregion( "maincpu" )->base() + 0x10000; - UINT8 data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; - if ( !space.debugger_access() ) - { - m_thom_cart_bank = offset & 3; - to8_update_cart_bank(); - } - return data; -} - - -/* ------------ floppy / network controller dispatch ------------ */ - - - -void thomson_state::to8_floppy_init() -{ - UINT8* mem = memregion("maincpu")->base(); - to7_floppy_init( mem + 0x34000 ); -} - - - -void thomson_state::to8_floppy_reset() -{ - UINT8* mem = memregion("maincpu")->base(); - to7_floppy_reset(); - if ( THOM_FLOPPY_INT ) - thmfc_floppy_reset(); - m_flopbank->configure_entries( TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 ); -} - - - -READ8_MEMBER( thomson_state::to8_floppy_r ) -{ - if ( space.debugger_access() ) - return 0; - - if ( (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) - /* external controller */ - return to7_floppy_r( space, offset ); - else if ( ! (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) - /* internal controller */ - return thmfc_floppy_r( space, offset ); - else - /* no controller */ - return 0; -} - - - -WRITE8_MEMBER( thomson_state::to8_floppy_w ) -{ - if ( (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) - /* external controller */ - to7_floppy_w( space, offset, data ); - else if ( ! (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) - /* internal controller */ - thmfc_floppy_w( space, offset, data ); -} - - - -/* ------------ system gate-array ------------ */ - - - -#define TO8_LIGHTPEN_DECAL 16 - - - -READ8_MEMBER( thomson_state::to8_gatearray_r ) -{ - struct thom_vsignal v = thom_get_vsignal(); - struct thom_vsignal l = thom_get_lightpen_vsignal( TO8_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 6 ); - int count, inil, init, lt3; - UINT8 res; - count = m_to7_lightpen ? l.count : v.count; - inil = m_to7_lightpen ? l.inil : v.inil; - init = m_to7_lightpen ? l.init : v.init; - lt3 = m_to7_lightpen ? l.lt3 : v.lt3; - - switch ( offset ) - { - case 0: /* system 2 / lightpen register 1 */ - if ( m_to7_lightpen ) - res = (count >> 8) & 0xff; - else - res = m_to8_reg_sys2 & 0xf0; - break; - - case 1: /* ram register / lightpen register 2 */ - if ( m_to7_lightpen ) - { - if ( !space.debugger_access() ) - { - thom_firq_2( 0 ); - m_to8_lightpen_intr = 0; - } - res = count & 0xff; - } - else - res = m_to8_reg_ram & 0x1f; - break; - - case 2: /* cartrige register / lightpen register 3 */ - if ( m_to7_lightpen ) - res = (lt3 << 7) | (inil << 6); - else - res = m_to8_reg_cart; - break; - - case 3: /* lightpen register 4 */ - res = (v.init << 7) | (init << 6) | (v.inil << 5) | (m_to8_lightpen_intr << 1) | m_to7_lightpen; - break; - - default: - logerror( "$%04x to8_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); - res = 0; - } - - LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", - m_maincpu->pc(), machine().time().as_double(), - offset, 0xe7e4 + offset, res, m_to7_lightpen )); - - return res; -} - - - -WRITE8_MEMBER( thomson_state::to8_gatearray_w ) -{ - LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", - m_maincpu->pc(), machine().time().as_double(), - offset, 0xe7e4 + offset, data )); - - switch ( offset ) - { - case 0: /* switch */ - m_to7_lightpen = data & 1; - break; - - case 1: /* ram register */ - if ( m_to8_reg_sys1 & 0x10 ) - { - m_to8_reg_ram = data; - to8_update_ram_bank(); - } - break; - - case 2: /* cartridge register */ - m_to8_reg_cart = data; - to8_update_cart_bank(); - break; - - case 3: /* system register 1 */ - m_to8_reg_sys1 = data; - to8_update_floppy_bank(); - to8_update_ram_bank(); - to8_update_cart_bank(); - break; - - default: - logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n", - m_maincpu->pc(), offset, data ); - } -} - - - -/* ------------ video gate-array ------------ */ - - - -READ8_MEMBER( thomson_state::to8_vreg_r ) -{ - /* 0xe7dc from external floppy drive aliases the video gate-array */ - if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) && ( m_to8_reg_sys1 & 0x80 ) ) - { - if ( space.debugger_access() ) - return 0; - - if ( THOM_FLOPPY_EXT ) - return to7_floppy_r( space, 0xc ); - else - return 0; - } - - switch ( offset ) - { - case 0: /* palette data */ - { - UINT8 c = m_to9_palette_data[ m_to9_palette_idx ]; - if ( !space.debugger_access() ) - { - m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; - } - return c; - } - - case 1: /* palette address */ - return m_to9_palette_idx; - - case 2: - case 3: - return 0; - - default: - logerror( "to8_vreg_r: invalid read offset %i\n", offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::to8_vreg_w ) -{ - LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", - m_maincpu->pc(), machine().time().as_double(), - offset, 0xe7da + offset, data )); - - switch ( offset ) - { - case 0: /* palette data */ - { - UINT16 color, idx; - m_to9_palette_data[ m_to9_palette_idx ] = data; - idx = m_to9_palette_idx / 2; - color = m_to9_palette_data[ 2 * idx + 1 ]; - color = m_to9_palette_data[ 2 * idx ] | (color << 8); - thom_set_palette( idx, color & 0x1fff ); - m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; - } - break; - - case 1: /* palette address */ - m_to9_palette_idx = data & 31; - break; - - case 2: /* display register */ - to9_set_video_mode( data, 1 ); - break; - - case 3: /* system register 2 */ - /* 0xe7dc from external floppy drive aliases the video gate-array */ - if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) && ( m_to8_reg_sys1 & 0x80 ) ) - { - if ( THOM_FLOPPY_EXT ) - to7_floppy_w( space, 0xc, data ); - } - else - { - m_to8_reg_sys2 = data; - thom_set_video_page( data >> 6 ); - thom_set_border_color( data & 15 ); - } - break; - - default: - logerror( "to8_vreg_w: invalid write offset %i data=$%02X\n", offset, data ); - } -} - - - -/* ------------ system PIA 6821 ------------ */ - - - -READ8_MEMBER( thomson_state::to8_sys_porta_in ) -{ - int ktest = to8_kbd_ktest(); - - LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", m_maincpu->pc(), machine().time().as_double(), ktest )); - - return ktest; -} - - - -WRITE8_MEMBER( thomson_state::to8_sys_portb_out ) -{ - m_centronics->write_data0(BIT(data, 0)); - m_centronics->write_strobe(BIT(data, 1)); - - to8_update_ram_bank(); - - if ( data & 4 ) /* bit 2: video overlay (TODO) */ - LOG(( "to8_sys_portb_out: video overlay not handled\n" )); -} - - - -/* ------------ 6846 (timer, I/O) ------------ */ - - -WRITE_LINE_MEMBER(thomson_state::write_centronics_busy ) -{ - m_centronics_busy = state; -} - -READ8_MEMBER( thomson_state::to8_timer_port_in ) -{ - int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; - int cass = to7_get_cassette() ? 0x80 : 0; - int dtr = m_centronics_busy << 6; - int lock = m_to8_kbd_caps ? 0 : 8; /* undocumented! */ - return lightpen | cass | dtr | lock; -} - - - -WRITE8_MEMBER( thomson_state::to8_timer_port_out ) -{ - int ack = (data & 0x20) ? 1 : 0; /* bit 5: keyboard ACK */ - m_to8_bios_bank = (data & 0x10) ? 1 : 0; /* bit 4: BIOS bank*/ - thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - m_biosbank->set_entry( m_to8_bios_bank ); - m_to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */ - to8_update_floppy_bank(); - to8_update_cart_bank(); - to8_kbd_set_ack(ack); -} - - - -WRITE8_MEMBER( thomson_state::to8_timer_cp2_out ) -{ - /* mute */ - m_to7_game_mute = data; - to7_game_sound_update(); -} - -/* ------------ lightpen ------------ */ - - - -/* direct connection to interrupt line instead of through a PIA */ -void thomson_state::to8_lightpen_cb( int step ) -{ - if ( ! m_to7_lightpen ) - return; - - thom_firq_2( 1 ); - m_to7_lightpen_step = step; - m_to8_lightpen_intr = 1; -} - - - -/* ------------ init / reset ------------ */ - - - -MACHINE_RESET_MEMBER( thomson_state, to8 ) -{ - LOG (( "to8: machine reset called\n" )); - - /* subsystems */ - thom_irq_reset(); - m_pia_sys->set_port_a_z_mask( 0xfe ); - to7_game_reset(); - to8_floppy_reset(); - to8_kbd_reset(); - to7_modem_reset(); - to7_midi_reset(); - - /* gate-array */ - m_to7_lightpen = 0; - m_to8_reg_ram = 0; - m_to8_reg_cart = 0; - m_to8_reg_sys1 = 0; - m_to8_reg_sys2 = 0; - m_to8_lightpen_intr = 0; - m_to8_soft_select = 0; - - /* video */ - thom_set_video_mode( THOM_VMODE_TO770 ); - m_thom_lightpen_cb = &thomson_state::to8_lightpen_cb; - thom_set_lightpen_callback( 4 ); - thom_set_border_color( 0 ); - thom_set_mode_point( 0 ); - m_pia_sys->cb1_w( 0 ); - - /* memory */ - m_old_ram_bank = -1; - m_old_cart_bank = -1; - m_old_cart_bank_was_read_only = 0; - m_old_floppy_bank = -1; - m_to8_cart_vpage = 0; - m_to8_data_vpage = 0; - m_to8_soft_bank = 0; - m_to8_bios_bank = 0; - to8_update_ram_bank(); - to8_update_cart_bank(); - to8_update_floppy_bank(); - m_biosbank->set_entry( 0 ); - /* thom_cart_bank not reset */ -} - - - -MACHINE_START_MEMBER( thomson_state, to8 ) -{ - UINT8* mem = memregion("maincpu")->base(); - UINT8* ram = m_ram->pointer(); - - LOG (( "to8: machine start called\n" )); - - /* subsystems */ - thom_irq_init(); - to7_game_init(); - to8_floppy_init(); - to8_kbd_init(); - to9_palette_init(); - to7_modem_init(); - to7_midi_init(); - - /* memory */ - m_thom_cart_bank = 0; - m_thom_vram = ram; - m_cartbank->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); - if ( m_ram->size() == 256*1024 ) - { - m_cartbank->configure_entries( 8, 16, ram, 0x4000 ); - m_cartbank->configure_entries( 8+16, 16, ram, 0x4000 ); - m_datalobank->configure_entries( 0, 16, ram + 0x2000, 0x4000 ); - m_datalobank->configure_entries( 16, 16, ram + 0x2000, 0x4000 ); - m_datahibank->configure_entries( 0, 16, ram + 0x0000, 0x4000 ); - m_datahibank->configure_entries( 16, 16, ram + 0x0000, 0x4000 ); - } - else - { - m_cartbank->configure_entries( 8, 32, ram, 0x4000 ); - m_datalobank->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); - m_datahibank->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); - } - m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); - m_syslobank->configure_entry( 0, ram + 0x6000); - m_syshibank->configure_entry( 0, ram + 0x4000); - m_biosbank->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); - m_cartbank->set_entry( 0 ); - m_vrambank->set_entry( 0 ); - m_syslobank->set_entry( 0 ); - m_syshibank->set_entry( 0 ); - m_datalobank->set_entry( 0 ); - m_datahibank->set_entry( 0 ); - m_biosbank->set_entry( 0 ); - - /* save-state */ - save_item(NAME(m_thom_cart_nb_banks)); - save_item(NAME(m_thom_cart_bank)); - save_item(NAME(m_to7_lightpen)); - save_item(NAME(m_to7_lightpen_step)); - save_item(NAME(m_to8_reg_ram)); - save_item(NAME(m_to8_reg_cart)); - save_item(NAME(m_to8_reg_sys1)); - save_item(NAME(m_to8_reg_sys2)); - save_item(NAME(m_to8_soft_select)); - save_item(NAME(m_to8_soft_bank)); - save_item(NAME(m_to8_bios_bank)); - save_item(NAME(m_to8_lightpen_intr)); - save_item(NAME(m_to8_data_vpage)); - save_item(NAME(m_to8_cart_vpage)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_ram_bank_postload), this)); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_cart_bank_postload), this)); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_floppy_bank_postload), this)); -} - - - -/***************************** TO9+ *************************/ - - - -/* ------------ system PIA 6821 ------------ */ - - - -/* ------------ 6846 (timer, I/O) ------------ */ - - - -READ8_MEMBER( thomson_state::to9p_timer_port_in ) -{ - int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; - int cass = to7_get_cassette() ? 0x80 : 0; - int dtr = m_centronics_busy << 6; - return lightpen | cass | dtr; -} - - - -WRITE8_MEMBER( thomson_state::to9p_timer_port_out ) -{ - int bios_bank = (data & 0x10) ? 1 : 0; /* bit 4: BIOS bank */ - thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - m_biosbank->set_entry( bios_bank ); - m_to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */ - to8_update_floppy_bank(); - to8_update_cart_bank(); -} - -/* ------------ init / reset ------------ */ - -MACHINE_RESET_MEMBER( thomson_state, to9p ) -{ - LOG (( "to9p: machine reset called\n" )); - - /* subsystems */ - thom_irq_reset(); - m_pia_sys->set_port_a_z_mask( 0xfe ); - to7_game_reset(); - to8_floppy_reset(); - to9_kbd_reset(); - to7_modem_reset(); - to7_midi_reset(); - - /* gate-array */ - m_to7_lightpen = 0; - m_to8_reg_ram = 0; - m_to8_reg_cart = 0; - m_to8_reg_sys1 = 0; - m_to8_reg_sys2 = 0; - m_to8_lightpen_intr = 0; - m_to8_soft_select = 0; - - /* video */ - thom_set_video_mode( THOM_VMODE_TO770 ); - m_thom_lightpen_cb = &thomson_state::to8_lightpen_cb; - thom_set_lightpen_callback( 4 ); - thom_set_border_color( 0 ); - thom_set_mode_point( 0 ); - m_pia_sys->cb1_w( 0 ); - - /* memory */ - m_old_ram_bank = -1; - m_old_cart_bank = -1; - m_old_floppy_bank = -1; - m_to8_cart_vpage = 0; - m_to8_data_vpage = 0; - m_to8_soft_bank = 0; - m_to8_bios_bank = 0; - to8_update_ram_bank(); - to8_update_cart_bank(); - to8_update_floppy_bank(); - m_biosbank->set_entry( 0 ); - /* thom_cart_bank not reset */ -} - - - -MACHINE_START_MEMBER( thomson_state, to9p ) -{ - UINT8* mem = memregion("maincpu")->base(); - UINT8* ram = m_ram->pointer(); - - LOG (( "to9p: machine start called\n" )); - - /* subsystems */ - thom_irq_init(); - to7_game_init(); - to8_floppy_init(); - to9_kbd_init(); - to9_palette_init(); - to7_modem_init(); - to7_midi_init(); - - /* memory */ - m_thom_cart_bank = 0; - m_thom_vram = ram; - m_cartbank->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); - m_cartbank->configure_entries( 8, 32, ram, 0x4000 ); - m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); - m_syslobank->configure_entry( 0, ram + 0x6000 ); - m_syshibank->configure_entry( 0, ram + 0x4000 ); - m_datalobank->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); - m_datahibank->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); - m_biosbank->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); - m_cartbank->set_entry( 0 ); - m_vrambank->set_entry( 0 ); - m_syslobank->set_entry( 0 ); - m_syshibank->set_entry( 0 ); - m_datalobank->set_entry( 0 ); - m_datahibank->set_entry( 0 ); - m_biosbank->set_entry( 0 ); - - /* save-state */ - save_item(NAME(m_thom_cart_nb_banks)); - save_item(NAME(m_thom_cart_bank)); - save_item(NAME(m_to7_lightpen)); - save_item(NAME(m_to7_lightpen_step)); - save_item(NAME(m_to8_reg_ram)); - save_item(NAME(m_to8_reg_cart)); - save_item(NAME(m_to8_reg_sys1)); - save_item(NAME(m_to8_reg_sys2)); - save_item(NAME(m_to8_soft_select)); - save_item(NAME(m_to8_soft_bank)); - save_item(NAME(m_to8_bios_bank)); - save_item(NAME(m_to8_lightpen_intr)); - save_item(NAME(m_to8_data_vpage)); - save_item(NAME(m_to8_cart_vpage)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_ram_bank_postload), this)); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_cart_bank_postload), this)); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_floppy_bank_postload), this)); -} - - - -/****************** MO6 / Olivetti Prodest PC 128 *******************/ - - - -/* ------------ RAM / ROM banking ------------ */ - - - -void thomson_state::mo6_update_ram_bank() -{ - UINT8 bank = 0; - - if ( m_to8_reg_sys1 & 0x10 ) - { - bank = m_to8_reg_ram & 7; /* 128 KB RAM only = 8 pages */ - } - if ( bank != m_to8_data_vpage ) { - m_datalobank->set_entry( bank ); - m_datahibank->set_entry( bank ); - m_to8_data_vpage = bank; - m_old_ram_bank = bank; - LOG_BANK(( "mo6_update_ram_bank: select bank %i (new style)\n", bank )); - } -} - - - -void thomson_state::mo6_update_ram_bank_postload() -{ - mo6_update_ram_bank(); -} - - - -void thomson_state::mo6_update_cart_bank() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - int b = (m_pia_sys->a_output() >> 5) & 1; - int bank = 0; - int bank_is_read_only = 0; - - if ( ( ( m_to8_reg_sys1 & 0x40 ) && ( m_to8_reg_cart & 0x20 ) ) || ( ! ( m_to8_reg_sys1 & 0x40 ) && ( m_mo5_reg_cart & 4 ) ) ) - { - /* RAM space */ - if ( m_to8_reg_sys1 & 0x40 ) - { - /* use a7e6 */ - m_to8_cart_vpage = m_to8_reg_cart & 7; /* 128 KB RAM only = 8 pages */ - bank = 8 + m_to8_cart_vpage; - bank_is_read_only = (( m_to8_reg_cart & 0x40 ) == 0); - if ( bank != m_old_cart_bank ) - { - if (m_to8_cart_vpage < 4) - { - if (m_old_cart_bank < 8 || m_old_cart_bank > 11) - { - space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_read_bank( 0xc000, 0xefff, m_carthibank ); - if ( bank_is_read_only ) - { - space.nop_write( 0xb000, 0xefff); - } - else - { - space.install_write_handler( 0xb000, 0xbfff, write8_delegate(FUNC(thomson_state::mo6_vcart_lo_w),this)); - space.install_write_handler( 0xc000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_vcart_hi_w),this)); - } - } - } - else - { - if (m_old_cart_bank < 12) - { - if ( bank_is_read_only ) - { - space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_read_bank( 0xc000, 0xefff, m_carthibank ); - space.nop_write( 0xb000, 0xefff); - } - else - { - space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); - } - } - } - LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (%s)\n", - m_to8_cart_vpage, - bank_is_read_only ? "read-only":"read-write")); - } - else if ( bank_is_read_only != m_old_cart_bank_was_read_only ) - { - if ( bank_is_read_only ) - { - space.nop_write( 0xb000, 0xefff); - } - else - { - if (m_to8_cart_vpage < 4) - { - space.install_write_handler( 0xb000, 0xbfff, write8_delegate(FUNC(thomson_state::mo6_vcart_lo_w),this)); - space.install_write_handler( 0xc000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_vcart_hi_w),this)); - } - else - { - space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); - } - } - LOG_BANK(( "mo6_update_cart_bank: update CART bank %i write status to %s\n", - m_to8_cart_vpage, - bank_is_read_only ? "read-only":"read-write")); - } - m_old_cart_bank_was_read_only = bank_is_read_only; - } - else if ( m_thom_cart_nb_banks == 4 ) - { - /* "JANE"-style cartridge bank switching */ - bank = m_mo5_reg_cart & 3; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) - { - space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_read_bank( 0xc000, 0xefff, m_carthibank ); - space.nop_write( 0xb000, 0xefff); - } - LOG_BANK(( "mo6_update_cart_bank: CART is external cartridge bank %i (A7CB style)\n", bank )); - } - } - else - { - /* RAM from MO5 network extension */ - int bank_is_read_only = (( m_mo5_reg_cart & 8 ) == 0); - m_to8_cart_vpage = (m_mo5_reg_cart & 3) | 4; - bank = 8 + m_to8_cart_vpage; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 12 ) - { - if ( bank_is_read_only ) - { - space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_read_bank( 0xc000, 0xefff, m_carthibank ); - space.nop_write( 0xb000, 0xefff); - } - else - { - space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); - } - } - LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (MO5 compat.) (%s)\n", - m_to8_cart_vpage, - bank_is_read_only ? "read-only":"read-write")); - } - else if ( bank_is_read_only != m_old_cart_bank_was_read_only ) - { - if ( bank_is_read_only ) - { - space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_read_bank( 0xc000, 0xefff, m_carthibank ); - space.nop_write( 0xb000, 0xefff); - } - else - { - space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); - } - LOG_BANK(( "mo5_update_cart_bank: update CART bank %i write status to %s\n", - m_to8_cart_vpage, - bank_is_read_only ? "read-only":"read-write")); - } - m_old_cart_bank_was_read_only = bank_is_read_only; - } - } - else - { - /* ROM space */ - if ( m_to8_reg_sys2 & 0x20 ) - { - /* internal ROM */ - if ( m_to8_reg_sys2 & 0x10) - { - bank = b + 6; /* BASIC 128 */ - } - else - { - bank = b + 4; /* BASIC 1 */ - } - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 4 || m_old_cart_bank > 7 ) - { - space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_read_bank( 0xc000, 0xefff, m_carthibank ); - space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_cartridge_w),this) ); - } - LOG_BANK(( "mo6_update_cart_bank: CART is internal ROM bank %i\n", b )); - } - } - else - { - /* cartridge */ - if ( m_thom_cart_nb_banks ) - { - bank = m_thom_cart_bank % m_thom_cart_nb_banks; - if ( bank != m_old_cart_bank ) - { - if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) - { - space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); - space.install_read_bank( 0xc000, 0xefff, m_carthibank ); - space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_cartridge_w),this) ); - space.install_read_handler( 0xbffc, 0xbfff, read8_delegate(FUNC(thomson_state::mo6_cartridge_r),this) ); - } - LOG_BANK(( "mo6_update_cart_bank: CART is external cartridge bank %i\n", bank )); - } - } - else - { - if ( m_old_cart_bank != 0 ) - { - space.nop_read( 0xb000, 0xefff ); - LOG_BANK(( "mo6_update_cart_bank: CART is unmapped\n")); - } - } - } - } - if ( bank != m_old_cart_bank ) - { - m_cartlobank->set_entry( bank ); - m_carthibank->set_entry( bank ); - m_biosbank->set_entry( b ); - m_old_cart_bank = bank; - } -} - - - -void thomson_state::mo6_update_cart_bank_postload() -{ - mo6_update_cart_bank(); -} - - - -/* write signal generates a bank switch */ -WRITE8_MEMBER( thomson_state::mo6_cartridge_w ) -{ - if ( offset >= 0x2000 ) - return; - - m_thom_cart_bank = offset & 3; - mo6_update_cart_bank(); -} - - - -/* read signal generates a bank switch */ -READ8_MEMBER( thomson_state::mo6_cartridge_r ) -{ - UINT8* pos = memregion( "maincpu" )->base() + 0x10000; - UINT8 data = pos[offset + 0xbffc + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; - if ( !space.debugger_access() ) - { - m_thom_cart_bank = offset & 3; - mo6_update_cart_bank(); - } - return data; -} - - - -WRITE8_MEMBER( thomson_state::mo6_ext_w ) -{ - /* MO5 network extension compatible */ - m_mo5_reg_cart = data; - mo6_update_cart_bank(); -} - - - -/* ------------ game 6821 PIA ------------ */ - -/* similar to SX 90-018, but with a few differences: mute, printer */ - - -WRITE_LINE_MEMBER( thomson_state::mo6_centronics_busy ) -{ - m_pia_game->cb1_w(state); -} - - -WRITE8_MEMBER( thomson_state::mo6_game_porta_out ) -{ - LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", m_maincpu->pc(), machine().time().as_double(), data )); - - /* centronics data */ - m_cent_data_out->write(data); -} - - - -WRITE_LINE_MEMBER( thomson_state::mo6_game_cb2_out ) -{ - LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", m_maincpu->pc(), machine().time().as_double(), state )); - - /* centronics strobe */ - m_centronics->write_strobe(state); -} - - - -TIMER_CALLBACK_MEMBER(thomson_state::mo6_game_update_cb) -{ - /* unlike the TO8, CB1 & CB2 are not connected to buttons */ - if ( m_io_config->read() & 1 ) - { - UINT8 mouse = to7_get_mouse_signal(); - m_pia_game->ca1_w( BIT(mouse, 0) ); /* XA */ - m_pia_game->ca2_w( BIT(mouse, 1) ); /* YA */ - } - else - { - /* joystick */ - UINT8 in = m_io_game_port_buttons->read(); - m_pia_game->ca1_w( BIT(in, 2) ); /* P1 action B */ - m_pia_game->ca2_w( BIT(in, 6) ); /* P1 action A */ - } -} - - - -void thomson_state::mo6_game_init() -{ - LOG (( "mo6_game_init called\n" )); - m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo6_game_update_cb),this)); - m_to7_game_timer->adjust(TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD); - save_item(NAME(m_to7_game_sound)); - save_item(NAME(m_to7_game_mute)); -} - - - -void thomson_state::mo6_game_reset() -{ - LOG (( "mo6_game_reset called\n" )); - m_pia_game->ca1_w( 0 ); - m_to7_game_sound = 0; - m_to7_game_mute = 0; - to7_game_sound_update(); -} - - - -/* ------------ system PIA 6821 ------------ */ - - - -READ8_MEMBER( thomson_state::mo6_sys_porta_in ) -{ - return - (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ - 8 | /* bit 3: kbd-line float up to 1 */ - ((m_io_lightpen_button->read() & 1) ? 2 : 0); - /* bit 1: lightpen button */; -} - - - -READ8_MEMBER( thomson_state::mo6_sys_portb_in ) -{ - /* keyboard: 9 lines of 8 keys */ - UINT8 porta = m_pia_sys->a_output(); - UINT8 portb = m_pia_sys->b_output(); - int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ - int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ - - if ( ! (porta & 8) ) - lin = 8; /* A bit 3: 9-th kbd line select */ - - return - ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; - /* bit 7: key up */ -} - - - -WRITE8_MEMBER( thomson_state::mo6_sys_porta_out ) -{ - thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - m_to7_game_mute = data & 4; /* bit 2: sound mute */ - thom_set_caps_led( (data & 16) ? 0 : 1 ) ; /* bit 4: keyboard led */ - mo5_set_cassette( (data & 0x40) ? 1 : 0 ); /* bit 6: cassette output */ - mo6_update_cart_bank(); /* bit 5: rom bank */ - to7_game_sound_update(); -} - - - -WRITE8_MEMBER( thomson_state::mo6_sys_portb_out ) -{ - m_buzzer->write_unsigned8((data & 1) ? 0x80 : 0); /* bit 0: buzzer */ -} - - - -WRITE_LINE_MEMBER( thomson_state::mo6_sys_cb2_out ) -{ - /* SCART pin 8 = slow switch (?) */ - LOG(( "mo6_sys_cb2_out: SCART slow switch set to %i\n", state )); -} - - - -/* ------------ system gate-array ------------ */ - -#define MO6_LIGHTPEN_DECAL 12 - - - -READ8_MEMBER( thomson_state::mo6_gatearray_r ) -{ - struct thom_vsignal v = thom_get_vsignal(); - struct thom_vsignal l = thom_get_lightpen_vsignal( MO6_LIGHTPEN_DECAL, m_to7_lightpen_step - 1, 6 ); - int count, inil, init, lt3; - UINT8 res; - count = m_to7_lightpen ? l.count : v.count; - inil = m_to7_lightpen ? l.inil : v.inil; - init = m_to7_lightpen ? l.init : v.init; - lt3 = m_to7_lightpen ? l.lt3 : v.lt3; - - switch ( offset ) - { - case 0: /* system 2 / lightpen register 1 */ - if ( m_to7_lightpen ) - res = (count >> 8) & 0xff; - else - res = m_to8_reg_sys2 & 0xf0; - break; - - case 1: /* ram register / lightpen register 2 */ - if ( m_to7_lightpen ) - { - if ( !space.debugger_access() ) - { - thom_firq_2( 0 ); - m_to8_lightpen_intr = 0; - } - res = count & 0xff; - } - else - res = m_to8_reg_ram & 0x1f; - break; - - case 2: /* cartrige register / lightpen register 3 */ - if ( m_to7_lightpen ) - res = (lt3 << 7) | (inil << 6); - else - res = 0; - break; - - case 3: /* lightpen register 4 */ - res = (v.init << 7) | (init << 6) | (v.inil << 5) | (m_to8_lightpen_intr << 1) | m_to7_lightpen; - break; - - default: - logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", m_maincpu->pc(), offset ); - res = 0; - } - - LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", - m_maincpu->pc(), machine().time().as_double(), - offset, 0xa7e4 + offset, res, m_to7_lightpen )); - - return res; -} - - - -WRITE8_MEMBER( thomson_state::mo6_gatearray_w ) -{ - LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", - m_maincpu->pc(), machine().time().as_double(), - offset, 0xa7e4 + offset, data )); - - switch ( offset ) - { - case 0: /* switch */ - m_to7_lightpen = data & 1; - break; - - case 1: /* ram register */ - if ( m_to8_reg_sys1 & 0x10 ) - { - m_to8_reg_ram = data; - mo6_update_ram_bank(); - } - break; - - case 2: /* cartridge register */ - m_to8_reg_cart = data; - mo6_update_cart_bank(); - break; - - case 3: /* system register 1 */ - m_to8_reg_sys1 = data; - mo6_update_ram_bank(); - mo6_update_cart_bank(); - break; - - default: - logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", m_maincpu->pc(), offset, data ); - } -} - - -/* ------------ video gate-array ------------ */ - - - -READ8_MEMBER( thomson_state::mo6_vreg_r ) -{ - /* 0xa7dc from external floppy drive aliases the video gate-array */ - if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) ) - { - if ( !space.debugger_access() ) - return to7_floppy_r( space, 0xc ); - } - - switch ( offset ) - { - case 0: /* palette data */ - case 1: /* palette address */ - return to8_vreg_r( space, offset ); - - case 2: - case 3: - return 0; - - default: - logerror( "mo6_vreg_r: invalid read offset %i\n", offset ); - return 0; - } -} - - - -WRITE8_MEMBER( thomson_state::mo6_vreg_w ) -{ - LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", - m_maincpu->pc(), machine().time().as_double(), - offset, 0xa7da + offset, data )); - - switch ( offset ) - { - case 0: /* palette data */ - case 1: /* palette address */ - to8_vreg_w( space, offset, data ); - return; - - case 2: /* display / external floppy register */ - if ( ( m_to8_reg_sys1 & 0x80 ) && ( m_to8_reg_ram & 0x80 ) ) - to7_floppy_w( space, 0xc, data ); - else - to9_set_video_mode( data, 2 ); - break; - - case 3: /* system register 2 */ - /* 0xa7dc from external floppy drive aliases the video gate-array */ - if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) ) - to7_floppy_w( space, 0xc, data ); - else - { - m_to8_reg_sys2 = data; - thom_set_video_page( data >> 6 ); - thom_set_border_color( data & 15 ); - mo6_update_cart_bank(); - } - break; - - default: - logerror( "mo6_vreg_w: invalid write offset %i data=$%02X\n", offset, data ); - } -} - - - -/* ------------ init / reset ------------ */ - - - -MACHINE_RESET_MEMBER( thomson_state, mo6 ) -{ - LOG (( "mo6: machine reset called\n" )); - - /* subsystems */ - thom_irq_reset(); - m_pia_sys->set_port_a_z_mask( 0x75 ); - mo6_game_reset(); - to7_floppy_reset(); - to7_modem_reset(); - to7_midi_reset(); - mo5_init_timer(); - - /* gate-array */ - m_to7_lightpen = 0; - m_to8_reg_ram = 0; - m_to8_reg_cart = 0; - m_to8_reg_sys1 = 0; - m_to8_reg_sys2 = 0; - m_to8_lightpen_intr = 0; - - /* video */ - thom_set_video_mode( THOM_VMODE_MO5 ); - m_thom_lightpen_cb = &thomson_state::to8_lightpen_cb; - thom_set_lightpen_callback( 3 ); - thom_set_border_color( 0 ); - thom_set_mode_point( 0 ); - m_pia_sys->ca1_w( 0 ); - - /* memory */ - m_old_ram_bank = -1; - m_old_cart_bank = -1; - m_to8_cart_vpage = 0; - m_to8_data_vpage = 0; - mo6_update_ram_bank(); - mo6_update_cart_bank(); - /* mo5_reg_cart not reset */ - /* thom_cart_bank not reset */ -} - - - -MACHINE_START_MEMBER( thomson_state, mo6 ) -{ - UINT8* mem = memregion("maincpu")->base(); - UINT8* ram = m_ram->pointer(); - - LOG (( "mo6: machine start called\n" )); - - /* subsystems */ - thom_irq_init(); - mo6_game_init(); - to7_floppy_init( mem + 0x30000 ); - to9_palette_init(); - to7_modem_init(); - to7_midi_init(); - m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo5_periodic_cb),this)); - - /* memory */ - m_thom_cart_bank = 0; - m_mo5_reg_cart = 0; - m_thom_vram = ram; - m_cartlobank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - m_cartlobank->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); - m_cartlobank->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); - m_cartlobank->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); - m_carthibank->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 8, 8, ram, 0x4000 ); - m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); - m_syslobank->configure_entry( 0, ram + 0x6000); - m_syshibank->configure_entry( 0, ram + 0x4000); - m_datalobank->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); - m_datahibank->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); - m_biosbank->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); - m_cartlobank->set_entry( 0 ); - m_carthibank->set_entry( 0 ); - m_vrambank->set_entry( 0 ); - m_syslobank->set_entry( 0 ); - m_syshibank->set_entry( 0 ); - m_datalobank->set_entry( 0 ); - m_datahibank->set_entry( 0 ); - m_biosbank->set_entry( 0 ); - - /* save-state */ - save_item(NAME(m_thom_cart_nb_banks)); - save_item(NAME(m_thom_cart_bank)); - save_item(NAME(m_to7_lightpen)); - save_item(NAME(m_to7_lightpen_step)); - save_item(NAME(m_to8_reg_ram)); - save_item(NAME(m_to8_reg_cart)); - save_item(NAME(m_to8_reg_sys1)); - save_item(NAME(m_to8_reg_sys2)); - save_item(NAME(m_to8_lightpen_intr)); - save_item(NAME(m_to8_data_vpage)); - save_item(NAME(m_to8_cart_vpage)); - save_item(NAME(m_mo5_reg_cart)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_ram_bank_postload), this)); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_cart_bank_postload), this)); -} - - - -/***************************** MO5 NR *************************/ - - - -/* ------------ network ( & external floppy) ------------ */ - - - -READ8_MEMBER( thomson_state::mo5nr_net_r ) -{ - if ( space.debugger_access() ) - return 0; - - if ( to7_controller_type ) - return to7_floppy_r ( space, offset ); - - logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", m_maincpu->pc(), machine().time().as_double(), offset ); - - return 0; -} - - - -WRITE8_MEMBER( thomson_state::mo5nr_net_w ) -{ - if ( to7_controller_type ) - to7_floppy_w ( space, offset, data ); - else - logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n", - m_maincpu->pc(), machine().time().as_double(), data, offset ); -} - - -/* ------------ printer ------------ */ - -/* Unlike the TO8, TO9, TO9+, MO6, the printer has its own ports and does not - go through the 6821 PIA. -*/ - - -READ8_MEMBER( thomson_state::mo5nr_prn_r ) -{ - UINT8 result = 0; - - result |= m_centronics_busy << 7; - - return result; -} - - -WRITE8_MEMBER( thomson_state::mo5nr_prn_w ) -{ - /* TODO: understand other bits */ - m_centronics->write_strobe(BIT(data, 3)); -} - - - -/* ------------ system PIA 6821 ------------ */ - - - -READ8_MEMBER( thomson_state::mo5nr_sys_portb_in ) -{ - /* keyboard: only 8 lines of 8 keys (MO6 has 9 lines) */ - UINT8 portb = m_pia_sys->b_output(); - int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ - int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ - - return ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; - /* bit 7: key up */ -} - - - -WRITE8_MEMBER( thomson_state::mo5nr_sys_porta_out ) -{ - /* no keyboard LED */ - thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - m_to7_game_mute = data & 4; /* bit 2: sound mute */ - mo5_set_cassette( (data & 0x40) ? 1 : 0 ); /* bit 6: cassette output */ - mo6_update_cart_bank(); /* bit 5: rom bank */ - to7_game_sound_update(); -} - - - -/* ------------ game 6821 PIA ------------ */ - -/* similar to the MO6, without the printer */ - - - -void thomson_state::mo5nr_game_init() -{ - LOG (( "mo5nr_game_init called\n" )); - m_to7_game_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo6_game_update_cb),this)); - m_to7_game_timer->adjust( TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); - save_item(NAME(m_to7_game_sound)); - save_item(NAME(m_to7_game_mute)); -} - - - -void thomson_state::mo5nr_game_reset() -{ - LOG (( "mo5nr_game_reset called\n" )); - m_pia_game->ca1_w( 0 ); - m_to7_game_sound = 0; - m_to7_game_mute = 0; - to7_game_sound_update(); -} - - - -/* ------------ init / reset ------------ */ - - - -MACHINE_RESET_MEMBER( thomson_state, mo5nr ) -{ - LOG (( "mo5nr: machine reset called\n" )); - - /* subsystems */ - thom_irq_reset(); - m_pia_sys->set_port_a_z_mask( 0x65 ); - mo5nr_game_reset(); - to7_floppy_reset(); - to7_modem_reset(); - to7_midi_reset(); - mo5_init_timer(); - - /* gate-array */ - m_to7_lightpen = 0; - m_to8_reg_ram = 0; - m_to8_reg_cart = 0; - m_to8_reg_sys1 = 0; - m_to8_reg_sys2 = 0; - m_to8_lightpen_intr = 0; - - /* video */ - thom_set_video_mode( THOM_VMODE_MO5 ); - m_thom_lightpen_cb = &thomson_state::to8_lightpen_cb; - thom_set_lightpen_callback( 3 ); - thom_set_border_color( 0 ); - thom_set_mode_point( 0 ); - m_pia_sys->ca1_w( 0 ); - - /* memory */ - m_old_ram_bank = -1; - m_old_cart_bank = -1; - m_to8_cart_vpage = 0; - m_to8_data_vpage = 0; - mo6_update_ram_bank(); - mo6_update_cart_bank(); - /* mo5_reg_cart not reset */ - /* thom_cart_bank not reset */ -} - - - -MACHINE_START_MEMBER( thomson_state, mo5nr ) -{ - UINT8* mem = memregion("maincpu")->base(); - UINT8* ram = m_ram->pointer(); - - LOG (( "mo5nr: machine start called\n" )); - - /* subsystems */ - thom_irq_init(); - mo5nr_game_init(); - to7_floppy_init( mem + 0x30000 ); - to9_palette_init(); - to7_modem_init(); - to7_midi_init(); - m_mo5_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::mo5_periodic_cb),this)); - - /* memory */ - m_thom_cart_bank = 0; - m_mo5_reg_cart = 0; - m_thom_vram = ram; - - m_cartlobank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - m_cartlobank->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); - m_cartlobank->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); - m_cartlobank->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); - m_carthibank->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 8, 8, ram, 0x4000 ); - m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); - m_syslobank->configure_entry( 0, ram + 0x6000); - m_syshibank->configure_entry( 0, ram + 0x4000); - m_datalobank->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); - m_datahibank->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); - m_biosbank->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); - m_cartlobank->set_entry( 0 ); - m_carthibank->set_entry( 0 ); - m_vrambank->set_entry( 0 ); - m_syslobank->set_entry( 0 ); - m_syshibank->set_entry( 0 ); - m_datalobank->set_entry( 0 ); - m_datahibank->set_entry( 0 ); - m_biosbank->set_entry( 0 ); - - /* save-state */ - save_item(NAME(m_thom_cart_nb_banks)); - save_item(NAME(m_thom_cart_bank)); - save_item(NAME(m_to7_lightpen)); - save_item(NAME(m_to7_lightpen_step)); - save_item(NAME(m_to8_reg_ram)); - save_item(NAME(m_to8_reg_cart)); - save_item(NAME(m_to8_reg_sys1)); - save_item(NAME(m_to8_reg_sys2)); - save_item(NAME(m_to8_lightpen_intr)); - save_item(NAME(m_to8_data_vpage)); - save_item(NAME(m_to8_cart_vpage)); - save_item(NAME(m_mo5_reg_cart)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_ram_bank_postload), this)); - machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_cart_bank_postload), this)); -} diff --git a/src/mess/machine/ti85.c b/src/mess/machine/ti85.c deleted file mode 100644 index 069e8f7f6fa..00000000000 --- a/src/mess/machine/ti85.c +++ /dev/null @@ -1,1192 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha,Jon Sturm -/*************************************************************************** - TI-85 driver by Krzysztof Strzecha - TI-83 Plus, TI-84 Plus, and Siliver Edition support by Jon Sturm - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - -***************************************************************************/ - -#include -#include "emu.h" -#include "cpu/z80/z80.h" -#include "includes/ti85.h" - -#define TI85_SNAPSHOT_SIZE 32976 -#define TI86_SNAPSHOT_SIZE 131284 - -TIMER_CALLBACK_MEMBER(ti85_state::ti85_timer_callback) -{ - if (ioport("ON")->read() & 0x01) - { - if (m_ON_interrupt_mask && !m_ON_pressed) - { - m_maincpu->set_input_line(0, HOLD_LINE); - m_ON_interrupt_status = 1; - if (!m_timer_interrupt_mask) m_timer_interrupt_mask = 2; - } - m_ON_pressed = 1; - return; - } - else - m_ON_pressed = 0; - if (m_timer_interrupt_mask) - { - m_maincpu->set_input_line(0, HOLD_LINE); - m_timer_interrupt_status = m_timer_interrupt_mask; - } -} - -TIMER_CALLBACK_MEMBER(ti85_state::ti83_timer1_callback) -{ - if (ioport("ON")->read() & 0x01) - { - if (m_ON_interrupt_mask && !m_ON_pressed) - { - m_maincpu->set_input_line(0, HOLD_LINE); - m_ON_interrupt_status = 1; - } - m_ON_pressed = 1; - return; - } - else - { - m_ON_pressed = 0; - } - if (m_timer_interrupt_mask & 2) - { - m_maincpu->set_input_line(0, HOLD_LINE); - m_timer_interrupt_status = m_timer_interrupt_status | 2; - } -} - -TIMER_CALLBACK_MEMBER(ti85_state::ti83_timer2_callback) -{ - if (m_timer_interrupt_mask & 4) - { - m_maincpu->set_input_line(0, HOLD_LINE); - m_timer_interrupt_status = m_timer_interrupt_status | 4; - } -} - -void ti85_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case CRYSTAL_TIMER3: - case CRYSTAL_TIMER2: - case CRYSTAL_TIMER1: - if (m_ctimer[id].count) - { - m_ctimer[id].count--; - if (!m_ctimer[id].count) - { - if (!(m_ctimer[id].loop & 4)) - { - if (!(m_ctimer[id].loop & 1)) - { - m_ctimer[id].setup = 0; - } - else - { - ti83pse_count(id, m_ctimer[id].max); - } - if (!(m_ctimer[id].loop & 2)) - { - //generate interrupt - m_ctimer_interrupt_status |= (0x20 << id); - m_maincpu->set_input_line(0, HOLD_LINE); - } - m_ctimer[id].loop &= 2; - } - } - } - break; - case HW_TIMER1: - if (ioport("ON")->read() & 0x01) - { - if (m_ON_interrupt_mask && !m_ON_pressed) - { - m_maincpu->set_input_line(0, HOLD_LINE); - m_ON_interrupt_status = 1; - } - m_ON_pressed = 1; - return; - } - else - { - m_ON_pressed = 0; - } - if (m_timer_interrupt_mask & 2) - { - m_maincpu->set_input_line(0, HOLD_LINE); - m_timer_interrupt_status = m_timer_interrupt_status | 2; - } - break; - case HW_TIMER2: - if (m_timer_interrupt_mask & 4) - { - m_maincpu->set_input_line(0, HOLD_LINE); - m_timer_interrupt_status = m_timer_interrupt_status | 4; - } - } -} - -inline void ti8x_update_bank(address_space &space, UINT8 bank, UINT8 *base, UINT8 page, bool is_ram) -{ - ti85_state *state = space.machine().driver_data(); - static const char *const tag[] = {"bank1", "bank2", "bank3", "bank4"}; - - state->membank(tag[bank&3])->set_base(base + (0x4000 * page)); - - if (is_ram) - space.install_write_bank(bank * 0x4000, bank * 0x4000 + 0x3fff, tag[bank&3]); - else - space.nop_write(bank * 0x4000, bank * 0x4000 + 0x3fff); -} - -void ti85_state::update_ti85_memory () -{ - membank("bank2")->set_base(m_bios + 0x004000*m_ti8x_memory_page_1); -} - -void ti85_state::update_ti83p_memory () -{ - //address_space &space = m_maincpu->space(AS_PROGRAM); - - m_membank1->set_bank(m_booting ? 0x1f : 0); //Always flash page 0, well almost - - if (m_ti83p_port4 & 1) - { - m_membank2->set_bank(m_ti8x_memory_page_1 & 0xfe); - - m_membank3->set_bank(m_ti8x_memory_page_1); - - m_membank4->set_bank(m_ti8x_memory_page_2); - - } - else - { - m_membank2->set_bank(m_ti8x_memory_page_1); - - m_membank3->set_bank(m_ti8x_memory_page_2); - - m_membank4->set_bank(0x40); //Always first ram page - - } -} - -void ti85_state::update_ti83pse_memory () -{ - //address_space &space = m_maincpu->space(AS_PROGRAM); - - m_membank1->set_bank(m_booting ? (m_model==TI84P ? 0x3f : 0x7f) : 0); - - if (m_ti83p_port4 & 1) - { - m_membank2->set_bank(m_ti8x_memory_page_1 & 0xfe); - - m_membank3->set_bank(m_ti8x_memory_page_1 | 1); - - m_membank4->set_bank(m_ti8x_memory_page_2); - - - } - else - { - m_membank2->set_bank(m_ti8x_memory_page_1); - - m_membank3->set_bank(m_ti8x_memory_page_2); - - m_membank4->set_bank(m_ti8x_memory_page_3 + 0x80); - - } -} - -void ti85_state::update_ti86_memory () -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - if (m_ti8x_memory_page_1 & 0x40) - { - ti8x_update_bank(space, 1, m_ti8x_ram, m_ti8x_memory_page_1 & 0x07, true); - } - else - { - ti8x_update_bank(space, 1, m_bios, m_ti8x_memory_page_1 & 0x0f, false); - } - - if (m_ti8x_memory_page_2 & 0x40) - { - ti8x_update_bank(space, 2, m_ti8x_ram, m_ti8x_memory_page_2 & 0x07, true); - } - else - { - ti8x_update_bank(space, 2, m_bios, m_ti8x_memory_page_2 & 0x0f, false); - } - -} - -/*************************************************************************** - Machine Initialization -***************************************************************************/ - -void ti85_state::machine_start() -{ - m_model = TI85; - - address_space &space = m_maincpu->space(AS_PROGRAM); - m_bios = memregion("bios")->base(); - - m_timer_interrupt_mask = 0; - m_timer_interrupt_status = 0; - m_ON_interrupt_mask = 0; - m_ON_interrupt_status = 0; - m_ON_pressed = 0; - m_power_mode = 0; - m_keypad_mask = 0; - m_ti8x_memory_page_1 = 0; - m_LCD_memory_base = 0; - m_LCD_status = 0; - m_LCD_mask = 0; - m_video_buffer_width = 0; - m_interrupt_speed = 0; - m_port4_bit0 = 0; - m_ti81_port_7_data = 0; - - machine().scheduler().timer_pulse(attotime::from_hz(256), timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback),this)); - - space.unmap_write(0x0000, 0x3fff); - space.unmap_write(0x4000, 0x7fff); - membank("bank1")->set_base(m_bios); - membank("bank2")->set_base(m_bios + 0x04000); -} - -MACHINE_RESET_MEMBER(ti85_state,ti85) -{ - m_red_out = 0x00; - m_white_out = 0x00; - m_PCR = 0xc0; -} - -DIRECT_UPDATE_MEMBER(ti85_state::ti83p_direct_update_handler) -{ - if (m_booting) - { - if (((m_ti83p_port4 & 1) && (address >= 0x4000 && address < 0xc000)) || (address >= 0x4000 && address < 0x8000)) - { - m_booting = false; - update_ti83p_memory(); - } - } - return address; -} - - -MACHINE_RESET_MEMBER(ti85_state,ti83p) -{ - m_red_out = 0x00; - m_white_out = 0x00; - m_PCR = 0xc0; - - - m_ti8x_memory_page_1 = 0; - m_ti8x_memory_page_2 = 0; - m_ti8x_memory_page_3 = 0; - m_ti83p_port4 = 1; - m_booting = true; - if (m_model == TI83P) - { - update_ti83p_memory(); - } - else - { - update_ti83pse_memory(); - } -} - -MACHINE_START_MEMBER(ti85_state,ti83p) -{ - m_model = TI83P; - //address_space &space = m_maincpu->space(AS_PROGRAM); - //m_bios = memregion("flash")->base(); - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(ti85_state::ti83p_direct_update_handler), this)); - - m_timer_interrupt_mask = 0; - m_timer_interrupt_status = 0; - m_ON_interrupt_mask = 0; - m_ON_interrupt_status = 0; - m_ON_pressed = 0; - m_ti8x_memory_page_1 = 0; - m_ti8x_memory_page_2 = 0; - m_ti8x_memory_page_3 = 0; - m_LCD_memory_base = 0; - m_LCD_status = 0; - m_LCD_mask = 0; - m_power_mode = 0; - m_keypad_mask = 0; - m_video_buffer_width = 0; - m_interrupt_speed = 0; - m_ti83p_port4 = 1; - m_flash_unlocked = 0; - - m_booting = true; - - ti85_state::update_ti83p_memory(); - - - machine().scheduler().timer_pulse(attotime::from_hz(256), timer_expired_delegate(FUNC(ti85_state::ti83_timer1_callback),this)); - machine().scheduler().timer_pulse(attotime::from_hz(512), timer_expired_delegate(FUNC(ti85_state::ti83_timer2_callback),this)); - - - /* save states and debugging */ - save_item(NAME(m_timer_interrupt_status)); - save_item(NAME(m_timer_interrupt_mask)); - save_item(NAME(m_ti8x_memory_page_1)); - save_item(NAME(m_ti8x_memory_page_2)); - save_item(NAME(m_ti8x_memory_page_3)); - save_item(NAME(m_ti83p_port4)); - save_item(NAME(m_booting)); -} - -void ti85_state::ti8xpse_init_common() -{ - //address_space &space = m_maincpu->space(AS_PROGRAM); - //address_space &asic = ADDRESS_MAP_NAME(ti83p_asic_mem); - - m_timer_interrupt_mask = 0; - m_timer_interrupt_status = 0; - m_ctimer_interrupt_status = 0; - m_ON_interrupt_mask = 0; - m_ON_interrupt_status = 0; - m_ON_pressed = 0; - m_ti8x_memory_page_1 = 0; - m_ti8x_memory_page_2 = 0; - m_ti8x_memory_page_3 = 0; - m_LCD_memory_base = 0; - m_LCD_status = 0; - m_LCD_mask = 0; - m_power_mode = 0; - m_keypad_mask = 0; - m_video_buffer_width = 0; - m_interrupt_speed = 0; - m_ti83p_port4 = 1; - m_flash_unlocked = 0; - - ti85_state::update_ti83pse_memory(); - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(ti85_state::ti83p_direct_update_handler), this)); - - - machine().scheduler().timer_pulse(attotime::from_hz(256), timer_expired_delegate(FUNC(ti85_state::ti83_timer1_callback),this)); - machine().scheduler().timer_pulse(attotime::from_hz(512), timer_expired_delegate(FUNC(ti85_state::ti83_timer2_callback),this)); - - m_crystal_timer1 = timer_alloc(CRYSTAL_TIMER1); - m_crystal_timer2 = timer_alloc(CRYSTAL_TIMER2); - m_crystal_timer3 = timer_alloc(CRYSTAL_TIMER3); - - /* save states and debugging */ - save_item(NAME(m_ctimer_interrupt_status)); - save_item(NAME(m_timer_interrupt_status)); - save_item(NAME(m_ti8x_memory_page_1)); - save_item(NAME(m_ti8x_memory_page_2)); - save_item(NAME(m_ti8x_memory_page_3)); - save_item(NAME(m_ti83p_port4)); -} - - -MACHINE_START_MEMBER(ti85_state,ti83pse) -{ - m_model = TI84PSE; - - ti8xpse_init_common(); -} - -MACHINE_START_MEMBER(ti85_state,ti84pse) -{ - m_model = TI83PSE; - - ti8xpse_init_common(); -} - -MACHINE_START_MEMBER(ti85_state,ti84p) -{ - m_model = TI84P; - - ti8xpse_init_common(); -} - -MACHINE_START_MEMBER(ti85_state,ti86) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - m_bios = memregion("bios")->base(); - - m_timer_interrupt_mask = 0; - m_timer_interrupt_status = 0; - m_ON_interrupt_mask = 0; - m_ON_interrupt_status = 0; - m_ON_pressed = 0; - m_ti8x_memory_page_1 = 0; - m_ti8x_memory_page_2 = 0; - m_LCD_memory_base = 0; - m_LCD_status = 0; - m_LCD_mask = 0; - m_power_mode = 0; - m_keypad_mask = 0; - m_video_buffer_width = 0; - m_interrupt_speed = 0; - m_port4_bit0 = 0; - - m_ti8x_ram = auto_alloc_array(machine(), UINT8, 128*1024); - memset(m_ti8x_ram, 0, sizeof(UINT8)*128*1024); - - space.unmap_write(0x0000, 0x3fff); - - membank("bank1")->set_base(m_bios); - membank("bank2")->set_base(m_bios + 0x04000); - - membank("bank4")->set_base(m_ti8x_ram); - machine().device("nvram")->set_base(m_ti8x_ram, sizeof(UINT8)*128*1024); - - machine().scheduler().timer_pulse(attotime::from_hz(256), timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback),this)); -} - - -/* I/O ports handlers */ - -READ8_MEMBER(ti85_state::ti85_port_0000_r) -{ - return 0xff; -} - -READ8_MEMBER(ti85_state::ti8x_keypad_r) -{ - int data = 0xff; - int port; - int bit; - static const char *const bitnames[] = { "BIT0", "BIT1", "BIT2", "BIT3", "BIT4", "BIT5", "BIT6", "BIT7" }; - - if (m_keypad_mask == 0x7f) return data; - - for (bit = 0; bit < 7; bit++) - { - if (~m_keypad_mask&(0x01<read() & (0x01<>3)&0x03; - m_interrupt_speed = (data>>1)&0x03; - m_port4_bit0 = data&0x01; -} - -WRITE8_MEMBER(ti85_state::ti85_port_0005_w) -{ - m_ti8x_memory_page_1 = data; - update_ti85_memory(); -} - -WRITE8_MEMBER(ti85_state::ti85_port_0006_w) -{ - m_power_mode = data; -} - -WRITE8_MEMBER(ti85_state::ti8x_serial_w) -{ - m_speaker->level_w(BIT(data, 2) | BIT(data, 3)); - m_red_out = BIT(data, 2); - m_white_out = BIT(data, 3); - //ti85serial_red_out( m_serial, 0, m_red_out ); - //ti85serial_white_out( m_serial, 0, m_white_out ); - //ti85_update_serial(m_serial); - m_PCR = data & 0xf0; -} - -WRITE8_MEMBER(ti85_state::ti86_port_0005_w) -{ - m_ti8x_memory_page_1 = data&((data&0x40)?0x47:0x4f); - update_ti86_memory(); -} - -WRITE8_MEMBER(ti85_state::ti86_port_0006_w) -{ - m_ti8x_memory_page_2 = data&((data&0x40)?0x47:0x4f); - update_ti86_memory(); -} - -WRITE8_MEMBER(ti85_state::ti82_port_0002_w) -{ - m_ti8x_memory_page_1 = (data & 0x07); - update_ti85_memory(); - m_ti8x_port2 = data; -} - -WRITE8_MEMBER(ti85_state::ti83_port_0000_w) -{ - m_ti8x_memory_page_1 = (m_ti8x_memory_page_1 & 7) | ((data & 16) >> 1); - update_ti85_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83_port_0002_w) -{ - m_ti8x_memory_page_1 = (m_ti8x_memory_page_1 & 8) | (data & 7); - update_ti85_memory(); - m_ti8x_port2 = data; -} - -WRITE8_MEMBER(ti85_state::ti83_port_0003_w) -{ - if (m_LCD_status && !(data&0x08)) m_timer_interrupt_mask = 0; - m_ON_interrupt_mask = data&0x01; - //m_timer_interrupt_mask = data&0x04; - m_LCD_mask = data&0x02; - m_LCD_status = data&0x08; -} - -WRITE8_MEMBER(ti85_state::ti8x_plus_serial_w) -{ - m_speaker->level_w(BIT(data, 0) | BIT(data, 1)); - m_red_out = BIT(data, 0); - m_white_out = BIT(data, 1); - //ti85serial_red_out( m_serial, 0, m_red_out ); - //ti85serial_white_out( m_serial, 0, m_white_out ); - //ti85_update_serial(m_serial); - m_PCR = data & 0xf0; -} - -WRITE8_MEMBER(ti85_state::ti83pse_int_ack_w) -{ - //Lets ignore this for now, I think it'll be fine. - m_ON_interrupt_status = data & 1; - m_timer_interrupt_status = data & 0x06; -} - -WRITE8_MEMBER(ti85_state::ti83p_int_mask_w) -{ - //m_LCD_mask = (data&0x08) >> 2; - m_ON_interrupt_mask = data & 0x01; - m_ON_interrupt_status &= m_ON_interrupt_mask; - - m_timer_interrupt_mask = data & 0x06; - - m_timer_interrupt_status &= m_timer_interrupt_mask; -} - -WRITE8_MEMBER(ti85_state::ti83p_port_0004_w) -{ - m_ti83p_port4 = data | 0xe0; - update_ti83p_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83p_port_0006_w) -{ - m_ti8x_memory_page_1 = data & ((data&0x40) ? 0x41 : 0x5f); - update_ti83p_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83p_port_0007_w) -{ - m_ti8x_memory_page_2 = data & ((data&0x40) ? 0x41 : 0x5f); - update_ti83p_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83pse_port_0004_w) -{ - m_ti83p_port4 = data; - update_ti83pse_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83pse_port_0005_w) -{ - m_ti8x_memory_page_3 = data & 0x07; - update_ti83pse_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83pse_port_0006_w) -{ - if ((m_model == TI84P) && (data < 0x80)) - { - m_ti8x_memory_page_1 = data & 0x3f; - } - else - { - m_ti8x_memory_page_1 = data; - } - update_ti83pse_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83pse_port_0007_w) -{ - if ((m_model == TI84P) && (data < 0x80)) - { - m_ti8x_memory_page_2 = data & 0x3f; - } - else - { - m_ti8x_memory_page_2 = data; - } - update_ti83pse_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83p_port_0014_w) -{ - m_flash_unlocked = data; - update_ti83pse_memory(); -} - -WRITE8_MEMBER(ti85_state::ti83pse_port_0020_w) -{ - m_cpu_speed = data; - if(data) - { - m_maincpu->set_unscaled_clock(15000000); - } - else - { - m_maincpu->set_unscaled_clock(6000000); - } -} - -READ8_MEMBER(ti85_state::ti83pse_port_0020_r) -{ - return m_cpu_speed; -} - -WRITE8_MEMBER(ti85_state::ti83pse_port_0021_w) -{ - m_ti83pse_port21 = data & 0x0f; -} - -READ8_MEMBER(ti85_state::ti83pse_port_0021_r) -{ - return m_ti83pse_port21; -} - -READ8_MEMBER(ti85_state::ti84pse_port_0055_r) -{ - return 0x1f; -} - -READ8_MEMBER(ti85_state::ti84pse_port_0056_r) -{ - return 0; -} - -//timer ports - -void ti85_state::ti83pse_count( UINT8 timer, UINT8 data) -{ - m_ctimer[timer].max = m_ctimer[timer].count = data; - - if (m_ctimer[timer].setup) - { - switch (m_ctimer[timer].setup & 0x07) - { - case 0x00: - m_ctimer[timer].divsor = 3.0; - break; - case 0x01: - m_ctimer[timer].divsor = 32.0; - break; - case 0x02: - m_ctimer[timer].divsor = 327.000; - break; - case 0x03: - m_ctimer[timer].divsor = 3276.00; - break; - case 0x04: - m_ctimer[timer].divsor = 1.0; - break; - case 0x05: - m_ctimer[timer].divsor = 16.0; - break; - case 0x06: - m_ctimer[timer].divsor = 256.0; - break; - case 0x07: - m_ctimer[timer].divsor = 4096.0; - break; - } - switch (timer) - { - case CRYSTAL_TIMER1: - m_crystal_timer1->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor)); - m_crystal_timer1->enable(true); - break; - case CRYSTAL_TIMER2: - m_crystal_timer2->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor)); - m_crystal_timer2->enable(true); - break; - case CRYSTAL_TIMER3: - m_crystal_timer3->adjust(attotime::zero, 0, attotime::from_hz( 32768.0f/m_ctimer[timer].divsor)); - m_crystal_timer3->enable(true); - break; - - } - } -} - - -READ8_MEMBER(ti85_state::ti83pse_ctimer1_setup_r) -{ - return m_ctimer[CRYSTAL_TIMER1].setup; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer1_setup_w) -{ - m_crystal_timer1->enable(false); - m_ctimer[CRYSTAL_TIMER1].setup = data; -} - -READ8_MEMBER(ti85_state::ti83pse_ctimer1_loop_r) -{ - return m_ctimer[CRYSTAL_TIMER1].loop; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer1_loop_w) -{ - m_ctimer[CRYSTAL_TIMER1].loop = data & 0x03; - m_ctimer_interrupt_status = 0; -} - -READ8_MEMBER(ti85_state::ti83pse_ctimer1_count_r) -{ - return m_ctimer[CRYSTAL_TIMER1].count; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer1_count_w) -{ - ti83pse_count(CRYSTAL_TIMER1, data); - -} - -// - -READ8_MEMBER(ti85_state::ti83pse_ctimer2_setup_r) -{ - return m_ctimer[CRYSTAL_TIMER2].setup; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer2_setup_w) -{ - m_crystal_timer2->enable(false); - m_ctimer[CRYSTAL_TIMER2].setup = data; -} - -READ8_MEMBER(ti85_state::ti83pse_ctimer2_loop_r) -{ - return m_ctimer[CRYSTAL_TIMER2].loop; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer2_loop_w) -{ - m_ctimer[CRYSTAL_TIMER2].loop = data & 0x03; - m_ctimer_interrupt_status = 0; -} - -READ8_MEMBER(ti85_state::ti83pse_ctimer2_count_r) -{ - return m_ctimer[CRYSTAL_TIMER2].count; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer2_count_w) -{ - ti83pse_count(CRYSTAL_TIMER2, data); - -} - -// - -READ8_MEMBER(ti85_state::ti83pse_ctimer3_setup_r) -{ - return m_ctimer[CRYSTAL_TIMER3].setup; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer3_setup_w) -{ - m_crystal_timer3->enable(false); - m_ctimer[CRYSTAL_TIMER3].setup = data; -} - -READ8_MEMBER(ti85_state::ti83pse_ctimer3_loop_r) -{ - return m_ctimer[CRYSTAL_TIMER3].loop; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer3_loop_w) -{ - m_ctimer[CRYSTAL_TIMER3].loop = data & 0x03; - m_ctimer_interrupt_status = 0; -} - -READ8_MEMBER(ti85_state::ti83pse_ctimer3_count_r) -{ - return m_ctimer[CRYSTAL_TIMER3].count; -} - -WRITE8_MEMBER(ti85_state::ti83pse_ctimer3_count_w) -{ - ti83pse_count(CRYSTAL_TIMER3, data); - -} - - - -/*************************************************************************** - TI calculators snapshot files (SAV) -***************************************************************************/ - -void ti85_state::ti8x_snapshot_setup_registers (UINT8 * data) -{ - unsigned char lo,hi; - unsigned char * reg = data + 0x40; - - /* Set registers */ - lo = reg[0x00] & 0x0ff; - hi = reg[0x01] & 0x0ff; - m_maincpu->set_state_int(Z80_AF, (hi << 8) | lo); - lo = reg[0x04] & 0x0ff; - hi = reg[0x05] & 0x0ff; - m_maincpu->set_state_int(Z80_BC, (hi << 8) | lo); - lo = reg[0x08] & 0x0ff; - hi = reg[0x09] & 0x0ff; - m_maincpu->set_state_int(Z80_DE, (hi << 8) | lo); - lo = reg[0x0c] & 0x0ff; - hi = reg[0x0d] & 0x0ff; - m_maincpu->set_state_int(Z80_HL, (hi << 8) | lo); - lo = reg[0x10] & 0x0ff; - hi = reg[0x11] & 0x0ff; - m_maincpu->set_state_int(Z80_IX, (hi << 8) | lo); - lo = reg[0x14] & 0x0ff; - hi = reg[0x15] & 0x0ff; - m_maincpu->set_state_int(Z80_IY, (hi << 8) | lo); - lo = reg[0x18] & 0x0ff; - hi = reg[0x19] & 0x0ff; - m_maincpu->set_state_int(Z80_PC, (hi << 8) | lo); - lo = reg[0x1c] & 0x0ff; - hi = reg[0x1d] & 0x0ff; - m_maincpu->set_state_int(Z80_SP, (hi << 8) | lo); - lo = reg[0x20] & 0x0ff; - hi = reg[0x21] & 0x0ff; - m_maincpu->set_state_int(Z80_AF2, (hi << 8) | lo); - lo = reg[0x24] & 0x0ff; - hi = reg[0x25] & 0x0ff; - m_maincpu->set_state_int(Z80_BC2, (hi << 8) | lo); - lo = reg[0x28] & 0x0ff; - hi = reg[0x29] & 0x0ff; - m_maincpu->set_state_int(Z80_DE2, (hi << 8) | lo); - lo = reg[0x2c] & 0x0ff; - hi = reg[0x2d] & 0x0ff; - m_maincpu->set_state_int(Z80_HL2, (hi << 8) | lo); - m_maincpu->set_state_int(Z80_IFF1, reg[0x30]&0x0ff); - m_maincpu->set_state_int(Z80_IFF2, reg[0x34]&0x0ff); - m_maincpu->set_state_int(Z80_HALT, reg[0x38]&0x0ff); - m_maincpu->set_state_int(Z80_IM, reg[0x3c]&0x0ff); - m_maincpu->set_state_int(Z80_I, reg[0x40]&0x0ff); - - m_maincpu->set_state_int(Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); - - m_maincpu->set_input_line(0, 0); - m_maincpu->set_input_line(INPUT_LINE_NMI, 0); - m_maincpu->set_input_line(INPUT_LINE_HALT, 0); -} - -void ti85_state::ti85_setup_snapshot (UINT8 * data) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int i; - unsigned char lo,hi; - unsigned char * hdw = data + 0x8000 + 0x94; - - ti8x_snapshot_setup_registers (data); - - /* Memory dump */ - for (i = 0; i < 0x8000; i++) - space.write_byte(i + 0x8000, data[i+0x94]); - - m_keypad_mask = hdw[0x00]&0x7f; - - m_ti8x_memory_page_1 = hdw[0x08]&0xff; - update_ti85_memory(); - - m_power_mode = hdw[0x14]&0xff; - - lo = hdw[0x28] & 0x0ff; - hi = hdw[0x29] & 0x0ff; - m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8; - - m_LCD_status = hdw[0x2c]&0xff ? 0 : 0x08; - if (m_LCD_status) m_LCD_mask = 0x02; - - m_LCD_contrast = hdw[0x30]&0xff; - - m_timer_interrupt_mask = !hdw[0x38]; - m_timer_interrupt_status = 0; - - m_ON_interrupt_mask = !m_LCD_status && m_timer_interrupt_status; - m_ON_interrupt_status = 0; - m_ON_pressed = 0; - - m_video_buffer_width = 0x02; - m_interrupt_speed = 0x03; -} - -void ti85_state::ti86_setup_snapshot (UINT8 * data) -{ - unsigned char lo,hi; - unsigned char * hdw = data + 0x20000 + 0x94; - - ti8x_snapshot_setup_registers ( data); - - /* Memory dump */ - memcpy(m_ti8x_ram, data+0x94, 0x20000); - - m_keypad_mask = hdw[0x00]&0x7f; - - m_ti8x_memory_page_1 = hdw[0x04]&0xff ? 0x40 : 0x00; - m_ti8x_memory_page_1 |= hdw[0x08]&0x0f; - - m_ti8x_memory_page_2 = hdw[0x0c]&0xff ? 0x40 : 0x00; - m_ti8x_memory_page_2 |= hdw[0x10]&0x0f; - - update_ti86_memory(); - - lo = hdw[0x2c] & 0x0ff; - hi = hdw[0x2d] & 0x0ff; - m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8; - - m_LCD_status = hdw[0x30]&0xff ? 0 : 0x08; - if (m_LCD_status) m_LCD_mask = 0x02; - - m_LCD_contrast = hdw[0x34]&0xff; - - m_timer_interrupt_mask = !hdw[0x3c]; - m_timer_interrupt_status = 0; - - m_ON_interrupt_mask = !m_LCD_status && m_timer_interrupt_status; - m_ON_interrupt_status = 0; - m_ON_pressed = 0; - - m_video_buffer_width = 0x02; - m_interrupt_speed = 0x03; -} - -SNAPSHOT_LOAD_MEMBER( ti85_state, ti8x ) -{ - int expected_snapshot_size = 0; - dynamic_buffer ti8x_snapshot_data; - - if (!strncmp(machine().system().name, "ti85", 4)) - expected_snapshot_size = TI85_SNAPSHOT_SIZE; - else if (!strncmp(machine().system().name, "ti86", 4)) - expected_snapshot_size = TI86_SNAPSHOT_SIZE; - - logerror("Snapshot loading\n"); - - if (snapshot_size != expected_snapshot_size) - { - logerror ("Incomplete snapshot file\n"); - return IMAGE_INIT_FAIL; - } - - ti8x_snapshot_data.resize(snapshot_size); - - image.fread( &ti8x_snapshot_data[0], snapshot_size); - - if (!strncmp(machine().system().name, "ti85", 4)) - ti85_setup_snapshot(&ti8x_snapshot_data[0]); - else if (!strncmp(machine().system().name, "ti86", 4)) - ti86_setup_snapshot(&ti8x_snapshot_data[0]); - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/trs80.c b/src/mess/machine/trs80.c deleted file mode 100644 index 980176e109e..00000000000 --- a/src/mess/machine/trs80.c +++ /dev/null @@ -1,933 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert and unknown others -/*************************************************************************** - - machine.c - - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) - -MAX_LUMPS 192 crude storage units - don't know much about it -MAX_GRANULES 8 lumps consisted of granules.. aha -MAX_SECTORS 5 and granules of sectors - -***************************************************************************/ - -#include "includes/trs80.h" - - -#define IRQ_M1_RTC 0x80 /* RTC on Model I */ -#define IRQ_M1_FDC 0x40 /* FDC on Model I */ -#define IRQ_M4_RTC 0x04 /* RTC on Model 4 */ -#define CASS_RISE 0x01 /* high speed cass on Model III/4) */ -#define CASS_FALL 0x02 /* high speed cass on Model III/4) */ -#define MODEL4_MASTER_CLOCK 20275200 - - -TIMER_CALLBACK_MEMBER(trs80_state::cassette_data_callback) -{ -/* This does all baud rates. 250 baud (trs80), and 500 baud (all others) set bit 7 of "cassette_data". - 1500 baud (trs80m3, trs80m4) is interrupt-driven and uses bit 0 of "cassette_data" */ - - double new_val = (m_cassette->input()); - - /* Check for HI-LO transition */ - if ( m_old_cassette_val > -0.2 && new_val < -0.2 ) - { - m_cassette_data |= 0x80; /* 500 baud */ - if (m_mask & CASS_FALL) /* see if 1500 baud */ - { - m_cassette_data = 0; - m_irq |= CASS_FALL; - m_maincpu->set_input_line(0, HOLD_LINE); - } - } - else - if ( m_old_cassette_val < -0.2 && new_val > -0.2 ) - { - if (m_mask & CASS_RISE) /* 1500 baud */ - { - m_cassette_data = 1; - m_irq |= CASS_RISE; - m_maincpu->set_input_line(0, HOLD_LINE); - } - } - - m_old_cassette_val = new_val; -} - - -/************************************* - * - * Port handlers. - * - *************************************/ - - -READ8_MEMBER( trs80_state::trs80m4_e0_r ) -{ -/* Indicates which devices are interrupting - d6..d3 not emulated. - Whenever an interrupt occurs, this port is immediately read - to find out which device requires service. Lowest-numbered - bit takes precedence. We take this opportunity to clear the - cpu INT line. - - d6 RS232 Error (Any of {FE, PE, OR} errors has occurred) - d5 RS232 Rcv (DAV indicates a char ready to be picked up from uart) - d4 RS232 Xmit (TBMT indicates ready to accept another char from cpu) - d3 I/O Bus - d2 RTC - d1 Cass 1500 baud Falling - d0 Cass 1500 baud Rising */ - - m_maincpu->set_input_line(0, CLEAR_LINE); - return ~(m_mask & m_irq); -} - -READ8_MEMBER( trs80_state::trs80m4_e4_r ) -{ -/* Indicates which devices are interrupting - d6..d5 not emulated. - Whenever an NMI occurs, this port is immediately read - to find out which device requires service. Lowest-numbered - bit takes precedence. We take this opportunity to clear the - cpu NMI line. - - d7 status of FDC INTREQ (0=true) - d6 status of Motor Timeout (0=true) - d5 status of Reset signal (0=true - this will reboot the computer) */ - - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - - return ~(m_nmi_mask & m_nmi_data); -} - -READ8_MEMBER( trs80_state::trs80m4_e8_r ) -{ -/* not emulated - d7 Clear-to-Send (CTS), Pin 5 - d6 Data-Set-Ready (DSR), pin 6 - d5 Carrier Detect (CD), pin 8 - d4 Ring Indicator (RI), pin 22 - d3,d2,d0 Not used - d1 UART Receiver Input, pin 20 (pin 20 is also DTR) */ - - return 0; -} - -READ8_MEMBER( trs80_state::trs80m4_ea_r ) -{ -/* UART Status Register - d7 Data Received ('1'=condition true) - d6 Transmitter Holding Register empty ('1'=condition true) - d5 Overrun Error ('1'=condition true) - d4 Framing Error ('1'=condition true) - d3 Parity Error ('1'=condition true) - d2..d0 Not used */ - - UINT8 data=7; - m_ay31015->set_input_pin(AY31015_SWE, 0); - data |= m_ay31015->get_output_pin(AY31015_TBMT) ? 0x40 : 0; - data |= m_ay31015->get_output_pin(AY31015_DAV ) ? 0x80 : 0; - data |= m_ay31015->get_output_pin(AY31015_OR ) ? 0x20 : 0; - data |= m_ay31015->get_output_pin(AY31015_FE ) ? 0x10 : 0; - data |= m_ay31015->get_output_pin(AY31015_PE ) ? 0x08 : 0; - m_ay31015->set_input_pin(AY31015_SWE, 1); - - return data; -} - -READ8_MEMBER( trs80_state::trs80m4_eb_r ) -{ -/* UART received data */ - UINT8 data = m_ay31015->get_received_data(); - m_ay31015->set_input_pin(AY31015_RDAV, 0); - m_ay31015->set_input_pin(AY31015_RDAV, 1); - return data; -} - -READ8_MEMBER( trs80_state::trs80m4_ec_r ) -{ -/* Reset the RTC interrupt */ - m_irq &= ~IRQ_M4_RTC; - return 0; -} - -READ8_MEMBER( trs80_state::sys80_f9_r ) -{ -/* UART Status Register - d6..d4 not emulated - d7 Transmit buffer empty (inverted) - d6 CTS pin - d5 DSR pin - d4 CD pin - d3 Parity Error - d2 Framing Error - d1 Overrun - d0 Data Available */ - - UINT8 data = 70; - m_ay31015->set_input_pin(AY31015_SWE, 0); - data |= m_ay31015->get_output_pin(AY31015_TBMT) ? 0 : 0x80; - data |= m_ay31015->get_output_pin(AY31015_DAV ) ? 0x01 : 0; - data |= m_ay31015->get_output_pin(AY31015_OR ) ? 0x02 : 0; - data |= m_ay31015->get_output_pin(AY31015_FE ) ? 0x04 : 0; - data |= m_ay31015->get_output_pin(AY31015_PE ) ? 0x08 : 0; - m_ay31015->set_input_pin(AY31015_SWE, 1); - - return data; -} - -READ8_MEMBER( trs80_state::lnw80_fe_r ) -{ - return ((m_mode & 0x78) >> 3) | 0xf0; -} - -READ8_MEMBER( trs80_state::trs80_ff_r ) -{ -/* ModeSel and cassette data - d7 cassette data from tape - d2 modesel setting */ - - UINT8 data = (~m_mode & 1) << 5; - return data | m_cassette_data; -} - -READ8_MEMBER( trs80_state::trs80m4_ff_r ) -{ -/* Return of cassette data stream from tape - d7 Low-speed data - d6..d1 info from write of port EC - d0 High-speed data */ - - m_irq &= 0xfc; /* clear cassette interrupts */ - - return m_port_ec | m_cassette_data; -} - - -WRITE8_MEMBER( trs80_state::trs80m4_84_w ) -{ -/* Hi-res graphics control - d6..d4 not emulated - d7 Page Control - d6 Fix upper memory - d5 Memory bit 1 - d4 Memory bit 0 - d3 Invert Video - d2 80/64 width - d1 Select bit 1 - d0 Select bit 0 */ - - /* get address space instead of io space */ - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT8 *base = m_region_maincpu->base(); - - m_mode = (m_mode & 0x73) | (data & 0x8c); - - m_model4 &= 0xce; - m_model4 |= (data & 3) << 4; - - switch (data & 3) - { - case 0: /* normal operation */ - - if (m_model4 & 4) /* Model 4P gets RAM while Model 4 gets ROM */ - { - if (m_model4 & 8) - m_bank1->set_base(base); - else - m_bank1->set_base(base + 0x10000); - - m_bank2->set_base(base + 0x11000); - m_bank4->set_base(base + 0x137ea); - } - else - { - m_bank1->set_base(base); - m_bank2->set_base(base + 0x01000); - m_bank4->set_base(base + 0x037ea); - } - - m_bank7->set_base(base + 0x14000); - m_bank8->set_base(base + 0x1f400); - m_bank9->set_base(base + 0x1f800); - m_bank11->set_base(base + 0x05000); - m_bank12->set_base(base + 0x06000); - m_bank14->set_base(base + 0x09000); - m_bank15->set_base(base + 0x0a000); - m_bank17->set_base(base + 0x14000); - m_bank18->set_base(base + 0x1f400); - m_bank19->set_base(base + 0x1f800); - mem.install_readwrite_handler (0x37e8, 0x37e9, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this)); /* 3 & 13 */ - mem.install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); /* 5 */ - mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); /* 6 & 16 */ - break; - - case 1: /* write-only ram backs up the rom */ - - if (m_model4 & 4) /* Model 4P gets RAM while Model 4 gets ROM */ - { - if (m_model4 & 8) - m_bank1->set_base(base); - else - m_bank1->set_base(base + 0x10000); - - m_bank2->set_base(base + 0x11000); - m_bank3->set_base(base + 0x137e8); - m_bank4->set_base(base + 0x137ea); - } - else - { - m_bank1->set_base(base); - m_bank2->set_base(base + 0x01000); - m_bank3->set_base(base + 0x037e8); - m_bank4->set_base(base + 0x037ea); - } - - m_bank7->set_base(base + 0x14000); - m_bank8->set_base(base + 0x1f400); - m_bank9->set_base(base + 0x1f800); - m_bank11->set_base(base + 0x10000); - m_bank12->set_base(base + 0x11000); - m_bank13->set_base(base + 0x137e8); - m_bank14->set_base(base + 0x137ea); - m_bank15->set_base(base + 0x0a000); - m_bank17->set_base(base + 0x14000); - m_bank18->set_base(base + 0x1f400); - m_bank19->set_base(base + 0x1f800); - mem.install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); /* 5 */ - mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); /* 6 & 16 */ - break; - - case 2: /* keyboard and video are moved to high memory, and the rest is ram */ - m_bank1->set_base(base + 0x10000); - m_bank2->set_base(base + 0x11000); - m_bank3->set_base(base + 0x137e8); - m_bank4->set_base(base + 0x137ea); - m_bank5->set_base(base + 0x13800); - m_bank6->set_base(base + 0x13c00); - m_bank7->set_base(base + 0x14000); - m_bank11->set_base(base + 0x10000); - m_bank12->set_base(base + 0x11000); - m_bank13->set_base(base + 0x137e8); - m_bank14->set_base(base + 0x137ea); - m_bank15->set_base(base + 0x13800); - m_bank16->set_base(base + 0x13c00); - m_bank17->set_base(base + 0x14000); - m_bank18->set_base(base + 0x0a000); - mem.install_read_handler (0xf400, 0xf7ff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); /* 8 */ - mem.install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); /* 9 & 19 */ - m_model4++; - break; - - case 3: /* 64k of ram */ - m_bank1->set_base(base + 0x10000); - m_bank2->set_base(base + 0x11000); - m_bank3->set_base(base + 0x137e8); - m_bank4->set_base(base + 0x137ea); - m_bank5->set_base(base + 0x13800); - m_bank6->set_base(base + 0x13c00); - m_bank7->set_base(base + 0x14000); - m_bank8->set_base(base + 0x1f400); - m_bank9->set_base(base + 0x1f800); - m_bank11->set_base(base + 0x10000); - m_bank12->set_base(base + 0x11000); - m_bank13->set_base(base + 0x137e8); - m_bank14->set_base(base + 0x137ea); - m_bank15->set_base(base + 0x13800); - m_bank16->set_base(base + 0x13c00); - m_bank17->set_base(base + 0x14000); - m_bank18->set_base(base + 0x1f400); - m_bank19->set_base(base + 0x1f800); - break; - } -} - -WRITE8_MEMBER( trs80_state::trs80m4_90_w ) -{ - m_speaker->level_w(~data & 1); -} - -WRITE8_MEMBER( trs80_state::trs80m4p_9c_w ) /* model 4P only - swaps the ROM with read-only RAM */ -{ - /* Meaning of model4 variable: - d5..d4 memory mode (as described in section above) - d3 rom switch (1=enabled) only effective in mode0 and 1 - d2 this is a Model 4P - d1 this is a Model 4 - d0 Video banking exists yes/no (1=not banked) */ - - m_model4 &= 0xf7; - m_model4 |= (data << 3); - - if ((m_model4) && (~m_model4 & 0x20)) - { - switch (m_model4 & 8) - { - case 0: /* Read-only RAM replaces rom */ - m_bank1->set_base(m_region_maincpu->base() + 0x10000); - break; - case 8: /* Normal setup - rom enabled */ - m_bank1->set_base(m_region_maincpu->base()); - break; - } - } -} - -WRITE8_MEMBER( trs80_state::trs80m4_e0_w ) -{ -/* Interrupt settings - which devices are allowed to interrupt - bits align with read of E0 - d6 Enable Rec Err - d5 Enable Rec Data - d4 Enable Xmit Emp - d3 Enable I/O int - d2 Enable RT int - d1 C fall Int - d0 C Rise Int */ - - m_mask = data; -} - -WRITE8_MEMBER( trs80_state::trs80m4_e4_w ) -{ -/* Disk to NMI interface - d7 1=enable disk INTRQ to generate NMI - d6 1=enable disk Motor Timeout to generate NMI */ - - m_nmi_mask = data; -} - -WRITE8_MEMBER( trs80_state::trs80m4_e8_w ) -{ -/* d1 when '1' enables control register load (see below) */ - - m_reg_load = data & 2; -} - -WRITE8_MEMBER( trs80_state::trs80m4_e9_w ) -{ -/* UART set baud rate. Rx = bits 0..3, Tx = bits 4..7 - 00h 50 - 11h 75 - 22h 110 - 33h 134.5 - 44h 150 - 55h 300 - 66h 600 - 77h 1200 - 88h 1800 - 99h 2000 - AAh 2400 - BBh 3600 - CCh 4800 - DDh 7200 - EEh 9600 - FFh 19200 */ - - static const int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 }; - m_ay31015->set_receiver_clock(baud_clock[data & 0x0f]); - m_ay31015->set_transmitter_clock(baud_clock[data >> 4]); -} - -WRITE8_MEMBER( trs80_state::trs80m4_ea_w ) -{ - if (m_reg_load) - -/* d2..d0 not emulated - d7 Even Parity Enable ('1'=even, '0'=odd) - d6='1',d5='1' for 8 bits - d6='0',d5='1' for 7 bits - d6='1',d5='0' for 6 bits - d6='0',d5='0' for 5 bits - d4 Stop Bit Select ('1'=two stop bits, '0'=one stop bit) - d3 Parity Inhibit ('1'=disable; No parity, '0'=parity enabled) - d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) - d1 Request-to-Send (RTS), pin 4 - d0 Data-Terminal-Ready (DTR), pin 20 */ - - { - m_ay31015->set_input_pin(AY31015_CS, 0); - m_ay31015->set_input_pin(AY31015_NB1, BIT(data, 6)); - m_ay31015->set_input_pin(AY31015_NB2, BIT(data, 5)); - m_ay31015->set_input_pin(AY31015_TSB, BIT(data, 4)); - m_ay31015->set_input_pin(AY31015_EPS, BIT(data, 7)); - m_ay31015->set_input_pin(AY31015_NP, BIT(data, 3)); - m_ay31015->set_input_pin(AY31015_CS, 1); - } - else - { -/* not emulated - d7,d6 Not used - d5 Secondary Unassigned, pin 18 - d4 Secondary Transmit Data, pin 14 - d3 Secondary Request-to-Send, pin 19 - d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) - d1 Data-Terminal-Ready (DTR), pin 20 - d0 Request-to-Send (RTS), pin 4 */ - - } -} - -WRITE8_MEMBER( trs80_state::trs80m4_eb_w ) -{ - m_ay31015->set_transmit_data(data); -} - -WRITE8_MEMBER( trs80_state::trs80m4_ec_w ) -{ -/* Hardware settings - d5..d4 not emulated - d6 CPU fast (1=4MHz, 0=2MHz) - d5 1=Enable Video Wait - d4 1=Enable External I/O bus - d3 1=Enable Alternate Character Set - d2 Mode Select (0=64 chars, 1=32chars) - d1 Cassette Motor (1=On) */ - - m_maincpu->set_unscaled_clock(data & 0x40 ? MODEL4_MASTER_CLOCK/5 : MODEL4_MASTER_CLOCK/10); - - m_mode = (m_mode & 0xde) | ((data & 4) ? 1 : 0) | ((data & 8) ? 0x20 : 0); - - m_cassette->change_state(( data & 2 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR ); - - m_port_ec = data & 0x7e; -} - -/* Selection of drive and parameters - d6..d5 not emulated. - A write also causes the selected drive motor to turn on for about 3 seconds. - When the motor turns off, the drive is deselected. - d7 1=MFM, 0=FM - d6 1=Wait - d5 1=Write Precompensation enabled - d4 0=Side 0, 1=Side 1 - d3 1=select drive 3 - d2 1=select drive 2 - d1 1=select drive 1 - d0 1=select drive 0 */ -WRITE8_MEMBER( trs80_state::trs80m4_f4_w ) -{ - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - if (BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(BIT(data, 4)); - } - - m_fdc->dden_w(!BIT(data, 7)); -} - -WRITE8_MEMBER( trs80_state::sys80_f8_w ) -{ -/* not emulated - d2 reset UART (XR pin) - d1 DTR - d0 RTS */ -} - -WRITE8_MEMBER( trs80_state::sys80_fe_w ) -{ -/* not emulated - d4 select internal or external cassette player */ - - m_tape_unit = (data & 0x10) ? 2 : 1; -} - -/* lnw80 can switch out all the devices, roms and video ram to be replaced by graphics ram. */ -WRITE8_MEMBER( trs80_state::lnw80_fe_w ) -{ -/* lnw80 video options - d3 bankswitch lower 16k between roms and hires ram (1=hires) - d2 enable colour \ - d1 hres / these 2 are the bits from the MODE command of LNWBASIC - d0 inverse video (entire screen) */ - - /* get address space instead of io space */ - address_space &mem = m_maincpu->space(AS_PROGRAM); - - m_mode = (m_mode & 0x87) | ((data & 0x0f) << 3); - - if (data & 8) - { - mem.unmap_readwrite (0x0000, 0x3fff); - mem.install_readwrite_handler (0x0000, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_gfxram_r), this), write8_delegate(FUNC(trs80_state::trs80_gfxram_w), this)); - } - else - { - mem.unmap_readwrite (0x0000, 0x3fff); - mem.install_read_bank (0x0000, 0x2fff, "bank1"); - membank("bank1")->set_base(m_region_maincpu->base()); - mem.install_readwrite_handler (0x37e0, 0x37e3, read8_delegate(FUNC(trs80_state::trs80_irq_status_r), this), write8_delegate(FUNC(trs80_state::trs80_motor_w), this)); - mem.install_readwrite_handler (0x37e8, 0x37eb, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this)); - mem.install_read_handler (0x37ec, 0x37ec, read8_delegate(FUNC(trs80_state::trs80_wd179x_r), this)); - mem.install_write_handler (0x37ec, 0x37ec, write8_delegate(FUNC(fd1793_t::cmd_w),(fd1793_t*)m_fdc)); - mem.install_readwrite_handler (0x37ed, 0x37ed, read8_delegate(FUNC(fd1793_t::track_r),(fd1793_t*)m_fdc), write8_delegate(FUNC(fd1793_t::track_w),(fd1793_t*)m_fdc)); - mem.install_readwrite_handler (0x37ee, 0x37ee, read8_delegate(FUNC(fd1793_t::sector_r),(fd1793_t*)m_fdc), write8_delegate(FUNC(fd1793_t::sector_w),(fd1793_t*)m_fdc)); - mem.install_readwrite_handler (0x37ef, 0x37ef, read8_delegate(FUNC(fd1793_t::data_r),(fd1793_t*)m_fdc),write8_delegate( FUNC(fd1793_t::data_w),(fd1793_t*)m_fdc)); - mem.install_read_handler (0x3800, 0x38ff, 0, 0x0300, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this)); - mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this)); - } -} - -WRITE8_MEMBER( trs80_state::trs80_ff_w ) -{ -/* Standard output port of Model I - d3 ModeSel bit - d2 Relay - d1, d0 Cassette output */ - - static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 }; - static int init = 0; - - m_cassette->change_state(( data & 4 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR ); - m_cassette->output(levels[data & 3]); - m_cassette_data &= ~0x80; - - m_mode = (m_mode & 0xfe) | ((data & 8) >> 3); - - if (!init) - { - init = 1; - static INT16 speaker_levels[4] = { 0, -32768, 0, 32767 }; - m_speaker->static_set_levels(*m_speaker, 4, speaker_levels); - - } - /* Speaker for System-80 MK II - only sounds if relay is off */ - if (~data & 4) - m_speaker->level_w(data & 3); -} - -WRITE8_MEMBER( trs80_state::trs80m4_ff_w ) -{ -/* Cassette port - d1, d0 Cassette output */ - - static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 }; - m_cassette->output(levels[data & 3]); - m_cassette_data &= ~0x80; -} - - -/************************************* - * - * Interrupt handlers. - * - *************************************/ - -INTERRUPT_GEN_MEMBER(trs80_state::trs80_rtc_interrupt) -{ -/* This enables the processing of interrupts for the clock and the flashing cursor. - The OS counts one tick for each interrupt. The Model I has 40 ticks per - second, while the Model III/4 has 30. */ - - if (m_model4) // Model 4 - { - if (m_mask & IRQ_M4_RTC) - { - m_irq |= IRQ_M4_RTC; - device.execute().set_input_line(0, HOLD_LINE); - } - } - else // Model 1 - { - m_irq |= IRQ_M1_RTC; - device.execute().set_input_line(0, HOLD_LINE); - } -} - -void trs80_state::trs80_fdc_interrupt_internal() -{ - if (m_model4) - { - if (m_nmi_mask & 0x80) // Model 4 does a NMI - { - m_nmi_data = 0x80; - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } - } - else // Model 1 does a IRQ - { - m_irq |= IRQ_M1_FDC; - m_maincpu->set_input_line(0, HOLD_LINE); - } -} - -INTERRUPT_GEN_MEMBER(trs80_state::trs80_fdc_interrupt)/* not used - should it be? */ -{ - trs80_fdc_interrupt_internal(); -} - -WRITE_LINE_MEMBER(trs80_state::trs80_fdc_intrq_w) -{ - if (state) - { - trs80_fdc_interrupt_internal(); - } - else - { - if (m_model4) - m_nmi_data = 0; - else - m_irq &= ~IRQ_M1_FDC; - } -} - - -/************************************* - * * - * Memory handlers * - * * - *************************************/ - -READ8_MEMBER( trs80_state::trs80_wd179x_r ) -{ - UINT8 data = 0xff; - if (BIT(m_io_config->read(), 7)) - data = m_fdc->status_r(space, offset); - - return data; -} - -READ8_MEMBER( trs80_state::trs80_printer_r ) -{ - return m_cent_status_in->read(); -} - -WRITE8_MEMBER( trs80_state::trs80_printer_w ) -{ - m_cent_data_out->write(space, 0, data); - m_centronics->write_strobe(0); - m_centronics->write_strobe(1); -} - -WRITE8_MEMBER( trs80_state::trs80_cassunit_w ) -{ -/* not emulated - 01 for unit 1 (default) - 02 for unit 2 */ - - m_tape_unit = data; -} - -READ8_MEMBER( trs80_state::trs80_irq_status_r ) -{ -/* (trs80l2) Whenever an interrupt occurs, 37E0 is read to see what devices require service. - d7 = RTC - d6 = FDC - d2 = Communications (not emulated) - All interrupting devices are serviced in a single interrupt. There is a mask byte, - which is dealt with by the DOS. We take the opportunity to reset the cpu INT line. */ - - int result = m_irq; - m_maincpu->set_input_line(0, CLEAR_LINE); - m_irq = 0; - return result; -} - - -WRITE8_MEMBER( trs80_state::trs80_motor_w ) -{ - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - if (BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_fdc->set_floppy(floppy); - - if (floppy) - { - floppy->mon_w(0); - floppy->ss_w(BIT(data, 4)); - } - - // switch to fm - m_fdc->dden_w(1); -} - -/************************************* - * Keyboard * - *************************************/ -READ8_MEMBER( trs80_state::trs80_keyboard_r ) -{ - UINT8 result = 0; - - if (offset & 1) - result |= m_io_line0->read(); - if (offset & 2) - result |= m_io_line1->read(); - if (offset & 4) - result |= m_io_line2->read(); - if (offset & 8) - result |= m_io_line3->read(); - if (offset & 16) - result |= m_io_line4->read(); - if (offset & 32) - result |= m_io_line5->read(); - if (offset & 64) - result |= m_io_line6->read(); - if (offset & 128) - result |= m_io_line7->read(); - - return result; -} - - -/************************************* - * Machine * - *************************************/ - -void trs80_state::machine_start() -{ - m_tape_unit=1; - m_reg_load=1; - m_nmi_data=0xff; - - m_cassette_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(trs80_state::cassette_data_callback),this)); - m_cassette_data_timer->adjust( attotime::zero, 0, attotime::from_hz(11025) ); -} - -void trs80_state::machine_reset() -{ - m_cassette_data = 0; -} - -MACHINE_RESET_MEMBER(trs80_state,trs80m4) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - m_cassette_data = 0; - - mem.install_read_bank (0x0000, 0x0fff, "bank1"); - m_bank1 = membank("bank1"); - mem.install_read_bank (0x1000, 0x37e7, "bank2"); - m_bank2 = membank("bank2"); - mem.install_read_bank (0x37e8, 0x37e9, "bank3"); - m_bank3 = membank("bank3"); - mem.install_read_bank (0x37ea, 0x37ff, "bank4"); - m_bank4 = membank("bank4"); - mem.install_read_bank (0x3800, 0x3bff, "bank5"); - m_bank5 = membank("bank5"); - mem.install_read_bank (0x3c00, 0x3fff, "bank6"); - m_bank6 = membank("bank6"); - mem.install_read_bank (0x4000, 0xf3ff, "bank7"); - m_bank7 = membank("bank7"); - mem.install_read_bank (0xf400, 0xf7ff, "bank8"); - m_bank8 = membank("bank8"); - mem.install_read_bank (0xf800, 0xffff, "bank9"); - m_bank9 = membank("bank9"); - - mem.install_write_bank (0x0000, 0x0fff, "bank11"); - m_bank11 = membank("bank11"); - mem.install_write_bank (0x1000, 0x37e7, "bank12"); - m_bank12 = membank("bank12"); - mem.install_write_bank (0x37e8, 0x37e9, "bank13"); - m_bank13 = membank("bank13"); - mem.install_write_bank (0x37ea, 0x37ff, "bank14"); - m_bank14 = membank("bank14"); - mem.install_write_bank (0x3800, 0x3bff, "bank15"); - m_bank15 = membank("bank15"); - mem.install_write_bank (0x3c00, 0x3fff, "bank16"); - m_bank16 = membank("bank16"); - mem.install_write_bank (0x4000, 0xf3ff, "bank17"); - m_bank17 = membank("bank17"); - mem.install_write_bank (0xf400, 0xf7ff, "bank18"); - m_bank18 = membank("bank18"); - mem.install_write_bank (0xf800, 0xffff, "bank19"); - m_bank19 = membank("bank19"); - trs80m4p_9c_w(mem, 0, 1); /* Enable the ROM */ - trs80m4_84_w(mem, 0, 0); /* switch in devices at power-on */ -} - -MACHINE_RESET_MEMBER(trs80_state,lnw80) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - m_cassette_data = 0; - m_reg_load = 1; - lnw80_fe_w(space, 0, 0); -} - - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -#define LOG 1 - -#define CMD_TYPE_OBJECT_CODE 0x01 -#define CMD_TYPE_TRANSFER_ADDRESS 0x02 -#define CMD_TYPE_END_OF_PARTITIONED_DATA_SET_MEMBER 0x04 -#define CMD_TYPE_LOAD_MODULE_HEADER 0x05 -#define CMD_TYPE_PARTITIONED_DATA_SET_HEADER 0x06 -#define CMD_TYPE_PATCH_NAME_HEADER 0x07 -#define CMD_TYPE_ISAM_DIRECTORY_ENTRY 0x08 -#define CMD_TYPE_END_OF_ISAM_DIRECTORY_ENTRY 0x0a -#define CMD_TYPE_PDS_DIRECTORY_ENTRY 0x0c -#define CMD_TYPE_END_OF_PDS_DIRECTORY_ENTRY 0x0e -#define CMD_TYPE_YANKED_LOAD_BLOCK 0x10 -#define CMD_TYPE_COPYRIGHT_BLOCK 0x1f - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -QUICKLOAD_LOAD_MEMBER( trs80_state, trs80_cmd ) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - UINT8 type, length; - UINT8 data[0x100]; - UINT8 addr[2]; - void *ptr; - - while (!image.image_feof()) - { - image.fread( &type, 1); - image.fread( &length, 1); - - length -= 2; - int block_length = length ? length : 256; - - switch (type) - { - case CMD_TYPE_OBJECT_CODE: - { - image.fread( &addr, 2); - UINT16 address = (addr[1] << 8) | addr[0]; - if (LOG) logerror("/CMD object code block: address %04x length %u\n", address, block_length); - ptr = program.get_write_ptr(address); - image.fread( ptr, block_length); - } - break; - - case CMD_TYPE_TRANSFER_ADDRESS: - { - image.fread( &addr, 2); - UINT16 address = (addr[1] << 8) | addr[0]; - if (LOG) logerror("/CMD transfer address %04x\n", address); - m_maincpu->set_state_int(Z80_PC, address); - } - break; - - case CMD_TYPE_LOAD_MODULE_HEADER: - image.fread( &data, block_length); - if (LOG) logerror("/CMD load module header '%s'\n", data); - break; - - case CMD_TYPE_COPYRIGHT_BLOCK: - image.fread( &data, block_length); - if (LOG) logerror("/CMD copyright block '%s'\n", data); - break; - - default: - image.fread( &data, block_length); - logerror("/CMD unsupported block type %u!\n", type); - } - } - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/trs80m2kb.c b/src/mess/machine/trs80m2kb.c deleted file mode 100644 index 01f4dc7930a..00000000000 --- a/src/mess/machine/trs80m2kb.c +++ /dev/null @@ -1,392 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Tandy Radio Shack TRS-80 Model II keyboard emulation - -**********************************************************************/ - -#include "trs80m2kb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8021_TAG "z4" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type TRS80M2_KEYBOARD = &device_creator; - - - -//------------------------------------------------- -// ROM( trs80m2_keyboard ) -//------------------------------------------------- - -ROM_START( trs80m2_keyboard ) - ROM_REGION( 0x400, I8021_TAG, 0 ) - ROM_LOAD( "65-1991.z4", 0x0000, 0x0400, NO_DUMP ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *trs80m2_keyboard_device::device_rom_region() const -{ - return ROM_NAME( trs80m2_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( kb_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( trs80m2_keyboard_io, AS_IO, 8, trs80m2_keyboard_device ) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(kb_t1_r) - AM_RANGE(MCS48_PORT_P0, MCS48_PORT_P0) AM_READ(kb_p0_r) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(kb_p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// MACHINE_DRIVER( trs80m2_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( trs80m2_keyboard ) - MCFG_CPU_ADD(I8021_TAG, I8021, 3000000) // 1000uH inductor connected across the XTAL inputs - MCFG_CPU_IO_MAP(trs80m2_keyboard_io) - MCFG_DEVICE_DISABLE() // TODO -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor trs80m2_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( trs80m2_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( trs80m2_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( trs80m2_keyboard ) - PORT_START("Y0") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y1") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y2") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPEAT") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("Y3") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("cannot read label") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - - PORT_START("Y4") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - - PORT_START("Y5") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOLD") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - - PORT_START("Y6") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) - - PORT_START("Y7") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) - - PORT_START("Y8") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) - - PORT_START("Y9") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("YA") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("YB") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor trs80m2_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( trs80m2_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// trs80m2_keyboard_device - constructor -//------------------------------------------------- - -trs80m2_keyboard_device::trs80m2_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, TRS80M2_KEYBOARD, "TRS-80 Model II Keyboard", tag, owner, clock, "trs80m2kb", __FILE__), - m_maincpu(*this, I8021_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_ya(*this, "YA"), - m_yb(*this, "YB"), - m_write_clock(*this), - m_busy(1), - m_data(1), - m_clk(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void trs80m2_keyboard_device::device_start() -{ - // resolve callbacks - m_write_clock.resolve_safe(); - - // state saving - save_item(NAME(m_busy)); - save_item(NAME(m_data)); - save_item(NAME(m_clk)); - save_item(NAME(m_y)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void trs80m2_keyboard_device::device_reset() -{ -} - - -//------------------------------------------------- -// busy_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( trs80m2_keyboard_device::busy_w ) -{ - m_busy = state; -} - - -//------------------------------------------------- -// data_r - -//------------------------------------------------- - -READ_LINE_MEMBER( trs80m2_keyboard_device::data_r ) -{ - return m_data; -} - -//------------------------------------------------- -// kb_t1_r - -//------------------------------------------------- - -READ8_MEMBER( trs80m2_keyboard_device::kb_t1_r ) -{ - return m_busy; -} - - -//------------------------------------------------- -// kb_p0_r - -//------------------------------------------------- - -READ8_MEMBER( trs80m2_keyboard_device::kb_p0_r ) -{ - UINT8 data = 0xff; - - switch (m_y) - { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; - case 0xa: data &= m_ya->read(); break; - case 0xb: data &= m_yb->read(); break; - } - - return data; -} - - -//------------------------------------------------- -// kb_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( trs80m2_keyboard_device::kb_p1_w ) -{ - /* - - bit description - - 0 DATA - 1 CLOCK - 2 LED - 3 - 4 LED - 5 - 6 - 7 - - */ - - m_data = BIT(data, 0); - int clk = BIT(data, 1); - - if (m_clk != clk) - { - m_write_clock(clk); - m_clk = clk; - } - - output_set_led_value(LED_0, BIT(data, 2)); - output_set_led_value(LED_1, BIT(data, 4)); -} - - -//------------------------------------------------- -// kb_p2_w - -//------------------------------------------------- - -WRITE8_MEMBER( trs80m2_keyboard_device::kb_p2_w ) -{ - /* - - bit description - - 0 D - 1 C - 2 B - 3 A - 4 - 5 - 6 - 7 - - */ - - m_y = BITSWAP8(data, 7, 6, 5, 4, 0, 1, 2, 3) & 0x0f; -} diff --git a/src/mess/machine/trs80m2kb.h b/src/mess/machine/trs80m2kb.h deleted file mode 100644 index be665372e2b..00000000000 --- a/src/mess/machine/trs80m2kb.h +++ /dev/null @@ -1,106 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Tandy Radio Shack TRS-80 Model II keyboard emulation - -**********************************************************************/ - -#pragma once - -#ifndef __TRS80M2_KEYBOARD__ -#define __TRS80M2_KEYBOARD__ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "sound/discrete.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define TRS80M2_KEYBOARD_TAG "trs80m2kb" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_TRS80M2_KEYBOARD_CLOCK_CALLBACK(_write) \ - devcb = &trs80m2_keyboard_device::set_clock_wr_callback(*device, DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> trs80m2_keyboard_device - -class trs80m2_keyboard_device : public device_t -{ -public: - // construction/destruction - trs80m2_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_clock_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clock.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_WRITE_LINE_MEMBER( busy_w ); - DECLARE_READ_LINE_MEMBER( data_r ); - - // not really public - DECLARE_READ8_MEMBER( kb_t1_r ); - DECLARE_READ8_MEMBER( kb_p0_r ); - DECLARE_WRITE8_MEMBER( kb_p1_w ); - DECLARE_WRITE8_MEMBER( kb_p2_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - enum - { - LED_0 = 0, - LED_1 - }; - - required_device m_maincpu; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_ya; - required_ioport m_yb; - - devcb_write_line m_write_clock; - - int m_busy; - int m_data; - int m_clk; - - UINT8 m_y; -}; - - -// device type definition -extern const device_type TRS80M2_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/upd65031.c b/src/mess/machine/upd65031.c deleted file mode 100644 index 86d9ff5e093..00000000000 --- a/src/mess/machine/upd65031.c +++ /dev/null @@ -1,621 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/********************************************************************** - - NEC uPD65031 'BLINK' emulation - - the uPD65031 manages almost everything in the Z88: - - memory bankswitch - - interrupts - - RTC - - LCD - - keyboard - - serial - - speaker - - TODO: - - coma and snooze mode - - speaker controlled by txd - - EPROM programming - - UART - -*********************************************************************/ - - -#include "upd65031.h" - - -// device type definition -const device_type UPD65031 = &device_creator; - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - -#define SPEAKER_ALARM_FREQ attotime::from_hz(3200) - -// internal registers -enum -{ - // write registers - REG_PB0 = 0x70, // pixel base 0 - REG_PB1 = 0x71, // pixel base 1 - REG_PB2 = 0x72, // pixel base 2 - REG_PB3 = 0x73, // pixel base 3 - REG_SBR = 0x74, // screen base register - - REG_COM = 0xb0, // command register - REG_INT = 0xb1, // interrupt control - REG_EPR = 0xb3, // EPROM programming - REG_TACK = 0xb4, // RTC acknowledge - REG_TMK = 0xb5, // RTC interrupt mask - REG_ACK = 0xb6, // interrupt acknowledge - - REG_SR0 = 0xd0, // segment register 0 - REG_SR1 = 0xd1, // segment register 1 - REG_SR2 = 0xd2, // segment register 2 - REG_SR3 = 0xd3, // segment register 3 - - REG_RXC = 0xe2, // UART receiver control - REG_TXD = 0xe3, // UART transmit data - REG_TXC = 0xe4, // UART transmit control - REG_UMK = 0xe5, // UART interrupt mask - REG_UAK = 0xe6, // UART interrupt acknowledge - - - // read registers - REG_STA = 0xb1, // interrupt status - REG_KBD = 0xb2, // keyboard read - REG_TSTA = 0xb5, // RTC interrupt status - - REG_TIM0 = 0xd0, // RTC 5ms counter - REG_TIM1 = 0xd1, // RTC seconds counter (6 bits) - REG_TIM2 = 0xd2, // RTC minutes counter - REG_TIM3 = 0xd3, // RTC minutes/256 counter - REG_TIM4 = 0xd4, // RTC minutes/65536 counter (5 bits) - - REG_RXD = 0xe0, // UART receive data register - REG_RXE = 0xe1, // UART extended receiver data - REG_UIT = 0xe5 // UART interrupt status -}; - -//mode -enum -{ - STATE_AWAKE = 0, - STATE_SNOOZE, - STATE_COMA -}; - -// interrupt status -#define STA_FLAPOPEN 0x80 -#define STA_A19 0x40 -#define STA_FLAP 0x20 -#define STA_UART 0x10 -#define STA_BTL 0x08 -#define STA_KEY 0x04 -#define STA_TIME 0x01 - -// interrupt control -#define INT_KWAIT 0x80 -#define INT_A19 0x40 -#define INT_FLAP 0x20 -#define INT_UART 0x10 -#define INT_BTL 0x08 -#define INT_KEY 0x04 -#define INT_TIME 0x02 -#define INT_GINT 0x01 - -// command register -#define COM_SRUN 0x80 -#define COM_SBIT 0x40 -#define COM_OVERP 0x20 -#define COM_RESTIM 0x10 -#define COM_PROGRAM 0x08 -#define COM_RAMS 0x04 -#define COM_VPPON 0x02 -#define COM_LCDON 0x01 - -// EPROM programming register -#define EPR_PD1 0x80 -#define EPR_PD0 0x40 -#define EPR_PGMD 0x20 -#define EPR_EOED 0x10 -#define EPR_SE3D 0x08 -#define EPR_PGMP 0x04 -#define EPR_EOEP 0x02 -#define EPR_SE3P 0x01 - -// RTC interrupt status -#define TSTA_MIN 0x04 -#define TSTA_SEC 0x02 -#define TSTA_TICK 0x01 - -//************************************************************************** -// INLINE HELPERS -//************************************************************************** - -inline void upd65031_device::interrupt_refresh() -{ - if ((m_int & INT_GINT) && ((m_int & m_sta & 0x7c) || ((m_int & INT_TIME) && (m_sta & STA_TIME)))) - { - if (LOG) logerror("uPD65031 '%s': set int\n", tag()); - - m_write_int(ASSERT_LINE); - } - else - { - if (LOG) logerror("uPD65031 '%s': clear int\n", tag()); - - m_write_int(CLEAR_LINE); - } -} - - -inline void upd65031_device::update_rtc_interrupt() -{ - // any ints occurred? - if ((m_int & INT_GINT) && (m_int & INT_TIME) && (m_tsta & (TSTA_MIN | TSTA_SEC | TSTA_TICK))) - m_sta |= STA_TIME; - else - m_sta &= ~STA_TIME; -} - - -inline void upd65031_device::set_mode(int mode) -{ - if (m_mode != mode) - { - m_mode = mode; - - switch(mode) - { - case STATE_AWAKE: - //TODO - break; - case STATE_SNOOZE: - //TODO - break; - case STATE_COMA: - //TODO - break; - } - } -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// upd65031_device - constructor -//------------------------------------------------- - -upd65031_device::upd65031_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, UPD65031, "NEC uPD65031", tag, owner, clock, "upd65031", __FILE__), - m_read_kb(*this), - m_write_int(*this), - m_write_nmi(*this), - m_write_spkr(*this) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void upd65031_device::device_start() -{ - // resolve callbacks - m_read_kb.resolve_safe(0); - m_write_int.resolve_safe(); - m_write_nmi.resolve_safe(); - m_write_spkr.resolve_safe(); - - // bind delegates - m_screen_update_cb.bind_relative_to(*owner()); - m_out_mem_cb.bind_relative_to(*owner()); - - // allocate timers - m_rtc_timer = timer_alloc(TIMER_RTC); - m_flash_timer = timer_alloc(TIMER_FLASH); - m_speaker_timer = timer_alloc(TIMER_SPEAKER); - m_rtc_timer->adjust(attotime::from_msec(5), 0, attotime::from_msec(5)); - m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); - m_speaker_timer->reset(); - - // state saving - save_item(NAME(m_mode)); - save_item(NAME(m_lcd_regs)); - save_item(NAME(m_tim)); - save_item(NAME(m_sr)); - save_item(NAME(m_sta)); - save_item(NAME(m_int)); - save_item(NAME(m_ack)); - save_item(NAME(m_tsta)); - save_item(NAME(m_tmk)); - save_item(NAME(m_tack)); - save_item(NAME(m_com)); - save_item(NAME(m_flash)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void upd65031_device::device_reset() -{ - memset(m_lcd_regs, 0, sizeof(m_lcd_regs)); - memset(m_tim, 0, sizeof(m_tim)); - memset(m_sr, 0, sizeof(m_sr)); - m_sta = 0; - m_int = 0; - m_ack = 0; - m_tsta = 0; - m_tmk = TSTA_TICK | TSTA_SEC | TSTA_MIN; - m_tack = 0; - m_com = 0; - m_flash = 0; - m_mode = 0; - set_mode(STATE_AWAKE); - - if (!m_out_mem_cb.isnull()) - { - // reset bankswitch - m_out_mem_cb(0, 0, 0); - m_out_mem_cb(1, 0, 0); - m_out_mem_cb(2, 0, 0); - m_out_mem_cb(3, 0, 0); - } -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void upd65031_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_RTC: - - // if a key is pressed sets the interrupt - if ((m_int & INT_GINT) && (m_int & INT_KEY) && m_read_kb(0) != 0xff) - { - if (LOG) logerror("uPD65031 '%s': Keyboard interrupt!\n", tag()); - - // awakes CPU from snooze on key down - if (m_mode == STATE_SNOOZE) - set_mode(STATE_AWAKE); - - m_sta |= STA_KEY; - } - else - { - m_sta &= ~STA_KEY; - } - - // hold clock at reset? - in this mode it doesn't update - if (!(m_com & COM_RESTIM)) - { - bool irq_change = false; - - // update 5 millisecond counter - m_tim[0]++; - - // tick - if (m_tim[0] & 1) - { - // set tick int has occurred - if (m_tmk & TSTA_TICK) - { - m_tsta |= TSTA_TICK; - irq_change = true; - } - } - - if (m_tim[0] == 200) - { - m_tim[0] = 0; - - // set seconds int has occurred - if (m_tmk & TSTA_SEC) - { - m_tsta |= TSTA_SEC; - irq_change = true; - } - - m_tim[1]++; - - if (m_tim[1] == 60) - { - // set minutes int has occurred - if (m_tmk & TSTA_MIN) - { - m_tsta |= TSTA_MIN; - irq_change = true; - } - m_tim[1] = 0; - m_tim[2]++; - - if (m_tim[2] == 0) // overflowed from 255 - { - m_tim[3]++; - - if (m_tim[3] == 0) // overflowed from 255 - { - m_tim[4]++; - - if (m_tim[4] == 32) - m_tim[4] = 0; - } - } - } - } - - if ((m_int & INT_GINT) && (m_int & INT_TIME) && irq_change && !(m_sta & STA_FLAPOPEN)) - { - set_mode(STATE_AWAKE); - - update_rtc_interrupt(); - } - - // refresh interrupt - interrupt_refresh(); - } - break; - case TIMER_FLASH: - m_flash = !m_flash; - break; - case TIMER_SPEAKER: - m_speaker_state = !m_speaker_state; - m_write_spkr(m_speaker_state ? 1 : 0); - break; - } -} - - -//------------------------------------------------- -// screen_update -//------------------------------------------------- - -UINT32 upd65031_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - if (!m_screen_update_cb.isnull() && (m_com & COM_LCDON)) - m_screen_update_cb(bitmap, m_lcd_regs[4], m_lcd_regs[2], m_lcd_regs[3], m_lcd_regs[0], m_lcd_regs[1], m_flash); - else - bitmap.fill(0, cliprect); - - return 0; -} - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( upd65031_device::read ) -{ - UINT8 port = offset & 0xff; - - switch (port) - { - case REG_STA: // read interrupt status - return m_sta; - - case REG_KBD: - { - // if set, reading the keyboard will put into snooze - if (m_int & INT_KWAIT) - { - set_mode(STATE_SNOOZE); - - if (LOG) logerror("uPD65031 '%s': entering snooze!\n", tag()); - } - - UINT8 data = m_read_kb(offset>>8); - - if (LOG) logerror("uPD65031 '%s': key r %02x: %02x\n", tag(), offset>>8, data); - - return data; - } - - // read real time clock status - case REG_TSTA: - if (LOG) logerror("uPD65031 '%s': tsta r: %02x\n", tag(), m_tsta); - return m_tsta & 0x07; - - // read real time clock counters - case REG_TIM0: - if (LOG) logerror("uPD65031 '%s': TIM0 r: %02x\n", tag(), m_tim[0]); - return m_tim[0]; - case REG_TIM1: - if (LOG) logerror("uPD65031 '%s': TIM1 r: %02x\n", tag(), m_tim[1]); - return m_tim[1]; - case REG_TIM2: - if (LOG) logerror("uPD65031 '%s': TIM2 r: %02x\n", tag(), m_tim[2]); - return m_tim[2]; - case REG_TIM3: - if (LOG) logerror("uPD65031 '%s': TIM3 r: %02x\n", tag(), m_tim[3]); - return m_tim[3]; - case REG_TIM4: - if (LOG) logerror("uPD65031 '%s': TIM4 r: %02x\n", tag(), m_tim[4]); - return m_tim[4]; - - // UART - case REG_RXD: - case REG_RXE: - case REG_UIT: - // TODO - return 0; - - default: - logerror("uPD65031 '%s': blink r: %04x\n", tag(), offset); - return 0; - } -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( upd65031_device::write ) -{ - UINT8 port = offset & 0xff; - - switch (port) - { - // gfx registers - case REG_PB0: - case REG_PB1: - case REG_PB2: - case REG_PB3: - case REG_SBR: - m_lcd_regs[port - REG_PB0] = ((offset & 0xff00) | data); - break; - - case REG_COM: // command register - if (LOG) logerror("uPD65031 '%s': com w: %02x\n", tag(), data); - - // reset clock? - if (data & COM_RESTIM) - m_tim[0] = m_tim[1] = m_tim[2] = m_tim[3] = m_tim[4] = 0; - - if ((data & COM_SRUN) && !(data & COM_SBIT)) - { - // constant tone used for keyclick and alarm - m_speaker_timer->adjust(SPEAKER_ALARM_FREQ, 0, SPEAKER_ALARM_FREQ); - } - else - { - if (!(data & COM_SRUN)) - { - // speaker controlled by SBIT - m_speaker_state = BIT(data, 6); - m_write_spkr(m_speaker_state); - } - else - { - // speaker controlled by txd line - // TODO - } - - m_speaker_timer->reset(); - } - - // bit 2 controls the lower 8kb of memory - if (BIT(m_com^data, 2) && !m_out_mem_cb.isnull()) - m_out_mem_cb(0, m_sr[0], BIT(data, 2)); - - m_com = data; - break; - - case REG_INT: // interrupt control - if (LOG) logerror("uPD65031 '%s': int w: %02x\n", tag(), data); - - m_int = data; - - // refresh ints - update_rtc_interrupt(); - interrupt_refresh(); - break; - - case REG_EPR: // EPROM programming register - if (LOG) logerror("uPD65031 '%s': epr w: %02x\n", tag(), data); - // TODO - break; - - case REG_TACK: // rtc interrupt acknowledge - if (LOG) logerror("uPD65031 '%s': tack w: %02x\n", tag(), data); - - // clear ints that have occurred - m_tsta &= ~(data & 0x07); - m_tack = data; - - // refresh ints - update_rtc_interrupt(); - interrupt_refresh(); - break; - - case REG_TMK: // write rtc interrupt mask - if (LOG) logerror("uPD65031 '%s': tmk w: %02x\n", tag(), data); - - m_tmk = data & 0x07; - break; - - case REG_ACK: // acknowledge ints - if (LOG) logerror("uPD65031 '%s': ack w: %02x\n", tag(), data); - - m_ack = data; - m_sta &= ~(data & 0x7f); - - // refresh ints - interrupt_refresh(); - break; - - // Segment registers - case REG_SR0: - case REG_SR1: - case REG_SR2: - case REG_SR3: - if (!m_out_mem_cb.isnull() && m_sr[port & 3] != data) - m_out_mem_cb(port & 3, data, BIT(m_com, 2)); - - m_sr[port & 3] = data; - break; - - // UART - case REG_RXC: - case REG_TXD: - case REG_TXC: - case REG_UMK: - case REG_UAK: - if (LOG) logerror("uPD65031 '%s': UART w: %02x %02x\n", tag(), port & 7 , data); - // TODO - break; - - default: - logerror("uPD65031 '%s': blink w: %04x %02x\n", tag(), offset, data); - break; - } -} - - -//------------------------------------------------- -// flp line -//------------------------------------------------- - -WRITE_LINE_MEMBER( upd65031_device::flp_w ) -{ - if (!(m_sta & STA_FLAPOPEN) && state) - { - // set interrupt on rising edge - m_sta |= STA_FLAP; - - interrupt_refresh(); - } - - if (state) - m_sta |= STA_FLAPOPEN; - else - m_sta &= ~STA_FLAPOPEN; -} - -//------------------------------------------------- -// battery low line -//------------------------------------------------- - -WRITE_LINE_MEMBER( upd65031_device::btl_w ) -{ - if (state) - m_sta |= STA_BTL; - else - m_sta &= ~STA_BTL; -} diff --git a/src/mess/machine/upd65031.h b/src/mess/machine/upd65031.h deleted file mode 100644 index 75801beb0c4..00000000000 --- a/src/mess/machine/upd65031.h +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/********************************************************************** - - NEC uPD65031 'BLINK' emulation - -**********************************************************************/ - -#pragma once - -#ifndef __UPD65031__ -#define __UPD65031__ - -#include "emu.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_UPD65031_KB_CALLBACK(_read) \ - devcb = &upd65031_device::set_kb_rd_callback(*device, DEVCB_##_read); - -#define MCFG_UPD65031_INT_CALLBACK(_write) \ - devcb = &upd65031_device::set_int_wr_callback(*device, DEVCB_##_write); - -#define MCFG_UPD65031_NMI_CALLBACK(_write) \ - devcb = &upd65031_device::set_nmi_wr_callback(*device, DEVCB_##_write); - -#define MCFG_UPD65031_SPKR_CALLBACK(_write) \ - devcb = &upd65031_device::set_spkr_wr_callback(*device, DEVCB_##_write); - -#define MCFG_UPD65031_SCR_UPDATE_CB(_class, _method) \ - upd65031_device::set_screen_update_callback(*device, upd65031_screen_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - -#define MCFG_UPD65031_MEM_UPDATE_CB(_class, _method) \ - upd65031_device::set_memory_update_callback(*device, upd65031_memory_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -typedef device_delegate upd65031_screen_update_delegate; -typedef device_delegate upd65031_memory_update_delegate; - -#define UPD65031_SCREEN_UPDATE(_name) void _name(bitmap_ind16 &bitmap, UINT16 sbf, UINT16 hires0, UINT16 hires1, UINT16 lores0, UINT16 lores1, int flash) -#define UPD65031_MEMORY_UPDATE(_name) void _name(int bank, UINT16 page, int rams) - - -// ======================> upd65031_device - -class upd65031_device : public device_t -{ -public: - // construction/destruction - upd65031_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_kb_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_kb.set_callback(object); } - template static devcb_base &set_int_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_int.set_callback(object); } - template static devcb_base &set_nmi_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_nmi.set_callback(object); } - template static devcb_base &set_spkr_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_spkr.set_callback(object); } - - static void set_screen_update_callback(device_t &device, upd65031_screen_update_delegate callback) { downcast(device).m_screen_update_cb = callback; } - static void set_memory_update_callback(device_t &device, upd65031_memory_update_delegate callback) { downcast(device).m_out_mem_cb = callback; } - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_WRITE_LINE_MEMBER( flp_w ); - DECLARE_WRITE_LINE_MEMBER( btl_w ); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - inline void interrupt_refresh(); - inline void update_rtc_interrupt(); - inline void set_mode(int mode); - static const device_timer_id TIMER_RTC = 0; - static const device_timer_id TIMER_FLASH = 1; - static const device_timer_id TIMER_SPEAKER = 2; - - devcb_read8 m_read_kb; - devcb_write_line m_write_int; - devcb_write_line m_write_nmi; - devcb_write_line m_write_spkr; - - upd65031_screen_update_delegate m_screen_update_cb; // callback for update the LCD - upd65031_memory_update_delegate m_out_mem_cb; // callback for update bankswitch - - int m_mode; - UINT16 m_lcd_regs[5]; // LCD registers - UINT8 m_tim[5]; // RTC registers - UINT8 m_sr[4]; // segment registers - UINT8 m_sta; // interrupt status - UINT8 m_int; // interrupts mask - UINT8 m_ack; // interrupts acknowledge - UINT8 m_tsta; // timer interrupt status - UINT8 m_tmk; // timer interrupt mask - UINT8 m_tack; // timer interrupts acknowledge - UINT8 m_com; // command register - int m_flash; // cursor flash - int m_speaker_state; // spkr line - - // timers - emu_timer *m_rtc_timer; - emu_timer *m_flash_timer; - emu_timer *m_speaker_timer; -}; - - -// device type definition -extern const device_type UPD65031; - - -#endif diff --git a/src/mess/machine/ut88.c b/src/mess/machine/ut88.c deleted file mode 100644 index 353334b69cd..00000000000 --- a/src/mess/machine/ut88.c +++ /dev/null @@ -1,178 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - UT88 machine driver by Miodrag Milanovic - - 06/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "cpu/i8085/i8085.h" -#include "sound/dac.h" -#include "imagedev/cassette.h" -#include "machine/i8255.h" -#include "includes/ut88.h" - -static const UINT8 hex_to_7seg[16] = -{ - 0x3F, 0x06, 0x5B, 0x4F, - 0x66, 0x6D, 0x7D, 0x07, - 0x7F, 0x6F, 0x77, 0x7c, - 0x39, 0x5e, 0x79, 0x71 -}; - - -/* Driver initialization */ -DRIVER_INIT_MEMBER(ut88_state,ut88) -{ - /* set initially ROM to be visible on first bank */ - UINT8 *RAM = m_region_maincpu->base(); - memset(RAM,0x0000,0x0800); // make first page empty by default - m_bank1->configure_entries(1, 2, RAM, 0x0000); - m_bank1->configure_entries(0, 2, RAM, 0xf800); -} - - -void ut88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_RESET: - m_bank1->set_entry(0); - break; - case TIMER_UPDATE_DISPLAY: - for (int i=0;i<6;i++) - output_set_digit_value(i, hex_to_7seg[m_lcd_digit[i]]); - timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY); - break; - default: - assert_always(FALSE, "Unknown id in ut88_state::device_timer"); - } -} - - -READ8_MEMBER( ut88_state::ut88_8255_portb_r ) -{ - UINT8 data = 0xff; - - if ( m_keyboard_mask & 0x01 ) - data &= m_io_line0->read(); - if ( m_keyboard_mask & 0x02 ) - data &= m_io_line1->read(); - if ( m_keyboard_mask & 0x04 ) - data &= m_io_line2->read(); - if ( m_keyboard_mask & 0x08 ) - data &= m_io_line3->read(); - if ( m_keyboard_mask & 0x10 ) - data &= m_io_line4->read(); - if ( m_keyboard_mask & 0x20 ) - data &= m_io_line5->read(); - if ( m_keyboard_mask & 0x40 ) - data &= m_io_line6->read(); - if ( m_keyboard_mask & 0x80 ) - data &= m_io_line7->read(); - - return data; -} - -READ8_MEMBER( ut88_state::ut88_8255_portc_r ) -{ - return m_io_line8->read(); -} - -WRITE8_MEMBER( ut88_state::ut88_8255_porta_w ) -{ - m_keyboard_mask = data ^ 0xff; -} - -MACHINE_RESET_MEMBER(ut88_state,ut88) -{ - timer_set(attotime::from_usec(10), TIMER_RESET); - m_bank1->set_entry(1); - m_keyboard_mask = 0; -} - - -READ8_MEMBER( ut88_state::ut88_keyboard_r ) -{ - return m_ppi->read(space, offset^0x03); -} - - -WRITE8_MEMBER( ut88_state::ut88_keyboard_w ) -{ - m_ppi->write(space, offset^0x03, data); -} - -WRITE8_MEMBER( ut88_state::ut88_sound_w ) -{ - m_dac->write_unsigned8(data); //beeper - m_cassette->output(BIT(data, 0) ? 1 : -1); -} - - -READ8_MEMBER( ut88_state::ut88_tape_r ) -{ - double level = m_cassette->input(); - return (level < 0) ? 0 : 0xff; -} - -READ8_MEMBER( ut88_state::ut88mini_keyboard_r ) -{ - // This is real keyboard implementation - UINT8 *keyrom1 = m_region_proms->base(); - UINT8 *keyrom2 = m_region_proms->base()+100; - - UINT8 key = keyrom2[m_io_line1->read()]; - - // if keyboard 2nd part returned 0 on 4th bit, output from - // first part is used - - if (!BIT(key, 3)) - key = keyrom1[m_io_line0->read()]; - - // for delete key there is special key producing code 0x80 - - key = (BIT(m_io_line2->read(), 7)) ? key : 0x80; - - // If key 0 is pressed its value is 0x10 this is done by additional - // discrete logic - - key = (BIT(m_io_line0->read(), 0)) ? key : 0x10; - return key; -} - - -WRITE8_MEMBER( ut88_state::ut88mini_write_led ) -{ - switch(offset) - { - case 0: m_lcd_digit[4] = (data >> 4) & 0x0f; - m_lcd_digit[5] = data & 0x0f; - break; - case 1: m_lcd_digit[2] = (data >> 4) & 0x0f; - m_lcd_digit[3] = data & 0x0f; - break; - case 2: m_lcd_digit[0] = (data >> 4) & 0x0f; - m_lcd_digit[1] = data & 0x0f; - break; - } -} - -DRIVER_INIT_MEMBER(ut88_state,ut88mini) -{ -} - -MACHINE_START_MEMBER(ut88_state,ut88mini) -{ - timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY); -} - -MACHINE_RESET_MEMBER(ut88_state,ut88mini) -{ - m_lcd_digit[0] = m_lcd_digit[1] = m_lcd_digit[2] = 0; - m_lcd_digit[3] = m_lcd_digit[4] = m_lcd_digit[5] = 0; -} diff --git a/src/mess/machine/v1050kb.c b/src/mess/machine/v1050kb.c deleted file mode 100644 index e0819004237..00000000000 --- a/src/mess/machine/v1050kb.c +++ /dev/null @@ -1,425 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Visual 1050 keyboard emulation - -*********************************************************************/ - -#include "v1050kb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8049_TAG "z5" -#define DISCRETE_TAG "ls1" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type V1050_KEYBOARD = &device_creator; - - -//------------------------------------------------- -// ROM( v1050_keyboard ) -//------------------------------------------------- - -ROM_START( v1050_keyboard ) - ROM_REGION( 0x800, I8049_TAG, 0 ) - ROM_LOAD( "20-08049-410.z5", 0x0000, 0x0800, NO_DUMP ) // internal 8049 ROM - ROM_LOAD( "22-02716-074.z8", 0x0000, 0x0800, NO_DUMP ) // external ROM for 8039 version -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *v1050_keyboard_device::device_rom_region() const -{ - return ROM_NAME( v1050_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( kb_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( v1050_keyboard_io, AS_IO, 8, v1050_keyboard_device ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// DISCRETE_SOUND_START( v1050kb ) -//------------------------------------------------- - -static const discrete_555_desc v1050_ne555 = -{ - DISC_555_OUT_SQW | DISC_555_OUT_DC, - 5, // B+ voltage of 555 - DEFAULT_555_VALUES -}; - -static DISCRETE_SOUND_START( v1050kb ) - DISCRETE_INPUT_LOGIC(NODE_01) - DISCRETE_555_ASTABLE(NODE_02, NODE_01, (int) RES_K(68) /* can't read on schematic */ , (int) RES_K(3), (int) CAP_N(10), &v1050_ne555) - DISCRETE_OUTPUT(NODE_02, 5000) -DISCRETE_SOUND_END - - -//------------------------------------------------- -// MACHINE_DRIVER( v1050_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( v1050_keyboard ) - MCFG_CPU_ADD(I8049_TAG, I8049, XTAL_4_608MHz) - MCFG_CPU_IO_MAP(v1050_keyboard_io) - MCFG_DEVICE_DISABLE() // TODO - - // discrete sound - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) - MCFG_DISCRETE_INTF(v1050kb) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor v1050_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( v1050_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( v1050_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( v1050_keyboard ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Help") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("No Scrl") - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter DelCh") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 Pg Dn") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 \xE2\x86\x92") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad - DelLn") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 End") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad , DelWd") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Wd\xE2\x86\x92") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F14 OnSer") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F16 Print") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F12 Copy") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 End") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F15 Quick") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F11 Move") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F17 Block") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F13 Hide") - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Line Feed") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('|') PORT_CHAR('\\') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Retn") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Num Lock") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break Stop") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Back Space") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Wd\xE2\x86\x90") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5 \xE2\x86\x91") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 \xE2\x86\x90") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 Last") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 PgUp") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 \xE2\x86\x93") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 Insert") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 InsCr") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 Begin") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 Rept") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 Find") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 Again") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 Refs") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 Save") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - - PORT_START("YA") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') PORT_CHAR('\'') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - - PORT_START("YB") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) - - PORT_START("SW1") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("SW2") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor v1050_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( v1050_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// v1050_keyboard_device - constructor -//------------------------------------------------- - -v1050_keyboard_device::v1050_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, V1050_KEYBOARD, "Visual 1050 Keyboard", tag, owner, clock, "v1050kb", __FILE__), - m_maincpu(*this, I8049_TAG), - m_discrete(*this, DISCRETE_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_ya(*this, "YA"), - m_yb(*this, "YB"), - m_out_tx_handler(*this), - m_y(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void v1050_keyboard_device::device_start() -{ - // state saving - save_item(NAME(m_y)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void v1050_keyboard_device::device_reset() -{ - m_out_tx_handler.resolve_safe(); - m_out_tx_handler(1); -} - - -//------------------------------------------------- -// si_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( v1050_keyboard_device::si_w ) -{ - m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); -} - - -//------------------------------------------------- -// kb_p1_r - -//------------------------------------------------- - -READ8_MEMBER( v1050_keyboard_device::kb_p1_r ) -{ - UINT8 data = 0xff; - - switch (m_y) - { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; - case 0xa: data &= m_ya->read(); break; - case 0xb: data &= m_yb->read(); break; - } - - return data; -} - - -//------------------------------------------------- -// kb_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( v1050_keyboard_device::kb_p1_w ) -{ - m_y = data & 0x0f; -} - - -//------------------------------------------------- -// kb_p2_w - -//------------------------------------------------- - -WRITE8_MEMBER( v1050_keyboard_device::kb_p2_w ) -{ - /* - - bit description - - P20 Z8 A8 (8039 external ROM) - P21 Z8 A9 - P22 Z8 A10 - P23 - P24 - P25 led output - P26 speaker (NE555) output - P27 serial output - - */ - - // led output - output_set_led_value(0, BIT(data, 5)); - - // speaker output - m_discrete->write(space, NODE_01, BIT(data, 6)); - - // serial output - m_out_tx_handler(BIT(data, 7)); -} diff --git a/src/mess/machine/v1050kb.h b/src/mess/machine/v1050kb.h deleted file mode 100644 index 94b4b5dafc4..00000000000 --- a/src/mess/machine/v1050kb.h +++ /dev/null @@ -1,86 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Visual 1050 keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __V1050_KEYBOARD__ -#define __V1050_KEYBOARD__ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "sound/discrete.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_V1050_KEYBOARD_OUT_TX_HANDLER(_devcb) \ - devcb = &v1050_keyboard_device::set_out_tx_handler(*device, DEVCB_##_devcb); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> V1050_keyboard_device - -class v1050_keyboard_device : public device_t -{ -public: - // construction/destruction - v1050_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_out_tx_handler(device_t &device, _Object object) { return downcast(device).m_out_tx_handler.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_WRITE_LINE_MEMBER( si_w ); - - // not really public - DECLARE_READ8_MEMBER( kb_p1_r ); - DECLARE_WRITE8_MEMBER( kb_p1_w ); - DECLARE_WRITE8_MEMBER( kb_p2_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - required_device m_maincpu; - required_device m_discrete; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_ya; - required_ioport m_yb; - devcb_write_line m_out_tx_handler; - - UINT8 m_y; -}; - - -// device type definition -extern const device_type V1050_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/vector06.c b/src/mess/machine/vector06.c deleted file mode 100644 index ba944cef8fd..00000000000 --- a/src/mess/machine/vector06.c +++ /dev/null @@ -1,181 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Vector06c driver by Miodrag Milanovic - - 10/07/2008 Preliminary driver. - -****************************************************************************/ - - -#include "includes/vector06.h" - - -READ8_MEMBER( vector06_state::vector06_8255_portb_r ) -{ - UINT8 key = 0xff; - if (BIT(m_keyboard_mask, 0)) key &= m_line[0]->read(); - if (BIT(m_keyboard_mask, 1)) key &= m_line[1]->read(); - if (BIT(m_keyboard_mask, 2)) key &= m_line[2]->read(); - if (BIT(m_keyboard_mask, 3)) key &= m_line[3]->read(); - if (BIT(m_keyboard_mask, 4)) key &= m_line[4]->read(); - if (BIT(m_keyboard_mask, 5)) key &= m_line[5]->read(); - if (BIT(m_keyboard_mask, 6)) key &= m_line[6]->read(); - if (BIT(m_keyboard_mask, 7)) key &= m_line[7]->read(); - return key; -} - -READ8_MEMBER( vector06_state::vector06_8255_portc_r ) -{ - UINT8 ret = m_line[8]->read(); - - if (m_cassette->input() > 0) - ret |= 0x10; - - return ret; -} - -WRITE8_MEMBER( vector06_state::vector06_8255_porta_w ) -{ - m_keyboard_mask = data ^ 0xff; -} - -void vector06_state::vector06_set_video_mode(int width) -{ - rectangle visarea(0, width+64-1, 0, 256+64-1); - machine().first_screen()->configure(width+64, 256+64, visarea, machine().first_screen()->frame_period().attoseconds()); -} - -WRITE8_MEMBER( vector06_state::vector06_8255_portb_w ) -{ - m_color_index = data & 0x0f; - if ((data & 0x10) != m_video_mode) - { - m_video_mode = data & 0x10; - vector06_set_video_mode((m_video_mode==0x10) ? 512 : 256); - } -} - -WRITE8_MEMBER( vector06_state::vector06_color_set ) -{ - UINT8 r = (data & 7) << 5; - UINT8 g = ((data >> 3) & 7) << 5; - UINT8 b = ((data >>6) & 3) << 6; - m_palette->set_pen_color( m_color_index, rgb_t(r,g,b) ); -} - - -READ8_MEMBER( vector06_state::vector06_romdisk_portb_r ) -{ - UINT16 addr = (m_romdisk_msb << 8) | m_romdisk_lsb; - if (m_cart->exists() && addr < m_cart->get_rom_size()) - return m_cart->read_rom(space, addr); - else - return 0xff; -} - -WRITE8_MEMBER( vector06_state::vector06_romdisk_porta_w ) -{ - m_romdisk_lsb = data; -} - -WRITE8_MEMBER( vector06_state::vector06_romdisk_portc_w ) -{ - m_romdisk_msb = data; -} - -READ8_MEMBER( vector06_state::vector06_8255_1_r ) -{ - return m_ppi->read(space, offset^3); -} - -WRITE8_MEMBER( vector06_state::vector06_8255_1_w ) -{ - m_ppi->write(space, offset^3, data); -} - -READ8_MEMBER( vector06_state::vector06_8255_2_r ) -{ - return m_ppi2->read(space, offset^3); -} - -WRITE8_MEMBER( vector06_state::vector06_8255_2_w ) -{ - m_ppi2->write(space, offset^3, data); -} - -INTERRUPT_GEN_MEMBER(vector06_state::vector06_interrupt) -{ - m_vblank_state++; - if (m_vblank_state>1) m_vblank_state=0; - device.execute().set_input_line(0,m_vblank_state ? HOLD_LINE : CLEAR_LINE); - -} - -IRQ_CALLBACK_MEMBER(vector06_state::vector06_irq_callback) -{ - // Interupt is RST 7 - return 0xff; -} - -TIMER_CALLBACK_MEMBER(vector06_state::reset_check_callback) -{ - UINT8 val = m_reset->read(); - - if (BIT(val, 0)) - { - m_bank1->set_base(m_region_maincpu->base() + 0x10000); - m_maincpu->reset(); - } - - if (BIT(val, 1)) - { - m_bank1->set_base(m_ram->pointer() + 0x0000); - m_maincpu->reset(); - } -} - -WRITE8_MEMBER( vector06_state::vector06_disc_w ) -{ - floppy_image_device *floppy = NULL; - - switch (data & 0x01) - { - case 0: floppy = m_floppy0->get_device(); break; - case 1: floppy = m_floppy1->get_device(); break; - } - - m_fdc->set_floppy(floppy); - - if (floppy) - { - // something here needs to turn the motor on - floppy->mon_w(0); - floppy->ss_w(!BIT(data, 2)); - } -} - -void vector06_state::machine_start() -{ - machine().scheduler().timer_pulse(attotime::from_hz(50), timer_expired_delegate(FUNC(vector06_state::reset_check_callback),this)); -} - -void vector06_state::machine_reset() -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.install_read_bank (0x0000, 0x7fff, m_bank1); - space.install_write_bank(0x0000, 0x7fff, m_bank2); - space.install_read_bank (0x8000, 0xffff, m_bank3); - space.install_write_bank(0x8000, 0xffff, m_bank4); - - m_bank1->set_base(m_region_maincpu->base() + 0x10000); - m_bank2->set_base(m_ram->pointer() + 0x0000); - m_bank3->set_base(m_ram->pointer() + 0x8000); - m_bank4->set_base(m_ram->pointer() + 0x8000); - - m_keyboard_mask = 0; - m_color_index = 0; - m_video_mode = 0; -} diff --git a/src/mess/machine/victor9k_fdc.c b/src/mess/machine/victor9k_fdc.c deleted file mode 100644 index ae04084757b..00000000000 --- a/src/mess/machine/victor9k_fdc.c +++ /dev/null @@ -1,1351 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Victor 9000 floppy disk controller emulation - -**********************************************************************/ - -/* - - value error description - - 01 no sync pulse detected - 02 no header track - 03 checksum error in header - 04 not right track - 05 not right sector - 06 not a data block - 07 data checksum error - 08 sync too long - 99 not a system disc - - 11 Noise on sync - FF No sync (bad or unformatted disk) - -*/ - -/* - - TODO: - - - write protect - - separate read/write methods - - communication error with SCP after loading boot sector - - bp ff1a8 - - patch ff1ab=c3 - - single/double sided jumper - - header sync length unknown (6 is too short) - - 8048 spindle speed control - -*/ - -#include "victor9k_fdc.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 -#define LOG_VIA 0 -#define LOG_SCP 0 -#define LOG_BITS 0 - -#define I8048_TAG "5d" -#define M6522_4_TAG "1f" -#define M6522_5_TAG "1k" -#define M6522_6_TAG "1h" - -// this is exactly the same decode/encode as used in the Commodore 4040/8050 series drives -#define GCR_DECODE(_e, _i) \ - ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04)) - -// E7 E6 I7 E5 E4 E3 E2 I2 E1 E0 -#define GCR_ENCODE(_e, _i) \ - ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03)) - -// Tandon TM-100 spindle @ 300RPM, measured TACH 12VAC 256Hz -// TACH = RPM / 60 * SPINDLE RATIO * MOTOR POLES -// 256 = 300 / 60 * 6.4 * 8 -#define SPINDLE_RATIO 6.4 -#define MOTOR_POLES 8 - -// TODO wrong values here! motor speed is controlled by an LM2917, with help from the spindle TACH and a DAC0808 whose value is set by the SCP 8048 -const int victor_9000_fdc_t::rpm[] = { 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 254, 255, 257, 259, 260, 262, 264, 266, 267, 269, 271, 273, 275, 276, 278, 280, 282, 284, 286, 288, 290, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 318, 320, 322, 324, 326, 328, 330, 333, 335, 337, 339, 342, 344, 346, 348, 351, 353, 355, 358, 360, 362, 365, 367, 370, 372, 375, 377, 380, 382, 385, 387, 390, 392, 395, 398, 400, 403, 406, 408, 411, 414, 416, 419, 422, 425, 428, 430, 433, 436, 439, 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, 472, 475, 478, 482, 485, 488, 491, 494, 498, 501, 504, 508, 511, 514, 518, 521, 525, 528, 532, 535, 539, 542, 546, 550, 553, 557, 561, 564, 568, 572, 576, 579, 583, 587, 591, 595, 599, 603, 607, 611, 615, 619, 623, 627, 631, 636, 640, 644, 648, 653, 657, 661, 666, 670, 674, 679, 683, 688, 693, 697, 702, 706, 711, 716, 721, 725, 730, 735, 740, 745, 750, 755, 760, 765, 770, 775, 780, 785, 790, 796, 801, 806, 812, 817, 822, 828, 833, 839, 844, 850, 856, 861, 867, 873, 878, 884 }; - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type VICTOR_9000_FDC = &device_creator; - - -//------------------------------------------------- -// ROM( victor_9000_fdc ) -//------------------------------------------------- - -ROM_START( victor_9000_fdc ) - ROM_REGION( 0x400, I8048_TAG, 0) - ROM_LOAD( "36080.5d", 0x000, 0x400, CRC(9bf49f7d) SHA1(b3a11bb65105db66ae1985b6f482aab6ea1da38b) ) - - ROM_REGION( 0x800, "gcr", 0 ) - ROM_LOAD( "100836-001.4k", 0x000, 0x800, CRC(adc601bd) SHA1(6eeff3d2063ae2d97452101aa61e27ef83a467e5) ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *victor_9000_fdc_t::device_rom_region() const -{ - return ROM_NAME( victor_9000_fdc ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( floppy_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( floppy_io, AS_IO, 8, victor_9000_fdc_t ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(floppy_p1_r, floppy_p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(floppy_p2_r, floppy_p2_w) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(tach0_r) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(tach1_r) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(da_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// SLOT_INTERFACE( victor9k_floppies ) -//------------------------------------------------- - -int victor_9000_fdc_t::load0_cb(floppy_image_device *device) -{ - // DOOR OPEN 0 - m_via4->write_ca1(0); - - return IMAGE_INIT_PASS; -} - -void victor_9000_fdc_t::unload0_cb(floppy_image_device *device) -{ - // DOOR OPEN 0 - m_via4->write_ca1(1); -} - -int victor_9000_fdc_t::load1_cb(floppy_image_device *device) -{ - // DOOR OPEN 1 - m_via4->write_cb1(0); - - return IMAGE_INIT_PASS; -} - -void victor_9000_fdc_t::unload1_cb(floppy_image_device *device) -{ - // DOOR OPEN 1 - m_via4->write_cb1(1); -} - -static SLOT_INTERFACE_START( victor9k_floppies ) - SLOT_INTERFACE( "525ssqd", FLOPPY_525_SSQD ) // Tandon TM100-3 with custom electronics - SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Tandon TM100-4 with custom electronics -SLOT_INTERFACE_END - -FLOPPY_FORMATS_MEMBER( victor_9000_fdc_t::floppy_formats ) - FLOPPY_VICTOR_9000_FORMAT -FLOPPY_FORMATS_END - - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( victor_9000_fdc ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( victor_9000_fdc ) - MCFG_CPU_ADD(I8048_TAG, I8048, XTAL_30MHz/6) - MCFG_CPU_IO_MAP(floppy_io) - - MCFG_DEVICE_ADD(M6522_4_TAG, VIA6522, XTAL_30MHz/30) - MCFG_VIA6522_READPA_HANDLER(READ8(victor_9000_fdc_t, via4_pa_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(victor_9000_fdc_t, via4_pa_w)) - MCFG_VIA6522_READPB_HANDLER(READ8(victor_9000_fdc_t, via4_pb_r)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor_9000_fdc_t, via4_pb_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(victor_9000_fdc_t, wrsync_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor_9000_fdc_t, via4_irq_w)) - - MCFG_DEVICE_ADD(M6522_5_TAG, VIA6522, XTAL_30MHz/30) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor_9000_fdc_t, via5_irq_w)) - MCFG_VIA6522_READPA_HANDLER(READ8(victor_9000_fdc_t, via5_pa_r)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor_9000_fdc_t, via5_pb_w)) - - MCFG_DEVICE_ADD(M6522_6_TAG, VIA6522, XTAL_30MHz/30) - MCFG_VIA6522_READPA_HANDLER(READ8(victor_9000_fdc_t, via6_pa_r)) - MCFG_VIA6522_READPB_HANDLER(READ8(victor_9000_fdc_t, via6_pb_r)) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(victor_9000_fdc_t, via6_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(victor_9000_fdc_t, via6_pb_w)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(victor_9000_fdc_t, drw_w)) - MCFG_VIA6522_CB2_HANDLER(WRITELINE(victor_9000_fdc_t, erase_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(victor_9000_fdc_t, via6_irq_w)) - - MCFG_FLOPPY_DRIVE_ADD(I8048_TAG":0", victor9k_floppies, "525qd", victor_9000_fdc_t::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(I8048_TAG":1", victor9k_floppies, "525qd", victor_9000_fdc_t::floppy_formats) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor victor_9000_fdc_t::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( victor_9000_fdc ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// victor_9000_fdc_t - constructor -//------------------------------------------------- - -victor_9000_fdc_t::victor_9000_fdc_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, VICTOR_9000_FDC, "Victor 9000 FDC", tag, owner, clock, "victor9k_fdc", __FILE__), - m_irq_cb(*this), - m_syn_cb(*this), - m_lbrdy_cb(*this), - m_maincpu(*this, I8048_TAG), - m_via4(*this, M6522_4_TAG), - m_via5(*this, M6522_5_TAG), - m_via6(*this, M6522_6_TAG), - m_floppy0(*this, I8048_TAG":0:525qd"), - m_floppy1(*this, I8048_TAG":1:525qd"), - m_gcr_rom(*this, "gcr"), - m_da(0), - m_da0(0), - m_da1(0), - m_start0(1), - m_stop0(1), - m_start1(1), - m_stop1(1), - m_sel0(0), - m_sel1(0), - m_tach0(0), - m_tach1(0), - m_rdy0(0), - m_rdy1(0), - m_l0ms(0), - m_l1ms(0), - m_st0(0), - m_st1(0), - m_stp0(0), - m_stp1(0), - m_drive(0), - m_side(0), - m_via4_irq(CLEAR_LINE), - m_via5_irq(CLEAR_LINE), - m_via6_irq(CLEAR_LINE), - m_period(attotime::from_hz(XTAL_15MHz/32)) -{ - cur_live.tm = attotime::never; - cur_live.state = IDLE; - cur_live.next_state = -1; -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void victor_9000_fdc_t::device_start() -{ - // resolve callbacks - m_irq_cb.resolve_safe(); - m_syn_cb.resolve_safe(); - m_lbrdy_cb.resolve_safe(); - - // allocate timer - t_gen = timer_alloc(TM_GEN); - t_tach0 = timer_alloc(TM_TACH0); - t_tach1 = timer_alloc(TM_TACH1); - - // state saving - save_item(NAME(m_da)); - save_item(NAME(m_da0)); - save_item(NAME(m_da1)); - save_item(NAME(m_start0)); - save_item(NAME(m_stop0)); - save_item(NAME(m_start1)); - save_item(NAME(m_stop1)); - save_item(NAME(m_sel0)); - save_item(NAME(m_sel1)); - save_item(NAME(m_tach0)); - save_item(NAME(m_tach1)); - save_item(NAME(m_rdy0)); - save_item(NAME(m_rdy1)); - save_item(NAME(m_l0ms)); - save_item(NAME(m_l1ms)); - save_item(NAME(m_st0)); - save_item(NAME(m_st1)); - save_item(NAME(m_stp0)); - save_item(NAME(m_stp1)); - save_item(NAME(m_drive)); - save_item(NAME(m_side)); - save_item(NAME(m_drw)); - save_item(NAME(m_erase)); - save_item(NAME(m_via4_irq)); - save_item(NAME(m_via5_irq)); - save_item(NAME(m_via6_irq)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void victor_9000_fdc_t::device_reset() -{ - live_abort(); - - // reset devices - m_via4->reset(); - m_via5->reset(); - m_via6->reset(); - - // set floppy callbacks - m_floppy0->setup_load_cb(floppy_image_device::load_cb(FUNC(victor_9000_fdc_t::load0_cb), this)); - m_floppy0->setup_unload_cb(floppy_image_device::unload_cb(FUNC(victor_9000_fdc_t::unload0_cb), this)); - - m_floppy1->setup_load_cb(floppy_image_device::load_cb(FUNC(victor_9000_fdc_t::load1_cb), this)); - m_floppy1->setup_unload_cb(floppy_image_device::unload_cb(FUNC(victor_9000_fdc_t::unload1_cb), this)); -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void victor_9000_fdc_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TM_GEN: - live_sync(); - live_run(); - break; - - case TM_TACH0: - m_tach0 = !m_tach0; - if (LOG_SCP) logerror("TACH0 %u\n", m_tach0); - break; - - case TM_TACH1: - m_tach1 = !m_tach1; - if (LOG_SCP) logerror("TACH1 %u\n", m_tach1); - break; - } -} - - -//------------------------------------------------- -// floppy_p1_r - -//------------------------------------------------- - -READ8_MEMBER( victor_9000_fdc_t::floppy_p1_r ) -{ - /* - - bit description - - 0 L0MS0 - 1 L0MS1 - 2 L0MS2 - 3 L0MS3 - 4 L1MS0 - 5 L1MS1 - 6 L1MS2 - 7 L1MS3 - - */ - - return (m_l1ms << 4) | m_l0ms; -} - - -//------------------------------------------------- -// floppy_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( victor_9000_fdc_t::floppy_p1_w ) -{ - /* - - bit description - - 0 L0MS0 - 1 L0MS1 - 2 L0MS2 - 3 L0MS3 - 4 L1MS0 - 5 L1MS1 - 6 L1MS2 - 7 L1MS3 - - */ - - m_l0ms = data & 0x0f; - m_l1ms = data >> 4; -} - - -//------------------------------------------------- -// floppy_p2_r - -//------------------------------------------------- - -READ8_MEMBER( victor_9000_fdc_t::floppy_p2_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 RDY0 - 7 RDY1 - - */ - - UINT8 data = m_p2 & 0x3f; - - data |= m_rdy0 << 6; - data |= m_rdy1 << 7; - - return data; -} - - -//------------------------------------------------- -// floppy_p2_w - -//------------------------------------------------- - -WRITE8_MEMBER( victor_9000_fdc_t::floppy_p2_w ) -{ - /* - - bit description - - 0 START0 - 1 STOP0 - 2 START1 - 3 STOP1 - 4 SEL1 - 5 SEL0 - 6 RDY0 - 7 RDY1 - - */ - - m_p2 = data; - - bool sync = false; - - int start0 = BIT(data, 0); - if (m_start0 != start0) sync = true; - - int stop0 = BIT(data, 1); - if (m_stop0 != stop0) sync = true; - - int start1 = BIT(data, 2); - if (m_start1 != start1) sync = true; - - int stop1 = BIT(data, 3); - if (m_stop1 != stop1) sync = true; - - int sel0 = BIT(data, 5); - if (m_sel0 != sel0) sync = true; - - int sel1 = BIT(data, 4); - if (m_sel1 != sel1) sync = true; - - set_rdy0(BIT(data, 6)); - set_rdy1(BIT(data, 7)); - - if (LOG_SCP) logerror("%s %s START0/STOP0/SEL0/RDY0 %u/%u/%u/%u START1/STOP1/SEL1/RDY1 %u/%u/%u/%u\n", machine().time().as_string(), machine().describe_context(), start0, stop0, sel0, m_rdy0, start1, stop1, sel1, m_rdy1); - - if (sync) - { - live_sync(); - - m_start0 = start0; - m_stop0 = stop0; - m_sel0 = sel0; - //update_spindle_motor(m_floppy0, t_tach0, m_start0, m_stop0, m_sel0, m_da0); - - m_start1 = start1; - m_stop1 = stop1; - m_sel1 = sel1; - //update_spindle_motor(m_floppy1, t_tach1, m_start1, m_stop1, m_sel1, m_da1); - - checkpoint(); - - if (!m_floppy0->mon_r() || !m_floppy1->mon_r()) { - if(cur_live.state == IDLE) { - live_start(); - } - } else { - live_abort(); - } - - live_run(); - } -} - - -//------------------------------------------------- -// tach0_r - -//------------------------------------------------- - -READ8_MEMBER( victor_9000_fdc_t::tach0_r ) -{ - return m_tach0; -} - - -//------------------------------------------------- -// tach1_r - -//------------------------------------------------- - -READ8_MEMBER( victor_9000_fdc_t::tach1_r ) -{ - return m_tach1; -} - - -void victor_9000_fdc_t::update_stepper_motor(floppy_image_device *floppy, int stp, int old_st, int st) -{ - if (stp) return; - - int tracks = 0; - - switch (old_st) - { - case 6: if (st == 0xa) tracks++; else if (st == 5) tracks--; break; - case 5: if (st == 6) tracks++; else if (st == 9) tracks--; break; - case 9: if (st == 5) tracks++; else if (st == 0xa) tracks--; break; - case 0xa: if (st == 9) tracks++; else if (st == 6) tracks--; break; - } - - if (tracks == -1) - { - floppy->dir_w(1); - floppy->stp_w(1); - floppy->stp_w(0); - } - else if (tracks == 1) - { - floppy->dir_w(0); - floppy->stp_w(1); - floppy->stp_w(0); - } -} - -void victor_9000_fdc_t::update_spindle_motor(floppy_image_device *floppy, emu_timer *t_tach, bool start, bool stop, bool sel, UINT8 &da) -{ - if (start && !stop && floppy->mon_r()) { - if (LOG_SCP) logerror("%s: motor start\n", floppy->tag()); - floppy->mon_w(0); - } else if (stop && !floppy->mon_r()) { - if (LOG_SCP) logerror("%s: motor stop\n", floppy->tag()); - floppy->mon_w(1); - t_tach->reset(); - } - - if (sel) { - da = m_da; - if (!floppy->mon_r()) { - float tach = rpm[da] / 60 * SPINDLE_RATIO * MOTOR_POLES; - - if (LOG_SCP) logerror("%s: motor speed %u rpm / tach %0.1f hz (DA %02x)\n", floppy->tag(), rpm[da], (double) tach, da); - - t_tach->adjust(attotime::from_hz(tach*2), 0, attotime::from_hz(tach*2)); - floppy->set_rpm(rpm[da]); - } - } -} - -void victor_9000_fdc_t::set_rdy0(int state) -{ - //m_rdy0 = state; - //m_via5->write_ca2(m_rdy0); -} - -void victor_9000_fdc_t::set_rdy1(int state) -{ - //m_rdy1 = state; - //m_via5->write_cb2(m_rdy1); -} - - -//------------------------------------------------- -// da_w - -//------------------------------------------------- - -WRITE8_MEMBER( victor_9000_fdc_t::da_w ) -{ - if (LOG_SCP) logerror("%s %s DA %02x\n", machine().time().as_string(), machine().describe_context(), data); - - if (m_da != data) - { - live_sync(); - m_da = data; - update_spindle_motor(m_floppy0, t_tach0, m_start0, m_stop0, m_sel0, m_da0); - update_spindle_motor(m_floppy1, t_tach1, m_start1, m_stop1, m_sel1, m_da1); - checkpoint(); - live_run(); - } -} - -READ8_MEMBER( victor_9000_fdc_t::via4_pa_r ) -{ - /* - - bit description - - PA0 L0MS0 - PA1 L0MS1 - PA2 L0MS2 - PA3 L0MS3 - PA4 - PA5 - PA6 - PA7 - - */ - - return m_l0ms; -} - -WRITE8_MEMBER( victor_9000_fdc_t::via4_pa_w ) -{ - /* - - bit description - - PA0 L0MS0 - PA1 L0MS1 - PA2 L0MS2 - PA3 L0MS3 - PA4 ST0A - PA5 ST0B - PA6 ST0C - PA7 ST0D - - */ - - m_l0ms = data & 0x0f; - - { // HACK to bypass SCP - m_floppy0->mon_w((m_l0ms == 0xf) ? 1 : 0); - m_floppy0->set_rpm(victor9k_format::get_rpm(m_side, m_floppy0->get_cyl())); - m_rdy0 = (m_l0ms == 0xf) ? 0 : 1; - m_via5->write_ca2(m_rdy0); - } - - UINT8 st0 = data >> 4; - - if (LOG_VIA) logerror("%s %s L0MS %01x ST0 %01x\n", machine().time().as_string(), machine().describe_context(), m_l0ms, st0); - - if (m_st0 != st0) - { - live_sync(); - update_stepper_motor(m_floppy0, m_stp0, st0, m_st0); - m_st0 = st0; - checkpoint(); - live_run(); - } -} - -READ8_MEMBER( victor_9000_fdc_t::via4_pb_r ) -{ - /* - - bit description - - PB0 L1MS0 - PB1 L1MS1 - PB2 L1MS2 - PB3 L1MS3 - PB4 - PB5 - PB6 - PB7 - - */ - - return m_l1ms; -} - -WRITE8_MEMBER( victor_9000_fdc_t::via4_pb_w ) -{ - /* - - bit description - - PB0 L1MS0 - PB1 L1MS1 - PB2 L1MS2 - PB3 L1MS3 - PB4 ST1A - PB5 ST1B - PB6 ST1C - PB7 ST1D - - */ - - m_l1ms = data & 0x0f; - - { // HACK to bypass SCP - m_floppy1->mon_w((m_l1ms == 0xf) ? 1 : 0); - m_floppy1->set_rpm(victor9k_format::get_rpm(m_side, m_floppy1->get_cyl())); - m_rdy1 = (m_l1ms == 0xf) ? 0 : 1; - m_via5->write_cb2(m_rdy1); - } - - UINT8 st1 = data >> 4; - - if (LOG_VIA) logerror("%s %s L1MS %01x ST1 %01x\n", machine().time().as_string(), machine().describe_context(), m_l1ms, st1); - - if (m_st1 != st1) - { - live_sync(); - update_stepper_motor(m_floppy1, m_stp1, st1, m_st1); - m_st1 = st1; - checkpoint(); - live_run(); - } -} - -WRITE_LINE_MEMBER( victor_9000_fdc_t::wrsync_w ) -{ - if (m_wrsync != state) - { - live_sync(); - m_wrsync = state; - cur_live.wrsync = state; - checkpoint(); - if (LOG_VIA) logerror("%s %s WRSYNC %u\n", machine().time().as_string(), machine().describe_context(), state); - live_run(); - } -} - -WRITE_LINE_MEMBER( victor_9000_fdc_t::via4_irq_w ) -{ - m_via4_irq = state; - - m_irq_cb(m_via4_irq || m_via5_irq || m_via6_irq); -} - -READ8_MEMBER( victor_9000_fdc_t::via5_pa_r ) -{ - /* - - bit description - - PA0 E0 - PA1 E1 - PA2 I1 - PA3 E2 - PA4 E4 - PA5 E5 - PA6 I7 - PA7 E6 - - */ - - return GCR_DECODE(checkpoint_live.e, checkpoint_live.i); -} - -WRITE8_MEMBER( victor_9000_fdc_t::via5_pb_w ) -{ - /* - - bit description - - PB0 WD0 - PB1 WD1 - PB2 WD2 - PB3 WD3 - PB4 WD4 - PB5 WD5 - PB6 WD6 - PB7 WD7 - - */ - - if (LOG_VIA) logerror("%s %s WD %02x\n", machine().time().as_string(), machine().describe_context(), data); - - if (m_wd != data) - { - live_sync(); - m_wd = cur_live.wd = data; - checkpoint(); - live_run(); - } -} - -WRITE_LINE_MEMBER( victor_9000_fdc_t::via5_irq_w ) -{ - m_via5_irq = state; - - m_irq_cb(m_via4_irq || m_via5_irq || m_via6_irq); -} - - -READ8_MEMBER( victor_9000_fdc_t::via6_pa_r ) -{ - /* - - bit description - - PA0 - PA1 _TRK0D0 - PA2 - PA3 _TRK0D1 - PA4 - PA5 - PA6 WPS - PA7 _SYNC - - */ - - if (LOG_VIA) logerror("%s %s TRK0D0 %u TRK0D1 %u SYNC %u\n", machine().time().as_string(), machine().describe_context(), m_floppy0->trk00_r(), m_floppy1->trk00_r(), checkpoint_live.sync); - - UINT8 data = 0; - - // track 0 drive A sense - data |= m_floppy0->trk00_r() << 1; - - // track 0 drive B sense - data |= m_floppy1->trk00_r() << 3; - - // write protect sense - data |= (m_drive ? m_floppy1->wpt_r() : m_floppy0->wpt_r()) << 6; - - // disk sync detect - data |= checkpoint_live.sync << 7; - - return data; -} - -WRITE8_MEMBER( victor_9000_fdc_t::via6_pa_w ) -{ - /* - - bit description - - PA0 LED0A - PA1 - PA2 LED1A - PA3 - PA4 SIDE SELECT - PA5 DRIVE SELECT - PA6 - PA7 - - */ - - // LED, drive A - output_set_led_value(LED_A, BIT(data, 0)); - - // LED, drive B - output_set_led_value(LED_B, BIT(data, 2)); - - bool sync = false; - - // dual side select - int side = BIT(data, 4); - if (m_side != side) sync = true; - - // select drive A/B - int drive = BIT(data, 5); - if (m_drive != drive) sync = true; - - if (sync) - { - live_sync(); - - m_side = side; - cur_live.side = side; - m_floppy0->ss_w(side); - m_floppy1->ss_w(side); - - m_drive = drive; - cur_live.drive = drive; - - if (LOG_VIA) logerror("%s %s SIDE %u DRIVE %u\n", machine().time().as_string(), machine().describe_context(), side, drive); - - checkpoint(); - live_run(); - } -} - -READ8_MEMBER( victor_9000_fdc_t::via6_pb_r ) -{ - /* - - bit description - - PB0 RDY0 - PB1 RDY1 - PB2 - PB3 _DS1 - PB4 _DS0 - PB5 SINGLE/_DOUBLE SIDED - PB6 - PB7 - - */ - - UINT8 data = 0; - - // motor speed status, drive A - data |= m_rdy0; - - // motor speed status, drive B - data |= m_rdy1 << 1; - - // door B sense - data |= (m_floppy1->exists() ? 0 : 1) << 3; - - // door A sense - data |= (m_floppy0->exists() ? 0 : 1) << 4; - - // single/double sided jumper - //data |= 0x20; - - return data; -} - -WRITE8_MEMBER( victor_9000_fdc_t::via6_pb_w ) -{ - /* - - bit description - - PB0 RDY0 - PB1 RDY1 - PB2 _SCRESET - PB3 - PB4 - PB5 - PB6 STP0 - PB7 STP1 - - */ - - set_rdy0(BIT(data, 0)); - set_rdy1(BIT(data, 1)); - - // motor speed controller reset - if (!BIT(data, 2)) - m_maincpu->reset(); - - bool sync = false; - - // stepper enable A - int stp0 = BIT(data, 6); - if (m_stp0 != stp0) sync = true; - - // stepper enable B - int stp1 = BIT(data, 7); - if (m_stp1 != stp1) sync = true; - - if (sync) - { - live_sync(); - - m_stp0 = stp0; - update_stepper_motor(m_floppy0, m_stp0, m_st0, m_st0); - - m_stp1 = stp1; - update_stepper_motor(m_floppy1, m_stp1, m_st1, m_st1); - - if (LOG_VIA) logerror("%s %s STP0 %u STP1 %u\n", machine().time().as_string(), machine().describe_context(), stp0, stp1); - - checkpoint(); - live_run(); - } -} - -WRITE_LINE_MEMBER( victor_9000_fdc_t::drw_w ) -{ - if (m_drw != state) - { - live_sync(); - m_drw = cur_live.drw = state; - checkpoint(); - if (LOG_VIA) logerror("%s %s DRW %u\n", machine().time().as_string(), machine().describe_context(), state); - if (state) { - pll_stop_writing(get_floppy(), machine().time()); - } else { - pll_start_writing(machine().time()); - } - live_run(); - } -} - -WRITE_LINE_MEMBER( victor_9000_fdc_t::erase_w ) -{ - if (m_erase != state) - { - live_sync(); - m_erase = cur_live.erase = state; - checkpoint(); - if (LOG_VIA) logerror("%s %s ERASE %u\n", machine().time().as_string(), machine().describe_context(), state); - live_run(); - } -} - -WRITE_LINE_MEMBER( victor_9000_fdc_t::via6_irq_w ) -{ - m_via6_irq = state; - - m_irq_cb(m_via4_irq || m_via5_irq || m_via6_irq); -} - -READ8_MEMBER( victor_9000_fdc_t::cs7_r ) -{ - m_lbrdy_cb(1); - - if (LOG_VIA) logerror("%s %s LBRDY 1 : %02x\n", machine().time().as_string(), machine().describe_context(), m_via5->read(space, offset)); - - return m_via5->read(space, offset); -} - -WRITE8_MEMBER( victor_9000_fdc_t::cs7_w ) -{ - m_lbrdy_cb(1); - - if (LOG_VIA) logerror("%s %s LBRDY 1\n", machine().time().as_string(), machine().describe_context()); - - m_via5->write(space, offset, data); -} - -floppy_image_device* victor_9000_fdc_t::get_floppy() -{ - return m_drive ? m_floppy1 : m_floppy0; -} - -void victor_9000_fdc_t::live_start() -{ - cur_live.tm = machine().time(); - cur_live.state = RUNNING; - cur_live.next_state = -1; - - cur_live.shift_reg = 0; - cur_live.shift_reg_write = 0; - cur_live.bit_counter = 0; - cur_live.sync_bit_counter = 0; - cur_live.sync_byte_counter = 0; - - cur_live.drive = m_drive; - cur_live.side = m_side; - cur_live.drw = m_drw; - cur_live.wd = m_wd; - cur_live.wrsync = m_wrsync; - cur_live.erase = m_erase; - - pll_reset(cur_live.tm); - checkpoint_live = cur_live; - pll_save_checkpoint(); - - live_run(); -} - -void victor_9000_fdc_t::pll_reset(const attotime &when) -{ - cur_pll.reset(when); - cur_pll.set_clock(attotime::from_nsec(2130)); -} - -void victor_9000_fdc_t::pll_start_writing(const attotime &tm) -{ - cur_pll.start_writing(tm); - pll_reset(cur_live.tm); -} - -void victor_9000_fdc_t::pll_commit(floppy_image_device *floppy, const attotime &tm) -{ - cur_pll.commit(floppy, tm); -} - -void victor_9000_fdc_t::pll_stop_writing(floppy_image_device *floppy, const attotime &tm) -{ - cur_pll.stop_writing(floppy, tm); - pll_reset(cur_live.tm); -} - -void victor_9000_fdc_t::pll_save_checkpoint() -{ - checkpoint_pll = cur_pll; -} - -void victor_9000_fdc_t::pll_retrieve_checkpoint() -{ - cur_pll = checkpoint_pll; -} - -int victor_9000_fdc_t::pll_get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit) -{ - return cur_pll.get_next_bit(tm, floppy, limit); -} - -bool victor_9000_fdc_t::pll_write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit) -{ - return cur_pll.write_next_bit(bit, tm, floppy, limit); -} - -void victor_9000_fdc_t::checkpoint() -{ - pll_commit(get_floppy(), cur_live.tm); - checkpoint_live = cur_live; - pll_save_checkpoint(); -} - -void victor_9000_fdc_t::rollback() -{ - cur_live = checkpoint_live; - pll_retrieve_checkpoint(); -} - -void victor_9000_fdc_t::live_delay(int state) -{ - cur_live.next_state = state; - if(cur_live.tm != machine().time()) - t_gen->adjust(cur_live.tm - machine().time()); - else - live_sync(); -} - -void victor_9000_fdc_t::live_sync() -{ - if(!cur_live.tm.is_never()) { - if(cur_live.tm > machine().time()) { - rollback(); - live_run(machine().time()); - pll_commit(get_floppy(), cur_live.tm); - } else { - pll_commit(get_floppy(), cur_live.tm); - if(cur_live.next_state != -1) { - cur_live.state = cur_live.next_state; - cur_live.next_state = -1; - } - if(cur_live.state == IDLE) { - pll_stop_writing(get_floppy(), cur_live.tm); - cur_live.tm = attotime::never; - } - } - cur_live.next_state = -1; - checkpoint(); - } -} - -void victor_9000_fdc_t::live_abort() -{ - if(!cur_live.tm.is_never() && cur_live.tm > machine().time()) { - rollback(); - live_run(machine().time()); - } - - pll_stop_writing(get_floppy(), cur_live.tm); - - cur_live.tm = attotime::never; - cur_live.state = IDLE; - cur_live.next_state = -1; - - cur_live.brdy = 1; - cur_live.lbrdy_changed = true; - cur_live.sync = 1; - cur_live.syn = 1; - cur_live.syn_changed = true; - cur_live.gcr_err = 1; -} - -void victor_9000_fdc_t::live_run(const attotime &limit) -{ - if(cur_live.state == IDLE || cur_live.next_state != -1) - return; - - for(;;) { - switch(cur_live.state) { - case RUNNING: { - bool syncpoint = false; - - if (cur_live.tm > limit) - return; - - // read bit - int bit = 0; - if (cur_live.drw) { - bit = pll_get_next_bit(cur_live.tm, get_floppy(), limit); - if(bit < 0) - return; - } - - // write bit - int write_bit = 0; - if (!cur_live.drw) { // TODO WPS - write_bit = BIT(cur_live.shift_reg_write, 9); - if (pll_write_next_bit(write_bit, cur_live.tm, get_floppy(), limit)) - return; - } - - // clock read shift register - cur_live.shift_reg <<= 1; - cur_live.shift_reg |= bit; - cur_live.shift_reg &= 0x3ff; - - // sync - int sync = !(cur_live.shift_reg == 0x3ff); - - // bit counter - if (cur_live.drw) { - if (!sync) { - cur_live.bit_counter = 0; - } else if (cur_live.sync) { - cur_live.bit_counter++; - if (cur_live.bit_counter == 10) { - cur_live.bit_counter = 0; - } - } - } else { - cur_live.bit_counter++; - if (cur_live.bit_counter == 10) { - cur_live.bit_counter = 0; - } - } - - // sync counter - if (sync) { - cur_live.sync_bit_counter = 0; - cur_live.sync_byte_counter = 10; // TODO 9 in schematics - } else if (!cur_live.sync) { - cur_live.sync_bit_counter++; - if (cur_live.sync_bit_counter == 10) { - cur_live.sync_bit_counter = 0; - cur_live.sync_byte_counter++; - if (cur_live.sync_byte_counter == 16) { - cur_live.sync_byte_counter = 0; - } - } - } - - // syn - int syn = !(cur_live.sync_byte_counter == 15); - - // GCR decoder - if (cur_live.drw) { - cur_live.i = cur_live.drw << 10 | cur_live.shift_reg; - } else { - cur_live.i = cur_live.drw << 10 | 0x200 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f); - } - - cur_live.e = m_gcr_rom->base()[cur_live.i]; - - attotime next = cur_live.tm + m_period; - if (LOG) logerror("%s:%s cyl %u bit %u sync %u bc %u sr %03x sbc %u sBC %u syn %u i %03x e %02x\n",cur_live.tm.as_string(),next.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.sync_bit_counter,cur_live.sync_byte_counter,syn,cur_live.i,cur_live.e); - - // byte ready - int brdy = !(cur_live.bit_counter == 9); - - // GCR error - int gcr_err = !(brdy || BIT(cur_live.e, 3)); - - if (LOG_BITS) { - if (cur_live.drw) { - logerror("%s cyl %u bit %u sync %u bc %u sr %03x i %03x e %02x\n",cur_live.tm.as_string(),get_floppy()->get_cyl(),bit,sync,cur_live.bit_counter,cur_live.shift_reg,cur_live.i,cur_live.e); - } else { - logerror("%s cyl %u writing bit %u bc %u sr %03x i %03x e %02x\n",cur_live.tm.as_string(),get_floppy()->get_cyl(),write_bit,cur_live.bit_counter,cur_live.shift_reg_write,cur_live.i,cur_live.e); - } - } - - if (!brdy) { - // load write shift register - cur_live.shift_reg_write = GCR_ENCODE(cur_live.e, cur_live.i); - - if (LOG) logerror("%s load write shift register %03x\n",cur_live.tm.as_string(),cur_live.shift_reg_write); - } else { - // clock write shift register - cur_live.shift_reg_write <<= 1; - cur_live.shift_reg_write &= 0x3ff; - } - - if (brdy != cur_live.brdy) { - if (LOG) logerror("%s BRDY %u\n", cur_live.tm.as_string(),brdy); - if (!brdy) - { - cur_live.lbrdy_changed = true; - if (LOG_VIA) logerror("%s LBRDY 0 : %02x\n", cur_live.tm.as_string(), GCR_DECODE(cur_live.e, cur_live.i)); - } - cur_live.brdy = brdy; - syncpoint = true; - } - - if (sync != cur_live.sync) { - if (LOG) logerror("%s SYNC %u\n", cur_live.tm.as_string(),sync); - cur_live.sync = sync; - syncpoint = true; - } - - if (syn != cur_live.syn) { - if (LOG) logerror("%s SYN %u\n", cur_live.tm.as_string(),syn); - cur_live.syn = syn; - cur_live.syn_changed = true; - syncpoint = true; - } - - if (gcr_err != cur_live.gcr_err) { - if (LOG) logerror("%s GCR ERR %u\n", cur_live.tm.as_string(),gcr_err); - cur_live.gcr_err = gcr_err; - syncpoint = true; - } - - if (syncpoint) { - live_delay(RUNNING_SYNCPOINT); - return; - } - break; - } - - case RUNNING_SYNCPOINT: { - if (cur_live.lbrdy_changed) { - m_lbrdy_cb(0); - cur_live.lbrdy_changed = false; - } - - if (cur_live.syn_changed) { - m_syn_cb(cur_live.syn); - cur_live.syn_changed = false; - } - - m_via5->write_ca1(cur_live.brdy); - - cur_live.state = RUNNING; - checkpoint(); - break; - } - } - } -} diff --git a/src/mess/machine/victor9k_fdc.h b/src/mess/machine/victor9k_fdc.h deleted file mode 100644 index 21c88ebfabf..00000000000 --- a/src/mess/machine/victor9k_fdc.h +++ /dev/null @@ -1,241 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Victor 9000 floppy disk controller emulation - -**********************************************************************/ - -#pragma once - -#ifndef __VICTOR_9000_FDC__ -#define __VICTOR_9000_FDC__ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" -#include "formats/victor9k_dsk.h" -#include "imagedev/floppy.h" -#include "machine/6522via.h" -#include "machine/fdc_pll.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VICTOR_9000_FDC_IRQ_CB(_write) \ - devcb = &victor_9000_fdc_t::set_irq_wr_callback(*device, DEVCB_##_write); - -#define MCFG_VICTOR_9000_FDC_SYN_CB(_write) \ - devcb = &victor_9000_fdc_t::set_syn_wr_callback(*device, DEVCB_##_write); - -#define MCFG_VICTOR_9000_FDC_LBRDY_CB(_write) \ - devcb = &victor_9000_fdc_t::set_lbrdy_wr_callback(*device, DEVCB_##_write); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> victor_9000_fdc_t - -class victor_9000_fdc_t : public device_t -{ -public: - // construction/destruction - victor_9000_fdc_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_irq_cb.set_callback(object); } - template static devcb_base &set_syn_wr_callback(device_t &device, _Object object) { return downcast(device).m_syn_cb.set_callback(object); } - template static devcb_base &set_lbrdy_wr_callback(device_t &device, _Object object) { return downcast(device).m_lbrdy_cb.set_callback(object); } - - DECLARE_READ8_MEMBER( cs5_r ) { return m_via4->read(space, offset); } - DECLARE_WRITE8_MEMBER( cs5_w ) { m_via4->write(space, offset, data); } - DECLARE_READ8_MEMBER( cs6_r ) { return m_via6->read(space, offset); } - DECLARE_WRITE8_MEMBER( cs6_w ) { m_via6->write(space, offset, data); } - DECLARE_READ8_MEMBER( cs7_r ); - DECLARE_WRITE8_MEMBER( cs7_w ); - - DECLARE_FLOPPY_FORMATS( floppy_formats ); - - DECLARE_READ8_MEMBER( floppy_p1_r ); - DECLARE_WRITE8_MEMBER( floppy_p1_w ); - DECLARE_READ8_MEMBER( floppy_p2_r ); - DECLARE_WRITE8_MEMBER( floppy_p2_w ); - DECLARE_READ8_MEMBER( tach0_r ); - DECLARE_READ8_MEMBER( tach1_r ); - DECLARE_WRITE8_MEMBER( da_w ); - - DECLARE_READ8_MEMBER( via4_pa_r ); - DECLARE_WRITE8_MEMBER( via4_pa_w ); - DECLARE_READ8_MEMBER( via4_pb_r ); - DECLARE_WRITE8_MEMBER( via4_pb_w ); - DECLARE_WRITE_LINE_MEMBER( wrsync_w ); - DECLARE_WRITE_LINE_MEMBER( via4_irq_w ); - - DECLARE_READ8_MEMBER( via5_pa_r ); - DECLARE_WRITE8_MEMBER( via5_pb_w ); - DECLARE_WRITE_LINE_MEMBER( via5_irq_w ); - - DECLARE_READ8_MEMBER( via6_pa_r ); - DECLARE_READ8_MEMBER( via6_pb_r ); - DECLARE_WRITE8_MEMBER( via6_pa_w ); - DECLARE_WRITE8_MEMBER( via6_pb_w ); - DECLARE_WRITE_LINE_MEMBER( drw_w ); - DECLARE_WRITE_LINE_MEMBER( erase_w ); - DECLARE_WRITE_LINE_MEMBER( via6_irq_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - -private: - static const int rpm[0x100]; - - enum - { - TM_GEN, - TM_TACH0, - TM_TACH1 - }; - - enum - { - LED_A = 0, - LED_B - }; - - enum { - IDLE, - RUNNING, - RUNNING_SYNCPOINT - }; - - struct live_info { - attotime tm; - int state, next_state; - - int drive; - int side; - int drw; - - // common - offs_t i; - UINT8 e; - - // read - UINT16 shift_reg; - int bit_counter; - int sync_bit_counter; - int sync_byte_counter; - int brdy; - bool lbrdy_changed; - int sync; - int syn; - bool syn_changed; - int gcr_err; - - // write - UINT16 shift_reg_write; - UINT8 wd; - int wrsync; - int gcr_data; - int erase; - }; - - devcb_write_line m_irq_cb; - devcb_write_line m_syn_cb; - devcb_write_line m_lbrdy_cb; - - required_device m_maincpu; - required_device m_via4; - required_device m_via5; - required_device m_via6; - required_device m_floppy0; - required_device m_floppy1; - required_memory_region m_gcr_rom; - - void update_stepper_motor(floppy_image_device *floppy, int stp, int old_st, int st); - void update_spindle_motor(floppy_image_device *floppy, emu_timer *t_tach, bool start, bool stop, bool sel, UINT8 &da); - void set_rdy0(int state); - void set_rdy1(int state); - - int load0_cb(floppy_image_device *device); - void unload0_cb(floppy_image_device *device); - - int load1_cb(floppy_image_device *device); - void unload1_cb(floppy_image_device *device); - - UINT8 m_p2; - - /* floppy state */ - UINT8 m_da; - UINT8 m_da0; - UINT8 m_da1; - int m_start0; - int m_stop0; - int m_start1; - int m_stop1; - int m_sel0; - int m_sel1; - int m_tach0; - int m_tach1; - int m_rdy0; - int m_rdy1; - UINT8 m_l0ms; - UINT8 m_l1ms; - int m_st0; - int m_st1; - int m_stp0; - int m_stp1; - int m_drive; - int m_side; - int m_drw; - int m_erase; - UINT8 m_wd; - int m_wrsync; - - int m_via4_irq; - int m_via5_irq; - int m_via6_irq; - - attotime m_period; - - live_info cur_live, checkpoint_live; - fdc_pll_t cur_pll, checkpoint_pll; - emu_timer *t_gen, *t_tach0, *t_tach1; - - floppy_image_device* get_floppy(); - void live_start(); - void pll_reset(const attotime &when); - void pll_start_writing(const attotime &tm); - void pll_commit(floppy_image_device *floppy, const attotime &tm); - void pll_stop_writing(floppy_image_device *floppy, const attotime &tm); - int pll_get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit); - bool pll_write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit); - void pll_save_checkpoint(); - void pll_retrieve_checkpoint(); - void checkpoint(); - void rollback(); - void live_delay(int state); - void live_sync(); - void live_abort(); - void live_run(const attotime &limit = attotime::never); -}; - - - -// device type definition -extern const device_type VICTOR_9000_FDC; - - - -#endif diff --git a/src/mess/machine/victor9kb.c b/src/mess/machine/victor9kb.c deleted file mode 100644 index a0cf21bfe36..00000000000 --- a/src/mess/machine/victor9kb.c +++ /dev/null @@ -1,712 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Victor 9000 keyboard emulation - -*********************************************************************/ - -/* - -Keyboard PCB Layout ----------- - -Marking on PCB back: A65-02307-201D 007 - -|------------------------------------------------------------------------------------| -| 22-908-03 22-950-3B XTAL 8021 74LS14 [804x] [EPROM] [???] L CN1=___ -| X X X X X X X X X X X | -| X X X X X X X X X X X X X X X X X X X X X | -| X X X X X X X X X X X X X X X X X X X X X | -| X X X X X X X X X X X X X X X X X X X X X | -| X X X X X X X X X X X X X X X X X X X X | -| X X marking X X X X X X X X | -|----------------------------------------------------------------------------------------| - - -Notes: - All IC's shown. - XTAL - 3.579545Mhz Crystal, marked "48-300-010" (front of xtal) and "3.579545Mhz" (back of xtal) - 74LS14 - Z4 - 74LS14 Hex inverter with Schmitt-trigger inputs (0.8v hysteresis) - 8021 - Z3 - Intel 8021 MCU, marked: "P8021 2137 // 8227 // 20-8021-139 // (C) INTEL 77" - 22-908-03 - Z2 - Exar Semiconductor XR22-008-03 keyboard matrix capacitive readout latch - 22-950-3B - Z1 - Exar Semiconductor XR22-050-3B keyboard matrix row driver with 4 to 12 decoder/demultiplexer - CN1 or J1 - J1 - keyboard data connector (SIP, 7 pins, right angle) - L - L1 & L2 - mil-spec 22uH 10% inductors (double wide silver band(mil spec), red(2) red(2) black(x1uH) silver(10%)) - - [804x] - unpopulated space for a 40 pin 804x or 803x MCU - [EPROM] - unpopulated space for an EPROM, if a ROMless 803x MCU was used - [???] - unpopulated space for an unknown NDIP10 IC or DIP-switch array - X - capacitive sensor pad for one key - marking - PCB trace marking: "KTC // A65-02307-007 // PCB 201 D" - -74LS14 (Hex inverter with Schmitt-trigger inputs (0.8v hysteresis)) ------------------- - __ __ - 1A 1 |* \_/ | 14 VCC - /1Y 2 | | 13 6A - 2A 3 | | 12 /6Y - /2Y 4 | | 11 5A - 3A 5 | 74LS14| 10 /5Y - /3Y 6 | | 9 4A - GND 7 |_______| 8 /4Y - - -P8021 Pinout ------------------- - _____ _____ - P22 1 |* \_/ | 28 VCC - P23 2 | | 27 P21 - PROG 3 | | 26 P20 - P00 4 | | 25 P17 - P01 5 | P8021 | 24 P16 - P02 6 | | 23 P15 - P03 7 | | 22 P14 - P04 8 | | 21 P13 - P05 9 | | 20 P12 - P06 10 | | 19 P11 - P07 11 | | 18 P10 - ALE 12 | | 17 RESET - T1 13 | | 16 XTAL 2 - VSS 14 |_____________| 15 XTAL 1 - - -XR22-008-03 Pinout (AKA XR22-908-03) ------------------- - _____ _____ - D0 1 |* \_/ | 20 Vcc - D1 2 | | 19 _CLR - D2 3 | | 18 Q0 - D3 4 | | 17 Q1 - HYS 5 | 22-008-03 | 16 Q2 - D4 6 | | 15 Q3 - D5 7 | | 14 Q4 - D6 8 | | 13 Q5 - D7 9 | | 12 Q6 - GND 10 |_____________| 11 Q7 - - -XR22-050-3B Pinout (AKA XR22-950-3B) ------------------- - _____ _____ - Y8 1 |* \_/ | 20 Vcc - Y9 2 | | 19 Y7 - Y10 3 | | 18 Y6 - Y11 4 | | 17 Y5 - _STB 5 | 22-050-3B | 16 Y4 - A0 6 | | 15 Y3 - A1 7 | | 14 Y2 - A2 8 | | 13 Y1 - A3 9 | | 12 Y0 - GND 10 |_____________| 11 OE? - -i8021 to elsewhere connections ------------------------------- -8021 pin - 22-xxx pin - P22 1 - 74LS14 pin 5 (3A) AND (804x chip pin 37, P26) - P23 2 - 74LS14 pin 11 (5A) AND (804x chip pin 38, P27) - PROG 3 - (804x chip pin 25, PROG) - P00 4 - N/C - P01 5 - N/C - P02 6 - N/C - P03 7 - N/C - P04 8 - N/C - P05 9 - N/C - P06 10 - N/C - P07 11 - N/C - ALE 12 - N/C - T1 13 - 74LS14 pin 2 (/1Y) AND (804x chip pin 39, T1) - VSS 14 - GND -XTAL1 15 - XTAL -XTAL2 16 - XTAL -RESET 17 - 10uf capacitor - VCC - P10 18 - 22-908 pin 18 (Q0) AND 22-950 pin 6 (A0) AND (804x chip pin 27, P10) - P11 19 - 22-908 pin 17 (Q1) AND 22-950 pin 7 (A1) AND (804x chip pin 28, P11) - P12 20 - 22-908 pin 16 (Q2) AND 22-950 pin 8 (A2) AND (804x chip pin 29, P12) - P13 21 - 22-908 pin 15 (Q3) AND 22-950 pin 9 (A3) AND (804x chip pin 30, P13) - P14 22 - 22-908 pin 14 (Q4) AND (804x chip pin 31, P14) - P15 23 - 22-908 pin 13 (Q5) AND (804x chip pin 32, P15) - P16 24 - 22-908 pin 12 (Q6) AND (804x chip pin 33, P16) - P17 25 - 22-908 pin 11 (Q7) AND (804x chip pin 34, P17) - P20 26 - 22-908 pin 19 (/CLR) AND 22-950 pin 5 (/STB) AND (804x chip pin 35, P24) - P21 27 - 74LS14 pin 9 (4A) AND (804x chip pin 36, P25) - VCC 28 - VCC - -74LS14 to elsewhere connections -------------------------------- - 1A 1 - 100 Ohm resistor - J1 pin 4 - /1Y 2 - 8021 pin 13 (T1) - 2A 3 - 74LS14 pin 8 - /2Y 4 - 22uH 10% inductor 'L1' - J1 pin 5 - 3A 5 - 8021 pin 1 (P22) - /3Y 6 - many keyboard contact pads (!) - GND 7 - GND - /4Y 8 - 74LS14 pin 3 - 4A 9 - 8021 pin 27 (P21) - /5Y 10 - 74LS14 pin 13 - 5A 11 - 8021 pin 2 (P23) - /6Y 12 - 22uH 10% inductor 'L2' - J1 pin 6 - 6A 13 - 74LS14 pin 10 - VCC 14 - VCC - - -J1 (aka CN1) connections: -------------------------- -1 - VCC -2 - GND -3 - GND -4 - 100 Ohm 5% resistor -> 74LS14 pin 1 -> inverted 74LS14 pin 2 -> inverted 8021 pin 13 (T1) -5 - 22uH 10% inductor 'L1' <- 74LS14 pin 4 <- inverted 74LS14 pin 3 <- inverted 74LS14 pin 8 <- 74LS14 pin 9 <- 8021 pin 27 (P21) -6 - 22uH 10% inductor 'L2' <- 74LS14 pin 12 <- inverted 74LS14 pin 13 <- inverted 74LS14 pin 10 <- 74LS14 pin 11 <- 8021 pin 2 (P23) -7 - VCC - -Pins 5,and 6 also have a .0047uF capacitor to GND (forming some sort of LC filter) -There is another .0047uF capacitor to ground from the connection between 74LS14 pin 1 and the 100 Ohm 5% resistor which connects to pin 4 (forming some sort of RC filter) - -Exar Custom connections between each other: -------------------------------------------- -22-950 pin 11 (OE?) - 68KOhm 5% resistor - 22-908 pin 5 (HYS) - -Cable connecting J1/CN1 to the Victor: --------------------------------------- -RJ45 when looking at end of plug (not socket!) -.||||||||. -|87654321| -|__----__| - |__| - -RJ45 pins Wire Color Connection -1 White J1 pin 1 (VCC) -2 Yellow J1 pin 2 (GND) -3 Green J1 pin 3 (GND) -4 Orange J1 pin 4 (?KBACK?) -5 Blue J1 pin 5 (?KBRDY?) -6 Red J1 pin 6 (?KBDATA?) -7 Black J1 pin 7 (VCC) -8 shield/bare Keyboard Frame Ground - - -Key Layout (USA Variant): (the S0x markings appear on the back of the PCB) -|------------------------------------------------------------------------------------| -| 22-908-03 22-950-3B XTAL 8021 74LS14 [804x] [EPROM] [???] L CN1=___ -| 01 02 03 04 05 06 07 08 09 10 11 | -| 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | -| 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | -| 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | -| 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | -| 95 96 marking 97 98 99 100 101 102 103 104| -|----------------------------------------------------------------------------------------| - - key - Shifted(top)/Unshifted(bottom)/Alt(front) (if no slashes in description assume key has just one symbol on it) - S01 - [1] - S02 - [2] - S03 - [3] - S04 - [4] - S05 - [5] - S06 - [6] - S07 - [7] - S08 - [8] - S09 - UNUSED (under the [8] key, no metal contact on key) - S10 - [9] - S11 - [10] - - S12 - CLR/HOME - S13 - (Degree symbol U+00B0)/(+- symbol U+00B1)/(Pi symbol U+03C0) - S14 - !/1/| - S15 - @/2/< - S16 - #/3/> - S17 - $/4/(centered closed dot U+00B7) - S18 - %/5/(up arrow symbol U+2191) - S19 - (cent symbol U+00A2)/6/(logical not symbol U+00AC) - S20 - &/7/^ - S21 - * /8/` - S22 - (/9/{ - S23 - )/0/} - S24 - _/-/~ - S25 - +/=/\ - S26 - BACKSPACE - S27 - INS - S28 - DEL - S29 - MODE CALC/= (white keypad key) - S30 - % (white keypad key) - S31 - (division symbol U+00F7) (white keypad key) - S32 - (multiplication symbol U+00D7) (white keypad key) - - S33 - (up arrow, SCRL, down arrow)//VTAB - S34 - TAB//BACK - S35 - Q - S36 - W - S37 - E - S38 - R - S39 - T - S40 - Y - S41 - U - S42 - I - S43 - O - S44 - P - S45 - (1/4 symbol U+00BC)/(1/2 symbol U+00BD) - S46 - [/] - S47 - UNUSED (under the RETURN key, no metal contact on key) - S48 - ERASE/EOL - S49 - REQ/CAN - S50 - 7 (white keypad key) - S51 - 8 (white keypad key) - S52 - 9 (white keypad key) - S53 - - (white keypad key) - - S54 - (OFF,RVS,ON)//ESC - S55 - LOCK//CAPS LOCK - S56 - A - S57 - S - S58 - D - S59 - F - S60 - G - S61 - H - S62 - J - S63 - K - S64 - L - S65 - :/; - S66 - "/' - S67 - UNUSED (under the RETURN key, no metal contact on key) - S68 - RETURN - S69 - WORD/(left arrow U+2190)/(volume up U+1F508 plus U+25B4) (i.e. 'Previous Word') - S70 - WORD/(right arrow U+2192)/(volume down U+1F508 plus U+25BE) (i.e. 'Next Word') - S71 - 4 (white keypad key) - S72 - 5 (white keypad key) - S73 - 6 (white keypad key) - S74 - + (white keypad key) - - S75 - (OFF,UNDL,ON) - S76 - SHIFT (left shift) - S77 - UNUSED (under the left SHIFT key, no metal contact on key) - S78 - Z - S79 - X - S80 - C - S81 - V - S82 - B - S83 - N - S84 - M - S85 - ,/, (yes, both are comma) - S86 - ./. (yes, both are period/fullstop) - S87 - ?// (this is the actual / key) - S88 - SHIFT (right shift) - S89 - (up arrow U+2191)//(brightness up U+263C plus U+25B4) - S90 - (down arrow U+2193)//(brightness down U+263C plus U+25BE) - S91 - 1 (white keypad key) - S92 - 2 (white keypad key) - S93 - 3 (white keypad key) - S94 - ENTER (white keypad key) - - S95 - RPT - S96 - ALT - S97 - (spacebar) - S98 - PAUSE/CONT - S99 - (left arrow U+2190)//(contrast up U+25D0 plus U+25B4) (U+1F313 can be used in place of U+25D0) - S100 - (right arrow U+2192)//(contrast down U+25D0 plus U+25BE) '' - S101 - 0 (white keypad key) - S102 - 00 (white keypad key) ('double zero') - S103 - . (white keypad key) - S104 - UNUSED (under the ENTER (keypad) key, no metal contact on key) - - Note that the five unused key contacts: - S09, S47, S67, S77 and S104 - may be used on international variants of the Victor 9000/Sirius 1 Keyboard. - -Keyboard Matrix ---------------- -Row select -| Columns Sxxx by bit Columns Key by bit -| D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 -V V V V V V V V V V V V V V V V V -Y0 12 13 33 34 54 55 75 76 CLRH DEGR SCRL TAB RVS LOCK UNDL LSHFT -Y1 14 15 35 36 56 57 77 78 1 2 Q W A S N/A Z -Y2 16 17 37 38 58 59 79 80 3 4 E R D F X C -Y3 18 19 39 40 60 61 81 82 5 6 T Y G H V B -Y4 20 21 41 42 62 63 83 84 7 8 U I J K N M -Y5 22 23 43 44 64 65 85 86 9 0 O P L ; , . -Y6 24 25 45 46 66 67 87 88 - = 1/2 [] ' N/A ? RSHFT -Y7 26 27 47 48 68 69 89 90 BKSP INS N/A ERSE RETN WRDL UP DOWN -Y8 28 29 49 50 70 71 91 92 DEL MODE REQ k7 WRDR k4 k1 k2 -Y9 30 31 51 52 72 73 93 94 k% kDIV k8 k9 k5 k6 k3 kENTR -Y10 32 11 53 10 74 09 07 06 kMUL [10] k- [9] k+ N/A [7] [6] -Y11 104 103 102 101 100 99 98 97 kN/A k. k00 k0 RGHT LEFT PAUS SPACE -/3Y 05 04 03 02 01 08 95 96 [5] [4] [3] [2] [1] [8] RPT ALT - -*/ - -#include "victor9kb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8021_TAG "z3" - -#define LOG 0 - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type VICTOR9K_KEYBOARD = &device_creator; - - -//------------------------------------------------- -// ROM( victor9k_keyboard ) -//------------------------------------------------- - -ROM_START( victor9k_keyboard ) - ROM_REGION( 0x400, I8021_TAG, 0) - ROM_LOAD( "20-8021-139.z3", 0x000, 0x400, CRC(0fe9d53d) SHA1(61d92ba90f98f8978bbd9303c1ac3134cde8cdcb) ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *victor_9000_keyboard_t::device_rom_region() const -{ - return ROM_NAME( victor9k_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( kb_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( victor9k_keyboard_io, AS_IO, 8, victor_9000_keyboard_t ) - // P0 is unconnected on pcb - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) - AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(kb_t1_r) -ADDRESS_MAP_END - - -//------------------------------------------------- -// MACHINE_DRIVER( victor9k_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( victor9k_keyboard ) - MCFG_CPU_ADD(I8021_TAG, I8021, XTAL_3_579545MHz) - MCFG_CPU_IO_MAP(victor9k_keyboard_io) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor victor_9000_keyboard_t::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( victor9k_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( victor9k_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( victor9k_keyboard ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR/HOME") PORT_CODE(KEYCODE_HOME) // S12 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_PLUSMINUS" " UTF8_DEGREES" " UTF8_SMALL_PI) PORT_CODE(KEYCODE_TILDE) // +-, degree, pi // S13 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP" SCRL " UTF8_DOWN) PORT_CODE(KEYCODE_SCRLOCK) // unicode arrows // S33 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB/BACK") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) // S34 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RVS On-Off/ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) // S54 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK/CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) // S55 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNDL On-Off") PORT_CODE(KEYCODE_PRTSCR) // need better key code // S75 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // S76 - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1 ! |") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR('|') // S14 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2 @ <") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR('<') // S15 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // S35 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // S36 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // S56 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // S57 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S75") // unused // S75 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // S76 - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3 # >") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR('>') // S16 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4 $ \xc2\xb7") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // centered closed dot U+00B7 // S17 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // S37 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // S38 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // S58 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // S59 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // S79 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // S80 - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5 % " UTF8_UP) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // S18 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 \xc2\xa2 \xc2\xac") PORT_CODE(KEYCODE_6) PORT_CHAR('6') // cent U+00A2, logic not U+00AC // S19 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // S39 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // S40 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // S60 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // S61 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // S81 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // S82 - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7 & ^") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR('^') // S20 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8 * `") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR('`') // S21 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // S41 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // S42 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // S62 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // S63 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // S83 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // S84 - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9 ( {") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('{') // S22 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 ) }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR('}') // S23 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // S43 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // S44 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // S64 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') // S65 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') // S85 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') // S86 - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _ ~") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHAR('~') // S24 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= + \\") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('\\') // S25 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xbd \xc2\xbc") PORT_CODE(KEYCODE_OPENBRACE) // unicode half fraction U+00BD / quarter fraction U+00BC // S45 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR(']') // S46 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') // S66 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S67") // unused // S67 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // S87 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // S88 - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // S26 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) // S27 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S47") // unused // S47 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ERASE/EOL") PORT_CODE(KEYCODE_END) // should this be mapped to end or del? // S48 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // S68 - //PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_LEFT"/Volume Up \xf0\x9f\x94\x88\xe2\x96\xb4") PORT_CODE(KEYCODE_PGUP) // unicode U+2190/U+1F508 + U+25B4 // S69 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_LEFT"/Volume Up") PORT_CODE(KEYCODE_PGUP) // unicode U+2190/U+1F508 + U+25B4 // S69 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP"/Brightness Up \xe2\x98\xbc\xe2\x96\xb4") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // U+2191/U+263C + U+25B4 // S89 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN"/Brightness Down \xe2\x98\xbc\xe2\x96\xbe") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // U+2193/U+263C + U+25BE // S90 - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(127) // S28 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad MODE CALC/=") PORT_CODE(KEYCODE_NUMLOCK) // S29 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REQ/CAN") PORT_CODE(KEYCODE_BACKSLASH) // is this a good key for this? does sysrq make more sense? // S49 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) // S50 - //PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_RIGHT"/Volume Down \xf0\x9f\x94\x88\xe2\x96\xbe") PORT_CODE(KEYCODE_PGDN) // unicode U+2192/U+1F508 + U+25B4 // S70 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Word " UTF8_RIGHT"/Volume Down") PORT_CODE(KEYCODE_PGDN) // unicode U+2192/U+1F508 + U+25B4 // S70 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) // S71 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) // S91 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) // S92 - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad %") // find a good key for this // S30 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_DIVIDE) PORT_CODE(KEYCODE_SLASH_PAD) // unicode division sign U+00F7 // S31 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) // S51 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) // S52 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) // S72 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) // S73 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) // S93 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) // S94 - - PORT_START("YA") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad " UTF8_MULTIPLY) PORT_CODE(KEYCODE_ASTERISK) // unicode multiply sign U+00D7 // S32 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 [10]") PORT_CODE(KEYCODE_F10) // S11 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) // S53 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 [9]") PORT_CODE(KEYCODE_F9) // S10 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) // S74 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S09") // unused // S09 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 [7]") PORT_CODE(KEYCODE_F7) // S07 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 [6]") PORT_CODE(KEYCODE_F6) // S06 - - PORT_START("YB") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S04") // unused // S104 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) // S103 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 00") // S102 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) // S101 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT"/Contrast Down \xe2\x97\x90\xe2\x96\xbe") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // U+2190/U+25D0 + U+25BE S100 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT"/Contrast Up \xe2\x97\x90\xe2\x96\xb4") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // U+2190/U+25D0 + U+25B4 S99 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAUSE/CONT") PORT_CODE(KEYCODE_PAUSE) // S98 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Spacebar") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // S97 - - PORT_START("YC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 [5]") PORT_CODE(KEYCODE_F5) // S05 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 [4]") PORT_CODE(KEYCODE_F4) // S04 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 [3]") PORT_CODE(KEYCODE_F3) // S03 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 [2]") PORT_CODE(KEYCODE_F2) // S02 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 [1]") PORT_CODE(KEYCODE_F1) // S01 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 [8]") PORT_CODE(KEYCODE_F8) // S11 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RPT") PORT_CODE(KEYCODE_LCONTROL) // S95 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_SHIFT_2) // S96 -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor victor_9000_keyboard_t::device_input_ports() const -{ - return INPUT_PORTS_NAME( victor9k_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// victor_9000_keyboard_t - constructor -//------------------------------------------------- - -victor_9000_keyboard_t::victor_9000_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, VICTOR9K_KEYBOARD, "Victor 9000 Keyboard", tag, owner, clock, "victor9kb", __FILE__), - m_maincpu(*this, I8021_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_ya(*this, "YA"), - m_yb(*this, "YB"), - m_yc(*this, "YC"), - m_kbrdy_cb(*this), - m_kbdata_cb(*this), - m_y(0), - m_kbrdy(-1), - m_kbdata(-1), - m_kback(1) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void victor_9000_keyboard_t::device_start() -{ - // resolve callbacks - m_kbrdy_cb.resolve_safe(); - m_kbdata_cb.resolve_safe(); - - // state saving - save_item(NAME(m_p1)); - save_item(NAME(m_y)); - save_item(NAME(m_stb)); - save_item(NAME(m_y12)); - save_item(NAME(m_kbrdy)); - save_item(NAME(m_kbdata)); - save_item(NAME(m_kback)); -} - - -//------------------------------------------------- -// kback_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( victor_9000_keyboard_t::kback_w ) -{ - if (LOG) logerror("KBACK %u\n", state); - - m_kback = !state; -} - - -//------------------------------------------------- -// kb_p1_r - -//------------------------------------------------- - -READ8_MEMBER( victor_9000_keyboard_t::kb_p1_r ) -{ - UINT8 data = 0xff; - - switch (m_y) - { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; - case 0xa: data &= m_ya->read(); break; - case 0xb: data &= m_yb->read(); break; - } - - if (!m_y12) - { - data &= m_yc->read(); - } - - return data; -} - - -//------------------------------------------------- -// kb_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( victor_9000_keyboard_t::kb_p1_w ) -{ - m_p1 = data; -} - - -//------------------------------------------------- -// kb_p2_w - -//------------------------------------------------- - -WRITE8_MEMBER( victor_9000_keyboard_t::kb_p2_w ) -{ - /* - - bit description - - P20 22-908 CLR, 22-950 STB - P21 KBRDY - P22 Y12 - P23 KBDATA - - */ - - // falling (?edge or level?), latch keyboard rows 0-11 - if (!BIT(data, 0)) - { - m_y = m_p1 & 0x0f; - } - - // keyboard row 12 - m_y12 = BIT(data, 2); - - // keyboard ready - m_kbrdy_cb(BIT(data, 1)); - - // keyboard data - m_kbdata_cb(BIT(data, 3)); -} - - -//------------------------------------------------- -// kb_t1_r - -//------------------------------------------------- - -READ8_MEMBER( victor_9000_keyboard_t::kb_t1_r ) -{ - return m_kback; -} diff --git a/src/mess/machine/victor9kb.h b/src/mess/machine/victor9kb.h deleted file mode 100644 index c3834e1a7d8..00000000000 --- a/src/mess/machine/victor9kb.h +++ /dev/null @@ -1,97 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Victor 9000 keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __VICTOR9K_KEYBOARD__ -#define __VICTOR9K_KEYBOARD__ - - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VICTOR9K_KBRDY_HANDLER(_devcb) \ - devcb = &victor_9000_keyboard_t::set_kbrdy_cb(*device, DEVCB_##_devcb); - -#define MCFG_VICTOR9K_KBDATA_HANDLER(_devcb) \ - devcb = &victor_9000_keyboard_t::set_kbdata_cb(*device, DEVCB_##_devcb); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> victor_9000_keyboard_t - -class victor_9000_keyboard_t : public device_t -{ -public: - // construction/destruction - victor_9000_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_kbrdy_cb(device_t &device, _Object object) { return downcast(device).m_kbrdy_cb.set_callback(object); } - template static devcb_base &set_kbdata_cb(device_t &device, _Object object) { return downcast(device).m_kbdata_cb.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_WRITE_LINE_MEMBER( kback_w ); - - // not really public - DECLARE_READ8_MEMBER( kb_p1_r ); - DECLARE_WRITE8_MEMBER( kb_p1_w ); - DECLARE_WRITE8_MEMBER( kb_p2_w ); - DECLARE_READ8_MEMBER( kb_t1_r ); - -protected: - // device-level overrides - virtual void device_start(); - -private: - required_device m_maincpu; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_ya; - required_ioport m_yb; - required_ioport m_yc; - - devcb_write_line m_kbrdy_cb; - devcb_write_line m_kbdata_cb; - - UINT8 m_p1; - UINT8 m_y; - int m_stb; - int m_y12; - int m_kbrdy; - int m_kbdata; - int m_kback; -}; - - -// device type definition -extern const device_type VICTOR9K_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/vtech2.c b/src/mess/machine/vtech2.c deleted file mode 100644 index 5929b4aab47..00000000000 --- a/src/mess/machine/vtech2.c +++ /dev/null @@ -1,489 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/*************************************************************************** - vtech2.c - - machine driver - Juergen Buchmueller MESS driver, Jan 2000 - Davide Moretti ROM dump and hardware description - - TODO: - Add loading images from WAV files. - Printer and RS232 support. - Check if the FDC is really the same as in the - Laser 210/310 (aka VZ200/300) series. - -****************************************************************************/ - -#include "emu.h" -#include "includes/vtech2.h" -#include "imagedev/flopdrv.h" -#include "imagedev/cassette.h" -#include "sound/speaker.h" - -/* public */ - -/* static */ - -#define TRKSIZE_VZ 0x9a0 /* arbitrary (actually from analyzing format) */ - -static const UINT8 laser_fdc_wrprot[2] = {0x80, 0x80}; - -/* wrappers for bank #1 to #4 */ -WRITE8_MEMBER(vtech2_state::mwa_bank1 ) { mwa_bank(0,offset,data); } -WRITE8_MEMBER(vtech2_state::mwa_bank2 ) { mwa_bank(1,offset,data); } -WRITE8_MEMBER(vtech2_state::mwa_bank3 ) { mwa_bank(2,offset,data); } -WRITE8_MEMBER(vtech2_state::mwa_bank4 ) { mwa_bank(3,offset,data); } - -/* wrappers for bank #1 to #4 */ -READ8_MEMBER(vtech2_state::mra_bank1 ) { return mra_bank(0,offset); } -READ8_MEMBER(vtech2_state::mra_bank2 ) { return mra_bank(1,offset); } -READ8_MEMBER(vtech2_state::mra_bank3 ) { return mra_bank(2,offset); } -READ8_MEMBER(vtech2_state::mra_bank4 ) { return mra_bank(3,offset); } - -/* read banked memory (plain ROM/RAM) */ -static const char *const mra_bank_hard[4] = -{ - "bank1", /* mapped in 0000-3fff */ - "bank2", /* mapped in 4000-7fff */ - "bank3", /* mapped in 8000-bfff */ - "bank4" /* mapped in c000-ffff */ -}; - -/* write banked memory (plain ROM/RAM) */ -static const char *const mwa_bank_hard[4] = -{ - "bank1", /* mapped in 0000-3fff */ - "bank2", /* mapped in 4000-7fff */ - "bank3", /* mapped in 8000-bfff */ - "bank4" /* mapped in c000-ffff */ -}; - -DRIVER_INIT_MEMBER(vtech2_state,laser) -{ - UINT8 *gfx = memregion("gfx2")->base(); - int i; - - m_laser_track_x2[0] = m_laser_track_x2[1] = 80; - m_laser_fdc_bits = 8; - m_laser_drive = -1; - - for (i = 0; i < 256; i++) - gfx[i] = i; - - m_laser_latch = -1; - m_mem = memregion("maincpu")->base(); - - // check ROM expansion - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - - for (i = 0; i < ARRAY_LENGTH(m_laser_bank); i++) - m_laser_bank[i] = -1; -} - - - -void vtech2_state::laser_machine_init(int bank_mask, int video_mask) -{ - m_laser_bank_mask = bank_mask; - m_laser_video_bank = video_mask; - m_videoram = m_mem + m_laser_video_bank * 0x04000; - logerror("laser_machine_init(): bank mask $%04X, video %d [$%05X]\n", m_laser_bank_mask, m_laser_video_bank, m_laser_video_bank * 0x04000); - - for (int i = 0; i < ARRAY_LENGTH(m_laser_bank); i++) - laser_bank_select_w(m_maincpu->space(AS_PROGRAM), i, 0); -} - -void vtech2_state::machine_reset() -{ - /* banks 0 to 3 only, optional ROM extension */ - laser_machine_init(0x00f, 3); -} - -MACHINE_RESET_MEMBER(vtech2_state,laser500) -{ - /* banks 0 to 2, and 4-7 only, optional ROM extension */ - laser_machine_init(0x0f7, 7); -} - -MACHINE_RESET_MEMBER(vtech2_state,laser700) -{ - /* all banks except #3 */ - laser_machine_init(0xff7, 7); -} - - -WRITE8_MEMBER(vtech2_state::laser_bank_select_w) -{ - static const char *const bank_name[16] = { - "ROM lo","ROM hi","MM I/O","Video RAM lo", - "RAM #0","RAM #1","RAM #2","RAM #3", - "RAM #4","RAM #5","RAM #6","RAM #7/Video RAM hi", - "ext ROM #0","ext ROM #1","ext ROM #2","ext ROM #3" - }; - char bank[10]; - offset %= 4; - data &= 15; - - if( data != m_laser_bank[offset] ) - { - m_laser_bank[offset] = data; - logerror("select bank #%d $%02X [$%05X] %s\n", offset+1, data, 0x4000 * (data & 15), bank_name[data]); - - /* memory mapped I/O bank selected? */ - if (data == 2) - { - static read8_delegate mra_bank_soft[] = - { - read8_delegate(FUNC(vtech2_state::mra_bank1), this), - read8_delegate(FUNC(vtech2_state::mra_bank2), this), - read8_delegate(FUNC(vtech2_state::mra_bank3), this), - read8_delegate(FUNC(vtech2_state::mra_bank4), this), - }; - - static write8_delegate mwa_bank_soft[] = - { - write8_delegate(FUNC(vtech2_state::mwa_bank1), this), - write8_delegate(FUNC(vtech2_state::mwa_bank2), this), - write8_delegate(FUNC(vtech2_state::mwa_bank3), this), - write8_delegate(FUNC(vtech2_state::mwa_bank4), this), - }; - - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_soft[offset], mwa_bank_soft[offset]); - } - else - { - sprintf(bank, "bank%d", offset + 1); - if (data >= 12 && m_cart_rom && (m_cart_rom->bytes() > (data % 12) * 0x4000)) // Expansion ROM banks - { - membank(bank)->set_base(m_cart_rom->base()+ (data % 12) * 0x4000); - m_maincpu->space(AS_PROGRAM).install_read_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_hard[offset]); - m_maincpu->space(AS_PROGRAM).install_write_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_hard[offset]); - } - else if (data < 12 && (m_laser_bank_mask & (1 << data))) // ROM/RAM banks - { - // video RAM bank selected? - if (data == m_laser_video_bank) - logerror("select bank #%d VIDEO!\n", offset + 1); - - membank(bank)->set_base(&m_mem[0x4000 * m_laser_bank[offset]]); - m_maincpu->space(AS_PROGRAM).install_read_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_hard[offset]); - m_maincpu->space(AS_PROGRAM).install_write_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_hard[offset]); - } - else - { - logerror("select bank #%d MASKED!\n", offset + 1); - m_maincpu->space(AS_PROGRAM).nop_readwrite(offset * 0x4000, offset * 0x4000 + 0x3fff); - } - } - - } -} - -/************************************************* - * memory mapped I/O read - * bit function - * 7 not assigned - * 6 column 6 - * 5 column 5 - * 4 column 4 - * 3 column 3 - * 2 column 2 - * 1 column 1 - * 0 column 0 - ************************************************/ -int vtech2_state::mra_bank(int bank, int offs) -{ - UINT8 data = 0x7f; - - /* Laser 500/700 only: keyboard rows A through D */ - if( (offs & 0x00ff) == 0x00ff ) - { - if( (offs & 0x0300) == 0x0000 ) /* keyboard row A */ - { - if( ioport("ROWA")->read() != m_row_a ) - { - m_row_a = ioport("ROWA")->read(); - data &= m_row_a; - } - } - if( (offs & 0x0300) == 0x0100 ) /* keyboard row B */ - { - if( ioport("ROWB")->read() != m_row_b ) - { - m_row_b = ioport("ROWB")->read(); - data &= m_row_b; - } - } - if( (offs & 0x0300) == 0x0200 ) /* keyboard row C */ - { - if( ioport("ROWC")->read() != m_row_c ) - { - m_row_c = ioport("ROWC")->read(); - data &= m_row_c; - } - } - if( (offs & 0x0300) == 0x0300 ) /* keyboard row D */ - { - if( ioport("ROWD")->read() != m_row_d ) - { - m_row_d = ioport("ROWD")->read(); - data &= m_row_d; - } - } - } - else - { - /* All Lasers keyboard rows 0 through 7 */ - if( !(offs & 0x01) ) - data &= ioport("ROW0")->read(); - if( !(offs & 0x02) ) - data &= ioport("ROW1")->read(); - if( !(offs & 0x04) ) - data &= ioport("ROW2")->read(); - if( !(offs & 0x08) ) - data &= ioport("ROW3")->read(); - if( !(offs & 0x10) ) - data &= ioport("ROW4")->read(); - if( !(offs & 0x20) ) - data &= ioport("ROW5")->read(); - if( !(offs & 0x40) ) - data &= ioport("ROW6")->read(); - if( !(offs & 0x80) ) - data &= ioport("ROW7")->read(); - } - - /* BIT 7 - tape input */ - - data |= (m_cassette->input() > +0.02) ? 0x80 : 0; - - return data; -} - -/************************************************* - * memory mapped I/O write - * bit function - * 7-6 not assigned - * 5 speaker B ??? - * 4 ??? - * 3 mode: 1 graphics, 0 text - * 2 cassette out (MSB) - * 1 cassette out (LSB) - * 0 speaker A - ************************************************/ -void vtech2_state::mwa_bank(int bank, int offs, int data) -{ - offs += 0x4000 * m_laser_bank[bank]; - switch (m_laser_bank[bank]) - { - case 0: /* ROM lower 16K */ - case 1: /* ROM upper 16K */ - logerror("bank #%d write to ROM [$%05X] $%02X\n", bank+1, offs, data); - break; - case 2: /* memory mapped output */ - if (data != m_laser_latch) - { - logerror("bank #%d write to I/O [$%05X] $%02X\n", bank+1, offs, data); - /* Toggle between graphics and text modes? */ - if ((data ^ m_laser_latch) & 0x01) - m_speaker->level_w(data & 1); - m_laser_latch = data; - } - m_cassette->output( BIT(data, 2) ? -1.0 : +1.0); - break; - case 12: /* ext. ROM #1 */ - case 13: /* ext. ROM #2 */ - case 14: /* ext. ROM #3 */ - case 15: /* ext. ROM #4 */ - logerror("bank #%d write to ROM [$%05X] $%02X\n", bank+1, offs, data); - break; - default: /* RAM */ - if( m_laser_bank[bank] == m_laser_video_bank && m_mem[offs] != data ) - { - logerror("bank #%d write to videoram [$%05X] $%02X\n", bank+1, offs, data); - } - m_mem[offs] = data; - break; - } -} - - -device_t *vtech2_state::laser_file() -{ - return machine().device(m_laser_drive ? FLOPPY_1 : FLOPPY_0); -} - -void vtech2_state::laser_get_track() -{ - sprintf(m_laser_frame_message, "#%d get track %02d", m_laser_drive, m_laser_track_x2[m_laser_drive]/2); - m_laser_frame_time = 30; - /* drive selected or and image file ok? */ - if( m_laser_drive >= 0 && laser_file() != NULL ) - { - int size, offs; - device_image_interface *image = dynamic_cast(laser_file()); - size = TRKSIZE_VZ; - offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2; - image->fseek(offs, SEEK_SET); - size = image->fread(m_laser_fdc_data, size); - logerror("get track @$%05x $%04x bytes\n", offs, size); - } - m_laser_fdc_offs = 0; - m_laser_fdc_write = 0; -} - -void vtech2_state::laser_put_track() -{ - device_image_interface *image = dynamic_cast(laser_file()); - /* drive selected and image file ok? */ - if( m_laser_drive >= 0 && laser_file() != NULL ) - { - int size, offs; - offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2; - image->fseek(offs + m_laser_fdc_start, SEEK_SET); - size = image->fwrite(&m_laser_fdc_data[m_laser_fdc_start], m_laser_fdc_write); - logerror("put track @$%05X+$%X $%04X/$%04X bytes\n", offs, m_laser_fdc_start, size, m_laser_fdc_write); - } -} - -#define PHI0(n) (((n)>>0)&1) -#define PHI1(n) (((n)>>1)&1) -#define PHI2(n) (((n)>>2)&1) -#define PHI3(n) (((n)>>3)&1) - -READ8_MEMBER(vtech2_state::laser_fdc_r) -{ - int data = 0xff; - switch( offset ) - { - case 1: /* data (read-only) */ - if( m_laser_fdc_bits > 0 ) - { - if( m_laser_fdc_status & 0x80 ) - m_laser_fdc_bits--; - data = (m_laser_data >> m_laser_fdc_bits) & 0xff; -#if 0 - logerror("laser_fdc_r bits %d%d%d%d%d%d%d%d\n", - (data>>7)&1,(data>>6)&1,(data>>5)&1,(data>>4)&1, - (data>>3)&1,(data>>2)&1,(data>>1)&1,(data>>0)&1 ); -#endif - } - if( m_laser_fdc_bits == 0 ) - { - m_laser_data = m_laser_fdc_data[m_laser_fdc_offs]; - logerror("laser_fdc_r %d : data ($%04X) $%02X\n", offset, m_laser_fdc_offs, m_laser_data); - if( m_laser_fdc_status & 0x80 ) - { - m_laser_fdc_bits = 8; - m_laser_fdc_offs = (m_laser_fdc_offs + 1) % TRKSIZE_FM; - } - m_laser_fdc_status &= ~0x80; - } - break; - case 2: /* polling (read-only) */ - /* fake */ - if( m_laser_drive >= 0 ) - m_laser_fdc_status |= 0x80; - data = m_laser_fdc_status; - break; - case 3: /* write protect status (read-only) */ - if( m_laser_drive >= 0 ) - data = laser_fdc_wrprot[m_laser_drive]; - logerror("laser_fdc_r %d : write_protect $%02X\n", offset, data); - break; - } - return data; -} - -WRITE8_MEMBER(vtech2_state::laser_fdc_w) -{ - int drive; - - switch( offset ) - { - case 0: /* latch (write-only) */ - drive = (data & 0x10) ? 0 : (data & 0x80) ? 1 : -1; - if( drive != m_laser_drive ) - { - m_laser_drive = drive; - if( m_laser_drive >= 0 ) - laser_get_track(); - } - if( m_laser_drive >= 0 ) - { - if( (PHI0(data) && !(PHI1(data) || PHI2(data) || PHI3(data)) && PHI1(m_laser_fdc_latch)) || - (PHI1(data) && !(PHI0(data) || PHI2(data) || PHI3(data)) && PHI2(m_laser_fdc_latch)) || - (PHI2(data) && !(PHI0(data) || PHI1(data) || PHI3(data)) && PHI3(m_laser_fdc_latch)) || - (PHI3(data) && !(PHI0(data) || PHI1(data) || PHI2(data)) && PHI0(m_laser_fdc_latch)) ) - { - if( m_laser_track_x2[m_laser_drive] > 0 ) - m_laser_track_x2[m_laser_drive]--; - logerror("laser_fdc_w(%d) $%02X drive %d: stepout track #%2d.%d\n", offset, data, m_laser_drive, m_laser_track_x2[m_laser_drive]/2,5*(m_laser_track_x2[m_laser_drive]&1)); - if( (m_laser_track_x2[m_laser_drive] & 1) == 0 ) - laser_get_track(); - } - else - if( (PHI0(data) && !(PHI1(data) || PHI2(data) || PHI3(data)) && PHI3(m_laser_fdc_latch)) || - (PHI1(data) && !(PHI0(data) || PHI2(data) || PHI3(data)) && PHI0(m_laser_fdc_latch)) || - (PHI2(data) && !(PHI0(data) || PHI1(data) || PHI3(data)) && PHI1(m_laser_fdc_latch)) || - (PHI3(data) && !(PHI0(data) || PHI1(data) || PHI2(data)) && PHI2(m_laser_fdc_latch)) ) - { - if( m_laser_track_x2[m_laser_drive] < 2*40 ) - m_laser_track_x2[m_laser_drive]++; - logerror("laser_fdc_w(%d) $%02X drive %d: stepin track #%2d.%d\n", offset, data, m_laser_drive, m_laser_track_x2[m_laser_drive]/2,5*(m_laser_track_x2[m_laser_drive]&1)); - if( (m_laser_track_x2[m_laser_drive] & 1) == 0 ) - laser_get_track(); - } - if( (data & 0x40) == 0 ) - { - m_laser_data <<= 1; - if( (m_laser_fdc_latch ^ data) & 0x20 ) - m_laser_data |= 1; - if( (m_laser_fdc_edge ^= 1) == 0 ) - { - if( --m_laser_fdc_bits == 0 ) - { - UINT8 value = 0; - m_laser_data &= 0xffff; - if( m_laser_data & 0x4000 ) value |= 0x80; - if( m_laser_data & 0x1000 ) value |= 0x40; - if( m_laser_data & 0x0400 ) value |= 0x20; - if( m_laser_data & 0x0100 ) value |= 0x10; - if( m_laser_data & 0x0040 ) value |= 0x08; - if( m_laser_data & 0x0010 ) value |= 0x04; - if( m_laser_data & 0x0004 ) value |= 0x02; - if( m_laser_data & 0x0001 ) value |= 0x01; - logerror("laser_fdc_w(%d) data($%04X) $%02X <- $%02X ($%04X)\n", offset, m_laser_fdc_offs, m_laser_fdc_data[m_laser_fdc_offs], value, m_laser_data); - m_laser_fdc_data[m_laser_fdc_offs] = value; - m_laser_fdc_offs = (m_laser_fdc_offs + 1) % TRKSIZE_FM; - m_laser_fdc_write++; - m_laser_fdc_bits = 8; - } - } - } - /* change of write signal? */ - if( (m_laser_fdc_latch ^ data) & 0x40 ) - { - /* falling edge? */ - if ( m_laser_fdc_latch & 0x40 ) - { - sprintf(m_laser_frame_message, "#%d put track %02d", m_laser_drive, m_laser_track_x2[m_laser_drive]/2); - m_laser_frame_time = 30; - m_laser_fdc_start = m_laser_fdc_offs; - m_laser_fdc_edge = 0; - } - else - { - /* data written to track before? */ - if( m_laser_fdc_write ) - laser_put_track(); - } - m_laser_fdc_bits = 8; - m_laser_fdc_write = 0; - } - } - m_laser_fdc_latch = data; - break; - } -} diff --git a/src/mess/machine/wangpckb.c b/src/mess/machine/wangpckb.c deleted file mode 100644 index 7e38ec2f153..00000000000 --- a/src/mess/machine/wangpckb.c +++ /dev/null @@ -1,583 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Wang PC keyboard emulation - -*********************************************************************/ - -/* - -PCB Layout ----------- - -Key Tronic A65-02454-002 -PCB 201 - -|-----------------------------------------------------------------------| -| LS273 PSG 555 LS04 4MHz LS132 CN1 LS374 XR | -| CPU | -| LD1 LD2 LD3 LD4 LD5 | -| SW1 LS259 SW2 LS259 | -| | -| | -| | -| | -| | -| | -| | -|-----------------------------------------------------------------------| - -Notes: - Relevant IC's shown. - - CPU - Intel P8051AH "20-8051-225" - PSG - Texas Instruments SN76496N - XR - Exar Semiconductor XR22-908-03B? (hard to read) - CN1 - 1x6 pin PCB header - SW1 - 8-way DIP switch - SW2 - 8-way DIP switch - -*/ - -/* - - TODO: - - - rewrite the mcs51.c serial I/O to replace this horrible, horrible hack - - dip switches - -*/ - -#include "wangpckb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - -#define I8051_TAG "z5" -#define SN76496_TAG "z4" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type WANGPC_KEYBOARD = &device_creator; - - - -//------------------------------------------------- -// ROM( wangpc_keyboard ) -//------------------------------------------------- - -ROM_START( wangpc_keyboard ) - ROM_REGION( 0x1000, I8051_TAG, 0 ) - ROM_LOAD( "20-8051-225.z5", 0x0000, 0x1000, CRC(82d2999f) SHA1(2bb34a1de2d94b2885d9e8fcd4964296f6276c5c) ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *wangpc_keyboard_device::device_rom_region() const -{ - return ROM_NAME( wangpc_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( wangpc_keyboard_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( wangpc_keyboard_io, AS_IO, 8, wangpc_keyboard_device ) - //AM_RANGE(0x0000, 0xfeff) AM_READNOP - AM_RANGE(0x47, 0x58) AM_MIRROR(0xff00) AM_READNOP - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_DEVWRITE(SN76496_TAG, sn76496_device, write) - AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) - AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_WRITE(kb_p2_w) - AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_WRITE(kb_p3_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// MACHINE_DRIVER( wangpc_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( wangpc_keyboard ) - MCFG_CPU_ADD(I8051_TAG, I8051, XTAL_4MHz) - MCFG_CPU_IO_MAP(wangpc_keyboard_io) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SN76496_TAG, SN76496, 2000000) // ??? - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor wangpc_keyboard_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( wangpc_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( wangpc_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( wangpc_keyboard ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // 2b - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // 63 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EXEC") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) // 53 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) // 52 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // 43 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // 29 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x96") // 26 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // 2e - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') // 64 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // 1f - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // 21 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("GL") // 54 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')// 45 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') // 44 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 35 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // 2d - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') // 65 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') // 2f - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // 56 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') // 55 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') // 46 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // 22 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // 23 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // 37 - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') // 67 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') // 66 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // 58 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // 57 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // 48 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // 47 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') // 38 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') // 2a - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6 \xC2\xA3") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(0xa3) // 69 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') // 68 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // 5a - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // 59 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // 4a - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // 49 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // 3a - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // 39 - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // 6b - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // 6a - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // 5c - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // 5b - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // 4c - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // 4b - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // 3c - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // 3b - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') // 6d - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // 6c - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // 5e - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // 5d - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // 4e - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // 4d - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // 3e - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // 3d - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\xA4") PORT_CODE(KEYCODE_TILDE) // 1f - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') // 6e - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\xA5") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') // 6f - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // 5f - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 1e - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // 4f - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 1b - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // 3f - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_F8) // 77 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SRCH") PORT_CODE(KEYCODE_F9) // 76 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // 1c - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . ;") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // 32 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // 33 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 '") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 34 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // 35 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // 28 - - PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MERGE") PORT_CODE(KEYCODE_F6) // 79 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NOTE") PORT_CODE(KEYCODE_F7) // 78 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GOTO") // 11 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CANCEL") // 12 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2ND") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) // 25 - - PORT_START("YA") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEC TAB") PORT_CODE(KEYCODE_F4) // 7b - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FORMAT") PORT_CODE(KEYCODE_F5) // 7a - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x95") // 71 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("(blank)") // 70 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // 2c - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 27 - - PORT_START("YB") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PAGE") PORT_CODE(KEYCODE_F2) // 7d - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CENTER") PORT_CODE(KEYCODE_F3) // 7c - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("MOVE") PORT_CODE(KEYCODE_F12) // 73 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COMMAND") // 72 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("YC") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_ESC) // 36 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INDENT") PORT_CODE(KEYCODE_F1) // 7e - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPLC") PORT_CODE(KEYCODE_F10) // 75 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COPY") PORT_CODE(KEYCODE_F11) // 74 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 24 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // 1d - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("YD") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad \xC3\x97") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // 14 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad \xC3\xB7") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // 18 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PRINT") // 19 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // 20 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) PORT_NAME("ERASE") // 1a - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 1c - - PORT_START("YE") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad + *") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))// 60 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad - !") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // 13 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 >") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 15 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 " UTF8_UP) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 16 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5 ]") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 40 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 $") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 17 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 #") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 10 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // 1b - - PORT_START("YF") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INSERT") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // 62 - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PREV") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) // 61 - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("NEXT") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) // 51 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 <") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 50 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // 42 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 [") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 41 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 &") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 31 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 @") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 30 - - PORT_START("SW1") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:6") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("SW2") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3") - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4") - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor wangpc_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( wangpc_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// wangpc_keyboard_device - constructor -//------------------------------------------------- - -wangpc_keyboard_device::wangpc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, WANGPC_KEYBOARD, "Wang PC Keyboard", tag, owner, clock, "wangpckb", __FILE__), - device_serial_interface(mconfig, *this), - m_maincpu(*this, I8051_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_ya(*this, "YA"), - m_yb(*this, "YB"), - m_yc(*this, "YC"), - m_yd(*this, "YD"), - m_ye(*this, "YE"), - m_yf(*this, "YF"), - m_txd_handler(*this) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void wangpc_keyboard_device::device_start() -{ - m_txd_handler.resolve_safe(); - - // set serial callbacks - m_maincpu->i8051_set_serial_tx_callback(WRITE8_DELEGATE(wangpc_keyboard_device, mcs51_tx_callback)); - m_maincpu->i8051_set_serial_rx_callback(READ8_DELEGATE(wangpc_keyboard_device, mcs51_rx_callback)); - set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void wangpc_keyboard_device::device_reset() -{ - transmit_register_reset(); - receive_register_reset(); - - m_txd_handler(1); -} - - -//------------------------------------------------- -// write_rxd - -//------------------------------------------------- - -WRITE_LINE_MEMBER(wangpc_keyboard_device::write_rxd) -{ - receive_register_update_bit(state); - - if (is_receive_register_full()) - { - m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); - receive_register_extract(); - - if (LOG) logerror("Wang PC keyboard receive data %02x\n", get_received_char()); - } -} - - -//------------------------------------------------- -// mcs51_rx_callback - -//------------------------------------------------- - -READ8_MEMBER(wangpc_keyboard_device::mcs51_rx_callback) -{ - return get_received_char(); -} - - -//------------------------------------------------- -// mcs51_tx_callback - -//------------------------------------------------- - -WRITE8_MEMBER(wangpc_keyboard_device::mcs51_tx_callback) -{ - if (LOG) logerror("Wang PC keyboard transmit data %02x\n", data); - - transmit_register_setup(data); - - // HACK bang the bits out immediately - while (!is_transmit_register_empty()) - { - m_txd_handler(transmit_register_get_data_bit()); - } -} - - -//------------------------------------------------- -// kb_p1_r - -//------------------------------------------------- - -READ8_MEMBER( wangpc_keyboard_device::kb_p1_r ) -{ - UINT8 data = 0xff; - - switch (m_y & 0x0f) - { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; - case 0xa: data &= m_ya->read(); break; - case 0xb: data &= m_yb->read(); break; - case 0xc: data &= m_yc->read(); break; - case 0xd: data &= m_yd->read(); break; - case 0xe: data &= m_ye->read(); break; - case 0xf: data &= m_yf->read(); break; - } - - return data; -} - - -//------------------------------------------------- -// kb_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_keyboard_device::kb_p1_w ) -{ - /* - - bit description - - P1.0 led 0 - P1.1 led 1 - P1.2 led 2 - P1.3 led 3 - P1.4 led 4 - P1.5 led 5 - P1.6 - P1.7 - - */ - - for (int i = 0; i < 6; i++) - { - output_set_led_value(i, !BIT(data, i)); - } - - if (LOG) logerror("P1 %02x\n", data); -} - - -//------------------------------------------------- -// kb_p2_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_keyboard_device::kb_p2_w ) -{ - /* - - bit description - - P2.0 row 0 - P2.1 row 1 - P2.2 row 2 - P2.3 row 3 - P2.4 - P2.5 - P2.6 chip enable for something - P2.7 - - */ - - m_y = data & 0x0f; - - if (LOG) logerror("P2 %02x\n", data); -} - - -//------------------------------------------------- -// kb_p3_w - -//------------------------------------------------- - -WRITE8_MEMBER( wangpc_keyboard_device::kb_p3_w ) -{ - /* - - bit description - - P3.0 RxD - P3.1 TxD - P3.2 - P3.3 chip enable for something - P3.4 - P3.5 - P3.6 - P3.7 - - */ - - if (LOG) logerror("P3 %02x\n", data); -} diff --git a/src/mess/machine/wangpckb.h b/src/mess/machine/wangpckb.h deleted file mode 100644 index 27c87b071fc..00000000000 --- a/src/mess/machine/wangpckb.h +++ /dev/null @@ -1,107 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Wang PC keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __WANGPC_KEYBOARD__ -#define __WANGPC_KEYBOARD__ - - -#include "emu.h" -#include "cpu/mcs51/mcs51.h" -#include "sound/sn76496.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define WANGPC_KEYBOARD_TAG "wangpckb" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_WANGPC_KEYBOARD_ADD() \ - MCFG_DEVICE_ADD(WANGPC_KEYBOARD_TAG, WANGPC_KEYBOARD, 0) - -#define MCFG_WANGPCKB_TXD_HANDLER(_devcb) \ - devcb = &wangpc_keyboard_device::set_txd_handler(*device, DEVCB_##_devcb); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> wangpc_keyboard_device - -class wangpc_keyboard_device : public device_t, - public device_serial_interface -{ -public: - // construction/destruction - wangpc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_txd_handler(device_t &device, _Object object) { return downcast(device).m_txd_handler.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - DECLARE_WRITE_LINE_MEMBER( write_rxd ); - - // not really public - DECLARE_READ8_MEMBER( kb_p1_r ); - DECLARE_WRITE8_MEMBER( kb_p1_w ); - DECLARE_WRITE8_MEMBER( kb_p2_w ); - DECLARE_WRITE8_MEMBER( kb_p3_w ); - - DECLARE_READ8_MEMBER(mcs51_rx_callback); - DECLARE_WRITE8_MEMBER(mcs51_tx_callback); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // device_serial_interface overrides - -private: - required_device m_maincpu; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_ya; - required_ioport m_yb; - required_ioport m_yc; - required_ioport m_yd; - required_ioport m_ye; - required_ioport m_yf; - devcb_write_line m_txd_handler; - - UINT8 m_y; -}; - - -// device type definition -extern const device_type WANGPC_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/wswan.c b/src/mess/machine/wswan.c deleted file mode 100644 index 508f93e8544..00000000000 --- a/src/mess/machine/wswan.c +++ /dev/null @@ -1,662 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Anthony Kruize,Wilbert Pol -/*************************************************************************** - - wswan.c - - Machine file to handle emulation of the Bandai WonderSwan. - - Anthony Kruize - Wilbert Pol - -TODO: - SRAM sizes should be in kbit instead of kbytes(?). This raises a few - interesting issues: - - mirror of smaller <64KBYTE/512kbit sram sizes - - banking when using 1M or 2M sram sizes - -***************************************************************************/ - -#include "includes/wswan.h" - -#define INTERNAL_EEPROM_SIZE 1024 - -enum enum_system { TYPE_WSWAN=0, TYPE_WSC }; - - -static const UINT8 ws_portram_init[256] = -{ - 0x00, 0x00, 0x00/*?*/, 0xbb, 0x00, 0x00, 0x00, 0x26, 0xfe, 0xde, 0xf9, 0xfb, 0xdb, 0xd7, 0x7f, 0xf5, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x9e, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x99, 0xfd, 0xb7, 0xdf, - 0x30, 0x57, 0x75, 0x76, 0x15, 0x73, 0x70/*77?*/, 0x77, 0x20, 0x75, 0x50, 0x36, 0x70, 0x67, 0x50, 0x77, - 0x57, 0x54, 0x75, 0x77, 0x75, 0x17, 0x37, 0x73, 0x50, 0x57, 0x60, 0x77, 0x70, 0x77, 0x10, 0x73, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, - 0x87, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xdb, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x83, 0x00, - 0x2f, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1 -}; - -/* - Some fake bios code to initialize some registers and set up some things on the wonderswan. - The code from f:ffe0 which gets copied to 0:0400 is taken from a wonderswan crystal's initial - memory settings. Lacking real bios dumps we will use this.... - - The setting of SP to 2000h is what's needed to get Wonderswan Colloseum to boot. - - f000:ffc0 - FC cld - BC 00 20 mov sp,2000h - 68 00 00 push 0000h - 07 pop es - 68 00 F0 push F000h - 1F pop ds - BF 00 04 mov di,0400h - BE E0 FF mov si,FFE0h - B9 10 00 mov cx,0010h - F3 A4 rep movsb - B0 2F mov al,2Fh - E6 C0 out al,C0h - EA 00 04 00 00 jmp 0000:0400 - - f000:ffe0 - E4 A0 in al, A0h - 0C 01 or al,01h - E6 A0 out al,A0h - EA 00 00 FF FF jmp FFFFh:0000h - -*/ -static const UINT8 ws_fake_bios_code[] = { - 0xfc, 0xbc, 0x00, 0x20, 0x68, 0x00, 0x00, 0x07, 0x68, 0x00, 0xf0, 0x1f, 0xbf, 0x00, 0x04, 0xbe, - 0xe0, 0xff, 0xb9, 0x10, 0x00, 0xf3, 0xa4, 0xb0, 0x2f, 0xe6, 0xc0, 0xea, 0x00, 0x04, 0x00, 0x00, - 0xe4, 0xa0, 0x0c, 0x01, 0xe6, 0xa0, 0xea, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xea, 0xc0, 0xff, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -void wswan_state::handle_irqs() -{ - if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_HBLTMR) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_HBLTMR); - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_VBL) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_VBL); - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_VBLTMR) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_VBLTMR); - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_LCMP) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_LCMP); - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_SRX) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_SRX); - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_RTC) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_RTC); - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_KEY) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_KEY); - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_STX) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_STX); - } - else - { - m_maincpu->set_input_line(0, CLEAR_LINE); - } -} - -void wswan_state::set_irq_line(int irq) -{ - if (m_ws_portram[0xb2] & irq) - { - m_ws_portram[0xb6] |= irq; - handle_irqs(); - } -} - -void wswan_state::dma_sound_cb() -{ - if ((m_sound_dma.enable & 0x88) == 0x80) - { - address_space &space = m_maincpu->space(AS_PROGRAM); - /* TODO: Output sound DMA byte */ - port_w(space, 0x89, space.read_byte(m_sound_dma.source)); - m_sound_dma.size--; - m_sound_dma.source = (m_sound_dma.source + 1) & 0x0fffff; - if (m_sound_dma.size == 0) - { - m_sound_dma.enable &= 0x7F; - } - } -} - -void wswan_state::clear_irq_line(int irq) -{ - m_ws_portram[0xb6] &= ~irq; - handle_irqs(); -} - -void wswan_state::register_save() -{ - save_item(NAME(m_ws_portram)); - save_item(NAME(m_internal_eeprom)); - save_item(NAME(m_bios_disabled)); - save_item(NAME(m_rotate)); - - save_item(NAME(m_sound_dma.source)); - save_item(NAME(m_sound_dma.size)); - save_item(NAME(m_sound_dma.enable)); - - if (m_cart->exists()) - m_cart->save_nvram(); -} - -void wswan_state::common_start() -{ - m_ws_bios_bank = auto_alloc_array(machine(), UINT8, 0x10000); - memcpy(m_ws_bios_bank + 0xffc0, ws_fake_bios_code, 0x40); - - register_save(); - - machine().device("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE); - - if (m_cart->exists()) - { - // ROM - m_maincpu->space(AS_PROGRAM).install_read_handler(0x20000, 0x2ffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom20),(ws_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x30000, 0x3ffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom30),(ws_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x40000, 0xeffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom40),(ws_cart_slot_device*)m_cart)); - - // SRAM - if (m_cart->get_type() == WS_SRAM) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0x10000, 0x1ffff, read8_delegate(FUNC(ws_cart_slot_device::read_ram),(ws_cart_slot_device*)m_cart)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x10000, 0x1ffff, write8_delegate(FUNC(ws_cart_slot_device::write_ram),(ws_cart_slot_device*)m_cart)); - } - } -} - -void wswan_state::machine_start() -{ - common_start(); - m_system_type = TYPE_WSWAN; -} - -MACHINE_START_MEMBER(wswan_state, wscolor) -{ - common_start(); - m_system_type = TYPE_WSC; -} - -void wswan_state::machine_reset() -{ - m_bios_disabled = 0; - - if (m_cart->exists()) - m_rotate = m_cart->get_is_rotated(); - else - m_rotate = 0; - - /* Intialize ports */ - memcpy(m_ws_portram, ws_portram_init, 256); - - render_target *target = machine().render().first_target(); - target->set_view(m_rotate); - - /* Initialize sound DMA */ - memset(&m_sound_dma, 0, sizeof(m_sound_dma)); -} - -READ8_MEMBER( wswan_state::bios_r ) -{ - if (!m_bios_disabled) - return m_ws_bios_bank[offset]; - else - return m_cart->read_rom40(space, offset + 0xb0000); -} - -READ8_MEMBER( wswan_state::port_r ) -{ - UINT8 value = m_ws_portram[offset]; - - if (offset != 2) - logerror("PC=%X: port read %02X\n", m_maincpu->pc(), offset); - - if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) - return m_vdp->reg_r(space, offset); - - switch (offset) - { - case 0x4a: // Sound DMA source address (low) - value = m_sound_dma.source & 0xff; - break; - case 0x4b: // Sound DMA source address (high) - value = (m_sound_dma.source >> 8) & 0xff; - break; - case 0x4c: // Sound DMA source memory segment - value = (m_sound_dma.source >> 16) & 0xff; - break; - case 0x4e: // Sound DMA transfer size (low) - value = m_sound_dma.size & 0xff; - break; - case 0x4f: // Sound DMA transfer size (high) - value = (m_sound_dma.size >> 8) & 0xff; - break; - case 0x52: // Sound DMA start/stop - value = m_sound_dma.enable; - break; - case 0x60: - value = m_vdp->reg_r(space, offset); - break; - case 0xa0: // Hardware type - // Bit 0 - Disable/enable Bios - // Bit 1 - Determine mono/color - // Bit 2 - Determine color/crystal - value = value & ~ 0x02; - if (m_system_type == TYPE_WSC) - value |= 2; - break; - case 0xc0: - case 0xc1: - case 0xc2: - case 0xc3: - case 0xc4: // EEPROM data - case 0xc5: // EEPROM data - case 0xc6: - case 0xc7: - case 0xc8: - case 0xc9: - case 0xca: - case 0xcb: // RTC data - case 0xcc: - case 0xcd: - case 0xce: - case 0xcf: - value = m_cart->read_io(space, offset & 0x0f); - break; - } - - return value; -} - -WRITE8_MEMBER( wswan_state::port_w ) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT8 input; - logerror("PC=%X: port write %02X <- %02X\n", m_maincpu->pc(), offset, data); - - if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) - { - m_vdp->reg_w(space, offset, data); - return; - } - - switch (offset) - { - case 0x40: /* DMA source address (low) - Bit 0-7 - DMA source address bit 0-7 - */ - case 0x41: /* DMA source address (high) - Bit 0-7 - DMA source address bit 8-15 - */ - case 0x42: /* DMA source bank - Bit 0-7 - DMA source bank number - */ - case 0x43: /* DMA destination bank - Bit 0-7 - DMA destination bank number - */ - case 0x44: /* DMA destination address (low) - Bit 0-7 - DMA destination address bit 0-7 - */ - case 0x45: /* DMA destination address (high) - Bit 0-7 - DMA destination address bit 8-15 - */ - case 0x46: /* Size of copied data (low) - Bit 0-7 - DMA size bit 0-7 - */ - case 0x47: /* Size of copied data (high) - Bit 0-7 - DMA size bit 8-15 - */ - break; - case 0x48: /* DMA control - Bit 0-6 - Unknown - Bit 7 - DMA stop/start - */ - if (data & 0x80) - { - UINT32 src, dst; - UINT16 length; - - src = m_ws_portram[0x40] + (m_ws_portram[0x41] << 8) + (m_ws_portram[0x42] << 16); - dst = m_ws_portram[0x44] + (m_ws_portram[0x45] << 8) + (m_ws_portram[0x43] << 16); - length = m_ws_portram[0x46] + (m_ws_portram[0x47] << 8); - for ( ; length > 0; length--) - { - mem.write_byte(dst, mem.read_byte(src)); - src++; - dst++; - } -#ifdef MAME_DEBUG - logerror("DMA src:%X dst:%X length:%d\n", src, dst, length); -#endif - m_ws_portram[0x40] = src & 0xff; - m_ws_portram[0x41] = (src >> 8) & 0xff; - m_ws_portram[0x44] = dst & 0xff; - m_ws_portram[0x45] = (dst >> 8) & 0xff; - m_ws_portram[0x46] = length & 0xff; - m_ws_portram[0x47] = (length >> 8) & 0xff; - data &= 0x7f; - } - break; - case 0x4a: /* Sound DMA source address (low) - Bit 0-7 - Sound DMA source address bit 0-7 - */ - m_sound_dma.source = (m_sound_dma.source & 0x0fff00) | data; - break; - case 0x4b: /* Sound DMA source address (high) - Bit 0-7 - Sound DMA source address bit 8-15 - */ - m_sound_dma.source = (m_sound_dma.source & 0x0f00ff) | (data << 8); - break; - case 0x4c: /* Sound DMA source memory segment - Bit 0-3 - Sound DMA source address segment - Bit 4-7 - Unknown - */ - m_sound_dma.source = (m_sound_dma.source & 0xffff) | ((data & 0x0f) << 16); - break; - case 0x4d: /* Unknown */ - break; - case 0x4e: /* Sound DMA transfer size (low) - Bit 0-7 - Sound DMA transfer size bit 0-7 - */ - m_sound_dma.size = (m_sound_dma.size & 0xff00) | data; - break; - case 0x4f: /* Sound DMA transfer size (high) - Bit 0-7 - Sound DMA transfer size bit 8-15 - */ - m_sound_dma.size = (m_sound_dma.size & 0xff) | (data << 8); - break; - case 0x50: /* Unknown */ - case 0x51: /* Unknown */ - break; - case 0x52: /* Sound DMA start/stop - Bit 0-6 - Unknown - Bit 7 - Sound DMA stop/start - */ - m_sound_dma.enable = data; - break; - case 0x60: - m_vdp->reg_w(space, offset, data); - break; - case 0x80: /* Audio 1 freq (lo) - Bit 0-7 - Audio channel 1 frequency bit 0-7 - */ - case 0x81: /* Audio 1 freq (hi) - Bit 0-7 - Audio channel 1 frequency bit 8-15 - */ - case 0x82: /* Audio 2 freq (lo) - Bit 0-7 - Audio channel 2 frequency bit 0-7 - */ - case 0x83: /* Audio 2 freq (hi) - Bit 0-7 - Audio channel 2 frequency bit 8-15 - */ - case 0x84: /* Audio 3 freq (lo) - Bit 0-7 - Audio channel 3 frequency bit 0-7 - */ - case 0x85: /* Audio 3 freq (hi) - Bit 0-7 - Audio channel 3 frequency bit 8-15 - */ - case 0x86: /* Audio 4 freq (lo) - Bit 0-7 - Audio channel 4 frequency bit 0-7 - */ - case 0x87: /* Audio 4 freq (hi) - Bit 0-7 - Audio channel 4 frequency bit 8-15 - */ - case 0x88: /* Audio 1 volume - Bit 0-3 - Right volume audio channel 1 - Bit 4-7 - Left volume audio channel 1 - */ - case 0x89: /* Audio 2 volume - Bit 0-3 - Right volume audio channel 2 - Bit 4-7 - Left volume audio channel 2 - */ - case 0x8a: /* Audio 3 volume - Bit 0-3 - Right volume audio channel 3 - Bit 4-7 - Left volume audio channel 3 - */ - case 0x8b: /* Audio 4 volume - Bit 0-3 - Right volume audio channel 4 - Bit 4-7 - Left volume audio channel 4 - */ - case 0x8c: /* Sweep step - Bit 0-7 - Sweep step - */ - case 0x8d: /* Sweep time - Bit 0-7 - Sweep time - */ - case 0x8e: /* Noise control - Bit 0-2 - Noise generator type - Bit 3 - Reset - Bit 4 - Enable - Bit 5-7 - Unknown - */ - case 0x8f: /* Sample location - Bit 0-7 - Sample address location 0 00xxxxxx xx000000 - */ - case 0x90: /* Audio control - Bit 0 - Audio 1 enable - Bit 1 - Audio 2 enable - Bit 2 - Audio 3 enable - Bit 3 - Audio 4 enable - Bit 4 - Unknown - Bit 5 - Audio 2 voice mode enable - Bit 6 - Audio 3 sweep mode enable - Bit 7 - Audio 4 noise mode enable - */ - case 0x91: /* Audio output - Bit 0 - Mono select - Bit 1-2 - Output volume - Bit 3 - External stereo - Bit 4-6 - Unknown - Bit 7 - External speaker (Read-only, set by hardware) - */ - case 0x92: /* Noise counter shift register (lo) - Bit 0-7 - Noise counter shift register bit 0-7 - */ - case 0x93: /* Noise counter shift register (hi) - Bit 0-6 - Noise counter shift register bit 8-14 - bit 7 - Unknown - */ - case 0x94: /* Master volume - Bit 0-3 - Master volume - Bit 4-7 - Unknown - */ - m_sound->port_w(space, offset, data); - break; - case 0xa0: /* Hardware type - this is probably read only - Bit 0 - Enable cartridge slot and/or disable bios - Bit 1 - Hardware type: 0 = WS, 1 = WSC - Bit 2-7 - Unknown - */ - if ((data & 0x01) && !m_bios_disabled) - m_bios_disabled = 1; - break; - - case 0xb0: /* Interrupt base vector - Bit 0-7 - Interrupt base vector - */ - break; - case 0xb1: /* Communication byte - Bit 0-7 - Communication byte - */ - break; - case 0xb2: /* Interrupt enable - Bit 0 - Serial transmit interrupt enable - Bit 1 - Key press interrupt enable - Bit 2 - RTC alarm interrupt enable - Bit 3 - Serial receive interrupt enable - Bit 4 - Drawing line detection interrupt enable - Bit 5 - VBlank timer interrupt enable - Bit 6 - VBlank interrupt enable - Bit 7 - HBlank timer interrupt enable - */ - break; - case 0xb3: /* serial communication control - Bit 0 - Receive complete - Bit 1 - Error - Bit 2 - Send complete - Bit 3-4 - Unknown - Bit 5 - Send data interrupt generation - Bit 6 - Connection speed: 0 = 9600 bps, 1 = 38400 bps - bit 7 - Receive data interrupt generation - */ - // data |= 0x02; - m_ws_portram[0xb1] = 0xff; - if (data & 0x80) - { - // m_ws_portram[0xb1] = 0x00; - data |= 0x04; - } - if (data & 0x20) - { - // data |= 0x01; - } - break; - case 0xb5: /* Read controls - Bit 0-3 - Current state of input lines (read-only) - Bit 4-6 - Select line of inputs to read - 001 - Read Y cursors - 010 - Read X cursors - 100 - Read START,A,B buttons - Bit 7 - Unknown - */ - data = data & 0xf0; - switch (data) - { - case 0x10: /* Read Y cursors: Y1 - Y2 - Y3 - Y4 */ - input = m_cursy->read(); - if (m_rotate) // reorient controls if the console is rotated - { - if (input & 0x01) data |= 0x02; - if (input & 0x02) data |= 0x04; - if (input & 0x04) data |= 0x08; - if (input & 0x08) data |= 0x01; - } - else - data = data | input; - break; - case 0x20: /* Read X cursors: X1 - X2 - X3 - X4 */ - input = m_cursx->read(); - if (m_rotate) // reorient controls if the console is rotated - { - if (input & 0x01) data |= 0x02; - if (input & 0x02) data |= 0x04; - if (input & 0x04) data |= 0x08; - if (input & 0x08) data |= 0x01; - } - else - data = data | input; - break; - case 0x40: /* Read buttons: START - A - B */ - data = data | m_buttons->read(); - break; - } - break; - case 0xb6: /* Interrupt acknowledge - Bit 0 - Serial transmit interrupt acknowledge - Bit 1 - Key press interrupt acknowledge - Bit 2 - RTC alarm interrupt acknowledge - Bit 3 - Serial receive interrupt acknowledge - Bit 4 - Drawing line detection interrupt acknowledge - Bit 5 - VBlank timer interrupt acknowledge - Bit 6 - VBlank interrupt acknowledge - Bit 7 - HBlank timer interrupt acknowledge - */ - clear_irq_line(data); - data = m_ws_portram[0xb6]; - break; - case 0xba: /* Internal EEPROM data (low) - Bit 0-7 - Internal EEPROM data transfer bit 0-7 - */ - case 0xbb: /* Internal EEPROM data (high) - Bit 0-7 - Internal EEPROM data transfer bit 8-15 - */ - break; - case 0xbc: /* Internal EEPROM address (low) - Bit 0-7 - Internal EEPROM address bit 1-8 - */ - case 0xbd: /* Internal EEPROM address (high) - Bit 0 - Internal EEPROM address bit 9(?) - Bit 1-7 - Unknown - Only 1KByte internal EEPROM?? - */ - break; - case 0xbe: /* Internal EEPROM command - Bit 0 - Read complete (read only) - Bit 1 - Write complete (read only) - Bit 2-3 - Unknown - Bit 4 - Read - Bit 5 - Write - Bit 6 - Protect - Bit 7 - Initialize - */ - if (data & 0x20) - { - UINT16 addr = ( ( ( m_ws_portram[0xbd] << 8 ) | m_ws_portram[0xbc] ) << 1 ) & 0x1FF; - m_internal_eeprom[ addr ] = m_ws_portram[0xba]; - m_internal_eeprom[ addr + 1 ] = m_ws_portram[0xbb]; - data |= 0x02; - } - else if ( data & 0x10 ) - { - UINT16 addr = ( ( ( m_ws_portram[0xbd] << 8 ) | m_ws_portram[0xbc] ) << 1 ) & 0x1FF; - m_ws_portram[0xba] = m_internal_eeprom[ addr ]; - m_ws_portram[0xbb] = m_internal_eeprom[ addr + 1]; - data |= 0x01; - } - else - { - logerror( "Unsupported internal EEPROM command: %X\n", data ); - } - break; - case 0xc0: // ROM bank $40000-$fffff - case 0xc1: // SRAM bank - case 0xc2: // ROM bank $20000-$2ffff - case 0xc3: // ROM bank $30000-$3ffff - case 0xc4: - case 0xc5: - case 0xc6: // EEPROM address / command - case 0xc7: // EEPROM address / command - case 0xc8: // EEPROM command - case 0xc9: - case 0xca: // RTC command - case 0xcb: // RTC data - case 0xcc: - case 0xcd: - case 0xce: - case 0xcf: - m_cart->write_io(space, offset & 0x0f, data); - break; - default: - logerror( "Write to unsupported port: %X - %X\n", offset, data ); - break; - } - - /* Update the port value */ - m_ws_portram[offset] = data; -} diff --git a/src/mess/machine/x1.c b/src/mess/machine/x1.c deleted file mode 100644 index f9c40398f20..00000000000 --- a/src/mess/machine/x1.c +++ /dev/null @@ -1,69 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Angelo Salese, Barry Rodewald - -#include "includes/x1.h" - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -const device_type X1_KEYBOARD = &device_creator; - -//------------------------------------------------- -// z80ctc_device - constructor -//------------------------------------------------- - -x1_keyboard_device::x1_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, X1_KEYBOARD, "X1 Keyboard", tag, owner, clock, "x1_keyboard", __FILE__), - device_z80daisy_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void x1_keyboard_device::device_start() -{ -} - -//************************************************************************** -// DAISY CHAIN INTERFACE -//************************************************************************** - -//------------------------------------------------- -// z80daisy_irq_state - return the overall IRQ -// state for this device -//------------------------------------------------- - -int x1_keyboard_device::z80daisy_irq_state() -{ - x1_state *state = machine().driver_data(); - if(state->m_key_irq_flag != 0) - return Z80_DAISY_INT; - return 0; -} - - -//------------------------------------------------- -// z80daisy_irq_ack - acknowledge an IRQ and -// return the appropriate vector -//------------------------------------------------- - -int x1_keyboard_device::z80daisy_irq_ack() -{ - x1_state *state = machine().driver_data(); - state->m_key_irq_flag = 0; - state->m_maincpu->set_input_line(INPUT_LINE_IRQ0,CLEAR_LINE); - return state->m_key_irq_vector; -} - -//------------------------------------------------- -// z80daisy_irq_reti - clear the interrupt -// pending state to allow other interrupts through -//------------------------------------------------- - -void x1_keyboard_device::z80daisy_irq_reti() -{ -} diff --git a/src/mess/machine/x68k_hdc.c b/src/mess/machine/x68k_hdc.c deleted file mode 100644 index bdc1612da23..00000000000 --- a/src/mess/machine/x68k_hdc.c +++ /dev/null @@ -1,431 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/* - - X68000 custom SASI Hard Disk controller - - 0xe96001 (R/W) - SASI data I/O - 0xe96003 (W) - SEL signal high (0) - 0xe96003 (R) - SASI status - - bit 4 = MSG - if 1, content of data line is a message - - bit 3 = Command / Data - if 1, content of data line is a command or status, otherwise it is data. - - bit 2 = I/O - if 0, Host -> Controller (Output), otherwise Controller -> Host (Input). - - bit 1 = BSY - if 1, HD is busy. - - bit 0 = REQ - if 1, host is demanding data transfer to the host. - 0xe96005 (W/O) - data is arbitrary (?) - 0xe96007 (W/O) - SEL signal low (1) - -*/ - -#include "x68k_hdc.h" -#include "imagedev/harddriv.h" -#include "image.h" - -const device_type X68KHDC = &device_creator; - -x68k_hdc_image_device::x68k_hdc_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, X68KHDC, "SASI Hard Disk", tag, owner, clock, "x68k_hdc_image", __FILE__), - device_image_interface(mconfig, *this) -{ -} - -void x68k_hdc_image_device::device_config_complete() -{ - update_names(X68KHDC, "sasihd", "sasi"); -} - -void x68k_hdc_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - m_req = 1; - m_status_port |= 0x01; -} - -void x68k_hdc_image_device::device_start() -{ - m_status = 0x00; - m_status_port = 0x00; - m_phase = SASI_PHASE_BUSFREE; -} - -bool x68k_hdc_image_device::call_create(int format_type, option_resolution *format_options) -{ - // create 20MB HD - int x; - int ret; - unsigned char sectordata[256]; // empty block data - - memset(sectordata,0,sizeof(sectordata)); - for(x=0;x<0x013c98;x++) // 0x13c98 = number of blocks on a 20MB HD - { - ret = fwrite(sectordata,256); - if(ret < 256) - return IMAGE_INIT_FAIL; - } - - return IMAGE_INIT_PASS; -} - -WRITE16_MEMBER( x68k_hdc_image_device::hdc_w ) -{ - unsigned int lba = 0; - std::vector blk; - switch(offset) - { - case 0x00: // data I/O - if(m_phase == SASI_PHASE_WRITE) - { - if(m_transfer_byte_count == 0) - { - switch(m_command[0]) - { - case SASI_CMD_SPECIFY: - m_transfer_byte_total = 10; - break; - case SASI_CMD_WRITE: - m_transfer_byte_total = (0x100 * m_command[4]); - break; - default: - m_transfer_byte_total = 0x100; - } - } - - if(m_command[0] == SASI_CMD_SPECIFY) - { - logerror("SPECIFY: wrote 0x%02x\n",data); - } - - if(m_command[0] == SASI_CMD_WRITE) - { - if(!exists()) - { - m_phase = SASI_PHASE_STATUS; - m_io = 1; // Output - m_status_port |= 0x04; // C/D remains the same - m_status = 0x02; - logerror("SASI: No HD connected.\n"); - } - else - { - fwrite(&data,1); - } - } - - m_req = 0; - m_status_port &= ~0x01; - timer_set(attotime::from_nsec(450)); - m_transfer_byte_count++; - if(m_transfer_byte_count >= m_transfer_byte_total) - { - // End of transfer - m_phase = SASI_PHASE_STATUS; - m_io = 1; - m_status_port |= 0x04; - m_cd = 1; - m_status_port |= 0x08; - logerror("SASI: Write transfer complete\n"); - } - } - if(m_phase == SASI_PHASE_COMMAND) - { - if(m_command_byte_count == 0) - { - // first command byte - m_current_command = data; - switch(data >> 5) // high 3 bits determine command class, and therefore, length - { - case 0: - m_command_byte_total = 6; - break; - case 1: - m_command_byte_total = 10; - break; - case 2: - m_command_byte_total = 8; - break; - default: - m_command_byte_total = 6; - } - } - m_command[m_command_byte_count] = data; - // reset REQ temporarily - m_req = 0; - m_status_port &= ~0x01; - timer_set(attotime::from_nsec(450)); - - m_command_byte_count++; - if(m_command_byte_count >= m_command_byte_total) - { - // End of command - - switch(m_command[0]) - { - case SASI_CMD_REZERO_UNIT: - m_phase = SASI_PHASE_STATUS; - m_io = 1; // Output - m_status_port |= 0x04; // C/D remains the same - logerror("SASI: REZERO UNIT\n"); - break; - case SASI_CMD_REQUEST_SENSE: - m_phase = SASI_PHASE_READ; - m_io = 1; - m_status_port |= 0x04; - m_cd = 0; - m_status_port &= ~0x08; - m_transfer_byte_count = 0; - m_transfer_byte_total = 0; - logerror("SASI: REQUEST SENSE\n"); - break; - case SASI_CMD_SPECIFY: - m_phase = SASI_PHASE_WRITE; - m_io = 0; - m_status_port &= ~0x04; - m_cd = 0; // Data - m_status_port &= ~0x08; - m_transfer_byte_count = 0; - m_transfer_byte_total = 0; - logerror("SASI: SPECIFY\n"); - break; - case SASI_CMD_READ: - if(!exists()) - { - m_phase = SASI_PHASE_STATUS; - m_io = 1; // Output - m_status_port |= 0x04; // C/D remains the same - m_cd = 1; - m_status_port |= 0x08; - m_status = 0x02; - logerror("SASI: No HD connected\n"); - } - else - { - m_phase = SASI_PHASE_READ; - m_io = 1; - m_status_port |= 0x04; - m_cd = 0; - m_status_port &= ~0x08; - m_transfer_byte_count = 0; - m_transfer_byte_total = 0; - lba = m_command[3]; - lba |= m_command[2] << 8; - lba |= (m_command[1] & 0x1f) << 16; - fseek(lba * 256,SEEK_SET); - logerror("SASI: READ (LBA 0x%06x, blocks = %i)\n",lba,m_command[4]); - } - break; - case SASI_CMD_WRITE: - if(!exists()) - { - m_phase = SASI_PHASE_STATUS; - m_io = 1; // Output - m_status_port |= 0x04; // C/D remains the same - m_cd = 1; - m_status_port |= 0x08; - m_status = 0x02; - logerror("SASI: No HD connected\n"); - } - else - { - m_phase = SASI_PHASE_WRITE; - m_io = 0; - m_status_port &= ~0x04; - m_cd = 0; - m_status_port &= ~0x08; - m_transfer_byte_count = 0; - m_transfer_byte_total = 0; - lba = m_command[3]; - lba |= m_command[2] << 8; - lba |= (m_command[1] & 0x1f) << 16; - fseek(lba * 256,SEEK_SET); - logerror("SASI: WRITE (LBA 0x%06x, blocks = %i)\n",lba,m_command[4]); - } - break; - case SASI_CMD_SEEK: - m_phase = SASI_PHASE_STATUS; - m_io = 1; // Output - m_status_port |= 0x04; // C/D remains the same - m_cd = 1; - m_status_port |= 0x08; - logerror("SASI: SEEK (LBA 0x%06x)\n",lba); - break; - case SASI_CMD_FORMAT_UNIT: - case SASI_CMD_FORMAT_UNIT_06: - /* - Format Unit command format (differs from SASI spec?) - 0 | 0x06 - 1 | Unit number (0-7) | LBA MSB (high 5 bits) - 2 | LBA - 3 | LBA LSB - 4 | ?? (usually 0x01) - 5 | ?? - */ - m_phase = SASI_PHASE_STATUS; - m_io = 1; // Output - m_status_port |= 0x04; // C/D remains the same - m_cd = 1; - m_status_port |= 0x08; - lba = m_command[3]; - lba |= m_command[2] << 8; - lba |= (m_command[1] & 0x1f) << 16; - fseek(lba * 256,SEEK_SET); - blk.resize(256*33); - memset(&blk[0], 0, 256*33); - // formats 33 256-byte blocks - fwrite(&blk[0],256*33); - logerror("SASI: FORMAT UNIT (LBA 0x%06x)\n",lba); - break; - default: - m_phase = SASI_PHASE_STATUS; - m_io = 1; // Output - m_status_port |= 0x04; // C/D remains the same - m_status = 0x02; - logerror("SASI: Invalid or unimplemented SASI command (0x%02x) received.\n",m_command[0]); - } - } - } - break; - case 0x01: - if(data == 0) - { - if(m_phase == SASI_PHASE_SELECTION) - { - // Go to Command phase - m_phase = SASI_PHASE_COMMAND; - m_cd = 1; // data port expects a command or status - m_status_port |= 0x08; - m_command_byte_count = 0; - m_command_byte_total = 0; - timer_set(attotime::from_nsec(45)); - } - } - break; - case 0x02: - break; - case 0x03: - if(data != 0) - { - if(m_phase == SASI_PHASE_BUSFREE) - { - // Go to Selection phase - m_phase = SASI_PHASE_SELECTION; - m_bsy = 1; // HDC is now busy - m_status_port |= 0x02; - } - } - break; - } - -// logerror("SASI: write to HDC, offset %04x, data %04x\n",offset,data); -} - -READ16_MEMBER( x68k_hdc_image_device::hdc_r ) -{ - int retval = 0xff; - - switch(offset) - { - case 0x00: - if(m_phase == SASI_PHASE_MESSAGE) - { - m_phase = SASI_PHASE_BUSFREE; - m_msg = 0; - m_cd = 0; - m_io = 0; - m_bsy = 0; - m_req = 0; - m_status = 0; - m_status_port = 0; // reset all status bits to 0 - return 0x00; - } - if(m_phase == SASI_PHASE_STATUS) - { - m_phase = SASI_PHASE_MESSAGE; - m_msg = 1; - m_status_port |= 0x10; - // reset REQ temporarily - m_req = 0; - m_status_port &= ~0x01; - timer_set(attotime::from_nsec(450)); - - return m_status; - } - if(m_phase == SASI_PHASE_READ) - { - if(m_transfer_byte_count == 0) - { - switch(m_command[0]) - { - case SASI_CMD_REQUEST_SENSE: - // set up sense bytes - m_sense[0] = 0x01; // "No index signal" - m_sense[1] = 0; - m_sense[2] = 0; - m_sense[3] = 0; - if(m_command[3] == 0) - m_transfer_byte_total = 4; - else - m_transfer_byte_total = m_command[3]; - break; - case SASI_CMD_READ: - m_transfer_byte_total = (0x100 * m_command[4]); - m_transfer_byte_count = 0; - break; - default: - m_transfer_byte_total = 0; - } - } - - switch(m_command[0]) - { - case SASI_CMD_REQUEST_SENSE: - retval = m_sense[m_transfer_byte_count]; - logerror("REQUEST SENSE: read value 0x%02x\n",retval); - break; - case SASI_CMD_READ: - if(!exists()) - { - m_phase = SASI_PHASE_STATUS; - m_io = 1; // Output - m_status_port |= 0x04; // C/D remains the same - m_status = 0x02; - logerror("SASI: No HD connected.\n"); - } - else - { - unsigned char val; - fread(&val,1); - retval = val; - } - break; - default: - retval = 0; - } - - m_req = 0; - m_status_port &= ~0x01; - timer_set(attotime::from_nsec(450)); - m_transfer_byte_count++; - if(m_transfer_byte_count >= m_transfer_byte_total) - { - // End of transfer - m_phase = SASI_PHASE_STATUS; - m_io = 1; - m_status_port |= 0x04; - m_cd = 1; - m_status_port |= 0x08; - logerror("SASI: Read transfer complete\n"); - } - - return retval; - } - return 0x00; - case 0x01: -// logerror("SASI: [%08x] read from status port, read 0x%02x\n",activecpu_get_pc(),m_status_port); - return m_status_port; - case 0x02: - return 0xff; // write-only - case 0x03: - return 0xff; // write-only - default: - return 0xff; - } -} diff --git a/src/mess/machine/x68k_hdc.h b/src/mess/machine/x68k_hdc.h deleted file mode 100644 index 73fc210fa63..00000000000 --- a/src/mess/machine/x68k_hdc.h +++ /dev/null @@ -1,130 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/* - - X68000 Custom SASI HD controller - -*/ - -#include "emu.h" - -enum -{ - SASI_PHASE_BUSFREE = 0, - SASI_PHASE_ARBITRATION, - SASI_PHASE_SELECTION, - SASI_PHASE_RESELECTION, - SASI_PHASE_COMMAND, - SASI_PHASE_DATA, - SASI_PHASE_STATUS, - SASI_PHASE_MESSAGE, - SASI_PHASE_READ, - SASI_PHASE_WRITE -}; - -// SASI commands, based on the SASI standard -enum -{ - // Class 0 (6-byte) commands - SASI_CMD_TEST_UNIT_READY = 0, - SASI_CMD_REZERO_UNIT, - SASI_CMD_RESERVED_02, - SASI_CMD_REQUEST_SENSE, - SASI_CMD_FORMAT_UNIT, - SASI_CMD_RESERVED_05, - SASI_CMD_FORMAT_UNIT_06, // the X68000 uses command 0x06 for Format Unit, despite the SASI specs saying 0x04 - SASI_CMD_RESERVED_07, - SASI_CMD_READ, - SASI_CMD_RESERVED_09, - SASI_CMD_WRITE, - SASI_CMD_SEEK, - SASI_CMD_RESERVED_0C, - SASI_CMD_RESERVED_0D, - SASI_CMD_RESERVED_0E, - SASI_CMD_WRITE_FILE_MARK, - SASI_CMD_INVALID_10, - SASI_CMD_INVALID_11, - SASI_CMD_RESERVE_UNIT, - SASI_CMD_RELEASE_UNIT, - SASI_CMD_INVALID_14, - SASI_CMD_INVALID_15, - SASI_CMD_READ_CAPACITY, - SASI_CMD_INVALID_17, - SASI_CMD_INVALID_18, - SASI_CMD_INVALID_19, - SASI_CMD_READ_DIAGNOSTIC, - SASI_CMD_WRITE_DIAGNOSTIC, - SASI_CMD_INVALID_1C, - SASI_CMD_INVALID_1D, - SASI_CMD_INVALID_1E, - SASI_CMD_INQUIRY, - // Class 1 commands (yes, just the one) - SASI_CMD_RESERVED_20, - SASI_CMD_RESERVED_21, - SASI_CMD_RESERVED_22, - SASI_CMD_SET_BLOCK_LIMITS = 0x28, - // Class 2 commands - SASI_CMD_EXTENDED_ADDRESS_READ = 0x48, - SASI_CMD_INVALID_49, - SASI_CMD_EXTENDED_ADDRESS_WRITE, - SASI_CMD_WRITE_AND_VERIFY = 0x54, - SASI_CMD_VERIFY, - SASI_CMD_INVALID_56, - SASI_CMD_SEARCH_DATA_HIGH, - SASI_CMD_SEARCH_DATA_EQUAL, - SASI_CMD_SEARCH_DATA_LOW, - // controller-specific commands - SASI_CMD_SPECIFY = 0xc2 -}; - -class x68k_hdc_image_device : public device_t, - public device_image_interface -{ -public: - // construction/destruction - x68k_hdc_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // image-level overrides - virtual iodevice_t image_type() const { return IO_HARDDISK; } - - virtual bool is_readable() const { return 1; } - virtual bool is_writeable() const { return 1; } - virtual bool is_creatable() const { return 1; } - virtual bool must_be_loaded() const { return 0; } - virtual bool is_reset_on_load() const { return 0; } - virtual const char *image_interface() const { return NULL; } - virtual const char *file_extensions() const { return "hdf"; } - virtual const option_guide *create_option_guide() const { return NULL; } - virtual bool call_create(int format_type, option_resolution *format_options); - - DECLARE_WRITE16_MEMBER( hdc_w ); - DECLARE_READ16_MEMBER( hdc_r ); -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -private: - int m_phase; - unsigned char m_status_port; // read at 0xe96003 - unsigned char m_status; // status phase output - //unsigned char m_message; - unsigned char m_command[10]; - unsigned char m_sense[4]; - int m_command_byte_count; - int m_command_byte_total; - int m_current_command; - int m_transfer_byte_count; - int m_transfer_byte_total; - int m_msg; // MSG - int m_cd; // C/D (Command/Data) - int m_bsy; // BSY - int m_io; // I/O - int m_req; // REQ -}; - -// device type definition -extern const device_type X68KHDC; - -#define MCFG_X68KHDC_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, X68KHDC, 0) diff --git a/src/mess/machine/x68k_kbd.c b/src/mess/machine/x68k_kbd.c deleted file mode 100644 index 18984549707..00000000000 --- a/src/mess/machine/x68k_kbd.c +++ /dev/null @@ -1,452 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -#include "machine/x68k_kbd.h" - -x68k_keyboard_device::x68k_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, X68K_KEYBOARD, "X68k Keyboard", tag, owner, 0, "x68k_keyboard", __FILE__), - m_io_kbd8(*this, "TERM_LINE8"), - m_io_kbd9(*this, "TERM_LINE9"), - m_io_kbda(*this, "TERM_LINEA"), - m_io_kbdb(*this, "TERM_LINEB"), - m_io_kbdd(*this, "TERM_LINED"), - m_io_kbde(*this, "TERM_LINEE") -{ -} - - -void x68k_keyboard_device::write(UINT8 data) -{ - /* Keyboard control commands: - 00xxxxxx - TV Control - Not of much use as yet - - 01000xxy - y = Mouse control signal - - 01001xxy - y = Keyboard enable - - 010100xy - y = Sharp X1 display compatibility mode - - 010101xx - xx = LED brightness (00 = bright, 11 = dark) - - 010110xy - y = Display control enable - - 010111xy - y = Display control via the Opt. 2 key enable - - 0110xxxx - xxxx = Key delay (default 500ms) - 100 * (delay time) + 200ms - - 0111xxxx - xxxx = Key repeat rate (default 110ms) - (repeat rate)^2*5 + 30ms - - 1xxxxxxx - xxxxxxx = keyboard LED status - b6 = "full size" - b5 = hiragana - b4 = insert - b3 = caps - b2 = code input - b1 = romaji input - b0 = kana - */ - - if(data & 0x80) // LED status - { - output_set_value("key_led_kana",(data & 0x01) ? 0 : 1); - output_set_value("key_led_romaji",(data & 0x02) ? 0 : 1); - output_set_value("key_led_code",(data & 0x04) ? 0 : 1); - output_set_value("key_led_caps",(data & 0x08) ? 0 : 1); - output_set_value("key_led_insert",(data & 0x10) ? 0 : 1); - output_set_value("key_led_hiragana",(data & 0x20) ? 0 : 1); - output_set_value("key_led_fullsize",(data & 0x40) ? 0 : 1); - logerror("KB: LED status set to %02x\n",data & 0x7f); - } - - if((data & 0xc0) == 0) // TV control - { - // nothing for now - } - - if((data & 0xf8) == 0x48) // Keyboard enable - { - m_enabled = data & 0x01; - logerror("KB: Keyboard enable bit = %i\n",m_enabled); - } - - if((data & 0xf0) == 0x60) // Key delay time - { - m_delay = data & 0x0f; - logerror("KB: Keypress delay time is now %ims\n",(data & 0x0f)*100+200); - } - - if((data & 0xf0) == 0x70) // Key repeat rate - { - m_repeat = data & 0x0f; - logerror("KB: Keypress repeat rate is now %ims\n",((data & 0x0f)^2)*5+30); - } -} - -UINT8 x68k_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) -{ - if (m_enabled) - { - for (int row = 0; row < 15; row++ ) - { - UINT8 data = 0; - - if (row == 0) data = m_io_kbd0->read(); - else - if (row == 1) data = m_io_kbd1->read(); - else - if (row == 2) data = m_io_kbd2->read(); - else - if (row == 3) data = m_io_kbd3->read(); - else - if (row == 4) data = m_io_kbd4->read(); - else - if (row == 5) data = m_io_kbd5->read(); - else - if (row == 6) data = m_io_kbd6->read(); - else - if (row == 7) data = m_io_kbd7->read(); - else - if (row == 8) data = m_io_kbd8->read(); - else - if (row == 9) data = m_io_kbd9->read(); - else - if (row == 10) data = m_io_kbda->read(); - else - if (row == 11) data = m_io_kbdb->read(); - else - if (row == 12) data = m_io_kbdc->read(); - else - if (row == 13) data = m_io_kbdd->read(); - else - if (row == 14) data = m_io_kbde->read(); - - for (int column = 0; column < 8; column++ ) - { - int new_down = (data & (1 << column)) != 0; - int scan_code = (row * 8) + column; - int old_down = m_key_down[scan_code]; - m_key_down[scan_code] = new_down; - - if (new_down && !old_down) - { - m_repeat_code = scan_code; - m_until_repeat = m_delay * 240; - - return scan_code; - } - else if(!new_down && old_down) - { - m_repeat_code = 0; - return scan_code + 0x80; - } - } - } - - if (m_repeat_code > 0 && m_key_down[m_repeat_code]) - { - m_until_repeat--; - if (m_until_repeat == 0) - { - m_until_repeat = m_repeat * 240; - return m_repeat_code; - } - } - } - - return 0; -} - -static INPUT_PORTS_START( x68k_keyboard ) - - PORT_START("TERM_LINE0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) // unused - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) /* ESC */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 ! \xE3\x83\x8C") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') /* 1 ! */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \" \xE3\x83\x95") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') /* 2 " */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 # \xE3\x82\xA2 \xE3\x82\xA1") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') /* 3 # */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $ \xE3\x82\xA6 \xE3\x82\xA5") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') /* 4 $ */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 % \xE3\x82\xA8 \xE3\x82\xA7") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') /* 5 % */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 & \xE3\x82\xAA \xE3\x82\xA9") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') /* 6 & */ - - PORT_START("TERM_LINE1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \' \xE3\x83\xA4 \xE3\x83\xA3") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') /* 7 ' */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 ( \xE3\x83\xA6 \xE3\x83\xA5") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') /* 8 ( */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 ) \xE3\x83\xA8 \xE3\x83\xA7") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') /* 9 ) */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 \xE3\x83\xAF \xE3\x83\xB2") PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0 */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- = \xE3\x83\x9B") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') /* - = */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("^ \xE3\x83\x98") PORT_CHAR('^') /* ^ */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA5 \xE3\x83\xBC |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') /* Yen | */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* Backspace */ - - PORT_START("TERM_LINE2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* Tab */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q \xE3\x82\xBF") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* Q */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W \xE3\x83\x86") PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* W */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E \xE3\x82\xA4 \xE3\x82\xA3") PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* E */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R \xE3\x82\xB9") PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* R */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T \xE3\x82\xAB") PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* T */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y \xE3\x83\xB3") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* Y */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U \xE3\x83\x8A") PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* U */ - - PORT_START("TERM_LINE3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I \xE3\x83\x8B") PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* I */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O \xE3\x83\xA9") PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* O */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P \xE3\x82\xBB") PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* P */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ ` \xE3\x82\x9B") PORT_CHAR('@') PORT_CHAR('`') /* @ */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ { \xE3\x82\x9C \xE3\x80\x8C") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') /* [ { */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* Return */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A \xE3\x83\x81") PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* A */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S \xE3\x83\x88") PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* S */ - - PORT_START("TERM_LINE4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D \xE3\x82\xB7") PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* D */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F \xE3\x83\x8F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* F */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G \xE3\x82\xAD") PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* G */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H \xE3\x82\xAF") PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* H */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J \xE3\x83\x9E") PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* J */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K \xE3\x83\x8E") PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* K */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L \xE3\x83\xAA") PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* L */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; + \xE3\x83\xAC") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') /* ; + */ - - PORT_START("TERM_LINE5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": * \xE3\x82\xB1") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') /* : * */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] } \xE3\x83\xA0 \xE3\x80\x8D") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') /* ] } */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z \xE3\x83\x84 \xE3\x83\x83") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* Z */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X \xE3\x82\xB5") PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* X */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C \xE3\x82\xBD") PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* C */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V \xE3\x83\x92") PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* V */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B \xE3\x82\xB3") PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* B */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N \xE3\x83\x9F") PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* N */ - - PORT_START("TERM_LINE6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M \xE3\x83\xA2") PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* M */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", < \xE3\x83\x8D \xE3\x80\x81") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') /* , < */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". > \xE3\x83\xAB \xE3\x80\x82") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') /* . > */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ? \xE3\x83\xA1 \xE3\x83\xBB") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') /* / ? */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_ \xE3\x83\xAD") PORT_CHAR('_') /* Underscore (shifted only?) */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') /* Space */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* Home */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) /* Del */ - - PORT_START("TERM_LINE7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_PGUP) /* Roll Up */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_PGDN) /* Roll Down */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Undo") PORT_CODE(KEYCODE_END) /* Undo */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) /* Left */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) /* Up */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /* Right */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) /* Down */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey CLR") PORT_CODE(KEYCODE_NUMLOCK) /* CLR */ - - PORT_START("TERM_LINE8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) /* / (numpad) */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) /* * (numpad) */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) /* - (numpad) */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) /* 7 (numpad) */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) /* 8 (numpad) */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) /* 9 (numpad) */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) /* + (numpad) */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) /* 4 (numpad) */ - - PORT_START("TERM_LINE9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) /* 5 (numpad) */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) /* 6 (numpad) */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey =") /* = (numpad) */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) /* 1 (numpad) */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) /* 2 (numpad) */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) /* 3 (numpad) */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* Enter (numpad) */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) /* 0 (numpad) */ - - PORT_START("TERM_LINEA") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey ,") /* , (numpad) */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) /* 2 (numpad) */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE8\xA8\x98\xE5\x8F\xB7 (Symbolic input)") /* Sign / Symbolic input (babelfish translation) */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE7\x99\xBB\xE9\x8C\xB2 (Register)") /* Register (babelfish translation) */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") /* Help */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF1") PORT_CODE(KEYCODE_F11) /* XF1 */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF2") PORT_CODE(KEYCODE_F12) /* XF2 */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF3") /* XF3 */ - - PORT_START("TERM_LINEB") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF4") /* XF4 */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF5") /* XF5 */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xe3\x81\x8b\xe3\x81\xaa (Kana)") /* Kana */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xe3\x83\xad\xe3\x83\xbc\xe3\x83\x9e\xe5\xad\x97 (Romaji)") /* Romaji */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89 (Code input)") /* Code input */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) /* Caps lock */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) /* Insert */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x81\xB2\xE3\x82\x89\xE3\x81\x8C\xE3\x81\xAA (Hiragana)") /* Hiragana */ - - PORT_START("TERM_LINEC") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE5\x85\xA8\xE8\xA7\x92 (Full size)") /* Full size (babelfish translation) */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") /* Break */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Copy") /* Copy */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) /* F1 */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) /* F2 */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) /* F3 */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) /* F4 */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) /* F5 */ - - PORT_START("TERM_LINED") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) /* F6 */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) /* F7 */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) /* F8 */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) /* F9 */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) /* F10 */ - // 0x6d reserved - // 0x6e reserved - // 0x6f reserved - - PORT_START("TERM_LINEE") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) /* Shift */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) /* Ctrl */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Opt. 1") PORT_CODE(KEYCODE_PRTSCR) /* Opt1 */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Opt. 2") PORT_CODE(KEYCODE_PAUSE) /* Opt2 */ - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_38400, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_38400, "38400") // TODO: Should be 2400 but MC68901 doesn't support divide by 16 - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_NONE, "None") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_1, "1") -INPUT_PORTS_END - -ioport_constructor x68k_keyboard_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(x68k_keyboard); -} - -void x68k_keyboard_device::device_start() -{ - serial_keyboard_device::device_start(); - set_rcv_rate(38400); // TODO: Should be 2400 but MC68901 doesn't support divide by 16 -} - -void x68k_keyboard_device::device_reset() -{ - serial_keyboard_device::device_reset(); - - m_enabled = 0; - m_delay = 500; // 3*100+200 - m_repeat = 110; // 4^2*5+30 - m_repeat_code = 0; - - memset(m_key_down, 0, sizeof(m_key_down)); -} - -void x68k_keyboard_device::rcv_complete() -{ - receive_register_extract(); - write(get_received_char()); -} - -const device_type X68K_KEYBOARD = &device_creator; - -#if 0 - -void x68k_state::x68k_keyboard_push_scancode(unsigned char code) -{ - m_keynum++; - if(m_keynum >= 1) - { - // keyboard buffer full - if(m_enabled != 0) - { - //m_mfp.rsr |= 0x80; // Buffer full - //if(ioport("options")->read() & 0x01) - //{ - // m_current_vector[6] = 0x4c; - // m_maincpu->set_input_line_and_vector(6,ASSERT_LINE,0x4c); - // logerror("MFP: Receive buffer full IRQ sent\n"); - //} - } - } - m_buffer[m_headpos++] = code; - if(m_headpos > 15) - { - m_headpos = 0; - m_current_vector[6] = 0x4b; - } -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_keyboard_poll) -{ - int x; - static const char *const keynames[] = { "key1", "key2", "key3", "key4" }; - - for(x=0;x<0x80;x++) - { - // adjust delay/repeat timers - if(m_keytime[x] > 0) - { - m_keytime[x] -= 5; - } - if(!(ioport(keynames[x / 32])->read() & (1 << (x % 32)))) - { - if(m_keyon[x] != 0) - { - x68k_keyboard_push_scancode(0x80 + x); - m_keytime[x] = 0; - m_keyon[x] = 0; - m_last_pressed = 0; - logerror("KB: Released key 0x%02x\n",x); - } - } - // check to see if a key is being held - if(m_keyon[x] != 0 && m_keytime[x] == 0 && m_last_pressed == x) - { - if(ioport(keynames[m_last_pressed / 32])->read() & (1 << (m_last_pressed % 32))) - { - x68k_keyboard_push_scancode(m_last_pressed); - m_keytime[m_last_pressed] = (m_repeat^2)*5+30; - logerror("KB: Holding key 0x%02x\n",m_last_pressed); - } - } - if((ioport(keynames[x / 32])->read() & (1 << (x % 32)))) - { - if(m_keyon[x] == 0) - { - x68k_keyboard_push_scancode(x); - m_keytime[x] = m_delay * 100 + 200; - m_keyon[x] = 1; - m_last_pressed = x; - logerror("KB: Pushed key 0x%02x\n",x); - } - } - } -} - - struct - { - unsigned char led_status; // keyboard LED status - unsigned char buffer[16]; - int headpos; // scancodes are added here - int tailpos; // scancodes are read from here - int keynum; // number of scancodes in buffer - int keytime[0x80]; // time until next keypress - int keyon[0x80]; // is 1 if key is pressed, used to determine if the key state has changed from 1 to 0 - int last_pressed; // last key pressed, for repeat key handling - } m_keyboard; - TIMER_CALLBACK_MEMBER(x68k_led_callback); - TIMER_CALLBACK_MEMBER(x68k_keyboard_poll); - void x68k_keyboard_ctrl_w(int data); - int x68k_keyboard_pop_scancode(); - void x68k_keyboard_push_scancode(unsigned char code); - -#endif diff --git a/src/mess/machine/x68k_kbd.h b/src/mess/machine/x68k_kbd.h deleted file mode 100644 index bc4908e7d03..00000000000 --- a/src/mess/machine/x68k_kbd.h +++ /dev/null @@ -1,41 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -#ifndef X68K_KBD_H_ -#define X68K_KBD_H_ - -#include "bus/rs232/keyboard.h" - -class x68k_keyboard_device : public serial_keyboard_device -{ -public: - x68k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ioport_constructor device_input_ports() const; - -protected: - virtual void device_start(); - virtual void device_reset(); - virtual void rcv_complete(); - -private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); - void write(UINT8 data); - - required_ioport m_io_kbd8; - required_ioport m_io_kbd9; - required_ioport m_io_kbda; - required_ioport m_io_kbdb; - required_ioport m_io_kbdd; - required_ioport m_io_kbde; - - int m_delay; // keypress delay after initial press - int m_repeat; // keypress repeat rate - int m_enabled; // keyboard enabled? - - UINT8 m_key_down[15*8]; - int m_repeat_code; - int m_until_repeat; -}; - -extern const device_type X68K_KEYBOARD; - -#endif /* X68KKBD_H_ */ diff --git a/src/mess/machine/x820kb.c b/src/mess/machine/x820kb.c deleted file mode 100644 index 115e8591e4a..00000000000 --- a/src/mess/machine/x820kb.c +++ /dev/null @@ -1,387 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Xerox 820/820-II ASCII keyboard emulation - -*********************************************************************/ - -/* - -PCB Layout ----------- - -Maxi-Switch Co. -630107-02 - -|-----------------------------------------------------------------------| -| |--CN1--| CN2 | -| 8748 6MHz 74154 * | -| | -|-----------------------------------------------------------------------| - -Notes: - All IC's shown. - - 8048 - NEC D8748D - 74154 - 4-line to 16-line decoder/multiplexer - * - unpopulated 8-pin chip - CN1 - 2x16 PCB header - CN2 - unpopulated RJ-45? connector - -*/ - -/* - - TODO: - - - repeat - - what are T0/T1/INT? - -*/ - -#include "x820kb.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define I8748_TAG "i8748" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type XEROX_820_KEYBOARD = &device_creator; - - -//------------------------------------------------- -// ROM( xerox_820_keyboard ) -//------------------------------------------------- - -ROM_START( xerox_820_keyboard ) - ROM_REGION( 0x400, I8748_TAG, 0 ) - ROM_LOAD( "820iikey.bin", 0x000, 0x400, CRC(8ea3b39b) SHA1(3f05959f54a558b273567b1b4f0c7cdf46d8d9bf) ) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *xerox_820_keyboard_t::device_rom_region() const -{ - return ROM_NAME( xerox_820_keyboard ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( kb_io ) -//------------------------------------------------- - -static ADDRESS_MAP_START( xerox_820_keyboard_io, AS_IO, 8, xerox_820_keyboard_t ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) - AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(kb_p2_r) AM_WRITENOP - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(kb_t0_r) - AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T1) AM_READ(kb_t1_r) - AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(kb_bus_w) -ADDRESS_MAP_END - - -//------------------------------------------------- -// MACHINE_DRIVER( xerox_820_keyboard ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( xerox_820_keyboard ) - MCFG_CPU_ADD(I8748_TAG, I8048, XTAL_6MHz) - MCFG_CPU_IO_MAP(xerox_820_keyboard_io) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor xerox_820_keyboard_t::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( xerox_820_keyboard ); -} - - -//------------------------------------------------- -// INPUT_PORTS( xerox_820_keyboard ) -//------------------------------------------------- - -INPUT_PORTS_START( xerox_820_keyboard ) - PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - - PORT_START("Y1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - - PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') PORT_CHAR('`') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_CHAR('~') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - - PORT_START("Y3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR('\\') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - - PORT_START("Y4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // ; = - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // : < > - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - - PORT_START("Y5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - - PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_TILDE) - - PORT_START("Y7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) - - PORT_START("Y8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - - PORT_START("YF") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) -INPUT_PORTS_END - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -ioport_constructor xerox_820_keyboard_t::device_input_ports() const -{ - return INPUT_PORTS_NAME( xerox_820_keyboard ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// xerox_820_keyboard_t - constructor -//------------------------------------------------- - -xerox_820_keyboard_t::xerox_820_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, XEROX_820_KEYBOARD, "Xerox 820 Keyboard", tag, owner, clock, "x820kb", __FILE__), - m_maincpu(*this, I8748_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_yf(*this, "YF"), - m_kbstb_cb(*this), - m_p1(0xff), - m_bus(0xff) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void xerox_820_keyboard_t::device_start() -{ - // state saving - save_item(NAME(m_p1)); - save_item(NAME(m_bus)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void xerox_820_keyboard_t::device_reset() -{ - m_kbstb_cb.resolve_safe(); -} - -void xerox_820_keyboard_t::device_reset_after_children() -{ - m_maincpu->set_input_line(MCS48_INPUT_IRQ, ASSERT_LINE); -} - - -//------------------------------------------------- -// kb_p1_r - -//------------------------------------------------- - -READ8_MEMBER( xerox_820_keyboard_t::kb_p1_r ) -{ - return m_p1; // TODO: move to mcs48.c -} - - -//------------------------------------------------- -// kb_p1_w - -//------------------------------------------------- - -WRITE8_MEMBER( xerox_820_keyboard_t::kb_p1_w ) -{ - /* - - bit description - - 0 A0 - 1 A1 - 2 A2 - 3 A3 - 4 KBSTB - 5 - 6 - 7 ? (toggled if T1=0) - - */ - - m_p1 = data; - - m_kbstb_cb(BIT(data, 4) ? CLEAR_LINE : ASSERT_LINE); -} - - -//------------------------------------------------- -// kb_p2_r - -//------------------------------------------------- - -READ8_MEMBER( xerox_820_keyboard_t::kb_p2_r ) -{ - UINT8 data = 0xff; - - switch (m_p1 & 0x0f) - { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 0xf: data &= m_yf->read(); break; - } - - return data; -} - - -//------------------------------------------------- -// kb_t0_r - -//------------------------------------------------- - -READ8_MEMBER( xerox_820_keyboard_t::kb_t0_r ) -{ - UINT8 data = 1; - - switch (m_p1 & 0x0f) - { - case 0xd: data = 1; break; // ??? if 0, return key data | 0x80 - case 0xe: data = 1; break; // ??? if 0, set r6=1 - } - - return data; -} - - -//------------------------------------------------- -// kb_t1_r - -//------------------------------------------------- - -READ8_MEMBER( xerox_820_keyboard_t::kb_t1_r ) -{ - return 1; // ??? if 0, toggle P17 -} - - -//------------------------------------------------- -// kb_bus_w - -//------------------------------------------------- - -WRITE8_MEMBER( xerox_820_keyboard_t::kb_bus_w ) -{ - m_bus = data; -} diff --git a/src/mess/machine/x820kb.h b/src/mess/machine/x820kb.h deleted file mode 100644 index 03a3054c486..00000000000 --- a/src/mess/machine/x820kb.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Xerox 820/820-II ASCII keyboard emulation - -*********************************************************************/ - -#pragma once - -#ifndef __XEROX_820_KEYBOARD__ -#define __XEROX_820_KEYBOARD__ - -#include "emu.h" -#include "cpu/mcs48/mcs48.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(_devcb) \ - devcb = &xerox_820_keyboard_t::set_kbstb_wr_callback(*device, DEVCB_##_devcb); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> xerox_820_keyboard_t - -class xerox_820_keyboard_t : public device_t -{ -public: - // construction/destruction - xerox_820_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_kbstb_wr_callback(device_t &device, _Object object) { return downcast(device).m_kbstb_cb.set_callback(object); } - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - - UINT8 read() { return m_bus; } - - DECLARE_READ8_MEMBER( kb_p1_r ); - DECLARE_WRITE8_MEMBER( kb_p1_w ); - DECLARE_READ8_MEMBER( kb_p2_r ); - DECLARE_READ8_MEMBER( kb_t0_r ); - DECLARE_READ8_MEMBER( kb_t1_r ); - DECLARE_WRITE8_MEMBER( kb_bus_w ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_reset_after_children(); - -private: - required_device m_maincpu; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_yf; - - devcb_write_line m_kbstb_cb; - - UINT8 m_p1; - UINT8 m_bus; -}; - - -// device type definition -extern const device_type XEROX_820_KEYBOARD; - - - -#endif diff --git a/src/mess/machine/z80bin.c b/src/mess/machine/z80bin.c deleted file mode 100644 index ac18c8e7e11..00000000000 --- a/src/mess/machine/z80bin.c +++ /dev/null @@ -1,77 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -#include "emu.h" -#include "machine/z80bin.h" - -/*------------------------------------------------- - z80bin_load_file - load a z80bin file into - memory --------------------------------------------------*/ - -int z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ) -{ - int ch; - UINT16 args[3]; - UINT16 i=0, j, size; - UINT8 data; - char pgmname[256]; - char message[256]; - - image->fseek(7, SEEK_SET); - - while((ch = image->fgetc()) != 0x1A) - { - if (ch == EOF) - { - image->seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file name"); - image->message(" Unexpected EOF while getting file name"); - return IMAGE_INIT_FAIL; - } - - if (ch != '\0') - { - if (i >= (ARRAY_LENGTH(pgmname) - 1)) - { - image->seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long"); - image->message(" File name too long"); - return IMAGE_INIT_FAIL; - } - - pgmname[i] = ch; /* build program name */ - i++; - } - } - - pgmname[i] = '\0'; /* terminate string with a null */ - - if (image->fread(args, sizeof(args)) != sizeof(args)) - { - image->seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size"); - image->message(" Unexpected EOF while getting file size"); - return IMAGE_INIT_FAIL; - } - - exec_addr[0] = LITTLE_ENDIANIZE_INT16(args[0]); - start_addr[0] = LITTLE_ENDIANIZE_INT16(args[1]); - end_addr[0] = LITTLE_ENDIANIZE_INT16(args[2]); - - size = (end_addr[0] - start_addr[0] + 1) & 0xffff; - - /* display a message about the loaded quickload */ - image->message(" %s\nsize=%04X : start=%04X : end=%04X : exec=%04X",pgmname,size,start_addr[0],end_addr[0],exec_addr[0]); - - for (i = 0; i < size; i++) - { - j = (start_addr[0] + i) & 0xffff; - if (image->fread(&data, 1) != 1) - { - snprintf(message, ARRAY_LENGTH(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); - image->seterror(IMAGE_ERROR_INVALIDIMAGE, message); - image->message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); - return IMAGE_INIT_FAIL; - } - space.write_byte(j, data); - } - - return IMAGE_INIT_PASS; -} diff --git a/src/mess/machine/z80bin.h b/src/mess/machine/z80bin.h deleted file mode 100644 index 1690ebffcda..00000000000 --- a/src/mess/machine/z80bin.h +++ /dev/null @@ -1,18 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/********************************************************************* - - machine/z80bin.h - - Quickload code for Z80 bin format - -*********************************************************************/ - -#pragma once - -#ifndef __Z80_BIN__ -#define __Z80_BIN__ - -int z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ); - -#endif diff --git a/src/mess/machine/z80ne.c b/src/mess/machine/z80ne.c deleted file mode 100644 index 3e5bce4522e..00000000000 --- a/src/mess/machine/z80ne.c +++ /dev/null @@ -1,770 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Roberto Lavarone -/*********************************************************************** - - machine/z80ne.c - - Functions to emulate general aspects of the machine (RAM, ROM, - interrupts, I/O ports) - -***********************************************************************/ - -/* Core includes */ -#include "emu.h" -#include "includes/z80ne.h" - -/* Components */ -#include "machine/ay31015.h" - -/* Devices */ -#include "imagedev/flopdrv.h" - -#define VERBOSE 0 -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - - - - - -/* timer to read cassette waveforms */ - -cassette_image_device* z80ne_state::cassette_device_image() -{ - if (m_lx385_ctrl & 0x08) - return m_cassette2; - else - return m_cassette1; -} - -TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_cassette_tc) -{ - UINT8 cass_ws = 0; - m_cass_data.input.length++; - - cass_ws = ((cassette_device_image())->input() > +0.02) ? 1 : 0; - - if ((cass_ws ^ m_cass_data.input.level) & cass_ws) - { - m_cass_data.input.level = cass_ws; - m_cass_data.input.bit = ((m_cass_data.input.length < m_cass_data.wave_filter) || (m_cass_data.input.length > 0x20)) ? 1 : 0; - m_cass_data.input.length = 0; - m_ay31015->set_input_pin(AY31015_SI, m_cass_data.input.bit); - } - m_cass_data.input.level = cass_ws; - - /* saving a tape - convert the serial stream from the uart */ - - m_cass_data.output.length--; - - if (!(m_cass_data.output.length)) - { - if (m_cass_data.output.level) - m_cass_data.output.level = 0; - else - { - m_cass_data.output.level=1; - cass_ws = m_ay31015->get_output_pin(AY31015_SO); - m_cass_data.wave_length = cass_ws ? m_cass_data.wave_short : m_cass_data.wave_long; - } - cassette_device_image()->output(m_cass_data.output.level ? -1.0 : +1.0); - m_cass_data.output.length = m_cass_data.wave_length; - } -} - - -DRIVER_INIT_MEMBER(z80ne_state,z80ne) -{ - /* first two entries point to rom on reset */ - UINT8 *RAM = m_region_z80ne->base(); - m_bank1->configure_entry(0, &RAM[0x00000]); /* RAM at 0x0000 */ - m_bank1->configure_entry(1, &RAM[0x14000]); /* ep382 at 0x0000 */ - m_bank2->configure_entry(0, &RAM[0x14000]); /* ep382 at 0x8000 */ -} - -DRIVER_INIT_MEMBER(z80ne_state,z80net) -{ - DRIVER_INIT_CALL(z80ne); -} - -DRIVER_INIT_MEMBER(z80ne_state,z80netb) -{ -} - -DRIVER_INIT_MEMBER(z80ne_state,z80netf) -{ - /* first two entries point to rom on reset */ - UINT8 *RAM = m_region_z80ne->base(); - m_bank1->configure_entry(0, &RAM[0x00000]); /* RAM at 0x0000-0x03FF */ - m_bank1->configure_entries(1, 3, &RAM[0x14400], 0x0400); /* ep390, ep1390, ep2390 at 0x0000-0x03FF */ - m_bank1->configure_entry(4, &RAM[0x14000]); /* ep382 at 0x0000-0x03FF */ - m_bank1->configure_entry(5, &RAM[0x10000]); /* ep548 at 0x0000-0x03FF */ - - m_bank2->configure_entry(0, &RAM[0x00400]); /* RAM at 0x0400 */ - m_bank2->configure_entry(1, &RAM[0x10400]); /* ep548 at 0x0400-0x3FFF */ - - m_bank3->configure_entry(0, &RAM[0x08000]); /* RAM at 0x8000 */ - m_bank3->configure_entry(1, &RAM[0x14000]); /* ep382 at 0x8000 */ - - m_bank4->configure_entry(0, &RAM[0x0F000]); /* RAM at 0xF000 */ - m_bank4->configure_entries(1, 3, &RAM[0x14400], 0x0400); /* ep390, ep1390, ep2390 at 0xF000 */ - -} - -TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_kbd_scan) -{ - /* - * NE555 is connected to a 74LS93 binary counter - * 74LS93 output: - * QA-QC: column index for LEDs and keyboard - * QD: keyboard row select - * - * Port F0 input bit assignment: - * 0 QA bits 0..3 of row counter - * 1 QB - * 2 QC - * 3 QD - * 4 Control button pressed, active high - * 5 Always low - * 6 Always low - * 7 Selected button pressed, active low - * - * - */ - - UINT16 key_bits; - UINT8 ctrl; //, rst; - UINT8 i; - - /* 4-bit counter */ - --m_lx383_scan_counter; - m_lx383_scan_counter &= 0x0f; - - if ( --m_lx383_downsampler == 0 ) - { - m_lx383_downsampler = LX383_DOWNSAMPLING; - key_bits = (m_io_row1->read() << 8) | m_io_row0->read(); -// rst = m_io_rst->read(); - ctrl = m_io_ctrl->read(); - - for ( i = 0; i>= 1; - } - } -} - -DIRECT_UPDATE_MEMBER(z80ne_state::z80ne_default) -{ - return address; -} -/* - * Handle NMI delay for single step instruction - */ -DIRECT_UPDATE_MEMBER(z80ne_state::z80ne_nmi_delay_count) -{ - m_nmi_delay_counter--; - - if (!m_nmi_delay_counter) - { - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } - return address; -} - -/* - * Handle delayed ROM/RAM banking at RESET - * after the first reset_delay_counter bytes have been read from ROM, switch the RAM back in - */ -DIRECT_UPDATE_MEMBER(z80ne_state::z80ne_reset_delay_count) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - /* - * TODO: when debugger is active, his memory access causes this callback - * - */ - if(!space.debugger_access()) - m_reset_delay_counter--; - - if (!m_reset_delay_counter) - { - /* remove this callback */ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); - /* and switch to RAM bank at address 0x0000 */ - m_bank1->set_entry( 0 ); /* RAM at 0x0000 (bank 1) */ - } - return address; -} - -void z80ne_state::reset_lx388() -{ - m_lx388_kr2376->set_input_pin( KR2376_DSII, 0); - m_lx388_kr2376->set_input_pin( KR2376_PII, 0); -} - -void z80ne_state::reset_lx382_banking() -{ - /* switch to ROM bank at address 0x0000 */ - m_bank1->set_entry(1); - m_bank2->set_entry(0); /* ep382 at 0x8000 */ - - /* after the first 3 bytes have been read from ROM, switch the RAM back in */ - m_reset_delay_counter = 2; - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_reset_delay_count), this)); -} - -void z80ne_state::reset_lx390_banking() -{ - m_reset_delay_counter = 0; - - switch (m_io_config->read() & 0x07) { - case 0x01: /* EP382 Hex Monitor */ - if (VERBOSE) - logerror("reset_lx390_banking: banking ep382\n"); - m_bank1->set_entry(4); /* ep382 at 0x0000 for 3 cycles, then RAM */ - m_bank2->set_entry(0); /* RAM at 0x0400 */ - m_bank3->set_entry(1); /* ep382 at 0x8000 */ - m_bank4->set_entry(0); /* RAM at 0xF000 */ - /* after the first 3 bytes have been read from ROM, switch the RAM back in */ - m_reset_delay_counter = 2; - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_reset_delay_count), this)); - break; - case 0x02: /* EP548 16k BASIC */ - if (VERBOSE) - logerror("reset_lx390_banking: banking ep548\n"); - m_bank1->set_entry(5); /* ep548 at 0x0000-0x03FF */ - m_bank2->set_entry(1); /* ep548 at 0x0400-0x3FFF */ - m_bank3->set_entry(0); /* RAM at 0x8000 */ - m_bank4->set_entry(0); /* RAM at 0xF000 */ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); - break; - case 0x03: /* EP390 Boot Loader for 5.5k floppy BASIC */ - if (VERBOSE) - logerror("reset_lx390_banking: banking ep390\n"); - m_bank1->set_entry(1); /* ep390 at 0x0000-0 x03FF for 3 cycles, then RAM */ - m_bank2->set_entry(0); /* RAM at 0x0400-0x3FFF */ - m_bank3->set_entry(0); /* RAM at 0x8000 */ - m_bank4->set_entry(1); /* ep390 at 0xF000 */ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); - break; - case 0x04: /* EP1390 Boot Loader for NE DOS 1.0/1.5 */ - if (VERBOSE) - logerror("reset_lx390_banking: banking ep1390\n"); - m_bank1->set_entry(2); /* ep1390 at 0x0000-0x03FF for 3 cycles, then RAM */ - m_bank2->set_entry(0); /* RAM at 0x0400-0x3FFF */ - m_bank3->set_entry(0); /* RAM at 0x8000 */ - m_bank4->set_entry(2); /* ep1390 at 0xF000 */ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); - break; - case 0x05: /* EP2390 Boot Loader for NE DOS G.1 */ - if (VERBOSE) - logerror("reset_lx390_banking: banking ep2390\n"); - m_bank1->set_entry(3); /* ep2390 at 0x0000-0x03FF for 3 cycles, then RAM */ - m_bank2->set_entry(0); /* RAM at 0x0400-0x3FFF */ - m_bank3->set_entry(0); /* RAM at 0x8000 */ - m_bank4->set_entry(3); /* ep2390 at 0xF000 */ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this)); - break; - } - - /* TODO: in real hardware the ENH bus line is pulled down - * until a I/O read is performed on a address with A0 address bit low and A1 or A2 address bit high - */ -} - -MACHINE_RESET_MEMBER(z80ne_state,z80ne_base) -{ - int i; - - LOG(("In machine_reset z80ne_base\n")); - - for ( i=0; iread() & 0x07) - { - case 0x01: - m_cass_data.speed = TAPE_300BPS; - m_cass_data.wave_filter = LX385_TAPE_SAMPLE_FREQ / 1600; - m_cass_data.wave_short = LX385_TAPE_SAMPLE_FREQ / (2400 * 2); - m_cass_data.wave_long = LX385_TAPE_SAMPLE_FREQ / (1200 * 2); - break; - case 0x02: - m_cass_data.speed = TAPE_600BPS; - m_cass_data.wave_filter = LX385_TAPE_SAMPLE_FREQ / 3200; - m_cass_data.wave_short = LX385_TAPE_SAMPLE_FREQ / (4800 * 2); - m_cass_data.wave_long = LX385_TAPE_SAMPLE_FREQ / (2400 * 2); - break; - case 0x04: - m_cass_data.speed = TAPE_1200BPS; - m_cass_data.wave_filter = LX385_TAPE_SAMPLE_FREQ / 6400; - m_cass_data.wave_short = LX385_TAPE_SAMPLE_FREQ / (9600 * 2); - m_cass_data.wave_long = LX385_TAPE_SAMPLE_FREQ / (4800 * 2); - } - m_cass_data.wave_length = m_cass_data.wave_short; - m_cass_data.output.length = m_cass_data.wave_length; - m_cass_data.output.level = 1; - m_cass_data.input.length = 0; - m_cass_data.input.bit = 1; - - m_ay31015->set_input_pin(AY31015_CS, 0); - m_ay31015->set_input_pin(AY31015_NB1, 1); - m_ay31015->set_input_pin(AY31015_NB2, 1); - m_ay31015->set_input_pin(AY31015_TSB, 1); - m_ay31015->set_input_pin(AY31015_EPS, 1); - m_ay31015->set_input_pin(AY31015_NP, m_io_lx_385->read() & 0x80 ? 1 : 0); - m_ay31015->set_input_pin(AY31015_CS, 1); - m_ay31015->set_receiver_clock(m_cass_data.speed * 16.0); - m_ay31015->set_transmitter_clock(m_cass_data.speed * 16.0); - - m_nmi_delay_counter = 0; - lx385_ctrl_w(m_maincpu->space(AS_PROGRAM), 0, 0); - -} - -MACHINE_RESET_MEMBER(z80ne_state,z80ne) -{ - LOG(("In machine_reset z80ne\n")); - reset_lx382_banking(); - MACHINE_RESET_CALL_MEMBER( z80ne_base ); -} - -MACHINE_RESET_MEMBER(z80ne_state,z80net) -{ - LOG(("In machine_reset z80net\n")); - MACHINE_RESET_CALL_MEMBER( z80ne ); - reset_lx388(); -} - -MACHINE_RESET_MEMBER(z80ne_state,z80netb) -{ - LOG(("In machine_reset z80netb\n")); - MACHINE_RESET_CALL_MEMBER( z80ne_base ); - reset_lx388(); -} - -MACHINE_RESET_MEMBER(z80ne_state,z80netf) -{ - LOG(("In machine_reset z80netf\n")); - reset_lx390_banking(); - MACHINE_RESET_CALL_MEMBER( z80ne_base ); - reset_lx388(); -} - -INPUT_CHANGED_MEMBER(z80ne_state::z80ne_reset) -{ - UINT8 rst; - rst = m_io_rst->read(); - - if ( ! BIT(rst, 0)) - { - machine().schedule_soft_reset(); - } -} - -INPUT_CHANGED_MEMBER(z80ne_state::z80ne_nmi) -{ - UINT8 nmi; - nmi = m_io_lx388_brk->read(); - - if ( ! BIT(nmi, 0)) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - } -} - -MACHINE_START_MEMBER(z80ne_state,z80ne) -{ - LOG(("In MACHINE_START z80ne\n")); - m_lx385_ctrl = 0x1f; - save_item(NAME(m_lx383_scan_counter)); - save_item(NAME(m_lx383_downsampler)); - save_item(NAME(m_lx383_key)); - save_item(NAME(m_nmi_delay_counter)); - m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ne_state::z80ne_cassette_tc),this)); - machine().scheduler().timer_pulse( attotime::from_hz(1000), timer_expired_delegate(FUNC(z80ne_state::z80ne_kbd_scan),this)); -} - -MACHINE_START_MEMBER(z80ne_state,z80net) -{ - MACHINE_START_CALL_MEMBER( z80ne ); - LOG(("In MACHINE_START z80net\n")); -} - -MACHINE_START_MEMBER(z80ne_state,z80netb) -{ - MACHINE_START_CALL_MEMBER( z80net ); - LOG(("In MACHINE_START z80netb\n")); -} - -MACHINE_START_MEMBER(z80ne_state,z80netf) -{ - MACHINE_START_CALL_MEMBER( z80net ); - LOG(("In MACHINE_START z80netf\n")); -} - -/****************************************************************************** - Drivers -******************************************************************************/ - -/* LX.383 - LX.384 HEX keyboard and display */ -READ8_MEMBER(z80ne_state::lx383_r) -{ - /* - * Keyboard scanning - * - * IC14 NE555 astable oscillator - * IC13 74LS93 binary counter - * IC5 74LS240 tri-state buffer - * - * l'oscillatore NE555 alimenta il clock del contatore 74LS93 - * D0 - Q(A) --\ - * D1 - Q(B) |-- column - * D2 - Q(C) --/ - * D3 - Q(D) row - * D4 - CTRL - * D5 - 0 - * D6 - 0 - * D7 - ~KEY Pressed - */ - return m_lx383_key[m_lx383_scan_counter]; -} - -WRITE8_MEMBER(z80ne_state::lx383_w) -{ - /* - * First 8 locations (F0-F7) are mapped to a dual-port 8-byte RAM - * The 1KHz NE-555 astable oscillator circuit drive - * a 4-bit 74LS93 binary counter. - * The 3 least sigificant bits of the counter are connected - * both to the read addres of the dual-port ram and to - * a 74LS156 3 to 8 binary decoder driving the cathode - * of 8 7-segments LEDS. - * The data output of the dual-port ram drive the anodes - * of the LEDS through 74LS07 buffers. - * LED segments - dual-port RAM bit: - * A 0x01 - * B 0x02 - * C 0x04 - * D 0x08 - * E 0x10 - * F 0x20 - * G 0x40 - * P 0x80 (represented by DP in original schematics) - * - * A write in the range F0-FF starts a 74LS90 counter - * that trigger the NMI line of the CPU afther 2 instruction - * fetch cycles for single step execution. - */ - - if ( offset < 8 ) - output_set_digit_value( offset, data ^ 0xff ); - else - { - /* after writing to port 0xF8 and the first ~M1 cycles strike a NMI for single step execution */ - m_nmi_delay_counter = 1; - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_nmi_delay_count), this)); - } -} - - -/* LX.385 Cassette tape interface */ -/* - * NE555 is connected to a 74LS93 binary counter - * 74LS93 output: - * QA-QC: column index for LEDs and keyboard - * QD: keyboard row select - * - * Port EE: UART Data Read/Write - * Port EF: Status/Control - * read, UART status bits read - * 0 OR Overrun - * 1 FE Framing Error - * 2 PE Parity Error - * 3 TBMT Transmitter Buffer Empty - * 4 DAV Data Available - * 5 EOC End Of Character - * 6 1 - * 7 1 - * write, UART control bits / Tape Unit select / Modulation control - * 0 bit1=0, bit0=0 UART Reset pulse - * 1 bit1=0, bit0=1 UART RDAV (Reset Data Available) pulse - * 2 Tape modulation enable - * 3 *TAPEA Enable (active low) (at reset: low) - * 4 *TAPEB Enable (active low) (at reset: low) - * Cassette is connected to the uart data input and output via the cassette - * interface hardware. - * - * The cassette interface hardware converts square-wave pulses into bits which the uart receives. - * - * 1. the cassette format: "frequency shift" is converted - into the uart data format "non-return to zero" - - 2. on cassette a 1 data bit is stored as 8 2400 Hz pulses - and a 0 data bit as 4 1200 Hz pulses - - At 1200 baud, a logic 1 is 1 cycle of 1200 Hz and a logic 0 is 1/2 cycle of 600 Hz. - - At 300 baud, a logic 1 is 8 cycles of 2400 Hz and a logic 0 is 4 cycles of 1200 Hz. - - Attenuation is applied to the signal and the square wave edges are rounded. - - A manchester encoder is used. A flip-flop synchronises input - data on the positive-edge of the clock pulse. - * - */ -READ8_MEMBER(z80ne_state::lx385_data_r) -{ - return m_ay31015->get_received_data(); -} - -READ8_MEMBER(z80ne_state::lx385_ctrl_r) -{ - /* set unused bits high */ - UINT8 data = 0xc0; - - m_ay31015->set_input_pin(AY31015_SWE, 0); - data |= (m_ay31015->get_output_pin(AY31015_OR ) ? 0x01 : 0); - data |= (m_ay31015->get_output_pin(AY31015_FE ) ? 0x02 : 0); - data |= (m_ay31015->get_output_pin(AY31015_PE ) ? 0x04 : 0); - data |= (m_ay31015->get_output_pin(AY31015_TBMT) ? 0x08 : 0); - data |= (m_ay31015->get_output_pin(AY31015_DAV ) ? 0x10 : 0); - data |= (m_ay31015->get_output_pin(AY31015_EOC ) ? 0x20 : 0); - m_ay31015->set_input_pin(AY31015_SWE, 1); - - return data; -} - -WRITE8_MEMBER(z80ne_state::lx385_data_w) -{ - m_ay31015->set_transmit_data(data); -} - -#define LX385_CASSETTE_MOTOR_MASK ((1<<3)|(1<<4)) - -WRITE8_MEMBER(z80ne_state::lx385_ctrl_w) -{ - /* Translate data to control signals - * 0 bit1=0, bit0=0 UART Reset pulse - * 1 bit1=0, bit0=1 UART RDAV (Reset Data Available) pulse - * 2 UART Tx Clock Enable (active high) - * 3 *TAPEA Enable (active low) (at reset: low) - * 4 *TAPEB Enable (active low) (at reset: low) - */ - UINT8 uart_reset, uart_rdav, uart_tx_clock; - UINT8 motor_a, motor_b; - UINT8 changed_bits = (m_lx385_ctrl ^ data) & 0x1C; - m_lx385_ctrl = data; - - uart_reset = ((data & 0x03) == 0x00); - uart_rdav = ((data & 0x03) == 0x01); - uart_tx_clock = ((data & 0x04) == 0x04); - motor_a = ((data & 0x08) == 0x00); - motor_b = ((data & 0x10) == 0x00); - - /* UART Reset and RDAV */ - if (uart_reset) - { - m_ay31015->set_input_pin(AY31015_XR, 1); - m_ay31015->set_input_pin(AY31015_XR, 0); - } - - if (uart_rdav) - { - m_ay31015->set_input_pin(AY31015_RDAV, 1); - m_ay31015->set_input_pin(AY31015_RDAV, 0); - } - - if (!changed_bits) return; - - /* UART Tx Clock enable/disable */ - if (changed_bits & 0x04) - m_ay31015->set_transmitter_clock(uart_tx_clock ? m_cass_data.speed * 16.0 : 0.0); - - /* motors */ - if(changed_bits & 0x18) - { - m_cassette1->change_state( - (motor_a) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - - m_cassette2->change_state( - (motor_b) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - - if (motor_a || motor_b) - m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(LX385_TAPE_SAMPLE_FREQ)); - else - m_cassette_timer->adjust(attotime::zero); - } -} - -READ8_MEMBER(z80ne_state::lx388_mc6847_videoram_r) -{ - if (offset == ~0) return 0xff; - - UINT8 *videoram = m_videoram; - int d6 = BIT(videoram[offset], 6); - int d7 = BIT(videoram[offset], 7); - - m_vdg->inv_w(d6 && d7); - m_vdg->as_w(!d6 && d7); - m_vdg->intext_w(!d6 && d7); - - return videoram[offset]; -} - -READ8_MEMBER(z80ne_state::lx388_data_r) -{ - UINT8 data; - - data = m_lx388_kr2376->data_r(space, 0) & 0x7f; - data |= m_lx388_kr2376->get_output_pin(KR2376_SO) << 7; - return data; -} - -READ8_MEMBER(z80ne_state::lx388_read_field_sync) -{ - return m_vdg->fs_r() << 7; -} - -/* - * DRQ INTRQ IC9B.10 IC8B.*Q - * 0 0 1 0 - * 0 1 0 x - * 1 0 0 x - * 1 1 0 x - * - */ - -WRITE8_MEMBER(z80ne_state::lx390_motor_w) -{ - /* Selection of drive and parameters - A write also causes the selected drive motor to turn on for about 3 seconds. - When the motor turns off, the drive is deselected. - d7 Unused (trs80: 1=MFM, 0=FM) - d6 (trs80: 1=Wait) - d5 0=Side 0, 1=Side 1 (trs80: 1=Write Precompensation enabled) - d4 Unused (trs80: 0=Side 0, 1=Side 1) - d3 1=select drive 3 - d2 1=select drive 2 - d1 1=select drive 1 - d0 1=select drive 0 */ - - floppy_image_device *floppy = NULL; - - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); - if (BIT(data, 2)) floppy = m_floppy2->get_device(); - if (BIT(data, 3)) floppy = m_floppy3->get_device(); - - m_wd1771->set_floppy(floppy); - - if (floppy) - { - floppy->ss_w(BIT(data, 5)); - floppy->mon_w(0); - } - - m_wd17xx_state.head = (data & 32) ? 1 : 0; - m_wd17xx_state.drive = data & 0x0F; - - /* no drive selected, turn off all leds */ - if (!m_wd17xx_state.drive) - { - output_set_value("drv0", 0); - output_set_value("drv1", 0); - } -} - -READ8_MEMBER(z80ne_state::lx390_reset_bank) -{ - offs_t pc; - - /* if PC is not in range, we are under integrated debugger control, DON'T SWAP */ - pc = m_maincpu->pc(); - if((pc >= 0xf000) && (pc <=0xffff)) - { - LOG(("lx390_reset_bank, reset memory bank 1\n")); - m_bank1->set_entry(0); /* RAM at 0x0000 (bank 1) */ - } - else - { - LOG(("lx390_reset_bank, bypass because in debugger\n")); - } - return 0xff; -} - -READ8_MEMBER(z80ne_state::lx390_fdc_r) -{ - UINT8 d; - - switch(offset) - { - case 0: - d = m_wd1771->status_r(space, 0) ^ 0xff; - LOG(("lx390_fdc_r, WD17xx status: %02x\n", d)); - break; - case 1: - d = m_wd1771->track_r(space, 0) ^ 0xff; - LOG(("lx390_fdc_r, WD17xx track: %02x\n", d)); - break; - case 2: - d = m_wd1771->sector_r(space, 0) ^ 0xff; - LOG(("lx390_fdc_r, WD17xx sector: %02x\n", d)); - break; - case 3: - d = m_wd1771->data_r(space, 0) ^ 0xff; - LOG(("lx390_fdc_r, WD17xx data3: %02x\n", d)); - break; - case 6: - d = 0xff; - lx390_reset_bank(space, 0); - break; - case 7: - d = m_wd1771->data_r(space, 3) ^ 0xff; - LOG(("lx390_fdc_r, WD17xx data7, force: %02x\n", d)); - break; - default: - d = 0x00; - } - return d; -} - -WRITE8_MEMBER(z80ne_state::lx390_fdc_w) -{ - UINT8 d; - - d = data; - switch(offset) - { - case 0: - LOG(("lx390_fdc_w, WD17xx command: %02x\n", d)); - m_wd1771->cmd_w(space, offset, d ^ 0xff); - if (m_wd17xx_state.drive & 1) - output_set_value("drv0", 2); - else if (m_wd17xx_state.drive & 2) - output_set_value("drv1", 2); - break; - case 1: - LOG(("lx390_fdc_w, WD17xx track: %02x\n", d)); - m_wd1771->track_w(space, offset, d ^ 0xff); - break; - case 2: - LOG(("lx390_fdc_w, WD17xx sector: %02x\n", d)); - m_wd1771->sector_w(space, offset, d ^ 0xff); - break; - case 3: - m_wd1771->data_w(space, 0, d ^ 0xff); - LOG(("lx390_fdc_w, WD17xx data3: %02x\n", d)); - break; - case 6: - LOG(("lx390_fdc_w, motor_w: %02x\n", d)); - lx390_motor_w(space, 0, d); - break; - case 7: - LOG(("lx390_fdc_w, WD17xx data7, force: %02x\n", d)); - m_wd1771->data_w(space, 3, d ^ 0xff); - break; - } -} diff --git a/src/mess/machine/zx.c b/src/mess/machine/zx.c deleted file mode 100644 index be1e1ed246c..00000000000 --- a/src/mess/machine/zx.c +++ /dev/null @@ -1,390 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Krzysztof Strzecha, Robbbert -/*************************************************************************** - zx.c - - machine driver - Juergen Buchmueller , Dec 1999 - -****************************************************************************/ - -#include "includes/zx.h" - -#define video_screen_get_refresh(screen) (((screen_config *)(screen)->inline_config)->refresh) - -#define DEBUG_ZX81_PORTS 1 -#define DEBUG_ZX81_VSYNC 1 - -#define LOG_ZX81_IOR(_comment) do { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOR: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, space.machine().first_screen()->vpos(), _comment); } while (0) -#define LOG_ZX81_IOW(_comment) do { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOW: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, space.machine().first_screen()->vpos(), _comment); } while (0) -#define LOG_ZX81_VSYNC do { if (DEBUG_ZX81_VSYNC) logerror("VSYNC starts in scanline: %d\n", space.machine().first_screen()->vpos()); } while (0) - - -WRITE8_MEMBER(zx_state::zx_ram_w) -{ - UINT8 *RAM = m_region_maincpu->base(); - RAM[offset + 0x4000] = data; - - if (data & 0x40) - { - space.write_byte(offset | 0xc000, data); - RAM[offset | 0xc000] = data; - } - else - { - space.write_byte(offset | 0xc000, 0); - RAM[offset | 0xc000] = 0; - } -} - -/* I know this looks really pointless... but it has to be here */ -READ8_MEMBER( zx_state::zx_ram_r ) -{ - UINT8 *RAM = m_region_maincpu->base(); - return RAM[offset | 0xc000]; -} - -DRIVER_INIT_MEMBER(zx_state,zx) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - - space.install_read_bank(0x4000, 0x4000 + m_ram->size() - 1, "bank1"); - space.install_write_handler(0x4000, 0x4000 + m_ram->size() - 1, write8_delegate(FUNC(zx_state::zx_ram_w),this)); - membank("bank1")->set_base(m_region_maincpu->base() + 0x4000); -} - -DIRECT_UPDATE_MEMBER(zx_state::zx_setdirect) -{ - if (address & 0xc000) - zx_ula_r(address, m_region_maincpu, 0); - return address; -} - -DIRECT_UPDATE_MEMBER(zx_state::pc8300_setdirect) -{ - if (address & 0xc000) - zx_ula_r(address, m_region_gfx1, 0); - return address; -} - -DIRECT_UPDATE_MEMBER(zx_state::pow3000_setdirect) -{ - if (address & 0xc000) - zx_ula_r(address, m_region_gfx1, 1); - return address; -} - -void zx_state::machine_reset() -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::zx_setdirect), this)); - m_tape_bit = 0x80; -} - -MACHINE_RESET_MEMBER(zx_state,pow3000) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pow3000_setdirect), this)); - m_tape_bit = 0x80; -} - -MACHINE_RESET_MEMBER(zx_state,pc8300) -{ - m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pc8300_setdirect), this)); - m_tape_bit = 0x80; -} - -TIMER_CALLBACK_MEMBER(zx_state::zx_tape_pulse) -{ - m_tape_bit = 0x80; -} - -READ8_MEMBER( zx_state::zx80_io_r ) -{ -/* port FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out - The upper 8 bits are used to select a keyboard scan line */ - - UINT8 data = 0xff; - UINT8 offs = offset & 0xff; - - if (offs == 0xfe) - { - if ((offset & 0x0100) == 0) - data &= m_io_row0->read(); - if ((offset & 0x0200) == 0) - data &= m_io_row1->read(); - if ((offset & 0x0400) == 0) - data &= m_io_row2->read(); - if ((offset & 0x0800) == 0) - data &= m_io_row3->read(); - if ((offset & 0x1000) == 0) - data &= m_io_row4->read(); - if ((offset & 0x2000) == 0) - data &= m_io_row5->read(); - if ((offset & 0x4000) == 0) - data &= m_io_row6->read(); - if ((offset & 0x8000) == 0) - data &= m_io_row7->read(); - - if (!m_io_config->read()) - data &= ~0x40; - - m_cassette->output(+1.0); - - if (m_ula_irq_active) - { - zx_ula_bkgnd(0); - m_ula_irq_active = 0; - } -// else -// { - if ((m_cassette->input() < -0.75) && m_tape_bit) - { - m_tape_bit = 0x00; - timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE); - } - - data &= ~m_tape_bit; -// } - if (m_ula_frame_vsync == 3) - { - m_ula_frame_vsync = 2; - } - } - - return data; -} - -READ8_MEMBER( zx_state::zx81_io_r ) -{ -/* port FB = read printer status, not emulated - FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out - The upper 8 bits are used to select a keyboard scan line */ - - UINT8 data = 0xff; - UINT8 offs = offset & 0xff; - - if (offs == 0xfe) - { - if ((offset & 0x0100) == 0) - data &= m_io_row0->read(); - if ((offset & 0x0200) == 0) - data &= m_io_row1->read(); - if ((offset & 0x0400) == 0) - data &= m_io_row2->read(); - if ((offset & 0x0800) == 0) - data &= m_io_row3->read(); - if ((offset & 0x1000) == 0) - data &= m_io_row4->read(); - if ((offset & 0x2000) == 0) - data &= m_io_row5->read(); - if ((offset & 0x4000) == 0) - data &= m_io_row6->read(); - if ((offset & 0x8000) == 0) - data &= m_io_row7->read(); - - if (!m_io_config->read()) - data &= ~0x40; - - m_cassette->output(+1.0); - - if (m_ula_irq_active) - { - zx_ula_bkgnd(0); - m_ula_irq_active = 0; - } - else - { - if ((m_cassette->input() < -0.75) && m_tape_bit) - { - m_tape_bit = 0x00; - timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE); - } - - data &= ~m_tape_bit; - } - if (m_ula_frame_vsync == 3) - { - m_ula_frame_vsync = 2; - } - } - - return data; -} - -READ8_MEMBER( zx_state::pc8300_io_r ) -{ -/* port F5 = sound - F6 = unknown - FB = read printer status, not emulated - FE = read keyboard and cass bit; turn off HSYNC-generator/cass-out - The upper 8 bits are used to select a keyboard scan line. - No TV diode */ - - UINT8 data = 0xff; - UINT8 offs = offset & 0xff; - - if (offs == 0xf5) - { - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - } - else - if (offs == 0xfe) - { - if ((offset & 0x0100) == 0) - data &= m_io_row0->read(); - if ((offset & 0x0200) == 0) - data &= m_io_row1->read(); - if ((offset & 0x0400) == 0) - data &= m_io_row2->read(); - if ((offset & 0x0800) == 0) - data &= m_io_row3->read(); - if ((offset & 0x1000) == 0) - data &= m_io_row4->read(); - if ((offset & 0x2000) == 0) - data &= m_io_row5->read(); - if ((offset & 0x4000) == 0) - data &= m_io_row6->read(); - if ((offset & 0x8000) == 0) - data &= m_io_row7->read(); - - m_cassette->output(+1.0); - - if (m_ula_irq_active) - { - zx_ula_bkgnd(0); - m_ula_irq_active = 0; - } - else - { - if ((m_cassette->input() < -0.75) && m_tape_bit) - { - m_tape_bit = 0x00; - timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE); - } - - data &= ~m_tape_bit; - } - if (m_ula_frame_vsync == 3) - { - m_ula_frame_vsync = 2; - } - } - - return data; -} - -READ8_MEMBER( zx_state::pow3000_io_r ) -{ -/* port 7E = read NTSC/PAL diode - F5 = sound - F6 = unknown - FB = read printer status, not emulated - FE = read keyboard and cass bit; turn off HSYNC-generator/cass-out - The upper 8 bits are used to select a keyboard scan line */ - - UINT8 data = 0xff; - UINT8 offs = offset & 0xff; - - if (offs == 0x7e) - { - data = (m_io_config->read()); - } - else - if (offs == 0xf5) - { - m_speaker_state ^= 1; - m_speaker->level_w(m_speaker_state); - } - else - if (offs == 0xfe) - { - if ((offset & 0x0100) == 0) - data &= m_io_row0->read(); - if ((offset & 0x0200) == 0) - data &= m_io_row1->read(); - if ((offset & 0x0400) == 0) - data &= m_io_row2->read(); - if ((offset & 0x0800) == 0) - data &= m_io_row3->read(); - if ((offset & 0x1000) == 0) - data &= m_io_row4->read(); - if ((offset & 0x2000) == 0) - data &= m_io_row5->read(); - if ((offset & 0x4000) == 0) - data &= m_io_row6->read(); - if ((offset & 0x8000) == 0) - data &= m_io_row7->read(); - - m_cassette->output(+1.0); - - if (m_ula_irq_active) - { - zx_ula_bkgnd(0); - m_ula_irq_active = 0; - } - else - { - if ((m_cassette->input() < -0.75) && m_tape_bit) - { - m_tape_bit = 0x00; - timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE); - } - - data &= ~m_tape_bit; - } - if (m_ula_frame_vsync == 3) - { - m_ula_frame_vsync = 2; - } - } - - return data; -} - -WRITE8_MEMBER( zx_state::zx80_io_w ) -{ -/* port FF = write HSYNC and cass data */ - - UINT8 offs = offset & 0xff; - - if (offs == 0xff) - m_cassette->output(-1.0); -} - -WRITE8_MEMBER( zx_state::zx81_io_w ) -{ -/* port F5 = unknown, pc8300/pow3000/lambda only - F6 = unknown, pc8300/pow3000/lambda only - FB = write data to printer, not emulated - FD = turn off NMI generator - FE = turn on NMI generator - FF = write HSYNC and cass data */ - - int height = m_screen->height(); - UINT8 offs = offset & 0xff; - - if (offs == 0xfd) - { - m_ula_nmi->reset(); - } - else - if (offs == 0xfe) - { - m_ula_nmi->adjust(attotime::zero, 0, m_maincpu->cycles_to_attotime(207)); - - /* remove the IRQ */ - m_ula_irq_active = 0; - } - else - if (offs == 0xff) - { - m_cassette->output(-1.0); - zx_ula_bkgnd(1); - if (m_ula_frame_vsync == 2) - { - m_maincpu->spin_until_time(m_screen->time_until_pos(height - 1, 0)); - m_ula_scanline_count = height - 1; - logerror ("S: %d B: %d\n", m_screen->vpos(), m_screen->hpos()); - } - } -} diff --git a/src/mess/machine/zx8302.c b/src/mess/machine/zx8302.c deleted file mode 100644 index 6866b61f290..00000000000 --- a/src/mess/machine/zx8302.c +++ /dev/null @@ -1,606 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Sinclair ZX8302 emulation - -**********************************************************************/ - -/* - - TODO: - - - set time - - read from microdrive - - write to microdrive - - DTR/CTS handling - - network - -*/ - -#include "emu.h" -#include -#include "machine/microdrv.h" -#include "zx8302.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - - -// Monday 1st January 1979 00:00:00 UTC -static const int RTC_BASE_ADJUST = 283996800; - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type ZX8302 = &device_creator; - -//************************************************************************** -// INLINE HELPERS -//************************************************************************** - -//------------------------------------------------- -// trigger_interrupt - -//------------------------------------------------- - -inline void zx8302_device::trigger_interrupt(UINT8 line) -{ - m_irq |= line; - - m_out_ipl1l_cb(ASSERT_LINE); -} - - -//------------------------------------------------- -// transmit_ipc_data - transmit IPC data -//------------------------------------------------- - -inline void zx8302_device::transmit_ipc_data() -{ - /* - - IPC <-> ZX8302 serial link protocol - *********************************** - - Send bit to IPC - --------------- - - 1. ZX start bit (COMDATA = 0) - 2. IPC clock (COMCTL = 0, COMTL = 1) - 3. ZX data bit (COMDATA = 0/1) - 4. IPC clock (COMCTL = 0, COMTL = 1) - 5. ZX stop bit (COMDATA = 1) - - Receive bit from IPC - -------------------- - - 1. ZX start bit (COMDATA = 0) - 2. IPC clock (COMCTL = 0, COMTL = 1) - 3. IPC data bit (COMDATA = 0/1) - 4. IPC clock (COMCTL = 0, COMTL = 1) - 5. IPC stop bit (COMDATA = 1) - - */ - - switch (m_ipc_state) - { - case IPC_START: - if (LOG) logerror("ZX8302 '%s' COMDATA Start Bit\n", tag()); - - m_out_comdata_cb(BIT(m_idr, 0)); - m_ipc_busy = 1; - m_ipc_state = IPC_DATA; - break; - - case IPC_DATA: - if (LOG) logerror("ZX8302 '%s' COMDATA Data Bit: %x\n", tag(), BIT(m_idr, 1)); - - m_comdata_to_ipc = BIT(m_idr, 1); - m_out_comdata_cb(m_comdata_to_ipc); - m_ipc_state = IPC_STOP; - break; - - case IPC_STOP: - if (LOG) logerror("ZX8302 '%s' COMDATA Stop Bit\n", tag()); - - m_out_comdata_cb(BIT(m_idr, 2)); - m_ipc_busy = 0; - break; - } -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// zx8302_device - constructor -//------------------------------------------------- - -zx8302_device::zx8302_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ZX8302, "Sinclair ZX8302", tag, owner, clock, "zx8302", __FILE__), - device_serial_interface(mconfig, *this), - m_rtc_clock(0), - m_out_ipl1l_cb(*this), - m_out_baudx4_cb(*this), - m_out_comdata_cb(*this), - m_out_txd1_cb(*this), - m_out_txd2_cb(*this), - m_out_netout_cb(*this), - m_out_mdselck_cb(*this), - m_out_mdseld_cb(*this), - m_out_mdrdw_cb(*this), - m_out_erase_cb(*this), - m_out_raw1_cb(*this), - m_in_raw1_cb(*this), - m_out_raw2_cb(*this), - m_in_raw2_cb(*this), - m_dtr1(0), - m_cts2(0), - m_idr(1), - m_irq(0), - m_ctr(time(NULL) + RTC_BASE_ADJUST), - m_status(0), - m_comdata_from_ipc(1), - m_comdata_to_cpu(1), - m_comdata_to_ipc(1), - m_comctl(1), - m_ipc_state(0), - m_ipc_busy(0), - m_baudx4(0), - m_track(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void zx8302_device::device_start() -{ - // resolve callbacks - m_out_ipl1l_cb.resolve_safe(); - m_out_baudx4_cb.resolve_safe(); - m_out_comdata_cb.resolve_safe(); - m_out_txd1_cb.resolve_safe(); - m_out_txd2_cb.resolve_safe(); - m_out_netout_cb.resolve_safe(); - m_out_mdselck_cb.resolve_safe(); - m_out_mdseld_cb.resolve_safe(); - m_out_mdrdw_cb.resolve_safe(); - m_out_erase_cb.resolve_safe(); - m_out_raw1_cb.resolve_safe(); - m_in_raw1_cb.resolve_safe(0); - m_out_raw2_cb.resolve_safe(); - m_in_raw2_cb.resolve_safe(0); - - // allocate timers - m_baudx4_timer = timer_alloc(TIMER_BAUDX4); - m_rtc_timer = timer_alloc(TIMER_RTC); - m_gap_timer = timer_alloc(TIMER_GAP); - - m_rtc_timer->adjust(attotime::zero, 0, attotime::from_hz(m_rtc_clock / 32768)); - m_gap_timer->adjust(attotime::zero, 0, attotime::from_msec(31)); - - // register for state saving - save_item(NAME(m_dtr1)); - save_item(NAME(m_cts2)); - save_item(NAME(m_idr)); - save_item(NAME(m_tcr)); - save_item(NAME(m_tdr)); - save_item(NAME(m_irq)); - save_item(NAME(m_ctr)); - save_item(NAME(m_status)); - save_item(NAME(m_comdata_from_ipc)); - save_item(NAME(m_comdata_to_cpu)); - save_item(NAME(m_comdata_to_ipc)); - save_item(NAME(m_comctl)); - save_item(NAME(m_ipc_state)); - save_item(NAME(m_ipc_busy)); - save_item(NAME(m_baudx4)); - save_item(NAME(m_mdv_data)); - save_item(NAME(m_track)); -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void zx8302_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_BAUDX4: - m_baudx4 = !m_baudx4; - m_out_baudx4_cb(m_baudx4); - break; - - case TIMER_RTC: - m_ctr++; - break; - - case TIMER_GAP: - trigger_interrupt(INT_GAP); - break; - - default: - device_serial_interface::device_timer(timer, id, param, ptr); - break; - } -} - - -//------------------------------------------------- -// tra_callback - -//------------------------------------------------- - -void zx8302_device::tra_callback() -{ - switch (m_tcr & MODE_MASK) - { - case MODE_SER1: - m_out_txd1_cb(transmit_register_get_data_bit()); - break; - - case MODE_SER2: - m_out_txd2_cb(transmit_register_get_data_bit()); - break; - - case MODE_MDV: - // TODO - break; - - case MODE_NET: - m_out_netout_cb(transmit_register_get_data_bit()); - break; - } -} - - -//------------------------------------------------- -// tra_complete - -//------------------------------------------------- - -void zx8302_device::tra_complete() -{ - m_status &= ~STATUS_TX_BUFFER_FULL; - - trigger_interrupt(INT_TRANSMIT); -} - - -//------------------------------------------------- -// rcv_callback - -//------------------------------------------------- - -void zx8302_device::rcv_callback() -{ - switch (m_tcr & MODE_MASK) - { - case MODE_NET: - receive_register_update_bit(m_rs232_rx); - break; - } -} - - -//------------------------------------------------- -// rcv_complete - -//------------------------------------------------- - -void zx8302_device::rcv_complete() -{ - // TODO -} - - -//------------------------------------------------- -// rtc_r - real time clock read -//------------------------------------------------- - -READ8_MEMBER( zx8302_device::rtc_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0: - data = (m_ctr >> 24) & 0xff; - break; - case 1: - data = (m_ctr >> 16) & 0xff; - break; - case 2: - data = (m_ctr >> 8) & 0xff; - break; - case 3: - data = m_ctr & 0xff; - break; - } - - return data; -} - - -//------------------------------------------------- -// rtc_w - real time clock write -//------------------------------------------------- - -WRITE8_MEMBER( zx8302_device::rtc_w ) -{ - if (LOG) logerror("ZX8302 '%s' Set Real Time Clock: %02x\n", tag(), data); -} - - -//------------------------------------------------- -// control_w - serial transmit clock -//------------------------------------------------- - -WRITE8_MEMBER( zx8302_device::control_w ) -{ - if (LOG) logerror("ZX8302 '%s' Transmit Control: %02x\n", tag(), data); - - int baud = (19200 >> (data & BAUD_MASK)); - int baudx4 = baud * 4; - - m_tcr = data; - - m_baudx4_timer->adjust(attotime::zero, 0, attotime::from_hz(baudx4)); - - set_tra_rate(baud); - set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2); -} - - -//------------------------------------------------- -// mdv_track_r - microdrive track data -//------------------------------------------------- - -READ8_MEMBER( zx8302_device::mdv_track_r ) -{ - if (LOG) logerror("ZX8302 '%s' Microdrive Track %u: %02x\n", tag(), m_track, m_mdv_data[m_track]); - - UINT8 data = m_mdv_data[m_track]; - - m_track = !m_track; - - return data; -} - - -//------------------------------------------------- -// status_r - status register -//------------------------------------------------- - -READ8_MEMBER( zx8302_device::status_r ) -{ - /* - - bit description - - 0 Network port - 1 Transmit buffer full - 2 Receive buffer full - 3 Microdrive GAP - 4 SER1 DTR - 5 SER2 CTS - 6 IPC busy - 7 COMDATA - - */ - - UINT8 data = 0; - - // TODO network port - - // serial status - data |= m_status; - - // TODO microdrive GAP - - // data terminal ready - data |= m_dtr1 << 4; - - // clear to send - data |= m_cts2 << 5; - - // IPC busy - data |= m_ipc_busy << 6; - - // COMDATA - data |= m_comdata_to_cpu << 7; - - if (LOG) logerror("ZX8302 '%s' Status: %02x\n", tag(), data); - - return data; -} - - -//------------------------------------------------- -// ipc_command_w - IPC command -//------------------------------------------------- -// When the main CPU writes to the IPC it writes the lsn of 18003 -// this is encoded as follows : -// -// b0 start bit -// b1 data bit -// b2 stop bit -// b3 extra stop bit. -// -// At startup the IPC sits in a loop waiting for the comdata bit to go -// high, the main CPU does this by writing 0x01 to output register. - -WRITE8_MEMBER( zx8302_device::ipc_command_w ) -{ - if (LOG) logerror("ZX8302 '%s' IPC Command: %02x\n", tag(), data); - - m_idr = data; - m_ipc_state = IPC_START; - - transmit_ipc_data(); -} - - -//------------------------------------------------- -// mdv_control_w - microdrive control -//------------------------------------------------- - -WRITE8_MEMBER( zx8302_device::mdv_control_w ) -{ - /* - - bit description - - 0 MDSELDH - 1 MDSELCKH - 2 MDRDWL - 3 ERASE - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("ZX8302 '%s' Microdrive Control: %02x\n", tag(), data); - - m_out_mdseld_cb(BIT(data, 0)); - m_out_mdselck_cb(BIT(data, 1)); - m_out_mdrdw_cb(BIT(data, 2)); - m_out_erase_cb(BIT(data, 3)); - - if (BIT(data, 1)) - { - m_status &= ~STATUS_RX_BUFFER_FULL; - } -} - - -//------------------------------------------------- -// irq_status_r - interrupt status -//------------------------------------------------- - -READ8_MEMBER( zx8302_device::irq_status_r ) -{ - if (LOG) logerror("ZX8302 '%s' Interrupt Status: %02x\n", tag(), m_irq); - - return m_irq; -} - - -//------------------------------------------------- -// irq_acknowledge_w - interrupt acknowledge -//------------------------------------------------- - -WRITE8_MEMBER( zx8302_device::irq_acknowledge_w ) -{ - if (LOG) logerror("ZX8302 '%s' Interrupt Acknowledge: %02x\n", tag(), data); - - m_irq &= ~data; - - if (!m_irq) - { - m_out_ipl1l_cb(CLEAR_LINE); - } -} - - -//------------------------------------------------- -// data_w - transmit buffer -//------------------------------------------------- - -WRITE8_MEMBER( zx8302_device::data_w ) -{ - if (LOG) logerror("ZX8302 '%s' Data Register: %02x\n", tag(), data); - - m_tdr = data; - m_status |= STATUS_TX_BUFFER_FULL; -} - - -//------------------------------------------------- -// vsync_w - vertical sync -//------------------------------------------------- - -WRITE_LINE_MEMBER( zx8302_device::vsync_w ) -{ - if (state) - { - if (LOG) logerror("ZX8302 '%s' Frame Interrupt\n", tag()); - - trigger_interrupt(INT_FRAME); - } -} - - -//------------------------------------------------- -// comctl_w - IPC COMCTL -//------------------------------------------------- - -WRITE_LINE_MEMBER( zx8302_device::comctl_w ) -{ - if (LOG) logerror("ZX8302 '%s' COMCTL: %x\n", tag(), state); - - if (state) - { - transmit_ipc_data(); - m_comdata_to_cpu = m_comdata_from_ipc; - } -} - - -//------------------------------------------------- -// comdata_w - IPC COMDATA -//------------------------------------------------- -// IPC writing comdata to CPU -// - -WRITE_LINE_MEMBER( zx8302_device::comdata_w ) -{ - if (LOG) logerror("ZX8302 '%s' COMDATA->CPU(pending): %x\n", tag(), state); - - m_comdata_from_ipc = state; -} - - -//------------------------------------------------- -// extint_w - external interrupt -//------------------------------------------------- - -WRITE_LINE_MEMBER( zx8302_device::extint_w ) -{ - if (LOG) logerror("ZX8302 '%s' EXTINT: %x\n", tag(), state); - - if (state == ASSERT_LINE) - { - trigger_interrupt(INT_EXTERNAL); - } -} - -WRITE_LINE_MEMBER( zx8302_device::write_netin ) -{ - m_rs232_rx = state; - device_serial_interface::rx_w(state); -} - -WRITE_LINE_MEMBER( zx8302_device::write_dtr1 ) -{ - m_dtr1 = state; -} - -WRITE_LINE_MEMBER( zx8302_device::write_cts2 ) -{ - m_cts2 = state; -} diff --git a/src/mess/machine/zx8302.h b/src/mess/machine/zx8302.h deleted file mode 100644 index 2cfb4efbe49..00000000000 --- a/src/mess/machine/zx8302.h +++ /dev/null @@ -1,263 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Sinclair ZX8302 emulation - -********************************************************************** - _____ _____ - ERASE 1 |* \_/ | 40 Vdd - EXTINTL 2 | | 39 DB4 - MDRDWL 3 | | 38 DB5 - NETOUT 4 | | 37 DB0 - BAUDX4 5 | | 36 DB1 - DTR1L 6 | | 35 COMDATA - CTS2L 7 | | 34 MDSELDH - DCSML 8 | | 33 MDSELCKN - ROWL 9 | | 32 VSYNCH - PCENL 10 | ZX8302 | 31 XTAL2 - Vdd 11 | ULA | 30 XTAL1 - DB2 12 | | 29 - TXD1 13 | | 28 RESETOUTL - TXD2 14 | | 27 DB7 - A5 15 | | 26 IPL1L - NETIN 16 | | 25 CLKCPU - A1 17 | | 24 DB3 - A0 18 | | 23 DB6 - RAW2 19 | | 22 COMCTL - GND 20 |_____________| 21 RAW1 - -**********************************************************************/ - -#pragma once - -#ifndef __ZX8302__ -#define __ZX8302__ - -#include "emu.h" - - -///************************************************************************* -// INTERFACE CONFIGURATION MACROS -///************************************************************************* - -#define MCFG_ZX8302_RTC_CLOCK(_clk) \ - zx8302_device::set_rtc_clock(*device, _clk); - -#define MCFG_ZX8302_OUT_IPL1L_CB(_devcb) \ - devcb = &zx8302_device::set_out_ipl1l_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_BAUDX4_CB(_devcb) \ - devcb = &zx8302_device::set_out_baudx4_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_COMDATA_CB(_devcb) \ - devcb = &zx8302_device::set_out_comdata_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_TXD1_CB(_devcb) \ - devcb = &zx8302_device::set_out_txd1_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_TXD2_CB(_devcb) \ - devcb = &zx8302_device::set_out_txd2_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_NETOUT_CB(_devcb) \ - devcb = &zx8302_device::set_out_netout_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_MDSELCK_CB(_devcb) \ - devcb = &zx8302_device::set_out_mdselck_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_MDSELD_CB(_devcb) \ - devcb = &zx8302_device::set_out_mdseld_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_MDRDW_CB(_devcb) \ - devcb = &zx8302_device::set_out_mdrdw_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_ERASE_CB(_devcb) \ - devcb = &zx8302_device::set_out_erase_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_RAW1_CB(_devcb) \ - devcb = &zx8302_device::set_out_raw1_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_IN_RAW1_CB(_devcb) \ - devcb = &zx8302_device::set_in_raw1_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_OUT_RAW2_CB(_devcb) \ - devcb = &zx8302_device::set_out_raw2_callback(*device, DEVCB_##_devcb); - -#define MCFG_ZX8302_IN_RAW2_CB(_devcb) \ - devcb = &zx8302_device::set_in_raw2_callback(*device, DEVCB_##_devcb); - - -///************************************************************************* -// TYPE DEFINITIONS -///************************************************************************* - -// ======================> zx8302_device - -class zx8302_device : public device_t, - public device_serial_interface -{ -public: - // construction/destruction - zx8302_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - static void set_rtc_clock(device_t &device, int rtc_clock) { downcast(device).m_rtc_clock = rtc_clock; } - template static devcb_base &set_out_ipl1l_callback(device_t &device, _Object object) { return downcast(device).m_out_ipl1l_cb.set_callback(object); } - template static devcb_base &set_out_baudx4_callback(device_t &device, _Object object) { return downcast(device).m_out_baudx4_cb.set_callback(object); } - template static devcb_base &set_out_comdata_callback(device_t &device, _Object object) { return downcast(device).m_out_comdata_cb.set_callback(object); } - template static devcb_base &set_out_txd1_callback(device_t &device, _Object object) { return downcast(device).m_out_txd1_cb.set_callback(object); } - template static devcb_base &set_out_txd2_callback(device_t &device, _Object object) { return downcast(device).m_out_txd2_cb.set_callback(object); } - template static devcb_base &set_out_netout_callback(device_t &device, _Object object) { return downcast(device).m_out_netout_cb.set_callback(object); } - template static devcb_base &set_out_mdselck_callback(device_t &device, _Object object) { return downcast(device).m_out_mdselck_cb.set_callback(object); } - template static devcb_base &set_out_mdseld_callback(device_t &device, _Object object) { return downcast(device).m_out_mdseld_cb.set_callback(object); } - template static devcb_base &set_out_mdrdw_callback(device_t &device, _Object object) { return downcast(device).m_out_mdrdw_cb.set_callback(object); } - template static devcb_base &set_out_erase_callback(device_t &device, _Object object) { return downcast(device).m_out_erase_cb.set_callback(object); } - template static devcb_base &set_out_raw1_callback(device_t &device, _Object object) { return downcast(device).m_out_raw1_cb.set_callback(object); } - template static devcb_base &set_in_raw1_callback(device_t &device, _Object object) { return downcast(device).m_in_raw1_cb.set_callback(object); } - template static devcb_base &set_out_raw2_callback(device_t &device, _Object object) { return downcast(device).m_out_raw2_cb.set_callback(object); } - template static devcb_base &set_in_raw2_callback(device_t &device, _Object object) { return downcast(device).m_in_raw2_cb.set_callback(object); } - - DECLARE_READ8_MEMBER( rtc_r ); - DECLARE_WRITE8_MEMBER( rtc_w ); - DECLARE_WRITE8_MEMBER( control_w ); - DECLARE_READ8_MEMBER( mdv_track_r ); - DECLARE_READ8_MEMBER( status_r ); - DECLARE_WRITE8_MEMBER( ipc_command_w ); - DECLARE_WRITE8_MEMBER( mdv_control_w ); - DECLARE_READ8_MEMBER( irq_status_r ); - DECLARE_WRITE8_MEMBER( irq_acknowledge_w ); - DECLARE_WRITE8_MEMBER( data_w ); - DECLARE_WRITE_LINE_MEMBER( vsync_w ); - DECLARE_WRITE_LINE_MEMBER( comctl_w ); - DECLARE_WRITE_LINE_MEMBER( comdata_w ); - DECLARE_WRITE_LINE_MEMBER( extint_w ); - - DECLARE_WRITE_LINE_MEMBER( write_netin ); - DECLARE_WRITE_LINE_MEMBER( write_dtr1 ); - DECLARE_WRITE_LINE_MEMBER( write_cts2 ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // device_serial_interface overrides - virtual void tra_callback(); - virtual void tra_complete(); - virtual void rcv_callback(); - virtual void rcv_complete(); - - inline void trigger_interrupt(UINT8 line); - inline void transmit_ipc_data(); - -private: - enum - { - TIMER_BAUDX4 = 0, - TIMER_RTC, - TIMER_GAP - }; - - enum - { - IPC_START, - IPC_DATA, - IPC_STOP - }; - - enum - { - BAUD_19200 = 0, - BAUD_9600, - BAUD_4800, - BAUD_2400, - BAUD_1200, - BAUD_600, - BAUD_300, - BAUD_75, - BAUD_MASK = 0x07 - }; - - enum - { - MODE_SER1 = 0x00, - MODE_SER2 = 0x08, - MODE_MDV = 0x10, - MODE_NET = 0x18, - MODE_MASK = 0x18 - }; - - enum - { - INT_GAP = 0x01, - INT_INTERFACE = 0x02, - INT_TRANSMIT = 0x04, - INT_FRAME = 0x08, - INT_EXTERNAL = 0x10 - }; - - enum - { - STATUS_NETWORK_PORT = 0x01, - STATUS_TX_BUFFER_FULL = 0x02, - STATUS_RX_BUFFER_FULL = 0x04, - STATUS_MICRODRIVE_GAP = 0x08 - }; - - int m_rtc_clock; // the RTC clock (pin 30) of the chip - - // serial - devcb_write_line m_out_ipl1l_cb; - devcb_write_line m_out_baudx4_cb; - devcb_write_line m_out_comdata_cb; - devcb_write_line m_out_txd1_cb; - devcb_write_line m_out_txd2_cb; - devcb_write_line m_out_netout_cb; - - // microdrive - devcb_write_line m_out_mdselck_cb; - devcb_write_line m_out_mdseld_cb; - devcb_write_line m_out_mdrdw_cb; - devcb_write_line m_out_erase_cb; - devcb_write_line m_out_raw1_cb; - devcb_read_line m_in_raw1_cb; - devcb_write_line m_out_raw2_cb; - devcb_read_line m_in_raw2_cb; - - int m_rs232_rx; - int m_dtr1; - int m_cts2; - - // registers - UINT8 m_idr; // IPC data register - UINT8 m_tcr; // transfer control register - UINT8 m_tdr; // transfer data register - UINT8 m_irq; // interrupt register - UINT32 m_ctr; // counter register - UINT8 m_status; // status register - - // IPC communication state - int m_comdata_from_ipc; // pending data from IPC->68000 - int m_comdata_to_cpu; // communication data IPC->68000 - int m_comdata_to_ipc; // communication data 68000->IPC - int m_comctl; // communication control - int m_ipc_state; // communication state - int m_ipc_busy; // IPC busy - int m_baudx4; // IPC baud x4 - - // microdrive state - UINT8 m_mdv_data[2]; // track data register - int m_track; // current track - - // timers - emu_timer *m_baudx4_timer; // baud x4 timer - emu_timer *m_rtc_timer; // real time clock timer - emu_timer *m_gap_timer; // microdrive gap timer -}; - - -// device type definition -extern const device_type ZX8302; - - - -#endif diff --git a/src/mess/tools/castool/main.c b/src/mess/tools/castool/main.c deleted file mode 100644 index 22564dcdf78..00000000000 --- a/src/mess/tools/castool/main.c +++ /dev/null @@ -1,217 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - main.c - - Castool command line front end - - 27/03/2009 Initial version by Miodrag Milanovic - -***************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include "corestr.h" - -#include "formats/a26_cas.h" -#include "formats/ace_tap.h" -#include "formats/adam_cas.h" -#include "formats/apf_apt.h" -#include "formats/cbm_tap.h" -#include "formats/cgen_cas.h" -#include "formats/coco_cas.h" -#include "formats/csw_cas.h" -#include "formats/fm7_cas.h" -#include "formats/fmsx_cas.h" -#include "formats/gtp_cas.h" -#include "formats/hect_tap.h" -#include "formats/kc_cas.h" -#include "formats/kim1_cas.h" -#include "formats/lviv_lvt.h" -#include "formats/mz_cas.h" -#include "formats/orao_cas.h" -#include "formats/oric_tap.h" -#include "formats/p6001_cas.h" -#include "formats/phc25_cas.h" -#include "formats/pmd_cas.h" -#include "formats/primoptp.h" -#include "formats/rk_cas.h" -#include "formats/sc3000_bit.h" -#include "formats/sol_cas.h" -#include "formats/sorc_cas.h" -#include "formats/sord_cas.h" -#include "formats/spc1000_cas.h" -#include "formats/svi_cas.h" -#include "formats/thom_cas.h" -#include "formats/trs_cas.h" -#include "formats/tvc_cas.h" -#include "formats/tzx_cas.h" -#include "formats/uef_cas.h" -#include "formats/vg5k_cas.h" -#include "formats/vt_cas.h" -#include "formats/x07_cas.h" -#include "formats/x1_tap.h" -#include "formats/zx81_p.h" - -struct SupportedCassetteFormats -{ - const char *name; - const struct CassetteFormat * const *formats; - const char *desc; -}; - -const struct SupportedCassetteFormats formats[] = { - {"a26", a26_cassette_formats ,"Atari 2600 SuperCharger"}, - {"apf", apf_cassette_formats ,"APF Imagination Machine"}, - {"bbc", bbc_cassette_formats ,"Acorn BBC & Electron"}, - {"cbm", cbm_cassette_formats ,"Commodore 8-bit series"}, - {"cdt", cdt_cassette_formats ,"Amstrad CPC"}, - {"cgenie", cgenie_cassette_formats ,"EACA Colour Genie"}, - {"coco", coco_cassette_formats ,"Tandy Radio Shack Color Computer"}, - {"csw", csw_cassette_formats ,"Compressed Square Wave"}, - {"ddp", coleco_adam_cassette_formats ,"Coleco ADAM"}, - {"fm7", fm7_cassette_formats ,"Fujitsu FM-7"}, - {"fmsx", fmsx_cassette_formats ,"MSX"}, - {"gtp", gtp_cassette_formats ,"Elektronika inzenjering Galaksija"}, - {"hector", hector_cassette_formats ,"Micronique Hector & Interact Family Computer"}, - {"jupiter", ace_cassette_formats ,"Jupiter Cantab Jupiter Ace"}, - {"kc85", kc_cassette_formats ,"VEB Mikroelektronik KC 85"}, - {"kim1", kim1_cassette_formats ,"MOS KIM-1"}, - {"lviv", lviv_lvt_format ,"PK-01 Lviv"}, - {"mo5", mo5_cassette_formats ,"Thomson MO-series"}, - {"mz", mz700_cassette_formats ,"Sharp MZ-700"}, - {"orao", orao_cassette_formats ,"PEL Varazdin Orao"}, - {"oric", oric_cassette_formats ,"Tangerine Oric"}, - {"pc6001", pc6001_cassette_formats ,"NEC PC-6001"}, - {"phc25", phc25_cassette_formats ,"Sanyo PHC-25"}, - {"pmd85", pmd85_cassette_formats ,"Tesla PMD-85"}, - {"primo", primo_ptp_format ,"Microkey Primo"}, - {"rku", rku_cassette_formats ,"UT-88"}, - {"rk8", rk8_cassette_formats ,"Mikro-80"}, - {"rks", rks_cassette_formats ,"Specialist"}, - {"rko", rko_cassette_formats ,"Orion"}, - {"rkr", rkr_cassette_formats ,"Radio-86RK"}, - {"rka", rka_cassette_formats ,"Zavod BRA Apogee BK-01"}, - {"rkm", rkm_cassette_formats ,"Mikrosha"}, - {"rkp", rkp_cassette_formats ,"SAM SKB VM Partner-01.01"}, - {"sc3000", sc3000_cassette_formats ,"Sega SC-3000"}, - {"sol20", sol20_cassette_formats ,"PTC SOL-20"}, - {"sorcerer", sorcerer_cassette_formats ,"Exidy Sorcerer"}, - {"sordm5", sordm5_cassette_formats ,"Sord M5"}, - {"spc1000", spc1000_cassette_formats ,"Samsung SPC-1000"}, - {"svi", svi_cassette_formats ,"Spectravideo SVI-318 & SVI-328"}, - {"to7", to7_cassette_formats ,"Thomson TO-series"}, - {"trs80l2", trs80l2_cassette_formats ,"TRS-80 Level 2"}, - {"tvc64", tvc64_cassette_formats ,"Videoton TVC 64"}, - {"tzx", tzx_cassette_formats ,"Sinclair ZX Spectrum"}, - {"uef", uef_cassette_formats ,"Acorn Electron"}, - {"vg5k", vg5k_cassette_formats ,"Philips VG 5000"}, - {"vtech1", vtech1_cassette_formats ,"Video Technology Laser 110-310"}, - {"vtech2", vtech2_cassette_formats ,"Video Technology Laser 350-700"}, - {"x07", x07_cassette_formats ,"Canon X-07"}, - {"x1", x1_cassette_formats ,"Sharp X1"}, - {"zx80_o", zx80_o_format ,"Sinclair ZX80"}, - {"zx81_p", zx81_p_format ,"Sinclair ZX81"}, - - - - {NULL,NULL,NULL} -}; - - -static const char *get_extension(const char *name) -{ - const char *s; - s = name; - if (s != NULL) - s = strrchr(s, '.'); - return s ? s+1 : NULL; -} - -static void display_usage(void) -{ - fprintf(stderr, "Usage: \n"); - fprintf(stderr, " castool.exe convert \n"); -} - -static void display_formats(void) -{ - int i,j; - fprintf(stderr, "Supported formats:\n\n"); - for (i = 0; formats[i].name; i++) { - fprintf(stderr, "%10s - %s\n",formats[i].name,formats[i].desc); - for (j = 1; formats[i].formats[j]; j++) { - fprintf(stderr, "%15s %s\n","",formats[i].formats[j]->extensions); - } - } -} - -int CLIB_DECL main(int argc, char *argv[]) -{ - int i; - int found =0; - const struct CassetteFormat * const *selected_formats = NULL; - cassette_image *cassette; - FILE *f; - - if (argc > 1) - { - if (!core_stricmp("convert", argv[1])) - { - // convert command - if (argc!=5) { - fprintf(stderr, "Wrong parameter number.\n\n"); - display_usage(); - return -1; - } else { - for (i = 0; formats[i].name; i++) { - if (core_stricmp(formats[i].name,argv[2])==0) { - selected_formats = formats[i].formats; - found = 1; - } - } - if (found==0) { - fprintf(stderr, "Wrong format name.\n\n"); - display_usage(); - fprintf(stderr, "\n"); - display_formats(); - return -1; - } - - f = fopen(argv[3], "rb"); - if (!f) { - fprintf(stderr, "File %s not found.\n",argv[3]); - return -1; - } - - if (cassette_open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, CASSETTE_FLAG_READONLY, &cassette)) { - fprintf(stderr, "Invalid format of input file.\n"); - fclose(f); - return -1; - } - - cassette_dump(cassette,argv[4]); - cassette_close(cassette); - fclose(f); - goto theend; - } - } - } - - /* Usage */ - fprintf(stderr, "castool - Generic cassette manipulation tool for use with MESS\n\n"); - display_usage(); - fprintf(stderr, "\n"); - display_formats(); - fprintf(stderr, "\nExample usage:\n"); - fprintf(stderr, " castool.exe convert tzx game.tzx game.wav\n\n"); - -theend : - return 0; -} diff --git a/src/mess/tools/floptool/main.c b/src/mess/tools/floptool/main.c deleted file mode 100644 index 2cb36f3a873..00000000000 --- a/src/mess/tools/floptool/main.c +++ /dev/null @@ -1,275 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - main.c - - Floptool command line front end - - 20/07/2011 Initial version by Miodrag Milanovic - -***************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include "corestr.h" - -#include "formats/mfi_dsk.h" -#include "formats/dfi_dsk.h" -#include "formats/ipf_dsk.h" - -#include "formats/hxcmfm_dsk.h" -#include "formats/ami_dsk.h" - -#include "formats/st_dsk.h" -#include "formats/pasti_dsk.h" - -#include "formats/dsk_dsk.h" - -#include "formats/d88_dsk.h" -#include "formats/imd_dsk.h" -#include "formats/td0_dsk.h" -#include "formats/cqm_dsk.h" -#include "formats/pc_dsk.h" -#include "formats/naslite_dsk.h" - -#include "formats/ap_dsk35.h" -#include "formats/ap2_dsk.h" - -#include "formats/oric_dsk.h" - -#include "formats/applix_dsk.h" - -static floppy_format_type floppy_formats[] = { - FLOPPY_MFI_FORMAT, - FLOPPY_DFI_FORMAT, - FLOPPY_IPF_FORMAT, - - FLOPPY_MFM_FORMAT, - FLOPPY_ADF_FORMAT, - - FLOPPY_ST_FORMAT, - FLOPPY_MSA_FORMAT, - FLOPPY_PASTI_FORMAT, - - FLOPPY_DSK_FORMAT, - - FLOPPY_D88_FORMAT, - FLOPPY_IMD_FORMAT, - FLOPPY_TD0_FORMAT, - FLOPPY_CQM_FORMAT, - FLOPPY_PC_FORMAT, - FLOPPY_NASLITE_FORMAT, - - FLOPPY_DC42_FORMAT, - FLOPPY_A216S_FORMAT, - FLOPPY_RWTS18_FORMAT, - FLOPPY_EDD_FORMAT, - - FLOPPY_ORIC_DSK_FORMAT, - - FLOPPY_APPLIX_FORMAT, -}; - -void CLIB_DECL ATTR_PRINTF(1,2) logerror(const char *format, ...) -{ - va_list arg; - va_start(arg, format); - vprintf(format, arg); - va_end(arg); -} - -enum { FORMAT_COUNT = ARRAY_LENGTH(floppy_formats) }; - -static floppy_image_format_t *formats[FORMAT_COUNT]; - -static void init_formats() -{ - for(int i=0; i != FORMAT_COUNT; i++) - formats[i] = floppy_formats[i](); -} - -static floppy_image_format_t *find_format_by_name(const char *name) -{ - for(int i=0; i != FORMAT_COUNT; i++) - if(!core_stricmp(name, formats[i]->name())) - return formats[i]; - return 0; -} - -static floppy_image_format_t *find_format_by_identify(io_generic *image) -{ - int best = 0; - floppy_image_format_t *best_fif = 0; - - for(int i = 0; i != FORMAT_COUNT; i++) { - floppy_image_format_t *fif = formats[i]; - int score = fif->identify(image, floppy_image::FF_UNKNOWN); - if(score > best) { - best = score; - best_fif = fif; - } - } - return best_fif; -} - -static void display_usage() -{ - fprintf(stderr, "Usage: \n"); - fprintf(stderr, " floptool.exe identify [ ...]\n"); - fprintf(stderr, " floptool.exe convert [input_format|auto] output_format \n"); -} - -static void display_formats() -{ - fprintf(stderr, "Supported formats:\n\n"); - for(int i = 0; i != FORMAT_COUNT; i++) - { - floppy_image_format_t *fif = formats[i]; - fprintf(stderr, "%15s - %s [%s]\n", fif->name(), fif->description(), fif->extensions()); - } -} - -static void display_full_usage() -{ - /* Usage */ - fprintf(stderr, "floptool - Generic floppy image manipulation tool for use with MESS\n\n"); - display_usage(); - fprintf(stderr, "\n"); - display_formats(); - fprintf(stderr, "\nExample usage:\n"); - fprintf(stderr, " floptool.exe identify image.dsk\n\n"); - -} - -static int identify(int argc, char *argv[]) -{ - if (argc<3) { - fprintf(stderr, "Missing name of file to identify.\n\n"); - display_usage(); - return 1; - } - - for(int i=2; idescription()); - else - printf("%s : Unknown format\n", argv[i]); - fclose(f); - } - return 0; -} - -static int convert(int argc, char *argv[]) -{ - if (argc!=6) { - fprintf(stderr, "Incorrect number of arguments.\n\n"); - display_usage(); - return 1; - } - - floppy_image_format_t *source_format, *dest_format; - - char msg[4096]; - sprintf(msg, "Error opening %s for reading", argv[4]); - FILE *f = fopen(argv[4], "rb"); - if (!f) { - perror(msg); - return 1; - } - io_generic source_io; - source_io.file = f; - source_io.procs = &stdio_ioprocs_noclose; - source_io.filler = 0xff; - - if(!core_stricmp(argv[2], "auto")) { - source_format = find_format_by_identify(&source_io); - if(!source_format) { - fprintf(stderr, "Error: Could not identify the format of file %s\n", argv[4]); - return 1; - } - - } else { - source_format = find_format_by_name(argv[2]); - if(!source_format) { - fprintf(stderr, "Error: Format '%s' unknown\n", argv[2]); - return 1; - } - } - - dest_format = find_format_by_name(argv[3]); - if(!dest_format) { - fprintf(stderr, "Error: Format '%s' unknown\n", argv[3]); - return 1; - } - if(!dest_format->supports_save()) { - fprintf(stderr, "Error: saving to format '%s' unsupported\n", argv[3]); - return 1; - } - - sprintf(msg, "Error opening %s for writing", argv[5]); - f = fopen(argv[5], "wb"); - if (!f) { - perror(msg); - return 1; - } - io_generic dest_io; - dest_io.file = f; - dest_io.procs = &stdio_ioprocs_noclose; - dest_io.filler = 0xff; - - floppy_image image(84, 2, floppy_image::FF_UNKNOWN); - if(!source_format->load(&source_io, floppy_image::FF_UNKNOWN, &image)) { - fprintf(stderr, "Error: parsing input file as '%s' failed\n", source_format->name()); - return 1; - } - - if(!dest_format->save(&dest_io, &image)) { - fprintf(stderr, "Error: writing output file as '%s' failed\n", dest_format->name()); - return 1; - } - - fclose((FILE *)source_io.file); - fclose((FILE *)dest_io.file); - - return 0; -} - -int CLIB_DECL main(int argc, char *argv[]) -{ - init_formats(); - - if (argc == 1) { - display_full_usage(); - return 0; - } - - if (!core_stricmp("identify", argv[1])) - return identify(argc, argv); - else if (!core_stricmp("convert", argv[1])) - return convert(argc, argv); - else { - fprintf(stderr, "Unknown command '%s'\n\n", argv[1]); - display_usage(); - return 1; - } -} diff --git a/src/mess/tools/imgtool/charconv.c b/src/mess/tools/imgtool/charconv.c deleted file mode 100644 index 39b5953d799..00000000000 --- a/src/mess/tools/imgtool/charconv.c +++ /dev/null @@ -1,162 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - charconv.c - - Imgtool character set conversion routines. - -***************************************************************************/ - -#include "corestr.h" -#include "charconv.h" - - -/*------------------------------------------------- - utf8_from_latin1 - convert an ISO-8859-1 - character sequence to an UTF-8 string --------------------------------------------------*/ - -static char *utf8_from_latin1(const char *src) -{ - char *buffer, *bufptr; - - /* validate input */ - if (!src) - { - return NULL; - } - - /* allocate space for result, twice the source len to be safe */ - buffer = (char *) osd_malloc(strlen(src) * 2 + 1); - - /* point to the start */ - bufptr = buffer; - - do - { - unsigned char c = *src; - - if (c < 0x80) - { - *bufptr++ = c; - } - else if (c < 0xc0) - { - *bufptr++ = '\xc2'; - *bufptr++ = c; - } - else - { - *bufptr++ = '\xc3'; - *bufptr++ = c - 0x40; - } - } while (*src++); - - return buffer; -} - - -/*------------------------------------------------- - latin1_from_utf8 - convert an UTF-8 - character sequence to an ISO-8859-1 string --------------------------------------------------*/ - -static char *latin1_from_utf8(const char *src) -{ - char *buffer, *bufptr; - - /* validate input */ - if (!src) - { - return NULL; - } - - /* allocate space for result */ - buffer = (char *) osd_malloc(strlen(src) + 1); - - /* point to the start */ - bufptr = buffer; - - do - { - unsigned char c = *src; - - if (c < 0x80) - { - *bufptr++ = c; - } - else if (c == 0xc2) - { - c = *++src; - *bufptr++ = c; - } - else if (c == 0xc3) - { - c = *++src; - *bufptr++ = c + 0x40; - } - else - { - /* conversion failed */ - *bufptr++ = '\0'; - break; - } - } while(*src++); - - return buffer; -} - - -/*------------------------------------------------- - utf8_from_native - convert specified character - sequence to an UTF-8 string --------------------------------------------------*/ - -char *utf8_from_native(imgtool_charset charset, const char *src) -{ - char *result; - - switch (charset) - { - case IMGTOOL_CHARSET_UTF8: - result = core_strdup(src); - break; - - case IMGTOOL_CHARSET_ISO_8859_1: - result = utf8_from_latin1(src); - break; - - default: - result = NULL; - break; - } - return result; -} - - -/*------------------------------------------------- - native_from_utf8 - convert an UTF-8 string - to specified character set --------------------------------------------------*/ - -char *native_from_utf8(imgtool_charset charset, const char *src) -{ - char *result; - - switch (charset) - { - case IMGTOOL_CHARSET_UTF8: - result = core_strdup(src); - break; - - case IMGTOOL_CHARSET_ISO_8859_1: - result = latin1_from_utf8(src); - break; - - default: - result = NULL; - break; - } - return result; -} diff --git a/src/mess/tools/imgtool/charconv.h b/src/mess/tools/imgtool/charconv.h deleted file mode 100644 index 1544e9df402..00000000000 --- a/src/mess/tools/imgtool/charconv.h +++ /dev/null @@ -1,31 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - charconv.h - - Imgtool character set conversion routines. - -***************************************************************************/ - - -#ifndef __CHARCONV_H__ -#define __CHARCONV_H__ - - -/* Supported character sets */ -enum imgtool_charset -{ - IMGTOOL_CHARSET_UTF8, - IMGTOOL_CHARSET_ISO_8859_1, -}; - - -/* Convert specified charset to UTF-8 */ -char *utf8_from_native(imgtool_charset charset, const char *src); - -/* Convert UTF-8 string to specified charset */ -char *native_from_utf8(imgtool_charset charset, const char *src); - - -#endif /* __CHARCONV_H__ */ diff --git a/src/mess/tools/imgtool/filtbas.c b/src/mess/tools/imgtool/filtbas.c deleted file mode 100644 index bff1bda121e..00000000000 --- a/src/mess/tools/imgtool/filtbas.c +++ /dev/null @@ -1,3115 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/**************************************************************************** - - filtbas.c - - Filter for Microsoft-style tokenized BASIC files - - BASIC files typically follow the following format: - - int8 $ff - int16 - ... - int16 - int16 - int8[] - int8 $00 End of line delimiter - -*****************************************************************************/ - -#include -#include -#include - -#include "imgtool.h" -#include "formats/imageutl.h" - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define EOLN (CRLF == 1 ? "\r" : (CRLF == 2 ? "\n" : (CRLF == 3 ? "\r\n" : NULL))) - - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -struct basictoken_tableent -{ - UINT8 shift; - UINT8 base; - const char *const *tokens; - int num_tokens; -}; - - - -struct basictokens -{ - UINT16 baseaddress; - unsigned int skip_bytes : 15; - unsigned int be : 1; - const basictoken_tableent *entries; - int num_entries; -}; - - - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -/*------------------------------------------------- - basic_readfile - reads a file and decodes - BASIC tokens into ASCII text --------------------------------------------------*/ - -static imgtoolerr_t basic_readfile(const basictokens *tokens, - imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t err; - imgtool_stream *mem_stream; - UINT8 line_header[4]; - UINT16 line_number; //, address; - UINT8 b, shift; - int i; - int in_string = FALSE; - const basictoken_tableent *token_table; - const char *token; - - /* open a memory stream */ - mem_stream = stream_open_mem(NULL, 0); - if (mem_stream == NULL) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - /* read actual file */ - err = imgtool_partition_read_file(partition, filename, fork, mem_stream, NULL); - if (err) - goto done; - - /* skip first few bytes */ - stream_seek(mem_stream, tokens->skip_bytes, SEEK_SET); - - /* keep reading line headers */ - while(stream_read(mem_stream, line_header, sizeof(line_header)) == sizeof(line_header)) - { - /* pluck the address and line number out */ - if (tokens->be) - { - //address = (UINT16) - pick_integer_be(line_header, 0, 2); - line_number = (UINT16) pick_integer_be(line_header, 2, 2); - } - else - { - //address = (UINT16) - pick_integer_le(line_header, 0, 2); - line_number = (UINT16) pick_integer_le(line_header, 2, 2); - } - - /* write the line number */ - stream_printf(destf, "%u ", (unsigned) line_number); - shift = 0x00; - - while((stream_read(mem_stream, &b, 1) > 0) && (b != 0x00)) - { - if (b == 0x22) - in_string = in_string ? FALSE : TRUE; - - if ((b & 0x80) && (!in_string)) - { - token = NULL; - - for (i = 0; i < tokens->num_entries; i++) - { - token_table = &tokens->entries[i]; - if (token_table->shift == shift) - { - if ((b - 0x80) < token_table->num_tokens) - { - token = token_table->tokens[b - 0x80]; - if (token) - shift = 0x00; - } - } - - if (token_table->shift == b) - { - shift = token_table->shift; - break; - } - } - - if (shift == 0x00) - stream_puts(destf, token ? token : "!"); - } - else - { - stream_putc(destf, (char) b); - } - } - - stream_puts(destf, EOLN); - } - -done: - if (mem_stream != NULL) - stream_close(mem_stream); - return err; -} - - - -/*------------------------------------------------- - basic_writefile - translates ASCII text to - BASIC tokens and writes it to a file --------------------------------------------------*/ - -static imgtoolerr_t basic_writefile(const basictokens *tokens, - imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtoolerr_t err; - imgtool_stream *mem_stream; - char buf[1024]; - int eof = FALSE; - UINT32 len; - char c; - int i, j, pos, in_quotes; - UINT16 line_number; - UINT8 line_header[4]; - UINT8 file_header[3]; - const basictoken_tableent *token_table; - const char *token; - UINT8 token_shift, token_value; - UINT16 address; - - /* open a memory stream */ - mem_stream = stream_open_mem(NULL, 0); - if (mem_stream == NULL) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - /* skip first few bytes */ - stream_fill(mem_stream, 0x00, tokens->skip_bytes); - - /* loop until the file is complete */ - while(!eof) - { - /* read a line */ - pos = 0; - while((len = stream_read(sourcef, &c, 1)) > 0) - { - /* break if at end of line */ - if ((c == '\r') || (c == '\n')) - break; - - if (pos <= ARRAY_LENGTH(buf) - 1) - { - buf[pos++] = c; - } - } - eof = (len == 0); - buf[pos] = '\0'; - - /* ignore lines that don't start with digits */ - if (isdigit(buf[0])) - { - /* start at beginning of line */ - pos = 0; - - /* read line number */ - line_number = 0; - while(isdigit(buf[pos])) - { - line_number *= 10; - line_number += (buf[pos++] - '0'); - } - - /* determine address */ - if (tokens->baseaddress != 0) - { - address = tokens->baseaddress + (UINT16)stream_size(mem_stream) + 4; - } - else - { - address = 0x0000; - } - - /* set up line header */ - memset(&line_header, 0, sizeof(line_header)); - if (tokens->be) - { - place_integer_be(line_header, 0, 2, address); - place_integer_be(line_header, 2, 2, line_number); - } - else - { - place_integer_be(line_header, 0, 2, address); - place_integer_be(line_header, 2, 2, line_number); - } - - /* emit line header */ - stream_write(mem_stream, line_header, sizeof(line_header)); - - /* skip spaces */ - while(isspace(buf[pos])) - pos++; - - /* when we start out, we are not within quotation marks */ - in_quotes = FALSE; - - /* read until end of line */ - while(buf[pos] != '\0') - { - token = NULL; - token_shift = 0; - token_value = 0; - - if (buf[pos] == '\"') - { - /* flip quotation status */ - in_quotes = !in_quotes; - } - else if (!in_quotes) - { - for (i = 0; (token == NULL) && (i < tokens->num_entries); i++) - { - token_table = &tokens->entries[i]; - for (j = 0; (token == NULL) && (j < token_table->num_tokens); j++) - { - if (!strncmp(&buf[pos], token_table->tokens[j], strlen(token_table->tokens[j]))) - { - token = token_table->tokens[j]; - token_shift = token_table->shift; - token_value = token_table->base + j; - pos += strlen(token); - } - } - } - } - - /* did we find a token? */ - if (token != NULL) - { - /* emit the token */ - if (token_shift != 0) - stream_write(mem_stream, &token_shift, 1); - stream_write(mem_stream, &token_value, 1); - } - else - { - /* no token; emit the byte */ - stream_write(mem_stream, &buf[pos++], 1); - } - } - - /* emit line terminator */ - stream_fill(mem_stream, 0x00, 1); - } - } - - /* emit program terminator */ - stream_fill(mem_stream, 0x00, 2); - - /* reset stream */ - stream_seek(mem_stream, 0, SEEK_SET); - - /* this is somewhat gross */ - if (tokens->skip_bytes >= 3) - { - if (tokens->be) - { - place_integer_be(file_header, 0, 1, 0xFF); - place_integer_be(file_header, 1, 2, stream_size(mem_stream)); - } - else - { - place_integer_le(file_header, 0, 1, 0xFF); - place_integer_le(file_header, 1, 2, stream_size(mem_stream)); - } - stream_write(mem_stream, file_header, 3); - stream_seek(mem_stream, 0, SEEK_SET); - } - - /* write actual file */ - err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL); - if (err) - goto done; - -done: - if (mem_stream != NULL) - stream_close(mem_stream); - return err; -} - - - -/*************************************************************************** - TOKEN DEFINITIONS -***************************************************************************/ - -static const char *const cocobas_statements[] = -{ - "FOR", /* 0x80 */ - "GO", /* 0x81 */ - "REM", /* 0x82 */ - "'", /* 0x83 */ - "ELSE", /* 0x84 */ - "IF", /* 0x85 */ - "DATA", /* 0x86 */ - "PRINT", /* 0x87 */ - "ON", /* 0x88 */ - "INPUT", /* 0x89 */ - "END", /* 0x8a */ - "NEXT", /* 0x8b */ - "DIM", /* 0x8c */ - "READ", /* 0x8d */ - "RUN", /* 0x8e */ - "RESTORE", /* 0x8f */ - "RETURN", /* 0x90 */ - "STOP", /* 0x91 */ - "POKE", /* 0x92 */ - "CONT", /* 0x93 */ - "LIST", /* 0x94 */ - "CLEAR", /* 0x95 */ - "NEW", /* 0x96 */ - "CLOAD", /* 0x97 */ - "CSAVE", /* 0x98 */ - "OPEN", /* 0x99 */ - "CLOSE", /* 0x9a */ - "LLIST", /* 0x9b */ - "SET", /* 0x9c */ - "RESET", /* 0x9d */ - "CLS", /* 0x9e */ - "MOTOR", /* 0x9f */ - "SOUND", /* 0xa0 */ - "AUDIO", /* 0xa1 */ - "EXEC", /* 0xa2 */ - "SKIPF", /* 0xa3 */ - "TAB(", /* 0xa4 */ - "TO", /* 0xa5 */ - "SUB", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "OFF", /* 0xaa */ - "+", /* 0xab */ - "-", /* 0xac */ - "*", /* 0xad */ - "/", /* 0xae */ - "^", /* 0xaf */ - "AND", /* 0xb0 */ - "OR", /* 0xb1 */ - ">", /* 0xb2 */ - "=", /* 0xb3 */ - "<", /* 0xb4 */ - "DEL", /* 0xb5 */ - "EDIT", /* 0xb6 */ - "TRON", /* 0xb7 */ - "TROFF", /* 0xb8 */ - "DEF", /* 0xb9 */ - "LET", /* 0xba */ - "LINE", /* 0xbb */ - "PCLS", /* 0xbc */ - "PSET", /* 0xbd */ - "PRESET", /* 0xbe */ - "SCREEN", /* 0xbf */ - "PCLEAR", /* 0xc0 */ - "COLOR", /* 0xc1 */ - "CIRCLE", /* 0xc2 */ - "PAINT", /* 0xc3 */ - "GET", /* 0xc4 */ - "PUT", /* 0xc5 */ - "DRAW", /* 0xc6 */ - "PCOPY", /* 0xc7 */ - "PMODE", /* 0xc8 */ - "PLAY", /* 0xc9 */ - "DLOAD", /* 0xca */ - "RENUM", /* 0xcb */ - "FN", /* 0xcc */ - "USING", /* 0xcd */ - "DIR", /* 0xce */ - "DRIVE", /* 0xcf */ - "FIELD", /* 0xd0 */ - "FILES", /* 0xd1 */ - "KILL", /* 0xd2 */ - "LOAD", /* 0xd3 */ - "LSET", /* 0xd4 */ - "MERGE", /* 0xd5 */ - "RENAME", /* 0xd6 */ - "RSET", /* 0xd7 */ - "SAVE", /* 0xd8 */ - "WRITE", /* 0xd9 */ - "VERIFY", /* 0xda */ - "UNLOAD", /* 0xdb */ - "DSKINI", /* 0xdc */ - "BACKUP", /* 0xdd */ - "COPY", /* 0xde */ - "DSKI$", /* 0xdf */ - "DSKO$", /* 0xe0 */ - "DOS", /* 0xe1 */ - "WIDTH", /* 0xe2 */ - "PALETTE", /* 0xe3 */ - "HSCREEN", /* 0xe4 */ - "LPOKE", /* 0xe5 */ - "HCLS", /* 0xe6 */ - "HCOLOR", /* 0xe7 */ - "HPAINT", /* 0xe8 */ - "HCIRCLE", /* 0xe9 */ - "HLINE", /* 0xea */ - "HGET", /* 0xeb */ - "HPUT", /* 0xec */ - "HBUFF", /* 0xed */ - "HPRINT", /* 0xee */ - "ERR", /* 0xef */ - "BRK", /* 0xf0 */ - "LOCATE", /* 0xf1 */ - "HSTAT", /* 0xf2 */ - "HSET", /* 0xf3 */ - "HRESET", /* 0xf4 */ - "HDRAW", /* 0xf5 */ - "CMP", /* 0xf6 */ - "RGB", /* 0xf7 */ - "ATTR" /* 0xf8 */ -}; - -static const char *const cocobas_functions[] = -{ - "SGN", /* 0xff80 */ - "INT", /* 0xff81 */ - "ABS", /* 0xff82 */ - "USR", /* 0xff83 */ - "RND", /* 0xff84 */ - "SIN", /* 0xff85 */ - "PEEK", /* 0xff86 */ - "LEN", /* 0xff87 */ - "STR$", /* 0xff88 */ - "VAL", /* 0xff89 */ - "ASC", /* 0xff8a */ - "CHR$", /* 0xff8b */ - "EOF", /* 0xff8c */ - "JOYSTK", /* 0xff8d */ - "LEFT$", /* 0xff8e */ - "RIGHT$", /* 0xff8f */ - "MID$", /* 0xff90 */ - "POINT", /* 0xff91 */ - "INKEY$", /* 0xff92 */ - "MEM", /* 0xff93 */ - "ATN", /* 0xff94 */ - "COS", /* 0xff95 */ - "TAN", /* 0xff96 */ - "EXP", /* 0xff97 */ - "FIX", /* 0xff98 */ - "LOG", /* 0xff99 */ - "POS", /* 0xff9a */ - "SQR", /* 0xff9b */ - "HEX$", /* 0xff9c */ - "VARPTR", /* 0xff9d */ - "INSTR", /* 0xff9e */ - "TIMER", /* 0xff9f */ - "PPOINT", /* 0xffa0 */ - "STRING$", /* 0xffa1 */ - "CVN", /* 0xffa2 */ - "FREE", /* 0xffa3 */ - "LOC", /* 0xffa4 */ - "LOF", /* 0xffa5 */ - "MKN$", /* 0xffa6 */ - "AS", /* 0xffa7 */ - "LPEEK", /* 0xffa8 */ - "BUTTON", /* 0xffa9 */ - "HPOINT", /* 0xffaa */ - "ERNO", /* 0xffab */ - "ERLIN" /* 0xffac */ -}; - -static const char *const dragonbas_statements[] = -{ - "FOR", /* 0x80 */ - "GO", /* 0x81 */ - "REM", /* 0x82 */ - "'", /* 0x83 */ - "ELSE", /* 0x84 */ - "IF", /* 0x85 */ - "DATA", /* 0x86 */ - "PRINT", /* 0x87 */ - "ON", /* 0x88 */ - "INPUT", /* 0x89 */ - "END", /* 0x8a */ - "NEXT", /* 0x8b */ - "DIM", /* 0x8c */ - "READ", /* 0x8d */ - "LET", /* 0x8e */ - "RUN", /* 0x8f */ - "RESTORE", /* 0x90 */ - "RETURN", /* 0x91 */ - "STOP", /* 0x92 */ - "POKE", /* 0x93 */ - "CONT", /* 0x94 */ - "LIST", /* 0x95 */ - "CLEAR", /* 0x96 */ - "NEW", /* 0x97 */ - "DEF", /* 0x98 */ - "CLOAD", /* 0x99 */ - "CSAVE", /* 0x9a */ - "OPEN", /* 0x9b */ - "CLOSE", /* 0x9c */ - "LLIST", /* 0x9d */ - "SET", /* 0x9e */ - "RESET", /* 0x9f */ - "CLS", /* 0xa0 */ - "MOTOR", /* 0xa1 */ - "SOUND", /* 0xa2 */ - "AUDIO", /* 0xa3 */ - "EXEC", /* 0xa4 */ - "SKIPF", /* 0xa5 */ - "DEL", /* 0xa6 */ - "EDIT", /* 0xa7 */ - "TRON", /* 0xa8 */ - "TROFF", /* 0xa9 */ - "LINE", /* 0xaa */ - "PCLS", /* 0xab */ - "PSET", /* 0xac */ - "PRESET", /* 0xad */ - "SCREEN", /* 0xae */ - "PCLEAR", /* 0xaf */ - "COLOR", /* 0xb0 */ - "CIRCLE", /* 0xb1 */ - "PAINT", /* 0xb2 */ - "GET", /* 0xb3 */ - "PUT", /* 0xb4 */ - "DRAW", /* 0xb5 */ - "PCOPY", /* 0xb6 */ - "PMODE", /* 0xb7 */ - "PLAY", /* 0xb8 */ - "DLOAD", /* 0xb9 */ - "RENUM", /* 0xba */ - "TAB(", /* 0xbb */ - "TO", /* 0xbc */ - "SUB", /* 0xbd */ - "FN", /* 0xbe */ - "THEN", /* 0xbf */ - "NOT", /* 0xc0 */ - "STEP", /* 0xc1 */ - "OFF", /* 0xc2 */ - "+", /* 0xc3 */ - "-", /* 0xc4 */ - "*", /* 0xc5 */ - "/", /* 0xc6 */ - "^", /* 0xc7 */ - "AND", /* 0xc8 */ - "OR", /* 0xc9 */ - ">", /* 0xca */ - "=", /* 0xcb */ - "<", /* 0xcc */ - "USING", /* 0xcd */ - "DIR", /* 0xce */ - "DRIVE", /* 0xcf */ - "FIELD", /* 0xd0 */ - "FILES", /* 0xd1 */ - "KILL", /* 0xd2 */ - "LOAD", /* 0xd3 */ - "LSET", /* 0xd4 */ - "MERGE", /* 0xd5 */ - "RENAME", /* 0xd6 */ - "RSET", /* 0xd7 */ - "SAVE", /* 0xd8 */ - "WRITE", /* 0xd9 */ - "VERIFY", /* 0xda */ - "UNLOAD", /* 0xdb */ - "DSKINI", /* 0xdc */ - "BACKUP", /* 0xdd */ - "COPY", /* 0xde */ - "DSKI$", /* 0xdf */ - "DSKO$" /* 0xe0 */ -}; - -static const char *const dragonbas_functions[] = -{ - "SGN", /* 0xff80 */ - "INT", /* 0xff81 */ - "ABS", /* 0xff82 */ - "POS", /* 0xff83 */ - "RND", /* 0xff84 */ - "SQR", /* 0xff85 */ - "LOG", /* 0xff86 */ - "EXP", /* 0xff87 */ - "SIN", /* 0xff88 */ - "COS", /* 0xff89 */ - "TAN", /* 0xff8a */ - "ATN", /* 0xff8b */ - "PEEK", /* 0xff8c */ - "LEN", /* 0xff8d */ - "STR$", /* 0xff8e */ - "VAL", /* 0xff8f */ - "ASC", /* 0xff90 */ - "CHR$", /* 0xff91 */ - "EOF", /* 0xff92 */ - "JOYSTK", /* 0xff93 */ - "FIX", /* 0xff94 */ - "HEX$", /* 0xff95 */ - "LEFT$", /* 0xff96 */ - "RIGHT$", /* 0xff97 */ - "MID$", /* 0xff98 */ - "POINT", /* 0xff99 */ - "INKEY$", /* 0xff9a */ - "MEM", /* 0xff9b */ - "VARPTR", /* 0xff9c */ - "INSTR", /* 0xff9d */ - "TIMER", /* 0xff9e */ - "PPOINT", /* 0xff9f */ - "STRING$", /* 0xffa0 */ - "USR" /* 0xffa1 */ - "CVN", /* 0xffa2 */ - "FREE", /* 0xffa3 */ - "LOC", /* 0xffa4 */ - "LOF", /* 0xffa5 */ - "MKN$" /* 0xffa6 */ -}; - -static const char *const vzbas[] = -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "RESET", /* 0x82 */ - "SET", /* 0x83 */ - "CLS", /* 0x84 */ - NULL, /* 0x85 */ - "RANDOM", /* 0x86 */ - "NEXT", /* 0x87 */ - "DATA", /* 0x88 */ - "INPUT", /* 0x89 */ - "DIM", /* 0x8a */ - "READ", /* 0x8b */ - "LET", /* 0x8c */ - "GOTO", /* 0x8d */ - "RUN", /* 0x8e */ - "IF", /* 0x8f */ - "RESTORE", /* 0x90 */ - "GOSUB", /* 0x91 */ - "RETURN", /* 0x92 */ - "'", /* 0x93 */ - "STOP", /* 0x94 */ - "ELSE", /* 0x95 */ - "COPY", /* 0x96 */ - "COLOR", /* 0x97 */ - "VERIFY", /* 0x98 */ - "DEFINT", /* 0x99 */ - "DEFSNG", /* 0x9a */ - "DEFDBL", /* 0x9b */ - "CRUN", /* 0x9c */ - "MODE", /* 0x9d */ - "ERROR", /* 0x9e */ - "RESUME", /* 0x9f */ - "OUT", /* 0xa0 */ - "IN", /* 0xa1 */ - NULL, /* 0xa2 */ - NULL, /* 0xa3 */ - NULL, /* 0xa4 */ - NULL, /* 0xa5 */ - NULL, /* 0xa6 */ - NULL, /* 0xa7 */ - NULL, /* 0xa8 */ - NULL, /* 0xa9 */ - NULL, /* 0xaa */ - NULL, /* 0xab */ - NULL, /* 0xac */ - NULL, /* 0xad */ - "(RESET)", /* 0xae */ - "LPRINT", /* 0xaf */ - NULL, /* 0xb0 */ - "POKE", /* 0xb1 */ - "PRINT", /* 0xb2 */ - "CONT", /* 0xb3 */ - "LIST", /* 0xb4 */ - "LLIST", /* 0xb5 */ - "DELETE", /* 0xb6 */ - "AUTO", /* 0xb7 */ - "CLEAR", /* 0xb8 */ - "CLOAD", /* 0xb9 */ - "CSAVE", /* 0xba */ - "NEW", /* 0xbb */ - "TAB(", /* 0xbc */ - "TO", /* 0xbd */ - NULL, /* 0xbe */ - "USING", /* 0xbf */ - "VARPTR", /* 0xc0 */ - "USR", /* 0xc1 */ - "ERL", /* 0xc2 */ - "ERR", /* 0xc3 */ - "STRING$", /* 0xc4 */ - NULL, /* 0xc5 */ - "POINT", /* 0xc6 */ - NULL, /* 0xc7 */ - "MEM", /* 0xc8 */ - "INKEY$", /* 0xc9 */ - "THEN", /* 0xca */ - "NOT", /* 0xcb */ - "STEP", /* 0xcc */ - "+", /* 0xcd */ - "-", /* 0xce */ - "*", /* 0xcf */ - "/", /* 0xd0 */ - "^", /* 0xd1 */ - "AND", /* 0xd2 */ - "OR", /* 0xd3 */ - ">", /* 0xd4 */ - "=", /* 0xd5 */ - "<", /* 0xd6 */ - "SGN", /* 0xd7 */ - "INT", /* 0xd8 */ - "ABS", /* 0xd9 */ - "FRE", /* 0xda */ - "INP", /* 0xdb */ - "POS", /* 0xdc */ - "SQR", /* 0xdd */ - "AND", /* 0xde */ - "LOG", /* 0xdf */ - "EXP", /* 0xe0 */ - "COS", /* 0xe1 */ - "SIN", /* 0xe2 */ - "TAN", /* 0xe3 */ - "ATN", /* 0xe4 */ - "PEEK", /* 0xe5 */ - NULL, /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ - "CINT", /* 0xef */ - "CSNG", /* 0xf0 */ - "CDBL", /* 0xf1 */ - "FIX", /* 0xf2 */ - "LEN", /* 0xf3 */ - "STR$", /* 0xf4 */ - "VAL", /* 0xf5 */ - "ASC", /* 0xf6 */ - "CHR$", /* 0xf7 */ - "LEFT$", /* 0xf8 */ - "RIGHT$", /* 0xf9 */ - "MID$", /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - NULL /* 0xff */ -}; - -static const char *const bml3bas_statements[] = -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "DIM", /* 0x84 */ - "READ", /* 0x85 */ - "LET", /* 0x86 */ - "GO", /* 0x87 */ - "RUN", /* 0x88 */ - "IF", /* 0x89 */ - "RESTORE", /* 0x8a */ - "RETURN", /* 0x8b */ - "REM", /* 0x8c */ - "'", /* 0x8d */ - "STOP", /* 0x8e */ - "ELSE", /* 0x8f */ - "TRON", /* 0x90 */ - "TROFF", /* 0x91 */ - "SWAP", /* 0x92 */ - "DEFSTR", /* 0x93 */ - "DEFINT", /* 0x94 */ - "DEFSNG", /* 0x95 */ - "DEFDBL", /* 0x96 */ - "ON", /* 0x97 */ - "WAIT", /* 0x98 */ - "RENUM", /* 0x99 */ - "EDIT", /* 0x9a */ - "ERROR", /* 0x9b */ - "RESUME", /* 0x9c */ - "AUTO", /* 0x9d */ - "DELETE", /* 0x9e */ - "TERM", /* 0x9f */ - "WIDTH", /* 0xa0 */ - "UNLIST", /* 0xa1 */ - "MON", /* 0xa2 */ - "LOCATE", /* 0xa3 */ - "CLS", /* 0xa4 */ - "CONSOLE", /* 0xa5 */ - "PSET", /* 0xa6 */ - "PRESET", /* 0xa7 */ - "MOTOR", /* 0xa8 */ - "SKIPF", /* 0xa9 */ - "SAVE", /* 0xaa */ - "LOAD", /* 0xab */ - "MERGE", /* 0xac */ - "EXEC", /* 0xad */ - "OPEN", /* 0xae */ - "CLOSE", /* 0xaf */ - "FILES", /* 0xb0 */ - "COM", /* 0xb1 */ - "KEY", /* 0xb2 */ - "PAINT", /* 0xb3 */ - "BEEP", /* 0xb4 */ - "COLOR", /* 0xb5 */ - "LINE", /* 0xb6 */ - "DEF", /* 0xb7 */ - "POKE", /* 0xb8 */ - "PRINT", /* 0xb9 */ - "CONT", /* 0xba */ - "LIST", /* 0xbb */ - "CLEAR", /* 0xbc */ - "RANDOMIZE",/* 0xbd */ - "WHILE", /* 0xbe */ - "WEND", /* 0xbf */ - "NEW", /* 0xc0 */ - "TAB(", /* 0xc1 */ - "TO", /* 0xc2 */ - "SUB", /* 0xc3 */ - "FN", /* 0xc4 */ - "SPC(", /* 0xc5 */ - "USING", /* 0xc6 */ - "USR", /* 0xc7 */ - "ERL", /* 0xc8 */ - "ERR", /* 0xc9 */ - "OFF", /* 0xca */ - "THEN", /* 0xcb */ - "NOT", /* 0xcc */ - "STEP", /* 0xcd */ - "+", /* 0xce */ - "-", /* 0xcf */ - "*", /* 0xd0 */ - "/", /* 0xd1 */ - "^", /* 0xd2 */ - "AND", /* 0xd3 */ - "OR", /* 0xd4 */ - "XOR", /* 0xd5 */ - "EQV", /* 0xd6 */ - "IMP", /* 0xd7 */ - "MOD", /* 0xd8 */ - "\\", /* 0xd9 */ - ">", /* 0xda */ - "=", /* 0xdb */ - "<" /* 0xdc */ -}; - -static const char *const bml3bas_functions[] = -{ - "SGN", /* 0xff80 */ - "INT", /* 0xff81 */ - "ABS", /* 0xff82 */ - "FRE", /* 0xff83 */ - "POS", /* 0xff84 */ - "SQR", /* 0xff85 */ - "LOG", /* 0xff86 */ - "EXP", /* 0xff87 */ - "COS", /* 0xff88 */ - "SIN", /* 0xff89 */ - "TAN", /* 0xff8a */ - "ATN", /* 0xff8b */ - "PEEK", /* 0xff8c */ - "LEN", /* 0xff8d */ - "STR$", /* 0xff8e */ - "VAL", /* 0xff8f */ - "ASC", /* 0xff90 */ - "CHR$", /* 0xff91 */ - "CINT", /* 0xff92 */ - "CSNG", /* 0xff93 */ - "CDBL", /* 0xff94 */ - "FIX", /* 0xff95 */ - "SPACE$", /* 0xff96 */ - "HEX$", /* 0xff97 */ - "OCT$", /* 0xff98 */ - "LOF", /* 0xff99 */ - "EOF", /* 0xff9a */ - "PEN", /* 0xff9b */ - "LEFT$", /* 0xff9c */ - "RIGHT$", /* 0xff9d */ - "MID$", /* 0xff9e */ - "INSTR", /* 0xff9f */ - "SCREEN", /* 0xffa0 */ - "VARPTR", /* 0xffa1 */ - "STRING$", /* 0xffa2 */ - "RND", /* 0xffa3 */ - "INKEY$", /* 0xffa4 */ - "INPUT", /* 0xffa5 */ - "CSRLIN", /* 0xffa6 */ - "POINT", /* 0xffa7 */ - "TIME", /* 0xffa8 */ - "DATE" /* 0xffa9 */ -}; - - -#ifdef BASIC_ -/* ----------------------------------------------------------------------- * - * CBM machines * - * ----------------------------------------------------------------------- */ -static const char *const basic_10[] = /* "BASIC 1.0" - supported by pet */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - NULL, /* 0xcb */ - NULL, /* 0xcc */ - NULL, /* 0xcd */ - NULL, /* 0xce */ - NULL, /* 0xcf */ - NULL, /* 0xd0 */ - NULL, /* 0xd1 */ - NULL, /* 0xd2 */ - NULL, /* 0xd3 */ - NULL, /* 0xd4 */ - NULL, /* 0xd5 */ - NULL, /* 0xd6 */ - NULL, /* 0xd7 */ - NULL, /* 0xd8 */ - NULL, /* 0xd9 */ - NULL, /* 0xda */ - NULL, /* 0xdb */ - NULL, /* 0xdc */ - NULL, /* 0xdd */ - NULL, /* 0xde */ - NULL, /* 0xdf */ - NULL, /* 0xe0 */ - NULL, /* 0xe1 */ - NULL, /* 0xe2 */ - NULL, /* 0xe3 */ - NULL, /* 0xe4 */ - NULL, /* 0xe5 */ - NULL, /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ - NULL, /* 0xef */ - NULL, /* 0xf0 */ - NULL, /* 0xf1 */ - NULL, /* 0xf2 */ - NULL, /* 0xf3 */ - NULL, /* 0xf4 */ - NULL, /* 0xf5 */ - NULL, /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_20[] = /* "BASIC 2.0" - supported by vic20 & clones, c64 & clones, cbm30xx series */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - NULL, /* 0xcc */ - NULL, /* 0xcd */ - NULL, /* 0xce */ - NULL, /* 0xcf */ - NULL, /* 0xd0 */ - NULL, /* 0xd1 */ - NULL, /* 0xd2 */ - NULL, /* 0xd3 */ - NULL, /* 0xd4 */ - NULL, /* 0xd5 */ - NULL, /* 0xd6 */ - NULL, /* 0xd7 */ - NULL, /* 0xd8 */ - NULL, /* 0xd9 */ - NULL, /* 0xda */ - NULL, /* 0xdb */ - NULL, /* 0xdc */ - NULL, /* 0xdd */ - NULL, /* 0xde */ - NULL, /* 0xdf */ - NULL, /* 0xe0 */ - NULL, /* 0xe1 */ - NULL, /* 0xe2 */ - NULL, /* 0xe3 */ - NULL, /* 0xe4 */ - NULL, /* 0xe5 */ - NULL, /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ - NULL, /* 0xef */ - NULL, /* 0xf0 */ - NULL, /* 0xf1 */ - NULL, /* 0xf2 */ - NULL, /* 0xf3 */ - NULL, /* 0xf4 */ - NULL, /* 0xf5 */ - NULL, /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_20_super_expander_vic[] = /* "BASIC 2.0 with Super Expander" - supported by vic20 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "KEY", /* 0xcc */ - "GRAPHIC", /* 0xcd */ - "SCNCLR", /* 0xce */ - "CIRCLE", /* 0xcf */ - "DRAW", /* 0xd0 */ - "REGION", /* 0xd1 */ - "COLOR", /* 0xd2 */ - "POINT", /* 0xd3 */ - "SOUND", /* 0xd4 */ - "CHAR", /* 0xd5 */ - "PAINT", /* 0xd6 */ - "RPOT", /* 0xd7 */ - "RPEN", /* 0xd8 */ - "RSND", /* 0xd9 */ - "RCOLR", /* 0xda */ - "RGR", /* 0xdb */ - "RJOY", /* 0xdc */ - "RDOT", /* 0xdd */ - NULL, /* 0xde */ - NULL, /* 0xdf */ - NULL, /* 0xe0 */ - NULL, /* 0xe1 */ - NULL, /* 0xe2 */ - NULL, /* 0xe3 */ - NULL, /* 0xe4 */ - NULL, /* 0xe5 */ - NULL, /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ - NULL, /* 0xef */ - NULL, /* 0xf0 */ - NULL, /* 0xf1 */ - NULL, /* 0xf2 */ - NULL, /* 0xf3 */ - NULL, /* 0xf4 */ - NULL, /* 0xf5 */ - NULL, /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_20_turtle_basic_10[] = /* "BASIC 2.0 with Turtle BASIC 1.0" - supported by vic20 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "GRAPHIC", /* 0xcc */ - "OLD", /* 0xcd */ - "TURN", /* 0xce */ - "PEN", /* 0xcf */ - "DRAW", /* 0xd0 */ - "MOVE", /* 0xd1 */ - "POINT", /* 0xd2 */ - "KILL", /* 0xd3 */ - "WRITE", /* 0xd4 */ - "REPEAT", /* 0xd5 */ - "SCREEN", /* 0xd6 */ - "DOKE", /* 0xd7 */ - "RELOC", /* 0xd8 */ - "FILL", /* 0xd9 */ - "RTIME", /* 0xda */ - "BASE", /* 0xdb */ - "PAUSE", /* 0xdc */ - "POP", /* 0xdd */ - "COLOR", /* 0xde */ - "MERGE", /* 0xdf */ - "CHAR", /* 0xe0 */ - "TAKE", /* 0xe1 */ - "SOUND", /* 0xe2 */ - "VOL", /* 0xe3 */ - "PUT", /* 0xe4 */ - "PLACE", /* 0xe5 */ - "CLS", /* 0xe6 */ - "ACCEPT", /* 0xe7 */ - "RESET", /* 0xe8 */ - "GRAB", /* 0xe9 */ - "RDOT", /* 0xea */ - "PLR$", /* 0xeb */ - "DEEK", /* 0xec */ - "JOY", /* 0xed */ - NULL, /* 0xee */ - NULL, /* 0xef */ - NULL, /* 0xf0 */ - NULL, /* 0xf1 */ - NULL, /* 0xf2 */ - NULL, /* 0xf3 */ - NULL, /* 0xf4 */ - NULL, /* 0xf5 */ - NULL, /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_20_speech_basic_27[] = /* "BASIC 2.0 with Speech BASIC 2.7" - supported by c64 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "RESET", /* 0xcc */ - "BASIC", /* 0xcd */ - "HELP", /* 0xce */ - "KEY", /* 0xcf */ - "HIMEM", /* 0xd0 */ - "DISK", /* 0xd1 */ - "DIR", /* 0xd2 */ - "BLOAD", /* 0xd3 */ - "BSAVE", /* 0xd4 */ - "MAP", /* 0xd5 */ - "MEM", /* 0xd6 */ - "PAUSE", /* 0xd7 */ - "BLOCK", /* 0xd8 */ - "HEAR", /* 0xd9 */ - "RECORD", /* 0xda */ - "PLAY", /* 0xdb */ - "VOLDEF", /* 0xdc */ - "COLDEF", /* 0xdd */ - "HEX", /* 0xde */ - "DEZ", /* 0xdf */ - "SCREEN", /* 0xe0 */ - "EXEC", /* 0xe1 */ - "MON", /* 0xe2 */ - "{LEFT ARROW}", /* 0xe3 - A single character shaped as a left pointing arrow */ - "FROM", /* 0xe4 */ - "SPEED", /* 0xe5 */ - "OFF", /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ - NULL, /* 0xef */ - NULL, /* 0xf0 */ - NULL, /* 0xf1 */ - NULL, /* 0xf2 */ - NULL, /* 0xf3 */ - NULL, /* 0xf4 */ - NULL, /* 0xf5 */ - NULL, /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_20_at_basic[] = /* "BASIC 2.0 with @BASIC" - supported by c64 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "TRACE", /* 0xcc */ - "DELETE", /* 0xcd */ - "AUTO", /* 0xce */ - "OLD", /* 0xcf */ - "DUMP", /* 0xd0 */ - "FIND", /* 0xd1 */ - "RENUMBER", /* 0xd2 */ - "DLOAD", /* 0xd3 */ - "DSAVE", /* 0xd4 */ - "DVERIFY", /* 0xd5 */ - "DIRECTORY" /* 0xd6 */ - "CATALOG", /* 0xd7 */ - "SCRATCH", /* 0xd8 */ - "COLLECT", /* 0xd9 */ - "RENAME", /* 0xda */ - "COPY", /* 0xdb */ - "BACKUP", /* 0xdc */ - "DISK", /* 0xdd */ - "HEADER", /* 0xde */ - "APPEND", /* 0xdf */ - "MERGE", /* 0xe0 */ - "MLOAD", /* 0xe1 */ - "MVERIFY", /* 0xe2 */ - "MSAVE", /* 0xe3 */ - "KEY", /* 0xe4 */ - "BASIC", /* 0xe5 */ - "RESET", /* 0xe6 */ - "EXIT", /* 0xe7 */ - "ENTER", /* 0xe8 */ - "DOKE", /* 0xe9 */ - "SET", /* 0xea */ - "HELP", /* 0xeb */ - "SCREEN", /* 0xec */ - "LOMEM", /* 0xed */ - "HIMEM", /* 0xee */ - "COLOUR", /* 0xef */ - "TYPE", /* 0xf0 */ - "TIME", /* 0xf1 */ - "DEEK", /* 0xf2 */ - "HEX$", /* 0xf3 */ - "BIN$", /* 0xf4 */ - "OFF", /* 0xf5 */ - "ALARM", /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_20_simon_s_basic[] = /* "BASIC 2.0 with Simon's BASIC" - supported by c64 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - NULL, /* 0xcc */ - NULL, /* 0xcd */ - NULL, /* 0xce */ - NULL, /* 0xcf */ - NULL, /* 0xd0 */ - NULL, /* 0xd1 */ - NULL, /* 0xd2 */ - NULL, /* 0xd3 */ - NULL, /* 0xd4 */ - NULL, /* 0xd5 */ - NULL, /* 0xd6 */ - NULL, /* 0xd7 */ - NULL, /* 0xd8 */ - NULL, /* 0xd9 */ - NULL, /* 0xda */ - NULL, /* 0xdb */ - NULL, /* 0xdc */ - NULL, /* 0xdd */ - NULL, /* 0xde */ - NULL, /* 0xdf */ - NULL, /* 0xe0 */ - NULL, /* 0xe1 */ - NULL, /* 0xe2 */ - NULL, /* 0xe3 */ - NULL, /* 0xe4 */ - NULL, /* 0xe5 */ - NULL, /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ - NULL, /* 0xef */ - NULL, /* 0xf0 */ - NULL, /* 0xf1 */ - NULL, /* 0xf2 */ - NULL, /* 0xf3 */ - NULL, /* 0xf4 */ - NULL, /* 0xf5 */ - NULL, /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}", /* 0xff - A single character shaped as greek lowercase 'PI' */ - NULL, /* 0x6400 */ - "HIRES", /* 0x6401 */ - "PLOT", /* 0x6402 */ - "LINE", /* 0x6403 */ - "BLOCK", /* 0x6404 */ - "FCHR", /* 0x6405 */ - "FCOL", /* 0x6406 */ - "FILL", /* 0x6407 */ - "REC", /* 0x6408 */ - "ROT", /* 0x6409 */ - "DRAW", /* 0x640a */ - "CHAR", /* 0x640b */ - "HI COL", /* 0x640c */ - "INV", /* 0x640d */ - "FRAC", /* 0x640e */ - "MOVE", /* 0x640f */ - "PLACE", /* 0x6410 */ - "UPB", /* 0x6411 */ - "UPW", /* 0x6412 */ - "LEFTW", /* 0x6413 */ - "LEFTB", /* 0x6414 */ - "DOWNB", /* 0x6415 */ - "DOWNW", /* 0x6416 */ - "RIGHTB", /* 0x6417 */ - "RIGHTW", /* 0x6418 */ - "MULTI", /* 0x6419 */ - "COLOUR", /* 0x641a */ - "MMOB", /* 0x641b */ - "BFLASH", /* 0x641c */ - "MOB SET", /* 0x641d */ - "MUSIC", /* 0x641e */ - "FLASH", /* 0x641f */ - "REPEAT", /* 0x6420 */ - "PLAY", /* 0x6421 */ - ">>", /* 0x6422 */ - "CENTRE", /* 0x6423 */ - "ENVELOPE", /* 0x6424 */ - "CGOTO", /* 0x6425 */ - "WAVE", /* 0x6426 */ - "FETCH", /* 0x6427 */ - "AT(", /* 0x6428 */ - "UNTIL", /* 0x6429 */ - ">>", /* 0x642a */ - ">>", /* 0x642b */ - "USE", /* 0x642c */ - ">>", /* 0x642d */ - "GLOBAL", /* 0x642e */ - ">>", /* 0x642f */ - "RESET", /* 0x6430 */ - "PROC", /* 0x6431 */ - "CALL", /* 0x6432 */ - "EXEC", /* 0x6433 */ - "END PROC", /* 0x6434 */ - "EXIT", /* 0x6435 */ - "END LOOP", /* 0x6436 */ - "ON KEY", /* 0x6437 */ - "DISABLE", /* 0x6438 */ - "RESUME", /* 0x6439 */ - "LOOP", /* 0x643a */ - "DELAY", /* 0x643b */ - ">>", /* 0x643c */ - ">>", /* 0x643d */ - ">>", /* 0x643e */ - ">>", /* 0x643f */ - "SECURE", /* 0x6440 */ - "DISAPA", /* 0x6441 */ - "CIRCLE", /* 0x6442 */ - "ON ERROR", /* 0x6443 */ - "NO ERROR", /* 0x6444 */ - "LOCAL", /* 0x6445 */ - "RCOMP", /* 0x6446 */ - "ELSE", /* 0x6447 */ - "RETRACE", /* 0x6448 */ - "TRACE", /* 0x6449 */ - "DIR", /* 0x644a */ - "PAGE", /* 0x644b */ - "DUMP", /* 0x644c */ - "FIND", /* 0x644d */ - "OPTION", /* 0x644e */ - "AUTO", /* 0x644f */ - "OLD", /* 0x6450 */ - "JOY", /* 0x6451 */ - "MOD", /* 0x6452 */ - "DIV", /* 0x6453 */ - ">>", /* 0x6454 */ - "DUP", /* 0x6455 */ - "INKEY", /* 0x6456 */ - "INST", /* 0x6457 */ - "TEST", /* 0x6458 */ - "LIN", /* 0x6459 */ - "EXOR", /* 0x645a */ - "INSERT", /* 0x645b */ - "POT", /* 0x645c */ - "PENX", /* 0x645d */ - ">>", /* 0x645e */ - "PENY", /* 0x645f */ - "SOUND", /* 0x6460 */ - "GRAPHICS", /* 0x6461 */ - "DESIGN", /* 0x6462 */ - "RLOCMOB", /* 0x6463 */ - "CMOB", /* 0x6464 */ - "BCKGNDS", /* 0x6465 */ - "PAUSE", /* 0x6466 */ - "NRM", /* 0x6467 */ - "MOB OFF", /* 0x6468 */ - "OFF", /* 0x6469 */ - "ANGL", /* 0x646a */ - "ARC", /* 0x646b */ - "COLD", /* 0x646c */ - "SCRSV", /* 0x646d */ - "SCRLD", /* 0x646e */ - "TEXT", /* 0x646f */ - "CSET", /* 0x6470 */ - "VOL", /* 0x6471 */ - "DISK", /* 0x6472 */ - "HRDCPY", /* 0x6473 */ - "KEY", /* 0x6474 */ - "PAINT", /* 0x6475 */ - "LOW COL", /* 0x6476 */ - "COPY", /* 0x6477 */ - "MERGE", /* 0x6478 */ - "RENUMBER", /* 0x6479 */ - "MEM", /* 0x647a */ - "DETECT", /* 0x647b */ - "CHECK", /* 0x647c */ - "DISPLAY", /* 0x647d */ - "ERR", /* 0x647e */ - "OUT" /* 0x647f */ -}; - -static const char *const basic_20_exp_40[] = /* "BASIC 2.0 with BASIC 4.0 Expansion" - supported by c64 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "CONCAT", /* 0xcc */ - "DOPEN", /* 0xcd */ - "DCLOSE", /* 0xce */ - "RECORD", /* 0xcf */ - "HEADER", /* 0xd0 */ - "COLLECT", /* 0xd1 */ - "BACKUP", /* 0xd2 */ - "COPY", /* 0xd3 */ - "APPEND", /* 0xd4 */ - "DSAVE", /* 0xd5 */ - "DLOAD", /* 0xd6 */ - "CATALOG", /* 0xd7 */ - "RENAME", /* 0xd8 */ - "SCRATCH", /* 0xd9 */ - "DIRECTORY", /* 0xda */ - "COLOR", /* 0xdb */ - "COLD", /* 0xdc */ - "KEY", /* 0xdd */ - "DVERIFY", /* 0xde */ - "DELETE" /* 0xdf */ - "AUTO", /* 0xe0 */ - "MERGE", /* 0xe1 */ - "OLD", /* 0xe2 */ - "MONITOR", /* 0xe3 */ - NULL, /* 0xe4 */ - NULL, /* 0xe5 */ - NULL, /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ - NULL, /* 0xef */ - NULL, /* 0xf0 */ - NULL, /* 0xf1 */ - NULL, /* 0xf2 */ - NULL, /* 0xf3 */ - NULL, /* 0xf4 */ - NULL, /* 0xf5 */ - NULL, /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_35[] = /* "BASIC 3.5" - supported by c16 & clones, except c364 */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "RGR", /* 0xcc */ - "RCLR" /* 0xcd */ - "RLUM" /* 0xce */ - "JOY", /* 0xcf */ - "RDOT" /* 0xd0 */ - "DEC", /* 0xd1 */ - "HEX$", /* 0xd2 */ - "ERR$", /* 0xd3 */ - "INSTR", /* 0xd4 */ - "ELSE", /* 0xd5 */ - "RESUME", /* 0xd6 */ - "TRAP", /* 0xd7 */ - "TRON", /* 0xd8 */ - "TROFF", /* 0xd9 */ - "SOUND", /* 0xda */ - "VOL", /* 0xdb */ - "AUTO", /* 0xdc */ - "PUDEF", /* 0xdd */ - "GRAPHIC", /* 0xde */ - "PAINT", /* 0xdf */ - "CHAR", /* 0xe0 */ - "BOX", /* 0xe1 */ - "CIRCLE", /* 0xe2 */ - "GSHAPE", /* 0xe3 */ - "SSHAPE", /* 0xe4 */ - "DRAW", /* 0xe5 */ - "LOCATE", /* 0xe6 */ - "COLOR", /* 0xe7 */ - "SCNCLR", /* 0xe8 */ - "SCALE", /* 0xe9 */ - "HELP", /* 0xea */ - "DO", /* 0xeb */ - "LOOP", /* 0xec */ - "EXIT", /* 0xed */ - "DIRECTORY", /* 0xee */ - "DSAVE", /* 0xef */ - "DLOAD", /* 0xf0 */ - "HEADER", /* 0xf1 */ - "SCRATCH", /* 0xf2 */ - "COLLECT", /* 0xf3 */ - "COPY", /* 0xf4 */ - "RENAME", /* 0xf5 */ - "BACKUP", /* 0xf6 */ - "DELETE", /* 0xf7 */ - "RENUMBER", /* 0xf8 */ - "KEY", /* 0xf9 */ - "MONITOR", /* 0xfa */ - "USING", /* 0xfb */ - "UNTIL", /* 0xfc */ - "WHILE", /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_35_magic_voice[] = /* "BASIC 3.5 with Magic Voice Speech Synthesizer" - supported by c364 */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "RGR", /* 0xcc */ - "RCLR" /* 0xcd */ - "RLUM" /* 0xce */ - "JOY", /* 0xcf */ - "RDOT" /* 0xd0 */ - "DEC", /* 0xd1 */ - "HEX$", /* 0xd2 */ - "ERR$", /* 0xd3 */ - "INSTR", /* 0xd4 */ - "ELSE", /* 0xd5 */ - "RESUME", /* 0xd6 */ - "TRAP", /* 0xd7 */ - "TRON", /* 0xd8 */ - "TROFF", /* 0xd9 */ - "SOUND", /* 0xda */ - "VOL", /* 0xdb */ - "AUTO", /* 0xdc */ - "PUDEF", /* 0xdd */ - "GRAPHIC", /* 0xde */ - "PAINT", /* 0xdf */ - "CHAR", /* 0xe0 */ - "BOX", /* 0xe1 */ - "CIRCLE", /* 0xe2 */ - "GSHAPE", /* 0xe3 */ - "SSHAPE", /* 0xe4 */ - "DRAW", /* 0xe5 */ - "LOCATE", /* 0xe6 */ - "COLOR", /* 0xe7 */ - "SCNCLR", /* 0xe8 */ - "SCALE", /* 0xe9 */ - "HELP", /* 0xea */ - "DO", /* 0xeb */ - "LOOP", /* 0xec */ - "EXIT", /* 0xed */ - "DIRECTORY", /* 0xee */ - "DSAVE", /* 0xef */ - "DLOAD", /* 0xf0 */ - "HEADER", /* 0xf1 */ - "SCRATCH", /* 0xf2 */ - "COLLECT", /* 0xf3 */ - "COPY", /* 0xf4 */ - "RENAME", /* 0xf5 */ - "BACKUP", /* 0xf6 */ - "DELETE", /* 0xf7 */ - "RENUMBER", /* 0xf8 */ - "KEY", /* 0xf9 */ - "MONITOR", /* 0xfa */ - "USING", /* 0xfb */ - "UNTIL", /* 0xfc */ - "WHILE", /* 0xfd */ - NULL, /* 0xfe - Prefix for additional tokens */ - "{PI}", /* 0xff - A single character shaped as greek lowercase 'PI' */ - NULL, /* 0xfe00 */ - "RATE", /* 0xfe01 */ - "VOC", /* 0xfe02 */ - NULL, /* 0xfe03 */ - "RDY", /* 0xfe04 */ - NULL, /* 0xfe05 */ - NULL, /* 0xfe06 */ - NULL, /* 0xfe07 */ - NULL, /* 0xfe08 */ - NULL, /* 0xfe09 */ - "SAY" /* 0xfe0a */ -}; - -static const char *const basic_40[] = /* "BASIC 4.0" - supported by cbm40xx & cbm80xx series, p500, cbm600 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "CONCAT", /* 0xcc */ - "DOPEN", /* 0xcd */ - "DCLOSE", /* 0xce */ - "RECORD", /* 0xcf */ - "HEADER", /* 0xd0 */ - "COLLECT", /* 0xd1 */ - "BACKUP", /* 0xd2 */ - "COPY", /* 0xd3 */ - "APPEND", /* 0xd4 */ - "DSAVE", /* 0xd5 */ - "DLOAD", /* 0xd6 */ - "CATALOG", /* 0xd7 */ - "RENAME", /* 0xd8 */ - "SCRATCH", /* 0xd9 */ - "DIRECTORY", /* 0xda */ - NULL, /* 0xdb */ - NULL, /* 0xdc */ - NULL, /* 0xdd */ - NULL, /* 0xde */ - NULL, /* 0xdf */ - NULL, /* 0xe0 */ - NULL, /* 0xe1 */ - NULL, /* 0xe2 */ - NULL, /* 0xe3 */ - NULL, /* 0xe4 */ - NULL, /* 0xe5 */ - NULL, /* 0xe6 */ - NULL, /* 0xe7 */ - NULL, /* 0xe8 */ - NULL, /* 0xe9 */ - NULL, /* 0xea */ - NULL, /* 0xeb */ - NULL, /* 0xec */ - NULL, /* 0xed */ - NULL, /* 0xee */ - NULL, /* 0xef */ - NULL, /* 0xf0 */ - NULL, /* 0xf1 */ - NULL, /* 0xf2 */ - NULL, /* 0xf3 */ - NULL, /* 0xf4 */ - NULL, /* 0xf5 */ - NULL, /* 0xf6 */ - NULL, /* 0xf7 */ - NULL, /* 0xf8 */ - NULL, /* 0xf9 */ - NULL, /* 0xfa */ - NULL, /* 0xfb */ - NULL, /* 0xfc */ - NULL, /* 0xfd */ - NULL, /* 0xfe */ - "{PI}" /* 0xff - A single character shaped as greek lowercase 'PI' */ -}; - -static const char *const basic_70[] = /* "BASIC 7.0" - supported by c128 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "RGR", /* 0xcc */ - "RCLR", /* 0xcd */ - NULL, /* 0xce - Prefix for additional tokens */ - "JOY", /* 0xcf */ - "RDOT" /* 0xd0 */ - "DEC", /* 0xd1 */ - "HEX$", /* 0xd2 */ - "ERR$", /* 0xd3 */ - "INSTR", /* 0xd4 */ - "ELSE", /* 0xd5 */ - "RESUME", /* 0xd6 */ - "TRAP", /* 0xd7 */ - "TRON", /* 0xd8 */ - "TROFF", /* 0xd9 */ - "SOUND", /* 0xda */ - "VOL", /* 0xdb */ - "AUTO", /* 0xdc */ - "PUDEF", /* 0xdd */ - "GRAPHIC", /* 0xde */ - "PAINT", /* 0xdf */ - "CHAR", /* 0xe0 */ - "BOX", /* 0xe1 */ - "CIRCLE", /* 0xe2 */ - "GSHAPE", /* 0xe3 */ - "SSHAPE", /* 0xe4 */ - "DRAW", /* 0xe5 */ - "LOCATE", /* 0xe6 */ - "COLOR", /* 0xe7 */ - "SCNCLR", /* 0xe8 */ - "SCALE", /* 0xe9 */ - "HELP", /* 0xea */ - "DO", /* 0xeb */ - "LOOP", /* 0xec */ - "EXIT", /* 0xed */ - "DIRECTORY", /* 0xee */ - "DSAVE", /* 0xef */ - "DLOAD", /* 0xf0 */ - "HEADER", /* 0xf1 */ - "SCRATCH", /* 0xf2 */ - "COLLECT", /* 0xf3 */ - "COPY", /* 0xf4 */ - "RENAME", /* 0xf5 */ - "BACKUP", /* 0xf6 */ - "DELETE", /* 0xf7 */ - "RENUMBER", /* 0xf8 */ - "KEY", /* 0xf9 */ - "MONITOR", /* 0xfa */ - "USING", /* 0xfb */ - "UNTIL", /* 0xfc */ - "WHILE", /* 0xfd */ - NULL, /* 0xfe - Prefix for additional tokens */ - "{PI}", /* 0xff - A single character shaped as greek lowercase 'PI' */ - NULL, /* 0xce00 */ - NULL, /* 0xce01 */ - "POT", /* 0xce02 */ - "BUMP", /* 0xce03 */ - "PEN", /* 0xce04 */ - "RSPPOS", /* 0xce05 */ - "RSPRITE", /* 0xce06 */ - "RSPCOLOR", /* 0xce07 */ - "XOR", /* 0xce08 */ - "RWINDOW", /* 0xce09 */ - "POINTER", /* 0xce0a */ - NULL, /* 0xfe00 */ - NULL, /* 0xfe01 */ - "BANK", /* 0xfe02 */ - "FILTER", /* 0xfe03 */ - "PLAY", /* 0xfe04 */ - "TEMPO", /* 0xfe05 */ - "MOVSPR", /* 0xfe06 */ - "SPRITE", /* 0xfe07 */ - "SPRCOLOR", /* 0xfe08 */ - "RREG", /* 0xfe09 */ - "ENVELOPE", /* 0xfe0a */ - "SLEEP", /* 0xfe0b */ - "CATALOG", /* 0xfe0c */ - "DOPEN", /* 0xfe0d */ - "APPEND", /* 0xfe0e */ - "DCLOSE", /* 0xfe0f */ - "BSAVE", /* 0xfe10 */ - "BLOAD", /* 0xfe11 */ - "RECORD", /* 0xfe12 */ - "CONCAT", /* 0xfe13 */ - "DVERIFY", /* 0xfe14 */ - "DCLEAR", /* 0xfe15 */ - "SPRSAV", /* 0xfe16 */ - "COLLISION", /* 0xfe17 */ - "BEGIN", /* 0xfe18 */ - "BEND", /* 0xfe19 */ - "WINDOW", /* 0xfe1a */ - "BOOT", /* 0xfe1b */ - "WIDTH", /* 0xfe1c */ - "SPRDEF", /* 0xfe1d */ - "QUIT", /* 0xfe1e */ - "STASH", /* 0xfe1f */ - NULL, /* 0xfe20 */ - "FETCH", /* 0xfe21 */ - NULL, /* 0xfe22 */ - "SWAP", /* 0xfe23 */ - "OFF", /* 0xfe24 */ - "FAST", /* 0xfe25 */ - "SLOW" /* 0xfe26 */ -}; - -static const char *const basic_100[] = /* "BASIC 10.0" - supported by c65 & clones */ -{ - "END", /* 0x80 */ - "FOR", /* 0x81 */ - "NEXT", /* 0x82 */ - "DATA", /* 0x83 */ - "INPUT#", /* 0x84 */ - "INPUT", /* 0x85 */ - "DIM", /* 0x86 */ - "READ", /* 0x87 */ - "LET", /* 0x88 */ - "GOTO", /* 0x89 */ - "RUN", /* 0x8a */ - "IF", /* 0x8b */ - "RESTORE", /* 0x8c */ - "GOSUB", /* 0x8d */ - "RETURN", /* 0x8e */ - "REM", /* 0x8f */ - "STOP", /* 0x90 */ - "ON", /* 0x91 */ - "WAIT", /* 0x92 */ - "LOAD", /* 0x93 */ - "SAVE", /* 0x94 */ - "VERIFY", /* 0x95 */ - "DEF", /* 0x96 */ - "POKE", /* 0x97 */ - "PRINT#", /* 0x98 */ - "PRINT", /* 0x99 */ - "CONT", /* 0x9a */ - "LIST", /* 0x9b */ - "CLR", /* 0x9c */ - "CMD", /* 0x9d */ - "SYS", /* 0x9e */ - "OPEN", /* 0x9f */ - "CLOSE", /* 0xa0 */ - "GET", /* 0xa1 */ - "NEW", /* 0xa2 */ - "TAB(", /* 0xa3 */ - "TO", /* 0xa4 */ - "FN", /* 0xa5 */ - "SPC(", /* 0xa6 */ - "THEN", /* 0xa7 */ - "NOT", /* 0xa8 */ - "STEP", /* 0xa9 */ - "+", /* 0xaa */ - "-", /* 0xab */ - "*", /* 0xac */ - "/", /* 0xad */ - "^", /* 0xae */ - "AND", /* 0xaf */ - "OR", /* 0xb0 */ - ">", /* 0xb1 */ - "=", /* 0xb2 */ - "<", /* 0xb3 */ - "SGN", /* 0xb4 */ - "INT", /* 0xb5 */ - "ABS", /* 0xb6 */ - "USR", /* 0xb7 */ - "FRE", /* 0xb8 */ - "POS", /* 0xb9 */ - "SQR", /* 0xba */ - "RND", /* 0xbb */ - "LOG", /* 0xbc */ - "EXP", /* 0xbd */ - "COS", /* 0xbe */ - "SIN", /* 0xbf */ - "TAN", /* 0xc0 */ - "ATN", /* 0xc1 */ - "PEEK", /* 0xc2 */ - "LEN", /* 0xc3 */ - "STR$", /* 0xc4 */ - "VAL", /* 0xc5 */ - "ASC", /* 0xc6 */ - "CHR$", /* 0xc7 */ - "LEFT$", /* 0xc8 */ - "RIGHT$", /* 0xc9 */ - "MID$", /* 0xca */ - "GO", /* 0xcb */ - "RGR", /* 0xcc */ - "RCLR", /* 0xcd */ - NULL, /* 0xce - Prefix for additional tokens */ - "JOY", /* 0xcf */ - "RDOT" /* 0xd0 */ - "DEC", /* 0xd1 */ - "HEX$", /* 0xd2 */ - "ERR$", /* 0xd3 */ - "INSTR", /* 0xd4 */ - "ELSE", /* 0xd5 */ - "RESUME", /* 0xd6 */ - "TRAP", /* 0xd7 */ - "TRON", /* 0xd8 */ - "TROFF", /* 0xd9 */ - "SOUND", /* 0xda */ - "VOL", /* 0xdb */ - "AUTO", /* 0xdc */ - "PUDEF", /* 0xdd */ - "GRAPHIC", /* 0xde */ - "PAINT", /* 0xdf */ - "CHAR", /* 0xe0 */ - "BOX", /* 0xe1 */ - "CIRCLE", /* 0xe2 */ - "PASTE", /* 0xe3 */ - "CUT", /* 0xe4 */ - "LINE", /* 0xe5 */ - "LOCATE", /* 0xe6 */ - "COLOR", /* 0xe7 */ - "SCNCLR", /* 0xe8 */ - "SCALE", /* 0xe9 */ - "HELP", /* 0xea */ - "DO", /* 0xeb */ - "LOOP", /* 0xec */ - "EXIT", /* 0xed */ - "DIR", /* 0xee */ - "DSAVE", /* 0xef */ - "DLOAD", /* 0xf0 */ - "HEADER", /* 0xf1 */ - "SCRATCH", /* 0xf2 */ - "COLLECT", /* 0xf3 */ - "COPY", /* 0xf4 */ - "RENAME", /* 0xf5 */ - "BACKUP", /* 0xf6 */ - "DELETE", /* 0xf7 */ - "RENUMBER", /* 0xf8 */ - "KEY", /* 0xf9 */ - "MONITOR", /* 0xfa */ - "USING", /* 0xfb */ - "UNTIL", /* 0xfc */ - "WHILE", /* 0xfd */ - NULL, /* 0xfe - Prefix for additional tokens */ - "{PI}", /* 0xff - A single character shaped as greek lowercase 'PI' */ - NULL, /* 0xce00 */ - NULL, /* 0xce01 */ - "POT", /* 0xce02 */ - "BUMP", /* 0xce03 */ - "PEN", /* 0xce04 */ - "RSPPOS", /* 0xce05 */ - "RSPRITE", /* 0xce06 */ - "RSPCOLOR", /* 0xce07 */ - "XOR", /* 0xce08 */ - "RWINDOW", /* 0xce09 */ - "POINTER", /* 0xce0a */ - NULL, /* 0xfe00 */ - NULL, /* 0xfe01 */ - "BANK", /* 0xfe02 */ - "FILTER", /* 0xfe03 */ - "PLAY", /* 0xfe04 */ - "TEMPO", /* 0xfe05 */ - "MOVSPR", /* 0xfe06 */ - "SPRITE", /* 0xfe07 */ - "SPRCOLOR", /* 0xfe08 */ - "RREG", /* 0xfe09 */ - "ENVELOPE", /* 0xfe0a */ - "SLEEP", /* 0xfe0b */ - "CATALOG", /* 0xfe0c */ - "DOPEN", /* 0xfe0d */ - "APPEND", /* 0xfe0e */ - "DCLOSE", /* 0xfe0f */ - "BSAVE", /* 0xfe10 */ - "BLOAD", /* 0xfe11 */ - "RECORD", /* 0xfe12 */ - "CONCAT", /* 0xfe13 */ - "DVERIFY", /* 0xfe14 */ - "DCLEAR", /* 0xfe15 */ - "SPRSAV", /* 0xfe16 */ - "COLLISION", /* 0xfe17 */ - "BEGIN", /* 0xfe18 */ - "BEND", /* 0xfe19 */ - "WINDOW", /* 0xfe1a */ - "BOOT", /* 0xfe1b */ - "WIDTH", /* 0xfe1c */ - "SPRDEF", /* 0xfe1d */ - "QUIT", /* 0xfe1e */ - "DMA", /* 0xfe1f */ - NULL, /* 0xfe20 */ - "DMA", /* 0xfe21 */ - NULL, /* 0xfe22 */ - "DMA", /* 0xfe23 */ - "OFF", /* 0xfe24 */ - "FAST", /* 0xfe25 */ - "SLOW", /* 0xfe26 */ - "TYPE", /* 0xfe27 */ - "BVERIFY", /* 0xfe28 */ - "ECTORY", /* 0xfe29 */ - "ERASE", /* 0xfe2a */ - "FIND", /* 0xfe2b */ - "CHANGE", /* 0xfe2c */ - "SET", /* 0xfe2d */ - "SCREEN", /* 0xfe2e */ - "POLYGON", /* 0xfe2f */ - "ELLIPSE", /* 0xfe30 */ - "VIEWPORT", /* 0xfe31 */ - "GCOPY", /* 0xfe32 */ - "PEN", /* 0xfe33 */ - "PALETTE", /* 0xfe34 */ - "DMODE", /* 0xfe35 */ - "DPAT", /* 0xfe36 */ - "PIC", /* 0xfe37 */ - "GENLOCK", /* 0xfe38 */ - "FOREGROUND", /* 0xfe39 */ - NULL, /* 0xfe3a */ - "BACKGROUND", /* 0xfe3b */ - "BORDER", /* 0xfe3c */ - "HIGHLIGHT" /* 0xfe3d */ -}; - -#endif - - - -/*************************************************************************** - COCO BASIC -***************************************************************************/ - -static const basictoken_tableent cocobas_tokenents[] = -{ - { 0x00, 0x80, cocobas_statements, ARRAY_LENGTH(cocobas_statements) }, - { 0xff, 0x80, cocobas_functions, ARRAY_LENGTH(cocobas_functions) } -}; - -static const basictokens cocobas_tokens = -{ - 0x2600, - 3, - TRUE, - cocobas_tokenents, - ARRAY_LENGTH(cocobas_tokenents) -}; - -static imgtoolerr_t cocobas_readfile(imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *destf) -{ - return basic_readfile(&cocobas_tokens, partition, filename, fork, destf); -} - -static imgtoolerr_t cocobas_writefile(imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - return basic_writefile(&cocobas_tokens, partition, filename, fork, sourcef, opts); -} - -void filter_cocobas_getinfo(UINT32 state, union filterinfo *info) -{ - switch(state) - { - case FILTINFO_STR_NAME: info->s = "cocobas"; break; - case FILTINFO_STR_HUMANNAME: info->s = "CoCo Tokenized Basic Files"; break; - case FILTINFO_PTR_READFILE: info->read_file = cocobas_readfile; break; - case FILTINFO_PTR_WRITEFILE: info->write_file = cocobas_writefile; break; - } -} - - - -/*************************************************************************** - DRAGON BASIC -***************************************************************************/ - -static const basictoken_tableent dragonbas_tokenents[] = -{ - { 0x00, 0x80, dragonbas_statements, ARRAY_LENGTH(dragonbas_statements) }, - { 0xff, 0x80, dragonbas_functions, ARRAY_LENGTH(dragonbas_functions) } -}; - -static const basictokens dragonbas_tokens = -{ - 0x2600, - 4, - TRUE, - dragonbas_tokenents, - ARRAY_LENGTH(dragonbas_tokenents) -}; - -static imgtoolerr_t dragonbas_readfile(imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *destf) -{ - return basic_readfile(&dragonbas_tokens, partition, filename, fork, destf); -} - -static imgtoolerr_t dragonbas_writefile(imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - return basic_writefile(&dragonbas_tokens, partition, filename, fork, sourcef, opts); -} - -void filter_dragonbas_getinfo(UINT32 state, union filterinfo *info) -{ - switch(state) - { - case FILTINFO_STR_NAME: info->s = "dragonbas"; break; - case FILTINFO_STR_HUMANNAME: info->s = "Dragon Tokenized Basic Files"; break; - case FILTINFO_PTR_READFILE: info->read_file = dragonbas_readfile; break; - case FILTINFO_PTR_WRITEFILE: info->write_file = dragonbas_writefile; break; - } -} - - - -/*************************************************************************** - VZBASIC -***************************************************************************/ - -static const basictoken_tableent vzbas_tokenents[] = -{ - { 0x00, 0x80, vzbas, ARRAY_LENGTH(vzbas) } -}; - - - -static const basictokens vzbas_tokens = -{ - 0x7ae9, - 0, - FALSE, - vzbas_tokenents, - ARRAY_LENGTH(vzbas_tokenents) -}; - -static imgtoolerr_t vzbas_readfile(imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *destf) -{ - return basic_readfile(&vzbas_tokens, partition, filename, fork, destf); -} - -static imgtoolerr_t vzbas_writefile(imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - return basic_writefile(&vzbas_tokens, partition, filename, fork, sourcef, opts); -} - -void filter_vzbas_getinfo(UINT32 state, union filterinfo *info) -{ - switch(state) - { - case FILTINFO_STR_NAME: info->s = "vzbas"; break; - case FILTINFO_STR_HUMANNAME: info->s = "Laser/VZ Tokenized Basic Files"; break; - case FILTINFO_PTR_READFILE: info->read_file = vzbas_readfile; break; - case FILTINFO_PTR_WRITEFILE: info->write_file = vzbas_writefile; break; - } -} - - - -/*************************************************************************** - BML3 BASIC -***************************************************************************/ - -static const basictoken_tableent bml3bas_tokenents[] = -{ - { 0x00, 0x80, bml3bas_statements, ARRAY_LENGTH(bml3bas_statements) }, - { 0xff, 0x80, bml3bas_functions, ARRAY_LENGTH(bml3bas_functions) } -}; - -static const basictokens bml3bas_tokens = -{ - 0x2600, - 3, - TRUE, - bml3bas_tokenents, - ARRAY_LENGTH(bml3bas_tokenents) -}; - -static imgtoolerr_t bml3bas_readfile(imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *destf) -{ - return basic_readfile(&bml3bas_tokens, partition, filename, fork, destf); -} - -static imgtoolerr_t bml3bas_writefile(imgtool_partition *partition, const char *filename, - const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - return basic_writefile(&bml3bas_tokens, partition, filename, fork, sourcef, opts); -} - -void filter_bml3bas_getinfo(UINT32 state, union filterinfo *info) -{ - switch(state) - { - case FILTINFO_STR_NAME: info->s = "bml3bas"; break; - case FILTINFO_STR_HUMANNAME: info->s = "Basic Master Level 3 Tokenized Basic Files"; break; - case FILTINFO_PTR_READFILE: info->read_file = bml3bas_readfile; break; - case FILTINFO_PTR_WRITEFILE: info->write_file = bml3bas_writefile; break; - } -} diff --git a/src/mess/tools/imgtool/filteoln.c b/src/mess/tools/imgtool/filteoln.c deleted file mode 100644 index 30fb52ed429..00000000000 --- a/src/mess/tools/imgtool/filteoln.c +++ /dev/null @@ -1,127 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/**************************************************************************** - - filteoln.c - - Native end-of-line filter - -*****************************************************************************/ - -#include - -#include "imgtool.h" - -#define EOLN (CRLF == 1 ? "\r" : (CRLF == 2 ? "\n" : (CRLF == 3 ? "\r\n" : NULL))) - - - -static imgtoolerr_t convert_stream_eolns(imgtool_stream *source, imgtool_stream *dest, const char *eoln) -{ - size_t len, i, pos; - char buffer[2000]; - int hit_cr = FALSE; - - while((len = stream_read(source, buffer, sizeof(buffer))) > 0) - { - pos = 0; - - for (i = 0; i < len; i++) - { - switch(buffer[i]) - { - case '\r': - case '\n': - if (!hit_cr || (buffer[i] != '\n')) - { - if (i > pos) - stream_write(dest, buffer + pos, i - pos); - stream_write(dest, eoln, strlen(eoln)); - } - pos = i + 1; - break; - } - hit_cr = (buffer[i] == '\r'); - } - - if (i > pos) - stream_write(dest, buffer + pos, i - pos); - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t ascii_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t err; - imgtool_stream *mem_stream; - - mem_stream = stream_open_mem(NULL, 0); - if (!mem_stream) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - err = imgtool_partition_read_file(partition, filename, fork, mem_stream, NULL); - if (err) - goto done; - - stream_seek(mem_stream, SEEK_SET, 0); - err = convert_stream_eolns(mem_stream, destf, EOLN); - if (err) - goto done; - -done: - if (mem_stream) - stream_close(mem_stream); - return err; -} - - - -static imgtoolerr_t ascii_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtoolerr_t err; - imgtool_stream *mem_stream = NULL; - const char *eoln; - - /* create a stream */ - mem_stream = stream_open_mem(NULL, 0); - if (!mem_stream) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - eoln = imgtool_partition_get_info_string(partition, IMGTOOLINFO_STR_EOLN); - - err = convert_stream_eolns(sourcef, mem_stream, eoln); - if (err) - goto done; - stream_seek(mem_stream, SEEK_SET, 0); - - err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL); - if (err) - goto done; - -done: - if (mem_stream) - stream_close(mem_stream); - return err; -} - - - -void filter_eoln_getinfo(UINT32 state, union filterinfo *info) -{ - switch(state) - { - case FILTINFO_STR_NAME: info->s = "ascii"; break; - case FILTINFO_STR_HUMANNAME: info->s = "Ascii"; break; - case FILTINFO_PTR_READFILE: info->read_file = ascii_readfile; break; - case FILTINFO_PTR_WRITEFILE: info->write_file = ascii_writefile; break; - } -} diff --git a/src/mess/tools/imgtool/filter.c b/src/mess/tools/imgtool/filter.c deleted file mode 100644 index 5887d6b501d..00000000000 --- a/src/mess/tools/imgtool/filter.c +++ /dev/null @@ -1,82 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - filter.c - - Imgtool filters - -***************************************************************************/ - -#include - -#include "imgtool.h" - -/* ----------------------------------------------------------------------- */ - -INT64 filter_get_info_int(filter_getinfoproc get_info, UINT32 state) -{ - union filterinfo info; - info.i = 0; - get_info(state, &info); - return info.i; -} - -void *filter_get_info_ptr(filter_getinfoproc get_info, UINT32 state) -{ - union filterinfo info; - info.p = NULL; - get_info(state, &info); - return info.p; -} - -void *filter_get_info_fct(filter_getinfoproc get_info, UINT32 state) -{ - union filterinfo info; - info.f = NULL; - get_info(state, &info); - return info.f; -} - -const char *filter_get_info_string(filter_getinfoproc get_info, UINT32 state) -{ - union filterinfo info; - info.s = NULL; - get_info(state, &info); - return info.s; -} - -/* ----------------------------------------------------------------------- */ - -const filter_getinfoproc filters[] = -{ - filter_eoln_getinfo, - filter_cocobas_getinfo, - filter_dragonbas_getinfo, - filter_macbinary_getinfo, - filter_vzsnapshot_getinfo, - filter_vzbas_getinfo, - filter_thombas5_getinfo, - filter_thombas7_getinfo, - filter_thombas128_getinfo, - filter_thomcrypt_getinfo, - filter_bml3bas_getinfo, - NULL -}; - - - -filter_getinfoproc filter_lookup(const char *name) -{ - int i; - const char *filter_name; - - for (i = 0; filters[i]; i++) - { - filter_name = filter_get_info_string(filters[i], FILTINFO_STR_NAME); - if (!strcmp(name, filter_name)) - return filters[i]; - } - - return NULL; -} diff --git a/src/mess/tools/imgtool/filter.h b/src/mess/tools/imgtool/filter.h deleted file mode 100644 index 814d813d598..00000000000 --- a/src/mess/tools/imgtool/filter.h +++ /dev/null @@ -1,66 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - filter.h - - Imgtool filters - -***************************************************************************/ - -#ifndef FILTER_H -#define FILTER_H - -#include -#include - -#include "library.h" - -struct imgtool_filter; - -enum -{ - /* --- the following bits of info are returned as 64-bit signed integers --- */ - FILTINFO_INT_FIRST = 0x00000, - FILTINFO_INT_STATESIZE, - - /* --- the following bits of info are returned as pointers to data or functions --- */ - FILTINFO_PTR_FIRST = 0x10000, - FILTINFO_PTR_READFILE, - FILTINFO_PTR_WRITEFILE, - FILTINFO_PTR_CHECKSTREAM, - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - FILTINFO_STR_FIRST = 0x20000, - FILTINFO_STR_NAME, - FILTINFO_STR_HUMANNAME, - FILTINFO_STR_EXTENSION -}; - -extern const filter_getinfoproc filters[]; - -filter_getinfoproc filter_lookup(const char *name); - -/* ----------------------------------------------------------------------- */ - -INT64 filter_get_info_int(filter_getinfoproc get_info, UINT32 state); -void *filter_get_info_ptr(filter_getinfoproc get_info, UINT32 state); -void *filter_get_info_fct(filter_getinfoproc get_info, UINT32 state); -const char *filter_get_info_string(filter_getinfoproc get_info, UINT32 state); - -/* ----------------------------------------------------------------------- */ - -extern void filter_eoln_getinfo(UINT32 state, union filterinfo *info); -extern void filter_cocobas_getinfo(UINT32 state, union filterinfo *info); -extern void filter_dragonbas_getinfo(UINT32 state, union filterinfo *info); -extern void filter_macbinary_getinfo(UINT32 state, union filterinfo *info); -extern void filter_vzsnapshot_getinfo(UINT32 state, union filterinfo *info); -extern void filter_vzbas_getinfo(UINT32 state, union filterinfo *info); -extern void filter_thombas5_getinfo(UINT32 state, union filterinfo *info); -extern void filter_thombas7_getinfo(UINT32 state, union filterinfo *info); -extern void filter_thombas128_getinfo(UINT32 state, union filterinfo *info); -extern void filter_thomcrypt_getinfo(UINT32 state, union filterinfo *info); -extern void filter_bml3bas_getinfo(UINT32 state, union filterinfo *info); - - -#endif /* FILTER_H */ diff --git a/src/mess/tools/imgtool/formats/coco_dsk.c b/src/mess/tools/imgtool/formats/coco_dsk.c deleted file mode 100644 index 9674ed9de11..00000000000 --- a/src/mess/tools/imgtool/formats/coco_dsk.c +++ /dev/null @@ -1,1194 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - formats/coco_dsk.c - - Tandy Color Computer / Dragon disk images - -*********************************************************************/ - -#include -#include -#include - -#include "formats/coco_dsk.h" -#include "formats/basicdsk.h" -#include "formats/imageutl.h" -#include "coretmpl.h" - -/* ----------------------------------------------------------------------- - * JVC (Jeff Vavasour CoCo) format - * - * Used by Jeff Vavasour's CoCo Emulators - * - * Documentation taken from Tim Linder's web site: - * http://home.netcom.com/~tlindner/JVC.html - * - * A. Header length - * The header length is determined by the file length modulo 256: - * headerSize = fileLength % 256; - * This means that the header is variable length and the minimum size - * is zero bytes, and the maximum size of 255 bytes. - * - * B. Header - * Here is a description of the header bytes: - * Byte Offset Description Default - * ----------- ----------------- ------- - * 0 Sectors per track 18 - * 1 Side count 1 - * 2 Sector size code 1 - * 3 First sector ID 1 - * 4 Sector attribute flag 0 - * - * If the sector attribute flag is zero then the track count is determined - * by the formula: - * - * (fileLength - headerSize) / (sectorsPerTrack * (128 << - * sectorSizeCode)) / sideCount - * - * If the sector attribute flag is non zero then the track count is - * determined by the more complex formula: - * - * (fileLength - headerSize) / (sectorsPerTrack * ((128 << - * sectorSizeCode) + 1) ) / sideCount - * - * If the length of the header is to short to contain the geometry desired, - * then the default values are assumed. If the header length is zero the all - * of the geometry is assumed. When creating disk images it is desirable to - * make the header length as short as possible. The header should only be - * used to deviate from the default values. - * - * The sector data begins immediately after the header. If the header length - * is zero then the sector data is at the beginning file. - * - * C. Sectors per track - * This is the number of sectors per track (ones based). A value of 18 - * means there are 18 sectors per track - * - * D. Side Count - * This is the number of sides in the disk image. Values of 1 or 2 are - * acceptable. If there are two sides then the tracks are interleaved. - * The first track in the image file is track zero side 1, the second - * track in the image file is track zero side 2. - * - * E. Sector size - * The is the same value that is stored in the wd179x ID field to - * determine sector size: - * - * 0x00 128 bytes - * 0x01 256 bytes - * 0x02 512 bytes - * 0x03 1024 bytes - * - * Other values are undefined. Every sector in the disk image must be the - * same size. - * - * F. First sector ID - * This determines the first sector ID for each track. Each successive - * sector adds one to the previous ID. If the first sector ID is 1, then - * the second sector has an ID of 2, and the third has an ID of 3. - * - * G. Sector Attribute Flag - * If this byte is non zero, then each sector contains an additional - * byte prepended to the sector data. If the attribute flag is zero then - * there are no extra bytes in front of the sector data. - * - * H. Sector attribute byte - * This byte is put at the beginning of every sector if the header flag - * is turned on. The information this byte contains is the same as the - * status register (of the wd179x) would contain when a 'Read Sector' - * command was issued. The bit fields are defined as: - * - * Bit position: - * --------------- - * 7 6 5 4 3 2 1 0 - * | | | | | | | | - * | | | | | | | +--- Not used. Set to zero. - * | | | | | | +----- Not used. Set to zero. - * | | | | | +------- Not used. Set to zero. - * | | | | +--------- Set on CRC error. - * | | | +----------- Set if sector not found. - * | | +------------- Record type: 1 - Deleted Data Mark, 0 - Data Mark. - * | +--------------- Not Used. Set to zero. - * +----------------- Not Used. Set to zero. - * - * ----------------------------------------------------------------------- */ - -static int coco_jvc_decode_header(floppy_image_legacy *floppy, UINT64 size, - struct basicdsk_geometry *geometry) -{ - UINT8 header[256]; - UINT8 sector_attribute_flag; - UINT16 physical_bytes_per_sector; - UINT32 header_size, file_size; - struct basicdsk_geometry dummy_geometry; - - if (geometry) - memset(geometry, 0, sizeof(*geometry)); - else - geometry = &dummy_geometry; - - if (size > 0xFFFFFFFF) - return -1; - file_size = (UINT32) size; - - /* read the header */ - header_size = (UINT32) file_size % 0x100; - floppy_image_read(floppy, header, 0, header_size); - geometry->offset = header_size; - - /* byte offset 0 - sectors per track */ - geometry->sectors = (header_size > 0) ? header[0] : 18; - if (geometry->sectors <= 0) - return -1; - - /* byte offset 1 - side count */ - geometry->heads = (header_size > 1) ? header[1] : 1; - if (geometry->heads <= 0) - return -1; - - /* byte offset 2 - sector size code */ - geometry->sector_length = 128 << ((header_size > 2) ? header[2] : 1); - if (geometry->sector_length <= 0) - return -1; - - /* byte offset 3 - first sector ID */ - geometry->first_sector_id = (header_size > 3) ? header[3] : 1; - - /* byte offset 4 - sector attribute flag */ - sector_attribute_flag = (header_size > 4) ? header[4] : 0; - if (sector_attribute_flag != 0) - return -1; /* we do not support sector attribute flags */ - - physical_bytes_per_sector = geometry->sector_length; - if (sector_attribute_flag) - physical_bytes_per_sector++; - - geometry->tracks = (file_size - header_size) / geometry->sectors / geometry->heads / physical_bytes_per_sector; - - /* do we have an oddball size? reject this file if not */ - if ((file_size - header_size) % physical_bytes_per_sector) - return -1; - - /* minimum of 35 tracks; support degenerate JVC files */ - if (geometry->tracks < 35) - geometry->tracks = 35; - - return 0; -} - - - -static FLOPPY_IDENTIFY(coco_jvc_identify) -{ - UINT64 size; - size = floppy_image_size(floppy); - *vote = coco_jvc_decode_header(floppy, size, NULL) ? 0 : 100; - return FLOPPY_ERROR_SUCCESS; -} - - - -static FLOPPY_CONSTRUCT(coco_jvc_construct) -{ - struct basicdsk_geometry geometry; - UINT8 header[5]; - size_t header_size; - - if (params) - { - /* create */ - memset(&geometry, 0, sizeof(geometry)); - geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); - geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - - header[0] = (UINT8) geometry.sectors; - header[1] = (UINT8) geometry.heads; - header[2] = (UINT8) compute_log2(geometry.sector_length) - 7; - header[3] = (UINT8) geometry.first_sector_id; - header[4] = 0; - - /* now that we have the header computed, figure out the header size */ - header_size = 0; - if (header[0] != 18) - header_size = 1; - if (header[1] != 1) - header_size = 2; - if (header[2] != 1) - header_size = 3; - if (header[3] != 1) - header_size = 4; - if (header[4] != 0) - header_size = 5; - - geometry.offset = header_size; - - floppy_image_write(floppy, header, 0, header_size); - } - else - { - /* load */ - if (coco_jvc_decode_header(floppy, floppy_image_size(floppy), &geometry)) - return FLOPPY_ERROR_INVALIDIMAGE; - } - return basicdsk_construct(floppy, &geometry); -} - - -/* ----------------------------------------------------------------------- - * OS-9 file format - * - * This file format is largely a hack because there are a large amount of - * disk images that do not have geometry image separate from the disk image - * itself. So we support OS-9 images with are simply basic disks whose - * geometry is determined by the disk image. - * - * OS-9 images identified by an LSN; which are simply blocks of 256 bytes - * - * LSN0 - * Byte size use - * $00 3 sectors on disk - * $03 1 track size in sectors - * $04 2 bytes in allocation bit map; typically 1bit/sector so for - * 35 tracks of 18 sectors each that's $4E (single sided disk) - * 40 tracks per side, 18 sectors each = $B4 - * $06 2 sectors per bit in allocation map; normally 1 - * $08 3 LSN of root directory; normally 2 but depends on size of - * $04 value - * $0B 2 owner's user number; normally 0 - * $0D 1 disk attributes; normally $FF - * $0E 2 psuedo random number for identification - * $10 1 disk format; typical is 3 - * %00000001 0=single side 1=double side - * %00000010 0=single density (non Coco) 1=double density - * %00000100 0=48tracks/inch 1=96tracks/inch - * $11 2 sectors per track; normal is $12 skip several not needed - * for Format - * $1A 5 date of creation Y:M:D:H:M - * $1F 32 ASCII name of disk, last letter has $80 added to it, - * the full 32 bytes do not need to be used. - * - * Allocation bit map, fill with zeros and set bits from low to high as - * sectors are used. So, for a fresh disk sectors LSN0,LSN1,LSN2, and LSN3 - * will be in use so the first byte will be $FF $C0 and all others - * in the map are $00 - * - * Root directory LSN2 - * Byte size use - * $00 1 attributes will be $BF - * $01 2 owners ID will be $0000 - * $03 5 date last modified will be creation date Y:M:D:H:M - * $08 1 link count; set to $02 - * $09 4 file size in bytes, set to $40 - * $0D 3 date created Y:M:D - * $10 3 block LSN set to current sector number+1 ie $03 in this case - * $13 2 size in sectors of directory block, set to $07 - * All other bytes in sector set to $00 - * LSN3 first sector of directory with names - * Fill sector with all $00 and then set listed bytes - * $00 2 value $2EAE which is .. with last byte+$80 - * $1F 1 value $02 LSN for start of this directory as there is - * none higher in tree - * $20 1 value $AE which is . with $80 added - * $3F 1 value $02 LSN for start of this directory - * ----------------------------------------------------------------------- */ - -static floperr_t coco_os9_readheader(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) -{ - UINT8 header[0x20]; - int total_sectors; - - floppy_image_read(floppy, header, 0, sizeof(header)); - - total_sectors = (header[0x00] << 16) | (header[0x01] << 8) | header[0x02]; - - memset(geometry, 0, sizeof(*geometry)); - geometry->first_sector_id = 1; - geometry->sector_length = 256; - geometry->sectors = (header[0x11] << 8) + header[0x12]; - geometry->heads = (header[0x10] & 0x01) ? 2 : 1; - - if (!geometry->sectors) - return FLOPPY_ERROR_INVALIDIMAGE; - - geometry->tracks = total_sectors / geometry->sectors / geometry->heads; - - if (total_sectors != geometry->tracks * geometry->sectors * geometry->heads) - return FLOPPY_ERROR_INVALIDIMAGE; - - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_os9_post_format(floppy_image_legacy *floppy, option_resolution *params) -{ - UINT8 header[0x0400]; - floperr_t err; - time_t t; - struct tm *ltime; - int heads, tracks, sectors, total_sectors; - - heads = option_resolution_lookup_int(params, PARAM_HEADS); - tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - total_sectors = heads * tracks * sectors; - - /* write the initial header */ - time(&t); - ltime = localtime(&t); - - memset(&header, 0, sizeof(header)); - header[0x0000] = (UINT8) (total_sectors >> 16); - header[0x0001] = (UINT8) (total_sectors >> 8); - header[0x0002] = (UINT8) (total_sectors >> 0); - header[0x0003] = (UINT8) sectors; - header[0x0004] = (UINT8) (((total_sectors + 7) / 8) >> 8); - header[0x0005] = (UINT8) (((total_sectors + 7) / 8) >> 0); - header[0x0006] = 0x00; - header[0x0007] = 0x01; - header[0x0008] = 0x00; - header[0x0009] = 0x00; - header[0x000a] = 0x02; - header[0x000b] = 0x00; - header[0x000c] = 0x00; - header[0x000d] = 0xff; - header[0x000e] = floppy_random_byte(floppy); - header[0x000f] = floppy_random_byte(floppy); - header[0x0010] = (heads == 2) ? 3 : 2; - header[0x0011] = (UINT8) (sectors >> 8); - header[0x0012] = (UINT8) (sectors >> 0); - header[0x001A] = (UINT8) ltime->tm_year; - header[0x001B] = (UINT8) ltime->tm_mon + 1; - header[0x001C] = (UINT8) ltime->tm_mday; - header[0x001D] = (UINT8) ltime->tm_hour; - header[0x001E] = (UINT8) ltime->tm_min; - header[0x001F] = 0xA0; - header[0x0100] = 0xFF; - header[0x0101] = 0xC0; - header[0x0200] = 0xBF; - header[0x0201] = 0x00; - header[0x0202] = 0x00; - header[0x0203] = (UINT8) ltime->tm_year; - header[0x0204] = (UINT8) ltime->tm_mon + 1; - header[0x0205] = (UINT8) ltime->tm_mday; - header[0x0206] = (UINT8) ltime->tm_hour; - header[0x0207] = (UINT8) ltime->tm_min; - header[0x0208] = 0x02; - header[0x0209] = 0x00; - header[0x020A] = 0x00; - header[0x020B] = 0x00; - header[0x020C] = 0x40; - header[0x020D] = (UINT8) (ltime->tm_year % 100); - header[0x020E] = (UINT8) ltime->tm_mon; - header[0x020F] = (UINT8) ltime->tm_mday; - header[0x0210] = 0x00; - header[0x0211] = 0x00; - header[0x0212] = 0x03; - header[0x0213] = 0x00; - header[0x0214] = 0x07; - header[0x0300] = 0x2E; - header[0x0301] = 0xAE; - header[0x031F] = 0x02; - header[0x0320] = 0xAE; - header[0x033F] = 0x02; - - if (total_sectors % 8) - header[0x0100 + (total_sectors / 8)] = 0xFF >> (total_sectors % 8); - - err = floppy_write_sector(floppy, 0, 0, 1, 0, &header[0x0000], 256, 0); - if (err) - return err; - - err = floppy_write_sector(floppy, 0, 0, 2, 0, &header[0x0100], 256, 0); - if (err) - return err; - - err = floppy_write_sector(floppy, 0, 0, 3, 0, &header[0x0200], 256, 0); - if (err) - return err; - - err = floppy_write_sector(floppy, 0, 0, 4, 0, &header[0x0300], 256, 0); - if (err) - return err; - - return FLOPPY_ERROR_SUCCESS; -} - - - -static FLOPPY_IDENTIFY(coco_os9_identify) -{ - struct basicdsk_geometry geometry; - *vote = coco_os9_readheader(floppy, &geometry) ? 0 : 100; - return FLOPPY_ERROR_SUCCESS; -} - - - -static FLOPPY_CONSTRUCT(coco_os9_construct) -{ - floperr_t err; - struct basicdsk_geometry geometry; - - if (params) - { - /* create */ - memset(&geometry, 0, sizeof(geometry)); - geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); - geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - } - else - { - /* open */ - err = coco_os9_readheader(floppy, &geometry); - if (err) - return err; - } - - /* actually construct the image */ - err = basicdsk_construct(floppy, &geometry); - floppy_callbacks(floppy)->post_format = coco_os9_post_format; - return err; -} - - - -/* ----------------------------------------------------------------------- - * VDK file format - * - * Used by Paul Burgin's PC-Dragon emulator - * - * Offset Bytes Field Description - * ------ ----- ------------ ----------- - * 0 1 magic1 Signature byte 1 ('d') - * 1 1 magic2 Signature byte 2 ('k') - * 2 2 header_len Total header length (little endian) - * 4 1 ver_actual Version of the VDK format (0x10) - * 5 1 ver_compat Backwards compatibility version (0x10) - * 6 1 source_id Identify of the file source - * 7 1 source_ver Version of the file source - * 8 1 tracks Number of tracks - * 9 1 sides Number of sides (1-2) - * 10 1 flags Various flags - * bit 0: Write protect - * bit 1: A Lock - * bit 2: F Lock - * bit 3: Disk set - * 11 1 compression Compression flags (bits 0-2) and name length - * ----------------------------------------------------------------------- */ - - - -static int coco_vdk_decode_header(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) -{ - UINT8 header[12]; - UINT8 heads, tracks, sectors; - UINT16 sector_length, offset; - UINT64 size; - - size = floppy_image_size(floppy); - - floppy_image_read(floppy, header, 0, sizeof(header)); - - if (header[0] != 'd') - return -1; - if (header[1] != 'k') - return -1; - if (header[5] != 0x10) - return -1; - if (header[11] & 0x07) - return -1; - - heads = header[9]; - tracks = header[8]; - sectors = 18; - sector_length = 0x100; - - offset = header[3] * 0x100 + header[2]; - - if (size != ((UINT32) heads * tracks * sectors * sector_length + offset)) - return -1; - - if (geometry) - { - memset(geometry, 0, sizeof(*geometry)); - geometry->heads = heads; - geometry->tracks = tracks; - geometry->sectors = sectors; - geometry->first_sector_id = 1; - geometry->sector_length = sector_length; - geometry->offset = offset; - } - return 0; -} - - - -static FLOPPY_IDENTIFY(coco_vdk_identify) -{ - *vote = coco_vdk_decode_header(floppy, NULL) ? 0 : 100; - return FLOPPY_ERROR_SUCCESS; -} - - - -static FLOPPY_CONSTRUCT(coco_vdk_construct) -{ - struct basicdsk_geometry geometry; - UINT8 header[12]; - - if (params) - { - /* create */ - memset(&geometry, 0, sizeof(geometry)); - geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - geometry.sectors = 18; - geometry.first_sector_id = 1; - geometry.sector_length = 256; - geometry.offset = sizeof(header); - - memset(&header, 0, sizeof(header)); - header[0] = 'd'; - header[1] = 'k'; - header[2] = (UINT8) (sizeof(header) >> 0); - header[3] = (UINT8) (sizeof(header) >> 8); - header[4] = 0x10; - header[5] = 0x10; - header[8] = (UINT8) geometry.tracks; - header[9] = (UINT8) geometry.heads; - - floppy_image_write(floppy, header, 0, sizeof(header)); - } - else - { - /* load */ - if (coco_vdk_decode_header(floppy, &geometry)) - return FLOPPY_ERROR_INVALIDIMAGE; - } - return basicdsk_construct(floppy, &geometry); -} - - - -/* ----------------------------------------------------------------------- - * DMK file format - * - * David M. Keil's disk image format is aptly called an 'on disk' image - * format. This means that whatever written to the disk is enocded into - * the image file. IDAMS, sector headers, traling CRCs, and intra sector - * spacing. * - * - * HEADER DESCRIPTION: - * - * Offset Bytes Field Description - * ------ ----- ------------ ----------- - * 0 1 write_prot 0xff = Writed Protected, 0x00 = R/W - * 1 1 tracks Number of tracks - * 2 2 track_length Bytes per track (little endian) - * 4 1 disk_options Miscellaneous flags - * bit 0-3: Unused - * bit 4: 1=single sided 0=dbl - * bit 5: Unused - * bit 6: Single density? - * bit 6: Ignore density flags? - * 5 7 reserved Reserved for future use - * 12 4 real_disk_code If this is 0x12345678 (little endian) - * then access a real disk drive - * (unsupported) - * - * Each track begins with a track TOC, consisting of 64 little endian 16-bit - * integers. Each integer has the following format: - * bit 0-13: Offset from beginning of track to 'FE' byte of IDAM - * Note these are always sorted from first to last. All empty - * entries are 0x00 - * bit 14: Undefined (reserved) - * bit 15: Sector double density (0=SD 1=DD) - * ----------------------------------------------------------------------- */ - -struct dmk_tag -{ - int heads; - int tracks; - UINT32 track_size; -}; - -#define DMK_HEADER_LEN 16 -#define DMK_TOC_LEN 64 -#define DMK_IDAM_LENGTH 7 -#define DMK_DATA_GAP 80 -#define DMK_LEAD_IN 32 -#define DMK_EXTRA_TRACK_LENGTH 156 - -#define dmk_idam_type(x) (x)[0] -#define dmk_idam_track(x) (x)[1] -#define dmk_idam_side(x) (x)[2] -#define dmk_idam_sector(x) (x)[3] -#define dmk_idam_sectorlength(x) (x)[4] -#define dmk_idam_crc(x) (((x)[5] << 8) + (x)[6]) -#define dmk_idam_set_crc(x, crc) (x)[5] = ((crc) >> 8); (x)[6] = ((crc) >> 0); - - -static struct dmk_tag *get_dmk_tag(floppy_image_legacy *floppy) -{ - return (dmk_tag *)floppy_tag(floppy); -} - - -static floperr_t coco_dmk_get_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset) -{ - struct dmk_tag *tag = get_dmk_tag(floppy); - - if ((head < 0) || (head >= tag->heads) || (track < 0) || (track >= tag->tracks)) - return FLOPPY_ERROR_SEEKERROR; - - *offset = track; - *offset *= tag->heads; - *offset += head; - *offset *= tag->track_size; - *offset += DMK_HEADER_LEN; - return FLOPPY_ERROR_SUCCESS; -} - - - -static UINT32 coco_dmk_min_track_size(int sectors, int sector_length) -{ - int sector_physical_length; - sector_physical_length = 8 + 3 + DMK_IDAM_LENGTH + 22 + 12 + 3 + 1 + sector_length + 2 + 24; - return DMK_TOC_LEN * 2 + DMK_LEAD_IN + (sectors * sector_physical_length); -} - - - -static floperr_t coco_dmk_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen) -{ - floperr_t err; - UINT64 track_offset; - - err = coco_dmk_get_offset(floppy, head, track, &track_offset); - if (err) - return err; - - floppy_image_read(floppy, buffer, offset + track_offset, buflen); - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen) -{ - floperr_t err; - UINT64 track_offset; - - err = coco_dmk_get_offset(floppy, head, track, &track_offset); - if (err) - return err; - - floppy_image_write(floppy, buffer, offset + track_offset, buflen); - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_get_track_data_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset) -{ - *offset = DMK_TOC_LEN + 1; - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_format_track(floppy_image_legacy *floppy, int head, int track, option_resolution *params) -{ - int sectors; - int sector_length; - int interleave; - int first_sector_id; - floperr_t err; - int physical_sector; - int logical_sector; - int track_position; - UINT16 idam_offset; - UINT16 crc; - UINT8 *track_data; - void *track_data_v; - UINT32 max_track_size; - std::vector sector_map; - - sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - interleave = option_resolution_lookup_int(params, PARAM_INTERLEAVE); - first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); - - max_track_size = get_dmk_tag(floppy)->track_size; - - if (sectors > DMK_TOC_LEN) - { - err = FLOPPY_ERROR_INTERNAL; - goto done; - } - - if (max_track_size < coco_dmk_min_track_size(sectors, sector_length)) - { - err = FLOPPY_ERROR_NOSPACE; - goto done; - } - - err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL); - if (err) - goto done; - track_data = (UINT8 *) track_data_v; - - /* set up sector map */ - memset(§or_map[0], 0xff, sectors*sizeof(int)); - - physical_sector = 0; - for (logical_sector = 0; logical_sector < sectors; logical_sector++) - { - while(sector_map[physical_sector] >= 0) - { - physical_sector++; - physical_sector %= sectors; - } - - sector_map[physical_sector] = logical_sector + first_sector_id; - physical_sector += interleave + 1; - physical_sector %= sectors; - } - - /* set up track table of contents */ - physical_sector = 0; - track_position = DMK_TOC_LEN * 2 + DMK_LEAD_IN; - while(physical_sector < DMK_TOC_LEN) - { - if (physical_sector >= sectors) - { - /* no more sectors */ - idam_offset = 0; - } - else - { - /* this is a sector */ - logical_sector = sector_map[physical_sector]; - - /* write the sector */ - memset(&track_data[track_position], 0x00, 8); - track_position += 8; - - memset(&track_data[track_position], 0xA1, 3); - track_position += 3; - - idam_offset = track_position | 0x8000; - dmk_idam_type( &track_data[track_position]) = 0xFE; - dmk_idam_track( &track_data[track_position]) = track; - dmk_idam_side( &track_data[track_position]) = head; - dmk_idam_sector( &track_data[track_position]) = logical_sector; - dmk_idam_sectorlength( &track_data[track_position]) = compute_log2(sector_length / 128); - crc = ccitt_crc16(0xcdb4, &track_data[track_position], DMK_IDAM_LENGTH - 2); - dmk_idam_set_crc( &track_data[track_position], crc); - track_position += DMK_IDAM_LENGTH; - - memset(&track_data[track_position], 0x4E, 22); - track_position += 22; - - memset(&track_data[track_position], 0x00, 12); - track_position += 12; - - memset(&track_data[track_position], 0xA1, 3); - track_position += 3; - - /* write sector body */ - track_data[track_position] = 0xFB; - memset(&track_data[track_position + 1], floppy_get_filler(floppy), sector_length); - crc = ccitt_crc16(0xcdb4, &track_data[track_position], sector_length + 1); - track_data[track_position + sector_length + 1] = (UINT8) (crc >> 8); - track_data[track_position + sector_length + 2] = (UINT8) (crc >> 0); - track_position += sector_length + 3; - - /* write sector footer */ - memset(&track_data[track_position], 0x4E, 24); - track_position += 24; - } - - /* write the TOC entry */ - track_data[physical_sector * 2 + 0] = (UINT8) (idam_offset >> 0); - track_data[physical_sector * 2 + 1] = (UINT8) (idam_offset >> 8); - - physical_sector++; - } - - /* write track lead in */ - memset(&track_data[physical_sector * 2], 0x4e, DMK_LEAD_IN); - - /* write track footer */ - assert(max_track_size >= (UINT32)track_position); - memset(&track_data[track_position], 0x4e, max_track_size - track_position); - -done: - return err; -} - - - -static int coco_dmk_get_heads_per_disk(floppy_image_legacy *floppy) -{ - return get_dmk_tag(floppy)->heads; -} - - - -static int coco_dmk_get_tracks_per_disk(floppy_image_legacy *floppy) -{ - return get_dmk_tag(floppy)->tracks; -} - - - -static UINT32 coco_dmk_get_track_size(floppy_image_legacy *floppy, int head, int track) -{ - return get_dmk_tag(floppy)->track_size; -} - - - -static floperr_t coco_dmk_seek_sector_in_track(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, int dirtify, UINT8 **sector_data, UINT32 *sector_length) -{ - struct dmk_tag *tag = get_dmk_tag(floppy); - floperr_t err; - UINT32 idam_offset = 0; - UINT16 calculated_crc; - size_t i; - size_t offs; - int state; - UINT8 *track_data; - void *track_data_v; - size_t track_length; - size_t sec_len; - - err = floppy_load_track(floppy, head, track, dirtify, &track_data_v, &track_length); - if (err) - return err; - track_data = (UINT8 *) track_data_v; - - /* search for matching IDAM */ - for (i = 0; i < DMK_TOC_LEN; i++) - { - idam_offset = track_data[i * 2 + 1]; - idam_offset <<= 8; - idam_offset |= track_data[i * 2 + 0]; - idam_offset &= 0x3FFF; - - if (idam_offset == 0) - { - /* we've reached the end of the road */ - i = DMK_TOC_LEN; - break; - } - - if ((idam_offset + DMK_IDAM_LENGTH) >= tag->track_size) - continue; - - calculated_crc = ccitt_crc16(0xCDB4, &track_data[idam_offset], DMK_IDAM_LENGTH - 2); - - if (calculated_crc == dmk_idam_crc(&track_data[idam_offset])) - { - if (sector_is_index) - { - /* the sector is indexed; decrement the index and go */ - if (sector-- == 0) - break; - } - else - { - /* check IDAM integrity and check for matching sector */ - if (sector == dmk_idam_sector(&track_data[idam_offset]) -/* && (track == dmk_idam_track(&track_data[idam_offset])) */ -/* && (head == dmk_idam_side(&track_data[idam_offset])) */ - ) - break; - } - } - } - - if (i >= DMK_TOC_LEN) - return FLOPPY_ERROR_SEEKERROR; - - /* we found a matching sector ID */ - state = 0; - offs = idam_offset + DMK_IDAM_LENGTH; - - /* find pattern 0xA1A1FB; this represents the start of a data sector */ - for (i = 0; i < DMK_DATA_GAP; i++) - { - /* overflowing the track? */ - if ((i + offs) >= tag->track_size) - return FLOPPY_ERROR_SEEKERROR; - - if (track_data[offs + i] == 0xA1) - state++; - else if ((track_data[offs + i] == 0xFB) && state) - break; - else - state = 0; - } - if (i >= DMK_DATA_GAP) - return FLOPPY_ERROR_SEEKERROR; - - offs += i + 1; - sec_len = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); - - if ((offs + sec_len) > track_length) - return FLOPPY_ERROR_INVALIDIMAGE; - - if (sector_data) - *sector_data = track_data + offs; - if (sector_length) - *sector_length = sec_len; - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length) -{ - return coco_dmk_seek_sector_in_track(floppy, head, track, sector, FALSE, FALSE, NULL, sector_length); -} - - - -static floperr_t coco_dmk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags) -{ - floperr_t err; - UINT32 idam_offset; - const UINT8 *track_data; - void *track_data_v; - - if (sector_index*2 >= DMK_TOC_LEN) - return FLOPPY_ERROR_SEEKERROR; - - err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, NULL); - if (err) - return err; - track_data = (UINT8 *) track_data_v; - - idam_offset = track_data[sector_index * 2 + 1]; - idam_offset <<= 8; - idam_offset |= track_data[sector_index * 2 + 0]; - idam_offset &= 0x3FFF; - - if (idam_offset == 0) - return FLOPPY_ERROR_SEEKERROR; - - if (cylinder) - *cylinder = dmk_idam_track(&track_data[idam_offset]); - if (side) - *side = dmk_idam_side(&track_data[idam_offset]); - if (sector) - *sector = dmk_idam_sector(&track_data[idam_offset]); - if (sector_length) - *sector_length = 128 << dmk_idam_sectorlength(&track_data[idam_offset]); - if (flags) - /* TODO: read DAM or DDAM and determine flags */ - *flags = 0; - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t internal_coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen) -{ - floperr_t err; - UINT32 sector_length; - UINT16 crc_on_disk; - UINT16 calculated_crc; - UINT8 *sector_data; - - err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, FALSE, §or_data, §or_length); - if (err) - return err; - - crc_on_disk = sector_data[sector_length + 0]; - crc_on_disk <<= 8; - crc_on_disk += sector_data[sector_length + 1]; - - calculated_crc = ccitt_crc16(0xE295, sector_data, sector_length); - if (calculated_crc != crc_on_disk) - return FLOPPY_ERROR_INVALIDIMAGE; - - memcpy(buffer, sector_data, MIN(sector_length, buflen)); - - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t internal_coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam) -{ - floperr_t err; - UINT32 sector_length; - UINT8 *sector_data; - UINT16 crc; - - err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, TRUE, §or_data, §or_length); - if (err) - return err; - - if (buflen > sector_length) - return FLOPPY_ERROR_INTERNAL; - - memcpy(sector_data, buffer, buflen); - - crc = ccitt_crc16(0xE295, sector_data, sector_length); - sector_data[sector_length + 0] = crc >> 8; - sector_data[sector_length + 1] = crc >> 0; - return FLOPPY_ERROR_SUCCESS; -} - - - -static floperr_t coco_dmk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen) -{ - return internal_coco_dmk_read_sector(floppy, head, track, sector, FALSE, buffer, buflen); -} - -static floperr_t coco_dmk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) -{ - return internal_coco_dmk_write_sector(floppy, head, track, sector, FALSE, buffer, buflen, ddam); -} - -static floperr_t coco_dmk_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen) -{ - return internal_coco_dmk_read_sector(floppy, head, track, sector, TRUE, buffer, buflen); -} - -static floperr_t coco_dmk_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam) -{ - return internal_coco_dmk_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam); -} - - - -static void coco_dmk_interpret_header(floppy_image_legacy *floppy, int *heads, int *tracks, int *track_size) -{ - UINT8 header[DMK_HEADER_LEN]; - - floppy_image_read(floppy, header, 0, DMK_HEADER_LEN); - - if (tracks) - *tracks = header[1]; - if (heads) - *heads = (header[4] & 0x10) ? 1 : 2; - if (track_size) - *track_size = ((int) header[3]) * 0x100 + header[2]; -} - - - -FLOPPY_CONSTRUCT(coco_dmk_construct) -{ - struct FloppyCallbacks *callbacks; - struct dmk_tag *tag; - UINT8 header[DMK_HEADER_LEN]; - int heads, tracks, track_size, sectors, sector_length; - - if (params) - { - heads = option_resolution_lookup_int(params, PARAM_HEADS); - tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - - track_size = coco_dmk_min_track_size(sectors, sector_length) + DMK_EXTRA_TRACK_LENGTH; - - memset(header, 0, sizeof(header)); - header[1] = tracks; - header[2] = track_size >> 0; - header[3] = track_size >> 8; - header[4] = (heads == 2) ? 0x00 : 0x10; - - floppy_image_write(floppy, header, 0, sizeof(header)); - } - else - { - coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); - } - - tag = (dmk_tag *)floppy_create_tag(floppy, sizeof(struct dmk_tag)); - if (!tag) - return FLOPPY_ERROR_OUTOFMEMORY; - tag->heads = heads; - tag->track_size = track_size; - tag->tracks = tracks; - - callbacks = floppy_callbacks(floppy); - callbacks->read_track = coco_dmk_read_track; - callbacks->write_track = coco_dmk_write_track; - callbacks->get_track_data_offset = coco_dmk_get_track_data_offset; - callbacks->format_track = coco_dmk_format_track; - callbacks->get_heads_per_disk = coco_dmk_get_heads_per_disk; - callbacks->get_tracks_per_disk = coco_dmk_get_tracks_per_disk; - callbacks->get_track_size = coco_dmk_get_track_size; - callbacks->get_sector_length = coco_dmk_get_sector_length; - callbacks->get_indexed_sector_info = coco_dmk_get_indexed_sector_info; - callbacks->read_sector = coco_dmk_read_sector; - callbacks->write_sector = coco_dmk_write_sector; - callbacks->read_indexed_sector = coco_dmk_read_indexed_sector; - callbacks->write_indexed_sector = coco_dmk_write_indexed_sector; - - return FLOPPY_ERROR_SUCCESS; -} - - - -FLOPPY_IDENTIFY(coco_dmk_identify) -{ - int heads, tracks, track_size; - UINT64 size, expected_size; - - size = floppy_image_size(floppy); - coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size); - expected_size = DMK_HEADER_LEN + (heads * tracks * track_size); - *vote = (size == expected_size) ? 100 : 0; - return FLOPPY_ERROR_SUCCESS; -} - - - -/* ----------------------------------------------------------------------- */ - -LEGACY_FLOPPY_OPTIONS_START( coco ) - LEGACY_FLOPPY_OPTION( coco_jvc, "dsk", "CoCo JVC disk image", coco_jvc_identify, coco_jvc_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS(1-[18]-255) - SECTOR_LENGTH(128/[256]/512/1024) - FIRST_SECTOR_ID(0-[1])) - LEGACY_FLOPPY_OPTION( coco_os9, "os9", "CoCo OS-9 disk image", coco_os9_identify, coco_os9_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS(1-[18]-255) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) - LEGACY_FLOPPY_OPTION( coco_vdk, "vdk", "CoCo VDK disk image", coco_vdk_identify, coco_vdk_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS([18]) - SECTOR_LENGTH([256]) - FIRST_SECTOR_ID([1])) - LEGACY_FLOPPY_OPTION( coco_dmk, "dsk,dmk", "CoCo DMK disk image", coco_dmk_identify, coco_dmk_construct, NULL, - HEADS([1]-2) - TRACKS([35]-255) - SECTORS(1-[18]) - SECTOR_LENGTH(128/[256]/512/1024/2048/4096/8192) - INTERLEAVE(0-[6]-17) - FIRST_SECTOR_ID(0-[1])) -LEGACY_FLOPPY_OPTIONS_END diff --git a/src/mess/tools/imgtool/formats/coco_dsk.h b/src/mess/tools/imgtool/formats/coco_dsk.h deleted file mode 100644 index 797911d40a1..00000000000 --- a/src/mess/tools/imgtool/formats/coco_dsk.h +++ /dev/null @@ -1,24 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - formats/coco_dsk.h - - Tandy Color Computer / Dragon disk images - -*********************************************************************/ - -#ifndef COCO_DSK_H -#define COCO_DSK_H - -#include "formats/flopimg.h" - - -/**************************************************************************/ - -LEGACY_FLOPPY_OPTIONS_EXTERN(coco); - -FLOPPY_IDENTIFY(coco_dmk_identify); -FLOPPY_CONSTRUCT(coco_dmk_construct); - -#endif /* COCO_DSK_H */ diff --git a/src/mess/tools/imgtool/formats/vt_dsk.c b/src/mess/tools/imgtool/formats/vt_dsk.c deleted file mode 100644 index 4e75e843d28..00000000000 --- a/src/mess/tools/imgtool/formats/vt_dsk.c +++ /dev/null @@ -1,57 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/********************************************************************* - - formats/vt_dsk.c - - VTech Laser/VZ disk images - -*********************************************************************/ - -#include -#include -#include -#include "formats/vt_dsk.h" -#include "formats/basicdsk.h" - -static FLOPPY_IDENTIFY(vz_identify) -{ - UINT64 size = floppy_image_size(floppy); - *vote = ((size == 98560) || (size == 99200) || (size == 99184)) ? 100 : 0; - return FLOPPY_ERROR_SUCCESS; -} - -static FLOPPY_CONSTRUCT(vz_construct) -{ - struct basicdsk_geometry geometry; - memset(&geometry, 0, sizeof(geometry)); - - if (params) - { - geometry.heads = option_resolution_lookup_int(params, PARAM_HEADS); - geometry.tracks = option_resolution_lookup_int(params, PARAM_TRACKS); - geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS); - geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID); - geometry.sector_length = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH); - } - else - { - geometry.heads = 1; - geometry.tracks = 40; - geometry.sectors = 16; - geometry.first_sector_id = 0; - geometry.sector_length = floppy_image_size(floppy)/geometry.tracks/geometry.sectors; - } - - return basicdsk_construct(floppy, &geometry); -} - - -LEGACY_FLOPPY_OPTIONS_START(vz) - LEGACY_FLOPPY_OPTION(vtech1, "dsk", "Laser/VZ disk image", vz_identify, vz_construct, NULL, - HEADS([1]) - TRACKS([40]) - SECTORS([16]) - SECTOR_LENGTH([154]) - FIRST_SECTOR_ID([0])) -LEGACY_FLOPPY_OPTIONS_END diff --git a/src/mess/tools/imgtool/formats/vt_dsk.h b/src/mess/tools/imgtool/formats/vt_dsk.h deleted file mode 100644 index a3f9a86b44e..00000000000 --- a/src/mess/tools/imgtool/formats/vt_dsk.h +++ /dev/null @@ -1,18 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/********************************************************************* - - formats/vt_dsk.h - - Tandy Color Computer / Dragon disk images - -*********************************************************************/ - -#ifndef VT_DSK_H -#define VT_DSK_H - -#include "formats/flopimg.h" - -LEGACY_FLOPPY_OPTIONS_EXTERN(vz); - -#endif /* VT_DSK_H */ diff --git a/src/mess/tools/imgtool/iflopimg.c b/src/mess/tools/imgtool/iflopimg.c deleted file mode 100644 index 9e8493f9477..00000000000 --- a/src/mess/tools/imgtool/iflopimg.c +++ /dev/null @@ -1,363 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - iflopimg.c - - Bridge code for Imgtool into the standard floppy code - -*********************************************************************/ - -#include "imgtool.h" -#include "formats/flopimg.h" -#include "library.h" -#include "iflopimg.h" - -imgtoolerr_t imgtool_floppy_error(floperr_t err) -{ - switch(err) - { - case FLOPPY_ERROR_SUCCESS: - return IMGTOOLERR_SUCCESS; - - case FLOPPY_ERROR_OUTOFMEMORY: - return IMGTOOLERR_OUTOFMEMORY; - - case FLOPPY_ERROR_INVALIDIMAGE: - return IMGTOOLERR_CORRUPTIMAGE; - - case FLOPPY_ERROR_SEEKERROR: - return IMGTOOLERR_SEEKERROR; - - case FLOPPY_ERROR_UNSUPPORTED: - return IMGTOOLERR_UNIMPLEMENTED; - - default: - return IMGTOOLERR_UNEXPECTED; - } -} - - - -/********************************************************************* - Imgtool ioprocs -*********************************************************************/ - -static void imgtool_floppy_closeproc(void *file) -{ - stream_close((imgtool_stream *) file); -} - -static int imgtool_floppy_seekproc(void *file, INT64 offset, int whence) -{ - stream_seek((imgtool_stream *) file, offset, whence); - return 0; -} - -static size_t imgtool_floppy_readproc(void *file, void *buffer, size_t length) -{ - return stream_read((imgtool_stream *) file, buffer, length); -} - -static size_t imgtool_floppy_writeproc(void *file, const void *buffer, size_t length) -{ - stream_write((imgtool_stream *) file, buffer, length); - return length; -} - -static UINT64 imgtool_floppy_filesizeproc(void *file) -{ - return stream_size((imgtool_stream *) file); -} - -static const struct io_procs imgtool_ioprocs = -{ - imgtool_floppy_closeproc, - imgtool_floppy_seekproc, - imgtool_floppy_readproc, - imgtool_floppy_writeproc, - imgtool_floppy_filesizeproc -}; - -static const struct io_procs imgtool_noclose_ioprocs = -{ - NULL, - imgtool_floppy_seekproc, - imgtool_floppy_readproc, - imgtool_floppy_writeproc, - imgtool_floppy_filesizeproc -}; - - - -/********************************************************************* - Imgtool handlers -*********************************************************************/ - -struct imgtool_floppy_image -{ - floppy_image_legacy *floppy; -}; - - - - -static imgtoolerr_t imgtool_floppy_open_internal(imgtool_image *image, imgtool_stream *f, int noclose) -{ - floperr_t ferr; - imgtoolerr_t err; - struct imgtool_floppy_image *fimg; - const imgtool_class *imgclass; - const struct FloppyFormat *format; - imgtoolerr_t (*open)(imgtool_image *image, imgtool_stream *f); - - fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(image); - imgclass = &imgtool_image_module(image)->imgclass; - format = (const struct FloppyFormat *) imgclass->derived_param; - open = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_OPEN); - - /* open up the floppy */ - ferr = floppy_open(f, noclose ? &imgtool_noclose_ioprocs : &imgtool_ioprocs, - NULL, format, FLOPPY_FLAGS_READWRITE, &fimg->floppy); - if (ferr) - { - err = imgtool_floppy_error(ferr); - return err; - } - - if (open) - { - err = open(image, NULL); - if (err) - return err; - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t imgtool_floppy_open(imgtool_image *image, imgtool_stream *f) -{ - return imgtool_floppy_open_internal(image, f, FALSE); -} - - - -static imgtoolerr_t imgtool_floppy_create(imgtool_image *image, imgtool_stream *f, option_resolution *opts) -{ - floperr_t ferr; - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - struct imgtool_floppy_image *fimg; - const imgtool_class *imgclass; - const struct FloppyFormat *format; - imgtoolerr_t (*create)(imgtool_image *, imgtool_stream *, option_resolution *); - imgtoolerr_t (*open)(imgtool_image *image, imgtool_stream *f); - - fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(image); - imgclass = &imgtool_image_module(image)->imgclass; - format = (const struct FloppyFormat *) imgclass->derived_param; - create = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *, option_resolution *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_CREATE); - open = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_OPEN); - - /* open up the floppy */ - ferr = floppy_create(f, &imgtool_ioprocs, format, opts, &fimg->floppy); - if (ferr) - { - err = imgtool_floppy_error(ferr); - goto done; - } - - /* do we have to do extra stuff when creating the image? */ - if (create) - { - err = create(image, NULL, opts); - if (err) - goto done; - } - - /* do we have to do extra stuff when opening the image? */ - if (open) - { - err = open(image, NULL); - if (err) - goto done; - } - -done: - return err; -} - - - -static void imgtool_floppy_close(imgtool_image *img) -{ - floppy_close(imgtool_floppy(img)); -} - - - -static imgtoolerr_t imgtool_floppy_get_sector_size(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size) -{ - floperr_t ferr; - - ferr = floppy_get_sector_length(imgtool_floppy(image), head, track, sector, sector_size); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t imgtool_floppy_read_sector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len) -{ - floperr_t ferr; - - ferr = floppy_read_sector(imgtool_floppy(image), head, track, sector, 0, buffer, len); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t imgtool_floppy_write_sector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam) -{ - floperr_t ferr; - - ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, len, ddam); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static void imgtool_floppy_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - const struct FloppyFormat *format; - imgtool_class derived_class; - - format = (const struct FloppyFormat *) imgclass->derived_param; - memset(&derived_class, 0, sizeof(derived_class)); - derived_class.get_info = imgclass->derived_get_info; - - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: - info->i = sizeof(struct imgtool_floppy_image) + - imgtool_get_info_int(&derived_class, IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES); - break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: - sprintf(info->s = imgtool_temp_str(), "%s_%s", format->name, - imgtool_get_info_string(&derived_class, IMGTOOLINFO_STR_NAME)); - break; - case IMGTOOLINFO_STR_DESCRIPTION: - sprintf(info->s = imgtool_temp_str(), "%s (%s)", format->description, - imgtool_get_info_string(&derived_class, IMGTOOLINFO_STR_DESCRIPTION)); - break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), format->extensions); break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: info->p = (void*)format->param_guidelines; break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_OPEN: info->open = imgtool_floppy_open; break; - case IMGTOOLINFO_PTR_CREATE: info->create = imgtool_floppy_create; break; - case IMGTOOLINFO_PTR_CLOSE: info->close = imgtool_floppy_close; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = format->param_guidelines ? floppy_option_guide : NULL; break; - case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = imgtool_floppy_get_sector_size; break; - case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = imgtool_floppy_read_sector; break; - case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = imgtool_floppy_write_sector; break; - - default: imgclass->derived_get_info(imgclass, state, info); break; - } -} - - - -int imgtool_floppy_make_class(int index, imgtool_class *imgclass) -{ - const struct FloppyFormat *format; - - /* get the format */ - format = (const struct FloppyFormat *) - imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_FORMAT); - assert(format); - if (!format[index].construct) - return FALSE; - - imgclass->derived_get_info = imgclass->get_info; - imgclass->get_info = imgtool_floppy_get_info; - imgclass->derived_param = (void *) &format[index]; - return TRUE; -} - - - -floppy_image_legacy *imgtool_floppy(imgtool_image *img) -{ - struct imgtool_floppy_image *fimg; - fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(img); - return fimg->floppy; -} - - - -static imgtoolerr_t imgtool_floppy_transfer_sector_tofrom_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f, int direction) -{ - floperr_t err; - floppy_image_legacy *floppy; - dynamic_buffer buffer; - - floppy = imgtool_floppy(img); - - buffer.resize(length); - - if (direction) - { - err = floppy_read_sector(floppy, head, track, sector, offset, &buffer[0], length); - if (err) - goto done; - stream_write(f, &buffer[0], length); - } - else - { - stream_read(f, &buffer[0], length); - err = floppy_write_sector(floppy, head, track, sector, offset, &buffer[0], length, 0); /* TODO: pass ddam argument from imgtool */ - if (err) - goto done; - } - - err = FLOPPY_ERROR_SUCCESS; - -done: - return imgtool_floppy_error(err); -} - - - -imgtoolerr_t imgtool_floppy_read_sector_to_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f) -{ - return imgtool_floppy_transfer_sector_tofrom_stream(img, head, track, sector, offset, length, f, 1); -} - - - -imgtoolerr_t imgtool_floppy_write_sector_from_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f) -{ - return imgtool_floppy_transfer_sector_tofrom_stream(img, head, track, sector, offset, length, f, 0); -} - - - -void *imgtool_floppy_extrabytes(imgtool_image *img) -{ - struct imgtool_floppy_image *fimg; - fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(img); - return fimg + 1; -} diff --git a/src/mess/tools/imgtool/iflopimg.h b/src/mess/tools/imgtool/iflopimg.h deleted file mode 100644 index 8e298330845..00000000000 --- a/src/mess/tools/imgtool/iflopimg.h +++ /dev/null @@ -1,41 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - iflopimg.h - - Bridge code for Imgtool into the standard floppy code - -*********************************************************************/ - -#ifndef IFLOPIMG_H -#define IFLOPIMG_H - -#include "formats/flopimg.h" -#include "library.h" - -/*************************************************************************** - - Prototypes - -***************************************************************************/ - -enum -{ - IMGTOOLINFO_PTR_FLOPPY_FORMAT = IMGTOOLINFO_PTR_CLASS_SPECIFIC, - IMGTOOLINFO_PTR_FLOPPY_OPEN, - IMGTOOLINFO_PTR_FLOPPY_CREATE -}; - -int imgtool_floppy_make_class(int index, imgtool_class *imgclass); - -floppy_image_legacy *imgtool_floppy(imgtool_image *img); -imgtoolerr_t imgtool_floppy_error(floperr_t err); - -imgtoolerr_t imgtool_floppy_read_sector_to_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f); -imgtoolerr_t imgtool_floppy_write_sector_from_stream(imgtool_image *img, int head, int track, int sector, int offset, size_t length, imgtool_stream *f); - - -void *imgtool_floppy_extrabytes(imgtool_image *img); - -#endif /* IFLOPIMG_H */ diff --git a/src/mess/tools/imgtool/imghd.c b/src/mess/tools/imgtool/imghd.c deleted file mode 100644 index 8ac129751f9..00000000000 --- a/src/mess/tools/imgtool/imghd.c +++ /dev/null @@ -1,273 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet -/* - Code to interface the MESS image code with MAME's harddisk core. - - We do not support diff files as it will involve some changes in the MESS - image code. - - Raphael Nabet 2003 -*/ - -#include "imgtool.h" -#include "harddisk.h" -#include "imghd.h" - - -static imgtoolerr_t map_chd_error(chd_error chderr) -{ - imgtoolerr_t err; - - switch(chderr) - { - case CHDERR_NONE: - err = IMGTOOLERR_SUCCESS; - break; - case CHDERR_OUT_OF_MEMORY: - err = IMGTOOLERR_OUTOFMEMORY; - break; - case CHDERR_FILE_NOT_WRITEABLE: - err = IMGTOOLERR_READONLY; - break; - case CHDERR_NOT_SUPPORTED: - err = IMGTOOLERR_UNIMPLEMENTED; - break; - default: - err = IMGTOOLERR_UNEXPECTED; - break; - } - return err; -} - - - -/* - imghd_create() - - Create a MAME HD image -*/ -imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 hunksize, UINT32 cylinders, UINT32 heads, UINT32 sectors, UINT32 seclen) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - dynamic_buffer cache; - chd_file chd; - chd_error rc; - UINT64 logicalbytes; - int hunknum, totalhunks; - std::string metadata; - chd_codec_type compression[4] = { CHD_CODEC_NONE }; - - /* sanity check args */ - if (hunksize >= 2048) - { - err = IMGTOOLERR_PARAMCORRUPT; - goto done; - } - if (hunksize <= 0) - hunksize = 1024; /* default value */ - - /* bail if we are read only */ - if (stream_isreadonly(stream)) - { - err = IMGTOOLERR_READONLY; - goto done; - } - - /* calculations */ - logicalbytes = (UINT64)cylinders * heads * sectors * seclen; - - /* create the new hard drive */ - rc = chd.create(*stream_core_file(stream), logicalbytes, hunksize, seclen, compression); - if (rc != CHDERR_NONE) - { - err = map_chd_error(rc); - goto done; - } - - /* open the new hard drive */ - rc = chd.open(*stream_core_file(stream)); - - if (rc != CHDERR_NONE) - { - err = map_chd_error(rc); - goto done; - } - - /* write the metadata */ - strprintf(metadata,HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen); - err = (imgtoolerr_t)chd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata); - if (rc != CHDERR_NONE) - { - err = map_chd_error(rc); - goto done; - } - - /* alloc and zero buffer */ - cache.resize(hunksize); - memset(&cache[0], 0, hunksize); - - /* zero out every hunk */ - totalhunks = (logicalbytes + hunksize - 1) / hunksize; - for (hunknum = 0; hunknum < totalhunks; hunknum++) - { - rc = chd.write_units(hunknum, &cache[0]); - if (rc) - { - err = IMGTOOLERR_WRITEERROR; - goto done; - } - } - -done: - return err; -} - - - -/* - imghd_open() - - Open stream as a MAME HD image -*/ -imgtoolerr_t imghd_open(imgtool_stream *stream, struct mess_hard_disk_file *hard_disk) -{ - chd_error chderr; - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - - hard_disk->hard_disk = NULL; - hard_disk->chd = NULL; - - chderr = hard_disk->chd->open(*stream_core_file(stream), stream_isreadonly(stream)); - if (chderr) - { - err = map_chd_error(chderr); - goto done; - } - - hard_disk->hard_disk = hard_disk_open(hard_disk->chd); - if (!hard_disk->hard_disk) - { - err = IMGTOOLERR_UNEXPECTED; - goto done; - } - hard_disk->stream = stream; - -done: - if (err) - imghd_close(hard_disk); - return err; -} - - - -/* - imghd_close() - - Close MAME HD image -*/ -void imghd_close(struct mess_hard_disk_file *disk) -{ - if (disk->hard_disk) - { - hard_disk_close(disk->hard_disk); - disk->hard_disk = NULL; - } - if (disk->stream) - stream_close(disk->stream); -} - - - -/* - imghd_read() - - Read sector(s) from MAME HD image -*/ -imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, UINT32 lbasector, void *buffer) -{ - UINT32 reply; - reply = hard_disk_read(disk->hard_disk, lbasector, buffer); - return (imgtoolerr_t)(reply ? IMGTOOLERR_SUCCESS : map_chd_error((chd_error)reply)); -} - - - -/* - imghd_write() - - Write sector(s) from MAME HD image -*/ -imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, UINT32 lbasector, const void *buffer) -{ - UINT32 reply; - reply = hard_disk_write(disk->hard_disk, lbasector, buffer); - return (imgtoolerr_t)(reply ? IMGTOOLERR_SUCCESS : map_chd_error((chd_error)reply)); -} - - - -/* - imghd_get_header() - - Return pointer to the header of MAME HD image -*/ -const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk) -{ - const hard_disk_info *reply; - reply = hard_disk_get_info(disk->hard_disk); - return reply; -} - - -static imgtoolerr_t mess_hd_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions); - -enum -{ - mess_hd_createopts_blocksize = 'B', - mess_hd_createopts_cylinders = 'C', - mess_hd_createopts_heads = 'D', - mess_hd_createopts_sectors = 'E', - mess_hd_createopts_seclen = 'F' -}; - -static OPTION_GUIDE_START( mess_hd_create_optionguide ) - OPTION_INT(mess_hd_createopts_blocksize, "blocksize", "Sectors Per Block" ) - OPTION_INT(mess_hd_createopts_cylinders, "cylinders", "Cylinders" ) - OPTION_INT(mess_hd_createopts_heads, "heads", "Heads" ) - OPTION_INT(mess_hd_createopts_sectors, "sectors", "Total Sectors" ) - OPTION_INT(mess_hd_createopts_seclen, "seclen", "Sector Bytes" ) -OPTION_GUIDE_END - -#define mess_hd_create_optionspecs "B[1]-2048;C1-[32]-65536;D1-[8]-64;E1-[128]-4096;F128/256/[512]/1024/2048/4096/8192/16384/32768/65536" - - -void hd_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mess_hd"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "MESS hard disk image"); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break; - - case IMGTOOLINFO_PTR_CREATE: info->create = mess_hd_image_create; break; - - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = mess_hd_create_optionguide; break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), mess_hd_create_optionspecs); break; - } -} - - - -static imgtoolerr_t mess_hd_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions) -{ - UINT32 blocksize, cylinders, heads, sectors, seclen; - - /* read options */ - blocksize = option_resolution_lookup_int(createoptions, mess_hd_createopts_blocksize); - cylinders = option_resolution_lookup_int(createoptions, mess_hd_createopts_cylinders); - heads = option_resolution_lookup_int(createoptions, mess_hd_createopts_heads); - sectors = option_resolution_lookup_int(createoptions, mess_hd_createopts_sectors); - seclen = option_resolution_lookup_int(createoptions, mess_hd_createopts_seclen); - - return imghd_create(f, blocksize, cylinders, heads, sectors, seclen); -} diff --git a/src/mess/tools/imgtool/imghd.h b/src/mess/tools/imgtool/imghd.h deleted file mode 100644 index 3dba7d40d4f..00000000000 --- a/src/mess/tools/imgtool/imghd.h +++ /dev/null @@ -1,42 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/**************************************************************************** - - imghd.h - - Bridge between Imgtool and CHD hard disk images - -****************************************************************************/ - -#ifndef IMGHD_H -#define IMGHD_H - -#include "harddisk.h" - -struct mess_hard_disk_file -{ - imgtool_stream *stream; - hard_disk_file *hard_disk; - chd_file *chd; -}; - - -/* create a new hard disk */ -imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 blocksize, UINT32 cylinders, UINT32 heads, UINT32 sectors, UINT32 seclen); - -/* opens a hard disk given an Imgtool stream */ -imgtoolerr_t imghd_open(imgtool_stream *stream, struct mess_hard_disk_file *hard_disk); - -/* close a hard disk */ -void imghd_close(struct mess_hard_disk_file *disk); - -/* reads data from a hard disk */ -imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, UINT32 lbasector, void *buffer); - -/* writes data to a hard disk */ -imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, UINT32 lbasector, const void *buffer); - -/* gets the header from a hard disk */ -const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk); - -#endif /* IMGHD_H */ diff --git a/src/mess/tools/imgtool/imgterrs.c b/src/mess/tools/imgtool/imgterrs.c deleted file mode 100644 index bd679440309..00000000000 --- a/src/mess/tools/imgtool/imgterrs.c +++ /dev/null @@ -1,55 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - imgterrs.c - - Imgtool errors - -***************************************************************************/ - -#include "imgtool.h" -#include "imgterrs.h" -#include "osdcomm.h" - -static const char *const msgs[] = -{ - "Out of memory", - "Unexpected error", - "Argument too long", - "Read error", - "Write error", - "Image is read only", - "Corrupt image", - "Corrupt file", - "Corrupt directory", - "File not found", - "Unrecognized format", - "Not implemented", - "Parameter too small", - "Parameter too large", - "Missing parameter not found", - "Inappropriate parameter", - "Invalid parameter", - "Bad file name", - "Out of space on image", - "Input past end of file", - "Cannot specify path", - "Invalid path", - "Path not found", - "Directory not empty", - "Seek error", - "File system does not support forks", - "Fork not found", - "Invalid partition" -}; - - - -const char *imgtool_error(imgtoolerr_t err) -{ - err = (imgtoolerr_t)(ERRORCODE(err) - 1); - assert(err >= 0); - assert(err < ARRAY_LENGTH(msgs)); - return msgs[err]; -} diff --git a/src/mess/tools/imgtool/imgterrs.h b/src/mess/tools/imgtool/imgterrs.h deleted file mode 100644 index 1cdafb6cef2..00000000000 --- a/src/mess/tools/imgtool/imgterrs.h +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - imgterrs.h - - Imgtool errors - -***************************************************************************/ - -#ifndef IMGTERRS_H -#define IMGTERRS_H - -/* Error codes */ -enum imgtoolerr_t -{ - IMGTOOLERR_SUCCESS, - IMGTOOLERR_OUTOFMEMORY, - IMGTOOLERR_UNEXPECTED, - IMGTOOLERR_BUFFERTOOSMALL, - IMGTOOLERR_READERROR, - IMGTOOLERR_WRITEERROR, - IMGTOOLERR_READONLY, - IMGTOOLERR_CORRUPTIMAGE, - IMGTOOLERR_CORRUPTFILE, - IMGTOOLERR_CORRUPTDIR, - IMGTOOLERR_FILENOTFOUND, - IMGTOOLERR_MODULENOTFOUND, - IMGTOOLERR_UNIMPLEMENTED, - IMGTOOLERR_PARAMTOOSMALL, - IMGTOOLERR_PARAMTOOLARGE, - IMGTOOLERR_PARAMNEEDED, - IMGTOOLERR_PARAMNOTNEEDED, - IMGTOOLERR_PARAMCORRUPT, - IMGTOOLERR_BADFILENAME, - IMGTOOLERR_NOSPACE, - IMGTOOLERR_INPUTPASTEND, - IMGTOOLERR_CANNOTUSEPATH, - IMGTOOLERR_INVALIDPATH, - IMGTOOLERR_PATHNOTFOUND, - IMGTOOLERR_DIRNOTEMPTY, - IMGTOOLERR_SEEKERROR, - IMGTOOLERR_NOFORKS, - IMGTOOLERR_FORKNOTFOUND, - IMGTOOLERR_INVALIDPARTITION -}; - - - -/* These error codes are actually modifiers that make it easier to distinguish - * the cause of an error - * - * Note - drivers should not use these modifiers - */ -#define IMGTOOLERR_SRC_MODULE 0x1000 -#define IMGTOOLERR_SRC_FUNCTIONALITY 0x2000 -#define IMGTOOLERR_SRC_IMAGEFILE 0x3000 -#define IMGTOOLERR_SRC_FILEONIMAGE 0x4000 -#define IMGTOOLERR_SRC_NATIVEFILE 0x5000 - -#define ERRORCODE(err) ((err) & 0x0fff) -#define ERRORSOURCE(err) ((err) & 0xf000) -#define ERRORPARAM(err) (((err) & 0xf0000) / 0x10000) - -#define PARAM_TO_ERROR(errcode, param) ((errcode) | ((param) * 0x10000)) - - -const char *imgtool_error(imgtoolerr_t err); - -#endif /* IMGTERRS_H */ diff --git a/src/mess/tools/imgtool/imgtool.c b/src/mess/tools/imgtool/imgtool.c deleted file mode 100644 index df44a9bbff2..00000000000 --- a/src/mess/tools/imgtool/imgtool.c +++ /dev/null @@ -1,2814 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - imgtool.c - - Core code for Imgtool - -***************************************************************************/ - -#include -#include - -#include "imgtool.h" -#include "formats/imageutl.h" -#include "library.h" -#include "modules.h" -#include "pool.h" - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -struct imgtool_image -{ - const imgtool_module *module; - object_pool *pool; -}; - -struct imgtool_partition -{ - imgtool_image *image; - object_pool *pool; - int partition_index; - UINT64 base_block; - UINT64 block_count; - - imgtool_class imgclass; - size_t partition_extra_bytes; - size_t directory_extra_bytes; - - char path_separator; - char alternate_path_separator; - - unsigned int prefer_ucase : 1; - unsigned int supports_creation_time : 1; - unsigned int supports_lastmodified_time : 1; - unsigned int supports_bootblock : 1; /* this module supports loading/storing the boot block */ - - imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path); - imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent); - void (*close_enum) (imgtool_directory *enumeration); - imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size); - imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); - imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts); - imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename); - imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len); - imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path); - imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path); - imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len); - imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values); - imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values); - imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len); - imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo); - imgtoolerr_t (*suggest_transfer)(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length); - imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size); - - const option_guide *writefile_optguide; - const char *writefile_optspec; -}; - -struct imgtool_directory -{ - imgtool_partition *partition; -}; - - - -/*************************************************************************** - GLOBALS -***************************************************************************/ - -static imgtool_library *global_imgtool_library; - -static int global_omit_untested; -static void (*global_warn)(const char *message); - - -void CLIB_DECL ATTR_PRINTF(1,2) logerror(const char *format, ...) -{ - va_list arg; - va_start(arg, format); - vprintf(format, arg); - va_end(arg); -} - -/*************************************************************************** - - Imgtool initialization and basics - -***************************************************************************/ -void rtrim(char *buf) -{ - size_t buflen; - char *s; - - buflen = strlen(buf); - if (buflen) - { - for (s = &buf[buflen-1]; s >= buf && (*s >= '\0') && isspace(*s); s--) - *s = '\0'; - } -} - -char *strncpyz(char *dest, const char *source, size_t len) -{ - char *s; - if (len) { - s = strncpy(dest, source, len - 1); - dest[len-1] = '\0'; - } - else { - s = dest; - } - return s; -} - -char *strncatz(char *dest, const char *source, size_t len) -{ - size_t l; - l = strlen(dest); - dest += l; - if (len > l) - len -= l; - else - len = 0; - return strncpyz(dest, source, len); -} - -/*------------------------------------------------- - markerrorsource - marks where an error source --------------------------------------------------*/ - -static imgtoolerr_t markerrorsource(imgtoolerr_t err) -{ - switch(err) - { - case IMGTOOLERR_OUTOFMEMORY: - case IMGTOOLERR_UNEXPECTED: - case IMGTOOLERR_BUFFERTOOSMALL: - /* Do nothing */ - break; - - case IMGTOOLERR_FILENOTFOUND: - case IMGTOOLERR_BADFILENAME: - err = (imgtoolerr_t)(err | IMGTOOLERR_SRC_FILEONIMAGE); - break; - - default: - err = (imgtoolerr_t)(err | IMGTOOLERR_SRC_IMAGEFILE); - break; - } - return err; -} - -char *imgtool_basename(char *filename) -{ - char *c; - - // NULL begets NULL - if (!filename) - return NULL; - - // start at the end and return when we hit a slash or colon - for (c = filename + strlen(filename) - 1; c >= filename; c--) - if (*c == '\\' || *c == '/' || *c == ':') - return c + 1; - - // otherwise, return the whole thing - return filename; -} - -/*------------------------------------------------- - internal_error - debug function for raising - internal errors --------------------------------------------------*/ - -static void internal_error(const imgtool_module *module, const char *message) -{ -#ifdef MAME_DEBUG - printf("%s: %s\n", module->name, message); -#endif -} - - -/*------------------------------------------------- - normalize_filename - convert a filename to the - native format used by the module --------------------------------------------------*/ - -static char *normalize_filename(imgtool_partition *partition, const char *src) -{ - imgtool_charset charset; - - /* get charset from module */ - charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); - - /* and dupe it */ - return native_from_utf8(charset, src); -} - - - -/*------------------------------------------------- - imgtool_init - initializes the imgtool core --------------------------------------------------*/ - -void imgtool_init(int omit_untested, void (*warn)(const char *message)) -{ - imgtoolerr_t err; - err = imgtool_create_cannonical_library(omit_untested, &global_imgtool_library); - assert(err == IMGTOOLERR_SUCCESS); - if (err == IMGTOOLERR_SUCCESS) - { - imgtool_library_sort(global_imgtool_library, ITLS_DESCRIPTION); - } - global_omit_untested = omit_untested; - global_warn = warn; -} - - - -/*------------------------------------------------- - imgtool_exit - closes out the imgtool core --------------------------------------------------*/ - -void imgtool_exit(void) -{ - if (global_imgtool_library) - { - imgtool_library_close(global_imgtool_library); - global_imgtool_library = NULL; - } - global_warn = NULL; -} - - - -/*------------------------------------------------- - imgtool_find_module - looks up a module --------------------------------------------------*/ - -const imgtool_module *imgtool_find_module(const char *modulename) -{ - return imgtool_library_findmodule(global_imgtool_library, modulename); -} - - - -/*------------------------------------------------- - imgtool_get_module_features - retrieves a - structure identifying this module's features - associated with an image --------------------------------------------------*/ - -imgtool_module_features imgtool_get_module_features(const imgtool_module *module) -{ - imgtool_module_features features; - memset(&features, 0, sizeof(features)); - - if (module->create) - features.supports_create = 1; - if (module->open) - features.supports_open = 1; - if (module->read_sector) - features.supports_readsector = 1; - if (module->write_sector) - features.supports_writesector = 1; - return features; -} - - - -/*------------------------------------------------- - imgtool_warn - issues a warning --------------------------------------------------*/ - -void imgtool_warn(const char *format, ...) -{ - va_list va; - char buffer[2000]; - - if (global_warn) - { - va_start(va, format); - vsprintf(buffer, format, va); - va_end(va); - global_warn(buffer); - } -} - - - -/*------------------------------------------------- - evaluate_module - evaluates a single file to - determine what module can best handle a file --------------------------------------------------*/ - -static imgtoolerr_t evaluate_module(const char *fname, - const imgtool_module *module, float *result) -{ - imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - imgtool_directory *imageenum = NULL; - imgtool_dirent ent; - float current_result; - - *result = 0.0; - - err = imgtool_image_open(module, fname, OSD_FOPEN_READ, &image); - if (err) - goto done; - - if (image) - { - current_result = module->open_is_strict ? 0.9 : 0.5; - - err = imgtool_partition_open(image, 0, &partition); - if (err) - goto done; - - err = imgtool_directory_open(partition, NULL, &imageenum); - if (err) - goto done; - - memset(&ent, 0, sizeof(ent)); - do - { - err = imgtool_directory_get_next(imageenum, &ent); - if (err) - goto done; - - if (ent.corrupt) - current_result = (current_result * 99 + 1.00f) / 100; - else - current_result = (current_result + 1.00f) / 2; - } - while(!ent.eof); - - *result = current_result; - } - -done: - if (ERRORCODE(err) == IMGTOOLERR_CORRUPTIMAGE) - err = IMGTOOLERR_SUCCESS; - if (imageenum) - imgtool_directory_close(imageenum); - if (partition) - imgtool_partition_close(partition); - if (image) - imgtool_image_close(image); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_image - retrieves the image - associated with this partition --------------------------------------------------*/ - -imgtool_image *imgtool_partition_image(imgtool_partition *partition) -{ - return partition->image; -} - - - -/*------------------------------------------------- - imgtool_identify_file - attempts to determine the module - for any given image --------------------------------------------------*/ - -imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules, size_t count) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - imgtool_library *library = global_imgtool_library; - imgtool_module *module = NULL; - imgtool_module *insert_module; - imgtool_module *temp_module; - size_t i = 0; - const char *extension; - float val, temp_val, *values = NULL; - - if (count <= 0) - { - err = IMGTOOLERR_UNEXPECTED; - goto done; - } - - for (i = 0; i < count; i++) - modules[i] = NULL; - if (count > 1) - count--; /* null terminate */ - - values = (float *) malloc(count * sizeof(*values)); - if (!values) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - for (i = 0; i < count; i++) - values[i] = 0.0; - - /* figure out the file extension, if any */ - extension = strrchr(fname, '.'); - if (extension) - extension++; - - /* iterate through all modules */ - while((module = imgtool_library_iterate(library, module)) != NULL) - { - if (!extension || image_find_extension(module->extensions, extension)) - { - err = evaluate_module(fname, module, &val); - if (err) - goto done; - - insert_module = module; - for (i = 0; (val > 0.0f) && (i < count); i++) - { - if (val > values[i]) - { - temp_val = values[i]; - temp_module = modules[i]; - values[i] = val; - modules[i] = insert_module; - val = temp_val; - insert_module = temp_module; - } - } - } - } - - if (!modules[0]) - err = (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_IMAGEFILE); - -done: - if (values) - free(values); - return err; -} - - - -/*------------------------------------------------- - imgtool_image_get_sector_size - gets the size - of a particular sector on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_get_sector_size(imgtool_image *image, UINT32 track, UINT32 head, - UINT32 sector, UINT32 *length) -{ - /* implemented? */ - if (!image->module->get_sector_size) - return (imgtoolerr_t )(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - return image->module->get_sector_size(image, track, head, sector, length); -} - - - -/*------------------------------------------------- - imgtool_image_get_geometry - gets the geometry - of an image; note that this may disagree with - particular sectors; this is a common copy - protection scheme --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors) -{ - UINT32 dummy; - - /* some sanitization, to make the callbacks easier to implement */ - if (!tracks) - tracks = &dummy; - if (!heads) - heads = &dummy; - if (!sectors) - sectors = &dummy; - *tracks = 0; - *heads = 0; - *sectors = 0; - - /* implemented? */ - if (!image->module->get_geometry) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - return image->module->get_geometry(image, tracks, heads, sectors); -} - - - -/*------------------------------------------------- - imgtool_image_read_sector - reads a sector on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_read_sector(imgtool_image *image, UINT32 track, UINT32 head, - UINT32 sector, void *buffer, size_t len) -{ - /* implemented? */ - if (!image->module->read_sector) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - return image->module->read_sector(image, track, head, sector, buffer, len); -} - - - -/*------------------------------------------------- - imgtool_image_write_sector - writes a sector on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_write_sector(imgtool_image *image, UINT32 track, UINT32 head, - UINT32 sector, const void *buffer, size_t len) -{ - /* implemented? */ - if (!image->module->write_sector) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - return image->module->write_sector(image, track, head, sector, buffer, len); -} - - - -/*------------------------------------------------- - imgtool_image_get_block_size - gets the size of - a standard block on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_get_block_size(imgtool_image *image, UINT32 *length) -{ - /* implemented? */ - if (image->module->block_size == 0) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - *length = image->module->block_size; - return IMGTOOLERR_SUCCESS; -} - - - -/*------------------------------------------------- - imgtool_image_read_block - reads a standard - block on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_read_block(imgtool_image *image, UINT64 block, void *buffer) -{ - /* implemented? */ - if (!image->module->read_block) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - return image->module->read_block(image, buffer, block); -} - - - -/*------------------------------------------------- - imgtool_image_write_block - writes a standard - block on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_write_block(imgtool_image *image, UINT64 block, const void *buffer) -{ - /* implemented? */ - if (!image->module->write_block) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - return image->module->write_block(image, buffer, block); -} - - - -/*------------------------------------------------- - imgtool_image_clear_block - clears a standard - block on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_clear_block(imgtool_image *image, UINT64 block, UINT8 data) -{ - imgtoolerr_t err; - UINT8 *block_data = NULL; - UINT32 length; - - err = imgtool_image_get_block_size(image, &length); - if (err) - goto done; - - block_data = (UINT8*)malloc(length); - if (!block_data) - { - err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; - goto done; - } - memset(block_data, data, length); - - err = imgtool_image_write_block(image, block, block_data); - if (err) - goto done; - -done: - if (block_data) - free(block_data); - return err; -} - - - -/*------------------------------------------------- - imgtool_image_list_partitions - lists the - partitions on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_list_partitions(imgtool_image *image, imgtool_partition_info *partitions, size_t len) -{ - /* implemented? */ - if (!image->module->list_partitions) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - memset(partitions, '\0', sizeof(*partitions) * len); - return image->module->list_partitions(image, partitions, len); -} - - - -/*------------------------------------------------- - imgtool_image_malloc - allocates memory associated with an - image --------------------------------------------------*/ - -void *imgtool_image_malloc(imgtool_image *image, size_t size) -{ - return pool_malloc_lib(image->pool, size); -} - - - -/*------------------------------------------------- - imgtool_image_module - returns the module associated with - this image --------------------------------------------------*/ - -const imgtool_module *imgtool_image_module(imgtool_image *img) -{ - return img->module; -} - - - -/*------------------------------------------------- - imgtool_image_extra_bytes - returns extra bytes on an image --------------------------------------------------*/ - -void *imgtool_image_extra_bytes(imgtool_image *image) -{ - void *ptr = NULL; - if (image->module->image_extra_bytes > 0) - ptr = ((UINT8 *) image) + sizeof(*image); - assert(ptr); - return ptr; -} - - - -/*------------------------------------------------- - imgtool_image_rand - returns a random number --------------------------------------------------*/ - -UINT64 imgtool_image_rand(imgtool_image *image) -{ - /* we can't use mame_rand() here */ -#ifdef rand -#undef rand -#endif - return ((UINT64) rand()) << 32 - | ((UINT64) rand()) << 0; -} - - - -/*************************************************************************** - - Imgtool partition management - -***************************************************************************/ - -static char *pool_strdup_allow_null(object_pool *pool, char *s) -{ - return s ? pool_strdup_lib(pool, s) : NULL; -} - - - -imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, imgtool_partition **partition) -{ - imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; - imgtool_partition *p = NULL; - imgtool_class imgclass; - imgtool_partition_info partition_info[32]; - UINT64 base_block, block_count; - size_t partition_extra_bytes; - object_pool *pool; - imgtoolerr_t (*open_partition)(imgtool_partition *partition, UINT64 first_block, UINT64 block_count); - - if (image->module->list_partitions) - { - /* this image supports partitions */ - if ((partition_index < 0) || (partition_index >= ARRAY_LENGTH(partition_info))) - return IMGTOOLERR_INVALIDPARTITION; - - /* retrieve the info on the partitions */ - memset(partition_info, '\0', sizeof(partition_info)); - err = image->module->list_partitions(image, partition_info, ARRAY_LENGTH(partition_info)); - if (err) - return err; - - /* is this a valid partition */ - if (!partition_info[partition_index].get_info) - return IMGTOOLERR_INVALIDPARTITION; - - /* use this partition */ - memset(&imgclass, 0, sizeof(imgclass)); - imgclass.get_info = partition_info[partition_index].get_info; - base_block = partition_info[partition_index].base_block; - block_count = partition_info[partition_index].block_count; - } - else - { - /* this image does not support partitions */ - if (partition_index != 0) - return IMGTOOLERR_INVALIDPARTITION; - - /* identify the image class */ - imgclass = imgtool_image_module(image)->imgclass; - base_block = 0; - block_count = ~0; - } - - /* does this partition type have extra bytes? */ - partition_extra_bytes = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES); - - /* allocate the new memory pool */ - pool = pool_alloc_lib(NULL); - if (!pool) - { - err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - /* allocate the new partition object */ - p = (imgtool_partition *) pool_malloc_lib(pool, sizeof(*p) + partition_extra_bytes); - if (!p) - { - err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; - goto done; - } - memset(p, 0, sizeof(*p) + partition_extra_bytes); - p->pool = pool; - - /* fill out the structure */ - p->image = image; - p->partition_index = partition_index; - p->base_block = base_block; - p->block_count = block_count; - p->imgclass = imgclass; - p->partition_extra_bytes = partition_extra_bytes; - p->directory_extra_bytes = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES); - p->path_separator = (char) imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PATH_SEPARATOR); - p->alternate_path_separator = (char) imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR); - p->prefer_ucase = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PREFER_UCASE) ? 1 : 0; - p->supports_creation_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME) ? 1 : 0; - p->supports_lastmodified_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME) ? 1 : 0; - p->supports_bootblock = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK) ? 1 : 0; - p->begin_enum = (imgtoolerr_t (*)(imgtool_directory *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_BEGIN_ENUM); - p->next_enum = (imgtoolerr_t (*)(imgtool_directory *, imgtool_dirent *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_NEXT_ENUM); - p->free_space = (imgtoolerr_t (*)(imgtool_partition *, UINT64 *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_FREE_SPACE); - p->read_file = (imgtoolerr_t (*)(imgtool_partition *, const char *, const char *, imgtool_stream *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_READ_FILE); - p->write_file = (imgtoolerr_t (*)(imgtool_partition *, const char *, const char *, imgtool_stream *, option_resolution *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_WRITE_FILE); - p->delete_file = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_DELETE_FILE); - p->list_forks = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_forkent *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_LIST_FORKS); - p->create_dir = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CREATE_DIR); - p->delete_dir = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_DELETE_DIR); - p->list_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, UINT32 *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_LIST_ATTRS); - p->get_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, const UINT32 *, imgtool_attribute *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_ATTRS); - p->set_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, const UINT32 *, const imgtool_attribute *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_SET_ATTRS); - p->attr_name = (imgtoolerr_t (*)(UINT32, const imgtool_attribute *, char *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_ATTR_NAME); - p->get_iconinfo = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_iconinfo *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_ICON_INFO); - p->suggest_transfer = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_transfer_suggestion *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_SUGGEST_TRANSFER); - p->get_chain = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_chainent *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_CHAIN); - p->writefile_optguide = (const option_guide *) imgtool_get_info_ptr(&imgclass, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE); - p->writefile_optspec = pool_strdup_allow_null(p->pool, (char*)imgtool_get_info_ptr(&imgclass, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC)); - - /* mask out if writing is untested */ - if (global_omit_untested && imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED)) - { - p->write_file = NULL; - p->delete_file = NULL; - p->create_dir = NULL; - p->delete_dir = NULL; - p->writefile_optguide = NULL; - p->writefile_optspec = NULL; - } - - /* call the partition open function, if present */ - open_partition = (imgtoolerr_t (*)(imgtool_partition *, UINT64, UINT64)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_OPEN_PARTITION); - if (open_partition) - { - /* we have an open partition function */ - err = (*open_partition)(p, base_block, block_count); - if (err) - goto done; - } - -done: - *partition = err ? NULL : p; - return err; -} - - - -void imgtool_partition_close(imgtool_partition *partition) -{ - pool_free_lib(partition->pool); -} - - - -/*************************************************************************** - - Imgtool partition operations - -***************************************************************************/ - -/*------------------------------------------------- - imgtool_partition_get_attribute_name - retrieves the human readable - name for an attribute --------------------------------------------------*/ - -void imgtool_partition_get_attribute_name(imgtool_partition *partition, UINT32 attribute, const imgtool_attribute *attr_value, - char *buffer, size_t buffer_len) -{ - imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_UNIMPLEMENTED; - - buffer[0] = '\0'; - - if (attr_value) - { - if (partition->attr_name) - err = partition->attr_name(attribute, attr_value, buffer, buffer_len); - - if (err == (imgtoolerr_t)IMGTOOLERR_UNIMPLEMENTED) - { - switch(attribute & 0xF0000) - { - case IMGTOOLATTR_INT_FIRST: - snprintf(buffer, buffer_len, "%d", (int) attr_value->i); - break; - } - } - } - else - { - switch(attribute) - { - case IMGTOOLATTR_INT_MAC_TYPE: - snprintf(buffer, buffer_len, "File type"); - break; - case IMGTOOLATTR_INT_MAC_CREATOR: - snprintf(buffer, buffer_len, "File creator"); - break; - case IMGTOOLATTR_INT_MAC_FINDERFLAGS: - snprintf(buffer, buffer_len, "Finder flags"); - break; - case IMGTOOLATTR_INT_MAC_COORDX: - snprintf(buffer, buffer_len, "X coordinate"); - break; - case IMGTOOLATTR_INT_MAC_COORDY: - snprintf(buffer, buffer_len, "Y coordinate"); - break; - case IMGTOOLATTR_INT_MAC_FINDERFOLDER: - snprintf(buffer, buffer_len, "Finder folder"); - break; - case IMGTOOLATTR_INT_MAC_ICONID: - snprintf(buffer, buffer_len, "Icon ID"); - break; - case IMGTOOLATTR_INT_MAC_SCRIPTCODE: - snprintf(buffer, buffer_len, "Script code"); - break; - case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: - snprintf(buffer, buffer_len, "Extended flags"); - break; - case IMGTOOLATTR_INT_MAC_COMMENTID: - snprintf(buffer, buffer_len, "Comment ID"); - break; - case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: - snprintf(buffer, buffer_len, "Putaway directory"); - break; - case IMGTOOLATTR_TIME_CREATED: - snprintf(buffer, buffer_len, "Creation time"); - break; - case IMGTOOLATTR_TIME_LASTMODIFIED: - snprintf(buffer, buffer_len, "Last modified time"); - break; - } - } -} - - - -/*------------------------------------------------- - imgtool_validitychecks - checks the validity - of the imgtool modules --------------------------------------------------*/ - -int imgtool_validitychecks(void) -{ - int error = 0; - int val; - imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; - const imgtool_module *module = NULL; - const option_guide *guide_entry; - imgtool_module_features features; - int created_library = FALSE; - - if (!global_imgtool_library) - { - imgtool_init(FALSE, NULL); - created_library = TRUE; - } - - while((module = imgtool_library_iterate(global_imgtool_library, module)) != NULL) - { - features = imgtool_get_module_features(module); - - if (!module->name) - { - printf("imgtool module %s has null 'name'\n", module->name); - error = 1; - } - if (!module->description) - { - printf("imgtool module %s has null 'description'\n", module->name); - error = 1; - } - if (!module->extensions) - { - printf("imgtool module %s has null 'extensions'\n", module->extensions); - error = 1; - } - -#if 0 - /* sanity checks on modules that do not support directories */ - if (!module->path_separator) - { - if (module->alternate_path_separator) - { - printf("imgtool module %s specified alternate_path_separator but not path_separator\n", module->name); - error = 1; - } - if (module->initial_path_separator) - { - printf("imgtool module %s specified initial_path_separator without directory support\n", module->name); - error = 1; - } - if (module->create_dir) - { - printf("imgtool module %s implements create_dir without directory support\n", module->name); - error = 1; - } - if (module->delete_dir) - { - printf("imgtool module %s implements delete_dir without directory support\n", module->name); - error = 1; - } - } -#endif - - /* sanity checks on sector operations */ - if (module->read_sector && !module->get_sector_size) - { - printf("imgtool module %s implements read_sector without supporting get_sector_size\n", module->name); - error = 1; - } - if (module->write_sector && !module->get_sector_size) - { - printf("imgtool module %s implements write_sector without supporting get_sector_size\n", module->name); - error = 1; - } - - /* sanity checks on creation options */ - if (module->createimage_optguide || module->createimage_optspec) - { - if (!module->create) - { - printf("imgtool module %s has creation options without supporting create\n", module->name); - error = 1; - } - if ((!module->createimage_optguide && module->createimage_optspec) - || (module->createimage_optguide && !module->createimage_optspec)) - { - printf("imgtool module %s does has partially incomplete creation options\n", module->name); - error = 1; - } - - if (module->createimage_optguide && module->createimage_optspec) - { - guide_entry = module->createimage_optguide; - while(guide_entry->option_type != OPTIONTYPE_END) - { - if (option_resolution_contains(module->createimage_optspec, guide_entry->parameter)) - { - switch(guide_entry->option_type) - { - case OPTIONTYPE_INT: - case OPTIONTYPE_ENUM_BEGIN: - err = (imgtoolerr_t)option_resolution_getdefault(module->createimage_optspec, - guide_entry->parameter, &val); - if (err) - goto done; - break; - - default: - break; - } - if (!guide_entry->identifier) - { - printf("imgtool module %s creation option %d has null identifier\n", - module->name, (int) (guide_entry - module->createimage_optguide)); - error = 1; - } - if (!guide_entry->display_name) - { - printf("imgtool module %s creation option %d has null display_name\n", - module->name, (int) (guide_entry - module->createimage_optguide)); - error = 1; - } - } - guide_entry++; - } - } - } - } - -done: - if (created_library) - imgtool_exit(); - if (err) - { - printf("imgtool: %s\n", imgtool_error(err)); - error = 1; - } - return error; -} - - - -/*------------------------------------------------- - imgtool_temp_str - provides a temporary string - buffer used for string passing --------------------------------------------------*/ - -char *imgtool_temp_str(void) -{ - static int index; - static char temp_string_pool[32][256]; - return temp_string_pool[index++ % ARRAY_LENGTH(temp_string_pool)]; -} - - - -/*************************************************************************** - - Image handling functions - -***************************************************************************/ - -static imgtoolerr_t internal_open(const imgtool_module *module, const char *fname, - int read_or_write, option_resolution *createopts, imgtool_image **outimg) -{ - imgtoolerr_t err; - imgtool_stream *f = NULL; - imgtool_image *image = NULL; - object_pool *pool = NULL; - size_t size; - - if (outimg) - *outimg = NULL; - - /* is the requested functionality implemented? */ - if ((read_or_write == OSD_FOPEN_RW_CREATE) ? !module->create : !module->open) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - /* create a memory pool */ - pool = pool_alloc_lib(NULL); - if (!pool) - { - err = (imgtoolerr_t)(IMGTOOLERR_OUTOFMEMORY); - goto done; - } - - /* open the stream */ - f = stream_open(fname, read_or_write); - if (!f) - { - err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_IMAGEFILE); - goto done; - } - - /* setup the image structure */ - size = sizeof(imgtool_image) + module->image_extra_bytes; - image = (imgtool_image *) pool_malloc_lib(pool, size); - if (!image) - { - err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; - goto done; - } - memset(image, '\0', size); - image->pool = pool; - image->module = module; - - /* actually call create or open */ - if (read_or_write == OSD_FOPEN_RW_CREATE) - err = module->create(image, f, createopts); - else - err = module->open(image, f); - if (err) - { - err = markerrorsource(err); - goto done; - } - -done: - if (err) - { - if (f) - stream_close(f); - if (pool) - pool_free_lib(pool); - image = NULL; - } - - if (outimg) - *outimg = image; - else if (image) - imgtool_image_close(image); - return err; -} - - - -/*------------------------------------------------- - imgtool_image_open - open an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_open(const imgtool_module *module, const char *fname, int read_or_write, imgtool_image **outimg) -{ - read_or_write = read_or_write ? OSD_FOPEN_RW : OSD_FOPEN_READ; - return internal_open(module, fname, read_or_write, NULL, outimg); -} - - - -/*------------------------------------------------- - imgtool_image_open_byname - open an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_open_byname(const char *modulename, const char *fname, int read_or_write, imgtool_image **outimg) -{ - const imgtool_module *module; - - module = imgtool_find_module(modulename); - if (!module) - return (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); - - return imgtool_image_open(module, fname, read_or_write, outimg); -} - - - -/*------------------------------------------------- - imgtool_image_close - close an image --------------------------------------------------*/ - -void imgtool_image_close(imgtool_image *image) -{ - if (image->module->close) - image->module->close(image); - pool_free_lib(image->pool); -} - - - -/*------------------------------------------------- - imgtool_image_create - creates an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_create(const imgtool_module *module, const char *fname, - option_resolution *opts, imgtool_image **image) -{ - imgtoolerr_t err; - option_resolution *alloc_resolution = NULL; - - /* allocate dummy options if necessary */ - if (!opts && module->createimage_optguide) - { - alloc_resolution = option_resolution_create(module->createimage_optguide, module->createimage_optspec); - if (!alloc_resolution) - { - err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; - goto done; - } - opts = alloc_resolution; - } - if (opts) - option_resolution_finish(opts); - - err = internal_open(module, fname, OSD_FOPEN_RW_CREATE, opts, image); - if (err) - goto done; - -done: - if (alloc_resolution) - option_resolution_close(alloc_resolution); - return err; -} - - - -/*------------------------------------------------- - imgtool_image_create_byname - creates an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_create_byname(const char *modulename, const char *fname, - option_resolution *opts, imgtool_image **image) -{ - const imgtool_module *module; - - module = imgtool_find_module(modulename); - if (!module) - return (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); - - return imgtool_image_create(module, fname, opts, image); -} - - - -/*------------------------------------------------- - imgtool_image_info - returns format specific information - about an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_image_info(imgtool_image *image, char *string, size_t len) -{ - if (len > 0) - { - string[0] = '\0'; - if (image->module->info) - image->module->info(image, string, len); - } - return IMGTOOLERR_SUCCESS; -} - - - -#define PATH_MUSTBEDIR 0x00000001 -#define PATH_LEAVENULLALONE 0x00000002 -#define PATH_CANBEBOOTBLOCK 0x00000004 - -/*------------------------------------------------- - cannonicalize_path - normalizes a path string - into a NUL delimited list --------------------------------------------------*/ - -static imgtoolerr_t cannonicalize_path(imgtool_partition *partition, UINT32 flags, - const char **path, char **alloc_path) -{ - imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; - char *new_path = NULL; - char path_separator, alt_path_separator; - const char *s; - int in_path_separator, i, j; - - path_separator = partition->path_separator; - alt_path_separator = partition->alternate_path_separator; - - /* is this path NULL? if so, is that ignored? */ - if (!*path && (flags & PATH_LEAVENULLALONE)) - goto done; - - /* is this the special filename for bootblocks? */ - if (*path == FILENAME_BOOTBLOCK) - { - if (!(flags & PATH_CANBEBOOTBLOCK)) - err = (imgtoolerr_t)IMGTOOLERR_UNEXPECTED; - else if (!partition->supports_bootblock) - err = (imgtoolerr_t)IMGTOOLERR_FILENOTFOUND; - goto done; - } - - if (path_separator == '\0') - { - if (flags & PATH_MUSTBEDIR) - { - /* do we specify a path when paths are not supported? */ - if (*path && **path) - { - err = (imgtoolerr_t)(IMGTOOLERR_CANNOTUSEPATH | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - *path = NULL; /* normalize empty path */ - } - } - else - { - s = *path ? *path : ""; - - /* allocate space for a new cannonical path */ - new_path = (char*)malloc(strlen(s) + 4); - if (!new_path) - { - err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - /* copy the path */ - in_path_separator = TRUE; - i = j = 0; - do - { - if ((s[i] != '\0') && (s[i] != path_separator) && (s[i] != alt_path_separator)) - { - new_path[j++] = s[i]; - in_path_separator = FALSE; - } - else if (!in_path_separator) - { - new_path[j++] = '\0'; - in_path_separator = TRUE; - } - } - while(s[i++] != '\0'); - new_path[j++] = '\0'; - new_path[j++] = '\0'; - *path = new_path; - } - -done: - *alloc_path = new_path; - return err; -} - - - -static imgtoolerr_t cannonicalize_fork(imgtool_partition *partition, const char **fork) -{ - /* does this module support forks? */ - if (partition->list_forks) - { - /* this module supports forks; make sure that fork is non-NULL */ - if (!*fork) - *fork = ""; - } - else - { - /* this module does not support forks; make sure that fork is NULL */ - if (*fork) - return IMGTOOLERR_NOFORKS; - } - return IMGTOOLERR_SUCCESS; -} - - - -/*------------------------------------------------- - imgtool_partition_get_directory_entry - retrieves - the nth directory entry within a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_directory_entry(imgtool_partition *partition, const char *path, int index, imgtool_dirent *ent) -{ - imgtoolerr_t err; - imgtool_directory *imgenum = NULL; - - if (index < 0) - { - err = (imgtoolerr_t)IMGTOOLERR_PARAMTOOSMALL; - goto done; - } - - err = imgtool_directory_open(partition, path, &imgenum); - if (err) - goto done; - - do - { - err = imgtool_directory_get_next(imgenum, ent); - if (err) - goto done; - - if (ent->eof) - { - err = (imgtoolerr_t)IMGTOOLERR_FILENOTFOUND; - goto done; - } - } - while(index--); - -done: - if (err) - memset(ent->filename, 0, sizeof(ent->filename)); - if (imgenum) - imgtool_directory_close(imgenum); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_get_file_size - returns free - space on a partition, in bytes --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const char *fname, UINT64 *filesize) -{ - imgtoolerr_t err; - imgtool_directory *imgenum; - imgtool_dirent ent; - const char *path; - - path = NULL; /* TODO: Need to parse off the path */ - - *filesize = -1; - memset(&ent, 0, sizeof(ent)); - - err = imgtool_directory_open(partition, path, &imgenum); - if (err) - goto done; - - do - { - err = imgtool_directory_get_next(imgenum, &ent); - if (err) - goto done; - - if (!core_stricmp(fname, ent.filename)) - { - *filesize = ent.filesize; - goto done; - } - } - while(ent.filename[0]); - - err = (imgtoolerr_t)IMGTOOLERR_FILENOTFOUND; - -done: - if (imgenum) - imgtool_directory_close(imgenum); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_list_file_attributes - identifies - all attributes on a file --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; - - memset(attrs, 0, sizeof(*attrs) * len); - - if (!partition->list_attrs) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - new_fname = normalize_filename(partition, path); - if (new_fname == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - path = new_fname; - - /* cannonicalize path */ - err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); - if (err) - goto done; - - err = partition->list_attrs(partition, path, attrs, len); - if (err) - goto done; - -done: - if (alloc_path != NULL) - free(alloc_path); - if (new_fname != NULL) - osd_free(new_fname); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_get_file_attributes - retrieves - attributes on a file --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; - - if (!partition->get_attrs) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - new_fname = normalize_filename(partition, path); - if (new_fname == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - path = new_fname; - - /* cannonicalize path */ - err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); - if (err) - goto done; - - err = partition->get_attrs(partition, path, attrs, values); - if (err) - goto done; - -done: - if (alloc_path != NULL) - free(alloc_path); - if (new_fname != NULL) - osd_free(new_fname); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_put_file_attributes - sets - attributes on a file --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_put_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - - if (!partition->set_attrs) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - /* cannonicalize path */ - err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); - if (err) - goto done; - - err = partition->set_attrs(partition, path, attrs, values); - if (err) - goto done; - -done: - if (alloc_path) - free(alloc_path); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_get_file_attributes - retrieves - an attribute on a single file --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute *value) -{ - UINT32 attrs[2]; - attrs[0] = attr; - attrs[1] = 0; - return imgtool_partition_get_file_attributes(partition, path, attrs, value); -} - - - -/*------------------------------------------------- - imgtool_partition_put_file_attribute - sets - attributes on a single file --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_put_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute value) -{ - UINT32 attrs[2]; - attrs[0] = attr; - attrs[1] = 0; - return imgtool_partition_put_file_attributes(partition, path, attrs, &value); -} - - - -/*------------------------------------------------- - imgtool_partition_get_icon_info - retrieves the - icon for a file stored on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; - - if (!partition->get_iconinfo) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - new_fname = normalize_filename(partition, path); - if (new_fname == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - path = new_fname; - - /* cannonicalize path */ - err = cannonicalize_path(partition, 0, &path, &alloc_path); - if (err) - goto done; - - memset(iconinfo, 0, sizeof(*iconinfo)); - err = partition->get_iconinfo(partition, path, iconinfo); - if (err) - goto done; - -done: - if (alloc_path) - free(alloc_path); - if (new_fname) - osd_free(new_fname); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_suggest_file_filters - suggests - a list of filters appropriate for a file on a - partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition, const char *path, - imgtool_stream *stream, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) -{ - imgtoolerr_t err; - int i, j; - char *alloc_path = NULL; - imgtoolerr_t (*check_stream)(imgtool_stream *stream, imgtool_suggestion_viability_t *viability); - size_t position; - - /* clear out buffer */ - memset(suggestions, 0, sizeof(*suggestions) * suggestions_length); - - if (!partition->suggest_transfer) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - /* cannonicalize path */ - err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path); - if (err) - goto done; - - /* invoke the module's suggest call */ - err = partition->suggest_transfer(partition, path, suggestions, suggestions_length); - if (err) - goto done; - - /* Loop on resulting suggestions, and do the following: - * 1. Call check_stream if present, and remove disqualified streams - * 2. Fill in missing descriptions - */ - i = j = 0; - while(suggestions[i].viability) - { - if (stream && suggestions[i].filter) - { - check_stream = (imgtoolerr_t (*)(imgtool_stream *, imgtool_suggestion_viability_t *)) filter_get_info_fct(suggestions[i].filter, FILTINFO_PTR_CHECKSTREAM); - if (check_stream) - { - position = stream_tell(stream); - err = check_stream(stream, &suggestions[i].viability); - stream_seek(stream, position, SEEK_SET); - if (err) - goto done; - } - } - - /* the check_stream proc can remove the option by clearing out the viability */ - if (suggestions[i].viability) - { - /* we may have to move this suggestion, if one was removed */ - if (i != j) - memcpy(&suggestions[j], &suggestions[i], sizeof(*suggestions)); - - /* if the description is missing, fill it in */ - if (!suggestions[j].description) - { - if (suggestions[j].filter) - suggestions[j].description = filter_get_info_string(suggestions[i].filter, FILTINFO_STR_HUMANNAME); - else - suggestions[j].description = "Raw"; - } - - j++; - } - i++; - } - suggestions[j].viability = (imgtool_suggestion_viability_t)0; - -done: - if (alloc_path) - free(alloc_path); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_get_chain - retrieves the block - chain for a file or directory on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_chain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size) -{ - size_t i; - - assert(chain_size > 0); - - if (!partition->get_chain) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - /* initialize the chain array, so the module's get_chain function can be lazy */ - for (i = 0; i < chain_size; i++) - { - chain[i].level = 0; - chain[i].block = ~0; - } - - return partition->get_chain(partition, path, chain, chain_size - 1); -} - - - -/*------------------------------------------------- - imgtool_partition_get_chain_string - retrieves - the block chain for a file or directory on a - partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_chain_string(imgtool_partition *partition, const char *path, char *buffer, size_t buffer_len) -{ - imgtoolerr_t err; - imgtool_chainent chain[512]; - UINT64 last_block; - UINT8 cur_level = 0; - int len, i; - int comma_needed = FALSE; - - /* determine the last block identifier */ - chain[0].block = ~0; - last_block = chain[0].block; - - err = imgtool_partition_get_chain(partition, path, chain, ARRAY_LENGTH(chain)); - if (err) - return err; - - len = snprintf(buffer, buffer_len, "["); - buffer += len; - buffer_len -= len; - - for (i = 0; chain[i].block != last_block; i++) - { - while(cur_level < chain[i].level) - { - len = snprintf(buffer, buffer_len, " ["); - buffer += len; - buffer_len -= len; - cur_level++; - comma_needed = FALSE; - } - while(cur_level > chain[i].level) - { - len = snprintf(buffer, buffer_len, "]"); - buffer += len; - buffer_len -= len; - cur_level--; - } - - if (comma_needed) - { - len = snprintf(buffer, buffer_len, ", "); - buffer += len; - buffer_len -= len; - } - - len = snprintf(buffer, buffer_len, "%u", (unsigned) chain[i].block); - buffer += len; - buffer_len -= len; - comma_needed = TRUE; - } - - do - { - len = snprintf(buffer, buffer_len, "]"); - buffer += len; - buffer_len -= len; - } - while(cur_level-- > 0); - - return IMGTOOLERR_SUCCESS; -} - - - -/*------------------------------------------------- - imgtool_partition_get_free_space - returns the - amount of free space on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_free_space(imgtool_partition *partition, UINT64 *sz) -{ - imgtoolerr_t err; - UINT64 size; - - if (!partition->free_space) - return (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - - err = partition->free_space(partition, &size); - if (err) - return (imgtoolerr_t)(err | IMGTOOLERR_SRC_IMAGEFILE); - - if (sz) - *sz = size; - return IMGTOOLERR_SUCCESS; -} - - - -/*------------------------------------------------- - imgtool_partition_read_file - starts reading - from a file on a partition with a stream --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - union filterinfo u; - - if (!partition->read_file) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - if (filter) - { - /* use a filter */ - filter(FILTINFO_PTR_READFILE, &u); - if (!u.read_file) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - err = u.read_file(partition, filename, fork, destf); - if (err) - { - err = markerrorsource(err); - goto done; - } - } - else - { - /* cannonicalize path */ - err = cannonicalize_path(partition, PATH_CANBEBOOTBLOCK, &filename, &alloc_path); - if (err) - goto done; - - err = cannonicalize_fork(partition, &fork); - if (err) - goto done; - - /* invoke the actual module */ - err = partition->read_file(partition, filename, fork, destf); - if (err) - { - err = markerrorsource(err); - goto done; - } - } - -done: - if (alloc_path) - free(alloc_path); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_write_file - starts writing - to a new file on an image with a stream --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts, filter_getinfoproc filter) -{ - imgtoolerr_t err; - char *buf = NULL; - char *s; - option_resolution *alloc_resolution = NULL; - char *alloc_path = NULL; - UINT64 free_space; - UINT64 file_size; - union filterinfo u; - - if (!partition->write_file) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - if (filter) - { - /* use a filter */ - filter(FILTINFO_PTR_WRITEFILE, &u); - if (!u.write_file) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - err = u.write_file(partition, filename, fork, sourcef, opts); - if (err) - { - err = markerrorsource(err); - goto done; - } - } - else - { - /* does this partition prefer upper case file names? */ - if (partition->prefer_ucase) - { - buf = (char*)malloc(strlen(filename) + 1); - if (!buf) - { - err = (imgtoolerr_t)(IMGTOOLERR_OUTOFMEMORY); - goto done; - } - strcpy(buf, filename); - for (s = buf; *s; s++) - *s = toupper(*s); - filename = buf; - } - - /* cannonicalize path */ - err = cannonicalize_path(partition, PATH_CANBEBOOTBLOCK, &filename, &alloc_path); - if (err) - goto done; - - err = cannonicalize_fork(partition, &fork); - if (err) - goto done; - - /* allocate dummy options if necessary */ - if (!opts && partition->writefile_optguide) - { - alloc_resolution = option_resolution_create(partition->writefile_optguide, partition->writefile_optspec); - if (!alloc_resolution) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - opts = alloc_resolution; - } - if (opts) - option_resolution_finish(opts); - - /* if free_space is implemented; do a quick check to see if space is available */ - if (partition->free_space) - { - err = partition->free_space(partition, &free_space); - if (err) - { - err = markerrorsource(err); - goto done; - } - - file_size = stream_size(sourcef); - - if (file_size > free_space) - { - err = markerrorsource(IMGTOOLERR_NOSPACE); - goto done; - } - } - - /* actually invoke the write file handler */ - err = partition->write_file(partition, filename, fork, sourcef, opts); - if (err) - { - err = markerrorsource(err); - goto done; - } - } - -done: - if (buf) - free(buf); - if (alloc_path) - free(alloc_path); - if (alloc_resolution) - option_resolution_close(alloc_resolution); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_get_file - read a file from - an image, storing it into a native file --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char *filename, const char *fork, - const char *dest, filter_getinfoproc filter) -{ - imgtoolerr_t err; - imgtool_stream *f; - char *new_fname = NULL; - char *alloc_dest = NULL; - const char *filter_extension = NULL; - - if (!dest) - { - /* determine the filter extension, if appropriate */ - if (filter != NULL) - filter_extension = filter_get_info_string(filter, FILTINFO_STR_EXTENSION); - - if (filter_extension != NULL) - { - alloc_dest = (char*)malloc(strlen(filename) + 1 + strlen(filter_extension) + 1); - if (!alloc_dest) - return IMGTOOLERR_OUTOFMEMORY; - - sprintf(alloc_dest, "%s.%s", filename, filter_extension); - dest = alloc_dest; - } - else - { - if (filename == FILENAME_BOOTBLOCK) - dest = "boot.bin"; - else - dest = filename; - } - } - - f = stream_open(dest, OSD_FOPEN_WRITE); - if (!f) - { - err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE); - goto done; - } - - new_fname = normalize_filename(partition, filename); - if (new_fname == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - err = imgtool_partition_read_file(partition, new_fname, fork, f, filter); - if (err) - goto done; - -done: - if (f != NULL) - stream_close(f); - if (alloc_dest != NULL) - free(alloc_dest); - if (new_fname != NULL) - osd_free(new_fname); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_put_file - read a native file - and store it on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char *newfname, const char *fork, - const char *source, option_resolution *opts, filter_getinfoproc filter) -{ - imgtoolerr_t err; - imgtool_stream *f = NULL; - imgtool_charset charset; - char *alloc_newfname = NULL; - - if (!newfname) - newfname = (const char *) imgtool_basename((char *) source); - - charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); - if (charset != IMGTOOL_CHARSET_UTF8) - { - /* convert to native format */ - alloc_newfname = native_from_utf8(charset, newfname); - if (alloc_newfname == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_NATIVEFILE); - goto done; - } - - newfname = alloc_newfname; - } - - f = stream_open(source, OSD_FOPEN_READ); - if (f) - err = imgtool_partition_write_file(partition, newfname, fork, f, opts, filter); - else - err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE); - -done: - /* clean up */ - if (f != NULL) - stream_close(f); - if (alloc_newfname != NULL) - osd_free(alloc_newfname); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_delete_file - delete a file - on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const char *fname) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; - - if (!partition->delete_file) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - new_fname = normalize_filename(partition, fname); - if (new_fname == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - fname = new_fname; - - /* cannonicalize path */ - err = cannonicalize_path(partition, 0, &fname, &alloc_path); - if (err) - goto done; - - err = partition->delete_file(partition, fname); - if (err) - { - err = markerrorsource(err); - goto done; - } - -done: - if (alloc_path) - free(alloc_path); - if (new_fname) - osd_free(new_fname); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_list_file_forks - lists all - forks on an image --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - char *new_fname = NULL; - - if (!partition->list_forks) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - new_fname = normalize_filename(partition, path); - if (new_fname == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - path = new_fname; - - /* cannonicalize path */ - err = cannonicalize_path(partition, 0, &path, &alloc_path); - if (err) - goto done; - - err = partition->list_forks(partition, path, ents, len); - if (err) - goto done; - -done: - if (alloc_path) - free(alloc_path); - if (new_fname) - osd_free(new_fname); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_create_directory - creates a - directory on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, const char *path) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - char *new_path = NULL; - - /* implemented? */ - if (!partition->create_dir) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - new_path = normalize_filename(partition, path); - if (new_path == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - path = new_path; - - /* cannonicalize path */ - err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); - if (err) - goto done; - - err = partition->create_dir(partition, path); - if (err) - goto done; - -done: - if (alloc_path) - free(alloc_path); - if (new_path) - osd_free(new_path); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_delete_directory - deletes a - directory on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, const char *path) -{ - imgtoolerr_t err; - char *alloc_path = NULL; - char *new_path = NULL; - - /* implemented? */ - if (!partition->delete_dir) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - new_path = normalize_filename(partition, path); - if (new_path == NULL) - { - err = (imgtoolerr_t)(IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - path = new_path; - - /* cannonicalize path */ - err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); - if (err) - goto done; - - err = partition->delete_dir(partition, path); - if (err) - goto done; - -done: - if (alloc_path) - free(alloc_path); - if (new_path) - osd_free(new_path); - return err; -} - - - -/*------------------------------------------------- - imgtool_partition_get_block_size - gets the - size of a standard block on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_get_block_size(imgtool_partition *partition, UINT32 *length) -{ - return imgtool_image_get_block_size(partition->image, length); -} - - - -/*------------------------------------------------- - imgtool_partition_read_block - reads a standard - block on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_read_block(imgtool_partition *partition, UINT64 block, void *buffer) -{ - if (block >= partition->block_count) - return IMGTOOLERR_SEEKERROR; - return imgtool_image_read_block(partition->image, block + partition->base_block, buffer); -} - - - -/*------------------------------------------------- - imgtool_partition_write_block - writes a - standard block on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_partition_write_block(imgtool_partition *partition, UINT64 block, const void *buffer) -{ - if (block >= partition->block_count) - return IMGTOOLERR_SEEKERROR; - return imgtool_image_write_block(partition->image, block + partition->base_block, buffer); -} - - - -/*------------------------------------------------- - imgtool_partition_get_features - retrieves a - structure identifying this partition's features - associated with an image --------------------------------------------------*/ - -imgtool_partition_features imgtool_partition_get_features(imgtool_partition *partition) -{ - imgtool_partition_features features; - memset(&features, 0, sizeof(features)); - - if (partition->read_file) - features.supports_reading = 1; - if (partition->write_file) - features.supports_writing = 1; - if (partition->delete_file) - features.supports_deletefile = 1; - if (partition->path_separator) - features.supports_directories = 1; - if (partition->free_space) - features.supports_freespace = 1; - if (partition->create_dir) - features.supports_createdir = 1; - if (partition->delete_dir) - features.supports_deletedir = 1; - if (partition->supports_creation_time) - features.supports_creation_time = 1; - if (partition->supports_lastmodified_time) - features.supports_lastmodified_time = 1; - if (!features.supports_writing && !features.supports_createdir && !features.supports_deletefile && !features.supports_deletedir) - features.is_read_only = 1; - return features; -} - - - -/*------------------------------------------------- - imgtool_partition_get_info_ptr - retrieves a - pointer associated with a partition's format --------------------------------------------------*/ - -void *imgtool_partition_get_info_ptr(imgtool_partition *partition, UINT32 state) -{ - return imgtool_get_info_ptr(&partition->imgclass, state); -} - - - -/*------------------------------------------------- - imgtool_partition_get_info_string - retrieves a - string associated with a partition's format --------------------------------------------------*/ - -const char *imgtool_partition_get_info_string(imgtool_partition *partition, UINT32 state) -{ - return imgtool_get_info_string(&partition->imgclass, state); -} - - - -/*------------------------------------------------- - imgtool_partition_get_info_int - retrieves a - pointer associated with a partition's format --------------------------------------------------*/ - -UINT64 imgtool_partition_get_info_int(imgtool_partition *partition, UINT32 state) -{ - return imgtool_get_info_int(&partition->imgclass, state); -} - - - -/*------------------------------------------------- - imgtool_partition_extra_bytes - returns extra - bytes on a partition --------------------------------------------------*/ - -void *imgtool_partition_extra_bytes(imgtool_partition *partition) -{ - void *ptr = NULL; - if (partition->partition_extra_bytes > 0) - ptr = ((UINT8 *) partition) + sizeof(*partition); - assert(ptr); - return ptr; -} - - - -/*------------------------------------------------- - imgtool_partition_rand - returns random number --------------------------------------------------*/ - -UINT64 imgtool_partition_rand(imgtool_partition *partition) -{ - return imgtool_image_rand(partition->image); -} - - - -/*************************************************************************** - - Path handling functions - -***************************************************************************/ - -/*------------------------------------------------- - imgtool_partition_get_root_path - retrieves - the path root of this partition --------------------------------------------------*/ - -const char *imgtool_partition_get_root_path(imgtool_partition *partition) -{ - int initial_path_separator; - char path_separator; - char *buf; - int pos = 0; - - initial_path_separator = imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR) ? 1 : 0; - path_separator = (char) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_PATH_SEPARATOR); - buf = imgtool_temp_str(); - - if (initial_path_separator) - buf[pos++] = path_separator; - buf[pos] = '\0'; - return buf; -} - - - -/*------------------------------------------------- - imgtool_partition_path_concatenate - retrieves - a pointer associated with a partition's format --------------------------------------------------*/ - -const char *imgtool_partition_path_concatenate(imgtool_partition *partition, const char *path1, const char *path2) -{ - char path_separator; - size_t len; - char *buffer; - size_t buffer_len; - - path_separator = (char) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_PATH_SEPARATOR); - len = strlen(path1); - - /* prepare buffer */ - buffer = imgtool_temp_str(); - buffer_len = 256; - - if (!strcmp(path2, ".")) - { - /* keep the same directory */ - snprintf(buffer, buffer_len, "%s", path1); - } - else if (!strcmp(path2, "..")) - { - /* up one directory */ - while((len > 0) && (path1[len - 1] == path_separator)) - len--; - while((len > 0) && (path1[len - 1] != path_separator)) - len--; - while((len > 1) && (path1[len - 1] == path_separator)) - len--; - snprintf(buffer, buffer_len, "%s", path1); - buffer[len] = '\0'; - } - else - { - /* append a path */ - if ((*path1 != 0) && (path1[strlen(path1) - 1] != path_separator)) - snprintf(buffer, buffer_len, "%s%c%s", path1, path_separator, path2); - else - snprintf(buffer, buffer_len, "%s%s", path1, path2); - } - return buffer; -} - - - -/*------------------------------------------------- - imgtool_partition_get_base_name - retrieves - a base name for a partition specific path --------------------------------------------------*/ - -const char *imgtool_partition_get_base_name(imgtool_partition *partition, const char *path) -{ - char path_separator; - const char *new_path = path; - int i; - - path_separator = (char) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_PATH_SEPARATOR); - - for (i = 0; path[i]; i++) - { - if (path[i] == path_separator) - new_path = &path[i + 1]; - } - return new_path; -} - - - -/*************************************************************************** - - Directory handling functions - -***************************************************************************/ - -/*------------------------------------------------- - imgtool_directory_open - begins - enumerating files on a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *path, imgtool_directory **outenum) -{ - imgtoolerr_t err = (imgtoolerr_t)IMGTOOLERR_SUCCESS; - imgtool_directory *enumeration = NULL; - char *alloc_path = NULL; - char *new_path = NULL; - size_t size; - - /* sanity checks */ - assert(partition); - assert(outenum); - - *outenum = NULL; - - if (!partition->next_enum) - { - err = (imgtoolerr_t)(IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY); - goto done; - } - - new_path = normalize_filename(partition, path); - path = new_path; - - err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path); - if (err) - goto done; - - size = sizeof(imgtool_directory) + partition->directory_extra_bytes; - enumeration = (imgtool_directory *) malloc(size); - if (!enumeration) - { - err = (imgtoolerr_t)IMGTOOLERR_OUTOFMEMORY; - goto done; - } - memset(enumeration, '\0', size); - enumeration->partition = partition; - - if (partition->begin_enum) - { - err = partition->begin_enum(enumeration, path); - if (err) - { - err = markerrorsource(err); - goto done; - } - } - -done: - if (alloc_path != NULL) - free(alloc_path); - if (new_path != NULL) - osd_free(new_path); - if (err && (enumeration != NULL)) - { - free(enumeration); - enumeration = NULL; - } - *outenum = enumeration; - return err; -} - - - -/*------------------------------------------------- - imgtool_directory_close - closes a directory --------------------------------------------------*/ - -void imgtool_directory_close(imgtool_directory *directory) -{ - imgtool_partition *partition; - partition = imgtool_directory_partition(directory); - if (partition->close_enum) - partition->close_enum(directory); - free(directory); -} - - - -/*------------------------------------------------- - imgtool_directory_get_next - continues - enumerating files within a partition --------------------------------------------------*/ - -imgtoolerr_t imgtool_directory_get_next(imgtool_directory *directory, imgtool_dirent *ent) -{ - imgtoolerr_t err; - imgtool_partition *partition; - int charset; - - partition = imgtool_directory_partition(directory); - - /* This makes it so that drivers don't have to take care of clearing - * the attributes if they don't apply - */ - memset(ent, 0, sizeof(*ent)); - - err = partition->next_enum(directory, ent); - if (err) - return markerrorsource(err); - - charset = imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); - - if (charset) - { - char *new_fname = utf8_from_native((imgtool_charset)charset, ent->filename); - - if (!new_fname) - return IMGTOOLERR_BADFILENAME; - - strcpy(ent->filename, new_fname); - osd_free(new_fname); - } - - /* don't trust the module! */ - if (!partition->supports_creation_time && (ent->creation_time != 0)) - { - internal_error(NULL, "next_enum() specified creation_time, which is marked as unsupported by this module"); - return IMGTOOLERR_UNEXPECTED; - } - if (!partition->supports_lastmodified_time && (ent->lastmodified_time != 0)) - { - internal_error(NULL, "next_enum() specified lastmodified_time, which is marked as unsupported by this module"); - return IMGTOOLERR_UNEXPECTED; - } - if (!partition->path_separator && ent->directory) - { - internal_error(NULL, "next_enum() returned a directory, which is marked as unsupported by this module"); - return IMGTOOLERR_UNEXPECTED; - } - return IMGTOOLERR_SUCCESS; -} - - - -/*------------------------------------------------- - imgtool_directory_module - returns the module associated - with this directory --------------------------------------------------*/ - -const imgtool_module *imgtool_directory_module(imgtool_directory *directory) -{ - return directory->partition->image->module; -} - - - -/*------------------------------------------------- - imgtool_directory_extrabytes - returns extra - bytes on a directory --------------------------------------------------*/ - -void *imgtool_directory_extrabytes(imgtool_directory *directory) -{ - assert(directory->partition->directory_extra_bytes > 0); - return ((UINT8 *) directory) + sizeof(*directory); -} - - - -/*------------------------------------------------- - imgtool_directory_partition - returns the - partition associated with this directory --------------------------------------------------*/ - -imgtool_partition *imgtool_directory_partition(imgtool_directory *directory) -{ - return directory->partition; -} - - - -/*------------------------------------------------- - imgtool_directory_image - returns the image - associated with this directory --------------------------------------------------*/ - -imgtool_image *imgtool_directory_image(imgtool_directory *directory) -{ - return directory->partition->image; -} - - - -/*------------------------------------------------- - unknown_partition_get_info - represents an - unknown partition --------------------------------------------------*/ - -void unknown_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "unknown"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Unknown partition type"); break; - } -} diff --git a/src/mess/tools/imgtool/imgtool.h b/src/mess/tools/imgtool/imgtool.h deleted file mode 100644 index e688dfb60f1..00000000000 --- a/src/mess/tools/imgtool/imgtool.h +++ /dev/null @@ -1,169 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - imgtool.h - - Main headers for Imgtool core - -***************************************************************************/ - -#ifndef IMGTOOL_H -#define IMGTOOL_H - -#include -#include -#include - -#include "corestr.h" -#include "formats/flopimg.h" -#include "opresolv.h" -#include "library.h" -#include "filter.h" - -/* ----------------------------------------------------------------------- */ - -#define EOLN_CR "\x0d" -#define EOLN_LF "\x0a" -#define EOLN_CRLF "\x0d\x0a" - -#define FILENAME_BOOTBLOCK ((const char *) 1) - -enum -{ - OSD_FOPEN_READ, - OSD_FOPEN_WRITE, - OSD_FOPEN_RW, - OSD_FOPEN_RW_CREATE -}; - -/* --------------------------------------------------------------------------- - * Image calls - * - * These are the calls that front ends should use for manipulating images. You - * should never call the module functions directly because they may not be - * implemented (i.e. - the function pointers are NULL). The img_* functions are - * aware of these issues and will make the appropriate checks as well as - * marking up return codes with the source. In addition, some of the img_* - * calls are high level calls that simply image manipulation - * - * Calls that return 'int' that are not explictly noted otherwise return - * imgtool error codes - * --------------------------------------------------------------------------- - */ - -struct imgtool_module_features -{ - unsigned int supports_create : 1; - unsigned int supports_open : 1; - unsigned int supports_readsector : 1; - unsigned int supports_writesector : 1; - unsigned int is_read_only : 1; -}; - -struct imgtool_partition_features -{ - unsigned int supports_reading : 1; - unsigned int supports_writing : 1; - unsigned int supports_deletefile : 1; - unsigned int supports_directories : 1; - unsigned int supports_freespace : 1; - unsigned int supports_createdir : 1; - unsigned int supports_deletedir : 1; - unsigned int supports_creation_time : 1; - unsigned int supports_lastmodified_time : 1; - unsigned int supports_forks : 1; - unsigned int supports_geticoninfo : 1; - unsigned int is_read_only : 1; -}; - -/* ----- initialization and basics ----- */ -void imgtool_init(int omit_untested, void (*warning)(const char *message)); -void imgtool_exit(void); -const imgtool_module *imgtool_find_module(const char *modulename); -imgtool_module_features imgtool_get_module_features(const imgtool_module *module); -void imgtool_warn(const char *format, ...) ATTR_PRINTF(1,2); -char *imgtool_basename(char *filename); - -/* ----- image management ----- */ -imgtoolerr_t imgtool_identify_file(const char *filename, imgtool_module **modules, size_t count); -imgtoolerr_t imgtool_image_open(const imgtool_module *module, const char *filename, int read_or_write, imgtool_image **outimg); -imgtoolerr_t imgtool_image_open_byname(const char *modulename, const char *filename, int read_or_write, imgtool_image **outimg); -imgtoolerr_t imgtool_image_create(const imgtool_module *module, const char *fname, option_resolution *opts, imgtool_image **image); -imgtoolerr_t imgtool_image_create_byname(const char *modulename, const char *fname, option_resolution *opts, imgtool_image **image); -void imgtool_image_close(imgtool_image *image); -imgtoolerr_t imgtool_image_info(imgtool_image *image, char *string, size_t len); -imgtoolerr_t imgtool_image_get_sector_size(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *length); -imgtoolerr_t imgtool_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors); -imgtoolerr_t imgtool_image_read_sector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len); -imgtoolerr_t imgtool_image_write_sector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len); -imgtoolerr_t imgtool_image_get_block_size(imgtool_image *image, UINT32 *length); -imgtoolerr_t imgtool_image_read_block(imgtool_image *image, UINT64 block, void *buffer); -imgtoolerr_t imgtool_image_write_block(imgtool_image *image, UINT64 block, const void *buffer); -imgtoolerr_t imgtool_image_clear_block(imgtool_image *image, UINT64 block, UINT8 data); -imgtoolerr_t imgtool_image_list_partitions(imgtool_image *image, imgtool_partition_info *partitions, size_t len); -void *imgtool_image_malloc(imgtool_image *image, size_t size); -const imgtool_module *imgtool_image_module(imgtool_image *image); -void *imgtool_image_extra_bytes(imgtool_image *image); -UINT64 imgtool_image_rand(imgtool_image *image); - -/* ----- partition management ----- */ -imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, imgtool_partition **partition); -void imgtool_partition_close(imgtool_partition *partition); -imgtool_image *imgtool_partition_image(imgtool_partition *partition); - -/* ----- partition operations ----- */ -imgtoolerr_t imgtool_partition_get_directory_entry(imgtool_partition *partition, const char *path, int index, imgtool_dirent *ent); -imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const char *filename, UINT64 *filesize); -imgtoolerr_t imgtool_partition_get_free_space(imgtool_partition *partition, UINT64 *sz); -imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter); -imgtoolerr_t imgtool_partition_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *resolution, filter_getinfoproc filter); -imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char *filename, const char *fork, const char *dest, filter_getinfoproc filter); -imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char *newfname, const char *fork, const char *source, option_resolution *opts, filter_getinfoproc filter); -imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const char *fname); -imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len); -imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, const char *path); -imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, const char *path); -imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len); -imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values); -imgtoolerr_t imgtool_partition_put_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values); -imgtoolerr_t imgtool_partition_get_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute *value); -imgtoolerr_t imgtool_partition_put_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute value); -void imgtool_partition_get_attribute_name(imgtool_partition *partition, UINT32 attribute, const imgtool_attribute *attr_value, char *buffer, size_t buffer_len); -imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo); -imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition, const char *path, imgtool_stream *stream, imgtool_transfer_suggestion *suggestions, size_t suggestions_length); -imgtoolerr_t imgtool_partition_get_block_size(imgtool_partition *partition, UINT32 *length); -imgtoolerr_t imgtool_partition_read_block(imgtool_partition *partition, UINT64 block, void *buffer); -imgtoolerr_t imgtool_partition_write_block(imgtool_partition *partition, UINT64 block, const void *buffer); -imgtoolerr_t imgtool_partition_get_chain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size); -imgtoolerr_t imgtool_partition_get_chain_string(imgtool_partition *partition, const char *path, char *buffer, size_t buffer_len); -imgtool_partition_features imgtool_partition_get_features(imgtool_partition *partition); -void * imgtool_partition_get_info_ptr(imgtool_partition *partition, UINT32 state); -const char * imgtool_partition_get_info_string(imgtool_partition *partition, UINT32 state); -UINT64 imgtool_partition_get_info_int(imgtool_partition *partition, UINT32 state); -void * imgtool_partition_extra_bytes(imgtool_partition *partition); -UINT64 imgtool_partition_rand(imgtool_partition *partition); - -/* ----- path management ----- */ -const char * imgtool_partition_get_root_path(imgtool_partition *partition); -const char * imgtool_partition_path_concatenate(imgtool_partition *partition, const char *path1, const char *path2); -const char * imgtool_partition_get_base_name(imgtool_partition *partition, const char *path); - -/* ----- directory management ----- */ -imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *path, imgtool_directory **outenum); -void imgtool_directory_close(imgtool_directory *enumeration); -imgtoolerr_t imgtool_directory_get_next(imgtool_directory *enumeration, imgtool_dirent *ent); -const imgtool_module *imgtool_directory_module(imgtool_directory *enumeration); -void *imgtool_directory_extrabytes(imgtool_directory *enumeration); -imgtool_partition *imgtool_directory_partition(imgtool_directory *directory); -imgtool_image *imgtool_directory_image(imgtool_directory *enumeration); - -/* ----- special ----- */ -int imgtool_validitychecks(void); -void unknown_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); - -char *strncpyz(char *dest, const char *source, size_t len); -char *strncatz(char *dest, const char *source, size_t len); -void rtrim(char *buf); - -#endif /* IMGTOOL_H */ diff --git a/src/mess/tools/imgtool/library.c b/src/mess/tools/imgtool/library.c deleted file mode 100644 index e2ce14d4461..00000000000 --- a/src/mess/tools/imgtool/library.c +++ /dev/null @@ -1,282 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/**************************************************************************** - - library.c - - Code relevant to the Imgtool library; analgous to the MESS/MAME driver - list. - -****************************************************************************/ - -#include - -#include "imgtool.h" -#include "library.h" -#include "pool.h" - -struct imgtool_library -{ - object_pool *pool; - imgtool_module *first; - imgtool_module *last; -}; - - - -imgtool_library *imgtool_library_create(void) -{ - imgtool_library *library; - object_pool *pool; - - /* create a memory pool */ - pool = pool_alloc_lib(NULL); - if (!pool) - goto error; - - /* allocate the main structure */ - library = (imgtool_library *)pool_malloc_lib(pool, sizeof(imgtool_library)); - if (!library) - goto error; - - /* initialize the structure */ - memset(library, 0, sizeof(*library)); - library->pool = pool; - - return library; - -error: - if (pool) - pool_free_lib(pool); - return NULL; -} - - - -void imgtool_library_close(imgtool_library *library) -{ - pool_free_lib(library->pool); -} - - - -static void imgtool_library_add_class(imgtool_library *library, const imgtool_class *imgclass) -{ - imgtool_module *module; - char *s1, *s2; - - /* allocate the module and place it in the chain */ - module = (imgtool_module *)imgtool_library_malloc(library, sizeof(*module)); - memset(module, 0, sizeof(*module)); - module->previous = library->last; - if (library->last) - library->last->next = module; - else - library->first = module; - library->last = module; - - /* extensions have a weird format */ - s1 = imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_FILE_EXTENSIONS); - s2 = (char*)imgtool_library_malloc(library, strlen(s1) + 1); - strcpy(s2, s1); - module->extensions = s2; - - module->imgclass = *imgclass; - module->name = imgtool_library_strdup(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_NAME)); - module->description = imgtool_library_strdup(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_DESCRIPTION)); - module->eoln = imgtool_library_strdup_allow_null(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_EOLN)); - module->initial_path_separator = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR) ? 1 : 0; - module->open_is_strict = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_OPEN_IS_STRICT) ? 1 : 0; - module->tracks_are_called_cylinders = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS) ? 1 : 0; - module->writing_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED) ? 1 : 0; - module->creation_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_CREATION_UNTESTED) ? 1 : 0; - module->open = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_OPEN); - module->create = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *, option_resolution *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CREATE); - module->close = (void (*)(imgtool_image *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CLOSE); - module->info = (void (*)(imgtool_image *, char *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_INFO); - module->read_sector = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_SECTOR); - module->write_sector = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, const void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_SECTOR); - module->get_geometry = (imgtoolerr_t (*)(imgtool_image *, UINT32 *, UINT32 *, UINT32 *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_GEOMETRY); - module->get_sector_size = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, UINT32 *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_SECTOR_SIZE); - module->read_block = (imgtoolerr_t (*)(imgtool_image *, void *, UINT64)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_BLOCK); - module->write_block = (imgtoolerr_t (*)(imgtool_image *, const void *, UINT64)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_BLOCK); - module->list_partitions = (imgtoolerr_t (*)(imgtool_image *, imgtool_partition_info *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_LIST_PARTITIONS); - module->block_size = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_BLOCK_SIZE); - module->createimage_optguide = (const option_guide *) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE); - module->createimage_optspec = imgtool_library_strdup_allow_null(library, (const char*)imgtool_get_info_ptr(imgclass, IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC)); - module->image_extra_bytes += imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES); -} - - - -void imgtool_library_add(imgtool_library *library, imgtool_get_info get_info) -{ - int (*make_class)(int index, imgtool_class *imgclass); - imgtool_class imgclass; - int i, result; - - /* try this class */ - memset(&imgclass, 0, sizeof(imgclass)); - imgclass.get_info = get_info; - - /* do we have derived getinfo functions? */ - make_class = (int (*)(int index, imgtool_class *imgclass)) - imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_MAKE_CLASS); - - if (make_class) - { - i = 0; - do - { - /* clear out the class */ - memset(&imgclass, 0, sizeof(imgclass)); - imgclass.get_info = get_info; - - /* make the class */ - result = make_class(i++, &imgclass); - if (result) - imgtool_library_add_class(library, &imgclass); - } - while(result); - } - else - { - imgtool_library_add_class(library, &imgclass); - } -} - - - -const imgtool_module *imgtool_library_unlink(imgtool_library *library, - const char *module) -{ - imgtool_module *m; - imgtool_module **previous; - imgtool_module **next; - - for (m = library->first; m; m = m->next) - { - if (!core_stricmp(m->name, module)) - { - previous = m->previous ? &m->previous->next : &library->first; - next = m->next ? &m->next->previous : &library->last; - *previous = m->next; - *next = m->previous; - m->previous = NULL; - m->next = NULL; - return m; - } - } - return NULL; -} - - - -static int module_compare(const imgtool_module *m1, - const imgtool_module *m2, imgtool_libsort_t sort) -{ - int rc = 0; - switch(sort) - { - case ITLS_NAME: - rc = strcmp(m1->name, m2->name); - break; - case ITLS_DESCRIPTION: - rc = core_stricmp(m1->name, m2->name); - break; - } - return rc; -} - - - -void imgtool_library_sort(imgtool_library *library, imgtool_libsort_t sort) -{ - imgtool_module *m1; - imgtool_module *m2; - imgtool_module *target; - imgtool_module **before; - imgtool_module **after; - - for (m1 = library->first; m1; m1 = m1->next) - { - target = m1; - for (m2 = m1->next; m2; m2 = m2->next) - { - while(module_compare(target, m2, sort) > 0) - target = m2; - } - - if (target != m1) - { - /* unlink the target */ - before = target->previous ? &target->previous->next : &library->first; - after = target->next ? &target->next->previous : &library->last; - *before = target->next; - *after = target->previous; - - /* now place the target before m1 */ - target->previous = m1->previous; - target->next = m1; - before = m1->previous ? &m1->previous->next : &library->first; - *before = target; - m1->previous = target; - - /* since we changed the order, we have to replace ourselves */ - m1 = target; - } - } -} - - - -const imgtool_module *imgtool_library_findmodule( - imgtool_library *library, const char *module_name) -{ - const imgtool_module *module; - - assert(library); - module = library->first; - while(module && module_name && strcmp(module->name, module_name)) - module = module->next; - return module; -} - - - -imgtool_module *imgtool_library_iterate(imgtool_library *library, const imgtool_module *module) -{ - return module ? module->next : library->first; -} - - - -imgtool_module *imgtool_library_index(imgtool_library *library, int i) -{ - imgtool_module *module; - module = library->first; - while(module && i--) - module = module->next; - return module; -} - - - -void *imgtool_library_malloc(imgtool_library *library, size_t mem) -{ - return pool_malloc_lib(library->pool, mem); -} - - - -char *imgtool_library_strdup(imgtool_library *library, const char *s) -{ - return pool_strdup_lib(library->pool, s); -} - - - -char *imgtool_library_strdup_allow_null(imgtool_library *library, const char *s) -{ - return s ? imgtool_library_strdup(library, s) : NULL; -} diff --git a/src/mess/tools/imgtool/library.h b/src/mess/tools/imgtool/library.h deleted file mode 100644 index 25c923c1f4d..00000000000 --- a/src/mess/tools/imgtool/library.h +++ /dev/null @@ -1,408 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/**************************************************************************** - - library.h - - Code relevant to the Imgtool library; analgous to the MESS/MAME driver - list. - - Unlike MESS and MAME which have static driver lists, Imgtool has a - concept of a library and this library is built at startup time. - dynamic for which modules are added to. This makes "dynamic" modules - much easier - -****************************************************************************/ - -#ifndef LIBRARY_H -#define LIBRARY_H - -#include - -#include "corestr.h" -#include "opresolv.h" -#include "stream.h" -#include "unicode.h" -#include "charconv.h" - - -struct imgtool_image; -struct imgtool_partition; -struct imgtool_directory; -struct imgtool_library; - -enum imgtool_suggestion_viability_t -{ - SUGGESTION_END, - SUGGESTION_POSSIBLE, - SUGGESTION_RECOMMENDED -}; - -union filterinfo -{ - INT64 i; /* generic integers */ - void * p; /* generic pointers */ - void * f; /* generic function pointers */ - const char *s; /* generic strings */ - - imgtoolerr_t (*read_file)(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); - imgtoolerr_t (*write_file)(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts); - imgtoolerr_t (*check_stream)(imgtool_stream *stream, imgtool_suggestion_viability_t *viability); -}; - -typedef void (*filter_getinfoproc)(UINT32 state, union filterinfo *info); - -enum imgtool_libsort_t -{ - ITLS_NAME, - ITLS_DESCRIPTION -}; - -struct imgtool_dirent -{ - char filename[1024]; - char attr[64]; - UINT64 filesize; - - time_t creation_time; - time_t lastmodified_time; - time_t lastaccess_time; - - char softlink[1024]; - char comment[256]; - - /* flags */ - unsigned int eof : 1; - unsigned int corrupt : 1; - unsigned int directory : 1; - unsigned int hardlink : 1; -}; - -struct imgtool_chainent -{ - UINT8 level; - UINT64 block; -}; - -enum imgtool_forktype_t -{ - FORK_END, - FORK_DATA, - FORK_RESOURCE, - FORK_ALTERNATE -}; - -struct imgtool_forkent -{ - imgtool_forktype_t type; - UINT64 size; - char forkname[64]; -}; - -struct imgtool_transfer_suggestion -{ - imgtool_suggestion_viability_t viability; - filter_getinfoproc filter; - const char *fork; - const char *description; -}; - -enum -{ - /* --- the following bits of info are returned as 64-bit signed integers --- */ - IMGTOOLATTR_INT_FIRST = 0x00000, - IMGTOOLATTR_INT_MAC_TYPE, - IMGTOOLATTR_INT_MAC_CREATOR, - IMGTOOLATTR_INT_MAC_FINDERFLAGS, - IMGTOOLATTR_INT_MAC_COORDX, - IMGTOOLATTR_INT_MAC_COORDY, - IMGTOOLATTR_INT_MAC_FINDERFOLDER, - IMGTOOLATTR_INT_MAC_ICONID, - IMGTOOLATTR_INT_MAC_SCRIPTCODE, - IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS, - IMGTOOLATTR_INT_MAC_COMMENTID, - IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY, - - /* --- the following bits of info are returned as pointers to data or functions --- */ - IMGTOOLATTR_PTR_FIRST = 0x10000, - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - IMGTOOLATTR_STR_FIRST = 0x20000, - - /* --- the following bits of info are returned as time_t values --- */ - IMGTOOLATTR_TIME_FIRST = 0x30000, - IMGTOOLATTR_TIME_CREATED, - IMGTOOLATTR_TIME_LASTMODIFIED -}; - -union imgtool_attribute -{ - INT64 i; - time_t t; -}; - -struct imgtool_iconinfo -{ - unsigned icon16x16_specified : 1; - unsigned icon32x32_specified : 1; - UINT32 icon16x16[16][16]; - UINT32 icon32x32[32][32]; -}; - -enum -{ - /* --- the following bits of info are returned as 64-bit signed integers --- */ - IMGTOOLINFO_INT_FIRST = 0x00000, - IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES, - IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES, - IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES, - IMGTOOLINFO_INT_PATH_SEPARATOR, - IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR, - IMGTOOLINFO_INT_PREFER_UCASE, - IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR, - IMGTOOLINFO_INT_OPEN_IS_STRICT, - IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME, - IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME, - IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS, - IMGTOOLINFO_INT_WRITING_UNTESTED, - IMGTOOLINFO_INT_CREATION_UNTESTED, - IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK, - IMGTOOLINFO_INT_BLOCK_SIZE, - IMGTOOLINFO_INT_CHARSET, - - IMGTOOLINFO_INT_CLASS_SPECIFIC = 0x08000, - - /* --- the following bits of info are returned as pointers to data or functions --- */ - IMGTOOLINFO_PTR_FIRST = 0x10000, - - IMGTOOLINFO_PTR_OPEN, - IMGTOOLINFO_PTR_CREATE, - IMGTOOLINFO_PTR_CLOSE, - IMGTOOLINFO_PTR_OPEN_PARTITION, - IMGTOOLINFO_PTR_CREATE_PARTITION, - IMGTOOLINFO_PTR_INFO, - IMGTOOLINFO_PTR_BEGIN_ENUM, - IMGTOOLINFO_PTR_NEXT_ENUM, - IMGTOOLINFO_PTR_CLOSE_ENUM, - IMGTOOLINFO_PTR_FREE_SPACE, - IMGTOOLINFO_PTR_READ_FILE, - IMGTOOLINFO_PTR_WRITE_FILE, - IMGTOOLINFO_PTR_DELETE_FILE, - IMGTOOLINFO_PTR_LIST_FORKS, - IMGTOOLINFO_PTR_CREATE_DIR, - IMGTOOLINFO_PTR_DELETE_DIR, - IMGTOOLINFO_PTR_LIST_ATTRS, - IMGTOOLINFO_PTR_GET_ATTRS, - IMGTOOLINFO_PTR_SET_ATTRS, - IMGTOOLINFO_PTR_ATTR_NAME, - IMGTOOLINFO_PTR_GET_ICON_INFO, - IMGTOOLINFO_PTR_SUGGEST_TRANSFER, - IMGTOOLINFO_PTR_GET_CHAIN, - IMGTOOLINFO_PTR_GET_SECTOR_SIZE, - IMGTOOLINFO_PTR_GET_GEOMETRY, - IMGTOOLINFO_PTR_READ_SECTOR, - IMGTOOLINFO_PTR_WRITE_SECTOR, - IMGTOOLINFO_PTR_READ_BLOCK, - IMGTOOLINFO_PTR_WRITE_BLOCK, - IMGTOOLINFO_PTR_APPROVE_FILENAME_CHAR, - IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE, - IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE, - IMGTOOLINFO_PTR_MAKE_CLASS, - IMGTOOLINFO_PTR_LIST_PARTITIONS, - - IMGTOOLINFO_PTR_CLASS_SPECIFIC = 0x18000, - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - IMGTOOLINFO_STR_FIRST = 0x20000, - - IMGTOOLINFO_STR_NAME, - IMGTOOLINFO_STR_DESCRIPTION, - IMGTOOLINFO_STR_FILE, - IMGTOOLINFO_STR_FILE_EXTENSIONS, - IMGTOOLINFO_STR_EOLN, - IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC, - IMGTOOLINFO_STR_WRITEFILE_OPTSPEC, - - IMGTOOLINFO_STR_CLASS_SPECIFIC = 0x28000 -}; - - - -union imgtoolinfo; - -struct imgtool_class; -typedef void (*imgtool_get_info)(const imgtool_class *, UINT32, union imgtoolinfo *); - -struct imgtool_class -{ - imgtool_get_info get_info; - imgtool_get_info derived_get_info; - void *derived_param; -}; - - - -struct imgtool_partition_info -{ - imgtool_get_info get_info; - UINT64 base_block; - UINT64 block_count; -}; - - - -union imgtoolinfo -{ - INT64 i; /* generic integers */ - void * p; /* generic pointers */ - void * f; /* generic function pointers */ - char * s; /* generic strings */ - - imgtoolerr_t (*open) (imgtool_image *image, imgtool_stream *stream); - void (*close) (imgtool_image *image); - imgtoolerr_t (*create) (imgtool_image *image, imgtool_stream *stream, option_resolution *opts); - imgtoolerr_t (*create_partition) (imgtool_image *image, UINT64 first_block, UINT64 block_count); - void (*info) (imgtool_image *image, char *string, size_t len); - imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path); - imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent); - void (*close_enum) (imgtool_directory *enumeration); - imgtoolerr_t (*open_partition) (imgtool_partition *partition, UINT64 first_block, UINT64 block_count); - imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size); - imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); - imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts); - imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename); - imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len); - imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path); - imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path); - imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len); - imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values); - imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values); - imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len); - imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo); - imgtoolerr_t (*suggest_transfer) (imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length); - imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size); - imgtoolerr_t (*get_sector_size) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size); - imgtoolerr_t (*get_geometry) (imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors); - imgtoolerr_t (*read_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len); - imgtoolerr_t (*write_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam); - imgtoolerr_t (*read_block) (imgtool_image *image, void *buffer, UINT64 block); - imgtoolerr_t (*write_block) (imgtool_image *image, const void *buffer, UINT64 block); - imgtoolerr_t (*list_partitions) (imgtool_image *image, imgtool_partition_info *partitions, size_t len); - int (*approve_filename_char)(unicode_char ch); - int (*make_class)(int index, imgtool_class *imgclass); - - const option_guide *createimage_optguide; - const option_guide *writefile_optguide; -}; - - - -INLINE INT64 imgtool_get_info_int(const imgtool_class *imgclass, UINT32 state) -{ - union imgtoolinfo info; - info.i = 0; - imgclass->get_info(imgclass, state, &info); - return info.i; -} - -INLINE void *imgtool_get_info_ptr(const imgtool_class *imgclass, UINT32 state) -{ - union imgtoolinfo info; - info.p = NULL; - imgclass->get_info(imgclass, state, &info); - return info.p; -} - -INLINE void *imgtool_get_info_fct(const imgtool_class *imgclass, UINT32 state) -{ - union imgtoolinfo info; - info.f = NULL; - imgclass->get_info(imgclass, state, &info); - return info.f; -} - -INLINE char *imgtool_get_info_string(const imgtool_class *imgclass, UINT32 state) -{ - union imgtoolinfo info; - info.s = NULL; - imgclass->get_info(imgclass, state, &info); - return info.s; -} - -/* circular string buffer */ -char *imgtool_temp_str(void); - - - -struct imgtool_module -{ - imgtool_module *previous; - imgtool_module *next; - - imgtool_class imgclass; - - const char *name; - const char *description; - const char *extensions; - const char *eoln; - - size_t image_extra_bytes; - - /* flags */ - unsigned int initial_path_separator : 1; - unsigned int open_is_strict : 1; - unsigned int tracks_are_called_cylinders : 1; /* used for hard drivers */ - unsigned int writing_untested : 1; /* used when we support writing, but not in main build */ - unsigned int creation_untested : 1; /* used when we support creation, but not in main build */ - - imgtoolerr_t (*open) (imgtool_image *image, imgtool_stream *f); - void (*close) (imgtool_image *image); - void (*info) (imgtool_image *image, char *string, size_t len); - imgtoolerr_t (*create) (imgtool_image *image, imgtool_stream *f, option_resolution *opts); - imgtoolerr_t (*get_sector_size)(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size); - imgtoolerr_t (*get_geometry) (imgtool_image *image, UINT32 *track, UINT32 *heads, UINT32 *sectors); - imgtoolerr_t (*read_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len); - imgtoolerr_t (*write_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len); - imgtoolerr_t (*read_block) (imgtool_image *image, void *buffer, UINT64 block); - imgtoolerr_t (*write_block) (imgtool_image *image, const void *buffer, UINT64 block); - imgtoolerr_t (*list_partitions)(imgtool_image *image, imgtool_partition_info *partitions, size_t len); - - UINT32 block_size; - - const option_guide *createimage_optguide; - const char *createimage_optspec; - - const void *extra; -}; - -/* creates an imgtool library */ -imgtool_library *imgtool_library_create(void); - -/* closes an imgtool library */ -void imgtool_library_close(imgtool_library *library); - -/* adds a module to an imgtool library */ -void imgtool_library_add(imgtool_library *library, imgtool_get_info get_info); - -/* seeks out and removes a module from an imgtool library */ -const imgtool_module *imgtool_library_unlink(imgtool_library *library, - const char *module); - -/* sorts an imgtool library */ -void imgtool_library_sort(imgtool_library *library, imgtool_libsort_t sort); - -/* finds a module */ -const imgtool_module *imgtool_library_findmodule( - imgtool_library *library, const char *module_name); - -/* memory allocators for pooled library memory */ -void *imgtool_library_malloc(imgtool_library *library, size_t mem); -char *imgtool_library_strdup(imgtool_library *library, const char *s); -char *imgtool_library_strdup_allow_null(imgtool_library *library, const char *s); - -imgtool_module *imgtool_library_iterate( - imgtool_library *library, const imgtool_module *module); -imgtool_module *imgtool_library_index( - imgtool_library *library, int i); - -#endif /* LIBRARY_H */ diff --git a/src/mess/tools/imgtool/main.c b/src/mess/tools/imgtool/main.c deleted file mode 100644 index 6825b71fa81..00000000000 --- a/src/mess/tools/imgtool/main.c +++ /dev/null @@ -1,972 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - main.c - - Imgtool command line front end - -***************************************************************************/ - -#include -#include -#include -#include -#include - -#include "imgtool.h" -#include "main.h" -#include "modules.h" -/* ---------------------------------------------------------------------- */ - -static void writeusage(FILE *f, int write_word_usage, const struct command *c, char *argv[]) -{ - fprintf(f, "%s %s %s %s\n", - (write_word_usage ? "Usage:" : " "), - imgtool_basename(argv[0]), - c->name, - c->usage ? c->usage : ""); -} - - - -/* ----------------------------------------------------------------------- */ - -static int parse_options(int argc, char *argv[], int minunnamed, int maxunnamed, - option_resolution *resolution, filter_getinfoproc *filter, const char **fork) -{ - int i; - int lastunnamed = 0; - char *s; - char *name = NULL; - char *value = NULL; - optreserr_t oerr; - static char buf[256]; - - if (filter) - *filter = NULL; - if (fork) - *fork = NULL; - - for (i = 0; i < argc; i++) - { - /* Named or unamed arg */ - if ((argv[i][0] != '-') || (argv[i][1] != '-')) - { - /* Unnamed */ - if (i >= maxunnamed) - goto error; /* Too many unnamed */ - lastunnamed = i + 1; - } - else - { - /* Named */ - name = argv[i] + 2; - s = strchr(name, '='); - if (!s) - goto error; - *s = 0; - value = s + 1; - - if (!strcmp(name, "filter")) - { - /* filter option */ - if (!filter) - goto error; /* this command doesn't use filters */ - if (*filter) - goto optionalreadyspecified; - *filter = filter_lookup(value); - if (!(*filter)) - goto filternotfound; - - } - else if (!strcmp(name, "fork")) - { - /* fork option */ - if (!fork) - goto error; /* this command doesn't use filters */ - if (*fork) - goto optionalreadyspecified; - - snprintf(buf, ARRAY_LENGTH(buf), "%s", value); - *fork = buf; - } - else - { - /* Other named option */ - if (i < minunnamed) - goto error; /* Too few unnamed */ - - oerr = option_resolution_add_param(resolution, name, value); - if (oerr) - goto opterror; - } - } - } - return lastunnamed; - -filternotfound: - fprintf(stderr, "%s: Unknown filter type\n", value); - return -1; - -optionalreadyspecified: - fprintf(stderr, "Cannot specify multiple %ss\n", name); - return -1; - -opterror: - fprintf(stderr, "%s: %s\n", name, option_resolution_error_string(oerr)); - return -1; - -error: - fprintf(stderr, "%s: Unrecognized option\n", argv[i]); - return -1; -} - - - -void reporterror(imgtoolerr_t err, const struct command *c, const char *format, const char *imagename, - const char *filename, const char *newname, option_resolution *opts) -{ - const char *src = "imgtool"; - const char *err_name; - - err_name = imgtool_error(err); - - switch(ERRORSOURCE(err)) { - case IMGTOOLERR_SRC_MODULE: - src = format; - break; - case IMGTOOLERR_SRC_FUNCTIONALITY: - src = c->name; - break; - case IMGTOOLERR_SRC_IMAGEFILE: - src = imagename; - break; - case IMGTOOLERR_SRC_FILEONIMAGE: - src = filename; - break; - case IMGTOOLERR_SRC_NATIVEFILE: - src = newname ? newname : filename; - break; - } - fflush(stdout); - fflush(stderr); - - if (!src) - src = c->name; - fprintf(stderr, "%s: %s\n", src, err_name); -} - - - -static const char *interpret_filename(const char *filename) -{ - if (!strcmp(filename, "??BOOT??") - || !strcmp(filename, "\'??BOOT??\'") - || !strcmp(filename, "\"??BOOT??\"")) - filename = FILENAME_BOOTBLOCK; - return filename; -} - - - -/* ----------------------------------------------------------------------- */ - -static int cmd_dir(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - int total_count, total_size, freespace_err; - UINT64 freespace; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - imgtool_directory *imgenum = NULL; - imgtool_dirent ent; - char buf[512]; - char last_modified[19]; - const char *path; - int partition_index = 0; - - /* attempt to open image */ - err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_READ, &image); - if (err) - goto done; - - /* attempt to open partition */ - err = imgtool_partition_open(image, partition_index, &partition); - if (err) - goto done; - - path = argc > 2 ? argv[2] : NULL; - - err = imgtool_directory_open(partition, path, &imgenum); - if (err) - goto done; - - memset(&ent, 0, sizeof(ent)); - last_modified[0] = '\0'; - total_count = 0; - total_size = 0; - - fprintf(stdout, "Contents of %s:%s\n", argv[1], path ? path : ""); - - imgtool_image_info(image, buf, sizeof(buf)); - if (buf[0]) - fprintf(stdout, "%s\n", buf); - fprintf(stdout, "------------------------------ -------- --------------- ------------------\n"); - - while (((err = imgtool_directory_get_next(imgenum, &ent)) == 0) && !ent.eof) - { - if (ent.directory) - snprintf(buf, sizeof(buf), ""); - else - snprintf(buf, sizeof(buf), "%u", (unsigned int) ent.filesize); - - if (ent.lastmodified_time != 0) - strftime(last_modified, sizeof(last_modified), "%d-%b-%y %H:%M:%S", - localtime(&ent.lastmodified_time)); - - if (ent.hardlink) - strcat(ent.filename, " "); - - fprintf(stdout, "%-30s %8s %15s %18s\n", ent.filename, buf, ent.attr, last_modified); - - if (ent.softlink && ent.softlink[0] != '\0') - fprintf(stdout, "-> %s\n", ent.softlink); - - if (ent.comment && ent.comment[0] != '\0') - fprintf(stdout, ": %s\n", ent.comment); - - total_count++; - total_size += ent.filesize; - - memset(&ent, 0, sizeof(ent)); - } - - freespace_err = imgtool_partition_get_free_space(partition, &freespace); - - if (err) - goto done; - - fprintf(stdout, "------------------------ ------ ---------------\n"); - fprintf(stdout, "%8i File(s) %8i bytes\n", total_count, total_size); - if (!freespace_err) - fprintf(stdout, " %8u bytes free\n", (unsigned int) freespace); - -done: - if (imgenum) - imgtool_directory_close(imgenum); - if (partition) - imgtool_partition_close(partition); - if (image) - imgtool_image_close(image); - if (err) - reporterror(err, c, argv[0], argv[1], NULL, NULL, NULL); - return err ? -1 : 0; -} - - - -static int cmd_get(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - const char *filename; - char *new_filename; - int unnamedargs = 0; - filter_getinfoproc filter; - const char *fork; - int partition_index = 0; - - err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_READ, &image); - if (err) - goto done; - - err = imgtool_partition_open(image, partition_index, &partition); - if (err) - goto done; - - filename = interpret_filename(argv[2]); - - unnamedargs = parse_options(argc, argv, 3, 4, NULL, &filter, &fork); - if (unnamedargs < 0) - goto done; - - new_filename = (unnamedargs == 4) ? argv[3] : NULL; - - err = imgtool_partition_get_file(partition, filename, fork, new_filename, filter); - if (err) - goto done; - - err = IMGTOOLERR_SUCCESS; - -done: - if (err) - reporterror(err, c, argv[0], argv[1], argv[2], argv[3], NULL); - if (partition) - imgtool_partition_close(partition); - if (image) - imgtool_image_close(image); - return (err || (unnamedargs < 0)) ? -1 : 0; -} - - - -static int cmd_put(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - int i; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - const char *filename = NULL; - int unnamedargs; - filter_getinfoproc filter; - const imgtool_module *module; - option_resolution *resolution = NULL; - const char *fork; - const char *new_filename; - char **filename_list; - int filename_count; - int partition_index = 0; - const option_guide *writefile_optguide; - const char *writefile_optspec; - - module = imgtool_find_module(argv[0]); - if (!module) - { - err = (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); - goto done; - } - - /* ugh I hate the way this function is set up, this is because the - * arguments depend on the partition; something that requires some - * rudimentary parsing */ - if (argc >= 2) - { - /* open up the image */ - err = imgtool_image_open(module, argv[1], OSD_FOPEN_RW, &image); - if (err) - goto done; - - /* open up the partition */ - err = imgtool_partition_open(image, partition_index, &partition); - if (err) - goto done; - - writefile_optguide = (const option_guide *) imgtool_partition_get_info_ptr(partition, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE); - writefile_optspec = (const char *)imgtool_partition_get_info_ptr(partition, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC); - - if (writefile_optguide && writefile_optspec) - { - resolution = option_resolution_create(writefile_optguide, writefile_optspec); - if (!resolution) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - } - } - - unnamedargs = parse_options(argc, argv, 4, 0xffff, resolution, &filter, &fork); - if (unnamedargs < 0) - return -1; - - /* pick out which args are filenames, and which one is the destination */ - new_filename = interpret_filename(argv[unnamedargs - 1]); - filename_list = &argv[2]; - filename_count = unnamedargs - 3; - - /* loop through the filenames, and put them */ - for (i = 0; i < filename_count; i++) - { - filename = filename_list[i]; - printf("Putting file '%s'...\n", filename); - err = imgtool_partition_put_file(partition, new_filename, fork, filename, resolution, filter); - if (err) - goto done; - } - -done: - if (partition) - imgtool_partition_close(partition); - if (image) - imgtool_image_close(image); - if (resolution) - option_resolution_close(resolution); - if (err) - reporterror(err, c, argv[0], argv[1], filename, NULL, resolution); - return err ? -1 : 0; -} - - - -static int cmd_getall(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - imgtool_directory *imgenum = NULL; - imgtool_dirent ent; - filter_getinfoproc filter; - int unnamedargs; - const char *path = NULL; - int arg; - int partition_index = 0; - - err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_READ, &image); - if (err) - goto done; - - err = imgtool_partition_open(image, partition_index, &partition); - if (err) - goto done; - - arg = 2; - if ((argc > 2) && (argv[2][0] != '-')) - { - path = argv[arg++]; - } - - unnamedargs = parse_options(argc, argv, arg, arg, NULL, &filter, NULL); - if (unnamedargs < 0) - goto done; - - err = imgtool_directory_open(partition, path, &imgenum); - if (err) - goto done; - - memset(&ent, 0, sizeof(ent)); - - while (((err = imgtool_directory_get_next(imgenum, &ent)) == 0) && !ent.eof) - { - fprintf(stdout, "Retrieving %s (%u bytes)\n", ent.filename, (unsigned int) ent.filesize); - - err = imgtool_partition_get_file(partition, ent.filename, NULL, NULL, filter); - if (err) - goto done; - } - -done: - if (imgenum) - imgtool_directory_close(imgenum); - if (partition) - imgtool_partition_close(partition); - if (image) - imgtool_image_close(image); - if (err) - reporterror(err, c, argv[0], argv[1], NULL, NULL, NULL); - return err ? -1 : 0; -} - - - -static int cmd_del(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - int partition_index = 0; - - err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); - if (err) - goto done; - - err = imgtool_partition_open(image, partition_index, &partition); - if (err) - goto done; - - err = imgtool_partition_delete_file(partition, argv[2]); - if (err) - goto done; - -done: - if (partition) - imgtool_partition_close(partition); - if (image) - imgtool_image_close(image); - if (err) - reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); - return err ? -1 : 0; -} - - - -static int cmd_mkdir(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - int partition_index = 0; - - err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); - if (err) - goto done; - - err = imgtool_partition_open(image, partition_index, &partition); - if (err) - goto done; - - err = imgtool_partition_create_directory(partition, argv[2]); - if (err) - goto done; - -done: - if (partition) - imgtool_partition_close(partition); - if (image) - imgtool_image_close(image); - if (err) - reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); - return err ? -1 : 0; -} - - - -static int cmd_rmdir(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - imgtool_image *image = NULL; - imgtool_partition *partition = NULL; - int partition_index = 0; - - err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &image); - if (err) - goto done; - - err = imgtool_partition_open(image, partition_index, &partition); - if (err) - goto done; - - err = imgtool_partition_delete_directory(partition, argv[2]); - if (err) - goto done; - -done: - if (partition) - imgtool_partition_close(partition); - if (image) - imgtool_image_close(image); - if (err) - reporterror(err, c, argv[0], argv[1], argv[2], NULL, NULL); - return err ? -1 : 0; -} - - - -static int cmd_identify(const struct command *c, int argc, char *argv[]) -{ - imgtool_module *modules[128]; - imgtoolerr_t err; - int i; - - err = imgtool_identify_file(argv[0], modules, ARRAY_LENGTH(modules)); - if (err) - goto error; - - for (i = 0; modules[i]; i++) - { - printf("%.16s %s\n", modules[i]->name, modules[i]->description); - } - - return 0; - -error: - reporterror(err, c, NULL, argv[0], NULL, NULL, 0); - return -1; -} - - - -static int cmd_create(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - int unnamedargs; - const imgtool_module *module; - option_resolution *resolution = NULL; - - module = imgtool_find_module(argv[0]); - if (!module) - { - err = (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE); - goto error; - } - - if (module->createimage_optguide && module->createimage_optspec) - { - resolution = option_resolution_create(module->createimage_optguide, module->createimage_optspec); - if (!resolution) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto error; - } - } - - unnamedargs = parse_options(argc, argv, 2, 3, resolution, NULL, NULL); - if (unnamedargs < 0) - return -1; - - err = imgtool_image_create(module, argv[1], resolution, NULL); - if (err) - goto error; - - if (resolution) - option_resolution_close(resolution); - return 0; - -error: - if (resolution) - option_resolution_close(resolution); - reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); - return -1; -} - - - -static int cmd_readsector(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - imgtool_image *img; - imgtool_stream *stream = NULL; - dynamic_buffer buffer; - UINT32 size, track, head, sector; - - /* attempt to open image */ - err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_READ, &img); - if (err) - goto done; - - track = atoi(argv[2]); - head = atoi(argv[3]); - sector = atoi(argv[4]); - - err = imgtool_image_get_sector_size(img, track, head, sector, &size); - if (err) - goto done; - - buffer.resize(size); - - err = imgtool_image_read_sector(img, track, head, sector, &buffer[0], size); - if (err) - goto done; - - - stream = stream_open(argv[5], OSD_FOPEN_WRITE); - if (!stream) - { - err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE); - goto done; - } - - stream_write(stream, &buffer[0], size); - -done: - if (stream) - stream_close(stream); - if (err) - reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); - return err ? -1 : 0; -} - - - -static int cmd_writesector(const struct command *c, int argc, char *argv[]) -{ - imgtoolerr_t err; - imgtool_image *img; - imgtool_stream *stream = NULL; - dynamic_buffer buffer; - UINT32 size, track, head, sector; - - /* attempt to open image */ - err = imgtool_image_open_byname(argv[0], argv[1], OSD_FOPEN_RW, &img); - if (err) - goto done; - - track = atoi(argv[2]); - head = atoi(argv[3]); - sector = atoi(argv[4]); - - stream = stream_open(argv[5], OSD_FOPEN_READ); - if (!stream) - { - err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE); - goto done; - } - - size = (UINT32) stream_size(stream); - - buffer.resize(size); - - stream_read(stream, &buffer[0], size); - - err = imgtool_image_write_sector(img, track, head, sector, &buffer[0], size); - if (err) - goto done; - -done: - if (stream) - stream_close(stream); - if (err) - reporterror(err, c, argv[0], argv[1], NULL, NULL, 0); - return err ? -1 : 0; -} - - - -static int cmd_listformats(const struct command *c, int argc, char *argv[]) -{ - const imgtool_module *mod; - - fprintf(stdout, "Image formats supported by imgtool:\n\n"); - - mod = imgtool_find_module(NULL); - while(mod) - { - fprintf(stdout, " %-25s%s\n", mod->name, mod->description); - mod = mod->next; - } - - return 0; -} - - - -static int cmd_listfilters(const struct command *c, int argc, char *argv[]) -{ - int i; - - fprintf(stdout, "Filters supported by imgtool:\n\n"); - - for (i = 0; filters[i]; i++) - { - fprintf(stdout, " %-11s%s\n", - filter_get_info_string(filters[i], FILTINFO_STR_NAME), - filter_get_info_string(filters[i], FILTINFO_STR_HUMANNAME)); - } - - return 0; -} - -static void listoptions(const option_guide *opt_guide, const char *opt_spec) -{ - char opt_name[32]; - const char *opt_desc; - struct OptionRange range[32]; - char range_buffer[512]; - char buf[32]; - int i; - - assert(opt_guide); - - fprintf(stdout, "Option Allowed values Description\n"); - fprintf(stdout, "---------------- ------------------------------ -----------\n"); - - while(opt_guide->option_type != OPTIONTYPE_END) - { - range_buffer[0] = 0; - snprintf(opt_name, ARRAY_LENGTH(opt_name), "--%s", opt_guide->identifier); - opt_desc = opt_guide->display_name; - - /* is this option relevant? */ - if (!strchr(opt_spec, opt_guide->parameter)) - { - opt_guide++; - continue; - } - - switch(opt_guide->option_type) { - case OPTIONTYPE_INT: - option_resolution_listranges(opt_spec, opt_guide->parameter, - range, ARRAY_LENGTH(range)); - - for (i = 0; range[i].max >= 0; i++) - { - if (range[i].min == range[i].max) - snprintf(buf, ARRAY_LENGTH(buf), "%i", range[i].min); - else - snprintf(buf, ARRAY_LENGTH(buf), "%i-%i", range[i].min, range[i].max); - - if (i > 0) - strncatz(range_buffer, "/", sizeof(range_buffer)); - strncatz(range_buffer, buf, sizeof(range_buffer)); - } - break; - - case OPTIONTYPE_ENUM_BEGIN: - i = 0; - while(opt_guide[1].option_type == OPTIONTYPE_ENUM_VALUE) - { - if (i > 0) - strncatz(range_buffer, "/", sizeof(range_buffer)); - strncatz(range_buffer, opt_guide[1].identifier, sizeof(range_buffer)); - - opt_guide++; - i++; - } - break; - - case OPTIONTYPE_STRING: - snprintf(range_buffer, sizeof(range_buffer), "(string)"); - break; - default: - assert(0); - break; - } - - fprintf(stdout, "%16s %-30s %s\n", - opt_name, - range_buffer, - opt_desc); - opt_guide++; - } -} - - - -static int cmd_listdriveroptions(const struct command *c, int argc, char *argv[]) -{ - const imgtool_module *mod; - const option_guide *opt_guide; - const char *opt_spec; - - mod = imgtool_find_module(argv[0]); - if (!mod) - goto error; - - fprintf(stdout, "Driver specific options for module '%s':\n\n", argv[0]); - - /* list write options */ - opt_guide = (const option_guide *) imgtool_get_info_ptr(&mod->imgclass, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE); - opt_spec = imgtool_get_info_string(&mod->imgclass, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC); - if (opt_guide) - { - fprintf(stdout, "Image specific file options (usable on the 'put' command):\n\n"); - listoptions(opt_guide, opt_spec); - puts("\n"); - } - else - { - fprintf(stdout, "No image specific file options\n\n"); - } - - /* list create options */ - opt_guide = mod->createimage_optguide; - if (opt_guide) - { - fprintf(stdout, "Image specific creation options (usable on the 'create' command):\n\n"); - listoptions(opt_guide, mod->createimage_optspec); - puts("\n"); - } - else - { - fprintf(stdout, "No image specific creation options\n\n"); - } - - return 0; - -error: - reporterror((imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND|IMGTOOLERR_SRC_MODULE), c, argv[0], NULL, NULL, NULL, NULL); - return -1; -} - - - -/* ----------------------------------------------------------------------- */ - -static const struct command cmds[] = -{ - { "create", cmd_create, " [--(createoption)=value]", 2, 8, 0}, - { "dir", cmd_dir, " [path]", 2, 3, 0 }, - { "get", cmd_get, " [newname] [--filter=filter] [--fork=fork]", 3, 4, 0 }, - { "put", cmd_put, " ... [--(fileoption)==value] [--filter=filter] [--fork=fork]", 3, 0xffff, 0 }, - { "getall", cmd_getall, " [path] [--filter=filter]", 2, 3, 0 }, - { "del", cmd_del, " ...", 3, 3, 1 }, - { "mkdir", cmd_mkdir, " ", 3, 3, 0 }, - { "rmdir", cmd_rmdir, " ...", 3, 3, 1 }, - { "readsector", cmd_readsector, " ", 6, 6, 0 }, - { "writesector", cmd_writesector, " ", 6, 6, 0 }, - { "identify", cmd_identify, "", 1, 1 }, - { "listformats", cmd_listformats, NULL, 0, 0, 0 }, - { "listfilters", cmd_listfilters, NULL, 0, 0, 0 }, - { "listdriveroptions", cmd_listdriveroptions, "", 1, 1, 0 } -}; - -int CLIB_DECL main(int argc, char *argv[]) -{ - int i; - int result; - const struct command *c; - const char *sample_format = "coco_jvc_rsdos"; - -#ifdef MAME_DEBUG - if (imgtool_validitychecks()) - return -1; -#endif /* MAME_DEBUG */ - - putchar('\n'); - - if (argc > 1) - { - /* figure out what command they are running, and run it */ - for (i = 0; i < ARRAY_LENGTH(cmds); i++) - { - c = &cmds[i]; - if (!core_stricmp(c->name, argv[1])) - { - /* check argument count */ - if (c->minargs > (argc - 2)) - goto cmderror; - - /* initialize the imgtool core */ - imgtool_init(TRUE, NULL); - - if (c->lastargrepeats && (argc > c->maxargs)) - { - for (i = c->maxargs+1; i < argc; i++) - { - argv[c->maxargs+1] = argv[i]; - - result = c->cmdproc(c, c->maxargs, argv + 2); - if (result) - goto done; - } - result = 0; - goto done; - } - else - { - if ((c->maxargs > 0) && (c->maxargs < (argc - 2))) - goto cmderror; - - result = c->cmdproc(c, argc - 2, argv + 2); - goto done; - } - } - } - } - - /* Usage */ - fprintf(stderr, "imgtool - Generic image manipulation tool for use with MESS\n\n"); - for (i = 0; i < ARRAY_LENGTH(cmds); i++) - { - writeusage(stdout, (i == 0), &cmds[i], argv); - } - - fprintf(stderr, "\n is the image format, e.g. %s\n", sample_format); - fprintf(stderr, " is the image filename; can specify a ZIP file for image name\n"); - - fprintf(stderr, "\nExample usage:\n"); - fprintf(stderr, "\t%s dir %s myimageinazip.zip\n", imgtool_basename(argv[0]), sample_format); - fprintf(stderr, "\t%s get %s myimage.dsk myfile.bin mynewfile.txt\n", imgtool_basename(argv[0]), sample_format); - fprintf(stderr, "\t%s getall %s myimage.dsk\n", imgtool_basename(argv[0]), sample_format); - result = 0; - goto done; - -cmderror: - writeusage(stdout, 1, &cmds[i], argv); - result = -1; - -done: - imgtool_exit(); - return result; -} diff --git a/src/mess/tools/imgtool/main.h b/src/mess/tools/imgtool/main.h deleted file mode 100644 index d4089686437..00000000000 --- a/src/mess/tools/imgtool/main.h +++ /dev/null @@ -1,20 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -#include "imgtool.h" - -struct command -{ - const char *name; - int (*cmdproc)(const struct command *c, int argc, char *argv[]); - const char *usage; - int minargs; - int maxargs; - int lastargrepeats; -}; - -void reporterror(imgtoolerr_t err, const struct command *c, const char *format, const char *imagename, - const char *filename, const char *newname, option_resolution *opts); - -#ifdef MAME_DEBUG -int cmd_testsuite(struct command *c, int argc, char *argv[]); -#endif diff --git a/src/mess/tools/imgtool/modules.c b/src/mess/tools/imgtool/modules.c deleted file mode 100644 index e5f0c43690c..00000000000 --- a/src/mess/tools/imgtool/modules.c +++ /dev/null @@ -1,119 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - modules.c - - List of Imgtool modules - -***************************************************************************/ - -#include "imgtool.h" -#include "modules.h" - -#ifndef MODULES_RECURSIVE -#define MODULES_RECURSIVE - -/* step 1: declare all external references */ -#define MODULE(name) extern void name##_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); -#include "modules.c" -#undef MODULE - -/* step 2: define the modules[] array */ -#define MODULE(name) name##_get_info, -static void (*const modules[])(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) = -{ -#include "modules.c" -}; - -/* step 3: declare imgtool_create_cannonical_library() */ -imgtoolerr_t imgtool_create_cannonical_library(int omit_untested, imgtool_library **library) -{ - imgtoolerr_t err; - size_t i; - imgtool_library *lib; - imgtool_module *module; - - /* list of modules that we drop */ - static const char *const irrelevant_modules[] = - { - "coco_os9_rsdos" - }; - - lib = imgtool_library_create(); - if (!lib) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto error; - } - - /* create all modules */ - for (i = 0; i < ARRAY_LENGTH(modules); i++) - imgtool_library_add(lib, modules[i]); - - /* remove irrelevant modules */ - for (i = 0; i < ARRAY_LENGTH(irrelevant_modules); i++) - { - imgtool_library_unlink(lib, irrelevant_modules[i]); - } - - /* if we are omitting untested, go through and block out the functionality in question */ - if (omit_untested) - { - module = NULL; - while((module = imgtool_library_iterate(lib, module)) != NULL) - { - if (module->writing_untested) - { - module->write_sector = NULL; - } - if (module->creation_untested) - { - module->create = NULL; - module->createimage_optguide = NULL; - module->createimage_optspec = NULL; - } - } - } - - *library = lib; - return IMGTOOLERR_SUCCESS; - -error: - if (lib) - imgtool_library_close(lib); - return err; - -} - - -#else /* MODULES_RECURSIVE */ - -MODULE(amiga_floppy) -MODULE(concept) -MODULE(mac_mfs) -MODULE(mac_hfs) -MODULE(hd) -MODULE(rsdos) -MODULE(vzdos) -MODULE(os9) -MODULE(ti99_old) -MODULE(ti99_v9t9) -MODULE(ti99_pc99fm) -MODULE(ti99_pc99mfm) -MODULE(ti99_ti99hd) -MODULE(ti990) -MODULE(pc_floppy) -MODULE(pc_chd) -MODULE(prodos_525) -MODULE(prodos_35) -MODULE(thom_fd_basic) -MODULE(thom_qd_basic) -MODULE(thom_sap_basic) -MODULE(cybiko) -MODULE(cybikoxt) -MODULE(psion) -MODULE(bml3) -MODULE(hp48) - -#endif /* MODULES_RECURSIVE */ diff --git a/src/mess/tools/imgtool/modules.h b/src/mess/tools/imgtool/modules.h deleted file mode 100644 index 6f5a3786c6b..00000000000 --- a/src/mess/tools/imgtool/modules.h +++ /dev/null @@ -1,18 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/**************************************************************************** - - modules.h - - Code that creates the "canonical" Imgtool library - -****************************************************************************/ - -#ifndef MODULES_H -#define MODULES_H - -#include "library.h" - -imgtoolerr_t imgtool_create_cannonical_library(int omit_untested, imgtool_library **library); - -#endif /* MODULES_H */ diff --git a/src/mess/tools/imgtool/modules/amiga.c b/src/mess/tools/imgtool/modules/amiga.c deleted file mode 100644 index 7723748cbd2..00000000000 --- a/src/mess/tools/imgtool/modules/amiga.c +++ /dev/null @@ -1,2411 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/**************************************************************************** - - amiga.c - - Amiga floppies - -****************************************************************************/ - - -/***************************************************************************** - Includes -*****************************************************************************/ - - -#include -#include -#include - -#include "imgtool.h" -#include "iflopimg.h" -#include "formats/imageutl.h" - - - -/***************************************************************************** - Data structures -*****************************************************************************/ - - -#define BSIZE (512) /* Block size is always 512 bytes for floppies */ -#define TSIZE ((BSIZE/4) - 56) /* Size of data tables */ -#define MSIZE ((BSIZE/4) - 1) /* Size of bitmaps */ - - -enum disk_type -{ - DT_UNKNOWN = -1, - DT_OFS = 0, - DT_FFS = 1, - DT_OFS_INTL = 2, - DT_FFS_INTL = 3, - DT_OFS_INTL_DIRC = 4, - DT_FFS_INTL_DIRC = 5 -}; - - -enum -{ - T_INVALID = 0, - T_HEADER = 2, - T_DATA = 8, - T_LIST = 16, - T_DIRCACHE = 33 -}; - - -enum sec_type -{ - ST_INVALID = 0, - ST_ROOT = 1, - ST_USERDIR = 2, - ST_FILE = -3, - ST_LINKFILE = -4, - ST_LINKDIR = 4, - ST_SOFTLINK = 3 -}; - - -struct amiga_date -{ - UINT32 days; /* days since 1 jan 78 */ - UINT32 mins; /* minutes past midnight */ - UINT32 ticks; /* ticks (1/50 sec) past last minute */ -}; - - -struct root_block -{ - UINT32 ht_size; /* Hash table size in long */ - UINT32 chksum; /* Rootblock checksum */ - UINT32 ht[TSIZE]; /* Hash table (entry block number) */ - UINT32 bm_flag; /* bitmap flag, -1 means VALID */ - UINT32 bm_pages[25]; /* bitmap blocks pointers (first one at bm_pages[0]) */ - amiga_date r; /* last root alteration date */ - UINT8 name_len; /* volume name length */ - UINT8 diskname[30]; /* volume name */ - amiga_date v; /* last disk alteration date */ - amiga_date c; /* filesystem creation date */ - UINT32 extension; /* FFS: first directory cache block, 0 otherwise */ -}; - - -struct bitmap_block -{ - UINT32 chksum; /* checksum, normal algorithm */ - UINT32 map[MSIZE]; /* bitmap */ -}; - - -struct bitmap_ext_block -{ - UINT32 map[MSIZE]; /* bitmap */ - UINT32 next; /* next extension block */ -}; - - -struct file_block -{ - UINT32 header_key; /* self pointer (to this block) */ - UINT32 high_seq; /* number of data block ptr stored here */ - UINT32 first_data; /* first data block ptr */ - UINT32 chksum; /* same algorithm as rootblock */ - UINT32 data_blocks[TSIZE]; /* data blk ptr */ - UINT16 uid; /* UserID */ - UINT16 gid; /* GroupID */ - UINT32 protect; /* protection flags (0 by default) */ - UINT32 byte_size; /* file size in bytes */ - UINT8 comm_len; /* file comment length */ - UINT8 comment[79]; /* comment (max. 79 chars permitted) */ - amiga_date date; /* last change date */ - UINT8 name_len; /* filename length */ - UINT8 filename[30]; /* filename (max. 30 chars permitted) */ - UINT32 real_entry; /* FFS: unused, set to 0 */ - UINT32 next_link; /* FFS: hardlinks chained list (first == newest */ - UINT32 hash_chain; /* next entry ptr with same hash */ - UINT32 parent; /* parent directory */ - UINT32 extension; /* pointer to 1st file extension block */ -}; - - -struct file_ext_block -{ - UINT32 header_key; /* self pointer (to this block) */ - UINT32 high_seq; /* number of data block ptr stored here */ - UINT32 chksum; /* same algorithm as rootblock */ - UINT32 data_blocks[TSIZE]; /* data blk ptr */ - UINT32 parent; /* file header block */ - UINT32 extension; /* pointer to next file extension block */ -}; - - -struct data_block -{ - UINT32 header_key; /* self pointer (to this block) */ - UINT32 seq_num; /* file data block number */ - UINT32 data_size; /* data size */ - UINT32 next_data; /* next data block ptr */ - UINT32 chksum; /* checksum, rootblock algorithm */ - UINT8 data[BSIZE-24]; /* file data */ -}; - - -struct dir_block -{ - UINT32 header_key; /* self pointer (to this block) */ - UINT32 chksum; /* same algorithm as rootblock */ - UINT32 ht[TSIZE]; /* hash table (entry block number) */ - UINT8 uid; /* UserID */ - UINT8 gid; /* GroupID */ - UINT32 protect; /* protection flags (0 by default) */ - UINT8 comm_len; /* file comment length */ - UINT8 comment[79]; /* comment (max. 79 chars permitted) */ - amiga_date date; /* last access date */ - UINT8 name_len; /* directory name length */ - UINT8 dirname[30]; /* directory name (max. 30 chars permitted) */ - UINT32 next_link; /* FFS: hardlinks chained list (first == newest */ - UINT32 hash_chain; /* next entry ptr with same hash */ - UINT32 parent; /* parent directory */ - UINT32 extension; /* FFS: first directory cache block */ -}; - - -struct hardlink_block -{ - UINT32 header_key; /* self pointer (to this block) */ - UINT32 chksum; /* same algorithm as rootblock */ - UINT32 protect; /* protection flags (0 by default) */ - UINT8 comm_len; /* file comment length */ - UINT8 comment[79]; /* comment (max. 79 chars permitted) */ - amiga_date date; /* last access date */ - UINT8 name_len; /* hard link name length */ - UINT8 hlname[30]; /* hard link name (max. 30 chars permitted) */ - UINT32 real_entry; /* FFS: pointer to "real" file or directory */ - UINT32 next_link; /* FFS: hardlinks chained list (first == newest */ - UINT32 hash_chain; /* next entry ptr with same hash */ - UINT32 parent; /* parent directory */ - UINT32 sec_type; /* secondary type, ST_LINKFILE/ST_LINKDIR */ -}; - - -struct softlink_block -{ - UINT32 header_key; /* self pointer (to this block) */ - UINT32 chksum; /* same algorithm as rootblock */ - UINT8 symbolic_name[BSIZE-224]; /* path name to referenced object */ - UINT32 protect; /* protection flags (0 by default) */ - UINT8 comm_len; /* file comment length */ - UINT8 comment[79]; /* comment (max. 79 chars permitted) */ - amiga_date date; /* last access date */ - UINT8 name_len; /* soft link name length */ - UINT8 slname[30]; /* soft link name (max. 30 chars permitted) */ - UINT32 hash_chain; /* next entry ptr with same hash */ - UINT32 parent; /* parent directory */ -}; - - -/* Basic Amiga floppy disk image info */ -struct amiga_floppy -{ - imgtool_stream *stream; - UINT8 sectors; -}; - - -/* iterator used to walk through directory entries */ -struct amiga_iterator -{ - unsigned int index; /* current file index */ - int block; /* block number we are iterating */ - UINT32 next_block; /* next block in hash chain */ - int ht_index; /* current index in the hash table */ - unsigned int eof : 1; /* end of file listing reached? */ -}; - - -/***************************************************************************** - Prototypes -*****************************************************************************/ - - -static imgtoolerr_t amiga_image_read_sector(imgtool_image* img, - UINT32 track, UINT32 head, UINT32 sector, void *buf, size_t len); -static imgtoolerr_t amiga_image_write_sector(imgtool_image* img, - UINT32 track, UINT32 head, UINT32 sector, const void *buf, size_t len, int ddam); - - - -/***************************************************************************** - Utility functions -*****************************************************************************/ - - -/* Amiga version of the toupper function */ -static int intl_toupper(int c) -{ - return (c>='a' && c<='z') || (c>=224 && c<=254 && c!=247) ? c - ('a'-'A') : c ; -} - - -/* Amiga filename case insensitive string compare */ -static int intl_stricmp(const char *s1, const char *s2) -{ - for (;;) - { - int c1 = intl_toupper(*s1++); - int c2 = intl_toupper(*s2++); - - if (c1 == 0 || c1 != c2) - return c1 - c2; - } -} - - -/* Calculate the hash value for a filename */ -static int hash_name(const char *name, int intl) -{ - int i, l = strlen(name); - UINT32 hash = l; - - for(i = 0; i < l; i++) - { - hash *= 13; - hash += (UINT8) (intl ? intl_toupper(name[i]) : toupper(name[i])); - hash &= 0x7ff; - } - - return hash % TSIZE; /* 0 < hash < 71 in case of BSIZE=512 */ -} - - -/* Returns TRUE if year is a leap year */ -static int is_leap(int year) -{ - return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); -} - - -/* Convert amiga time to standard time */ -static time_t amiga_crack_time(amiga_date *date) -{ - int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - int year = 1978, month = 1, year_days = 365; /* base date */ - int day = date->days; - struct tm t; - - /* initialize struct */ - memset(&t, 0, sizeof(t)); - - /* first calculate the year */ - while (day >= year_days) - { - day -= year_days; - year_days = is_leap(++year) ? 366 : 365; - } - - /* then the month */ - while(day >= month_days[month-1]) - { - day -= month_days[month-1]; - if (month == 2 && is_leap(year)) - day -= 1; - month++; - } - - /* fill the struct with our calculated values */ - t.tm_year = year - 1900; - t.tm_mon = month - 1; - t.tm_mday = day + 1; - t.tm_hour = date->mins / 60; - t.tm_min = date->mins % 60; - t.tm_sec = date->ticks / 50; - - return mktime(&t); -} - - -/* convert standard time to amiga time */ -static void amiga_setup_time(time_t time, amiga_date *dest) -{ - struct tm t = *localtime(&time); - int year; - - dest->days = 0; - - for (year = 1978; year < t.tm_year + 1900; year++) - { - dest->days += is_leap(year) ? 366 : 365; - } - - dest->days += t.tm_yday; - dest->mins = t.tm_hour * 60 + t.tm_min; - dest->ticks = t.tm_sec * 50; -} - - -/* convert flags to human readable form */ -static void amiga_decode_flags(UINT32 flags, char *dest) -{ - /* test for flags */ - dest[0] = (flags & 0x80) ? 'h' : '-'; - dest[1] = (flags & 0x40) ? 's' : '-'; - dest[2] = (flags & 0x20) ? 'p' : '-'; - dest[3] = (flags & 0x10) ? 'a' : '-'; - dest[4] = (flags & 0x08) ? '-' : 'r'; - dest[5] = (flags & 0x04) ? '-' : 'w'; - dest[6] = (flags & 0x02) ? '-' : 'e'; - dest[7] = (flags & 0x01) ? '-' : 'd'; - dest[8] = '\0'; -} - - -static void copy_integer_array_be(UINT32 *dest, const UINT32 *source, int size) -{ - int i; - - for (i = 0; i < size; i++) - { - dest[i] = BIG_ENDIANIZE_INT32(source[i]); - } -} - - -/* This function converts an array of UINT32s to an amiga_date */ -static void copy_date_be(amiga_date *dest, const UINT32 *source) -{ - dest->days = BIG_ENDIANIZE_INT32(source[0]); - dest->mins = BIG_ENDIANIZE_INT32(source[1]); - dest->ticks = BIG_ENDIANIZE_INT32(source[2]); -} - - -/* Calculate the block checksum of a byte array */ -static UINT32 block_checksum(UINT8 *buffer, int length) -{ - UINT32 chksum = 0; - int i; - - for (i = 0; i < length/4; i++) - { - chksum += pick_integer_be(buffer, i*4, 4); - } - - return -chksum; -} - - -/* Returns the total number of blocks in the image */ -static int get_total_blocks(imgtool_image *img) -{ - amiga_floppy *f = (amiga_floppy *)imgtool_image_extra_bytes(img); - - return 2 * 80 * f->sectors; -} - - -/* Returns track, head and sector for a block */ -static void find_block(amiga_floppy *f, int block, int *track, - int *head, int *sector) -{ - *track = block / f->sectors; - *head = (block - *track * f->sectors) / f->sectors; - *sector = (block - *track * f->sectors) % f->sectors; -} - - -/* Generic read block */ -static imgtoolerr_t read_block(imgtool_image *img, int block, UINT8 *buffer) -{ - imgtoolerr_t ret; - int track, head, sector; - - find_block((amiga_floppy *) imgtool_image_extra_bytes(img), block, &track, &head, §or); - - /* get block from image */ - ret = amiga_image_read_sector(img, track, head, sector, buffer, BSIZE); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -/* Generic write block */ -static imgtoolerr_t write_block(imgtool_image *img, int block, const UINT8 *buffer) -{ - imgtoolerr_t ret; - int track, head, sector; - - find_block((amiga_floppy *) imgtool_image_extra_bytes(img), block, &track, &head, §or); - - /* write block to image */ - ret = amiga_image_write_sector(img, track, head, sector, buffer, BSIZE, 0); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -/* Return the type a block */ -static sec_type get_block_type(imgtool_image *img, int block) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* get data */ - ret = read_block(img, block, buffer); - if (ret) return ST_INVALID; - - /* return type */ - switch ((INT32) pick_integer_be(buffer, BSIZE-4, 4)) - { - case 1: return ST_ROOT; - case 2: return ST_USERDIR; - case -3: return ST_FILE; - case -4: return ST_LINKFILE; - case 4: return ST_LINKDIR; - case 3: return ST_SOFTLINK; - default: return ST_INVALID; - } -} - - -/* Read a bitmap block */ -static imgtoolerr_t read_bitmap_block(imgtool_image *img, int block, bitmap_block *bm) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* fill in data */ - bm->chksum = pick_integer_be(buffer, 0, 4); - copy_integer_array_be(bm->map, (UINT32 *) &buffer[4], MSIZE); - - return IMGTOOLERR_SUCCESS; -} - - -/* Write a bitmap block */ -static imgtoolerr_t write_bitmap_block(imgtool_image *img, int block, const bitmap_block *bm) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* Setup buffer */ - place_integer_be(buffer, 0, 4, bm->chksum); - copy_integer_array_be((UINT32 *) &buffer[4], bm->map, MSIZE); - - /* write block */ - ret = write_block(img, block, buffer); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -#ifdef UNUSED_FUNCTION -/* Read a bitmap extended block */ -static imgtoolerr_t read_bitmap_ext_block(imgtool_image *img, int block, bitmap_ext_block *bm) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* fill in data */ - copy_integer_array_be(bm->map, (UINT32 *) &buffer, MSIZE); - bm->next = pick_integer_be(buffer, BSIZE-4, 4); - - return IMGTOOLERR_SUCCESS; -} -#endif - - -/* Read the root block */ -static imgtoolerr_t read_root_block(imgtool_image *img, root_block *root) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* get raw root block from image */ - ret = read_block(img, get_total_blocks(img)/2, buffer); - if (ret) return ret; - - /* copy data to root_block */ - memset(root, 0, sizeof(root_block)); - - root->ht_size = pick_integer_be(buffer, 12, 4); - root->chksum = pick_integer_be(buffer, 20, 4); - copy_integer_array_be(root->ht, (UINT32 *) &buffer[24], TSIZE); - root->bm_flag = pick_integer_be(buffer, BSIZE-200, 4); - copy_integer_array_be(root->bm_pages, (UINT32 *) &buffer[BSIZE-196], 25); - copy_date_be(&root->r, (UINT32 *) &buffer[BSIZE-92]); - root->name_len = pick_integer_be(buffer, BSIZE-80, 1); - memcpy(root->diskname, &buffer[BSIZE-79], 30); - copy_date_be(&root->v, (UINT32 *) &buffer[BSIZE-40]); - copy_date_be(&root->c, (UINT32 *) &buffer[BSIZE-28]); - root->extension = pick_integer_be(buffer, BSIZE-8, 4); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t write_root_block(imgtool_image *img, const root_block *root) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* Setup buffer */ - memset(buffer, 0, BSIZE); - - place_integer_be(buffer, 0, 4, T_HEADER); - place_integer_be(buffer, 12, 4, root->ht_size); - place_integer_be(buffer, 20, 4, root->chksum); - copy_integer_array_be((UINT32 *) &buffer[24], root->ht, TSIZE); - place_integer_be(buffer, BSIZE-200, 4, root->bm_flag); - copy_integer_array_be((UINT32 *) &buffer[BSIZE-196], root->bm_pages, 25); - place_integer_be(buffer, BSIZE-92, 4, root->r.days); - place_integer_be(buffer, BSIZE-88, 4, root->r.mins); - place_integer_be(buffer, BSIZE-84, 4, root->r.ticks); - place_integer_be(buffer, BSIZE-80, 1, root->name_len); - memcpy(&buffer[BSIZE-79], root->diskname, root->name_len); - place_integer_be(buffer, BSIZE-40, 4, root->v.days); - place_integer_be(buffer, BSIZE-36, 4, root->v.mins); - place_integer_be(buffer, BSIZE-32, 4, root->v.ticks); - place_integer_be(buffer, BSIZE-28, 4, root->c.days); - place_integer_be(buffer, BSIZE-24, 4, root->c.mins); - place_integer_be(buffer, BSIZE-20, 4, root->c.ticks); - place_integer_be(buffer, BSIZE-8, 4, root->extension); - place_integer_be(buffer, BSIZE-4, 4, ST_ROOT); - - /* write root block to image */ - ret = write_block(img, get_total_blocks(img)/2, buffer); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -/* Read a file block */ -static imgtoolerr_t read_file_block(imgtool_image *img, int block, file_block *fb) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* fill in data */ - fb->header_key = pick_integer_be(buffer, 4, 4); - fb->high_seq = pick_integer_be(buffer, 8, 4); - fb->first_data = pick_integer_be(buffer, 16, 4); - fb->chksum = pick_integer_be(buffer, 20, 4); - copy_integer_array_be(fb->data_blocks, (UINT32 *) &buffer[24], TSIZE); - fb->uid = pick_integer_be(buffer, BSIZE-196, 2); - fb->gid = pick_integer_be(buffer, BSIZE-194, 2); - fb->protect = pick_integer_be(buffer, BSIZE-192, 4); - fb->byte_size = pick_integer_be(buffer, BSIZE-188, 4); - fb->comm_len = pick_integer_be(buffer, BSIZE-184, 1); - memcpy(fb->comment, &buffer[BSIZE-183], 79); - copy_date_be(&fb->date, (UINT32 *) &buffer[BSIZE-92]); - fb->name_len = pick_integer_be(buffer, BSIZE-80, 1); - memcpy(fb->filename, (UINT32 *) &buffer[BSIZE-79], 30); - fb->real_entry = pick_integer_be(buffer, BSIZE-44, 4); - fb->next_link = pick_integer_be(buffer, BSIZE-40, 4); - fb->hash_chain = pick_integer_be(buffer, BSIZE-16, 4); - fb->parent = pick_integer_be(buffer, BSIZE-12, 4); - fb->extension = pick_integer_be(buffer, BSIZE-8, 4); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t read_file_ext_block(imgtool_image *img, int block, file_ext_block *fe) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* fill in data */ - fe->header_key = pick_integer_be(buffer, 4, 4); - fe->high_seq = pick_integer_be(buffer, 8, 4); - fe->chksum = pick_integer_be(buffer, 20, 4); - copy_integer_array_be(fe->data_blocks, (UINT32 *) &buffer[24], TSIZE); - fe->parent = pick_integer_be(buffer, BSIZE-12, 4); - fe->extension = pick_integer_be(buffer, BSIZE-8, 4); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t read_data_block(imgtool_image *img, int block, data_block *d) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* fill in data */ - d->header_key = pick_integer_be(buffer, 4, 4); - d->seq_num = pick_integer_be(buffer, 8, 4); - d->data_size = pick_integer_be(buffer, 12, 4); - d->next_data = pick_integer_be(buffer, 16, 4); - d->chksum = pick_integer_be(buffer, 20, 4); - memcpy(d->data, &buffer[24], BSIZE-24); - - return IMGTOOLERR_SUCCESS; -} - - -/* Read a directory block */ -static imgtoolerr_t read_dir_block(imgtool_image *img, int block, dir_block *db) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* fill in data */ - db->header_key = pick_integer_be(buffer, 4, 4); - db->chksum = pick_integer_be(buffer, 20, 4); - copy_integer_array_be(db->ht, (UINT32 *) &buffer[24], TSIZE); - db->uid = pick_integer_be(buffer, BSIZE-196, 2); - db->gid = pick_integer_be(buffer, BSIZE-194, 2); - db->protect = pick_integer_be(buffer, BSIZE-192, 4); - db->comm_len = pick_integer_be(buffer, BSIZE-184, 1); - memcpy(db->comment, &buffer[BSIZE-183], 79); - copy_date_be(&db->date, (UINT32 *) &buffer[BSIZE-92]); - db->name_len = pick_integer_be(buffer, BSIZE-80, 1); - memcpy(db->dirname, (UINT32 *) &buffer[BSIZE-79], 30); - db->next_link = pick_integer_be(buffer, BSIZE-40, 4); - db->hash_chain = pick_integer_be(buffer, BSIZE-16, 4); - db->parent = pick_integer_be(buffer, BSIZE-12, 4); - db->extension = pick_integer_be(buffer, BSIZE-8, 4); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t write_dir_block(imgtool_image *img, int block, const dir_block *db) -{ - UINT8 buffer[BSIZE]; - - /* Setup buffer */ - memset(buffer, 0, BSIZE); - - /* Copy data */ - place_integer_be(buffer, 0, 4, T_HEADER); - place_integer_be(buffer, 4, 4, db->header_key); - place_integer_be(buffer, 20, 4, db->chksum); - copy_integer_array_be((UINT32 *) &buffer[24], db->ht, TSIZE); - place_integer_be(buffer, BSIZE-196, 2, db->uid); - place_integer_be(buffer, BSIZE-194, 2, db->gid); - place_integer_be(buffer, BSIZE-192, 4, db->protect); - place_integer_be(buffer, BSIZE-184, 1, db->comm_len); - memcpy((UINT32 *) &buffer[BSIZE-183], db->comment, db->comm_len); - place_integer_be(buffer, BSIZE-92, 4, db->date.days); - place_integer_be(buffer, BSIZE-88, 4, db->date.mins); - place_integer_be(buffer, BSIZE-84, 4, db->date.ticks); - place_integer_be(buffer, BSIZE-80, 1, db->name_len); - memcpy((UINT32 *) &buffer[BSIZE-79], db->dirname, db->name_len); - place_integer_be(buffer, BSIZE-40, 4, db->next_link); - place_integer_be(buffer, BSIZE-16, 4, db->hash_chain); - place_integer_be(buffer, BSIZE-12, 4, db->parent); - place_integer_be(buffer, BSIZE-8, 4, db->extension); - place_integer_be(buffer, BSIZE-4, 4, ST_USERDIR); - - /* Write block to disk */ - return write_block(img, block, buffer); -} - - -static imgtoolerr_t read_hardlink_block(imgtool_image *img, int block, hardlink_block *hl) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* fill in data */ - hl->header_key = pick_integer_be(buffer, 4, 4); - hl->chksum = pick_integer_be(buffer, 20, 4); - hl->protect = pick_integer_be(buffer, BSIZE-192, 4); - hl->comm_len = pick_integer_be(buffer, BSIZE-184, 1); - memcpy(hl->comment, &buffer[BSIZE-183], 79); - copy_date_be(&hl->date, (UINT32 *) &buffer[BSIZE-92]); - hl->name_len = pick_integer_be(buffer, BSIZE-80, 1); - memcpy(hl->hlname, (UINT32 *) &buffer[BSIZE-79], 30); - hl->real_entry = pick_integer_be(buffer, BSIZE-44, 4); - hl->next_link = pick_integer_be(buffer, BSIZE-40, 4); - hl->hash_chain = pick_integer_be(buffer, BSIZE-16, 4); - hl->parent = pick_integer_be(buffer, BSIZE-12, 4); - hl->sec_type = pick_integer_be(buffer, BSIZE-4, 4); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t read_softlink_block(imgtool_image *img, int block, softlink_block *sl) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* fill in data */ - sl->header_key = pick_integer_be(buffer, 4, 4); - sl->chksum = pick_integer_be(buffer, 20, 4); - memcpy(sl->symbolic_name, &buffer[24], BSIZE-224); - sl->protect = pick_integer_be(buffer, BSIZE-192, 4); - sl->comm_len = pick_integer_be(buffer, BSIZE-184, 1); - memcpy(sl->comment, &buffer[BSIZE-183], 79); - copy_date_be(&sl->date, (UINT32 *) &buffer[BSIZE-92]); - sl->name_len = pick_integer_be(buffer, BSIZE-80, 1); - memcpy(sl->slname, (UINT32 *) &buffer[BSIZE-79], 30); - sl->hash_chain = pick_integer_be(buffer, BSIZE-16, 4); - sl->parent = pick_integer_be(buffer, BSIZE-12, 4); - - return IMGTOOLERR_SUCCESS; -} - - -/* Returns the disk type */ -static disk_type get_disk_type(imgtool_image *img) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - ret = read_block(img, 0, buffer); - if (ret) return DT_UNKNOWN; - - switch(buffer[3]) - { - case 0: return DT_OFS; - case 1: return DT_FFS; - case 2: return DT_OFS_INTL; - case 3: return DT_FFS_INTL; - case 4: return DT_OFS_INTL_DIRC; - case 5: return DT_FFS_INTL_DIRC; - default: return DT_UNKNOWN; - } -} - - -/* Returns TRUE if the disk is formatted with the FastFileSystem */ -static int is_ffs(imgtool_image *img) -{ - disk_type t = get_disk_type(img); - - return ((t == DT_FFS || - t == DT_FFS_INTL || - t == DT_FFS_INTL_DIRC) ? TRUE : FALSE); -} - - -/* Returns TRUE if the disk uses the international mode */ -static int is_intl(imgtool_image *img) -{ - disk_type t = get_disk_type(img); - - return ((t == DT_OFS_INTL || - t == DT_FFS_INTL || - t == DT_OFS_INTL_DIRC || - t == DT_FFS_INTL_DIRC) ? TRUE : FALSE); -} - -#ifdef UNUSED_FUNCTION -/* Returns TRUE if the disk uses the directory cache mode */ -static int is_dirc(imgtool_image *img) -{ - disk_type t = get_disk_type(img); - - return ((t == DT_OFS_INTL_DIRC || - t == DT_FFS_INTL_DIRC) ? TRUE : FALSE); -} -#endif - -static imgtoolerr_t get_hash_table(imgtool_image *img, int block, UINT32 *ht) -{ - imgtoolerr_t ret; - - switch (get_block_type(img, block)) - { - case ST_USERDIR: - { - dir_block dir; - - /* get the directory block */ - ret = read_dir_block(img, block, &dir); - if (ret) return ret; - - /* copy data */ - memcpy(ht, &dir.ht, TSIZE*4); - - return IMGTOOLERR_SUCCESS; - } - - case ST_ROOT: - { - root_block root; - - /* get the root block */ - ret = read_root_block(img, &root); - if (ret) return ret; - - /* copy data */ - memcpy(ht, &root.ht, TSIZE*4); - - return IMGTOOLERR_SUCCESS; - } - - default: - return IMGTOOLERR_UNEXPECTED; - } -} - - -static imgtoolerr_t set_hash_table(imgtool_image *img, int block, const UINT32 *ht) -{ - UINT8 buffer[BSIZE]; - imgtoolerr_t ret; - - /* Read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* Copy new hash table into it */ - copy_integer_array_be((UINT32 *) &buffer[24], ht, TSIZE); - - /* Write it back again */ - ret = write_block(img, block, buffer); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - -#ifdef UNUSED_FUNCTION -static imgtoolerr_t get_root_hash_table(imgtool_image *img, UINT32 *ht) -{ - return get_hash_table(img, get_total_blocks(img)/2, ht); -} -#endif - -static imgtoolerr_t get_blockname(imgtool_image *img, int block, char *dest) -{ - UINT8 buffer[BSIZE]; - imgtoolerr_t ret; - - /* Read the block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* Copy filename out of the buffer */ - memset(dest, 0, 31); - memcpy(dest, &buffer[BSIZE-79], buffer[BSIZE-80]); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t get_hash_chain(imgtool_image *img, int block, UINT32 *chain) -{ - UINT8 buffer[BSIZE]; - imgtoolerr_t ret; - - /* Read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* Get chain value */ - *chain = pick_integer_be(buffer, BSIZE-16, 4); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t set_hash_chain(imgtool_image *img, int block, UINT32 chain) -{ - UINT8 buffer[BSIZE]; - imgtoolerr_t ret; - - /* Read block */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* Copy new hash chain value into it */ - place_integer_be(buffer, BSIZE-16, 4, chain); - - /* Write it back again */ - ret = write_block(img, block, buffer); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t walk_hash_chain(imgtool_image *img, const char *path, int start_block, int *prev_block, int *block) -{ - imgtoolerr_t err; - UINT32 hash_chain; - char name[31]; - - /* choose compare function depending on intl mode */ - int (*cmp)(const char *, const char *) = is_intl(img) ? &intl_stricmp : &core_stricmp; - - /* initialize filenames */ - memset(name, 0, sizeof(name)); - - switch (get_block_type(img, start_block)) - { - case ST_USERDIR: - { - dir_block dir; - - /* read block */ - err = read_dir_block(img, start_block, &dir); - if (err) return err; - - /* copy filename string and next hash */ - memcpy(name, dir.dirname, dir.name_len); - hash_chain = dir.hash_chain; - - break; - } - - case ST_FILE: - { - file_block file; - - /* read block */ - err = read_file_block(img, start_block, &file); - if (err) return err; - - /* copy filename string and next hash */ - memcpy(name, file.filename, file.name_len); - hash_chain = file.hash_chain; - - break; - } - - case ST_SOFTLINK: - { - softlink_block sl; - - /* read block */ - err = read_softlink_block(img, start_block, &sl); - if (err) return err; - - /* copy filename string and next hash */ - memcpy(name, sl.slname, sl.name_len); - hash_chain = sl.hash_chain; - - break; - } - - case ST_LINKDIR: - case ST_LINKFILE: - { - hardlink_block hl; - - /* read block */ - err = read_hardlink_block(img, start_block, &hl); - if (err) return err; - - /* copy filename string and next hash */ - memcpy(name, hl.hlname, hl.name_len); - hash_chain = hl.hash_chain; - break; - } - - default: - return IMGTOOLERR_UNEXPECTED; - - } - - /* if we haven't found the right filename but there are linked entries, - * walk up the chain */ - if ((*cmp)(name, path) != 0 && hash_chain != 0) - { - *prev_block = start_block; - return walk_hash_chain(img, path, hash_chain, prev_block, block); - } - - /* found the correct block, return */ - if ((*cmp)(name, path) == 0) - { - *block = start_block; - return IMGTOOLERR_SUCCESS; - } - - /* we should never get here */ - return IMGTOOLERR_UNEXPECTED; -} - - -/* Returns the block number for a dir/file/link entry given as NUL delimited - * list of path parts, for example "dir1\0dir2\0dir3" returns the block number - * for directory "dir3" */ -static imgtoolerr_t find_entry(imgtool_image *img, const char *path, int start_block, int *block) -{ - imgtoolerr_t ret; - const char *next_path; - int current_block, prev; - UINT32 ht[TSIZE]; - - /* get the hash table */ - ret = get_hash_table(img, start_block, ht); - if (ret) return ret; - - /* calculate hash and get block for initial entry */ - current_block = ht[hash_name(path, is_intl(img))]; - - /* check if there was a match in the hash table */ - if (current_block == 0) - { - return IMGTOOLERR_PATHNOTFOUND; - } - - /* walk the linked hash list */ - ret = walk_hash_chain(img, path, current_block, &prev, block); - if (ret) return ret; - - /* follow links */ - switch (get_block_type(img, *block)) - { - case ST_SOFTLINK: - - /* TODO: Softlink support */ - return IMGTOOLERR_UNIMPLEMENTED; - - case ST_LINKDIR: - case ST_LINKFILE: - { - hardlink_block hl; - - ret = read_hardlink_block(img, *block, &hl); - if (ret) return ret; - - *block = hl.real_entry; - - break; - } - - default: - break; - } - - /* get next path part */ - next_path = path + strlen(path) + 1; - - /* if there are more path parts, search the next block */ - if (next_path[0]) - { - return find_entry(img, next_path, *block, block); - } - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t get_block_chksum(imgtool_image *img, int block, UINT32 *chksum, int bitmap) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* get block data */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* clear old checksum */ - if (bitmap) - { - memset(buffer, 0, 4); - } - else - { - memset(&buffer[20], 0, 4); - } - - /* calulate checksum */ - *chksum = block_checksum(buffer, BSIZE); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t fix_chksum(imgtool_image *img, int block, int bitmap) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - UINT32 chksum; - - /* calculate block checksum */ - ret = get_block_chksum(img, block, &chksum, bitmap); - if (ret) return ret; - - /* read block data */ - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* update checksum */ - if (bitmap) - { - place_integer_be(buffer, 0, 4, chksum); - } - else - { - place_integer_be(buffer, 20, 4, chksum); - } - - /* write back new block data */ - ret = write_block(img, block, buffer); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t fix_block_chksum(imgtool_image *img, int block) -{ - return fix_chksum(img, block, FALSE); -} - - -static imgtoolerr_t fix_bitmap_chksum(imgtool_image *img, int block) -{ - return fix_chksum(img, block, TRUE); -} - - -/* Set a block as used */ -static imgtoolerr_t bitmap_mark(imgtool_image *img, int block, int used) -{ - imgtoolerr_t ret; - bitmap_block bm; - root_block root; - int page; - - block -= 2; /* subtract boot block sectors, 2 only for floppies! */ - - ret = read_root_block(img, &root); - if (ret) return ret; - - /* figure out bitmap block location */ - page = root.bm_pages[block / (MSIZE * 32)]; - - /* get bitmap */ - ret = read_bitmap_block(img, page, &bm); - if (ret) return ret; - - /* subtract pages we skip */ - block -= MSIZE * 32 * (block / (MSIZE * 32)); - - /* mark as used or free */ - if (used) - { - bm.map[block/32] &= ~(1 << block % 32); - } - else - { - bm.map[block/32] |= (1 << block % 32); - } - - /* write changed bitmap block back to disk */ - ret = write_bitmap_block(img, page, &bm); - if (ret) return ret; - - /* update checksum */ - ret = fix_bitmap_chksum(img, page); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t bitmap_mark_used(imgtool_image *img, int block) -{ - return bitmap_mark(img, block, TRUE); -} - - -static imgtoolerr_t bitmap_mark_free(imgtool_image *img, int block) -{ - return bitmap_mark(img, block, FALSE); -} - - -static imgtoolerr_t update_block_modified_date(imgtool_image *img, int block) -{ - UINT8 buffer[BSIZE]; - imgtoolerr_t ret; - amiga_date date; - time_t now; - - ret = read_block(img, block, buffer); - if (ret) return ret; - - /* Set new time */ - time(&now); - amiga_setup_time(now, &date); - - /* Write new time into block */ - place_integer_be(buffer, BSIZE-92, 4, date.days); - place_integer_be(buffer, BSIZE-88, 4, date.mins); - place_integer_be(buffer, BSIZE-84, 4, date.ticks); - - /* Write block back to disk */ - ret = write_block(img, block, buffer); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t clear_hash_table_entry(imgtool_image *img, int parent, char *filename) -{ - imgtoolerr_t ret; - UINT32 ht[TSIZE], chain; - int index, entry, prev, block; - - ret = get_hash_table(img, parent, ht); - if (ret) return ret; - - /* Calculate hash and get block for initial entry */ - index = hash_name(filename, is_intl(img)); - entry = ht[index]; - - /* Walk the hash chain to get the real entry */ - ret = walk_hash_chain(img, filename, entry, &prev, &block); - if (ret) return ret; - - /* Get chained value from block */ - ret = get_hash_chain(img, block, &chain); - if (ret) return ret; - - /* Check if we need to change the hash table */ - if (entry == block) - { - /* Set new value (might be 0 if there were no linked entries) */ - ht[index] = chain; - - /* Save changed hash table */ - ret = set_hash_table(img, parent, ht); - if (ret) return ret; - - /* Update last modified date */ - ret = update_block_modified_date(img, parent); - if (ret) return ret; - - /* Calculate new checksum */ - ret = fix_block_chksum(img, parent); - if (ret) return ret; - } - else - { - /* Save chained value to previous chain element */ - ret = set_hash_chain(img, prev, chain); - if (ret) return ret; - - /* Calculate new checksum */ - ret = fix_block_chksum(img, prev); - if (ret) return ret; - } - - /* Mark our block as free */ - ret = bitmap_mark_free(img, block); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -/* Returns the number of the first bit that is set in the array */ -static int get_first_bit(UINT32 *array, int size) -{ - int i; - - for (i = 0; i < size; i++) - { - if (array[i] != 0) - { - UINT32 v = array[i]; - int c; - - /* get first bit that is set */ - for (c = 0; (v & 1) == 0; c++) v >>= 1; - - /* return bit number */ - return i * 32 + c; - } - } - - return -1; -} - - -#ifdef UNUSED_FUNCTION -static imgtoolerr_t walk_bitmap_ext_blocks(imgtool_image *img, int start, int *block) -{ - imgtoolerr_t ret; - bitmap_ext_block bm_ext; - int bit; - - /* if we don't have a valid block, bail out */ - if (start == 0) - { - return IMGTOOLERR_NOSPACE; - } - - /* get the extended bitmap block */ - ret = read_bitmap_ext_block(img, start, &bm_ext); - if (ret) return ret; - - /* get the first bit that is set in the map */ - bit = get_first_bit(bm_ext.map, MSIZE); - - /* if we found one, return */ - if (bit != -1) - { - *block += bit; - return IMGTOOLERR_SUCCESS; - } - - /* increase on each call */ - *block += MSIZE * 32; - - /* else continue walking the list */ - return walk_bitmap_ext_blocks(img, bm_ext.next, block); -} -#endif - - -/* Searches for a block marked as free - * TODO: bm_ext support for HDs */ -static imgtoolerr_t find_free_block(imgtool_image *img, int *block) -{ - imgtoolerr_t ret; - root_block root; - int i; - - /* get root block */ - ret = read_root_block(img, &root); - if (ret) return ret; - - /* iterate bitmap pointers */ - for (i = 0; i < 25; i++) - { - bitmap_block bm; - - /* get bitmap block pointed to */ - ret = read_bitmap_block(img, root.bm_pages[i], &bm); - if (ret) return ret; - - *block = i * 32 * MSIZE + get_first_bit(bm.map, MSIZE); - - if (*block != -1) - { - *block += 2; - return IMGTOOLERR_SUCCESS; - } - } - - /* if we get here we haven't found a free block */ - return IMGTOOLERR_NOSPACE; -} - - -static imgtoolerr_t add_entry(imgtool_image *img, int parent, int block) -{ - imgtoolerr_t ret; - UINT32 ht[TSIZE]; - char name[31]; - int hash; - - ret = get_blockname(img, block, name); - if (ret) return ret; - - ret = get_hash_table(img, parent, ht); - if (ret) return ret; - - hash = hash_name(name, is_intl(img)); - - /* Check if there is already an entry with that name */ - if (ht[hash] != 0) - { - /* Save the old value to our hash chain */ - ret = set_hash_chain(img, block, ht[hash]); - if (ret) return ret; - } - - /* Write our block number into the table */ - ht[hash] = block; - - /* Write table back to disk */ - ret = set_hash_table(img, parent, ht); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -/* Recursively create new directory entries */ -static imgtoolerr_t makedir(imgtool_image *img, const char *path, int parent) -{ - imgtoolerr_t ret; - dir_block dir; - time_t now; - int block; - - if (!path) - { - return IMGTOOLERR_PARAMNEEDED; - } - - if (!path[0]) - { - return IMGTOOLERR_SUCCESS; - } - - /* Get a free block */ - ret = find_free_block(img, &block); - if (ret) return ret; - - /* Initialize entry */ - memset(&dir, 0, sizeof(dir_block)); - - /* Copy data */ - time(&now); - amiga_setup_time(now, &dir.date); - dir.name_len = strlen(path); - memcpy(dir.dirname, path, dir.name_len); - dir.header_key = block; - dir.parent = parent; - - /* Write block */ - ret = write_dir_block(img, block, &dir); - if (ret) return ret; - - /* Fix checksum */ - ret = fix_block_chksum(img, block); - if (ret) return ret; - - /* Link the new entry in the parent */ - ret = add_entry(img, parent, block); - if (ret) return ret; - - /* Mark it as used */ - ret = bitmap_mark_used(img, block); - if (ret) return ret; - - /* Create the next entry */ - return makedir(img, path + strlen(path) + 1, block); -} - - -/* Recursively checks the path parts and creates directories for them */ -static imgtoolerr_t checkdir(imgtool_image *img, const char *path, int parent) -{ - imgtoolerr_t ret; - int block; - char first_part[31]; - - memset(first_part, 0, sizeof(first_part)); - strcpy(first_part, path); - - /* Directories all the way down, bail out */ - if (!path[0]) - { - return IMGTOOLERR_CANNOTUSEPATH; - } - - /* Search for the entry */ - ret = find_entry(img, first_part, parent, &block); - - switch (ret) - { - case IMGTOOLERR_PATHNOTFOUND: - - /* There is no entry with this name yet, so we can just create them */ - return makedir(img, path, parent); - - case IMGTOOLERR_SUCCESS: - - if (get_block_type(img, block) == ST_USERDIR) - { - /* Go down one level */ - return checkdir(img, path + strlen(path) + 1, block); - } - else - { - /* There is an entry but it's not a directory, create it */ - return makedir(img, path, parent); - } - - default: return ret; - } -} - - -/* Writes the file data from the specified block into the stream */ -static imgtoolerr_t write_file_block_data(imgtool_image *img, int block, int size, imgtool_stream *destf) -{ - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - - /* Check if we even need to write something */ - if (size == 0) - { - return IMGTOOLERR_SUCCESS; - } - - if (is_ffs(img)) - { - /* Get block and read directly into buffer */ - ret = read_block(img, block, buffer); - if (ret) return ret; - } - else - { - data_block db; - UINT32 chksum; - - ret = read_data_block(img, block, &db); - if (ret) return ret; - - /* Verify data checksum */ - ret = get_block_chksum(img, block, &chksum, FALSE); - if (ret) return ret; - - if (db.chksum != chksum) - { - return IMGTOOLERR_CORRUPTFILE; - } - - /* Copy data to buffer */ - memcpy(buffer, db.data, size); - } - - /* Write data to stream */ - if (stream_write (destf, buffer, size) != size) - { - return IMGTOOLERR_WRITEERROR; - } - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t walk_data_block_ptr(imgtool_image *img, UINT32 *ptr, int *filesize, imgtool_stream *destf, int write) -{ - int i, blocksize = is_ffs(img) ? BSIZE : BSIZE-24; - imgtoolerr_t ret; - - for (i = TSIZE-1; i >= 0; i--) - { - /* We write either blocksize bytes or whats remaining */ - int bytes_left = (*filesize >= blocksize) ? blocksize : *filesize; - - if (write) - { - ret = write_file_block_data(img, ptr[i], bytes_left, destf); - if (ret) return ret; - } - else - { - ret = bitmap_mark_free(img, ptr[i]); - if (ret) return ret; - } - - *filesize -= bytes_left; - - /* Check if we are finished early */ - if (*filesize == 0) break; - } - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t write_data_block_ptr(imgtool_image *img, UINT32 *ptr, int *filesize, imgtool_stream *destf) -{ - return walk_data_block_ptr(img, ptr, filesize, destf, TRUE); -} - - -/* Marks all blocks pointed to by the data block pointers as free */ -static imgtoolerr_t clear_data_block_ptr(imgtool_image *img, UINT32 *ptr, int *filesize) -{ - return walk_data_block_ptr(img, ptr, filesize, NULL, FALSE); -} - - -static imgtoolerr_t walk_file_ext_data(imgtool_image *img, int block, int *filesize, imgtool_stream *destf, int write) -{ - file_ext_block file_ext; - imgtoolerr_t ret; - - /* Get file extension block */ - ret = read_file_ext_block(img, block, &file_ext); - if (ret) return ret; - - /* Write all data pointers in the table */ - ret = walk_data_block_ptr(img, file_ext.data_blocks, filesize, destf, write); - if (ret) return ret; - - /* Check if we are finished */ - if (*filesize != 0) - { - if (file_ext.extension == 0) - { - /* We are not finished, but there are no more extension blocks */ - return IMGTOOLERR_CORRUPTFILE; - } - else - { - /* Write the next file extension block */ - return walk_file_ext_data(img, file_ext.extension, filesize, destf, write); - } - } - - /* Mark ourself as free if we not writing */ - if (!write) - { - ret = bitmap_mark_free(img, block); - if (ret) return ret; - } - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t write_file_ext_data(imgtool_image *img, int block, int *filesize, imgtool_stream *destf) -{ - return walk_file_ext_data(img, block, filesize, destf, TRUE); -} - - -static imgtoolerr_t clear_file_ext_data(imgtool_image *img, int block, int *filesize) -{ - return walk_file_ext_data(img, block, filesize, NULL, FALSE); -} - - -/* Updates the disk alteration date stored in the root block */ -static imgtoolerr_t update_disk_alteration_date(imgtool_image *img) -{ - imgtoolerr_t ret; - root_block root; - time_t now; - - /* Get root block */ - ret = read_root_block(img, &root); - if (ret) return ret; - - /* Get current time */ - time(&now); - amiga_setup_time(now, &root.v); - - /* Write back new root block */ - ret = write_root_block(img, &root); - if (ret) return ret; - - /* And update its checksum */ - ret = fix_block_chksum(img, get_total_blocks(img)/2); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -/***************************************************************************** - Imgtool functions -*****************************************************************************/ - - -static imgtoolerr_t amiga_image_open(imgtool_image *img, imgtool_stream *stream) -{ - amiga_floppy *f = (amiga_floppy *) imgtool_image_extra_bytes(img); - UINT64 size = stream_size(stream); - - f->stream = stream; - f->sectors = size/BSIZE/80/2; - - if (f->sectors != 11 && f->sectors != 22) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - - return IMGTOOLERR_SUCCESS; -} - - -static void amiga_image_exit(imgtool_image *img) -{ -} - - -static void amiga_image_info(imgtool_image *img, char *string, size_t len) -{ - imgtoolerr_t ret; - root_block root; - char info[255]; - time_t t_c, t_v, t_r; - char c[19], v[19], r[19]; - - ret = read_root_block(img, &root); - if (ret) return; - - t_c = amiga_crack_time(&root.c); - t_v = amiga_crack_time(&root.v); - t_r = amiga_crack_time(&root.r); - - strftime(c, sizeof(c), "%d-%b-%y %H:%M:%S", localtime(&t_c)); - strftime(v, sizeof(v), "%d-%b-%y %H:%M:%S", localtime(&t_v)); - strftime(r, sizeof(r), "%d-%b-%y %H:%M:%S", localtime(&t_r)); - - strcpy(info, "Volume name: "); - strncat(info, (char *)root.diskname, root.name_len); - strcat(info, "\nVolume created: "); - strcat(info, c); - strcat(info, "\nVolume modified: "); - strcat(info, v); - strcat(info, "\n Root modified: "); - strcat(info, r); - - strncpy(string, info, len); -} - - -static imgtoolerr_t amiga_image_read_sector(imgtool_image* img, UINT32 track, UINT32 head, UINT32 sector, void *buf, size_t len) -{ - amiga_floppy *f = (amiga_floppy *) imgtool_image_extra_bytes(img); - - /* skip ahead to the area we want to read */ - stream_seek(f->stream, track * (head+1) * f->sectors * BSIZE + sector * BSIZE, SEEK_CUR); - - if (stream_read(f->stream, buf, len) != len) - { - return IMGTOOLERR_READERROR; - } - - /* reset stream */ - stream_seek(f->stream, 0, 0); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t amiga_image_write_sector(imgtool_image* img, UINT32 track, UINT32 head, UINT32 sector, const void *buf, size_t len, int ddam) -{ - amiga_floppy *f = (amiga_floppy *) imgtool_image_extra_bytes(img); - - /* skip ahead to the area we want to write */ - stream_seek(f->stream, track * (head+1) * f->sectors * BSIZE + sector * BSIZE, SEEK_CUR); - - /* write data */ - if (stream_write(f->stream, buf, len) != len) - { - return IMGTOOLERR_WRITEERROR; - } - - /* reset stream */ - stream_seek(f->stream, 0, 0); - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t amiga_image_get_sector_size(imgtool_image* img, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size) -{ - *sector_size = BSIZE; - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t amiga_image_beginenum(imgtool_directory *enumeration, const char *path) -{ - int blocks = get_total_blocks(imgtool_directory_image(enumeration)); - imgtoolerr_t ret; - amiga_iterator *iter; - - iter = (amiga_iterator *) imgtool_directory_extrabytes(enumeration); - if (!iter) return IMGTOOLERR_OUTOFMEMORY; - - iter->index = 1; - iter->ht_index = 0; - iter->eof = 0; - - if (path[0]) - { - /* search for the directory block, start with the root block */ - ret = find_entry(imgtool_directory_image(enumeration), path, blocks/2, &iter->block); - if (ret) return ret; - } - else - { - /* we didn't get a path, use the root directory */ - iter->block = blocks / 2; - } - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - amiga_iterator *iter = (amiga_iterator *) imgtool_directory_extrabytes(enumeration); - imgtoolerr_t ret; - UINT32 ht[TSIZE]; - int block; - - /* finished listing all entries? */ - if (iter->eof == 1 || iter->ht_index == TSIZE) - { - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - - /* get hash table */ - ret = get_hash_table(imgtool_directory_image(enumeration), iter->block, ht); - if (ret) return ret; - - /* skip empty hash table entries */ - while (ht[iter->ht_index] == 0) - { - iter->ht_index++; - /* check if we are already at the end */ - if (iter->ht_index == TSIZE) - { - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - } - - /* get block number */ - block = (iter->next_block == 0) ? ht[iter->ht_index] : iter->next_block; - - switch (get_block_type(imgtool_directory_image(enumeration), block)) - { - case ST_FILE: - { - file_block file; - - /* get block */ - ret = read_file_block(imgtool_directory_image(enumeration), block, &file); - if (ret) return ret; - - /* fill directory entry */ - strncpyz(ent->filename, (char *)file.filename, file.name_len + 1); - ent->filesize = file.byte_size; - ent->lastmodified_time = amiga_crack_time(&file.date); - amiga_decode_flags(file.protect, ent->attr); - strncpyz(ent->comment, (char *)file.comment, file.comm_len + 1); - - iter->next_block = file.hash_chain; - - break; - } - - case ST_USERDIR: - { - dir_block dir; - - /* get block */ - ret = read_dir_block(imgtool_directory_image(enumeration), block, &dir); - if (ret) return ret; - - /* fill directory entry */ - strncpyz(ent->filename, (char *)dir.dirname, dir.name_len + 1); - ent->lastmodified_time = amiga_crack_time(&dir.date); - amiga_decode_flags(dir.protect, ent->attr); - strncpyz(ent->comment, (char *)dir.comment, dir.comm_len + 1); - ent->directory = 1; - - iter->next_block = dir.hash_chain; - - break; - } - - case ST_SOFTLINK: - { - softlink_block sl; - - /* get block */ - ret = read_softlink_block(imgtool_directory_image(enumeration), block, &sl); - if (ret) return ret; - - /* fill directory entry */ - strncpyz(ent->filename, (char *)sl.slname, sl.name_len + 1); - ent->lastmodified_time = amiga_crack_time(&sl.date); - amiga_decode_flags(sl.protect, ent->attr); - strncpyz(ent->comment, (char *)sl.comment, sl.comm_len + 1); - strcpy(ent->softlink, (char *)sl.symbolic_name); - - iter->next_block = sl.hash_chain; - - break; - } - - case ST_LINKDIR: - - ent->directory = 1; - - case ST_LINKFILE: - { - hardlink_block hl; - - /* get block */ - ret = read_hardlink_block(imgtool_directory_image(enumeration), block, &hl); - if (ret) return ret; - - /* get filesize from linked file */ - if (!ent->directory) - { - file_block file; - ret = read_file_block(imgtool_directory_image(enumeration), hl.real_entry, &file); - if (ret) return ret; - ent->filesize = file.byte_size; - } - - /* fill directory entry */ - strncpyz(ent->filename, (char *)hl.hlname, hl.name_len + 1); - ent->lastmodified_time = amiga_crack_time(&hl.date); - amiga_decode_flags(hl.protect, ent->attr); - strncpyz(ent->comment, (char *)hl.comment, hl.comm_len + 1); - ent->hardlink = 1; - - iter->next_block = hl.hash_chain; - - break; - } - - default: - return IMGTOOLERR_UNIMPLEMENTED; - } - - /* if there are no linked entries, go to the next hash table entry */ - if (iter->next_block == 0) - { - iter->ht_index++; - } - - /* jump to next index */ - iter->index++; - - return IMGTOOLERR_SUCCESS; -} - - -static void amiga_image_closeenum(imgtool_directory *enumeration) -{ - free(enumeration); -} - - -static imgtoolerr_t amiga_image_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtoolerr_t ret; - imgtool_image *image = imgtool_partition_image(partition); - const int data_size = is_ffs(image) ? BSIZE : BSIZE-24; - root_block root; - bitmap_block bm; - int blocks, blocks_processed = 0, pages, i, c; - UINT32 v; - - /* initialize size */ - *size = 0; - - /* get root block */ - ret = read_root_block(image, &root); - if (ret) return ret; - - /* get total number of blocks in the image */ - blocks = get_total_blocks(image); - - /* subtract the two bootblock blocks (only for floppies!) */ - blocks -= 2; - - /* iterate all bitmap pages */ - for (pages = 0; pages < 25; pages++) - { - ret = read_bitmap_block(image, root.bm_pages[pages], &bm); - if (ret) return ret; - - for (i = 0; i < MSIZE; i++) - { - v = bm.map[i]; - - /* clear half used value */ - if ((blocks_processed + 32) > blocks) - v &= ~(~0 << (blocks - blocks_processed)); - - /* count bits */ - for (c = 0; v; c++) - v &= v - 1; - - *size += c * data_size; - - blocks_processed += 32; - - if (blocks_processed >= blocks) - return IMGTOOLERR_SUCCESS; - } - } - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t amiga_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtool_image *img = imgtool_partition_image(partition); - imgtoolerr_t ret; - file_block file; - int filesize, block; - - /* Search for the block number */ - ret = find_entry(img, filename, get_total_blocks(img)/2, &block); - if (ret == IMGTOOLERR_PATHNOTFOUND) return IMGTOOLERR_FILENOTFOUND; - if (ret) return ret; /* Other errors */ - - /* Phase 1: Follow data pointers */ - ret = read_file_block(img, block, &file); - if (ret) return ret; - - filesize = file.byte_size; - - /* Write out file data pointed to by data block pointers */ - ret = write_data_block_ptr(img, file.data_blocks, &filesize, destf); - if (ret) return ret; - - /* Check if we are done already */ - if (filesize == 0) return IMGTOOLERR_SUCCESS; - - /* Phase 2: Follow file extension blocks */ - ret = write_file_ext_data(img, file.extension, &filesize, destf); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -/* When a file is deleted, only its File header block number is cleared from - * the Directory block (or from the same-hash-value list) and the bitmap is - * updated. File header block, Data blocks and File extension blocks are not - * cleared, but the bitmap blocks are updated. */ -static imgtoolerr_t amiga_image_deletefile(imgtool_partition *partition, const char *fname) -{ - imgtool_image *img = imgtool_partition_image(partition); - imgtoolerr_t ret; - int parent, block; - char filename[31]; - - /* Initialize filename */ - memset(filename, 0, sizeof(filename)); - - /* Search for the block number */ - ret = find_entry(img, fname, get_total_blocks(img)/2, &block); - if (ret == IMGTOOLERR_PATHNOTFOUND) return IMGTOOLERR_FILENOTFOUND; - if (ret) return ret; - - /* Get the parent block, where we need to clear the hash */ - switch (get_block_type(img, block)) - { - case ST_FILE: - { - file_block file; - int filesize; - - ret = read_file_block(img, block, &file); - if (ret) return ret; - - filesize = file.byte_size; - parent = file.parent; - memcpy(filename, file.filename, file.name_len); - - /* Clear all linked data sectors */ - ret = clear_data_block_ptr(img, file.data_blocks, &filesize); - if (ret) return ret; - - /* Clear extended file data sectors */ - if (filesize != 0) - { - ret = clear_file_ext_data(img, file.extension, &filesize); - if (ret) return ret; - } - - break; - } - - case ST_LINKFILE: - { - softlink_block link; - - ret = read_softlink_block(img, block, &link); - if (ret) return ret; - - parent = link.parent; - memcpy(filename, link.slname, link.name_len); - - break; - } - - default: - return IMGTOOLERR_UNEXPECTED; - } - - /* Clear hash table entry */ - ret = clear_hash_table_entry(img, parent, filename); - if (ret) return ret; - - /* Update disk alteration date */ - ret = update_disk_alteration_date(img); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t amiga_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - return IMGTOOLERR_UNIMPLEMENTED; -} - - -static imgtoolerr_t amiga_image_create(imgtool_image *img, imgtool_stream *stream, option_resolution *opts) -{ - amiga_floppy *f = (amiga_floppy *) imgtool_image_extra_bytes(img); - const char *dskname = option_resolution_lookup_string(opts, 'N'); - imgtoolerr_t ret; - UINT8 buffer[BSIZE]; - root_block root; - bitmap_block bm; - time_t now; - int blocks; - - f->stream = stream; - - switch (option_resolution_lookup_int(opts, 'S')) - { - case 0: f->sectors = 11; break; - case 1: f->sectors = 22; break; - default: return IMGTOOLERR_PARAMCORRUPT; - } - - /* initialize with zeros */ - memset(buffer, 0, BSIZE); - - /* add DOS magic string and flags */ - buffer[0] = 'D'; - buffer[1] = 'O'; - buffer[2] = 'S'; - buffer[3] = 0; - - /* File system */ - buffer[3] += (option_resolution_lookup_int(opts, 'F')); - - /* File system mode */ - buffer[3] += (option_resolution_lookup_int(opts, 'M')); - - /* write first bootblock sector */ - ret = write_block(img, 0, buffer); - if (ret) return ret; - - /* reset with zeros */ - memset(buffer, 0, BSIZE); - - /* write second bootblock sector */ - ret = write_block(img, 1, buffer); - if (ret) return ret; - - /* rootblock */ - memset(&root, 0, sizeof(root_block)); - - blocks = get_total_blocks(img); - - root.chksum = 0; - root.ht_size = TSIZE; - root.bm_flag = -1; - root.bm_pages[0] = blocks/2 + 1; /* generally it's located here */ - - time(&now); - amiga_setup_time(now, &root.r); - amiga_setup_time(now, &root.v); - amiga_setup_time(now, &root.c); - - /* volume name */ - if (dskname) - { - root.name_len = strlen(dskname); - memcpy(&root.diskname, dskname, root.name_len); - } - else - { - root.name_len = strlen("Empty"); - memcpy(&root.diskname, "Empty", root.name_len); - } - - /* write root block to disk */ - ret = write_root_block(img, &root); - if (ret) return ret; - - /* calculate block checksum */ - ret = fix_block_chksum(img, blocks/2); - if (ret) return ret; - - /* bitmap block */ - memset(&bm, 0xff, sizeof(bitmap_block)); - - /* write bitmap block to disk */ - ret = write_bitmap_block(img, root.bm_pages[0], &bm); - if (ret) return ret; - - /* set root and bitmap block as used */ - ret = bitmap_mark_used(img, blocks/2); - if (ret) return ret; - - ret = bitmap_mark_used(img, root.bm_pages[0]); - if (ret) return ret; - - /* write empty last block so that we don't get a truncated image */ - memset(buffer, 0, BSIZE); - - ret = write_block(img, blocks - 1, buffer); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t amiga_image_createdir(imgtool_partition *partition, const char *path) -{ - imgtool_image *img = imgtool_partition_image(partition); - imgtoolerr_t ret; - - /* Create directories */ - ret = checkdir(img, path, get_total_blocks(img)/2); - if (ret) return ret; - - /* Update disk alteration date */ - ret = update_disk_alteration_date(img); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t amiga_image_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) -{ - return IMGTOOLERR_UNIMPLEMENTED; -} - - -static imgtoolerr_t amiga_image_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) -{ - return IMGTOOLERR_UNIMPLEMENTED; -} - - -static imgtoolerr_t amiga_image_geticoninfo(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo) -{ - return IMGTOOLERR_UNIMPLEMENTED; -} - - -static imgtoolerr_t amiga_image_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) -{ - return IMGTOOLERR_UNIMPLEMENTED; -} - - - -/***************************************************************************** - Create image options -*****************************************************************************/ - - -static OPTION_GUIDE_START(amiga_createimage_optionguide) - OPTION_STRING( 'N', "name", "Volume name" ) - OPTION_ENUM_START( 'S', "density", "Density" ) - OPTION_ENUM( 0, "dd", "Double Density" ) - OPTION_ENUM( 1, "hd", "High Density" ) - OPTION_ENUM_END - OPTION_ENUM_START( 'F', "filesystem", "File system" ) - OPTION_ENUM( 0, "ofs", "OldFileSystem" ) - OPTION_ENUM( 1, "ffs", "FastFileSystem" ) - OPTION_ENUM_END - OPTION_ENUM_START( 'M', "mode", "File system options" ) - OPTION_ENUM( 0, "none", "None" ) - OPTION_ENUM( 2, "intl", "International Mode" ) - OPTION_ENUM( 4, "dirc", "International Mode with Directory Cache" ) - OPTION_ENUM_END -OPTION_GUIDE_END - - - -/***************************************************************************** - Imgtool module declaration -*****************************************************************************/ - - -/* Amiga floppy disk attributes */ -void amiga_floppy_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(amiga_floppy); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(amiga_iterator); break; - case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break; - case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break; - case IMGTOOLINFO_INT_CHARSET: info->i = IMGTOOL_CHARSET_ISO_8859_1; break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "amiga_floppy"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Amiga floppy disk image (OFS/FFS format)"); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "adf"); break; - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), EOLN_LF); break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "S[0]-1;F[0]-1;M[0]/2/4"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_OPEN: info->open = amiga_image_open; break; - case IMGTOOLINFO_PTR_CLOSE: info->close = amiga_image_exit; break; - case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = amiga_image_read_sector; break; - case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = amiga_image_write_sector; break; - case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = amiga_image_get_sector_size; break; - case IMGTOOLINFO_PTR_CREATE: info->create = amiga_image_create; break; - case IMGTOOLINFO_PTR_INFO: info->info = amiga_image_info; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = amiga_image_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = amiga_image_nextenum; break; - case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = amiga_image_closeenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = amiga_image_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = amiga_image_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = amiga_image_writefile; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = amiga_image_deletefile; break; - case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = amiga_image_createdir; break; - case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = amiga_image_getattrs; break; - case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = amiga_image_setattrs; break; - case IMGTOOLINFO_PTR_GET_ICON_INFO: info->get_iconinfo = amiga_image_geticoninfo; break; - case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = amiga_image_suggesttransfer; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = amiga_createimage_optionguide; break; - } -} diff --git a/src/mess/tools/imgtool/modules/bml3.c b/src/mess/tools/imgtool/modules/bml3.c deleted file mode 100644 index 1ed1b645f69..00000000000 --- a/src/mess/tools/imgtool/modules/bml3.c +++ /dev/null @@ -1,928 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Jonathan Edwards -/**************************************************************************** - - bml3.c - - Hitachi bml3 disk images - - By Jonathan Edwards, based on rsdos.c (both use Microsoft BASIC) - -****************************************************************************/ - -/* Supported Hitachi floppy formats are: - - 3" or 5"1/4 single density, single-sided: 40 tracks, 16 sectors/track, 128 bytes/sector - - (used with MP-1805 floppy disk controller card) - - 5"1/4 double density, double-sided: 40 tracks, 16 sectors/track, 256 bytes/sector - - (first track on first head may be single density) - - (used with MP-1802 floppy disk controller card) -*/ - -#include -#include -#include -#include "imgtool.h" -#include "iflopimg.h" - -#define MAX_SECTOR_SIZE 256 - -struct bml3_diskinfo -{ - UINT16 sector_size; /* 128 or 256 */ - UINT8 heads; /* 1 or 2 */ - UINT8 fat_start_sector; /* in cylinder 20, start sector of FAT */ - UINT8 fat_start_offset; /* start byte of FAT in sector */ - UINT8 fat_sectors; /* the number of sectors in the FAT */ - UINT8 dirent_start_sector; /* in cylinder 20, start sector of directory entries */ - UINT8 granule_sectors; /* how many sectors per granule */ - UINT8 first_granule_cylinder; /* the number of the first cylinder with granule numbers assigned */ - UINT8 variant; /* 0 - older version, uses EOF to terminate files, 1 - newer version, stores file length */ -}; - -/* this structure mirrors the structure of a directory entry on disk */ -struct bml3_dirent -{ - char fname[8]; - char fext[3]; - UINT8 ftype; - UINT8 asciiflag; - UINT8 first_granule; - UINT16 lastsectorbytes; - // TODO there are some 'unused' bytes here that are sometimes used to store a timestamp, maybe support this? -}; - -struct bml3_direnum -{ - int index; - int eof; -}; - -#define MAX_GRANULEMAP_SIZE 256 - -struct granule_list_t { - UINT8 granules[MAX_GRANULEMAP_SIZE]; - UINT8 granule_count; - UINT8 last_granule_sectors; -}; - -#define BML3_OPTIONS_FTYPE 'T' -#define BML3_OPTIONS_ASCII 'M' - -static imgtoolerr_t bml3_diskimage_deletefile(imgtool_partition *partition, const char *fname); - - - -/********************************************************************* - Imgtool module code -*********************************************************************/ - -static bml3_diskinfo *bml3_get_diskinfo(imgtool_image *image) -{ - return (bml3_diskinfo *) imgtool_floppy_extrabytes(image); -} - - - -static int max_dirents(imgtool_image *image) -{ - bml3_diskinfo *info = bml3_get_diskinfo(image); - return (16 * info->heads + 1 - info->dirent_start_sector)*(info->sector_size/32); -} - - - -static void dirent_location(imgtool_image *image, int index_loc, UINT8 *head, UINT8 *track, UINT8 *sector, UINT8 *offset) -{ - bml3_diskinfo *info = bml3_get_diskinfo(image); - *track = 20; - *sector = info->dirent_start_sector + index_loc / (info->sector_size / 32); - *head = 0; - if (*sector > 16) { - // wrap to second head - *sector -= 16; - (*head)++; - } - *offset = index_loc % (info->sector_size/32) * 32; -} - - - -static floperr_t get_bml3_dirent(imgtool_image *f, int index_loc, struct bml3_dirent *ent) -{ - floperr_t err; - UINT8 head, track, sector, offset; - UINT8 buf[32]; - bml3_diskinfo *info = bml3_get_diskinfo(f); - dirent_location(f, index_loc, &head, &track, §or, &offset); - err = floppy_read_sector(imgtool_floppy(f), head, track, sector, offset, (void *) buf, sizeof(buf)); - memset(ent, 0, sizeof(*ent)); - switch (info->variant) { - case 0: - memcpy(&ent->fname, &buf[0], 8); - ent->ftype = buf[11]; - ent->asciiflag = buf[12]; - ent->first_granule = buf[14]; - break; - case 1: - memcpy(&ent->fname, &buf[0], 8); - memcpy(&ent->fext, &buf[8], 3); - ent->ftype = buf[11]; - ent->asciiflag = buf[12]; - ent->first_granule = buf[13]; - ent->lastsectorbytes = (buf[14] << 8) | buf[15]; - break; - default: - return FLOPPY_ERROR_INVALIDIMAGE; - } - return err; -} - - - -static floperr_t put_bml3_dirent(imgtool_image *f, int index_loc, const struct bml3_dirent *ent) -{ - floperr_t err; - UINT8 head, track, sector, offset; - UINT8 buf[32]; - bml3_diskinfo *info = bml3_get_diskinfo(f); - if (index_loc >= max_dirents(f)) - return (floperr_t)IMGTOOLERR_FILENOTFOUND; - dirent_location(f, index_loc, &head, &track, §or, &offset); - memset(buf, 0, sizeof(buf)); - switch (info->variant) { - case 0: - memcpy(&buf[0], &ent->fname, 8); - buf[11] = ent->ftype; - buf[12] = ent->asciiflag; - buf[14] = ent->first_granule; - break; - case 1: - memcpy(&buf[0], &ent->fname, 8); - memcpy(&buf[8], &ent->fext, 3); - buf[11] = ent->ftype; - buf[12] = ent->asciiflag; - buf[13] = ent->first_granule; - buf[14] = ent->lastsectorbytes >> 8; - buf[15] = ent->lastsectorbytes & 0xff; - break; - default: - return FLOPPY_ERROR_INVALIDIMAGE; - } - err = floppy_write_sector(imgtool_floppy(f), head, track, sector, offset, (void *) buf, sizeof(buf), 0); /* TODO: pass ddam argument from imgtool */ - return err; -} - - - -/* fnamebuf must have at least 13 bytes */ -static void get_dirent_fname(char *fnamebuf, const struct bml3_dirent *ent) -{ - char *s; - - memset(fnamebuf, 0, 13); - memcpy(fnamebuf, ent->fname, sizeof(ent->fname)); - rtrim(fnamebuf); - s = fnamebuf + strlen(fnamebuf); - *(s++) = '.'; - memcpy(s, ent->fext, sizeof(ent->fext)); - rtrim(s); - - /* If no extension, remove period */ - if (*s == '\0') - s[-1] = '\0'; -} - - - -static imgtoolerr_t lookup_bml3_file(imgtool_image *f, const char *fname, struct bml3_dirent *ent, int *position) -{ - int i; - floperr_t ferr; - char fnamebuf[13]; - - i = 0; - fnamebuf[0] = '\0'; - - do - { - do - { - ferr = get_bml3_dirent(f, i++, ent); - if (ferr) - return imgtool_floppy_error(ferr); - } - while(ent->fname[0] == '\0'); - - - if (ent->fname[0] != -1) - get_dirent_fname(fnamebuf, ent); - } - while((ent->fname[0] != -1) && core_stricmp(fnamebuf, fname)); - - if (ent->fname[0] == -1) - return IMGTOOLERR_FILENOTFOUND; - - if (position) - *position = i - 1; - return (imgtoolerr_t)0; -} - - - -static UINT8 get_granule_count(imgtool_image *img) -{ - // UINT16 tracks; - UINT16 disk_granules; - bml3_diskinfo *info = bml3_get_diskinfo(img); - - // This always returns 82 for D88, so not quite right - // tracks = floppy_get_tracks_per_disk(imgtool_floppy(img)); - - // The number of granules is primarily constrained by the disk capacity. - disk_granules = (40 - 1 - info->first_granule_cylinder) * info->heads * (16 / info->granule_sectors); - // Also, granule numbers from 0xC0 upwards are reserved for terminating a granule chain - return (UINT8)((disk_granules < 0xC0) ? disk_granules : 0xC0); -} - -/* granule_map must be an array of MAX_GRANULEMAP_SIZE bytes */ -static floperr_t get_granule_map(imgtool_image *img, UINT8 *granule_map, UINT8 *granule_count) -{ - bml3_diskinfo *info = bml3_get_diskinfo(img); - UINT8 count; - - count = get_granule_count(img); - if (granule_count) - *granule_count = count; - - // The first byte of the granule map sector is ignored (and expected to be 0) - return floppy_read_sector(imgtool_floppy(img), 0, 20, info->fat_start_sector, info->fat_start_offset, granule_map, count); -} - - - -static floperr_t put_granule_map(imgtool_image *img, const UINT8 *granule_map, UINT8 granule_count) -{ - bml3_diskinfo *info = bml3_get_diskinfo(img); - return floppy_write_sector(imgtool_floppy(img), 0, 20, info->fat_start_sector, info->fat_start_offset, granule_map, granule_count, 0); /* TODO: pass ddam argument from imgtool */ -} - - - - -static void granule_location(imgtool_image *image, UINT8 granule, UINT8 *head, UINT8 *track, UINT8 *sector) -{ - bml3_diskinfo *info = bml3_get_diskinfo(image); - UINT16 abs_track = granule * info->granule_sectors / 16; - *head = abs_track % info->heads; - *track = abs_track / info->heads + info->first_granule_cylinder; - // skip filesystem cylinder - if (*track >= 20) - (*track)++; - *sector = granule * info->granule_sectors % 16 + 1; -} - - - -static imgtoolerr_t transfer_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *f, imgtoolerr_t (*proc)(imgtool_image *, int, int, int, int, size_t, imgtool_stream *)) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - UINT8 head, track, sector; - granule_location(img, granule, &head, &track, §or); - if (length > 0) - err = proc(img, head, track, sector, 0, length, f); - return err; -} - - -static imgtoolerr_t transfer_from_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *destf) -{ - return transfer_granule(img, granule, length, destf, imgtool_floppy_read_sector_to_stream); -} - - - -static imgtoolerr_t transfer_to_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *sourcef) -{ - return transfer_granule(img, granule, length, sourcef, imgtool_floppy_write_sector_from_stream); -} - - - -static floperr_t read_granule(imgtool_image *img, UINT8 granule, int offset, int length, UINT8 *buf) -{ - UINT8 head, track, sector; - granule_location(img, granule, &head, &track, §or); - return floppy_read_sector(imgtool_floppy(img), head, track, sector, offset, buf, length); -} - - - -static floperr_t write_granule(imgtool_image *img, UINT8 granule, int offset, int length, const UINT8 *buf) -{ - UINT8 head, track, sector; - granule_location(img, granule, &head, &track, §or); - return floppy_write_sector(imgtool_floppy(img), head, track, sector, offset, buf, length, 0); /* TODO: pass ddam argument from imgtool */ -} - - - -static imgtoolerr_t list_granules(struct bml3_dirent *ent, imgtool_image *img, struct granule_list_t *granule_list) -{ - floperr_t ferr; - UINT8 max_granules; - UINT8 granule; - UINT8 usedmap[MAX_GRANULEMAP_SIZE]; /* Used to detect infinite loops */ - UINT8 granule_map[MAX_GRANULEMAP_SIZE]; - bml3_diskinfo *info = bml3_get_diskinfo(img); - - ferr = get_granule_map(img, granule_map, &max_granules); - if (ferr) - return imgtool_floppy_error(ferr); - - memset(usedmap, 0, max_granules); - - granule = ent->first_granule; - granule_list->granule_count = 0; - - while(!usedmap[granule] && granule < max_granules) - { - usedmap[granule] = 1; - granule_list->granules[granule_list->granule_count++] = granule; - granule = granule_map[granule]; - } - - granule_list->last_granule_sectors = granule - 0xc0; - if (info->variant == 0) { - // add final incomplete sector - granule_list->last_granule_sectors++; - } - - // A value of zero (variant 1) and max (variant 0) seem to indicate a file open for writing. - // Strictly speaking this means the image is corrupt, although a real system will happily read - // garbage from the file. - if (granule_list->last_granule_sectors > info->granule_sectors) - return IMGTOOLERR_CORRUPTIMAGE; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t get_file_size(struct bml3_dirent *ent, imgtool_image *img, const struct granule_list_t *granule_list, size_t *size) -{ - floperr_t ferr; - size_t last_sector_bytes = 0; - bml3_diskinfo *info = bml3_get_diskinfo(img); - - // TODO are these special cases valid, or maybe indicate a corrupt image? - if (granule_list->granule_count == 0) { - *size = 0; - return IMGTOOLERR_SUCCESS; - } - else if (granule_list->last_granule_sectors == 0) { - *size = info->sector_size * ((granule_list->granule_count - 1) * info->granule_sectors); - return IMGTOOLERR_SUCCESS; - } - - // determine size excluding final sector - *size = info->sector_size * ((granule_list->granule_count - 1) * info->granule_sectors + granule_list->last_granule_sectors - 1); - - // determine bytes used in final sector - switch (info->variant) { - case 0: - // look for EOF (ASCII SUB) and trailing NULs in final sector - { - UINT8 buf[MAX_SECTOR_SIZE]; - ferr = read_granule(img, granule_list->granules[granule_list->granule_count-1], info->sector_size * (granule_list->last_granule_sectors - 1), info->sector_size, buf); - if (ferr) - return imgtool_floppy_error(ferr); - for (last_sector_bytes = info->sector_size - 1; ; last_sector_bytes--) { - if (buf[last_sector_bytes] != 0) - break; - if (last_sector_bytes == 0) - break; - } - if (buf[last_sector_bytes] != 0x1a) { - last_sector_bytes++; - } - } - break; - case 1: - last_sector_bytes = ent->lastsectorbytes; - break; - } - - // TODO is it valid for last_sector_bytes == 0? - if (last_sector_bytes > info->sector_size) { - return IMGTOOLERR_CORRUPTIMAGE; - } - *size += last_sector_bytes; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t process_bml3_file(struct bml3_dirent *ent, imgtool_image *img, imgtool_stream *destf, size_t *size) -{ - imgtoolerr_t err; - size_t remaining_size, granule_size; - bml3_diskinfo *info = bml3_get_diskinfo(img); - struct granule_list_t granule_list; - granule_list.granule_count = 0; - - err = list_granules(ent, img, &granule_list); - if (err) - return err; - err = get_file_size(ent, img, &granule_list, size); - if (err) - return err; - - if (destf) { - remaining_size = *size; - granule_size = info->granule_sectors * info->sector_size; - - for (int c = 0; c < granule_list.granule_count; c++) { - if (granule_size >= remaining_size) - granule_size = remaining_size; - transfer_from_granule(img, granule_list.granules[c], granule_size, destf); - remaining_size -= granule_size; - } - } - return IMGTOOLERR_SUCCESS; -} - - - -/* create a new directory entry with a specified name */ -static imgtoolerr_t prepare_dirent(UINT8 variant, struct bml3_dirent *ent, const char *fname) -{ - const char *fname_end; - const char *fname_ext; - int fname_ext_len; - - memset(ent, '\0', sizeof(*ent)); - memset(ent->fname, ' ', sizeof(ent->fname)); - memset(ent->fext, ' ', sizeof(ent->fext)); - - fname_end = strchr(fname, '.'); - if (fname_end) - fname_ext = fname_end + 1; - else - fname_end = fname_ext = fname + strlen(fname); - - fname_ext_len = strlen(fname_ext); - - switch (variant) { - case 0: - /* 8-character max filename */ - if (((fname_end - fname) > 8) || (fname_ext_len > 0)) - return IMGTOOLERR_BADFILENAME; - break; - case 1: - /*8.3 filename */ - if (((fname_end - fname) > 8) || (fname_ext_len > 3)) - return IMGTOOLERR_BADFILENAME; - break; - default: - return IMGTOOLERR_CORRUPTIMAGE; - } - - memcpy(ent->fname, fname, fname_end - fname); - memcpy(ent->fext, fname_ext, fname_ext_len); - - /* By default, set as a type 2 binary file */ - ent->ftype = 2; - ent->asciiflag = 0; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t bml3_diskimage_open(imgtool_image *image, imgtool_stream *stream) -{ - // imgtoolerr_t err; - floperr_t ferr; - bml3_diskinfo *info = bml3_get_diskinfo(image); - floppy_image_legacy *floppy = imgtool_floppy(image); - const struct FloppyCallbacks *callbacks = floppy_callbacks(floppy); - - // probe disk geometry to guess format - int heads_per_disk = callbacks->get_heads_per_disk(floppy); - UINT32 sector_length; - ferr = callbacks->get_sector_length(floppy, 0, 20, 1, §or_length); - if (ferr) - return imgtool_floppy_error(ferr); - int sectors_per_track = callbacks->get_sectors_per_track(floppy, 0, 20); - - if (heads_per_disk == 2 && sector_length == 128 && sectors_per_track == 16) { - // single-sided, single-density - info->sector_size = 128; - info->heads = 1; - info->fat_start_sector = 1; - info->fat_start_offset = 5; - info->fat_sectors = 2; - info->dirent_start_sector = 7; - info->granule_sectors = 4; - info->first_granule_cylinder = 0; - info->variant = 0; - } - else if (heads_per_disk == 2 && sector_length == 256 && sectors_per_track == 16) { - // double-sided, double-density - info->sector_size = 256; - info->heads = 2; - info->fat_start_sector = 2; - info->fat_start_offset = 1; - info->fat_sectors = 1; - info->dirent_start_sector = 5; - info->granule_sectors = 8; - info->first_granule_cylinder = 1; - info->variant = 1; - } - else { - // invalid or unsupported format - return IMGTOOLERR_CORRUPTIMAGE; - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t bml3_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - floperr_t ferr; - imgtoolerr_t err; - size_t filesize; - struct bml3_direnum *rsenum; - struct bml3_dirent rsent; - char fname[13]; - imgtool_image *image; - - image = imgtool_directory_image(enumeration); - rsenum = (struct bml3_direnum *) imgtool_directory_extrabytes(enumeration); - - /* Did we hit the end of file before? */ - if (rsenum->eof) - goto eof; - - do - { - if (rsenum->index >= max_dirents(image)) - goto eof; - - ferr = get_bml3_dirent(image, rsenum->index++, &rsent); - if (ferr) - return imgtool_floppy_error(ferr); - } - while(rsent.fname[0] == '\0'); - - /* Now are we at the eof point? */ - if (rsent.fname[0] == -1) - { - rsenum->eof = 1; -eof: - ent->eof = 1; - } - else - { - /* Not the end of file */ - err = process_bml3_file(&rsent, image, NULL, &filesize); - if (err) - return err; - - if (filesize == ((size_t) -1)) - { - /* corrupt! */ - ent->filesize = 0; - ent->corrupt = 1; - } - else - { - ent->filesize = filesize; - ent->corrupt = 0; - } - ent->eof = 0; - - get_dirent_fname(fname, &rsent); - - snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fname); - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B')); - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t bml3_diskimage_freespace(imgtool_partition *partition, UINT64 *size) -{ - floperr_t ferr; - UINT8 i; - size_t s = 0; - UINT8 granule_count; - UINT8 granule_map[MAX_GRANULEMAP_SIZE]; - imgtool_image *image = imgtool_partition_image(partition); - bml3_diskinfo *info = bml3_get_diskinfo(image); - - ferr = get_granule_map(image, granule_map, &granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - for (i = 0; i < granule_count; i++) - { - if (granule_map[i] == 0xff) - s += (info->granule_sectors * info->sector_size); - } - *size = s; - return (imgtoolerr_t)FLOPPY_ERROR_SUCCESS; -} - - - -static imgtoolerr_t delete_entry(imgtool_image *img, struct bml3_dirent *ent, int pos) -{ - floperr_t ferr; - unsigned char g, i; - UINT8 granule_count; - UINT8 granule_map[MAX_GRANULEMAP_SIZE]; - - /* Write a NUL in the filename, marking it deleted */ - ent->fname[0] = 0; - ferr = put_bml3_dirent(img, pos, ent); - if (ferr) - return imgtool_floppy_error(ferr); - - ferr = get_granule_map(img, granule_map, &granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - /* Now free up the granules */ - g = ent->first_granule; - while (g < granule_count) - { - i = granule_map[g]; - granule_map[g] = 0xff; - g = i; - } - - ferr = put_granule_map(img, granule_map, granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t bml3_diskimage_readfile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t err; - struct bml3_dirent ent; - size_t size; - imgtool_image *img = imgtool_partition_image(partition); - - err = lookup_bml3_file(img, fname, &ent, NULL); - if (err) - return err; - - err = process_bml3_file(&ent, img, destf, &size); - if (err) - return err; - - if (size == (size_t) -1) - return IMGTOOLERR_CORRUPTIMAGE; - - return (imgtoolerr_t)0; -} - - - -static imgtoolerr_t bml3_diskimage_writefile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) -{ - floperr_t ferr; - imgtoolerr_t err; - imgtool_image *img = imgtool_partition_image(partition); - bml3_diskinfo *info = bml3_get_diskinfo(img); - struct bml3_dirent ent, ent2; - size_t i; - UINT64 sz, read_sz; - UINT64 freespace = 0; - unsigned char *gptr; - UINT8 granule_count; - UINT8 granule_map[MAX_GRANULEMAP_SIZE]; - UINT8 eof_buf[MAX_SECTOR_SIZE]; - - // one-time setup of eof_buf - memset(eof_buf, 0, sizeof(eof_buf)); - eof_buf[0] = 0x1A; - - /* can we write to this image? */ - if (floppy_is_read_only(imgtool_floppy(img))) - return IMGTOOLERR_READONLY; - - err = bml3_diskimage_freespace(partition, &freespace); - if (err) - return err; - - /* is there enough space? */ - sz = read_sz = stream_size(sourcef); - if (info->variant == 0) { - // also need to write EOF - sz++; - } - if (sz > freespace) - return IMGTOOLERR_NOSPACE; - - /* setup our directory entry */ - err = prepare_dirent(info->variant, &ent, fname); - if (err) - return err; - - ent.ftype = option_resolution_lookup_int(writeoptions, BML3_OPTIONS_FTYPE); - ent.asciiflag = ((UINT8) option_resolution_lookup_int(writeoptions, BML3_OPTIONS_ASCII)) - 1; - gptr = &ent.first_granule; - - ferr = get_granule_map(img, granule_map, &granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - unsigned char g = 0x00; - UINT32 granule_bytes = info->granule_sectors * info->sector_size; - - do - { - while (granule_map[g] != 0xff) - { - g++; - if ((g >= granule_count) || (g == 0)) - return IMGTOOLERR_UNEXPECTED; /* We should have already verified that there is enough space */ - } - *gptr = g; - gptr = &granule_map[g]; - - - i = MIN(read_sz, granule_bytes); - if (i > 0) { - err = transfer_to_granule(img, g, i, sourcef); - if (err) - return err; - read_sz -= i; - sz -= i; - } - if (i < info->granule_sectors * info->sector_size && sz > 0) { - // write EOF and trailing NULs in the final sector - ferr = write_granule(img, g, i, (info->granule_sectors * info->sector_size - i - 1) % info->sector_size + 1, eof_buf); - if (ferr) - return imgtool_floppy_error(ferr); - sz--; - i++; - } - - /* Go to next granule */ - g++; - } - while(sz > 0); - - /* Now that we are done with the file, we need to specify the final entry - * in the file allocation table - */ - *gptr = 0xc0 + ((i + info->sector_size-1) / info->sector_size) - (info->variant == 0 ? 1 : 0); - ent.lastsectorbytes = (i - 1) % info->sector_size + 1; - - /* delete file if it already exists */ - err = bml3_diskimage_deletefile(partition, fname); - if (err && err != IMGTOOLERR_FILENOTFOUND) - return err; - - /* Now we need to find an empty directory entry */ - i = -1; - do - { - ferr = get_bml3_dirent(img, ++i, &ent2); - if (ferr) - return imgtool_floppy_error(ferr); - } - while(ent2.fname[0] != '\0' && ent2.fname[0] != -1); - - ferr = put_bml3_dirent(img, i, &ent); - if (ferr) - return imgtool_floppy_error(ferr); - - /* write the granule map back out */ - ferr = put_granule_map(img, granule_map, granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t bml3_diskimage_deletefile(imgtool_partition *partition, const char *fname) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - int pos = 0; - struct bml3_dirent ent; - - err = lookup_bml3_file(image, fname, &ent, &pos); - if (err) - return err; - - return delete_entry(image, &ent, pos); -} - - - -static imgtoolerr_t bml3_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - struct bml3_dirent ent; - int pos; - - if (fname) - { - err = lookup_bml3_file(image, fname, &ent, &pos); - if (err) - return err; - - if (ent.asciiflag == 0xFF) - { - /* ASCII file */ - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = filter_eoln_getinfo; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = NULL; - } - else if (ent.ftype == 0) - { - /* tokenized BASIC file */ - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = NULL; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = filter_bml3bas_getinfo; - } - } - else - { - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = NULL; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = filter_eoln_getinfo; - suggestions[2].viability = SUGGESTION_POSSIBLE; - suggestions[2].filter = filter_bml3bas_getinfo; - } - - return IMGTOOLERR_SUCCESS; -} - - - -/********************************************************************* - Imgtool module declaration -*********************************************************************/ - -static OPTION_GUIDE_START( bml3_writefile_optionguide ) - OPTION_ENUM_START( BML3_OPTIONS_FTYPE, "ftype", "File type" ) - OPTION_ENUM( 0, "basic", "Basic" ) - OPTION_ENUM( 1, "data", "Data" ) - OPTION_ENUM( 2, "binary", "Binary" ) - OPTION_ENUM( 3, "assembler", "Assembler Source" ) - OPTION_ENUM_END - OPTION_ENUM_START( BML3_OPTIONS_ASCII, "ascii", "Ascii flag" ) - OPTION_ENUM( 0, "ascii", "Ascii" ) - OPTION_ENUM( 1, "binary", "Binary" ) - OPTION_ENUM_END -OPTION_GUIDE_END - - - -void bml3_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break; - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(bml3_diskinfo); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct bml3_direnum); break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "bml3"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Basic Master Level 3 format"); break; - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; - case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T0-[2]-3;M0-[1]"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; - case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = bml3_diskimage_open; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = bml3_diskimage_nextenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = bml3_diskimage_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = bml3_diskimage_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = bml3_diskimage_writefile; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = bml3_diskimage_deletefile; break; - case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = bml3_diskimage_suggesttransfer; break; - case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = bml3_writefile_optionguide; break; - case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_default; break; - } -} diff --git a/src/mess/tools/imgtool/modules/concept.c b/src/mess/tools/imgtool/modules/concept.c deleted file mode 100644 index a5c5a37b1ad..00000000000 --- a/src/mess/tools/imgtool/modules/concept.c +++ /dev/null @@ -1,492 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/* - Handlers for concept floppy images - - Disk images are in MESS format. - - Raphael Nabet, 2003 -*/ - -#include -#include -#include -#include -#include "imgtool.h" - -struct UINT16xE -{ - UINT8 bytes[2]; -}; - -/* - get_UINT16xE - - Read a 16-bit word, whether it is little-endian or big-endian - - little_endian (I): non-zero if word is little-endian, zero if word is - big-endian - word (I): pointer to word to read - - Returns value of word in native format -*/ -INLINE UINT16 get_UINT16xE(int little_endian, UINT16xE word) -{ - return little_endian ? (word.bytes[0] | (word.bytes[1] << 8)) : ((word.bytes[0] << 8) | word.bytes[1]); -} - -#if 0 -/* - set_UINT16xE - - Write a 16-bit word, whether it is little-endian or big-endian - - little_endian (I): non-zero if word is little-endian, zero if word is - big-endian - word (O): pointer to word to write - data (I): value to write in word, in native format -*/ -INLINE void set_UINT16xE(int little_endian, UINT16xE *word, UINT16 data) -{ - if (little_endian) - { - word->bytes[0] = data & 0xff; - word->bytes[1] = (data >> 8) & 0xff; - } - else - { - word->bytes[0] = (data >> 8) & 0xff; - word->bytes[1] = data & 0xff; - } -} -#endif - -/* - Disk structure: - - Track 0 Sector 0 & 1: bootstrap loader - Track 0 Sector 2 through 5: disk directory - Remaining sectors are used for data. -*/ - -/* - device directory record (Disk sector 2-5) -*/ - -struct concept_vol_hdr_entry -{ - UINT16xE first_block; - UINT16xE next_block; - UINT16xE ftype; - - unsigned char volname[8]; - UINT16xE last_block; - UINT16xE num_files; - UINT16xE last_boot; - UINT16xE last_access; - char mem_flipped; - char disk_flipped; - UINT16xE unused; -}; - -struct concept_file_dir_entry -{ - UINT16xE first_block; - UINT16xE next_block; - UINT16xE ftype; - - unsigned char filename[16]; - UINT16xE last_byte; - UINT16xE last_access; -}; - -struct concept_dev_dir -{ - concept_vol_hdr_entry vol_hdr; - concept_file_dir_entry file_dir[77]; - char unused[20]; -}; - -/* - concept disk image descriptor -*/ -struct concept_image -{ - imgtool_stream *file_handle; /* imgtool file handle */ - concept_dev_dir dev_dir; /* cached copy of device directory */ -}; - -/* - concept catalog iterator, used when imgtool reads the catalog -*/ -struct concept_iterator -{ - concept_image *image; - int index; /* current index */ -}; - - -static imgtoolerr_t concept_image_init(imgtool_image *img, imgtool_stream *f); -static void concept_image_exit(imgtool_image *img); -static void concept_image_info(imgtool_image *img, char *string, size_t len); -static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path); -static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); -static void concept_image_closeenum(imgtool_directory *enumeration); -static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64 *size); -static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); -#if 0 -static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions); -static imgtoolerr_t concept_image_deletefile(imgtool_partition *partition, const char *filename); -static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool_stream *f, option_resolution *createoptions); -#endif - -void concept_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(concept_image); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(concept_iterator); break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "concept"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Concept floppy disk image"); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "img"); break; - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_OPEN: info->open = concept_image_init; break; - case IMGTOOLINFO_PTR_CLOSE: info->close = concept_image_exit; break; - case IMGTOOLINFO_PTR_INFO: info->info = concept_image_info; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = concept_image_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = concept_image_nextenum; break; - case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = concept_image_closeenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = concept_image_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = concept_image_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = concept_image_writefile */; break; - case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = concept_image_deletefile */; break; - case IMGTOOLINFO_PTR_CREATE: /* info->create = concept_image_create */; break; - } -} - -/* - read_physical_record - - Read one 512-byte physical record from a disk image - - file_handle: imgtool file handle - secnum: physical record address - dest: pointer to destination buffer - - Return non-zero on error -*/ -static int read_physical_record(imgtool_stream *file_handle, int secnum, void *dest) -{ - int reply; - - /* seek to sector */ - reply = stream_seek(file_handle, secnum*512, SEEK_SET); - if (reply) - return 1; - /* read it */ - reply = stream_read(file_handle, dest, 512); - if (reply != 512) - return 1; - - return 0; -} - -#ifdef UNUSED_FUNCTION -/* - write_physical_record - - Write one 512-byte physical record to a disk image - - file_handle: imgtool file handle - secnum: logical sector address - src: pointer to source buffer - - Return non-zero on error -*/ -static int write_physical_record(imgtool_stream *file_handle, int secnum, const void *src) -{ - int reply; - - /* seek to sector */ - reply = stream_seek(file_handle, secnum*512, SEEK_SET); - if (reply) - return 1; - /* read it */ - reply = stream_write(file_handle, src, 512); - if (reply != 512) - return 1; - - return 0; -} -#endif - -/* - Search for a file name on a concept_image - - image (I): image reference - filename (I): name of the file to search - entry_index (O): index of file in disk catalog - - Return non-zero on error -*/ -static int get_catalog_entry(concept_image *image, const unsigned char *filename, int *entry_index) -{ - int filename_len = filename[0]; - int i; - - if (filename_len > 15) - /* file name is bad */ - return 1; - - for (i = 0; i < 77; i++) - { - if (!memcmp(filename, image->dev_dir.file_dir[i].filename, filename_len+1)) - { - /* file found */ - *entry_index = i; - return 0; - } - } - - /* file not found */ - return 1; -} - -/* - Open a file as a concept_image. -*/ -static imgtoolerr_t concept_image_init(imgtool_image *img, imgtool_stream *f) -{ - concept_image *image = (concept_image *) imgtool_image_extra_bytes(img); - int reply; - int i; - unsigned totphysrecs; - - image->file_handle = f; - - /* read device directory */ - for (i=0; i<4; i++) - { - reply = read_physical_record(f, i+2, ((char *) & image->dev_dir)+i*512); - if (reply) - return IMGTOOLERR_READERROR; - } - - /* do primitive checks */ - totphysrecs = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.last_block) - - get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.first_block); - - if ((get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.first_block) != 0) - || (get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.next_block) != 6) - || (totphysrecs < 6) /*|| (stream_size(f) != totphysrecs*512)*/ - || (image->dev_dir.vol_hdr.volname[0] > 7)) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - - return IMGTOOLERR_SUCCESS; -} - -/* - close a concept_image -*/ -static void concept_image_exit(imgtool_image *img) -{ - /*concept_image *image = (concept_image *) imgtool_image_extra_bytes(img);*/ -} - -/* - get basic information on a concept_image - - Currently returns the volume name -*/ -static void concept_image_info(imgtool_image *img, char *string, size_t len) -{ - concept_image *image = (concept_image *) imgtool_image_extra_bytes(img); - char vol_name[8]; - - memcpy(vol_name, image->dev_dir.vol_hdr.volname + 1, image->dev_dir.vol_hdr.volname[0]); - vol_name[image->dev_dir.vol_hdr.volname[0]] = 0; - - snprintf(string, len, "%s", vol_name); -} - -/* - Open the disk catalog for enumeration -*/ -static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path) -{ - concept_iterator *iter; - - iter = (concept_iterator *) imgtool_directory_extrabytes(enumeration); - iter->image = (concept_image *) imgtool_image_extra_bytes(imgtool_directory_image(enumeration)); - iter->index = 0; - return IMGTOOLERR_SUCCESS; -} - -/* - Enumerate disk catalog next entry -*/ -static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - concept_iterator *iter = (concept_iterator *) imgtool_directory_extrabytes(enumeration); - - - ent->corrupt = 0; - ent->eof = 0; - - if ((iter->image->dev_dir.file_dir[iter->index].filename[0] == 0) || (iter->index > 77)) - { - ent->eof = 1; - } - else if (iter->image->dev_dir.file_dir[iter->index].filename[0] > 15) - { - ent->corrupt = 1; - } - else - { - int len = iter->image->dev_dir.file_dir[iter->index].filename[0]; - const char *type; - - if (len > ARRAY_LENGTH(ent->filename)) - len = ARRAY_LENGTH(ent->filename); - memcpy(ent->filename, iter->image->dev_dir.file_dir[iter->index].filename + 1, len); - ent->filename[len] = 0; - - /* parse flags */ - switch (get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].ftype) & 0xf) - { - case 0: - case 8: - type = "DIRHDR"; - break; - case 2: - type = "CODE"; - break; - case 3: - type = "TEXT"; - break; - case 5: - type = "DATA"; - break; - default: - type = "???"; - break; - } - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%s", type); - - /* len in physrecs */ - ent->filesize = get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].next_block) - - get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].first_block); - - iter->index++; - } - - return (imgtoolerr_t)0; -} - -/* - Free enumerator -*/ -static void concept_image_closeenum(imgtool_directory *enumeration) -{ -} - -/* - Compute free space on disk image -*/ -static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtool_image *img = imgtool_partition_image(partition); - concept_image *image = (concept_image*) img; - int free_blocks; - int i; - - /* first get number of data blocks */ - free_blocks = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.last_block) - - get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.next_block); - - /* next substract length of each file */ - for (i=0; (image->dev_dir.file_dir[i].filename[0] != 0) && (i <= 77); i++) - { - free_blocks -= get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[i].next_block) - - get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[i].first_block); - } - - *size = free_blocks; - - return IMGTOOLERR_SUCCESS; -} - -/* - Extract a file from a concept_image. -*/ -static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtool_image *img = imgtool_partition_image(partition); - concept_image *image = (concept_image *) imgtool_image_extra_bytes(img); - size_t filename_len = strlen(filename); - unsigned char concept_fname[16]; - int catalog_index; - int i; - UINT8 buf[512]; - - if (filename_len > 15) - return IMGTOOLERR_BADFILENAME; - - concept_fname[0] = filename_len; - memcpy(concept_fname+1, filename, filename_len); - - if (get_catalog_entry(image, concept_fname, &catalog_index)) - return IMGTOOLERR_FILENOTFOUND; - - for (i = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[catalog_index].first_block); - i < get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[catalog_index].next_block); - i++) - { - if (read_physical_record(image->file_handle, i, buf)) - return IMGTOOLERR_READERROR; - - if (stream_write(destf, buf, 512) != 512) - return IMGTOOLERR_WRITEERROR; - } - - return (imgtoolerr_t)0; -} - -#if 0 -/* - Add a file to a concept_image. -*/ -static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) -{ - /* ... */ - - return 0; -} - -/* - Delete a file from a concept_image. -*/ -static imgtoolerr_t concept_image_deletefile(imgtool_partition *partition, const char *filename) -{ - /* ... */ - - return 0; -} - -/* - Create a blank concept_image. -*/ -static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool_stream *f, option_resolution *createoptions) -{ - /* ... */ - - return 0; -} -#endif diff --git a/src/mess/tools/imgtool/modules/cybiko.c b/src/mess/tools/imgtool/modules/cybiko.c deleted file mode 100644 index 1fc2afd319b..00000000000 --- a/src/mess/tools/imgtool/modules/cybiko.c +++ /dev/null @@ -1,578 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/* - - Cybiko Classic File System - - (c) 2007 Tim Schuerewegen - -*/ - -#include "imgtool.h" - -#include - -struct cybiko_file_system -{ - imgtool_stream *stream; - UINT32 page_count, page_size, block_count_boot, block_count_file; - UINT16 write_count; -}; - -struct cybiko_iter -{ - UINT16 block; -}; - -struct cfs_file -{ - char name[64]; // name of the file - UINT32 date; // date/time of the file (seconds since 1900/01/01) - UINT32 size; // size of the file - UINT32 blocks; // number of blocks occupied by the file -}; - -enum -{ - BLOCK_TYPE_INVALID, - BLOCK_TYPE_BOOT, - BLOCK_TYPE_FILE -}; - -#define MAX_PAGE_SIZE (264 * 2) - -#define INVALID_FILE_ID 0xFFFF - -enum -{ - FLASH_TYPE_INVALID, - FLASH_TYPE_AT45DB041, - FLASH_TYPE_AT45DB081, - FLASH_TYPE_AT45DB161 -}; - -#define BLOCK_USED(x) (x[0] & 0x80) -#define BLOCK_FILE_ID(x) buffer_read_16_be( x + 2) -#define BLOCK_PART_ID(x) buffer_read_16_be( x + 4) -#define BLOCK_FILENAME(x) (char*)(x + 7) - -#define FILE_HEADER_SIZE 0x48 - -// 2208988800 is the number of seconds between 1900/01/01 and 1970/01/01 - -static time_t time_crack( UINT32 cfs_time) -{ - return (time_t)(cfs_time - 2208988800UL); -} - -static UINT32 time_setup( time_t ansi_time) -{ - return (UINT32)(ansi_time + 2208988800UL); -} - -static UINT32 buffer_read_32_be( UINT8 *buffer) -{ - return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | (buffer[3] << 0); -} - -static UINT16 buffer_read_16_be( UINT8 *buffer) -{ - return (buffer[0] << 8) | (buffer[1] << 0); -} - -static void buffer_write_32_be( UINT8 *buffer, UINT32 data) -{ - buffer[0] = (data >> 24) & 0xFF; - buffer[1] = (data >> 16) & 0xFF; - buffer[2] = (data >> 8) & 0xFF; - buffer[3] = (data >> 0) & 0xFF; -} - -static void buffer_write_16_be( UINT8 *buffer, UINT16 data) -{ - buffer[0] = (data >> 8) & 0xFF; - buffer[1] = (data >> 0) & 0xFF; -} - -// page = crc1 (4) + wcnt (2) + crc2 (2) + data (x) + unk (2) - -static UINT32 page_buffer_calc_checksum_1( UINT8 *buffer, UINT32 size, int block_type) -{ - return crc32( 0, buffer + 8, (block_type == BLOCK_TYPE_BOOT) ? 250 : size - 10); -} - -static UINT16 page_buffer_calc_checksum_2( UINT8 *buffer) -{ - UINT16 val = 0xAF17; - val ^= buffer_read_16_be( buffer + 0); - val ^= buffer_read_16_be( buffer + 2); - val ^= buffer_read_16_be( buffer + 4); - return FLIPENDIAN_INT16(val); -} - -static int page_buffer_verify( UINT8 *buffer, UINT32 size, int block_type) -{ - UINT32 checksum_page, checksum_calc; - // checksum 1 - checksum_calc = page_buffer_calc_checksum_1( buffer, size, block_type); - checksum_page = buffer_read_32_be( buffer + 0); - if (checksum_calc != checksum_page) return FALSE; - // checksum 2 - checksum_calc = page_buffer_calc_checksum_2( buffer); - checksum_page = buffer_read_16_be( buffer + 6); - if (checksum_calc != checksum_page) return FALSE; - // ok - return TRUE; -} - -static int cfs_block_to_page( cybiko_file_system *cfs, int block_type, UINT32 block, UINT32 *page) -{ - switch (block_type) - { - case BLOCK_TYPE_BOOT : if (page) *page = block; return TRUE; - case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return TRUE; - default : return FALSE; - } -} - -static int cfs_page_to_block( cybiko_file_system *cfs, UINT32 page, int *block_type, UINT32 *block) -{ - UINT32 tmp = page; - // boot block - if (tmp < cfs->block_count_boot) - { - if (block_type) *block_type = BLOCK_TYPE_BOOT; - if (block) *block = tmp; - return TRUE; - } - tmp -= cfs->block_count_boot; - // file block - if (tmp < cfs->block_count_file) - { - if (block_type) *block_type = BLOCK_TYPE_FILE; - if (block) *block = tmp; - return TRUE; - } - tmp -= cfs->block_count_file; - // error - return FALSE; -} - -static int cfs_page_read( cybiko_file_system *cfs, UINT8 *buffer, UINT32 page) -{ - if (page >= cfs->page_count) return FALSE; - stream_seek( cfs->stream, page * cfs->page_size, SEEK_SET); - stream_read( cfs->stream, buffer, cfs->page_size); - return TRUE; -} - -static int cfs_page_write( cybiko_file_system *cfs, UINT8 *buffer, UINT32 page) -{ - if (page >= cfs->page_count) return FALSE; - stream_seek( cfs->stream, page * cfs->page_size, SEEK_SET); - stream_write( cfs->stream, buffer, cfs->page_size); - return TRUE; -} - -static int cfs_block_read( cybiko_file_system *cfs, UINT8 *buffer, int block_type, UINT32 block) -{ - UINT8 buffer_page[MAX_PAGE_SIZE]; - UINT32 page; - if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE; - if (!cfs_page_read( cfs, buffer_page, page)) return FALSE; - memcpy( buffer, buffer_page + 8, cfs->page_size - 10); - return TRUE; -} - -static int cfs_block_write( cybiko_file_system *cfs, UINT8 *buffer, int block_type, UINT32 block) -{ - UINT8 buffer_page[MAX_PAGE_SIZE]; - UINT32 page; - memcpy( buffer_page + 8, buffer, cfs->page_size - 10); - buffer_write_32_be( buffer_page + 0, page_buffer_calc_checksum_1( buffer_page, cfs->page_size, block_type)); - buffer_write_16_be( buffer_page + 4, cfs->write_count++); - buffer_write_16_be( buffer_page + 6, page_buffer_calc_checksum_2( buffer_page)); - buffer_write_16_be( buffer_page + cfs->page_size - 2, 0xFFFF); - if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE; - if (!cfs_page_write( cfs, buffer_page, page)) return FALSE; - return TRUE; -} - -static int cfs_file_delete( cybiko_file_system *cfs, UINT16 file_id) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id)) - { - buffer[0] &= ~0x80; - if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - } - } - return TRUE; -} - -static int cfs_file_info( cybiko_file_system *cfs, UINT16 file_id, cfs_file *file) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - file->blocks = file->size = 0; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id)) - { - if (BLOCK_PART_ID(buffer) == 0) - { - strcpy( file->name, BLOCK_FILENAME(buffer)); - file->date = buffer_read_32_be( buffer + 6 + FILE_HEADER_SIZE - 4); - } - file->size += buffer[1]; - file->blocks++; - } - } - return (file->blocks > 0) ? TRUE : FALSE; -} - -static int cfs_file_find( cybiko_file_system *cfs, const char *filename, UINT16 *file_id) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - if (BLOCK_USED(buffer) && (strncmp( filename, BLOCK_FILENAME(buffer), 40) == 0)) - { - *file_id = i; - return TRUE; - } - } - return FALSE; -} - -static int cfs_verify( cybiko_file_system *cfs) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i, block_type; - for (i=0;ipage_count;i++) - { - if (!cfs_page_read( cfs, buffer, i)) return FALSE; - if (!cfs_page_to_block( cfs, i, &block_type, NULL)) return FALSE; - if (!page_buffer_verify( buffer, cfs->page_size, block_type)) return FALSE; - } - return TRUE; -} - -static int cfs_init( cybiko_file_system *cfs, imgtool_stream *stream, int flash_type) -{ - cfs->stream = stream; - switch (flash_type) - { - case FLASH_TYPE_AT45DB041 : cfs->page_count = 2048; cfs->page_size = 264; break; - case FLASH_TYPE_AT45DB081 : cfs->page_count = 4096; cfs->page_size = 264; break; - case FLASH_TYPE_AT45DB161 : cfs->page_count = 4096; cfs->page_size = 528; break; - default : return FALSE; - } - cfs->block_count_boot = 5; - cfs->block_count_file = cfs->page_count - cfs->block_count_boot; - cfs->write_count = 0; - return TRUE; -} - -static int cfs_format( cybiko_file_system *cfs) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - // boot blocks - memset( buffer, 0xFF, sizeof( buffer)); - for (i=0;iblock_count_boot;i++) - { - if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return FALSE; - } - // file blocks - memset( buffer, 0xFF, sizeof( buffer)); - buffer[0] &= ~0x80; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - } - // ok - return TRUE; -} - -static UINT16 cfs_calc_free_blocks( cybiko_file_system *cfs) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - UINT16 blocks = 0; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return 0; - if (!BLOCK_USED(buffer)) blocks++; - } - return blocks; -} - -static UINT32 cfs_calc_free_space( cybiko_file_system *cfs, UINT16 blocks) -{ - UINT32 free_space; - free_space = blocks * (cfs->page_size - 0x10); - if (free_space > 0) free_space -= FILE_HEADER_SIZE; - return free_space; -} - -static int flash_size_to_flash_type( size_t size) -{ - switch (size) - { - case 0x084000 : return FLASH_TYPE_AT45DB041; - case 0x108000 : return FLASH_TYPE_AT45DB081; - case 0x210000 : return FLASH_TYPE_AT45DB161; - default : return FLASH_TYPE_INVALID; - } -} - -static int flash_option_to_flash_type( int option) -{ - switch (option) - { - case 0 : return FLASH_TYPE_AT45DB041; - case 1 : return FLASH_TYPE_AT45DB081; - case 2 : return FLASH_TYPE_AT45DB161; - default : return FLASH_TYPE_INVALID; - } -} - -static imgtoolerr_t cybiko_image_open( imgtool_image *image, imgtool_stream *stream) -{ - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - int flash_type; - // init - flash_type = flash_size_to_flash_type( stream_size( stream)); - if (!cfs_init( cfs, stream, flash_type)) return IMGTOOLERR_CORRUPTIMAGE; - // verify - if (!cfs_verify( cfs)) return IMGTOOLERR_CORRUPTIMAGE; - // ok - return IMGTOOLERR_SUCCESS; -} - -static void cybiko_image_close( imgtool_image *image) -{ - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - stream_close( cfs->stream); -} - -static imgtoolerr_t cybiko_image_create( imgtool_image *image, imgtool_stream *stream, option_resolution *opts) -{ - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - int flash_type; - // init - flash_type = flash_option_to_flash_type( option_resolution_lookup_int( opts, 'F')); - if (!cfs_init( cfs, stream, flash_type)) return IMGTOOLERR_CORRUPTIMAGE; - // format - if (!cfs_format( cfs)) return IMGTOOLERR_CORRUPTIMAGE; - // ok - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_begin_enum( imgtool_directory *enumeration, const char *path) -{ - cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration); - iter->block = 0; - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_next_enum( imgtool_directory *enumeration, imgtool_dirent *ent) -{ - imgtool_image *image = imgtool_directory_image( enumeration); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration); - UINT8 buffer[MAX_PAGE_SIZE]; - UINT16 file_id = INVALID_FILE_ID; - cfs_file file; - // find next file - while (iter->block < cfs->block_count_file) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, iter->block++)) return IMGTOOLERR_READERROR; - if (BLOCK_USED(buffer) && (BLOCK_PART_ID(buffer) == 0)) - { - file_id = BLOCK_FILE_ID(buffer); - break; - } - } - // get file information - if ((file_id != INVALID_FILE_ID) && cfs_file_info( cfs, file_id, &file)) - { - strcpy( ent->filename, file.name); - ent->filesize = file.size; - ent->lastmodified_time = time_crack( file.date); - ent->filesize = file.size; - } - else - { - ent->eof = 1; - } - // ok - return IMGTOOLERR_SUCCESS; -} - -static void cybiko_image_close_enum( imgtool_directory *enumeration) -{ - // nothing -} - -static imgtoolerr_t cybiko_image_free_space( imgtool_partition *partition, UINT64 *size) -{ - imgtool_image *image = imgtool_partition_image( partition); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - if (size) *size = cfs_calc_free_space( cfs, cfs_calc_free_blocks( cfs)); - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_read_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtool_image *image = imgtool_partition_image( partition); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - UINT8 buffer[MAX_PAGE_SIZE]; - UINT16 file_id, part_id = 0, old_part_id; - int i; - // find file - if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND; - // read file - do - { - old_part_id = part_id; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR; - if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id) && (BLOCK_PART_ID(buffer) == part_id)) - { - stream_write( destf, buffer + 6 + ((part_id == 0) ? FILE_HEADER_SIZE : 0), buffer[1]); - part_id++; - } - } - } while (old_part_id != part_id); - // ok - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtool_image *image = imgtool_partition_image( partition); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - UINT8 buffer[MAX_PAGE_SIZE]; - UINT16 file_id, part_id = 0, free_blocks; - UINT64 bytes_left; - cfs_file file; - int i; - // find file - if (!cfs_file_find( cfs, filename, &file_id)) file_id = INVALID_FILE_ID; - // check free space - free_blocks = cfs_calc_free_blocks( cfs); - if (file_id != INVALID_FILE_ID) - { - if (!cfs_file_info( cfs, file_id, &file)) return IMGTOOLERR_UNEXPECTED; - free_blocks += file.blocks; - } - if (cfs_calc_free_space( cfs, free_blocks) < stream_size( sourcef)) return IMGTOOLERR_NOSPACE; - // delete file - if (file_id != INVALID_FILE_ID) - { - if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED; - } - // create/write destination file - bytes_left = stream_size( sourcef); - i = 0; - while ((bytes_left > 0) && (i < cfs->block_count_file)) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR; - if (!BLOCK_USED(buffer)) - { - if (part_id == 0) file_id = i; - memset( buffer, 0xFF, cfs->page_size - 0x10); - buffer[0] = 0x80; - buffer[1] = cfs->page_size - 0x10 - ((part_id == 0) ? FILE_HEADER_SIZE : 0); - if (bytes_left < buffer[1]) buffer[1] = bytes_left; - buffer_write_16_be( buffer + 2, file_id); - buffer_write_16_be( buffer + 4, part_id); - if (part_id == 0) - { - buffer[6] = 0; - strcpy( BLOCK_FILENAME(buffer), filename); - buffer_write_32_be( buffer + 6 + FILE_HEADER_SIZE - 4, time_setup( time( NULL))); - stream_read( sourcef, buffer + 6 + FILE_HEADER_SIZE, buffer[1]); - } - else - { - stream_read( sourcef, buffer + 6, buffer[1]); - } - if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_WRITEERROR; - bytes_left -= buffer[1]; - part_id++; - } - i++; - } - // ok - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_delete_file( imgtool_partition *partition, const char *filename) -{ - imgtool_image *image = imgtool_partition_image( partition); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - UINT16 file_id; - // find file - if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND; - // delete file - if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED; - // ok - return IMGTOOLERR_SUCCESS; -} - -static OPTION_GUIDE_START( cybiko_image_createimage_optguide ) - OPTION_ENUM_START( 'F', "flash", "Flash Type" ) - OPTION_ENUM( 0, "AT45DB041", "AT45DB041 (528 KByte)" ) - OPTION_ENUM( 1, "AT45DB081", "AT45DB081 (1056 KByte)" ) - OPTION_ENUM( 2, "AT45DB161", "AT45DB161 (2112 KByte)" ) - OPTION_ENUM_END -OPTION_GUIDE_END - -//OPTION_GUIDE_START( cybiko_image_writefile_optguide ) -// OPTION_INT( 'B', "boot", "Boot Flag" ) -//OPTION_GUIDE_END - -void cybiko_get_info( const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch (state) - { - // --- the following bits of info are returned as 64-bit signed integers --- - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES : info->i = sizeof( cybiko_file_system); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES : info->i = sizeof( cybiko_iter); break; -// case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME : info->i = 1; break; - case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME : info->i = 1; break; -// case IMGTOOLINFO_INT_BLOCK_SIZE : info->i = 264; break; - // --- the following bits of info are returned as pointers to data or functions --- - case IMGTOOLINFO_PTR_OPEN : info->open = cybiko_image_open; break; - case IMGTOOLINFO_PTR_CREATE : info->create = cybiko_image_create; break; - case IMGTOOLINFO_PTR_CLOSE : info->close = cybiko_image_close; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = cybiko_image_begin_enum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = cybiko_image_next_enum; break; - case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = cybiko_image_close_enum; break; - case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = cybiko_image_free_space; break; - case IMGTOOLINFO_PTR_READ_FILE : info->read_file = cybiko_image_read_file; break; - case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = cybiko_image_write_file; break; - case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = cybiko_image_delete_file; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE : info->createimage_optguide = cybiko_image_createimage_optguide; break; -// case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE : info->writefile_optguide = cybiko_image_writefile_optguide; break; - // --- the following bits of info are returned as NULL-terminated strings --- - case IMGTOOLINFO_STR_NAME : strcpy( info->s = imgtool_temp_str(), "cybiko"); break; - case IMGTOOLINFO_STR_DESCRIPTION : strcpy( info->s = imgtool_temp_str(), "Cybiko Classic File System"); break; - case IMGTOOLINFO_STR_FILE : strcpy( info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "bin,nv"); break; - case IMGTOOLINFO_STR_EOLN : strcpy( info->s = imgtool_temp_str(), "\r\n"); break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "F[0]-2"); break; -// case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "B[0]-1"); break; - } -} diff --git a/src/mess/tools/imgtool/modules/cybikoxt.c b/src/mess/tools/imgtool/modules/cybikoxt.c deleted file mode 100644 index a1908dc9c76..00000000000 --- a/src/mess/tools/imgtool/modules/cybikoxt.c +++ /dev/null @@ -1,539 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tim Schuerewegen -/* - - Cybiko Xtreme File System - - (c) 2010 Tim Schuerewegen - -*/ - -#include "imgtool.h" - -#include - -struct cybiko_file_system -{ - imgtool_stream *stream; - UINT32 page_count, page_size, block_count_boot, block_count_file; - UINT16 write_count; -}; - -struct cybiko_iter -{ - UINT16 block; -}; - -struct cfs_file -{ - char name[64]; // name of the file - UINT32 date; // date/time of the file (seconds since 1900/01/01) - UINT32 size; // size of the file - UINT32 blocks; // number of blocks occupied by the file -}; - -enum -{ - BLOCK_TYPE_INVALID, - BLOCK_TYPE_BOOT, - BLOCK_TYPE_FILE -}; - -#define MAX_PAGE_SIZE (264 * 2) - -#define INVALID_FILE_ID 0xFFFF - -#define BLOCK_USED(x) (x[0] & 0x80) -#define BLOCK_FILE_ID(x) buffer_read_16_be( x + 2) -#define BLOCK_PART_ID(x) buffer_read_16_be( x + 4) -#define BLOCK_FILENAME(x) (char*)(x + 7) - -#define FILE_HEADER_SIZE 0x48 - -// 2208988800 is the number of seconds between 1900/01/01 and 1970/01/01 - -static time_t time_crack( UINT32 cfs_time) -{ - return (time_t)(cfs_time - 2208988800UL); -} - -static UINT32 time_setup( time_t ansi_time) -{ - return (UINT32)(ansi_time + 2208988800UL); -} - -static UINT32 buffer_read_32_be( UINT8 *buffer) -{ - return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | (buffer[3] << 0); -} - -static UINT16 buffer_read_16_be( UINT8 *buffer) -{ - return (buffer[0] << 8) | (buffer[1] << 0); -} - -static void buffer_write_32_be( UINT8 *buffer, UINT32 data) -{ - buffer[0] = (data >> 24) & 0xFF; - buffer[1] = (data >> 16) & 0xFF; - buffer[2] = (data >> 8) & 0xFF; - buffer[3] = (data >> 0) & 0xFF; -} - -static void buffer_write_16_be( UINT8 *buffer, UINT16 data) -{ - buffer[0] = (data >> 8) & 0xFF; - buffer[1] = (data >> 0) & 0xFF; -} - -// page = crc (2) + data (x) - -static UINT16 page_buffer_calc_checksum( UINT8 *data, UINT32 size) -{ - int i; - UINT32 val = 0; - for (i = 0; i < size; i++) - { - val = (val ^ data[i] ^ i) << 1; - val = val | ((val >> 16) & 0x0001); - } - return val; -} - -static int page_buffer_verify( UINT8 *buffer, UINT32 size, int block_type) -{ - // checksum - if (block_type == BLOCK_TYPE_FILE) - { - UINT32 checksum_page, checksum_calc; - checksum_calc = page_buffer_calc_checksum( buffer + 2, size - 2); - checksum_page = buffer_read_16_be( buffer + 0); - if (checksum_calc != checksum_page) return FALSE; - } - // ok - return TRUE; -} - -static int cfs_block_to_page( cybiko_file_system *cfs, int block_type, UINT32 block, UINT32 *page) -{ - switch (block_type) - { - case BLOCK_TYPE_BOOT : if (page) *page = block; return TRUE; - case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return TRUE; - default : return FALSE; - } -} - -static int cfs_page_to_block( cybiko_file_system *cfs, UINT32 page, int *block_type, UINT32 *block) -{ - UINT32 tmp = page; - // boot block - if (tmp < cfs->block_count_boot) - { - if (block_type) *block_type = BLOCK_TYPE_BOOT; - if (block) *block = tmp; - return TRUE; - } - tmp -= cfs->block_count_boot; - // file block - if (tmp < cfs->block_count_file) - { - if (block_type) *block_type = BLOCK_TYPE_FILE; - if (block) *block = tmp; - return TRUE; - } - tmp -= cfs->block_count_file; - // error - return FALSE; -} - -static int cfs_page_read( cybiko_file_system *cfs, UINT8 *buffer, UINT32 page) -{ - if (page >= cfs->page_count) return FALSE; - stream_seek( cfs->stream, page * cfs->page_size, SEEK_SET); - stream_read( cfs->stream, buffer, cfs->page_size); - return TRUE; -} - -static int cfs_page_write( cybiko_file_system *cfs, UINT8 *buffer, UINT32 page) -{ - if (page >= cfs->page_count) return FALSE; - stream_seek( cfs->stream, page * cfs->page_size, SEEK_SET); - stream_write( cfs->stream, buffer, cfs->page_size); - return TRUE; -} - -static int cfs_block_read( cybiko_file_system *cfs, UINT8 *buffer, int block_type, UINT32 block) -{ - UINT8 buffer_page[MAX_PAGE_SIZE]; - UINT32 page; - if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE; - if (!cfs_page_read( cfs, buffer_page, page)) return FALSE; - memcpy( buffer, buffer_page + 2, cfs->page_size - 2); - return TRUE; -} - -static int cfs_block_write( cybiko_file_system *cfs, UINT8 *buffer, int block_type, UINT32 block) -{ - UINT8 buffer_page[MAX_PAGE_SIZE]; - UINT32 page; - UINT16 checksum; - memcpy( buffer_page + 2, buffer, cfs->page_size - 2); - if (block_type == BLOCK_TYPE_BOOT) - { - checksum = 0xFFFF; - } - else - { - checksum = page_buffer_calc_checksum( buffer_page + 2, cfs->page_size - 2); - } - buffer_write_16_be( buffer_page + 0, checksum); - if (!cfs_block_to_page( cfs, block_type, block, &page)) return FALSE; - if (!cfs_page_write( cfs, buffer_page, page)) return FALSE; - return TRUE; -} - -static int cfs_file_delete( cybiko_file_system *cfs, UINT16 file_id) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id)) - { - buffer[0] &= ~0x80; - if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - } - } - return TRUE; -} - -static int cfs_file_info( cybiko_file_system *cfs, UINT16 file_id, cfs_file *file) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - file->blocks = file->size = 0; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id)) - { - if (BLOCK_PART_ID(buffer) == 0) - { - strcpy( file->name, BLOCK_FILENAME(buffer)); - file->date = buffer_read_32_be( buffer + 6 + FILE_HEADER_SIZE - 4); - } - file->size += buffer[1]; - file->blocks++; - } - } - return (file->blocks > 0) ? TRUE : FALSE; -} - -static int cfs_file_find( cybiko_file_system *cfs, const char *filename, UINT16 *file_id) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - if (BLOCK_USED(buffer) && (BLOCK_PART_ID(buffer) == 0) && (strcmp( filename, BLOCK_FILENAME(buffer)) == 0)) - { - *file_id = i; - return TRUE; - } - } - return FALSE; -} - -static int cfs_verify( cybiko_file_system *cfs) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i, block_type; - for (i=0;ipage_count;i++) - { - if (!cfs_page_read( cfs, buffer, i)) return FALSE; - if (!cfs_page_to_block( cfs, i, &block_type, NULL)) return FALSE; - if (!page_buffer_verify( buffer, cfs->page_size, block_type)) return FALSE; - } - return TRUE; -} - -static int cfs_init( cybiko_file_system *cfs, imgtool_stream *stream) -{ - cfs->stream = stream; - cfs->page_count = 2005; - cfs->page_size = 258; - cfs->block_count_boot = 5; - cfs->block_count_file = cfs->page_count - cfs->block_count_boot; - cfs->write_count = 0; - return TRUE; -} - -static int cfs_format( cybiko_file_system *cfs) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - // boot blocks - memset( buffer, 0xFF, sizeof( buffer)); - for (i=0;iblock_count_boot;i++) - { - if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return FALSE; - } - // file blocks - memset( buffer, 0xFF, sizeof( buffer)); - buffer[0] &= ~0x80; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return FALSE; - } - // padding - buffer[0] = 0xFF; - for (i=0;i<0x1B56;i++) - { - stream_write( cfs->stream, buffer, 1); - } - // ok - return TRUE; -} - -static UINT16 cfs_calc_free_blocks( cybiko_file_system *cfs) -{ - UINT8 buffer[MAX_PAGE_SIZE]; - int i; - UINT16 blocks = 0; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return 0; - if (!BLOCK_USED(buffer)) blocks++; - } - return blocks; -} - -static UINT32 cfs_calc_free_space( cybiko_file_system *cfs, UINT16 blocks) -{ - UINT32 free_space; - free_space = blocks * ((cfs->page_size - 2) - 6); - if (free_space > 0) free_space -= FILE_HEADER_SIZE; - return free_space; -} - -static imgtoolerr_t cybiko_image_open( imgtool_image *image, imgtool_stream *stream) -{ - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - // init - if (!cfs_init( cfs, stream)) return IMGTOOLERR_CORRUPTIMAGE; - // verify - if (!cfs_verify( cfs)) return IMGTOOLERR_CORRUPTIMAGE; - // ok - return IMGTOOLERR_SUCCESS; -} - -static void cybiko_image_close( imgtool_image *image) -{ - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - stream_close( cfs->stream); -} - -static imgtoolerr_t cybiko_image_create( imgtool_image *image, imgtool_stream *stream, option_resolution *opts) -{ - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - // init - if (!cfs_init( cfs, stream)) return IMGTOOLERR_CORRUPTIMAGE; - // format - if (!cfs_format( cfs)) return IMGTOOLERR_CORRUPTIMAGE; - // ok - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_begin_enum( imgtool_directory *enumeration, const char *path) -{ - cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration); - iter->block = 0; - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_next_enum( imgtool_directory *enumeration, imgtool_dirent *ent) -{ - imgtool_image *image = imgtool_directory_image( enumeration); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration); - UINT8 buffer[MAX_PAGE_SIZE]; - UINT16 file_id = INVALID_FILE_ID; - cfs_file file; - // find next file - while (iter->block < cfs->block_count_file) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, iter->block++)) return IMGTOOLERR_READERROR; - if (BLOCK_USED(buffer) && (BLOCK_PART_ID(buffer) == 0)) - { - file_id = BLOCK_FILE_ID(buffer); - break; - } - } - // get file information - if ((file_id != INVALID_FILE_ID) && cfs_file_info( cfs, file_id, &file)) - { - strcpy( ent->filename, file.name); - ent->filesize = file.size; - ent->lastmodified_time = time_crack( file.date); - ent->filesize = file.size; - } - else - { - ent->eof = 1; - } - // ok - return IMGTOOLERR_SUCCESS; -} - -static void cybiko_image_close_enum( imgtool_directory *enumeration) -{ - // nothing -} - -static imgtoolerr_t cybiko_image_free_space( imgtool_partition *partition, UINT64 *size) -{ - imgtool_image *image = imgtool_partition_image( partition); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - if (size) *size = cfs_calc_free_space( cfs, cfs_calc_free_blocks( cfs)); - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_read_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtool_image *image = imgtool_partition_image( partition); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - UINT8 buffer[MAX_PAGE_SIZE]; - UINT16 file_id, part_id = 0, old_part_id; - int i; - // check filename - if (strlen( filename) > 58) return IMGTOOLERR_BADFILENAME; - // find file - if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND; - // read file - do - { - old_part_id = part_id; - for (i=0;iblock_count_file;i++) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR; - if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id) && (BLOCK_PART_ID(buffer) == part_id)) - { - stream_write( destf, buffer + 6 + ((part_id == 0) ? FILE_HEADER_SIZE : 0), buffer[1]); - part_id++; - } - } - } while (old_part_id != part_id); - // ok - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtool_image *image = imgtool_partition_image( partition); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - UINT8 buffer[MAX_PAGE_SIZE]; - UINT16 file_id, part_id = 0, free_blocks; - UINT64 bytes_left; - cfs_file file; - int i; - // check filename - if (strlen( filename) > 58) return IMGTOOLERR_BADFILENAME; - // find file - if (!cfs_file_find( cfs, filename, &file_id)) file_id = INVALID_FILE_ID; - // check free space - free_blocks = cfs_calc_free_blocks( cfs); - if (file_id != INVALID_FILE_ID) - { - if (!cfs_file_info( cfs, file_id, &file)) return IMGTOOLERR_UNEXPECTED; - free_blocks += file.blocks; - } - if (cfs_calc_free_space( cfs, free_blocks) < stream_size( sourcef)) return IMGTOOLERR_NOSPACE; - // delete file - if (file_id != INVALID_FILE_ID) - { - if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED; - } - // create/write destination file - bytes_left = stream_size( sourcef); - i = 0; - while (i < cfs->block_count_file) - { - if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR; - if (!BLOCK_USED(buffer)) - { - if (part_id == 0) file_id = i; - memset( buffer, 0xFF, cfs->page_size - 0x02); - buffer[0] = 0x80; - buffer[1] = (cfs->page_size - 2) - 6 - ((part_id == 0) ? FILE_HEADER_SIZE : 0); - if (bytes_left < buffer[1]) buffer[1] = bytes_left; - buffer_write_16_be( buffer + 2, file_id); - buffer_write_16_be( buffer + 4, part_id); - if (part_id == 0) - { - buffer[6] = 0x20; - strcpy( BLOCK_FILENAME(buffer), filename); - buffer_write_32_be( buffer + 6 + FILE_HEADER_SIZE - 4, time_setup( time( NULL))); - stream_read( sourcef, buffer + 6 + FILE_HEADER_SIZE, buffer[1]); - } - else - { - stream_read( sourcef, buffer + 6, buffer[1]); - } - if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_WRITEERROR; - bytes_left -= buffer[1]; - if (bytes_left == 0) break; - part_id++; - } - i++; - } - // ok - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t cybiko_image_delete_file( imgtool_partition *partition, const char *filename) -{ - imgtool_image *image = imgtool_partition_image( partition); - cybiko_file_system *cfs = (cybiko_file_system*)imgtool_image_extra_bytes( image); - UINT16 file_id; - // check filename - if (strlen( filename) > 58) return IMGTOOLERR_BADFILENAME; - // find file - if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND; - // delete file - if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED; - // ok - return IMGTOOLERR_SUCCESS; -} - -void cybikoxt_get_info( const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch (state) - { - // --- the following bits of info are returned as 64-bit signed integers --- - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES : info->i = sizeof( cybiko_file_system); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES : info->i = sizeof( cybiko_iter); break; -// case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME : info->i = 1; break; - case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME : info->i = 1; break; -// case IMGTOOLINFO_INT_BLOCK_SIZE : info->i = 264; break; - // --- the following bits of info are returned as pointers to data or functions --- - case IMGTOOLINFO_PTR_OPEN : info->open = cybiko_image_open; break; - case IMGTOOLINFO_PTR_CREATE : info->create = cybiko_image_create; break; - case IMGTOOLINFO_PTR_CLOSE : info->close = cybiko_image_close; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = cybiko_image_begin_enum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = cybiko_image_next_enum; break; - case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = cybiko_image_close_enum; break; - case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = cybiko_image_free_space; break; - case IMGTOOLINFO_PTR_READ_FILE : info->read_file = cybiko_image_read_file; break; - case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = cybiko_image_write_file; break; - case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = cybiko_image_delete_file; break; - // --- the following bits of info are returned as NULL-terminated strings --- - case IMGTOOLINFO_STR_NAME : strcpy( info->s = imgtool_temp_str(), "cybikoxt"); break; - case IMGTOOLINFO_STR_DESCRIPTION : strcpy( info->s = imgtool_temp_str(), "Cybiko Xtreme File System"); break; - case IMGTOOLINFO_STR_FILE : strcpy( info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "bin,nv"); break; - case IMGTOOLINFO_STR_EOLN : strcpy( info->s = imgtool_temp_str(), "\r\n"); break; - } -} diff --git a/src/mess/tools/imgtool/modules/fat.c b/src/mess/tools/imgtool/modules/fat.c deleted file mode 100644 index 4f2fca17c25..00000000000 --- a/src/mess/tools/imgtool/modules/fat.c +++ /dev/null @@ -1,2111 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/**************************************************************************** - - fat.c - - PC FAT disk images - -***************************************************************************** - - Master boot record format: - - Offset Length Description - ------ ------ ----------- - 0 446 Boot machine code - 446 16 Partion #1 info - 462 16 Partion #2 info - 478 16 Partion #3 info - 494 16 Partion #4 info - 510 2 Magic bytes (0x55 0xAA) - - - Partition info format: - - Offset Length Description - ------ ------ ----------- - 0 1 Active byte (0x80=active 0x00=inactive) - 1 1 Starting head - 2 1 Starting sector (bits 5-0) and high bits of starting track (bits 6-5) - 3 1 Low bits of starting track - 4 1 Partition type: - 0x00 Unused - 0x?1 FAT12 (0-15 MB) - 0x?2 XENIX - 0x?4 FAT16 (16-32 MB) - 0x?6 FAT16` (32 MB-2 GB) - 0x?7 HPFS or NTFS - 0x?A Boot Manager - 0x?B FAT32 (512 MB-2 TB) - 0x?C FAT32 (512 MB-2 TB LBA) - 0x1? OS/2 Boot manager/Win95 hidden - 0xC? DR-DOS secured partition - 0xD? Multiuser DOS secured partition - 0xE? SpeedStor extended partition - 5 1 Ending head - 6 1 Ending sector (bits 5-0) and high bits of ending track (bits 6-5) - 7 1 Low bits of ending track - 8 4 Sector index of beginning of partition - 12 4 Total sectors in partition - - - Boot sector format: - - Offset Length Description - ------ ------ ----------- - 0 3 Jump instruction (to skip over header on boot) - 3 8 OEM Name - 11 2 Bytes per sector - 13 1 Sectors per cluster - 14 2 Reserved sector count (including boot sector) - 16 1 Number of FATs (file allocation tables) - 17 2 Number of root directory entries - 19 2 Total sectors (bits 0-15) - 21 1 Media descriptor - 22 2 Sectors per FAT - 24 2 Sectors per track - 26 2 Number of heads - 28 4 Hidden sectors - 32 4 Total sectors (bits 16-47) - 36 1 Physical drive number - 37 1 Current head - 38 1 Signature - 39 4 ID - 43 11 Volume Label - 54 8 FAT file system type - 62 448 Boot machine code - 510 2 Magic bytes (0x55 0xAA) - - For more information: - http://support.microsoft.com/kb/q140418/ - - - Directory Entry Format: - - Offset Length Description - ------ ------ ----------- - 0 8 DOS File Name (padded with spaces) - 8 3 DOS File Extension (padded with spaces) - 11 1 File Attributes - 12 2 Unknown - 14 4 Time of Creation - 18 2 Last Access Time - 20 2 EA-Index (OS/2 stuff) - 22 4 Last Modified Time - 26 2 First Cluster - 28 4 File Size - - - Dates and times are stored in separate words; when together, the time is - first and the date is second. - - Time: - bits 15-11 Hour - bits 10- 5 Minute - bits 4- 0 Second / 2 - - Date: - bits 15- 9 Year - 1980 - bits 8- 5 Month - bits 4- 0 Day - - LFN Entry Format: - - Offset Length Description - ------ ------ ----------- - 0 1 Sequence Number (bit 6 is set on highest sequence) - 1 10 Name characters (five UTF-16LE chars) - 11 1 Attributes (always 0x0F) - 12 1 Reserved (always 0x00) - 13 1 Checksum of short filename entry - 14 12 Name characters (six UTF-16LE chars) - 26 2 Entry Cluster (always 0x00) - 28 4 Name characters (two UTF-16LE chars) - - Valid characters in DOS file names: - - Upper case letters A-Z - - Numbers 0-9 - - Space (though there is no way to identify a trailing space) - - ! # $ % & ( ) - @ ^ _ ` { } ~ - - Characters 128-255 (though the code page is indeterminate) - - For more information: - http://en.wikipedia.org/wiki/File_Allocation_Table - -****************************************************************************/ - -#include -#include -#include "imgtool.h" -#include "formats/imageutl.h" -#include "unicode.h" -#include "fat.h" - -#define FAT_DIRENT_SIZE 32 -#define FAT_SECLEN 512 - -#define LOG(x) - -struct fat_partition_info -{ - UINT32 fat_bits; - UINT32 sectors_per_cluster; - UINT32 cluster_size; - UINT32 reserved_sectors; - UINT32 fat_count; - UINT32 root_entries; - UINT32 sectors_per_fat; - UINT64 total_sectors; - UINT32 total_clusters; -}; - -struct fat_file -{ - unsigned int root : 1; - unsigned int directory : 1; - unsigned int eof : 1; - UINT32 index; - UINT32 filesize; - UINT32 first_cluster; - UINT32 parent_first_cluster; - UINT32 cluster; - UINT32 cluster_index; - UINT32 dirent_sector_index; - UINT32 dirent_sector_offset; -}; - -struct fat_dirent -{ - char long_filename[512]; - char short_filename[13]; - unsigned int directory : 1; - unsigned int eof : 1; - UINT32 filesize; - UINT32 first_cluster; - UINT32 dirent_sector_index; - UINT32 dirent_sector_offset; - time_t creation_time; - time_t lastmodified_time; -}; - -struct fat_freeentry_info -{ - UINT32 required_size; - UINT32 candidate_position; - UINT32 position; -}; - -struct fat_mediatype -{ - UINT8 media_descriptor; - UINT8 heads; - UINT8 tracks; - UINT8 sectors; -}; - -enum creation_policy_t -{ - CREATE_NONE, - CREATE_FILE, - CREATE_DIR -}; - - - -static const fat_mediatype known_media[] = -{ - { 0xF0, 2, 80, 36 }, - { 0xF0, 2, 80, 18 }, - { 0xF9, 2, 80, 9 }, - { 0xF9, 2, 80, 15 }, - { 0xFD, 2, 40, 9 }, - { 0xFF, 2, 40, 8 }, - { 0xFC, 1, 40, 9 }, - { 0xFE, 1, 40, 8 }, - { 0xF8, 0, 0, 0 } -}; - -/* boot sector code taken from FreeDOS */ -static const UINT8 boot_sector_code[] = -{ - 0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xd8, 0xbd, 0x00, 0x7c, 0xb8, 0xe0, 0x1f, - 0x8e, 0xc0, 0x89, 0xee, 0x89, 0xef, 0xb9, 0x00, 0x01, 0xf3, 0xa5, 0xea, - 0x5e, 0x7c, 0xe0, 0x1f, 0x00, 0x00, 0x60, 0x00, 0x8e, 0xd8, 0x8e, 0xd0, - 0x8d, 0x66, 0xa0, 0xfb, 0x80, 0x7e, 0x24, 0xff, 0x75, 0x03, 0x88, 0x56, - 0x24, 0xc7, 0x46, 0xc0, 0x10, 0x00, 0xc7, 0x46, 0xc2, 0x01, 0x00, 0x8b, - 0x76, 0x1c, 0x8b, 0x7e, 0x1e, 0x03, 0x76, 0x0e, 0x83, 0xd7, 0x00, 0x89, - 0x76, 0xd2, 0x89, 0x7e, 0xd4, 0x8a, 0x46, 0x10, 0x98, 0xf7, 0x66, 0x16, - 0x01, 0xc6, 0x11, 0xd7, 0x89, 0x76, 0xd6, 0x89, 0x7e, 0xd8, 0x8b, 0x5e, - 0x0b, 0xb1, 0x05, 0xd3, 0xeb, 0x8b, 0x46, 0x11, 0x31, 0xd2, 0xf7, 0xf3, - 0x89, 0x46, 0xd0, 0x01, 0xc6, 0x83, 0xd7, 0x00, 0x89, 0x76, 0xda, 0x89, - 0x7e, 0xdc, 0x8b, 0x46, 0xd6, 0x8b, 0x56, 0xd8, 0x8b, 0x7e, 0xd0, 0xc4, - 0x5e, 0x5a, 0xe8, 0xac, 0x00, 0xc4, 0x7e, 0x5a, 0xb9, 0x0b, 0x00, 0xbe, - 0xf1, 0x7d, 0x57, 0xf3, 0xa6, 0x5f, 0x26, 0x8b, 0x45, 0x1a, 0x74, 0x0b, - 0x83, 0xc7, 0x20, 0x26, 0x80, 0x3d, 0x00, 0x75, 0xe7, 0x72, 0x68, 0x50, - 0xc4, 0x5e, 0x5a, 0x8b, 0x7e, 0x16, 0x8b, 0x46, 0xd2, 0x8b, 0x56, 0xd4, - 0xe8, 0x7e, 0x00, 0x58, 0x1e, 0x07, 0x8e, 0x5e, 0x5c, 0xbf, 0x00, 0x20, - 0xab, 0x89, 0xc6, 0x01, 0xf6, 0x01, 0xc6, 0xd1, 0xee, 0xad, 0x73, 0x04, - 0xb1, 0x04, 0xd3, 0xe8, 0x80, 0xe4, 0x0f, 0x3d, 0xf8, 0x0f, 0x72, 0xe8, - 0x31, 0xc0, 0xab, 0x0e, 0x1f, 0xc4, 0x5e, 0x5a, 0xbe, 0x00, 0x20, 0xad, - 0x09, 0xc0, 0x75, 0x05, 0x88, 0xd3, 0xff, 0x6e, 0x5a, 0x48, 0x48, 0x8b, - 0x7e, 0x0d, 0x81, 0xe7, 0xff, 0x00, 0xf7, 0xe7, 0x03, 0x46, 0xda, 0x13, - 0x56, 0xdc, 0xe8, 0x34, 0x00, 0xeb, 0xe0, 0x5e, 0xac, 0x56, 0xb4, 0x0e, - 0xcd, 0x10, 0x3c, 0x2e, 0x75, 0xf5, 0xc3, 0xe8, 0xf1, 0xff, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x21, 0x20, 0x48, 0x69, 0x74, 0x20, 0x61, 0x20, 0x6b, - 0x65, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74, - 0x2e, 0x30, 0xe4, 0xcd, 0x13, 0xcd, 0x16, 0xcd, 0x19, 0x56, 0x89, 0x46, - 0xc8, 0x89, 0x56, 0xca, 0x8c, 0x46, 0xc6, 0x89, 0x5e, 0xc4, 0xe8, 0xbe, - 0xff, 0x2e, 0xb4, 0x41, 0xbb, 0xaa, 0x55, 0x8a, 0x56, 0x24, 0x84, 0xd2, - 0x74, 0x19, 0xcd, 0x13, 0x72, 0x15, 0xd1, 0xe9, 0x81, 0xdb, 0x54, 0xaa, - 0x75, 0x0d, 0x8d, 0x76, 0xc0, 0x89, 0x5e, 0xcc, 0x89, 0x5e, 0xce, 0xb4, - 0x42, 0xeb, 0x26, 0x8b, 0x4e, 0xc8, 0x8b, 0x56, 0xca, 0x8a, 0x46, 0x18, - 0xf6, 0x66, 0x1a, 0x91, 0xf7, 0xf1, 0x92, 0xf6, 0x76, 0x18, 0x89, 0xd1, - 0x88, 0xc6, 0x86, 0xe9, 0xd0, 0xc9, 0xd0, 0xc9, 0x08, 0xe1, 0x41, 0xc4, - 0x5e, 0xc4, 0xb8, 0x01, 0x02, 0x8a, 0x56, 0x24, 0xcd, 0x13, 0x0f, 0x82, - 0x75, 0xff, 0x8b, 0x46, 0x0b, 0xf6, 0x76, 0xc0, 0x01, 0x46, 0xc6, 0x83, - 0x46, 0xc8, 0x01, 0x83, 0x56, 0xca, 0x00, 0x4f, 0x75, 0x98, 0x8e, 0x46, - 0xc6, 0x5e, 0xc3, 0x4d, 0x45, 0x54, 0x41, 0x4b, 0x45, 0x52, 0x4e, 0x53, - 0x59, 0x53, 0x00, 0x00, 0x55, 0xaa -}; - -static const char fat8_string[8] = { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' }; -static const char fat12_string[8] = { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' }; -static const char fat16_string[8] = { 'F', 'A', 'T', '1', '6', ' ', ' ', ' ' }; -static const char fat32_string[8] = { 'F', 'A', 'T', '3', '2', ' ', ' ', ' ' }; - - - -static fat_partition_info *fat_get_partition_info(imgtool_partition *partition) -{ - return (fat_partition_info *) imgtool_partition_extra_bytes(partition); -} - - - -static imgtoolerr_t fat_read_sector(imgtool_partition *partition, UINT32 sector_index, - int offset, void *buffer, size_t buffer_len) -{ - //const fat_partition_info *disk_info; - imgtoolerr_t err; - UINT8 data[FAT_SECLEN]; - UINT32 block_size; - size_t len; - - //disk_info = fat_get_partition_info(partition); - - /* sanity check */ - err = imgtool_partition_get_block_size(partition, &block_size); - if (err) - return err; - assert(block_size == sizeof(data)); - - while(buffer_len > 0) - { - err = imgtool_partition_read_block(partition, sector_index++, data); - if (err) - return err; - - len = MIN(buffer_len, sizeof(data) - offset); - memcpy(buffer, data + offset, len); - - buffer = ((UINT8 *) buffer) + len; - buffer_len -= len; - offset = 0; - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_write_sector(imgtool_partition *partition, UINT32 sector_index, - int offset, const void *buffer, size_t buffer_len) -{ - //const fat_partition_info *disk_info; - imgtoolerr_t err; - UINT8 data[FAT_SECLEN]; - const void *write_data; - UINT32 block_size; - size_t len; - - //disk_info = fat_get_partition_info(partition); - - /* sanity check */ - err = imgtool_partition_get_block_size(partition, &block_size); - if (err) - return err; - assert(block_size == sizeof(data)); - - while(buffer_len > 0) - { - len = MIN(buffer_len, sizeof(data) - offset); - - if ((offset != 0) || (buffer_len < sizeof(data))) - { - err = imgtool_partition_read_block(partition, sector_index, data); - if (err) - return err; - memcpy(data + offset, buffer, len); - write_data = data; - } - else - { - write_data = buffer; - } - - err = imgtool_partition_write_block(partition, sector_index++, write_data); - if (err) - return err; - - buffer = ((UINT8 *) buffer) + len; - buffer_len -= len; - offset = 0; - } - return IMGTOOLERR_SUCCESS; -} - - -#ifdef UNUSED_FUNCTION -static imgtoolerr_t fat_clear_sector(imgtool_partition *partition, UINT32 sector_index, UINT8 data) -{ - char buf[FAT_SECLEN]; - memset(buf, data, sizeof(buf)); - return fat_write_sector(partition, sector_index, 0, buf, sizeof(buf)); -} -#endif - - -static imgtoolerr_t fat_partition_open(imgtool_partition *partition, UINT64 first_block, UINT64 block_count) -{ - UINT8 header[FAT_SECLEN]; - imgtoolerr_t err; - fat_partition_info *info; - UINT32 fat_bits, total_sectors_l, total_sectors_h, sector_size; - UINT64 available_sectors; - //int has_extended_bios_param_block = TRUE; - - info = fat_get_partition_info(partition); - - /* read the boot/root sector */ - err = fat_read_sector(partition, 0, 0, header, sizeof(header)); - if (err) - return err; - - /* magic bytes present? */ - if ((header[510] != 0x55) || (header[511] != 0xAA)) - return IMGTOOLERR_CORRUPTIMAGE; - - /* determine which type of FAT is on this disk */ - if (!memcmp(&header[54], fat8_string, sizeof(fat8_string))) - fat_bits = 8; - else if (!memcmp(&header[54], fat12_string, sizeof(fat12_string))) - fat_bits = 12; - else if (!memcmp(&header[54], fat16_string, sizeof(fat16_string))) - fat_bits = 16; - else if (!memcmp(&header[54], fat32_string, sizeof(fat32_string))) - fat_bits = 32; - else - { - fat_bits = 8; - //has_extended_bios_param_block = FALSE; - } - - info->fat_bits = fat_bits; - sector_size = pick_integer_le(header, 11, 2); - info->sectors_per_cluster = pick_integer_le(header, 13, 1); - info->reserved_sectors = pick_integer_le(header, 14, 2); - info->fat_count = pick_integer_le(header, 16, 1); - info->root_entries = pick_integer_le(header, 17, 2); - total_sectors_l = pick_integer_le(header, 19, 2); - info->sectors_per_fat = pick_integer_le(header, 22, 2); - total_sectors_h = pick_integer_le(header, 32, 4); - - if (info->sectors_per_cluster == 0) - return IMGTOOLERR_CORRUPTIMAGE; - - info->total_sectors = total_sectors_l + (((UINT64) total_sectors_h) << 16); - available_sectors = info->total_sectors - info->reserved_sectors - - (info->sectors_per_fat * info->fat_count) - - (info->root_entries * FAT_DIRENT_SIZE + FAT_SECLEN - 1) / FAT_SECLEN; - info->total_clusters = (available_sectors + info->sectors_per_cluster - 1) / info->sectors_per_cluster; - info->cluster_size = FAT_SECLEN * info->sectors_per_cluster; - - if (info->fat_count == 0) - return IMGTOOLERR_CORRUPTIMAGE; - if (sector_size != FAT_SECLEN) - return IMGTOOLERR_CORRUPTIMAGE; - if (info->sectors_per_fat == 0) - return IMGTOOLERR_CORRUPTIMAGE; - if (info->sectors_per_cluster == 0) - return IMGTOOLERR_CORRUPTIMAGE; - if (info->reserved_sectors == 0) - return IMGTOOLERR_CORRUPTIMAGE; - if (info->total_clusters * info->fat_bits > info->sectors_per_fat * FAT_SECLEN * 8) - return IMGTOOLERR_CORRUPTIMAGE; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_partition_create(imgtool_image *image, UINT64 first_block, UINT64 block_count) -{ - imgtoolerr_t err; - UINT32 heads, tracks, sectors_per_track; - UINT32 fat_bits, sectors_per_cluster, reserved_sectors, hidden_sectors; - UINT32 root_dir_count, root_dir_sectors; - UINT32 sectors_per_fat, fat_count, i; - UINT32 boot_sector_offset; - UINT64 total_clusters; - UINT8 media_descriptor; - //const char *title; - const char *fat_bits_string; - UINT8 header[FAT_SECLEN]; -#if 0 - UINT64 first_fat_entries; -#endif - - /* check for limits */ - if (block_count > U64(0xFFFFFFFFFFFF)) - return IMGTOOLERR_PARAMTOOLARGE; - - /* get the geometry */ - err = imgtool_image_get_geometry(image, &tracks, &heads, §ors_per_track); - if (err) - return err; - - /* cap our sector count so that we only use FAT12/16 */ - sectors_per_cluster = (block_count + 65524 - 1) / 65524; - - /* compute the FAT file system type */ - if ((block_count / sectors_per_cluster) <= 4084) - { - fat_bits = 12; - fat_bits_string = fat12_string; - } - else if ((block_count / sectors_per_cluster) <= 65524) - { - fat_bits = 16; - fat_bits_string = fat16_string; - } - else - { - fat_bits = 32; - fat_bits_string = fat32_string; - } - - /* figure out media type */ - i = 0; - while((known_media[i].heads > 0) && ((known_media[i].heads != heads) - || (known_media[i].tracks != tracks) - || (known_media[i].sectors != sectors_per_track))) - { - i++; - } - media_descriptor = known_media[i].media_descriptor; - - /* other miscellaneous settings */ - //title = ""; - fat_count = 2; - root_dir_count = 512; - hidden_sectors = 0; - reserved_sectors = 1; - - /* calculated settings */ - root_dir_sectors = (root_dir_count * FAT_DIRENT_SIZE + FAT_SECLEN - 1) / FAT_SECLEN; - total_clusters = (block_count - reserved_sectors - hidden_sectors - root_dir_sectors) - / sectors_per_cluster; - sectors_per_fat = (total_clusters * fat_bits + (FAT_SECLEN * 8) - 1) - / (FAT_SECLEN * 8); - - /* prepare the header */ - memset(header, 0, sizeof(header)); - memcpy(&header[3], "IMGTOOL ", 8); - place_integer_le(header, 11, 2, FAT_SECLEN); - place_integer_le(header, 13, 1, sectors_per_cluster); - place_integer_le(header, 14, 1, reserved_sectors); - place_integer_le(header, 16, 1, fat_count); - place_integer_le(header, 17, 2, root_dir_count); - place_integer_le(header, 19, 2, (UINT16) (block_count >> 0)); - place_integer_le(header, 21, 1, media_descriptor); - place_integer_le(header, 22, 2, sectors_per_fat); - place_integer_le(header, 24, 2, sectors_per_track); - place_integer_le(header, 26, 2, heads); - place_integer_le(header, 28, 4, hidden_sectors); - place_integer_le(header, 32, 4, (UINT32) (block_count >> 16)); - place_integer_le(header, 36, 1, 0xFF); - place_integer_le(header, 38, 1, 0x28); - place_integer_le(header, 39, 4, imgtool_image_rand(image)); - memcpy(&header[43], " ", 11); - memcpy(&header[54], fat_bits_string, 8); - - /* store boot code */ - boot_sector_offset = sizeof(header) - sizeof(boot_sector_code); - if (boot_sector_offset < 62) - return IMGTOOLERR_UNEXPECTED; /* sanity check */ - if (boot_sector_offset > 510) - return IMGTOOLERR_UNEXPECTED; /* sanity check */ - memcpy(&header[boot_sector_offset], boot_sector_code, sizeof(boot_sector_code)); - - /* specify jump instruction */ - if (boot_sector_offset <= 129) - { - header[0] = 0xEB; /* JMP rel8 */ - header[1] = (UINT8) (boot_sector_offset - 2); /* (offset) */ - header[2] = 0x90; /* NOP */ - } - else - { - header[0] = 0xE9; /* JMP rel16 */ - header[1] = (UINT8) ((boot_sector_offset - 2) >> 0); /* (offset) */ - header[2] = (UINT8) ((boot_sector_offset - 2) >> 8); /* (offset) */ - } - - err = imgtool_image_write_block(image, first_block, header); - if (err) - return err; - - /* clear out file allocation table */ - for (i = reserved_sectors; i < (reserved_sectors + sectors_per_fat * fat_count + root_dir_sectors); i++) - { - err = imgtool_image_clear_block(image, first_block + i, 0); - if (err) - return err; - } - - // FIXME: this causes a corrupt PC floppy image since it doubles the FAT partition header - works without it though -#if 0 - /* set first two FAT entries */ - first_fat_entries = ((UINT64) media_descriptor) | 0xFFFFFF00; - first_fat_entries &= (((UINT64) 1) << fat_bits) - 1; - first_fat_entries |= ((((UINT64) 1) << fat_bits) - 1) << fat_bits; - first_fat_entries = LITTLE_ENDIANIZE_INT64(first_fat_entries); - - for (i = 0; i < fat_count; i++) - { - err = imgtool_image_write_block(image, first_block + 1 + (i * sectors_per_fat), &first_fat_entries); - if (err) - return err; - } -#endif - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_load_fat(imgtool_partition *partition, UINT8 **fat_table) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - const fat_partition_info *disk_info; - UINT8 *table; - UINT32 table_size; - UINT32 pos, len; - UINT32 sector_index; - - disk_info = fat_get_partition_info(partition); - - table_size = disk_info->sectors_per_fat * disk_info->fat_count * FAT_SECLEN; - - /* allocate the table with extra bytes, in case we "overextend" our reads */ - table = (UINT8*)malloc(table_size + sizeof(UINT64)); - if (!table) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - memset(table, 0, table_size + sizeof(UINT64)); - - pos = 0; - sector_index = disk_info->reserved_sectors; - - while(pos < table_size) - { - len = MIN(table_size - pos, FAT_SECLEN); - - err = fat_read_sector(partition, sector_index++, 0, &table[pos], len); - if (err) - goto done; - - pos += FAT_SECLEN; - } - -done: - if (err && table) - { - free(table); - table = NULL; - } - *fat_table = table; - return err; -} - - - -static imgtoolerr_t fat_save_fat(imgtool_partition *partition, const UINT8 *fat_table) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - const fat_partition_info *disk_info; - UINT32 table_size; - UINT32 pos, len; - UINT32 sector_index; - - disk_info = fat_get_partition_info(partition); - - table_size = disk_info->sectors_per_fat * disk_info->fat_count * FAT_SECLEN; - - pos = 0; - sector_index = disk_info->reserved_sectors; - - while(pos < table_size) - { - len = MIN(table_size - pos, FAT_SECLEN); - - err = fat_write_sector(partition, sector_index++, 0, &fat_table[pos], len); - if (err) - goto done; - - pos += FAT_SECLEN; - } - -done: - return err; -} - - - -static UINT32 fat_get_fat_entry(imgtool_partition *partition, const UINT8 *fat_table, UINT32 fat_entry) -{ - const fat_partition_info *disk_info; - UINT64 entry; - UINT32 bit_index, i; - UINT32 last_entry = 0; - UINT32 bit_mask; - - disk_info = fat_get_partition_info(partition); - bit_index = fat_entry * disk_info->fat_bits; - bit_mask = 0xFFFFFFFF >> (32 - disk_info->fat_bits); - - if (fat_entry >= disk_info->total_clusters) - { - assert(0); - return 1; - } - - /* make sure that the cluster is free in all fats */ - for (i = 0; i < disk_info->fat_count; i++) - { - memcpy(&entry, fat_table + (i * FAT_SECLEN - * disk_info->sectors_per_fat) + (bit_index / 8), sizeof(entry)); - - /* we've extracted the bytes; we now need to normalize it */ - entry = LITTLE_ENDIANIZE_INT64(entry); - entry >>= bit_index % 8; - entry &= bit_mask; - - if (i == 0) - last_entry = (UINT32) entry; - else if (last_entry != (UINT32) entry) - return 1; /* if the FATs disagree; mark this as reserved */ - } - - /* normalize special clusters */ - if (last_entry >= (0xFFFFFFF0 & bit_mask)) - { - last_entry |= 0xFFFFFFF0; - if (last_entry >= 0xFFFFFFF8) - last_entry = 0xFFFFFFFF; - } - return last_entry; -} - - - -static void fat_set_fat_entry(imgtool_partition *partition, UINT8 *fat_table, UINT32 fat_entry, UINT32 value) -{ - const fat_partition_info *disk_info; - UINT64 entry; - UINT32 bit_index, i; - - disk_info = fat_get_partition_info(partition); - bit_index = fat_entry * disk_info->fat_bits; - value &= 0xFFFFFFFF >> (32 - disk_info->fat_bits); - - for (i = 0; i < disk_info->fat_count; i++) - { - memcpy(&entry, fat_table + (i * FAT_SECLEN - * disk_info->sectors_per_fat) + (bit_index / 8), sizeof(entry)); - - entry = LITTLE_ENDIANIZE_INT64(entry); - entry &= (~((UINT64) 0xFFFFFFFF >> (32 - disk_info->fat_bits)) << (bit_index % 8)) | ((1 << (bit_index % 8)) - 1); - entry |= ((UINT64) value) << (bit_index % 8); - entry = LITTLE_ENDIANIZE_INT64(entry); - - memcpy(fat_table + (i * FAT_SECLEN - * disk_info->sectors_per_fat) + (bit_index / 8), &entry, sizeof(entry)); - } -} - - - -static void fat_debug_integrity_check(imgtool_partition *partition, const UINT8 *fat_table, const fat_file *file) -{ -#ifdef MAME_DEBUG - /* debug function to test the integrity of a file */ - UINT32 cluster; - const fat_partition_info *disk_info; - - disk_info = fat_get_partition_info(partition); - cluster = file->first_cluster ? file->first_cluster : 0xFFFFFFFF; - - if (!file->root) - { - while(cluster != 0xFFFFFFFF) - { - assert((cluster >= 2) && (cluster < disk_info->total_clusters)); - cluster = fat_get_fat_entry(partition, fat_table, cluster); - } - } -#endif -} - - - -static imgtoolerr_t fat_seek_file(imgtool_partition *partition, fat_file *file, UINT32 pos) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - const fat_partition_info *disk_info; - UINT32 new_cluster; - UINT8 *fat_table = NULL; - - disk_info = fat_get_partition_info(partition); - - /* can't seek past end of file */ - if (!file->directory && (pos > file->filesize)) - pos = file->filesize; - - if (file->first_cluster == 0) - { - /* special case; the root directory */ - file->index = pos; - } - else - { - /* first, we need to check to see if we have to go back to the beginning */ - if (pos < file->index) - { - file->cluster = file->first_cluster; - file->cluster_index = 0; - file->eof = 0; - } - - /* skip ahead clusters */ - while((file->cluster_index + disk_info->cluster_size) <= pos) - { - if (!fat_table) - { - err = fat_load_fat(partition, &fat_table); - if (err) - goto done; - } - - new_cluster = fat_get_fat_entry(partition, fat_table, file->cluster); - - file->cluster = new_cluster; - file->cluster_index += disk_info->cluster_size; - - /* are we at the end of the file? */ - if (new_cluster == 0xFFFFFFFF) - { - pos = file->cluster_index; - file->eof = 1; - } - } - file->index = pos; - } - -done: - if (fat_table) - free(fat_table); - return err; -} - - - -static UINT32 fat_get_filepos_sector_index(imgtool_partition *partition, fat_file *file) -{ - UINT32 sector_index; - const fat_partition_info *disk_info; - - disk_info = fat_get_partition_info(partition); - - sector_index = disk_info->reserved_sectors + (disk_info->sectors_per_fat * disk_info->fat_count); - if (file->root) - { - /* special case for the root file */ - sector_index += file->index / FAT_SECLEN; - } - else - { - /* cluster out of range? */ - if ((file->cluster < 2) || (file->cluster >= disk_info->total_clusters)) - return 0; - - sector_index += (disk_info->root_entries * FAT_DIRENT_SIZE + FAT_SECLEN - 1) / FAT_SECLEN; - sector_index += (file->cluster - 2) * disk_info->sectors_per_cluster; - sector_index += (file->index / FAT_SECLEN) % disk_info->sectors_per_cluster; - } - return sector_index; -} - - - -static imgtoolerr_t fat_corrupt_file_error(const fat_file *file) -{ - imgtoolerr_t err; - if (file->root) - err = IMGTOOLERR_CORRUPTIMAGE; - else if (file->directory) - err = IMGTOOLERR_CORRUPTDIR; - else - err = IMGTOOLERR_CORRUPTFILE; - return err; -} - - - -static imgtoolerr_t fat_readwrite_file(imgtool_partition *partition, fat_file *file, - void *buffer, size_t buffer_len, size_t *bytes_read, int read_or_write) -{ - imgtoolerr_t err; -// const fat_partition_info *disk_info; - UINT32 sector_index; - int offset; - size_t len; - -// disk_info = - fat_get_partition_info(partition); - if (bytes_read) - *bytes_read = 0; - if (!file->directory) - buffer_len = MIN(buffer_len, file->filesize - file->index); - - while(!file->eof && (buffer_len > 0)) - { - sector_index = fat_get_filepos_sector_index(partition, file); - if (sector_index == 0) - return fat_corrupt_file_error(file); - - offset = file->index % FAT_SECLEN; - len = MIN(buffer_len, FAT_SECLEN - offset); - - /* read or write the data from the disk */ - if (read_or_write) - err = fat_write_sector(partition, sector_index, offset, buffer, len); - else - err = fat_read_sector(partition, sector_index, offset, buffer, len); - if (err) - return err; - - /* and move the file pointer ahead */ - err = fat_seek_file(partition, file, file->index + len); - if (err) - return err; - - buffer = ((UINT8 *) buffer) + len; - buffer_len -= len; - if (bytes_read) - *bytes_read += len; - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_read_file(imgtool_partition *partition, fat_file *file, - void *buffer, size_t buffer_len, size_t *bytes_read) -{ - return fat_readwrite_file(partition, file, buffer, buffer_len, bytes_read, 0); -} - - - -static imgtoolerr_t fat_write_file(imgtool_partition *partition, fat_file *file, - const void *buffer, size_t buffer_len, size_t *bytes_read) -{ - return fat_readwrite_file(partition, file, (void *) buffer, buffer_len, bytes_read, 1); -} - - - -static UINT32 fat_allocate_cluster(imgtool_partition *partition, UINT8 *fat_table) -{ - const fat_partition_info *disk_info; - UINT32 i, val; - - disk_info = fat_get_partition_info(partition); - - for (i = 2; i < disk_info->total_clusters; i++) - { - val = fat_get_fat_entry(partition, fat_table, i); - if (val == 0) - { - fat_set_fat_entry(partition, fat_table, i, 1); - return i; - } - } - return 0; -} - - - -/* sets the size of a file; ~0 means 'delete' */ -static imgtoolerr_t fat_set_file_size(imgtool_partition *partition, fat_file *file, - UINT32 new_size) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - const fat_partition_info *disk_info; - UINT32 new_cluster_count; - UINT32 old_cluster_count; - UINT32 cluster, write_cluster, last_cluster, new_pos, i; - UINT8 *fat_table = NULL; - UINT8 dirent[32]; - size_t clear_size; - void *clear_buffer = NULL; - int delete_file = FALSE; - int rest_free = FALSE; - - disk_info = fat_get_partition_info(partition); - - LOG(("fat_set_file_size(): file->first_cluster=%d new_size=0x%08x\n", file->first_cluster, new_size)); - - /* special case */ - if (new_size == ~0) - { - delete_file = TRUE; - new_size = 0; - } - - /* if this is the trivial case (not changing the size), succeed */ - if (!delete_file && (file->filesize == new_size)) - { - err = IMGTOOLERR_SUCCESS; - goto done; - } - - /* what is the new position? */ - new_pos = MIN(file->index, new_size); - - if (file->root) - { - /* this is the root directory; this is a special case */ - if (new_size > (disk_info->root_entries * FAT_DIRENT_SIZE)) - { - err = IMGTOOLERR_NOSPACE; - goto done; - } - } - else - { - old_cluster_count = (file->filesize + disk_info->cluster_size - 1) / disk_info->cluster_size; - new_cluster_count = (new_size + disk_info->cluster_size - 1) / disk_info->cluster_size; - cluster = 0; - - /* load the dirent */ - err = fat_read_sector(partition, file->dirent_sector_index, file->dirent_sector_offset, dirent, sizeof(dirent)); - if (err) - goto done; - - /* need to load the FAT whether we are growing or shrinking the file */ - if (old_cluster_count != new_cluster_count) - { - err = fat_load_fat(partition, &fat_table); - if (err) - goto done; - - cluster = 0; - i = 0; - do - { - last_cluster = cluster; - write_cluster = 0; - - /* identify the next cluster */ - if (cluster != 0) - cluster = fat_get_fat_entry(partition, fat_table, cluster); - else - cluster = file->first_cluster ? file->first_cluster : 0xFFFFFFFF; - - /* do we need to grow the file by a cluster? */ - if (i < new_cluster_count && ((cluster < 2) || (cluster >= disk_info->total_clusters))) - { - /* grow this file by a cluster */ - cluster = fat_allocate_cluster(partition, fat_table); - if (cluster == 0) - { - err = IMGTOOLERR_NOSPACE; - goto done; - } - - write_cluster = cluster; - } - else if (i >= new_cluster_count) - { - /* we are shrinking the file; we need to unlink this node */ - if ((cluster < 2) || (cluster >= disk_info->total_clusters)) - cluster = 0xFFFFFFFF; /* ack file is corrupt! recover */ - write_cluster = 0xFFFFFFFF; - } - - /* write out the entry, if appropriate */ - if (write_cluster != 0) - { - /* are we tieing up loose ends? */ - if (rest_free && (write_cluster == 0xFFFFFFFF)) - write_cluster = 0; - - if (last_cluster == 0) - file->first_cluster = (write_cluster != 0xFFFFFFFF) ? write_cluster : 0; - else - fat_set_fat_entry(partition, fat_table, last_cluster, write_cluster); - - /* did we write the last cluster? if so, the rest (if any) are free */ - if (write_cluster == 0xFFFFFFFF) - rest_free = TRUE; - } - } - while((++i < new_cluster_count) || (cluster != 0xFFFFFFFF)); - } - - /* record the new file size */ - place_integer_le(dirent, 26, 2, file->first_cluster); - place_integer_le(dirent, 28, 4, new_size); - - /* delete the file, if appropriate */ - if (delete_file) - dirent[0] = 0xE5; - - /* save the dirent */ - err = fat_write_sector(partition, file->dirent_sector_index, file->dirent_sector_offset, dirent, sizeof(dirent)); - if (err) - goto done; - - /* if we've modified the FAT, save it out */ - if (fat_table) - { - err = fat_save_fat(partition, fat_table); - if (err) - goto done; - } - - /* update the file structure */ - if (!file->directory) - file->filesize = new_size; - file->cluster = file->first_cluster; - file->index = 0; - file->cluster_index = 0; - file->eof = (new_cluster_count == 0); - } - - /* special case; clear out stale bytes on non-root directories */ - if (file->directory && !delete_file) - { - if (file->root) - clear_size = MIN(file->filesize - new_size, FAT_DIRENT_SIZE); - else - clear_size = (disk_info->cluster_size - (new_size % disk_info->cluster_size)) % disk_info->cluster_size; - - if (clear_size > 0) - { - err = fat_seek_file(partition, file, new_size); - if (err) - goto done; - - clear_buffer = malloc(clear_size); - if (!clear_buffer) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - memset(clear_buffer, '\0', clear_size); - - err = fat_write_file(partition, file, clear_buffer, clear_size, NULL); - if (err) - goto done; - } - } - - /* seek back to original pos */ - err = fat_seek_file(partition, file, new_pos); - if (err) - goto done; - - if (fat_table) - fat_debug_integrity_check(partition, fat_table, file); - -done: - if (fat_table) - free(fat_table); - if (clear_buffer) - free(clear_buffer); - return err; -} - - - -static void prepend_lfn_bytes(utf16_char *lfn_buf, size_t lfn_buflen, size_t *lfn_len, - const UINT8 *entry, int offset, int chars) -{ - UINT16 w; - int i; - size_t move_len; - - move_len = MIN(*lfn_len + 1, lfn_buflen - chars - 1); - memmove(&lfn_buf[chars], &lfn_buf[0], move_len * sizeof(*lfn_buf)); - - for (i = 0; i < chars; i++) - { - /* read the character */ - memcpy(&w, &entry[offset + i * 2], 2); - w = LITTLE_ENDIANIZE_INT16(w); - - /* append to buffer */ - lfn_buf[i] = (w != 0xFFFF) ? w : 0; - } - *lfn_len += chars; -} - - - -static UINT8 fat_calc_filename_checksum(const UINT8 *short_filename) -{ - UINT8 checksum; - int i, j; - - checksum = 0; - for (i = 0; i < 11; i++) - { - j = checksum & 1; - checksum >>= 1; - if (j) - checksum |= 0x80; - checksum += short_filename[i]; - } - return checksum; -} - - - -static void fat_calc_dirent_lfnchecksum(UINT8 *entry, size_t entry_len) -{ - UINT8 checksum; - int i; - - checksum = fat_calc_filename_checksum(entry + entry_len - FAT_DIRENT_SIZE); - - for (i = 0; i < (entry_len / FAT_DIRENT_SIZE - 1); i++) - entry[i * FAT_DIRENT_SIZE + 13] = checksum; -} - - - -static char fat_cannonicalize_sfn_char(char ch) -{ - /* return the display version of this short file name character */ - return tolower(ch); -} - - - -static void fat_cannonicalize_sfn(char *sfn, const UINT8 *sfn_bytes) -{ - /* return the display version of this short file name */ - int i; - - memset(sfn, '\0', 13); - memcpy(sfn, sfn_bytes, 8); - rtrim(sfn); - if (sfn[0] == 0x05) - sfn[0] = (char) 0xE5; - if ((sfn_bytes[8] != ' ') || (sfn_bytes[9] != ' ') || (sfn_bytes[10] != ' ')) - { - strcat(sfn, "."); - memcpy(sfn + strlen(sfn), &sfn_bytes[8], 3); - rtrim(sfn); - } - for (i = 0; sfn[i]; i++) - sfn[i] = fat_cannonicalize_sfn_char(sfn[i]); -} - - - -static time_t fat_crack_time(UINT32 fat_time) -{ - struct tm t; - time_t now; - - time(&now); - t = *localtime(&now); - - t.tm_sec = ((fat_time >> 0) & 0x001F) * 2; - t.tm_min = ((fat_time >> 5) & 0x003F); - t.tm_hour = ((fat_time >> 11) & 0x001F); - t.tm_mday = ((fat_time >> 16) & 0x001F); - t.tm_mon = ((fat_time >> 21) & 0x000F); - t.tm_year = ((fat_time >> 25) & 0x007F) + 1980 - 1900; - - return mktime(&t); -} - - - -static UINT32 fat_setup_time(time_t ansi_time) -{ - struct tm t; - UINT32 result = 0; - - t = *localtime(&ansi_time); - - result |= (((UINT32) (t.tm_sec / 2)) & 0x001F) << 0; - result |= (((UINT32) t.tm_min) & 0x003F) << 5; - result |= (((UINT32) t.tm_hour) & 0x001F) << 11; - result |= (((UINT32) t.tm_mday) & 0x001F) << 16; - result |= (((UINT32) t.tm_mon) & 0x000F) << 21; - result |= (((UINT32) (t.tm_year + 1900 - 1980)) & 0x007F) << 25; - - return result; -} - - - -static imgtoolerr_t fat_read_dirent(imgtool_partition *partition, fat_file *file, - fat_dirent *ent, fat_freeentry_info *freeent) -{ - imgtoolerr_t err; - //const fat_partition_info *disk_info; - UINT8 entry[FAT_DIRENT_SIZE]; - size_t bytes_read; - int i, j; - unicode_char ch; - utf16_char lfn_buf[512]; - size_t lfn_len = 0; - int lfn_lastentry = 0; - UINT8 lfn_checksum = 0; - UINT32 entry_index, entry_sector_index, entry_sector_offset; - - assert(file->directory); - lfn_buf[0] = '\0'; - memset(ent, 0, sizeof(*ent)); - //disk_info = fat_get_partition_info(partition); - - /* The first eight bytes of a FAT directory entry is a blank padded name - * - * The first byte can be special: - * 0x00 - entry is available and no further entry is used - * 0x05 - first character is actually 0xe5 - * 0x2E - dot entry; either '.' or '..' - * 0xE5 - entry has been erased and is available - * - * Byte 11 is the attributes; and 0x0F denotes a LFN entry - */ - do - { - entry_index = file->index; - entry_sector_index = fat_get_filepos_sector_index(partition, file); - entry_sector_offset = file->index % FAT_SECLEN; - - err = fat_read_file(partition, file, entry, sizeof(entry), &bytes_read); - if (err) - return err; - if (bytes_read < sizeof(entry)) - memset(entry, 0, sizeof(entry)); - - if (entry[11] == 0x0F) - { - /* this is an LFN entry */ - if ((lfn_lastentry == 0) - || ((entry[0] & 0x3F) != (lfn_lastentry - 1)) - || (lfn_checksum != entry[13])) - { - lfn_buf[0] = 0; - lfn_len = 0; - lfn_checksum = entry[13]; - } - lfn_lastentry = entry[0] & 0x3F; - prepend_lfn_bytes(lfn_buf, ARRAY_LENGTH(lfn_buf), - &lfn_len, entry, 28, 2); - prepend_lfn_bytes(lfn_buf, ARRAY_LENGTH(lfn_buf), - &lfn_len, entry, 14, 6); - prepend_lfn_bytes(lfn_buf, ARRAY_LENGTH(lfn_buf), - &lfn_len, entry, 1, 5); - } - else if (freeent && (freeent->position == ~0)) - { - /* do a quick check to find out if we found space */ - if ((entry[0] == '\0') || (entry[0] == 0xE5)) - { - if (freeent->candidate_position > entry_index) - freeent->candidate_position = entry_index; - - if ((entry[0] == '\0') || (freeent->candidate_position + freeent->required_size < file->index)) - freeent->position = freeent->candidate_position; - } - else - { - freeent->candidate_position = ~0; - } - } - } - while((entry[0] == 0x2E) || (entry[0] == 0xE5) || (entry[11] == 0x0F)); - - /* no more directory entries? */ - if (entry[0] == '\0') - { - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - - /* pick apart short filename */ - fat_cannonicalize_sfn(ent->short_filename, entry); - - /* and the long filename */ - if (lfn_lastentry == 1) - { - /* only use the LFN if the checksum passes */ - if (lfn_checksum == fat_calc_filename_checksum(entry)) - { - i = 0; - j = 0; - do - { - i += uchar_from_utf16(&ch, &lfn_buf[i], ARRAY_LENGTH(lfn_buf) - i); - j += utf8_from_uchar(&ent->long_filename[j], ARRAY_LENGTH(ent->long_filename) - j, ch); - } - while(ch != 0); - } - } - - /* other attributes */ - ent->filesize = pick_integer_le(entry, 28, 4); - ent->directory = (entry[11] & 0x10) ? 1 : 0; - ent->first_cluster = pick_integer_le(entry, 26, 2); - ent->dirent_sector_index = entry_sector_index; - ent->dirent_sector_offset = entry_sector_offset; - ent->creation_time = fat_crack_time(pick_integer_le(entry, 14, 4)); - ent->lastmodified_time = fat_crack_time(pick_integer_le(entry, 22, 4)); - return IMGTOOLERR_SUCCESS; -} - - - -enum sfn_disposition_t -{ - SFN_SUFFICIENT, /* name fully representable in short file name */ - SFN_DERIVATIVE, /* name not fully representable in short file name, but no need to tildize */ - SFN_MANGLED /* name not representable in short file name; must tildize */ -}; - -static imgtoolerr_t fat_construct_dirent(const char *filename, creation_policy_t create, - UINT8 **entry, size_t *entry_len) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - UINT8 *created_entry = NULL; - UINT8 *new_created_entry; - UINT32 now; - size_t created_entry_len = FAT_DIRENT_SIZE; - size_t created_entry_pos = 0; - unicode_char ch; - char last_short_char = ' '; - char short_char = '\0'; - char cannonical_short_char; - utf16_char buf[UTF16_CHAR_MAX]; - int i, len; - int sfn_pos = 0; - sfn_disposition_t sfn_disposition = SFN_SUFFICIENT; - int sfn_in_extension = 0; - - /* sanity check */ - if (*filename == '\0') - { - err = IMGTOOLERR_BADFILENAME; - goto done; - } - - /* construct intial entry */ - created_entry = (UINT8 *) malloc(FAT_DIRENT_SIZE); - if (!created_entry) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - /* set up the basics for the new dirent */ - memset(created_entry + 0, ' ', 11); - memset(created_entry + 12, '\0', FAT_DIRENT_SIZE - 12); - created_entry[11] = (create == CREATE_DIR) ? 0x10 : 0x00; - - /* set up file dates in the new dirent */ - now = fat_setup_time(time(NULL)); - place_integer_le(created_entry, 14, 4, now); - place_integer_le(created_entry, 18, 2, now); - place_integer_le(created_entry, 22, 4, now); - - while(*filename) - { - filename += uchar_from_utf8(&ch, filename, UTF8_CHAR_MAX); - - /* append to short filename, if possible */ - if ((ch < 32) || (ch > 128)) - short_char = '\0'; - else if (isalnum((char) ch)) - short_char = toupper((char) ch); - else if (strchr(".!#$%^()-@^_`{}~", (char) ch)) - short_char = (char) ch; - else - short_char = '\0'; /* illegal SFN char */ - cannonical_short_char = fat_cannonicalize_sfn_char((char) ch); - if (!short_char || (short_char != cannonical_short_char)) - { - if (toupper(short_char) == toupper(cannonical_short_char)) - sfn_disposition = MAX(sfn_disposition, SFN_DERIVATIVE); - else - sfn_disposition = SFN_MANGLED; - } - - /* append the short filename char */ - if (short_char == '.') - { - /* multiple extensions or trailing spaces? */ - if (sfn_in_extension) - sfn_disposition = SFN_MANGLED; - else if (last_short_char == ' ') - sfn_disposition = MAX(sfn_disposition, SFN_DERIVATIVE); - - sfn_in_extension = 1; - sfn_pos = 8; - created_entry[created_entry_len - FAT_DIRENT_SIZE + 8] = ' '; - created_entry[created_entry_len - FAT_DIRENT_SIZE + 9] = ' '; - created_entry[created_entry_len - FAT_DIRENT_SIZE + 10] = ' '; - } - else if (sfn_pos == (sfn_in_extension ? 11 : 8)) - { - /* ran out of characters for short filename */ - sfn_disposition = SFN_MANGLED; - } - else if (short_char != '\0') - { - created_entry[created_entry_len - FAT_DIRENT_SIZE + sfn_pos++] = short_char; - } - last_short_char = short_char; - - - /* convert to UTF-16 and add a long filename entry */ - len = utf16le_from_uchar(buf, UTF16_CHAR_MAX, ch); - for (i = 0; i < len; i++) - { - switch(created_entry_pos) - { - case 0: - case 32: - /* need to grow */ - new_created_entry = (UINT8 *) malloc(created_entry_len + FAT_DIRENT_SIZE); - if (!new_created_entry) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - /* move existing entries forward */ - memmove(new_created_entry + 32, created_entry, created_entry_len); - - if (created_entry) free(created_entry); - created_entry = new_created_entry; - created_entry_len += 32; - - /* set up this LFN */ - memset(created_entry, '\0', 32); - memset(&created_entry[1], '\xFF', 10); - memset(&created_entry[14], '\xFF', 12); - memset(&created_entry[28], '\xFF', 4); - created_entry[11] = 0x0F; - - /* specify entry index */ - created_entry[0] = (created_entry_len / 32) - 1; - if (created_entry[0] >= 0x40) - { - err = IMGTOOLERR_BADFILENAME; - goto done; - } - created_entry_pos = 1; - break; - - case 11: - created_entry_pos = 14; - break; - - case 26: - created_entry_pos = 28; - break; - } - - memcpy(&created_entry[created_entry_pos], &buf[i], 2); - created_entry_pos += 2; - } - } - - /* trailing spaces? */ - if (short_char == ' ') - sfn_disposition = MAX(sfn_disposition, SFN_DERIVATIVE); - - if (sfn_disposition == SFN_SUFFICIENT) - { - /* the short filename suffices; remove the LFN stuff */ - memcpy(created_entry, created_entry + created_entry_len - FAT_DIRENT_SIZE, FAT_DIRENT_SIZE); - created_entry_len = FAT_DIRENT_SIZE; - free(created_entry); - new_created_entry = (UINT8 *) malloc(created_entry_len); - if (!new_created_entry) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - created_entry = new_created_entry; - } - else - { - /* need to do finishing touches on the LFN */ - created_entry[0] |= 0x40; - - /* if necessary, mangle the name */ - if (sfn_disposition == SFN_MANGLED) - { - i = 6; - while((i > 0) && isspace(created_entry[created_entry_len - FAT_DIRENT_SIZE + i - 1])) - i--; - created_entry[created_entry_len - FAT_DIRENT_SIZE + i + 0] = '~'; - created_entry[created_entry_len - FAT_DIRENT_SIZE + i + 1] = '1'; - } - fat_calc_dirent_lfnchecksum(created_entry, created_entry_len); - } - -done: - if (err && created_entry) - { - free(created_entry); - created_entry = NULL; - } - *entry = created_entry; - *entry_len = created_entry_len; - return err; -} - - - -static void fat_bump_dirent(imgtool_partition *partition, UINT8 *entry, size_t entry_len) -{ - UINT8 *sfn_entry; - int pos, digit_count, i; - UINT32 digit_place, val = 0; - - sfn_entry = &entry[entry_len - FAT_DIRENT_SIZE]; - - digit_place = 1; - for (pos = 7; (pos >= 0) && isdigit((char) sfn_entry[pos]); pos--) - { - val += (sfn_entry[pos] - '0') * digit_place; - digit_place *= 10; - } - val++; - pos++; - - /* count the digits */ - digit_place = 1; - digit_count = 1; - while(val >= digit_place * 10) - { - digit_count++; - digit_place *= 10; - } - - /* give us some more space, if necessary */ - while ((pos > 0) && ((pos + digit_count) > 8)) - pos--; - - /* have we actually ran out of digits */ - if ((pos + digit_count) > 8) - { - /* extreme degenerate case; simply randomize the filename */ - for (i = 0; i < 6; i++) - sfn_entry[i] = 'A' + (imgtool_partition_rand(partition) % 26); - sfn_entry[6] = '~'; - sfn_entry[7] = '0'; - } - else - { - /* write the tilde, if possible */ - if (pos > 0) - sfn_entry[pos - 1] = '~'; - - /* write out the number */ - while(digit_place > 0) - { - sfn_entry[pos++] = (val / digit_place) + '0'; - val %= digit_place; - digit_place /= 10; - } - } - - /* since we changed the short file name, we need to recalc the checksums - * in the LFN entries */ - fat_calc_dirent_lfnchecksum(entry, entry_len); -} - - - -static imgtoolerr_t fat_lookup_path(imgtool_partition *partition, const char *path, - creation_policy_t create, fat_file *file) -{ - imgtoolerr_t err; - const fat_partition_info *disk_info; - fat_dirent ent; - fat_freeentry_info freeent = { 0, }; - const char *next_path_part; - UINT8 *created_entry = NULL; - size_t created_entry_len = 0; - UINT32 entry_sector_index, entry_sector_offset; - UINT32 parent_first_cluster; - int bumped_sfn; - char sfn[13]; - - disk_info = fat_get_partition_info(partition); - - memset(file, 0, sizeof(*file)); - file->root = 1; - file->directory = 1; - file->filesize = disk_info->root_entries * FAT_DIRENT_SIZE; - - while(*path) - { - if (!file->directory) - { - err = IMGTOOLERR_PATHNOTFOUND; - goto done; - } - - next_path_part = path + strlen(path) + 1; - if (create && (*next_path_part == '\0')) - { - /* this is the last entry, and we are creating a file */ - err = fat_construct_dirent(path, create, &created_entry, &created_entry_len); - if (err) - goto done; - - freeent.required_size = created_entry_len; - freeent.candidate_position = ~0; - freeent.position = ~0; - } - - do - { - err = fat_read_dirent(partition, file, &ent, created_entry ? &freeent : NULL); - if (err) - goto done; - - LOG(("fat_lookup_path(): %s/%s: %d\n", ent.short_filename, ent.long_filename, ent.dirent_sector_offset)); - } - while(!ent.eof && core_stricmp(path, ent.short_filename) && core_stricmp(path, ent.long_filename)); - - parent_first_cluster = file->first_cluster; - - if (ent.eof) - { - /* it seems that we have reached the end of this directory */ - if (!created_entry) - { - err = IMGTOOLERR_FILENOTFOUND; - goto done; - } - - if (created_entry_len > FAT_DIRENT_SIZE) - { - /* must ensure uniqueness of the short filename */ - do - { - /* rewind to the beginning of the directory */ - err = fat_seek_file(partition, file, 0); - if (err) - goto done; - - bumped_sfn = FALSE; - fat_cannonicalize_sfn(sfn, &created_entry[created_entry_len - FAT_DIRENT_SIZE]); - - do - { - err = fat_read_dirent(partition, file, &ent, NULL); - if (err) - goto done; - - if (!core_stricmp(sfn, ent.short_filename)) - { - bumped_sfn = TRUE; - fat_bump_dirent(partition, created_entry, created_entry_len); - fat_cannonicalize_sfn(sfn, &created_entry[created_entry_len - FAT_DIRENT_SIZE]); - } - } - while(!ent.eof); - } - while(bumped_sfn); - } - - LOG(("fat_lookup_path(): creating entry; pos=%u length=%u\n", freeent.position, freeent.required_size)); - - err = fat_set_file_size(partition, file, MAX(file->filesize, freeent.position + created_entry_len)); - if (err) - goto done; - - err = fat_seek_file(partition, file, freeent.position); - if (err) - goto done; - - err = fat_write_file(partition, file, created_entry, created_entry_len, NULL); - if (err) - goto done; - - /* we have to do a special seek operation to get the main dirent */ - err = fat_seek_file(partition, file, freeent.position + created_entry_len - FAT_DIRENT_SIZE); - if (err) - goto done; - entry_sector_index = fat_get_filepos_sector_index(partition, file); - entry_sector_offset = file->index % FAT_SECLEN; - - /* build the file struct for the newly created file/directory */ - memset(file, 0, sizeof(*file)); - file->directory = (created_entry[created_entry_len - FAT_DIRENT_SIZE + 11] & 0x10) ? 1 : 0; - file->dirent_sector_index = entry_sector_index; - file->dirent_sector_offset = entry_sector_offset; - } - else - { - /* update the current file */ - memset(file, 0, sizeof(*file)); - file->directory = ent.directory; - file->filesize = ent.filesize; - file->cluster = ent.first_cluster; - file->first_cluster = ent.first_cluster; - file->dirent_sector_index = ent.dirent_sector_index; - file->dirent_sector_offset = ent.dirent_sector_offset; - } - - path = next_path_part; - file->parent_first_cluster = parent_first_cluster; - } - - err = IMGTOOLERR_SUCCESS; - -done: - if (created_entry) - free(created_entry); - return err; -} - - - -static imgtoolerr_t fat_partition_beginenum(imgtool_directory *enumeration, const char *path) -{ - imgtoolerr_t err; - fat_file *file; - - file = (fat_file *) imgtool_directory_extrabytes(enumeration); - - err = fat_lookup_path(imgtool_directory_partition(enumeration), path, CREATE_NONE, file); - if (err) - return err; - if (!file->directory) - return IMGTOOLERR_PATHNOTFOUND; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_partition_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - imgtoolerr_t err; - fat_file *file; - fat_dirent fatent; - - file = (fat_file *) imgtool_directory_extrabytes(enumeration); - err = fat_read_dirent(imgtool_directory_partition(enumeration), file, &fatent, NULL); - if (err) - return err; - - /* copy stuff from the FAT dirent to the Imgtool dirent */ - snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fatent.long_filename[0] - ? fatent.long_filename : fatent.short_filename); - ent->filesize = fatent.filesize; - ent->directory = fatent.directory; - ent->eof = fatent.eof; - ent->creation_time = fatent.creation_time; - ent->lastmodified_time = fatent.lastmodified_time; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_read_bootblock(imgtool_partition *partition, imgtool_stream *stream) -{ - imgtoolerr_t err; - UINT8 block[FAT_SECLEN]; - - err = fat_read_sector(partition, 0, 0, block, sizeof(block)); - if (err) - return err; - - stream_write(stream, block, sizeof(block)); - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_write_bootblock(imgtool_partition *partition, imgtool_stream *stream) -{ - imgtoolerr_t err; - UINT8 block[FAT_SECLEN]; - UINT8 new_block[FAT_SECLEN]; - - if (stream_size(stream) != sizeof(new_block)) - return IMGTOOLERR_UNEXPECTED; - stream_read(stream, new_block, sizeof(new_block)); - - if (new_block[510] != 0x55) - return IMGTOOLERR_UNEXPECTED; - if (new_block[511] != 0xAA) - return IMGTOOLERR_UNEXPECTED; - - /* read current boot sector */ - err = fat_read_sector(partition, 0, 0, block, sizeof(block)); - if (err) - return err; - - /* merge in the new stuff */ - memcpy(&block[ 0], &new_block[ 0], 3); - memcpy(&block[62], &new_block[62], 448); - - /* and write it out */ - err = fat_write_sector(partition, 0, 0, block, sizeof(block)); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_partition_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t err; - fat_file file; - size_t bytes_read; - char buffer[1024]; - - /* special case for bootblock */ - if (filename == FILENAME_BOOTBLOCK) - return fat_read_bootblock(partition, destf); - - err = fat_lookup_path(partition, filename, CREATE_NONE, &file); - if (err) - return err; - - if (file.directory) - return IMGTOOLERR_FILENOTFOUND; - - do - { - err = fat_read_file(partition, &file, buffer, sizeof(buffer), &bytes_read); - if (err) - return err; - - stream_write(destf, buffer, bytes_read); - } - while(bytes_read > 0); - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_partition_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtoolerr_t err; - fat_file file; - UINT32 bytes_left, len; - char buffer[1024]; - - /* special case for bootblock */ - if (filename == FILENAME_BOOTBLOCK) - return fat_write_bootblock(partition, sourcef); - - err = fat_lookup_path(partition, filename, CREATE_FILE, &file); - if (err) - return err; - - if (file.directory) - return IMGTOOLERR_FILENOTFOUND; - - bytes_left = (UINT32) stream_size(sourcef); - - err = fat_set_file_size(partition, &file, bytes_left); - if (err) - return err; - - while(bytes_left > 0) - { - len = MIN(bytes_left, sizeof(buffer)); - stream_read(sourcef, buffer, len); - - err = fat_write_file(partition, &file, buffer, len, NULL); - if (err) - return err; - - bytes_left -= len; - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_partition_delete(imgtool_partition *partition, const char *filename, unsigned int dir) -{ - imgtoolerr_t err; - fat_file file; - fat_dirent ent; - - err = fat_lookup_path(partition, filename, CREATE_NONE, &file); - if (err) - return err; - if (file.directory != dir) - return IMGTOOLERR_FILENOTFOUND; - - if (dir) - { - err = fat_read_dirent(partition, &file, &ent, NULL); - if (err) - return err; - if (!ent.eof) - return IMGTOOLERR_DIRNOTEMPTY; - } - - err = fat_set_file_size(partition, &file, ~0); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_partition_deletefile(imgtool_partition *partition, const char *filename) -{ - return fat_partition_delete(partition, filename, 0); -} - - - -static imgtoolerr_t fat_partition_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtoolerr_t err; - const fat_partition_info *disk_info; - UINT8 *fat_table; - UINT32 i; - - disk_info = fat_get_partition_info(partition); - - err = fat_load_fat(partition, &fat_table); - if (err) - goto done; - - *size = 0; - for (i = 2; i < disk_info->total_clusters; i++) - { - if (fat_get_fat_entry(partition, fat_table, i) == 0) - *size += disk_info->cluster_size; - } - -done: - if (fat_table) - free(fat_table); - return err; -} - - - -static imgtoolerr_t fat_partition_createdir(imgtool_partition *partition, const char *path) -{ - imgtoolerr_t err; - fat_file file; - UINT8 initial_data[64]; - - err = fat_lookup_path(partition, path, CREATE_DIR, &file); - if (err) - return err; - if (!file.directory) - return IMGTOOLERR_FILENOTFOUND; - - err = fat_set_file_size(partition, &file, sizeof(initial_data)); - if (err) - return err; - - /* set up the two directory entries in all directories */ - memset(initial_data, 0, sizeof(initial_data)); - memcpy(&initial_data[0], ". ", 11); - place_integer_le(initial_data, 11, 1, 0x10); - place_integer_le(initial_data, 26, 2, file.first_cluster); - memcpy(&initial_data[32], ". ", 11); - place_integer_le(initial_data, 43, 1, 0x10); - place_integer_le(initial_data, 58, 2, file.parent_first_cluster); - - err = fat_write_file(partition, &file, initial_data, sizeof(initial_data), NULL); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_partition_deletedir(imgtool_partition *partition, const char *path) -{ - return fat_partition_delete(partition, path, 1); -} - - - -void fat_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break; - case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break; - case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: info->i = 1; break; - case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break; - case IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK: info->i = 1; break; - case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '\\'; break; - case IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR: info->i = '/'; break; - case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES: info->i = sizeof(fat_partition_info); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(fat_file); break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r\n"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_CREATE_PARTITION: info->create_partition = fat_partition_create; break; - case IMGTOOLINFO_PTR_OPEN_PARTITION: info->open_partition = fat_partition_open; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = fat_partition_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = fat_partition_nextenum; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = fat_partition_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = fat_partition_writefile; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = fat_partition_deletefile; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = fat_partition_freespace; break; - case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = fat_partition_createdir; break; - case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = fat_partition_deletedir; break; - } -} diff --git a/src/mess/tools/imgtool/modules/fat.h b/src/mess/tools/imgtool/modules/fat.h deleted file mode 100644 index 46f741999c3..00000000000 --- a/src/mess/tools/imgtool/modules/fat.h +++ /dev/null @@ -1,3 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -void fat_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); diff --git a/src/mess/tools/imgtool/modules/hp48.c b/src/mess/tools/imgtool/modules/hp48.c deleted file mode 100644 index e54908c9c1e..00000000000 --- a/src/mess/tools/imgtool/modules/hp48.c +++ /dev/null @@ -1,739 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/**************************************************************************** - - hp48.c - - Memory cards for HP48 SX/GX - - Antoine Mine' 2014 - -***************************************************************************** -*/ - -/* - HP memory cards can contain two kinds of objects: - - attached libraries - - backup objects (encapsulating any kind of object) - - Attached libraries appear with a LIB attribute in imgtool's listing, and in - the global "LIBRARY" menu on the HP48. - Backup objects appear with a BAK attribute in imgtool's listing, and - in the relevant "PORTS" menu on the HP48. - - Currently, we only support storing host files into backup objects and - retreiving backup objects into files. - For attached library objects in the memory card, we only show their name, but - cannot retrieve their contents. - - To install a library contained in a host file, copy it with imgtool to - the card; it creates a backup object visible in the "PORTS" menu; - then evalue the object, store it into some port (e.g, 0 STO), - turn off the HP48 and back on; the library should now be attached and - visible in the "LIBRARY" menu. - (The process is similar to installing a library from a file you get - from the serial interface.) -*/ - - -/* - HP memory cards have size from 32 KB to 4096 KB. - However, cards with size greater than 128 KB are seen as multiple ports of - size 128 KB on the HP48 GX. In imgtool, we see them as distinct 128 KB - partitions. - Unfortunately, at the moment, partitions do not seem to be supported in the - command-line tool... - */ - - -/* - Here is the format of backup objects (addresses are in 4-bit nibbles): - - offset field size value - 0 prolog 5 02B62 prolog for overall backup object - 5 size 5 len total size in nibble without prolog - 10 name length 2 nbcar object name, in characters - 12 name 2*nbcar - - 12+2*nbcar name length 2 nbcar same value as name length at 10 - 14+2*nbcar object - - - len-5 prolog 5 02911 prolog for inlined system integer - len - 1 0 - len+1 CRC 4 - CRC from 5 to len - - total length: len+4 - - i.e., the backup object is a container containing the object name - and two objects: the backuped object itself and a system integer - that contains the CRC. - - HP48 host files start with a "HPHP48-X" header (where X can be any - single letter, which denotes a ROM revision and, implicitly, whether - the program is for the S/SX or the G/GX family). - When storing a file to the memory card, we strip the header and - embed the object into a backup object with the correct CRC. - When copying from the memory card to a host file, we extract the object - from the backup container, stripping its CRC, and add the HPHP48-X header. - - */ - - - - - -/***************************************************************************** - Includes -*****************************************************************************/ - -#include "imgtool.h" - - - -/***************************************************************************** - Data structures -*****************************************************************************/ - - -struct hp48_card -{ - imgtool_stream *stream; - int modified; - - /* size, in bytes of card data: from 32 KB to 4 MB */ - int size; - - /* we store each nibble (4-bit) into its own byte, for simpler addressing; - hence, data has 2*size - */ - UINT8* data; - -}; - -struct hp48_partition -{ - /* pointer to the beginning of the partition inside the hp48_card */ - UINT8* data; - - /* size, in bytes (128 KB or less) */ - int size; - -}; - -struct hp48_directory -{ - int pos; -}; - - -#define PROLOG_BACKUP 0x02B62 -#define PROLOG_LIBRARY 0x02B40 -#define PROLOG_SYSINT 0x02911 - -/* memory cards are composed solely of libraries and backup objects */ -#define IS_OBJECT(prolog) ((prolog) == PROLOG_LIBRARY || (prolog) == PROLOG_BACKUP) - -/* host files begin with this prefix (up to the last letter) */ -static const char* hp48_prefix = "HPHP48-R"; - - - -static OPTION_GUIDE_START( hp48_create_optionguide ) - OPTION_INT('S', "size", "Size in KB" ) -OPTION_GUIDE_END - -/* size in KB, 128 KB being the default */ -static const char hp48_create_optionspec[] = "S32/64/[128]/256/512/1024/2048/4096"; - - - -/***************************************************************************** - Utility functions -*****************************************************************************/ - - -/* byes to nibbles */ -static void unpack(UINT8* dst, UINT8* src, int nsize) -{ - int i; - - if ( nsize & 1 ) - { - dst[nsize-1] = src[nsize/2] & 0xf; - } - - for ( i = nsize/2-1; i >= 0; i-- ) - { - dst[2*i+1] = src[i] >> 4; - dst[2*i ] = src[i] & 0xf; - } -} - -/* nibbles to bytes */ -static void pack(UINT8* dst, UINT8* src, int nsize) -{ - int i; - - for ( i = 0 ; i < nsize/2; i++ ) - { - dst[i] = (src[2*i] & 0xf) | (src[2*i+1] << 4); - } - - if ( nsize & 1 ) - { - dst[nsize/2] = src[nsize-1] & 0xf; - } - } - - -static int read20(UINT8* data) -{ - return data[0] | (data[1] << 4) | (data[2] << 8) | (data[3] << 12) | (data[4] << 16); -} - -static int read8(UINT8* data) -{ - return data[0] | (data[1] << 4); -} - -static void readstring(char* dst, UINT8* data, int nb) -{ - int i; - for ( i = 0; i < nb; i++ ) - { - dst[i] = read8( data + 2*i ); - } - dst[nb] = 0; -} - -static void write20(UINT8* data, int v) -{ - data[0] = v & 0xf; - data[1] = (v >> 4) & 0xf; - data[2] = (v >> 8) & 0xf; - data[3] = (v >> 12) & 0xf; - data[4] = (v >> 16) & 0xf; -} - -static void write8(UINT8* data, int v) -{ - data[0] = v & 0xf; - data[1] = (v >> 4) & 0xf; -} - -static void writestring(UINT8* data, const char* str, int nb) -{ - int i; - for ( i = 0; i < nb; i++ ) - { - write8( data + 2*i, str[i] ); - } -} - - -/* go to the end, return its offset */ -static int find_end(hp48_partition* p) -{ - int pos = 0; - while (1) - { - if ( pos + 10 > 2*p->size) break; - - int prolog = read20( p->data + pos ); - if ( !IS_OBJECT( prolog )) break; - - pos += read20( p->data + pos + 5 ) + 5; - } - - if ( pos > 2*p->size ) pos = 2*p->size; - return pos; -} - - -/* find the backup object with the given name, returns its offset or -1 (not found) */ -static int find_file(hp48_partition* p, const char* filename, int *ptotalsize, int* pstart, int* pcontentsize) -{ - UINT8* data = p->data; - int pos = 0; - - /* find file */ - while (1) - { - if ( pos + 10 > 2*p->size) return -1; - - /* get prolog */ - int prolog = read20( data+pos ); - if ( !IS_OBJECT(prolog)) return -1; - - /* get size */ - int totalsize = read20( data+pos+5 ); - if ( totalsize < 14) return -1; - if ( pos + 5 + totalsize > 2*p->size ) return -1; - - if ( prolog == PROLOG_BACKUP ) - { - /* get name */ - int namelen = read8( data + pos + 10 ); - char name[257]; - if ( 9 + 2*namelen > totalsize ) return -1; - readstring( name, data + pos + 12, namelen ); - - /* check name */ - if ( !strcmp( name, filename ) ) - { - /* found! */ - if ( ptotalsize ) *ptotalsize = totalsize; - if ( pstart ) *pstart = pos + 14 + 2*namelen; - if ( pcontentsize ) *pcontentsize = totalsize - (9 + 2*namelen); - return pos; - } - else - { - /* skip */ - pos += totalsize + 5; - } - } - else - { - /* skip */ - pos += totalsize + 5; - } - - } - - // never executed - //return -1; -} - - -/* CRC computing. - This is the same CRC that is computed by the HP48 hardware. - */ -static UINT16 crc(UINT8* data, int len) -{ - UINT16 crc = 0; - int i; - - for ( i = 0; i < len; i++ ) - { - crc = (crc >> 4) ^ (((crc ^ data[i]) & 0xf) * 0x1081); - } - - return crc; -} - - - -/***************************************************************************** - Imgtool functions -*****************************************************************************/ - - -static imgtoolerr_t hp48_open(imgtool_image *img, imgtool_stream *stream) -{ - hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - int size = stream_size( stream ); - - /* check that size is a power of 2 between 32 KB and 4 MG */ - if ( (size < 32 * 1024) || - (size > 4 * 1024 * 1024) || - (size & (size-1)) ) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - - /* store info */ - c->stream = stream; - c->modified = 0; - c->size = size; - c->data = (UINT8*) malloc( 2 * size ); - if ( !c->data ) - { - return IMGTOOLERR_READERROR; - } - - /* fully load image */ - stream_seek( stream, 0, SEEK_SET ); - if ( stream_read( stream, c->data, size ) < size ) - { - return IMGTOOLERR_READERROR; - } - unpack( c->data, c->data, 2 * size ); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t hp48_create(imgtool_image* img, - imgtool_stream *stream, - option_resolution *opts) -{ - hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - int size; - - size = option_resolution_lookup_int(opts, 'S'); - - c->stream = stream; - c->modified = 1; - c->size = size * 1024; - c->data = (UINT8*) malloc( 2 * c->size ); - if ( !c->data ) - { - return IMGTOOLERR_READERROR; - } - - /* zeroing the image seems fine */ - memset( c->data, 0, 2 * c->size ); - - return IMGTOOLERR_SUCCESS; -} - - - -static void hp48_close(imgtool_image *img) -{ - hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - - if ( c->modified ) - { - /* save image */ - pack( c->data, c->data, 2 * c->size ); - stream_seek( c->stream, 0, SEEK_SET ); - stream_write( c->stream, c->data, c->size ); - } - - /* clean up */ - free( c->data ); - stream_close( c->stream ); -} - - - -/* each 128 KB chunk is a distinct partition */ -#define MAX_PORT_SIZE (128*1024) - -void hp48_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); - -static imgtoolerr_t hp48_list_partitions(imgtool_image *img, - imgtool_partition_info *partitions, - size_t len) -{ - hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - - int i; - for ( i = 0; i < len && i * MAX_PORT_SIZE < c->size ; i++ ) - { - /* offset and size in bytes */ - partitions[i].base_block = i * MAX_PORT_SIZE; - partitions[i].block_count = c->size - partitions[i].base_block; - if ( partitions[i].block_count > MAX_PORT_SIZE ) - { - partitions[i].block_count = MAX_PORT_SIZE; - } - - partitions[i].get_info = hp48_partition_get_info; - } - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t hp48_open_partition(imgtool_partition *part, - UINT64 first_block, UINT64 block_count) -{ - imgtool_image* img = imgtool_partition_image( part ); - hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); - - if ( first_block + block_count > c->size ) - return IMGTOOLERR_INVALIDPARTITION; - - /* store partition position */ - p->data = c->data + first_block; - p->size = block_count; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t hp48_beginenum(imgtool_directory *enumeration, - const char *path) -{ - hp48_directory* d = (hp48_directory*) imgtool_directory_extrabytes( enumeration ); - - d->pos = 0; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t hp48_nextenum(imgtool_directory *enumeration, - imgtool_dirent *ent) -{ - imgtool_partition *part = imgtool_directory_partition( enumeration ); - //imgtool_image* img = imgtool_partition_image( part ); - //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); - hp48_directory* d = (hp48_directory*) imgtool_directory_extrabytes( enumeration ); - - UINT8* data = p->data; - int pos = d->pos; - - if ( pos < 0 || pos+12 > 2*p->size ) - { - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - - int prolog = read20( data+pos ); - - if ( IS_OBJECT(prolog) ) - { - pos += 5; - int totalsize = read20( data+pos ); - pos += 5; - - int namelen = read8( data+pos ); - pos += 2; - if ( (pos + 2*namelen > 2*p->size) || - (namelen >= sizeof(ent->filename)) ) - { - ent->eof = 1; - return IMGTOOLERR_CORRUPTFILE; - } - readstring( ent->filename, data+pos, namelen ); - - /* compute size in bytes, removing name, length & CRC fields */ - ent->filesize = ((totalsize - 19 - 2*namelen) + 1) / 2; - - switch (prolog) - { - case PROLOG_LIBRARY: strncpy( ent->attr, "LIB", sizeof(ent->attr) ); break; - case PROLOG_BACKUP: strncpy( ent->attr, "BAK", sizeof(ent->attr) ); break; - default: strncpy( ent->attr, "?", sizeof(ent->attr) ); - } - - d->pos = d->pos + totalsize + 5; - } - else - { - /* 0 or unknown object => end */ - ent->eof = 1; - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t hp48_freespace(imgtool_partition *part, UINT64 *size) -{ - //imgtool_image* img = imgtool_partition_image( part ); - //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); - - *size = p->size - (find_end(p)+1)/2; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t hp48_readfile(imgtool_partition *part, - const char *filename, - const char *fork, - imgtool_stream *destf) -{ - //imgtool_image* img = imgtool_partition_image( part ); - //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); - - /* find entry */ - int totalsize, start, size; - int pos = find_file(p, filename, &totalsize, &start, &size); - if ( pos == -1 ) - { - return IMGTOOLERR_FILENOTFOUND; - } - - /* CRC check */ - UINT16 objcrc = read20( p->data + pos + totalsize ) >> 4; - UINT16 mycrc = crc( p->data + pos + 5, totalsize - 4); - if ( objcrc != mycrc ) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - size -= 10; - - /* save header */ - stream_write( destf, hp48_prefix, 8); - - /* save contents to host file */ - int bytesize = (size + 1) / 2; - UINT8* buf = (UINT8*) malloc( bytesize ); - if (!buf) - { - return IMGTOOLERR_FILENOTFOUND; - } - pack( buf, p->data + start, size ); - stream_write( destf, buf, bytesize ); - free( buf ); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t hp48_deletefile(imgtool_partition *part, - const char *filename) -{ - imgtool_image* img = imgtool_partition_image( part ); - hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); - - /* find entry */ - int totalsize; - int pos = find_file(p, filename, &totalsize, NULL, NULL ); - if ( pos == -1 ) - { - return IMGTOOLERR_FILENOTFOUND; - } - - /* move */ - totalsize += 5; - memmove( p->data+pos, p->data+pos+totalsize, 2*p->size-(pos+totalsize) ); - memset( p->data + 2*p->size-totalsize, 0, totalsize); - c->modified = 1; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t hp48_writefile(imgtool_partition *part, - const char *filename, - const char *fork, - imgtool_stream *sourcef, - option_resolution *opts) -{ - imgtool_image* img = imgtool_partition_image( part ); - hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img ); - hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part ); - - /* check header */ - char head[8]; - stream_read( sourcef, head, 8 ); - if ( memcmp( head, hp48_prefix, 7) ) - { - return IMGTOOLERR_READERROR; - } - - /* ensure that the file does not exist */ - /* TODO: resize the existing file instead, to keep it in place? */ - hp48_deletefile( part, filename ); - - /* goto end */ - //UINT8* data = p->data; - int pos = find_end(p); - - int len = strlen( filename ); - if ( len > 255 ) len = 255; - - /* check size */ - int filesize = stream_size( sourcef ) - 8; - if ( pos + 2*filesize + 24 + 2*len > 2 * p->size ) - { - return IMGTOOLERR_NOSPACE; - } - - /* load file */ - UINT8* buf = (UINT8*) malloc( filesize ); - if ( !buf ) return IMGTOOLERR_NOSPACE; - stream_read( sourcef, buf, filesize ); - - /* store backup object */ - int org = pos; - int totalsize = 2*filesize + 19 + 2*len; - write20( p->data+pos, PROLOG_BACKUP ); - pos +=5; - write20( p->data+pos, totalsize ); - pos +=5; - write8( p->data+pos, len ); - pos += 2; - writestring( p->data+pos, filename, len ); - pos += 2*len; - write8( p->data+pos, len ); - pos += 2; - unpack( p->data+pos, buf, 2*filesize ); - pos += 2*filesize; - - /* store crc */ - write20( p->data+pos, PROLOG_SYSINT ); - pos += 5; - p->data[pos] = 0; - write20( p->data+pos, crc(p->data+org+5, totalsize-4) << 4 ); - - free(buf); - - c->modified = 1; - - return IMGTOOLERR_SUCCESS; -} - - - - -/***************************************************************************** - Imgtool module declaration -*****************************************************************************/ - - - -void hp48_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "hp48"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "HP48 SX/GX memory card"); break; - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "crd"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_OPEN_PARTITION: info->open_partition = hp48_open_partition; break; - case IMGTOOLINFO_PTR_CLOSE: info->close = hp48_close; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = hp48_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = hp48_nextenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = hp48_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = hp48_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = hp48_writefile; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = hp48_deletefile; break; - - case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES: info->i = sizeof(hp48_partition); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(hp48_directory); break; - - } -} - -void hp48_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "hp48"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "HP48 SX/GX memory card"); break; - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "crd"); break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), hp48_create_optionspec); break; - - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = hp48_create_optionguide; break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_OPEN: info->open = hp48_open; break; - case IMGTOOLINFO_PTR_CREATE: info->create = hp48_create; break; - case IMGTOOLINFO_PTR_CLOSE: info->close = hp48_close; break; - case IMGTOOLINFO_PTR_LIST_PARTITIONS: info->list_partitions = hp48_list_partitions; break; - - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(hp48_card); break; - } -} diff --git a/src/mess/tools/imgtool/modules/mac.c b/src/mess/tools/imgtool/modules/mac.c deleted file mode 100644 index 53ae4be3ec0..00000000000 --- a/src/mess/tools/imgtool/modules/mac.c +++ /dev/null @@ -1,6418 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/**************************************************************************** - - mac.c - - Handlers for Classic MacOS images (MFS and HFS formats). - - Raphael Nabet, 2003 - - TODO: - * add support for HFS write - -***************************************************************************** - - terminology: - disk block: 512-byte logical block. With sectors of 512 bytes, one logical - block is equivalent to one sector; when the sector size is not 512 - bytes, sectors are split or grouped to make 512-byte disk blocks. - allocation block: The File Manager always allocates logical disk blocks to - a file in groups called allocation blocks; an allocation block is - simply a group of consecutive logical blocks. The size of a volume's - allocation blocks depends on the capacity of the volume; there can be - at most 4094 (MFS) or 65535 (HFS) allocation blocks on a volume. - MFS (Macintosh File System): File system used by the early Macintosh. This - File system does not support folders (you may create folders on a MFS - disk, but such folders are not implemented on File System level but in - the Desktop file, and they are just a hint of how programs should list - files, i.e. you can't have two files with the same name on a volume - even if they are in two different folders), and it is not adequate for - large volumes. - HFS (Hierarchical File System): File system introduced with the HD20 - harddisk, the Macintosh Plus ROMs, and system 3.2 (IIRC). Contrary to - MFS, it supports hierarchical folders. Also, it is suitable for larger - volumes. - HFS+ (HFS Plus): New file system introduced with MacOS 8.1. It has a lot - in common with HFS, but it supports more allocation blocks (up to 4 - billions IIRC), and many extra features, including longer file names - (up to 255 UTF-16 Unicode chars). - tag data: with the GCR encoding, each disk block is associated with a 12 - (3.5" floppies) or 20 (HD20) byte tag record. This tag record contains - information on the block allocation status (whether it is allocated - in a file or free, which file is it belongs to, what offset the block - has in the file). This enables to recover all files whose data blocks - are still on the disk surface even if the disk catalog has been trashed - completely (though most file properties, like the name, type and - logical EOF, are not saved in the tag record and cannot be recovered). - - Organization of an MFS volume: - - Logical Contents Allocation block - block - - 0 - 1: System startup information - 2 - m: Master directory block (MDB) - + allocation block link pointers - m+1 - n: Directory file - n+1 - p-2: Other files and free space 0 - ((p-2)-(n+1))/k - p-1: Alternate MDB - p: Not used - usually, k = 2, m = 3, n = 16, p = 799 (SSDD 3.5" floppy) - with DSDD 3.5" floppy, I assume that p = 1599, but I don't know the other - values - - - Master Directory Block: - - Offset Length Description - ------ ------ ----------- - 0 2 Volume Signature - 2 4 Creation Date - 6 4 Last Modification Date - 10 2 Volume Attributes - 12 2 Number of Files In Root Directory - 14 2 First Block of Volume Bitmap - ... - - Links: - http://developer.apple.com/documentation/mac/Files/Files-99.html - http://developer.apple.com/documentation/mac/Files/Files-100.html - http://developer.apple.com/documentation/mac/Files/Files-101.html - http://developer.apple.com/documentation/mac/Files/Files-102.html - http://developer.apple.com/documentation/mac/Files/Files-103.html - http://developer.apple.com/documentation/mac/Files/Files-104.html - http://developer.apple.com/documentation/mac/Files/Files-105.html - http://developer.apple.com/documentation/mac/Files/Files-106.html - http://developer.apple.com/documentation/mac/Devices/Devices-121.html#MARKER-2-169 - http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html - -*****************************************************************************/ - -#include -#include -#include -#include -#include - -#include "formats/imageutl.h" -#include "imgtool.h" -#include "macutil.h" -#include "iflopimg.h" -#include "formats/ap_dsk35.h" - -/* if 1, check consistency of B-Tree (most of the checks will eventually be - suppressed when the image is opened as read-only and only enabled when - the image is opened as read/write) */ -#define BTREE_CHECKS 1 -/* if 1, check consistency of tag data when we are at risk of corrupting the - disk (file write and allocation) */ -#define TAG_CHECKS 1 -/* if 1, check consistency of tag data when reading files (not recommended - IMHO) */ -#define TAG_EXTRA_CHECKS 0 - -#if 0 -#pragma mark MISCELLANEOUS UTILITIES -#endif - -struct UINT16BE -{ - UINT8 bytes[2]; -}; - -struct UINT24BE -{ - UINT8 bytes[3]; -}; - -struct UINT32BE -{ - UINT8 bytes[4]; -}; - -INLINE UINT16 get_UINT16BE(UINT16BE word) -{ - return (word.bytes[0] << 8) | word.bytes[1]; -} - -INLINE void set_UINT16BE(UINT16BE *word, UINT16 data) -{ - word->bytes[0] = (data >> 8) & 0xff; - word->bytes[1] = data & 0xff; -} - -#if 0 -INLINE UINT32 get_UINT24BE(UINT24BE word) -{ - return (word.bytes[0] << 16) | (word.bytes[1] << 8) | word.bytes[2]; -} - -INLINE void set_UINT24BE(UINT24BE *word, UINT32 data) -{ - word->bytes[0] = (data >> 16) & 0xff; - word->bytes[1] = (data >> 8) & 0xff; - word->bytes[2] = data & 0xff; -} -#endif - -INLINE UINT32 get_UINT32BE(UINT32BE word) -{ - return (word.bytes[0] << 24) | (word.bytes[1] << 16) | (word.bytes[2] << 8) | word.bytes[3]; -} - -INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) -{ - word->bytes[0] = (data >> 24) & 0xff; - word->bytes[1] = (data >> 16) & 0xff; - word->bytes[2] = (data >> 8) & 0xff; - word->bytes[3] = data & 0xff; -} - -/* - Macintosh string: first byte is length -*/ -typedef UINT8 mac_str27[28]; -typedef UINT8 mac_str31[32]; -typedef UINT8 mac_str63[64]; -typedef UINT8 mac_str255[256]; - -/* - Macintosh type/creator code: 4 char value -*/ -typedef UINT32BE mac_type; - -/* - point record, with the y and x coordinates -*/ -struct mac_point -{ - UINT16BE v; /* actually signed */ - UINT16BE h; /* actually signed */ -}; - -/* - rect record, with the corner coordinates -*/ -struct mac_rect -{ - UINT16BE top; /* actually signed */ - UINT16BE left; /* actually signed */ - UINT16BE bottom;/* actually signed */ - UINT16BE right; /* actually signed */ -}; - -/* - FInfo (Finder file info) record -*/ -struct mac_FInfo -{ - mac_type type; /* file type */ - mac_type creator; /* file creator */ - UINT16BE flags; /* Finder flags */ - mac_point location; /* file's location in window */ - /* If set to {0, 0}, and the inited flag is - clear, the Finder will place the item - automatically */ - UINT16BE fldr; /* MFS: window that contains file */ - /* -3: trash */ - /* -2: desktop */ - /* -1: new folder template?????? */ - /* 0: disk window ("root") */ - /* > 0: specific folder, index of FOBJ resource??? */ - /* The FOBJ resource contains some folder info; - the name of the resource is the folder name. */ - /* HFS & HFS+: - System 7: The window in which the file???s icon appears - System 8: reserved (set to 0) */ -}; - -/* - FXInfo (Finder extended file info) record -- not found in MFS -*/ -struct mac_FXInfo -{ - UINT16BE iconID; /* System 7: An ID number for the file???s icon; the - numbers that identify icons are assigned by the - Finder */ - /* System 8: Reserved (set to 0) */ - UINT16BE reserved[3]; /* Reserved (set to 0) */ - UINT8 script; /* System 7: if high-bit is set, the script code - for displaying the file name; ignored otherwise */ - /* System 8: Extended flags MSB(?) */ - UINT8 XFlags; /* Extended flags */ - UINT16BE comment; /* System 7: Comment ID if high-bit is clear */ - /* System 8: Reserved (set to 0) */ - UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the - file onto the desktop, the directory ID of the - folder from which the user moves the file is - saved here) */ -}; - -/* - DInfo (Finder folder info) record -- not found in MFS -*/ -struct mac_DInfo -{ - mac_rect rect; /* Folder's window bounds */ - UINT16BE flags; /* Finder flags, e.g. kIsInvisible, kNameLocked, etc */ - mac_point location; /* Location of the folder in parent window */ - /* If set to {0, 0}, and the initied flag is - clear, the Finder will place the item - automatically */ - UINT16BE view; /* System 7: The manner in which folders are - displayed */ - /* System 8: reserved (set to 0) */ -}; - -/* - DXInfo (Finder extended folder info) record -- not found in MFS -*/ -struct mac_DXInfo -{ - mac_point scroll; /* Scroll position */ - UINT32BE openChain; /* System 7: chain of directory IDs for open folders */ - /* System 8: reserved (set to 0) */ - UINT8 script; /* System 7: if high-bit is set, the script code - for displaying the folder name; ignored otherwise */ - /* System 8: Extended flags MSB(?) */ - UINT8 XFlags; /* Extended flags */ - UINT16BE comment; /* System 7: Comment ID if high-bit is clear */ - /* System 8: Reserved (set to 0) */ - UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the - folder onto the desktop, the directory ID of - the folder from which the user moves it is - saved here) */ -}; - -/* - defines for FInfo & DInfo flags fields -*/ -enum -{ - fif_isOnDesk = 0x0001, /* System 6: set if item is located on desktop (files and folders) */ - /* System 7: Unused (set to 0) */ - fif_color = 0x000E, /* color coding (files and folders) */ - fif_colorReserved = 0x0010, /* System 6: reserved??? */ - /* System 7: Unused (set to 0) */ - fif_requiresSwitchLaunch= 0x0020, /* System 6: ??? */ - /* System 7: Unused (set to 0) */ - fif_isShared = 0x0040, /* Applications files: if set, the */ - /* application can be executed by */ - /* multiple users simultaneously. */ - /* Otherwise, set to 0. */ - fif_hasNoINITs = 0x0080, /* Extensions/Control Panels: if set(?), */ - /* this file contains no INIT */ - /* resource */ - /* Otherwise, set to 0. */ - fif_hasBeenInited = 0x0100, /* System 6: The Finder has recorded information from - the file???s bundle resource into the desktop - database and given the file or folder a - position on the desktop. */ - /* System 7? 8?: Clear if the file contains desktop database */ - /* resources ('BNDL', 'FREF', 'open', 'kind'...) */ - /* that have not been added yet. Set only by the Finder */ - /* Reserved for folders - make sure this bit is cleared for folders */ - - /* bit 0x0200 was at a point (AOCE for system 7.x?) the letter bit for - AOCE, but was reserved before and it is reserved again in recent MacOS - releases. */ - - fif_hasCustomIcon = 0x0400, /* (files and folders) */ - fif_isStationery = 0x0800, /* System 7: (files only) */ - fif_nameLocked = 0x1000, /* (files and folders) */ - fif_hasBundle = 0x2000, /* Files only */ - fif_isInvisible = 0x4000, /* (files and folders) */ - fif_isAlias = 0x8000 /* System 7: (files only) */ -}; - -/* - mac_to_c_strncpy() - - Encode a macintosh string as a C string. The NUL character is escaped, - using the "%00" sequence. To avoid any ambiguity, '%' is escaped with - '%25'. - - dst (O): C string - n (I): length of buffer pointed to by dst - src (I): macintosh string (first byte is length) -*/ -static void mac_to_c_strncpy(char *dst, int n, UINT8 *src) -{ - size_t len = src[0]; - int i, j; - - i = j = 0; - while ((i < len) && (j < n-1)) - { - switch (src[i+1]) - { - case '\0': - if (j >= n-3) - goto exit; - dst[j] = '%'; - dst[j+1] = '0'; - dst[j+2] = '0'; - j += 3; - break; - - case '%': - if (j >= n-3) - goto exit; - dst[j] = '%'; - dst[j+1] = '2'; - dst[j+2] = '5'; - j += 3; - break; - - default: - dst[j] = src[i+1]; - j++; - break; - } - i++; - } - -exit: - if (n > 0) - dst[j] = '\0'; -} - -/* - c_to_mac_strncpy() - - Decode a C string to a macintosh string. The NUL character is escaped, - using the "%00" sequence. To avoid any ambiguity, '%' is escaped with - '%25'. - - dst (O): macintosh string (first byte is length) - src (I): C string - n (I): length of string pointed to by src -*/ -static void c_to_mac_strncpy(mac_str255 dst, const char *src, int n) -{ - size_t len; - int i; - char buf[3]; - - - len = 0; - i = 0; - while ((i < n) && (len < 255)) - { - switch (src[i]) - { - case '%': - if (i >= n-2) - goto exit; - buf[0] = src[i+1]; - buf[1] = src[i+2]; - buf[2] = '\0'; - dst[len+1] = strtoul(buf, NULL, 16); - i += 3; - break; - - default: - dst[len+1] = src[i]; - i++; - break; - } - len++; - } - -exit: - dst[0] = len; -} - -/* - mac_strcmp() - - Compare two macintosh strings - - s1 (I): the string to compare - s2 (I): the comparison string - - Return a zero if s1 and s2 are equal, a negative value if s1 is less than - s2, and a positive value if s1 is greater than s2. -*/ -#ifdef UNUSED_FUNCTION -static int mac_strcmp(const UINT8 *s1, const UINT8 *s2) -{ - size_t common_len; - - common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0]; - - return memcmp(s1+1, s2+1, common_len) || ((int)s1[0] - s2[0]); -} -#endif - -/* - mac_stricmp() - - Compare two macintosh strings in a manner compatible with the macintosh HFS - file system. - - This functions emulates the way HFS (and MFS???) sorts string: this is - equivalent to the RelString macintosh toolbox call with the caseSensitive - parameter as false and the diacSensitive parameter as true. - - s1 (I): the string to compare - s2 (I): the comparison string - - Return a zero if s1 and s2 are equal, a negative value if s1 is less than - s2, and a positive value if s1 is greater than s2. - -Known issues: - Using this function makes sense with the MacRoman encoding, as it means the - computer will regard "DeskTop File", "Desktop File", "Desktop file", etc, - as the same file. (UNIX users will probably regard this as an heresy, but - you must consider that, unlike UNIX, the Macintosh was not designed for - droids, but error-prone human beings that may forget about case.) - - (Also, letters with diatrical signs follow the corresponding letters - without diacritical signs in the HFS catalog file. This does not matter, - though, since the Finder will not display files in the HFS catalog order, - but it will instead sort files according to whatever order is currently - selected in the View menu.) - - However, with other text encodings, the behavior will be completely absurd. - For instance, with the Greek encoding, it will think that the degree symbol - is the same letter (with different case) as the upper-case Psi, so that if - a program asks for a file called "90??" on a greek HFS volume, and there is - a file called "90??" on this volume, file "90??" will be opened. - Results will probably be even weirder with 2-byte scripts like Japanese or - Chinese. Of course, we are not going to fix this issue, since doing so - would break the compatibility with the original Macintosh OS. -*/ - -static int mac_stricmp(const UINT8 *s1, const UINT8 *s2) -{ - static const unsigned char mac_char_sort_table[256] = - { - /* \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - /* \x08 \x09 \x0a \x0b \x0c \x0d \x0e \x0f */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - /* \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - /* \x18 \x19 \x1a \x1b \x1c \x1d \x1e \x1f */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - /* \x20 \x21 \x22 \x23 \x24 \x25 \x26 \x27 */ - 0x20, 0x21, 0x22, 0x27, 0x28, 0x29, 0x2a, 0x2b, - /* \x28 \x29 \x2a \x2b \x2c \x2d \x2e \x2f */ - 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, - /* \x30 \x31 \x32 \x33 \x34 \x35 \x36 \x37 */ - 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, - /* \x38 \x39 \x3a \x3b \x3c \x3d \x3e \x3f */ - 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, - /* \x40 \x41 \x42 \x43 \x44 \x45 \x46 \x47 */ - 0x46, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b, - /* \x48 \x49 \x4a \x4b \x4c \x4d \x4e \x4f */ - 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68, - /* \x50 \x51 \x52 \x53 \x54 \x55 \x56 \x57 */ - 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d, - /* \x58 \x59 \x5a \x5b \x5c \x5d \x5e \x5f */ - 0x7e, 0x7f, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, - /* \x60 \x61 \x62 \x63 \x64 \x65 \x66 \x67 */ - 0x4d, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b, - /* \x68 \x69 \x6a \x6b \x6c \x6d \x6e \x6f */ - 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68, - /* \x70 \x71 \x72 \x73 \x74 \x75 \x76 \x77 */ - 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d, - /* \x78 \x79 \x7a \x7b \x7c \x7d \x7e \x7f */ - 0x7e, 0x7f, 0x81, 0x87, 0x88, 0x89, 0x8a, 0x8b, - /* \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 */ - 0x49, 0x4b, 0x53, 0x56, 0x67, 0x69, 0x78, 0x4e, - /* \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f */ - 0x48, 0x4f, 0x49, 0x4a, 0x4b, 0x53, 0x56, 0x57, - /* \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97 */ - 0x58, 0x59, 0x5e, 0x5f, 0x60, 0x61, 0x67, 0x6d, - /* \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f */ - 0x6e, 0x6f, 0x69, 0x6a, 0x79, 0x7a, 0x7b, 0x78, - /* \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 */ - 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x75, - /* \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf */ - 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x4c, 0x6b, - /* \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 */ - 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, - /* \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf */ - 0xa1, 0xa2, 0xa3, 0x50, 0x70, 0xa4, 0x4c, 0x6b, - /* \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 */ - 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0x25, - /* \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf */ - 0x26, 0xac, 0x20, 0x48, 0x4a, 0x6a, 0x6c, 0x6c, - /* \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 */ - 0xad, 0xae, 0x23, 0x24, 0x2c, 0x2d, 0xaf, 0xb0, - /* \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf */ - 0x80, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, - /* \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - /* \xe8 \xe9 \xea \xeb \xec \xed \xee \xef */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, - /* \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, - /* \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7 - }; - - size_t common_len; - int i; - int c1, c2; - - common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0]; - - for (i=0; i n) - len = n; - dest[0] = len; - memcpy(dest+1, src+1, len); -} -#endif - -/* - disk image reference -*/ -struct mac_l1_imgref -{ - imgtool_image *image; - UINT32 heads; -}; - - - -static imgtoolerr_t mac_find_block(mac_l1_imgref *image, int block, - UINT32 *track, UINT32 *head, UINT32 *sector) -{ - *track = 0; - while(block >= (apple35_sectors_per_track(imgtool_floppy(image->image), *track) * image->heads)) - { - block -= (apple35_sectors_per_track(imgtool_floppy(image->image), (*track)++) * image->heads); - if (*track >= 80) - return IMGTOOLERR_SEEKERROR; - } - - *head = block / apple35_sectors_per_track(imgtool_floppy(image->image), *track); - *sector = block % apple35_sectors_per_track(imgtool_floppy(image->image), *track); - return IMGTOOLERR_SUCCESS; -} - - - -/* - image_read_block() - - Read one 512-byte block of data from a macintosh disk image - - image (I/O): level-1 image reference - block (I): address of block to read - dest (O): buffer where block data should be stored - - Return imgtool error code -*/ -static imgtoolerr_t image_read_block(mac_l1_imgref *image, UINT32 block, void *dest) -{ - imgtoolerr_t err; - floperr_t ferr; - UINT32 track, head, sector; - - err = mac_find_block(image, block, &track, &head, §or); - if (err) - return err; - - ferr = floppy_read_sector(imgtool_floppy(image->image), head, track, sector, 0, dest, 512); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - -/* - image_write_block() - - Read one 512-byte block of data from a macintosh disk image - - image (I/O): level-1 image reference - block (I): address of block to write - src (I): buffer with the block data - - Return imgtool error code -*/ -static imgtoolerr_t image_write_block(mac_l1_imgref *image, UINT32 block, const void *src) -{ - imgtoolerr_t err; - floperr_t ferr; - UINT32 track, head, sector; - - err = mac_find_block(image, block, &track, &head, §or); - if (err) - return err; - - ferr = floppy_write_sector(imgtool_floppy(image->image), head, track, sector, 0, src, 512, 0); /* TODO: pass ddam argument from imgtool */ - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - -/* - image_get_tag_len() - - Get length of tag data (12 for GCR floppies, 20 for HD20, 0 otherwise) - - image (I/O): level-1 image reference - - Return tag length -*/ -INLINE int image_get_tag_len(mac_l1_imgref *image) -{ - return 0; -} - - - -/* - image_read_tag() - - Read a 12- or 20-byte tag record associated with a disk block - - image (I/O): level-1 image reference - block (I): address of block to read - dest (O): buffer where tag data should be stored - - Return imgtool error code -*/ -static imgtoolerr_t image_read_tag(mac_l1_imgref *image, UINT32 block, void *dest) -{ - return IMGTOOLERR_UNEXPECTED; -} - -/* - image_write_tag() - - Write a 12- or 20-byte tag record associated with a disk block - - image (I/O): level-1 image reference - block (I): address of block to write - src (I): buffer with the tag data - - Return imgtool error code -*/ -static imgtoolerr_t image_write_tag(mac_l1_imgref *image, UINT32 block, const void *src) -{ - return IMGTOOLERR_UNEXPECTED; -} - -#if 0 -#pragma mark - -#pragma mark MFS/HFS WRAPPERS -#endif - -enum mac_format -{ - L2I_MFS, - L2I_HFS -}; - -enum mac_forkID { data_fork = 0x00, rsrc_fork = 0xff }; - -/* - MFS image ref -*/ -struct mfs_l2_imgref -{ - UINT16 dir_num_files; - UINT16 dir_start; - UINT16 dir_blk_len; - - UINT16 ABStart; - - mac_str27 volname; - - unsigned char ABlink_dirty[13]; /* dirty flag for each disk block in the ABlink array */ - UINT8 ABlink[6141]; -}; - -/* - HFS extent descriptor -*/ -struct hfs_extent -{ - UINT16BE stABN; /* first allocation block */ - UINT16BE numABlks; /* number of allocation blocks */ -}; - -/* - HFS likes to group extents by 3 (it is 8 with HFS+), so we create a - specific type. -*/ -typedef hfs_extent hfs_extent_3[3]; - -/* - MFS open file ref -*/ -struct mfs_fileref -{ - UINT16 stBlk; /* first allocation block of file */ -}; - -/* - HFS open file ref -*/ -struct hfs_fileref -{ - hfs_extent_3 extents; /* first 3 file extents */ - - UINT32 parID; /* CNID of parent directory (undefined for extent & catalog files) */ - mac_str31 filename; /* file name (undefined for extent & catalog files) */ -}; - -struct mac_l2_imgref; - -/* - MFS/HFS open file ref -*/ -struct mac_fileref -{ - struct mac_l2_imgref *l2_img; /* image pointer */ - - UINT32 fileID; /* file ID (a.k.a. CNID in HFS/HFS+) */ - - mac_forkID forkType; /* 0x00 for data, 0xff for resource */ - - UINT32 eof; /* logical end-of-file */ - UINT32 pLen; /* physical end-of-file */ - - UINT32 crPs; /* current position in file */ - - UINT8 reload_buf; - UINT8 block_buffer[512]; /* buffer with current file block */ - - union - { - mfs_fileref mfs; - hfs_fileref hfs; - }; -}; - -/* - open BT ref -*/ -struct mac_BTref -{ - struct mac_fileref fileref; /* open B-tree file ref */ - - UINT16 nodeSize; /* size of a node, in bytes */ - UINT32 rootNode; /* node number of root node */ - UINT32 firstLeafNode; /* node number of first leaf node */ - UINT32 attributes; /* persistent attributes about the tree */ - UINT16 treeDepth; /* maximum height (usually leaf nodes) */ - UINT16 maxKeyLength; /* maximum key length */ - - /* function to compare keys during tree searches */ - int (*key_compare_func)(const void *key1, const void *key2); - - void *node_buf; /* current node buffer */ -}; - -/* - Constants for BTHeaderRec attributes field -*/ -enum -{ - btha_badCloseMask = 0x00000001, /* reserved */ - btha_bigKeysMask = 0x00000002, /* key length field is 16 bits */ - btha_variableIndexKeysMask = 0x00000004 /* keys in index nodes are variable length */ -}; - -/* - HFS image ref -*/ -struct hfs_l2_imgref -{ - UINT16 VBM_start; - - UINT16 ABStart; - - mac_str27 volname; - - mac_BTref extents_BT; - mac_BTref cat_BT; - - UINT8 VBM[8192]; -}; - -/* - MFS/HFS image ref -*/ -struct mac_l2_imgref -{ - mac_l1_imgref l1_img; - - UINT16 numABs; - UINT16 blocksperAB; - - UINT16 freeABs; - - UINT32 nxtCNID; /* nxtFNum in MFS, nxtCNID in HFS */ - - mac_format format; - union - { - mfs_l2_imgref mfs; - hfs_l2_imgref hfs; - } u; -}; - -/* - MFS Master Directory Block -*/ -struct mfs_mdb -{ - UINT8 sigWord[2]; /* volume signature - always $D2D7 */ - UINT32BE crDate; /* date and time of volume creation */ - UINT32BE lsMod/*lsBkUp???*/;/* date and time of last modification (backup???) */ - UINT16BE atrb; /* volume attributes (0x0000) */ - /* bit 15 is set if volume is locked by software */ - UINT16BE nmFls; /* number of files in directory */ - UINT16BE dirSt; /* first block of directory */ - - UINT16BE blLn; /* length of directory in blocks (0x000C) */ - UINT16BE nmAlBlks; /* number of allocation blocks in volume (0x0187) */ - UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks (0x00000400) */ - UINT32BE clpSiz; /* default clump size - number of bytes to allocate - when a file grows (0x00002000) */ - UINT16BE alBlSt; /* first allocation block in volume (0x0010) */ - - UINT32BE nxtFNum; /* next unused file number */ - UINT16BE freeABs; /* number of unused allocation blocks */ - - mac_str27 VN; /* volume name */ - - UINT8 ABlink[512-64];/* Link array for file ABs. Array of nmAlBlks - 12-bit-long entries, indexed by AB address. If an - AB belongs to no file, the entry is 0; if an AB is - the last in any file, the entry is 1; if an AB - belongs to a file and is not the last one, the - entry is the AB address of the next file AB plus 1. - Note that the array extends on as many consecutive - disk blocks as needed (usually the MDB block plus - the next one). Incidentally, this array is not - saved in the secondary MDB: presumably, the idea - was that the disk utility could rely on the tag - data to rebuild the link array if it should ever - be corrupted. */ -}; - -/* - HFS Master Directory Block -*/ -struct hfs_mdb -{ -/* First fields are similar to MFS, though several fields have a different meaning */ - UINT8 sigWord[2]; /* volume signature - always $D2D7 */ - UINT32BE crDate; /* date and time of volume creation */ - UINT32BE lsMod; /* date and time of last modification */ - UINT16BE atrb; /* volume attributes (0x0000) */ - /* bit 15 is set if volume is locked by software */ - UINT16BE nmFls; /* number of files in root folder */ - UINT16BE VBMSt; /* first block of volume bitmap */ - UINT16BE allocPtr; /* start of next allocation search */ - - UINT16BE nmAlBlks; /* number of allocation blocks in volume */ - UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks */ - UINT32BE clpSiz; /* default clump size - number of bytes to allocate - when a file grows */ - UINT16BE alBlSt; /* first allocation block in volume (0x0010) */ - UINT32BE nxtCNID; /* next unused catalog node ID */ - UINT16BE freeABs; /* number of unused allocation blocks */ - mac_str27 VN; /* volume name */ - -/* next fields are HFS-specific */ - - UINT32BE volBkUp; /* date and time of last backup */ - UINT16BE vSeqNum; /* volume backup sequence number */ - UINT32BE wrCnt; /* volume write count */ - UINT32BE xtClpSiz; /* clump size for extents overflow file */ - UINT32BE ctClpSiz; /* clump size for catalog file */ - UINT16BE nmRtDirs; /* number of directories in root folder */ - UINT32BE filCnt; /* number of files in volume */ - UINT32BE dirCnt; /* number of directories in volume */ - UINT8 fndrInfo[32]; /* information used by the Finder */ - - union - { - struct - { - UINT16BE VCSize; /* size (in blocks) of volume cache */ - UINT16BE VBMCSize; /* size (in blocks) of volume bitmap cache */ - UINT16BE ctlCSize; /* size (in blocks) of common volume cache */ - }; - struct - { - UINT16BE embedSigWord; /* embedded volume signature */ - hfs_extent embedExtent; /* embedded volume location and size */ - } v2; - } u; - - UINT32BE xtFlSize; /* size (in bytes) of extents overflow file */ - hfs_extent_3 xtExtRec; /* extent record for extents overflow file */ - UINT32BE ctFlSize; /* size (in bytes) of catalog file */ - hfs_extent_3 ctExtRec; /* extent record for catalog file */ -}; - -/* to save a little stack space, we use the same buffer for MDB and next blocks */ -union img_open_buf -{ - struct mfs_mdb mfs_mdb; - struct hfs_mdb hfs_mdb; - UINT8 raw[512]; -}; - -/* - Information extracted from catalog/directory -*/ -struct mac_dirent -{ - UINT16 dataRecType; /* type of data record */ - - mac_FInfo flFinderInfo; /* information used by the Finder */ - mac_FXInfo flXFinderInfo; /* information used by the Finder */ - - UINT8 flags; /* bit 0=1 if file locked */ - - UINT32 fileID; /* file ID in directory/catalog */ - - UINT32 dataLogicalSize; /* logical EOF of data fork */ - UINT32 dataPhysicalSize; /* physical EOF of data fork */ - UINT32 rsrcLogicalSize; /* logical EOF of resource fork */ - UINT32 rsrcPhysicalSize; /* physical EOF of resource fork */ - - UINT32 createDate; /* date and time of creation */ - UINT32 modifyDate; /* date and time of last modification */ -}; - -/* - Tag record for GCR floppies (12 bytes) - - And, no, I don't know the format of the 20-byte tag record of the HD20 -*/ -struct floppy_tag_record -{ - UINT32BE fileID; /* a.k.a. CNID */ - /* a value of 1 seems to be the default for non-AB blocks, but this is not consistent */ - UINT8 ftype; /* bit 1 = 1 if resource fork */ - /* bit 0 = 1 if block is allocated to user file (i.e. it is not - in HFS extent & catalog, and not in non-AB blocks such - as MDB and MFS directory)??? */ - /* bit 7 seems to be used, but I don't know what it means */ - /* a value of $FF seems to be the default for non-AB blocks, but this is not consistent */ - UINT8 fattr; /* bit 0 = 1 if locked(?) */ - /* a value of $FF seems to be the default for non-AB blocks, but this is not consistent */ - UINT16BE fblock; /* relative file block number (enough for any volume up to 32 MBytes in size) */ - UINT32BE wrCnt; /* MFS: date and time of last write */ - /* HFS: seems related to the wrCnt field in the mdb, i.e. - each time a volume is written to, the current value of - wrCnt is written in the tag field, then it is incremented */ - /* (DV17 says "disk block number", but it cannot be true) */ -}; - -#ifdef UNUSED_FUNCTION -static void hfs_image_close(struct mac_l2_imgref *l2_img); -#endif -static imgtoolerr_t mfs_file_get_nth_block_address(struct mac_fileref *fileref, UINT32 block_num, UINT32 *block_address); -static imgtoolerr_t hfs_file_get_nth_block_address(struct mac_fileref *fileref, UINT32 block_num, UINT32 *block_address); -static imgtoolerr_t mfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, mac_str255 filename, mac_dirent *cat_info, int create_it); -static imgtoolerr_t hfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info); -static imgtoolerr_t mfs_file_open(struct mac_l2_imgref *l2_img, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref); -static imgtoolerr_t hfs_file_open(struct mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref); -static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABeof); -static imgtoolerr_t mfs_dir_update(struct mac_fileref *fileref); - -static struct mac_l2_imgref *get_imgref(imgtool_image *img) -{ - return (struct mac_l2_imgref *) imgtool_floppy_extrabytes(img); -} - - -#ifdef UNUSED_FUNCTION -/* - mac_image_close - - Close a macintosh image. - - l2_img (I/O): level-2 image reference -*/ -static void mac_image_close(struct mac_l2_imgref *l2_img) -{ - switch (l2_img->format) - { - case L2I_MFS: - break; - - case L2I_HFS: - hfs_image_close(l2_img); - break; - } -} -#endif - -/* - mac_lookup_path - - Resolve a file path, and translate it to a parID + filename pair that enables - to do an efficient file search on a HFS volume (and an inefficient one on - MFS, but it is not an issue as MFS volumes typically have a few dozens - files, vs. possibly thousands with HFS volumes). - - l2_img (I/O): level-2 image reference - fpath (I): file path (C string) - parID (O): set to the CNID of the parent directory if the volume is in HFS - format (reserved for MFS volumes) - filename (O): set to the actual name of the file, with capitalization matching - the one on the volume rather than the one in the fpath parameter (Mac - string) - cat_info (O): catalog info for this file extracted from the catalog file - (may be NULL) - - Return imgtool error code -*/ -static imgtoolerr_t mac_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info, int create_it) -{ - imgtoolerr_t err = IMGTOOLERR_UNEXPECTED; - - switch (l2_img->format) - { - case L2I_MFS: - *parID = 0; - err = mfs_lookup_path(l2_img, fpath, filename, cat_info, create_it); - break; - - case L2I_HFS: - err = hfs_lookup_path(l2_img, fpath, parID, filename, cat_info); - break; - } - return err; -} - -/* - mac_file_open - - Open a file located on a macintosh image - - l2_img (I/O): level-2 image reference - parID (I): CNID of the parent directory if the volume is in HFS format - (reserved for MFS volumes) - filename (I): name of the file (Mac string) - mac_forkID (I): tells which fork should be opened - fileref (O): mac file reference to open - - Return imgtool error code -*/ -static imgtoolerr_t mac_file_open(struct mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref) -{ - switch (l2_img->format) - { - case L2I_MFS: - return mfs_file_open(l2_img, filename, fork, fileref); - - case L2I_HFS: - return hfs_file_open(l2_img, parID, filename, fork, fileref); - } - - return IMGTOOLERR_UNEXPECTED; -} - -/* - mac_file_read - - Read data from an open mac file, starting at current position in file - - fileref (I/O): mac file reference - len (I): number of bytes to read - dest (O): destination buffer - - Return imgtool error code -*/ -static imgtoolerr_t mac_file_read(struct mac_fileref *fileref, UINT32 len, void *dest) -{ - UINT32 block = 0; - floppy_tag_record tag; - int run_len; - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - - if ((fileref->crPs + len) > fileref->eof) - /* EOF */ - return IMGTOOLERR_UNEXPECTED; - - while (len > 0) - { - if (fileref->reload_buf) - { - switch (fileref->l2_img->format) - { - case L2I_MFS: - err = mfs_file_get_nth_block_address(fileref, fileref->crPs/512, &block); - break; - - case L2I_HFS: - err = hfs_file_get_nth_block_address(fileref, fileref->crPs/512, &block); - break; - } - if (err) - return err; - err = image_read_block(&fileref->l2_img->l1_img, block, fileref->block_buffer); - if (err) - return err; - fileref->reload_buf = FALSE; - - if (TAG_EXTRA_CHECKS) - { - /* optional check */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - err = image_read_tag(&fileref->l2_img->l1_img, block, &tag); - if (err) - return err; - - if ((get_UINT32BE(tag.fileID) != fileref->fileID) - || (((tag.ftype & 2) != 0) != (fileref->forkType == rsrc_fork)) - || (get_UINT16BE(tag.fblock) != ((fileref->crPs/512) & 0xffff))) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - } - } - } - run_len = 512 - (fileref->crPs % 512); - if (run_len > len) - run_len = len; - - memcpy(dest, fileref->block_buffer+(fileref->crPs % 512), run_len); - len -= run_len; - dest = (UINT8 *)dest + run_len; - fileref->crPs += run_len; - if ((fileref->crPs % 512) == 0) - fileref->reload_buf = TRUE; - } - - return IMGTOOLERR_SUCCESS; -} - -/* - mac_file_write - - Write data to an open mac file, starting at current position in file - - fileref (I/O): mac file reference - len (I): number of bytes to read - dest (O): destination buffer - - Return imgtool error code -*/ -static imgtoolerr_t mac_file_write(struct mac_fileref *fileref, UINT32 len, const void *src) -{ - UINT32 block = 0; - floppy_tag_record tag; - int run_len; - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - - if ((fileref->crPs + len) > fileref->eof) - /* EOF */ - return IMGTOOLERR_UNEXPECTED; - - while (len > 0) - { - switch (fileref->l2_img->format) - { - case L2I_MFS: - err = mfs_file_get_nth_block_address(fileref, fileref->crPs/512, &block); - break; - - case L2I_HFS: - err = hfs_file_get_nth_block_address(fileref, fileref->crPs/512, &block); - break; - } - if (err) - return err; - - if (TAG_CHECKS) - { - /* optional check */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - err = image_read_tag(&fileref->l2_img->l1_img, block, &tag); - if (err) - return err; - - if ((get_UINT32BE(tag.fileID) != fileref->fileID) - || (((tag.ftype & 2) != 0) != (fileref->forkType == rsrc_fork)) - || (get_UINT16BE(tag.fblock) != ((fileref->crPs/512) & 0xffff))) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - } - } - - if (fileref->reload_buf) - { - err = image_read_block(&fileref->l2_img->l1_img, block, fileref->block_buffer); - if (err) - return err; - fileref->reload_buf = FALSE; - } - run_len = 512 - (fileref->crPs % 512); - if (run_len > len) - run_len = len; - - memcpy(fileref->block_buffer+(fileref->crPs % 512), src, run_len); - err = image_write_block(&fileref->l2_img->l1_img, block, fileref->block_buffer); - if (err) - return err; - /* update tag data */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - if (!TAG_CHECKS) - { - err = image_read_tag(&fileref->l2_img->l1_img, block, &tag); - if (err) - return err; - } - - switch (fileref->l2_img->format) - { - case L2I_MFS: - set_UINT32BE(&tag.wrCnt, mac_time_now()); - break; - - case L2I_HFS: - /*set_UINT32BE(&tag.wrCnt, ++fileref->l2_img.u.hfs.wrCnt);*/ /* ***TODO*** */ - break; - } - - err = image_write_tag(&fileref->l2_img->l1_img, block, &tag); - if (err) - return err; - } - len -= run_len; - src = (const UINT8 *)src + run_len; - fileref->crPs += run_len; - if ((fileref->crPs % 512) == 0) - fileref->reload_buf = TRUE; - } - - return IMGTOOLERR_SUCCESS; -} - -#ifdef UNUSED_FUNCTION -/* - mac_file_tell - - Get current position in an open mac file - - fileref (I/O): mac file reference - filePos (O): current position in file - - Return imgtool error code -*/ -static imgtoolerr_t mac_file_tell(struct mac_fileref *fileref, UINT32 *filePos) -{ - *filePos = fileref->crPs; - - return IMGTOOLERR_SUCCESS; -} -#endif - -/* - mac_file_seek - - Set current position in an open mac file - - fileref (I/O): mac file reference - filePos (I): new position in file - - Return imgtool error code -*/ -static imgtoolerr_t mac_file_seek(struct mac_fileref *fileref, UINT32 filePos) -{ - if ((fileref->crPs / 512) != (filePos / 512)) - fileref->reload_buf = TRUE; - - fileref->crPs = filePos; - - return IMGTOOLERR_SUCCESS; -} - -/* - mac_file_seteof - - Set the position of the EOF in an open mac file - - fileref (I/O): mac file reference - newEof (I): new position of EOF in file - - Return imgtool error code -*/ -static imgtoolerr_t mac_file_seteof(struct mac_fileref *fileref, UINT32 newEof) -{ - UINT32 newABEof; - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - - newABEof = (newEof + fileref->l2_img->blocksperAB * 512 - 1) / (fileref->l2_img->blocksperAB * 512); - -#if 0 - if (fileref->pLen % (fileref->l2_img->blocksperAB * 512)) - return IMGTOOLERR_CORRUPTIMAGE; -#endif - - if (newEof < fileref->eof) - fileref->eof = newEof; - - switch (fileref->l2_img->format) - { - case L2I_MFS: - err = mfs_file_setABeof(fileref, newABEof); - break; - - case L2I_HFS: - err = IMGTOOLERR_UNIMPLEMENTED; - break; - } - if (err) - return err; - - fileref->eof = newEof; - - err = mfs_dir_update(fileref); - if (err) - return err; - - /* update current pos if beyond new EOF */ -#if 0 - if (fileref->crPs > newEof) - { - if ((fileref->crPs / 512) != (newEof / 512)) - fileref->reload_buf = TRUE; - - fileref->crPs = newEof; - } -#endif - - return IMGTOOLERR_SUCCESS; -} - -#if 0 -#pragma mark - -#pragma mark MFS IMPLEMENTATION -#endif - -/* - directory entry for use in the directory file - - Note the structure is variable length. It is always word-aligned, and - cannot cross block boundaries. - - Note that the directory does not seem to be sorted: the order in which - files appear does not match file names, and it does not always match file - IDs. -*/ -struct mfs_dir_entry -{ - UINT8 flags; /* bit 7=1 if entry used, bit 0=1 if file locked */ - /* 0x00 means end of block: if we are not done - with reading the directory, the remnants will - be read from next block */ - UINT8 flVersNum; /* version number (usually 0x00, but I don't - have the IM volume that describes it) */ - mac_FInfo flFinderInfo; /* information used by the Finder */ - - UINT32BE fileID; /* file ID */ - - UINT16BE dataStartBlock; /* first allocation block of data fork */ - UINT32BE dataLogicalSize; /* logical EOF of data fork */ - UINT32BE dataPhysicalSize; /* physical EOF of data fork */ - UINT16BE rsrcStartBlock; /* first allocation block of resource fork */ - UINT32BE rsrcLogicalSize; /* logical EOF of resource fork */ - UINT32BE rsrcPhysicalSize; /* physical EOF of resource fork */ - - UINT32BE createDate; /* date and time of creation */ - UINT32BE modifyDate; /* date and time of last modification */ - - UINT8 name[1]; /* first char is length of file name */ - /* next chars are file name - 255 chars at most */ - /* IIRC, Finder 7 only supports 31 chars, - wheareas earlier versions support 63 chars */ -}; - -/* - FOBJ desktop resource: describes a folder, or the location of the volume - icon. - - In typical Apple manner, this resource is not documented. However, I have - managed to reverse engineer some parts of it. -*/ -struct mfs_FOBJ -{ - UINT8 unknown0[2]; /* $00: $0004 for disk, $0008 for folder??? */ - mac_point location; /* $02: location in parent window */ - UINT8 unknown1[4]; /* $06: ??? */ - UINT8 view; /* $0A: manner in which folders are displayed??? */ - UINT8 unknown2; /* $0B: ??? */ - UINT16BE par_fldr; /* $0C: parent folder ID */ - UINT8 unknown3[10]; /* $0E: ??? */ - UINT16BE unknown4; /* $18: ??? */ - UINT32BE createDate; /* $1A: date and time of creation */ - UINT32BE modifyDate; /* $1E: date and time of last modification */ - UINT16BE unknown5; /* $22: put-away folder ID?????? */ - UINT8 unknown6[8]; /* $24: ??? */ - mac_rect bounds; /* $2C: window bounds */ - mac_point scroll; /* $34: current scroll offset??? */ - union - { /* I think there are two versions of the structure */ - struct - { - UINT16BE item_count; /* number of items (folders and files) in - this folder */ - UINT32BE item_descs[1]; /* this variable-length array has - item_count entries - meaning of entry is unknown */ - } v1; - struct - { - UINT16BE zerofill; /* always 0? */ - UINT16BE unknown0; /* always 0??? */ - UINT16BE item_count; /* number of items (folders and files) in - this folder */ - UINT8 unknown1[20]; /* ??? */ - UINT8 name[1]; /* variable-length macintosh string */ - } v2; - } u; -}; - -/* - MFS open dir ref -*/ -struct mfs_dirref -{ - struct mac_l2_imgref *l2_img; /* image pointer */ - UINT16 index; /* current file index in the disk directory */ - UINT16 cur_block; /* current block offset in directory file */ - UINT16 cur_offset; /* current byte offset in current block of directory file */ - UINT8 block_buffer[512]; /* buffer with current directory block */ -}; - - - -static imgtoolerr_t mfs_image_create(imgtool_image *image, imgtool_stream *stream, option_resolution *opts) -{ - imgtoolerr_t err; - UINT8 buffer[512]; - UINT32 heads, tracks, sector_bytes, i; - UINT32 total_disk_blocks, total_allocation_blocks, allocation_block_size; - UINT32 free_allocation_blocks; - - heads = option_resolution_lookup_int(opts, 'H'); - tracks = option_resolution_lookup_int(opts, 'T'); - sector_bytes = option_resolution_lookup_int(opts, 'L'); - - get_imgref(image)->l1_img.image = image; - get_imgref(image)->l1_img.heads = heads; - - if (sector_bytes != 512) - return IMGTOOLERR_UNEXPECTED; - - /* computation */ - allocation_block_size = 1024; - total_disk_blocks = 0; - for (i = 0; i < tracks; i++) - total_disk_blocks += heads * apple35_sectors_per_track(imgtool_floppy(image), i) * sector_bytes / 512; - total_allocation_blocks = total_disk_blocks / (allocation_block_size / 512); - free_allocation_blocks = total_allocation_blocks - 3; - - /* write master directory block */ - memset(buffer, 0, sizeof(buffer)); - place_integer_be(buffer, 0, 2, 0xd2d7); /* signature */ - place_integer_be(buffer, 2, 4, mac_time_now()); /* creation date */ - place_integer_be(buffer, 6, 4, mac_time_now()); /* last modified date */ - place_integer_be(buffer, 10, 2, 0); /* volume attributes */ - place_integer_be(buffer, 12, 2, 0); /* number of files in directory */ - place_integer_be(buffer, 14, 2, 4); /* first block of directory */ - place_integer_be(buffer, 16, 2, 12); /* length of directory in blocks */ - place_integer_be(buffer, 18, 2, total_allocation_blocks); /* allocation blocks on volume count */ - place_integer_be(buffer, 20, 4, allocation_block_size); /* allocation block size */ - place_integer_be(buffer, 24, 4, 8192); /* default clumping size */ - place_integer_be(buffer, 28, 2, 16); /* first allocation block on volume */ - place_integer_be(buffer, 30, 4, 2); /* next unused catalog node */ - place_integer_be(buffer, 34, 2, free_allocation_blocks); /* free allocation block count */ - pascal_from_c_string(&buffer[36], 28, "Untitled"); /* volume title */ - - err = image_write_block(&get_imgref(image)->l1_img, 2, buffer); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -/* - mfs_image_open - - Open a MFS image. Image must already be open on level 1. This function - should not be called directly: call mac_image_open() instead. - - l2_img (I/O): level-2 image reference to open (l1_img and format fields - must be initialized) - img_open_buf (I): buffer with the MDB block - - Return imgtool error code -*/ -static imgtoolerr_t mfs_image_open(imgtool_image *image, imgtool_stream *stream) -{ - imgtoolerr_t err; - struct mac_l2_imgref *l2_img; - img_open_buf buf_local; - img_open_buf *buf; - - l2_img = get_imgref(image); - l2_img->l1_img.image = image; - l2_img->l1_img.heads = 1; - l2_img->format = L2I_MFS; - - /* read MDB */ - err = image_read_block(&l2_img->l1_img, 2, &buf_local.raw); - if (err) - return err; - buf = &buf_local; - - /* check signature word */ - if ((buf->mfs_mdb.sigWord[0] != 0xd2) || (buf->mfs_mdb.sigWord[1] != 0xd7) - || (buf->mfs_mdb.VN[0] > 27)) - return IMGTOOLERR_CORRUPTIMAGE; - - l2_img->u.mfs.dir_num_files = get_UINT16BE(buf->mfs_mdb.nmFls); - l2_img->u.mfs.dir_start = get_UINT16BE(buf->mfs_mdb.dirSt); - l2_img->u.mfs.dir_blk_len = get_UINT16BE(buf->mfs_mdb.blLn); - - l2_img->numABs = get_UINT16BE(buf->mfs_mdb.nmAlBlks); - if ((get_UINT32BE(buf->mfs_mdb.alBlkSiz) % 512) || (get_UINT32BE(buf->mfs_mdb.alBlkSiz) == 0)) - return IMGTOOLERR_CORRUPTIMAGE; - l2_img->blocksperAB = get_UINT32BE(buf->mfs_mdb.alBlkSiz) / 512; - l2_img->u.mfs.ABStart = get_UINT16BE(buf->mfs_mdb.alBlSt); - - l2_img->nxtCNID = get_UINT32BE(buf->mfs_mdb.nxtFNum); - - l2_img->freeABs = get_UINT16BE(buf->mfs_mdb.freeABs); - - mac_strcpy(l2_img->u.mfs.volname, buf->mfs_mdb.VN); - - if (l2_img->numABs > 4094) - return IMGTOOLERR_CORRUPTIMAGE; - - /* extract link array */ - { - int byte_len = l2_img->numABs + ((l2_img->numABs + 1) >> 1); - int cur_byte; - int cur_block; - int block_len = sizeof(buf->mfs_mdb.ABlink); - - /* clear dirty flags */ - for (cur_block=0; cur_block<13; cur_block++) - l2_img->u.mfs.ABlink_dirty[cur_block] = 0; - - /* append the chunk after MDB to link array */ - cur_byte = 0; - if (block_len > (byte_len - cur_byte)) - block_len = byte_len - cur_byte; - memcpy(l2_img->u.mfs.ABlink+cur_byte, buf->mfs_mdb.ABlink, block_len); - cur_byte += block_len; - cur_block = 2; - while (cur_byte < byte_len) - { - /* read next block */ - cur_block++; - err = image_read_block(&l2_img->l1_img, cur_block, buf->raw); - if (err) - return err; - block_len = 512; - - /* append this block to link array */ - if (block_len > (byte_len - cur_byte)) - block_len = byte_len - cur_byte; - memcpy(l2_img->u.mfs.ABlink+cur_byte, buf->raw, block_len); - cur_byte += block_len; - } - /* check that link array and directory don't overlap */ - if (cur_block >= l2_img->u.mfs.dir_start) - return IMGTOOLERR_CORRUPTIMAGE; - } - - return IMGTOOLERR_SUCCESS; -} - -/* - mfs_update_mdb - - Update MDB on disk - - l2_img (I/O): level-2 image reference - - Return imgtool error code -*/ -static imgtoolerr_t mfs_update_mdb(struct mac_l2_imgref *l2_img) -{ - imgtoolerr_t err; - union - { - struct mfs_mdb mfs_mdb; - UINT8 raw[512]; - } buf; - - assert(l2_img->format == L2I_MFS); - - /* read MDB */ - err = image_read_block(&l2_img->l1_img, 2, &buf.mfs_mdb); - if (err) - return err; - - set_UINT16BE(&buf.mfs_mdb.nmFls, l2_img->u.mfs.dir_num_files); -#if 0 /* these fields are never changed */ - set_UINT16BE(&buf.mfs_mdb.dirSt, l2_img->u.mfs.dir_start); - set_UINT16BE(&buf.mfs_mdb.blLn, l2_img->u.mfs.dir_blk_len); - - set_UINT16BE(&buf.mfs_mdb.nmAlBlks, l2_img->numABs); - set_UINT32BE(&buf.mfs_mdb.alBlkSiz, l2_img->blocksperAB*512); - set_UINT16BE(&buf.mfs_mdb.alBlSt, l2_img->u.mfs.ABStart); -#endif - - set_UINT32BE(&buf.mfs_mdb.nxtFNum, l2_img->nxtCNID); - - set_UINT16BE(&buf.mfs_mdb.freeABs, l2_img->freeABs); - -#if 0 /* these fields are never changed */ - mac_strcpy(buf.mfs_mdb.VN, l2_img->u.mfs.volname); -#endif - - /* save link array */ - { - int byte_len = l2_img->numABs + ((l2_img->numABs + 1) >> 1); - int cur_byte = 0; - int cur_block = 2; - int block_len = sizeof(buf.mfs_mdb.ABlink); - - /* update the chunk of link array after the MDB */ - if (block_len > (byte_len - cur_byte)) - block_len = byte_len - cur_byte; - memcpy(buf.mfs_mdb.ABlink, l2_img->u.mfs.ABlink+cur_byte, block_len); - cur_byte += block_len; - - if (block_len < sizeof(buf.mfs_mdb.ABlink)) - memset(buf.mfs_mdb.ABlink+block_len, 0, sizeof(buf.mfs_mdb.ABlink)-block_len); - - l2_img->u.mfs.ABlink_dirty[0] = 0; - - /* write back modified MDB+link */ - err = image_write_block(&l2_img->l1_img, 2, &buf.mfs_mdb); - if (err) - return err; - - while (cur_byte < byte_len) - { - /* advance to next block */ - cur_block++; - block_len = 512; - - /* extract the current chunk of link array */ - if (block_len > (byte_len - cur_byte)) - block_len = byte_len - cur_byte; - - if (l2_img->u.mfs.ABlink_dirty[cur_block-2]) - { - memcpy(buf.raw, l2_img->u.mfs.ABlink+cur_byte, block_len); - if (block_len < 512) - memset(buf.raw+block_len, 0, 512-block_len); - /* write back link array */ - err = image_write_block(&l2_img->l1_img, cur_block, buf.raw); - if (err) - return err; - l2_img->u.mfs.ABlink_dirty[cur_block-2] = 0; - } - - cur_byte += block_len; - } - } - - return IMGTOOLERR_SUCCESS; -} - -/* - mfs_dir_open - - Open the directory file - - l2_img (I/O): level-2 image reference - dirref (O): open directory file reference - - Return imgtool error code -*/ -static imgtoolerr_t mfs_dir_open(struct mac_l2_imgref *l2_img, const char *path, mfs_dirref *dirref) -{ - imgtoolerr_t err; - - assert(l2_img->format == L2I_MFS); - - if (path[0]) - return IMGTOOLERR_PATHNOTFOUND; - - dirref->l2_img = l2_img; - dirref->index = 0; - - dirref->cur_block = 0; - dirref->cur_offset = 0; - err = image_read_block(&l2_img->l1_img, l2_img->u.mfs.dir_start + dirref->cur_block, dirref->block_buffer); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - -/* - mfs_dir_read - - Read one entry of directory file - - dirref (I/O): open directory file reference - dir_entry (O): set to point to the entry read: set to NULL if EOF or error - - Return imgtool error code -*/ -static imgtoolerr_t mfs_dir_read(mfs_dirref *dirref, mfs_dir_entry **dir_entry) -{ - mfs_dir_entry *cur_dir_entry; - size_t cur_dir_entry_len; - imgtoolerr_t err; - - - if (dir_entry) - *dir_entry = NULL; - - if (dirref->index == dirref->l2_img->u.mfs.dir_num_files) - /* EOF */ - return IMGTOOLERR_SUCCESS; - - /* get cat entry pointer */ - cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset); - while ((dirref->cur_offset == 512) || ! (cur_dir_entry->flags & 0x80)) - { - dirref->cur_block++; - dirref->cur_offset = 0; - if (dirref->cur_block > dirref->l2_img->u.mfs.dir_blk_len) - /* aargh! */ - return IMGTOOLERR_CORRUPTIMAGE; - err = image_read_block(&dirref->l2_img->l1_img, dirref->l2_img->u.mfs.dir_start + dirref->cur_block, dirref->block_buffer); - if (err) - return err; - cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset); - } - - cur_dir_entry_len = offsetof(mfs_dir_entry, name) + cur_dir_entry->name[0] + 1; - - if ((dirref->cur_offset + cur_dir_entry_len) > 512) - /* aargh! */ - return IMGTOOLERR_CORRUPTIMAGE; - - /* entry looks valid: set pointer to entry */ - if (dir_entry) - *dir_entry = cur_dir_entry; - - /* update offset in block */ - dirref->cur_offset += cur_dir_entry_len; - /* align to word boundary */ - dirref->cur_offset = (dirref->cur_offset + 1) & ~1; - - /* update file count */ - dirref->index++; - - return IMGTOOLERR_SUCCESS; -} - -/* - mfs_dir_insert - - Add an entry in the directory file - - l2_img (I/O): level-2 image reference - dirref (I/O): open directory file reference - filename (I): name of the file for which an entry is created (Mac string) - dir_entry (O): set to point to the created entry: set to NULL if EOF or - error - - Return imgtool error code -*/ -static imgtoolerr_t mfs_dir_insert(struct mac_l2_imgref *l2_img, mfs_dirref *dirref, const UINT8 *new_fname, mfs_dir_entry **dir_entry) -{ - size_t new_dir_entry_len; - mfs_dir_entry *cur_dir_entry; - size_t cur_dir_entry_len; - UINT32 cur_date; - imgtoolerr_t err; - - dirref->l2_img = l2_img; - dirref->index = 0; - - new_dir_entry_len = offsetof(mfs_dir_entry, name) + new_fname[0] + 1; - - for (dirref->cur_block = 0; dirref->cur_block < dirref->l2_img->u.mfs.dir_blk_len; dirref->cur_block++) - { - /* read current block */ - err = image_read_block(&dirref->l2_img->l1_img, dirref->l2_img->u.mfs.dir_start + dirref->cur_block, dirref->block_buffer); - if (err) - return err; - - /* get free chunk in this block */ - dirref->cur_offset = 0; - cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset); - while ((dirref->cur_offset < 512) && (cur_dir_entry->flags & 0x80)) - { /* skip cur_dir_entry */ - cur_dir_entry_len = offsetof(mfs_dir_entry, name) + cur_dir_entry->name[0] + 1; - /* update offset in block */ - dirref->cur_offset += cur_dir_entry_len; - /* align to word boundary */ - dirref->cur_offset = (dirref->cur_offset + 1) & ~1; - /* update entry pointer */ - cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset); - /* update file index (useless, but can't harm) */ - dirref->index++; - } - - if (new_dir_entry_len <= (/*512*/510 - dirref->cur_offset)) - { - /*memcpy(cur_dir_entry, new_dir_entry, new_dir_entry_len);*/ - cur_dir_entry->flags = 0x80; - cur_dir_entry->flVersNum = 0x00; - memset(&cur_dir_entry->flFinderInfo, 0, sizeof(cur_dir_entry->flFinderInfo)); - set_UINT32BE(&cur_dir_entry->fileID, dirref->l2_img->nxtCNID++); - set_UINT16BE(&cur_dir_entry->dataStartBlock, 1); - set_UINT32BE(&cur_dir_entry->dataLogicalSize, 0); - set_UINT32BE(&cur_dir_entry->dataPhysicalSize, 0); - set_UINT16BE(&cur_dir_entry->rsrcStartBlock, 1); - set_UINT32BE(&cur_dir_entry->rsrcLogicalSize, 0); - set_UINT32BE(&cur_dir_entry->rsrcPhysicalSize, 0); - cur_date = mac_time_now(); - set_UINT32BE(&cur_dir_entry->createDate, cur_date); - set_UINT32BE(&cur_dir_entry->modifyDate, cur_date); - mac_strcpy(cur_dir_entry->name, new_fname); - - /* update offset in block */ - dirref->cur_offset += new_dir_entry_len; - /* align to word boundary */ - dirref->cur_offset = (dirref->cur_offset + 1) & ~1; - if (dirref->cur_offset < 512) - /* mark remaining space as free record */ - dirref->block_buffer[dirref->cur_offset] = 0; - /* write back directory */ - err = image_write_block(&dirref->l2_img->l1_img, dirref->l2_img->u.mfs.dir_start + dirref->cur_block, dirref->block_buffer); - if (err) - return err; - /* update file count */ - dirref->l2_img->u.mfs.dir_num_files++; - - /* update MDB (nxtCNID & dir_num_files fields) */ - err = mfs_update_mdb(dirref->l2_img); - if (err) - return err; - - if (dir_entry) - *dir_entry = cur_dir_entry; - return IMGTOOLERR_SUCCESS; - } - } - - return IMGTOOLERR_NOSPACE; -} - -/* - mfs_dir_update - - Update one entry of directory file - - fileref (I/O): open file reference - - Return imgtool error code -*/ -static imgtoolerr_t mfs_dir_update(struct mac_fileref *fileref) -{ - UINT16 cur_block; - UINT16 cur_offset; - UINT8 block_buffer[512]; - mfs_dir_entry *cur_dir_entry; - size_t cur_dir_entry_len; - imgtoolerr_t err; - - for (cur_block = 0; cur_block < fileref->l2_img->u.mfs.dir_blk_len; cur_block++) - { - /* read current block */ - err = image_read_block(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.dir_start + cur_block, block_buffer); - if (err) - return err; - - /* get free chunk in this block */ - cur_offset = 0; - cur_dir_entry = (mfs_dir_entry *) (block_buffer + cur_offset); - while ((cur_offset < 512) && (cur_dir_entry->flags & 0x80)) - { - if (get_UINT32BE(cur_dir_entry->fileID) == fileref->fileID) - { /* found it: update directory entry */ - switch (fileref->forkType) - { - case data_fork: - set_UINT16BE(&cur_dir_entry->dataStartBlock, fileref->mfs.stBlk); - set_UINT32BE(&cur_dir_entry->dataLogicalSize, fileref->eof); - set_UINT32BE(&cur_dir_entry->dataPhysicalSize, fileref->pLen); - break; - - case rsrc_fork: - set_UINT16BE(&cur_dir_entry->rsrcStartBlock, fileref->mfs.stBlk); - set_UINT32BE(&cur_dir_entry->rsrcLogicalSize, fileref->eof); - set_UINT32BE(&cur_dir_entry->rsrcPhysicalSize, fileref->pLen); - break; - } - /* write back directory */ - err = image_write_block(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.dir_start + cur_block, block_buffer); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; - } - /* skip cur_dir_entry */ - cur_dir_entry_len = offsetof(mfs_dir_entry, name) + cur_dir_entry->name[0] + 1; - /* update offset in block */ - cur_offset += cur_dir_entry_len; - /* align to word boundary */ - cur_offset = (cur_offset + 1) & ~1; - /* update entry pointer */ - cur_dir_entry = (mfs_dir_entry *) (block_buffer + cur_offset); - } - } - - return IMGTOOLERR_UNEXPECTED; -} - - -/* - mfs_find_dir_entry - - Find a file in an MFS directory - - dirref (I/O): open directory file reference - filename (I): file name (Mac string) - dir_entry (O): set to point to the entry read: set to NULL if EOF or error - - Return imgtool error code -*/ -static imgtoolerr_t mfs_find_dir_entry(mfs_dirref *dirref, const mac_str255 filename, mfs_dir_entry **dir_entry) -{ - mfs_dir_entry *cur_dir_entry; - imgtoolerr_t err; - - if (dir_entry) - *dir_entry = NULL; - - /* scan dir for file */ - while (1) - { - err = mfs_dir_read(dirref, &cur_dir_entry); - if (err) - return err; - if (!cur_dir_entry) - /* EOF */ - break; - if ((! mac_stricmp(filename, cur_dir_entry->name)) && (cur_dir_entry->flVersNum == 0)) - { /* file found */ - - if (dir_entry) - *dir_entry = cur_dir_entry; - - return IMGTOOLERR_SUCCESS; - } - } - - return IMGTOOLERR_FILENOTFOUND; -} - -/* - mfs_lookup_path - - Resolve a file path for MFS volumes. This function should not be called - directly: call mac_lookup_path instead. - - l2_img (I/O): level-2 image reference - fpath (I): file path (C string) - filename (O): set to the actual name of the file, with capitalization matching - the one on the volume rather than the one in the fpath parameter (Mac - string) - cat_info (I/O): on output, catalog info for this file extracted from the - catalog file (may be NULL) - If create_it is TRUE, created info will first be set according to the - data from cat_info - create_it (I): TRUE if entry should be created if not found - - Return imgtool error code -*/ -static imgtoolerr_t mfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, mac_str255 filename, mac_dirent *cat_info, int create_it) -{ - mfs_dirref dirref; - mfs_dir_entry *dir_entry; - imgtoolerr_t err; - - /* rapid check */ - if (strchr(fpath, ':')) - return IMGTOOLERR_BADFILENAME; - - /* extract file name */ - c_to_mac_strncpy(filename, fpath, strlen(fpath)); - - /* open dir */ - mfs_dir_open(l2_img, "", &dirref); - - /* find file */ - err = mfs_find_dir_entry(&dirref, filename, &dir_entry); - if ((err == IMGTOOLERR_FILENOTFOUND) && create_it) - err = mfs_dir_insert(l2_img, &dirref, filename, &dir_entry); - if (err) - return err; - - mac_strcpy(filename, dir_entry->name); - - if (create_it && cat_info) - { - dir_entry->flFinderInfo = cat_info->flFinderInfo; - dir_entry->flags = (dir_entry->flags & 0x80) | (cat_info->flags & 0x7f); - set_UINT32BE(&dir_entry->createDate, cat_info->createDate); - set_UINT32BE(&dir_entry->modifyDate, cat_info->modifyDate); - - /* write current directory block */ - err = image_write_block(&l2_img->l1_img, l2_img->u.mfs.dir_start + dirref.cur_block, dirref.block_buffer); - if (err) - return err; - } - - if (cat_info) - { - cat_info->flFinderInfo = dir_entry->flFinderInfo; - memset(&cat_info->flXFinderInfo, 0, sizeof(cat_info->flXFinderInfo)); - cat_info->flags = dir_entry->flags; - cat_info->fileID = get_UINT32BE(dir_entry->fileID); - cat_info->dataLogicalSize = get_UINT32BE(dir_entry->dataLogicalSize); - cat_info->dataPhysicalSize = get_UINT32BE(dir_entry->dataPhysicalSize); - cat_info->rsrcLogicalSize = get_UINT32BE(dir_entry->rsrcLogicalSize); - cat_info->rsrcPhysicalSize = get_UINT32BE(dir_entry->rsrcPhysicalSize); - cat_info->createDate = get_UINT32BE(dir_entry->createDate); - cat_info->modifyDate = get_UINT32BE(dir_entry->modifyDate); - cat_info->dataRecType = 0x200; /* hcrt_File */ - } - - return IMGTOOLERR_SUCCESS; -} - -/* - mfs_file_open_internal - - Open a file fork, given its directory entry. This function should not be - called directly: call mfs_file_open instead. - - l2_img (I/O): level-2 image reference - dir_entry (I): directory entry for the file to open - mac_forkID (I): tells which fork should be opened - fileref (O): mac file reference to open - - Return imgtool error code -*/ -static imgtoolerr_t mfs_file_open_internal(struct mac_l2_imgref *l2_img, const mfs_dir_entry *dir_entry, mac_forkID fork, struct mac_fileref *fileref) -{ - assert(l2_img->format == L2I_MFS); - - fileref->l2_img = l2_img; - - fileref->fileID = get_UINT32BE(dir_entry->fileID); - fileref->forkType = fork; - - switch (fork) - { - case data_fork: - fileref->mfs.stBlk = get_UINT16BE(dir_entry->dataStartBlock); - fileref->eof = get_UINT32BE(dir_entry->dataLogicalSize); - fileref->pLen = get_UINT32BE(dir_entry->dataPhysicalSize); - break; - - case rsrc_fork: - fileref->mfs.stBlk = get_UINT16BE(dir_entry->rsrcStartBlock); - fileref->eof = get_UINT32BE(dir_entry->rsrcLogicalSize); - fileref->pLen = get_UINT32BE(dir_entry->rsrcPhysicalSize); - break; - } - - fileref->crPs = 0; - - fileref->reload_buf = TRUE; - - return IMGTOOLERR_SUCCESS; -} - -/* - mfs_file_open - - Open a file located on a MFS volume. This function should not be called - directly: call mac_file_open instead. - - l2_img (I/O): level-2 image reference - filename (I): name of the file (Mac string) - mac_forkID (I): tells which fork should be opened - fileref (O): mac file reference to open - - Return imgtool error code -*/ -static imgtoolerr_t mfs_file_open(struct mac_l2_imgref *l2_img, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref) -{ - mfs_dirref dirref; - mfs_dir_entry *dir_entry; - imgtoolerr_t err; - - /* open dir */ - mfs_dir_open(l2_img, "", &dirref); - - /* find file */ - err = mfs_find_dir_entry(&dirref, filename, &dir_entry); - if (err) - return err; - - /* open it */ - return mfs_file_open_internal(l2_img, dir_entry, fork, fileref); -} - -/* - mfs_get_ABlink - - Read one entry of the Allocation Bitmap link array, on an MFS volume. - - l2_img (I/O): level-2 image reference - AB_address (I): index in the array, which is an AB address - - Returns the 12-bit value read in array. -*/ -static UINT16 mfs_get_ABlink(struct mac_l2_imgref *l2_img, UINT16 AB_address) -{ - UINT16 reply; - int base; - - assert(l2_img->format == L2I_MFS); - - base = (AB_address >> 1) * 3; - - if (! (AB_address & 1)) - reply = (l2_img->u.mfs.ABlink[base] << 4) | ((l2_img->u.mfs.ABlink[base+1] >> 4) & 0x0f); - else - reply = ((l2_img->u.mfs.ABlink[base+1] << 8) & 0xf00) | l2_img->u.mfs.ABlink[base+2]; - - return reply; -} - -/* - mfs_set_ABlink - - Set one entry of the Allocation Bitmap link array, on an MFS volume. - - l2_img (I/O): level-2 image reference - AB_address (I): index in the array, which is an AB address - data (I): 12-bit value to write in array -*/ -static void mfs_set_ABlink(struct mac_l2_imgref *l2_img, UINT16 AB_address, UINT16 data) -{ - int base; - - assert(l2_img->format == L2I_MFS); - - base = (AB_address >> 1) * 3; - - if (! (AB_address & 1)) - { - l2_img->u.mfs.ABlink[base] = (data >> 4) & 0xff; - l2_img->u.mfs.ABlink[base+1] = (l2_img->u.mfs.ABlink[base+1] & 0x0f) | ((data << 4) & 0xf0); - - l2_img->u.mfs.ABlink_dirty[(base+64)/512] = 1; - l2_img->u.mfs.ABlink_dirty[(base+1+64)/512] = 1; - } - else - { - l2_img->u.mfs.ABlink[base+1] = (l2_img->u.mfs.ABlink[base+1] & 0xf0) | ((data >> 8) & 0x0f); - l2_img->u.mfs.ABlink[base+2] = data & 0xff; - - l2_img->u.mfs.ABlink_dirty[(base+1+64)/512] = 1; - l2_img->u.mfs.ABlink_dirty[(base+2+64)/512] = 1; - } -} - -/* - mfs_file_get_nth_block_address - - Get the disk block address of a given block in an open file on a MFS image. - Called by macintosh file code. - - fileref (I/O): open mac file reference - block_num (I): file block index - block_address (O): disk block address for the file block - - Return imgtool error code -*/ -static imgtoolerr_t mfs_file_get_nth_block_address(struct mac_fileref *fileref, UINT32 block_num, UINT32 *block_address) -{ - UINT32 AB_num; - UINT32 i; - UINT16 AB_address; - - assert(fileref->l2_img->format == L2I_MFS); - - AB_num = block_num / fileref->l2_img->blocksperAB; - - AB_address = fileref->mfs.stBlk; - if ((AB_address == 0) || (AB_address >= fileref->l2_img->numABs+2)) - /* 0 -> ??? */ - return IMGTOOLERR_CORRUPTIMAGE; - if (AB_address == 1) - /* EOF */ - return IMGTOOLERR_UNEXPECTED; - AB_address -= 2; - for (i=0; il2_img, AB_address); - if ((AB_address == 0) || (AB_address >= fileref->l2_img->numABs+2)) - /* 0 -> empty block: there is no way an empty block could make it - into the link chain!!! */ - return IMGTOOLERR_CORRUPTIMAGE; - if (AB_address == 1) - /* EOF */ - return IMGTOOLERR_UNEXPECTED; - AB_address -= 2; - } - - *block_address = fileref->l2_img->u.mfs.ABStart + AB_address * fileref->l2_img->blocksperAB - + block_num % fileref->l2_img->blocksperAB; - - return IMGTOOLERR_SUCCESS; -} - -/* - mfs_file_allocABs - - Allocate a chunk of ABs - - fileref (I/O): open mac file reference - lastAB (I): AB address on disk of last file AB (only if - fileref->mfs.stBlk != 1) - allocABs (I): number of ABs to allocate in addition to the current file - allocation - fblock (I): first file block to allocate (used for tag data) - - Return imgtool error code -*/ -static imgtoolerr_t mfs_file_allocABs(struct mac_fileref *fileref, UINT16 lastAB, UINT32 allocABs, UINT32 fblock) -{ - int numABs = fileref->l2_img->numABs; - int free_ABs; - int i, j; - floppy_tag_record tag; - int extentBaseAB, extentABlen; - int firstBestExtentBaseAB = 0, firstBestExtentABlen; - int secondBestExtentBaseAB = 0, secondBestExtentABlen; - imgtoolerr_t err; - - /* return if done */ - if (! allocABs) - return IMGTOOLERR_SUCCESS; - - /* compute free space */ - free_ABs = 0; - for (i=0; il2_img, i) == 0) - { - if (TAG_CHECKS) - { - /* optional check */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - for (j=0; jl2_img->blocksperAB; j++) - { - err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + i * fileref->l2_img->blocksperAB + j, &tag); - if (err) - return err; - - if (get_UINT32BE(tag.fileID) != 0) - { - /*return IMGTOOLERR_CORRUPTIMAGE;*/ - goto corrupt_free_block; - } - } - } - } - - free_ABs++; - } -corrupt_free_block: - ; - } - - /* check we have enough free space */ - if (free_ABs < allocABs) - return IMGTOOLERR_NOSPACE; - - if (fileref->mfs.stBlk != 1) - { /* try to extend last file extent */ - /* append free ABs after last AB */ - for (i=lastAB+1; (mfs_get_ABlink(fileref->l2_img, i) == 0) && (allocABs > 0) && (i < numABs); i++) - { - if (TAG_CHECKS) - { - /* optional check */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - for (j=0; jl2_img->blocksperAB; j++) - { - err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + i * fileref->l2_img->blocksperAB + j, &tag); - if (err) - return err; - - if (get_UINT32BE(tag.fileID) != 0) - { - /*return IMGTOOLERR_CORRUPTIMAGE;*/ - goto corrupt_free_block2; - } - } - } - } - - mfs_set_ABlink(fileref->l2_img, lastAB, i+2); - lastAB = i; - allocABs--; - free_ABs--; - } -corrupt_free_block2: - /* return if done */ - if (! allocABs) - { - mfs_set_ABlink(fileref->l2_img, lastAB, 1); - fileref->l2_img->freeABs = free_ABs; - return IMGTOOLERR_SUCCESS; /* done */ - } - } - - while (allocABs) - { - /* find smallest data block at least nb_alloc_physrecs in length, and largest data block less than nb_alloc_physrecs in length */ - firstBestExtentABlen = INT_MAX; - secondBestExtentABlen = 0; - for (i=0; il2_img, i) == 0) - { /* found one free block */ - /* compute its length */ - extentBaseAB = i; - extentABlen = 0; - while ((il2_img, i) == 0)) - { - if (TAG_CHECKS) - { - /* optional check */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - for (j=0; jl2_img->blocksperAB; j++) - { - err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + i * fileref->l2_img->blocksperAB + j, &tag); - if (err) - return err; - - if (get_UINT32BE(tag.fileID) != 0) - { - /*return IMGTOOLERR_CORRUPTIMAGE;*/ - goto corrupt_free_block3; - } - } - } - } - - extentABlen++; - i++; - } -corrupt_free_block3: - /* compare to previous best and second-best blocks */ - if ((extentABlen < firstBestExtentABlen) && (extentABlen >= allocABs)) - { - firstBestExtentBaseAB = extentBaseAB; - firstBestExtentABlen = extentABlen; - if (extentABlen == allocABs) - /* no need to search further */ - break; - } - else if ((extentABlen > secondBestExtentABlen) && (extentABlen < allocABs)) - { - secondBestExtentBaseAB = extentBaseAB; - secondBestExtentABlen = extentABlen; - } - } - } - - if (firstBestExtentABlen != INT_MAX) - { /* found one contiguous block which can hold it all */ - extentABlen = allocABs; - for (i=0; imfs.stBlk != 1) - mfs_set_ABlink(fileref->l2_img, lastAB, firstBestExtentBaseAB+i+2); - else - fileref->mfs.stBlk = firstBestExtentBaseAB+i+2; - lastAB = firstBestExtentBaseAB+i; - free_ABs--; - /* set tag to allocated */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - set_UINT32BE(&tag.fileID, fileref->fileID); - tag.ftype = 1; - if ((fileref->forkType) == rsrc_fork) - tag.ftype |= 2; - tag.fattr = /*fattr*/ 0; /* ***TODO*** */ - for (j=0; jl2_img->blocksperAB; j++) - { - set_UINT16BE(&tag.fblock, fblock & 0xffff); - set_UINT32BE(&tag.wrCnt, mac_time_now()); - err = image_write_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + lastAB * fileref->l2_img->blocksperAB + j, &tag); - if (err) - { - mfs_set_ABlink(fileref->l2_img, lastAB, 1); - fileref->l2_img->freeABs = free_ABs; - return err; - } - fblock++; - } - } - } - allocABs = 0; - mfs_set_ABlink(fileref->l2_img, lastAB, 1); - fileref->l2_img->freeABs = free_ABs; - /*return IMGTOOLERR_SUCCESS;*/ /* done */ - } - else if (secondBestExtentABlen != 0) - { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */ - for (i=0; imfs.stBlk != 1) - mfs_set_ABlink(fileref->l2_img, lastAB, secondBestExtentBaseAB+i+2); - else - fileref->mfs.stBlk = secondBestExtentBaseAB+i+2; - lastAB = secondBestExtentBaseAB+i; - free_ABs--; - /* set tag to allocated */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - set_UINT32BE(&tag.fileID, fileref->fileID); - tag.ftype = 1; - if ((fileref->forkType) == rsrc_fork) - tag.ftype |= 2; - tag.fattr = /*fattr*/ 0; /* ***TODO*** */ - for (j=0; jl2_img->blocksperAB; j++) - { - set_UINT16BE(&tag.fblock, fblock & 0xffff); - set_UINT32BE(&tag.wrCnt, mac_time_now()); - err = image_write_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + lastAB * fileref->l2_img->blocksperAB + j, &tag); - if (err) - { - mfs_set_ABlink(fileref->l2_img, lastAB, 1); - fileref->l2_img->freeABs = free_ABs; - return err; - } - fblock++; - } - } - } - allocABs -= secondBestExtentABlen; - } - else - { - mfs_set_ABlink(fileref->l2_img, lastAB, 1); - return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */ - } - } - - return IMGTOOLERR_SUCCESS; -} - -/* - mfs_file_setABeof - - Set physical file EOF in ABs - - fileref (I/O): open mac file reference - newABeof (I): desired number of allocated ABs for this file - - Return imgtool error code -*/ -static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABeof) -{ - UINT16 AB_address = 0; - UINT16 AB_link; - int i, j; - floppy_tag_record tag; - int MDB_dirty = 0; - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - - - assert(fileref->l2_img->format == L2I_MFS); - - /* run through link chain until we reach the old or the new EOF */ - AB_link = fileref->mfs.stBlk; - if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2)) - /* 0 -> ??? */ - return IMGTOOLERR_CORRUPTIMAGE; - for (i=0; (il2_img, AB_address); - if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2)) - /* 0 -> empty block: there is no way an empty block could make it - into the link chain!!! */ - return IMGTOOLERR_CORRUPTIMAGE; - - if (TAG_CHECKS) - { - /* optional check */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - for (j=0; jl2_img->blocksperAB; j++) - { - err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + AB_address * fileref->l2_img->blocksperAB + j, &tag); - if (err) - return err; - - if ((get_UINT32BE(tag.fileID) != fileref->fileID) - || (((tag.ftype & 2) != 0) != (fileref->forkType == rsrc_fork)) - || (get_UINT16BE(tag.fblock) != ((i * fileref->l2_img->blocksperAB + j) & 0xffff))) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - } - } - } - } - - if (i == newABeof) - { /* new EOF is shorter than old one */ - /* mark new eof */ - if (i==0) - fileref->mfs.stBlk = 1; - else - { - mfs_set_ABlink(fileref->l2_img, AB_address, 1); - MDB_dirty = 1; - } - - /* free all remaining blocks */ - while (AB_link != 1) - { - AB_address = AB_link - 2; - AB_link = mfs_get_ABlink(fileref->l2_img, AB_address); - if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2)) - { /* 0 -> empty block: there is no way an empty block could make - it into the link chain!!! */ - if (MDB_dirty) - { /* update MDB (freeABs field) and ABLink array */ - err = mfs_update_mdb(fileref->l2_img); - if (err) - return err; - } - return IMGTOOLERR_CORRUPTIMAGE; - } - - if (TAG_CHECKS) - { - /* optional check */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - for (j=0; jl2_img->blocksperAB; j++) - { - err = image_read_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + AB_address * fileref->l2_img->blocksperAB + j, &tag); - if (err) - return err; - - if ((get_UINT32BE(tag.fileID) != fileref->fileID) - || (((tag.ftype & 2) != 0) != (fileref->forkType == rsrc_fork)) - || (get_UINT16BE(tag.fblock) != ((i * fileref->l2_img->blocksperAB + j) & 0xffff))) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - } - } - } - - mfs_set_ABlink(fileref->l2_img, AB_address, 0); - fileref->l2_img->freeABs++; - MDB_dirty = 1; - /* set tag to free */ - if (image_get_tag_len(&fileref->l2_img->l1_img) == 12) - { - memset(&tag, 0, sizeof(tag)); - for (j=0; jl2_img->blocksperAB; j++) - { - err = image_write_tag(&fileref->l2_img->l1_img, fileref->l2_img->u.mfs.ABStart + AB_address * fileref->l2_img->blocksperAB + j, &tag); - if (err) - return err; - } - } - i++; - } - } - else - { /* new EOF is larger than old one */ - err = mfs_file_allocABs(fileref, AB_address, newABeof - i, i * fileref->l2_img->blocksperAB); - if (err) - return err; - MDB_dirty = 1; - } - - if (MDB_dirty) - { /* update MDB (freeABs field) and ABLink array */ - err = mfs_update_mdb(fileref->l2_img); - if (err) - return err; - } - - fileref->pLen = newABeof * (fileref->l2_img->blocksperAB * 512); - - return IMGTOOLERR_SUCCESS; -} - -#ifdef UNUSED_FUNCTION -/* - mfs_hashString - - Hash a string: under MFS, this provides the resource ID of the comment - resource associated with the file whose name is provided (FCMT resource - type). - - Ripped from Apple technote TB06 (converted from 68k ASM to C) - - string (I): string to hash - - Returns hash value -*/ -static int mfs_hashString(const mac_str255 string) -{ - int reply; - int len; - int i; - - len = string[0]; - - reply = 0; - for (i=0; i> 1) & 0x7fff) | ~0x7fff; - else - reply = ((reply >> 1) & 0x7fff); - if (! (reply & 0x8000)) - reply = - reply; - } - - return reply; -} -#endif - -#if 0 -#pragma mark - -#pragma mark HFS IMPLEMENTATION -#endif - -/* - HFS extents B-tree key -*/ -struct hfs_extentKey -{ - UINT8 keyLength; /* length of key, excluding this field */ - UINT8 forkType; /* 0 = data fork, FF = resource fork */ - UINT32BE fileID; /* file ID */ - UINT16BE startBlock; /* first file allocation block number in this extent */ -}; -enum -{ - keyLength_hfs_extentKey = sizeof(hfs_extentKey) - sizeof(UINT8) -}; - -/* - HFS catalog B-tree key -*/ -struct hfs_catKey -{ - UINT8 keyLen; /* key length */ - UINT8 resrv1; /* reserved */ - UINT32BE parID; /* parent directory ID */ - mac_str31 cName; /* catalog node name */ - /* note that in index nodes, it is a mac_str31, but - in leaf keys it's a variable-length string */ -}; - -/* - HFS catalog data record for a folder - 70 bytes -*/ -struct hfs_catFolderData -{ - UINT16BE recordType; /* record type */ - UINT16BE flags; /* folder flags */ - UINT16BE valence; /* folder valence */ - UINT32BE folderID; /* folder ID */ - UINT32BE createDate; /* date and time of creation */ - UINT32BE modifyDate; /* date and time of last modification */ - UINT32BE backupDate; /* date and time of last backup */ - mac_DInfo userInfo; /* Finder information */ - mac_DXInfo finderInfo; /* additional Finder information */ - UINT32BE reserved[4]; /* reserved - set to zero */ -}; - -/* - HFS catalog data record for a file - 102 bytes -*/ -struct hfs_catFileData -{ - UINT16BE recordType; /* record type */ - UINT8 flags; /* file flags */ - UINT8 fileType; /* file type (reserved, always 0?) */ - mac_FInfo userInfo; /* Finder information */ - UINT32BE fileID; /* file ID */ - UINT16BE dataStartBlock; /* not used - set to zero */ - UINT32BE dataLogicalSize; /* logical EOF of data fork */ - UINT32BE dataPhysicalSize; /* physical EOF of data fork */ - UINT16BE rsrcStartBlock; /* not used - set to zero */ - UINT32BE rsrcLogicalSize; /* logical EOF of resource fork */ - UINT32BE rsrcPhysicalSize; /* physical EOF of resource fork */ - UINT32BE createDate; /* date and time of creation */ - UINT32BE modifyDate; /* date and time of last modification */ - UINT32BE backupDate; /* date and time of last backup */ - mac_FXInfo finderInfo; /* additional Finder information */ - UINT16BE clumpSize; /* file clump size (not used) */ - hfs_extent_3 dataExtents; /* first data fork extent record */ - hfs_extent_3 rsrcExtents; /* first resource fork extent record */ - UINT32BE reserved; /* reserved - set to zero */ -}; - -/* - HFS catalog data record for a thread - 46 bytes - - The key for a thread record features the CNID of the item and an empty - name, instead of the CNID of the parent and the item name. -*/ -struct hfs_catThreadData -{ - UINT16BE recordType; /* record type */ - UINT32BE reserved[2]; /* reserved - set to zero */ - UINT32BE parID; /* parent ID for this catalog node */ - mac_str31 nodeName; /* name of this catalog node */ -}; - -/* - union for all types at once -*/ -union hfs_catData -{ - UINT16BE dataType; - hfs_catFolderData folder; - hfs_catFileData file; - hfs_catThreadData thread; -}; - -/* - HFS catalog record types -*/ -enum -{ - hcrt_Folder = 0x0100, /* Folder record */ - hcrt_File = 0x0200, /* File record */ - hcrt_FolderThread = 0x0300, /* Folder thread record */ - hcrt_FileThread = 0x0400 /* File thread record */ -}; - -/* - Catalog file record flags - - This is similar to the MFS catalog flag field, but the "thread exists" flag - (0x02) is specific to HFS/HFS+, whereas the "Record in use" flag (0x80) is - only used by MFS. -*/ -enum -{ - cfrf_fileLocked = 0x01, /* file is locked and cannot be written to */ - cfrf_threadExists = 0x02 /* a file thread record exists for this file */ -}; - -/* - BT functions used by HFS functions -*/ -struct BT_leaf_rec_enumerator -{ - mac_BTref *BTref; - UINT32 cur_node; - int cur_rec; -}; - -static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void *key1, const void *key2), int is_extent); -static void BT_close(mac_BTref *BTref); -static imgtoolerr_t BT_search_leaf_rec(mac_BTref *BTref, const void *search_key, - UINT32 *node_ID, int *record_ID, - void **record_ptr, int *record_len, - int search_exact_match, int *match_found); -static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, int rec_len, void **data_ptr, int *data_len); -static imgtoolerr_t BT_leaf_rec_enumerator_open(mac_BTref *BTref, BT_leaf_rec_enumerator *enumerator); -static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerator, void **record_ptr, int *rec_len); - -struct hfs_cat_enumerator -{ - struct mac_l2_imgref *l2_img; - BT_leaf_rec_enumerator BT_enumerator; - UINT32 parID; -}; - -/* - hfs_open_extents_file - - Open the file extents B-tree file - - l2_img (I/O): level-2 image reference - mdb (I): copy of the MDB block - fileref (O): mac open file reference - - Return imgtool error code -*/ -static imgtoolerr_t hfs_open_extents_file(struct mac_l2_imgref *l2_img, const struct hfs_mdb *mdb, struct mac_fileref *fileref) -{ - assert(l2_img->format == L2I_HFS); - - fileref->l2_img = l2_img; - - fileref->fileID = 3; - fileref->forkType = (mac_forkID)0x00; - - fileref->eof = fileref->pLen = get_UINT32BE(mdb->xtFlSize); - memcpy(fileref->hfs.extents, mdb->xtExtRec, sizeof(hfs_extent_3)); - - fileref->crPs = 0; - - fileref->reload_buf = TRUE; - - return IMGTOOLERR_SUCCESS; -} - -/* - hfs_open_cat_file - - Open the disk catalog B-tree file - - l2_img (I/O): level-2 image reference - mdb (I): copy of the MDB block - fileref (O): mac open file reference - - Return imgtool error code -*/ -static imgtoolerr_t hfs_open_cat_file(struct mac_l2_imgref *l2_img, const struct hfs_mdb *mdb, struct mac_fileref *fileref) -{ - assert(l2_img->format == L2I_HFS); - - fileref->l2_img = l2_img; - - fileref->fileID = 4; - fileref->forkType = (mac_forkID)0x00; - - fileref->eof = fileref->pLen = get_UINT32BE(mdb->ctFlSize); - memcpy(fileref->hfs.extents, mdb->ctExtRec, sizeof(hfs_extent_3)); - - fileref->crPs = 0; - - fileref->reload_buf = TRUE; - - return IMGTOOLERR_SUCCESS; -} - -/* - hfs_extentKey_compare - - key compare function for file extents B-tree - - p1 (I): pointer to first key - p2 (I): pointer to second key - - Return a zero the two keys are equal, a negative value if the key pointed - to by p1 is less than the key pointed to by p2, and a positive value if the - key pointed to by p1 is greater than the key pointed to by p2. -*/ -static int hfs_extentKey_compare(const void *p1, const void *p2) -{ - const hfs_extentKey *key1 = (const hfs_extentKey*)p1; - const hfs_extentKey *key2 = (const hfs_extentKey*)p2; - - /* let's keep it simple for now */ - return memcmp(key1, key2, sizeof(hfs_extentKey)); -} - -/* - hfs_catKey_compare - - key compare function for disk catalog B-tree - - p1 (I): pointer to first key - p2 (I): pointer to second key - - Return a zero the two keys are equal, a negative value if the key pointed - to by p1 is less than the key pointed to by p2, and a positive value if the - key pointed to by p1 is greater than the key pointed to by p2. -*/ -static int hfs_catKey_compare(const void *p1, const void *p2) -{ - const hfs_catKey *key1 = (const hfs_catKey *)p1; - const hfs_catKey *key2 = (const hfs_catKey *)p2; - - if (get_UINT32BE(key1->parID) != get_UINT32BE(key2->parID)) - return (get_UINT32BE(key1->parID) < get_UINT32BE(key2->parID)) ? -1 : +1; - - return mac_stricmp(key1->cName, key2->cName); -} - -/* - hfs_image_open - - Open a HFS image. Image must already be open on level 1. - - l2_img (I/O): level-2 image reference to open (l1_img and format fields - must be initialized) - img_open_buf (I): buffer with the MDB block - - Return imgtool error code -*/ -static imgtoolerr_t hfs_image_open(imgtool_image *image, imgtool_stream *stream) -{ - imgtoolerr_t err; - struct mac_l2_imgref *l2_img; - img_open_buf buf_local; - img_open_buf *buf; - - l2_img = get_imgref(image); - l2_img->l1_img.image = image; - l2_img->l1_img.heads = 2; - l2_img->format = L2I_HFS; - - /* read MDB */ - err = image_read_block(&l2_img->l1_img, 2, &buf_local.raw); - if (err) - return err; - buf = &buf_local; - - /* check signature word */ - if ((buf->hfs_mdb.sigWord[0] != 0x42) || (buf->hfs_mdb.sigWord[1] != 0x44) - || (buf->hfs_mdb.VN[0] > 27)) - return IMGTOOLERR_CORRUPTIMAGE; - - l2_img->u.hfs.VBM_start = get_UINT16BE(buf->hfs_mdb.VBMSt); - - l2_img->numABs = get_UINT16BE(buf->hfs_mdb.nmAlBlks); - if (get_UINT32BE(buf->hfs_mdb.alBlkSiz) % 512) - return IMGTOOLERR_CORRUPTIMAGE; - l2_img->blocksperAB = get_UINT32BE(buf->hfs_mdb.alBlkSiz) / 512; - l2_img->u.hfs.ABStart = get_UINT16BE(buf->hfs_mdb.alBlSt); - - l2_img->nxtCNID = get_UINT32BE(buf->hfs_mdb.nxtCNID); - - l2_img->freeABs = get_UINT16BE(buf->hfs_mdb.freeABs); - - mac_strcpy(l2_img->u.hfs.volname, buf->hfs_mdb.VN); - - /* open extents and catalog BT */ - err = hfs_open_extents_file(l2_img, &buf->hfs_mdb, &l2_img->u.hfs.extents_BT.fileref); - if (err) - return err; - err = BT_open(&l2_img->u.hfs.extents_BT, hfs_extentKey_compare, TRUE); - if (err) - return err; - if ((l2_img->u.hfs.extents_BT.attributes & btha_bigKeysMask) - /*|| (l2_img->u.hfs.extents_BT.attributes & kBTVariableIndexKeysMask)*/ - || (l2_img->u.hfs.extents_BT.maxKeyLength != 7)) - { /* This is not supported by the HFS format */ - /* Variable Index keys are not supported either, but hopefully it will - not break this imgtool module if it set (though it would probably break - a real macintosh) */ - BT_close(&l2_img->u.hfs.extents_BT); - return IMGTOOLERR_CORRUPTIMAGE; - } - err = hfs_open_cat_file(l2_img, &buf->hfs_mdb, &l2_img->u.hfs.cat_BT.fileref); - if (err) - { - BT_close(&l2_img->u.hfs.extents_BT); - return err; - } - err = BT_open(&l2_img->u.hfs.cat_BT, hfs_catKey_compare, FALSE); - if (err) - { - return err; - } - if ((l2_img->u.hfs.cat_BT.attributes & btha_bigKeysMask) - /*|| (l2_img->u.hfs.cat_BT.attributes & kBTVariableIndexKeysMask)*/ - || (l2_img->u.hfs.cat_BT.maxKeyLength != 37)) - { /* This is not supported by the HFS format */ - /* Variable Index keys are not supported either, but hopefully it will - not break this imgtool module if it set (though it would probably break - a real macintosh) */ - BT_close(&l2_img->u.hfs.extents_BT); - BT_close(&l2_img->u.hfs.cat_BT); - return IMGTOOLERR_CORRUPTIMAGE; - } - - /* extract volume bitmap */ - { - int byte_len = (l2_img->numABs + 7) / 8; - int cur_byte = 0; - int cur_block = l2_img->u.hfs.VBM_start; - - while (cur_byte < byte_len) - { - /* read next block */ - err = image_read_block(&l2_img->l1_img, cur_block, buf->raw); - if (err) - return err; - cur_block++; - - /* append this block to VBM */ - memcpy(l2_img->u.hfs.VBM+cur_byte, buf->raw, 512); - cur_byte += 512; - } - } - - return IMGTOOLERR_SUCCESS; -} - -#ifdef UNUSED_FUNCTION -/* - hfs_image_close - - Close a HFS image. - - l2_img (I/O): level-2 image reference -*/ -static void hfs_image_close(struct mac_l2_imgref *l2_img) -{ - assert(l2_img->format == L2I_HFS); - - BT_close(&l2_img->u.hfs.extents_BT); - BT_close(&l2_img->u.hfs.cat_BT); -} -#endif - -/* - hfs_get_cat_record_data - - extract data from a catalog B-tree leaf record - - l2_img (I/O): level-2 image reference - rec_raw (I): pointer to record key and data, as returned by - BT_node_get_keyed_record - rec_len (I): total length of record, as returned by - BT_node_get_keyed_record - rec_key (O): set to point to record key - rec_data (O): set to point to record data - - Return imgtool error code -*/ -static imgtoolerr_t hfs_get_cat_record_data(struct mac_l2_imgref *l2_img, void *rec_raw, int rec_len, hfs_catKey **rec_key, hfs_catData **rec_data) -{ - hfs_catKey *lrec_key; - void *rec_data_raw; - hfs_catData *lrec_data; - int rec_data_len; - int min_data_size; - imgtoolerr_t err; - - - assert(l2_img->format == L2I_HFS); - - lrec_key = (hfs_catKey*)rec_raw; - /* check that key is long enough to hold it all */ - if ((lrec_key->keyLen+1) < (offsetof(hfs_catKey, cName) + lrec_key->cName[0] + 1)) - return IMGTOOLERR_CORRUPTIMAGE; - - /* get pointer to record data */ - err = BT_get_keyed_record_data(&l2_img->u.hfs.cat_BT, rec_raw, rec_len, &rec_data_raw, &rec_data_len); - if (err) - return err; - lrec_data = (hfs_catData*)rec_data_raw; - - /* extract record type */ - if (rec_data_len < 2) - return IMGTOOLERR_CORRUPTIMAGE; - - /* check that the record is large enough for its type */ - switch (get_UINT16BE(lrec_data->dataType)) - { - case hcrt_Folder: - min_data_size = sizeof(hfs_catFolderData); - break; - - case hcrt_File: - min_data_size = sizeof(hfs_catFileData); - break; - - case hcrt_FolderThread: - case hcrt_FileThread: - min_data_size = sizeof(hfs_catThreadData); - break; - - default: - /* records of unknown type can be safely ignored */ - min_data_size = 0; - break; - } - - if (rec_data_len < min_data_size) - return IMGTOOLERR_CORRUPTIMAGE; - - if (rec_key) - *rec_key = lrec_key; - if (rec_data) - *rec_data = lrec_data; - - return IMGTOOLERR_SUCCESS; -} - -/* - hfs_cat_open - - Open an enumerator on the disk catalog - - l2_img (I/O): level-2 image reference - enumerator (O): open catalog enumerator reference - - Return imgtool error code -*/ -static imgtoolerr_t hfs_cat_open(struct mac_l2_imgref *l2_img, const char *path, hfs_cat_enumerator *enumerator) -{ - imgtoolerr_t err; - UINT32 parID; - mac_str255 filename; - mac_dirent cat_info; - - assert(l2_img->format == L2I_HFS); - - /* resolve path and fetch file info from directory/catalog */ - err = mac_lookup_path(l2_img, path, &parID, filename, &cat_info, FALSE); - if (err) - return err; - if (cat_info.dataRecType != hcrt_Folder) - return IMGTOOLERR_FILENOTFOUND; - - enumerator->l2_img = l2_img; - enumerator->parID = parID; - - return BT_leaf_rec_enumerator_open(&l2_img->u.hfs.cat_BT, &enumerator->BT_enumerator); -} - -/* - hfs_cat_read - - Enumerate the disk catalog - - enumerator (I/O): open catalog enumerator reference - rec_key (O): set to point to record key - rec_data (O): set to point to record data - - Return imgtool error code -*/ -static imgtoolerr_t hfs_cat_read(hfs_cat_enumerator *enumerator, hfs_catKey **rec_key, hfs_catData **rec_data) -{ - void *rec; - int rec_len = 0; - imgtoolerr_t err; - - - *rec_key = NULL; - *rec_data = NULL; - - /* read next record */ - err = BT_leaf_rec_enumerator_read(&enumerator->BT_enumerator, &rec, &rec_len); - if (err) - return err; - - /* check EOList condition */ - if (rec == NULL) - return IMGTOOLERR_SUCCESS; - - /* extract record data */ - err = hfs_get_cat_record_data(enumerator->l2_img, rec, rec_len, rec_key, rec_data); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - -/* - hfs_cat_search - - Search the catalog for a given file - - l2_img (I/O): level-2 image reference - parID (I): CNID of file parent directory - cName (I): file name - rec_key (O): set to point to record key - rec_data (O): set to point to record data - - Return imgtool error code -*/ -static imgtoolerr_t hfs_cat_search(struct mac_l2_imgref *l2_img, UINT32 parID, const mac_str31 cName, hfs_catKey **rec_key, hfs_catData **rec_data) -{ - hfs_catKey search_key; - void *rec; - int rec_len; - imgtoolerr_t err; - - assert(l2_img->format == L2I_HFS); - - if (cName[0] > 31) - return IMGTOOLERR_UNEXPECTED; - - /* generate search key */ - search_key.keyLen = search_key.resrv1 = 0; /* these fields do not matter - to the compare function, so we - don't fill them */ - set_UINT32BE(&search_key.parID, parID); - mac_strcpy(search_key.cName, cName); - - /* search key */ - err = BT_search_leaf_rec(&l2_img->u.hfs.cat_BT, &search_key, NULL, NULL, &rec, &rec_len, TRUE, NULL); - if (err) - return err; - - /* extract record data */ - err = hfs_get_cat_record_data(l2_img, rec, rec_len, rec_key, rec_data); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - -/* - hfs_lookup_path - - Resolve a file path - - l2_img (I/O): level-2 image reference - fpath (I): file path (C string) - parID (O): set to the CNID of the file parent directory - filename (O): set to the actual name of the file, with capitalization matching - the one on the volume rather than the one in the fpath parameter (Mac - string) - cat_info (O): catalog info for this file extracted from the catalog file - (may be NULL) - - Return imgtool error code -*/ -static imgtoolerr_t hfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info) -{ - const char *element_start; - int element_len; - mac_str255 mac_element_name; - //int level; - imgtoolerr_t err; - hfs_catKey *catrec_key = NULL; - hfs_catData *catrec_data = NULL; - UINT16 dataRecType = hcrt_Folder; - - /* iterate each path element */ - element_start = fpath; - //level = 0; - *parID = 2; /* root parID is 2 */ - - while(*element_start) - { - /* find next path element */ - element_len = strlen(element_start); - /* decode path element name */ - c_to_mac_strncpy(mac_element_name, element_start, element_len); - - err = hfs_cat_search(l2_img, *parID, mac_element_name, &catrec_key, &catrec_data); - if (err) - return err; - - dataRecType = get_UINT16BE(catrec_data->dataType); - - /* regular folder/file name */ - if (dataRecType == hcrt_Folder) - *parID = get_UINT32BE(catrec_data->folder.folderID); - else if (element_start[element_len + 1]) - return IMGTOOLERR_BADFILENAME; - - /* iterate */ - element_start += element_len + 1; - } - - if (catrec_key && (dataRecType == hcrt_File)) - { - /* save ref */ - *parID = get_UINT32BE(catrec_key->parID); - mac_strcpy(filename, catrec_key->cName); - } - - if (cat_info) - { - if (catrec_data && (dataRecType == hcrt_File)) - { - cat_info->flFinderInfo = catrec_data->file.userInfo; - cat_info->flXFinderInfo = catrec_data->file.finderInfo; - cat_info->flags = catrec_data->file.flags; - cat_info->fileID = get_UINT32BE(catrec_data->file.fileID); - cat_info->dataLogicalSize = get_UINT32BE(catrec_data->file.dataLogicalSize); - cat_info->dataPhysicalSize = get_UINT32BE(catrec_data->file.dataPhysicalSize); - cat_info->rsrcLogicalSize = get_UINT32BE(catrec_data->file.rsrcLogicalSize); - cat_info->rsrcPhysicalSize = get_UINT32BE(catrec_data->file.rsrcPhysicalSize); - cat_info->createDate = get_UINT32BE(catrec_data->file.createDate); - cat_info->modifyDate = get_UINT32BE(catrec_data->file.modifyDate); - } - else - { - memset(cat_info, 0, sizeof(*cat_info)); - } - cat_info->dataRecType = dataRecType; - } - - return IMGTOOLERR_SUCCESS; -} - -/* - hfs_file_open_internal - - Open a file fork, given its catalog entry. This function should not be - called directly: call hfs_file_open instead. - - l2_img (I/O): level-2 image reference - file_rec (I): catalog entry for the file to open - mac_forkID (I): tells which fork should be opened - fileref (O): mac file reference to open - - Return imgtool error code -*/ -static imgtoolerr_t hfs_file_open_internal(struct mac_l2_imgref *l2_img, const hfs_catFileData *file_rec, mac_forkID fork, struct mac_fileref *fileref) -{ - assert(l2_img->format == L2I_HFS); - - fileref->l2_img = l2_img; - - fileref->fileID = get_UINT32BE(file_rec->fileID); - fileref->forkType = fork; - - switch (fork) - { - case data_fork: - fileref->eof = get_UINT32BE(file_rec->dataLogicalSize); - fileref->pLen = get_UINT32BE(file_rec->dataPhysicalSize); - memcpy(fileref->hfs.extents, file_rec->dataExtents, sizeof(hfs_extent_3)); - break; - - case rsrc_fork: - fileref->eof = get_UINT32BE(file_rec->rsrcLogicalSize); - fileref->pLen = get_UINT32BE(file_rec->rsrcPhysicalSize); - memcpy(fileref->hfs.extents, file_rec->rsrcExtents, sizeof(hfs_extent_3)); - break; - } - - fileref->crPs = 0; - - fileref->reload_buf = TRUE; - - return IMGTOOLERR_SUCCESS; -} - -/* - hfs_file_open - - Open a file located on a HFS volume. This function should not be called - directly: call mac_file_open instead. - - l2_img (I/O): level-2 image reference - parID (I): CNID of file parent directory - filename (I): name of the file (Mac string) - mac_forkID (I): tells which fork should be opened - fileref (O): mac file reference to open - - Return imgtool error code -*/ -static imgtoolerr_t hfs_file_open(struct mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, struct mac_fileref *fileref) -{ - hfs_catKey *catrec_key; - hfs_catData *catrec_data; - UINT16 dataRecType; - imgtoolerr_t err; - - /* lookup file in catalog */ - err = hfs_cat_search(l2_img, parID, filename, &catrec_key, &catrec_data); - if (err) - return err; - - dataRecType = get_UINT16BE(catrec_data->dataType); - - /* file expected */ - if (dataRecType != hcrt_File) - return IMGTOOLERR_BADFILENAME; - - fileref->hfs.parID = get_UINT32BE(catrec_key->parID); - mac_strcpy(fileref->hfs.filename, catrec_key->cName); - - /* open it */ - return hfs_file_open_internal(l2_img, &catrec_data->file, fork, fileref); -} - -/* - hfs_file_get_nth_block_address - - Get the disk block address of a given block in an open file on a MFS image. - Called by macintosh file code. - - fileref (I/O): open mac file reference - block_num (I): file block index - block_address (O): disk block address for the file block - - Return imgtool error code -*/ -static imgtoolerr_t hfs_file_get_nth_block_address(struct mac_fileref *fileref, UINT32 block_num, UINT32 *block_address) -{ - UINT32 AB_num; - UINT32 cur_AB; - UINT32 i; - void *cur_extents_raw; - hfs_extent *cur_extents; - int cur_extents_len; - void *extents_BT_rec; - int extents_BT_rec_len; - imgtoolerr_t err; - UINT16 AB_address; - - assert(fileref->l2_img->format == L2I_HFS); - - AB_num = block_num / fileref->l2_img->blocksperAB; - cur_AB = 0; - cur_extents = fileref->hfs.extents; - - /* first look in catalog tree extents */ - for (i=0; i<3; i++) - { - if (AB_num < cur_AB+get_UINT16BE(cur_extents[i].numABlks)) - break; - cur_AB += get_UINT16BE(cur_extents[i].numABlks); - } - if (i == 3) - { - /* extent not found: read extents record from extents BT */ - hfs_extentKey search_key; - hfs_extentKey *found_key; - - search_key.keyLength = keyLength_hfs_extentKey; - search_key.forkType = fileref->forkType; - set_UINT32BE(&search_key.fileID, fileref->fileID); - set_UINT16BE(&search_key.startBlock, AB_num); - - /* search for the record with the largest key lower than or equal to - search_key. The keys are constructed in such a way that, if a record - includes AB_num, it is that one. */ - err = BT_search_leaf_rec(&fileref->l2_img->u.hfs.extents_BT, &search_key, - NULL, NULL, &extents_BT_rec, &extents_BT_rec_len, - FALSE, NULL); - if (err) - return err; - - if (extents_BT_rec == NULL) - return IMGTOOLERR_CORRUPTIMAGE; - - found_key = (hfs_extentKey*)extents_BT_rec; - /* check that this record concerns the correct file */ - if ((found_key->forkType != fileref->forkType) - || (get_UINT32BE(found_key->fileID) != fileref->fileID)) - return IMGTOOLERR_CORRUPTIMAGE; - - /* extract start AB */ - cur_AB = get_UINT16BE(found_key->startBlock); - /* get extents pointer */ - err = BT_get_keyed_record_data(&fileref->l2_img->u.hfs.extents_BT, extents_BT_rec, extents_BT_rec_len, &cur_extents_raw, &cur_extents_len); - if (err) - return err; - if (cur_extents_len < 3*sizeof(hfs_extent)) - return IMGTOOLERR_CORRUPTIMAGE; - cur_extents = (hfs_extent*)cur_extents_raw; - - /* pick correct extent in record */ - for (i=0; i<3; i++) - { - if (AB_num < cur_AB+get_UINT16BE(cur_extents[i].numABlks)) - break; - cur_AB += get_UINT16BE(cur_extents[i].numABlks); - } - if (i == 3) - /* extent not found */ - return IMGTOOLERR_CORRUPTIMAGE; - } - - AB_address = get_UINT16BE(cur_extents[i].stABN) + (AB_num-cur_AB); - - if (AB_address >= fileref->l2_img->numABs) - return IMGTOOLERR_CORRUPTIMAGE; - - *block_address = fileref->l2_img->u.hfs.ABStart + AB_address * fileref->l2_img->blocksperAB - + block_num % fileref->l2_img->blocksperAB; - - return IMGTOOLERR_SUCCESS; -} - -#if 0 -#pragma mark - -#pragma mark B-TREE IMPLEMENTATION -#endif - -/* - B-tree (Balanced search tree) files are used by the HFS and HFS+ file - systems: the Extents and Catalog files are both B-Tree. - - Note that these B-trees are B+-trees: data is only on the leaf level, and - nodes located on the same level are also linked sequentially, which allows - fast sequenctial access to the catalog file. - - These files are normal files, except for the fact that they are not - referenced from the catalog but the MDB. They are allocated in fixed-size - records of 512 bytes (HFS). (HFS+ supports any power of two from 512 - through 32768, and uses a default of 1024 for Extents, and 4096 for both - Catalog and Attributes.) - - Nodes can contain any number of records. The nodes can be of any of four - types: header node (unique node with b-tree information, pointer to root - node and start of the node allocation bitmap), map nodes (which are created - when the node allocation bitmap outgrows the header node), index nodes - (root and branch node that enable to efficiently search the leaf nodes for - a specific key value), and leaf nodes (which hold the actual user data - records with keys and data). The first node is always a header node. - Other nodes can be of any of the 3 other type, or they can be free. -*/ - -/* - BTNodeHeader - - Header of a node record -*/ -struct BTNodeHeader -{ - UINT32BE fLink; /* (index of) next node at this level */ - UINT32BE bLink; /* (index of) previous node at this level */ - UINT8 kind; /* kind of node (leaf, index, header, map) */ - UINT8 height; /* zero for header, map; 1 for leaf, 2 through - treeDepth for index (child is one LESS than - parent, whatever IM says) */ - UINT16BE numRecords; /* number of records in this node */ - UINT16BE reserved; /* reserved; set to zero */ -}; - -/* - Constants for BTNodeHeader kind field -*/ -enum -{ - btnk_leafNode = 0xff, /* leaf nodes hold the actual user data records - with keys and data */ - btnk_indexNode = 0, /* root and branch node that enable to efficiently - search the leaf nodes for a specific key value */ - btnk_headerNode = 1, /* unique node with b-tree information, pointer to - root node and start of the node allocation - bitmap */ - btnk_mapNode = 2 /* map nodes are created when the node allocation - bitmap outgrows the header node */ -}; - -/* - BTHeaderRecord: first record of a B-tree header node (second record is - unused, and third is node allocation bitmap). -*/ -struct BTHeaderRecord -{ - UINT16BE treeDepth; /* maximum height (usually leaf nodes) */ - UINT32BE rootNode; /* node number of root node */ - UINT32BE leafRecords; /* number of leaf records in all leaf nodes */ - UINT32BE firstLeafNode; /* node number of first leaf node */ - UINT32BE lastLeafNode; /* node number of last leaf node */ - UINT16BE nodeSize; /* size of a node, in bytes */ - UINT16BE maxKeyLength; /* maximum length of data (index + leaf) record keys; - length of all index record keys if - btha_variableIndexKeysMask attribute flag is not set */ - UINT32BE totalNodes; /* total number of nodes in tree */ - UINT32BE freeNodes; /* number of unused (free) nodes in tree */ - - UINT16BE reserved1; /* unused */ - UINT32BE clumpSize; /* used in some HFS implementations? (reserved in - early HFS implementations, and in HFS Plus) */ - UINT8 btreeType; /* reserved - set to 0 */ - UINT8 reserved2; /* reserved */ - UINT32BE attributes; /* persistent attributes about the tree */ - UINT32BE reserved3[16]; /* reserved */ -}; - -static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent); - -/* - BT_open - - Open a file as a B-tree. The file must be already open as a macintosh - file. - - BTref (I/O): B-tree file handle to open (BTref->fileref must have been - open previously) - key_compare_func (I): function that compares two keys - is_extent (I): TRUE if we are opening the extent B-tree (we want to do - extra checks in this case because the extent B-Tree may include extent - records for the extent B-tree itself, and if an extent record for the - extent B-tree is located in an extent that has not been defined by - previous extent records, then we can never retreive this extent record) - - Return imgtool error code -*/ -static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void *key1, const void *key2), int is_extent) -{ - imgtoolerr_t err; - BTNodeHeader node_header; - BTHeaderRecord header_rec; - - /* seek to node 0 */ - err = mac_file_seek(&BTref->fileref, 0); - if (err) - return err; - - /* read node header */ - err = mac_file_read(&BTref->fileref, sizeof(node_header), &node_header); - if (err) - return err; - - if ((node_header.kind != btnk_headerNode) || (get_UINT16BE(node_header.numRecords) < 3) - || (node_header.height != 0)) - return IMGTOOLERR_CORRUPTIMAGE; /* right??? */ - - /* CHEESY HACK: we assume that the header record immediately follows the - node header. This is because we need to know the node length to know where - the record pointers are located, but we need to read the header record to - know the node length. */ - err = mac_file_read(&BTref->fileref, sizeof(header_rec), &header_rec); - if (err) - return err; - - BTref->nodeSize = get_UINT16BE(header_rec.nodeSize); - BTref->rootNode = get_UINT32BE(header_rec.rootNode); - BTref->firstLeafNode = get_UINT32BE(header_rec.firstLeafNode); - BTref->attributes = get_UINT32BE(header_rec.attributes); - BTref->treeDepth = get_UINT16BE(header_rec.treeDepth); - BTref->maxKeyLength = get_UINT16BE(header_rec.maxKeyLength); - - BTref->key_compare_func = key_compare_func; - - BTref->node_buf = malloc(BTref->nodeSize); - if (!BTref->node_buf) - return IMGTOOLERR_OUTOFMEMORY; - - if (BTREE_CHECKS) - { - /* optional: check integrity of B-tree */ - err = BT_check(BTref, is_extent); - if (err) - return err; - } - - return IMGTOOLERR_SUCCESS; -} - -/* - BT_close - - Close a B-tree - - BTref (I/O): open B-tree file handle -*/ -static void BT_close(mac_BTref *BTref) -{ - free(BTref->node_buf); -} - -/* - BT_read_node - - Read a node from a B-tree - - BTref (I/O): open B-tree file handle - node_ID (I): index of the node to read - expected_kind (I): kind of the node to read - expected_depth (I): depth of the node to read - dest (O): destination buffer - - Return imgtool error code -*/ -static imgtoolerr_t BT_read_node(mac_BTref *BTref, UINT32 node_ID, int expected_kind, int expected_depth, void *dest) -{ - imgtoolerr_t err; - - /* seek to node */ - err = mac_file_seek(&BTref->fileref, node_ID*BTref->nodeSize); - if (err) - return err; - - /* read it */ - err = mac_file_read(&BTref->fileref, BTref->nodeSize, dest); - if (err) - return err; - - /* check node kind and depth */ - if ((((BTNodeHeader *) dest)->kind != expected_kind) - || (((BTNodeHeader *) dest)->height != expected_depth)) - return IMGTOOLERR_CORRUPTIMAGE; - - return IMGTOOLERR_SUCCESS; -} - -/* - BT_node_get_record - - Extract a raw record from a B-tree node - - BTref (I/O): open B-tree file handle - node_buf (I): buffer with the node the record should be extracted from - recnum (I): index of record to read - rec_ptr (O): set to point to start of record (key + data) - rec_len (O): set to total length of record (key + data) - - Return imgtool error code -*/ -static imgtoolerr_t BT_node_get_record(mac_BTref *BTref, void *node_buf, unsigned recnum, void **rec_ptr, int *rec_len) -{ - UINT16 node_numRecords = get_UINT16BE(((BTNodeHeader *) node_buf)->numRecords); - UINT16 offset; - UINT16 next_offset; - - if (recnum >= node_numRecords) - return IMGTOOLERR_UNEXPECTED; - - offset = get_UINT16BE(((UINT16BE *)((UINT8 *) node_buf + BTref->nodeSize))[-recnum-1]); - next_offset = get_UINT16BE(((UINT16BE *)((UINT8 *) node_buf + BTref->nodeSize))[-recnum-2]); - - if ((offset < sizeof(BTNodeHeader)) || (offset > BTref->nodeSize-2*node_numRecords) - || (next_offset < sizeof(BTNodeHeader)) || (next_offset > BTref->nodeSize-2*node_numRecords) - || (offset & 1) || (next_offset & 1) - || (offset > next_offset)) - return IMGTOOLERR_CORRUPTIMAGE; - - *rec_ptr = (UINT8 *)node_buf + offset; - *rec_len = next_offset - offset; - - return IMGTOOLERR_SUCCESS; -} - -/* - BT_node_get_keyed_record - - Extract a keyed record from a B-tree node. Equivalent to - BT_node_get_record, only we do extra checks. - - BTref (I/O): open B-tree file handle - node_buf (I): buffer with the node the record should be extracted from - node_is_index (I): TRUE if node is index node - recnum (I): index of record to read - rec_ptr (O): set to point to start of record (key + data) - rec_len (O): set to total length of record (key + data) - - Return imgtool error code -*/ -static imgtoolerr_t BT_node_get_keyed_record(mac_BTref *BTref, void *node_buf, int node_is_index, unsigned recnum, void **rec_ptr, int *rec_len) -{ - imgtoolerr_t err; - void *lrec_ptr; - int lrec_len; - int key_len; - - /* extract record */ - err = BT_node_get_record(BTref, node_buf, recnum, &lrec_ptr, &lrec_len); - if (err) - return err; - - /* read key len */ - key_len = (BTref->attributes & btha_bigKeysMask) - ? get_UINT16BE(* (UINT16BE *)lrec_ptr) - : (* (UINT8 *)lrec_ptr); - - /* check that key fits in record */ - if ((key_len + ((BTref->attributes & btha_bigKeysMask) ? 2 : 1)) > lrec_len) - /* hurk! */ - return IMGTOOLERR_CORRUPTIMAGE; - - if (key_len > BTref->maxKeyLength) - return IMGTOOLERR_CORRUPTIMAGE; - - if (node_is_index && (! (BTref->attributes & btha_variableIndexKeysMask)) && (key_len != BTref->maxKeyLength)) - return IMGTOOLERR_CORRUPTIMAGE; - - if (rec_ptr) - *rec_ptr = lrec_ptr; - if (rec_len) - *rec_len = lrec_len; - - return IMGTOOLERR_SUCCESS; -} - -/* - BT_get_keyed_record_data - - extract data from a keyed record - - BTref (I/O): open B-tree file handle - rec_ptr (I): point to start of record (key + data) - rec_len (I): total length of record (key + data) - data_ptr (O): set to point to record data - data_len (O): set to length of record data - - Return imgtool error code -*/ -static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, int rec_len, void **data_ptr, int *data_len) -{ - int lkey_len; - int data_offset; - - /* read key len */ - lkey_len = (BTref->attributes & btha_bigKeysMask) - ? get_UINT16BE(* (UINT16BE *)rec_ptr) - : (* (UINT8 *)rec_ptr); - - /* compute offset to data record */ - data_offset = lkey_len + ((BTref->attributes & btha_bigKeysMask) ? 2 : 1); - if (data_offset > rec_len) - /* hurk! */ - return IMGTOOLERR_CORRUPTIMAGE; - /* fix alignment */ - if (data_offset & 1) - data_offset++; - - if (data_ptr) - *data_ptr = (UINT8 *)rec_ptr + data_offset; - if (data_len) - *data_len = (rec_len > data_offset) ? rec_len-data_offset : 0; - - return IMGTOOLERR_SUCCESS; -} - -/* - BT_check - - Check integrity of a complete B-tree - - BTref (I/O): open B-tree file handle - is_extent (I): TRUE if we are opening the extent B-tree (we want to do - extra checks in this case because the extent B-Tree may include extent - records for the extent B-tree itself, and if an extent record for the - extent B-tree is located in an extent that has not been defined by - previous extent records, then we can never retreive this extent record) - - Return imgtool error code -*/ -struct data_nodes_t -{ - void *buf; - UINT32 node_num; - UINT32 cur_rec; - UINT32 num_recs; -}; -static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent) -{ - UINT16 node_numRecords; - BTHeaderRecord *header_rec; - UINT8 *bitmap; - - data_nodes_t *data_nodes; - int i, j; - UINT32 cur_node, prev_node; - void *rec1, *rec2; - int rec1_len, rec2_len; - void *rec1_data; - int rec1_data_len; - UINT32 totalNodes, lastLeafNode; - UINT32 freeNodes; - int compare_result; - UINT32 map_count, map_len; - UINT32 run_len; - UINT32 run_bit_len; - UINT32 actualFreeNodes; - imgtoolerr_t err; - UINT32 maxExtentAB = 0, maxExtentNode = 0, extentEOL = 0; /* if is_extent is TRUE */ - - if (is_extent) - { - switch (BTref->fileref.l2_img->format) - { - case L2I_MFS: - /* MFS does not feature any extents B-tree! */ - return IMGTOOLERR_UNEXPECTED; - - case L2I_HFS: - maxExtentAB = 0; - for (j=0; j<3; j++) - maxExtentAB += get_UINT16BE(BTref->fileref.hfs.extents[j].numABlks); - maxExtentNode = (UINT64)maxExtentAB * 512 * BTref->fileref.l2_img->blocksperAB - / BTref->nodeSize; - extentEOL = FALSE; - break; - } - } - - /* read header node */ - if ((! is_extent) || (0 < maxExtentNode)) - err = BT_read_node(BTref, 0, btnk_headerNode, 0, BTref->node_buf); - else - err = IMGTOOLERR_CORRUPTIMAGE; - if (err) - return err; - - /* check we have enough records */ - node_numRecords = get_UINT16BE(((BTNodeHeader *) BTref->node_buf)->numRecords); - if (node_numRecords < 3) - return IMGTOOLERR_CORRUPTIMAGE; - - /* get header record */ - err = BT_node_get_record(BTref, BTref->node_buf, 0, &rec1, &rec1_len); - if (err) - return err; - header_rec = (BTHeaderRecord *)rec1; - - /* check length of header record */ - if (rec1_len < sizeof(BTHeaderRecord)) - return IMGTOOLERR_CORRUPTIMAGE; - - totalNodes = get_UINT32BE(header_rec->totalNodes); - if (totalNodes == 0) - /* we need at least one header node */ - return IMGTOOLERR_CORRUPTIMAGE; - lastLeafNode = get_UINT32BE(header_rec->lastLeafNode); - freeNodes = get_UINT32BE(header_rec->freeNodes); - - /* check file length */ - if ((BTref->nodeSize * totalNodes) > BTref->fileref.pLen) - return IMGTOOLERR_CORRUPTIMAGE; - - /* initialize for the function postlog ("bail:" tag) */ - err = IMGTOOLERR_SUCCESS; - bitmap = NULL; - data_nodes = NULL; - - /* alloc buffer for reconstructed bitmap */ - map_len = (totalNodes + 7) / 8; - bitmap = (UINT8*)malloc(map_len); - if (! bitmap) - return IMGTOOLERR_OUTOFMEMORY; - memset(bitmap, 0, map_len); - - /* check B-tree data nodes (i.e. index and leaf nodes) */ - if (BTref->treeDepth == 0) - { - /* B-tree is empty */ - if (BTref->rootNode || BTref->firstLeafNode || lastLeafNode) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto bail; - } - } - else - { - /* alloc array of buffers for catalog data nodes */ - data_nodes = (data_nodes_t *)malloc(sizeof(data_nodes_t) * BTref->treeDepth); - if (! data_nodes) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto bail; - } - for (i=0; itreeDepth; i++) - data_nodes[i].buf = NULL; /* required for function postlog to work should next loop fail */ - for (i=0; itreeDepth; i++) - { - data_nodes[i].buf = malloc(BTref->nodeSize); - if (!data_nodes[i].buf) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto bail; - } - } - - /* read first data nodes */ - cur_node = BTref->rootNode; - for (i=BTref->treeDepth-1; i>=0; i--) - { - /* check node index */ - if (cur_node >= totalNodes) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - /* check that node has not been used for another purpose */ - /* this check is unecessary because the current consistency checks - that forward and back linking match and that node height is correct - are enough to detect such errors */ -#if 0 - if (bitmap[cur_node >> 3] & (0x80 >> (cur_node & 7))) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } -#endif - /* add node in bitmap */ - bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7)); - /* read node */ - if ((! is_extent) || (cur_node < maxExtentNode)) - err = BT_read_node(BTref, cur_node, i ? btnk_indexNode : btnk_leafNode, i+1, data_nodes[i].buf); - else - err = IMGTOOLERR_CORRUPTIMAGE; - if (err) - goto bail; - /* check that it is the first node at this level */ - if (get_UINT32BE(((BTNodeHeader *) data_nodes[i].buf)->bLink)) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - /* fill other fields */ - data_nodes[i].node_num = cur_node; - data_nodes[i].cur_rec = 0; - data_nodes[i].num_recs = get_UINT16BE(((BTNodeHeader *) data_nodes[i].buf)->numRecords); - /* check that there is at least one record */ - if (data_nodes[i].num_recs == 0) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - - /* iterate to next level if applicable */ - if (i != 0) - { - /* extract first record */ - err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, TRUE, 0, &rec1, &rec1_len); - if (err) - goto bail; - - /* extract record data ptr */ - err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len); - if (err) - goto bail; - if (rec1_data_len < sizeof(UINT32BE)) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - - /* iterate to next level */ - cur_node = get_UINT32BE(* (UINT32BE *)rec1_data); - } - } - - /* check that a) the root node has no successor, and b) that we have really - read the first leaf node */ - if (get_UINT32BE(((BTNodeHeader *) data_nodes[BTref->treeDepth-1].buf)->fLink) - || (cur_node != BTref->firstLeafNode)) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - - /* check that keys are ordered correctly */ - while (1) - { - /* iterate through parent nodes */ - i = 0; - while ((itreeDepth) && ((data_nodes[i].cur_rec == 0) || (data_nodes[i].cur_rec == data_nodes[i].num_recs))) - { - /* read next node if necessary */ - if (data_nodes[i].cur_rec == data_nodes[i].num_recs) - { - /* get link to next node */ - cur_node = get_UINT32BE(((BTNodeHeader *) data_nodes[i].buf)->fLink); - if (cur_node == 0) - { - if (i == 0) - /* normal End of List */ - goto end_of_list; - else - { - /* error */ - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - } - /* add node in bitmap */ - bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7)); - /* read node */ - if ((! is_extent) || (cur_node < maxExtentNode)) - err = BT_read_node(BTref, cur_node, i ? btnk_indexNode : btnk_leafNode, i+1, data_nodes[i].buf); - else - err = IMGTOOLERR_CORRUPTIMAGE; - if (err) - goto bail; - /* check that backward linking match forward linking */ - if (get_UINT32BE(((BTNodeHeader *) data_nodes[i].buf)->bLink) != data_nodes[i].node_num) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - /* fill other fields */ - data_nodes[i].node_num = cur_node; - data_nodes[i].cur_rec = 0; - data_nodes[i].num_recs = get_UINT16BE(((BTNodeHeader *) data_nodes[i].buf)->numRecords); - /* check that there is at least one record */ - if (data_nodes[i].num_recs == 0) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - /* next test is not necessary because we have checked that - the root node has no successor */ -#if 0 - if (i < BTref->treeDepth-1) - { -#endif - data_nodes[i+1].cur_rec++; -#if 0 - } - else - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } -#endif - } - i++; - } - - if (is_extent && !extentEOL) - { - /* extract current leaf record and update maxExtentAB and - maxExtentNode */ - hfs_extentKey *extentKey; - hfs_extent *extentData; - - /* extract current leaf record */ - err = BT_node_get_keyed_record(BTref, data_nodes[0].buf, FALSE, data_nodes[0].cur_rec, &rec1, &rec1_len); - if (err) - goto bail; - - extentKey = (hfs_extentKey*)rec1; - if ((extentKey->keyLength < 7) || (extentKey->forkType != 0) || (get_UINT32BE(extentKey->fileID) != 3) - || (get_UINT16BE(extentKey->startBlock) != maxExtentAB)) - /* the key is corrupt or does not concern the extent - B-tree: set the extentEOL flag so that we stop looking for - further extent records for the extent B-tree */ - extentEOL = TRUE; - else - { /* this key concerns the extent B-tree: update maxExtentAB - and maxExtentNode */ - /* extract record data ptr */ - err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len); - if (err) - goto bail; - if (rec1_data_len < sizeof(hfs_extent)*3) - /* the record is corrupt: set the extentEOL flag so - that we stop looking for further extent records for the - extent B-tree */ - extentEOL = TRUE; - else - { - extentData = (hfs_extent*)rec1_data; - - for (j=0; j<3; j++) - maxExtentAB += get_UINT16BE(extentData[j].numABlks); - maxExtentNode = (UINT64)maxExtentAB * 512 * BTref->fileref.l2_img->blocksperAB - / BTref->nodeSize; - } - } - if (extentEOL) - { - /* check that the extent B-Tree has been defined entirely */ - if (maxExtentNode < totalNodes) - { /* no good */ - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - } - } - - if (itreeDepth) - { - /* extract current record */ - err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, i > 0, data_nodes[i].cur_rec, &rec1, &rec1_len); - if (err) - goto bail; - - /* extract previous record */ - err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, i > 0, data_nodes[i].cur_rec-1, &rec2, &rec2_len); - if (err) - goto bail; - - /* check that it is sorted correctly */ - compare_result = (*BTref->key_compare_func)(rec1, rec2); - if (compare_result <= 0) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - - i--; - } - else - { - i--; - if (i>0) - { /* extract first record of root if it is an index node */ - err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, TRUE, data_nodes[i].cur_rec, &rec1, &rec1_len); - if (err) - goto bail; - } - i--; - } - - while (i>=0) - { - /* extract first record of current level */ - err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, i > 0, data_nodes[i].cur_rec, &rec2, &rec2_len); - if (err) - goto bail; - - /* compare key with key of current record of upper level */ - compare_result = (*BTref->key_compare_func)(rec1, rec2); - if (compare_result != 0) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - - /* extract record data ptr */ - err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len); - if (err) - goto bail; - if (rec1_data_len < sizeof(UINT32BE)) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - cur_node = get_UINT32BE(* (UINT32BE *)rec1_data); - - /* compare node index with data of current record of upper - level */ - if (cur_node != data_nodes[i].node_num) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - - /* iterate to next level */ - rec1 = rec2; - rec1_len = rec2_len; - i--; - } - - /* next leaf record */ - data_nodes[0].cur_rec++; - } - -end_of_list: - /* check that we are at the end of list for each index level */ - for (i=1; itreeDepth; i++) - { - if ((data_nodes[i].cur_rec != (data_nodes[i].num_recs-1)) - || get_UINT32BE(((BTNodeHeader *) data_nodes[i].buf)->fLink)) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - } - /* check that the last leaf node is what it is expected to be */ - if (data_nodes[0].node_num != lastLeafNode) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - } - - /* check map node chain */ - cur_node = 0; /* node 0 is the header node... */ - bitmap[0] |= 0x80; - /* check back linking */ - if (get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->bLink)) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - /* get pointer to next node */ - cur_node = get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->fLink); - while (cur_node != 0) - { - /* save node address */ - prev_node = cur_node; - /* check that node has not been used for another purpose */ - /* this check is unecessary because the current consistency checks that - forward and back linking match and that node height is correct are - enough to detect such errors */ -#if 0 - if (bitmap[cur_node >> 3] & (0x80 >> (cur_node & 7))) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } -#endif - /* add node in bitmap */ - bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7)); - /* read map node */ - if ((! is_extent) || (cur_node < maxExtentNode)) - err = BT_read_node(BTref, cur_node, btnk_mapNode, 0, BTref->node_buf); - else - err = IMGTOOLERR_CORRUPTIMAGE; - if (err) - goto bail; - /* check back linking */ - if (get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->bLink) != prev_node) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - /* get pointer to next node */ - cur_node = get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->fLink); - } - - /* re-read header node */ - err = BT_read_node(BTref, 0, btnk_headerNode, 0, BTref->node_buf); - if (err) - goto bail; - - /* get header bitmap record */ - err = BT_node_get_record(BTref, BTref->node_buf, 2, &rec1, &rec1_len); - if (err) - goto bail; - - /* check bitmap, iterating map nodes */ - map_count = 0; - actualFreeNodes = 0; - while (map_count < map_len) - { - /* compute compare len */ - run_len = rec1_len; - if (run_len > (map_len-map_count)) - run_len = map_len-map_count; - /* check that all used nodes are marked as such in the B-tree bitmap */ - for (i=0; i (totalNodes-map_count*8)) - run_bit_len = totalNodes-map_count*8; - for (i=0; i>3] & (0x80 >> (i & 7)))) - actualFreeNodes++; - map_count += run_len; - /* read next map node if required */ - if (map_count < map_len) - { - /* get pointer to next node */ - cur_node = get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->fLink); - if (cur_node == 0) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto bail; - } - /* read map node */ - err = BT_read_node(BTref, cur_node, btnk_mapNode, 0, BTref->node_buf); - if (err) - goto bail; - /* get map record */ - err = BT_node_get_record(BTref, BTref->node_buf, 0, &rec1, &rec1_len); - if (err) - goto bail; - header_rec = (BTHeaderRecord *)rec1; - } - } - - /* check free node count */ - if (freeNodes != actualFreeNodes) - return IMGTOOLERR_CORRUPTIMAGE; - -bail: - /* free buffers */ - if (data_nodes) - { - for (i=0; itreeDepth; i++) - if (data_nodes[i].buf) - free(data_nodes[i].buf); - free(data_nodes); - } - if (bitmap) - free(bitmap); - - return err; -} - -/* - BT_search_leaf_rec - - Search for a given key in a B-Tree. If exact match found, returns - corresponding leaf record. Otherwise, may return the greatest record less - than the requested key (of course, this will fail if the key is lower than - all keys in the B-Tree). - - BTref (I/O): open B-tree file handle - search_key (I): key to search the B-Tree for - node_ID (O): set to the node ID of the node the record is located in (may - be NULL) - record_ID (O): set to the index of the record in the node (may be NULL) - record_ptr (O): set to point to record in node buffer (may be NULL) - record_len (O): set to total record len (may be NULL) - search_exact_match (I): if TRUE, the function will search for a record - equal to search_key; if FALSE, the function will search for the - greatest record less than or equal to search_key - match_found (O): set to TRUE if an exact match for search_key has been - found (only makes sense if search_exact_match is FALSE) (may be NULL) - - Return imgtool error code -*/ -static imgtoolerr_t BT_search_leaf_rec(mac_BTref *BTref, const void *search_key, - UINT32 *node_ID, int *record_ID, - void **record_ptr, int *record_len, - int search_exact_match, int *match_found) -{ - imgtoolerr_t err; - int i; - UINT32 cur_node; - void *cur_rec; - int cur_rec_len; - void *last_rec; - int last_rec_len = 0; - void *rec_data; - int rec_data_len; - int depth; - UINT16 node_numRecords; - int compare_result = 0; - - /* start with root node */ - if ((BTref->rootNode == 0) || (BTref->treeDepth == 0)) - /* tree is empty */ - return ((BTref->rootNode == 0) == (BTref->treeDepth == 0)) - ? IMGTOOLERR_FILENOTFOUND - : IMGTOOLERR_CORRUPTIMAGE; - - cur_node = BTref->rootNode; - depth = BTref->treeDepth; - - while (1) - { - /* read current node */ - err = BT_read_node(BTref, cur_node, (depth > 1) ? btnk_indexNode : btnk_leafNode, depth, BTref->node_buf); - if (err) - return err; - - /* search for key */ - node_numRecords = get_UINT16BE(((BTNodeHeader *) BTref->node_buf)->numRecords); - last_rec = cur_rec = NULL; - for (i=0; inode_buf, depth > 1, i, &cur_rec, &cur_rec_len); - if (err) - return err; - - compare_result = (*BTref->key_compare_func)(cur_rec, search_key); - if (compare_result > 0) - break; - last_rec = cur_rec; - last_rec_len = cur_rec_len; - if (compare_result == 0) - break; - } - - if (! last_rec) - { /* all keys are greater than the search key: the search key is - nowhere in the tree */ - if (search_exact_match) - return IMGTOOLERR_FILENOTFOUND; - - if (match_found) - *match_found = FALSE; - - if (node_ID) - *node_ID = 0; - - if (record_ID) - *record_ID = -1; - - if (record_ptr) - *record_ptr = NULL; - - return IMGTOOLERR_SUCCESS; - } - - if (((BTNodeHeader *) BTref->node_buf)->kind == btnk_leafNode) - /* leaf node -> end of search */ - break; - - /* extract record data ptr */ - err = BT_get_keyed_record_data(BTref, last_rec, last_rec_len, &rec_data, &rec_data_len); - if (err) - return err; - if (rec_data_len < sizeof(UINT32BE)) - return IMGTOOLERR_CORRUPTIMAGE; - - /* iterate to next level */ - cur_node = get_UINT32BE(* (UINT32BE *)rec_data); - depth--; - } - - if (compare_result != 0) - /* key not found */ - if (search_exact_match) - return IMGTOOLERR_FILENOTFOUND; - - if (match_found) - *match_found = (compare_result == 0); - - if (node_ID) - *node_ID = cur_node; - - if (record_ID) - *record_ID = i; - - if (record_ptr) - *record_ptr = last_rec; - - if (record_len) - *record_len = last_rec_len; - - return IMGTOOLERR_SUCCESS; -} - -/* - BT_leaf_rec_enumerator_open - - Open enumerator for leaf records of a B-Tree - - BTref (I/O): open B-tree file handle - enumerator (O): B-Tree enumerator to open - - Return imgtool error code -*/ -static imgtoolerr_t BT_leaf_rec_enumerator_open(mac_BTref *BTref, BT_leaf_rec_enumerator *enumerator) -{ - enumerator->BTref = BTref; - enumerator->cur_node = BTref->firstLeafNode; - enumerator->cur_rec = 0; - - return IMGTOOLERR_SUCCESS; -} - -/* - BT_leaf_rec_enumerator_read - - Read next leaf record of a B-Tree - - enumerator (I/O): open B-Tree enumerator - - Return imgtool error code -*/ -static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerator, void **record_ptr, int *rec_len) -{ - UINT16 node_numRecords; - imgtoolerr_t err; - - - *record_ptr = NULL; - - /* check EOList condition */ - if (enumerator->cur_node == 0) - return IMGTOOLERR_SUCCESS; - - /* read current node */ - err = BT_read_node(enumerator->BTref, enumerator->cur_node, btnk_leafNode, 1, enumerator->BTref->node_buf); - if (err) - return err; - node_numRecords = get_UINT16BE(((BTNodeHeader *) enumerator->BTref->node_buf)->numRecords); - - /* skip nodes until we find a record */ - while ((enumerator->cur_rec >= node_numRecords) && (enumerator->cur_node != 0)) - { - enumerator->cur_node = get_UINT32BE(((BTNodeHeader *) enumerator->BTref->node_buf)->fLink); - enumerator->cur_rec = 0; - - /* read node */ - err = BT_read_node(enumerator->BTref, enumerator->cur_node, btnk_leafNode, 1, enumerator->BTref->node_buf); - if (err) - return err; - node_numRecords = get_UINT16BE(((BTNodeHeader *) enumerator->BTref->node_buf)->numRecords); - } - - /* check EOList condition */ - if (enumerator->cur_node == 0) - return IMGTOOLERR_SUCCESS; - - /* get current record */ - err = BT_node_get_keyed_record(enumerator->BTref, enumerator->BTref->node_buf, FALSE, enumerator->cur_rec, record_ptr, rec_len); - if (err) - return err; - - /* iterate to next record */ - enumerator->cur_rec++; - if (enumerator->cur_rec >= node_numRecords) - { /* iterate to next node if last record (not required, but will improve - performance on next iteration) */ - enumerator->cur_node = get_UINT32BE(((BTNodeHeader *) enumerator->BTref->node_buf)->fLink); - enumerator->cur_rec = 0; - } - return IMGTOOLERR_SUCCESS; -} - -/* - B-Tree extend EOF algorithm: - * see if the bitmap will need to be extended - * extend EOF by min 1 (if bitmap is large engough) or 2 (if bitmap needs - to be extended) and max ClumpSiz (see extClpSiz and ctClpSiz in MDB) - ***If we are extending the extent B-Tree, we need to defer the possible - creation of an additional extent record, or we might enter an endless - recursion loop*** - - Empty node alloc algorithm: - - * see if there is any free node in B-tree bitmap - * optionally, try to compact the B-tree if file is full - * if file is still full, extend EOF and try again - * mark new block as used and return its index - - - Empty node delete algorithm: - - * remove node from link list - * mark node as free in the B-tree bitmap - * optionally, if more than N% of the B-tree is free, compact the B-tree and - free some disk space - * Count nodes on this level; if there is only one left, delete parent index - node and mark the relaining node as root; if it was the last leaf node, - update header node with an empty B-tree; in either case, decrement tree - depth - - - Record shifting algorithm: - - For a given node and its first non-empty successor node: - - * compute how much free room there is in the node - * see if the first record of the first non-empty successor can fit - * if so, move it (i.e. delete the first record of the later node, and add a - copy of it to the end of the former) - - - Node merging algorithm - - * Consider node and its predecessor. If there is room, shift all records - from later to former, then delete empty later node, and delete later - record from parent index node. - - - Node splitting algorithm (non-first) - - * Consider node and its predecessor. Create new middle node and split - records in 3 even sets. Update record for last node and insert record - for middle node in parent index node. - - - Node splitting algorithm (first node) - - * Create new successor node, and split records in 2 1/3 and 2/3 sets. - Insert record for later node in parent index node. - - - Record delete algorithm: - - * remove record from node - * if record was first in node, test if node is now empty - * if node is not empty, substitute key of deleted record with key of - new head record in index tree - * if node is empty, delete key of deleted record in index tree, then - delete empty node - * optionally, look the predecessor node. Merge the two nodes if possible. - - - Record insert algorithm: - - * if there room, just insert new record in node; if new record is in first - position, update record in parent index node - * else consider predecessor: see if we can make enough room by shifting - records. If so, do shift records, insert new record, update record in - parent index node - * else split the nodes and insert record -*/ -/* - Possible additions: - - Node compaction algorithm: - - This algorithm can be executed with a specific start point and max number - of nodes, or with all nodes on a level. - - * see how many nodes we can save by shifting records left - * if we will save at least one node, do shift as many records as possible - (try to leave free space split homogeneously???) -*/ - -/*static void*/ - -#if 0 -#pragma mark - -#pragma mark RESOURCE IMPLEMENTATION -#endif - -/* - Resource manager - - The resource manager stores arbitrary chunks of data (resource) identified - by a type/id pair. The resource type is a 4-char code, which generally - implies the format of the data (e.g. 'PICT' is for a quickdraw picture, - 'STR ' for a macintosh string, 'CODE' for 68k machine code, etc). The - resource id is a signed 16-bit number that uniquely identifies each - resource of a given type. Note that, with most resource types, resources - with id < 128 are system resources that are available to all applications, - whereas resources with id >= 128 are application resources visible only to - the application that defines them. - - Each resource can optionally have a resource name, which is a macintosh - string of 255 chars at most. - - Limits: - 16MBytes of data - 64kbytes of type+reference lists - 64kbytes of resource names - - The Macintosh toolbox can open several resource files simulteanously to - overcome these restrictions. - - Resources are used virtually everywhere in the Macintosh Toolbox, so it is - no surprise that file comments and MFS folders are stored in resource files. -*/ - -/* - Resource header -*/ -struct rsrc_header -{ - UINT32BE data_offs; /* Offset from beginning of resource fork to resource data */ - UINT32BE map_offs; /* Offset from beginning of resource fork to resource map */ - UINT32BE data_len; /* Length of resource data */ - UINT32BE map_len; /* Length of resource map */ -}; - -/* - Resource data: each data entry is preceded by its len (UINT32BE) - Offset to specific data fields are gotten from the resource map -*/ - -/* - Resource map: -*/ -struct rsrc_map_header -{ - rsrc_header reserved0; /* Reserved for copy of resource header */ - UINT32BE reserved1; /* Reserved for handle to next resource map */ - UINT16BE reserved2; /* Reserved for file reference number */ - - UINT16BE attr; /* Resource fork attributes */ - UINT16BE typelist_offs; /* Offset from beginning of map to resource type list */ - UINT16BE namelist_offs; /* Offset from beginning of map to resource name list */ - UINT16BE type_count; /* Number of types in the map minus 1 */ - /* This is actually part of the type list, which matters for offsets */ -}; - -/* - Resource type list entry -*/ -struct rsrc_type_entry -{ - UINT32BE type; /* Resource type */ - UINT16BE ref_count; /* Number of resources of this type in map minus 1 */ - UINT16BE ref_offs; /* Offset from beginning of resource type list to reference list for this type */ -}; - -/* - Resource reference list entry -*/ -struct rsrc_ref_entry -{ - UINT16BE id; /* Resource ID */ - UINT16BE name_offs; /* Offset from beginning of resource name list to resource name */ - /* (-1 if none) */ - UINT8 attr; /* Resource attributes */ - UINT24BE data_offs; /* Offset from beginning of resource data to data for this resource */ - UINT32BE reserved; /* Reserved for handle to resource */ -}; - -/* - Resource name list entry: this is just a standard macintosh string -*/ - -struct mac_resfileref -{ - mac_fileref fileref; /* open resource fork ref (you may open resources - files in data fork, too, if you ever need to, - but Classic MacOS never does such a thing - (MacOS X often does so, though)) */ - UINT32 data_offs; /* Offset from beginning of resource file to resource data */ - UINT32 map_offs; /* Offset from beginning of resource file to resource data */ - - UINT16 typelist_offs; /* Offset from beginning of map to resource type list */ - UINT16 namelist_offs; /* Offset from beginning of map to resource name list */ - UINT16 type_count; /* Number of types in the map minus 1 */ - /* This is actually part of the type list, which matters for offsets */ -}; - -#ifdef UNUSED_FUNCTION -/* - resfile_open - - Open a file as a resource file. The file must be already open as a - macintosh file. - - resfileref (I/O): resource file handle to open (resfileref->fileref must - have been opened previously) - - Return imgtool error code -*/ -static imgtoolerr_t resfile_open(mac_resfileref *resfileref) -{ - imgtoolerr_t err; - rsrc_header header; - rsrc_map_header map_header; - - /* seek to resource header */ - err = mac_file_seek(&resfileref->fileref, 0); - if (err) - return err; - - err = mac_file_read(&resfileref->fileref, sizeof(header), &header); - if (err) - return err; - - resfileref->data_offs = get_UINT32BE(header.data_offs); - resfileref->map_offs = get_UINT32BE(header.map_offs); - - /* seek to resource map header */ - err = mac_file_seek(&resfileref->fileref, resfileref->map_offs); - if (err) - return err; - - err = mac_file_read(&resfileref->fileref, sizeof(map_header), &map_header); - if (err) - return err; - - resfileref->typelist_offs = get_UINT16BE(map_header.typelist_offs); - resfileref->namelist_offs = get_UINT16BE(map_header.namelist_offs); - resfileref->type_count = get_UINT16BE(map_header.type_count); - - return IMGTOOLERR_SUCCESS; -} - -/* - resfile_get_entry - - Get the resource entry in the resource map associated with a given type/id - pair. - - resfileref (I/O): open resource file handle - type (I): type of the resource - id (I): id of the resource - entry (O): resource entry that has been read - - Return imgtool error code -*/ -static imgtoolerr_t resfile_get_entry(mac_resfileref *resfileref, UINT32 type, UINT16 id, rsrc_ref_entry *entry) -{ - imgtoolerr_t err; - rsrc_type_entry type_entry; - UINT16 ref_count; - int i; - - /* seek to resource type list in resource map */ - err = mac_file_seek(&resfileref->fileref, resfileref->map_offs+resfileref->typelist_offs+2); - if (err) - return err; - - if (resfileref->type_count == 0xffff) - /* type list is empty */ - return IMGTOOLERR_FILENOTFOUND; - - for (i=0; i<=resfileref->type_count; i++) - { - err = mac_file_read(&resfileref->fileref, sizeof(type_entry), &type_entry); - if (err) - return err; - if (type == get_UINT32BE(type_entry.type)) - break; - } - if (i > resfileref->type_count) - /* type not found in list */ - return IMGTOOLERR_FILENOTFOUND; - - ref_count = get_UINT16BE(type_entry.ref_count); - - /* seek to resource ref list for this type in resource map */ - err = mac_file_seek(&resfileref->fileref, resfileref->map_offs+resfileref->typelist_offs+get_UINT16BE(type_entry.ref_offs)); - if (err) - return err; - - if (ref_count == 0xffff) - /* ref list is empty */ - return IMGTOOLERR_FILENOTFOUND; - - for (i=0; i<=ref_count; i++) - { - err = mac_file_read(&resfileref->fileref, sizeof(*entry), entry); - if (err) - return err; - if (id == get_UINT16BE(entry->id)) - break; - } - if (i > ref_count) - /* id not found in list */ - return IMGTOOLERR_FILENOTFOUND; - - /* type+id have been found... */ - return IMGTOOLERR_SUCCESS; -} - -/* - resfile_get_resname - - Get the name of a resource. - - resfileref (I/O): open resource file handle - entry (I): resource entry in the resource map (returned by - resfile_get_entry) - string (O): resource name - - Return imgtool error code -*/ -static imgtoolerr_t resfile_get_resname(mac_resfileref *resfileref, const rsrc_ref_entry *entry, mac_str255 string) -{ - imgtoolerr_t err; - UINT16 name_offs; - UINT8 len; - - name_offs = get_UINT16BE(entry->name_offs); - - if (name_offs == 0xffff) - /* ref list is empty */ - return IMGTOOLERR_UNEXPECTED; - - /* seek to resource name in name list in resource map */ - err = mac_file_seek(&resfileref->fileref, resfileref->map_offs+name_offs); - if (err) - return err; - - /* get string length */ - err = mac_file_read(&resfileref->fileref, 1, &len); - if (err) - return err; - - string[0] = len; - - /* get string data */ - err = mac_file_read(&resfileref->fileref, len, string+1); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - -/* - resfile_get_reslen - - Get the data length for a given resource. - - resfileref (I/O): open resource file handle - entry (I): resource entry in the resource map (returned by - resfile_get_entry) - len (O): resource length - - Return imgtool error code -*/ -static imgtoolerr_t resfile_get_reslen(mac_resfileref *resfileref, const rsrc_ref_entry *entry, UINT32 *len) -{ - imgtoolerr_t err; - UINT32 data_offs; - UINT32BE llen; - - data_offs = get_UINT24BE(entry->data_offs); - - /* seek to resource data in resource data section */ - err = mac_file_seek(&resfileref->fileref, resfileref->data_offs+data_offs); - if (err) - return err; - - /* get data length */ - err = mac_file_read(&resfileref->fileref, sizeof(llen), &llen); - if (err) - return err; - - *len = get_UINT32BE(llen); - - return IMGTOOLERR_SUCCESS; -} - -/* - resfile_get_resdata - - Get the data for a given resource. - - resfileref (I/O): open resource file handle - entry (I): resource entry in the resource map (returned by - resfile_get_entry) - offset (I): offset the data should be read from, usually 0 - len (I): length of the data to read, usually the value returned by - resfile_get_reslen - dest (O): resource data - - Return imgtool error code -*/ -static imgtoolerr_t resfile_get_resdata(mac_resfileref *resfileref, const rsrc_ref_entry *entry, UINT32 offset, UINT32 len, void *dest) -{ - imgtoolerr_t err; - UINT32 data_offs; - UINT32BE llen; - - data_offs = get_UINT24BE(entry->data_offs); - - /* seek to resource data in resource data section */ - err = mac_file_seek(&resfileref->fileref, resfileref->data_offs+data_offs); - if (err) - return err; - - /* get data length */ - err = mac_file_read(&resfileref->fileref, sizeof(llen), &llen); - if (err) - return err; - - /* check that we do not ask to read more data than avalaible */ - if ((offset + len) > get_UINT32BE(llen)) - return IMGTOOLERR_UNEXPECTED; - - if (offset) - { /* seek to resource data offset in resource data section */ - err = mac_file_seek(&resfileref->fileref, resfileref->data_offs+data_offs+4+offset); - if (err) - return err; - } - - /* get data */ - err = mac_file_read(&resfileref->fileref, len, dest); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} -#endif - -#if 0 -#pragma mark - -#pragma mark DESKTOP FILE IMPLEMENTATION -#endif -/* - All macintosh volumes have information stored in the desktop file or the - desktop database. - - Such information include file comments, copy of BNDL and FREF resources - that describes supported file types for each application on the volume, - copy of icons for each file type registered by each application on the - volume, etc. On MFS volumes, the list of folders is stored in the desktop - file as well. - - - There have been two implementations of the desktop metadata: - - * The original desktop file. The database is stored in the resource fork - of a (usually invisible) file called "Desktop" (case may change - according to system versions), located at the root of the volume. The - desktop file is used by System 6 and earlier for all volumes (unless - Appleshare 2 is installed and the volume is shared IIRC), and by System - 7 and later for volumes smaller than 2MBytes (so that floppy disks - remain fully compatible with earlier versions of system). The desktop - file is incompletely documented by Apple technote TB06. - - * The desktop database. The database is stored in the resource fork is - stored in the data fork of two (usually invisible) files called - "Desktop DF" and "Desktop DF". The desktop database is used for - volumes shared by Appleshare 2, and for most volumes under System 7 and - later. The format of these file is not documented AFAIK. - - - The reasons for the introduction of the desktop database were: - * the macintosh resource manager cannot share resource files, which was - a problem for Appleshare - * the macintosh resource manager is pretty limited (+/-16MByte of data and - 2727 resources at most), which was a problem for large hard disks with - many programs/comments -*/ - -#ifdef UNUSED_FUNCTION -/* - get_comment - - Get a comment from the Desktop file - - l2_img (I): macintosh image the data should be read from - id (I): comment id (from mfs_hashString(), or HFS FXInfo/DXInfo records) - comment (O): comment that has been read - - Return imgtool error code -*/ -static imgtoolerr_t get_comment(struct mac_l2_imgref *l2_img, UINT16 id, mac_str255 comment) -{ - static const UINT8 desktop_fname[] = {'\7','D','e','s','k','t','o','p'}; - #define restype_FCMT (('F' << 24) | ('C' << 16) | ('M' << 8) | 'T') - mac_resfileref resfileref; - rsrc_ref_entry resentry; - UINT32 reslen; - imgtoolerr_t err; - - /* open rsrc fork of file Desktop in root directory */ - err = mac_file_open(l2_img, 2, desktop_fname, rsrc_fork, &resfileref.fileref); - if (err) - return err; - - /* open resource structures */ - err = resfile_open(&resfileref); - if (err) - return err; - - /* look for resource FCMT #id */ - err = resfile_get_entry(&resfileref, restype_FCMT, id, &resentry); - if (err) - return err; - - /* extract comment len */ - err = resfile_get_reslen(&resfileref, &resentry, &reslen); - if (err) - return err; - - /* check comment len */ - if (reslen > 256) - /* hurk */ - /*return IMGTOOLERR_CORRUPTIMAGE;*/ - /* people willing to extend the MFM comment field (you know, the kind - of masochists that try to support 20-year-old OSes) might append extra - fields, so we just truncate the resource */ - reslen = 256; - - /* extract comment data */ - err = resfile_get_resdata(&resfileref, &resentry, 0, reslen, comment); - if (err) - return err; - - /* phew, we are done! */ - return IMGTOOLERR_SUCCESS; -} -#endif - -#if 0 -#pragma mark - -#pragma mark IMGTOOL MODULE IMPLEMENTATION -#endif - -#ifdef UNUSED_FUNCTION -static void mac_image_exit(imgtool_image *img); -#endif -static void mac_image_info(imgtool_image *img, char *string, size_t len); -static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path); -static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); -static imgtoolerr_t mac_image_freespace(imgtool_partition *partition, UINT64 *size); -static imgtoolerr_t mac_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf); -static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions); - -#ifdef UNUSED_FUNCTION -/* - close a mfs/hfs image -*/ -static void mac_image_exit(imgtool_image *img) -{ - struct mac_l2_imgref *image = get_imgref(img); - - mac_image_close(image); -} -#endif - -/* - get basic information on a mfs/hfs image - - Currently returns the volume name -*/ -static void mac_image_info(imgtool_image *img, char *string, size_t len) -{ - struct mac_l2_imgref *image = get_imgref(img); - - switch (image->format) - { - case L2I_MFS: - mac_to_c_strncpy(string, len, image->u.mfs.volname); - break; - - case L2I_HFS: - mac_to_c_strncpy(string, len, image->u.hfs.volname); - break; - } -} - -/* - MFS/HFS catalog iterator, used when imgtool reads the catalog -*/ -struct mac_iterator -{ - mac_format format; - struct mac_l2_imgref *l2_img; - union - { - struct - { - mfs_dirref dirref; /* open directory reference */ - } mfs; - struct - { - hfs_cat_enumerator catref; /* catalog file enumerator */ - } hfs; - } u; -}; - -/* - Open the disk catalog for enumeration -*/ -static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path) -{ - struct mac_l2_imgref *image = get_imgref(imgtool_directory_image(enumeration)); - mac_iterator *iter = (mac_iterator *) imgtool_directory_extrabytes(enumeration); - imgtoolerr_t err = IMGTOOLERR_UNEXPECTED; - - iter->format = image->format; - iter->l2_img = image; - - switch (iter->format) - { - case L2I_MFS: - err = mfs_dir_open(image, path, &iter->u.mfs.dirref); - break; - - case L2I_HFS: - err = hfs_cat_open(image, path, &iter->u.hfs.catref); - break; - } - - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - -/* - Enumerate disk catalog next entry (MFS) -*/ -static imgtoolerr_t mfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent) -{ - mfs_dir_entry *cur_dir_entry; - imgtoolerr_t err; - - - assert(iter->format == L2I_MFS); - - ent->corrupt = 0; - ent->eof = 0; - - err = mfs_dir_read(&iter->u.mfs.dirref, &cur_dir_entry); - if (err) - { - /* error */ - ent->corrupt = 1; - return err; - } - else if (!cur_dir_entry) - { - /* EOF */ - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - - /* copy info */ - mac_to_c_strncpy(ent->filename, ARRAY_LENGTH(ent->filename), cur_dir_entry->name); - ent->filesize = get_UINT32BE(cur_dir_entry->dataPhysicalSize) - + get_UINT32BE(cur_dir_entry->rsrcPhysicalSize); - - return IMGTOOLERR_SUCCESS; -} - -#if 0 -/* - Concatenate path elements in the reverse order - - dest (O): destination buffer - dest_cur_pos (I/O): current position in destination buffer (buffer is - filled from end to start) - dest_max_len (I): length of destination buffer (use length minus one if you - want to preserve a trailing NUL character) - src (I): source C string -*/ -static void concat_fname(char *dest, int *dest_cur_pos, int dest_max_len, const char *src) -{ - static const char ellipsis[] = { '.', '.', '.' }; - int src_len = strlen(src); /* number of chars from src to insert */ - - if (src_len <= *dest_cur_pos) - { - *dest_cur_pos -= src_len; - memcpy(dest + *dest_cur_pos, src, src_len); - } - else - { - memcpy(dest, src + src_len - *dest_cur_pos, *dest_cur_pos); - *dest_cur_pos = 0; - memcpy(dest, ellipsis, (sizeof(ellipsis) <= dest_max_len) - ? sizeof(ellipsis) - : dest_max_len); - } -} -#endif - -/* - Enumerate disk catalog next entry (HFS) -*/ -static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent) -{ - hfs_catKey *catrec_key; - hfs_catData *catrec_data; - UINT16 dataRecType; - imgtoolerr_t err; - /* currently, the mac->C conversion transcodes one mac char with at most 3 - C chars */ - int cur_name_head; - - assert(iter->format == L2I_HFS); - - ent->corrupt = 0; - ent->eof = 0; - - do - { - err = hfs_cat_read(&iter->u.hfs.catref, &catrec_key, &catrec_data); - if (err) - { - /* error */ - ent->corrupt = 1; - return err; - } - else if (!catrec_key) - { - /* EOF */ - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - dataRecType = get_UINT16BE(catrec_data->dataType); - } while (((dataRecType != hcrt_Folder) && (dataRecType != hcrt_File)) - || (get_UINT32BE(catrec_key->parID) != iter->u.hfs.catref.parID)); - - /* copy info */ - switch (get_UINT16BE(catrec_data->dataType)) - { - case hcrt_Folder: - ent->directory = 1; - ent->filesize = 0; - break; - - case hcrt_File: - ent->directory = 0; - ent->filesize = get_UINT32BE(catrec_data->file.dataPhysicalSize) - + get_UINT32BE(catrec_data->file.rsrcPhysicalSize); - break; - } - - /* initialize file path buffer */ - cur_name_head = ARRAY_LENGTH(ent->filename); - if (cur_name_head > 0) - { - cur_name_head--; - ent->filename[cur_name_head] = '\0'; - } - - /* insert folder/file name in buffer */ - mac_to_c_strncpy(ent->filename, ARRAY_LENGTH(ent->filename), catrec_key->cName); -// concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, buf); - -#if 0 - /* extract parent directory ID */ - parID = get_UINT32BE(catrec_key->parID); - - /* looping while (parID != 1) will display the volume name; looping while - (parID != 2) won't */ - while (parID != /*1*/2) - { - /* search catalog for folder thread */ - err = hfs_cat_search(iter->l2_img, parID, mac_empty_str, &catrec_key, &catrec_data); - if (err) - { - /* error */ - concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, ":"); - concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, "???"); - - memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename) - cur_name_head); - ent->corrupt = 1; - return err; - } - - dataRecType = get_UINT16BE(catrec_data->dataType); - - if (dataRecType != hcrt_FolderThread) - { - /* error */ - concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename)-1, ":"); - concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename)-1, "???"); - - memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename)-cur_name_head); - ent->corrupt = 1; - return IMGTOOLERR_CORRUPTIMAGE; - } - - /* got folder thread record: insert the folder name at the start of - file path, then iterate */ - mac_to_c_strncpy(buf, sizeof(buf), catrec_data->thread.nodeName); - concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, ":"); - concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, buf); - - /* extract parent directory ID */ - parID = get_UINT32BE(catrec_data->thread.parID); - } - memmove(ent->filename, ent->filename+cur_name_head, ARRAY_LENGTH(ent->filename) -cur_name_head); -#endif - return IMGTOOLERR_SUCCESS; -} - -/* - Enumerate disk catalog next entry -*/ -static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - imgtoolerr_t err; - mac_iterator *iter = (mac_iterator *) imgtool_directory_extrabytes(enumeration); - - switch (iter->format) - { - case L2I_MFS: - err = mfs_image_nextenum(iter, ent); - break; - - case L2I_HFS: - err = hfs_image_nextenum(iter, ent); - break; - - default: - assert(1); - err = IMGTOOLERR_UNEXPECTED; - break; - } - return err; -} - -/* - Compute free space on disk image in bytes -*/ -static imgtoolerr_t mac_image_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtool_image *image = imgtool_partition_image(partition); - *size = ((UINT64) get_imgref(image)->freeABs) * 512; - return IMGTOOLERR_SUCCESS; -} - -#ifdef UNUSED_FUNCTION -static imgtoolerr_t mac_get_comment(struct mac_l2_imgref *image, mac_str255 filename, const mac_dirent *cat_info, mac_str255 comment) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - UINT16 commentID; - - comment[0] = '\0'; - - /* get comment from Desktop file */ - switch (image->format) - { - case L2I_MFS: - commentID = mfs_hashString(filename); - err = get_comment(image, commentID, comment); - break; - - case L2I_HFS: - /* This is the way to get Finder comments in system <= 7. Attached - comments use another method, and Finder 8 uses yet another one. */ - commentID = get_UINT16BE(cat_info->flXFinderInfo.comment); - if (commentID) - err = get_comment(image, commentID, comment); - break; - } - return err; -} -#endif - - -/* - Extract a file from a disk image. -*/ -static imgtoolerr_t mac_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t err; - imgtool_image *img = imgtool_partition_image(partition); - struct mac_l2_imgref *image = get_imgref(img); - UINT32 parID; - mac_str255 filename; - mac_dirent cat_info; - mac_fileref fileref; - UINT8 buf[512]; - UINT32 i, run_len, data_len; - mac_fork_t fork_num; - - err = mac_identify_fork(fork, &fork_num); - if (err) - return err; - - /* resolve path and fetch file info from directory/catalog */ - err = mac_lookup_path(image, fpath, &parID, filename, &cat_info, FALSE); - if (err) - return err; - if (cat_info.dataRecType != hcrt_File) - return IMGTOOLERR_FILENOTFOUND; - - /* open file */ - err = mac_file_open(image, parID, filename, fork_num ? rsrc_fork : data_fork, &fileref); - if (err) - return err; - - data_len = fork_num ? cat_info.rsrcLogicalSize : cat_info.dataLogicalSize; - - /* extract DF */ - i = 0; - while(i < data_len) - { - run_len = MIN(data_len - i, sizeof(buf)); - - err = mac_file_read(&fileref, run_len, buf); - if (err) - return err; - if (stream_write(destf, buf, run_len) != run_len) - return IMGTOOLERR_WRITEERROR; - i += run_len; - } - - return IMGTOOLERR_SUCCESS; -} - -/* - Add a file to a disk image. -*/ -static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) -{ - imgtool_image *img = imgtool_partition_image(partition); - struct mac_l2_imgref *image = get_imgref(img); - UINT32 parID; - mac_str255 filename; - mac_dirent cat_info; - mac_fileref fileref; - UINT32 fork_len; - /*UINT16 commentID;*/ - /*mac_str255 comment;*/ - UINT8 buf[512]; - UINT32 i, run_len; - imgtoolerr_t err; - mac_fork_t fork_num; - - (void) writeoptions; - - if (image->format == L2I_HFS) - return IMGTOOLERR_UNIMPLEMENTED; - - err = mac_identify_fork(fork, &fork_num); - if (err) - return err; - -#if 0 - if (header.version_old != 0) - return IMGTOOLERR_UNIMPLEMENTED; -#endif - /*mac_strcpy(filename, header.filename);*/ - memset(&cat_info, 0, sizeof(cat_info)); - set_UINT32BE(&cat_info.flFinderInfo.type, 0x3F3F3F3F); - set_UINT32BE(&cat_info.flFinderInfo.creator, 0x3F3F3F3F); - fork_len = stream_size(sourcef); - /*comment[0] = get_UINT16BE(header.comment_len);*/ /* comment length */ - /* Next two fields are set to 0 with MFS volumes. IIRC, 0 normally - means system script: I don't think MFS stores the file name script code - anywhere on disk, so it should be a reasonable approximation. */ - - /* create file */ - /* clear inited flag and file location in window */ - set_UINT16BE(&cat_info.flFinderInfo.flags, get_UINT16BE(cat_info.flFinderInfo.flags) & ~fif_hasBeenInited); - set_UINT16BE(&cat_info.flFinderInfo.location.v, 0); - set_UINT16BE(&cat_info.flFinderInfo.location.h, 0); - - /* resolve path and create file */ - err = mac_lookup_path(image, fpath, &parID, filename, &cat_info, TRUE); - if (err) - return err; - - /* open file fork */ - err = mac_file_open(image, parID, filename, (fork_num ? rsrc_fork : data_fork), &fileref); - if (err) - return err; - - err = mac_file_seteof(&fileref, fork_len); - if (err) - return err; - - /* extract fork */ - for (i=0; i 512) - run_len = 512; - if (stream_read(sourcef, buf, run_len) != run_len) - return IMGTOOLERR_READERROR; - err = mac_file_write(&fileref, run_len, buf); - if (err) - return err; - i += run_len; - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t mac_image_listforks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len) -{ - imgtoolerr_t err; - UINT32 parID; - mac_str255 filename; - mac_dirent cat_info; - int fork_num = 0; - imgtool_image *img = imgtool_partition_image(partition); - struct mac_l2_imgref *image = get_imgref(img); - - /* resolve path and fetch file info from directory/catalog */ - err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE); - if (err) - return err; - if (cat_info.dataRecType != hcrt_File) - return IMGTOOLERR_FILENOTFOUND; - - /* specify data fork */ - ents[fork_num].type = FORK_DATA; - ents[fork_num].forkname[0] = '\0'; - ents[fork_num].size = cat_info.dataLogicalSize; - fork_num++; - - if (cat_info.rsrcLogicalSize > 0) - { - /* specify the resource fork */ - ents[fork_num].type = FORK_RESOURCE; - strcpy(ents[fork_num].forkname, "RESOURCE_FORK"); - ents[fork_num].size = cat_info.rsrcLogicalSize; - fork_num++; - } - - ents[fork_num].type = FORK_END; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t mac_image_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) -{ - imgtoolerr_t err; - imgtool_image *img = imgtool_partition_image(partition); - UINT32 parID; - mac_str255 filename; - mac_dirent cat_info; - struct mac_l2_imgref *image = get_imgref(img); - int i; - - /* resolve path and fetch file info from directory/catalog */ - err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE); - if (err) - return err; - if (cat_info.dataRecType != hcrt_File) - return IMGTOOLERR_FILENOTFOUND; - - for (i = 0; attrs[i]; i++) - { - switch(attrs[i]) - { - case IMGTOOLATTR_INT_MAC_TYPE: - values[i].i = get_UINT32BE(cat_info.flFinderInfo.type); - break; - case IMGTOOLATTR_INT_MAC_CREATOR: - values[i].i = get_UINT32BE(cat_info.flFinderInfo.creator); - break; - case IMGTOOLATTR_INT_MAC_FINDERFLAGS: - values[i].i = get_UINT16BE(cat_info.flFinderInfo.flags); - break; - case IMGTOOLATTR_INT_MAC_COORDX: - values[i].i = get_UINT16BE(cat_info.flFinderInfo.location.h); - break; - case IMGTOOLATTR_INT_MAC_COORDY: - values[i].i = get_UINT16BE(cat_info.flFinderInfo.location.v); - break; - case IMGTOOLATTR_INT_MAC_FINDERFOLDER: - values[i].i = get_UINT16BE(cat_info.flFinderInfo.fldr); - break; - case IMGTOOLATTR_INT_MAC_ICONID: - values[i].i = get_UINT16BE(cat_info.flXFinderInfo.iconID); - break; - case IMGTOOLATTR_INT_MAC_SCRIPTCODE: - values[i].i = cat_info.flXFinderInfo.script; - break; - case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: - values[i].i = cat_info.flXFinderInfo.XFlags; - break; - case IMGTOOLATTR_INT_MAC_COMMENTID: - values[i].i = get_UINT16BE(cat_info.flXFinderInfo.comment); - break; - case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: - values[i].i = get_UINT32BE(cat_info.flXFinderInfo.putAway); - break; - - case IMGTOOLATTR_TIME_CREATED: - values[i].t = mac_crack_time(cat_info.createDate); - break; - case IMGTOOLATTR_TIME_LASTMODIFIED: - values[i].t = mac_crack_time(cat_info.modifyDate); - break; - } - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t mac_image_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) -{ - imgtoolerr_t err; - UINT32 parID; - mac_str255 filename; - mac_dirent cat_info; - imgtool_image *img = imgtool_partition_image(partition); - struct mac_l2_imgref *image = get_imgref(img); - int i; - - /* resolve path and fetch file info from directory/catalog */ - err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE); - if (err) - return err; - if (cat_info.dataRecType != hcrt_File) - return IMGTOOLERR_FILENOTFOUND; - - for (i = 0; attrs[i]; i++) - { - switch(attrs[i]) - { - case IMGTOOLATTR_INT_MAC_TYPE: - set_UINT32BE(&cat_info.flFinderInfo.type, values[i].i); - break; - case IMGTOOLATTR_INT_MAC_CREATOR: - set_UINT32BE(&cat_info.flFinderInfo.creator, values[i].i); - break; - case IMGTOOLATTR_INT_MAC_FINDERFLAGS: - set_UINT16BE(&cat_info.flFinderInfo.flags, values[i].i); - break; - case IMGTOOLATTR_INT_MAC_COORDX: - set_UINT16BE(&cat_info.flFinderInfo.location.h, values[i].i); - break; - case IMGTOOLATTR_INT_MAC_COORDY: - set_UINT16BE(&cat_info.flFinderInfo.location.v, values[i].i); - break; - case IMGTOOLATTR_INT_MAC_FINDERFOLDER: - set_UINT16BE(&cat_info.flFinderInfo.fldr, values[i].i); - break; - case IMGTOOLATTR_INT_MAC_ICONID: - set_UINT16BE(&cat_info.flXFinderInfo.iconID, values[i].i); - break; - case IMGTOOLATTR_INT_MAC_SCRIPTCODE: - cat_info.flXFinderInfo.script = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: - cat_info.flXFinderInfo.XFlags = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_COMMENTID: - set_UINT16BE(&cat_info.flXFinderInfo.comment, values[i].i); - break; - case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: - set_UINT32BE(&cat_info.flXFinderInfo.putAway, values[i].i); - break; - - case IMGTOOLATTR_TIME_CREATED: - cat_info.createDate = mac_setup_time(values[i].t); - break; - case IMGTOOLATTR_TIME_LASTMODIFIED: - cat_info.modifyDate = mac_setup_time(values[i].t); - break; - } - } - - /* resolve path and fetch file info from directory/catalog */ - err = mac_lookup_path(image, path, &parID, filename, &cat_info, TRUE); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -/************************************* - * - * Our very own resource manager - * - *************************************/ - -static const void *mac_walk_resources(const void *resource_fork, size_t resource_fork_length, - UINT32 resource_type, - int (*discriminator)(const void *resource, UINT16 id, UINT32 length, void *param_), - void *param, UINT16 *resource_id, UINT32 *resource_length) -{ - UINT32 resource_data_offset, resource_data_length; - UINT32 resource_map_offset, resource_map_length; - UINT32 resource_typelist_count, resource_typelist_offset; - UINT32 resource_entry_offset, resource_entry_count; - UINT32 i, this_resource_type; - UINT32 this_resource_data, this_resource_length; - UINT16 this_resource_id; - const void *this_resource_ptr; - - if (resource_fork_length < 16) - return NULL; - - /* read resource header; its ok if anything past this point fails */ - resource_data_offset = pick_integer_be(resource_fork, 0, 4); - resource_map_offset = pick_integer_be(resource_fork, 4, 4); - resource_data_length = pick_integer_be(resource_fork, 8, 4); - resource_map_length = pick_integer_be(resource_fork, 12, 4); - if ((resource_data_offset + resource_data_length) > resource_fork_length) - return NULL; - if ((resource_map_offset + resource_map_length) > resource_fork_length) - return NULL; - if (resource_map_length < 30) - return NULL; - - /* read resource map and locate the resource type list */ - resource_typelist_offset = pick_integer_be(resource_fork, - resource_map_offset + 24, 2) + resource_map_offset; - if ((resource_typelist_offset + 2) > resource_fork_length) - return NULL; - resource_typelist_count = pick_integer_be(resource_fork, - resource_typelist_offset, 2) + 1; - if ((resource_typelist_offset + resource_typelist_count * 16 + 2) > resource_fork_length) - return NULL; - - /* scan the resource type list and locate the entries for this type */ - resource_entry_count = 0; - resource_entry_offset = 0; - for (i = 0; i < resource_typelist_count; i++) - { - this_resource_type = pick_integer_be(resource_fork, resource_typelist_offset - + (i * 8) + 2 + 0, 4); - if (this_resource_type == resource_type) - { - resource_entry_count = pick_integer_be(resource_fork, resource_typelist_offset - + (i * 8) + 2 + 4, 2) + 1; - resource_entry_offset = pick_integer_be(resource_fork, resource_typelist_offset - + (i * 8) + 2 + 6, 2) + resource_typelist_offset; - break; - } - } - - /* scan the resource entries, and find the correct resource */ - for (i = 0; i < resource_entry_count; i++) - { - this_resource_id = pick_integer_be(resource_fork, resource_entry_offset - + (i * 12) + 0, 2); - this_resource_data = pick_integer_be(resource_fork, resource_entry_offset - + (i * 12) + 5, 3) + resource_data_offset; - if ((this_resource_data + 4) > resource_fork_length) - return NULL; - - /* gauge the length */ - this_resource_length = pick_integer_be(resource_fork, this_resource_data, 4); - this_resource_data += 4; - if ((this_resource_data + this_resource_length) > resource_fork_length) - return NULL; - - this_resource_ptr = ((const UINT8 *) resource_fork) + this_resource_data; - if (discriminator(this_resource_ptr, this_resource_id, - this_resource_length, param)) - { - if (resource_length) - *resource_length = this_resource_length; - if (resource_id) - *resource_id = this_resource_id; - return this_resource_ptr; - } - } - - return NULL; -} - - - -static int get_resource_discriminator(const void *resource, UINT16 id, UINT32 length, void *param) -{ - const UINT16 *id_ptr = (const UINT16 *) param; - return id == *id_ptr; -} - - - -static const void *mac_get_resource(const void *resource_fork, size_t resource_fork_length, - UINT32 resource_type, UINT16 resource_id, UINT32 *resource_length) -{ - return mac_walk_resources(resource_fork, resource_fork_length, - resource_type, get_resource_discriminator, &resource_id, NULL, resource_length); -} - - - -/************************************* - * - * Custom icons - * - *************************************/ - -static int bundle_discriminator(const void *resource, UINT16 id, UINT32 length, void *param) -{ - UINT32 this_creator_code = pick_integer_be(resource, 0, 4); - UINT32 desired_creator_code = *((UINT32 *) param); - return this_creator_code == desired_creator_code; -} - - - -static int get_pixel(const UINT8 *src, int width, int height, int bpp, - int x, int y) -{ - UINT8 byte, mask; - int bit_position; - - byte = src[(y * width + x) * bpp / 8]; - bit_position = 8 - ((x % (8 / bpp)) + 1) * bpp; - mask = (1 << bpp) - 1; - return (byte >> bit_position) & mask; -} - - - -static int load_icon(UINT32 *dest, const void *resource_fork, UINT64 resource_fork_length, - UINT32 resource_type, UINT16 resource_id, int width, int height, int bpp, - const UINT32 *palette, int has_mask) -{ - int success = FALSE; - int y, x, color, is_masked; - UINT32 pixel; - const UINT8 *src; - UINT32 resource_length; - UINT32 frame_length; - UINT32 total_length; - - frame_length = width * height * bpp / 8; - total_length = frame_length * (has_mask ? 2 : 1); - - /* attempt to fetch resource */ - src = (const UINT8*)mac_get_resource(resource_fork, resource_fork_length, resource_type, - resource_id, &resource_length); - if (src && (resource_length == total_length)) - { - for (y = 0; y < height; y++) - { - for (x = 0; x < width; x ++) - { - /* first check mask bit */ - if (has_mask) - is_masked = get_pixel(src + frame_length, width, height, bpp, x, y); - else - is_masked = dest[y * width + x] >= 0x80000000; - - if (is_masked) - { - /* mask is ok; check the actual icon */ - color = get_pixel(src, width, height, bpp, x, y); - pixel = palette[color] | 0xFF000000; - } - else - { - /* masked out; nothing */ - pixel = 0; - } - - dest[y * width + x] = pixel; - } - } - success = TRUE; - } - return success; -} - - - -static imgtoolerr_t mac_image_geticoninfo(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo) -{ - static const UINT32 mac_palette_1bpp[2] = { 0xFFFFFF, 0x000000 }; - - static const UINT32 mac_palette_4bpp[16] = - { - 0xFFFFFF, 0xFCF305, 0xFF6402, 0xDD0806, 0xF20884, 0x4600A5, - 0x0000D4, 0x02ABEA, 0x1FB714, 0x006411, 0x562C05, 0x90713A, - 0xC0C0C0, 0x808080, 0x404040, 0x000000 - }; - - static const UINT32 mac_palette_8bpp[256] = - { - 0xFFFFFF, 0xFFFFCC, 0xFFFF99, 0xFFFF66, 0xFFFF33, 0xFFFF00, - 0xFFCCFF, 0xFFCCCC, 0xFFCC99, 0xFFCC66, 0xFFCC33, 0xFFCC00, - 0xFF99FF, 0xFF99CC, 0xFF9999, 0xFF9966, 0xFF9933, 0xFF9900, - 0xFF66FF, 0xFF66CC, 0xFF6699, 0xFF6666, 0xFF6633, 0xFF6600, - 0xFF33FF, 0xFF33CC, 0xFF3399, 0xFF3366, 0xFF3333, 0xFF3300, - 0xFF00FF, 0xFF00CC, 0xFF0099, 0xFF0066, 0xFF0033, 0xFF0000, - 0xCCFFFF, 0xCCFFCC, 0xCCFF99, 0xCCFF66, 0xCCFF33, 0xCCFF00, - 0xCCCCFF, 0xCCCCCC, 0xCCCC99, 0xCCCC66, 0xCCCC33, 0xCCCC00, - 0xCC99FF, 0xCC99CC, 0xCC9999, 0xCC9966, 0xCC9933, 0xCC9900, - 0xCC66FF, 0xCC66CC, 0xCC6699, 0xCC6666, 0xCC6633, 0xCC6600, - 0xCC33FF, 0xCC33CC, 0xCC3399, 0xCC3366, 0xCC3333, 0xCC3300, - 0xCC00FF, 0xCC00CC, 0xCC0099, 0xCC0066, 0xCC0033, 0xCC0000, - 0x99FFFF, 0x99FFCC, 0x99FF99, 0x99FF66, 0x99FF33, 0x99FF00, - 0x99CCFF, 0x99CCCC, 0x99CC99, 0x99CC66, 0x99CC33, 0x99CC00, - 0x9999FF, 0x9999CC, 0x999999, 0x999966, 0x999933, 0x999900, - 0x9966FF, 0x9966CC, 0x996699, 0x996666, 0x996633, 0x996600, - 0x9933FF, 0x9933CC, 0x993399, 0x993366, 0x993333, 0x993300, - 0x9900FF, 0x9900CC, 0x990099, 0x990066, 0x990033, 0x990000, - 0x66FFFF, 0x66FFCC, 0x66FF99, 0x66FF66, 0x66FF33, 0x66FF00, - 0x66CCFF, 0x66CCCC, 0x66CC99, 0x66CC66, 0x66CC33, 0x66CC00, - 0x6699FF, 0x6699CC, 0x669999, 0x669966, 0x669933, 0x669900, - 0x6666FF, 0x6666CC, 0x666699, 0x666666, 0x666633, 0x666600, - 0x6633FF, 0x6633CC, 0x663399, 0x663366, 0x663333, 0x663300, - 0x6600FF, 0x6600CC, 0x660099, 0x660066, 0x660033, 0x660000, - 0x33FFFF, 0x33FFCC, 0x33FF99, 0x33FF66, 0x33FF33, 0x33FF00, - 0x33CCFF, 0x33CCCC, 0x33CC99, 0x33CC66, 0x33CC33, 0x33CC00, - 0x3399FF, 0x3399CC, 0x339999, 0x339966, 0x339933, 0x339900, - 0x3366FF, 0x3366CC, 0x336699, 0x336666, 0x336633, 0x336600, - 0x3333FF, 0x3333CC, 0x333399, 0x333366, 0x333333, 0x333300, - 0x3300FF, 0x3300CC, 0x330099, 0x330066, 0x330033, 0x330000, - 0x00FFFF, 0x00FFCC, 0x00FF99, 0x00FF66, 0x00FF33, 0x00FF00, - 0x00CCFF, 0x00CCCC, 0x00CC99, 0x00CC66, 0x00CC33, 0x00CC00, - 0x0099FF, 0x0099CC, 0x009999, 0x009966, 0x009933, 0x009900, - 0x0066FF, 0x0066CC, 0x006699, 0x006666, 0x006633, 0x006600, - 0x0033FF, 0x0033CC, 0x003399, 0x003366, 0x003333, 0x003300, - 0x0000FF, 0x0000CC, 0x000099, 0x000066, 0x000033, 0xEE0000, - 0xDD0000, 0xBB0000, 0xAA0000, 0x880000, 0x770000, 0x550000, - 0x440000, 0x220000, 0x110000, 0x00EE00, 0x00DD00, 0x00BB00, - 0x00AA00, 0x008800, 0x007700, 0x005500, 0x004400, 0x002200, - 0x001100, 0x0000EE, 0x0000DD, 0x0000BB, 0x0000AA, 0x000088, - 0x000077, 0x000055, 0x000044, 0x000022, 0x000011, 0xEEEEEE, - 0xDDDDDD, 0xBBBBBB, 0xAAAAAA, 0x888888, 0x777777, 0x555555, - 0x444444, 0x222222, 0x111111, 0x000000 - }; - - static const UINT32 attrs[4] = - { - IMGTOOLATTR_INT_MAC_TYPE, - IMGTOOLATTR_INT_MAC_CREATOR, - IMGTOOLATTR_INT_MAC_FINDERFLAGS - }; - - imgtoolerr_t err; - imgtool_attribute attr_values[3]; - UINT32 type_code, creator_code, finder_flags; - imgtool_stream *stream = NULL; - const void *resource_fork; - UINT64 resource_fork_length; - const void *bundle; - UINT32 bundle_length, pos, fref_pos, icn_pos, i; - UINT16 local_id = 0, resource_id; - UINT32 fref_bundleentry_length, icn_bundleentry_length; - const void *fref; - UINT32 resource_length; - - assert((ARRAY_LENGTH(attrs) - 1) - == ARRAY_LENGTH(attr_values)); - - /* first retrieve type and creator code */ - err = mac_image_getattrs(partition, path, attrs, attr_values); - if (err) - goto done; - type_code = (UINT32) attr_values[0].i; - creator_code = (UINT32) attr_values[1].i; - finder_flags = (UINT32) attr_values[2].i; - - /* check the bundle bit; if clear (and the type is not 'APPL'), use the - * desktop file */ - if (!(finder_flags & 0x2000) && (type_code != /* APPL */ 0x4150504C)) - path = "Desktop\0"; - - stream = stream_open_mem(NULL, 0); - if (!stream) - { - err = IMGTOOLERR_SUCCESS; - goto done; - } - - /* read in the resource fork */ - err = mac_image_readfile(partition, path, "RESOURCE_FORK", stream); - if (err) - goto done; - resource_fork = stream_getptr(stream); - resource_fork_length = stream_size(stream); - - /* attempt to look up the bundle */ - bundle = mac_walk_resources(resource_fork, resource_fork_length, /* BNDL */ 0x424E444C, - bundle_discriminator, &creator_code, NULL, &bundle_length); - if (!bundle) - goto done; - - /* find the FREF and the icon family */ - pos = 8; - fref_pos = icn_pos = 0; - fref_bundleentry_length = icn_bundleentry_length = 0; - while((pos + 10) <= bundle_length) - { - UINT32 this_bundleentry_type = pick_integer_be(bundle, pos + 0, 4); - UINT32 this_bundleentry_length = pick_integer_be(bundle, pos + 4, 2) + 1; - - if (this_bundleentry_type == /* FREF */ 0x46524546) - { - fref_pos = pos; - fref_bundleentry_length = this_bundleentry_length; - } - if (this_bundleentry_type == /* ICN# */ 0x49434E23) - { - icn_pos = pos; - icn_bundleentry_length = this_bundleentry_length; - } - pos += 6 + this_bundleentry_length * 4; - } - if (!fref_pos || !icn_pos) - goto done; - - /* look up the FREF */ - for (i = 0; i < fref_bundleentry_length; i++) - { - local_id = pick_integer_be(bundle, fref_pos + (i * 4) + 6, 2); - resource_id = pick_integer_be(bundle, fref_pos + (i * 4) + 8, 2); - - fref = mac_get_resource(resource_fork, resource_fork_length, - /* FREF */ 0x46524546, resource_id, &resource_length); - if (fref && (resource_length >= 7)) - { - if (pick_integer_be(fref, 0, 4) == type_code) - break; - } - } - if (i >= fref_bundleentry_length) - goto done; - - /* now look up the icon family */ - resource_id = 0; - for (i = 0; i < icn_bundleentry_length; i++) - { - if (pick_integer_be(bundle, icn_pos + (i * 4) + 6, 2) == local_id) - { - resource_id = pick_integer_be(bundle, icn_pos + (i * 4) + 8, 2); - break; - } - } - if (i >= icn_bundleentry_length) - goto done; - - /* fetch 32x32 icons (ICN#, icl4, icl8) */ - if (load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, - /* ICN# */ 0x49434E23, resource_id, 32, 32, 1, mac_palette_1bpp, TRUE)) - { - iconinfo->icon32x32_specified = 1; - - load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, - /* icl4 */ 0x69636C34, resource_id, 32, 32, 4, mac_palette_4bpp, FALSE); - load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, - /* icl8 */ 0x69636C38, resource_id, 32, 32, 8, mac_palette_8bpp, FALSE); - } - - /* fetch 16x16 icons (ics#, ics4, ics8) */ - if (load_icon((UINT32 *) iconinfo->icon16x16, resource_fork, resource_fork_length, - /* ics# */ 0x69637323, resource_id, 16, 16, 1, mac_palette_1bpp, TRUE)) - { - iconinfo->icon16x16_specified = 1; - - load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, - /* ics4 */ 0x69637334, resource_id, 32, 32, 4, mac_palette_4bpp, FALSE); - load_icon((UINT32 *) iconinfo->icon32x32, resource_fork, resource_fork_length, - /* ics8 */ 0x69637338, resource_id, 32, 32, 8, mac_palette_8bpp, FALSE); - } - -done: - if (stream) - stream_close(stream); - return err; -} - - - -/************************************* - * - * File transfer suggestions - * - *************************************/ - -static imgtoolerr_t mac_image_suggesttransfer(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) -{ - imgtoolerr_t err; - UINT32 parID; - mac_str255 filename; - mac_dirent cat_info; - imgtool_image *img = imgtool_partition_image(partition); - struct mac_l2_imgref *image = get_imgref(img); - mac_filecategory_t file_category = MAC_FILECATEGORY_DATA; - - if (path) - { - /* resolve path and fetch file info from directory/catalog */ - err = mac_lookup_path(image, path, &parID, filename, &cat_info, FALSE); - if (err) - return err; - if (cat_info.dataRecType != hcrt_File) - return IMGTOOLERR_FILENOTFOUND; - - file_category = (cat_info.rsrcLogicalSize > 0) ? MAC_FILECATEGORY_FORKED : MAC_FILECATEGORY_DATA; - } - - mac_suggest_transfer(file_category, suggestions, suggestions_length); - return IMGTOOLERR_SUCCESS; -} - - - -/************************************* - * - * Module population - * - *************************************/ - -static void generic_mac_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break; - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(struct mac_l2_imgref); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct mac_iterator); break; - case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = ':'; break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; - case IMGTOOLINFO_PTR_CLOSE: /* info->close = mac_image_exit */; break; - case IMGTOOLINFO_PTR_INFO: info->info = mac_image_info; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = mac_image_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = mac_image_nextenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = mac_image_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = mac_image_readfile; break; - case IMGTOOLINFO_PTR_LIST_FORKS: info->list_forks = mac_image_listforks; break; - case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = mac_image_getattrs; break; - case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = mac_image_setattrs; break; - case IMGTOOLINFO_PTR_GET_ICON_INFO: info->get_iconinfo = mac_image_geticoninfo; break; - case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = mac_image_suggesttransfer; break; - case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_mac; break; - } -} - - - -void mac_mfs_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mac_mfs"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Mac MFS Floppy"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = mfs_image_create; break; - case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = mfs_image_open; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = mac_image_writefile; break; - - default: generic_mac_get_info(imgclass, state, info); break; - } -} - - - -void mac_hfs_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mac_hfs"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Mac HFS Floppy"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = hfs_image_open; break; - - default: generic_mac_get_info(imgclass, state, info); break; - } -} diff --git a/src/mess/tools/imgtool/modules/macbin.c b/src/mess/tools/imgtool/modules/macbin.c deleted file mode 100644 index 3ef85a039d1..00000000000 --- a/src/mess/tools/imgtool/modules/macbin.c +++ /dev/null @@ -1,377 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/**************************************************************************** - - macbin.c - - MacBinary filter for use with Mac and ProDOS drivers - -***************************************************************************** - - MacBinary file format - - Offset Length Description - ------ ------ ----------- - 0 1 [I] Magic byte (0x00) - 1 64 [I] File name (Pascal String) - 65 4 [I] File Type Code - 69 4 [I] File Creator Code - 73 1 [I] Finder Flags (bits 15-8) - 74 1 [I] Magic byte (0x00) - 75 2 [I] File Vertical Position - 77 2 [I] File Horizontal Position - 79 2 [I] Window/Folder ID - 81 1 [I] Protected (bit 0) - 82 1 [I] Magic byte (0x00) - 83 4 [I] Data Fork Length - 87 4 [I] Resource Fork Length - 91 4 [I] Creation Date - 95 4 [I] Last Modified Date - 99 2 [I] "Get Info" comment length - 101 1 [II] Finder Flags (bits 7-0) - 102 4 [III] MacBinary III Signature 'mBIN' - 106 1 [III] Script of Filename - 107 1 [III] Extended Finder Flags - 116 4 [II] Unpacked Length - 120 2 [II] Secondary Header Length - 122 1 [II] MacBinary II Version Number (II: 0x81, III: 0x82) - 123 1 [II] Minimum Compatible MacBinary II Version Number (0x81) - 124 2 [II] CRC of previous 124 bytes - - For more information, consult http://www.lazerware.com/formats/macbinary.html - - TODO: I believe that the script code is some sort of identifier identifying - the character set used for the filename. If this is true, we are not - handling that properly - -*****************************************************************************/ - -#include - -#include "imgtool.h" -#include "formats/imageutl.h" -#include "macutil.h" - - - -static UINT32 pad128(UINT32 length) -{ - if (length % 128) - length += 128 - (length % 128); - return length; -} - - - -static imgtoolerr_t macbinary_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - static const UINT32 attrs[] = - { - IMGTOOLATTR_TIME_CREATED, - IMGTOOLATTR_TIME_LASTMODIFIED, - IMGTOOLATTR_INT_MAC_TYPE, - IMGTOOLATTR_INT_MAC_CREATOR, - IMGTOOLATTR_INT_MAC_FINDERFLAGS, - IMGTOOLATTR_INT_MAC_COORDX, - IMGTOOLATTR_INT_MAC_COORDY, - IMGTOOLATTR_INT_MAC_FINDERFOLDER, - IMGTOOLATTR_INT_MAC_SCRIPTCODE, - IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS, - 0 - }; - imgtoolerr_t err; - UINT8 header[128]; - const char *basename; - int i; - - UINT32 type_code = 0x3F3F3F3F; - UINT32 creator_code = 0x3F3F3F3F; - UINT16 finder_flags = 0; - UINT16 coord_x = 0; - UINT16 coord_y = 0; - UINT16 finder_folder = 0; - UINT8 script_code = 0; - UINT8 extended_flags = 0; - - imgtool_forkent fork_entries[4]; - const imgtool_forkent *data_fork = NULL; - const imgtool_forkent *resource_fork = NULL; - UINT32 creation_time = 0; - UINT32 lastmodified_time = 0; - imgtool_attribute attr_values[10]; - - /* get the forks */ - err = imgtool_partition_list_file_forks(partition, filename, fork_entries, sizeof(fork_entries)); - if (err) - return err; - for (i = 0; fork_entries[i].type != FORK_END; i++) - { - if (fork_entries[i].type == FORK_DATA) - data_fork = &fork_entries[i]; - else if (fork_entries[i].type == FORK_RESOURCE) - resource_fork = &fork_entries[i]; - } - - /* get the attributes */ - err = imgtool_partition_get_file_attributes(partition, filename, attrs, attr_values); - if (err && (ERRORCODE(err) != IMGTOOLERR_UNIMPLEMENTED)) - return err; - if (err == IMGTOOLERR_SUCCESS) - { - creation_time = mac_setup_time(attr_values[0].t); - lastmodified_time = mac_setup_time(attr_values[1].t); - type_code = attr_values[2].i; - creator_code = attr_values[3].i; - finder_flags = attr_values[4].i; - coord_x = attr_values[5].i; - coord_y = attr_values[6].i; - finder_folder = attr_values[7].i; - script_code = attr_values[8].i; - extended_flags = attr_values[9].i; - } - - memset(header, 0, sizeof(header)); - - /* place filename */ - basename = filename; - while(basename[strlen(basename) + 1]) - basename += strlen(basename) + 1; - pascal_from_c_string((unsigned char *) &header[1], 64, basename); - - place_integer_be(header, 65, 4, type_code); - place_integer_be(header, 69, 4, creator_code); - place_integer_be(header, 73, 1, (finder_flags >> 8) & 0xFF); - place_integer_be(header, 75, 2, coord_x); - place_integer_be(header, 77, 2, coord_y); - place_integer_be(header, 79, 2, finder_folder); - place_integer_be(header, 83, 4, data_fork ? data_fork->size : 0); - place_integer_be(header, 87, 4, resource_fork ? resource_fork->size : 0); - place_integer_be(header, 91, 4, creation_time); - place_integer_be(header, 95, 4, lastmodified_time); - place_integer_be(header, 101, 1, (finder_flags >> 0) & 0xFF); - place_integer_be(header, 102, 4, 0x6D42494E); - place_integer_be(header, 106, 1, script_code); - place_integer_be(header, 107, 1, extended_flags); - place_integer_be(header, 122, 1, 0x82); - place_integer_be(header, 123, 1, 0x81); - place_integer_be(header, 124, 2, ccitt_crc16(0, header, 124)); - - stream_write(destf, header, sizeof(header)); - - if (data_fork) - { - err = imgtool_partition_read_file(partition, filename, "", destf, NULL); - if (err) - return err; - - stream_fill(destf, 0, pad128(data_fork->size)); - } - - if (resource_fork) - { - err = imgtool_partition_read_file(partition, filename, "RESOURCE_FORK", destf, NULL); - if (err) - return err; - - stream_fill(destf, 0, pad128(resource_fork->size)); - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t write_fork(imgtool_partition *partition, const char *filename, const char *fork, - imgtool_stream *sourcef, UINT64 pos, UINT64 fork_len, option_resolution *opts) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - imgtool_stream *mem_stream = NULL; - size_t len; - - if (fork_len > 0) - { - mem_stream = stream_open_mem(NULL, 0); - if (!mem_stream) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - stream_seek(sourcef, pos, SEEK_SET); - len = stream_transfer(mem_stream, sourcef, fork_len); - if (len < fork_len) - stream_fill(mem_stream, 0, fork_len); - - stream_seek(mem_stream, 0, SEEK_SET); - err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL); - if (err) - goto done; - } - -done: - if (mem_stream) - stream_close(mem_stream); - return err; -} - - - -static imgtoolerr_t macbinary_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - static const UINT32 attrs[] = - { - IMGTOOLATTR_TIME_CREATED, - IMGTOOLATTR_TIME_LASTMODIFIED, - IMGTOOLATTR_INT_MAC_TYPE, - IMGTOOLATTR_INT_MAC_CREATOR, - IMGTOOLATTR_INT_MAC_FINDERFLAGS, - IMGTOOLATTR_INT_MAC_COORDX, - IMGTOOLATTR_INT_MAC_COORDY, - IMGTOOLATTR_INT_MAC_FINDERFOLDER, - IMGTOOLATTR_INT_MAC_SCRIPTCODE, - IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS, - 0 - }; - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - UINT8 header[128]; - UINT32 datafork_size; - UINT32 resourcefork_size; - UINT64 total_size; - UINT32 creation_time; - UINT32 lastmodified_time; - //int version; - imgtool_attribute attr_values[10]; - - UINT32 type_code; - UINT32 creator_code; - UINT16 finder_flags; - UINT16 coord_x; - UINT16 coord_y; - UINT16 finder_folder; - UINT8 script_code = 0; - UINT8 extended_flags = 0; - - /* read in the header */ - memset(header, 0, sizeof(header)); - stream_read(sourcef, header, sizeof(header)); - - /* check magic and zero fill bytes */ - if (header[0] != 0x00) - return IMGTOOLERR_CORRUPTFILE; - if (header[74] != 0x00) - return IMGTOOLERR_CORRUPTFILE; - if (header[82] != 0x00) - return IMGTOOLERR_CORRUPTFILE; - - datafork_size = pick_integer_be(header, 83, 4); - resourcefork_size = pick_integer_be(header, 87, 4); - total_size = stream_size(sourcef); - - /* size of a MacBinary header is always 128 bytes */ - if (total_size - pad128(datafork_size) - pad128(resourcefork_size) != 128) - return IMGTOOLERR_CORRUPTFILE; - - /* check filename length byte */ - if ((header[1] <= 0x00) || (header[1] > 0x3F)) - return IMGTOOLERR_CORRUPTFILE; - - /* check the CRC */ - if (pick_integer_be(header, 124, 2) != ccitt_crc16(0, header, 124)) - { - /* the CRC does not match; this file is MacBinary I */ - //version = 1; - } - else if (pick_integer_be(header, 102, 4) != 0x6D42494E) - { - /* did not see 'mBIN'; this file is MacBinary II */ - if (header[122] < 0x81) - return IMGTOOLERR_CORRUPTFILE; - if (header[123] < 0x81) - return IMGTOOLERR_CORRUPTFILE; - //version = 2; - } - else - { - /* we did see 'mBIN'; this file is MacBinary III */ - if (header[122] < 0x82) - return IMGTOOLERR_CORRUPTFILE; - if (header[123] < 0x81) - return IMGTOOLERR_CORRUPTFILE; - //version = 3; - } - - type_code = pick_integer_be(header, 65, 4); - creator_code = pick_integer_be(header, 69, 4); - finder_flags = pick_integer_be(header, 73, 1) << 8; - coord_x = pick_integer_be(header, 75, 2); - coord_y = pick_integer_be(header, 77, 2); - finder_folder = pick_integer_be(header, 79, 2); - creation_time = pick_integer_be(header, 91, 4); - lastmodified_time = pick_integer_be(header, 95, 4); - - if (image) - { - /* write out both forks */ - err = write_fork(partition, filename, "", sourcef, sizeof(header), datafork_size, opts); - if (err) - return err; - err = write_fork(partition, filename, "RESOURCE_FORK", sourcef, sizeof(header) + pad128(datafork_size), resourcefork_size, opts); - if (err) - return err; - - /* set up attributes */ - attr_values[0].t = mac_crack_time(creation_time); - attr_values[1].t = mac_crack_time(lastmodified_time); - attr_values[2].i = type_code; - attr_values[3].i = creator_code; - attr_values[4].i = finder_flags; - attr_values[5].i = coord_x; - attr_values[6].i = coord_y; - attr_values[7].i = finder_folder; - attr_values[8].i = script_code; - attr_values[9].i = extended_flags; - - err = imgtool_partition_put_file_attributes(partition, filename, attrs, attr_values); - if (err) - return err; - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t macbinary_checkstream(imgtool_stream *stream, imgtool_suggestion_viability_t *viability) -{ - imgtoolerr_t err; - - err = macbinary_writefile(NULL, NULL, NULL, stream, NULL); - if (err == IMGTOOLERR_CORRUPTFILE) - { - /* the filter returned corrupt; this is not a valid file */ - *viability = SUGGESTION_END; - err = IMGTOOLERR_SUCCESS; - } - else if (err == IMGTOOLERR_SUCCESS) - { - /* success; lets recommend this filter */ - *viability = SUGGESTION_RECOMMENDED; - } - return err; -} - - - -void filter_macbinary_getinfo(UINT32 state, union filterinfo *info) -{ - switch(state) - { - case FILTINFO_STR_NAME: info->s = "macbinary"; break; - case FILTINFO_STR_HUMANNAME: info->s = "MacBinary"; break; - case FILTINFO_STR_EXTENSION: info->s = "bin"; break; - case FILTINFO_PTR_READFILE: info->read_file = macbinary_readfile; break; - case FILTINFO_PTR_WRITEFILE: info->write_file = macbinary_writefile; break; - case FILTINFO_PTR_CHECKSTREAM: info->check_stream = macbinary_checkstream; break; - } -} diff --git a/src/mess/tools/imgtool/modules/macutil.c b/src/mess/tools/imgtool/modules/macutil.c deleted file mode 100644 index fe2e1ade51a..00000000000 --- a/src/mess/tools/imgtool/modules/macutil.c +++ /dev/null @@ -1,89 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/**************************************************************************** - - macutil.c - - Imgtool Utility code for manipulating certain Apple/Mac data structures - and conventions - -*****************************************************************************/ - -#include "macutil.h" - - -time_t mac_crack_time(UINT32 t) -{ - /* not sure if this is correct... */ - return t - (((1970 - 1904) * 365) + 17) * 24 * 60 * 60; -} - - - -UINT32 mac_setup_time(time_t t) -{ - /* not sure if this is correct... */ - return t + (((1970 - 1904) * 365) + 17) * 24 * 60 * 60; -} - - - -UINT32 mac_time_now(void) -{ - time_t now; - time(&now); - return mac_setup_time(now); -} - - - -imgtoolerr_t mac_identify_fork(const char *fork_string, mac_fork_t *fork_num) -{ - if (!strcmp(fork_string, "")) - *fork_num = MAC_FORK_DATA; - else if (!strcmp(fork_string, "RESOURCE_FORK")) - *fork_num = MAC_FORK_RESOURCE; - else - return IMGTOOLERR_FORKNOTFOUND; - return IMGTOOLERR_SUCCESS; -} - - - -void mac_suggest_transfer(mac_filecategory_t file_category, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) -{ - suggestions[0].viability = (file_category == MAC_FILECATEGORY_FORKED) ? SUGGESTION_RECOMMENDED : SUGGESTION_POSSIBLE; - suggestions[0].filter = filter_macbinary_getinfo; - suggestions[0].fork = NULL; - suggestions[0].description = NULL; - - suggestions[1].viability = (file_category == MAC_FILECATEGORY_TEXT) ? SUGGESTION_RECOMMENDED : SUGGESTION_POSSIBLE; - suggestions[1].filter = filter_eoln_getinfo; - suggestions[1].fork = NULL; - suggestions[1].description = NULL; - - suggestions[2].viability = (file_category == MAC_FILECATEGORY_DATA) ? SUGGESTION_RECOMMENDED : SUGGESTION_POSSIBLE; - suggestions[2].filter = NULL; - suggestions[2].fork = ""; - suggestions[2].description = "Raw (data fork)"; - - suggestions[3].viability = SUGGESTION_POSSIBLE; - suggestions[3].filter = NULL; - suggestions[3].fork = "RESOURCE_FORK"; - suggestions[3].description = "Raw (resource fork)"; -} - - - -void pascal_from_c_string(unsigned char *pstring, size_t pstring_len, const char *cstring) -{ - size_t cstring_len, i; - - cstring_len = strlen(cstring); - pstring[0] = MIN(cstring_len, pstring_len - 1); - - for (i = 0; i < pstring[0]; i++) - pstring[1 + i] = cstring[i]; - while(i < pstring_len - 1) - pstring[1 + i++] = '\0'; -} diff --git a/src/mess/tools/imgtool/modules/macutil.h b/src/mess/tools/imgtool/modules/macutil.h deleted file mode 100644 index 71121dade31..00000000000 --- a/src/mess/tools/imgtool/modules/macutil.h +++ /dev/null @@ -1,42 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/**************************************************************************** - - macutil.h - - Imgtool Utility code for manipulating certain Apple/Mac data structures - and conventions - -*****************************************************************************/ - -#ifndef MACUTIL_H -#define MACUTIL_H - -#include "imgtool.h" - -enum mac_fork_t -{ - MAC_FORK_DATA, - MAC_FORK_RESOURCE -}; - -enum mac_filecategory_t -{ - MAC_FILECATEGORY_DATA, - MAC_FILECATEGORY_TEXT, - MAC_FILECATEGORY_FORKED -}; - - -/* converting Classic Mac OS time <==> Imgtool time */ -time_t mac_crack_time(UINT32 t); -UINT32 mac_setup_time(time_t t); -UINT32 mac_time_now(void); - -imgtoolerr_t mac_identify_fork(const char *fork_string, mac_fork_t *fork_num); - -void mac_suggest_transfer(mac_filecategory_t file_category, imgtool_transfer_suggestion *suggestions, size_t suggestions_length); - -void pascal_from_c_string(unsigned char *pstring, size_t pstring_len, const char *cstring); - -#endif /* MACUTIL_H */ diff --git a/src/mess/tools/imgtool/modules/os9.c b/src/mess/tools/imgtool/modules/os9.c deleted file mode 100644 index 2a9e2fb0292..00000000000 --- a/src/mess/tools/imgtool/modules/os9.c +++ /dev/null @@ -1,1244 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/**************************************************************************** - - os9.c - - CoCo OS-9 disk images - -****************************************************************************/ - -#include - -#include "imgtool.h" -#include "formats/imageutl.h" -#include "formats/coco_dsk.h" -#include "iflopimg.h" - -enum creation_policy_t -{ - CREATE_NONE, - CREATE_FILE, - CREATE_DIR -}; - -struct os9_diskinfo -{ - UINT32 total_sectors; - UINT32 sectors_per_track; - UINT32 allocation_bitmap_bytes; - UINT32 cluster_size; - UINT32 root_dir_lsn; - UINT32 owner_id; - UINT32 attributes; - UINT32 disk_id; - UINT32 format_flags; - UINT32 bootstrap_lsn; - UINT32 bootstrap_size; - UINT32 sector_size; - - unsigned int sides : 2; - unsigned int double_density : 1; - unsigned int double_track : 1; - unsigned int quad_track_density : 1; - unsigned int octal_track_density : 1; - - char name[33]; - UINT8 *allocation_bitmap; -}; - - -struct os9_fileinfo -{ - unsigned int directory : 1; - unsigned int non_sharable : 1; - unsigned int public_execute : 1; - unsigned int public_write : 1; - unsigned int public_read : 1; - unsigned int user_execute : 1; - unsigned int user_write : 1; - unsigned int user_read : 1; - - UINT32 lsn; - UINT32 owner_id; - UINT32 link_count; - UINT32 file_size; - - struct - { - UINT32 lsn; - UINT32 count; - } sector_map[48]; -}; - - -struct os9_direnum -{ - struct os9_fileinfo dir_info; - UINT32 index; -}; - - - -static void pick_string(const void *ptr, size_t offset, size_t length, char *dest) -{ - UINT8 b; - - while(length--) - { - b = ((UINT8 *) ptr)[offset++]; - *(dest++) = b & 0x7F; - if (b & 0x80) - length = 0; - } - *dest = '\0'; -} - - - -static void place_string(void *ptr, size_t offset, size_t length, const char *s) -{ - size_t i; - UINT8 b; - UINT8 *bptr; - - bptr = (UINT8 *) ptr; - bptr += offset; - - bptr[0] = 0x80; - - for (i = 0; s[i] && (i < length); i++) - { - b = ((UINT8) s[i]) & 0x7F; - if (s[i+1] == '\0') - b |= 0x80; - bptr[i] = b; - } -} - - - -static os9_diskinfo *os9_get_diskinfo(imgtool_image *image) -{ - return (os9_diskinfo *) imgtool_floppy_extrabytes(image); -} - - - -static struct os9_direnum *os9_get_dirinfo(imgtool_directory *directory) -{ - return (struct os9_direnum *) imgtool_directory_extrabytes(directory); -} - - - -static imgtoolerr_t os9_locate_lsn(imgtool_image *image, UINT32 lsn, UINT32 *head, UINT32 *track, UINT32 *sector) -{ - const os9_diskinfo *disk_info; - - disk_info = os9_get_diskinfo(image); - if (lsn > disk_info->total_sectors) - return IMGTOOLERR_CORRUPTIMAGE; - - *track = lsn / (disk_info->sectors_per_track * disk_info->sides); - *head = (lsn / disk_info->sectors_per_track) % disk_info->sides; - *sector = (lsn % disk_info->sectors_per_track) + 1; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t os9_read_lsn(imgtool_image *img, UINT32 lsn, int offset, void *buffer, size_t buffer_len) -{ - imgtoolerr_t err; - floperr_t ferr; - UINT32 head, track, sector; - - err = os9_locate_lsn(img, lsn, &head, &track, §or); - if (err) - return err; - - ferr = floppy_read_sector(imgtool_floppy(img), head, track, sector, offset, buffer, buffer_len); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t os9_write_lsn(imgtool_image *img, UINT32 lsn, int offset, const void *buffer, size_t buffer_len) -{ - imgtoolerr_t err; - floperr_t ferr; - UINT32 head, track, sector; - - err = os9_locate_lsn(img, lsn, &head, &track, §or); - if (err) - return err; - - ferr = floppy_write_sector(imgtool_floppy(img), head, track, sector, offset, buffer, buffer_len, 0); /* TODO: pass ddam argument from imgtool */ - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static UINT32 os9_lookup_lsn(imgtool_image *img, - const struct os9_fileinfo *file_info, UINT32 *index) -{ - int i; - UINT32 lsn; - const os9_diskinfo *disk_info; - - disk_info = os9_get_diskinfo(img); - lsn = *index / disk_info->sector_size; - - i = 0; - while(lsn >= file_info->sector_map[i].count) - lsn -= file_info->sector_map[i++].count; - - lsn = file_info->sector_map[i].lsn + lsn; - *index %= disk_info->sector_size; - return lsn; -} - - - -static int os9_interpret_dirent(void *entry, char **filename, UINT32 *lsn, int *corrupt) -{ - int i; - char *entry_b = (char *) entry; - - *filename = NULL; - *lsn = 0; - if (corrupt) - *corrupt = FALSE; - - if (entry_b[28] != '\0') - { - if (corrupt) - *corrupt = TRUE; - } - - for (i = 0; (i < 28) && !(entry_b[i] & 0x80); i++) - ; - entry_b[i] &= 0x7F; - entry_b[i+1] = '\0'; - - *lsn = pick_integer_be(entry, 29, 3); - if (strcmp(entry_b, ".") && strcmp(entry_b, "..")) - *filename = entry_b; - return *filename != NULL; -} - - - -/*------------------------------------------------- - os9_decode_file_header - reads a file/directory - entry from an LSN, and decodes it --------------------------------------------------*/ - -static imgtoolerr_t os9_decode_file_header(imgtool_image *image, - int lsn, struct os9_fileinfo *info) -{ - imgtoolerr_t err; - UINT32 attributes, count; - int max_entries, i; - const os9_diskinfo *disk_info; - UINT8 header[256]; - - disk_info = os9_get_diskinfo(image); - - err = os9_read_lsn(image, lsn, 0, header, sizeof(header)); - if (err) - return err; - - info->lsn = lsn; - attributes = pick_integer_be(header, 0, 1); - info->owner_id = pick_integer_be(header, 1, 2); - info->link_count = pick_integer_be(header, 8, 1); - info->file_size = pick_integer_be(header, 9, 4); - info->directory = (attributes & 0x80) ? 1 : 0; - info->non_sharable = (attributes & 0x40) ? 1 : 0; - info->public_execute = (attributes & 0x20) ? 1 : 0; - info->public_write = (attributes & 0x10) ? 1 : 0; - info->public_read = (attributes & 0x08) ? 1 : 0; - info->user_execute = (attributes & 0x04) ? 1 : 0; - info->user_write = (attributes & 0x02) ? 1 : 0; - info->user_read = (attributes & 0x01) ? 1 : 0; - - if (info->directory && (info->file_size % 32 != 0)) - return IMGTOOLERR_CORRUPTIMAGE; - - /* read all sector map entries */ - max_entries = (disk_info->sector_size - 16) / 5; - max_entries = MIN(max_entries, ARRAY_LENGTH(info->sector_map) - 1); - for (i = 0; i < max_entries; i++) - { - lsn = pick_integer_be(header, 16 + (i * 5) + 0, 3); - count = pick_integer_be(header, 16 + (i * 5) + 3, 2); - if (count <= 0) - break; - - info->sector_map[i].lsn = lsn; - info->sector_map[i].count = count; - } - info->sector_map[i].lsn = 0; - info->sector_map[i].count = 0; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t os9_allocate_lsn(imgtool_image *image, UINT32 *lsn) -{ - UINT32 i; - os9_diskinfo *disk_info; - UINT8 b, mask; - - disk_info = os9_get_diskinfo(image); - - for (i = 0; i < disk_info->total_sectors; i++) - { - b = disk_info->allocation_bitmap[i / 8]; - mask = 1 << (7 - (i % 8)); - - if ((b & mask) == 0) - { - disk_info->allocation_bitmap[i / 8] |= mask; - *lsn = i; - return os9_write_lsn(image, 1, 0, disk_info->allocation_bitmap, disk_info->allocation_bitmap_bytes); - } - } - return IMGTOOLERR_NOSPACE; -} - - - -static imgtoolerr_t os9_deallocate_lsn(imgtool_image *image, UINT32 lsn) -{ - UINT8 mask; - os9_diskinfo *disk_info; - - disk_info = os9_get_diskinfo(image); - mask = 1 << (7 - (lsn % 8)); - disk_info->allocation_bitmap[lsn / 8] &= ~mask; - return os9_write_lsn(image, 1, 0, disk_info->allocation_bitmap, disk_info->allocation_bitmap_bytes); -} - - - -static UINT32 os9_get_free_lsns(imgtool_image *image) -{ - const os9_diskinfo *disk_info; - UINT32 i, free_lsns; - UINT8 b; - - disk_info = os9_get_diskinfo(image); - free_lsns = 0; - - for (i = 0; i < disk_info->total_sectors; i++) - { - b = disk_info->allocation_bitmap[i / 8]; - b >>= (7 - (i % 8)); - free_lsns += ~b & 1; - } - - return free_lsns; -} - - - -static imgtoolerr_t os9_corrupt_file_error(const struct os9_fileinfo *file_info) -{ - imgtoolerr_t err; - if (file_info->directory) - err = IMGTOOLERR_CORRUPTDIR; - else - err = IMGTOOLERR_CORRUPTFILE; - return err; -} - - - -static imgtoolerr_t os9_set_file_size(imgtool_image *image, - struct os9_fileinfo *file_info, UINT32 new_size) -{ - imgtoolerr_t err; - const os9_diskinfo *disk_info; - UINT32 new_lsn_count, current_lsn_count; - UINT32 free_lsns, lsn, i; - int sector_map_length = -1; - UINT8 header[256]; - - /* easy way out? */ - if (file_info->file_size == new_size) - return IMGTOOLERR_SUCCESS; - - disk_info = os9_get_diskinfo(image); - - free_lsns = os9_get_free_lsns(image); - current_lsn_count = (file_info->file_size + disk_info->sector_size - 1) / disk_info->sector_size; - new_lsn_count = (new_size + disk_info->sector_size - 1) / disk_info->sector_size; - - /* check to see if the file is growing and we do not have enough space */ - if ((new_lsn_count > current_lsn_count) && (new_lsn_count - current_lsn_count > free_lsns)) - return IMGTOOLERR_NOSPACE; - - if (current_lsn_count != new_lsn_count) - { - /* first find out the size of our sector map */ - sector_map_length = 0; - lsn = 0; - while((lsn < current_lsn_count) && (sector_map_length < ARRAY_LENGTH(file_info->sector_map))) - { - if (file_info->sector_map[sector_map_length].count == 0) - return os9_corrupt_file_error(file_info); - - lsn += file_info->sector_map[sector_map_length].count; - sector_map_length++; - } - - /* keep in mind that the sector_map might not parallel our expected - * current LSN count; we should tolerate this abnormality */ - current_lsn_count = lsn; - - while(current_lsn_count > new_lsn_count) - { - /* shrink this file */ - lsn = file_info->sector_map[sector_map_length - 1].lsn + - file_info->sector_map[sector_map_length - 1].count - 1; - - err = os9_deallocate_lsn(image, lsn); - if (err) - return err; - - file_info->sector_map[sector_map_length - 1].count--; - while(sector_map_length > 0 && (file_info->sector_map[sector_map_length - 1].count == 0)) - sector_map_length--; - current_lsn_count--; - } - - while(current_lsn_count < new_lsn_count) - { - /* grow this file */ - err = os9_allocate_lsn(image, &lsn); - if (err) - return err; - - if ((sector_map_length > 0) && ((file_info->sector_map[sector_map_length - 1].lsn + - file_info->sector_map[sector_map_length - 1].count) == lsn)) - { - file_info->sector_map[sector_map_length - 1].count++; - } - else if (sector_map_length >= ARRAY_LENGTH(file_info->sector_map)) - { - return IMGTOOLERR_NOSPACE; - } - else - { - file_info->sector_map[sector_map_length].lsn = lsn; - file_info->sector_map[sector_map_length].count = 1; - sector_map_length++; - file_info->sector_map[sector_map_length].lsn = 0; - file_info->sector_map[sector_map_length].count = 0; - } - current_lsn_count++; - } - } - - /* now lets write back the sector */ - err = os9_read_lsn(image, file_info->lsn, 0, header, sizeof(header)); - if (err) - return err; - - file_info->file_size = new_size; - place_integer_be(header, 9, 4, file_info->file_size); - - /* do we have to write the sector map? */ - if (sector_map_length >= 0) - { - for (i = 0; i < MIN(sector_map_length + 1, ARRAY_LENGTH(file_info->sector_map)); i++) - { - place_integer_be(header, 16 + (i * 5) + 0, 3, file_info->sector_map[i].lsn); - place_integer_be(header, 16 + (i * 5) + 3, 2, file_info->sector_map[i].count); - } - } - - err = os9_write_lsn(image, file_info->lsn, 0, header, disk_info->sector_size); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -/*------------------------------------------------- - os9_lookup_path - walks an OS-9 directory - structure to find a file, or optionally, create - a file --------------------------------------------------*/ - -static imgtoolerr_t os9_lookup_path(imgtool_image *img, const char *path, - creation_policy_t create, struct os9_fileinfo *file_info, - UINT32 *parent_lsn, UINT32 *dirent_lsn, UINT32 *dirent_index) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - struct os9_fileinfo dir_info; - UINT32 index, current_lsn, dir_size; - UINT32 entry_index = 0; - UINT32 free_entry_index = 0xffffffff; - UINT32 entry_lsn = 0; - UINT32 allocated_lsn = 0; - UINT8 entry[32]; - UINT8 block[64]; - char *filename; - const os9_diskinfo *disk_info; - - disk_info = os9_get_diskinfo(img); - current_lsn = disk_info->root_dir_lsn; - - if (parent_lsn) - *parent_lsn = 0; - - /* we have to transverse each path element */ - while(*path) - { - if (parent_lsn) - *parent_lsn = current_lsn; - - /* decode the directory header of this directory */ - err = os9_decode_file_header(img, current_lsn, &dir_info); - if (err) - goto done; - dir_size = dir_info.file_size; - - /* sanity check directory */ - if (!dir_info.directory) - { - err = (current_lsn == disk_info->root_dir_lsn) ? IMGTOOLERR_CORRUPTIMAGE : IMGTOOLERR_INVALIDPATH; - goto done; - } - - /* walk the directory */ - for (index = 0; index < dir_size; index += 32) - { - entry_index = index; - entry_lsn = os9_lookup_lsn(img, &dir_info, &entry_index); - - err = os9_read_lsn(img, entry_lsn, entry_index, entry, sizeof(entry)); - if (err) - goto done; - - /* remember first free entry found */ - if( free_entry_index == 0xffffffff ) - { - if( entry[0] == 0 ) - free_entry_index = index; - } - - if (os9_interpret_dirent(entry, &filename, ¤t_lsn, NULL)) - { - if (!strcmp(path, filename)) - break; - } - - } - - /* at the end of the file? */ - if (index >= dir_size) - { - /* if we're not creating, or we are creating but we have not fully - * transversed the directory, error out */ - if (!create || path[strlen(path) + 1]) - { - err = IMGTOOLERR_PATHNOTFOUND; - goto done; - } - - /* allocate a new LSN */ - err = os9_allocate_lsn(img, &allocated_lsn); - if (err) - goto done; - - /* write the file */ - memset(block, 0, sizeof(block)); - place_integer_be(block, 0, 1, 0x1B | ((create == CREATE_DIR) ? 0x80 : 0x00)); - err = os9_write_lsn(img, allocated_lsn, 0, block, sizeof(block)); - if (err) - goto done; - - if( free_entry_index == 0xffffffff ) - { - /* expand the directory to hold the new entry */ - err = os9_set_file_size(img, &dir_info, dir_size + 32); - if (err) - goto done; - } - else - /* use first unused entry in directory */ - dir_size = free_entry_index; - - /* now prepare the directory entry */ - memset(entry, 0, sizeof(entry)); - place_string(entry, 0, 28, path); - place_integer_be(entry, 29, 3, allocated_lsn); - - /* now write the directory entry */ - entry_index = dir_size; - entry_lsn = os9_lookup_lsn(img, &dir_info, &entry_index); - err = os9_write_lsn(img, entry_lsn, entry_index, entry, 32); - if (err) - goto done; - - /* directory entry append complete; no need to hold this lsn */ - current_lsn = allocated_lsn; - allocated_lsn = 0; - } - path += strlen(path) + 1; - } - - if (file_info) - { - err = os9_decode_file_header(img, current_lsn, file_info); - if (err) - goto done; - } - - if (dirent_lsn) - *dirent_lsn = entry_lsn; - if (dirent_index) - *dirent_index = entry_index; - -done: - if (allocated_lsn != 0) - os9_deallocate_lsn(img, allocated_lsn); - return err; -} - - - -static imgtoolerr_t os9_diskimage_open(imgtool_image *image, imgtool_stream *stream) -{ - imgtoolerr_t err; - floperr_t ferr; - os9_diskinfo *info; - UINT32 track_size_in_sectors, i; //, attributes; - UINT8 header[256]; - UINT32 allocation_bitmap_lsns; - UINT8 b, mask; - - info = os9_get_diskinfo(image); - - ferr = floppy_read_sector(imgtool_floppy(image), 0, 0, 1, 0, header, sizeof(header)); - if (ferr) - return imgtool_floppy_error(ferr); - - info->total_sectors = pick_integer_be(header, 0, 3); - track_size_in_sectors = pick_integer_be(header, 3, 1); - info->allocation_bitmap_bytes = pick_integer_be(header, 4, 2); - info->cluster_size = pick_integer_be(header, 6, 2); - info->root_dir_lsn = pick_integer_be(header, 8, 3); - info->owner_id = pick_integer_be(header, 11, 2); -// attributes = - pick_integer_be(header, 13, 1); - info->disk_id = pick_integer_be(header, 14, 2); - info->format_flags = pick_integer_be(header, 16, 1); - info->sectors_per_track = pick_integer_be(header, 17, 2); - info->bootstrap_lsn = pick_integer_be(header, 21, 3); - info->bootstrap_size = pick_integer_be(header, 24, 2); - info->sector_size = pick_integer_be(header, 104, 2); - - info->sides = (info->format_flags & 0x01) ? 2 : 1; - info->double_density = (info->format_flags & 0x02) ? 1 : 0; - info->double_track = (info->format_flags & 0x04) ? 1 : 0; - info->quad_track_density = (info->format_flags & 0x08) ? 1 : 0; - info->octal_track_density = (info->format_flags & 0x10) ? 1 : 0; - - pick_string(header, 31, 32, info->name); - - if (info->sector_size == 0) - info->sector_size = 256; - - /* does the root directory and allocation bitmap collide? */ - allocation_bitmap_lsns = (info->allocation_bitmap_bytes + info->sector_size - 1) / info->sector_size; - if (1 + allocation_bitmap_lsns > info->root_dir_lsn) - return IMGTOOLERR_CORRUPTIMAGE; - - /* is the allocation bitmap too big? */ - info->allocation_bitmap = (UINT8*)imgtool_image_malloc(image, info->allocation_bitmap_bytes); - if (!info->allocation_bitmap) - return IMGTOOLERR_OUTOFMEMORY; - memset(info->allocation_bitmap, 0, info->allocation_bitmap_bytes); - - /* sectors per track and track size don't jive? */ - if (info->sectors_per_track != track_size_in_sectors) - return IMGTOOLERR_CORRUPTIMAGE; - - /* zero sectors per track? */ - if (info->sectors_per_track == 0) - return IMGTOOLERR_CORRUPTIMAGE; - - /* do we have an odd number of sectors? */ - if (info->total_sectors % info->sectors_per_track) - return IMGTOOLERR_CORRUPTIMAGE; - - /* read the allocation bitmap */ - for (i = 0; i < allocation_bitmap_lsns; i++) - { - err = os9_read_lsn(image, 1 + i, 0, &info->allocation_bitmap[i * info->sector_size], - MIN(info->allocation_bitmap_bytes - (i * info->sector_size), info->sector_size)); - if (err) - return err; - } - - /* check to make sure that the allocation bitmap and root sector are reserved */ - for (i = 0; i <= allocation_bitmap_lsns; i++) - { - b = info->allocation_bitmap[i / 8]; - mask = 1 << (7 - (i % 8)); - if ((b & mask) == 0) - return IMGTOOLERR_CORRUPTIMAGE; - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t os9_diskimage_create(imgtool_image *img, imgtool_stream *stream, option_resolution *opts) -{ - imgtoolerr_t err; - dynamic_buffer header; - UINT32 heads, tracks, sectors, sector_bytes, first_sector_id; - UINT32 cluster_size, owner_id; - UINT32 allocation_bitmap_bits, allocation_bitmap_lsns; - UINT32 attributes, format_flags, disk_id; - UINT32 i; - INT32 total_allocated_sectors; - const char *title; - time_t t; - struct tm *ltime; - - time(&t); - ltime = localtime(&t); - - heads = option_resolution_lookup_int(opts, 'H'); - tracks = option_resolution_lookup_int(opts, 'T'); - sectors = option_resolution_lookup_int(opts, 'S'); - sector_bytes = option_resolution_lookup_int(opts, 'L'); - first_sector_id = option_resolution_lookup_int(opts, 'F'); - title = ""; - - header.resize(sector_bytes); - - if (sector_bytes > 256) - sector_bytes = 256; - cluster_size = 1; - owner_id = 1; - disk_id = 1; - attributes = 0; - allocation_bitmap_bits = heads * tracks * sectors / cluster_size; - allocation_bitmap_lsns = (allocation_bitmap_bits / 8 + sector_bytes - 1) / sector_bytes; - format_flags = ((heads > 1) ? 0x01 : 0x00) | ((tracks > 40) ? 0x02 : 0x00); - - memset(&header[0], 0, sector_bytes); - place_integer_be(&header[0], 0, 3, heads * tracks * sectors); - place_integer_be(&header[0], 3, 1, sectors); - place_integer_be(&header[0], 4, 2, (allocation_bitmap_bits + 7) / 8); - place_integer_be(&header[0], 6, 2, cluster_size); - place_integer_be(&header[0], 8, 3, 1 + allocation_bitmap_lsns); - place_integer_be(&header[0], 11, 2, owner_id); - place_integer_be(&header[0], 13, 1, attributes); - place_integer_be(&header[0], 14, 2, disk_id); - place_integer_be(&header[0], 16, 1, format_flags); - place_integer_be(&header[0], 17, 2, sectors); - place_string(&header[0], 31, 32, title); - place_integer_be(&header[0], 103, 2, sector_bytes / 256); - - /* path descriptor options */ - place_integer_be(&header[0], 0x3f+0x00, 1, 1); /* device class */ - place_integer_be(&header[0], 0x3f+0x01, 1, 1); /* drive number */ - place_integer_be(&header[0], 0x3f+0x03, 1, 0x20); /* device type */ - place_integer_be(&header[0], 0x3f+0x04, 1, 1); /* density capability */ - place_integer_be(&header[0], 0x3f+0x05, 2, tracks); /* number of tracks */ - place_integer_be(&header[0], 0x3f+0x07, 1, heads); /* number of sides */ - place_integer_be(&header[0], 0x3f+0x09, 2, sectors); /* sectors per track */ - place_integer_be(&header[0], 0x3f+0x0b, 2, sectors); /* sectors on track zero */ - place_integer_be(&header[0], 0x3f+0x0d, 1, 3); /* sector interleave factor */ - place_integer_be(&header[0], 0x3f+0x0e, 1, 8); /* default sectors per allocation */ - - err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id, 0, &header[0], sector_bytes, 0); /* TODO: pass ddam argument from imgtool */ - if (err) - goto done; - - total_allocated_sectors = 1 + allocation_bitmap_lsns + 1 + 7; - - for (i = 0; i < allocation_bitmap_lsns; i++) - { - memset(&header[0], 0x00, sector_bytes); - - if (total_allocated_sectors > (8 * 256)) - { - memset(&header[0], 0xff, sector_bytes); - total_allocated_sectors -= (8 * 256); - } - else if (total_allocated_sectors > 1 ) - { - int offset; - UINT8 mask; - - while( total_allocated_sectors >= 0 ) - { - offset = total_allocated_sectors / 8; - mask = 1 << (7 - ( total_allocated_sectors % 8 ) ); - - header[offset] |= mask; - total_allocated_sectors--; - } - } - - err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + i, 0, &header[0], sector_bytes, 0); /* TODO: pass ddam argument from imgtool */ - if (err) - goto done; - } - - memset(&header[0], 0, sector_bytes); - header[0x00] = 0xBF; - header[0x01] = 0x00; - header[0x02] = 0x00; - header[0x03] = (UINT8) ltime->tm_year; - header[0x04] = (UINT8) ltime->tm_mon + 1; - header[0x05] = (UINT8) ltime->tm_mday; - header[0x06] = (UINT8) ltime->tm_hour; - header[0x07] = (UINT8) ltime->tm_min; - header[0x08] = 0x02; - header[0x09] = 0x00; - header[0x0A] = 0x00; - header[0x0B] = 0x00; - header[0x0C] = 0x40; - header[0x0D] = (UINT8) (ltime->tm_year % 100); - header[0x0E] = (UINT8) ltime->tm_mon; - header[0x0F] = (UINT8) ltime->tm_mday; - place_integer_be(&header[0], 0x10, 3, 1 + allocation_bitmap_lsns + 1); - place_integer_be(&header[0], 0x13, 2, 8); - - err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + allocation_bitmap_lsns, 0, &header[0], sector_bytes, 0); /* TODO: pass ddam argument from imgtool */ - if (err) - goto done; - - memset(&header[0], 0, sector_bytes); - header[0x00] = 0x2E; - header[0x01] = 0xAE; - header[0x1F] = 1 + allocation_bitmap_lsns; - header[0x20] = 0xAE; - header[0x3F] = 1 + allocation_bitmap_lsns; - err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 2 + allocation_bitmap_lsns, 0, &header[0], sector_bytes, 0); /* TOOD: pass ddam argument from imgtool */ - if (err) - goto done; - -done: - return err; -} - - - -static imgtoolerr_t os9_diskimage_beginenum(imgtool_directory *enumeration, const char *path) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - struct os9_direnum *os9enum; - imgtool_image *image; - - image = imgtool_directory_image(enumeration); - os9enum = os9_get_dirinfo(enumeration); - - err = os9_lookup_path(image, path, CREATE_NONE, &os9enum->dir_info, NULL, NULL, NULL); - if (err) - goto done; - - /* this had better be a directory */ - if (!os9enum->dir_info.directory) - { - err = IMGTOOLERR_CORRUPTIMAGE; - goto done; - } - -done: - return err; -} - - - -static imgtoolerr_t os9_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - struct os9_direnum *os9enum; - UINT32 lsn, index; - imgtoolerr_t err; - UINT8 dir_entry[32]; - char filename[29]; - struct os9_fileinfo file_info; - imgtool_image *image; - - image = imgtool_directory_image(enumeration); - os9enum = os9_get_dirinfo(enumeration); - - do - { - /* check for EOF */ - if (os9enum->index >= os9enum->dir_info.file_size) - { - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - - /* locate the LSN and offset for this directory entry */ - index = os9enum->index; - lsn = os9_lookup_lsn(image, &os9enum->dir_info, &index); - - /* read the directory entry out of the lSN */ - err = os9_read_lsn(image, lsn, index, dir_entry, sizeof(dir_entry)); - if (err) - return err; - - if (dir_entry[0]) - { - /* read the file or directory name */ - pick_string(dir_entry, 0, 28, filename); - - /* we have certain expectations of the directory contents; the - * first directory entry should be "..", the second ".", and - * subsequent entries should never be "." or ".." */ - switch(os9enum->index) - { - case 0: - if (strcmp(filename, "..")) - imgtool_warn("First entry in directory should be \"..\" and not \"%s\"", filename); - break; - - case 32: - if (strcmp(filename, ".")) - imgtool_warn("Second entry in directory should be \".\" and not \"%s\"", filename); - break; - - default: - if (!strcmp(filename, ".") || !strcmp(filename, "..")) - imgtool_warn("Directory entry %d should not be \"%s\"", index / 32, filename); - break; - } - - /* if the filename is ".", the file should point to the current directory */ - if (!strcmp(filename, ".") && (pick_integer_be(dir_entry, 29, 3) != os9enum->dir_info.lsn)) - { - imgtool_warn("Directory \".\" does not point back to same directory"); - } - } - else - { - /* no more directory entries */ - filename[0] = '\0'; - } - - /* move on to the next directory entry */ - os9enum->index += 32; - } - while(!filename[0] || !strcmp(filename, ".") || !strcmp(filename, "..")); - - /* read file attributes */ - lsn = pick_integer_be(dir_entry, 29, 3); - err = os9_decode_file_header(imgtool_directory_image(enumeration), lsn, &file_info); - if (err) - return err; - - /* fill out imgtool_dirent structure */ - snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", filename); - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c%c%c%c%c%c%c%c", - file_info.directory ? 'd' : '-', - file_info.non_sharable ? 's' : '-', - file_info.public_execute ? 'x' : '-', - file_info.public_write ? 'w' : '-', - file_info.public_read ? 'r' : '-', - file_info.user_execute ? 'x' : '-', - file_info.user_write ? 'w' : '-', - file_info.user_read ? 'r' : '-'); - - ent->directory = file_info.directory; - ent->corrupt = (dir_entry[28] != 0); - ent->filesize = file_info.file_size; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t os9_diskimage_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtool_image *image = imgtool_partition_image(partition); - const os9_diskinfo *disk_info; - UINT32 free_lsns; - - disk_info = os9_get_diskinfo(image); - free_lsns = os9_get_free_lsns(image); - - *size = free_lsns * disk_info->sector_size; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t os9_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t err; - imgtool_image *img = imgtool_partition_image(partition); - const os9_diskinfo *disk_info; - struct os9_fileinfo file_info; - UINT8 buffer[256]; - int i, j; - UINT32 file_size; - UINT32 used_size; - - disk_info = os9_get_diskinfo(img); - - err = os9_lookup_path(img, filename, CREATE_NONE, &file_info, NULL, NULL, NULL); - if (err) - return err; - if (file_info.directory) - return IMGTOOLERR_FILENOTFOUND; - file_size = file_info.file_size; - - for (i = 0; file_info.sector_map[i].count > 0; i++) - { - for (j = 0; j < file_info.sector_map[i].count; j++) - { - used_size = MIN(file_size, disk_info->sector_size); - err = os9_read_lsn(img, file_info.sector_map[i].lsn + j, 0, - buffer, used_size); - if (err) - return err; - stream_write(destf, buffer, used_size); - file_size -= used_size; - } - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t os9_diskimage_writefile(imgtool_partition *partition, const char *path, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - struct os9_fileinfo file_info; - size_t write_size; - dynamic_buffer buf; - int i = -1; - UINT32 lsn = 0; - UINT32 count = 0; - UINT32 sz; - const os9_diskinfo *disk_info; - - disk_info = os9_get_diskinfo(image); - - buf.resize(disk_info->sector_size); - - err = os9_lookup_path(image, path, CREATE_FILE, &file_info, NULL, NULL, NULL); - if (err) - goto done; - - sz = (UINT32) stream_size(sourcef); - - err = os9_set_file_size(image, &file_info, sz); - if (err) - goto done; - - while(sz > 0) - { - write_size = (size_t) MIN(sz, (UINT64) disk_info->sector_size); - - stream_read(sourcef, &buf[0], write_size); - - while(count == 0) - { - i++; - lsn = file_info.sector_map[i].lsn; - count = file_info.sector_map[i].count; - } - - err = os9_write_lsn(image, lsn, 0, &buf[0], write_size); - if (err) - goto done; - - lsn++; - count--; - sz -= write_size; - } - -done: - return err; -} - - - -static imgtoolerr_t os9_diskimage_delete(imgtool_partition *partition, const char *path, - unsigned int delete_directory) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - //const os9_diskinfo *disk_info; - struct os9_fileinfo file_info; - UINT32 dirent_lsn, dirent_index; - UINT32 entry_lsn, entry_index; - UINT32 i, j, lsn; - UINT8 b; - - //disk_info = os9_get_diskinfo(image); - - err = os9_lookup_path(image, path, CREATE_NONE, &file_info, NULL, &dirent_lsn, &dirent_index); - if (err) - return err; - if (file_info.directory != delete_directory) - return IMGTOOLERR_FILENOTFOUND; - - /* make sure that if we are deleting a directory, it is empty */ - if (delete_directory) - { - for (i = 64; i < file_info.file_size; i += 32) - { - entry_index = i; - entry_lsn = os9_lookup_lsn(image, &file_info, &entry_index); - - err = os9_read_lsn(image, entry_lsn, entry_index, &b, 1); - if (err) - return err; - - /* this had better be a deleted file, if not we can't delete */ - if (b != 0) - return IMGTOOLERR_DIRNOTEMPTY; - } - } - - /* zero out the file entry */ - b = '\0'; - err = os9_write_lsn(image, dirent_lsn, dirent_index, &b, 1); - if (err) - return err; - - /* get the link count */ - err = os9_read_lsn(image, file_info.lsn, 8, &b, 1); - if (err) - return err; - - if (b > 0) - b--; - if (b > 0) - { - /* link count is greater than zero */ - err = os9_write_lsn(image, file_info.lsn, 8, &b, 1); - if (err) - return err; - } - else - { - /* no more links; outright delete the file */ - err = os9_deallocate_lsn(image, file_info.lsn); - if (err) - return err; - - for (i = 0; (i < ARRAY_LENGTH(file_info.sector_map)) && file_info.sector_map[i].count; i++) - { - lsn = file_info.sector_map[i].lsn; - for (j = 0; j < file_info.sector_map[i].count; j++) - { - err = os9_deallocate_lsn(image, lsn + j); - if (err) - return err; - } - } - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t os9_diskimage_deletefile(imgtool_partition *partition, const char *path) -{ - return os9_diskimage_delete(partition, path, 0); -} - - - -static imgtoolerr_t os9_diskimage_createdir(imgtool_partition *partition, const char *path) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - struct os9_fileinfo file_info; - UINT8 dir_data[64]; - UINT32 parent_lsn; - - err = os9_lookup_path(image, path, CREATE_DIR, &file_info, &parent_lsn, NULL, NULL); - if (err) - goto done; - - err = os9_set_file_size(image, &file_info, 64); - if (err) - goto done; - - /* create intial directories */ - memset(dir_data, 0, sizeof(dir_data)); - place_string(dir_data, 0, 32, ".."); - place_integer_be(dir_data, 29, 3, parent_lsn); - place_string(dir_data, 32, 32, "."); - place_integer_be(dir_data, 61, 3, file_info.lsn); - - err = os9_write_lsn(image, file_info.sector_map[0].lsn, 0, dir_data, sizeof(dir_data)); - if (err) - goto done; - -done: - return err; -} - - - -static imgtoolerr_t os9_diskimage_deletedir(imgtool_partition *partition, const char *path) -{ - return os9_diskimage_delete(partition, path, 1); -} - - - -void os9_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break; - case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break; - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(os9_diskinfo); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct os9_direnum); break; - case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "os9"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "OS-9 format"); break; - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; - case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = os9_diskimage_create; break; - case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = os9_diskimage_open; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = os9_diskimage_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = os9_diskimage_nextenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = os9_diskimage_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = os9_diskimage_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = os9_diskimage_writefile; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = os9_diskimage_deletefile; break; - case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = os9_diskimage_createdir; break; - case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = os9_diskimage_deletedir; break; - case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_coco; break; - } -} diff --git a/src/mess/tools/imgtool/modules/pc_flop.c b/src/mess/tools/imgtool/modules/pc_flop.c deleted file mode 100644 index 916cf873c46..00000000000 --- a/src/mess/tools/imgtool/modules/pc_flop.c +++ /dev/null @@ -1,173 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/**************************************************************************** - - pc_flop.c - - PC floppies - -****************************************************************************/ - -#include "imgtool.h" -#include "formats/imageutl.h" -#include "formats/pc_dsk.h" -#include "fat.h" -#include "iflopimg.h" - -#define FAT_SECLEN 512 - - -static imgtoolerr_t fat_image_create(imgtool_image *image, imgtool_stream *stream, option_resolution *opts) -{ - imgtoolerr_t err; - UINT32 tracks, heads, sectors; - UINT8 buffer[FAT_SECLEN]; - imgtool_class imgclass = { fat_get_info }; - imgtoolerr_t (*fat_partition_create)(imgtool_image *image, UINT64 first_block, UINT64 block_count); - - tracks = option_resolution_lookup_int(opts, 'T'); - heads = option_resolution_lookup_int(opts, 'H'); - sectors = option_resolution_lookup_int(opts, 'S'); - - /* set up just enough of a boot sector to specify geometry */ - memset(buffer, 0, sizeof(buffer)); - place_integer_le(buffer, 24, 2, sectors); - place_integer_le(buffer, 26, 2, heads); - place_integer_le(buffer, 19, 2, (UINT16) (((UINT64) tracks * heads * sectors) >> 0)); - place_integer_le(buffer, 32, 4, (UINT16) (((UINT64) tracks * heads * sectors) >> 16)); - err = imgtool_image_write_block(image, 0, buffer); - if (err) - goto done; - - /* load fat_partition_create */ - fat_partition_create = (imgtoolerr_t (*)(imgtool_image *, UINT64, UINT64)) - imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CREATE_PARTITION); - - /* actually create the partition */ - err = fat_partition_create(image, 0, ((UINT64) tracks) * heads * sectors); - if (err) - goto done; - -done: - return err; -} - - - -static imgtoolerr_t fat_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors) -{ - imgtoolerr_t err; - UINT64 total_sectors; - UINT8 buffer[FAT_SECLEN]; - - err = imgtool_image_read_block(image, 0, buffer); - if (err) - return err; - - total_sectors = pick_integer_le(buffer, 19, 2) - | (pick_integer_le(buffer, 32, 4) << 16); - - *sectors = pick_integer_le(buffer, 24, 2); - *heads = pick_integer_le(buffer, 26, 2); - *tracks = total_sectors / *heads / *sectors; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_get_sector_position(imgtool_image *image, UINT32 sector_index, - UINT32 *track, UINT32 *head, UINT32 *sector) -{ - imgtoolerr_t err; - UINT32 tracks, heads, sectors; - - if (sector_index == 0) - { - /* special case */ - *head = 0; - *track = 0; - *sector = 1; - } - else - { - err = imgtool_image_get_geometry(image, &tracks, &heads, §ors); - if (err) - return err; - - *track = sector_index / sectors / heads; - *head = (sector_index / sectors) % heads; - *sector = 1 + (sector_index % sectors); - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_image_readblock(imgtool_image *image, void *buffer, UINT64 block) -{ - imgtoolerr_t err; - floperr_t ferr; - UINT32 track, head, sector; - UINT32 block_size; - - err = imgtool_image_get_block_size(image, &block_size); - if (err) - return err; - - err = fat_get_sector_position(image, block, &track, &head, §or); - if (err) - return err; - - ferr = floppy_read_sector(imgtool_floppy(image), head, track, sector, 0, buffer, block_size); - if (ferr) - return imgtool_floppy_error(ferr); - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t fat_image_writeblock(imgtool_image *image, const void *buffer, UINT64 block) -{ - imgtoolerr_t err; - floperr_t ferr; - UINT32 track, head, sector; - UINT32 block_size; - - err = imgtool_image_get_block_size(image, &block_size); - if (err) - return err; - - err = fat_get_sector_position(image, block, &track, &head, §or); - if (err) - return err; - - ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, block_size, 0); /* TODO: pass ddam argument from imgtool */ - if (ferr) - return imgtool_floppy_error(ferr); - return IMGTOOLERR_SUCCESS; -} - - - -void pc_floppy_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_BLOCK_SIZE: info->i = FAT_SECLEN; break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "fat"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "FAT format"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; - case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = fat_image_create; break; - case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_pc; break; - case IMGTOOLINFO_PTR_READ_BLOCK: info->read_block = fat_image_readblock; break; - case IMGTOOLINFO_PTR_WRITE_BLOCK: info->write_block = fat_image_writeblock; break; - case IMGTOOLINFO_PTR_GET_GEOMETRY: info->get_geometry = fat_image_get_geometry; break; - - default: fat_get_info(imgclass, state, info); break; - } -} diff --git a/src/mess/tools/imgtool/modules/pc_hard.c b/src/mess/tools/imgtool/modules/pc_hard.c deleted file mode 100644 index 915032932c7..00000000000 --- a/src/mess/tools/imgtool/modules/pc_hard.c +++ /dev/null @@ -1,470 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/**************************************************************************** - - pc_hard.c - - PC hard drives - -***************************************************************************** - - Master boot record format: - - Offset Length Description - ------ ------ ----------- - 0 446 Boot machine code - 446 16 Partion #1 info - 462 16 Partion #2 info - 478 16 Partion #3 info - 494 16 Partion #4 info - 510 2 Magic bytes (0x55 0xAA) - - - Partition info format: - - Offset Length Description - ------ ------ ----------- - 0 1 Bootable (0x80=bootable 0x00=not bootable) - 1 1 Starting head - 2 1 Starting sector (bits 5-0) and high bits of starting track (bits 6-5) - 3 1 Low bits of starting track - 4 1 Partition type: - 0x00 Unused - 0x?1 FAT12 (0-15 MB) - 0x?2 XENIX - 0x?4 FAT16 (16-32 MB) - 0x?6 FAT16` (32 MB-2 GB) - 0x?7 HPFS or NTFS - 0x?A Boot Manager - 0x?B FAT32 (512 MB-2 TB) - 0x?C FAT32 (512 MB-2 TB LBA) - 0x1? OS/2 Boot manager/Win95 hidden - 0xC? DR-DOS secured partition - 0xD? Multiuser DOS secured partition - 0xE? SpeedStor extended partition - 5 1 Ending head - 6 1 Ending sector (bits 5-0) and high bits of ending track (bits 6-5) - 7 1 Low bits of ending track - 8 4 Sector index of beginning of partition - 12 4 Total sectors in partition - -****************************************************************************/ -#include "imgtool.h" -#include "formats/imageutl.h" -#include "imghd.h" - -#define FAT_SECLEN 512 - -static OPTION_GUIDE_START( pc_chd_create_optionguide ) - OPTION_INT('T', "cylinders", "Cylinders" ) - OPTION_INT('H', "heads", "Heads" ) - OPTION_INT('S', "sectors", "Sectors" ) -OPTION_GUIDE_END - -static const char pc_chd_create_optionspec[] = "H1-[16]S1-[32]-63T10/20/30/40/50/60/70/80/90/[100]/110/120/130/140/150/160/170/180/190/200"; - -static const char fat8_string[8] = { 'F', 'A', 'T', ' ', ' ', ' ', ' ', ' ' }; -static const char fat12_string[8] = { 'F', 'A', 'T', '1', '2', ' ', ' ', ' ' }; -static const char fat16_string[8] = { 'F', 'A', 'T', '1', '6', ' ', ' ', ' ' }; -//static const char fat32_string[8] = { 'F', 'A', 'T', '3', '2', ' ', ' ', ' ' }; - -/* imports from fat.c */ -extern void fat_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info); - - -struct pc_chd_image_info -{ - struct mess_hard_disk_file hard_disk; - - struct - { - unsigned int corrupt : 1; - UINT8 partition_type; - UINT32 fat_bits; - UINT32 starting_track; - UINT32 starting_head; - UINT32 starting_sector; - UINT32 ending_track; - UINT32 ending_head; - UINT32 ending_sector; - UINT32 sector_index; - UINT32 total_sectors; - } partitions[4]; -}; - - - -static pc_chd_image_info *pc_chd_get_image_info(imgtool_image *image) -{ - return (pc_chd_image_info *) imgtool_image_extra_bytes(image); -} - - - -static void pc_chd_locate_block(imgtool_image *image, UINT64 block, UINT32 *cylinder, UINT32 *head, UINT32 *sector) -{ - pc_chd_image_info *info; - const hard_disk_info *hd_info; - - info = pc_chd_get_image_info(image); - hd_info = imghd_get_header(&info->hard_disk); - - *sector = block % hd_info->sectors; - *head = (block / hd_info->sectors) % hd_info->heads; - *cylinder = block / hd_info->sectors / hd_info->heads; -} - - - -static imgtoolerr_t pc_chd_partition_create(imgtool_image *image, int partition_index, UINT64 first_block, UINT64 block_count) -{ - imgtoolerr_t err; - UINT8 header_block[FAT_SECLEN]; - UINT8 partition_block[FAT_SECLEN]; - UINT8 partition_type; - UINT8 *fat_type; - UINT8 *partition_entry; - UINT32 first_cylinder, first_head, first_sector; - UINT32 last_cylinder, last_head, last_sector; - imgtool_class imgclass = { fat_get_info }; - imgtoolerr_t (*fat_partition_create)(imgtool_image *image, UINT64 first_block, UINT64 block_count); - - /* sanity checks */ - assert((partition_index >= 0) && (partition_index <= 3)); - - /* compute geometry */ - pc_chd_locate_block(image, first_block, &first_cylinder, &first_head, &first_sector); - pc_chd_locate_block(image, first_block + block_count - 1, &last_cylinder, &last_head, &last_sector); - - /* load fat_partition_create */ - fat_partition_create = (imgtoolerr_t (*)(imgtool_image *, UINT64, UINT64)) - imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CREATE_PARTITION); - - /* first create the actual partition */ - err = fat_partition_create(image, first_block, block_count); - if (err) - goto done; - - /* read the first block of the partition, to determine the type of FAT */ - err = imgtool_image_read_block(image, first_block, partition_block); - if (err) - goto done; - fat_type = &partition_block[54]; - if (!memcmp(fat_type, fat8_string, sizeof(fat8_string))) - partition_type = 0x01; - else if (!memcmp(fat_type, fat12_string, sizeof(fat12_string))) - partition_type = 0x01; - else if ((!memcmp(fat_type, fat16_string, sizeof(fat16_string))) && (block_count < 32*1024*1024/FAT_SECLEN)) - partition_type = 0x04; - else if ((!memcmp(fat_type, fat16_string, sizeof(fat16_string))) && (block_count >= 32*1024*1024/FAT_SECLEN)) - partition_type = 0x06; - else - partition_type = 0x0B; - - /* read the partition header */ - err = imgtool_image_read_block(image, 0, header_block); - if (err) - goto done; - - /* fill out the partition entry */ - partition_entry = &header_block[446 + (partition_index * 16)]; - place_integer_le(partition_entry, 0, 1, 0x80); - place_integer_le(partition_entry, 1, 1, first_head); - place_integer_le(partition_entry, 2, 1, ((first_sector & 0x3F) | (first_cylinder >> 8 << 2))); - place_integer_le(partition_entry, 3, 1, first_cylinder); - place_integer_le(partition_entry, 4, 1, partition_type); - place_integer_le(partition_entry, 5, 1, last_head); - place_integer_le(partition_entry, 6, 1, ((last_sector & 0x3F) | (last_cylinder >> 8 << 2))); - place_integer_le(partition_entry, 7, 1, last_cylinder); - place_integer_le(partition_entry, 8, 4, first_block); - place_integer_le(partition_entry, 12, 4, block_count); - - /* write the partition header */ - err = imgtool_image_write_block(image, 0, header_block); - if (err) - goto done; - -done: - return err; -} - - - -static imgtoolerr_t pc_chd_read_partition_header(imgtool_image *image) -{ - imgtoolerr_t err; - int i; - const UINT8 *partition_info; - pc_chd_image_info *info; - UINT8 buffer[FAT_SECLEN]; - - info = pc_chd_get_image_info(image); - - /* read the initial block */ - err = imgtool_image_read_block(image, 0, buffer); - if (err) - return err; - - /* magic bytes present? */ - if ((buffer[510] != 0x55) || (buffer[511] != 0xAA)) - return IMGTOOLERR_CORRUPTIMAGE; - - for (i = 0; i < ARRAY_LENGTH(info->partitions); i++) - { - partition_info = &buffer[446 + i * 16]; - - info->partitions[i].partition_type = partition_info[4]; - info->partitions[i].starting_head = partition_info[1]; - info->partitions[i].starting_track = ((partition_info[2] << 2) & 0xFF00) | partition_info[3]; - info->partitions[i].starting_sector = partition_info[2] & 0x3F; - info->partitions[i].ending_head = partition_info[5]; - info->partitions[i].ending_track = ((partition_info[6] << 2) & 0xFF00) | partition_info[7]; - info->partitions[i].ending_sector = partition_info[6] & 0x3F; - - info->partitions[i].sector_index = pick_integer_le(partition_info, 8, 4); - info->partitions[i].total_sectors = pick_integer_le(partition_info, 12, 4); - - if (info->partitions[i].starting_track > info->partitions[i].ending_track) - return IMGTOOLERR_CORRUPTIMAGE; - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t pc_chd_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *opts) -{ - imgtoolerr_t err; - UINT32 cylinders, heads, sectors; - pc_chd_image_info *info; - UINT8 header_block[FAT_SECLEN]; - - cylinders = option_resolution_lookup_int(opts, 'T'); - heads = option_resolution_lookup_int(opts, 'H'); - sectors = option_resolution_lookup_int(opts, 'S'); - - info = pc_chd_get_image_info(image); - - /* create the hard disk image */ - err = imghd_create(f, 0, cylinders, heads, sectors, FAT_SECLEN); - if (err) - goto done; - - err = imghd_open(f, &info->hard_disk); - if (err) - goto done; - - /* set up partition header block */ - memset(header_block, 0, sizeof(header_block)); - header_block[510] = 0x55; - header_block[511] = 0xAA; - err = imgtool_image_write_block(image, 0, header_block); - if (err) - goto done; - - err = pc_chd_partition_create(image, 0, 1, cylinders * heads * sectors - 1); - if (err) - goto done; - - err = pc_chd_read_partition_header(image); - if (err) - goto done; - -done: - if (err) - imghd_close(&info->hard_disk); - return err; -} - - - -static imgtoolerr_t pc_chd_image_open(imgtool_image *image, imgtool_stream *stream) -{ - imgtoolerr_t err; - pc_chd_image_info *info; - - info = pc_chd_get_image_info(image); - - /* open the hard drive */ - err = imghd_open(stream, &info->hard_disk); - if (err) - return err; - - err = pc_chd_read_partition_header(image); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static void pc_chd_image_close(imgtool_image *image) -{ - pc_chd_image_info *info; - info = pc_chd_get_image_info(image); - imghd_close(&info->hard_disk); -} - - - -static imgtoolerr_t pc_chd_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors) -{ - pc_chd_image_info *info; - const hard_disk_info *hd_info; - - info = pc_chd_get_image_info(image); - hd_info = imghd_get_header(&info->hard_disk); - - *tracks = hd_info->cylinders; - *heads = hd_info->heads; - *sectors = hd_info->sectors; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t pc_chd_image_getsectorsize(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size) -{ - pc_chd_image_info *info; - info = pc_chd_get_image_info(image); - *sector_size = imghd_get_header(&info->hard_disk)->sectorbytes; - return IMGTOOLERR_SUCCESS; -} - - - -static UINT32 pc_chd_calc_lbasector(pc_chd_image_info *info, UINT32 track, UINT32 head, UINT32 sector) -{ - UINT32 lbasector; - const hard_disk_info *hd_info; - - hd_info = imghd_get_header(&info->hard_disk); - lbasector = track; - lbasector *= hd_info->heads; - lbasector += head; - lbasector *= hd_info->sectors; - lbasector += sector; - return lbasector; -} - - - -static imgtoolerr_t pc_chd_image_readsector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len) -{ - pc_chd_image_info *info; - info = pc_chd_get_image_info(image); - return imghd_read(&info->hard_disk, - pc_chd_calc_lbasector(info, track, head, sector), - buffer); -} - - - -static imgtoolerr_t pc_chd_image_writesector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam) -{ - pc_chd_image_info *info; - info = pc_chd_get_image_info(image); - return imghd_write(&info->hard_disk, - pc_chd_calc_lbasector(info, track, head, sector), - buffer); -} - - - -static imgtoolerr_t pc_chd_image_readblock(imgtool_image *image, void *buffer, UINT64 block) -{ - pc_chd_image_info *info; - info = pc_chd_get_image_info(image); - return imghd_read(&info->hard_disk, block, buffer); -} - - - -static imgtoolerr_t pc_chd_image_writeblock(imgtool_image *image, const void *buffer, UINT64 block) -{ - pc_chd_image_info *info; - info = pc_chd_get_image_info(image); - return imghd_write(&info->hard_disk, block, buffer); -} - - - -static imgtoolerr_t pc_chd_list_partitions(imgtool_image *image, imgtool_partition_info *partitions, size_t len) -{ - pc_chd_image_info *info; - size_t i; - - info = pc_chd_get_image_info(image); - - for (i = 0; i < MIN(4, len); i++) - { - partitions[i].base_block = info->partitions[i].sector_index; - partitions[i].block_count = info->partitions[i].total_sectors; - - switch(info->partitions[i].partition_type) - { - case 0x00: /* Empty Partition */ - partitions[i].get_info = NULL; - break; - - case 0x01: /* FAT12 */ - case 0x04: /* FAT16 (-32 MB) */ - case 0x06: /* FAT16 (32+ MB) */ - case 0x0B: /* FAT32 */ - case 0x0C: /* FAT32 (LBA Mapped) */ - case 0x0E: /* FAT16 (LBA Mapped) */ - case 0x11: /* OS/2 FAT12 */ - case 0x14: /* OS/2 FAT16 (-32 MB) */ - case 0x16: /* OS/2 FAT16 (32+ MB) */ - case 0x1B: /* Hidden Win95 FAT32 */ - case 0x1C: /* Hidden Win95 FAT32 (LBA Mapped) */ - case 0x1D: /* Hidden Win95 FAT16 (LBA Mapped) */ - case 0xC1: /* DR-DOS FAT12 */ - case 0xC4: /* DR-DOS FAT16 (-32 MB) */ - case 0xC6: /* DR-DOS FAT16 (32+ MB) */ - case 0xD1: /* Old Multiuser DOS FAT12 */ - case 0xD4: /* Old Multiuser DOS FAT16 (-32 MB) */ - case 0xD6: /* Old Multiuser DOS FAT16 (32+ MB) */ - partitions[i].get_info = fat_get_info; - break; - - default: - partitions[i].get_info = unknown_partition_get_info; - break; - } - } - return IMGTOOLERR_SUCCESS; -} - - - -void pc_chd_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_BLOCK_SIZE: info->i = FAT_SECLEN; break; - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(pc_chd_image_info); break; - case IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS: info->i = 1; break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc_chd"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "PC CHD disk image"); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "chd"); break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), pc_chd_create_optionspec); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_CREATE: info->create = pc_chd_image_create; break; - case IMGTOOLINFO_PTR_OPEN: info->open = pc_chd_image_open; break; - case IMGTOOLINFO_PTR_CLOSE: info->close = pc_chd_image_close; break; - case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = pc_chd_image_readsector; break; - case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = pc_chd_image_writesector; break; - case IMGTOOLINFO_PTR_READ_BLOCK: info->read_block = pc_chd_image_readblock; break; - case IMGTOOLINFO_PTR_WRITE_BLOCK: info->write_block = pc_chd_image_writeblock; break; - case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = pc_chd_image_getsectorsize; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = pc_chd_create_optionguide; break; - case IMGTOOLINFO_PTR_GET_GEOMETRY: info->get_geometry = pc_chd_image_get_geometry; break; - case IMGTOOLINFO_PTR_LIST_PARTITIONS: info->list_partitions = pc_chd_list_partitions; break; - } -} diff --git a/src/mess/tools/imgtool/modules/prodos.c b/src/mess/tools/imgtool/modules/prodos.c deleted file mode 100644 index 5800e2bf9f3..00000000000 --- a/src/mess/tools/imgtool/modules/prodos.c +++ /dev/null @@ -1,2282 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/**************************************************************************** - - prodos.c - - Apple II ProDOS disk images - -***************************************************************************** - - Notes: - - ProDOS disks are split into 512 byte blocks. - - ProDOS directory structure: - - Offset Length Description - ------ ------ ----------- - 0 2 ??? - 2 2 Next block (0 if end) - 4 39 Directory Entry - 43 39 Directory Entry - ... - 472 39 Directory Entry - 511 1 ??? - - - ProDOS directory entry structure: - - Offset Length Description - ------ ------ ----------- - 0 1 Storage type (bits 7-4) - 10 - Seedling File (1 block) - 20 - Sapling File (2-256 blocks) - 30 - Tree File (257-32768 blocks) - 40 - Pascal Areas on ProFile HDs (???) - 50 - GS/OS Extended File (data and rsrc fork) - E0 - Subdirectory Header - F0 - Volume Header - 1 15 File name (NUL padded) - 16 1 File type - 17 2 Key pointer - 19 2 Blocks used - 21 3 File size - 24 4 Creation date - 28 1 ProDOS version that created the file - 29 1 Minimum ProDOS version needed to read the file - 30 1 Access byte - 31 2 Auxilary file type - 33 4 Last modified date - 37 2 Header pointer - - - In "seedling files", the key pointer points to a single block that is the - whole file. In "sapling files", the key pointer points to an index block - that contains 256 2-byte index pointers that point to the actual blocks of - the files. These 2-byte values are not contiguous; the low order byte is - in the first half of the block, and the high order byte is in the second - half of the block. In "tree files", the key pointer points to an index - block of index blocks. - - ProDOS dates are 32-bit little endian values - - bits 0- 4 Day - bits 5- 8 Month (0-11) - bits 9-15 Year (0-49 is 2000-2049, 50-99 is 1950-1999) - bits 16-21 Minute - bits 24-28 Hour - - - ProDOS directory and volume headers have this information: - - Offset Length Description - ------ ------ ----------- - 31 1 Length of the entry; generally is 39 - 32 1 Number of entries per block; generally is 13 - 33 2 Active entry count in directory - 35 2 Volume bitmap block number - 37 2 Total blocks on volume - - GS/OS Extended Files (storage type $5) point to an extended key block that - contains information about the two forks. The first half of the extended - key block contains info about the data form, and the second half the - resource fork. Both sides have the following format: - - Offset Length Description - ------ ------ ----------- - 0 1 Storage type (bits 3-0, unlike the directory entry) - 1 2 Key pointer - 3 2 Blocks used - 5 3 File size - 8 1 Size of secondary info #1 (must be 18 to be valid) - 9 1 Secondary info #1 type (1=FInfo 2=xFInfo) - 10 16 FInfo or xFInfo - 26 1 Size of secondary info #2 (must be 18 to be valid) - 27 1 Secondary info #2 type (1=FInfo 2=xFInfo) - 28 16 FInfo or xFInfo - - FInfo format: - - Offset Length Description - ------ ------ ----------- - 0 4 File type - 4 4 File creator - 8 2 Finder flags - 10 2 X Coordinate - 12 2 Y Coordinate - 14 2 Finder folder - - xFInfo format: - - Offset Length Description - ------ ------ ----------- - 0 2 Icon ID - 2 6 Reserved - 8 1 Script Code - 9 1 Extended flags - 10 2 Comment ID - 12 4 Put Away Directory - - - For more info, consult ProDOS technical note #25 - (http://web.pdx.edu/~heiss/technotes/pdos/tn.pdos.25.html) - -*****************************************************************************/ - -#include "imgtool.h" -#include "formats/imageutl.h" -#include "formats/ap2_dsk.h" -#include "formats/ap_dsk35.h" -#include "iflopimg.h" -#include "macutil.h" - -#define ROOTDIR_BLOCK 2 -#define BLOCK_SIZE 512 - -struct prodos_diskinfo -{ - imgtoolerr_t (*load_block)(imgtool_image *image, int block, void *buffer); - imgtoolerr_t (*save_block)(imgtool_image *image, int block, const void *buffer); - UINT8 dirent_size; - UINT8 dirents_per_block; - UINT16 volume_bitmap_block; - UINT16 total_blocks; -}; - -struct prodos_direnum -{ - UINT32 block; - UINT32 index; - UINT8 block_data[BLOCK_SIZE]; -}; - -struct prodos_dirent -{ - char filename[16]; - UINT8 storage_type; - UINT16 extkey_pointer; - UINT16 key_pointer[2]; - UINT32 filesize[2]; - int depth[2]; - UINT32 lastmodified_time; - UINT32 creation_time; - - /* FInfo */ - UINT32 file_type; - UINT32 file_creator; - UINT16 finder_flags; - UINT16 coord_x; - UINT16 coord_y; - UINT16 finder_folder; - - /* xFInfo */ - UINT16 icon_id; - UINT8 script_code; - UINT8 extended_flags; - UINT16 comment_id; - UINT32 putaway_directory; -}; - -enum creation_policy_t -{ - CREATE_NONE, - CREATE_FILE, - CREATE_DIR -}; - - - -static time_t prodos_crack_time(UINT32 prodos_time) -{ - struct tm t; - time_t now; - - time(&now); - t = *localtime(&now); - - t.tm_sec = 0; - t.tm_min = (prodos_time >> 16) & 0x3F; - t.tm_hour = (prodos_time >> 24) & 0x1F; - t.tm_mday = (prodos_time >> 0) & 0x1F; - t.tm_mon = (prodos_time >> 5) & 0x0F; - t.tm_year = (prodos_time >> 9) & 0x7F; - - if (t.tm_year <= 49) - t.tm_year += 100; - return mktime(&t); -} - - - -static UINT32 prodos_setup_time(time_t ansi_time) -{ - struct tm t; - UINT32 result = 0; - - t = *localtime(&ansi_time); - if ((t.tm_year >= 100) && (t.tm_year <= 149)) - t.tm_year -= 100; - - result |= (((UINT32) t.tm_min) & 0x003F) << 16; - result |= (((UINT32) t.tm_hour) & 0x001F) << 24; - result |= (((UINT32) t.tm_mday) & 0x001F) << 0; - result |= (((UINT32) t.tm_mon) & 0x000F) << 5; - result |= (((UINT32) t.tm_year) & 0x007F) << 9; - return result; -} - - - -static UINT32 prodos_time_now(void) -{ - time_t now; - time(&now); - return prodos_setup_time(now); -} - - - -static int is_file_storagetype(UINT8 storage_type) -{ - return ((storage_type >= 0x10) && (storage_type <= 0x3F)) - || ((storage_type >= 0x50) && (storage_type <= 0x5F)); -} - - - -static int is_normalfile_storagetype(UINT8 storage_type) -{ - return ((storage_type >= 0x10) && (storage_type <= 0x3F)); -} - - - -static int is_extendedfile_storagetype(UINT8 storage_type) -{ - return ((storage_type >= 0x50) && (storage_type <= 0x5F)); -} - - - -static int is_dir_storagetype(UINT8 storage_type) -{ - return (storage_type >= 0xE0) && (storage_type <= 0xEF); -} - - - -static prodos_diskinfo *get_prodos_info(imgtool_image *image) -{ - prodos_diskinfo *info; - info = (prodos_diskinfo *) imgtool_floppy_extrabytes(image); - return info; -} - - - -/* ----------------------------------------------------------------------- */ - -static void prodos_find_block_525(imgtool_image *image, int block, - UINT32 *track, UINT32 *head, UINT32 *sector1, UINT32 *sector2) -{ - static const UINT8 skewing[] = - { - 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, - 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F - }; - - block *= 2; - - *track = block / APPLE2_SECTOR_COUNT; - *head = 0; - *sector1 = skewing[block % APPLE2_SECTOR_COUNT + 0]; - *sector2 = skewing[block % APPLE2_SECTOR_COUNT + 1]; -} - - - -static imgtoolerr_t prodos_load_block_525(imgtool_image *image, - int block, void *buffer) -{ - floperr_t ferr; - UINT32 track, head, sector1, sector2; - - prodos_find_block_525(image, block, &track, &head, §or1, §or2); - - /* read first sector */ - ferr = floppy_read_sector(imgtool_floppy(image), head, track, - sector1, 0, ((UINT8 *) buffer) + 0, 256); - if (ferr) - return imgtool_floppy_error(ferr); - - /* read second sector */ - ferr = floppy_read_sector(imgtool_floppy(image), head, track, - sector2, 0, ((UINT8 *) buffer) + 256, 256); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_save_block_525(imgtool_image *image, - int block, const void *buffer) -{ - floperr_t ferr; - UINT32 track, head, sector1, sector2; - - prodos_find_block_525(image, block, &track, &head, §or1, §or2); - - /* read first sector */ - ferr = floppy_write_sector(imgtool_floppy(image), head, track, - sector1, 0, ((const UINT8 *) buffer) + 0, 256, 0); /* TODO: pass ddam argument from imgtool */ - if (ferr) - return imgtool_floppy_error(ferr); - - /* read second sector */ - ferr = floppy_write_sector(imgtool_floppy(image), head, track, - sector2, 0, ((const UINT8 *) buffer) + 256, 256, 0); /* TODO: pass ddam argument from imgtool */ - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static void prodos_setprocs_525(imgtool_image *image) -{ - prodos_diskinfo *info; - info = get_prodos_info(image); - info->load_block = prodos_load_block_525; - info->save_block = prodos_save_block_525; -} - - - -/* ----------------------------------------------------------------------- */ - -static imgtoolerr_t prodos_find_block_35(imgtool_image *image, int block, - UINT32 *track, UINT32 *head, UINT32 *sector) -{ - int sides = 2; - - *track = 0; - while(block >= (apple35_sectors_per_track(imgtool_floppy(image), *track) * sides)) - { - block -= (apple35_sectors_per_track(imgtool_floppy(image), (*track)++) * sides); - if (*track >= 80) - return IMGTOOLERR_SEEKERROR; - } - - *head = block / apple35_sectors_per_track(imgtool_floppy(image), *track); - *sector = block % apple35_sectors_per_track(imgtool_floppy(image), *track); - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_load_block_35(imgtool_image *image, - int block, void *buffer) -{ - imgtoolerr_t err; - floperr_t ferr; - UINT32 track, head, sector; - - err = prodos_find_block_35(image, block, &track, &head, §or); - if (err) - return err; - - ferr = floppy_read_sector(imgtool_floppy(image), head, track, sector, 0, buffer, 512); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_save_block_35(imgtool_image *image, - int block, const void *buffer) -{ - imgtoolerr_t err; - floperr_t ferr; - UINT32 track, head, sector; - - err = prodos_find_block_35(image, block, &track, &head, §or); - if (err) - return err; - - ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, 512, 0); /* TODO: pass ddam argument from imgtool */ - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static void prodos_setprocs_35(imgtool_image *image) -{ - prodos_diskinfo *info; - info = get_prodos_info(image); - info->load_block = prodos_load_block_35; - info->save_block = prodos_save_block_35; -} - - - -/* ----------------------------------------------------------------------- */ - -static imgtoolerr_t prodos_load_block(imgtool_image *image, - int block, void *buffer) -{ - prodos_diskinfo *diskinfo; - diskinfo = get_prodos_info(image); - return diskinfo->load_block(image, block, buffer); -} - - - -static imgtoolerr_t prodos_save_block(imgtool_image *image, - int block, const void *buffer) -{ - prodos_diskinfo *diskinfo; - diskinfo = get_prodos_info(image); - return diskinfo->save_block(image, block, buffer); -} - - - -static imgtoolerr_t prodos_clear_block(imgtool_image *image, int block) -{ - UINT8 buffer[BLOCK_SIZE]; - memset(buffer, 0, sizeof(buffer)); - return prodos_save_block(image, block, buffer); -} - - - -/* ----------------------------------------------------------------------- */ - -static imgtoolerr_t prodos_diskimage_open(imgtool_image *image) -{ - imgtoolerr_t err; - UINT8 buffer[BLOCK_SIZE]; - prodos_diskinfo *di; - const UINT8 *ent; - - di = get_prodos_info(image); - - /* specify defaults */ - di->dirent_size = 39; - di->dirents_per_block = 13; - - /* load the first block, hoping that the volume header is first */ - err = prodos_load_block(image, ROOTDIR_BLOCK, buffer); - if (err) - return err; - - ent = &buffer[4]; - - /* did we find the volume header? */ - if ((ent[0] & 0xF0) == 0xF0) - { - di->dirent_size = pick_integer_le(ent, 31, 1); - di->dirents_per_block = pick_integer_le(ent, 32, 1); - di->volume_bitmap_block = pick_integer_le(ent, 35, 2); - di->total_blocks = pick_integer_le(ent, 37, 2); - } - - /* sanity check these values */ - if (di->dirent_size < 39) - return IMGTOOLERR_CORRUPTIMAGE; - if (di->dirents_per_block * di->dirent_size >= BLOCK_SIZE) - return IMGTOOLERR_CORRUPTIMAGE; - if (di->volume_bitmap_block >= di->total_blocks) - return IMGTOOLERR_CORRUPTIMAGE; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_open_525(imgtool_image *image, imgtool_stream *stream) -{ - prodos_setprocs_525(image); - return prodos_diskimage_open(image); -} - - - -static imgtoolerr_t prodos_diskimage_open_35(imgtool_image *image, imgtool_stream *stream) -{ - prodos_setprocs_35(image); - return prodos_diskimage_open(image); -} - - - -/* ----------------------------------------------------------------------- */ - -static imgtoolerr_t prodos_load_volume_bitmap(imgtool_image *image, UINT8 **bitmap) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - UINT8 *alloc_bitmap; - UINT32 bitmap_blocks, i; - - di = get_prodos_info(image); - - bitmap_blocks = (di->total_blocks + (BLOCK_SIZE * 8) - 1) / (BLOCK_SIZE * 8); - alloc_bitmap = (UINT8*)malloc(bitmap_blocks * BLOCK_SIZE); - if (!alloc_bitmap) - { - err = IMGTOOLERR_OUTOFMEMORY; - goto done; - } - - for (i = 0; i < bitmap_blocks; i++) - { - err = prodos_load_block(image, di->volume_bitmap_block + i, - &alloc_bitmap[i * BLOCK_SIZE]); - if (err) - goto done; - } - - err = IMGTOOLERR_SUCCESS; - -done: - if (err && alloc_bitmap) - { - free(alloc_bitmap); - alloc_bitmap = NULL; - } - *bitmap = alloc_bitmap; - return err; -} - - - -static imgtoolerr_t prodos_save_volume_bitmap(imgtool_image *image, const UINT8 *bitmap) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - UINT32 bitmap_blocks, i; - - di = get_prodos_info(image); - - bitmap_blocks = (di->total_blocks + (BLOCK_SIZE * 8) - 1) / (BLOCK_SIZE * 8); - - for (i = 0; i < bitmap_blocks; i++) - { - err = prodos_save_block(image, di->volume_bitmap_block + i, - &bitmap[i * BLOCK_SIZE]); - if (err) - return err; - } - return IMGTOOLERR_SUCCESS; -} - - - -static void prodos_set_volume_bitmap_bit(UINT8 *buffer, UINT16 block, int value) -{ - UINT8 mask; - buffer += block / 8; - mask = 1 << (7 - (block % 8)); - if (value) - *buffer |= mask; - else - *buffer &= ~mask; -} - - - -static int prodos_get_volume_bitmap_bit(const UINT8 *buffer, UINT16 block) -{ - UINT8 mask; - buffer += block / 8; - mask = 1 << (7 - (block % 8)); - return (*buffer & mask) ? 1 : 0; -} - - - -static imgtoolerr_t prodos_alloc_block(imgtool_image *image, UINT8 *bitmap, - UINT16 *block) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - prodos_diskinfo *di; - UINT16 bitmap_blocks, i; - UINT8 *alloc_bitmap = NULL; - - di = get_prodos_info(image); - *block = 0; - bitmap_blocks = (di->total_blocks + (BLOCK_SIZE * 8) - 1) / (BLOCK_SIZE * 8); - - if (!bitmap) - { - err = prodos_load_volume_bitmap(image, &alloc_bitmap); - if (err) - goto done; - bitmap = alloc_bitmap; - } - - for (i = (di->volume_bitmap_block + bitmap_blocks); i < di->total_blocks; i++) - { - if (!prodos_get_volume_bitmap_bit(bitmap, i)) - { - prodos_set_volume_bitmap_bit(bitmap, i, 1); - *block = i; - break; - } - } - - if (*block > 0) - { - if (alloc_bitmap) - { - err = prodos_save_volume_bitmap(image, bitmap); - if (err) - goto done; - } - } - else - { - err = IMGTOOLERR_NOSPACE; - } - -done: - if (err) - *block = 0; - if (alloc_bitmap) - free(alloc_bitmap); - return err; -} - - - -/* ----------------------------------------------------------------------- */ - -static imgtoolerr_t prodos_diskimage_create(imgtool_image *image, option_resolution *opts) -{ - imgtoolerr_t err; - UINT32 heads, tracks, sectors, sector_bytes; - UINT32 dirent_size, volume_bitmap_block, i; - UINT32 volume_bitmap_block_count, total_blocks; - UINT8 buffer[BLOCK_SIZE]; - - heads = option_resolution_lookup_int(opts, 'H'); - tracks = option_resolution_lookup_int(opts, 'T'); - sectors = option_resolution_lookup_int(opts, 'S'); - sector_bytes = option_resolution_lookup_int(opts, 'L'); - - dirent_size = 39; - volume_bitmap_block = 6; - total_blocks = tracks * heads * sectors * sector_bytes / BLOCK_SIZE; - volume_bitmap_block_count = (total_blocks + (BLOCK_SIZE * 8) - 1) / (BLOCK_SIZE * 8); - - /* prepare initial dir block */ - memset(buffer, 0, sizeof(buffer)); - place_integer_le(buffer, 4 + 0, 1, 0xF0); - place_integer_le(buffer, 4 + 31, 1, dirent_size); - place_integer_le(buffer, 4 + 32, 1, BLOCK_SIZE / dirent_size); - place_integer_le(buffer, 4 + 35, 2, volume_bitmap_block); - place_integer_le(buffer, 4 + 37, 2, total_blocks); - - err = prodos_save_block(image, ROOTDIR_BLOCK, buffer); - if (err) - return err; - - /* setup volume bitmap */ - memset(buffer, 0, sizeof(buffer)); - for (i = 0; i < (volume_bitmap_block + volume_bitmap_block_count); i++) - prodos_set_volume_bitmap_bit(buffer, i, 1); - prodos_save_block(image, volume_bitmap_block, buffer); - - /* and finally open the image */ - return prodos_diskimage_open(image); -} - - - -static imgtoolerr_t prodos_diskimage_create_525(imgtool_image *image, imgtool_stream *stream, option_resolution *opts) -{ - prodos_setprocs_525(image); - return prodos_diskimage_create(image, opts); -} - - - -static imgtoolerr_t prodos_diskimage_create_35(imgtool_image *image, imgtool_stream *stream, option_resolution *opts) -{ - prodos_setprocs_35(image); - return prodos_diskimage_create(image, opts); -} - - - -/* ----------------------------------------------------------------------- */ - -static imgtoolerr_t prodos_enum_seek(imgtool_image *image, - prodos_direnum *appleenum, UINT32 block, UINT32 index) -{ - imgtoolerr_t err; - UINT8 buffer[BLOCK_SIZE]; - - if (appleenum->block != block) - { - if (block != 0) - { - err = prodos_load_block(image, block, buffer); - if (err) - return err; - memcpy(appleenum->block_data, buffer, sizeof(buffer)); - } - appleenum->block = block; - } - - appleenum->index = index; - return IMGTOOLERR_SUCCESS; -} - - - -static UINT8 *next_info_block(UINT8 *buffer, size_t *position) -{ - size_t side = *position & 0x100; - size_t subpos = *position & 0x0FF; - UINT8 *result; - - if (subpos < 8) - { - subpos = 8; - *position = side + subpos; - } - - while((buffer[side + subpos] == 0x00) || (subpos + buffer[side + subpos] > 0x100)) - { - if (side) - return NULL; - - side = 0x100; - subpos = 8; - } - - result = &buffer[side + subpos]; - subpos += *result; - *position = side + subpos; - return result; -} - - - -static UINT8 *alloc_info_block(UINT8 *buffer, size_t block_size, UINT8 block_type) -{ - size_t position = 0; - size_t side; - size_t subpos; - UINT8 *result; - - while(next_info_block(buffer, &position)) - ; - - side = position & 0x100; - subpos = position & 0x0FF; - - if ((subpos + block_size) > 0x100) - return NULL; - - result = &buffer[side + subpos]; - *(result++) = (UINT8) block_size; - *(result++) = block_type; - memset(result, 0, block_size - 2); - return result; -} - - - -static imgtoolerr_t prodos_get_next_dirent(imgtool_image *image, - prodos_direnum *appleenum, prodos_dirent *ent) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - size_t finfo_offset; - UINT32 next_block, next_index; - UINT32 offset; - UINT8 buffer[BLOCK_SIZE]; - const UINT8 *info_ptr; - int fork_num; - - di = get_prodos_info(image); - memset(ent, 0, sizeof(*ent)); - - /* have we hit the end of the file? */ - if (appleenum->block == 0) - return IMGTOOLERR_SUCCESS; - - /* populate the resulting dirent */ - offset = appleenum->index * di->dirent_size + 4; - ent->storage_type = appleenum->block_data[offset + 0]; - memcpy(ent->filename, &appleenum->block_data[offset + 1], 15); - ent->filename[15] = '\0'; - ent->creation_time = pick_integer_le(appleenum->block_data, offset + 24, 4); - ent->lastmodified_time = pick_integer_le(appleenum->block_data, offset + 33, 4); - ent->file_type = 0x3F3F3F3F; - ent->file_creator = 0x3F3F3F3F; - ent->finder_flags = 0; - ent->coord_x = 0; - ent->coord_y = 0; - ent->finder_folder = 0; - ent->icon_id = 0; - ent->script_code = 0; - ent->extended_flags = 0; - ent->comment_id = 0; - ent->putaway_directory = 0; - - if (is_extendedfile_storagetype(ent->storage_type)) - { - /* this is a ProDOS extended file; we need to get the extended info - * block */ - ent->extkey_pointer = pick_integer_le(appleenum->block_data, offset + 17, 2); - - err = prodos_load_block(image, ent->extkey_pointer, buffer); - if (err) - return err; - - for (fork_num = 0; fork_num <= 1; fork_num++) - { - ent->key_pointer[fork_num] = pick_integer_le(buffer, 1 + (fork_num * 256), 2); - ent->filesize[fork_num] = pick_integer_le(buffer, 5 + (fork_num * 256), 3); - ent->depth[fork_num] = buffer[fork_num * 256] & 0x0F; - } - - finfo_offset = 0; - while((info_ptr = next_info_block(buffer, &finfo_offset)) != NULL) - { - if (*(info_ptr++) == 18) - { - switch(*(info_ptr++)) - { - case 1: /* FInfo */ - ent->file_type = pick_integer_be(info_ptr, 0, 4); - ent->file_creator = pick_integer_be(info_ptr, 4, 4); - ent->finder_flags = pick_integer_be(info_ptr, 8, 2); - ent->coord_x = pick_integer_be(info_ptr, 10, 2); - ent->coord_y = pick_integer_be(info_ptr, 12, 2); - ent->finder_folder = pick_integer_be(info_ptr, 14, 4); - break; - - case 2: /* xFInfo */ - ent->icon_id = pick_integer_be(info_ptr, 0, 2); - ent->script_code = pick_integer_be(info_ptr, 8, 1); - ent->extended_flags = pick_integer_be(info_ptr, 9, 1); - ent->comment_id = pick_integer_be(info_ptr, 10, 2); - ent->putaway_directory = pick_integer_be(info_ptr, 12, 4); - break; - } - } - } - } - else - { - /* normal ProDOS files have all of the info right here */ - ent->key_pointer[0] = pick_integer_le(appleenum->block_data, offset + 17, 2); - ent->filesize[0] = pick_integer_le(appleenum->block_data, offset + 21, 3); - ent->depth[0] = ent->storage_type >> 4; - } - - /* identify next entry */ - next_block = appleenum->block; - next_index = appleenum->index + 1; - if (next_index >= di->dirents_per_block) - { - next_block = pick_integer_le(appleenum->block_data, 2, 2); - next_index = 0; - } - - /* seek next block */ - err = prodos_enum_seek(image, appleenum, next_block, next_index); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -/* changes a normal file to a ProDOS extended file */ -static imgtoolerr_t prodos_promote_file(imgtool_image *image, UINT8 *bitmap, prodos_dirent *ent) -{ - imgtoolerr_t err; - UINT16 new_block; - UINT8 buffer[BLOCK_SIZE]; - - assert(is_normalfile_storagetype(ent->storage_type)); - - err = prodos_alloc_block(image, bitmap, &new_block); - if (err) - return err; - - /* create raw extended info block */ - memset(buffer, 0, sizeof(buffer)); - err = prodos_save_block(image, new_block, buffer); - if (err) - return err; - - ent->storage_type = (ent->storage_type & 0x0F) | 0x50; - ent->extkey_pointer = new_block; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_put_dirent(imgtool_image *image, - prodos_direnum *appleenum, prodos_dirent *ent) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - UINT32 offset; - size_t finfo_offset; - UINT8 buffer[BLOCK_SIZE]; - int fork_num; - int needs_finfo = FALSE; - int needs_xfinfo = FALSE; - UINT8 *info_ptr; - UINT8 *finfo; - UINT8 *xfinfo; - - di = get_prodos_info(image); - offset = appleenum->index * di->dirent_size + 4; - - /* determine whether we need FInfo and/or xFInfo */ - if (is_normalfile_storagetype(ent->storage_type)) - { - needs_finfo = (ent->file_type != 0x3F3F3F3F) || - (ent->file_creator != 0x3F3F3F3F) || - (ent->finder_flags != 0) || - (ent->coord_x != 0) || - (ent->coord_y != 0) || - (ent->finder_folder != 0); - - needs_xfinfo = (ent->icon_id != 0) || - (ent->script_code != 0) || - (ent->extended_flags != 0) || - (ent->comment_id != 0) || - (ent->putaway_directory != 0); - } - - /* do we need to promote this file to an extended file? */ - if (!is_extendedfile_storagetype(ent->storage_type) - && (needs_finfo || needs_xfinfo)) - { - err = prodos_promote_file(image, NULL, ent); - if (err) - return err; - } - - /* write out the storage type, filename, creation and lastmodified times */ - appleenum->block_data[offset + 0] = ent->storage_type; - memcpy(&appleenum->block_data[offset + 1], ent->filename, 15); - place_integer_le(appleenum->block_data, offset + 24, 4, ent->creation_time); - place_integer_le(appleenum->block_data, offset + 33, 4, ent->lastmodified_time); - - if (is_extendedfile_storagetype(ent->storage_type)) - { - /* ProDOS extended file */ - err = prodos_load_block(image, ent->extkey_pointer, buffer); - if (err) - return err; - - finfo = NULL; - xfinfo = NULL; - - for (fork_num = 0; fork_num <= 1; fork_num++) - { - place_integer_le(buffer, 1 + (fork_num * 256), 2, ent->key_pointer[fork_num]); - place_integer_le(buffer, 5 + (fork_num * 256), 3, ent->filesize[fork_num]); - buffer[fork_num * 256] = ent->depth[fork_num]; - } - - finfo_offset = 0; - while((info_ptr = next_info_block(buffer, &finfo_offset)) != NULL) - { - if (*(info_ptr++) == 18) - { - switch(*(info_ptr++)) - { - case 1: /* FInfo */ - finfo = info_ptr; - break; - - case 2: /* xFInfo */ - xfinfo = info_ptr; - break; - } - } - } - - /* allocate the finfo and/or xinfo blocks, if we need them */ - if (needs_finfo && !finfo) - finfo = alloc_info_block(buffer, 18, 1); - if (needs_xfinfo && !xfinfo) - xfinfo = alloc_info_block(buffer, 18, 2); - - if (finfo) - { - place_integer_be(finfo, 0, 4, ent->file_type); - place_integer_be(finfo, 4, 4, ent->file_creator); - place_integer_be(finfo, 8, 2, ent->finder_flags); - place_integer_be(finfo, 10, 2, ent->coord_x); - place_integer_be(finfo, 12, 2, ent->coord_y); - place_integer_be(finfo, 14, 4, ent->finder_folder); - } - - if (xfinfo) - { - place_integer_be(xfinfo, 0, 2, ent->icon_id); - place_integer_be(xfinfo, 8, 1, ent->script_code); - place_integer_be(xfinfo, 9, 1, ent->extended_flags); - place_integer_be(xfinfo, 10, 2, ent->comment_id); - place_integer_be(xfinfo, 12, 4, ent->putaway_directory); - } - - err = prodos_save_block(image, ent->extkey_pointer, buffer); - if (err) - return err; - - place_integer_le(appleenum->block_data, offset + 17, 2, ent->extkey_pointer); - place_integer_le(appleenum->block_data, offset + 21, 3, BLOCK_SIZE); - } - else - { - /* normal file */ - place_integer_le(appleenum->block_data, offset + 17, 2, ent->key_pointer[0]); - place_integer_le(appleenum->block_data, offset + 21, 3, ent->filesize[0]); - } - - err = prodos_save_block(image, appleenum->block, appleenum->block_data); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_lookup_path(imgtool_image *image, const char *path, - creation_policy_t create, prodos_direnum *direnum, prodos_dirent *ent) -{ - imgtoolerr_t err; - prodos_direnum my_direnum; - UINT32 block = ROOTDIR_BLOCK; - const char *old_path; - UINT16 this_block; - UINT32 this_index; - UINT16 free_block = 0; - UINT32 free_index = 0; - UINT16 new_file_block; - UINT8 buffer[BLOCK_SIZE]; - - if (!direnum) - direnum = &my_direnum; - - while(*path) - { - memset(direnum, 0, sizeof(*direnum)); - err = prodos_enum_seek(image, direnum, block, 0); - if (err) - goto done; - - do - { - this_block = direnum->block; - this_index = direnum->index; - - err = prodos_get_next_dirent(image, direnum, ent); - if (err) - goto done; - - /* if we need to create a file entry and this is free, track it */ - if (create && this_block && !free_block && !ent->storage_type) - { - free_block = this_block; - free_index = this_index; - } - } - while(direnum->block && (strcmp(path, ent->filename) || ( - !is_file_storagetype(ent->storage_type) && - !is_dir_storagetype(ent->storage_type)))); - - old_path = path; - path += strlen(path) + 1; - if (*path) - { - /* we have found part of the path; we are not finished yet */ - if (!is_dir_storagetype(ent->storage_type)) - { - err = IMGTOOLERR_FILENOTFOUND; - goto done; - } - block = ent->key_pointer[0]; - } - else if (!direnum->block) - { - /* did not find file; maybe we need to create it */ - if (create == CREATE_NONE) - { - err = IMGTOOLERR_FILENOTFOUND; - goto done; - } - - /* do we need to expand the directory? */ - if (!free_block) - { - if (this_block == 0) - { - err = IMGTOOLERR_CORRUPTFILE; - goto done; - } - - err = prodos_load_block(image, this_block, buffer); - if (err) - goto done; - - /* allocate a block */ - err = prodos_alloc_block(image, NULL, &free_block); - if (err) - goto done; - - /* clear out this new block */ - err = prodos_clear_block(image, free_block); - if (err) - goto done; - - /* save this link */ - place_integer_le(buffer, 2, 2, free_block); - err = prodos_save_block(image, this_block, buffer); - if (err) - goto done; - - free_index = 0; - } - - /* seek back to the free space */ - err = prodos_enum_seek(image, direnum, free_block, free_index); - if (err) - goto done; - - new_file_block = 0; - if (create == CREATE_DIR) - { - /* if we are creating a directory, we need to create a new block */ - err = prodos_alloc_block(image, NULL, &new_file_block); - if (err) - goto done; - - err = prodos_clear_block(image, new_file_block); - if (err) - goto done; - } - - /* prepare the dirent */ - memset(ent, 0, sizeof(*ent)); - ent->storage_type = (create == CREATE_DIR) ? 0xe0 : 0x10; - ent->creation_time = ent->lastmodified_time = prodos_time_now(); - ent->key_pointer[0] = new_file_block; - ent->file_type = 0x3F3F3F3F; - ent->file_creator = 0x3F3F3F3F; - strncpy(ent->filename, old_path, ARRAY_LENGTH(ent->filename)); - - /* and place it */ - err = prodos_put_dirent(image, direnum, ent); - if (err) - goto done; - - this_block = free_block; - this_index = free_index; - } - else - { - /* we've found the file; seek that dirent */ - err = prodos_enum_seek(image, direnum, this_block, this_index); - if (err) - goto done; - } - } - - err = IMGTOOLERR_SUCCESS; -done: - return err; -} - - - -static imgtoolerr_t prodos_fill_file(imgtool_image *image, UINT8 *bitmap, - UINT16 key_block, int key_block_allocated, - int depth, UINT32 blockcount, UINT32 block_index) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - int dirty; - int sub_block_allocated; - UINT16 i, sub_block, new_sub_block; - UINT8 buffer[BLOCK_SIZE]; - - di = get_prodos_info(image); - - if (key_block_allocated) - { - /* we are on a recently allocated key block; start fresh */ - memset(buffer, 0, sizeof(buffer)); - dirty = TRUE; - } - else - { - /* this is a preexisting key block */ - err = prodos_load_block(image, key_block, buffer); - if (err) - return err; - dirty = FALSE; - } - - for (i = 0; i < 256; i++) - { - sub_block_allocated = FALSE; - - sub_block = buffer[i + 256]; - sub_block <<= 8; - sub_block += buffer[i + 0]; - - new_sub_block = sub_block; - if ((block_index < blockcount) && (sub_block == 0)) - { - err = prodos_alloc_block(image, bitmap, &new_sub_block); - if (err) - return err; - sub_block_allocated = TRUE; - } - else if ((block_index >= blockcount) && (sub_block != 0)) - { - new_sub_block = 0; - if (sub_block < di->total_blocks) - prodos_set_volume_bitmap_bit(bitmap, sub_block, 0); - } - - /* did we change the block? */ - if (new_sub_block != sub_block) - { - dirty = TRUE; - buffer[i + 0] = new_sub_block >> 0; - buffer[i + 256] = new_sub_block >> 8; - if (sub_block == 0) - sub_block = new_sub_block; - } - - /* call recursive function */ - if (depth > 2) - { - err = prodos_fill_file(image, bitmap, sub_block, sub_block_allocated, depth - 1, blockcount, block_index); - if (err) - return err; - } - - /* increment index */ - block_index += 1 << ((depth - 2) * 8); - } - - /* if we changed anything, then save the block */ - if (dirty) - { - err = prodos_save_block(image, key_block, buffer); - if (err) - return err; - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_set_file_block_count(imgtool_image *image, prodos_direnum *direnum, - prodos_dirent *ent, UINT8 *bitmap, int fork_num, UINT32 new_blockcount) -{ - imgtoolerr_t err; - int depth, new_depth, i; - UINT16 new_block, block; - UINT8 buffer[BLOCK_SIZE]; - UINT16 key_pointer; - - if (fork_num && (new_blockcount > 0) && !is_extendedfile_storagetype(ent->storage_type)) - { - /* need to change a normal file to an extended file */ - err = prodos_promote_file(image, bitmap, ent); - if (err) - return err; - } - - key_pointer = ent->key_pointer[fork_num]; - depth = ent->depth[fork_num]; - - /* determine the new tree depth */ - if (new_blockcount <= 1) - new_depth = 1; - else if (new_blockcount <= 256) - new_depth = 2; - else - new_depth = 3; - - /* are we zero length, and do we have to create a block? */ - if ((new_blockcount >= 1) && (key_pointer == 0)) - { - err = prodos_alloc_block(image, bitmap, &new_block); - if (err) - return err; - key_pointer = new_block; - } - - /* do we have to grow the tree? */ - while(new_depth > depth) - { - err = prodos_alloc_block(image, bitmap, &new_block); - if (err) - return err; - - /* create this new key block, with a link to the previous one */ - memset(buffer, 0, sizeof(buffer)); - buffer[0] = (UINT8) (key_pointer >> 0); - buffer[256] = (UINT8) (key_pointer >> 8); - err = prodos_save_block(image, new_block, buffer); - if (err) - return err; - - depth++; - key_pointer = new_block; - } - - /* do we have to shrink the tree? */ - while(new_depth < depth) - { - err = prodos_load_block(image, key_pointer, buffer); - if (err) - return err; - - for (i = 1; i < 256; i++) - { - block = buffer[i + 256]; - block <<= 8; - block |= buffer[i + 0]; - - if (block > 0) - { - if (depth > 2) - { - /* remove this block's children */ - err = prodos_fill_file(image, bitmap, block, FALSE, depth - 1, 0, 0); - if (err) - return err; - } - - /* and remove this block */ - prodos_set_volume_bitmap_bit(bitmap, block, 0); - } - } - - /* remove this key block */ - prodos_set_volume_bitmap_bit(bitmap, key_pointer, 0); - - /* set the new key pointer */ - block = buffer[256]; - block <<= 8; - block |= buffer[0]; - key_pointer = block; - - depth--; - } - - if (new_blockcount > 0) - { - /* fill out the file tree */ - err = prodos_fill_file(image, bitmap, key_pointer, FALSE, depth, new_blockcount, 0); - if (err) - return err; - } - else if (key_pointer != 0) - { - /* we are now zero length, and don't need a key pointer */ - prodos_set_volume_bitmap_bit(bitmap, key_pointer, 0); - key_pointer = 0; - } - - /* change the depth if we are not an extended file */ - if (is_normalfile_storagetype(ent->storage_type)) - { - ent->storage_type &= ~0xF0; - ent->storage_type |= depth * 0x10; - } - - ent->key_pointer[fork_num] = key_pointer; - ent->depth[fork_num] = depth; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_set_file_size(imgtool_image *image, prodos_direnum *direnum, - prodos_dirent *ent, int fork_num, UINT32 new_size) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - UINT32 blockcount, new_blockcount; - UINT8 *bitmap = NULL; - - if (ent->filesize[fork_num] != new_size) - { - blockcount = (ent->filesize[fork_num] + BLOCK_SIZE - 1) / BLOCK_SIZE; - new_blockcount = (new_size + BLOCK_SIZE - 1) / BLOCK_SIZE; - - /* do we need to change the block chain? */ - if (new_blockcount != blockcount) - { - err = prodos_load_volume_bitmap(image, &bitmap); - if (err) - goto done; - - err = prodos_set_file_block_count(image, direnum, ent, bitmap, fork_num, new_blockcount); - if (err) - goto done; - - err = prodos_save_volume_bitmap(image, bitmap); - if (err) - goto done; - } - - ent->filesize[fork_num] = new_size; - err = prodos_put_dirent(image, direnum, ent); - if (err) - goto done; - } - -done: - if (bitmap) - free(bitmap); - return err; -} - - - -static UINT32 prodos_get_storagetype_maxfilesize(UINT8 storage_type) -{ - UINT32 max_filesize = 0; - switch(storage_type & 0xF0) - { - case 0x10: - max_filesize = BLOCK_SIZE * 1; - break; - case 0x20: - max_filesize = BLOCK_SIZE * 256; - break; - case 0x30: - case 0x50: - max_filesize = BLOCK_SIZE * 32768; - break; - } - return max_filesize; -} - - - -static imgtoolerr_t prodos_diskimage_beginenum(imgtool_directory *enumeration, const char *path) -{ - imgtoolerr_t err; - imgtool_image *image; - prodos_direnum *appleenum; - prodos_dirent ent; - UINT16 block = ROOTDIR_BLOCK; - - image = imgtool_directory_image(enumeration); - appleenum = (prodos_direnum *) imgtool_directory_extrabytes(enumeration); - - /* find subdirectory, if appropriate */ - if (*path) - { - err = prodos_lookup_path(image, path, CREATE_NONE, NULL, &ent); - if (err) - return err; - - /* only work on directories */ - if (!is_dir_storagetype(ent.storage_type)) - return IMGTOOLERR_FILENOTFOUND; - - block = ent.key_pointer[0]; - } - - /* seek initial block */ - err = prodos_enum_seek(image, appleenum, block, 0); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - imgtoolerr_t err; - imgtool_image *image; - prodos_direnum *appleenum; - prodos_dirent pd_ent; - UINT32 max_filesize; - - image = imgtool_directory_image(enumeration); - appleenum = (prodos_direnum *) imgtool_directory_extrabytes(enumeration); - - do - { - err = prodos_get_next_dirent(image, appleenum, &pd_ent); - if (err) - return err; - } - while(appleenum->block - && !is_file_storagetype(pd_ent.storage_type) - && !is_dir_storagetype(pd_ent.storage_type)); - - /* end of file? */ - if (pd_ent.storage_type == 0x00) - { - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - - strcpy(ent->filename, pd_ent.filename); - ent->directory = is_dir_storagetype(pd_ent.storage_type); - ent->creation_time = prodos_crack_time(pd_ent.creation_time); - ent->lastmodified_time = prodos_crack_time(pd_ent.lastmodified_time); - - if (!ent->directory) - { - ent->filesize = pd_ent.filesize[0]; - - max_filesize = prodos_get_storagetype_maxfilesize(pd_ent.storage_type); - if (ent->filesize > max_filesize) - { - ent->corrupt = 1; - ent->filesize = max_filesize; - } - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_read_file_tree(imgtool_image *image, UINT32 *filesize, - UINT32 block, int nest_level, imgtool_stream *destf) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - UINT8 buffer[BLOCK_SIZE]; - UINT16 sub_block; - size_t bytes_to_write; - int i; - - /* check bounds */ - di = get_prodos_info(image); - if (block >= di->total_blocks) - return IMGTOOLERR_CORRUPTFILE; - - err = prodos_load_block(image, block, buffer); - if (err) - return err; - - if (nest_level > 0) - { - /* this is an index block */ - for (i = 0; i < 256; i++) - { - /* retrieve the block pointer; the two bytes are on either half - * of the block */ - sub_block = buffer[i + 256]; - sub_block <<= 8; - sub_block |= buffer[i + 0]; - - if (sub_block != 0) - { - err = prodos_read_file_tree(image, filesize, sub_block, nest_level - 1, destf); - if (err) - return err; - } - } - } - else - { - /* this is a leaf block */ - bytes_to_write = MIN(*filesize, sizeof(buffer)); - stream_write(destf, buffer, bytes_to_write); - *filesize -= bytes_to_write; - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_write_file_tree(imgtool_image *image, UINT32 *filesize, - UINT32 block, int nest_level, imgtool_stream *sourcef) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - UINT8 buffer[BLOCK_SIZE]; - UINT16 sub_block; - size_t bytes_to_read; - int i; - - /* nothing more to read? bail */ - if (*filesize == 0) - return IMGTOOLERR_SUCCESS; - - /* check bounds */ - di = get_prodos_info(image); - if (block >= di->total_blocks) - return IMGTOOLERR_CORRUPTFILE; - - err = prodos_load_block(image, block, buffer); - if (err) - return err; - - if (nest_level > 0) - { - for (i = 0; i < 256; i++) - { - sub_block = buffer[i + 256]; - sub_block <<= 8; - sub_block |= buffer[i + 0]; - - if (sub_block != 0) - { - err = prodos_write_file_tree(image, filesize, sub_block, nest_level - 1, sourcef); - if (err) - return err; - } - } - } - else - { - /* this is a leaf block */ - bytes_to_read = MIN(*filesize, sizeof(buffer)); - stream_read(sourcef, buffer, bytes_to_read); - *filesize -= bytes_to_read; - - err = prodos_save_block(image, block, buffer); - if (err) - return err; - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_diskinfo *di; - UINT8 *bitmap = NULL; - UINT16 i; - - di = get_prodos_info(image); - *size = 0; - - err = prodos_load_volume_bitmap(image, &bitmap); - if (err) - goto done; - - for (i = 0; i < di->total_blocks; i++) - { - if (!prodos_get_volume_bitmap_bit(bitmap, i)) - *size += BLOCK_SIZE; - } - -done: - if (bitmap) - free(bitmap); - return err; -} - - - -static imgtoolerr_t prodos_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - UINT16 key_pointer; - int nest_level; - mac_fork_t fork_num; - - err = prodos_lookup_path(image, filename, CREATE_NONE, NULL, &ent); - if (err) - return err; - - if (is_dir_storagetype(ent.storage_type)) - return IMGTOOLERR_FILENOTFOUND; - - err = mac_identify_fork(fork, &fork_num); - if (err) - return err; - - key_pointer = ent.key_pointer[fork_num]; - nest_level = ent.depth[fork_num] - 1; - - if (key_pointer != 0) - { - err = prodos_read_file_tree(image, &ent.filesize[fork_num], key_pointer, - nest_level, destf); - if (err) - return err; - } - - /* have we not actually received the correct amount of bytes? if not, fill in the rest */ - if (ent.filesize[fork_num] > 0) - stream_fill(destf, 0, ent.filesize[fork_num]); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - prodos_direnum direnum; - UINT64 file_size; - mac_fork_t fork_num; - - file_size = stream_size(sourcef); - - err = prodos_lookup_path(image, filename, CREATE_FILE, &direnum, &ent); - if (err) - return err; - - /* only work on files */ - if (is_dir_storagetype(ent.storage_type)) - return IMGTOOLERR_FILENOTFOUND; - - err = mac_identify_fork(fork, &fork_num); - if (err) - return err; - - /* set the file size */ - err = prodos_set_file_size(image, &direnum, &ent, fork_num, file_size); - if (err) - return err; - - err = prodos_write_file_tree(image, &ent.filesize[fork_num], ent.key_pointer[fork_num], - ent.depth[fork_num] - 1, sourcef); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_deletefile(imgtool_partition *partition, const char *path) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - prodos_direnum direnum; - - err = prodos_lookup_path(image, path, CREATE_NONE, &direnum, &ent); - if (err) - return err; - - /* only work on files */ - if (is_dir_storagetype(ent.storage_type)) - return IMGTOOLERR_FILENOTFOUND; - - /* empty out both forks */ - err = prodos_set_file_size(image, &direnum, &ent, 0, 0); - if (err) - return err; - err = prodos_set_file_size(image, &direnum, &ent, 1, 0); - if (err) - return err; - - memset(&ent, 0, sizeof(ent)); - err = prodos_put_dirent(image, &direnum, &ent); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_listforks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - prodos_direnum direnum; - int fork_num = 0; - - err = prodos_lookup_path(image, path, CREATE_NONE, &direnum, &ent); - if (err) - return err; - - if (is_dir_storagetype(ent.storage_type)) - return IMGTOOLERR_FILENOTFOUND; - - /* specify data fork */ - ents[fork_num].type = FORK_DATA; - ents[fork_num].forkname[0] = '\0'; - ents[fork_num].size = ent.filesize[0]; - fork_num++; - - if (is_extendedfile_storagetype(ent.storage_type)) - { - /* specify the resource fork */ - ents[fork_num].type = FORK_RESOURCE; - strcpy(ents[fork_num].forkname, "RESOURCE_FORK"); - ents[fork_num].size = ent.filesize[1]; - fork_num++; - } - - ents[fork_num].type = FORK_END; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_createdir(imgtool_partition *partition, const char *path) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - prodos_direnum direnum; - - err = prodos_lookup_path(image, path, CREATE_DIR, &direnum, &ent); - if (err) - return err; - - /* only work on directories */ - if (!is_dir_storagetype(ent.storage_type)) - return IMGTOOLERR_FILENOTFOUND; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_free_directory(imgtool_image *image, UINT8 *volume_bitmap, UINT16 key_pointer) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - int i; - UINT16 next_block; - UINT32 offset; - UINT8 buffer[BLOCK_SIZE]; - - di = get_prodos_info(image); - - if (key_pointer != 0) - { - err = prodos_load_block(image, key_pointer, buffer); - if (err) - return err; - - for (i = 0; i < di->dirents_per_block; i++) - { - offset = i * di->dirent_size + 4; - - if (is_file_storagetype(buffer[offset]) || is_file_storagetype(buffer[offset])) - return IMGTOOLERR_DIRNOTEMPTY; - } - - next_block = pick_integer_le(buffer, 2, 2); - - err = prodos_free_directory(image, volume_bitmap, next_block); - if (err) - return err; - - prodos_set_volume_bitmap_bit(volume_bitmap, key_pointer, 0); - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_deletedir(imgtool_partition *partition, const char *path) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - prodos_direnum direnum; - UINT8 *volume_bitmap = NULL; - - err = prodos_lookup_path(image, path, CREATE_NONE, &direnum, &ent); - if (err) - goto done; - - /* only work on directories */ - if (!is_dir_storagetype(ent.storage_type)) - { - err = IMGTOOLERR_FILENOTFOUND; - goto done; - } - - err = prodos_load_volume_bitmap(image, &volume_bitmap); - if (err) - goto done; - - err = prodos_free_directory(image, volume_bitmap, ent.key_pointer[0]); - if (err) - goto done; - - err = prodos_save_volume_bitmap(image, volume_bitmap); - if (err) - goto done; - - memset(&ent, 0, sizeof(ent)); - err = prodos_put_dirent(image, &direnum, &ent); - if (err) - goto done; - -done: - if (volume_bitmap) - free(volume_bitmap); - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_get_file_tree(imgtool_image *image, imgtool_chainent *chain, size_t chain_size, - size_t *chain_pos, UINT16 block, UINT8 total_depth, UINT8 cur_depth) -{ - imgtoolerr_t err; - prodos_diskinfo *di; - int i; - UINT16 sub_block; - UINT8 buffer[BLOCK_SIZE]; - - if (block == 0) - return IMGTOOLERR_SUCCESS; - if (*chain_pos >= chain_size) - return IMGTOOLERR_SUCCESS; - - /* check bounds */ - di = get_prodos_info(image); - if (block >= di->total_blocks) - return IMGTOOLERR_CORRUPTFILE; - - chain[*chain_pos].level = cur_depth; - chain[*chain_pos].block = block; - (*chain_pos)++; - - /* must we recurse into the tree? */ - if (cur_depth < total_depth) - { - err = prodos_load_block(image, block, buffer); - if (err) - return err; - - for (i = 0; i < 256; i++) - { - sub_block = buffer[i + 256]; - sub_block <<= 8; - sub_block |= buffer[i + 0]; - - err = prodos_get_file_tree(image, chain, chain_size, chain_pos, sub_block, total_depth, cur_depth + 1); - if (err) - return err; - } - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - int i; - - err = prodos_lookup_path(image, path, CREATE_NONE, NULL, &ent); - if (err) - return err; - - for (i = 0; attrs[i]; i++) - { - switch(attrs[i]) - { - case IMGTOOLATTR_INT_MAC_TYPE: - values[i].i = ent.file_type; - break; - case IMGTOOLATTR_INT_MAC_CREATOR: - values[i].i = ent.file_creator; - break; - case IMGTOOLATTR_INT_MAC_FINDERFLAGS: - values[i].i = ent.finder_flags; - break; - case IMGTOOLATTR_INT_MAC_COORDX: - values[i].i = ent.coord_x; - break; - case IMGTOOLATTR_INT_MAC_COORDY: - values[i].i = ent.coord_y; - break; - case IMGTOOLATTR_INT_MAC_FINDERFOLDER: - values[i].i = ent.finder_folder; - break; - case IMGTOOLATTR_INT_MAC_ICONID: - values[i].i = ent.icon_id; - break; - case IMGTOOLATTR_INT_MAC_SCRIPTCODE: - values[i].i = ent.script_code; - break; - case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: - values[i].i = ent.extended_flags; - break; - case IMGTOOLATTR_INT_MAC_COMMENTID: - values[i].i = ent.comment_id; - break; - case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: - values[i].i = ent.putaway_directory; - break; - - case IMGTOOLATTR_TIME_CREATED: - values[i].t = prodos_crack_time(ent.creation_time); - break; - case IMGTOOLATTR_TIME_LASTMODIFIED: - values[i].t = prodos_crack_time(ent.lastmodified_time); - break; - } - } - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - prodos_direnum direnum; - int i; - - err = prodos_lookup_path(image, path, CREATE_NONE, &direnum, &ent); - if (err) - return err; - - for (i = 0; attrs[i]; i++) - { - switch(attrs[i]) - { - case IMGTOOLATTR_INT_MAC_TYPE: - ent.file_type = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_CREATOR: - ent.file_creator = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_FINDERFLAGS: - ent.finder_flags = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_COORDX: - ent.coord_x = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_COORDY: - ent.coord_y = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_FINDERFOLDER: - ent.finder_folder = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_ICONID: - ent.icon_id = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_SCRIPTCODE: - ent.script_code = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS: - ent.extended_flags = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_COMMENTID: - ent.comment_id = values[i].i; - break; - case IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY: - ent.putaway_directory = values[i].i; - break; - - case IMGTOOLATTR_TIME_CREATED: - ent.creation_time = prodos_setup_time(values[i].t); - break; - case IMGTOOLATTR_TIME_LASTMODIFIED: - ent.lastmodified_time = prodos_setup_time(values[i].t); - break; - } - } - - err = prodos_put_dirent(image, &direnum, &ent); - if (err) - return err; - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_suggesttransfer(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - mac_filecategory_t file_category = MAC_FILECATEGORY_DATA; - - if (path) - { - err = prodos_lookup_path(image, path, CREATE_NONE, NULL, &ent); - if (err) - return err; - - file_category = is_extendedfile_storagetype(ent.storage_type) - ? MAC_FILECATEGORY_FORKED : MAC_FILECATEGORY_DATA; - } - - mac_suggest_transfer(file_category, suggestions, suggestions_length); - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t prodos_diskimage_getchain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - prodos_dirent ent; - size_t chain_pos = 0; - int fork_num; - - err = prodos_lookup_path(image, path, CREATE_NONE, NULL, &ent); - if (err) - return err; - - switch(ent.storage_type & 0xF0) - { - case 0x10: - case 0x20: - case 0x30: - /* normal ProDOS file */ - err = prodos_get_file_tree(image, chain, chain_size, &chain_pos, - ent.key_pointer[0], ent.depth[0] - 1, 0); - if (err) - return err; - break; - - case 0x50: - /* extended ProDOS file */ - chain[chain_pos].level = 0; - chain[chain_pos].block = ent.extkey_pointer; - chain_pos++; - - for (fork_num = 0; fork_num <= 1; fork_num++) - { - if (ent.key_pointer[fork_num]) - { - err = prodos_get_file_tree(image, chain, chain_size, &chain_pos, - ent.key_pointer[fork_num], ent.depth[fork_num] - 1, 1); - if (err) - return err; - } - } - break; - - case 0xE0: - /* directory */ - return IMGTOOLERR_UNIMPLEMENTED; - - default: - return IMGTOOLERR_UNEXPECTED; - } - - return IMGTOOLERR_SUCCESS; -} - - - -static void generic_prodos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break; - case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break; - case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: info->i = 1; break; - case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break; - case IMGTOOLINFO_INT_WRITING_UNTESTED: info->i = 1; break; - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(prodos_diskinfo); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(prodos_direnum); break; - case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "ProDOS format"); break; - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = prodos_diskimage_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = prodos_diskimage_nextenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = prodos_diskimage_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = prodos_diskimage_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = prodos_diskimage_writefile; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = prodos_diskimage_deletefile; break; - case IMGTOOLINFO_PTR_LIST_FORKS: info->list_forks = prodos_diskimage_listforks; break; - case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = prodos_diskimage_createdir; break; - case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = prodos_diskimage_deletedir; break; - case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = prodos_diskimage_getattrs; break; - case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = prodos_diskimage_setattrs; break; - case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = prodos_diskimage_suggesttransfer; break; - case IMGTOOLINFO_PTR_GET_CHAIN: info->get_chain = prodos_diskimage_getchain; break; - } -} - - - -void prodos_525_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "prodos_525"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = prodos_diskimage_create_525; break; - case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = prodos_diskimage_open_525; break; - case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple2; break; - - default: generic_prodos_get_info(imgclass, state, info); break; - } -} - - - -void prodos_35_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "prodos_35"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = prodos_diskimage_create_35; break; - case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = prodos_diskimage_open_35; break; - case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_iigs; break; - - default: generic_prodos_get_info(imgclass, state, info); break; - } -} diff --git a/src/mess/tools/imgtool/modules/psion.c b/src/mess/tools/imgtool/modules/psion.c deleted file mode 100644 index d343dde5c6a..00000000000 --- a/src/mess/tools/imgtool/modules/psion.c +++ /dev/null @@ -1,683 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Psion Organiser II Datapack - - 08/18/2010 Sandro Ronco - - Known file types: - 0x00 invalid record - 0x01 - 0x7e deleted record - 0x7f invalid deleted record - 0x80 long record - 0x81 file name - 0x82 diary - 0x83 OPL/OB3 procedure - 0x84 RS232 setup - 0x85 - 0x8f reserved - 0x90 MAIN Record - 0x91 - 0xfe data records from files - 0xff invalid record - -****************************************************************************/ - -#include "imgtool.h" - -#define MAXFILES 256 - -struct psion_file -{ - char filename[9]; - UINT8 type; - UINT8 id; - - UINT16 name_rec; - UINT16 data_rec; -}; - -struct psion_pack -{ - imgtool_stream *stream; - - UINT16 eop; - struct psion_file pack_index[MAXFILES]; -}; - -struct psion_iter -{ - UINT16 index; -}; - -UINT16 head_checksum(UINT8* data) -{ - UINT16 checksum = 0; - - for (int i=0; i<6; i+=2) - checksum += (data[i]<<8 | data[i+1]); - - return checksum; -} - -UINT16 get_long_rec_size(imgtool_stream *stream) -{ - UINT8 size_h, size_l; - - stream_read(stream, &size_h, 1); - stream_read(stream, &size_l, 1); - - return (size_h<<8) | size_l; -} - -UINT32 update_pack_index(psion_pack *pack) -{ - UINT8 data, type; - UINT16 size; - UINT16 index = 0; - - memset(pack->pack_index, 0, sizeof(psion_file) * MAXFILES); - - // start at the first record - stream_seek(pack->stream, 0x10, SEEK_SET); - - do - { - stream_read(pack->stream, &data, 1); - - if(data == 0xff) - { - pack->eop = stream_tell(pack->stream) - 1; - return TRUE; - } - else if (data == 0x02) - { - // long record without name are ignored - stream_read(pack->stream, &data, 1); - size = get_long_rec_size(pack->stream); - stream_seek(pack->stream, size, SEEK_CUR); - } - else - { - stream_read(pack->stream, &type, 1); - - // deleted record are not listed - if (type < 0x90 && (type & 0x80)) - { - pack->pack_index[index].type = type; - stream_read(pack->stream, &pack->pack_index[index].filename, 8); - stream_read(pack->stream, &pack->pack_index[index].id, 1); - pack->pack_index[index].name_rec = stream_tell(pack->stream) - 11; - - //check for data record - stream_read(pack->stream, &data, 1); - if (data == 0x02) - pack->pack_index[index].data_rec = stream_tell(pack->stream) - 1; - - stream_seek(pack->stream, -1, SEEK_CUR); - - index++; - } - else - stream_seek(pack->stream, data, SEEK_CUR); - } - - } while (stream_size(pack->stream) > stream_tell(pack->stream)); - - // corrupted image - return FALSE; -} - -int seek_next_record(imgtool_stream *stream, UINT8 id) -{ - UINT8 data, rec_id; - UINT16 size; - - do - { - stream_read(stream, &data, 1); - - if(data == 0xff) - break; - - if (data == 2) - { - stream_read(stream, &rec_id, 1); - size = get_long_rec_size(stream); - - } - else - { - stream_read(stream, &rec_id, 1); - if (id == rec_id) - { - stream_seek(stream, -2, SEEK_CUR); - return TRUE; - } - size = data; - } - - // next record - stream_seek(stream, size, SEEK_CUR); - - } while (stream_size(stream) > stream_tell(stream)); - - return FALSE; -} - -// if there are multiple files with the same name, only the first is found -int seek_file_name(psion_pack *pack, const char *filename) -{ - UINT16 index = 0; - - while (pack->pack_index[index].name_rec) - { - if (!strncmp(filename, pack->pack_index[index].filename, strlen(filename))) - return index; - index++; - } - - // filename not found - return -1; -} - -UINT8 get_free_file_id(psion_pack *pack) -{ - for (UINT8 file_id=0x91; file_id<0xff; file_id++) - { - int index = 0; - - while (pack->pack_index[index].id != file_id) - if (pack->pack_index[index++].name_rec == 0) - return file_id; - } - - return 0xff; -} - -void put_name_record(imgtool_stream *stream, const char* filename, UINT8 record_type, UINT8 record_id) -{ - char data[0x10]; - int i = 0; - - data[i++] = 0x09; - data[i++] = record_type; - - // filename is 8 char long space filled - for (int j=0; j<8; j++) - if (j < strlen(filename)) - data[i++] = filename[j]; - else - data[i++] = 0x20; - - data[i++] = record_id; - - stream_write(stream, data, i); -} - -void update_opk_head(imgtool_stream *stream) -{ - UINT16 size = stream_size(stream) - 6; - - stream_seek(stream, 4, SEEK_SET); - stream_putc(stream, (size>>8) & 0xff); - stream_putc(stream, size & 0xff); -} - -char *stream_getline(imgtool_stream *source, UINT16 max_len) -{ - UINT16 pos = 0; - char data; - char *line = (char*)malloc(max_len); - memset(line, 0, max_len); - - while (pos < max_len && stream_size(source) > stream_tell(source)) - { - stream_read(source, &data, 1); - - switch(data) - { - case '\r': - stream_read(source, &data, 1); - if (data != '\n') - stream_seek(source, -1, SEEK_CUR); - case '\n': - return line; - default: - line[pos++] = data; - break; - } - } - - if (pos) - return line; - - free(line); - return NULL; -} - -UINT16 put_odb(imgtool_stream *instream, imgtool_stream *outstream, UINT8 file_id) -{ - char *line; - UINT16 out_size = 0; - - // reset stream - stream_seek(instream, 0, SEEK_SET); - - while ((line = stream_getline(instream, 256))) - { - UINT16 len = strlen(line); - - stream_putc(outstream, (UINT8)len); - stream_putc(outstream, file_id); - stream_write(outstream, line, len); - - out_size += (len + 1); - - free(line); - } - - // end of pack - stream_fill(outstream, 0xff, 2); - - return out_size + 4; -} - -UINT16 put_ob3(imgtool_stream *instream, imgtool_stream *outstream) -{ - UINT16 size = stream_size(instream) - 6; - dynamic_buffer buffer(size); - - stream_seek(instream, 6, SEEK_SET); - stream_read(instream, &buffer[0], size); - - stream_write(outstream, &buffer[0], size); - - // end of pack - stream_fill(outstream, 0xff, 2); - - return size; -} - -UINT16 put_opl(imgtool_stream *instream, imgtool_stream *outstream) -{ - UINT16 out_size = 0; - UINT32 rec_start = stream_tell(outstream); - char *line; - - // reset stream - stream_seek(instream, 0, SEEK_SET); - - stream_fill(outstream, 0x00, 4); - - // replace all eol with 0x00 - while ((line = stream_getline(instream, 256))) - { - // replace tab with space - for (int i=0; i>8) & 0xff); - stream_putc(outstream, out_size & 0xff); - - return out_size + 4; -} - -UINT16 get_odb(imgtool_stream *instream, imgtool_stream *outstream, UINT8 type, UINT8 file_id) -{ - UINT8 data, *buffer; - UINT16 out_size = 0; - - if (file_id >= 0x90) - while (seek_next_record(instream, file_id)) - { - stream_read(instream, &data, 1); - stream_seek(instream, 1, SEEK_CUR); - buffer = (UINT8*)malloc(data); - stream_read(instream, buffer, data); - stream_write(outstream, buffer, data); - stream_putc(outstream, '\r'); - stream_putc(outstream, '\n'); - free (buffer); - out_size += data; - } - - return out_size; -} - -UINT16 get_ob3(imgtool_stream *instream, imgtool_stream *outstream, UINT8 type, UINT8 file_id) -{ - UINT8 data, *buffer = NULL; - UINT16 size = 0; - static const char ob3_magic[3] = {'O', 'R', 'G'}; - - stream_read(instream, &data, 1); - - if (data == 0x02) - { - stream_seek(instream, 1, SEEK_CUR); - size = get_long_rec_size(instream); - buffer = (UINT8*)malloc(size); - stream_read(instream, buffer, size); - } - - stream_write(outstream, ob3_magic, 3); - stream_putc(outstream, (size>>8) & 0xff); - stream_putc(outstream, size & 0xff); - stream_putc(outstream, type | 0x80); - - if (buffer) - { - stream_write(outstream, buffer, size); - free (buffer); - } - - return size; -} - -static imgtoolerr_t datapack_open( imgtool_image *image, imgtool_stream *stream) -{ - psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); - char opk_magic[4]; - - stream_read(stream, opk_magic, 4); - - if(strcmp(opk_magic, "OPK\0")) - return IMGTOOLERR_UNEXPECTED; - - pack->stream = stream; - - if (update_pack_index(pack)) - return IMGTOOLERR_SUCCESS; - else - return IMGTOOLERR_CORRUPTIMAGE; -} - -static imgtoolerr_t datapack_create( imgtool_image *image, imgtool_stream *stream, option_resolution *opts) -{ - psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); - static const UINT8 opk_magic[4] = {'O', 'P', 'K', 0x00}; - UINT8 pack_head[8] = {0x40, 0x00, 0x59, 0x01, 0x01, 0x01, 0x00, 0x00}; - UINT16 checksum; - - pack_head[0] |= (option_resolution_lookup_int(opts, 'R')) ? 0x00 : 0x02; - pack_head[0] |= (option_resolution_lookup_int(opts, 'P')) ? 0x04 : 0x00; - pack_head[0] |= (option_resolution_lookup_int(opts, 'W')) ? 0x00 : 0x08; - pack_head[0] |= (option_resolution_lookup_int(opts, 'B')) ? 0x00 : 0x10; - pack_head[0] |= (option_resolution_lookup_int(opts, 'C')) ? 0x20 : 0x00; - pack_head[1] = option_resolution_lookup_int(opts, 'S'); - - checksum = head_checksum(pack_head); - - stream_write(stream, opk_magic, 4); - stream_fill(stream, 0x00, 2); - stream_write(stream, pack_head, 8); - - stream_putc(stream, (checksum>>8) & 0xff); - stream_putc(stream, checksum & 0xff); - - put_name_record(stream, "MAIN", 0x81, 0x90); - - stream_fill(stream, 0xff, 2); - - update_opk_head(stream); - - pack->stream = stream; - - if (update_pack_index(pack)) - return IMGTOOLERR_SUCCESS; - else - return IMGTOOLERR_CORRUPTIMAGE; -} - -static void datapack_close( imgtool_image *image) -{ - psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); - - stream_close( pack->stream ); -} - -static imgtoolerr_t datapack_begin_enum(imgtool_directory *enumeration, const char *path) -{ - psion_iter *iter = (psion_iter*)imgtool_directory_extrabytes(enumeration); - iter->index = 0; - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t datapack_next_enum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - imgtool_image *image = imgtool_directory_image(enumeration); - psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); - psion_iter *iter = (psion_iter*)imgtool_directory_extrabytes(enumeration); - UINT8 data = 0; - - if (!pack->pack_index[iter->index].name_rec) - { - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - memcpy(ent->filename, pack->pack_index[iter->index].filename, 8); - sprintf(ent->attr, "Type: %02x ID: %02x", pack->pack_index[iter->index].type, pack->pack_index[iter->index].id); - - if (pack->pack_index[iter->index].data_rec) - { - stream_seek(pack->stream, pack->pack_index[iter->index].data_rec + 2, SEEK_SET); - ent->filesize = get_long_rec_size(pack->stream); - } - - // seek all file's records - if (pack->pack_index[iter->index].id >= 0x90) - { - stream_seek(pack->stream, 0x10, SEEK_SET); - while (seek_next_record(pack->stream, pack->pack_index[iter->index].id)) - { - stream_read(pack->stream, &data, 1); - stream_seek(pack->stream, data + 1, SEEK_CUR); - ent->filesize +=data; - } - } - - iter->index++; - return IMGTOOLERR_SUCCESS; -} - -static void datapack_close_enum( imgtool_directory *enumeration) -{ -} - -static imgtoolerr_t datapack_free_space( imgtool_partition *partition, UINT64 *size) -{ - imgtool_image *image = imgtool_partition_image( partition); - psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); - UINT32 pack_size = 0; - - stream_seek(pack->stream, 0x07, SEEK_SET); - stream_read(pack->stream, &pack_size, 1); - - if (size) - *size = (pack_size * 0x2000) - pack->eop; - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t datapack_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtool_image *image = imgtool_partition_image(partition); - psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); - int index = seek_file_name(pack, filename); - - if (index >= 0) - { - if ((pack->pack_index[index].type & 0x7f) == 0x01) - { - // ODB files - stream_seek(pack->stream, 0x10, SEEK_SET); - get_odb(pack->stream, destf, pack->pack_index[index].type, pack->pack_index[index].id); - } - else if ((pack->pack_index[index].type & 0x7f) == 0x03) - { - // OB3/OPL files - stream_seek(pack->stream, pack->pack_index[index].data_rec, SEEK_SET); - get_ob3(pack->stream, destf, pack->pack_index[index].type, pack->pack_index[index].id); - } - else - { - // Other files - return IMGTOOLERR_UNIMPLEMENTED; - } - - return IMGTOOLERR_SUCCESS; - } - else - return IMGTOOLERR_FILENOTFOUND; -} - -static imgtoolerr_t datapack_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtool_image *image = imgtool_partition_image(partition); - psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); - static const UINT8 data_head[4] = {0x02, 0x80, 0x00, 0x00}; - UINT8 head[3]; - UINT16 size = 0; - UINT8 type = option_resolution_lookup_int(opts, 'T'); - UINT8 file_id = option_resolution_lookup_int(opts, 'I'); - - if (!pack->eop) - return IMGTOOLERR_CORRUPTIMAGE; - - // if not file_id is specified get the first free (for ODB only) - if (file_id == 0 && type == 3) - { - file_id = get_free_file_id(pack); - - if (file_id == 0xff) - return IMGTOOLERR_NOSPACE; - } - - stream_read(sourcef, head, 3); - stream_seek(pack->stream, pack->eop, SEEK_SET); - - if (type == 0) - type = (!strncmp((char*)head, "ORG", 3)) ? 1 : 2; - - switch (type) - { - case 1: //OB3 file - put_name_record(pack->stream, filename, 0x83, file_id); - stream_write(pack->stream, data_head, 4); - size = put_ob3(sourcef, pack->stream); - break; - case 2: //OPL file - put_name_record(pack->stream, filename, 0x83, file_id); - stream_write(pack->stream, data_head, 4); - size = put_opl(sourcef, pack->stream); - break; - case 3: //ODB file - put_name_record(pack->stream, filename, 0x81, file_id); - size = put_odb(sourcef, pack->stream, file_id); - break; - } - - if (type != 3) - { - // update the OB3/OPL long record size - stream_seek(pack->stream, pack->eop + 13, SEEK_SET); - stream_putc(pack->stream, (size>>8) & 0xff); - stream_putc(pack->stream, size & 0xff); - } - - update_opk_head(pack->stream); - - if (update_pack_index(pack)) - return IMGTOOLERR_SUCCESS; - else - return IMGTOOLERR_CORRUPTIMAGE; -} - -static imgtoolerr_t datapack_delete_file( imgtool_partition *partition, const char *filename) -{ - imgtool_image *image = imgtool_partition_image(partition); - psion_pack *pack = (psion_pack*)imgtool_image_extra_bytes(image); - int index = seek_file_name(pack, filename); - - if (index >= 0) - { - // clear the bit 7 of the file type to mark the file as deleted - stream_seek(pack->stream, pack->pack_index[index].name_rec + 1, SEEK_SET); - stream_putc(pack->stream, pack->pack_index[index].type & 0x7f); - - if (update_pack_index(pack)) - return IMGTOOLERR_SUCCESS; - else - return IMGTOOLERR_CORRUPTIMAGE; - } - else - return IMGTOOLERR_FILENOTFOUND; -} - -static OPTION_GUIDE_START( psion_create_optguide ) - OPTION_ENUM_START( 'S', "size", "datapack size" ) - OPTION_ENUM( 1, "8k", "8 kbyte" ) - OPTION_ENUM( 2, "16k", "16 kbyts" ) - OPTION_ENUM( 4, "32k", "32 kbyte" ) - OPTION_ENUM( 8, "64k", "64 kbyte" ) - OPTION_ENUM( 16, "128k", "128 kbyte" ) // only paged datapacks can have this size - OPTION_ENUM_END - OPTION_INT('R', "ram", "EPROM/RAM datapack" ) - OPTION_INT('P', "paged", "linear/paged datapack" ) - OPTION_INT('W', "protect", "write-protected datapack" ) - OPTION_INT('B', "boot", "bootable datapack" ) - OPTION_INT('C', "copy", "copyable datapack" ) -OPTION_GUIDE_END - -static OPTION_GUIDE_START( psion_write_optguide ) - OPTION_ENUM_START( 'T', "type", "file type" ) - OPTION_ENUM( 1, "OB3", "OB3 files" ) - OPTION_ENUM( 2, "OPL", "OPL files" ) - OPTION_ENUM( 3, "ODB", "ODB or text files" ) - OPTION_ENUM_END - OPTION_INT( 'I', "id", "File ID" ) -OPTION_GUIDE_END - -void psion_get_info( const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch (state) - { - // --- the following bits of info are returned as 64-bit signed integers --- - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES : info->i = sizeof(psion_pack); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES : info->i = sizeof(psion_iter); break; - - // --- the following bits of info are returned as pointers to data or functions --- - case IMGTOOLINFO_PTR_OPEN : info->open = datapack_open; break; - case IMGTOOLINFO_PTR_CREATE : info->create = datapack_create; break; - case IMGTOOLINFO_PTR_CLOSE : info->close = datapack_close; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = datapack_begin_enum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = datapack_next_enum; break; - case IMGTOOLINFO_PTR_CLOSE_ENUM : info->close_enum = datapack_close_enum; break; - case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = datapack_free_space; break; - case IMGTOOLINFO_PTR_READ_FILE : info->read_file = datapack_read_file; break; - case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = datapack_write_file; break; - case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = datapack_delete_file; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE : info->createimage_optguide = psion_create_optguide; break; - case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE : info->createimage_optguide = psion_write_optguide; break; - - // --- the following bits of info are returned as NULL-terminated strings --- - case IMGTOOLINFO_STR_NAME : strcpy( info->s = imgtool_temp_str(), "psionpack"); break; - case IMGTOOLINFO_STR_DESCRIPTION : strcpy( info->s = imgtool_temp_str(), "Psion Organiser II Datapack"); break; - case IMGTOOLINFO_STR_FILE : strcpy( info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "opk"); break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "S1/2/[4]/8/16;R[0]/1;P[0]/1;W0/[1];B[0]/1;C0/[1]"); break; - case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "T[1]/2/3;I[0]/145-255"); break; - } -} diff --git a/src/mess/tools/imgtool/modules/rsdos.c b/src/mess/tools/imgtool/modules/rsdos.c deleted file mode 100644 index 8323574b001..00000000000 --- a/src/mess/tools/imgtool/modules/rsdos.c +++ /dev/null @@ -1,623 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/**************************************************************************** - - rsdos.c - - CoCo RS-DOS disk images - -****************************************************************************/ - -#include -#include -#include -#include "imgtool.h" -#include "formats/coco_dsk.h" -#include "iflopimg.h" - -/* this structure mirrors the structure of an RS-DOS directory entry on disk */ -struct rsdos_dirent -{ - char fname[8]; - char fext[3]; - char ftype; - char asciiflag; - unsigned char first_granule; - unsigned char lastsectorbytes_msb; - unsigned char lastsectorbytes_lsb; - unsigned char unused[16]; -}; - -struct rsdos_direnum -{ - int index; - int eof; -}; - -#define RSDOS_OPTIONS_FTYPE 'T' -#define RSDOS_OPTIONS_ASCII 'M' - - - -/********************************************************************* - Imgtool module code -*********************************************************************/ - -#define MAX_DIRENTS ((18-2)*(256/32)) -static floperr_t get_rsdos_dirent(imgtool_image *f, int index_loc, struct rsdos_dirent *ent) -{ - return floppy_read_sector(imgtool_floppy(f), 0, 17, 3, index_loc * 32, (void *) ent, sizeof(*ent)); -} - - - -static floperr_t put_rsdos_dirent(imgtool_image *f, int index_loc, const struct rsdos_dirent *ent) -{ - if (index_loc >= MAX_DIRENTS) - return (floperr_t)IMGTOOLERR_FILENOTFOUND; - return floppy_write_sector(imgtool_floppy(f), 0, 17, 3, index_loc * 32, (void *) ent, sizeof(*ent), 0); /* TODO: pass ddam argument from imgtool */ -} - - - -/* fnamebuf must have at least 13 bytes */ -static void get_dirent_fname(char *fnamebuf, const struct rsdos_dirent *ent) -{ - char *s; - - memset(fnamebuf, 0, 13); - memcpy(fnamebuf, ent->fname, sizeof(ent->fname)); - rtrim(fnamebuf); - s = fnamebuf + strlen(fnamebuf); - *(s++) = '.'; - memcpy(s, ent->fext, sizeof(ent->fext)); - rtrim(s); - - /* If no extension, remove period */ - if (*s == '\0') - s[-1] = '\0'; -} - - - -static imgtoolerr_t lookup_rsdos_file(imgtool_image *f, const char *fname, struct rsdos_dirent *ent, int *position) -{ - int i; - floperr_t ferr; - char fnamebuf[13]; - - i = 0; - fnamebuf[0] = '\0'; - - do - { - do - { - ferr = get_rsdos_dirent(f, i++, ent); - if (ferr) - return imgtool_floppy_error(ferr); - } - while(ent->fname[0] == '\0'); - - - if (ent->fname[0] != -1) - get_dirent_fname(fnamebuf, ent); - } - while((ent->fname[0] != -1) && core_stricmp(fnamebuf, fname)); - - if (ent->fname[0] == -1) - return IMGTOOLERR_FILENOTFOUND; - - if (position) - *position = i - 1; - return (imgtoolerr_t)0; -} - - - -static UINT8 get_granule_count(imgtool_image *img) -{ - UINT16 tracks; - UINT16 granules; - - tracks = floppy_get_tracks_per_disk(imgtool_floppy(img)); - granules = (tracks - 1) * 2; - return (granules > 255) ? 255 : (UINT8) granules; -} - -#define MAX_GRANULEMAP_SIZE 256 - -/* granule_map must be an array of MAX_GRANULEMAP_SIZE bytes */ -static floperr_t get_granule_map(imgtool_image *img, UINT8 *granule_map, UINT8 *granule_count) -{ - UINT8 count; - - count = get_granule_count(img); - if (granule_count) - *granule_count = count; - - return floppy_read_sector(imgtool_floppy(img), 0, 17, 2, 0, granule_map, count); -} - - - -static floperr_t put_granule_map(imgtool_image *img, const UINT8 *granule_map, UINT8 granule_count) -{ - return floppy_write_sector(imgtool_floppy(img), 0, 17, 2, 0, granule_map, granule_count, 0); /* TODO: pass ddam argument from imgtool */ -} - - - - -static imgtoolerr_t transfer_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *f, imgtoolerr_t (*proc)(imgtool_image *, int, int, int, int, size_t, imgtool_stream *)) -{ - imgtoolerr_t err = IMGTOOLERR_SUCCESS; - UINT8 track, sector; - - track = granule / 2; - if (track >= 17) - track++; - - sector = (granule % 2) ? 10 : 1; - - if (length > 0) - err = proc(img, 0, track, sector, 0, length, f); - return err; -} - - - -static imgtoolerr_t transfer_from_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *destf) -{ - return transfer_granule(img, granule, length, destf, imgtool_floppy_read_sector_to_stream); -} - - - -static imgtoolerr_t transfer_to_granule(imgtool_image *img, UINT8 granule, int length, imgtool_stream *sourcef) -{ - return transfer_granule(img, granule, length, sourcef, imgtool_floppy_write_sector_from_stream); -} - - - -static imgtoolerr_t process_rsdos_file(struct rsdos_dirent *ent, imgtool_image *img, imgtool_stream *destf, size_t *size) -{ - floperr_t ferr; - size_t s, lastgransize; - UINT8 granule_count; - unsigned char i = 0, granule; - UINT8 usedmap[MAX_GRANULEMAP_SIZE]; /* Used to detect infinite loops */ - UINT8 granule_map[MAX_GRANULEMAP_SIZE]; - - ferr = get_granule_map(img, granule_map, &granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - memset(usedmap, 0, granule_count); - - lastgransize = ent->lastsectorbytes_lsb + (((int) ent->lastsectorbytes_msb) << 8); - s = 0; - granule = ent->first_granule; - - while(!usedmap[granule] && ((i = granule_map[granule]) < granule_count)) - { - usedmap[granule] = 1; - if (destf) - transfer_from_granule(img, granule, 9*256, destf); - - /* i is the next granule */ - s += (256 * 9); - granule = i; - } - - if ((i < 0xc0) || (i > 0xc9)) - return IMGTOOLERR_CORRUPTIMAGE; - - if (lastgransize) - i--; - lastgransize += (256 * (i - 0xc0)); - - if (destf) - transfer_from_granule(img, granule, lastgransize, destf); - - if (size) - *size = s + lastgransize; - return IMGTOOLERR_SUCCESS; -} - - - -/* create a new directory entry with a specified name */ -static imgtoolerr_t prepare_dirent(struct rsdos_dirent *ent, const char *fname) -{ - const char *fname_end; - const char *fname_ext; - int fname_ext_len; - - memset(ent, '\0', sizeof(*ent)); - memset(ent->fname, ' ', sizeof(ent->fname)); - memset(ent->fext, ' ', sizeof(ent->fext)); - - fname_end = strchr(fname, '.'); - if (fname_end) - fname_ext = fname_end + 1; - else - fname_end = fname_ext = fname + strlen(fname); - - fname_ext_len = strlen(fname_ext); - - /* We had better be an 8.3 filename */ - if (((fname_end - fname) > 8) || (fname_ext_len > 3)) - return IMGTOOLERR_BADFILENAME; - - memcpy(ent->fname, fname, fname_end - fname); - memcpy(ent->fext, fname_ext, fname_ext_len); - - /* For now, all files are type 2 binary files */ - ent->ftype = 2; - ent->asciiflag = 0; - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t rsdos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - floperr_t ferr; - imgtoolerr_t err; - size_t filesize; - struct rsdos_direnum *rsenum; - struct rsdos_dirent rsent; - char fname[13]; - imgtool_image *image; - - image = imgtool_directory_image(enumeration); - rsenum = (struct rsdos_direnum *) imgtool_directory_extrabytes(enumeration); - - /* Did we hit the end of file before? */ - if (rsenum->eof) - goto eof; - - do - { - if (rsenum->index >= MAX_DIRENTS) - goto eof; - - ferr = get_rsdos_dirent(image, rsenum->index++, &rsent); - if (ferr) - return imgtool_floppy_error(ferr); - } - while(rsent.fname[0] == '\0'); - - /* Now are we at the eof point? */ - if (rsent.fname[0] == -1) - { - rsenum->eof = 1; -eof: - ent->eof = 1; - } - else - { - /* Not the end of file */ - err = process_rsdos_file(&rsent, image, NULL, &filesize); - if (err) - return err; - - if (filesize == ((size_t) -1)) - { - /* corrupt! */ - ent->filesize = 0; - ent->corrupt = 1; - } - else - { - ent->filesize = filesize; - ent->corrupt = 0; - } - ent->eof = 0; - - get_dirent_fname(fname, &rsent); - - snprintf(ent->filename, ARRAY_LENGTH(ent->filename), "%s", fname); - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B')); - } - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t rsdos_diskimage_freespace(imgtool_partition *partition, UINT64 *size) -{ - floperr_t ferr; - UINT8 i; - size_t s = 0; - UINT8 granule_count; - UINT8 granule_map[MAX_GRANULEMAP_SIZE]; - imgtool_image *image = imgtool_partition_image(partition); - - ferr = get_granule_map(image, granule_map, &granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - for (i = 0; i < granule_count; i++) - { - if (granule_map[i] == 0xff) - s += (9 * 256); - } - *size = s; - return (imgtoolerr_t)FLOPPY_ERROR_SUCCESS; -} - - - -static imgtoolerr_t delete_entry(imgtool_image *img, struct rsdos_dirent *ent, int pos) -{ - floperr_t ferr; - unsigned char g, i; - UINT8 granule_count; - UINT8 granule_map[MAX_GRANULEMAP_SIZE]; - - /* Write a NUL in the filename, marking it deleted */ - ent->fname[0] = 0; - ferr = put_rsdos_dirent(img, pos, ent); - if (ferr) - return imgtool_floppy_error(ferr); - - ferr = get_granule_map(img, granule_map, &granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - /* Now free up the granules */ - g = ent->first_granule; - while (g < granule_count) - { - i = granule_map[g]; - granule_map[g] = 0xff; - g = i; - } - - ferr = put_granule_map(img, granule_map, granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t rsdos_diskimage_readfile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t err; - struct rsdos_dirent ent; - size_t size; - imgtool_image *img = imgtool_partition_image(partition); - - err = lookup_rsdos_file(img, fname, &ent, NULL); - if (err) - return err; - - err = process_rsdos_file(&ent, img, destf, &size); - if (err) - return err; - - if (size == (size_t) -1) - return IMGTOOLERR_CORRUPTIMAGE; - - return (imgtoolerr_t)0; -} - - - -static imgtoolerr_t rsdos_diskimage_writefile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) -{ - floperr_t ferr; - imgtoolerr_t err; - imgtool_image *img = imgtool_partition_image(partition); - struct rsdos_dirent ent, ent2; - size_t i; - UINT64 sz; - UINT64 freespace = 0; - unsigned char g; - unsigned char *gptr; - UINT8 granule_count; - UINT8 granule_map[MAX_GRANULEMAP_SIZE]; - - /* can we write to this image? */ - if (floppy_is_read_only(imgtool_floppy(img))) - return IMGTOOLERR_READONLY; - - err = rsdos_diskimage_freespace(partition, &freespace); - if (err) - return err; - - /* is there enough space? */ - sz = stream_size(sourcef); - if (sz > freespace) - return IMGTOOLERR_NOSPACE; - - /* setup our directory entry */ - err = prepare_dirent(&ent, fname); - if (err) - return err; - - ent.ftype = option_resolution_lookup_int(writeoptions, RSDOS_OPTIONS_FTYPE); - ent.asciiflag = ((UINT8) option_resolution_lookup_int(writeoptions, RSDOS_OPTIONS_ASCII)) - 1; - ent.lastsectorbytes_lsb = sz % 256; - ent.lastsectorbytes_msb = (((sz % 256) == 0) && (sz > 0)) ? 1 : 0; - gptr = &ent.first_granule; - - ferr = get_granule_map(img, granule_map, &granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - g = 0x00; - - do - { - while (granule_map[g] != 0xff) - { - g++; - if ((g >= granule_count) || (g == 0)) - return IMGTOOLERR_UNEXPECTED; /* We should have already verified that there is enough space */ - } - *gptr = g; - gptr = &granule_map[g]; - - - i = MIN(sz, (9*256)); - err = transfer_to_granule(img, g, i, sourcef); - if (err) - return err; - - sz -= i; - - /* Go to next granule */ - g++; - } - while(sz > 0); - - /* Now that we are done with the file, we need to specify the final entry - * in the file allocation table - */ - *gptr = 0xc0 + ((i + 255) / 256); - - /* Now we need to find an empty directory entry */ - i = -1; - do - { - ferr = get_rsdos_dirent(img, ++i, &ent2); - if (ferr) - return imgtool_floppy_error(ferr); - } - while((ent2.fname[0] != '\0') && strcmp(ent.fname, ent2.fname) && (ent2.fname[0] != -1)); - - /* delete file if it already exists */ - if (ent2.fname[0] && (ent2.fname[0] != -1)) - { - err = delete_entry(img, &ent2, i); - if (err) - return err; - } - - ferr = put_rsdos_dirent(img, i, &ent); - if (ferr) - return imgtool_floppy_error(ferr); - - /* write the granule map back out */ - ferr = put_granule_map(img, granule_map, granule_count); - if (ferr) - return imgtool_floppy_error(ferr); - - return IMGTOOLERR_SUCCESS; -} - - - -static imgtoolerr_t rsdos_diskimage_deletefile(imgtool_partition *partition, const char *fname) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - int pos; - struct rsdos_dirent ent; - - err = lookup_rsdos_file(image, fname, &ent, &pos); - if (err) - return err; - - return delete_entry(image, &ent, pos); -} - - - -static imgtoolerr_t rsdos_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) -{ - imgtoolerr_t err; - imgtool_image *image = imgtool_partition_image(partition); - struct rsdos_dirent ent; - int pos; - - if (fname) - { - err = lookup_rsdos_file(image, fname, &ent, &pos); - if (err) - return err; - - if (ent.asciiflag == (char) 0xFF) - { - /* ASCII file */ - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = filter_eoln_getinfo; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = NULL; - } - else if (ent.ftype == 0) - { - /* tokenized BASIC file */ - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = NULL; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = filter_cocobas_getinfo; - } - } - else - { - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = NULL; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = filter_eoln_getinfo; - suggestions[2].viability = SUGGESTION_POSSIBLE; - suggestions[2].filter = filter_cocobas_getinfo; - } - - return IMGTOOLERR_SUCCESS; -} - - - -/********************************************************************* - Imgtool module declaration -*********************************************************************/ - -static OPTION_GUIDE_START( coco_rsdos_writefile_optionguide ) - OPTION_ENUM_START( RSDOS_OPTIONS_FTYPE, "ftype", "File type" ) - OPTION_ENUM( 0, "basic", "Basic" ) - OPTION_ENUM( 1, "data", "Data" ) - OPTION_ENUM( 2, "binary", "Binary" ) - OPTION_ENUM( 3, "assembler", "Assembler Source" ) - OPTION_ENUM_END - OPTION_ENUM_START( RSDOS_OPTIONS_ASCII, "ascii", "Ascii flag" ) - OPTION_ENUM( 0, "ascii", "Ascii" ) - OPTION_ENUM( 1, "binary", "Binary" ) - OPTION_ENUM_END -OPTION_GUIDE_END - - - -void rsdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct rsdos_direnum); break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "rsdos"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "RS-DOS format"); break; - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; - case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T0-[2]-3;M0-[1]"); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = rsdos_diskimage_nextenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = rsdos_diskimage_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = rsdos_diskimage_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = rsdos_diskimage_writefile; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = rsdos_diskimage_deletefile; break; - case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = rsdos_diskimage_suggesttransfer; break; - case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = coco_rsdos_writefile_optionguide; break; - case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_coco; break; - } -} diff --git a/src/mess/tools/imgtool/modules/thomson.c b/src/mess/tools/imgtool/modules/thomson.c deleted file mode 100644 index 43684bc0aea..00000000000 --- a/src/mess/tools/imgtool/modules/thomson.c +++ /dev/null @@ -1,1681 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/**************************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Thomson 8-bit micro-computers. - - Handles SAP, QD and FD floppy formats with a BASIC-DOS filesystem - (most floppies except some games and demo). - -*****************************************************************************/ - -/* TODO: - - improve two-sided floppy support - - check & correct BASIC read filter - - implement BASIC write filter - - handle accented letters - */ - - -/* Thomson floppy geometry are: - - 5"1/4 single density: 40 tracks, 16 sectors/track, 128 bytes/sector - - 5"1/4 double density: 40 tracks, 16 sectors/track, 256 bytes/sector - - 3"1/2 double density: 80 tracks, 16 sectors/track, 256 bytes/sector - - 2"8: 25 logical tracks, 16 logical sectors/track, 128 bytes/sector - - Notes: - - - 2"8 QDD actually contain a single spiraling track, with 400 128-byte - sectors; however, the filesystem considers it has 25 virtual tracks of - 16 sectors => we do the same in imgtool (but thomflop.c uses a 400-sector - addressing to emulate the device hardware) - - - tracks always have 16 sectors, this is requred by the filesystem - - - two-sided floppies are handled as two one-sided floppies in two - logical floppy drives on the original Thomsons; each has its own - independent FAT and directory. - In imgtool, we handle two-sided images as two partitions. - For now, only 3"1/2 .fd and QDD .qd files can be two-sided. - - - it seems possible to create 3"1/2 single density floppies on the TO9, - I am not sure this is standard, and we do not support it... - -*/ - - -/* Microsoft BASIC Filesystem. - - The floppy is divided into blocks, with always two blocks / track. - Also, in double density, only the first 255 bytes of each 256-byte - sector is used. Thus, blocks are 1024 bytes in single density, and - 2040 bytes in double density. - Depending on the number of tracks, there can be 50, 80 or 160 blocks. - - Filesystem data always occupy track 20, whatever the floppy geometry. - - * sector 1: - - bytes 0-7: floppy name - - remaining bytes: undocumented, seem unused - - * sector 2: FAT, 1 byte info per block - - byte 0: always 0 - - byte 1: block 0 - ... - - byte i: block i-1 - ... - - byte 160: block 159 - - remaining bytes: undocumented, seem unused - - The byte has the following meaning: - - ff: block is free - - fb: block is reserved - - 00-bf: block allocated, points to then next file block - - c1-c8: last block in file, (value & 15) is the number of sectors - actually allocated to the file - - Note: in single density, we can reference only 127 blocks. This is not - a problem because single density floppies can only have 50 or 80 blocks, - never 160. - - * sector 3-16: directory - - no subdirectories - - each file entry occupies 32 bytes: - - bytes 00-07: filename, padded with whitespaces - - bytes 08-0A: file extension, padedd with whitespaces - - byte 0B: file type - . 0 = BASIC, ASCII or binary program (B) - . 1 = BASIC or ASCII data (D) - . 2 = machine code (M) - . 3 = ASCII assembler file (A) - - byte 0C: format flag - . 00 = binary (tokenized) - . ff = ASCII - - byte 0D: first block - - bytes 0E-0F: bytes used in the last sector - - bytes 10-17: comment - - byte 18: day (of month) - - byte 19: month - - byte 1A: year (two last digits) - - bytes 1B-1f: unknown - - Note that byte 0 has a special significance: - - 00: free directory entry - - 20-7F: actual directory entry, value is the first character ini filename - - ff: end of directory - - There can be 56 files in single density, 112 in double density. - */ - -#include "imgtool.h" -#include "iflopimg.h" - -#include - - -#define MAXSIZE 80*16*256*2 /* room for two faces, double-density, 80 tracks */ - -struct thom_floppy { - imgtool_stream *stream; - - UINT16 sector_size; /* 128 or 256 */ - UINT16 sectuse_size; /* bytes used in sector: 128 or 255 */ - UINT8 tracks; /* 25, 40, or 80 */ - UINT8 heads; /* 1 or 2 */ - UINT8 data[MAXSIZE]; /* image data */ - - int modified; /* data need to be copied back to image file */ - -}; - - -enum thom_dirent_type { - THOM_DIRENT_END, - THOM_DIRENT_FREE, - THOM_DIRENT_FILE, - THOM_DIRENT_INVALID, - -}; - - -struct thom_dirent { - thom_dirent_type type; - int index; - - char name[9]; - char ext[4]; - char comment[9]; - UINT8 ftype; - UINT8 format; - UINT8 firstblock; - UINT16 lastsectsize; - UINT8 day; - UINT8 month; - UINT8 year; - -}; - - -static void thom_basic_get_info(const imgtool_class *clas, UINT32 param, - union imgtoolinfo *info); - -static UINT8* thom_get_sector(thom_floppy* f, unsigned head, - unsigned track, unsigned sector); - - -/*********************** .fd / .qd format ************************/ - -/* .fd and .qd formats are very simple: the sectors are simply put one after - another, starting at sector 1 of track 0 to sector 16 track 0, then - starting again at sector 1 of track 1, and so on. - There is no image or sector header, and no gap between sectors. - The number of tracks and sector size are determined by the extension - (.fd have 40 or 80 tracks, .qd have 25 tracks) and the file size. -*/ - -static imgtoolerr_t thom_open_fd_qd(imgtool_image *img, imgtool_stream *stream) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - int size = stream_size( stream ); - - f->stream = stream; - f->modified = 0; - - /* guess format */ - switch ( size ) { - case 81920: - f->tracks = 40; - f->sector_size = 128; - f->sectuse_size = 128; - f->heads = 1; - break; - - case 163840: - f->tracks = 40; - f->sector_size = 256; - f->sectuse_size = 255; - f->heads = 1; - /* could also be: sector_size=128, heads=2 */ - /* maight even be: tracks=80, sector_size=128 */ - break; - - case 327680: - f->tracks = 80; - f->sector_size = 256; - f->sectuse_size = 255; - f->heads = 1; - /* could also be: tracks=40, heads=2 */ - break; - - case 655360: - f->tracks = 80; - f->sector_size = 256; - f->sectuse_size = 255; - f->heads = 2; - break; - - case 51200: - f->tracks = 25; - f->sector_size = 128; - f->sectuse_size = 128; - f->heads = 1; - break; - - case 62400: - f->tracks = 25; - f->sector_size = 128; - f->sectuse_size = 128; - f->heads = 2; - break; - - default: - return IMGTOOLERR_CORRUPTIMAGE; - } - - assert( size == f->heads * f->tracks * 16 * f->sector_size ); - - stream_seek( stream, 0, SEEK_SET ); - if ( stream_read( stream, f->data, size ) < size ) - return IMGTOOLERR_READERROR; - - return IMGTOOLERR_SUCCESS; -} - -static void thom_close_fd_qd(imgtool_image *img) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - - /* save image */ - if ( f->modified ) { - int size = f->heads * f->tracks * 16 * f->sector_size; - stream_seek( f->stream, 0, SEEK_SET ); - if ( stream_write( f->stream, f->data, size ) < size ) - { - /* logerror( "thom_diskimage_close_fd_qd: write error\n" ); */ - } - } - - stream_close( f->stream ); -} - - -/*********************** .sap format ************************/ - -/* SAP format, Copyright 1998 by Alexandre Pukall - - image is composed of: - - byte 0: version (0 or 1) - - bytes 1..65: signature - - bytes 66..end: sectors - - each sector is composed of - - a 4-byte header: - . byte 0: format - 0 3"1/2 double density - 1 5"1/4 low density - . byte 1: protection (?) - . byte 2: track index, in 0..79 - . byte 3: sector index, in 1..16 - - sector data, XOR 0xB3 - - 2-byte CRC of header + data, high byte first - - there is no provision for two-sided images in sap - */ - -static const int sap_magic_num = 0xB3; /* simple XOR crypt */ - -static const char sap_header[]= - "\001SYSTEME D'ARCHIVAGE PUKALL S.A.P. " - "(c) Alexandre PUKALL Avril 1998"; - -static const UINT16 sap_crc[] = { - 0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387, - 0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f, -}; - -static UINT16 thom_sap_crc( UINT8* data, int size ) -{ - int i; - UINT16 crc = 0xffff, crc2; - for ( i = 0; i < size; i++ ) { - crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ]; - crc = ( crc2 >> 4 ) ^ sap_crc[ ( crc2 ^ (data[i] >> 4) ) & 15 ]; - } - return crc; -} - -static imgtoolerr_t thom_open_sap(imgtool_image *img, imgtool_stream *stream) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - UINT8 buf[262]; - - f->stream = stream; - f->modified = 0; - - /* check image header */ - stream_seek( stream, 0, SEEK_SET ); - stream_read( stream, buf, 66 ); - if ( memcmp( buf+1, sap_header+1, 65 ) ) return IMGTOOLERR_CORRUPTIMAGE; - - /* guess format */ - stream_read( stream, buf, 1 ); - switch ( buf[0] ) { - case 1: - case 3: - f->heads = 1; - f->tracks = 40; - f->sector_size = 128; - f->sectuse_size = 128; - break; - case 0: - case 2: - case 4: - f->heads = 1; - f->tracks = 80; - f->sector_size = 256; - f->sectuse_size = 255; - break; - default: return IMGTOOLERR_CORRUPTIMAGE; - } - - stream_seek( stream, 66, SEEK_SET ); - while ( 1) { - int i, sector, track; - UINT16 crc; - - /* load sector */ - if ( stream_read( stream, buf, 6 + f->sector_size ) < 6 + f->sector_size ) - break; - - /* parse sector header */ - track = buf[2]; - sector = buf[3]; - if ( sector < 1 || sector > 16 || track >= f->tracks ) - return IMGTOOLERR_CORRUPTIMAGE; - - /* decrypt */ - for ( i = 0; i < f->sector_size; i++ ) buf[ i + 4 ] ^= sap_magic_num; - memcpy( thom_get_sector( f, 0, track, sector ), buf + 4, f->sector_size ); - - /* check CRC */ - crc = thom_sap_crc( buf, f->sector_size + 4 ); - if ( ( (crc >> 8) != buf[ f->sector_size + 4 ] ) || - ( (crc & 0xff) != buf[ f->sector_size + 5 ] ) ) - return IMGTOOLERR_CORRUPTIMAGE; - } - - return IMGTOOLERR_SUCCESS; -} - -static void thom_close_sap(imgtool_image *img) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - - if ( f->modified ) { - int i, sector, track; - UINT8 buf[262]; - UINT16 crc; - - /* rewind */ - stream_seek( f->stream, 0, SEEK_SET ); - - /* image header */ - if ( stream_write( f->stream, sap_header, 66 ) < 66 ) { - /* logerror( "thom_diskimage_close_sap: write error\n" ); */ - return; - } - - for ( track = 0; track < f->tracks; track++ ) - for ( sector = 1; sector <= 16; sector++ ) { - /* sector header & data */ - buf[0] = ( f->tracks == 80 ) ? 2 : 1; - buf[1] = 0; - buf[2] = track; - buf[3] = sector; - memcpy( buf + 4, - thom_get_sector( f, 0, track, sector), f->sector_size ); - - /* compute crc */ - crc = thom_sap_crc( buf, f->sector_size + 4 ); - buf[ f->sector_size + 4 ] = crc >> 8; - buf[ f->sector_size + 5 ] = crc & 0xff; - - /* crypt */ - for ( i = 0; i < f->sector_size; i++ ) buf[ i + 4 ] ^= sap_magic_num; - - /* save */ - if ( stream_write( f->stream, buf, f->sector_size + 6 ) < - f->sector_size + 6 ) { - /* logerror( "thom_diskimage_close_sap: write error\n" ); */ - return; - } - } - } - - stream_close( f->stream ); -} - - -/*********************** low-level functions *********************/ - -static UINT8* thom_get_sector(thom_floppy* f, unsigned head, - unsigned track, unsigned sector) -{ - assert( head < f->heads); - assert( track < f->tracks ); - assert( sector > 0 && sector <= 16 ); - return & f->data[ ( (head * f->tracks + track) * 16 + (sector-1) ) * - f->sector_size ]; -} - -static int thom_nb_blocks(thom_floppy* f) -{ - int n1 = f->tracks * 2; /* 2 blocks per track */ - int n2 = f->sector_size - 1; /* FAT entries */ - return (n1 < n2) ? n1 : n2; -} - -static int thom_max_dirent(thom_floppy* f) -{ - return 14 * f->sector_size / 32; -} - -/* remove trailing spaces */ -static void thom_stringify(char* str) -{ - char* s = str + strlen(str) - 1; - while ( s >= str && *s == ' ' ) { *s = 0; s--; } - for ( s = str; *s; s++ ) - if ( (UINT8)*s == 0xff ) *s = 0; - else if ( *s < ' ' || *s >= 127 ) *s = '?'; -} - -/* pad with spaces until the length is nb */ -static void thom_unstringity(char* str, int nb) -{ - char* s = str; - while ( s < str + nb && *s ) s++; - while ( s < str + nb ) { *s = ' '; s++; } -} - -/* get filename and extension & truncate them to 8 + 3 */ -static void thom_conv_filename(const char* s, char name[9], char ext[4]) -{ - int i; - memset( name, 0, 9 ); - memset( ext, 0, 4 ); - for ( i = 0; i < 8 && *s && *s != '.'; i++, s++ ) name[i] = *s; - while ( *s && *s != '.' ) s++; - if ( *s == '.' ) { - s++; - for ( i = 0; i < 3 && *s; i++, s++ ) ext[i] = *s; - } -} - -static time_t thom_crack_time(thom_dirent* d) -{ - struct tm t; - time_t now; - - /* check */ - if ( d->day < 1 || d->day > 31 || d->month < 1 || d->month > 12 ) return 0; - - /* converts */ - time( &now ); - t = *localtime( &now ); - t.tm_sec = 0; - t.tm_min = 0; - t.tm_hour = 0; - t.tm_mday = d->day; - t.tm_mon = d->month - 1; - t.tm_year = (d->year < 65 ) ? d->year + 100 : d->year; - return mktime(&t); -} - -static void thom_make_time(thom_dirent* d, time_t time) -{ - if ( ! time ) { - d->day = d->month = d->year = 0; - } - else { - struct tm t = *localtime( &time ); - d->day = t.tm_mday; - d->month = t.tm_mon + 1; - d->year = t.tm_year % 100; - } -} - -static void thom_make_time_now(thom_dirent* d) -{ - time_t now; - time( &now ); - thom_make_time( d, now ); -} - -static void thom_get_dirent(thom_floppy* f, unsigned head, - unsigned n, thom_dirent* d) -{ - UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32; - memset( d, 0, sizeof(*d) ); - d->index = n; - if ( n >= thom_max_dirent( f ) ) - d->type = THOM_DIRENT_END; - else if ( *base == 0xff ) - d->type = THOM_DIRENT_END; - else if ( *base == 0 ) - d->type = THOM_DIRENT_FREE; - else { - int i; - /* fill regular entry */ - d->type = THOM_DIRENT_FILE; - memcpy( d->name, base, 8 ); - memcpy( d->ext, base + 8, 3 ); - memcpy( d->comment, base + 16, 8 ); - thom_stringify( d->name ); - thom_stringify( d->ext ); - thom_stringify( d->comment ); - d->ftype = base[11]; - d->format = base[12]; - d->firstblock = base[13]; - d->lastsectsize = ((int)base[14] << 8) + base[15]; - d->day = base[24]; - d->month = base[25]; - d->year = base[26]; - /* sanity check */ - for ( i = 0; i < 11; i++ ) - if ( base[i] < ' ' || base[i] > 127 ) d->type = THOM_DIRENT_INVALID; - } -} - -static void thom_set_dirent(thom_floppy* f, unsigned head, - unsigned n, thom_dirent* d) -{ - UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32; - if ( n >= thom_max_dirent( f ) ) return; - memset( base, 0, 32 ); - if ( d->type == THOM_DIRENT_END ) base[ 0 ] = 0xff; - else if ( d->type == THOM_DIRENT_FREE ) base[ 0 ] = 0; - else { - memcpy( base, d->name, 8 ); - memcpy( base + 8, d->ext, 3 ); - memcpy( base + 16, d->comment, 8 ); - thom_unstringity( (char*)base, 8 ); - thom_unstringity( (char*)base + 8, 3 ); - if ( base[16] ) thom_unstringity( (char*)base + 16, 8 ); - base[11] = d->ftype; - base[12] = d->format; - base[13] = d->firstblock; - base[14] = d->lastsectsize >> 8; - base[15] = d->lastsectsize & 0xff; - base[24] = d->day; - base[25] = d->month; - base[26] = d->year; - } - f->modified = 1; -} - -/* returns 1 if file found, 0 if not */ -static int thom_find_dirent(thom_floppy* f, unsigned head, - const char* name, thom_dirent* d) -{ - int n = 0; - while ( 1 ) { - thom_get_dirent( f, head, n, d ); - if ( d->type == THOM_DIRENT_END ) return 0; - if ( d->type == THOM_DIRENT_FILE ) { - char buf[13]; - sprintf( buf, "%s.%s", d->name, d->ext ); - if ( ! strcmp( buf, name ) ) return 1; - } - n++; - } -} - -/* returns 1 if free entry found, 0 if none available */ -static int thom_find_free_dirent(thom_floppy* f, unsigned head, thom_dirent* d) -{ - int n = 0; - while ( 1 ) { - thom_get_dirent( f, head, n, d ); - if ( d->type == THOM_DIRENT_FREE ) return 1; - if ( d->type == THOM_DIRENT_END ) break; - n++; - } - if ( n + 1 >= thom_max_dirent( f ) ) return 0; - thom_set_dirent( f, head, n+1, d ); - d->type = THOM_DIRENT_FREE; - return 1; -} - -/* returns the file size in bytes, or -1 if error */ -static int thom_get_file_size(thom_floppy* f, unsigned head, thom_dirent* d) -{ - UINT8* fat = thom_get_sector( f, head, 20, 2 ); - int nbblocks = thom_nb_blocks(f); - int block = d->firstblock; - int size = 0; - int timeout = nbblocks; - if ( d->type != THOM_DIRENT_FILE ) return -1; - if ( block >= nbblocks ) return -1; - block = fat[ block + 1 ]; - while ( 1 ) { - if ( block < nbblocks ) { - /* full block */ - size += 8 * f->sectuse_size; - block = fat[ block + 1 ]; - } - else if ( block >= 0xc1 && block <= 0xc8 ) { - /* last block in file */ - size += (block-0xc1) * f->sectuse_size; - size += d->lastsectsize; - return size; - } - else return -1; - timeout--; - if ( timeout < 0 ) return -1; - } -} - -/* number of blocks used by file */ -static int thom_get_file_blocks(thom_floppy* f, unsigned head, thom_dirent* d) -{ - UINT8* fat = thom_get_sector( f, head, 20, 2 ); - int nbblocks = thom_nb_blocks(f); - int block = d->firstblock; - int nb = 0; - if ( d->type != THOM_DIRENT_FILE ) return 0; - if ( block >= nbblocks ) return 0; - block = fat[ block + 1 ]; - while ( 1 ) { - if ( block < nbblocks ) { - /* full block */ - nb++; - block = fat[ block + 1 ]; - } - else if ( block >= 0xc1 && block <= 0xc8 ) { - /* last block in file */ - nb++; - return nb; - } - else return nb; - } -} - -/* number of free blocks */ -static int thom_get_free_blocks(thom_floppy* f, unsigned head) -{ - UINT8* fat = thom_get_sector( f, head, 20, 2 ); - int nbblocks = thom_nb_blocks(f); - int i, nb = 0; - for ( i = 1; i <= nbblocks; i++ ) - if ( fat[i] == 0xff ) nb++; - return nb; -} - -/* dump file contents into dst */ -static void thom_get_file(thom_floppy* f, unsigned head, - thom_dirent* d, imgtool_stream *dst) -{ - UINT8* fat = thom_get_sector( f, head, 20, 2 ); - int nbblocks = thom_nb_blocks(f); - int block = d->firstblock; - if ( block >= nbblocks ) return; - while ( 1 ) { - int nextblock = fat[ block + 1 ]; - int track = block / 2; - int firstsect = (block % 2) ? 9 : 1; - if ( nextblock < nbblocks ) { - /* full block */ - int i; - for ( i = 0; i < 8; i++ ) { - UINT8* data = thom_get_sector( f, head, track, firstsect + i ); - stream_write( dst, data, f->sectuse_size ); - } - block = fat[ block + 1 ]; - } - else if ( nextblock >= 0xc1 && nextblock <= 0xc8 ) { - /* last block in file */ - int i; - UINT8* data; - for ( i = 0; i < nextblock - 0xc1; i++ ) { - data = thom_get_sector( f, head, track, firstsect + i ); - stream_write( dst, data, f->sectuse_size ); - } - data = thom_get_sector( f, head, track, firstsect + i ); - stream_write( dst, data, d->lastsectsize ); - return; - } - else { - /* invalid, assume last block */ - UINT8* data = thom_get_sector( f, head, track, firstsect ); - stream_write( dst, data, d->lastsectsize ); - return; - } - block = nextblock; - } -} - -static void thom_del_file(thom_floppy* f, unsigned head, thom_dirent* d) -{ - UINT8* fat = thom_get_sector( f, head, 20, 2 ); - int nbblocks = thom_nb_blocks(f); - int block = d->firstblock; - if ( d->type != THOM_DIRENT_FILE ) return; - if ( block >= nbblocks ) return; - while ( 1 ) { - int nextblock = fat[ block + 1 ]; - fat[ block ] = 0xff; - if ( nextblock < nbblocks ) block = fat[ block + 1 ]; - else break; - } - d->type = THOM_DIRENT_FREE; - thom_set_dirent( f, head, d->index, d ); - f->modified = 1; -} - -/* create a new file or overwrite an old one, with the contents of src */ -static void thom_put_file(thom_floppy* f, unsigned head, - thom_dirent* d, imgtool_stream *src) -{ - int size = stream_size( src ); - UINT8* fat = thom_get_sector( f, head, 20, 2 ); - int nbblocks = thom_nb_blocks(f); - int block; - - /* find first free block */ - for ( block = 0; block < nbblocks && fat[ block + 1 ] != 0xff; block++ ); - if ( block >= nbblocks ) return; - d->firstblock = block; - - /* store file */ - while (1) { - int track = block / 2; - int firstsect = (block % 2) ? 9 : 1; - int i; - - /* store data, full sectors */ - for ( i = 0; i < 8 && size > f->sectuse_size; i++ ) { - UINT8* dst = thom_get_sector( f, head, track, firstsect + i ); - stream_read( src, dst, f->sectuse_size ); - size -= f->sectuse_size; - } - - /* store data, last sector */ - if ( i < 8 ) { - UINT8* dst = thom_get_sector( f, head, track, firstsect + i ); - stream_read( src, dst, size ); - fat[ block + 1 ] = 0xc1 + i; - d->lastsectsize = size; - break; - } - - /* find next free block & update fat */ - i = block; - for ( block++; block < nbblocks && fat[ block + 1 ] != 0xff; block++ ); - if ( block >= nbblocks ) { - /* out of memory! */ - fat[ i + 1 ] = 0; - d->lastsectsize = 0; - break; - } - fat[ i + 1 ] = block; - } - - d->type = THOM_DIRENT_FILE; - thom_set_dirent( f, head, d->index, d ); - f->modified = 1; -} - - -/********************** module functions ***********************/ - -static imgtoolerr_t thom_get_sector_size(imgtool_image* img, UINT32 track, - UINT32 head, UINT32 sector, - UINT32 *sector_size) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - - if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) { - if ( sector_size ) *sector_size = 0; - return IMGTOOLERR_SEEKERROR; - } - if ( sector_size ) *sector_size = f->sector_size; - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_get_geometry(imgtool_image* img, UINT32* tracks, - UINT32* heads, UINT32* sectors) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - if ( tracks ) *tracks = f->tracks; - if ( heads ) *heads = f->heads; - if ( sectors ) *sectors = 16; - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_read_sector(imgtool_image* img, UINT32 track, - UINT32 head, UINT32 sector, void *buf, - size_t len) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) - return IMGTOOLERR_SEEKERROR; - if ( len > f->sector_size) return IMGTOOLERR_READERROR; - memcpy( buf, thom_get_sector( f, head, track, sector ), len ); - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_write_sector(imgtool_image *img, UINT32 track, - UINT32 head, UINT32 sector, - const void *buf, size_t len, int ddam) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR; - if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) - return IMGTOOLERR_SEEKERROR; - if ( len > f->sector_size) return IMGTOOLERR_WRITEERROR; - f->modified = 1; - memcpy( thom_get_sector( f, head, track, sector ), buf, len ); - return IMGTOOLERR_SUCCESS; -} - -/* returns floopy name */ -/* actually, each side has its own name, but we only return the one on side 0. - */ -static void thom_info(imgtool_image *img, char *string, size_t len) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - UINT8* base = thom_get_sector( f, 0, 20, 1 ); - char buf[9]; - memcpy( buf, base, 8 ); - buf[8] = 0; - thom_stringify( buf ); - strncpy( string, buf, len ); -} - -/* each side of a floppy has its own filesystem, we treat them as'partitions' - */ -static imgtoolerr_t thom_list_partitions(imgtool_image *img, - imgtool_partition_info *partitions, - size_t len) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - if ( len >= 1 ) { - partitions[0].get_info = thom_basic_get_info; - partitions[0].base_block = 0; - partitions[0].block_count = 1; - } - if ( len >= 2 && f->heads >= 2 ) { - partitions[1].get_info = thom_basic_get_info; - partitions[1].base_block = 1; - partitions[1].block_count = 1; - } - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_open_partition(imgtool_partition *part, - UINT64 first_block, UINT64 block_count) -{ - imgtool_image* img = imgtool_partition_image( part ); - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - if ( first_block >= f->heads ) - return IMGTOOLERR_INVALIDPARTITION; - * ( (int*) imgtool_partition_extra_bytes( part ) ) = first_block; - return IMGTOOLERR_SUCCESS; -} - - -static imgtoolerr_t thom_begin_enum(imgtool_directory *enumeration, - const char *path) -{ - int* n = (int*) imgtool_directory_extrabytes( enumeration ); - *n = 0; - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration, - imgtool_dirent *ent) -{ - imgtool_partition *part = imgtool_directory_partition( enumeration); - int head = *( (int*) imgtool_partition_extra_bytes( part ) ); - imgtool_image* img = imgtool_partition_image( part ); - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - int* n = (int*) imgtool_directory_extrabytes( enumeration ); - thom_dirent d; - - do { - thom_get_dirent( f, head, *n, &d ); - (*n) ++; - } - while ( d.type == THOM_DIRENT_FREE ); - if ( d.type == THOM_DIRENT_END ) ent->eof = 1; - else if ( d.type == THOM_DIRENT_INVALID ) { - ent->corrupt = 1; - } - else { - int size; - snprintf( ent->filename, sizeof(ent->filename), "%s.%s", d.name, d.ext ); - snprintf( ent->attr, sizeof(ent->attr), "%c %c %s", - (d.ftype == 0) ? 'B' : (d.ftype == 1) ? 'D' : - (d.ftype == 2) ? 'M' : (d.ftype == 3) ? 'A' : '?', - (d.format == 0) ? 'B' : (d.format == 0xff) ? 'A' : '?', - d.comment ); - ent->creation_time = thom_crack_time( &d ); - size = thom_get_file_size( f, head, &d ); - if ( size >= 0 ) ent->filesize = size; - else { - ent->filesize = 0; - ent->corrupt = 1; - } - } - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_free_space(imgtool_partition *part, UINT64 *size) -{ - int head = *( (int*) imgtool_partition_extra_bytes( part ) ); - imgtool_image* img = imgtool_partition_image( part ); - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - int nb = thom_get_free_blocks( f, head ); - (*size) = nb * f->sectuse_size * 8; - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_read_file(imgtool_partition *part, - const char *filename, - const char *fork, - imgtool_stream *destf) -{ - int head = *( (int*) imgtool_partition_extra_bytes( part ) ); - imgtool_image* img = imgtool_partition_image( part ); - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - thom_dirent d; - char name[9], ext[4], fname[14]; - int size; - - /* convert filename */ - thom_conv_filename( filename, name, ext ); - sprintf( fname, "%s.%s", name, ext ); - - if ( ! thom_find_dirent( f, head, fname, &d ) ) - return IMGTOOLERR_FILENOTFOUND; - size = thom_get_file_size( f, head, &d ); - if ( size < 0 ) return IMGTOOLERR_CORRUPTFILE; - thom_get_file( f, head, &d, destf ); - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_delete_file(imgtool_partition *part, - const char *filename) -{ - int head = *( (int*) imgtool_partition_extra_bytes( part ) ); - imgtool_image* img = imgtool_partition_image( part ); - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - thom_dirent d; - char name[9], ext[4], fname[14]; - - /* convert filename */ - thom_conv_filename( filename, name, ext ); - sprintf( fname, "%s.%s", name, ext ); - - if ( ! thom_find_dirent( f, head, fname, &d ) ) - return IMGTOOLERR_FILENOTFOUND; - /*if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE;*/ - if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR; - thom_del_file( f, head, &d ); - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_write_file(imgtool_partition *part, - const char *filename, - const char *fork, - imgtool_stream *sourcef, - option_resolution *opts) -{ - int head = *( (int*) imgtool_partition_extra_bytes( part ) ); - imgtool_image* img = imgtool_partition_image( part ); - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - thom_dirent d; - int size = stream_size( sourcef ); - int blocks = thom_get_free_blocks( f, head ); - char name[9], ext[4], fname[14]; - const char* comment; - int is_new = 1; - - if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR; - - /* convert filename */ - thom_conv_filename( filename, name, ext ); - sprintf( fname, "%s.%s", name, ext ); - - /* check available space & find dir entry */ - if ( thom_find_dirent( f, head, fname, &d ) ) { - /* file already exists: delete it */ - if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE; - blocks += thom_get_file_blocks( f, head, &d ); - if ( blocks * 8 * f->sectuse_size < size ) return IMGTOOLERR_NOSPACE; - thom_del_file( f, head, &d ); - is_new = 0; - } - else { - /* new file, need new dir entry */ - if ( blocks * 8 * f->sectuse_size < size ) return IMGTOOLERR_NOSPACE; - if ( ! thom_find_free_dirent( f, head, &d ) ) return IMGTOOLERR_NOSPACE; - thom_make_time_now( &d ); - } - - /* fill-in dir entry */ - memcpy( d.name, name, 9 ); - memcpy( d.ext, ext, 4 ); - - /* file type */ - switch ( option_resolution_lookup_int( opts, 'T' ) ) { - case 0: - if ( ! is_new ) break; - if ( ! core_stricmp( ext, "BAS" ) ) d.ftype = 0; - else if ( ! core_stricmp( ext, "BAT" ) ) d.ftype = 0; - else if ( ! core_stricmp( ext, "DAT" ) ) d.ftype = 1; - else if ( ! core_stricmp( ext, "ASC" ) ) d.ftype = 1; - else if ( ! core_stricmp( ext, "BIN" ) ) d.ftype = 2; - else if ( ! core_stricmp( ext, "MAP" ) ) d.ftype = 2; - else if ( ! core_stricmp( ext, "CFG" ) ) d.ftype = 2; - else if ( ! core_stricmp( ext, "ASM" ) ) d.ftype = 3; - else d.ftype = 2; - break; - case 1: d.ftype = 0; break; - case 2: d.ftype = 1; break; - case 3: d.ftype = 2; break; - case 4: d.ftype = 3; break; - } - - /* format flag */ - switch ( option_resolution_lookup_int( opts, 'F' ) ) { - case 0: - if ( ! is_new ) break; - if ( ! core_stricmp( ext, "DAT" ) ) d.format = 0xff; - else if ( ! core_stricmp( ext, "ASC" ) ) d.format = 0xff; - else if ( ! core_stricmp( ext, "ASM" ) ) d.format = 0xff; - else d.format = 0; - break; - case 1: d.format = 0; break; - case 2: d.format = 0xff; break; - } - - /* comment */ - comment = option_resolution_lookup_string( opts, 'C' ); - if ( comment && *comment ) - strncpy( d.comment, comment, 8 ); - - /* write file */ - thom_put_file( f, head, &d, sourcef ); - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_suggest_transfer(imgtool_partition *part, - const char *fname, - imgtool_transfer_suggestion *suggestions, - size_t suggestions_length) -{ - int head = *( (int*) imgtool_partition_extra_bytes( part ) ); - imgtool_image* img = imgtool_partition_image( part ); - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - thom_dirent d; - int is_basic = 0; - - if ( suggestions_length < 1 ) return IMGTOOLERR_SUCCESS; - - if ( fname ) { - if ( ! thom_find_dirent( f, head, fname, &d ) ) - return IMGTOOLERR_FILENOTFOUND; - if ( d.ftype == 0 && d.format == 0 ) is_basic = 1; - } - - if ( is_basic ) { - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = filter_thombas128_getinfo; - if ( suggestions_length >= 2 ) { - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = filter_thombas7_getinfo; - } - if ( suggestions_length >= 3 ) { - suggestions[2].viability = SUGGESTION_POSSIBLE; - suggestions[2].filter = filter_thombas5_getinfo; - } - if ( suggestions_length >= 4 ) { - suggestions[3].viability = SUGGESTION_POSSIBLE; - suggestions[3].filter = NULL; - } - } - else { - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = NULL; - } - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_create(imgtool_image* img, - imgtool_stream *stream, - option_resolution *opts) -{ - thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img ); - int i; - UINT8* buf; - const char* name; - - f->stream = stream; - f->modified = 0; - - /* get parameters */ - f->heads = option_resolution_lookup_int( opts, 'H' ); - f->tracks = option_resolution_lookup_int( opts, 'T' ); - name = option_resolution_lookup_string( opts, 'N' ); - switch ( option_resolution_lookup_int( opts, 'D' ) ) { - case 0: f->sector_size = 128; f->sectuse_size = 128; break; - case 1: f->sector_size = 256; f->sectuse_size = 255; break; - default: return IMGTOOLERR_PARAMCORRUPT; - } - - /* sanity checks */ - switch ( f->tracks ) { - case 25: if ( f->sector_size != 128 ) return IMGTOOLERR_PARAMCORRUPT; break; - case 40: break; - case 80: if ( f->sector_size != 256 ) return IMGTOOLERR_PARAMCORRUPT; break; - default: return IMGTOOLERR_PARAMCORRUPT; - } - - memset( f->data, 0xe5, sizeof( f->data ) ); - - for ( i = 0; i < f->heads; i++ ) { - /* disk info */ - buf = thom_get_sector( f, i, 20, 1 ); - memset( buf, 0xff, f->sector_size ); - if ( name ) { - strncpy( (char*)buf, name, 8 ); - thom_unstringity( (char*)buf, 8 ); - } - else memset( buf, ' ', 8 ); - - /* FAT */ - buf = thom_get_sector( f, i, 20, 2 ); - memset( buf, 0, f->sector_size ); - memset( buf + 1, 0xff, thom_nb_blocks( f ) ); - buf[ 41 ] = buf[ 42 ] = 0xfe; /* reserved for FAT */ - - /* (empty) directory */ - buf = thom_get_sector( f, i, 20, 3 ); - memset( buf, 0xff, 14 * f->sector_size ); - } - - f->modified = 1; - - return IMGTOOLERR_SUCCESS; -} - - -/****************** BASIC tokenization *********************/ - -/* character codes >= 128 are reserved for BASIC keywords */ - -static const char *const thombas7[2][128] = { - { /* statements */ - "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF", - "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", - "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO", - "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", - "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT", - "CONT", "LIST", "CLEAR", "WHILE", "WHEN", "NEW", "SAVE", "LOAD", "MERGE", - "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", - "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", - "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", - ">", "=", "<", - /* DOS specific */ - "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", - "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", - "BACKUP", "COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "DENSITY", - }, - { /* functions: 0xff prefix */ - "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN", - "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", "CSNG", - "CDBL", "FIX", "HEX$", "OCT$", "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$", - "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT", - "SCREEN", "POS", "PTRIG", - /* DOS specific */ - "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF", - "SPACE$", "STRING$", "DSKI$", - } -}; - -/* MO5: some keywords ar missing; DOS and TUNE are added */ -static const char *const thombas5[2][128] = { - { /* statements */ - "END", "FOR", "NEXT", "DATA", "DIM", "READ", NULL, "GO", "RUN", "IF", - "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", - "DEFINT", "DEFSNG", NULL, "ON", "TUNE", "ERROR", "RESUME", "AUTO", - "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", - "BEEP", "COLOR", "LINE", "BOX", NULL, "ATTRB", "DEF", "POKE", "PRINT", - "CONT", "LIST", "CLEAR", "DOS", NULL, "NEW", "SAVE", "LOAD", "MERGE", - "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", - "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", - "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", - ">", "=", "<", - /* DOS specific */ - "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", - "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", - "BACKUP","COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "SEARCH", - "DENSITY", - }, - { /* functions: 0xff prefix */ - "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN", - "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", NULL, - NULL, "FIX", "HEX$", NULL, "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$", - "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT", - "SCREEN", "POS", "PTRIG", - /* DOS specific */ - "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF", - "SPACE$", "STRING$", "DSKI$", - } -}; - -/* BASIC 128 has many new keywords */ -/* DENSITY is missing on BASIC 512 & BASIC 128 for MO6 but, otherwise, they - have the same tokens -*/ -static const char *const thombas128[2][128] = { - { /* statements */ - "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF", - "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR", - "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO", - "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC", - "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT", - "CONT", "LIST", "CLEAR", "INTERVAL", "KEY", "NEW", "SAVE", "LOAD", "MERGE", - "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN", - "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP", - "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@", - ">", "=", "<", - "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET", - "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD", - "BACKUP", "COPY", "CIRCLE", "PAINT", "RESET", "RENUM", "SWAP", "DENSITY", - "WINDOW", "PATTERN", "DO", "LOOP", "EXIT", "INMOUSE", "MOUSE", "CHAINE", - "COMMON", "SEARCH", "FWD", "TURTLE", - }, - { /* functions: 0xff prefix */ - "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN", - "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", "CSNG", - "CDBL", "FIX", "HEX$", "OCT$", "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$", - "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT", - "SCREEN", "POS", "PTRIG", - "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF", - "SPACE$", "STRING$", "DSKI$", - "FKEY$", "MIN(", "MAX(", "ATN", "CRUNCH$", "MTRIG", "EVAL", "PALETTE", - "BANK", "HEAD", "ROT", "SHOW", "ZOOM", "TRACE", - } -}; - -/* tables for simple XOR encryption sieve */ -static const UINT8 crypt1[11] = { - 0x80, 0x19, 0x56, 0xAA, 0x80, 0x76, 0x22, 0xF1, 0x82, 0x38, 0xAA -}; - -static const UINT8 crypt2[13] = { - 0x86, 0x1E, 0xD7, 0xBA, 0x87, 0x99, 0x26, 0x64, 0x87, 0x23, 0x34, 0x58, 0x86 -}; - -/* decrypt BASIC protected files */ -static void thom_decrypt(imgtool_stream* out, imgtool_stream* in) -{ - int i1 = 11, i2 = 13; - while ( 1 ) { - UINT8 b; - if ( stream_read( in, &b, 1) < 1 ) break; - b = ( (UINT8)(b - i2) ^ crypt2[i2-1] ^ crypt1[i1-1] ) + i1; - stream_putc( out, b ); - i1--; i2--; - if ( !i1 ) i1 = 11; - if ( !i2 ) i2 = 13; - } -} - -/* encrypt BASIC protected files */ -static void thom_encrypt(imgtool_stream* out, imgtool_stream* in) -{ - int i1 = 11, i2 = 13; - while ( 1 ) { - UINT8 b; - if ( stream_read( in, &b, 1) < 1 ) break; - b = ( (UINT8)(b - i1) ^ crypt2[i2-1] ^ crypt1[i1-1] ) + i2; - stream_putc( out, b ); - i1--; i2--; - if ( !i1 ) i1 = 11; - if ( !i2 ) i2 = 13; - } -} - -static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part, - const char *name, - const char *fork, imgtool_stream *dst) -{ - UINT8 buf[3]; - imgtool_stream *org = stream_open_mem( NULL, 0 ); - imgtoolerr_t err; - if ( !org ) return IMGTOOLERR_OUTOFMEMORY; - - /* read file */ - err = thom_read_file( part, name, fork, org ); - if ( err ) { - stream_close( org ); - return err; - } - - stream_seek( org, 0, SEEK_SET ); - if ( stream_read( org, buf, 3 ) < 3 || buf[0] != 0xfe ) { - /* regular file */ - stream_seek( org, 0, SEEK_SET ); - stream_transfer_all( dst, org ); - } - else { - /* encrypted file */ - stream_putc( dst, '\xff' ); - stream_write( dst, buf+1, 2 ); - thom_decrypt( dst, org ); - } - - stream_close( org ); - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thomcrypt_write_file(imgtool_partition *part, - const char *name, - const char *fork, imgtool_stream *src, - option_resolution *opts) -{ - UINT8 buf[3]; - - if ( stream_read( src, buf, 3 ) < 3 || buf[0] == 0xfe ) { - /* too short or already encrypted file */ - stream_seek( src, 0, SEEK_SET ); - return thom_write_file( part, name, fork, src, opts ); - } - else { - /* regular file */ - imgtool_stream *dst = stream_open_mem( NULL, 0 ); - imgtoolerr_t err; - if ( !dst ) return IMGTOOLERR_OUTOFMEMORY; - stream_putc( dst, '\xfe' ); - stream_write( dst, buf+1, 2 ); - thom_encrypt( dst, src ); - stream_seek( dst, 0, SEEK_SET ); - err = thom_write_file( part, name, fork, dst, opts ); - stream_close( dst); - return err; - } -} - -void filter_thomcrypt_getinfo(UINT32 state, union filterinfo *info) -{ - switch(state) { - case FILTINFO_STR_NAME: - info->s = "thomcrypt"; - break; - case FILTINFO_STR_HUMANNAME: - info->s = "Thomson BASIC, Protected file encryption (no tokenization)"; - break; - case FILTINFO_PTR_READFILE: - info->read_file = thomcrypt_read_file; - break; - case FILTINFO_PTR_WRITEFILE: - info->write_file = thomcrypt_write_file; - break; - } -} - -/* untokenization automatically decrypt protected files */ -static imgtoolerr_t thom_basic_read_file(imgtool_partition *part, - const char *name, - const char *fork, - imgtool_stream *dst, - const char *const table[2][128]) -{ - imgtool_stream *org = stream_open_mem( NULL, 0 ); - imgtoolerr_t err; - UINT8 buf[4]; - int i; - - if ( !org ) return IMGTOOLERR_OUTOFMEMORY; - - err = thomcrypt_read_file( part, name, fork, org ); - if ( err ) { - stream_close( org ); - return err; - } - stream_seek( org, 3, SEEK_SET ); /* skip header */ - - while ( 1 ) { - int in_str = 0, in_fun = 0; - int linelength, linenum; - - /* line header: line length and line number */ - /* I am not sure this is 100% correct but it works in many cases */ - if ( stream_read( org, buf, 2 ) < 2 ) goto end; - linelength = ((int)buf[0] << 8) + (int)buf[1] - 4; - if ( linelength <= 0 ) goto end; - if ( stream_read( org, buf, 2 ) < 2 ) goto end; - linenum = ((int)buf[0] << 8) + buf[1]; - stream_printf( dst, "%u ", linenum ); - - /* process line */ - for ( i = 0; i < linelength; i++ ) { - UINT8 c; - if ( stream_read( org, &c, 1 ) < 1 ) break; - if ( c == 0 ) { - /* Sometimes, linelength seems wrong and we must rely on the fact that - BASIC lines are 0-terminated. - At other times, there are 0 embedded within lines or extra stuff - between the 0 and the following line, and so, we must rely - on linelength to cut the line (!) - */ - if ( linelength > 256 ) break; - } - else if ( c == 0xff && ! in_str ) in_fun = 1; /* function prefix */ - else { - if ( c >= 0x80 && ! in_str ) { - /* token */ - const char* token = table[ in_fun ][ c - 0x80 ]; - if ( token ) stream_puts( dst, token ); - else stream_puts( dst, "???" ); - } - else { - /* regular character */ - if ( c == '"' ) in_str = 1 - in_str; - stream_putc( dst, c ); /* normal letter */ - } - in_fun = 0; - } - } - stream_putc( dst, '\n' ); - } - end: - - stream_close( org ); - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t thom_basic_write_file(imgtool_partition *part, - const char *name, - const char *fork, - imgtool_stream *src, - option_resolution *opts, - const char *const table[2][128]) -{ - return IMGTOOLERR_UNIMPLEMENTED; -} - - -#define FILTER(short,long) \ - static imgtoolerr_t short##_read_file(imgtool_partition *part, \ - const char *name, \ - const char *fork, \ - imgtool_stream *dst) \ - { \ - return thom_basic_read_file( part, name, fork, dst, short ); \ - } \ - static imgtoolerr_t short##_write_file(imgtool_partition *part, \ - const char *name, \ - const char *fork, \ - imgtool_stream *src, \ - option_resolution *opts) \ - { \ - return thom_basic_write_file( part, name, fork, src, opts, short ); \ - } \ - void filter_##short##_getinfo(UINT32 state, union filterinfo *info) \ - { \ - switch(state) \ - { \ - case FILTINFO_STR_NAME: \ - info->s = #short; \ - break; \ - case FILTINFO_STR_HUMANNAME: \ - info->s = long; \ - break; \ - case FILTINFO_PTR_READFILE: \ - info->read_file = short##_read_file; \ - break; \ - case FILTINFO_PTR_WRITEFILE: \ - info->write_file = short##_write_file; \ - break; \ - } \ - } - -FILTER( thombas5, - "Thomson MO5 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" ) -FILTER( thombas7, - "Thomson TO7 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" ) -FILTER( thombas128, - "Thomson w/ BASIC 128/512, Tokenized Files (read-only, auto-decrypt)" ) - - -/************************* driver ***************************/ - -static OPTION_GUIDE_START( thom_createimage_optguide ) - OPTION_INT( 'H', "heads", "Heads" ) - OPTION_INT( 'T', "tracks", "Tracks" ) - OPTION_ENUM_START( 'D', "density", "Density" ) - OPTION_ENUM( 0, "SD", "Single density (128 bytes)" ) - OPTION_ENUM( 1, "DD", "Double density (256 bytes)" ) - OPTION_ENUM_END - OPTION_STRING( 'N', "name", "Floppy name" ) -OPTION_GUIDE_END - -static OPTION_GUIDE_START( thom_writefile_optguide ) - OPTION_ENUM_START( 'T', "ftype", "File type" ) - OPTION_ENUM( 0, "auto", "Automatic (by extension)" ) - OPTION_ENUM( 1, "B", "Program" ) - OPTION_ENUM( 2, "D", "Data" ) - OPTION_ENUM( 3, "M", "Machine Code" ) - OPTION_ENUM( 4, "A", "Assembler Source" ) - OPTION_ENUM_END - OPTION_ENUM_START( 'F', "format", "Format flag" ) - OPTION_ENUM( 0, "auto", "Automatic (by extension)" ) - OPTION_ENUM( 1, "B", "Binary, Tokenized BASIC" ) - OPTION_ENUM( 2, "A", "ASCII" ) - OPTION_ENUM_END - OPTION_STRING( 'C', "comment", "Comment" ) -OPTION_GUIDE_END - -static void thom_basic_get_info(const imgtool_class *clas, - UINT32 param, - union imgtoolinfo *info) -{ - switch ( param ) { - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: - info->i = sizeof(thom_floppy); break; - case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES: - info->i = sizeof(int); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: - info->i = sizeof(int); break; - case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: - case IMGTOOLINFO_INT_PREFER_UCASE: - info->i = 1; break; - case IMGTOOLINFO_INT_PATH_SEPARATOR: - info->i = 0; break; - case IMGTOOLINFO_STR_FILE: - strcpy( info->s = imgtool_temp_str(), __FILE__ ); break; - case IMGTOOLINFO_STR_NAME: - strcpy( info->s = imgtool_temp_str(), "thom" ); break; - case IMGTOOLINFO_STR_DESCRIPTION: - strcpy( info->s = imgtool_temp_str(), "Thomson BASIC filesystem" ); - break; - case IMGTOOLINFO_PTR_CREATE: - info->create = thom_create; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: - info->createimage_optguide = thom_createimage_optguide; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: - info->begin_enum = thom_begin_enum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: - info->next_enum = thom_next_enum; break; - case IMGTOOLINFO_PTR_READ_FILE: - info->read_file = thom_read_file; break; - case IMGTOOLINFO_PTR_WRITE_FILE: - info->write_file = thom_write_file; break; - case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: - info->writefile_optguide = thom_writefile_optguide; break; - case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: - strcpy( info->s = imgtool_temp_str(), "T[0]-4;F[0]-2;C" ); break; - case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: - info->suggest_transfer = thom_suggest_transfer; break; - case IMGTOOLINFO_PTR_DELETE_FILE: - info->delete_file = thom_delete_file; break; - case IMGTOOLINFO_PTR_FREE_SPACE: - info->free_space = thom_free_space; break; - case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: - info->get_sector_size = thom_get_sector_size; break; - case IMGTOOLINFO_PTR_GET_GEOMETRY: - info->get_geometry = thom_get_geometry; break; - case IMGTOOLINFO_PTR_INFO: - info->info = thom_info; break; - case IMGTOOLINFO_PTR_READ_SECTOR: - info->read_sector = thom_read_sector; break; - case IMGTOOLINFO_PTR_WRITE_SECTOR: - info->write_sector = thom_write_sector; break; - case IMGTOOLINFO_PTR_LIST_PARTITIONS: - info->list_partitions = thom_list_partitions; break; - case IMGTOOLINFO_PTR_OPEN_PARTITION: - info->open_partition = thom_open_partition; break; - } -} - -void thom_fd_basic_get_info(const imgtool_class *clas, - UINT32 param, - union imgtoolinfo *info) -{ - switch ( param ) { - case IMGTOOLINFO_STR_NAME: - strcpy( info->s = imgtool_temp_str(), "thom_fd" ); break; - case IMGTOOLINFO_STR_DESCRIPTION: - strcpy( info->s = imgtool_temp_str(), - "Thomson .fd disk image, BASIC format" ); - break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: - strcpy( info->s = imgtool_temp_str(), "fd" ); break; - case IMGTOOLINFO_PTR_OPEN: - info->open = thom_open_fd_qd; break; - case IMGTOOLINFO_PTR_CLOSE: - info->close = thom_close_fd_qd; break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: - strcpy( info->s = imgtool_temp_str(), "H[1]-2;T40/[80];D0-[1];N" ); break; - default: - thom_basic_get_info( clas, param, info ); - } -} - -void thom_qd_basic_get_info(const imgtool_class *clas, - UINT32 param, - union imgtoolinfo *info) -{ - switch ( param ) { - case IMGTOOLINFO_STR_NAME: - strcpy( info->s = imgtool_temp_str(), "thom_qd" ); break; - case IMGTOOLINFO_STR_DESCRIPTION: - strcpy( info->s = imgtool_temp_str(), - "Thomson .qd disk image, BASIC format" ); - break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: - strcpy( info->s = imgtool_temp_str(), "qd" ); break; - case IMGTOOLINFO_PTR_OPEN: - info->open = thom_open_fd_qd; break; - case IMGTOOLINFO_PTR_CLOSE: - info->close = thom_close_fd_qd; break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: - strcpy( info->s = imgtool_temp_str(), "H[1]-2;T[25];D[0];N" ); break; - default: - thom_basic_get_info( clas, param, info ); - } -} - -void thom_sap_basic_get_info(const imgtool_class *clas, - UINT32 param, - union imgtoolinfo *info) -{ - switch ( param ) { - case IMGTOOLINFO_STR_NAME: - strcpy( info->s = imgtool_temp_str(), "thom_sap" ); break; - case IMGTOOLINFO_STR_DESCRIPTION: - strcpy( info->s = imgtool_temp_str(), - "Thomson .sap disk image, BASIC format" ); - break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: - strcpy( info->s = imgtool_temp_str(), "sap" ); break; - case IMGTOOLINFO_PTR_OPEN: - info->open = thom_open_sap; break; - case IMGTOOLINFO_PTR_CLOSE: - info->close = thom_close_sap; break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: - strcpy( info->s = imgtool_temp_str(), "H[1];T40/[80];D0-[1];N" ); break; - default: - thom_basic_get_info( clas, param, info ); - } -} diff --git a/src/mess/tools/imgtool/modules/ti99.c b/src/mess/tools/imgtool/modules/ti99.c deleted file mode 100644 index 220cbebdb27..00000000000 --- a/src/mess/tools/imgtool/modules/ti99.c +++ /dev/null @@ -1,5360 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Raphael Nabet -/* - Handlers for ti99 disk images - - We support the following types of image: - * floppy disks ("DSK format") in v9t9, pc99 and old mess image format - * hard disks ("WIN format") in MAME harddisk format (256-byte sectors only, - i.e. no SCSI) - Files are extracted in TIFILES format. There is a compile-time option to - extract text files in flat format instead, but I need to re-implement it - properly (using filters comes to mind). - - Raphael Nabet, 2002-2004 - - TODO: - - finish and test hd support ***test sibling FDR support*** - - check allocation bitmap against corruption when an image is opened -*/ - -#include -#include -#include -#include -#include -#include "imgtool.h" -#include "harddisk.h" -#include "imghd.h" - -/* - Concepts shared by both disk structures: - ---------------------------------------- - - In both formats, the entire disk surface is split into physical records, - each 256-byte-long. For best efficiency, the sector size is usually 256 - bytes so that one sector is equivalent to a physical record (this is true - with floppies and HFDC hard disks). If the sector size is not 256 bytes - (e.g. 512 bytes with SCSI hard disks, possibly 128 bytes on a TI-99 - simulator running on TI-990), sectors are grouped or split to form 256-byte - physical records. Physical records are numbered from 0, with the first - starting on sector 0 track 0. To avoid confusion with physical records in - files, such physical records will be called "absolute physical records", - abbreviated as "absolute physrecs" or "aphysrecs". - - Disk space is allocated in units referred to as AUs. Each AU represents an - integral number of 256-byte physical records. The number of physrecs per - AU varies depending on the disk format and size. AUs are numbered from 0, - with the first starting with absolute physrec 0. - - Absolute physrec 0 contains a 256-byte record with volume information, - which is called "Volume Information Block", abbreviated as "vib". - - To keep track of which areas on the disk are allocated and which are free, - disk managers maintain a bit map of allocated AUs (called "allocation - bitmap", abbreviated as "abm"). Each bit in the allocation bitmap - represents an AU: if a bit is 0, the AU is free; if a bit is 1, the AU is - allocated (or possibly bad if the disk manager can track bad sectors). - Where on the disk the abm is located depends on the disk structure (see - structure-specific description for details). - - Files are implemented as a succession of 256-byte physical records. To - avoid confusion with absolute physical records, these physical records will - be called "file physical records", abbreviated as "file physrecs" or - "fphysrecs". - - Programs do normally not access file physical records directly. They may - call high-level file routines that enable to create either fixed-length - logical records of any size from 1 through 255, or variable-length records - of any size from 0 through 254: logical records are grouped by file - managers into 256-byte physical records. Some disk managers (HFDC and - SCSI) allow programs to create fixed-length records larger than 255 bytes, - too, but few programs use this possibility. Additionally, program files - can be created: program files do not implement any logical record, and can - be seen as a flat byte stream, not unlike files under MSDOS, UNIX and the C - standard library. (Unfortunately, the API for program files lacks - flexibility, and most programs that need to process a flat byte stream - will use fixed-size records of 128 bytes.) - - Fixed-length records (reclen < 256) are grouped like this: - fphysrec 0 fphysrec 1 - _______________ _______________ - |R0 |R1 |R2 |X| |R3 |R4 |R5 |X| - --------------- --------------- - \_/ \_/ - unused unused - (size < reclen) (size < reclen) - - Fixed-length records (reclen > 256) are grouped like this: - fphysrec 0 fphysrec 1 fphysrec 2 fphysrec 3 ... - _________________ _________________ _________________ _________________ - | R0 (#0-255) | | R0 (#256-511) | |R0 (#512-end)|X| | R1 (#0-255) | ... - ----------------- ----------------- ----------------- ----------------- - \_/ - unused - - Variable length records are grouped like this: - fphysrec 0: - byte: - ------------------------------ - 0 |l0 = length of record 0 data| - |----------------------------| - 1 | | - | | - : | record 0 data | - | | - l0 | | - |----------------------------| - l0+1 |l1 = length of record 1 data| - |----------------------------| - l0+2 | | - | | - : | record 1 data | - | | - l0+l1+1 | | - |----------------------------| - : : : - : : : - |----------------------------| - n |lm = length of record m data| - |----------------------------| - n+1 | | - | | - : | record m data | - | | - n+lm | | - |----------------------------| - n+lm+1 |>ff: EOR mark | - |----------------------------| - n+lm+2 | | - | | - : | unused | - : |(we should have size < lm+1)| - | | - 255 | | - ------------------------------ - - fphysrec 1: - byte: - ------------------------------ - 0 |lm+1=length of record 0 data| - |----------------------------| - 1 | | - | | - : | record m+1 data | - | | - lm+1 | | - |----------------------------| - : : : - : : : - - I think the EOR mark is not required if all 256 bytes of a physical - record are used by logical records. - - - All files are associated with a "file descriptor record" ("fdr") that holds - file information (name, format, length) and points to the data AUs. The WIN - disk structure also supports sibling FDRs, in case a file is so fragmented - that all the data pointers cannot fit in one FDR; the DSK disk structure - does not implement any such feature, and you may be unable to append data - to an existing file if it is too fragmented, even though the disk is not - full. - - - DSK disk structure: - ------------------- - - The DSK disk structure is used for floppy disks, and a few RAMDISKs as - well. It supports 1600 AUs and 16 MBytes at most (the 16 MByte value is a - theorical maximum, as I doubt anyone has ever created so big a DSK volume). - - The disk sector size is always 256 bytes (the only potential exceptions are - the SCSI floppy disk units and the TI-99 simulator on TI-990, but I don't - know anything about either). - - For some reason, the number of physrecs per AU is always a power of 2. - Originally, AUs always were one physical record each. However, since the - allocation bitmap cannot support more than 1600 AUs, disks larger than - 400kbytes need to have several physical records per AU. Note that - relatively few disk controllers implement AUs that span multiple physical - records (IIRC, these are Myarc's HFDC, SCSI DSR with floppy disk interface, - and some upgraded Myarc and Corcomp DD floppy controllers). - - The allocation bitmap is located in the VIB. It is 200 bytes long, and - supports 1600 AUs at most. - - Directories are implemented with a "File Descriptor Index Record" (FDIR) - for each directory. The FDIR is array of 0 through 128 words, containing - the aphysrec address of each fdr in the directory, sorted by ascending file - name, terminated with a 0. Note that, while we should be prepared to read - images images with 128 entries, I think (not 100% sure) that we should - write no more than 127 for compatibility with some existing disk managers. - - Originally, the DSK structure only supported one directory level (i.e. the - root directory level). The FDIR record for the root directory is always - located in aphysrec 1. Moreover, Myarc extended the DSK structure to - support up to 3 subdirectories in the root directory (note that there is no - support for more subdirs, or for subdirs located in subdirs). To do so, - they used an unused field of the VIB to hold the 10-char name of each - directory and the aphysrec address of the associated FDIR record. - - aphysrec 0: Volume Information Block (VIB): see below - aphysrec 1: FDIR for root directory - Remaining AUs are used for fdr and data (and subdirectory FDIR if - applicable). There is one FDIR record per directory; the FDIR points to - the FDR for each file in the directory. The FDR (File Descriptor Record) - contains the file information (name, format, length, pointers to data - physrecs/AUs, etc). - - - WIN disk structure: - ------------------- - - The WIN disk structure is used for hard disks. It supports 65535 AUs and - 256 MBytes at most. - - The disk sector size is 256 bytes on HFDC, 512 bytes on SCSI. 512-byte - sectors are split into 256-byte physical records. - - We may have from 1 through 16 physrecs per AUs. Since we cannot have more - than 65535 AUs, we need to have several physical records per AU in disks - larger than 16 Mbytes. - - Contrary to the DSK disk structure, the WIN disk structure supports - hierarchic subdirectories, with a limit of 114 subdirectories and 127 files - per directory. Each directory is associated with both a "Directory - Descriptor Record" (DDR) and a "File Descriptor Index Record" (FDIR). The - only exception is the root directory, which uses the VIB instead of a DDR - (the VIB includes all the important fields of the DDR). The DDR contains - some directory info (name, number of files and subdirectories directly - enclosed in the directory, AU address of the FDIR of the parent directory, - etc), the AU address of the associated FDIR, and the AU address of the DDR - of up to 114 subdirectories, sorted by ascending directory name. The WIN - FDIR is similar to, yet different from, the DSK FDIR: it contains up to 127 - (vs. 128) AU address (vs. aphysrec address) of each fdr in the directory, - sorted by ascending file name. Additionally, it includes the AU address of - the associated DDR. - - When a file has more than 54 data fragments, the disk manager creates - sibling FDRs that hold additional fragments. (Sibling FDRs are called - offspring FDRs in most existing documentation, but I prefer "sibling FDRs" - as "offspring FDRs" wrongly suggests a directory-like hierarchy. - Incidentally, I cannot really figure out why they chose to duplicate the - FDR rather than create a file extension record, but there must be a - reason.) Note that sibling FDRs usually fill unused physrecs in the AU - allocated for the eldest FDR, and a new AU is allocated for new sibling - FDRs only when the first AU is full. - - aphysrec 0: Volume Information Block (VIB): see below - aphysrec 1-n (where n = 1+SUP(number_of_AUs/2048)): Volume bitmap - Remaining AUs are used for ddr, fdir, fdr and data. -*/ - -/* Since string length is encoded with a byte, the maximum length of a string -is 255. Since we need to add a device name (1 char minimum, typically 4 chars) -and a '.' separator, we chose a practical value of 250 (though few applications -will accept paths of such length). */ -#define MAX_PATH_LEN 253 -#define MAX_SAFE_PATH_LEN 250 - -#define MAX_DIR_LEVEL 125 /* We need to put a recursion limit to avoid endless recursion hazard */ - - -#if 0 -#pragma mark MISCELLANEOUS UTILITIES -#endif - -/* - Miscellaneous utilities that are used to handle TI data types -*/ - -struct UINT16BE -{ - UINT8 bytes[2]; -}; - -struct UINT16LE -{ - UINT8 bytes[2]; -}; - -INLINE UINT16 get_UINT16BE(UINT16BE word) -{ - return (word.bytes[0] << 8) | word.bytes[1]; -} - -INLINE void set_UINT16BE(UINT16BE *word, UINT16 data) -{ - word->bytes[0] = (data >> 8) & 0xff; - word->bytes[1] = data & 0xff; -} - -INLINE UINT16 get_UINT16LE(UINT16LE word) -{ - return word.bytes[0] | (word.bytes[1] << 8); -} - -INLINE void set_UINT16LE(UINT16LE *word, UINT16 data) -{ - word->bytes[0] = data & 0xff; - word->bytes[1] = (data >> 8) & 0xff; -} - -/* - Convert a C string to a 10-character file name (padded with spaces if necessary) - - dst (O): destination 10-character array - src (I): source C string -*/ -static void str_to_fname(char dst[10], const char *src) -{ - int i; - - - i = 0; - - /* copy 10 characters at most */ - if (src) - while ((i<10) && (src[i]!='\0')) - { - dst[i] = src[i]; - i++; - } - - /* pad with spaces */ - while (i<10) - { - dst[i] = ' '; - i++; - } -} - -/* - Convert a 10-character file name to a C string (removing trailing spaces if necessary) - - dst (O): destination C string - src (I): source 10-character array - n (I): length of dst buffer (string may be truncated if less than 11) -*/ -static void fname_to_str(char *dst, const char src[10], int n) -{ - int i; - int last_nonspace; - - - /* copy 10 characters at most */ - if (--n > 10) - n = 10; - - /* copy filename */ - i = 0; - last_nonspace = -1; - - while (i MAX_PATH_LEN) || strchr(fpath, ' ')) - return 1; - - /* check that each path element has an acceptable length */ - element_start = fpath; - do - { - /* find next path element */ - element_end = strchr(element_start, '.'); - element_len = element_end ? (element_end - element_start) : strlen(element_start); - if ((element_len > 10) || (element_len == 0)) - return 1; - - /* iterate */ - if (element_end) - element_start = element_end+1; - else - element_start = NULL; - } - while (element_start); - - return 0; -} - -#if 0 -#pragma mark - -#pragma mark LEVEL 1 DISK ROUTINES -#endif - -/* - Level 1 deals with accessing the disk hardware (in our case, the raw disk - image). - - Higher level routines will only know the disk as a succession of - 256-byte-long physical records addressed by a linear address. -*/ - -/* - Disk geometry -*/ -struct ti99_geometry -{ - int secspertrack; - int cylinders; - int heads; -}; - -/* - Physical sector address -*/ -struct ti99_sector_address -{ - int sector; - int cylinder; - int side; -}; - -/* - Time stamp (used in fdr, and WIN VIB/DDR) -*/ -struct ti99_date_time -{ - UINT8 time_MSB, time_LSB;/* 0-4: hour, 5-10: minutes, 11-15: seconds/2 */ - UINT8 date_MSB, date_LSB;/* 0-6: year, 7-10: month, 11-15: day */ -}; - -/* - Subdirectory descriptor (HFDC only) - - The HFDC supports up to 3 subdirectories. -*/ -struct dsk_subdir -{ - char name[10]; /* subdirectory name (10 characters, pad with spaces) */ - UINT16BE fdir_aphysrec; /* aphysrec address of fdir record for this subdirectory */ -}; - -/* - DSK VIB record - - Most fields in this record are only relevant to level 2 routines, but level - 1 routines need the disk geometry information extracted from the VIB. -*/ -struct dsk_vib -{ - char name[10]; /* disk volume name (10 characters, pad with spaces) */ - UINT16BE totphysrecs; /* total number of physrecs on disk (usually 360, */ - /* 720, 640, 1280 or 1440). (TI originally */ - /* said it should be the total number of AUs, */ - /* but, in practice, DSRs that supports disks */ - /* over 400kbytes (e.g. HFDC) write the total */ - /* number of physrecs.) */ - UINT8 secspertrack; /* sectors per track (usually 9 (FM SD), */ - /* 16 or 18 (MFM DD), or 36 (MFM HD) */ - UINT8 id[3]; /* 'DSK' */ - UINT8 protection; /* 'P' if disk is protected, ' ' otherwise. */ - UINT8 cylinders; /* tracks per side (usually 40) */ - UINT8 heads; /* sides (1 or 2) */ - UINT8 density; /* density: 1 (FM SD), 2 (MFM DD), or 3 (MFM HD) */ - dsk_subdir subdir[3]; /* descriptor for up to 3 subdirectories (HFDC only) */ - /* reserved by TI */ - UINT8 abm[200]; /* allocation bitmap: there is one bit per AU. */ - /* A binary 1 in a bit position indicates that */ - /* the allocation unit associated with that */ - /* bit has been allocated. */ - /* Bits corresponding to system reserved AUs, */ - /* non-existant AUs, and bad AUs, are set to one, too. */ - /* (AU 0 is associated to LSBit of byte 0, */ - /* AU 7 to MSBit of byte 0, AU 8 to LSBit */ - /* of byte 1, etc.) */ -}; - -enum ti99_img_format -{ - if_mess, - if_v9t9, - if_pc99_fm, - if_pc99_mfm, - if_harddisk -}; - -/* - level-1 disk image descriptor -*/ -struct ti99_lvl1_imgref -{ - ti99_img_format img_format; /* tells the image format */ - imgtool_stream *file_handle; /* imgtool file handle */ - struct mess_hard_disk_file harddisk_handle; /* MAME harddisk handle (harddisk format) */ - ti99_geometry geometry; /* geometry */ - unsigned pc99_track_len; /* unformatted track length (pc99 format) */ - UINT32 *pc99_data_offset_array; /* offset for each sector (pc99 format) */ -}; - -/* - calculate CRC for data address marks or sector data - - crc (I/O): current CRC value to be updated (initialize to 0xffff before - calling this function for the first time) - value: new byte of data to update the CRC with -*/ -static void calc_crc(UINT16 *crc, UINT8 value) -{ - UINT8 l, h; - - l = value ^ (*crc >> 8); - *crc = (*crc & 0xff) | (l << 8); - l >>= 4; - l ^= (*crc >> 8); - *crc <<= 8; - *crc = (*crc & 0xff00) | l; - l = (l << 4) | (l >> 4); - h = l; - l = (l << 2) | (l >> 6); - l &= 0x1f; - *crc = *crc ^ (l << 8); - l = h & 0xf0; - *crc = *crc ^ (l << 8); - l = (h << 1) | (h >> 7); - l &= 0xe0; - *crc = *crc ^ l; -} - -/* - Parse a PC99 disk image - - file_handle (I/O): imgtool file handle - fm_format (I): if true, the image is in FM format, otherwise it is in MFM - format - pass (I): 0 for first pass, 1 for second pass - vib (O): buffer where the vib should be stored (first pass) - geometry (O): disk image geometry (second pass) - data_offset_array (O): array of data offset to generate (second pass) - out_track_len (O): track length is returned there - - Return imgtool error code -*/ -#define MAX_TRACK_LEN 6872 -#define DATA_OFFSET_NONE 0xffffffff -static int parse_pc99_image(imgtool_stream *file_handle, int fm_format, int pass, dsk_vib *vib, const ti99_geometry *geometry, UINT32 *data_offset_array, unsigned *out_track_len) -{ - int track_len, num_tracks; /* length of a track in bytes, and number of tracks */ - int phys_track; - int expected_cylinder, expected_head; - int track_start_pos, track_pos; - UINT8 c; - UINT8 cylinder, head, sector; - int seclen; - UINT8 crc1, crc2; - UINT16 crc; - long data_offset; - UINT8 track_buf[MAX_TRACK_LEN]; - int i; - - if (fm_format) - track_len = 3253; - else - track_len = 6872; - - if (out_track_len) - *out_track_len = track_len; - - if (stream_size(file_handle) % track_len) - return IMGTOOLERR_CORRUPTIMAGE; - - num_tracks = stream_size(file_handle) / track_len; - if (num_tracks <= 0) - return IMGTOOLERR_CORRUPTIMAGE; - - /* we only support 40-track-per-side images */ - if ((num_tracks != 40) && (num_tracks != 80)) - return IMGTOOLERR_UNIMPLEMENTED; - - if (pass == 1) - { - /* initialize offset map */ - for (head = 0; head < geometry->heads; head++) - for (cylinder = 0; cylinder < geometry->cylinders; cylinder++) - for (sector = 0; sector < geometry->secspertrack; sector++) - data_offset_array[(head*geometry->cylinders + cylinder)*geometry->secspertrack + sector] = DATA_OFFSET_NONE; - } - /* rewind to start of file */ - stream_seek(file_handle, 0, SEEK_SET); - - /* pass 0 only looks for vib in track 0; pass 1 scans every track */ - for (phys_track=0; phys_track < ((pass == 1) ? num_tracks : 1); phys_track++) - { - if (stream_read(file_handle, track_buf, track_len) != track_len) - return IMGTOOLERR_READERROR; - - /* we only support 40-track-per-side images */ - expected_cylinder = phys_track % 40; - expected_head = phys_track / 40; - - track_start_pos = 0; - - while (track_start_pos < track_len) - { - if (fm_format) - { - do - { - c = track_buf[track_start_pos]; - track_start_pos++; - } while ((c != 0xfe) && (track_start_pos < track_len)); - - if (c != 0xfe) - break; - - track_pos = track_start_pos; - - crc = 0xffff; - calc_crc(& crc, c); - } - else - { - do - { - c = track_buf[track_start_pos]; - track_start_pos++; - } while ((c != 0xa1) && (track_start_pos < track_len)); - - if (c != 0xa1) - break; - - track_pos = track_start_pos; - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - if (c != 0xa1) - continue; - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - if (c != 0xa1) - continue; - - crc = 0xffff; - calc_crc(& crc, c); - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - if (c != 0xfe) - continue; - } - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - cylinder = c; - calc_crc(& crc, c); - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - head = c; - calc_crc(& crc, c); - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - sector = c; - calc_crc(& crc, c); - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - seclen = 128 << c; - calc_crc(& crc, c); - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - crc1 = c; - calc_crc(& crc, c); - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - crc2 = c; - calc_crc(& crc, c); - -#if 0 - /* CRC seems to be completely hosed */ - if (crc) - printf("aargh!"); -#endif - if ((seclen != 256) || (crc1 != 0xf7) || (crc2 != 0xf7) - || (cylinder != expected_cylinder) || (head != expected_head) - || ((pass == 1) && ((cylinder >= geometry->cylinders) - || (head >= geometry->heads) - || (sector >= geometry->secspertrack)))) - continue; - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - while (c == (fm_format ? 0xff : 0x4e)) - { - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - } - - while (c == 0x00) - { - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - } - - if (fm_format) - { - if (c != 0xfb) - continue; - - crc = 0xffff; - calc_crc(& crc, c); - } - else - { - if (c != 0xa1) - continue; - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - if (c != 0xa1) - continue; - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - if (c != 0xa1) - continue; - - crc = 0xffff; - calc_crc(& crc, c); - - c = track_buf[track_pos]; - track_pos++; - if (track_pos == track_len) - track_pos = 0; - - if (c != 0xfb) - continue; - } - data_offset = track_pos; - for (i=0; icylinders + cylinder)*geometry->secspertrack + sector] != DATA_OFFSET_NONE) - /* error: duplicate sector */ - return IMGTOOLERR_CORRUPTIMAGE; - data_offset_array[(head*geometry->cylinders + cylinder)*geometry->secspertrack + sector] = data_offset; - break; - } - } - } - - if (pass == 0) - return IMGTOOLERR_CORRUPTIMAGE; - - if (pass == 1) - { - /* check offset map */ - for (head = 0; head < geometry->heads; head++) - for (cylinder = 0; cylinder < geometry->cylinders; cylinder++) - for (sector = 0; sector < geometry->secspertrack; sector++) - if (data_offset_array[(head*geometry->cylinders + cylinder)*geometry->secspertrack + sector] == DATA_OFFSET_NONE) - /* error: missing sector */ - return IMGTOOLERR_CORRUPTIMAGE; - } - - return 0; -} - - -/* - Read the volume information block (aphysrec 0) assuming no geometry - information. (Called when an image is opened to figure out the - geometry information.) - - file_handle (I/O): imgtool file handle - img_format (I): image format (MESS, V9T9 or PC99) - dest (O): pointer to 256-byte destination buffer - - Return imgtool error code -*/ -static int read_image_vib_no_geometry(imgtool_stream *file_handle, ti99_img_format img_format, dsk_vib *dest) -{ - int reply; - - switch (img_format) - { - case if_mess: - case if_v9t9: - /* seek to sector */ - reply = stream_seek(file_handle, 0, SEEK_SET); - if (reply) - return IMGTOOLERR_READERROR; - /* read it */ - reply = stream_read(file_handle, dest, 256); - if (reply != 256) - return IMGTOOLERR_READERROR; - return 0; - - case if_pc99_fm: - case if_pc99_mfm: - return parse_pc99_image(file_handle, img_format == if_pc99_fm, 0, dest, NULL, NULL, NULL); - - case if_harddisk: - /* not implemented, because we don't need it */ - break; - } - - return IMGTOOLERR_UNIMPLEMENTED; -} - -/* - Open a disk image at level 1 - - file_handle (I/O): imgtool file handle - img_format (I): image format (MESS, V9T9, PC99, or MAME harddisk) - l1_img (O): level-1 image handle - vib (O): buffer where the vib should be stored (floppy images only) - - Return imgtool error code -*/ -static imgtoolerr_t open_image_lvl1(imgtool_stream *file_handle, ti99_img_format img_format, ti99_lvl1_imgref *l1_img, dsk_vib *vib) -{ - imgtoolerr_t err; - int reply; - UINT16 totphysrecs; - - - l1_img->img_format = img_format; - l1_img->file_handle = file_handle; - - if (img_format == if_harddisk) - { - const hard_disk_info *info; - - err = imghd_open(file_handle, &l1_img->harddisk_handle); - if (err) - return err; - - info = imghd_get_header(&l1_img->harddisk_handle); - l1_img->geometry.cylinders = info->cylinders; - l1_img->geometry.heads = info->heads; - l1_img->geometry.secspertrack = info->sectors; - if (info->sectorbytes != 256) - { - imghd_close(&l1_img->harddisk_handle); - return IMGTOOLERR_CORRUPTIMAGE; /* TODO: support 512-byte sectors */ - } - -#if 0 - /* read vib */ - reply = read_absolute_physrec(l1_img, 0, vib); - if (reply) - return reply; -#endif - } - else - { - /* read vib */ - reply = read_image_vib_no_geometry(file_handle, img_format, vib); - if (reply) - return (imgtoolerr_t)reply; - - /* extract geometry information */ - totphysrecs = get_UINT16BE(vib->totphysrecs); - - l1_img->geometry.secspertrack = vib->secspertrack; - if (l1_img->geometry.secspertrack == 0) - /* Some images might be like this, because the original SSSD TI - controller always assumes 9. */ - l1_img->geometry.secspertrack = 9; - l1_img->geometry.cylinders = vib->cylinders; - if (l1_img->geometry.cylinders == 0) - /* Some images are like this, because the original SSSD TI - controller always assumes 40. */ - l1_img->geometry.cylinders = 40; - l1_img->geometry.heads = vib->heads; - if (l1_img->geometry.heads == 0) - /* Some images are like this, because the original SSSD TI - controller always assumes that tracks beyond 40 are on side 2. */ - l1_img->geometry.heads = totphysrecs / (l1_img->geometry.secspertrack * l1_img->geometry.cylinders); - - /* check information */ - if ((totphysrecs != (l1_img->geometry.secspertrack * l1_img->geometry.cylinders * l1_img->geometry.heads)) - || (totphysrecs < 2) - || memcmp(vib->id, "DSK", 3) || (! strchr(" P", vib->protection)) - || (((img_format == if_mess) || (img_format == if_v9t9)) - && (stream_size(file_handle) != totphysrecs*256U))) - return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; - - if ((img_format == if_pc99_fm) || (img_format == if_pc99_mfm)) - { - l1_img->pc99_data_offset_array = (UINT32*)malloc(sizeof(*l1_img->pc99_data_offset_array)*totphysrecs); - if (! l1_img->pc99_data_offset_array) - return IMGTOOLERR_OUTOFMEMORY; - reply = parse_pc99_image(file_handle, img_format == if_pc99_fm, 1, NULL, & l1_img->geometry, l1_img->pc99_data_offset_array, &l1_img->pc99_track_len); - if (reply) - { - free(l1_img->pc99_data_offset_array); - return (imgtoolerr_t)reply; - } - } - } - - return (imgtoolerr_t)0; -} - -/* - Close a disk image at level 1 - - l1_img (I/O): level-1 image handle - - Return imgtool error code -*/ -static void close_image_lvl1(ti99_lvl1_imgref *l1_img) -{ - if (l1_img->img_format == if_harddisk) - { - imghd_close(&l1_img->harddisk_handle); - } - - stream_close(l1_img->file_handle); - - if ((l1_img->img_format == if_pc99_fm) || (l1_img->img_format == if_pc99_mfm)) - free(l1_img->pc99_data_offset_array); -} - -/* - Convert physical sector address to offset in disk image (old MESS and V9T9 - formats only) - - l1_img (I/O): level-1 image handle - address (I): physical sector address - - Return offset in image -*/ -INLINE int sector_address_to_image_offset(const ti99_lvl1_imgref *l1_img, const ti99_sector_address *address) -{ - int offset = 0; - - switch (l1_img->img_format) - { - case if_mess: - /* old MESS format */ - offset = (((address->cylinder*l1_img->geometry.heads) + address->side)*l1_img->geometry.secspertrack + address->sector)*256; - break; - - case if_v9t9: - /* V9T9 format */ - if (address->side & 1) - /* on side 1, tracks are stored in the reverse order */ - offset = (((address->side*l1_img->geometry.cylinders) + (l1_img->geometry.cylinders-1 - address->cylinder))*l1_img->geometry.secspertrack + address->sector)*256; - else - offset = (((address->side*l1_img->geometry.cylinders) + address->cylinder)*l1_img->geometry.secspertrack + address->sector)*256; - break; - - case if_pc99_fm: - case if_pc99_mfm: - /* pc99 format */ - case if_harddisk: - /* harddisk format */ - assert(1); /* not implemented */ - break; - } - - return offset; -} - -/* - Read one 256-byte sector from a disk image - - l1_img (I/O): level-1 image handle - address (I): physical sector address - dest (O): pointer to 256-byte destination buffer - - Return non-zero on error -*/ -static int read_sector(ti99_lvl1_imgref *l1_img, const ti99_sector_address *address, void *dest) -{ - int reply; - UINT32 track_len, track_offset, sector_offset; - - switch (l1_img->img_format) - { - case if_mess: - /* old MESS format */ - case if_v9t9: - /* V9T9 format */ - /* seek to sector */ - reply = stream_seek(l1_img->file_handle, sector_address_to_image_offset(l1_img, address), SEEK_SET); - if (reply) - return 1; - /* read it */ - reply = stream_read(l1_img->file_handle, dest, 256); - if (reply != 256) - return 1; - break; - - case if_pc99_fm: - case if_pc99_mfm: - /* pc99 format */ - track_len = l1_img->pc99_track_len; - track_offset = (address->side*l1_img->geometry.cylinders + address->cylinder)*track_len; - sector_offset = l1_img->pc99_data_offset_array[(address->side*l1_img->geometry.cylinders + address->cylinder)*l1_img->geometry.secspertrack + address->sector]; - - if ((sector_offset + 256) <= track_len) - { - /* seek to sector */ - reply = stream_seek(l1_img->file_handle, track_offset+sector_offset, SEEK_SET); - if (reply) - return 1; - /* read it */ - reply = stream_read(l1_img->file_handle, dest, 256); - if (reply != 256) - return 1; - } - else - { - /* seek to sector */ - reply = stream_seek(l1_img->file_handle, track_offset+sector_offset, SEEK_SET); - if (reply) - return 1; - /* read first chunk (until end of track) */ - reply = stream_read(l1_img->file_handle, (UINT8 *)dest, track_len-sector_offset); - if (reply != track_len-sector_offset) - return 1; - - /* wrap to start of track */ - reply = stream_seek(l1_img->file_handle, track_offset, SEEK_SET); - if (reply) - return 1; - /* read remnant of sector */ - reply = stream_read(l1_img->file_handle, (UINT8 *)dest + (track_len-sector_offset), 256-(track_len-sector_offset)); - if (reply != 256-(track_len-sector_offset)) - return 1; - } - break; - - case if_harddisk: - /* not implemented */ - assert(1); - /*return imghd_read(l1_img->harddisk_handle, ((address->cylinder*l1_img->geometry.heads) + address->side)*l1_img->geometry.secspertrack + address->sector, 1, dest) != 1;*/ - break; - } - - return 0; -} - -/* - Write one 256-byte sector to a disk image - - l1_img (I/O): level-1 image handle - address (I): physical sector address - src (I): pointer to 256-byte source buffer - - Return non-zero on error -*/ -static int write_sector(ti99_lvl1_imgref *l1_img, const ti99_sector_address *address, const void *src) -{ - int reply; - UINT32 track_len, track_offset, sector_offset; - - switch (l1_img->img_format) - { - case if_mess: - /* old MESS format */ - case if_v9t9: - /* V9T9 format */ - /* seek to sector */ - reply = stream_seek(l1_img->file_handle, sector_address_to_image_offset(l1_img, address), SEEK_SET); - if (reply) - return 1; - /* write it */ - reply = stream_write(l1_img->file_handle, src, 256); - if (reply != 256) - return 1; - break; - - case if_pc99_fm: - case if_pc99_mfm: - /* pc99 format */ - track_len = l1_img->pc99_track_len; - track_offset = (address->side*l1_img->geometry.cylinders + address->cylinder)*track_len; - sector_offset = l1_img->pc99_data_offset_array[(address->side*l1_img->geometry.cylinders + address->cylinder)*l1_img->geometry.secspertrack + address->sector]; - - if ((sector_offset + 256) <= track_len) - { - /* seek to sector */ - reply = stream_seek(l1_img->file_handle, track_offset+sector_offset, SEEK_SET); - if (reply) - return 1; - /* write it */ - reply = stream_write(l1_img->file_handle, src, 256); - if (reply != 256) - return 1; - } - else - { - /* seek to sector */ - reply = stream_seek(l1_img->file_handle, track_offset+sector_offset, SEEK_SET); - if (reply) - return 1; - /* write first chunk (until end of track) */ - reply = stream_write(l1_img->file_handle, (UINT8 *)src, track_len-sector_offset); - if (reply != track_len-sector_offset) - return 1; - - /* wrap to start of track */ - reply = stream_seek(l1_img->file_handle, track_offset, SEEK_SET); - if (reply) - return 1; - /* write remnant of sector */ - reply = stream_write(l1_img->file_handle, (UINT8 *)src + (track_len-sector_offset), 256-(track_len-sector_offset)); - if (reply != 256-(track_len-sector_offset)) - return 1; - } - break; - - case if_harddisk: - /* not implemented */ - assert(1); - /*return imghd_write(l1_img->harddisk_handle, ((address->cylinder*l1_img->geometry.heads) + address->side)*l1_img->geometry.secspertrack + address->sector, 1, src) != 1;*/ - break; - } - - return 0; -} - -/* - Convert physical record address to sector address (DSK format) - - aphysrec (I): absolute physrec address - geometry (I): disk image geometry - address (O): physical sector address -*/ -static void dsk_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address) -{ - address->sector = aphysrec % geometry->secspertrack; - aphysrec /= geometry->secspertrack; - address->cylinder = aphysrec % geometry->cylinders; - address->side = aphysrec / geometry->cylinders; - if (address->side & 1) - /* on side 1, tracks are stored in the reverse order */ - address->cylinder = geometry->cylinders-1 - address->cylinder; -} - -/* - Convert physical record address to sector address (WIN format for HFDC) - - Note that physical address translation makes sense for HFDC, but not SCSI. - - aphysrec (I): absolute physrec address - geometry (I): disk image geometry - address (O): physical sector address -*/ -#ifdef UNUSED_FUNCTION -static void win_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address) -{ - address.sector = aphysrec % l1_img->geometry.secspertrack; - aphysrec /= l1_img->geometry.secspertrack; - address.side = aphysrec % l1_img->geometry.heads; - address.cylinder = aphysrec / l1_img->geometry.heads; -} -#endif - -/* - Read one 256-byte physical record from a disk image - - l1_img (I/O): level-1 image handle - aphysrec (I): absolute physrec address - dest (O): pointer to 256-byte destination buffer - - Return non-zero on error -*/ -static int read_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, void *dest) -{ - ti99_sector_address address; - - - if (l1_img->img_format == if_harddisk) - { -#if 0 - win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); - return read_sector(l1_img, & address, dest); -#endif - - return imghd_read(&l1_img->harddisk_handle, aphysrec, dest) != IMGTOOLERR_SUCCESS; - } - else - { - dsk_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); - - return read_sector(l1_img, & address, dest); - } -} - -/* - Write one 256-byte physical record to a disk image - - l1_img (I/O): level-1 image handle - aphysrec (I): absolute physrec address - src (I): pointer to 256-byte source buffer - - Return non-zero on error -*/ -static int write_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, const void *src) -{ - ti99_sector_address address; - - - if (l1_img->img_format == if_harddisk) - { -#if 0 - win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); - return write_sector(l1_img, & address, dest); -#endif - - return imghd_write(&l1_img->harddisk_handle, aphysrec, src) != IMGTOOLERR_SUCCESS; - } - else - { - dsk_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); - - return write_sector(l1_img, & address, src); - } -} - -#if 0 -#pragma mark - -#pragma mark LEVEL 2 DISK ROUTINES -#endif - -/* - Level 2 implements files as a succession of 256-byte-long physical records. - - Level 2 implements allocation bitmap (and AU), disk catalog, etc. -*/ - -/* - WIN VIB/DDR record -*/ -struct win_vib_ddr -{ - char name[10]; /* disk volume name (10 characters, pad with spaces) */ - UINT16BE totAUs; /* total number of AUs */ - UINT8 secspertrack; /* HFDC: sectors per track (typically 32) */ - /* SCSI: reserved */ - union - { - struct - { - UINT8 id[3]; /* V1 VIB: 'WIN' */ - } vib_v1; - - struct /* V2 VIB: extra params */ - { - UINT8 res_AUs; /* # AUs reserved for vib, bitmap, ddr, fdir and fdr, divided by 64 */ - UINT8 step_spd; /* HFDC: step speed (0-7) */ - /* SCSI: reserved */ - UINT8 red_w_cur;/* HFDC: reduced write current cylinder, divided by 8 */ - /* SCSI: reserved */ - } vib_v2; - - struct - { - UINT8 id[3]; /* DDR: 'DIR' */ - } ddr; - } u; - UINT16BE params; /* bits 0-3: sectors/AU - 1 */ - /* HFDC: */ - /* bits 4-7: # heads - 1 */ - /* bit 8: V1: buffered head stepping flag */ - /* V2: reserved */ - /* bit 9-15: write precompensation track, divided by 16 */ - /* SCSI: */ - /* bits 4-15: reserved */ - ti99_date_time creation;/* date and time of creation */ - UINT8 num_files; /* number of files in directory */ - UINT8 num_subdirs; /* number of subdirectories in directory */ - UINT16BE fdir_AU; /* points to root directory fdir */ - union - { - struct - { - UINT16BE dsk1_AU; /* HFDC: points to current dsk1 emulation image (0 if none) */ - /* SCSI: reserved */ - } vib; - - struct - { - UINT16BE parent_ddr_AU; /* points to parent directory DDR */ - } ddr; - } u2; - UINT16BE subdir_AU[114];/* points to all subdirectory DDRs */ -}; - -/* - AU format -*/ -struct ti99_AUformat -{ - int totAUs; /* total number of AUs */ - int physrecsperAU; /* number of 256-byte physical records per AU */ -}; - -/* - DSK directory reference: 0 for root, 1 for 1st subdir, 2 for 2nd subdir, 3 - for 3rd subdir -*/ -/*typedef int dir_ref;*/ - -/* - catalog entry (used for in-memory catalog) -*/ -struct dir_entry -{ - UINT16 dir_ptr; /* DSK: unused */ - /* WIN: AU address of the DDR for this directory */ - char name[10]; /* name of this directory (copied from the VIB for DSK, DDR for WIN) */ -}; - -struct file_entry -{ - UINT16 fdr_ptr; /* DSK: aphysrec address of the FDR for this file */ - /* WIN: AU address of the FDR for this file */ - char name[10]; /* name of this file (copied from FDR) */ -}; - -struct ti99_catalog -{ - int num_subdirs; /* number of subdirectories */ - int num_files; /* number of files */ - dir_entry subdirs[114]; /* description of each subdir */ - file_entry files[128]; /* description of each file */ -}; - -/* - level-2 disk image descriptor -*/ -struct ti99_lvl2_imgref_dsk -{ - UINT16 totphysrecs; /* total number of aphysrecs (extracted from vib record in aphysrec 0) */ - ti99_catalog catalogs[4]; /* catalog of root directory and up to 3 subdirectories */ - UINT16 fdir_aphysrec[4]; /* fdir aphysrec address for root directory - and up to 3 subdirectories */ -}; - -enum win_vib_t -{ - win_vib_v1, - win_vib_v2 -}; -struct ti99_lvl2_imgref_win -{ - win_vib_t vib_version; /* version of the vib record in aphysrec 0 (see win_vib_ddr) */ -}; - -enum l2i_t -{ - L2I_DSK, - L2I_WIN -}; - -struct ti99_lvl2_imgref -{ - ti99_lvl1_imgref l1_img;/* image format, imgtool image handle, image geometry */ - ti99_AUformat AUformat; /* AU format */ - int data_offset; /* In order to reduce seek times when searching the - disk for a given file name, fdr (and ddr, and - fdir) records are preferentially allocated in - AUs n to data_offset, whereas data records are - preferentially allocated in AUs starting at - data_offset. */ - /* With the DSK disk structure, n is always 2 (if 1 - physrec per AU) or 1 (if 2 physrecs per AU or - more), and data_offset is arbitrarily chosen as - 34. */ - /* With the WIN disk structure, n depends on the - size of the volume bitmap, which itself depends - on the number of AUs on disk (we always have n - <= 33), and data_offset is read from the vib - record (except with the obsolete v1 VIB, where - we use a default value of 64). */ - char vol_name[10]; /* cached volume name (extracted from vib record in aphysrec 0) */ - - UINT8 abm[8192]; /* allocation bitmap */ - - l2i_t type; /* structure format */ - - union - { - ti99_lvl2_imgref_dsk dsk; - ti99_lvl2_imgref_win win; - }; /* structure-specific info */ -}; - -/* - file flags found in fdr (and tifiles) -*/ -enum -{ - fdr99_f_program = 0x01, /* set for program files */ - fdr99_f_int = 0x02, /* set for binary files */ - fdr99_f_wp = 0x08, /* set if file is write-protected */ - /*fdr99_f_backup = 0x10,*/ /* set if file has been modified since last backup */ - /*fdr99_f_dskimg = 0x20,*/ /* set if file is a DSK image (HFDC HD only) */ - fdr99_f_var = 0x80 /* set if file uses variable-length records*/ -}; - -/* - DSK FDR record -*/ -struct dsk_fdr -{ - char name[10]; /* file name (10 characters, pad with spaces) */ - UINT16BE xreclen; /* extended record len: if record len is >= 256, */ - /* reclen is set to 0 and the actual reclen is */ - /* stored here (Myarc HFDC only). TI reserved */ - /* this field for data chain pointer extension, */ - /* but this was never implemented. */ - UINT8 flags; /* file status flags (see enum above) */ - UINT8 recsperphysrec; /* logical records per physrec */ - /* ignored for variable length record files and */ - /* program files */ - UINT16BE fphysrecs; /* file length in physrecs */ - /* Note that the HFDC defines this field as the */ - /* number of allocated physrecs in the cluster */ - /* chain (i.e. rounded on the next AU */ - /* boundary), so level-3 routines should use */ - /* the fixrecs field instead to determine the */ - /* logical length of field. IIRC, the HFDC */ - /* implementation is regarded as a bug because */ - /* program files do not define the fixrecs field */ - /* field, so program field saved by the HFDC */ - /* DSR may be larger whan they should. */ - UINT8 eof; /* EOF offset in last physrec for variable length */ - /* record files and program files (0->256)*/ - UINT8 reclen; /* logical record size in bytes ([1,255] 0->256) */ - /* Maximum allowable record size for variable */ - /* length record files. Reserved for program */ - /* files (set to 0). Set to 0 if reclen >=256 */ - /* (HFDC only). */ - UINT16LE fixrecs; /* file length in logical records */ - /* For variable length record files, number of */ - /* 256-byte records actually used. */ - ti99_date_time creation;/* date and time of creation (HFDC and BwG only; */ - /* reserved in TI) */ - ti99_date_time update; /* date and time of last write to file (HFDC and */ - /* BwG only; reserved in TI) */ - UINT8 clusters[76][3]; /* data cluster table: 0 through 76 entries (3 */ - /* bytes each), one entry for each file cluster. */ - /* 12 bits: address of first AU of cluster */ - /* 12 bits: offset of last 256-byte record in cluster */ -}; - -/* - WIN FDR record -*/ -struct win_fdr -{ - char name[10]; /* file name (10 characters, pad with spaces) */ - UINT16BE xreclen; /* extended record len: if record len is >= 256, */ - /* reclen is set to 0 and the actual reclen is */ - /* stored here (Myarc HFDC only). TI reserved */ - /* this field for data chain pointer extension, */ - /* but this was never implemented. */ - UINT8 flags; /* file status flags (see enum above) */ - UINT8 recsperphysrec; /* logical records per physrec */ - /* ignored for variable length record files and */ - /* program files */ - UINT16BE fphysrecs_LSW; /* eldest FDR: file length in physrecs */ - /* Note that the HFDC defines this field as the */ - /* number of allocated physrecs in the cluster */ - /* chain (i.e. rounded on the next AU */ - /* boundary), so level-3 routines should use */ - /* the fixrecs field instead to determine the */ - /* logical length of field. IIRC, the HFDC */ - /* implementation is regarded as a bug because */ - /* program files do not define the fixrecs field */ - /* field, so program field saved by the HFDC */ - /* DSR may be larger whan they should. */ - /* other sibling FDRs: index of the first file */ - /* physrec in this particular sibling FDR */ - UINT8 eof; /* EOF offset in last physrec for variable length */ - /* record files and program files (0->256)*/ - UINT8 reclen; /* logical record size in bytes ([1,255]) */ - /* Maximum allowable record size for variable */ - /* length record files. Reserved for program */ - /* files (set to 0). Set to 0 if reclen >=256 */ - /* (HFDC only). */ - UINT16LE fixrecs_LSW; /* file length in logical records */ - /* For variable length record files, number of */ - /* 256-byte records actually used. */ - ti99_date_time creation;/* date and time of creation */ - ti99_date_time update; /* date and time of last write to file */ - - char id[2]; /* 'FI' */ - UINT16BE prevsibFDR_AU; /* address of the AU where previous sibling FDR is */ - /* (see also xinfo_LSB) */ - UINT16BE nextsibFDR_AU; /* address of the AU where next sibling FDR is */ - /* (see also xinfo_LSB) */ - UINT16BE sibFDR_AUlen; /* total number of data AUs allocated in this particular sibling FDR */ - UINT16BE parent_FDIR_AU;/* FDIR the file is listed in */ - UINT8 xinfo_MSB; /* extended information (MSByte) */ - /* bits 0-3: MSN of fphysrecs */ - /* bits 4-7: MSN of fixrecs */ - UINT8 xinfo_LSB; /* extended information (LSByte) */ - /* bits 8-11: physrec offset within AU for */ - /* previous sibling FDR (see prevsibFDR_AU) */ - /* bits 12-15: physrec offset within AU for */ - /* next sibling FDR (see nextsibFDR_AU) */ - UINT16BE clusters[54][2];/* data cluster table: 0 through 54 entries (4 */ - /* bytes each), one entry for each file cluster. */ - /* 16 bits: address of first AU of cluster */ - /* 16 bits: address of last AU of cluster */ -}; - -/* - tifile header: stand-alone file -*/ -struct tifile_header -{ - char tifiles[8]; /* always '\7TIFILES' */ - UINT16BE fphysrecs; /* file length in physrecs */ - UINT8 flags; /* see enum above */ - UINT8 recsperphysrec; /* records per physrec */ - UINT8 eof; /* current position of eof in last physrec (0->255)*/ - UINT8 reclen; /* bytes per record ([1,255] 0->256) */ - UINT16BE fixrecs; /* file length in records */ - UINT8 res[128-16]; /* reserved */ - /* * variant a: */ - /* 112 chars: 0xCA53 repeated 56 times */ - /* * variant b: */ - /* 4 chars: unknown */ - /* 108 chars: 0xCA53 repeated 54 times */ - /* * variant c: */ - /* 10 chars: original TI file name filed with spaces */ - /* 102 chars: spaces */ - /* * variant d: */ - /* 10 chars: original TI file name filed with spaces */ - /* 2 chars: CR+LF */ - /* 98 chars: spaces */ - /* 2 chars: CR+LF */ - /* * variant e: */ - /* 10 chars: original TI file name */ - /* 4 bytes: unknown */ - /* 4 bytes: time & date of creation */ - /* 4 bytes: time & date of last update */ - /* 90 chars: spaces */ - /* * variant f: */ - /* 6 bytes: 'MYTERM' */ - /* 4 bytes: time & date of creation */ - /* 4 bytes: time & date of last update */ - /* 2 bytes: unknown (always >0000) */ - /* 96 chars: 0xCA53 repeated 56 times */ -}; - -/* - level-2 file descriptor -*/ -struct ti99_lvl2_fileref_dsk -{ - struct ti99_lvl2_imgref *l2_img; - int fdr_aphysrec; - dsk_fdr fdr; -}; - -struct ti99_lvl2_fileref_win -{ - struct ti99_lvl2_imgref *l2_img; - unsigned fphysrecs; /* copy of field in the eldest FDR */ - unsigned eldestfdr_aphysrec; /* aphysrec address of the eldest FDR */ - unsigned curfdr_aphysrec; /* aphysrec address of the currently open sibling FDR */ - win_fdr curfdr; /* buffer with currently open sibling FDR */ -}; - -struct ti99_lvl2_fileref_tifiles -{ - imgtool_stream *file_handle; - tifile_header hdr; -}; - -enum l2f_type_t -{ - L2F_DSK, - L2F_WIN, - L2F_TIFILES -}; - -struct ti99_lvl2_fileref -{ - l2f_type_t type; - union - { - ti99_lvl2_fileref_dsk dsk; - ti99_lvl2_fileref_win win; - ti99_lvl2_fileref_tifiles tifiles; - }; -}; - -/* - Compare two (possibly empty) catalog entry for qsort -*/ -static int cat_file_compare_qsort(const void *p1, const void *p2) -{ - const file_entry *entry1 = (const file_entry *)p1; - const file_entry *entry2 = (const file_entry *)p2; - - if ((entry1->fdr_ptr == 0) && (entry2->fdr_ptr == 0)) - return 0; - else if (entry1->fdr_ptr == 0) - return +1; - else if (entry2->fdr_ptr == 0) - return -1; - else - return memcmp(entry1->name, entry2->name, 10); -} - -static int cat_dir_compare_qsort(const void *p1, const void *p2) -{ - const dir_entry *entry1 = (const dir_entry *)p1; - const dir_entry *entry2 = (const dir_entry *)p2; - - if ((entry1->dir_ptr == 0) && (entry2->dir_ptr == 0)) - return 0; - else if (entry1->dir_ptr == 0) - return +1; - else if (entry2->dir_ptr == 0) - return -1; - else - return memcmp(entry1->name, entry2->name, 10); -} - -/* - Read a directory catalog from disk image - - l2_img: image reference - aphysrec: physical record address of the FDIR - dest: pointer to the destination buffer where the catalog should be written - - Return an error code if there was an error, 0 otherwise. -*/ -static int dsk_read_catalog(struct ti99_lvl2_imgref *l2_img, int aphysrec, ti99_catalog *dest) -{ - int totphysrecs = l2_img->dsk.totphysrecs; - UINT16BE fdir_buf[128]; - dsk_fdr fdr; - int i; - int reply; - - - /* Read FDIR record */ - reply = read_absolute_physrec(& l2_img->l1_img, aphysrec, fdir_buf); - if (reply) - return IMGTOOLERR_READERROR; - - /* Copy FDIR info to catalog structure */ - for (i=0; i<128; i++) - dest->files[i].fdr_ptr = get_UINT16BE(fdir_buf[i]); - - /* Check FDIR pointers and check and extract file names from DDRs */ - for (i=0; i<128; i++) - { - if (dest->files[i].fdr_ptr >= totphysrecs) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - else if (dest->files[i].fdr_ptr) - { - reply = read_absolute_physrec(& l2_img->l1_img, dest->files[i].fdr_ptr, &fdr); - if (reply) - return IMGTOOLERR_READERROR; - - /* check and copy file name */ - if (check_fname(fdr.name)) - return IMGTOOLERR_CORRUPTIMAGE; - memcpy(dest->files[i].name, fdr.name, 10); - } - } - - /* Check catalog */ - for (i=0; i<127; i++) - { - if (((! dest->files[i].fdr_ptr) && dest->files[i+1].fdr_ptr) - || ((dest->files[i].fdr_ptr && dest->files[i+1].fdr_ptr) && (memcmp(dest->files[i].name, dest->files[i+1].name, 10) >= 0))) - { - /* if the catalog is not sorted, we repair it */ - qsort(dest->files, ARRAY_LENGTH(dest->files), sizeof(dest->files[0]), - cat_file_compare_qsort); - break; - } - } - - /* Set file count */ - for (i=0; (i<128) && (dest->files[i].fdr_ptr != 0); i++) - ; - dest->num_files = i; - - /* Set subdir count to 0 (subdirs are loaded elsewhere) */ - dest->num_subdirs = 0; - - return 0; -} - -/* - Read a directory catalog from disk image - - l2_img: image reference - DDR_AU: AU address of the VIB/DDR - dest: pointer to the destination buffer where the catalog should be written - - Return an error code if there was an error, 0 otherwise. -*/ -static int win_read_catalog(struct ti99_lvl2_imgref *l2_img, int DDR_AU, ti99_catalog *dest) -{ - win_vib_ddr ddr_buf; - UINT16BE fdir_buf[128]; - win_fdr fdr_buf; - int i; - int reply; - - - /* Read DDR record */ - reply = read_absolute_physrec(& l2_img->l1_img, DDR_AU*l2_img->AUformat.physrecsperAU, &ddr_buf); - if (reply) - return IMGTOOLERR_READERROR; - - /* sanity checks */ - if ((ddr_buf.num_files > 127) || (ddr_buf.num_subdirs > 114) || (get_UINT16BE(ddr_buf.fdir_AU) > l2_img->AUformat.totAUs)) - return IMGTOOLERR_CORRUPTIMAGE; - - /* set file count and subdir count */ - dest->num_files = ddr_buf.num_files; - dest->num_subdirs = ddr_buf.num_subdirs; - - /* Copy DDR info to catalog structure */ - for (i=0; isubdirs[i].dir_ptr = get_UINT16BE(ddr_buf.subdir_AU[i]); - - /* Read FDIR record */ - reply = read_absolute_physrec(& l2_img->l1_img, get_UINT16BE(ddr_buf.fdir_AU)*l2_img->AUformat.physrecsperAU, fdir_buf); - if (reply) - return IMGTOOLERR_READERROR; - - /* Copy FDIR info to catalog structure */ - for (i=0; inum_files; i++) - dest->files[i].fdr_ptr = get_UINT16BE(fdir_buf[i]); - - /* Check DDR pointers and check and extract file names from FDRs */ - for (i=0; inum_subdirs; i++) - { - if (dest->subdirs[i].dir_ptr >= l2_img->AUformat.totAUs) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - else if (dest->subdirs[i].dir_ptr) - { - reply = read_absolute_physrec(& l2_img->l1_img, dest->subdirs[i].dir_ptr*l2_img->AUformat.physrecsperAU, &ddr_buf); - if (reply) - return IMGTOOLERR_READERROR; - - /* check and copy file name */ - if (check_fname(ddr_buf.name)) - return IMGTOOLERR_CORRUPTIMAGE; - memcpy(dest->subdirs[i].name, ddr_buf.name, 10); - } - } - - /* Check FDIR pointers and check and extract file names from FDRs */ - for (i=0; inum_files; i++) - { - if (dest->files[i].fdr_ptr >= l2_img->AUformat.totAUs) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - else if (dest->files[i].fdr_ptr) - { - reply = read_absolute_physrec(& l2_img->l1_img, dest->files[i].fdr_ptr*l2_img->AUformat.physrecsperAU, &fdr_buf); - if (reply) - return IMGTOOLERR_READERROR; - - /* check and copy file name */ - if (check_fname(fdr_buf.name)) - return IMGTOOLERR_CORRUPTIMAGE; - memcpy(dest->files[i].name, fdr_buf.name, 10); - } - } - - /* Check catalog */ - - /* Check subdir order */ - for (i=0; inum_subdirs-1; i++) - { - if (((! dest->subdirs[i].dir_ptr) && dest->subdirs[i+1].dir_ptr) - || ((dest->subdirs[i].dir_ptr && dest->subdirs[i+1].dir_ptr) && (memcmp(dest->subdirs[i].name, dest->subdirs[i+1].name, 10) >= 0))) - { - /* if the subdir catalog is not sorted, we repair it */ - qsort(dest->subdirs, dest->num_subdirs, sizeof(dest->subdirs[0]), cat_dir_compare_qsort); - break; - } - } - - /* Fix subdir count */ - while (dest->num_subdirs && (dest->subdirs[dest->num_subdirs-1].dir_ptr == 0)) - dest->num_subdirs--; - - /* Check file order */ - for (i=0; inum_files-1; i++) - { - if (((! dest->files[i].fdr_ptr) && dest->files[i+1].fdr_ptr) - || ((dest->files[i].fdr_ptr && dest->files[i+1].fdr_ptr) && (memcmp(dest->files[i].name, dest->files[i+1].name, 10) >= 0))) - { - /* if the file catalog is not sorted, we repair it */ - qsort(dest->files, dest->num_files, sizeof(dest->files[0]), cat_file_compare_qsort); - break; - } - } - - /* Fix file count */ - while (dest->num_files && (dest->files[dest->num_files-1].fdr_ptr == 0)) - dest->num_files--; - - return 0; -} - -/* - Search for a file path on a floppy image - - l2_img: image reference - fpath: path of the file to search - parent_ref_valid: set to TRUE if either the file was found or the file was - not found but its parent dir was - parent_ref: reference to parent dir (0 for root) - out_is_dir: TRUE if element is a directory - catalog_index: on output, index of file catalog entry (may be NULL) -*/ -static int dsk_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *fpath, int *parent_ref_valid, int *parent_ref, int *out_is_dir, int *catalog_index) -{ - int i; - const ti99_catalog *cur_catalog; - const char *element_start, *element_end; - int element_len; - char element[10]; - int is_dir = FALSE; - - - cur_catalog = & l2_img->dsk.catalogs[0]; - if (parent_ref_valid) - (* parent_ref_valid) = FALSE; - if (parent_ref) - *parent_ref = 0; - - element_start = fpath; - do - { - /* find next path element */ - element_end = strchr(element_start, '.'); - element_len = element_end ? (element_end - element_start) : strlen(element_start); - if ((element_len > 10) || (element_len == 0)) - return IMGTOOLERR_BADFILENAME; - /* last path element */ - if ((!element_end) && parent_ref_valid) - (* parent_ref_valid) = TRUE; - - /* generate file name */ - memcpy(element, element_start, element_len); - memset(element+element_len, ' ', 10-element_len); - - /* search entry in subdirectories */ - for (i = 0; inum_subdirs; i++) - { - if (! memcmp(element, cur_catalog->subdirs[i].name, 10)) - { - is_dir = TRUE; - break; - } - } - - /* if it failed, search entry in files */ - if (i == cur_catalog->num_subdirs) - { - for (i = 0; inum_files; i++) - { - if (! memcmp(element, cur_catalog->files[i].name, 10)) - { - is_dir = FALSE; - break; - } - } - /* exit if not found */ - if (i == cur_catalog->num_files) - { - return IMGTOOLERR_FILENOTFOUND; - } - } - - /* iterate */ - if (element_end) - { - element_start = element_end+1; - - if (! is_dir) - /* this is not a directory */ - return IMGTOOLERR_BADFILENAME; - - /* initialize cur_catalog */ - cur_catalog = & l2_img->dsk.catalogs[i+1]; - if (parent_ref) - *parent_ref = i+1; - } - else - element_start = NULL; - } - while (element_start); - - if (out_is_dir) - *out_is_dir = is_dir; - - if (catalog_index) - *catalog_index = i; - - return 0; -} - -/* - Search for a file path on a harddisk image - - l2_img: image reference - fpath: path of the file to search - parent_ref_valid: set to TRUE if either the file was found or the file was - not found but its parent dir was - parent_ddr_AU: parent DDR AU address (0 for root) - parent_catalog: catalog of parent dir (cannot be NULL) - out_is_dir: TRUE if element is a directory - catalog_index: on output, index of file catalog entry (may be NULL) -*/ -static int win_find_catalog_entry(struct ti99_lvl2_imgref *l2_img, const char *fpath, - int *parent_ref_valid, int *parent_ddr_AU, ti99_catalog *parent_catalog, - int *out_is_dir, int *catalog_index) -{ - int i; - const char *element_start, *element_end; - int element_len; - char element[10]; - int is_dir = FALSE; - int errorcode; - - if (parent_ref_valid) - (* parent_ref_valid) = FALSE; - if (parent_ddr_AU) - *parent_ddr_AU = 0; - - errorcode = win_read_catalog(l2_img, 0, parent_catalog); - if (errorcode) - return errorcode; - - element_start = fpath; - do - { - /* find next path element */ - element_end = strchr(element_start, '.'); - element_len = element_end ? (element_end - element_start) : strlen(element_start); - if ((element_len > 10) || (element_len == 0)) - return IMGTOOLERR_BADFILENAME; - /* last path element */ - if ((!element_end) && parent_ref_valid) - (* parent_ref_valid) = TRUE; - - /* generate file name */ - memcpy(element, element_start, element_len); - memset(element+element_len, ' ', 10-element_len); - - /* search entry in subdirectories */ - for (i = 0; inum_subdirs; i++) - { - if (! memcmp(element, parent_catalog->subdirs[i].name, 10)) - { - is_dir = TRUE; - break; - } - } - - /* if it failed, search entry in files */ - if (i == parent_catalog->num_subdirs) - { - for (i = 0; inum_files; i++) - { - if (! memcmp(element, parent_catalog->files[i].name, 10)) - { - is_dir = FALSE; - break; - } - } - /* exit if not found */ - if (i == parent_catalog->num_files) - { - return IMGTOOLERR_FILENOTFOUND; - } - } - - /* iterate */ - if (element_end) - { - element_start = element_end+1; - - if (! is_dir) - /* this is not a directory */ - return IMGTOOLERR_BADFILENAME; - - if (parent_ddr_AU) - *parent_ddr_AU = parent_catalog->subdirs[i].dir_ptr; - - errorcode = win_read_catalog(l2_img, parent_catalog->subdirs[i].dir_ptr, parent_catalog); - if (errorcode) - return errorcode; - } - else - element_start = NULL; - } - while (element_start); - - if (out_is_dir) - *out_is_dir = is_dir; - - if (catalog_index) - *catalog_index = i; - - return 0; -} - -/* - Allocate one AU on disk, for use as a fdr record - - l2_img: image reference - fdr_AU: on output, address of allocated AU -*/ -static int alloc_fdr_AU(struct ti99_lvl2_imgref *l2_img, unsigned *fdr_AU) -{ - int totAUs = l2_img->AUformat.totAUs; - int i; - - for (i=0; iabm[i >> 3] & (1 << (i & 7)))) - { - *fdr_AU = i; - l2_img->abm[i >> 3] |= 1 << (i & 7); - - return 0; - } - } - - return IMGTOOLERR_NOSPACE; -} - -INLINE int get_dsk_fdr_cluster_baseAU(struct ti99_lvl2_imgref *l2_img, dsk_fdr *fdr, int cluster_index) -{ - int reply; - - /* read base AU/physrec for this cluster */ - reply = ((fdr->clusters[cluster_index][1] & 0xf) << 8) | fdr->clusters[cluster_index][0]; - /* convert to AU address */ - if (l2_img->AUformat.physrecsperAU <= 2) - reply /= l2_img->AUformat.physrecsperAU; - - return reply; -} - -INLINE int get_dsk_fdr_cluster_baseaphysrec(struct ti99_lvl2_imgref *l2_img, dsk_fdr *fdr, int cluster_index) -{ - int reply; - - /* read base AU/physrec for this cluster */ - reply = ((fdr->clusters[cluster_index][1] & 0xf) << 8) | fdr->clusters[cluster_index][0]; - /* convert to physrec address */ - if (l2_img->AUformat.physrecsperAU > 2) - reply *= l2_img->AUformat.physrecsperAU; - - return reply; -} - -INLINE int get_dsk_fdr_cluster_lastfphysrec(dsk_fdr *fdr, int cluster_index) -{ - return (fdr->clusters[cluster_index][2] << 4) | (fdr->clusters[cluster_index][1] >> 4); -} - -INLINE void set_dsk_fdr_cluster_lastfphysrec(dsk_fdr *fdr, int cluster_index, int data) -{ - fdr->clusters[cluster_index][1] = (fdr->clusters[cluster_index][1] & 0x0f) | (data << 4); - fdr->clusters[cluster_index][2] = data >> 4; -} - -INLINE void set_dsk_fdr_cluster(struct ti99_lvl2_imgref *l2_img, dsk_fdr *fdr, int cluster_index, int baseAU, int lastfphysrec) -{ - /* convert AU address to FDR value */ - if (l2_img->AUformat.physrecsperAU <= 2) - baseAU *= l2_img->AUformat.physrecsperAU; - - /* write cluster entry */ - fdr->clusters[cluster_index][0] = baseAU; - fdr->clusters[cluster_index][1] = ((baseAU >> 8) & 0x0f) | (lastfphysrec << 4); - fdr->clusters[cluster_index][2] = lastfphysrec >> 4; -} - -INLINE unsigned get_win_fdr_fphysrecs(win_fdr *fdr) -{ - return (((unsigned) fdr->xinfo_MSB << 12) & 0xf0000) | get_UINT16BE(fdr->fphysrecs_LSW); -} - -INLINE void set_win_fdr_fphysrecs(win_fdr *fdr, unsigned data) -{ - fdr->xinfo_MSB = (fdr->xinfo_MSB & 0x0f) | ((data >> 12) & 0xf0); - set_UINT16BE(&fdr->fphysrecs_LSW, data & 0xffff); -} - -INLINE unsigned get_win_fdr_fixrecs(win_fdr *fdr) -{ - return (((unsigned) fdr->xinfo_MSB << 16) & 0xf0000) | get_UINT16LE(fdr->fixrecs_LSW); -} - -INLINE void set_win_fdr_fixrecs(win_fdr *fdr, unsigned data) -{ - fdr->xinfo_MSB = (fdr->xinfo_MSB & 0xf0) | ((data >> 16) & 0x0f); - set_UINT16LE(&fdr->fixrecs_LSW, data & 0xffff); -} - -INLINE unsigned get_win_fdr_prevsibFDR_aphysrec(struct ti99_lvl2_imgref *l2_img, win_fdr *fdr) -{ - unsigned prevsibFDR_AU = get_UINT16BE(fdr->prevsibFDR_AU); - - return prevsibFDR_AU - ? (prevsibFDR_AU * l2_img->AUformat.physrecsperAU + ((fdr->xinfo_LSB >> 4) & 0xf)) - : 0; -} - -INLINE unsigned get_win_fdr_nextsibFDR_aphysrec(struct ti99_lvl2_imgref *l2_img, win_fdr *fdr) -{ - unsigned nextsibFDR_AU = get_UINT16BE(fdr->nextsibFDR_AU); - - return nextsibFDR_AU - ? (nextsibFDR_AU * l2_img->AUformat.physrecsperAU + (fdr->xinfo_LSB & 0xf)) - : 0; -} - -INLINE unsigned get_win_fdr_cursibFDR_basefphysrec(win_fdr *fdr) -{ - return get_UINT16BE(fdr->prevsibFDR_AU) ? get_win_fdr_fphysrecs(fdr) : 0; -} - -/* - Advance to next sibling FDR -*/ -static int win_goto_next_sibFDR(ti99_lvl2_fileref_win *win_file) -{ - if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU) == 0) - return IMGTOOLERR_UNEXPECTED; - - win_file->curfdr_aphysrec = get_win_fdr_nextsibFDR_aphysrec(win_file->l2_img, &win_file->curfdr); - if (read_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr)) - return IMGTOOLERR_READERROR; - - return 0; -} - -/* - Back to previous sibling FDR -*/ -static int win_goto_prev_sibFDR(ti99_lvl2_fileref_win *win_file) -{ - if (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) == 0) - return IMGTOOLERR_UNEXPECTED; - - win_file->curfdr_aphysrec = get_win_fdr_prevsibFDR_aphysrec(win_file->l2_img, &win_file->curfdr); - if (read_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr)) - return IMGTOOLERR_READERROR; - - return 0; -} - -/* - Append a new sibling FDR at the end of the sibling FDR list, and open it. - - You must have gone to the end of the list. -*/ -static int win_alloc_sibFDR(ti99_lvl2_fileref_win *win_file) -{ - unsigned oldfdr_AU, oldfdr_physrecinAU; - unsigned newfdr_AU, newfdr_physrecinAU; - int allocated = FALSE; - int errorcode; - unsigned cursibFDR_basefphysrec; - - if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU)) - return IMGTOOLERR_UNEXPECTED; - - oldfdr_AU = win_file->curfdr_aphysrec / win_file->l2_img->AUformat.physrecsperAU; - oldfdr_physrecinAU = win_file->curfdr_aphysrec % win_file->l2_img->AUformat.physrecsperAU; - - if (oldfdr_physrecinAU != (win_file->l2_img->AUformat.physrecsperAU - 1)) - { /* current AU is not full */ - newfdr_AU = oldfdr_AU; - newfdr_physrecinAU = oldfdr_physrecinAU + 1; - } - else - { /* current AU is full: allocate another */ - errorcode = alloc_fdr_AU(win_file->l2_img, &newfdr_AU); - if (errorcode) - return errorcode; - newfdr_physrecinAU = 0; - allocated = TRUE; - } - - set_UINT16BE(&win_file->curfdr.nextsibFDR_AU, newfdr_AU); - win_file->curfdr.xinfo_LSB = (win_file->curfdr.xinfo_LSB & 0xf0) | newfdr_physrecinAU; - - /* save current sibling FDR */ - if (write_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr)) - { - /* clear pointer */ - set_UINT16BE(&win_file->curfdr.nextsibFDR_AU, 0); - win_file->curfdr.xinfo_LSB = win_file->curfdr.xinfo_LSB & 0xf0; - if (allocated) - /* free AU */ - win_file->l2_img->abm[newfdr_AU >> 3] |= 1 << (newfdr_AU & 7); - return IMGTOOLERR_WRITEERROR; - } - - /* now update in-memory structure to describe new sibling FDR */ - cursibFDR_basefphysrec = get_win_fdr_cursibFDR_basefphysrec(&win_file->curfdr) - + get_UINT16BE(win_file->curfdr.sibFDR_AUlen) * win_file->l2_img->AUformat.physrecsperAU; - - set_UINT16BE(&win_file->curfdr.nextsibFDR_AU, 0); - set_UINT16BE(&win_file->curfdr.prevsibFDR_AU, oldfdr_AU); - win_file->curfdr.xinfo_LSB = oldfdr_physrecinAU << 4; - - win_file->curfdr_aphysrec = newfdr_AU * win_file->l2_img->AUformat.physrecsperAU + newfdr_physrecinAU; - - set_win_fdr_fphysrecs(&win_file->curfdr, cursibFDR_basefphysrec); - set_UINT16BE(&win_file->curfdr.sibFDR_AUlen, 0); - memset(win_file->curfdr.clusters, 0, sizeof(win_file->curfdr.clusters)); - - return 0; -} - -/* - Extend a file with nb_alloc_physrecs extra physrecs - - dsk_file: file reference - nb_alloc_physrecs: number of physical records to allocate -*/ -static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc_physrecs) -{ - int totAUs = dsk_file->l2_img->AUformat.totAUs; - int free_physrecs; - int fphysrecs; - int i; - int cluster_index; - int last_sec, p_last_sec = 0; - int cur_block_seclen; - int cluster_baseAU, cluster_AUlen; - int first_best_block_baseAU = 0, first_best_block_seclen; - int second_best_block_baseAU = 0, second_best_block_seclen; - int search_start; - - /* compute free space */ - free_physrecs = 0; - for (i=0; il2_img->abm[i >> 3] & (1 << (i & 7)))) - free_physrecs += dsk_file->l2_img->AUformat.physrecsperAU; - } - - /* check we have enough free space */ - if (free_physrecs < nb_alloc_physrecs) - return IMGTOOLERR_NOSPACE; - - /* current number of data physrecs in file */ - fphysrecs = get_UINT16BE(dsk_file->fdr.fphysrecs); - - if (fphysrecs == 0) - { /* cluster array must be empty */ - cluster_index = 0; - } - else - { /* try to extend last block */ - last_sec = -1; - for (cluster_index=0; cluster_index<76; cluster_index++) - { - p_last_sec = last_sec; - last_sec = get_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index); - if (last_sec >= (fphysrecs-1)) - break; - } - if (cluster_index == 76) - /* that sucks */ - return IMGTOOLERR_CORRUPTIMAGE; - - if (last_sec > (fphysrecs-1)) - { /* some extra space has already been allocated */ - cur_block_seclen = last_sec - (fphysrecs-1); - if (cur_block_seclen > nb_alloc_physrecs) - cur_block_seclen = nb_alloc_physrecs; - - fphysrecs += cur_block_seclen; - set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); - nb_alloc_physrecs -= cur_block_seclen; - if (! nb_alloc_physrecs) - return 0; /* done */ - } - - /* round up to next AU boundary */ - last_sec = last_sec + dsk_file->l2_img->AUformat.physrecsperAU - (last_sec % dsk_file->l2_img->AUformat.physrecsperAU) - 1; - - if (last_sec > (fphysrecs-1)) - { /* some extra space has already been allocated */ - cur_block_seclen = last_sec - (fphysrecs-1); - if (cur_block_seclen > nb_alloc_physrecs) - cur_block_seclen = nb_alloc_physrecs; - - fphysrecs += cur_block_seclen; - set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); - set_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index, fphysrecs-1); - nb_alloc_physrecs -= cur_block_seclen; - if (! nb_alloc_physrecs) - return 0; /* done */ - } - - /* read base AU address for this cluster */ - cluster_baseAU = get_dsk_fdr_cluster_baseAU(dsk_file->l2_img, &dsk_file->fdr, cluster_index); - /* point past cluster end */ - cluster_baseAU += (last_sec-p_last_sec/*+file->l2_img->AUformat.physrecsperAU-1*/) / dsk_file->l2_img->AUformat.physrecsperAU; - /* count free physrecs after last block */ - cur_block_seclen = 0; - for (i=cluster_baseAU; (! (dsk_file->l2_img->abm[i >> 3] & (1 << (i & 7)))) && (cur_block_seclen < nb_alloc_physrecs) && (i < totAUs); i++) - cur_block_seclen += dsk_file->l2_img->AUformat.physrecsperAU; - if (cur_block_seclen) - { /* extend last block */ - if (cur_block_seclen > nb_alloc_physrecs) - cur_block_seclen = nb_alloc_physrecs; - - fphysrecs += cur_block_seclen; - set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); - last_sec += cur_block_seclen; - nb_alloc_physrecs -= cur_block_seclen; - set_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index, last_sec); - cluster_AUlen = (cur_block_seclen + dsk_file->l2_img->AUformat.physrecsperAU - 1) / dsk_file->l2_img->AUformat.physrecsperAU; - for (i=0; il2_img->abm[(i+cluster_baseAU) >> 3] |= 1 << ((i+cluster_baseAU) & 7); - if (! nb_alloc_physrecs) - return 0; /* done */ - } - cluster_index++; - if (cluster_index == 76) - /* that sucks */ - return IMGTOOLERR_NOSPACE; - } - - search_start = dsk_file->l2_img->data_offset; /* initially, search for free space only in data space */ - while (nb_alloc_physrecs) - { - /* find smallest data block at least nb_alloc_physrecs in length, and largest data block less than nb_alloc_physrecs in length */ - first_best_block_seclen = INT_MAX; - second_best_block_seclen = 0; - for (i=search_start; il2_img->abm[i >> 3] & (1 << (i & 7)))) - { /* found one free block */ - /* compute its length */ - cluster_baseAU = i; - cur_block_seclen = 0; - while ((il2_img->abm[i >> 3] & (1 << (i & 7))))) - { - cur_block_seclen += dsk_file->l2_img->AUformat.physrecsperAU; - i++; - } - /* compare to previous best and second-best blocks */ - if ((cur_block_seclen < first_best_block_seclen) && (cur_block_seclen >= nb_alloc_physrecs)) - { - first_best_block_baseAU = cluster_baseAU; - first_best_block_seclen = cur_block_seclen; - if (cur_block_seclen == nb_alloc_physrecs) - /* no need to search further */ - break; - } - else if ((cur_block_seclen > second_best_block_seclen) && (cur_block_seclen < nb_alloc_physrecs)) - { - second_best_block_baseAU = cluster_baseAU; - second_best_block_seclen = cur_block_seclen; - } - } - } - - if (first_best_block_seclen != INT_MAX) - { /* found one contiguous block which can hold it all */ - fphysrecs += nb_alloc_physrecs; - set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); - - set_dsk_fdr_cluster(dsk_file->l2_img, &dsk_file->fdr, cluster_index, first_best_block_baseAU, fphysrecs-1); - cluster_AUlen = (nb_alloc_physrecs + dsk_file->l2_img->AUformat.physrecsperAU - 1) / dsk_file->l2_img->AUformat.physrecsperAU; - for (i=0; il2_img->abm[(i+first_best_block_baseAU) >> 3] |= 1 << ((i+first_best_block_baseAU) & 7); - - nb_alloc_physrecs = 0; - } - else if (second_best_block_seclen != 0) - { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */ - fphysrecs += second_best_block_seclen; - set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs); - - set_dsk_fdr_cluster(dsk_file->l2_img, &dsk_file->fdr, cluster_index, second_best_block_baseAU, fphysrecs-1); - cluster_AUlen = (second_best_block_seclen + dsk_file->l2_img->AUformat.physrecsperAU - 1) / dsk_file->l2_img->AUformat.physrecsperAU; - for (i=0; il2_img->abm[(i+second_best_block_baseAU) >> 3] |= 1 << ((i+second_best_block_baseAU) & 7); - - nb_alloc_physrecs -= second_best_block_seclen; - - cluster_index++; - if (cluster_index == 76) - /* that sucks */ - return IMGTOOLERR_NOSPACE; - } - else if (search_start != 0) - { /* we did not find any free physrec in the data section of the disk */ - search_start = 0; /* time to fall back to fdr space */ - } - else - return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */ - } - - return 0; -} - -/* - Extend a file with nb_alloc_physrecs extra physrecs - - win_file: file reference - nb_alloc_physrecs: number of physical records to allocate -*/ -static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc_physrecs) -{ - int totAUs = win_file->l2_img->AUformat.totAUs; - int free_physrecs; - int fphysrecs; - int i; - int cluster_index; - int num_fphysrec; - int cur_block_seclen; - int cluster_baseAU, cluster_AUlen; - int first_best_block_baseAU = 0, first_best_block_seclen; - int second_best_block_baseAU = 0, second_best_block_seclen; - int search_start; - int errorcode; - - /* compute free space */ - free_physrecs = 0; - for (i=0; il2_img->abm[i >> 3] & (1 << (i & 7)))) - free_physrecs += win_file->l2_img->AUformat.physrecsperAU; - } - - /* check we have enough free space */ - if (free_physrecs < nb_alloc_physrecs) - return IMGTOOLERR_NOSPACE; - - /* move to last sibling non-empty FDR */ - while ((get_UINT16BE(win_file->curfdr.nextsibFDR_AU) != 0) && - (get_UINT16BE(win_file->curfdr.clusters[53][0]) != 0)) - { - errorcode = win_goto_next_sibFDR(win_file); - if (errorcode) - return errorcode; - } - if ((get_UINT16BE(win_file->curfdr.clusters[0][0]) == 0) && (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) != 0)) - { /* this is annoying: we have found a sibling FDR filled with 0s: rewind - to last non-empty sibling if applicable */ - errorcode = win_goto_prev_sibFDR(win_file); - if (errorcode) - return errorcode; - } - - /* current number of data physrecs in file */ - fphysrecs = win_file->fphysrecs; - - /* current number of allocated physrecs */ - num_fphysrec = get_win_fdr_cursibFDR_basefphysrec(&win_file->curfdr) - + get_UINT16BE(win_file->curfdr.sibFDR_AUlen) * win_file->l2_img->AUformat.physrecsperAU; - - if (num_fphysrec > fphysrecs) - { /* some extra space has already been allocated */ - cur_block_seclen = num_fphysrec - fphysrecs; - if (cur_block_seclen > nb_alloc_physrecs) - cur_block_seclen = nb_alloc_physrecs; - - fphysrecs += cur_block_seclen; - win_file->fphysrecs = fphysrecs; - /* TODO: update eldest FDR fphysrecs field */ - /*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/ - nb_alloc_physrecs -= cur_block_seclen; - if (! nb_alloc_physrecs) - return 0; /* done */ - } - - /* find last non-empty cluster */ - for (cluster_index=0; (cluster_index<54) && (get_UINT16BE(win_file->curfdr.clusters[cluster_index][0]) != 0); cluster_index++) - ; - /* if we are dealing with an empty file, we will have (cluster_index == 0)... */ - if (cluster_index != 0) - { - cluster_index--; - /* try to extend last cluster */ - /* point past cluster end */ - cluster_baseAU = get_UINT16BE(win_file->curfdr.clusters[cluster_index][1]) + 1; - /* count free physrecs after last block */ - cur_block_seclen = 0; - for (i=cluster_baseAU; (! (win_file->l2_img->abm[i >> 3] & (1 << (i & 7)))) && (cur_block_seclen < nb_alloc_physrecs) && (i < totAUs); i++) - cur_block_seclen += win_file->l2_img->AUformat.physrecsperAU; - if (cur_block_seclen) - { /* extend last block */ - if (cur_block_seclen > nb_alloc_physrecs) - cur_block_seclen = nb_alloc_physrecs; - - fphysrecs += cur_block_seclen; - cluster_AUlen = (cur_block_seclen + win_file->l2_img->AUformat.physrecsperAU - 1) / win_file->l2_img->AUformat.physrecsperAU; - win_file->fphysrecs = fphysrecs; - /* TODO: update eldest FDR fphysrecs field */ - /*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/ - set_UINT16BE(&win_file->curfdr.sibFDR_AUlen, - get_UINT16BE(win_file->curfdr.sibFDR_AUlen)+cluster_AUlen); - set_UINT16BE(&win_file->curfdr.clusters[cluster_index][1], - get_UINT16BE(win_file->curfdr.clusters[cluster_index][1])+cluster_AUlen); - for (i=0; il2_img->abm[(i+cluster_baseAU) >> 3] |= 1 << ((i+cluster_baseAU) & 7); - nb_alloc_physrecs -= cur_block_seclen; - if (! nb_alloc_physrecs) - return 0; /* done */ - } - /* now point to first free entry in cluster table */ - cluster_index++; - } - - search_start = win_file->l2_img->data_offset; /* initially, search for free space only in data space */ - while (nb_alloc_physrecs) - { - /* find smallest data block at least nb_alloc_physrecs in length, and largest data block less than nb_alloc_physrecs in length */ - first_best_block_seclen = INT_MAX; - second_best_block_seclen = 0; - for (i=search_start; il2_img->abm[i >> 3] & (1 << (i & 7)))) - { /* found one free block */ - /* compute its length */ - cluster_baseAU = i; - cur_block_seclen = 0; - while ((il2_img->abm[i >> 3] & (1 << (i & 7))))) - { - cur_block_seclen += win_file->l2_img->AUformat.physrecsperAU; - i++; - } - /* compare to previous best and second-best blocks */ - if ((cur_block_seclen < first_best_block_seclen) && (cur_block_seclen >= nb_alloc_physrecs)) - { - first_best_block_baseAU = cluster_baseAU; - first_best_block_seclen = cur_block_seclen; - if (cur_block_seclen == nb_alloc_physrecs) - /* no need to search further */ - break; - } - else if ((cur_block_seclen > second_best_block_seclen) && (cur_block_seclen < nb_alloc_physrecs)) - { - second_best_block_baseAU = cluster_baseAU; - second_best_block_seclen = cur_block_seclen; - } - } - } - - if ((first_best_block_seclen != INT_MAX) || (second_best_block_seclen != 0)) - { - if (cluster_index == 54) - { - /* end of cluster list: go to next sibling FDR */ - if (write_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr)) - return IMGTOOLERR_WRITEERROR; - if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU) != 0) - { /* read next sibling FDR */ - errorcode = win_goto_next_sibFDR(win_file); - if (errorcode) - return errorcode; - } - else - { /* allocate new sibling FDR */ - errorcode = win_alloc_sibFDR(win_file); - if (errorcode) - return errorcode; - } - cluster_index = 0; - } - } - - if (first_best_block_seclen != INT_MAX) - { /* found one contiguous block which can hold it all */ - fphysrecs += nb_alloc_physrecs; - cluster_AUlen = (nb_alloc_physrecs + win_file->l2_img->AUformat.physrecsperAU - 1) / win_file->l2_img->AUformat.physrecsperAU; - win_file->fphysrecs = fphysrecs; - /* TODO: update eldest FDR fphysrecs field */ - /*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/ - set_UINT16BE(&win_file->curfdr.sibFDR_AUlen, - get_UINT16BE(win_file->curfdr.sibFDR_AUlen)+cluster_AUlen); - set_UINT16BE(&win_file->curfdr.clusters[cluster_index][0], first_best_block_baseAU); - set_UINT16BE(&win_file->curfdr.clusters[cluster_index][1], - first_best_block_baseAU+cluster_AUlen-1); - - for (i=0; il2_img->abm[(i+first_best_block_baseAU) >> 3] |= 1 << ((i+first_best_block_baseAU) & 7); - - nb_alloc_physrecs = 0; - } - else if (second_best_block_seclen != 0) - { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */ - fphysrecs += second_best_block_seclen; - cluster_AUlen = (second_best_block_seclen + win_file->l2_img->AUformat.physrecsperAU - 1) / win_file->l2_img->AUformat.physrecsperAU; - win_file->fphysrecs = fphysrecs; - /* TODO: update eldest FDR fphysrecs field */ - /*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/ - set_UINT16BE(&win_file->curfdr.sibFDR_AUlen, - get_UINT16BE(win_file->curfdr.sibFDR_AUlen)+cluster_AUlen); - set_UINT16BE(&win_file->curfdr.clusters[cluster_index][0], second_best_block_baseAU); - set_UINT16BE(&win_file->curfdr.clusters[cluster_index][1], - second_best_block_baseAU+cluster_AUlen-1); - - for (i=0; il2_img->abm[(i+second_best_block_baseAU) >> 3] |= 1 << ((i+second_best_block_baseAU) & 7); - - nb_alloc_physrecs -= second_best_block_seclen; - - /* now point to first free entry in cluster table */ - cluster_index++; - } - else if (search_start != 0) - { /* we did not find any free physrec in the data section of the disk */ - search_start = 0; /* time to fall back to fdr space */ - } - else - return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */ - } - - return 0; -} - -/* - Allocate a new (empty) file -*/ -static int new_file_lvl2_dsk(struct ti99_lvl2_imgref *l2_img, int parent_ref, char filename[10], struct ti99_lvl2_fileref *l2_file) -{ - ti99_catalog *catalog = &l2_img->dsk.catalogs[parent_ref]; - unsigned fdr_AU, fdr_aphysrec; - int catalog_index, i; - int reply = 0; - int errorcode; - - - if (catalog->num_files >= 127) - /* if num_files == 128, catalog is full */ - /* if num_files == 127, catalog is not full, but we don't want to write - a 128th entry for compatibility with some existing DSRs that detect the - end of the FDIR array with a 0 entry (and do not check that the index - has not reached 128) */ - return IMGTOOLERR_NOSPACE; - - /* find insertion point in catalog */ - for (i=0; (i < catalog->num_files) && ((reply = memcmp(catalog->files[i].name, filename, 10)) < 0); i++) - ; - - if ((inum_files) && (reply == 0)) - /* file already exists */ - return IMGTOOLERR_BADFILENAME; - else - { - /* otherwise insert new entry */ - catalog_index = i; - errorcode = alloc_fdr_AU(l2_img, &fdr_AU); - if (errorcode) - return errorcode; - fdr_aphysrec = fdr_AU * l2_img->AUformat.physrecsperAU; - - /* shift catalog entries until the insertion point */ - for (i=catalog->num_files; i>catalog_index; i--) - catalog->files[i] = catalog->files[i-1]; - - /* write new catalog entry */ - catalog->files[catalog_index].fdr_ptr = fdr_aphysrec; - memcpy(catalog->files[catalog_index].name, filename, 10); - - /* update catalog len */ - catalog->num_files++; - } - - /* set up file handle */ - l2_file->type = L2F_DSK; - l2_file->dsk.l2_img = l2_img; - l2_file->dsk.fdr_aphysrec = fdr_aphysrec; - memset(&l2_file->dsk.fdr, 0, sizeof(l2_file->dsk.fdr)); - memcpy(l2_file->dsk.fdr.name, filename, 10); - - return 0; -} - -/* - Allocate a new (empty) file -*/ -static int new_file_lvl2_win(struct ti99_lvl2_imgref *l2_img, ti99_catalog *parent_catalog, char filename[10], struct ti99_lvl2_fileref *l2_file) -{ - unsigned fdr_AU; - int catalog_index, i; - int reply = 0; - int errorcode; - - - if (parent_catalog->num_files >= 127) - /* if num_files == 127, catalog is full */ - return IMGTOOLERR_NOSPACE; - - /* find insertion point in catalog */ - for (i=0; (i < parent_catalog->num_files) && ((reply = memcmp(parent_catalog->files[i].name, filename, 10)) < 0); i++) - ; - - if ((inum_files) && (reply == 0)) - /* file already exists */ - return IMGTOOLERR_BADFILENAME; - else - { - /* otherwise insert new entry */ - catalog_index = i; - errorcode = alloc_fdr_AU(l2_img, &fdr_AU); - if (errorcode) - return errorcode; - - /* shift catalog entries until the insertion point */ - for (i=parent_catalog->num_files; i>catalog_index; i--) - parent_catalog->files[i] = parent_catalog->files[i-1]; - - /* write new catalog entry */ - parent_catalog->files[catalog_index].fdr_ptr = fdr_AU; - memcpy(parent_catalog->files[catalog_index].name, filename, 10); - - /* update catalog len */ - parent_catalog->num_files++; - } - - /* set up file handle */ - l2_file->type = L2F_WIN; - l2_file->win.l2_img = l2_img; - l2_file->win.fphysrecs = 0; - l2_file->win.eldestfdr_aphysrec = fdr_AU * l2_img->AUformat.physrecsperAU; - l2_file->win.curfdr_aphysrec = l2_file->win.eldestfdr_aphysrec; - memset(&l2_file->win.curfdr, 0, sizeof(l2_file->win.curfdr)); - memcpy(l2_file->win.curfdr.name, filename, 10); - - return 0; -} - -/* - Allocate a new (empty) file -*/ -static int new_file_lvl2_tifiles(imgtool_stream *file_handle, struct ti99_lvl2_fileref *l2_file) -{ - /* set up file handle */ - l2_file->type = L2F_TIFILES; - l2_file->tifiles.file_handle = file_handle; - memset(&l2_file->tifiles.hdr, 0, sizeof(l2_file->tifiles.hdr)); - l2_file->tifiles.hdr.tifiles[0] = '\7'; - l2_file->tifiles.hdr.tifiles[1] = 'T'; - l2_file->tifiles.hdr.tifiles[2] = 'I'; - l2_file->tifiles.hdr.tifiles[3] = 'F'; - l2_file->tifiles.hdr.tifiles[4] = 'I'; - l2_file->tifiles.hdr.tifiles[5] = 'L'; - l2_file->tifiles.hdr.tifiles[6] = 'E'; - l2_file->tifiles.hdr.tifiles[7] = 'S'; - - return 0; -} - -/* - Open an existing file on a floppy image - - l2_img: level 2 image the file is located on - fpath: access path to the file - file: set up if open is successful -*/ -static int open_file_lvl2_dsk(struct ti99_lvl2_imgref *l2_img, const char *fpath, struct ti99_lvl2_fileref *l2_file) -{ - int parent_ref, is_dir, catalog_index; - int reply; - - - reply = dsk_find_catalog_entry(l2_img, fpath, NULL, &parent_ref, &is_dir, &catalog_index); - if (reply) - return reply; - - if (is_dir) - /* this is not a file */ - return IMGTOOLERR_BADFILENAME; - - l2_file->type = L2F_DSK; - l2_file->dsk.l2_img = l2_img; - l2_file->dsk.fdr_aphysrec = l2_img->dsk.catalogs[parent_ref].files[catalog_index].fdr_ptr; - if (read_absolute_physrec(& l2_img->l1_img, l2_file->dsk.fdr_aphysrec, &l2_file->dsk.fdr)) - return IMGTOOLERR_READERROR; - - return 0; -} - -/* - Open an existing file on a harddisk image - - l2_img: level 2 image the file is located on - fpath: access path to the file - file: set up if open is successful -*/ -static int open_file_lvl2_win(struct ti99_lvl2_imgref *l2_img, const char *fpath, struct ti99_lvl2_fileref *l2_file) -{ - int parent_ref, is_dir, catalog_index; - ti99_catalog catalog; - int reply; - - reply = win_find_catalog_entry(l2_img, fpath, NULL, &parent_ref, &catalog, &is_dir, &catalog_index); - if (reply) - return reply; - - if (is_dir) - /* this is not a file */ - return IMGTOOLERR_BADFILENAME; - - l2_file->type = L2F_WIN; - l2_file->win.l2_img = l2_img; - l2_file->win.eldestfdr_aphysrec = catalog.files[catalog_index].fdr_ptr * l2_img->AUformat.physrecsperAU; - l2_file->win.curfdr_aphysrec = l2_file->win.eldestfdr_aphysrec; - if (read_absolute_physrec(& l2_img->l1_img, l2_file->win.curfdr_aphysrec, &l2_file->win.curfdr)) - return IMGTOOLERR_READERROR; - l2_file->win.fphysrecs = get_win_fdr_fphysrecs(&l2_file->win.curfdr); - - /* check integrity of FDR sibling chain */ - /* note that as we check that the back chain is consistent with the forward - chain, we will also detect any cycle in the sibling chain, so we do not - need to check against them explicitely */ - if (get_UINT16BE(l2_file->win.curfdr.prevsibFDR_AU) != 0) - return IMGTOOLERR_CORRUPTIMAGE; - - { - int i, pastendoflist_flag; - unsigned cur_fphysrec, sibFDR_AUlen; - win_fdr *cur_fdr, fdr_buf; - unsigned curfdr_aphysrec, prevfdr_aphysrec; - - cur_fphysrec = 0; - pastendoflist_flag = 0; - cur_fdr = &l2_file->win.curfdr; - curfdr_aphysrec = l2_file->win.eldestfdr_aphysrec; - - while (1) - { - sibFDR_AUlen = 0; - i=0; - if (! pastendoflist_flag) - { - /* compute number of allocated AUs and check number of AUs */ - for (; i<54; i++) - { - if (get_UINT16BE(cur_fdr->clusters[i][0]) == 0) - { - pastendoflist_flag = TRUE; - break; - } - sibFDR_AUlen += get_UINT16BE(cur_fdr->clusters[i][1]) - - get_UINT16BE(cur_fdr->clusters[i][0]) - + 1; - } - } - /* clear remainder of cluster table */ - for (; i<54; i++) - { -#if 0 - set_UINT16BE(&cur_fdr->clusters[i][0], 0); - set_UINT16BE(&cur_fdr->clusters[i][1], 0); -#endif - if ((get_UINT16BE(cur_fdr->clusters[i][0]) != 0) || (get_UINT16BE(cur_fdr->clusters[i][1]) != 0)) - return IMGTOOLERR_CORRUPTIMAGE; - } - - /* check sibFDR_AUlen field */ - if (get_UINT16BE(cur_fdr->sibFDR_AUlen) != sibFDR_AUlen) - return IMGTOOLERR_CORRUPTIMAGE; - - /* update current file physrec position to point to end of sibling FDR */ - cur_fphysrec += sibFDR_AUlen * l2_file->win.l2_img->AUformat.physrecsperAU; - - /* exit loop if end of sibling chain */ - if (! get_UINT16BE(cur_fdr->nextsibFDR_AU)) - break; - - /* otherwise read next FDR */ - if (get_UINT16BE(cur_fdr->nextsibFDR_AU) >= l2_file->win.l2_img->AUformat.totAUs) - return IMGTOOLERR_CORRUPTIMAGE; - - prevfdr_aphysrec = curfdr_aphysrec; - curfdr_aphysrec = get_win_fdr_nextsibFDR_aphysrec(l2_file->win.l2_img, cur_fdr); - if (read_absolute_physrec(& l2_file->win.l2_img->l1_img, curfdr_aphysrec, &fdr_buf)) - return IMGTOOLERR_READERROR; - cur_fdr = &fdr_buf; - - /* check that back chaining is consistent with forward chaining */ - if (get_win_fdr_prevsibFDR_aphysrec(l2_file->win.l2_img, &fdr_buf) != prevfdr_aphysrec) - return IMGTOOLERR_CORRUPTIMAGE; - /* check fphysrecs field */ - if (get_win_fdr_fphysrecs(&fdr_buf) != cur_fphysrec) - return IMGTOOLERR_CORRUPTIMAGE; - - /* check consistency of informative fields (name, record format, flags, etc) */ - if (memcmp(fdr_buf.name, l2_file->win.curfdr.name, 10) - || (get_UINT16BE(fdr_buf.xreclen) != get_UINT16BE(l2_file->win.curfdr.xreclen)) - || (fdr_buf.flags != l2_file->win.curfdr.flags) - || (fdr_buf.recsperphysrec != l2_file->win.curfdr.recsperphysrec) - || (fdr_buf.eof != l2_file->win.curfdr.eof) - || (fdr_buf.reclen != l2_file->win.curfdr.reclen) - || (get_UINT16LE(fdr_buf.fixrecs_LSW) != get_UINT16LE(l2_file->win.curfdr.fixrecs_LSW)) - || memcmp(&fdr_buf.creation, &l2_file->win.curfdr.creation, 4) - || memcmp(&fdr_buf.update, &l2_file->win.curfdr.update, 4) - /*|| memcmp(fdr_buf.id, l2_file->win.curfdr.id, 2)*/ - || (get_UINT16BE(fdr_buf.parent_FDIR_AU) != get_UINT16BE(l2_file->win.curfdr.parent_FDIR_AU)) - || ((fdr_buf.xinfo_MSB & 0xf) != (l2_file->win.curfdr.xinfo_MSB & 0xf))) - return IMGTOOLERR_CORRUPTIMAGE; - } - if (cur_fphysrec < l2_file->win.fphysrecs) - return IMGTOOLERR_CORRUPTIMAGE; - } - - return 0; -} - -/* - Open an existing file in TIFILES format -*/ -static int open_file_lvl2_tifiles(imgtool_stream *file_handle, struct ti99_lvl2_fileref *l2_file) -{ - /* set up file handle */ - l2_file->type = L2F_TIFILES; - l2_file->tifiles.file_handle = file_handle; - - /* seek to header */ - if (stream_seek(l2_file->tifiles.file_handle, 0, SEEK_SET)) - return IMGTOOLERR_READERROR; - /* read it */ - if (stream_read(l2_file->tifiles.file_handle, &l2_file->tifiles.hdr, sizeof(l2_file->tifiles.hdr)) != sizeof(l2_file->tifiles.hdr)) - return IMGTOOLERR_READERROR; - - return 0; -} - -/* - compute the aphysrec address for a given file physical record (fphysrec) - - l2_img: image where the file is located -*/ -static int dsk_fphysrec_to_aphysrec(ti99_lvl2_fileref_dsk *dsk_file, unsigned fphysrec, unsigned *aphysrec) -{ - int cluster_index; - int cluster_firstfphysrec, cluster_lastfphysrec; - int cluster_baseaphysrec; - - - /* check parameter */ - if (fphysrec >= get_UINT16BE(dsk_file->fdr.fphysrecs)) - return IMGTOOLERR_UNEXPECTED; - - - /* search for the cluster in the data chain pointers array */ - cluster_firstfphysrec = 0; - for (cluster_index=0; cluster_index<76; cluster_index++) - { - /* read curent file block table entry */ - cluster_lastfphysrec = get_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index); - if (cluster_lastfphysrec >= fphysrec) - break; - cluster_firstfphysrec = cluster_lastfphysrec+1; - } - if (cluster_index == 76) - /* if not found, the file is corrupt */ - return IMGTOOLERR_CORRUPTIMAGE; - - /* read base aphysrec address for this cluster */ - cluster_baseaphysrec = get_dsk_fdr_cluster_baseaphysrec(dsk_file->l2_img, &dsk_file->fdr, cluster_index); - /* return absolute physrec address */ - *aphysrec = cluster_baseaphysrec + (fphysrec - cluster_firstfphysrec); - return 0; -} - -/* - compute the aphysrec address for a given file physical record (fphysrec) - - l2_img: image where the file is located -*/ -static int win_fphysrec_to_aphysrec(ti99_lvl2_fileref_win *win_file, unsigned fphysrec, unsigned *aphysrec) -{ - int cluster_index; - int cluster_firstfphysrec, cluster_lastfphysrec; - int cluster_baseaphysrec; - int errorcode; - - - /* check parameter */ - if (fphysrec >= win_file->fphysrecs) - return IMGTOOLERR_UNEXPECTED; - - /* look for correct sibling */ - if (fphysrec < get_win_fdr_cursibFDR_basefphysrec(& win_file->curfdr)) - { - while (fphysrec < get_win_fdr_cursibFDR_basefphysrec(& win_file->curfdr)) - { - if (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) == 0) - return IMGTOOLERR_CORRUPTIMAGE; - errorcode = win_goto_prev_sibFDR(win_file); - if (errorcode) - return errorcode; - } - } - else /*if (fphysrec >= get_win_fdr_cursibFDR_basefphysrec(& dsk_file->curfdr))*/ - { - while (fphysrec >= (get_win_fdr_cursibFDR_basefphysrec(& win_file->curfdr) - + get_UINT16BE(win_file->curfdr.sibFDR_AUlen) * win_file->l2_img->AUformat.physrecsperAU)) - { - if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU) == 0) - return IMGTOOLERR_CORRUPTIMAGE; - errorcode = win_goto_next_sibFDR(win_file); - if (errorcode) - return errorcode; - } - } - - - /* search for the cluster in the data chain pointers array */ - cluster_firstfphysrec = get_win_fdr_cursibFDR_basefphysrec(& win_file->curfdr); - for (cluster_index = 0; cluster_index<54; cluster_index++) - { - cluster_lastfphysrec = cluster_firstfphysrec - + (get_UINT16BE(win_file->curfdr.clusters[cluster_index][1]) - - get_UINT16BE(win_file->curfdr.clusters[cluster_index][0]) - + 1) - * win_file->l2_img->AUformat.physrecsperAU; - if (fphysrec < cluster_lastfphysrec) - break; - - cluster_firstfphysrec = cluster_lastfphysrec; - } - - if (cluster_index == 54) - return IMGTOOLERR_CORRUPTIMAGE; - - - /* read base aphysrec address for this cluster */ - cluster_baseaphysrec = get_UINT16BE(win_file->curfdr.clusters[cluster_index][0]) * win_file->l2_img->AUformat.physrecsperAU; - /* return absolute physrec address */ - *aphysrec = cluster_baseaphysrec + (fphysrec - cluster_firstfphysrec); - return 0; -} - -/* - read a 256-byte physical record from a file -*/ -static int read_file_physrec(struct ti99_lvl2_fileref *l2_file, unsigned fphysrec, void *dest) -{ - int errorcode; - unsigned aphysrec; - - switch (l2_file->type) - { - case L2F_DSK: - /* compute absolute physrec address */ - errorcode = dsk_fphysrec_to_aphysrec(&l2_file->dsk, fphysrec, &aphysrec); - if (errorcode) - return errorcode; - /* read physrec */ - if (read_absolute_physrec(& l2_file->dsk.l2_img->l1_img, aphysrec, dest)) - return IMGTOOLERR_READERROR; - break; - - case L2F_WIN: - /* compute absolute physrec address */ - errorcode = win_fphysrec_to_aphysrec(&l2_file->win, fphysrec, &aphysrec); - if (errorcode) - return errorcode; - /* read physrec */ - if (read_absolute_physrec(& l2_file->win.l2_img->l1_img, aphysrec, dest)) - return IMGTOOLERR_READERROR; - break; - - case L2F_TIFILES: - /* seek to physrec */ - if (stream_seek(l2_file->tifiles.file_handle, 128+256*fphysrec, SEEK_SET)) - return IMGTOOLERR_READERROR; - /* read it */ - if (stream_read(l2_file->tifiles.file_handle, dest, 256) != 256) - return IMGTOOLERR_READERROR; - break; - } - - return 0; -} - -/* - read a 256-byte physical record from a file -*/ -static int write_file_physrec(struct ti99_lvl2_fileref *l2_file, unsigned fphysrec, const void *src) -{ - int errorcode; - unsigned aphysrec; - - switch (l2_file->type) - { - case L2F_DSK: - /* compute absolute physrec address */ - errorcode = dsk_fphysrec_to_aphysrec(&l2_file->dsk, fphysrec, &aphysrec); - if (errorcode) - return errorcode; - /* write physrec */ - if (write_absolute_physrec(& l2_file->dsk.l2_img->l1_img, aphysrec, src)) - return IMGTOOLERR_WRITEERROR; - break; - - case L2F_WIN: - /* compute absolute physrec address */ - errorcode = win_fphysrec_to_aphysrec(&l2_file->win, fphysrec, &aphysrec); - if (errorcode) - return errorcode; - /* write physrec */ - if (write_absolute_physrec(& l2_file->win.l2_img->l1_img, aphysrec, src)) - return IMGTOOLERR_WRITEERROR; - break; - - case L2F_TIFILES: - /* seek to physrec */ - if (stream_seek(l2_file->tifiles.file_handle, 128+256*fphysrec, SEEK_SET)) - return IMGTOOLERR_WRITEERROR; - /* write it */ - if (stream_write(l2_file->tifiles.file_handle, src, 256) != 256) - return IMGTOOLERR_WRITEERROR; - break; - } - - return 0; -} - -/* - Write a field in every fdr record associated to a file -*/ -#ifdef UNUSED_FUNCTION -static int set_win_fdr_field(struct ti99_lvl2_fileref *l2_file, size_t offset, size_t size, void *data) -{ - win_fdr fdr_buf; - unsigned fdr_aphysrec; - int errorcode = 0; - - for (fdr_aphysrec = l2_file->win.eldestfdr_aphysrec; - fdr_aphysrec && ((errorcode = (read_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf) ? IMGTOOLERR_READERROR : 0)) == 0); - fdr_aphysrec = get_win_fdr_nextsibFDR_physrec(l2_file->win.l2_img, &fdr_buf)) - { - memcpy(((UINT8 *) &fdr_buf) + offset, data, size); - if (write_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf)) - { - errorcode = IMGTOOLERR_WRITEERROR; - break; - } - } - - return errorcode; -} -#endif - -static UINT8 get_file_flags(struct ti99_lvl2_fileref *l2_file) -{ - int reply = 0; - - switch (l2_file->type) - { - case L2F_DSK: - reply = l2_file->dsk.fdr.flags; - break; - - case L2F_WIN: - reply = l2_file->win.curfdr.flags; - break; - - case L2F_TIFILES: - reply = l2_file->tifiles.hdr.flags; - break; - } - - return reply; -} - -static void set_file_flags(struct ti99_lvl2_fileref *l2_file, UINT8 data) -{ - switch (l2_file->type) - { - case L2F_DSK: - l2_file->dsk.fdr.flags = data; - break; - - case L2F_WIN: - l2_file->win.curfdr.flags = data; - break; - - case L2F_TIFILES: - l2_file->tifiles.hdr.flags = data; - break; - } -} - -static UINT8 get_file_recsperphysrec(struct ti99_lvl2_fileref *l2_file) -{ - int reply = 0; - - switch (l2_file->type) - { - case L2F_DSK: - reply = l2_file->dsk.fdr.recsperphysrec; - break; - - case L2F_WIN: - reply = l2_file->win.curfdr.recsperphysrec; - break; - - case L2F_TIFILES: - reply = l2_file->tifiles.hdr.recsperphysrec; - break; - } - - return reply; -} - -static void set_file_recsperphysrec(struct ti99_lvl2_fileref *l2_file, UINT8 data) -{ - switch (l2_file->type) - { - case L2F_DSK: - l2_file->dsk.fdr.recsperphysrec = data; - break; - - case L2F_WIN: - l2_file->win.curfdr.recsperphysrec = data; - break; - - case L2F_TIFILES: - l2_file->tifiles.hdr.recsperphysrec = data; - break; - } -} - -static unsigned get_file_fphysrecs(struct ti99_lvl2_fileref *l2_file) -{ - int reply = 0; - - switch (l2_file->type) - { - case L2F_DSK: - reply = get_UINT16BE(l2_file->dsk.fdr.fphysrecs); - break; - - case L2F_WIN: - reply = l2_file->win.fphysrecs; - break; - - case L2F_TIFILES: - reply = get_UINT16BE(l2_file->tifiles.hdr.fphysrecs); - break; - } - - return reply; -} - -static int set_file_fphysrecs(struct ti99_lvl2_fileref *l2_file, unsigned data) -{ - switch (l2_file->type) - { - case L2F_DSK: - if (data >= 65536) - return IMGTOOLERR_UNIMPLEMENTED; - set_UINT16BE(&l2_file->dsk.fdr.fphysrecs, data); - break; - - case L2F_WIN: - l2_file->win.fphysrecs = data; - break; - - case L2F_TIFILES: - if (data >= 65536) - return IMGTOOLERR_UNIMPLEMENTED; - set_UINT16BE(&l2_file->tifiles.hdr.fphysrecs, data); - break; - } - - return 0; -} - -static UINT8 get_file_eof(struct ti99_lvl2_fileref *l2_file) -{ - int reply = 0; - - switch (l2_file->type) - { - case L2F_DSK: - reply = l2_file->dsk.fdr.eof; - break; - - case L2F_WIN: - reply = l2_file->win.curfdr.eof; - break; - - case L2F_TIFILES: - reply = l2_file->tifiles.hdr.eof; - break; - } - - return reply; -} - -static void set_file_eof(struct ti99_lvl2_fileref *l2_file, UINT8 data) -{ - switch (l2_file->type) - { - case L2F_DSK: - l2_file->dsk.fdr.eof = data; - break; - - case L2F_WIN: - l2_file->win.curfdr.eof = data; - break; - - case L2F_TIFILES: - l2_file->tifiles.hdr.eof = data; - break; - } -} - -static UINT16 get_file_reclen(struct ti99_lvl2_fileref *l2_file) -{ - int reply = 0; - - switch (l2_file->type) - { - case L2F_DSK: - reply = l2_file->dsk.fdr.reclen; - if ((reply == 0) && (! (l2_file->dsk.fdr.flags & (fdr99_f_program /*| fdr99_f_var*/)))) - reply = get_UINT16BE(l2_file->dsk.fdr.xreclen); - break; - - case L2F_WIN: - reply = l2_file->win.curfdr.reclen; - if ((reply == 0) && (! (l2_file->win.curfdr.flags & (fdr99_f_program /*| fdr99_f_var*/)))) - reply = get_UINT16BE(l2_file->win.curfdr.xreclen); - break; - - case L2F_TIFILES: - reply = l2_file->tifiles.hdr.reclen; - break; - } - - return reply; -} - -static int set_file_reclen(struct ti99_lvl2_fileref *l2_file, UINT16 data) -{ - switch (l2_file->type) - { - case L2F_DSK: - if (data < 256) - { - l2_file->dsk.fdr.reclen = data; - set_UINT16BE(&l2_file->dsk.fdr.xreclen, 0); - } - else - { - l2_file->dsk.fdr.reclen = 0; - set_UINT16BE(&l2_file->dsk.fdr.xreclen, data); - } - break; - - case L2F_WIN: - if (data < 256) - { - l2_file->win.curfdr.reclen = data; - set_UINT16BE(&l2_file->win.curfdr.xreclen, 0); - } - else - { - l2_file->win.curfdr.reclen = 0; - set_UINT16BE(&l2_file->win.curfdr.xreclen, data); - } - break; - - case L2F_TIFILES: - if (data >= 256) - return IMGTOOLERR_UNIMPLEMENTED; - l2_file->tifiles.hdr.reclen = data; - break; - } - - return 0; -} - -static unsigned get_file_fixrecs(struct ti99_lvl2_fileref *l2_file) -{ - int reply = 0; - - switch (l2_file->type) - { - case L2F_DSK: - reply = get_UINT16LE(l2_file->dsk.fdr.fixrecs); - break; - - case L2F_WIN: - reply = get_win_fdr_fixrecs(&l2_file->win.curfdr); - break; - - case L2F_TIFILES: - reply = get_UINT16BE(l2_file->tifiles.hdr.fixrecs); - break; - } - - return reply; -} - -static int set_file_fixrecs(struct ti99_lvl2_fileref *l2_file, unsigned data) -{ - switch (l2_file->type) - { - case L2F_DSK: - if (data >= 65536) - return IMGTOOLERR_UNIMPLEMENTED; - set_UINT16LE(&l2_file->dsk.fdr.fixrecs, data); - break; - - case L2F_WIN: - set_win_fdr_fixrecs(&l2_file->win.curfdr, data); - break; - - case L2F_TIFILES: - if (data >= 65536) - return IMGTOOLERR_UNIMPLEMENTED; - set_UINT16BE(&l2_file->tifiles.hdr.fixrecs, data); - break; - } - - return 0; -} - -static void get_file_creation_date(struct ti99_lvl2_fileref *l2_file, ti99_date_time *reply) -{ - switch (l2_file->type) - { - case L2F_DSK: - *reply = l2_file->dsk.fdr.creation; - break; - - case L2F_WIN: - *reply = l2_file->win.curfdr.creation; - break; - - case L2F_TIFILES: - memset(reply, 0, sizeof(*reply)); - break; - } -} - -static void set_file_creation_date(struct ti99_lvl2_fileref *l2_file, ti99_date_time data) -{ - switch (l2_file->type) - { - case L2F_DSK: - l2_file->dsk.fdr.creation = data; - break; - - case L2F_WIN: - l2_file->win.curfdr.creation = data; - break; - - case L2F_TIFILES: - break; - } -} - -static void get_file_update_date(struct ti99_lvl2_fileref *l2_file, ti99_date_time *reply) -{ - switch (l2_file->type) - { - case L2F_DSK: - *reply = l2_file->dsk.fdr.update; - break; - - case L2F_WIN: - *reply = l2_file->win.curfdr.update; - break; - - case L2F_TIFILES: - memset(reply, 0, sizeof(*reply)); - break; - } -} - -static void set_file_update_date(struct ti99_lvl2_fileref *l2_file, ti99_date_time data) -{ - switch (l2_file->type) - { - case L2F_DSK: - l2_file->dsk.fdr.update = data; - break; - - case L2F_WIN: - l2_file->win.curfdr.update = data; - break; - - case L2F_TIFILES: - break; - } -} - -#ifdef UNUSED_FUNCTION -static void current_date_time(ti99_date_time *reply) -{ - /* All these functions should be ANSI */ - time_t cur_time = time(NULL); - struct tm expanded_time = *localtime(& cur_time); - - reply->time_MSB = (expanded_time.tm_hour << 3) | (expanded_time.tm_min >> 3); - reply->time_LSB = (expanded_time.tm_min << 5) | (expanded_time.tm_sec >> 1); - reply->date_MSB = ((expanded_time.tm_year % 100) << 1) | ((expanded_time.tm_mon+1) >> 3); - reply->date_LSB = ((expanded_time.tm_mon+1) << 5) | expanded_time.tm_mday; -} -#endif - -#if 0 -#pragma mark - -#pragma mark LEVEL 3 DISK ROUTINES -#endif - -/* - Level 3 implements files as a succession of logical records. - - There are three types of files: - * program files that are not implemented at level 3 (no logical record) - * files with fixed-size records (random-access files) - * files with variable-size records (sequential-access) -*/ - -struct ti99_lvl3_fileref -{ - ti99_lvl2_fileref l2_file; - - int cur_log_rec; - int cur_phys_rec; - int cur_pos_in_phys_rec; -}; - -#ifdef UNUSED_FUNCTION -/* - Open a file on level 3. - - To open a file on level 3, you must open (or create) the file on level 2, - then pass the file reference to open_file_lvl3. -*/ -static int open_file_lvl3(ti99_lvl3_fileref *l3_file) -{ - l3_file->cur_log_rec = 0; - l3_file->cur_phys_rec = 0; - l3_file->cur_pos_in_phys_rec = 0; - - /*if ()*/ - - return 0; -} - -/* - Test a file for EOF -*/ -static int is_eof(ti99_lvl3_fileref *l3_file) -{ - int flags = get_file_flags(&l3_file->l2_file); - int fphysrecs = get_file_fphysrecs(&l3_file->l2_file); - int fdr_eof = get_file_eof(&l3_file->l2_file); - - if (flags & fdr99_f_var) - { - return (l3_file->cur_phys_rec >= fphysrecs); - } - else - { - return ((l3_file->cur_phys_rec >= fphysrecs) - || ((l3_file->cur_phys_rec == (fphysrecs-1)) - && (l3_file->cur_pos_in_phys_rec >= (fdr_eof ? fdr_eof : 256)))); - } -} - -/* - Read next record from a file -*/ -static int read_next_record(ti99_lvl3_fileref *l3_file, void *dest, int *out_reclen) -{ - int errorcode; - UINT8 physrec_buf[256]; - int reclen; - int flags = get_file_flags(&l3_file->l2_file); - int fphysrecs = get_file_fphysrecs(&l3_file->l2_file); - int fdr_eof = get_file_eof(&l3_file->l2_file); - - if (flags & fdr99_f_program) - { - /* program files have no level-3 record */ - return IMGTOOLERR_UNEXPECTED; - } - else if (flags & fdr99_f_var) - { - /* variable-length records */ - if (is_eof(l3_file)) - return IMGTOOLERR_UNEXPECTED; - errorcode = read_file_physrec(&l3_file->l2_file, l3_file->cur_phys_rec, physrec_buf); - if (errorcode) - return errorcode; - /* read reclen */ - reclen = physrec_buf[l3_file->cur_pos_in_phys_rec]; - /* check integrity */ - if ((reclen == 0xff) || (reclen > get_file_reclen(&l3_file->l2_file)) - || ((l3_file->cur_pos_in_phys_rec + 1 + reclen) > 256)) - return IMGTOOLERR_CORRUPTIMAGE; - /* copy to buffer */ - memcpy(dest, physrec_buf + l3_file->cur_pos_in_phys_rec + 1, reclen); - l3_file->cur_pos_in_phys_rec += reclen + 1; - /* skip to next physrec if needed */ - if ((l3_file->cur_pos_in_phys_rec == 256) - || (physrec_buf[l3_file->cur_pos_in_phys_rec] == 0xff)) - { - l3_file->cur_pos_in_phys_rec = 0; - l3_file->cur_phys_rec++; - } - (* out_reclen) = reclen; - } - else - { - /* fixed len records */ - reclen = get_file_reclen(&l3_file->l2_file); - if (is_eof(l3_file)) - return IMGTOOLERR_UNEXPECTED; - if ((l3_file->cur_pos_in_phys_rec + reclen) > 256) - { - l3_file->cur_pos_in_phys_rec = 0; - l3_file->cur_phys_rec++; - } - if ((l3_file->cur_phys_rec >= fphysrecs) - || ((l3_file->cur_phys_rec == (fphysrecs-1)) - && ((l3_file->cur_pos_in_phys_rec + reclen) >= (fdr_eof ? fdr_eof : 256)))) - return IMGTOOLERR_CORRUPTIMAGE; - errorcode = read_file_physrec(&l3_file->l2_file, l3_file->cur_phys_rec, physrec_buf); - if (errorcode) - return errorcode; - memcpy(dest, physrec_buf + l3_file->cur_pos_in_phys_rec, reclen); - l3_file->cur_pos_in_phys_rec += reclen; - if (l3_file->cur_pos_in_phys_rec == 256) - { - l3_file->cur_pos_in_phys_rec = 0; - l3_file->cur_phys_rec++; - } - (* out_reclen) = reclen; - } - - return 0; -} -#endif - -#if 0 -#pragma mark - -#pragma mark IMGTOOL MODULE IMPLEMENTATION -#endif - -/* - ti99 catalog iterator, used when imgtool reads the catalog -*/ -struct dsk_iterator -{ - struct ti99_lvl2_imgref *image; - int level; - int listing_subdirs; /* true if we are listing subdirectories at current level */ - int index[2]; /* current index in the disk catalog */ - ti99_catalog *cur_catalog; /* current catalog */ -}; - -struct win_iterator -{ - struct ti99_lvl2_imgref *image; - int level; - int listing_subdirs; /* true if we are listing subdirectories at current level */ - int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */ - ti99_catalog catalog[MAX_DIR_LEVEL]; /* current catalog */ -}; - - -static imgtoolerr_t dsk_image_init_mess(imgtool_image *image, imgtool_stream *f); -static imgtoolerr_t dsk_image_init_v9t9(imgtool_image *image, imgtool_stream *f); -static imgtoolerr_t dsk_image_init_pc99_fm(imgtool_image *image, imgtool_stream *f); -static imgtoolerr_t dsk_image_init_pc99_mfm(imgtool_image *image, imgtool_stream *f); -static imgtoolerr_t win_image_init(imgtool_image *image, imgtool_stream *f); -static void ti99_image_exit(imgtool_image *img); -static void ti99_image_info(imgtool_image *img, char *string, size_t len); -static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path); -static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); -static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path); -static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); -static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *size); -static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf); -static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions); -static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const char *fpath); -static imgtoolerr_t win_image_deletefile(imgtool_partition *partition, const char *fpath); -static imgtoolerr_t dsk_image_create_mess(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions); -static imgtoolerr_t dsk_image_create_v9t9(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions); - -enum -{ - dsk_createopts_volname = 'A', - dsk_createopts_sides = 'B', - dsk_createopts_tracks = 'C', - dsk_createopts_sectors = 'D', - dsk_createopts_protection = 'E', - dsk_createopts_density = 'F' -}; - -static OPTION_GUIDE_START( dsk_create_optionguide ) - OPTION_STRING(dsk_createopts_volname, "label", "Volume name" ) - OPTION_INT(dsk_createopts_sides, "sides", "Sides" ) - OPTION_INT(dsk_createopts_tracks, "tracks", "Tracks" ) - OPTION_INT(dsk_createopts_sectors, "sectors", "Sectors (1->9 for SD, 1->18 for DD, 1->36 for HD)" ) - OPTION_INT(dsk_createopts_protection, "protection", "Protection (0 for normal, 1 for protected)" ) - OPTION_ENUM_START(dsk_createopts_density, "density", "Density" ) - OPTION_ENUM( 0, "Auto", "Auto" ) - OPTION_ENUM( 1, "SD", "Single Density" ) - OPTION_ENUM( 2, "DD", "Double Density" ) - OPTION_ENUM( 3, "HD", "High Density" ) - OPTION_ENUM_END -OPTION_GUIDE_END - -#define dsk_create_optionspecs "B1-[2];C1-[40]-80;D1-[18]-36;E[0]-1;F[0]-3" - -static void ti99_getinfo(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(ti99_lvl2_imgref); break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(dsk_iterator); break; - - case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break; - case IMGTOOLINFO_PTR_CLOSE: info->close = ti99_image_exit; break; - case IMGTOOLINFO_PTR_INFO: info->info = ti99_image_info; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = ti99_image_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = ti99_image_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = ti99_image_writefile; break; - } -} - -static void ti99_dsk_getinfo(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "dsk"); break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = dsk_image_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = dsk_image_nextenum; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = dsk_image_deletefile; break; - default: ti99_getinfo(imgclass, state, info); - } -} - -void ti99_old_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti99_old"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (old MESS format)"); break; - case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_mess; break; - case IMGTOOLINFO_PTR_CREATE: info->create = dsk_image_create_mess; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = dsk_create_optionguide; break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), dsk_create_optionspecs); break; - default: ti99_dsk_getinfo(imgclass, state, info); break; - } -} - -void ti99_v9t9_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "v9t9"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (V9T9 format)"); break; - case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_v9t9; break; - case IMGTOOLINFO_PTR_CREATE: info->create = dsk_image_create_v9t9; break; - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = dsk_create_optionguide; break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), dsk_create_optionspecs); break; - default: ti99_dsk_getinfo(imgclass, state, info); break; - } -} - -void ti99_pc99fm_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc99fm"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (PC99 FM format)"); break; - case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_pc99_fm; break; - case IMGTOOLINFO_PTR_CREATE: /* info->create = dsk_image_create_pc99fm; */ break; - default: ti99_dsk_getinfo(imgclass, state, info); break; - } -} - -void ti99_pc99mfm_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc99mfm"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (PC99 MFM format)"); break; - case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_pc99_mfm; break; - case IMGTOOLINFO_PTR_CREATE: /* info->create = dsk_image_create_pc99mfm; */ break; - default: ti99_dsk_getinfo(imgclass, state, info); break; - } -} - -void ti99_ti99hd_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti99hd"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Harddisk"); break; - case IMGTOOLINFO_PTR_OPEN: info->open = win_image_init; break; - case IMGTOOLINFO_PTR_CREATE: /* info->create = hd_image_create; */ break; - - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = win_image_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = win_image_nextenum; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = win_image_deletefile; break; - default: ti99_getinfo(imgclass, state, info); - } -} - - - -/* - Open a file as a ti99_image (common code). -*/ -static int dsk_image_init(imgtool_image *img, imgtool_stream *f, ti99_img_format img_format) -{ - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - dsk_vib vib; - int reply; - int totphysrecs; - unsigned fdir_aphysrec; - int i; - - /* open disk image at level 1 */ - reply = open_image_lvl1(f, img_format, &image->l1_img, &vib); - if (reply) - return reply; - - /* open disk image at level 2 */ - image->type = L2I_DSK; - - /* @BN@ */ - /* Copy in the allocation bit map! */ - memcpy(image->abm, vib.abm, 200); - /* first compute AU size and number of AUs */ - totphysrecs = get_UINT16BE(vib.totphysrecs); - - image->AUformat.physrecsperAU = (totphysrecs + 1599) / 1600; - /* round to next larger power of 2 */ - for (i = 1; i < image->AUformat.physrecsperAU; i <<= 1) - ; - image->AUformat.physrecsperAU = i; - image->AUformat.totAUs = totphysrecs / image->AUformat.physrecsperAU; - - /* extract number of physrecs */ - image->dsk.totphysrecs = get_UINT16BE(vib.totphysrecs); - - /* read and check main volume catalog */ - reply = dsk_read_catalog(image, 1, &image->dsk.catalogs[0]); - if (reply) - return reply; - - image->dsk.fdir_aphysrec[0] = 1; - - /* read and check subdirectory catalogs */ - /* Note that the reserved areas used for HFDC subdirs may be used for other - purposes by other FDRs, so, if we get any error, we will assume there is no - subdir after all... */ - image->dsk.catalogs[0].num_subdirs = 0; - for (i=0; i<3; i++) - { - fdir_aphysrec = get_UINT16BE(vib.subdir[i].fdir_aphysrec); - if ((! memcmp(vib.subdir[i].name, "\0\0\0\0\0\0\0\0\0\0", 10)) - || (! memcmp(vib.subdir[i].name, " ", 10))) - { - /* name is empty: fine with us unless there is a fdir pointer */ - if (fdir_aphysrec != 0) - { - image->dsk.catalogs[0].num_subdirs = 0; - break; - } - } - else if (check_fname(vib.subdir[i].name)) - { - /* name is invalid: this is not an HFDC format floppy */ - image->dsk.catalogs[0].num_subdirs = 0; - break; - } - else - { - /* there is a non-empty name */ - if ((fdir_aphysrec == 0) || (fdir_aphysrec >= totphysrecs)) - { - /* error: fdir pointer is invalid or NULL */ - image->dsk.catalogs[0].num_subdirs = 0; - break; - } - /* fill in descriptor fields */ - image->dsk.fdir_aphysrec[image->dsk.catalogs[0].num_subdirs+1] = fdir_aphysrec; - /*image->dsk.catalogs[0].subdirs[image->dsk.catalogs[0].num_subdirs].dir_ptr = fdir_aphysrec;*/ - memcpy(image->dsk.catalogs[0].subdirs[image->dsk.catalogs[0].num_subdirs].name, vib.subdir[i].name, 10); - reply = dsk_read_catalog(image, fdir_aphysrec, &image->dsk.catalogs[image->dsk.catalogs[0].num_subdirs+1]); - if (reply) - { - /* error: invalid fdir */ - image->dsk.catalogs[0].num_subdirs = 0; - break; - } - /* found valid subdirectory: increment subdir count */ - image->dsk.catalogs[0].num_subdirs++; - } - } - - /* extract volume name */ - memcpy(image->vol_name, vib.name, 10); - - /* initialize default data_offset */ - image->data_offset = 32+2; - - return 0; -} - -/* - Open a file as a ti99_image (MESS format). -*/ -static imgtoolerr_t dsk_image_init_mess(imgtool_image *image, imgtool_stream *f) -{ - return (imgtoolerr_t)dsk_image_init(image, f, if_mess); -} - -/* - Open a file as a ti99_image (V9T9 format). -*/ -static imgtoolerr_t dsk_image_init_v9t9(imgtool_image *image, imgtool_stream *f) -{ - return (imgtoolerr_t)dsk_image_init(image, f, if_v9t9); -} - -/* - Open a file as a ti99_image (PC99 FM format). -*/ -static imgtoolerr_t dsk_image_init_pc99_fm(imgtool_image *image, imgtool_stream *f) -{ - return (imgtoolerr_t)dsk_image_init(image, f, if_pc99_fm); -} - -/* - Open a file as a ti99_image (PC99 MFM format). -*/ -static imgtoolerr_t dsk_image_init_pc99_mfm(imgtool_image *image, imgtool_stream *f) -{ - return (imgtoolerr_t)dsk_image_init(image, f, if_pc99_mfm); -} - -/* - Open a file as a ti99_image (harddisk format). -*/ -static imgtoolerr_t win_image_init(imgtool_image *img, imgtool_stream *f) -{ - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - win_vib_ddr vib; - int reply; - int i; - - /* open disk image at level 1 */ - reply = open_image_lvl1(f, if_harddisk, & image->l1_img, NULL); - if (reply) - return (imgtoolerr_t)reply; - - /* open disk image at level 2 */ - image->type = L2I_WIN; - - /* read VIB */ - reply = read_absolute_physrec(&image->l1_img, 0, &vib); - if (reply) - return (imgtoolerr_t)reply; - - /* guess VIB version */ - image->win.vib_version = memcmp(vib.u.vib_v1.id, "WIN", 3) ? win_vib_v2 : win_vib_v1; - - /* extract AU size and number of AUs */ - image->AUformat.physrecsperAU = ((get_UINT16BE(vib.params) >> 12) & 0xf) + 1; - image->AUformat.totAUs = get_UINT16BE(vib.totAUs); - - /* extract volume name */ - memcpy(image->vol_name, vib.name, 10); - - /* extract data_offset */ - switch (image->win.vib_version) - { - case win_vib_v1: - image->data_offset = 64; - break; - - case win_vib_v2: - image->data_offset = vib.u.vib_v2.res_AUs * 64; - break; - } - - /* read allocation bitmap (aphysrecs 1 through n, n<=33) */ - for (i=0; i < (image->AUformat.totAUs+2047)/2048; i++) - { - reply = read_absolute_physrec(&image->l1_img, i+1, image->abm+i*256); - if (reply) - return (imgtoolerr_t)reply; - } - - return (imgtoolerr_t)0; -} - -/* - close a ti99_image -*/ -static void ti99_image_exit(imgtool_image *img) -{ - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - - close_image_lvl1(&image->l1_img); -} - -/* - get basic information on a ti99_image - - Currently returns the volume name -*/ -static void ti99_image_info(imgtool_image *img, char *string, size_t len) -{ - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - char vol_name[11]; - - fname_to_str(vol_name, image->vol_name, 11); - - snprintf(string, len, "%s", vol_name); -} - -/* - Open the disk catalog for enumeration -*/ -static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path) -{ - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(imgtool_directory_image(enumeration)); - dsk_iterator *iter = (dsk_iterator *) imgtool_directory_extrabytes(enumeration); - - iter->image = image; - iter->level = 0; - iter->listing_subdirs = 1; - iter->index[0] = 0; - iter->cur_catalog = &iter->image->dsk.catalogs[0]; - - return (imgtoolerr_t)0; -} - -/* - Enumerate disk catalog next entry -*/ -static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - dsk_iterator *iter = (dsk_iterator*) imgtool_directory_extrabytes(enumeration); - dsk_fdr fdr; - int reply; - unsigned fdr_aphysrec; - - - ent->corrupt = 0; - ent->eof = 0; - - /* iterate through catalogs to next file or dir entry */ - while ((iter->level >= 0) - && (iter->index[iter->level] >= (iter->listing_subdirs - ? iter->cur_catalog->num_subdirs - : iter->cur_catalog->num_files))) - { - if (iter->listing_subdirs) - { - iter->listing_subdirs = 0; - iter->index[iter->level] = 0; - } - else - { - iter->listing_subdirs = 1; - if (! iter->level) - iter->level = -1; - else - { - iter->level = 0; - iter->index[0]++; - iter->cur_catalog = &iter->image->dsk.catalogs[0]; - } - } - } - - if (iter->level < 0) - { - ent->eof = 1; - } - else - { - if (iter->listing_subdirs) - { - fname_to_str(ent->filename, iter->image->dsk.catalogs[0].subdirs[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename)); - - /* set type of DIR */ - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "DIR"); - - /* len in physrecs */ - /* @BN@ return length in bytes */ - /* ent->filesize = 1; */ - ent->filesize = 256; - - /* recurse subdirectory */ - iter->listing_subdirs = 0; /* no need to list subdirs as only the - root dir has subdirs in DSK format */ - iter->level = 1; - iter->cur_catalog = &iter->image->dsk.catalogs[iter->index[0]+1]; - iter->index[iter->level] = 0; - } - else - { - fdr_aphysrec = iter->cur_catalog->files[iter->index[iter->level]].fdr_ptr; - reply = read_absolute_physrec(& iter->image->l1_img, fdr_aphysrec, & fdr); - if (reply) - return IMGTOOLERR_READERROR; -#if 0 - fname_to_str(ent->filename, fdr.name, ARRAY_LENGTH(ent->filename)); -#else - { - char buf[11]; - - ent->filename[0] = '\0'; - if (iter->level) - { - fname_to_str(ent->filename, iter->image->dsk.catalogs[0].subdirs[iter->index[0]].name, ARRAY_LENGTH(ent->filename)); - strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1); - } - fname_to_str(buf, fdr.name, 11); - strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); - } -#endif - /* parse flags */ - if (fdr.flags & fdr99_f_program) - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "PGM%s", - (fdr.flags & fdr99_f_wp) ? " R/O" : ""); - else - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c/%c %d%s", - (fdr.flags & fdr99_f_int) ? 'I' : 'D', - (fdr.flags & fdr99_f_var) ? 'V' : 'F', - fdr.reclen, - (fdr.flags & fdr99_f_wp) ? " R/O" : ""); - /* len in physrecs */ - /* @BN@ return length in bytes */ - /* ent->filesize = get_UINT16BE(fdr.fphysrecs); */ - ent->filesize = (get_UINT16BE(fdr.fphysrecs)+1)*256; - - iter->index[iter->level]++; - } - } - - return (imgtoolerr_t)0; -} - -/* - Open the disk catalog for enumeration -*/ -static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path) -{ - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(imgtool_directory_image(enumeration)); - win_iterator *iter = (win_iterator *) imgtool_directory_extrabytes(enumeration); - imgtoolerr_t errorcode; - - iter->image = image; - iter->level = 0; - iter->listing_subdirs = 1; - iter->index[0] = 0; - errorcode = (imgtoolerr_t)win_read_catalog(image, 0, &iter->catalog[0]); - if (errorcode) - return errorcode; - - return (imgtoolerr_t)0; -} - -/* - Enumerate disk catalog next entry -*/ -static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - win_iterator *iter = (win_iterator *) imgtool_directory_extrabytes(enumeration); - unsigned fdr_aphysrec; - win_fdr fdr; - int reply; - int i; - - - ent->corrupt = 0; - ent->eof = 0; - - /* iterate through catalogs to next file or dir entry */ - while ((iter->level >= 0) - && (iter->index[iter->level] >= (iter->listing_subdirs - ? iter->catalog[iter->level].num_subdirs - : iter->catalog[iter->level].num_files))) - { - if (iter->listing_subdirs) - { - iter->listing_subdirs = 0; - iter->index[iter->level] = 0; - } - else - { - iter->listing_subdirs = 1; - iter->level--; - iter->index[iter->level]++; - } - } - - if (iter->level < 0) - { - ent->eof = 1; - } - else - { - if (iter->listing_subdirs) - { -#if 0 - fname_to_str(ent->filename, iter->catalog[iter->level].subdirs[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename)); -#else - { - char buf[11]; - - ent->filename[0] = '\0'; - for (i=0; ilevel; i++) - { - fname_to_str(buf, iter->catalog[i].subdirs[iter->index[i]].name, 11); - strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); - strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1); - } - fname_to_str(buf, iter->catalog[iter->level].subdirs[iter->index[iter->level]].name, 11); - strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); - } -#endif - - /* set type of DIR */ - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "DIR"); - - /* len in physrecs */ - /* @BN@ return length in bytes */ - /* ent->filesize = 2; */ - ent->filesize = 512; - - /* recurse subdirectory */ - /*iter->listing_subdirs = 1;*/ - iter->level++; - iter->index[iter->level] = 0; - reply = win_read_catalog(iter->image, iter->catalog[iter->level-1].subdirs[iter->index[iter->level-1]].dir_ptr, &iter->catalog[iter->level]); - if (reply) - { - ent->corrupt = 1; - return (imgtoolerr_t)reply; - } - } - else - { - fdr_aphysrec = iter->catalog[iter->level].files[iter->index[iter->level]].fdr_ptr*iter->image->AUformat.physrecsperAU; - reply = read_absolute_physrec(& iter->image->l1_img, fdr_aphysrec, & fdr); - if (reply) - return IMGTOOLERR_READERROR; -#if 0 - fname_to_str(ent->filename, iter->catalog[iter->level].files[iter->index[iter->level]].name, ARRAY_LENGTH(ent->filename)); -#else - { - char buf[11]; - - ent->filename[0] = '\0'; - for (i=0; ilevel; i++) - { - fname_to_str(buf, iter->catalog[i].subdirs[iter->index[i]].name, 11); - strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); - strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1); - } - fname_to_str(buf, iter->catalog[iter->level].files[iter->index[iter->level]].name, 11); - strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); - } -#endif - /* parse flags */ - if (fdr.flags & fdr99_f_program) - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "PGM%s", - (fdr.flags & fdr99_f_wp) ? " R/O" : ""); - else - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%c/%c %d%s", - (fdr.flags & fdr99_f_int) ? 'I' : 'D', - (fdr.flags & fdr99_f_var) ? 'V' : 'F', - fdr.reclen, - (fdr.flags & fdr99_f_wp) ? " R/O" : ""); - /* len in physrecs */ - /* @BN@ return length in bytes */ - /* ent->filesize = get_win_fdr_fphysrecs(&fdr); */ - ent->filesize = (get_win_fdr_fphysrecs(&fdr)+1)*256; - - iter->index[iter->level]++; - } - } - - return (imgtoolerr_t)0; -} - -/* - Compute free space on disk image (in AUs) -*/ -static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtool_image *img = imgtool_partition_image(partition); - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - size_t freeAUs; - int i; - - freeAUs = 0; - for (i=0; iAUformat.totAUs; i++) - { - if (! (image->abm[i >> 3] & (1 << (i & 7)))) - freeAUs++; - } - - /* @BN@ return free space in bytes */ - /* *size = freeAUs; */ - *size = freeAUs*256; - - return IMGTOOLERR_SUCCESS; -} - -/* - Extract a file from a ti99_image. The file is saved in tifile format. -*/ -static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf) -{ - imgtool_image *img = imgtool_partition_image(partition); -#if 1 - - /* extract data as TIFILES */ - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - ti99_lvl2_fileref src_file; - ti99_lvl2_fileref dst_file; - ti99_date_time date_time; - int fphysrecs; - int i; - UINT8 buf[256]; - imgtoolerr_t errorcode; - - - if (check_fpath(fpath)) - return IMGTOOLERR_BADFILENAME; - - /* open file on TI image */ - switch (image->type) - { - case L2I_DSK: - errorcode = (imgtoolerr_t)open_file_lvl2_dsk(image, fpath, &src_file); - break; - - case L2I_WIN: - errorcode = (imgtoolerr_t)open_file_lvl2_win(image, fpath, &src_file); - break; - - default: - errorcode = (imgtoolerr_t)-1; - break; - } - if (errorcode) - return errorcode; - - errorcode = (imgtoolerr_t)new_file_lvl2_tifiles(destf, &dst_file); - if (errorcode) - return errorcode; - - /* write TIFILE header */ - /* set up parameters */ - set_file_flags(&dst_file, get_file_flags(&src_file)); - set_file_recsperphysrec(&dst_file, get_file_recsperphysrec(&src_file)); - errorcode = (imgtoolerr_t)set_file_fphysrecs(&dst_file, get_file_fphysrecs(&src_file)); - if (errorcode) - return errorcode; - set_file_eof(&dst_file, get_file_eof(&src_file)); - errorcode = (imgtoolerr_t)set_file_reclen(&dst_file, get_file_reclen(&src_file)); - if (errorcode) - return errorcode; - errorcode = (imgtoolerr_t)set_file_fixrecs(&dst_file, get_file_fixrecs(&src_file)); - if (errorcode) - return errorcode; - - get_file_creation_date(&src_file, &date_time); -#if 0 - if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) - || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) - current_date_time(&date_time); -#endif - set_file_creation_date(&dst_file, date_time); - - get_file_update_date(&src_file, &date_time); -#if 0 - if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) - || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) - current_date_time(&date_time); -#endif - set_file_update_date(&dst_file, date_time); - - if (stream_write(destf, & dst_file.tifiles.hdr, 128) != 128) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - - /* copy data to TIFILE */ - fphysrecs = get_file_fphysrecs(&src_file); - - for (i=0; itype) - { - case L2I_DSK: - errorcode = open_file_lvl2_dsk(image, fpath, &src_file.l2_file); - break; - - case L2I_WIN: - errorcode = open_file_lvl2_win(image, fpath, &src_file.l2_file); - break; - } - if (errorcode) - return errorcode; - - errorcode = open_file_lvl3(& src_file); - if (errorcode) - return errorcode; - - /* write text data */ - while (! is_eof(& src_file)) - { - errorcode = read_next_record(& src_file, buf, & reclen); - if (errorcode) - return errorcode; - if (stream_write(destf, buf, reclen) != reclen) - return IMGTOOLERR_WRITEERROR; - if (stream_write(destf, &lineend, 1) != 1) - return IMGTOOLERR_WRITEERROR; - } - - return 0; - -#endif -} - -/* - Add a file to a ti99_image. The file must be in tifile format. -*/ -static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) -{ - imgtool_image *img = imgtool_partition_image(partition); - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - const char *filename; - char ti_fname[10]; - ti99_lvl2_fileref src_file; - ti99_lvl2_fileref dst_file; - ti99_date_time date_time; - int i; - int fphysrecs; - UINT8 buf[256]; - imgtoolerr_t errorcode; - int parent_ref_valid, parent_ref = 0; - ti99_catalog *catalog, catalog_buf = {0, }; - - - (void) writeoptions; - - if (check_fpath(fpath)) - return IMGTOOLERR_BADFILENAME; - - switch (image->type) - { - case L2I_DSK: - errorcode = (imgtoolerr_t)dsk_find_catalog_entry(image, fpath, &parent_ref_valid, &parent_ref, NULL, NULL); - if (errorcode == 0) - /* file already exists: causes an error for now */ - return (imgtoolerr_t)IMGTOOLERR_UNEXPECTED; - else if ((! parent_ref_valid) || (errorcode != IMGTOOLERR_FILENOTFOUND)) - return (imgtoolerr_t)errorcode; - break; - - case L2I_WIN: - errorcode = (imgtoolerr_t)win_find_catalog_entry(image, fpath, &parent_ref_valid, &parent_ref, &catalog_buf, NULL, NULL); - if (errorcode == 0) - /* file already exists: causes an error for now */ - return (imgtoolerr_t)IMGTOOLERR_UNEXPECTED; - else if ((! parent_ref_valid) || (errorcode != IMGTOOLERR_FILENOTFOUND)) - return (imgtoolerr_t)errorcode; - break; - } - - errorcode =(imgtoolerr_t) open_file_lvl2_tifiles(sourcef, & src_file); - if (errorcode) - return (imgtoolerr_t)errorcode; - - /* create new file */ - filename = strrchr(fpath, '.'); - if (filename) - filename++; - else - filename = fpath; - str_to_fname(ti_fname, filename); - switch (image->type) - { - case L2I_DSK: - errorcode = (imgtoolerr_t)new_file_lvl2_dsk(image, parent_ref, ti_fname, &dst_file); - if (errorcode) - return (imgtoolerr_t)errorcode; - break; - - case L2I_WIN: - errorcode = (imgtoolerr_t)new_file_lvl2_win(image, &catalog_buf, ti_fname, &dst_file); - if (errorcode) - return (imgtoolerr_t)errorcode; - break; - } - - /* set up parameters */ - set_file_flags(&dst_file, get_file_flags(&src_file)); - set_file_recsperphysrec(&dst_file, get_file_recsperphysrec(&src_file)); - errorcode = (imgtoolerr_t)set_file_fphysrecs(&dst_file, /*get_file_fphysrecs(&src_file)*/0); - if (errorcode) - return (imgtoolerr_t)errorcode; - set_file_eof(&dst_file, get_file_eof(&src_file)); - errorcode = (imgtoolerr_t)set_file_reclen(&dst_file, get_file_reclen(&src_file)); - if (errorcode) - return (imgtoolerr_t)errorcode; - errorcode = (imgtoolerr_t)set_file_fixrecs(&dst_file, get_file_fixrecs(&src_file)); - if (errorcode) - return (imgtoolerr_t)errorcode; - - get_file_creation_date(&src_file, &date_time); -#if 0 - if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) - || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) - current_date_time(&date_time); -#endif - set_file_creation_date(&dst_file, date_time); - - get_file_update_date(&src_file, &date_time); -#if 0 - if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) - || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) - current_date_time(&date_time); -#endif - set_file_update_date(&dst_file, date_time); - - /* alloc data physrecs */ - fphysrecs = get_file_fphysrecs(&src_file); - switch (dst_file.type) - { - case L2F_DSK: - errorcode = (imgtoolerr_t)dsk_alloc_file_physrecs(&dst_file.dsk, fphysrecs); - if (errorcode) - return (imgtoolerr_t)errorcode; - break; - - case L2F_WIN: - errorcode = (imgtoolerr_t)win_alloc_file_physrecs(&dst_file.win, fphysrecs); - if (errorcode) - return (imgtoolerr_t)errorcode; - break; - - case L2F_TIFILES: - break; - } - - /* copy data */ - for (i=0; itype) - { - case L2I_DSK: - if (write_absolute_physrec(& image->l1_img, dst_file.dsk.fdr_aphysrec, &dst_file.dsk.fdr)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - break; - - case L2I_WIN: - /* save fphysrecs field as well */ - if (dst_file.win.curfdr_aphysrec == dst_file.win.eldestfdr_aphysrec) - set_win_fdr_fphysrecs(&dst_file.win.curfdr, dst_file.win.fphysrecs); - if (write_absolute_physrec(& image->l1_img, dst_file.win.curfdr_aphysrec, &dst_file.win.curfdr)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - if (dst_file.win.curfdr_aphysrec != dst_file.win.eldestfdr_aphysrec) - { - dst_file.win.curfdr_aphysrec = dst_file.win.eldestfdr_aphysrec; - if (read_absolute_physrec(& image->l1_img, dst_file.win.curfdr_aphysrec, &dst_file.win.curfdr)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - set_win_fdr_fphysrecs(&dst_file.win.curfdr, dst_file.win.fphysrecs); - if (write_absolute_physrec(& image->l1_img, dst_file.win.curfdr_aphysrec, &dst_file.win.curfdr)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - } - break; - } - - /* update catalog */ - switch (image->type) - { - case L2I_DSK: - catalog = &image->dsk.catalogs[parent_ref]; - for (i=0; i<128; i++) - { - buf[2*i] = catalog->files[i].fdr_ptr >> 8; - buf[2*i+1] = catalog->files[i].fdr_ptr & 0xff; - } - if (write_absolute_physrec(& image->l1_img, image->dsk.fdir_aphysrec[parent_ref], buf)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - break; - - case L2I_WIN: - { - win_vib_ddr parent_ddr; - int fdir_AU; - - /* update VIB/DDR and get FDIR AU address */ - if (read_absolute_physrec(& image->l1_img, parent_ref * image->AUformat.physrecsperAU, &parent_ddr)) - return (imgtoolerr_t)IMGTOOLERR_READERROR; - parent_ddr.num_files = catalog_buf.num_files; - if (write_absolute_physrec(& image->l1_img, parent_ref * image->AUformat.physrecsperAU, &parent_ddr)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - fdir_AU = get_UINT16BE(parent_ddr.fdir_AU); - - /* generate FDIR and save it */ - for (i=0; i<127; i++) - { - buf[2*i] = catalog_buf.files[i].fdr_ptr >> 8; - buf[2*i+1] = catalog_buf.files[i].fdr_ptr & 0xff; - } - buf[254] = parent_ref >> 8; - buf[255] = parent_ref & 0xff; - if (write_absolute_physrec(& image->l1_img, fdir_AU * image->AUformat.physrecsperAU, buf)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - } - break; - } - - /* update bitmap */ - switch (image->type) - { - case L2I_DSK: - { - dsk_vib vib; - - if (read_absolute_physrec(& image->l1_img, 0, &vib)) - return (imgtoolerr_t)IMGTOOLERR_READERROR; - memcpy(vib.abm, image->abm, 200); - if (write_absolute_physrec(& image->l1_img, 0, &vib)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - } - break; - - case L2I_WIN: - /* save allocation bitmap (aphysrecs 1 through n, n<=33) */ - for (i=0; i < (image->AUformat.totAUs+2047)/2048; i++) - if (write_absolute_physrec(&image->l1_img, i+1, image->abm+i*256)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - break; - } - - return (imgtoolerr_t)0; -} - -/* - Delete a file from a ti99_image. -*/ -static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const char *fpath) -{ - imgtool_image *img = imgtool_partition_image(partition); - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - dsk_fdr fdr; - int i, cluster_index; - unsigned cur_AU, cluster_lastfphysrec; -// int fphysrecs; - int parent_ref, is_dir, catalog_index; - imgtoolerr_t errorcode; - UINT8 buf[256]; - ti99_catalog *catalog; - - - if (check_fpath(fpath)) - return IMGTOOLERR_BADFILENAME; - - errorcode = (imgtoolerr_t)dsk_find_catalog_entry(image, fpath, NULL, &parent_ref, &is_dir, &catalog_index); - if (errorcode) - return errorcode; - - if (is_dir) - { - catalog = &image->dsk.catalogs[catalog_index+1]; - - if ((catalog->num_files != 0) || (catalog->num_subdirs != 0)) - return IMGTOOLERR_UNIMPLEMENTED; - - catalog = &image->dsk.catalogs[0]; - - /* free fdir AU */ - cur_AU = image->dsk.fdir_aphysrec[catalog_index+1] / image->AUformat.physrecsperAU; - image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); - - /* delete catalog entry */ - for (i=catalog_index; i<2; i++) - { - catalog->subdirs[i] = catalog->subdirs[i+1]; - image->dsk.fdir_aphysrec[i+1] = image->dsk.fdir_aphysrec[i+2]; - } - memset(catalog->subdirs[2].name, 0, 10); - catalog->subdirs[2].dir_ptr = 0; - image->dsk.fdir_aphysrec[3] = 0; - catalog->num_subdirs--; - - /* update directory and bitmap in vib */ - { - dsk_vib vib; - - if (read_absolute_physrec(& image->l1_img, 0, &vib)) - return IMGTOOLERR_READERROR; - - for (i=0; i<3; i++) - { - memcpy(vib.subdir[i].name, catalog->subdirs[i].name, 10); - set_UINT16BE(&vib.subdir[i].fdir_aphysrec, image->dsk.fdir_aphysrec[i+1]); - } - - memcpy(vib.abm, image->abm, 200); - - if (write_absolute_physrec(& image->l1_img, 0, &vib)) - return IMGTOOLERR_WRITEERROR; - } - } - else - { - catalog = &image->dsk.catalogs[parent_ref]; - - if (read_absolute_physrec(& image->l1_img, catalog->files[catalog_index].fdr_ptr, &fdr)) - return IMGTOOLERR_READERROR; - - /* free data AUs */ -// fphysrecs = - get_UINT16BE(fdr.fphysrecs); - - i = 0; - cluster_index = 0; - while (cluster_index < 76) - { - cur_AU = get_dsk_fdr_cluster_baseAU(image, & fdr, cluster_index); - if (cur_AU == 0) - /* end of cluster list */ - break; - cluster_lastfphysrec = get_dsk_fdr_cluster_lastfphysrec(& fdr, cluster_index); - - while (i<=cluster_lastfphysrec) - { - /* the condition below is an error, but it should not prevent - us from deleting the file */ - if (cur_AU >= image->AUformat.totAUs) - /*return IMGTOOLERR_CORRUPTIMAGE;*/ - break; - - image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); - - i += image->AUformat.physrecsperAU; - cur_AU++; - } - - cluster_index++; - } - /* the condition below is an error, but it should not prevent us from - deleting the file */ -#if 0 - if (ifiles[catalog_index].fdr_ptr / image->AUformat.physrecsperAU; - image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); - - /* delete catalog entry */ - for (i=catalog_index; i<127; i++) - catalog->files[i] = catalog->files[i+1]; - catalog->files[127].fdr_ptr = 0; - catalog->num_files--; - - /* update parent fdir */ - for (i=0; i<128; i++) - { - buf[2*i] = catalog->files[i].fdr_ptr >> 8; - buf[2*i+1] = catalog->files[i].fdr_ptr & 0xff; - } - if (write_absolute_physrec(& image->l1_img, image->dsk.fdir_aphysrec[parent_ref], buf)) - return IMGTOOLERR_WRITEERROR; - - /* update bitmap */ - { - dsk_vib vib; - - if (read_absolute_physrec(& image->l1_img, 0, &vib)) - return IMGTOOLERR_READERROR; - memcpy(vib.abm, image->abm, 200); - if (write_absolute_physrec(& image->l1_img, 0, &vib)) - return IMGTOOLERR_WRITEERROR; - } - } - - return (imgtoolerr_t)0; -} - -static imgtoolerr_t win_image_deletefile(imgtool_partition *partition, const char *fpath) -{ - imgtool_image *img = imgtool_partition_image(partition); - struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_image_extra_bytes(img); - int parent_ddr_AU, is_dir, catalog_index; - win_fdr fdr; - int i; - unsigned cur_AU, end_AU; - unsigned curfdr_aphysrec; - unsigned cursibFDR_index, endsibFDR_index = 0; - int errorcode; - UINT8 buf[256]; - ti99_catalog catalog; - - - if (check_fpath(fpath)) - return (imgtoolerr_t)IMGTOOLERR_BADFILENAME; - - errorcode = win_find_catalog_entry(image, fpath, NULL, &parent_ddr_AU, &catalog, &is_dir, &catalog_index); - if (errorcode) - return (imgtoolerr_t)errorcode; - - if (is_dir) - { - unsigned DDR_AU; - win_vib_ddr ddr_buf; - - /* Read DDR record */ - DDR_AU = catalog.subdirs[catalog_index].dir_ptr; - if (read_absolute_physrec(& image->l1_img, DDR_AU*image->AUformat.physrecsperAU, &ddr_buf)) - return (imgtoolerr_t)IMGTOOLERR_READERROR; - - /* read FDIR AU pointer */ - cur_AU = get_UINT16BE(ddr_buf.fdir_AU); - - /* sanity checks */ - if ((ddr_buf.num_files > 127) || (ddr_buf.num_subdirs > 114) || (cur_AU > image->AUformat.totAUs)) - return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; - - if ((ddr_buf.num_files != 0) || (ddr_buf.num_subdirs != 0)) - return (imgtoolerr_t)IMGTOOLERR_UNIMPLEMENTED; - - /* free fdir AU */ - image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); - - /* free ddr AU */ - image->abm[DDR_AU >> 3] &= ~ (1 << (DDR_AU & 7)); - - /* delete parent catalog entry */ - for (i=catalog_index; i<113; i++) - catalog.subdirs[i] = catalog.subdirs[i+1]; - catalog.subdirs[113].dir_ptr = 0; - catalog.num_subdirs--; - - /* update parent VIB/DDR */ - if (read_absolute_physrec(& image->l1_img, parent_ddr_AU * image->AUformat.physrecsperAU, &ddr_buf)) - return (imgtoolerr_t)IMGTOOLERR_READERROR; - ddr_buf.num_subdirs = catalog.num_subdirs; - for (i=0; i<114; i++) - set_UINT16BE(&ddr_buf.subdir_AU[i], catalog.subdirs[i].dir_ptr); - if (write_absolute_physrec(& image->l1_img, parent_ddr_AU * image->AUformat.physrecsperAU, &ddr_buf)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - - /* save allocation bitmap (aphysrecs 1 through n, n<=33) */ - for (i=0; i < (image->AUformat.totAUs+2047)/2048; i++) - if (write_absolute_physrec(&image->l1_img, i+1, image->abm+i*256)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - } - else - { - /* check integrity of FDR sibling chain, and go to last sibling */ - /* note that as we check that the back chain is consistent with the forward - chain, we will also detect any cycle in the sibling chain, so we do not - need to check against them explicitely */ - { - int pastendoflist_flag; - unsigned prevfdr_aphysrec; - - - pastendoflist_flag = 0; - cursibFDR_index = 0; - curfdr_aphysrec = catalog.files[catalog_index].fdr_ptr * image->AUformat.physrecsperAU; - if (read_absolute_physrec(& image->l1_img, curfdr_aphysrec, &fdr)) - return (imgtoolerr_t)IMGTOOLERR_READERROR; - - if (get_UINT16BE(fdr.prevsibFDR_AU) != 0) - return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; - - while (1) - { - if (! pastendoflist_flag) - { - /* look for end of list */ - for (i=0; i<54; i++) - { - if (get_UINT16BE(fdr.clusters[i][0]) == 0) - { - endsibFDR_index = cursibFDR_index; - pastendoflist_flag = TRUE; - break; - } - } - } - - /* exit loop if end of sibling chain */ - if (! get_UINT16BE(fdr.nextsibFDR_AU)) - break; - - /* otherwise read next FDR */ - if (get_UINT16BE(fdr.nextsibFDR_AU) >= image->AUformat.totAUs) - return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; - - prevfdr_aphysrec = curfdr_aphysrec; - curfdr_aphysrec = get_win_fdr_nextsibFDR_aphysrec(image, &fdr); - if (read_absolute_physrec(& image->l1_img, curfdr_aphysrec, &fdr)) - return (imgtoolerr_t)IMGTOOLERR_READERROR; - cursibFDR_index++; - - /* check that back chaining is consistent with forward chaining */ - if (get_win_fdr_prevsibFDR_aphysrec(image, &fdr) != prevfdr_aphysrec) - return (imgtoolerr_t)IMGTOOLERR_CORRUPTIMAGE; - } - if (! pastendoflist_flag) - endsibFDR_index = cursibFDR_index; - } - - - while (1) - { - if (cursibFDR_index <= endsibFDR_index) - { - for (i = 0; i < 54; i++) - { - cur_AU = get_UINT16BE(fdr.clusters[i][0]); - if (cur_AU == 0) - /* end of cluster list */ - break; - end_AU = get_UINT16BE(fdr.clusters[i][1]); - - while (cur_AU<=end_AU) - { - /* the condition below is an error, but it should not prevent - us from deleting the file */ - if (cur_AU >= image->AUformat.totAUs) - /*return IMGTOOLERR_CORRUPTIMAGE;*/ - break; - - image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); - - cur_AU++; - } - } - } - - /* free fdr AU if applicable */ - if ((curfdr_aphysrec % image->AUformat.physrecsperAU) == 0) - { - cur_AU = curfdr_aphysrec / image->AUformat.physrecsperAU; - image->abm[cur_AU >> 3] &= ~ (1 << (cur_AU & 7)); - } - - if (cursibFDR_index == 0) - break; - curfdr_aphysrec = get_win_fdr_prevsibFDR_aphysrec(image, &fdr); - if (read_absolute_physrec(& image->l1_img, curfdr_aphysrec, &fdr)) - return (imgtoolerr_t)IMGTOOLERR_READERROR; - cursibFDR_index--; - } - - - /* delete catalog entry */ - for (i=catalog_index; i<127; i++) - catalog.files[i] = catalog.files[i+1]; - catalog.files[127].fdr_ptr = 0; - catalog.num_files--; - - - /* update VIB/DDR and get FDIR AU address */ - { - win_vib_ddr parent_ddr; - - if (read_absolute_physrec(& image->l1_img, parent_ddr_AU * image->AUformat.physrecsperAU, &parent_ddr)) - return (imgtoolerr_t)IMGTOOLERR_READERROR; - parent_ddr.num_files = catalog.num_files; - if (write_absolute_physrec(& image->l1_img, parent_ddr_AU * image->AUformat.physrecsperAU, &parent_ddr)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - cur_AU = get_UINT16BE(parent_ddr.fdir_AU); - } - - /* generate FDIR and save it */ - for (i=0; i<127; i++) - { - buf[2*i] = catalog.files[i].fdr_ptr >> 8; - buf[2*i+1] = catalog.files[i].fdr_ptr & 0xff; - } - buf[254] = parent_ddr_AU >> 8; - buf[255] = parent_ddr_AU & 0xff; - if (write_absolute_physrec(& image->l1_img, cur_AU * image->AUformat.physrecsperAU, buf)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - - /* save allocation bitmap (aphysrecs 1 through n, n<=33) */ - for (i=0; i < (image->AUformat.totAUs+2047)/2048; i++) - if (write_absolute_physrec(&image->l1_img, i+1, image->abm+i*256)) - return (imgtoolerr_t)IMGTOOLERR_WRITEERROR; - } - - return (imgtoolerr_t)0; -} - -/* - Create a blank ti99_image (common code). - - Supports MESS and V9T9 formats only -*/ -static imgtoolerr_t dsk_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions, ti99_img_format img_format) -{ - const char *volname; - int density; - ti99_lvl1_imgref l1_img; - int protected_var; - - int totphysrecs, physrecsperAU, totAUs; - - dsk_vib vib; - UINT8 empty_sec[256]; - - int i; - - l1_img.img_format = img_format; - l1_img.file_handle = f; - - /* read options */ - volname = option_resolution_lookup_string(createoptions, dsk_createopts_volname); - l1_img.geometry.heads = option_resolution_lookup_int(createoptions, dsk_createopts_sides); - l1_img.geometry.cylinders = option_resolution_lookup_int(createoptions, dsk_createopts_tracks); - l1_img.geometry.secspertrack = option_resolution_lookup_int(createoptions, dsk_createopts_sectors); - protected_var = option_resolution_lookup_int(createoptions, dsk_createopts_protection); - density = option_resolution_lookup_int(createoptions, dsk_createopts_density); - - /* NPW 03-DEC-2003 - Fixes a crash if volname is NULL */ - if (!volname) - volname = ""; - - totphysrecs = l1_img.geometry.secspertrack * l1_img.geometry.cylinders * l1_img.geometry.heads; - physrecsperAU = (totphysrecs + 1599) / 1600; - /* round to next larger power of 2 */ - for (i = 1; i < physrecsperAU; i <<= 1) - ; - physrecsperAU = i; - totAUs = totphysrecs / physrecsperAU; - - /* auto-density */ - if (density == 0) - { - if (l1_img.geometry.secspertrack <= 9) - density = 1; - else if (l1_img.geometry.secspertrack <= 18) - density = 2; - else - density = 3; - } - - /* check volume name */ - if (strchr(volname, '.') || strchr(volname, ' ') || (strlen(volname) > 10)) - return /*IMGTOOLERR_BADFILENAME*/IMGTOOLERR_PARAMCORRUPT; - - /* FM disks can hold fewer sector per track than MFM disks */ - if ((density == 1) && (l1_img.geometry.secspertrack > 9)) - return IMGTOOLERR_PARAMTOOLARGE; - - /* DD disks can hold fewer sector per track than HD disks */ - if ((density == 2) && (l1_img.geometry.secspertrack > 18)) - return IMGTOOLERR_PARAMTOOLARGE; - - /* check total disk size */ - if (totphysrecs < 2) - return IMGTOOLERR_PARAMTOOSMALL; - - /* initialize vib in aphysrec 0 */ - - /* set volume name */ - str_to_fname(vib.name, volname); - - /* set every header field */ - set_UINT16BE(& vib.totphysrecs, totphysrecs); - vib.secspertrack = l1_img.geometry.secspertrack; - vib.id[0] = 'D'; - vib.id[1] = 'S'; - vib.id[2] = 'K'; - vib.protection = protected_var ? 'P' : ' '; - vib.cylinders = l1_img.geometry.cylinders; - vib.heads = l1_img.geometry.heads; - vib.density = density; - for (i=0; i<3; i++) - { - memset(vib.subdir[i].name, '\0', 10); - set_UINT16BE(& vib.subdir[i].fdir_aphysrec, 0); - } - - /* clear bitmap */ - for (i=0; i < (totAUs>>3); i++) - vib.abm[i] = 0; - - if (totAUs & 7) - { - vib.abm[i] = 0xff << (totAUs & 7); - i++; - } - - for (; i < 200; i++) - vib.abm[i] = 0xff; - - /* mark first 2 aphysrecs (vib and fdir) as used */ - vib.abm[0] |= (physrecsperAU == 1) ? 3 : 1; - - /* write aphysrec 0 */ - if (write_absolute_physrec(& l1_img, 0, &vib)) - return IMGTOOLERR_WRITEERROR; - - - /* now clear every other physrecs, including the FDIR record */ - memset(empty_sec, 0, sizeof(empty_sec)); - - for (i=1; i -#include -#include -#include -#include "imgtool.h" - -/* Max sector length is bytes. Generally 256, except for a few older disk -units which use 288-byte-long sectors, and SCSI units which generally use -standard 512-byte-long sectors. */ -/* I chose a limit of 512. No need to use more until someone creates CD-ROMs -for TI990. */ -#define MAX_SECTOR_SIZE 512 -#define MIN_SECTOR_SIZE 256 - -#define MAX_CYLINDERS 2047 -#define MAX_HEADS 31 -#define MAX_SECTORS_PER_TRACK 256 /* 255 for 512-byte-long sector, so that the total number of words that can be recorded on a track may fit in one 16-bit word (store registers command) */ - -/* Max path len in chars: this value is 48 characters in DX10, but since the -path includes at least a leading '.', our value is 47. */ -/* Since path generally include a volume name that can be up to 8 character -long, we should display a warning message when the user wants to create a path -that is longer than 39 characters. */ -#define MAX_PATH_LEN 47 -#define MAX_SAFE_PATH_LEN 39 - -#define MAX_DIR_LEVEL 25 /* We need to put a recursion limit to avoid endless recursion hazard */ - - -struct UINT16BE -{ - UINT8 bytes[2]; -}; - -struct UINT32BE -{ - UINT8 bytes[4]; -}; - -INLINE UINT16 get_UINT16BE(UINT16BE word) -{ - return (word.bytes[0] << 8) | word.bytes[1]; -} - -INLINE void set_UINT16BE(UINT16BE *word, UINT16 data) -{ - word->bytes[0] = (data >> 8) & 0xff; - word->bytes[1] = data & 0xff; -} - -INLINE UINT32 get_UINT32BE(UINT32BE word) -{ - return (word.bytes[0] << 24) | (word.bytes[1] << 16) | (word.bytes[2] << 8) | word.bytes[3]; -} - -INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) -{ - word->bytes[0] = (data >> 24) & 0xff; - word->bytes[1] = (data >> 16) & 0xff; - word->bytes[2] = (data >> 8) & 0xff; - word->bytes[3] = data & 0xff; -} - -/* - disk image header -*/ -struct disk_image_header -{ - UINT32BE cylinders; /* number of cylinders on hard disk (big-endian) */ - UINT32BE heads; /* number of heads on hard disk (big-endian) */ - UINT32BE sectors_per_track; /* number of sectors per track on hard disk (big-endian) */ - UINT32BE bytes_per_sector; /* number of bytes of data per sector on hard disk (big-endian) */ -}; - -enum -{ - header_len = sizeof(disk_image_header) -}; - -/* - Disk structure: - - Track 0 Sector 0: see below - Track 0 Sector 1: list of bad ADU - Track 0 Sector 2 through N: disk allocation bitmap - Track 1 Sector 0 through N-2: optional disk program image loader - Track 1 Sector N-1: copy of Track 0 Sector 0 - Track 1 Sector N: copy of Track 0 Sector 1 - Last cylinder has disagnostic information (reported as .S$DIAG) - Remaining sectors are used for fdr and data. -*/ - -/* - SC0 record (Disk sector 0) -*/ -struct ti990_sc0 -{ - char vnm[8]; /* volume name */ - UINT16BE tna; /* total number of ADUs */ - UINT8 sbm; /* starting sector of bit maps */ - UINT8 tbm; /* total bit maps */ - UINT16BE rl; /* track 01 record length */ - UINT16BE slt; /* system loader track address */ - UINT8 fill00[6]; /* * * RESERVED * * */ - UINT16BE nba; /* total number of bad ADUs on disk */ - UINT16BE sle; /* system loader entry point */ - UINT16BE sll; /* system loader length */ - UINT8 fill01[8]; /* * * RESERVED * * */ - UINT16BE lt1; /* system loader track (copy 2) */ - UINT8 fill02[8]; /* * * RESERVED * * */ - char pi1[8]; /* primary system file name */ - char pi2[8]; /* secondary system file name */ - UINT16BE pif; /* system selector */ - UINT16BE vda; /* volume directory ADU */ - UINT16BE vpl; /* vcatalog physical record length */ - UINT16BE spa; /* sectors per ADU */ - UINT8 dcd[4]; /* disk creation date */ - char pf1[8]; /* primary program file */ - char pf2[8]; /* secondary program file */ - UINT16BE pff; /* program file switch */ - char of1[8]; /* primary overlay file */ - char of2[8]; /* secondary overlay file */ - UINT16BE off; /* overlay file switch */ - char il1[8]; /* primary intermediate loader */ - char il2[8]; /* secondary intermediate loader */ - UINT16BE ilf; /* intermediate loader flag */ - char din[8]; /* diagnostic file name */ - UINT16BE dif; /* diagnostic flag */ - UINT16BE drs; /* default physical record size "DBUILD DETERMINES DEFAULT PRS" (whatever it means) */ - UINT16BE bal; /* starting sector of bad ADU list */ - UINT16BE spr; /* track 0 sectors per record */ - char wf1[8]; /* WCS primary microcode file */ - char wf2[8]; /* WCS secondary microcode file */ - UINT16BE wff; /* WCS flag switch */ - UINT16BE vif; /* track 1 select flag (whatever it means) volume information copied flag */ - UINT16BE sta; /* state of disk: */ - /* 1 = disk surface has not been tested for defects */ - /* 2 = disk surface has been tested, but no file system has been installed */ - /* 3 = a file system has been installed */ - UINT16BE dct; /* disk creation time */ - UINT16BE fsf; /* * * RESERVED * * */ - /* SCOSIZ = >AA */ -}; - -/* - DOR (Directory Overhead Record) -*/ -struct ti990_dor -{ - UINT16BE nrc; /* # records in directory (minus DOR) nrc = nfl + nar (+ tfc???) */ - UINT16BE nfl; /* # files currently in directory */ - UINT16BE nar; /* # of available records */ - UINT16BE tfc; /* number of temporary files */ - char dnm[8]; /* directory file name (VCATALOG for root) */ - UINT16BE lvl; /* level # of directory (0 for root, 1 for children of root, 2 for grandchildren, etc) */ - char pnm[8]; /* name of parent directory (VCATALOG for root, even though it makes little sense) */ - UINT16BE prs; /* "default physical record length (used for file creation)" */ - /* DORSIZ = >1C */ -}; - -/* - file flags found in fdr -*/ -enum -{ - ace_flg_rdf = 0x8000, /* read access flag */ - ace_flg_wrf = 0x4000, /* write access flag */ - ace_flg_dlf = 0x2000, /* delete access flag */ - ace_flg_exf = 0x1000, /* execute access flag */ - ace_flg_ctf = 0x0800, /* control access flag */ - - fdr_fl1_sec = 0x8000, /* file secured flag */ - - fdr_flg_fu = 0xc000, /* file usage bits */ - fdr_flg_fu_shift = 14, - fdr_flg_fmt = 0x3000, /* file format bits */ - fdr_flg_fmt_shift = 12, - fdr_flg_all = 0x0800, /* extendable file flag */ - fdr_flg_ft = 0x0600, /* file type bits */ - fdr_flg_ft_shift = 9, - fdr_flg_wpb = 0x0100, /* write protect bit */ - fdr_flg_dpb = 0x0080, /* delete protect bit */ - fdr_flg_tmp = 0x0040, /* temporary file flag */ - fdr_flg_blb = 0x0020, /* blocked file flag */ - fdr_flg_ali = 0x0010, /* alias flag bit */ - fdr_flg_fwt = 0x0008, /* forced write / partial logging */ - fdr_flg_cdr = 0x0001 /* record is CDR */ -}; - -/* - ACE subrecord found in FDR -*/ -struct ti990_ace -{ - char agn[8]; /* access group name */ - UINT16BE flg; /* flags */ -}; - -/* - FDR record -*/ -struct ti990_fdr -{ - UINT16BE hkc; /* hask key count: the number of file descriptor records that are present in the directory that hashed to this record number */ - UINT16BE hkv; /* hask key value: the result of the hash algorithm for the file name actually covered in this record */ - char fnm[8]; /* file name */ - UINT8 rsv[2]; /* reserved */ - UINT16BE fl1; /* flags word 1 */ - UINT16BE flg; /* flags word 2 */ - UINT16BE prs; /* physical record size */ - UINT16BE lrs; /* logical record size */ - UINT16BE pas; /* primary allocation size: # of ADUs allocated in primary allocation block? */ - UINT16BE paa; /* primary allocation address: first ADU of primary allocation block? */ - UINT16BE sas; /* secondary allocation size: used to determinate the # of blocks allocated per secondary allocation */ - UINT16BE saa; /* offset of secondary table: ???? "offset into this FDR of the secondary allocation table, if any. No secondary allocation table is denoted by 0. Secondary allocations are present only for unbounded files." */ - UINT16BE rfa; /* record number of first alias */ - UINT32BE eom; /* end of medium record number */ - UINT32BE bkm; /* end of medium block number */ - UINT16BE ofm; /* end of medium offset / */ - /* prelog number for KIF */ - UINT32BE fbq; /* free block queue head */ - UINT16BE btr; /* B-tree roots block # */ - UINT32BE ebq; /* empty block queue head */ - UINT16BE kdr; /* key descriptions record # */ - UINT8 ud[6]; /* last update date */ - UINT8 cd[6]; /* creation date */ - UINT8 apb; /* ADU's per block */ - UINT8 bpa; /* blocks per ADU */ - UINT16BE mrs; /* minimumu KIF record size */ - UINT8 sat[64]; /* secondary allocation table: 16 2-word entries. The first word of an entry contains the size, in ADUs, of the secondary allocation. The second word contains the starting ADU of the allocation. */ - -/* bytes >86 to >100 are optional */ - UINT8 res[10]; /* reserved: seem to be actually meaningful (at least under DX10 3.6.x) */ - char uid[8]; /* user id of file creator */ - UINT16BE psa; /* public security attribute */ - ti990_ace ace[9]; /* 9 access control entries */ - UINT8 fil[2]; /* not used */ -}; - -/* - ADR record: variant of FDR for Aliases - - The fields marked here with *** are in the ADR template to maintain - compatability with the FDR template. -*/ -struct ti990_adr -{ - UINT16BE hkc; /* hask key count */ - UINT16BE hkv; /* hask key value */ - char fnm[8]; /* file name */ - char psw[4]; /* "password" (whatever it means) */ - UINT16BE flg; /* flags (same as fdr.flg) */ - UINT16BE fill00; /* *** physical record size */ - UINT16BE fill01; /* *** logical record size */ - UINT16BE fill02; /* *** primary allocation size */ - UINT16BE fill03; /* *** primary allocation address */ - UINT16BE fill04; /* *** secondary allocation size */ - UINT16BE fill05; /* *** secondary allocation address */ - UINT16BE rna; /* record number of next ADR */ - UINT16BE raf; /* record # of actual FDR (from 1 through dor.nrc) */ -}; - -/* - CDR record: variant of FDR for Channel - - The CDR is the permanent record of a channel. It is carried as an alias - of the program file in which the channel owner task resides. -*/ -struct ti990_cdr -{ - UINT16BE hkc; /* hask key count */ - UINT16BE hkv; /* hask key value */ - char fnm[8]; /* file name */ - UINT16BE fill00; /* reserved */ - UINT16BE fill01; /* reserved */ - UINT16BE fdf; /* flags (same as fdr.flg) */ - UINT8 flg; /* channel flzgs */ - UINT8 iid; /* owner task installed ID */ - UINT8 typ; /* default resource type */ - UINT8 tf; /* resource type flags */ - UINT16BE mxl; /* maximum message length */ - UINT8 fill04[6]; /* reserved (and, no, I don't know where fill02 and fill03 have gone) */ - UINT16BE rna; /* record number of next CDR or ADR */ - UINT16BE raf; /* record # of actual FDR */ - UINT8 fill05[110]; /* reserved */ - char uid[8]; /* user ID of channel creator */ - UINT16BE psa; /* public security attribute */ - UINT8 scg[94]; /* "SDT with 9 control groups" (whatever it means - and, no, 94 is not dividable by 9) */ - UINT8 fill06[8]; /* reserved */ -}; - -/* - Based on contents of the flags field, catalog entries may be either an FDR, - an ADR or a CDR. - - They may be a KDR, too, but confusion is impossible because the KDR FILL00 - field starts at offset 4, and therefore if we try to interpret a KDR as an - FDR (or ADR, CDR), we will find fnm[0] and assume the FDR is empty. -*/ -union directory_entry -{ - ti990_fdr fdr; - ti990_adr adr; - ti990_cdr cdr; -}; - -#if 0 - -/* - tifile header: stand-alone file -*/ -struct tifile_header -{ - char tifiles[8]; /* always '\7TIFILES' */ - UINT8 secsused_MSB; /* file length in sectors (big-endian) */ - UINT8 secsused_LSB; - UINT8 flags; /* see enum above */ - UINT8 recspersec; /* records per sector */ - UINT8 eof; /* current position of eof in last sector (0->255)*/ - UINT8 reclen; /* bytes per record ([1,255] 0->256) */ - UINT8 fixrecs_MSB; /* file length in records (big-endian) */ - UINT8 fixrecs_LSB; - UINT8 res[128-16]; /* reserved */ -}; - - -/* - catalog entry (used for in-memory catalog) -*/ -struct catalog_entry -{ - UINT16 fdr_secnum; - char filename[10]; -}; - -#endif - -/* - Disk geometry -*/ -struct ti990_geometry -{ - unsigned int cylinders, heads, sectors_per_track, bytes_per_sector; -}; - -/* - Physical sector address -*/ -struct ti990_phys_sec_address -{ - int cylinder; - int head; - int sector; -}; - -/* - ti99 disk image descriptor -*/ -struct ti990_image -{ - imgtool_stream *file_handle; /* imgtool file handle */ - ti990_geometry geometry; /* geometry */ - ti990_sc0 sec0; /* cached copy of sector 0 */ -}; - -/* - ti990 catalog iterator, used when imgtool reads the catalog -*/ -struct ti990_iterator -{ - ti990_image *image; - int level; /* current recursion level */ - int nrc[MAX_DIR_LEVEL]; /* length of disk catalogs in records */ - int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */ - directory_entry xdr[MAX_DIR_LEVEL]; /* fdr records */ -}; - - -static imgtoolerr_t ti990_image_init(imgtool_image *img, imgtool_stream *f); -static void ti990_image_exit(imgtool_image *img); -static void ti990_image_info(imgtool_image *img, char *string, size_t len); -static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path); -static imgtoolerr_t ti990_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent); -static void ti990_image_closeenum(imgtool_directory *enumeration); -static imgtoolerr_t ti990_image_freespace(imgtool_partition *partition, UINT64 *size); -#ifdef UNUSED_FUNCTION -static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const char *fpath, imgtool_stream *destf); -static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const char *fpath, imgtool_stream *sourcef, option_resolution *writeoptions); -static imgtoolerr_t ti990_image_deletefile(imgtool_partition *partition, const char *fpath); -#endif -static imgtoolerr_t ti990_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions); - -enum -{ - /*ti990_createopts_volname = 'A',*/ - ti990_createopts_cylinders = 'B', - ti990_createopts_heads = 'C', - ti990_createopts_sectors = 'D', - ti990_createopts_sectorsize = 'E' -}; - -static OPTION_GUIDE_START( ti990_create_optionguide ) - /*OPTION_STRING(ti990_createopts_volname, "label", "Volume name" )*/ - OPTION_INT(ti990_createopts_cylinders, "cylinders", "Cylinders" ) - OPTION_INT(ti990_createopts_heads, "heads", "Heads" ) - OPTION_INT(ti990_createopts_sectors, "sectors", "Sectors" ) - OPTION_INT(ti990_createopts_sectorsize, "bytes per sector (typically 256)", "Bytes Per Sector" ) -OPTION_GUIDE_END - -#define symb2str2(a) #a -#define symb2str(a) symb2str2(a) -#define ti990_create_optionspecs "B1-[145]-" symb2str(MAX_CYLINDERS)";C1-[4]-" symb2str(MAX_HEADS)";D1-[32]-" symb2str(MAX_SECTORS_PER_TRACK)";E" symb2str(MIN_SECTOR_SIZE)"-[256]-" symb2str(MAX_SECTOR_SIZE)";" - -void ti990_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti990hd"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI990 Hard Disk"); break; - case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break; - case IMGTOOLINFO_STR_EOLN: /* strcpy(info->s = imgtool_temp_str(), "\r"); */ break; - - case IMGTOOLINFO_PTR_OPEN: info->open = ti990_image_init; break; - case IMGTOOLINFO_PTR_CLOSE: info->close = ti990_image_exit; break; - case IMGTOOLINFO_PTR_INFO: info->info = ti990_image_info; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = ti990_image_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = ti990_image_nextenum; break; - case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = ti990_image_closeenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = ti990_image_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: /* info->read_file = ti990_image_readfile; */ break; - case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = ti990_image_writefile; */ break; - case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = ti990_image_deletefile; */ break; - case IMGTOOLINFO_PTR_CREATE: info->create = ti990_image_create; break; - - case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = ti990_create_optionguide; break; - case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), ti990_create_optionspecs); break; - } -} - -#ifdef UNUSED_FUNCTION -/* - Convert a C string to a 8-character file name (padded with spaces if necessary) -*/ -static void str_to_fname(char dst[8], const char *src) -{ - int i; - - - i = 0; - - /* copy 8 characters at most */ - if (src) - while ((i<8) && (src[i]!='\0')) - { - dst[i] = src[i]; - i++; - } - - /* pad with spaces */ - while (i<8) - { - dst[i] = ' '; - i++; - } -} -#endif - -/* - Convert a 8-character file name to a C string (removing trailing spaces if necessary) -*/ -static void fname_to_str(char *dst, const char src[8], int n) -{ - int i; - int last_nonspace; - - - /* copy 8 characters at most */ - if (--n > 8) - n = 8; - - /* copy filename */ - i = 0; - last_nonspace = -1; - - while (icylinder*geometry->heads) + address->head)*geometry->sectors_per_track + address->sector)*geometry->bytes_per_sector + header_len; - - return offset; -} - -/* - Read one sector from a disk image - - file_handle: imgtool file handle - address: physical sector address - geometry: disk geometry (sectors per track, tracks per side, sides) - dest: pointer to destination buffer - len: length of data to read -*/ -static int read_sector_physical_len(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest, int len) -{ - int reply; - - if (len > geometry->bytes_per_sector) - return 1; - - /* seek to sector */ - reply = stream_seek(file_handle, phys_address_to_offset(address, geometry), SEEK_SET); - if (reply) - return 1; - /* read it */ - reply = stream_read(file_handle, dest, len); - if (reply != len) - return 1; - - return 0; -} - -#ifdef UNUSED_FUNCTION -/* - Read one sector from a disk image - - file_handle: imgtool file handle - address: physical sector address - geometry: disk geometry (sectors per track, tracks per side, sides) - dest: pointer to a destination buffer of geometry->bytes_per_sector bytes -*/ -static int read_sector_physical(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest) -{ - return read_sector_physical_len(file_handle, address, geometry, dest, geometry->bytes_per_sector); -} -#endif - -/* - Write one sector to a disk image - - file_handle: imgtool file handle - address: physical sector address - geometry: disk geometry (sectors per track, tracks per side, sides) - src: pointer to source buffer - len: length of source buffer -*/ -static int write_sector_physical_len(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src, int len) -{ - int reply; - - if (len > geometry->bytes_per_sector) - return 1; - - /* seek to sector */ - reply = stream_seek(file_handle, phys_address_to_offset(address, geometry), SEEK_SET); - if (reply) - return 1; - /* write it */ - reply = stream_write(file_handle, src, len); - if (reply != len) - return 1; - /* pad with 0s if needed */ - if (len < geometry->bytes_per_sector) - { - reply = stream_fill(file_handle, 0, geometry->bytes_per_sector - len); - - if (reply != geometry->bytes_per_sector - len) - return 1; - } - - return 0; -} - -#ifdef UNUSED_FUNCTION -/* - Write one sector to a disk image - - file_handle: imgtool file handle - address: physical sector address - geometry: disk geometry (sectors per track, tracks per side, sides) - dest: pointer to a source buffer of geometry->bytes_per_sector bytes -*/ -static int write_sector_physical(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src) -{ - return write_sector_physical_len(file_handle, address, geometry, src, geometry->bytes_per_sector); -} -#endif - -/* - Convert logical sector address to physical sector address -*/ -static void log_address_to_phys_address(int secnum, const ti990_geometry *geometry, ti990_phys_sec_address *address) -{ - address->sector = secnum % geometry->sectors_per_track; - secnum /= geometry->sectors_per_track; - address->head = secnum % geometry->heads; - address->cylinder = secnum / geometry->heads; -} - -/* - Read one sector from a disk image - - file_handle: imgtool file handle - secnum: logical sector address - geometry: disk geometry (sectors per track, tracks per side, sides) - dest: pointer to destination buffer - len: length of data to read -*/ -static int read_sector_logical_len(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest, int len) -{ - ti990_phys_sec_address address; - - - log_address_to_phys_address(secnum, geometry, &address); - - return read_sector_physical_len(file_handle, &address, geometry, dest, len); -} - -#ifdef UNUSED_FUNCTION -/* - Read one sector from a disk image - - file_handle: imgtool file handle - secnum: logical sector address - geometry: disk geometry (sectors per track, tracks per side, sides) - dest: pointer to a destination buffer of geometry->bytes_per_sector bytes -*/ -static int read_sector_logical(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest) -{ - return read_sector_logical_len(file_handle, secnum, geometry, dest, geometry->bytes_per_sector); -} -#endif - -/* - Write one sector to a disk image - - file_handle: imgtool file handle - secnum: logical sector address - geometry: disk geometry (sectors per track, tracks per side, sides) - src: pointer to source buffer - len: length of source buffer -*/ -static int write_sector_logical_len(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, const void *src, int len) -{ - ti990_phys_sec_address address; - - - log_address_to_phys_address(secnum, geometry, &address); - - return write_sector_physical_len(file_handle, &address, geometry, src, len); -} - -/* - Write one sector to a disk image - - file_handle: imgtool file handle - secnum: logical sector address - geometry: disk geometry (sectors per track, tracks per side, sides) - dest: pointer to a source buffer of geometry->bytes_per_sector bytes -*/ -static int write_sector_logical(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, const void *src) -{ - return write_sector_logical_len(file_handle, secnum, geometry, src, geometry->bytes_per_sector); -} - -#if 0 -#pragma mark - -#pragma mark CATALOG FILE ROUTINES -#endif - -#ifdef UNUSED_FUNCTION -/* - Find the catalog entry and fdr record associated with a file name - - image: ti990_image image record - fpath: path of the file to search - fdr: pointer to buffer where the fdr record should be stored (may be NULL) - catalog_index: on output, index of file catalog entry (may be NULL) - out_fdr_secnum: on output, sector address of the fdr (may be NULL) - out_parent_fdr_secnum: on output, sector offset of the fdr for the parent - directory fdr (-1 if root) (may be NULL) -*/ -static int find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *catalog_index, int *out_fdr_secnum, int *out_parent_fdr_secnum) -{ - int fdr_secnum = -1, parent_fdr_secnum; - int i; - const char *element_start, *element_end; - int element_len; - char element[8]; - ti990_dor dor; - directory_entry xdr; - int hash_key; - int nrc; - unsigned base; - int reply; - int flag; - - - base = (unsigned) get_UINT16BE(image->sec0.vda) * get_UINT16BE(image->sec0.spa); - - element_start = fpath; - do - { - /* read directory header */ - reply = read_sector_logical_len(image->file_handle, base, & image->geometry, &dor, sizeof(dor)); - if (reply) - return IMGTOOLERR_READERROR; - - nrc = get_UINT16BE(dor.nrc); - - /* find next path element */ - element_end = strchr(element_start, '.'); - element_len = element_end ? (element_end - element_start) : strlen(element_start); - if ((element_len > 8) || (element_len == 0)) - return IMGTOOLERR_BADFILENAME; - /* generate file name and hash key */ - hash_key = 1; - for (i=0; ifile_handle, base + i, & image->geometry, - & xdr, 0x86); - if (reply) - return IMGTOOLERR_READERROR; - if (!memcmp(element, xdr.fdr.fnm, 8)) - { /* found match !!! */ - parent_fdr_secnum = fdr_secnum; - fdr_secnum = base + i; - break; - } - - /* next record */ - if (i != nrc) - i++; - else - i = 1; - - /* exit if we have tested every record */ - if (i == hash_key) - return IMGTOOLERR_FILENOTFOUND; - } - - /* iterate */ - if (element_end) - { - element_start = element_end+1; - /* we need to check that this is a directory */ - /* if it is an alias to a directory, we need to follow it, too. */ - - /* parse flags */ - flag = get_UINT16BE(xdr.fdr.flg); - - if (flag & fdr_flg_ali) - { - /* read original fdr */ - reply = read_sector_logical_len(image->file_handle, base + get_UINT16BE(xdr.adr.raf), - & image->geometry, & xdr, 0x86); - - flag = get_UINT16BE(xdr.fdr.flg); - } - - if (flag & fdr_flg_cdr) - /* This is a channel, not a file */ - return IMGTOOLERR_BADFILENAME; - else if (flag & fdr_flg_ali) - /* WTH??? */ - return IMGTOOLERR_CORRUPTIMAGE; - else if (((flag >> fdr_flg_fu_shift) & 3) != 1) - { - /* This file is not a directory */ - return IMGTOOLERR_BADFILENAME; - } - - /* initialize base */ - base = (unsigned) get_UINT16BE(xdr.fdr.paa) * get_UINT16BE(image->sec0.spa); - } - else - element_start = NULL; - } - while (element_start); - - if (catalog_index) - *catalog_index = i; - - if (out_fdr_secnum) - *out_fdr_secnum = fdr_secnum; - - if (out_parent_fdr_secnum) - *out_parent_fdr_secnum = parent_fdr_secnum; - - return 0; -} -#endif - -#if 0 -/* - Allocate one sector on disk, for use as a fdr record - - image: ti99_image image record - fdr_secnum: on output, logical address of a free sector -*/ -static int alloc_fdr_sector(ti99_image *image, int *fdr_secnum) -{ - int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; - int i; - - - for (i=0; isec0.abm[i >> 3] & (1 << (i & 7)))) - { - *fdr_secnum = i; - image->sec0.abm[i >> 3] |= 1 << (i & 7); - - return 0; - } - } - - return IMGTOOLERR_NOSPACE; -} - -/* - Extend a file with nb_alloc_sectors extra sectors - - image: ti99_image image record - fdr: file fdr record - nb_alloc_sectors: number of sectors to allocate -*/ -static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sectors) -{ - int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; - int free_sectors; - int secsused; - int i; - int lnks_index; - int cur_sec, last_sec, p_last_sec; - int cur_block_len, cur_block_start; - int first_best_block_len, first_best_block_start = 0; - int second_best_block_len, second_best_block_start = 0; - int search_start; - - /* compute free space */ - free_sectors = 0; - for (i=0; isec0.abm[i >> 3] & (1 << (i & 7)))) - free_sectors++; - } - - /* check we have enough free space */ - if (free_sectors < nb_alloc_sectors) - return IMGTOOLERR_NOSPACE; - - /* current number of data sectors in file */ - secsused = get_fdr_secsused(fdr); - - if (secsused == 0) - { /* links array must be empty */ - lnks_index = 0; - } - else - { /* try to extend last block */ - last_sec = -1; - for (lnks_index=0; lnks_index<76; lnks_index++) - { - p_last_sec = last_sec; - last_sec = (fdr->lnks[lnks_index][2] << 4) | (fdr->lnks[lnks_index][1] >> 4); - if (last_sec >= (secsused-1)) - break; - } - if (lnks_index == 76) - /* that sucks */ - return IMGTOOLERR_CORRUPTIMAGE; - - if (last_sec > (secsused-1)) - { /* some extra space has already been allocated */ - cur_block_len = last_sec - (secsused-1); - if (cur_block_len > nb_alloc_sectors) - cur_block_len = nb_alloc_sectors; - - secsused += cur_block_len; - set_fdr_secsused(fdr, secsused); - nb_alloc_sectors -= cur_block_len; - if (! nb_alloc_sectors) - return 0; /* done */ - } - - /* block base */ - cur_sec = ((fdr->lnks[lnks_index][1] & 0xf) << 8) | fdr->lnks[lnks_index][0]; - /* point past block end */ - cur_sec += last_sec-p_last_sec; - /* count free sectors after last block */ - cur_block_len = 0; - for (i=cur_sec; (! (image->sec0.abm[i >> 3] & (1 << (i & 7)))) && (cur_block_len < nb_alloc_sectors) && (i < totsecs); i++) - cur_block_len++; - if (cur_block_len) - { /* extend last block */ - secsused += cur_block_len; - set_fdr_secsused(fdr, secsused); - last_sec += cur_block_len; - nb_alloc_sectors -= cur_block_len; - fdr->lnks[lnks_index][1] = (fdr->lnks[lnks_index][1] & 0x0f) | (last_sec << 4); - fdr->lnks[lnks_index][2] = last_sec >> 4; - for (i=0; isec0.abm[(i+cur_sec) >> 3] |= 1 << ((i+cur_sec) & 7); - if (! nb_alloc_sectors) - return 0; /* done */ - } - lnks_index++; - if (lnks_index == 76) - /* that sucks */ - return IMGTOOLERR_NOSPACE; - } - - search_start = image->data_offset; /* initially, search for free space only in data space */ - while (nb_alloc_sectors) - { - /* find smallest data block at least nb_alloc_sectors in length, and largest data block less than nb_alloc_sectors in length */ - first_best_block_len = INT_MAX; - second_best_block_len = 0; - for (i=search_start; isec0.abm[i >> 3] & (1 << (i & 7)))) - { /* found one free block */ - /* compute its length */ - cur_block_start = i; - cur_block_len = 0; - while ((isec0.abm[i >> 3] & (1 << (i & 7))))) - { - cur_block_len++; - i++; - } - /* compare to previous best and second-best blocks */ - if ((cur_block_len < first_best_block_len) && (cur_block_len >= nb_alloc_sectors)) - { - first_best_block_start = cur_block_start; - first_best_block_len = cur_block_len; - if (cur_block_len == nb_alloc_sectors) - /* no need to search further */ - break; - } - else if ((cur_block_len > second_best_block_len) && (cur_block_len < nb_alloc_sectors)) - { - second_best_block_start = cur_block_start; - second_best_block_len = cur_block_len; - } - } - } - - if (first_best_block_len != INT_MAX) - { /* found one contiguous block which can hold it all */ - secsused += nb_alloc_sectors; - set_fdr_secsused(fdr, secsused); - - fdr->lnks[lnks_index][0] = first_best_block_start; - fdr->lnks[lnks_index][1] = ((first_best_block_start >> 8) & 0x0f) | ((secsused-1) << 4); - fdr->lnks[lnks_index][2] = (secsused-1) >> 4; - for (i=0; isec0.abm[(i+first_best_block_start) >> 3] |= 1 << ((i+first_best_block_start) & 7); - - nb_alloc_sectors = 0; - } - else if (second_best_block_len != 0) - { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */ - secsused += second_best_block_len; - set_fdr_secsused(fdr, secsused); - - fdr->lnks[lnks_index][0] = second_best_block_start; - fdr->lnks[lnks_index][1] = ((second_best_block_start >> 8) & 0x0f) | ((secsused-1) << 4); - fdr->lnks[lnks_index][2] = (secsused-1) >> 4; - for (i=0; isec0.abm[(i+second_best_block_start) >> 3] |= 1 << ((i+second_best_block_start) & 7); - - nb_alloc_sectors -= second_best_block_len; - - lnks_index++; - if (lnks_index == 76) - /* that sucks */ - return IMGTOOLERR_NOSPACE; - } - else if (search_start != 0) - { /* we did not find any free sector in the data section of the disk */ - search_start = 0; /* time to fall back to fdr space */ - } - else - return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */ - } - - return 0; -} - -/* - Allocate a new (empty) file -*/ -static int new_file(ti99_image *image, char filename[10], int *out_fdr_secnum/*, ti99_fdr *fdr,*/) -{ - int fdr_secnum; - int catalog_index, i; - int reply = 0; - - - /* find insertion point in catalog */ - i = 0; - if ((image->catalog[0].fdr_secnum == 0) && (image->catalog[1].fdr_secnum != 0)) - i = 1; /* skip empty entry 0 (it must be a non-listable catalog) */ - - for (; (i<128) && ((fdr_secnum = image->catalog[i].fdr_secnum) != 0) && ((reply = memcmp(image->catalog[i].filename, filename, 10)) < 0); i++) - ; - - if (i == 128) - /* catalog is full */ - return IMGTOOLERR_NOSPACE; - else if (fdr_secnum && (reply == 0)) - /* file already exists */ - return IMGTOOLERR_BADFILENAME; - else - { - catalog_index = i; - reply = alloc_fdr_sector(image, &fdr_secnum); - if (reply) - return reply; - - /* look for first free entry in catalog */ - for (i=catalog_index; image->catalog[i].fdr_secnum != 0; i++) - ; - - if (i == 128) - /* catalog is full */ - return IMGTOOLERR_NOSPACE; - - /* shift catalog entries until the insertion point */ - for (/*i=127*/; i>catalog_index; i--) - image->catalog[i] = image->catalog[i-1]; - - /* write new catalog entry */ - image->catalog[catalog_index].fdr_secnum = fdr_secnum; - memcpy(image->catalog[catalog_index].filename, filename, 10); - if (out_fdr_secnum) - *out_fdr_secnum = fdr_secnum; - } - - return 0; -} - -/* - Compare two (possibly empty) catalog entry for qsort -*/ -static int qsort_catalog_compare(const void *p1, const void *p2) -{ - const catalog_entry *entry1 = p1; - const catalog_entry *entry2 = p2; - - if ((entry1->fdr_secnum == 0) && (entry2->fdr_secnum == 0)) - return 0; - else if (entry1->fdr_secnum == 0) - return +1; - else if (entry2->fdr_secnum == 0) - return -1; - else - return memcmp(entry1->filename, entry2->filename, 10); -} -#endif - -/* - Open a file as a ti990_image. -*/ -static imgtoolerr_t ti990_image_init(imgtool_image *img, imgtool_stream *f) -{ - ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); - disk_image_header header; - int reply; - unsigned totsecs; - - image->file_handle = f; - reply = stream_read(f, &header, sizeof(header)); - if (reply != sizeof(header)) - return IMGTOOLERR_READERROR; - - image->geometry.cylinders = get_UINT32BE(header.cylinders); - image->geometry.heads = get_UINT32BE(header.heads); - image->geometry.sectors_per_track = get_UINT32BE(header.sectors_per_track); - image->geometry.bytes_per_sector = get_UINT32BE(header.bytes_per_sector); - - totsecs = image->geometry.cylinders*image->geometry.heads*image->geometry.sectors_per_track; - - if ((image->geometry.bytes_per_sector < MIN_SECTOR_SIZE) - || (image->geometry.bytes_per_sector > MAX_SECTOR_SIZE) - || (image->geometry.sectors_per_track > MAX_SECTORS_PER_TRACK) - || (image->geometry.heads > MAX_HEADS) - || (image->geometry.cylinders > MAX_CYLINDERS) - || (totsecs < 1) - || (stream_size(f) != header_len + totsecs*image->geometry.bytes_per_sector)) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - - { - ti990_phys_sec_address address = { 0, 0, 0 }; - reply = read_sector_physical_len(f, &address, &image->geometry, & image->sec0, sizeof(image->sec0)); - } - if (reply) - { - return IMGTOOLERR_READERROR; - } - - if ((get_UINT16BE(image->sec0.tna)*get_UINT16BE(image->sec0.spa) > totsecs) - || ((get_UINT16BE(image->sec0.spa) != 1) && (get_UINT16BE(image->sec0.spa) % 3))) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - - if ((get_UINT16BE(image->sec0.vpl) != 0x86) && (get_UINT16BE(image->sec0.vpl) != 0x100)) - { - return IMGTOOLERR_CORRUPTIMAGE; - } - - return IMGTOOLERR_SUCCESS; -} - -/* - close a ti990_image -*/ -static void ti990_image_exit(imgtool_image *img) -{ - ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); - stream_close(image->file_handle); -} - -/* - get basic information on a ti990_image - - Currently returns the volume name -*/ -static void ti990_image_info(imgtool_image *img, char *string, size_t len) -{ - ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); - char vol_name[9]; - - fname_to_str(vol_name, image->sec0.vnm, 9); - - snprintf(string, len, "%s", vol_name); -} - -/* - Open the disk catalog for enumeration -*/ -static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path) -{ - ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(imgtool_directory_image(enumeration)); - ti990_iterator *iter = (ti990_iterator *) imgtool_directory_extrabytes(enumeration); - ti990_dor dor; - int reply; - - iter->image = image; - - reply = read_sector_logical_len(iter->image->file_handle, - (unsigned) get_UINT16BE(iter->image->sec0.vda) * get_UINT16BE(iter->image->sec0.spa), - & iter->image->geometry, &dor, sizeof(dor)); - - if (reply) - return IMGTOOLERR_READERROR; - - iter->level = 0; - iter->nrc[0] = get_UINT16BE(dor.nrc); - iter->index[0] = 0; - - return IMGTOOLERR_SUCCESS; -} - -/* - Enumerate disk catalog next entry -*/ -static imgtoolerr_t ti990_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - ti990_iterator *iter = (ti990_iterator *) imgtool_directory_extrabytes(enumeration); - int flag; - int reply = 0; - - - ent->corrupt = 0; - ent->eof = 0; - - while ((iter->level >= 0) - && (! (reply = read_sector_logical_len(iter->image->file_handle, - iter->level ? (unsigned) get_UINT16BE(iter->xdr[iter->level-1].fdr.paa) * get_UINT16BE(iter->image->sec0.spa) + (iter->index[iter->level]+1) - : (unsigned) get_UINT16BE(iter->image->sec0.vda) * get_UINT16BE(iter->image->sec0.spa) + (iter->index[iter->level]+1), - & iter->image->geometry, &iter->xdr[iter->level], - iter->level ? get_UINT16BE(iter->xdr[iter->level-1].fdr.prs) - : get_UINT16BE(iter->image->sec0.vpl)))) - && (iter->xdr[iter->level].fdr.fnm[0] == 0)) - { - iter->index[iter->level]++; - while (iter->index[iter->level] >= iter->nrc[iter->level]) - iter->level--; - } - - if (iter->level < 0) - { - ent->eof = 1; - } - else if (reply) - return IMGTOOLERR_READERROR; - else - { -#if 0 - fname_to_str(ent->filename, iter->xdr[iter->level].fdr.fnm, ARRAY_LENGTH(ent->filename)); -#else - { - int i; - char buf[9]; - - ent->filename[0] = '\0'; - for (i=0; ilevel; i++) - { - fname_to_str(buf, iter->xdr[i].fdr.fnm, 9); - strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); - strncat(ent->filename, ".", ARRAY_LENGTH(ent->filename) - 1); - } - fname_to_str(buf, iter->xdr[iter->level].fdr.fnm, 9); - strncat(ent->filename, buf, ARRAY_LENGTH(ent->filename) - 1); - } -#endif - - /* parse flags */ - flag = get_UINT16BE(iter->xdr[iter->level].fdr.flg); - if (flag & fdr_flg_cdr) - { - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "CHANNEL"); - - ent->filesize = 0; - } - else if (flag & fdr_flg_ali) - { - ti990_fdr target_fdr; - char buf[9]; - - reply = read_sector_logical_len(iter->image->file_handle, - iter->level ? ((unsigned) get_UINT16BE(iter->xdr[iter->level-1].fdr.paa) * get_UINT16BE(iter->image->sec0.spa) + get_UINT16BE(iter->xdr[iter->level].adr.raf)) - : ((unsigned) get_UINT16BE(iter->image->sec0.vda) * get_UINT16BE(iter->image->sec0.spa) + get_UINT16BE(iter->xdr[iter->level].adr.raf)), - & iter->image->geometry, &target_fdr, - iter->level ? get_UINT16BE(iter->xdr[iter->level-1].fdr.prs) - : get_UINT16BE(iter->image->sec0.vpl)); - - fname_to_str(buf, target_fdr.fnm, 9); - - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "ALIAS OF %s", buf); - - ent->filesize = 0; - } - else - { - const char *fmt, *type; - - switch ((flag >> fdr_flg_fmt_shift) & 3) - { - case 0: - fmt = "NBS"; - break; - case 1: - fmt = "BS "; - break; - default: - fmt = "???"; - break; - } - - switch ((flag >> fdr_flg_fu_shift) & 3) - { - case 1: - type = "DIR"; - break; - case 2: - type = "PRO"; - break; - case 3: - type = "IMG"; - break; - default: - switch ((flag >> fdr_flg_ft_shift) & 3) - { - case 1: - type = "SEQ"; - break; - case 2: - type = "REL"; - break; - case 3: - type = "KIF"; - break; - default: - type = "???"; - break; - } - break; - } - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), - "%s %c %s%s%s%s%s", fmt, (flag & fdr_flg_all) ? 'N' : 'C', type, - (flag & fdr_flg_blb) ? "" : " BLK", - (flag & fdr_flg_tmp) ? " TMP" : "", - (flag & fdr_flg_wpb) ? " WPT" : "", - (flag & fdr_flg_dpb) ? " DPT" : ""); - - /* len in blocks */ - ent->filesize = get_UINT32BE(iter->xdr[iter->level].fdr.bkm); - if ((((flag >> fdr_flg_ft_shift) & 3) == 3) || get_UINT16BE(iter->xdr[iter->level].fdr.ofm)) - ent->filesize++; - - /* convert to ADUs */ - if (iter->xdr[iter->level].fdr.apb > 1) - /* more than one ADU per block */ - ent->filesize *= iter->xdr[iter->level].fdr.apb; - else if (iter->xdr[iter->level].fdr.bpa > 1) - /* more than one block per ADU */ - ent->filesize = (ent->filesize + iter->xdr[iter->level].fdr.bpa - 1) / iter->xdr[iter->level].fdr.bpa; - } - iter->index[iter->level]++; - - if (get_UINT16BE(iter->xdr[iter->level].fdr.saa) != 0) - printf("roupoupou"); - else - { - int i; - for (i=0; i<64; i++) - if (iter->xdr[iter->level].fdr.sat[i]) - { - printf("roupoupou"); - break; - } - } - - /* recurse subdirectory if applicable */ - if ((((flag >> fdr_flg_fu_shift) & 3) == 1) - && (! (flag & fdr_flg_ali)) - && (! (flag & fdr_flg_cdr)) - && (iter->level < MAX_DIR_LEVEL) - && ! ((iter->level == 0) && ! memcmp(iter->xdr[iter->level].fdr.fnm, "VCATALOG", 8))) - { - ti990_dor dor; - - if (get_UINT16BE(iter->xdr[iter->level].fdr.saa) != 0) - printf("ninou"); - - read_sector_logical_len(iter->image->file_handle, - get_UINT16BE(iter->xdr[iter->level].fdr.paa) * get_UINT16BE(iter->image->sec0.spa), - & iter->image->geometry, &dor, sizeof(dor)); - - iter->level++; - iter->nrc[iter->level] = get_UINT16BE(dor.nrc)/*get_UINT32BE(iter->fdr[iter->level-1].eom)-1*/; - iter->index[iter->level] = 0; -#if 0 - if (get_UINT16BE(dor.nrc) != (get_UINT32BE(iter->xdr[iter->level-1].fdr.eom)-1)) - printf("hiha"); -#endif - } - - /* go to upper level if applicable */ - while (iter->index[iter->level] >= iter->nrc[iter->level]) - iter->level--; - } - - return (imgtoolerr_t)0; -} - -/* - Free enumerator -*/ -static void ti990_image_closeenum(imgtool_directory *enumeration) -{ -} - -/* - Compute free space on disk image (in ADUs) -*/ -static imgtoolerr_t ti990_image_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtool_image *img = imgtool_partition_image(partition); - ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); - int totadus = get_UINT16BE(image->sec0.tna); - int adu, record, sub_adu; - char buf[256]; - size_t freeadus = 0; - - if ((totadus+2031)/2032 != image->sec0.tbm) - /*return IMGTOOLERR_CORRUPTIMAGE;*/ - return (imgtoolerr_t)0; - - adu = 0; - record = 0; - sub_adu = 0; - while (adufile_handle, image->sec0.sbm + record, &image->geometry, buf, sizeof(buf)); - - while ((adu < totadus) && (sub_adu < 2032)) - { - if (! (buf[(sub_adu >> 3) + 2] & (1 << (sub_adu & 7)))) - freeadus++; - sub_adu++; - adu++; - } - sub_adu = 0; - record++; - } - - * size = freeadus; - - return IMGTOOLERR_SUCCESS; -} - -#ifdef UNUSED_FUNCTION -/* - Extract a file from a ti990_image. -*/ -static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const char *fpath, imgtool_stream *destf) -{ - imgtool_image *img = imgtool_partition_image(partition); - ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); - int catalog_index, fdr_secnum, parent_fdr_secnum; - imgtoolerr_t reply; - - - reply = find_fdr(image, fpath, &catalog_index, &fdr_secnum, &parent_fdr_secnum); - if (reply) - return reply; - - /* ... */ - - return 0; - -#if 0 - ti99_image *image = (ti99_image*) img; - int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; - char ti_fname[10]; - ti99_fdr fdr; - tifile_header dst_header; - int i, lnks_index; - int cur_sec, last_sec; - int secsused; - UINT8 buf[256]; - int reply; - - str_to_fname(ti_fname, filename); - - reply = find_fdr(image, ti_fname, &fdr, NULL); - if (reply) - return reply; - - dst_header.tifiles[0] = '\7'; - dst_header.tifiles[1] = 'T'; - dst_header.tifiles[2] = 'I'; - dst_header.tifiles[3] = 'F'; - dst_header.tifiles[4] = 'I'; - dst_header.tifiles[5] = 'L'; - dst_header.tifiles[6] = 'E'; - dst_header.tifiles[7] = 'S'; - dst_header.secsused_MSB = fdr.secsused_MSB; - dst_header.secsused_LSB = fdr.secsused_LSB; - dst_header.flags = fdr.flags; - dst_header.recspersec = fdr.recspersec; - dst_header.eof = fdr.eof; - dst_header.reclen = fdr.reclen; - dst_header.fixrecs_MSB = fdr.fixrecs_MSB; - dst_header.fixrecs_LSB = fdr.fixrecs_LSB; - for (i=0; i<(128-14); i++) - dst_header.res[i] = 0; - - if (stream_write(destf, & dst_header, 128) != 128) - return IMGTOOLERR_WRITEERROR; - - - secsused = get_fdr_secsused(&fdr); - - i = 0; /* file logical sector #0 */ - lnks_index = 0; /* start of file block table */ - while (i> 4); - - /* copy current file block */ - while ((i<=last_sec) && (i= totsecs) - return IMGTOOLERR_CORRUPTIMAGE; - - if (read_sector_logical(image->file_handle, cur_sec, & image->geometry, buf)) - return IMGTOOLERR_READERROR; - - if (stream_write(destf, buf, 256) != 256) - return IMGTOOLERR_WRITEERROR; - - i++; - cur_sec++; - } - - /* next entry in file block table */ - lnks_index++; - } - - return 0; -#endif -} - -/* - Add a file to a ti990_image. -*/ -static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const char *fpath, imgtool_stream *sourcef, option_resolution *writeoptions) -{ - imgtool_image *img = imgtool_partition_image(partition); - ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); - int catalog_index, fdr_secnum, parent_fdr_secnum; - imgtoolerr_t reply; - - - /* check that file does not exist */ - reply = find_fdr(image, fpath, &catalog_index, &fdr_secnum, &parent_fdr_secnum); - if ((reply) && (reply != IMGTOOLERR_FILENOTFOUND)) - return reply; - - /* ... */ - - return 0; - -#if 0 - ti99_image *image = (ti99_image*) img; - int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; - char ti_fname[10]; - ti99_fdr fdr; - tifile_header src_header; - int i, lnks_index; - int cur_sec, last_sec; - int secsused; - UINT8 buf[256]; - int reply; - int fdr_secnum; - - str_to_fname(ti_fname, filename); - - reply = find_fdr(image, ti_fname, &fdr, NULL); - if (reply == 0) - { /* file already exists: causes an error for now */ - return IMGTOOLERR_UNEXPECTED; - } - else if (reply != IMGTOOLERR_FILENOTFOUND) - { - return reply; - } - - if (stream_read(sourcef, & src_header, 128) != 128) - return IMGTOOLERR_READERROR; - - /* create new file */ - reply = new_file(image, ti_fname, &fdr_secnum); - if (reply) - return reply; - - memcpy(fdr.name, ti_fname, 10); - fdr.res10[1] = fdr.res10[0] = 0; - fdr.flags = src_header.flags; - fdr.recspersec = src_header.recspersec; - fdr.secsused_MSB = /*src_header.secsused_MSB*/0; - fdr.secsused_LSB = /*src_header.secsused_LSB*/0; - fdr.eof = src_header.eof; - fdr.reclen = src_header.reclen; - fdr.fixrecs_LSB = src_header.fixrecs_LSB; - fdr.fixrecs_MSB = src_header.fixrecs_MSB; - for (i=0; i<8; i++) - fdr.res20[i] = 0; - for (i=0; i<76; i++) - fdr.lnks[i][2] = fdr.lnks[i][1] = fdr.lnks[i][0] = 0; - - /* alloc data sectors */ - secsused = (src_header.secsused_MSB << 8) | src_header.secsused_LSB; - reply = alloc_file_sectors(image, &fdr, secsused); - if (reply) - return reply; - - /* copy data */ - i = 0; - lnks_index = 0; - while (i> 4); - - while ((i= totsecs) - return IMGTOOLERR_CORRUPTIMAGE; - - if (stream_read(sourcef, buf, 256) != 256) - return IMGTOOLERR_READERROR; - - if (write_sector_logical(image->file_handle, cur_sec, & image->geometry, buf)) - return IMGTOOLERR_WRITEERROR; - - i++; - cur_sec++; - } - - lnks_index++; - } - - /* write fdr */ - if (write_sector_logical(image->file_handle, fdr_secnum, & image->geometry, &fdr)) - return IMGTOOLERR_WRITEERROR; - - /* update catalog */ - for (i=0; i<128; i++) - { - buf[2*i] = image->catalog[i].fdr_secnum >> 8; - buf[2*i+1] = image->catalog[i].fdr_secnum & 0xff; - } - if (write_sector_logical(image->file_handle, 1, & image->geometry, buf)) - return IMGTOOLERR_WRITEERROR; - - /* update bitmap */ - if (write_sector_logical(image->file_handle, 0, & image->geometry, &image->sec0)) - return IMGTOOLERR_WRITEERROR; - - return 0; -#endif -} - -/* - Delete a file from a ti990_image. -*/ -static imgtoolerr_t ti990_image_deletefile(imgtool_partition *partition, const char *fpath) -{ - imgtool_image *img = imgtool_partition_image(partition); - ti990_image *image = (ti990_image *) imgtool_image_extra_bytes(img); - int catalog_index, fdr_secnum, parent_fdr_secnum; - imgtoolerr_t reply; - - - reply = find_fdr(image, fpath, &catalog_index, &fdr_secnum, &parent_fdr_secnum); - if (reply) - return reply; - - /* ... */ - - return 0; - -#if 0 - ti99_image *image = (ti99_image*) img; - int totsecs = (image->sec0.totsecsMSB << 8) | image->sec0.totsecsLSB; - char ti_fname[10]; - ti99_fdr fdr; - int i, lnks_index; - int cur_sec, last_sec; - int secsused; - int catalog_index; - int reply; - UINT8 buf[256]; - - str_to_fname(ti_fname, filename); - - reply = find_fdr(image, ti_fname, &fdr, &catalog_index); - if (reply) - return reply; - - /* free data sectors */ - secsused = get_fdr_secsused(&fdr); - - i = 0; - lnks_index = 0; - while (i> 4); - - while ((i= totsecs) - return IMGTOOLERR_CORRUPTIMAGE; - - image->sec0.abm[cur_sec >> 3] &= ~ (1 << (cur_sec & 7)); - - i++; - cur_sec++; - } - - lnks_index++; - } - - /* free fdr sector */ - image->sec0.abm[image->catalog[catalog_index].fdr_secnum >> 3] &= ~ (1 << (image->catalog[catalog_index].fdr_secnum & 7)); - - /* delete catalog entry */ - for (i=catalog_index; i<127; i++) - image->catalog[i] = image->catalog[i+1]; - image->catalog[127].fdr_secnum = 0; - - /* update catalog */ - for (i=0; i<128; i++) - { - buf[2*i] = image->catalog[i].fdr_secnum >> 8; - buf[2*i+1] = image->catalog[i].fdr_secnum & 0xff; - } - if (write_sector_logical(image->file_handle, 1, & image->geometry, buf)) - return IMGTOOLERR_WRITEERROR; - - /* update bitmap */ - if (write_sector_logical(image->file_handle, 0, & image->geometry, &image->sec0)) - return IMGTOOLERR_WRITEERROR; - - return 0; -#endif -} -#endif - -/* - Create a blank ti990_image. -*/ -static imgtoolerr_t ti990_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions) -{ - //const char *volname; - ti990_geometry geometry; - unsigned totsecs; - disk_image_header header; - ti990_sc0 sec0; - UINT8 empty_sec[MAX_SECTOR_SIZE]; - int reply; - int i; - - /* read options */ - //volname = option_resolution_lookup_string(createoptions, ti990_createopts_volname); - geometry.cylinders = option_resolution_lookup_int(createoptions, ti990_createopts_cylinders); - geometry.heads = option_resolution_lookup_int(createoptions, ti990_createopts_heads); - geometry.sectors_per_track = option_resolution_lookup_int(createoptions, ti990_createopts_sectors); - geometry.bytes_per_sector = option_resolution_lookup_int(createoptions, ti990_createopts_sectorsize); - - totsecs = geometry.cylinders * geometry.heads * geometry.sectors_per_track; - - /* write header */ - set_UINT32BE(& header.cylinders, geometry.cylinders); - set_UINT32BE(& header.heads, geometry.heads); - set_UINT32BE(& header.sectors_per_track, geometry.sectors_per_track); - set_UINT32BE(& header.bytes_per_sector, geometry.bytes_per_sector); - - reply = stream_write(f, &header, sizeof(header)); - if (reply != sizeof(header)) - { - return IMGTOOLERR_WRITEERROR; - } - - - /* initialize sector 0 */ - /* mark disk as uninitialized */ - set_UINT16BE(& sec0.sta, 2); - - - /* write sector 0 */ - if (write_sector_logical(f, 0, & geometry, &sec0)) - return IMGTOOLERR_WRITEERROR; - - - /* now clear every other sector, including catalog */ - memset(empty_sec, 0, geometry.bytes_per_sector); - - for (i=1; i -#include -#include -#include -#include "imgtool.h" -#include "formats/imageutl.h" -#include "formats/vt_dsk.h" -#include "iflopimg.h" - -/* - -sector format - -| GAP1 | IDAM | GAP2 | DATA | CHECKSUM | ... - -GAP1 = 80 80 80 80 80 00 6 -IDAM = FE E7 18 C3 Track# Sector# Checksum-8 of prev. 2 bytes 7 -GAP2 = 80 80 80 80 80 80 00 C3 18 E7 FE 11 -DATA = 126 bytes actual data 126 - = nextTrack# nextSector# 2 -CHECKSUM = Checksum-16 of the previous 128 bytes 2 - --- - 154 bytes - -sectors 0 to 14 are used for the disk directory. sector 15 is used -as track map, with one bit for each sector used. - -*/ - -#define DATA_SIZE (126) -#define SECTOR_SIZE (0x9b) -#define MAX_DIRENTS (15*8) - -/* vzdos directry entry */ -struct vzdos_dirent -{ - char ftype; - char delimitor; - char fname[8]; - UINT8 start_track; - UINT8 start_sector; - UINT16 start_address; - UINT16 end_address; -}; - -struct vz_iterator -{ - int index; - int eof; -}; - -static const UINT8 sector_order[] = -{ - 0, 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13 -}; - -/********************************************************************* - Internal functions -*********************************************************************/ - -/* get length of filename without trailing spaces */ -static int vzdos_get_fname_len(const char *fname) -{ - int len; - - for (len = 7; len > 0; len--) - if (fname[len] != 0x20) - break; - - return len; -} - -/* calculate checksum-16 of buffer */ -static UINT16 chksum16(UINT8 *buffer, int len) -{ - int i; - UINT16 sum = 0; - - for (i = 0; i < len; i++) - sum += buffer[i]; - - return sum; -} - -/* returns the offset where the actual sector data starts */ -static imgtoolerr_t vzdos_get_data_start(imgtool_image *img, int track, int sector, int *start) -{ - imgtoolerr_t ret; - UINT8 buffer[25]; /* enough to read the sector header */ - - ret = (imgtoolerr_t)floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], 0, &buffer, sizeof(buffer)); - if (ret) return ret; - - /* search for start of data */ - if (memcmp(buffer + 19, "\xC3\x18\xE7\xFE", 4) == 0) - *start = 23; - else if (memcmp(buffer + 20, "\xC3\x18\xE7\xFE", 4) == 0) - *start = 24; - else if (memcmp(buffer + 21, "\xC3\x18\xE7\xFE", 4) == 0) - *start = 25; - else - return IMGTOOLERR_CORRUPTIMAGE; - - return IMGTOOLERR_SUCCESS; -} - -/* return the actual data of a sector */ -static imgtoolerr_t vzdos_read_sector_data(imgtool_image *img, int track, int sector, UINT8 *data) -{ - int ret, data_start; - UINT8 buffer[DATA_SIZE + 4]; /* data + checksum */ - - ret = vzdos_get_data_start(img, track, sector, &data_start); - if (ret) return (imgtoolerr_t)ret; - - ret = floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], data_start, &buffer, sizeof(buffer)); - if (ret) return (imgtoolerr_t)ret; - - /* verify sector checksums */ - if (pick_integer_le(buffer, DATA_SIZE + 2, 2) != chksum16(buffer, DATA_SIZE + 2)) - return IMGTOOLERR_CORRUPTFILE; - - memcpy(data, &buffer, DATA_SIZE + 2); - - return IMGTOOLERR_SUCCESS; -} - -/* write data to sector */ -static imgtoolerr_t vzdos_write_sector_data(imgtool_image *img, int track, int sector, UINT8 *data) -{ - int ret, data_start; - UINT8 buffer[DATA_SIZE + 4]; /* data + checksum */ - - ret = vzdos_get_data_start(img, track, sector, &data_start); - if (ret) return (imgtoolerr_t)ret; - - memcpy(buffer, data, DATA_SIZE + 2); - place_integer_le(buffer, DATA_SIZE + 2, 2, chksum16(data, DATA_SIZE + 2)); - - ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], data_start, buffer, sizeof(buffer), 0); /* TODO: pass ddam argument from imgtool */ - if (ret) return (imgtoolerr_t)ret; - - return IMGTOOLERR_SUCCESS; -} - -/* write formatted empty sector */ -static imgtoolerr_t vzdos_clear_sector(imgtool_image *img, int track, int sector) -{ - UINT8 data[DATA_SIZE + 2]; - - memset(data, 0x00, sizeof(data)); - - return vzdos_write_sector_data(img, track, sector, data); -} - -/* return a directory entry for an index */ -static imgtoolerr_t vzdos_get_dirent(imgtool_image *img, int index, vzdos_dirent *ent) -{ - int ret, entry; - UINT8 buffer[DATA_SIZE + 2]; - - ret = vzdos_read_sector_data(img, 0, (int) index / 8, buffer); - if (ret) return (imgtoolerr_t)ret; - - entry = ((index % 8) * sizeof(vzdos_dirent)); - - memcpy(ent, &buffer[entry], 10); - ent->start_track = pick_integer_le(&buffer[entry], 10, 1); - ent->start_sector = pick_integer_le(&buffer[entry], 11, 1); - ent->start_address = pick_integer_le(&buffer[entry], 12, 2); - ent->end_address = pick_integer_le(&buffer[entry], 14, 2); - - if (ent->ftype == 0x00) - return IMGTOOLERR_FILENOTFOUND; - - /* check values */ - if (ent->start_track > 39) - return IMGTOOLERR_CORRUPTFILE; - - if (ent->start_sector > 15) - return IMGTOOLERR_CORRUPTFILE; - - return IMGTOOLERR_SUCCESS; -} - -/* save a directory entry to disk */ -static imgtoolerr_t vzdos_set_dirent(imgtool_image *img, int index, vzdos_dirent ent) -{ - int ret, entry; - UINT8 buffer[DATA_SIZE + 2]; - - /* read current sector with entries */ - ret = vzdos_read_sector_data(img, 0, (int) index / 8, buffer); - if (ret) return (imgtoolerr_t)ret; - - entry = ((index % 8) * sizeof(vzdos_dirent)); - - memcpy(&buffer[entry], &ent, 10); - place_integer_le(buffer, entry + 10, 1, ent.start_track); - place_integer_le(buffer, entry + 11, 1, ent.start_sector); - place_integer_le(buffer, entry + 12, 2, ent.start_address); - place_integer_le(buffer, entry + 14, 2, ent.end_address); - - /* save new sector */ - ret = vzdos_write_sector_data(img, 0, (int) index / 8, buffer); - if (ret) return (imgtoolerr_t)ret; - - return IMGTOOLERR_SUCCESS; -} - -/* clear a directory entry */ -static imgtoolerr_t vzdos_clear_dirent(imgtool_image *img, int index) -{ - int ret; - vzdos_dirent entry; - - memset(&entry, 0x00, sizeof(vzdos_dirent)); - - ret = vzdos_set_dirent(img, index, entry); - if (ret) return (imgtoolerr_t)ret; - - return IMGTOOLERR_SUCCESS; -} - -/* search the index for a directory entry */ -static imgtoolerr_t vzdos_searchentry(imgtool_image *image, const char *fname, int *entry) { - int i, len, ret; - vzdos_dirent ent; - char filename[9]; - - /* check for invalid filenames */ - if (strlen(fname) > 8) - return IMGTOOLERR_BADFILENAME; - - /* TODO: check for invalid characters */ - - *entry = -1; - - for (i = 0; i < MAX_DIRENTS; i++) { - ret = vzdos_get_dirent(image, i, &ent); - if (ret) return (imgtoolerr_t)ret; - - len = vzdos_get_fname_len(ent.fname) + 1; - - if (strlen(fname) != len) - continue; - - memset(filename, 0x00, sizeof(filename)); - memcpy(filename, ent.fname, len); - - if (!core_stricmp(fname, filename)) { - *entry = i; - break; - } - - } - - if (*entry == -1) - return IMGTOOLERR_FILENOTFOUND; - - return IMGTOOLERR_SUCCESS; -} - -/* return a directory entry for a filename */ -static imgtoolerr_t vzdos_get_dirent_fname(imgtool_image *img, const char *fname, vzdos_dirent *ent) -{ - int ret, index; - - ret = vzdos_searchentry(img, fname, &index); - if (ret) return (imgtoolerr_t)ret; - - ret = vzdos_get_dirent(img, index, ent); - if (ret) return (imgtoolerr_t)ret; - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t vzdos_toggle_trackmap(imgtool_image *img, int track, int sector, int clear) -{ - int ret, value, bit; - UINT8 buffer[DATA_SIZE + 2]; - - /* get trackmap from image */ - ret = vzdos_read_sector_data(img, 0, 15, buffer); - if (ret) return (imgtoolerr_t)ret; - - value = (int) (floor(((double)track * 16 + sector) / 8) - 1); - bit = 0x01 << ((track * 16 + sector) % 8); - - if (clear) - buffer[value-1] &= ~bit; - else - buffer[value-1] |= bit; - - ret = vzdos_write_sector_data(img, 0, 15, buffer); - if (ret) return (imgtoolerr_t)ret; - - return IMGTOOLERR_SUCCESS; -} - -/* clear a trackmap entry */ -static imgtoolerr_t vzdos_clear_trackmap(imgtool_image *img, int track, int sector) -{ - return vzdos_toggle_trackmap(img, track, sector, 1); -} - -/* enable a trackmap entry */ -static imgtoolerr_t vzdos_set_trackmap(imgtool_image *img, int track, int sector) -{ - return vzdos_toggle_trackmap(img, track, sector, 0); -} - -/* return the status of a trackmap entry */ -static imgtoolerr_t vzdos_get_trackmap(imgtool_image *img, int track, int sector, int *used) -{ - int ret, value, bit; - UINT8 buffer[DATA_SIZE + 2]; - - /* get trackmap from image */ - ret = vzdos_read_sector_data(img, 0, 15, buffer); - if (ret) return (imgtoolerr_t)ret; - - value = (int) (floor(((double)track * 16 + sector) / 8) - 1); - bit = 0x01 << ((track * 16 + sector) % 8); - - if (buffer[value-1] & bit) - *used = 1; - else - *used = 0; - - return IMGTOOLERR_SUCCESS; -} - -/* return the next free sector */ -static imgtoolerr_t vzdos_free_trackmap(imgtool_image *img, int *track, int *sector) -{ - int ret, used = 0; - - for (*track = 1; *track < 40; (*track)++) { - for (*sector = 0; *sector < 16; (*sector)++) { - ret = vzdos_get_trackmap(img, *track, *sector, &used); - if (ret) return (imgtoolerr_t)ret; - if (!used) return IMGTOOLERR_SUCCESS; - } - } - - return IMGTOOLERR_NOSPACE; -} - -static imgtoolerr_t vzdos_write_formatted_sector(imgtool_image *img, int track, int sector) -{ - int ret; - UINT8 sector_data[DATA_SIZE + 4 + 24]; - - static const UINT8 sector_header[24] = { - 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0xFE, 0xE7, - 0x18, 0xC3, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, - 0x80, 0x80, 0x80, 0x00, 0xC3, 0x18, 0xE7, 0xFE - }; - - memset(sector_data, 0x00, sizeof(sector_data)); - memcpy(sector_data, sector_header, sizeof(sector_header)); - - sector_data[10] = (UINT8) track; /* current track */ - sector_data[11] = (UINT8) sector; /* current sector */ - sector_data[12] = (UINT8) track + sector; /* checksum-8 */ - - ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], 0, sector_data, sizeof(sector_data), 0); /* TODO: pass ddam argument from imgtool */ - if (ret) return (imgtoolerr_t)ret; - - return IMGTOOLERR_SUCCESS; -} - -/********************************************************************* - Imgtool module code -*********************************************************************/ - -static imgtoolerr_t vzdos_diskimage_beginenum(imgtool_directory *enumeration, const char *path) -{ - vz_iterator *iter; - - iter = (vz_iterator *) imgtool_directory_extrabytes(enumeration); - if (!iter) return IMGTOOLERR_OUTOFMEMORY; - - iter->index = 1; - iter->eof = 0; - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t vzdos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) -{ - vz_iterator *iter = (vz_iterator *) imgtool_directory_extrabytes(enumeration); - - if (iter->eof == 1 || iter->index > MAX_DIRENTS) { - ent->eof = 1; - - } else { - const char *type; - int ret, len; - vzdos_dirent dirent; - - ret = vzdos_get_dirent(imgtool_directory_image(enumeration), iter->index - 1, &dirent); - - if (ret == IMGTOOLERR_FILENOTFOUND) - { - iter->eof = 1; - ent->eof = 1; - return IMGTOOLERR_SUCCESS; - } - - if (ret == IMGTOOLERR_CORRUPTFILE) - ent->corrupt = 1; - - /* kill trailing spaces */ - for (len = 7; len > 0; len--) { - if (dirent.fname[len] != 0x20) { - break; - } - } - - memcpy(ent->filename, &dirent.fname, len + 1); - ent->filesize = dirent.end_address - dirent.start_address; - - switch (dirent.ftype) - { - case 0x01: type = "Deleted"; break; - case 'T': type = "Basic"; break; - case 'B': type = "Binary"; break; - case 'D': type = "Data"; break; - case 'F': type = "Quickwrite"; break; - case 'A': type = "Assembler"; break; - case 'S': type = "Diskops"; break; - case 'W': type = "Wordpro"; break; - default: type = "Unknown"; - } - - snprintf(ent->attr, ARRAY_LENGTH(ent->attr), "%s", type); - - iter->index++; - } - - return IMGTOOLERR_SUCCESS; -} - -/* TRK 0 sector 15 is used to hold the track map of the disk with one bit - corresponding to a sector used. */ -static imgtoolerr_t vzdos_diskimage_freespace(imgtool_partition *partition, UINT64 *size) -{ - imgtoolerr_t ret; - int i; - imgtool_image *image = imgtool_partition_image(partition); - UINT8 c, v, buffer[DATA_SIZE + 2]; - *size = 0; - - ret = vzdos_read_sector_data(image, 0, 15, buffer); - if (ret) return ret; - - for (i = 0; i < DATA_SIZE; i++) { - v = buffer[i]; - for (c = 0; v; c++) { - v &= v - 1; - } - *size += c * DATA_SIZE; - } - *size = (DATA_SIZE * 16 * 39) - *size; - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t vzdos_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t ret; - imgtool_image *image = imgtool_partition_image(partition); - int filesize, track, sector; - vzdos_dirent ent; - UINT8 buffer[DATA_SIZE + 2]; - - ret = vzdos_get_dirent_fname(image, filename, &ent); - if (ret) return ret; - - filesize = ent.end_address - ent.start_address; - track = ent.start_track; - sector = ent.start_sector; - - while (filesize > 0) { - int towrite; - - ret = vzdos_read_sector_data(image, track, sector, buffer); - if (ret) return ret; - - /* detect sectors pointing to themselfs */ - if ((track == (int)pick_integer_le(buffer, DATA_SIZE, 1)) && (sector == (int)pick_integer_le(buffer, DATA_SIZE + 1, 1))) - return IMGTOOLERR_CORRUPTIMAGE; - - /* load next track and sector values */ - track = pick_integer_le(buffer, DATA_SIZE, 1); - sector = pick_integer_le(buffer, DATA_SIZE + 1, 1); - - /* track 0 is invalid */ - if ((track == 0) && (filesize > DATA_SIZE)) - return IMGTOOLERR_CORRUPTIMAGE; - - /* write either DATA_SIZE or the remaining bytes */ - towrite = filesize > DATA_SIZE ? DATA_SIZE : filesize; - - if (stream_write(destf, buffer, towrite) != towrite) - return IMGTOOLERR_WRITEERROR; - - filesize -= DATA_SIZE; - } - - return IMGTOOLERR_SUCCESS; -} - -/* deletes directory entry, clears trackmap entries and sectors */ -static imgtoolerr_t vzdos_diskimage_deletefile(imgtool_partition *partition, const char *fname) -{ - imgtoolerr_t ret; - imgtool_image *img = imgtool_partition_image(partition); - int index, filesize, track, sector, next_track, next_sector; - vzdos_dirent entry, next_entry; - UINT8 buffer[DATA_SIZE + 2]; - - ret = vzdos_get_dirent_fname(img, fname, &entry); - if (ret) return ret; - - ret = (imgtoolerr_t)floppy_read_sector(imgtool_floppy(img), 0, entry.start_track, sector_order[entry.start_sector], 24, &buffer, DATA_SIZE + 2); - if (ret) return ret; - - filesize = entry.end_address - entry.start_address; - track = entry.start_track; - sector = entry.start_sector; - - /* delete directory entry */ - ret = vzdos_searchentry(img, fname, &index); - if (ret) return ret; - - ret = vzdos_get_dirent(img, index + 1, &next_entry); - - if (ret == IMGTOOLERR_FILENOTFOUND) { - /* we are the last directory entry, just delete it */ - ret = vzdos_clear_dirent(img, index); - if (ret) return ret; - - } else if (ret) { - /* an error occurred */ - return ret; - - } else { - ret = vzdos_set_dirent(img, index++, next_entry); - if (ret) return ret; - - while ((ret = vzdos_get_dirent(img, index + 1, &next_entry)) != IMGTOOLERR_FILENOTFOUND) { - if (ret) return ret; - ret = vzdos_set_dirent(img, index++, next_entry); - if (ret) return ret; - } - - ret = vzdos_clear_dirent(img, index); - if (ret) return ret; - - } - - /* clear sectors and trackmap entries */ - while (filesize > 0) { - filesize -= DATA_SIZE; - - /* clear trackmap entry */ - ret = vzdos_clear_trackmap(img, track, sector); - if (ret) return ret; - - /* load next track and sector values */ - next_track = pick_integer_le(buffer, DATA_SIZE, 1); - next_sector = pick_integer_le(buffer, DATA_SIZE + 1, 1); - - /* overwrite sector with default values */ - ret = vzdos_clear_sector(img, track, sector); - if (ret) return ret; - - /* read next sector */ - track = next_track; - sector = next_sector; - - if (filesize > 0) { - ret = (imgtoolerr_t)floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], 24, &buffer, DATA_SIZE + 2); - if (ret) return ret; - } - - } - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t vzdos_writefile(imgtool_partition *partition, int offset, imgtool_stream *sourcef, vzdos_dirent *entry) -{ - imgtoolerr_t ret; - imgtool_image *img = imgtool_partition_image(partition); - int index, track, sector, toread, next_track, next_sector; - vzdos_dirent temp_entry; - UINT64 filesize = 0, freespace = 0; - UINT8 buffer[DATA_SIZE + 2]; - char filename[9]; - - /* is the image writeable? */ - if (floppy_is_read_only(imgtool_floppy(img))) - return IMGTOOLERR_READONLY; - - /* check for already existing filename -> overwrite */ - strcpy(filename, entry->fname); - filename[vzdos_get_fname_len(entry->fname) + 1] = 0x00; - ret = vzdos_get_dirent_fname(img, filename, &temp_entry); - if (!ret) { - /* file already exists, delete it */ - ret = vzdos_diskimage_deletefile(partition, filename); - if (ret) return ret; - } else if (ret != IMGTOOLERR_FILENOTFOUND) { - /* another error occurred, return it */ - return ret; - } - - ret = (imgtoolerr_t)stream_seek(sourcef, offset, SEEK_SET); - if (ret) return ret; - - /* check if there is enough space */ - filesize = stream_size(sourcef) - offset; - - ret = vzdos_diskimage_freespace(partition, &freespace); - if (ret) return ret; - - if (filesize > freespace) - return IMGTOOLERR_NOSPACE; - - /* get next free track and sector */ - ret = vzdos_free_trackmap(img, &track, §or); - if (ret) return ret; - - entry->end_address = entry->start_address + (unsigned int) filesize; - entry->start_track = track; - entry->start_sector = sector; - - /* search for next free directory entry */ - for (index = 0; index < MAX_DIRENTS; index++) { - ret = vzdos_get_dirent(img, index, &temp_entry); - if (ret == IMGTOOLERR_FILENOTFOUND) - break; - else if (ret) - return (ret); - } - - /* write directory entry to disk */ - ret = vzdos_set_dirent(img, index, *entry); - if (ret) return ret; - - next_track = 0; - next_sector = 0; - - /* write data to disk */ - while (filesize > 0) { - toread = filesize > DATA_SIZE ? DATA_SIZE : filesize; - stream_read(sourcef, buffer, toread); - - filesize -= toread; - - /* mark sector as used */ - ret = vzdos_set_trackmap(img, track, sector); - if (ret) return ret; - - /* get track and sector for next sector */ - if (filesize > 0) { - ret = vzdos_free_trackmap(img, &next_track, &next_sector); - if (ret) return ret; - } else { - next_track = 0; - next_sector = 0; - } - buffer[DATA_SIZE] = next_track; - buffer[DATA_SIZE + 1] = next_sector; - - /* write sector to disk */ - ret = vzdos_write_sector_data(img, track, sector, buffer); - if (ret) return ret; - - track = next_track; - sector = next_sector; - } - - return IMGTOOLERR_SUCCESS; - -} - -/* create a new file or overwrite a file */ -static imgtoolerr_t vzdos_diskimage_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtoolerr_t ret; - int ftype; - vzdos_dirent entry; - - /* TODO: check for leading spaces and strip */ - if (strlen(filename) > 8 || strlen(filename) < 1) - return IMGTOOLERR_BADFILENAME; - - /* prepare directory entry */ - ftype = option_resolution_lookup_int(opts, 'T'); - - switch (ftype) { - case 0: - entry.ftype = 'T'; - entry.start_address = 31465; - break; - case 1: - entry.ftype = 'B'; - entry.start_address = 31465; /* ??? */ - break; - case 2: - entry.ftype = 'D'; - entry.start_address = 31465; /* ??? */ - break; - default: - break; - } - - entry.delimitor = ':'; - memset(&entry.fname, 0x20, 8); /* pad with spaces */ - memcpy(&entry.fname, filename, strlen(filename)); - - /* write file to disk */ - ret = vzdos_writefile(partition, 0, sourcef, &entry); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t vzdos_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length) -{ - imgtoolerr_t ret; - imgtool_image *image = imgtool_partition_image(partition); - vzdos_dirent entry; - - if (fname) { - ret = vzdos_get_dirent_fname(image, fname, &entry); - if (ret) return ret; - - switch (entry.ftype) { - case 'B': - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = filter_vzsnapshot_getinfo; - suggestions[0].description = "VZ Snapshot"; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = NULL; - suggestions[1].description = "Raw"; - break; - case 'T': - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = filter_vzsnapshot_getinfo; - suggestions[0].description = "VZ Snapshot"; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = NULL; - suggestions[1].description = "Raw"; - suggestions[2].viability = SUGGESTION_POSSIBLE; - suggestions[2].filter = filter_vzbas_getinfo; - suggestions[2].description = "Tokenized Basic"; - break; - default: - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = NULL; - suggestions[0].description = "Raw"; - } - - } else { - suggestions[0].viability = SUGGESTION_RECOMMENDED; - suggestions[0].filter = NULL; - suggestions[0].description = "Raw"; - suggestions[1].viability = SUGGESTION_POSSIBLE; - suggestions[1].filter = filter_vzsnapshot_getinfo; - suggestions[1].description = "VZ Snapshot"; - } - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t vzdos_diskimage_create(imgtool_image *img, imgtool_stream *stream, option_resolution *opts) -{ - imgtoolerr_t ret; - int track, sector; - - for (track = 0; track < 40; track++) { - for (sector = 0; sector < 16; sector++) { - ret = vzdos_write_formatted_sector(img, track, sector); - if (ret) return ret; - } - } - - return IMGTOOLERR_SUCCESS; -} - -/********************************************************************* - Imgtool vz filter code -*********************************************************************/ - -static imgtoolerr_t vzsnapshot_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) -{ - imgtoolerr_t ret; - imgtool_image *image = imgtool_partition_image(partition); - vzdos_dirent entry; - UINT8 header[24]; - - /* get directory entry from disk */ - ret = vzdos_get_dirent_fname(image, filename, &entry); - if (ret) return ret; - - /* prepare header */ - header[0] = 'V'; - header[1] = 'Z'; - header[2] = 'F'; - - switch (entry.ftype) { - case 'B': - header[3] = '1'; - header[21] = 0xF1; - break; - case 'T': - header[3] = '0'; - header[21] = 0xF0; - break; - default: - memset(header, 0x00, 4); - header[21] = 0x00; - } - - memset(header + 4, 0x00, 17); - memcpy(header + 4, entry.fname, vzdos_get_fname_len(entry.fname) + 1); - place_integer_le(header, 22, 2, entry.start_address); - - /* write header to file */ - stream_write(destf, header, sizeof(header)); - - /* write data to file */ - ret = vzdos_diskimage_readfile(partition, filename, "", destf); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - -static imgtoolerr_t vzsnapshot_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts) -{ - imgtoolerr_t ret; - int fnameopt; - vzdos_dirent entry; - UINT8 header[24]; - - /* get header infos from file */ - stream_read(sourcef, header, sizeof(header)); - - /* prepare directory entry */ - entry.ftype = header[21] == 0xF1 ? 'B' : 'T'; - entry.delimitor = ':'; - entry.start_address = pick_integer_le(header, 22, 2); - - /* filename from header or directly? */ - fnameopt = option_resolution_lookup_int(opts, 'F'); - - if (fnameopt == 0) { - memcpy(&entry.fname, &header[4], 8); - } else { - /* TODO: check for leading spaces and strip */ - if (strlen(filename) > 8 || strlen(filename) < 1) - return IMGTOOLERR_BADFILENAME; - - memcpy(&entry.fname, filename, strlen(filename) - 3); - } - - /* write file to disk */ - ret = vzdos_writefile(partition, 24, sourcef, &entry); - if (ret) return ret; - - return IMGTOOLERR_SUCCESS; -} - -void filter_vzsnapshot_getinfo(UINT32 state, union filterinfo *info) -{ - switch(state) - { - case FILTINFO_STR_NAME: info->s = "vzsnapshot"; break; - case FILTINFO_STR_HUMANNAME: info->s = "VZ Snapshot"; break; - case FILTINFO_STR_EXTENSION: info->s = "vz"; break; - case FILTINFO_PTR_READFILE: info->read_file = vzsnapshot_readfile; break; - case FILTINFO_PTR_WRITEFILE: info->write_file = vzsnapshot_writefile; break; - } -} - -/********************************************************************* - Imgtool module declaration -*********************************************************************/ - -static OPTION_GUIDE_START(vzdos_writefile_optionguide) - OPTION_ENUM_START( 'T', "ftype", "File type" ) - OPTION_ENUM( 0, "basic", "Basic" ) - OPTION_ENUM( 1, "binary", "Binary" ) - OPTION_ENUM( 2, "data", "Data" ) - OPTION_ENUM_END - OPTION_ENUM_START( 'F', "fname", "Filename" ) - OPTION_ENUM( 0, "intern", "Filename from VZ-Header" ) - OPTION_ENUM( 1, "extern", "Actual filename" ) - OPTION_ENUM_END -OPTION_GUIDE_END - -/* -T Basic Editor File -B Binary File -D Sequential Access Program Data File -F Quickwrite Document -A Russell Harrison's Edit Ass. File -S Dave Mitchell/Mark Hardwood Edit Ass. File Start Addr A280H -S Quickwrite/Diskops System File/Label Except Above -W Edit Ass. with Diskops File Start Addr A813H -W E & F Word Pro with Patch 3.3 File End Addr D000H -W Russell Harrison Word Pro File Except above two -*/ - -void vzdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) -{ - switch(state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break; - case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(vz_iterator); break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "vzdos"); break; - case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "VZ-DOS format"); break; - case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break; - case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T[0]-2;F[0]-1"); break; - case IMGTOOLINFO_STR_EOLN: info->s = NULL; break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break; - case IMGTOOLINFO_PTR_OPEN: info->open = NULL; break; - case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = vzdos_diskimage_beginenum; break; - case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = vzdos_diskimage_nextenum; break; - case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = vzdos_diskimage_freespace; break; - case IMGTOOLINFO_PTR_READ_FILE: info->read_file = vzdos_diskimage_readfile; break; - case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = vzdos_diskimage_writefile; break; - case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = vzdos_diskimage_deletefile; break; - case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = vzdos_diskimage_create; break; - case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = vzdos_writefile_optionguide; break; - case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = vzdos_diskimage_suggesttransfer; break; - case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_vz; break; - } -} diff --git a/src/mess/tools/imgtool/stream.c b/src/mess/tools/imgtool/stream.c deleted file mode 100644 index 5c9cf4050c6..00000000000 --- a/src/mess/tools/imgtool/stream.c +++ /dev/null @@ -1,536 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - stream.c - - Code for implementing Imgtool streams - -***************************************************************************/ - -#include -#include -#include - -#include "unzip.h" -#include "osdcore.h" -#include "imgtool.h" - -enum imgtype_t -{ - IMG_FILE, - IMG_MEM -}; - -struct imgtool_stream -{ - imgtype_t imgtype; - int write_protect; - const char *name; // needed for clear - UINT64 position; - UINT64 filesize; - - union - { - core_file *file; - UINT8 *buffer; - } u; -}; - - - -static imgtool_stream *stream_open_zip(const char *zipname, const char *subname, int read_or_write) -{ - imgtool_stream *imgfile = NULL; -// zip_error ziperr; - zip_file *z = NULL; - const zip_file_header *zipent; - FILE *f; - - if (read_or_write) - goto error; - - /* check to see if the file exists */ - f = fopen(zipname, "r"); - if (!f) - goto error; - fclose(f); - - imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); - if (!imgfile) - goto error; - - memset(imgfile, 0, sizeof(*imgfile)); - imgfile->imgtype = IMG_MEM; - imgfile->write_protect = 1; - imgfile->position = 0; - -// ziperr = - zip_file_open(zipname, &z); - if (!z) - goto error; - - zipent = zip_file_first_file(z); - while(zipent && subname && strcmp(subname, zipent->filename)) - zipent = zip_file_next_file(z); - if (!zipent) - goto error; - - imgfile->filesize = zipent->uncompressed_length; - imgfile->u.buffer = (UINT8*)malloc(zipent->uncompressed_length); - if (!imgfile->u.buffer) - goto error; - - if (zip_file_decompress(z, imgfile->u.buffer, zipent->uncompressed_length)) - goto error; - - zip_file_close(z); - return imgfile; - -error: - if (z) - zip_file_close(z); - if (imgfile) - { - if (imgfile->u.buffer) - free(imgfile->u.buffer); - free(imgfile); - } - return NULL; -} - - - -imgtool_stream *stream_open(const char *fname, int read_or_write) -{ - file_error filerr; - const char *ext; - imgtool_stream *imgfile = NULL; - static const UINT32 write_modes[] = - { - OPEN_FLAG_READ, - OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, - OPEN_FLAG_READ | OPEN_FLAG_WRITE, - OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE - }; - core_file *f = NULL; - char *buf = NULL; - int len, i; - imgtool_stream *s = NULL; - char c; - - /* maybe we are just a ZIP? */ - ext = strrchr(fname, '.'); - if (ext && !core_stricmp(ext, ".zip")) - return stream_open_zip(fname, NULL, read_or_write); - - filerr = core_fopen(fname, write_modes[read_or_write], &f); - if (filerr != FILERR_NONE) - { - if (!read_or_write) - { - len = strlen(fname); - - /* can't open the file; try opening ZIP files with other names */ - buf = (char*)malloc(len + 1); - if (!buf) - goto error; - strcpy(buf, fname); - - for(i = len-1; !s && (i >= 0); i--) - { - if ((buf[i] == '\\') || (buf[i] == '/')) - { - c = buf[i]; - buf[i] = '\0'; - s = stream_open_zip(buf, buf + i + 1, read_or_write); - buf[i] = c; - } - } - free(buf); - buf = NULL; - - if (s) - return s; - } - - /* ah well, it was worth a shot */ - goto error; - } - - imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); - if (!imgfile) - goto error; - - /* Normal file */ - memset(imgfile, 0, sizeof(*imgfile)); - imgfile->imgtype = IMG_FILE; - imgfile->position = 0; - imgfile->filesize = core_fsize(f); - imgfile->write_protect = read_or_write ? 0 : 1; - imgfile->u.file = f; - imgfile->name = fname; - return imgfile; - -error: - if (imgfile != NULL) - free((void *) imgfile); - if (f != NULL) - core_fclose(f); - if (buf) - free(buf); - return (imgtool_stream *) NULL; -} - - - -imgtool_stream *stream_open_write_stream(int size) -{ - imgtool_stream *imgfile; - - imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); - if (!imgfile) - return NULL; - - imgfile->imgtype = IMG_MEM; - imgfile->write_protect = 0; - imgfile->position = 0; - imgfile->filesize = size; - imgfile->u.buffer = (UINT8*)malloc(size); - - if (!imgfile->u.buffer) - { - free(imgfile); - return NULL; - } - - return imgfile; -} - - - -imgtool_stream *stream_open_mem(void *buf, size_t sz) -{ - imgtool_stream *imgfile; - - imgfile = (imgtool_stream *)malloc(sizeof(imgtool_stream)); - if (!imgfile) - return NULL; - - memset(imgfile, 0, sizeof(*imgfile)); - imgfile->imgtype = IMG_MEM; - imgfile->position = 0; - imgfile->write_protect = 0; - - imgfile->filesize = sz; - imgfile->u.buffer = (UINT8*)buf; - return imgfile; -} - - - -void stream_close(imgtool_stream *s) -{ - assert(s != NULL); - - switch(s->imgtype) - { - case IMG_FILE: - if (s->u.file != NULL) - { - core_fclose(s->u.file); - s->u.file = NULL; - } - break; - - case IMG_MEM: - if (s->u.buffer != NULL) - { - free(s->u.buffer); - s->u.buffer = NULL; - } - break; - - default: - assert(0); - break; - } - free((void *) s); -} - - - -core_file *stream_core_file(imgtool_stream *stream) -{ - return (stream->imgtype == IMG_FILE) ? stream->u.file : NULL; -} - - - -UINT32 stream_read(imgtool_stream *stream, void *buf, UINT32 sz) -{ - UINT32 result = 0; - - switch(stream->imgtype) - { - case IMG_FILE: - assert(sz == (UINT32) sz); - core_fseek(stream->u.file, stream->position, SEEK_SET); - result = core_fread(stream->u.file, buf, (UINT32) sz); - break; - - case IMG_MEM: - /* do we have to limit sz? */ - if (sz > (stream->filesize - stream->position)) - sz = (UINT32) (stream->filesize - stream->position); - - memcpy(buf, stream->u.buffer + stream->position, sz); - result = sz; - break; - - default: - assert(0); - break; - } - stream->position += result; - return result; -} - - - -UINT32 stream_write(imgtool_stream *s, const void *buf, UINT32 sz) -{ - void *new_buffer; - UINT32 result = 0; - - switch(s->imgtype) - { - case IMG_MEM: - if (!s->write_protect) - { - /* do we have to expand the buffer? */ - if (s->filesize < s->position + sz) - { - /* try to expand the buffer */ - if (s->u.buffer) free(s->u.buffer); - new_buffer = malloc(s->position + sz); - if (new_buffer) - { - s->u.buffer = (UINT8*)new_buffer; - s->filesize = s->position + sz; - } - } - - /* do we have to limit sz? */ - if (sz > (s->filesize - s->position)) - sz = (UINT32) (s->filesize - s->position); - - memcpy(s->u.buffer + s->position, buf, sz); - result = sz; - } - break; - - case IMG_FILE: - core_fseek(s->u.file, s->position, SEEK_SET); - result = core_fwrite(s->u.file, buf, sz); - break; - - default: - assert(0); - break; - } - - /* advance the file pointer */ - s->position += result; - - /* did we grow the file */ - if (s->position > s->filesize) - s->filesize = s->position; - return result; -} - - - -UINT64 stream_size(imgtool_stream *s) -{ - return s->filesize; -} - - - -void *stream_getptr(imgtool_stream *f) -{ - void *ptr; - - switch(f->imgtype) - { - case IMG_MEM: - ptr = f->u.buffer; - break; - - default: - ptr = NULL; - break; - } - return ptr; -} - - - -int stream_seek(imgtool_stream *s, INT64 pos, int where) -{ - UINT64 size; - - size = stream_size(s); - - switch(where) - { - case SEEK_CUR: - pos += s->position; - break; - case SEEK_END: - pos += size; - break; - } - - if (pos < 0) - s->position = 0; - else - s->position = MIN(size, pos); - - if (s->position < pos) - stream_fill(s, '\0', pos - s->position); - - return 0; -} - - - -UINT64 stream_tell(imgtool_stream *s) -{ - return s->position; -} - - - -UINT64 stream_transfer(imgtool_stream *dest, imgtool_stream *source, UINT64 sz) -{ - UINT64 result = 0; - UINT64 readsz; - char buf[1024]; - - while(sz && (readsz = stream_read(source, buf, MIN(sz, sizeof(buf))))) - { - stream_write(dest, buf, readsz); - sz -= readsz; - result += readsz; - } - return result; -} - - - -UINT64 stream_transfer_all(imgtool_stream *dest, imgtool_stream *source) -{ - return stream_transfer(dest, source, stream_size(source)); -} - - - -int stream_crc(imgtool_stream *s, unsigned long *result) -{ - size_t sz; - void *ptr; - - switch(s->imgtype) - { - case IMG_MEM: - *result = crc32(0, (unsigned char *) s->u.buffer, (size_t) s->filesize); - break; - - default: - sz = stream_size(s); - ptr = malloc(sz); - if (!ptr) - return IMGTOOLERR_OUTOFMEMORY; - stream_seek(s, 0, SEEK_SET); - if (stream_read(s, ptr, sz) != sz) - { - free(ptr); - return IMGTOOLERR_READERROR; - } - *result = crc32(0, (const Bytef*)ptr, sz); - free(ptr); - break; - } - return 0; -} - - - -int file_crc(const char *fname, unsigned long *result) -{ - int err; - imgtool_stream *f; - - f = stream_open(fname, OSD_FOPEN_READ); - if (!f) - return IMGTOOLERR_FILENOTFOUND; - - err = stream_crc(f, result); - stream_close(f); - return err; -} - - - -UINT64 stream_fill(imgtool_stream *f, unsigned char b, UINT64 sz) -{ - UINT64 outsz; - char buf[1024]; - - outsz = 0; - memset(buf, b, MIN(sz, sizeof(buf))); - - while(sz) - { - outsz += stream_write(f, buf, MIN(sz, sizeof(buf))); - sz -= MIN(sz, sizeof(buf)); - } - return outsz; -} - - - -int stream_isreadonly(imgtool_stream *s) -{ - return s->write_protect; -} - - - -UINT32 stream_putc(imgtool_stream *stream, char c) -{ - return stream_write(stream, &c, 1); -} - - - -UINT32 stream_puts(imgtool_stream *stream, const char *s) -{ - return stream_write(stream, s, strlen(s)); -} - - - -UINT32 stream_printf(imgtool_stream *stream, const char *fmt, ...) -{ - va_list va; - char buf[256]; - - va_start(va, fmt); - vsprintf(buf, fmt, va); - va_end(va); - - return stream_puts(stream, buf); -} diff --git a/src/mess/tools/imgtool/stream.h b/src/mess/tools/imgtool/stream.h deleted file mode 100644 index 13e6e0d727f..00000000000 --- a/src/mess/tools/imgtool/stream.h +++ /dev/null @@ -1,48 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - stream.h - - Code for implementing Imgtool streams - -***************************************************************************/ - -#ifndef STREAM_H -#define STREAM_H - -#include "imgterrs.h" -#include "corefile.h" - -struct imgtool_stream; - -imgtool_stream *stream_open(const char *fname, int read_or_write); /* similar params to mame_fopen */ -imgtool_stream *stream_open_write_stream(int filesize); -imgtool_stream *stream_open_mem(void *buf, size_t sz); -void stream_close(imgtool_stream *stream); -core_file *stream_core_file(imgtool_stream *stream); -UINT32 stream_read(imgtool_stream *stream, void *buf, UINT32 sz); -UINT32 stream_write(imgtool_stream *stream, const void *buf, UINT32 sz); -UINT64 stream_size(imgtool_stream *stream); -int stream_seek(imgtool_stream *stream, INT64 pos, int where); -UINT64 stream_tell(imgtool_stream *stream); -void *stream_getptr(imgtool_stream *stream); -UINT32 stream_putc(imgtool_stream *stream, char c); -UINT32 stream_puts(imgtool_stream *stream, const char *s); -UINT32 stream_printf(imgtool_stream *stream, const char *fmt, ...) ATTR_PRINTF(2,3); - -/* Transfers sz bytes from source to dest */ -UINT64 stream_transfer(imgtool_stream *dest, imgtool_stream *source, UINT64 sz); -UINT64 stream_transfer_all(imgtool_stream *dest, imgtool_stream *source); - -/* Fills sz bytes with b */ -UINT64 stream_fill(imgtool_stream *f, unsigned char b, UINT64 sz); - -/* Returns the CRC of a file */ -int stream_crc(imgtool_stream *f, unsigned long *result); -int file_crc(const char *fname, unsigned long *result); - -/* Returns whether a stream is read only or not */ -int stream_isreadonly(imgtool_stream *f); - -#endif /* STREAM_H */ diff --git a/src/mess/video/733_asr.c b/src/mess/video/733_asr.c deleted file mode 100644 index da1286d69f5..00000000000 --- a/src/mess/video/733_asr.c +++ /dev/null @@ -1,815 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - 733 ASR emulation - - We are emulating a TI Model 733 ASR ("Silent 700") data terminal, - interfaced through a TI asynchronous EIA/TTY interface module. - - The ASR features a printer, a keyboard and a tape unit (which is not - emulated). The ASR is attached to the computer with a serial interface. - - References: - 945401-9701 Model 990/4 Computer System Field Maintenance Manual p. C-1, - 945250-9701 990 Computer Family Systems Handbook pp. 5-9 through 5-16, - 0943442-9701 Model 990 Computer Reference Manual Preliminary pp. 3-13 - through 3-21 and 3-39 through 3-44. - - TODO: - * separate ASR emulation from EIA interface emulation? - * implement tape interface? - - Raphael Nabet 2003 - - Rewritten as class - Michael Zapf, 2014 -*/ - -#include "emu.h" -#include "733_asr.h" - -enum -{ - /*ASROutQueueSize = 32,*/ - - asr_window_offset_x = 0, - asr_window_offset_y = 0, - asr_window_width = 640, - asr_window_height = 480, - asr_scroll_step = 8 -}; - -enum -{ - AS_wrq_mask = 1 << 3, - AS_rrq_mask = 1 << 4, - AS_dsr_mask = 1 << 6, - AS_int_mask = 1 << 7, - - AM_dtr_mask = 1 << 1, - AM_rts_mask = 1 << 2, - AM_enint_mask = 1 << 6 -}; - -enum -{ - asrfontdata_size = 96/*128*/*8 -}; - -static const gfx_layout fontlayout = -{ - 6, 8, /* 6*8 characters */ - /*96*/128, /* 96 characters */ - 1, /* 1 bit per pixel */ - { 0 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ -}; - -static GFXDECODE_START( asr733 ) - GFXDECODE_ENTRY( asr733_chr_region, 0, fontlayout, 0, 1 ) -GFXDECODE_END - -PALETTE_INIT_MEMBER(asr733_device, asr733) -{ - palette.set_pen_color(0,rgb_t::white); /* white */ - palette.set_pen_color(1,rgb_t::black); /* black */ -} - - -const device_type ASR733 = &device_creator; - -asr733_device::asr733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ASR733, "733 ASR", tag, owner, clock, "asr733", __FILE__), - m_palette(*this, "palette"), - m_gfxdecode(*this, "gfxdecode"), - m_keyint_line(*this), - m_lineint_line(*this) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void asr733_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void asr733_device::device_start() -{ - screen_device *screen = machine().first_screen(); - int width = screen->width(); - int height = screen->height(); - const rectangle &visarea = screen->visible_area(); - - m_last_key_pressed = 0x80; - m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); - - m_bitmap->fill(0, visarea); - - m_keyint_line.resolve(); - m_lineint_line.resolve(); - - m_line_timer = timer_alloc(0); - - UINT8 *dst; - - static const unsigned char fontdata6x8[asrfontdata_size] = - { /* ASCII characters */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, - 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00, - 0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08, - 0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00, - 0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00, - 0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00, - 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00, - 0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00, - 0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, - 0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00, - 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00, - 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60, - 0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, - 0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, - 0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, - 0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, - 0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, - 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00, - 0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, - 0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, - 0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, - 0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08, - 0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, - 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, - 0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00, - 0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00, - 0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00, - 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00, - 0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc, - 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, - 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00, - 0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, - 0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, - 0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00, - 0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00, - 0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, - 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, - 0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, - 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00, - 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00, - 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, - 0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00, - 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00, - 0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00 - }; - - dst = machine().root_device().memregion(asr733_chr_region)->base(); - - memcpy(dst, fontdata6x8, asrfontdata_size); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void asr733_device::device_reset() -{ - /*m_OutQueueLen = 0;*/ - - m_status = AS_dsr_mask | AS_wrq_mask; - m_mode = 0; - m_line_timer->adjust(attotime::from_msec(0), 0, attotime::from_hz(60)); - - set_interrupt_line(); -} - -void asr733_device::set_interrupt_line() -{ - if ((m_mode & AM_enint_mask) && (m_new_status_flag)) /* right??? */ - { - m_status |= AS_int_mask; - m_keyint_line(ASSERT_LINE); - } - else - { - m_status &= ~AS_int_mask; - m_keyint_line(CLEAR_LINE); - } -} - -/* write a single char on screen */ -void asr733_device::draw_char(int character, int x, int y, int color) -{ - m_gfxdecode->gfx(0)->opaque(*m_bitmap, m_bitmap->cliprect(), character-32, color, 0, 0, x+1, y); -} - -void asr733_device::linefeed() -{ - UINT8 buf[asr_window_width]; - - for (int y=asr_window_offset_y; ypens()); - } - - const rectangle asr_scroll_clear_window( - asr_window_offset_x, /* min_x */ - asr_window_offset_x+asr_window_width-1, /* max_x */ - asr_window_offset_y+asr_window_height-asr_scroll_step, /* min_y */ - asr_window_offset_y+asr_window_height-1 /* max_y */ - ); - m_bitmap->fill(0, asr_scroll_clear_window); -} - -void asr733_device::transmit(UINT8 data) -{ - switch (data) - { - /* aux device control chars */ - case 0x05: - /* ENQ -> "WRU": ??? */ - break; - - case 0x11: - /* DC1 -> "X-ON": transmit on??? */ - break; - - case 0x12: - /* DC2 -> "X-OFF": transmit off??? */ - break; - - case 0x13: - /* DC3 -> "TAPE": tape on??? */ - break; - - case 0x14: - /* DC4 -> "-T-A-P-E-" ("TAPE" with overstrike): tape off??? */ - break; - - - /* printer control chars */ - case 0x07: - /* BELL: 250ms beep */ - break; - - case 0x08: - /* BS: backspace */ - if (m_x > 0) - m_x--; - break; - - case 0x0A: - /* LF: line feed */ - linefeed(); - break; - - case 0x0D: - /* CR: carriage return */ - m_x = 0; - break; - - - default: - if ((data < 0x20) || (data == 0x7f) || (data >= 0x80)) - /* ignore control characters */ - break; - - if (m_x == 80) - { - m_x = 0; - linefeed(); - } - draw_char(data, asr_window_offset_x + m_x*8, asr_window_offset_y+asr_window_height-8, 0); - m_x++; - break; - } - - m_status |= AS_wrq_mask; - m_new_status_flag = 1; /* right??? */ - set_interrupt_line(); -} - -#if 0 -void asr733_device::receive_callback(int dummy) -{ - (void) dummy; - - m_recv_buf = m_OutQueue[m_OutQueueHead]; - m_OutQueueHead = (m_OutQueueHead + 1) % ASROutQueueSize; - m_OutQueueLen--; - - m_status |= AS_rrq_mask; - m_new_status_flag = 1; /* right??? */ - set_interrupt_line(); -} -#endif - -/* - 0-7: receive buffer - 8: XMITING transmit in progress, 1 if transmitting - 9: TIMERR timing error, 1 if error - 10: RCR reverse channel receive, not used - "ASR733/33 ID" 1 -> TTY (???) (2270509-9701 pp. G-9 & G-10) - 11: WRQ write request, 1 if ready to transmit - 12: RRQ read request, 1 if ready to receive - 13: DCD data carrier detect, not used - 14: DSR data set ready, 1 if online - 15: INT interrupt, 1 if interrupt -*/ -READ8_MEMBER( asr733_device::cru_r ) -{ - int reply = 0; - - switch (offset) - { - case 0: - /* receive buffer */ - reply = m_recv_buf; - break; - - case 1: - /* status register */ - reply = m_status; - break; - } - - return reply; -} - -/* - 0-7: transmit buffer - 8: not used - 9: DTR data terminal ready (set to 1) - 10: RTS request to send (set to 1) - 11: CLRWRQ clear write request (write any value to execute) - 12: CLRRRQ clear read request (write any value to execute) - 13: CLRNSF clear new status flag - clear DSR/DCD interrupts (write any value to execute) - 14: enable interrupts, 1 to enable interrupts - 15: diagnostic mode, 0 for normal mode -*/ -WRITE8_MEMBER( asr733_device::cru_w ) -{ - switch (offset) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - /* transmit buffer */ - if (data) - m_xmit_buf |= 1 << offset; - else - m_xmit_buf &= ~ (1 << offset); - if ((offset == 7) && (m_mode & AM_dtr_mask) && (m_mode & AM_rts_mask)) /* right??? */ - transmit(m_xmit_buf); - break; - - case 8: /* not used */ - break; - - case 9: /* data terminal ready (set to 1) */ - case 10: /* request to send (set to 1) */ - case 14: /* enable interrupts, 1 to enable interrupts */ - case 15: /* diagnostic mode, 0 for normal mode */ - if (data) - m_mode |= 1 << (offset - 8); - else - m_mode &= ~ (1 << (offset - 8)); - if (offset == 14) - set_interrupt_line(); - break; - - case 11: /* clear write request (write any value to execute) */ - case 12: /* clear read request (write any value to execute) */ - m_status &= ~ (1 << (offset - 8)); - set_interrupt_line(); - break; - - case 13: /* clear new status flag - whatever it means (write any value to execute) */ - m_new_status_flag = 0; - set_interrupt_line(); - break; - } -} - -/* - Video refresh -*/ -void asr733_device::refresh(bitmap_ind16 &bitmap, int x, int y) -{ - copybitmap(bitmap, *m_bitmap, 0, 0, x, y, m_bitmap->cliprect()); -} - - -/* - Time callbacks -*/ -void asr733_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - check_keyboard(); - m_lineint_line(ASSERT_LINE); - m_lineint_line(CLEAR_LINE); -} - -static const unsigned char key_translate[3][51] = -{ - { /* unshifted */ - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '0', - ':', - '-', - - 0x1b, - 'Q', - 'W', - 'E', - 'R', - 'T', - 'Y', - 'U', - 'I', - 'O', - 'P', - 0x0a, - 0x0d, - - 0, - 'A', - 'S', - 'D', - 'F', - 'G', - 'H', - 'J', - 'K', - 'L', - ';', - 0x08, - 0, - - 0, - 'Z', - 'X', - 'C', - 'V', - 'B', - 'N', - 'M', - ',', - '.', - '/', - 0, - - ' ' - }, - { /* shifted */ - '!', - '"', - '#', - '$', - '%', - '&', - '^', - '(', - ')', - ' ', - '*', - '=', - - 0x1b, - 'Q', - 'W', - 'E', - 'R', - 'T', - 'Y', - 'U', - 'I', - '_', - '@', - 0x0a, - 0x0d, - - 0, - 'A', - 'S', - 'D', - 'F', - 'G', - 'H', - 'J', - 0, - '/', - '+', - 0x08, - 0, - - 0, - 'Z', - 'X', - 'C', - 'V', - 'B', - '^', - '|', - '<', - '>', - '?', - 0, - - ' ' - }, - { /* control */ - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '0', - ':', - '-', - - 0x1b, - 0x11, - 0x17, - 0x05, - 0x12, - 0x14, - 0x19, - 0x15, - 0x09, - 0x0f, - 0x10, - 0x0a, - 0x0d, - - 0, - 0x01, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0a, - 0x0b, - 0x0c, - ';', - 0x08, - 0, - - 0, - 0x1a, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0e, - 0x0d, - ',', - '.', - '/', - 0, - - ' ' - } -}; - - -/* - keyboard handler: should be called regularly by machine code, for instance - every Video Blank Interrupt. -*/ -void asr733_device::check_keyboard() -{ - enum modifier_state_t - { - /* key modifier states */ - unshifted = 0, shift, control, - /* special value to stop repeat if the modifier state changes */ - special_debounce = -1 - } ; - - enum { repeat_delay = 5 /* approx. 1/10s */ }; - - //UINT16 key_buf[6]; - UINT16 key_buf[4]; - int i, j; - modifier_state_t modifier_state; - int repeat_mode; - - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" }; - - /* read current key state */ - /* 2008-05 FP: in 733_asr.h there are only 4 input ports defined... */ - /* for (i = 0; i < 6; i++) */ - for (i = 0; i < 4; i++) - { - key_buf[i] = ioport(keynames[i])->read(); - } - - /* process key modifiers */ - if (key_buf[1] & 0x0200) - modifier_state = control; - else if ((key_buf[2] & 0x0040) || (key_buf[3] & 0x0002)) - modifier_state = shift; - else - modifier_state = unshifted; - - /* test repeat key */ - repeat_mode = key_buf[2] & 0x0020; - - /* remove modifier keys */ - key_buf[1] &= ~0x0200; - key_buf[2] &= ~0x0060; - key_buf[3] &= ~0x0002; - - if (! repeat_mode) - /* reset REPEAT timer if the REPEAT key is not pressed */ - m_repeat_timer = 0; - - if ( !(m_last_key_pressed & 0x80) && (key_buf[m_last_key_pressed >> 4] & (1 << (m_last_key_pressed & 0xf)))) - { - /* last key has not been released */ - if (modifier_state == m_last_modifier_state) - { - /* handle REPEAT mode if applicable */ - if ((repeat_mode) && (++m_repeat_timer == repeat_delay)) - { - if (m_status & AS_rrq_mask) - { /* keyboard buffer full */ - m_repeat_timer--; - } - else - { /* repeat current key */ - m_status |= AS_rrq_mask; - m_new_status_flag = 1; /* right??? */ - set_interrupt_line(); - m_repeat_timer = 0; - } - } - } - else - { - m_repeat_timer = 0; - m_last_modifier_state = special_debounce; - } - } - else - { - m_last_key_pressed = 0x80; - - if (m_status & AS_rrq_mask) - { /* keyboard buffer full */ - /* do nothing */ - } - else - { - //for (i=0; i<6; i++) - for (i=0; i<4; i++) - { - for (j=0; j<16; j++) - { - if (key_buf[i] & (1 << j)) - { - m_last_key_pressed = (i << 4) | j; - m_last_modifier_state = modifier_state; - - m_recv_buf = (int)key_translate[modifier_state][m_last_key_pressed]; - m_status |= AS_rrq_mask; - m_new_status_flag = 1; /* right??? */ - set_interrupt_line(); - return; - } - } - } - } - } -} - -UINT32 asr733_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - refresh(bitmap, 0, 0); - return 0; -} - -static MACHINE_CONFIG_FRAGMENT( asr733 ) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", asr733) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(asr733_device, asr733) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, asr733_device, screen_update) - - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_SCREEN_PALETTE("palette") -MACHINE_CONFIG_END - -INPUT_PORTS_START( asr733 ) - PORT_START("KEY0") /* keys 1-16 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_MINUS) \ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS) \ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) \ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) \ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) \ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) \ - \ - PORT_START("KEY1") /* keys 17-32 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_CLOSEBRACE) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) \ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) \ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) \ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) \ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) \ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) \ - \ - PORT_START("KEY2") /* keys 33-48 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RUB OUT") PORT_CODE(KEYCODE_BACKSPACE) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_RALT) \ - /* hack for my mac that does not disciminate the right ALT key */ \ - /* PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_LALT) */ \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) \ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) \ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) \ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) \ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) \ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) \ - \ - PORT_START("KEY3") /* keys 49-51 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(SPACE)") PORT_CODE(KEYCODE_SPACE) -INPUT_PORTS_END - -ioport_constructor asr733_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( asr733 ); -} - -//------------------------------------------------- -// machine_config_additions - return a pointer to -// the device's machine fragment -//------------------------------------------------- - -machine_config_constructor asr733_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( asr733 ); -} diff --git a/src/mess/video/733_asr.h b/src/mess/video/733_asr.h deleted file mode 100644 index 6182a21eb52..00000000000 --- a/src/mess/video/733_asr.h +++ /dev/null @@ -1,88 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet - -#define asr733_chr_region ":gfx1" - -enum -{ - /* 8 bytes per character definition */ - asr733_single_char_len = 8, - asr733_chr_region_len = 128*asr733_single_char_len -}; - -class asr733_device : public device_t -{ -public: - asr733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_PALETTE_INIT(asr733); - - DECLARE_READ8_MEMBER(cru_r); - DECLARE_WRITE8_MEMBER(cru_w); - - template static devcb_base &static_set_keyint_callback(device_t &device, _Object object) - { - return downcast(device).m_keyint_line.set_callback(object); - } - template static devcb_base &static_set_lineint_callback(device_t &device, _Object object) - { - return downcast(device).m_lineint_line.set_callback(object); - } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - // device-level overrides - void device_config_complete(); - void device_start(); - void device_reset(); - machine_config_constructor device_mconfig_additions() const; - void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - ioport_constructor device_input_ports() const; - -private: - // internal state -#if 0 - UINT8 m_OutQueue[ASROutQueueSize]; - int m_OutQueueHead; - int m_OutQueueLen; -#endif - - void check_keyboard(); - void refresh(bitmap_ind16 &bitmap, int x, int y); - - void set_interrupt_line(); - void draw_char(int character, int x, int y, int color); - void linefeed(); - void transmit(UINT8 data); - - emu_timer *m_line_timer; // screen line timer - - UINT8 m_recv_buf; - UINT8 m_xmit_buf; - - UINT8 m_status; - UINT8 m_mode; - UINT8 m_last_key_pressed; - int m_last_modifier_state; - - unsigned char m_repeat_timer; - int m_new_status_flag; - - int m_x; - - bitmap_ind16* m_bitmap; - - required_device m_palette; - required_device m_gfxdecode; - devcb_write_line m_keyint_line; - devcb_write_line m_lineint_line; -}; - -extern const device_type ASR733; - -#define MCFG_ASR733_KEYINT_HANDLER( _intcallb ) \ - devcb = &asr733_device::static_set_keyint_callback( *device, DEVCB_##_intcallb ); - -#define MCFG_ASR733_LINEINT_HANDLER( _intcallb ) \ - devcb = &asr733_device::static_set_lineint_callback( *device, DEVCB_##_intcallb ); diff --git a/src/mess/video/911_chr.h b/src/mess/video/911_chr.h deleted file mode 100644 index 6d24b5d0415..00000000000 --- a/src/mess/video/911_chr.h +++ /dev/null @@ -1,3516 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - 911_chr.h: character definitions for 911_vdt.c - - We define the character matrix for each character. - - The US terminal uses the standard 7-bit ASCII character set, with - additional graphic characters in the 32 first positions. - - The various European terminals use variants of the 7-bit ASCII character - set with national characters instead of various punctuation characters. - I think these national character sets were standardized at a point, but - I don't know how close to this standard the character sets used by the - 911 VDT are. - - The Japanese terminal uses 8-bit character codes. The 128 first characters - are identical to the US character set (except that '\' is replaced by the - Yen symbol), and the next 128 characters include the katakana syllabus. - Kanji ideograms are not supported in this scheme. - - The Arabic terminal uses 8-bit character codes, too. It requires - additional code in the TI990 OS for correct operation, as the keyboard - returns codes for isolated characters (i.e. without ligatures), which need - to be substituted with codes with correct context-dependent ligatures. - And both OS and application programs need to support the fact that the - writing direction can be either right-to-left or left-to-right, according - to whether the characters are Latin or Arabic. - - As the original ROMs have not been dumped yet, I recreated the matrices - from various matrix printouts in TI documentation. -*/ -/* - The Arabic character set is not implemented, because documentation is ambiguous - (it says there are 115 characters, but I can hardly see 80 characters in the - attached table), and the character matrices are not documented. -*/ - - -/* - Offsets in the char_defs array -*/ -enum -{ - /* US ASCII: 128 characters (32 symbols + 95 ASCII + 1 blank (delete character)) */ - char_defs_US_base = 0, - /* additionnal katakana set (128 characters, including JIS set) */ - char_defs_katakana_base = char_defs_US_base+128, - /* extra symbols for national character sets */ - char_defs_pound = char_defs_katakana_base+128, /* pound sign (UK 0x23, French WP 0x23) */ - char_defs_yen, /* yen sign (Japan 0x5C) */ - char_defs_auml, /* Latin small letter a with diaeresis (Swedish/Finish 0x7B, German 0x7B) */ - char_defs_Auml, /* Latin capital letter A with diaeresis (Swedish/Finish 0x5B, German 0x5B) */ - char_defs_Aring, /* Latin capital letter A with ring above (Swedish/Finish 0x5D, Norwegian/Danish 0x5D) */ - char_defs_uuml, /* Latin small letter u with diaeresis (Swedish/Finish 0x7E, German 0x7D) */ - char_defs_aring, /* Latin small letter a with ring above (Swedish/Finish 0x7D, Norwegian/Danish 0x7D) */ - char_defs_Uuml, /* Latin capital letter U with diaeresis (German 0x5D) */ - char_defs_ouml, /* Latin small letter o with diaeresis (German 0x7C) */ - char_defs_Ouml, /* Latin capital letter O with diaeresis (German 0x5C) */ - char_defs_szlig, /* Latin small letter sharp s (German 0x7E) */ - char_defs_aelig, /* Latin small letter ae (Norwegian/Danish 0x7B) */ - char_defs_AElig, /* Latin capital letter AE (Norwegian/Danish 0x5B) */ - char_defs_oslash, /* Latin small letter o with stroke (Norwegian/Danish 0x7C) */ - char_defs_Oslash, /* Latin capital letter O with stroke (Norwegian/Danish 0x5C) */ - char_defs_agrave, /* Latin small letter a with grave (French WP 0x40) */ - char_defs_deg, /* degree sign (French WP 0x5B) */ - char_defs_ccedil, /* Latin small letter c with cedilla (French WP 0x5C) */ - char_defs_sect, /* section sign (French WP 0x5D) */ - char_defs_egrave, /* Latin small letter e with grave (French WP 0x7B) */ - char_defs_ugrave, /* Latin small letter u with grave (French WP 0x7C) */ - char_defs_eacute, /* Latin small letter e with acute (French WP 0x7D) */ - char_defs_uml, /* diaeresis (French WP 0x7E) */ - - char_defs_count /* total character count */ -}; - -/* structure used to describe differences between national character sets and -US character set */ -/* much more compact than defining the complete 128-char vector */ -struct char_override_t -{ - unsigned char char_index; /* char to replace */ - unsigned short symbol_index; /* replacement symbol */ -}; - -/* One UK-specific character */ -static const char_override_t UK_overrides[1] = -{ - { 0x23, char_defs_pound } -}; - -/* One Japan-specific character (see below for the 128 additionnal characters) */ -static const char_override_t japanese_overrides[1] = -{ - { 0x5C, char_defs_yen } -}; - -/* 5 Sweden/Finland-specific characters */ -static const char_override_t swedish_overrides[/*5*/7] = -{ - { 0x7B, char_defs_auml }, - { 0x5B, char_defs_Auml }, - { 0x5D, char_defs_Aring }, - { 0x7E, char_defs_uuml }, - { 0x7D, char_defs_aring }, - /* next characters described in D-4 but not 1-10 */ - { 0x5C, char_defs_Ouml }, - { 0x7C, char_defs_ouml } -}; - -/* 7 German-specific characters */ -static const char_override_t german_overrides[7] = -{ - { 0x5D, char_defs_Uuml }, - { 0x7D, char_defs_uuml }, - { 0x7C, char_defs_ouml }, - { 0x5C, char_defs_Ouml }, - { 0x7B, char_defs_auml }, - { 0x7E, char_defs_szlig }, - { 0x5B, char_defs_Auml } /* 945423-9701 rev. B p. 1-10 says 0x5D, but it must be a mistake */ -}; - -/* 6 Norway/Denmark-specific characters */ -static const char_override_t norwegian_overrides[6] = -{ - { 0x5D, char_defs_Aring }, - { 0x7B, char_defs_aelig }, - { 0x5B, char_defs_AElig }, - { 0x7D, char_defs_aring }, - { 0x7C, char_defs_oslash}, - { 0x5C, char_defs_Oslash} -}; - -/* 9 French-specific characters (word-processing model only: the data-processing model uses -the US character set, although the keyboard mapping is different from the US model) */ -/* WARNING: I have created the character matrices from scratch, as I have no printout of -the original matrices. */ -static const char_override_t frenchWP_overrides[9] = -{ - { 0x23, char_defs_pound }, - { 0x40, char_defs_agrave}, - { 0x5B, char_defs_deg }, - { 0x5C, char_defs_ccedil}, - { 0x5D, char_defs_sect }, - { 0x7B, char_defs_eacute}, /* 945423-9701 rev. B says char_defs_egrave, but it must be a mistake */ - { 0x7C, char_defs_ugrave}, - { 0x7D, char_defs_egrave}, /* 945423-9701 rev. B says char_defs_eacute, but it must be a mistake */ - { 0x7E, char_defs_uml } -}; - -/* - char_defs array: character matrices for each character -*/ -static const UINT8 char_defs[char_defs_count][10] = -{ -/* US character set: 128 7*10 character matrix */ - { /* 0x00 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c - }, - { /* 0x01 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c - }, - { /* 0x02 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x03 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x04 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x05 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x06 */ - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x07 */ - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x08 */ - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x09 */ - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x0A */ - 0x00, - 0x00, - 0x00, - 0x1f, - 0x1f, - 0x1f, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x0B */ - 0x1c, - 0x1c, - 0x1c, - 0x7c, - 0x7c, - 0x7c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x0C */ - 0x00, - 0x00, - 0x00, - 0x7f, - 0x7f, - 0x7f, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x0D */ - 0x1c, - 0x1c, - 0x1c, - 0x1f, - 0x1f, - 0x1f, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x0E */ - 0x01, - 0x03, - 0x06, - 0x04, - 0x08, - 0x08, - 0x10, - 0x30, - 0x60, - 0x40 - }, - { /* 0x0F */ - 0x00, - 0x00, - 0x7f, - 0x00, - 0x00, - 0x00, - 0x7f, - 0x00, - 0x00, - 0x00 - }, - { /* 0x10 */ - 0x00, - 0x00, - 0x00, - 0x40, - 0x40, - 0x40, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x11 */ - 0x00, - 0x00, - 0x00, - 0x60, - 0x60, - 0x60, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x12 */ - 0x00, - 0x00, - 0x00, - 0x70, - 0x70, - 0x70, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x13 */ - 0x00, - 0x00, - 0x00, - 0x78, - 0x78, - 0x78, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x14*/ - 0x00, - 0x00, - 0x00, - 0x7c, - 0x7c, - 0x7c, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x15 */ - 0x00, - 0x00, - 0x00, - 0x7e, - 0x7e, - 0x7e, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x16 */ - 0x00, - 0x00, - 0x00, - 0x7f, - 0x7f, - 0x7f, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x17*/ - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x18 */ - 0x1c, - 0x1c, - 0x1c, - 0x7f, - 0x7f, - 0x7f, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x19 */ - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f - }, - { /* 0x1A */ - 0x00, - 0x00, - 0x00, - 0x7c, - 0x7c, - 0x7c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x1B */ - 0x1c, - 0x1c, - 0x1c, - 0x1f, - 0x1f, - 0x1f, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x1C */ - 0x1c, - 0x1c, - 0x1c, - 0x7f, - 0x7f, - 0x7f, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x1D */ - 0x1c, - 0x1c, - 0x1c, - 0x7c, - 0x7c, - 0x7c, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x1E */ - 0x40, - 0x60, - 0x30, - 0x10, - 0x08, - 0x08, - 0x04, - 0x06, - 0x03, - 0x01 - }, - { /* 0x1F */ - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22 - }, - { /* 0x20 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x21 */ - 0x00, - 0x18, - 0x18, - 0x18, - 0x18, - 0x18, - 0x00, - 0x18, - 0x00, - 0x00 - }, - { /* 0x22 */ - 0x00, - 0x14, - 0x14, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x23 */ - 0x00, - 0x00, - 0x14, - 0x36, - 0x00, - 0x36, - 0x14, - 0x00, - 0x00, - 0x00 - }, - { /* 0x24 */ - 0x00, - 0x1c, - 0x2a, - 0x28, - 0x1c, - 0x0a, - 0x2a, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x25 */ - 0x00, - 0x30, - 0x32, - 0x04, - 0x08, - 0x10, - 0x26, - 0x06, - 0x00, - 0x00 - }, - { /* 0x26 */ - 0x00, - 0x10, - 0x28, - 0x28, - 0x10, - 0x2a, - 0x24, - 0x1a, - 0x00, - 0x00 - }, - { /* 0x27 */ - 0x00, - 0x04, - 0x08, - 0x10, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x28 */ - 0x00, - 0x02, - 0x04, - 0x08, - 0x08, - 0x08, - 0x04, - 0x02, - 0x00, - 0x00 - }, - { /* 0x29 */ - 0x00, - 0x20, - 0x10, - 0x08, - 0x08, - 0x08, - 0x10, - 0x20, - 0x00, - 0x00 - }, - { /* 0x2A */ - 0x00, - 0x00, - 0x08, - 0x1c, - 0x3e, - 0x1c, - 0x08, - 0x00, - 0x00, - 0x00 - }, - { /* 0x2B */ - 0x00, - 0x00, - 0x08, - 0x08, - 0x3e, - 0x08, - 0x08, - 0x00, - 0x00, - 0x00 - }, - { /* 0x2C */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x18, - 0x18, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0x2D */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x3e, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x2E */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x18, - 0x18, - 0x00, - 0x00 - }, - { /* 0x2F */ - 0x00, - 0x00, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x00, - 0x00, - 0x00 - }, - { /* 0x30 */ - 0x00, - 0x0c, - 0x12, - 0x12, - 0x12, - 0x12, - 0x12, - 0x0c, - 0x00, - 0x00 - }, - { /* 0x31 */ - 0x00, - 0x08, - 0x18, - 0x08, - 0x08, - 0x08, - 0x08, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x32 */ - 0x00, - 0x1c, - 0x22, - 0x02, - 0x1c, - 0x20, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x33 */ - 0x00, - 0x1c, - 0x22, - 0x02, - 0x0c, - 0x02, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x34 */ - 0x00, - 0x04, - 0x0c, - 0x14, - 0x24, - 0x3e, - 0x04, - 0x04, - 0x00, - 0x00 - }, - { /* 0x35 */ - 0x00, - 0x3e, - 0x20, - 0x3c, - 0x02, - 0x02, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x36 */ - 0x00, - 0x0c, - 0x10, - 0x20, - 0x3c, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x37 */ - 0x00, - 0x3e, - 0x02, - 0x04, - 0x08, - 0x10, - 0x10, - 0x10, - 0x00, - 0x00 - }, - { /* 0x38 */ - 0x00, - 0x1c, - 0x22, - 0x22, - 0x1c, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x39 */ - 0x00, - 0x1c, - 0x22, - 0x22, - 0x1e, - 0x02, - 0x04, - 0x18, - 0x00, - 0x00 - }, - { /* 0x3A */ - 0x00, - 0x00, - 0x18, - 0x18, - 0x00, - 0x18, - 0x18, - 0x00, - 0x00, - 0x00 - }, - { /* 0x3B */ - 0x00, - 0x18, - 0x18, - 0x00, - 0x18, - 0x18, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0x3C */ - 0x00, - 0x02, - 0x04, - 0x08, - 0x10, - 0x08, - 0x04, - 0x02, - 0x00, - 0x00 - }, - { /* 0x3D */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x00, - 0x3e, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x3E */ - 0x00, - 0x20, - 0x10, - 0x08, - 0x04, - 0x08, - 0x10, - 0x20, - 0x00, - 0x00 - }, - { /* 0x3F */ - 0x00, - 0x1c, - 0x22, - 0x04, - 0x08, - 0x08, - 0x00, - 0x08, - 0x00, - 0x00 - }, - { /* 0x40 */ - 0x00, - 0x1c, - 0x22, - 0x2e, - 0x2a, - 0x2e, - 0x20, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x41 */ - 0x00, - 0x1c, - 0x22, - 0x22, - 0x3e, - 0x22, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* 0x42 */ - 0x00, - 0x3c, - 0x12, - 0x12, - 0x1c, - 0x12, - 0x12, - 0x3c, - 0x00, - 0x00 - }, - { /* 0x43 */ - 0x00, - 0x1c, - 0x22, - 0x20, - 0x20, - 0x20, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x44 */ - 0x00, - 0x3c, - 0x12, - 0x12, - 0x12, - 0x12, - 0x12, - 0x3c, - 0x00, - 0x00 - }, - { /* 0x45 */ - 0x00, - 0x3e, - 0x20, - 0x20, - 0x3c, - 0x20, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x46 */ - 0x00, - 0x3e, - 0x20, - 0x20, - 0x3c, - 0x20, - 0x20, - 0x20, - 0x00, - 0x00 - }, - { /* 0x47 */ - 0x00, - 0x1e, - 0x20, - 0x20, - 0x2e, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x48 */ - 0x00, - 0x22, - 0x22, - 0x22, - 0x3e, - 0x22, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* 0x49 */ - 0x00, - 0x1c, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x4A */ - 0x00, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x4B */ - 0x00, - 0x22, - 0x24, - 0x28, - 0x30, - 0x28, - 0x24, - 0x22, - 0x00, - 0x00 - }, - { /* 0x4C */ - 0x00, - 0x20, - 0x20, - 0x20, - 0x20, - 0x20, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x4D */ - 0x00, - 0x22, - 0x36, - 0x2a, - 0x22, - 0x22, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* 0x4E */ - 0x00, - 0x22, - 0x32, - 0x2a, - 0x26, - 0x22, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* 0x4F */ - 0x00, - 0x3e, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x50 */ - 0x00, - 0x3c, - 0x22, - 0x22, - 0x3c, - 0x20, - 0x20, - 0x20, - 0x00, - 0x00 - }, - { /* 0x51 */ - 0x00, - 0x3e, - 0x22, - 0x22, - 0x22, - 0x2a, - 0x24, - 0x3a, - 0x00, - 0x00 - }, - { /* 0x52 */ - 0x00, - 0x3c, - 0x22, - 0x22, - 0x3c, - 0x28, - 0x24, - 0x22, - 0x00, - 0x00 - }, - { /* 0x53 */ - 0x00, - 0x1c, - 0x20, - 0x10, - 0x08, - 0x04, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x54 */ - 0x00, - 0x3e, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x00, - 0x00 - }, - { /* 0x55 */ - 0x00, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x56 */ - 0x00, - 0x22, - 0x22, - 0x22, - 0x14, - 0x14, - 0x08, - 0x08, - 0x00, - 0x00 - }, - { /* 0x57 */ - 0x00, - 0x22, - 0x22, - 0x22, - 0x2a, - 0x2a, - 0x2a, - 0x14, - 0x00, - 0x00 - }, - { /* 0x58 */ - 0x00, - 0x22, - 0x22, - 0x14, - 0x08, - 0x14, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* 0x59 */ - 0x00, - 0x22, - 0x22, - 0x14, - 0x08, - 0x08, - 0x08, - 0x08, - 0x00, - 0x00 - }, - { /* 0x5A */ - 0x00, - 0x3e, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x5B */ - 0x00, - 0x0e, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x0e, - 0x00, - 0x00 - }, - { /* 0x5C */ - 0x00, - 0x00, - 0x20, - 0x10, - 0x08, - 0x04, - 0x02, - 0x00, - 0x00, - 0x00 - }, - { /* 0x5D */ - 0x00, - 0x38, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x38, - 0x00, - 0x00 - }, - { /* 0x5E */ - 0x00, - 0x08, - 0x14, - 0x22, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x5F */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x60 */ - 0x00, - 0x10, - 0x08, - 0x04, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x61 */ - 0x00, - 0x00, - 0x00, - 0x1c, - 0x22, - 0x3e, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* 0x62 */ - 0x00, - 0x00, - 0x00, - 0x3c, - 0x12, - 0x1c, - 0x12, - 0x3c, - 0x00, - 0x00 - }, - { /* 0x63 */ - 0x00, - 0x00, - 0x00, - 0x1e, - 0x20, - 0x20, - 0x20, - 0x1e, - 0x00, - 0x00 - }, - { /* 0x64 */ - 0x00, - 0x00, - 0x00, - 0x3c, - 0x12, - 0x12, - 0x12, - 0x3c, - 0x00, - 0x00 - }, - { /* 0x65 */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x20, - 0x3c, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x66 */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x20, - 0x3c, - 0x20, - 0x20, - 0x00, - 0x00 - }, - { /* 0x67 */ - 0x00, - 0x00, - 0x00, - 0x1e, - 0x20, - 0x2e, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x68 */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x22, - 0x3e, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* 0x69 */ - 0x00, - 0x00, - 0x00, - 0x1c, - 0x08, - 0x08, - 0x08, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x6A */ - 0x00, - 0x00, - 0x00, - 0x0e, - 0x04, - 0x04, - 0x24, - 0x3c, - 0x00, - 0x00 - }, - { /* 0x6B */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x24, - 0x38, - 0x24, - 0x22, - 0x00, - 0x00 - }, - { /* 0x6C */ - 0x00, - 0x00, - 0x00, - 0x20, - 0x20, - 0x20, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x6D */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x36, - 0x2a, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* 0x6E */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x32, - 0x2a, - 0x26, - 0x22, - 0x00, - 0x00 - }, - { /* 0x6F */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x22, - 0x22, - 0x22, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x70 */ - 0x00, - 0x00, - 0x00, - 0x3c, - 0x22, - 0x3c, - 0x20, - 0x20, - 0x00, - 0x00 - }, - { /* 0x71 */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x22, - 0x2a, - 0x24, - 0x3a, - 0x00, - 0x00 - }, - { /* 0x72 */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x22, - 0x3e, - 0x24, - 0x22, - 0x00, - 0x00 - }, - { /* 0x73 */ - 0x00, - 0x00, - 0x00, - 0x1e, - 0x20, - 0x1c, - 0x02, - 0x3c, - 0x00, - 0x00 - }, - { /* 0x74 */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x08, - 0x08, - 0x08, - 0x08, - 0x00, - 0x00 - }, - { /* 0x75 */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x22, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0x76 */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x22, - 0x24, - 0x28, - 0x10, - 0x00, - 0x00 - }, - { /* 0x77 */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x22, - 0x2a, - 0x36, - 0x22, - 0x00, - 0x00 - }, - { /* 0x78 */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x14, - 0x08, - 0x14, - 0x22, - 0x00, - 0x00 - }, - { /* 0x79 */ - 0x00, - 0x00, - 0x00, - 0x22, - 0x14, - 0x08, - 0x08, - 0x08, - 0x00, - 0x00 - }, - { /* 0x7A */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x04, - 0x08, - 0x10, - 0x3e, - 0x00, - 0x00 - }, - { /* 0x7B */ - 0x00, - 0x06, - 0x08, - 0x08, - 0x10, - 0x08, - 0x08, - 0x06, - 0x00, - 0x00 - }, - { /* 0x7C */ - 0x00, - 0x08, - 0x08, - 0x08, - 0x00, - 0x08, - 0x08, - 0x08, - 0x00, - 0x00 - }, - { /* 0x7D */ - 0x00, - 0x30, - 0x08, - 0x08, - 0x04, - 0x08, - 0x08, - 0x30, - 0x00, - 0x00 - }, - { /* 0x7E */ - 0x00, - 0x10, - 0x2a, - 0x04, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x7F */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - - -/* 128 additional characters for Japanese terminals */ - { /* 0x80 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c - }, - { /* 0x81 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c - }, - { /* 0x82 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x83 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x84 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x85 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x86 */ - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x87 */ - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x88 */ - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x89 */ - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x8A */ - 0x00, - 0x00, - 0x00, - 0x1f, - 0x1f, - 0x1f, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x8B */ - 0x1c, - 0x1c, - 0x1c, - 0x7c, - 0x7c, - 0x7c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x8C */ - 0x00, - 0x00, - 0x00, - 0x7f, - 0x7f, - 0x7f, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x8D */ - 0x1c, - 0x1c, - 0x1c, - 0x1f, - 0x1f, - 0x1f, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x8E */ - 0x01, - 0x03, - 0x06, - 0x04, - 0x08, - 0x08, - 0x10, - 0x30, - 0x30, - 0x20 - }, - { /* 0x8F */ - 0x00, - 0x00, - 0x7f, - 0x00, - 0x00, - 0x00, - 0x7f, - 0x00, - 0x00, - 0x00 - }, - { /* 0x90 */ - 0x00, - 0x00, - 0x00, - 0x40, - 0x40, - 0x40, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x91 */ - 0x00, - 0x00, - 0x00, - 0x60, - 0x60, - 0x60, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x92 */ - 0x00, - 0x00, - 0x00, - 0x70, - 0x70, - 0x70, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x93 */ - 0x00, - 0x00, - 0x00, - 0x78, - 0x78, - 0x78, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x94*/ - 0x00, - 0x00, - 0x00, - 0x7c, - 0x7c, - 0x7c, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x95 */ - 0x00, - 0x00, - 0x00, - 0x7e, - 0x7e, - 0x7e, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x96 */ - 0x00, - 0x00, - 0x00, - 0x7f, - 0x7f, - 0x7f, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x97*/ - 0x00, - 0x00, - 0x00, - 0x1c, - 0x1c, - 0x1c, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x98 */ - 0x1c, - 0x1c, - 0x1c, - 0x7f, - 0x7f, - 0x7f, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x99 */ - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f, - 0x7f - }, - { /* 0x9A */ - 0x00, - 0x00, - 0x00, - 0x7c, - 0x7c, - 0x7c, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x9B */ - 0x1c, - 0x1c, - 0x1c, - 0x1f, - 0x1f, - 0x1f, - 0x1c, - 0x1c, - 0x1c, - 0x1c - }, - { /* 0x9C */ - 0x1c, - 0x1c, - 0x1c, - 0x7f, - 0x7f, - 0x7f, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x9D */ - 0x1c, - 0x1c, - 0x1c, - 0x7c, - 0x7c, - 0x7c, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0x9E */ - 0x40, - 0x60, - 0x30, - 0x10, - 0x08, - 0x08, - 0x04, - 0x06, - 0x06, - 0x02 - }, - { /* 0x9F */ - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22, - 0x22 - }, - { /* 0xA0 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xA1 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x38, - 0x28, - 0x38, - 0x00, - 0x00 - }, - { /* 0xA2 */ - 0x00, - 0x0e, - 0x08, - 0x08, - 0x08, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xA3 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x08, - 0x08, - 0x08, - 0x38, - 0x00, - 0x00 - }, - { /* 0xA4 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x10, - 0x08, - 0x00, - 0x00 - }, - { /* 0xA5 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x10, - 0x10, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xA6 */ - 0x00, - 0x00, - 0x3e, - 0x02, - 0x1e, - 0x02, - 0x04, - 0x08, - 0x00, - 0x00 - }, - { /* 0xA7 */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x02, - 0x0c, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xA8 */ - 0x00, - 0x00, - 0x00, - 0x04, - 0x08, - 0x18, - 0x28, - 0x08, - 0x00, - 0x00 - }, - { /* 0xA9 */ - 0x00, - 0x00, - 0x00, - 0x08, - 0x3e, - 0x22, - 0x02, - 0x0c, - 0x00, - 0x00 - }, - { /* 0xAA */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x08, - 0x08, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xAB */ - 0x00, - 0x00, - 0x00, - 0x04, - 0x3e, - 0x0c, - 0x14, - 0x24, - 0x00, - 0x00 - }, - { /* 0xAC */ - 0x00, - 0x00, - 0x00, - 0x10, - 0x3e, - 0x12, - 0x14, - 0x10, - 0x00, - 0x00 - }, - { /* 0xAD */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x1c, - 0x04, - 0x04, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xAE */ - 0x00, - 0x00, - 0x00, - 0x3c, - 0x04, - 0x3c, - 0x04, - 0x3c, - 0x00, - 0x00 - }, - { /* 0xAF */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x2a, - 0x2a, - 0x02, - 0x0c, - 0x00, - 0x00 - }, - { /* 0xB0 */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x3e, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xB1 */ - 0x00, - 0x00, - 0x3e, - 0x02, - 0x0c, - 0x08, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xB2 */ - 0x00, - 0x04, - 0x08, - 0x18, - 0x28, - 0x08, - 0x08, - 0x08, - 0x00, - 0x00 - }, - { /* 0xB3 */ - 0x00, - 0x08, - 0x3e, - 0x22, - 0x02, - 0x04, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xB4 */ - 0x00, - 0x00, - 0x3e, - 0x08, - 0x08, - 0x08, - 0x08, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xB5 */ - 0x00, - 0x04, - 0x3e, - 0x04, - 0x0c, - 0x14, - 0x24, - 0x04, - 0x00, - 0x00 - }, - { /* 0xB6 */ - 0x00, - 0x08, - 0x08, - 0x3e, - 0x0a, - 0x0a, - 0x12, - 0x24, - 0x00, - 0x00 - }, - { /* 0xB7 */ - 0x00, - 0x08, - 0x3e, - 0x08, - 0x3e, - 0x08, - 0x08, - 0x08, - 0x00, - 0x00 - }, - { /* 0xB8 */ - 0x00, - 0x00, - 0x1e, - 0x12, - 0x22, - 0x04, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xB9 */ - 0x00, - 0x10, - 0x10, - 0x1e, - 0x24, - 0x04, - 0x04, - 0x08, - 0x00, - 0x00 - }, - { /* 0xBA */ - 0x00, - 0x00, - 0x3e, - 0x02, - 0x02, - 0x02, - 0x02, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xBB */ - 0x00, - 0x14, - 0x3e, - 0x14, - 0x14, - 0x04, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xBC */ - 0x00, - 0x00, - 0x30, - 0x00, - 0x32, - 0x02, - 0x04, - 0x38, - 0x00, - 0x00 - }, - { /* 0xBD */ - 0x00, - 0x00, - 0x3e, - 0x02, - 0x04, - 0x08, - 0x14, - 0x22, - 0x00, - 0x00 - }, - { /* 0xBE */ - 0x00, - 0x10, - 0x3e, - 0x12, - 0x14, - 0x10, - 0x10, - 0x1e, - 0x00, - 0x00 - }, - { /* 0xBF */ - 0x00, - 0x00, - 0x22, - 0x22, - 0x12, - 0x02, - 0x04, - 0x18, - 0x00, - 0x00 - }, - { /* 0xC0 */ - 0x00, - 0x00, - 0x1e, - 0x12, - 0x2a, - 0x04, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xC1 */ - 0x00, - 0x04, - 0x38, - 0x08, - 0x3e, - 0x08, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xC2 */ - 0x00, - 0x00, - 0x2a, - 0x2a, - 0x2a, - 0x02, - 0x04, - 0x08, - 0x00, - 0x00 - }, - { /* 0xC3 */ - 0x00, - 0x00, - 0x1c, - 0x00, - 0x3e, - 0x08, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xC4 */ - 0x00, - 0x10, - 0x10, - 0x10, - 0x18, - 0x14, - 0x10, - 0x10, - 0x00, - 0x00 - }, - { /* 0xC5 */ - 0x00, - 0x08, - 0x08, - 0x3e, - 0x08, - 0x08, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xC6 */ - 0x00, - 0x00, - 0x1c, - 0x00, - 0x00, - 0x00, - 0x00, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xC7 */ - 0x00, - 0x00, - 0x3e, - 0x02, - 0x14, - 0x08, - 0x14, - 0x20, - 0x00, - 0x00 - }, - { /* 0xC8 */ - 0x00, - 0x08, - 0x3e, - 0x04, - 0x08, - 0x1c, - 0x2a, - 0x08, - 0x00, - 0x00 - }, - { /* 0xC9 */ - 0x00, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xCA */ - 0x00, - 0x00, - 0x04, - 0x02, - 0x12, - 0x12, - 0x12, - 0x22, - 0x00, - 0x00 - }, - { /* 0xCB */ - 0x00, - 0x00, - 0x20, - 0x20, - 0x3e, - 0x20, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xCC */ - 0x00, - 0x00, - 0x3e, - 0x02, - 0x02, - 0x04, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xCD */ - 0x00, - 0x00, - 0x10, - 0x28, - 0x04, - 0x02, - 0x02, - 0x00, - 0x00, - 0x00 - }, - { /* 0xCE */ - 0x00, - 0x08, - 0x3e, - 0x08, - 0x2a, - 0x2a, - 0x2a, - 0x08, - 0x00, - 0x00 - }, - { /* 0xCF */ - 0x00, - 0x00, - 0x3e, - 0x02, - 0x02, - 0x14, - 0x08, - 0x04, - 0x00, - 0x00 - }, - { /* 0xD0 */ - 0x00, - 0x10, - 0x0e, - 0x00, - 0x0e, - 0x00, - 0x10, - 0x0e, - 0x00, - 0x00 - }, - { /* 0xD1 */ - 0x00, - 0x00, - 0x04, - 0x08, - 0x10, - 0x22, - 0x3e, - 0x02, - 0x00, - 0x00 - }, - { /* 0xD2 */ - 0x00, - 0x00, - 0x02, - 0x02, - 0x14, - 0x08, - 0x14, - 0x20, - 0x00, - 0x00 - }, - { /* 0xD3 */ - 0x00, - 0x00, - 0x3c, - 0x10, - 0x3e, - 0x10, - 0x10, - 0x1e, - 0x00, - 0x00 - }, - { /* 0xD4 */ - 0x00, - 0x10, - 0x10, - 0x3e, - 0x12, - 0x14, - 0x10, - 0x10, - 0x00, - 0x00 - }, - { /* 0xD5 */ - 0x00, - 0x00, - 0x1c, - 0x04, - 0x04, - 0x04, - 0x04, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xD6 */ - 0x00, - 0x00, - 0x3e, - 0x02, - 0x3e, - 0x02, - 0x02, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xD7 */ - 0x00, - 0x00, - 0x1c, - 0x00, - 0x3e, - 0x02, - 0x02, - 0x0c, - 0x00, - 0x00 - }, - { /* 0xD8 */ - 0x00, - 0x00, - 0x12, - 0x12, - 0x12, - 0x02, - 0x04, - 0x08, - 0x00, - 0x00 - }, - { /* 0xD9 */ - 0x00, - 0x00, - 0x28, - 0x28, - 0x28, - 0x2a, - 0x2a, - 0x2c, - 0x00, - 0x00 - }, - { /* 0xDA */ - 0x00, - 0x00, - 0x20, - 0x20, - 0x22, - 0x24, - 0x28, - 0x30, - 0x00, - 0x00 - }, - { /* 0xDB */ - 0x00, - 0x00, - 0x3e, - 0x22, - 0x22, - 0x22, - 0x22, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xDC */ - 0x00, - 0x00, - 0x3e, - 0x22, - 0x22, - 0x02, - 0x04, - 0x08, - 0x00, - 0x00 - }, - { /* 0xDD */ - 0x00, - 0x00, - 0x30, - 0x00, - 0x02, - 0x02, - 0x04, - 0x38, - 0x00, - 0x00 - }, - { /* 0xDE */ - 0x00, - 0x28, - 0x28, - 0x28, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xDF */ - 0x00, - 0x38, - 0x28, - 0x38, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xE0 */ - 0x00, - 0x1c, - 0x22, - 0x04, - 0x08, - 0x08, - 0x00, - 0x08, - 0x00, - 0x00 - }, - { /* 0xE1 */ - 0x00, - 0x18, - 0x18, - 0x18, - 0x18, - 0x00, - 0x18, - 0x18, - 0x00, - 0x00 - }, - { /* 0xE2 */ - 0x00, - 0x14, - 0x14, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xE3 */ - 0x00, - 0x00, - 0x14, - 0x36, - 0x00, - 0x36, - 0x14, - 0x00, - 0x00, - 0x00 - }, - { /* 0xE4 */ - 0x00, - 0x1c, - 0x2a, - 0x28, - 0x1c, - 0x0a, - 0x2a, - 0x1c, - 0x00, - 0x00 - }, - { /* 0xE5 */ - 0x00, - 0x30, - 0x32, - 0x04, - 0x08, - 0x10, - 0x26, - 0x06, - 0x00, - 0x00 - }, - { /* 0xE6 */ - 0x00, - 0x10, - 0x28, - 0x28, - 0x10, - 0x2a, - 0x24, - 0x1a, - 0x00, - 0x00 - }, - { /* 0xE7 */ - 0x00, - 0x04, - 0x08, - 0x10, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xE8 */ - 0x00, - 0x02, - 0x04, - 0x08, - 0x08, - 0x08, - 0x04, - 0x02, - 0x00, - 0x00 - }, - { /* 0xE9 */ - 0x00, - 0x20, - 0x10, - 0x08, - 0x08, - 0x08, - 0x10, - 0x20, - 0x00, - 0x00 - }, - { /* 0xEA */ - 0x00, - 0x00, - 0x08, - 0x1c, - 0x3e, - 0x1c, - 0x08, - 0x00, - 0x00, - 0x00 - }, - { /* 0xEB */ - 0x00, - 0x00, - 0x08, - 0x08, - 0x3e, - 0x08, - 0x08, - 0x00, - 0x00, - 0x00 - }, - { /* 0xEC */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x18, - 0x18, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xED */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x3e, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xEE */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x18, - 0x18, - 0x00, - 0x00 - }, - { /* 0xEF */ - 0x00, - 0x00, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x00, - 0x00, - 0x00 - }, - { /* 0xF0 */ - 0x00, - 0x0c, - 0x12, - 0x12, - 0x12, - 0x12, - 0x12, - 0x0c, - 0x00, - 0x00 - }, - { /* 0xF1 */ - 0x00, - 0x08, - 0x18, - 0x08, - 0x08, - 0x08, - 0x08, - 0x1c, - 0x00, - 0x00 - }, - { /* 0xF2 */ - 0x00, - 0x1c, - 0x22, - 0x02, - 0x1c, - 0x20, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* 0xF3 */ - 0x00, - 0x1c, - 0x22, - 0x02, - 0x0c, - 0x02, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0xF4 */ - 0x00, - 0x04, - 0x0c, - 0x14, - 0x24, - 0x3e, - 0x04, - 0x04, - 0x00, - 0x00 - }, - { /* 0xF5 */ - 0x00, - 0x3e, - 0x20, - 0x3c, - 0x02, - 0x02, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0xF6 */ - 0x00, - 0x0c, - 0x10, - 0x20, - 0x3c, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0xF7 */ - 0x00, - 0x3e, - 0x02, - 0x04, - 0x08, - 0x10, - 0x10, - 0x10, - 0x00, - 0x00 - }, - { /* 0xF8 */ - 0x00, - 0x1c, - 0x22, - 0x22, - 0x1c, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* 0xF9 */ - 0x00, - 0x1c, - 0x22, - 0x22, - 0x1e, - 0x02, - 0x04, - 0x18, - 0x00, - 0x00 - }, - { /* 0xFA */ - 0x00, - 0x00, - 0x18, - 0x18, - 0x00, - 0x18, - 0x18, - 0x00, - 0x00, - 0x00 - }, - { /* 0xFB */ - 0x00, - 0x18, - 0x18, - 0x00, - 0x18, - 0x18, - 0x08, - 0x10, - 0x00, - 0x00 - }, - { /* 0xFC */ - 0x00, - 0x02, - 0x04, - 0x08, - 0x10, - 0x08, - 0x04, - 0x02, - 0x00, - 0x00 - }, - { /* 0xFD */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x00, - 0x3e, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* 0xFE */ - 0x00, - 0x20, - 0x10, - 0x08, - 0x04, - 0x08, - 0x10, - 0x20, - 0x00, - 0x00 - }, - { /* 0xFF */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - - -/* extra symbols for various national terminals, which use slightly modified -variants of the US character set */ - { /* pound */ - 0x00, - 0x0c, - 0x12, - 0x10, - 0x38, - 0x10, - 0x3a, - 0x34, - 0x00, - 0x00 - }, - { /* yen */ - 0x00, - 0x22, - 0x14, - 0x08, - 0x3e, - 0x08, - 0x3e, - 0x08, - 0x00, - 0x00 - }, - { /* auml */ - 0x00, - 0x00, - 0x22, - 0x00, - 0x1c, - 0x22, - 0x3e, - 0x22, - 0x00, - 0x00 - }, - { /* Auml */ - 0x00, - 0x22, - 0x00, - 0x1c, - 0x22, - 0x3e, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* Aring */ - 0x00, - 0x08, - 0x00, - 0x1c, - 0x22, - 0x3e, - 0x22, - 0x22, - 0x00, - 0x00 - }, - { /* uuml */ - 0x00, - 0x00, - 0x22, - 0x00, - 0x22, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* aring */ - 0x00, - 0x00, - 0x08, - 0x00, - 0x1c, - 0x22, - 0x3e, - 0x22, - 0x00, - 0x00 - }, - - { /* Uuml */ - 0x00, - 0x22, - 0x00, - 0x22, - 0x22, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - - { /* ouml */ - 0x00, - 0x00, - 0x22, - 0x00, - 0x3e, - 0x22, - 0x22, - 0x3e, - 0x00, - 0x00 - }, - { /* Ouml */ - 0x00, - 0x22, - 0x00, - 0x3e, - 0x22, - 0x22, - 0x22, - 0x3e, - 0x00, - 0x00 - }, - { /* szlig */ - 0x00, - 0x18, - 0x24, - 0x24, - 0x2c, - 0x22, - 0x22, - 0x2c, - 0x00, - 0x00 - }, - { /* aelig */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x28, - 0x3e, - 0x28, - 0x2e, - 0x00, - 0x00 - }, - { /* AElig */ - 0x00, - 0x3e, - 0x28, - 0x28, - 0x3e, - 0x28, - 0x28, - 0x2e, - 0x00, - 0x00 - }, - { /* Oslash */ - 0x00, - 0x00, - 0x00, - 0x3e, - 0x26, - 0x2a, - 0x32, - 0x3e, - 0x00, - 0x00 - }, - { /* oslash */ - 0x00, - 0x3e, - 0x22, - 0x26, - 0x2a, - 0x32, - 0x22, - 0x3e, - 0x00, - 0x00 - }, -/* WARNING: I have created the next 8 French character matrices from scratch, -as I have no printout of the original matrices. */ - { /* agrave */ - 0x00, - 0x10, - 0x08, - 0x00, - 0x1c, - 0x22, - 0x3e, - 0x22, - 0x00, - 0x00 - }, - { /* deg */ - 0x00, - 0x38, - 0x28, - 0x38, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }, - { /* ccedil */ - 0x00, - 0x00, - 0x00, - 0x1e, - 0x20, - 0x20, - 0x20, - 0x1e, - 0x08, - 0x04 - }, - { /* sect */ - 0x00, - 0x1c, - 0x20, - 0x1c, - 0x22, - 0x1c, - 0x02, - 0x1c, - 0x00, - 0x00 - }, - { /* egrave */ - 0x00, - 0x10, - 0x08, - 0x3e, - 0x20, - 0x3c, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* ugrave */ - 0x00, - 0x10, - 0x08, - 0x22, - 0x22, - 0x22, - 0x22, - 0x1c, - 0x00, - 0x00 - }, - { /* eacute */ - 0x00, - 0x04, - 0x08, - 0x3e, - 0x20, - 0x3c, - 0x20, - 0x3e, - 0x00, - 0x00 - }, - { /* uml */ - 0x00, - 0x22, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - } -}; diff --git a/src/mess/video/911_key.h b/src/mess/video/911_key.h deleted file mode 100644 index 108bf85fd7d..00000000000 --- a/src/mess/video/911_key.h +++ /dev/null @@ -1,4028 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - key translation table for both US and UK terminals - - The only difference is that the US # character is a Pound character in UK. -*/ -static const unsigned char US_key_translate[4][91] = -{ - { /* lower case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x5F, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x71, - 0x77, - 0x65, - 0x72, - 0x74, - 0x79, - 0x75, - 0x69, - 0x6F, - 0x70, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x61, - 0x73, - 0x64, - 0x66, - 0x67, - 0x68, - 0x6A, - 0x6B, - 0x6C, - 0x3B, - 0x27, - 0, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x7A, - 0x78, - 0x63, - 0x76, - 0x62, - 0x6E, - 0x6D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* upper case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x5F, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x3B, - 0x27, - 0, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* shifted */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x21, - 0x40, - 0x23, - 0x24, - 0x25, - 0x5E, - 0x26, - 0x2A, - 0x28, - 0x29, - 0x5B, - 0x5D, - 0x3D, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x8A, - 0x8C, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x3A, - 0x22, - 0, - 0x83, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x3C, - 0x3E, - 0x3F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* control */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x90, - 0x91, - 0x00, - 0xA1, - 0x8D, - 0x8E, - 0x8F, - 0x7C, - 0x60, - 0x7E, - 0x1D, - 0x7F, - 0x5C, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x11, - 0x17, - 0x05, - 0x12, - 0x14, - 0x19, - 0x15, - 0x09, - 0x0F, - 0x10, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x01, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0A, - 0x0B, - 0x0C, - 0x7B, - 0x7D, - 0, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x1A, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0E, - 0x0D, - 0x1C, - 0x1E, - 0x1F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - } -}; - - -/* - key translation table for French terminals -*/ -static const unsigned char French_key_translate[4][91] = -{ - { /* lower case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x5F, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x61, - 0x7A, - 0x65, - 0x72, - 0x74, - 0x79, - 0x75, - 0x69, - 0x6F, - 0x70, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x71, - 0x73, - 0x64, - 0x66, - 0x67, - 0x68, - 0x6A, - 0x6B, - 0x6C, - 0x6D, - 0x27, - 0, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x77, - 0x78, - 0x63, - 0x76, - 0x62, - 0x6E, - 0x3B, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0 - }, - { /* upper case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x5F, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x41, - 0x5A, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x51, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x4D, - 0x27, - 0, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x57, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x3B, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0 - }, - { /* shifted */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x21, - 0x40, - 0x23, - 0x24, - 0x25, - 0x5E, - 0x26, - 0x2A, - 0x28, - 0x29, - 0x5B, - 0x5D, - 0x3D, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x41, - 0x5A, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x8A, - 0x8C, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x51, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x4D, - 0x22, - 0, - 0x83, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x57, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x3A, - 0x3C, - 0x3E, - 0x3F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0 - }, - { /* control */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x90, - 0x91, - 0x00, - 0xA1, - 0x8D, - 0x8E, - 0x8F, - 0x7C, - 0x60, - 0x7E, - 0x1D, - 0x7F, - 0x5C, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x01, - 0x1A, - 0x05, - 0x12, - 0x14, - 0x19, - 0x15, - 0x09, - 0x0F, - 0x10, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x11, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0A, - 0x0B, - 0x0C, - 0x0D, - 0x7D, - 0, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x17, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0E, - 0x7B, - 0x1C, - 0x1E, - 0x1F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0 - } -}; - - -/* - key translation table for German terminals -*/ -static const unsigned char German_key_translate[4][91] = -{ - { /* lower case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x7E, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x71, - 0x77, - 0x65, - 0x72, - 0x74, - 0x7A, - 0x75, - 0x69, - 0x6F, - 0x70, - 0x7D, - 0x88, - 0x87, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x61, - 0x73, - 0x64, - 0x66, - 0x67, - 0x68, - 0x6A, - 0x6B, - 0x6C, - 0x7C, - 0x7B, - 0x3B, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x79, - 0x78, - 0x63, - 0x76, - 0x62, - 0x6E, - 0x6D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* upper case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x27, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x5A, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x5D, - 0x88, - 0x87, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x5C, - 0x5B, - 0x3B, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x59, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* shifted */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x21, - 0x40, - 0x23, - 0x24, - 0x25, - 0x5E, - 0x26, - 0x2A, - 0x28, - 0x29, - 0x5F, - 0x3D, - 0x22, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x5A, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x5D, - 0x8A, - 0x8C, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x5C, - 0x5B, - 0x3A, - 0x83, /* 945423-9701 rev. B says 0x85, but it must be a mistake */ - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x59, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x3C, - 0x3E, - 0x3F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* control */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x90, - 0x91, - 0x00, - 0xA1, - 0x8D, - 0x8E, - 0x8F, - 0x7C, - 0x60, - 0x00, - 0x1D, - 0x7F, - 0x00, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x11, - 0x17, - 0x05, - 0x12, - 0x14, - 0x1A, - 0x15, - 0x09, - 0x0F, - 0x10, - 0x00, - 0x88, - 0x87, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x01, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0A, - 0x0B, - 0x0C, - 0x00, - 0x00, - 0x00, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x19, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0E, - 0x0D, - 0x1C, - 0x1E, - 0x1F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - } -}; - - -/* - key translation table for Swedish/Finnish terminals -*/ -static const unsigned char Swedish_key_translate[4][91] = -{ - { /* lower case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x7E, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x71, - 0x77, - 0x65, - 0x72, - 0x74, - 0x79, - 0x75, - 0x69, - 0x6F, - 0x70, - 0x7D, - 0x88, - 0x87, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x61, - 0x73, - 0x64, - 0x66, - 0x67, - 0x68, - 0x6A, - 0x6B, - 0x6C, - 0x7C, - 0x7B, - 0x3B, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x7A, - 0x78, - 0x63, - 0x76, - 0x62, - 0x6E, - 0x6D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* upper case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x27, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x5D, - 0x88, - 0x87, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x5C, - 0x5B, - 0x3B, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* shifted */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x21, - 0x40, - 0x23, - 0x24, - 0x25, - 0x5E, - 0x26, - 0x2A, - 0x28, - 0x29, - 0x5F, - 0x3D, - 0x22, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x5D, - 0x8A, - 0x8C, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x5C, - 0x5B, - 0x3A, - 0x83, /* 945423-9701 rev. B says 0x85, but it must be a mistake */ - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x3C, - 0x3E, - 0x3F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* control */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x90, - 0x91, - 0x00, - 0xA1, - 0x8D, - 0x8E, - 0x8F, - 0x00, - 0x60, - 0x00, - 0x1D, - 0x7F, - 0x00, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x11, - 0x17, - 0x05, - 0x12, - 0x14, - 0x19, - 0x15, - 0x09, - 0x0F, - 0x10, - 0x00, - 0x88, - 0x87, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x01, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0A, - 0x0B, - 0x0C, - 0x00, - 0x00, - 0x00, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x1A, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0E, - 0x0D, - 0x1C, - 0x1E, - 0x1F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - } -}; - - -/* - key translation table for Norwegian/Danish terminals -*/ -static const unsigned char Norwegian_key_translate[4][91] = -{ - { /* lower case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x27, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x71, - 0x77, - 0x65, - 0x72, - 0x74, - 0x79, - 0x75, - 0x69, - 0x6F, - 0x70, - 0x7D, - 0x88, - 0x87, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x61, - 0x73, - 0x64, - 0x66, - 0x67, - 0x68, - 0x6A, - 0x6B, - 0x6C, - 0x7B, - 0x7C, - 0x3B, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x7A, - 0x78, - 0x63, - 0x76, - 0x62, - 0x6E, - 0x6D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* upper case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x27, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x5D, - 0x88, - 0x87, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x5B, - 0x5C, - 0x3B, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* shifted */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x21, - 0x40, - 0x23, - 0x24, - 0x25, - 0x5E, - 0x26, - 0x2A, - 0x28, - 0x29, - 0x5F, - 0x3D, - 0x22, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x5D, - 0x8A, /* 945423-9701 rev. B says 0x88, but it must be a mistake */ - 0x8C, /* 945423-9701 rev. B says 0x87, but it must be a mistake */ - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x5B, - 0x5C, - 0x3A, - 0x83, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x3C, - 0x3E, - 0x3F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - }, - { /* control */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x90, - 0x91, - 0x00, - 0xA1, - 0x8D, - 0x8E, - 0x8F, - 0x00, - 0x60, - 0x00, - 0x1D, - 0x7F, - 0x00, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x11, - 0x17, - 0x05, - 0x12, - 0x14, - 0x19, - 0x15, - 0x09, - 0x0F, - 0x10, - 0x00, - 0x88, /* 945423-9701 rev. B says 0x8A, but it must be a mistake */ - 0x87, /* 945423-9701 rev. B says 0x8C, but it must be a mistake */ - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x01, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0A, - 0x0B, - 0x0C, - 0x00, - 0x00, - 0x00, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x1A, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0E, - 0x0D, - 0x1C, - 0x1E, - 0x1F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0x0D - } -}; - - -/* - key translation table for Japanese katakana terminals -*/ -static const unsigned char Japanese_key_translate[6][91] = -{ - { /* lower case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x5F, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x71, - 0x77, - 0x65, - 0x72, - 0x74, - 0x79, - 0x75, - 0x69, - 0x6F, - 0x70, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x61, - 0x73, - 0x64, - 0x66, - 0x67, - 0x68, - 0x6A, - 0x6B, - 0x6C, - 0x3B, - 0x27, - 0x5C, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x7A, - 0x78, - 0x63, - 0x76, - 0x62, - 0x6E, - 0x6D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* upper case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x5F, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x3B, - 0x27, - 0x5C, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* shifted */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x21, - 0x40, - 0x23, - 0x24, - 0x25, - 0x5E, - 0x26, - 0x2A, - 0x28, - 0x29, - 0x5B, - 0x5D, - 0x3D, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x8A, - 0x8C, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x3A, - 0x22, - 0x00, - 0x83, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x3C, - 0x3E, - 0x3F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* control */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x90, - 0x91, - 0x00, - 0xA1, - 0x8D, - 0x8E, - 0x8F, - 0x7C, - 0x60, - 0x7E, - 0x1D, - 0x7F, - 0x5C, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays the back quote character, whereas it actually display the Yen symbol) */ - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x11, - 0x17, - 0x05, - 0x12, - 0x14, - 0x19, - 0x15, - 0x09, - 0x0F, - 0x10, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x01, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0A, - 0x0B, - 0x0C, - 0x7B, - 0x7D, - 0x00, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x1A, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0E, - 0x0D, - 0x1C, - 0x1E, - 0x1F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* katakana */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0xC7, - 0xCC, - 0xB1, - 0xB3, - 0xB4, - 0xB5, - 0xD4, - 0xD5, - 0xD6, - 0xDC, - 0xCE, - 0xCD, - 0xDB, - 0x1B, /* 945423-9701 rev. B says 0x00, but it must be a mistake */ - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0xC0, - 0xC3, - 0xB2, - 0xBD, - 0xB6, - 0xDD, - 0xC5, - 0xC6, - 0xD7, - 0xBE, - 0x88, /* 945423-9701 rev. B says 0x00, but it must be a mistake */ - 0x87, /* 945423-9701 rev. B says 0x00, but it must be a mistake */ - 0x0D, /* 945423-9701 rev. B says 0x00, but it must be a mistake */ - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0xC1, - 0xC4, - 0xBC, - 0xCA, - 0xB7, - 0xB8, - 0xCF, - 0xC9, - 0xD8, /* 945423-9701 rev. B says 0xC8, but it must be a mistake */ - 0xDA, - 0xB9, - 0xD1, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0xC2, - 0xBB, - 0xBF, - 0xCB, - 0xBA, - 0xD0, - 0xD3, - 0xC8, - 0xD9, - 0xD2, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* shifted katakana */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x00, - 0x00, - 0xA7, - 0xA9, - 0xAA, - 0xAB, - 0xAC, - 0xAD, - 0xAE, - 0xA6, - 0xDE, - 0xDF, - 0xB0, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x00, - 0x00, - 0xAB, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x8A, - 0x8C, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xA2, - 0xA3, - 0x83, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0xAF, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xA4, - 0xA1, - 0xA5, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - } -}; - - -#if 0 -/* - key translation table for Arabic terminals -*/ -static const unsigned char Arabic_key_translate[6][91] = -{ - { /* lower case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x5F, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x71, - 0x77, - 0x65, - 0x72, - 0x74, - 0x79, - 0x75, - 0x69, - 0x6F, - 0x70, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x61, - 0x73, - 0x64, - 0x66, - 0x67, - 0x68, - 0x6A, - 0x6B, - 0x6C, - 0x3B, - 0x27, - 0x5C, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x7A, - 0x78, - 0x63, - 0x76, - 0x62, - 0x6E, - 0x6D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* upper case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x2B, - 0x2D, - 0x5F, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x3B, - 0x27, - 0x5C, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x2C, - 0x2E, - 0x2F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* shifted */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x21, - 0x40, - 0x23, - 0x24, - 0x25, - 0x5E, - 0x26, - 0x2A, - 0x28, - 0x29, - 0x5B, - 0x5D, - 0x3D, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x51, - 0x57, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x8A, - 0x8C, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x41, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x3A, - 0x22, - 0x00, - 0x83, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x5A, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x4D, - 0x3C, - 0x3E, - 0x3F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* control */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x90, - 0x91, - 0x00, - 0xA1, - 0x8D, - 0x8E, - 0x8F, - 0x7C, - 0x60, - 0x7E, - 0x1D, - 0x7F, - 0x5C, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x11, - 0x17, - 0x05, - 0x12, - 0x14, - 0x19, - 0x15, - 0x09, - 0x0F, - 0x10, - 0x88, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x01, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0A, - 0x0B, - 0x0C, - 0x7B, - 0x7D, - 0x00, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x1A, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0E, - 0x0D, - 0x1C, - 0x1E, - 0x1F, - 0, - - 0x30, - 0x2E, - - 0, - 0x20, - 0 - }, - { /* arabic */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0xC7, - 0xCC, - 0xB1, - 0xB3, - 0xB4, - 0xB5, - 0xD4, - 0xD5, - 0xD6, - 0xDC, - 0xCE, - 0xCD, - 0xDB, - 0x1B, - - 0x37, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x38, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x39, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0xC0, - 0xC3, - 0xB2, - 0xBD, - 0xB6, - 0xDD, - 0xC5, - 0xC6, - 0xD7, - 0xBE, - 0x88, - 0x87, - 0x0D, - - 0x34, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x35, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x36, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - - - 0x88, - 0x82, - 0x8A, - - 0, - 0xC1, - 0xC4, - 0xBC, - 0xCA, - 0xB7, - 0xB8, - 0xCF, - 0xC9, - 0xD8, - 0xDA, - 0xB9, - 0xD1, - 0x85, - - 0x31, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x32, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x33, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - - - 0x86, - 0x8B, - 0x84, - - 0, - 0xC2, - 0xBB, - 0xBF, - 0xCB, - 0xBA, - 0xD0, - 0xD3, - 0xC8, - 0xD9, - 0xD2, - 0, - - 0x30, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x2E, - - 0, - 0x20, - 0 - }, - { /* shifted arabic */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x00, - 0x00, - 0xA7, - 0xA9, - 0xAA, - 0xAB, - 0xAC, - 0xAD, - 0xAE, - 0xA6, - 0xDE, - 0xDF, - 0xB0, - 0x1B, - - 0x37, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x38, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x39, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x00, - 0x00, - 0xAB, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x8A, - 0x8C, - 0x0D, - - 0x34, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x35, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x36, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xA2, - 0xA3, - 0x83, - - 0x31, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x32, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x33, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - - - 0x86, - 0x8B, - 0x84, - - 0, - 0xAF, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xA4, - 0xA1, - 0xA5, - 0, - - 0x30, /* 945423-9701 rev. B says so, but it might be a mistake (it claims it displays arabic-style digits, whereas it actually displays western-style digits) */ - 0x2E, - - 0, - 0x20, - 0 - } -}; -#endif - - -/* - key translation table for French word-processing terminals -*/ -static const unsigned char FrenchWP_key_translate[4][91] = -{ - { /* lower case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x26, - 0x7B, - 0x22, - 0x27, - 0x28, - 0x5D, - 0x7D, - 0x21, - 0x5C, - 0x40, - 0x29, - 0x2D, - 0x24, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x61, - 0x7A, - 0x65, - 0x72, - 0x74, - 0x79, - 0x75, - 0x69, - 0x6F, - 0x70, - 0x5E, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x71, - 0x73, - 0x64, - 0x66, - 0x67, - 0x68, - 0x6A, - 0x6B, - 0x6C, - 0x6D, - 0x7C, - 0x2A, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x77, - 0x78, - 0x63, - 0x76, - 0x62, - 0x6E, - 0x2C, - 0x3B, - 0x3A, - 0x3D, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0 - }, - { /* upper case */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x5B, - 0x5F, - 0x23, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x41, - 0x5A, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x7E, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x51, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x4D, - 0x25, - 0x60, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x57, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x3F, - 0x2E, - 0x2F, - 0x2B, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0 - }, - { /* shifted */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x31, - 0x32, - 0x33, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x30, - 0x5B, - 0x5F, - 0x23, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x41, - 0x5A, - 0x45, - 0x52, - 0x54, - 0x59, - 0x55, - 0x49, - 0x4F, - 0x50, - 0x7E, - 0x8C, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x51, - 0x53, - 0x44, - 0x46, - 0x47, - 0x48, - 0x4A, - 0x4B, - 0x4C, - 0x4D, - 0x25, - 0x60, - 0x83, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x57, - 0x58, - 0x43, - 0x56, - 0x42, - 0x4E, - 0x3F, - 0x2E, - 0x2F, - 0x2B, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0 - }, - { /* control */ - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9B, - 0x9C, - - - 0x80, - 0x81, - 0x9F, - - 0, - 0x90, - 0x91, - 0x00, - 0xA1, - 0x8D, - 0x8E, - 0x8F, - 0x3C, - 0x3E, - 0x00, - 0x1D, - 0x7F, - 0x00, - 0x1B, - - 0x37, - 0x38, - 0x39, - - - 0x9A, - 0x89, - 0, - - 0xA0, - 0x01, - 0x1A, - 0x05, - 0x12, - 0x14, - 0x19, - 0x15, - 0x09, - 0x0F, - 0x10, - 0x00, - 0x87, - 0x0D, - - 0x34, - 0x35, - 0x36, - - - 0x88, - 0x82, - 0x8A, - - 0, - 0x11, - 0x13, - 0x04, - 0x06, - 0x07, - 0x08, - 0x0A, - 0x0B, - 0x0C, - 0x0D, - 0x00, - 0x00, - 0x85, - - 0x31, - 0x32, - 0x33, - - - 0x86, - 0x8B, - 0x84, - - 0, - 0x17, - 0x18, - 0x03, - 0x16, - 0x02, - 0x0E, - 0x00, - 0x1C, - 0x1E, - 0x1F, - 0, - - 0x30, - 0x2C, - - 0, - 0x20, - 0 - } -}; diff --git a/src/mess/video/911_vdt.c b/src/mess/video/911_vdt.c deleted file mode 100644 index c0d30600681..00000000000 --- a/src/mess/video/911_vdt.c +++ /dev/null @@ -1,844 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - TI 911 VDT core. To be operated with the TI 990 line of computers (can be connected to - any model, as communication uses the CRU bus). - - Raphael Nabet 2002 - -TODO: - * add more flexibility, so that we can create multiple-terminal configurations. - * support test mode??? -*/ - - -#include "emu.h" -#include "911_vdt.h" -#include "911_chr.h" -#include "911_key.h" - -#define MAX_VDT 1 - -static const gfx_layout fontlayout_7bit = -{ - 7, 10, /* 7*10 characters */ - 128, /* 128 characters */ - 1, /* 1 bit per pixel */ - { 0 }, - { 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 10*8 /* every char takes 10 consecutive bytes */ -}; - -static const gfx_layout fontlayout_8bit = -{ - 7, 10, /* 7*10 characters */ - 128, /* 128 characters */ - 1, /* 1 bit per pixel */ - { 0 }, - { 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 10*8 /* every char takes 10 consecutive bytes */ -}; - -static GFXDECODE_START( vdt911 ) - // Caution: Array must use same order as vdt911_model_t - // US - GFXDECODE_ENTRY( vdt911_chr_region, vdt911_US_chr_offset, fontlayout_7bit, 0, 4 ) - - // UK - GFXDECODE_ENTRY( vdt911_chr_region, vdt911_UK_chr_offset, fontlayout_7bit, 0, 4 ) - - // French (without accented characters) - GFXDECODE_ENTRY( vdt911_chr_region, vdt911_US_chr_offset, fontlayout_7bit, 0, 4 ) - - // German - GFXDECODE_ENTRY( vdt911_chr_region, vdt911_german_chr_offset, fontlayout_7bit, 0, 4 ) - - // Swedish - GFXDECODE_ENTRY( vdt911_chr_region, vdt911_swedish_chr_offset, fontlayout_7bit, 0, 4 ) - - // Norwegian - GFXDECODE_ENTRY( vdt911_chr_region, vdt911_norwegian_chr_offset, fontlayout_7bit, 0, 4 ) - - // Japanese - GFXDECODE_ENTRY( vdt911_chr_region, vdt911_japanese_chr_offset, fontlayout_8bit, 0, 4 ) - - // Arabic - // GFXDECODE_ENTRY( vdt911_chr_region, vdt911_arabic_chr_offset, fontlayout_8bit, 0, 4 ) - - // FrenchWP (contains accented characters) - GFXDECODE_ENTRY( vdt911_chr_region, vdt911_frenchWP_chr_offset, fontlayout_7bit, 0, 4 ) -GFXDECODE_END - -static const unsigned char vdt911_colors[] = -{ - 0x00,0x00,0x00, /* black */ - 0xC0,0xC0,0xC0, /* low intensity */ - 0xFF,0xFF,0xFF /* high intensity */ -}; - -static const unsigned short vdt911_palette[] = -{ - 0, 2, /* high intensity */ - 0, 1, /* low intensity */ - 2, 0, /* high intensity, reverse */ - 2, 1 /* low intensity, reverse */ -}; - -/* - Macros for model features -*/ -/* TRUE for Japanese and Arabic terminals, which use 8-bit charcodes and keyboard shift modes */ -#define USES_8BIT_CHARCODES() ((m_model == vdt911_model_Japanese) /*|| (m_model == vdt911_model_Arabic)*/) -/* TRUE for keyboards which have this extra key (on the left of TAB/SKIP) - (Most localized keyboards have it) */ -#define HAS_EXTRA_KEY_67() (! ((m_model == vdt911_model_US) || (m_model == vdt911_model_UK) || (m_model == vdt911_model_French))) -/* TRUE for keyboards which have this extra key (on the right of space), - AND do not use it as a modifier */ -#define HAS_EXTRA_KEY_91() ((m_model == vdt911_model_German) || (m_model == vdt911_model_Swedish) || (m_model == vdt911_model_Norwegian)) - -/* - Initialize vdt911 palette -*/ -PALETTE_INIT_MEMBER(vdt911_device, vdt911) -{ - UINT8 i, r, g, b; - - for ( i = 0; i < 3; i++ ) - { - r = vdt911_colors[i*3]; g = vdt911_colors[i*3+1]; b = vdt911_colors[i*3+2]; - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - for(i=0;i<8;i++) - palette.set_pen_indirect(i, vdt911_palette[i]); -} - -/* - Copy a character bitmap array to another location in memory -*/ -static void copy_character_matrix_array(const UINT8 char_array[128][10], UINT8 *dest) -{ - int i, j; - - for (i=0; i<128; i++) - for (j=0; j<10; j++) - *(dest++) = char_array[i][j]; -} - -/* - Patch a character bitmap array according to an array of char_override_t -*/ -static void apply_char_overrides(int nb_char_overrides, const char_override_t char_overrides[], UINT8 *dest) -{ - int i, j; - - for (i=0; i; - -vdt911_device::vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, VDT911, "911 VDT", tag, owner, clock, "vdt911", __FILE__), - m_beeper(*this, "beeper"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_keyint_line(*this), - m_lineint_line(*this) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void vdt911_device::device_config_complete() -{ -} - -enum -{ - BLINK_TIMER, - BEEP_TIMER, - LINE_TIMER -}; - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void vdt911_device::device_start() -{ - m_last_key_pressed = 0x80; - - m_keyboard_data_ready = false; - m_display_enable = false; - m_blink_state = false; - - m_keyint_line.resolve(); - m_lineint_line.resolve(); - - /* set up cursor blink clock. 2Hz frequency -> .25s half-period. */ - /*m_blink_clock =*/ - - // m_beeper->set_frequency(2000); - - m_blink_timer = timer_alloc(BLINK_TIMER); - m_beep_timer = timer_alloc(BEEP_TIMER); - m_line_timer = timer_alloc(LINE_TIMER); - - m_blink_timer->adjust(attotime::from_msec(0), 0, attotime::from_msec(250)); - - UINT8 *base; - UINT8 *chr = machine().root_device().memregion(vdt911_chr_region)->base(); - - /* set up US character definitions */ - base = chr+vdt911_US_chr_offset; - copy_character_matrix_array(char_defs+char_defs_US_base, base); - - /* set up UK character definitions */ - base = chr+vdt911_UK_chr_offset; - copy_character_matrix_array(char_defs+char_defs_US_base, base); - apply_char_overrides(sizeof(UK_overrides)/sizeof(char_override_t), UK_overrides, base); - - /* French character set is identical to US character set */ - - /* set up German character definitions */ - base = chr+vdt911_german_chr_offset; - copy_character_matrix_array(char_defs+char_defs_US_base, base); - apply_char_overrides(sizeof(german_overrides)/sizeof(char_override_t), german_overrides, base); - - /* set up Swedish/Finnish character definitions */ - base = chr+vdt911_swedish_chr_offset; - copy_character_matrix_array(char_defs+char_defs_US_base, base); - apply_char_overrides(sizeof(swedish_overrides)/sizeof(char_override_t), swedish_overrides, base); - - /* set up Norwegian/Danish character definitions */ - base = chr+vdt911_norwegian_chr_offset; - copy_character_matrix_array(char_defs+char_defs_US_base, base); - apply_char_overrides(sizeof(norwegian_overrides)/sizeof(char_override_t), norwegian_overrides, base); - - /* set up French word processing character definitions */ - base = chr+vdt911_frenchWP_chr_offset; - copy_character_matrix_array(char_defs+char_defs_US_base, base); - apply_char_overrides(sizeof(frenchWP_overrides)/sizeof(char_override_t), frenchWP_overrides, base); - - /* set up Katakana Japanese character definitions */ - base = chr+vdt911_japanese_chr_offset; - copy_character_matrix_array(char_defs+char_defs_US_base, base); - apply_char_overrides(sizeof(japanese_overrides)/sizeof(char_override_t), japanese_overrides, base); - base = chr+vdt911_japanese_chr_offset+128*vdt911_single_char_len; - copy_character_matrix_array(char_defs+char_defs_katakana_base, base); - -#if 0 - /* set up Arabic character definitions */ - base = chr+vdt911_arabic_chr_offset; - copy_character_matrix_array(char_defs+char_defs_US_base, base); - apply_char_overrides(sizeof(arabic_overrides)/sizeof(char_override_t), arabic_overrides, base); - base = chr+vdt911_arabic_chr_offset+128*vdt911_single_char_len; - copy_character_matrix_array(char_defs+char_defs_arabic_base, base); -#endif -} - - -void vdt911_device::device_reset() -{ - m_model = (vdt911_model_t)ioport("LOCALE")->read(); - m_screen_size = (vdt911_screen_size_t)ioport("SCREEN")->read(); - - if (m_screen_size == char_960) - m_cursor_address_mask = 0x3ff; /* 1kb of RAM */ - else - m_cursor_address_mask = 0x7ff; /* 2 kb of RAM */ - - m_line_timer->adjust(attotime::from_msec(0), 0, attotime::from_hz(get_refresh_rate())); -} - -/* - Timer callbacks -*/ -void vdt911_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case BLINK_TIMER: - m_blink_state = !m_blink_state; - break; - case BEEP_TIMER: - m_beeper->set_state(0); - break; - case LINE_TIMER: - check_keyboard(); - m_lineint_line(ASSERT_LINE); - m_lineint_line(CLEAR_LINE); - break; - } -} - -/* - CRU interface read -*/ -READ8_MEMBER( vdt911_device::cru_r ) -{ - int reply=0; - - offset &= 0x1; - - if (!m_word_select) - { /* select word 0 */ - switch (offset) - { - case 0: - reply = m_display_RAM[m_cursor_address]; - break; - - case 1: - reply = m_keyboard_data & 0x7f; - if (m_keyboard_data_ready) - reply |= 0x80; - break; - } - } - else - { /* select word 1 */ - switch (offset) - { - case 0: - reply = m_cursor_address & 0xff; - break; - - case 1: - reply = (m_cursor_address >> 8) & 0x07; - if (m_keyboard_data & 0x80) - reply |= 0x08; - /*if (!m_terminal_ready) - reply |= 0x10;*/ - if (m_previous_word_select) - reply |= 0x20; - /*if (m_keyboard_parity_error) - reply |= 0x40;*/ - if (m_keyboard_data_ready) - reply |= 0x80; - break; - } - } - - return reply; -} - -/* - CRU interface write -*/ -WRITE8_MEMBER( vdt911_device::cru_w ) -{ - offset &= 0xf; - - if (!m_word_select) - { /* select word 0 */ - switch (offset) - { - case 0x0: - case 0x1: - case 0x2: - case 0x3: - case 0x4: - case 0x5: - case 0x6: - case 0x7: - /* display memory write data */ - if (data) - m_data_reg |= (1 << offset); - else - m_data_reg &= ~ (1 << offset); - break; - - case 0x8: - /* write data strobe */ - m_display_RAM[m_cursor_address] = m_data_reg; - break; - - case 0x9: - /* test mode */ - /* ... */ - break; - - case 0xa: - /* cursor move */ - if (data) - m_cursor_address--; - else - m_cursor_address++; - m_cursor_address &= m_cursor_address_mask; - break; - - case 0xb: - /* blinking cursor enable */ - m_blinking_cursor_enable = data; - break; - - case 0xc: - /* keyboard interrupt enable */ - m_keyboard_interrupt_enable = data; - m_keyint_line(m_keyboard_interrupt_enable && m_keyboard_data_ready); - break; - - case 0xd: - /* dual intensity enable */ - m_dual_intensity_enable = data; - break; - - case 0xe: - /* display enable */ - m_display_enable = data; - break; - - case 0xf: - /* select word */ - m_previous_word_select = m_word_select; - m_word_select = data; - break; - } - } - else - { /* select word 1 */ - switch (offset) - { - case 0x0: - case 0x1: - case 0x2: - case 0x3: - case 0x4: - case 0x5: - case 0x6: - case 0x7: - case 0x8: - case 0x9: - case 0xa: - /* cursor address */ - if (data) - m_cursor_address |= (1 << offset); - else - m_cursor_address &= ~ (1 << offset); - m_cursor_address &= m_cursor_address_mask; - break; - - case 0xb: - /* not used */ - break; - - case 0xc: - /* display cursor */ - m_display_cursor = data; - break; - - case 0xd: - /* keyboard acknowledge */ - if (m_keyboard_data_ready) - { - m_keyboard_data_ready = 0; - if (m_keyboard_interrupt_enable) - m_keyint_line(CLEAR_LINE); - } - /*m_keyboard_parity_error = 0;*/ - break; - - case 0xe: - /* beep enable strobe - not tested */ - m_beeper->set_state(1); - m_beep_timer->adjust(attotime::from_usec(300)); - break; - - case 0xf: - /* select word */ - m_previous_word_select = m_word_select; - m_word_select = data; - break; - } - } -} - -/* - Video refresh -*/ -void vdt911_device::refresh(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y) -{ - gfx_element *gfx = m_gfxdecode->gfx(m_model); - int height = (m_screen_size == char_960) ? 12 : /*25*/24; - - int use_8bit_charcodes = USES_8BIT_CHARCODES(); - int address = 0; - int i, j; - int cur_char; - int color; - - /*if (use_8bit_charcodes) - color = vdt->dual_intensity_enable ? 1 : 0;*/ - - if (!m_display_enable) - { - rectangle my_rect(x, x + 80*7 - 1, y, y + height*10 - 1); - - bitmap.fill(0, my_rect); - } - else - { - for (i=0; iopaque(bitmap, cliprect, cur_char, color, 0, 0, - x+j*7, y+i*10); - } - } - } -} - -static const unsigned char (*const key_translate[])[91] = -{ /* array must use same order as vdt911_model_t!!! */ - /* US */ - US_key_translate, - /* UK */ - US_key_translate, - /* French */ - French_key_translate, - /* German */ - German_key_translate, - /* Swedish */ - Swedish_key_translate, - /* Norwegian */ - Norwegian_key_translate, - /* Japanese */ - Japanese_key_translate, - /* Arabic */ - /*Arabic_key_translate,*/ - /* FrenchWP */ - FrenchWP_key_translate -}; - -/* - keyboard handler: should be called regularly by machine code, for instance - every Video Blank Interrupt. -*/ -void vdt911_device::check_keyboard() -{ - enum modifier_state_t - { - /* states for Western keyboards and katakana/Arabic keyboards in romaji/Latin mode */ - lower_case = 0, upper_case, shift, control, - /* states for katakana/Arabic keyboards in katakana/Arabic mode */ - foreign, foreign_shift, - /* special value to stop repeat if the modifier state changes */ - special_debounce = -1 - }; - - static unsigned char repeat_timer; - enum { repeat_delay = 5 /* approx. 1/10s */ }; - - UINT16 key_buf[6]; - int i, j; - modifier_state_t modifier_state; - int repeat_mode; - - static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" }; - - /* read current key state */ - for (i = 0; i < 6; i++) - { - key_buf[i] = ioport(keynames[i])->read(); - } - - /* parse modifier keys */ - if ((USES_8BIT_CHARCODES()) - && ((key_buf[5] & 0x0400) || ((!(key_buf[5] & 0x0100)) && m_foreign_mode))) - { /* we are in katakana/Arabic mode */ - m_foreign_mode = true; - - if ((key_buf[4] & 0x0400) || (key_buf[5] & 0x0020)) - modifier_state = foreign_shift; - else - modifier_state = foreign; - } - else - { /* we are using a Western keyboard, or a katakana/Arabic keyboard in - romaji/Latin mode */ - m_foreign_mode = false; - - if (key_buf[3] & 0x0040) - modifier_state = control; - else if ((key_buf[4] & 0x0400) || (key_buf[5] & 0x0020)) - modifier_state = shift; - else if ((key_buf[0] & 0x2000)) - modifier_state = upper_case; - else - modifier_state = lower_case; - } - - - /* test repeat key */ - repeat_mode = key_buf[2] & 0x0002; - - - /* remove modifier keys */ - key_buf[0] &= ~0x2000; - key_buf[2] &= ~0x0002; - key_buf[3] &= ~0x0040; - key_buf[4] &= ~0x0400; - key_buf[5] &= ~0x0120; - - /* remove unused keys */ - if (! HAS_EXTRA_KEY_91()) - key_buf[5] &= ~0x0400; - - if (! HAS_EXTRA_KEY_67()) - key_buf[4] &= ~0x0004; - - - if (! repeat_mode) - /* reset REPEAT timer if the REPEAT key is not pressed */ - repeat_timer = 0; - - if (!(m_last_key_pressed & 0x80) && (key_buf[m_last_key_pressed >> 4] & (1 << (m_last_key_pressed & 0xf)))) - { - /* last key has not been released */ - if (modifier_state == m_last_modifier_state) - { - /* handle REPEAT mode if applicable */ - if ((repeat_mode) && (++repeat_timer == repeat_delay)) - { - if (m_keyboard_data_ready) - { /* keyboard buffer full */ - repeat_timer--; - } - else - { /* repeat current key */ - m_keyboard_data_ready = 1; - repeat_timer = 0; - } - } - } - else - { - repeat_timer = 0; - m_last_modifier_state = special_debounce; - } - } - else - { - m_last_key_pressed = 0x80; - - if (m_keyboard_data_ready) - { /* keyboard buffer full */ - /* do nothing */ - } - else - { - for (i=0; i<6; i++) - { - for (j=0; j<16; j++) - { - if (key_buf[i] & (1 << j)) - { - m_last_key_pressed = (i << 4) | j; - m_last_modifier_state = modifier_state; - - m_keyboard_data = (int)key_translate[m_model][modifier_state][m_last_key_pressed]; - m_keyboard_data_ready = 1; - if (m_keyboard_interrupt_enable) - m_keyint_line(ASSERT_LINE); - return; - } - } - } - } - } -} - -int vdt911_device::get_refresh_rate() -{ - // European models have 50 Hz - return ((m_model == vdt911_model_US) || (m_model == vdt911_model_Japanese))? 60 : 50; -} - -UINT32 vdt911_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - refresh(bitmap, cliprect, 0, 0); - return 0; -} - -INPUT_PORTS_START( vdt911 ) - PORT_START( "LOCALE" ) - PORT_CONFNAME( 0x0f, 0x00, "Terminal language" ) - PORT_CONFSETTING( vdt911_model_US, "English US" ) - PORT_CONFSETTING( vdt911_model_UK, "English UK" ) - PORT_CONFSETTING( vdt911_model_French, "French" ) - PORT_CONFSETTING( vdt911_model_German, "German" ) - PORT_CONFSETTING( vdt911_model_Swedish, "Swedish" ) - PORT_CONFSETTING( vdt911_model_Norwegian, "Norwegian" ) - PORT_CONFSETTING( vdt911_model_Japanese, "Japanese" ) - // PORT_CONFSETTING( vdt911_model_Arabic, "Arabic" ) - PORT_CONFSETTING( vdt911_model_FrenchWP, "French Word Processing" ) - - PORT_START( "SCREEN" ) - PORT_CONFNAME( 0x01, char_960, "Terminal screen size" ) - PORT_CONFSETTING( char_960, "960 chars (12 lines)") - PORT_CONFSETTING( char_1920, "1920 chars (24 lines)") - - PORT_START("KEY0") /* keys 1-16 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CMD") PORT_CODE(KEYCODE_F9) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(red)") PORT_CODE(KEYCODE_F10) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ERASE FIELD") PORT_CODE(KEYCODE_END) \ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ERASE INPUT") PORT_CODE(KEYCODE_PGDN) \ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(grey)") PORT_CODE(KEYCODE_F11) \ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UPPER CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE\ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) \ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) \ - \ - PORT_START("KEY1") /* keys 17-32 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ [") PORT_CODE(KEYCODE_MINUS) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- ]") PORT_CODE(KEYCODE_EQUALS) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_ =") PORT_CODE(KEYCODE_BACKSPACE) \ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) \ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 (numpad)") PORT_CODE(KEYCODE_7_PAD) \ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (numpad)") PORT_CODE(KEYCODE_8_PAD) \ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (numpad)") PORT_CODE(KEYCODE_9_PAD) \ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRINT") PORT_CODE(KEYCODE_PRTSCR) \ - \ - PORT_START("KEY2") /* keys 33-48 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(up)") PORT_CODE(KEYCODE_UP) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_LALT) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER_PAD) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) \ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) \ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) \ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CHAR (left/right)") PORT_CODE(KEYCODE_OPENBRACE) \ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FIELD (left/right)") PORT_CODE(KEYCODE_CLOSEBRACE) \ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) \ - \ - PORT_START("KEY3") /* keys 49-64 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 (numpad)") PORT_CODE(KEYCODE_4_PAD) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 (numpad)") PORT_CODE(KEYCODE_5_PAD) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 (numpad)") PORT_CODE(KEYCODE_6_PAD) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(left)") PORT_CODE(KEYCODE_LEFT) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(right)") PORT_CODE(KEYCODE_RIGHT) \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) \ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) \ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) \ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) \ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) \ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) \ - \ - PORT_START("KEY4") /* keys 65-80 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(not on US keyboard)") PORT_CODE(KEYCODE_BACKSLASH) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SKIP TAB") PORT_CODE(KEYCODE_TAB) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 (numpad)") PORT_CODE(KEYCODE_1_PAD) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 (numpad)") PORT_CODE(KEYCODE_2_PAD) \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 (numpad)") PORT_CODE(KEYCODE_3_PAD) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INS CHAR") PORT_CODE(KEYCODE_INSERT) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(down)") PORT_CODE(KEYCODE_DOWN) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL CHAR") PORT_CODE(KEYCODE_DEL) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) \ - PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) \ - PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) \ - PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) \ - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) \ - PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) \ - \ - PORT_START("KEY5") /* keys 81-91 */ \ - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) \ - PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) \ - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) \ - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) \ - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) \ - PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT) \ - PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 (numpad)") PORT_CODE(KEYCODE_0_PAD) \ - PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (numpad)") PORT_CODE(KEYCODE_DEL_PAD) \ - PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(not on US keyboard)") PORT_CODE(KEYCODE_MINUS_PAD) \ - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) \ - PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(not on US keyboard)") PORT_CODE(KEYCODE_PLUS_PAD) -INPUT_PORTS_END - -static MACHINE_CONFIG_FRAGMENT( vdt911 ) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, vdt911_device, screen_update) - - MCFG_SCREEN_SIZE(560, 280) - MCFG_SCREEN_VISIBLE_AREA(0, 560-1, 0, /*250*/280-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_SPEAKER_STANDARD_MONO("speaker") - MCFG_SOUND_ADD("beeper", BEEP, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.50) - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INDIRECT_ENTRIES(3) - MCFG_PALETTE_INIT_OWNER(vdt911_device, vdt911) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", vdt911) -MACHINE_CONFIG_END - -//------------------------------------------------- -// machine_config_additions - return a pointer to -// the device's machine fragment -//------------------------------------------------- - -machine_config_constructor vdt911_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( vdt911 ); -} - -ioport_constructor vdt911_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( vdt911 ); -} diff --git a/src/mess/video/911_vdt.h b/src/mess/video/911_vdt.h deleted file mode 100644 index 7eb0f55dbc1..00000000000 --- a/src/mess/video/911_vdt.h +++ /dev/null @@ -1,118 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet - -#include "sound/beep.h" - -#define vdt911_chr_region ":gfx1" -enum -{ - /* 10 bytes per character definition */ - vdt911_single_char_len = 10, - - vdt911_US_chr_offset = 0, - vdt911_UK_chr_offset = vdt911_US_chr_offset+128*vdt911_single_char_len, - vdt911_german_chr_offset = vdt911_UK_chr_offset+128*vdt911_single_char_len, - vdt911_swedish_chr_offset = vdt911_german_chr_offset+128*vdt911_single_char_len, - vdt911_norwegian_chr_offset = vdt911_swedish_chr_offset+128*vdt911_single_char_len, - vdt911_frenchWP_chr_offset = vdt911_norwegian_chr_offset+128*vdt911_single_char_len, - vdt911_japanese_chr_offset = vdt911_frenchWP_chr_offset+128*vdt911_single_char_len, - - vdt911_chr_region_len = vdt911_japanese_chr_offset+256*vdt911_single_char_len -}; - -enum vdt911_screen_size_t { char_960 = 0, char_1920 }; -enum vdt911_model_t -{ - vdt911_model_US = 0, - vdt911_model_UK, - vdt911_model_French, - vdt911_model_German, - vdt911_model_Swedish, // Swedish/Finnish - vdt911_model_Norwegian, // Norwegian/Danish - vdt911_model_Japanese, // Katakana Japanese - /*vdt911_model_Arabic,*/ // Arabic - vdt911_model_FrenchWP // French word processing -}; - -class vdt911_device : public device_t -{ -public: - vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_READ8_MEMBER(cru_r); - DECLARE_WRITE8_MEMBER(cru_w); - - DECLARE_PALETTE_INIT(vdt911); - - template static devcb_base &static_set_keyint_callback(device_t &device, _Object object) - { - return downcast(device).m_keyint_line.set_callback(object); - } - - template static devcb_base &static_set_lineint_callback(device_t &device, _Object object) - { - return downcast(device).m_lineint_line.set_callback(object); - } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - // device-level overrides - void device_config_complete(); - void device_start(); - void device_reset(); - - machine_config_constructor device_mconfig_additions() const; - ioport_constructor device_input_ports() const; - - void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - void refresh(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y); - int get_refresh_rate(); - void check_keyboard(); - - vdt911_screen_size_t m_screen_size; // char_960 for 960-char, 12-line model; char_1920 for 1920-char, 24-line model - vdt911_model_t m_model; // country code - - UINT8 m_data_reg; // dt911 write buffer - UINT8 m_display_RAM[2048]; // vdt911 char buffer (1kbyte for 960-char model, 2kbytes for 1920-char model) - - unsigned int m_cursor_address; // current cursor address (controlled by the computer, affects both display and I/O protocol) - unsigned int m_cursor_address_mask; // 1023 for 960-char model, 2047 for 1920-char model - - emu_timer *m_beep_timer; // beep clock (beeps ends when timer times out) - emu_timer *m_blink_timer; // cursor blink clock - emu_timer *m_line_timer; // screen line timer - - UINT8 m_keyboard_data; // last code pressed on keyboard - bool m_keyboard_data_ready; // true if there is a new code in keyboard_data - bool m_keyboard_interrupt_enable; // true when keybord interrupts are enabled - - bool m_display_enable; // screen is black when false - bool m_dual_intensity_enable; // if true, MSBit of ASCII codes controls character highlight - bool m_display_cursor; // if true, the current cursor location is displayed on screen - bool m_blinking_cursor_enable; // if true, the cursor will blink when displayed - bool m_blink_state; // current cursor blink state - - bool m_word_select; // CRU interface mode - bool m_previous_word_select; // value of word_select is saved here - - UINT8 m_last_key_pressed; - int m_last_modifier_state; - char m_foreign_mode; - - required_device m_beeper; - required_device m_gfxdecode; - required_device m_palette; - devcb_write_line m_keyint_line; - devcb_write_line m_lineint_line; -}; - -extern const device_type VDT911; - -#define MCFG_VDT911_KEYINT_HANDLER( _intcallb ) \ - devcb = &vdt911_device::static_set_keyint_callback( *device, DEVCB_##_intcallb ); - -#define MCFG_VDT911_LINEINT_HANDLER( _intcallb ) \ - devcb = &vdt911_device::static_set_lineint_callback( *device, DEVCB_##_intcallb ); diff --git a/src/mess/video/abc1600.c b/src/mess/video/abc1600.c deleted file mode 100644 index 2a312cb3ae7..00000000000 --- a/src/mess/video/abc1600.c +++ /dev/null @@ -1,1259 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Luxor ABC 1600 Mover emulation - -**********************************************************************/ - -#include "includes/abc1600.h" -#include "abc1600.lh" - - - -//************************************************************************** -// CONSTANTS / MACROS -//************************************************************************** - -#define LOG 0 - - -#define SY6845E_TAG "sy6845e" - - -// video RAM -#define VIDEORAM_SIZE 0x40000 -#define VIDEORAM16_MASK 0x3ffff -#define VIDEORAM8_MASK 0x7fffe - - -// flag register -#define L_P BIT(m_flag, 0) -#define BLANK BIT(m_flag, 1) -#define PIX_POL BIT(m_flag, 2) -#define FRAME_POL BIT(m_flag, 3) -#define HOLD_FY BIT(m_flag, 4) -#define HOLD_FX BIT(m_flag, 5) -#define COMP_MOVE BIT(m_flag, 6) -#define REPLACE BIT(m_flag, 7) - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type ABC1600_MOVER = &device_creator; - - -DEVICE_ADDRESS_MAP_START( vram_map, 8, abc1600_mover_device ) - AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(video_ram_r, video_ram_w) -ADDRESS_MAP_END - -DEVICE_ADDRESS_MAP_START( crtc_map, 8, abc1600_mover_device ) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xfe) AM_DEVREADWRITE(SY6845E_TAG, mc6845_device, status_r, address_w) - AM_RANGE(0x01, 0x01) AM_MIRROR(0xfe) AM_DEVREADWRITE(SY6845E_TAG, mc6845_device, register_r, register_w) -ADDRESS_MAP_END - -DEVICE_ADDRESS_MAP_START( io_map, 8, abc1600_mover_device ) - AM_RANGE(0x000, 0x000) AM_MIRROR(0xff) AM_READ(iord0_r) - AM_RANGE(0x000, 0x000) AM_MIRROR(0xf8) AM_WRITE(ldsx_hb_w) - AM_RANGE(0x001, 0x001) AM_MIRROR(0xf8) AM_WRITE(ldsx_lb_w) - AM_RANGE(0x002, 0x002) AM_MIRROR(0xf8) AM_WRITE(ldsy_hb_w) - AM_RANGE(0x003, 0x003) AM_MIRROR(0xf8) AM_WRITE(ldsy_lb_w) - AM_RANGE(0x004, 0x004) AM_MIRROR(0xf8) AM_WRITE(ldtx_hb_w) - AM_RANGE(0x005, 0x005) AM_MIRROR(0xf8) AM_WRITE(ldtx_lb_w) - AM_RANGE(0x006, 0x006) AM_MIRROR(0xf8) AM_WRITE(ldty_hb_w) - AM_RANGE(0x007, 0x007) AM_MIRROR(0xf8) AM_WRITE(ldty_lb_w) - AM_RANGE(0x100, 0x100) AM_MIRROR(0xf8) AM_WRITE(ldfx_hb_w) - AM_RANGE(0x101, 0x101) AM_MIRROR(0xf8) AM_WRITE(ldfx_lb_w) - AM_RANGE(0x102, 0x102) AM_MIRROR(0xf8) AM_WRITE(ldfy_hb_w) - AM_RANGE(0x103, 0x103) AM_MIRROR(0xf8) AM_WRITE(ldfy_lb_w) - AM_RANGE(0x105, 0x105) AM_MIRROR(0xf8) AM_WRITE(wrml_w) - AM_RANGE(0x107, 0x107) AM_MIRROR(0xf8) AM_WRITE(wrdl_w) - AM_RANGE(0x200, 0x200) AM_MIRROR(0xf8) AM_WRITE(wrmask_strobe_hb_w) - AM_RANGE(0x201, 0x201) AM_MIRROR(0xf8) AM_WRITE(wrmask_strobe_lb_w) - AM_RANGE(0x202, 0x202) AM_MIRROR(0xf8) AM_WRITE(enable_clocks_w) - AM_RANGE(0x203, 0x203) AM_MIRROR(0xf8) AM_WRITE(flag_strobe_w) - AM_RANGE(0x204, 0x204) AM_MIRROR(0xf8) AM_WRITE(endisp_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( mover_map, AS_0, 16, abc1600_mover_device ) - AM_RANGE(0x00000, 0x7ffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// ROM( abc1600_mover ) -//------------------------------------------------- - -ROM_START( abc1600_mover ) - ROM_REGION16_BE( 0x2000, "wrmsk", 0 ) - ROM_LOAD16_BYTE( "wrmskl 6490362-01.1g", 0x0001, 0x1000, CRC(bc737538) SHA1(80e2c3757eb7f713018808d6e41ebef612425028) ) - ROM_LOAD16_BYTE( "wrmskh 6490363-01.1j", 0x0000, 0x1000, CRC(6b7c9f0b) SHA1(7155a993adcf08a5a8a2f22becf9fd66fda698be) ) - - ROM_REGION( 0x200, "shinf", 0 ) - ROM_LOAD( "shinf 6490361-01.1f", 0x000, 0x200, CRC(20260f8f) SHA1(29bf49c64e7cc7592e88cde2768ac57c7ce5e085) ) - - ROM_REGION16_BE( 0x40, "drmsk", 0 ) - ROM_LOAD16_BYTE( "drmskl 6490359-01.1k", 0x01, 0x20, CRC(6e71087c) SHA1(0acf67700d6227f4b315cf8fb0fb31c0e7fb9496) ) - ROM_LOAD16_BYTE( "drmskh 6490358-01.1l", 0x00, 0x20, CRC(a4a9a9dc) SHA1(d8575c0335d6021cbb5f7bcd298b41c35294a80a) ) - - ROM_REGION( 0x104, "plds", 0 ) - ROM_LOAD( "drmsk 6490360-01.1m", 0x000, 0x104, CRC(5f7143c1) SHA1(1129917845f8e505998b15288f02bf907487e4ac) ) // mover word mixer @ 1m,1n,1t,2t -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const rom_entry *abc1600_mover_device::device_rom_region() const -{ - return ROM_NAME( abc1600_mover ); -} - - -//------------------------------------------------- -// mc6845 -//------------------------------------------------- - -inline UINT16 abc1600_mover_device::get_crtca(UINT16 ma, UINT8 ra, UINT8 column) -{ - /* - - bit description - - CRTCA0 0 - CRTCA1 0 - CRTCA2 CC1/MA1 - CRTCA3 CC2/MA2 - CRTCA4 CC3/MA3 - CRTCA5 CC4/MA4 - CRTCA6 RA0 - CRTCA7 RA1 - CRTCA8 RA2 - CRTCA9 RA3 - CRTCA10 CR0/MA8 - CRTCA11 CR1/MA9 - CRTCA12 CR2/MA10 - CRTCA13 CR3/MA11 - CRTCA14 CR4/MA12 - CRTCA15 CR5/MA13 - - */ - - UINT8 cc = (ma & 0xff) + column; - UINT8 cr = ma >> 8; - - return (cr << 10) | ((ra & 0x0f) << 6) | ((cc << 1) & 0x3c); -} - -MC6845_UPDATE_ROW(abc1600_mover_device::crtc_update_row) -{ - int x = 0; - const pen_t *pen = m_palette->pens(); - - for (int column = 0; column < x_count; column += 2) - { - UINT16 dma = get_crtca(ma, ra, column); - - // data is read out of video RAM in nibble mode by strobing CAS 4 times - for (int cas = 0; cas < 4; cas++) - { - UINT16 data = read_videoram(dma + cas); - - for (int bit = 0; bit < 16; bit++) - { - int color = ((BIT(data, 15) ^ PIX_POL) && !BLANK) && de; - - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; - - data <<= 1; - } - } - } -} - -MC6845_ON_UPDATE_ADDR_CHANGED( abc1600_mover_device::crtc_update ) -{ -} - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( abc1600_mover ) -//------------------------------------------------- - -static MACHINE_CONFIG_FRAGMENT( abc1600_mover ) - MCFG_DEFAULT_LAYOUT(layout_abc1600) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_UPDATE_DRIVER(abc1600_mover_device, screen_update) - MCFG_SCREEN_SIZE(958, 1067) - MCFG_SCREEN_VISIBLE_AREA(0, 958-1, 0, 1067-1) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") - - MCFG_MC6845_ADD(SY6845E_TAG, SY6845E, SCREEN_TAG, XTAL_64MHz/32) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(32) - MCFG_MC6845_UPDATE_ROW_CB(abc1600_mover_device, crtc_update_row) - MCFG_MC6845_ADDR_CHANGED_CB(abc1600_mover_device, crtc_update) -MACHINE_CONFIG_END - - -//------------------------------------------------- -// machine_config_additions - device-specific -// machine configurations -//------------------------------------------------- - -machine_config_constructor abc1600_mover_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( abc1600_mover ); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// abc1600_mover_device - constructor -//------------------------------------------------- - -abc1600_mover_device::abc1600_mover_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, ABC1600_MOVER, "ABC 1600 Mover", tag, owner, clock, "abc1600mover", __FILE__), - device_memory_interface(mconfig, *this), - m_space_config("vram", ENDIANNESS_BIG, 16, 18, -1, *ADDRESS_MAP_NAME(mover_map)), - m_crtc(*this, SY6845E_TAG), - m_palette(*this, "palette"), - m_wrmsk_rom(*this, "wrmsk"), - m_shinf_rom(*this, "shinf"), - m_drmsk_rom(*this, "drmsk") -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void abc1600_mover_device::device_start() -{ - // state saving - save_item(NAME(m_endisp)); - save_item(NAME(m_clocks_disabled)); - save_item(NAME(m_gmdi)); - save_item(NAME(m_wrm)); - save_item(NAME(m_ms)); - save_item(NAME(m_ds)); - save_item(NAME(m_flag)); - save_item(NAME(m_xsize)); - save_item(NAME(m_ysize)); - save_item(NAME(m_udx)); - save_item(NAME(m_udy)); - save_item(NAME(m_xfrom)); - save_item(NAME(m_xto)); - save_item(NAME(m_yto)); - save_item(NAME(m_ty)); - save_item(NAME(m_mfa)); - save_item(NAME(m_mta)); - save_item(NAME(m_sh)); - save_item(NAME(m_mdor)); - save_item(NAME(m_hold_1w_cyk)); - save_item(NAME(m_wrms0)); - save_item(NAME(m_wrms1)); - save_item(NAME(m_rmc)); - save_item(NAME(m_cmc)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void abc1600_mover_device::device_reset() -{ - // disable display - m_clocks_disabled = 1; - m_endisp = 0; -} - - -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *abc1600_mover_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == AS_0) ? &m_space_config : NULL; -} - - -//------------------------------------------------- -// read_videoram - -//------------------------------------------------- - -inline UINT16 abc1600_mover_device::read_videoram(offs_t offset) -{ - return space().read_word((offset & VIDEORAM16_MASK) << 1); -} - - -//------------------------------------------------- -// write_videoram - -//------------------------------------------------- - -inline void abc1600_mover_device::write_videoram(offs_t offset, UINT16 data, UINT16 mask) -{ - UINT16 old_data = read_videoram(offset); - - space().write_word((offset & VIDEORAM16_MASK) << 1, (data & mask) | (old_data & (mask ^ 0xffff))); -} - - -//------------------------------------------------- -// video_ram_r - -//------------------------------------------------- - -READ8_MEMBER( abc1600_mover_device::video_ram_r ) -{ - offs_t addr = (offset & VIDEORAM8_MASK) >> 1; - UINT8 data = 0; - - if (offset & 0x01) - { - data = read_videoram(addr) & 0xff; - } - else - { - data = read_videoram(addr) >> 8; - } - - return data; -} - - -//------------------------------------------------- -// video_ram_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::video_ram_w ) -{ - offs_t addr = (offset & VIDEORAM8_MASK) >> 1; - - if (offset & 0x01) - { - if (REPLACE) - { - // WRPORT_LB - m_wrm = (m_wrm & 0xff00) | data; - if (LOG) logerror("WRM LB %02x -> %04x\n", data, m_wrm); - } - else - { - // DATAPORT_LB - m_gmdi = (m_gmdi & 0xff00) | data; - if (LOG) logerror("GMDI LB %02x -> %04x\n", data, m_gmdi); - } - - write_videoram(addr, m_gmdi, m_wrm & 0x00ff); - - if (LOG) logerror("Video RAM write LB to %05x : %04x\n", addr, read_videoram(addr)); - } - else - { - if (REPLACE) - { - // WRPORT_HB - m_wrm = (data << 8) | (m_wrm & 0xff); - if (LOG) logerror("WRM HB %02x -> %04x\n", data, m_wrm); - } - else - { - // DATAPORT_HB - m_gmdi = (data << 8) | (m_gmdi & 0xff); - if (LOG) logerror("GMDI HB %02x -> %04x\n", data, m_gmdi); - } - - write_videoram(addr, m_gmdi, m_wrm & 0xff00); - - if (LOG) logerror("Video RAM write HB to %05x : %04x\n", addr, read_videoram(addr)); - } -} - - -//------------------------------------------------- -// iord0_r - -//------------------------------------------------- - -READ8_MEMBER( abc1600_mover_device::iord0_r ) -{ - /* - - bit description - - 0 0 - 1 SCREENPOS - 2 - 3 - 4 - 5 - 6 VSYNC - 7 BUSY - - */ - - UINT8 data = 0; - - // monitor orientation (portrait/landscape) - data |= machine().render().first_target()->view() << 1; - - // vertical sync - data |= m_crtc->vsync_r() << 6; - - return data; -} - - -//------------------------------------------------- -// ldsx_hb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldsx_hb_w ) -{ - /* - - bit description - - 0 XSIZE8 - 1 XSIZE9 - 2 U/D* Y - 3 U/D* X - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("%s LDSX HB: %02x\n", machine().describe_context(), data); - - m_xsize = ((data & 0x03) << 8) | (m_xsize & 0xff); - m_udy = BIT(data, 2); - m_udx = BIT(data, 3); -} - - -//------------------------------------------------- -// ldsx_lb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldsx_lb_w ) -{ - /* - - bit description - - 0 XSIZE0 - 1 XSIZE1 - 2 XSIZE2 - 3 XSIZE3 - 4 XSIZE4 - 5 XSIZE5 - 6 XSIZE6 - 7 XSIZE7 - - */ - - if (LOG) logerror("%s LDSX LB: %02x\n", machine().describe_context(), data); - - m_xsize = (m_xsize & 0x300) | data; -} - - -//------------------------------------------------- -// ldsy_hb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldsy_hb_w ) -{ - /* - - bit description - - 0 YSIZE8 - 1 YSIZE9 - 2 YSIZE10 - 3 YSIZE11 - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("%s LDSY HB: %02x\n", machine().describe_context(), data); - - m_ysize = ((data & 0x0f) << 8) | (m_ysize & 0xff); -} - - -//------------------------------------------------- -// ldsy_lb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldsy_lb_w ) -{ - /* - - bit description - - 0 YSIZE0 - 1 YSIZE1 - 2 YSIZE2 - 3 YSIZE3 - 4 YSIZE4 - 5 YSIZE5 - 6 YSIZE6 - 7 YSIZE7 - - */ - - if (LOG) logerror("%s LDSY LB: %02x\n", machine().describe_context(), data); - - m_ysize = (m_ysize & 0xf00) | data; -} - - -//------------------------------------------------- -// ldtx_hb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldtx_hb_w ) -{ - /* - - bit description - - 0 XTO8, MTA4 - 1 XTO9, MTA5 - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("%s LDTX HB: %02x\n", machine().describe_context(), data); - - m_xto = ((data & 0x03) << 8) | (m_xto & 0xff); - m_mta = (m_mta & 0x3ffcf) | ((data & 0x03) << 4); -} - - -//------------------------------------------------- -// ldtx_lb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldtx_lb_w ) -{ - /* - - bit description - - 0 XTO0 - 1 XTO1 - 2 XTO2 - 3 XTO3 - 4 XTO4, MTA0 - 5 XTO5, MTA1 - 6 XTO6, MTA2 - 7 XTO7, MTA3 - - */ - - if (LOG) logerror("%s LDTX LB: %02x\n", machine().describe_context(), data); - - m_xto = (m_xto & 0x300) | data; - m_mta = (m_mta & 0x3fff0) | (data >> 4); -} - - -//------------------------------------------------- -// ldty_hb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldty_hb_w ) -{ - /* - - bit description - - 0 YTO8, MTA14 - 1 YTO9, MTA15 - 2 YTO10, MTA16 - 3 YTO11, MTA17 - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("%s LDTY HB: %02x\n", machine().describe_context(), data); - - if (L_P) return; - - m_ty = ((data & 0x0f) << 8) | (m_yto & 0xff); - m_yto = ((data & 0x0f) << 8) | (m_yto & 0xff); - m_mta = ((data & 0x0f) << 14) | (m_mta & 0x3fff); -} - - -//------------------------------------------------- -// ldty_lb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldty_lb_w ) -{ - /* - - bit description - - 0 YTO0, MTA6 - 1 YTO1, MTA7 - 2 YTO2, MTA8 - 3 YTO3, MTA9 - 4 YTO4, MTA10 - 5 YTO5, MTA11 - 6 YTO6, MTA12 - 7 YTO7, MTA13 - - */ - - if (LOG) logerror("%s LDTY LB: %02x\n", machine().describe_context(), data); - - if (L_P) return; - - m_ty = (m_ty & 0xf00) | data; - m_yto = (m_yto & 0xf00) | data; - m_mta = (m_mta & 0x3c03f) | (data << 6); -} - - -//------------------------------------------------- -// ldfx_hb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldfx_hb_w ) -{ - /* - - bit description - - 0 XFROM8, MFA4 - 1 XFROM9, MFA5 - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("%s LDFX HB: %02x\n", machine().describe_context(), data); - - m_xfrom = ((data & 0x03) << 8) | (m_xfrom & 0xff); - m_mfa = (m_mfa & 0x3ffcf) | ((data & 0x03) << 4); -} - - -//------------------------------------------------- -// ldfx_lb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldfx_lb_w ) -{ - /* - - bit description - - 0 XFROM0 - 1 XFROM1 - 2 XFROM2 - 3 XFROM3 - 4 XFROM4, MFA0 - 5 XFROM5, MFA1 - 6 XFROM6, MFA2 - 7 XFROM7, MFA3 - - */ - - if (LOG) logerror("%s LDFX LB: %02x\n", machine().describe_context(), data); - - m_xfrom = (m_xfrom & 0x300) | data; - m_mfa = (m_mfa & 0x3fff0) | (data >> 4); -} - - -//------------------------------------------------- -// ldfy_hb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldfy_hb_w ) -{ - /* - - bit description - - 0 MFA14 - 1 MFA15 - 2 MFA16 - 3 MFA17 - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("%s LDFY HB: %02x\n", machine().describe_context(), data); - - m_mfa = ((data & 0x0f) << 14) | (m_mfa & 0x3fff); -} - - -//------------------------------------------------- -// ldfy_lb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::ldfy_lb_w ) -{ - /* - - bit description - - 0 MFA6 - 1 MFA7 - 2 MFA8 - 3 MFA9 - 4 MFA10 - 5 MFA11 - 6 MFA12 - 7 MFA13 - - */ - - if (LOG) logerror("%s LDFY LB: %02x\n", machine().describe_context(), data); - - m_mfa = (m_mfa & 0x3c03f) | (data << 6); - - mover(); -} - - -//------------------------------------------------- -// wrml_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::wrml_w ) -{ - /* - - bit description - - 0 MOVE CYK CLK - 1 DISP CYC SEL / DISP CYK PRE FETCH (+1 PIXCLK) - 2 DATA CLK - 3 _DISP MEM WE - 4 _CAS HB - 5 DTACK CLK / BLANK TEST (+2 PIXCLK) - 6 DISPREC CLK - 7 _RAS HB - - */ - - if (LOG) logerror("MS %u : %02x\n", (offset >> 4) & 0x0f, data); - - if (m_clocks_disabled) - { - m_ms[(offset >> 4) & 0x0f] = data; - } -} - - -//------------------------------------------------- -// wrdl_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::wrdl_w ) -{ - /* - - bit description - - 0 MOVE CYK CLK - 1 DISP CYC SEL / DISP CYK PRE FETCH (+1 PIXCLK) - 2 DATA CLK - 3 _DISP MEM WE - 4 _CAS HB - 5 DTACK CLK / BLANK TEST (+2 PIXCLK) - 6 DISPREC CLK - 7 _RAS HB - - */ - - if (LOG) logerror("WS %u : %02x\n", (offset >> 4) & 0x0f, data); - - if (m_clocks_disabled) - { - m_ds[(offset >> 4) & 0x0f] = data; - } -} - - -//------------------------------------------------- -// wrmask_strobe_hb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::wrmask_strobe_hb_w ) -{ - if (REPLACE) - { - // DATAPORT_HB - m_gmdi = (data << 8) | (m_gmdi & 0xff); - if (LOG) logerror("GMDI HB %04x\n", m_gmdi); - } - else - { - // WRPORT_HB - m_wrm = (data << 8) | (m_wrm & 0xff); - if (LOG) logerror("WRM HB %04x\n", m_gmdi); - } -} - - -//------------------------------------------------- -// wrmask_strobe_lb_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::wrmask_strobe_lb_w ) -{ - if (REPLACE) - { - // DATAPORT_LB - m_gmdi = (m_gmdi & 0xff00) | data; - if (LOG) logerror("GMDI LB %04x\n", m_gmdi); - } - else - { - // WRPORT_LB - m_wrm = (m_wrm & 0xff00) | data; - if (LOG) logerror("WRM LB %04x\n", m_gmdi); - } -} - - -//------------------------------------------------- -// enable_clocks_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::enable_clocks_w ) -{ - if (LOG) logerror("ENABLE CLOCKS\n"); - m_clocks_disabled = 0; -} - - -//------------------------------------------------- -// flag_strobe_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::flag_strobe_w ) -{ - /* - - bit description - - 0 L/_P FLAG - 1 BLANK FLAG - 2 PIX POL - 3 FRAME POL - 4 HOLD FY - 5 HOLD FX - 6 COMP MOVE FLAG - 7 REPLACE/SET & RESET - - */ - - m_flag = data; - if (LOG) logerror("FLAG %02x\n", m_flag); -} - - -//------------------------------------------------- -// endisp_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc1600_mover_device::endisp_w ) -{ - m_endisp = 1; - if (LOG) logerror("ENDISP\n"); -} - - - -//************************************************************************** -// MOVER -//************************************************************************** - -//------------------------------------------------- -// clock_mfa_x - -//------------------------------------------------- - -inline void abc1600_mover_device::clock_mfa_x() -{ - UINT16 mfa_y = m_mfa >> 6; - UINT8 mfa_x = m_mfa & 0x3f; - - if (!HOLD_FX) - { - mfa_x += m_udx ? 1 : -1; - mfa_x &= 0x3f; - } - - m_mfa = (mfa_y << 6) | mfa_x; -} - - -//------------------------------------------------- -// clock_mfa_y - -//------------------------------------------------- - -inline void abc1600_mover_device::clock_mfa_y() -{ - UINT16 mfa_y = m_mfa >> 6; - UINT8 mfa_x = m_mfa & 0x3f; - - if (!HOLD_FY) - { - mfa_y += m_udy ? 1 : -1; - mfa_y &= 0xfff; - } - - m_mfa = (mfa_y << 6) | mfa_x; -} - - -//------------------------------------------------- -// clock_mta_x - -//------------------------------------------------- - -inline void abc1600_mover_device::clock_mta_x() -{ - UINT16 mta_y = m_mta >> 6; - UINT8 mta_x = m_mta & 0x3f; - - mta_x += m_udx ? 1 : -1; - mta_x &= 0x3f; - - m_mta = (mta_y << 6) | mta_x; -} - - -//------------------------------------------------- -// clock_mta_y - -//------------------------------------------------- - -inline void abc1600_mover_device::clock_mta_y() -{ - UINT16 mta_y = m_mta >> 6; - UINT8 mta_x = m_mta & 0x3f; - - mta_y += m_udy ? 1 : -1; - mta_y &= 0xfff; - - m_mta = (mta_y << 6) | mta_x; -} - - -//------------------------------------------------- -// load_mfa_x - -//------------------------------------------------- - -inline void abc1600_mover_device::load_mfa_x() -{ - UINT16 mfa_y = m_mfa >> 6; - UINT8 mfa_x = m_xfrom >> 4; - - m_mfa = (mfa_y << 6) | mfa_x; -} - - -//------------------------------------------------- -// load_mta_x - -//------------------------------------------------- - -inline void abc1600_mover_device::load_mta_x() -{ - UINT16 mta_y = m_mta >> 6; - UINT8 mta_x = m_xto >> 4; - - m_mta = (mta_y << 6) | mta_x; -} - - -//------------------------------------------------- -// load_xy_reg - -//------------------------------------------------- - -inline void abc1600_mover_device::load_xy_reg() -{ - if (L_P) return; - - UINT16 sum = m_xto + m_xsize; - - m_xto = sum & 0x3ff; - m_yto = m_ty & 0xfff; - m_mta = (m_ty << 6) | (sum >> 4); -} - - -//------------------------------------------------- -// compare_mta_x - -//------------------------------------------------- - -inline void abc1600_mover_device::compare_mta_x() -{ - UINT8 mta_x_end = ((m_xto + m_xsize) >> 4) & 0x3f; - UINT8 mta_x = m_mta & 0x3f; - - if (mta_x == mta_x_end) - { - m_cmc = 0; - } - - m_wrms1 = m_cmc & m_amm; -} - - -//------------------------------------------------- -// compare_mta_y - -//------------------------------------------------- - -inline void abc1600_mover_device::compare_mta_y() -{ - int mta_y_end = (m_yto + m_ysize) & 0xfff; - UINT16 mta_y = m_mta >> 6; - - if (mta_y == mta_y_end) - { - m_rmc = 0; - } -} - - -//------------------------------------------------- -// get_shinf - -//------------------------------------------------- - -inline void abc1600_mover_device::get_shinf() -{ - /* - - bit description - - A0 XFROM0 - A1 XFROM1 - A2 XFROM2 - A3 XFROM3 - A4 XTO0 - A5 XTO1 - A6 XTO2 - A7 XTO3 - A8 U/D* X - - */ - - UINT16 shinf_addr = (m_udx << 8) | ((m_xto & 0x0f) << 4) | (m_xfrom & 0x0f); - UINT8 shinf = m_shinf_rom[shinf_addr]; - - m_sh = shinf & 0x0f; - m_hold_1w_cyk = BIT(shinf, 5); -} - - -//------------------------------------------------- -// get_drmsk - -//------------------------------------------------- - -inline UINT16 abc1600_mover_device::get_drmsk() -{ - /* - - bit description - - A0 SH0 - A1 SH1 - A2 SH2 - A3 SH3 - A4 U/D* X - - */ - - UINT16 drmsk_addr = (m_udx << 4) | (m_sh & 0x0f); - return m_drmsk_rom[drmsk_addr]; -} - - -//------------------------------------------------- -// get_wrmsk - get mover write mask -//------------------------------------------------- - -inline UINT16 abc1600_mover_device::get_wrmsk() -{ - /* - - bit description - - A0 XTO0 - A1 XTO1 - A2 XTO2 - A3 XTO3 - A4 XSIZE0 - A5 XSIZE1 - A6 XSIZE2 - A7 XSIZE3 - A8 U/D* X - A9 ANDED MASKS - A10 WRMS0 - A11 WRMS1 - - */ - - UINT16 wrmsk_addr = (m_wrms1 << 11) | (m_wrms0 << 10) | ((!m_wrms1 && !m_wrms0) << 9) | (m_udx << 8) | ((m_xsize & 0x0f) << 4) | (m_xto & 0x0f); - return m_wrmsk_rom[wrmsk_addr] ^ 0xffff; -} - - -//------------------------------------------------- -// barrel_shift - -//------------------------------------------------- - -inline UINT16 abc1600_mover_device::barrel_shift(UINT16 gmdr) -{ - UINT16 rot = gmdr; - - for (int sh = 0; sh < m_sh; sh++) - { - int msb = BIT(rot, 15); - rot <<= 1; - rot |= msb; - } - - return rot; -} - - -//------------------------------------------------- -// word_mixer - -//------------------------------------------------- - -inline UINT16 abc1600_mover_device::word_mixer(UINT16 rot) -{ - UINT16 drmsk = get_drmsk(); - UINT16 gmdi = (rot & drmsk) | (m_mdor & (drmsk ^ 0xffff)); - - if (COMP_MOVE) - { - gmdi ^= 0xffff; - } - - m_mdor = rot; - - return gmdi; -} - - -//------------------------------------------------- -// mover - -//------------------------------------------------- - -void abc1600_mover_device::mover() -{ - if (LOG) logerror("XFROM %u XSIZE %u YSIZE %u XTO %u YTO %u MFA %05x MTA %05x U/D*X %u U/D*Y %u\n", m_xfrom, m_xsize, m_ysize, m_xto, m_yto, m_mfa, m_mta, m_udx, m_udy); - - m_amm = 1; - - m_rmc = 1; - get_shinf(); - - do - { - compare_mta_y(); - - load_mfa_x(); - load_mta_x(); - m_cmc = 1; - m_wrms0 = 0; - - if (m_hold_1w_cyk) - { - // read one word in advance - UINT16 gmdr = read_videoram(m_mfa); - UINT16 rot = barrel_shift(gmdr); - word_mixer(rot); - - clock_mfa_x(); - } - - do - { - compare_mta_x(); - - UINT16 gmdr = read_videoram(m_mfa); - UINT16 rot = barrel_shift(gmdr); - UINT16 gmdi = word_mixer(rot); - UINT16 mask = get_wrmsk(); - - write_videoram(m_mta, gmdi, mask); - - clock_mfa_x(); - clock_mta_x(); - - m_wrms0 = 1; - } - while (m_cmc); - - clock_mfa_y(); - clock_mta_y(); - } - while (m_rmc); - - load_xy_reg(); - - m_amm = 0; -} - -UINT32 abc1600_mover_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - if (m_endisp) - { - bitmap.fill(m_palette->pen(FRAME_POL), cliprect); - m_crtc->screen_update(screen, bitmap, cliprect); - } - else - { - bitmap.fill(rgb_t::black, cliprect); - } - - return 0; -} diff --git a/src/mess/video/abc1600.h b/src/mess/video/abc1600.h deleted file mode 100644 index 172967c783d..00000000000 --- a/src/mess/video/abc1600.h +++ /dev/null @@ -1,151 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Luxor ABC 1600 Mover emulation - -**********************************************************************/ - -#pragma once - -#ifndef __ABC1600_MOVER__ -#define __ABC1600_MOVER__ - -#include "emu.h" -#include "video/mc6845.h" - - - -///************************************************************************* -// INTERFACE CONFIGURATION MACROS -///************************************************************************* - -#define ABC1600_MOVER_TAG "mover" - - -#define MCFG_ABC1600_MOVER_ADD() \ - MCFG_DEVICE_ADD(ABC1600_MOVER_TAG, ABC1600_MOVER, 0) - - - -///************************************************************************* -// TYPE DEFINITIONS -///************************************************************************* - -// ======================> abc1600_mover_device - -class abc1600_mover_device : public device_t, - public device_memory_interface -{ -public: - // construction/destruction - abc1600_mover_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - - virtual DECLARE_ADDRESS_MAP(vram_map, 8); - virtual DECLARE_ADDRESS_MAP(crtc_map, 8); - virtual DECLARE_ADDRESS_MAP(io_map, 8); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - MC6845_UPDATE_ROW(crtc_update_row); - MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; - -private: - inline UINT16 get_drmsk(); - inline void get_shinf(); - inline UINT16 get_wrmsk(); - inline UINT16 barrel_shift(UINT16 gmdr); - inline UINT16 word_mixer(UINT16 rot); - inline void clock_mfa_x(); - inline void clock_mfa_y(); - inline void clock_mta_x(); - inline void clock_mta_y(); - inline void load_mfa_x(); - inline void load_mta_x(); - inline void compare_mta_x(); - inline void compare_mta_y(); - inline void load_xy_reg(); - void mover(); - - DECLARE_READ8_MEMBER( video_ram_r ); - DECLARE_WRITE8_MEMBER( video_ram_w ); - - DECLARE_READ8_MEMBER( iord0_r ); - DECLARE_WRITE8_MEMBER( ldsx_hb_w ); - DECLARE_WRITE8_MEMBER( ldsx_lb_w ); - DECLARE_WRITE8_MEMBER( ldsy_hb_w ); - DECLARE_WRITE8_MEMBER( ldsy_lb_w ); - DECLARE_WRITE8_MEMBER( ldtx_hb_w ); - DECLARE_WRITE8_MEMBER( ldtx_lb_w ); - DECLARE_WRITE8_MEMBER( ldty_hb_w ); - DECLARE_WRITE8_MEMBER( ldty_lb_w ); - DECLARE_WRITE8_MEMBER( ldfx_hb_w ); - DECLARE_WRITE8_MEMBER( ldfx_lb_w ); - DECLARE_WRITE8_MEMBER( ldfy_hb_w ); - DECLARE_WRITE8_MEMBER( ldfy_lb_w ); - DECLARE_WRITE8_MEMBER( wrml_w ); - DECLARE_WRITE8_MEMBER( wrdl_w ); - DECLARE_WRITE8_MEMBER( wrmask_strobe_hb_w ); - DECLARE_WRITE8_MEMBER( wrmask_strobe_lb_w ); - DECLARE_WRITE8_MEMBER( enable_clocks_w ); - DECLARE_WRITE8_MEMBER( flag_strobe_w ); - DECLARE_WRITE8_MEMBER( endisp_w ); - - inline UINT16 read_videoram(offs_t offset); - inline void write_videoram(offs_t offset, UINT16 data, UINT16 mask); - inline UINT16 get_crtca(UINT16 ma, UINT8 ra, UINT8 column); - - const address_space_config m_space_config; - - required_device m_crtc; - required_device m_palette; - required_region_ptr m_wrmsk_rom; - required_region_ptr m_shinf_rom; - required_region_ptr m_drmsk_rom; - - int m_endisp; // enable display - int m_clocks_disabled; // clocks disabled - UINT16 m_gmdi; // video RAM data latch - UINT16 m_wrm; // write mask latch - UINT8 m_ms[16]; // mover sequence control - UINT8 m_ds[16]; // display sequence control - UINT8 m_flag; // flags - UINT16 m_xsize; // X size - UINT16 m_ysize; // Y size - int m_udx; // up/down X - int m_udy; // up/down Y - UINT16 m_xfrom; // X from - UINT16 m_xto; // X to - UINT16 m_yto; // Y to - UINT16 m_ty; // to Y - UINT32 m_mfa; // mover from address - UINT32 m_mta; // mover to address - UINT8 m_sh; // - UINT16 m_mdor; // - int m_hold_1w_cyk; // - int m_wrms0; // - int m_wrms1; // - int m_rmc; // row match count - int m_cmc; // column match count - int m_amm; // active mover mask -}; - - -// device type definition -extern const device_type ABC1600_MOVER; - - - -#endif diff --git a/src/mess/video/abc80.c b/src/mess/video/abc80.c deleted file mode 100644 index 30272f3b0ea..00000000000 --- a/src/mess/video/abc80.c +++ /dev/null @@ -1,205 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/***************************************************************************** - * - * video/abc80.c - * - ****************************************************************************/ - -#include "emu.h" -#include "includes/abc80.h" - - - -//------------------------------------------------- -// gfx_layout charlayout -//------------------------------------------------- - -static const gfx_layout charlayout = -{ - 6, 10, - 128, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 10*8 -}; - - -//------------------------------------------------- -// GFXDECODE( abc80 ) -//------------------------------------------------- - -static GFXDECODE_START( abc80 ) - GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 1 ) // normal characters - GFXDECODE_ENTRY( "chargen", 0x500, charlayout, 0, 1 ) // graphics characters -GFXDECODE_END - - -//------------------------------------------------- -// update_screen - -//------------------------------------------------- - -void abc80_state::update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int c = 0; - int r = 0; - int mode = 0; - - for (int y = 0; y < 312; y++) - { - UINT8 vsync_data = m_vsync_prom->base()[y]; - UINT8 l = m_line_prom->base()[y]; - int dv = (vsync_data & ABC80_K2_DV) ? 1 : 0; - - if (!(vsync_data & ABC80_K2_FRAME_RESET)) - { - // reset F2 - r = 0; - } - - for (int sx = 0; sx < 64; sx++) - { - UINT8 hsync_data = m_hsync_prom->base()[sx]; - int dh = (hsync_data & ABC80_K5_DH) ? 1 : 0; - UINT8 data = 0; - - if (hsync_data & ABC80_K5_LINE_END) - { - // reset F4 - c = 0; - - // reset J5 - mode = 0; - } - - /* - - Video RAM Addressing Scheme - - A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 - R2 R1 R0 xx xx xx xx C2 C1 C0 - - A6 A5 A4 A3 = 00 C5 C4 C3 + R4 R3 R4 R3 - - */ - - int a = (c >> 3) & 0x07; - int b = ((r >> 1) & 0x0c) | ((r >> 3) & 0x03); - int s = (a + b) & 0x0f; - UINT16 videoram_addr = ((r & 0x07) << 7) | (s << 3) | (c & 0x07); - UINT8 videoram_data = m_latch; - UINT8 attr_addr = ((dh & dv) << 7) | (videoram_data & 0x7f); - UINT8 attr_data = m_attr_prom->base()[attr_addr]; - - int blank = (attr_data & ABC80_J3_BLANK) ? 1 : 0; - int j = (attr_data & ABC80_J3_TEXT) ? 1 : 0; - int k = (attr_data & ABC80_J3_GRAPHICS) ? 1 : 0; - int versal = (attr_data & ABC80_J3_VERSAL) ? 1 : 0; - int cursor = (videoram_data & ABC80_CHAR_CURSOR) ? 1 : 0; - - if (!j && k) mode = 0; - if (j && !k) mode = 1; - if (j && k) mode = !mode; - - if (mode & versal) - { - // graphics mode - int r0 = 1, r1 = 1, r2 = 1; - - if (l < 3) r0 = 0; else if (l < 7) r1 = 0; else r2 = 0; - - int c0 = BIT(videoram_data, 0) | r0; - int c1 = BIT(videoram_data, 1) | r0; - int c2 = BIT(videoram_data, 2) | r1; - int c3 = BIT(videoram_data, 3) | r1; - int c4 = BIT(videoram_data, 4) | r2; - int c5 = BIT(videoram_data, 6) | r2; - - if (!(c0 & c2 & c4)) data |= 0xe0; - if (!(c1 & c3 & c5)) data |= 0x1c; - } - else - { - // text mode - UINT16 chargen_addr = ((videoram_data & 0x7f) * 10) + l; - - data = m_char_rom->base()[chargen_addr]; - } - - // shift out pixels - for (int bit = 0; bit < 6; bit++) - { - int color = BIT(data, 7); - int x = (sx * 6) + bit; - - color ^= (cursor & m_blink); - color &= blank; - - bitmap.pix32(y, x) = m_palette->pen(color); - - data <<= 1; - } - - m_latch = m_video_ram[videoram_addr]; - - if (hsync_data & ABC80_K5_ROW_START) - { - // clock F4 - c++; - } - } - - if (vsync_data & ABC80_K2_FRAME_END) - { - // clock F2 - r++; - } - } -} - - -void abc80_state::video_start() -{ - screen_device *screen = machine().device(SCREEN_TAG); - - // start timers - m_pio_timer = timer_alloc(TIMER_ID_PIO); - m_pio_timer->adjust(screen->time_until_pos(0, 0), 0, screen->scan_period()); - - m_blink_timer = timer_alloc(TIMER_ID_BLINK); - m_blink_timer->adjust(attotime::from_hz(XTAL_11_9808MHz/2/6/64/312/16), 0, attotime::from_hz(XTAL_11_9808MHz/2/6/64/312/16)); - - m_vsync_on_timer = timer_alloc(TIMER_ID_VSYNC_ON); - m_vsync_on_timer->adjust(screen->time_until_pos(0, 0), 0, screen->frame_period()); - - m_vsync_off_timer = timer_alloc(TIMER_ID_VSYNC_OFF); - m_vsync_off_timer->adjust(screen->time_until_pos(16, 0), 0, screen->frame_period()); - - // allocate memory - m_video_ram.allocate(0x400); -} - - -UINT32 abc80_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - update_screen(bitmap, cliprect); - - return 0; -} - - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( abc80_video ) -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( abc80_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(abc80_state, screen_update) - - MCFG_SCREEN_RAW_PARAMS(XTAL_11_9808MHz/2, ABC80_HTOTAL, ABC80_HBEND, ABC80_HBSTART, ABC80_VTOTAL, ABC80_VBEND, ABC80_VBSTART) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", abc80) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END diff --git a/src/mess/video/abc800.c b/src/mess/video/abc800.c deleted file mode 100644 index ee9fc3a19de..00000000000 --- a/src/mess/video/abc800.c +++ /dev/null @@ -1,311 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/***************************************************************************** - * - * video/abc800.c - * - ****************************************************************************/ - -#include "includes/abc80x.h" - - - -// these are needed because the MC6845 emulation does -// not position the active display area correctly -#define HORIZONTAL_PORCH_HACK 115 -#define VERTICAL_PORCH_HACK 29 - - - -//************************************************************************** -// HIGH RESOLUTION GRAPHICS -//************************************************************************** - -//------------------------------------------------- -// hrs_w - high resolution scanline write -//------------------------------------------------- - -WRITE8_MEMBER( abc800_state::hrs_w ) -{ - m_hrs = data; -} - - -//------------------------------------------------- -// hrc_w - high resolution color write -//------------------------------------------------- - -WRITE8_MEMBER( abc800_state::hrc_w ) -{ - m_fgctl = data; -} - - - -//************************************************************************** -// ABC 800 COLOR -//************************************************************************** - -//------------------------------------------------- -// translate_trom_offset - -//------------------------------------------------- - -offs_t abc800c_state::translate_trom_offset(offs_t offset) -{ - int row = offset / 40; - int col = offset % 40; - - offset = ((row & 0x07) * 0x80) + col; - - if (row & 0x08) offset += 0x28; - if (row & 0x10) offset += 0x50; - - return offset; -} - - -//------------------------------------------------- -// hr_update - high resolution screen update -//------------------------------------------------- - -void abc800c_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const pen_t *pen = m_palette->pens(); - - UINT16 addr = 0; - - for (int y = m_hrs; y < MIN(cliprect.max_y + 1, m_hrs + 480); y += 2) - { - int x = 0; - - for (int sx = 0; sx < 64; sx++) - { - UINT8 data = m_video_ram[addr++]; - - for (int dot = 0; dot < 4; dot++) - { - UINT16 fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); - UINT8 fgctl = m_fgctl_prom->base()[fgctl_addr]; - int color = fgctl & 0x07; - - if (color) - { - bool black = bitmap.pix32(y, x) == rgb_t::black; - bool opaque = !BIT(fgctl, 3); - - if (black || opaque) - { - bitmap.pix32(y, x) = pen[color]; - bitmap.pix32(y, x + 1) = pen[color]; - - bitmap.pix32(y + 1, x) = pen[color]; - bitmap.pix32(y + 1, x + 1) = pen[color]; - } - } - - data <<= 2; - x += 2; - } - } - } -} - - -void abc800_state::video_start() -{ - // register for state saving - save_item(NAME(m_hrs)); - save_item(NAME(m_fgctl)); -} - - -//------------------------------------------------- -// SCREEN_UPDATE( abc800c ) -//------------------------------------------------- - -UINT32 abc800c_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - // clear screen - bitmap.fill(rgb_t::black, cliprect); - - // draw text - if (!BIT(m_fgctl, 7)) - { - m_trom->screen_update(screen, bitmap, cliprect); - } - - // draw HR graphics - hr_update(bitmap, cliprect); - - return 0; -} - - -//------------------------------------------------- -// SAA5050_INTERFACE( trom_intf ) -//------------------------------------------------- - -READ8_MEMBER( abc800c_state::char_ram_r ) -{ - return m_char_ram[translate_trom_offset(offset)]; -} - - -//------------------------------------------------- -// PALETTE_INIT( abc800c ) -//------------------------------------------------- - -PALETTE_INIT_MEMBER( abc800c_state, abc800c ) -{ - palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black - palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red - palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green - palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow - palette.set_pen_color(4, rgb_t(0x00, 0x00, 0xff)); // blue - palette.set_pen_color(5, rgb_t(0xff, 0x00, 0xff)); // magenta - palette.set_pen_color(6, rgb_t(0x00, 0xff, 0xff)); // cyan - palette.set_pen_color(7, rgb_t(0xff, 0xff, 0xff)); // white -} - - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( abc800c_video ) -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( abc800c_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(abc800c_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(480, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 480-1) - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(abc800c_state, abc800c) - - MCFG_DEVICE_ADD(SAA5052_TAG, SAA5052, XTAL_12MHz/2) - MCFG_SAA5050_D_CALLBACK(READ8(abc800c_state, char_ram_r)) - MCFG_SAA5050_SCREEN_SIZE(40, 24, 40) -MACHINE_CONFIG_END - - - -//************************************************************************** -// ABC 800 MONOCHROME -//************************************************************************** - -//------------------------------------------------- -// hr_update - high resolution screen update -//------------------------------------------------- - -void abc800m_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT16 addr = 0; - - const pen_t *pen = m_palette->pens(); - - for (int y = m_hrs + VERTICAL_PORCH_HACK; y < MIN(cliprect.max_y + 1, m_hrs + VERTICAL_PORCH_HACK + 240); y++) - { - int x = HORIZONTAL_PORCH_HACK; - - for (int sx = 0; sx < 64; sx++) - { - UINT8 data = m_video_ram[addr++]; - - for (int dot = 0; dot < 4; dot++) - { - UINT16 fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); - int color = (m_fgctl_prom->base()[fgctl_addr] & 0x07) ? 1 : 0; - - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - - data <<= 2; - } - } - } -} - - -//------------------------------------------------- -// MC6845_UPDATE_ROW( abc800m_update_row ) -//------------------------------------------------- - -MC6845_UPDATE_ROW( abc800m_state::abc800m_update_row ) -{ - int column; - rgb_t fgpen = m_palette->pen(1); - - y += vbp; - - for (column = 0; column < x_count; column++) - { - int bit; - - UINT16 address = (m_char_ram[(ma + column) & 0x7ff] << 4) | (ra & 0x0f); - UINT8 data = (m_char_rom->base()[address & 0x7ff] & 0x3f); - - if (column == cursor_x) - { - data = 0x3f; - } - - data <<= 2; - - for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++) - { - int x = hbp + (column * ABC800_CHAR_WIDTH) + bit; - - if (BIT(data, 7) && de) - { - bitmap.pix32(y, x) = fgpen; - } - - data <<= 1; - } - } -} - - -//------------------------------------------------- -// SCREEN_UPDATE( abc800m ) -//------------------------------------------------- - -UINT32 abc800m_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - // clear screen - bitmap.fill(rgb_t::black, cliprect); - - // draw HR graphics - hr_update(bitmap, cliprect); - - // draw text - if (!BIT(m_fgctl, 7)) - { - m_crtc->screen_update(screen, bitmap, cliprect); - } - - return 0; -} - - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( abc800m_video ) -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( abc800m_video ) - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, ABC800_CCLK) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(ABC800_CHAR_WIDTH) - MCFG_MC6845_UPDATE_ROW_CB(abc800m_state, abc800m_update_row) - MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE(Z80DART_TAG, z80dart_device, rib_w)) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(abc800m_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(768, 312) - MCFG_SCREEN_VISIBLE_AREA(0,768-1, 0, 312-1) - - MCFG_PALETTE_ADD_MONOCHROME_YELLOW("palette") -MACHINE_CONFIG_END diff --git a/src/mess/video/abc802.c b/src/mess/video/abc802.c deleted file mode 100644 index 667f8cfe931..00000000000 --- a/src/mess/video/abc802.c +++ /dev/null @@ -1,220 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/***************************************************************************** - * - * video/abc802.c - * - ****************************************************************************/ - -#include "includes/abc80x.h" - - - -//------------------------------------------------- -// MC6845_UPDATE_ROW( abc802_update_row ) -//------------------------------------------------- - -MC6845_UPDATE_ROW( abc802_state::abc802_update_row ) -{ - /* - - PAL16R4 equation: - - IF (VCC) *OS = FC + RF / RC - *RG: = HS / *RG + *ATE / *RG + ATD / *RG + LL / - *RG + AT1 / *RG + AT0 / ATE + *ATD + *LL + - *AT1 + *AT0 - *RI: = *RI + *INV / *RI + LL / *INV + *LL - *RF: = HS / *RF + *ATE / *RF + ATD / *RF + LL / - *RF + AT1 / *RF + AT0 / ATE + *ATD + *LL + - *AT1 + AT0 - *RC: = HS / *RC + *ATE / *RC + *ATD / *RC + LL / - *RC + *ATI / *RC + AT0 / ATE + *LL + *AT1 + - *AT0 - IF (VCC) *O0 = *CUR + *AT0 / *CUR + ATE - *O1 = *CUR + *AT1 / *CUR + ATE - - - + = AND - / = OR - * = Inverted - - ATD Attribute data - ATE Attribute enable - AT0,AT1 Attribute address - CUR Cursor - FC FLSH clock - HS Horizontal sync - INV Inverted signal input - LL Load when Low - OEL Output Enable when Low - RC Row clear - RF Row flash - RG Row graphic - RI Row inverted - - */ - - const pen_t *pen = m_palette->pens(); - - int rf = 0, rc = 0, rg = 0; - - y += vbp; - - for (int column = 0; column < x_count; column++) - { - UINT8 code = m_char_ram[(ma + column) & 0x7ff]; - UINT16 address = code << 4; - UINT8 ra_latch = ra; - UINT8 data; - - int ri = (code & ABC802_INV) ? 1 : 0; - - if (column == cursor_x) - { - ra_latch = 0x0f; - } - - if ((m_flshclk && rf) || rc) - { - ra_latch = 0x0e; - } - - if (rg) - { - address |= 0x800; - } - - data = m_char_rom->base()[(address + ra_latch) & 0xfff]; - - if (data & ABC802_ATE) - { - int attr = data & 0x03; - int value = (data & ABC802_ATD) ? 1 : 0; - - switch (attr) - { - case 0x00: - // Row Graphic - rg = value; - break; - - case 0x01: - // Row Flash - rf = value; - break; - - case 0x02: - // Row Clear - rc = value; - break; - - case 0x03: - // undefined - break; - } - } - else - { - data <<= 2; - - if (m_80_40_mux) - { - for (int bit = 0; bit < ABC800_CHAR_WIDTH; bit++) - { - int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + bit; - int color = (BIT(data, 7) ^ ri) && de; - - bitmap.pix32(y, x) = pen[color]; - - data <<= 1; - } - } - else - { - for (int bit = 0; bit < ABC800_CHAR_WIDTH; bit++) - { - int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + (bit << 1); - int color = (BIT(data, 7) ^ ri) && de; - - bitmap.pix32(y, x) = pen[color]; - bitmap.pix32(y, x + 1) = pen[color]; - - data <<= 1; - } - - column++; - } - } - } -} - - -//------------------------------------------------- -// vs_w - vertical sync write -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc802_state::vs_w ) -{ - if (!state) - { - // flash clock - if (m_flshclk_ctr & 0x20) - { - m_flshclk = !m_flshclk; - m_flshclk_ctr = 0; - } - else - { - m_flshclk_ctr++; - } - } - - // signal _DEW to DART - m_dart->rib_w(!state); -} - - -void abc802_state::video_start() -{ - // register for state saving - save_item(NAME(m_flshclk_ctr)); - save_item(NAME(m_flshclk)); - save_item(NAME(m_80_40_mux)); -} - - -//------------------------------------------------- -// SCREEN_UPDATE( abc802 ) -//------------------------------------------------- - -UINT32 abc802_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - // draw text - m_crtc->screen_update(screen, bitmap, cliprect); - - return 0; -} - - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( abc802_video ) -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( abc802_video ) - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, ABC800_CCLK) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(ABC800_CHAR_WIDTH) - MCFG_MC6845_UPDATE_ROW_CB(abc802_state, abc802_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(abc802_state, vs_w)) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(abc802_state, screen_update) - - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(768, 312) - MCFG_SCREEN_VISIBLE_AREA(0,768-1, 0, 312-1) - - MCFG_PALETTE_ADD_MONOCHROME_AMBER("palette") -MACHINE_CONFIG_END diff --git a/src/mess/video/abc806.c b/src/mess/video/abc806.c deleted file mode 100644 index f958b025b1c..00000000000 --- a/src/mess/video/abc806.c +++ /dev/null @@ -1,507 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/***************************************************************************** - * - * video/abc806.c - * - ****************************************************************************/ - -#include "includes/abc80x.h" - - - -#define HORIZONTAL_PORCH_HACK 109 -#define VERTICAL_PORCH_HACK 27 - - - -//------------------------------------------------- -// hrs_w - high resolution memory banking -//------------------------------------------------- - -WRITE8_MEMBER( abc806_state::hrs_w ) -{ - /* - - bit signal description - - 0 VM14 visible screen memory area bit 0 - 1 VM15 visible screen memory area bit 1 - 2 VM16 visible screen memory area bit 2 - 3 VM17 visible screen memory area bit 3 - 4 F14 cpu accessible screen memory area bit 0 - 5 F15 cpu accessible screen memory area bit 1 - 6 F16 cpu accessible screen memory area bit 2 - 7 F17 cpu accessible screen memory area bit 3 - - */ - - m_hrs = data; -} - - -//------------------------------------------------- -// hrc_w - high resolution color write -//------------------------------------------------- - -WRITE8_MEMBER( abc806_state::hrc_w ) -{ - int reg = (offset >> 8) & 0x0f; - - m_hrc[reg] = data; -} - - -//------------------------------------------------- -// charram_r - character RAM read -//------------------------------------------------- - -READ8_MEMBER( abc806_state::charram_r ) -{ - m_attr_data = m_attr_ram[offset]; - - return m_char_ram[offset]; -} - - -//------------------------------------------------- -// charram_w - character RAM write -//------------------------------------------------- - -WRITE8_MEMBER( abc806_state::charram_w ) -{ - m_attr_ram[offset] = m_attr_data; - - m_char_ram[offset] = data; -} - - -//------------------------------------------------- -// ami_r - attribute memory read -//------------------------------------------------- - -READ8_MEMBER( abc806_state::ami_r ) -{ - return m_attr_data; -} - - -//------------------------------------------------- -// amo_w - attribute memory write -//------------------------------------------------- - -WRITE8_MEMBER( abc806_state::amo_w ) -{ - m_attr_data = data; -} - - -//------------------------------------------------- -// cli_r - palette PROM read -//------------------------------------------------- - -READ8_MEMBER( abc806_state::cli_r ) -{ - /* - - bit description - - 0 HRU II data bit 0 - 1 HRU II data bit 1 - 2 HRU II data bit 2 - 3 HRU II data bit 3 - 4 - 5 - 6 - 7 RTC data output - - */ - - UINT16 hru2_addr = (m_hru2_a8 << 8) | (offset >> 8); - UINT8 data = m_hru2_prom->base()[hru2_addr] & 0x0f; - - logerror("HRU II %03x : %01x\n", hru2_addr, data); - - data |= m_rtc->dio_r() << 7; - - return data; -} - - -//------------------------------------------------- -// sti_r - protection device read -//------------------------------------------------- - -READ8_MEMBER( abc806_state::sti_r ) -{ - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 PROT DOUT - - */ - - return 0x7f; -} - - -//------------------------------------------------- -// sto_w - -//------------------------------------------------- - -WRITE8_MEMBER( abc806_state::sto_w ) -{ - int level = BIT(data, 7); - - switch (data & 0x07) - { - case 0: - // external memory enable - m_eme = level; - break; - case 1: - // 40/80 column display - m_40 = level; - break; - case 2: - // HRU II address line 8, PROT A0 - m_hru2_a8 = level; - break; - case 3: - // PROT INI - break; - case 4: - // text display enable - m_txoff = level; - break; - case 5: - // RTC chip select - m_rtc->cs_w(!level); - break; - case 6: - // RTC clock - m_rtc->clk_w(level); - break; - case 7: - // RTC data in, PROT DIN - m_rtc->dio_w(level); - break; - } -} - - -//------------------------------------------------- -// sso_w - sync offset write -//------------------------------------------------- - -WRITE8_MEMBER( abc806_state::sso_w ) -{ - m_sync = data & 0x3f; -} - - -//------------------------------------------------- -// MC6845_UPDATE_ROW( abc806_update_row ) -//------------------------------------------------- - -MC6845_UPDATE_ROW( abc806_state::abc806_update_row ) -{ - const pen_t *pen = m_palette->pens(); - - int fg_color = 7; - int bg_color = 0; - int underline = 0; - int flash = 0; - int e5 = m_40; - int e6 = m_40; - int th = 0; - - y += m_sync + vbp; - - for (int column = 0; column < x_count; column++) - { - UINT8 data = m_char_ram[(ma + column) & 0x7ff]; - UINT8 attr = m_attr_ram[(ma + column) & 0x7ff]; - UINT8 rad_data; - - if ((attr & 0x07) == ((attr >> 3) & 0x07)) - { - // special case - switch (attr >> 6) - { - case 0: - // use previously selected attributes - break; - - case 1: - // reserved for future use - break; - - case 2: - // blank - fg_color = 0; - bg_color = 0; - underline = 0; - flash = 0; - break; - - case 3: - // double width - e5 = BIT(attr, 0); - e6 = BIT(attr, 1); - - // read attributes from next byte - attr = m_attr_ram[(ma + column + 1) & 0x7ff]; - - if (attr != 0x00) - { - fg_color = attr & 0x07; - bg_color = (attr >> 3) & 0x07; - underline = BIT(attr, 6); - flash = BIT(attr, 7); - } - break; - } - } - else - { - // normal case - fg_color = attr & 0x07; - bg_color = (attr >> 3) & 0x07; - underline = BIT(attr, 6); - flash = BIT(attr, 7); - e5 = m_40; - e6 = m_40; - } - - if (column == cursor_x) - { - rad_data = 0x0f; - } - else - { - UINT16 rad_addr = (e6 << 8) | (e5 << 7) | (flash << 6) | (underline << 4) | (m_flshclk << 5) | (ra & 0x0f); - rad_data = m_rad_prom->base()[rad_addr] & 0x0f; - } - - UINT16 chargen_addr = (th << 12) | (data << 4) | rad_data; - UINT8 chargen_data = m_char_rom->base()[chargen_addr & 0xfff] << 2; - int x = hbp + (column + 4) * ABC800_CHAR_WIDTH; - - for (int bit = 0; bit < ABC800_CHAR_WIDTH; bit++) - { - int color = BIT(chargen_data, 7) ? fg_color : bg_color; - if (!de) color = 0; - - bitmap.pix32(y, x++) = pen[color]; - - if (e5 || e6) - { - bitmap.pix32(y, x++) = pen[color]; - } - - chargen_data <<= 1; - } - - if (e5 || e6) - { - column++; - } - } -} - - -//------------------------------------------------- -// hs_w - horizontal sync write -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc806_state::hs_w ) -{ - int vsync; - - if (!state) - { - m_v50_addr++; - - // clock current vsync value into the shift register - m_vsync_shift <<= 1; - m_vsync_shift |= m_vsync; - - vsync = BIT(m_vsync_shift, m_sync); - - if (!m_d_vsync && vsync) - { - // clear V50 address - m_v50_addr = 0; - } - else if (m_d_vsync && !vsync) - { - // flash clock - if (m_flshclk_ctr & 0x20) - { - m_flshclk = !m_flshclk; - m_flshclk_ctr = 0; - } - else - { - m_flshclk_ctr++; - } - } - - if (m_d_vsync != vsync) - { - // signal _DEW to DART - m_dart->rib_w(!vsync); - } - - m_d_vsync = vsync; - } -} - - -//------------------------------------------------- -// vs_w - vertical sync write -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc806_state::vs_w ) -{ - m_vsync = state; -} - - -//------------------------------------------------- -// hr_update - high resolution screen update -//------------------------------------------------- - -void abc806_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const pen_t *pen = m_palette->pens(); - - UINT32 addr = (m_hrs & 0x0f) << 15; - - for (int y = m_sync + VERTICAL_PORCH_HACK; y < MIN(cliprect.max_y + 1, m_sync + VERTICAL_PORCH_HACK + 240); y++) - { - for (int sx = 0; sx < 128; sx++) - { - UINT8 data = m_video_ram[addr++]; - UINT16 dot = (m_hrc[data >> 4] << 8) | m_hrc[data & 0x0f]; - - for (int pixel = 0; pixel < 4; pixel++) - { - int x = HORIZONTAL_PORCH_HACK + (ABC800_CHAR_WIDTH * 4) - 16 + (sx * 4) + pixel; - - if (BIT(dot, 15) || (bitmap.pix32(y, x) == rgb_t::black)) - { - bitmap.pix32(y, x) = pen[(dot >> 12) & 0x07]; - } - - dot <<= 4; - } - } - } -} - - -void abc806_state::video_start() -{ - // initialize variables - for (int i = 0; i < 16; i++) - { - m_hrc[i] = 0; - } - - m_sync = 10; - m_d_vsync = 1; - m_vsync = 1; - m_40 = 1; - - // allocate memory - m_char_ram.allocate(ABC806_CHAR_RAM_SIZE); - m_attr_ram.allocate(ABC806_ATTR_RAM_SIZE); - - // register for state saving - save_item(NAME(m_txoff)); - save_item(NAME(m_40)); - save_item(NAME(m_flshclk_ctr)); - save_item(NAME(m_flshclk)); - save_item(NAME(m_attr_data)); - save_item(NAME(m_hrs)); - save_item(NAME(m_hrc)); - save_item(NAME(m_sync)); - save_item(NAME(m_v50_addr)); - save_item(NAME(m_hru2_a8)); - save_item(NAME(m_vsync_shift)); - save_item(NAME(m_vsync)); - save_item(NAME(m_d_vsync)); -} - - -//------------------------------------------------- -// SCREEN_UPDATE( abc806 ) -//------------------------------------------------- - -UINT32 abc806_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - // clear screen - bitmap.fill(rgb_t::black, cliprect); - - if (!m_txoff) - { - // draw text - m_crtc->screen_update(screen, bitmap, cliprect); - } - - // draw HR graphics - hr_update(bitmap, cliprect); - - return 0; -} - - -//------------------------------------------------- -// PALETTE_INIT( abc806 ) -//------------------------------------------------- - -PALETTE_INIT_MEMBER( abc806_state, abc806 ) -{ - palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black - palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red - palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green - palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow - palette.set_pen_color(4, rgb_t(0x00, 0x00, 0xff)); // blue - palette.set_pen_color(5, rgb_t(0xff, 0x00, 0xff)); // magenta - palette.set_pen_color(6, rgb_t(0x00, 0xff, 0xff)); // cyan - palette.set_pen_color(7, rgb_t(0xff, 0xff, 0xff)); // white -} - - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( abc806_video ) -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( abc806_video ) - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, ABC800_CCLK) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(ABC800_CHAR_WIDTH) - MCFG_MC6845_UPDATE_ROW_CB(abc806_state, abc806_update_row) - MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(abc806_state, hs_w)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(abc806_state, vs_w)) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(abc806_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(768, 312) - MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 312-1) - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(abc806_state, abc806) -MACHINE_CONFIG_END diff --git a/src/mess/video/ac1.c b/src/mess/video/ac1.c deleted file mode 100644 index 8af6b695baa..00000000000 --- a/src/mess/video/ac1.c +++ /dev/null @@ -1,61 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - AC1 video driver by Miodrag Milanovic - - 15/01/2009 Preliminary driver. - -****************************************************************************/ - -#include "emu.h" -#include "includes/ac1.h" - -#define AC1_VIDEO_MEMORY 0x1000 - -const gfx_layout ac1_charlayout = -{ - 6, 8, /* 6x8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {7, 6, 5, 4, 3, 2}, - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, - 8*8 /* size of one char */ -}; - -void ac1_state::video_start() -{ -} - -UINT32 ac1_state::screen_update_ac1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - address_space &space = m_maincpu->space(AS_PROGRAM); - - for(y = 0; y < 16; y++ ) - { - for(x = 0; x < 64; x++ ) - { - int code = space.read_byte(AC1_VIDEO_MEMORY + x + y*64); - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, 63*6-x*6,15*8-y*8); - } - } - return 0; -} - -UINT32 ac1_state::screen_update_ac1_32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - address_space &space = m_maincpu->space(AS_PROGRAM); - - for(y = 0; y < 32; y++ ) - { - for(x = 0; x < 64; x++ ) - { - int code = space.read_byte(AC1_VIDEO_MEMORY + x + y*64); - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, 63*6-x*6,31*8-y*8); - } - } - return 0; -} diff --git a/src/mess/video/advision.c b/src/mess/video/advision.c deleted file mode 100644 index 086f61c6175..00000000000 --- a/src/mess/video/advision.c +++ /dev/null @@ -1,110 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - video/advision.c - - Routines to control the Adventurevision video hardware - - Video hardware is composed of a vertical array of 40 LEDs which is - reflected off a spinning mirror, to give a resolution of 150 x 40 at 15 FPS. - -***************************************************************************/ - -#include "emu.h" -#include "includes/advision.h" - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void advision_state::video_start() -{ - m_video_hpos = 0; - m_display.resize(8 * 8 * 256); - memset(&m_display[0], 0, 8*8*256); - save_item(NAME(m_display)); - save_item(NAME(m_video_hpos)); -} - -/*************************************************************************** - - Initialise the palette. - -***************************************************************************/ - -PALETTE_INIT_MEMBER(advision_state, advision) -{ - for (int i = 0; i < 8; i++) - { - /* 8 shades of RED */ - m_palette->set_pen_color(i, i * 0x22, 0x00, 0x00); - } -} - -/*************************************************************************** - - Update the display data. - -***************************************************************************/ - -void advision_state::vh_write(int data) -{ - if (m_video_bank >= 1 && m_video_bank <=5) - { - m_led_latch[m_video_bank] = data; - } -} - -void advision_state::vh_update(int x) -{ - UINT8 *dst = &m_display[x]; - - for (int y = 0; y < 8; y++) - { - UINT8 data = m_led_latch[7 - y]; - - for (int i = 0; i < 8; i++) - { - if (!BIT(data, 7 - i)) - dst[i * 256] = 8; - } - - m_led_latch[7 - y] = 0xff; - dst += 8 * 256; - } -} - - -/*************************************************************************** - - Refresh the video screen - -***************************************************************************/ - -UINT32 advision_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - if ((m_frame_count++ % 4) == 0) - { - m_frame_start = 1; - m_video_hpos = 0; - } - - for (int x = 0; x < 150; x++) - { - UINT8 *led = &m_display[x]; - - for (int y = 0; y < 128; y+=2) - { - if (*led > 0) - bitmap.pix16(30 + y, 85 + x) = --(*led); - else - bitmap.pix16(30 + y, 85 + x) = 0; - - led += 256; - } - } - return 0; -} diff --git a/src/mess/video/alesis.c b/src/mess/video/alesis.c deleted file mode 100644 index 08f4554a4f2..00000000000 --- a/src/mess/video/alesis.c +++ /dev/null @@ -1,167 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - Alesis SR-16 LCD emulation - -****************************************************************************/ - -#include "emu.h" -#include "includes/alesis.h" - - -void alesis_state::update_lcd_symbols(bitmap_ind16 &bitmap, UINT8 pos, UINT8 y, UINT8 x, int state) -{ - if (pos == 6) - { - switch(x) - { - case 0: - switch(y) - { - case 0: output_set_value("a_next", state); break; - case 1: output_set_value("b_next", state); break; - case 2: output_set_value("fill_next", state); break; - case 3: output_set_value("user_next", state); break; - case 4: output_set_value("play", state); break; - case 5: output_set_value("record", state); break; - case 6: output_set_value("compose", state); break; - case 7: output_set_value("perform", state); break; - } - break; - case 1: - if (y == 0) - { - output_set_value("song", state); - } - else if (y < 8) - { - if (state) - m_lcd_digits[0] |= (1<<(y-1)); - else - m_lcd_digits[0] &= ~(1<<(y-1)); - - output_set_value("digit0", BITSWAP8(m_lcd_digits[0],7,3,1,4,6,5,2,0)); - } - break; - case 2: - if (y == 0) - { - output_set_value("pattern", state); - } - else if (y < 8) - { - if (state) - m_lcd_digits[1] |= (1<<(y-1)); - else - m_lcd_digits[1] &= ~(1<<(y-1)); - - output_set_value("digit1", BITSWAP8(m_lcd_digits[1],7,3,1,4,6,5,2,0)); - } - break; - case 3: - switch(y) - { - case 0: output_set_value("b", state); break; - case 1: output_set_value("a", state); break; - case 2: output_set_value("fill", state); break; - case 3: output_set_value("user", state); break; - case 4: output_set_value("edited", state); break; - case 5: output_set_value("set", state); break; - case 6: output_set_value("drum", state); break; - case 7: output_set_value("press_play", state); break; - } - break; - case 4: - if (y == 7) - { - output_set_value("metronome", state); - } - else if (y < 7) - { - if (state) - m_lcd_digits[4] |= (1<> 5) -#define CR0_MODE_0 0 -#define CR0_MODE_1 1 -#define CR0_MODE_VECTOR 2 -#define CR0_MODE_3 3 -#define CR0_MODE_BLT 4 -#define CR0_MODE_NORMAL 7 -#define CR0_SHIFT(a) ((a) & 0x1f) - -// control register 1 -#define CR1_INV 0x80 -#define CR1_AD_BIT 0x80 // 4- and 8-plane color -#define CR1_DADDR_16 0x40 -#define CR1_DV_CK 0x40 // 4- and 8-plane color -#define CR1_DH_CK 0x20 -#define CR1_ROP_EN 0x10 -#define CR1_RESET 0x08 -#define CR1_DP_CK 0x04 -#define CR1_SYNC_EN 0x02 -#define CR1_DISP_EN 0x01 - -// control register 2 -#define CR2_S_DATA(a) ((a) >> 6) -#define CR2_CONST_ACCESS 0x00 -#define CR2_PIXEL_ACCESS 0x01 -#define CR2_SHIFT_ACCESS 0x02 -#define CR2_PLANE_ACCESS 0x03 -#define CR2_S_PLANE(a) (((a) >> 4) & 0x03) -#define CR2_D_PLANE(a) ((a) & 0x0f) -#define CR2B_S_PLANE(a) ((a) & 0x07) -#define CR2A_D_PLANE(a) (a) - -// Lookup table control register -#define LUT_AD_CS 0x80 -#define LUT_CPAL_CS 0x40 -#define LUT_FIFO_CS 0x20 -#define LUT_FIFO_RST 0x10 -#define LUT_ST_LUK 0x08 -#define LUT_R_W 0x04 -#define LUT_C1 0x02 -#define LUT_C0 0x01 -#define LUT_C1_C0(a) ((a)& (LUT_C1|LUT_C0)) - - -apollo_graphics_15i::bt458::bt458(running_machine &running_machine) -{ - m_machine = &running_machine; -} - -void apollo_graphics_15i::bt458::start() -{ - MLOG1(("start apollo_graphics_15i::bt458")); -} - -void apollo_graphics_15i::bt458::reset() -{ - MLOG1(("reset apollo_graphics_15i::bt458")); - - m_color_counter = 0; - m_red = 0; - m_green = 0; - - m_address_register = 0; - memset(m_color_palette_RAM, 0, sizeof(m_color_palette_RAM)); - memset(m_overlay_color, 0, sizeof(m_overlay_color)); - m_read_mask_register = 0; - m_blink_mask_register = 0; - m_command_register = 0; - m_control_test_register = 0; -} - -void apollo_graphics_15i::bt458::write(UINT8 data, UINT8 c10) -{ - MLOG1(("writing Bt458 data=%02x C1,C0=%d", data, c10)); - switch (c10) - { - case 0: // address register - m_address_register = data; - m_color_counter = 0; - MLOG1(("bt458::write 0: addr=%02x", data)); - break; - case 1: // color palette RAM - switch (m_color_counter) - { - case 0: - m_red = data; - m_color_counter++; - break; - case 1: - m_green = data; - m_color_counter++; - break; - case 2: - m_color_palette_RAM[m_address_register] = (m_red << 16) | (m_green << 8) | data; - m_address_register++; - m_color_counter = 0; - break; - } - break; - case 2: // registers - switch (m_address_register) - { - case 0x04: - m_read_mask_register = data; - MLOG1(("bt458::write: writing Bt458 m_read_mask_register=%02x", data)) - break; - case 0x05: - m_blink_mask_register = data; - MLOG1(("bt458::write: writing Bt458 m_blink_mask_register=%02x", data)) - break; - case 0x06: - m_command_register = data; - MLOG1(("bt458::write: writing Bt458 m_command_register=%02x", data)) - break; - case 0x07: - m_control_test_register = data; - break; - default: - MLOG1(("bt458::write: writing unexpected Bt458 data=%02x C1,C0=%d at %02x", data, c10, m_address_register)) - break; - } - break; - case 3: // overlay color - switch (m_address_register) - { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - m_overlay_color[m_address_register] = data; - MLOG1(("bt458::write: writing Bt458 m_overlay_color[%d]=%02x",m_address_register, data)); - break; - default: - MLOG1(("bt458::write: writing unexpected Bt458 data=%02x C1,C0=%d at %02x", data, c10, m_address_register)); - break; - } - break; - default: - MLOG1(("bt458::write: writing unexpected Bt458 data=%02x C1,C0=%d", data, c10)) - ; - break; - } -} - -UINT8 apollo_graphics_15i::bt458::read(UINT8 c10) -{ - UINT8 data = 0xff; - - switch (c10) - { - case 0: // address register - data = m_address_register; - break; - case 1: // color palette RAM - switch (m_color_counter) - { - case 0: // red - data = (m_color_palette_RAM[m_address_register] >> 16) & 0xff; - m_color_counter++; - break; - case 1: // Green - data = (m_color_palette_RAM[m_address_register] >> 8) & 0xff; - m_color_counter++; - break; - case 2: // blue - data = m_color_palette_RAM[m_address_register] & 0xff; - m_address_register++; - m_color_counter = 0; - break; - } - break; - case 2: // registers - switch (m_address_register) - { - case 0x04: - data = m_read_mask_register; - MLOG1(("bt458::read: reading Bt458 m_read_mask_register=%02x", data)) - break; - case 0x05: - data = m_blink_mask_register; - MLOG1(("bt458::read: reading Bt458 m_blink_mask_register=%02x", data)) - break; - case 0x06: - data = m_command_register; - MLOG1(("bt458::read: reading Bt458 m_command_register=%02x", data)) - break; - case 0x07: - { - UINT32 rgb = m_color_palette_RAM[0]; - switch (m_control_test_register & 0x0f) - { - case 0x01: data = 0x01 | ((rgb >> 16) & 0xf0); break; - case 0x09: data = 0x09 | ((rgb >> 12) & 0xf0); break; - case 0x02: data = 0x02 | ((rgb >> 8) & 0xf0); break; - case 0x0a: data = 0x0a | ((rgb >> 4) & 0xf0); break; - case 0x04: data = 0x04 | ((rgb >> 0) & 0xf0); break; - case 0x0c: data = 0x0c | ((rgb << 4) & 0xf0); break; - default: data = 0xff; break; - } - } - break; - default: - MLOG1(("bt458::read: reading unexpected Bt458 data=%02x C1,C0=%d at %02x", data, c10, m_address_register)) - break; - } - break; - default: - MLOG1(("bt458::read: reading unexpected Bt458 data=%02x C1,C0=%d at %02x", data, c10, m_address_register)) - break; - } - -// MLOG1(("reading Bt458 data=%02x cs=%d", m_data, c10)); - return data; -} - -UINT32 apollo_graphics_15i::bt458::get_rgb(UINT8 index) -{ - return m_color_palette_RAM[index]; -} - -/*************************************************************************** - Monochrome Controller Registers at 0x5d800 - 0x5dc07 - ***************************************************************************/ - -const char *apollo_graphics_15i::cr_text(offs_t offset, UINT8 data, UINT8 rw) -{ - static const char *cr0[8] = - { "cr0 mode=0 CPU dest BLT", "cr0 mode=1 Alternating BLT", - "cr0 mode=2 Vector mode", "cr0 mode=3 CPU Source BLT", - "cr0 mode=4 Double access BLT ", "cr0 mode=5 ???", - "cr0 mode=6 ???", "cr0 mode=7 Normal" }; - - static const char *cr2[4] = - { "cr2 Constant access", "cr2 Pixel access", "cr2 ???", - "cr2 Plane access" }; - - static const char *cr2b[4] = - { "cr2b Constant access", "cr2b Pixel access", "cr2b ???", - "cr2b Plane access" }; - - switch (offset & 0x407) - { - case 0: - return rw ? "sr" : "we"; - case 1: - return rw ? "id" : "we"; - case 2: - case 3: - return "rop0"; - case 4: - case 5: - return m_n_planes == 8 ? "rop1" : "mem refresh"; - case 6: - case 7: - return m_n_planes == 8 ? "mem refresh" : "???"; - case 0x400: - return cr0[data >> 5]; - case 0x401: - return m_n_planes == 8 ? "LUT data" : "red"; - case 0x402: - return "cr1"; - case 0x403: - return m_n_planes == 8 ? "LUT ctrl" : "green"; - case 0x404: - return m_n_planes == 8 ? "cr2a" : cr2[data >> 6]; - case 0x405: - return m_n_planes == 8 ? cr2b[data >> 6] : "blue"; - case 0x406: - return "cr3"; - case 0x407: - return m_n_planes == 8 ? "cr3b" : "a/d"; - default: - return "???"; - } -} - -void apollo_graphics_15i::log_cr1(const char * text) -{ - MLOG2(("%s: cr0=%02x cr1=%02x sr=%02x pixel_clock=%3d/%3d bl=%d vb=%d vs=%d hs=%d hc=%d vck=%d hck=%d pck=%d vd=%d", - text, - m_cr0, - m_cr1, - m_sr, - m_p_clock, - m_data_clock, - m_sr & SR_BLANK ? 1 : 0, - m_sr & SR_V_BLANK ? 1 : 0, - m_sr & SR_V_SYNC ? 1 : 0, - m_sr & SR_H_SYNC ? 1 : 0, - m_sr & SR_H_CK ? 1 : 0, - m_cr1 & CR1_DV_CK ? 1 : 0, - m_cr1 & CR1_DH_CK ? 1 : 0, - m_cr1 & CR1_DP_CK ? 1 : 0, - m_sr & SR_V_DATA ? 1 : 0)); -} - -void apollo_graphics_15i::increment_h_clock() -{ - MLOG1(("increment_h_clock: sr=%02x m_h_clock=%d", m_sr, m_h_clock)); - - if (m_device_id == SCREEN_DEVICE_ID_19I) - { - // DISP7A.DEX Test 5 - // Note: 108 = 80 + 28 = 1280/16 + 448/16 - switch (m_h_clock %= 108) - { - case 8: // Not blanking - m_sr |= SR_BLANK; - break; - case 88: // blanking - m_sr &= ~SR_BLANK; - break; - case 93: // HSync active - m_sr &= ~SR_H_SYNC; - // DISP7A.DEX.1 Test 6 - increment_v_clock(); - break; - case 104: // HSync inactive - m_sr |= SR_H_SYNC; - break; - } - } - else if (m_n_planes == 1) - { - switch (m_h_clock %= 84) - { - case 1: // HSync inactive - m_sr |= SR_H_SYNC; - break; - case 8: // Not blanking - m_sr |= SR_BLANK; - break; - case 72: // blanking - m_sr &= ~SR_BLANK; - break; - case 77: // HSync active - m_sr &= ~SR_H_SYNC; - // DISP7D.DEX.1 Test 6 - increment_v_clock(); - break; - } - } - else if (m_n_planes == 4) - { - switch (m_h_clock %= 84) - { - case 8: // Not blanking - m_sr |= SR_BLANK; - if (m_sr & SR_V_BLANK) - { - m_sr |= SR_V_FLAG; - } - break; - case 73: // blanking - m_sr &= ~SR_BLANK; - if (m_sr & SR_V_BLANK) - { - m_sr &= ~SR_V_FLAG; - } - break; - } - } - else // m_n_planes == 8 - { - switch (m_h_clock %= 84) - { - case 9: // Not blanking - m_sr |= SR_BLANK; - break; - case 73: // blanking - m_sr &= ~SR_BLANK; - break; - } - } - m_h_clock++; -} - -void apollo_graphics_15i::increment_v_clock() -{ - MLOG1(("increment_v_clock: sr=%02x m_v_clock=%d", m_sr, m_v_clock)); - - if (m_device_id == SCREEN_DEVICE_ID_19I) - { - switch (m_v_clock %= 1066) - { - case 1023: // blanking - m_sr &= ~(SR_V_BLANK | SR_BLANK); - break; - case 1028: // VSync active - m_sr &= ~SR_V_SYNC; - break; - case 1032: // VSync inactive - m_sr |= SR_V_SYNC; - break; - case 1065: // not blanking - m_sr |= (SR_V_BLANK | SR_BLANK); - break; - } - } - else if (m_n_planes == 1) - { - switch (m_v_clock %= 842) - { - case 799: - m_sr &= ~SR_V_BLANK; - break; - case 804: - m_sr &= ~SR_SYNC; - break; - case 808: - m_sr |= SR_SYNC; - break; - case 841: - m_sr |= SR_V_BLANK; - break; - } - } - else if (m_n_planes == 4) - { - // DISP7B.DEX Test 6 and Test 20 - switch (m_v_clock %= 842) - { - case 799: - m_sr &= ~SR_V_BLANK; - m_sr &= ~SR_V_FLAG; - break; - case 803: - m_sr &= ~SR_SYNC; - break; - case 807: - m_sr |= SR_SYNC; - break; - case 836: - m_sr |= SR_V_FLAG; - break; - case 841: - m_sr |= SR_V_BLANK; - break; - } - } - else if (m_n_planes == 8) - { - // DISP7C.DEX Test 50 - switch (m_v_clock %= 842) - { - case 800: - m_sr &= ~SR_V_BLANK; - break; - case 804: - m_sr &= ~SR_SYNC; - break; - case 808: - m_sr |= SR_SYNC; - break; - case 0: - m_sr |= SR_V_BLANK; - break; - } - } - m_v_clock++; - m_p_clock = 0; - m_data_clock = 0; -} - -void apollo_graphics_15i::increment_p_clock() -{ - if (m_n_planes == 1) - { - if ((m_cr1 & CR1_DISP_EN) == 0) - { - m_sr &= ~SR_V_DATA; - } - else - { - int pixel_offset = (m_device_id == SCREEN_DEVICE_ID_19I) ? 10 : 8; - - if (m_p_clock > pixel_offset) - { - // FIXME: ok for DEX Test 5 6 17 19 - nok for 20 - int pixel_addr = m_v_clock * m_width + m_data_clock; - - // FIXME: ok for DEX Test 5 6 17 20 - nok for 19 - // Note: for dn3500_19i DEX Test 17 18 20 will fail !!!! - // Note: must NOT reset m_data_clock in increment_p_clock ! -// int pixel_addr = m_data_clock * 32; - - UINT16 pixel = m_image_memory[pixel_addr / 16] & (0x8000 >> (pixel_addr % 16)); - - pixel = (pixel ? 1 : 0) ^ ((m_cr1 & CR1_INV) ? 0 : 1); - - m_sr = pixel ? (m_sr | SR_V_DATA) : (m_sr & ~SR_V_DATA); - - m_data_clock++; - } - - m_p_clock++; - - // DEX Test 4: Pixel Counter Test - if ((m_p_clock % 8) == 0) - { - m_sr ^= SR_H_CK; - } - } - } - else if (m_n_planes == 4) - { - if ((m_p_clock % 8) == 0 && m_p_clock > 0) - { - m_sr ^= SR_H_CK; - } - m_p_clock++; - } - else // m_n_planes == 8 - { - if ((m_p_clock % 8) == 1 && m_p_clock > 1) - { - m_sr ^= SR_H_CK; - } - m_p_clock++; - } -} - -void apollo_graphics_15i::set_cr1(UINT8 data) -{ - UINT8 diffs = m_cr1 ^ data; - m_cr1 = data; - - UINT8 dp_clock = (diffs & CR1_DP_CK) && (m_cr1 & CR1_DP_CK) == 0; - UINT8 dh_clock = (diffs & CR1_DH_CK) && (m_cr1 & CR1_DH_CK) == 0; - UINT8 dv_clock = m_n_planes == 1 ? 0 : ((diffs & CR1_DV_CK) && (m_cr1 & CR1_DV_CK) == 0); - - if ((m_cr1 & CR1_RESET) == 0) - { - if (diffs & CR1_RESET) - { - MLOG1(("!!! set_cr1: CR1_RESET")); - - m_blt_cycle_count = 0; - m_sr &= ~SR_ALT; - m_image_offset = 0; - memset(m_guard_latch, 0, sizeof(m_guard_latch)); - - m_h_clock = 0; - m_v_clock = 0; - m_p_clock = 0; - m_data_clock = 0; - - if (m_device_id == SCREEN_DEVICE_ID_19I) - { - m_sr = SR_H_CK | SR_V_BLANK | SR_H_SYNC | SR_V_SYNC; - } - else if (m_n_planes == 1) - { - m_sr = SR_V_BLANK | SR_V_SYNC; - } - else - { - m_sr = SR_H_CK | SR_V_BLANK | SR_SYNC | SR_DONE; - } - } - log_cr1("CR1_RESET"); - } - else - { - if ((diffs & CR1_RESET) && (m_cr1 & CR1_RESET) != 0) - { - log_cr1("CR1_RESET"); - } - - if (dh_clock) - { - increment_h_clock(); - log_cr1("CR1_DH_CK"); - } - - if (dv_clock) - { - increment_v_clock(); - log_cr1("CR1_DV_CK"); - } - - if (dp_clock) - { - increment_p_clock(); - log_cr1("CR1_DP_CK"); - } - - if ((m_sr & SR_V_BLANK) == 0) - { - m_sr &= ~SR_BLANK; - } - - if (diffs & CR1_DISP_EN) - { - // update screen - m_update_flag = 1; - } - } -} - -void apollo_graphics_15i::set_cr3a(UINT8 data) -{ - m_cr3a = data; - if ((data & 0x80) == 0) - { - int shift = (data & 0x0f) >> 1; - UINT8 bit_mask = 1 << shift; - if (data & 0x01) - { - set_cr1(m_cr1 | bit_mask); - } - else - { - set_cr1(m_cr1 & ~bit_mask); - } - } -} - -void apollo_graphics_15i::set_cr3b(UINT8 data) -{ - m_cr3b = data; - if ((data & 0x80) == 0) - { - int shift = (data & 0x0f) >> 1; - UINT8 bit_mask = 1 << shift; - if (data & 0x01) - { - set_lut_cr(m_lut_control | bit_mask); - } - else - { - set_lut_cr(m_lut_control & ~bit_mask); - } - } -} - -void apollo_graphics_15i::set_lut_cr(UINT8 data) -{ - UINT8 diffs = m_lut_control ^ data; - m_lut_control = data; - - if ((diffs & LUT_CPAL_CS) && (data & LUT_CPAL_CS) != 0) - { - MLOG1(("writing Color Graphics Controller: LUT_CPAL_CS Disabled")); - while (!m_lut_fifo->is_empty()) - { - m_bt458->write(m_lut_fifo->get(), LUT_C1_C0(m_lut_control)); - } - } - - if ((diffs & LUT_FIFO_RST) && (data & LUT_FIFO_RST) == 0) - { - MLOG1(("writing Color Graphics Controller: LUT_FIFO_RST Active")); - m_lut_fifo->reset(); - m_sr |= SR_LUT_OK; - } - - if ((diffs & LUT_FIFO_CS) && (data & LUT_FIFO_CS) == 0) - { - MLOG1(("writing Color Graphics Controller: LUT_FIFO_CS Enabled")); - } - - if ((diffs & LUT_ST_LUK) && (data & LUT_ST_LUK) == 0) - { - MLOG1(("writing Color Graphics Controller: LUT_ST_LUK Active")); - m_sr &= ~SR_LUT_OK; - } -} - -READ8_MEMBER( apollo_graphics_15i::apollo_mcr_r ) -{ - UINT8 data; - switch (offset & 0x407) - { - case 0: - data = m_sr; - if (m_ad_pending) - { - m_ad_pending = 0; - m_sr &= ~SR_DONE; - } - break; - case 1: - data = m_n_planes == 1 ? m_device_id : 0xff; - break; - case 0x400: - data = m_cr0; - break; - case 0x402: - data = m_cr1; - break; - case 0x404: - data = m_cr2; - break; - case 0x406: - data = m_cr3a; - break; - default: - data = 0xff; - break; - } - - // omit excessive logging - static UINT8 status0 = 0xff; - if ((offset != 1) && (offset != 0 || data != status0)) - { - if (offset == 0) - status0 = data; - MLOG1(("reading Graphics Controller at offset %03x = %02x (%s)", offset, data, cr_text(offset, data, 1))); - } - - return data; -} - -WRITE8_MEMBER( apollo_graphics_15i::apollo_mcr_w ) -{ - MLOG1(("writing Graphics Controller at offset %03x = %02x (%s)", offset, data, cr_text(offset, data, 0))); - switch (offset & 0x407) - { - case 0: - m_write_enable_register = set_lsb0(m_write_enable_register, data); - break; - case 1: - m_write_enable_register = set_msb0(m_write_enable_register, data); - // FIXME: seems to be necessary for dex - m_blt_cycle_count = 0; - m_sr &= ~SR_ALT; - break; - case 2: - m_rop_register = set_lsb0(m_rop_register, data); - break; - case 3: - m_rop_register = set_msb0(m_rop_register, data); - set_status_rmw(); - break; - case 4: - case 5: - // trigger memory refresh in diagnostic mode - m_diag_mem_request = data; - break; - case 0x400: - m_cr0 = data; - break; - case 0x402: - set_cr1(data); - break; - case 0x404: - m_cr2 = data; - m_cr2_s_data = CR2_S_DATA(data); - m_cr2_s_plane = 0x00; - m_cr2_d_plane = 0x0e; - // for DISP7B.DEX Test 16 - m_sr |= SR_R_M_W; - break; - case 0x406: - set_cr3a(data); - break; - case 0x407: // A/D Channel Register - m_ad_pending = 1; - m_sr |= SR_DONE; - break; - } -} - -void apollo_graphics_15i::set_status_rmw() -{ - UINT8 plane, d_plane_bit; - UINT32 rop_reg; - - m_sr &= ~SR_R_M_W; - rop_reg = m_rop_register; - d_plane_bit = 0x01; - for (plane = 0; plane < m_n_planes; plane++) - { - if ((m_cr2_d_plane & d_plane_bit) == 0) - { - switch (rop_reg & 0x0f) - { - case 0: // zero - case 3: // Source - case 0x0c: // ~Source - case 0x0f: // one - break; - default: - m_sr |= SR_R_M_W; - break; - } - } - rop_reg >>= 4; - d_plane_bit <<= 1; - } -} - -UINT16 apollo_graphics_15i::rop(UINT16 dest_data, UINT16 src_data, UINT8 plane) -{ - UINT16 src_data1 = src_data; - if (m_cr1 & CR1_ROP_EN) - { - switch ((m_rop_register >> (plane * 4)) & 0x0f) - { - case 0: // zero - src_data = 0; - break; - case 1: // Source AND Destination - src_data = src_data & dest_data; - break; - case 2: // Source AND ~Destination - src_data = src_data & (~dest_data); - break; - case 3: // Source - break; - case 4: // ~Source AND Destination - src_data = (~src_data) & dest_data; - break; - case 5: // Destination - src_data = dest_data; - break; - case 6: // Source XOR Destination - src_data = src_data ^ dest_data; - break; - case 7: // Source OR Destination - src_data = src_data | dest_data; - break; - case 8: // Source NOR Destination - src_data = ~(src_data | dest_data); - break; - case 9: // Source XNOR Destination - src_data = ~(src_data ^ dest_data); - break; - case 0x0a: // ~Destination - src_data = ~dest_data; - break; - case 0x0b: // Source OR ~Destination - src_data = src_data | (~dest_data); - break; - case 0x0c: // ~Source - src_data = ~src_data; - break; - case 0x0d: // ~Source OR Destination - src_data = (~src_data) | dest_data; - break; - case 0x0e: // Source NAND Destination - src_data = ~(src_data & dest_data); - break; - case 0x0f: // One - src_data = 0xffff; - break; - } - } - MLOG2(("rop: cr0=%02x cr1=%02x cr2=%02x rop_register=%08x dest=%04x src=%04x plane=%d s_plane=%d ->%04x", m_cr0, m_cr1, m_cr2, m_rop_register,dest_data, src_data1, plane, m_cr2_s_plane, src_data )) - return src_data; -} - -void apollo_graphics_15i::set_source_data(UINT32 offset) -{ - if (m_n_planes == 1 || (m_cr1 & CR1_AD_BIT)) - { - offset += m_image_plane_size * m_cr2_s_plane; - m_guard_latch[m_cr2_s_plane] <<= 16; - m_guard_latch[m_cr2_s_plane] |= m_image_memory[offset]; - } - else - { - UINT8 plane; - for (plane = 0; plane < m_n_planes; plane++) - { - m_guard_latch[plane] <<= 16; - m_guard_latch[plane] |= m_image_memory[offset]; - offset += m_image_plane_size; - } - } -} - -UINT32 apollo_graphics_15i::get_source_data(UINT8 plane) -{ - UINT32 src_data; - - if (m_n_planes == 1 || (m_cr1 & CR1_AD_BIT)) - { - src_data = m_guard_latch[m_cr2_s_plane]; - } - else - { - src_data = m_guard_latch[plane]; - } - - switch (m_cr2_s_data) - { - case CR2_CONST_ACCESS: // 0x00 - // set source to all ones (used for vectors) - src_data = 0xffff; - break; - case CR2_PIXEL_ACCESS: // 0x01 - // replicate 4 LSB of data bus - src_data = src_data & (1 << plane) ? 0xffff : 0; - break; - case CR2_SHIFT_ACCESS: // 0x02 - // replicate LSB of shifter - src_data = src_data & 1 ? 0xffff : 0; - break; - case CR2_PLANE_ACCESS: // 0x03 - // use source data unchanged (normal use) - if (CR0_SHIFT(m_cr0) >= 16) - { - src_data = (src_data << 16) | (src_data >> 16); - } - src_data >>= (CR0_SHIFT(m_cr0) & 0x0f); - break; - } - return src_data; -} - -void apollo_graphics_15i::blt(UINT32 dest_addr, UINT16 mem_mask) -{ - UINT16 src_data, dest_data; - UINT8 d_plane_bit; - UINT8 plane; - - d_plane_bit = 0x01; - for (plane = 0; plane < m_n_planes; plane++) - { - if ((m_cr2_d_plane & d_plane_bit) == 0) - { - dest_data = m_image_memory[dest_addr]; - src_data = get_source_data(plane); - src_data = rop(dest_data, src_data, plane); - src_data &= ~(m_write_enable_register | ~mem_mask); - dest_data &= (m_write_enable_register | ~mem_mask); - m_image_memory[dest_addr] = dest_data | src_data; - } - dest_addr += m_image_plane_size; - d_plane_bit <<= 1; - } -} - -/*************************************************************************** - Monochrome graphics memory space at FA0000 - FDFFFF - Color graphics memory space at A0000 - BFFFF - ***************************************************************************/ - -READ16_MEMBER( apollo_graphics_15i::apollo_mem_r ) -{ - UINT16 data; - UINT32 src_addr; - - if (offset >= m_image_memory_size) - { - // 128 kB display buffer of 15" screen seems to be shadowed from $fa0000 to $fc0000 - MLOG1(("reading Graphics Memory at invalid offset %05x", offset)); - offset %= m_image_memory_size; - } - - src_addr = offset + m_image_plane_size * m_cr2_s_plane; - - switch (CR0_MODE(m_cr0)) - { - case CR0_MODE_VECTOR: // vector or fill mode - case CR0_MODE_3: // CPU source BLT: read internal data bus - data = m_guard_latch[m_cr2_s_plane]; - break; - - default: - set_source_data(offset); - data = m_image_memory[src_addr]; - break; - } - - // omit excessive logging - if ((offset & (m_image_plane_size - 1)) < 8) - { - MLOG1(("reading Graphics Memory with mode %d: src_addr %05x = %04x & %04x", CR0_MODE(m_cr0), src_addr, data, mem_mask)); - } - else if ((offset & (m_image_plane_size - 1)) == 8) - { - MLOG1(("...")); - } - return data; -} - -WRITE16_MEMBER( apollo_graphics_15i::apollo_mem_w ) -{ - UINT32 dest_addr; - UINT32 src_addr; - - if (offset >= m_image_memory_size) - { - // 128 kB display buffer of 15" screen seems to be shadowed from $fa0000 to $fc0000 - MLOG1(("writing Graphics Memory at invalid offset %05x = %04x & %04x ", offset, data, mem_mask)); - offset %= m_image_memory_size; - } - - // omit excessive logging - if (offset < 24) - { - MLOG1(("writing Graphics Memory with mode %d: offset=%04x data=%04x mask=%04x", CR0_MODE(m_cr0), offset, data, mem_mask)); - } - else if (offset == 24) - { - MLOG1(("...")); - } - - switch (CR0_MODE(m_cr0)) - { - case CR0_MODE_0: - // CPU destination BLT - // 1. bus write to provide display memory address - // 2. bus read to get data - src_addr = offset + m_image_plane_size * m_cr2_s_plane; - m_guard_latch[m_cr2_s_plane] <<= 16; - m_guard_latch[m_cr2_s_plane] |= m_image_memory[src_addr]; - break; - - case CR0_MODE_1: - // Alternating BLT - // alternating bus writes provide src/dest address - // second write provides Write-enables - if (++m_blt_cycle_count == 1) - { - m_sr |= SR_ALT; - set_source_data(offset); - } - else - { - m_blt_cycle_count = 0; - m_sr &= ~SR_ALT; - m_write_enable_register = data; - blt(offset, mem_mask); - } - break; - - case CR0_MODE_VECTOR: - // Vector or fill mode - // write provides Write-enables and address - m_write_enable_register = data; - blt(offset, mem_mask); - break; - - case CR0_MODE_3: - // CPU source BLT - // 1. bus write to provide src data - // 2. bus write to provide Write-enables and address - if (++m_blt_cycle_count == 1) - { - m_sr |= SR_ALT; - - // strange: must fix byte access for /systest/grtest on sr10.2 - if (mem_mask == 0xff00) - { - data >>= 8; - mem_mask >>= 8; - } - - m_guard_latch[m_cr2_s_plane] <<= 16; - m_guard_latch[m_cr2_s_plane] |= (data & mem_mask); - } - else - { - m_blt_cycle_count = 0; - m_sr &= ~SR_ALT; - - m_write_enable_register = data; - blt(offset, mem_mask); - } - break; - - case CR0_MODE_BLT: - // Double access BLT - // bus write to provide src addr on address lines - // dest addr on data lines (16-bit WORD Offset) - - set_source_data(offset); - dest_addr = (data & mem_mask); - if (m_device_id == SCREEN_DEVICE_ID_19I && (m_cr1 & CR1_DADDR_16)) - { - dest_addr += 0x10000; - } - blt(dest_addr, 0xffff); - break; - - case CR0_MODE_NORMAL: - m_guard_latch[m_cr2_s_plane] <<= 16; - m_guard_latch[m_cr2_s_plane] |= (data & mem_mask); - blt(offset, mem_mask); - break; - - default: - MLOG(("writing Graphics Memory - unexpected cr0 mode %d", CR0_MODE(m_cr0))) - ; - break; - } - m_update_flag = 1; -} - -/*************************************************************************** - Color Screen - ***************************************************************************/ - -READ8_MEMBER( apollo_graphics_15i::apollo_ccr_r ) -{ - UINT8 data; - - if (m_n_planes == 4) - { - switch (offset & 0x407) - { - case 1: - data = m_n_planes == 4 ? m_device_id : 0xff; - break; - case 0x407: - data = m_ad_result; - break; - default: - return apollo_mcr_r(space, offset, mem_mask); - } - } - else if (m_n_planes == 8) - { - switch (offset & 0x407) - { - case 1: - data = m_n_planes == 8 ? m_device_id : 0xff; - break; - case 4: - data = get_lsb1(m_rop_register); - break; - case 5: - data = get_msb1(m_rop_register); - break; - - case 0x401: - // LUT data register - if ((m_lut_control & LUT_FIFO_CS) == 0) - { - data = m_lut_fifo->get(); - } - else if ((m_lut_control & LUT_R_W) == 0) - { - MLOG1(("apollo_graphics_15i::apollo_ccr_r: reading LUT data register with unexpected RW = 0 in LUT Control register")); - data = m_lut_data; - } - else if ((m_lut_control & LUT_AD_CS) == 0) - { - data = m_ad_result; - } - else if ((m_lut_control & LUT_CPAL_CS) == 0) - { - data = m_bt458->read(LUT_C1_C0(m_lut_control)); - } - else - { - MLOG1(("apollo_graphics_15i::apollo_ccr_r: reading LUT data register with unexpected CS in LUT Control register")); - data = m_lut_data; - } - break; - case 0x403: - // LUT control register - data = m_lut_control; - break; - case 0x404: - // cr2a - data = m_cr2; - break; - case 0x405: - // cr2b - data = m_cr2b; - break; - case 0x407: - // cr3b - data = m_cr3b; - break; - default: - return apollo_mcr_r(space, offset, mem_mask); - } - } - else - { - data = 0xff; - } - - // omit excessive logging - static UINT8 status1 = 0xff; - if ((offset != 1) && (offset != 0 || data != status1)) - { - if (offset == 0) - status1 = data; - MLOG1(("reading Color Graphics Controller at offset %03x = %02x (%s)", offset, data, cr_text(offset, data, 1))); - } - - return data; -} - -UINT8 apollo_graphics_15i::get_pixel(UINT32 offset, UINT16 mask) -{ - UINT8 data = 0; - UINT16 *source_ptr = m_image_memory + offset; - - if (m_n_planes == 4) - { - UINT16 data0 = source_ptr[0]; - UINT16 data1 = source_ptr[m_image_plane_size]; - UINT16 data2 = source_ptr[m_image_plane_size * 2]; - UINT16 data3 = source_ptr[m_image_plane_size * 3]; - - data = (data0 & mask) ? 1 : 0; - data |= (data1 & mask) ? 2 : 0; - data |= (data2 & mask) ? 4 : 0; - data |= (data3 & mask) ? 8 : 0; - } - else if (m_n_planes == 8) - { - UINT16 data0 = source_ptr[0]; - UINT16 data1 = source_ptr[m_image_plane_size]; - UINT16 data2 = source_ptr[m_image_plane_size * 2]; - UINT16 data3 = source_ptr[m_image_plane_size * 3]; - UINT16 data4 = source_ptr[m_image_plane_size * 4]; - UINT16 data5 = source_ptr[m_image_plane_size * 5]; - UINT16 data6 = source_ptr[m_image_plane_size * 6]; - UINT16 data7 = source_ptr[m_image_plane_size * 7]; - - data = (data0 & mask) ? 1 : 0; - data |= (data1 & mask) ? 2 : 0; - data |= (data2 & mask) ? 4 : 0; - data |= (data3 & mask) ? 8 : 0; - data |= (data4 & mask) ? 0x10 : 0; - data |= (data5 & mask) ? 0x20 : 0; - data |= (data6 & mask) ? 0x40 : 0; - data |= (data7 & mask) ? 0x80 : 0; - } - - return data; -} - -// read the 4-plane ADC value for data - -UINT8 apollo_graphics_15i::c4p_read_adc(UINT8 data) -{ - UINT8 value = 0; - - if ((data & 0x0c) == 0x04) - { - UINT8 red, green, blue; - UINT8 pixel = get_pixel((m_v_clock * m_buffer_width / 16) + m_h_clock, - 0x8000); - UINT32 rgb = m_color_lookup_table[pixel]; - - if ((m_sr & SR_BLANK) != 0) - { - // not blanking - red = 30 + ((rgb >> 16) & 0xff) / 4; - green = 60 + ((rgb >> 8) & 0xff) / 4; - blue = 30 + (rgb & 0xff) / 4; - } - else if (m_h_clock > 2) - { - // blanking - red = 20; - green = 50; - blue = 20; - } - else - { - // sync - red = 20; - green = 10; - blue = 20; - } - - switch (data & 3) - { - case 0: // Red - value = red; - break; - case 1: // Green - value = green; - break; - case 2: // Blue - value = blue; - break; - default: // unused - value = 0; - break; - } - } - return value; -} - -// read the 8-plane ADC value for data - -UINT8 apollo_graphics_15i::c8p_read_adc(UINT8 data) -{ - UINT8 value = 0; - - if ((data & 0x0c) == 0x04) - { - UINT8 red, green, blue; - UINT8 pixel = get_pixel((m_v_clock * m_buffer_width / 16) + m_h_clock, 0x8000); - UINT32 rgb = m_bt458->get_rgb(pixel); - - if ((m_sr & SR_BLANK) != 0) - { - // not blanking - red = 10 + ((rgb >> 16) & 0xff) / 2; - green = 70 + ((rgb >> 8) & 0xff) / 2; - blue = 10 + (rgb & 0xff) / 2; - } - else if (m_h_clock < 20) - { - // blanking - red = 5; - green = 60; - blue = 5; - } - else - { - // sync - red = 5; - green = 5; - blue = 5; - } - - switch (data & 3) - { - case 0: // Red - value = red; - break; - case 1: // Green - value = green; - break; - case 2: // Blue - value = blue; - break; - default: // unused - value = 0; - break; - } - } - return value; -} - -WRITE8_MEMBER( apollo_graphics_15i::apollo_ccr_w ) -{ - static const UINT8 rgb_value[16] = - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, - 0xcc, 0xdd, 0xee, 0xff }; - - if (m_n_planes == 4) - { - switch (offset & 0x407) - { - case 0x401: - // red lookup table register - m_color_lookup_table[data >> 4] &= 0xff00ffff; - m_color_lookup_table[data >> 4] |= rgb_value[data & 0x0f] << 16; - break; - case 0x403: - // green lookup table register - m_color_lookup_table[data >> 4] &= 0xffff00ff; - m_color_lookup_table[data >> 4] |= rgb_value[data & 0x0f] << 8; - break; - case 0x404: - // cr2 - m_cr2 = data; - m_cr2_s_data = CR2_S_DATA(data); - m_cr2_s_plane = CR2_S_PLANE(data); - m_cr2_d_plane = CR2_D_PLANE(data); - // for DISP7B.DEX Test 16 - m_sr |= SR_R_M_W; - break; - case 0x405: - // blue lookup table register - m_color_lookup_table[data >> 4] &= 0xffffff00; - m_color_lookup_table[data >> 4] |= rgb_value[data & 0x0f]; - break; - case 0x407: - // A/D channel register - m_ad_result = c4p_read_adc(data); - m_ad_pending = 1; - m_sr |= SR_DONE; - break; - default: - apollo_mcr_w(space, offset, data, mem_mask); - return; - } - } - else if (m_n_planes == 8) - { - switch (offset & 0x407) - { - case 2: - m_rop_register = set_lsb0(m_rop_register, data); - break; - case 3: - m_rop_register = set_msb0(m_rop_register, data); - set_status_rmw(); - break; - case 4: - m_rop_register = set_lsb1(m_rop_register, data); - break; - case 5: - m_rop_register = set_msb1(m_rop_register, data); - set_status_rmw(); - break; - case 6: - case 7: - // trigger memory refresh in diagnostic mode - m_diag_mem_request = data; - break; - case 0x401: - // LUT data register - m_lut_data = data; - if ((m_lut_control & LUT_R_W) == 1) - { - MLOG1(("apollo_graphics_15i::apollo_ccr_w: writing LUT data register with RW = 1 in LUT Control register")); - } - else if ((m_lut_control & LUT_AD_CS) == 0) - { - m_ad_result = c8p_read_adc(data); - m_ad_pending = 1; - m_sr |= SR_DONE; - } - else if ((m_lut_control & LUT_CPAL_CS) == 0) - { - m_bt458->write(data, LUT_C1_C0(m_lut_control)); - } - else if ((m_lut_control & LUT_FIFO_CS) == 0) - { - m_lut_fifo->put(data); - } - else - { - MLOG1(("apollo_graphics_15i::apollo_ccr_w: writing LUT data register with unexpected CS in LUT Control register")); - } - break; - case 0x403: - // LUT control register - set_lut_cr(data); - break; - case 0x404: - // cr2a - m_cr2 = data; - m_cr2_d_plane = CR2A_D_PLANE(data); - m_sr |= SR_R_M_W; - break; - case 0x405: - // cr2b - m_cr2b = data; - m_cr2_s_data = CR2_S_DATA(data); - m_cr2_s_plane = CR2B_S_PLANE(data); - break; - case 0x407: - // cr3b - set_cr3b(data); - break; - default: - apollo_mcr_w(space, offset, data, mem_mask); - return; - } - } - - MLOG1(("writing Color Graphics Controller at offset %03x = %02x (%s)", offset, data, cr_text(offset, data, 0))); -} - -READ16_MEMBER( apollo_graphics_15i::apollo_cgm_r ) -{ - if (!is_mono()) - { - return apollo_mem_r(space, offset, mem_mask); - } - else - { - return 0xffff; - } -} - -WRITE16_MEMBER( apollo_graphics_15i::apollo_cgm_w ) -{ - if (!is_mono()) - { - apollo_mem_w(space, offset, data, mem_mask); - } -} - -/*************************************************************************** - VIDEO HARDWARE - ***************************************************************************/ - -UINT32 apollo_graphics_15i::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int has_changed = 0; - - if (m_update_flag && !m_update_pending) - { - has_changed = 1; - m_update_flag = 0; - m_update_pending = 1; - screen_update1(bitmap, cliprect); - m_update_pending = 0; - } - return has_changed ? 0 : UPDATE_HAS_NOT_CHANGED; -} - -void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT16 *source_ptr = m_image_memory; - int x, y; - UINT16 data, mask; - UINT16 inverse = (m_cr1 & CR1_INV) ? 0xffff : 0; - - MLOG1(("screen_update1: size=%0x rowpixels=%d", m_image_memory_size, bitmap.rowpixels())); - - if ((m_cr1 & CR1_DISP_EN) == 0) - { - // display is disabled - for (y = 0; y < m_height; y++) - { - int dest = 0; - for (x = 0; x < m_width; x += 16) - { - for (mask = 0x8000; mask; mask >>= 1) - { - bitmap.pix32(y, dest++) = 0; - } - } - source_ptr += (m_buffer_width - m_width) / 16; - } - } - else if (m_n_planes == 4) - { - for (y = 0; y < m_height; y++) - { - int dest = 0; - for (x = 0; x < m_width; x += 16) - { - UINT16 data0 = source_ptr[0]; - UINT16 data1 = source_ptr[m_image_plane_size]; - UINT16 data2 = source_ptr[m_image_plane_size * 2]; - UINT16 data3 = source_ptr[m_image_plane_size * 3]; - source_ptr++; - for (mask = 0x8000; mask; mask >>= 1) - { - data = (data0 & mask) ? 1 : 0; - data |= (data1 & mask) ? 2 : 0; - data |= (data2 & mask) ? 4 : 0; - data |= (data3 & mask) ? 8 : 0; - bitmap.pix32(y, dest++) = m_color_lookup_table[data]; - } - } - source_ptr += (m_buffer_width - m_width) / 16; - } - } - else if (m_n_planes == 8) - { - for (y = 0; y < m_height; y++) - { - int dest = 0; - for (x = 0; x < m_width; x += 16) - { - UINT16 data0 = source_ptr[0]; - UINT16 data1 = source_ptr[m_image_plane_size]; - UINT16 data2 = source_ptr[m_image_plane_size * 2]; - UINT16 data3 = source_ptr[m_image_plane_size * 3]; - UINT16 data4 = source_ptr[m_image_plane_size * 4]; - UINT16 data5 = source_ptr[m_image_plane_size * 5]; - UINT16 data6 = source_ptr[m_image_plane_size * 6]; - UINT16 data7 = source_ptr[m_image_plane_size * 7]; - source_ptr++; - for (mask = 0x8000; mask; mask >>= 1) - { - data = (data0 & mask) ? 1 : 0; - data |= (data1 & mask) ? 2 : 0; - data |= (data2 & mask) ? 4 : 0; - data |= (data3 & mask) ? 8 : 0; - data |= (data4 & mask) ? 0x10 : 0; - data |= (data5 & mask) ? 0x20 : 0; - data |= (data6 & mask) ? 0x40 : 0; - data |= (data7 & mask) ? 0x80 : 0; - bitmap.pix32(y, dest++) = m_bt458->get_rgb(data); - } - } - source_ptr += (m_buffer_width - m_width) / 16; - } - } - else // m_n_planes == 1 - { - for (y = 0; y < m_height; y++) - { - int dest = 0; - for (x = 0; x < m_width; x += 16) - { - data = *source_ptr++ ^ inverse; - for (mask = 0x8000; mask; mask >>= 1) - { - bitmap.pix32(y, dest++) = data & mask ? 0 : 0x00ffffff; - } - } - source_ptr += (m_buffer_width - m_width) / 16; - } - } -} - -/*------------------------------------------------- - vblank_state_changed - - called on each state change of the VBLANK signal - -------------------------------------------------*/ - -void apollo_graphics_15i::vblank_state_changed(screen_device &screen, bool vblank_state) -{ - if ((m_cr1 & CR1_RESET) && (m_cr1 & CR1_SYNC_EN)) - { - if (vblank_state) - { - m_sr &= ~(SR_V_BLANK | SR_BLANK); - if (m_n_planes == 1) - { - // faking V_DATA for disp.dex test 16 - if (m_image_memory[0]) - { - m_sr |= SR_V_DATA; - } - } - else if (m_n_planes == 4) - { - m_sr &= ~SR_V_FLAG; - } - } - else - { - m_sr |= (SR_V_BLANK | SR_BLANK); - if (m_n_planes == 1) - { - m_sr &= ~SR_V_DATA; - } - else if (m_n_planes == 4) - { - m_sr |= SR_V_FLAG; - } - } - } -} - -void apollo_graphics_15i::register_vblank_callback() -{ - MLOG1(("register_vblank_callback")); - - /* register for VBLANK callbacks */ - screen_device *screen = (screen_device *)machine().device(VIDEO_SCREEN_TAG); - screen->register_vblank_callback(vblank_state_delegate(FUNC(apollo_graphics_15i::vblank_state_changed),this)); -} - - -/*************************************************************************** - MACHINE DRIVERS - ***************************************************************************/ - -MACHINE_CONFIG_FRAGMENT( apollo_graphics ) - MCFG_DEFAULT_LAYOUT( layout_apollo_15i ) - MCFG_SCREEN_ADD(VIDEO_SCREEN_TAG, RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) - MCFG_SCREEN_REFRESH_RATE(76) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(657)) - MCFG_SCREEN_SIZE(1024, 800) - MCFG_SCREEN_VISIBLE_AREA(0, 1023, 0, 799) - MCFG_SCREEN_UPDATE_DEVICE(APOLLO_SCREEN_TAG, apollo_graphics_15i, screen_update) -MACHINE_CONFIG_END - -const device_type APOLLO_GRAPHICS = &device_creator ; - -apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig,const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, APOLLO_GRAPHICS, "Apollo Screen", tag, owner, clock,"apollo_graphics_15i", __FILE__), - m_lut_fifo(NULL), - m_bt458(NULL) -{ -} - -apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig,const char *tag, device_t *owner, UINT32 clock, device_type type,const char *name, const char *shortname, const char *source) : - device_t(mconfig, type, name, tag, owner, clock, shortname, source), - m_lut_fifo(NULL), - m_bt458(NULL) -{ -} - -apollo_graphics_15i::~apollo_graphics_15i() -{ - if (m_lut_fifo) global_free(m_lut_fifo); - if (m_bt458) global_free(m_bt458); -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void apollo_graphics_15i::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void apollo_graphics_15i::device_start() -{ - MLOG1(("apollo_graphics_15i::device_start")) - - m_n_planes = 0; - m_width = 0; - m_height = 0; - m_buffer_width = 0; - m_buffer_height = 0; - - m_sr = 0; - m_device_id = 0; - m_write_enable_register = 0; - m_rop_register = 0; - m_diag_mem_request = 0; - m_cr0 = 0; - m_cr1 = 0; - m_cr2 = 0; - m_cr2b = 0; - m_cr2_s_data = 0; - m_cr2_s_plane = 0x00; - m_cr2_d_plane = 0x0e; - m_cr3a = 0; - m_cr3b = 0; - m_ad_result = 0; - m_ad_pending = 0; - - m_lut_control = 0; - m_lut_data = 0; - - m_update_flag = 0; - m_update_pending = 0; - - m_blt_cycle_count = 0; - m_image_offset = 0; - memset(m_guard_latch, 0, sizeof(m_guard_latch)); - - m_h_clock = 0; - m_v_clock = 0; - m_p_clock = 0; - m_data_clock = 0; - - m_image_memory = 0; - m_image_plane_size = 0; - m_image_memory_size = 0; - - memset(m_color_lookup_table, 0, sizeof(m_color_lookup_table)); - - m_lut_fifo = NULL; - m_bt458 = NULL; -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void apollo_graphics_15i::device_reset() -{ - MLOG1(("apollo_graphics_15i::device_reset")); - - if (m_n_planes == 0) - { - if (apollo_config(APOLLO_CONF_MONO_19I)) - { - // monochrome 1280x1024 - m_n_planes = 1; - m_device_id = SCREEN_DEVICE_ID_19I; - m_width = 1280; - m_height = 1024; - m_buffer_width = 2048; - m_buffer_height = 1024; - } - else if (apollo_config(APOLLO_CONF_MONO_15I)) - { - // monochrome 1024x800 - m_n_planes = 1; - m_device_id = SCREEN_DEVICE_ID_15I; - m_width = 1024; - m_height = 800; - m_buffer_width = 1024; - m_buffer_height = 1024; - } - else if (apollo_config(APOLLO_CONF_4_PLANES)) - { - // 4-planes color 1024x800 - m_n_planes = 4; - m_device_id = SCREEN_DEVICE_ID_C4P; - m_width = 1024; - m_height = 800; - m_buffer_width = 1024; - m_buffer_height = 1024; - } - else - { - // 8-planes color 1024x800 - m_n_planes = 8; - m_device_id = SCREEN_DEVICE_ID_C8P; - m_width = 1024; - m_height = 800; - m_buffer_width = 1024; - m_buffer_height = 1024; - - if (m_lut_fifo) global_free(m_lut_fifo); - if (m_bt458) global_free(m_bt458); - - m_lut_fifo = global_alloc(lut_fifo); - - m_bt458 = global_alloc(bt458(machine())); - m_bt458->start(); - m_bt458->reset(); - } - } - - if (m_image_memory == NULL) - { - /* allocate the memory image */ - m_image_plane_size = m_buffer_height * m_buffer_width / 16; - m_image_memory_size = m_image_plane_size * m_n_planes; - m_image_memory - = auto_alloc_array(machine(), UINT16, m_image_memory_size); - assert(m_image_memory != NULL); - - MLOG1(("device reset apollo graphics: buffer=%p size=%0x", (void *) m_image_memory, m_image_memory_size)); - } - - memset(m_color_lookup_table, 0, sizeof(m_color_lookup_table)); - memset(m_image_memory, 0, m_image_memory_size * 2); - - // register_vblank_callback(this); - - /* FIXME: register for VBLANK callbacks */ - register_vblank_callback(); -} - -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( apollo_mono19i ) - MCFG_DEFAULT_LAYOUT( layout_apollo ) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - MCFG_SCREEN_ADD(VIDEO_SCREEN_TAG, RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) - MCFG_SCREEN_REFRESH_RATE(64) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(616)) - MCFG_SCREEN_SIZE(1280, 1024) - MCFG_SCREEN_VISIBLE_AREA(0, 1279, 0, 1023) - MCFG_SCREEN_UPDATE_DEVICE(APOLLO_SCREEN_TAG, apollo_graphics_19i, screen_update) - MACHINE_CONFIG_END - -const device_type APOLLO_MONO19I = &device_creator ; - -apollo_graphics_19i::apollo_graphics_19i(const machine_config &mconfig, - const char *tag, device_t *owner, UINT32 clock) : - apollo_graphics_15i(mconfig, tag, owner, clock, APOLLO_MONO19I, - "Apollo 19\" Monochrome Screen", "apollo_graphics_19i", __FILE__) -{ -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void apollo_graphics_19i::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void apollo_graphics_19i::device_start() -{ - MLOG1(("apollo_graphics_19i::device_start")); - - apollo_graphics_15i::device_start(); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void apollo_graphics_19i::device_reset() -{ - MLOG1(("apollo_graphics_19i::device_reset")); - - if (m_n_planes == 0) - { - // monochrome 1280x1024 - m_n_planes = 1; - m_device_id = SCREEN_DEVICE_ID_19I; - m_width = 1280; - m_height = 1024; - m_buffer_width = 2048; - m_buffer_height = 1024; - } - - apollo_graphics_15i::device_reset(); - - /* FIXME: register for VBLANK callbacks */ - register_vblank_callback(); -} - - -READ16_MEMBER( apollo_graphics_15i::apollo_mgm_r ) -{ - if (is_mono()) - { - return apollo_mem_r(space, offset, mem_mask); - } - else - { - return 0xffff; - } -} - -WRITE16_MEMBER( apollo_graphics_15i::apollo_mgm_w ) -{ - if (is_mono()) - { - apollo_mem_w(space, offset, data, mem_mask); - } -} diff --git a/src/mess/video/apple1.c b/src/mess/video/apple1.c deleted file mode 100644 index f6485dc7ee5..00000000000 --- a/src/mess/video/apple1.c +++ /dev/null @@ -1,392 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels, Colin Howell, R. Belmont -/*************************************************************************** - - apple1.c - - Functions to emulate the video hardware of the Apple I. - - The Apple I video hardware was basically a dumb video terminal; in - fact it was based on Steve Wozniak's own design for a simple video - terminal. It had 40 columns by 24 lines of uppercase-only text. - Text could only be output at 60 characters per second, one character - per video frame. The cursor (a blinking @) could only be advanced - using spaces or carriage returns. Carriage returns were the only - control characters recognized. Previously written text could not be - altered, only scrolled off the top of the screen. - - The video memory used seven 1k-bit dynamic shift registers. Six of - these held the 6-bit visible character codes, and one stored the - cursor location as a simple bitmap--the bit for the cursor position - was set to 0, and all the other bits were 1. - - These shift registers were continuously recirculated, completing one - cycle per video frame. As a new line of characters was about to be - scanned by the video beam, that character line would be recirculated - into the shift registers and would simultaneously be stored into a - 6x40-bit line buffer (also a shift register). At this point, if the - cursor location was in this line, a new character could be written - into that location in the shift registers and the cursor could be - advanced. (Carriage returns were not written into the shift - registers; they only advanced the cursor.) - - The characters in the line buffer were recirculated 7 times to - display the 8 scan lines of the characters, before being replaced by - a new line of characters from the main shift registers. - - Cursor blinking was performed by a Signetics 555 timer IC whose - output was gated into the character code signals as they passed into - the line buffer. - - Character images were provided by a Signetics 2513 character - generator ROM, a chip also used in computer terminals such as the - ADM-3A. This ROM had 9 address lines and 5 data lines; it contained - 64 character images, each 5 pixels wide by 8 pixels high, with one - line of pixels being blank for vertical separation. The video - circuitry added the 2 pixels of horizontal separation for each - character. - - A special CLEAR SCREEN switch on the keyboard, directly connected to - the video hardware, could be used to clear the video memory and - return the cursor to the home position. This was completely - independent of the processor. - - A schematic of the Apple I video hardware can be found in the - Apple-1 Operation Manual; look for the schematic titled "Terminal - Section". Most of the functionality modeled here was determined by - reading this schematic. Many of the chips used were standard 74xx - TTL chips, but the shift registers used for the video memory and - line buffer were Signetics 25xx PMOS ICs. These were already - becoming obsolete when the Apple I was built, and detailed - information on them is very hard to find today. - -***************************************************************************/ - -#include "emu.h" -#include "includes/apple1.h" - - -/*************************************************************************** - - Terminal code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(apple1_state::terminal_gettileinfo) -{ - int ch, gfxfont, code, color; - - ch = m_current_terminal->mem[tile_index]; - code = ch & ((1 << m_current_terminal->char_bits) - 1); - color = ch >> m_current_terminal->char_bits; - gfxfont = m_current_terminal->gfx; - - if ((tile_index == m_current_terminal->cur_offset) && !m_current_terminal->cur_hidden && m_current_terminal->getcursorcode) - code = m_current_terminal->getcursorcode(code); - - SET_TILE_INFO_MEMBER(gfxfont, /* gfx */ - code, /* character */ - color, /* color */ - 0); /* flags */ -} - -void apple1_state::terminal_draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal) -{ - m_current_terminal = terminal; - terminal->tm->draw(screen, dest, cliprect, 0, 0); - m_current_terminal = NULL; -} - -void apple1_state::verify_coords(terminal_t *terminal, int x, int y) -{ - assert(x >= 0); - assert(y >= 0); - assert(x < terminal->num_cols); - assert(y < terminal->num_rows); -} - -void apple1_state::terminal_putchar(terminal_t *terminal, int x, int y, int ch) -{ - int offs; - - verify_coords(terminal, x, y); - - offs = y * terminal->num_cols + x; - if (terminal->mem[offs] != ch) - { - terminal->mem[offs] = ch; - terminal->tm->mark_tile_dirty(offs); - } -} - -int apple1_state::terminal_getchar(terminal_t *terminal, int x, int y) -{ - int offs; - - verify_coords(terminal, x, y); - offs = y * terminal->num_cols + x; - return terminal->mem[offs]; -} - -void apple1_state::terminal_putblank(terminal_t *terminal, int x, int y) -{ - terminal_putchar(terminal, x, y, terminal->blank_char); -} - -void apple1_state::terminal_dirtycursor(terminal_t *terminal) -{ - if (terminal->cur_offset >= 0) - terminal->tm->mark_tile_dirty(terminal->cur_offset); -} - -void apple1_state::terminal_setcursor(terminal_t *terminal, int x, int y) -{ - terminal_dirtycursor(terminal); - terminal->cur_offset = y * terminal->num_cols + x; - terminal_dirtycursor(terminal); -} - -void apple1_state::terminal_hidecursor(terminal_t *terminal) -{ - terminal->cur_hidden = 1; - terminal_dirtycursor(terminal); -} - -void apple1_state::terminal_showcursor(terminal_t *terminal) -{ - terminal->cur_hidden = 0; - terminal_dirtycursor(terminal); -} - -void apple1_state::terminal_getcursor(terminal_t *terminal, int *x, int *y) -{ - *x = terminal->cur_offset % terminal->num_cols; - *y = terminal->cur_offset / terminal->num_cols; -} - -void apple1_state::terminal_fill(terminal_t *terminal, int val) -{ - int i; - for (i = 0; i < terminal->num_cols * terminal->num_rows; i++) - terminal->mem[i] = val; - terminal->tm->mark_all_dirty(); -} - -void apple1_state::terminal_clear(terminal_t *terminal) -{ - terminal_fill(terminal, terminal->blank_char); -} - -terminal_t *apple1_state::terminal_create( - int gfx, int blank_char, int char_bits, - int (*getcursorcode)(int original_code), - int num_cols, int num_rows) -{ - terminal_t *term; - int char_width, char_height; - - char_width = m_gfxdecode->gfx(gfx)->width(); - char_height = m_gfxdecode->gfx(gfx)->height(); - - term = (terminal_t *) auto_alloc_array(machine(), char, sizeof(terminal_t) - sizeof(term->mem) - + (num_cols * num_rows * sizeof(termchar_t))); - - term->tm = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(apple1_state::terminal_gettileinfo),this), TILEMAP_SCAN_ROWS, - char_width, char_height, num_cols, num_rows); - - term->gfx = gfx; - term->blank_char = blank_char; - term->char_bits = char_bits; - term->num_cols = num_cols; - term->num_rows = num_rows; - term->getcursorcode = getcursorcode; - term->cur_offset = -1; - term->cur_hidden = 0; - terminal_clear(term); - return term; -} - - -/**************************************************************************/ - - - -/* The cursor blinking is generated by a free-running timer with a - 0.52-second period. It is on for 2/3 of this period and off for - 1/3. */ -#define CURSOR_OFF_LENGTH (0.52/3) - -/**************************************************************************/ - -static int apple1_getcursorcode(int original_code) -{ - /* Cursor uses symbol 0 (an @ sign) in the character generator ROM. */ - return 0; -} - -/**************************************************************************/ - -void apple1_state::video_start() -{ - m_blink_on = 1; /* cursor is visible initially */ - m_terminal = terminal_create( - 0, /* graphics font 0 (the only one we have) */ - 32, /* Blank character is symbol 32 in the ROM */ - 8, /* use 8 bits for the character code */ - apple1_getcursorcode, - 40, 24); /* 40 columns, 24 rows */ - - terminal_setcursor(m_terminal, 0, 0); -} - -/* This function handles all writes to the video display. */ -void apple1_state::apple1_vh_dsp_w (int data) -{ - int x, y; - int cursor_x, cursor_y; - - /* While CLEAR SCREEN is being held down, the hardware is forced - to clear the video memory, so video writes have no effect. */ - if (m_vh_clrscrn_pressed) - return; - - /* The video display port only accepts the 7 lowest bits of the char. */ - data &= 0x7f; - - terminal_getcursor(m_terminal, &cursor_x, &cursor_y); - - if (data == '\r') { - /* Carriage-return moves the cursor to the start of the next - line. */ - cursor_x = 0; - cursor_y++; - } - else if (data < ' ') { - /* Except for carriage-return, the video hardware completely - ignores all control characters. */ - return; - } - else { - /* For visible characters, only 6 bits of the ASCII code are - used, because the 2513 character generator ROM only - contains 64 symbols. The low 5 bits of the ASCII code are - used directly. Bit 6 is ignored, since it is the same for - all the available characters in the ROM. Bit 7 is inverted - before being used as the high bit of the 6-bit ROM symbol - index, because the block of 32 ASCII symbols containing the - uppercase letters comes first in the ROM. */ - - int romindx = (data & 0x1f) | (((data ^ 0x40) & 0x40) >> 1); - - terminal_putchar(m_terminal, cursor_x, cursor_y, romindx); - if (cursor_x < 39) - { - cursor_x++; - } - else - { - cursor_x = 0; - cursor_y++; - } - } - - /* If the cursor went past the bottom line, scroll the text up one line. */ - if (cursor_y == 24) - { - for (y = 1; y < 24; y++) - for (x = 0; x < 40; x++) - terminal_putchar(m_terminal, x, y-1, - terminal_getchar(m_terminal, x, y)); - - for (x = 0; x < 40; x++) - terminal_putblank(m_terminal, x, 23); - - cursor_y--; - } - - terminal_setcursor(m_terminal, cursor_x, cursor_y); -} - -/* This function handles clearing the video display on cold-boot or in - response to a press of the CLEAR SCREEN switch. */ -void apple1_state::apple1_vh_dsp_clr () -{ - terminal_setcursor(m_terminal, 0, 0); - terminal_clear(m_terminal); -} - -/* Calculate how long it will take for the display to assert the RDA - signal in response to a video display write. This signal indicates - the display has completed the write and is ready to accept another - write. */ -attotime apple1_state::apple1_vh_dsp_time_to_ready () -{ - int cursor_x, cursor_y; - int cursor_scanline; - double scanline_period = m_screen->scan_period().as_double(); - double cursor_hfrac; - - /* The video hardware refreshes the screen by reading the - character codes from its circulating shift-register memory. - Because of the way this memory works, a new character can only - be written into the cursor location at the moment this location - is about to be read. This happens during the first scanline of - the cursor's character line, when the beam reaches the cursor's - horizontal position. */ - - terminal_getcursor(m_terminal, &cursor_x, &cursor_y); - cursor_scanline = cursor_y * apple1_charlayout.height; - - /* Each scanline is composed of 455 pixel times. The first 175 of - these are the horizontal blanking period; the remaining 280 are - for the visible part of the scanline. */ - cursor_hfrac = (175 + cursor_x * apple1_charlayout.width) / 455; - - if (m_screen->vpos() == cursor_scanline) { - /* video_screen_get_hpos() doesn't account for the horizontal - blanking interval; it acts as if the scanline period is - entirely composed of visible pixel times. However, we can - still use it to find what fraction of the current scanline - period has elapsed. */ - double current_hfrac = m_screen->hpos() / - m_screen->width(); - if (current_hfrac < cursor_hfrac) - return attotime::from_double(scanline_period * (cursor_hfrac - current_hfrac)); - } - - return attotime::from_double( - m_screen->time_until_pos(cursor_scanline, 0).as_double() + - scanline_period * cursor_hfrac); -} - -/* Blink the cursor on or off, as appropriate. */ -void apple1_state::apple1_vh_cursor_blink () -{ - int new_blink_on; - - /* The cursor is on for 2/3 of its blink period and off for 1/3. - This is most easily handled by dividing the total elapsed time - by the length of the off-portion of the cycle, giving us the - number of one-third-cycles elapsed, then checking the result - modulo 3. */ - - if (((int) (machine().time().as_double() / CURSOR_OFF_LENGTH)) % 3 < 2) - new_blink_on = 1; - else - new_blink_on = 0; - - if (new_blink_on != m_blink_on) { /* have we changed state? */ - if (new_blink_on) - terminal_showcursor(m_terminal); - else - terminal_hidecursor(m_terminal); - m_blink_on = new_blink_on; - } -} - -UINT32 apple1_state::screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - apple1_vh_cursor_blink(); - terminal_draw(screen, bitmap, cliprect, m_terminal); - return 0; -} diff --git a/src/mess/video/apple2.c b/src/mess/video/apple2.c deleted file mode 100644 index 195fed4ce8f..00000000000 --- a/src/mess/video/apple2.c +++ /dev/null @@ -1,1540 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/*************************************************************************** - - video/apple2.c - -***************************************************************************/ - -#include "emu.h" -#include "includes/apple2.h" -#include "machine/ram.h" - -#include "video/apple2.h" - -/***************************************************************************/ - - -#define BLACK 0 -#define DKRED 1 -#define DKBLUE 2 -#define PURPLE 3 -#define DKGREEN 4 -#define DKGRAY 5 -#define BLUE 6 -#define LTBLUE 7 -#define BROWN 8 -#define ORANGE 9 -#define GRAY 10 -#define PINK 11 -#define GREEN 12 -#define YELLOW 13 -#define AQUA 14 -#define WHITE 15 - -#define ALWAYS_REFRESH 0 -#define PROFILER_VIDEOTOUCH PROFILER_USER3 - -/*************************************************************************** - HELPERS -***************************************************************************/ - -/*------------------------------------------------- - effective_a2 - calculates the effective a2 - register --------------------------------------------------*/ - -inline UINT32 apple2_state::effective_a2() -{ - return m_flags & m_a2_videomask; -} - - -/*------------------------------------------------- - compute_video_address - performs funky Apple II - video address lookup --------------------------------------------------*/ - -UINT32 apple2_state::compute_video_address(int col, int row) -{ - /* special Apple II addressing - gotta love it */ - return (((row & 0x07) << 7) | ((row & 0x18) * 5 + col)); -} - - - -/*------------------------------------------------- - adjust_begin_and_end_row - processes the cliprect --------------------------------------------------*/ - -void apple2_state::adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow) -{ - /* assumptions of the code */ - assert((*beginrow % 8) == 0); - assert((*endrow % 8) == 7); - - *beginrow = MAX(*beginrow, cliprect.min_y - (cliprect.min_y % 8)); - *endrow = MIN(*endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - - /* sanity check again */ - assert((*beginrow % 8) == 0); - assert((*endrow % 8) == 7); -} - - - -/*************************************************************************** - TEXT -***************************************************************************/ - -/*------------------------------------------------- - apple2_plot_text_character - plots a single - textual character --------------------------------------------------*/ - -inline void apple2_state::apple2_plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, - const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2) -{ - int x, y, i; - int fg = m_fgcolor; - int bg = m_bgcolor; - const UINT8 *chardata; - UINT16 color; - - if (m_sysconfig != NULL) - { - switch (m_sysconfig->read() & 0x03) - { - case 0: - break; // leave alone - - case 1: - if ((m_machinetype == APPLE_II) || (m_machinetype == LABA2P) || (m_machinetype == SPACE84)) - { - bg = WHITE; - } - else - { - fg = WHITE; - } - break; - - case 2: - if ((m_machinetype == APPLE_II) || (m_machinetype == LABA2P) || (m_machinetype == SPACE84)) - { - bg = GREEN; - } - else - { - fg = GREEN; - } - break; - - case 3: - if ((m_machinetype == APPLE_II) || (m_machinetype == LABA2P) || (m_machinetype == SPACE84)) - { - bg = ORANGE; - } - else - { - fg = ORANGE; - } - break; - } - } - - - if (my_a2 & VAR_ALTCHARSET) - { - /* we're using an alternate charset */ - code |= m_alt_charset_value; - } - else if (m_flash && (code >= 0x40) && (code <= 0x7f)) - { - /* we're flashing; swap */ - i = fg; - fg = bg; - bg = i; - } - - /* look up the character data */ - chardata = &textgfx_data[(code * 8) % textgfx_datalen]; - - /* and finally, plot the character itself */ - if ((m_machinetype == SPACE84) || (m_machinetype == LABA2P)) - { - for (y = 0; y < 8; y++) - { - for (x = 0; x < 7; x++) - { - color = (chardata[y] & (1 << (6-x))) ? bg : fg; - - for (i = 0; i < xscale; i++) - { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; - } - } - } - } - else - { - for (y = 0; y < 8; y++) - { - for (x = 0; x < 7; x++) - { - color = (chardata[y] & (1 << x)) ? bg : fg; - - for (i = 0; i < xscale; i++) - { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; - } - } - } - } -} - - - -/*------------------------------------------------- - apple2_text_draw - renders text (either 40 - column or 80 column) --------------------------------------------------*/ - -void apple2_state::apple2_text_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) -{ - int row, col; - UINT32 start_address = (page ? 0x0800 : 0x0400); - UINT32 address; - UINT32 my_a2 = effective_a2(); - - /* perform adjustments */ - adjust_begin_and_end_row(cliprect, &beginrow, &endrow); - - for (row = beginrow; row <= endrow; row += 8) - { - for (col = 0; col < 40; col++) - { - /* calculate adderss */ - address = start_address + compute_video_address(col, row / 8); - - if (my_a2 & VAR_80COL) - { - apple2_plot_text_character(bitmap, col * 14 + 0, row, 1, m_a2_videoaux[address], - m_textgfx_data, m_textgfx_datalen, my_a2); - apple2_plot_text_character(bitmap, col * 14 + 7, row, 1, m_a2_videoram[address], - m_textgfx_data, m_textgfx_datalen, my_a2); - } - else - { - apple2_plot_text_character(bitmap, col * 14, row, 2, m_a2_videoram[address], - m_textgfx_data, m_textgfx_datalen, my_a2); - } - } - } -} - - -/*------------------------------------------------- - apple2_lores_draw - renders lo-res text --------------------------------------------------*/ - -void apple2_state::apple2_lores_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) -{ - int row, col, y, x; - UINT8 code; - UINT32 start_address = (page ? 0x0800 : 0x0400); - UINT32 address; - - /* perform adjustments */ - adjust_begin_and_end_row(cliprect, &beginrow, &endrow); - - for (row = beginrow; row <= endrow; row += 8) - { - for (col = 0; col < 40; col++) - { - /* calculate adderss */ - address = start_address + compute_video_address(col, row / 8); - - /* perform the lookup */ - code = m_a2_videoram[address]; - - /* and now draw */ - for (y = 0; y < 4; y++) - { - for (x = 0; x < 14; x++) - bitmap.pix16(row + y, col * 14 + x) = (code >> 0) & 0x0F; - } - for (y = 4; y < 8; y++) - { - for (x = 0; x < 14; x++) - bitmap.pix16(row + y, col * 14 + x) = (code >> 4) & 0x0F; - } - } - } -} - - -/*************************************************************************** - HIGH RESOLUTION GRAPHICS -***************************************************************************/ - -void apple2_state::apple2_hires_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) -{ - const UINT8 *vram, *vaux; - int row, col, b; - int offset; - int columns; - UINT8 vram_row[82]; - UINT16 v; - UINT16 *p; - UINT32 w; - UINT16 *artifact_map_ptr; - int mon_type = 0; - - if (m_sysconfig != NULL) - { - mon_type = m_sysconfig->read() & 0x03; - } - - /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; - if (endrow < beginrow) - return; - - if (m_machinetype == TK2000) - { - vram = m_a2_videoram + (page ? 0xa000 : 0x2000); - vaux = m_a2_videoaux + (page ? 0xa000 : 0x2000); - } - else - { - vram = m_a2_videoram + (page ? 0x4000 : 0x2000); - vaux = m_a2_videoaux + (page ? 0x4000 : 0x2000); - } - columns = ((effective_a2() & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40; - - vram_row[0] = 0; - vram_row[columns + 1] = 0; - - for (row = beginrow; row <= endrow; row++) - { - for (col = 0; col < 40; col++) - { - offset = compute_video_address(col, row / 8) | ((row & 7) << 10); - - switch(columns) - { - case 40: - vram_row[1+col] = vram[offset]; - break; - - case 80: - vram_row[1+(col*2)+0] = vaux[offset]; - vram_row[1+(col*2)+1] = vram[offset]; - break; - - default: - fatalerror("Invalid column count\n"); - } - } - - p = &bitmap.pix16(row); - - for (col = 0; col < columns; col++) - { - w = (((UINT32) vram_row[col+0] & 0x7f) << 0) - | (((UINT32) vram_row[col+1] & 0x7f) << 7) - | (((UINT32) vram_row[col+2] & 0x7f) << 14); - - switch(columns) - { - case 40: - switch (mon_type) - { - case 0: - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) - { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; - *(p++) = v; - *(p++) = v; - } - break; - - case 1: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? WHITE : BLACK; - *(p++) = v ? WHITE : BLACK; - } - break; - - case 2: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? GREEN : BLACK; - *(p++) = v ? GREEN : BLACK; - } - break; - - case 3: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? ORANGE : BLACK; - *(p++) = v ? ORANGE : BLACK; - } - break; - } - break; - - case 80: - if (m_monochrome_dhr) - { - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? WHITE : BLACK; - } - } - else - { - switch (mon_type) - { - case 0: - for (b = 0; b < 7; b++) - { - v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; - *(p++) = v; - } - break; - - case 1: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? WHITE : BLACK; - } - break; - - case 2: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? GREEN : BLACK; - } - break; - - case 3: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? ORANGE : BLACK; - } - break; - } - } - break; - - default: - fatalerror("Invalid column count\n"); - } - } - } -} - - - -/*************************************************************************** - VIDEO CORE -***************************************************************************/ - -void apple2_state::apple2_video_start(const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo) -{ - int i, j; - UINT16 c; - UINT8 *apple2_font; - - static const UINT8 hires_artifact_color_table[] = - { - BLACK, PURPLE, GREEN, WHITE, - BLACK, BLUE, ORANGE, WHITE - }; - - static const UINT8 dhires_artifact_color_table[] = - { - BLACK, DKGREEN, BROWN, GREEN, - DKRED, DKGRAY, ORANGE, YELLOW, - DKBLUE, BLUE, GRAY, AQUA, - PURPLE, LTBLUE, PINK, WHITE - }; - - m_fgcolor = 15; - m_bgcolor = 0; - m_flash = 0; - apple2_font = memregion("gfx1")->base(); - m_alt_charset_value = memregion("gfx1")->bytes() / 16; - m_a2_videoram = vram; - m_a2_videoaux = aux_vram; - - m_textgfx_data = memregion("gfx1")->base(); - m_textgfx_datalen = memregion("gfx1")->bytes(); - - /* 2^3 dependent pixels * 2 color sets * 2 offsets */ - m_hires_artifact_map = auto_alloc_array(machine(), UINT16, 8 * 2 * 2); - - /* 2^4 dependent pixels */ - m_dhires_artifact_map = auto_alloc_array(machine(), UINT16, 16); - - /* build hires artifact map */ - for (i = 0; i < 8; i++) - { - for (j = 0; j < 2; j++) - { - if (i & 0x02) - { - if ((i & 0x05) != 0) - c = 3; - else - c = j ? 2 : 1; - } - else - { - if ((i & 0x05) == 0x05) - c = j ? 1 : 2; - else - c = 0; - } - m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % hires_modulo]; - m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % hires_modulo]; - } - } - - /* Fix for Ivel Ultra */ - if (!strcmp(machine().system().name, "ivelultr")) { - int len = memregion("gfx1")->bytes(); - for (i = 0; i < len; i++) - { - apple2_font[i] = BITSWAP8(apple2_font[i], 7, 7, 6, 5, 4, 3, 2, 1); - } - } - - /* do we need to flip the gfx? */ - if (!strcmp(machine().system().name, "apple2") - || !strcmp(machine().system().name, "apple2p") - || !strcmp(machine().system().name, "prav82") - || !strcmp(machine().system().name, "prav8m") - || !strcmp(machine().system().name, "ivelultr") - || !strcmp(machine().system().name, "apple2jp")) - { - int len = memregion("gfx1")->bytes(); - for (i = 0; i < len; i++) - { - apple2_font[i] = BITSWAP8(apple2_font[i], 7, 0, 1, 2, 3, 4, 5, 6); - } - } - - - /* build double hires artifact map */ - for (i = 0; i < 16; i++) - { - m_dhires_artifact_map[i] = dhires_artifact_color_table[i]; - } - - memset(&m_old_a2, 0, sizeof(m_old_a2)); - m_a2_videomask = ~ignored_softswitches; -} - - - -VIDEO_START_MEMBER(apple2_state,apple2) -{ - apple2_video_start(m_ram->pointer(), m_ram->pointer()+0x10000, VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 4); - - /* hack to fix the colors on apple2/apple2p */ - m_fgcolor = 0; - m_bgcolor = 15; - - m_monochrome_dhr = false; -} - - -VIDEO_START_MEMBER(apple2_state,apple2p) -{ - apple2_video_start(m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 8); - - /* hack to fix the colors on apple2/apple2p */ - m_fgcolor = 0; - m_bgcolor = 15; - - m_monochrome_dhr = false; -} - - -VIDEO_START_MEMBER(apple2_state,apple2e) -{ - device_a2eauxslot_card_interface *auxslotdevice = m_a2eauxslot->get_a2eauxslot_card(); - if (auxslotdevice) - { - apple2_video_start(m_ram->pointer(), auxslotdevice->get_vram_ptr(), auxslotdevice->allow_dhr() ? 0 : VAR_DHIRES, 8); - } - else - { - apple2_video_start(m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_DHIRES, 8); - } -} - - -VIDEO_START_MEMBER(apple2_state,apple2c) -{ - apple2_video_start(m_ram->pointer(), m_ram->pointer()+0x10000, 0, 8); -} - -UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int page; - UINT32 new_a2; - - /* calculate the m_flash value */ - m_flash = ((machine().time() * 4).seconds() & 1) ? 1 : 0; - - /* read out relevant softswitch variables; to see what has changed */ - new_a2 = effective_a2(); - if (new_a2 & VAR_80STORE) - new_a2 &= ~VAR_PAGE2; - new_a2 &= VAR_TEXT | VAR_MIXED | VAR_HIRES | VAR_DHIRES | VAR_80COL | VAR_PAGE2 | VAR_ALTCHARSET; - - if (ALWAYS_REFRESH || (new_a2 != m_old_a2)) - { - m_old_a2 = new_a2; - } - - /* choose which page to use */ - page = (new_a2 & VAR_PAGE2) ? 1 : 0; - - /* choose the video mode to draw */ - if (effective_a2() & VAR_TEXT) - { - /* text screen - TK2000 uses HGR for text */ - if (m_machinetype == TK2000) - { - apple2_hires_draw(bitmap, cliprect, page, 0, 191); - } - else - { - apple2_text_draw(bitmap, cliprect, page, 0, 191); - } - } - else if ((effective_a2() & VAR_HIRES) && (effective_a2() & VAR_MIXED)) - { - /* hi-res on top; text at bottom */ - apple2_hires_draw(bitmap, cliprect, page, 0, 159); - apple2_text_draw(bitmap, cliprect, page, 160, 191); - } - else if (effective_a2() & VAR_HIRES) - { - /* hi-res screen */ - apple2_hires_draw(bitmap, cliprect, page, 0, 191); - } - else if (effective_a2() & VAR_MIXED) - { - /* lo-res on top; text at bottom */ - apple2_lores_draw(bitmap, cliprect, page, 0, 159); - apple2_text_draw(bitmap, cliprect, page, 160, 191); - } - else - { - /* lo-res screen */ - apple2_lores_draw(bitmap, cliprect, page, 0, 191); - } - return 0; -} - -/* - New implementation -*/ - -const device_type APPLE2_VIDEO = &device_creator; - -//------------------------------------------------- -// a2_video_device - constructor -//------------------------------------------------- - -a2_video_device::a2_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, APPLE2_VIDEO, "Apple II video", tag, owner, clock, "a2video", __FILE__) -{ -} - -void a2_video_device::device_start() -{ - static const UINT8 hires_artifact_color_table[] = - { - BLACK, PURPLE, GREEN, WHITE, - BLACK, BLUE, ORANGE, WHITE - }; - static const UINT8 dhires_artifact_color_table[] = - { - BLACK, DKGREEN, BROWN, GREEN, - DKRED, DKGRAY, ORANGE, YELLOW, - DKBLUE, BLUE, GRAY, AQUA, - PURPLE, LTBLUE, PINK, WHITE - }; - - // generate hi-res artifact data - int i, j; - UINT16 c; - - /* 2^3 dependent pixels * 2 color sets * 2 offsets */ - m_hires_artifact_map = auto_alloc_array(machine(), UINT16, 8 * 2 * 2); - - /* build hires artifact map */ - for (i = 0; i < 8; i++) - { - for (j = 0; j < 2; j++) - { - if (i & 0x02) - { - if ((i & 0x05) != 0) - c = 3; - else - c = j ? 2 : 1; - } - else - { - if ((i & 0x05) == 0x05) - c = j ? 1 : 2; - else - c = 0; - } - m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % 8]; - m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % 8]; - } - } - - /* 2^4 dependent pixels */ - m_dhires_artifact_map = auto_alloc_array(machine(), UINT16, 16); - - /* build double hires artifact map */ - for (i = 0; i < 16; i++) - { - m_dhires_artifact_map[i] = dhires_artifact_color_table[i]; - } - - save_item(NAME(m_page2)); - save_item(NAME(m_flash)); - save_item(NAME(m_mix)); - save_item(NAME(m_graphics)); - save_item(NAME(m_hires)); - save_item(NAME(m_dhires)); - save_item(NAME(m_80col)); - save_item(NAME(m_altcharset)); -} - -void a2_video_device::device_reset() -{ - m_page2 = false; - m_graphics = false; - m_hires = false; - m_80col = false; - m_altcharset = false; - m_dhires = false; - m_flash = false; - m_mix = false; - m_sysconfig = 0; -} - -void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, - const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg) -{ - int x, y, i; - const UINT8 *chardata; - UINT16 color; - - if (!m_altcharset) - { - if ((code >= 0x40) && (code <= 0x7f)) - { - code &= 0x3f; - - if (m_flash) - { - i = fg; - fg = bg; - bg = i; - } - } - } - else - { - if ((code >= 0x60) && (code <= 0x7f)) - { - code |= 0x80; // map to lowercase normal - i = fg; // and flip the color - fg = bg; - bg = i; - } - } - - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; - - for (y = 0; y < 8; y++) - { - for (x = 0; x < 7; x++) - { - color = (chardata[y] & (1 << x)) ? bg : fg; - - for (i = 0; i < xscale; i++) - { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; - } - } - } -} - -void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, - const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg) -{ - int x, y, i; - const UINT8 *chardata; - UINT16 color; - - if ((code >= 0x40) && (code <= 0x7f)) - { - if (m_flash) - { - i = fg; - fg = bg; - bg = i; - } - } - - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; - - for (y = 0; y < 8; y++) - { - for (x = 0; x < 7; x++) - { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; - - for (i = 0; i < xscale; i++) - { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; - } - } - } -} - -void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, - const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg) -{ - int x, y, i; - const UINT8 *chardata; - UINT16 color; - - if ((code >= 0x40) && (code <= 0x7f)) - { - if (m_flash) - { - i = fg; - fg = bg; - bg = i; - } - } - - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; - - for (y = 0; y < 8; y++) - { - for (x = 1; x < 8; x++) - { - color = (chardata[y] & (1 << x)) ? fg : bg; - - for (i = 0; i < xscale; i++) - { - bitmap.pix16(ypos + y, xpos + ((x-1) * xscale) + i) = color; - } - } - } -} - -void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - int row, col, y, x; - UINT8 code; - UINT32 start_address = m_page2 ? 0x0800 : 0x0400; - UINT32 address; - int fg = 0; - - switch (m_sysconfig & 0x03) - { - case 0: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - /* perform adjustments */ - beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - - if (!(m_sysconfig & 0x03)) - { - for (row = beginrow; row <= endrow; row += 8) - { - for (col = 0; col < 40; col++) - { - /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - - /* perform the lookup */ - code = m_ram_ptr[address]; - - /* and now draw */ - for (y = 0; y < 4; y++) - { - for (x = 0; x < 14; x++) - bitmap.pix16(row + y, col * 14 + x) = (code >> 0) & 0x0F; - } - for (y = 4; y < 8; y++) - { - for (x = 0; x < 14; x++) - bitmap.pix16(row + y, col * 14 + x) = (code >> 4) & 0x0F; - } - } - } - } - else - { - for (row = beginrow; row <= endrow; row += 8) - { - for (col = 0; col < 40; col++) - { - UINT8 bits; - - /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - - /* perform the lookup */ - code = m_ram_ptr[address]; - - bits = (code >> 0) & 0x0F; - /* and now draw */ - for (y = 0; y < 4; y++) - { - for (x = 0; x < 14; x++) - { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; - } - } - - bits = (code >> 4) & 0x0F; - for (y = 4; y < 8; y++) - { - for (x = 0; x < 14; x++) - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; - } - } - } - } -} - -void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - int row, col, y; - UINT8 code, auxcode; - UINT32 start_address = m_page2 ? 0x0800 : 0x0400; - UINT32 address; - static const int aux_colors[16] = { 0, 2, 4, 6, 8, 0xa, 0xc, 0xe, 1, 3, 5, 7, 9, 0xb, 0xd, 0xf }; - int fg = 0; - - switch (m_sysconfig & 0x03) - { - case 0: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - /* perform adjustments */ - beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - - if (!(m_sysconfig & 0x03)) - { - for (row = beginrow; row <= endrow; row += 8) - { - for (col = 0; col < 40; col++) - { - /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - - /* perform the lookup */ - code = m_ram_ptr[address]; - auxcode = m_aux_ptr[address]; - - /* and now draw */ - for (y = 0; y < 4; y++) - { - UINT16 *vram = &bitmap.pix16(row + y, (col * 14)); - - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - } - for (y = 4; y < 8; y++) - { - UINT16 *vram = &bitmap.pix16(row + y, (col * 14)); - - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - } - } - } - } - else - { - for (row = beginrow; row <= endrow; row += 8) - { - for (col = 0; col < 40; col++) - { - UINT8 bits, abits; - - /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - - /* perform the lookup */ - code = m_ram_ptr[address]; - auxcode = m_aux_ptr[address]; - - bits = (code >> 0) & 0x0F; - abits = (auxcode >> 0) & 0x0F; - - /* and now draw */ - for (y = 0; y < 4; y++) - { - UINT16 *vram = &bitmap.pix16(row + y, (col * 14)); - - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = abits & (1 << 3) ? fg : 0; - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 3) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - } - - bits = (code >> 4) & 0x0F; - abits = (auxcode >> 4) & 0x0F; - - for (y = 4; y < 8; y++) - { - UINT16 *vram = &bitmap.pix16(row + y, (col * 14)); - - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = abits & (1 << 3) ? fg : 0; - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 3) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - } - } - } - } -} - -void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - int row, col; - UINT32 start_address; - UINT32 address; - UINT8 *aux_page = m_ram_ptr; - int fg = 0; - int bg = 0; - - if (m_80col) - { - start_address = 0x400; - if (m_aux_ptr) - { - aux_page = m_aux_ptr; - } - } - else - { - start_address = m_page2 ? 0x800 : 0x400; - } - - beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - - switch (m_sysconfig & 0x03) - { - case 0: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - for (row = beginrow; row <= endrow; row += 8) - { - if (m_80col) - { - for (col = 0; col < 40; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - - plot_text_character(bitmap, col * 14, row, 1, aux_page[address], - m_char_ptr, m_char_size, fg, bg); - plot_text_character(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); - } - } - else - { - for (col = 0; col < 40; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); - } - } - } -} - -void a2_video_device::text_update_orig(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - int row, col; - UINT32 start_address = m_page2 ? 0x800 : 0x400; - UINT32 address; - int fg = 0; - int bg = 0; - - beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - - switch (m_sysconfig & 0x03) - { - case 0: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - for (row = beginrow; row <= endrow; row += 8) - { - for (col = 0; col < 40; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); - } - } -} - -void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - int row, col; - UINT32 start_address = m_page2 ? 0x800 : 0x400; - UINT32 address; - int fg = 0; - int bg = 0; - - beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - - switch (m_sysconfig & 0x03) - { - case 0: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - for (row = beginrow; row <= endrow; row += 8) - { - for (col = 0; col < 40; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_ultr(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); - } - } -} - -void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - const UINT8 *vram; - int row, col, b; - int offset; - UINT8 vram_row[42]; - UINT16 v; - UINT16 *p; - UINT32 w; - UINT16 *artifact_map_ptr; - int mon_type = m_sysconfig & 0x03; - - /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; - if (endrow < beginrow) - return; - - vram = &m_ram_ptr[(m_page2 ? 0x4000 : 0x2000)]; - - vram_row[0] = 0; - vram_row[41] = 0; - - for (row = beginrow; row <= endrow; row++) - { - for (col = 0; col < 40; col++) - { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); - vram_row[1+col] = vram[offset]; - } - - p = &bitmap.pix16(row); - - for (col = 0; col < 40; col++) - { - w = (((UINT32) vram_row[col+0] & 0x7f) << 0) - | (((UINT32) vram_row[col+1] & 0x7f) << 7) - | (((UINT32) vram_row[col+2] & 0x7f) << 14); - - switch (mon_type) - { - case 0: - // verified on h/w: setting dhires w/o 80col emulates a rev. 0 Apple ][ with no orange/blue - if (m_dhires) - { - artifact_map_ptr = m_hires_artifact_map; - } - else - { - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16]; - } - for (b = 0; b < 7; b++) - { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; - *(p++) = v; - *(p++) = v; - } - break; - - case 1: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? WHITE : BLACK; - *(p++) = v ? WHITE : BLACK; - } - break; - - case 2: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? GREEN : BLACK; - *(p++) = v ? GREEN : BLACK; - } - break; - - case 3: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? ORANGE : BLACK; - *(p++) = v ? ORANGE : BLACK; - } - break; - } - } - } -} - -// similar to regular A2 except page 2 is at $A000 -void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - const UINT8 *vram; - int row, col, b; - int offset; - UINT8 vram_row[42]; - UINT16 v; - UINT16 *p; - UINT32 w; - UINT16 *artifact_map_ptr; - int mon_type = m_sysconfig & 0x03; - - /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; - if (endrow < beginrow) - return; - - vram = &m_ram_ptr[(m_page2 ? 0xa000 : 0x2000)]; - - vram_row[0] = 0; - vram_row[41] = 0; - - for (row = beginrow; row <= endrow; row++) - { - for (col = 0; col < 40; col++) - { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); - vram_row[1+col] = vram[offset]; - } - - p = &bitmap.pix16(row); - - for (col = 0; col < 40; col++) - { - w = (((UINT32) vram_row[col+0] & 0x7f) << 0) - | (((UINT32) vram_row[col+1] & 0x7f) << 7) - | (((UINT32) vram_row[col+2] & 0x7f) << 14); - - switch (mon_type) - { - case 0: - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) - { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; - *(p++) = v; - *(p++) = v; - } - break; - - case 1: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? WHITE : BLACK; - *(p++) = v ? WHITE : BLACK; - } - break; - - case 2: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? GREEN : BLACK; - *(p++) = v ? GREEN : BLACK; - } - break; - - case 3: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? ORANGE : BLACK; - *(p++) = v ? ORANGE : BLACK; - } - break; - } - } - } -} - -void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - const UINT8 *vram, *vaux; - int row, col, b; - int offset; - UINT8 vram_row[82]; - UINT16 v; - UINT16 *p; - UINT32 w; - int page = m_page2 ? 0x4000 : 0x2000; - int mon_type = m_sysconfig & 0x03; - - /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; - if (endrow < beginrow) - return; - - vram = &m_ram_ptr[page]; - if (m_aux_ptr) - { - vaux = m_aux_ptr; - } - else - { - vaux = vram; - } - vaux += page; - - vram_row[0] = 0; - vram_row[81] = 0; - - for (row = beginrow; row <= endrow; row++) - { - for (col = 0; col < 40; col++) - { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); - vram_row[1+(col*2)+0] = vaux[offset]; - vram_row[1+(col*2)+1] = vram[offset]; - } - - p = &bitmap.pix16(row); - - for (col = 0; col < 80; col++) - { - w = (((UINT32) vram_row[col+0] & 0x7f) << 0) - | (((UINT32) vram_row[col+1] & 0x7f) << 7) - | (((UINT32) vram_row[col+2] & 0x7f) << 14); - - switch (mon_type) - { - case 0: - for (b = 0; b < 7; b++) - { - v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; - *(p++) = v; - } - break; - - case 1: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? WHITE : BLACK; - } - break; - - case 2: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? GREEN : BLACK; - } - break; - - case 3: - w >>= 7; - for (b = 0; b < 7; b++) - { - v = (w & 1); - w >>= 1; - *(p++) = v ? ORANGE : BLACK; - } - break; - } - } - } -} - -/* according to Steve Nickolas (author of Dapple), our original palette would - * have been more appropriate for an Apple IIgs. So we've substituted in the - * Robert Munafo palette instead, which is more accurate on 8-bit Apples - */ -static const rgb_t apple2_palette[] = -{ - rgb_t::black, - rgb_t(0xE3, 0x1E, 0x60), /* Dark Red */ - rgb_t(0x60, 0x4E, 0xBD), /* Dark Blue */ - rgb_t(0xFF, 0x44, 0xFD), /* Purple */ - rgb_t(0x00, 0xA3, 0x60), /* Dark Green */ - rgb_t(0x9C, 0x9C, 0x9C), /* Dark Gray */ - rgb_t(0x14, 0xCF, 0xFD), /* Medium Blue */ - rgb_t(0xD0, 0xC3, 0xFF), /* Light Blue */ - rgb_t(0x60, 0x72, 0x03), /* Brown */ - rgb_t(0xFF, 0x6A, 0x3C), /* Orange */ - rgb_t(0x9C, 0x9C, 0x9C), /* Light Grey */ - rgb_t(0xFF, 0xA0, 0xD0), /* Pink */ - rgb_t(0x14, 0xF5, 0x3C), /* Light Green */ - rgb_t(0xD0, 0xDD, 0x8D), /* Yellow */ - rgb_t(0x72, 0xFF, 0xD0), /* Aquamarine */ - rgb_t(0xFF, 0xFF, 0xFF) /* White */ -}; - -/* Initialize the palette */ -PALETTE_INIT_MEMBER(a2_video_device, apple2) -{ - palette.set_pen_colors(0, apple2_palette, ARRAY_LENGTH(apple2_palette)); -} diff --git a/src/mess/video/apple2.h b/src/mess/video/apple2.h deleted file mode 100644 index 6f5f76e4cbf..00000000000 --- a/src/mess/video/apple2.h +++ /dev/null @@ -1,61 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont -/********************************************************************* - - video/apple2.h - Video handling for 8-bit Apple IIs - -*********************************************************************/ - -#ifndef __A2_VIDEO__ -#define __A2_VIDEO__ - -#include "emu.h" - -class a2_video_device : - public device_t -{ -public: - // construction/destruction - a2_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_PALETTE_INIT(apple2); - - bool m_page2; - bool m_flash; - bool m_mix; - bool m_graphics; - bool m_hires; - bool m_dhires; - bool m_80col; - bool m_altcharset; - UINT16 *m_hires_artifact_map; - UINT16 *m_dhires_artifact_map; - - UINT8 *m_ram_ptr, *m_aux_ptr, *m_char_ptr; - int m_char_size; - - int m_sysconfig; - - void text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void text_update_ultr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void text_update_orig(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void lores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void dlores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - -protected: - virtual void device_reset(); - virtual void device_start(); - -private: - void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg); - void plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg); - void plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen, int fg, int bg); -}; - -// device type definition -extern const device_type APPLE2_VIDEO; - -#endif diff --git a/src/mess/video/apple2gs.c b/src/mess/video/apple2gs.c deleted file mode 100644 index fb00047c30a..00000000000 --- a/src/mess/video/apple2gs.c +++ /dev/null @@ -1,168 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,R. Belmont -/********************************************************************* - - video/apple2gs.c - - Apple IIgs video code - -*********************************************************************/ - - -#include "emu.h" -#include "includes/apple2.h" -#include "includes/apple2gs.h" - - - -VIDEO_START_MEMBER(apple2gs_state,apple2gs) -{ - m_bordercolor = 0; - apple2_video_start(m_slowmem, m_slowmem+0x10000, 0, 8); - m_legacy_gfx = auto_bitmap_ind16_alloc(machine(), 560, 192); - - save_item(m_bordercolor, "BORDERCLR"); - save_item(NAME(m_fgcolor)); - save_item(NAME(m_bgcolor)); -} - - - -UINT32 apple2gs_state::screen_update_apple2gs(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - const UINT8 *vram; - UINT32 *scanline; - UINT8 scb, b; - int col, palette; - UINT32 last_pixel = 0, pixel; - int beamy; - UINT16 *a2pixel; - - beamy = cliprect.min_y; - - if (m_newvideo & 0x80) - { - // in top or bottom border? - if ((beamy < BORDER_TOP) || (beamy >= 200+BORDER_TOP)) - { - // don't draw past the bottom border - if (beamy >= 231+BORDER_TOP) - { - return 0; - } - - scanline = &bitmap.pix32(beamy); - for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) - { - scanline[col] = m_a2_palette[m_bordercolor]; - } - } - else // regular screen area - { - int shrline = beamy - BORDER_TOP; - - scb = m_slowmem[0x19D00 + shrline]; - palette = ((scb & 0x0f) << 4); - - vram = &m_slowmem[0x12000 + (shrline * 160)]; - scanline = &bitmap.pix32(beamy); - - // draw left and right borders - for (col = 0; col < BORDER_LEFT; col++) - { - scanline[col] = m_a2_palette[m_bordercolor]; - scanline[col+BORDER_LEFT+640] = m_a2_palette[m_bordercolor]; - } - - if (scb & 0x80) // 640 mode - { - for (col = 0; col < 160; col++) - { - b = vram[col]; - scanline[col * 4 + 0 + BORDER_LEFT] = m_shr_palette[palette + 0 + ((b >> 6) & 0x03)]; - scanline[col * 4 + 1 + BORDER_LEFT] = m_shr_palette[palette + 4 + ((b >> 4) & 0x03)]; - scanline[col * 4 + 2 + BORDER_LEFT] = m_shr_palette[palette + 8 + ((b >> 2) & 0x03)]; - scanline[col * 4 + 3 + BORDER_LEFT] = m_shr_palette[palette + 12 + ((b >> 0) & 0x03)]; - } - } - else // 320 mode - { - for (col = 0; col < 160; col++) - { - b = vram[col]; - pixel = (b >> 4) & 0x0f; - - if ((scb & 0x20) && !pixel) - pixel = last_pixel; - else - last_pixel = pixel; - pixel += palette; - scanline[col * 4 + 0 + BORDER_LEFT] = m_shr_palette[pixel]; - scanline[col * 4 + 1 + BORDER_LEFT] = m_shr_palette[pixel]; - - b = vram[col]; - pixel = (b >> 0) & 0x0f; - - if ((scb & 0x20) && !pixel) - pixel = last_pixel; - else - last_pixel = pixel; - pixel += palette; - scanline[col * 4 + 2 + BORDER_LEFT] = m_shr_palette[pixel]; - scanline[col * 4 + 3 + BORDER_LEFT] = m_shr_palette[pixel]; - } - } - } - } - else - { - /* call legacy Apple II video rendering at scanline 0 to draw into the off-screen buffer */ - if (beamy == 0) - { - // check if DHR should be monochrome 560x192 - if (m_newvideo & 0x20) - { - m_monochrome_dhr = true; - } - else - { - m_monochrome_dhr = false; - } - - rectangle new_cliprect(0, 559, 0, 191); - screen_update_apple2(screen, *m_legacy_gfx, new_cliprect); - } - - if ((beamy < (BORDER_TOP+4)) || (beamy >= (192+4+BORDER_TOP))) - { - if (beamy >= (231+BORDER_TOP)) - { - return 0; - } - - scanline = &bitmap.pix32(beamy); - for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) - { - scanline[col] = m_a2_palette[m_bordercolor]; - } - } - else - { - scanline = &bitmap.pix32(beamy); - - // draw left and right borders - for (col = 0; col < BORDER_LEFT + 40; col++) - { - scanline[col] = m_a2_palette[m_bordercolor]; - scanline[col+BORDER_LEFT+600] = m_a2_palette[m_bordercolor]; - } - - a2pixel = &m_legacy_gfx->pix16(beamy-(BORDER_TOP+4)); - for (int x = 0; x < 560; x++) - { - scanline[40 + BORDER_LEFT + x] = m_a2_palette[*a2pixel++]; - } - } - } - return 0; -} diff --git a/src/mess/video/apple3.c b/src/mess/video/apple3.c deleted file mode 100644 index e733199bd87..00000000000 --- a/src/mess/video/apple3.c +++ /dev/null @@ -1,518 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,R. Belmont -/*************************************************************************** - - video/apple3.c - - Apple /// - -***************************************************************************/ - - -#include "emu.h" -#include "includes/apple3.h" -#include "machine/ram.h" - -#define BLACK 0 -#define DKRED 1 -#define DKBLUE 2 -#define PURPLE 3 -#define DKGREEN 4 -#define DKGRAY 5 -#define BLUE 6 -#define LTBLUE 7 -#define BROWN 8 -#define ORANGE 9 -#define GRAY 10 -#define PINK 11 -#define GREEN 12 -#define YELLOW 13 -#define AQUA 14 -#define WHITE 15 - -// derived from the IIgs palette then adjusted to match Sara -static const unsigned char apple3_palette[] = -{ - // text colors, which don't match the Apple II palette - 0x0, 0x0, 0x0, /* Black $0 */ - 0x5, 0x0, 0x5, /* Magenta $1 */ - 0x0, 0x0, 0x9, /* Dark Blue $2 */ - 0xD, 0x2, 0xD, /* Purple $3 */ - 0x0, 0x7, 0x2, /* Dark Green $4 */ - 0xa, 0xa, 0xa, /* Light Gray $5 */ - 0x2, 0x2, 0xF, /* Medium Blue $6 */ - 0x6, 0xA, 0xF, /* Light Blue $7 */ - 0x8, 0x5, 0x0, /* Brown $8 */ - 0xF, 0x6, 0x0, /* Orange $9 */ - 0x5, 0x5, 0x5, /* Dark Gray $A */ - 0xF, 0x9, 0xF, /* Pink $B */ - 0x1, 0xD, 0x0, /* Light Green $C */ - 0xe, 0xe, 0x0, /* Yellow $D */ - 0x4, 0xe, 0xd, /* Cyan $E */ - 0xF, 0xF, 0xF, /* White $F */ - // graphics colors, which *are* Apple II order - 0x0, 0x0, 0x0, /* Black $0 */ - 0xD, 0x0, 0x3, /* Deep Red $1 */ - 0x0, 0x0, 0x9, /* Dark Blue $2 */ - 0xD, 0x2, 0xD, /* Purple $3 */ - 0x0, 0x7, 0x2, /* Dark Green $4 */ - 0x5, 0x5, 0x5, /* Dark Gray $5 */ - 0x2, 0x2, 0xF, /* Medium Blue $6 */ - 0x6, 0xA, 0xF, /* Light Blue $7 */ - 0x8, 0x5, 0x0, /* Brown $8 */ - 0xF, 0x6, 0x0, /* Orange $9 */ - 0xA, 0xA, 0xA, /* Light Gray $A */ - 0xF, 0x9, 0x8, /* Pink $B */ - 0x1, 0xD, 0x0, /* Light Green $C */ - 0xF, 0xF, 0x0, /* Yellow $D */ - 0x4, 0xF, 0x9, /* Aquamarine $E */ - 0xF, 0xF, 0xF /* White $F */ - -}; - -static const UINT32 text_map[] = -{ - 0x400, 0x480, 0x500, 0x580, 0x600, 0x680, 0x700, 0x780, - 0x428, 0x4a8, 0x528, 0x5a8, 0x628, 0x6a8, 0x728, 0x7a8, - 0x450, 0x4d0, 0x550, 0x5d0, 0x650, 0x6d0, 0x750, 0x7d0 -}; - - -PALETTE_INIT_MEMBER(apple3_state, apple3) -{ - int i; - - for (i = 0; i < 32; i++) - { - m_palette->set_pen_color(i, - apple3_palette[(3*i)]*17, - apple3_palette[(3*i)+1]*17, - apple3_palette[(3*i)+2]*17); - } -} - -void apple3_state::apple3_write_charmem() -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - static const UINT32 screen_hole_map[] = - { - 0x478, 0x4f8, 0x578, 0x5f8, 0x678, 0x6f8, 0x778, 0x7f8 - }; - int i, j, addr; - UINT8 val; - - for (i = 0; i < 8; i++) - { - for (j = 0; j < 4; j++) - { - addr = 0x7f & space.read_byte(screen_hole_map[i] + 0x400 + j + 0); - val = space.read_byte(screen_hole_map[i] + j + 0); - m_char_mem[((addr * 8) + ((i & 3) * 2) + 0) & 0x3ff] = val; - - addr = 0x7f & space.read_byte(screen_hole_map[i] + 0x400 + j + 4); - val = space.read_byte(screen_hole_map[i] + j + 4); - m_char_mem[((addr * 8) + ((i & 3) * 2) + 1) & 0x3ff] = val; - } - } -} - - - -VIDEO_START_MEMBER(apple3_state,apple3) -{ - int i, j; - UINT32 v; - - memset(m_char_mem, 0, 0x800); - - m_hgr_map = auto_alloc_array(machine(), UINT32, 192); - for (i = 0; i < 24; i++) - { - v = text_map[i] - 0x0400; - for (j = 0; j < 8; j++) - { - m_hgr_map[(i * 8) + j] = 0x2000 + v + (j * 0x400); - } - } -} - - - -void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap) -{ - int x, y, col, row, lc; - offs_t offset; - UINT8 ch; - const UINT8 *char_data; - pen_t fg, bg, temp; - UINT16 *dest; - UINT8 *ram = m_ram->pointer(); - UINT32 ram_size = m_ram->size(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = 0; y < 24; y++) - { - for (x = 0; x < 40; x++) - { - offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); - ch = ram[offset]; - - // no color text in emulation mode - if ((m_flags & VAR_VM0) && (m_via_1_a & 0x40)) - { - /* color text */ - offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0000 : 0x0400); - bg = (ram[offset] >> 0) & 0x0F; - fg = (ram[offset] >> 4) & 0x0F; - } - else - { - /* monochrome - on a real /// with an RGB monitor, text is white */ - bg = BLACK; - fg = WHITE; - } - - /* inverse? */ - if (!(ch & 0x80)) - { - temp = fg; - fg = bg; - bg = temp; - } - - char_data = &m_char_mem[(ch & 0x7F) * 8]; - - for (row = 0; row < 8; row++) - { - for (col = 0; col < 7; col++) - { - if (m_smoothscr) - { - // get the offset into the group of 8 lines - lc = (col + smooth) & 7; - } - else - { - lc = col; - } - - dest = &bitmap.pix16(y * 8 + row, x * 14 + lc * 2); - dest[0] = (char_data[row] & (1 << col)) ? fg : bg; - dest[1] = (char_data[row] & (1 << col)) ? fg : bg; - } - } - } - } -} - - - -void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap) -{ - int x, y, col, row, lc; - offs_t offset; - UINT8 ch; - const UINT8 *char_data; - pen_t fg, bg; - UINT16 *dest; - UINT8 *ram = m_ram->pointer(); - UINT32 ram_size = m_ram->size(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = 0; y < 24; y++) - { - for (x = 0; x < 40; x++) - { - offset = ram_size - 0x8000 + text_map[y] + x; - - /* first character */ - ch = ram[offset + 0x0000]; - char_data = &m_char_mem[(ch & 0x7F) * 8]; - fg = (ch & 0x80) ? GREEN : BLACK; - bg = (ch & 0x80) ? BLACK : GREEN; - - for (row = 0; row < 8; row++) - { - for (col = 0; col < 7; col++) - { - if (m_smoothscr) - { - // get the offset into the group of 8 lines - lc = (col + smooth) & 7; - } - else - { - lc = col; - } - - dest = &bitmap.pix16(y * 8 + row, x * 14 + lc + 0); - *dest = (char_data[row] & (1 << col)) ? fg : bg; - } - } - - /* second character */ - ch = ram[offset + 0x0400]; - char_data = &m_char_mem[(ch & 0x7F) * 8]; - fg = (ch & 0x80) ? GREEN : BLACK; - bg = (ch & 0x80) ? BLACK : GREEN; - - for (row = 0; row < 8; row++) - { - for (col = 0; col < 7; col++) - { - dest = &bitmap.pix16(y * 8 + row, x * 14 + col + 7); - *dest = (char_data[row] & (1 << col)) ? fg : bg; - } - } - } - } -} - - - -void apple3_state::apple3_video_graphics_hgr(bitmap_ind16 &bitmap) -{ - /* hi-res mode: 280x192x2 */ - int y, i, x, ly, lyb; - const UINT8 *pix_info; - UINT16 *ptr; - UINT8 b; - UINT8 *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = 0; y < 192; y++) - { - ly = y; - if (m_smoothscr) - { - // get our base Y position - ly = y & ~7; - // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; - // add to the base - ly += lyb; - } - - if (m_flags & VAR_VM2) - pix_info = &ram[m_hgr_map[ly]]; - else - pix_info = &ram[m_hgr_map[ly] - 0x2000]; - ptr = &bitmap.pix16(y); - - for (i = 0; i < 40; i++) - { - b = *(pix_info++); - - for (x = 0; x < 7; x++) - { - ptr[0] = ptr[1] = (b & 0x01) ? WHITE : BLACK; - ptr += 2; - b >>= 1; - } - } - } -} - -void apple3_state::apple3_video_graphics_chgr(bitmap_ind16 &bitmap) -{ - /* color hi-res mode: 280x192x16 */ - int y, i, x, ly, lyb; - const UINT8 *pix_info; - const UINT8 *col_info; - UINT16 *ptr; - UINT8 b; - UINT16 fgcolor, bgcolor; - UINT8 *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = 0; y < 192; y++) - { - ly = y; - if (m_smoothscr) - { - // get our base Y position - ly = y & ~7; - // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; - // add to the base - ly += lyb; - } - - if (m_flags & VAR_VM2) - { - pix_info = &ram[m_hgr_map[ly] + 0x2000]; - col_info = &ram[m_hgr_map[ly] + 0x4000]; - } - else - { - pix_info = &ram[m_hgr_map[ly] - 0x2000]; - col_info = &ram[m_hgr_map[ly]]; - } - ptr = &bitmap.pix16(y); - - for (i = 0; i < 40; i++) - { - bgcolor = ((*col_info >> 0) & 0x0F) + 16; - fgcolor = ((*col_info >> 4) & 0x0F) + 16; - - b = *pix_info; - - for (x = 0; x < 7; x++) - { - ptr[0] = ptr[1] = (b & 1) ? fgcolor : bgcolor; - ptr += 2; - b >>= 1; - } - pix_info++; - col_info++; - } - } -} - - - -void apple3_state::apple3_video_graphics_shgr(bitmap_ind16 &bitmap) -{ - /* super hi-res mode: 560x192x2 */ - int y, i, x, ly, lyb; - const UINT8 *pix_info1; - const UINT8 *pix_info2; - UINT16 *ptr; - UINT8 b1, b2; - UINT8 *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = 0; y < 192; y++) - { - ly = y; - if (m_smoothscr) - { - // get our base Y position - ly = y & ~7; - // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; - // add to the base - ly += lyb; - } - - if (m_flags & VAR_VM2) - { - pix_info1 = &ram[m_hgr_map[ly] + 0x2000]; - pix_info2 = &ram[m_hgr_map[ly] + 0x4000]; - } - else - { - pix_info1 = &ram[m_hgr_map[ly] - 0x2000]; - pix_info2 = &ram[m_hgr_map[ly]]; - } - ptr = &bitmap.pix16(y); - - for (i = 0; i < 40; i++) - { - b1 = *(pix_info1++); - b2 = *(pix_info2++); - - for (x = 0; x < 7; x++) - { - *(ptr++) = (b1 & 0x01) ? WHITE : BLACK; - b1 >>= 1; - } - - for (x = 0; x < 7; x++) - { - *(ptr++) = (b2 & 0x01) ? WHITE : BLACK; - b2 >>= 1; - } - } - } -} - - - -void apple3_state::apple3_video_graphics_chires(bitmap_ind16 &bitmap) -{ - UINT16 *pen; - UINT8 p1, p2, p3, p4; - int y, i, ly, lyb; - UINT8 *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = 0; y < 192; y++) - { - ly = y; - if (m_smoothscr) - { - // get our base Y position - ly = y & ~7; - // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; - // add to the base - ly += lyb; - } - - pen = &bitmap.pix16(y); - for (i = 0; i < 20; i++) - { - if (m_flags & VAR_VM2) - { - p1 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 0]; - p2 = ram[m_hgr_map[ly] + 0x4000 + (i * 2) + 0]; - p3 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 1]; - p4 = ram[m_hgr_map[ly] + 0x4000 + (i * 2) + 1]; - } - else - { - p1 = ram[m_hgr_map[ly] - 0x2000 + (i * 2) + 0]; - p2 = ram[m_hgr_map[ly] - 0x0000 + (i * 2) + 0]; - p3 = ram[m_hgr_map[ly] - 0x2000 + (i * 2) + 1]; - p4 = ram[m_hgr_map[ly] - 0x0000 + (i * 2) + 1]; - } - - pen[ 0] = pen[ 1] = pen[ 2] = pen[ 3] = (p1 & 0x0f); - pen[ 4] = pen[ 5] = pen[ 6] = pen[ 7] = ((p1 >> 4) & 0x07) | ((p2 & 1) << 3); - pen[ 8] = pen[ 9] = pen[10] = pen[11] = ((p2 >> 1) & 0x0F); - pen[12] = pen[13] = pen[14] = pen[15] = ((p2 >> 5) & 0x03) | ((p3 & 3) << 2); - pen[16] = pen[17] = pen[18] = pen[19] = ((p3 >> 2) & 0x0F); - pen[20] = pen[21] = pen[22] = pen[23] = ((p3 >> 6) & 0x01) | ((p4 << 1) & 0xe); - pen[24] = pen[25] = pen[26] = pen[27] = ((p4 >> 3) & 0x0F); - pen += 28; - } - } -} - - - -UINT32 apple3_state::screen_update_apple3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -// printf("gfx mode %x\n", m_flags & (VAR_VM3|VAR_VM1|VAR_VM0)); - - switch(m_flags & (VAR_VM3|VAR_VM1|VAR_VM0)) - { - case 0: - case VAR_VM0: - apple3_video_text40(bitmap); - break; - - case VAR_VM1: - case VAR_VM1|VAR_VM0: - apple3_video_text80(bitmap); - break; - - case VAR_VM3: - apple3_video_graphics_hgr(bitmap); /* hgr mode */ - break; - - case VAR_VM3|VAR_VM0: - apple3_video_graphics_chgr(bitmap); - break; - - case VAR_VM3|VAR_VM1: - apple3_video_graphics_shgr(bitmap); - break; - - case VAR_VM3|VAR_VM1|VAR_VM0: - apple3_video_graphics_chires(bitmap); - break; - } - return 0; -} diff --git a/src/mess/video/aquarius.c b/src/mess/video/aquarius.c deleted file mode 100644 index 3d644bfd8b2..00000000000 --- a/src/mess/video/aquarius.c +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/*************************************************************************** - - aquarius.c - - Functions to emulate the video hardware of the aquarius. - -***************************************************************************/ - -#include "emu.h" -#include "includes/aquarius.h" - - -static const unsigned short aquarius_palette[] = -{ - 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0,10, 0,11, 0,12, 0,13, 0,14, 0,15, 0, - 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1,10, 1,11, 1,12, 1,13, 1,14, 1,15, 1, - 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2,10, 2,11, 2,12, 2,13, 2,14, 2,15, 2, - 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3,10, 3,11, 3,12, 3,13, 3,14, 3,15, 3, - 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4,10, 4,11, 4,12, 4,13, 4,14, 4,15, 4, - 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5,10, 5,11, 5,12, 5,13, 5,14, 5,15, 5, - 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, 6, 8, 6, 9, 6,10, 6,11, 6,12, 6,13, 6,14, 6,15, 6, - 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, 7, 8, 7, 9, 7,10, 7,11, 7,12, 7,13, 7,14, 7,15, 7, - 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, 8, 8, 8, 9, 8,10, 8,11, 8,12, 8,13, 8,14, 8,15, 8, - 0, 9, 1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9, 9, 9,10, 9,11, 9,12, 9,13, 9,14, 9,15, 9, - 0,10, 1,10, 2,10, 3,10, 4,10, 5,10, 6,10, 7,10, 8,10, 9,10,10,10,11,10,12,10,13,10,14,10,15,10, - 0,11, 1,11, 2,11, 3,11, 4,11, 5,11, 6,11, 7,11, 8,11, 9,11,10,11,11,11,12,11,13,11,14,11,15,11, - 0,12, 1,12, 2,12, 3,12, 4,12, 5,12, 6,12, 7,12, 8,12, 9,12,10,12,11,12,12,12,13,12,14,12,15,12, - 0,13, 1,13, 2,13, 3,13, 4,13, 5,13, 6,13, 7,13, 8,13, 9,13,10,13,11,13,12,13,13,13,14,13,15,13, - 0,14, 1,14, 2,14, 3,14, 4,14, 5,14, 6,14, 7,14, 8,14, 9,14,10,14,11,14,12,14,13,14,14,14,15,14, - 0,15, 1,15, 2,15, 3,15, 4,15, 5,15, 6,15, 7,15, 8,15, 9,15,10,15,11,15,12,15,13,15,14,15,15,15, -}; - -PALETTE_INIT_MEMBER(aquarius_state, aquarius) -{ - int i; - - for (i = 0; i < 16; i++) - m_palette->set_indirect_color(i, m_tea1002->color(i)); - - for (i = 0; i < 512; i++) - m_palette->set_pen_indirect(i, aquarius_palette[i]); -} - -WRITE8_MEMBER(aquarius_state::aquarius_videoram_w) -{ - UINT8 *videoram = m_videoram; - videoram[offset] = data; - m_tilemap->mark_tile_dirty(offset); -} - -WRITE8_MEMBER(aquarius_state::aquarius_colorram_w) -{ - m_colorram[offset] = data; - m_tilemap->mark_tile_dirty(offset); -} - -TILE_GET_INFO_MEMBER(aquarius_state::aquarius_gettileinfo) -{ - UINT8 *videoram = m_videoram; - int bank = 0; - int code = videoram[tile_index]; - int color = m_colorram[tile_index]; - int flags = 0; - - SET_TILE_INFO_MEMBER(bank, code, color, flags); -} - -void aquarius_state::video_start() -{ - m_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(aquarius_state::aquarius_gettileinfo),this), TILEMAP_SCAN_ROWS, 8, 8, 40, 25); -} - -UINT32 aquarius_state::screen_update_aquarius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - return 0; -} diff --git a/src/mess/video/arcadia.c b/src/mess/video/arcadia.c deleted file mode 100644 index 869439aef10..00000000000 --- a/src/mess/video/arcadia.c +++ /dev/null @@ -1,676 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** -Consolidation and enhancment of documentation by Manfred Schneider based on previous work from - PeT mess@utanet.at and Paul Robson (autismuk@aol.com) - - Schematics, manuals and anything you can desire for at http://amigan.1emu.net/ - - TODO: find a dump of the charactyer ROM - convert the drawing code to tilemap - - emulation of signetics 2637 video/audio device - -General -The UVI is capable of controlling 512 Bytes of RAM. It also generates a select signal -for a 128 byte wide area. -This whole addres space maps in the arcadia and compatible machines from $1800 - $1AFF. - -1. Video Memory - -The screen table is at 1800-CF and 1A00-CF. Each page has 13 lines of the -screen (16 bytes per line,26 lines in total, 208 scan lines). The 2 most -significant bits of each byte are colour data, the 6 least significant -are character data. The resolution of the Arcadia is 128 x 208 pixels. - -It is possible to halve the screen resolution so 1A00..1ACF can -be used for code. This is controlled by bit 6 of $19F8. - -The byte at location $18FF is the current Character Line address, lower -4 bits only. The start line goes from 1800 to 18C0 then from 1900 to 19C0. -The 4 least significant bits of this count 0123456789ABC0123456789ABC, -going to D when in vertical blank. The 4 most significant bits are always -'1'. Some games do use this for scrolling effects - a good example of this -is the routine at $010F in Alien Invaders which scrolls the various bits of -the screen about using the memory locations $18FF and $18FE. - -The screen can be scrolled upto 7 pixels to the left using the high 3 bits -of $18FE. This is used in Alien Invaders. - -A line beginning with $C0 contains block graphics. Each square contains -3 wide x 2 high pixels, coloured as normal. The 3 least significant bits -are the top, the next 3 bits are the bottom. Alien Invaders uses this for -shields. The graphics are returned to normal for the next line. - -The VBlank signal (maybe VSYNC) is connected to the SENSE input. This is -logic '1' when the system is in VBLANK. - -The Flag line does.... something graphical - it might make the sprites -half width/double height perhaps. Breakaway sets this when the bats are -double size in vertical mode. - - -2. Character codes - -Character codes 00..37 to be in a ROM somewhere in the Emerson. These -are known, others may be discovered by comparing the screen snapshots -against the character tables. If the emulator displays an exclamation -mark you've found one. Get a snapshot to see what it looks like -normally and let me know. Codes 38..3F are taken from RAM. - -00 (space) -01..0F Graphic Characters -10..19 0..9 -1A..33 A..Z -34 Decimal Point -35 comma -36 + -37 $ -38..3F User Defined Characters (8 off, from 1980..19FF) - -Character data is stored 8 bits per character , as a single plane graphic -The 2nd and 3rd bits of palette data come from the screen tables, so there -are two colours per character and 4 possible palette selections for the -background. - - -3. Sound - -fixed frequency sound and random Noise generator. -18FD pitch (lower 7 bits) -18FE volume ( bits 0 - 2) -18fe bit 3 set means sound on -18fe bit 4 set means random noise on - -Calculation of sound frequency is done as follows - 1/Freq = 2 (pitch +1) * (horizontal line period) - - -4. Sprites - -Sprite pointers are at 18F0..18F7 (there are four of them). The graphics -used are the ones in the 1980..19BF UDG table (the first four). - -Sprite addresses (x,y) are converted to offsets in the 128 x 208 as follows: - -1) 1's complement the y coordinate -2) subtract 16 from the y coordinate -3) subtract 43 from the x coordinate - -5. Palette - -The Palette is encoded between 19F8-19FB. This section describes the method -by which colours are allocated. There are 8 colours, information is coded -3 bits per colour (usually 2 colours per byte) - - Colour Code Name - ------ ----- ------- - 7 111 Black - 6 110 Blue - 5 101 Red - 4 100 Magenta - 3 011 Green - 2 010 Cyan - 1 001 Yellow - 0 000 White - -Bits 0..2 of $19F9 are the screen colour -Bits 3..5 of $19F9 are the colours of characters -Bit 6 of $19f9 is for poti axis -Bit 7 of $19f9 is for character size (1 = 8x8; 0 = 8x16) -Bits 0..5 of $19FA are the colours of Sprites 2 & 3 (sprite 3 is low bits) -Bit 6 of $19FA is for size of sprite 3 (0 = 8x16; 1 = 8x8) -Bit 7 of $19FA is for size of sprite 2 (0 = 8x16; 1 = 8x8) -Bits 0..5 of $19FB are the colours of Sprites 0 & 1 (sprite 1 is low bits) -Bit 6 of $19FB is for size of sprite 1 (0 = 8x16; 1 = 8x8) -Bit 7 of $19FB is for size of sprite 0 (0 = 8x16; 1 = 8x8) - - -6. Collision Detection - -Bits are set to zero on a collision - I think they are reset at the -frame start. There are two locations : one is for sprite/background -collisions, one is for sprite/sprite collisions. - -19FC bits 0..3 are collision between sprites 0..3 and the background. - -19FD bit 0 is sprite 0 / 1 collision - bit 1 is sprite 0 / 2 collision - bit 2 is sprite 0 / 3 collision - bit 3 is sprite 1 / 2 collision - bit 4 is sprite 1 / 3 collision (guess) - bit 5 is sprite 2 / 3 collision (guess) - - -7. Graphic Mode -19f8 bit 7 graphics mode on (lower 6 bits descripe rectangles) -0xc0 in line switches to graphics mode in this line -0x40 in line switches to char mode in this line - 22211100 - 22211100 - 22211100 - 22211100 - 55544433 - 55544433 - 55544433 - 55544433 - - 8. Memory Map - The offsets in the following memory Map are from the view of the UVI. - In the arcadia and compatibles the base offset is $1800 thats how the CPU sees the UVI - - 0000 - 00FF external RAM - 0000 - 00CF upper screen character/graphics codes organised as 16 char x 13 rows - 00D0 - 00EF RAM (not used by UVI, can be used by CPU) - 00F0 vertical offset object 0 - 00F1 horizontal offset object 0 - 00F2 vertical offset object 1 - 00F3 horizontal offset object 1 - 00F4 vertical offset object 2 - 00F5 horizontal offset object 2 - 00F6 vertical offset object 3 - 00F7 horizontal offset object 3 - 00F8 - 00FB RAM (not used by UVI, can be used by CPU) - 00FC complement number of rows from the trailing edge of VRST - to the start of character display - 00FD bit0 - 6 sound frequeny, bit 7 color mode - 00FE bit0 - 2 loudness, bit 3 sound enable when set, bit 4 random noise enable when set - bit 5 - 7 delay for row of characters - 00FF bit 0 - 3 DMA number, bit 4 - 7 unused -0100 - 017F CE area. In arcadia used for keypad. -0180 - 01FF internal UVI registers - 0180 - 0187 image of object 0 or UDC-code $38 - 0188 - 018F image of object 1 or UDC-code $39 - 0190 - 0197 image of object 2 or UDC-code $3A - 0198 - 019F image of object 3 or UDC-code $3B - 01A0 - 01A7 image of UDC-code $3C - 01A8 - 01AF image of UDC-code $3D - 01B0 - 01B7 image of UDC-code $3E - 01B8 - 01BF image of UDC-code $3F - 01C0 - 01F7 unused - 01F8 bit 0 - 2 alternate screen color, bit 3 - 5 alternate character color - bit 6 Refresh mode when set entire character field will be display twice - bit 7 Grahics mode - 01F9 bit 0 - 2 screen color, bit 3 - 5 character color - bit 6 poti mux control - bit 7 character size when set size=8x8 else size=8x16 - 01FA bit 0 - 2 color of object 3, bit 3 - 5 color of object 2 - bit 6 size of object 3 when set size=8x8 else size=8x16 - bit 7 size of object 2 when set size=8x8 else size=8x16 - 01FB bit 0 - 2 color of object 1, bit 3 - 5 color of object 0 - bit 6 size of object 1 when set size=8x8 else size=8x16 - bit 7 size of object 0 when set size=8x8 else size=8x16 - 01FC object - character collision bits - bit 0 when low object 0 collided with character - bit 1 when low object 1 collided with character - bit 2 when low object 2 collided with character - bit 3 when low object 3 collided with character - bit 4 - 7 unused set to high - 01FD inter object collision - bit 0 - when low object 1 and 2 collide - bit 1 - when low object 1 and 3 collide - bit 2 - when low object 1 and 4 collide - bit 3 - when low object 2 and 3 collide - bit 4 - when low object 2 and 4 collide - bit 5 - when low object 3 and 4 collide - bit 6 - 7 unused set to high - 01FE digital value of POT1 or POT3 input. Valid only during VRST - 01FF digital value of POT2 or POT4 input. Valid only furing VRST -0200 - 02FF 2nd external RAM - 0200 - 02CF lower screen character/graphics codes organised as 16 char x 13 rows - 02D0 - 02FF RAM (not used by UVI, can be used by CPU) -*/ - - -#include "includes/arcadia.h" - -static const UINT8 chars[0x40][8]={ - // read from the screen generated from a palladium - { 0,0,0,0,0,0,0,0 }, // 00 (space) - { 1,2,4,8,16,32,64,128 }, // 01 (\) - { 128,64,32,16,8,4,2,1 }, // 02 (/) - { 255,255,255,255,255,255,255,255 }, // 03 (solid block) - { 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00 },// 04 (?) - { 3,3,3,3,3,3,3,3 }, // 05 (half square right on) - { 0,0,0,0,0,0,255,255 }, // 06 (horz lower line) - { 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },// 07 (half square left on) - { 0xff,0xff,3,3,3,3,3,3 }, // 08 (?) - { 0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },// 09 (?) - { 192,192,192,192,192,192,255,255 }, // 0A (!_) - { 3,3,3,3,3,3,255,255 }, // 0B (_!) - { 1,3,7,15,31,63,127,255 }, // 0C (diagonal block) - { 128,192,224,240,248,252,254,255 }, // 0D (diagonal block) - { 255,254,252,248,240,224,192,128 }, // 0E (diagonal block) - { 255,127,63,31,15,7,3,1 }, // 0F (diagonal block) - { 0x00,0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c },// 10 0 - { 0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x1c },// 11 1 - { 0x00,0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e },// 12 2 - { 0x00,0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c },// 13 3 - { 0x00,0x04,0x0c,0x14,0x24,0x3e,0x04,0x04 },// 14 4 - { 0x00,0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c },// 15 5 - { 0x00,0x0c,0x10,0x20,0x3c,0x22,0x22,0x1c },// 16 6 - { 0x00,0x7c,0x02,0x04,0x08,0x10,0x10,0x10 },// 17 7 - { 0x00,0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c },// 18 8 - { 0x00,0x1c,0x22,0x22,0x3e,0x02,0x04,0x18 },// 19 9 - { 0x00,0x08,0x14,0x22,0x22,0x3e,0x22,0x22 },// 1A A - { 0x00,0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c },// 1B B - { 0x00,0x1c,0x22,0x20,0x20,0x20,0x22,0x1c },// 1C C - { 0x00,0x3c,0x22,0x22,0x22,0x22,0x22,0x3c },// 1D D - { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e },// 1E E - { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x20 },// 1F F - { 0x00,0x1e,0x20,0x20,0x20,0x26,0x22,0x1e },// 20 G - { 0x00,0x22,0x22,0x22,0x3e,0x22,0x22,0x22 },// 21 H - { 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x1c },// 22 I - { 0x00,0x02,0x02,0x02,0x02,0x02,0x22,0x1c },// 23 J - { 0x00,0x22,0x24,0x28,0x30,0x28,0x24,0x22 },// 24 K - { 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x3e },// 25 L - { 0x00,0x22,0x36,0x2a,0x2a,0x22,0x22,0x22 },// 26 M - { 0x00,0x22,0x22,0x32,0x2a,0x26,0x22,0x22 },// 27 N - { 0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c },// 28 O - { 0x00,0x3c,0x22,0x22,0x3c,0x20,0x20,0x20 },// 29 P - { 0x00,0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a },// 2A Q - { 0x00,0x3c,0x22,0x22,0x3c,0x28,0x24,0x22 },// 2B R - { 0x00,0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c },// 2C S - { 0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08 },// 2D T - { 0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1c },// 2E U - { 0x00,0x22,0x22,0x22,0x22,0x22,0x14,0x08 },// 2F V - { 0x00,0x22,0x22,0x22,0x2a,0x2a,0x36,0x22 },// 30 W - { 0x00,0x22,0x22,0x14,0x08,0x14,0x22,0x22 },// 31 X - { 0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08 },// 32 Y - { 0x00,0x3e,0x02,0x04,0x08,0x10,0x20,0x3e },// 33 Z - { 0,0,0,0,0,0,0,8 }, // 34 . - { 0,0,0,0,0,8,8,0x10 }, // 35 , - { 0,0,8,8,0x3e,8,8,0 }, // 36 + - { 0,8,0x1e,0x28,0x1c,0xa,0x3c,8 }, // 37 $ - // 8x user defined -}; - -void arcadia_state::video_start() -{ - int i; - memcpy(&m_chars, chars, sizeof(chars)); - for (i=0; i<0x40; i++) - { - m_rectangle[i][0]=0; - m_rectangle[i][4]=0; - if (i&1) m_rectangle[i][0]|=3; - if (i&2) m_rectangle[i][0]|=0x1c; - if (i&4) m_rectangle[i][0]|=0xe0; - if (i&8) m_rectangle[i][4]|=3; - if (i&0x10) m_rectangle[i][4]|=0x1c; - if (i&0x20) m_rectangle[i][4]|=0xe0; - m_rectangle[i][1]=m_rectangle[i][2]=m_rectangle[i][3]=m_rectangle[i][0]; - m_rectangle[i][5]=m_rectangle[i][6]=m_rectangle[i][7]=m_rectangle[i][4]; - } - - { - int width = m_screen->width(); - int height = m_screen->height(); - m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); - } -} - -READ8_MEMBER( arcadia_state::video_r ) -{ - UINT8 data=0; - switch (offset) - { - case 0xff: data = m_charline|0xf0;break; - case 0x100: data = m_controller1_col1->read();break; - case 0x101: data = m_controller1_col2->read();break; - case 0x102: data = m_controller1_col3->read();break; - case 0x103: data = m_controller1_extra->read();break; - case 0x104: data = m_controller2_col1->read();break; - case 0x105: data = m_controller2_col2->read();break; - case 0x106: data = m_controller2_col3->read();break; - case 0x107: data = m_controller2_extra->read();break; - case 0x108: data = m_panel->read();break; -#if 0 - case 0x1fe: - if (m_ad_select) - data=ioport("controller1_joy_y")->read()<<3; - else - data=ioport("controller1_joy_x")->read()<<3; - break; - case 0x1ff: - if (m_ad_select) - data=ioport("controller2_joy_y")->read()<<3; - else - data=ioport("controller2_joy_x")->read()<<3; - break; -#else - case 0x1fe: - data = 0x80; - if (m_ad_select) - { - if (m_joysticks->read()&0x10) data=0; - if (m_joysticks->read()&0x20) data=0xff; - } - else - { - if (m_joysticks->read()&0x40) data=0xff; - if (m_joysticks->read()&0x80) data=0; - } - break; - case 0x1ff: - data = 0x6f; // 0x7f too big for alien invaders (move right) - if (m_ad_select) - { - if (m_joysticks->read()&0x1) data=0; - if (m_joysticks->read()&0x2) data=0xff; - } - else - { - if (m_joysticks->read()&0x4) data=0xff; - if (m_joysticks->read()&0x8) data=0; - } - break; -#endif - default: - data = m_reg.data[offset]; - } - return data; -} - -WRITE8_MEMBER( arcadia_state::video_w ) -{ - m_reg.data[offset]=data; - switch (offset) - { - case 0xfc: - m_ypos=255-data+YPOS; - break; - case 0xfd: - m_custom->write(space, offset&3, data); - m_multicolor = data & 0x80; - break; - case 0xfe: - m_custom->write(space, offset&3, data); - m_shift = (data>>5); - break; - case 0xf0: - case 0xf2: - case 0xf4: - case 0xf6: - m_pos[(offset>>1)&3].y = (data^0xff)+1; - break; - case 0xf1: - case 0xf3: - case 0xf5: - case 0xf7: - m_pos[(offset>>1)&3].x = data-43; - break; - case 0x180: case 0x181: case 0x182: case 0x183: case 0x184: case 0x185: case 0x186: case 0x187: - case 0x188: case 0x189: case 0x18a: case 0x18b: case 0x18c: case 0x18d: case 0x18e: case 0x18f: - case 0x190: case 0x191: case 0x192: case 0x193: case 0x194: case 0x195: case 0x196: case 0x197: - case 0x198: case 0x199: case 0x19a: case 0x19b: case 0x19c: case 0x19d: case 0x19e: case 0x19f: - case 0x1a0: case 0x1a1: case 0x1a2: case 0x1a3: case 0x1a4: case 0x1a5: case 0x1a6: case 0x1a7: - case 0x1a8: case 0x1a9: case 0x1aa: case 0x1ab: case 0x1ac: case 0x1ad: case 0x1ae: case 0x1af: - case 0x1b0: case 0x1b1: case 0x1b2: case 0x1b3: case 0x1b4: case 0x1b5: case 0x1b6: case 0x1b7: - case 0x1b8: case 0x1b9: case 0x1ba: case 0x1bb: case 0x1bc: case 0x1bd: case 0x1be: case 0x1bf: - m_chars[0x38|((offset>>3)&7)][offset&7] = data; - break; - case 0x1f8: - m_lines26 = data & 0x40; - m_graphics = data & 0x80; - break; - case 0x1f9: - m_doublescan =! (data&0x80); - m_ad_delay = 10; - break; - } -} - -void arcadia_state::draw_char(UINT8 *ch, int charcode, int y, int x) -{ - int k,b,cc,sc, colour; - if (m_multicolor) - { - if (charcode&0x40) - cc=((m_reg.d.pal[1]>>3)&7); - else - cc=((m_reg.d.pal[0]>>3)&7); - - if (charcode&0x80) - sc=(m_reg.d.pal[1]&7); - else - sc=(m_reg.d.pal[0]&7); - } - else - { - cc=((m_reg.d.pal[1]>>3)&1)|((charcode>>5)&6); - sc=(m_reg.d.pal[1]&7); - } - colour = (((sc << 3) | cc) + 4); - - if (m_doublescan) - { - for (k=0; (k<8)&&(yheight()); k++, y+=2) - { - b=ch[k]; - m_bg[y][x>>3]|=b>>(x&7); - m_bg[y][(x>>3)+1]|=b<<(8-(x&7)); - - if (y+1height()) - { - m_bg[y+1][x>>3]|=b>>(x&7); - m_bg[y+1][(x>>3)+1]|=b<<(8-(x&7)); - m_gfxdecode->gfx(0)->opaque(*m_bitmap,m_bitmap->cliprect(), b,colour, 0,0,x,y); - m_gfxdecode->gfx(0)->opaque(*m_bitmap,m_bitmap->cliprect(), b,colour, 0,0,x,y+1); - } - } - } - else - { - for (k=0; (k<8)&&(yheight()); k++, y++) - { - b=ch[k]; - m_bg[y][x>>3]|=b>>(x&7); - m_bg[y][(x>>3)+1]|=b<<(8-(x&7)); - - m_gfxdecode->gfx(0)->opaque(*m_bitmap,m_bitmap->cliprect(), b,colour, 0,0,x,y); - } - } -} - - -void arcadia_state::vh_draw_line(int y, UINT8 chars1[16]) -{ - int x, ch, j, h; - int graphics = m_graphics; - h = m_doublescan ? 16 : 8 ; - - if (m_bitmap->height() - m_line < h) - h = m_bitmap->height() - m_line; - - m_bitmap->plot_box(0, y, m_bitmap->width(), h, (m_reg.d.pal[1]&7)); - memset(m_bg[y], 0, sizeof(m_bg[0])*h); - - for (x=XPOS+m_shift, j=0; j<16;j++,x+=8) - { - ch=chars1[j]; -// hangman switches with 0x40 -// alien invaders shield lines start with 0xc0 - if ((ch&0x3f)==0) - { - switch (ch) - { - case 0xc0: graphics=TRUE;break; - case 0x40: graphics=FALSE;break; -// case 0x80: -// alien invaders shields are empty 0x80 -// popmessage(5, "graphics code 0x80 used"); - } - } - if (graphics) - draw_char(m_rectangle[ch&0x3f], ch, y, x); - else - draw_char(m_chars[ch&0x3f], ch, y, x); - } -} - - -int arcadia_state::sprite_collision(int n1, int n2) -{ - int k, b1, b2, x; - if (m_pos[n1].x+8<=m_pos[n2].x) - return FALSE; - if (m_pos[n1].x>=m_pos[n2].x+8) - return FALSE; - - for (k=0; k<8; k++) - { - if (m_pos[n1].y+k=m_pos[n2].y+8) - break; - x=m_pos[n1].x-m_pos[n2].x; - b1=m_reg.d.chars[n1][k]; - b2=m_reg.d.chars[n2][m_pos[n1].y+k-m_pos[n2].y]; - if (x<0) - b2>>=-x; - if (x>0) - b1>>=x; - if (b1&b2) - return TRUE; - } - return FALSE; -} - - -void arcadia_state::draw_sprites() -{ - int i, k, x, y, color=0; - UINT8 b; - - m_reg.d.collision_bg|=0xf; - m_reg.d.collision_sprite|=0x3f; - for (i=0; i<4; i++) - { - int doublescan = FALSE; - if (m_pos[i].y<=-YPOS) continue; - if (m_pos[i].y>=m_bitmap->height()-YPOS-8) continue; - if (m_pos[i].x<=-XPOS) continue; - if (m_pos[i].x>=128+XPOS-8) continue; - - switch (i) - { - case 0: - color=(m_reg.d.pal[3]>>3)&7; - doublescan=m_reg.d.pal[3]&0x80?FALSE:TRUE; - break; - case 1: - color=m_reg.d.pal[3]&7; - doublescan=m_reg.d.pal[3]&0x40?FALSE:TRUE; - break; - case 2: - color=(m_reg.d.pal[2]>>3)&7; - doublescan=m_reg.d.pal[2]&0x80?FALSE:TRUE; - break; - case 3: - color=m_reg.d.pal[2]&7; - doublescan=m_reg.d.pal[2]&0x40?FALSE:TRUE; - break; - } - for (k=0; k<8; k++) - { - int j, m; - b=m_reg.d.chars[i][k]; - x=m_pos[i].x+XPOS; - if (!doublescan) - { - y=m_pos[i].y+YPOS+k; - for (j=0,m=0x80; j<8; j++, m>>=1) - { - if (b & m) - m_bitmap->pix16(y, x + j) = color; - } - } - else - { - y=m_pos[i].y+YPOS+k*2; - for (j=0,m=0x80; j<8; j++, m>>=1) - { - if (b & m) - { - m_bitmap->pix16(y, x + j) = color; - m_bitmap->pix16(y+1, x + j) = color; - } - } - } - if (m_reg.d.collision_bg&(1<>3]<<8) | m_bg[y][(x>>3)+1]) ) - m_reg.d.collision_bg&=~(1<width(); - - if (m_ad_delay<=0) - m_ad_select=m_reg.d.pal[1]&0x40; - else m_ad_delay--; - - m_line++; - m_line%=262; - // unbelievable, reflects only charline, but alien invaders uses it for - // alien scrolling - - if (m_lineplot_box(0, m_line, width, 1, (m_reg.d.pal[1])&7); - memset(m_bg[m_line], 0, sizeof(m_bg[0])); - } - else - { - int h=m_doublescan?16:8; - - m_charline=(m_line-m_ypos)/h; - - if (m_charline<13) - { - if (((m_line-m_ypos)&(h-1))==0) - { - vh_draw_line(m_charline*h+m_ypos, m_reg.d.chars1[m_charline]); - } - } - else - if (m_lines26 && (m_charline<26)) - { - if (((m_line-m_ypos)&(h-1))==0) - { - vh_draw_line(m_charline*h+m_ypos, m_reg.d.chars2[m_charline-13]); - } - m_charline-=13; - } - else - { - m_charline=0xd; - m_bitmap->plot_box(0, m_line, width, 1, (m_reg.d.pal[1])&7); - memset(m_bg[m_line], 0, sizeof(m_bg[0])); - } - } - if (m_line==261) - draw_sprites(); -} - -READ8_MEMBER( arcadia_state::vsync_r ) -{ - return m_line>=216 ? 0x80 : 0 ; -} - -UINT32 arcadia_state::screen_update_arcadia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, *m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} diff --git a/src/mess/video/atarist.c b/src/mess/video/atarist.c deleted file mode 100644 index 2c80d6beb9a..00000000000 --- a/src/mess/video/atarist.c +++ /dev/null @@ -1,1131 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Olivier Galibert -/* - - TODO: - - - rewrite shifter - - STe pixelofs - - blitter hog - - high resolution - -*/ - -#include "emu.h" -#include "cpu/m68000/m68000.h" -#include "machine/ram.h" -#include "video/atarist.h" -#include "includes/atarist.h" - - - -//************************************************************************** -// CONSTANTS / MACROS -//************************************************************************** - -#define LOG 0 - -static const int BLITTER_NOPS[16][4] = -{ - { 1, 1, 1, 1 }, - { 2, 2, 3, 3 }, - { 2, 2, 3, 3 }, - { 1, 1, 2, 2 }, - { 2, 2, 3, 3 }, - { 2, 2, 2, 2 }, - { 2, 2, 3, 3 }, - { 2, 2, 3, 3 }, - { 2, 2, 3, 3 }, - { 2, 2, 3, 3 }, - { 2, 2, 2, 2 }, - { 2, 2, 3, 3 }, - { 1, 1, 2, 2 }, - { 2, 2, 3, 3 }, - { 2, 2, 3, 3 }, - { 1, 1, 1, 1 } -}; - - -//************************************************************************** -// SHIFTER -//************************************************************************** - -//------------------------------------------------- -// shift_mode_0 - -//------------------------------------------------- - -inline pen_t st_state::shift_mode_0() -{ - int color = (BIT(m_shifter_rr[3], 15) << 3) | (BIT(m_shifter_rr[2], 15) << 2) | (BIT(m_shifter_rr[1], 15) << 1) | BIT(m_shifter_rr[0], 15); - - m_shifter_rr[0] <<= 1; - m_shifter_rr[1] <<= 1; - m_shifter_rr[2] <<= 1; - m_shifter_rr[3] <<= 1; - - return m_palette->pen(color); -} - - -//------------------------------------------------- -// shift_mode_1 - -//------------------------------------------------- - -inline pen_t st_state::shift_mode_1() -{ - int color = (BIT(m_shifter_rr[1], 15) << 1) | BIT(m_shifter_rr[0], 15); - - m_shifter_rr[0] <<= 1; - m_shifter_rr[1] <<= 1; - m_shifter_shift++; - - if (m_shifter_shift == 16) - { - m_shifter_rr[0] = m_shifter_rr[2]; - m_shifter_rr[1] = m_shifter_rr[3]; - m_shifter_rr[2] = m_shifter_rr[3] = 0; - m_shifter_shift = 0; - } - - return m_palette->pen(color); -} - - -//------------------------------------------------- -// shift_mode_2 - -//------------------------------------------------- - -inline pen_t st_state::shift_mode_2() -{ - int color = BIT(m_shifter_rr[0], 15); - - m_shifter_rr[0] <<= 1; - m_shifter_shift++; - - switch (m_shifter_shift) - { - case 16: - m_shifter_rr[0] = m_shifter_rr[1]; - m_shifter_rr[1] = m_shifter_rr[2]; - m_shifter_rr[2] = m_shifter_rr[3]; - m_shifter_rr[3] = 0; - break; - - case 32: - m_shifter_rr[0] = m_shifter_rr[1]; - m_shifter_rr[1] = m_shifter_rr[2]; - m_shifter_rr[2] = 0; - break; - - case 48: - m_shifter_rr[0] = m_shifter_rr[1]; - m_shifter_rr[1] = 0; - m_shifter_shift = 0; - break; - } - - return m_palette->pen(color); -} - - -//------------------------------------------------- -// shifter_tick - -//------------------------------------------------- - -void st_state::shifter_tick() -{ - int y = machine().first_screen()->vpos(); - int x = machine().first_screen()->hpos(); - - pen_t pen; - - switch (m_shifter_mode) - { - case 0: - pen = shift_mode_0(); - break; - - case 1: - pen = shift_mode_1(); - break; - - case 2: - pen = shift_mode_2(); - break; - - default: - pen = m_palette->black_pen(); - break; - } - - m_bitmap.pix32(y, x) = pen; -} - - -//------------------------------------------------- -// shifter_load - -//------------------------------------------------- - -inline void st_state::shifter_load() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT16 data = program.read_word(m_shifter_ofs); - - m_shifter_ir[m_shifter_bitplane] = data; - m_shifter_bitplane++; - m_shifter_ofs += 2; - - if (m_shifter_bitplane == 4) - { - m_shifter_bitplane = 0; - - m_shifter_rr[0] = m_shifter_ir[0]; - m_shifter_rr[1] = m_shifter_ir[1]; - m_shifter_rr[2] = m_shifter_ir[2]; - m_shifter_rr[3] = m_shifter_ir[3]; - } -} - - -//------------------------------------------------- -// glue_tick - -//------------------------------------------------- - -void st_state::glue_tick() -{ - int y = machine().first_screen()->vpos(); - int x = machine().first_screen()->hpos(); - - int v = (y >= m_shifter_y_start) && (y < m_shifter_y_end); - int h = (x >= m_shifter_x_start) && (x < m_shifter_x_end); - - if(m_shifter_mode == 1) { - int dt = 8; - h = (x >= m_shifter_x_start-dt) && (x < m_shifter_x_end-dt); - } - int de = h && v; - - if(!x) { - m_shifter_bitplane = 0; - m_shifter_shift = 0; - } - - if (de != m_shifter_de) - { - m_mfp->tbi_w(de); - m_shifter_de = de; - } - - if (de) - { - shifter_load(); - } - - if ((y == m_shifter_vblank_start) && (x == 0)) - { - m_maincpu->set_input_line(M68K_IRQ_4, HOLD_LINE); - m_shifter_ofs = m_shifter_base; - } - - if (x == m_shifter_hblank_start) - { - m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); -// m_shifter_ofs += (m_shifter_lineofs * 2); // STe - } - - pen_t pen; - - switch (m_shifter_mode) - { - case 0: - pen = shift_mode_0(); - m_bitmap.pix32(y, x) = pen; - m_bitmap.pix32(y, x+1) = pen; - pen = shift_mode_0(); - m_bitmap.pix32(y, x+2) = pen; - m_bitmap.pix32(y, x+3) = pen; - pen = shift_mode_0(); - m_bitmap.pix32(y, x+4) = pen; - m_bitmap.pix32(y, x+5) = pen; - pen = shift_mode_0(); - m_bitmap.pix32(y, x+6) = pen; - m_bitmap.pix32(y, x+7) = pen; - break; - - case 1: - pen = shift_mode_1(); - m_bitmap.pix32(y, x) = pen; - pen = shift_mode_1(); - m_bitmap.pix32(y, x+1) = pen; - pen = shift_mode_1(); - m_bitmap.pix32(y, x+2) = pen; - pen = shift_mode_1(); - m_bitmap.pix32(y, x+3) = pen; - pen = shift_mode_1(); - m_bitmap.pix32(y, x+4) = pen; - pen = shift_mode_1(); - m_bitmap.pix32(y, x+5) = pen; - pen = shift_mode_1(); - m_bitmap.pix32(y, x+6) = pen; - pen = shift_mode_1(); - m_bitmap.pix32(y, x+7) = pen; - break; - - case 2: - pen = shift_mode_2(); - break; - - default: - pen = m_palette->black_pen(); - break; - } -} - - -//------------------------------------------------- -// set_screen_parameters - -//------------------------------------------------- - -void st_state::set_screen_parameters() -{ - if (m_shifter_sync & 0x02) - { - m_shifter_x_start = ATARIST_HBDEND_PAL*2; - m_shifter_x_end = ATARIST_HBDSTART_PAL*2; - m_shifter_y_start = ATARIST_VBDEND_PAL; - m_shifter_y_end = ATARIST_VBDSTART_PAL; - m_shifter_hblank_start = ATARIST_HBSTART_PAL*2; - m_shifter_vblank_start = ATARIST_VBSTART_PAL; - } - else - { - m_shifter_x_start = ATARIST_HBDEND_NTSC*2; - m_shifter_x_end = ATARIST_HBDSTART_NTSC*2; - m_shifter_y_start = ATARIST_VBDEND_NTSC; - m_shifter_y_end = ATARIST_VBDSTART_NTSC; - m_shifter_hblank_start = ATARIST_HBSTART_NTSC*2; - m_shifter_vblank_start = ATARIST_VBSTART_NTSC; - } -} - - -//------------------------------------------------- -// shifter_base_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::shifter_base_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0x00: - data = (m_shifter_base >> 16) & 0x3f; - break; - - case 0x01: - data = (m_shifter_base >> 8) & 0xff; - break; - } - - return data; -} - - -//------------------------------------------------- -// shifter_base_w - -//------------------------------------------------- - -WRITE8_MEMBER( st_state::shifter_base_w ) -{ - switch (offset) - { - case 0x00: - m_shifter_base = (m_shifter_base & 0x00ff00) | (data & 0x3f) << 16; - logerror("SHIFTER Video Base Address %06x\n", m_shifter_base); - break; - - case 0x01: - m_shifter_base = (m_shifter_base & 0x3f0000) | (data << 8); - logerror("SHIFTER Video Base Address %06x\n", m_shifter_base); - break; - } -} - - -//------------------------------------------------- -// shifter_counter_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::shifter_counter_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0x00: - data = (m_shifter_ofs >> 16) & 0x3f; - break; - - case 0x01: - data = (m_shifter_ofs >> 8) & 0xff; - break; - - case 0x02: - data = m_shifter_ofs & 0xff; - break; - } - - return data; -} - - -//------------------------------------------------- -// shifter_sync_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::shifter_sync_r ) -{ - return m_shifter_sync; -} - - -//------------------------------------------------- -// shifter_sync_w - -//------------------------------------------------- - -WRITE8_MEMBER( st_state::shifter_sync_w ) -{ - m_shifter_sync = data; - logerror("SHIFTER Sync %x\n", m_shifter_sync); - set_screen_parameters(); -} - - -//------------------------------------------------- -// shifter_mode_r - -//------------------------------------------------- - -READ8_MEMBER( st_state::shifter_mode_r ) -{ - return m_shifter_mode; -} - - -//------------------------------------------------- -// shifter_mode_w - -//------------------------------------------------- - -WRITE8_MEMBER( st_state::shifter_mode_w ) -{ - m_shifter_mode = data; - logerror("SHIFTER Mode %x\n", m_shifter_mode); -} - - -//------------------------------------------------- -// shifter_palette_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::shifter_palette_r ) -{ - return m_shifter_palette[offset] | 0xf888; -} - - -//------------------------------------------------- -// shifter_palette_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::shifter_palette_w ) -{ - m_shifter_palette[offset] = data; - // logerror("SHIFTER Palette[%x] = %x\n", offset, data); - - m_palette->set_pen_color(offset, pal3bit(data >> 8), pal3bit(data >> 4), pal3bit(data)); -} - - - -//************************************************************************** -// STE SHIFTER -//************************************************************************** - -//------------------------------------------------- -// shifter_base_low_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::shifter_base_low_r ) -{ - return m_shifter_base & 0xfe; -} - - -//------------------------------------------------- -// shifter_base_low_w - -//------------------------------------------------- - -WRITE8_MEMBER( ste_state::shifter_base_low_w ) -{ - m_shifter_base = (m_shifter_base & 0x3fff00) | (data & 0xfe); - logerror("SHIFTER Video Base Address %06x\n", m_shifter_base); -} - - -//------------------------------------------------- -// shifter_counter_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::shifter_counter_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 0x00: - data = (m_shifter_ofs >> 16) & 0x3f; - break; - - case 0x01: - data = (m_shifter_ofs >> 8) & 0xff; - break; - - case 0x02: - data = m_shifter_ofs & 0xfe; - break; - } - - return data; -} - - -//------------------------------------------------- -// shifter_counter_w - -//------------------------------------------------- - -WRITE8_MEMBER( ste_state::shifter_counter_w ) -{ - switch (offset) - { - case 0x00: - m_shifter_ofs = (m_shifter_ofs & 0x00fffe) | (data & 0x3f) << 16; - logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs); - break; - - case 0x01: - m_shifter_ofs = (m_shifter_ofs & 0x3f00fe) | (data << 8); - logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs); - break; - - case 0x02: - m_shifter_ofs = (m_shifter_ofs & 0x3fff00) | (data & 0xfe); - logerror("SHIFTER Video Address Counter %06x\n", m_shifter_ofs); - break; - } -} - - -//------------------------------------------------- -// shifter_palette_w - -//------------------------------------------------- - -WRITE16_MEMBER( ste_state::shifter_palette_w ) -{ - int r = ((data >> 7) & 0x0e) | BIT(data, 11); - int g = ((data >> 3) & 0x0e) | BIT(data, 7); - int b = ((data << 1) & 0x0e) | BIT(data, 3); - - m_shifter_palette[offset] = data; - logerror("SHIFTER palette %x = %x\n", offset, data); - - m_palette->set_pen_color(offset, r, g, b); -} - - -//------------------------------------------------- -// shifter_lineofs_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::shifter_lineofs_r ) -{ - return m_shifter_lineofs; -} - - -//------------------------------------------------- -// shifter_lineofs_w - -//------------------------------------------------- - -WRITE8_MEMBER( ste_state::shifter_lineofs_w ) -{ - m_shifter_lineofs = data; - logerror("SHIFTER Line Offset %x\n", m_shifter_lineofs); -} - - -//------------------------------------------------- -// shifter_pixelofs_r - -//------------------------------------------------- - -READ8_MEMBER( ste_state::shifter_pixelofs_r ) -{ - return m_shifter_pixelofs; -} - - -//------------------------------------------------- -// shifter_pixelofs_w - -//------------------------------------------------- - -WRITE8_MEMBER( ste_state::shifter_pixelofs_w ) -{ - m_shifter_pixelofs = data & 0x0f; - logerror("SHIFTER Pixel Offset %x\n", m_shifter_pixelofs); -} - - - -//************************************************************************** -// BLITTER -//************************************************************************** - -//------------------------------------------------- -// blitter_source - -//------------------------------------------------- - -void st_state::blitter_source() -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - UINT16 data = program.read_word(m_blitter_src); - - if (m_blitter_src_inc_x < 0) - { - m_blitter_srcbuf = (data << 16) | (m_blitter_srcbuf >> 16); - } - else - { - m_blitter_srcbuf = (m_blitter_srcbuf << 16) | data; - } -} - - -//------------------------------------------------- -// blitter_hop - -//------------------------------------------------- - -UINT16 st_state::blitter_hop() -{ - UINT16 source = m_blitter_srcbuf >> (m_blitter_skew & 0x0f); - UINT16 halftone = m_blitter_halftone[m_blitter_ctrl & 0x0f]; - - if (m_blitter_ctrl & ATARIST_BLITTER_CTRL_SMUDGE) - { - halftone = m_blitter_halftone[source & 0x0f]; - } - - switch (m_blitter_hop) - { - case 0: - return 0xffff; - case 1: - return halftone; - case 2: - return source; - case 3: - return source & halftone; - } - - return 0; -} - - -//------------------------------------------------- -// blitter_op - -//------------------------------------------------- - -void st_state::blitter_op(UINT16 s, UINT32 dstaddr, UINT16 mask) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - UINT16 d = program.read_word(dstaddr); - UINT16 result = 0; - - if (m_blitter_op & 0x08) result = (~s & ~d); - if (m_blitter_op & 0x04) result |= (~s & d); - if (m_blitter_op & 0x02) result |= (s & ~d); - if (m_blitter_op & 0x01) result |= (s & d); - - program.write_word(dstaddr, result); -} - - -//------------------------------------------------- -// blitter_tick - -//------------------------------------------------- - -void st_state::blitter_tick() -{ - do - { - if (m_blitter_skew & ATARIST_BLITTER_SKEW_FXSR) - { - blitter_source(); - m_blitter_src += m_blitter_src_inc_x; - } - - blitter_source(); - blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask1); - m_blitter_xcount--; - - while (m_blitter_xcount > 0) - { - m_blitter_src += m_blitter_src_inc_x; - m_blitter_dst += m_blitter_dst_inc_x; - - if (m_blitter_xcount == 1) - { - if (!(m_blitter_skew & ATARIST_BLITTER_SKEW_NFSR)) - { - blitter_source(); - } - - blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask3); - } - else - { - blitter_source(); - blitter_op(blitter_hop(), m_blitter_dst, m_blitter_endmask2); - } - - m_blitter_xcount--; - } - - m_blitter_src += m_blitter_src_inc_y; - m_blitter_dst += m_blitter_dst_inc_y; - - if (m_blitter_dst_inc_y < 0) - { - m_blitter_ctrl = (m_blitter_ctrl & 0xf0) | (((m_blitter_ctrl & 0x0f) - 1) & 0x0f); - } - else - { - m_blitter_ctrl = (m_blitter_ctrl & 0xf0) | (((m_blitter_ctrl & 0x0f) + 1) & 0x0f); - } - - m_blitter_xcount = m_blitter_xcountl; - m_blitter_ycount--; - } - while (m_blitter_ycount > 0); - - m_blitter_ctrl &= 0x7f; - - m_mfp->i3_w(0); -} - - -//------------------------------------------------- -// blitter_halftone_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_halftone_r ) -{ - return m_blitter_halftone[offset]; -} - - -//------------------------------------------------- -// blitter_src_inc_x_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_src_inc_x_r ) -{ - return m_blitter_src_inc_x; -} - - -//------------------------------------------------- -// blitter_src_inc_y_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_src_inc_y_r ) -{ - return m_blitter_src_inc_y; -} - - -//------------------------------------------------- -// blitter_src_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_src_r ) -{ - switch (offset) - { - case 0: - return (m_blitter_src >> 16) & 0xff; - case 1: - return m_blitter_src & 0xfffe; - } - - return 0; -} - - -//------------------------------------------------- -// blitter_end_mask_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_end_mask_r ) -{ - switch (offset) - { - case 0: - return m_blitter_endmask1; - case 1: - return m_blitter_endmask2; - case 2: - return m_blitter_endmask3; - } - - return 0; -} - - -//------------------------------------------------- -// blitter_dst_inc_x_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_dst_inc_x_r ) -{ - return m_blitter_dst_inc_x; -} - - -//------------------------------------------------- -// blitter_dst_inc_y_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_dst_inc_y_r ) -{ - return m_blitter_dst_inc_y; -} - - -//------------------------------------------------- -// blitter_dst_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_dst_r ) -{ - switch (offset) - { - case 0: - return (m_blitter_dst >> 16) & 0xff; - case 1: - return m_blitter_dst & 0xfffe; - } - - return 0; -} - - -//------------------------------------------------- -// blitter_count_x_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_count_x_r ) -{ - return m_blitter_xcount; -} - - -//------------------------------------------------- -// blitter_count_y_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_count_y_r ) -{ - return m_blitter_ycount; -} - - -//------------------------------------------------- -// blitter_op_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_op_r ) -{ - if (ACCESSING_BITS_0_7) - { - return m_blitter_hop; - } - else - { - return m_blitter_op; - } -} - - -//------------------------------------------------- -// blitter_ctrl_r - -//------------------------------------------------- - -READ16_MEMBER( st_state::blitter_ctrl_r ) -{ - if (ACCESSING_BITS_0_7) - { - return m_blitter_ctrl; - } - else - { - return m_blitter_skew; - } -} - - -//------------------------------------------------- -// blitter_halftone_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_halftone_w ) -{ - m_blitter_halftone[offset] = data; -} - - -//------------------------------------------------- -// blitter_src_inc_x_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_src_inc_x_w ) -{ - m_blitter_src_inc_x = data & 0xfffe; -} - - -//------------------------------------------------- -// blitter_src_inc_y_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_src_inc_y_w ) -{ - m_blitter_src_inc_y = data & 0xfffe; -} - - -//------------------------------------------------- -// blitter_src_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_src_w ) -{ - switch (offset) - { - case 0: - m_blitter_src = (data & 0xff) | (m_blitter_src & 0xfffe); - break; - - case 1: - m_blitter_src = (m_blitter_src & 0xff0000) | (data & 0xfffe); - break; - } -} - - -//------------------------------------------------- -// blitter_end_mask_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_end_mask_w ) -{ - switch (offset) - { - case 0: - m_blitter_endmask1 = data; - break; - - case 1: - m_blitter_endmask2 = data; - break; - - case 2: - m_blitter_endmask3 = data; - break; - } -} - - -//------------------------------------------------- -// blitter_dst_inc_x_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_dst_inc_x_w ) -{ - m_blitter_dst_inc_x = data & 0xfffe; -} - - -//------------------------------------------------- -// blitter_dst_inc_y_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_dst_inc_y_w ) -{ - m_blitter_dst_inc_y = data & 0xfffe; -} - - -//------------------------------------------------- -// blitter_dst_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_dst_w ) -{ - switch (offset) - { - case 0: - m_blitter_dst = (data & 0xff) | (m_blitter_dst & 0xfffe); - break; - - case 1: - m_blitter_dst = (m_blitter_dst & 0xff0000) | (data & 0xfffe); - break; - } -} - - -//------------------------------------------------- -// blitter_count_x_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_count_x_w ) -{ - m_blitter_xcount = data; -} - - -//------------------------------------------------- -// blitter_count_y_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_count_y_w ) -{ - m_blitter_ycount = data; -} - - -//------------------------------------------------- -// blitter_op_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_op_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_blitter_hop = (data >> 8) & 0x03; - } - else - { - m_blitter_op = data & 0x0f; - } -} - - -//------------------------------------------------- -// blitter_ctrl_w - -//------------------------------------------------- - -WRITE16_MEMBER( st_state::blitter_ctrl_w ) -{ - if (ACCESSING_BITS_0_7) - { - m_blitter_ctrl = (data >> 8) & 0xef; - - if (!(m_blitter_ctrl & ATARIST_BLITTER_CTRL_BUSY)) - { - if ((data >> 8) & ATARIST_BLITTER_CTRL_BUSY) - { - m_mfp->i3_w(1); - - int nops = BLITTER_NOPS[m_blitter_op][m_blitter_hop]; // each NOP takes 4 cycles - timer_set(attotime::from_hz((Y2/4)/(4*nops)), TIMER_BLITTER_TICK); - } - } - } - else - { - m_blitter_skew = data & 0xcf; - } -} - - - -//************************************************************************** -// VIDEO -//************************************************************************** - -void st_state::video_start() -{ - m_shifter_timer = timer_alloc(TIMER_SHIFTER_TICK); - m_glue_timer = timer_alloc(TIMER_GLUE_TICK); - -// m_shifter_timer->adjust(machine().first_screen()->time_until_pos(0), 0, attotime::from_hz(Y2/4)); // 125 ns - m_glue_timer->adjust(machine().first_screen()->time_until_pos(0), 0, attotime::from_hz(Y2/16)); // 500 ns - - machine().first_screen()->register_screen_bitmap(m_bitmap); - - /* register for state saving */ - save_item(NAME(m_shifter_base)); - save_item(NAME(m_shifter_ofs)); - save_item(NAME(m_shifter_sync)); - save_item(NAME(m_shifter_mode)); - save_item(NAME(m_shifter_palette)); - save_item(NAME(m_shifter_rr)); - save_item(NAME(m_shifter_ir)); - save_item(NAME(m_shifter_bitplane)); - save_item(NAME(m_shifter_shift)); - save_item(NAME(m_shifter_h)); - save_item(NAME(m_shifter_v)); - save_item(NAME(m_shifter_de)); - - save_item(NAME(m_blitter_halftone)); - save_item(NAME(m_blitter_src_inc_x)); - save_item(NAME(m_blitter_src_inc_y)); - save_item(NAME(m_blitter_dst_inc_x)); - save_item(NAME(m_blitter_dst_inc_y)); - save_item(NAME(m_blitter_src)); - save_item(NAME(m_blitter_dst)); - save_item(NAME(m_blitter_endmask1)); - save_item(NAME(m_blitter_endmask2)); - save_item(NAME(m_blitter_endmask3)); - save_item(NAME(m_blitter_xcount)); - save_item(NAME(m_blitter_ycount)); - save_item(NAME(m_blitter_xcountl)); - save_item(NAME(m_blitter_hop)); - save_item(NAME(m_blitter_op)); - save_item(NAME(m_blitter_ctrl)); - save_item(NAME(m_blitter_skew)); - - set_screen_parameters(); -} - - -void ste_state::video_start() -{ - st_state::video_start(); - - // register for state saving - save_item(NAME(m_shifter_lineofs)); - save_item(NAME(m_shifter_pixelofs)); -} - -void stbook_state::video_start() -{ -} - - -UINT32 st_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} diff --git a/src/mess/video/atarist.h b/src/mess/video/atarist.h deleted file mode 100644 index da66ff3a17e..00000000000 --- a/src/mess/video/atarist.h +++ /dev/null @@ -1,41 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Olivier Galibert -#ifndef _VIDEO_ATARIST_H_ -#define _VIDEO_ATARIST_H_ - -// 32028400 also exists -#define Y2 32084988.0 -#define Y2_NTSC 32042400.0 - -#define ATARIST_HBSTART_PAL 128*4 -#define ATARIST_HBEND_PAL 0 -#define ATARIST_HBSTART_NTSC 127*4 -#define ATARIST_HBEND_NTSC 0 -#define ATARIST_HTOT_PAL 129*4 -#define ATARIST_HTOT_NTSC 128*4 - -#define ATARIST_HBDEND_PAL 14*4 -#define ATARIST_HBDSTART_PAL 94*4 -#define ATARIST_HBDEND_NTSC 13*4 -#define ATARIST_HBDSTART_NTSC 93*4 - -#define ATARIST_VBEND_PAL 0 -#define ATARIST_VBEND_NTSC 0 -#define ATARIST_VBSTART_PAL 312 -#define ATARIST_VBSTART_NTSC 262 -#define ATARIST_VTOT_PAL 313 -#define ATARIST_VTOT_NTSC 263 - -#define ATARIST_VBDEND_PAL 63 -#define ATARIST_VBDSTART_PAL 263 -#define ATARIST_VBDEND_NTSC 34 -#define ATARIST_VBDSTART_NTSC 234 - -#define ATARIST_BLITTER_SKEW_NFSR 0x40 -#define ATARIST_BLITTER_SKEW_FXSR 0x80 - -#define ATARIST_BLITTER_CTRL_SMUDGE 0x20 -#define ATARIST_BLITTER_CTRL_HOG 0x40 -#define ATARIST_BLITTER_CTRL_BUSY 0x80 - -#endif diff --git a/src/mess/video/aussiebyte.c b/src/mess/video/aussiebyte.c deleted file mode 100644 index f3f758fe4f6..00000000000 --- a/src/mess/video/aussiebyte.c +++ /dev/null @@ -1,196 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*********************************************************** - - Video - Graphics not working properly. - Mode 0 - lores (wide, chunky) - Mode 1 - external, *should* be ok - Mode 2 - thin graphics, not explained well enough to code - Mode 3 - alphanumeric, works - - - -************************************************************/ -#include "includes/aussiebyte.h" -/*********************************************************** - - I/O Ports - -************************************************************/ - -// dummy read port, forces requested action to happen -READ8_MEMBER( aussiebyte_state::port33_r ) -{ - return 0xff; -} - -/* -Video control - needs to be fully understood -d0, d1, d2, d3 - can replace RA0-3 in graphics mode -d4 - GS - unknown -d5 - /SRRD - controls write of data to either vram or aram (1=vram, 0=aram) -d6 - /VWR - 0 = enable write vdata to vram, read from aram to vdata ; 1 = enable write to aram from vdata -d7 - OE on port 35 -*/ -WRITE8_MEMBER( aussiebyte_state::port34_w ) -{ - m_port34 = data; -} - -WRITE8_MEMBER( aussiebyte_state::port35_w ) -{ - m_port35 = data; -} - -READ8_MEMBER( aussiebyte_state::port36_r ) -{ - if BIT(m_port34, 5) - { - if BIT(m_p_attribram[m_alpha_address & 0x7ff], 7) - return m_p_videoram[m_alpha_address]; - else - return m_p_videoram[m_graph_address]; - } - else - return m_p_attribram[m_alpha_address & 0x7ff]; -} - -READ8_MEMBER( aussiebyte_state::port37_r ) -{ - return m_crtc->de_r() ? 0xff : 0xfe; -} - - -/*********************************************************** - - Video - -************************************************************/ -MC6845_ON_UPDATE_ADDR_CHANGED( aussiebyte_state::crtc_update_addr ) -{ -/* not sure what goes in here - parameters passed are device, address, strobe */ -// m_video_address = address;// & 0x7ff; -} - -WRITE8_MEMBER( aussiebyte_state::address_w ) -{ - m_crtc->address_w( space, 0, data ); - - m_video_index = data & 0x1f; - - if (m_video_index == 31) - { - m_alpha_address++; - m_alpha_address &= 0x3fff; - m_graph_address = (m_alpha_address << 4) | (m_port34 & 15); - - if BIT(m_port34, 5) - { - if BIT(m_p_attribram[m_alpha_address & 0x7ff], 7) - m_p_videoram[m_alpha_address] = m_port35; - else - m_p_videoram[m_graph_address] = m_port35; - } - else - m_p_attribram[m_alpha_address & 0x7ff] = m_port35; - } -} - -WRITE8_MEMBER( aussiebyte_state::register_w ) -{ - m_crtc->register_w( space, 0, data ); - UINT16 temp = m_alpha_address; - - // Get transparent address - if (m_video_index == 18) - m_alpha_address = (data << 8 ) | (temp & 0xff); - else - if (m_video_index == 19) - m_alpha_address = data | (temp & 0xff00); -} - -UINT8 aussiebyte_state::crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16 ac_cnt, bool ac_curs) -{ - UINT8 gfx = 0; - switch (ac_attr & 3) - { - case 0: // lores gfx - switch (ac_ra) - { - case 0: - case 1: - case 2: - gfx = (BIT(ac_chr, 7) ? 0xf8 : 0) | (BIT(ac_chr, 3) ? 7 : 0); - break; - case 3: - case 4: - case 5: - gfx = (BIT(ac_chr, 6) ? 0xf8 : 0) | (BIT(ac_chr, 2) ? 7 : 0); - break; - case 6: - case 7: - case 8: - gfx = (BIT(ac_chr, 5) ? 0xf8 : 0) | (BIT(ac_chr, 1) ? 7 : 0); - break; - default: - gfx = (BIT(ac_chr, 4) ? 0xf8 : 0) | (BIT(ac_chr, 0) ? 7 : 0); - break; - } - break; - case 1: // external mode - gfx = BITSWAP8(ac_chr, 0,1,2,3,4,5,6,7); - break; - case 2: // thin gfx - break; - case 3: // alpha - gfx = m_p_chargen[((ac_chr & 0x7f)<<4) | ac_ra]; - break; - } - - if (BIT(ac_attr, 3) & (ac_ra == 11)) // underline - gfx = 0xff; - if (BIT(ac_attr, 2) & ((ac_ra == 5) | (ac_ra == 6))) // strike-through - gfx = 0xff; - if (BIT(ac_attr, 6) & BIT(ac_cnt, 13)) // flash - gfx = 0; - if BIT(ac_attr, 5) // blank - gfx = 0; - if (ac_curs & BIT(ac_cnt, 14)) // cursor - gfx ^= 0xff; - if BIT(ac_attr, 4) // reverse video - gfx ^= 0xff; - return gfx; -} - -MC6845_UPDATE_ROW( aussiebyte_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,attr; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - ra &= 15; - m_cnt++; - - for (x = 0; x < x_count; x++) - { - mem = ma + x; - attr = m_p_attribram[mem & 0x7ff]; - if BIT(attr, 7) - chr = m_p_videoram[mem & 0x3fff]; // alpha - else - chr = m_p_videoram[(mem << 4) | ra]; // gfx - - gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); - - /* Display a scanline of a character (8 pixels) */ - *p++ = palette[BIT(gfx, 7)]; - *p++ = palette[BIT(gfx, 6)]; - *p++ = palette[BIT(gfx, 5)]; - *p++ = palette[BIT(gfx, 4)]; - *p++ = palette[BIT(gfx, 3)]; - *p++ = palette[BIT(gfx, 2)]; - *p++ = palette[BIT(gfx, 1)]; - *p++ = palette[BIT(gfx, 0)]; - } -} diff --git a/src/mess/video/avigo.c b/src/mess/video/avigo.c deleted file mode 100644 index 0177023fe9f..00000000000 --- a/src/mess/video/avigo.c +++ /dev/null @@ -1,118 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/*************************************************************************** - - avigo.c - - Functions to emulate the video hardware of the TI Avigo 10 PDA - -***************************************************************************/ - -#include "emu.h" -#include "includes/avigo.h" - -/*************************************************************************** - Start the video hardware emulation. -***************************************************************************/ - -/* mem size = 0x017c0 */ - - -/* current column to read/write */ - -#define AVIGO_VIDEO_DEBUG 0 -#define LOG(x) do { if (AVIGO_VIDEO_DEBUG) logerror x; } while (0) - - -READ8_MEMBER(avigo_state::vid_memory_r) -{ - if (!offset) - return m_screen_column; - - if ((offset<0x0100) || (offset>=0x01f0) || (m_screen_column >= (AVIGO_SCREEN_WIDTH>>3))) - { - LOG(("vid mem read: %04x\n", offset)); - return 0; - } - - /* 0x0100-0x01f0 contains data for selected column */ - return m_video_memory[m_screen_column + ((offset&0xff)*(AVIGO_SCREEN_WIDTH>>3))]; -} - -WRITE8_MEMBER(avigo_state::vid_memory_w) -{ - if (!offset) - { - /* select column to read/write */ - m_screen_column = data; - - LOG(("vid mem column write: %02x\n",data)); - - if (data>=(AVIGO_SCREEN_WIDTH>>3)) - { - LOG(("error: vid mem column write: %02x\n",data)); - } - return; - } - - if ((offset<0x0100) || (offset>=0x01f0) || (m_screen_column >= (AVIGO_SCREEN_WIDTH>>3))) - { - LOG(("vid mem write: %04x %02x\n", offset, data)); - return; - } - - /* 0x0100-0x01f0 contains data for selected column */ - m_video_memory[m_screen_column + ((offset&0xff)*(AVIGO_SCREEN_WIDTH>>3))] = data; -} - -void avigo_state::video_start() -{ - /* current selected column to read/write */ - m_screen_column = 0; - - /* allocate video memory */ - m_video_memory = machine().memory().region_alloc( "videoram", (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1, 1, ENDIANNESS_LITTLE )->base(); - memset(m_video_memory, 0, (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1); - - save_pointer(NAME(m_video_memory), (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1); -} - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(avigo_state, avigo) -{ - m_palette->set_pen_color(0,rgb_t(0xff,0xff,0xff)); /* white */ - m_palette->set_pen_color(1,rgb_t(0x00,0x00,0x00)); /* black */ -} - -UINT32 avigo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int y; - int b; - int x; - - /* draw avigo display */ - for (y=0; y>3)); - - x = 0; - for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) - { - int px; - UINT8 byte = line_ptr[0]; - - px = x; - for (b=7; b>=0; b--) - { - bitmap.pix16(y, px) = ((byte>>7) & 0x01); - px++; - byte = byte<<1; - } - - x = px; - line_ptr = line_ptr+1; - } - } - return 0; -} diff --git a/src/mess/video/b2m.c b/src/mess/video/b2m.c deleted file mode 100644 index 9cd59b2ec42..00000000000 --- a/src/mess/video/b2m.c +++ /dev/null @@ -1,60 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Bashkiria-2M video driver by Miodrag Milanovic - - 28/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/b2m.h" -#include "machine/ram.h" - -void b2m_state::video_start() -{ -} - -UINT32 b2m_state::screen_update_b2m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code1; - UINT8 code2; - UINT8 col; - int y, x, b; - UINT8 *ram = m_ram->pointer(); - - for (x = 0; x < 48; x++) - { - for (y = 0; y < 256; y++) - { - if (m_b2m_video_page==0) { - code1 = ram[0x11000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)]; - code2 = ram[0x15000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)]; - } else { - code1 = ram[0x19000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)]; - code2 = ram[0x1d000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)]; - } - for (b = 7; b >= 0; b--) - { - col = (((code2 >> b) & 0x01)<<1) + ((code1 >> b) & 0x01); - bitmap.pix16(y, x*8+b) = col; - } - } - } - - return 0; -} - -static const rgb_t b2m_palette[4] = { - rgb_t(0x00, 0x00, 0x00), // 0 - rgb_t(0x00, 0x00, 0x00), // 1 - rgb_t(0x00, 0x00, 0x00), // 2 - rgb_t(0x00, 0x00, 0x00), // 3 -}; - -PALETTE_INIT_MEMBER(b2m_state, b2m) -{ - palette.set_pen_colors(0, b2m_palette, ARRAY_LENGTH(b2m_palette)); -} diff --git a/src/mess/video/bbc.c b/src/mess/video/bbc.c deleted file mode 100644 index 5e059647705..00000000000 --- a/src/mess/video/bbc.c +++ /dev/null @@ -1,306 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Gordon Jefferyes, Nigel Barnes -/****************************************************************************** - BBC Model B - - MESS Driver By: - - Gordon Jefferyes - mess_bbc@romvault.com - - This is the first go around at converting the BBC code over to using - mames built in mc6845, there are a number of features now incorrect - or missing in this build: - - BBC split modes no longer work (Like is used in Elite.) - -******************************************************************************/ - -#include "emu.h" -#include "includes/bbc.h" -#include "video/saa5050.h" -#include "video/mc6845.h" - -/************************************************************************ - * C0 and C1 along with MA12 output from the 6845 drive 4 NAND gates in ICs 27,36 and 40 - * the outputs from these NAND gates (B1 to B4) along with MA8 to MA11 from the 6845 (A1 to B4) are added together - * in IC39 74LS283 4 bit adder to form (S1 to S4) the logic is used to loop the screen memory for hardware scrolling. - * when MA13 from the 6845 is low the latches IC8 and IC9 are enabled - * they control the memory addressing for the Hi-Res modes. - * when MA13 from the 6845 is high the latches IC10 and IC11 are enabled - * they control the memory addressing for the Teletext mode. - * IC 8 or IC10 drives the row select in the memory (the lower 7 bits in the memory address) and - * IC 9 or IC11 drives the column select in the memory (the next 7 bits in the memory address) this - * gives control of the bottom 14 bits of the memory, in a 32K model B 15 bits are needed to access - * all the RAM, so S4 for the adder drives the CAS0 and CAS1 to access the top bit, in a 16K model A - * the output of S4 is linked out to a 0v supply by link S25 to just access the 16K memory area. - ************************************************************************/ - -unsigned int bbc_state::calculate_video_address(int ma,int ra) -{ - // ma = output from IC2 6845 MA address - - int c0=m_b4_video0; // output from IC32 74LS259 bits 4 and 5 - int c1=m_b5_video1; - - /* the 4 bit input port b on IC39 are produced by 4 NAND gates. - these NAND gates take their - inputs from c0 and c1 (from IC32) and ma12 (from the 6845) */ - - /* get bit m12 from the 6845 */ - int ma12=(ma>>12)&1; - - // 4 bit input B on IC39 74LS283 (4 bit adder) - /* 3 input NAND part of IC 36 */ - int b1=(~(c1 & c0 & ma12)) & 1; - /* 2 input NAND part of IC40 (b3 is calculated before b2 and b4 because b3 feed back into b2 and b4) */ - int b3=(~(c0 & ma12)) & 1; - /* 3 input NAND part of IC 36 */ - int b2=(~(c1 & b3 & ma12)) & 1; - /* 2 input NAND part of IC 27 */ - int b4=(~(b3 & ma12)) & 1; - - /* inputs port b to IC39 are taken from the NAND gates b1 to b4 */ - int b=(b1<<0)|(b2<<1)|(b3<<2)|(b4<<3); - - /* inputs port a to IC39 are MA8 to MA11 from the 6845 */ - int a=(ma>>8)&0xf; - - /* IC39 performs the 4 bit add with the carry input set high */ - int s=(a+b+1)&0xf; - - /* if MA13 (TTXVDU) is low then IC8 and IC9 are used to calculate - the memory location required for the hi res video. - if MA13 is hight then IC10 and IC11 are used to calculate the memory location for the teletext chip*/ - unsigned int m; - if ((ma>>13)&1) - { - // IC 10 and IC 11 - m=((ma&0x3ff)|0x3c00)|((s&0x8)<<11); - } else { - // IC 8 and IC 9 - m=((ma&0xff)<<3)|(s<<11)|(ra&0x7); - } - if (m_memorySize==16) - return m & 0x3fff; - - return m; -} - -/************************************************************************ - * VideoULA - ************************************************************************/ - -static const int pixels_per_byte_set[8]={ 2,4,8,16,1,2,4,8 }; - -static const int width_of_cursor_set[8]={ 0,0,1,2,1,0,2,4 }; - -/* this is a quick lookup array that puts bits 0,2,4,6 into bits 0,1,2,3 - this is used by the palette lookup in the video ULA */ -void bbc_state::set_pixel_lookup() -{ - for (int i=0; i<256; i++) - { - m_pixel_bits[i] = (((i>>7)&1)<<3) | (((i>>5)&1)<<2) | (((i>>3)&1)<<1) | (((i>>1)&1)<<0); - } -} - - -WRITE8_MEMBER(bbc_state::bbc_videoULA_w) -{ - // Make sure vpos is never <0 2008-10-11 PHS. - int vpos=machine().first_screen()->vpos(); - if(vpos==0) - machine().first_screen()->update_partial(vpos); - else - machine().first_screen()->update_partial(vpos -1 ); - - logerror("setting videoULA %.4x to:%.4x at :%d \n",data,offset,machine().first_screen()->vpos() ); - - - switch (offset&0x01) - { - // Set the control register in the Video ULA - case 0: - { - m_videoULA_Reg=data; - m_videoULA_master_cursor_size= (m_videoULA_Reg>>7)&0x01; - m_videoULA_width_of_cursor= (m_videoULA_Reg>>5)&0x03; - m_videoULA_6845_clock_rate= (m_videoULA_Reg>>4)&0x01; - m_videoULA_characters_per_line= (m_videoULA_Reg>>2)&0x03; - m_videoULA_teletext_normal_select=(m_videoULA_Reg>>1)&0x01; - m_videoULA_flash_colour_select= m_videoULA_Reg &0x01; - - m_videoULA_pallet_lookup=m_videoULA_flash_colour_select?m_videoULA_pallet0:m_videoULA_pallet1; - - m_emulation_cursor_size=width_of_cursor_set[m_videoULA_width_of_cursor|(m_videoULA_master_cursor_size<<2)]; - - // this is the number of BBC pixels held in each byte - if (m_videoULA_teletext_normal_select) - { - m_pixels_per_byte=6; - } else { - m_pixels_per_byte=pixels_per_byte_set[m_videoULA_characters_per_line|(m_videoULA_6845_clock_rate<<2)]; - } - m_mc6845->set_hpixels_per_column(m_pixels_per_byte); - if (m_videoULA_6845_clock_rate) - m_mc6845->set_clock(2000000); - else - m_mc6845->set_clock(1000000); - } - break; - // Set a pallet register in the Video ULA - case 1: - int tpal=(data>>4)&0x0f; - int tcol=data&0x0f; - m_videoULA_pallet0[tpal]=tcol; - m_videoULA_pallet1[tpal]=tcol<8?tcol:tcol^7; - break; - } -} - -/************************************************************************ - * BBC circuits controlled by 6845 Outputs - ************************************************************************/ - -MC6845_UPDATE_ROW( bbc_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - if (m_videoULA_teletext_normal_select) - { - m_trom->lose_w(1); - m_trom->lose_w(0); - - for(int x_pos=0; x_pos>13)&1)==0) - { - m_Teletext_Latch=0; - } - else - { - m_Teletext_Latch=(m_BBC_Video_RAM[calculate_video_address(ma+x_pos,ra)]); - } - - m_trom->write((m_Teletext_Latch&0x3f)|(m_Teletext_Latch&0x40)); - - m_trom->f1_w(1); - m_trom->f1_w(0); - - for(int pixelno=0;pixelno<6;pixelno++) - { - m_trom->tr6_w(1); - m_trom->tr6_w(0); - - int col=m_trom->get_rgb() ^ ((x_pos==cursor_x) ? 7 : 0); - - int r = BIT(col, 0) * 0xff; - int g = BIT(col, 1) * 0xff; - int b = BIT(col, 2) * 0xff; - - rgb_t rgb = rgb_t(r, g, b); - - bitmap.pix32(y, (x_pos*m_pixels_per_byte)+pixelno) = rgb; - } - } - - if (ra == 18) - { - m_trom->lose_w(1); - m_trom->lose_w(0); - } - } - else - { - // this is IC38 and IC41 takes 6845 DisplayEnabled and 6845 RA3 - int DE= !(ra>=8); - - if (DE) - { - for(int x_pos=0; x_posdew_w(state); -} - - -/**** BBC B+ Shadow Ram change ****/ - -void bbc_state::bbcbp_setvideoshadow(int vdusel) -{ - if (vdusel) - { - m_BBC_Video_RAM= m_region_maincpu->base()+0x8000; - } else { - m_BBC_Video_RAM= m_region_maincpu->base(); - } -} - -/************************************************************************ - * bbc_vh_start - * Initialize the BBC video emulation - ************************************************************************/ - -void bbc_state::common_init(int memorySize) -{ - m_emulation_cursor_size = 1; - - m_VideoULA_CR = 7; - m_VideoULA_CR_counter = 0; - - set_pixel_lookup(); - - m_BBC_Video_RAM = m_region_maincpu->base(); - m_memorySize=memorySize; - -} - -VIDEO_START_MEMBER(bbc_state,bbca) -{ - common_init(m_ram->size()/1024); -} - -VIDEO_START_MEMBER(bbc_state,bbcb) -{ - common_init(32); -} - -VIDEO_START_MEMBER(bbc_state,bbcbp) -{ - common_init(32); -} - -VIDEO_START_MEMBER(bbc_state,bbcm) -{ - common_init(32); -} diff --git a/src/mess/video/bk.c b/src/mess/video/bk.c deleted file mode 100644 index 103c78779bd..00000000000 --- a/src/mess/video/bk.c +++ /dev/null @@ -1,40 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - BK video driver by Miodrag Milanovic - - 10/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/bk.h" - - -void bk_state::video_start() -{ -} - -UINT32 bk_state::screen_update_bk0010(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 code; - int y, x, b; - int nOfs; - - nOfs = (m_scrool - 728) % 256; - - for (y = 0; y < 256; y++) - { - for (x = 0; x < 32; x++) - { - code = m_bk0010_video_ram[((y+nOfs) %256)*32 + x]; - for (b = 0; b < 16; b++) - { - bitmap.pix16(y, x*16 + b) = (code >> b) & 0x01; - } - } - } - return 0; -} diff --git a/src/mess/video/busicom.c b/src/mess/video/busicom.c deleted file mode 100644 index 0c97258a002..00000000000 --- a/src/mess/video/busicom.c +++ /dev/null @@ -1,1860 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Busicom 141-PF - - 04/08/2009 Initial driver by Miodrag Milanovic - -****************************************************************************/ -#include "emu.h" -#include "includes/busicom.h" - -// Printer font 34x44 as provided by MIT Media Lab - - -static const UINT8 printer_font[]= { -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,3,4,5,6,6,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,4,6,7,7,7,7,7,7,7,7,6,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,5,7,7,7,7,7,7,7,7,7,7,7,7,5,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,7,7,5,3,2,1,1,2,3,5,7,7,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,6,7,7,7,6,2,0,0,0,0,0,0,0,0,1,5,7,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,1,0,0,0,0,0,0, -0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0, -0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0, -0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0, -0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0, -0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0, -0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0, -0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0, -0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0, -0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0, -0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0, -0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0, -0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0, -0,0,0,0,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0, -0,0,0,0,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0, -0,0,0,0,5,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0, -0,0,0,0,5,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0, -0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0,0,0,0, -0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,5,0,0,0,0,0,0, -0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0, -0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,1,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,5,2,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,7,7,5,2,0,0,0,0,1,4,6,7,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,2,6,7,7,7,7,7,6,6,5,5,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,6,5,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,7,6,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,5,7,7,7,7,6,1,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,2,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,5,2,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,3,3,2,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,2,1,1,1,1,1,0,4,7,7,7,2,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,3,1,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,2,3,4,4,4,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,5,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,6,7,7,7,7,7,5,5,5,6,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,6,7,7,7,5,2,0,0,0,0,0,1,1,4,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,5,0,0,0,0,0,0,0,0,0, -0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,5,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,1,0,0,0,0,0,0,0, -0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0, -0,0,1,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0, -0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,4,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,6,7,7,5,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,0,0,0,0,0,0,0,0, -0,0,0,6,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0, -0,0,0,1,3,4,4,4,4,4,4,4,3,3,4,4,4,4,4,4,4,5,5,5,5,5,4,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, -0,0,0,5,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0, -0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0, -0,0,0,0,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,1,0,5,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,2,0,1,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,5,6,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,5,7,6,5,5,5,5,4,6,7,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,3,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,5,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,3,5,7,7,7,7,6,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,4,6,7,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,7,7,7,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,3,4,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,2,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,6,7,7,7,4,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,6,7,7,4,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,6,7,7,6,4,4,4,3,3,3,2,2,2,3,2,5,7,7,7,4,3,3,3,2,2,2,1,0,0,0,0, -0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0, -0,0,0,2,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0, -0,0,0,0,0,1,3,4,4,4,4,5,5,5,5,4,4,4,6,7,7,7,4,3,4,4,4,5,4,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,2,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,2,4,4,3,3,3,3,3,3,4,3,3,3,3,4,4,4,4,4,4,4,4,2,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0, -0,0,0,0,6,7,7,5,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,6,5,4,1,0,0,0,0,0,0,0, -0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,1,3,4,6,6,7,6,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,6,2,4,5,7,7,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,6,6,6,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,7,7,7,7,5,3,2,1,0,0,0,2,6,7,7,7,6,2,0,0,0,0,0,0,0,0, -0,0,0,0,2,7,7,7,7,6,4,2,0,0,0,0,0,0,0,0,1,5,7,7,7,6,1,0,0,0,0,0,0,0, -0,0,0,0,0,1,3,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,4,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,3,5,6,7,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,3,7,7,7,7,7,7,7,5,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,6,7,7,7,6,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,5,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,4,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,7,7,7,4,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,7,7,7,7,7,7,6,4,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,5,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,6,4,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,5,7,7,7,2,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,7,7,7,6,0,0,1,3,5,7,7,7,7,6,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,7,7,7,5,1,5,7,7,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,7,7,7,7,7,7,7,7,5,2,0,1,1,2,4,6,7,7,7,6,1,0,0,0,0,0,0,0,0, -0,0,0,0,4,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,4,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,1,0,0,0,0,0, -0,0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,3,0,0,0,0,0, -0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0, -0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0, -0,0,0,0,5,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0, -0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0, -0,0,0,0,3,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0, -0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,5,0,0,0,0,0, -0,0,0,0,0,6,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0, -0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0, -0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,0,0,1,5,7,7,7,3,0,0,0,0,0,0,0,0,0,1,4,7,7,7,4,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,6,7,7,7,5,2,0,0,0,0,0,1,4,6,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,5,7,7,7,7,5,3,4,5,5,6,7,7,7,7,5,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,4,6,7,7,7,7,7,7,6,4,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,3,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,0,0,0,0,0, -0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0, -0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0, -0,0,0,0,3,7,7,7,7,6,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,6,7,7,2,0,0,0,0,0, -0,0,0,0,3,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,6,0,0,0,0,0,0, -0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0, -0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,0, -0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,3,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,1,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,1,2,4,5,5,6,6,6,5,5,4,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,5,7,7,7,7,7,6,6,5,5,6,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,4,7,7,7,7,5,2,0,0,0,0,0,1,4,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,1,4,7,7,7,5,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,6,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,1,0,0,0,0,0,0,0, -0,0,0,0,4,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,4,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,4,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,6,2,0,0,0,0,0,0,1,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,7,7,6,5,5,5,5,6,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,6,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,6,7,7,7,7,5,3,2,1,1,0,1,2,5,7,7,7,7,5,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,3,7,7,7,6,2,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0, -0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,0, -0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0, -0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0, -0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0, -0,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0, -0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0, -0,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0, -0,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0, -0,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0, -0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0, -0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0, -0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,2,7,7,7,6,3,2,0,0,0,0,0,0,0,0,0,4,7,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,2,7,7,7,7,7,6,4,3,3,2,2,3,4,6,7,7,7,7,6,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,2,2,3,3,4,4,4,5,4,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,5,7,7,7,7,7,6,5,4,4,5,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,6,7,7,7,6,2,1,0,0,0,0,0,1,2,5,7,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,4,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0, -0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0, -0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0, -0,0,0,4,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0, -0,0,0,4,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0, -0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0, -0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0, -0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,0, -0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,4,0,0,0,0,0, -0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,4,0,0,0,0,0, -0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,4,0,0,0,0,0, -0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,4,0,0,0,0,0, -0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,3,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,6,3,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,1,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,7,7,5,1,0,0,0,0,1,3,6,7,7,6,6,7,7,6,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,6,7,7,7,7,6,6,6,5,7,7,7,7,7,4,5,7,7,5,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,7,5,2,6,7,7,5,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,4,2,0,0,7,7,7,4,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,3,2,2,1,0,0,0,1,7,7,7,3,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,6,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,5,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,2,2,3,5,6,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,7,7,7,7,7,7,7,6,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,6,5,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,3,6,7,7,7,6,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,2,4,7,7,7,5,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,5,5,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,6,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,4,6,7,7,7,7,7,7,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,4,6,6,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,2,0,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,6,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,6,0,4,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,1,0,1,5,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,5,7,7,7,7,2,0,0,0,1,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,1,6,7,7,7,5,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,7,4,0,0,0,0,0,0,0,0,0,2,6,7,7,7,5,1,0,0,0,0,0,0, -0,0,0,0,0,2,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,5,0,0,0,0,0,0, -0,0,0,0,3,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,5,0,0,0,0,0, -0,0,0,2,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0,0, -0,0,2,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0, -0,1,6,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0, -0,4,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0, -0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0, -0,0,5,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,1,0,0, -0,0,1,6,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0, -0,0,0,1,5,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0, -0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0, -0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0, -0,0,0,0,0,0,2,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,1,0,1,2,2,2,2,3,4,5,7,7,7,7,7,7,7,7,7,6,5,5,5,4,4,4,4,4,3,0,0,0, -2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0, -2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0, -0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0, -0,1,2,2,2,3,3,3,3,3,3,4,7,7,7,7,7,7,7,5,3,2,2,2,2,2,2,1,1,2,1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,5,5,5,5,4,4,3,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0, -0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,4,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,4,2,0,0,0, -0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,3,0,0, -0,6,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,4,0,0, -0,4,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,2,0,0, -0,0,4,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,3,0,0,0, -0,0,0,5,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,3,0,0,0,0, -0,0,0,0,5,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,4,0,0,0,0,0, -0,0,0,0,0,4,7,7,7,7,7,4,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,4,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,3,0,0,0,0,0,0,4,7,7,7,7,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,7,7,7,4,0,0,0,1,5,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,7,7,3,0,0,5,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,4,5,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,4,2,6,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,1,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,7,7,7,4,0,0,0,0,3,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,3,0,0,0,0,0,0,3,7,7,7,7,7,6,1,0,0,0,0,0,0,0, -0,0,0,0,1,5,7,7,7,7,7,3,0,0,0,0,0,0,0,0,4,7,7,7,7,7,6,1,0,0,0,0,0,0, -0,0,0,1,6,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,6,1,0,0,0,0,0, -0,0,1,6,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,6,1,0,0,0,0, -0,2,6,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,5,0,0,0,0, -1,6,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,7,4,0,0,0, -1,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,3,0,0, -0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,3,0,0, -0,0,4,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,7,3,0,0,0, -0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,6,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,3,4,5,5,5,2,0,0, -2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -0,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,5,5,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,4,5,5,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,1,0,0, -5,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,5,0,0, -5,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,6,0,0, -5,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,7,7,6,0,0, -5,7,7,7,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,6,0,0, -5,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,6,0,0, -5,7,7,7,5,3,5,7,7,7,7,3,0,0,0,0,0,0,0,0,4,7,7,7,7,6,4,6,7,7,7,6,0,0, -5,7,7,7,3,0,0,4,7,7,7,7,3,0,0,0,0,0,0,3,7,7,7,7,6,1,0,2,7,7,7,6,0,0, -5,7,7,7,3,0,0,0,2,6,7,7,7,4,1,0,0,0,4,7,7,7,7,5,0,0,0,1,7,7,7,6,0,0, -5,7,7,7,3,0,0,0,0,1,6,7,7,7,6,3,3,5,7,7,7,7,5,0,0,0,0,0,6,7,7,6,1,0, -5,7,7,7,3,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,4,7,7,7,1,0, -4,7,7,7,3,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,3,7,7,7,1,0, -4,7,7,7,3,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,0,0,0,0,0,0,3,7,7,7,1,0, -4,7,7,7,3,0,0,0,0,0,0,0,0,0,3,7,7,6,2,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, -4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,1,3,1,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, -4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -2,7,7,7,3,0,0,0,0,0,0,0,0,0,1,2,2,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0, -2,7,7,7,3,0,0,0,0,0,0,0,0,0,3,7,7,6,1,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, -1,7,7,7,2,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,2,6,7,4,0,0, -0,2,4,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,4,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,4,4,4,4,4,5,5,5,6,7,7,7,7,7,7,7,7,6,5,5,5,5,5,5,2,0,0,0,0,0, -0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0, -0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0, -0,0,0,0,2,4,5,5,5,5,5,5,4,5,7,7,7,7,7,6,3,2,2,3,3,3,2,2,1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,5,6,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,5,5,3,0,0,0, -3,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0, -4,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,7,7,7,7,7,7,4,0,0, -5,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,5,0,0, -6,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,5,0,0, -5,7,7,7,6,6,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,6,7,7,7,7,5,0,0, -5,7,7,7,4,0,3,6,7,7,7,5,0,0,0,0,0,0,0,1,6,7,7,7,6,2,0,3,7,7,7,5,0,0, -5,7,7,7,3,0,0,1,5,7,7,7,4,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,6,7,7,5,0,0, -5,7,7,7,2,0,0,0,0,4,7,7,7,4,0,0,0,1,6,7,7,7,4,1,0,0,0,0,5,7,7,5,0,0, -5,7,7,7,2,0,0,0,0,0,4,7,7,7,3,0,1,5,7,7,7,4,0,0,0,0,0,0,5,7,7,6,0,0, -5,7,7,7,2,0,0,0,0,0,0,3,7,7,7,6,6,7,7,7,3,0,0,0,0,0,0,0,4,7,7,6,0,0, -5,7,7,7,2,0,0,0,0,0,0,0,3,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,4,7,7,6,0,0, -5,7,7,7,2,0,0,0,0,0,0,0,0,2,6,7,7,7,3,0,0,0,0,0,0,0,0,0,3,7,7,7,0,0, -5,7,7,7,2,0,0,0,0,0,0,0,0,0,2,5,5,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, -5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0, -5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0, -5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0, -4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,0,0, -4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,1,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,0,0, -4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,0,0, -2,6,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,4,0,0, -0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,0,0,0,0,0,0, -0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0, -0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0, -0,0,0,0,1,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,5,7,4,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,4,5,6,7,7,7,7,7,5,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,5,6,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0, -0,0,0,0,0,0,0,0,0,1,3,4,5,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0, -0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0, -0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,6,4,4,6,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,4,7,7,7,7,3,0,0,0,0,3,7,7,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,6,7,7,7,7,2,0,0,0,0,0,0,5,7,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,7,6,1,0,0,0,0,0,0,0,1,6,7,7,3,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,5,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,3,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,0,2,6,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,5,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,4,4,4,4,3,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -1,3,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,4,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,5,5,5,5,5,6,6,6,6,6,6,4,0,0, -6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, -7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -1,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,2,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,3,3,3,3,3,3,3,3,4,4,4,3,4,5,5,3,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,6,6,6,6,6,6,5,5,5,5,5,5,5,2,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,3,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,3,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,6,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,1,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,1,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,2,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,6,6,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,3,4,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,4,7,7,7,7,7,6,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,1,0,0, -0,0,2,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,4,0,0, -0,1,6,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,4,0,0, -0,5,7,7,7,6,3,1,1,3,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0, -2,7,7,7,6,1,0,0,0,0,1,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -2,7,7,7,1,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0, -3,7,7,7,1,0,0,0,0,0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0,0, -4,7,7,7,3,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0, -3,7,7,7,4,0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0, -1,6,7,7,6,2,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0, -0,4,7,7,7,7,4,1,2,2,5,7,7,7,4,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0, -0,0,6,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,2,6,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,2,7,7,7,7,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,5,7,7,7,7,7,5,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,1,3,6,7,7,5,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0,0,2,6,7,7,7,7,7,7,7,5,2,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,2,6,7,7,7,7,7,7,7,7,7,6,1,0,0,0, -0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,1,6,7,7,7,7,6,4,5,7,7,7,7,4,0,0,0, -0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,4,7,7,7,6,2,0,0,0,2,5,7,7,7,1,0,0, -0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,2,7,7,7,4,0,0, -0,0,0,0,1,5,7,7,7,4,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,6,7,7,4,0,0, -0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,0,0,3,7,7,4,0,0, -0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,5,7,7,3,0,0, -0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,1,7,7,7,3,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,3,7,7,7,2,0,0, -0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,3,1,0,1,5,7,7,7,5,0,0,0, -0,4,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,6,6,7,7,7,6,1,0,0,0, -0,2,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,1,0,0,0,0, -0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,5,5,6,7,5,4,3,1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,3,4,5,5,5,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,5,7,7,7,7,7,7,7,7,7,7,5,2,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,4,7,7,7,7,7,7,7,6,5,5,6,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,7,7,4,1,0,0,0,0,0,1,2,5,7,7,7,7,5,1,0,0,0,0,0,0, -0,0,0,0,0,4,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,1,3,6,7,7,7,5,1,0,0,0,0,0, -0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,6,0,0,0,0,0, -0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,3,0,0,0,0, -0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0, -0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,4,0,0,0,0, -0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0, -0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,3,1,0,0,0, -0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,5,0,0,0, -0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0, -0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,3,0,0,0,0, -0,0,0,0,2,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,5,0,0,0,0,0, -0,0,0,0,0,4,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,5,1,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,7,7,4,2,1,0,0,0,0,1,3,7,7,7,7,7,4,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,6,6,7,7,7,7,7,7,6,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,6,7,7,7,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,3,5,6,7,7,7,7,7,7,7,6,5,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,2,4,5,5,5,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,3,1,0,0,0,0,0,0,0,0, -0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0, -0,0,4,7,7,7,7,6,6,6,6,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,4,0,0,0,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,4,6,7,7,7,4,0,0,0,0,0, -0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,6,1,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,4,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0, -0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0,0, -0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0, -0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0, -0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0, -0,0,4,7,7,7,7,4,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,5,7,7,7,5,1,0,0,0,0,0, -0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0, -0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0, -0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0, -0,0,3,7,7,7,7,4,1,1,1,1,1,2,2,1,1,2,6,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,6,1,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,4,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,1,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0, -0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0, -0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0, -0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,1,0,0,0,0,0, -0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0, -0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,1,0,0,0,0, -0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0, -0,0,0,6,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,7,4,0,0,0,0, -0,0,0,1,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,5,6,1,0,0,0,0,0,0,0,0,0,0,0,1,6,7,5,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,1,1,1,0,0,0,0, -0,0,0,0,0,2,7,7,7,7,5,0,0,0,0,0,0,0,0,1,4,7,7,7,7,7,7,7,7,7,6,1,0,0, -0,0,1,2,4,6,7,7,7,7,7,6,5,4,3,3,3,4,5,6,7,7,7,7,7,7,7,7,7,7,7,2,0,0, -0,2,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0, -1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,3,2,1,0,0,0,0, -2,7,7,7,7,7,7,7,7,7,7,7,6,5,5,4,4,3,3,3,4,7,7,7,7,7,2,0,0,0,0,0,0,0, -0,5,7,7,7,7,7,7,7,7,7,3,1,0,0,0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,1,1,4,6,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,5,2,2,1,1,0,0,0, -0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,4,0,0, -0,0,0,0,0,0,4,7,7,7,7,5,3,3,3,4,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,3,1,0,0, -1,3,5,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,2,1,0,0,0,0,0, -2,7,7,7,7,7,7,7,7,7,7,7,7,4,3,2,2,2,3,2,2,6,7,7,7,6,0,0,0,0,0,0,0,0, -1,5,7,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,1,2,3,4,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,5,7,7,5,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,2,7,7,3,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,4,2,0,0,0,0,0,0,0,0,0,0,0,0,2,5,3,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,5,7,7,3,0,0,0,0,0,0,0,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,1,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,4,0,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,6,1,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,7,7,7,4,0,0,0,0,0,6,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,2,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,2,6,7,5,0,4,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,5,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,4,4,3,4,5,5,5,6,5,3,2,3,6,7,7,7,7,4,3,4,5,5,5,5,5,5,5,5,6,5,2,0,0, -4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0, -3,7,7,7,7,7,7,7,7,7,6,6,7,7,7,7,7,7,4,4,5,6,7,7,7,7,7,7,7,7,7,3,0,0, -0,0,1,1,1,2,2,2,1,0,0,0,4,7,7,5,7,7,1,0,0,0,1,1,1,2,2,2,2,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,7,4,0,6,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,3,7,7,1,0,2,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,7,7,6,0,0,0,5,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,6,7,7,5,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,1,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,7,7,7,7,2,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,6,7,7,7,6,0,0,0,0,0,0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,7,3,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,5,7,7,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,1,5,6,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,4,5,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,1,2,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,7,7,7,6,5,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,1,4,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,3,5,5,6,7,7,7,7,7,7,7,6,6,6,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,4,4,4,4,4,4,4,4,4,4,4,4,4,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,1,0,0,0,0, -0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0, -0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0, -0,0,0,1,2,4,6,7,7,7,7,5,3,3,3,3,3,3,3,3,5,7,7,7,7,7,4,3,2,0,0,0,0,0, -0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,1,1,1,2,5,7,7,7,7,5,2,1,1,0,0,0,0,1,3,7,7,7,7,6,2,2,2,0,0,0,0,0, -0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0, -0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0, -0,0,1,2,3,3,3,4,4,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,4,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0, -0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0, -0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0, -0,0,0,2,4,4,7,7,7,7,6,2,2,4,7,7,7,7,7,4,3,5,7,7,7,7,6,4,2,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,3,0,0,0,6,7,7,7,3,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,2,0,0,0,5,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,2,0,0,0,4,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,2,0,0,0,4,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,2,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,2,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,2,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,7,7,7,3,0,0,0,3,7,7,7,2,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,6,7,7,3,0,0,0,3,7,7,7,2,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,6,7,7,3,0,0,0,3,7,7,7,3,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,3,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,3,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,3,0,0,0,2,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,3,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,6,7,7,3,0,0,0,2,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,3,0,0,0,2,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,3,0,0,0,2,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,3,0,0,0,2,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,3,0,0,0,1,7,7,7,4,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,3,0,0,0,1,7,7,7,5,0,0,0,1,6,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,3,0,0,0,1,7,7,7,5,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,4,0,0,0,1,7,7,7,5,0,0,0,0,6,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,4,0,0,0,1,7,7,7,6,0,0,0,0,6,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,4,0,0,0,1,7,7,7,6,0,0,0,0,6,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,4,0,0,0,1,7,7,7,6,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,4,0,0,0,1,7,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,3,7,7,4,0,0,0,0,6,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,3,7,7,4,0,0,0,0,6,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,3,7,7,4,0,0,0,0,6,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,3,7,7,5,0,0,0,0,7,7,7,7,1,0,0,0,5,7,7,3,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,5,7,7,6,1,0,0,2,7,7,7,7,3,0,0,0,6,7,7,4,0,0,0,0,0,0,0, -0,0,0,0,0,1,4,7,7,7,7,6,4,5,6,7,7,7,7,6,3,3,4,7,7,7,7,5,3,1,0,0,0,0, -0,0,1,5,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0, -0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0, -0,0,1,4,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,5,4,0,0,0,0, -0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -2,6,7,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,5,5,1,0,0, -5,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,7,7,7,4,0,0, -5,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,5,0,0, -5,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,5,0,0, -5,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,7,7,7,7,6,0,0, -5,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,1,0, -5,7,7,7,5,3,6,7,7,7,7,5,1,0,0,0,0,0,0,0,4,7,7,7,7,6,3,5,7,7,7,7,2,0, -6,7,7,7,1,0,0,3,7,7,7,7,6,2,0,0,0,0,0,4,7,7,7,7,5,1,0,1,7,7,7,7,1,0, -6,7,7,6,0,0,0,0,2,6,7,7,7,7,3,0,0,0,4,7,7,7,7,5,0,0,0,0,5,7,7,7,1,0, -5,7,7,6,0,0,0,0,0,1,5,7,7,7,7,6,5,6,7,7,7,7,4,0,0,0,0,0,3,7,7,7,1,0, -5,7,7,7,1,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,3,7,7,7,1,0, -5,7,7,7,1,0,0,0,0,0,0,0,4,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,2,7,7,7,1,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,3,7,7,7,7,7,3,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,2,6,7,6,1,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, -3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, -3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0, -2,7,7,7,1,0,0,0,0,0,0,0,0,0,3,7,7,4,0,0,0,0,0,0,0,0,0,0,1,6,7,7,1,0, -2,7,7,7,1,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,4,7,4,0,0, -1,4,5,3,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,3,4,4,5,5,5,5,5,5,6,7,7,7,7,7,6,6,5,5,5,5,5,5,5,3,0,0,0,0,0, -0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0,0, -0,0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,6,6,5,3,0,0,0,0,0, -0,0,0,0,0,1,4,4,4,4,4,5,5,6,7,7,7,7,7,6,3,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,4,5,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0, -4,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,7,7,4,0,0, -5,7,7,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,5,0,0, -5,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,5,0,0, -6,7,7,7,7,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,6,0,0, -6,7,7,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,6,0,0, -6,7,7,7,6,4,5,7,7,7,6,1,0,0,0,0,0,0,0,0,3,7,7,7,7,5,2,5,7,7,7,6,0,0, -6,7,7,7,2,0,1,4,7,7,7,6,1,0,0,0,0,0,0,3,7,7,7,7,4,0,0,2,7,7,7,6,0,0, -6,7,7,7,1,0,0,0,3,6,7,7,6,1,0,0,0,0,4,7,7,7,7,4,0,0,0,0,5,7,7,6,0,0, -6,7,7,7,1,0,0,0,0,1,6,7,7,7,3,1,2,5,7,7,7,7,3,0,0,0,0,0,3,7,7,6,0,0, -6,7,7,7,1,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,5,2,0,0,0,0,0,0,4,7,7,6,0,0, -5,7,7,7,1,0,0,0,0,0,0,1,6,7,7,7,7,7,7,6,1,0,0,0,0,0,0,0,4,7,7,6,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,1,4,7,7,7,7,5,1,0,0,0,0,0,0,0,0,5,7,7,6,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,3,7,6,3,0,0,0,0,0,0,0,0,0,0,5,7,7,6,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,4,7,7,6,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,2,0, -4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,0, -3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,6,0,0, -2,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,5,0,0, -2,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,2,0,0, -0,2,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, -0,0,0,0,4,5,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,4,1,0,0,0,0,0, -0,0,0,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,0,0,0,0,0, -0,0,0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,4,0,0,0,0,0,0, -0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,4,7,7,7,7,7,7,7,7,7,7,7,6,6,6,5,5,5,5,5,5,5,5,5,5,6,6,3,0,0,0,0, -0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0, -0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0, -0,0,0,1,1,1,1,1,2,2,2,2,3,7,7,7,7,7,6,3,2,2,1,1,1,1,1,1,1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,2,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,5,1,0,0,0,0,0,0, -0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,4,0,0,0,0,0,0,0, -0,0,1,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,0,3,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,4,0,0,0,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,4,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,3,0,0,0,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,3,0,0,0,0,0,1,6,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,4,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,1,5,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,1,5,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,7,2,2,6,7,7,7,7,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,7,7,7,7,7,7,6,2,5,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,7,7,7,7,6,1,0,1,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,7,7,7,6,1,0,0,0,1,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,7,7,6,2,0,0,0,0,0,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,7,6,1,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,7,2,0,0,0,0,0,0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,6,1,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,6,1,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,0,0,0,0,0,0,0,0, -0,0,1,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,0,0,0,0, -0,0,0,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0,0,0,0, -0,0,0,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,2,0,0,0,0,0,0, -0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,6,1,0,0,0,0,0, -0,0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,0,0,0, -0,0,0,5,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,0, -0,0,0,5,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,5,0,0,0,0, -0,0,0,4,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,5,0,0,0,0, -0,0,0,3,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,2,0,0,0,0, -0,0,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,0,0,0,0, -0,0,1,3,4,4,4,5,5,5,5,5,5,5,5,5,5,5,4,4,3,4,5,6,6,7,7,7,7,7,2,0,0,0, -0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0, -0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0, -0,3,7,7,7,7,6,4,3,3,3,3,3,3,4,4,4,4,4,4,4,5,5,5,5,5,6,5,5,3,1,0,0,0, -0,3,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,6,7,7,7,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,6,7,7,7,7,7,6,6,6,5,5,5,6,6,6,6,6,6,6,6,6,3,0,0,0,0,0,0,0,0,0,0, -0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0,0, -0,0,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0, -0,0,6,7,7,7,6,4,3,4,4,4,4,5,6,5,5,4,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,5,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,5,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,2,0,0,0, -0,0,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0, -0,0,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,0, -0,0,0,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,2,0,0,0, -0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,3,3,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -2,5,5,5,5,5,5,4,4,4,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,5,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,5,1,0,0,0,0,0,0,0,2,2,0,0,0, -3,7,7,7,5,1,0,1,1,1,1,1,0,0,0,0,0,0,4,7,7,6,1,0,0,0,0,1,5,7,6,1,0,0, -3,7,7,7,7,7,6,7,7,7,7,7,4,1,0,0,0,0,4,7,7,7,3,0,0,0,0,3,7,7,7,1,0,0, -3,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,0,0,1,6,7,7,6,1,0,0,1,6,7,7,5,0,0,0, -2,7,7,7,7,6,5,5,5,6,6,7,6,3,0,0,0,0,0,3,7,7,7,3,0,0,4,7,7,7,2,0,0,0, -2,7,7,7,4,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,5,7,7,5,0,1,6,7,7,4,0,0,0,0, -2,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,1,2,7,7,7,2,0,0,0,0, -3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,5,6,7,7,4,0,0,0,0,0, -3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,6,0,0,0,0,0,0, -3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,3,0,0,0,0,0,0, -3,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,1,0,0,0,0,0,0, -3,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,2,0,0,0,0,0,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,4,0,0,0,0,0,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,6,1,0,0,0,0,0, -4,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,7,5,0,0,0,0,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,4,7,7,7,2,0,0,0,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,1,0,5,7,7,5,0,0,0,0, -4,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,5,0,0,1,6,7,7,3,0,0,0, -4,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0,3,7,7,6,1,0,0, -4,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,4,0,0,0,0,0,5,7,7,3,0,0, -4,7,7,7,6,4,3,2,2,1,1,1,1,0,0,0,0,0,2,7,7,7,2,0,0,0,0,0,1,7,7,5,0,0, -3,7,7,7,7,7,7,7,7,7,7,7,7,6,4,1,0,0,5,7,7,7,1,0,0,0,0,0,0,4,7,5,0,0, -1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,0,0,4,7,7,4,0,0,0,0,0,0,0,1,5,3,0,0, -0,3,6,7,7,7,7,7,7,7,7,7,7,7,7,4,0,0,1,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,4,3,3,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,3,5,6,7,7,7,7,7,7,7,7,4,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,6,7,7,7,7,7,7,7,7,7,7,7,7,6,3,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,7,7,7,7,7,6,3,2,2,2,2,2,4,5,6,7,7,7,7,6,2,0,0,0,0,0,0, -0,0,0,0,0,1,6,7,7,7,6,3,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,6,0,0,0,0,0,0, -0,0,0,0,1,5,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,7,4,0,0,0,0,0, -0,0,0,0,4,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,7,2,0,0,0,0, -0,0,0,2,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,7,7,3,0,0,0,0, -0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,7,2,0,0,0,0, -0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0, -0,0,0,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,5,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,4,7,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,2,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,6,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,1,0,0,0, -0,0,0,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,7,7,4,0,0,0, -0,0,0,0,3,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,7,7,7,7,2,0,0,0, -0,0,0,0,0,6,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,4,0,0,0,0, -0,0,0,0,0,1,6,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,5,0,0,0,0,0, -0,0,0,0,0,0,4,7,7,7,6,2,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,6,1,0,0,0,0,0, -0,0,0,0,0,0,0,4,7,7,7,7,5,2,0,0,0,0,0,0,1,2,5,7,7,7,6,2,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,7,7,7,7,7,5,4,3,2,2,4,6,7,7,7,7,5,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,4,6,7,7,7,7,7,7,7,7,5,4,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,4,4,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,5,5,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0, -0,0,6,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,7,7,3,0,0,0,0, -0,0,6,7,7,7,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,4,0,0,0,0, -0,1,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,7,7,5,0,0,0,0, -0,1,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,6,0,0,0,0, -0,1,7,7,7,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,6,0,0,0,0, -0,1,7,7,7,7,7,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,7,7,6,0,0,0,0, -0,1,7,7,7,7,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,1,6,7,7,7,7,7,6,0,0,0,0, -0,1,7,7,7,7,7,7,7,7,3,0,0,0,0,0,0,0,0,0,0,0,5,7,7,7,7,7,7,6,1,0,0,0, -0,1,7,7,7,6,5,7,7,7,5,0,0,0,0,0,0,0,0,0,0,1,7,7,7,7,7,7,7,7,1,0,0,0, -0,1,7,7,7,4,0,5,7,7,7,3,0,0,0,0,0,0,0,0,0,4,7,7,7,5,5,7,7,7,1,0,0,0, -0,1,7,7,7,5,0,2,7,7,7,5,0,0,0,0,0,0,0,0,1,6,7,7,7,1,3,7,7,7,1,0,0,0, -0,1,7,7,7,5,0,0,6,7,7,7,2,0,0,0,0,0,0,0,5,7,7,7,4,0,4,7,7,7,1,0,0,0, -0,1,7,7,7,5,0,0,4,7,7,7,3,0,0,0,0,0,0,1,7,7,7,7,1,0,4,7,7,7,1,0,0,0, -0,1,7,7,7,5,0,0,1,7,7,7,5,0,0,0,0,0,0,3,7,7,7,5,0,0,4,7,7,7,2,0,0,0, -0,1,7,7,7,5,0,0,0,5,7,7,7,1,0,0,0,0,0,6,7,7,7,2,0,0,4,7,7,7,2,0,0,0, -0,1,7,7,7,6,0,0,0,2,7,7,7,4,0,0,0,0,3,7,7,7,5,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,6,0,0,0,0,6,7,7,6,0,0,0,0,6,7,7,7,2,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,6,0,0,0,0,3,7,7,7,1,0,0,2,7,7,7,5,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,6,1,0,0,0,1,7,7,7,3,0,0,4,7,7,7,3,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,7,1,0,0,0,0,4,7,7,5,0,0,6,7,7,6,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,7,1,0,0,0,0,2,7,7,7,2,1,7,7,7,2,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,6,7,7,7,1,0,0,0,0,0,6,7,7,5,5,7,7,6,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,0,6,7,7,6,1,0,0,0,0,0,4,7,7,7,7,7,7,4,0,0,0,0,0,0,4,7,7,7,2,0,0,0, -0,0,6,7,7,6,1,0,0,0,0,0,2,7,7,7,7,7,7,2,0,0,0,0,0,0,4,7,7,7,2,0,0,0, -0,0,6,7,7,6,0,0,0,0,0,0,0,5,7,7,7,7,5,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0, -0,0,6,7,7,6,0,0,0,0,0,0,0,1,6,7,7,7,1,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0, -0,0,6,7,7,6,0,0,0,0,0,0,0,0,2,6,7,4,0,0,0,0,0,0,0,0,4,7,7,7,1,0,0,0, -0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0, -0,0,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0, -0,1,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,4,0,0,0, -0,1,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,7,7,7,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,1,6,7,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,3,0,0,0, -0,0,6,7,7,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,7,7,2,0,0,0, -0,0,5,7,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,0,0,0,0, -0,0,4,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,7,5,0,0,0,0, -0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - -void busicom_state::video_start() -{ -} - -UINT32 busicom_state::screen_update_busicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int y, x, b, j; - //34x44 - for (y = 0; y < 11; y++) - { - UINT8 col = 8 * m_printer_line_color[y]; - for (x = 0; x < 17; x++) - { - UINT8 chr = m_printer_line[y][x]; - for (j = 0; j < 44; j++) { - for (b = 0; b < 34; b++) - { - bitmap.pix16((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; - } - for (b = 34; b < 40; b++) - { - bitmap.pix16((y*44)+j, x*40+b) = 0; - } - - } - } - } - return 0; -} -static const UINT8 color[] = { 0xFF,0xDB,0xB7,0x92,0x6E,0x49,0x25,0x00 }; - -static const UINT8 color_red[] = { 0xb0,0xb5,0xc0,0xc5,0xd0,0xd5,0xdf }; - -PALETTE_INIT_MEMBER(busicom_state, busicom) -{ - int i; - for(i=0;i<8;i++) { - m_palette->set_pen_color( i, rgb_t(color[i],color[i],color[i]) ); - } - m_palette->set_pen_color( 8, rgb_t(0xff,0xff,0xff) ); - for(i=0;i<7;i++) { - m_palette->set_pen_color( i+9, rgb_t(color_red[i],0x00,0x00) ); - } -} diff --git a/src/mess/video/cgc7900.c b/src/mess/video/cgc7900.c deleted file mode 100644 index 0eb1cda1dd6..00000000000 --- a/src/mess/video/cgc7900.c +++ /dev/null @@ -1,237 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "emu.h" -#include "includes/cgc7900.h" - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -#define OVERLAY_CUR BIT(cell, 31) /* places a cursor in the cell if SET */ -#define OVERLAY_BLK BIT(cell, 30) /* blinks the foreground character in the cell if SET */ -#define OVERLAY_VF BIT(cell, 28) /* makes the foreground visible if SET (else transparent) */ -#define OVERLAY_VB BIT(cell, 27) /* makes the background visible if SET (else transparent) */ -#define OVERLAY_PL BIT(cell, 24) /* uses bits 0-7 as PLOT DOT descriptor if SET (else ASCII) */ -#define OVERLAY_BR BIT(cell, 18) /* turns on Red in background if SET */ -#define OVERLAY_BG BIT(cell, 17) /* turns on Green in background if SET */ -#define OVERLAY_BB BIT(cell, 16) /* turns on Blue in background if SET */ -#define OVERLAY_FR BIT(cell, 10) /* turns on Red in foreground if SET */ -#define OVERLAY_FG BIT(cell, 9) /* turns on Green in foreground if SET */ -#define OVERLAY_FB BIT(cell, 8) /* turns on Blue in background if SET */ -#define OVERLAY_DATA (cell & 0xff) /* ASCII or Plot Dot character */ - -#define IMAGE_SELECT BIT(m_roll_overlay[0], 13) -#define OVERLAY_CURSOR_BLINK BIT(m_roll_overlay[0], 12) -#define OVERLAY_CHARACTER_BLINK BIT(m_roll_overlay[0], 11) - -PALETTE_INIT_MEMBER(cgc7900_state, cgc7900) -{ - palette.set_pen_color(0, rgb_t::black); - palette.set_pen_color(1, rgb_t(0x00, 0x00, 0xff)); - palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); - palette.set_pen_color(3, rgb_t(0x00, 0xff, 0xff)); - palette.set_pen_color(4, rgb_t(0xff, 0x00, 0x00)); - palette.set_pen_color(5, rgb_t(0xff, 0x00, 0xff)); - palette.set_pen_color(6, rgb_t(0xff, 0xff, 0x00)); - palette.set_pen_color(7, rgb_t::white); -} - -/*************************************************************************** - READ/WRITE HANDLERS -***************************************************************************/ - -/*------------------------------------------------- - cgc7900_z_mode_r - Z mode read --------------------------------------------------*/ - -READ16_MEMBER( cgc7900_state::z_mode_r ) -{ - return 0; -} - -/*------------------------------------------------- - cgc7900_z_mode_w - Z mode write --------------------------------------------------*/ - -WRITE16_MEMBER( cgc7900_state::z_mode_w ) -{ -} - -/*------------------------------------------------- - cgc7900_color_status_w - color status write --------------------------------------------------*/ - -WRITE16_MEMBER( cgc7900_state::color_status_w ) -{ -} - -/*------------------------------------------------- - cgc7900_sync_r - sync information read --------------------------------------------------*/ - -READ16_MEMBER( cgc7900_state::sync_r ) -{ - /* - - bit signal description - - 0 _VERT vertical retrace (0=vblank) - 1 interlace (1=first field, 0=second field) - 2 _HG horizontal retrace (0=hblank) - 3 1 - 4 1 - 5 1 - 6 1 - 7 1 - 8 1 - 9 1 - 10 1 - 11 1 - 12 1 - 13 1 - 14 1 - 15 1 - - */ - - return 0xffff; -} - -/*************************************************************************** - VIDEO -***************************************************************************/ - -/*------------------------------------------------- - update_clut - update color lookup table --------------------------------------------------*/ - -void cgc7900_state::update_clut() -{ - for (int i = 0; i < 256; i++) - { - UINT16 addr = i * 2; - UINT32 data = (m_clut_ram[addr + 1] << 16) | m_clut_ram[addr]; - UINT8 b = data & 0xff; - UINT8 g = (data >> 8) & 0xff; - UINT8 r = (data >> 16) & 0xff; - - m_clut[i] = rgb_t(r, g, b); - } -} - -/*------------------------------------------------- - draw_bitmap - draw bitmap image --------------------------------------------------*/ - -void cgc7900_state::draw_bitmap(screen_device *screen, bitmap_rgb32 &bitmap) -{ -} - -/*------------------------------------------------- - draw_overlay - draw text overlay --------------------------------------------------*/ - -void cgc7900_state::draw_overlay(screen_device *screen, bitmap_rgb32 &bitmap) -{ - const pen_t *pen = m_palette->pens(); - for (int y = 0; y < 768; y++) - { - int sy = y / 8; - int line = y % 8; - - for (int sx = 0; sx < 85; sx++) - { - UINT16 addr = (sy * 170) + (sx * 2); - UINT32 cell = (m_overlay_ram[addr] << 16) | m_overlay_ram[addr + 1]; - UINT8 data = m_char_rom->base()[(OVERLAY_DATA << 3) | line]; - int fg = (cell >> 8) & 0x07; - int bg = (cell >> 16) & 0x07; - - for (int x = 0; x < 8; x++) - { - if (OVERLAY_CUR) - { - if (!OVERLAY_CURSOR_BLINK || m_blink) - { - bitmap.pix32(y, (sx * 8) + x) = pen[7]; - } - } - else - { - if (BIT(data, x) && (!OVERLAY_CHARACTER_BLINK || m_blink)) - { - if (OVERLAY_VF) bitmap.pix32(y, (sx * 8) + x) = pen[fg]; - } - else - { - if (OVERLAY_VB) bitmap.pix32(y, (sx * 8) + x) = pen[bg]; - } - } - } - } - } -} - -/*------------------------------------------------- - TIMER_DEVICE_CALLBACK_MEMBER( blink_tick ) --------------------------------------------------*/ - -TIMER_DEVICE_CALLBACK_MEMBER(cgc7900_state::blink_tick) -{ - m_blink = !m_blink; -} - -UINT32 cgc7900_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - update_clut(); - draw_bitmap(&screen, bitmap); - draw_overlay(&screen, bitmap); - - return 0; -} - -/*------------------------------------------------- - gfx_layout cgc7900_charlayout --------------------------------------------------*/ - -static const gfx_layout cgc7900_charlayout = -{ - 8,8, - RGN_FRAC(1,1), - 1, - { RGN_FRAC(0,1) }, - { STEP8(7,-1) }, - { STEP8(0,8) }, - 8*8 -}; - -/*------------------------------------------------- - GFXDECODE( cgc7900 ) --------------------------------------------------*/ - -static GFXDECODE_START( cgc7900 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, cgc7900_charlayout, 0, 1 ) -GFXDECODE_END - -/*************************************************************************** - MACHINE DRIVERS -***************************************************************************/ - -/*------------------------------------------------- - MACHINE_DRIVER( cgc7900_video ) --------------------------------------------------*/ - -MACHINE_CONFIG_FRAGMENT( cgc7900_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DRIVER(cgc7900_state, screen_update) - MCFG_SCREEN_SIZE(1024, 768) - MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", cgc7900) - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(cgc7900_state, cgc7900) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("blink", cgc7900_state, blink_tick, attotime::from_hz(XTAL_28_48MHz/7500000)) -MACHINE_CONFIG_END diff --git a/src/mess/video/channelf.c b/src/mess/video/channelf.c deleted file mode 100644 index 03a5310e934..00000000000 --- a/src/mess/video/channelf.c +++ /dev/null @@ -1,71 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Frank Palazzolo, Sean Riddle -#include "includes/channelf.h" - -static const rgb_t channelf_palette[] = -{ - rgb_t(0x10, 0x10, 0x10), /* black */ - rgb_t(0xfd, 0xfd, 0xfd), /* white */ - rgb_t(0xff, 0x31, 0x53), /* red */ - rgb_t(0x02, 0xcc, 0x5d), /* green */ - rgb_t(0x4b, 0x3f, 0xf3), /* blue */ - rgb_t(0xe0, 0xe0, 0xe0), /* ltgray */ - rgb_t(0x91, 0xff, 0xa6), /* ltgreen */ - rgb_t(0xce, 0xd0, 0xff) /* ltblue */ -}; - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define LTGRAY 5 -#define LTGREEN 6 -#define LTBLUE 7 - -static const UINT16 colormap[] = { - BLACK, WHITE, WHITE, WHITE, - LTBLUE, BLUE, RED, GREEN, - LTGRAY, BLUE, RED, GREEN, - LTGREEN, BLUE, RED, GREEN, -}; - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(channelf_state, channelf) -{ - palette.set_pen_colors(0, channelf_palette, ARRAY_LENGTH(channelf_palette)); -} - -void channelf_state::video_start() -{ - m_p_videoram = memregion("vram")->base(); -} - -int channelf_state::recalc_palette_offset(int reg1, int reg2) -{ - /* Note: This is based on the decoding they used to */ - /* determine which palette this line is using */ - - return ((reg2&0x2)|(reg1>>1)) << 2; -} - -UINT32 channelf_state::screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,col; - UINT16 ma=0,x; - int palette_offset; - - for(y = 0; y < 64; y++ ) - { - UINT16 *p = &bitmap.pix16(y); - palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3); - - for (x = ma; x < ma + 128; x++) - { - col = palette_offset+(m_p_videoram[x|(y<<7)]&3); - *p++ = colormap[col]; - } - ma+=128; - } - return 0; -} diff --git a/src/mess/video/comquest.c b/src/mess/video/comquest.c deleted file mode 100644 index cbfb1014fe7..00000000000 --- a/src/mess/video/comquest.c +++ /dev/null @@ -1,24 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#include "emu.h" - -#include "includes/comquest.h" - -void comquest_state::video_start() -{ -} - -UINT32 comquest_state::screen_update_comquest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, j; - - for (y=0; y<128;y++) { - for (x=0, j=0; j<8;j++,x+=8*4) { -#if 0 - m_gfxdecode->gfx(0)->opaque(bitmap,0, state->m_data[y][j],0, - 0,0,x,y); -#endif - } - } - return 0; -} diff --git a/src/mess/video/comx35.c b/src/mess/video/comx35.c deleted file mode 100644 index 4c214006776..00000000000 --- a/src/mess/video/comx35.c +++ /dev/null @@ -1,126 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "emu.h" -#include "rendlay.h" -#include "includes/comx35.h" -#include "cpu/cosmac/cosmac.h" -#include "sound/cdp1869.h" -#include "sound/wave.h" -#include "video/mc6845.h" - -WRITE8_MEMBER( comx35_state::cdp1869_w ) -{ - UINT16 ma = m_maincpu->get_memory_address(); - - switch (offset) - { - case 3: - m_vis->out3_w(space, ma, data); - break; - - case 4: - m_vis->out4_w(space, ma, data); - break; - - case 5: - m_vis->out5_w(space, ma, data); - break; - - case 6: - m_vis->out6_w(space, ma, data); - break; - - case 7: - m_vis->out7_w(space, ma, data); - break; - } -} - -/* CDP1869 */ - -static ADDRESS_MAP_START( cdp1869_page_ram, AS_0, 8, driver_device ) - AM_RANGE(0x000, 0x7ff) AM_RAM -ADDRESS_MAP_END - -CDP1869_CHAR_RAM_READ_MEMBER( comx35_state::comx35_charram_r ) -{ - UINT8 column = pmd & 0x7f; - UINT16 charaddr = (column << 4) | cma; - - return m_char_ram[charaddr]; -} - -CDP1869_CHAR_RAM_WRITE_MEMBER( comx35_state::comx35_charram_w ) -{ - UINT8 column = pmd & 0x7f; - UINT16 charaddr = (column << 4) | cma; - - m_char_ram[charaddr] = data; -} - -CDP1869_PCB_READ_MEMBER( comx35_state::comx35_pcb_r ) -{ - return BIT(pmd, 7); -} - -WRITE_LINE_MEMBER( comx35_state::prd_w ) -{ - if ((m_prd == CLEAR_LINE) && (state == ASSERT_LINE)) - { - m_cr1 = m_iden ? CLEAR_LINE : ASSERT_LINE; - check_interrupt(); - } - - m_prd = state; - - m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF1, state); -} - - -void comx35_state::video_start() -{ - // allocate memory - m_char_ram.allocate(COMX35_CHARRAM_SIZE); -} - -/* Machine Drivers */ - -MACHINE_CONFIG_FRAGMENT( comx35_pal_video ) - MCFG_CDP1869_SCREEN_PAL_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_CDP1869_ADD(CDP1869_TAG, CDP1869_DOT_CLK_PAL, cdp1869_page_ram) - MCFG_CDP1869_COLOR_CLOCK(CDP1869_COLOR_CLK_PAL) - MCFG_CDP1869_CHAR_PCB_READ_OWNER(comx35_state, comx35_pcb_r) - MCFG_CDP1869_CHAR_RAM_READ_OWNER(comx35_state, comx35_charram_r) - MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(comx35_state, comx35_charram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) - MCFG_CDP1869_PRD_CALLBACK(WRITELINE(comx35_state, prd_w)) - MCFG_CDP1869_SET_SCREEN(SCREEN_TAG) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( comx35_ntsc_video ) - MCFG_CDP1869_SCREEN_NTSC_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_NTSC) - - /* sound hardware */ - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_CDP1869_ADD(CDP1869_TAG, CDP1869_DOT_CLK_NTSC, cdp1869_page_ram) - MCFG_CDP1869_COLOR_CLOCK(CDP1869_COLOR_CLK_NTSC) - MCFG_CDP1869_CHAR_PCB_READ_OWNER(comx35_state, comx35_pcb_r) - MCFG_CDP1869_CHAR_RAM_READ_OWNER(comx35_state, comx35_charram_r) - MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(comx35_state, comx35_charram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(GND) - MCFG_CDP1869_PRD_CALLBACK(WRITELINE(comx35_state, prd_w)) - MCFG_CDP1869_SET_SCREEN(SCREEN_TAG) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END diff --git a/src/mess/video/crt.c b/src/mess/video/crt.c deleted file mode 100644 index d075600baf7..00000000000 --- a/src/mess/video/crt.c +++ /dev/null @@ -1,184 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - video/crt.c - - CRT video emulation for TX-0 and PDP-1. - - -Theory of operation: - - What makes such CRT devices so odd is that there is no video processor, no - scan logic, no refresh logic. The beam position and intensity is - controlled by the program completely: in order to draw an object, the - program must direct the beam to each point of the object, and in order to - refresh it, the program must redraw the object periodically. - - Since the refresh rates are highly variable (completely controlled by the - program), I need to simulate CRT remanence: the intensity of each pixel on - display decreases regularly. In order to keep this efficient, I keep a - list of non-black pixels, and only process these pixels on each refresh. - In order to improve efficiency further, I keep a distinct list for each - line of the display: I have found that it improves drawing speed slightly - (probably because it improves the cache hit rate). - - - Raphael Nabet 2002-2004 - Based on earlier work by Chris Salomon -*/ - -#include "emu.h" -#include "video/crt.h" - - -// special value that tells that the node is not in list -enum -{ - intensity_pixel_not_in_list = -1 -}; - - -// device type definition -const device_type CRT = &device_creator; - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// crt_device - constructor -//------------------------------------------------- - -crt_device::crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, CRT, "CRT Video", tag, owner, clock, "crt", __FILE__), - m_list(NULL), - m_list_head(NULL), - m_decay_counter(0), - m_num_intensity_levels(0), - m_window_offset_x(0), - m_window_offset_y(0), - m_window_width(0), - m_window_height(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void crt_device::device_start() -{ - /* alloc the arrays */ - m_list = auto_alloc_array(machine(), crt_point, m_window_width * m_window_height); - m_list_head = auto_alloc_array(machine(), int, m_window_height); - - /* fill with black and set up list as empty */ - for (int i = 0; i < (m_window_width * m_window_height); i++) - m_list[i].intensity = intensity_pixel_not_in_list; - - for (int i = 0; i < m_window_height; i++) - m_list_head[i] = -1; - - m_decay_counter = 0; -} - - -// -// crt_plot -// -// schedule a pixel to be plotted -// -void crt_device::plot(int x, int y) -{ - crt_point *node; - int list_index; - - /* compute pixel coordinates */ - if (x<0) x=0; - if (y<0) y=0; - if ((x>(m_window_width-1)) || ((y>m_window_height-1))) - return; - y = (m_window_height-1) - y; - - /* find entry in list */ - list_index = x + y*m_window_width; - - node = &m_list[list_index]; - - if (node->intensity == intensity_pixel_not_in_list) - { /* insert node in list if it is not in it */ - node->next = m_list_head[y]; - m_list_head[y] = list_index; - } - /* set intensity */ - node->intensity = m_num_intensity_levels; -} - - -// -// crt_eof -// -// keep track of time -// -void crt_device::eof() -{ - m_decay_counter++; -} - - -// -// crt_update -// -// update the bitmap -// -void crt_device::update(bitmap_ind16 &bitmap) -{ - int i, p_i; - int y; - - //if (m_decay_counter) - { - /* some time has elapsed: let's update the screen */ - for (y=0; yintensity == m_num_intensity_levels) - /* new pixel: set to max intensity */ - node->intensity = m_num_intensity_levels-1; - else - { - /* otherwise, apply intensity decay */ - node->intensity -= m_decay_counter; - if (node->intensity < 0) - node->intensity = 0; - } - - /* draw pixel on screen */ - //plot_pixel(bitmap, x, y+m_window_offset_y, node->intensity); - line[x] = node->intensity; - - if (node->intensity != 0) - p_i = i; /* current node will be next iteration's previous node */ - else - { /* delete current node */ - node->intensity = intensity_pixel_not_in_list; - if (p_i != -1) - m_list[p_i].next = node->next; - else - m_list_head[y] = node->next; - } - } - } - - m_decay_counter = 0; - } -} diff --git a/src/mess/video/crt.h b/src/mess/video/crt.h deleted file mode 100644 index cb0767ad0d9..00000000000 --- a/src/mess/video/crt.h +++ /dev/null @@ -1,93 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/************************************************************************* - - video/crt.h - - CRT video emulation for TX-0 and PDP-1 - -*************************************************************************/ - -#ifndef __CRT_H__ -#define __CRT_H__ - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CRT_NUM_LEVELS(_lev) \ - crt_device::set_num_levels(*device, _lev); - -#define MCFG_CRT_OFFSETS(_xoffs, _yoffs) \ - crt_device::set_offsets(*device, _xoffs, _yoffs); - -#define MCFG_CRT_SIZE(_width, _height) \ - crt_device::set_size(*device, _width, _height); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -struct crt_point -{ - crt_point() : - intensity(0), - next(0) {} - - int intensity; /* current intensity of the pixel */ - /* a node is not in the list when (intensity == -1) */ - int next; /* index of next pixel in list */ -}; - -// ======================> crt_device - -class crt_device : public device_t -{ -public: - crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~crt_device() { } - - static void set_num_levels(device_t &device, int levels) { downcast(device).m_num_intensity_levels = levels; } - static void set_offsets(device_t &device, int x_offset, int y_offset) - { - crt_device &dev = downcast(device); - dev.m_window_offset_x = x_offset; - dev.m_window_offset_y = y_offset; - } - static void set_size(device_t &device, int width, int height) - { - crt_device &dev = downcast(device); - dev.m_window_width = width; - dev.m_window_height = height; - } - - void plot(int x, int y); - void eof(); - void update(bitmap_ind16 &bitmap); - -protected: - // device-level overrides - virtual void device_start(); - -private: - crt_point *m_list; /* array of (crt_window_width*crt_window_height) point */ - int *m_list_head; /* head of the list of lit pixels (index in the array) */ - /* keep a separate list for each display line (makes the video code slightly faster) */ - - int m_decay_counter; /* incremented each frame (tells for how many frames the CRT has decayed between two screen refresh) */ - - /* CRT window */ - int m_num_intensity_levels; - int m_window_offset_x; - int m_window_offset_y; - int m_window_width; - int m_window_height; -}; - -extern const device_type CRT; - - - -#endif /* CRT_H_ */ diff --git a/src/mess/video/dai.c b/src/mess/video/dai.c deleted file mode 100644 index a0d36a8097c..00000000000 --- a/src/mess/video/dai.c +++ /dev/null @@ -1,764 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha, Nathan Woods -/*************************************************************************** - - dai.c - - Functions to emulate the video hardware of DAI. - - Krzysztof Strzecha - - All video modes are emulated but not fully tested yet. - dai_state::screen_update_dai() function needs strong cleanup and optimalisation. - - -***************************************************************************/ - -#include "emu.h" -#include "includes/dai.h" - -#define DEBUG_DAI_VIDEO 0 - -#define LOG_DAI_VIDEO_LINE(_mode, _unit, _resolution, _repeat, _scan) do { if (DEBUG_DAI_VIDEO) logerror ("Mode: %02x, Unit: %02x, Resolution: %02x, Repeat: %d, Current line: %d\n", _mode, _unit, _resolution, _repeat, _scan); } while (0) - -const unsigned char dai_palette[16*3] = -{ - 0x00, 0x00, 0x00, /* 0 Black */ - 0x00, 0x00, 0x8b, /* 1 Dark Blue */ - 0xb1, 0x00, 0x95, /* 2 Purple Red */ - 0xff, 0x00, 0x00, /* 3 Red */ - 0x75, 0x2e, 0x50, /* 4 Purple Brown */ - 0x00, 0xb2, 0x38, /* 5 Emerald Green */ - 0x98, 0x62, 0x00, /* 6 Kakhi Brown */ - 0xae, 0x7a, 0x00, /* 7 Mustard Brown */ - 0x89, 0x89, 0x89, /* 8 Grey */ - 0xa1, 0x6f, 0xff, /* 9 Middle Blue */ - 0xff, 0xa5, 0x00, /* 10 Orange */ - 0xff, 0x99, 0xff, /* 11 Pink */ - 0x9e, 0xf4, 0xff, /* 12 Light Blue */ - 0xb3, 0xff, 0xbb, /* 13 Light Green */ - 0xff, 0xff, 0x28, /* 14 Light Yellow */ - 0xff, 0xff, 0xff, /* 15 White */ -}; - - -PALETTE_INIT_MEMBER(dai_state, dai) -{ - int i; - - for ( i = 0; i < sizeof(dai_palette) / 3; i++ ) - { - m_palette->set_pen_color(i, dai_palette[i * 3], dai_palette[i * 3 + 1], dai_palette[i * 3 + 2]); - } -} - - -void dai_state::video_start() -{ -} - -UINT32 dai_state::screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int i, j, k, l; - - UINT8* char_rom = memregion("gfx1")->base(); - - UINT16 dai_video_memory_start = 0xbfff; - UINT16 dai_scan_lines = 604; /* scan lines of PAL tv */ - - UINT16 current_scan_line = 0; - UINT16 current_video_memory_address = dai_video_memory_start; - - UINT8 mode; /* mode byte of line - bits 0-3 - line repeat count - bits 4-5 - resolution control - bits 6-7 - display mode control */ - UINT8 colour; /* colour byte of line - bits 0-3 - one of 16 colours - bits 4-5 - colour register for update - bit 6 - if unset force 'unit colour mode' - bit 7 - enable coulor change - if unset bits 0-5 are ignored */ - UINT8 line_repeat_count; /* number of horizontalraster scans - for which same data will be displayed - 0000 - 2 lines - each additional repeat adds 2 scans */ - UINT8 horizontal_resolution; /* number of blobs per line - 00 - 88 (low resolution graphics) - 01 - 176 (medium resolution graphics) - 10 - 352 (high resolution graphics) - 11 - 528 (text with 66 chars per line) */ - UINT8 display_mode; /* determine how data will be used - to generate the picture - 00 - four colour graphics - 01 - four colour characters - 10 - sixteen colour graphics - 11 - sixteen colour characters */ - UINT8 unit_mode; - - UINT8 current_data_1, current_data_2; - - UINT8 current_colour; - - while (current_scan_line < dai_scan_lines) - { - mode = space.read_byte(current_video_memory_address--); - colour = space.read_byte(current_video_memory_address--); - line_repeat_count = mode & 0x0f; - horizontal_resolution = (mode & 0x30) >> 4; - display_mode = (mode & 0xc0) >> 6; - unit_mode = (colour & 0x40) >> 6; - - if (colour & 0x80) - m_4_colours_palette[(colour & 0x30) >> 4] = colour & 0x0f; - - switch (display_mode) - { - case 0x00: /* 4 colour grahics modes */ - switch (horizontal_resolution) - { - case 0x00: /* 88 pixels */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - - for (i=0; i<11; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - case 1: - for (i=0; i<11; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; - } - } - } - break; - } - break; - - case 0x01: /* 176 pixels */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - case 1: - for (i=0; i<22; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; - } - } - } - break; - } - break; - - case 0x02: /* 352 pixels */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; - } - } - } - break; - case 1: - for (i=0; i<44; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; - } - } - } - break; - } - break; - - case 0x03: /* 528 pixels */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; - } - } - } - break; - case 1: - for (i=0; i<66; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; - } - } - } - break; - } - break; - } - break; - - case 0x01: /* 4 colour characters */ - switch (horizontal_resolution) - { - case 0x00: /* 11 chars */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address); - current_data_2 = space.read_byte(current_video_memory_address-1); - current_video_memory_address-=2; - for (i=0; i<11; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - case 1: - for (i=0; i<11; i++) - { - current_data_1 = space.read_byte(current_video_memory_address); - current_data_2 = space.read_byte(current_video_memory_address-1); - current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - } - break; - case 0x01: /* 22 chars */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address); - current_data_2 = space.read_byte(current_video_memory_address-1); - current_video_memory_address-=2; - for (i=0; i<22; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - case 1: - for (i=0; i<22; i++) - { - current_data_1 = space.read_byte(current_video_memory_address); - current_data_2 = space.read_byte(current_video_memory_address-1); - current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - } - break; - case 0x02: /* 44 chars */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address); - current_data_2 = space.read_byte(current_video_memory_address-1); - current_video_memory_address-=2; - for (i=0; i<44; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; - } - } - } - break; - case 1: - for (i=0; i<44; i++) - { - current_data_1 = space.read_byte(current_video_memory_address); - current_data_2 = space.read_byte(current_video_memory_address-1); - current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; - } - } - } - break; - } - break; - case 0x03: /* 66 chars */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address); - current_data_2 = space.read_byte(current_video_memory_address-1); - current_video_memory_address-=2; - for (i=0; i<66; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; - } - } - } - break; - case 1: - for (i=0; i<66; i++) - { - current_data_1 = space.read_byte(current_video_memory_address); - current_data_2 = space.read_byte(current_video_memory_address-1); - current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; - } - } - } - break; - } - break; - } - break; - case 0x02: /* 16 colour graphics */ - switch (horizontal_resolution) - { - case 0x00: /* 88 pixels */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - - for (i=0; i<11; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - case 1: - for (i=0; i<11; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; - } - } - } - break; - } - break; - - case 0x01: /* 176 pixels */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - case 1: - for (i=0; i<22; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; - } - } - } - break; - } - break; - - case 0x02: /* 352 pixels */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; - } - } - } - break; - case 1: - for (i=0; i<44; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; - } - } - } - break; - } - break; - - case 0x03: /* 528 pixels */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; - } - } - } - break; - case 1: - for (i=0; i<66; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; - } - } - } - break; - } - break; - } - break; - case 0x03: /* 16 colour characters */ - switch (horizontal_resolution) - { - case 0x00: /* 11 chars */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - case 1: - for (i=0; i<11; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - } - break; - case 0x01: /* 22 chars */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - case 1: - for (i=0; i<22; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; - } - } - } - current_video_memory_address-=2; - break; - } - break; - case 0x02: /* 44 chars */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; - } - } - } - break; - case 1: - for (i=0; i<44; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; - } - } - } - break; - } - break; - case 0x03: /* 66 chars */ - switch (unit_mode) - { - case 0: - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) - { - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; - } - } - } - break; - case 1: - for (i=0; i<66; i++) - { - current_data_1 = space.read_byte(current_video_memory_address--); - current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) - { - for (k=0; k<8; k++) - { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; - } - } - } - break; - } - break; - } - break; - } - current_scan_line += line_repeat_count*2+2; - LOG_DAI_VIDEO_LINE(display_mode, unit_mode, horizontal_resolution, line_repeat_count, current_scan_line); - } - return 0; -} diff --git a/src/mess/video/dgn_beta.c b/src/mess/video/dgn_beta.c deleted file mode 100644 index 41cb1fde657..00000000000 --- a/src/mess/video/dgn_beta.c +++ /dev/null @@ -1,286 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/* - video/dgn_beta.c - -The Dragon Beta uses a 68B45 for it's display generation, this is used in the -conventional wat with a character generator ROM in the two text modes, which are -standard 40x25 and 80x25. In adition to the 6845 there is some TTL logic which -provides colour and attributes. In text modes the video ram is organised as pairs -of character and attribute, in alternate bytes. - -The attributes decode as follows :- - - 7-6-5-4-3-2-1-0 - f-u-F-F-F-B-B-B - - f=flash - u=underline - - FFF = foreground colour - BBB = bakcground colour - - 000 black - 001 red - 010 green - 011 yellow - 100 blue - 101 magenta - 110 cyan - 111 white - - If flash is true, foreground and background colours will be exchanged. - -It is interesting to note that the 6845 uses 16 bit wide access to the ram, in contrast -to the 8 bit accesses from the CPUs, this allows each increment of the MA lines to move -2 bytes at a time, and therefore feed both the character rom and the attribute decode -circuit simultaniously. - -The RAM addresses are made up of two parts, the MA0..13 from the 6845, plus two output -lines from the 6821 PIA, I28, the lines are BP6 and PB7, with PB7 being the most -significant. This effectivly allows the 6845 access to the first 128K of memory, as there -are 16 address lines, accessing a 16 bit wide memory. - -The relationship between how the cpu sees the RAM, and the way the 6845 sees it is simply -CPU addr=2x6845 addr. So for the default video address of $1F000, the CPU sees this as -being at $1F000 (after DAT trasnlation). The 6845 is programmed to start it's MA lines -counting at $3800, plus A14 and A15 being supplied by PB6 and PB7 from I28, gives an address -of $F800, which is the same as $1F000 / 2. - -I am currently at this time not sure of how any of the graphics modes, work, this will need -further investigation. - -However the modes supported are :- - -Text Modes - width height colours - 40 25 8 - 80 25 8 -Graphics modes - 320 256 4 - 320 256 16 - 640 512 4 - 640 256 4** - 640 512 2 - -Looking at the parts of the circuit sheet that I have seen it looks like the graphics modes -are driven using a combination of the 6845 MA and RA lines to address more than 64K or memory -which is needed for some of the modes above (specifically, 640x512x4, which needs 80K). - -2006-11-30, Text mode is almost completely implemented, in both 40 and 80 column modes. -I have made a start on implementing the graphics modes of the beta, drawing from technical -documents, from the project, this is still a work in progress. I have however managed to get -it to display a distorted graphical image, so I know I am going in the correct direction ! - -** 2006-12-05, this mode is not documented in any of the printed documentation, however it -is supported and displayed by the graphics test rom, it is basically the 640x512x4 mode with -half the number of vertical lines, and in non-interlaced mode. - -It seems that the 640x512 modes operate the 6845 in interlaced mode, just how this affects -the access to the video memory is unclear to me at the moment. - -*/ - -#include "emu.h" -#include "includes/dgn_beta.h" - -/* GCtrl bitmasks, infered from bits of Beta schematic */ -#define GCtrlWI 0x01 -#define GCtrlSWChar 0x02 /* Character set select */ -#define GCtrlHiLo 0x04 /* Hi/Lo res graphics, Hi=1, Lo=0 */ -#define GCtrlChrGfx 0x08 /* Character=1 / Graphics=0 */ -#define GCtrlControl 0x10 /* Control bit, sets direct drive mode */ -#define GCtrlFS 0x20 /* labeled F/S, not yet sure of function Fast or Slow scan ? */ -#define GCtrlAddrLines 0xC0 /* Top two address lines for text mode */ - -#define IsTextMode (m_GCtrl & GCtrlChrGfx) ? 1 : 0 // Is this text mode ? -#define IsGfx16 ((~m_GCtrl & GCtrlChrGfx) && (~m_GCtrl & GCtrlControl)) ? 1 : 0 // is this 320x256x16bpp mode -#define IsGfx2 ((m_GCtrl & GCtrlHiLo) && (~m_GCtrl & GCtrlFS)) ? 1 : 0 // Is this a 2 colour mode -#define SWChar (m_GCtrl & GCtrlSWChar)>>1 // Swchar bit - -MC6845_UPDATE_ROW( dgn_beta_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 *videoram = m_videoram; - UINT32 *p = &bitmap.pix32(y); - int i; - if(IsTextMode) - { - UINT8 *chr_gen = memregion("gfx1")->base(); - for ( i = 0; i < x_count; i++ ) - { - UINT32 offset = ( ( ma + i ) | ((m_GCtrl & GCtrlAddrLines)<<8)) << 1; - UINT8 chr = videoram[ offset ]; - UINT8 attr = videoram[ offset +1 ]; - - /* Extract non-colour attributes, in character set 1, undeline is used */ - /* We will extract the colours below, when we have decoded inverse */ - /* to indicate a double height character */ - int UnderLine=(attr & 0x40) >> 6; // Underline active - int FlashChar=(attr & 0x80) >> 7; // Flashing char - - // underline is active for character set 0, on character row 9 - int ULActive=(UnderLine && (ra==9) && ~SWChar); - - /* Invert forground and background if flashing char and flash acive */ - int Invert=(FlashChar & m_FlashBit); - - /* Underline inverts flash */ - if (ULActive) - Invert=~Invert; - - /* Cursor on also inverts */ - if (i == cursor_x) - Invert=~Invert; - - UINT16 fg = 0; - UINT16 bg = 0; - - /* Invert colours if invert is true */ - if(!Invert) - { - fg = (attr & 0x38) >> 3; - bg = (attr & 0x07); - } - else - { - bg = (attr & 0x38) >> 3; - fg = (attr & 0x07); - } - - - - UINT8 data = chr_gen[ chr * 16 + ra ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - } - - } - else - { - for ( i = 0; i < x_count; i++ ) - { - UINT32 offset = ((((ma + i ) & 0x1FFF) << 3) | (ra & 0x07)) << 1; - - UINT8 Lo = videoram[ offset ]; - UINT8 Hi = videoram[ offset +1 ]; - UINT16 Word = (Hi<<8) | Lo; - int Red; - int Green; - int Blue; - int Intense; - int Colour; - int Dot; - - /* If contol is low then we are plotting 4 bit per pixel, 16 colour mode */ - /* This directly drives the colour output lines, from the pixel value */ - /* If Control is high, then we lookup the colour from the LS670 4x4 bit */ - /* palate register */ - if (IsGfx16) - { - Intense =(Lo & 0x0F); - Red =(Lo & 0xF0)>>4; - Green =(Hi & 0x0F); - Blue =(Hi & 0xF0)>>4; - Colour=((Intense&0x08) | (Red&0x08)>>1) | ((Green&0x08)>>2) | ((Blue&0x08)>>3); - - for (Dot=0;Dot<4;Dot++) - { - *p = palette[Colour]; p++; - *p = palette[Colour]; p++; - *p = palette[Colour]; p++; - *p = palette[Colour]; p++; - - Intense =Intense<<1; - Red =Red<<1; - Green =Green<<1; - Blue =Blue<<1; - } - } - else if (IsGfx2) - { - for (Dot=0;Dot<16;Dot=Dot+1) - { - Colour=m_ColourRAM[((Word&0x8000)>>15)]; - - *p = palette[Colour]; p++; - - Hi=(Word&0x8000) >> 15; - Word=((Word<<1)&0xFFFE) | Hi; - } - } - else - { - for (Dot=0;Dot<8;Dot++) - { - Colour=m_ColourRAM[((Word&0x8000)>>14) | ((Word&0x80)>>7)]; - *p = palette[Colour]; p++; - *p = palette[Colour]; p++; - - Hi=(Word&0x8000) >> 15; - Word=((Word<<1)&0xFFFE) | Hi; - } - } - } - } - -} - -WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_vsync_changed) -{ - m_beta_VSync=state; - if (!m_beta_VSync) - { - m_FlashCount++; - if(m_FlashCount==10) - { - m_FlashCount=0; // Reset counter - m_FlashBit=(!m_FlashBit) & 0x01; // Invert flash bit. - } - } - - dgn_beta_frame_interrupt(state); -} - - -/* Set video control register from I28 port B, the control register is laid out as */ -/* follows :- */ -/* bit function */ -/* 0 WI, unknown */ -/* 1 Character set select, drives A12 of character rom in text mode */ -/* 2 High (1) or Low(0) resolution if in graphics mode. */ -/* 3 Text (1) or Graphics(0) mode */ -/* 4 Control bit, Selects between colour palate and drirect drive */ -/* 5 F/S bit, 1=80 bytes/line, 0=40bytes/line */ -/* 6 Effective A14, to ram, in text mode */ -/* 7 Effective A15, to ram, in text mode */ -/* the top two address lines for the video ram, are supplied by the BB6 and PB7 on */ -/* 6821-I28, this allows the 6845 to access the full 64K address range, however */ -/* since the ram data is addressed as a 16bit wide unit, this allows the 6845 */ -/* access to the first 128K or ram. */ -void dgn_beta_state::dgnbeta_vid_set_gctrl(int data) -{ - m_GCtrl=data; -} - - -/* Write handler for colour, pallate ram */ -WRITE8_MEMBER(dgn_beta_state::dgnbeta_colour_ram_w) -{ - m_ColourRAM[offset]=data&0x0f; /* Colour ram 4 bit and write only to CPU */ -} diff --git a/src/mess/video/electron.c b/src/mess/video/electron.c deleted file mode 100644 index e77904ef8e6..00000000000 --- a/src/mess/video/electron.c +++ /dev/null @@ -1,273 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/****************************************************************************** - Acorn Electron driver - - MESS Driver By: - - Wilbert Pol - -******************************************************************************/ - -#include "emu.h" -#include "includes/electron.h" - -/* - From the ElectrEm site: - -Timing is somewhat of a thorny issue on the Electron. It is almost certain the Electron could have been a much faster machine if BBC Micro OS level compatibility had not been not a design requirement. - -When accessing the ROM regions, the CPU always runs at 2MHz. When accessing the FC (1 MHz bus) or FD (JIM) pages, the CPU always runs at 1MHz. - -The timing for RAM accesses varies depending on the graphics mode, and how many bytes are required to be read by the video circuits per scanline. When accessing RAM in modes 4-6, the CPU is simply moved to a 1MHz clock. This occurs for any RAM access at any point during the frame. - -In modes 0-3, if the CPU tries to access RAM at any time during which the video circuits are fetching bytes, it is halted by means of receiving a stopped clock until the video circuits next stop fetching bytes. - -Each scanline is drawn in exactly 64us, and of that the video circuits fetch bytes for 40us. In modes 0, 1 and 2, 256 scanlines have pixels on, whereas in mode 3 only 250 scanlines are affected as mode 3 is a 'spaced' mode. - -As opposed to one clock generator which changes pace, the 1MHz and 2MHz clocks are always available, so the ULA acts to simply change which clock is piped to the CPU. This means in half of all cases, a further 2MHz cycle is lost waiting for the 2MHz and 1MHz clocks to synchronise during a 2MHz to 1MHz step. - -The video circuits run from a constant 2MHz clock, and generate 312 scanlines a frame, one scanline every 128 cycles. This actually gives means the Electron is running at 50.08 frames a second. - -Creating a scanline numbering scheme where the first scanline with pixels is scanline 0, in all modes the end of display interrupt is generated at the end of scanline 255, and the RTC interrupt is generated upon the end of scanline 99. - -From investigating some code for vertical split modes printed in Electron User volume 7, issue 7 it seems that the exact timing of the end of display interrupt is somewhere between 24 and 40 cycles after the end of pixels. This may coincide with HSYNC. I have no similarly accurate timing for the real time clock interrupt at this time. - -Mode changes are 'immediate', so any change in RAM access timing occurs exactly after the write cycle of the changing instruction. Similarly palette changes take effect immediately. VSYNC is not signalled in any way. - -*/ - - - - -void electron_state::video_start() -{ - int i; - for( i = 0; i < 256; i++ ) { - m_map4[i] = ( ( i & 0x10 ) >> 3 ) | ( i & 0x01 ); - m_map16[i] = ( ( i & 0x40 ) >> 3 ) | ( ( i & 0x10 ) >> 2 ) | ( ( i & 0x04 ) >> 1 ) | ( i & 0x01 ); - } - m_scanline_timer = timer_alloc(TIMER_SCANLINE_INTERRUPT); - m_scanline_timer->adjust( machine().first_screen()->time_until_pos(0), 0, machine().first_screen()->scan_period() ); -} - -inline UINT8 electron_state::read_vram( UINT16 addr ) -{ - return m_ula.vram[ addr % m_ula.screen_size ]; -} - -inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix16(y, x) = (UINT16)color; -} - -UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int i; - int x = 0; - int pal[16]; - int scanline = screen.vpos(); - rectangle r = cliprect; - r.min_y = r.max_y = scanline; - - /* set up palette */ - switch( m_ula.screen_mode ) - { - case 0: case 3: case 4: case 6: case 7: /* 2 colour mode */ - pal[0] = m_ula.current_pal[0]; - pal[1] = m_ula.current_pal[8]; - break; - case 1: case 5: /* 4 colour mode */ - pal[0] = m_ula.current_pal[0]; - pal[1] = m_ula.current_pal[2]; - pal[2] = m_ula.current_pal[8]; - pal[3] = m_ula.current_pal[10]; - break; - case 2: /* 16 colour mode */ - for( i = 0; i < 16; i++ ) - pal[i] = m_ula.current_pal[i]; - } - - /* draw line */ - switch( m_ula.screen_mode ) - { - case 0: - for( i = 0; i < 80; i++ ) - { - UINT8 pattern = read_vram( m_ula.screen_addr + (i << 3) ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)& 1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)& 1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)& 1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)& 1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)& 1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)& 1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)& 1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)& 1] ); - } - m_ula.screen_addr++; - if ( ( scanline & 0x07 ) == 7 ) - m_ula.screen_addr += 0x278; - break; - - case 1: - for( i = 0; i < 80; i++ ) - { - UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); - } - m_ula.screen_addr++; - if ( ( scanline & 0x07 ) == 7 ) - m_ula.screen_addr += 0x278; - break; - - case 2: - for( i = 0; i < 80; i++ ) - { - UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>0]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>0]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>0]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>0]] ); - } - m_ula.screen_addr++; - if ( ( scanline & 0x07 ) == 7 ) - m_ula.screen_addr += 0x278; - break; - - case 3: - if ( ( scanline > 249 ) || ( scanline % 10 >= 8 ) ) - bitmap.fill(7, r ); - else - { - for( i = 0; i < 80; i++ ) - { - UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); - } - m_ula.screen_addr++; - } - if ( scanline % 10 == 9 ) - m_ula.screen_addr += 0x278; - break; - - case 4: - case 7: - for( i = 0; i < 40; i++ ) - { - UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); - } - m_ula.screen_addr++; - if ( ( scanline & 0x07 ) == 7 ) - m_ula.screen_addr += 0x138; - break; - - case 5: - for( i = 0; i < 40; i++ ) - { - UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>1]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); - electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>0]] ); - } - m_ula.screen_addr++; - if ( ( scanline & 0x07 ) == 7 ) - m_ula.screen_addr += 0x138; - break; - - case 6: - if ( ( scanline > 249 ) || ( scanline % 10 >= 8 ) ) - bitmap.fill(7, r ); - else - { - for( i = 0; i < 40; i++ ) - { - UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>4)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>3)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>2)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>1)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); - electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>0)&1] ); - } - m_ula.screen_addr++; - if ( ( scanline % 10 ) == 7 ) - m_ula.screen_addr += 0x138; - } - break; - } - - return 0; -} - -TIMER_CALLBACK_MEMBER(electron_state::electron_scanline_interrupt) -{ - switch (machine().first_screen()->vpos()) - { - case 43: - electron_interrupt_handler( INT_SET, INT_RTC ); - break; - case 199: - electron_interrupt_handler( INT_SET, INT_DISPLAY_END ); - break; - case 0: - m_ula.screen_addr = m_ula.screen_start - m_ula.screen_base; - break; - } -} diff --git a/src/mess/video/fm7.c b/src/mess/video/fm7.c deleted file mode 100644 index 298e98c9262..00000000000 --- a/src/mess/video/fm7.c +++ /dev/null @@ -1,1493 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald -/* - * - * Fujitsu Micro 7 Video functions - * - */ - -#include "emu.h" -#include "cpu/m6809/m6809.h" -#include "includes/fm7.h" - - -/* - * Main CPU: Sub-CPU interface (port 0xfd05) - * - * Read: - * bit 7: Sub-CPU busy (or halted) - * bit 0: EXTDET (?) - * Write: - * bit 7: Sub-CPU halt - * bit 6: Sub-CPU cancel IRQ - */ - -READ8_MEMBER(fm7_state::fm7_subintf_r) -{ - UINT8 ret = 0x00; - - if(m_video.sub_busy != 0 || m_video.sub_halt != 0) - ret |= 0x80; - - ret |= 0x7e; - //ret |= 0x01; // EXTDET (not implemented yet) - - return ret; -} - -WRITE8_MEMBER(fm7_state::fm7_subintf_w) -{ - m_video.sub_halt = data & 0x80; - if(data & 0x80) - m_video.sub_busy = data & 0x80; - - m_sub->set_input_line(INPUT_LINE_HALT,(data & 0x80) ? ASSERT_LINE : CLEAR_LINE); - if(data & 0x40) - m_sub->set_input_line(M6809_IRQ_LINE,ASSERT_LINE); - //popmessage("Sub CPU Interface write: %02x\n",data); -} - -READ8_MEMBER(fm7_state::fm7_sub_busyflag_r) -{ - if(m_video.sub_halt == 0) - m_video.sub_busy = 0x00; - return 0x00; -} - -WRITE8_MEMBER(fm7_state::fm7_sub_busyflag_w) -{ - m_video.sub_busy = 0x80; -} - -/* - * Sub-CPU port 0xd402 - * Read-only: Acknowledge Cancel IRQ - */ -READ8_MEMBER(fm7_state::fm7_cancel_ack) -{ - m_sub->set_input_line(M6809_IRQ_LINE,CLEAR_LINE); - return 0x00; -} - -/* - * Reading from 0xd404 (sub-CPU) causes an "Attention" FIRQ on the main CPU - */ -READ8_MEMBER(fm7_state::fm7_attn_irq_r) -{ - m_video.attn_irq = 1; - m_maincpu->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); - return 0xff; -} - -/* - * Sub CPU: I/O port 0xd409 - * - * On read, enables VRAM access - * On write, disables VRAM access - */ -READ8_MEMBER(fm7_state::fm7_vram_access_r) -{ - m_video.vram_access = 1; - return 0xff; -} - -WRITE8_MEMBER(fm7_state::fm7_vram_access_w) -{ - m_video.vram_access = 0; -} - -TIMER_CALLBACK_MEMBER(fm7_state::fm77av_alu_task_end) -{ - m_alu.busy = 0; -} - -void fm7_state::fm7_alu_mask_write(UINT32 offset, int bank, UINT8 dat) -{ - UINT8 temp; - int page = 0; - - if(offset >= 0xc000) - page = 1; - - if((m_alu.command & 0x40) == 0) - { // "always" write mode - m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = dat; - return; - } - - temp = m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)]; - if(m_alu.command & 0x20) - { // "not equal" write mode - temp &= m_alu.compare_data; - dat &= ~m_alu.compare_data; - } - else - { // "equal" write mode - temp &= ~m_alu.compare_data; - dat &= m_alu.compare_data; - } - - m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = temp | dat; -} - -void fm7_state::fm7_alu_function_compare(UINT32 offset) -{ - // COMPARE - compares which colors match those in the compare registers - // can be used on its own, or when bit 6 of the command register is high. - - UINT8 red,green,blue; - UINT8 dat = 0; - UINT8 colour; - UINT8 banks; - int x,y; - int match; - int page = 0; - UINT8 bit = 0x80; - - if(offset >= 0xc000) - { - page = 1; - offset += m_video.vram_offset2; - } - else - offset += m_video.vram_offset; - - blue = m_video_ram[(offset & 0x3fff) + (page * 0xc000)]; - red = m_video_ram[(offset & 0x3fff) + 0x4000 + (page * 0xc000)]; - green = m_video_ram[(offset & 0x3fff) + 0x8000 + (page * 0xc000)]; - - banks = (~m_alu.bank_disable) & 0x07; - - for(x=0;x<8;x++) // loop through each pixel - { - colour = 0; - if(blue & bit) - colour |= 1; - if(red & bit) - colour |= 2; - if(green & bit) - colour |= 4; - - match = 0; - for(y=0;y<8;y++) // loop through each compare register - { - if(!(m_alu.compare[y] & 0x80)) // don't compare if register is masked - { - if((m_alu.compare[y] & banks) == (colour & banks)) - match = 1; - } - } - if(match != 0) - dat |= bit; - - bit >>= 1; - } - m_alu.compare_data = dat; -} - -void fm7_state::fm7_alu_function_pset(UINT32 offset) -{ - // PSET - simply sets the pixels to the selected logical colour - int x; - UINT8 dat; - int page = 0; - UINT8 mask; - - if(m_alu.command & 0x40) - fm7_alu_function_compare(offset); - - if(offset >= 0xc000) - { - page = 1; - offset += m_video.vram_offset2; - } - else - offset += m_video.vram_offset; - - for(x=0;x<3;x++) // cycle through banks - { - if(!(m_alu.bank_disable & (1 << x))) - { - if(m_alu.lcolour & (1 << x)) - dat = 0xff; - else - dat = 0; - - mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & m_alu.mask; - dat &= ~m_alu.mask; - dat |= mask; - - fm7_alu_mask_write(offset,x,dat); - } - } -} - -void fm7_state::fm7_alu_function_or(UINT32 offset) -{ - int x; - UINT8 dat; - int page = 0; - UINT8 mask; - - if(m_alu.command & 0x40) - fm7_alu_function_compare(offset); - - if(offset >= 0xc000) - { - page = 1; - offset += m_video.vram_offset2; - } - else - offset += m_video.vram_offset; - - for(x=0;x<3;x++) // cycle through banks - { - if(!(m_alu.bank_disable & (1 << x))) - { - if(m_alu.lcolour & (1 << x)) - dat = 0xff; - else - dat = 0; - - mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); - dat |= mask; - - mask &= m_alu.mask; - dat &= ~m_alu.mask; - dat |= mask; - - fm7_alu_mask_write(offset,x,dat); - } - } -} - -void fm7_state::fm7_alu_function_and(UINT32 offset) -{ - int x; - UINT8 dat; - int page = 0; - UINT8 mask; - - if(m_alu.command & 0x40) - fm7_alu_function_compare(offset); - - if(offset >= 0xc000) - { - page = 1; - offset += m_video.vram_offset2; - } - else - offset += m_video.vram_offset; - - for(x=0;x<3;x++) // cycle through banks - { - if(!(m_alu.bank_disable & (1 << x))) - { - if(m_alu.lcolour & (1 << x)) - dat = 0xff; - else - dat = 0; - - mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); - dat &= mask; - - mask &= m_alu.mask; - dat &= ~m_alu.mask; - dat |= mask; - - fm7_alu_mask_write(offset,x,dat); - } - } -} - -void fm7_state::fm7_alu_function_xor(UINT32 offset) -{ - int x; - UINT8 dat; - int page = 0; - UINT8 mask; - - if(m_alu.command & 0x40) - fm7_alu_function_compare(offset); - - if(offset >= 0xc000) - { - page = 1; - offset += m_video.vram_offset2; - } - else - offset += m_video.vram_offset; - - for(x=0;x<3;x++) // cycle through banks - { - if(!(m_alu.bank_disable & (1 << x))) - { - if(m_alu.lcolour & (1 << x)) - dat = 0xff; - else - dat = 0; - - mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); - dat ^= mask; - - mask &= m_alu.mask; - dat &= ~m_alu.mask; - dat |= mask; - - fm7_alu_mask_write(offset,x,dat); - } - } -} - -void fm7_state::fm7_alu_function_not(UINT32 offset) -{ - int x; - UINT8 dat; - int page = 0; - UINT8 mask; - - if(m_alu.command & 0x40) - fm7_alu_function_compare(offset); - - if(offset >= 0xc000) - { - page = 1; - offset += m_video.vram_offset2; - } - else - offset += m_video.vram_offset; - - for(x=0;x<3;x++) // cycle through banks - { - if(!(m_alu.bank_disable & (1 << x))) - { - if(m_alu.lcolour & (1 << x)) - dat = 0xff; - else - dat = 0; - - mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); - dat = ~mask; - - mask &= m_alu.mask; - dat &= ~m_alu.mask; - dat |= mask; - - fm7_alu_mask_write(offset,x,dat); - } - } -} - -void fm7_state::fm7_alu_function_invalid(UINT32 offset) -{ - // Invalid function, still does something though (used by Laydock) - int x; - UINT8 dat; - int page = 0; - UINT8 mask; - - if(m_alu.command & 0x40) - fm7_alu_function_compare(offset); - - if(offset >= 0xc000) - { - page = 1; - offset += m_video.vram_offset2; - } - else - offset += m_video.vram_offset; - - for(x=0;x<3;x++) // cycle through banks - { - if(!(m_alu.bank_disable & (1 << x))) - { - mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); - - dat = mask & m_alu.mask; - - fm7_alu_mask_write(offset,x,dat); - } - } -} - -void fm7_state::fm7_alu_function_tilepaint(UINT32 offset) -{ - // TILEPAINT - writes to VRAM based on the tilepaint colour registers - int x; - UINT8 dat = 0; - int page = 0; - UINT8 mask; - - if(m_alu.command & 0x40) - fm7_alu_function_compare(offset); - - if(offset >= 0xc000) - { - page = 1; - offset += m_video.vram_offset2; - } - else - offset += m_video.vram_offset; - - for(x=0;x<3;x++) // cycle through banks - { - if(!(m_alu.bank_disable & (1 << x))) - { - switch(x) - { - case 0: - dat = m_alu.tilepaint_b; - break; - case 1: - dat = m_alu.tilepaint_r; - break; - case 2: - dat = m_alu.tilepaint_g; - break; - } - dat &= ~m_alu.mask; - mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & m_alu.mask; - dat |= mask; - - fm7_alu_mask_write(offset,x,dat); - } - } -} - -void fm7_state::fm7_alu_function(UINT32 offset) -{ - switch(m_alu.command & 0x07) - { - case 0x00: // PSET - fm7_alu_function_pset(offset); - break; - case 0x02: // OR - fm7_alu_function_or(offset); - break; - case 0x03: // AND - fm7_alu_function_and(offset); - break; - case 0x04: // XOR - fm7_alu_function_xor(offset); - break; - case 0x05: // NOT - fm7_alu_function_not(offset); - break; - case 0x06: // TILEPAINT - fm7_alu_function_tilepaint(offset); - break; - case 0x07: // COMPARE - fm7_alu_function_compare(offset); - break; - case 0x01: - default: - fm7_alu_function_invalid(offset); - } -} - -UINT32 fm7_state::fm7_line_set_pixel(int x, int y) -{ - UINT32 addr; - static const UINT8 pixel_mask[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe }; - - - if(m_video.modestatus & 0x40) // 320 pixels wide - { - addr = (x >> 3) + (y * 40); - } - else // 640 pixels wide - { - addr = (x >> 3) + (y * 80); - } - addr += (m_alu.addr_offset << 1); - addr &= 0x3fff; - if(m_video.active_video_page != 0) - addr += 0xc000; - - if(m_alu.command & 0x80) // ALU must be active - { - m_alu.mask = pixel_mask[x & 0x07]; - fm7_alu_function(addr); - } - - return addr; -} - -void fm7_state::fm77av_line_draw() -{ - int x1 = m_alu.x0; - int x2 = m_alu.x1; - int y1 = m_alu.y0; - int y2 = m_alu.y1; - - int dx = abs(x2 - x1); - int dy = abs(y2 - y1); - int stepx, stepy; - int err,err2; - int byte_count = 0; - - if(x1 < x2) - stepx = 1; - else - stepx = -1; - if(y1 < y2) - stepy = 1; - else - stepy = -1; - - err = dx - dy; - - for(;;) - { - fm7_line_set_pixel(x1, y1); - byte_count++; - - if(x1 == x2 && y1 == y2) - break; - - err2 = 2*err; - if(err2 > -dy) - { - err -= dy; - x1 += stepx; - } - if(err2 < dx) - { - err += dx; - y1 += stepy; - } - } - - // set timer to disable busy flag - // 1/16 us for each byte changed - timer_set(attotime::from_usec(byte_count/16), TIMER_FM77AV_ALU_TASK_END); -} - -READ8_MEMBER(fm7_state::fm7_vram_r) -{ - int offs; - UINT16 page = 0x0000; - - if(m_video.active_video_page != 0) - page = 0xc000; - - if(offset < 0x4000 && (m_video.multi_page & 0x01)) - return 0xff; - if((offset < 0x8000 && offset >=0x4000) && (m_video.multi_page & 0x02)) - return 0xff; - if((offset < 0xc000 && offset >=0x8000) && (m_video.multi_page & 0x04)) - return 0xff; - - if(m_alu.command & 0x80) // ALU active, writes to VRAM even when reading it (go figure) - { - fm7_alu_function(offset+page); - } - - if(m_video.modestatus & 0x40) - { - if(m_video.active_video_page != 0) - offs = (offset & 0xe000) | ((offset + m_video.vram_offset2) & 0x1fff); - else - offs = (offset & 0xe000) | ((offset + m_video.vram_offset) & 0x1fff); - } - else - { - if(m_video.active_video_page != 0) - offs = (offset & 0xc000) | ((offset + m_video.vram_offset2) & 0x3fff); - else - offs = (offset & 0xc000) | ((offset + m_video.vram_offset) & 0x3fff); - } - return m_video_ram[offs + page]; -} - -WRITE8_MEMBER(fm7_state::fm7_vram_w) -{ - int offs; - UINT16 page = 0x0000; - - if(m_video.active_video_page != 0) - page = 0xc000; - - if(offset < 0x4000 && (m_video.multi_page & 0x01)) - return; - if((offset < 0x8000 && offset >=0x4000) && (m_video.multi_page & 0x02)) - return; - if((offset < 0xc000 && offset >=0x8000) && (m_video.multi_page & 0x04)) - return; - - if(m_alu.command & 0x80) // ALU active - { - fm7_alu_function(offset+page); - return; - } - - if(m_video.modestatus & 0x40) - { - if(m_video.active_video_page != 0) - offs = (offset & 0xe000) | ((offset + m_video.vram_offset2) & 0x1fff); - else - offs = (offset & 0xe000) | ((offset + m_video.vram_offset) & 0x1fff); - } - else - { - if(m_video.active_video_page != 0) - offs = (offset & 0xc000) | ((offset + m_video.vram_offset2) & 0x3fff); - else - offs = (offset & 0xc000) | ((offset + m_video.vram_offset) & 0x3fff); - } -// if(m_video.vram_access != 0) - m_video_ram[offs+page] = data; -} - -// not pretty, but it should work. -WRITE8_MEMBER(fm7_state::fm7_vram_banked_w) -{ - int offs; - UINT16 page = 0x0000; - - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return; - - if(m_video.active_video_page != 0) - page = 0xc000; - - if(offset < 0x4000 && (m_video.multi_page & 0x01)) - return; - if((offset < 0x8000 && offset >=0x4000) && (m_video.multi_page & 0x02)) - return; - if((offset < 0xc000 && offset >=0x8000) && (m_video.multi_page & 0x04)) - return; - - if(m_alu.command & 0x80) // ALU active - { - fm7_alu_function(offset+page); - return; - } - - if(m_video.modestatus & 0x40) - { - if(m_video.active_video_page != 0) - offs = (offset & 0xe000) | ((offset + m_video.vram_offset2) & 0x1fff); - else - offs = (offset & 0xe000) | ((offset + m_video.vram_offset) & 0x1fff); - } - else - { - if(m_video.active_video_page != 0) - offs = (offset & 0xc000) | ((offset + m_video.vram_offset2) & 0x3fff); - else - offs = (offset & 0xc000) | ((offset + m_video.vram_offset) & 0x3fff); - } - m_video_ram[offs+page] = data; -} - -READ8_MEMBER(fm7_state::fm7_vram0_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset); -} - -READ8_MEMBER(fm7_state::fm7_vram1_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x1000); -} - -READ8_MEMBER(fm7_state::fm7_vram2_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x2000); -} - -READ8_MEMBER(fm7_state::fm7_vram3_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x3000); -} - -READ8_MEMBER(fm7_state::fm7_vram4_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x4000); -} - -READ8_MEMBER(fm7_state::fm7_vram5_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x5000); -} - -READ8_MEMBER(fm7_state::fm7_vram6_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x6000); -} - -READ8_MEMBER(fm7_state::fm7_vram7_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x7000); -} - -READ8_MEMBER(fm7_state::fm7_vram8_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x8000); -} - -READ8_MEMBER(fm7_state::fm7_vram9_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0x9000); -} - -READ8_MEMBER(fm7_state::fm7_vramA_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0xa000); -} - -READ8_MEMBER(fm7_state::fm7_vramB_r) -{ - if(!m_video.sub_halt) // no access if sub CPU is not halted. - return 0xff; - return fm7_vram_r(space,offset+0xb000); -} - -WRITE8_MEMBER(fm7_state::fm7_vram0_w) -{ - fm7_vram_banked_w(space,offset,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram1_w) -{ - fm7_vram_banked_w(space,offset+0x1000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram2_w) -{ - fm7_vram_banked_w(space,offset+0x2000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram3_w) -{ - fm7_vram_banked_w(space,offset+0x3000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram4_w) -{ - fm7_vram_banked_w(space,offset+0x4000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram5_w) -{ - fm7_vram_banked_w(space,offset+0x5000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram6_w) -{ - fm7_vram_banked_w(space,offset+0x6000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram7_w) -{ - fm7_vram_banked_w(space,offset+0x7000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram8_w) -{ - fm7_vram_banked_w(space,offset+0x8000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vram9_w) -{ - fm7_vram_banked_w(space,offset+0x9000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vramA_w) -{ - fm7_vram_banked_w(space,offset+0xa000,data); -} - -WRITE8_MEMBER(fm7_state::fm7_vramB_w) -{ - fm7_vram_banked_w(space,offset+0xb000,data); -} - -/* - * Sub CPU: I/O port 0xd408 - * - * On read, enables the CRT display - * On write, disables the CRT display - */ -READ8_MEMBER(fm7_state::fm7_crt_r) -{ - m_video.crt_enable = 1; - return 0xff; -} - -WRITE8_MEMBER(fm7_state::fm7_crt_w) -{ - m_video.crt_enable = 0; -} - -/* - * Sub CPU: I/O ports 0xd40e - 0xd40f - * - * 0xd40e: bits 0-6 - offset in bytes (high byte) (bit 6 is used for 400 line video only) - * 0xd40f: bits 0-7 - offset in bytes (low byte) - */ -WRITE8_MEMBER(fm7_state::fm7_vram_offset_w) -{ - UINT16 new_offset = 0; - - switch(offset) - { - case 0: - if(m_video.active_video_page != 0) - new_offset = ((data & 0x3f) << 8) | (m_video.vram_offset2 & 0x00ff); - else - new_offset = ((data & 0x3f) << 8) | (m_video.vram_offset & 0x00ff); - break; - case 1: // low 5 bits are used on FM-77AV and later only - if(m_type == SYS_FM7) - new_offset = (m_video.vram_offset & 0xff00) | (data & 0xe0); - else - { - if(m_video.active_video_page != 0) - { - if(m_video.fine_offset != 0) - new_offset = (m_video.vram_offset2 & 0xff00) | (data & 0xff); - else - new_offset = (m_video.vram_offset2 & 0xff00) | (data & 0xe0); - } - else - { - if(m_video.fine_offset != 0) - new_offset = (m_video.vram_offset & 0xff00) | (data & 0xff); - else - new_offset = (m_video.vram_offset & 0xff00) | (data & 0xe0); - } - } - break; - } - if(m_video.active_video_page != 0) - m_video.vram_offset2 = new_offset; - else - m_video.vram_offset = new_offset; -} - -/* - * Main CPU: port 0xfd37 - * Multipage - * Port is write-only - * - * bits 6-4: VRAM planes to display (G,R,B) (1=disable) - * bits 2-0: VRAM CPU access (G,R,B) (1=disable) - */ -WRITE8_MEMBER(fm7_state::fm7_multipage_w) -{ - m_video.multi_page = data & 0x77; -} - -/* - * Main CPU: I/O ports 0xfd38-0xfd3f - * Colour palette. - * Each port represents one of eight colours. Palette is 3-bit. - * bit 2 = Green - * bit 1 = Red - * bit 0 = Blue - */ -READ8_MEMBER(fm7_state::fm7_palette_r) -{ - return m_video.fm7_pal[offset]; -} - -WRITE8_MEMBER(fm7_state::fm7_palette_w) -{ - m_palette->set_pen_color(offset, rgb_t(pal1bit(data >> 1), pal1bit(data >> 2), pal1bit(data >> 0))); - m_video.fm7_pal[offset] = data & 0x07; -} - -/* - * Main CPU: 0xfd30 - 0xfd34 - * Analog colour palette (FM-77AV and later only) - * All ports are write-only. - * - * fd30: colour select(?) high 4 bits (LC11-LC8) - * fd31: colour select(?) low 8 bits (LC7-LC0) - * fd32: blue level (4 bits) - * fd33: red level (4 bits) - * fd34: green level (4 bits) - */ -WRITE8_MEMBER(fm7_state::fm77av_analog_palette_w) -{ - int val; - - switch(offset) - { - case 0: - val = ((data & 0x0f) << 8) | (m_video.fm77av_pal_selected & 0x00ff); - m_video.fm77av_pal_selected = val; - break; - case 1: - val = data | (m_video.fm77av_pal_selected & 0x0f00); - m_video.fm77av_pal_selected = val; - break; - case 2: - m_av_palette->set_pen_blue_level(m_video.fm77av_pal_selected, data << 4); - break; - case 3: - m_av_palette->set_pen_red_level(m_video.fm77av_pal_selected, data << 4); - break; - case 4: - m_av_palette->set_pen_green_level(m_video.fm77av_pal_selected, data << 4); - break; - } -} - - -/* - * Sub CPU: 0xd430 - BUSY/NMI/Bank register (FM77AV series only) - * - * On read: bit 7 - 0 if in VBlank - * bit 4 - ALU busy(0)/ready(1) - * bit 2 - VSync status (1 if active?) - * bit 0 - RESET - * - * On write: bits 1-0 - CGROM select (maps to 0xd800) - * bit 2 - fine offset enable (enables OA4-OA0 bits in VRAM offset) - * bit 5 - active VRAM page - * bit 6 - display VRAM page - * bit 7 - NMI mask register (1=mask) - */ -READ8_MEMBER(fm7_state::fm77av_video_flags_r) -{ - UINT8 ret = 0xff; - - if(machine().first_screen()->vblank()) - ret &= ~0x80; - - if(m_alu.busy != 0) - ret &= ~0x10; - - if(m_video.vsync_flag == 0) - ret &= ~0x04; - - if(!m_video.sub_reset) - ret &= ~0x01; - - return ret; -} - -WRITE8_MEMBER(fm7_state::fm77av_video_flags_w) -{ - UINT8* RAM = memregion("subsyscg")->base(); - - m_video.cgrom = data & 0x03; - membank("bank20")->set_base(RAM+(m_video.cgrom*0x800)); - m_video.fine_offset = data & 0x04; - m_video.active_video_page = data & 0x20; - m_video.display_video_page = data & 0x40; - m_video.nmi_mask = data & 0x80; -} - -/* - * Main CPU: port 0xfd12 - * Sub mode status register (FM-77AV or later) - * bit 6 (R/W) - Video mode width(?) 0=640 (default) 1=320. - * bit 1 (R/O) - DISPTMG status (0=blank) - * bit 0 (R/O) - VSync status (1=sync?) - */ -READ8_MEMBER(fm7_state::fm77av_sub_modestatus_r) -{ - UINT8 ret = 0x00; - - ret |= 0xbc; - ret |= (m_video.modestatus & 0x40); - - if(!machine().first_screen()->vblank()) - ret |= 0x02; - - if(m_video.vsync_flag != 0) - ret |= 0x01; - - return ret; -} - -WRITE8_MEMBER(fm7_state::fm77av_sub_modestatus_w) -{ - m_video.modestatus = data & 0x40; - if(data & 0x40) - { - rectangle rect(0, 320-1, 0, 200-1); - machine().first_screen()->configure(320,200,rect,HZ_TO_ATTOSECONDS(60)); - } - else - { - rectangle rect(0, 640-1, 0, 200-1); - machine().first_screen()->configure(640,200,rect,HZ_TO_ATTOSECONDS(60)); - } -} - -/* - * Main CPU: port 0xfd13 - * Sub Bank select register - * - * bits 1 and 0 select which subsys ROM to be banked into sub CPU space - * on the FM-77AV40 and later, bit 2 can also selected to bank in sub monitor RAM. - */ -WRITE8_MEMBER(fm7_state::fm77av_sub_bank_w) -{ -// UINT8* RAM = memregion("sub")->base(); - UINT8* ROM; - - if((data & 0x03) == (m_sb_prev & 0x03)) - return; - - m_video.subrom = data & 0x03; - switch (data & 0x03) - { - case 0x00: // Type C, 640x200 (as used on the FM-7) - ROM = memregion("subsys_c")->base(); - // membank(20)->set_base(ROM); - membank("bank21")->set_base(ROM+0x800); - logerror("VID: Sub ROM Type C selected\n"); - break; - case 0x01: // Type A, 640x200 - ROM = memregion("subsys_a")->base(); - // membank(20)->set_base(RAM+0xd800); - membank("bank21")->set_base(ROM); - logerror("VID: Sub ROM Type A selected\n"); - break; - case 0x02: // Type B, 320x200 - ROM = memregion("subsys_b")->base(); - // membank(20)->set_base(RAM+0xd800); - membank("bank21")->set_base(ROM); - logerror("VID: Sub ROM Type B selected\n"); - break; - case 0x03: // CG Font? - ROM = memregion("subsyscg")->base(); - // membank(20)->set_base(RAM+0xd800); - membank("bank21")->set_base(ROM); - logerror("VID: Sub ROM CG selected\n"); - break; - } - // reset sub CPU, set busy flag, set reset flag - m_sub->set_input_line(INPUT_LINE_RESET,PULSE_LINE); - m_video.sub_busy = 0x80; - m_video.sub_halt = 0; - m_video.sub_reset = 1; - m_sb_prev = data; -} - -/* - * Sub CPU: ports 0xd410-0xd42b (FM-77AV and later only) - * Video operations - * - * 0xd410 (R/W): Command register - * bit 7: 0=DIS 1=Start - * bits 6-5: MBIT1, MBIT2 - * bits 2-0: Draw mode - * 0 0 0 - PSET - * 0 1 0 - OR - * 0 1 1 - AND - * 1 0 0 - XOR - * 1 0 1 - NOT - * 1 1 0 - TILEPAINT - * 1 1 1 - COMPARE - * 0xd411 (R/W): Logical colour (bits 2-0, G-R-B) - * 0xd412 (R/W): Mask register - * 0xd413 (R) : Compare data (?) - * 0xd413-1a(W): Compare registers (bits 2-0, G-R-B, 1=mask (bit 7)) - * 0xd41b (R/W): Bank disable register (bits 2-0, G-R-B, 1=disable, bit 3 must always be 1) - * 0xd41c-1e(W): Tilepaint registers (B-R-G) - * 0xd420-21(W): Line Address offset register (High-Low, A13-A1) - * 0xd422-23(W): Line style pattern register (High-Low, P15-P0) - * 0xd424-25(W): Line X0 (High-Low, X9-X0) - * 0xd426-27(W): Line Y0 (High-Low, Y8-Y0) - * 0xd428-29(W): Line X1 (High-Low, X9-X0) - * 0xd42a-2b(W): Line Y1 (High-Low, Y8-Y0) - */ -READ8_MEMBER(fm7_state::fm77av_alu_r) -{ - switch(offset) - { - case 0x00: - logerror("ALU: read from command register (%02x)\n",m_alu.command); - return m_alu.command; - case 0x01: - logerror("ALU: read from logical colour\n"); - return m_alu.lcolour; - case 0x02: - logerror("ALU: read from mask register\n"); - return m_alu.mask; - case 0x03: - logerror("ALU: read from compare data register (%02x)\n",m_alu.compare_data); - return m_alu.compare_data; - case 0x0b: - logerror("ALU: read from bank disable register\n"); - return 0xf7 | m_alu.bank_disable; - default: - logerror("ALU: read from invalid register 0x%02x\n",offset); - return 0xff; - } -} - -WRITE8_MEMBER(fm7_state::fm77av_alu_w) -{ - UINT16 dat; - - switch(offset) - { - case 0x00: - m_alu.command = data; - logerror("ALU: write to command register - %02x\n",data); - break; - case 0x01: - m_alu.lcolour = data & 0x07; - logerror("ALU: write to logical colour - %02x\n",data); - break; - case 0x02: - m_alu.mask = data; - logerror("ALU: write to mask register - %02x\n",data); - break; - case 0x03: - case 0x04: - case 0x05: - case 0x06: - case 0x07: - case 0x08: - case 0x09: - case 0x0a: - m_alu.compare[offset-3] = data; - logerror("ALU: write to compare register %i - %02x\n",offset-3,data); - break; - case 0x0b: - m_alu.bank_disable = data & 0x03; -// logerror("ALU: write to bank disable register - %02x\n",data); - break; - case 0x0c: - m_alu.tilepaint_b = data; -// logerror("ALU: write to tilepaint (blue) register - %02x\n",data); - break; - case 0x0d: - m_alu.tilepaint_r = data; -// logerror("ALU: write to tilepaint (red) register - %02x\n",data); - break; - case 0x0e: - m_alu.tilepaint_g = data; -// logerror("ALU: write to tilepaint (green) register - %02x\n",data); - break; - case 0x10: - dat = ((data & 0x1f) << 8) | (m_alu.addr_offset & 0x00ff); - m_alu.addr_offset = dat; -// logerror("ALU: write to address offset (high) register - %02x (%04x)\n",data,m_alu.addr_offset); - break; - case 0x11: - dat = (m_alu.addr_offset & 0xff00) | data; - m_alu.addr_offset = dat; -// logerror("ALU: write to address offset (low) register - %02x (%04x)\n",data,m_alu.addr_offset); - break; - case 0x12: - dat = (data << 8) | (m_alu.line_style & 0x00ff); - m_alu.line_style = dat; -// logerror("ALU: write to line style (high) register - %02x (%04x)\n",data,m_alu.line_style); - break; - case 0x13: - dat = (m_alu.line_style & 0xff00) | data; - m_alu.line_style = dat; -// logerror("ALU: write to line style (low) register - %02x (%04x)\n",data,m_alu.line_style); - break; - case 0x14: - dat = ((data & 0x03) << 8) | (m_alu.x0 & 0x00ff); - m_alu.x0 = dat; -// logerror("ALU: write to X0 (high) register - %02x (%04x)\n",data,m_alu.x0); - break; - case 0x15: - dat = (m_alu.x0 & 0xff00) | data; - m_alu.x0 = dat; -// logerror("ALU: write to X0 (low) register - %02x (%04x)\n",data,m_alu.x0); - break; - case 0x16: - dat = ((data & 0x01) << 8) | (m_alu.y0 & 0x00ff); - m_alu.y0 = dat; -// logerror("ALU: write to Y0 (high) register - %02x (%04x)\n",data,m_alu.y0); - break; - case 0x17: - dat = (m_alu.y0 & 0xff00) | data; - m_alu.y0 = dat; -// logerror("ALU: write to Y0 (low) register - %02x (%04x)\n",data,m_alu.y0); - break; - case 0x18: - dat = ((data & 0x03) << 8) | (m_alu.x1 & 0x00ff); - m_alu.x1 = dat; -// logerror("ALU: write to X1 (high) register - %02x (%04x)\n",data,m_alu.x1); - break; - case 0x19: - dat = (m_alu.x1 & 0xff00) | data; - m_alu.x1 = dat; -// logerror("ALU: write to X1 (low) register - %02x (%04x)\n",data,m_alu.x1); - break; - case 0x1a: - dat = ((data & 0x01) << 8) | (m_alu.y1 & 0x00ff); - m_alu.y1 = dat; -// logerror("ALU: write to Y1 (high) register - %02x (%04x)\n",data,m_alu.y1); - break; - case 0x1b: - dat = (m_alu.y1 & 0xff00) | data; - m_alu.y1 = dat; - // draw line - fm77av_line_draw(); -// logerror("ALU: write to Y1 (low) register - %02x (%04x)\n",data,m_alu.y1); - break; - default: - logerror("ALU: write 0x%02x to invalid register 0x%02x\n",data,offset); - } -} - -TIMER_CALLBACK_MEMBER(fm7_state::fm77av_vsync) -{ - if(param == 0) // start of vsync - { - m_video.vsync_flag = 1; - m_fm77av_vsync_timer->adjust(attotime::from_usec(510),1); // VSync length for 200 line modes = 0.51ms - } - else - { - m_video.vsync_flag = 0; - m_fm77av_vsync_timer->adjust(machine().first_screen()->time_until_vblank_end()); - } -} - -// called when banked into main CPU space by the MMR, available only if sub CPU is halted -READ8_MEMBER(fm7_state::fm7_sub_ram_ports_banked_r) -{ - UINT8* RAM = memregion("maincpu")->base(); - UINT8* ROM; - - if(!m_video.sub_halt) - return 0xff; - - if(offset < 0x380) // work RAM - return RAM[0x1d000+offset]; - if(offset >= 0x380 && offset < 0x400) // shared RAM - return m_shared_ram[offset-0x380]; - if(offset >= 0x500 && offset < 0x800) // work RAM - return RAM[0x1d000+offset]; - if(offset > 0x800) // CGROM - { - ROM = memregion("subsyscg")->base(); - return ROM[(m_video.cgrom*0x800)+(offset-0x800)]; - } - - if(offset >= 0x410 && offset <= 0x42b) - return fm77av_alu_r(space,offset-0x410); - - switch(offset) - { - case 0x400: - case 0x401: - return fm7_sub_keyboard_r(space,offset-0x400); - case 0x402: - return fm7_cancel_ack(space,0); - case 0x403: - return fm7_sub_beeper_r(space,0); - case 0x404: - return fm7_attn_irq_r(space,0); - case 0x408: - return fm7_crt_r(space,0); - case 0x409: - return fm7_vram_access_r(space,0); - case 0x40a: - return fm7_sub_busyflag_r(space,0); - case 0x430: - return fm77av_video_flags_r(space,0); - case 0x431: - case 0x432: - return fm77av_key_encoder_r(space,offset-0x431); - default: - logerror("Unmapped read from sub CPU port 0xd%03x via MMR banking\n",offset); - return 0xff; - } -} - -WRITE8_MEMBER(fm7_state::fm7_sub_ram_ports_banked_w) -{ - UINT8* RAM = memregion("maincpu")->base(); - - if(!m_video.sub_halt) - return; - - if(offset < 0x380) // work RAM - { - RAM[0x1d000+offset] = data; - return; - } - if(offset >= 0x380 && offset < 0x400) // shared RAM - { - m_shared_ram[offset-0x380] = data; - return; - } - if(offset >= 0x500 && offset < 0x800) // work RAM - { - RAM[0x1d000+offset] = data; - return; - } - - if(offset >= 0x410 && offset <= 0x42b) - { - fm77av_alu_w(space,offset-0x410,data); - return; - } - - switch(offset) - { - case 0x408: - fm7_crt_w(space,0,data); - break; - case 0x409: - fm7_vram_access_w(space,0,data); - break; - case 0x40a: - fm7_sub_busyflag_w(space,0,data); - break; - case 0x40e: - case 0x40f: - fm7_vram_offset_w(space,offset-0x40e,data); - break; - case 0x430: - fm77av_video_flags_w(space,0,data); - break; - case 0x431: - case 0x432: - fm77av_key_encoder_w(space,offset-0x431,data); - break; - default: - logerror("Unmapped write of 0x%02x to sub CPU port 0xd%03x via MMR banking\n",data,offset); - } -} - -READ8_MEMBER(fm7_state::fm7_console_ram_banked_r) -{ - UINT8* RAM = memregion("maincpu")->base(); - - if(!m_video.sub_halt) - return 0xff; - - return RAM[0x1c000+offset]; -} - -WRITE8_MEMBER(fm7_state::fm7_console_ram_banked_w) -{ - UINT8* RAM = memregion("maincpu")->base(); - - if(!m_video.sub_halt) - return; - - RAM[0x1c000+offset] = data; -} - -void fm7_state::video_start() -{ - m_video.vram_access = 0; - m_video.crt_enable = 0; - m_video.vram_offset = 0x0000; - m_video.vram_offset2 = 0x0000; - m_video.sub_reset = 0; - m_video.multi_page = 0; - m_video.subrom = 0; - m_video.cgrom = 0; - m_video.fine_offset = 0; - m_video.nmi_mask = 0; - m_video.active_video_page = 0; - m_video.display_video_page = 0; - m_video.vsync_flag = 0; -} - -UINT32 fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT8 code_r = 0,code_g = 0,code_b = 0; - UINT8 code_r2 = 0,code_g2 = 0,code_b2 = 0; - UINT8 code_r3 = 0,code_g3 = 0,code_b3 = 0; - UINT8 code_r4 = 0,code_g4 = 0,code_b4 = 0; - UINT16 col; - int y, x, b; - UINT16 page = 0x0000; - - if(m_video.display_video_page != 0) - page = 0xc000; - - if(m_video.crt_enable == 0) - return 0; - - if(m_video.modestatus & 0x40) // 320x200 mode - { - for (y = 0; y < 200; y++) - { - for (x = 0; x < 40; x++) - { - if(!(m_video.multi_page & 0x40)) - { - code_r = m_video_ram[0x8000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; - code_r2 = m_video_ram[0xa000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; - code_r3 = m_video_ram[0x14000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; - code_r4 = m_video_ram[0x16000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; - } - if(!(m_video.multi_page & 0x20)) - { - code_g = m_video_ram[0x4000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; - code_g2 = m_video_ram[0x6000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; - code_g3 = m_video_ram[0x10000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; - code_g4 = m_video_ram[0x12000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; - } - if(!(m_video.multi_page & 0x10)) - { - code_b = m_video_ram[0x0000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; - code_b2 = m_video_ram[0x2000 + ((y*40 + x + m_video.vram_offset) & 0x1fff)]; - code_b3 = m_video_ram[0xc000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; - code_b4 = m_video_ram[0xe000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; - } - for (b = 0; b < 8; b++) - { - col = (((code_b >> b) & 0x01) ? 8 : 0) | (((code_b2 >> b) & 0x01) ? 4 : 0) | (((code_b3 >> b) & 0x01) ? 2 : 0) | (((code_b4 >> b) & 0x01) ? 1 : 0); - col |= (((code_g >> b) & 0x01) ? 128 : 0) | (((code_g2 >> b) & 0x01) ? 64 : 0) | (((code_g3 >> b) & 0x01) ? 32 : 0) | (((code_g4 >> b) & 0x01) ? 16 : 0); - col |= (((code_r >> b) & 0x01) ? 2048 : 0) | (((code_r2 >> b) & 0x01) ? 1024 : 0) | (((code_r3 >> b) & 0x01) ? 512 : 0) | (((code_r4 >> b) & 0x01) ? 256 : 0); - bitmap.pix32(y, x*8+(7-b)) = m_av_palette->pen_color(col); - } - } - } - } - else - { - for (y = 0; y < 200; y++) - { - for (x = 0; x < 80; x++) - { - if(!(m_video.multi_page & 0x40)) - code_r = m_video_ram[page + 0x8000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; - if(!(m_video.multi_page & 0x20)) - code_g = m_video_ram[page + 0x4000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; - if(!(m_video.multi_page & 0x10)) - code_b = m_video_ram[page + 0x0000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; - for (b = 0; b < 8; b++) - { - col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); - bitmap.pix32(y, x*8+(7-b)) = m_palette->pen_color(col); - } - } - } - } - return 0; -} diff --git a/src/mess/video/fmtowns.c b/src/mess/video/fmtowns.c deleted file mode 100644 index 1790f856bc4..00000000000 --- a/src/mess/video/fmtowns.c +++ /dev/null @@ -1,1729 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald - -/* - * FM Towns video hardware - * - * Resolution: from 320x200 to 768x512 - * - * Up to two graphics layers - * - * Sprites - * - * CRTC registers (16-bit): - * - * 0: HSync width 1 - * 1: HSync width 2 - * 4: HSync total - * 5: VSync width 1 - * 6: VSync width 2 - * 7: Equalising pulse accountable time (what?) - * 8: VSync total - * - * 9: - * 10: Graphic layer 0 horizontal start/end - * 11: - * 12: Graphic layer 1 horizontal start/end - * - * 13: - * 14: Graphic layer 0 vertical start/end - * 15: - * 16: Graphic layer 1 vertical start/end - * - * 17: Graphic layer 0 initial address? - * 18: Graphic layer 0 horizontal adjust - * 19: Graphic layer 0 field indirect address offset - * 20: Graphic layer 0 line indirect address offset - * - * 21-24: As above, but for Graphic layer 1 - * - * 27: Layer zoom. bit 0 = x2 horizontal zoom layer 0 - * to be confirmed bit 5 = x2 vertical zoom layer 0 - * bit 9 = x2 horizontal zoom layer 1 - * bit 13 = x2 vertical zoom layer 1 - * - * 28: Control register 0 - * VSync enable (bit 15) (blank display?) - * Scroll type (layer 0 = bit 4, layer 1 = bit 5) - * 0 = spherical scroll, 1 = cylindrical scroll - * - * 29: Control register 1 - * Dot clock (bits 1 and 0) - * 0x00 = 28.6363MHz - * 0x01 = 24.5454MHz - * 0x02 = 25.175MHz - * 0x03 = 21.0525MHz (default?) - * - * 30: Dummy register - * - * 31: Control register 2 - * - * Video registers: - * - * 0: Graphic layer(s) type: (others likely exist) - * bit 4 = 2 layers - * bits 2-3 = layer 1 mode - * bits 0-1 = layer 0 mode - * mode: 1 = 16 colours, 2 = 256 colours, 3 = highcolour (16-bit) - * 0 = disabled? - * - * 1: Layer reverse (priority?) (bit 0) - * YM (bit 2) - unknown - * peltype (bits 4 and 5) - * - * - * Sprite registers: - * - * 0,1: Maximum sprite (last one to render?) (10-bit) - * - * 1 (bit 7): Enable sprite display - * - * 2,3: X offset (9-bit) - * - * 4,5: Y offset (9-bit) - * - * 6 (bit 4): VRAM location (0=0x40000,1=0x60000) - * - */ - -#include "emu.h" -#include "machine/pic8259.h" -#include "machine/ram.h" -#include "includes/fmtowns.h" - -//#define CRTC_REG_DISP 1 -//#define SPR_DEBUG 1 - -//static UINT32 pshift; // for debugging - -void towns_state::towns_crtc_refresh_mode() -{ - unsigned int width,height; - - rectangle scr(0, m_video.towns_crtc_reg[4], 0, m_video.towns_crtc_reg[8] / 2); - - // layer 0 - width = m_video.towns_crtc_reg[10] - m_video.towns_crtc_reg[9]; - height = (m_video.towns_crtc_reg[14] - m_video.towns_crtc_reg[13]) / 2; - m_video.towns_crtc_layerscr[0].min_x = scr.xcenter() - (width / 2); - m_video.towns_crtc_layerscr[0].min_y = scr.ycenter() - (height / 2); - m_video.towns_crtc_layerscr[0].max_x = scr.xcenter() + (width / 2); - m_video.towns_crtc_layerscr[0].max_y = scr.ycenter() + (height / 2); - - // layer 1 - width = m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]; - height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / 2; - m_video.towns_crtc_layerscr[1].min_x = scr.xcenter() - (width / 2); - m_video.towns_crtc_layerscr[1].min_y = scr.ycenter() - (height / 2); - m_video.towns_crtc_layerscr[1].max_x = scr.xcenter() + (width / 2); - m_video.towns_crtc_layerscr[1].max_y = scr.ycenter() + (height / 2); - - // sanity checks - if(scr.max_x == 0 || scr.max_y == 0) - return; - if(scr.max_x <= scr.min_x || scr.max_y <= scr.min_y) - return; - - machine().first_screen()->configure(scr.max_x+1,scr.max_y+1,scr,HZ_TO_ATTOSECONDS(60)); -} - -READ8_MEMBER( towns_state::towns_gfx_high_r ) -{ - return m_towns_gfxvram[offset]; -} - -WRITE8_MEMBER( towns_state::towns_gfx_high_w ) -{ - m_towns_gfxvram[offset] = data; -} - -READ8_MEMBER( towns_state::towns_gfx_r ) -{ - UINT8 ret = 0; - - if(m_towns_mainmem_enable != 0) - return m_messram->pointer()[offset+0xc0000]; - - offset = offset << 2; - - if(m_video.towns_vram_page_sel != 0) - offset += 0x20000; - - ret = (((m_towns_gfxvram[offset] >> m_video.towns_vram_rplane) << 7) & 0x80) - | (((m_towns_gfxvram[offset] >> m_video.towns_vram_rplane) << 2) & 0x40) - | (((m_towns_gfxvram[offset+1] >> m_video.towns_vram_rplane) << 5) & 0x20) - | (((m_towns_gfxvram[offset+1] >> m_video.towns_vram_rplane)) & 0x10) - | (((m_towns_gfxvram[offset+2] >> m_video.towns_vram_rplane) << 3) & 0x08) - | (((m_towns_gfxvram[offset+2] >> m_video.towns_vram_rplane) >> 2) & 0x04) - | (((m_towns_gfxvram[offset+3] >> m_video.towns_vram_rplane) << 1) & 0x02) - | (((m_towns_gfxvram[offset+3] >> m_video.towns_vram_rplane) >> 4) & 0x01); - - return ret; -} - -WRITE8_MEMBER( towns_state::towns_gfx_w ) -{ - if(m_towns_mainmem_enable != 0) - { - m_messram->pointer()[offset+0xc0000] = data; - return; - } - offset = offset << 2; - if(m_video.towns_vram_page_sel != 0) - offset += 0x20000; - if(m_video.towns_vram_wplane & 0x08) - { - m_towns_gfxvram[offset] &= ~0x88; - m_towns_gfxvram[offset] |= ((data & 0x80) >> 4) | ((data & 0x40) << 1); - m_towns_gfxvram[offset + 1] &= ~0x88; - m_towns_gfxvram[offset + 1] |= ((data & 0x20) >> 2) | ((data & 0x10) << 3); - m_towns_gfxvram[offset + 2] &= ~0x88; - m_towns_gfxvram[offset + 2] |= ((data & 0x08)) | ((data & 0x04) << 5); - m_towns_gfxvram[offset + 3] &= ~0x88; - m_towns_gfxvram[offset + 3] |= ((data & 0x02) << 2) | ((data & 0x01) << 7); - } - if(m_video.towns_vram_wplane & 0x04) - { - m_towns_gfxvram[offset] &= ~0x44; - m_towns_gfxvram[offset] |= ((data & 0x80) >> 5) | ((data & 0x40)); - m_towns_gfxvram[offset + 1] &= ~0x44; - m_towns_gfxvram[offset + 1] |= ((data & 0x20) >> 3) | ((data & 0x10) << 2); - m_towns_gfxvram[offset + 2] &= ~0x44; - m_towns_gfxvram[offset + 2] |= ((data & 0x08) >> 1) | ((data & 0x04) << 4); - m_towns_gfxvram[offset + 3] &= ~0x44; - m_towns_gfxvram[offset + 3] |= ((data & 0x02) << 1) | ((data & 0x01) << 6); - } - if(m_video.towns_vram_wplane & 0x02) - { - m_towns_gfxvram[offset] &= ~0x22; - m_towns_gfxvram[offset] |= ((data & 0x80) >> 6) | ((data & 0x40) >> 1); - m_towns_gfxvram[offset + 1] &= ~0x22; - m_towns_gfxvram[offset + 1] |= ((data & 0x20) >> 4) | ((data & 0x10) << 1); - m_towns_gfxvram[offset + 2] &= ~0x22; - m_towns_gfxvram[offset + 2] |= ((data & 0x08) >> 2) | ((data & 0x04) << 3); - m_towns_gfxvram[offset + 3] &= ~0x22; - m_towns_gfxvram[offset + 3] |= ((data & 0x02)) | ((data & 0x01) << 5); - } - if(m_video.towns_vram_wplane & 0x01) - { - m_towns_gfxvram[offset] &= ~0x11; - m_towns_gfxvram[offset] |= ((data & 0x80) >> 7) | ((data & 0x40) >> 2); - m_towns_gfxvram[offset + 1] &= ~0x11; - m_towns_gfxvram[offset + 1] |= ((data & 0x20) >> 5) | ((data & 0x10)); - m_towns_gfxvram[offset + 2] &= ~0x11; - m_towns_gfxvram[offset + 2] |= ((data & 0x08) >> 3) | ((data & 0x04) << 2); - m_towns_gfxvram[offset + 3] &= ~0x11; - m_towns_gfxvram[offset + 3] |= ((data & 0x02) >> 1) | ((data & 0x01) << 4); - } -} - -void towns_state::towns_update_kanji_offset() -{ - // this is a little over the top... - if(m_video.towns_kanji_code_h < 0x30) - { - m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) - | (((m_video.towns_kanji_code_l - 0x20) & 0x20) << 8) - | (((m_video.towns_kanji_code_l - 0x20) & 0x40) << 6) - | ((m_video.towns_kanji_code_h & 0x07) << 9); - } - else if(m_video.towns_kanji_code_h < 0x70) - { - m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) - + (((m_video.towns_kanji_code_l - 0x20) & 0x60) << 8) - + ((m_video.towns_kanji_code_h & 0x0f) << 9) - + (((m_video.towns_kanji_code_h - 0x30) & 0x70) * 0xc00) - + 0x8000; - } - else - { - m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) - | (((m_video.towns_kanji_code_l - 0x20) & 0x20) << 8) - | (((m_video.towns_kanji_code_l - 0x20) & 0x40) << 6) - | ((m_video.towns_kanji_code_h & 0x07) << 9) - | 0x38000; - } -} - -READ8_MEMBER( towns_state::towns_video_cff80_r ) -{ - UINT8* ROM = m_user->base(); - - switch(offset) - { - case 0x00: // mix register - return m_video.towns_crtc_mix; - case 0x01: // read/write plane select (bit 0-3 write, bit 6-7 read) - return ((m_video.towns_vram_rplane << 6) & 0xc0) | m_video.towns_vram_wplane; - case 0x02: // display planes (bits 0-2,5), display page select (bit 4) - return m_video.towns_display_plane | m_video.towns_display_page_sel; - case 0x03: // VRAM page select (bit 5) - if(m_video.towns_vram_page_sel != 0) - return 0x10; - else - return 0x00; - case 0x06: - if(m_video.towns_vblank_flag != 0) - return 0x10; - else - return 0x00; - case 0x16: // Kanji character data - return ROM[(m_video.towns_kanji_offset << 1) + 0x180000]; - case 0x17: // Kanji character data - return ROM[(m_video.towns_kanji_offset++ << 1) + 0x180001]; - case 0x19: // ANK CG ROM - if(m_towns_ankcg_enable != 0) - return 0x01; - else - return 0x00; - default: - logerror("VGA: read from invalid or unimplemented memory-mapped port %05x\n",0xcff80+offset*4); - } - - return 0; -} - -WRITE8_MEMBER( towns_state::towns_video_cff80_w ) -{ - switch(offset) - { - case 0x00: // mix register - m_video.towns_crtc_mix = data; - break; - case 0x01: // read/write plane select (bit 0-3 write, bit 6-7 read) - m_video.towns_vram_wplane = data & 0x0f; - m_video.towns_vram_rplane = (data & 0xc0) >> 6; - towns_update_video_banks(space); - //logerror("VGA: VRAM wplane select = 0x%02x\n",towns_vram_wplane); - break; - case 0x02: // display plane (bits 0-2), display page select (bit 4) - m_video.towns_display_plane = data & 0x27; - m_video.towns_display_page_sel = data & 0x10; - break; - case 0x03: // VRAM page select (bit 4) - m_video.towns_vram_page_sel = data & 0x10; - break; - case 0x14: // Kanji offset (high) - m_video.towns_kanji_code_h = data & 0x7f; - towns_update_kanji_offset(); - //logerror("VID: Kanji code set (high) = %02x %02x\n",towns_kanji_code_h,towns_kanji_code_l); - break; - case 0x15: // Kanji offset (low) - m_video.towns_kanji_code_l = data & 0x7f; - towns_update_kanji_offset(); - //logerror("VID: Kanji code set (low) = %02x %02x\n",towns_kanji_code_h,towns_kanji_code_l); - break; - case 0x19: // ANK CG ROM - m_towns_ankcg_enable = data & 0x01; - towns_update_video_banks(space); - break; - default: - logerror("VGA: write %08x to invalid or unimplemented memory-mapped port %05x\n",data,0xcff80+offset); - } -} - -READ8_MEMBER( towns_state::towns_video_cff80_mem_r ) -{ - if(m_towns_mainmem_enable != 0) - return m_messram->pointer()[offset+0xcff80]; - - return towns_video_cff80_r(space,offset); -} - -WRITE8_MEMBER( towns_state::towns_video_cff80_mem_w ) -{ - if(m_towns_mainmem_enable != 0) - { - m_messram->pointer()[offset+0xcff80] = data; - return; - } - towns_video_cff80_w(space,offset,data); -} - -/* - * port 0x440-0x443 - CRTC - * 0x440 = register select - * 0x442/3 = register data (16-bit) - * 0x448 = shifter register select - * 0x44a = shifter register data (8-bit) - * - */ -READ8_MEMBER(towns_state::towns_video_440_r) -{ - UINT8 ret = 0; - UINT16 xpos,ypos; - - switch(offset) - { - case 0x00: - return m_video.towns_crtc_sel; - case 0x02: -// logerror("CRTC: reading register %i (0x442) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]); - if(m_video.towns_crtc_sel == 30) - return 0x00; - return m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0x00ff; - case 0x03: -// logerror("CRTC: reading register %i (0x443) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]); - if(m_video.towns_crtc_sel == 30) - { - // check video position - xpos = space.machine().first_screen()->hpos(); - ypos = space.machine().first_screen()->vpos(); - - if(xpos < (m_video.towns_crtc_reg[0] & 0xfe)) - ret |= 0x02; - if(ypos < (m_video.towns_crtc_reg[6] & 0x1f)) - ret |= 0x04; - if(xpos < m_video.towns_crtc_layerscr[0].max_x && xpos > m_video.towns_crtc_layerscr[0].min_x) - ret |= 0x10; - if(xpos < m_video.towns_crtc_layerscr[1].max_x && xpos > m_video.towns_crtc_layerscr[1].min_x) - ret |= 0x20; - if(ypos < m_video.towns_crtc_layerscr[0].max_y && ypos > m_video.towns_crtc_layerscr[0].min_y) - ret |= 0x40; - if(ypos < m_video.towns_crtc_layerscr[1].max_y && ypos > m_video.towns_crtc_layerscr[1].min_y) - ret |= 0x80; - - return ret; - } - return (m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0xff00) >> 8; - case 0x08: - return m_video.towns_video_sel; - case 0x0a: - logerror("Video: reading register %i (0x44a) [%02x]\n",m_video.towns_video_sel,m_video.towns_video_reg[m_video.towns_video_sel]); - return m_video.towns_video_reg[m_video.towns_video_sel]; - case 0x0c: - if(m_video.towns_dpmd_flag != 0) - { - m_video.towns_dpmd_flag = 0; - ret |= 0x80; - } - ret |= (m_video.towns_sprite_flag ? 0x02 : 0x00); // Sprite drawing flag - ret |= m_video.towns_sprite_page & 0x01; - return ret; - case 0x10: - return m_video.towns_sprite_sel; - case 0x12: - logerror("SPR: reading register %i (0x452) [%02x]\n",m_video.towns_sprite_sel,m_video.towns_sprite_reg[m_video.towns_sprite_sel]); - return m_video.towns_sprite_reg[m_video.towns_sprite_sel]; - //default: - //logerror("VID: read port %04x\n",offset+0x440); - } - return 0x00; -} - -WRITE8_MEMBER(towns_state::towns_video_440_w) -{ - switch(offset) - { - case 0x00: - m_video.towns_crtc_sel = data; - break; - case 0x02: -// logerror("CRTC: writing register %i (0x442) [%02x]\n",towns_crtc_sel,data); - m_video.towns_crtc_reg[m_video.towns_crtc_sel] = - (m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0xff00) | data; - towns_crtc_refresh_mode(); - break; - case 0x03: -// logerror("CRTC: writing register %i (0x443) [%02x]\n",towns_crtc_sel,data); - m_video.towns_crtc_reg[m_video.towns_crtc_sel] = - (m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0x00ff) | (data << 8); - towns_crtc_refresh_mode(); - break; - case 0x08: - m_video.towns_video_sel = data & 0x01; - break; - case 0x0a: - logerror("Video: writing register %i (0x44a) [%02x]\n",m_video.towns_video_sel,data); - m_video.towns_video_reg[m_video.towns_video_sel] = data; - break; - case 0x10: - m_video.towns_sprite_sel = data & 0x07; - break; - case 0x12: - logerror("SPR: writing register %i (0x452) [%02x]\n",m_video.towns_sprite_sel,data); - m_video.towns_sprite_reg[m_video.towns_sprite_sel] = data; - break; - default: - logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0x440); - } -} - -READ8_MEMBER(towns_state::towns_video_5c8_r) -{ - //logerror("VID: read port %04x\n",offset+0x5c8); - switch(offset) - { - case 0x00: // 0x5c8 - disable TVRAM? - if(m_video.towns_tvram_enable != 0) - { - m_video.towns_tvram_enable = 0; - return 0x80; - } - else - return 0x00; - } - return 0x00; -} - -WRITE8_MEMBER(towns_state::towns_video_5c8_w) -{ - pic8259_device* dev = m_pic_slave; - - switch(offset) - { - case 0x02: // 0x5ca - VSync clear? - dev->ir3_w(0); - if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set low\n"); - //towns_vblank_flag = 0; - break; - } - logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0x5c8); -} - -void towns_state::towns_update_palette() -{ - UINT8 entry = m_video.towns_palette_select; - UINT8 r = m_video.towns_palette_r[entry]; - UINT8 g = m_video.towns_palette_g[entry]; - UINT8 b = m_video.towns_palette_b[entry]; - m_palette->set_pen_color(entry, r, g, b); -} - -/* Video/CRTC - * - * 0xfd90 - palette colour select - * 0xfd92/4/6 - BRG value - * 0xfd98-9f - degipal(?) - */ -READ8_MEMBER(towns_state::towns_video_fd90_r) -{ - UINT8 ret = 0; - UINT16 xpos; - -// logerror("VID: read port %04x\n",offset+0xfd90); - switch(offset) - { - case 0x00: - return m_video.towns_palette_select; - case 0x02: - return m_video.towns_palette_b[m_video.towns_palette_select]; - case 0x04: - return m_video.towns_palette_r[m_video.towns_palette_select]; - case 0x06: - return m_video.towns_palette_g[m_video.towns_palette_select]; - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - return m_video.towns_degipal[offset-0x08]; - case 0x10: // "sub status register" - // check video position - xpos = space.machine().first_screen()->hpos(); - - if(xpos < m_video.towns_crtc_layerscr[0].max_x && xpos > m_video.towns_crtc_layerscr[0].min_x) - ret |= 0x02; - if(m_video.towns_vblank_flag) - ret |= 0x01; - return ret; - } - return 0x00; -} - -WRITE8_MEMBER(towns_state::towns_video_fd90_w) -{ - switch(offset) - { - case 0x00: - m_video.towns_palette_select = data; - break; - case 0x02: - m_video.towns_palette_b[m_video.towns_palette_select] = data; - towns_update_palette(); - break; - case 0x04: - m_video.towns_palette_r[m_video.towns_palette_select] = data; - towns_update_palette(); - break; - case 0x06: - m_video.towns_palette_g[m_video.towns_palette_select] = data; - towns_update_palette(); - break; - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - m_video.towns_degipal[offset-0x08] = data; - m_video.towns_dpmd_flag = 1; - break; - case 0x10: - m_video.towns_layer_ctrl = data; - break; - } - logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0xfd90); -} - -READ8_MEMBER(towns_state::towns_video_ff81_r) -{ - return ((m_video.towns_vram_rplane << 6) & 0xc0) | m_video.towns_vram_wplane; -} - -WRITE8_MEMBER(towns_state::towns_video_ff81_w) -{ - m_video.towns_vram_wplane = data & 0x0f; - m_video.towns_vram_rplane = (data & 0xc0) >> 6; - towns_update_video_banks(space); - logerror("VGA: VRAM wplane select (I/O) = 0x%02x\n",m_video.towns_vram_wplane); -} - -READ8_MEMBER(towns_state::towns_video_unknown_r) -{ - return 0x00; -} - -/* - * Sprite RAM, low memory - * Writing to 0xc8xxx or 0xcaxxx activates TVRAM - * Writing to I/O port 0x5c8 disables TVRAM - * (bit 7 returns high if TVRAM was previously active) - * - * In TVRAM mode: - * 0xc8000-0xc8fff: ASCII text (2 bytes each: ISO646 code, then attribute) - * 0xca000-0xcafff: JIS code - */ -READ8_MEMBER(towns_state::towns_spriteram_low_r) -{ - UINT8* RAM = m_messram->pointer(); - UINT8* ROM = m_user->base(); - - if(offset < 0x1000) - { // 0xc8000-0xc8fff - if(m_towns_mainmem_enable == 0) - { -// if(towns_tvram_enable == 0) -// return towns_sprram[offset]; -// else - return m_towns_txtvram[offset]; - } - else - return RAM[offset + 0xc8000]; - } - if(offset >= 0x1000 && offset < 0x2000) - { // 0xc9000-0xc9fff - return RAM[offset + 0xc9000]; - } - if(offset >= 0x2000 && offset < 0x3000) - { // 0xca000-0xcafff - if(m_towns_mainmem_enable == 0) - { - if(m_towns_ankcg_enable != 0 && offset < 0x2800) - return ROM[0x180000 + 0x3d000 + (offset-0x2000)]; -// if(towns_tvram_enable == 0) -// return m_towns_sprram[offset]; -// else - return m_towns_txtvram[offset]; - } - else - return RAM[offset + 0xca000]; - } - return 0x00; -} - -WRITE8_MEMBER(towns_state::towns_spriteram_low_w) -{ - UINT8* RAM = m_messram->pointer(); - - if(offset < 0x1000) - { // 0xc8000-0xc8fff - m_video.towns_tvram_enable = 1; - if(m_towns_mainmem_enable == 0) - m_towns_txtvram[offset] = data; - else - RAM[offset + 0xc8000] = data; - } - if(offset >= 0x1000 && offset < 0x2000) - { - RAM[offset + 0xc9000] = data; - } - if(offset >= 0x2000 && offset < 0x3000) - { // 0xca000-0xcafff - m_video.towns_tvram_enable = 1; - if(m_towns_mainmem_enable == 0) - m_towns_txtvram[offset] = data; - else - RAM[offset + 0xca000] = data; - } -} - -READ8_MEMBER( towns_state::towns_spriteram_r ) -{ - return m_towns_txtvram[offset]; -} - -WRITE8_MEMBER( towns_state::towns_spriteram_w ) -{ - m_towns_txtvram[offset] = data; -} - -/* - * Sprites - * - * Max. 1024, 16x16, 16 colours per sprite - * 128kB Sprite RAM (8kB attributes, 120kB pattern/colour data) - * Sprites are rendered directly to VRAM layer 1 (VRAM offset 0x40000 or 0x60000) - * - * Sprite RAM format: - * 4 words per sprite - * +0: X position (10-bit) - * +2: Y position (10-bit) - * +4: Sprite Attribute - * bit 15: enforce offsets (regs 2-5) - * bit 12,13: flip sprite - * bits 10-0: Sprite RAM offset containing sprite pattern - * TODO: other attributes (zoom?) - * +6: Sprite Colour - * bit 15: use colour data in located in sprite RAM offset in bits 11-0 (x32) - */ -void towns_state::render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) -{ - UINT16 xpos,ypos; - UINT16 col,pixel; - UINT32 voffset; - UINT16 xstart,xend,ystart,yend; - int xdir,ydir; - int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1); - int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2); - - if(xflip) - { - xstart = x+14; - xend = x-2; - xdir = -2; - } - else - { - xstart = x+1; - xend = x+17; - xdir = 2; - } - if(yflip) - { - ystart = y+15; - yend = y-1; - ydir = -1; - } - else - { - ystart = y; - yend = y+16; - ydir = 1; - } - xstart &= 0x1ff; - xend &= 0x1ff; - ystart &= 0x1ff; - yend &= 0x1ff; - poffset &= 0x1ffff; - - for(ypos=ystart;ypos!=yend;ypos+=ydir,ypos&=0x1ff) - { - for(xpos=xstart;xpos!=xend;xpos+=xdir,xpos&=0x1ff) - { - if(m_video.towns_sprite_page != 0) - voffset = 0x20000; - else - voffset = 0x00000; - pixel = (m_towns_txtvram[poffset] & 0xf0) >> 4; - col = m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8); - voffset += (m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos - voffset += (xpos & 0x1ff) * 2; - if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) - || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) - { - if(xpos < width && ypos < height && pixel != 0) - { - m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; - m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; - } - } - if(xflip) - voffset+=2; - else - voffset-=2; - pixel = m_towns_txtvram[poffset] & 0x0f; - col = m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8); - if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) - || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) - { - if(xpos < width && ypos < height && pixel != 0) - { - m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; - m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; - } - } - poffset++; - poffset &= 0x1ffff; - } - } -} - -void towns_state::render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) -{ - UINT16 xpos,ypos; - UINT16 col; - UINT32 voffset; - UINT16 xstart,ystart,xend,yend; - int xdir,ydir; - int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1); - int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2); - - if(xflip) - { - xstart = x+16; - xend = x; - xdir = -1; - } - else - { - xstart = x+1; - xend = x+17; - xdir = 1; - } - if(yflip) - { - ystart = y+15; - yend = y-1; - ydir = -1; - } - else - { - ystart = y; - yend = y+16; - ydir = 1; - } - xstart &= 0x1ff; - xend &= 0x1ff; - ystart &= 0x1ff; - yend &= 0x1ff; - poffset &= 0x1ffff; - - for(ypos=ystart;ypos!=yend;ypos+=ydir,ypos&=0x1ff) - { - for(xpos=xstart;xpos!=xend;xpos+=xdir,xpos&=0x1ff) - { - if(m_video.towns_sprite_page != 0) - voffset = 0x20000; - else - voffset = 0x00000; - col = m_towns_txtvram[poffset] | (m_towns_txtvram[poffset+1] << 8); - voffset += (m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos - voffset += (xpos & 0x1ff) * 2; - if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) - || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) - { - if(xpos < width && ypos < height && col < 0x8000) - { - m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; - m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; - } - } - poffset+=2; - poffset &= 0x1ffff; - } - } -} - -void towns_state::draw_sprites(const rectangle* rect) -{ - UINT16 sprite_limit = (m_video.towns_sprite_reg[0] | (m_video.towns_sprite_reg[1] << 8)) & 0x3ff; - int n; - UINT16 x,y,attr,colour; - UINT16 xoff = (m_video.towns_sprite_reg[2] | (m_video.towns_sprite_reg[3] << 8)) & 0x1ff; - UINT16 yoff = (m_video.towns_sprite_reg[4] | (m_video.towns_sprite_reg[5] << 8)) & 0x1ff; - UINT32 poffset,coffset; - - if(!(m_video.towns_sprite_reg[1] & 0x80)) - return; - - // clears VRAM for each frame? - if(m_video.towns_sprite_page == 0) - memset(m_towns_gfxvram+0x40000,0x80,0x20000); - else - memset(m_towns_gfxvram+0x60000,0x80,0x20000); - - for(n=sprite_limit;n<1024;n++) - { - x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); - y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); - attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); - colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); - if(attr & 0x8000) - { - x += xoff; - y += yoff; - } - x &= 0x1ff; - y &= 0x1ff; - - if(colour & 0x8000) - { - poffset = (attr & 0x3ff) << 7; - coffset = (colour & 0xfff) << 5; -#ifdef SPR_DEBUG - printf("Sprite4 #%i, X %i Y %i Attr %04x Col %04x Poff %08x Coff %08x\n", - n,x,y,attr,colour,poffset,coffset); -#endif - if(!(colour & 0x2000)) - render_sprite_4((poffset)&0x1ffff,coffset,x,y,attr&0x2000,attr&0x1000,rect); - } - else - { - poffset = (attr & 0x3ff) << 7; -#ifdef SPR_DEBUG - printf("Sprite16 #%i, X %i Y %i Attr %04x Col %04x Poff %08x", - n,x,y,attr,colour,poffset); -#endif - if(!(colour & 0x2000)) - render_sprite_16((poffset)&0x1ffff,x,y,attr&0x2000,attr&0x1000,rect); - } - } - - if(m_video.towns_sprite_page == 0) // flip VRAM page - m_video.towns_sprite_page = 1; - else - m_video.towns_sprite_page = 0; - - m_video.towns_sprite_flag = 1; // we are now drawing - m_video.sprite_timer->adjust(m_maincpu->cycles_to_attotime(128 * (1025-sprite_limit))); -} - -void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) -{ - UINT32 off = 0; - int x; - UINT16 colour; - int hzoom = 1; - int linesize; - UINT32 scroll; - - if(layer == 0) - linesize = m_video.towns_crtc_reg[20] * 4; - else - linesize = m_video.towns_crtc_reg[24] * 4; - - if(m_video.towns_display_page_sel != 0) - off = 0x20000; - -// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) -// off = 0x20000; - - if(layer != 0) - { - if(!(m_video.towns_video_reg[0] & 0x10)) - return; - if(!(m_video.towns_crtc_reg[28] & 0x10)) - off += (m_video.towns_crtc_reg[21]) << 2; // initial offset - else - { - scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 2)); - off += scroll; - } - off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); - hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; - } - else - { - if(!(m_video.towns_crtc_reg[28] & 0x20)) - off += (m_video.towns_crtc_reg[17]) << 2; // initial offset - else - { - scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 2)); - off += scroll; - } - off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); - hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; - } - - off += line * linesize; - off &= ~0x01; - - if(hzoom == 1) - { - for(x=rect->min_x;xmax_x;x++) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - - colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; - if(colour < 0x8000) - { - bitmap.pix32(scanline, x) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - } - off+=2; - } - } - - if(hzoom == 2) - { // x2 horizontal zoom - for(x=rect->min_x;xmax_x;x+=2) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; - if(colour < 0x8000) - { - bitmap.pix32(scanline, x) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+1) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - } - off+=2; - } - } - - if(hzoom == 3) - { // x3 horizontal zoom - for(x=rect->min_x;xmax_x;x+=3) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; - if(colour < 0x8000) - { - bitmap.pix32(scanline, x) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+1) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+2) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - } - off+=2; - } - } - - if(hzoom == 4) - { // x4 horizontal zoom - for(x=rect->min_x;xmax_x;x+=4) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; - if(colour < 0x8000) - { - bitmap.pix32(scanline, x) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+1) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+2) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+3) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - } - off+=2; - } - } - - if(hzoom == 5) - { // x5 horizontal zoom - for(x=rect->min_x;xmax_x;x+=5) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; - if(colour < 0x8000) - { - bitmap.pix32(scanline, x) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+1) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+2) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+3) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - bitmap.pix32(scanline, x+4) = - ((colour & 0x001f) << 3) - | ((colour & 0x7c00) << 1) - | ((colour & 0x03e0) << 14); - } - off+=2; - } - } -} - -void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) -{ - int off = 0; - int x; - UINT8 colour; - int hzoom = 1; - int linesize; - UINT32 scroll; - - if(m_video.towns_display_page_sel != 0) - off = 0x20000; - -// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) -// off = 0x20000; - - if(layer == 0) - linesize = m_video.towns_crtc_reg[20] * 8; - else - linesize = m_video.towns_crtc_reg[24] * 8; - - if(layer != 0) - { - if(!(m_video.towns_video_reg[0] & 0x10)) - return; - if(!(m_video.towns_crtc_reg[28] & 0x10)) - off += m_video.towns_crtc_reg[21] << 3; // initial offset - else - { - scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 3)); - off += scroll; - } - off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); - hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; - } - else - { - if(!(m_video.towns_crtc_reg[28] & 0x20)) - off += m_video.towns_crtc_reg[17] << 3; // initial offset - else - { - scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3)); - off += scroll; - } - off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); - hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; - } - - off += line * linesize; - - if(hzoom == 1) - { - for(x=rect->min_x;xmax_x;x++) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)]; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - } - off++; - } - } - - if(hzoom == 2) - { // x2 horizontal zoom - for(x=rect->min_x;xmax_x;x+=2) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)+1]; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - } - off++; - } - } - - if(hzoom == 3) - { // x3 horizontal zoom - for(x=rect->min_x;xmax_x;x+=3) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)+1]; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - bitmap.pix32(scanline, x+2) = m_palette->pen(colour); - } - off++; - } - } - - if(hzoom == 4) - { // x4 horizontal zoom - for(x=rect->min_x;xmax_x;x+=4) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)+1]; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - bitmap.pix32(scanline, x+2) = m_palette->pen(colour); - bitmap.pix32(scanline, x+3) = m_palette->pen(colour); - } - off++; - } - } - - if(hzoom == 5) - { // x5 horizontal zoom - for(x=rect->min_x;xmax_x;x+=5) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)+1]; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - bitmap.pix32(scanline, x+2) = m_palette->pen(colour); - bitmap.pix32(scanline, x+3) = m_palette->pen(colour); - bitmap.pix32(scanline, x+4) = m_palette->pen(colour); - } - off++; - } - } -} - -void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) -{ - int off = 0; - int x; - UINT8 colour; - int hzoom = 1; - int linesize; - UINT32 scroll; - - if(m_video.towns_display_page_sel != 0) - off = 0x20000; - -// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) -// off = 0x20000; - - if(layer == 0) - linesize = m_video.towns_crtc_reg[20] * 4; - else - linesize = m_video.towns_crtc_reg[24] * 4; - - if(layer != 0) - { - if(!(m_video.towns_video_reg[0] & 0x10)) - return; - if(!(m_video.towns_crtc_reg[28] & 0x10)) - off += m_video.towns_crtc_reg[21]; // initial offset - else - { - scroll = ((m_video.towns_crtc_reg[21] & 0xfc00)<<2) | (((m_video.towns_crtc_reg[21] & 0x3ff)<<2)); - off += scroll; - } - off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); - hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; - } - else - { - if(!(m_video.towns_crtc_reg[28] & 0x20)) - off += m_video.towns_crtc_reg[17]; // initial offset - else - { - scroll = ((m_video.towns_crtc_reg[17] & 0xfc00)<<2) | (((m_video.towns_crtc_reg[17] & 0x3ff)<<2)); - off += scroll; - } - off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); - hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; - } - - off += line * linesize; - - if(hzoom == 1) - { - for(x=rect->min_x;xmax_x;x+=2) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; - if(colour != 0) - { - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - } - colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - } - off++; - } - } - - if(hzoom == 2) - { // x2 horizontal zoom - for(x=rect->min_x;xmax_x;x+=4) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; - if(colour != 0) - { - bitmap.pix32(scanline, x+2) = m_palette->pen(colour); - bitmap.pix32(scanline, x+3) = m_palette->pen(colour); - } - colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - } - off++; - } - } - - if(hzoom == 3) - { // x3 horizontal zoom - for(x=rect->min_x;xmax_x;x+=6) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; - if(colour != 0) - { - bitmap.pix32(scanline, x+3) = m_palette->pen(colour); - bitmap.pix32(scanline, x+4) = m_palette->pen(colour); - bitmap.pix32(scanline, x+5) = m_palette->pen(colour); - } - colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - bitmap.pix32(scanline, x+2) = m_palette->pen(colour); - } - off++; - } - } - - if(hzoom == 4) - { // x4 horizontal zoom - for(x=rect->min_x;xmax_x;x+=8) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; - if(colour != 0) - { - bitmap.pix32(scanline, x+4) = m_palette->pen(colour); - bitmap.pix32(scanline, x+5) = m_palette->pen(colour); - bitmap.pix32(scanline, x+6) = m_palette->pen(colour); - bitmap.pix32(scanline, x+7) = m_palette->pen(colour); - } - colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - bitmap.pix32(scanline, x+2) = m_palette->pen(colour); - bitmap.pix32(scanline, x+3) = m_palette->pen(colour); - } - off++; - } - } - - if(hzoom == 5) - { // x5 horizontal zoom - for(x=rect->min_x;xmax_x;x+=10) - { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; - if(colour != 0) - { - bitmap.pix32(scanline, x+5) = m_palette->pen(colour); - bitmap.pix32(scanline, x+6) = m_palette->pen(colour); - bitmap.pix32(scanline, x+7) = m_palette->pen(colour); - bitmap.pix32(scanline, x+8) = m_palette->pen(colour); - bitmap.pix32(scanline, x+9) = m_palette->pen(colour); - } - colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; - if(colour != 0) - { - bitmap.pix32(scanline, x) = m_palette->pen(colour); - bitmap.pix32(scanline, x+1) = m_palette->pen(colour); - bitmap.pix32(scanline, x+2) = m_palette->pen(colour); - bitmap.pix32(scanline, x+3) = m_palette->pen(colour); - bitmap.pix32(scanline, x+4) = m_palette->pen(colour); - } - off++; - } - } -} - -void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer) -{ - int line; - int scanline; - int height; - - if(layer == 0) - { - scanline = rect->min_y; - height = (rect->max_y - rect->min_y); - if(m_video.towns_crtc_reg[27] & 0x0010) - height /= 2; - switch(m_video.towns_video_reg[0] & 0x03) - { - case 0x01: - for(line=0;linemin_y; - height = (rect->max_y - rect->min_y); - if(m_video.towns_crtc_reg[27] & 0x1000) - height /= 2; - switch(m_video.towns_video_reg[0] & 0x0c) - { - case 0x04: - for(line=0;linebase(); - int a,b; - - // all characters are 16 pixels high - vram_addr = (x * 4) + (y * (linesize * 16)); - - if((attr & 0xc0) == 0) - rom_addr = 0x3d800 + (ascii * 128); - else - { - code_h = (jis & 0xff00) >> 8; - code_l = jis & 0x00ff; - if(code_h < 0x30) - { - rom_addr = ((code_l & 0x1f) << 4) - | (((code_l - 0x20) & 0x20) << 8) - | (((code_l - 0x20) & 0x40) << 6) - | ((code_h & 0x07) << 9); - } - else if(code_h < 0x70) - { - rom_addr = ((code_l & 0x1f) << 4) - + (((code_l - 0x20) & 0x60) << 8) - + ((code_h & 0x0f) << 9) - + (((code_h - 0x30) & 0x70) * 0xc00) - + 0x8000; - } - else - { - rom_addr = ((code_l & 0x1f) << 4) - | (((code_l - 0x20) & 0x20) << 8) - | (((code_l - 0x20) & 0x40) << 6) - | ((code_h & 0x07) << 9) - | 0x38000; - } - } - colour = attr & 0x07; - if(attr & 0x20) - colour |= 0x08; - - for(a=0;a<16;a++) // for each scanline - { - if((attr & 0xc0) == 0) - data = font_rom[0x180000 + rom_addr + a]; - else - { - if((attr & 0xc0) == 0x80) - data = font_rom[0x180000 + rom_addr + (a*2)]; - else - data = font_rom[0x180000 + rom_addr + (a*2) + 1]; - } - - if(attr & 0x08) - data = ~data; // inverse - - // and finally, put the data in VRAM - for(b=0;b<8;b+=2) - { - temp = 0; - if(data & (1<(dev)->ir3_w(0); // IRQ11 = VSync - if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set low\n"); - m_video.towns_vblank_flag = 0; -} - -INTERRUPT_GEN_MEMBER(towns_state::towns_vsync_irq) -{ - pic8259_device* dev = m_pic_slave; - dev->ir3_w(1); // IRQ11 = VSync - if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set high\n"); - m_video.towns_vblank_flag = 1; - machine().scheduler().timer_set(machine().first_screen()->time_until_vblank_end(), timer_expired_delegate(FUNC(towns_state::towns_vblank_end),this), 0, (void*)dev); - if(m_video.towns_tvram_enable) - draw_text_layer(); - if(m_video.towns_sprite_reg[1] & 0x80) - draw_sprites(&m_video.towns_crtc_layerscr[1]); -} - -void towns_state::video_start() -{ - m_video.towns_vram_wplane = 0x00; - m_video.towns_sprite_page = 0; - m_video.sprite_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(towns_state::towns_sprite_done),this)); -} - -UINT32 towns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0x00000000, cliprect); - - if(!(m_video.towns_video_reg[1] & 0x01)) - { - if(!machine().input().code_pressed(KEYCODE_Q)) - { - if((m_video.towns_layer_ctrl & 0x03) != 0) - towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[1],1); - } - if(!machine().input().code_pressed(KEYCODE_W)) - { - if((m_video.towns_layer_ctrl & 0x0c) != 0) - towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[0],0); - } - } - else - { - if(!machine().input().code_pressed(KEYCODE_Q)) - { - if((m_video.towns_layer_ctrl & 0x0c) != 0) - towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[0],0); - } - if(!machine().input().code_pressed(KEYCODE_W)) - { - if((m_video.towns_layer_ctrl & 0x03) != 0) - towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[1],1); - } - } - -#if 0 -#ifdef SPR_DEBUG - if(machine().input().code_pressed(KEYCODE_O)) - pshift+=0x80; - if(machine().input().code_pressed(KEYCODE_I)) - pshift-=0x80; - popmessage("Pixel shift = %08x",pshift); -#endif -#endif - -#ifdef CRTC_REG_DISP - popmessage("CRTC: %i %i %i %i %i %i %i %i %i\n%i %i %i %i | %i %i %i %i\n%04x %i %i %i | %04x %i %i %i\nZOOM: %04x\nVideo: %02x %02x\nText=%i Spr=%02x\nReg28=%04x", - m_video.towns_crtc_reg[0],m_video.towns_crtc_reg[1],m_video.towns_crtc_reg[2],m_video.towns_crtc_reg[3], - m_video.towns_crtc_reg[4],m_video.towns_crtc_reg[5],m_video.towns_crtc_reg[6],m_video.towns_crtc_reg[7], - m_video.towns_crtc_reg[8], - m_video.towns_crtc_reg[9],m_video.towns_crtc_reg[10],m_video.towns_crtc_reg[11],m_video.towns_crtc_reg[12], - m_video.towns_crtc_reg[13],m_video.towns_crtc_reg[14],m_video.towns_crtc_reg[15],m_video.towns_crtc_reg[16], - m_video.towns_crtc_reg[17],m_video.towns_crtc_reg[18],m_video.towns_crtc_reg[19],m_video.towns_crtc_reg[20], - m_video.towns_crtc_reg[21],m_video.towns_crtc_reg[22],m_video.towns_crtc_reg[23],m_video.towns_crtc_reg[24], - m_video.towns_crtc_reg[27],m_video.towns_video_reg[0],m_video.towns_video_reg[1],m_video.towns_tvram_enable,m_video.towns_sprite_reg[1] & 0x80, - m_video.towns_crtc_reg[28]); -#endif - - return 0; -} diff --git a/src/mess/video/galaxy.c b/src/mess/video/galaxy.c deleted file mode 100644 index 0f8184916f8..00000000000 --- a/src/mess/video/galaxy.c +++ /dev/null @@ -1,134 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha, Miodrag Milanovic -/*************************************************************************** - - galaxy.c - - Functions to emulate the video hardware of the Galaksija. - - 20/05/2008 - Real video implementation by Miodrag Milanovic - 01/03/2008 - Update by Miodrag Milanovic to make Galaksija video work with new SVN code -***************************************************************************/ - -#include "emu.h" -#include "includes/galaxy.h" -#include "cpu/z80/z80.h" - - -TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int y, x; - if (m_interrupts_enabled == TRUE) - { - UINT8 *gfx = m_region_gfx1->base(); - UINT8 dat = (m_latch_value & 0x3c) >> 2; - if ((m_gal_cnt >= 48 * 2) && (m_gal_cnt < 48 * 210)) // display on screen just m_first 208 lines - { - UINT8 mode = (m_latch_value >> 1) & 1; // bit 2 latch represents mode - UINT16 addr = (m_maincpu->state_int(Z80_I) << 8) | m_maincpu->state_int(Z80_R) | ((m_latch_value & 0x80) ^ 0x80); - if (mode == 0) - { - // Text mode - if (m_first == 0 && (m_maincpu->state_int(Z80_R) & 0x1f) == 0) - { - // Due to a fact that on real processor latch value is set at - // the end of last cycle we need to skip dusplay of double - // m_first char in each row - m_code = 0x00; - m_first = 1; - } - else - { - m_code = space.read_byte(addr) & 0xbf; - m_code += (m_code & 0x80) >> 1; - m_code = gfx[(m_code & 0x7f) +(dat << 7 )] ^ 0xff; - m_first = 0; - } - y = m_gal_cnt / 48 - 2; - x = (m_gal_cnt % 48) * 8; - - m_bitmap.pix16(y, x ) = (m_code >> 0) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 1) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 2) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 3) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 4) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 5) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 6) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 7) & 1; - } - else - { // Graphics mode - if (m_first < 4 && (m_maincpu->state_int(Z80_R) & 0x1f) == 0) - { - // Due to a fact that on real processor latch value is set at - // the end of last cycle we need to skip dusplay of 4 times - // m_first char in each row - m_code = 0x00; - m_first++; - } - else - { - m_code = space.read_byte(addr) ^ 0xff; - m_first = 0; - } - y = m_gal_cnt / 48 - 2; - x = (m_gal_cnt % 48) * 8; - - /* hack - until calc of R is fixed in Z80 */ - if (x == 11 * 8 && y == 0) - { - m_start_addr = addr; - } - if ((x / 8 >= 11) && (x / 8 < 44)) - { - m_code = space.read_byte(m_start_addr + y * 32 + (m_gal_cnt % 48) - 11) ^ 0xff; - } - else - { - m_code = 0x00; - } - /* end of hack */ - - m_bitmap.pix16(y, x ) = (m_code >> 0) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 1) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 2) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 3) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 4) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 5) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 6) & 1; x++; - m_bitmap.pix16(y, x ) = (m_code >> 7) & 1; - } - } - m_gal_cnt++; - } -} - -void galaxy_state::galaxy_set_timer() -{ - m_gal_cnt = 0; - m_gal_video_timer->adjust(attotime::zero, 0, attotime::from_hz(6144000 / 8)); -} - -void galaxy_state::video_start() -{ - m_gal_cnt = 0; - - m_gal_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxy_state::gal_video),this)); - m_gal_video_timer->adjust(attotime::zero, 0, attotime::never); - - machine().first_screen()->register_screen_bitmap(m_bitmap); -} - -UINT32 galaxy_state::screen_update_galaxy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_gal_video_timer->adjust(attotime::zero, 0, attotime::never); - if (m_interrupts_enabled == FALSE) - { - const rectangle black_area(0, 384 - 1, 0, 208 - 1); - m_bitmap.fill(0, black_area); - } - m_interrupts_enabled = FALSE; - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} diff --git a/src/mess/video/galeb.c b/src/mess/video/galeb.c deleted file mode 100644 index d7bd7bb7b4a..00000000000 --- a/src/mess/video/galeb.c +++ /dev/null @@ -1,45 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Galeb video driver by Miodrag Milanovic - - 01/03/2008 Updated to work with latest SVN code - 22/02/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/galeb.h" - - -const gfx_layout galeb_charlayout = -{ - 8, 8, /* 8x8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {7, 6, 5, 4, 3, 2, 1, 0}, - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, - 8*8 /* size of one char */ -}; - -void galeb_state::video_start() -{ -} - -UINT32 galeb_state::screen_update_galeb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - - for(y = 0; y < 16; y++ ) - { - for(x = 0; x < 48; x++ ) - { - int code = m_video_ram[15 + x + y*64]; - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*8); - } - } - return 0; -} diff --git a/src/mess/video/gamecom.c b/src/mess/video/gamecom.c deleted file mode 100644 index 29bad2d9ce7..00000000000 --- a/src/mess/video/gamecom.c +++ /dev/null @@ -1,71 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol, Robbbert - -#include "includes/gamecom.h" - -#define Y_PIXELS 200 - - -TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) - { - // draw line - m_base_address = ( m_p_ram[SM8521_LCDC] & 0x40 ) ? 0x2000 : 0x0000; - - if ( ~m_p_ram[SM8521_LCDC] & 0x80 ) - { - rectangle rec(0, Y_PIXELS - 1, m_scanline, m_scanline); - m_bitmap.fill(0, rec ); - return; - } - else - { - UINT8 *line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; - int pal[4]; - int i; - - switch( m_p_ram[SM8521_LCDC] & 0x30 ) - { - case 0x00: - pal[0] = 4; - pal[1] = 3; - pal[2] = 2; - pal[3] = 0; - break; - case 0x10: - pal[0] = 4; - pal[1] = 3; - pal[2] = 1; - pal[3] = 0; - break; - case 0x20: - pal[0] = 4; - pal[1] = 3; - pal[2] = 1; - pal[3] = 0; - break; - case 0x30: - pal[0] = 4; - pal[1] = 2; - pal[2] = 1; - pal[3] = 0; - break; - } - for( i = 0; i < 40; i++ ) - { - UINT8 p = line[i]; - m_bitmap.pix16(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; - m_bitmap.pix16(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; - m_bitmap.pix16(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; - m_bitmap.pix16(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; - } - } - - m_scanline = ( m_scanline + 1 ) % Y_PIXELS; -} - -void gamecom_state::video_start() -{ - m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_scanline),this)); - m_scanline_timer->adjust( machine().first_screen()->time_until_pos(0 ), 0, machine().first_screen()->scan_period() ); - machine().first_screen()->register_screen_bitmap(m_bitmap); -} diff --git a/src/mess/video/gb_lcd.c b/src/mess/video/gb_lcd.c deleted file mode 100644 index b46aece5a15..00000000000 --- a/src/mess/video/gb_lcd.c +++ /dev/null @@ -1,2852 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - gb_lcd.c - - Video file to handle emulation of the Nintendo Game Boy. - - Original code Carsten Sorensen 1998 - Mess modifications, bug fixes and speedups Hans de Goede 1998 - Bug fixes, SGB and GBC code Anthony Kruize 2002 - Improvements to match real hardware Wilbert Pol 2006-2008 - - Timing is not accurate enough: - - Mode 3 takes 172 cycles (measuered with logic analyzer by costis) - -***************************************************************************/ - -#include "emu.h" -//#include "cpu/lr35902/lr35902.h" -#include "video/gb_lcd.h" - -/* Interrupts (copied from includes/gb.h)... */ -#define VBL_INT 0 /* V-Blank */ -#define LCD_INT 1 /* LCD Status */ -#define TIM_INT 2 /* Timer */ -#define SIO_INT 3 /* Serial I/O */ -#define EXT_INT 4 /* Joypad */ - - - -#define LCDCONT m_vid_regs[0x00] /* LCD control register */ -#define LCDSTAT m_vid_regs[0x01] /* LCD status register */ -#define SCROLLY m_vid_regs[0x02] /* Starting Y position of the background */ -#define SCROLLX m_vid_regs[0x03] /* Starting X position of the background */ -#define CURLINE m_vid_regs[0x04] /* Current screen line being scanned */ -#define CMPLINE m_vid_regs[0x05] /* Gen. int. when scan reaches this line */ -#define BGRDPAL m_vid_regs[0x07] /* Background palette */ -#define SPR0PAL m_vid_regs[0x08] /* Sprite palette #0 */ -#define SPR1PAL m_vid_regs[0x09] /* Sprite palette #1 */ -#define WNDPOSY m_vid_regs[0x0A] /* Window Y position */ -#define WNDPOSX m_vid_regs[0x0B] /* Window X position */ -#define KEY1 m_vid_regs[0x0D] /* Prepare speed switch */ -#define HDMA1 m_vid_regs[0x11] /* HDMA source high byte */ -#define HDMA2 m_vid_regs[0x12] /* HDMA source low byte */ -#define HDMA3 m_vid_regs[0x13] /* HDMA destination high byte */ -#define HDMA4 m_vid_regs[0x14] /* HDMA destination low byte */ -#define HDMA5 m_vid_regs[0x15] /* HDMA length/mode/start */ -#define GBCBCPS m_vid_regs[0x28] /* Backgound palette spec */ -#define GBCBCPD m_vid_regs[0x29] /* Backgound palette data */ -#define GBCOCPS m_vid_regs[0x2A] /* Object palette spec */ -#define GBCOCPD m_vid_regs[0x2B] /* Object palette data */ - -/* -- Super Game Boy specific -- */ -#define SGB_BORDER_PAL_OFFSET 64 /* Border colours stored from pal 4-7 */ -#define SGB_XOFFSET 48 /* GB screen starts at column 48 */ -#define SGB_YOFFSET 40 /* GB screen starts at row 40 */ - - -enum { - UNLOCKED=0, - LOCKED -}; - - -enum { - GB_LCD_STATE_LYXX_M3=1, - GB_LCD_STATE_LYXX_PRE_M0, - GB_LCD_STATE_LYXX_M0, - GB_LCD_STATE_LYXX_M0_SCX3, - GB_LCD_STATE_LYXX_M0_GBC_PAL, - GB_LCD_STATE_LYXX_M0_PRE_INC, - GB_LCD_STATE_LYXX_M0_INC, - GB_LCD_STATE_LY00_M2, - GB_LCD_STATE_LYXX_M2, - GB_LCD_STATE_LY9X_M1, - GB_LCD_STATE_LY9X_M1_INC, - GB_LCD_STATE_LY00_M1, - GB_LCD_STATE_LY00_M1_1, - GB_LCD_STATE_LY00_M1_2, - GB_LCD_STATE_LY00_M0 -}; - - -/* OAM contents on power up. - - The OAM area seems contain some kind of unit fingerprint. On each boot - the data is almost always the same. Some random bits are flipped between - different boots. It is currently unknown how much these fingerprints - differ between different units. - - OAM fingerprints taken from Wilbert Pol's own unit. - */ - -static const UINT8 dmg_oam_fingerprint[0x100] = { - 0xD8, 0xE6, 0xB3, 0x89, 0xEC, 0xDE, 0x11, 0x62, 0x0B, 0x7E, 0x48, 0x9E, 0xB9, 0x6E, 0x26, 0xC9, - 0x36, 0xF4, 0x7D, 0xE4, 0xD9, 0xCE, 0xFA, 0x5E, 0xA3, 0x77, 0x60, 0xFC, 0x1C, 0x64, 0x8B, 0xAC, - 0xB6, 0x74, 0x3F, 0x9A, 0x0E, 0xFE, 0xEA, 0xA9, 0x40, 0x3A, 0x7A, 0xB6, 0xF2, 0xED, 0xA8, 0x3E, - 0xAF, 0x2C, 0xD2, 0xF2, 0x01, 0xE0, 0x5B, 0x3A, 0x53, 0x6A, 0x1C, 0x6C, 0x20, 0xD9, 0x22, 0xB4, - 0x8C, 0x38, 0x71, 0x69, 0x3E, 0x93, 0xA3, 0x22, 0xCE, 0x76, 0x24, 0xE7, 0x1A, 0x14, 0x6B, 0xB1, - 0xF9, 0x3D, 0xBF, 0x3D, 0x74, 0x64, 0xCB, 0xF5, 0xDC, 0x9A, 0x53, 0xC6, 0x0E, 0x78, 0x34, 0xCB, - 0x42, 0xB3, 0xFF, 0x07, 0x73, 0xAE, 0x6C, 0xA2, 0x6F, 0x6A, 0xA4, 0x66, 0x0A, 0x8C, 0x40, 0xB3, - 0x9A, 0x3D, 0x39, 0x78, 0xAB, 0x29, 0xE7, 0xC5, 0x7A, 0xDD, 0x51, 0x95, 0x2B, 0xE4, 0x1B, 0xF6, - 0x31, 0x16, 0x34, 0xFE, 0x11, 0xF2, 0x5E, 0x11, 0xF3, 0x95, 0x66, 0xB9, 0x37, 0xC2, 0xAD, 0x6D, - 0x1D, 0xA7, 0x79, 0x06, 0xD7, 0xE5, 0x8F, 0xFA, 0x9C, 0x02, 0x0C, 0x31, 0x8B, 0x17, 0x2E, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static const UINT8 mgb_oam_fingerprint[0x100] = { - 0xB9, 0xE9, 0x0D, 0x69, 0xBB, 0x7F, 0x00, 0x80, 0xE9, 0x7B, 0x79, 0xA2, 0xFD, 0xCF, 0xD8, 0x0A, - 0x87, 0xEF, 0x44, 0x11, 0xFE, 0x37, 0x10, 0x21, 0xFA, 0xFF, 0x00, 0x17, 0xF6, 0x4F, 0x83, 0x03, - 0x3A, 0xF4, 0x00, 0x24, 0xBB, 0xAE, 0x05, 0x01, 0xFF, 0xF7, 0x12, 0x48, 0xA7, 0x5E, 0xF6, 0x28, - 0x5B, 0xFF, 0x2E, 0x10, 0xFF, 0xB9, 0x50, 0xC8, 0xAF, 0x77, 0x2C, 0x1A, 0x62, 0xD7, 0x81, 0xC2, - 0xFD, 0x5F, 0xA0, 0x94, 0xAF, 0xFF, 0x51, 0x20, 0x36, 0x76, 0x50, 0x0A, 0xFD, 0xF6, 0x20, 0x00, - 0xFE, 0xF7, 0xA0, 0x68, 0xFF, 0xFC, 0x29, 0x51, 0xA3, 0xFA, 0x06, 0xC4, 0x94, 0xFF, 0x39, 0x0A, - 0xFF, 0x6C, 0x20, 0x20, 0xF1, 0xAD, 0x0C, 0x81, 0x56, 0xFB, 0x03, 0x82, 0xFF, 0xFF, 0x08, 0x58, - 0x96, 0x7E, 0x01, 0x4D, 0xFF, 0xE4, 0x82, 0xE3, 0x3D, 0xBB, 0x54, 0x00, 0x3D, 0xF3, 0x04, 0x21, - 0xB7, 0x39, 0xCC, 0x10, 0xF9, 0x5B, 0x80, 0x50, 0x3F, 0x6A, 0x1C, 0x21, 0x1F, 0xFA, 0xA8, 0x52, - 0x5F, 0xB3, 0x44, 0xA1, 0x96, 0x1E, 0x00, 0x27, 0x63, 0x77, 0x30, 0x54, 0x37, 0x6F, 0x60, 0x22, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static const UINT8 cgb_oam_fingerprint[0x100] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0xFF, 0x09, 0x00, 0x9D, 0x61, 0xA8, 0x28, 0x36, 0x1E, 0x58, 0xAA, 0x75, 0x74, 0xA1, 0x42, - 0x05, 0x96, 0x40, 0x09, 0x41, 0x02, 0x60, 0x00, 0x1F, 0x11, 0x22, 0xBC, 0x31, 0x52, 0x22, 0x54, - 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04, - 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04, - 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04, - 0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04 -}; - -/* - For an AGS in CGB mode this data is: */ -#if 0 -static const UINT8 abs_oam_fingerprint[0x100] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, - 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, - 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, - 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, - 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF -}; -#endif - - -const device_type GB_LCD_DMG = &device_creator; -const device_type GB_LCD_MGB = &device_creator; -const device_type GB_LCD_SGB = &device_creator; -const device_type GB_LCD_CGB = &device_creator; - - - -gb_lcd_device::gb_lcd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_video_interface(mconfig, *this), - m_sgb_border_hack(0) -{ -} - -gb_lcd_device::gb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, GB_LCD_DMG, "DMG LCD", tag, owner, clock, "dmg_lcd", __FILE__), - device_video_interface(mconfig, *this), - m_sgb_border_hack(0) -{ -} - -mgb_lcd_device::mgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : gb_lcd_device(mconfig, GB_LCD_MGB, "MGB LCD", tag, owner, clock, "mgb_lcd", __FILE__) -{ -} - -sgb_lcd_device::sgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : gb_lcd_device(mconfig, GB_LCD_SGB, "SGB LCD", tag, owner, clock, "sgb_lcd", __FILE__) -{ -} - -cgb_lcd_device::cgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : gb_lcd_device(mconfig, GB_LCD_CGB, "CGB LCD", tag, owner, clock, "cgb_lcd", __FILE__) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void gb_lcd_device::common_start() -{ - m_screen->register_screen_bitmap(m_bitmap); - save_item(NAME(m_bitmap)); - m_oam = auto_alloc_array_clear(machine(), UINT8, 0x100); - - machine().save().register_postload(save_prepost_delegate(FUNC(gb_lcd_device::videoptr_restore), this)); - - m_maincpu = machine().device("maincpu"); - - save_pointer(NAME(m_oam), 0x100); - save_item(NAME(m_window_lines_drawn)); - save_item(NAME(m_vid_regs)); - save_item(NAME(m_bg_zbuf)); - - save_item(NAME(m_cgb_bpal)); - save_item(NAME(m_cgb_spal)); - - save_item(NAME(m_gb_bpal)); - save_item(NAME(m_gb_spal0)); - save_item(NAME(m_gb_spal1)); - - save_item(NAME(m_current_line)); - save_item(NAME(m_cmp_line)); - save_item(NAME(m_sprCount)); - save_item(NAME(m_sprite)); - save_item(NAME(m_previous_line)); - save_item(NAME(m_start_x)); - save_item(NAME(m_end_x)); - save_item(NAME(m_mode)); - save_item(NAME(m_state)); - save_item(NAME(m_lcd_irq_line)); - save_item(NAME(m_triggering_line_irq)); - save_item(NAME(m_line_irq)); - save_item(NAME(m_triggering_mode_irq)); - save_item(NAME(m_mode_irq)); - save_item(NAME(m_delayed_line_irq)); - save_item(NAME(m_sprite_cycles)); - save_item(NAME(m_scrollx_adjust)); - save_item(NAME(m_oam_locked)); - save_item(NAME(m_vram_locked)); - save_item(NAME(m_pal_locked)); - save_item(NAME(m_hdma_enabled)); - save_item(NAME(m_hdma_possible)); - save_item(NAME(m_gbc_mode)); - save_item(NAME(m_gb_tile_no_mod)); - save_item(NAME(m_vram_bank)); - - save_item(NAME(m_gb_chrgen_offs)); - save_item(NAME(m_gb_bgdtab_offs)); - save_item(NAME(m_gb_wndtab_offs)); - save_item(NAME(m_gbc_chrgen_offs)); - save_item(NAME(m_gbc_bgdtab_offs)); - save_item(NAME(m_gbc_wndtab_offs)); - - save_item(NAME(m_layer[0].enabled)); - save_item(NAME(m_layer[0].xindex)); - save_item(NAME(m_layer[0].xshift)); - save_item(NAME(m_layer[0].xstart)); - save_item(NAME(m_layer[0].xend)); - save_item(NAME(m_layer[0].bgline)); - save_item(NAME(m_layer[1].enabled)); - save_item(NAME(m_layer[1].xindex)); - save_item(NAME(m_layer[1].xshift)); - save_item(NAME(m_layer[1].xstart)); - save_item(NAME(m_layer[1].xend)); - save_item(NAME(m_layer[1].bgline)); -} - - -void gb_lcd_device::videoptr_restore() -{ - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; -} - -void cgb_lcd_device::videoptr_restore() -{ - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].gbc_map = m_vram + m_gbc_bgdtab_offs; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].gbc_map = m_vram + m_gbc_wndtab_offs; -} - - -void gb_lcd_device::device_start() -{ - common_start(); - m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_lcd_device::lcd_timer_proc),this)); - - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_vram), 0x2000); - - memcpy(m_oam, dmg_oam_fingerprint, 0x100); -} - -void mgb_lcd_device::device_start() -{ - common_start(); - m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mgb_lcd_device::lcd_timer_proc),this)); - - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_vram), 0x2000); - - memcpy(m_oam, mgb_oam_fingerprint, 0x100); -} - -void sgb_lcd_device::device_start() -{ - common_start(); - m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sgb_lcd_device::lcd_timer_proc),this)); - - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_vram), 0x2000); - - m_sgb_tile_data = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_sgb_tile_data), 0x2000); - - memset(m_sgb_tile_map, 0, sizeof(m_sgb_tile_map)); - - /* Some default colours for non-SGB games */ - m_sgb_pal[0] = 32767; - m_sgb_pal[1] = 21140; - m_sgb_pal[2] = 10570; - m_sgb_pal[3] = 0; - /* The rest of the colortable can be black */ - for (int i = 4; i < 8 * 16; i++) - m_sgb_pal[i] = 0; - - save_item(NAME(m_sgb_atf_data)); - save_item(NAME(m_sgb_atf)); - save_item(NAME(m_sgb_pal_data)); - save_item(NAME(m_sgb_pal_map)); - save_item(NAME(m_sgb_pal)); - save_item(NAME(m_sgb_tile_map)); - save_item(NAME(m_sgb_window_mask)); -} - -void cgb_lcd_device::device_start() -{ - common_start(); - m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cgb_lcd_device::lcd_timer_proc),this)); - - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x4000); - save_pointer(NAME(m_vram), 0x4000); - - memcpy(m_oam, cgb_oam_fingerprint, 0x100); - - /* Background is initialised as white */ - for (int i = 0; i < 32; i++) - m_cgb_bpal[i] = 32767; - /* Sprites are supposed to be uninitialized, but we'll make them black */ - for (int i = 0; i < 32; i++) - m_cgb_spal[i] = 0; -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void gb_lcd_device::common_reset() -{ - m_window_lines_drawn = 0; - - m_current_line = 0; - m_cmp_line = 0; - m_sprCount = 0; - m_previous_line = 0; - m_start_x = 0; - m_end_x = 0; - m_mode = 0; - m_state = 0; - m_lcd_irq_line = 0; - m_triggering_line_irq = 0; - m_line_irq = 0; - m_triggering_mode_irq = 0; - m_mode_irq = 0; - m_delayed_line_irq = 0; - m_sprite_cycles = 0; - m_scrollx_adjust = 0; - m_oam_locked = 0; - m_vram_locked = 0; - m_pal_locked = 0; - m_gbc_mode = 0; - m_gb_tile_no_mod = 0; - m_vram_bank = 0; - - m_gb_chrgen_offs = 0; - m_gb_bgdtab_offs = 0x1c00; - m_gb_wndtab_offs = 0x1c00; - - memset(&m_vid_regs, 0, sizeof(m_vid_regs)); - memset(&m_bg_zbuf, 0, sizeof(m_bg_zbuf)); - memset(&m_cgb_bpal, 0, sizeof(m_cgb_bpal)); - memset(&m_cgb_spal, 0, sizeof(m_cgb_spal)); - memset(&m_sprite, 0, sizeof(m_sprite)); - memset(&m_layer[0], 0, sizeof(m_layer[0])); - memset(&m_layer[1], 0, sizeof(m_layer[1])); - - // specific reg initialization - m_vid_regs[0x06] = 0xff; - - for (int i = 0x0c; i < _NR_GB_VID_REGS; i++) - m_vid_regs[i] = 0xff; - - LCDSTAT = 0x80; - LCDCONT = 0x00; /* Video hardware is turned off at boot time */ - m_current_line = CURLINE = CMPLINE = 0x00; - SCROLLX = SCROLLY = 0x00; - SPR0PAL = SPR1PAL = 0xFF; - WNDPOSX = WNDPOSY = 0x00; - - // Initialize palette arrays - for (int i = 0; i < 4; i++) - m_gb_bpal[i] = m_gb_spal0[i] = m_gb_spal1[i] = i; - -} - - -void gb_lcd_device::device_reset() -{ - common_reset(); - - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(456)); -} - -void sgb_lcd_device::device_reset() -{ - common_reset(); - - memset(m_sgb_tile_data, 0, 0x2000); - - m_sgb_window_mask = 0; - - memset(m_sgb_pal_map, 0, sizeof(m_sgb_pal_map)); - memset(m_sgb_atf_data, 0, sizeof(m_sgb_atf_data)); -} - -void cgb_lcd_device::device_reset() -{ - common_reset(); - - m_gbc_chrgen_offs = 0x2000; - m_gbc_bgdtab_offs = 0x3c00; - m_gbc_wndtab_offs = 0x3c00; - - /* HDMA disabled */ - m_hdma_enabled = 0; - m_hdma_possible = 0; - - m_gbc_mode = 1; -} - - - -inline void gb_lcd_device::plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix16(y, x) = (UINT16)color; -} - -/* - Select which sprites should be drawn for the current scanline and return the - number of sprites selected. - */ -void gb_lcd_device::select_sprites() -{ - int /*yindex,*/ line, height; - UINT8 *oam = m_oam + 39 * 4; - - m_sprCount = 0; - - /* If video hardware is enabled and sprites are enabled */ - if ((LCDCONT & 0x80) && (LCDCONT & 0x02)) - { - /* Check for stretched sprites */ - if (LCDCONT & 0x04) - height = 16; - else - height = 8; - - //yindex = m_current_line; - line = m_current_line + 16; - - for (int i = 39; i >= 0; i--) - { - if (line >= oam[0] && line < (oam[0] + height) && oam[1] && oam[1] < 168) - { - /* We limit the sprite count to max 10 here; - proper games should not exceed this... */ - if (m_sprCount < 10) - { - m_sprite[m_sprCount] = i; - m_sprCount++; - } - } - oam -= 4; - } - } -} - -void gb_lcd_device::update_sprites() -{ - bitmap_ind16 &bitmap = m_bitmap; - UINT8 height, tilemask, line, *oam, *vram; - int yindex; - - if (LCDCONT & 0x04) - { - height = 16; - tilemask = 0xFE; - } - else - { - height = 8; - tilemask = 0xFF; - } - - yindex = m_current_line; - line = m_current_line + 16; - - oam = m_oam + 39 * 4; - vram = m_vram; - for (int i = 39; i >= 0; i--) - { - /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ - if (line >= oam[0] && line < (oam[0] + height) && oam[1] && oam[1] < 168) - { - UINT16 data; - UINT8 bit, *spal; - int xindex, adr; - - spal = (oam[3] & 0x10) ? m_gb_spal1 : m_gb_spal0; - xindex = oam[1] - 8; - if (oam[3] & 0x40) /* flip y ? */ - { - adr = (oam[2] & tilemask) * 16 + (height - 1 - line + oam[0]) * 2; - } - else - { - adr = (oam[2] & tilemask) * 16 + (line - oam[0]) * 2; - } - data = (vram[adr + 1] << 8) | vram[adr]; - - switch (oam[3] & 0xA0) - { - case 0xA0: /* priority is set (behind bgnd & wnd, flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); - if (colour && !m_bg_zbuf[xindex] && xindex >= 0 && xindex < 160) - plot_pixel(bitmap, xindex, yindex, spal[colour]); - data >>= 1; - } - break; - case 0x20: /* priority is not set (overlaps bgnd & wnd, flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); - if (colour && xindex >= 0 && xindex < 160) - plot_pixel(bitmap, xindex, yindex, spal[colour]); - data >>= 1; - } - break; - case 0x80: /* priority is set (behind bgnd & wnd, don't flip x) */ - for (bit = 0; bit < 8 && xindex < 160; bit++, xindex++) - { - register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - if (colour && !m_bg_zbuf[xindex] && xindex >= 0 && xindex < 160) - plot_pixel(bitmap, xindex, yindex, spal[colour]); - data <<= 1; - } - break; - case 0x00: /* priority is not set (overlaps bgnd & wnd, don't flip x) */ - for (bit = 0; bit < 8 && xindex < 160; bit++, xindex++) - { - register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - if (colour && xindex >= 0 && xindex < 160) - plot_pixel(bitmap, xindex, yindex, spal[colour]); - data <<= 1; - } - break; - } - } - oam -= 4; - } -} - -void gb_lcd_device::update_scanline() -{ - bitmap_ind16 &bitmap = m_bitmap; - - g_profiler.start(PROFILER_VIDEO); - - /* Make sure we're in mode 3 */ - if ((LCDSTAT & 0x03) == 0x03) - { - /* Calculate number of pixels to render based on time still left on the timer */ - UINT32 cycles_to_go = m_maincpu->attotime_to_cycles(m_lcd_timer->remaining()); - int l = 0; - - if (m_start_x < 0) - { - /* Window is enabled if the hardware says so AND the current scanline is - * within the window AND the window X coordinate is <=166 */ - m_layer[1].enabled = ((LCDCONT & 0x20) && (m_current_line >= WNDPOSY) && (WNDPOSX <= 166)) ? 1 : 0; - - /* BG is enabled if the hardware says so AND (window_off OR (window_on - * AND window's X position is >=7)) */ - m_layer[0].enabled = ((LCDCONT & 0x01) && ((!m_layer[1].enabled) || (m_layer[1].enabled && (WNDPOSX >= 7)))) ? 1 : 0; - - if (m_layer[0].enabled) - { - m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; - m_layer[0].xindex = SCROLLX >> 3; - m_layer[0].xshift = SCROLLX & 7; - m_layer[0].xstart = 0; - m_layer[0].xend = 160; - } - - if (m_layer[1].enabled) - { - int xpos = WNDPOSX - 7; /* Window is offset by 7 pixels */ - if (xpos < 0) - xpos = 0; - - m_layer[1].bgline = m_window_lines_drawn; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; - m_layer[1].xindex = 0; - m_layer[1].xshift = 0; - m_layer[1].xstart = xpos; - m_layer[1].xend = 160; - m_layer[0].xend = xpos; - } - m_start_x = 0; - } - - if (cycles_to_go < 160) - { - m_end_x = MIN(160 - cycles_to_go, 160); - /* Draw empty pixels when the background is disabled */ - if (!(LCDCONT & 0x01)) - { - rectangle r(m_start_x, m_end_x - 1, m_current_line, m_current_line); - bitmap.fill(m_gb_bpal[0], r); - } - while (l < 2) - { - UINT8 xindex, *map, *tiles; - UINT16 data; - int i, tile_index; - - if (!m_layer[l].enabled) - { - l++; - continue; - } - map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); - tiles = m_layer[l].bg_tiles + ((m_layer[l].bgline & 7) << 1); - xindex = m_start_x; - if (xindex < m_layer[l].xstart) - xindex = m_layer[l].xstart; - i = m_end_x; - if (i > m_layer[l].xend) - i = m_layer[l].xend; - i = i - xindex; - - tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; - data = tiles[tile_index] | (tiles[tile_index+1] << 8); - data <<= m_layer[l].xshift; - - while (i > 0) - { - while ((m_layer[l].xshift < 8) && i) - { - register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - plot_pixel(bitmap, xindex, m_current_line, m_gb_bpal[colour]); - m_bg_zbuf[xindex] = colour; - xindex++; - data <<= 1; - m_layer[l].xshift++; - i--; - } - if (m_layer[l].xshift == 8) - { - /* Take possible changes to SCROLLY into account */ - if (l == 0) - { - m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); - tiles = m_layer[l].bg_tiles + ((m_layer[l].bgline & 7) << 1); - } - - m_layer[l].xindex = (m_layer[l].xindex + 1) & 31; - m_layer[l].xshift = 0; - tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; - data = tiles[tile_index] | (tiles[tile_index + 1] << 8); - } - } - l++; - } - if (m_end_x == 160 && LCDCONT & 0x02) - { - update_sprites(); - } - m_start_x = m_end_x; - } - } - else - { - if (!(LCDCONT & 0x80)) - { - /* Draw an empty line when LCD is disabled */ - if (m_previous_line != m_current_line) - { - if (m_current_line < 144) - { - const rectangle &r = m_screen->visible_area(); - rectangle r1(r.min_x, r.max_x, m_current_line, m_current_line); - bitmap.fill(0, r1); - } - m_previous_line = m_current_line; - } - } - } - - g_profiler.stop(); -} - -/* --- Super Game Boy Specific --- */ - -void sgb_lcd_device::update_sprites() -{ - bitmap_ind16 &bitmap = m_bitmap; - UINT8 height, tilemask, line, *oam, *vram, pal; - INT16 yindex; - - if (LCDCONT & 0x04) - { - height = 16; - tilemask = 0xFE; - } - else - { - height = 8; - tilemask = 0xFF; - } - - /* Offset to center of screen */ - yindex = m_current_line + SGB_YOFFSET; - line = m_current_line + 16; - - oam = m_oam + 39 * 4; - vram = m_vram; - for (int i = 39; i >= 0; i--) - { - /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ - if (line >= oam[0] && line < (oam[0] + height) && oam[1] && oam[1] < 168) - { - UINT16 data; - UINT8 bit, *spal; - INT16 xindex; - int adr; - - spal = (oam[3] & 0x10) ? m_gb_spal1 : m_gb_spal0; - xindex = oam[1] - 8; - if (oam[3] & 0x40) /* flip y ? */ - { - adr = (oam[2] & tilemask) * 16 + (height - 1 - line + oam[0]) * 2; - } - else - { - adr = (oam[2] & tilemask) * 16 + (line - oam[0]) * 2; - } - data = (vram[adr + 1] << 8) | vram[adr]; - - /* Find the palette to use */ - // If sprite started before the start of the line we may need to pick a different pal_map entry? - pal = m_sgb_pal_map[(xindex < 0) ? 0 : (xindex >> 3)][((yindex - SGB_YOFFSET) >> 3)] << 2; - - /* Offset to center of screen */ - xindex += SGB_XOFFSET; - - switch (oam[3] & 0xA0) - { - case 0xA0: /* priority is set (behind bgnd & wnd, flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); - if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour && !m_bg_zbuf[xindex - SGB_XOFFSET]) - plot_pixel(bitmap, xindex, yindex, m_sgb_pal[pal + spal[colour]]); - data >>= 1; - } - break; - case 0x20: /* priority is not set (overlaps bgnd & wnd, flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); - if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour) - plot_pixel(bitmap, xindex, yindex, m_sgb_pal[pal + spal[colour]]); - data >>= 1; - } - break; - case 0x80: /* priority is set (behind bgnd & wnd, don't flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour && !m_bg_zbuf[xindex - SGB_XOFFSET]) - plot_pixel(bitmap, xindex, yindex, m_sgb_pal[pal + spal[colour]]); - data <<= 1; - } - break; - case 0x00: /* priority is not set (overlaps bgnd & wnd, don't flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour) - plot_pixel(bitmap, xindex, yindex, m_sgb_pal[pal + spal[colour]]); - data <<= 1; - } - break; - } - } - oam -= 4; - } -} - - -void sgb_lcd_device::refresh_border() -{ - UINT16 data, data2; - UINT8 *tiles, *tiles2; - - for (UINT16 yidx = 0; yidx < 224; yidx++) - { - UINT8 *map = m_sgb_tile_map + ((yidx >> 3) * 64); - UINT16 xindex = 0; - - for (UINT16 xidx = 0; xidx < 64; xidx += 2) - { - if (map[xidx + 1] & 0x80) /* Vertical flip */ - tiles = m_sgb_tile_data + ((7 - (yidx % 8)) << 1); - else /* No vertical flip */ - tiles = m_sgb_tile_data + ((yidx % 8) << 1); - tiles2 = tiles + 16; - - UINT8 pal = (map[xidx + 1] & 0x1C) >> 2; - if (pal == 0) - pal = 1; - pal <<= 4; - - if (m_sgb_border_hack) - { /* A few games do weird stuff */ - UINT8 tileno = map[xidx]; - if (tileno >= 128) tileno = ((64 + tileno) % 128) + 128; - else tileno = (64 + tileno) % 128; - data = tiles[tileno * 32] | (tiles[(tileno * 32) + 1] << 8); - data2 = tiles2[tileno * 32] | (tiles2[(tileno * 32) + 1] << 8); - } - else - { - data = tiles[map[xidx] * 32] | (tiles[(map[xidx] * 32) + 1] << 8); - data2 = tiles2[map[xidx] * 32] | (tiles2[(map[xidx] * 32) + 1] << 8); - } - - for (int i = 0; i < 8; i++) - { - register UINT8 colour; - if ((map[xidx + 1] & 0x40)) /* Horizontal flip */ - { - colour = ((data & 0x0001) ? 1 : 0) | ((data & 0x0100) ? 2 : 0) | - ((data2 & 0x0001) ? 4 : 0) | ((data2 & 0x0100) ? 8 : 0); - data >>= 1; - data2 >>= 1; - } - else /* No horizontal flip */ - { - colour = ((data & 0x0080) ? 1 : 0) | ((data & 0x8000) ? 2 : 0) | - ((data2 & 0x0080) ? 4 : 0) | ((data2 & 0x8000) ? 8 : 0); - data <<= 1; - data2 <<= 1; - } - /* A slight hack below so we don't draw over the GB screen. - * Drawing there is allowed, but due to the way we draw the - * scanline, it can obscure the screen even when it shouldn't. - */ - if (!((yidx >= SGB_YOFFSET && yidx < SGB_YOFFSET + 144) && - (xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160))) - { - plot_pixel(m_bitmap, xindex, yidx, m_sgb_pal[pal + colour]); - } - xindex++; - } - } - } -} - -void sgb_lcd_device::update_scanline() -{ - bitmap_ind16 &bitmap = m_bitmap; - - g_profiler.start(PROFILER_VIDEO); - - if ((LCDSTAT & 0x03) == 0x03) - { - /* Calcuate number of pixels to render based on time still left on the timer */ - UINT32 cycles_to_go = m_maincpu->attotime_to_cycles(m_lcd_timer->remaining()); - int l = 0; - - if (m_start_x < 0) - { - /* Window is enabled if the hardware says so AND the current scanline is - * within the window AND the window X coordinate is <=166 */ - m_layer[1].enabled = ((LCDCONT & 0x20) && m_current_line >= WNDPOSY && WNDPOSX <= 166) ? 1 : 0; - - /* BG is enabled if the hardware says so AND (window_off OR (window_on - * AND window's X position is >=7 )) */ - m_layer[0].enabled = ((LCDCONT & 0x01) && ((!m_layer[1].enabled) || (m_layer[1].enabled && WNDPOSX >= 7))) ? 1 : 0; - - if (m_layer[0].enabled) - { - m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; - m_layer[0].xindex = SCROLLX >> 3; - m_layer[0].xshift = SCROLLX & 7; - m_layer[0].xstart = 0; - m_layer[0].xend = 160; - } - - if (m_layer[1].enabled) - { - int xpos; - - /* Window X position is offset by 7 so we'll need to adjust */ - xpos = WNDPOSX - 7; - if (xpos < 0) - xpos = 0; - - m_layer[1].bgline = m_window_lines_drawn; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; - m_layer[1].xindex = 0; - m_layer[1].xshift = 0; - m_layer[1].xstart = xpos; - m_layer[1].xend = 160; - m_layer[0].xend = xpos; - } - m_start_x = 0; - } - - if (cycles_to_go == 0) - { - /* Does this belong here? or should it be moved to the else block */ - /* Handle SGB mask */ - switch (m_sgb_window_mask) - { - case 1: /* Freeze screen */ - return; - case 2: /* Blank screen (black) */ - { - rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160-1, SGB_YOFFSET, SGB_YOFFSET + 144 - 1); - bitmap.fill(0, r); - } - return; - case 3: /* Blank screen (white - or should it be color 0?) */ - { - rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, SGB_YOFFSET, SGB_YOFFSET + 144 - 1); - bitmap.fill(32767, r); - } - return; - } - - /* Draw the "border" if we're on the first line */ - if (m_current_line == 0) - { - refresh_border(); - } - } - if (cycles_to_go < 160) - { - m_end_x = MIN(160 - cycles_to_go,160); - - /* if background or screen disabled clear line */ - if (!(LCDCONT & 0x01)) - { - rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, m_current_line + SGB_YOFFSET, m_current_line + SGB_YOFFSET); - bitmap.fill(0, r); - } - while (l < 2) - { - UINT8 xindex, sgb_palette, *map, *tiles; - UINT16 data; - int i, tile_index; - - if (!m_layer[l].enabled) - { - l++; - continue; - } - map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); - tiles = m_layer[l].bg_tiles + ((m_layer[l].bgline & 7) << 1); - xindex = m_start_x; - if (xindex < m_layer[l].xstart) - xindex = m_layer[l].xstart; - i = m_end_x; - if (i > m_layer[l].xend) - i = m_layer[l].xend; - i = i - xindex; - - tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; - data = tiles[tile_index] | (tiles[tile_index + 1] << 8); - data <<= m_layer[l].xshift; - - while (i > 0) - { - /* Figure out which palette we're using */ - assert(((m_end_x - i) >> 3) >= 0 && ((m_end_x - i) >> 3) < ARRAY_LENGTH(m_sgb_pal_map)); - sgb_palette = m_sgb_pal_map[(m_end_x - i) >> 3][m_current_line >> 3] << 2; - - while ((m_layer[l].xshift < 8) && i) - { - register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - plot_pixel(bitmap, xindex + SGB_XOFFSET, m_current_line + SGB_YOFFSET, m_sgb_pal[sgb_palette + m_gb_bpal[colour]]); - m_bg_zbuf[xindex] = colour; - xindex++; - data <<= 1; - m_layer[l].xshift++; - i--; - } - if (m_layer[l].xshift == 8) - { - /* Take possible changes to SCROLLY into account */ - if (l == 0) - { - m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); - tiles = m_layer[l].bg_tiles + ((m_layer[l].bgline & 7) << 1); - } - - m_layer[l].xindex = (m_layer[l].xindex + 1) & 31; - m_layer[l].xshift = 0; - tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; - data = tiles[tile_index] | (tiles[tile_index + 1] << 8); - } - } - l++; - } - if ((m_end_x == 160) && (LCDCONT & 0x02)) - { - update_sprites(); - } - m_start_x = m_end_x; - } - } - else - { - if (!(LCDCONT * 0x80)) - { - /* if screen disabled clear line */ - if (m_previous_line != m_current_line) - { - /* Also refresh border here??? */ - if (m_current_line < 144) - { - rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, m_current_line + SGB_YOFFSET, m_current_line + SGB_YOFFSET); - bitmap.fill(0, r); - } - m_previous_line = m_current_line; - } - } - } - - g_profiler.stop(); -} - -/* --- Game Boy Color Specific --- */ - -void cgb_lcd_device::update_sprites() -{ - bitmap_ind16 &bitmap = m_bitmap; - UINT8 height, tilemask, line, *oam; - int xindex, yindex; - - if (LCDCONT & 0x04) - { - height = 16; - tilemask = 0xFE; - } - else - { - height = 8; - tilemask = 0xFF; - } - - yindex = m_current_line; - line = m_current_line + 16; - - oam = m_oam + 39 * 4; - for (int i = 39; i >= 0; i--) - { - /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ - if (line >= oam[0] && line < (oam[0] + height) && oam[1] && oam[1] < 168) - { - UINT16 data; - UINT8 bit, pal; - - /* Handle mono mode for GB games */ - if (!m_gbc_mode) - pal = (oam[3] & 0x10) ? 4 : 0; - else - pal = ((oam[3] & 0x7) * 4); - - xindex = oam[1] - 8; - if (oam[3] & 0x40) /* flip y ? */ - { - data = *((UINT16 *) &m_vram[((oam[3] & 0x8)<<10) + (oam[2] & tilemask) * 16 + (height - 1 - line + oam[0]) * 2]); - } - else - { - data = *((UINT16 *) &m_vram[((oam[3] & 0x8)<<10) + (oam[2] & tilemask) * 16 + (line - oam[0]) * 2]); - } - - data = LITTLE_ENDIANIZE_INT16(data); - - switch (oam[3] & 0xA0) - { - case 0xA0: /* priority is set (behind bgnd & wnd, flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); - if (colour && !m_bg_zbuf[xindex] && xindex >= 0 && xindex < 160) - { - if (!m_gbc_mode) - colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour]; - plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]); - } - data >>= 1; - } - break; - case 0x20: /* priority is not set (overlaps bgnd & wnd, flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); - if ((m_bg_zbuf[xindex] & 0x80) && (m_bg_zbuf[xindex] & 0x7f) && (LCDCONT & 0x1)) - colour = 0; - if (colour && xindex >= 0 && xindex < 160) - { - if (!m_gbc_mode) - colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour]; - plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]); - } - data >>= 1; - } - break; - case 0x80: /* priority is set (behind bgnd & wnd, don't flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - if (colour && !m_bg_zbuf[xindex] && xindex >= 0 && xindex < 160) - { - if (!m_gbc_mode) - colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour]; - plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]); - } - data <<= 1; - } - break; - case 0x00: /* priority is not set (overlaps bgnd & wnd, don't flip x) */ - for (bit = 0; bit < 8; bit++, xindex++) - { - if (xindex >= 0 && xindex < 160) - { - register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - if ((m_bg_zbuf[xindex] & 0x80) && (m_bg_zbuf[xindex] & 0x7f) && (LCDCONT & 0x1)) - colour = 0; - if (colour) - { - if (!m_gbc_mode) - colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour]; - plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]); - } - } - data <<= 1; - } - break; - } - } - oam -= 4; - } -} - -void cgb_lcd_device::update_scanline() -{ - bitmap_ind16 &bitmap = m_bitmap; - - g_profiler.start(PROFILER_VIDEO); - - if ((LCDSTAT & 0x03) == 0x03) - { - /* Calcuate number of pixels to render based on time still left on the timer */ - UINT32 cycles_to_go = m_maincpu->attotime_to_cycles(m_lcd_timer->remaining()); - int l = 0; - - if (m_start_x < 0) - { - /* Window is enabled if the hardware says so AND the current scanline is - * within the window AND the window X coordinate is <=166 */ - m_layer[1].enabled = ((LCDCONT & 0x20) && (m_current_line >= WNDPOSY) && (WNDPOSX <= 166)) ? 1 : 0; - - /* BG is enabled if the hardware says so AND (window_off OR (window_on - * AND window's X position is >=7 )) */ - m_layer[0].enabled = ((LCDCONT & 0x01) && ((!m_layer[1].enabled) || (m_layer[1].enabled && (WNDPOSX >= 7)))) ? 1 : 0; - - if (m_layer[0].enabled) - { - m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].gbc_map = m_vram + m_gbc_bgdtab_offs; - m_layer[0].xindex = SCROLLX >> 3; - m_layer[0].xshift = SCROLLX & 7; - m_layer[0].xstart = 0; - m_layer[0].xend = 160; - } - - if (m_layer[1].enabled) - { - int xpos; - - /* Window X position is offset by 7 so we'll need to adust */ - xpos = WNDPOSX - 7; - if (xpos < 0) - xpos = 0; - - m_layer[1].bgline = m_window_lines_drawn; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].gbc_map = m_vram + m_gbc_wndtab_offs; - m_layer[1].xindex = 0; - m_layer[1].xshift = 0; - m_layer[1].xstart = xpos; - m_layer[1].xend = 160; - m_layer[0].xend = xpos; - } - m_start_x = 0; - } - - if (cycles_to_go < 160) - { - m_end_x = MIN(160 - cycles_to_go, 160); - /* Draw empty line when the background is disabled */ - if (!(LCDCONT & 0x01)) - { - rectangle r(m_start_x, m_end_x - 1, m_current_line, m_current_line); - bitmap.fill((!m_gbc_mode) ? 0 : 32767, r); - } - while (l < 2) - { - UINT8 xindex, *map, *tiles, *gbcmap; - UINT16 data; - int i, tile_index; - - if (!m_layer[l].enabled) - { - l++; - continue; - } - map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); - gbcmap = m_layer[l].gbc_map + ((m_layer[l].bgline << 2) & 0x3E0); - tiles = (gbcmap[m_layer[l].xindex] & 0x08) ? (m_vram + m_gbc_chrgen_offs) : (m_vram + m_gb_chrgen_offs); - - /* Check for vertical flip */ - if (gbcmap[m_layer[l].xindex] & 0x40) - { - tiles += ((7 - (m_layer[l].bgline & 0x07)) << 1); - } - else - { - tiles += ((m_layer[l].bgline & 0x07) << 1); - } - xindex = m_start_x; - if (xindex < m_layer[l].xstart) - xindex = m_layer[l].xstart; - i = m_end_x; - if (i > m_layer[l].xend) - i = m_layer[l].xend; - i = i - xindex; - - tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; - data = tiles[tile_index] | (tiles[tile_index + 1] << 8); - /* Check for horinzontal flip */ - if (gbcmap[m_layer[l].xindex] & 0x20) - { - data >>= m_layer[l].xshift; - } - else - { - data <<= m_layer[l].xshift; - } - - while (i > 0) - { - while ((m_layer[l].xshift < 8) && i) - { - int colour; - /* Check for horinzontal flip */ - if (gbcmap[m_layer[l].xindex] & 0x20) - { - colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); - data >>= 1; - } - else - { - colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); - data <<= 1; - } - plot_pixel(bitmap, xindex, m_current_line, m_cgb_bpal[(!m_gbc_mode) ? m_gb_bpal[colour] : (((gbcmap[m_layer[l].xindex] & 0x07) * 4) + colour)]); - m_bg_zbuf[xindex] = colour + (gbcmap[m_layer[l].xindex] & 0x80); - xindex++; - m_layer[l].xshift++; - i--; - } - if (m_layer[l].xshift == 8) - { - /* Take possible changes to SCROLLY into account */ - if (l == 0) - { - m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); - gbcmap = m_layer[l].gbc_map + ((m_layer[l].bgline << 2) & 0x3E0); - } - - m_layer[l].xindex = (m_layer[l].xindex + 1) & 31; - m_layer[l].xshift = 0; - tiles = (gbcmap[m_layer[l].xindex] & 0x08) ? (m_vram + m_gbc_chrgen_offs) : (m_vram + m_gb_chrgen_offs); - - /* Check for vertical flip */ - if (gbcmap[m_layer[l].xindex] & 0x40) - { - tiles += ((7 - (m_layer[l].bgline & 0x07)) << 1); - } - else - { - tiles += ((m_layer[l].bgline & 0x07) << 1); - } - tile_index = (map[m_layer[l].xindex] ^ m_gb_tile_no_mod) * 16; - data = tiles[tile_index] | (tiles[tile_index + 1] << 8); - } - } - l++; - } - if (m_end_x == 160 && (LCDCONT & 0x02)) - { - update_sprites(); - } - m_start_x = m_end_x; - } - } - else - { - if (!(LCDCONT & 0x80)) - { - /* Draw an empty line when LCD is disabled */ - if (m_previous_line != m_current_line) - { - if (m_current_line < 144) - { - const rectangle &r1 = m_screen->visible_area(); - rectangle r(r1.min_x, r1.max_x, m_current_line, m_current_line); - bitmap.fill((!m_gbc_mode) ? 0 : 32767 , r); - } - m_previous_line = m_current_line; - } - } - } - - g_profiler.stop(); -} - - -TIMER_CALLBACK_MEMBER(gb_lcd_device::video_init_vbl) -{ - m_maincpu->set_input_line(VBL_INT, ASSERT_LINE); -} - -UINT32 gb_lcd_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - - -void gb_lcd_device::increment_scanline() -{ - m_current_line = (m_current_line + 1) % 154; - if (LCDCONT & 0x80) - { - CURLINE = m_current_line; - } - if (m_current_line == 0) - { - m_window_lines_drawn = 0; - } -} - -TIMER_CALLBACK_MEMBER(gb_lcd_device::lcd_timer_proc) -{ - static const int gb_sprite_cycles[] = { 0, 8, 20, 32, 44, 52, 64, 76, 88, 96, 108 }; - - m_state = param; - - if (LCDCONT & 0x80) - { - switch (m_state) - { - case GB_LCD_STATE_LYXX_PRE_M0: /* Just before switching to mode 0 */ - m_mode = 0; - if (LCDSTAT & 0x08) - { - if (!m_mode_irq) - { - if (!m_line_irq && !m_delayed_line_irq) - { - m_mode_irq = 1; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - else - { - m_mode_irq = 0; - } - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0); - break; - case GB_LCD_STATE_LYXX_M0: /* Switch to mode 0 */ - /* update current scanline */ - update_scanline(); - /* Increment the number of window lines drawn if enabled */ - if (m_layer[1].enabled) - { - m_window_lines_drawn++; - } - m_previous_line = m_current_line; - /* Set Mode 0 lcdstate */ - m_mode = 0; - LCDSTAT &= 0xFC; - m_oam_locked = UNLOCKED; - m_vram_locked = UNLOCKED; - /* - There seems to a kind of feature in the Game Boy hardware when the lowest bits of the - SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later - than usual. - The SGB probably has the same bug. - */ - if ((SCROLLX & 0x03) == 0x03) - { - m_scrollx_adjust += 4; - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3); - break; - } - case GB_LCD_STATE_LYXX_M0_SCX3: - /* Generate lcd interrupt if requested */ - if (!m_mode_irq && (LCDSTAT & 0x08) && - ((!m_line_irq && m_delayed_line_irq) || !(LCDSTAT & 0x40))) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(196 - m_scrollx_adjust - m_sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); - break; - case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ - if (CURLINE < 143) - { - m_mode = 2; - m_triggering_mode_irq = (LCDSTAT & 0x20) ? 1 : 0; - if (m_triggering_mode_irq) - { - if (!m_mode_irq) - { - if (!m_line_irq && !m_delayed_line_irq) - { - m_mode_irq = 1; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - else - { - m_mode_irq = 0; - } - } - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC); - break; - case GB_LCD_STATE_LYXX_M0_INC: /* Increment LY, stay in M0 for 4 more cycles */ - increment_scanline(); - m_delayed_line_irq = m_line_irq; - m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; - m_line_irq = 0; - if (!m_mode_irq && !m_delayed_line_irq && m_triggering_line_irq && !m_triggering_mode_irq) - { - m_line_irq = m_triggering_line_irq; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - /* Reset LY==LYC STAT bit */ - LCDSTAT &= 0xFB; - /* Check if we're going into VBlank next */ - if (CURLINE == 144) - { - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); - } - else - { - /* Internally switch to mode 2 */ - m_mode = 2; - /* Generate lcd interrupt if requested */ - if (!m_mode_irq && m_triggering_mode_irq && - ((!m_triggering_line_irq && !m_delayed_line_irq) || !(LCDSTAT & 0x40))) - { - m_mode_irq = 1; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2); - } - break; - case GB_LCD_STATE_LY00_M2: /* Switch to mode 2 on line #0 */ - /* Set Mode 2 lcdstate */ - m_mode = 2; - LCDSTAT = (LCDSTAT & 0xFC) | 0x02; - m_oam_locked = LOCKED; - /* Generate lcd interrupt if requested */ - if ((LCDSTAT & 0x20) && !m_line_irq) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - /* Check for regular compensation of x-scroll register */ - m_scrollx_adjust = (SCROLLX & 0x04) ? 4 : 0; - /* Mode 2 lasts approximately 80 clock cycles */ - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); - break; - case GB_LCD_STATE_LYXX_M2: /* Switch to mode 2 */ - /* Update STAT register to the correct state */ - LCDSTAT = (LCDSTAT & 0xFC) | 0x02; - m_oam_locked = LOCKED; - /* Generate lcd interrupt if requested */ - if ((m_delayed_line_irq && m_triggering_line_irq && !(LCDSTAT & 0x20)) || - (!m_mode_irq && !m_line_irq && !m_delayed_line_irq && m_triggering_mode_irq)) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_line_irq = m_triggering_line_irq; - m_triggering_mode_irq = 0; - /* Check if LY==LYC STAT bit should be set */ - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - } - /* Check for regular compensation of x-scroll register */ - m_scrollx_adjust = (SCROLLX & 0x04) ? 4 : 0; - /* Mode 2 last for approximately 80 clock cycles */ - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); - break; - case GB_LCD_STATE_LYXX_M3: /* Switch to mode 3 */ - select_sprites(); - m_sprite_cycles = gb_sprite_cycles[m_sprCount]; - /* Set Mode 3 lcdstate */ - m_mode = 3; - LCDSTAT = (LCDSTAT & 0xFC) | 0x03; - m_vram_locked = LOCKED; - /* Check for compensations of x-scroll register */ - /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */ - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(168 + m_scrollx_adjust + m_sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0); - m_start_x = -1; - break; - case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ - if (CURLINE == 144) - { - /* Trigger VBlank interrupt */ - m_maincpu->set_input_line(VBL_INT, ASSERT_LINE); - /* Set VBlank lcdstate */ - m_mode = 1; - LCDSTAT = (LCDSTAT & 0xFC) | 0x01; - /* Trigger LCD interrupt if requested */ - if (LCDSTAT & 0x10) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - /* Check if LY==LYC STAT bit should be set */ - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - } - if (m_delayed_line_irq && m_triggering_line_irq) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC); - break; - case GB_LCD_STATE_LY9X_M1_INC: /* Increment scanline counter */ - increment_scanline(); - m_delayed_line_irq = m_line_irq; - m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; - m_line_irq = 0; - if (!m_delayed_line_irq && m_triggering_line_irq) - { - m_line_irq = m_triggering_line_irq; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - /* Reset LY==LYC STAT bit */ - LCDSTAT &= 0xFB; - if (m_current_line == 153) - { - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1); - } - else - { - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); - } - break; - case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ - /* Check LY=LYC for line #153 */ - if (m_delayed_line_irq) - { - if (m_triggering_line_irq) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - m_delayed_line_irq = m_delayed_line_irq | m_line_irq; - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - } - increment_scanline(); - m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; - m_line_irq = 0; - LCDSTAT &= 0xFB; - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4/*8*/), GB_LCD_STATE_LY00_M1_1); - break; - case GB_LCD_STATE_LY00_M1_1: - if (!m_delayed_line_irq && m_triggering_line_irq) - { - m_line_irq = m_triggering_line_irq; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2); - break; - case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ - if (m_delayed_line_irq && m_triggering_line_irq) - { - m_line_irq = m_triggering_line_irq; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0); - break; - case GB_LCD_STATE_LY00_M0: /* The STAT register seems to go to 0 for about 4 cycles */ - /* Set Mode 0 lcdstat */ - m_mode = 0; - LCDSTAT = (LCDSTAT & 0xFC); - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2); - break; - } - } - else - { - increment_scanline(); - if (m_current_line < 144) - { - update_scanline(); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(456)); - } -} - - -// CGB specific code - -void cgb_lcd_device::hdma_trans(UINT16 length) -{ - UINT16 src, dst; - address_space &space = m_maincpu->space(AS_PROGRAM); - - src = ((UINT16)HDMA1 << 8) | (HDMA2 & 0xF0); - dst = ((UINT16)(HDMA3 & 0x1F) << 8) | (HDMA4 & 0xF0); - dst |= 0x8000; - while (length > 0) - { - space.write_byte(dst++, space.read_byte(src++)); - length--; - } - HDMA1 = src >> 8; - HDMA2 = src & 0xF0; - HDMA3 = 0x1f & (dst >> 8); - HDMA4 = dst & 0xF0; - HDMA5--; - if ((HDMA5 & 0x7f) == 0x7f) - { - HDMA5 = 0xff; - m_hdma_enabled = 0; - } -} - - -TIMER_CALLBACK_MEMBER(cgb_lcd_device::lcd_timer_proc) -{ - static const int cgb_sprite_cycles[] = { 0, 8, 20, 32, 44, 52, 64, 76, 88, 96, 108 }; - - m_state = param; - - if (LCDCONT & 0x80) - { - switch (m_state) - { - case GB_LCD_STATE_LYXX_PRE_M0: /* Just before switching to mode 0 */ - m_mode = 0; - if (LCDSTAT & 0x08) - { - if (!m_mode_irq) - { - if (!m_line_irq && !m_delayed_line_irq) - { - m_mode_irq = 1; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - else - { - m_mode_irq = 0; - } - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0); - break; - case GB_LCD_STATE_LYXX_M0: /* Switch to mode 0 */ - /* update current scanline */ - update_scanline(); - /* Increment the number of window lines drawn if enabled */ - if (m_layer[1].enabled) - { - m_window_lines_drawn++; - } - m_previous_line = m_current_line; - /* Set Mode 0 lcdstate */ - m_mode = 0; - LCDSTAT &= 0xFC; - m_oam_locked = UNLOCKED; - m_vram_locked = UNLOCKED; - /* - There seems to a kind of feature in the Game Boy hardware when the lowest bits of the - SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later - than usual. - The SGB probably has the same bug. - */ - m_triggering_mode_irq = (LCDSTAT & 0x08) ? 1 : 0; - if ((SCROLLX & 0x03) == 0x03) - { - m_scrollx_adjust += 4; - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3); - break; - } - case GB_LCD_STATE_LYXX_M0_SCX3: - /* Generate lcd interrupt if requested */ - if (!m_mode_irq && m_triggering_mode_irq && - ((!m_line_irq && m_delayed_line_irq) || !(LCDSTAT & 0x40))) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - m_triggering_mode_irq = 0; - } - if ((SCROLLX & 0x03) == 0x03) - { - m_pal_locked = UNLOCKED; - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_GBC_PAL); - break; - case GB_LCD_STATE_LYXX_M0_GBC_PAL: - m_pal_locked = UNLOCKED; - /* Check for HBLANK DMA */ - if (m_hdma_enabled) - { - hdma_trans(0x10); -// cpunum_set_reg(0, LR35902_DMA_CYCLES, 36); - } - else - { - m_hdma_possible = 1; - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(192 - m_scrollx_adjust - m_sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); - break; - case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ - m_cmp_line = CMPLINE; - if (CURLINE < 143) - { - m_mode = 2; - if (LCDSTAT & 0x20) - { - if (!m_mode_irq) - { - if (!m_line_irq && !m_delayed_line_irq) - { - m_mode_irq = 1; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - else - { - m_mode_irq = 0; - } - } - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC); - break; - case GB_LCD_STATE_LYXX_M0_INC: /* Increment LY, stay in M0 for 4 more cycles */ - increment_scanline(); - m_delayed_line_irq = m_line_irq; - m_triggering_line_irq = ((m_cmp_line == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; - m_line_irq = 0; - if (!m_mode_irq && !m_delayed_line_irq && m_triggering_line_irq && !(LCDSTAT & 0x20)) - { - m_line_irq = m_triggering_line_irq; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_hdma_possible = 0; - /* Check if we're going into VBlank next */ - if (CURLINE == 144) - { - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); - } - else - { - /* Internally switch to mode 2 */ - m_mode = 2; - /* Generate lcd interrupt if requested */ - if (!m_mode_irq && (LCDSTAT & 0x20) && - ((!m_triggering_line_irq && !m_delayed_line_irq) || !(LCDSTAT & 0x40))) - { - m_mode_irq = 1; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2); - } - break; - case GB_LCD_STATE_LY00_M2: /* Switch to mode 2 on line #0 */ - /* Set Mode 2 lcdstate */ - m_mode = 2; - LCDSTAT = (LCDSTAT & 0xFC) | 0x02; - m_oam_locked = LOCKED; - /* Generate lcd interrupt if requested */ - if ((LCDSTAT & 0x20) && !m_line_irq) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - /* Check for regular compensation of x-scroll register */ - m_scrollx_adjust = (SCROLLX & 0x04) ? 4 : 0; - /* Mode 2 lasts approximately 80 clock cycles */ - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); - break; - case GB_LCD_STATE_LYXX_M2: /* Switch to mode 2 */ - /* Update STAT register to the correct state */ - LCDSTAT = (LCDSTAT & 0xFC) | 0x02; - m_oam_locked = LOCKED; - /* Generate lcd interrupt if requested */ - if ((m_delayed_line_irq && m_triggering_line_irq && !(LCDSTAT & 0x20)) || - (!m_mode_irq && !m_line_irq && !m_delayed_line_irq && (LCDSTAT & 0x20))) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_line_irq = m_triggering_line_irq; - /* Check if LY==LYC STAT bit should be set */ - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - } - else - { - LCDSTAT &= ~0x04; - } - /* Check for regular compensation of x-scroll register */ - m_scrollx_adjust = (SCROLLX & 0x04) ? 4 : 0; - /* Mode 2 last for approximately 80 clock cycles */ - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); - break; - case GB_LCD_STATE_LYXX_M3: /* Switch to mode 3 */ - select_sprites(); - m_sprite_cycles = cgb_sprite_cycles[m_sprCount]; - /* Set Mode 3 lcdstate */ - m_mode = 3; - LCDSTAT = (LCDSTAT & 0xFC) | 0x03; - m_vram_locked = LOCKED; - m_pal_locked = LOCKED; - /* Check for compensations of x-scroll register */ - /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */ - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(168 + m_scrollx_adjust + m_sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0); - m_start_x = -1; - break; - case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ - if (CURLINE == 144) - { - /* Trigger VBlank interrupt */ - m_maincpu->set_input_line(VBL_INT, ASSERT_LINE); - /* Set VBlank lcdstate */ - m_mode = 1; - LCDSTAT = (LCDSTAT & 0xFC) | 0x01; - /* Trigger LCD interrupt if requested */ - if (LCDSTAT & 0x10) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - /* Check if LY==LYC STAT bit should be set */ - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - } - else - { - LCDSTAT &= ~0x04; - } - if (m_delayed_line_irq && m_triggering_line_irq) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC); - break; - case GB_LCD_STATE_LY9X_M1_INC: /* Increment scanline counter */ - increment_scanline(); - m_delayed_line_irq = m_line_irq; - m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; - m_line_irq = 0; - if (!m_delayed_line_irq && m_triggering_line_irq) - { - m_line_irq = m_triggering_line_irq; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - if (m_current_line == 153) - { - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1); - } - else - { - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); - } - break; - case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ - /* Check LY=LYC for line #153 */ - if (m_delayed_line_irq) - { - if (m_triggering_line_irq) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - m_delayed_line_irq = m_delayed_line_irq | m_line_irq; - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - } - else - { - LCDSTAT &= ~0x04; - } - increment_scanline(); - m_triggering_line_irq = ((CMPLINE == CURLINE) && (LCDSTAT & 0x40)) ? 1 : 0; - m_line_irq = 0; - LCDSTAT &= 0xFB; - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_1); - break; - case GB_LCD_STATE_LY00_M1_1: - if (!m_delayed_line_irq && m_triggering_line_irq) - { - m_line_irq = m_triggering_line_irq; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2); - break; - case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ - if (m_delayed_line_irq && m_triggering_line_irq) - { - m_line_irq = m_triggering_line_irq; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - } - else - { - LCDSTAT &= ~0x04; - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0); - break; - case GB_LCD_STATE_LY00_M0: /* The STAT register seems to go to 0 for about 4 cycles */ - /* Set Mode 0 lcdstat */ - m_mode = 0; - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2); - break; - } - } - else - { - increment_scanline(); - if (m_current_line < 144) - { - update_scanline(); - } - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(456)); - } -} - - -void gb_lcd_device::lcd_switch_on() -{ - m_current_line = 0; - m_previous_line = 153; - m_window_lines_drawn = 0; - m_line_irq = 0; - m_delayed_line_irq = 0; - m_mode = 0; - m_oam_locked = LOCKED; /* TODO: Investigate whether this OAM locking is correct. */ - /* Check for LY=LYC coincidence */ - if (CURLINE == CMPLINE) - { - LCDSTAT |= 0x04; - /* Generate lcd interrupt if requested */ - if (LCDSTAT & 0x40) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - m_state = GB_LCD_STATE_LY00_M2; - m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); -} - - - - -READ8_MEMBER(gb_lcd_device::vram_r) -{ - return (m_vram_locked == LOCKED) ? 0xff : m_vram[offset + (m_vram_bank * 0x2000)]; -} - -WRITE8_MEMBER(gb_lcd_device::vram_w) -{ - if (m_vram_locked == LOCKED) - return; - - m_vram[offset + (m_vram_bank * 0x2000)] = data; -} - -READ8_MEMBER(gb_lcd_device::oam_r) -{ - return (m_oam_locked == LOCKED) ? 0xff : m_oam[offset]; -} - -WRITE8_MEMBER(gb_lcd_device::oam_w) -{ - if (m_oam_locked == LOCKED || offset >= 0xa0) - return; - - m_oam[offset] = data; -} - - - -READ8_MEMBER(gb_lcd_device::video_r) -{ - return m_vid_regs[offset]; -} - -WRITE8_MEMBER(gb_lcd_device::video_w) -{ - switch (offset) - { - case 0x00: /* LCDC - LCD Control */ - m_gb_chrgen_offs = (data & 0x10) ? 0x0000 : 0x0800; - m_gb_tile_no_mod = (data & 0x10) ? 0x00 : 0x80; - m_gb_bgdtab_offs = (data & 0x08) ? 0x1c00 : 0x1800; - m_gb_wndtab_offs = (data & 0x40) ? 0x1c00 : 0x1800; - /* if LCD controller is switched off, set STAT and LY to 00 */ - if (!(data & 0x80)) - { - LCDSTAT &= ~0x03; - CURLINE = 0; - m_oam_locked = UNLOCKED; - m_vram_locked = UNLOCKED; - } - /* If LCD is being switched on */ - if (!(LCDCONT & 0x80) && (data & 0x80)) - { - lcd_switch_on(); - } - break; - case 0x01: /* STAT - LCD Status */ - data = 0x80 | (data & 0x78) | (LCDSTAT & 0x07); - /* - Check for the STAT bug: - Writing to STAT when the LCD controller is active causes a STAT - interrupt to be triggered. - */ - if (LCDCONT & 0x80) - { - /* Triggers seen so far: - - 0x40 -> 0x00 - trigger - - 0x00 -> 0x08 - trigger - - 0x08 -> 0x00 - don't trigger - - 0x00 -> 0x20 (mode 3) - trigger - - 0x00 -> 0x60 (mode 2) - don't trigger - - 0x20 -> 0x60 (mode 3) - trigger - - 0x20 -> 0x40 (mode 3) - trigger - - 0x40 -> 0x20 (mode 2) - don't trigger - - 0x40 -> 0x08 (mode 0) - don't trigger - - 0x00 -> 0x40 - trigger only if LY==LYC - - 0x20 -> 0x00/0x08/0x10/0x20/0x40 (mode 2, after m2int) - don't trigger - - 0x20 -> 0x00/0x08/0x10/0x20/0x40 (mode 3, after m2int) - don't trigger - */ - if (!m_mode_irq && ((m_mode == 1) || - ((LCDSTAT & 0x40) && !(data & 0x68)) || - (!(LCDSTAT & 0x40) && (data & 0x40) && (LCDSTAT & 0x04)) || - (!(LCDSTAT & 0x48) && (data & 0x08)) || - ((LCDSTAT & 0x60) == 0x00 && (data & 0x60) == 0x20) || - ((LCDSTAT & 0x60) == 0x20 && (data & 0x40)) - )) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - /* - - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger - - 0x20 -> 0x00/0x10/0x20/0x40 (mode 0, after m2int) - trigger (stat bug) - - 0x00 -> 0xXX (mode 0) - trigger stat bug - */ - if (m_mode_irq && m_mode == 0) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - break; - case 0x04: /* LY - LCD Y-coordinate */ - return; - case 0x05: /* LYC */ - if (CMPLINE != data) - { - if (CURLINE == data) - { - if (m_state != GB_LCD_STATE_LYXX_M0_INC && m_state != GB_LCD_STATE_LY9X_M1_INC) - { - LCDSTAT |= 0x04; - /* Generate lcd interrupt if requested */ - if (LCDSTAT & 0x40) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - } - else - { - LCDSTAT &= 0xFB; - m_triggering_line_irq = 0; - } - } - break; - case 0x06: /* DMA - DMA Transfer and Start Address */ - { - UINT8 *P = m_oam; - offset = (UINT16) data << 8; - for (data = 0; data < 0xA0; data++) - *P++ = space.read_byte(offset++); - } - return; - case 0x07: /* BGP - Background Palette */ - update_scanline(); - m_gb_bpal[0] = data & 0x3; - m_gb_bpal[1] = (data & 0xC) >> 2; - m_gb_bpal[2] = (data & 0x30) >> 4; - m_gb_bpal[3] = (data & 0xC0) >> 6; - break; - case 0x08: /* OBP0 - Object Palette 0 */ -// update_scanline(); - m_gb_spal0[0] = data & 0x3; - m_gb_spal0[1] = (data & 0xC) >> 2; - m_gb_spal0[2] = (data & 0x30) >> 4; - m_gb_spal0[3] = (data & 0xC0) >> 6; - break; - case 0x09: /* OBP1 - Object Palette 1 */ -// update_scanline(); - m_gb_spal1[0] = data & 0x3; - m_gb_spal1[1] = (data & 0xC) >> 2; - m_gb_spal1[2] = (data & 0x30) >> 4; - m_gb_spal1[3] = (data & 0xC0) >> 6; - break; - case 0x02: /* SCY - Scroll Y */ - case 0x03: /* SCX - Scroll X */ - update_scanline(); - break; - case 0x0A: /* WY - Window Y position */ - case 0x0B: /* WX - Window X position */ - break; - default: /* Unknown register, no change */ - return; - } - m_vid_regs[offset] = data; -} - -READ8_MEMBER(cgb_lcd_device::video_r) -{ - switch (offset) - { - case 0x11: /* FF51 */ - case 0x12: /* FF52 */ - case 0x13: /* FF53 */ - case 0x14: /* FF54 */ - return 0xFF; - case 0x29: /* FF69 */ - case 0x2B: /* FF6B */ - if (m_pal_locked == LOCKED) - { - return 0xFF; - } - break; - } - return m_vid_regs[offset]; -} - -WRITE8_MEMBER(cgb_lcd_device::video_w) -{ - switch (offset) - { - case 0x00: /* LCDC - LCD Control */ - m_gb_chrgen_offs = (data & 0x10) ? 0x0000 : 0x0800; - m_gbc_chrgen_offs = (data & 0x10) ? 0x2000 : 0x2800; - m_gb_tile_no_mod = (data & 0x10) ? 0x00 : 0x80; - m_gb_bgdtab_offs = (data & 0x08) ? 0x1c00 : 0x1800; - m_gbc_bgdtab_offs = (data & 0x08) ? 0x3c00 : 0x3800; - m_gb_wndtab_offs = (data & 0x40) ? 0x1c00 : 0x1800; - m_gbc_wndtab_offs = (data & 0x40) ? 0x3c00 : 0x3800; - /* if LCD controller is switched off, set STAT to 00 */ - if (!(data & 0x80)) - { - LCDSTAT &= ~0x03; - CURLINE = 0; - m_oam_locked = UNLOCKED; - m_vram_locked = UNLOCKED; - m_pal_locked = UNLOCKED; - } - /* If LCD is being switched on */ - if (!(LCDCONT & 0x80) && (data & 0x80)) - { - lcd_switch_on(); - } - break; - case 0x01: /* STAT - LCD Status */ - data = 0x80 | (data & 0x78) | (LCDSTAT & 0x07); - if (LCDCONT & 0x80) - { - /* - - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger - */ - if (m_mode_irq && m_mode == 0 && (LCDSTAT & 0x28) == 0x20 && (data & 0x08)) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - /* Check if line irqs are being disabled */ - if (!(data & 0x40)) - { - m_delayed_line_irq = 0; - } - /* Check if line irqs are being enabled */ - if (!(LCDSTAT & 0x40) && (data & 0x40)) - { - if (CMPLINE == CURLINE) - { - m_line_irq = 1; - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - } - break; - case 0x05: /* LYC */ - if (CMPLINE != data) - { - if ((m_state != GB_LCD_STATE_LYXX_M0_PRE_INC && CURLINE == data) || - (m_state == GB_LCD_STATE_LYXX_M0_INC && m_triggering_line_irq)) - { - LCDSTAT |= 0x04; - /* Generate lcd interrupt if requested */ - if (LCDSTAT & 0x40) - { - m_maincpu->set_input_line(LCD_INT, ASSERT_LINE); - } - } - else - { - LCDSTAT &= 0xFB; - m_triggering_line_irq = 0; - m_cmp_line = data; - } - } - break; - case 0x07: /* BGP - GB background palette */ - update_scanline(); - m_gb_bpal[0] = data & 0x3; - m_gb_bpal[1] = (data & 0xC) >> 2; - m_gb_bpal[2] = (data & 0x30) >> 4; - m_gb_bpal[3] = (data & 0xC0) >> 6; - break; - case 0x08: /* OBP0 - GB Object 0 palette */ - m_gb_spal0[0] = data & 0x3; - m_gb_spal0[1] = (data & 0xC) >> 2; - m_gb_spal0[2] = (data & 0x30) >> 4; - m_gb_spal0[3] = (data & 0xC0) >> 6; - break; - case 0x09: /* OBP1 - GB Object 1 palette */ - m_gb_spal1[0] = data & 0x3; - m_gb_spal1[1] = (data & 0xC) >> 2; - m_gb_spal1[2] = (data & 0x30) >> 4; - m_gb_spal1[3] = (data & 0xC0) >> 6; - break; - case 0x0c: /* Undocumented register involved in selecting gb/gbc mode */ - logerror("Write to undocumented register: %X = %X\n", offset, data); - break; - case 0x0F: /* VBK - VRAM bank select */ - m_vram_bank = data & 0x01; - data |= 0xFE; - break; - case 0x11: /* HDMA1 - HBL General DMA - Source High */ - break; - case 0x12: /* HDMA2 - HBL General DMA - Source Low */ - data &= 0xF0; - break; - case 0x13: /* HDMA3 - HBL General DMA - Destination High */ - data &= 0x1F; - break; - case 0x14: /* HDMA4 - HBL General DMA - Destination Low */ - data &= 0xF0; - break; - case 0x15: /* HDMA5 - HBL General DMA - Mode, Length */ - if (!(data & 0x80)) - { - if (m_hdma_enabled) - { - m_hdma_enabled = 0; - data = HDMA5 & 0x80; - } - else - { - /* General DMA */ - hdma_trans(((data & 0x7F) + 1) * 0x10); -// cpunum_set_reg(0, LR35902_DMA_CYCLES, 4 + (((data & 0x7F) + 1) * 32)); - data = 0xff; - } - } - else - { - /* H-Blank DMA */ - m_hdma_enabled = 1; - data &= 0x7f; - m_vid_regs[offset] = data; - /* Check if HDMA should be immediately performed */ - if (m_hdma_possible) - { - hdma_trans(0x10); -// cpunum_set_reg(0, LR35902_DMA_CYCLES, 36); - m_hdma_possible = 0; - } - } - break; - case 0x28: /* BCPS - Background palette specification */ - GBCBCPS = data; - if (data & 0x01) - GBCBCPD = m_cgb_bpal[(data >> 1) & 0x1F] >> 8; - else - GBCBCPD = m_cgb_bpal[(data >> 1) & 0x1F] & 0xFF; - break; - case 0x29: /* BCPD - background palette data */ - if (m_pal_locked == LOCKED) - { - return; - } - GBCBCPD = data; - if (GBCBCPS & 0x01) - m_cgb_bpal[(GBCBCPS >> 1) & 0x1F] = ((data << 8) | (m_cgb_bpal[(GBCBCPS >> 1) & 0x1F] & 0xFF)) & 0x7FFF; - else - m_cgb_bpal[(GBCBCPS >> 1) & 0x1F] = ((m_cgb_bpal[(GBCBCPS >> 1) & 0x1F] & 0xFF00) | data) & 0x7FFF; - if (GBCBCPS & 0x80) - { - GBCBCPS++; - GBCBCPS &= 0xBF; - } - break; - case 0x2A: /* OCPS - Object palette specification */ - GBCOCPS = data; - if (data & 0x01) - GBCOCPD = m_cgb_spal[(data >> 1) & 0x1F] >> 8; - else - GBCOCPD = m_cgb_spal[(data >> 1) & 0x1F] & 0xFF; - break; - case 0x2B: /* OCPD - Object palette data */ - if (m_pal_locked == LOCKED) - { - return; - } - GBCOCPD = data; - if (GBCOCPS & 0x01) - m_cgb_spal[(GBCOCPS >> 1) & 0x1F] = ((data << 8) | (m_cgb_spal[(GBCOCPS >> 1) & 0x1F] & 0xFF)) & 0x7FFF; - else - m_cgb_spal[(GBCOCPS >> 1) & 0x1F] = ((m_cgb_spal[(GBCOCPS >> 1) & 0x1F] & 0xFF00) | data) & 0x7FFF; - if (GBCOCPS & 0x80) - { - GBCOCPS++; - GBCOCPS &= 0xBF; - } - break; - /* Undocumented registers */ - case 0x2C: - /* bit 0 can be read/written */ - logerror("Write to undocumented register: %X = %X\n", offset, data); - data = 0xFE | (data & 0x01); - if (data & 0x01) - { - m_gbc_mode = 0; - } - break; - case 0x32: - case 0x33: - case 0x34: - /* whole byte can be read/written */ - logerror("Write to undocumented register: %X = %X\n", offset, data); - break; - case 0x35: - /* bit 4-6 can be read/written */ - logerror("Write to undocumented register: %X = %X\n", offset, data); - data = 0x8F | (data & 0x70); - break; - case 0x36: - case 0x37: - logerror("Write to undocumented register: %X = %X\n", offset, data); - return; - default: - /* we didn't handle the write, so pass it to the GB handler */ - gb_lcd_device::video_w(space, offset, data); - return; - } - - m_vid_regs[offset] = data; -} - -// Super Game Boy - -void sgb_lcd_device::sgb_io_write_pal(int offs, UINT8 *data) -{ - switch (offs) - { - case 0x00: /* PAL01 */ - m_sgb_pal[0 * 4 + 0] = data[1] | (data[2] << 8); - m_sgb_pal[0 * 4 + 1] = data[3] | (data[4] << 8); - m_sgb_pal[0 * 4 + 2] = data[5] | (data[6] << 8); - m_sgb_pal[0 * 4 + 3] = data[7] | (data[8] << 8); - m_sgb_pal[1 * 4 + 0] = data[1] | (data[2] << 8); - m_sgb_pal[1 * 4 + 1] = data[9] | (data[10] << 8); - m_sgb_pal[1 * 4 + 2] = data[11] | (data[12] << 8); - m_sgb_pal[1 * 4 + 3] = data[13] | (data[14] << 8); - break; - case 0x01: /* PAL23 */ - m_sgb_pal[2 * 4 + 0] = data[1] | (data[2] << 8); - m_sgb_pal[2 * 4 + 1] = data[3] | (data[4] << 8); - m_sgb_pal[2 * 4 + 2] = data[5] | (data[6] << 8); - m_sgb_pal[2 * 4 + 3] = data[7] | (data[8] << 8); - m_sgb_pal[3 * 4 + 0] = data[1] | (data[2] << 8); - m_sgb_pal[3 * 4 + 1] = data[9] | (data[10] << 8); - m_sgb_pal[3 * 4 + 2] = data[11] | (data[12] << 8); - m_sgb_pal[3 * 4 + 3] = data[13] | (data[14] << 8); - break; - case 0x02: /* PAL03 */ - m_sgb_pal[0 * 4 + 0] = data[1] | (data[2] << 8); - m_sgb_pal[0 * 4 + 1] = data[3] | (data[4] << 8); - m_sgb_pal[0 * 4 + 2] = data[5] | (data[6] << 8); - m_sgb_pal[0 * 4 + 3] = data[7] | (data[8] << 8); - m_sgb_pal[3 * 4 + 0] = data[1] | (data[2] << 8); - m_sgb_pal[3 * 4 + 1] = data[9] | (data[10] << 8); - m_sgb_pal[3 * 4 + 2] = data[11] | (data[12] << 8); - m_sgb_pal[3 * 4 + 3] = data[13] | (data[14] << 8); - break; - case 0x03: /* PAL12 */ - m_sgb_pal[1 * 4 + 0] = data[1] | (data[2] << 8); - m_sgb_pal[1 * 4 + 1] = data[3] | (data[4] << 8); - m_sgb_pal[1 * 4 + 2] = data[5] | (data[6] << 8); - m_sgb_pal[1 * 4 + 3] = data[7] | (data[8] << 8); - m_sgb_pal[2 * 4 + 0] = data[1] | (data[2] << 8); - m_sgb_pal[2 * 4 + 1] = data[9] | (data[10] << 8); - m_sgb_pal[2 * 4 + 2] = data[11] | (data[12] << 8); - m_sgb_pal[2 * 4 + 3] = data[13] | (data[14] << 8); - break; - case 0x04: /* ATTR_BLK */ - { - UINT8 I, J, K, o; - for( K = 0; K < data[1]; K++ ) - { - o = K * 6; - if( data[o + 2] & 0x1 ) - { - for( I = data[ o + 4]; I <= data[o + 6]; I++ ) - { - for( J = data[o + 5]; J <= data[o + 7]; J++ ) - { - m_sgb_pal_map[I][J] = data[o + 3] & 0x3; - } - } - } - } - } - break; - case 0x05: /* ATTR_LIN */ - { - UINT8 J, K; - if( data[1] > 15 ) - data[1] = 15; - for( K = 0; K < data[1]; K++ ) - { - if( data[K + 1] & 0x80 ) - { - for( J = 0; J < 20; J++ ) - { - m_sgb_pal_map[J][data[K + 1] & 0x1f] = (data[K + 1] & 0x60) >> 5; - } - } - else - { - for( J = 0; J < 18; J++ ) - { - m_sgb_pal_map[data[K + 1] & 0x1f][J] = (data[K + 1] & 0x60) >> 5; - } - } - } - } - break; - case 0x06: /* ATTR_DIV */ - { - UINT8 I, J; - if( data[1] & 0x40 ) /* Vertical */ - { - for( I = 0; I < data[2]; I++ ) - { - for( J = 0; J < 20; J++ ) - { - m_sgb_pal_map[J][I] = (data[1] & 0xC) >> 2; - } - } - for( J = 0; J < 20; J++ ) - { - m_sgb_pal_map[J][data[2]] = (data[1] & 0x30) >> 4; - } - for( I = data[2] + 1; I < 18; I++ ) - { - for( J = 0; J < 20; J++ ) - { - m_sgb_pal_map[J][I] = data[1] & 0x3; - } - } - } - else /* Horizontal */ - { - for( I = 0; I < data[2]; I++ ) - { - for( J = 0; J < 18; J++ ) - { - m_sgb_pal_map[I][J] = (data[1] & 0xC) >> 2; - } - } - for( J = 0; J < 18; J++ ) - { - m_sgb_pal_map[data[2]][J] = (data[1] & 0x30) >> 4; - } - for( I = data[2] + 1; I < 20; I++ ) - { - for( J = 0; J < 18; J++ ) - { - m_sgb_pal_map[I][J] = data[1] & 0x3; - } - } - } - } - break; - case 0x07: /* ATTR_CHR */ - { - UINT16 I, sets; - UINT8 x, y; - sets = (data[3] | (data[4] << 8) ); - if( sets > 360 ) - sets = 360; - sets >>= 2; - sets += 6; - x = data[1]; - y = data[2]; - if( data[5] ) /* Vertical */ - { - for( I = 6; I < sets; I++ ) - { - m_sgb_pal_map[x][y++] = (data[I] & 0xC0) >> 6; - if( y > 17 ) - { - y = 0; - x++; - if( x > 19 ) - x = 0; - } - - m_sgb_pal_map[x][y++] = (data[I] & 0x30) >> 4; - if( y > 17 ) - { - y = 0; - x++; - if( x > 19 ) - x = 0; - } - - m_sgb_pal_map[x][y++] = (data[I] & 0xC) >> 2; - if( y > 17 ) - { - y = 0; - x++; - if( x > 19 ) - x = 0; - } - - m_sgb_pal_map[x][y++] = data[I] & 0x3; - if( y > 17 ) - { - y = 0; - x++; - if( x > 19 ) - x = 0; - } - } - } - else /* horizontal */ - { - for( I = 6; I < sets; I++ ) - { - m_sgb_pal_map[x++][y] = (data[I] & 0xC0) >> 6; - if( x > 19 ) - { - x = 0; - y++; - if( y > 17 ) - y = 0; - } - - m_sgb_pal_map[x++][y] = (data[I] & 0x30) >> 4; - if( x > 19 ) - { - x = 0; - y++; - if( y > 17 ) - y = 0; - } - - m_sgb_pal_map[x++][y] = (data[I] & 0xC) >> 2; - if( x > 19 ) - { - x = 0; - y++; - if( y > 17 ) - y = 0; - } - - m_sgb_pal_map[x++][y] = data[I] & 0x3; - if( x > 19 ) - { - x = 0; - y++; - if( y > 17 ) - y = 0; - } - } - } - } - break; - case 0x08: /* SOUND */ - /* This command enables internal sound effects */ - /* Not Implemented */ - break; - case 0x09: /* SOU_TRN */ - /* This command sends data to the SNES sound processor. - We'll need to emulate that for this to be used */ - /* Not Implemented */ - break; - case 0x0A: /* PAL_SET */ - { - UINT16 index_; - - /* Palette 0 */ - index_ = (UINT16)(data[1] | (data[2] << 8)) * 4; - m_sgb_pal[0] = m_sgb_pal_data[index_]; - m_sgb_pal[1] = m_sgb_pal_data[index_ + 1]; - m_sgb_pal[2] = m_sgb_pal_data[index_ + 2]; - m_sgb_pal[3] = m_sgb_pal_data[index_ + 3]; - /* Palette 1 */ - index_ = (UINT16)(data[3] | (data[4] << 8)) * 4; - m_sgb_pal[4] = m_sgb_pal_data[index_]; - m_sgb_pal[5] = m_sgb_pal_data[index_ + 1]; - m_sgb_pal[6] = m_sgb_pal_data[index_ + 2]; - m_sgb_pal[7] = m_sgb_pal_data[index_ + 3]; - /* Palette 2 */ - index_ = (UINT16)(data[5] | (data[6] << 8)) * 4; - m_sgb_pal[8] = m_sgb_pal_data[index_]; - m_sgb_pal[9] = m_sgb_pal_data[index_ + 1]; - m_sgb_pal[10] = m_sgb_pal_data[index_ + 2]; - m_sgb_pal[11] = m_sgb_pal_data[index_ + 3]; - /* Palette 3 */ - index_ = (UINT16)(data[7] | (data[8] << 8)) * 4; - m_sgb_pal[12] = m_sgb_pal_data[index_]; - m_sgb_pal[13] = m_sgb_pal_data[index_ + 1]; - m_sgb_pal[14] = m_sgb_pal_data[index_ + 2]; - m_sgb_pal[15] = m_sgb_pal_data[index_ + 3]; - /* Attribute File */ - if (data[9] & 0x40) - m_sgb_window_mask = 0; - m_sgb_atf = (data[9] & 0x3f) * (18 * 5); - if (data[9] & 0x80) - { - for (int j = 0; j < 18; j++ ) - { - for (int i = 0; i < 5; i++ ) - { - m_sgb_pal_map[i * 4][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0xC0) >> 6; - m_sgb_pal_map[(i * 4) + 1][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0x30) >> 4; - m_sgb_pal_map[(i * 4) + 2][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0xC) >> 2; - m_sgb_pal_map[(i * 4) + 3][j] = m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0x3; - } - } - } - } - break; - case 0x0B: /* PAL_TRN */ - { - UINT16 col; - - for (int i = 0; i < 2048; i++ ) - { - col = (m_vram[0x0800 + (i * 2) + 1] << 8) | m_vram[0x0800 + (i * 2)]; - m_sgb_pal_data[i] = col; - } - } - break; - case 0x0C: /* ATRC_EN */ - /* Not Implemented */ - break; - case 0x0D: /* TEST_EN */ - /* Not Implemented */ - break; - case 0x0E: /* ICON_EN */ - /* Not Implemented */ - break; - case 0x0F: /* DATA_SND */ - /* Not Implemented */ - break; - case 0x10: /* DATA_TRN */ - /* Not Implemented */ - break; - case 0x12: /* JUMP */ - /* Not Implemented */ - break; - case 0x13: /* CHR_TRN */ - if (data[1] & 0x1) - memcpy(m_sgb_tile_data + 4096, m_vram + 0x0800, 4096); - else - memcpy(m_sgb_tile_data, m_vram + 0x0800, 4096); - break; - case 0x14: /* PCT_TRN */ - { - UINT16 col; - if (m_sgb_border_hack) - { - memcpy(m_sgb_tile_map, m_vram + 0x1000, 2048); - for (int i = 0; i < 64; i++) - { - col = (m_vram[0x0800 + (i * 2) + 1 ] << 8) | m_vram[0x0800 + (i * 2)]; - m_sgb_pal[SGB_BORDER_PAL_OFFSET + i] = col; - } - } - else /* Do things normally */ - { - memcpy(m_sgb_tile_map, m_vram + 0x0800, 2048); - for (int i = 0; i < 64; i++) - { - col = (m_vram[0x1000 + (i * 2) + 1] << 8) | m_vram[0x1000 + (i * 2)]; - m_sgb_pal[SGB_BORDER_PAL_OFFSET + i] = col; - } - } - } - break; - case 0x15: /* ATTR_TRN */ - memcpy(m_sgb_atf_data, m_vram + 0x0800, 4050); - break; - case 0x16: /* ATTR_SET */ - { - /* Attribute File */ - if (data[1] & 0x40) - m_sgb_window_mask = 0; - m_sgb_atf = (data[1] & 0x3f) * (18 * 5); - for (int j = 0; j < 18; j++) - { - for (int i = 0; i < 5; i++) - { - m_sgb_pal_map[i * 4][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0xC0) >> 6; - m_sgb_pal_map[(i * 4) + 1][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0x30) >> 4; - m_sgb_pal_map[(i * 4) + 2][j] = (m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0xC) >> 2; - m_sgb_pal_map[(i * 4) + 3][j] = m_sgb_atf_data[(j * 5) + m_sgb_atf + i] & 0x3; - } - } - } - break; - case 0x17: /* MASK_EN */ - m_sgb_window_mask = data[1]; - break; - case 0x18: /* OBJ_TRN */ - /* Not Implemnted */ - break; - case 0x19: /* ? */ - /* Called by: dkl,dkl2,dkl3,zeldadx - But I don't know what it is for. */ - /* Not Implemented */ - break; - case 0x1E: /* Used by bootrom to transfer the gb cart header */ - break; - case 0x1F: /* Used by bootrom to transfer the gb cart header */ - break; - default: - logerror( "SGB: Unknown Command 0x%02x!\n", data[0] >> 3 ); - } - -} diff --git a/src/mess/video/gb_lcd.h b/src/mess/video/gb_lcd.h deleted file mode 100644 index 31bd0c30403..00000000000 --- a/src/mess/video/gb_lcd.h +++ /dev/null @@ -1,215 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/***************************************************************************** - * - * video/gb_lcd.h - * - ****************************************************************************/ - -#ifndef __GB_LCD_H__ -#define __GB_LCD_H__ - -#include "emu.h" - - -#define _NR_GB_VID_REGS 0x40 - - -struct layer_struct { - UINT8 enabled; - UINT8 *bg_tiles; - UINT8 *bg_map; - UINT8 xindex; - UINT8 xshift; - UINT8 xstart; - UINT8 xend; - /* GBC specific */ - UINT8 *gbc_map; - INT16 bgline; -}; - - -class gb_lcd_device : public device_t, - public device_video_interface -{ -public: - gb_lcd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - gb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER(vram_r); - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_READ8_MEMBER(oam_r); - DECLARE_WRITE8_MEMBER(oam_w); - virtual DECLARE_READ8_MEMBER(video_r); - virtual DECLARE_WRITE8_MEMBER(video_w); - - // FIXME: remove it when proper sgb support is added - void set_sgb_hack(bool val) { m_sgb_border_hack = val ? 1 : 0; } - -protected: - inline void plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - - void select_sprites(); - virtual void update_sprites(); - virtual void update_scanline(); - - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - void common_start(); - void common_reset(); - - // pointer to the main system - cpu_device *m_maincpu; - - // state variables - bitmap_ind16 m_bitmap; - - UINT8 m_sgb_atf_data[4050]; /* (SGB) Attributes files */ - UINT32 m_sgb_atf; - UINT16 m_sgb_pal_data[4096]; - UINT8 m_sgb_pal_map[20][18]; - UINT16 m_sgb_pal[128]; - UINT8 *m_sgb_tile_data; - UINT8 m_sgb_tile_map[2048]; - UINT8 m_sgb_window_mask; - - // this is temporarily needed for a bunch of games which draw the border differently... - int m_sgb_border_hack; - - int m_window_lines_drawn; - - UINT8 m_vid_regs[_NR_GB_VID_REGS]; - UINT8 m_bg_zbuf[160]; - - UINT16 m_cgb_bpal[32]; /* CGB current background palette table */ - UINT16 m_cgb_spal[32]; /* CGB current sprite palette table */ - - UINT8 m_gb_bpal[4]; /* Background palette */ - UINT8 m_gb_spal0[4]; /* Sprite 0 palette */ - UINT8 m_gb_spal1[4]; /* Sprite 1 palette */ - - /* Things used to render current line */ - int m_current_line; /* Current line */ - int m_cmp_line; /* Compare line */ - int m_sprCount; /* Number of sprites on current line */ - int m_sprite[10]; /* References to sprites to draw on current line */ - int m_previous_line; /* Previous line we've drawn in */ - int m_start_x; /* Pixel to start drawing from (inclusive) */ - int m_end_x; /* Pixel to end drawing (exclusive) */ - int m_mode; /* Keep track of internal STAT mode */ - int m_state; /* Current state of the video state machine */ - int m_lcd_irq_line; - int m_triggering_line_irq; - int m_line_irq; - int m_triggering_mode_irq; - int m_mode_irq; - int m_delayed_line_irq; - int m_sprite_cycles; - int m_scrollx_adjust; - int m_oam_locked; - int m_vram_locked; - int m_pal_locked; - int m_hdma_enabled; - int m_hdma_possible; - struct layer_struct m_layer[2]; - emu_timer *m_lcd_timer; - int m_gbc_mode; - - UINT8 *m_vram; // Pointer to VRAM - UINT8 *m_oam; // Pointer to OAM memory - UINT8 m_gb_tile_no_mod; - UINT32 m_gb_chrgen_offs; // GB Character generator - UINT32 m_gb_bgdtab_offs; // GB Background character table - UINT32 m_gb_wndtab_offs; // GB Window character table - UINT32 m_gbc_chrgen_offs; // CGB Character generator - UINT32 m_gbc_bgdtab_offs; // CGB Background character table - UINT32 m_gbc_wndtab_offs; // CGB Window character table - int m_vram_bank; - - TIMER_CALLBACK_MEMBER(video_init_vbl); - virtual TIMER_CALLBACK_MEMBER(lcd_timer_proc); - virtual void videoptr_restore(); - void save_gb_video(); - void increment_scanline(); - void lcd_switch_on(); -}; - - -class mgb_lcd_device : public gb_lcd_device -{ -public: - mgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -protected: - - // device-level overrides - virtual void device_start(); -}; - - -class sgb_lcd_device : public gb_lcd_device -{ -public: - sgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - void sgb_io_write_pal(int offs, UINT8 *data); - -protected: - - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - virtual void update_sprites(); - virtual void update_scanline(); - void refresh_border(); -}; - - -class cgb_lcd_device : public gb_lcd_device -{ -public: - cgb_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual DECLARE_READ8_MEMBER(video_r); - virtual DECLARE_WRITE8_MEMBER(video_w); - -protected: - - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - virtual void update_sprites(); - virtual void update_scanline(); - - virtual TIMER_CALLBACK_MEMBER(lcd_timer_proc); - virtual void videoptr_restore(); - void hdma_trans(UINT16 length); -}; - - -extern const device_type GB_LCD_DMG; -extern const device_type GB_LCD_MGB; -extern const device_type GB_LCD_SGB; -extern const device_type GB_LCD_CGB; - - -#define MCFG_GB_LCD_DMG_ADD(_tag ) \ - MCFG_DEVICE_ADD( _tag, GB_LCD_DMG, 0 ) - -#define MCFG_GB_LCD_MGB_ADD(_tag ) \ - MCFG_DEVICE_ADD( _tag, GB_LCD_MGB, 0 ) - -#define MCFG_GB_LCD_SGB_ADD(_tag ) \ - MCFG_DEVICE_ADD( _tag, GB_LCD_SGB, 0 ) - -#define MCFG_GB_LCD_CGB_ADD(_tag ) \ - MCFG_DEVICE_ADD( _tag, GB_LCD_CGB, 0 ) - - -#endif /* GB_LCD_H_ */ diff --git a/src/mess/video/gba.c b/src/mess/video/gba.c deleted file mode 100644 index 0699f047c98..00000000000 --- a/src/mess/video/gba.c +++ /dev/null @@ -1,1901 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:R. Belmont,Ryan Holtz -/*************************************************************************** - - gba.c - - File to handle emulation of the video hardware of the Game Boy Advance - - By R. Belmont, MooglyGuy - -***************************************************************************/ - -#include "emu.h" -#include "includes/gba.h" - -#define VERBOSE_LEVEL (0) - -INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ...) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%08x: %s", machine.driver_data()->m_maincpu->pc(), buf ); - } -} - -static const int coeff[32] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 -}; - -/* Utility functions */ -INLINE UINT32 alpha_blend_pixel(UINT32 color0, UINT32 color1, int ca, int cb); -INLINE UINT32 increase_brightness(UINT32 color, int coeff_); -INLINE UINT32 decrease_brightness(UINT32 color, int coeff_); - -#define GBA_MODE0 0 -#define GBA_MODE1 1 -#define GBA_MODE2 2 -#define GBA_MODE345 3 - -#define GBA_SUBMODE0 0 -#define GBA_SUBMODE1 1 -#define GBA_SUBMODE2 2 - -inline void gba_state::update_mask(UINT8* mask, int mode, int submode, UINT32* obj_win, UINT8 inwin0, UINT8 inwin1, UINT8 in0_mask, UINT8 in1_mask, UINT8 out_mask) -{ - UINT8 mode_mask = 0; - if (submode == GBA_SUBMODE2) - { - for (int x = 0; x < 240; x++) - { - mask[x] = out_mask; - - if ((obj_win[x] & 0x80000000) == 0) - mask[x] = m_WINOUT >> 8; - - if (inwin1) - { - if (is_in_window(x, 1)) - mask[x] = in1_mask; - } - - if (inwin0) - { - if (is_in_window(x, 0)) - mask[x] = in0_mask; - } - } - } - - if (mode == GBA_MODE1) - { - // disable line3 - mode_mask = ~0x08; - } - else if (mode == GBA_MODE2) - { - // disable line0 & line1 - mode_mask = ~0x03; - } - else if (mode == GBA_MODE345) - { - // disable line0, line1 & line3 - mode_mask = ~0x0b; - } - - - if (mode_mask) - { - for (int x = 0; x < 240; x++) - mask[x] &= mode_mask; - } -} - -void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) -{ - UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; - int inWindow0 = 0; - int inWindow1 = 0; - UINT8 inWin0Mask = m_WININ & 0x00ff; - UINT8 inWin1Mask = m_WININ >> 8; - UINT8 outMask = m_WINOUT & 0x00ff; - UINT8 masks[240]; // this puts together WinMasks with the fact that some modes/submodes skip specific layers! - - if (submode == GBA_SUBMODE2) - { - if (m_DISPCNT & DISPCNT_WIN0_EN) - { - UINT8 v0 = m_WIN0V >> 8; - UINT8 v1 = m_WIN0V & 0x00ff; - inWindow0 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; - if (v1 >= v0) - inWindow0 |= (y >= v0 && y < v1) ? 1 : 0; - else - inWindow0 |= (y >= v0 || y < v1) ? 1 : 0; - } - - if (m_DISPCNT & DISPCNT_WIN1_EN) - { - UINT8 v0 = m_WIN1V >> 8; - UINT8 v1 = m_WIN1V & 0x00ff; - inWindow1 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; - if (v1 >= v0) - inWindow1 |= (y >= v0 && y < v1) ? 1 : 0; - else - inWindow1 |= (y >= v0 || y < v1) ? 1 : 0; - } - } - - // Draw BG - switch (mode) - { - case 0: - draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); - draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); - draw_bg_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2HOFS, m_BG2VOFS); - draw_bg_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3HOFS, m_BG3VOFS); - break; - case 1: - draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); - draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); - draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); - break; - case 2: - draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); - draw_roz_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3X, m_BG3Y, m_BG3PA, m_BG3PB, m_BG3PC, m_BG3PD, &m_gfxBG3X, &m_gfxBG3Y, m_gfxBG3Changed); - break; - case 3: - case 4: - case 5: - draw_roz_bitmap_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed, bpp); - break; - } - - // Draw OAM - draw_gba_oam(lineOBJ, y); - if (submode == GBA_SUBMODE2) - draw_gba_oam_window(lineOBJWin, y); - - memset(masks, 0xff, sizeof(masks)); - update_mask(&masks[0], mode, submode, lineOBJWin, inWindow0, inWindow1, inWin0Mask, inWin1Mask, outMask); - - for (int x = 0; x < 240; x++) - { - UINT32 color = backdrop; - UINT8 top = 0x20; - - if ((UINT8)(line0[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x01) - { - color = line0[x]; - top = 0x01; - } - - if ((UINT8)(line1[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x02) - { - color = line1[x]; - top = 0x02; - } - - if ((UINT8)(line2[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x04) - { - color = line2[x]; - top = 0x04; - } - - if ((UINT8)(line3[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x08) - { - color = line3[x]; - top = 0x08; - } - - if ((UINT8)(lineOBJ[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x10) - { - color = lineOBJ[x]; - top = 0x10; - } - - if (color & 0x00010000) - { - if (submode != GBA_SUBMODE0 || top == 0x10) - { - UINT32 back = backdrop; - UINT8 top2 = 0x20; - - if ((UINT8)(line0[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x01) - { - back = line0[x]; - top2 = 0x01; - } - - if ((UINT8)(line1[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x02) - { - back = line1[x]; - top2 = 0x02; - } - - if ((UINT8)(line2[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x04) - { - back = line2[x]; - top2 = 0x04; - } - - if ((UINT8)(line3[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x08) - { - back = line3[x]; - top2 = 0x08; - } - - if (top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) - color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); - else - { - if (top & m_BLDCNT) - { - switch(m_BLDCNT & BLDCNT_SFX) - { - case BLDCNT_SFX_LIGHTEN: - color = increase_brightness(color, coeff[m_BLDY & 0x1f]); - break; - case BLDCNT_SFX_DARKEN: - color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); - break; - } - } - } - } - } - else if (submode == GBA_SUBMODE1 || (submode == GBA_SUBMODE2 && masks[x] & 0x20)) - { - if (top & m_BLDCNT) - { - switch(m_BLDCNT & BLDCNT_SFX) - { - case BLDCNT_SFX_NONE: - break; - case BLDCNT_SFX_ALPHA: - { - UINT32 back = backdrop; - UINT8 top2 = 0x20; - - if ((UINT8)(line0[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x01) - { - if (top != 0x01) - { - back = line0[x]; - top2 = 0x01; - } - } - - if ((UINT8)(line1[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x02) - { - if (top != 0x02) - { - back = line1[x]; - top2 = 0x02; - } - } - - if ((UINT8)(line2[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x04) - { - if (top != 0x04) - { - back = line2[x]; - top2 = 0x04; - } - } - - if ((UINT8)(line3[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x08) - { - if (top != 0x08) - { - back = line3[x]; - top2 = 0x08; - } - } - - if ((UINT8)(lineOBJ[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x10) - { - if (top != 0x10) - { - back = lineOBJ[x]; - top2 = 0x10; - } - } - - if (top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) - color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); - } - break; - case BLDCNT_SFX_LIGHTEN: - color = increase_brightness(color, coeff[m_BLDY & 0x1f]); - break; - case BLDCNT_SFX_DARKEN: - color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); - break; - } - } - } - lineMix[x] = color; - } - if (mode == GBA_MODE1 || mode == GBA_MODE2 || mode == GBA_MODE345) - m_gfxBG2Changed = 0; - if (mode == GBA_MODE2) - m_gfxBG3Changed = 0; -} - -void gba_state::draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth) -{ - UINT8 *src8 = (UINT8 *)m_gba_vram.target(); - UINT16 *src16 = (UINT16 *)m_gba_vram.target(); - UINT16 *palette = (UINT16 *)m_gba_pram.target(); - INT32 sx = (depth == 4) ? 160 : 240; - INT32 sy = (depth == 4) ? 128 : 160; - UINT32 prio = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; - INT32 cx, cy, pixx, pixy, x; - - if ((depth == 8) && (m_DISPCNT & DISPCNT_FRAMESEL)) - src8 += 0xa000; - - if ((depth == 4) && (m_DISPCNT & DISPCNT_FRAMESEL)) - src16 += 0xa000/2; - - // sign extend roz parameters - if (X & 0x08000000) X |= 0xf0000000; - if (Y & 0x08000000) Y |= 0xf0000000; - if (PA & 0x8000) PA |= 0xffff0000; - if (PB & 0x8000) PB |= 0xffff0000; - if (PC & 0x8000) PC |= 0xffff0000; - if (PD & 0x8000) PD |= 0xffff0000; - - if(ypos == 0) - changed = 3; - - if(changed & 1) - *currentx = X; - else - *currentx += PB; - - if(changed & 2) - *currenty = Y; - else - *currenty += PD; - - cx = *currentx; - cy = *currenty; - - if(ctrl & BGCNT_MOSAIC) - { - INT32 mosaic_line = ((m_MOSAIC & 0xf0) >> 4) + 1; - INT32 tempy = (ypos / mosaic_line) * mosaic_line; - cx = X + tempy*PB; - cy = Y + tempy*PD; - } - - pixx = cx >> 8; - pixy = cy >> 8; - - for(x = 0; x < 240; x++) - { - if(pixx < 0 || pixy < 0 || pixx >= sx || pixy >= sy) - { - scanline[x] = 0x80000000; - } - else - { - if (depth == 8) - { - UINT8 color = src8[pixy*sx + pixx]; - scanline[x] = color ? (palette[color] | prio) : 0x80000000; - } - else - { - scanline[x] = src16[pixy*sx + pixx] | prio; - } - } - - cx += PA; - cy += PC; - - pixx = cx >> 8; - pixy = cy >> 8; - } - - if(ctrl & BGCNT_MOSAIC) - { - INT32 mosaicx = (m_MOSAIC & 0x0f) + 1; - if(mosaicx > 1) - { - INT32 m = 1; - for(x = 0; x < 239; x++) - { - scanline[x+1] = scanline[x]; - m++; - if(m == mosaicx) - { - m = 1; - x++; - } - } - } - } -} - -void gba_state::draw_roz_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed) -{ - UINT32 base, mapbase, size; - static const INT32 sizes[4] = { 128, 256, 512, 1024 }; - INT32 cx, cy, pixx, pixy; - UINT8 *mgba_vram = (UINT8 *)m_gba_vram.target(); - UINT32 tile; - UINT16 *pgba_pram = (UINT16 *)m_gba_pram.target(); - UINT16 pixel; - UINT32 prio = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; - int x = 0; - - for (x = 0; x < 240; x++) - scanline[x] = 0x80000000; - - if (m_DISPCNT & enablemask) - { - base = ((ctrl & BGCNT_CHARBASE) >> BGCNT_CHARBASE_SHIFT) * 0x4000; // VRAM base of tiles - mapbase = ((ctrl & BGCNT_SCREENBASE) >> BGCNT_SCREENBASE_SHIFT) * 0x800; // VRAM base of map - size = (ctrl & BGCNT_SCREENSIZE) >> BGCNT_SCREENSIZE_SHIFT; // size of map in submaps - - // sign extend roz parameters - if (X & 0x08000000) X |= 0xf0000000; - if (Y & 0x08000000) Y |= 0xf0000000; - if (PA & 0x8000) PA |= 0xffff0000; - if (PB & 0x8000) PB |= 0xffff0000; - if (PC & 0x8000) PC |= 0xffff0000; - if (PD & 0x8000) PD |= 0xffff0000; - - if(ypos == 0) - changed = 3; - - if(changed & 1) - *currentx = X; - else - *currentx += PB; - - if(changed & 2) - *currenty = Y; - else - *currenty += PD; - - cx = *currentx; - cy = *currenty; - - if(ctrl & BGCNT_MOSAIC) - { - int mosaic_line = ((m_MOSAIC & 0xf0) >> 4) + 1; - int y = ypos % mosaic_line; - cx -= y*PB; - cy -= y*PD; - } - - pixx = cx >> 8; - pixy = cy >> 8; - - if(ctrl & BGCNT_PALETTESET_WRAP) - { - pixx %= sizes[size]; - pixy %= sizes[size]; - if(pixx < 0) - { - pixx += sizes[size]; - } - if(pixy < 0) - { - pixy += sizes[size]; - } - } - - for(x = 0; x < 240; x++) - { - if(pixx < 0 || pixy < 0 || pixx >= sizes[size] || pixy >= sizes[size]) - { - scanline[x] = 0x80000000; - } - else - { - int tilex = pixx & 7; - int tiley = pixy & 7; - - // shall we shift for (ctrl & BGCNT_PALETTE256)?? or is not effective for ROZ? - tile = mgba_vram[mapbase + (pixx >> 3) + (pixy >> 3) * (sizes[size] >> 3)]; - pixel = mgba_vram[base + (tile << 6) + (tiley << 3) + tilex]; - - // plot it - scanline[x] = pixel ? (pgba_pram[pixel] | prio) : 0x80000000; - } - - cx += PA; - cy += PC; - - pixx = cx >> 8; - pixy = cy >> 8; - - if(ctrl & BGCNT_PALETTESET_WRAP) - { - pixx %= sizes[size]; - pixy %= sizes[size]; - if(pixx < 0) - { - pixx += sizes[size]; - } - if(pixy < 0) - { - pixy += sizes[size]; - } - } - } - - if(ctrl & BGCNT_MOSAIC) - { - int mosaicx = (m_MOSAIC & 0x0f) + 1; - if(mosaicx > 1) - { - int m = 1; - for(x = 0; x < 239; x++) - { - scanline[x+1] = scanline[x]; - m++; - if(m == mosaicx) - { - m = 1; - x++; - } - } - } - } - } -} - -void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, UINT32 hofs, UINT32 vofs) -{ - UINT8 *vram = (UINT8*)m_gba_vram.target(); - UINT16 *palette = (UINT16*)m_gba_pram.target(); - UINT8 *chardata = &vram[((ctrl & BGCNT_CHARBASE) >> BGCNT_CHARBASE_SHIFT) * 0x4000]; - UINT16 *screendata = (UINT16*)&vram[((ctrl & BGCNT_SCREENBASE) >> BGCNT_SCREENBASE_SHIFT) * 0x800]; - UINT32 priority = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; - INT32 width = 256; - INT32 height = 256; - INT32 maskx, masky, pixx, pixy; - UINT8 use_mosaic = (ctrl & BGCNT_MOSAIC) ? 1 : 0; - INT32 mosaicx = (m_MOSAIC & 0x000f) + 1; - INT32 mosaicy = ((m_MOSAIC & 0x00f0) >> 4) + 1; - INT32 stride; - int x = 0; - - for (x = 0; x < 240; x++) - scanline[x] = 0x80000000; - - if(m_DISPCNT & enablemask) - { - switch((ctrl & BGCNT_SCREENSIZE) >> BGCNT_SCREENSIZE_SHIFT) - { - case 1: - width = 512; - break; - case 2: - height = 512; - break; - case 3: - width = 512; - height = 512; - break; - } - - maskx = width - 1; - masky = height - 1; - - pixx = hofs & maskx; - pixy = (vofs + ypos) & masky; - - if(use_mosaic) - { - if((ypos % mosaicy) != 0) - { - mosaicy = (ypos / mosaicy) * mosaicy; - pixy = (vofs + mosaicy) & masky; - } - } - - if(pixy > 255 && height > 256) - { - pixy &= 0x000000ff; - screendata += 0x400; - if(width > 256) - { - screendata += 0x400; - } - } - - stride = (pixy >> 3) << 5; - - UINT16 *src = screendata + 0x400 * (pixx >> 8) + ((pixx & 255) >> 3) + stride; - for(x = 0; x < 240; x++) - { - UINT16 data = *src; - INT32 tile = data & TILEOBJ_TILE; - INT32 tilex = pixx & 7; - INT32 tiley = pixy & 7; - UINT8 color; - UINT8 palindex; - - if(data & TILEOBJ_HFLIP) - { - tilex = 7 - tilex; - } - if(data & TILEOBJ_VFLIP) - { - tiley = 7 - tiley; - } - - if (ctrl & BGCNT_PALETTE256) - { - color = chardata[(tile << 6) + (tiley << 3) + tilex]; - palindex = 0; - } - else - { - color = chardata[(tile << 5) + (tiley << 2) + (tilex >> 1)]; - - if (tilex & 1) - color >>= 4; - else - color &= 0x0f; - palindex = (data >> 8) & 0x00f0; - } - - if (color) - scanline[x] = palette[palindex + color] | priority; - else - scanline[x] = 0x80000000; - - if (data & TILEOBJ_HFLIP) - { - if (tilex == 0) - { - src++; - } - } - else if (tilex == 7) - { - src++; - } - - pixx++; - if(pixx == 256) - { - if(width > 256) - { - src = screendata + 0x400 + stride; - } - else - { - src = screendata + stride; - pixx = 0; - } - } - else if(pixx >= width) - { - pixx = 0; - src = screendata + stride; - } - } - - if(use_mosaic) - { - if(mosaicx > 1) - { - INT32 m = 1; - for(x = 0; x < 239; x++) - { - scanline[x+1] = scanline[x]; - m++; - if(m == mosaicx) - { - m = 1; - x++; - } - } - } - } - - } -} - -void gba_state::draw_gba_oam_window(UINT32 *scanline, int y) -{ - INT16 gba_oamindex; - UINT32 tilebytebase, tileindex, tiledrawindex; - UINT32 width, height; - UINT16 *pgba_oam = (UINT16 *)m_gba_oam.target(); - UINT8 *src = (UINT8*)m_gba_vram.target(); - int x = 0; - - for (x = 0; x < 240; x++) - scanline[x] = 0x80000000; - - if (m_DISPCNT & DISPCNT_OBJWIN_EN) - { - for( gba_oamindex = 127; gba_oamindex >= 0; gba_oamindex-- ) - { - INT32 sx, sy; - UINT16 attr0, attr1, attr2; - INT32 cury; - - attr0 = pgba_oam[(4*gba_oamindex)+0]; - attr1 = pgba_oam[(4*gba_oamindex)+1]; - attr2 = pgba_oam[(4*gba_oamindex)+2]; - - sx = (attr1 & OBJ_X_COORD); - sy = (attr0 & OBJ_Y_COORD); - - if(sy > 160) - { - sy -= 256; - } - - if ((attr0 & OBJ_MODE) != OBJ_MODE_WINDOW) - { - continue; - } - else - { - width = 0; - height = 0; - switch (attr0 & OBJ_SHAPE ) - { - case OBJ_SHAPE_SQR: - switch(attr1 & OBJ_SIZE ) - { - case OBJ_SIZE_8: - width = 1; - height = 1; - break; - case OBJ_SIZE_16: - width = 2; - height = 2; - break; - case OBJ_SIZE_32: - width = 4; - height = 4; - break; - case OBJ_SIZE_64: - width = 8; - height = 8; - break; - } - break; - case OBJ_SHAPE_HORIZ: - switch(attr1 & OBJ_SIZE ) - { - case OBJ_SIZE_8: - width = 2; - height = 1; - break; - case OBJ_SIZE_16: - width = 4; - height = 1; - break; - case OBJ_SIZE_32: - width = 4; - height = 2; - break; - case OBJ_SIZE_64: - width = 8; - height = 4; - break; - } - break; - case OBJ_SHAPE_VERT: - switch(attr1 & OBJ_SIZE ) - { - case OBJ_SIZE_8: - width = 1; - height = 2; - break; - case OBJ_SIZE_16: - width = 1; - height = 4; - break; - case OBJ_SIZE_32: - width = 2; - height = 4; - break; - case OBJ_SIZE_64: - width = 4; - height = 8; - break; - } - break; - default: - width = 0; - height = 0; - verboselog(machine(), 0, "OAM error: Trying to draw OBJ with OBJ_SHAPE = 3!\n" ); - break; - } - - tiledrawindex = tileindex = (attr2 & OBJ_TILENUM); - tilebytebase = 0x10000; // the index doesn't change in the higher modes, we just ignore sprites that are out of range - - if (attr0 & OBJ_ROZMODE_ROZ) - { - INT32 fx, fy, ax, ay, rx, ry; - INT16 dx, dy, dmx, dmy; - UINT8 color; - - width *= 8; - height *= 8; - - if ((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DISABLE) - { - continue; - } - - fx = width; - fy = height; - - if((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DBLROZ) - { - fx *= 2; - fy *= 2; - } - - cury = y - sy; - - if(cury >= 0 && cury < fy) - { - if(sx < 240 || ((sx + fx) & 0x1ff) < 240) - { - int rot = (attr1 & OBJ_SCALE_PARAM) >> OBJ_SCALE_PARAM_SHIFT; - dx = (INT16)pgba_oam[(rot << 4)+3]; - dmx = (INT16)pgba_oam[(rot << 4)+7]; - dy = (INT16)pgba_oam[(rot << 4)+11]; - dmy = (INT16)pgba_oam[(rot << 4)+15]; - - rx = (width << 7) - (fx >> 1)*dx - (fy >> 1)*dmx + cury * dmx; - ry = (height << 7) - (fx >> 1)*dy - (fy >> 1)*dmy + cury * dmy; - - if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) - { - int inc = 32; - if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) - { - continue; - } - if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) - { - inc = sx >> 2; - } - else - { - tiledrawindex &= 0x3fe; - } - for(x = 0; x < fx; x++) - { - ax = rx >> 8; - ay = ry >> 8; - - if(ax < 0 || ax >= sx || ay < 0 || ay >= sy) - { - } - else - { - color = src[tilebytebase + ((((tiledrawindex + (ay >> 3) * inc) << 5) + ((ay & 0x07) << 3) + ((ax >> 3) << 6) + (ax & 0x07)) & 0x7fff)]; - - if(color) - { - scanline[sx] = 1; - } - } - - sx = (sx + 1) & 0x1ff; - - rx += dx; - ry += dy; - } - } - else - { - int inc = 32; - if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) - { - continue; - } - if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) - { - inc = sx >> 3; - } - for(x = 0; x < fx; x++) - { - ax = rx >> 8; - ay = ry >> 8; - - if(ax < 0 || ax >= sx || ay < 0 || ay >= sy) - { - } - else - { - color = src[tilebytebase + ((((tiledrawindex + (ay >> 3) * inc) << 5) + ((ay & 0x07) << 2) + ((ax >> 3) << 5) + ((ax & 0x07) >> 1)) & 0x7fff)]; - - if(ax & 1) - { - color >>= 4; - } - else - { - color &= 0x0f; - } - - if(color) - { - scanline[sx] = 1; - } - } - - sx = (sx + 1) & 0x1ff; - - rx += dx; - ry += dy; - } - } - } - } - } - else - { - INT32 ax; - int cury_ = y - sy; - - width *= 8; - height *= 8; - - if(cury_ >= 0 && cury_ < height) - { - if( ( (sx < 240) || ( ( (sx + width) & 0x1ff ) < 240 ) ) && (attr0 & OBJ_ROZMODE_DISABLE) == 0) - { - if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) - { - int inc = 32; - int address = 0; - if(attr1 & OBJ_VFLIP) - { - cury_ = height - cury_ - 1; - } - if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) - { - continue; - } - - if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) - { - inc = width >> 2; - } - else - { - tiledrawindex &= 0x3fe; - } - - ax = 0; - if(attr1 & OBJ_HFLIP) - { - ax = width - 1; - } - - address = 0x10000 + ((((tiledrawindex + (cury_ >> 3) * inc) << 5) + ((cury_ & 7) << 3) + ((ax >> 3) << 6) + (ax & 7)) & 0x7fff); - - if(attr1 & OBJ_HFLIP) - { - ax = 7; - } - - for(x = 0; x < width; x++) - { - if(sx < 240) - { - UINT8 color = src[address]; - - if(color) - { - scanline[sx] = 1; - } - } - - sx = (sx + 1) & 0x1ff; - - if(attr1 & OBJ_HFLIP) - { - ax--; - address--; - if(ax == -1) - { - address -= 56; - ax = 7; - } - if(address < 0x10000) - { - address += 0x8000; - } - } - else - { - ax++; - address++; - if(ax == 8) - { - address += 56; - ax = 0; - } - if(address > 0x17fff) - { - address -= 0x8000; - } - } - } - } - else - { - int inc = 32; - UINT32 address; - if(attr1 & OBJ_VFLIP) - { - cury_ = height - cury_ - 1; - } - if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) - { - continue; - } - - if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) - { - inc = width >> 3; - } - - ax = 0; - if(attr1 & OBJ_HFLIP) - { - ax = width - 1; - } - - address = 0x10000 + ((((tiledrawindex + (cury_ >> 3) * inc) << 5) + ((cury_ & 0x07) << 2) + ((ax >> 3) << 5) + ((ax & 0x07) >> 1)) & 0x7fff); - if(attr1 & OBJ_HFLIP) - { - ax = 7; - for(x = width - 1; x >= 0; x--) - { - if(sx < 240) - { - UINT8 color = src[address]; - if(x & 1) - { - color >>= 4; - } - else - { - color &= 0x0f; - } - - if(color) - { - scanline[sx] = 1; - } - } - - sx = (sx + 1) & 0x1ff; - ax--; - if((x & 1) == 0) - { - address--; - } - if(ax == -1) - { - ax = 7; - address -= 28; - } - if(address < 0x10000) - { - address += 0x8000; - } - } - } - else - { - for(x = 0; x < width; x++) - { - if(sx < 240) - { - UINT8 color = src[address]; - - if(x & 1) - { - color >>= 4; - } - else - { - color &= 0x0f; - } - - if(color) - { - scanline[sx] = 1; - } - } - - sx = (sx + 1) & 0x1ff; - ax++; - if(x & 1) - { - address++; - } - if(ax == 8) - { - address += 28; - ax = 0; - } - if(address > 0x17fff) - { - address -= 0x8000; - } - } - } - } - } - } - } - } - } - } -} - -void gba_state::draw_gba_oam(UINT32 *scanline, int y) -{ - INT16 gba_oamindex; - INT32 mosaiccnt = 0; - INT32 mosaicy = ((m_MOSAIC & 0xf000) >> 12) + 1; - INT32 mosaicx = ((m_MOSAIC & 0x0f00) >> 8) + 1; - UINT32 tileindex, tiledrawindex; //, tilebytebase - UINT8 width, height; - UINT16 *pgba_oam = (UINT16 *)m_gba_oam.target(); - UINT8 *src = (UINT8 *)m_gba_vram.target(); - UINT16 *palette = (UINT16*)m_gba_pram.target(); - int x = 0; - - for (x = 0; x < 240; x++) - scanline[x] = 0x80000000; - - if( m_DISPCNT & DISPCNT_OBJ_EN ) - { - for( gba_oamindex = 0; gba_oamindex < 128; gba_oamindex++ ) - { - UINT16 attr0, attr1, attr2; - INT32 cury; - UINT32 prio; - UINT32 priority; - - attr0 = pgba_oam[(4*gba_oamindex)+0]; - attr1 = pgba_oam[(4*gba_oamindex)+1]; - attr2 = pgba_oam[(4*gba_oamindex)+2]; - priority = (attr2 & OBJ_PRIORITY) >> OBJ_PRIORITY_SHIFT; - prio = (priority << 25) | ((attr0 & OBJ_MODE) << 6); - - if ((attr0 & OBJ_MODE) != OBJ_MODE_WINDOW) - { - width = 0; - height = 0; - switch (attr0 & OBJ_SHAPE) - { - case OBJ_SHAPE_SQR: - switch(attr1 & OBJ_SIZE ) - { - case OBJ_SIZE_8: - width = 1; - height = 1; - break; - case OBJ_SIZE_16: - width = 2; - height = 2; - break; - case OBJ_SIZE_32: - width = 4; - height = 4; - break; - case OBJ_SIZE_64: - width = 8; - height = 8; - break; - } - break; - case OBJ_SHAPE_HORIZ: - switch(attr1 & OBJ_SIZE ) - { - case OBJ_SIZE_8: - width = 2; - height = 1; - break; - case OBJ_SIZE_16: - width = 4; - height = 1; - break; - case OBJ_SIZE_32: - width = 4; - height = 2; - break; - case OBJ_SIZE_64: - width = 8; - height = 4; - break; - } - break; - case OBJ_SHAPE_VERT: - switch(attr1 & OBJ_SIZE ) - { - case OBJ_SIZE_8: - width = 1; - height = 2; - break; - case OBJ_SIZE_16: - width = 1; - height = 4; - break; - case OBJ_SIZE_32: - width = 2; - height = 4; - break; - case OBJ_SIZE_64: - width = 4; - height = 8; - break; - } - break; - default: - width = 0; - height = 0; - verboselog(machine(), 0, "OAM error: Trying to draw OBJ with OBJ_SHAPE = 3!\n" ); - break; - } - - tiledrawindex = tileindex = (attr2 & OBJ_TILENUM); -// tilebytebase = 0x10000; // the index doesn't change in the higher modes, we just ignore sprites that are out of range - - if (attr0 & OBJ_ROZMODE_ROZ) - { - INT32 sx, sy; - INT32 fx, fy, rx, ry; - INT16 dx, dy, dmx, dmy; - - width *= 8; - height *= 8; - - if ((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DISABLE) - { - continue; - } - - sx = (attr1 & OBJ_X_COORD); - sy = (attr0 & OBJ_Y_COORD); - - if(sy > 160) - { - sy -= 256; - } - - fx = width; - fy = height; - - if((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DBLROZ) - { - fx *= 2; - fy *= 2; - } - - cury = y - sy; - - if(cury >= 0 && cury < fy) - { - if(sx < 240 || ((sx + fx) & 0x1ff) < 240) - { - INT32 oamparam = (attr1 & OBJ_SCALE_PARAM) >> OBJ_SCALE_PARAM_SHIFT; - - dx = (INT16)pgba_oam[(oamparam << 4)+3]; - dmx = (INT16)pgba_oam[(oamparam << 4)+7]; - dy = (INT16)pgba_oam[(oamparam << 4)+11]; - dmy = (INT16)pgba_oam[(oamparam << 4)+15]; - - if(attr0 & OBJ_MOSAIC) - { - cury -= (cury % mosaicy); - } - - rx = (width << 7) - (fx >> 1)*dx - (fy >> 1)*dmx + cury*dmx; - ry = (height << 7) - (fx >> 1)*dy - (fy >> 1)*dmy + cury*dmy; - - if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) - { - INT32 inc = 32; - - if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) - { - continue; - } - - if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) - { - inc = width >> 2; - } - else - { - tiledrawindex &= 0x3fe; - } - - for(x = 0; x < fx; x++) - { - INT32 pixx = rx >> 8; - INT32 pixy = ry >> 8; - - if(!(pixx < 0 || pixx >= width || pixy < 0 || pixy >= height || sx >= 240)) - { - UINT8 color = src[0x10000 + ((((tiledrawindex + (pixy >> 3) * inc) << 5) + ((pixy & 7) << 3) + ((pixx >> 3) << 6) + (pixx & 7)) & 0x7fff)]; - if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) - { - scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - else if(color != 0 && prio < (scanline[sx] & 0xff000000)) - { - scanline[sx] = palette[256 + color] | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - - if(attr0 & OBJ_MOSAIC) - { - mosaiccnt++; - if(mosaiccnt == mosaicx) - { - mosaiccnt = 0; - } - } - } - - sx++; - sx &= 0x1ff; - - rx += dx; - ry += dy; - } - } - else - { - INT32 inc = 32; - INT32 palentry = (attr2 >> 8) & 0xf0; - - if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) - { - continue; - } - - if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) - { - inc = width >> 3; - } - - for(x = 0; x < fx; x++) - { - INT32 pixx = rx >> 8; - INT32 pixy = ry >> 8; - - if(!(pixx < 0 || pixx >= width || pixy < 0 || pixy >= height || sx >= 240)) - { - UINT8 color = src[0x10000 + ((((tiledrawindex + (pixy >> 3) * inc) << 5) + ((pixy & 7) << 2) + ((pixx >> 3) << 5) + ((pixx & 7) >> 1)) & 0x7fff)]; - - if(pixx & 1) - { - color >>= 4; - } - else - { - color &= 0x0f; - } - - if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) - { - scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - else if(color != 0 && prio < (scanline[sx] & 0xff000000)) - { - scanline[sx] = palette[256 + palentry + color] | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - } - - if(attr0 & OBJ_MOSAIC) - { - mosaiccnt++; - if(mosaiccnt == mosaicx) - { - mosaiccnt = 0; - } - } - - sx++; - - sx &= 0x1ff; - - rx += dx; - ry += dy; - } - } - } - } - } - else - { - INT32 sx, sy; - INT32 vflip = (attr1 & OBJ_VFLIP) ? 1 : 0; - INT32 hflip = (attr1 & OBJ_HFLIP) ? 1 : 0; - - width *= 8; - height *= 8; - - if ((attr0 & OBJ_ROZMODE) == OBJ_ROZMODE_DISABLE) - { - continue; - } - - sx = (attr1 & OBJ_X_COORD); - sy = (attr0 & OBJ_Y_COORD); - - if(sy > 160) - { - sy -= 256; - } - - cury = y - sy; - if(cury >= 0 && cury < height) - { - if(sx < 240 || ((sx + width) & 0x1ff) < 240) - { - if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) - { - INT32 pixx; - INT32 inc = 32; - INT32 address = 0; - - if(vflip) - { - cury = height - cury - 1; - } - - if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) - { - continue; - } - - if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) - { - inc = width >> 2; - } - else - { - tiledrawindex &= 0x3fe; - } - - pixx = 0; - if(hflip) - { - pixx = width - 1; - } - - if(attr0 & OBJ_MOSAIC) - { - cury -= (cury % mosaicy); - } - - address = 0x10000 + ((((tiledrawindex + (cury >> 3) * inc) << 5) + ((cury & 7) << 3) + ((pixx >> 3) << 6) + (pixx & 7)) & 0x7fff); - - if(hflip) - { - pixx = 7; - } - - for(x = 0; x < width; x++) - { - if(sx < 240) - { - UINT8 color = src[address]; - if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) - { - scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - else if(color != 0 && prio < (scanline[sx] & 0xff000000)) - { - scanline[sx] = palette[256 + color] | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - } - - if(attr0 & OBJ_MOSAIC) - { - mosaiccnt++; - if(mosaiccnt == mosaicx) - { - mosaiccnt = 0; - } - } - - sx++; - sx &= 0x1ff; - - if(hflip) - { - pixx--; - address--; - if(pixx == -1) - { - address -= 56; - pixx = 7; - } - if(address < 0x10000) - { - address += 0x8000; - } - } - else - { - pixx++; - address++; - if(pixx == 8) - { - address += 56; - pixx = 0; - } - if(address > 0x17fff) - { - address -= 0x8000; - } - } - } - } - else - { - INT32 pixx; - INT32 inc = 32; - UINT32 address = 0; - - if(vflip) - { - cury = height - cury - 1; - } - - if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) - { - continue; - } - - if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) - { - inc = width >> 3; - } - - pixx = 0; - if(hflip) - { - pixx = width - 1; - } - - if(attr0 & OBJ_MOSAIC) - { - cury -= (cury % mosaicy); - } - - address = 0x10000 + ((((tiledrawindex + (cury >> 3) * inc) << 5) + ((cury & 7) << 2) + ((pixx >> 3) << 5) + ((pixx & 7) >> 1)) & 0x7fff); - - if(hflip) - { - pixx = 7; - for(x = width - 1; x >= 0; x--) - { - if(sx < 240) - { - UINT8 color = src[address]; - UINT8 palentry = (attr2 >> 8) & 0xf0; - - if(x & 1) - { - color >>= 4; - } - else - { - color &= 0x0f; - } - - if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) - { - scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - else if(color != 0 && prio < (scanline[sx] & 0xff000000)) - { - scanline[sx] = palette[256 + palentry + color] | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - } - - sx++; - sx &= 0x1ff; - - pixx--; - if(!(x & 1)) - { - address--; - } - if(pixx == -1) - { - address -= 28; - pixx = 7; - } - if(address < 0x10000) - { - address += 0x8000; - } - } - } - else - { - for(x = 0; x < width; x++) - { - if(sx < 240) - { - UINT8 color = src[address]; - UINT8 palentry = (attr2 >> 8) & 0xf0; - - if(x & 1) - { - color >>= 4; - } - else - { - color &= 0x0f; - } - - if(color == 0 && priority < ((scanline[sx] >> 25) & 3)) - { - scanline[sx] = (scanline[sx] & 0xf9ffffff) | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - else if(color != 0 && prio < (scanline[sx] & 0xff000000)) - { - scanline[sx] = palette[256 + palentry + color] | prio; - if((attr0 & OBJ_MOSAIC) != 0 && mosaiccnt != 0) - { - scanline[sx] = (scanline[sx - 1] & 0xf9ffffff) | prio; - } - } - } - - if(attr0 & OBJ_MOSAIC) - { - mosaiccnt++; - if(mosaiccnt == mosaicx) - { - mosaiccnt = 0; - } - } - - sx++; - sx &= 0x1ff; - - pixx++; - if(x & 1) - { - address++; - } - if(pixx == 8) - { - address += 28; - pixx = 0; - } - if(address > 0x17fff) - { - address -= 0x8000; - } - } - } - } - } - } - } - } - } - } -} - -inline int gba_state::is_in_window(int x, int window) -{ - int x0 = m_WIN0H >> 8; - int x1 = m_WIN0H & 0x00ff; - - if(window == 1) - { - x0 = m_WIN1H >> 8; - x1 = m_WIN1H & 0x00ff; - } - - if(x0 <= x1) - { - if(x >= x0 && x < x1) - { - return 1; - } - } - else - { - if(x >= x0 || x < x1) - { - return 1; - } - } - - return 0; -} - -INLINE UINT32 alpha_blend_pixel(UINT32 color0, UINT32 color1, int ca, int cb) -{ - if(color0 < 0x80000000) - { - int r0 = (color0 >> 0) & 0x1f; - int g0 = (color0 >> 5) & 0x1f; - int b0 = (color0 >> 10) & 0x1f; - int r1 = (color1 >> 0) & 0x1f; - int g1 = (color1 >> 5) & 0x1f; - int b1 = (color1 >> 10) & 0x1f; - int r = ((r0 * ca) >> 4) + ((r1 * cb) >> 4); - int g = ((g0 * ca) >> 4) + ((g1 * cb) >> 4); - int b = ((b0 * ca) >> 4) + ((b1 * cb) >> 4); - - if(r > 0x1f) r = 0x1f; - if(g > 0x1f) g = 0x1f; - if(b > 0x1f) b = 0x1f; - - return (color0 & 0xffff0000) | (b << 10) | (g << 5) | r; - } - return color0; -} - -INLINE UINT32 increase_brightness(UINT32 color, int coeff_) -{ - int r = (color >> 0) & 0x1f; - int g = (color >> 5) & 0x1f; - int b = (color >> 10) & 0x1f; - - r += ((0x1f - r) * coeff_) >> 4; - g += ((0x1f - g) * coeff_) >> 4; - b += ((0x1f - b) * coeff_) >> 4; - - if(r > 0x1f) r = 0x1f; - if(g > 0x1f) g = 0x1f; - if(b > 0x1f) b = 0x1f; - - return (color & 0xffff0000) | (b << 10) | (g << 5) | r; -} - -INLINE UINT32 decrease_brightness(UINT32 color, int coeff_) -{ - int r = (color >> 0) & 0x1f; - int g = (color >> 5) & 0x1f; - int b = (color >> 10) & 0x1f; - - r -= (r * coeff_) >> 4; - g -= (g * coeff_) >> 4; - b -= (b * coeff_) >> 4; - - if(r < 0) r = 0; - if(g < 0) g = 0; - if(b < 0) b = 0; - - return (color & 0xffff0000) | (b << 10) | (g << 5) | r; -} - -void gba_state::draw_scanline(int y) -{ - bitmap_ind16 &bitmap = m_bitmap; - UINT16 *scanline = &bitmap.pix16(y); - UINT8 submode = 0; - int depth = 0; - - // forced blank - if (m_DISPCNT & DISPCNT_BLANK) - { - // forced blank is white - for (int x = 0; x < 240; x++) - scanline[x] = 0x7fff; - return; - } - - if(!m_fxOn && !m_windowOn && !(m_DISPCNT & DISPCNT_OBJWIN_EN)) - submode = GBA_SUBMODE0; - else if(m_fxOn && !m_windowOn && !(m_DISPCNT & DISPCNT_OBJWIN_EN)) - submode = GBA_SUBMODE1; - else - submode = GBA_SUBMODE2; - - if ((m_DISPCNT & 7) == 3) - depth = 16; - else if ((m_DISPCNT & 7) == 4) - depth = 8; - else if ((m_DISPCNT & 7) == 5) - depth = 4; - - //printf("mode = %d, %d\n", m_DISPCNT & 7, submode); - - switch(m_DISPCNT & 7) - { - case 0: - case 1: - case 2: - draw_modes(m_DISPCNT & 7, submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], depth); - break; - case 3: - case 4: - case 5: - draw_modes(GBA_MODE345, submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], depth); - break; - default: - fatalerror("Invalid screen mode (6 or 7)!\n"); - } - - for (int x = 0; x < 240; x++) - { - scanline[x] = m_xferscan[6][1024 + x] & 0x7fff; - } - - return; -} - -void gba_state::video_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); -} - -UINT32 gba_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} diff --git a/src/mess/video/gime.c b/src/mess/video/gime.c deleted file mode 100644 index 83b78e92b25..00000000000 --- a/src/mess/video/gime.c +++ /dev/null @@ -1,2077 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - gime.c - - Implementation of CoCo GIME (Graphics Interrupt Memory Enhancement) - video chip. - - Mid frame raster effects (source John Kowalski) - - Here are the things that get changed mid-frame: - - - Palette registers ($FFB0-$FFBF) - - Horizontal resolution (switches between 256 and 320 pixels, $FF99) - - Horizontal scroll position (bits 0-6 $FF9F) - - Horizontal virtual screen (bit 7 $FF9F) - - Pixel height (bits 0-2 $FF98) - - Border color ($FF9A) - - On the positive side, you don't have to worry about registers - $FF9D/$FF9E being changed mid-frame. Even if they are changed - mid-frame, they have no effect on the displayed image. The video - address only gets latched at the top of the frame. - - - TIMING - - We divide a single frame into five regions - - Region Scanlines (on 192) Field Sync (before right border) - ------ ------------------ -------------------------------- - Top Border 25 1 - Body 192 1 - Bottom Border 26 1 - Vertical Retrace 6 0 - Vertical Blanking 13 (or 13.5) 1 - - Horizontal sync appears to be low only during retrace/blanking but - field sync switches as soon as the last body pixel is displayed - - Note that the GIME trailing edges field sync after the bottom - border; this is different than the MC6847 - -********************************************************************** - - SOFTWARE FOR TIMING TESTING - - Various CoCo 3 programs can "stress test" timing in various ways - - COLOR3: This program was in Rainbow January 1987. It will synchronize - with field sync by polling bit 7 of $FF03 (PIA0) (specifically, it polls - until the rising edge of writes to PIA0 CB1). This causes the loop to - be broken out at the top of vblank. COLOR3 also synchronizes on - horizontal sync through PIA0; it counts 70 hsyncs to get to a point 32 - scanlines into the body. - - DEMO: This SockMaster demo has a main loop that adjusts GIME registers - and shuffles some graphics bytes. From a timing perspective, the - critical piece is a SYNC with PIA field sync (specifically, it SYNCs - with the trailing edge of writes to PIA0 CB1). DEMO does not attempt - to synchronize on horizontal sync; it relies on CPU timing. - - MOON: SockMaster demo. Uses GIME interrupts; FIRQ gets TMR interrupts - and IRQ gets VBORD interrupts. Since it does not use the PIA field - sync, it can be used to demonstrate how the GIME's VBORD interrupt - is distinct. - - BOINK: SockMaster demo. Like DEMO, it SYNCs on the trailing edge - of PIA field sync. Also uses non standard $FF99 LPF mode. If - BOINK "wobbles vertically", it suggests that the main loop is not - executing within a single field sync. BOINK also makes extensive - use of $FF9F scrolling with bit 7 cleared. - - CRYSTAL CITY: Jeremy Spiller game. The intro uses an attribute-less - GIME text mode - -**********************************************************************/ - - -#include "emu.h" -#include "video/gime.h" -#include "machine/6883sam.h" -#include "bus/coco/cococart.h" -#include "machine/ram.h" - - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -#define USE_HORIZONTAL_CLIP false -#define GIME_TYPE_1987 0 -#define NO_ATTRIBUTE 0x80 - -#define LOG_INT_MASKING 0 -#define LOG_GIME 0 -#define LOG_TIMER 0 - - - -//************************************************************************** -// DEVICE SETUP -//************************************************************************** - -//------------------------------------------------- -// ctor -//------------------------------------------------- - -gime_base_device::gime_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const UINT8 *fontdata, const char *shortname, const char *source) - : mc6847_friend_device(mconfig, type, name, tag, owner, clock, fontdata, true, 263, 25+192+26+3, false, shortname, source), - m_write_irq(*this), - m_write_firq(*this), - m_read_floating_bus(*this), - m_maincpu_tag(NULL), - m_ram_tag(NULL), - m_ext_tag(NULL) -{ -} - - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void gime_base_device::device_start(void) -{ - // find the RAM device - make sure that it is started - m_ram = machine().device(m_ram_tag); - if (!m_ram->started()) - throw device_missing_dependencies(); - - // find the CART device - make sure that it is started - m_cart_device = machine().device(m_ext_tag); - if (!m_cart_device->started()) - throw device_missing_dependencies(); - - // find the CPU device - make sure that it is started - m_cpu = machine().device(m_maincpu_tag); - if (!m_cpu->started()) - throw device_missing_dependencies(); - - // inherited device_start - need to do this after checking dependencies - super::device_start(); - - // initialize variables - memset(m_scanlines, 0, sizeof(m_scanlines)); - m_interrupt_value = 0x00; - m_irq = 0x00; - m_firq = 0x00; - - // allocate timer - m_gime_clock_timer = timer_alloc(TIMER_GIME_CLOCK); - - // setup banks - assert(ARRAY_LENGTH(m_read_banks) == ARRAY_LENGTH(m_write_banks)); - for (int i = 0; i < ARRAY_LENGTH(m_read_banks); i++) - { - char buffer[8]; - snprintf(buffer, ARRAY_LENGTH(buffer), "rbank%d", i); - m_read_banks[i] = machine().root_device().membank(buffer); - snprintf(buffer, ARRAY_LENGTH(buffer), "wbank%d", i); - m_write_banks[i] = machine().root_device().membank(buffer); - } - - // resolve callbacks - m_write_irq.resolve_safe(); - m_write_firq.resolve_safe(); - m_read_floating_bus.resolve_safe(0); - - // set up ROM/RAM pointers - m_rom = machine().root_device().memregion(m_maincpu_tag)->base(); - m_cart_rom = m_cart_device->get_cart_base(); - - // populate palettes - for (int color = 0; color < 64; color++) - { - m_composite_palette[color] = get_composite_color(color); - m_composite_bw_palette[color] = black_and_white(m_composite_palette[color]); - m_rgb_palette[color] = get_rgb_color(color); - } - - // set up save states - save_pointer(NAME(m_gime_registers), ARRAY_LENGTH(m_gime_registers)); - save_pointer(NAME(m_mmu), ARRAY_LENGTH(m_mmu)); - save_item(NAME(m_sam_state)); - save_item(NAME(m_ff22_value)); - save_item(NAME(m_interrupt_value)); - save_item(NAME(m_irq)); - save_item(NAME(m_firq)); - save_item(NAME(m_timer_value)); - save_item(NAME(m_is_blinking)); - save_pointer(NAME(m_palette_rotated[0]), 16); -} - - - -//------------------------------------------------- -// get_composite_color -//------------------------------------------------- - -inline gime_base_device::pixel_t gime_base_device::get_composite_color(int color) -{ - /* CMP colors - * - * These colors are of the format IICCCC, where II is the intensity and - * CCCC is the base color. There is some weirdness because intensity - * is often different for each base color. - * - * The code below is based on an algorithm specified in the following - * CoCo BASIC program was used to approximate composite colors. - * (Program by SockMaster): - * - * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 - * 20 SAT=92:CON=70:BRI=-50:L(0)=0:L(1)=47:L(2)=120:L(3)=255 - * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 - * 40 BRI=BRI+CON:FORG=1TO15:R(P)=COS(A)*SAT+BRI - * 50 G(P)=(COS(S)*SAT)*1+BRI:B(P)=(COS(D)*SAT)*1+BRI:P=P+1 - * 55 A=A+W:S=S+W:D=D+W:NEXT:R(P-16)=L(H):G(P-16)=L(H):B(P-16)=L(H) - * 60 NEXT:R(63)=R(48):G(63)=G(48):B(63)=B(48) - * 70 FORH=0TO63STEP1:R=INT(R(H)):G=INT(G(H)):B=INT(B(H)):IFR<0THENR=0 - * 80 IFG<0THENG=0 - * 90 IFB<0THENB=0 - * 91 IFR>255THENR=255 - * 92 IFG>255THENG=255 - * 93 IFB>255THENB=255 - * 100 PRINTRIGHT$(STR$(H),2);" $";:R=R+256:G=G+256:B=B+256 - * 110 PRINTRIGHT$(HEX$(R),2);",$";RIGHT$(HEX$(G),2);",$";RIGHT$(HEX$(B),2) - * 115 IF(H AND15)=15 THENIFINKEY$=""THEN115ELSEPRINT - * 120 NEXT - * - * At one point, we used a different SockMaster program, but the colors - * produced were too dark for people's taste - * - * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 - * 20 SAT=92:CON=53:BRI=-16:L(0)=0:L(1)=47:L(2)=120:L(3)=255 - * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 - * 40 BRI=BRI+CON:FORG=1TO15:R(P)=COS(A)*SAT+BRI - * 50 G(P)=(COS(S)*SAT)*.50+BRI:B(P)=(COS(D)*SAT)*1.9+BRI:P=P+1 - * 55 A=A+W:S=S+W:D=D+W:NEXT:R(P-16)=L(H):G(P-16)=L(H):B(P-16)=L(H) - * 60 NEXT:R(63)=R(48):G(63)=G(48):B(63)=B(48) - * 70 FORH=0TO63STEP1:R=INT(R(H)):G=INT(G(H)):B=INT(B(H)):IFR<0THENR=0 - * 80 IFG<0THENG=0 - * 90 IFB<0THENB=0 - * 91 IFR>255THENR=255 - * 92 IFG>255THENG=255 - * 93 IFB>255THENB=255 - * 100 PRINTRIGHT$(STR$(H),2);" $";:R=R+256:G=G+256:B=B+256 - * 110 PRINTRIGHT$(HEX$(R),2);",$";RIGHT$(HEX$(G),2);",$";RIGHT$(HEX$(B),2) - * 115 IF(H AND15)=15 THENIFINKEY$=""THEN115ELSEPRINT - * 120 NEXT - */ - - double saturation, brightness, contrast; - int offset; - double w; - int r, g, b; - - switch(color) - { - case 0: - r = g = b = 0; - break; - - case 16: - r = g = b = 47; - break; - - case 32: - r = g = b = 120; - break; - - case 48: - case 63: - r = g = b = 255; - break; - - default: - w = .4195456981879*1.01; - contrast = 70; - saturation = 92; - brightness = -50; - brightness += ((color / 16) + 1) * contrast; - offset = (color % 16) - 1 + (color / 16)*15; - r = cos(w*(offset + 9.2)) * saturation + brightness; - g = cos(w*(offset + 14.2)) * saturation + brightness; - b = cos(w*(offset + 19.2)) * saturation + brightness; - - if (r < 0) - r = 0; - else if (r > 255) - r = 255; - - if (g < 0) - g = 0; - else if (g > 255) - g = 255; - - if (b < 0) - b = 0; - else if (b > 255) - b = 255; - break; - } - return (pixel_t) ((r << 16) | (g << 8) | (b << 0)); -} - - - -//------------------------------------------------- -// get_rgb_color -//------------------------------------------------- - -inline gime_base_device::pixel_t gime_base_device::get_rgb_color(int color) -{ - return (((color >> 4) & 2) | ((color >> 2) & 1)) * 0x550000 - | (((color >> 3) & 2) | ((color >> 1) & 1)) * 0x005500 - | (((color >> 2) & 2) | ((color >> 0) & 1)) * 0x000055; -} - - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void gime_base_device::device_reset(void) -{ - /* Tepolt verifies that the GIME registers are all cleared on initialization */ - memset(m_gime_registers, 0, sizeof(m_gime_registers)); - - /* initialize MMU */ - for (int i = 0; i < 8; i++) - m_mmu[i] = m_mmu[i + 8] = 56 + i; - - /* initialize palette */ - memset(m_palette_rotated, 0, sizeof(m_palette_rotated)); - m_palette_rotated_position = 0; - m_palette_rotated_position_used = false; - - /* clear SAM state */ - m_sam_state = 0x0000; - - /* clear interrupts */ - m_interrupt_value = 0x00; - m_irq = 0x00; - m_firq = 0x00; - m_is_blinking = false; - - m_legacy_video = false; - - m_displayed_rgb = false; - - update_memory(); - reset_timer(); -} - - - -//------------------------------------------------- -// device_timer - handle timer callbacks -//------------------------------------------------- - -void gime_base_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case TIMER_GIME_CLOCK: - timer_elapsed(); - break; - - default: - super::device_timer(timer, id, param, ptr); - break; - } -} - - - -//------------------------------------------------- -// device_pre_save - device-specific pre save -//------------------------------------------------- - -void gime_base_device::device_pre_save() -{ - super::device_pre_save(); - - // copy to palette rotation position zero - for (offs_t i = 0; i < 16; i++) - m_palette_rotated[0][i] = m_palette_rotated[m_palette_rotated_position][i]; -} - - -//------------------------------------------------- -// device_post_load - device-specific post load -//------------------------------------------------- - -void gime_base_device::device_post_load() -{ - super::device_post_load(); - update_memory(); - update_cpu_clock(); - - // we update to position zero - m_palette_rotated_position = 0; - m_palette_rotated_position_used = false; -} - - - -//------------------------------------------------- -// device_input_ports -//------------------------------------------------- - -ioport_constructor gime_base_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(mc6847_artifacting); -} - - - -//************************************************************************** -// TIMER -// -// The CoCo 3 had a timer that had would activate when first written to, and -// would decrement over and over again until zero was reached, and at that -// point, would flag an interrupt. At this point, the timer starts back up -// again. -// -// I am deducing that the timer interrupt line was asserted if the timer was -// zero and unasserted if the timer was non-zero. Since we never truly track -// the timer, we just use timer callback (coco3_timer_callback() asserts the -// line) -// -// Most CoCo 3 docs, including the specs that Tandy released, say that the -// high speed timer is 70ns (half of the speed of the main clock crystal). -// However, it seems that this is in error, and the GIME timer is really a -// 280ns timer (one eighth the speed of the main clock crystal. Gault's -// FAQ agrees with this -// -//************************************************************************** - -//------------------------------------------------- -// timer_type -//------------------------------------------------- - -gime_base_device::timer_type_t gime_base_device::timer_type(void) -{ - // wraps the GIME register access and returns an enumeration - return (m_gime_registers[0x01] & 0x20) ? GIME_TIMER_CLOCK : GIME_TIMER_HBORD; -} - - - -//------------------------------------------------- -// timer_type_string -//------------------------------------------------- - -const char *gime_base_device::timer_type_string(void) -{ - const char *result; - switch(timer_type()) - { - case GIME_TIMER_CLOCK: - result = "CLOCK"; - break; - case GIME_TIMER_HBORD: - result = "HBORD"; - break; - default: - fatalerror("Should not get here\n"); - } - return result; -} - - - -//------------------------------------------------- -// timer_elapsed -//------------------------------------------------- - -void gime_base_device::timer_elapsed(void) -{ - /* reset the timer; give her another run! */ - reset_timer(); - - /* change the blinking value - note that we don't have to use update_value() */ - m_is_blinking = !m_is_blinking; - - /* twiddle the timer interrupt */ - set_interrupt_value(INTERRUPT_TMR, true); - set_interrupt_value(INTERRUPT_TMR, false); -} - - - -//------------------------------------------------- -// reset_timer -//------------------------------------------------- - -void gime_base_device::reset_timer(void) -{ - /* value is from 0-4095 */ - m_timer_value = ((m_gime_registers[0x04] & 0x0F) * 0x100) | m_gime_registers[0x05]; - - /* depending on the GIME type, cannonicalize the value */ - if (m_timer_value > 0) - { - if (GIME_TYPE_1987) - m_timer_value += 1; /* the 1987 GIME reset to the value plus one */ - else - m_timer_value += 2; /* the 1986 GIME reset to the value plus two */ - } - - attotime duration; - if ((timer_type() == GIME_TIMER_CLOCK) && (m_timer_value > 0)) - { - /* we're starting a countdown on the GIME clock timer */ - attotime current_time = machine().time(); - UINT64 current_tick = current_time.as_ticks(m_clock); - duration = attotime::from_ticks(current_tick + m_timer_value, m_clock) - current_time; - } - else - { - /* either the timer is off, or were not using the GIME clock timer */ - duration = attotime::never; - } - m_gime_clock_timer->adjust(duration); - - if (LOG_TIMER) - logerror("%s: reset_timer(): timer_type=%s value=%d\n", describe_context(), timer_type_string(), m_timer_value); -} - - - -//************************************************************************** -// MEMORY AND REGISTERS -//************************************************************************** - -//------------------------------------------------- -// update_memory -//------------------------------------------------- - -inline void gime_base_device::update_memory(void) -{ - for (int bank = 0; bank <= 8; bank++) - { - update_memory(bank); - } -} - - - -//------------------------------------------------- -// update_memory -//------------------------------------------------- - -void gime_base_device::update_memory(int bank) -{ - // choose bank - assert((bank >= 0) && (bank < ARRAY_LENGTH(m_read_banks)) && (bank < ARRAY_LENGTH(m_write_banks))); - memory_bank *read_bank = m_read_banks[bank]; - memory_bank *write_bank = m_write_banks[bank]; - - // bank 8 is really $FE00-$FEFF; it is weird so adjust for it - offs_t offset; - bool force_ram; - bool enable_mmu = (m_gime_registers[0] & 0x40) ? true : false; - if (bank == 8) - { - bank = 7; - offset = 0x1E00; - force_ram = true; - enable_mmu = enable_mmu && !(m_gime_registers[0] & 0x08); - } - else - { - offset = 0x0000; - force_ram = false; - } - - // is the MMU enabled at $FF90? - int block; - if (enable_mmu) - { - // check TR register at $FF91 - bank += (m_gime_registers[1] & 0x01) ? 8 : 0; - - // perform the MMU lookup - block = m_mmu[bank]; - - // also check $FF9B - relevant for the 2-8 MB upgrade - block |= ((UINT32) ((m_gime_registers[11] >> 4) & 0x03)) << 8; - } - else - { - // the MMU is not enabled - block = bank + 56; - } - - // are we actually in ROM? - UINT8 *memory; - bool is_read_only; - if (((block & 0x3F) >= 0x3C) && !(m_sam_state & SAM_STATE_TY) && !force_ram) - { - // we're in ROM - static const UINT8 rom_map[4][4] = - { - { 0, 1, 6, 7 }, - { 0, 1, 6, 7 }, - { 0, 1, 2, 3 }, - { 4, 5, 6, 7 } - }; - - // look up the block in the ROM map - block = rom_map[m_gime_registers[0] & 3][(block & 0x3F) - 0x3C]; - - // are we in onboard ROM or cart ROM? - UINT8 *rom_ptr = (block & 4) ? m_cart_rom : m_rom; - // TODO: make this unmapped - if (rom_ptr==NULL) rom_ptr = m_rom; - // perform the look up - memory = &rom_ptr[(block & 3) * 0x2000]; - is_read_only = true; - } - else - { - // we're in RAM - memory = memory_pointer(block * 0x2000); - is_read_only = false; - } - - // compensate for offset - memory += offset; - - // set the banks - read_bank->set_base(memory); - write_bank->set_base(is_read_only ? m_dummy_bank : memory); -} - - - -//------------------------------------------------- -// memory_pointer -//------------------------------------------------- - -UINT8 *gime_base_device::memory_pointer(UINT32 address) -{ - return &m_ram->pointer()[address % m_ram->size()]; -} - - - -//------------------------------------------------- -// update_cart_rom -//------------------------------------------------- - -void gime_base_device::update_cart_rom(void) -{ - m_cart_rom = m_cart_device->get_cart_base(); - update_memory(); -} - - - -//------------------------------------------------- -// read -//------------------------------------------------- - -UINT8 gime_base_device::read(offs_t offset) -{ - UINT8 data = 0x00; - - switch(offset & 0xF0) - { - case 0x00: - data = read_gime_register(offset); - break; - - case 0x10: - data = read_mmu_register(offset); - break; - - case 0x20: - data = read_palette_register(offset); - break; - - default: - data = read_floating_bus(); - break; - } - - return data; -} - - - -//------------------------------------------------- -// read_gime_register -//------------------------------------------------- - -inline UINT8 gime_base_device::read_gime_register(offs_t offset) -{ - offset &= 0x0F; - - UINT8 result; - switch(offset) - { - case 2: // read pending IRQs - result = m_irq; - if (result != 0x00) - { - m_irq = 0x00; - recalculate_irq(); - } - break; - - case 3: // read pending FIRQs - result = m_firq; - if (result != 0x00) - { - m_firq = 0x00; - recalculate_firq(); - } - break; - - case 14: - case 15: - // these (I guess) are readable (Mametesters bug #05135) - result = m_gime_registers[offset]; - break; - - default: - // the others are not readable; read floating bus (Mametesters bug #05135) - result = read_floating_bus(); - break; - } - return result; -} - - - -//------------------------------------------------- -// read_mmu_register -//------------------------------------------------- - -inline UINT8 gime_base_device::read_mmu_register(offs_t offset) -{ - return (m_mmu[offset & 0x0F] & 0x3F) | (read_floating_bus() & 0xC0); -} - - - -//------------------------------------------------- -// read_palette_register -//------------------------------------------------- - -inline UINT8 gime_base_device::read_palette_register(offs_t offset) -{ - // Bits 7/6 are floating, and behave oddly. On a real CoCo 3 - // - // POKE&HFFB1,255:PRINTPEEK(&HFFB1) returns 127. - // POKE&HFFB1,0:PRINTPEEK(&HFFB1) returns 64 - // - // This is because of the floating bus - return m_palette_rotated[m_palette_rotated_position][offset & 0x0F] - | (read_floating_bus() & 0xC0); -} - - - -//------------------------------------------------- -// read_floating_bus -//------------------------------------------------- - -inline UINT8 gime_base_device::read_floating_bus(void) -{ - return m_read_floating_bus(0); -} - - - -//------------------------------------------------- -// write -//------------------------------------------------- - -void gime_base_device::write(offs_t offset, UINT8 data) -{ - switch(offset & 0xF0) - { - case 0x00: - write_gime_register(offset & 0x0F, data); - break; - - case 0x10: - write_mmu_register(offset & 0x0F, data); - break; - - case 0x20: - write_palette_register(offset & 0x0F, data & 0x3F); - break; - - case 0x30: - case 0x40: - write_sam_register(offset - 0x30); - break; - } -} - - - -//------------------------------------------------- -// write_gime_register -//------------------------------------------------- - -inline void gime_base_device::write_gime_register(offs_t offset, UINT8 data) -{ - // this is needed for writes to FF95 - bool timer_was_off = (m_gime_registers[0x04] == 0x00) && (m_gime_registers[0x05] == 0x00); - - // sanity check input - offset &= 0x0F; - - // perform logging - if (LOG_GIME) - logerror("%s: CoCo3 GIME: $%04x <== $%02x\n", describe_context(), offset + 0xff90, data); - - // make the change, and track the difference - UINT8 xorval = m_gime_registers[offset] ^ data; - m_gime_registers[offset] = data; - - switch(offset) - { - case 0x00: - // $FF90 Initialization register 0 - // Bit 7 COCO 1=CoCo compatible mode - // Bit 6 MMUEN 1=MMU enabled - // Bit 5 IEN 1 = GIME chip IRQ enabled - // Bit 4 FEN 1 = GIME chip FIRQ enabled - // Bit 3 MC3 1 = RAM at FEXX is constant - // Bit 2 MC2 1 = standard SCS (Spare Chip Select) - // Bit 1 MC1 ROM map control - // Bit 0 MC0 ROM map control - if (xorval & 0x4B) - update_memory(); - break; - - case 0x01: - // $FF91 Initialization register 1 - // Bit 7 Unused - // Bit 6 Unused - // Bit 5 TINS Timer input select; 1 = 280 nsec, 0 = 63.5 usec - // Bit 4 Unused - // Bit 3 Unused - // Bit 2 Unused - // Bit 1 Unused - // Bit 0 TR Task register select - if (xorval & 0x01) - update_memory(); - - // I'm not sure about this one; as written this code will reset the timer - // with the _original_ value. This is probably not correct. - if (xorval & 0x20) - reset_timer(); - break; - - case 0x02: - // $FF92 Interrupt request enable register - // Bit 7 Unused - // Bit 6 Unused - // Bit 5 TMR Timer interrupt - // Bit 4 HBORD Horizontal border interrupt - // Bit 3 VBORD Vertical border interrupt - // ! Bit 2 EI2 Serial data interrupt - // Bit 1 EI1 Keyboard interrupt - // Bit 0 EI0 Cartridge interrupt - if (LOG_INT_MASKING) - { - logerror("%s: GIME IRQ: Interrupts { %s%s%s%s%s%s} enabled\n", - describe_context(), - (data & 0x20) ? "TMR " : "", - (data & 0x10) ? "HBORD " : "", - (data & 0x08) ? "VBORD " : "", - (data & 0x04) ? "EI2 " : "", - (data & 0x02) ? "EI1 " : "", - (data & 0x01) ? "EI0 " : ""); - } - break; - - case 0x03: - // $FF93 Fast interrupt request enable register - // Bit 7 Unused - // Bit 6 Unused - // Bit 5 TMR Timer interrupt - // Bit 4 HBORD Horizontal border interrupt - // Bit 3 VBORD Vertical border interrupt - // ! Bit 2 EI2 Serial data interrupt - // Bit 1 EI1 Keyboard interrupt - // Bit 0 EI0 Cartridge interrupt - if (LOG_INT_MASKING) - { - logerror("%s: GIME FIRQ: Interrupts { %s%s%s%s%s%s} enabled\n", - describe_context(), - (data & 0x20) ? "TMR " : "", - (data & 0x10) ? "HBORD " : "", - (data & 0x08) ? "VBORD " : "", - (data & 0x04) ? "EI2 " : "", - (data & 0x02) ? "EI1 " : "", - (data & 0x01) ? "EI0 " : ""); - } - break; - - case 0x04: - // $FF94 Timer register MSB - // Bits 4-7 Unused - // Bits 0-3 High order four bits of the timer - reset_timer(); - break; - - case 0x05: - // $FF95 Timer register LSB - // Bits 0-7 Low order eight bits of the timer - if (timer_was_off && (m_gime_registers[0x05] != 0x00)) - { - // Writes to $FF95 do not cause the timer to reset, but MESS - // will invoke coco3_timer_reset() if $FF94/5 was previously - // $0000. The reason for this is because the timer is not - // actually off when $FF94/5 are loaded with $0000; rather it - // is continuously reloading the GIME's internal countdown - // register, even if it isn't causing interrupts to be raised. - // - // Failure to do this was the cause of bug #1065. Special - // thanks to John Kowalski for pointing me in the right - // direction - reset_timer(); - } - break; - - case 0x08: - // $FF98 Video Mode Register - // Bit 7 BP 0 = Text modes, 1 = Graphics modes - // Bit 6 Unused - // ! Bit 5 BPI Burst Phase Invert (Color Set) - // Bit 4 MOCH 1 = Monochrome on Composite - // ! Bit 3 H50 1 = 50 Hz power, 0 = 60 Hz power - // Bits 0-2 LPR Lines per row - break; - - case 0x09: - // $FF99 Video Resolution Register - // Bit 7 Undefined - // Bits 5-6 LPF Lines per Field (Number of Rows) - // Bits 2-4 HRES Horizontal Resolution - // 000=16 bytes per row - // 001=20 bytes per row - // 010=32 bytes per row - // 011=40 bytes per row - // 100=64 bytes per row - // 101=80 bytes per row - // 110=128 bytes per row - // 111=160 bytes per row - // Bits 0-1 CRES Color Resolution - if (xorval & 0x60) - update_geometry(); - break; - - case 0x0A: - // $FF9A Border Register - // Bits 6,7 Unused - // Bits 0-5 BRDR Border color - break; - - case 0x0C: - // $FF9C Vertical Scroll Register - // Bits 4-7 Reserved - // Bits 0-3 VSC Vertical Scroll bits - break; - - case 0x0B: - // $FF9B Two/Eight Megabyte Upgrade register - // - // This variable is weird; it affects both the video position, but - // it also affects normal memory mapping. However, changing $FF9B - // alone won't affect the MMU; writes to $FFAx are required to "latch" - // in the $FF9B value. - // - // The reason that $FF9B is not mentioned in offical documentation - // is because it is only meaningful in CoCo 3's with the 2MB upgrade - break; - - case 0x0D: - case 0x0E: - // $FF9B,$FF9D,$FF9E Vertical Offset Registers - // - // According to JK, if an odd value is placed in $FF9E on the 1986 - // GIME, the GIME crashes - break; - - case 0x0F: - // $FF9F Horizontal Offset Register - // Bit 7 HVEN Horizontal Virtual Enable - // Bits 0-6 X0-X6 Horizontal Offset Address - // - // Unline $FF9D-E, this value can be modified mid frame - // - // Note that the FF9F offset is shifted by one bit (e.g. - $FF9F=$03 will - // be a six byte offset). Also note that scanlines wrap at 256 byte boundaries - // without regard to bit 7. - break; - } -} - - - -//------------------------------------------------- -// write_mmu_register -//------------------------------------------------- - -inline void gime_base_device::write_mmu_register(offs_t offset, UINT8 data) -{ - offset &= 0x0F; - - // Check to see if the MMU register has changed. If we have more than 512k of RAM - // then we have to always update because this is the point at which the MMU makes - // decisions based off of $FF9B - if ((m_mmu[offset] != data) || (m_ram->size() > 512*1024)) - { - m_mmu[offset] = data; - update_memory(offset & 0x07); - } -} - - - -//------------------------------------------------- -// write_palette_register -//------------------------------------------------- - -inline void gime_base_device::write_palette_register(offs_t offset, UINT8 data) -{ - offset &= 0x0F; - - /* has this entry changed? */ - if (m_palette_rotated[m_palette_rotated_position][offset] != data) - { - /* do we need to rotate the palette? */ - if (m_palette_rotated_position_used) - { - /* identify the new position */ - UINT16 new_palette_rotated_position = (m_palette_rotated_position + 1) % ARRAY_LENGTH(m_palette_rotated); - - /* copy the palette */ - for (int i = 0; i < ARRAY_LENGTH(m_palette_rotated[0]); i++) - m_palette_rotated[new_palette_rotated_position][i] = m_palette_rotated[m_palette_rotated_position][i]; - - /* and advance */ - m_palette_rotated_position = new_palette_rotated_position; - m_palette_rotated_position_used = false; - } - - /* record the change */; - m_palette_rotated[m_palette_rotated_position][offset] = data; - } -} - - - -//------------------------------------------------- -// write_sam_register -//------------------------------------------------- - -inline void gime_base_device::write_sam_register(offs_t offset) -{ - /* change the SAM state */ - UINT16 xorval = alter_sam_state(offset); - - /* $FFDE-F can trigger a memory update */ - if (xorval & SAM_STATE_TY) - update_memory(); - - if (xorval & (SAM_STATE_R1|SAM_STATE_R0)) - update_cpu_clock(); -} - - - -//------------------------------------------------- -// interrupt_rising_edge -//------------------------------------------------- - -void gime_base_device::interrupt_rising_edge(UINT8 interrupt) -{ - /* evaluate IRQ */ - if ((m_gime_registers[0x00] & 0x20) && (m_gime_registers[0x02] & interrupt)) - { - m_irq |= interrupt; - recalculate_irq(); - } - - /* evaluate FIRQ */ - if ((m_gime_registers[0x00] & 0x10) && (m_gime_registers[0x03] & interrupt)) - { - m_firq |= interrupt; - recalculate_firq(); - } -} - - - -//------------------------------------------------- -// recalculate_irq -//------------------------------------------------- - -void gime_base_device::recalculate_irq(void) -{ - m_write_irq(irq_r()); -} - - - -//------------------------------------------------- -// recalculate_firq -//------------------------------------------------- - -void gime_base_device::recalculate_firq(void) -{ - m_write_firq(firq_r()); -} - - - -//************************************************************************** -// VIDEO STATE -//************************************************************************** - -//------------------------------------------------- -// get_video_base -// -// The purpose of the ff9d_mask and ff9e_mask is to mask out bits that are -// ignored in lo-res mode. Specifically, $FF9D is masked with $E0, and -// $FF9E is masked with $3F -// -// John Kowalski confirms this behavior -//------------------------------------------------- - -inline offs_t gime_base_device::get_video_base(void) -{ - offs_t result; - UINT8 ff9d_mask, ff9e_mask; - - if (m_legacy_video) - { - /* legacy video gets the base address from the SAM addresses, and masks out GIME variables */ - result = display_offset(); - ff9d_mask = 0xE0; - ff9e_mask = 0x3F; - } - else - { - /* GIME video ignores the SAM addresses, relying on the GIME variables exclusively */ - result = 0; - ff9d_mask = 0xFF; - ff9e_mask = 0xFF; - } - - result += ((offs_t) (m_gime_registers[0x0E] & ff9e_mask) * 0x00008) - | ((offs_t) (m_gime_registers[0x0D] & ff9d_mask) * 0x00800) - | ((offs_t) (m_gime_registers[0x0B] & 0x0F) * 0x80000); - return result; -} - - - -//------------------------------------------------- -// new_frame -//------------------------------------------------- - -void gime_base_device::new_frame(void) -{ - /* call inherited function */ - super::new_frame(); - - /* latch in legacy video value */ - bool legacy_video_changed = update_value(&m_legacy_video, m_gime_registers[0] & 0x80 ? true : false); - - /* latch in the video position */ - m_video_position = get_video_base(); - m_line_in_row = m_gime_registers[0x0C] & 0x0F; - - /* update the geometry, as appropriate */ - if (legacy_video_changed) - update_geometry(); -} - - - -//------------------------------------------------- -// horizontal_sync_changed -//------------------------------------------------- - -void gime_base_device::horizontal_sync_changed(bool line) -{ - set_interrupt_value(INTERRUPT_HBORD, line); - - /* decrement timer if appropriate */ - if ((timer_type() == GIME_TIMER_HBORD) && (m_timer_value > 0) && line) - { - if (--m_timer_value == 0) - timer_elapsed(); - } - -} - - - -//------------------------------------------------- -// enter_bottom_border -//------------------------------------------------- - -void gime_base_device::enter_bottom_border(void) -{ - set_interrupt_value(INTERRUPT_VBORD, true); - set_interrupt_value(INTERRUPT_VBORD, false); -} - - - -//------------------------------------------------- -// update_border -//------------------------------------------------- - -void gime_base_device::update_border(UINT16 physical_scanline) -{ - UINT8 border; - if (m_legacy_video) - { - /* legacy video */ - switch(border_value(m_ff22_value, true)) - { - case BORDER_COLOR_GREEN: - border = 0x12; /* green */ - break; - case BORDER_COLOR_WHITE: - border = 0x3F; /* white */ - break; - case BORDER_COLOR_BLACK: - border = 0x00; /* black */ - break; - case BORDER_COLOR_ORANGE: - border = 0x26; /* orange */ - break; - default: - fatalerror("Should not get here\n"); - } - } - else - { - /* get the border value from $FF9A */ - border = m_gime_registers[0x0A] & 0x3F; - } - update_value(&m_scanlines[physical_scanline].m_border, border); -} - - - -//------------------------------------------------- -// record_border_scanline -//------------------------------------------------- - -void gime_base_device::record_border_scanline(UINT16 physical_scanline) -{ - m_line_in_row = 0; - update_border(physical_scanline); - update_value(&m_scanlines[physical_scanline].m_line_in_row, (UINT8) ~0); -} - - - -//------------------------------------------------- -// get_lines_per_row -//------------------------------------------------- - -inline UINT16 gime_base_device::get_lines_per_row(void) -{ - UINT16 lines_per_row; - if (m_legacy_video) - { - switch(m_ff22_value & (MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0)) - { - case 0: - case MODE_GM0: - case MODE_GM1: - case MODE_GM1|MODE_GM0: - case MODE_GM2: - case MODE_GM2|MODE_GM0: - case MODE_GM2|MODE_GM1: - case MODE_GM2|MODE_GM1|MODE_GM0: - lines_per_row = 12; - break; - - case MODE_AG: - case MODE_AG|MODE_GM0: - case MODE_AG|MODE_GM1: - lines_per_row = 3; - break; - - case MODE_AG|MODE_GM1|MODE_GM0: - case MODE_AG|MODE_GM2: - lines_per_row = 2; - break; - - case MODE_AG|MODE_GM2|MODE_GM0: - case MODE_AG|MODE_GM2|MODE_GM1: - case MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0: - lines_per_row = 1; - break; - - default: - fatalerror("Should not get here\n"); - } - } - else - { - switch(m_gime_registers[0x08] & 0x07) - { - case 0x00: - case 0x01: - lines_per_row = 1; - break; - case 0x02: - lines_per_row = 2; - break; - case 0x03: - lines_per_row = 8; - break; - case 0x04: - lines_per_row = 9; - break; - case 0x05: - lines_per_row = 10; - break; - case 0x06: - lines_per_row = 11; - break; - case 0x07: - lines_per_row = 0xFFFF; - break; - default: - fatalerror("Should not get here\n"); - } - } - return lines_per_row; -} - - - -//------------------------------------------------- -// record_scanline_res -//------------------------------------------------- - -template -inline UINT32 gime_base_device::record_scanline_res(int scanline) -{ - int column; - UINT32 base_offset = m_legacy_video ? 0 : (m_gime_registers[0x0F] & 0x7F) * 2; - UINT32 offset = 0; - - /* main loop */ - for (column = 0; column < xres; column++) - { - /* input data */ - UINT8 data, mode; - offset += ((*this).*(get_data))(m_video_position + ((base_offset + offset) & 0xFF), &data, &mode); - - /* and record the pertinent values */ - if (record_mode) - update_value(&m_scanlines[scanline].m_mode[column], mode); - update_value(&m_scanlines[scanline].m_data[column], data); - update_value(&m_scanlines[scanline].m_palette[column], m_palette_rotated_position); - } - - return offset; -} - - - -//------------------------------------------------- -// get_data_mc6847 - used for retrieving data/mode -// in legacy video modes -//------------------------------------------------- - -UINT32 gime_base_device::get_data_mc6847(UINT32 video_position, UINT8 *data, UINT8 *mode) -{ - *data = *memory_pointer(video_position); - *mode = (m_ff22_value & (MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0|MODE_CSS)) - | ((*data & 0x80) == 0x80 ? MODE_AS : 0) - | ((*data & 0xC0) == 0x40 ? MODE_INV : 0); - - // postprocess the mode to remove unnecessary flags - *mode = mc6847_friend_device::simplify_mode(*data, *mode); - return 1; -} - - - -//------------------------------------------------- -// get_data_without_attributes - used for -// retrieving data/mode in GIME graphics or GIME -// text modes without attributes -//------------------------------------------------- - -UINT32 gime_base_device::get_data_without_attributes(UINT32 video_position, UINT8 *data, UINT8 *mode) -{ - *data = *memory_pointer(video_position); - *mode = NO_ATTRIBUTE; - return 1; -} - - - -//------------------------------------------------- -// get_data_with_attributes - used for retrieving -// data/mode in GIME text modes with attributes -//------------------------------------------------- - -UINT32 gime_base_device::get_data_with_attributes(UINT32 video_position, UINT8 *data, UINT8 *mode) -{ - *data = *memory_pointer(video_position + 0); - *mode = *memory_pointer(video_position + 1); - - /* is the blink attribute specified? */ - if (UNEXPECTED(*mode & 0x80)) - { - /* if so - and we're blinking - then clear the character */ - if (m_is_blinking) - { - *data = 0x20; - *mode &= ~0x40; - } - - /* clear the blink bit */ - *mode &= ~0x80; - } - return 2; -} - - - -//------------------------------------------------- -// record_body_scanline -//------------------------------------------------- - -void gime_base_device::record_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline) -{ - /* update the border first */ - update_border(physical_scanline); - - /* set the line in row */ - update_value(&m_scanlines[physical_scanline].m_line_in_row, m_line_in_row); - - /* we're using this palette rotation */ - m_palette_rotated_position_used = true; - - UINT32 pitch = 0; - if (m_legacy_video) - { - /* legacy video */ - update_value(&m_scanlines[physical_scanline].m_ff22_value, m_ff22_value); - - switch(m_ff22_value & (MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0)) - { - case MODE_AG: - case MODE_AG|MODE_GM0: - case MODE_AG|MODE_GM1|MODE_GM0: - case MODE_AG|MODE_GM2|MODE_GM0: - pitch = record_scanline_res<16, &gime_base_device::get_data_mc6847, true>(physical_scanline); - break; - - case 0: - case MODE_GM0: - case MODE_GM1: - case MODE_GM1|MODE_GM0: - case MODE_GM2: - case MODE_GM2|MODE_GM0: - case MODE_GM2|MODE_GM1: - case MODE_GM2|MODE_GM1|MODE_GM0: - case MODE_AG|MODE_GM1: - case MODE_AG|MODE_GM2: - case MODE_AG|MODE_GM2|MODE_GM1: - case MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0: - pitch = record_scanline_res<32, &gime_base_device::get_data_mc6847, true>(physical_scanline); - break; - - default: - /* should not get here */ - fatalerror("Should not get here\n"); - } - } - else - { - /* CoCo 3 video */ - update_value(&m_scanlines[physical_scanline].m_ff98_value, m_gime_registers[0x08]); - update_value(&m_scanlines[physical_scanline].m_ff99_value, m_gime_registers[0x09]); - - /* is this graphics or text? */ - if (m_gime_registers[0x08] & 0x80) - { - /* graphics */ - switch(m_gime_registers[0x09] & 0x1C) - { - case 0x00: pitch = record_scanline_res< 16, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; - case 0x04: pitch = record_scanline_res< 20, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; - case 0x08: pitch = record_scanline_res< 32, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; - case 0x0C: pitch = record_scanline_res< 40, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; - case 0x10: pitch = record_scanline_res< 64, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; - case 0x14: pitch = record_scanline_res< 80, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; - case 0x18: pitch = record_scanline_res<128, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; - case 0x1C: pitch = record_scanline_res<160, &gime_base_device::get_data_without_attributes, false>(physical_scanline); break; - default: - fatalerror("Should not get here\n"); - } - } - else - { - /* text */ - switch(m_gime_registers[0x09] & 0x15) - { - case 0x00: pitch = record_scanline_res< 32, &gime_base_device::get_data_without_attributes, true>(physical_scanline); break; - case 0x01: pitch = record_scanline_res< 32, &gime_base_device::get_data_with_attributes, true>(physical_scanline); break; - case 0x04: pitch = record_scanline_res< 40, &gime_base_device::get_data_without_attributes, true>(physical_scanline); break; - case 0x05: pitch = record_scanline_res< 40, &gime_base_device::get_data_with_attributes, true>(physical_scanline); break; - case 0x10: pitch = record_scanline_res< 64, &gime_base_device::get_data_without_attributes, true>(physical_scanline); break; - case 0x11: pitch = record_scanline_res< 64, &gime_base_device::get_data_with_attributes, true>(physical_scanline); break; - case 0x14: pitch = record_scanline_res< 80, &gime_base_device::get_data_without_attributes, true>(physical_scanline); break; - case 0x15: pitch = record_scanline_res< 80, &gime_base_device::get_data_with_attributes, true>(physical_scanline); break; - default: - fatalerror("Should not get here\n"); - } - } - - /* is the GIME hoizontal virtual screen enabled? */ - if (m_gime_registers[0x0F] & 0x80) - { - pitch = 256; - } - } - - /* sanity checks */ - assert(pitch > 0); - - /* are we moving on to the next line? */ - if (++m_line_in_row >= get_lines_per_row()) - { - /* next row */ - m_line_in_row = 0; - m_video_position += pitch; - } -} - - - -//------------------------------------------------- -// record_partial_body_scanline -//------------------------------------------------- - -void gime_base_device::record_partial_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline, INT32 start_clock, INT32 end_clock) -{ - fatalerror("NYI"); -} - - - -//------------------------------------------------- -// update_geometry -//------------------------------------------------- - -void gime_base_device::update_geometry(void) -{ - UINT16 top_border_scanlines, body_scanlines; - - switch(m_legacy_video ? 0x00 : (m_gime_registers[9] & 0x60)) - { - case 0x00: - // 192 lines (and legacy video) - top_border_scanlines = 25; - body_scanlines = 192; - break; - - case 0x20: - // 200 lines - top_border_scanlines = 23; - body_scanlines = 200; - break; - - case 0x40: - // zero/infinite lines - // - // If specified within the border, the border will go forever. If specified within the body, the body will go forever. This - // suggests that there is a counter that counts scanlines, and we switch border <=> body when we hit some maximum count - top_border_scanlines = ~0; - body_scanlines = ~0; - break; - - case 0x60: - // 225 lines - top_border_scanlines = 8; - body_scanlines = 225; - break; - - default: - fatalerror("Should not get here\n"); - } - - // bit 3 of $FF99 controls "wideness" - bool wide = !m_legacy_video && (m_gime_registers[9] & 0x08); - - // set the geometry - set_geometry(top_border_scanlines, body_scanlines, wide); -} - - - -//************************************************************************** -// VIDEO BLITTING -//************************************************************************** - -//------------------------------------------------- -// emit_dummy_samples -//------------------------------------------------- - -UINT32 gime_base_device::emit_dummy_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) -{ - fatalerror("Should not get here\n"); -} - -//------------------------------------------------- -// emit_mc6847_samples -//------------------------------------------------- - -inline UINT32 gime_base_device::emit_mc6847_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) -{ - return super::emit_mc6847_samples<2>( - scanline->m_mode[sample_start], - &scanline->m_data[sample_start], - sample_count, - pixels, - palette, - super::m_charrom_cb, - sample_start, - scanline->m_line_in_row); -} - - - -//------------------------------------------------- -// emit_gime_graphics_samples -//------------------------------------------------- - -template -inline UINT32 gime_base_device::emit_gime_graphics_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) -{ - const UINT8 *data = &scanline->m_data[sample_start]; - mc6847_friend_device::emit_graphics(data, sample_count, pixels, 0, palette); - return sample_count * (8 / bits_per_pixel) * xscale; -} - - - -//------------------------------------------------- -// emit_gime_text_samples -//------------------------------------------------- - -template -inline UINT32 gime_base_device::emit_gime_text_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette) -{ - UINT8 attribute = scanline->m_mode[sample_start]; - const UINT8 *data = &scanline->m_data[sample_start]; - - /* determine the background/foreground colors */ - UINT8 bg = (attribute == NO_ATTRIBUTE) ? 0 : ((attribute >> 0) & 0x07) + 0x00; - UINT8 fg = (attribute == NO_ATTRIBUTE) ? 1 : ((attribute >> 3) & 0x07) + 0x08; - - /* underline attribute */ - int underline_line = -1; - if ((attribute != NO_ATTRIBUTE) && (attribute & 0x40)) - { - /* to quote SockMaster: - * - * The underline attribute will light up the bottom scan line of the character - * if the lines are set to 8 or 9. Not appear at all when less, or appear on - * the 2nd to bottom scan line if set higher than 9. Further exception being - * the $x7 setting where the whole screen is filled with only one line of data - * - but it's glitched - the line repeats over and over again every 16 scan - * lines.. Nobody will use this mode, but that's what happens if you want to - * make things really authentic :) - */ - switch(scanline->m_ff98_value & 0x07) - { - case 0x03: - underline_line = 7; - break; - case 0x04: - case 0x05: - underline_line = 8; - break; - case 0x06: - underline_line = 9; - break; - } - } - - for (int i = 0; i < sample_count; i++) - { - for (int j = 0; j < 8; j++) - { - for (int k = 0; k < xscale; k++) - { - UINT8 font_byte = hires_font[data[i] & 0x7F][scanline->m_line_in_row]; - bool bit = (scanline->m_line_in_row == underline_line) || ((font_byte >> (7 - j)) & 0x01); - pixels[(i * 8 + j) * xscale + k] = bit ? palette[fg] : palette[bg]; - } - } - } - return sample_count * 8 * xscale; -} - - - -//------------------------------------------------- -// render_scanline -//------------------------------------------------- - -template -inline void gime_base_device::render_scanline(const scanline_record *scanline, pixel_t *pixels, int min_x, int max_x, palette_resolver *resolver) -{ - int left_border, right_border; - int x, x2, pixel_position; - pixel_t border_color = resolver->lookup(scanline->m_border); - const pixel_t *resolved_palette = NULL; - - /* is this a wide video mode? */ - bool wide = !m_legacy_video && (scanline->m_ff99_value & 0x04); - - /* size up the borders */ - if (sample_count > 0) - { - left_border = wide ? 0 : 64; - right_border = wide ? 640 : 512; - } - else - { - left_border = 640; - right_border = 640; - } - - /* left border */ - for (x = min_x; x < left_border; x++) - { - pixels[x] = border_color; - } - - /* right border */ - for (x = right_border; x <= max_x; x++) - { - pixels[x] = border_color; - } - - /* offset the pixel counts depending on wide */ - pixels += wide ? 0 : 64; - - /* body */ - x = 0; - pixel_position = 0; - while(x < sample_count) - { - /* determine how many bytes exist for which the mode is identical */ - for (x2 = x + 1; (x2 < sample_count) && (scanline->m_mode[x] == scanline->m_mode[x2]) && (scanline->m_palette[x] == scanline->m_palette[x2]); x2++) - ; - - /* resolve the palette */ - resolved_palette = resolver->get_palette(scanline->m_palette[x]); - - /* emit the samples, with a (hopefully) aggressively inlined function */ - pixel_position += ((*this).*(emit_samples))(scanline, x, x2 - x, &pixels[pixel_position], resolved_palette); - - /* update x */ - x = x2; - } - - /* artifacting */ - if (m_legacy_video && (sample_count > 0)) - { - m_artifacter.process_artifacts<2>(pixels, scanline->m_mode[0], resolved_palette); - } -} - - - -//------------------------------------------------- -// update_screen -//------------------------------------------------- - -bool gime_base_device::update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect, const pixel_t *RESTRICT palette) -{ - int base_x = 64; - int min_x = USE_HORIZONTAL_CLIP ? cliprect.min_x : 0; - int max_x = USE_HORIZONTAL_CLIP ? cliprect.max_x : (base_x * 2 + 512 - 1); - int min_y = cliprect.min_y; - int max_y = cliprect.max_y; - palette_resolver resolver(this, palette); - - /* if the video didn't change, indicate as much */ - if (!has_video_changed()) - return UPDATE_HAS_NOT_CHANGED; - - for (int y = min_y; y <= max_y; y++) - { - const scanline_record *scanline = &m_scanlines[y]; - pixel_t *RESTRICT pixels = bitmap_addr(bitmap, y, 0); - - /* render the scanline */ - if (m_scanlines[y].m_line_in_row == (UINT8) ~0) - { - /* this is a border scanline */ - render_scanline<0, &gime_base_device::emit_dummy_samples>(scanline, pixels, min_x, max_x, &resolver); - } - else if (m_legacy_video) - { - /* this is a legacy body scanline */ - switch(scanline->m_ff22_value & (MODE_AG|MODE_GM2|MODE_GM1|MODE_GM0)) - { - case MODE_AG: - case MODE_AG|MODE_GM0: - case MODE_AG|MODE_GM1|MODE_GM0: - case MODE_AG|MODE_GM2|MODE_GM0: - render_scanline<16, &gime_base_device::emit_mc6847_samples>(scanline, pixels, min_x, max_x, &resolver); - break; - - default: - render_scanline<32, &gime_base_device::emit_mc6847_samples>(scanline, pixels, min_x, max_x, &resolver); - break; - } - } - else if (scanline->m_ff98_value & 0x80) - { - /* GIME graphics */ - switch(scanline->m_ff99_value & 0x1F) - { - case 0x00: render_scanline< 16, &gime_base_device::emit_gime_graphics_samples< 4, 1> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x01: render_scanline< 16, &gime_base_device::emit_gime_graphics_samples< 8, 2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x02: - case 0x03: render_scanline< 16, &gime_base_device::emit_gime_graphics_samples<16, 4> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x04: render_scanline< 20, &gime_base_device::emit_gime_graphics_samples< 4, 1> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x05: render_scanline< 20, &gime_base_device::emit_gime_graphics_samples< 8, 2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x06: - case 0x07: render_scanline< 20, &gime_base_device::emit_gime_graphics_samples<16, 4> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x08: render_scanline< 32, &gime_base_device::emit_gime_graphics_samples< 2, 1> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x09: render_scanline< 32, &gime_base_device::emit_gime_graphics_samples< 4, 2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x0A: - case 0x0B: render_scanline< 32, &gime_base_device::emit_gime_graphics_samples< 8, 4> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x0C: render_scanline< 40, &gime_base_device::emit_gime_graphics_samples< 2, 1> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x0D: render_scanline< 40, &gime_base_device::emit_gime_graphics_samples< 4, 2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x0E: - case 0x0F: render_scanline< 40, &gime_base_device::emit_gime_graphics_samples< 8, 4> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x10: render_scanline< 64, &gime_base_device::emit_gime_graphics_samples< 1, 1> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x11: render_scanline< 64, &gime_base_device::emit_gime_graphics_samples< 2, 2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x12: - case 0x13: render_scanline< 64, &gime_base_device::emit_gime_graphics_samples< 4, 4> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x14: render_scanline< 80, &gime_base_device::emit_gime_graphics_samples< 1, 1> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x15: render_scanline< 80, &gime_base_device::emit_gime_graphics_samples< 2, 2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x16: - case 0x17: render_scanline< 80, &gime_base_device::emit_gime_graphics_samples< 4, 4> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x18: - case 0x19: render_scanline<128, &gime_base_device::emit_gime_graphics_samples< 1, 2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x1A: - case 0x1B: render_scanline<128, &gime_base_device::emit_gime_graphics_samples< 2, 4> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x1C: - case 0x1D: render_scanline<160, &gime_base_device::emit_gime_graphics_samples< 1, 2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x1E: - case 0x1F: render_scanline<160, &gime_base_device::emit_gime_graphics_samples< 2, 4> >(scanline, pixels, min_x, max_x, &resolver); break; - } - } - else - { - /* GIME text */ - switch(scanline->m_ff99_value & 0x14) - { - case 0x00: render_scanline<32, &gime_base_device::emit_gime_text_samples<2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x04: render_scanline<40, &gime_base_device::emit_gime_text_samples<2> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x10: render_scanline<64, &gime_base_device::emit_gime_text_samples<1> >(scanline, pixels, min_x, max_x, &resolver); break; - case 0x14: render_scanline<80, &gime_base_device::emit_gime_text_samples<1> >(scanline, pixels, min_x, max_x, &resolver); break; - } - } - } - return 0; -} - - - -//------------------------------------------------- -// update_composite -//------------------------------------------------- - -bool gime_base_device::update_composite(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - update_value(&m_displayed_rgb, false); - const pixel_t *palette = (m_gime_registers[0x08] & 0x10) - ? m_composite_bw_palette - : m_composite_palette; - return update_screen(bitmap, cliprect, palette); -} - - - -//------------------------------------------------- -// update_rgb -//------------------------------------------------- - -bool gime_base_device::update_rgb(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - update_value(&m_displayed_rgb, true); - return update_screen(bitmap, cliprect, m_rgb_palette); -} - - - -//************************************************************************** -// PALETTE RESOLVER MEMBER CLASS -//************************************************************************** - -//------------------------------------------------- -// palette_resolver::palette_resolver -//------------------------------------------------- - -inline gime_base_device::palette_resolver::palette_resolver(gime_base_device *gime, const pixel_t *palette) -{ - m_gime = gime; - m_palette = palette; - memset(m_resolved_palette, 0, sizeof(m_resolved_palette)); - m_current_resolved_palette = -1; -} - - - -//------------------------------------------------- -// palette_resolver::get_palette -//------------------------------------------------- - -inline const gime_base_device::pixel_t *gime_base_device::palette_resolver::get_palette(UINT16 palette_rotation) -{ - if (UNEXPECTED(m_current_resolved_palette != palette_rotation)) - { - for (int i = 0; i < 16; i++) - m_resolved_palette[i] = lookup(m_gime->m_palette_rotated[palette_rotation][i]); - m_current_resolved_palette = palette_rotation; - } - return m_resolved_palette; -} - - - -//------------------------------------------------- -// palette_resolver::lookup -//------------------------------------------------- - -inline gime_base_device::pixel_t gime_base_device::palette_resolver::lookup(UINT8 color) -{ - assert(color <= 63); - return m_palette[color]; -} - - - -//------------------------------------------------- -// hires_font -//------------------------------------------------- - -const UINT8 gime_base_device::hires_font[128][12] = -{ - { 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x10}, { 0x44, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00}, - { 0x08, 0x10, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, { 0x10, 0x28, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, - { 0x28, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, { 0x20, 0x10, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, - { 0x10, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, { 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x10}, - { 0x10, 0x28, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, { 0x28, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, - { 0x20, 0x10, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, { 0x28, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00}, - { 0x10, 0x28, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00}, { 0x00, 0x18, 0x24, 0x38, 0x24, 0x24, 0x38, 0x40}, - { 0x44, 0x10, 0x28, 0x44, 0x7C, 0x44, 0x44, 0x00}, { 0x10, 0x10, 0x28, 0x44, 0x7C, 0x44, 0x44, 0x00}, - { 0x08, 0x10, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, { 0x00, 0x00, 0x68, 0x14, 0x3C, 0x50, 0x3C, 0x00}, - { 0x3C, 0x50, 0x50, 0x78, 0x50, 0x50, 0x5C, 0x00}, { 0x10, 0x28, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, - { 0x28, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, { 0x00, 0x00, 0x38, 0x4C, 0x54, 0x64, 0x38, 0x00}, - { 0x10, 0x28, 0x00, 0x44, 0x44, 0x4C, 0x34, 0x00}, { 0x20, 0x10, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00}, - { 0x38, 0x4C, 0x54, 0x54, 0x54, 0x64, 0x38, 0x00}, { 0x44, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00}, - { 0x28, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00}, { 0x38, 0x40, 0x38, 0x44, 0x38, 0x04, 0x38, 0x00}, - { 0x08, 0x14, 0x10, 0x38, 0x10, 0x50, 0x3C, 0x00}, { 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x7C, 0x00}, - { 0x10, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x20, 0x40}, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00}, - { 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00}, - { 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00}, { 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00}, - { 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00}, { 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00}, - { 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00}, { 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00}, - { 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00}, { 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00}, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20}, { 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00}, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00}, { 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00}, - { 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00}, { 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00}, - { 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00}, { 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00}, - { 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00}, { 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00}, - { 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00}, { 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00}, - { 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00}, { 0x38, 0x44, 0x44, 0x38, 0x04, 0x04, 0x38, 0x00}, - { 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00}, { 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20}, - { 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00}, { 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00}, - { 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00}, { 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00}, - { 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00}, { 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00}, - { 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00}, { 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00}, - { 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00}, { 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00}, - { 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00}, { 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00}, - { 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00}, { 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00}, - { 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00}, { 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00}, - { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00}, { 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00}, - { 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00}, { 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00}, - { 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00}, { 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00}, - { 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00}, { 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00}, - { 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00}, { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00}, - { 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00}, { 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00}, - { 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00}, { 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00}, - { 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00}, { 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00}, - { 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00}, { 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00}, - { 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00}, { 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00}, - { 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00}, - { 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00}, { 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00}, - { 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00}, { 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00}, - { 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00}, { 0x00, 0x00, 0x34, 0x4C, 0x4C, 0x34, 0x04, 0x38}, - { 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00}, { 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00}, - { 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x44, 0x38}, { 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00}, - { 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00}, { 0x00, 0x00, 0x68, 0x54, 0x54, 0x54, 0x54, 0x00}, - { 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00}, { 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, - { 0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40}, { 0x00, 0x00, 0x3C, 0x44, 0x44, 0x3C, 0x04, 0x04}, - { 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00}, { 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00}, - { 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00}, { 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00}, - { 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00}, { 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00}, - { 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00}, { 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38}, - { 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00}, { 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00}, - { 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00}, { 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00}, - { 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00}, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00} -}; - - - -//************************************************************************** -// VARIATIONS -//************************************************************************** - -const device_type GIME_NTSC = &device_creator; -const device_type GIME_PAL = &device_creator; - - - -//------------------------------------------------- -// gime_ntsc_device -//------------------------------------------------- - -gime_ntsc_device::gime_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : gime_base_device(mconfig, GIME_NTSC, "GIME_NTSC", tag, owner, clock, ntsc_round_fontdata8x12, "gime_ntsc", __FILE__) -{ -} - - - -//------------------------------------------------- -// gime_pal_device -//------------------------------------------------- - -gime_pal_device::gime_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : gime_base_device(mconfig, GIME_PAL, "GIME_PAL", tag, owner, clock, pal_round_fontdata8x12, "gime_pal", __FILE__) -{ -} diff --git a/src/mess/video/gime.h b/src/mess/video/gime.h deleted file mode 100644 index 862dfeec3b0..00000000000 --- a/src/mess/video/gime.h +++ /dev/null @@ -1,311 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods -/********************************************************************* - - gime.h - - Implementation of CoCo GIME (Graphics Interrupt Memory Enhancement) - video chip. - -***************************************************************************/ - -#pragma once - -#ifndef __GIME__ -#define __GIME__ - -#include "video/mc6847.h" -#include "machine/6883sam.h" -#include "machine/ram.h" - - -//************************************************************************** -// GIME CONFIG/INTERFACE -//************************************************************************** - -#define MCFG_GIME_HSYNC_CALLBACK MCFG_MC6847_HSYNC_CALLBACK - -#define MCFG_GIME_FSYNC_CALLBACK MCFG_MC6847_FSYNC_CALLBACK - -#define MCFG_GIME_IRQ_CALLBACK(_write) \ - devcb = &gime_base_device::set_irq_wr_callback(*device, DEVCB_##_write); - -#define MCFG_GIME_FIRQ_CALLBACK(_write) \ - devcb = &gime_base_device::set_firq_wr_callback(*device, DEVCB_##_write); - -#define MCFG_GIME_FLOATING_BUS_CALLBACK(_read) \ - devcb = &gime_base_device::set_floating_bus_rd_callback(*device, DEVCB_##_read); - -#define MCFG_GIME_MAINCPU(_tag) \ - gime_base_device::set_maincpu_tag(*device, _tag); - -#define MCFG_GIME_RAM(_tag) \ - gime_base_device::set_ram_tag(*device, _tag); - -#define MCFG_GIME_EXT(_tag) \ - gime_base_device::set_ext_tag(*device, _tag); - - -//************************************************************************** -// GIME CORE -//************************************************************************** - -class cococart_slot_device; - -class gime_base_device : public mc6847_friend_device, public sam6883_friend_device -{ -public: - template static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_irq.set_callback(object); } - template static devcb_base &set_firq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_firq.set_callback(object); } - template static devcb_base &set_floating_bus_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_floating_bus.set_callback(object); } - static void set_maincpu_tag(device_t &device, const char *tag) { downcast(device).m_maincpu_tag = tag; } - static void set_ram_tag(device_t &device, const char *tag) { downcast(device).m_ram_tag = tag; } - static void set_ext_tag(device_t &device, const char *tag) { downcast(device).m_ext_tag = tag; } - - // read/write - DECLARE_READ8_MEMBER( read ) { return read(offset); } - DECLARE_WRITE8_MEMBER( write ) { write(offset, data); } - - // used to turn on/off reading/writing to $FF40-$FF5F - bool spare_chip_select_enabled(void) { return m_gime_registers[0] & 0x04 ? true : false; } - - // the GIME seems to intercept writes to $FF22 (not precisely sure how) - void ff22_write(UINT8 data) { m_ff22_value = data; } - - // updates the cart ROM - void update_cart_rom(void); - - /* updates the screen -- this will call begin_update(), - followed by update_row() reapeatedly and after all row - updating is complete, end_update() */ - bool update_composite(bitmap_rgb32 &bitmap, const rectangle &cliprect); - bool update_rgb(bitmap_rgb32 &bitmap, const rectangle &cliprect); - - // interrupt outputs - bool firq_r(void) { return m_firq != 0x00; } - bool irq_r(void) { return m_irq != 0x00; } - - // interrupt inputs - void set_il0(bool value) { set_interrupt_value(INTERRUPT_EI0, value); } - void set_il1(bool value) { set_interrupt_value(INTERRUPT_EI1, value); } - void set_il2(bool value) { set_interrupt_value(INTERRUPT_EI2, value); } - -protected: - gime_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const UINT8 *fontdata, const char *shortname, const char *source); - - // device-level overrides - virtual void device_start(void); - virtual void device_reset(void); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void device_pre_save(void); - virtual void device_post_load(void); - virtual ioport_constructor device_input_ports() const; - - // other overrides - virtual void new_frame(void); - virtual void horizontal_sync_changed(bool line); - virtual void enter_bottom_border(void); - virtual void record_border_scanline(UINT16 physical_scanline); - virtual void record_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline); - virtual void record_partial_body_scanline(UINT16 physical_scanline, UINT16 logical_scanline, INT32 start_clock, INT32 end_clock); - -private: - typedef mc6847_friend_device super; - - struct scanline_record - { - UINT8 m_border; - UINT8 m_line_in_row; - UINT8 m_ff22_value; - UINT8 m_ff98_value; - UINT8 m_ff99_value; - UINT8 m_mode[160]; - UINT8 m_data[160]; - UINT16 m_palette[160]; - }; - - typedef UINT32 (gime_base_device::*get_data_func)(UINT32, UINT8 *, UINT8 *); - - class palette_resolver - { - public: - palette_resolver(gime_base_device *gime, const pixel_t *palette); - const pixel_t *get_palette(UINT16 palette_rotation); - pixel_t lookup(UINT8 color); - - private: - gime_base_device *m_gime; - const pixel_t *m_palette; - pixel_t m_resolved_palette[16]; - int m_current_resolved_palette; - }; - - enum - { - INTERRUPT_TMR = 0x20, - INTERRUPT_HBORD = 0x10, - INTERRUPT_VBORD = 0x08, - INTERRUPT_EI2 = 0x04, - INTERRUPT_EI1 = 0x02, - INTERRUPT_EI0 = 0x01 - }; - - enum timer_type_t - { - GIME_TIMER_HBORD, - GIME_TIMER_CLOCK - }; - - // timer constants - static const device_timer_id TIMER_GIME_CLOCK = 4; - - // statics - static const UINT8 hires_font[128][12]; - - // callbacks - devcb_write_line m_write_irq; - devcb_write_line m_write_firq; - devcb_read8 m_read_floating_bus; - - // device state - UINT8 m_gime_registers[16]; - UINT8 m_mmu[16]; - UINT8 m_ff22_value; - UINT8 m_interrupt_value; - UINT8 m_irq; - UINT8 m_firq; - UINT16 m_timer_value; - bool m_is_blinking; - - // video state - bool m_legacy_video; - UINT32 m_video_position; - UINT8 m_line_in_row; - scanline_record m_scanlines[25+192+26]; - bool m_displayed_rgb; - - // palette state - UINT8 m_palette_rotated[1024][16]; - UINT16 m_palette_rotated_position; - bool m_palette_rotated_position_used; - - // incidentals - ram_device * m_ram; - emu_timer * m_gime_clock_timer; - cococart_slot_device * m_cart_device; - memory_bank * m_read_banks[9]; - memory_bank * m_write_banks[9]; - UINT8 * m_rom; - UINT8 * m_cart_rom; - pixel_t m_composite_palette[64]; - pixel_t m_composite_bw_palette[64]; - pixel_t m_rgb_palette[64]; - UINT8 m_dummy_bank[0x2000]; - - const char *m_maincpu_tag; /* tag of main CPU */ - const char *m_ram_tag; /* tag of RAM device */ - const char *m_ext_tag; /* tag of expansion device */ - - // timer constants - static const device_timer_id TIMER_FRAME = 0; - static const device_timer_id TIMER_HSYNC_OFF = 1; - static const device_timer_id TIMER_HSYNC_ON = 2; - static const device_timer_id TIMER_FSYNC_OFF = 3; - static const device_timer_id TIMER_FSYNC_ON = 4; - - // read/write - UINT8 read(offs_t offset); - UINT8 read_gime_register(offs_t offset); - UINT8 read_mmu_register(offs_t offset); - UINT8 read_palette_register(offs_t offset); - UINT8 read_floating_bus(void); - void write(offs_t offset, UINT8 data); - void write_gime_register(offs_t offset, UINT8 data); - void write_mmu_register(offs_t offset, UINT8 data); - void write_palette_register(offs_t offset, UINT8 data); - void write_sam_register(offs_t offset); - - // memory - void update_memory(void); - void update_memory(int bank); - UINT8 *memory_pointer(UINT32 address); - - // interrupts - void interrupt_rising_edge(UINT8 interrupt); - void recalculate_irq(void); - void recalculate_firq(void); - - ATTR_FORCE_INLINE void set_interrupt_value(UINT8 interrupt, bool value) - { - /* save the old interrupt value */ - UINT8 old_interrupt_value = m_interrupt_value; - - /* update the interrupt value */ - if (value) - m_interrupt_value |= interrupt; - else - m_interrupt_value &= ~interrupt; - - /* was this a rising edge? */ - if (value && ((old_interrupt_value & interrupt) == 0)) - { - interrupt_rising_edge(interrupt); - } - } - - // timer - timer_type_t timer_type(void); - const char *timer_type_string(void); - void reset_timer(void); - void timer_elapsed(void); - - // video - bool update_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect, const pixel_t *palette); - void update_geometry(void); - void update_border(UINT16 physical_scanline); - pixel_t get_composite_color(int color); - pixel_t get_rgb_color(int color); - offs_t get_video_base(void); - UINT16 get_lines_per_row(void); - UINT32 get_data_mc6847(UINT32 video_position, UINT8 *data, UINT8 *mode); - UINT32 get_data_without_attributes(UINT32 video_position, UINT8 *data, UINT8 *mode); - UINT32 get_data_with_attributes(UINT32 video_position, UINT8 *data, UINT8 *mode); - bool is_blinking(void); - - // template function for doing video update collection - template - UINT32 record_scanline_res(int scanline); - - // rendering sampled graphics - typedef UINT32 (gime_base_device::*emit_samples_proc)(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); - UINT32 emit_dummy_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); - UINT32 emit_mc6847_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); - template - UINT32 emit_gime_text_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); - template - UINT32 emit_gime_graphics_samples(const scanline_record *scanline, int sample_start, int sample_count, pixel_t *pixels, const pixel_t *palette); - template - void render_scanline(const scanline_record *scanline, pixel_t *pixels, int min_x, int max_x, palette_resolver *resolver); -}; - - -//************************************************************************** -// VARIATIONS -//************************************************************************** - -class gime_ntsc_device : public gime_base_device -{ -public: - gime_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); -}; - -class gime_pal_device : public gime_base_device -{ -public: - gime_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); -}; - -extern const device_type GIME_NTSC; -extern const device_type GIME_PAL; - -#endif /* __GIME__ */ diff --git a/src/mess/video/hec2video.c b/src/mess/video/hec2video.c deleted file mode 100644 index f16f23b8363..00000000000 --- a/src/mess/video/hec2video.c +++ /dev/null @@ -1,141 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:JJ Stacino -///////////////////////////////////////////////////////////////////////////////// -///// Hector video -///////////////////////////////////////////////////////////////////////////////// -/* Hector 2HR+ - Victor - Hector 2HR - Hector HRX - Hector MX40c - Hector MX80c - Hector 1 - Interact - - 12/05/2009 Skeleton driver - Micko : mmicko@gmail.com - 31/06/2009 Video - Robbbert - - 29/10/2009 Update skeleton to functional machine - by yo_fr (jj.stac @ aliceadsl.fr) - - => add Keyboard, - => add color, - => add cassette, - => add sn76477 sound and 1bit sound, - => add joysticks (stick, pot, fire) - => add BR/HR switching - => add bank switch for HRX - => add device MX80c and bank switching for the ROM - Importante note : the keyboard function add been piked from - DChector project : http://dchector.free.fr/ made by DanielCoulom - (thank's Daniel) - TODO : Add the cartridge function, - Adjust the one shot and A/D timing (sn76477) -*/ - -#include "emu.h" - -#include "includes/hec2hrp.h" - - -void hec2hrp_state::Init_Hector_Palette() -{ - UINT8 *hector_color = m_hector_color; - // basic colors ! - hector_color[0] = 0; // fond (noir) - hector_color[1] = 1; // HECTOR HRX (rouge) - hector_color[2] = 7; // Point interrogation (Blanc) - hector_color[3] = 3; // Ecriture de choix (jaune) - - // Color initialisation : full lightning - m_palette->set_pen_color( 0,rgb_t(000,000,000));//Noir - m_palette->set_pen_color( 1,rgb_t(255,000,000));//Rouge - m_palette->set_pen_color( 2,rgb_t(000,255,000));//Vert - m_palette->set_pen_color( 3,rgb_t(255,255,000));//Jaune - m_palette->set_pen_color( 4,rgb_t(000,000,255));//Bleu - m_palette->set_pen_color( 5,rgb_t(255,000,255));//Magneta - m_palette->set_pen_color( 6,rgb_t(000,255,255));//Cyan - m_palette->set_pen_color( 7,rgb_t(255,255,255));//Blanc - // 1/2 lightning - - m_palette->set_pen_color( 8,rgb_t(000,000,000));//Noir - m_palette->set_pen_color( 9,rgb_t(128,000,000));//Rouge - m_palette->set_pen_color( 10,rgb_t(000,128,000));//Vert - m_palette->set_pen_color( 11,rgb_t(128,128,000));//Jaune - m_palette->set_pen_color( 12,rgb_t(000,000,128));//Bleu - m_palette->set_pen_color( 13,rgb_t(128,000,128));//Magneta - m_palette->set_pen_color( 14,rgb_t(000,128,128));//Cyan - m_palette->set_pen_color( 15,rgb_t(128,128,128));//Blanc -} - -void hec2hrp_state::hector_hr(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) -{ - UINT8 *hector_color = m_hector_color; - UINT8 gfx,y; - UINT16 sy=0,ma=0,x; - for (y = 0; y <= ymax; y++) { //224 - UINT16 *p = &bitmap.pix16(sy++); - for (x = ma; x < ma + yram; x++) { // 64 - gfx = *(page+x); - /* Display a scanline of a character (4 pixels !) */ - *p++ = hector_color[(gfx >> 0) & 0x03]; - *p++ = hector_color[(gfx >> 2) & 0x03]; - *p++ = hector_color[(gfx >> 4) & 0x03]; - *p++ = hector_color[(gfx >> 6) & 0x03]; - } - ma+=yram; - } -} - -void hec2hrp_state::hector_80c(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) -{ - UINT8 gfx,y; - UINT16 sy=0,ma=0,x; - for (y = 0; y <= ymax; y++) { //224 - UINT16 *p = &bitmap.pix16(sy++); - for (x = ma; x < ma + yram; x++) { // 64 - gfx = *(page+x); - /* Display a scanline of a character (8 pixels !) */ - *p++ = (gfx & 0x01) ? 7 : 0; - *p++ = (gfx & 0x02) ? 7 : 0; - *p++ = (gfx & 0x04) ? 7 : 0; - *p++ = (gfx & 0x08) ? 7 : 0; - *p++ = (gfx & 0x10) ? 7 : 0; - *p++ = (gfx & 0x20) ? 7 : 0; - *p++ = (gfx & 0x40) ? 7 : 0; - *p++ = (gfx & 0x80) ? 7 : 0; - } - ma+=yram; - } -} - - -VIDEO_START_MEMBER(hec2hrp_state,hec2hrp) -{ - Init_Hector_Palette(); -} - -UINT32 hec2hrp_state::screen_update_hec2hrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_videoram; - UINT8 *videoram_HR = m_hector_videoram; - if (m_hector_flag_hr==1) - { - if (m_hector_flag_80c==0) - { - screen.set_visible_area(0, 243, 0, 227); - hector_hr(bitmap , &videoram_HR[0], 227, 64); - } - else - { - screen.set_visible_area(0, 243*2, 0, 227); - hector_80c(bitmap , &videoram_HR[0], 227, 64); - } - } - else - { - screen.set_visible_area(0, 113, 0, 75); - hector_hr(bitmap, videoram, 77, 32); - } - return 0; -} diff --git a/src/mess/video/hp48.c b/src/mess/video/hp48.c deleted file mode 100644 index 03883f17100..00000000000 --- a/src/mess/video/hp48.c +++ /dev/null @@ -1,203 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2008 - - Hewlett Packard HP48 S/SX & G/GX/G+ - -**********************************************************************/ - -#include "emu.h" -#include "includes/hp48.h" - -/*************************************************************************** - DEBUGGING -***************************************************************************/ - - -#define VERBOSE 0 - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - - - -/*************************************************************************** - GLOBAL VARIABLES & CONSTANTS -***************************************************************************/ - -/* base colors */ -static const int hp48_bg_color[3] = { 136, 147, 109 }; /* yellow */ -static const int hp48_fg_color[3] = { 0, 0, 64 }; /* dark blue */ - -/* color mixing */ -#define mix(c1,c2,x) (c1)*(1-(x))+(c2)*(x) -#define mix2(i,x) mix(hp48_bg_color[i],hp48_fg_color[i],x) - - - - -/*************************************************************************** - FUNCTIONS -***************************************************************************/ - -PALETTE_INIT_MEMBER(hp48_state, hp48) -{ - int i; - for ( i = 0; i < 255; i++ ) - { - float c = i/255.; - m_palette->set_pen_color( i, rgb_t( 0, mix2(0,c), mix2(1,c), mix2(2,c) ) ); - } -} - - - -/* The screen is organised as follows: - - - - announciators - - ---------------------- ^ ^ - | | | | - | | | | - | | | | - | | M lines | - | main screen | | | - | | | | - | | | 64 lines - | | | | - | | | | - |----------------------| - | - | | | | - | menu | m lines | - | | | | - ---------------------- v v - - <----- 131 columns ----> - - - - The LCD is 131x64 pixels and has two components: - - a main screen - - a menu screen - - The main height (M) and the menu height (m) can be changed with the constraints: - - m+M=64 - - M>=2 - - Pixels are 1-bit, packed in memory. - - The start address of both screens can be changed independently - (this allows smooth, pixel-precise vertical scrooling of both parts). - They must be even addresses (in nibbles). - - The stride (offset in nibbles between two scanlines) can be changed for the main screen. - It must be even. - It is fixed to 34 for the menu screen. - - The bit offset for the first column of the main screen can be changed - (this allows smooth, pixel-precise horizontal scrooling). - It is always 0 for the menu screen. - - Above the LCD, there are 6 annonciators that can be independently turned - on and off (and independetly from the LCD). - They are not handled here, but through output_set_value. - */ - - -/* - In theory, the LCD is monorchrome, with a global adjustable contrast (32 levels). - However, by switching between screens at each refresh (64 Hz), one can achieve the - illusion of grayscale, with moderate flickering. - This technique was very widespread. - We emulate it by simply averaging between the last few (HP48_NB_SCREENS) frames. - - HP48_NB_SCREENS should be a multiple of the period of screen flips to avoid - flickering in the emulation. - */ - - -#define draw_pixel \ - m_screens[ m_cur_screen ][ y ][ xp + 8 ] = (data & 1) ? fg : 0; \ - xp++; \ - data >>= 1 - -#define draw_quart \ - UINT8 data = space.read_byte( addr ); \ - draw_pixel; draw_pixel; draw_pixel; draw_pixel; - - -UINT32 hp48_state::screen_update_hp48(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int x, y, xp, i, addr; - int display = HP48_IO_4(0) >> 3; /* 1=on, 0=off */ - int left_margin = HP48_IO_4(0) & 7; /* 0..7 pixels for main bitmap */ - int contrast = HP48_IO_8(1) & 0x1f; /* 0..31 */ - int refresh = HP48_IO_4(3) >> 3; /* vertical refresh */ - int bitmap_start = HP48_IO_20(0x20) & ~1; /* main bitmap address */ - int right_margin = HP48_IO_12(0x25) & ~1; /* -2048..2046 nibbles for main bitmap */ - int last_line = HP48_IO_8(0x28) & 0x3f; /* 2..63 lines of main bitmap before menu */ - int menu_start = HP48_IO_20(0x30) & ~1; /* menu bitmap address */ - int fg = contrast + 2; - - LOG(( "%f hp48 video_update called: ", machine().time().as_double())); - - if ( !display || refresh ) - { - LOG(( "display off\n" )); - bitmap.fill(0 ); - return 0; - } - - /* correcting factors */ - if ( right_margin & 0x800 ) right_margin -= 0x1000; - if ( last_line <= 1 ) last_line = 0x3f; - - LOG(( "on=%i lmargin=%i rmargin=%i contrast=%i start=%05x lline=%i menu=%05x\n", - display, left_margin, right_margin, contrast, bitmap_start, last_line, menu_start )); - - /* draw main bitmap */ - addr = bitmap_start; - for ( y = 0; y <= last_line; y++ ) - { - xp = -left_margin; - for ( x = 0; x < 34; x++, addr++ ) - { - draw_quart; - } - addr += (right_margin + (left_margin / 4) + 1) & ~1; - } - - /* draw menu bitmap */ - addr = menu_start; - for ( ; y <= 0x3f; y++ ) - { - xp = 0; - for ( x = 0; x < 34; x++, addr++ ) - { - draw_quart; - } - } - - /* draw averaged frames */ - for ( y = 0; y < 64; y++ ) - { - for ( x = 0; x < 131; x++ ) - { - int acc = 0; - for ( i = 0; i < HP48_NB_SCREENS; i++ ) - { - acc += m_screens[ i ][ y ][ x+8 ]; - } - acc = (acc * 255) / (33 * HP48_NB_SCREENS); - bitmap.pix16(y, x ) = acc; - } - } - - m_cur_screen = (m_cur_screen + 1) % HP48_NB_SCREENS; - - return 0; -} diff --git a/src/mess/video/intv.c b/src/mess/video/intv.c deleted file mode 100644 index 42c12b743a8..00000000000 --- a/src/mess/video/intv.c +++ /dev/null @@ -1,137 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,Frank Palazzolo -#include "emu.h" -#include "includes/intv.h" - -void intv_state::video_start() -{ - m_tms9927_num_rows = 25; -} - - -/* very rudimentary support for the tms9927 character generator IC */ - - -READ8_MEMBER( intv_state::intvkbd_tms9927_r ) -{ - UINT8 rv; - switch (offset) - { - case 8: - rv = m_tms9927_cursor_row; - break; - case 9: - /* note: this is 1-based */ - rv = m_tms9927_cursor_col; - break; - case 11: - m_tms9927_last_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows; - rv = m_tms9927_last_row; - break; - default: - rv = 0; - } - return rv; -} - -WRITE8_MEMBER( intv_state::intvkbd_tms9927_w ) -{ - switch (offset) - { - case 3: - m_tms9927_num_rows = (data & 0x3f) + 1; - break; - case 6: - m_tms9927_last_row = data; - break; - case 11: - m_tms9927_last_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows; - break; - case 12: - /* note: this is 1-based */ - m_tms9927_cursor_col = data; - break; - case 13: - m_tms9927_cursor_row = data; - break; - } -} - - -UINT32 intv_state::screen_update_intv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_stic->screen_update(screen, bitmap, cliprect); - return 0; -} - - -UINT32 intv_state::screen_update_intvkbd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_videoram; - int x,y,offs; - int current_row; -// char c; - - /* Draw the underlying INTV screen first */ - m_stic->screen_update(screen, bitmap, cliprect); - - /* if the intvkbd text is not blanked, overlay it */ - if (!m_intvkbd_text_blanked) - { - current_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows; - for(y=0;y<24;y++) - { - for(x=0;x<40;x++) - { - offs = current_row*64+x; - - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, - videoram[offs], - 7, /* white */ - 0,0, - x<<3,y<<3, 0); - } - if (current_row == m_tms9927_cursor_row) - { - /* draw the cursor as a solid white block */ - /* (should use a filled rect here!) */ - - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, - 191, /* a block */ - 7, /* white */ - 0,0, - (m_tms9927_cursor_col-1)<<3,y<<3, 0); - } - current_row = (current_row + 1) % m_tms9927_num_rows; - } - } - -#if 0 - // debugging - c = tape_motor_mode_desc[m_tape_motor_mode][0]; - m_gfxdecode->gfx(0)->transpen(bitmap,&machine().screen[0].visarea, - c, - 1, - 0,0, - 0*8,0*8, 0); - for(y=0;y<5;y++) - { - m_gfxdecode->gfx(0)->transpen(bitmap,&machine().screen[0].visarea, - m_tape_unknown_write[y]+'0', - 1, - 0,0, - 0*8,(y+2)*8, 0); - } - m_gfxdecode->gfx(0)->transpen(bitmap,&machine().screen[0].visarea, - m_tape_unknown_write[5]+'0', - 1, - 0,0, - 0*8,8*8, 0); - m_gfxdecode->gfx(0)->transpen(bitmap,&machine().screen[0].visarea, - m_tape_interrupts_enabled+'0', - 1, - 0,0, - 0*8,10*8, 0); -#endif - return 0; -} diff --git a/src/mess/video/k1ge.c b/src/mess/video/k1ge.c deleted file mode 100644 index 94e0398fd1a..00000000000 --- a/src/mess/video/k1ge.c +++ /dev/null @@ -1,918 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/****************************************************************************** - - K1GE/K2GE graphics emulation - - The K1GE graphics were used in the Neogeo pocket mono; the K2GE graphics were - used in the Neogeo pocket color. - -******************************************************************************/ - -#include "emu.h" -#include "k1ge.h" - - -PALETTE_INIT_MEMBER(k1ge_device, k1ge) -{ - int i; - - for ( i = 0; i < 8; i++ ) - { - int j = ( i << 5 ) | ( i << 2 ) | ( i >> 1 ); - - palette.set_pen_color( 7-i, j, j, j ); - } -} - - -PALETTE_INIT_MEMBER(k2ge_device, k2ge) -{ - int r,g,b; - - for ( b = 0; b < 16; b++ ) - { - for ( g = 0; g < 16; g++ ) - { - for ( r = 0; r < 16; r++ ) - { - palette.set_pen_color( ( b << 8 ) | ( g << 4 ) | r, ( r << 4 ) | r, ( g << 4 ) | g, ( b << 4 ) | b ); - } - } - } -} - - -READ8_MEMBER( k1ge_device::read ) -{ - assert(offset < 0x4000); - - UINT8 data = m_vram[offset]; - - switch( offset ) - { - case 0x008: /* RAS.H */ - data = m_screen->hpos() >> 2; - break; - case 0x009: /* RAS.V */ - data = m_screen->vpos(); - break; - } - return data; -} - - -WRITE8_MEMBER( k1ge_device::write ) -{ - assert(offset < 0x4000); - - switch( offset ) - { - case 0x000: - m_vblank_pin_w( ( data & 0x80 ) ? ( ( m_vram[0x010] & 0x40 ) ? 1 : 0 ) : 0 ); - break; - case 0x030: - data &= 0x80; - break; - case 0x101: case 0x102: case 0x103: - case 0x105: case 0x106: case 0x107: - case 0x109: case 0x10a: case 0x10b: - case 0x10d: case 0x10e: case 0x10f: - case 0x111: case 0x112: case 0x113: - case 0x115: case 0x116: case 0x117: - data &= 0x07; - break; - case 0x7e2: - if ( m_vram[0x7f0] != 0xaa ) - return; - data &= 0x80; - break; - } - - /* Only the lower 4 bits of the palette entry high bytes can be written */ - if ( offset >= 0x0200 && offset < 0x0400 && ( offset & 1 ) ) - { - data &= 0x0f; - } - - m_vram[offset] = data; -} - - -void k1ge_device::draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, int pal_base ) -{ - int i; - int offset_x = ( scroll_x >> 3 ) * 2; - int px = scroll_x & 0x07; - UINT16 map_data; - UINT16 hflip; - UINT16 pcode; - UINT16 tile_addr; - UINT16 tile_data; - - base += ( ( ( ( scroll_y + line ) >> 3 ) * 0x0040 ) & 0x7ff ); - - /* setup */ - map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); - hflip = map_data & 0x8000; - pcode = pal_base + ( ( map_data & 0x2000 ) ? 4 : 0 ); - tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); - if ( map_data & 0x4000 ) - tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; - else - tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - if ( hflip ) - tile_data >>= 2 * ( scroll_x & 0x07 ); - else - tile_data <<= 2 * ( scroll_x & 0x07 ); - - /* draw pixels */ - for ( i = 0; i < 160; i++ ) - { - UINT16 col; - - if ( hflip ) - { - col = tile_data & 0x0003; - tile_data >>= 2; - } - else - { - col = tile_data >> 14; - tile_data <<= 2; - } - - if ( col ) - { - p[ i ] = m_vram[ pcode + col ]; - } - - px++; - if ( px >= 8 ) - { - offset_x = ( offset_x + 2 ) & 0x3f; - map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); - hflip = map_data & 0x8000; - pcode = pal_base + ( ( map_data & 0x2000 ) ? 4 : 0 ); - tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); - if ( map_data & 0x4000 ) - tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; - else - tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - px = 0; - } - } -} - - -void k1ge_device::draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ) -{ - struct { - UINT16 spr_data; - UINT8 x; - UINT8 y; - } spr[64]; - int num_sprites = 0; - UINT8 spr_y = 0; - UINT8 spr_x = 0; - int i; - - priority <<= 11; - - /* Select sprites */ - for ( i = 0; i < 256; i += 4 ) - { - UINT16 spr_data = m_vram[ 0x800 + i ] | ( m_vram[ 0x801 + i ] << 8 ); - UINT8 x = m_vram[ 0x802 + i ]; - UINT8 y = m_vram[ 0x803 + i ]; - - spr_x = ( spr_data & 0x0400 ) ? ( spr_x + x ) : ( scroll_x + x ); - spr_y = ( spr_data & 0x0200 ) ? ( spr_y + y ) : ( scroll_y + y ); - - if ( ( spr_data & 0x1800 ) == priority ) - { - if ( ( line >= spr_y || spr_y > 0xf8 ) && line < ( ( spr_y + 8 ) & 0xff ) ) - { - spr[num_sprites].spr_data = spr_data; - spr[num_sprites].y = spr_y; - spr[num_sprites].x = spr_x; - num_sprites++; - } - } - } - - /* Draw sprites */ - for ( i = num_sprites-1; i >= 0; i-- ) - { - int j; - UINT16 tile_addr; - UINT16 tile_data; - UINT16 pcode = 0x100 + ( ( spr[i].spr_data & 0x2000 ) ? 4 : 0 ); - - tile_addr = 0x2000 + ( ( spr[i].spr_data & 0x1ff ) * 16 ); - if ( spr[i].spr_data & 0x4000 ) - tile_addr += ( 7 - ( ( line - spr[i].y ) & 0x07 ) ) * 2; - else - tile_addr += ( ( line - spr[i].y ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - - for ( j = 0; j < 8; j++ ) - { - UINT16 col; - - spr_x = spr[i].x + j; - - if ( spr[i].spr_data & 0x8000 ) - { - col = tile_data & 0x03; - tile_data >>= 2; - } - else - { - col = tile_data >> 14; - tile_data <<= 2; - } - - if ( spr_x < 160 && col ) - { - p[ spr_x ] = m_vram[ pcode + col ]; - } - } - } -} - - -void k1ge_device::draw( int line ) -{ - UINT16 *p = &m_bitmap->pix16(line); - UINT16 oowcol = m_vram[0x012] & 0x07; - int i; - - if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) - { - for( i = 0; i < 160; i++ ) - { - p[i] = oowcol; - } - } - else - { - UINT16 col = ( ( m_vram[0x118] & 0xc0 ) == 0x80 ) ? m_vram[0x118] & 0x07 : 0; - - for ( i = 0; i < 160; i++ ) - p[i] = col; - - if ( m_vram[0x030] & 0x80 ) - { - /* Draw sprites with 01 priority */ - draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF1 */ - draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x108 ); - - /* Draw sprites with 10 priority */ - draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF2 */ - draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x110 ); - - /* Draw sprites with 11 priority */ - draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); - } - else - { - /* Draw sprites with 01 priority */ - draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF2 */ - draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x110 ); - - /* Draw sprites with 10 priority */ - draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF1 */ - draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x108 ); - - /* Draw sprites with 11 priority */ - draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); - } - - for( i = 0; i < m_wba_h; i++ ) - { - p[i] = oowcol; - } - - for( i = m_wba_h + m_wsi_h; i < 160; i++ ) - { - p[i] = oowcol; - } - } -} - - -void k2ge_device::draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_base ) -{ - int i; - int offset_x = ( scroll_x >> 3 ) * 2; - int px = scroll_x & 0x07; - UINT16 map_data; - UINT16 hflip; - UINT16 pcode; - UINT16 tile_addr; - UINT16 tile_data; - - base += ( ( ( ( scroll_y + line ) >> 3 ) * 0x0040 ) & 0x7ff ); - - /* setup */ - map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); - hflip = map_data & 0x8000; - pcode = pal_base + ( ( map_data & 0x1e00 ) >> 6 ); - tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); - if ( map_data & 0x4000 ) - tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; - else - tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - if ( hflip ) - tile_data >>= 2 * ( scroll_x & 0x07 ); - else - tile_data <<= 2 * ( scroll_x & 0x07 ); - - /* draw pixels */ - for ( i = 0; i < 160; i++ ) - { - UINT16 col; - - if ( hflip ) - { - col = tile_data & 0x0003; - tile_data >>= 2; - } - else - { - col = tile_data >> 14; - tile_data <<= 2; - } - - if ( col ) - { - p[ i ] = m_vram[ pcode + col * 2 ] | ( m_vram[ pcode + col * 2 + 1 ] << 8 ); - } - - px++; - if ( px >= 8 ) - { - offset_x = ( offset_x + 2 ) & 0x3f; - map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); - hflip = map_data & 0x8000; - pcode = pal_base + ( ( map_data & 0x1e00 ) >> 6 ); - tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); - if ( map_data & 0x4000 ) - tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; - else - tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - px = 0; - } - } -} - - -void k2ge_device::draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ) -{ - struct { - UINT16 spr_data; - UINT8 x; - UINT8 y; - UINT8 index; - } spr[64]; - int num_sprites = 0; - UINT8 spr_y = 0; - UINT8 spr_x = 0; - int i; - - priority <<= 11; - - /* Select sprites */ - for ( i = 0; i < 256; i += 4 ) - { - UINT16 spr_data = m_vram[ 0x800 + i ] | ( m_vram[ 0x801 + i ] << 8 ); - UINT8 x = m_vram[ 0x802 + i ]; - UINT8 y = m_vram[ 0x803 + i ]; - - spr_x = ( spr_data & 0x0400 ) ? ( spr_x + x ) : ( scroll_x + x ); - spr_y = ( spr_data & 0x0200 ) ? ( spr_y + y ) : ( scroll_y + y ); - - if ( ( spr_data & 0x1800 ) == priority ) - { - if ( ( line >= spr_y || spr_y > 0xf8 ) && line < ( ( spr_y + 8 ) & 0xff ) ) - { - spr[num_sprites].spr_data = spr_data; - spr[num_sprites].y = spr_y; - spr[num_sprites].x = spr_x; - spr[num_sprites].index = i >> 2; - num_sprites++; - } - } - } - - /* Draw sprites */ - for ( i = num_sprites-1; i >= 0; i-- ) - { - int j; - UINT16 tile_addr; - UINT16 tile_data; - UINT16 pcode = 0x0200 + ( ( m_vram[0x0c00 + spr[i].index ] & 0x0f ) << 3 ); - - tile_addr = 0x2000 + ( ( spr[i].spr_data & 0x1ff ) * 16 ); - if ( spr[i].spr_data & 0x4000 ) - tile_addr += ( 7 - ( ( line - spr[i].y ) & 0x07 ) ) * 2; - else - tile_addr += ( ( line - spr[i].y ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - - for ( j = 0; j < 8; j++ ) - { - UINT16 col; - - spr_x = spr[i].x + j; - - if ( spr[i].spr_data & 0x8000 ) - { - col = tile_data & 0x03; - tile_data >>= 2; - } - else - { - col = tile_data >> 14; - tile_data <<= 2; - } - - if ( spr_x < 160 && col ) - { - p[ spr_x ] = m_vram[ pcode + col * 2 ] | ( m_vram[ pcode + col * 2 + 1 ] << 8 ); - } - } - } -} - - -void k2ge_device::k1ge_draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_lut_base, UINT16 k2ge_lut_base ) -{ - int i; - int offset_x = ( scroll_x >> 3 ) * 2; - int px = scroll_x & 0x07; - UINT16 map_data; - UINT16 hflip; - UINT16 pcode; - UINT16 tile_addr; - UINT16 tile_data; - - base += ( ( ( ( scroll_y + line ) >> 3 ) * 0x0040 ) & 0x7ff ); - - /* setup */ - map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); - hflip = map_data & 0x8000; - pcode = ( map_data & 0x2000 ) ? 1 : 0; - tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); - if ( map_data & 0x4000 ) - tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; - else - tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - if ( hflip ) - tile_data >>= 2 * ( scroll_x & 0x07 ); - else - tile_data <<= 2 * ( scroll_x & 0x07 ); - - /* draw pixels */ - for ( i = 0; i < 160; i++ ) - { - UINT16 col; - - if ( hflip ) - { - col = tile_data & 0x0003; - tile_data >>= 2; - } - else - { - col = tile_data >> 14; - tile_data <<= 2; - } - - if ( col ) - { - UINT16 col2 = 16 * pcode + ( m_vram[ pal_lut_base + 4 * pcode + col ] * 2 ); - p[ i ] = m_vram[ k2ge_lut_base + col2 ] | ( m_vram[ k2ge_lut_base + col2 + 1 ] << 8 ); - } - - px++; - if ( px >= 8 ) - { - offset_x = ( offset_x + 2 ) & 0x3f; - map_data = m_vram[ base + offset_x ] | ( m_vram[ base + offset_x + 1 ] << 8 ); - hflip = map_data & 0x8000; - pcode = ( map_data & 0x2000 ) ? 1 : 0; - tile_addr = 0x2000 + ( ( map_data & 0x1ff ) * 16 ); - if ( map_data & 0x4000 ) - tile_addr += ( 7 - ( ( scroll_y + line ) & 0x07 ) ) * 2; - else - tile_addr += ( ( scroll_y + line ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - px = 0; - } - } -} - - -void k2ge_device::k1ge_draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ) -{ - struct { - UINT16 spr_data; - UINT8 x; - UINT8 y; - } spr[64]; - int num_sprites = 0; - UINT8 spr_y = 0; - UINT8 spr_x = 0; - int i; - - priority <<= 11; - - /* Select sprites */ - for ( i = 0; i < 256; i += 4 ) - { - UINT16 spr_data = m_vram[ 0x800 + i ] | ( m_vram[ 0x801 + i ] << 8 ); - UINT8 x = m_vram[ 0x802 + i ]; - UINT8 y = m_vram[ 0x803 + i ]; - - spr_x = ( spr_data & 0x0400 ) ? ( spr_x + x ) : ( scroll_x + x ); - spr_y = ( spr_data & 0x0200 ) ? ( spr_y + y ) : ( scroll_y + y ); - - if ( ( spr_data & 0x1800 ) == priority ) - { - if ( ( line >= spr_y || spr_y > 0xf8 ) && line < ( ( spr_y + 8 ) & 0xff ) ) - { - spr[num_sprites].spr_data = spr_data; - spr[num_sprites].y = spr_y; - spr[num_sprites].x = spr_x; - num_sprites++; - } - } - } - - /* Draw sprites */ - for ( i = num_sprites-1; i >= 0; i-- ) - { - int j; - UINT16 tile_addr; - UINT16 tile_data; - UINT16 pcode = ( spr[i].spr_data & 0x2000 ) ? 1 : 0; - - tile_addr = 0x2000 + ( ( spr[i].spr_data & 0x1ff ) * 16 ); - if ( spr[i].spr_data & 0x4000 ) - tile_addr += ( 7 - ( ( line - spr[i].y ) & 0x07 ) ) * 2; - else - tile_addr += ( ( line - spr[i].y ) & 0x07 ) * 2; - tile_data = m_vram[ tile_addr ] | ( m_vram[ tile_addr + 1 ] << 8 ); - - for ( j = 0; j < 8; j++ ) - { - UINT16 col; - - spr_x = spr[i].x + j; - - if ( spr[i].spr_data & 0x8000 ) - { - col = tile_data & 0x03; - tile_data >>= 2; - } - else - { - col = tile_data >> 14; - tile_data <<= 2; - } - - if ( spr_x < 160 && col ) - { - UINT16 col2 = 16 * pcode + m_vram[ 0x100 + 4 * pcode + col ] * 2; - p[ spr_x ] = m_vram[ 0x380 + col2 ] | ( m_vram[ 0x381 + col2 ] << 8 ); - } - } - } -} - - -void k2ge_device::draw( int line ) -{ - UINT16 *p = &m_bitmap->pix16(line); - UINT16 col = 0; - UINT16 oowcol; - int i; - - oowcol = ( m_vram[0x012] & 0x07 ) * 2; - oowcol = m_vram[0x3f0 + oowcol ] | ( m_vram[0x3f1 + oowcol ] << 8 ); - - if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) - { - for( i = 0; i < 160; i++ ) - { - p[i] = oowcol; - } - } - else - { - /* Determine the background color */ - if ( ( m_vram[0x118] & 0xc0 ) == 0x80 ) - { - col = ( m_vram[0x118] & 0x07 ) * 2; - } - col = m_vram[0x3e0 + col ] | ( m_vram[0x3e1 + col ] << 8 ); - - /* Set the bacground color */ - for ( i = 0; i < 160; i++ ) - { - p[i] = col; - } - - if ( m_vram[0x7e2] & 0x80 ) - { - /* K1GE compatibility mode */ - if ( m_vram[0x030] & 0x80 ) - { - /* Draw sprites with 01 priority */ - k1ge_draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF1 */ - k1ge_draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x108, 0x3a0 ); - - /* Draw sprites with 10 priority */ - k1ge_draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF2 */ - k1ge_draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x110, 0x3c0 ); - - /* Draw sprites with 11 priority */ - k1ge_draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); - } - else - { - /* Draw sprites with 01 priority */ - k1ge_draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF2 */ - k1ge_draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x110, 0x3c0 ); - - /* Draw sprites with 10 priority */ - k1ge_draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF1 */ - k1ge_draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x108, 0x3a0 ); - - /* Draw sprites with 11 priority */ - k1ge_draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); - } - } - else - { - /* K2GE mode */ - if ( m_vram[0x030] & 0x80 ) - { - /* Draw sprites with 01 priority */ - draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF1 */ - draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x280 ); - - /* Draw sprites with 10 priority */ - draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF2 */ - draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x300 ); - - /* Draw sprites with 11 priority */ - draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); - } - else - { - /* Draw sprites with 01 priority */ - draw_sprite_plane( p, 1, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF2 */ - draw_scroll_plane( p, 0x1800, line, m_vram[0x034], m_vram[0x035], 0x300 ); - - /* Draw sprites with 10 priority */ - draw_sprite_plane( p, 2, line, m_vram[0x020], m_vram[0x021] ); - - /* Draw PF1 */ - draw_scroll_plane( p, 0x1000, line, m_vram[0x032], m_vram[0x033], 0x280 ); - - /* Draw sprites with 11 priority */ - draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); - } - } - - for ( i = 0; i < m_wba_h; i++ ) - { - p[i] = oowcol; - } - - for ( i = m_wba_h + m_wsi_h; i < 160; i++ ) - { - p[i] = oowcol; - } - } -} - - -TIMER_CALLBACK_MEMBER( k1ge_device::hblank_on_timer_callback ) -{ - m_hblank_pin_w(0); -} - - -TIMER_CALLBACK_MEMBER( k1ge_device::timer_callback ) -{ - int y = m_screen->vpos(); - - /* Check for start of VBlank */ - if ( y >= 152 ) - { - m_vram[0x010] |= 0x40; - if (m_vram[0x000] & 0x80) - { - m_vblank_pin_w(1); - } - } - - /* Check for end of VBlank */ - if ( y == 0 ) - { - m_wba_h = m_vram[0x002]; - m_wba_v = m_vram[0x003]; - m_wsi_h = m_vram[0x004]; - m_wsi_v = m_vram[0x005]; - m_vram[0x010] &= ~ 0x40; - if (m_vram[0x000] & 0x80) - { - m_vblank_pin_w(0); - } - } - - /* Check if Hint should be triggered */ - if ( y == K1GE_SCREEN_HEIGHT - 1 || y < 151 ) - { - if (!m_hblank_pin_w.isnull()) - { - if (m_vram[0x000] & 0x40) - { - m_hblank_pin_w(1); - } - m_hblank_on_timer->adjust( m_screen->time_until_pos(y, 480 ) ); - } - } - - /* Draw a line when inside visible area */ - if ( y && y < 153 ) - { - draw( y - 1 ); - } - - m_timer->adjust( m_screen->time_until_pos(( y + 1 ) % K1GE_SCREEN_HEIGHT, 0 ) ); -} - - -void k1ge_device::update( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - copybitmap( bitmap, *m_bitmap, 0, 0, 0, 0, cliprect ); -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void k1ge_device::device_start() -{ - m_vblank_pin_w.resolve(); - m_hblank_pin_w.resolve(); - - m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k1ge_device::timer_callback), this)); - m_hblank_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k1ge_device::hblank_on_timer_callback), this)); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x4000); - m_bitmap = auto_bitmap_ind16_alloc( machine(), m_screen->width(), m_screen->height() ); - - save_pointer(NAME(m_vram), 0x4000); - save_item(NAME(m_wba_h)); - save_item(NAME(m_wba_v)); - save_item(NAME(m_wsi_h)); - save_item(NAME(m_wsi_v)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void k1ge_device::device_reset() -{ - m_vram[0x000] = 0x00; /* Interrupt enable */ - m_vram[0x002] = 0x00; /* WBA.H */ - m_vram[0x003] = 0x00; /* WVA.V */ - m_vram[0x004] = 0xFF; /* WSI.H */ - m_vram[0x005] = 0xFF; /* WSI.V */ - m_vram[0x007] = 0xc6; /* REF */ - m_vram[0x012] = 0x00; /* 2D control */ - m_vram[0x020] = 0x00; /* PO.H */ - m_vram[0x021] = 0x00; /* PO.V */ - m_vram[0x030] = 0x00; /* PF */ - m_vram[0x032] = 0x00; /* S1SO.H */ - m_vram[0x033] = 0x00; /* S1SO.V */ - m_vram[0x034] = 0x00; /* S2SO.H */ - m_vram[0x035] = 0x00; /* S2SO.V */ - m_vram[0x101] = 0x07; /* SPPLT01 */ - m_vram[0x102] = 0x07; /* SPPLT02 */ - m_vram[0x103] = 0x07; /* SPPLT03 */ - m_vram[0x105] = 0x07; /* SPPLT11 */ - m_vram[0x106] = 0x07; /* SPPLT12 */ - m_vram[0x107] = 0x07; /* SPPLT13 */ - m_vram[0x109] = 0x07; /* SC1PLT01 */ - m_vram[0x10a] = 0x07; /* SC1PLT02 */ - m_vram[0x10b] = 0x07; /* SC1PLT03 */ - m_vram[0x10d] = 0x07; /* SC1PLT11 */ - m_vram[0x10e] = 0x07; /* SC1PLT12 */ - m_vram[0x10f] = 0x07; /* SC1PLT13 */ - m_vram[0x111] = 0x07; /* SC2PLT01 */ - m_vram[0x112] = 0x07; /* SC2PLT02 */ - m_vram[0x113] = 0x07; /* SC2PLT03 */ - m_vram[0x115] = 0x07; /* SC2PLT11 */ - m_vram[0x116] = 0x07; /* SC2PLT12 */ - m_vram[0x117] = 0x07; /* SC2PLT13 */ - m_vram[0x118] = 0x07; /* BG */ - m_vram[0x400] = 0xFF; /* LED control */ - m_vram[0x402] = 0x80; /* LEDFREG */ - m_vram[0x7e0] = 0x52; /* RESET */ - m_vram[0x7e2] = 0x00; /* MODE */ - - m_timer->adjust( m_screen->time_until_pos(( m_screen->vpos() + 1 ) % K1GE_SCREEN_HEIGHT, 0 ) ); -} - - -const device_type K1GE = &device_creator; - -k1ge_device::k1ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, K1GE, "K1GE Monochrome Graphics + LCD", tag, owner, clock, "k1ge", __FILE__) - , device_video_interface(mconfig, *this) - , m_vblank_pin_w(*this) - , m_hblank_pin_w(*this) -{ -} - -k1ge_device::k1ge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source) - , device_video_interface(mconfig, *this) - , m_vblank_pin_w(*this) - , m_hblank_pin_w(*this) -{ -} - -static MACHINE_CONFIG_FRAGMENT( k1ge ) - MCFG_PALETTE_ADD("palette", 8 ) - MCFG_PALETTE_INIT_OWNER(k1ge_device, k1ge) -MACHINE_CONFIG_END - -//------------------------------------------------- -// machine_config_additions - return a pointer to -// the device's machine fragment -//------------------------------------------------- - -machine_config_constructor k1ge_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( k1ge ); -} - - -const device_type K2GE = &device_creator; - -k2ge_device::k2ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : k1ge_device(mconfig, K2GE, "K2GE Color Graphics + LCD", tag, owner, clock, "k2ge", __FILE__) -{ -} - -static MACHINE_CONFIG_FRAGMENT( k2ge ) - MCFG_PALETTE_ADD("palette", 4096 ) - MCFG_PALETTE_INIT_OWNER(k2ge_device, k2ge) -MACHINE_CONFIG_END - -//------------------------------------------------- -// machine_config_additions - return a pointer to -// the device's machine fragment -//------------------------------------------------- - -machine_config_constructor k2ge_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( k2ge ); -} diff --git a/src/mess/video/k1ge.h b/src/mess/video/k1ge.h deleted file mode 100644 index 6ecb2e771bc..00000000000 --- a/src/mess/video/k1ge.h +++ /dev/null @@ -1,92 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/****************************************************************************** - - K1GE/K2GE graphics emulation - -******************************************************************************/ - -#ifndef __K2GE_H_ -#define __K2GE_H_ - - -#define MCFG_K1GE_ADD(_tag, _clock, _screen, _vblank, _hblank ) \ - MCFG_DEVICE_ADD( _tag, K1GE, _clock ) \ - MCFG_VIDEO_SET_SCREEN( _screen ) \ - devcb = &k1ge_device::static_set_vblank_callback( *device, DEVCB_##_vblank ); \ - devcb = &k1ge_device::static_set_hblank_callback( *device, DEVCB_##_hblank ); - -#define MCFG_K2GE_ADD(_tag, _clock, _screen, _vblank, _hblank ) \ - MCFG_DEVICE_ADD( _tag, K2GE, _clock ) \ - MCFG_VIDEO_SET_SCREEN( _screen ) \ - devcb = &k1ge_device::static_set_vblank_callback( *device, DEVCB_##_vblank ); \ - devcb = &k1ge_device::static_set_hblank_callback( *device, DEVCB_##_hblank ); - - -class k1ge_device : public device_t, - public device_video_interface -{ -public: - k1ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - k1ge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_PALETTE_INIT(k1ge); - - void update( bitmap_ind16 &bitmap, const rectangle &cliprect ); - - // Static methods - template static devcb_base &static_set_vblank_callback(device_t &device, _Object object) { return downcast(device).m_vblank_pin_w.set_callback(object); } - template static devcb_base &static_set_hblank_callback(device_t &device, _Object object) { return downcast(device).m_hblank_pin_w.set_callback(object); } - - static const int K1GE_SCREEN_HEIGHT = 199; -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual machine_config_constructor device_mconfig_additions() const; - - devcb_write_line m_vblank_pin_w; - devcb_write_line m_hblank_pin_w; - UINT8 *m_vram; - UINT8 m_wba_h, m_wba_v, m_wsi_h, m_wsi_v; - - emu_timer *m_timer; - emu_timer *m_hblank_on_timer; - bitmap_ind16 *m_bitmap; - - virtual void draw(int line); - - void draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, int pal_base ); - void draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ); - TIMER_CALLBACK_MEMBER( hblank_on_timer_callback ); - TIMER_CALLBACK_MEMBER( timer_callback ); - -}; - - -class k2ge_device : public k1ge_device -{ -public: - k2ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_PALETTE_INIT(k2ge); -protected: - virtual machine_config_constructor device_mconfig_additions() const; - - virtual void draw(int line); - - void draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_base ); - void draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ); - void k1ge_draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_lut_base, UINT16 k2ge_lut_base ); - void k1ge_draw_sprite_plane( UINT16 *p, UINT16 priority, int line, int scroll_x, int scroll_y ); - -}; - -extern const device_type K1GE; -extern const device_type K2GE; - - -#endif diff --git a/src/mess/video/kaypro.c b/src/mess/video/kaypro.c deleted file mode 100644 index d9e6d10340b..00000000000 --- a/src/mess/video/kaypro.c +++ /dev/null @@ -1,312 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert - -#include "includes/kaypro.h" - - - -/*********************************************************** - - Video - -************************************************************/ - -PALETTE_INIT_MEMBER(kaypro_state,kaypro) -{ - palette.set_pen_color(0, rgb_t::black); /* black */ - palette.set_pen_color(1, rgb_t(0, 220, 0)); /* green */ - palette.set_pen_color(2, rgb_t(0, 110, 0)); /* low intensity green */ -} - -UINT32 kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -/* The display consists of 80 columns and 24 rows. Each row is allocated 128 bytes of ram, - but only the first 80 are used. The total video ram therefore is 0x0c00 bytes. - There is one video attribute: bit 7 causes blinking. The first half of the - character generator is blank, with the visible characters in the 2nd half. - During the "off" period of blanking, the first half is used. Only 5 pixels are - connected from the rom to the shift register, the remaining pixels are held high. */ - - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - m_framecnt++; - - for (y = 0; y < 24; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 80; x++) - { - gfx = 0; - - if (ra < 8) - { - chr = m_p_videoram[x]^0x80; - - /* Take care of flashing characters */ - if ((chr < 0x80) && (m_framecnt & 0x08)) - chr |= 0x80; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | ra ]; - } - - /* Display a scanline of a character (7 pixels) */ - *p++ = 0; - *p++ = BIT( gfx, 4 ); - *p++ = BIT( gfx, 3 ); - *p++ = BIT( gfx, 2 ); - *p++ = BIT( gfx, 1 ); - *p++ = BIT( gfx, 0 ); - *p++ = 0; - } - } - ma+=128; - } - return 0; -} - -UINT32 kaypro_state::screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - m_framecnt++; - - for (y = 0; y < 24; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 80; x++) - { - gfx = 0; - - if (ra < 8) - { - chr = m_p_videoram[x]; - - /* Take care of flashing characters */ - if ((chr > 0x7f) && (m_framecnt & 0x08)) - chr |= 0x80; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | ra ]; - } - - /* Display a scanline of a character (7 pixels) */ - *p++ = BIT( gfx, 6 ); - *p++ = BIT( gfx, 5 ); - *p++ = BIT( gfx, 4 ); - *p++ = BIT( gfx, 3 ); - *p++ = BIT( gfx, 2 ); - *p++ = BIT( gfx, 1 ); - *p++ = BIT( gfx, 0 ); - } - } - ma+=128; - } - return 0; -} - -UINT32 kaypro_state::screen_update_kaypro2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_framecnt++; - m_crtc->screen_update(screen, bitmap, cliprect); - return 0; -} - -/* bit 6 of kaypro2x_system_port selects alternate characters (A12 on character generator rom). - The diagram specifies a 2732 with 28 pins, and more address pins. Possibly a 2764 or 27128. - Since our dump only goes up to A11, the alternate character set doesn't exist. - - 0000-07FF of videoram is memory-mapped characters; 0800-0FFF is equivalent attribute bytes. - d3 Underline - d2 blinking (at unknown rate) - d1 low intensity - d0 reverse video - - Not sure how the attributes interact, for example does an underline blink? */ - - -MC6845_UPDATE_ROW( kaypro_state::kaypro2x_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - UINT16 x; - UINT8 gfx,fg,bg; - - for (x = 0; x < x_count; x++) // for each character - { - UINT8 inv=0; - // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ - UINT16 mem = (ma + x) & 0x7ff; - UINT8 chr = m_p_videoram[mem]; - UINT8 attr = m_p_videoram[mem | 0x800]; - - if ((attr & 3) == 3) - { - fg = 0; - bg = 2; - } - else - if ((attr & 3) == 2) - { - fg = 2; - bg = 0; - } - else - if ((attr & 3) == 1) - { - fg = 0; - bg = 1; - } - else - { - fg = 1; - bg = 0; - } - - /* Take care of flashing characters */ - if ( (BIT(attr, 2)) & (BIT(m_framecnt, 3)) ) - fg = bg; - - /* process cursor */ - if (x == cursor_x) - inv ^= m_mc6845_cursor[ra]; - - /* get pattern of pixels for that character scanline */ - if ( (ra == 15) & (BIT(attr, 3)) ) /* underline */ - gfx = 0xff; - else - gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; - - /* Display a scanline of a character (8 pixels) */ - *p++ = palette[BIT( gfx, 7 ) ? fg : bg]; - *p++ = palette[BIT( gfx, 6 ) ? fg : bg]; - *p++ = palette[BIT( gfx, 5 ) ? fg : bg]; - *p++ = palette[BIT( gfx, 4 ) ? fg : bg]; - *p++ = palette[BIT( gfx, 3 ) ? fg : bg]; - *p++ = palette[BIT( gfx, 2 ) ? fg : bg]; - *p++ = palette[BIT( gfx, 1 ) ? fg : bg]; - *p++ = palette[BIT( gfx, 0 ) ? fg : bg]; - } -} - -/************************************* MC6845 SUPPORT ROUTINES ***************************************/ - -/* The 6845 can produce a variety of cursor shapes - all are emulated here - remove when mame fixed */ -void kaypro_state::mc6845_cursor_configure() -{ - UINT8 i,curs_type=0,r9,r10,r11; - - /* curs_type holds the general cursor shape to be created - 0 = no cursor - 1 = partial cursor (only shows on a block of scan lines) - 2 = full cursor - 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ - - for ( i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) m_mc6845_cursor[i] = 0; // prepare cursor by erasing old one - - r9 = m_mc6845_reg[9]; // number of scan lines - 1 - r10 = m_mc6845_reg[10] & 0x1f; // cursor start line = last 5 bits - r11 = m_mc6845_reg[11]+1; // cursor end line incremented to suit for-loops below - - /* decide the curs_type by examining the registers */ - if (r10 < r11) curs_type=1; // start less than end, show start to end - else - if (r10 == r11) curs_type=2; // if equal, show full cursor - else curs_type=3; // if start greater than end, it's a two-part cursor - - if ((r11 - 1) > r9) curs_type=2; // if end greater than scan-lines, show full cursor - if (r10 > r9) curs_type=0; // if start greater than scan-lines, then no cursor - if (r11 > 16) r11=16; // truncate 5-bit register to fit our 4-bit hardware - - /* create the new cursor */ - if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(m_mc6845_cursor);i++) m_mc6845_cursor[i]=0xff; // turn on full cursor - - if (curs_type == 1) for (i = r10;i < r11;i++) m_mc6845_cursor[i]=0xff; // for each line that should show, turn on that scan line - - if (curs_type == 3) for (i = r11; i < r10;i++) m_mc6845_cursor[i]=0; // now take a bite out of the middle -} - -/* Resize the screen within the limits of the hardware. Expand the image to fill the screen area. - Standard screen is 640 x 400 = 0x7d0 bytes. */ - -void kaypro_state::mc6845_screen_configure() -{ - UINT16 width = m_mc6845_reg[1]*8-1; // width in pixels - UINT16 height = m_mc6845_reg[6]*(m_mc6845_reg[9]+1)-1; // height in pixels - UINT16 bytes = m_mc6845_reg[1]*m_mc6845_reg[6]-1; // video ram needed -1 - - /* Resize the screen */ - if ((width < 640) && (height < 400) && (bytes < 0x800)) /* bounds checking to prevent an assert or violation */ - machine().first_screen()->set_visible_area(0, width, 0, height); -} - - -/**************************** I/O PORTS *****************************************************************/ - -READ8_MEMBER( kaypro_state::kaypro2x_status_r ) -{ -/* Need bit 7 high or computer hangs */ - - return 0x80 | m_crtc->register_r(space, 0); -} - -WRITE8_MEMBER( kaypro_state::kaypro2x_index_w ) -{ - m_mc6845_ind = data & 0x1f; - m_crtc->address_w( space, 0, data ); -} - -WRITE8_MEMBER( kaypro_state::kaypro2x_register_w ) -{ - static const UINT8 mcmask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0}; - - if (m_mc6845_ind < 16) - m_mc6845_reg[m_mc6845_ind] = data & mcmask[m_mc6845_ind]; /* save data in register */ - else - m_mc6845_reg[m_mc6845_ind] = data; - - m_crtc->register_w( space, 0, data ); - - if ((m_mc6845_ind == 1) || (m_mc6845_ind == 6) || (m_mc6845_ind == 9)) - mc6845_screen_configure(); /* adjust screen size */ - - if ((m_mc6845_ind > 8) && (m_mc6845_ind < 12)) - mc6845_cursor_configure(); /* adjust cursor shape - remove when mame fixed */ - - if ((m_mc6845_ind > 17) && (m_mc6845_ind < 20)) - m_mc6845_video_address = m_mc6845_reg[19] | ((m_mc6845_reg[18] & 0x3f) << 8); /* internal ULA address */ -} - -READ8_MEMBER( kaypro_state::kaypro_videoram_r ) -{ - return m_p_videoram[offset]; -} - -WRITE8_MEMBER( kaypro_state::kaypro_videoram_w ) -{ - m_p_videoram[offset] = data; -} - -READ8_MEMBER( kaypro_state::kaypro2x_videoram_r ) -{ - return m_p_videoram[m_mc6845_video_address]; -} - -WRITE8_MEMBER( kaypro_state::kaypro2x_videoram_w ) -{ - m_p_videoram[m_mc6845_video_address] = data; -} - -VIDEO_START_MEMBER(kaypro_state,kaypro) -{ - m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion("roms")->base()+0x3000; -} diff --git a/src/mess/video/kc.c b/src/mess/video/kc.c deleted file mode 100644 index 9a9dcbce29b..00000000000 --- a/src/mess/video/kc.c +++ /dev/null @@ -1,240 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/*************************************************************************** - - kc.c - - Functions to emulate the video hardware of the kc85/4,kc85/3 - -***************************************************************************/ - -#include "emu.h" -#include "includes/kc.h" - -// 3 bit colour value. bit 2->green, bit 1->red, bit 0->blue -static const UINT8 kc85_palette[KC85_PALETTE_SIZE * 3] = -{ - // foreground colours, "full" of each component - 0x00, 0x00, 0x00, // black - 0x00, 0x00, 0xd0, // blue - 0xd0, 0x00, 0x00, // red - 0xd0, 0x00, 0xd0, // magenta - 0x00, 0xd0, 0x00, // green - 0x00, 0xd0, 0xd0, // cyan - 0xd0, 0xd0, 0x00, // yellow - 0xd0, 0xd0, 0xd0, // white - - // full of each component + half of another component - 0x00, 0x00, 0x00, // black - 0x60, 0x00, 0xa0, // violet - 0xa0, 0x60, 0x00, // brown - 0xa0, 0x00, 0x60, // red/purple - 0x00, 0xa0, 0x60, // pastel green - 0x00, 0x60, 0xa0, // sky blue - 0xa0, 0xa0, 0x60, // yellow/green - 0xd0, 0xd0, 0xd0, // white - - // background colours are slightly darker than foreground colours - 0x00, 0x00, 0x00, // black - 0x00, 0x00, 0xa0, // dark blue - 0xa0, 0x00, 0x00, // dark red - 0xa0, 0x00, 0xa0, // dark magenta - 0x00, 0xa0, 0x00, // dark green - 0x00, 0xa0, 0xa0, // dark cyan - 0xa0, 0xa0, 0x00, // dark yellow - 0xa0, 0xa0, 0xa0 // dark white (grey) -}; - - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(kc_state,kc85) -{ - for (int i = 0; i < sizeof(kc85_palette) / 3; i++ ) - palette.set_pen_color(i, kc85_palette[i*3], kc85_palette[i*3+1], kc85_palette[i*3+2]); -} - -/* set new blink state */ -WRITE_LINE_MEMBER( kc_state::video_toggle_blink_state ) -{ - if (state) - { - machine().first_screen()->update_partial(machine().first_screen()->vpos()); - - m_kc85_blink_state = !m_kc85_blink_state; - } -} - - -/* draw 8 pixels */ -void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, UINT8 colour_byte, UINT8 gfx_byte) -{ - int pens[4]; - int px; - - if (m_high_resolution) - { - /* High resolution: 4 colors for block */ - - pens[0] = 0; // black - pens[1] = 2; // red - pens[2] = 5; // cyan - pens[3] = 7; // white - - px = x; - - for (int a=0; a<8; a++) - { - int pen = pens[((gfx_byte>>7) & 0x07) | ((colour_byte>>6) & 0x02)]; - - if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) - { - bitmap.pix16(y, px) = pen; - } - - px++; - colour_byte <<= 1; - gfx_byte <<= 1; - } - } - else - { - /* Low resolution: 2 colors for block */ - /* 16 foreground colours, 8 background colours */ - - /* bit 7 = 1: flash between foreground and background colour 0: no flash */ - /* bit 6: adjusts foreground colours by adding half of another component */ - /* bit 5,4,3 = foreground colour */ - /* bit 5: background colour -> Green */ - /* bit 4: background colour -> Red */ - /* bit 3: background colour -> Blue */ - /* bit 2,1,0 = background colour */ - /* bit 2: background colour -> Green */ - /* bit 1: background colour -> Red */ - /* bit 0: background colour -> Blue */ - - int background_pen = (colour_byte&7) + 16; - int foreground_pen = ((colour_byte>>3) & 0x0f); - - if ((colour_byte & 0x80) && m_kc85_blink_state && (m_pio_data[1] & 0x80)) - { - foreground_pen = background_pen; - } - - pens[0] = background_pen; - pens[1] = foreground_pen; - - px = x; - - for (int a=0; a<8; a++) - { - int pen = pens[(gfx_byte>>7) & 0x01]; - - if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) - { - bitmap.pix16(y, px) = pen; - } - px++; - gfx_byte = gfx_byte<<1; - } - } -} - - -/*************************************************************************** - KC85/4 video hardware -***************************************************************************/ - -void kc85_4_state::video_start() -{ - m_video_ram = machine().memory().region_alloc("videoram", (KC85_4_SCREEN_COLOUR_RAM_SIZE*2) + (KC85_4_SCREEN_PIXEL_RAM_SIZE*2), 1, ENDIANNESS_LITTLE)->base(); - memset(m_video_ram, 0, (KC85_4_SCREEN_COLOUR_RAM_SIZE*2) + (KC85_4_SCREEN_PIXEL_RAM_SIZE*2)); - m_display_video_ram = m_video_ram; - - m_kc85_blink_state = 0; -} - -void kc85_4_state::video_control_w(int data) -{ - /* calculate address of video ram to display */ - if (data & 1) - m_display_video_ram = m_video_ram + (KC85_4_SCREEN_PIXEL_RAM_SIZE + KC85_4_SCREEN_COLOUR_RAM_SIZE); - else - m_display_video_ram = m_video_ram; - - m_high_resolution = (data & 0x08) ? 0 : 1; -} - - -UINT32 kc85_4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *pixel_ram = m_display_video_ram; - UINT8 *colour_ram = pixel_ram + 0x04000; - - for (int y=cliprect.min_y; y<=cliprect.max_y; y++) - { - for (int x=0; x<(KC85_SCREEN_WIDTH>>3); x++) - { - UINT16 offset = y | (x<<8); - - UINT8 colour_byte = colour_ram[offset]; - UINT8 gfx_byte = pixel_ram[offset]; - - video_draw_8_pixels(bitmap, (x<<3), y, colour_byte, gfx_byte); - } - } - - return 0; -} - -/*************************************************************************** - KC85/3 video -***************************************************************************/ - -void kc_state::video_start() -{ - m_video_ram = machine().memory().region_alloc("videoram", 0x4000, 1, ENDIANNESS_LITTLE)->base(); - memset(m_video_ram, 0, 0x4000); - - m_kc85_blink_state = 0; -} - -UINT32 kc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* colour ram takes up 0x02800 bytes */ - UINT8 *pixel_ram = m_video_ram; - UINT8 *colour_ram = m_video_ram + 0x02800; - - for (int y=cliprect.min_y; y<=cliprect.max_y; y++) - { - for (int x=0; x<(KC85_SCREEN_WIDTH>>3); x++) - { - int pixel_offset,colour_offset; - - if ((x & 0x020)==0) - { - pixel_offset = (x & 0x01f) | (((y>>2) & 0x03)<<5) | - ((y & 0x03)<<7) | (((y>>4) & 0x0f)<<9); - - colour_offset = (x & 0x01f) | (((y>>2) & 0x03f)<<5); - } - else - { - /* 1 0 1 0 0 V7 V6 V1 V0 V3 V2 V5 V4 H2 H1 H0 */ - /* 1 0 1 1 0 0 0 V7 V6 V3 V2 V5 V4 H2 H1 H0 */ - - pixel_offset = 0x02000+((x & 0x07) | (((y>>4) & 0x03)<<3) | - (((y>>2) & 0x03)<<5) | ((y & 0x03)<<7) | ((y>>6) & 0x03)<<9); - - colour_offset = 0x0800+((x & 0x07) | (((y>>4) & 0x03)<<3) | - (((y>>2) & 0x03)<<5) | ((y>>6) & 0x03)<<7); - } - - UINT8 colour_byte = colour_ram[colour_offset]; - UINT8 gfx_byte = pixel_ram[pixel_offset]; - - video_draw_8_pixels(bitmap,(x<<3),y, colour_byte, gfx_byte); - } - } - - return 0; -} diff --git a/src/mess/video/kramermc.c b/src/mess/video/kramermc.c deleted file mode 100644 index a5609e8259f..00000000000 --- a/src/mess/video/kramermc.c +++ /dev/null @@ -1,46 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Kramer MC video driver by Miodrag Milanovic - - 13/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/kramermc.h" - -#define KRAMERMC_VIDEO_MEMORY 0xFC00 - -const gfx_layout kramermc_charlayout = -{ - 8, 8, /* 8x8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {0, 1, 2, 3, 4, 5, 6, 7}, - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, - 8*8 /* size of one char */ -}; - -void kramermc_state::video_start() -{ -} - -UINT32 kramermc_state::screen_update_kramermc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - address_space &space = m_maincpu->space(AS_PROGRAM); - - for(y = 0; y < 16; y++ ) - { - for(x = 0; x < 64; x++ ) - { - int code = space.read_byte(KRAMERMC_VIDEO_MEMORY + x + y*64); - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*8); - } - } - return 0; -} diff --git a/src/mess/video/kyocera.c b/src/mess/video/kyocera.c deleted file mode 100644 index 34c3d60f95d..00000000000 --- a/src/mess/video/kyocera.c +++ /dev/null @@ -1,89 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "includes/kyocera.h" - -PALETTE_INIT_MEMBER(kc85_state,kc85) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -PALETTE_INIT_MEMBER(tandy200_state,tandy200) -{ - palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); -} - -UINT32 kc85_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_lcdc0->screen_update(screen, bitmap, cliprect); - m_lcdc1->screen_update(screen, bitmap, cliprect); - m_lcdc2->screen_update(screen, bitmap, cliprect); - m_lcdc3->screen_update(screen, bitmap, cliprect); - m_lcdc4->screen_update(screen, bitmap, cliprect); - m_lcdc5->screen_update(screen, bitmap, cliprect); - m_lcdc6->screen_update(screen, bitmap, cliprect); - m_lcdc7->screen_update(screen, bitmap, cliprect); - m_lcdc8->screen_update(screen, bitmap, cliprect); - m_lcdc9->screen_update(screen, bitmap, cliprect); - - return 0; -} - -UINT32 tandy200_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_lcdc->screen_update(screen, bitmap, cliprect); - - return 0; -} - -static ADDRESS_MAP_START( tandy200_lcdc, AS_0, 8, tandy200_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1fff) - AM_RANGE(0x0000, 0x1fff) AM_RAM -ADDRESS_MAP_END - -MACHINE_CONFIG_FRAGMENT( kc85_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(44) - MCFG_SCREEN_UPDATE_DRIVER(kc85_state, screen_update) - MCFG_SCREEN_SIZE(240, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(kc85_state,kc85) - - MCFG_HD44102_ADD(HD44102_0_TAG, SCREEN_TAG, 0, 0) - MCFG_HD44102_ADD(HD44102_1_TAG, SCREEN_TAG, 50, 0) - MCFG_HD44102_ADD(HD44102_2_TAG, SCREEN_TAG, 100, 0) - MCFG_HD44102_ADD(HD44102_3_TAG, SCREEN_TAG, 150, 0) - MCFG_HD44102_ADD(HD44102_4_TAG, SCREEN_TAG, 200, 0) - MCFG_HD44102_ADD(HD44102_5_TAG, SCREEN_TAG, 0, 32) - MCFG_HD44102_ADD(HD44102_6_TAG, SCREEN_TAG, 50, 32) - MCFG_HD44102_ADD(HD44102_7_TAG, SCREEN_TAG, 100, 32) - MCFG_HD44102_ADD(HD44102_8_TAG, SCREEN_TAG, 150, 32) - MCFG_HD44102_ADD(HD44102_9_TAG, SCREEN_TAG, 200, 32) - -// MCFG_HD44103_MASTER_ADD("m11", SCREEN_TAG, CAP_P(18), RES_K(100), HD44103_FS_HIGH, HD44103_DUTY_1_32) -// MCFG_HD44103_SLAVE_ADD( "m12", "m11", SCREEN_TAG, HD44103_FS_HIGH, HD44103_DUTY_1_32) -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( tandy200_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(80) - MCFG_SCREEN_UPDATE_DRIVER(tandy200_state, screen_update) - MCFG_SCREEN_SIZE(240, 128) - MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 128-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEFAULT_LAYOUT(layout_lcd) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(tandy200_state,tandy200) - - MCFG_DEVICE_ADD(HD61830_TAG, HD61830, XTAL_4_9152MHz/2/2) - MCFG_DEVICE_ADDRESS_MAP(AS_0, tandy200_lcdc) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) -MACHINE_CONFIG_END diff --git a/src/mess/video/llc.c b/src/mess/video/llc.c deleted file mode 100644 index dd9ba725500..00000000000 --- a/src/mess/video/llc.c +++ /dev/null @@ -1,96 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic, Robbbert -/*************************************************************************** - - LLC driver by Miodrag Milanovic - - 17/04/2009 Preliminary driver. - -****************************************************************************/ - - -#include "includes/llc.h" - - -void llc_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 llc_state::screen_update_llc1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,inv; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x++) - { - inv = (m_p_videoram[x] & 0x80) ? 0xff : 0; - chr = m_p_videoram[x] & 0x7f; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ chr | (ra << 7) ] ^ inv; - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} - -UINT32 llc_state::screen_update_llc2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,inv, inv1=m_rv ? 0xff : 0; - UINT16 sy=0,ma=0,x; - - for (y = 0; y < 32; y++) - { - for (ra = 0; ra < 8; ra++) - { - inv = 0; - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x++) - { - chr = m_p_videoram[x]; - if (chr==0x11) // inverse on - { - inv=0xff; - chr=0x0f; // must not show - } - else - if (chr==0x10) // inverse off - inv=0; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ (chr << 3) | ra ] ^ inv ^ inv1; - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} diff --git a/src/mess/video/lviv.c b/src/mess/video/lviv.c deleted file mode 100644 index affc58516f0..00000000000 --- a/src/mess/video/lviv.c +++ /dev/null @@ -1,91 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/*************************************************************************** - - lviv.c - - Functions to emulate the video hardware of PK-01 Lviv. - - Krzysztof Strzecha - -***************************************************************************/ - -#include "emu.h" -#include "includes/lviv.h" - -const unsigned char lviv_palette[8*3] = -{ - 0x00, 0x00, 0x00, - 0x00, 0x00, 0xa4, - 0x00, 0xa4, 0x00, - 0x00, 0xa4, 0xa4, - 0xa4, 0x00, 0x00, - 0xa4, 0x00, 0xa4, - 0xa4, 0xa4, 0x00, - 0xa4, 0xa4, 0xa4 -}; - - -PALETTE_INIT_MEMBER(lviv_state, lviv) -{ - int i; - - for ( i = 0; i < sizeof(lviv_palette) / 3; i++ ) { - m_palette->set_pen_color(i, lviv_palette[i*3], lviv_palette[i*3+1], lviv_palette[i*3+2]); - } -} - - -void lviv_state::lviv_update_palette(UINT8 pal) -{ - m_colortable[0][0] = 0; - m_colortable[0][1] = 0; - m_colortable[0][2] = 0; - m_colortable[0][3] = 0; - - m_colortable[0][0] |= (((pal>>3)&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; - m_colortable[0][0] |= ((pal>>5)&0x01) ? 0x02 : 0x00; - m_colortable[0][0] |= (((pal>>2)&0x01) == ((pal>>6)&0x01)) ? 0x01 : 0x00; - - m_colortable[0][1] |= ((pal&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; - m_colortable[0][1] |= ((pal>>5)&0x01) ? 0x02 : 0x00; - m_colortable[0][1] |= ((pal>>6)&0x01) ? 0x00 : 0x01; - - m_colortable[0][2] |= ((pal>>4)&0x01) ? 0x04 : 0x00; - m_colortable[0][2] |= ((pal>>5)&0x01) ? 0x00 : 0x02; - m_colortable[0][2] |= ((pal>>6)&0x01) ? 0x01 : 0x00; - - m_colortable[0][3] |= ((pal>>4)&0x01) ? 0x00 : 0x04; - m_colortable[0][3] |= (((pal>>1)&0x01) == ((pal>>5)&0x01)) ? 0x02 : 0x00; - m_colortable[0][3] |= ((pal>>6)&0x01) ? 0x01 : 0x00; -} - -void lviv_state::video_start() -{ -} - -UINT32 lviv_state::screen_update_lviv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - int pen; - UINT8 data; - - for (y=0; y<256; y++) - for (x=0; x<256; x+=4) - { - data = m_video_ram[y*64+x/4]; - - pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; - bitmap.pix16(y, x + 0) = pen; - - pen = m_colortable[0][((data & 0x04) >> 2) | ((data & 0x40) >> (2+3))]; - bitmap.pix16(y, x + 1) = pen; - - pen = m_colortable[0][((data & 0x02) >> 1) | ((data & 0x20) >> (1+3))]; - bitmap.pix16(y, x + 2) = pen; - - pen = m_colortable[0][((data & 0x01) >> 0) | ((data & 0x10) >> (0+3))]; - bitmap.pix16(y, x + 3) = pen; - } - return 0; -} diff --git a/src/mess/video/mac.c b/src/mess/video/mac.c deleted file mode 100644 index 289c62feb57..00000000000 --- a/src/mess/video/mac.c +++ /dev/null @@ -1,1257 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods, Raphael Nabet, R. Belmont -/*************************************************************************** - - video/mac.c - - Macintosh video hardware - - Emulates the video hardware for compact Macintosh series (original - Macintosh (128k, 512k, 512ke), Macintosh Plus, Macintosh SE, Macintosh - Classic) - - Also emulates on-board video for systems with the - RBV, V8, Eagle, Sonora, and DAFB chips. - - ---------------------------------------------------------------------- - Monitor sense codes - - Apple assigns 3 pins for monitor IDs. These allow 8 possible codes: - - 000 - color 2-Page Display (21") - 001 - monochrome Full Page display (15") - 010 - color 512x384 (12") - 011 - monochrome 2 Page display (21") - 100 - NTSC - 101 - color Full Page display (15") - 110 - High-Resolution Color (13" 640x480) or use "type 6" extended codes - 111 - No monitor connected or use "type 7" extended codes - - For extended codes, you drive one of the 3 pins at a time and read the 2 - undriven pins. See http://support.apple.com/kb/TA21618?viewlocale=en_US - for details. - -Extended codes: - - Sense 2 Low Sense 1 Low Sense 0 Low - 1 & 0 2 & 0 2 & 1 - -Multiple Scan 14" 00 00 11 -Multiple Scan 16" 00 10 11 -Multiple Scan 21" 10 00 11 -PAL Encoder 00 00 00 -NTSC Encoder 01 01 00 -VGA/Super VGA 01 01 11 -RGB 16" 10 11 01 -PAL Monitor 11 00 00 -RGB 19" 11 10 10 -Radius color TPD 11 00 01 (TPD = Two Page Display) -Radius mono TPD 11 01 00 -Apple TPD 11 01 01 -Apple color FPD 01 11 10 (FPD = Full Page Display) - -***************************************************************************/ - - -#include "emu.h" -#include "sound/asc.h" -#include "includes/mac.h" -#include "machine/ram.h" - -PALETTE_INIT_MEMBER(mac_state,mac) -{ - palette.set_pen_color(0, 0xff, 0xff, 0xff); - palette.set_pen_color(1, 0x00, 0x00, 0x00); -} - -// 4-level grayscale -PALETTE_INIT_MEMBER(mac_state,macgsc) -{ - palette.set_pen_color(0, 0xff, 0xff, 0xff); - palette.set_pen_color(1, 0x7f, 0x7f, 0x7f); - palette.set_pen_color(2, 0x3f, 0x3f, 0x3f); - palette.set_pen_color(3, 0x00, 0x00, 0x00); -} - -VIDEO_START_MEMBER(mac_state,mac) -{ -} - -#define MAC_MAIN_SCREEN_BUF_OFFSET 0x5900 -#define MAC_ALT_SCREEN_BUF_OFFSET 0xD900 - -UINT32 mac_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT32 video_base; - const UINT16 *video_ram; - UINT16 word; - UINT16 *line; - int y, x, b; - - video_base = m_ram->size() - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); - video_ram = (const UINT16 *) (m_ram->pointer() + video_base); - - for (y = 0; y < MAC_V_VIS; y++) - { - line = &bitmap.pix16(y); - - for (x = 0; x < MAC_H_VIS; x += 16) - { - word = *(video_ram++); - for (b = 0; b < 16; b++) - { - line[x + b] = (word >> (15 - b)) & 0x0001; - } - } - } - return 0; -} - -UINT32 mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT32 video_base; - const UINT16 *video_ram; - UINT16 word; - UINT16 *line; - int y, x, b; - - video_base = m_screen_buffer ? 0x8000 : 0; - video_base += (MAC_H_VIS/8); - video_ram = (const UINT16 *) &m_vram[video_base/4]; - - for (y = 0; y < MAC_V_VIS; y++) - { - line = &bitmap.pix16(y); - - for (x = 0; x < MAC_H_VIS; x += 16) - { - word = video_ram[((y * MAC_H_VIS)/16) + ((x/16)^1)]; - for (b = 0; b < 16; b++) - { - line[x + b] = (word >> (15 - b)) & 0x0001; - } - } - } - return 0; -} - -UINT32 mac_state::screen_update_macprtb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - const UINT16 *video_ram; - UINT16 word; - UINT16 *line; - int y, x, b; - - video_ram = (const UINT16 *) m_vram16.target(); - - for (y = 0; y < 400; y++) - { - line = &bitmap.pix16(y); - - for (x = 0; x < 640; x += 16) - { - word = video_ram[((y * 640)/16) + ((x/16))]; - for (b = 0; b < 16; b++) - { - line[x + b] = (word >> (15 - b)) & 0x0001; - } - } - } - return 0; -} - -UINT32 mac_state::screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - const UINT16 *video_ram; - UINT16 word; - UINT16 *line; - int y, x, b; - - video_ram = (const UINT16 *) m_vram.target(); - - for (y = 0; y < 400; y++) - { - line = &bitmap.pix16(y); - - for (x = 0; x < 640; x += 16) - { - word = video_ram[((y * 640)/16) + ((x/16)^1)]; - for (b = 0; b < 16; b++) - { - line[x + b] = (word >> (15 - b)) & 0x0001; - } - } - } - return 0; -} - -UINT32 mac_state::screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 *line; - int y, x; - UINT8 pixels; - UINT8 *vram8 = (UINT8 *)m_vram.target(); - - for (y = 0; y < 400; y++) - { - line = &bitmap.pix16(y); - - for (x = 0; x < 640/4; x++) - { - pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; - - *line++ = ((pixels>>6)&3); - *line++ = ((pixels>>4)&3); - *line++ = ((pixels>>2)&3); - *line++ = (pixels&3); - - } - } - return 0; -} - -// IIci/IIsi RAM-Based Video (RBV) and children: V8, Eagle, Spice, VASP, Sonora - -VIDEO_START_MEMBER(mac_state,macrbv) -{ -} - -VIDEO_RESET_MEMBER(mac_state,maceagle) -{ - m_rbv_montype = 32; - m_rbv_palette[0xfe] = 0xffffff; - m_rbv_palette[0xff] = 0; -} - -VIDEO_RESET_MEMBER(mac_state,macrbv) -{ - rectangle visarea; - int htotal, vtotal; - double framerate; - int view; - - memset(m_rbv_regs, 0, sizeof(m_rbv_regs)); - - m_rbv_count = 0; - m_rbv_clutoffs = 0; - m_rbv_immed10wr = 0; - - m_rbv_regs[2] = 0x7f; - m_rbv_regs[3] = 0; - - m_rbv_type = RBV_TYPE_RBV; - - visarea.min_x = 0; - visarea.min_y = 0; - view = 0; - if (m_montype) - { - m_rbv_montype = m_montype->read(); - } - else - { - m_rbv_montype = 2; - } - switch (m_rbv_montype) - { - case 1: // 15" portrait display - visarea.max_x = 640-1; - visarea.max_y = 870-1; - htotal = 832; - vtotal = 918; - framerate = 75.0; - view = 1; - break; - - case 2: // 12" RGB - visarea.max_x = 512-1; - visarea.max_y = 384-1; - htotal = 640; - vtotal = 407; - framerate = 60.15; - break; - - case 6: // 13" RGB - default: - visarea.max_x = 640-1; - visarea.max_y = 480-1; - htotal = 800; - vtotal = 525; - framerate = 59.94; - break; - } - -// printf("RBV reset: monitor is %dx%d @ %f Hz\n", visarea.max_x+1, visarea.max_y+1, framerate); - machine().first_screen()->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS(framerate)); - render_target *target = machine().render().first_target(); - target->set_view(view); -} - -VIDEO_RESET_MEMBER(mac_state,macsonora) -{ - rectangle visarea; - int htotal, vtotal; - double framerate; - int view = 0; - - memset(m_rbv_regs, 0, sizeof(m_rbv_regs)); - - m_rbv_count = 0; - m_rbv_clutoffs = 0; - m_rbv_immed10wr = 0; - - m_rbv_regs[2] = 0x7f; - m_rbv_regs[3] = 0; - - m_rbv_type = RBV_TYPE_SONORA; - - visarea.min_x = 0; - visarea.min_y = 0; - - m_rbv_montype = m_montype ? m_montype->read() : 2; - switch (m_rbv_montype) - { - case 1: // 15" portrait display - visarea.max_x = 640-1; - visarea.max_y = 870-1; - htotal = 832; - vtotal = 918; - framerate = 75.0; - view = 1; - break; - - case 2: // 12" RGB - visarea.max_x = 512-1; - visarea.max_y = 384-1; - htotal = 640; - vtotal = 407; - framerate = 60.15; - break; - - case 6: // 13" RGB - default: - visarea.max_x = 640-1; - visarea.max_y = 480-1; - htotal = 800; - vtotal = 525; - framerate = 59.94; - break; - } - -// printf("Sonora reset: monitor is %dx%d @ %f Hz\n", visarea.max_x+1, visarea.max_y+1, framerate); - machine().first_screen()->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS(framerate)); - render_target *target = machine().render().first_target(); - target->set_view(view); -} - -VIDEO_START_MEMBER(mac_state,macsonora) -{ - memset(m_rbv_regs, 0, sizeof(m_rbv_regs)); - - m_rbv_count = 0; - m_rbv_clutoffs = 0; - m_rbv_immed10wr = 0; - - m_rbv_regs[2] = 0x7f; - m_rbv_regs[3] = 0; - m_rbv_regs[4] = 0x6; - m_rbv_regs[5] = 0x3; - - m_sonora_vctl[0] = 0x9f; - m_sonora_vctl[1] = 0; - m_sonora_vctl[2] = 0; - - m_rbv_type = RBV_TYPE_SONORA; -} - -VIDEO_START_MEMBER(mac_state,macv8) -{ - memset(m_rbv_regs, 0, sizeof(m_rbv_regs)); - - m_rbv_count = 0; - m_rbv_clutoffs = 0; - m_rbv_immed10wr = 0; - - m_rbv_regs[0] = 0x4f; - m_rbv_regs[1] = 0x06; - m_rbv_regs[2] = 0x7f; - - m_rbv_type = RBV_TYPE_V8; -} - -UINT32 mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 *scanline; - int x, y, hres, vres; - UINT8 *vram8 = (UINT8 *)m_ram->pointer(); - - switch (m_rbv_montype) - { - case 32: // classic II built-in display - hres = MAC_H_VIS; - vres = MAC_V_VIS; - vram8 += 0x1f9a80; // Classic II apparently doesn't use VRAM? - break; - - case 1: // 15" portrait display - hres = 640; - vres = 870; - break; - - case 2: // 12" RGB - hres = 512; - vres = 384; - break; - - case 6: // 13" RGB - default: - hres = 640; - vres = 480; - break; - } - - switch (m_rbv_regs[0x10] & 7) - { - case 0: // 1bpp - { - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) - { - pixels = vram8[(y * (hres/8)) + ((x/8)^3)]; - - *scanline++ = m_rbv_palette[0xfe|(pixels>>7)]; - *scanline++ = m_rbv_palette[0xfe|((pixels>>6)&1)]; - *scanline++ = m_rbv_palette[0xfe|((pixels>>5)&1)]; - *scanline++ = m_rbv_palette[0xfe|((pixels>>4)&1)]; - *scanline++ = m_rbv_palette[0xfe|((pixels>>3)&1)]; - *scanline++ = m_rbv_palette[0xfe|((pixels>>2)&1)]; - *scanline++ = m_rbv_palette[0xfe|((pixels>>1)&1)]; - *scanline++ = m_rbv_palette[0xfe|(pixels&1)]; - } - } - } - break; - - case 1: // 2bpp - { - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) - { - pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; - *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; - *scanline++ = m_rbv_palette[0xfc|((pixels>>2)&3)]; - *scanline++ = m_rbv_palette[0xfc|(pixels&3)]; - } - } - } - break; - - case 2: // 4bpp - { - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres/2; x++) - { - pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; - *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; - } - } - } - break; - - case 3: // 8bpp - { - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) - { - pixels = vram8[(y * hres) + (BYTE4_XOR_BE(x))]; - *scanline++ = m_rbv_palette[pixels]; - } - } - } - } - - return 0; -} - -UINT32 mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 *scanline; - int x, y, hres, vres; - - switch (m_rbv_montype) - { - case 1: // 15" portrait display - hres = 640; - vres = 870; - break; - - case 2: // 12" RGB - hres = 512; - vres = 384; - break; - - case 6: // 13" RGB - default: - hres = 640; - vres = 480; - break; - } - - switch (m_rbv_regs[0x10] & 7) - { - case 0: // 1bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) - { - pixels = vram8[(y * 0x400) + ((x/8)^3)]; - - *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<2)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<3)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<4)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<5)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<6)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<7)&0x80)]; - } - } - } - break; - - case 1: // 2bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) - { - pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; - *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; - *scanline++ = m_rbv_palette[0xfc|((pixels>>2)&3)]; - *scanline++ = m_rbv_palette[0xfc|(pixels&3)]; - } - } - } - break; - - case 2: // 4bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres/2; x++) - { - pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; - *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; - } - } - } - break; - - case 3: // 8bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) - { - pixels = vram8[(y * 2048) + (BYTE4_XOR_BE(x))]; - *scanline++ = m_rbv_palette[pixels]; - } - } - } - } - - return 0; -} - -UINT32 mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 *scanline; - int x, y, hres, vres; - - switch (m_rbv_montype) - { - case 1: // 15" portrait display - hres = 640; - vres = 870; - break; - - case 2: // 12" RGB - hres = 512; - vres = 384; - break; - - case 6: // 13" RGB - default: - hres = 640; - vres = 480; - break; - } - - switch (m_rbv_regs[0x10] & 7) - { - case 0: // 1bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) - { - pixels = vram8[(y * 1024) + ((x/8)^3)]; - - *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<2)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<3)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<4)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<5)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<6)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<7)&0x80)]; - } - } - } - break; - - case 1: // 2bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) - { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; - *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; - *scanline++ = m_rbv_palette[0x3f|((pixels<<4)&0xc0)]; - *scanline++ = m_rbv_palette[0x3f|((pixels<<6)&0xc0)]; - } - } - } - break; - - case 2: // 4bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres/2; x++) - { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; - *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; - } - } - } - break; - - case 3: // 8bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) - { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; - *scanline++ = m_rbv_palette[pixels]; - } - } - } - break; - } - - return 0; -} - -UINT32 mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 *scanline; - int x, y, hres, vres, stride; - - switch (m_rbv_montype) - { - case 1: // 15" portrait display - stride = hres = 640; - vres = 870; - break; - - case 2: // 12" RGB - stride = hres = 512; - vres = 384; - break; - - case 6: // 13" RGB - default: - stride = hres = 640; - vres = 480; - break; - } - - // forced blank? - if (m_sonora_vctl[0] & 0x80) - { - return 0; - } - - switch (m_sonora_vctl[1] & 7) - { - case 0: // 1bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) - { - pixels = vram8[(y * (stride/8)) + ((x/8)^3)]; - - *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<2)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<3)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<4)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<5)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<6)&0x80)]; - *scanline++ = m_rbv_palette[0x7f|((pixels<<7)&0x80)]; - } - } - } - break; - - case 1: // 2bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) - { - pixels = vram8[(y * (stride/4)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; - *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; - *scanline++ = m_rbv_palette[0x3f|((pixels<<4)&0xc0)]; - *scanline++ = m_rbv_palette[0x3f|((pixels<<6)&0xc0)]; - } - } - } - break; - - case 2: // 4bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres/2; x++) - { - pixels = vram8[(y * (stride/2)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; - *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; - } - } - } - break; - - case 3: // 8bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) - { - pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; - *scanline++ = m_rbv_palette[pixels]; - } - } - } - break; - - case 4: // 16bpp - { - UINT16 *vram16 = (UINT16 *)m_vram.target(); - UINT16 pixels; - - for (y = 0; y < vres; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) - { - pixels = vram16[(y * stride) + (x^1)]; - *scanline++ = rgb_t(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3); - } - } - } - break; - } - - return 0; -} - -// DAFB: video for Quadra 700/900 - -void mac_state::dafb_recalc_ints() -{ - if (m_dafb_int_status != 0) - { - nubus_slot_interrupt(0xf, ASSERT_LINE); - } - else - { - nubus_slot_interrupt(0xf, CLEAR_LINE); - } -} - -TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick) -{ - m_dafb_int_status |= 1; - dafb_recalc_ints(); - - m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); -} - -TIMER_CALLBACK_MEMBER(mac_state::dafb_cursor_tick) -{ - m_dafb_int_status |= 4; - dafb_recalc_ints(); - - m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); -} - -VIDEO_START_MEMBER(mac_state,macdafb) -{ - m_vbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_vbl_tick),this)); - m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_cursor_tick),this)); - - m_vbl_timer->adjust(attotime::never); - m_cursor_timer->adjust(attotime::never); -} - -VIDEO_RESET_MEMBER(mac_state,macdafb) -{ - m_rbv_count = 0; - m_rbv_clutoffs = 0; - m_rbv_montype = 6; - m_rbv_vbltime = 0; - m_dafb_int_status = 0; - m_rbv_type = RBV_TYPE_DAFB; - m_dafb_mode = 0; - m_dafb_base = 0x1000; - m_dafb_stride = 256*4; - - memset(m_rbv_palette, 0, sizeof(m_rbv_palette)); -} - -READ32_MEMBER(mac_state::dafb_r) -{ -// if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc()); - - switch (offset<<2) - { - case 0x1c: // inverse of monitor sense - return 7; // 21" color 2-page - - case 0x24: // SCSI 539x #1 status - return m_dafb_scsi1_drq<<9; - - case 0x28: // SCSI 539x #2 status - return m_dafb_scsi2_drq<<9; - - case 0x108: // IRQ/VBL status - return m_dafb_int_status; - - case 0x10c: // clear cursor scanline int - m_dafb_int_status &= ~4; - dafb_recalc_ints(); - break; - - case 0x114: // clear VBL int - m_dafb_int_status &= ~1; - dafb_recalc_ints(); - break; - } - return 0; -} - -WRITE32_MEMBER(mac_state::dafb_w) -{ -// if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc()); - - switch (offset<<2) - { - case 0: // bits 20-9 of base - m_dafb_base &= 0x1ff; - m_dafb_base |= (data & 0xffff) << 9; -// printf("DAFB baseH: %x\n", m_dafb_base); - break; - - case 4: // bits 8-5 of base - m_dafb_base &= ~0x1ff; - m_dafb_base |= (data & 0xf) << 5; -// printf("DAFB baseL: %x\n", m_dafb_base); - break; - - case 8: - m_dafb_stride = data<<2; // stride in DWORDs -// printf("DAFB stride: %x %x\n", m_dafb_stride, data); - break; - - case 0x104: - if (data & 1) // VBL enable - { - m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); - } - else - { - m_vbl_timer->adjust(attotime::never); - m_dafb_int_status &= ~1; - dafb_recalc_ints(); - } - - if (data & 2) // aux scanline interrupt enable - { - fatalerror("DAFB: Aux scanline interrupt enable not supported!\n"); - } - - if (data & 4) // cursor scanline interrupt enable - { - m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); - } - else - { - m_cursor_timer->adjust(attotime::never); - m_dafb_int_status &= ~4; - dafb_recalc_ints(); - } - break; - - case 0x10c: // clear cursor scanline int - m_dafb_int_status &= ~4; - dafb_recalc_ints(); - break; - - case 0x114: // clear VBL int - m_dafb_int_status &= ~1; - dafb_recalc_ints(); - break; - } -} - -READ32_MEMBER(mac_state::dafb_dac_r) -{ -// printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc()); - - return 0; -} - -WRITE32_MEMBER(mac_state::dafb_dac_w) -{ -// if ((offset > 0) && (offset != 0x10/4)) printf("DAFB: Write %08x to DAC @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc()); - - switch (offset<<2) - { - case 0: - m_rbv_clutoffs = data & 0xff; - m_rbv_count = 0; - break; - - case 0x10: - m_rbv_colors[m_rbv_count++] = data&0xff; - - if (m_rbv_count == 3) - { - m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2])); - m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); - m_rbv_clutoffs++; - m_rbv_count = 0; - } - break; - - case 0x20: - printf("%x to DAFB mode\n", data); - switch (data & 0x9f) - { - case 0x80: - m_dafb_mode = 0; // 1bpp - break; - - case 0x88: - m_dafb_mode = 1; // 2bpp - break; - - case 0x90: - m_dafb_mode = 2; // 4bpp - break; - - case 0x98: - m_dafb_mode = 3; // 8bpp - break; - - case 0x9c: - m_dafb_mode = 4; // 24bpp - break; - } - break; - } -} - -UINT32 mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT32 *scanline; - int x, y; - - switch (m_dafb_mode) - { - case 0: // 1bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - vram8 += m_dafb_base; - - for (y = 0; y < 870; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152; x+=8) - { - pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)]; - - *scanline++ = m_rbv_palette[(pixels>>7)&1]; - *scanline++ = m_rbv_palette[(pixels>>6)&1]; - *scanline++ = m_rbv_palette[(pixels>>5)&1]; - *scanline++ = m_rbv_palette[(pixels>>4)&1]; - *scanline++ = m_rbv_palette[(pixels>>3)&1]; - *scanline++ = m_rbv_palette[(pixels>>2)&1]; - *scanline++ = m_rbv_palette[(pixels>>1)&1]; - *scanline++ = m_rbv_palette[(pixels&1)]; - } - } - } - break; - - case 1: // 2bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - vram8 += m_dafb_base; - - for (y = 0; y < 870; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/4; x++) - { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[((pixels>>6)&3)]; - *scanline++ = m_rbv_palette[((pixels>>4)&3)]; - *scanline++ = m_rbv_palette[((pixels>>2)&3)]; - *scanline++ = m_rbv_palette[(pixels&3)]; - } - } - } - break; - - case 2: // 4bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - vram8 += m_dafb_base; - - for (y = 0; y < 870; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152/2; x++) - { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[(pixels>>4)]; - *scanline++ = m_rbv_palette[(pixels&0xf)]; - } - } - } - break; - - case 3: // 8bpp - { - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - vram8 += m_dafb_base; - - for (y = 0; y < 870; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152; x++) - { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; - *scanline++ = m_rbv_palette[pixels]; - } - } - } - break; - - case 4: // 24 bpp - for (y = 0; y < 480; y++) - { - UINT32 *base; - - scanline = &bitmap.pix32(y); - base = (UINT32 *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } - } - break; - } - - return 0; -} - -UINT32 mac_state::screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)/* Color PowerBooks using an off-the-shelf WD video chipset */ -{ - UINT32 *scanline; - int x, y; - UINT8 *vram8 = (UINT8 *)m_vram.target(); - UINT8 pixels; - -// vram8 += 0x40000; - - for (y = 0; y < 480; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640; x++) - { - pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; - *scanline++ = m_rbv_palette[pixels]; - } - } - - return 0; -} - -READ32_MEMBER(mac_state::macwd_r) -{ - switch (offset) - { - case 0xf6: - if (m_screen->vblank()) - { - return 0xffffffff; - } - else - { - return 0; - } - - default: -// printf("macwd_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, m_maincpu->pc()); - break; - } - return 0; -} - -WRITE32_MEMBER(mac_state::macwd_w) -{ - switch (offset) - { - case 0xf2: - if (mem_mask == 0xff000000) // DAC control - { - m_rbv_clutoffs = data>>24; - m_rbv_count = 0; - } - else if (mem_mask == 0x00ff0000) // DAC data - { - m_rbv_colors[m_rbv_count++] = (data>>16)&0xff; - if (m_rbv_count == 3) - { -// printf("RAMDAC: color %d = %02x %02x %02x\n", m_rbv_clutoffs, m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); - m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); - m_rbv_clutoffs++; - m_rbv_count = 0; - } - } - else - { - printf("macwd: Unknown DAC write, data %08x, mask %08x\n", data, mem_mask); - } - break; - - default: -// printf("macwd_w: %x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, m_maincpu->pc()); - break; - } -} diff --git a/src/mess/video/maria.c b/src/mess/video/maria.c deleted file mode 100644 index b2514770e82..00000000000 --- a/src/mess/video/maria.c +++ /dev/null @@ -1,484 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Dan Boris, Fabio Priuli, Mike Saarna, Robert Tuccitto -/*************************************************************************** - - Atari MARIA video emulation - - - - some history: - 2014-12-01 Mike Saarna, Robert Tuccitto Implemented "colorburst kill" bit - of the MARIA CTRL register. - 2014-10-05 Mike Saarna, Robert Tuccitto Last Line DMA value corrected - to 6. GCC and Atari docs both show a difference between - Other Line and Last Line as +6 at the lowest part of the - range. - Blank scanlines are drawn when DMA is off, like real - hardware. - If MARIA hits the DMA limit, the CPU doesn't run until - the next scanline. - - 2014-09-03 Mike Saarna, Robert Tuccitto reorganized DMA penalties to - support new rendering timeout code. - - 2014-08-29 Mike Saarna Timeout rendering added. - - 2014-08-26 Fabio Priuli Converted to device - - 2014-05-06 Mike Saarna Added interrupts to DMA cycle eating. Updates to - LL, OL, and spin accounting for HALT behavior. - - 2014-03-24 Mike Saarna Fixed DMA regarding startup, shutdown and - cycle stealing. - - 2013-05-08 huygens rewrite to emulate line ram buffers (mostly fixes Kung-Fu Master - Started DMA cycle stealing implementation - - 2003-06-23 ericball Kangaroo mode & 320 mode & other stuff - - 2002-05-14 kubecj vblank dma stop fix - - 2002-05-13 kubecj fixed 320C mode (displayed 2 pixels instead of one!) - noticed that Jinks uses 0x02-320D mode - implemented the mode - completely unsure if good! - implemented some Maria CTRL variables - - 2002-05-12 kubecj added cases for 0x01-160A, 0x05-160B as stated by docs - -***************************************************************************/ - -#include "emu.h" -#include "maria.h" - - -#define TRIGGER_HSYNC 64717 - -#define READ_MEM(x) space.read_byte(x) - -const device_type ATARI_MARIA = &device_creator; - - - -atari_maria_device::atari_maria_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ATARI_MARIA, "Atari MARIA", tag, owner, clock, "atari_maria", __FILE__) -{ -} - - -void atari_maria_device::device_start() -{ - m_cpu = machine().device(m_cpu_tag); - m_screen = machine().first_screen(); - m_screen->register_screen_bitmap(m_bitmap); - - save_item(NAME(m_maria_palette)); - save_item(NAME(m_line_ram)); - save_item(NAME(m_active_buffer)); - save_item(NAME(m_write_mode)); - save_item(NAME(m_dll)); - save_item(NAME(m_dl)); - save_item(NAME(m_holey)); - save_item(NAME(m_offset)); - save_item(NAME(m_vblank)); - save_item(NAME(m_dmaon)); - save_item(NAME(m_dpp)); - save_item(NAME(m_wsync)); - save_item(NAME(m_color_kill)); - save_item(NAME(m_cwidth)); - save_item(NAME(m_bcntl)); - save_item(NAME(m_kangaroo)); - save_item(NAME(m_rm)); - save_item(NAME(m_nmi)); - save_item(NAME(m_charbase)); -} - -void atari_maria_device::device_reset() -{ - for (int i = 0; i < 32; i++) - m_maria_palette[i] = 0; - - for (int i = 0; i < 2; i++) - for (int j = 0; j < 160; j++) - m_line_ram[i][j] = 0; - - m_active_buffer = 0; - - m_write_mode = 0; - m_dmaon = 0; - m_vblank = 0x80; - m_dll = 0; - m_wsync = 0; - - m_color_kill = 0; - m_cwidth = 0; - m_bcntl = 0; - m_kangaroo = 0; - m_rm = 0; - - m_dl = 0; - m_holey = 0; - m_offset = 0; - m_dpp = 0; - m_nmi = 0; - m_charbase = 0; -} - -/*************************************************************************** - - Stop the video hardware emulation. - -***************************************************************************/ - -int atari_maria_device::is_holey(unsigned int addr) -{ - if (((m_holey & 0x02) && ((addr & 0x9000) == 0x9000)) || ( (m_holey & 0x01) && ((addr & 0x8800) == 0x8800))) - return 1; - else - return 0; -} - -int atari_maria_device::write_line_ram(int addr, UINT8 offset, int pal) -{ - address_space& space = m_cpu->space(AS_PROGRAM); - int c; - - int data = READ_MEM(addr); - pal <<= 2; - - if (m_write_mode) - { - c = (pal & 0x10) | (data & 0x0c) | (data >> 6); // P2 D3 D2 D7 D6 - if (((c & 3) || m_kangaroo) && (offset < 160)) - m_line_ram[m_active_buffer][offset] = c; - offset++; - - c = (pal & 0x10) | ((data & 0x03) << 2) | ((data & 0x30) >> 4); // P2 D1 D0 D5 D4 - if (((c & 3) || m_kangaroo) && (offset < 160)) - m_line_ram[m_active_buffer][offset] = c; - } - else - { - for (int i = 0; i < 4; i++, offset++) - { - c = pal | ((data >> (6 - 2 * i)) & 0x03); - if (((c & 3) || m_kangaroo) && (offset < 160)) - m_line_ram[m_active_buffer][offset] = c; - } - } - return m_write_mode ? 2 : 4; -} - - -void atari_maria_device::draw_scanline() -{ - address_space& space = m_cpu->space(AS_PROGRAM); - UINT16 graph_adr, data_addr; - int width, pal, ind; - UINT8 hpos; - UINT16 dl; - int d, c, pixel_cell, cells; - int maria_cycles; - - cells = 0; - - if(m_dmaon) - { - // All lines in a zone have the same initial DMA startup time. We'll adjust - // cycles for the special last zone line later, as those penalties happen after - // MARIA is done rendering, or after its hit the maximum rendering time. - maria_cycles = 16; - - - /* Process this DLL entry */ - dl = m_dl; - - /* DMA */ - /* Step through DL's while we're within maximum rendering time. */ - /* max render time = ( scanline length - DMA start ) */ - /* 426 = ( 454 - 28 ) */ - - while (((READ_MEM(dl + 1) & 0x5f) != 0) && (maria_cycles<426)) - { - /* Extended header */ - if (!(READ_MEM(dl + 1) & 0x1f)) - { - graph_adr = (READ_MEM(dl + 2) << 8) | READ_MEM(dl); - width = ((READ_MEM(dl + 3) ^ 0xff) & 0x1f) + 1; - hpos = READ_MEM(dl + 4); - pal = READ_MEM(dl + 3) >> 5; - m_write_mode = (READ_MEM(dl + 1) & 0x80) >> 5; - ind = READ_MEM(dl + 1) & 0x20; - dl += 5; - maria_cycles += 10; - } - /* Normal header */ - else - { - graph_adr = (READ_MEM(dl + 2) << 8) | READ_MEM(dl); - width = ((READ_MEM(dl + 1) ^ 0xff) & 0x1f) + 1; - hpos = READ_MEM(dl + 3); - pal = READ_MEM(dl + 1) >> 5; - ind = 0x00; - dl += 4; - maria_cycles += 8; - } - - /*logerror("%x DL: ADR=%x width=%x hpos=%x pal=%x mode=%x ind=%x\n", m_screen->vpos(), graph_adr, width, hpos, pal, m_write_mode, ind);*/ - - for (int x = 0; x < width; x++) - { - if (maria_cycles >= 426) // ensure we haven't overrun the maximum render time - break; - - /* Do indirect mode */ - if (ind) - { - c = READ_MEM(graph_adr + x) & 0xff; - data_addr = (m_charbase | c) + (m_offset << 8); - if (is_holey(data_addr)) - continue; - - maria_cycles += 3; - if (m_cwidth) // two data bytes per map byte - { - cells = write_line_ram(data_addr, hpos, pal); - hpos += cells; - cells = write_line_ram(data_addr+1, hpos, pal); - hpos += cells; - maria_cycles += 6; - } - else - { - cells = write_line_ram(data_addr, hpos, pal); - hpos += cells; - maria_cycles += 3; - } - } - else // direct mode - { - data_addr = graph_adr + x + (m_offset << 8); - if (is_holey(data_addr)) - continue; - cells = write_line_ram(data_addr, hpos, pal); - hpos += cells; - maria_cycles += 3; - } - } - } - - // Last Line post-render DMA cycle penalties... - if (m_offset == 0) - { - maria_cycles += 6; // extra shutdown time - if (READ_MEM(m_dll + 3) & 0x80) - maria_cycles += 17; // interrupt overhead - } - - // If MARIA used up all of the DMA time then the CPU can't run until next line... - if (maria_cycles>=426) - { - m_cpu->spin_until_trigger(TRIGGER_HSYNC); - m_wsync = 1; - } - - // Spin the CPU for Maria DMA, if it's not already spinning for WSYNC. - // MARIA generates the 6502 clock by dividing its own clock by 4. It needs to HALT and unHALT - // the 6502 on ths same clock phase, so MARIA will wait until its clock divides evenly by 4. - // To spin until an even divisor, we just round-up any would-be truncations by adding 3. - if (!m_wsync) - m_cpu->spin_until_time(m_cpu->cycles_to_attotime((maria_cycles+3)/4)); - } - - // draw line buffer to screen - m_active_buffer = !m_active_buffer; // switch buffers - UINT16 *scanline; - scanline = &m_bitmap.pix16(m_screen->vpos()); - - - for (int i = 0; i < 160; i++) - { - switch (m_rm) - { - case 0x00: /* 160A, 160B */ - case 0x01: /* 160A, 160B */ - pixel_cell = m_line_ram[m_active_buffer][i]; - scanline[2 * i] = m_maria_palette[pixel_cell]; - scanline[2 * i + 1] = m_maria_palette[pixel_cell]; - break; - - case 0x02: /* 320B, 320D */ - pixel_cell = m_line_ram[m_active_buffer][i]; - d = (pixel_cell & 0x10) | (pixel_cell & 0x02) | ((pixel_cell >> 3) & 1); // b4 0 0 b1 b3 - scanline[2 * i] = m_maria_palette[d]; - d = (pixel_cell & 0x10) | ((pixel_cell << 1) & 0x02) | ((pixel_cell >> 2) & 1); // b4 0 0 b0 b2 - scanline[2 * i + 1] = m_maria_palette[d]; - break; - - case 0x03: /* 320A, 320C */ - pixel_cell = m_line_ram[m_active_buffer][i]; - d = (pixel_cell & 0x1c) | (pixel_cell & 0x02); // b4 b3 b2 b1 0 - scanline[2 * i] = m_maria_palette[d]; - d = (pixel_cell & 0x1c) | ((pixel_cell << 1) & 0x02); // b4 b3 b2 b0 0 - scanline[2 * i + 1] = m_maria_palette[d]; - break; - } - - if(m_color_kill) //remove color if there's no colorburst signal - { - scanline[2 * i] &= 0x0f; - scanline[2 * i + 1] &= 0x0f; - } - } - - for (int i = 0; i < 160; i++) // buffer automaticaly cleared once displayed - m_line_ram[m_active_buffer][i] = 0; -} - - -void atari_maria_device::interrupt(int lines) -{ - if (m_wsync) - { - machine().scheduler().trigger(TRIGGER_HSYNC); - m_wsync = 0; - } - - int frame_scanline = m_screen->vpos() % (lines + 1); - if (frame_scanline == 16) - m_vblank = 0x00; - - if (frame_scanline == (lines - 5)) - m_vblank = 0x80; -} - - -void atari_maria_device::startdma(int lines) -{ - address_space& space = m_cpu->space(AS_PROGRAM); - int maria_scanline = m_screen->vpos(); - int frame_scanline = maria_scanline % (lines + 1); - - if ((frame_scanline == 16) && m_dmaon) - { - /* end of vblank */ - m_dll = m_dpp; // currently only handle changes to dll during vblank - m_dl = (READ_MEM(m_dll + 1) << 8) | READ_MEM(m_dll+2); - m_offset = READ_MEM(m_dll) & 0x0f; - m_holey = (READ_MEM(m_dll) & 0x60) >> 5; - m_nmi = READ_MEM(m_dll) & 0x80; - /* logerror("DLL=%x\n",m_dll); */ - } - - if ((frame_scanline > 15) && (frame_scanline < (lines - 5))) - draw_scanline(); - - if ((frame_scanline > 16) && (frame_scanline < (lines - 5)) && m_dmaon) - { - if (m_offset == 0) - { - m_dll += 3; - m_dl = (READ_MEM(m_dll + 1) << 8) | READ_MEM(m_dll + 2); - m_offset = READ_MEM(m_dll) & 0x0f; - m_holey = (READ_MEM(m_dll) & 0x60) >> 5; - if (READ_MEM(m_dll & 0x10)) - logerror("dll bit 5 set!\n"); - m_nmi = READ_MEM(m_dll) & 0x80; - } - else - { - m_offset--; - } - } - - if (m_nmi) - { - m_cpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - m_nmi = 0; - } -} - -/*************************************************************************** - - Refresh the video screen - -***************************************************************************/ - -/* This routine is called at the start of vblank to refresh the screen */ -UINT32 atari_maria_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - - -READ8_MEMBER(atari_maria_device::read) -{ - switch (offset) - { - case 0x08: - return m_vblank; - - default: - logerror("undefined MARIA read %x\n",offset); - return 0x00; // don't know if this should be 0x00 or 0xff - } -} - -WRITE8_MEMBER(atari_maria_device::write) -{ - if ((offset & 3) != 0) - m_maria_palette[offset] = data; - - switch (offset) - { - case 0x00: - // all color ram addresses with 00 for their least significant bits point to the background color - for (int i = 0; i < 8; i++) - m_maria_palette[4 * i] = data; - break; - case 0x04: - m_cpu->spin_until_trigger(TRIGGER_HSYNC); - m_wsync = 1; - break; - case 0x0C: // DPPH - m_dpp = (m_dpp & 0x00ff) | (data << 8); - break; - case 0x10: // DPPL - m_dpp = (m_dpp & 0xff00) | data; - break; - case 0x14: - m_charbase = (data << 8); - break; - case 0x1C: - /*logerror("MARIA CTRL=%x\n",data);*/ - m_color_kill = data & 0x80; - switch ((data >> 5) & 3) - { - case 0x00: - case 01: - logerror("dma test mode, do not use.\n"); - break; - - case 0x02: - m_dmaon = 1; - break; - - case 0x03: - m_dmaon = 0; - break; - } - m_cwidth = data & 0x10; - m_bcntl = data & 0x08; // Currently unimplemented as we don't display the border - m_kangaroo = data & 0x04; - m_rm = data & 0x03; - - /*logerror( "MARIA CTRL: CK:%d DMA:%d CW:%d BC:%d KM:%d RM:%d\n", - m_color_kill ? 1 : 0, - (data & 0x60) >> 5, - m_cwidth ? 1 : 0, - m_bcntl ? 1 : 0, - m_kangaroo ? 1 : 0, - m_rm );*/ - - break; - } -} diff --git a/src/mess/video/maria.h b/src/mess/video/maria.h deleted file mode 100644 index 8e91354cb06..00000000000 --- a/src/mess/video/maria.h +++ /dev/null @@ -1,72 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Dan Boris -#ifndef __ATARI_MARIA__ -#define __ATARI_MARIA__ - -#include "emu.h" - -// ======================> atari_maria_device - -class atari_maria_device : public device_t -{ -public: - // construction/destruction - atari_maria_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - static void set_cpu_tag(device_t &device, const char *tag) { downcast(device).m_cpu_tag = tag; } - - void interrupt(int lines); - void startdma(int lines); - - DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - - int m_maria_palette[32]; - int m_line_ram[2][160]; - int m_active_buffer; - int m_write_mode; - unsigned int m_dll; - unsigned int m_dl; - int m_holey; - int m_offset; - int m_vblank; - int m_dmaon; - int m_dpp; - int m_wsync; - int m_color_kill; - int m_cwidth; - int m_bcntl; - int m_kangaroo; - int m_rm; - int m_nmi; - unsigned int m_charbase; - bitmap_ind16 m_bitmap; - - void draw_scanline(); - int is_holey(unsigned int addr); - int write_line_ram(int addr, UINT8 offset, int pal); - - const char *m_cpu_tag; - cpu_device *m_cpu; // CPU whose space(AS_PROGRAM) serves as DMA source - screen_device *m_screen; -}; - - -// device type definition -extern const device_type ATARI_MARIA; - - -#define MCFG_MARIA_DMACPU(_tag) \ - atari_maria_device::set_cpu_tag(*device, _tag); - - -#endif diff --git a/src/mess/video/mbc55x.c b/src/mess/video/mbc55x.c deleted file mode 100644 index d7fdc80d41c..00000000000 --- a/src/mess/video/mbc55x.c +++ /dev/null @@ -1,186 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phill Harvey-Smith -/* - video/mbc55x.c - - Machine driver for the Sanyo MBC-550 and MBC-555. - - Phill Harvey-Smith - 2011-01-29. - -Taken from : http://www.seasip.info/VintagePC/sanyo.html - -Video Controller - -To a programmer, the MBC's video hardware appears as a 6845 chip and three bitmapped graphics planes. -The 6845 appears at I/O ports 30h (register select) and 32h (data). At system boot, it is programmed -for 25 lines x 72 columns. The RAM BIOS then reprograms it for 25 x 80. The ROM also provides timings -for what appears to be a different 80-column mode; it decides which to use by reading port 1Ch. -If bit 7 of the result is 1, the 72-column mode is used; otherwise, the 80-column mode is. - -Here are the values written to the 6845 in each case, plus (for comparison) the values used by a real CGA: - - 6845 Register | IO.SYS | ROM 80 | ROM 72 | Real CGA -=============================+========+========+========+========== - Horizontal total | 112 | 101 | 112 | 83 - Horizontal display end | 80 | 80 | 72 | 80 - Horizontal sync pos | 89 | 83 | 85 | 81 - Horizontal sync width | 72 | 72 | 74 | 1 - Vertical total | 65 | 105 | 65 | 26 - Vertical total adjust | 0 | 2 | 0 | 0 - Vertical displayed | 50 | 100 | 50 | 26 - Vertical sync position | 56 | 100 | 56 | 25 - Interlace | 0 | 0 | 0 | 2 - Max scan address | 3 | 3 | 3 | 7 - Cursor start | 0 | 0 | 0 | 6 - Cursor end | 0 | 0 | 0 | 7 -=============================+========+========+========+========== - -The important thing to note here is that from the 6845's point of view, a character is 4 lines high. -This explains why the framebuffer memory is mapped as it is. - -The framebuffers - -The MBC video RAM is composed of three planes - green, red and blue. The green plane occupies main memory, -and its position varies; writes to port 10h set its address: - -Value | Address -======+======== - 4 | 0C000h - 5 | 1C000h (other values have not been tested) - 6 | 2C000h - 7 | 3C000h -======+======== - -The red and blue planes appear to have fixed locations of F0000h and F4000h respectively. - -When output goes to a composite monitor, the green plane is usually used by itself. -The red plane becomes "blink", causing pixels in it to blink; and the blue plane becomes "bright". - -Within each plane, memory is organised as 50 rows of 320 bytes (288 bytes in 72-column mode). -This corresponds to a rectangle, 640 (576) pixels wide and four pixels high. The first four bytes -give the leftmost column of the rectangle, the next four give the next column, and so on: - -[--byte 0--] [--byte 4--] [--byte 8--] [--byte 12--] ... -[--byte 1--] [--byte 5--] [--byte 9--] [--byte 13--] ... -[--byte 2--] [--byte 6--] [--byte 10--] [--byte 14--] ... -[--byte 3--] [--byte 7--] [--byte 11--] [--byte 15--] ... - -*************************************************************************************************************/ - -#include "includes/mbc55x.h" - -#define DEBUG_LINES 1 -#define DEBUG_VSYNC 2 - -#define DEBUG_SET(flags) ((m_debug_video & (flags))==(flags)) - -static void video_debug(running_machine &machine, int ref, int params, const char *param[]) -{ - mbc55x_state *mstate = machine.driver_data(); - if(params>0) - { - int temp; - sscanf(param[0],"%d",&temp); mstate->m_debug_video = temp;; - } - else - { - debug_console_printf(machine,"Error usage : mbc55x_vid_debug \n"); - debug_console_printf(machine,"Current debuglevel=%02X\n",mstate->m_debug_video); - } -} - -MC6845_UPDATE_ROW( mbc55x_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - UINT8 *ram = &m_ram->pointer()[0]; - UINT8 *red = &m_video_mem[RED_PLANE_OFFSET]; - UINT8 *blue = &m_video_mem[BLUE_PLANE_OFFSET]; - UINT8 *green; - int offset; - UINT8 rpx,gpx,bpx; - UINT8 rb,gb,bb; - - int x_pos; - int pixelno; - UINT8 bitno; - UINT8 shifts; - UINT8 colour; - - switch(m_vram_page) - { - case 4 : green=&ram[0x08000]; break; - case 5 : green=&ram[0x1C000]; break; - case 6 : green=&ram[0x2C000]; break; - case 7 : green=&ram[0x3C000]; break; - default : - green=&ram[0x0C000]; - } - - if(DEBUG_SET(DEBUG_LINES)) - logerror("MC6845_UPDATE_ROW: ma=%d, ra=%d, y=%d, x_count=%d\n",ma,ra,y,x_count); - - offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; - - if(DEBUG_SET(DEBUG_LINES)) - logerror("offset=%05X\n",offset); - - for(x_pos=0; x_pos> shifts; - gb=(gpx & bitno) >> shifts; - bb=(bpx & bitno) >> shifts; - - colour=(rb<<2) | (gb<<1) | (bb<<0); - - bitmap.pix32(y, (x_pos*8)+pixelno)=palette[colour]; - //logerror("set pixel (%d,%d)=%d\n",y, ((x_pos*8)+pixelno),colour); - bitno=bitno>>1; - shifts--; - } - } -} - -WRITE_LINE_MEMBER( mbc55x_state::vid_hsync_changed ) -{ -} - -WRITE_LINE_MEMBER( mbc55x_state::vid_vsync_changed ) -{ -} - -void mbc55x_state::video_start() -{ - m_debug_video=0; - - logerror("video_start\n"); - - if (machine().debug_flags & DEBUG_FLAG_ENABLED) - { - debug_console_register_command(machine(), "mbc55x_vid_debug", CMDFLAG_NONE, 0, 0, 1, video_debug); - } -} - -void mbc55x_state::video_reset() -{ - // When we reset clear the video registers and video memory. - memset(&m_video_mem,0,sizeof(m_video_mem)); - - logerror("Video reset\n"); -} - -void mbc55x_state::screen_eof_mbc55x(screen_device &screen, bool state) -{ -// logerror("screen_eof_mbc55x\n"); -} diff --git a/src/mess/video/mbee.c b/src/mess/video/mbee.c deleted file mode 100644 index ce55969f6a3..00000000000 --- a/src/mess/video/mbee.c +++ /dev/null @@ -1,495 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - microbee.c - - video hardware - Originally written by Juergen Buchmueller, Dec 1999 - - Rewritten by Robbbert (see notes in driver file). - - Operation of old keyboard: - The design is taken from the SY6545 Application Note AN3. As the CRTC - renders the picture, the MA lines also scan the keyboard. When a keydown - is detected, the lightpen pin is activated, which sets bit 6 of the status - register. The CPU continuously monitors this register. Once bit 6 is set, - the CPU needs to determine which key is pressed. It firstly clears bit 6, - then sets port 0B to 1. This prevents the CRTC from scanning the keyboard - and causing interference. Next, the CPU writes an address to regs 18,19 and - then instigates the transparent access. This checks one keyboard row, which - if the pressed key is found, will once again set bit 6. If not found, the - next row will be checked. Once found, the CPU clears bit 6 and port 0B, then - works out the ascii key code of the pressed key. - - Tests of old keyboard. Start mbeeic. - 1. Load ASTEROIDS PLUS, stay in attract mode, hold down spacebar, - it should only fire bullets. If it sometimes starts turning, - thrusting or using the shield, then there is a problem. - - 2. Load SCAVENGER and make sure it doesn't go to the next level - until you find the Exit. - - 3. At the Basic prompt, type in EDASM press enter. At the memory size - prompt press enter. Now, make sure the keyboard works properly. - - Old keyboard ToDo: - - Occasional characters dropped while typing - - Lots of characters dropped when pasting - - On mbee128p, Simply Write doesn't accept any input - - New keyboard ToDo: - - On mbeett, various problems caused by phantom characters. - -****************************************************************************/ - - -#include "includes/mbee.h" - -WRITE_LINE_MEMBER( mbee_state::crtc_vs ) -{ - m_b7_vs = state; - if ((m_io_config->read() & 0xc0) == 0) // VS selected in config menu - m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff)); -} - -/*********************************************************** - - The 6845 can produce a variety of cursor shapes - all - are emulated here. - - Need to find out if the 6545 works the same way. - -************************************************************/ - -void mbee_state::sy6545_cursor_configure() -{ - UINT8 i,curs_type=0,r9,r10,r11; - - /* curs_type holds the general cursor shape to be created - 0 = no cursor - 1 = partial cursor (only shows on a block of scan lines) - 2 = full cursor - 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ - - for ( i = 0; i < ARRAY_LENGTH(m_sy6545_cursor); i++) m_sy6545_cursor[i] = 0; // prepare cursor by erasing old one - - r9 = m_sy6545_reg[9]; // number of scan lines - 1 - r10 = m_sy6545_reg[10] & 0x1f; // cursor start line = last 5 bits - r11 = m_sy6545_reg[11]+1; // cursor end line incremented to suit for-loops below - - /* decide the curs_type by examining the registers */ - if (r10 < r11) curs_type=1; // start less than end, show start to end - else - if (r10 == r11) curs_type=2; // if equal, show full cursor - else curs_type=3; // if start greater than end, it's a two-part cursor - - if ((r11 - 1) > r9) curs_type=2; // if end greater than scan-lines, show full cursor - if (r10 > r9) curs_type=0; // if start greater than scan-lines, then no cursor - if (r11 > 16) r11=16; // truncate 5-bit register to fit our 4-bit hardware - - /* create the new cursor */ - if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(m_sy6545_cursor);i++) m_sy6545_cursor[i]=0xff; // turn on full cursor - - if (curs_type == 1) for (i = r10;i < r11;i++) m_sy6545_cursor[i]=0xff; // for each line that should show, turn on that scan line - - if (curs_type == 3) for (i = r11; i < r10;i++) m_sy6545_cursor[i]=0; // now take a bite out of the middle -} - - -/*********************************************************** - - Handlers of video, colour, and attribute RAM - -************************************************************/ - - -READ8_MEMBER( mbee_state::video_low_r ) -{ - if (m_is_premium && ((m_1c & 0x9f) == 0x90)) - return m_p_attribram[offset]; - else - if (m_0b) - return m_p_gfxram[offset]; - else - return m_p_videoram[offset]; -} - -WRITE8_MEMBER( mbee_state::video_low_w ) -{ - if BIT(m_1c, 4) - { - // non-premium attribute writes are discarded - if (m_is_premium && BIT(m_1c, 7)) - m_p_attribram[offset] = data; - } - else - m_p_videoram[offset] = data; -} - -READ8_MEMBER( mbee_state::video_high_r ) -{ - if BIT(m_08, 6) - return m_p_colorram[offset]; - else - return m_p_gfxram[(((m_1c & 15) + 1) << 11) | offset]; -} - -WRITE8_MEMBER( mbee_state::video_high_w ) -{ - if (BIT(m_08, 6) && (~m_0b & 1)) - m_p_colorram[offset] = data; - else - m_p_gfxram[(((m_1c & 15) + 1) << 11) | offset] = data; -} - -WRITE8_MEMBER( mbee_state::port0b_w ) -{ - m_0b = data & 1; -} - -READ8_MEMBER( mbee_state::port08_r ) -{ - return m_08; -} - -WRITE8_MEMBER( mbee_state::port08_w ) -{ - m_08 = data & 0x4e; -} - -READ8_MEMBER( mbee_state::port1c_r ) -{ - return m_1c; -} - -WRITE8_MEMBER( mbee_state::port1c_w ) -{ -/* d7 extended graphics (1=allow attributes and pcg banks) - d5 bankswitch basic rom - d4 select attribute ram - d3..d0 select m_videoram bank */ - - if (m_is_premium && BIT(data, 7)) - m_1c = data; - else - m_1c = data & 0x30; - - if (m_basic) - m_basic->set_entry(BIT(data, 5)); -} - - -/*********************************************************** - - CRTC-driven keyboard - -************************************************************/ - - -void mbee_state::oldkb_matrix_r(UINT16 offs) -{ - if (m_has_oldkb) - { - UINT8 port = (offs >> 7) & 7; - UINT8 bit = (offs >> 4) & 7; - UINT8 extra = 0; - UINT8 data = m_io_oldkb[port]->read(); - bool keydown = BIT(data, bit); - - // This adds premium-style cursor keys to the old keyboard. - // They are used by the pc85 menu. Premium keyboards already - // have these keys fitted. - if (!keydown && !m_is_premium) - { - if ((port == 0) || (port == 2) || (port == 3)) - extra = m_io_x7->read(); - else - if (port == 7) - extra = data; - - if (extra) - { - if BIT(extra, 0) // cursor up - { - if( port == 7 && bit == 1 ) keydown = 1; - if( port == 0 && bit == 5 ) keydown = 1; // control E - } - else - if BIT(extra, 2) // cursor down - { - if( port == 7 && bit == 1 ) keydown = 1; - if( port == 3 && bit == 0 ) keydown = 1; // control X - } - else - if BIT(extra, 3) // cursor left - { - if( port == 7 && bit == 1 ) keydown = 1; - if( port == 2 && bit == 3 ) keydown = 1; // control S - } - else - if BIT(extra, 6) // cursor right - { - if( port == 7 && bit == 1 ) keydown = 1; - if( port == 0 && bit == 4 ) keydown = 1; // control D - } - } - } - - if( keydown ) - m_crtc->assert_light_pen_input(); //lpen_strobe - } -} - - -void mbee_state::oldkb_scan( UINT16 param ) -{ - if (m_0b) return; // IC5 (pins 11,12,13) - if (param & 15) return; // only scan once per row instead of 16 times - oldkb_matrix_r(param); -} - - -/*********************************************************** - - CRTC registers - -************************************************************/ - -WRITE8_MEMBER ( mbee_state::m6545_index_w ) -{ - data &= 0x1f; - m_sy6545_ind = data; - m_crtc->address_w( space, 0, data ); -} - -WRITE8_MEMBER ( mbee_state::m6545_data_w ) -{ - static const UINT8 sy6545_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0,0x3f,0xff}; - - switch( m_sy6545_ind ) - { - case 12: - data &= 0x3f; // select alternate character set - if( m_sy6545_reg[12] != data ) - memcpy(m_p_gfxram, memregion("gfx")->base() + (((data & 0x30) == 0x20) << 11), 0x800); - break; - } - m_sy6545_reg[m_sy6545_ind] = data & sy6545_mask[m_sy6545_ind]; /* save data in register */ - m_crtc->register_w( space, 0, data ); - if ((m_sy6545_ind > 8) && (m_sy6545_ind < 12)) sy6545_cursor_configure(); /* adjust cursor shape - remove when mame fixed */ -} - - - - -/*********************************************************** - - Video - -************************************************************/ - -VIDEO_START_MEMBER( mbee_state, mono ) -{ - m_p_videoram = memregion("videoram")->base(); - m_p_gfxram = memregion("gfx")->base()+0x1000; - m_p_colorram = 0; - m_p_attribram = 0; - m_is_premium = 0; -} - -VIDEO_START_MEMBER( mbee_state, standard ) -{ - m_p_videoram = memregion("videoram")->base(); - m_p_gfxram = memregion("gfx")->base()+0x1000; - m_p_colorram = memregion("colorram")->base(); - m_p_attribram = 0; - m_is_premium = 0; -} - -VIDEO_START_MEMBER( mbee_state, premium ) -{ - m_p_videoram = memregion("videoram")->base(); - m_p_colorram = memregion("colorram")->base(); - m_p_gfxram = memregion("gfx")->base()+0x1000; - m_p_attribram = memregion("attrib")->base(); - m_is_premium = 1; -} - -UINT32 mbee_state::screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_framecnt++; - m_crtc->screen_update(screen, bitmap, cliprect); - return 0; -} - - -MC6845_ON_UPDATE_ADDR_CHANGED( mbee_state::crtc_update_addr ) -{ -// parameters passed are device, address, strobe(always 0) -// not used on 256TC - - oldkb_matrix_r(address); -} - - -MC6845_UPDATE_ROW( mbee_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - // colours - UINT8 colourm = (m_08 & 0x0e) >> 1; - UINT8 monopal = (m_io_config->read() & 0x30) >> 4; - // if colour chosen on mono bee, default to amber - if (!monopal && !m_p_colorram) - monopal = 2; - - UINT32 *p = &bitmap.pix32(y); - UINT8 inv, attr=0, gfx, fg=96+monopal, bg=96, col=0; - UINT16 mem, x, chr; - - for (x = 0; x < x_count; x++) // for each character - { - inv = 0; - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - - if BIT(m_1c, 7) // premium graphics enabled? - { - attr = m_p_attribram[mem]; - - if BIT(chr, 7) - chr += ((attr & 15) << 7); // bump chr to its particular pcg definition - - if BIT(attr, 6) - inv ^= 0xff; // inverse attribute - - if (BIT(attr, 7) & BIT(m_framecnt, 4)) // flashing attribute - chr = 0x20; - } - - oldkb_scan(x+ma); - - /* process cursor */ - if (x == cursor_x) - inv ^= m_sy6545_cursor[ra]; // cursor scan row - - /* get pattern of pixels for that character scanline */ - gfx = m_p_gfxram[(chr<<4) | ra] ^ inv; - - // get colours - if (!monopal) - { - col = m_p_colorram[mem]; // read a byte of colour - - if (m_is_premium) - { - fg = col & 15; - bg = col >> 4; - } - else - { - fg = (col & 0x1f) | 64; - bg = ((col & 0xe0) >> 2) | colourm; - } - } - - /* Display a scanline of a character (8 pixels) */ - *p++ = palette[BIT(gfx, 7) ? fg : bg]; - *p++ = palette[BIT(gfx, 6) ? fg : bg]; - *p++ = palette[BIT(gfx, 5) ? fg : bg]; - *p++ = palette[BIT(gfx, 4) ? fg : bg]; - *p++ = palette[BIT(gfx, 3) ? fg : bg]; - *p++ = palette[BIT(gfx, 2) ? fg : bg]; - *p++ = palette[BIT(gfx, 1) ? fg : bg]; - *p++ = palette[BIT(gfx, 0) ? fg : bg]; - } -} - - -/***************************************************************************************************** - - Palette - - Standard Palette: The 8 bits from the colour RAM are divided into 5 bits for foreground, and 3 - bits for background. The 5 foreground bits pass through a PAL, which has 6 outputs. A write to - port 8 produces 3 more background lines, giving 6 in total. These 12 lines travel to a pair of - 74LS157 switching chips, where the foreground or background lines are selected by the absence or - or presence of a pixel. The 6 chosen lines pass through a 7407 then are merged to the final 3 RGB - lines. Each pair is merged like this: - VCC --- 330 ohm --- primary colour line + out to monitor ---- 120 ohm --- secondary colour line - -*****************************************************************************************************/ - -PALETTE_INIT_MEMBER( mbee_state, standard ) -{ - const UINT8 *color_prom = memregion("proms")->base(); - UINT8 i=0, r, b, g, k, r1, g1, b1; - UINT8 bglevel[] = { 0, 0x54, 0xa0, 0xff }; - UINT8 fglevel[] = { 0, 0xa0, 0xff, 0xff }; - - // set up background colours (00-63) - for (b1 = 0; b1 < 4; b1++) - { - b = bglevel[b1]; - for (g1 = 0; g1 < 4; g1++) - { - g = bglevel[g1]; - for (r1 = 0; r1 < 4; r1++) - { - r = bglevel[r1]; - k = BITSWAP8(i, 7, 6, 5, 3, 1, 4, 2, 0); - palette.set_pen_color(k, rgb_t(r, g, b)); - i++; - } - } - } - - // set up foreground palette (64-95) by reading the prom - for (i = 0; i < 32; i++) - { - k = color_prom[i]; - r = fglevel[(BIT(k, 2))|(BIT(k, 5)<<1)]; - g = fglevel[(BIT(k, 1))|(BIT(k, 4)<<1)]; - b = fglevel[(BIT(k, 0))|(BIT(k, 3)<<1)]; - palette.set_pen_color(i|64, rgb_t(r, g, b)); - } - - // monochrome palette - palette.set_pen_color(96, rgb_t(0x00, 0x00, 0x00)); // black - palette.set_pen_color(97, rgb_t(0x00, 0xff, 0x00)); // green - palette.set_pen_color(98, rgb_t(0xf7, 0xaa, 0x00)); // amber - palette.set_pen_color(99, rgb_t(0xff, 0xff, 0xff)); // white -} - - -PALETTE_INIT_MEMBER( mbee_state, premium ) -{ - UINT8 i, r, b, g; - - /* set up 8 low intensity colours */ - for (i = 0; i < 7; i++) - { - r = BIT(i, 0) ? 0xc0 : 0; - g = BIT(i, 1) ? 0xc0 : 0; - b = BIT(i, 2) ? 0xc0 : 0; - palette.set_pen_color(i, rgb_t(r, g, b)); - } - - // colour 8 is dark grey, rather than black - palette.set_pen_color(8, rgb_t(96, 96, 96)); - - /* set up 8 high intensity colours */ - for (i = 9; i < 16; i++) - { - r = BIT(i, 0) ? 0xff : 0; - g = BIT(i, 1) ? 0xff : 0; - b = BIT(i, 2) ? 0xff : 0; - palette.set_pen_color(i, rgb_t(r, g, b)); - } - - // monochrome palette - palette.set_pen_color(96, rgb_t(0x00, 0x00, 0x00)); // black - palette.set_pen_color(97, rgb_t(0x00, 0xff, 0x00)); // green - palette.set_pen_color(98, rgb_t(0xf7, 0xaa, 0x00)); // amber - palette.set_pen_color(99, rgb_t(0xff, 0xff, 0xff)); // white -} diff --git a/src/mess/video/mc80.c b/src/mess/video/mc80.c deleted file mode 100644 index 66f05dd8576..00000000000 --- a/src/mess/video/mc80.c +++ /dev/null @@ -1,173 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - MC-80.xx video by Miodrag Milanovic - - 15/05/2009 Initial implementation - 12/05/2009 Skeleton driver. - -****************************************************************************/ - -#include "includes/mc80.h" - -// This is not a content of U402 510 -// but order is fine - -static const UINT8 prom[] = { - 0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @ - 0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A - 0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B - 0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C - 0x1e,0x09,0x09,0x09,0x09,0x09,0x1e,0x00, // D - 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E - 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F - 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G - - 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H - 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I - 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J - 0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00, // K - 0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00, // L - 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M - 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N - 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O - - 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P - 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q - 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R - 0x0e,0x11,0x10,0x0e,0x01,0x11,0x0e,0x00, // S - 0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // T - 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U - 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V - 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W - - 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X - 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y - 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z - 0x1c,0x10,0x10,0x10,0x10,0x10,0x1c,0x00, // [ - 0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00, // backslash - 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ] - 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^ - 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _ - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // - 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // ! - 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // " - 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // # - 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // [] - 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // % - 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // & - 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // ' - - 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // ( - 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // ) - 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // * - 0x00,0x04,0x04,0x1f,0x04,0x04,0x00,0x00, // + - 0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00, // , - 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // - - 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // . - 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // / - - 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0 - 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1 - 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2 - 0x1f,0x01,0x02,0x06,0x01,0x11,0x0e,0x00, // 3 - 0x02,0x06,0x0a,0x12,0x1f,0x02,0x02,0x00, // 4 - 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5 - 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6 - 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7 - - 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8 - 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9 - 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // : - 0x00,0x00,0x04,0x00,0x04,0x04,0x08,0x00, // ; - 0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00, // < - 0x00,0x00,0x1f,0x00,0x1f,0x00,0x00,0x00, // = - 0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00, // > - 0x0e,0x11,0x01,0x02,0x04,0x00,0x04,0x00 // ? -}; - -/*****************************************************************************/ -/* Implementation for MC80.2x */ -/*****************************************************************************/ - - - -VIDEO_START_MEMBER(mc80_state,mc8020) -{ -} - -UINT32 mc80_state::screen_update_mc8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - - for(y = 0; y < 8; y++ ) - { - for (ra = 0; ra < 16; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 32; x++) - { - if (ra > 3 && ra < 12) - { - chr = m_p_videoram[x]; - gfx = prom[(chr<<3) | (ra-4)]; - } - else - gfx = 0; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=32; - } - return 0; -} - -/*****************************************************************************/ -/* Implementation for MC80.3x */ -/*****************************************************************************/ - - -VIDEO_START_MEMBER(mc80_state,mc8030) -{ - m_p_videoram.set_target(memregion("vram")->base(),m_p_videoram.bytes()); -} - -UINT32 mc80_state::screen_update_mc8030(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 gfx; - UINT16 y=0,ma=0,x; - - for(y = 0; y < 256; y++ ) - { - UINT16 *p = &bitmap.pix16(y); - { - for (x = ma; x < ma + 64; x++) - { - gfx = m_p_videoram[x^0x3fff]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} diff --git a/src/mess/video/microtan.c b/src/mess/video/microtan.c deleted file mode 100644 index b6973e40fac..00000000000 --- a/src/mess/video/microtan.c +++ /dev/null @@ -1,57 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/*************************************************************************** - * Microtan 65 - * - * video hardware - * - * Juergen Buchmueller , Jul 2000 - * - * Thanks go to Geoff Macdonald - * for his site http:://www.geo255.redhotant.com - * and to Fabrice Frances - * for his site http://www.ifrance.com/oric/microtan.html - * - ***************************************************************************/ - -#include "emu.h" -#include "includes/microtan.h" - - - - -WRITE8_MEMBER(microtan_state::microtan_videoram_w) -{ - UINT8 *videoram = m_videoram; - if ((videoram[offset] != data) || (m_chunky_buffer[offset] != m_chunky_graphics)) - { - videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); - m_chunky_buffer[offset] = m_chunky_graphics; - } -} - -TILE_GET_INFO_MEMBER(microtan_state::get_bg_tile_info) -{ - UINT8 *videoram = m_videoram; - int gfxn = m_chunky_buffer[tile_index]; - int code = videoram[tile_index]; - - SET_TILE_INFO_MEMBER(gfxn, code, 0, 0); -} - -void microtan_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(microtan_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, - 8, 16, 32, 16); - - m_chunky_buffer = auto_alloc_array(machine(), UINT8, 0x200); - memset(m_chunky_buffer, 0, 0x200); - m_chunky_graphics = 0; -} - -UINT32 microtan_state::screen_update_microtan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} diff --git a/src/mess/video/mikro80.c b/src/mess/video/mikro80.c deleted file mode 100644 index edab6f8cd06..00000000000 --- a/src/mess/video/mikro80.c +++ /dev/null @@ -1,40 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Mikro-80 video driver by Miodrag Milanovic - - 10/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/mikro80.h" - - -void mikro80_state::video_start() -{ -} - -UINT32 mikro80_state::screen_update_mikro80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *gfx = m_region_gfx1->base(); - int x,y,b; - - for(y = 0; y < 32*8; y++ ) - { - for(x = 0; x < 64; x++ ) - { - int addr = x + (y / 8)*64; - UINT8 code = gfx[m_video_ram [addr]*8+ (y % 8)]; - UINT8 attr = m_cursor_ram[addr+1] & 0x80 ? 1 : 0; - for (b = 7; b >= 0; b--) - { - UINT8 col = (code >> b) & 0x01; - bitmap.pix16(y, x*8+(7-b)) = attr ? col ^ 1 : col; - } - } - } - return 0; -} diff --git a/src/mess/video/mikromik.c b/src/mess/video/mikromik.c deleted file mode 100644 index e107a3c4421..00000000000 --- a/src/mess/video/mikromik.c +++ /dev/null @@ -1,126 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "includes/mikromik.h" - - - -//------------------------------------------------- -// i8275 crtc display pixels -//------------------------------------------------- - -I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels ) -{ - UINT8 romdata = m_char_rom->base()[(charcode << 4) | linecount]; - - int d0 = BIT(romdata, 0); - int d7 = BIT(romdata, 7); - int gpa0 = BIT(gpa, 0); - int llen = m_llen; - int i; - - UINT8 data = (romdata << 1) | (d7 & d0); - - for (i = 0; i < 8; i++) - { - int qh = BIT(data, i); - int video_in = ((((d7 & llen) | !vsp) & !gpa0) & qh) | lten; - int compl_in = rvv; - int hlt_in = hlgt; - - int color = hlt_in ? 2 : (video_in ^ compl_in); - - bitmap.pix32(y, x + i) = m_palette->pen(color); - } -} - - -//------------------------------------------------- -// ADDRESS_MAP( mm1_upd7220_map ) -//------------------------------------------------- - -static ADDRESS_MAP_START( mm1_upd7220_map, AS_0, 16, mm1_state ) - ADDRESS_MAP_GLOBAL_MASK(0x7fff) - AM_RANGE(0x0000, 0x7fff) AM_RAM AM_SHARE("video_ram") -ADDRESS_MAP_END - - -//------------------------------------------------- -// UPD7220_INTERFACE( hgdc_intf ) -//------------------------------------------------- - -UPD7220_DISPLAY_PIXELS_MEMBER( mm1_state::hgdc_display_pixels ) -{ - UINT16 data = m_video_ram[address >> 1]; - - for (int i = 0; i < 16; i++) - { - if (BIT(data, i)) bitmap.pix32(y, x + i) = m_palette->pen(1); - } -} - - -UINT32 mm1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - /* text */ - m_crtc->screen_update(screen, bitmap, cliprect); - - /* graphics */ - m_hgdc->screen_update(screen, bitmap, cliprect); - - return 0; -} - - -//------------------------------------------------- -// gfx_layout charlayout -//------------------------------------------------- - -static const gfx_layout charlayout = -{ - 8, 16, - RGN_FRAC(1,1), - 1, - { 0 }, - { 7, 6, 5, 4, 3, 2, 1, 0 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 -}; - - -//------------------------------------------------- -// GFXDECODE( mm1 ) -//------------------------------------------------- - -static GFXDECODE_START( mm1 ) - GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 1 ) -GFXDECODE_END - - -//------------------------------------------------- -// MACHINE_CONFIG_FRAGMENT( mm1m6_video ) -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( mm1m6_video ) - MCFG_SCREEN_ADD( SCREEN_TAG, RASTER ) - MCFG_SCREEN_REFRESH_RATE( 50 ) - MCFG_SCREEN_UPDATE_DRIVER(mm1_state, screen_update) - MCFG_SCREEN_SIZE( 800, 400 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 800-1, 0, 400-1 ) - //MCFG_SCREEN_RAW_PARAMS(XTAL_18_720MHz, ...) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", mm1) - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") - - MCFG_DEVICE_ADD(I8275_TAG, I8275, XTAL_18_720MHz/8) - MCFG_I8275_CHARACTER_WIDTH(8) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(mm1_state, crtc_display_pixels) - MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w)) - MCFG_I8275_VRTC_CALLBACK(DEVWRITELINE(UPD7220_TAG, upd7220_device, ext_sync_w)) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) - - MCFG_DEVICE_ADD(UPD7220_TAG, UPD7220, XTAL_18_720MHz/8) - MCFG_DEVICE_ADDRESS_MAP(AS_0, mm1_upd7220_map) - MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mm1_state, hgdc_display_pixels) - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) -MACHINE_CONFIG_END diff --git a/src/mess/video/mz700.c b/src/mess/video/mz700.c deleted file mode 100644 index b3f08dad1a3..00000000000 --- a/src/mess/video/mz700.c +++ /dev/null @@ -1,128 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Dirk Best -/*************************************************************************** - * Sharp MZ700 - * - * video hardware - * - * Juergen Buchmueller , Jul 2000 - * - * Reference: http://sharpmz.computingmuseum.com - * - ***************************************************************************/ - -#include "emu.h" -#include "includes/mz700.h" - - -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define LOG(N,M,A) \ - do { \ - if(VERBOSE>=N) \ - { \ - if( M ) \ - logerror("%11.6f: %-24s",machine.time().as_double(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - - -PALETTE_INIT_MEMBER(mz_state, mz) -{ - int i; - - for (i = 0; i < 8; i++) - m_palette->set_indirect_color(i, rgb_t((i & 2) ? 0xff : 0x00, (i & 4) ? 0xff : 0x00, (i & 1) ? 0xff : 0x00)); - - for (i = 0; i < 256; i++) - { - m_palette->set_pen_indirect(i*2, i & 7); - m_palette->set_pen_indirect(i*2+1, (i >> 4) & 7); - } -} - - -UINT32 mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_videoram; - int offs; - - bitmap.fill(m_palette->black_pen(), cliprect); - - for(offs = 0; offs < 40*25; offs++) - { - int sx, sy, code, color; - - sy = (offs / 40) * 8; - sx = (offs % 40) * 8; - - color = m_colorram[offs]; - code = videoram[offs] | (color & 0x80) << 1; - - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code, color, 0, 0, sx, sy); - } - - return 0; -} - - -/*************************************************************************** - MZ-800 -***************************************************************************/ - -VIDEO_START_MEMBER(mz_state,mz800) -{ - m_gfxdecode->gfx(0)->set_source(m_cgram); -} - -UINT32 mz_state::screen_update_mz800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_videoram; - - bitmap.fill(m_palette->black_pen(), cliprect); - - if (m_mz700_mode) - return screen_update_mz700(screen, bitmap, cliprect); - else - { - if (m_hires_mode) - { - } - else - { - int x, y; - UINT8 *start_addr = videoram; - - for (x = 0; x < 40; x++) - { - for (y = 0; y < 200; y++) - { - bitmap.pix16(y, x * 8 + 0) = BIT(start_addr[x * 8 + y], 0); - bitmap.pix16(y, x * 8 + 1) = BIT(start_addr[x * 8 + y], 1); - bitmap.pix16(y, x * 8 + 2) = BIT(start_addr[x * 8 + y], 2); - bitmap.pix16(y, x * 8 + 3) = BIT(start_addr[x * 8 + y], 3); - bitmap.pix16(y, x * 8 + 4) = BIT(start_addr[x * 8 + y], 4); - bitmap.pix16(y, x * 8 + 5) = BIT(start_addr[x * 8 + y], 5); - bitmap.pix16(y, x * 8 + 6) = BIT(start_addr[x * 8 + y], 6); - bitmap.pix16(y, x * 8 + 7) = BIT(start_addr[x * 8 + y], 7); - } - } - } - - return 0; - } -} - -/*************************************************************************** - CGRAM -***************************************************************************/ - -WRITE8_MEMBER(mz_state::mz800_cgram_w) -{ - m_cgram[offset] = data; - - m_gfxdecode->gfx(0)->mark_dirty(offset/8); -} diff --git a/src/mess/video/mz80.c b/src/mess/video/mz80.c deleted file mode 100644 index d6bfa015c9c..00000000000 --- a/src/mess/video/mz80.c +++ /dev/null @@ -1,143 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - MZ80 driver by Miodrag Milanovic - - 22/11/2008 Preliminary driver. - -****************************************************************************/ - -#include "includes/mz80.h" - -const gfx_layout mz80k_charlayout = -{ - 8, 8, /* 8x8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {0, 1, 2, 3, 4, 5, 6, 7}, - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, - 8*8 /* size of one char */ -}; - -const gfx_layout mz80kj_charlayout = -{ - 8, 8, /* 8x8 characters */ - 256, /* 256 characters + 256 blanks */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {7, 6, 5, 4, 3, 2, 1, 0}, - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, - 8*8 /* size of one char */ -}; - -/* Video hardware */ -void mz80_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); -} - -UINT32 mz80_state::screen_update_mz80k(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_mz80k_vertical ^= 1; - m_mz80k_cursor_cnt++; - UINT8 y,ra,chr,gfx; - UINT16 x,sy=0,ma=0; - - for(y = 0; y < 25; y++ ) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 40; x++) - { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=40; - } - return 0; -} - -// same as above except bits are in reverse order -UINT32 mz80_state::screen_update_mz80kj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_mz80k_vertical ^= 1; - m_mz80k_cursor_cnt++; - UINT8 y,ra,chr,gfx; - UINT16 x,sy=0,ma=0; - - for(y = 0; y < 25; y++ ) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 40; x++) - { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 0); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 7); - } - } - ma+=40; - } - return 0; -} - -// has twice as much video ram and uses a scroll register -UINT32 mz80_state::screen_update_mz80a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_mz80k_vertical ^= 1; - m_mz80k_cursor_cnt++; - UINT8 y,ra,chr,gfx; - UINT16 x,sy=0, ma=m_p_ram[0x17d] | (m_p_ram[0x17e] << 8); - - for(y = 0; y < 25; y++ ) - { - for (ra = 0; ra < 8; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 40; x++) - { - chr = m_p_videoram[x&0x7ff]; - gfx = m_p_chargen[(chr<<3) | ra]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=40; - } - return 0; -} diff --git a/src/mess/video/nc.c b/src/mess/video/nc.c deleted file mode 100644 index 934bfbfd3a3..00000000000 --- a/src/mess/video/nc.c +++ /dev/null @@ -1,120 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Wilbert Pol, Kevin Thacker -/*************************************************************************** - - nc.c - - Functions to emulate the video hardware of the Amstrad PCW. - -***************************************************************************/ - -#include "emu.h" -#include "includes/nc.h" -#include "machine/ram.h" - -/*************************************************************************** - Start the video hardware emulation. -***************************************************************************/ - -void nc_state::video_start() -{ -} - -#if 0 -/* two colours */ -static const unsigned short nc_colour_table[NC_NUM_COLOURS] = -{ - 0, 1,2,3 -}; -#endif - -/* black/white */ -static const rgb_t nc_palette[NC_NUM_COLOURS] = -{ - rgb_t(0x060, 0x060, 0x060), - rgb_t(0x000, 0x000, 0x000), - rgb_t(0x080, 0x0a0, 0x060), - rgb_t(0x000, 0x000, 0x000) -}; - - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(nc_state, nc) -{ - palette.set_pen_colors(0, nc_palette, ARRAY_LENGTH(nc_palette)); -} - - -void nc_state::nc200_video_set_backlight(int state) -{ - m_nc200_backlight = state; -} - - -/*************************************************************************** - Draw the game screen in the given bitmap_ind16. - Do NOT call osd_update_display() from this function, - it will be called by the main emulation engine. -***************************************************************************/ -UINT32 nc_state::screen_update_nc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int y; - int b; - int x; - int height, width; - int pens[2]; - - if (m_type==NC_TYPE_200) - { - height = NC200_SCREEN_HEIGHT; - width = NC200_SCREEN_WIDTH; - - if (m_nc200_backlight) - { - pens[0] = 2; - pens[1] = 3; - } - else - { - pens[0] = 0; - pens[1] = 1; - } - } - else - { - height = NC_SCREEN_HEIGHT; - width = NC_SCREEN_WIDTH; - pens[0] = 2; - pens[1] = 3; - } - - - for (y=0; ypointer()) + m_display_memory_start + (y<<6); - - x = 0; - for (by=0; by>3; by++) - { - int px; - unsigned char byte; - - byte = line_ptr[0]; - - px = x; - for (b=0; b<8; b++) - { - bitmap.pix16(y, px) = pens[(byte>>7) & 0x01]; - byte = byte<<1; - px++; - } - - x = px; - - line_ptr = line_ptr+1; - } - } - return 0; -} diff --git a/src/mess/video/nes.c b/src/mess/video/nes.c deleted file mode 100644 index 077f4efe3a2..00000000000 --- a/src/mess/video/nes.c +++ /dev/null @@ -1,62 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Brad Oliver,Fabio Priuli -/*************************************************************************** - - video/nes.c - - Routines to control the unique NES video hardware/PPU. - -***************************************************************************/ - -#include "emu.h" -#include "includes/nes.h" - -void nes_state::video_reset() -{ - m_ppu->set_vidaccess_callback(ppu2c0x_vidaccess_delegate(FUNC(nes_state::nes_ppu_vidaccess),this)); -} - -void nes_state::video_start() -{ - m_last_frame_flip = 0; -} - -PALETTE_INIT_MEMBER(nes_state, nes) -{ - m_ppu->init_palette(palette, 0); -} - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -UINT32 nes_state::screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // render the ppu - m_ppu->render(bitmap, 0, 0, 0, 0); - - // if this is a disk system game, check for the flip-disk key - if ((m_cartslot && m_cartslot->exists() && (m_cartslot->get_pcb_id() == STD_DISKSYS)) // first scenario = disksys in m_cartslot (= famicom) - || m_disk) // second scenario = disk via fixed internal disk option (fds & famitwin) - { - if (m_io_disksel) - { - // latch this input so it doesn't go at warp speed - if ((m_io_disksel->read() & 0x01) && (!m_last_frame_flip)) - { - if (m_disk) - m_disk->disk_flip_side(); - else - m_cartslot->disk_flip_side(); - m_last_frame_flip = 1; - } - - if (!(m_io_disksel->read() & 0x01)) - m_last_frame_flip = 0; - } - } - return 0; -} diff --git a/src/mess/video/newbrain.c b/src/mess/video/newbrain.c deleted file mode 100644 index ae010c0b15c..00000000000 --- a/src/mess/video/newbrain.c +++ /dev/null @@ -1,130 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "includes/newbrain.h" -#include "newbrain.lh" - -void newbrain_state::video_start() -{ - /* register for state saving */ - save_item(NAME(m_tvcnsl)); - save_item(NAME(m_tvctl)); - save_item(NAME(m_tvram)); - save_item(NAME(m_segment_data)); -} - -void newbrain_state::screen_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - address_space &program = m_maincpu->space(AS_PROGRAM); - - int y, sx; - int columns = (m_tvctl & NEWBRAIN_VIDEO_80L) ? 80 : 40; - int excess = (m_tvctl & NEWBRAIN_VIDEO_32_40) ? 24 : 4; - int ucr = (m_tvctl & NEWBRAIN_VIDEO_UCR) ? 1 : 0; - int fs = (m_tvctl & NEWBRAIN_VIDEO_FS) ? 1 : 0; - int rv = (m_tvctl & NEWBRAIN_VIDEO_RV) ? 1 : 0; - int gr = 0; - - UINT16 videoram_addr = m_tvram; - UINT8 rc = 0; - - for (y = 0; y < 250; y++) - { - int x = 0; - - for (sx = 0; sx < columns; sx++) - { - int bit; - - UINT8 videoram_data = program.read_byte(videoram_addr + sx); - UINT8 charrom_data; - - if (gr) - { - /* render video ram data */ - charrom_data = videoram_data; - } - else - { - /* render character rom data */ - UINT16 charrom_addr = (rc << 8) | ((BIT(videoram_data, 7) & fs) << 7) | (videoram_data & 0x7f); - charrom_data = m_char_rom->base()[charrom_addr & 0xfff]; - - if ((videoram_data & 0x80) && !fs) - { - /* invert character */ - charrom_data ^= 0xff; - } - - if ((videoram_data & 0x60) && !ucr) - { - /* strip bit D0 */ - charrom_data &= 0xfe; - } - } - - for (bit = 0; bit < 8; bit++) - { - int color = BIT(charrom_data, 7) ^ rv; - - bitmap.pix32(y, x++) = m_palette->pen(color); - - if (columns == 40) - { - bitmap.pix32(y, x++) = m_palette->pen(color); - } - - charrom_data <<= 1; - } - } - - if (gr) - { - /* get new data for each line */ - videoram_addr += columns; - videoram_addr += excess; - } - else - { - /* increase row counter */ - rc++; - - if (rc == (ucr ? 8 : 10)) - { - /* reset row counter */ - rc = 0; - - videoram_addr += columns; - videoram_addr += excess; - } - } - } -} - -UINT32 newbrain_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - if (m_enrg1 & NEWBRAIN_ENRG1_TVP) - { - screen_update(bitmap, cliprect); - } - else - { - bitmap.fill(rgb_t::black, cliprect); - } - - return 0; -} - -/* Machine Drivers */ - -MACHINE_CONFIG_FRAGMENT( newbrain_video ) - MCFG_DEFAULT_LAYOUT(layout_newbrain) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(newbrain_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 250) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END diff --git a/src/mess/video/newport.c b/src/mess/video/newport.c deleted file mode 100644 index 8d331fbb60f..00000000000 --- a/src/mess/video/newport.c +++ /dev/null @@ -1,1667 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/* - SGI "Newport" graphics board used in the Indy and some Indigo2s - - Newport is modular, consisting of the following custom chips: - - REX3: Raster Engine, which is basically a blitter which can also draw antialiased lines. - REX also acts as the interface to the rest of the system - all the other chips on - a Newport board are accessed through it. - - RB2: Frame buffer input controller - - RO1: Frame buffer output controller - - XMAP9: Final display generator - - CMAP: Palette mapper - - VC2: Video timing controller / CRTC - - Taken from the Linux Newport driver, slave addresses for Newport devices are: - VC2 0 - Both CMAPs 1 - CMAP 0 2 - CMAP 1 3 - Both XMAPs 4 - XMAP 0 5 - XMAP 1 6 - RAMDAC 7 - VIDEO (CC1) 8 - VIDEO (AB1) 9 -*/ - -#include "emu.h" -#include "video/newport.h" - -#define VERBOSE_LEVEL ( 0 ) - -#if 0 -INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, const char *s_fmt, ... ) -{ - if( VERBOSE_LEVEL >= n_level ) - { - va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); - logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); - } -} -#endif - -#define VC2_VIDENTRY m_VC2.nRegister[0x00] -#define VC2_CURENTRY m_VC2.nRegister[0x01] -#define VC2_CURSORX m_VC2.nRegister[0x02] -#define VC2_CURSORY m_VC2.nRegister[0x03] -#define VC2_CURCURSORX m_VC2.nRegister[0x04] -#define VC2_DIDENTRY m_VC2.nRegister[0x05] -#define VC2_SCANLINELEN m_VC2.nRegister[0x06] -#define VC2_RAMADDR m_VC2.nRegister[0x07] -#define VC2_VTFRAMEPTR m_VC2.nRegister[0x08] -#define VC2_VTLINEPTR m_VC2.nRegister[0x09] -#define VC2_VTLINERUN m_VC2.nRegister[0x0a] -#define VC2_VLINECNT m_VC2.nRegister[0x0b] -#define VC2_CURTABLEPTR m_VC2.nRegister[0x0c] -#define VC2_WORKCURSORY m_VC2.nRegister[0x0d] -#define VC2_DIDFRAMEPTR m_VC2.nRegister[0x0e] -#define VC2_DIDLINEPTR m_VC2.nRegister[0x0f] -#define VC2_DISPLAYCTRL m_VC2.nRegister[0x10] -#define VC2_CONFIG m_VC2.nRegister[0x1f] - -#define XMAP0_CONFIG m_XMAP0.nRegister[0x00] -#define XMAP0_REVISION m_XMAP0.nRegister[0x01] -#define XMAP0_ENTRIES m_XMAP0.nRegister[0x02] -#define XMAP0_CURCMAP m_XMAP0.nRegister[0x03] -#define XMAP0_POPUPCMAP m_XMAP0.nRegister[0x04] -#define XMAP0_MODETBLIDX m_XMAP0.nRegister[0x07] - -#define XMAP1_CONFIG m_XMAP1.nRegister[0x00] -#define XMAP1_REVISION m_XMAP1.nRegister[0x01] -#define XMAP1_ENTRIES m_XMAP1.nRegister[0x02] -#define XMAP1_CURCMAP m_XMAP1.nRegister[0x03] -#define XMAP1_POPUPCMAP m_XMAP1.nRegister[0x04] -#define XMAP1_MODETBLIDX m_XMAP1.nRegister[0x07] - - -const device_type NEWPORT_VIDEO = &device_creator; - - -newport_video_device::newport_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, NEWPORT_VIDEO, "SGI Newport graphics board", tag, owner, clock, "newport_video", __FILE__) -{ -} - - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void newport_video_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void newport_video_device::device_start() -{ - m_base = auto_alloc_array_clear(machine(), UINT32, (1280+64) * (1024+64)); - - save_pointer(NAME(m_base), (1280+64) * (1024+64)); - save_item(NAME(m_VC2.nRegister)); - save_item(NAME(m_VC2.nRAM)); - save_item(NAME(m_VC2.nRegIdx)); - save_item(NAME(m_VC2.nRegData)); - - save_item(NAME(m_XMAP0.nRegister)); - save_item(NAME(m_XMAP0.nModeTable)); - save_item(NAME(m_XMAP1.nRegister)); - save_item(NAME(m_XMAP1.nModeTable)); - - save_item(NAME(m_REX3.nDrawMode1)); - save_item(NAME(m_REX3.nDrawMode0)); - save_item(NAME(m_REX3.nLSMode)); - save_item(NAME(m_REX3.nLSPattern)); - save_item(NAME(m_REX3.nLSPatSave)); - save_item(NAME(m_REX3.nZPattern)); - save_item(NAME(m_REX3.nColorBack)); - save_item(NAME(m_REX3.nColorVRAM)); - save_item(NAME(m_REX3.nAlphaRef)); - save_item(NAME(m_REX3.nSMask0X)); - save_item(NAME(m_REX3.nSMask0Y)); - save_item(NAME(m_REX3.nSetup)); - save_item(NAME(m_REX3.nStepZ)); - save_item(NAME(m_REX3.nXStart)); - save_item(NAME(m_REX3.nYStart)); - save_item(NAME(m_REX3.nXEnd)); - save_item(NAME(m_REX3.nYEnd)); - - save_item(NAME(m_REX3.nXSave)); - save_item(NAME(m_REX3.nXYMove)); - save_item(NAME(m_REX3.nBresD)); - save_item(NAME(m_REX3.nBresS1)); - save_item(NAME(m_REX3.nBresOctInc1)); - save_item(NAME(m_REX3.nBresRndInc2)); - save_item(NAME(m_REX3.nBresE1)); - save_item(NAME(m_REX3.nBresS2)); - save_item(NAME(m_REX3.nAWeight0)); - save_item(NAME(m_REX3.nAWeight1)); - save_item(NAME(m_REX3.nXStartF)); - save_item(NAME(m_REX3.nYStartF)); - save_item(NAME(m_REX3.nXEndF)); - save_item(NAME(m_REX3.nYEndF)); - save_item(NAME(m_REX3.nXStartI)); - save_item(NAME(m_REX3.nXYStartI)); - save_item(NAME(m_REX3.nXYEndI)); - save_item(NAME(m_REX3.nXStartEndI)); - save_item(NAME(m_REX3.nColorRed)); - save_item(NAME(m_REX3.nColorAlpha)); - save_item(NAME(m_REX3.nColorGreen)); - save_item(NAME(m_REX3.nColorBlue)); - save_item(NAME(m_REX3.nSlopeRed)); - save_item(NAME(m_REX3.nSlopeAlpha)); - save_item(NAME(m_REX3.nSlopeGreen)); - save_item(NAME(m_REX3.nSlopeBlue)); - save_item(NAME(m_REX3.nWriteMask)); - save_item(NAME(m_REX3.nZeroFract)); - save_item(NAME(m_REX3.nZeroOverflow)); - save_item(NAME(m_REX3.nHostDataPortMSW)); - save_item(NAME(m_REX3.nHostDataPortLSW)); - save_item(NAME(m_REX3.nDCBMode)); - save_item(NAME(m_REX3.nDCBRegSelect)); - save_item(NAME(m_REX3.nDCBSlvSelect)); - save_item(NAME(m_REX3.nDCBDataMSW)); - save_item(NAME(m_REX3.nDCBDataLSW)); - save_item(NAME(m_REX3.nSMask1X)); - save_item(NAME(m_REX3.nSMask1Y)); - save_item(NAME(m_REX3.nSMask2X)); - save_item(NAME(m_REX3.nSMask2Y)); - save_item(NAME(m_REX3.nSMask3X)); - save_item(NAME(m_REX3.nSMask3Y)); - save_item(NAME(m_REX3.nSMask4X)); - save_item(NAME(m_REX3.nSMask4Y)); - save_item(NAME(m_REX3.nTopScanline)); - save_item(NAME(m_REX3.nXYWin)); - save_item(NAME(m_REX3.nClipMode)); - save_item(NAME(m_REX3.nConfig)); - save_item(NAME(m_REX3.nStatus)); - save_item(NAME(m_REX3.nXFerWidth)); -#if 0 - save_item(NAME(m_REX3.nCurrentX)); - save_item(NAME(m_REX3.nCurrentY)); -#endif - save_item(NAME(m_REX3.nKludge_SkipLine)); - - save_item(NAME(m_nDrawGreen)); - save_item(NAME(m_CMAP0.nPaletteIndex)); - save_item(NAME(m_CMAP0.nPalette)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void newport_video_device::device_reset() -{ - m_nDrawGreen = 0; - m_REX3.nDrawMode0 = 0x00000000; - m_REX3.nDrawMode1 = 0x3002f001; - m_REX3.nDCBMode = 0x00000780; - m_REX3.nKludge_SkipLine = 0; -} - - -UINT32 newport_video_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - /* loop over rows and copy to the destination */ - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) - { - UINT32 *src = &m_base[1344 * y]; - UINT32 *dest = &bitmap.pix32(y, cliprect.min_x); - - /* loop over columns */ - for (int x = cliprect.min_x; x < cliprect.max_x; x++) - { - *dest++ = (*src++) & 0x00f8f8f8; - } - } - return 0; -} - - -WRITE32_MEMBER( newport_video_device::cmap0_w ) -{ - switch (m_REX3.nDCBRegSelect) - { - case 0x00: - //verboselog(machine(), 2, "CMAP0 Palette Index Write: %04x\n", data & 0x0000ffff ); - m_CMAP0.nPaletteIndex = data & 0x0000ffff; - break; - case 0x02: - //verboselog(machine(), 2, "CMAP0 Palette Entry %04x Write: %08x\n", m_CMAP0.nPaletteIndex, ( data >> 8 ) & 0x00ffffff ); - m_CMAP0.nPalette[m_CMAP0.nPaletteIndex] = ( data >> 8 ) & 0x00ffffff; - break; - default: - //verboselog(machine(), 2, "Unknown CMAP0 Register %d Write: %08x\n", m_REX3.nDCBRegSelect, data ); - break; - } -} - -READ32_MEMBER( newport_video_device::cmap0_r ) -{ - switch (m_REX3.nDCBRegSelect) - { - case 0x04: - //verboselog(machine(), 2, "CMAP0 Status Read: %08x\n", 0x00000008 ); - return 0x00000008; - case 0x06: /* Revision */ - //verboselog(machine(), 2, "CMAP0 Revision Read: CMAP Rev 1, Board Rev 2, 8bpp\n" ); - return 0x000000a1; - default: - //verboselog(machine(), 2, "Unknown CMAP0 Register %d Read\n", m_REX3.nDCBRegSelect ); - return 0x00000000; - } -} - -READ32_MEMBER( newport_video_device::cmap1_r ) -{ - switch (m_REX3.nDCBRegSelect) - { - case 0x04: - //verboselog(machine(), 2, "CMAP1 Status Read: %08x\n", 0x00000008 ); - return 0x00000008; - case 0x06: /* Revision */ - //verboselog(machine(), 2, "CMAP1 Revision Read: CMAP Rev 1, Board Rev 2, 8bpp\n" ); - return 0x000000a1; - default: - //verboselog(machine(), 2, "Unknown CMAP0 Register %d Read\n", m_REX3.nDCBRegSelect ); - return 0x00000000; - } -} - -READ32_MEMBER( newport_video_device::xmap0_r ) -{ - UINT8 nModeIdx; - - switch (m_REX3.nDCBRegSelect) - { - case 0: - //verboselog(machine(), 2, "XMAP0 Config Read: %08x\n", XMAP0_CONFIG ); - return XMAP0_CONFIG; - case 1: - //verboselog(machine(), 2, "XMAP0 Revision Read: %08x\n", 0x00 ); - return 0x00000000; - case 2: - //verboselog(machine(), 2, "XMAP0 FIFO Availability Read: %08x\n", 0x02 ); - return 0x00000002; - case 3: - //verboselog(machine(), 2, "XMAP0 Cursor CMAP MSB Read: %08x\n", XMAP0_CURCMAP ); - return XMAP0_CURCMAP; - case 4: - //verboselog(machine(), 2, "XMAP0 Pop Up CMAP MSB Read: %08x\n", XMAP0_POPUPCMAP ); - return XMAP0_POPUPCMAP; - case 5: - nModeIdx = ( XMAP0_MODETBLIDX & 0x0000007c ) >> 2; - switch (XMAP0_MODETBLIDX & 0x00000003) - { - case 0: - //verboselog(machine(), 2, "XMAP0 Mode Register Read: %02x (Byte 0): %08x\n", nModeIdx, ( m_XMAP0.nModeTable[ nModeIdx ] & 0x00ff0000 ) >> 16 ); - return ( m_XMAP0.nModeTable[ nModeIdx ] & 0x00ff0000 ) >> 16; - case 1: - //verboselog(machine(), 2, "XMAP0 Mode Register Read: %02x (Byte 1): %08x\n", nModeIdx, ( m_XMAP0.nModeTable[ nModeIdx ] & 0x0000ff00 ) >> 8 ); - return ( m_XMAP0.nModeTable[ nModeIdx ] & 0x0000ff00 ) >> 8; - case 2: - //verboselog(machine(), 2, "XMAP0 Mode Register Read: %02x (Byte 2): %08x\n", nModeIdx, ( m_XMAP0.nModeTable[ nModeIdx ] & 0x000000ff ) ); - return ( m_XMAP0.nModeTable[ nModeIdx ] & 0x000000ff ); - } - break; - case 6: - //verboselog(machine(), 2, "XMAP0 Unused Read: %08x\n", 0x00000000 ); - return 0x00000000; - case 7: - //verboselog(machine(), 2, "XMAP0 Mode Table Address Read: %08x\n", XMAP0_MODETBLIDX ); - return XMAP0_MODETBLIDX; - } - - //verboselog(machine(), 2, "XMAP0 Unknown m_REX3.nDCBRegSelect Value: %02x, returning 0\n", m_REX3.nDCBRegSelect ); - return 0x00000000; -} - -WRITE32_MEMBER( newport_video_device::xmap0_w ) -{ - UINT8 n8BitVal = data & 0x000000ff; - - switch (m_REX3.nDCBRegSelect) - { - case 0: - //verboselog(machine(), 2, "XMAP0 Config Write: %02x\n", n8BitVal ); - XMAP0_CONFIG = n8BitVal; - break; - case 1: - //verboselog(machine(), 2, "XMAP0 Revision Write (Ignored): %02x\n", n8BitVal ); - break; - case 2: - //verboselog(machine(), 2, "XMAP0 FIFO Availability Write (Ignored): %02x\n", n8BitVal ); - break; - case 3: - //verboselog(machine(), 2, "XMAP0 Cursor CMAP MSB Write: %02x\n", n8BitVal ); - XMAP0_CURCMAP = n8BitVal; - break; - case 4: - //verboselog(machine(), 2, "XMAP0 Pop Up CMAP MSB Write: %02x\n", n8BitVal ); - XMAP0_POPUPCMAP = n8BitVal; - break; - case 5: - //verboselog(machine(), 2, "XMAP0 Mode Register Write: %02x = %06x\n", ( data & 0xff000000 ) >> 24, data & 0x00ffffff ); - m_XMAP0.nModeTable[ ( data & 0xff000000 ) >> 24 ] = data & 0x00ffffff; - break; - case 6: - //verboselog(machine(), 2, "XMAP0 Unused Write (Ignored): %08x\n", data ); - break; - case 7: - //verboselog(machine(), 2, "XMAP0 Mode Table Address Write: %02x\n", n8BitVal ); - XMAP0_MODETBLIDX = n8BitVal; - break; - } -} - -READ32_MEMBER( newport_video_device::xmap1_r ) -{ - UINT8 nModeIdx; - - switch (m_REX3.nDCBRegSelect) - { - case 0: - //verboselog(machine(), 2, "XMAP1 Config Read: %08x\n", XMAP1_CONFIG ); - return XMAP1_CONFIG; - case 1: - //verboselog(machine(), 2, "XMAP1 Revision Read: %08x\n", 0x00 ); - return 0x00000000; - case 2: - //verboselog(machine(), 2, "XMAP1 FIFO Availability Read: %08x\n", 0x02 ); - return 0x00000002; - case 3: - //verboselog(machine(), 2, "XMAP1 Cursor CMAP MSB Read: %08x\n", XMAP1_CURCMAP ); - return XMAP1_CURCMAP; - case 4: - //verboselog(machine(), 2, "XMAP1 Pop Up CMAP MSB Read: %08x\n", XMAP1_POPUPCMAP ); - return XMAP1_POPUPCMAP; - case 5: - nModeIdx = ( XMAP1_MODETBLIDX & 0x0000007c ) >> 2; - switch (XMAP1_MODETBLIDX & 0x00000003) - { - case 0: - //verboselog(machine(), 2, "XMAP1 Mode Register Read: %02x (Byte 0): %08x\n", nModeIdx, ( m_XMAP1.nModeTable[ nModeIdx ] & 0x00ff0000 ) >> 16 ); - return ( m_XMAP1.nModeTable[ nModeIdx ] & 0x00ff0000 ) >> 16; - case 1: - //verboselog(machine(), 2, "XMAP1 Mode Register Read: %02x (Byte 1): %08x\n", nModeIdx, ( m_XMAP1.nModeTable[ nModeIdx ] & 0x0000ff00 ) >> 8 ); - return ( m_XMAP1.nModeTable[ nModeIdx ] & 0x0000ff00 ) >> 8; - case 2: - //verboselog(machine(), 2, "XMAP1 Mode Register Read: %02x (Byte 2): %08x\n", nModeIdx, ( m_XMAP1.nModeTable[ nModeIdx ] & 0x000000ff ) ); - return ( m_XMAP1.nModeTable[ nModeIdx ] & 0x000000ff ); - } - break; - case 6: - //verboselog(machine(), 2, "XMAP1 Unused Read: %08x\n", 0x00000000 ); - return 0x00000000; - case 7: - //verboselog(machine(), 2, "XMAP1 Mode Table Address Read: %08x\n", XMAP0_MODETBLIDX ); - return XMAP1_MODETBLIDX; - } - - //verboselog(machine(), 2, "XMAP1 Unknown m_REX3.nDCBRegSelect Value: %02x, returning 0\n", m_REX3.nDCBRegSelect ); - return 0x00000000; -} - -WRITE32_MEMBER( newport_video_device::xmap1_w ) -{ - UINT8 n8BitVal = data & 0x000000ff; - - switch (m_REX3.nDCBRegSelect) - { - case 0: - //verboselog(machine(), 2, "XMAP1 Config Write: %02x\n", n8BitVal ); - XMAP1_CONFIG = n8BitVal; - break; - case 1: - //verboselog(machine(), 2, "XMAP1 Revision Write (Ignored): %02x\n", n8BitVal ); - break; - case 2: - //verboselog(machine(), 2, "XMAP1 FIFO Availability Write (Ignored): %02x\n", n8BitVal ); - break; - case 3: - //verboselog(machine(), 2, "XMAP1 Cursor CMAP MSB Write: %02x\n", n8BitVal ); - XMAP1_CURCMAP = n8BitVal; - break; - case 4: - //verboselog(machine(), 2, "XMAP1 Pop Up CMAP MSB Write: %02x\n", n8BitVal ); - XMAP1_POPUPCMAP = n8BitVal; - break; - case 5: - //verboselog(machine(), 2, "XMAP1 Mode Register Write: %02x = %06x\n", ( data & 0xff000000 ) >> 24, data & 0x00ffffff ); - m_XMAP1.nModeTable[ ( data & 0xff000000 ) >> 24 ] = data & 0x00ffffff; - break; - case 6: - //verboselog(machine(), 2, "XMAP1 Unused Write (Ignored): %08x\n", data ); - break; - case 7: - //verboselog(machine(), 2, "XMAP1 Mode Table Address Write: %02x\n", n8BitVal ); - XMAP1_MODETBLIDX = n8BitVal; - break; - } -} - -READ32_MEMBER( newport_video_device::vc2_r ) -{ - UINT16 ret16; - - switch (m_REX3.nDCBRegSelect) - { - case 0x01: /* Register Read */ - //verboselog(machine(), 2, "VC2 Register Read: %02x, %08x\n", m_VC2.nRegIdx, m_VC2.nRegister[m_VC2.nRegIdx] ); - return m_VC2.nRegister[m_VC2.nRegIdx]; - case 0x03: /* RAM Read */ - //verboselog(machine(), 2, "VC2 RAM Read: %04x = %08x\n", VC2_RAMADDR, m_VC2.nRAM[VC2_RAMADDR] ); - ret16 = m_VC2.nRAM[VC2_RAMADDR]; - VC2_RAMADDR++; - if( VC2_RAMADDR == 0x8000 ) - { - VC2_RAMADDR = 0x0000; - } - return ret16; - default: - //verboselog(machine(), 2, "Unknown VC2 Register Read: %02x\n", m_REX3.nDCBRegSelect ); - return 0; - } -} - -WRITE32_MEMBER( newport_video_device::vc2_w ) -{ - switch (m_REX3.nXFerWidth) - { - case 0x01: /* Register Select */ - switch (m_REX3.nDCBRegSelect) - { - case 0x00: - m_VC2.nRegIdx = ( data & 0x000000ff ) >> 0; - //verboselog(machine(), 2, "VC2 Register Select: %02x\n", m_VC2.nRegIdx ); - break; - default: - //verboselog(machine(), 2, "Unknown VC2 Register Select: DCB Register %02x, data = 0x%08x\n", m_REX3.nDCBRegSelect, data ); - break; - } - break; - case 0x02: /* RAM Write */ - switch (m_REX3.nDCBRegSelect) - { - case 0x03: - //verboselog(machine(), 2, "VC2 RAM Write: %04x = %08x\n", VC2_RAMADDR, data & 0x0000ffff ); - m_VC2.nRAM[VC2_RAMADDR] = data & 0x0000ffff; - VC2_RAMADDR++; - if( VC2_RAMADDR == 0x8000 ) - { - VC2_RAMADDR = 0x0000; - } - break; - default: - //verboselog(machine(), 2, "Unknown 2-byte Write: DCB Register %02x, data = 0x%08x\n", m_REX3.nDCBRegSelect, data ); - break; - } - break; - case 0x03: /* Register Write */ - switch (m_REX3.nDCBRegSelect) - { - case 0x00: - //verboselog(machine(), 2, "VC2 Register Setup:\n" ); - m_VC2.nRegIdx = ( data & 0xff000000 ) >> 24; - m_VC2.nRegData = ( data & 0x00ffff00 ) >> 8; - switch( m_VC2.nRegIdx ) - { - case 0x00: - //verboselog(machine(), 2, " Video Entry Pointer: %04x\n", m_VC2.nRegData ); - break; - case 0x01: - //verboselog(machine(), 2, " Cursor Entry Pointer: %04x\n", m_VC2.nRegData ); - break; - case 0x02: - //verboselog(machine(), 2, " Cursor X Location: %04x\n", m_VC2.nRegData ); - break; - case 0x03: - //verboselog(machine(), 2, " Cursor Y Location: %04x\n", m_VC2.nRegData ); - break; - case 0x04: - //verboselog(machine(), 2, " Current Cursor X: %04x\n", m_VC2.nRegData ); - break; - case 0x05: - //verboselog(machine(), 2, " DID Entry Pointer: %04x\n", m_VC2.nRegData ); - break; - case 0x06: - //verboselog(machine(), 2, " Scanline Length: %04x\n", m_VC2.nRegData ); - break; - case 0x07: - //verboselog(machine(), 2, " RAM Address: %04x\n", m_VC2.nRegData ); - break; - case 0x08: - //verboselog(machine(), 2, " VT Frame Table Ptr: %04x\n", m_VC2.nRegData ); - break; - case 0x09: - //verboselog(machine(), 2, " VT Line Sequence Ptr: %04x\n", m_VC2.nRegData ); - break; - case 0x0a: - //verboselog(machine(), 2, " VT Lines in Run: %04x\n", m_VC2.nRegData ); - break; - case 0x0b: - //verboselog(machine(), 2, " Vertical Line Count: %04x\n", m_VC2.nRegData ); - break; - case 0x0c: - //verboselog(machine(), 2, " Cursor Table Ptr: %04x\n", m_VC2.nRegData ); - break; - case 0x0d: - //verboselog(machine(), 2, " Working Cursor Y: %04x\n", m_VC2.nRegData ); - break; - case 0x0e: - //verboselog(machine(), 2, " DID Frame Table Ptr: %04x\n", m_VC2.nRegData ); - break; - case 0x0f: - //verboselog(machine(), 2, " DID Line Table Ptr: %04x\n", m_VC2.nRegData ); - break; - case 0x10: - //verboselog(machine(), 2, " Display Control: %04x\n", m_VC2.nRegData ); - break; - case 0x1f: - //verboselog(machine(), 2, " Configuration: %04x\n", m_VC2.nRegData ); - m_VC2.nRegister[0x20] = m_VC2.nRegData; - break; - default: - //verboselog(machine(), 2, " Unknown VC2 Register: %04x\n", m_VC2.nRegData ); - break; - } - m_VC2.nRegister[m_VC2.nRegIdx] = m_VC2.nRegData; - break; - default: - //verboselog(machine(), 2, "Unknown VC2 Register Write: %02x = %08x\n", m_REX3.nDCBRegSelect, data ); - break; - } - break; - default: - //verboselog(machine(), 2, "Unknown VC2 XFer Width: Width %02x, DCB Register %02x, Value 0x%08x\n", m_REX3.nXFerWidth, m_REX3.nDCBRegSelect, data ); - break; - } -} - -READ32_MEMBER( newport_video_device::rex3_r ) -{ -// UINT32 nTemp; - -// if( offset >= ( 0x0800 / 4 ) ) -// { -// //verboselog(machine(), 2, "%08x:\n", 0xbf0f0000 + ( offset << 2 ) ); -// } - switch (offset) - { - case 0x0000/4: - case 0x0800/4: - //verboselog(machine(), 2, "REX3 Draw Mode 1 Read: %08x\n", m_REX3.nDrawMode1 ); - return m_REX3.nDrawMode1; - case 0x0004/4: - case 0x0804/4: - //verboselog(machine(), 2, "REX3 Draw Mode 0 Read: %08x\n", m_REX3.nDrawMode0 ); - return m_REX3.nDrawMode0; - case 0x0008/4: - case 0x0808/4: - //verboselog(machine(), 2, "REX3 Line Stipple Mode Read: %08x\n", m_REX3.nLSMode ); - return m_REX3.nLSMode; - case 0x000c/4: - case 0x080c/4: - //verboselog(machine(), 2, "REX3 Line Stipple Pattern Read: %08x\n", m_REX3.nLSPattern ); - return m_REX3.nLSPattern; - case 0x0010/4: - case 0x0810/4: - //verboselog(machine(), 2, "REX3 Line Stipple Pattern (Save) Read: %08x\n", m_REX3.nLSPatSave ); - return m_REX3.nLSPatSave; - case 0x0014/4: - case 0x0814/4: - //verboselog(machine(), 2, "REX3 Pattern Register Read: %08x\n", m_REX3.nZPattern ); - return m_REX3.nZPattern; - case 0x0018/4: - case 0x0818/4: - //verboselog(machine(), 2, "REX3 Opaque Pattern / Blendfunc Dest Color Read: %08x\n", m_REX3.nColorBack ); - return m_REX3.nColorBack; - case 0x001c/4: - case 0x081c/4: - //verboselog(machine(), 2, "REX3 VRAM Fastclear Color Read: %08x\n", m_REX3.nColorVRAM ); - return m_REX3.nColorVRAM; - case 0x0020/4: - case 0x0820/4: - //verboselog(machine(), 2, "REX3 AFUNCTION Reference Alpha Read: %08x\n", m_REX3.nAlphaRef ); - return m_REX3.nAlphaRef; - case 0x0028/4: - case 0x0828/4: - //verboselog(machine(), 2, "REX3 Screenmask 0 X Min/Max Read: %08x\n", m_REX3.nSMask0X ); - return m_REX3.nSMask0X; - case 0x002c/4: - case 0x082c/4: - //verboselog(machine(), 2, "REX3 Screenmask 0 Y Min/Max Read: %08x\n", m_REX3.nSMask0Y ); - return m_REX3.nSMask0Y; - case 0x0030/4: - case 0x0830/4: - //verboselog(machine(), 2, "REX3 Line/Span Setup Read: %08x\n", m_REX3.nSetup ); - return m_REX3.nSetup; - case 0x0034/4: - case 0x0834/4: - //verboselog(machine(), 2, "REX3 ZPattern Enable Read: %08x\n", m_REX3.nStepZ ); - return m_REX3.nStepZ; - case 0x0100/4: - case 0x0900/4: - //verboselog(machine(), 2, "REX3 X Start Read: %08x\n", m_REX3.nXStart ); - return m_REX3.nXStart; - case 0x0104/4: - case 0x0904/4: - //verboselog(machine(), 2, "REX3 YStart Read: %08x\n", m_REX3.nYStart ); - return m_REX3.nYStart; - case 0x0108/4: - case 0x0908/4: - //verboselog(machine(), 2, "REX3 XEnd Read: %08x\n", m_REX3.nXEnd ); - return m_REX3.nXEnd; - case 0x010c/4: - case 0x090c/4: - //verboselog(machine(), 2, "REX3 YEnd Read: %08x\n", m_REX3.nYEnd ); - return m_REX3.nYEnd; - case 0x0110/4: - case 0x0910/4: - //verboselog(machine(), 2, "REX3 XSave Read: %08x\n", m_REX3.nXSave ); - return m_REX3.nXSave; - case 0x0114/4: - case 0x0914/4: - //verboselog(machine(), 2, "REX3 XYMove Read: %08x\n", m_REX3.nXYMove ); - return m_REX3.nXYMove; - case 0x0118/4: - case 0x0918/4: - //verboselog(machine(), 2, "REX3 Bresenham D Read: %08x\n", m_REX3.nBresD ); - return m_REX3.nBresD; - case 0x011c/4: - case 0x091c/4: - //verboselog(machine(), 2, "REX3 Bresenham S1 Read: %08x\n", m_REX3.nBresS1 ); - return m_REX3.nBresS1; - case 0x0120/4: - case 0x0920/4: - //verboselog(machine(), 2, "REX3 Bresenham Octant & Incr1 Read: %08x\n", m_REX3.nBresOctInc1 ); - return m_REX3.nBresOctInc1; - case 0x0124/4: - case 0x0924/4: - //verboselog(machine(), 2, "REX3 Bresenham Octant Rounding Mode & Incr2 Read: %08x\n", m_REX3.nBresRndInc2 ); - return m_REX3.nBresRndInc2; - case 0x0128/4: - case 0x0928/4: - //verboselog(machine(), 2, "REX3 Bresenham E1 Read: %08x\n", m_REX3.nBresE1 ); - return m_REX3.nBresE1; - case 0x012c/4: - case 0x092c/4: - //verboselog(machine(), 2, "REX3 Bresenham S2 Read: %08x\n", m_REX3.nBresS2 ); - return m_REX3.nBresS2; - case 0x0130/4: - case 0x0930/4: - //verboselog(machine(), 2, "REX3 AA Line Weight Table 1/2 Read: %08x\n", m_REX3.nAWeight0 ); - return m_REX3.nAWeight0; - case 0x0134/4: - case 0x0934/4: - //verboselog(machine(), 2, "REX3 AA Line Weight Table 2/2 Read: %08x\n", m_REX3.nAWeight1 ); - return m_REX3.nAWeight1; - case 0x0138/4: - case 0x0938/4: - //verboselog(machine(), 2, "REX3 GL XStart Read: %08x\n", m_REX3.nXStartF ); - return m_REX3.nXStartF; - case 0x013c/4: - case 0x093c/4: - //verboselog(machine(), 2, "REX3 GL YStart Read: %08x\n", m_REX3.nYStartF ); - return m_REX3.nYStartF; - case 0x0140/4: - case 0x0940/4: - //verboselog(machine(), 2, "REX3 GL XEnd Read: %08x\n", m_REX3.nXEndF ); - return m_REX3.nXEndF; - case 0x0144/4: - case 0x0944/4: - //verboselog(machine(), 2, "REX3 GL YEnd Read: %08x\n", m_REX3.nYEndF ); - return m_REX3.nYEndF; - case 0x0148/4: - case 0x0948/4: - //verboselog(machine(), 2, "REX3 XStart (integer) Read: %08x\n", m_REX3.nXStartI ); - return m_REX3.nXStartI; - case 0x014c/4: - case 0x094c/4: - //verboselog(machine(), 2, "REX3 GL XEnd (copy) Read: %08x\n", m_REX3.nXEndF ); - return m_REX3.nXEndF; - case 0x0150/4: - case 0x0950/4: - //verboselog(machine(), 2, "REX3 XYStart (integer) Read: %08x\n", m_REX3.nXYStartI ); - return m_REX3.nXYStartI; - case 0x0154/4: - case 0x0954/4: - //verboselog(machine(), 2, "REX3 XYEnd (integer) Read: %08x\n", m_REX3.nXYEndI ); - return m_REX3.nXYEndI; - case 0x0158/4: - case 0x0958/4: - //verboselog(machine(), 2, "REX3 XStartEnd (integer) Read: %08x\n", m_REX3.nXStartEndI ); - return m_REX3.nXStartEndI; - case 0x0200/4: - case 0x0a00/4: - //verboselog(machine(), 2, "REX3 Red/CI Full State Read: %08x\n", m_REX3.nColorRed ); - return m_REX3.nColorRed; - case 0x0204/4: - case 0x0a04/4: - //verboselog(machine(), 2, "REX3 Alpha Full State Read: %08x\n", m_REX3.nColorAlpha ); - return m_REX3.nColorAlpha; - case 0x0208/4: - case 0x0a08/4: - //verboselog(machine(), 2, "REX3 Green Full State Read: %08x\n", m_REX3.nColorGreen ); - return m_REX3.nColorGreen; - case 0x020c/4: - case 0x0a0c/4: - //verboselog(machine(), 2, "REX3 Blue Full State Read: %08x\n", m_REX3.nColorBlue ); - return m_REX3.nColorBlue; - case 0x0210/4: - case 0x0a10/4: - //verboselog(machine(), 2, "REX3 Red/CI Slope Read: %08x\n", m_REX3.nSlopeRed ); - return m_REX3.nSlopeRed; - case 0x0214/4: - case 0x0a14/4: - //verboselog(machine(), 2, "REX3 Alpha Slope Read: %08x\n", m_REX3.nSlopeAlpha ); - return m_REX3.nSlopeAlpha; - case 0x0218/4: - case 0x0a18/4: - //verboselog(machine(), 2, "REX3 Green Slope Read: %08x\n", m_REX3.nSlopeGreen ); - return m_REX3.nSlopeGreen; - case 0x021c/4: - case 0x0a1c/4: - //verboselog(machine(), 2, "REX3 Blue Slope Read: %08x\n", m_REX3.nSlopeBlue ); - return m_REX3.nSlopeBlue; - case 0x0220/4: - case 0x0a20/4: - //verboselog(machine(), 2, "REX3 Write Mask Read: %08x\n", m_REX3.nWriteMask ); - return m_REX3.nWriteMask; - case 0x0224/4: - case 0x0a24/4: - //verboselog(machine(), 2, "REX3 Packed Color Fractions Read: %08x\n", m_REX3.nZeroFract ); - return m_REX3.nZeroFract; - case 0x0228/4: - case 0x0a28/4: - //verboselog(machine(), 2, "REX3 Color Index Zeros Overflow Read: %08x\n", m_REX3.nZeroOverflow ); - return m_REX3.nZeroOverflow; - case 0x022c/4: - case 0x0a2c/4: - //verboselog(machine(), 2, "REX3 Red/CI Slope (copy) Read: %08x\n", m_REX3.nSlopeRed ); - return m_REX3.nSlopeRed; - case 0x0230/4: - case 0x0a30/4: - //verboselog(machine(), 2, "REX3 Host Data Port MSW Read: %08x\n", m_REX3.nHostDataPortMSW ); - return m_REX3.nHostDataPortMSW; - case 0x0234/4: - case 0x0a34/4: - //verboselog(machine(), 2, "REX3 Host Data Port LSW Read: %08x\n", m_REX3.nHostDataPortLSW ); - return m_REX3.nHostDataPortLSW; - case 0x0238/4: - case 0x0a38/4: - //verboselog(machine(), 2, "REX3 Display Control Bus Mode Read: %08x\n", m_REX3.nDCBMode ); - return m_REX3.nDCBMode; - case 0x0240/4: - case 0x0a40/4: - switch (m_REX3.nDCBSlvSelect) - { - case 0x00: - return vc2_r(space, 0, mem_mask); - case 0x02: - return cmap0_r(space, 0, mem_mask); - case 0x03: - return cmap1_r(space, 0, mem_mask); - case 0x05: - return xmap0_r(space, 0, mem_mask); - case 0x06: - return xmap1_r(space, 0, mem_mask); - default: - //verboselog(machine(), 2, "REX3 Display Control Bus Data MSW Read: %08x\n", m_REX3.nDCBDataMSW ); - break; - } - return m_REX3.nDCBDataMSW; - case 0x0244/4: - case 0x0a44/4: - //verboselog(machine(), 2, "REX3 Display Control Bus Data LSW Read: %08x\n", m_REX3.nDCBDataLSW ); - return m_REX3.nDCBDataLSW; - case 0x1300/4: - //verboselog(machine(), 2, "REX3 Screenmask 1 X Min/Max Read: %08x\n", m_REX3.nSMask1X ); - return m_REX3.nSMask1X; - case 0x1304/4: - //verboselog(machine(), 2, "REX3 Screenmask 1 Y Min/Max Read: %08x\n", m_REX3.nSMask1Y ); - return m_REX3.nSMask1Y; - case 0x1308/4: - //verboselog(machine(), 2, "REX3 Screenmask 2 X Min/Max Read: %08x\n", m_REX3.nSMask2X ); - return m_REX3.nSMask2X; - case 0x130c/4: - //verboselog(machine(), 2, "REX3 Screenmask 2 Y Min/Max Read: %08x\n", m_REX3.nSMask2Y ); - return m_REX3.nSMask2Y; - case 0x1310/4: - //verboselog(machine(), 2, "REX3 Screenmask 3 X Min/Max Read: %08x\n", m_REX3.nSMask3X ); - return m_REX3.nSMask3X; - case 0x1314/4: - //verboselog(machine(), 2, "REX3 Screenmask 3 Y Min/Max Read: %08x\n", m_REX3.nSMask3Y ); - return m_REX3.nSMask3Y; - case 0x1318/4: - //verboselog(machine(), 2, "REX3 Screenmask 4 X Min/Max Read: %08x\n", m_REX3.nSMask4X ); - return m_REX3.nSMask4X; - case 0x131c/4: - //verboselog(machine(), 2, "REX3 Screenmask 4 Y Min/Max Read: %08x\n", m_REX3.nSMask4Y ); - return m_REX3.nSMask4Y; - case 0x1320/4: - //verboselog(machine(), 2, "REX3 Top of Screen Scanline Read: %08x\n", m_REX3.nTopScanline ); - return m_REX3.nTopScanline; - case 0x1324/4: - //verboselog(machine(), 2, "REX3 Clipping Mode Read: %08x\n", m_REX3.nXYWin ); - return m_REX3.nXYWin; - case 0x1328/4: - //verboselog(machine(), 2, "REX3 Clipping Mode Read: %08x\n", m_REX3.nClipMode ); - return m_REX3.nClipMode; - case 0x1330/4: - //verboselog(machine(), 2, "REX3 Config Read: %08x\n", m_REX3.nConfig ); - return m_REX3.nConfig; - case 0x1338/4: - //verboselog(machine(), 2, "REX3 Status Read: %08x\n", 0x00000001 ); -// nTemp = m_REX3.nStatus; - m_REX3.nStatus = 0; - return 0x00000001; - case 0x133c/4: - //verboselog(machine(), 2, "REX3 User Status Read: %08x\n", 0x00000001 ); - return 0x00000001; - default: - //verboselog(machine(), 2, "Unknown REX3 Read: %08x (%08x)\n", 0x1f0f0000 + ( offset << 2 ), mem_mask ); - return 0; - } -} - -void newport_video_device::DoREX3Command() -{ - UINT32 nCommand = ( ( m_REX3.nDrawMode0 & ( 1 << 15 ) ) >> 15 ) | - ( ( m_REX3.nDrawMode0 & ( 1 << 5 ) ) >> 4 ) | - ( ( m_REX3.nDrawMode0 & ( 1 << 9 ) ) >> 7 ) | - ( ( m_REX3.nDrawMode0 & ( 1 << 8 ) ) >> 5 ) | - ( ( m_REX3.nDrawMode0 & 0x0000001c ) << 2 ) | - ( ( m_REX3.nDrawMode0 & 0x00000003 ) << 7 ); - UINT16 nX, nY; - UINT16 nStartX = ( m_REX3.nXYStartI >> 16 ) & 0x0000ffff; - UINT16 nStartY = ( m_REX3.nXYStartI >> 0 ) & 0x0000ffff; - UINT16 nEndX = ( m_REX3.nXYEndI >> 16 ) & 0x0000ffff; - UINT16 nEndY = ( m_REX3.nXYEndI >> 0 ) & 0x0000ffff; - INT16 nMoveX, nMoveY; - - switch (nCommand) - { - case 0x00000110: - nX = nStartX; - nY = nStartY; - //verboselog(machine(), 3, "Tux Logo Draw: %04x, %04x = %08x\n", nX, nY, m_CMAP0.nPalette[ ( m_REX3.nHostDataPortMSW & 0xff000000 ) >> 24 ] ); -// m_REX3.nKludge_SkipLine = 1; - m_REX3.nBresOctInc1 = 0; - m_base[ nY*(1280+64) + nX ] = m_CMAP0.nPalette[ ( m_REX3.nHostDataPortMSW & 0xff000000 ) >> 24 ]; - nX++; - if( nX > ( ( m_REX3.nXYEndI & 0xffff0000 ) >> 16 ) ) - { - nY++; - nX = m_REX3.nXSave; - } - m_REX3.nXYStartI = ( nX << 16 ) | nY; - m_REX3.nXStartI = nX; - m_REX3.nXStart = 0 | ( ( m_REX3.nXYStartI & 0xffff0000 ) >> 5 ); - m_REX3.nYStart = 0 | ( ( m_REX3.nXYStartI & 0x0000ffff ) << 11 ); - break; - case 0x0000011e: - //verboselog(machine(), 3, "Block draw: %04x, %04x to %04x, %04x = %08x\n", nStartX, nStartY, nEndX, nEndY, m_CMAP0.nPalette[ m_REX3.nZeroFract ] ); - for( nY = nStartY; nY <= nEndY; nY++ ) - { - //verboselog(machine(), 3, "Pixel: %04x, %04x = %08x\n", nStartX, nY, m_CMAP0.nPalette[ m_REX3.nZeroFract ] ); - for( nX = nStartX; nX <= nEndX; nX++ ) - { - m_base[ nY*(1280+64) + nX ] = m_CMAP0.nPalette[ m_REX3.nZeroFract ]; - } - } - break; - case 0x00000119: - if( !m_REX3.nKludge_SkipLine ) - { - //verboselog(machine(), 3, "Pattern Line Draw: %08x at %04x, %04x color %08x\n", m_REX3.nZPattern, m_REX3.nXYStartI >> 16, m_REX3.nXYStartI & 0x0000ffff, m_CMAP0.nPalette[ m_REX3.nZeroFract ] ); - for( nX = nStartX; nX <= nEndX && nX < ( nStartX + 32 ); nX++ ) - { - if( m_REX3.nZPattern & ( 1 << ( 31 - ( nX - nStartX ) ) ) ) - { - m_base[ nStartY*(1280+64) + nX ] = m_CMAP0.nPalette[ m_REX3.nZeroFract ]; - } - } - if( m_REX3.nBresOctInc1 & 0x01000000 ) - { - nStartY--; - } - else - { - nStartY++; - } - m_REX3.nXYStartI = ( nStartX << 16 ) | nStartY; - m_REX3.nYStart = 0 | ( ( m_REX3.nXYStartI & 0x0000ffff ) << 11 ); - } - break; - case 0x0000019e: - nMoveX = (INT16)( ( m_REX3.nXYMove >> 16 ) & 0x0000ffff ); - nMoveY = (INT16)( m_REX3.nXYMove & 0x0000ffff ); - //verboselog(machine(), 1, "FB to FB Copy: %04x, %04x - %04x, %04x to %04x, %04x\n", nStartX, nStartY, nEndX, nEndY, nStartX + nMoveX, nStartY + nMoveY ); - for( nY = nStartY; nY <= nEndY; nY++ ) - { - for( nX = nStartX; nX <= nEndX; nX++ ) - { - m_base[ (nY + nMoveY)*(1280+64) + (nX + nMoveX) ] = m_base[ nY*(1280+64) + nX ]; - } - } - break; - default: - //verboselog(machine(), 1, "Unknown draw command: %08x\n", nCommand ); - break; - } -} - -WRITE32_MEMBER( newport_video_device::rex3_w ) -{ - UINT32 nTemp = 0; - - if( offset & 0x00000200 ) - { - //verboselog(machine(), 2, "Start Cmd\n" ); - } - switch( offset ) - { - case 0x0000/4: - case 0x0800/4: - //verboselog(machine(), 2, "REX3 Draw Mode 1 Write: %08x\n", data ); - switch( data & 0x00000007 ) - { - case 0x00: - //verboselog(machine(), 2, " Planes Enabled: None\n" ); - break; - case 0x01: - //verboselog(machine(), 2, " Planes Enabled: R/W RGB/CI\n" ); - break; - case 0x02: - //verboselog(machine(), 2, " Planes Enabled: R/W RGBA\n" ); - break; - case 0x03: - //verboselog(machine(), 2, " Planes Enabled: R/W OLAY\n" ); - break; - case 0x04: - //verboselog(machine(), 2, " Planes Enabled: R/W PUP\n" ); - break; - case 0x05: - //verboselog(machine(), 2, " Planes Enabled: R/W CID\n" ); - break; - default: - //verboselog(machine(), 2, " Unknown Plane Enable Value\n" ); - break; - } - switch( ( data & 0x00000018 ) >> 3 ) - { - case 0x00: - //verboselog(machine(), 2, " Plane Draw Depth: 4 bits\n" ); - break; - case 0x01: - //verboselog(machine(), 2, " Plane Draw Depth: 8 bits\n" ); - break; - case 0x02: - //verboselog(machine(), 2, " Plane Draw Depth: 12 bits\n" ); - break; - case 0x03: - //verboselog(machine(), 2, " Plane Draw Depth: 32 bits\n" ); - break; - } - //verboselog(machine(), 2, " DBuf Source Buffer: %d\n", ( data & 0x00000020 ) >> 5 ); - //verboselog(machine(), 2, " GL Y Coordinates: %d\n", ( data & 0x00000040 ) >> 6 ); - //verboselog(machine(), 2, " Enable Pxl Packing: %d\n", ( data & 0x00000080 ) >> 7 ); - switch( ( data & 0x00000300 ) >> 8 ) - { - case 0x00: - //verboselog(machine(), 2, " HOSTRW Depth: 4 bits\n" ); - break; - case 0x01: - //verboselog(machine(), 2, " HOSTRW Depth: 8 bits\n" ); - break; - case 0x02: - //verboselog(machine(), 2, " HOSTRW Depth: 12 bits\n" ); - break; - case 0x03: - //verboselog(machine(), 2, " HOSTRW Depth: 32 bits\n" ); - break; - } - //verboselog(machine(), 2, " DWord Transfers: %d\n", ( data & 0x00000400 ) >> 10 ); - //verboselog(machine(), 2, " Swap Endianness: %d\n", ( data & 0x00000800 ) >> 11 ); - //verboselog(machine(), 2, " Compare Src > Dest: %d\n", ( data & 0x00001000 ) >> 12 ); - //verboselog(machine(), 2, " Compare Src = Dest: %d\n", ( data & 0x00002000 ) >> 13 ); - //verboselog(machine(), 2, " Compare Src < Dest: %d\n", ( data & 0x00004000 ) >> 14 ); - //verboselog(machine(), 2, " RGB Mode Select: %d\n", ( data & 0x00008000 ) >> 15 ); - //verboselog(machine(), 2, " Enable Dithering: %d\n", ( data & 0x00010000 ) >> 16 ); - //verboselog(machine(), 2, " Enable Fast Clear: %d\n", ( data & 0x00020000 ) >> 17 ); - //verboselog(machine(), 2, " Enable Blending: %d\n", ( data & 0x00040000 ) >> 18 ); - switch( ( data & 0x00380000 ) >> 19 ) - { - case 0x00: - //verboselog(machine(), 2, " Src Blend Factor: 0\n" ); - break; - case 0x01: - //verboselog(machine(), 2, " Src Blend Factor: 1\n" ); - break; - case 0x02: - //verboselog(machine(), 2, " Src Blend Factor: Normalized Dest (or COLORBACK)\n" ); - break; - case 0x03: - //verboselog(machine(), 2, " Src Blend Factor: 1 - Normalized Dest (or COLORBACK)\n" ); - break; - case 0x04: - //verboselog(machine(), 2, " Src Blend Factor: Normalized Src\n" ); - break; - case 0x05: - //verboselog(machine(), 2, " Src Blend Factor: 1 - Normalized Src\n" ); - break; - default: - //verboselog(machine(), 2, " Unknown Src Blend Factor: %02x\n", ( data & 0x00380000 ) >> 19 ); - break; - } - switch( ( data & 0x01c00000 ) >> 22 ) - { - case 0x00: - //verboselog(machine(), 2, " Dest Blend Factor: 0\n" ); - break; - case 0x01: - //verboselog(machine(), 2, " Dest Blend Factor: 1\n" ); - break; - case 0x02: - //verboselog(machine(), 2, " Dest Blend Factor: Normalized Dest (or COLORBACK)\n" ); - break; - case 0x03: - //verboselog(machine(), 2, " Dest Blend Factor: 1 - Normalized Dest (or COLORBACK)\n" ); - break; - case 0x04: - //verboselog(machine(), 2, " Dest Blend Factor: Normalized Src\n" ); - break; - case 0x05: - //verboselog(machine(), 2, " Dest Blend Factor: 1 - Normalized Src\n" ); - break; - default: - //verboselog(machine(), 2, " Unknown Src Blend Factor: %02x\n", ( data & 0x00380000 ) >> 19 ); - break; - } - //verboselog(machine(), 2, " COLORBACK Dest Blend: %d\n", ( data & 0x02000000 ) >> 25 ); - //verboselog(machine(), 2, " Enable Pxl Prefetch: %d\n", ( data & 0x04000000 ) >> 26 ); - //verboselog(machine(), 2, " SFACTOR Src Alpha: %d\n", ( data & 0x08000000 ) >> 27 ); - switch( ( data & 0xf0000000 ) >> 28 ) - { - case 0x00: - //verboselog(machine(), 2, " Logical Op. Type: 0\n" ); - break; - case 0x01: - //verboselog(machine(), 2, " Logical Op. Type: Src & Dst\n" ); - break; - case 0x02: - //verboselog(machine(), 2, " Logical Op. Type: Src & ~Dst\n" ); - break; - case 0x03: - //verboselog(machine(), 2, " Logical Op. Type: Src\n" ); - break; - case 0x04: - //verboselog(machine(), 2, " Logical Op. Type: ~Src & Dst\n" ); - break; - case 0x05: - //verboselog(machine(), 2, " Logical Op. Type: Dst\n" ); - break; - case 0x06: - //verboselog(machine(), 2, " Logical Op. Type: Src ^ Dst\n" ); - break; - case 0x07: - //verboselog(machine(), 2, " Logical Op. Type: Src | Dst\n" ); - break; - case 0x08: - //verboselog(machine(), 2, " Logical Op. Type: ~(Src | Dst)\n" ); - break; - case 0x09: - //verboselog(machine(), 2, " Logical Op. Type: ~(Src ^ Dst)\n" ); - break; - case 0x0a: - //verboselog(machine(), 2, " Logical Op. Type: ~Dst\n" ); - break; - case 0x0b: - //verboselog(machine(), 2, " Logical Op. Type: Src | ~Dst\n" ); - break; - case 0x0c: - //verboselog(machine(), 2, " Logical Op. Type: ~Src\n" ); - break; - case 0x0d: - //verboselog(machine(), 2, " Logical Op. Type: ~Src | Dst\n" ); - break; - case 0x0e: - //verboselog(machine(), 2, " Logical Op. Type: ~(Src & Dst)\n" ); - break; - case 0x0f: - //verboselog(machine(), 2, " Logical Op. Type: 1\n" ); - break; - } - m_REX3.nDrawMode1 = data; -// if( offset >= ( 0x800 / 4 ) ) -// { -// DoREX3Command(); -// } - break; - case 0x0004/4: - //verboselog(machine(), 2, "REX3 Draw Mode 0 Write: %08x\n", data ); - switch( data & 0x00000003 ) - { - case 0x00: - //verboselog(machine(), 2, " Primitive Function: No Op\n" ); - break; - case 0x01: - //verboselog(machine(), 2, " Primitive Function: Read From FB\n" ); - break; - case 0x02: - //verboselog(machine(), 2, " Primitive Function: Draw To FB\n" ); - break; - case 0x03: - //verboselog(machine(), 2, " Primitive Function: Copy FB To FB\n" ); - break; - } - switch( ( data & 0x0000001c ) >> 2 ) - { - case 0x00: - //verboselog(machine(), 2, " Addressing Mode: Span/Point\n" ); - break; - case 0x01: - //verboselog(machine(), 2, " Addressing Mode: Block\n" ); - break; - case 0x02: - //verboselog(machine(), 2, " Addressing Mode: Bresenham Line, Integer Endpoints\n" ); - break; - case 0x03: - //verboselog(machine(), 2, " Addressing Mode: Bresenham Line, Fractional Endpoints\n" ); - break; - case 0x04: - //verboselog(machine(), 2, " Addressing Mode: AA Bresenham Line\n" ); - break; - default: - //verboselog(machine(), 2, " Unknown Addressing Mode: %02x\n", ( data & 0x0000001c ) >> 2 ); - break; - } - //verboselog(machine(), 2, " Iterator Setup: %d\n", ( data & 0x00000020 ) >> 5 ); - //verboselog(machine(), 2, " RGB/CI Draw Source: %d\n", ( data & 0x00000040 ) >> 6 ); - //verboselog(machine(), 2, " Alpha Draw Source: %d\n", ( data & 0x00000080 ) >> 7 ); - //verboselog(machine(), 2, " Stop On X: %d\n", ( data & 0x00000100 ) >> 8 ); - //verboselog(machine(), 2, " Stop On Y: %d\n", ( data & 0x00000200 ) >> 9 ); - //verboselog(machine(), 2, " Skip Start Point: %d\n", ( data & 0x00000400 ) >> 10 ); - //verboselog(machine(), 2, " Skip End Point: %d\n", ( data & 0x00000800 ) >> 11 ); - //verboselog(machine(), 2, " Enable Patterning: %d\n", ( data & 0x00001000 ) >> 12 ); - //verboselog(machine(), 2, " Enable Stippling: %d\n", ( data & 0x00002000 ) >> 13 ); - //verboselog(machine(), 2, " Stipple Advance: %d\n", ( data & 0x00004000 ) >> 14 ); - //verboselog(machine(), 2, " Limit Draw To 32px: %d\n", ( data & 0x00008000 ) >> 15 ); - //verboselog(machine(), 2, " Z Opaque Stipple %d\n", ( data & 0x00010000 ) >> 16 ); - //verboselog(machine(), 2, " LS Opaque Stipple: %d\n", ( data & 0x00020000 ) >> 17 ); - //verboselog(machine(), 2, " Enable Lin. Shade: %d\n", ( data & 0x00040000 ) >> 18 ); - //verboselog(machine(), 2, " Left-Right Only: %d\n", ( data & 0x00080000 ) >> 19 ); - //verboselog(machine(), 2, " Offset by XYMove: %d\n", ( data & 0x00100000 ) >> 20 ); - //verboselog(machine(), 2, " Enable CI Clamping: %d\n", ( data & 0x00200000 ) >> 21 ); - //verboselog(machine(), 2, " Enable End Filter: %d\n", ( data & 0x00400000 ) >> 22 ); - //verboselog(machine(), 2, " Enable Y+2 Stride: %d\n", ( data & 0x00800000 ) >> 23 ); - m_REX3.nDrawMode0 = data; - break; - case 0x0804/4: - //verboselog(machine(), 2, "REX3 Draw Mode 0 Write: %08x\n", data ); - m_REX3.nDrawMode0 = data; - break; - case 0x0008/4: - case 0x0808/4: - //verboselog(machine(), 2, "REX3 Line Stipple Mode Write: %08x\n", data ); - m_REX3.nLSMode = data & 0x0fffffff; - break; - case 0x000C/4: - case 0x080c/4: - //verboselog(machine(), 2, "REX3 Line Stipple Pattern Write: %08x\n", data ); - m_REX3.nLSPattern = data; - break; - case 0x0010/4: - case 0x0810/4: - //verboselog(machine(), 2, "REX3 Line Stipple Pattern (Save) Write: %08x\n", data ); - m_REX3.nLSPatSave = data; - break; - case 0x0014/4: - case 0x0814/4: - //verboselog(machine(), 2, "REX3 Pattern Register Write: %08x\n", data ); - m_REX3.nZPattern = data; - if (offset & 0x00000200) - { - DoREX3Command(); - } - break; - case 0x0018/4: - case 0x0818/4: - //verboselog(machine(), 2, "REX3 Opaque Pattern / Blendfunc Dest Color Write: %08x\n", data ); - m_REX3.nColorBack = data; - break; - case 0x001c/4: - case 0x081c/4: - //verboselog(machine(), 2, "REX3 VRAM Fastclear Color Write: %08x\n", data ); - m_REX3.nColorVRAM = data; - break; - case 0x0020/4: - case 0x0820/4: - //verboselog(machine(), 2, "REX3 AFUNCTION Reference Alpha Write: %08x\n", data ); - m_REX3.nAlphaRef = data & 0x000000ff; - break; - case 0x0024/4: - case 0x0824/4: - //verboselog(machine(), 2, "REX3 Stall GFIFO Write: %08x\n", data ); - break; - case 0x0028/4: - case 0x0828/4: - //verboselog(machine(), 2, "REX3 Screenmask 0 X Min/Max Write: %08x\n", data ); - m_REX3.nSMask0X = data; - break; - case 0x002c/4: - case 0x082c/4: - //verboselog(machine(), 2, "REX3 Screenmask 0 Y Min/Max Write: %08x\n", data ); - m_REX3.nSMask0Y = data; - break; - case 0x0030/4: - case 0x0830/4: - //verboselog(machine(), 2, "REX3 Line/Span Setup Write: %08x\n", data ); - m_REX3.nSetup = data; - break; - case 0x0034/4: - case 0x0834/4: - //verboselog(machine(), 2, "REX3 ZPattern Enable Write: %08x\n", data ); - m_REX3.nStepZ = data; - break; - case 0x0038/4: - case 0x0838/4: - //verboselog(machine(), 2, "REX3 Update LSPATTERN/LSRCOUNT\n" ); - m_REX3.nLSPattern = m_REX3.nLSPatSave; - break; - case 0x003c/4: - case 0x083c/4: - //verboselog(machine(), 2, "REX3 Update LSPATSAVE/LSRCNTSAVE\n" ); - m_REX3.nLSPatSave = m_REX3.nLSPattern; - break; - case 0x0100/4: - case 0x0900/4: - //verboselog(machine(), 2, "REX3 XStart Write: %08x\n", data ); - m_REX3.nXStart = data & ( 0x0000fffff << 7 ); - break; - case 0x0104/4: - case 0x0904/4: - //verboselog(machine(), 2, "REX3 YStart Write: %08x\n", data ); - m_REX3.nYStart = data & ( 0x0000fffff << 7 ); - break; - case 0x0108/4: - case 0x0908/4: - //verboselog(machine(), 2, "REX3 XEnd Write: %08x\n", data ); - m_REX3.nXEnd = data & ( 0x0000fffff << 7 ); - break; - case 0x010c/4: - case 0x090c/4: - //verboselog(machine(), 2, "REX3 YEnd Write: %08x\n", data ); - m_REX3.nYEnd = data & ( 0x0000fffff << 7 ); - break; - case 0x0110/4: - case 0x0910/4: - //verboselog(machine(), 2, "REX3 XSave Write: %08x\n", data ); - m_REX3.nXSave = data & 0x0000ffff; - m_REX3.nXStartI = m_REX3.nXSave & 0x0000ffff; - break; - case 0x0114/4: - case 0x0914/4: - //verboselog(machine(), 2, "REX3 XYMove Write: %08x\n", data ); - m_REX3.nXYMove = data; - if (offset & 0x00000200) - { - DoREX3Command(); - } - break; - case 0x0118/4: - case 0x0918/4: - //verboselog(machine(), 2, "REX3 Bresenham D Write: %08x\n", data ); - m_REX3.nBresD = data & 0x07ffffff; - break; - case 0x011c/4: - case 0x091c/4: - //verboselog(machine(), 2, "REX3 Bresenham S1 Write: %08x\n", data ); - m_REX3.nBresS1 = data & 0x0001ffff; - break; - case 0x0120/4: - case 0x0920/4: - //verboselog(machine(), 2, "REX3 Bresenham Octant & Incr1 Write: %08x\n", data ); - m_REX3.nBresOctInc1 = data & 0x070fffff; - break; - case 0x0124/4: - case 0x0924/4: - //verboselog(machine(), 2, "REX3 Bresenham Octant Rounding Mode & Incr2 Write: %08x\n", data ); - m_REX3.nBresRndInc2 = data & 0xff1fffff; - break; - case 0x0128/4: - case 0x0928/4: - //verboselog(machine(), 2, "REX3 Bresenham E1 Write: %08x\n", data ); - m_REX3.nBresE1 = data & 0x0000ffff; - break; - case 0x012c/4: - case 0x092c/4: - //verboselog(machine(), 2, "REX3 Bresenham S2 Write: %08x\n", data ); - m_REX3.nBresS2 = data & 0x03ffffff; - break; - case 0x0130/4: - case 0x0930/4: - //verboselog(machine(), 2, "REX3 AA Line Weight Table 1/2 Write: %08x\n", data ); - m_REX3.nAWeight0 = data; - break; - case 0x0134/4: - case 0x0934/4: - //verboselog(machine(), 2, "REX3 AA Line Weight Table 2/2 Write: %08x\n", data ); - m_REX3.nAWeight1 = data; - break; - case 0x0138/4: - case 0x0938/4: - //verboselog(machine(), 2, "REX3 GL XStart Write: %08x\n", data ); - m_REX3.nXStartF = data & ( 0x0000ffff << 7 ); - break; - case 0x013c/4: - case 0x093c/4: - //verboselog(machine(), 2, "REX3 GL YStart Write: %08x\n", data ); - m_REX3.nYStartF = data & ( 0x0000ffff << 7 ); - break; - case 0x0140/4: - case 0x0940/4: - //verboselog(machine(), 2, "REX3 GL XEnd Write: %08x\n", data ); - m_REX3.nXEndF = data & ( 0x0000ffff << 7 ); - break; - case 0x0144/4: - case 0x0944/4: - //verboselog(machine(), 2, "REX3 GL YEnd Write: %08x\n", data ); - m_REX3.nYEndF = data & ( 0x0000ffff << 7 ); - break; - case 0x0148/4: - case 0x0948/4: - //verboselog(machine(), 2, "REX3 XStart (integer) Write: %08x\n", data ); - m_REX3.nXStartI = data & 0x0000ffff; - m_REX3.nXSave = m_REX3.nXStartI; - m_REX3.nXStart = 0 | ( ( m_REX3.nXStartI & 0x0000ffff ) << 11 ); - break; - case 0x014c/4: - case 0x094c/4: - //verboselog(machine(), 2, "REX3 GL XEnd (copy) Write: %08x\n", data ); - m_REX3.nXEndF = data & ( 0x0000ffff << 7 ); - break; - case 0x0150/4: - case 0x0950/4: - //verboselog(machine(), 2, "REX3 XYStart (integer) Write: %08x\n", data ); - m_REX3.nXYStartI = data; - m_REX3.nXStartI = ( data & 0xffff0000 ) >> 16; - m_REX3.nXSave = m_REX3.nXStartI; - m_REX3.nXStart = 0 | ( ( m_REX3.nXYStartI & 0xffff0000 ) >> 5 ); - m_REX3.nYStart = 0 | ( ( m_REX3.nXYStartI & 0x0000ffff ) << 11 ); - break; - case 0x0154/4: - case 0x0954/4: - //verboselog(machine(), 2, "REX3 XYEnd (integer) Write: %08x\n", data ); - m_REX3.nXYEndI = data; - m_REX3.nXEnd = 0 | ( ( m_REX3.nXYEndI & 0xffff0000 ) >> 5 ); - m_REX3.nYEnd = 0 | ( ( m_REX3.nXYEndI & 0x0000ffff ) << 11 ); - if (offset & 0x00000200) - { - DoREX3Command(); - } - break; - case 0x0158/4: - case 0x0958/4: - //verboselog(machine(), 2, "REX3 XStartEnd (integer) Write: %08x\n", data ); - m_REX3.nXStartEndI = data; - m_REX3.nXYEndI = ( m_REX3.nXYEndI & 0x0000ffff ) | ( ( m_REX3.nXStartEndI & 0x0000ffff ) << 16 ); - m_REX3.nXYStartI = ( m_REX3.nXYStartI & 0x0000ffff ) | ( m_REX3.nXStartEndI & 0xffff0000 ); - m_REX3.nXSave = m_REX3.nXStartI; - m_REX3.nXStart = 0 | ( ( m_REX3.nXStartEndI & 0xffff0000 ) >> 5 ); - m_REX3.nXEnd = 0 | ( ( m_REX3.nXStartEndI & 0x0000ffff ) << 11 ); - break; - case 0x0200/4: - case 0x0a00/4: - //verboselog(machine(), 2, "REX3 Red/CI Full State Write: %08x\n", data ); - m_REX3.nColorRed = data & 0x00ffffff; - break; - case 0x0204/4: - case 0x0a04/4: - //verboselog(machine(), 2, "REX3 Alpha Full State Write: %08x\n", data ); - m_REX3.nColorAlpha = data & 0x000fffff; - break; - case 0x0208/4: - case 0x0a08/4: - //verboselog(machine(), 2, "REX3 Green Full State Write: %08x\n", data ); - m_REX3.nColorGreen = data & 0x000fffff; - break; - case 0x020c/4: - case 0x0a0c/4: - //verboselog(machine(), 2, "REX3 Blue Full State Write: %08x\n", data ); - m_REX3.nColorBlue = data & 0x000fffff; - break; - case 0x0210/4: - case 0x0a10/4: - //verboselog(machine(), 2, "REX3 Red/CI Slope Write: %08x\n", data ); - data &= 0x807fffff; - switch( data & 0x80000000 ) - { - case 0x00000000: - nTemp = data & 0x007fffff; - break; - case 0x80000000: - nTemp = 0x00800000 - ( data & 0x007fffff ); - nTemp |= 0x00800000; - break; - } - m_REX3.nSlopeRed = nTemp; - break; - case 0x0214/4: - case 0x0a14/4: - //verboselog(machine(), 2, "REX3 Alpha Slope Write: %08x\n", data ); - data &= 0x8007ffff; - switch( data & 0x80000000 ) - { - case 0x00000000: - nTemp = data & 0x0007ffff; - break; - case 0x80000000: - nTemp = 0x00080000 - ( data & 0x0007ffff ); - nTemp |= 0x00080000; - break; - } - m_REX3.nSlopeAlpha = nTemp; - break; - case 0x0218/4: - case 0x0a18/4: - //verboselog(machine(), 2, "REX3 Green Slope Write: %08x\n", data ); - data &= 0x8007ffff; - switch( data & 0x80000000 ) - { - case 0x00000000: - nTemp = data & 0x0007ffff; - break; - case 0x80000000: - nTemp = 0x00080000 - ( data & 0x0007ffff ); - nTemp |= 0x00080000; - break; - } - m_REX3.nSlopeGreen = nTemp; - break; - case 0x021c/4: - case 0x0a1c/4: - //verboselog(machine(), 2, "REX3 Blue Slope Write: %08x\n", data ); - data &= 0x8007ffff; - switch( data & 0x80000000 ) - { - case 0x00000000: - nTemp = data & 0x0007ffff; - break; - case 0x80000000: - nTemp = 0x00080000 - ( data & 0x0007ffff ); - nTemp |= 0x00080000; - break; - } - m_REX3.nSlopeBlue = nTemp; - break; - case 0x0220/4: - case 0x0a20/4: - //verboselog(machine(), 2, "REX3 Write Mask Write: %08x\n", data ); - m_REX3.nWriteMask = data & 0x00ffffff; - break; - case 0x0224/4: - case 0x0a24/4: - //verboselog(machine(), 2, "REX3 Packed Color Fractions Write: %08x\n", data ); - m_REX3.nZeroFract = data; - break; - case 0x0228/4: - case 0x0a28/4: - //verboselog(machine(), 2, "REX3 Color Index Zeros Overflow Write: %08x\n", data ); - m_REX3.nZeroOverflow = data; - break; - case 0x022c/4: - case 0x0a2c/4: - //verboselog(machine(), 2, "REX3 Red/CI Slope (copy) Write: %08x\n", data ); - m_REX3.nSlopeRed = data; - break; - case 0x0230/4: - case 0x0a30/4: - //verboselog(machine(), 3, "REX3 Host Data Port MSW Write: %08x\n", data ); - m_REX3.nHostDataPortMSW = data; - if (offset & 0x00000200) - { - DoREX3Command(); - } - break; - case 0x0234/4: - case 0x0a34/4: - //verboselog(machine(), 2, "REX3 Host Data Port LSW Write: %08x\n", data ); - m_REX3.nHostDataPortLSW = data; - break; - case 0x0238/4: - case 0x0a38/4: - //verboselog(machine(), 2, "REX3 Display Control Bus Mode Write: %08x\n", data ); - switch( data & 0x00000003 ) - { - case 0x00: - //verboselog(machine(), 2, " Transfer Width: 4 bytes\n" ); - m_REX3.nXFerWidth = 4; - break; - case 0x01: - //verboselog(machine(), 2, " Transfer Width: 1 bytes\n" ); - m_REX3.nXFerWidth = 1; - break; - case 0x02: - //verboselog(machine(), 2, " Transfer Width: 2 bytes\n" ); - m_REX3.nXFerWidth = 2; - break; - case 0x03: - //verboselog(machine(), 2, " Transfer Width: 3 bytes\n" ); - m_REX3.nXFerWidth = 3; - break; - } - //verboselog(machine(), 2, " DCB Reg Select Adr: %d\n", ( data & 0x00000070 ) >> 4 ); - //verboselog(machine(), 2, " DCB Slave Address: %d\n", ( data & 0x00000780 ) >> 7 ); -// //verboselog(machine(), 2, " Use Sync XFer ACK: %d\n", ( data & 0x00000800 ) >> 11 ); -// //verboselog(machine(), 2, " Use Async XFer ACK: %d\n", ( data & 0x00001000 ) >> 12 ); -// //verboselog(machine(), 2, " GIO CLK Cycle Width: %d\n", ( data & 0x0003e000 ) >> 13 ); -// //verboselog(machine(), 2, " GIO CLK Cycle Hold: %d\n", ( data & 0x007c0000 ) >> 18 ); -// //verboselog(machine(), 2, " GIO CLK Cycle Setup: %d\n", ( data & 0x0f800000 ) >> 23 ); -// //verboselog(machine(), 2, " Swap Byte Ordering: %d\n", ( data & 0x10000000 ) >> 28 ); - m_REX3.nDCBRegSelect = ( data & 0x00000070 ) >> 4; - m_REX3.nDCBSlvSelect = ( data & 0x00000780 ) >> 7; - m_REX3.nDCBMode = data & 0x1fffffff; - break; - case 0x0240/4: - case 0x0a40/4: - m_REX3.nDCBDataMSW = data; - switch( m_REX3.nDCBSlvSelect ) - { - case 0x00: - vc2_w(space, 0, data, mem_mask); - break; - case 0x01: - cmap0_w(space, 0, data, mem_mask); - break; - case 0x04: - xmap0_w(space, 0, data, mem_mask); - xmap1_w(space, 0, data, mem_mask); - break; - case 0x05: - xmap0_w(space, 0, data, mem_mask); - break; - case 0x06: - xmap1_w(space, 0, data, mem_mask); - break; - default: - //verboselog(machine(), 2, "REX3 Display Control Bus Data MSW Write: %08x\n", data ); - break; - } - break; - case 0x0244/4: - case 0x0a44/4: - //verboselog(machine(), 2, "REX3 Display Control Bus Data LSW Write: %08x\n", data ); - m_REX3.nDCBDataLSW = data; - break; - case 0x1300/4: - //verboselog(machine(), 2, "REX3 Screenmask 1 X Min/Max Write: %08x\n", data ); - m_REX3.nSMask1X = data; - break; - case 0x1304/4: - //verboselog(machine(), 2, "REX3 Screenmask 1 Y Min/Max Write: %08x\n", data ); - m_REX3.nSMask1Y = data; - break; - case 0x1308/4: - //verboselog(machine(), 2, "REX3 Screenmask 2 X Min/Max Write: %08x\n", data ); - m_REX3.nSMask2X = data; - break; - case 0x130c/4: - //verboselog(machine(), 2, "REX3 Screenmask 2 Y Min/Max Write: %08x\n", data ); - m_REX3.nSMask2Y = data; - break; - case 0x1310/4: - //verboselog(machine(), 2, "REX3 Screenmask 3 X Min/Max Write: %08x\n", data ); - m_REX3.nSMask3X = data; - break; - case 0x1314/4: - //verboselog(machine(), 2, "REX3 Screenmask 3 Y Min/Max Write: %08x\n", data ); - m_REX3.nSMask3Y = data; - break; - case 0x1318/4: - //verboselog(machine(), 2, "REX3 Screenmask 4 X Min/Max Write: %08x\n", data ); - m_REX3.nSMask4X = data; - break; - case 0x131c/4: - //verboselog(machine(), 2, "REX3 Screenmask 4 Y Min/Max Write: %08x\n", data ); - m_REX3.nSMask4Y = data; - break; - case 0x1320/4: - //verboselog(machine(), 2, "REX3 Top of Screen Scanline Write: %08x\n", data ); - m_REX3.nTopScanline = data & 0x000003ff; - break; - case 0x1324/4: - //verboselog(machine(), 2, "REX3 Clipping Mode Write: %08x\n", data ); - m_REX3.nXYWin = data; - break; - case 0x1328/4: - //verboselog(machine(), 2, "REX3 Clipping Mode Write: %08x\n", data ); - m_REX3.nClipMode = data & 0x00001fff; - break; - case 0x132c/4: - //verboselog(machine(), 2, "Request GFIFO Stall\n" ); - break; - case 0x1330/4: - //verboselog(machine(), 2, "REX3 Config Write: %08x\n", data ); - m_REX3.nConfig = data & 0x001fffff; - break; - case 0x1340/4: - //verboselog(machine(), 2, "Reset DCB Bus and Flush BFIFO\n" ); - break; - default: - //verboselog(machine(), 2, "Unknown REX3 Write: %08x (%08x): %08x\n", 0xbf0f0000 + ( offset << 2 ), mem_mask, data ); - break; - } -} diff --git a/src/mess/video/newport.h b/src/mess/video/newport.h deleted file mode 100644 index 16ee86065fb..00000000000 --- a/src/mess/video/newport.h +++ /dev/null @@ -1,163 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/* - SGI "Newport" graphics board used in the Indy and some Indigo2s - -*/ - -#ifndef __VIDHRDW_NEWPORT__ -#define __VIDHRDW_NEWPORT__ - -struct VC2_t -{ - UINT16 nRegister[0x21]; - UINT16 nRAM[0x8000]; - UINT8 nRegIdx; - UINT16 nRegData; -}; - - -struct XMAP_t -{ - UINT32 nRegister[0x08]; - UINT32 nModeTable[0x20]; -}; - -struct REX3_t -{ - UINT32 nDrawMode1; - UINT32 nDrawMode0; - UINT32 nLSMode; - UINT32 nLSPattern; - UINT32 nLSPatSave; - UINT32 nZPattern; - UINT32 nColorBack; - UINT32 nColorVRAM; - UINT32 nAlphaRef; - //UINT32 nStall0; - UINT32 nSMask0X; - UINT32 nSMask0Y; - UINT32 nSetup; - UINT32 nStepZ; - UINT32 nXStart; - UINT32 nYStart; - UINT32 nXEnd; - UINT32 nYEnd; - UINT32 nXSave; - UINT32 nXYMove; - UINT32 nBresD; - UINT32 nBresS1; - UINT32 nBresOctInc1; - UINT32 nBresRndInc2; - UINT32 nBresE1; - UINT32 nBresS2; - UINT32 nAWeight0; - UINT32 nAWeight1; - UINT32 nXStartF; - UINT32 nYStartF; - UINT32 nXEndF; - UINT32 nYEndF; - UINT32 nXStartI; - //UINT32 nYEndF1; - UINT32 nXYStartI; - UINT32 nXYEndI; - UINT32 nXStartEndI; - UINT32 nColorRed; - UINT32 nColorAlpha; - UINT32 nColorGreen; - UINT32 nColorBlue; - UINT32 nSlopeRed; - UINT32 nSlopeAlpha; - UINT32 nSlopeGreen; - UINT32 nSlopeBlue; - UINT32 nWriteMask; - UINT32 nZeroFract; - UINT32 nZeroOverflow; - //UINT32 nColorIndex; - UINT32 nHostDataPortMSW; - UINT32 nHostDataPortLSW; - UINT32 nDCBMode; - UINT32 nDCBRegSelect; - UINT32 nDCBSlvSelect; - UINT32 nDCBDataMSW; - UINT32 nDCBDataLSW; - UINT32 nSMask1X; - UINT32 nSMask1Y; - UINT32 nSMask2X; - UINT32 nSMask2Y; - UINT32 nSMask3X; - UINT32 nSMask3Y; - UINT32 nSMask4X; - UINT32 nSMask4Y; - UINT32 nTopScanline; - UINT32 nXYWin; - UINT32 nClipMode; - UINT32 nConfig; - UINT32 nStatus; - UINT8 nXFerWidth; -#if 0 - UINT32 nCurrentX; - UINT32 nCurrentY; -#endif - UINT32 nKludge_SkipLine; -}; - - -struct CMAP_t -{ - UINT16 nPaletteIndex; - UINT32 nPalette[0x10000]; -}; - - -class newport_video_device : public device_t -{ -public: - newport_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~newport_video_device() {} - - - DECLARE_READ32_MEMBER( rex3_r ); - DECLARE_WRITE32_MEMBER( rex3_w ); - - UINT32 screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - virtual void device_reset(); - -private: - // internal state - - DECLARE_READ32_MEMBER( cmap0_r ); - DECLARE_WRITE32_MEMBER( cmap0_w ); - DECLARE_READ32_MEMBER( cmap1_r ); - DECLARE_READ32_MEMBER( xmap0_r ); - DECLARE_WRITE32_MEMBER( xmap0_w ); - DECLARE_READ32_MEMBER( xmap1_r ); - DECLARE_WRITE32_MEMBER( xmap1_w ); - DECLARE_READ32_MEMBER( vc2_r ); - DECLARE_WRITE32_MEMBER( vc2_w ); - void DoREX3Command(); - - VC2_t m_VC2; - XMAP_t m_XMAP0; - XMAP_t m_XMAP1; - REX3_t m_REX3; - UINT32 *m_base; - UINT8 m_nDrawGreen; - CMAP_t m_CMAP0; -}; - - - -#define MCFG_NEWPORT_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, NEWPORT_VIDEO, 0) - - -extern const device_type NEWPORT_VIDEO; - - -#endif diff --git a/src/mess/video/nick.c b/src/mess/video/nick.c deleted file mode 100644 index afb16ff815b..00000000000 --- a/src/mess/video/nick.c +++ /dev/null @@ -1,1055 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Intelligent Designs NICK emulation - -**********************************************************************/ - -#include "nick.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - -/* colour mode types */ -#define NICK_2_COLOUR_MODE 0 -#define NICK_4_COLOUR_MODE 1 -#define NICK_16_COLOUR_MODE 2 -#define NICK_256_COLOUR_MODE 3 - -/* Display mode types */ -#define NICK_VSYNC_MODE 0 -#define NICK_PIXEL_MODE 1 -#define NICK_ATTR_MODE 2 -#define NICK_CH256_MODE 3 -#define NICK_CH128_MODE 4 -#define NICK_CH64_MODE 5 -#define NICK_UNUSED_MODE 6 -#define NICK_LPIXEL_MODE 7 - -/* MODEBYTE defines */ -#define NICK_MB_VIRQ (1<<7) -#define NICK_MB_VRES (1<<4) -#define NICK_MB_LPT_RELOAD (1<<0) - -/* Left margin defines */ -#define NICK_LM_MSBALT (1<<7) -#define NICK_LM_LSBALT (1<<6) - -/* Right margin defines */ -#define NICK_RM_ALTIND1 (1<<7) -#define NICK_RM_ALTIND0 (1<<6) - -/* useful macros */ -#define NICK_GET_LEFT_MARGIN(x) (x & 0x03f) -#define NICK_GET_RIGHT_MARGIN(x) (x & 0x03f) -#define NICK_GET_DISPLAY_MODE(x) ((x>>1) & 0x07) -#define NICK_GET_COLOUR_MODE(x) ((x>>5) & 0x03) - -#define NICK_RELOAD_LPT(x) (x & 0x080) -#define NICK_CLOCK_LPT(x) (x & 0x040) - -/* Macros to generate memory address is CHx modes */ -/* x = LD2, y = buf1 */ -#define ADDR_CH256(x,y) (((x & 0x0ff)<<8) | (y & 0x0ff)) -#define ADDR_CH128(x,y) (((x & 0x01ff)<<7) | (y & 0x07f)) -#define ADDR_CH64(x,y) (((x & 0x03ff)<<6) | (y & 0x03f)) - -/* No of highest resolution pixels per "clock" */ -#define NICK_PIXELS_PER_CLOCK 16 - -/* "clocks" per line */ -#define NICK_TOTAL_CLOCKS_PER_LINE 64 - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type NICK = &device_creator; - - -DEVICE_ADDRESS_MAP_START( vram_map, 8, nick_device ) - AM_RANGE(0x0000, 0xffff) AM_READWRITE(vram_r, vram_w) -ADDRESS_MAP_END - -DEVICE_ADDRESS_MAP_START( vio_map, 8, nick_device ) - AM_RANGE(0x00, 0x00) AM_WRITE(fixbias_w) - AM_RANGE(0x01, 0x01) AM_WRITE(border_w) - AM_RANGE(0x02, 0x02) AM_WRITE(lpl_w) - AM_RANGE(0x03, 0x03) AM_WRITE(lph_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( nick_map, AS_0, 8, nick_device ) - AM_RANGE(0x0000, 0xffff) AM_RAM -ADDRESS_MAP_END - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// nick_device - constructor -//------------------------------------------------- - -nick_device::nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, NICK, "NICK", tag, owner, clock, "nick", __FILE__), - device_memory_interface(mconfig, *this), - device_video_interface(mconfig, *this), - m_space_config("vram", ENDIANNESS_LITTLE, 8, 16, 0, *ADDRESS_MAP_NAME(nick_map)), - m_write_virq(*this), - horizontal_clock(0), - m_scanline_count(0), - m_FIXBIAS(0), - m_BORDER(0), - m_LPL(0), - m_LPH(0), - m_LD1(0), - m_LD2(0), - m_virq(CLEAR_LINE) -{ - memset(&m_LPT, 0x00, sizeof(m_LPT)); -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void nick_device::device_start() -{ - m_screen->register_screen_bitmap(m_bitmap); - calc_visible_clocks(ENTERPRISE_SCREEN_WIDTH); - - // initialize palette - initialize_palette(); - - // resolve callbacks - m_write_virq.resolve_safe(); - - // allocate timers - m_timer_scanline = timer_alloc(); - m_timer_scanline->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->scan_period()); - - // state saving - save_item(NAME(m_scanline_count)); - save_item(NAME(m_FIXBIAS)); - save_item(NAME(m_BORDER)); - save_item(NAME(m_LPL)); - save_item(NAME(m_LPH)); - save_item(NAME(m_LD1)); - save_item(NAME(m_LD2)); - save_item(NAME(m_LPT.SC)); - save_item(NAME(m_LPT.MB)); - save_item(NAME(m_LPT.LM)); - save_item(NAME(m_LPT.RM)); - save_item(NAME(m_LPT.LD1L)); - save_item(NAME(m_LPT.LD1H)); - save_item(NAME(m_LPT.LD2L)); - save_item(NAME(m_LPT.LD2H)); - save_item(NAME(m_LPT.COL)); - save_item(NAME(m_dest_pos)); - save_item(NAME(m_dest_max_pos)); - save_item(NAME(m_reg)); - save_item(NAME(m_first_visible_clock)); - save_item(NAME(m_last_visible_clock)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void nick_device::device_reset() -{ - m_write_virq(CLEAR_LINE); - m_virq = 0; - - m_scanline_count = 0; -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void nick_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - int scanline = m_screen->vpos(); - - if (scanline < ENTERPRISE_SCREEN_HEIGHT) - { - /* set write address for line */ - m_dest = &m_bitmap.pix32(scanline); - m_dest_pos = 0; - m_dest_max_pos = m_bitmap.width(); - - /* write line */ - do_line(); - } -} - - -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *nick_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == 0) ? &m_space_config : NULL; -} - - -//------------------------------------------------- -// update_screen - update screen -//------------------------------------------------- - -UINT32 nick_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - - return 0; -} - - -//------------------------------------------------- -// vram_r - video RAM read -//------------------------------------------------- - -READ8_MEMBER( nick_device::vram_r ) -{ - return this->space().read_byte(offset); -} - - -//------------------------------------------------- -// vram_w - video RAM write -//------------------------------------------------- - -WRITE8_MEMBER( nick_device::vram_w ) -{ - this->space().write_byte(offset, data); -} - - -//------------------------------------------------- -// fixbias_w - -//------------------------------------------------- - -WRITE8_MEMBER( nick_device::fixbias_w ) -{ - m_FIXBIAS = data; -} - - -//------------------------------------------------- -// border_w - -//------------------------------------------------- - -WRITE8_MEMBER( nick_device::border_w ) -{ - m_BORDER = data; -} - - -//------------------------------------------------- -// lpl_w - -//------------------------------------------------- - -WRITE8_MEMBER( nick_device::lpl_w ) -{ - m_LPL = m_reg[2] = data; - - update_lpt(); -} - - -//------------------------------------------------- -// lph_w - -//------------------------------------------------- - -WRITE8_MEMBER( nick_device::lph_w ) -{ - m_LPH = m_reg[3] = data; - - update_lpt(); -} - - -//------------------------------------------------- -// initialize_palette - -//------------------------------------------------- - -void nick_device::initialize_palette() -{ - const int resistances_rg[] = { (int) RES_R(470), (int) RES_R(220), (int) RES_R(100) }; - const int resistances_b[] = { (int) RES_R(220), (int) RES_R(82) }; - - double color_weights_rg[3], color_weights_b[2]; - - compute_resistor_weights(0, 0xff, -1.0, - 3, resistances_rg, color_weights_rg, 0, 0, - 2, resistances_b, color_weights_b, 0, 0, - 0, 0, 0, 0, 0); - - for (int i = 0; i < 256; i++) - { - /* - - bit description - - PC0 100R -- RED - PC1 100R -- GREEN - PC2 82R -- BLUE - PC3 220R -- RED - PC4 220R -- GREEN - PC5 220R -- BLUE - PC6 470R -- RED - PC7 470R -- GREEN - - */ - - int ra = BIT(i, 0); - int rb = BIT(i, 3); - int rc = BIT(i, 6); - - int ga = BIT(i, 1); - int gb = BIT(i, 4); - int gc = BIT(i, 7); - - int ba = BIT(i, 2); - int bb = BIT(i, 5); - - UINT8 r = combine_3_weights(color_weights_rg, rc, rb, ra); - UINT8 g = combine_3_weights(color_weights_rg, gc, gb, ga); - UINT8 b = combine_2_weights(color_weights_b, bb, ba); - - m_palette[i] = rgb_t(r, g, b); - } - - for (int i = 0; i < 256; i++) - { - int pen_index; - - pen_index = (BIT(i, 7) << 0) | (BIT(i, 3) << 1); - m_pen_idx_4col[i] = pen_index; - - pen_index = (BIT(i, 7) << 0) | (BIT(i, 3) << 1) | (BIT(i, 5) << 2) | (BIT(i, 1) << 3); - m_pen_idx_16col[i] = pen_index; - } -} - -// MESS specific -/* 8-bit pixel write! */ -void nick_device::write_pixel(int ci) -{ - if (m_dest_pos < m_dest_max_pos) - { - m_dest[m_dest_pos++] = m_palette[ci]; - } -} - -/* we align based on the clocks */ -void nick_device::calc_visible_clocks(int width) -{ - /* number of clocks we can see */ - int no_visible_clocks = width / NICK_PIXELS_PER_CLOCK; - m_first_visible_clock = (NICK_TOTAL_CLOCKS_PER_LINE - no_visible_clocks) >> 1; - m_last_visible_clock = m_first_visible_clock + no_visible_clocks; -} - - -/* write border colour */ -void nick_device::write_border(int clocks) -{ - int col_index = m_BORDER; - - for (int i = 0; i < (clocks << 4); i++) - write_pixel(col_index); -} - - -void nick_device::do_left_margin() -{ - UINT8 left = NICK_GET_LEFT_MARGIN(m_LPT.LM); - - if (left > m_first_visible_clock) - { - /* some of the left margin is visible */ - UINT8 left_visible = left - m_first_visible_clock; - - /* render the border */ - write_border(left_visible); - } -} - -void nick_device::do_right_margin() -{ - UINT8 right = NICK_GET_RIGHT_MARGIN(m_LPT.RM); - - if (right < m_last_visible_clock) - { - /* some of the right margin is visible */ - UINT8 right_visible = m_last_visible_clock - right; - - /* render the border */ - write_border(right_visible); - } -} - -int nick_device::get_color_index(int pen_index) -{ - if (pen_index & 0x08) - return ((m_FIXBIAS & 0x01f) << 3) | (pen_index & 0x07); - else - return m_LPT.COL[pen_index]; -} - -void nick_device::write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte) -{ - int col_index[2]; - int pen_index; - UINT8 data = data_byte; - - col_index[0] = get_color_index(pen0); - col_index[1] = get_color_index(pen1); - - for (int i = 0; i < 8; i++) - { - pen_index = col_index[BIT(data, 7)]; - write_pixel(pen_index); - data <<= 1; - } -} - -void nick_device::write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte) -{ - int col_index[2]; - int pen_index; - UINT8 data = data_byte; - - col_index[0] = get_color_index(pen0); - col_index[1] = get_color_index(pen1); - - for (int i = 0; i < 8; i++) - { - pen_index = col_index[BIT(data, 7)]; - write_pixel(pen_index); - write_pixel(pen_index); - data <<= 1; - } -} - - -void nick_device::write_pixels(UINT8 data_byte, UINT8 char_idx) -{ - /* pen index colour 2-C (0,1), 4-C (0..3) 16-C (0..16) */ - int pen_idx; - /* Col index = EP colour value */ - int pal_idx; - UINT8 color_mode = NICK_GET_COLOUR_MODE(m_LPT.MB); - UINT8 data = data_byte; - - switch (color_mode) - { - case NICK_2_COLOUR_MODE: - { - int pen_offs = 0; - - /* do before displaying byte */ - - /* left margin attributes */ - if (m_LPT.LM & NICK_LM_MSBALT) - { - if (data & 0x080) - { - pen_offs |= 2; - } - - data &=~0x080; - } - - if (m_LPT.LM & NICK_LM_LSBALT) - { - if (data & 0x001) - { - pen_offs |= 4; - } - - data &=~0x01; - } - - if (m_LPT.RM & NICK_RM_ALTIND1) - { - if (char_idx & 0x080) - { - pen_offs |= 0x02; - } - } - -#if 0 - if (m_LPT.RM & NICK_RM_ALTIND0) - { - if (data & 0x040) - { - pen_offs |= 0x04; - } - } -#endif - - - write_pixels2color(pen_offs, (pen_offs | 0x01), data); - } - break; - - case NICK_4_COLOUR_MODE: - { - //osd_printf_info("4 colour\r\n"); - - /* left margin attributes */ - if (m_LPT.LM & NICK_LM_MSBALT) - { - data &= ~0x080; - } - - if (m_LPT.LM & NICK_LM_LSBALT) - { - data &= ~0x01; - } - - - for (int i = 0; i < 4; i++) - { - pen_idx = m_pen_idx_4col[data]; - pal_idx = m_LPT.COL[pen_idx & 0x03]; - - write_pixel(pal_idx); - write_pixel(pal_idx); - - data <<= 1; - } - } - break; - - case NICK_16_COLOUR_MODE: - { - //osd_printf_info("16 colour\r\n"); - - /* left margin attributes */ - if (m_LPT.LM & NICK_LM_MSBALT) - { - data &= ~0x080; - } - - if (m_LPT.LM & NICK_LM_LSBALT) - { - data &= ~0x01; - } - - - for (int i = 0; i < 2; i++) - { - pen_idx = m_pen_idx_16col[data]; - - pal_idx = get_color_index(pen_idx); - - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - - data <<= 1; - } - } - break; - - case NICK_256_COLOUR_MODE: - { - /* left margin attributes */ - if (m_LPT.LM & NICK_LM_MSBALT) - { - data &= ~0x080; - } - - if (m_LPT.LM & NICK_LM_LSBALT) - { - data &= ~0x01; - } - - - pal_idx = data; - - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - - - } - break; - } -} - -void nick_device::write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx) -{ - /* pen index colour 2-C (0,1), 4-C (0..3) 16-C (0..16) */ - int pen_idx; - /* Col index = EP colour value */ - int pal_idx; - UINT8 color_mode = NICK_GET_COLOUR_MODE(m_LPT.MB); - UINT8 data = data_byte; - - switch (color_mode) - { - case NICK_2_COLOUR_MODE: - { - int pen_offs = 0; - - /* do before displaying byte */ - - /* left margin attributes */ - if (m_LPT.LM & NICK_LM_MSBALT) - { - if (data & 0x080) - { - pen_offs |= 2; - } - - data &=~0x080; - } - - if (m_LPT.LM & NICK_LM_LSBALT) - { - if (data & 0x001) - { - pen_offs |= 4; - } - - data &=~0x01; - } - - if (m_LPT.RM & NICK_RM_ALTIND1) - { - if (char_idx & 0x080) - { - pen_offs |= 0x02; - } - } - -#if 0 - if (m_LPT.RM & NICK_RM_ALTIND0) - { - if (data & 0x040) - { - pen_offs |= 0x04; - } - } -#endif - - - write_pixels2color_lpixel(pen_offs, (pen_offs | 0x01), data); - } - break; - - case NICK_4_COLOUR_MODE: - { - //osd_printf_info("4 colour\r\n"); - - /* left margin attributes */ - if (m_LPT.LM & NICK_LM_MSBALT) - { - data &= ~0x080; - } - - if (m_LPT.LM & NICK_LM_LSBALT) - { - data &= ~0x01; - } - - - for (int i = 0; i < 4; i++) - { - pen_idx = m_pen_idx_4col[data]; - pal_idx = m_LPT.COL[pen_idx & 0x03]; - - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - - data <<= 1; - } - } - break; - - case NICK_16_COLOUR_MODE: - { - //osd_printf_info("16 colour\r\n"); - - /* left margin attributes */ - if (m_LPT.LM & NICK_LM_MSBALT) - { - data &= ~0x080; - } - - if (m_LPT.LM & NICK_LM_LSBALT) - { - data &= ~0x01; - } - - - for (int i = 0; i < 2; i++) - { - pen_idx = m_pen_idx_16col[data]; - pal_idx = get_color_index(pen_idx); - - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - - data <<= 1; - } - } - break; - - case NICK_256_COLOUR_MODE: - { - /* left margin attributes */ - if (m_LPT.LM & NICK_LM_MSBALT) - { - data &= ~0x080; - } - - if (m_LPT.LM & NICK_LM_LSBALT) - { - data &= ~0x01; - } - - - pal_idx = data; - - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - write_pixel(pal_idx); - - - } - break; - } -} - - -void nick_device::do_pixel(int clocks_visible) -{ - UINT8 buf1, buf2; - - for (int i = 0; i < clocks_visible; i++) - { - buf1 = space().read_byte(m_LD1); - m_LD1++; - - buf2 = space().read_byte(m_LD1); - m_LD1++; - - write_pixels(buf1, buf1); - write_pixels(buf2, buf1); - } -} - - -void nick_device::do_lpixel(int clocks_visible) -{ - UINT8 buf1; - - for (int i = 0; i < clocks_visible; i++) - { - buf1 = space().read_byte(m_LD1); - m_LD1++; - - write_pixels_lpixel(buf1, buf1); - } -} - -void nick_device::do_attr(int clocks_visible) -{ - UINT8 buf1, buf2; - - for (int i = 0; i < clocks_visible; i++) - { - buf1 = space().read_byte(m_LD1); - m_LD1++; - - buf2 = space().read_byte(m_LD2); - m_LD2++; - - { - UINT8 bg_color = ((buf1 >> 4) & 0x0f); - UINT8 fg_color = (buf1 & 0x0f); - - write_pixels2color_lpixel(bg_color, fg_color, buf2); - } - } -} - -void nick_device::do_ch256(int clocks_visible) -{ - UINT8 buf1, buf2; - - for (int i = 0; i < clocks_visible; i++) - { - buf1 = space().read_byte(m_LD1); - m_LD1++; - buf2 = space().read_byte(ADDR_CH256(m_LD2, buf1)); - - write_pixels_lpixel(buf2, buf1); - } -} - -void nick_device::do_ch128(int clocks_visible) -{ - UINT8 buf1, buf2; - - for (int i = 0; i < clocks_visible; i++) - { - buf1 = space().read_byte(m_LD1); - m_LD1++; - buf2 = space().read_byte(ADDR_CH128(m_LD2, buf1)); - - write_pixels_lpixel(buf2, buf1); - } -} - -void nick_device::do_ch64(int clocks_visible) -{ - UINT8 buf1, buf2; - - for (int i = 0; i < clocks_visible; i++) - { - buf1 = space().read_byte(m_LD1); - m_LD1++; - buf2 = space().read_byte(ADDR_CH64(m_LD2, buf1)); - - write_pixels_lpixel(buf2, buf1); - } -} - - -void nick_device::do_display() -{ - LPT_ENTRY *pLPT = &m_LPT; - UINT8 clocks_visible; - UINT8 right_margin = NICK_GET_RIGHT_MARGIN(pLPT->RM); - UINT8 left_margin = NICK_GET_LEFT_MARGIN(pLPT->LM); - - clocks_visible = right_margin - left_margin; - - if (clocks_visible) - { - /* get display mode */ - UINT8 display_mode = NICK_GET_DISPLAY_MODE(pLPT->MB); - - if (m_scanline_count == 0) // || - //((pLPT->MB & NICK_MB_VRES)==0)) - { - /* doing first line */ - /* reload LD1, and LD2 (if necessary) regardless of display mode */ - m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8); - - if ((display_mode != NICK_LPIXEL_MODE) && (display_mode != NICK_PIXEL_MODE)) - { - /* lpixel and pixel modes don't use LD2 */ - m_LD2 = (pLPT->LD2L & 0xff) | ((pLPT->LD2H & 0xff) << 8); - } - } - else - { - /* not first line */ - switch (display_mode) - { - case NICK_ATTR_MODE: - { - /* reload LD1 */ - m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8); - } - break; - - case NICK_CH256_MODE: - case NICK_CH128_MODE: - case NICK_CH64_MODE: - { - /* reload LD1 */ - m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8); - m_LD2++; - } - break; - - default: - break; - } - } - - switch (display_mode) - { - case NICK_PIXEL_MODE: - { - do_pixel(clocks_visible); - } - break; - - case NICK_ATTR_MODE: - { - //osd_printf_info("attr mode\r\n"); - do_attr(clocks_visible); - } - break; - - case NICK_CH256_MODE: - { - //osd_printf_info("ch256 mode\r\n"); - do_ch256(clocks_visible); - } - break; - - case NICK_CH128_MODE: - { - do_ch128(clocks_visible); - } - break; - - case NICK_CH64_MODE: - { - //osd_printf_info("ch64 mode\r\n"); - do_ch64(clocks_visible); - } - break; - - case NICK_LPIXEL_MODE: - { - do_lpixel(clocks_visible); - } - break; - - default: - break; - } - } -} - -void nick_device::update_lpt() -{ - UINT16 CurLPT = (m_LPL & 0x0ff) | ((m_LPH & 0x0f) << 8); - CurLPT++; - m_LPL = CurLPT & 0x0ff; - m_LPH = (m_LPH & 0x0f0) | ((CurLPT >> 8) & 0x0f); -} - - -void nick_device::reload_lpt() -{ - /* get addr of LPT */ - UINT32 LPT_Addr = ((m_LPL & 0x0ff) << 4) | ((m_LPH & 0x0f) << (8+4)); - - /* update internal LPT state */ - m_LPT.SC = space().read_byte(LPT_Addr); - m_LPT.MB = space().read_byte(LPT_Addr + 1); - m_LPT.LM = space().read_byte(LPT_Addr + 2); - m_LPT.RM = space().read_byte(LPT_Addr + 3); - m_LPT.LD1L = space().read_byte(LPT_Addr + 4); - m_LPT.LD1H = space().read_byte(LPT_Addr + 5); - m_LPT.LD2L = space().read_byte(LPT_Addr + 6); - m_LPT.LD2H = space().read_byte(LPT_Addr + 7); - m_LPT.COL[0] = space().read_byte(LPT_Addr + 8); - m_LPT.COL[1] = space().read_byte(LPT_Addr + 9); - m_LPT.COL[2] = space().read_byte(LPT_Addr + 10); - m_LPT.COL[3] = space().read_byte(LPT_Addr + 11); - m_LPT.COL[4] = space().read_byte(LPT_Addr + 12); - m_LPT.COL[5] = space().read_byte(LPT_Addr + 13); - m_LPT.COL[6] = space().read_byte(LPT_Addr + 14); - m_LPT.COL[7] = space().read_byte(LPT_Addr + 15); -} - -/* call here to render a line of graphics */ -void nick_device::do_line() -{ - UINT8 scanline; - - m_write_virq((m_LPT.MB & NICK_MB_VIRQ) ? ASSERT_LINE : CLEAR_LINE); - - if (m_virq && !(m_LPT.MB & NICK_MB_VIRQ)) - { - m_timer_scanline->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->scan_period()); - } - - m_virq = (m_LPT.MB & NICK_MB_VIRQ) ? 1 : 0; - - if ((m_LPT.MB & NICK_MB_LPT_RELOAD)!=0) - { - /* reload LPT */ - - m_LPL = m_reg[2]; - m_LPH = m_reg[3]; - - reload_lpt(); - } - - /* left border */ - do_left_margin(); - - /* do visible part */ - do_display(); - - /* right border */ - do_right_margin(); - - // 0x0f7 is first! - /* scan line count for this LPT */ - scanline = ((~m_LPT.SC) + 1) & 0x0ff; - - //printf("scanline %02x\r\n", scanline); - - /* update count of scanlines done so far */ - m_scanline_count++; - - if (m_scanline_count == scanline) - { - /* done all scanlines of this Line Parameter Table, get next */ - - m_scanline_count = 0; - - update_lpt(); - reload_lpt(); - } -} diff --git a/src/mess/video/nick.h b/src/mess/video/nick.h deleted file mode 100644 index 738d202e2a7..00000000000 --- a/src/mess/video/nick.h +++ /dev/null @@ -1,178 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Intelligent Designs NICK emulation - -**********************************************************************/ - -#pragma once - -#ifndef __NICK__ -#define __NICK__ - -#include "emu.h" -#include "machine/rescap.h" -#include "video/resnet.h" - - - -///************************************************************************* -// INTERFACE CONFIGURATION MACROS -///************************************************************************* - -#define MCFG_NICK_ADD(_tag, _screen_tag, _clock) \ - MCFG_SCREEN_ADD(_screen_tag, RASTER) \ - MCFG_SCREEN_REFRESH_RATE(50) \ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) \ - MCFG_SCREEN_SIZE(ENTERPRISE_SCREEN_WIDTH, ENTERPRISE_SCREEN_HEIGHT) \ - MCFG_SCREEN_VISIBLE_AREA(0, ENTERPRISE_SCREEN_WIDTH-1, 0, ENTERPRISE_SCREEN_HEIGHT-1) \ - MCFG_SCREEN_UPDATE_DEVICE(_tag, nick_device, screen_update) \ - MCFG_DEVICE_ADD(_tag, NICK, _clock) \ - MCFG_VIDEO_SET_SCREEN(_screen_tag) - - -#define MCFG_NICK_VIRQ_CALLBACK(_write) \ - devcb = &nick_device::set_virq_wr_callback(*device, DEVCB_##_write); - - -/* there are 64us per line, although in reality - about 50 are visible. */ -#define ENTERPRISE_SCREEN_WIDTH (50*16) - -/* there are 312 lines per screen, although in reality - about 35*8 are visible */ -#define ENTERPRISE_SCREEN_HEIGHT (35*8) - - -///************************************************************************* -// TYPE DEFINITIONS -///************************************************************************* - -/* Nick executes a Display list, in the form of a list of Line Parameter - Tables, this is the form of the data */ -struct LPT_ENTRY -{ - UINT8 SC; /* scanlines in this modeline (two's complement) */ - UINT8 MB; /* the MODEBYTE (defines video display mode) */ - UINT8 LM; /* left margin etc */ - UINT8 RM; /* right margin etc */ - UINT8 LD1L; /* (a7..a0) of line data pointer LD1 */ - UINT8 LD1H; /* (a8..a15) of line data pointer LD1 */ - UINT8 LD2L; /* (a7..a0) of line data pointer LD2 */ - UINT8 LD2H; /* (a8..a15) of line data pointer LD2 */ - UINT8 COL[8]; /* COL0..COL7 */ -}; - - -// ======================> nick_device - -class nick_device : public device_t, - public device_memory_interface, - public device_video_interface -{ -public: - // construction/destruction - nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_virq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_virq.set_callback(object); } - - virtual DECLARE_ADDRESS_MAP(vram_map, 8); - virtual DECLARE_ADDRESS_MAP(vio_map, 8); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; - - DECLARE_READ8_MEMBER( vram_r ); - DECLARE_WRITE8_MEMBER( vram_w ); - - DECLARE_WRITE8_MEMBER( fixbias_w ); - DECLARE_WRITE8_MEMBER( border_w ); - DECLARE_WRITE8_MEMBER( lpl_w ); - DECLARE_WRITE8_MEMBER( lph_w ); - - address_space_config m_space_config; - -private: - devcb_write_line m_write_virq; - - void initialize_palette(); - - void write_pixel(int ci); - void calc_visible_clocks(int width); - void init(); - void write_border(int clocks); - void do_left_margin(); - void do_right_margin(); - - int get_color_index(int pen_index); - void write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte); - void write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte); - void write_pixels(UINT8 data_byte, UINT8 char_idx); - void write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx); - - void do_pixel(int clocks_visible); - void do_lpixel(int clocks_visible); - void do_attr(int clocks_visible); - void do_ch256(int clocks_visible); - void do_ch128(int clocks_visible); - void do_ch64(int clocks_visible); - void do_display(); - void update_lpt(); - void reload_lpt(); - void do_line(); - - /* horizontal position */ - UINT8 horizontal_clock; - /* current scanline within LPT */ - UINT8 m_scanline_count; - - UINT8 m_FIXBIAS; - UINT8 m_BORDER; - UINT8 m_LPL; - UINT8 m_LPH; - - UINT16 m_LD1; - UINT16 m_LD2; - - LPT_ENTRY m_LPT; - - UINT32 *m_dest; - int m_dest_pos; - int m_dest_max_pos; - - UINT8 m_reg[4]; - - /* first clock visible on left hand side */ - int m_first_visible_clock; - /* first clock visible on right hand side */ - int m_last_visible_clock; - - /* given a bit pattern, this will get the pen index */ - UINT8 m_pen_idx_4col[256]; - /* given a bit pattern, this will get the pen index */ - UINT8 m_pen_idx_16col[256]; - - int m_virq; - - bitmap_rgb32 m_bitmap; - rgb_t m_palette[256]; - - emu_timer *m_timer_scanline; -}; - - -// device type definition -extern const device_type NICK; - - - -#endif diff --git a/src/mess/video/ondra.c b/src/mess/video/ondra.c deleted file mode 100644 index c5112f4729e..00000000000 --- a/src/mess/video/ondra.c +++ /dev/null @@ -1,47 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Ondra driver by Miodrag Milanovic - - 08/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/ondra.h" -#include "machine/ram.h" - - - -void ondra_state::video_start() -{ - m_video_enable = 0; -} - -UINT32 ondra_state::screen_update_ondra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code1,code2; - int y, x, b; - int Vaddr = 0x2800; - - if (m_video_enable==1) { - for (x = 0; x < 40; x++) - { - for (y = 127; y >=0; y--) - { - code1 = m_ram->pointer()[0xd700 + Vaddr + 0x80]; - code2 = m_ram->pointer()[0xd700 + Vaddr + 0x00]; - for (b = 0; b < 8; b++) - { - bitmap.pix16(2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; - bitmap.pix16(2*y+1, x*8+b) = ((code2 << b) & 0x80) ? 1 : 0; - } - Vaddr++; - } - Vaddr = (Vaddr - 128) - 256; - } - } - return 0; -} diff --git a/src/mess/video/orao.c b/src/mess/video/orao.c deleted file mode 100644 index a41f060af8d..00000000000 --- a/src/mess/video/orao.c +++ /dev/null @@ -1,38 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Orao video driver by Miodrag Milanovic - - 01/03/2008 Updated to work with latest SVN code - 22/02/2008 Preliminary driver. - -****************************************************************************/ - -#include "emu.h" -#include "includes/orao.h" - -void orao_state::video_start() -{ -} - -UINT32 orao_state::screen_update_orao(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code; - int y, x, b; - - int addr = 0; - for (y = 0; y < 256; y++) - { - int horpos = 0; - for (x = 0; x < 32; x++) - { - code = m_video_ram[addr++]; - for (b = 0; b < 8; b++) - { - bitmap.pix16(y, horpos++) = (code >> b) & 0x01; - } - } - } - return 0; -} diff --git a/src/mess/video/orion.c b/src/mess/video/orion.c deleted file mode 100644 index 241080684cf..00000000000 --- a/src/mess/video/orion.c +++ /dev/null @@ -1,114 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Orion video driver by Miodrag Milanovic - - 22/04/2008 Orion Pro added - 02/04/2008 Preliminary driver. - -****************************************************************************/ - - -#include "emu.h" -#include "includes/orion.h" - -VIDEO_START_MEMBER(orion_state,orion128) -{ -} - -UINT32 orion_state::screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code1,code2,code3,code4,color,val; - int y, x,b; - int orionproshift = (m_orion128_video_mode & 0x10) ? 1 : 0; - int part1addr = (3-((m_orion128_video_page & 3) | orionproshift)) * 0x4000; - int part2addr = part1addr + 0x10000; - int video_mode = m_orion128_video_mode & m_video_mode_mask; - UINT8 *ram = m_ram->pointer(); - - for (x = 0; x < m_orion128_video_width; x++) - { - for (y = 0; y < 256; y++) - { - code1 = ram[part1addr + y + x*256]; - code2 = ram[part2addr + y + x*256]; - code3 = ram[part1addr + y + x*256 + 0x4000]; - code4 = ram[part2addr + y + x*256 + 0x4000]; - if ((video_mode==14) || (video_mode==15)) { - code2 = m_orionpro_pseudo_color; - } - color = 0; - for (b = 7; b >= 0; b--) - { - switch(m_orion128_video_mode & m_video_mode_mask) { - case 0 : color = ((code1 >> b) & 0x01) ? 10 : 0; break; - case 1 : color = ((code1 >> b) & 0x01) ? 17 : 16; break; - case 4 : val = (((code1 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); - switch(val) { - case 0 : color = 0; break; // black - case 1 : color = 4; break; // red - case 2 : color = 2; break; // green - case 3 : color = 1; break; // blue - } - break; - case 5 : val = (((code1 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); - switch(val) { - case 0 : color = 7; break; // white - case 1 : color = 4; break; // red - case 2 : color = 2; break; // green - case 3 : color = 1; break; // blue - } - break; - case 6 : - case 7 : - case 14 : - case 15 : - color = ((code1 >> b) & 0x01) ? (code2 & 0x0f) : (code2 >> 4); break; - - default: - switch(m_orion128_video_mode & m_video_mode_mask & 20) { - case 16 : - color = (((code1 >> b) & 0x01) << 2) + (((code3 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); - break; - case 20 : - color = (((code1 >> b) & 0x01) << 2) + (((code3 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); - if ((((code4 >> b) & 0x01)==1) && (color!=0)) { - color += 8; - } - break; - } - } - bitmap.pix16(y, x*8+(7-b)) = color; - } - } - } - - return 0; -} - -static const rgb_t orion128_palette[18] = { - rgb_t(0x00, 0x00, 0x00), // 0 - rgb_t(0x00, 0x00, 0xc0), // 1 - rgb_t(0x00, 0xc0, 0x00), // 2 - rgb_t(0x00, 0xc0, 0xc0), // 3 - rgb_t(0xc0, 0x00, 0x00), // 4 - rgb_t(0xc0, 0x00, 0xc0), // 5 - rgb_t(0xc0, 0xc0, 0x00), // 6 - rgb_t(0xc0, 0xc0, 0xc0), // 7 - rgb_t(0x80, 0x80, 0x80), // 8 - rgb_t(0x00, 0x00, 0xff), // 9 - rgb_t(0x00, 0xff, 0x00), // A - rgb_t(0x00, 0xff, 0xff), // B - rgb_t(0xff, 0x00, 0x00), // C - rgb_t(0xff, 0x00, 0xff), // D - rgb_t(0xff, 0xff, 0x00), // E - rgb_t(0xff, 0xff, 0xff), // F - rgb_t(0xc8, 0xb4, 0x28), // 10 - rgb_t(0x32, 0xfa, 0xfa) // 11 -}; - -PALETTE_INIT_MEMBER(orion_state,orion128 ) -{ - palette.set_pen_colors(0, orion128_palette, ARRAY_LENGTH(orion128_palette)); -} diff --git a/src/mess/video/osi.c b/src/mess/video/osi.c deleted file mode 100644 index 94dd155454b..00000000000 --- a/src/mess/video/osi.c +++ /dev/null @@ -1,180 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Robbbert, Wilbert Pol -#include "includes/osi.h" - -/* Palette Initialization */ - -PALETTE_INIT_MEMBER(sb2m600_state, osi630) -{ - /* black and white */ - palette.set_pen_color(0, 0x00, 0x00, 0x00); // black - palette.set_pen_color(1, 0xff, 0xff, 0xff); // white - - /* color enabled */ - palette.set_pen_color(2, 0xff, 0xff, 0x00); // yellow - palette.set_pen_color(3, 0xff, 0x00, 0x00); // red - palette.set_pen_color(4, 0x00, 0xff, 0x00); // green - palette.set_pen_color(5, 0x00, 0x80, 0x00); // olive green - palette.set_pen_color(6, 0x00, 0x00, 0xff); // blue - palette.set_pen_color(7, 0xff, 0x00, 0xff); // purple - palette.set_pen_color(8, 0x00, 0x00, 0x80); // sky blue - palette.set_pen_color(9, 0x00, 0x00, 0x00); // black -} - -/* Video Start */ - -void sb2m600_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); - UINT16 addr; - - /* randomize video memory contents */ - for (addr = 0; addr < OSI600_VIDEORAM_SIZE; addr++) - m_video_ram[addr] = machine().rand() & 0xff; - - /* randomize color memory contents */ - if (m_color_ram) - for (addr = 0; addr < OSI630_COLORRAM_SIZE; addr++) - m_color_ram[addr] = machine().rand() & 0x0f; -} - -/* Video Update */ - -UINT32 sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int y, bit, sx; - - if (m_32) - { - for (y = 0; y < 256; y++) - { - UINT16 videoram_addr = (y >> 4) * 64; - int line = (y >> 1) & 0x07; - int x = 0; - - for (sx = 0; sx < 64; sx++) - { - UINT8 videoram_data = m_video_ram[videoram_addr]; - UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff; - UINT8 charrom_data = m_p_chargen[charrom_addr]; - - for (bit = 0; bit < 8; bit++) - { - bool color = BIT(charrom_data, 7); - - if (m_coloren) - { - UINT8 colorram_data = m_color_ram[videoram_addr]; - color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; - } - - bitmap.pix16(y, x++) = color; - - charrom_data <<= 1; - } - - videoram_addr++; - } - } - } - else - { - for (y = 0; y < 256; y++) - { - UINT16 videoram_addr = (y >> 3) * 32; - int line = y & 0x07; - int x = 0; - - for (sx = 0; sx < 32; sx++) - { - UINT8 videoram_data = m_video_ram[videoram_addr]; - UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff; - UINT8 charrom_data = m_p_chargen[charrom_addr]; - - for (bit = 0; bit < 8; bit++) - { - bool color = BIT(charrom_data, 7); - - if (m_coloren) - { - UINT8 colorram_data = m_color_ram[videoram_addr]; - color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; - } - - bitmap.pix16(y, x++) = color; - bitmap.pix16(y, x++) = color; - - charrom_data <<= 1; - } - - videoram_addr++; - } - } - } - - return 0; -} - -UINT32 uk101_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int y, bit, sx; - - for (y = 0; y < 256; y++) - { - UINT16 videoram_addr = (y >> 4) * 64; - int line = (y >> 1) & 0x07; - int x = 0; - - for (sx = 0; sx < 64; sx++) - { - UINT8 videoram_data = m_video_ram[videoram_addr++]; - UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff; - UINT8 charrom_data = m_p_chargen[charrom_addr]; - - for (bit = 0; bit < 8; bit++) - { - bitmap.pix16(y, x) = BIT(charrom_data, 7); - x++; - charrom_data <<= 1; - } - } - } - - return 0; -} - -/* Machine Drivers */ - -MACHINE_CONFIG_FRAGMENT( osi600_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(X1/256/256) // 60 Hz - MCFG_SCREEN_UPDATE_DRIVER(sb2m600_state, screen_update) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 32*8-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( uk101_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DRIVER(uk101_state, screen_update) - MCFG_SCREEN_SIZE(64*8, 16*16) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( osi630_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_REFRESH_RATE(X1/256/256) // 60 Hz - MCFG_SCREEN_UPDATE_DRIVER(sb2m600_state, screen_update) - MCFG_SCREEN_SIZE(64*8, 16*16) - MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8+2) - MCFG_PALETTE_INIT_OWNER(sb2m600_state, osi630) -MACHINE_CONFIG_END diff --git a/src/mess/video/p2000m.c b/src/mess/video/p2000m.c deleted file mode 100644 index a75a994fe28..00000000000 --- a/src/mess/video/p2000m.c +++ /dev/null @@ -1,60 +0,0 @@ -// license:??? -// copyright-holders:Paul Daniels -/********************************************************************** - - p2000m.c - - Functions to emulate video hardware of the p2000m - -**********************************************************************/ - -#include "includes/p2000t.h" - - - - -VIDEO_START_MEMBER(p2000t_state,p2000m) -{ - m_frame_count = 0; -} - - -UINT32 p2000t_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_videoram; - int offs, sx, sy, code, loop; - - for (offs = 0; offs < 80 * 24; offs++) - { - sy = (offs / 80) * 20; - sx = (offs % 80) * 12; - - if ((m_frame_count > 25) && (videoram[offs + 2048] & 0x40)) - code = 32; - else - { - code = videoram[offs]; - if ((videoram[offs + 2048] & 0x01) && (code & 0x20)) - { - code += (code & 0x40) ? 64 : 96; - } else { - code &= 0x7f; - } - if (code < 32) code = 32; - } - - m_gfxdecode->gfx(0)->zoom_opaque(bitmap,cliprect, code, - videoram[offs + 2048] & 0x08 ? 0 : 1, 0, 0, sx, sy, 0x20000, 0x20000); - - if (videoram[offs] & 0x80) - { - for (loop = 0; loop < 12; loop++) - { - bitmap.pix16(sy + 18, sx + loop) = 0; /* cursor */ - bitmap.pix16(sy + 19, sx + loop) = 0; /* cursor */ - } - } - } - - return 0; -} diff --git a/src/mess/video/pc1251.c b/src/mess/video/pc1251.c deleted file mode 100644 index c891306600f..00000000000 --- a/src/mess/video/pc1251.c +++ /dev/null @@ -1,163 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#include "emu.h" - -#include "includes/pocketc.h" -#include "includes/pc1251.h" - -static const POCKETC_FIGURE /*busy={ - "11 1 1 11 1 1", - "1 1 1 1 1 1 1", - "11 1 1 1 1 1", - "1 1 1 1 1 1", - "11 1 11 1e" -},*/ def={ - "11 111 111", - "1 1 1 1", - "1 1 111 11", - "1 1 1 1", - "11 111 1e" -}, shift={ - " 11 1 1 1 111 111", - "1 1 1 1 1 1", - " 1 111 1 11 1", - " 1 1 1 1 1 1", - "11 1 1 1 1 1e" -}, /*hyp={ - "1 1 1 1 11", - "1 1 1 1 1 1", - "111 1 1 11", - "1 1 1 1", - "1 1 1 1e" -},*/ de={ - "11 111", - "1 1 1", - "1 1 111", - "1 1 1", - "11 111e" -}, g={ - " 11", - "1", - "1 1", - "1 1", - " 11e" -}, rad={ - "11 1 11", - "1 1 1 1 1 1", - "11 111 1 1", - "1 1 1 1 1 1", - "1 1 1 1 11e" -}, /*braces={ - " 1 1", - "1 1", - "1 1", - "1 1", - " 1 1e" -}, m={ - "1 1", - "11 11", - "1 1 1", - "1 1", - "1 1e" -}, e={ - "111", - "1", - "111", - "1", - "111e" -},*/ run={ - "11 1 1 1 1", - "1 1 1 1 11 1", - "11 1 1 1 11", - "1 1 1 1 1 1", - "1 1 1 1 1e" -}, pro={ - "11 11 1 ", - "1 1 1 1 1 1", - "11 11 1 1", - "1 1 1 1 1", - "1 1 1 1e" -}, /*japan={ - " 1 1 11 1 1 1", - " 1 1 1 1 1 1 1 11 1", - " 1 111 11 111 1 11", - "1 1 1 1 1 1 1 1 1", - " 1 1 1 1 1 1 1 1e" -}, sml={ - " 11 1 1 1", - "1 111 1", - " 1 1 1 1", - " 1 1 1 1", - "11 1 1 111e" -},*/ rsv={ - "11 11 1 1", - "1 1 1 1 1", - "11 1 1 1", - "1 1 1 1 1", - "1 1 11 1e" -}; - -READ8_MEMBER(pc1251_state::pc1251_lcd_read) -{ - UINT8 data = m_reg[offset&0xff]; - logerror("pc1251 read %.3x %.2x\n",offset,data); - return data; -} - -WRITE8_MEMBER(pc1251_state::pc1251_lcd_write) -{ - logerror("pc1251 write %.3x %.2x\n",offset,data); - m_reg[offset&0xff] = data; -} - -#define DOWN 62 -#define RIGHT 68 - -UINT32 pc1251_state::screen_update_pc1251(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, i, j; - int color[2]; - - bitmap.fill(11, cliprect); - - /* HJB: we cannot initialize array with values from other arrays, thus... */ - color[0] = 7; //pocketc_colortable[PC1251_CONTRAST][0]; - color[1] = 8; //pocketc_colortable[PC1251_CONTRAST][1]; - - for (x=RIGHT,y=DOWN, i=0; i<60; x+=3) - { - for (j=0; j<5; j++, i++, x+=3) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i], - PC1251_CONTRAST,0,0, - x,y); - } - for (i=0x7b; i>=0x40; x+=3) - { - for (j=0; j<5; j++, i--, x+=3) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i], - PC1251_CONTRAST,0,0, - x,y); - } - - pocketc_draw_special(bitmap, RIGHT+134, DOWN-10, de, - m_reg[0x3c] & 0x08 ? color[1] : color[0]); - pocketc_draw_special(bitmap, RIGHT+142, DOWN-10, g, - m_reg[0x3c] & 0x04 ? color[1] : color[0]); - pocketc_draw_special(bitmap, RIGHT+146, DOWN-10, rad, - m_reg[0x3d] & 0x04 ? color[1] : color[0]); - pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, def, - m_reg[0x3c] & 0x01 ? color[1] : color[0]); - pocketc_draw_special(bitmap, RIGHT, DOWN-10, shift, - m_reg[0x3d] & 0x02 ? color[1] : color[0]); - pocketc_draw_special(bitmap, RIGHT+38, DOWN-10, pro, - m_reg[0x3e] & 0x01 ? color[1] : color[0]); - pocketc_draw_special(bitmap, RIGHT+53, DOWN-10, run, - m_reg[0x3e] & 0x02 ? color[1] : color[0]); - pocketc_draw_special(bitmap, RIGHT+68, DOWN-10, rsv, - m_reg[0x3e] & 0x04 ? color[1] : color[0]); - - /* 0x3c 1 def?, 4 g, 8 de - 0x3d 2 shift, 4 rad, 8 error - 0x3e 1 pro?, 2 run?, 4rsv?*/ - return 0; -} diff --git a/src/mess/video/pc1350.c b/src/mess/video/pc1350.c deleted file mode 100644 index 0804f75ed7c..00000000000 --- a/src/mess/video/pc1350.c +++ /dev/null @@ -1,165 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#include "emu.h" - -#include "includes/pocketc.h" -#include "includes/pc1350.h" - -static const POCKETC_FIGURE /*busy={ - "11 1 1 11 1 1", - "1 1 1 1 1 1 1", - "11 1 1 1 1 1", - "1 1 1 1 1 1", - "11 1 11 1e" -},*/ def={ - "11 111 111", - "1 1 1 1", - "1 1 111 11", - "1 1 1 1", - "11 111 1e" -}, shift={ - " 11 1 1 1 111 111", - "1 1 1 1 1 1", - " 1 111 1 11 1", - " 1 1 1 1 1 1", - "11 1 1 1 1 1e" -}, /*hyp={ - "1 1 1 1 11", - "1 1 1 1 1 1", - "111 1 1 11", - "1 1 1 1", - "1 1 1 1e" -}, de={ - "11 111", - "1 1 1", - "1 1 111", - "1 1 1", - "11 111e" -}, g={ - " 11", - "1", - "1 1", - "1 1", - " 11e" -}, rad={ - "11 1 11", - "1 1 1 1 1 1", - "11 111 1 1", - "1 1 1 1 1 1", - "1 1 1 1 11e" -}, braces={ - " 1 1", - "1 1", - "1 1", - "1 1", - " 1 1e" -}, m={ - "1 1", - "11 11", - "1 1 1", - "1 1", - "1 1e" -}, e={ - "111", - "1", - "111", - "1", - "111e" -},*/ run={ - "11 1 1 1 1", - "1 1 1 1 11 1", - "11 1 1 1 11", - "1 1 1 1 1 1", - "1 1 1 1 1e" -}, pro={ - "11 11 1 ", - "1 1 1 1 1 1", - "11 11 1 1", - "1 1 1 1 1", - "1 1 1 1e" -}, japan={ - " 1 1 11 1 1 1", - " 1 1 1 1 1 1 1 11 1", - " 1 111 11 111 1 11", - "1 1 1 1 1 1 1 1 1", - " 1 1 1 1 1 1 1 1e" -}, sml={ - " 11 1 1 1", - "1 111 1", - " 1 1 1 1", - " 1 1 1 1", - "11 1 1 111e" -}/*, rsv={ - "11 11 1 1", - "1 1 1 1 1", - "11 1 1 1", - "1 1 1 1 1", - "1 1 11 1e" -}*/; - -READ8_MEMBER(pc1350_state::pc1350_lcd_read) -{ - UINT8 data = m_reg[offset&0xfff]; - logerror("pc1350 read %.3x %.2x\n",offset,data); - return data; -} - -WRITE8_MEMBER(pc1350_state::pc1350_lcd_write) -{ - logerror("pc1350 write %.3x %.2x\n",offset,data); - m_reg[offset&0xfff] = data; -} - -READ8_MEMBER(pc1350_state::pc1350_keyboard_line_r) -{ - return m_reg[0xe00]; -} - -/* pc1350 - 24x4 5x8 no space between chars - 7000 .. 701d, 7200..721d, 7400 ..741d, 7600 ..761d, 7800 .. 781d - 7040 .. 705d, 7240..725d, 7440 ..745d, 7640 ..765d, 7840 .. 785d - 701e .. 703b, 721e..723b, 741e ..743b, 761e ..763b, 781e .. 783b - 705e .. 707b, 725e..727b, 745e ..747b, 765e ..767b, 785e .. 787b - 783c: 0 SHIFT 1 DEF 4 RUN 5 PRO 6 JAPAN 7 SML */ -static const int pc1350_addr[4]={ 0, 0x40, 0x1e, 0x5e }; - -#define DOWN 45 -#define RIGHT 76 - -UINT32 pc1350_state::screen_update_pc1350(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y=DOWN, i, j, k=0, b; - int color[4]; - bitmap.fill(11, cliprect); - - /* HJB: we cannot initialize array with values from other arrays, thus... */ - color[0] = pocketc_colortable[PC1350_CONTRAST][0]; - color[1] = pocketc_colortable[PC1350_CONTRAST][1]; - color[2] = 8; - color[3] = 7; - - for (k=0, y=DOWN; k<4; y+=16, k++) - for (x=RIGHT, i=pc1350_addr[k]; i<0xa00; i+=0x200) - for (j=0; j<=0x1d; j++, x+=2) - for (b = 0; b < 8; b++) - bitmap.plot_box(x, y + b * 2, 2, 2, color[(m_reg[j+i] >> b) & 1]); - - - /* 783c: 0 SHIFT 1 DEF 4 RUN 5 PRO 6 JAPAN 7 SML */ - /* I don't know how they really look like in the lcd */ - pocketc_draw_special(bitmap, RIGHT-30, DOWN+45, shift, - m_reg[0x83c] & 0x01 ? color[2] : color[3]); - pocketc_draw_special(bitmap, RIGHT-30, DOWN+55, def, - m_reg[0x83c] & 0x02 ? color[2] : color[3]); - pocketc_draw_special(bitmap, RIGHT-30, DOWN+5, run, - m_reg[0x83c] & 0x10 ? color[2] : color[3]); - pocketc_draw_special(bitmap, RIGHT-30, DOWN+15, pro, - m_reg[0x83c] & 0x20 ? color[2] : color[3]); - pocketc_draw_special(bitmap, RIGHT-30, DOWN+25, japan, - m_reg[0x83c] & 0x40 ? color[2] : color[3]); - pocketc_draw_special(bitmap, RIGHT-30, DOWN+35, sml, - m_reg[0x83c] & 0x80 ? color[2] : color[3]); - - return 0; -} diff --git a/src/mess/video/pc1401.c b/src/mess/video/pc1401.c deleted file mode 100644 index d7663dce91b..00000000000 --- a/src/mess/video/pc1401.c +++ /dev/null @@ -1,213 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#include "emu.h" - -#include "includes/pocketc.h" -#include "includes/pc1401.h" - -/* pc140x - 16 5x7 with space between char - 6000 .. 6027, 6067.. 6040 - 603c: 3 STAT - 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 HYP, 4 PRO, 5 RUN, 6 CAL - 607c: 0 E, 1 M, 2 (), 3 RAD, 4 G, 5 DE, 6 PRINT */ - -/* pc1421 - 16 5x7 with space between char - 6000 .. 6027, 6067.. 6040 - 603c: 3 RUN - 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 BGN, 4 STAT, 5 FIN, 6 PRINT - 607c: 0 E, 1 M, 2 BAL, 3 INT, 4 PRN, 5 Sum-Sign, 6 PRO */ - -READ8_MEMBER(pc1401_state::pc1401_lcd_read) -{ - return m_reg[offset & 0xff]; -} - -WRITE8_MEMBER(pc1401_state::pc1401_lcd_write) -{ - m_reg[offset & 0xff]=data; -} - -static const POCKETC_FIGURE line={ /* simple line */ - "11111", - "11111", - "11111e" -}; -static const POCKETC_FIGURE busy={ - "11 1 1 11 1 1", - "1 1 1 1 1 1 1", - "11 1 1 1 1 1", - "1 1 1 1 1 1", - "11 1 11 1e" -}, def={ - "11 111 111", - "1 1 1 1", - "1 1 111 11", - "1 1 1 1", - "11 111 1e" -}, shift={ - " 11 1 1 1 111 111", - "1 1 1 1 1 1", - " 1 111 1 11 1", - " 1 1 1 1 1 1", - "11 1 1 1 1 1e" -}, hyp={ - "1 1 1 1 11", - "1 1 1 1 1 1", - "111 1 1 11", - "1 1 1 1", - "1 1 1 1e" -}, de={ - "11 111", - "1 1 1", - "1 1 111", - "1 1 1", - "11 111e" -}, g={ - " 11", - "1", - "1 1", - "1 1", - " 11e" -}, rad={ - "11 1 11", - "1 1 1 1 1 1", - "11 111 1 1", - "1 1 1 1 1 1", - "1 1 1 1 11e" -}, braces={ - " 1 1", - "1 1", - "1 1", - "1 1", - " 1 1e" -}, m={ - "1 1", - "11 11", - "1 1 1", - "1 1", - "1 1e" -}, e={ - "111", - "1", - "111", - "1", - "111e" -}/*, run={ - "11 1 1 1 1", - "1 1 1 1 11 1", - "11 1 1 1 11", - "1 1 1 1 1 1", - "1 1 1 1 1e" -}, pro={ - "11 11 1 ", - "1 1 1 1 1 1", - "11 11 1 1", - "1 1 1 1 1", - "1 1 1 1e" -}, japan={ - " 1 1 11 1 1 1", - " 1 1 1 1 1 1 1 11 1", - " 1 111 11 111 1 11", - "1 1 1 1 1 1 1 1 1", - " 1 1 1 1 1 1 1 1e" -}, sml={ - " 11 1 1 1", - "1 111 1", - " 1 1 1 1", - " 1 1 1 1", - "11 1 1 111e" -}, rsv={ - "11 11 1 1", - "1 1 1 1 1", - "11 1 1 1", - "1 1 1 1 1", - "1 1 11 1e" -}*/; - -#define DOWN 57 -#define RIGHT 114 - -UINT32 pc1401_state::screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, i, j; - int color[2]; - - bitmap.fill(11, cliprect); - -#if 0 - /* HJB: we cannot initialize array with values from other arrays, thus... */ - color[0] = pocketc_colortable[CONTRAST][0]; - color[1] = pocketc_colortable[CONTRAST][1]; -#endif - /* Above can be unreadable or misleading at certain contrast settings, this is better */ - color[0] = 7; - color[1] = 8; - - if (m_portc&1) - { - for (x=RIGHT,y=DOWN,i=0; i<0x28;x+=2) - { - for (j=0; j<5;j++,i++,x+=2) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,x,y); - } - for (i=0x67; i>=0x40;x+=2) - { - for (j=0; j<5;j++,i--,x+=2) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,x,y); - } - } - - pocketc_draw_special(bitmap, RIGHT+149, DOWN+24, line, - m_reg[0x3c] & 0x08 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT, DOWN-10, busy, - m_reg[0x3d] & 0x01 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, def, - m_reg[0x3d] & 0x02 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+43, DOWN-10,shift, - m_reg[0x3d] & 0x04 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+63, DOWN-10,hyp, - m_reg[0x3d] & 0x08 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+38, DOWN+24,line, - m_reg[0x3d] & 0x10 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+23, DOWN+24,line, - m_reg[0x3d] & 0x20 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+8, DOWN+24,line, - m_reg[0x3d] & 0x40 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+183, DOWN-10,e, - m_reg[0x7c] & 0x01 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+176, DOWN-10,m, - m_reg[0x7c] & 0x02 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+168, DOWN-10,braces, - m_reg[0x7c] & 0x04 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+138, DOWN-10,rad, - m_reg[0x7c] & 0x08 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+134, DOWN-10,g, - m_reg[0x7c] & 0x10 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+126, DOWN-10,de, - m_reg[0x7c] & 0x20 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, RIGHT+165, DOWN+24,line, - m_reg[0x7c] & 0x40 ? color[1] : color[0]); - -/* - 603c: 3 STAT - 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 HYP, 4 PRO, 5 RUN, 6 CAL - 607c: 0 E, 1 M, 2 (), 3 RAD, 4 G, 5 DE, 6 PRINT -*/ - return 0; -} diff --git a/src/mess/video/pc1403.c b/src/mess/video/pc1403.c deleted file mode 100644 index 0eb722c0319..00000000000 --- a/src/mess/video/pc1403.c +++ /dev/null @@ -1,246 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/***************************************************************************** - * - * pc1403.c - * portable sharp pc1403 video emulator interface - * (sharp pocket computers) - * - * Copyright (c) 2001 Peter Trauner, all rights reserved. - * - * History of changes: - * 21.07.2001 Several changes listed below were made by Mario Konegger - * (konegger@itp.tu-graz.ac.at) - * Placed the grafical symbols onto the right place and added - * some symbols, so the display is correct rebuit. - * Added a strange behaviour of the display concerning the on/off - * state and the BUSY-symbol, which I found out with experiments - * with my own pc1403. - *****************************************************************************/ - -#include "emu.h" - -#include "includes/pocketc.h" -#include "includes/pc1403.h" - - -void pc1403_state::video_start() -{ - if (strcmp(machine().system().name, "pc1403h") == 0) - { - m_DOWN = 69; - m_RIGHT = 155; - } - else - { - m_DOWN = 67; - m_RIGHT = 152; - } -} - -READ8_MEMBER(pc1403_state::pc1403_lcd_read) -{ - return m_reg[offset]; -} - -WRITE8_MEMBER(pc1403_state::pc1403_lcd_write) -{ - m_reg[offset]=data; -} - -static const POCKETC_FIGURE line={ /* simple line */ - "11111", - "11111", - "11111e" -}; -static const POCKETC_FIGURE busy={ - "11 1 1 11 1 1", - "1 1 1 1 1 1 1", - "11 1 1 1 1 1", - "1 1 1 1 1 1", - "11 1 11 1e" -}, def={ - "11 111 111", - "1 1 1 1", - "1 1 111 11", - "1 1 1 1", - "11 111 1e" -}, shift={ - " 11 1 1 1 111 111", - "1 1 1 1 1 1", - " 1 111 1 11 1", - " 1 1 1 1 1 1", - "11 1 1 1 1 1e" -}, hyp={ - "1 1 1 1 11", - "1 1 1 1 1 1", - "111 1 1 11", - "1 1 1 1", - "1 1 1 1e" -}, de={ - "11 111", - "1 1 1", - "1 1 111", - "1 1 1", - "11 111e" -}, g={ - " 11", - "1", - "1 1", - "1 1", - " 11e" -}, rad={ - "11 1 11", - "1 1 1 1 1 1", - "11 111 1 1", - "1 1 1 1 1 1", - "1 1 1 1 11e" -}, braces={ - " 1 1", - "1 1", - "1 1", - "1 1", - " 1 1e" -}, m={ - "1 1", - "11 11", - "1 1 1", - "1 1", - "1 1e" -}, e={ - "111", - "1", - "111", - "1", - "111e" -}, kana={ // katakana charset - " 1 1 ", - " 11111 111", - " 1 1 1 ", - " 1 1 1 ", - "1 1 1e" -}, shoo={ // minor - " 1 ", - " 1 1 1 ", - "1 1 1", - " 1 ", - " 1e" -}, sml={ - " 11 1 1 1", - "1 111 1", - " 1 1 1 1", - " 1 1 1 1", - "11 1 1 111e" -}; - -UINT32 pc1403_state::screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x, y, i, j; - int color[3]; - - bitmap.fill(11, cliprect); - - /* HJB: we cannot initialize array with values from other arrays, thus... */ - color[0] = 7; // pocketc_colortable[CONTRAST][0]; - color[2] = 8; // pocketc_colortable[CONTRAST][1]; - color[1] = (m_portc & 1) ? color[2] : color[0]; - - if (m_portc & 1) - { - for (x=m_RIGHT, y=m_DOWN, i=0; i<6*5; x+=2) { - for (j=0; j<5; j++, i++, x+=2) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, - x,y); - } - for (i=9*5; i<12*5; x+=2) - { - for (j=0; j<5; j++, i++, x+=2) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, - x,y); - } - for (i=6*5; i<9*5; x+=2) - { - for (j=0; j<5; j++, i++, x+=2) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, - x,y); - } - for (i=0x7b-3*5; i>0x7b-6*5; x+=2) - { - for (j=0; j<5; j++, i--, x+=2) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, - x,y); - } - for (i=0x7b; i>0x7b-3*5; x+=2) - { - for (j=0; j<5; j++, i--, x+=2) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, - x,y); - } - for (i=0x7b-6*5; i>0x7b-12*5; x+=2) - { - for (j=0; j<5; j++, i--, x+=2) - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0, - x,y); - } - } - /* if display is off, busy is always visible? it seems to behave like that. */ - /* But if computer is off, busy is hidden. */ - if(!(m_portc&8)) - { - if (m_portc&1) - pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy, - m_reg[0x3d] & 1 ? color[2] : color[0]); - - else pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy, color[2]); - } - else - pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy, color[0]); - - pocketc_draw_special(bitmap, m_RIGHT+18, m_DOWN-13, def, - m_reg[0x3d] & 0x02 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+43, m_DOWN-13, shift, - m_reg[0x3d] & 0x04 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+63, m_DOWN-13, hyp, - m_reg[0x3d] & 0x08 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, m_RIGHT+155, m_DOWN-13, kana, - m_reg[0x3c] & 0x01 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+167, m_DOWN-13, shoo, - m_reg[0x3c] & 0x02 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+178, m_DOWN-13, sml, - m_reg[0x3c] & 0x04 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, m_RIGHT+191, m_DOWN-13, de, - m_reg[0x7c] & 0x20 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+199, m_DOWN-13, g, - m_reg[0x7c] & 0x10 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+203, m_DOWN-13, rad, - m_reg[0x7c] & 0x08 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, m_RIGHT+266, m_DOWN-13, braces, - m_reg[0x7c] & 0x04 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+274, m_DOWN-13, m, - m_reg[0x7c] & 0x02 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+281, m_DOWN-13, e, - m_reg[0x7c] & 0x01 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, m_RIGHT+10, m_DOWN+27, line /* empty */, - m_reg[0x3c] & 0x40 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+31, m_DOWN+27, line /*calc*/, - m_reg[0x3d] & 0x40 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+52, m_DOWN+27, line/*run*/, - m_reg[0x3d] & 0x20 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+73, m_DOWN+27, line/*prog*/, - m_reg[0x3d] & 0x10 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+94, m_DOWN+27, line /* empty */, - m_reg[0x3c] & 0x20 ? color[1] : color[0]); - - pocketc_draw_special(bitmap, m_RIGHT+232, m_DOWN+27, line/*matrix*/, - m_reg[0x3c] & 0x10 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+253, m_DOWN+27, line/*stat*/, - m_reg[0x3c] & 0x08 ? color[1] : color[0]); - pocketc_draw_special(bitmap, m_RIGHT+274, m_DOWN+27, line/*print*/, - m_reg[0x7c] & 0x40 ? color[1] : color[0]); - - return 0; -} diff --git a/src/mess/video/pc1512.c b/src/mess/video/pc1512.c deleted file mode 100644 index cecfe291d96..00000000000 --- a/src/mess/video/pc1512.c +++ /dev/null @@ -1,606 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "includes/pc1512.h" - - - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -#define LOG 0 - - -static const rgb_t PALETTE_1512[] = -{ - rgb_t::black, - rgb_t(0x00, 0x00, 0xaa), - rgb_t(0x00, 0xaa, 0x00), - rgb_t(0x00, 0xaa, 0xaa), - rgb_t(0xaa, 0x00, 0x00), - rgb_t(0xaa, 0x00, 0xaa), - rgb_t(0xaa, 0x55, 0x00), - rgb_t(0xaa, 0xaa, 0xaa), - rgb_t(0x55, 0x55, 0x55), - rgb_t(0x55, 0x55, 0xff), - rgb_t(0x55, 0xff, 0x55), - rgb_t(0x55, 0xff, 0xff), - rgb_t(0xff, 0x55, 0x55), - rgb_t(0xff, 0x55, 0xff), - rgb_t(0xff, 0xff, 0x55), - rgb_t::white -}; - -static const int PALETTE_0[] = { 0, 3, 5, 7 }; -static const int PALETTE_1[] = { 0, 2, 4, 6 }; -static const int PALETTE_2[] = { 0, 3, 4, 7 }; - - -enum -{ - ALPHA_40 = 0, - ALPHA_80, - GRAPHICS_1, - GRAPHICS_2 -}; - - -#define MODE_ALPHA_80 0x01 -#define MODE_GRAPHICS 0x02 -#define MODE_PALETTE_2 0x04 -#define MODE_ENABLE_VIDEO 0x08 -#define MODE_GRAPHICS_2 0x10 -#define MODE_BLINK 0x20 - - -#define COLOR_INTENSITY 0x10 -#define COLOR_PALETTE_1 0x20 - - -#define VFP_LORES 22 -#define HFP_LORES 16 - - - -//************************************************************************** -// VIDEO RAM ACCESS -//************************************************************************** - -//------------------------------------------------- -// video_ram_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_state::video_ram_r ) -{ - UINT8 data = 0; - - switch (get_display_mode(m_vdu_mode)) - { - case ALPHA_40: - case ALPHA_80: - data = m_video_ram[offset]; - break; - - case GRAPHICS_1: - data = m_video_ram[(offset << 2) | 3]; - break; - - case GRAPHICS_2: - data = m_video_ram[(offset << 2) | (m_vdu_rdsel ^ 0x03)]; - break; - } - - return data; -} - - -//------------------------------------------------- -// video_ram_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_state::video_ram_w ) -{ - switch (get_display_mode(m_vdu_mode)) - { - case ALPHA_40: - case ALPHA_80: - m_video_ram[offset] = data; - break; - - case GRAPHICS_1: - m_video_ram[(offset << 2) | 3] = data; - m_video_ram[(offset << 2) | 2] = data; - m_video_ram[(offset << 2) | 1] = data; - m_video_ram[(offset << 2) | 0] = data; - break; - - case GRAPHICS_2: - if (BIT(m_vdu_plane, 0)) m_video_ram[(offset << 2) | 3] = data; - if (BIT(m_vdu_plane, 1)) m_video_ram[(offset << 2) | 2] = data; - if (BIT(m_vdu_plane, 2)) m_video_ram[(offset << 2) | 1] = data; - if (BIT(m_vdu_plane, 3)) m_video_ram[(offset << 2) | 0] = data; - break; - } -} - - -//------------------------------------------------- -// vdu_r - -//------------------------------------------------- - -READ8_MEMBER( pc1512_state::vdu_r ) -{ - UINT8 data = 0; - - switch (offset) - { - case 1: case 3: case 5: case 7: - data = m_vdu->register_r(space, 0); - break; - - case 0xa: // VDU Status - /* - - bit description - - 0 Toggle Bit - 1 Light-pen latch select - 2 Light-pen switch off - 3 Frame Flyback Time - 4 - 5 - 6 - 7 - - */ - - // toggle bit - data |= m_toggle; - m_toggle = !m_toggle; - - // light pen latch - data |= m_lpen << 1; - - // light pen switch - data |= 0x04; - - // vertical sync - //data |= m_vdu->vsync_r(); - int flyback = 0; - - if (machine().first_screen()->vpos() < VFP_LORES - 16) flyback = 1; - if (machine().first_screen()->vpos() > VFP_LORES + 200) flyback = 1; - - data |= flyback << 3; - break; - } - - return data; -} - - -//------------------------------------------------- -// vdu_w - -//------------------------------------------------- - -WRITE8_MEMBER( pc1512_state::vdu_w ) -{ - switch (offset) - { - case 0: case 2: case 4: case 6: - m_vdu->address_w(space, 0, data); - break; - - case 1: case 3: case 5: case 7: - m_vdu->register_w(space, 0, data); - break; - - case 8: // VDU Mode Control - /* - - bit description - - 0 Select Alpha 80 Char mode (de-select 40 Char mode) - 1 Select Graphics modes (de-select Alpha modes) - 2 Select Palette 2 (de-select palettes 0,1) - 3 Enable Video Display - 4 Select Graphics Mode 2 (de-select graphics mode 1) - 5 Enable Blinking Chars (disable intensified backgrounds) - 6 - 7 - - */ - - if (LOG) logerror("VDU Mode Control %02x\n", data); - - if ((get_display_mode(m_vdu_mode) != GRAPHICS_2) && (get_display_mode(data) == GRAPHICS_2)) - { - m_vdu_plane = 0x0f; - m_vdu_border = 0; - } - - if (get_display_mode(data) != GRAPHICS_2) - { - m_vdu_rdsel = 0; - } - - if (get_display_mode(m_vdu_mode) != get_display_mode(data)) - { - switch (get_display_mode(data)) - { - case ALPHA_40: - case GRAPHICS_1: - m_vdu->set_hpixels_per_column(8); - m_vdu->set_clock(XTAL_28_63636MHz/32); - break; - - case ALPHA_80: - m_vdu->set_hpixels_per_column(8); - m_vdu->set_clock(XTAL_28_63636MHz/16); - break; - - case GRAPHICS_2: - m_vdu->set_hpixels_per_column(16); - m_vdu->set_clock(XTAL_28_63636MHz/32); - break; - } - } - - m_vdu_mode = data; - break; - - case 9: // VDU Colour Select - /* - - bit description - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("VDU Colour Select %02x\n", data); - - m_vdu_color = data; - break; - - case 0xb: // Clear Light Pen Latch - if (LOG) logerror("VDU Clear Light Pen Latch\n"); - - m_lpen = 0; - break; - - case 0xc: // Set Light Pen Latch - if (LOG) logerror("VDU Set Light Pen Latch\n"); - - if (!m_lpen) - { - m_vdu->assert_light_pen_input(); - } - - m_lpen = 1; - break; - - case 0xd: // VDU Colour Plane Write - /* - - bit description - - 0 Allow CPU write to Blue Plane - 1 Allow CPU write to Green Plane - 2 Allow CPU write to Red Plane - 3 Allow CPU write to Intensity Plane - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("VDU Colour Plane Write %01x\n", data & 0x0f); - - if (get_display_mode(m_vdu_mode) == GRAPHICS_2) - { - m_vdu_plane = data; - } - break; - - case 0xe: // VDU Colour Plane Read - /* - - bit description - - 0 Read Select bit 0 (RDSEL0) - 1 Read Select bit 1 (RDSEL1) - 2 - 3 - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("VDU Colour Plane Read %u\n", data & 0x03); - - if (get_display_mode(m_vdu_mode) == GRAPHICS_2) - { - m_vdu_rdsel = data & 0x03; - } - break; - - case 0xf: // VDU Graphics Mode 2 Border - /* - - bit description - - 0 Border Blue - 1 Border Green - 2 Border Red - 3 Border Intensity - 4 - 5 - 6 - 7 - - */ - - if (LOG) logerror("VDU Graphics Mode 2 Border %u\n", data & 0x0f); - - m_vdu_border = data; - break; - } -} - - -//------------------------------------------------- -// mc6845 -//------------------------------------------------- - -int pc1512_state::get_display_mode(UINT8 mode) -{ - if (mode & MODE_GRAPHICS) - { - if (mode & MODE_GRAPHICS_2) - { - return GRAPHICS_2; - } - else - { - return GRAPHICS_1; - } - } - else - { - if (mode & MODE_ALPHA_80) - { - return ALPHA_80; - } - else - { - return ALPHA_40; - } - } -} - -offs_t pc1512_state::get_char_rom_offset() -{ - return ((m_lk->read() >> 5) & 0x03) << 11; -} - -MC6845_UPDATE_ROW( pc1512_state::draw_alpha ) -{ - offs_t char_rom_offset = get_char_rom_offset(); - UINT32 *p = &bitmap.pix32(y + vbp, hbp); - - if (get_display_mode(m_vdu_mode) == ALPHA_40) - p = &bitmap.pix32(y + vbp, hbp); - - if (y > 199) return; - - for (int column = 0; column < x_count; column++) - { - UINT8 code = m_video_ram[(ma + column) << 1]; - UINT8 attr = m_video_ram[((ma + column) << 1) + 1]; - int fg = attr & 0x0f; - int bg = attr >> 4; - - if (m_vdu_mode & MODE_BLINK) - { - bg &= 0x07; - - if (BIT(attr, 7) && !m_blink) - { - fg = bg; - } - } - - offs_t addr = char_rom_offset | (code << 3) | (ra & 0x07); - UINT8 data = m_char_rom->base()[addr & 0x1fff]; - - if ((column == cursor_x) && m_cursor) - { - data = 0xff; - } - - for (int bit = 0; bit < 8; bit++) - { - int color = BIT(data, 7) ? fg : bg; - - *p = PALETTE_1512[de ? color : 0]; p++; - - data <<= 1; - } - } -} - -int pc1512_state::get_color(UINT8 data) -{ - if (data == 0) return m_vdu_color & 0x0f; - - int color = PALETTE_0[data & 0x03]; - - if (m_vdu_color & COLOR_PALETTE_1) - { - color = PALETTE_1[data & 0x03]; - } - else if (m_vdu_mode & MODE_PALETTE_2) - { - color = PALETTE_2[data & 0x03]; - } - - if (m_vdu_color & COLOR_INTENSITY) - { - color += 8; - } - - return color; -} - -MC6845_UPDATE_ROW( pc1512_state::draw_graphics_1 ) -{ - if (y > 199) return; - - UINT32 *p = &bitmap.pix32(y + vbp, hbp); - - for (int column = 0; column < x_count; column++) - { - offs_t offset = ((ra & 0x01) << 15) | ((ma + column) << 3); - - UINT16 b = (m_video_ram[offset | 3] << 8) | m_video_ram[offset | 7]; - - for (int x = 0; x < 8; x++) - { - *p = PALETTE_1512[de ? get_color((BIT(b, 15) << 1) | BIT(b, 14)) : 0]; p++; - b <<= 2; - } - } -} - -MC6845_UPDATE_ROW( pc1512_state::draw_graphics_2 ) -{ - if (y > 199) return; - - UINT32 *p = &bitmap.pix32(y + vbp, hbp); - - for (int column = 0; column < x_count; column++) - { - offs_t offset = ((ra & 0x01) << 15) | ((ma + column) << 3); - - UINT16 i = BIT(m_vdu_color, 3) ? ((m_video_ram[offset | 0] << 8) | m_video_ram[offset | 4]) : 0; - UINT16 r = BIT(m_vdu_color, 2) ? ((m_video_ram[offset | 1] << 8) | m_video_ram[offset | 5]) : 0; - UINT16 g = BIT(m_vdu_color, 1) ? ((m_video_ram[offset | 2] << 8) | m_video_ram[offset | 6]) : 0; - UINT16 b = BIT(m_vdu_color, 0) ? ((m_video_ram[offset | 3] << 8) | m_video_ram[offset | 7]) : 0; - - for (int x = 0; x < 16; x++) - { - *p = PALETTE_1512[de ? (BIT(i, 15) << 3) | (BIT(r, 15) << 2) | (BIT(g, 15) << 1) | BIT(b, 15) : 0]; p++; - i <<= 1; r <<= 1; g <<= 1; b <<= 1; - } - } -} - -MC6845_UPDATE_ROW( pc1512_state::crtc_update_row ) -{ - switch (get_display_mode(m_vdu_mode)) - { - case ALPHA_40: - case ALPHA_80: - draw_alpha(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - - case GRAPHICS_1: - draw_graphics_1(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - - case GRAPHICS_2: - draw_graphics_2(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - } -} - - -void pc1512_state::video_start() -{ - // allocate memory - m_video_ram.allocate(0x10000); -} - - -UINT32 pc1512_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - if (m_vdu_mode & MODE_ENABLE_VIDEO) - { - m_blink_ctr++; - - if (m_blink_ctr == 0x08) - { - m_cursor = !m_cursor; - } - else if (m_blink_ctr == 0x10) - { - m_cursor = !m_cursor; - m_blink = !m_blink; - m_blink_ctr = 0; - } - - switch (get_display_mode(m_vdu_mode)) - { - case ALPHA_40: - case GRAPHICS_1: - screen.set_visible_area(0, 359, 0, 245); - break; - - case ALPHA_80: - case GRAPHICS_2: - screen.set_visible_area(0, 831, 0, 245); - break; - } - - switch (get_display_mode(m_vdu_mode)) - { - case ALPHA_40: - case ALPHA_80: - case GRAPHICS_1: - bitmap.fill(PALETTE_1512[m_vdu_color & 0x0f], cliprect); - break; - - case GRAPHICS_2: - bitmap.fill(PALETTE_1512[m_vdu_border & 0x0f], cliprect); - break; - } - - m_vdu->screen_update(screen, bitmap, cliprect); - } - else - { - bitmap.fill(rgb_t::black, cliprect); - } - - return 0; -} - - -//------------------------------------------------- -// MACHINE_CONFIG( pc1512 ) -//------------------------------------------------- - -MACHINE_CONFIG_FRAGMENT( pc1512_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(pc1512_state, screen_update) - MCFG_SCREEN_SIZE(80*8, 24*8) - MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_REFRESH_RATE(50) - - MCFG_MC6845_ADD(AMS40041_TAG, AMS40041, SCREEN_TAG, XTAL_28_63636MHz/32) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(pc1512_state, crtc_update_row) -MACHINE_CONFIG_END diff --git a/src/mess/video/pc4.c b/src/mess/video/pc4.c deleted file mode 100644 index ce743569bd2..00000000000 --- a/src/mess/video/pc4.c +++ /dev/null @@ -1,196 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sandro Ronco -/*************************************************************************** - - VTech Laser PC4 LCD controller emulation - -***************************************************************************/ - -#include "emu.h" -#include "includes/pc4.h" - -void pc4_state::set_busy_flag(UINT16 usec) -{ - m_busy_flag = 1; - m_busy_timer->adjust( attotime::from_usec( usec ) ); -} - -UINT32 pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0, cliprect); - - if (m_display_on) - for (int l=0; l<4; l++) - for (int i=0; i<40; i++) - { - UINT16 char_pos = l*40 + i; - - for (int y=0; y<8; y++) - for (int x=0; x<5; x++) - if (m_ddram[char_pos] <= 0x10) - { - //draw CGRAM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); - } - else - { - //draw CGROM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x); - - } - - // if is the correct position draw cursor and blink - if (char_pos == m_cursor_pos) - { - //draw the cursor - if (m_cursor_on) - for (int x=0; x<5; x++) - bitmap.pix16(l*9 + 7, i * 6 + x) = 1; - - if (!m_blink && m_blink_on) - for (int y=0; y<7; y++) - for (int x=0; x<5; x++) - bitmap.pix16(l*9 + y, i * 6 + x) = 1; - } - } - - return 0; - -} - -void pc4_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case BUSY_TIMER: - m_busy_flag = 0; - break; - - case BLINKING_TIMER: - m_blink = !m_blink; - break; - } -} - -WRITE8_MEMBER(pc4_state::lcd_control_w) -{ - if (BIT(data, 7)) - { - m_ac_mode = 0; - m_cursor_pos = m_ac = data & 0x7f; - set_busy_flag(37); - } - else if (BIT(data, 6)) - { - m_ac_mode = 1; - m_ac = data & 0x3f; - set_busy_flag(37); - } - else if (BIT(data, 5)) - { - m_cursor_on = BIT(data, 3); - - set_busy_flag(37); - } - else if (BIT(data, 4)) - { - UINT8 direct = (BIT(data, 2)) ? +1 : -1; - - if (BIT(data, 3)) - m_disp_shift += direct; - else - { - m_ac += direct; - m_cursor_pos += direct; - } - - set_busy_flag(37); - } - else if (BIT(data, 3)) - { - m_display_on = BIT(data, 2); - //m_cursor_on = BIT(data, 1); - m_blink_on = BIT(data, 0); - - set_busy_flag(37); - } - else if (BIT(data, 2)) - { - m_direction = (BIT(data, 1)) ? +1 : -1; - m_shift_on = BIT(data, 0); - set_busy_flag(37); - } - else if (BIT(data, 1)) - { - m_ac = 0; - m_cursor_pos = 0; - m_ac_mode = 0; - m_direction = 1; - m_disp_shift = 0; - set_busy_flag(520); - } - else if (BIT(data, 0)) - { - m_ac = 0; - m_cursor_pos = 0; - m_ac_mode = 0; - m_direction = 1; - m_disp_shift = 0; - memset(m_ddram, 0x20, sizeof(m_ddram)); - set_busy_flag(520); - } -} - - -READ8_MEMBER(pc4_state::lcd_control_r) -{ - return m_busy_flag<<7 || m_ac&0x7f; -} - -void pc4_state::update_ac(void) -{ - int new_ac = m_ac + m_direction; - m_ac = (new_ac < 0) ? 0 : ((new_ac >= 0xa0) ? 0xa0 : new_ac); - - if (m_ac_mode == 0) - { - m_cursor_pos = m_ac; - // display is shifted only after a write - if (m_shift_on && m_data_bus_flag == 1) m_disp_shift += m_direction; - } - - m_data_bus_flag = 0; -} - -WRITE8_MEMBER( pc4_state::lcd_offset_w ) -{ - m_cursor_pos = m_ac = (data%0xa0); -} - - -WRITE8_MEMBER(pc4_state::lcd_data_w) -{ - if (m_ac_mode == 0) - m_ddram[m_ac] = data; - else - m_cgram[m_ac] = data; - - update_ac(); - set_busy_flag(41); -} - -READ8_MEMBER(pc4_state::lcd_data_r) -{ - UINT8 data; - - if (m_ac_mode == 0) - data = m_ddram[m_ac]; - else - data = m_cgram[m_ac]; - - m_data_bus_flag = 2; - update_ac(); - set_busy_flag(41); - - return data; -} diff --git a/src/mess/video/pc8401a.c b/src/mess/video/pc8401a.c deleted file mode 100644 index 1cac970396a..00000000000 --- a/src/mess/video/pc8401a.c +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "includes/pc8401a.h" -#include "pc8500.lh" - -/* PC-8401A */ - -PALETTE_INIT_MEMBER(pc8401a_state,pc8401a) -{ - palette.set_pen_color(0, rgb_t(39, 108, 51)); - palette.set_pen_color(1, rgb_t(16, 37, 84)); -} - -void pc8401a_state::video_start() -{ -} - -/* PC-8500 */ - -void pc8500_state::video_start() -{ -} - -UINT32 pc8500_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ -// m_lcdc->screen_update(screen, bitmap, cliprect); - - /* - if (strcmp(screen.tag(), SCREEN_TAG) == 0) - { - sed1330_update(m_lcdc, &bitmap, cliprect); - } - else - { - m_crtc->update(bitmap, cliprect); - } - */ - - return 0; -} - -/* SED1330 Interface */ - -static ADDRESS_MAP_START( pc8401a_lcdc, AS_0, 8, pc8401a_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1fff) - AM_RANGE(0x0000, 0x1fff) AM_RAM -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pc8500_lcdc, AS_0, 8, pc8401a_state ) - ADDRESS_MAP_GLOBAL_MASK(0x3fff) - AM_RANGE(0x0000, 0x3fff) AM_RAM -ADDRESS_MAP_END - - -/* Machine Drivers */ - -MACHINE_CONFIG_FRAGMENT( pc8401a_video ) -// MCFG_DEFAULT_LAYOUT(layout_pc8401a) - - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pc8401a_state,pc8401a) - - /* LCD */ - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(44) - MCFG_SCREEN_UPDATE_DEVICE(SED1330_TAG, sed1330_device, screen_update) - MCFG_SCREEN_SIZE(480, 128) - MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 128-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_SED1330_ADD(SED1330_TAG, 0, SCREEN_TAG, pc8401a_lcdc) -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( pc8500_video ) - MCFG_DEFAULT_LAYOUT(layout_pc8500) - - MCFG_PALETTE_ADD("palette", 2+8) - MCFG_PALETTE_INIT_OWNER(pc8401a_state,pc8401a) - - /* LCD */ - MCFG_SCREEN_ADD(SCREEN_TAG, LCD) - MCFG_SCREEN_REFRESH_RATE(44) - MCFG_SCREEN_UPDATE_DEVICE(SED1330_TAG, sed1330_device, screen_update) - MCFG_SCREEN_SIZE(480, 208) - MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 200-1) - MCFG_SCREEN_PALETTE("palette") - - MCFG_SED1330_ADD(SED1330_TAG, 0, SCREEN_TAG, pc8500_lcdc) - - /* PC-8441A CRT */ - MCFG_SCREEN_ADD(CRT_SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(pc8500_state, screen_update) - MCFG_SCREEN_SIZE(80*8, 24*8) - MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_PALETTE("palette") - - MCFG_MC6845_ADD(MC6845_TAG, MC6845, CRT_SCREEN_TAG, 400000) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(6) -MACHINE_CONFIG_END diff --git a/src/mess/video/pc_t1t.c b/src/mess/video/pc_t1t.c deleted file mode 100644 index e77c5339bd0..00000000000 --- a/src/mess/video/pc_t1t.c +++ /dev/null @@ -1,1033 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/*************************************************************************** - - IBM PC junior - Tandy 1000 Graphics Adapter (T1T) section - - Note that in the IBM PC Junior world, the term 'vga' is not the 'vga' that - most people think of - -***************************************************************************/ - -#include "emu.h" -#include "pc_t1t.h" -#include "machine/pic8259.h" -#include "machine/ram.h" - -enum -{ - T1000_TEXT_INTEN = 0, - T1000_TEXT_BLINK, - T1000_GFX_1BPP, - T1000_GFX_2BPP, - T1000_GFX_4BPP, - T1000_GFX_2BPP_TGA, - PCJX_TEXT, - PCJR_GFX_2BPP_HIGH -}; - - -const device_type PCVIDEO_T1000 = &device_creator; -const device_type PCVIDEO_PCJR = &device_creator; - -pc_t1t_device::pc_t1t_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_video_interface(mconfig, *this), - m_mc6845(*this, T1000_MC6845_NAME), - m_mode_control(0), - m_color_select(0), - m_status(0), - m_bank(0), - m_pc_framecnt(0), - m_displayram(NULL), - m_chr_gen(NULL), - m_chr_size(0), - m_ra_offset(0), - m_address_data_ff(0), - m_update_row_type(-1), - m_display_enable(0), - m_vsync(0), - m_palette_base(0), - m_palette(*this,"palette") -{ -} - -pcvideo_t1000_device::pcvideo_t1000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : pc_t1t_device(mconfig, PCVIDEO_T1000, "Tandy 1000 Graphics Adapter", tag, owner, clock, "tandy_1000_graphics_adapter", __FILE__), - m_t1_displayram(NULL) -{ -} - -pcvideo_pcjr_device::pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : pc_t1t_device(mconfig, PCVIDEO_PCJR, "PC Jr Graphics Adapter", tag, owner, clock, "pcjr_graphics_adapter", __FILE__), - m_jxkanji(NULL) -{ -} - - -void pcvideo_t1000_device::device_start() -{ - m_chr_gen = machine().root_device().memregion("gfx1")->base(); - m_bank = 0; - m_chr_size = 1; - m_ra_offset = 256; -} - - -void pcvideo_pcjr_device::device_start() -{ - m_chr_gen = machine().root_device().memregion("gfx1")->base(); - m_bank = 0; - m_mode_control = 0x08; - m_chr_size = 8; - m_ra_offset = 1; - if(!strncmp(machine().system().name, "ibmpcjx", 7)) - m_jxkanji = machine().root_device().memregion("kanji")->base(); - else - m_jxkanji = NULL; -} - - -/*************************************************************************** - - Static declarations - -***************************************************************************/ - -MACHINE_CONFIG_FRAGMENT( pcvideo_t1000 ) - MCFG_SCREEN_ADD(T1000_SCREEN_NAME, RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,262,0,200) - MCFG_SCREEN_UPDATE_DEVICE( T1000_MC6845_NAME, mc6845_device, screen_update ) - - MCFG_PALETTE_ADD( "palette", 32 ) - MCFG_PALETTE_INIT_OWNER(pc_t1t_device, pcjr) - - MCFG_MC6845_ADD(T1000_MC6845_NAME, MC6845, T1000_SCREEN_NAME, XTAL_14_31818MHz/8) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(pc_t1t_device, crtc_update_row) - MCFG_MC6845_OUT_DE_CB(WRITELINE(pc_t1t_device, t1000_de_changed)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(pcvideo_t1000_device, t1000_vsync_changed)) -MACHINE_CONFIG_END - -machine_config_constructor pcvideo_t1000_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pcvideo_t1000 ); -} - - -MACHINE_CONFIG_FRAGMENT( pcvideo_pcjr ) - MCFG_SCREEN_ADD(T1000_SCREEN_NAME, RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,262,0,200) - MCFG_SCREEN_UPDATE_DEVICE( T1000_MC6845_NAME, mc6845_device, screen_update ) - - MCFG_PALETTE_ADD( "palette", 32 ) - MCFG_PALETTE_INIT_OWNER(pc_t1t_device, pcjr) - - MCFG_MC6845_ADD(T1000_MC6845_NAME, MC6845, T1000_SCREEN_NAME, XTAL_14_31818MHz/16) - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(pcvideo_pcjr_device, crtc_update_row) - MCFG_MC6845_OUT_DE_CB(WRITELINE(pc_t1t_device, t1000_de_changed)) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(pcvideo_pcjr_device, pcjr_vsync_changed)) -MACHINE_CONFIG_END - -machine_config_constructor pcvideo_pcjr_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pcvideo_pcjr ); -} - - -/*************************************************************************** - - Methods - -***************************************************************************/ - -/* Initialise the cga palette */ -PALETTE_INIT_MEMBER( pc_t1t_device, pcjr ) -{ - const static unsigned char tga_palette[16][3] = - { - { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0xaa }, { 0x00, 0xaa, 0x00 }, { 0x00, 0xaa, 0xaa }, - { 0xaa, 0x00, 0x00 }, { 0xaa, 0x00, 0xaa }, { 0xaa, 0x55, 0x00 }, { 0xaa, 0xaa, 0xaa }, - { 0x55, 0x55, 0x55 }, { 0x55, 0x55, 0xff }, { 0x55, 0xff, 0x55 }, { 0x55, 0xff, 0xff }, - { 0xff, 0x55, 0x55 }, { 0xff, 0x55, 0xff }, { 0xff, 0xff, 0x55 }, { 0xff, 0xff, 0xff } - }; - int i; - - /* colors */ - for(i = 0; i < 16; i++) - palette.set_pen_color(i, tga_palette[i][0], tga_palette[i][1], tga_palette[i][2]); - - /* b/w mode shades */ - for(i = 0; i < 16; i++) - palette.set_pen_color(16+i, ( i << 4 ) | i, ( i << 4 ) | i, ( i << 4 ) | i ); -} - - -MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - int i; - - if ( y == 0 ) logerror("t1000_text_inten_update_row\n"); - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ( ma + i ) << 1 ) & 0x3fff; - UINT8 chr = m_displayram[ offset ]; - UINT8 attr = m_displayram[ offset +1 ]; - UINT8 data = m_chr_gen[ chr * m_chr_size + ra * m_ra_offset ]; - UINT16 fg = m_palette_base + ( attr & 0x0F ); - UINT16 bg = m_palette_base + ( ( attr >> 4 ) & 0x07 ); - - if ( i == cursor_x && ( m_pc_framecnt & 0x08 ) ) - { - data = 0xFF; - } - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - } -} - - -MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - int i; - - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ( ma + i ) << 1 ) & 0x3fff; - UINT8 chr = m_displayram[ offset ]; - UINT8 attr = m_displayram[ offset +1 ]; - UINT8 data = m_chr_gen[ chr * m_chr_size + ra * m_ra_offset ]; - UINT16 fg = m_palette_base + ( attr & 0x0F ); - UINT16 bg = m_palette_base + ( ( attr >> 4 ) & 0x07 ); - - if ( i == cursor_x ) - { - if ( m_pc_framecnt & 0x08 ) - { - data = 0xFF; - } - } - else - { - if ( ( attr & 0x80 ) && ( m_pc_framecnt & 0x10 ) ) - { - data = 0x00; - } - } - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - } -} - -MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjx_text_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - int i; - - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ( ma + i ) << 1 ) & 0x3fff; - UINT8 chr = m_displayram[ offset ]; - UINT8 attr = m_displayram[ offset +1 ]; - UINT16 fg = m_palette_base + ( attr & 0x07 ); - UINT16 bg = m_palette_base + ( ( attr >> 4 ) & 0x07 ); - UINT16 code = chr & 0x1f; - if((attr & 0x88) == 0x88) - { - code = m_displayram[ offset - 2 ] & 0x1f; - code = (code << 8) + chr; - } - else if(attr & 0x80) - code = (code << 8) + m_displayram[ offset + 2 ]; - else - code = chr; - - UINT8 data; - if(ra < 16) - data = m_jxkanji[code * 16 * 2 + (ra * 2) + ((attr & 8)?1:0)]; - else - data = ((i == cursor_x) && (m_pc_framecnt & 8)) ? 0xff: 0; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - } -} - -MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_4bpp_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - UINT8 *vid = m_displayram + ( ra << 13 ); - int i; - - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; - UINT8 data = vid[ offset ]; - - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - - data = vid[ offset + 1 ]; - - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - } -} - - -MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - UINT8 *vid = m_displayram + ( ra << 13 ); - int i; - - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; - UINT8 data = vid[ offset ]; - - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; - - data = vid[ offset+1 ]; - - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; - } -} - - -MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjr_gfx_2bpp_high_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - UINT8 *vid = m_displayram + ( ra << 13 ); - int i; - - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; - UINT8 data0 = vid[ offset ]; - UINT8 data1 = vid[ offset + 1 ]; - - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x80 ) >> 7 ) | ( ( data1 & 0x80 ) >> 6 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x40 ) >> 6 ) | ( ( data1 & 0x40 ) >> 5 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x20 ) >> 5 ) | ( ( data1 & 0x20 ) >> 4 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x10 ) >> 4 ) | ( ( data1 & 0x10 ) >> 3 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x08 ) >> 3 ) | ( ( data1 & 0x08 ) >> 2 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x04 ) >> 2 ) | ( ( data1 & 0x04 ) >> 1 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x02 ) >> 1 ) | ( ( data1 & 0x02 ) ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x01 ) ) | ( ( data1 & 0x01 ) << 1 ) ) ]]; p++; - } -} - - -MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_tga_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - UINT8 *vid = m_displayram + ( ra << 13 ); - int i; - - if ( y == 0 ) logerror("t1000_gfx_2bpp_tga_update_row\n"); - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; - UINT8 data = vid[ offset ]; - UINT16 data2 = ( vid[ offset + 1 ] ) << 1; - - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x100 ) | ( data & 0x80 ) ) >> 7 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x80 ) | ( data & 0x40 ) ) >> 6 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x40 ) | ( data & 0x20 ) ) >> 5 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x20 ) | ( data & 0x10 ) ) >> 4 ) ]]; p++; - - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x10 ) | ( data & 0x08 ) ) >> 3 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x08 ) | ( data & 0x04 ) ) >> 2 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x04 ) | ( data & 0x02 ) ) >> 1 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( data2 & 0x02 ) | ( data & 0x01 ) ) ]]; p++; - } -} - - -MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_1bpp_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(y); - UINT8 *vid = m_displayram + ( ra << 13 ); - UINT8 fg = m_palette_base + m_reg.data[0x11]; - UINT8 bg = m_palette_base + m_reg.data[0x10]; - int i; - - if ( y == 0 ) logerror("t1000_gfx_1bpp_update_row\n"); - for ( i = 0; i < x_count; i++ ) - { - UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; - UINT8 data = vid[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - - data = vid[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - } -} - -MC6845_UPDATE_ROW( pc_t1t_device::crtc_update_row ) -{ - if (m_update_row_type == -1) - return; - - switch (m_update_row_type) - { - case T1000_TEXT_INTEN: - t1000_text_inten_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - case T1000_TEXT_BLINK: - t1000_text_blink_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - case T1000_GFX_1BPP: - t1000_gfx_1bpp_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - case T1000_GFX_2BPP: - t1000_gfx_2bpp_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - case T1000_GFX_2BPP_TGA: - t1000_gfx_2bpp_tga_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - case T1000_GFX_4BPP: - t1000_gfx_4bpp_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - } -} - - -MC6845_UPDATE_ROW( pcvideo_pcjr_device::crtc_update_row ) -{ - if (m_update_row_type == -1) - return; - - switch (m_update_row_type) - { - case PCJX_TEXT: - pcjx_text_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - case PCJR_GFX_2BPP_HIGH: - pcjr_gfx_2bpp_high_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - default: - pc_t1t_device::crtc_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); - break; - } -} - - -READ8_MEMBER( pcvideo_t1000_device::videoram_r ) -{ - UINT8 *videoram = m_t1_displayram; - int data = 0xff; - if( videoram ) - data = videoram[offset]; - return data; -} - -WRITE8_MEMBER( pcvideo_t1000_device::videoram_w ) -{ - UINT8 *videoram = m_t1_displayram; - if( videoram ) - videoram[offset] = data; -} - -void pcvideo_t1000_device::mode_switch( void ) -{ - switch( m_mode_control & 0x3B ) - { - case 0x08: case 0x09: - m_update_row_type = T1000_TEXT_INTEN; - break; - case 0x28: case 0x29: - m_update_row_type = T1000_TEXT_BLINK; - break; - case 0x0A: case 0x0B: case 0x2A: case 0x2B: - switch( m_bank & 0xc0 ) - { - case 0x00: - case 0x40: - //logerror("t1t_gfx_2bpp - 1\n"); - m_update_row_type = T1000_GFX_2BPP; - if ( m_color_select ) - { - m_reg.data[0x10] = 0x00; - m_reg.data[0x11] = 0x0B; - m_reg.data[0x12] = 0x0D; - m_reg.data[0x13] = 0x0F; - } - else - { - m_reg.data[0x10] = 0x00; - m_reg.data[0x11] = 0x0A; - m_reg.data[0x12] = 0x0C; - m_reg.data[0x13] = 0x0E; - } - break; - case 0x80: - case 0xc0: - //logerror("t1t_gfx_4bpp\n"); - m_update_row_type = T1000_GFX_4BPP; - break; - } - break; - case 0x18: case 0x19: case 0x1A: case 0x1B: - case 0x38: case 0x39: case 0x3A: case 0x3B: - switch( m_bank & 0xc0 ) - { - case 0x00: - case 0x40: - //logerror("t1t_gfx_1bpp\n"); - m_update_row_type = T1000_GFX_1BPP; - break; - case 0x80: - case 0xc0: - //logerror("t1t_gfx_2bpp - 2\n"); - m_update_row_type = T1000_GFX_2BPP_TGA; - break; - } - break; - default: - m_update_row_type = -1; - break; - } -} - - -/* mode control 1 ( m_reg.data[0] ) */ -/* bit0 - 0 = low bandwidth, 1 = high bandwidth */ -/* bit1 - 0 = alpha, 1 = graphics */ -/* bit2 - 0 = color, 1 = b/w */ -/* bit3 - 0 = video disable, 1 = video enable */ -/* bit4 - 1 = 16 color graphics */ -/* mode control 2 ( m_reg.data[3] ) */ -/* bit1 - 1 = enable blink */ -/* bit3 - 1 = 2 color graphics */ - -void pcvideo_pcjr_device::pc_pcjr_mode_switch() -{ - switch( m_reg.data[0] & 0x1A ) - { - case 0x08: /* 01x0x */ - if(m_jxkanji) - { - m_update_row_type = PCJX_TEXT; - break; - } - if ( m_reg.data[3] & 0x02 ) - { - m_update_row_type = T1000_TEXT_BLINK; - } - else - { - m_update_row_type = T1000_TEXT_INTEN; - } - break; - case 0x0A: /* 01x1x */ - /* By default use medium resolution mode */ - m_update_row_type = T1000_GFX_2BPP; - - /* Check for high resolution mode */ - if ( ( m_bank & 0xc0 ) == 0xc0 ) - m_update_row_type = PCJR_GFX_2BPP_HIGH; - - /* Check for 640x200 b/w 2 shades mode */ - if ( ( m_reg.data[0] & 0x04 ) && ( m_reg.data[3] & 0x08 ) ) - { - m_update_row_type = T1000_GFX_1BPP; - } - break; - case 0x18: /* 11x0x - invalid?? */ - m_update_row_type = -1; - break; - case 0x1A: /* 11x1x */ - m_update_row_type = T1000_GFX_4BPP; - break; - default: - m_update_row_type = -1; - break; - } - - /* Determine mc6845 input clock */ - if ( m_reg.data[0] & 0x01 ) - { - m_mc6845->set_clock( XTAL_14_31818MHz/8 ); - } - else - { - m_mc6845->set_clock( XTAL_14_31818MHz/16 ); - } - - /* color or b/w? */ - m_palette_base = ( m_reg.data[0] & 0x04 ) ? 16 : 0; -} - - -/* - * 3d8 rW T1T mode control register (see #P138) - */ -void pcvideo_t1000_device::mode_control_w(int data) -{ - m_mode_control = data; - - mode_switch(); -} - -int pc_t1t_device::mode_control_r(void) -{ - int data = m_mode_control; - return data; -} - -/* - * 3d9 ?W color select register on color adapter - */ -void pc_t1t_device::color_select_w(int data) -{ - if (m_color_select == data) - return; - m_color_select = data; -} - -int pc_t1t_device::color_select_r(void) -{ - int data = m_color_select; - return data; -} - -/* Bitfields for T1T status register: - * Bit(s) Description (Table P179) - * 7-6 not used - * 5-4 color EGA, color ET4000: diagnose video display feedback, select - * from color plane enable - * 4 holds current dot being displayed - * 3 in vertical retrace - * 2 (CGA,color EGA) light pen switch is off - * (MCGA,color ET4000) reserved (0) - * 1 (CGA,color EGA) positive edge from light pen has set trigger - * (MCGA,color ET4000) reserved (0) - * 0 display enabled - * =0 do not use memory - * =1 memory access without interfering with display - * (Genoa SuperEGA) horizontal or vertical retrace - */ -int pc_t1t_device::status_r(void) -{ - int data = m_vsync | m_status | m_display_enable; - /* HACK HACK HACK */ - data |= ( m_display_enable ? 0x10 : 0x00 ); - /* end HACK */ - return data; -} - -/* - * 3db -W light pen strobe reset (on any value) - */ -void pc_t1t_device::lightpen_strobe_w(int data) -{ -// pc_port[0x3db] = data; -} - - -/* - * 3da -W (mono EGA/mono VGA) feature control register - * (see PORT 03DAh-W for details; VGA, see PORT 03CAh-R) - */ -void pc_t1t_device::vga_index_w(int data) -{ - m_reg.index = data; -} - -void pcvideo_t1000_device::vga_data_w(int data) -{ - m_reg.data[m_reg.index] = data; - - switch (m_reg.index) - { - case 0x00: /* mode control 1 */ - break; - case 0x01: /* palette mask (bits 3-0) */ - break; - case 0x02: /* border color (bits 3-0) */ - break; - case 0x03: /* mode control 2 */ - break; - case 0x04: /* reset register */ - break; - /* palette array */ - case 0x10: case 0x11: case 0x12: case 0x13: - case 0x14: case 0x15: case 0x16: case 0x17: - case 0x18: case 0x19: case 0x1a: case 0x1b: - case 0x1c: case 0x1d: case 0x1e: case 0x1f: - m_reg.data[m_reg.index] = data & 0x0F; - break; - } -} - - -void pcvideo_pcjr_device::pc_pcjr_vga_data_w(int data) -{ - m_reg.data[m_reg.index] = data; - - switch (m_reg.index) - { - case 0x00: /* mode control 1 */ - /* bit0 - 0 = low bandwidth, 1 = high bandwidth */ - /* bit1 - 0 = alpha, 1 = graphics */ - /* bit2 - 0 = color, 1 = b/w */ - /* bit3 - 0 = video disable, 1 = video enable */ - /* bit4 - 1 = 16 color graphics */ - pc_pcjr_mode_switch(); - break; - case 0x01: /* palette mask (bits 3-0) */ - break; - case 0x02: /* border color (bits 3-0) */ - break; - case 0x03: /* mode control 2 */ - /* bit1 - 1 = enable blink */ - /* bit3 - 1 = 2 color graphics */ - pc_pcjr_mode_switch(); - break; - case 0x04: /* reset register */ - break; - /* palette array */ - case 0x10: case 0x11: case 0x12: case 0x13: - case 0x14: case 0x15: case 0x16: case 0x17: - case 0x18: case 0x19: case 0x1a: case 0x1b: - case 0x1c: case 0x1d: case 0x1e: case 0x1f: - m_reg.data[m_reg.index] = data & 0x0F; - break; - } -} - - -int pc_t1t_device::vga_data_r(void) -{ - int data = m_reg.data[m_reg.index]; - - switch (m_reg.index) - { - case 0x00: /* mode control 1 */ - break; - case 0x01: /* palette mask (bits 3-0) */ - break; - case 0x02: /* border color (bits 3-0) */ - break; - case 0x03: /* mode control 2 */ - break; - case 0x04: /* reset register */ - break; - /* palette array */ - case 0x10: case 0x11: case 0x12: case 0x13: - case 0x14: case 0x15: case 0x16: case 0x17: - case 0x18: case 0x19: case 0x1a: case 0x1b: - case 0x1c: case 0x1d: case 0x1e: case 0x1f: - break; - } - return data; -} - -/* - * 3df RW display bank, access bank, mode - * bit 0-2 Identifies the page of main memory being displayed in units of 16K. - * 0: 0K, 1: 16K...7: 112K. In 32K modes (bits 6-7 = 2) only 0,2,4 and - * 6 are valid, as the next page will also be used. - * 3-5 Identifies the page of main memory that can be read/written at B8000h - * in units of 16K. 0: 0K, 1: 16K...7: 112K. In 32K modes (bits 6-7 = 2) - * only 0,2,4 and 6 are valid, as the next page will also be used. - * 6-7 Display mode. 0: Text, 1: 16K graphics mode (4,5,6,8) - * 2: 32K graphics mode (9,Ah) - */ -void pcvideo_t1000_device::bank_w(int data) -{ - if (m_bank != data) - { - UINT8 *ram = machine().root_device().memregion("maincpu")->base(); - int dram, vram; - m_bank = data; - /* it seems the video ram is mapped to the last 128K of main memory */ -#if 1 - if ((data&0xc0)==0xc0) /* needed for lemmings */ - { - dram = 0x80000 + ((data & 0x06) << 14); - vram = 0x80000 + ((data & 0x30) << (14-3)); - } - else - { - dram = 0x80000 + ((data & 0x07) << 14); - vram = 0x80000 + ((data & 0x38) << (14-3)); - } -#else - dram = (data & 0x07) << 14; - vram = (data & 0x38) << (14-3); -#endif - m_t1_displayram = &ram[vram]; - m_displayram = &ram[dram]; - mode_switch(); - } -} - - -void pcvideo_pcjr_device::pc_pcjr_bank_w(int data) -{ - if (m_bank != data) - { - int dram, vram; - m_bank = data; - /* it seems the video ram is mapped to the last 128K of main memory */ - if ((data&0xc0)==0xc0) /* needed for lemmings */ - { - dram = ((data & 0x06) << 14); - vram = ((data & 0x30) << (14-3)); - } - else - { - dram = ((data & 0x07) << 14); - vram = ((data & 0x38) << (14-3)); - } - machine().root_device().membank( "bank14" )->set_base( machine().device(RAM_TAG)->pointer() + vram ); - m_displayram = machine().device(RAM_TAG)->pointer() + dram; - pc_pcjr_mode_switch(); - } -} - -void pcvideo_pcjr_device::pc_pcjx_bank_w(int data) -{ - if (m_bank != data) - { - int dram, vram; - m_bank = data; - /* this probably isn't right, but otherwise the memory test stomps on the vram */ - if ((data&0xc0)==0xc0) /* needed for lemmings */ - { - dram = 0x80000 + ((data & 0x06) << 14); - vram = 0x80000 + ((data & 0x30) << (14-3)); - } - else - { - dram = 0x80000 + ((data & 0x07) << 14); - vram = 0x80000 + ((data & 0x38) << (14-3)); - } - machine().root_device().membank( "bank14" )->set_base( machine().device(RAM_TAG)->pointer() + vram ); - m_displayram = machine().device(RAM_TAG)->pointer() + dram; - pc_pcjr_mode_switch(); - } -} - -int pc_t1t_device::bank_r(void) -{ - return m_bank; -} - -/************************************************************************* - * - * T1T - * Tandy 1000 / PCjr - * - *************************************************************************/ - -WRITE8_MEMBER( pcvideo_t1000_device::write ) -{ - switch( offset ) - { - case 0: case 2: case 4: case 6: - m_mc6845->address_w( space, offset, data ); - break; - case 1: case 3: case 5: case 7: - m_mc6845->register_w( space, offset, data ); - break; - case 8: - mode_control_w(data); - break; - case 9: - color_select_w(data); - break; - case 10: - vga_index_w(data); - break; - case 11: - lightpen_strobe_w(data); - break; - case 12: - break; - case 13: - break; - case 14: - vga_data_w(data); - break; - case 15: - bank_w(data); - break; - } -} - - -WRITE8_MEMBER( pcvideo_pcjr_device::write ) -{ - switch( offset ) - { - case 0: case 4: - m_mc6845->address_w( space, offset, data ); - break; - case 1: case 5: - m_mc6845->register_w( space, offset, data ); - break; - case 10: - if ( m_address_data_ff & 0x01 ) - { - pc_pcjr_vga_data_w( data ); - } - else - { - vga_index_w( data ); - } - m_address_data_ff ^= 0x01; - break; - case 11: - lightpen_strobe_w(data); - break; - case 12: - break; - case 15: - if(m_jxkanji) - pc_pcjx_bank_w(data); - else - pc_pcjr_bank_w(data); - break; - - default: - break; - } -} - - -READ8_MEMBER( pc_t1t_device::read ) -{ - int data = 0xff; - - switch( offset ) - { - case 0: case 2: case 4: case 6: - /* return last written mc6845 address value here? */ - break; - - case 1: case 3: case 5: case 7: - data = m_mc6845->register_r( space, offset ); - break; - - case 8: - data = mode_control_r(); - break; - - case 9: - data = color_select_r(); - break; - - case 10: - m_address_data_ff = 0; - data = status_r(); - break; - - case 11: - /* -W lightpen strobe reset */ - break; - - case 12: - case 13: - break; - - case 14: - data = vga_data_r(); - break; - - case 15: - data = bank_r(); - break; - } - return data; -} - - -WRITE_LINE_MEMBER( pc_t1t_device::t1000_de_changed ) -{ - m_display_enable = state ? 1 : 0; -} - - -WRITE_LINE_MEMBER( pcvideo_t1000_device::t1000_vsync_changed ) -{ - m_vsync = state ? 8 : 0; - if ( state ) - { - m_pc_framecnt++; - } -} - - -WRITE_LINE_MEMBER( pcvideo_pcjr_device::pcjr_vsync_changed ) -{ - m_vsync = state ? 8 : 0; - if ( state ) - { - m_pc_framecnt++; - } - machine().device("pic8259")->ir5_w(state); -} diff --git a/src/mess/video/pc_t1t.h b/src/mess/video/pc_t1t.h deleted file mode 100644 index 3c89cbc0b0f..00000000000 --- a/src/mess/video/pc_t1t.h +++ /dev/null @@ -1,147 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#ifndef PC_T1T_H -#define PC_T1T_H - -#include "video/mc6845.h" - -#define T1000_SCREEN_NAME "screen" -#define T1000_MC6845_NAME "mc6845_t1000" - -// used in tandy1000hx; used in pcjr??? -struct reg -{ - reg() - { - index = 0; - memset(&data, 0, sizeof(data)); - } - - UINT8 index; - UINT8 data[0x20]; - /* see vgadoc - 0 mode control 1 - 1 palette mask - 2 border color - 3 mode control 2 - 4 reset - 0x10-0x1f palette registers - */ -}; - -class pc_t1t_device : public device_t, - public device_video_interface -{ -public: - // construction/destruction - pc_t1t_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - DECLARE_PALETTE_INIT( pcjr ); - - DECLARE_WRITE_LINE_MEMBER( t1000_de_changed ); - - virtual MC6845_UPDATE_ROW( crtc_update_row ); - MC6845_UPDATE_ROW( t1000_text_inten_update_row ); - MC6845_UPDATE_ROW( t1000_text_blink_update_row ); - MC6845_UPDATE_ROW( t1000_gfx_4bpp_update_row ); - MC6845_UPDATE_ROW( t1000_gfx_2bpp_update_row ); - MC6845_UPDATE_ROW( t1000_gfx_2bpp_tga_update_row ); - MC6845_UPDATE_ROW( t1000_gfx_1bpp_update_row ); - - required_device m_mc6845; - UINT8 m_mode_control, m_color_select; - UINT8 m_status; - - struct reg m_reg; - - UINT8 m_bank; - - int m_pc_framecnt; - - UINT8 *m_displayram; - - UINT8 *m_chr_gen; - UINT8 m_chr_size; - UINT16 m_ra_offset; - - UINT8 m_address_data_ff; - - int m_update_row_type; - UINT8 m_display_enable; - UINT8 m_vsync; - UINT8 m_palette_base; - - int mode_control_r(void); - void color_select_w(int data); - int color_select_r(void); - int status_r(void); - void lightpen_strobe_w(int data); - void vga_index_w(int data); - int vga_data_r(void); - int bank_r(void); - - DECLARE_READ8_MEMBER( read ); - required_device m_palette; -}; - -class pcvideo_t1000_device : public pc_t1t_device -{ -public: - // construction/destruction - pcvideo_t1000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( videoram_r ); - DECLARE_WRITE8_MEMBER( videoram_w ); - DECLARE_WRITE_LINE_MEMBER( t1000_vsync_changed ); - -protected: - virtual machine_config_constructor device_mconfig_additions() const; - virtual void device_start(); - -private: - UINT8 *m_t1_displayram; - void mode_switch( void ); - void vga_data_w(int data); - void bank_w(int data); - void mode_control_w(int data); -}; - -extern const device_type PCVIDEO_T1000; - -#define MCFG_PCVIDEO_T1000_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, PCVIDEO_T1000, 0) - -class pcvideo_pcjr_device : public pc_t1t_device -{ -public: - // construction/destruction - pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_WRITE8_MEMBER( write ); - DECLARE_WRITE_LINE_MEMBER( pcjr_vsync_changed ); - - UINT8 *m_jxkanji; - - virtual MC6845_UPDATE_ROW( crtc_update_row ); - MC6845_UPDATE_ROW( pcjx_text_update_row ); - MC6845_UPDATE_ROW( pcjr_gfx_2bpp_high_update_row ); - -protected: - virtual machine_config_constructor device_mconfig_additions() const; - virtual void device_start(); - -private: - void pc_pcjr_mode_switch(); - void pc_pcjr_vga_data_w(int data); - void pc_pcjr_bank_w(int data); - void pc_pcjx_bank_w(int data); -}; - -extern const device_type PCVIDEO_PCJR; - -#define MCFG_PCVIDEO_PCJR_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, PCVIDEO_PCJR, 0) - - -#endif /* PC_T1T_H */ diff --git a/src/mess/video/pcd.c b/src/mess/video/pcd.c deleted file mode 100644 index 3c8f305c078..00000000000 --- a/src/mess/video/pcd.c +++ /dev/null @@ -1,396 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl - -#include "pcd.h" -#include "cpu/mcs51/mcs51.h" -#include "cpu/mcs48/mcs48.h" - -const device_type PCD_VIDEO = &device_creator; -const device_type PCX_VIDEO = &device_creator; - -pcdx_video_device::pcdx_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : - device_t(mconfig, type, name, tag, owner, clock, shortname, source), - m_maincpu(*this, ":maincpu"), - m_mcu(*this, "graphics"), - m_crtc(*this, "crtc"), - m_palette(*this, "palette"), - m_gfxdecode(*this, "gfxdecode") -{ -} - -pcd_video_device::pcd_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - pcdx_video_device(mconfig, PCD_VIDEO, "Siemens PC-D Video", tag, owner, clock, "pcd_video", __FILE__), - m_vram(32*1024), - m_charram(8*1024) -{ -} - -pcx_video_device::pcx_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - pcdx_video_device(mconfig, PCX_VIDEO, "Siemens PC-X Video", tag, owner, clock, "pcx_video", __FILE__), - device_serial_interface(mconfig, *this), - m_vram(4*1024), - m_charrom(*this, "char"), - m_pic2(*this, ":pic2"), - m_txd_handler(*this) -{ -} - -ROM_START( pcd_video ) - ROM_REGION(0x400, "graphics", 0) - ROM_LOAD("s36361-d321-v1.bin", 0x000, 0x400, CRC(69baeb2a) SHA1(98b9cd0f38c51b4988a3aed0efcf004bedd115ff)) -ROM_END - -const rom_entry *pcd_video_device::device_rom_region() const -{ - return ROM_NAME( pcd_video ); -} - -ROM_START( pcx_video ) - ROM_REGION(0x2000, "char", 0) - ROM_LOAD("d12-graka.bin", 0x0000, 0x2000, CRC(e4933c16) SHA1(932ae1f0cd2b029b7f5fc3d2d1679e70b25c0828)) - - ROM_REGION(0x6000, "graphics", 0) - ROM_LOAD("d40-graka.bin", 0x0000, 0x2000, CRC(dce48252) SHA1(0d9a575b2d001168a36864d7bd5db1c3aca5fb8d)) - ROM_LOAD("d39-graka.bin", 0x4000, 0x2000, CRC(02920e25) SHA1(145a6648d75c1dc4788f9bc7790281ef7e8f8426)) -ROM_END - -const rom_entry *pcx_video_device::device_rom_region() const -{ - return ROM_NAME( pcx_video ); -} - -static const gfx_layout pcd_charlayout = -{ - 8, 14, /* 8 x 14 characters */ - 512, /* 512 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8 }, - 8*16 -}; - -static GFXDECODE_START( pcx ) - GFXDECODE_ENTRY( "char", 0x0000, pcd_charlayout, 0, 1 ) -GFXDECODE_END - -static MACHINE_CONFIG_FRAGMENT( pcd_video ) - MCFG_CPU_ADD("graphics", I8741, XTAL_16MHz/2) - MCFG_DEVICE_DISABLE() - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(640, 350) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 349) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DEVICE("crtc", scn2674_device, screen_update) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(pcdx_video_device, pcdx) - - MCFG_SCN2674_VIDEO_ADD("crtc", 0, NULL); - MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8) - MCFG_SCN2674_GFX_CHARACTER_WIDTH(16) - MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(pcd_video_device, display_pixels) - MCFG_VIDEO_SET_SCREEN("screen") -MACHINE_CONFIG_END - -machine_config_constructor pcd_video_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pcd_video ); -} - -static ADDRESS_MAP_START( pcx_vid_map, AS_PROGRAM, 8, pcx_video_device ) - AM_RANGE(0x0000, 0x5fff) AM_ROM AM_REGION("graphics", 0) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pcx_vid_io, AS_IO, 8, pcx_video_device ) - AM_RANGE(0x8000, 0x8007) AM_DEVREADWRITE("crtc", scn2674_device, read, write) - AM_RANGE(0x8008, 0x8008) AM_READ(unk_r) - AM_RANGE(0xa000, 0xa001) AM_READWRITE(vram_latch_r, vram_latch_w) - AM_RANGE(0xa002, 0xa003) AM_READWRITE(term_mcu_r, term_mcu_w) - AM_RANGE(0xc000, 0xc7ff) AM_RAM - AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_WRITE(p1_w) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( pcx_vram, AS_0, 8, pcx_video_device ) - AM_RANGE(0x0000, 0x07ff) AM_READWRITE(vram_r, vram_w) -ADDRESS_MAP_END - -static MACHINE_CONFIG_FRAGMENT( pcx_video ) - MCFG_CPU_ADD("graphics", I8031, XTAL_24MHz/2) - MCFG_CPU_PROGRAM_MAP(pcx_vid_map) - MCFG_CPU_IO_MAP(pcx_vid_io) - - // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(640, 350) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 349) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_UPDATE_DEVICE("crtc", scn2674_device, screen_update) - - MCFG_GFXDECODE_ADD("gfxdecode", "palette", pcx) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") - - MCFG_SCN2674_VIDEO_ADD("crtc", 0, INPUTLINE("graphics", MCS51_INT0_LINE)); - MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8) - MCFG_SCN2674_GFX_CHARACTER_WIDTH(16) - MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(pcx_video_device, display_pixels) - MCFG_VIDEO_SET_SCREEN("screen") - MCFG_DEVICE_ADDRESS_MAP(AS_0, pcx_vram) -MACHINE_CONFIG_END - -machine_config_constructor pcx_video_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( pcx_video ); -} - -SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) -{ - address <<= 1; - if(lg) - { - UINT16 data = m_vram[address + 1] | (m_vram[address] << 8); - for(int i = 0; i < 16; i++) - bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (15 - i))) ? 1 : 0); - } - else - { - UINT8 data, attr; - int bgnd = 0; - data = m_charram[m_vram[address] * 16 + linecount]; - attr = m_vram[address + 1]; - if(cursor && blink) - data = 0xff; - if(ul && (attr & 0x20)) - data = 0xff; - if(attr & 8) - bgnd = 2; - if(attr & 0x10) - data = ~data; - for(int i = 0; i < 8; i++) - bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? 1 : bgnd); - } -} - -SCN2674_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels) -{ - UINT8 data; - address <<= 1; - data = m_charrom[m_vram[address] * 16 + linecount + (m_vram[address + 1] & 0x20 ? 4096 : 0)]; - if(cursor && blink) - data = 0xff; - if(m_p1 & 0x20) - data = ~data; - for(int i = 0; i < 8; i++) - bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? 1 : 0); -} - -PALETTE_INIT_MEMBER(pcdx_video_device, pcdx) -{ - palette.set_pen_color(0,rgb_t::black); - palette.set_pen_color(1,rgb_t::white); - palette.set_pen_color(2,rgb_t(128,128,128)); -} - -WRITE8_MEMBER(pcd_video_device::vram_w) -{ - if(m_vram_sw) - m_vram[offset] = data; - else if(!(offset & 1)) - { - offset >>= 1; - m_charram[offset & 0x1fff] = data; - m_gfxdecode->gfx(0)->mark_dirty(offset/16); - } -} - -READ8_MEMBER(pcd_video_device::vram_r) -{ - return m_vram[offset]; -} - -WRITE8_MEMBER(pcd_video_device::vram_sw_w) -{ - m_vram_sw = data & 1; -} - - -READ8_MEMBER(pcd_video_device::mcu_r) -{ - return 0x20; -} - -WRITE8_MEMBER(pcd_video_device::mcu_w) -{ -} - -READ8_MEMBER(pcx_video_device::term_r) -{ - switch(offset) - { - case 0: - m_pic2->ir0_w(CLEAR_LINE); - m_term_stat &= ~2; - return m_term_key; - case 1: - m_pic2->ir0_w(CLEAR_LINE); - return m_term_stat >> 1; - } - return 0xff; -} - -WRITE8_MEMBER(pcx_video_device::term_w) -{ - if(!offset) - { - m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE); - m_term_char = data; - m_term_stat |= 4; - } -} - -READ8_MEMBER(pcx_video_device::term_mcu_r) -{ - switch(offset) - { - case 0: - m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE); - m_pic2->ir0_w(ASSERT_LINE); - m_term_stat &= ~4; - return m_term_char; - case 1: - return m_term_stat; - } - return 0; -} - -WRITE8_MEMBER(pcx_video_device::term_mcu_w) -{ - if(!offset) - { - m_term_key = data; - m_pic2->ir0_w(ASSERT_LINE); - m_term_stat |= 2; - } -} - -WRITE8_MEMBER(pcx_video_device::vram_w) -{ - offset <<= 1; - m_vram[offset] = m_vram_latch_w[0]; - m_vram[offset+1] = m_vram_latch_w[1]; -} - -READ8_MEMBER(pcx_video_device::vram_r) -{ - offset <<= 1; - m_vram_latch_r[0] = m_vram[offset]; - m_vram_latch_r[1] = m_vram[offset+1]; - return m_vram[offset]; -} - -WRITE8_MEMBER(pcx_video_device::vram_latch_w) -{ - m_vram_latch_w[offset] = data; -} - -READ8_MEMBER(pcx_video_device::vram_latch_r) -{ - return m_vram_latch_r[offset]; -} - -READ8_MEMBER(pcdx_video_device::detect_r) -{ - return 0; -} - -WRITE8_MEMBER(pcdx_video_device::detect_w) -{ -} - -READ8_MEMBER(pcx_video_device::unk_r) -{ - return 0x80; -} - -WRITE8_MEMBER(pcx_video_device::p1_w) -{ - m_p1 = data; -} - -void pcd_video_device::device_start() -{ - m_maincpu->space(AS_IO).install_readwrite_handler(0xfb00, 0xfb01, 0, 0, read8_delegate(FUNC(pcdx_video_device::detect_r), this), write8_delegate(FUNC(pcdx_video_device::detect_w), this), 0xff00); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf0000, 0xf7fff, 0, 0, read8_delegate(FUNC(pcd_video_device::vram_r), this), write8_delegate(FUNC(pcd_video_device::vram_w), this), 0xffff); - m_gfxdecode->set_gfx(0, global_alloc(gfx_element(machine().device("palette"), pcd_charlayout, &m_charram[0], 0, 1, 0))); -} - -void pcd_video_device::device_reset() -{ - m_vram_sw = 1; -} - -DEVICE_ADDRESS_MAP_START(map, 16, pcd_video_device) - AM_RANGE(0x00, 0x0f) AM_DEVWRITE8("crtc", scn2674_device, write, 0x00ff) - AM_RANGE(0x00, 0x0f) AM_DEVREAD8("crtc", scn2674_device, read, 0xff00) - AM_RANGE(0x20, 0x21) AM_WRITE8(vram_sw_w, 0x00ff) - AM_RANGE(0x30, 0x33) AM_READWRITE8(mcu_r, mcu_w, 0x00ff) -ADDRESS_MAP_END - -void pcx_video_device::device_start() -{ - mcs51_cpu_device *mcu = downcast(m_mcu.target()); - m_maincpu->space(AS_IO).install_readwrite_handler(0xfb00, 0xfb01, 0, 0, read8_delegate(FUNC(pcdx_video_device::detect_r), this), write8_delegate(FUNC(pcdx_video_device::detect_w), this), 0x00ff); - m_txd_handler.resolve_safe(); - - // set serial callbacks - mcu->i8051_set_serial_tx_callback(WRITE8_DELEGATE(pcx_video_device, tx_callback)); - mcu->i8051_set_serial_rx_callback(READ8_DELEGATE(pcx_video_device, rx_callback)); - set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); - set_rate(600*2); // FIXME: fix the keyboard when the mc2661 baud rate calc is fixed -} - -void pcx_video_device::device_reset() -{ - m_term_key = 0; - m_term_stat = 0; - transmit_register_reset(); - receive_register_reset(); - - m_txd_handler(1); -} - -DEVICE_ADDRESS_MAP_START(map, 16, pcx_video_device) - AM_RANGE(0x0, 0xf) AM_READWRITE8(term_r, term_w, 0xffff) -ADDRESS_MAP_END - -READ8_MEMBER(pcx_video_device::rx_callback) -{ - return get_received_char(); -} - -WRITE8_MEMBER(pcx_video_device::tx_callback) -{ - transmit_register_setup(data); -} - -void pcx_video_device::tra_callback() -{ - m_txd_handler(transmit_register_get_data_bit()); -} - -void pcx_video_device::rcv_complete() -{ - receive_register_extract(); - m_mcu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); - m_mcu->set_input_line(MCS51_RX_LINE, CLEAR_LINE); -} - -void pcx_video_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - device_serial_interface::device_timer(timer, id, param, ptr); -} diff --git a/src/mess/video/pcd.h b/src/mess/video/pcd.h deleted file mode 100644 index 52b61298d52..00000000000 --- a/src/mess/video/pcd.h +++ /dev/null @@ -1,98 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Carl - -#ifndef _PCD_H_ -#define _PCD_H_ - -#include "emu.h" -#include "machine/pic8259.h" -#include "video/scn2674.h" - -#define MCFG_PCX_VIDEO_TXD_HANDLER(_devcb) \ - devcb = &pcx_video_device::set_txd_handler(*device, DEVCB_##_devcb); - -class pcdx_video_device : public device_t -{ -public: - pcdx_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - - virtual DECLARE_ADDRESS_MAP(map, 16) = 0; - DECLARE_READ8_MEMBER(detect_r); - DECLARE_WRITE8_MEMBER(detect_w); - DECLARE_PALETTE_INIT(pcdx); - -protected: - required_device m_maincpu; - required_device m_mcu; - required_device m_crtc; - required_device m_palette; - required_device m_gfxdecode; -}; - -class pcd_video_device : public pcdx_video_device -{ -public: - pcd_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - DECLARE_ADDRESS_MAP(map, 16); - DECLARE_ADDRESS_MAP(vram_map, 8); - DECLARE_READ8_MEMBER(mcu_r); - DECLARE_WRITE8_MEMBER(mcu_w); - DECLARE_WRITE8_MEMBER(vram_sw_w); - DECLARE_READ8_MEMBER(vram_r); - DECLARE_WRITE8_MEMBER(vram_w); - - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - SCN2674_DRAW_CHARACTER_MEMBER(display_pixels); -protected: - void device_start(); - void device_reset(); -private: - dynamic_buffer m_vram; - dynamic_buffer m_charram; - UINT8 m_vram_sw; -}; - -class pcx_video_device : public pcdx_video_device, - public device_serial_interface -{ -public: - pcx_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - template static devcb_base &set_txd_handler(device_t &device, _Object object) { return downcast(device).m_txd_handler.set_callback(object); } - - DECLARE_ADDRESS_MAP(map, 16); - DECLARE_READ8_MEMBER(term_r); - DECLARE_WRITE8_MEMBER(term_w); - DECLARE_READ8_MEMBER(term_mcu_r); - DECLARE_WRITE8_MEMBER(term_mcu_w); - DECLARE_READ8_MEMBER(rx_callback); - DECLARE_WRITE8_MEMBER(tx_callback); - DECLARE_READ8_MEMBER(vram_r); - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_READ8_MEMBER(vram_latch_r); - DECLARE_WRITE8_MEMBER(vram_latch_w); - DECLARE_READ8_MEMBER(unk_r); - DECLARE_WRITE8_MEMBER(p1_w); - - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - SCN2674_DRAW_CHARACTER_MEMBER(display_pixels); -protected: - void device_start(); - void device_reset(); - void tra_callback(); - void rcv_complete(); - void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -private: - dynamic_buffer m_vram; - required_region_ptr m_charrom; - required_device m_pic2; - devcb_write_line m_txd_handler; - UINT8 m_term_key, m_term_char, m_term_stat, m_vram_latch_r[2], m_vram_latch_w[2], m_p1; -}; - -extern const device_type PCD_VIDEO; -extern const device_type PCX_VIDEO; - -#endif diff --git a/src/mess/video/pcw.c b/src/mess/video/pcw.c deleted file mode 100644 index f4d18761636..00000000000 --- a/src/mess/video/pcw.c +++ /dev/null @@ -1,187 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/*************************************************************************** - - pcw.c - - Functions to emulate the video hardware of the Amstrad PCW. - -***************************************************************************/ - -#include "emu.h" -#include "includes/pcw.h" -#include "machine/ram.h" - -inline void pcw_state::pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix16(y, x) = (UINT16)color; -} - -/*************************************************************************** - Start the video hardware emulation. -***************************************************************************/ - -void pcw_state::video_start() -{ - rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1); - - m_prn_output = auto_bitmap_ind16_alloc(machine(),PCW_PRINTER_WIDTH,PCW_PRINTER_HEIGHT); - m_prn_output->fill(1, rect); -} - -#if 0 -/* two colours */ -static const unsigned short pcw_colour_table[PCW_NUM_COLOURS] = -{ - 0, 1 -}; -#endif - -/* black/white */ -static const rgb_t pcw_palette[PCW_NUM_COLOURS] = -{ - rgb_t(0x000, 0x000, 0x000), - rgb_t(0x0ff, 0x0ff, 0x0ff) -}; - - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(pcw_state, pcw) -{ - palette.set_pen_colors(0, pcw_palette, ARRAY_LENGTH(pcw_palette)); -} - -/*************************************************************************** - Draw the game screen in the given bitmap_ind16. - Do NOT call osd_update_display() from this function, - it will be called by the main emulation engine. -***************************************************************************/ -UINT32 pcw_state::screen_update_pcw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,b; - unsigned short roller_ram_offs; - unsigned char *roller_ram_ptr; - int pen0,pen1; - - pen0 = 0; - pen1 = 1; - - /* invert? */ - if (m_vdu_video_control_register & (1<<7)) - { - /* yes */ - pen1^=1; - pen0^=1; - } - - /* video enable? */ - if ((m_vdu_video_control_register & (1<<6))!=0) - { - /* render top border */ - rectangle rect(0, PCW_SCREEN_WIDTH, 0, PCW_BORDER_HEIGHT); - bitmap.fill(pen0, rect); - - /* render bottom border */ - rect.set(0, PCW_SCREEN_WIDTH, PCW_BORDER_HEIGHT + PCW_DISPLAY_HEIGHT, PCW_BORDER_HEIGHT + PCW_DISPLAY_HEIGHT + PCW_BORDER_HEIGHT); - bitmap.fill(pen0, rect); - - /* offset to start in table */ - roller_ram_offs = (m_roller_ram_offset<<1); - - for (y=0; y<256; y++) - { - int by; - unsigned short line_data; - unsigned char *line_ptr; - - x = PCW_BORDER_WIDTH; - - roller_ram_ptr = m_ram->pointer() + m_roller_ram_addr + roller_ram_offs; - - /* get line address */ - /* 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. */ - line_data = ((unsigned char *)roller_ram_ptr)[0] | (((unsigned char *)roller_ram_ptr)[1]<<8); - - /* calculate address of pixel data */ - line_ptr = m_ram->pointer() + ((line_data & 0x0e000)<<1) + ((line_data & 0x01ff8)<<1) + (line_data & 0x07); - - for (by=0; by<90; by++) - { - unsigned char byte; - - byte = line_ptr[0]; - - for (b=0; b<8; b++) - { - if (byte & 0x080) - { - pcw_plot_pixel(bitmap,x+b, y+PCW_BORDER_HEIGHT, pen1); - } - else - { - pcw_plot_pixel(bitmap,x+b, y+PCW_BORDER_HEIGHT, pen0); - - } - byte = byte<<1; - } - - x = x + 8; - - - line_ptr = line_ptr+8; - } - - /* update offset, wrap within 512 byte range */ - roller_ram_offs+=2; - roller_ram_offs&=511; - - } - - /* render border */ - /* 8 pixels either side of display */ - for (y=0; y<256; y++) - { - pcw_plot_pixel(bitmap, 0, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, 1, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, 2, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, 3, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, 4, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, 5, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, 6, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, 7, y+PCW_BORDER_HEIGHT, pen0); - - pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+0, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+1, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+2, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+3, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+4, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+5, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+6, y+PCW_BORDER_HEIGHT, pen0); - pcw_plot_pixel(bitmap, PCW_BORDER_WIDTH+PCW_DISPLAY_WIDTH+7, y+PCW_BORDER_HEIGHT, pen0); - } - } - else - { - /* not video - render whole lot in pen 0 */ - rectangle rect(0, PCW_SCREEN_WIDTH, 0, PCW_SCREEN_HEIGHT); - bitmap.fill(pen0, rect); - } - return 0; -} - -UINT32 pcw_state::screen_update_pcw_printer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // printer output - INT32 feed; - rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1); - feed = -(m_paper_feed / 2); - copyscrollbitmap(bitmap,*m_prn_output,0,NULL,1,&feed,rect); - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-3, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos-1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos-1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos+1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos+1) = 0; - return 0; -} diff --git a/src/mess/video/pcw16.c b/src/mess/video/pcw16.c deleted file mode 100644 index 40324af4e7e..00000000000 --- a/src/mess/video/pcw16.c +++ /dev/null @@ -1,268 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -#include "emu.h" -#include "includes/pcw16.h" -#include "machine/ram.h" - - -#if 0 -/* 16 colours, + 1 for border */ -static const unsigned short pcw16_colour_table[PCW16_NUM_COLOURS] = -{ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31 -}; -#endif - -static const rgb_t pcw16_palette[PCW16_NUM_COLOURS] = -{ - rgb_t(0x080, 0x080, 0x080), /* light grey */ - rgb_t(0x080, 0x080, 0x080), /* light grey */ - rgb_t(0x000, 0x080, 0x080), /* magenta */ - rgb_t(0x000, 0x080, 0x080), /* magenta */ - rgb_t(0x080, 0x080, 0x080), /* light grey */ - rgb_t(0x080, 0x080, 0x080), /* light grey */ - rgb_t(0x0ff, 0x080, 0x080), /* pastel green */ - rgb_t(0x0ff, 0x080, 0x080), /* pastel green */ - rgb_t(0x000, 0x000, 0x080), /* blue */ - rgb_t(0x000, 0x000, 0x000), /* black */ - rgb_t(0x000, 0x080, 0x0ff), /* mauve */ - rgb_t(0x000, 0x000, 0x0ff), /* bright blue */ - rgb_t(0x000, 0x080, 0x000), /* red */ - rgb_t(0x000, 0x0ff, 0x000), /* bright red */ - rgb_t(0x000, 0x0ff, 0x080), /* purple */ - rgb_t(0x000, 0x0ff, 0x0ff), /* bright magenta */ - rgb_t(0x0ff, 0x000, 0x080), /* sea green */ - rgb_t(0x0ff, 0x000, 0x0ff), /* bright green */ - rgb_t(0x0ff, 0x080, 0x0ff), /* pastel cyan */ - rgb_t(0x0ff, 0x000, 0x0ff), /* bright cyan */ - rgb_t(0x0ff, 0x080, 0x000), /* lime green */ - rgb_t(0x0ff, 0x0ff, 0x000), /* bright yellow */ - rgb_t(0x0ff, 0x0ff, 0x080), /* pastel yellow */ - rgb_t(0x0ff, 0x0ff, 0x0ff), /* bright white */ - rgb_t(0x080, 0x000, 0x080), /* cyan */ - rgb_t(0x080, 0x000, 0x000), /* green */ - rgb_t(0x080, 0x080, 0x0ff), /* pastel blue */ - rgb_t(0x080, 0x000, 0x0ff), /* sky blue */ - rgb_t(0x080, 0x080, 0x000), /* yellow */ - rgb_t(0x080, 0x0ff, 0x000), /* orange */ - rgb_t(0x080, 0x0ff, 0x080), /* pink */ - rgb_t(0x080, 0x0ff, 0x0ff), /* pastel magenta */ -}; - - -inline void pcw16_state::pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix16(y, x) = (UINT16)color; -} - -/* Initialise the palette */ -PALETTE_INIT_MEMBER(pcw16_state, pcw16) -{ - palette.set_pen_colors(0, pcw16_palette, ARRAY_LENGTH(pcw16_palette)); -} - -void pcw16_state::video_start() -{ -} - -/* 640, 1 bit per pixel */ -void pcw16_state::pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) -{ - int b; - int local_byte; - int cols[2]; - int px; - - local_byte = byte; - - cols[0] = m_colour_palette[0]; - cols[1] = m_colour_palette[1]; - - px = x; - for (b=0; b<8; b++) - { - pcw16_plot_pixel(bitmap, px, y, cols[(local_byte>>7) & 0x01]); - px++; - - local_byte = local_byte<<1; - } -} - -/* 320, 2 bits per pixel */ -void pcw16_state::pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) -{ - int b; - int px; - int local_byte; - int cols[4]; - - for (b=0; b<3; b++) - { - cols[b] = m_colour_palette[b]; - } - - local_byte = byte; - - px = x; - for (b=0; b<4; b++) - { - int col; - - col = cols[((local_byte>>6) & 0x03)]; - - pcw16_plot_pixel(bitmap, px, y, col); - px++; - pcw16_plot_pixel(bitmap, px, y, col); - px++; - - local_byte = local_byte<<2; - } -} - -/* 160, 4 bits per pixel */ -void pcw16_state::pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) -{ - int px; - int b; - int local_byte; - int cols[2]; - - cols[0] = m_colour_palette[0]; - cols[1] = m_colour_palette[1]; - local_byte = byte; - - px = x; - for (b=0; b<2; b++) - { - int col; - - col = cols[((local_byte>>4)&0x0f)]; - - pcw16_plot_pixel(bitmap, px, y, col); - px++; - pcw16_plot_pixel(bitmap, px, y, col); - px++; - pcw16_plot_pixel(bitmap, px, y, col); - px++; - pcw16_plot_pixel(bitmap, px, y, col); - px++; - - local_byte = local_byte<<4; - } -} - -/*************************************************************************** - Draw the game screen in the given bitmap_ind16. - Do NOT call osd_update_display() from this function, - it will be called by the main emulation engine. -***************************************************************************/ -UINT32 pcw16_state::screen_update_pcw16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *ram = m_ram->pointer(); - unsigned char *pScanLine = (unsigned char *)ram + 0x0fc00; //0x03c00; //0x020FC00; - - int y; - int x; - - int border_colour; - - border_colour = m_video_control & 31; - - /* reverse video? */ - if (m_video_control & (1<<7)) - { - /* colour 0 and colour 1 need to be inverted? - what happens in mode 1 and 2 - ignored? or is bit 1 toggled, - or is whole lot toggled? */ - - /* force border to be colour 1 */ - border_colour = m_colour_palette[1]; - } - - if ((m_video_control & (1<<6))==0) - { - /* blank */ - rectangle rect(0, PCW16_SCREEN_WIDTH, 0, PCW16_SCREEN_HEIGHT); - bitmap.fill(border_colour, rect); - } - else - { - /* no blank */ - - - /* render top border */ - rectangle rect(0, PCW16_SCREEN_WIDTH, 0, PCW16_BORDER_HEIGHT); - bitmap.fill(border_colour, rect); - - /* render bottom border */ - rect.set(0, PCW16_SCREEN_WIDTH, PCW16_BORDER_HEIGHT + PCW16_DISPLAY_HEIGHT, PCW16_BORDER_HEIGHT + PCW16_DISPLAY_HEIGHT + PCW16_BORDER_HEIGHT); - bitmap.fill(border_colour, rect); - - /* render border on either side of display */ - bitmap.plot_box(0, PCW16_BORDER_HEIGHT, 8, PCW16_DISPLAY_HEIGHT, border_colour); - bitmap.plot_box(PCW16_DISPLAY_WIDTH + PCW16_BORDER_WIDTH, PCW16_BORDER_HEIGHT, 8, PCW16_DISPLAY_HEIGHT, border_colour); - - /* render display */ - for (y=0; y>14) & 0x03); - - /* set initial x position */ - x = PCW16_BORDER_WIDTH; - - for (b=0; b<80; b++) - { - int byte; - - byte = ram[Addr]; - - switch (mode) - { - case 0: - { - pcw16_vh_decode_mode0(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); - } - break; - - case 1: - { - pcw16_vh_decode_mode1(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); - } - break; - - case 3: - case 2: - { - pcw16_vh_decode_mode2(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); - } - break; - } - - /* only lowest 16 bits are incremented between fetches */ - Addr = ((Addr+1) & 0x0ffff) | AddrUpper; - - x=x+8; - } - - pScanLine+=2; - } - } - return 0; -} diff --git a/src/mess/video/pdp1.c b/src/mess/video/pdp1.c deleted file mode 100644 index 2e91b2cadeb..00000000000 --- a/src/mess/video/pdp1.c +++ /dev/null @@ -1,591 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - video/pdp1.c - - PDP1 video emulation. - - We emulate three display devices: - * CRT screen - * control panel - * typewriter output - - For the actual emulation of these devices look at the machine/pdp1.c. This - file only includes the display routines. - - Raphael Nabet 2002-2004 - Based on earlier work by Chris Salomon -*/ - -#include - -#include "emu.h" -#include "cpu/pdp1/pdp1.h" -#include "includes/pdp1.h" - - - - -inline void pdp1_state::pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix16(y, x) = color; -} - -/* - video init -*/ -void pdp1_state::video_start() -{ - m_typewriter_color = color_typewriter_black; - - /* alloc bitmaps for our private fun */ - m_panel_bitmap.allocate(panel_window_width, panel_window_height, BITMAP_FORMAT_IND16); - m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16); - - /* set up out bitmaps */ - pdp1_draw_panel_backdrop(m_panel_bitmap); - - const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1); - m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds); -} - - -void pdp1_state::screen_eof_pdp1(screen_device &screen, bool state) -{ - // rising edge - if (state) - { - m_crt->eof(); - } -} - -/* - schedule a pixel to be plotted -*/ -void pdp1_state::pdp1_plot(int x, int y) -{ - /* compute pixel coordinates and plot */ - x = x*crt_window_width/01777; - y = y*crt_window_height/01777; - m_crt->plot(x, y); -} - - -/* - video_update_pdp1: effectively redraw the screen -*/ -UINT32 pdp1_state::screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - pdp1_erase_lightpen(bitmap); - m_crt->update(bitmap); - pdp1_draw_lightpen(bitmap); - - pdp1_draw_panel(m_panel_bitmap); - copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect); - - copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect); - return 0; -} - - - -/* - Operator control panel code -*/ - -enum -{ - x_panel_col1_offset = 8, - x_panel_col2_offset = x_panel_col1_offset+144+8, - x_panel_col3_offset = x_panel_col2_offset+96+8 -}; - -enum -{ - /* column 1: registers, test word, test address */ - y_panel_pc_offset = 0, - y_panel_ma_offset = y_panel_pc_offset+2*8, - y_panel_mb_offset = y_panel_ma_offset+2*8, - y_panel_ac_offset = y_panel_mb_offset+2*8, - y_panel_io_offset = y_panel_ac_offset+2*8, - y_panel_ta_offset = y_panel_io_offset+2*8, /* test address and extend switch */ - y_panel_tw_offset = y_panel_ta_offset+2*8, - - /* column 2: 1-bit indicators */ - y_panel_run_offset = 8, - y_panel_cyc_offset = y_panel_run_offset+8, - y_panel_defer_offset = y_panel_cyc_offset+8, - y_panel_hs_cyc_offset = y_panel_defer_offset+8, - y_panel_brk_ctr_1_offset = y_panel_hs_cyc_offset+8, - y_panel_brk_ctr_2_offset = y_panel_brk_ctr_1_offset+8, - y_panel_ov_offset = y_panel_brk_ctr_2_offset+8, - y_panel_rim_offset = y_panel_ov_offset+8, - y_panel_sbm_offset = y_panel_rim_offset+8, - y_panel_exd_offset = y_panel_sbm_offset+8, - y_panel_ioh_offset = y_panel_exd_offset+8, - y_panel_ioc_offset = y_panel_ioh_offset+8, - y_panel_ios_offset = y_panel_ioc_offset+8, - - /* column 3: power, single step, single inst, sense, flags, instr... */ - y_panel_power_offset = 8, - y_panel_sngl_step_offset = y_panel_power_offset+8, - y_panel_sngl_inst_offset = y_panel_sngl_step_offset+8, - y_panel_sep1_offset = y_panel_sngl_inst_offset+8, - y_panel_ss_offset = y_panel_sep1_offset+8, - y_panel_sep2_offset = y_panel_ss_offset+3*8, - y_panel_pf_offset = y_panel_sep2_offset+8, - y_panel_ir_offset = y_panel_pf_offset+2*8 -}; - -/* draw a small 8*8 LED (or is this a lamp? ) */ -void pdp1_state::pdp1_draw_led(bitmap_ind16 &bitmap, int x, int y, int state) -{ - int xx, yy; - - for (yy=1; yy<7; yy++) - for (xx=1; xx<7; xx++) - pdp1_plot_pixel(bitmap, x+xx, y+yy, state ? pen_lit_lamp : pen_unlit_lamp); -} - -/* draw nb_bits leds which represent nb_bits bits in value */ -void pdp1_state::pdp1_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) -{ - while (nb_bits) - { - nb_bits--; - - pdp1_draw_led(bitmap, x, y, (value >> nb_bits) & 1); - - x += 8; - } -} - - -/* draw a small 8*8 switch */ -void pdp1_state::pdp1_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state) -{ - int xx, yy; - int i; - - /* erase area */ - for (yy=0; yy<8; yy++) - for (xx=0; xx<8; xx++) - pdp1_plot_pixel(bitmap, x+xx, y+yy, pen_panel_bg); - - - /* draw nut (-> circle) */ - for (i=0; i<4;i++) - { - pdp1_plot_pixel(bitmap, x+2+i, y+1, pen_switch_nut); - pdp1_plot_pixel(bitmap, x+2+i, y+6, pen_switch_nut); - pdp1_plot_pixel(bitmap, x+1, y+2+i, pen_switch_nut); - pdp1_plot_pixel(bitmap, x+6, y+2+i, pen_switch_nut); - } - pdp1_plot_pixel(bitmap, x+2, y+2, pen_switch_nut); - pdp1_plot_pixel(bitmap, x+5, y+2, pen_switch_nut); - pdp1_plot_pixel(bitmap, x+2, y+5, pen_switch_nut); - pdp1_plot_pixel(bitmap, x+5, y+5, pen_switch_nut); - - /* draw button (->disc) */ - if (! state) - y += 4; - for (i=0; i<2;i++) - { - pdp1_plot_pixel(bitmap, x+3+i, y, pen_switch_button); - pdp1_plot_pixel(bitmap, x+3+i, y+3, pen_switch_button); - } - for (i=0; i<4;i++) - { - pdp1_plot_pixel(bitmap, x+2+i, y+1, pen_switch_button); - pdp1_plot_pixel(bitmap, x+2+i, y+2, pen_switch_button); - } -} - - -/* draw nb_bits switches which represent nb_bits bits in value */ -void pdp1_state::pdp1_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) -{ - while (nb_bits) - { - nb_bits--; - - pdp1_draw_switch(bitmap, x, y, (value >> nb_bits) & 1); - - x += 8; - } -} - - -/* write a single char on screen */ -void pdp1_state::pdp1_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color) -{ - m_gfxdecode->gfx(0)->transpen(bitmap,bitmap.cliprect(), character-32, color, 0, 0, - x+1, y, 0); -} - -/* write a string on screen */ -void pdp1_state::pdp1_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) -{ - while (* buf) - { - pdp1_draw_char(bitmap, *buf, x, y, color); - - x += 8; - buf++; - } -} - - -/* - draw the operator control panel (fixed backdrop) -*/ -void pdp1_state::pdp1_draw_panel_backdrop(bitmap_ind16 &bitmap) -{ - /* fill with black */ - const rectangle panel_bitmap_bounds(0, panel_window_width-1, 0, panel_window_height-1); - m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds); - - /* column 1: registers, test word, test address */ - pdp1_draw_string(bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption); - pdp1_draw_string(bitmap, "memory address", x_panel_col1_offset, y_panel_ma_offset, color_panel_caption); - pdp1_draw_string(bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption); - pdp1_draw_string(bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption); - pdp1_draw_string(bitmap, "in-out", x_panel_col1_offset, y_panel_io_offset, color_panel_caption); - pdp1_draw_string(bitmap, "extend address", x_panel_col1_offset, y_panel_ta_offset, color_panel_caption); - pdp1_draw_string(bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption); - - /* column separator */ - bitmap.plot_box(x_panel_col2_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption); - - /* column 2: 1-bit indicators */ - pdp1_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); - pdp1_draw_string(bitmap, "cycle", x_panel_col2_offset+8, y_panel_cyc_offset, color_panel_caption); - pdp1_draw_string(bitmap, "defer", x_panel_col2_offset+8, y_panel_defer_offset, color_panel_caption); - pdp1_draw_string(bitmap, "h. s. cycle", x_panel_col2_offset+8, y_panel_hs_cyc_offset, color_panel_caption); - pdp1_draw_string(bitmap, "brk. ctr. 1", x_panel_col2_offset+8, y_panel_brk_ctr_1_offset, color_panel_caption); - pdp1_draw_string(bitmap, "brk. ctr. 2", x_panel_col2_offset+8, y_panel_brk_ctr_2_offset, color_panel_caption); - pdp1_draw_string(bitmap, "overflow", x_panel_col2_offset+8, y_panel_ov_offset, color_panel_caption); - pdp1_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); - pdp1_draw_string(bitmap, "seq. break", x_panel_col2_offset+8, y_panel_sbm_offset, color_panel_caption); - pdp1_draw_string(bitmap, "extend", x_panel_col2_offset+8, y_panel_exd_offset, color_panel_caption); - pdp1_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); - pdp1_draw_string(bitmap, "i-o com'ds", x_panel_col2_offset+8, y_panel_ioc_offset, color_panel_caption); - pdp1_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); - - /* column separator */ - bitmap.plot_box(x_panel_col3_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption); - - /* column 3: power, single step, single inst, sense, flags, instr... */ - pdp1_draw_string(bitmap, "power", x_panel_col3_offset+16, y_panel_power_offset, color_panel_caption); - pdp1_draw_string(bitmap, "single step", x_panel_col3_offset+16, y_panel_sngl_step_offset, color_panel_caption); - pdp1_draw_string(bitmap, "single inst.", x_panel_col3_offset+16, y_panel_sngl_inst_offset, color_panel_caption); - /* separator */ - bitmap.plot_box(x_panel_col3_offset+8, y_panel_sep1_offset+4, 96, 1, pen_panel_caption); - pdp1_draw_string(bitmap, "sense switches", x_panel_col3_offset, y_panel_ss_offset, color_panel_caption); - /* separator */ - bitmap.plot_box(x_panel_col3_offset+8, y_panel_sep2_offset+4, 96, 1, pen_panel_caption); - pdp1_draw_string(bitmap, "program flags", x_panel_col3_offset, y_panel_pf_offset, color_panel_caption); - pdp1_draw_string(bitmap, "instruction", x_panel_col3_offset, y_panel_ir_offset, color_panel_caption); -} - -/* - draw the operator control panel (dynamic elements) -*/ -void pdp1_state::pdp1_draw_panel(bitmap_ind16 &bitmap) -{ - /* column 1: registers, test word, test address */ - pdp1_draw_multipleled(bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8,m_maincpu->state_int(PDP1_PC), 16); - pdp1_draw_multipleled(bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8,m_maincpu->state_int(PDP1_MA), 16); - pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_mb_offset+8,m_maincpu->state_int(PDP1_MB), 18); - pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_ac_offset+8,m_maincpu->state_int(PDP1_AC), 18); - pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_io_offset+8,m_maincpu->state_int(PDP1_IO), 18); - pdp1_draw_switch(bitmap, x_panel_col1_offset, y_panel_ta_offset+8,m_maincpu->state_int(PDP1_EXTEND_SW)); - pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8,m_maincpu->state_int(PDP1_TA), 16); - pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset, y_panel_tw_offset+8,m_maincpu->state_int(PDP1_TW), 18); - - /* column 2: 1-bit indicators */ - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset,m_maincpu->state_int(PDP1_RUN)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_cyc_offset,m_maincpu->state_int(PDP1_CYC)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_defer_offset,m_maincpu->state_int(PDP1_DEFER)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */ - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset,m_maincpu->state_int(PDP1_BRK_CTR) & 1); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset,m_maincpu->state_int(PDP1_BRK_CTR) & 2); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ov_offset,m_maincpu->state_int(PDP1_OV)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset,m_maincpu->state_int(PDP1_RIM)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_sbm_offset,m_maincpu->state_int(PDP1_SBM)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_exd_offset,m_maincpu->state_int(PDP1_EXD)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset,m_maincpu->state_int(PDP1_IOH)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioc_offset,m_maincpu->state_int(PDP1_IOC)); - pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset,m_maincpu->state_int(PDP1_IOS)); - - /* column 3: power, single step, single inst, sense, flags, instr... */ - pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */ - pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */ - pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_step_offset,m_maincpu->state_int(PDP1_SNGL_STEP)); - pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset,m_maincpu->state_int(PDP1_SNGL_STEP)); - pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset,m_maincpu->state_int(PDP1_SNGL_INST)); - pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset,m_maincpu->state_int(PDP1_SNGL_INST)); - pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ss_offset+8,m_maincpu->state_int(PDP1_SS), 6); - pdp1_draw_multipleswitch(bitmap, x_panel_col3_offset, y_panel_ss_offset+16,m_maincpu->state_int(PDP1_SS), 6); - pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_pf_offset+8,m_maincpu->state_int(PDP1_PF), 6); - pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ir_offset+8,m_maincpu->state_int(PDP1_IR), 5); -} - - -/* - Typewriter code -*/ - - - - -enum -{ - typewriter_line_height = 8, - typewriter_write_offset_y = typewriter_window_height-typewriter_line_height, - typewriter_scroll_step = typewriter_line_height -}; - -enum -{ - tab_step = 8 -}; - - -void pdp1_state::pdp1_typewriter_linefeed() -{ - UINT8 buf[typewriter_window_width]; - int y; - - for (y=0; ypens()); - } - - const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1); - m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window); -} - -void pdp1_state::pdp1_typewriter_drawchar(int character) -{ - static const char ascii_table[2][64] = - { /* n-s = non-spacing */ - { /* lower case */ - ' ', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', '*', '*', - '*', '*', '*', '*', - '0', '/', 's', 't', - 'u', 'v', 'w', 'x', - 'y', 'z', '*', ',', - '*',/*black*/ '*',/*red*/ '*',/*Tab*/ '*', - '\200',/*n-s middle dot*/'j', 'k', 'l', - 'm', 'n', 'o', 'p', - 'q', 'r', '*', '*', - '-', ')', '\201',/*n-s overstrike*/'(', - '*', 'a', 'b', 'c', - 'd', 'e', 'f', 'g', - 'h', 'i', '*',/*Lower Case*/ '.', - '*',/*Upper Case*/ '*',/*Backspace*/ '*', '*'/*Carriage Return*/ - }, - { /* upper case */ - ' ', '"', '\'', '~', - '\202',/*implies*/ '\203',/*or*/ '\204',/*and*/ '<', - '>', '\205',/*up arrow*/ '*', '*', - '*', '*', '*', '*', - '\206',/*right arrow*/'?', 'S', 'T', - 'U', 'V', 'W', 'X', - 'Y', 'Z', '*', '=', - '*',/*black*/ '*',/*red*/ '*',/*Tab*/ '*', - '_',/*n-s???*/ 'J', 'K', 'L', - 'M', 'N', 'O', 'P', - 'Q', 'R', '*', '*', - '+', ']', '|',/*n-s???*/ '[', - '*', 'A', 'B', 'C', - 'D', 'E', 'F', 'G', - 'H', 'I', '*',/*Lower Case*/ '\207',/*multiply*/ - '*',/*Upper Case*/ '*',/*Backspace*/ '*', '*'/*Carriage Return*/ - } - }; - - - - character &= 0x3f; - - switch (character) - { - case 034: - /* Black */ - m_typewriter_color = color_typewriter_black; - break; - - case 035: - /* Red */ - m_typewriter_color = color_typewriter_red; - break; - - case 036: - /* Tab */ - m_pos = m_pos + tab_step - (m_pos % tab_step); - break; - - case 072: - /* Lower case */ - m_case_shift = 0; - break; - - case 074: - /* Upper case */ - m_case_shift = 1; - break; - - case 075: - /* Backspace */ - if (m_pos) - m_pos--; - break; - - case 077: - /* Carriage Return */ - m_pos = 0; - pdp1_typewriter_linefeed(); - break; - - default: - /* Any printable character... */ - - if (m_pos >= 80) - { /* if past right border, wrap around. (Right???) */ - pdp1_typewriter_linefeed(); /* next line */ - m_pos = 0; /* return to start of line */ - } - - /* print character (lookup ASCII equivalent in table) */ - pdp1_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character], - 8*m_pos, typewriter_write_offset_y, - m_typewriter_color); /* print char */ - - if ((character!= 040) && (character!= 056)) /* 040 and 056 are non-spacing characters */ - m_pos++; /* step carriage forward */ - - break; - } -} - - - -/* - lightpen code -*/ - -void pdp1_state::pdp1_update_lightpen_state(const lightpen_t *new_state) -{ - m_lightpen_state = *new_state; -} - -#if 1 -void pdp1_state::pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_) -{ - int interval; - int a; - - x = x*crt_window_width/01777; - y = y*crt_window_width/01777; - radius = radius*crt_window_width/01777; - - interval = ceil(radius/sqrt(2.)); - - for (a=0; a<=interval; a++) - { - int b = sqrt((double)radius*radius-a*a) + .5; - - if ((x-a >= 0) && (y-b >= 0)) - pdp1_plot_pixel(bitmap, x-a, y-b, color_); - if ((x-a >= 0) && (y+b <= crt_window_height-1)) - pdp1_plot_pixel(bitmap, x-a, y+b, color_); - if ((x+a <= crt_window_width-1) && (y-b >= 0)) - pdp1_plot_pixel(bitmap, x+a, y-b, color_); - if ((x+a <= crt_window_width-1) && (y+b <= crt_window_height-1)) - pdp1_plot_pixel(bitmap, x+a, y+b, color_); - - if ((x-b >= 0) && (y-a >= 0)) - pdp1_plot_pixel(bitmap, x-b, y-a, color_); - if ((x-b >= 0) && (y+a <= crt_window_height-1)) - pdp1_plot_pixel(bitmap, x-b, y+a, color_); - if ((x+b <= crt_window_width-1) && (y-a >= 0)) - pdp1_plot_pixel(bitmap, x+b, y-a, color_); - if ((x+b <= crt_window_width-1) && (y+a <= crt_window_height-1)) - pdp1_plot_pixel(bitmap, x+b, y+a, color_); - } -} -#else -void pdp1_state::pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color) -{ - float fx, fy; - float interval; - - - fx = (float)x*crt_window_width/01777; - fy = (float)y*crt_window_height/01777; - - interval = radius/sqrt(2.); - - for (x=/*ceil*/(fx-interval); x<=fx+interval; x++) - { - float dy = sqrt(radius*radius-(x-fx)*(x-fx)); - - if ((x >= 0) && (x <= crt_window_width-1) && (fy-dy >= 0)) - pdp1_plot_pixel(bitmap, x, fy-dy, color); - if ((x >= 0) && (x <= crt_window_width-1) && (y+dy <= crt_window_height-1)) - pdp1_plot_pixel(bitmap, x, fy+dy, color); - } - for (y=/*ceil*/(fy-interval); y<=fy+interval; y++) - { - float dx = sqrt(radius*radius-(y-fy)*(y-fy)); - - if ((fx-dx >= 0) && (y >= 0) && (y <= crt_window_height-1)) - pdp1_plot_pixel(bitmap, fx-dx, y, color); - if ((fx+dx <= crt_window_width-1) && (y >= 0) && (y <= crt_window_height-1)) - pdp1_plot_pixel(bitmap, fx+dx, y, color); - } -} -#endif - -void pdp1_state::pdp1_erase_lightpen(bitmap_ind16 &bitmap) -{ - if (m_previous_lightpen_state.active) - { -#if 0 - if (m_previous_lightpen_state.x>0) - pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2-1, m_previous_lightpen_state.y/2, pen_black); - if (m_previous_lightpen_state.x<1023) - pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2+1, m_previous_lightpen_state.y/2, pen_black); - if (m_previous_lightpen_state.y>0) - pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2, m_previous_lightpen_state.y/2-1, pen_black); - if (m_previous_lightpen_state.y<1023) - pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2, m_previous_lightpen_state.y/2+1, pen_black); -#endif - pdp1_draw_circle(bitmap, m_previous_lightpen_state.x, m_previous_lightpen_state.y, m_previous_lightpen_state.radius, pen_black); - } -} - -void pdp1_state::pdp1_draw_lightpen(bitmap_ind16 &bitmap) -{ - if (m_lightpen_state.active) - { - int color_ = m_lightpen_state.down ? pen_lightpen_pressed : pen_lightpen_nonpressed; -#if 0 - if (m_lightpen_state.x>0) - pdp1_plot_pixel(bitmap, m_lightpen_state.x/2-1, m_lightpen_state.y/2, color); - if (m_lightpen_state.x<1023) - pdp1_plot_pixel(bitmap, m_lightpen_state.x/2+1, m_lightpen_state.y/2, color); - if (m_lightpen_state.y>0) - pdp1_plot_pixel(bitmap, m_lightpen_state.x/2, m_lightpen_state.y/2-1, color); - if (m_lightpen_state.y<1023) - pdp1_plot_pixel(bitmap, m_lightpen_state.x/2, m_lightpen_state.y/2+1, color); -#endif - pdp1_draw_circle(bitmap, m_lightpen_state.x, m_lightpen_state.y, m_lightpen_state.radius, color_); - } - m_previous_lightpen_state = m_lightpen_state; -} diff --git a/src/mess/video/pecom.c b/src/mess/video/pecom.c deleted file mode 100644 index 795e97f8ef4..00000000000 --- a/src/mess/video/pecom.c +++ /dev/null @@ -1,109 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Pecom driver by Miodrag Milanovic - - 08/11/2008 Preliminary driver. - -****************************************************************************/ - -#include "emu.h" -#include "sound/cdp1869.h" -#include "sound/wave.h" -#include "cpu/cosmac/cosmac.h" -#include "includes/pecom.h" - -WRITE8_MEMBER(pecom_state::pecom_cdp1869_w) -{ - UINT16 ma = m_cdp1802->get_memory_address(); - - switch (offset + 3) - { - case 3: - m_cdp1869->out3_w(space, ma, data); - break; - - case 4: - m_cdp1869->out4_w(space, ma, data); - break; - - case 5: - m_cdp1869->out5_w(space, ma, data); - break; - - case 6: - m_cdp1869->out6_w(space, ma, data); - break; - - case 7: - m_cdp1869->out7_w(space, ma, data); - break; - } -} - -static ADDRESS_MAP_START( cdp1869_page_ram, AS_0, 8, driver_device ) - AM_RANGE(0x000, 0x3ff) AM_MIRROR(0x400) AM_RAM -ADDRESS_MAP_END - -CDP1869_CHAR_RAM_READ_MEMBER(pecom_state::pecom_char_ram_r ) -{ - UINT8 column = pmd & 0x7f; - UINT16 charaddr = (column << 4) | cma; - - return m_charram[charaddr]; -} - -CDP1869_CHAR_RAM_WRITE_MEMBER(pecom_state::pecom_char_ram_w ) -{ - UINT8 column = pmd & 0x7f; - UINT16 charaddr = (column << 4) | cma; - - m_charram[charaddr] = data; -} - -CDP1869_PCB_READ_MEMBER(pecom_state::pecom_pcb_r ) -{ - return BIT(pmd, 7); -} - -WRITE_LINE_MEMBER(pecom_state::pecom_prd_w) -{ - // every other PRD triggers a DMAOUT request - if (m_dma) - { - m_cdp1802->set_input_line(COSMAC_INPUT_LINE_DMAOUT, HOLD_LINE); - } - - m_dma = !m_dma; -} - -VIDEO_START_MEMBER(pecom_state,pecom) -{ - /* allocate memory */ - m_charram = auto_alloc_array(machine(), UINT8, PECOM_CHAR_RAM_SIZE); - - /* register for state saving */ - save_item(NAME(m_reset)); - save_item(NAME(m_dma)); - save_pointer(NAME(m_charram), PECOM_CHAR_RAM_SIZE); -} - -MACHINE_CONFIG_FRAGMENT( pecom_video ) - MCFG_CDP1869_SCREEN_PAL_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL) - - MCFG_VIDEO_START_OVERRIDE(pecom_state,pecom) - - MCFG_SPEAKER_STANDARD_MONO("mono") - - MCFG_CDP1869_ADD(CDP1869_TAG, CDP1869_DOT_CLK_PAL, cdp1869_page_ram) - MCFG_CDP1869_COLOR_CLOCK(CDP1869_COLOR_CLK_PAL) - MCFG_CDP1869_CHAR_PCB_READ_OWNER(pecom_state, pecom_pcb_r) - MCFG_CDP1869_CHAR_RAM_READ_OWNER(pecom_state, pecom_char_ram_r) - MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(pecom_state, pecom_char_ram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) - MCFG_CDP1869_PRD_CALLBACK(WRITELINE(pecom_state, pecom_prd_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END diff --git a/src/mess/video/pk8020.c b/src/mess/video/pk8020.c deleted file mode 100644 index 31088bb6a53..00000000000 --- a/src/mess/video/pk8020.c +++ /dev/null @@ -1,59 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - PK-8020 driver by Miodrag Milanovic - based on work of Sergey Erokhin from pk8020.narod.ru - - 18/07/2008 Preliminary driver. - -****************************************************************************/ - -#include "emu.h" -#include "includes/pk8020.h" -#include "machine/ram.h" - -void pk8020_state::video_start() -{ -} - -UINT32 pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int y, x, b, j; - UINT8 *gfx = m_region_gfx1->base(); - UINT8 *ram = m_ram->pointer(); - - for (y = 0; y < 16; y++) - { - for (x = 0; x < 64; x++) - { - UINT8 chr = ram[x +(y*64) + 0x40000]; - UINT8 attr= ram[x +(y*64) + 0x40400]; - for (j = 0; j < 16; j++) { - UINT32 addr = 0x10000 + x + ((y*16+j)*64) + (m_video_page * 0xC000); - UINT8 code1 = ram[addr]; - UINT8 code2 = ram[addr + 0x4000]; - UINT8 code3 = ram[addr + 0x8000]; - UINT8 code4 = gfx[((chr<<4) + j) + (m_font*0x1000)]; - if (attr) code4 ^= 0xff; - for (b = 0; b < 8; b++) - { - UINT8 col = (((code4 >> b) & 0x01) ? 0x08 : 0x00); - col |= (((code3 >> b) & 0x01) ? 0x04 : 0x00); - col |= (((code2 >> b) & 0x01) ? 0x02 : 0x00); - col |= (((code1 >> b) & 0x01) ? 0x01 : 0x00); - bitmap.pix16((y*16)+j, x*8+(7-b)) = col; - } - } - } - } - return 0; -} - -PALETTE_INIT_MEMBER(pk8020_state, pk8020) -{ - int i; - for(i=0;i<16;i++) { - m_palette->set_pen_color( i, rgb_t(i*0x10,i*0x10,i*0x10) ); - } -} diff --git a/src/mess/video/pocketc.c b/src/mess/video/pocketc.c deleted file mode 100644 index 0cf2f505349..00000000000 --- a/src/mess/video/pocketc.c +++ /dev/null @@ -1,70 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -#include "emu.h" -#include "includes/pocketc.h" - -/* PC126x - 24x2 5x7 space between char - 2000 .. 203b, 2800 .. 283b - 2040 .. 207b, 2840 .. 287b - 203d: 0 BUSY, 1 PRINT, 3 JAPAN, 4 SMALL, 5 SHIFT, 6 DEF - 207c: 1 DEF 1 RAD 2 GRAD 5 ERROR 6 FLAG */ - -static const UINT8 pocketc_palette[] = -{ - 99,107,99, - 94,111,103, - 255,255,255, - 255,255,255, - 60, 66, 60, - 0, 0, 0 -}; - -const unsigned short pocketc_state::pocketc_colortable[8][2] = { - { 5, 4 }, - { 5, 0 }, - { 5, 2 }, - { 4, 5 }, - { 1, 4 }, - { 0, 5 }, - { 1, 5 }, - { 3, 5 } -}; - -PALETTE_INIT_MEMBER(pocketc_state, pocketc) -{ - UINT8 i=0, r, b, g, color_count = 6; - - while (color_count--) - { - r = pocketc_palette[i++]; g = pocketc_palette[i++]; b = pocketc_palette[i++]; - palette.set_indirect_color(5 - color_count, rgb_t(r, g, b)); - } - - for( i = 0; i < 8; i++ ) - { - palette.set_pen_indirect(i*2, pocketc_colortable[i][0]); - palette.set_pen_indirect(i*2+1, pocketc_colortable[i][1]); - } -} - - -/* Draw an indicator (DEG, SHIFT, etc) */ -void pocketc_state::pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, const POCKETC_FIGURE fig, int color) -{ - int i,j; - for (i=0; fig[i]; i++, y++) - { - for (j=0; fig[i][j]!=0; j++) - { - switch(fig[i][j]) - { - case '1': - bitmap.pix16(y, x+j) = color; - break; - case 'e': - return; - } - } - } -} diff --git a/src/mess/video/poisk1.c b/src/mess/video/poisk1.c deleted file mode 100644 index 99532e31fed..00000000000 --- a/src/mess/video/poisk1.c +++ /dev/null @@ -1,322 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -/* - * Poisk-1 does not have a real mc6845 and always runs in graphics mode. - * Text mode is emulated by BIOS. - * Video RAM in native graphics mode starts at 0xB8000, in emulated text mode -- at 0xBC000. - */ - -#include "emu.h" - -#include "includes/poisk1.h" - -#define CGA_PALETTE_SETS 83 -/* one for colour, one for mono, 81 for colour composite */ - -#include "video/cgapal.h" - -#define BG_COLOR(x) (((x) & 7)|(((x) & 0x10) >> 1)) - -#define VERBOSE_DBG 0 - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - -// - -/* - * Poisk-1 doesn't have a mc6845 and always runs in graphics mode. Text mode is emulated by BIOS; - * NMI is triggered on access to video memory and to mc6845 ports. Address and data are latched into: - * - * Port 28H (offset 0) -- lower 8 bits of address - * Port 29H (offset 1) -- high -//- and mode bits - * Port 2AH (offset 2) -- data - */ - -READ8_MEMBER(p1_state::p1_trap_r) -{ - UINT8 data = m_video.trap[offset]; - DBG_LOG(1,"trap",("R %.2x $%02x\n", 0x28+offset, data)); - if (offset == 0) - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - return data; -} - -WRITE8_MEMBER(p1_state::p1_trap_w) -{ - DBG_LOG(1,"trap",("W %.2x $%02x\n", 0x28+offset, data)); -} - -READ8_MEMBER(p1_state::p1_cga_r) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - return 0; -} - -WRITE8_MEMBER(p1_state::p1_cga_w) -{ - UINT16 port = offset + 0x3d0; - - DBG_LOG(1,"cga",("W %.4x $%02x\n", port, data)); - m_video.trap[2] = data; - m_video.trap[1] = 0xC0 | ((port >> 8) & 0x3f); - m_video.trap[0] = port & 255; - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); -} - -WRITE8_MEMBER(p1_state::p1_vram_w) -{ - DBG_LOG(1,"vram",("W %.4x $%02x\n", offset, data)); - if (m_video.videoram_base) - m_video.videoram_base[offset] = data; - m_video.trap[2] = data; - m_video.trap[1] = 0x80 | ((offset >> 8) & 0x3f); - m_video.trap[0] = offset & 255; - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); -} - -// CGA emulator -/* -068h D42 0..2 R, G, B XXX Foreground/Background color - 3 NMI DISABLE NMI trap 1: Disabled 0: Enabled - 4 PALETTE XXX Colour palette 0: XXX 1: XXX - 5 I (INTENS) XXX Foreground/Background color intensity - 6 DISPLAY BANK XXX Video RAM page - 7 HIRES 1: 640x200 0: 320x200 -*/ - -WRITE8_MEMBER(p1_state::p1_ppi2_porta_w) -{ - address_space &space_prg = m_maincpu->space(AS_PROGRAM); - rectangle visarea; - - DBG_LOG(1,"color_select_68",("W $%02x\n", data)); - - // NMI DISABLE - if (BIT(data, 3) != BIT(m_video.color_select_68, 3)) { - if (BIT(data, 3)) { - space_prg.install_readwrite_bank( 0xb8000, 0xbbfff, "bank11" ); - } else { - space_prg.install_read_bank( 0xb8000, 0xbbfff, "bank11" ); - space_prg.install_write_handler( 0xb8000, 0xbbfff, WRITE8_DELEGATE(p1_state, p1_vram_w) ); - } - } - // DISPLAY BANK - if (BIT(data, 6) != BIT(m_video.color_select_68, 6)) { - if (BIT(data, 6)) - m_video.videoram = m_video.videoram_base + 0x4000; - else - m_video.videoram = m_video.videoram_base; - } - // HIRES -- XXX - if (BIT(data, 7) != BIT(m_video.color_select_68, 7)) { - if (BIT(data, 7)) - machine().first_screen()->set_visible_area(0, 640-1, 0, 200-1); - else - machine().first_screen()->set_visible_area(0, 320-1, 0, 200-1); - } - m_video.color_select_68 = data; - set_palette_luts(); -} - -/* -06Ah Dxx 6 Enable/Disable color burst (?) - 7 Enable/Disable D7H/D7L -*/ - -WRITE8_MEMBER(p1_state::p1_ppi_portc_w) -{ - DBG_LOG(1,"mode_control_6a",("W $%02x\n", data)); - - m_video.mode_control_6a = data; - set_palette_luts(); -} - -void p1_state::set_palette_luts(void) -{ - /* Setup 2bpp palette lookup table */ - // HIRES - if ( m_video.color_select_68 & 0x80 ) - { - m_video.palette_lut_2bpp[0] = 0; - } - else - { - m_video.palette_lut_2bpp[0] = BG_COLOR(m_video.color_select_68); - } - // B&W -- XXX -/* - if ( m_video.mode_control_6a & 0x40 ) - { - m_video.palette_lut_2bpp[1] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 3; - m_video.palette_lut_2bpp[2] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 4; - m_video.palette_lut_2bpp[3] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 7; - } - else -*/ - { - // PALETTE - if ( m_video.color_select_68 & 0x20 ) - { - m_video.palette_lut_2bpp[1] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 3; - m_video.palette_lut_2bpp[2] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 5; - m_video.palette_lut_2bpp[3] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 7; - } - else - { - m_video.palette_lut_2bpp[1] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 2; - m_video.palette_lut_2bpp[2] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 4; - m_video.palette_lut_2bpp[3] = ( ( m_video.color_select_68 & 0x20 ) >> 2 ) | 6; - } - } -} - -/*************************************************************************** - Draw graphics mode with 320x200 pixels (default) with 2 bits/pixel. - Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 - cga fetches 2 byte per mc6845 access. -***************************************************************************/ - -POISK1_UPDATE_ROW( p1_state::cga_gfx_2bpp_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(ra); - UINT16 odd, offset; - int i; - - if ( ra == 0 ) DBG_LOG(1,"cga_gfx_2bpp_update_row",("\n")); - odd = ( ra & 1 ) << 13; - offset = ( ma & 0x1fff ) | odd; - for ( i = 0; i < stride; i++ ) - { - UINT8 data = videoram[ offset++ ]; - - *p = palette[m_video.palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]]; p++; - *p = palette[m_video.palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]]; p++; - *p = palette[m_video.palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]]; p++; - *p = palette[m_video.palette_lut_2bpp[ data & 0x03 ]]; p++; - } -} - -/*************************************************************************** - Draw graphics mode with 640x200 pixels (default). - The cell size is 1x1 (1 scanline is the real default) - Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 -***************************************************************************/ - -POISK1_UPDATE_ROW( p1_state::cga_gfx_1bpp_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(ra); - UINT8 fg = 15, bg = BG_COLOR(m_video.color_select_68); - UINT16 odd, offset; - int i; - - if ( ra == 0 ) DBG_LOG(1,"cga_gfx_1bpp_update_row",("bg %d\n", bg)); - odd = ( ra & 1 ) << 13; - offset = ( ma & 0x1fff ) | odd; - for ( i = 0; i < stride; i++ ) - { - UINT8 data = videoram[ offset++ ]; - - *p = palette[( data & 0x80 ) ? fg : bg ]; p++; - *p = palette[( data & 0x40 ) ? fg : bg ]; p++; - *p = palette[( data & 0x20 ) ? fg : bg ]; p++; - *p = palette[( data & 0x10 ) ? fg : bg ]; p++; - *p = palette[( data & 0x08 ) ? fg : bg ]; p++; - *p = palette[( data & 0x04 ) ? fg : bg ]; p++; - *p = palette[( data & 0x02 ) ? fg : bg ]; p++; - *p = palette[( data & 0x01 ) ? fg : bg ]; p++; - } -} - -/*************************************************************************** - Draw graphics mode with 640x200 pixels + extra highlight color for text - mode emulation - Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 -***************************************************************************/ - -POISK1_UPDATE_ROW( p1_state::poisk1_gfx_1bpp_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT32 *p = &bitmap.pix32(ra); - UINT8 fg, bg = BG_COLOR(m_video.color_select_68); - UINT16 odd, offset; - int i; - - if ( ra == 0 ) DBG_LOG(1,"poisk1_gfx_1bpp_update_row",("bg %d\n", bg)); - odd = ( ra & 1 ) << 13; - offset = ( ma & 0x1fff ) | odd; - for ( i = 0; i < stride; i++ ) - { - UINT8 data = videoram[ offset++ ]; - - fg = (data & 0x80) ? ( (m_video.color_select_68 & 0x20) ? 10 : 11 ) : 15; // XXX - *p = palette[bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg ]; p++; - *p = palette[( data & 0x20 ) ? fg : bg ]; p++; - *p = palette[( data & 0x10 ) ? fg : bg ]; p++; - *p = palette[( data & 0x08 ) ? fg : bg ]; p++; - *p = palette[( data & 0x04 ) ? fg : bg ]; p++; - *p = palette[( data & 0x02 ) ? fg : bg ]; p++; - *p = palette[( data & 0x01 ) ? fg : bg ]; p++; - } -} - -/* Initialise the cga palette */ -PALETTE_INIT_MEMBER(p1_state, p1) -{ - int i; - - DBG_LOG(0,"init",("palette_init()\n")); - - for ( i = 0; i < CGA_PALETTE_SETS * 16; i++ ) - { - palette.set_pen_color(i, cga_palette[i][0], cga_palette[i][1], cga_palette[i][2] ); - } -} - -void p1_state::video_start() -{ - address_space &space = m_maincpu->space( AS_PROGRAM ); - - DBG_LOG(0,"init",("video_start()\n")); - - memset(&m_video, 0, sizeof(m_video)); - m_video.videoram = m_video.videoram_base = auto_alloc_array(machine(), UINT8, 0x8000); - m_video.stride = 80; - - space.install_readwrite_bank(0xb8000, 0xbffff, "bank11" ); - machine().root_device().membank("bank11")->set_base(m_video.videoram); -} - -UINT32 p1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - UINT16 ra, ma = 0; - - if (!m_video.stride || !m_video.videoram) return 0; - - // bit 6 of 6Ah disables color burst -- not implemented - for (ra = cliprect.min_y; ra <= cliprect.max_y; ra++) - { - if (BIT(m_video.color_select_68, 7)) { - if (BIT(m_video.mode_control_6a, 7)) { - cga_gfx_1bpp_update_row(bitmap, cliprect, m_video.videoram, ma, ra, m_video.stride); - } else { - poisk1_gfx_1bpp_update_row(bitmap, cliprect, m_video.videoram, ma, ra, m_video.stride); - } - } else { - cga_gfx_2bpp_update_row(bitmap, cliprect, m_video.videoram, ma, ra, m_video.stride); - } - if (ra & 1) ma += m_video.stride; - } - - return 0; -} diff --git a/src/mess/video/poisk1.h b/src/mess/video/poisk1.h deleted file mode 100644 index 092de267b1e..00000000000 --- a/src/mess/video/poisk1.h +++ /dev/null @@ -1,10 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Sergey Svishchev -#include "emu.h" - -#define CGA_PALETTE_SETS 83 -/* one for colour, one for mono, 81 for colour composite */ - -INPUT_PORTS_EXTERN( pcvideo_poisk1 ); - -MACHINE_CONFIG_EXTERN( pcvideo_poisk1 ); diff --git a/src/mess/video/poly88.c b/src/mess/video/poly88.c deleted file mode 100644 index 83652770e56..00000000000 --- a/src/mess/video/poly88.c +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Poly-88 video by Miodrag Milanovic - - 18/05/2009 Initial implementation - -****************************************************************************/ - -#include "emu.h" -#include "includes/poly88.h" - -static const UINT8 mcm6571a_shift[] = -{ - 0,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0, - 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0, - 1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0 -}; - -void poly88_state::video_start() -{ - m_FNT = memregion("chargen")->base(); -} - -UINT32 poly88_state::screen_update_poly88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,j,b; - UINT16 addr; - int xpos; - UINT8 l,r; - - for(y = 0; y < 16; y++ ) - { - addr = y*64; - xpos = 0; - for(x = 0; x < 64; x++ ) - { - UINT8 code = m_video_ram[addr + x]; - if ((code & 0x80)==0) - { - for(j = 0; j < 15; j++ ) - { - l = j/5; - for(b = 0; b < 10; b++ ) - { - r = b/5; - if (l==0 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,5) ? 0 : 1; - - if (l==0 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,2) ? 0 : 1; - - if (l==1 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,4) ? 0 : 1; - - if (l==1 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,1) ? 0 : 1; - - if (l==2 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,3) ? 0 : 1; - - if (l==2 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; - } - } - } - else - { - for(j = 0; j < 15; j++ ) - { - code &= 0x7f; - l = 0; - if (mcm6571a_shift[code]==0) - { - if (j < 9) - l = m_FNT[code*16 + j]; - } - else - { - if ((j > 2) && (j < 12)) - l = m_FNT[code*16 + j - 3]; - } - - for(b = 0; b < 7; b++ ) - bitmap.pix16(y*15+j, xpos+b ) = (l >> (6-b)) & 1; - - bitmap.pix16(y*15+j, xpos+7 ) = 0; - bitmap.pix16(y*15+j, xpos+8 ) = 0; - bitmap.pix16(y*15+j, xpos+9 ) = 0; - } - } - xpos += 10; - } - } - return 0; -} diff --git a/src/mess/video/pp01.c b/src/mess/video/pp01.c deleted file mode 100644 index da2ec5cfde7..00000000000 --- a/src/mess/video/pp01.c +++ /dev/null @@ -1,56 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - PP-01 driver by Miodrag Milanovic - - 08/09/2008 Preliminary driver. - -****************************************************************************/ - - -#include "includes/pp01.h" - -void pp01_state::video_start() -{ -} - -UINT32 pp01_state::screen_update_pp01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code_r,code_g,code_b; - UINT8 col; - int y, x, b; - UINT8 *ram = m_ram->pointer(); - - for (y = 0; y < 256; y++) - { - for (x = 0; x < 32; x++) - { - code_r = ram[0x6000 + ((y+m_video_scroll)&0xff)*32 + x]; - code_g = ram[0xa000 + ((y+m_video_scroll)&0xff)*32 + x]; - code_b = ram[0xe000 + ((y+m_video_scroll)&0xff)*32 + x]; - for (b = 0; b < 8; b++) - { - col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); - bitmap.pix16(y, x*8+(7-b)) = col; - } - } - } - return 0; -} - -static const rgb_t pp01_palette[8] = { - rgb_t(0x00, 0x00, 0x00), // 0 - rgb_t(0x00, 0x00, 0x80), // 1 - rgb_t(0x00, 0x80, 0x00), // 2 - rgb_t(0x00, 0x80, 0x80), // 3 - rgb_t(0x80, 0x00, 0x00), // 4 - rgb_t(0x80, 0x00, 0x80), // 5 - rgb_t(0x80, 0x80, 0x00), // 6 - rgb_t(0x80, 0x80, 0x80), // 7 -}; - -PALETTE_INIT_MEMBER(pp01_state, pp01) -{ - palette.set_pen_colors(0, pp01_palette, ARRAY_LENGTH(pp01_palette)); -} diff --git a/src/mess/video/primo.c b/src/mess/video/primo.c deleted file mode 100644 index 55332149128..00000000000 --- a/src/mess/video/primo.c +++ /dev/null @@ -1,47 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/*************************************************************************** - - primo.c - - Functions to emulate the video hardware of Primo. - - Krzysztof Strzecha - -***************************************************************************/ - -#include "emu.h" -#include "includes/primo.h" - - - -void primo_state::primo_draw_scanline(bitmap_ind16 &bitmap, int primo_scanline) -{ - int x, i; - UINT8 data; - - /* set up scanline */ - UINT16 *scanline = &bitmap.pix16(primo_scanline); - - /* address of current line in Primo video memory */ - const UINT8* primo_video_ram_line = (const UINT8*)m_maincpu->space(AS_PROGRAM).get_read_ptr(m_video_memory_base + 32 * primo_scanline); - - for (x=0; x<256; x+=8) - { - data = primo_video_ram_line[x/8]; - - for (i=0; i<8; i++) - scanline[x+i]=(data & (0x80>>i)) ? 1 : 0; - - } -} - - -UINT32 primo_state::screen_update_primo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int primo_scanline; - - for (primo_scanline=0; primo_scanline<192; primo_scanline++) - primo_draw_scanline( bitmap, primo_scanline); - return 0; -} diff --git a/src/mess/video/rm380z.c b/src/mess/video/rm380z.c deleted file mode 100644 index 4b00c5222db..00000000000 --- a/src/mess/video/rm380z.c +++ /dev/null @@ -1,406 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol,Gabriele D'Antona - -/* - -RM 380Z video code - -*/ - - -#include "includes/rm380z.h" - - -void rm380z_state::put_point(int charnum,int x,int y,int col) -{ - int mx=3; - if (y==6) mx=4; - - for (unsigned int r=y;r<(y+mx);r++) - { - for (unsigned int c=x;c<(x+3);c++) - { - m_graphic_chars[charnum][c+(r*(RM380Z_CHDIMX+1))]=col; - } - } -} - -void rm380z_state::init_graphic_chars() -{ - for (int c=0;c<0x3f;c++) - { - if (c&0x01) put_point(c,0,0,1); - else put_point(c,0,0,0); - - if (c&0x02) put_point(c,3,0,1); - else put_point(c,3,0,0); - - if (c&0x04) put_point(c,0,3,1); - else put_point(c,0,3,0); - - if (c&0x08) put_point(c,3,3,1); - else put_point(c,3,3,0); - - if (c&0x10) put_point(c,0,6,1); - else put_point(c,0,6,0); - - if (c&0x20) put_point(c,3,6,1); - else put_point(c,3,6,0); - } -} - -void rm380z_state::config_videomode() -{ - if (m_port0&0x20) - { - // 80 cols - m_videomode=RM380Z_VIDEOMODE_80COL; - } - else - { - // 40 cols - m_videomode=RM380Z_VIDEOMODE_40COL; - } - - if (m_old_videomode!=m_videomode) - { - m_old_videomode=m_videomode; - } -} - -// char attribute bits in COS 4.0 - -// 0=alternate charset -// 1=underline -// 2=dim -// 3=reverse - - -void rm380z_state::decode_videoram_char(int pos,UINT8& chr,UINT8& attrib) -{ - UINT8 ch1=m_vramchars[pos]; - UINT8 ch2=m_vramattribs[pos]; - - // "special" (unknown) cases first - if ((ch1==0x80)&&(ch2==0x04)) - { - // blank out - chr=0x20; - attrib=0; - return; - } - else if ((ch1==0)&&(ch2==8)) - { - // cursor - chr=0x20; - attrib=8; - return; - } - else if ((ch1==0)&&(ch2==0)) - { - // delete char (?) - chr=0x20; - attrib=0; - return; - } - else if ((ch1==4)&&(ch2==4)) - { - // reversed cursor? - chr=0x20; - attrib=0; - return; - } - else if ((ch1==4)&&(ch2==8)) - { - // normal cursor - chr=0x20; - attrib=8; - return; - } - else - { - chr=ch1; - attrib=ch2; - - //printf("unhandled character combination [%x][%x]\n",ch1,ch2); - } -} - -void rm380z_state::scroll_videoram() -{ - int lineWidth=0x80; - if (m_videomode==RM380Z_VIDEOMODE_40COL) - { - lineWidth=0x40; - } - - // scroll up one row of videoram - - for (int row=1;rowr[1]) - { - scroll_videoram(); - } - else if ((r[2]==0x00)&&(r[1]==0x17)) - { - // wrap-scroll - scroll_videoram(); - } - - } -} - -// after ctrl-L (clear screen?): routine at EBBD is executed -// EB30??? next line? -// memory at FF02 seems to hold the line counter (same as FBFD) -// -// basics: -// 20e2: prints "Ready:" -// 0195: prints "\n" - -WRITE8_MEMBER( rm380z_state::videoram_write ) -{ - //printf("vramw [%2.2x][%2.2x] port0 [%2.2x] fbfd [%2.2x] fbfe [%2.2x] PC [%4.4x]\n",offset,data,m_port0,m_fbfd,m_fbfe,m_maincpu->safe_pc()); - - int lineWidth=0x80; - if (m_videomode==RM380Z_VIDEOMODE_40COL) - { - lineWidth=0x40; - } - - int rowadder=(m_fbfe&0x0f)*2; - if (m_videomode==RM380Z_VIDEOMODE_40COL) rowadder=0; // FBFE register is not used in VDU-40 - - int lineAdder=rowadder*lineWidth; - int realA=(offset+lineAdder); - - // we suppose videoram is being written as character/attribute couple - // fbfc 6th bit set=attribute, unset=char - - if (!(m_port0&0x40)) - { - m_vramchars[realA%RM380Z_SCREENSIZE]=data; - } - else - { - m_vramattribs[realA%RM380Z_SCREENSIZE]=data; - } - - // - - m_mainVideoram[offset]=data; -} - -READ8_MEMBER( rm380z_state::videoram_read ) -{ - return m_mainVideoram[offset]; -} - -void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bitmap,unsigned char* chsb,int vmode) -{ - //bool attrDim=false; - bool attrRev=false; - bool attrUnder=false; - - if (attribs&0x02) attrUnder=true; - //if (attribs&0x04) attrDim=true; - if (attribs&0x08) attrRev=true; - - if ((charnum>0)&&(charnum<=0x7f)) - { - // normal chars (base set) - - if (vmode==RM380Z_VIDEOMODE_80COL) - { - int basex=RM380Z_CHDIMX*(charnum/RM380Z_NCY); - int basey=RM380Z_CHDIMY*(charnum%RM380Z_NCY); - - for (int r=0;rbase(); - - int lineWidth=0x80; - int ncols=80; - - if (m_videomode==RM380Z_VIDEOMODE_40COL) - { - lineWidth=0x40; - ncols=40; - } - - // blank screen - bitmap.fill(0); - - for (int row=0;row>4) -#define SELECT_COL(x,c) (IS_80COL ? ((((x) & 1) ? ((c) << 2) : (c)) & 0xC) : (c)) -#define FILL_WORD(c) (((c) << 12) | ((c) << 8) | ((c) << 4) | (c)) - -#define IS_80COL (m_mode&0x10) -#define IS_XOR (m_op&8) - -#define DEBUG_TEXT 0x01 -#define DEBUG_DB 0x02 -#define DEBUG_PIXEL 0x04 - -#define DEBUG_SET(flags) ((m_debug_video & (flags))==(flags)) - -static void video_debug(running_machine &machine, int ref, int params, const char *param[]); - -READ16_MEMBER(rmnimbus_state::nimbus_video_io_r) -{ - UINT16 result = 0; - - switch (offset) - { - case 0x00: - case 0x08: - result = read_pixel_data(m_x, m_y); - break; - case 0x02: - case 0x0A: - result = read_pixel_data(m_x, ++m_y); - break; - case 0x05: - case 0x0D: - result = read_pixel_data(++m_x, m_y); - break; - - case 0x10: - result = m_yline; - break; - case 0x11: - result = m_op; - break; - case 0x12: - result = m_colours; - break; - case 0x13: - result = m_mode; - break; - case 0x14: - result = m_screen->vpos() % 0xb; // TODO: verify - break; - case 0x15: - result = m_x; - break; - case 0x16: - result = m_y; - break; - default: - logerror("nimbus: unknown video reg read %02x\n", offset); - break; - } - - if(DEBUG_SET(DEBUG_TEXT)) - logerror("Nimbus video IOR at %05X from %04X mask=%04X, data=%04X\n",space.device().safe_pc(),(offset*2),mem_mask,result); - - return result; -} - -UINT8 rmnimbus_state::get_pixel(UINT16 x, UINT16 y) -{ - UINT8 result = 0; - - if((x<640) && (y<250)) - { - if(IS_80COL) - result=m_video_mem.pix16(y, x) >> 2; - else - result=m_video_mem.pix16(y, x*2); - } - - return result; -} - -UINT16 rmnimbus_state::read_pixel_line(UINT16 x, UINT16 y, UINT8 pixels, UINT8 bpp) -{ - UINT16 colour = 0; - int i; - x *= pixels; - - if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) - logerror("read_pixel_line(x=%d, y=%d, width=%d, bpp=%d)\n",x,y,pixels,bpp); - - for(i = 0; i < pixels - 1; i++) - { - colour |= get_pixel(i + x, y); - - if(bpp==1) - colour=((colour==SELECT_COL(x + i, FG_COLOUR)) ? 1 : 0) << 1; - else - colour <<= bpp; - } - return colour | get_pixel(x + i, y); -} - -UINT16 rmnimbus_state::read_pixel_data(UINT16 x, UINT16 y) -{ - UINT16 result=0; - - if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) - logerror("read_pixel_data(x=%d, y=%d), reg022=%04X\n",x,y,m_op); - - if(IS_80COL) - { - switch (m_op & WIDTH_MASK) - { - case 0x00 : break; - - case 0x01 : break; - - case 0x02 : break; - - case 0x03 : break; - - case 0x04 : - result=read_pixel_line(x,y,4,2); - break; - - case 0x05 : break; - - case 0x06 : - result=read_pixel_line(x,y,8,2); - break; - - case 0x07 : break; - } - } - else /* 40 Col */ - { - switch (m_op & WIDTH_MASK) - { - case 0x00 : break; - - case 0x01 : break; - - case 0x02 : break; - - case 0x03 : break; - - case 0x04 : break; - - case 0x05 : break; - - case 0x06 : - result=read_pixel_line(x,y,4,4); - break; - - case 0x07 : break; - } - } - - return result; -} - -/* - Write to the video registers. - - Incase anyone wonders about the DEBUG_DB statement, this allows me to log which registers - are being written to and then play them back at the real machine, this has helped greatly - in figuring out what the video registers do. - -*/ - -WRITE16_MEMBER(rmnimbus_state::nimbus_video_io_w) -{ - UINT16 colours = data; - if(offset < 0x14) - { - if(DEBUG_SET(DEBUG_TEXT)) - logerror("Nimbus video IOW at %05X write of %04X to %04X mask=%04X\n",space.device().safe_pc(),data,(offset*2),mem_mask); - - if(DEBUG_SET(DEBUG_DB)) - logerror("dw %05X,%05X\n",(offset*2),data); - } - - switch (offset) - { - case 0x00: - case 0x08: - break; - - case 0x09: - colours = FILL_WORD(FG_COLOUR); - case 0x01: - m_x = data; - break; - - case 0x02: - case 0x0A: - m_y++; - break; - - case 0x0B: - colours = FILL_WORD(FG_COLOUR); - case 0x03: - m_x = data; - m_y++; - break; - - case 0x05: - case 0x0D: - m_x++; - break; - - case 0x0E: - colours = FILL_WORD(FG_COLOUR); - case 0x06: - m_y = data; - break; - - case 0x0F: - colours = FILL_WORD(FG_COLOUR); - case 0x07: - m_y = data; - m_x++; - break; - - case 0x10: - m_yline = data; - return; - case 0x11: - m_op = data; - return; - case 0x12: - m_colours = data; - return; - case 0x13: - /* - bits 0..3 of reg026 contain the border colour. - bit 5 contains the 40/80 column (320/640 pixel) flag. - */ - m_mode = data; - return; - case 0x14: - case 0x15: - case 0x16: - case 0x17: - change_palette(offset - 0x14, data); - return; - - default: - logerror("nimbus: unknown video reg write %02x %04x\n", offset, data); - return; - } - if(offset & 0x08) - write_pixel_data(m_x, m_y, colours); -} - -void rmnimbus_state::set_pixel(UINT16 x, UINT16 y, UINT8 colour) -{ - if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) - logerror("set_pixel(x=%d, y=%d, colour=%04X), IS_XOR=%02X\n",x,y,colour,IS_XOR); - - if((x<640) && (y<250)) - { - if(IS_XOR) - m_video_mem.pix16(y, x)^=colour; - else - m_video_mem.pix16(y, x)=colour; - } -} - -void rmnimbus_state::set_pixel40( UINT16 x, UINT16 y, UINT8 colour) -{ - set_pixel((x*2),y,colour); - set_pixel((x*2)+1,y,colour); -} - -void rmnimbus_state::write_pixel_line(UINT16 x, UINT16 y, UINT16 data, UINT8 pixels, UINT8 bpp) -{ - UINT8 colour; - UINT8 mask = (1 << bpp) - 1; - x *= pixels; - - if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) - logerror("write_pixel_line(x=%d, y=%d, data=%04X, width=%d, bpp=%d)\n",x,y,data,pixels,bpp); - - for(int i = (pixels - 1); i >= 0; i--) - { - if(bpp==1) - colour = SELECT_COL(x + i, (data & 1) ? FG_COLOUR : BG_COLOUR); - else if(IS_80COL) - colour = (data & mask) << 2; - else - colour = (data & mask); - - if(IS_80COL) - set_pixel(x + i,y,colour); - else - set_pixel40(x + i,y,colour); - - data >>= bpp; - } -} - -void rmnimbus_state::move_pixel_line(UINT16 x, UINT16 y, UINT8 pixels) -{ - x *= pixels; - if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) - logerror("move_pixel_line(x=%d, y=%d, width=%d)\n",x,y,pixels); - - for(int i = 0; i < pixels; i++) - { - if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) - logerror("x=%d\n",x + i); - m_video_mem.pix16(m_yline, x + i) = m_video_mem.pix16(y, x + i); - } -} - - - -/* - The values in the bottom 3 bits of reg022 seem to determine the number of bits per pixel - for following operations. - - The values that I have decoded so far are : - - 000 1bpp, foreground and background colours taken from reg024 - 001 2bpp, using the first 4 colours of the pallette - 010 - 011 - 100 4bpp, must be a 16 bit word, of which the upper byte is a mask anded with existing pixels then ored - with the lower byte containing the pixel data for two pixels. - 101 Move pixel data at x,reg020 to x,y, used for scrolling. - 110 if 40 col - 4bpp, 16 bit word containing the pixel data for 4 pixels. - else - 2bpp, 16 bit word containing the pixel data for 8 pixels. - 111 - - Bit 3 of reg022 is as follows : - - 0 pixels are written from supplied colour data - 1 pixels are xor'ed onto the screen -*/ - -void rmnimbus_state::write_pixel_data(UINT16 x, UINT16 y, UINT16 data) -{ - if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) - logerror("write_pixel_data(x=%d, y=%d, data=%04X), reg022=%04X\n",x,y,data,m_op); - - if(IS_80COL) - { - switch (m_op & WIDTH_MASK) - { - case 0x00: - write_pixel_line(x,y,data,16,1); - break; - - case 0x01: - write_pixel_line(x,y,data,8,1); - break; - - case 0x02: - write_pixel_line(x,y,data,8,1); - break; - - case 0x03: - set_pixel(x,y,SELECT_COL(x, FG_COLOUR)); - break; - - case 0x04: - write_pixel_line(x,y,(((data & 0xFF00)>>8) & (data & 0xFF)) | (~((data & 0xFF00)>>8) & read_pixel_line(x,y,4,2)),4,2); - break; - - case 0x05: - move_pixel_line(x,y,16); - break; - - case 0x06: - write_pixel_line(x,y,data,8,2); - break; - - case 0x07: - set_pixel(x,y,SELECT_COL(x, FG_COLOUR)); - break; - } - } - else /* 40 Col */ - { - switch (m_op & WIDTH_MASK) - { - case 0x00: - write_pixel_line(x,y,data,8,1); - break; - - case 0x01: - write_pixel_line(x,y,data,4,2); - break; - - case 0x02: - set_pixel40(x,y,FG_COLOUR); - break; - - case 0x03: - set_pixel(x,y,FG_COLOUR); - break; - - case 0x04: - write_pixel_line(x,y,(((data & 0xFF00)>>8) & (data & 0xFF)) | (~((data & 0xFF00)>>8) & read_pixel_line(x,y,2,4)),2,4); - break; - - case 0x05: - move_pixel_line(x,y,16); - break; - - case 0x06: - write_pixel_line(x,y,data,4,4); - break; - - case 0x07: - set_pixel(x,y,FG_COLOUR); - break; - } - } -} - -void rmnimbus_state::change_palette(UINT8 bank, UINT16 colours) -{ - // loop over changing colours - for(int colourno = (bank * 4); colourno < ((bank + 1) * 4); colourno++) - { - int i = (colours & 8) >> 3; - m_palette->set_pen_color(colourno, pal2bit((colours & 2) | i), pal2bit(((colours & 4) >> 1) | i), pal2bit(((colours & 1) << 1) | i)); - - if(DEBUG_SET(DEBUG_TEXT)) - logerror("set colourno[%02X], colour=%02X\n",colourno, colours & 0xf); - colours >>= 4; - } -} - -static void video_debug(running_machine &machine, int ref, int params, const char *param[]) -{ - rmnimbus_state *state = machine.driver_data(); - if(params>0) - { - int temp; - sscanf(param[0],"%d",&temp); state->m_debug_video = temp; - } - else - { - debug_console_printf(machine,"Error usage : nimbus_vid_debug \n"); - debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_video); - } -} - -void rmnimbus_state::video_start() -{ - m_debug_video=0; - - m_screen->register_screen_bitmap(m_video_mem); - - if (machine().debug_flags & DEBUG_FLAG_ENABLED) - { - debug_console_register_command(machine(), "nimbus_vid_debug", CMDFLAG_NONE, 0, 0, 1, video_debug); - } -} - -void rmnimbus_state::video_reset() -{ - m_mode = 0; - m_x = 0; - m_y = 0; - m_op = 0; - m_yline = 0; -} - -UINT32 rmnimbus_state::screen_update_nimbus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_video_mem, 0, 0, 0, 0, cliprect); - - return 0; -} diff --git a/src/mess/video/samcoupe.c b/src/mess/video/samcoupe.c deleted file mode 100644 index af931c952c7..00000000000 --- a/src/mess/video/samcoupe.c +++ /dev/null @@ -1,171 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Lee Hammerton, Dirk Best -/*************************************************************************** - - Miles Gordon Technology SAM Coupe - -***************************************************************************/ - -#include "emu.h" -#include "includes/samcoupe.h" - - -/*************************************************************************** - MACROS -***************************************************************************/ - -/* border color from border register */ -#define BORDER_COLOR(x) ((x & 0x20) >> 2 | (x & 0x07)) - -/* foreground and background color from attribute byte in mode 1 and 2 */ -#define ATTR_BG(x) ((x >> 3) & 0x07) -#define ATTR_FG(x) (((x >> 3) & 0x08) | (x & 0x07)) - - -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ - -void samcoupe_state::video_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); -} - -UINT32 samcoupe_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - -void samcoupe_state::draw_mode4_line(int y, int hpos) -{ - UINT8 *videoram = m_videoram; - - /* get start address */ - UINT8 *vram = videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); - - for (int i = 0; i < (SAM_BLOCK*2)/4; i++) - { - /* draw 2 pixels (doublewidth) */ - m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; - - /* move to next address */ - vram++; - - /* attribute register contains the third displayed byte */ - if (i == 2) - m_attribute = *vram; - } -} - -void samcoupe_state::draw_mode3_line(int y, int hpos) -{ - UINT8 *videoram = m_videoram; - - /* get start address */ - UINT8 *vram = videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); - - for (int i = 0; i < (SAM_BLOCK*2)/4; i++) - { - /* draw 4 pixels */ - m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; - - /* move to next address */ - vram++; - - /* attribute register contains the third displayed byte */ - if (i == 2) - m_attribute = *vram; - } -} - -void samcoupe_state::draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask) -{ - /* extract colors from attribute */ - UINT8 ink = m_clut[ATTR_FG(m_attribute)]; - UINT8 pap = m_clut[ATTR_BG(m_attribute)]; - - /* draw block of 8 pixels (doubled to 16) */ - for (int i = 0; i < SAM_BLOCK; i++) - { - bitmap.pix16(vpos, hpos + i*2 + 0) = BIT(mask, 7 - i) ? ink : pap; - bitmap.pix16(vpos, hpos + i*2 + 1) = BIT(mask, 7 - i) ? ink : pap; - } -} - -void samcoupe_state::draw_mode2_line(int y, int hpos) -{ - UINT8 *videoram = m_videoram; - - int cell = (y - SAM_BORDER_TOP) * 32 + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2; - - UINT8 mask = videoram[cell]; - m_attribute = videoram[cell + 0x2000]; - - draw_mode12_block(m_bitmap, y, hpos, mask); -} - -void samcoupe_state::draw_mode1_line(int y, int hpos) -{ - UINT8 *videoram = m_videoram; - - UINT8 mask = videoram[((((y - SAM_BORDER_TOP) & 0xc0) << 5) | (((y - SAM_BORDER_TOP) & 0x07) << 8) | (((y - SAM_BORDER_TOP) & 0x38) << 2)) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2]; - m_attribute = videoram[32*192 + (((y - SAM_BORDER_TOP) & 0xf8) << 2) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2]; - - draw_mode12_block(m_bitmap, y, hpos, mask); -} - -TIMER_CALLBACK_MEMBER(samcoupe_state::sam_video_update_callback) -{ - int vpos = machine().first_screen()->vpos(); - int hpos = machine().first_screen()->hpos(); - - int next_vpos = vpos; - int next_hpos = hpos + SAM_BLOCK*2; - - /* next scanline? */ - if (next_hpos >= SAM_BORDER_LEFT + SAM_SCREEN_WIDTH + SAM_BORDER_RIGHT) - { - next_vpos = (vpos + 1) % (SAM_BORDER_TOP + SAM_SCREEN_HEIGHT + SAM_BORDER_BOTTOM); - next_hpos = 0; - } - - /* display disabled? (only in mode 3 or 4) */ - if (BIT(m_vmpr, 6) && BIT(m_border, 7)) - { - m_bitmap.plot_box(hpos, vpos, SAM_BLOCK*2, 1, 0); - } - else - { - /* border area? */ - if (vpos < SAM_BORDER_TOP || vpos >= SAM_BORDER_TOP + SAM_SCREEN_HEIGHT || hpos < SAM_BORDER_LEFT || hpos >= SAM_BORDER_LEFT + SAM_SCREEN_WIDTH) - { - m_attribute = 0xff; - m_bitmap.plot_box(hpos, vpos, SAM_BLOCK*2, 1, m_clut[BORDER_COLOR(m_border)]); - } - else - { - /* main screen area */ - switch ((m_vmpr & 0x60) >> 5) - { - case 0: draw_mode1_line(vpos, hpos); break; - case 1: draw_mode2_line(vpos, hpos); break; - case 2: draw_mode3_line(vpos, hpos); break; - case 3: draw_mode4_line(vpos, hpos); break; - } - } - } - - /* do we need to trigger the scanline interrupt (interrupt happens at the start of the right border before the specified line)? */ - if (m_line_int < SAM_SCREEN_HEIGHT && hpos == SAM_BORDER_LEFT + SAM_SCREEN_WIDTH && vpos == (m_line_int + SAM_BORDER_TOP - 1)) - samcoupe_irq(SAM_LINE_INT); - - /* schedule next update */ - m_video_update_timer->adjust(machine().first_screen()->time_until_pos(next_vpos, next_hpos)); -} diff --git a/src/mess/video/special.c b/src/mess/video/special.c deleted file mode 100644 index d868c9efded..00000000000 --- a/src/mess/video/special.c +++ /dev/null @@ -1,153 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Specialist video driver by Miodrag Milanovic - - 15/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "includes/special.h" - - -VIDEO_START_MEMBER(special_state,special) -{ - m_palette->set_pen_color(0,rgb_t::black); /* black */ - m_palette->set_pen_color(1,rgb_t::white); /* white */ -} - -UINT32 special_state::screen_update_special(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code; - int y, x, b; - - for (x = 0; x < 48; x++) - { - for (y = 0; y < 256; y++) - { - code = m_p_videoram[y + x*256]; - for (b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = (code >> b) & 0x01; - } - } - return 0; -} -VIDEO_START_MEMBER(special_state,specialp) -{ -} - -UINT32 special_state::screen_update_specialp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code; - int y, x, b; - - for (x = 0; x < 64; x++) - { - for (y = 0; y < 256; y++) - { - code = m_p_videoram[y + x*256]; - for (b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = (code >> b) & 0x01; - } - } - return 0; -} - - -static const rgb_t specimx_palette[16] = { - rgb_t(0x00, 0x00, 0x00), // 0 - rgb_t(0x00, 0x00, 0xaa), // 1 - rgb_t(0x00, 0xaa, 0x00), // 2 - rgb_t(0x00, 0xaa, 0xaa), // 3 - rgb_t(0xaa, 0x00, 0x00), // 4 - rgb_t(0xaa, 0x00, 0xaa), // 5 - rgb_t(0xaa, 0x55, 0x00), // 6 - rgb_t(0xaa, 0xaa, 0xaa), // 7 - rgb_t(0x55, 0x55, 0x55), // 8 - rgb_t(0x55, 0x55, 0xff), // 9 - rgb_t(0x55, 0xff, 0x55), // A - rgb_t(0x55, 0xff, 0xff), // B - rgb_t(0xff, 0x55, 0x55), // C - rgb_t(0xff, 0x55, 0xff), // D - rgb_t(0xff, 0xff, 0x55), // E - rgb_t(0xff, 0xff, 0xff) // F -}; - -PALETTE_INIT_MEMBER(special_state,specimx) -{ - palette.set_pen_colors(0, specimx_palette, ARRAY_LENGTH(specimx_palette)); -} - - -VIDEO_START_MEMBER(special_state,specimx) -{ - m_specimx_colorram = auto_alloc_array(machine(), UINT8, 0x3000); -} - -UINT32 special_state::screen_update_specimx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code, color; - int y, x, b; - - for (x = 0; x < 48; x++) - { - for (y = 0; y < 256; y++) - { - code = m_ram->pointer()[0x9000 + y + x*256]; - color = m_specimx_colorram[y + x*256]; - for (b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = ((code >> b) & 0x01)==0 ? color & 0x0f : (color >> 4)& 0x0f ; - } - } - return 0; -} - -static const rgb_t erik_palette[8] = { - rgb_t(0x00, 0x00, 0x00), // 0 - rgb_t(0x00, 0x00, 0xff), // 1 - rgb_t(0xff, 0x00, 0x00), // 2 - rgb_t(0xff, 0x00, 0xff), // 3 - rgb_t(0x00, 0xff, 0x00), // 4 - rgb_t(0x00, 0xff, 0xff), // 5 - rgb_t(0xff, 0xff, 0x00), // 6 - rgb_t(0xff, 0xff, 0xff) // 7 -}; - -PALETTE_INIT_MEMBER(special_state,erik) -{ - palette.set_pen_colors(0, erik_palette, ARRAY_LENGTH(erik_palette)); -} - - -VIDEO_START_MEMBER(special_state,erik) -{ -} - -UINT32 special_state::screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code1, code2, color1, color2; - int y, x, b; - UINT8 *erik_video_ram_p1, *erik_video_ram_p2; - - erik_video_ram_p1 = m_ram->pointer() + 0x9000; - erik_video_ram_p2 = m_ram->pointer() + 0xd000; - - for (x = 0; x < 48; x++) - { - for (y = 0; y < 256; y++) - { - code1 = erik_video_ram_p1[y + x*256]; - code2 = erik_video_ram_p2[y + x*256]; - - for (b = 7; b >= 0; b--) - { - color1 = ((code1 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_1; - color2 = ((code2 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_2; - bitmap.pix16(y, x*8+(7-b)) = color1 | color2; - } - } - } - return 0; -} diff --git a/src/mess/video/spectrum.c b/src/mess/video/spectrum.c deleted file mode 100644 index c663aa5b865..00000000000 --- a/src/mess/video/spectrum.c +++ /dev/null @@ -1,298 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/*************************************************************************** - - spectrum.c - - Functions to emulate the video hardware of the ZX Spectrum. - - Changes: - - DJR 08/02/00 - Added support for FLASH 1. - DJR 16/05/00 - Support for TS2068/TC2048 hires and 64 column modes. - DJR 19/05/00 - Speeded up Spectrum 128 screen refresh. - DJR 23/05/00 - Preliminary support for border colour emulation. - -***************************************************************************/ - -#include "emu.h" -#include "includes/spectrum.h" - -/*************************************************************************** - Start the video hardware emulation. -***************************************************************************/ -VIDEO_START_MEMBER(spectrum_state,spectrum) -{ - m_frame_invert_count = 16; - m_frame_number = 0; - m_flash_invert = 0; - - m_previous_border_x = 0; - m_previous_border_y = 0; - machine().first_screen()->register_screen_bitmap(m_border_bitmap); - m_previous_screen_x = 0; - m_previous_screen_y = 0; - machine().first_screen()->register_screen_bitmap(m_screen_bitmap); - - m_screen_location = m_video_ram; -} - -VIDEO_START_MEMBER(spectrum_state,spectrum_128) -{ - m_frame_invert_count = 16; - m_frame_number = 0; - m_flash_invert = 0; - - m_previous_border_x = 0; - m_previous_border_y = 0; - machine().first_screen()->register_screen_bitmap(m_border_bitmap); - m_previous_screen_x = 0; - m_previous_screen_y = 0; - machine().first_screen()->register_screen_bitmap(m_screen_bitmap); - - m_screen_location = m_ram->pointer() + (5 << 14); -} - - -/* return the color to be used inverting FLASHing colors if necessary */ -inline unsigned char spectrum_state::get_display_color (unsigned char color, int invert) -{ - if (invert && (color & 0x80)) - return (color & 0xc0) + ((color & 0x38) >> 3) + ((color & 0x07) << 3); - else - return color; -} - -/* Code to change the FLASH status every 25 frames. Note this must be - independent of frame skip etc. */ -void spectrum_state::screen_eof_spectrum(screen_device &screen, bool state) -{ - // rising edge - if (state) - { - spectrum_UpdateBorderBitmap(); - spectrum_UpdateScreenBitmap(true); - - m_frame_number++; - - if (m_frame_number >= m_frame_invert_count) - { - m_frame_number = 0; - m_flash_invert = !m_flash_invert; - } - } -} - - - -/*************************************************************************** - Update the spectrum screen display. - - The screen consists of 312 scanlines as follows: - 64 border lines (the last 48 are actual border lines; the others may be - border lines or vertical retrace) - 192 screen lines - 56 border lines - - Each screen line has 48 left border pixels, 256 screen pixels and 48 right - border pixels. - - Each scanline takes 224 T-states divided as follows: - 128 Screen (reads a screen and ATTR byte [8 pixels] every 4 T states) - 24 Right border - 48 Horizontal retrace - 24 Left border - - The 128K Spectrums have only 63 scanlines before the TV picture (311 total) - and take 228 T-states per scanline. - -***************************************************************************/ - -inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix16(y, x) = (UINT16)color; -} - -UINT32 spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - static const rectangle rect(SPEC_LEFT_BORDER, SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE - 1, SPEC_TOP_BORDER, SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE - 1); - - if (m_border_bitmap.valid()) - copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect); - - spectrum_UpdateScreenBitmap(); - if (m_screen_bitmap.valid()) - copyscrollbitmap(bitmap, m_screen_bitmap, 0, 0, 0, 0, rect); - -#if 0 - // note, don't update borders in here, this can time travel w/regards to other timers and may end up giving you - // screen positions earlier than the last write handler gave you - - /* for now do a full-refresh */ - int x, y, b, scrx, scry; - unsigned short ink, pap; - unsigned char *attr, *scr; - // int full_refresh = 1; - - scr=m_screen_location; - - for (y=0; y<192; y++) - { - scrx=SPEC_LEFT_BORDER; - scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - attr=m_screen_location + ((scry>>3)*32) + 0x1800; - - for (x=0;x<32;x++) - { - /* Get ink and paper colour with bright */ - if (m_flash_invert && (*attr & 0x80)) - { - ink=((*attr)>>3) & 0x0f; - pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - } - else - { - ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - pap=((*attr)>>3) & 0x0f; - } - - for (b=0x80;b!=0;b>>=1) - { - if (*scr&b) - spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); - else - spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); - } - - scr++; - attr++; - } - } -#endif - - return 0; -} - - -static const rgb_t spectrum_palette[16] = { - rgb_t(0x00, 0x00, 0x00), - rgb_t(0x00, 0x00, 0xbf), - rgb_t(0xbf, 0x00, 0x00), - rgb_t(0xbf, 0x00, 0xbf), - rgb_t(0x00, 0xbf, 0x00), - rgb_t(0x00, 0xbf, 0xbf), - rgb_t(0xbf, 0xbf, 0x00), - rgb_t(0xbf, 0xbf, 0xbf), - rgb_t(0x00, 0x00, 0x00), - rgb_t(0x00, 0x00, 0xff), - rgb_t(0xff, 0x00, 0x00), - rgb_t(0xff, 0x00, 0xff), - rgb_t(0x00, 0xff, 0x00), - rgb_t(0x00, 0xff, 0xff), - rgb_t(0xff, 0xff, 0x00), - rgb_t(0xff, 0xff, 0xff) -}; -/* Initialise the palette */ -PALETTE_INIT_MEMBER(spectrum_state,spectrum) -{ - palette.set_pen_colors(0, spectrum_palette, ARRAY_LENGTH(spectrum_palette)); -} - -void spectrum_state::spectrum_UpdateScreenBitmap(bool eof) -{ - unsigned int x = machine().first_screen()->hpos(); - unsigned int y = machine().first_screen()->vpos(); - int width = m_screen_bitmap.width(); - int height = m_screen_bitmap.height(); - - - if ((m_previous_screen_x == x) && (m_previous_screen_y == y) && !eof) - return; - - if (m_screen_bitmap.valid()) - { - //printf("update screen from %d,%d to %d,%d\n", m_previous_screen_x, m_previous_screen_y, x, y); - - do - { - UINT16 scrx = m_previous_screen_x - SPEC_LEFT_BORDER; - UINT16 scry = m_previous_screen_y - SPEC_TOP_BORDER; - - if (scrx < SPEC_DISPLAY_XSIZE && scry < SPEC_DISPLAY_YSIZE) - { - // this can/must be optimised - if ((scrx & 7) == 0) { - UINT16 *bm = &m_screen_bitmap.pix16(m_previous_screen_y, m_previous_screen_x); - UINT8 attr = *(m_screen_location + ((scry & 0xF8) << 2) + (scrx >> 3) + 0x1800); - UINT8 scr = *(m_screen_location + ((scry & 7) << 8) + ((scry & 0x38) << 2) + ((scry & 0xC0) << 5) + (scrx >> 3)); - UINT16 ink = (attr & 0x07) + ((attr >> 3) & 0x08); - UINT16 pap = (attr >> 3) & 0x0f; - - if (m_flash_invert && (attr & 0x80)) - scr = ~scr; - - for (UINT8 b = 0x80; b != 0; b >>= 1) - *bm++ = (scr & b) ? ink : pap; - } - } - - m_previous_screen_x += 1; - - if (m_previous_screen_x >= width) - { - m_previous_screen_x = 0; - m_previous_screen_y += 1; - - if (m_previous_screen_y >= height) - { - m_previous_screen_y = 0; - } - } - } while (!((m_previous_screen_x == x) && (m_previous_screen_y == y))); - - } -} - -/* The code below is just a per-pixel 'partial update' for the border */ - -void spectrum_state::spectrum_UpdateBorderBitmap() -{ - unsigned int x = machine().first_screen()->hpos(); - unsigned int y = machine().first_screen()->vpos(); - int width = m_border_bitmap.width(); - int height = m_border_bitmap.height(); - - - if (m_border_bitmap.valid()) - { - UINT16 border = m_port_fe_data & 0x07; - - //printf("update border from %d,%d to %d,%d\n", m_previous_border_x, m_previous_border_y, x, y); - - do - { - m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border; - - m_previous_border_x += 1; - - if (m_previous_border_x >= width) - { - m_previous_border_x = 0; - m_previous_border_y += 1; - - if (m_previous_border_y >= height) - { - m_previous_border_y = 0; - } - } - } - while (!((m_previous_border_x == x) && (m_previous_border_y == y))); - - } - else - { - // no border bitmap allocated? fatalerror? - } - - -} diff --git a/src/mess/video/ssystem3.c b/src/mess/video/ssystem3.c deleted file mode 100644 index a755dff5a4b..00000000000 --- a/src/mess/video/ssystem3.c +++ /dev/null @@ -1,236 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Peter Trauner -/****************************************************************************** - PeT mess@utanet.at -******************************************************************************/ - -#include "emu.h" -#include "includes/ssystem3.h" - -void ssystem3_state::ssystem3_lcd_reset() -{ - m_lcd.count=0; m_lcd.clock=1; -} - -void ssystem3_state::ssystem3_lcd_write(int clock, int data) -{ - if (clock&&!m_lcd.clock) { - m_lcd.data[m_lcd.count/8]&=~(1<<(m_lcd.count&7)); - if (data) m_lcd.data[m_lcd.count/8]|=1<<(m_lcd.count&7); - if (m_lcd.count+1==40) { - logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)m_maincpu->pc(), - m_lcd.data[0], m_lcd.data[1], m_lcd.data[2], m_lcd.data[3], m_lcd.data[4]); - } - m_lcd.count=(m_lcd.count+1)%40; - } - m_lcd.clock=clock; -} - - - -static const unsigned char ssystem3_palette[] = -{ - 0,12,12, - 80,82,75, - 0,12,12 -}; - - -PALETTE_INIT_MEMBER(ssystem3_state, ssystem3) -{ - int i; - - for ( i = 0; i < sizeof(ssystem3_palette) / 3; i++ ) { - m_palette->set_pen_color(i, ssystem3_palette[i*3], ssystem3_palette[i*3+1], ssystem3_palette[i*3+2]); - } -} - - -void ssystem3_state::video_start() -{ - // artwork seams to need this - m_videoram = auto_alloc_array(machine(), UINT8, 6 * 2 + 24); -} - - -static const char led[]={ - " aaaaaaaaaaaa\r" - " f aaaaaaaaaa b\r" - " ff aaaaaaaa bb\r" - " fff aaaaaa bbb\r" - " ffff bbbb\r" - " ffff bbbb\r" - " ffff bbbb\r" - " ffff bbbb\r" - " ffff bbbb\r" - " ffff bbbb\r" - " fff bbb\r" - " f gggggggg b\r" - " gggggggggggg\r" - " gggggggggggg\r" - " e gggggggg c\r" - " eee ccc\r" - " eeee cccc\r" - " eeee cccc\r" - "eeee cccc\r" - "eeee cccc\r" - "eeee cccc\r" - "eeee cccc\r" - "eee dddddd ccc\r" - "ee dddddddd cc\r" - "e dddddddddd c\r" - " dddddddddddd" -}; - -void ssystem3_state::ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y) -{ - int i, xi, yi, mask, color; - - for (i=0, xi=0, yi=0; led[i]; i++) { - mask=0; - switch (led[i]) { - case 'a': mask=0x80; break; - case 'b': mask=0x40; break; - case 'c': mask=0x20; break; - case 'd': mask=0x10; break; - case 'e': mask=8; break; - case 'f': mask=4; break; - case 'g': mask=2; break; - case 'h': - // this is more likely wired to the separate leds - mask=1; - break; - } - - if (mask!=0) { - color=(value&mask)?1:0; - bitmap.pix16(y+yi, x+xi) = color; - } - if (led[i]!='\r') xi++; - else { yi++, xi=0; } - } -} - -static const struct { - int x,y; -} ssystem3_led_pos[5]={ - {150,123}, - {170,123}, - {200,123}, - {220,123}, - {125,123} -}; - -static const char single_led[]= -" c 1 1\r" -" bb ccccc bb 1 1\r" -" bb c bb 1 1\r" -" bb bb bb bb 1 1\r" -" bb bbbbbbbbbbb bb 111 111\r" -" 1 1\r" -" 99 9999999 99 1 1\r" -" 99 99 1 1\r" -" 88888888888 9 1 1\r" -" 88 8 9999\r" -" 8888 6666666 8 9999\r" -" 8888 6 6\r" -" 6 777 6\r" -" 6 777 6\r" -" 6 777 6\r" -" 6 777 6\r" -" 6 77777 6\r" -" 6 77777 6 2 2 4\r" -" 6 7777777 6 2 2 4\r" -" 6 7777777 6 2 2 4\r" -" 6 777777777 6 2 2 44444\r" -" 6 777777777 6 2 2 4\r" -" 6 77777777777 6 2 2 33433\r" -" 6 7 6 2 2 4\r" -" 6666666 7 6666666 2 2 4\r" -" 7 2 2 4\r" -" 77777777777777777\r" -"\r" -"\r" -"\r" -" 5555555555555555555 000000 000000 00 00 0000000 00 00 00000000 00 00 00 0000000\r" -"5 5 0000000 00000000 000 000 00000000 00 00 00000000 00 000 00 00000000\r" -"5 5 00 00 00 0000 0000 00 00 00 00 00 00 0000 00 00\r" -"5 5 00 00 00 00 00 00 00 00000000 00 00 00 00 00 00 00 00 0000\r" -"5 5 00 00 00 00 00 00 00 0000000 00 00 00 00 00 0000 00 00\r" -"5 5 0000000 00000000 00 0000 00 00 00000000 00 00 00 000 00000000\r" -" 55555555 55555555 000000 000000 00 00 00 00 000000 00 00 00 00 0000000" -; - -void ssystem3_state::ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch) -{ - int j, xi=0; - for (j=0; single_led[j]; j++) { - switch (single_led[j]) { - default: - if (ch==single_led[j]) { - bitmap.pix16(y, x+xi) = color; - } - xi++; - break; - case ' ': - xi++; - break; - case '\r': - xi=0; - y++; - break; - }; - } -} - -UINT32 ssystem3_state::screen_update_ssystem3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int i; - - for (i=0; i<4; i++) { - ssystem3_draw_7segment(bitmap, m_lcd.data[1+i], ssystem3_led_pos[i].x, ssystem3_led_pos[i].y); - } - - ssystem3_draw_led(bitmap, m_lcd.data[0]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '0'); //? - ssystem3_draw_led(bitmap, m_lcd.data[0]&2?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '5'); - ssystem3_draw_led(bitmap, m_lcd.data[0]&4?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '7'); - ssystem3_draw_led(bitmap, m_lcd.data[0]&8?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, 'b'); - ssystem3_draw_led(bitmap, m_lcd.data[0]&0x10?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '9'); - ssystem3_draw_led(bitmap, m_lcd.data[0]&0x20?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '8'); - ssystem3_draw_led(bitmap, m_lcd.data[0]&0x40?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, 'c'); - ssystem3_draw_led(bitmap, m_lcd.data[0]&0x80?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '6'); - ssystem3_draw_led(bitmap, m_lcd.data[1]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '2'); - ssystem3_draw_led(bitmap, m_lcd.data[2]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '1'); //? - ssystem3_draw_led(bitmap, m_lcd.data[3]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '3'); - ssystem3_draw_led(bitmap, m_lcd.data[4]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '4'); - - if (m_configuration->read() & 1) { // playfield(optional device) - static const int lcd_signs_on[]={ - 0, // empty - 1, // bauer - 3, // springer - 0x11, // l??ufer - 7, // turm - 0x1f, // dame - 0x17, // k??nig - 0 - }; - int y, x; - for (y=0; y<8; y++) { - for (x=0; x<8; x++) { - int figure, black; - int xp=263+x*22; - int yp=55+(y^7)*28; - ssystem3_playfield_getfigure(x, y, &figure, &black); - ssystem3_draw_led(bitmap, lcd_signs_on[figure]&1?1:0, xp, yp, '6'); - ssystem3_draw_led(bitmap, lcd_signs_on[figure]&2?1:0, xp, yp, '8'); - ssystem3_draw_led(bitmap, lcd_signs_on[figure]&4?1:0, xp, yp, '9'); - ssystem3_draw_led(bitmap, lcd_signs_on[figure]&8?1:0, xp, yp, 'b'); - ssystem3_draw_led(bitmap, lcd_signs_on[figure]&0x10?1:0, xp, yp, 'c'); - ssystem3_draw_led(bitmap, figure!=0 && black?1:0, xp, yp, '7'); - } - } - } - - return 0; -} diff --git a/src/mess/video/stic.c b/src/mess/video/stic.c deleted file mode 100644 index b5b8dbfb6a4..00000000000 --- a/src/mess/video/stic.c +++ /dev/null @@ -1,974 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,Frank Palazzolo -/********************************************************************** - - General Instruments AY-3-8900-1 a.k.a. Standard Television Interface Chip - (STIC) emulation for Mattel Intellivision - - *********************************************************************/ - -#include "emu.h" -#include "video/stic.h" - - -const device_type STIC = &device_creator; - -//------------------------------------------------- -// stic_device - constructor -//------------------------------------------------- - -stic_device::stic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, STIC, "STIC (Standard Television Interface Chip) Video Chip", tag, owner, clock, "stic", __FILE__), - m_grom(*this, "grom"), - m_x_scale(1), - m_y_scale(1) -{ -} - - -//------------------------------------------------- -// ~stic_device - destructor -//------------------------------------------------- - -stic_device::~stic_device() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void stic_device::device_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); - - save_item(NAME(m_stic_registers)); - save_item(NAME(m_gramdirty)); - save_item(NAME(m_gram)); - save_item(NAME(m_gramdirtybytes)); - save_item(NAME(m_color_stack_mode)); - save_item(NAME(m_color_stack_offset)); - save_item(NAME(m_stic_handshake)); - save_item(NAME(m_border_color)); - save_item(NAME(m_col_delay)); - save_item(NAME(m_row_delay)); - save_item(NAME(m_left_edge_inhibit)); - save_item(NAME(m_top_edge_inhibit)); - save_item(NAME(m_backtab_buffer)); - for (int sp = 0; sp < STIC_MOBS; sp++) - { - save_item(m_sprite[sp].visible, "STIC sprite/m_sprite[sp].visible", sp); - save_item(m_sprite[sp].xpos, "STIC sprite/m_sprite[sp].xpos", sp); - save_item(m_sprite[sp].ypos, "STIC sprite/m_sprite[sp].ypos", sp); - save_item(m_sprite[sp].coll, "STIC sprite/m_sprite[sp].coll", sp); - save_item(m_sprite[sp].collision, "STIC sprite/m_sprite[sp].collision", sp); - save_item(m_sprite[sp].doublex, "STIC sprite/m_sprite[sp].doublex", sp); - save_item(m_sprite[sp].doubley, "STIC sprite/m_sprite[sp].doubley", sp); - save_item(m_sprite[sp].quady, "STIC sprite/m_sprite[sp].quady", sp); - save_item(m_sprite[sp].xflip, "STIC sprite/m_sprite[sp].xflip", sp); - save_item(m_sprite[sp].yflip, "STIC sprite/m_sprite[sp].yflip", sp); - save_item(m_sprite[sp].behind_foreground, "STIC sprite/m_sprite[sp].behind_foreground", sp); - save_item(m_sprite[sp].grom, "STIC sprite/m_sprite[sp].grom", sp); - save_item(m_sprite[sp].card, "STIC sprite/m_sprite[sp].card", sp); - save_item(m_sprite[sp].color, "STIC sprite/m_sprite[sp].color", sp); - save_item(m_sprite[sp].doubleyres, "STIC sprite/m_sprite[sp].doubleyres", sp); - save_item(m_sprite[sp].dirty, "STIC sprite/m_sprite[sp].dirty", sp); - save_item(m_sprite_buffers[sp], "STIC sprite/m_sprite[sp].sprite_buffers", sp); - } -} - -void stic_device::device_reset() -{ - for (int i = 0; i < STIC_MOBS; i++) - { - intv_sprite_type* s = &m_sprite[i]; - s->visible = 0; - s->xpos = 0; - s->ypos = 0; - s->coll = 0; - s->collision = 0; - s->doublex = 0; - s->doubley = 0; - s->quady = 0; - s->xflip = 0; - s->yflip = 0; - s->behind_foreground = 0; - s->grom = 0; - s->card = 0; - s->color = 0; - s->doubleyres = 0; - s->dirty = 1; - for (int j = 0; j < 16; j++) - { - for (int k = 0; k < 128; k++) - { - m_sprite_buffers[i][j][k] = 0; - } - } - } - - memset(m_stic_registers, 0, sizeof(m_stic_registers)); - m_gramdirty = 1; - for (int i = 0; i < 64; i++) - { - m_gram[i] = 0; - m_gramdirtybytes[i] = 1; - } - - m_color_stack_mode = 0; - m_color_stack_offset = 0; - m_stic_handshake = 0; - m_border_color = 0; - m_col_delay = 0; - m_row_delay = 0; - m_left_edge_inhibit = 0; - m_top_edge_inhibit = 0; -} - -ROM_START( stic_grom ) - ROM_REGION( 0x800, "grom", ROMREGION_ERASEFF ) - ROM_LOAD( "ro-3-9503-003.u21", 0, 0x0800, CRC(683a4158) SHA1(f9608bb4ad1cfe3640d02844c7ad8e0bcd974917)) -ROM_END - -const rom_entry *stic_device::device_rom_region() const -{ - return ROM_NAME( stic_grom ); -} - - - -#define FOREGROUND_BIT 0x0010 - -// conversion from Intellivision color to internal representation -#define SET_COLOR(c) ((c * 2) + 1) -#define GET_COLOR(c) ((c - 1) / 2) - -/* initialized to non-zero, because we divide by it */ - -void stic_device::intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - int w, h; - - // output scaling - x *= m_x_scale; - y *= m_y_scale; - color = SET_COLOR(color); - - for (h = 0; h < m_y_scale; h++) - for (w = 0; w < m_x_scale; w++) - bitmap.pix16(y + h, x + w) = color; -} - -UINT32 stic_device::intv_get_pixel(bitmap_ind16 &bitmap, int x, int y) -{ - return GET_COLOR(bitmap.pix16(y * m_y_scale, x * m_x_scale)); -} - -void stic_device::intv_plot_box(bitmap_ind16 &bitmap, int x, int y, int w, int h, int color) -{ - bitmap.plot_box(x * m_x_scale, y * m_y_scale, w * m_x_scale, h * m_y_scale, SET_COLOR(color)); -} - - -int stic_device::sprites_collide(int spriteNum1, int spriteNum2) -{ - INT16 x0, y0, w0, h0, x1, y1, w1, h1, x2, y2, w2, h2; - - intv_sprite_type* s1 = &m_sprite[spriteNum1]; - intv_sprite_type* s2 = &m_sprite[spriteNum2]; - - x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH; - y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT; - x1 = (s1->xpos + x0) * STIC_X_SCALE; y1 = (s1->ypos + y0) * STIC_Y_SCALE; - x2 = (s2->xpos + x0) * STIC_X_SCALE; y2 = (s2->ypos + y0) * STIC_Y_SCALE; - w1 = (s1->doublex ? 2 : 1) * STIC_CARD_WIDTH; - w2 = (s2->doublex ? 2 : 1) * STIC_CARD_WIDTH; - h1 = (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) * (s1->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; - h2 = (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) * (s2->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; - - if ((x1 >= x2 + w2) || (y1 >= y2 + h2) || - (x2 >= x1 + w1) || (y2 >= y1 + h1)) - return FALSE; - - // iterate over the intersecting bits to see if any touch - x0 = MAX(x1, x2); - y0 = MAX(y1, y2); - w0 = MIN(x1 + w1, x2 + w2) - x0; - h0 = MIN(y1 + h1, y2 + h2) - y0; - x1 = x0 - x1; - y1 = y0 - y1; - x2 = x0 - x2; - y2 = y0 - y2; - for (x0 = 0; x0 < w0; x0++) - { - for (y0 = 0; y0 < h0; y0++) - { - if (m_sprite_buffers[spriteNum1][x0 + x1][y0 + y1] && - m_sprite_buffers[spriteNum2][x0 + x2][y0 + y2]) - return TRUE; - } - } - - return FALSE; -} - -void stic_device::determine_sprite_collisions() -{ - // check sprite to sprite collisions - for (int i = 0; i < STIC_MOBS - 1; i++) - { - intv_sprite_type* s1 = &m_sprite[i]; - if (s1->xpos == 0 || !s1->coll) - continue; - - for (int j = i + 1; j < STIC_MOBS; j++) - { - intv_sprite_type* s2 = &m_sprite[j]; - if (s2->xpos == 0 || !s2->coll) - continue; - - if (sprites_collide(i, j)) - { - s1->collision |= (1 << j); - s2->collision |= (1 << i); - } - } - } -} - -void stic_device::render_sprites() -{ - INT32 cardMemoryLocation, pixelSize; - INT32 spritePixelHeight; - INT32 nextMemoryLocation; - INT32 nextData; - INT32 nextX; - INT32 nextY; - INT32 xInc; - - for (int i = 0; i < STIC_MOBS; i++) - { - intv_sprite_type* s = &m_sprite[i]; - - if (s->grom) - cardMemoryLocation = (s->card * STIC_CARD_HEIGHT); - else - cardMemoryLocation = ((s->card & 0x003F) * STIC_CARD_HEIGHT); - - pixelSize = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1); - spritePixelHeight = pixelSize * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; - - for (int j = 0; j < spritePixelHeight; j++) - { - nextMemoryLocation = (cardMemoryLocation + (j/pixelSize)); - if (s->grom) - nextData = m_grom[nextMemoryLocation]; - else if (nextMemoryLocation < 0x200) - nextData = m_gram[nextMemoryLocation]; - else - nextData = 0xFFFF; - nextX = (s->xflip ? ((s->doublex ? 2 : 1) * STIC_CARD_WIDTH - 1) : 0); - nextY = (s->yflip ? (spritePixelHeight - j - 1) : j); - xInc = (s->xflip ? -1: 1); - - for (int k = 0; k < STIC_CARD_WIDTH * (1 + s->doublex); k++) - { - m_sprite_buffers[i][nextX + k * xInc][nextY] = (nextData & (1 << ((STIC_CARD_WIDTH - 1) - k / (1 + s->doublex)))) != 0; - } - } - } -} - -void stic_device::render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor) -{ - UINT32 color; - - for (int i = 0; i < STIC_CARD_WIDTH; i++) - { - color = (nextByte & (1 << ((STIC_CARD_WIDTH - 1) - i)) ? fgcolor : bgcolor); - intv_set_pixel(bitmap, x+i, y, color); - intv_set_pixel(bitmap, x+i, y+1, color); - } -} - -void stic_device::render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3) -{ - intv_plot_box(bitmap, x, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color0); - intv_plot_box(bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color1); - intv_plot_box(bitmap, x, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color2); - intv_plot_box(bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color3); -} - -void stic_device::render_color_stack_mode(bitmap_ind16 &bitmap) -{ - INT16 w, h, nextx, nexty; - UINT8 csPtr = 0; - UINT16 nextCard; - - for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; - h < STIC_BACKTAB_HEIGHT; - h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) - { - for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; - w < STIC_BACKTAB_WIDTH; - w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) - { - nextCard = m_backtab_buffer[h][w]; - - // colored squares mode - if ((nextCard & (STIC_CSTM_FG3|STIC_CSTM_SEL)) == STIC_CSTM_FG3) - { - UINT8 csColor = m_stic_registers[STIC_CSR + csPtr]; - UINT8 color0 = nextCard & STIC_CSQM_A; - UINT8 color1 = (nextCard & STIC_CSQM_B) >> 3; - UINT8 color2 = (nextCard & STIC_CSQM_C) >> 6; - UINT8 color3 = ((nextCard & STIC_CSQM_D2) >> 11) | - ((nextCard & (STIC_CSQM_D10)) >> 9); - render_colored_squares(bitmap, nextx, nexty, - (color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)), - (color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)), - (color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)), - (color3 == 7 ? csColor : (color3 | FOREGROUND_BIT))); - } - //color stack mode - else - { - UINT8 isGrom; - UINT16 memoryLocation, fgcolor, bgcolor; - UINT8* memory; - - //advance the color pointer, if necessary - if (nextCard & STIC_CSTM_ADV) - csPtr = (csPtr+1) & (STIC_CSRS - 1); - - fgcolor = ((nextCard & STIC_CSTM_FG3) >> 9) | - (nextCard & (STIC_CSTM_FG20)) | FOREGROUND_BIT; - bgcolor = m_stic_registers[STIC_CSR + csPtr] & STIC_CSR_BG; - - isGrom = !(nextCard & STIC_CSTM_SEL); - if (isGrom) - { - memoryLocation = nextCard & STIC_CSTM_C; - memory = m_grom; - for (int j = 0; j < STIC_CARD_HEIGHT; j++) - render_line(bitmap, memory[memoryLocation + j], - nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); - } - else - { - memoryLocation = nextCard & STIC_CSTM_C50; - memory = m_gram; - for (int j = 0; j < STIC_CARD_HEIGHT; j++) - render_line(bitmap, memory[memoryLocation + j], - nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); - } - } - } - } -} - -void stic_device::render_fg_bg_mode(bitmap_ind16 &bitmap) -{ - INT16 w, h, nextx, nexty; - UINT8 isGrom, fgcolor, bgcolor; - UINT16 nextCard, memoryLocation; - UINT8* memory; - - for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; - h < STIC_BACKTAB_HEIGHT; - h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) - { - for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; - w < STIC_BACKTAB_WIDTH; - w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) - { - nextCard = m_backtab_buffer[h][w]; - fgcolor = (nextCard & STIC_FBM_FG) | FOREGROUND_BIT; - bgcolor = ((nextCard & STIC_FBM_BG2) >> 11) | - ((nextCard & STIC_FBM_BG310) >> 9); - - isGrom = !(nextCard & STIC_FBM_SEL); - if (isGrom) - { - memoryLocation = nextCard & STIC_FBM_C; - memory = m_grom; - for (int j = 0; j < STIC_CARD_HEIGHT; j++) - render_line(bitmap, memory[memoryLocation + j], - nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); - } - else - { - memoryLocation = nextCard & STIC_FBM_C; - memory = m_gram; - for (int j = 0; j < STIC_CARD_HEIGHT; j++) - render_line(bitmap, memory[memoryLocation + j], - nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); - } - } - } -} - -void stic_device::copy_sprites_to_background(bitmap_ind16 &bitmap) -{ - UINT8 width, currentPixel; - UINT8 borderCollision, foregroundCollision; - UINT8 spritePixelHeight, x, y; - INT16 leftX, nextY; - INT16 leftBorder, rightBorder, topBorder, bottomBorder; - INT32 nextX; - - for (int i = STIC_MOBS - 1; i >= 0; i--) - { - intv_sprite_type *s = &m_sprite[i]; - if (s->xpos == 0 || (!s->coll && !s->visible)) - continue; - - borderCollision = FALSE; - foregroundCollision = FALSE; - - spritePixelHeight = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; - width = (s->doublex ? 2 : 1) * STIC_CARD_WIDTH; - - leftX = (s->xpos - STIC_CARD_WIDTH + STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; - nextY = (s->ypos - STIC_CARD_HEIGHT + STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; - - leftBorder = (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : 0)) * STIC_X_SCALE; - rightBorder = (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 - 1) * STIC_X_SCALE; - topBorder = (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : 0)) * STIC_Y_SCALE; - bottomBorder = (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE - 1; - - for (y = 0; y < spritePixelHeight; y++) - { - for (x = 0; x < width; x++) - { - //if this sprite pixel is not on, then don't paint it - if (!m_sprite_buffers[i][x][y]) - continue; - - nextX = leftX + x; - //if the next pixel location is on the border, then we - //have a border collision and we can ignore painting it - if ((nextX < leftBorder) || (nextX > rightBorder) || - (nextY < topBorder) || (nextY > bottomBorder)) - { - borderCollision = TRUE; - continue; - } - - currentPixel = intv_get_pixel(bitmap, nextX, nextY); - - //check for foreground collision - if (currentPixel & FOREGROUND_BIT) - { - foregroundCollision = TRUE; - if (s->behind_foreground) - continue; - } - - if (s->visible) - { - intv_set_pixel(bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT)); - } - } - nextY++; - } - - //update the collision bits - if (s->coll) - { - if (foregroundCollision) - s->collision |= STIC_MCR_BKGD; - if (borderCollision) - s->collision |= STIC_MCR_BRDR; - } - } -} - -void stic_device::render_background(bitmap_ind16 &bitmap) -{ - if (m_color_stack_mode) - render_color_stack_mode(bitmap); - else - render_fg_bg_mode(bitmap); -} - -#ifdef UNUSED_CODE -void stic_device::draw_background(bitmap_ind16 &bitmap, int transparency) -{ - // First, draw the background - int offs = 0; - int value = 0; - int row,col; - int fgcolor,bgcolor = 0; - int code; - - int colora, colorb, colorc, colord; - - int n_bit; - int p_bit; - int g_bit; - - int j; - - int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay; - int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay; - - if (m_color_stack_mode == 1) - { - m_color_stack_offset = 0; - for(row = 0; row < STIC_BACKTAB_HEIGHT; row++) - { - for(col = 0; col < STIC_BACKTAB_WIDTH; col++) - { - value = m_ram16[offs]; - - n_bit = value & STIC_CSTM_ADV; - p_bit = value & STIC_CSTM_FG3; - g_bit = value & STIC_CSTM_SEL; - - if (p_bit && (!g_bit)) // colored squares mode - { - colora = value & STIC_CSQM_A; - colorb = (value & STIC_CSQM_B) >> 3; - colorc = (value & STIC_CSQM_C) >> 6; - colord = ((n_bit & STIC_CSQM_D2) >> 11) + ((value & STIC_CSQM_D10) >> 9); - // color 7 if the top of the color stack in this mode - if (colora == 7) colora = m_stic_registers[STIC_CSR + STIC_CSR3]; - if (colorb == 7) colorb = m_stic_registers[STIC_CSR + STIC_CSR3]; - if (colorc == 7) colorc = m_stic_registers[STIC_CSR + STIC_CSR3]; - if (colord == 7) colord = m_stic_registers[STIC_CSR + STIC_CSR3]; - intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora); - intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb); - intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc); - intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colord); - } - else // normal color stack mode - { - if (n_bit) // next color - { - m_color_stack_offset += 1; - m_color_stack_offset &= (STIC_CSRS - 1); - } - - if (p_bit) // pastel color set - fgcolor = (value & STIC_CSTM_FG20) + 8; - else - fgcolor = value & STIC_CSTM_FG20; - - bgcolor = m_stic_registers[STIC_CSR + m_color_stack_offset]; - code = (value & STIC_CSTM_C)>>3; - - if (g_bit) // read from gram - { - code &= (STIC_CSTM_C50 >> 3); // keep from going outside the array - //if (m_gramdirtybytes[code] == 1) - { - decodechar(m_gfxdecode->gfx(1), - code, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); - m_gramdirtybytes[code] = 0; - } - // Draw GRAM char - drawgfx(bitmap,m_gfxdecode->gfx(1), - code, - bgcolor*16+fgcolor, - 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, - 0,transparency,bgcolor); - - for(j=0;j<8;j++) - { - //intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 1); - } - - } - else // read from grom - { - drawgfx(bitmap,m_gfxdecode->gfx(0), - code, - bgcolor*16+fgcolor, - 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, - 0,transparency,bgcolor); - - for(j=0;j<8;j++) - { - //intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 2); - } - } - } - offs++; - } // next col - } // next row - } - else - { - // fg/bg mode goes here - for(row = 0; row < STIC_BACKTAB_HEIGHT; row++) - { - for(col = 0; col < STIC_BACKTAB_WIDTH; col++) - { - value = m_ram16[offs]; - fgcolor = value & STIC_FBM_FG; - bgcolor = ((value & STIC_FBM_BG2) >> 11) + ((value & STIC_FBM_BG310) >> 9); - code = (value & STIC_FBM_C) >> 3; - - if (value & STIC_FBM_SEL) // read for GRAM - { - //if (m_gramdirtybytes[code] == 1) - { - decodechar(m_gfxdecode->gfx(1), - code, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); - m_gramdirtybytes[code] = 0; - } - // Draw GRAM char - drawgfx(bitmap,m_gfxdecode->gfx(1), - code, - bgcolor*16+fgcolor, - 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, - 0,transparency,bgcolor); - } - else // read from GROM - { - drawgfx(bitmap,m_gfxdecode->gfx(0), - code, - bgcolor*16+fgcolor, - 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, - 0,transparency,bgcolor); - } - offs++; - } // next col - } // next row - } -} -#endif - -/* TBD: need to handle sprites behind foreground? */ -#ifdef UNUSED_FUNCTION -void stic_device::draw_sprites(bitmap_ind16 &bitmap, int behind_foreground) -{ - int code; - int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH; - int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT; - - for (int i = STIC_MOBS - 1; i >= 0; --i) - { - intv_sprite_type *s = &m_sprite[i]; - if (s->visible && (s->behind_foreground == behind_foreground)) - { - code = s->card; - if (!s->grom) - { - code %= 64; // keep from going outside the array - if (s->yres == 1) - { - //if (m_gramdirtybytes[code] == 1) - { - decodechar(m_gfxdecode->gfx(1), - code, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); - m_gramdirtybytes[code] = 0; - } - // Draw GRAM char - m_gfxdecode->gfx(1)->zoom_transpen(bitmap,&machine().screen[0].visarea, - code, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, - 0x8000 * s->xsize, 0x8000 * s->ysize,0); - } - else - { - //if ((m_gramdirtybytes[code] == 1) || (m_gramdirtybytes[code+1] == 1)) - { - decodechar(m_gfxdecode->gfx(1), - code, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); - decodechar(m_gfxdecode->gfx(1), - code+1, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); - m_gramdirtybytes[code] = 0; - m_gramdirtybytes[code+1] = 0; - } - // Draw GRAM char - m_gfxdecode->gfx(1)->zoom_transpen(bitmap,&machine().screen[0].visarea, - code, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, - 0x8000*s->xsize, 0x8000*s->ysize,0); - m_gfxdecode->gfx(1)->zoom_transpen(bitmap,&machine().screen[0].visarea, - code+1, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, - 0x8000*s->xsize, 0x8000*s->ysize,0); - } - } - else - { - if (s->yres == 1) - { - // Draw GROM char - m_gfxdecode->gfx(0)->zoom_transpen(bitmap,&machine().screen[0].visarea, - code, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, - 0x8000*s->xsize, 0x8000*s->ysize,0); - } - else - { - m_gfxdecode->gfx(0)->zoom_transpen(bitmap,&machine().screen[0].visarea, - code, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, - 0x8000*s->xsize, 0x8000*s->ysize,0); - m_gfxdecode->gfx(0)->zoom_transpen(bitmap,&machine().screen[0].visarea, - code+1, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, - 0x8000*s->xsize, 0x8000*s->ysize,0); - } - } - } - } -} -#endif - -void stic_device::draw_borders(bitmap_ind16 &bitmap) -{ - intv_plot_box(bitmap, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : m_col_delay)) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color); - intv_plot_box(bitmap, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1) * STIC_X_SCALE, 0, STIC_OVERSCAN_RIGHT_WIDTH, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color); - - intv_plot_box(bitmap, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : m_row_delay)) * STIC_Y_SCALE, m_border_color); - intv_plot_box(bitmap, 0, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT * STIC_Y_SCALE, m_border_color); -} - -void stic_device::screenrefresh() -{ - if (m_stic_handshake != 0) - { - m_stic_handshake = 0; - // Render the background - render_background(m_bitmap); - // Render the sprites into their buffers - render_sprites(); - for (int i = 0; i < STIC_MOBS; i++) - m_sprite[i].collision = 0; - // Copy the sprites to the background - copy_sprites_to_background(m_bitmap); - determine_sprite_collisions(); - for (int i = 0; i < STIC_MOBS; i++) - m_stic_registers[STIC_MCR + i] |= m_sprite[i].collision; - /* draw the screen borders if enabled */ - draw_borders(m_bitmap); - } - else - { - /* STIC disabled, just fill with border color */ - m_bitmap.fill(SET_COLOR(m_border_color)); - } -} - - - -READ16_MEMBER( stic_device::read ) -{ - //logerror("%x = stic_r(%x)\n",0,offset); - switch (offset) - { - case STIC_MXR + STIC_MOB0: - case STIC_MXR + STIC_MOB1: - case STIC_MXR + STIC_MOB2: - case STIC_MXR + STIC_MOB3: - case STIC_MXR + STIC_MOB4: - case STIC_MXR + STIC_MOB5: - case STIC_MXR + STIC_MOB6: - case STIC_MXR + STIC_MOB7: - return 0x3800 | (m_stic_registers[offset] & 0x07FF); - case STIC_MYR + STIC_MOB0: - case STIC_MYR + STIC_MOB1: - case STIC_MYR + STIC_MOB2: - case STIC_MYR + STIC_MOB3: - case STIC_MYR + STIC_MOB4: - case STIC_MYR + STIC_MOB5: - case STIC_MYR + STIC_MOB6: - case STIC_MYR + STIC_MOB7: - return 0x3000 | (m_stic_registers[offset] & 0x0FFF); - case STIC_MAR + STIC_MOB0: - case STIC_MAR + STIC_MOB1: - case STIC_MAR + STIC_MOB2: - case STIC_MAR + STIC_MOB3: - case STIC_MAR + STIC_MOB4: - case STIC_MAR + STIC_MOB5: - case STIC_MAR + STIC_MOB6: - case STIC_MAR + STIC_MOB7: - return m_stic_registers[offset] & 0x3FFF; - case STIC_MCR + STIC_MOB0: - case STIC_MCR + STIC_MOB1: - case STIC_MCR + STIC_MOB2: - case STIC_MCR + STIC_MOB3: - case STIC_MCR + STIC_MOB4: - case STIC_MCR + STIC_MOB5: - case STIC_MCR + STIC_MOB6: - case STIC_MCR + STIC_MOB7: - return 0x3C00 | (m_stic_registers[offset] & 0x03FF); - case STIC_GMR: - m_color_stack_mode = 1; - //logerror("Setting color stack mode\n"); - /*** fall through ***/ - case STIC_DER: - return 0x3FFF; - case STIC_CSR + STIC_CSR0: - case STIC_CSR + STIC_CSR1: - case STIC_CSR + STIC_CSR2: - case STIC_CSR + STIC_CSR3: - case STIC_BCR: - return 0x3FF0 | (m_stic_registers[offset] & 0x000F); - case STIC_HDR: - case STIC_VDR: - return 0x3FF8 | (m_stic_registers[offset] & 0x0007); - case STIC_CBR: - return 0x3FFC | (m_stic_registers[offset] & 0x0003); - default: - //logerror("unmapped read from STIC register %02X\n", offset); - return 0x3FFF; - } -} - -WRITE16_MEMBER( stic_device::write ) -{ - intv_sprite_type *s; - - //logerror("stic_w(%x) = %x\n",offset,data); - switch (offset) - { - // X Positions - case STIC_MXR + STIC_MOB0: - case STIC_MXR + STIC_MOB1: - case STIC_MXR + STIC_MOB2: - case STIC_MXR + STIC_MOB3: - case STIC_MXR + STIC_MOB4: - case STIC_MXR + STIC_MOB5: - case STIC_MXR + STIC_MOB6: - case STIC_MXR + STIC_MOB7: - s = &m_sprite[offset & (STIC_MOBS - 1)]; - s->doublex = !!(data & STIC_MXR_XSIZE); - s->visible = !!(data & STIC_MXR_VIS); - s->coll = !!(data & STIC_MXR_COL); - s->xpos = (data & STIC_MXR_X); - break; - // Y Positions - case STIC_MYR + STIC_MOB0: - case STIC_MYR + STIC_MOB1: - case STIC_MYR + STIC_MOB2: - case STIC_MYR + STIC_MOB3: - case STIC_MYR + STIC_MOB4: - case STIC_MYR + STIC_MOB5: - case STIC_MYR + STIC_MOB6: - case STIC_MYR + STIC_MOB7: - s = &m_sprite[offset & (STIC_MOBS - 1)]; - s->yflip = !!(data & STIC_MYR_YFLIP); - s->xflip = !!(data & STIC_MYR_XFLIP); - s->quady = !!(data & STIC_MYR_YSIZE); - s->doubley = !!(data & STIC_MYR_YFULL); - s->doubleyres = !!(data & STIC_MYR_YRES); - s->ypos = (data & STIC_MYR_Y); - break; - // Attributes - case STIC_MAR + STIC_MOB0: - case STIC_MAR + STIC_MOB1: - case STIC_MAR + STIC_MOB2: - case STIC_MAR + STIC_MOB3: - case STIC_MAR + STIC_MOB4: - case STIC_MAR + STIC_MOB5: - case STIC_MAR + STIC_MOB6: - case STIC_MAR + STIC_MOB7: - s = &m_sprite[offset & (STIC_MOBS - 1)]; - s->behind_foreground = !!(data & STIC_MAR_PRI); - s->grom = !(data & STIC_MAR_SEL); - s->card = ((data & STIC_MAR_C) >> 3); - s->color = ((data & STIC_MAR_FG3) >> 9) | (data & STIC_MAR_FG20); - break; - // Collision Detection - TBD - case STIC_MCR + STIC_MOB0: - case STIC_MCR + STIC_MOB1: - case STIC_MCR + STIC_MOB2: - case STIC_MCR + STIC_MOB3: - case STIC_MCR + STIC_MOB4: - case STIC_MCR + STIC_MOB5: - case STIC_MCR + STIC_MOB6: - case STIC_MCR + STIC_MOB7: - // a MOB's own collision bit is *always* zero, even if a - // one is poked into it - data &= ~(1 << (offset & (STIC_MOBS - 1))); - break; - // Display enable - case STIC_DER: - //logerror("***Writing a %x to the STIC handshake\n",data); - m_stic_handshake = 1; - break; - // Graphics Mode - case STIC_GMR: - m_color_stack_mode = 0; - break; - // Color Stack - case STIC_CSR + STIC_CSR0: - case STIC_CSR + STIC_CSR1: - case STIC_CSR + STIC_CSR2: - case STIC_CSR + STIC_CSR3: - logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, space.device().safe_pc()); - break; - // Border Color - case STIC_BCR: - //logerror("***Writing a %x to the border color\n",data); - m_border_color = data & STIC_BCR_BC; - break; - // Framing - case STIC_HDR: - m_col_delay = data & STIC_HDR_DEL; - break; - case STIC_VDR: - m_row_delay = data & STIC_VDR_DEL; - break; - case STIC_CBR: - m_left_edge_inhibit = (data & STIC_CBR_COL); - m_top_edge_inhibit = (data & STIC_CBR_ROW) >> 1; - break; - default: - //logerror("unmapped write to STIC register %02X: %04X\n", offset, data); - break; - } - - if (offset < ARRAY_LENGTH(m_stic_registers)) - m_stic_registers[offset] = data; -} - - -READ16_MEMBER( stic_device::gram_read ) -{ - return m_gram[offset]; -} - -WRITE16_MEMBER( stic_device::gram_write ) -{ - data &= 0xff; - m_gram[offset] = data; - m_gramdirtybytes[offset] = 1; - m_gramdirty = 1; -} - - - -UINT32 stic_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} diff --git a/src/mess/video/stic.h b/src/mess/video/stic.h deleted file mode 100644 index 2865bfaef39..00000000000 --- a/src/mess/video/stic.h +++ /dev/null @@ -1,559 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nathan Woods,Frank Palazzolo -/***************************************************************************** - * - * includes/stic.h - * - ****************************************************************************/ - -#ifndef STIC_H_ -#define STIC_H_ - -// GROM/GRAM cards are 8x8 -#define STIC_CARD_WIDTH 8 -#define STIC_CARD_HEIGHT 8 - -// Intellivision resolution is 20x12 BACKTAB CARDs, minus the rightmost column, -// for an effective resolution of (19 * 8 + 1 * 7) x (12 * 8) == 159x96. -// -// MOB scanline height can be half of a card scanline height, so y-coordinates -// are scaled by 2. -#define STIC_X_SCALE 1 -#define STIC_Y_SCALE 2 - -// the Intellivision emulation scales to match the output format at the last -// step. The Intellivision keyboard component appears to be 320x96, but can -// also run Intellivision carts, so x-coordinates are conditionally scaled -// by 2. -#define INTV_X_SCALE 1 -#define INTV_Y_SCALE 1 -#define INTVKBD_X_SCALE 2 -#define INTVKBD_Y_SCALE INTV_Y_SCALE - -// overscan sizes in intv pixels -// these values are approximate. -#define STIC_OVERSCAN_LEFT_WIDTH 13 -#define STIC_OVERSCAN_RIGHT_WIDTH 17 -#define STIC_OVERSCAN_TOP_HEIGHT 12 -#define STIC_OVERSCAN_BOTTOM_HEIGHT 12 - -//Timing constants based on Joe Zbiciak's documentation -#define STIC_CYCLES_PER_SCANLINE 57 -#define STIC_ROW_BUSRQ 110 // CPU paused during backtab row buffering -#define STIC_FRAME_BUSRQ 42 // CPU paused just after end of vblank and before first row fetch (approximate) -#define STIC_VBLANK_END 3790 -#define STIC_FIRST_FETCH 3933 - -/*** STIC registers *********************************************************/ - -// number of STIC registers -#define STIC_REGISTERS 0x33 - -// STIC MOBs (Moveable OBjects) -enum -{ - STIC_MOB0, - STIC_MOB1, - STIC_MOB2, - STIC_MOB3, - STIC_MOB4, - STIC_MOB5, - STIC_MOB6, - STIC_MOB7, - - STIC_MOBS -}; - -// STIC Color Stack -enum -{ - STIC_CSR0, - STIC_CSR1, - STIC_CSR2, - STIC_CSR3, - - STIC_CSRS -}; - -/**************************************************************************** - * * - * MXR 0000[..0007] MOB X REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-----+---+---+--+--+--+--+--+--+--+--+ * - * | | | | | |XSIZE|VIS|COL|X7|X6|X5|X4|X3|X2|X1|X0| * - * +-+-+-+-+-+-----+---+---+--+--+--+--+--+--+--+--+ * - * * - * Xn x-position [0..255] * - * COL collision detection [1=enable] * - * VIS visibility [1=visible] * - * XSIZE double width [1=double] * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. If X=0, the sprite is not visible and does not register collisions. * - * 2. The horizontal handle is 8 pixels from the left of the sprite, * - * regardless of width. * - * * - ****************************************************************************/ -#define STIC_MXR 0x0000 - -#define STIC_MXR_XSIZE 0x0400 -#define STIC_MXR_VIS 0x0200 -#define STIC_MXR_COL 0x0100 -#define STIC_MXR_X 0x00FF - -/**************************************************************************** - * * - * MYR 0008[..000F] MOB Y REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-----+-----+-----+-----+----+--+--+--+--+--+--+--+ * - * | | | | |YFLIP|XFLIP|YSIZE|YFULL|YRES|Y6|Y5|Y4|Y3|Y2|Y1|Y0| * - * +-+-+-+-+-----+-----+-----+-----+----+--+--+--+--+--+--+--+ * - * * - * Yn y-position [0..127] * - * YRES y-resolution [0=8 scanlines,1=16 scanlines] * - * YFULL double scanline height [1=double] * - * YSIZE quadruple scanline height [1=quadruple] * - * XFLIP horizontally flip image [1=flip] * - * YFLIP vertically flip image [1=flip] * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. A sprite with YRES=1 will display two cards. * - * 2. A sprite with YFULL=0 and YSIZE=0 will have scanlines half the * - * height of a background card. * - * 3, The minimum size of a sprite is 8x8 (XSIZE=YRES=YSIZE=YFULL=0). * - * 4. The maximum size of a sprite is 16x128 (XSIZE=YRES=YSIZE=YFULL=1). * - * 5. The Y-position is measured in double height scanlines. * - * 6. The vertical handle is 8 double height scanlines from the top of the * - * sprite, regardless of height. * - * * - ****************************************************************************/ -#define STIC_MYR 0x0008 - -#define STIC_MYR_YFLIP 0x0800 -#define STIC_MYR_XFLIP 0x0400 -#define STIC_MYR_YSIZE 0x0200 -#define STIC_MYR_YFULL 0x0100 -#define STIC_MYR_YRES 0x0080 -#define STIC_MYR_Y 0x007F - -/**************************************************************************** - * * - * SAR 0010[..0017] MOB ATTRIBUTE REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+---+---+---+-+-+--+--+--+--+--+--+---+---+---+ * - * | | |PRI|FG3|SEL| | |C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * - * +-+-+---+---+---+-+-+--+--+--+--+--+--+---+---+---+ * - * * - * FGn foreground color [0..15] * - * Cn card # [0..63] * - * SEL card memory select [0=GROM, 1=GRAM] * - * PRI sprite priority [1=behind set background bit] * - * * - ****************************************************************************/ -#define STIC_MAR 0x0010 - -#define STIC_MAR_PRI 0x2000 -#define STIC_MAR_FG3 0x1000 -#define STIC_MAR_SEL 0x0800 -#define STIC_MAR_C 0x07F8 -#define STIC_MAR_FG20 0x0007 - -/**************************************************************************** - * * - * SCR 0018[..001F] MOB COLLISION REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-+----+----+----+----+----+----+----+----+----+----+ * - * | | | | | | |BRDR|BKGD|SPR7|SPR6|SPR5|SPR4|SPR3|SPR2|SPR1|SPR0| * - * +-+-+-+-+-+-+----+----+----+----+----+----+----+----+----+----+ * - * * - * SPRn 1=collision with sprite #n * - * BKGD 1=collsion with set background bit * - * BRDR 1=collision with screen border * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. All collisions are latched. Successive reads read from the latch. * - * A write will reset the latch. * - * 2. Sprites with VIS=0 register collisions. * - * 3. Sprites with X=0 do not register collisions. * - * 4. Two overlapping sprites with different priorities, one completely * - * hidden behind the background, still register a collision. * - * * - ****************************************************************************/ -#define STIC_MCR 0x0018 - -#define STIC_MCR_BRDR 0x0200 -#define STIC_MCR_BKGD 0x0100 -#define STIC_MCR_SPR7 0x0080 -#define STIC_MCR_SPR6 0x0040 -#define STIC_MCR_SPR5 0x0020 -#define STIC_MCR_SPR4 0x0010 -#define STIC_MCR_SPR3 0x0008 -#define STIC_MCR_SPR2 0x0004 -#define STIC_MCR_SPR1 0x0002 -#define STIC_MCR_SPR0 0x0001 - -/**************************************************************************** - * * - * DER 0021 DISPLAY ENABLE REGISTER W * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * | | | | | | | | | | | | | | | | | * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. Any write during VBLANK enables STIC output. * - * * - ****************************************************************************/ -#define STIC_DER 0x0020 - -/**************************************************************************** - * * - * GMR 0021 GRAPHICS MODE REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * | | | | | | | | | | | | | | | | | * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. Any write during VBLANK enables FOREGROUND/BACKGROUND mode. * - * 2. Any read during VBLANK enables COLOR STACK/COLORED SQUARES mode. * - * * - ****************************************************************************/ -#define STIC_GMR 0x0021 - -/**************************************************************************** - * * - * CSR 0028 COLOR STACK REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * - * | | | | | | | | | | | | |BG3|BG2|BG1|BG0| * - * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * - * * - * BGn background color [0..15] * - * * - ****************************************************************************/ -#define STIC_CSR 0x0028 - -#define STIC_CSR_BG 0x000F - -/**************************************************************************** - * * - * BCR 002C BORDER COLOR REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * - * | | | | | | | | | | | | |BC3|BC2|BC1|BC0| * - * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * - * * - * BCn border color [0..15] * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. Affects overscan, and column and row blockouts. * - * * - ****************************************************************************/ -#define STIC_BCR 0x002C - -#define STIC_BCR_BC 0x000F - -/**************************************************************************** - * * - * HDR 0030 HORIZONTAL DELAY REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * - * | | | | | | | | | | | | | |DEL2|DEL1|DEL0| * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * - * * - * DELn horizontal delay [0..7] * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. Affects both BACKTAB and MOBs. * - * * - ****************************************************************************/ -#define STIC_HDR 0x0030 - -#define STIC_HDR_DEL 0x0007 - -/**************************************************************************** - * * - * STIC_VDR 0030 VERTICAL DELAY REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * - * | | | | | | | | | | | | | |DEL2|DEL1|DEL0| * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * - * * - * DELn vertical delay [0..7] * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. Affects both BACKTAB and MOBs. * - * * - ****************************************************************************/ -#define STIC_VDR 0x0031 - -#define STIC_VDR_DEL 0x0007 - -/**************************************************************************** - * * - * STIC_CBR 0032 CARD BLOCKOUT REGISTER RW * - * * - * (MSB) (LSB) * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+---+ * - * | | | | | | | | | | | | | | |ROW|COL| * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+---+ * - * * - * COL blockout first card column [1=blockout] * - * ROW blockout first card row [1=blockout] * - * * - **************************************************************************** - * * - * NOTES * - * * - * 1. Generally used in conjunction with HDR and VDR registers, to achieve * - * smooth scrolling. * - * * - ****************************************************************************/ -#define STIC_CBR 0x0032 - -#define STIC_CBR_ROW 0x0002 -#define STIC_CBR_COL 0x0001 - -/*** BACKTAB ****************************************************************/ - -// BACKTAB is made up of 20x12 cards -// (the first 19 columns are 8x8, the 20th column is 7x8) -#define STIC_BACKTAB_WIDTH 20 -#define STIC_BACKTAB_HEIGHT 12 - -/**************************************************************************** - * * - * FOREGROUND/BACKGROUND MODE * - * * - * (MSB) (LSB) * - * +-+-+---+---+---+---+---+--+--+--+--+--+--+---+---+---+ * - * | | |BG2|BG3|SEL|BG1|BG0|C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * - * +-+-+---+---+---+---+---+--+--+--+--+--+--+---+---+---+ * - * * - * FGn foreground color [0..7] * - * Cn card # [0..63] * - * SEL card memory select [0=GROM, 1=GRAM] * - * BGn background color [0..15] * - * * - ****************************************************************************/ -#define STIC_FBM_BG2 0x2000 -#define STIC_FBM_BG310 0x1600 -#define STIC_FBM_SEL 0x0800 -#define STIC_FBM_C 0x01F8 -#define STIC_FBM_FG 0x0007 - -/**************************************************************************** - * * - * COLOR STACK MODE * - * * - * (MSB) (LSB) * - * +-+-+---+---+---+--+--+--+--+--+--+--+--+---+---+---+ * - * | | |ADV|FG3|SEL|C7|C6|C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * - * +-+-+---+---+---+--+--+--+--+--+--+--+--+---+---+---+ * - * * - * FGn foreground color [0..15] * - * Cn card # [GROM=0..212, GRAM=0..63] * - * SEL card memory select [0=GROM, 1=GRAM] * - * ADV advance color stack index [1=advance] * - * * - **************************************************************************** - * * - * NOTES: * - * * - * 1. When FG3=1 and SEL=0, COLORED SQUARES MODE is enabled. * - * 2. When SEL=1, C7 and C6 can be used as user-defined flags. * - * * - ****************************************************************************/ -#define STIC_CSTM_ADV 0x2000 -#define STIC_CSTM_FG3 0x1000 -#define STIC_CSTM_SEL 0x0800 -#define STIC_CSTM_C7 0x0400 -#define STIC_CSTM_C6 0x0200 -#define STIC_CSTM_C50 0x01F8 -#define STIC_CSTM_FG20 0x0007 - -#define STIC_CSTM_C (STIC_CSTM_C7|STIC_CSTM_C6|STIC_CSTM_C50) - -/**************************************************************************** - * * - * COLORED SQUARES MODE * - * * - * (MSB) (LSB) * - * +-+-+--+-+-+--+--+--+--+--+--+--+--+--+--+--+ * - * | | |D2|1|0|D1|D0|C2|C1|C0|B2|B1|B0|A2|A1|A0| * - * +-+-+--+-+-+--+--+--+--+--+--+--+--+--+--+--+ * - * * - * An color a [0..7] * - * Bn color b [0..7] * - * Cn color c [0..7] * - * Dn color d [0..7] * - * * - **************************************************************************** - * * - * NOTES: * - * * - * 1. Each color corresponds to one of the following 4 x 4 squares: * - * * - * +---+---+ * - * | a | b | * - * +---+---+ * - * | c | d | * - * +---+---+ * - * * - * 2. When color 7 is specified, the color is taken from the color stack. * - * * - ****************************************************************************/ -#define STIC_CSQM_D2 0x2000 -#define STIC_CSQM_D10 0x0600 -#define STIC_CSQM_C 0x01C0 -#define STIC_CSQM_B 0x0038 -#define STIC_CSQM_A 0x0007 - -#define STIC_CSQM_WIDTH (STIC_CARD_WIDTH / 2) -#define STIC_CSQM_HEIGHT (STIC_CARD_HEIGHT / 2) - - - -struct intv_sprite_type -{ - int visible; - int xpos; - int ypos; - int coll; - int collision; - int doublex; - int doubley; - int quady; - int xflip; - int yflip; - int behind_foreground; - int grom; - int card; - int color; - int doubleyres; - int dirty; -}; - - -// ======================> stic_device - -class stic_device : public device_t -{ -public: - // construction/destruction - stic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ~stic_device(); - - DECLARE_READ16_MEMBER(read); - DECLARE_READ16_MEMBER(gram_read); - DECLARE_READ16_MEMBER(grom_read) { if (offset > 0x800) printf("help! %X\n", offset); return (0xff00 | m_grom[offset]); } - DECLARE_WRITE16_MEMBER(write); - DECLARE_WRITE16_MEMBER(gram_write); - - void write_to_btb(int h, int w, UINT16 data) { m_backtab_buffer[h][w] = data; } - int read_row_delay() { return m_row_delay; } - int read_stic_handshake() { return m_stic_handshake; } - void set_x_scale(int val) { m_x_scale = val; } - void set_y_scale(int val) { m_y_scale = val; } - - // device-level overrides - virtual void device_start(); - virtual const rom_entry *device_rom_region() const; - virtual void device_reset(); - - void screenrefresh(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - -private: - - required_region_ptr m_grom; - - void intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); - UINT32 intv_get_pixel(bitmap_ind16 &bitmap, int x, int y); - void intv_plot_box(bitmap_ind16 &bm, int x, int y, int w, int h, int color); - int sprites_collide(int spriteNum1, int spriteNum2); - void determine_sprite_collisions(); - void render_sprites(); - void render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor); - void render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3); - void render_color_stack_mode(bitmap_ind16 &bitmap); - void render_fg_bg_mode(bitmap_ind16 &bitmap); - void copy_sprites_to_background(bitmap_ind16 &bitmap); - void render_background(bitmap_ind16 &bitmap); - void draw_borders(bitmap_ind16 &bitmap); - -#ifdef UNUSED_CODE - void draw_background(bitmap_ind16 &bitmap, int transparency); - void draw_sprites(bitmap_ind16 &bitmap, int behind_foreground); -#endif - - bitmap_ind16 m_bitmap; - - intv_sprite_type m_sprite[STIC_MOBS]; - UINT8 m_sprite_buffers[STIC_MOBS][STIC_CARD_WIDTH * 2][STIC_CARD_HEIGHT * 4 * 2 * 2]; - UINT16 m_backtab_buffer[STIC_BACKTAB_HEIGHT][STIC_BACKTAB_WIDTH]; - int m_color_stack_mode; - int m_stic_registers[STIC_REGISTERS]; - int m_color_stack_offset; - int m_stic_handshake; - int m_border_color; - int m_col_delay; - int m_row_delay; - int m_left_edge_inhibit; - int m_top_edge_inhibit; - int m_x_scale; - int m_y_scale; - - UINT8 m_gramdirty; - UINT8 m_gram[512]; - UINT8 m_gramdirtybytes[512]; -}; - -// device type definition -extern const device_type STIC; - - -/*************************************************************************** - DEVICE CONFIGURATION MACROS - ***************************************************************************/ - -#define MCFG_STIC_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, STIC, 0) - - -#endif /* STIC_H_ */ diff --git a/src/mess/video/super80.c b/src/mess/video/super80.c deleted file mode 100644 index 5adb90c170c..00000000000 --- a/src/mess/video/super80.c +++ /dev/null @@ -1,426 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/* Super80.c written by Robbbert, 2005-2010. See the driver source for documentation. */ - -/* Notes on using MAME MC6845 Device (MMD). - 1. Speed of MMD is about 20% slower than pre-MMD coding - 2. Undocumented cursor start and end-lines is not supported by MMD, so we do it here. */ - - -#include "includes/super80.h" - - - -/**************************** PALETTES for super80m and super80v ******************************************/ - -PALETTE_INIT_MEMBER( super80_state, super80m ) -{ - // RGB - //palette_set_colors_rgb(super80_rgb_palette); - m_palette->set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); /* 0 Black */ - m_palette->set_pen_color(1, rgb_t(0x00, 0x00, 0x00)); /* 1 Black */ - m_palette->set_pen_color(2, rgb_t(0x00, 0x00, 0x7f)); /* 2 Blue */ - m_palette->set_pen_color(3, rgb_t(0x00, 0x00, 0xff)); /* 3 Light Blue */ - m_palette->set_pen_color(4, rgb_t(0x00, 0x7f, 0x00)); /* 4 Green */ - m_palette->set_pen_color(5, rgb_t(0x00, 0xff, 0x00)); /* 5 Bright Green */ - m_palette->set_pen_color(6, rgb_t(0x00, 0x7f, 0x7f)); /* 6 Cyan */ - m_palette->set_pen_color(7, rgb_t(0x00, 0xff, 0xff)); /* 7 Turquoise */ - m_palette->set_pen_color(8, rgb_t(0x7f, 0x00, 0x00)); /* 8 Dark Red */ - m_palette->set_pen_color(9, rgb_t(0xff, 0x00, 0x00)); /* 9 Red */ - m_palette->set_pen_color(10, rgb_t(0x7f, 0x00, 0x7f)); /* 10 Purple */ - m_palette->set_pen_color(11, rgb_t(0xff, 0x00, 0xff)); /* 11 Magenta */ - m_palette->set_pen_color(12, rgb_t(0x7f, 0x7f, 0x00)); /* 12 Lime */ - m_palette->set_pen_color(13, rgb_t(0xff, 0xff, 0x00)); /* 13 Yellow */ - m_palette->set_pen_color(14, rgb_t(0xbf, 0xbf, 0xbf)); /* 14 Off White */ - m_palette->set_pen_color(15, rgb_t(0xff, 0xff, 0xff)); /* 15 White */ - // Composite - m_palette->set_pen_color(16, rgb_t(0x00, 0x00, 0x00)); /* 0 Black */ - m_palette->set_pen_color(17, rgb_t(0x80, 0x80, 0x80)); /* 1 Grey */ - m_palette->set_pen_color(18, rgb_t(0x00, 0x00, 0xff)); /* 2 Blue */ - m_palette->set_pen_color(19, rgb_t(0xff, 0xff, 0x80)); /* 3 Light Yellow */ - m_palette->set_pen_color(20, rgb_t(0x00, 0xff, 0x00)); /* 4 Green */ - m_palette->set_pen_color(21, rgb_t(0xff, 0x80, 0xff)); /* 5 Light Magenta */ - m_palette->set_pen_color(22, rgb_t(0x00, 0xff, 0xff)); /* 6 Cyan */ - m_palette->set_pen_color(23, rgb_t(0xff, 0x40, 0x40)); /* 7 Light Red */ - m_palette->set_pen_color(24, rgb_t(0xff, 0x00, 0x00)); /* 8 Red */ - m_palette->set_pen_color(25, rgb_t(0x00, 0x80, 0x80)); /* 9 Dark Cyan */ - m_palette->set_pen_color(26, rgb_t(0xff, 0x00, 0xff)); /* 10 Magenta */ - m_palette->set_pen_color(27, rgb_t(0x80, 0xff, 0x80)); /* 11 Light Green */ - m_palette->set_pen_color(28, rgb_t(0xff, 0xff, 0x00)); /* 12 Yellow */ - m_palette->set_pen_color(29, rgb_t(0x00, 0x00, 0x80)); /* 13 Dark Blue */ - m_palette->set_pen_color(30, rgb_t(0xff, 0xff, 0xff)); /* 14 White */ - m_palette->set_pen_color(31, rgb_t(0x00, 0x00, 0x00)); /* 15 Black */ -} - - - -void super80_state::screen_eof_super80m(screen_device &screen, bool state) -{ - // rising edge - if (state) - { - /* if we chose another palette or colour mode, enable it */ - m_palette_index = (m_io_config->read() & 0x60) ? 0 : 16; - } -} - -UINT32 super80_state::screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr=32,gfx,screen_on=0; - UINT16 sy=0,ma=m_vidpg,x; - - output_set_value("cass_led",BIT(m_portf0, 5)); - - if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ - screen_on++; - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 32; x++) // done this way to avoid x overflowing on page FF - { - if (screen_on) - chr = m_p_ram[ma | x] & 0x3f; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=32; - } - return 0; -} - -UINT32 super80_state::screen_update_super80d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr=32,gfx,screen_on=0; - UINT16 sy=0,ma=m_vidpg,x; - - output_set_value("cass_led",BIT(m_portf0, 5)); - - if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ - screen_on++; - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 32; x++) - { - if (screen_on) - chr = m_p_ram[ma | x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0); - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=32; - } - return 0; -} - -UINT32 super80_state::screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr=32,gfx,screen_on=0; - UINT16 sy=0,ma=m_vidpg,x; - - output_set_value("cass_led",BIT(m_portf0, 5)); - - if ((BIT(m_portf0, 2)) | (!BIT(m_io_config->read(), 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ - screen_on++; - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 32; x++) - { - if (screen_on) - chr = m_p_ram[ma | x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=32; - } - return 0; -} - -UINT32 super80_state::screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr=32,gfx,screen_on=0; - UINT16 sy=0,ma=m_vidpg,x; - UINT8 col, bg=0, fg=0, options=m_io_config->read(); - - /* get selected character generator */ - UINT8 cgen = m_current_charset ^ ((options & 0x10)>>4); /* bit 0 of port F1 and cgen config switch */ - - output_set_value("cass_led",BIT(m_portf0, 5)); - - if ((BIT(m_portf0, 2)) | (!BIT(options, 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ - screen_on++; - - if (screen_on) - { - if ((options & 0x60) == 0x60) - fg = 15; /* b&w */ - else - fg = 5; /* green */ - } - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 10; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 32; x++) - { - if (screen_on) - chr = m_p_ram[ma | x]; - - if (!(options & 0x40)) - { - col = m_p_ram[0xfe00 | ma | x]; /* byte of colour to display */ - fg = m_palette_index + (col & 0x0f); - bg = m_palette_index + (col >> 4); - } - - /* get pattern of pixels for that character scanline */ - if (cgen) - gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; - else - gfx = m_p_chargen[0x1000 | ((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0); - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7) ? fg : bg; - *p++ = BIT(gfx, 6) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 0) ? fg : bg; - } - } - ma+=32; - } - return 0; -} - -VIDEO_START_MEMBER(super80_state,super80) -{ - m_vidpg = 0xfe00; - m_p_chargen = memregion("chargen")->base(); - m_p_ram = memregion("maincpu")->base(); -} - -/**************************** I/O PORTS *****************************************************************/ - -WRITE8_MEMBER( super80_state::super80_f1_w ) -{ - m_vidpg = (data & 0xfe) << 8; - m_current_charset = data & 1; -} - -/*--------------------------------------------------------------- - - Super-80R and Super-80V - ----------------------------------------------------------------*/ - -static const UINT8 mc6845_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0}; - -READ8_MEMBER( super80_state::super80v_low_r ) -{ - if BIT(m_portf0, 2) - return m_p_videoram[offset]; - else - return m_p_colorram[offset]; -} - -WRITE8_MEMBER( super80_state::super80v_low_w ) -{ - if BIT(m_portf0, 2) - m_p_videoram[offset] = data; - else - m_p_colorram[offset] = data; -} - -READ8_MEMBER( super80_state::super80v_high_r ) -{ - if (!BIT(m_portf0, 2)) - return m_p_colorram[0x800 | offset]; - else - if BIT(m_portf0, 4) - return m_p_pcgram[0x800 | offset]; - else - return m_p_pcgram[offset]; -} - -WRITE8_MEMBER( super80_state::super80v_high_w ) -{ - if (!BIT(m_portf0, 2)) - m_p_colorram[0x800 | offset] = data; - else - { - m_p_videoram[0x800 | offset] = data; - - if BIT(m_portf0, 4) - m_p_pcgram[0x800 | offset] = data; - } -} - -/* The 6845 can produce a variety of cursor shapes - all are emulated here - remove when mame fixed */ -void super80_state::mc6845_cursor_configure() -{ - UINT8 i,curs_type=0,r9,r10,r11; - - /* curs_type holds the general cursor shape to be created - 0 = no cursor - 1 = partial cursor (only shows on a block of scan lines) - 2 = full cursor - 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ - - for ( i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) m_mc6845_cursor[i] = 0; // prepare cursor by erasing old one - - r9 = m_mc6845_reg[9]; // number of scan lines - 1 - r10 = m_mc6845_reg[10] & 0x1f; // cursor start line = last 5 bits - r11 = m_mc6845_reg[11]+1; // cursor end line incremented to suit for-loops below - - /* decide the curs_type by examining the registers */ - if (r10 < r11) curs_type=1; // start less than end, show start to end - else - if (r10 == r11) curs_type=2; // if equal, show full cursor - else curs_type=3; // if start greater than end, it's a two-part cursor - - if ((r11 - 1) > r9) curs_type=2; // if end greater than scan-lines, show full cursor - if (r10 > r9) curs_type=0; // if start greater than scan-lines, then no cursor - if (r11 > 16) r11=16; // truncate 5-bit register to fit our 4-bit hardware - - /* create the new cursor */ - if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(m_mc6845_cursor);i++) m_mc6845_cursor[i]=0xff; // turn on full cursor - - if (curs_type == 1) for (i = r10;i < r11;i++) m_mc6845_cursor[i]=0xff; // for each line that should show, turn on that scan line - - if (curs_type == 3) for (i = r11; i < r10;i++) m_mc6845_cursor[i]=0; // now take a bite out of the middle -} - -VIDEO_START_MEMBER(super80_state,super80v) -{ - m_p_pcgram = memregion("maincpu")->base()+0xf000; - m_p_videoram = memregion("videoram")->base(); - m_p_colorram = memregion("colorram")->base(); -} - -UINT32 super80_state::screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_s_options=m_io_config->read(); - output_set_value("cass_led",BIT(m_portf0, 5)); - m_crtc->screen_update(screen, bitmap, cliprect); - return 0; -} - -MC6845_UPDATE_ROW( super80_state::crtc_update_row ) -{ - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,col,gfx,fg,bg=0; - UINT16 mem,x; - UINT32 *p = &bitmap.pix32(y); - - for (x = 0; x < x_count; x++) // for each character - { - UINT8 inv=0; - // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ - mem = (ma + x) & 0xfff; - chr = m_p_videoram[mem]; - - /* get colour or b&w */ - fg = 5; /* green */ - if ((m_s_options & 0x60) == 0x60) fg = 15; /* b&w */ - - if (~m_s_options & 0x40) - { - col = m_p_colorram[mem]; /* byte of colour to display */ - fg = m_palette_index + (col & 0x0f); - bg = m_palette_index + (col >> 4); - } - - /* if inverse mode, replace any pcgram chrs with inverse chrs */ - if ((!BIT(m_portf0, 4)) && (chr & 0x80)) // is it a high chr in inverse mode - { - inv ^= 0xff; // invert the chr - chr &= 0x7f; // and drop bit 7 - } - - /* process cursor */ - if (x == cursor_x) - inv ^= m_mc6845_cursor[ra]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_pcgram[(chr<<4) | ra] ^ inv; - - /* Display a scanline of a character */ - *p++ = palette[BIT(gfx, 7) ? fg : bg]; - *p++ = palette[BIT(gfx, 6) ? fg : bg]; - *p++ = palette[BIT(gfx, 5) ? fg : bg]; - *p++ = palette[BIT(gfx, 4) ? fg : bg]; - *p++ = palette[BIT(gfx, 3) ? fg : bg]; - *p++ = palette[BIT(gfx, 2) ? fg : bg]; - *p++ = palette[BIT(gfx, 1) ? fg : bg]; - } -} - -/**************************** I/O PORTS *****************************************************************/ - -WRITE8_MEMBER( super80_state::super80v_10_w ) -{ - data &= 0x1f; - m_mc6845_ind = data; - m_crtc->address_w( space, 0, data ); -} - -WRITE8_MEMBER( super80_state::super80v_11_w ) -{ - m_mc6845_reg[m_mc6845_ind] = data & mc6845_mask[m_mc6845_ind]; /* save data in register */ - m_crtc->register_w( space, 0, data ); - if ((m_mc6845_ind > 8) && (m_mc6845_ind < 12)) mc6845_cursor_configure(); /* adjust cursor shape - remove when mame fixed */ -} diff --git a/src/mess/video/thomson.c b/src/mess/video/thomson.c deleted file mode 100644 index a258bb529da..00000000000 --- a/src/mess/video/thomson.c +++ /dev/null @@ -1,1387 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Antoine Mine -/********************************************************************** - - Copyright (C) Antoine Mine' 2006 - - Thomson 8-bit computers - -**********************************************************************/ - -#include -#include "includes/thomson.h" - - -#define VERBOSE 0 -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - - -/* One GPL is what is drawn in 1 us by the video system in the active window. - Most of the time, it corresponds to a 8-pixel wide horizontal span. - For some TO8/9/9+/MO6 modes, it can be 4-pixel or 16-pixel wide. - There are always 40 GPLs in an active row, and it is always defined by - two bytes in video memory (0x2000 bytes appart). -*/ - -#define THOM_GPL_PER_LINE 40 - - -/****************** dynamic screen size *****************/ - - -int thomson_state::thom_update_screen_size() -{ - const rectangle &visarea = m_screen->visible_area(); - UINT8 p = m_io_vconfig->read(); - int new_w, new_h, changed = 0; - - switch ( p & 3 ) - { - case 0: m_thom_bwidth = 56; m_thom_bheight = 47; break; /* as in original (?) */ - case 1: m_thom_bwidth = 16; m_thom_bheight = 16; break; /* small */ - default: m_thom_bwidth = 0; m_thom_bheight = 0; break; /* none */ - } - - switch ( p & 0xc ) - { - case 0: m_thom_hires = 0; break; /* low */ - case 4: m_thom_hires = 1; break; /* high */ - default: m_thom_hires = m_thom_hires_better; break; /* auto */ - } - - new_w = ( 320 + m_thom_bwidth * 2 ) * ( m_thom_hires + 1 ) - 1; - new_h = ( 200 + m_thom_bheight * 2 ) /** (m_thom_hires + 1 )*/ - 1; - if ( ( visarea.max_x != new_w ) || ( visarea.max_y != new_h ) ) - { - changed = 1; - m_screen->set_visible_area(0, new_w, 0, new_h ); - } - - return changed; -} - - - -/*********************** video timing ******************************/ - - -/* elapsed time from beginning of frame, in us */ -unsigned thomson_state::thom_video_elapsed() -{ - unsigned u; - attotime elapsed = m_thom_video_timer->elapsed(); - u = (elapsed * 1000000 ).seconds(); - if ( u >= 19968 ) - u = 19968; - return u; -} - - - -struct thom_vsignal thomson_state::thom_get_vsignal() -{ - struct thom_vsignal v; - int gpl = thom_video_elapsed() - 64 * THOM_BORDER_HEIGHT - 7; - if ( gpl < 0 ) - gpl += 19968; - - v.inil = ( gpl & 63 ) <= 40; - - v.init = gpl < (64 * THOM_ACTIVE_HEIGHT - 24); - - v.lt3 = ( gpl & 8 ) ? 1 : 0; - - v.line = gpl >> 6; - - v.count = v.line * 320 + ( gpl & 63 ) * 8; - - return v; -} - - - -/************************** lightpen *******************************/ - - - -void thomson_state::thom_get_lightpen_pos( int*x, int* y ) -{ - *x = m_io_lightpen_x->read(); - *y = m_io_lightpen_y->read(); - - if ( *x < 0 ) - *x = 0; - - if ( *y < 0 ) - *y = 0; - - if ( *x > 2 * m_thom_bwidth + 319 ) - *x = 2 * m_thom_bwidth + 319; - - if ( *y > 2 * m_thom_bheight + 199 ) - *y = 2 * m_thom_bheight + 199; -} - - - -struct thom_vsignal thomson_state::thom_get_lightpen_vsignal( int xdec, int ydec, int xdec2 ) -{ - struct thom_vsignal v; - int x, y; - int gpl; - - thom_get_lightpen_pos( &x, &y ); - x += xdec - m_thom_bwidth; - y += ydec - m_thom_bheight; - - gpl = (x >> 3) + y * 64; - if ( gpl < 0 ) - gpl += 19968; - - v.inil = (gpl & 63) <= 41; - - v.init = (gpl <= 64 * THOM_ACTIVE_HEIGHT - 24); - - v.lt3 = ( gpl & 8 ) ? 1 : 0; - - v.line = y; - - if ( v.inil && v.init ) - v.count = - ( gpl >> 6 ) * 320 + /* line */ - ( gpl & 63 ) * 8 + /* gpl inside line */ - ( (x + xdec2) & 7 ); /* pixel inside gpl */ - else - v.count = 0; - - return v; -} - - - -void thomson_state::thom_set_lightpen_callback( int nb ) -{ - LOG (( "%f thom_set_lightpen_callback called\n", machine().time().as_double())); - m_thom_lightpen_nb = nb; -} - -TIMER_CALLBACK_MEMBER( thomson_state::thom_lightpen_step ) -{ - int step = param; - - if ( m_thom_lightpen_cb ) - (this->*m_thom_lightpen_cb)( step ); - - if ( step < m_thom_lightpen_nb ) - m_thom_lightpen_timer->adjust(attotime::from_usec( 64 ), step + 1); -} - - - -/***************** scan-line oriented engine ***********************/ - -/* This code, common for all Thomson machines, emulates the TO8 - video hardware, with its 16-colors chosen among 4096, 9 video modes, - and 4 video pages. Moreover, it emulates changing the palette several times - per frame to simulate more than 16 colors per frame (and the same for mode - and page switchs) and cooper effects (distinguishing the left and right - border color of each row). - - TO7, TO7/70 and MO5 video hardware are much simpler (8 or 16 fixed colors, - one mode and one video page). Although the three are different, they can all - be emulated by the TO8 video hardware. - Thus, we use the same TO8-emulation code to deal with these simpler - hardware (although it is somewhat of an overkill). -*/ - - - -/* ---------------- state & state changes ---------------- */ - - -/* returns 1 if the mode is 640 pixel wide, 0 if it is 160 or 320 */ -int thomson_state::thom_mode_is_hires( int mode ) -{ - return ( mode == THOM_VMODE_80 ) || ( mode == THOM_VMODE_80_TO9 ); -} - - - -/* either the border index or its palette entry has changed */ -void thomson_state::thom_border_changed() -{ - unsigned l = thom_video_elapsed(); - unsigned y = l >> 6; - unsigned x = l & 63; - unsigned color = m_thom_pal[ m_thom_border_index ]; - - if ( y >= THOM_TOTAL_HEIGHT ) - { - /* end of page */ - m_thom_border_r[ THOM_TOTAL_HEIGHT ] = color; - } - else if ( ! x ) - { - /* start of line */ - m_thom_border_l[ y ] = color; - m_thom_border_r[ y ] = color; - } - else if ( x <= 19 ) - { - /* between left and right border */ - /* NOTE: this makes the lower right part of the color picker blink - in the TO8/TO9/TO9+, which actually happens on the real computer! - */ - m_thom_border_r[ y ] = color; - m_thom_border_l[ y + 1 ] = color; - } - else - { - /* end of line */ - m_thom_border_l[ y + 1 ] = color; - m_thom_border_r[ y + 1 ] = color; - } - m_thom_vstate_dirty = 1; -} - - - -/* the video mode or page has changed */ -void thomson_state::thom_gplinfo_changed() -{ - unsigned l = thom_video_elapsed() - THOM_BORDER_HEIGHT * 64 - 7; - unsigned y = l >> 6; - unsigned x = l & 63; - int modepage = ((int)m_thom_vmode << 8) | m_thom_vpage; - if ( y >= 200 || x>= 40 ) - m_thom_vmodepage[ 40 ] = modepage; - else - m_thom_vmodepage[ x ] = modepage; - m_thom_vmodepage_changed = 1; -} - - - -void thomson_state::thom_set_border_color( unsigned index ) -{ - assert( index < 16 ); - if ( index != m_thom_border_index ) - { - LOG (( "thom_set_border_color: %i at line %i col %i\n", index, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); - m_thom_border_index = index; - thom_border_changed(); - } -} - - - -void thomson_state::thom_set_palette( unsigned index, UINT16 color ) -{ - assert( index < 16 ); - - if ( color != 0x1000 ) - color &= 0xfff; - - if ( m_thom_pal[ index ] == color ) - return; - - LOG (( "thom_set_palette: %i to %03x at line %i col %i\n", index, color, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); - - m_thom_pal[ index ] = color; - if ( index == m_thom_border_index ) - thom_border_changed(); - m_thom_pal_changed = 1; - m_thom_vstate_dirty = 1; -} - - - -void thomson_state::thom_set_video_mode( unsigned mode ) -{ - assert( mode < THOM_VMODE_NB ); - - if ( mode != m_thom_vmode ) - { - LOG (( "thom_set_video_mode: %i at line %i, col %i\n", mode, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); - m_thom_vmode = mode; - thom_gplinfo_changed(); - m_thom_vstate_dirty = 1; - m_thom_hires_better |= thom_mode_is_hires( mode ); - } -} - - - -void thomson_state::thom_set_video_page( unsigned page ) -{ - assert( page < THOM_NB_PAGES ) - ; - if ( page != m_thom_vpage ) { - LOG (( "thom_set_video_page: %i at line %i col %i\n", page, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); - m_thom_vpage = page; - thom_gplinfo_changed(); - m_thom_vstate_dirty = 1; - } -} - - - -/* -------------- drawing --------------- */ - - - -typedef void ( thomson_state::*thom_scandraw ) ( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); - - - -#define UPDATE( name, res ) \ - void thomson_state::name##_scandraw_##res ( \ - UINT8* vram, UINT16* dst, UINT16* pal, \ - int org, int len ) \ - { \ - unsigned gpl; \ - vram += org; \ - dst += org * res; \ - for ( gpl = 0; gpl < len; gpl++, dst += res, vram++ ) { \ - UINT8 rama = vram[ 0 ]; \ - UINT8 ramb = vram[ 0x2000 ]; - -#define END_UPDATE \ - } \ - } - -#define UPDATE_HI( name ) UPDATE( name, 16 ) -#define UPDATE_LOW( name ) UPDATE( name, 8 ) - - - -/* 320x200, 16-colors, constraints: 2 distinct colors per GPL (8 pixels) */ -/* this also works for TO7, assuming the 2 top bits of each color byte are 1 */ - -UPDATE_HI( to770 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ ((ramb & 7) | ((ramb>>4) & 8)) ^ 8 ]; - c[1] = pal[ ((ramb >> 3) & 15) ^ 8 ]; - for ( i = 0; i < 16; i += 2, rama >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; -} -END_UPDATE - -UPDATE_LOW( to770 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ ((ramb & 7) | ((ramb>>4) & 8)) ^ 8 ]; - c[1] = pal[ ((ramb >> 3) & 15) ^ 8 ]; - for ( i = 0; i < 8; i++, rama >>= 1 ) - dst[ 7 - i ] = c[ rama & 1 ]; -} -END_UPDATE - - - -/* as above, different (more logical but TO7-incompatible) color encoding */ - -UPDATE_HI( mo5 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ ramb & 15 ]; - c[1] = pal[ ramb >> 4 ]; - for ( i = 0; i < 16; i += 2, rama >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; -} -END_UPDATE - -UPDATE_LOW( mo5 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ ramb & 15 ]; - c[1] = pal[ ramb >> 4 ]; - for ( i = 0; i < 8; i++, rama >>= 1 ) - dst[ 7 - i ] = c[ rama & 1 ]; -} -END_UPDATE - - -/* as mo5, but with pastel bit switched */ - -UPDATE_HI( mo5alt ) -{ - int i; - pen_t c[2]; - c[0] = pal[ (ramb & 15) ^ 8 ]; - c[1] = pal[ (ramb >> 4) ^ 8 ]; - for ( i = 0; i < 16; i += 2, rama >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; -} -END_UPDATE - -UPDATE_LOW( mo5alt ) -{ - int i; - pen_t c[2]; - c[0] = pal[ (ramb & 15) ^ 8 ]; - c[1] = pal[ (ramb >> 4) ^ 8 ]; - for ( i = 0; i < 8; i++, rama >>= 1 ) - dst[ 7 - i ] = c[ rama & 1 ]; -} -END_UPDATE - - - -/* as to770, but with pastel color bit unswitched */ - -UPDATE_HI( to9 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ (ramb & 7) | ((ramb>>4) & 8) ]; - c[1] = pal[ (ramb >> 3) & 15 ]; - for ( i = 0; i < 16; i += 2, rama >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; -} -END_UPDATE - -UPDATE_LOW( to9 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ (ramb & 7) | ((ramb>>4) & 8) ]; - c[1] = pal[ (ramb >> 3) & 15 ]; - for ( i = 0; i < 8; i++, rama >>= 1 ) - dst[ 7 - i ] = c[ rama & 1 ]; -} -END_UPDATE - - - -/* 320x200, 4-colors, no constraint */ - -UPDATE_HI( bitmap4 ) -{ - int i; - pen_t c[2][2]; - c[0][0] = pal[ 0 ]; - c[0][1] = pal[ 1 ]; - c[1][0] = pal[ 2 ]; - c[1][1] = pal[ 3 ]; - for ( i = 0; i < 16; i += 2, rama >>= 1, ramb >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ] [ ramb & 1 ]; -} -END_UPDATE - -UPDATE_LOW( bitmap4 ) -{ - int i; - pen_t c[2][2]; - c[0][0] = pal[ 0 ]; - c[0][1] = pal[ 1 ]; - c[1][0] = pal[ 2 ]; - c[1][1] = pal[ 3 ]; - for ( i = 0; i < 8; i++, rama >>= 1, ramb >>= 1 ) - dst[ 7 - i ] = c[ rama & 1 ] [ ramb & 1 ]; -} -END_UPDATE - - - -/* as above, but using 2-bit pixels instead of 2 planes of 1-bit pixels */ - -UPDATE_HI( bitmap4alt ) -{ - int i; - pen_t c[4]; - c[0] = pal[ 0 ]; - c[1] = pal[ 1 ]; - c[2] = pal[ 2 ]; - c[3] = pal[ 3 ]; - for ( i = 0; i < 8; i += 2, ramb >>= 2 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ ramb & 3 ]; - for ( i = 0; i < 8; i += 2, rama >>= 2 ) - dst[ 7 - i ] = dst[ 6 - i ] = c[ rama & 3 ]; -} -END_UPDATE - -UPDATE_LOW( bitmap4alt ) -{ - int i; - pen_t c[4]; - c[0] = pal[ 0 ]; - c[1] = pal[ 1 ]; - c[2] = pal[ 2 ]; - c[3] = pal[ 3 ]; - for ( i = 0; i < 4; i++, ramb >>= 2 ) - dst[ 7 - i ] = c[ ramb & 3 ]; - for ( i = 0; i < 4; i++, rama >>= 2 ) - dst[ 3 - i ] = c[ rama & 3 ]; -} -END_UPDATE - - -/* 160x200, 4 colors, no constraint, using only one memory page (undocumented) */ - -UPDATE_HI( bitmap4althalf ) -{ - dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = pal[ rama >> 6 ]; - dst[ 4] = dst[ 5] = dst[ 6] = dst[ 7] = pal[ (rama >> 4) & 3 ]; - dst[ 8] = dst[ 9] = dst[10] = dst[11] = pal[ (rama >> 2) & 3]; - dst[12] = dst[13] = dst[14] = dst[15] = pal[ rama & 3 ]; - (void)ramb; // ramb is not used -} -END_UPDATE - -UPDATE_LOW( bitmap4althalf ) -{ - dst[0] = dst[1] = pal[ rama >> 6 ]; - dst[2] = dst[3] = pal[ (rama >> 4) & 3 ]; - dst[4] = dst[5] = pal[ (rama >> 2) & 3]; - dst[6] = dst[7] = pal[ rama & 3 ]; - (void)ramb; // ramb is not used -} -END_UPDATE - - - -/* 160x200, 16-colors, no constraint */ - -UPDATE_HI( bitmap16 ) -{ - dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = pal[ rama >> 4 ]; - dst[ 4] = dst[ 5] = dst[ 6] = dst[ 7] = pal[ rama & 15 ]; - dst[ 8] = dst[ 9] = dst[10] = dst[11] = pal[ ramb >> 4 ]; - dst[12] = dst[13] = dst[14] = dst[15] = pal[ ramb & 15 ]; -} -END_UPDATE - -UPDATE_LOW( bitmap16 ) -{ - dst[0] = dst[1] = pal[ rama >> 4 ]; - dst[2] = dst[3] = pal[ rama & 15 ]; - dst[4] = dst[5] = pal[ ramb >> 4 ]; - dst[6] = dst[7] = pal[ ramb & 15 ]; -} -END_UPDATE - - - -/* 640x200 (80 text column), 2-colors, no constraint */ - -UPDATE_HI( mode80 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ 0 ]; - c[1] = pal[ 1 ]; - for ( i = 0; i < 8; i++, ramb >>= 1 ) - dst[ 15 - i ] = c[ ramb & 1 ]; - for ( i = 0; i < 8; i++, rama >>= 1 ) - dst[ 7 - i ] = c[ rama & 1 ]; -} -END_UPDATE - -UPDATE_LOW( mode80 ) -{ - /* 640-pixel mode but 320 pixels emulated => we merge pixels */ - int i; - pen_t c[4]; - c[0] = pal[ 0 ]; - c[1] = c[2] = c[3] = pal[ 1 ]; - for ( i = 0; i < 4; i++, ramb >>= 2 ) - dst[ 7 - i ] = c[ ramb & 3 ]; - for ( i = 0; i < 4; i++, rama >>= 2 ) - dst[ 3 - i ] = c[ rama & 3 ]; -} -END_UPDATE - - - -/* as above, but TO9 flavor */ - -UPDATE_HI( mode80_to9 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ 0 ]; - c[1] = pal[ 6 ]; - for ( i = 0; i < 8; i++, ramb >>= 1 ) - dst[ 15 - i ] = c[ ramb & 1 ]; - for ( i = 0; i < 8; i++, rama >>= 1 ) - dst[ 7 - i ] = c[ rama & 1 ]; -} -END_UPDATE - -UPDATE_LOW( mode80_to9 ) -{ - int i; - pen_t c[4]; - c[0] = pal[ 0 ]; - c[1] = c[2] = c[3] = pal[ 6 ]; - for ( i = 0; i < 4; i++, ramb >>= 2 ) - dst[ 7 - i ] = c[ ramb & 3 ]; - for ( i = 0; i < 4; i++, rama >>= 2 ) - dst[ 3 - i ] = c[ rama & 3 ]; -} -END_UPDATE - - - -/* 320x200, 2-colors, two pages (untested) */ - -UPDATE_HI( page1 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ 0 ]; - c[1] = pal[ 1 ]; - for ( i = 0; i < 16; i += 2, rama >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ rama & 1 ]; - (void)ramb; -} -END_UPDATE - -UPDATE_LOW( page1 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ 0 ]; - c[1] = pal[ 1 ]; - for ( i = 0; i < 8; i++, rama >>= 1 ) - dst[ 7 - i ] = c[ rama & 1 ]; - (void)ramb; -} -END_UPDATE - -UPDATE_HI( page2 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ 0 ]; - c[1] = pal[ 2 ]; - for ( i = 0; i < 16; i += 2, ramb >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ ramb & 1 ]; - (void)rama; -} -END_UPDATE - -UPDATE_LOW( page2 ) -{ - int i; - pen_t c[2]; - c[0] = pal[ 0 ]; - c[1] = pal[ 2 ]; - for ( i = 0; i < 8; i++, ramb >>= 1 ) - dst[ 7 - i ] = c[ ramb & 1 ]; - (void)rama; -} -END_UPDATE - - - -/* 320x200, 2-colors, two overlaid pages */ - -UPDATE_HI( overlay ) -{ - int i; - pen_t c[2][2]; - c[0][0] = pal[ 0 ]; - c[0][1] = c[1][1] = pal[ 1 ]; - c[1][0] = pal[ 2 ]; - for ( i = 0; i < 16; i += 2, rama >>= 1, ramb >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = c[ ramb & 1 ] [ rama & 1 ]; -} -END_UPDATE - -UPDATE_LOW( overlay ) -{ - int i; - pen_t c[2][2]; - c[0][0] = pal[ 0 ]; - c[0][1] = c[1][1] = pal[ 1 ]; - c[1][0] = pal[ 2 ]; - for ( i = 0; i < 8; i++, rama >>= 1, ramb >>= 1 ) - dst[ 7 - i ] = c[ ramb & 1 ] [ rama & 1 ]; -} -END_UPDATE - - -/* 160x200 undocumented variant of the above (2-colors, two overlaid pages) */ - -UPDATE_HI( overlayhalf ) -{ - int i; - pen_t c[2][2]; - c[0][0] = pal[ 0 ]; - c[0][1] = c[1][1] = pal[ 1 ]; - c[1][0] = pal[ 2 ]; - rama >>= 4; - ramb >>= 4; - for ( i = 0; i < 16; i += 4, rama >>= 1, ramb >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = dst[ 13 - i ] = dst[ 12 - i ] = - c[ ramb & 1 ] [ rama & 1 ]; -} -END_UPDATE - -UPDATE_LOW( overlayhalf ) -{ - int i; - pen_t c[2][2]; - c[0][0] = pal[ 0 ]; - c[0][1] = c[1][1] = pal[ 1 ]; - c[1][0] = pal[ 2 ]; - rama >>= 4; - ramb >>= 4; - for ( i = 0; i < 8; i += 2, rama >>= 1, ramb >>= 1 ) - dst[ 7 - i ] = dst[ 6 - i ] = c[ ramb & 1 ] [ rama & 1 ]; -} -END_UPDATE - - - -/* 160x200, 4-colors, four overlaid pages */ - -UPDATE_HI( overlay3 ) -{ - /* Note: "Manuel Technique" doc implies that the palette entries are 0,1,2,4,8; - we now use palette entries 0,1,2,3,4 instead, as this is what the TEO emulator uses and it has been confirmed correct - */ - static const int p[2][2][2][2] = { - { { { 0, 1 }, { 2, 1 } }, { { 3, 1 }, { 2, 1 } } }, - { { { 4, 1 }, { 2, 1 } }, { { 3, 1 }, { 2, 1 } } } - }; - int i; - for ( i = 0; i < 16; i += 4, rama >>= 1, ramb >>= 1 ) - dst[ 15 - i ] = dst[ 14 - i ] = dst[ 13 - i ] = dst[ 12 - i ] = - pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ] - [ rama & 1 ] [ (rama >> 4) & 1 ] ]; -} -END_UPDATE - -UPDATE_LOW( overlay3 ) -{ - static const int p[2][2][2][2] = { - { { { 0, 1 }, { 2, 1 } }, { { 3, 1 }, { 2, 1 } } }, - { { { 4, 1 }, { 2, 1 } }, { { 3, 1 }, { 2, 1 } } } - }; - int i; - for ( i = 0; i < 8; i += 2, rama >>= 1, ramb >>= 1 ) - dst[ 7 - i ] = dst[ 6 - i ] = - pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ] - [ rama & 1 ] [ (rama >> 4) & 1 ] ]; -} -END_UPDATE - - - -#define FUN(x) { &thomson_state::x##_scandraw_8, &thomson_state::x##_scandraw_16 } - - -static const thom_scandraw thom_scandraw_funcs[THOM_VMODE_NB][2] = -{ - FUN(to770), FUN(mo5), FUN(bitmap4), FUN(bitmap4alt), FUN(mode80), - FUN(bitmap16), FUN(page1), FUN(page2), FUN(overlay), FUN(overlay3), - FUN(to9), FUN(mode80_to9), - FUN(bitmap4althalf), FUN(mo5alt), FUN(overlayhalf), -}; - - - -/* called at the start of each scanline in the active area, just after - left border (-1<=y<199), and also after the last scanline (y=199) -*/ -TIMER_CALLBACK_MEMBER( thomson_state::thom_scanline_start ) -{ - int y = param; - - /* update active-area */ - if ( y >= 0 && (m_thom_vstate_dirty || m_thom_vstate_last_dirty || m_thom_vmem_dirty[y]) ) - { - int x = 0; - while ( x < 40 ) - { - int xx = x; - unsigned mode = m_thom_vmodepage[x] >> 8; - unsigned page = m_thom_vmodepage[x] & 0xff; - assert( mode < THOM_VMODE_NB ); - assert( page < 4 ); - if ( m_thom_vmodepage_changed ) - { - do - { - xx++; - } - while ( xx < 40 && m_thom_vmodepage[xx] == -1 ); - } - else - { - xx = 40; - } - (this->*thom_scandraw_funcs[ mode ][ m_thom_hires ]) - ( m_thom_vram + y * 40 + page * 0x4000, - m_thom_vbody + y * 320 * (m_thom_hires+1), - m_thom_last_pal, x, xx-x ); - x = xx; - } - m_thom_vmem_dirty[y] = 0; - } - - /* prepare for next scanline */ - if ( y == 199 ) - m_thom_scanline_timer->adjust(attotime::never); - else - { - if ( m_thom_vmodepage_changed ) - { - int x, m = 0; - for ( x = 0; x <= 40; x++ ) - { - if ( m_thom_vmodepage[x] !=-1 ) - { - m = m_thom_vmodepage[x]; - m_thom_vmodepage[x] = -1; - } - } - m_thom_vmodepage[0] = m; - m_thom_vmodepage_changed = 0; - } - - if ( m_thom_pal_changed ) - { - memcpy( m_thom_last_pal, m_thom_pal, 32 ); - m_thom_pal_changed = 0; - } - - m_thom_scanline_timer->adjust(attotime::from_usec(64), y + 1); - } -} - - - -/* -------------- misc --------------- */ - - -#define FLOP_STATE (m_thom_floppy_wcount ? 2 : m_thom_floppy_rcount ? 1 : 0) - - - -void thomson_state::thom_set_mode_point( int point ) -{ - assert( point >= 0 && point <= 1 ); - m_thom_mode_point = ( ! point ) * 0x2000; - m_vrambank->set_entry( ! point ); -} - - - -void thomson_state::thom_floppy_active( int write ) -{ - int fold = FLOP_STATE, fnew; - - /* stays up for a few frames */ - if ( write ) - m_thom_floppy_wcount = 25; - else - m_thom_floppy_rcount = 25; - - /* update icon */ - fnew = FLOP_STATE; - if ( fold != fnew ) - output_set_value( "floppy", fnew ); -} - - - -/* -------------- main update function --------------- */ - - - -UINT32 thomson_state::screen_update_thom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int y, ypos; - const int scale = m_thom_hires ? 2 : 1; - const int xbleft = m_thom_bwidth * scale; - const int xbright = ( m_thom_bwidth + THOM_ACTIVE_WIDTH ) * scale; - const int xright = ( m_thom_bwidth * 2 + THOM_ACTIVE_WIDTH ) * scale; - const int xwidth = THOM_ACTIVE_WIDTH * scale; - const int yup = THOM_BORDER_HEIGHT + THOM_ACTIVE_HEIGHT; - const int ybot = THOM_BORDER_HEIGHT + m_thom_bheight + 200; - UINT16* v = m_thom_vbody; - pen_t border = 0; - rectangle wrect(0, xright - 1, 0, 0); - rectangle lrect(0, xbleft - 1, 0, 0); - rectangle rrect(xbright, xright - 1, 0, 0); - - //LOG (( "%f thom: video update called\n", machine().time().as_double())); - - /* upper border */ - for ( y = 0; y < THOM_BORDER_HEIGHT - m_thom_bheight; y++ ) - { - if ( m_thom_border_l[ y ] != -1 ) - border = m_thom_border_l[ y ]; - } - ypos = 0; - while ( y < THOM_BORDER_HEIGHT ) - { - if ( m_thom_border_l[ y ] != -1 ) - border = m_thom_border_l[ y ]; - wrect.min_y = ypos; - do - { - y++; - ypos ++ /* += scale */; - } - while ( y < THOM_BORDER_HEIGHT && m_thom_border_l[ y ] == -1 ); - wrect.max_y = ypos - 1; - bitmap.fill(border, wrect ); - } - - /* left border */ - while ( y < yup ) - { - if ( m_thom_border_l[ y ] != -1 ) - border = m_thom_border_l[ y ]; - lrect.min_y = ypos; - do - { - y++; - ypos ++ /* += scale */; - } - while ( y < yup && m_thom_border_l[ y ] == -1 ); - lrect.max_y = ypos - 1; - bitmap.fill(border, lrect ); - } - - /* lower border */ - while (y < ybot ) - { - if ( m_thom_border_l[ y ] != -1 ) - border = m_thom_border_l[ y ]; - wrect.min_y = ypos; - do - { - y++; - ypos ++ /* += scale */; - } while ( y < ybot && m_thom_border_l[ y ] == -1 ); - wrect.max_y = ypos - 1; - bitmap.fill(border, wrect ); - } - - /* right border */ - for ( y = 0; y < THOM_BORDER_HEIGHT; y++ ) { - if ( m_thom_border_r[ y ] != -1 ) - border = m_thom_border_r[ y ]; - } - ypos = m_thom_bheight /* * scale */; - while ( y < yup ) - { - if ( m_thom_border_r[ y ] != -1 ) - border = m_thom_border_r[ y ]; - rrect.min_y = ypos; - do - { - y++; - ypos ++ /* += scale */; - } - while ( y < yup && m_thom_border_r[ y ] == -1 ); - rrect.max_y = ypos - 1; - bitmap.fill(border, rrect ); - } - - /* active area */ - ypos = m_thom_bheight /* * scale */; - for ( y = 0; y < 200; v += xwidth, y++ , ypos ++ /* += scale */ ) - { - draw_scanline16( bitmap, xbleft, ypos, xwidth, v, NULL ); -#if 0 - if ( thom_hires ) - draw_scanline16( bitmap, xbleft, ypos+1, xwidth, v, NULL ); -#endif - } - - return 0; -} - - - -/* -------------- frame start ------------------ */ - - -TIMER_CALLBACK_MEMBER( thomson_state::thom_set_init ) -{ - int init = param; - LOG (( "%f thom_set_init: %i, at line %i col %i\n", machine().time().as_double(), init, thom_video_elapsed() / 64, thom_video_elapsed() % 64 )); - - if ( m_thom_init_cb ) - (this->*m_thom_init_cb)( init ); - if ( ! init ) - m_thom_init_timer->adjust(attotime::from_usec( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init); -} - -/* call this at the very beginning of each new frame */ -void thomson_state::thom_vblank( screen_device &screen, bool state ) -{ - // rising edge - if (state) - { - int fnew, fold = FLOP_STATE; - int i; - UINT16 b = 0; - struct thom_vsignal l = thom_get_lightpen_vsignal( 0, -1, 0 ); - - LOG (( "%f thom: video eof called\n", machine().time().as_double() )); - - /* floppy indicator count */ - if ( m_thom_floppy_wcount ) - m_thom_floppy_wcount--; - if ( m_thom_floppy_rcount ) - m_thom_floppy_rcount--; - fnew = FLOP_STATE; - if ( fnew != fold ) - output_set_value( "floppy", fnew ); - - /* prepare state for next frame */ - for ( i = 0; i <= THOM_TOTAL_HEIGHT; i++ ) - { - if ( m_thom_border_l[ i ] != -1 ) - b = m_thom_border_l[ i ]; - if ( m_thom_border_r[ i ] != -1 ) - b = m_thom_border_r[ i ]; - } - memset( m_thom_border_l, 0xff, sizeof( m_thom_border_l ) ); - memset( m_thom_border_r, 0xff, sizeof( m_thom_border_r ) ); - m_thom_border_l[ 0 ] = b; - m_thom_border_r[ 0 ] = b; - m_thom_vstate_last_dirty = m_thom_vstate_dirty; - m_thom_vstate_dirty = 0; - - /* schedule first init signal */ - m_thom_init_timer->adjust(attotime::from_usec( 64 * THOM_BORDER_HEIGHT + 7 )); - - /* schedule first lightpen signal */ - l.line &= ~1; /* hack (avoid lock in MO6 palette selection) */ - m_thom_lightpen_timer->adjust( - attotime::from_usec( 64 * ( THOM_BORDER_HEIGHT + l.line - 2 ) + 16 ), 0); - - /* schedule first active-area scanline call-back */ - m_thom_scanline_timer->adjust(attotime::from_usec( 64 * THOM_BORDER_HEIGHT + 7), -1); - - /* reset video frame time */ - m_thom_video_timer->adjust(attotime::zero); - - /* update screen size according to user options */ - if ( thom_update_screen_size() ) - m_thom_vstate_dirty = 1; - - /* hi-res automatic */ - m_thom_hires_better = thom_mode_is_hires( m_thom_vmode ); - } -} - - - -/* -------------- initialization --------------- */ - - -/* TO7, TO7/70 palette, hardcoded in ROM - without further information, we assume that the hardcoded values - are the same as those setup by the TO8/TO9+/MO6 when booting up - */ -static const UINT16 thom_pal_init[16] = -{ - 0x1000, /* 0: black */ 0x000f, /* 1: red */ - 0x00f0, /* 2: geen */ 0x00ff, /* 3: yellow */ - 0x0f00, /* 4: blue */ 0x0f0f, /* 5: purple */ - 0x0ff0, /* 6: cyan */ 0x0fff, /* 7: white */ - 0x0777, /* 8: gray */ 0x033a, /* 9: pink */ - 0x03a3, /* a: light green */ 0x03aa, /* b: light yellow */ - 0x0a33, /* c: light blue */ 0x0a3a, /* d: redish pink */ - 0x0ee7, /* e: light cyan */ 0x007b, /* f: orange */ -}; - -/* MO5 palette, hardcoded in a ROM - values are from "Manuel Technique du MO5", p.19 - */ -static const UINT16 mo5_pal_init[16] = -{ - 0x1000, /* 0: black */ 0x055f, /* 1: red */ - 0x00f0, /* 2: geen */ 0x00ff, /* 3: yellow */ - 0x0f55, /* 4: blue */ 0x0f0f, /* 5: purple */ - 0x0ff5, /* 6: cyan */ 0x0fff, /* 7: white */ - 0x0aaa, /* 8: gray */ 0x0aaf, /* 9: pink */ - 0x0afa, /* a: light green */ 0x0aff, /* b: light yellow */ - 0x0fa5, /* c: light blue */ 0x0faf, /* d: parama pink */ - 0x0ffa, /* e: light cyan */ 0x05af, /* f: orange */ -}; - - -VIDEO_START_MEMBER( thomson_state, thom ) -{ - LOG (( "thom: video start called\n" )); - - /* scan-line state */ - memset( m_thom_border_l, 0xff, sizeof( m_thom_border_l ) ); - memset( m_thom_border_r, 0xff, sizeof( m_thom_border_r ) ); - memset( m_thom_vbody, 0, sizeof( m_thom_vbody ) ); - memset( m_thom_vmodepage, 0xffff, sizeof( m_thom_vmodepage ) ); - memset( m_thom_vmem_dirty, 0, sizeof( m_thom_vmem_dirty ) ); - m_thom_border_l[ 0 ] = 0; - m_thom_border_r[ 0 ] = 0; - m_thom_vmodepage[ 0 ] = 0; - m_thom_vmodepage_changed = 0; - m_thom_vmode = 0; - m_thom_vpage = 0; - m_thom_border_index = 0; - m_thom_vstate_dirty = 1; - m_thom_vstate_last_dirty = 1; - save_pointer(NAME(m_thom_last_pal), sizeof(m_thom_last_pal)); - save_pointer(NAME(m_thom_pal), sizeof(m_thom_pal)); - save_pointer(NAME(m_thom_border_l), sizeof(m_thom_border_l)); - save_pointer(NAME(m_thom_border_r), sizeof(m_thom_border_r)); - save_pointer(NAME(m_thom_vbody), sizeof(m_thom_vbody)); - save_pointer(NAME(m_thom_vmodepage), sizeof(m_thom_vmodepage)); - save_pointer(NAME(m_thom_vmem_dirty), sizeof(m_thom_vmem_dirty)); - save_item(NAME(m_thom_pal_changed)); - save_item(NAME(m_thom_vmodepage_changed)); - save_item(NAME(m_thom_vmode)); - save_item(NAME(m_thom_vpage)); - save_item(NAME(m_thom_border_index)); - save_item(NAME(m_thom_vstate_dirty)); - save_item(NAME(m_thom_vstate_last_dirty)); - - m_thom_mode_point = 0; - save_item(NAME(m_thom_mode_point)); - m_vrambank->set_entry( 0 ); - - m_thom_floppy_rcount = 0; - m_thom_floppy_wcount = 0; - save_item(NAME(m_thom_floppy_wcount)); - save_item(NAME(m_thom_floppy_rcount)); - output_set_value( "floppy", 0 ); - - m_thom_video_timer = machine().scheduler().timer_alloc(FUNC_NULL); - - m_thom_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_scanline_start),this)); - - m_thom_lightpen_nb = 0; - m_thom_lightpen_cb = NULL; - m_thom_lightpen_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_lightpen_step),this)); - save_item(NAME(m_thom_lightpen_nb)); - - m_thom_init_cb = NULL; - m_thom_init_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(thomson_state::thom_set_init),this)); - - save_item(NAME(m_thom_bwidth)); - save_item(NAME(m_thom_bheight)); - save_item(NAME(m_thom_hires)); - save_item(NAME(m_thom_hires_better)); -} - - -/* sets the fixed palette (for MO5,TO7,TO7/70) and gamma correction */ -void thomson_state::thom_configure_palette(double gamma, const UINT16* pal, palette_device& palette) -{ - memcpy( m_thom_last_pal, pal, 32 ); - memcpy( m_thom_pal, pal, 32 ); - - for ( int i = 0; i < 4097; i++ ) - { - UINT8 r = 255. * pow( (i & 15) / 15., gamma ); - UINT8 g = 255. * pow( ((i>> 4) & 15) / 15., gamma ); - UINT8 b = 255. * pow( ((i >> 8) & 15) / 15., gamma ); - /* UINT8 alpha = i & 0x1000 ? 0 : 255; TODO: transparency */ - palette.set_pen_color(i, r, g, b ); - } -} - - -PALETTE_INIT_MEMBER(thomson_state, thom) -{ - LOG (( "thom: palette init called\n" )); - - /* TO8 and later use an EF9369 color palette chip - The spec shows a built-in gamma correction for gamma=2.8 - i.e., output is out = in ^ (1/2.8) - - For the TO7, the gamma correction is irrelevant. - - For the TO7/70, we use the same palette and gamma has the TO8, - which gives good results (but is not verified). - */ - thom_configure_palette(1.0 / 2.8, thom_pal_init, palette); -} - -PALETTE_INIT_MEMBER(thomson_state, mo5) -{ - LOG (( "thom: MO5 palette init called\n" )); - - /* The MO5 has a different fixed palette than the TO7/70. - We use a smaller gamma correction which gives intutively better - results (but is not verified). - */ - thom_configure_palette(1.0, mo5_pal_init, palette); -} - - - -/***************************** TO7 / T9000 *************************/ - - - -/* write to video memory through addresses 0x4000-0x5fff */ -WRITE8_MEMBER( thomson_state::to7_vram_w ) -{ - assert( offset < 0x2000 ); - /* force two topmost color bits to 1 */ - if ( m_thom_mode_point ) - data |= 0xc0; - if ( m_thom_vram[ offset + m_thom_mode_point ] == data ) - return; - m_thom_vram[ offset + m_thom_mode_point ] = data; - /* dirty whole scanline */ - m_thom_vmem_dirty[ offset / 40 ] = 1; -} - - - -/* bits 0-13 : latched gpl of lightpen position */ -/* bit 14: latched INIT */ -/* bit 15: latched INIL */ -unsigned thomson_state::to7_lightpen_gpl ( int decx, int decy ) -{ - int x,y; - thom_get_lightpen_pos( &x, &y ); - x -= m_thom_bwidth; - y -= m_thom_bheight; - if ( x < 0 || y < 0 || x >= 320 || y >= 200 ) - return 0; - x += decx; - y += decy; - return y*40 + x/8 + (x < 320 ? 0x4000 : 0) + 0x8000; -} - - - -/************************** TO7/70 / MO5 ****************************/ - - - -/* write to video memory through addresses 0x4000-0x5fff (TO) - or 0x0000-0x1fff (MO) */ -WRITE8_MEMBER( thomson_state::to770_vram_w ) -{ - assert( offset < 0x2000 ); - if ( m_thom_vram[ offset + m_thom_mode_point ] == data ) - return; - m_thom_vram[ offset + m_thom_mode_point ] = data; - /* dirty whole scanline */ - m_thom_vmem_dirty[ offset / 40 ] = 1; -} - - - - -/***************************** TO8 ******************************/ - - - -/* write to video memory through system space (always page 1) */ - -WRITE8_MEMBER( thomson_state::to8_sys_lo_w ) -{ - UINT8* dst = m_thom_vram + offset + 0x6000; - assert( offset < 0x2000 ); - if ( *dst == data ) - return; - *dst = data; - /* dirty whole scanline */ - m_thom_vmem_dirty[ offset / 40 ] = 1; -} - - - -WRITE8_MEMBER( thomson_state::to8_sys_hi_w ) -{ - UINT8* dst = m_thom_vram + offset + 0x4000; - assert( offset < 0x2000 ); - if ( *dst == data ) return; - *dst = data; - /* dirty whole scanline */ - m_thom_vmem_dirty[ offset / 40 ] = 1; -} - - - -/* write to video memory through data space */ - -WRITE8_MEMBER( thomson_state::to8_data_lo_w ) -{ - UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_data_vpage + 0x2000 ) & m_ram->mask() ); - assert( offset < 0x2000 ); - if ( *dst == data ) - return; - *dst = data; - /* dirty whole scanline */ - if ( m_to8_data_vpage >= 4 ) - return; - m_thom_vmem_dirty[ offset / 40 ] = 1; -} - - - -WRITE8_MEMBER( thomson_state::to8_data_hi_w ) -{ - UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_data_vpage ) & m_ram->mask() ); - assert( offset < 0x2000 ); - if ( *dst == data ) - return; - *dst = data; - /* dirty whole scanline */ - if ( m_to8_data_vpage >= 4 ) - return; - m_thom_vmem_dirty[ offset / 40 ] = 1; -} - - - -/* write to video memory page through cartridge addresses space */ -WRITE8_MEMBER( thomson_state::to8_vcart_w ) -{ - UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() ); - assert( offset < 0x4000 ); - if ( *dst == data ) - return; - *dst = data; - /* dirty whole scanline */ - if ( m_to8_cart_vpage >= 4 ) - return; - m_thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = 1; -} - -WRITE8_MEMBER( thomson_state::mo6_vcart_lo_w ) -{ - UINT8* dst = m_thom_vram + ( ( offset + 0x3000 + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() ); - assert( offset < 0x1000 ); - if ( *dst == data ) - return; - *dst = data; - /* dirty whole scanline */ - if ( m_to8_cart_vpage >= 4 ) - return; - m_thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = 1; -} - -WRITE8_MEMBER( thomson_state::mo6_vcart_hi_w ) -{ - UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() ); - assert( offset < 0x3000 ); - if ( *dst == data ) - return; - *dst = data; - /* dirty whole scanline */ - if ( m_to8_cart_vpage >= 4 ) - return; - m_thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = 1; -} diff --git a/src/mess/video/ti85.c b/src/mess/video/ti85.c deleted file mode 100644 index 92ade7ae6fc..00000000000 --- a/src/mess/video/ti85.c +++ /dev/null @@ -1,194 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha,Jon Sturm -/*************************************************************************** - TI-85 driver by Krzysztof Strzecha - - Functions to emulate the video hardware of the TI-85 - -***************************************************************************/ - -#include "emu.h" -#include "includes/ti85.h" - -#define TI81_VIDEO_MEMORY_SIZE 768 -#define TI81_SCREEN_X_SIZE 12 -#define TI81_SCREEN_Y_SIZE 64 -#define TI81_NUMBER_OF_FRAMES 6 - -#define TI85_VIDEO_MEMORY_SIZE 1024 -#define TI85_SCREEN_X_SIZE 16 -#define TI85_SCREEN_Y_SIZE 64 -#define TI85_NUMBER_OF_FRAMES 6 - -#define TI86_VIDEO_MEMORY_SIZE 1024 -#define TI86_SCREEN_X_SIZE 16 -#define TI86_SCREEN_Y_SIZE 64 -#define TI86_NUMBER_OF_FRAMES 6 - - - -static const unsigned char ti85_colors[32*7][3] = -{ - { 0xae, 0xcd, 0xb0 }, { 0xaa, 0xc9, 0xae }, { 0xa6, 0xc5, 0xad }, { 0xa3, 0xc1, 0xab }, { 0x9f, 0xbd, 0xaa }, { 0x9b, 0xb9, 0xa8 }, { 0x98, 0xb5, 0xa7 }, //0x00 - { 0xae, 0xcd, 0xb0 }, { 0xa9, 0xc8, 0xae }, { 0xa4, 0xc3, 0xac }, { 0xa0, 0xbe, 0xaa }, { 0x9b, 0xb9, 0xa8 }, { 0x96, 0xb4, 0xa6 }, { 0x92, 0xaf, 0xa4 }, //0x01 - { 0xae, 0xcd, 0xb0 }, { 0xa8, 0xc7, 0xad }, { 0xa2, 0xc1, 0xab }, { 0x9d, 0xbb, 0xa9 }, { 0x97, 0xb5, 0xa6 }, { 0x91, 0xaf, 0xa4 }, { 0x8c, 0xa9, 0xa2 }, //0x02 - { 0xae, 0xcd, 0xb0 }, { 0xa7, 0xc6, 0xad }, { 0xa0, 0xbf, 0xaa }, { 0x9a, 0xb8, 0xa7 }, { 0x93, 0xb1, 0xa4 }, { 0x8c, 0xaa, 0xa1 }, { 0x86, 0xa3, 0x9f }, //0x03 - { 0xae, 0xcd, 0xb0 }, { 0xa6, 0xc5, 0xac }, { 0x9f, 0xbd, 0xa9 }, { 0x97, 0xb5, 0xa6 }, { 0x90, 0xad, 0xa3 }, { 0x88, 0xa5, 0xa0 }, { 0x81, 0x9d, 0x9d }, //0x04 - { 0xae, 0xcd, 0xb0 }, { 0xa5, 0xc4, 0xac }, { 0x9d, 0xbb, 0xa8 }, { 0x94, 0xb2, 0xa5 }, { 0x8c, 0xa9, 0xa1 }, { 0x83, 0xa0, 0x9d }, { 0x7b, 0x97, 0x9a }, //0x05 - { 0xae, 0xcd, 0xb0 }, { 0xa4, 0xc3, 0xac }, { 0x9b, 0xb9, 0xa8 }, { 0x91, 0xaf, 0xa4 }, { 0x88, 0xa5, 0xa0 }, { 0x7e, 0x9b, 0x9c }, { 0x75, 0x92, 0x98 }, //0x06 - { 0xae, 0xcd, 0xb0 }, { 0xa3, 0xc2, 0xab }, { 0x99, 0xb7, 0xa7 }, { 0x8e, 0xac, 0xa3 }, { 0x84, 0xa1, 0x9e }, { 0x79, 0x96, 0x9a }, { 0x6f, 0x8c, 0x96 }, //0x07 - { 0xae, 0xcd, 0xb0 }, { 0xa2, 0xc1, 0xab }, { 0x97, 0xb5, 0xa6 }, { 0x8c, 0xa9, 0xa1 }, { 0x80, 0x9d, 0x9c }, { 0x75, 0x91, 0x97 }, { 0x6a, 0x86, 0x93 }, //0x08 - { 0xae, 0xcd, 0xb0 }, { 0xa1, 0xc0, 0xaa }, { 0x95, 0xb3, 0xa5 }, { 0x89, 0xa6, 0xa0 }, { 0x7c, 0x99, 0x9b }, { 0x70, 0x8c, 0x96 }, { 0x64, 0x80, 0x91 }, //0x09 - { 0xae, 0xcd, 0xb0 }, { 0xa0, 0xbf, 0xaa }, { 0x93, 0xb1, 0xa4 }, { 0x86, 0xa3, 0x9f }, { 0x78, 0x95, 0x99 }, { 0x6b, 0x87, 0x93 }, { 0x5e, 0x7a, 0x8e }, //0x0a - { 0xae, 0xcd, 0xb0 }, { 0x9f, 0xbe, 0xaa }, { 0x91, 0xaf, 0xa4 }, { 0x83, 0xa0, 0x9e }, { 0x74, 0x91, 0x98 }, { 0x66, 0x82, 0x92 }, { 0x58, 0x74, 0x8c }, //0x0b - { 0xae, 0xcd, 0xb0 }, { 0x9e, 0xbd, 0xa9 }, { 0x8f, 0xad, 0xa3 }, { 0x80, 0x9e, 0x9d }, { 0x71, 0x8e, 0x96 }, { 0x62, 0x7e, 0x90 }, { 0x53, 0x6f, 0x8a }, //0x0c - { 0xa9, 0xc8, 0xae }, { 0x9a, 0xb9, 0xa8 }, { 0x8c, 0xaa, 0xa2 }, { 0x7e, 0x9b, 0x9c }, { 0x6f, 0x8c, 0x96 }, { 0x61, 0x7d, 0x90 }, { 0x53, 0x6f, 0x8a }, //0x0d - { 0xa4, 0xc3, 0xac }, { 0x96, 0xb5, 0xa6 }, { 0x89, 0xa7, 0xa0 }, { 0x7b, 0x99, 0x9b }, { 0x6e, 0x8b, 0x95 }, { 0x60, 0x7d, 0x8f }, { 0x53, 0x6f, 0x8a }, //0x0e - { 0xa0, 0xbe, 0xaa }, { 0x93, 0xb0, 0xa4 }, { 0x86, 0xa3, 0x9f }, { 0x79, 0x96, 0x9a }, { 0x6c, 0x89, 0x94 }, { 0x5f, 0x7c, 0x8f }, { 0x53, 0x6f, 0x8a }, //0x0f - { 0x9b, 0xba, 0xa8 }, { 0x8f, 0xad, 0xa3 }, { 0x83, 0xa1, 0x9e }, { 0x77, 0x94, 0x99 }, { 0x6b, 0x88, 0x94 }, { 0x5f, 0x7b, 0x8f }, { 0x53, 0x6f, 0x8a }, //0x10 - { 0x97, 0xb5, 0xa6 }, { 0x8b, 0xa9, 0xa1 }, { 0x80, 0x9d, 0x9c }, { 0x75, 0x92, 0x98 }, { 0x69, 0x86, 0x93 }, { 0x5e, 0x7a, 0x8e }, { 0x53, 0x6f, 0x8a }, //0x11 - { 0x92, 0xb0, 0xa4 }, { 0x87, 0xa5, 0x9f }, { 0x7d, 0x9a, 0x9b }, { 0x72, 0x8f, 0x97 }, { 0x68, 0x84, 0x92 }, { 0x5d, 0x79, 0x8e }, { 0x53, 0x6f, 0x8a }, //0x12 - { 0x8e, 0xac, 0xa2 }, { 0x84, 0xa1, 0x9e }, { 0x7a, 0x97, 0x9a }, { 0x70, 0x8d, 0x96 }, { 0x66, 0x83, 0x92 }, { 0x5c, 0x79, 0x8e }, { 0x53, 0x6f, 0x8a }, //0x13 - { 0x89, 0xa7, 0xa0 }, { 0x80, 0x9d, 0x9c }, { 0x77, 0x94, 0x98 }, { 0x6e, 0x8b, 0x95 }, { 0x65, 0x81, 0x91 }, { 0x5c, 0x78, 0x8d }, { 0x53, 0x6f, 0x8a }, //0x14 - { 0x85, 0xa2, 0x9e }, { 0x7c, 0x99, 0x9a }, { 0x74, 0x91, 0x97 }, { 0x6c, 0x88, 0x94 }, { 0x63, 0x80, 0x90 }, { 0x5b, 0x77, 0x8d }, { 0x53, 0x6f, 0x8a }, //0x15 - { 0x80, 0x9e, 0x9d }, { 0x78, 0x96, 0x99 }, { 0x71, 0x8e, 0x96 }, { 0x69, 0x86, 0x93 }, { 0x62, 0x7e, 0x90 }, { 0x5a, 0x76, 0x8d }, { 0x53, 0x6f, 0x8a }, //0x16 - { 0x7c, 0x99, 0x9b }, { 0x75, 0x92, 0x98 }, { 0x6e, 0x8b, 0x95 }, { 0x67, 0x84, 0x92 }, { 0x60, 0x7d, 0x8f }, { 0x59, 0x76, 0x8c }, { 0x53, 0x6f, 0x8a }, //0x17 - { 0x77, 0x94, 0x99 }, { 0x71, 0x8d, 0x96 }, { 0x6b, 0x87, 0x94 }, { 0x65, 0x81, 0x91 }, { 0x5f, 0x7b, 0x8f }, { 0x59, 0x75, 0x8c }, { 0x53, 0x6f, 0x8a }, //0x18 - { 0x73, 0x90, 0x97 }, { 0x6d, 0x8a, 0x94 }, { 0x68, 0x85, 0x92 }, { 0x63, 0x7f, 0x90 }, { 0x5d, 0x7a, 0x8e }, { 0x58, 0x74, 0x8c }, { 0x53, 0x6f, 0x8a }, //0x19 - { 0x6e, 0x8b, 0x95 }, { 0x69, 0x86, 0x93 }, { 0x65, 0x81, 0x91 }, { 0x60, 0x7d, 0x8f }, { 0x5c, 0x78, 0x8d }, { 0x57, 0x73, 0x8b }, { 0x53, 0x6f, 0x8a }, //0x1a - { 0x6a, 0x86, 0x93 }, { 0x66, 0x82, 0x91 }, { 0x62, 0x7e, 0x90 }, { 0x5e, 0x7a, 0x8e }, { 0x5a, 0x76, 0x8d }, { 0x56, 0x72, 0x8b }, { 0x53, 0x6f, 0x8a }, //0x1b - { 0x65, 0x82, 0x91 }, { 0x62, 0x7e, 0x8f }, { 0x5f, 0x7b, 0x8e }, { 0x5c, 0x78, 0x8d }, { 0x59, 0x75, 0x8c }, { 0x56, 0x72, 0x8b }, { 0x53, 0x6f, 0x8a }, //0x1c - { 0x61, 0x7d, 0x8f }, { 0x5e, 0x7a, 0x8e }, { 0x5c, 0x78, 0x8d }, { 0x5a, 0x76, 0x8c }, { 0x57, 0x73, 0x8b }, { 0x55, 0x71, 0x8a }, { 0x53, 0x6f, 0x8a }, //0x1d - { 0x5c, 0x78, 0x8d }, { 0x5a, 0x76, 0x8c }, { 0x59, 0x75, 0x8c }, { 0x57, 0x73, 0x8b }, { 0x56, 0x72, 0x8b }, { 0x54, 0x70, 0x8a }, { 0x53, 0x6f, 0x8a }, //0x1e - { 0x57, 0x74, 0x8c }, { 0x56, 0x73, 0x8b }, { 0x55, 0x72, 0x8b }, { 0x55, 0x71, 0x8b }, { 0x54, 0x70, 0x8a }, { 0x53, 0x6f, 0x8a }, { 0x53, 0x6f, 0x8a } //0x1f -}; - -static const unsigned short ti85_palette[32][7] = -{ - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 }, - { 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d }, - { 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14 }, - { 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b }, - { 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22 }, - { 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29 }, - { 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30 }, - { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 }, - { 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e }, - { 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45 }, - { 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c }, - { 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53 }, - { 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a }, - { 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61 }, - { 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68 }, - { 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f }, - { 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76 }, - { 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d }, - { 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84 }, - { 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b }, - { 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92 }, - { 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 }, - { 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 }, - { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7 }, - { 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae }, - { 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5 }, - { 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc }, - { 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3 }, - { 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca }, - { 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1 }, - { 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 }, - { 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf } -}; - -PALETTE_INIT_MEMBER(ti85_state, ti85) -{ - UINT8 i, j, r, g, b; - - for ( i = 0; i < 224; i++ ) - { - r = ti85_colors[i][0]; g = ti85_colors[i][1]; b = ti85_colors[i][2]; - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - for (i=0; i < 32; i++) - for (j=0; j < 7; j++) - palette.set_pen_indirect(i*7+j, ti85_palette[i][j]); - - if (!strncmp(machine().system().name, "ti81", 4)) - { - m_ti_video_memory_size = TI81_VIDEO_MEMORY_SIZE; - m_ti_screen_x_size = TI81_SCREEN_X_SIZE; - m_ti_screen_y_size = TI81_SCREEN_Y_SIZE; - m_ti_number_of_frames = TI81_NUMBER_OF_FRAMES; - } - else if (!strncmp(machine().system().name, "ti85", 4)) - { - m_ti_video_memory_size = TI85_VIDEO_MEMORY_SIZE; - m_ti_screen_x_size = TI85_SCREEN_X_SIZE; - m_ti_screen_y_size = TI85_SCREEN_Y_SIZE; - m_ti_number_of_frames = TI85_NUMBER_OF_FRAMES; - } - else if (!strncmp(machine().system().name, "ti86", 4)) - { - m_ti_video_memory_size = TI86_VIDEO_MEMORY_SIZE; - m_ti_screen_x_size = TI86_SCREEN_X_SIZE; - m_ti_screen_y_size = TI86_SCREEN_Y_SIZE; - m_ti_number_of_frames = TI86_NUMBER_OF_FRAMES; - } - else - { - /* don't allocate memory for the others drivers */ - return; - } - - m_frames = auto_alloc_array_clear(machine(), UINT8, m_ti_number_of_frames*m_ti_video_memory_size); -} - -void ti85_state::video_start() -{ -} - -UINT32 ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - address_space &space = m_maincpu->space(AS_PROGRAM); - int x,y,b; - int brightnes; - int lcdmem; - - if (!m_LCD_status || !m_timer_interrupt_mask) - { - for (y=0; y>(7-b)) & 0x01) - + ((*(m_frames+1*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) - + ((*(m_frames+2*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) - + ((*(m_frames+3*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) - + ((*(m_frames+4*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) - + ((*(m_frames+5*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01); - - bitmap.pix16(y, x*8+b) = ti85_palette[m_LCD_contrast&0x1f][brightnes]; - } - return 0; -} - -PALETTE_INIT_MEMBER(ti85_state,ti82) -{ - palette.set_pen_color(0, rgb_t(160, 190, 170)); - palette.set_pen_color(1, rgb_t(83, 111, 138)); -} diff --git a/src/mess/video/timex.c b/src/mess/video/timex.c deleted file mode 100644 index 6b7bd460366..00000000000 --- a/src/mess/video/timex.c +++ /dev/null @@ -1,270 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker -/*************************************************************************** - - timex.c - - Functions to emulate the video hardware of the Timex ZX Spectrum clones. - - Changes: - - DJR 08/02/00 - Added support for FLASH 1. - DJR 16/05/00 - Support for TS2068/TC2048 hires and 64 column modes. - DJR 19/05/00 - Speeded up Spectrum 128 screen refresh. - DJR 23/05/00 - Preliminary support for border colour emulation. - -***************************************************************************/ - -#include "emu.h" -#include "includes/spectrum.h" -#include "machine/ram.h" - -inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix16(y, x) = (UINT16)color; -} - -/* Update FLASH status for ts2068. Assumes flash update every 1/2s. */ -VIDEO_START_MEMBER(spectrum_state,ts2068) -{ - VIDEO_START_CALL_MEMBER( spectrum ); - m_frame_invert_count = 30; -} - -void spectrum_state::screen_eof_timex(screen_device &screen, bool state) -{ - // rising edge - if (state) - { - spectrum_UpdateBorderBitmap(); - - m_frame_number++; - - if (m_frame_number >= m_frame_invert_count) - { - m_frame_number = 0; - m_flash_invert = !m_flash_invert; - } - } -} - - -/******************************************************************* - * - * Update the TS2068 display. - * - * Port ff is used to set the display mode. - * - * bits 2..0 Video Mode Select - * 000 = Primary DFILE active (at 0x4000-0x5aff) - * 001 = Secondary DFILE active (at 0x6000-0x7aff) - * 010 = Extended Colour Mode (chars at 0x4000-0x57ff, colors 0x6000-0x7aff) - * 110 = 64 column mode (columns 0,2,4,...62 from DFILE 1 - * columns 1,3,5,...63 from DFILE 2) - * other = unpredictable results - * - * bits 5..3 64 column mode ink/paper selection (attribute value in brackets) - * 000 = Black/White (56) 100 = Green/Magenta (28) - * 001 = Blue/Yellow (49) 101 = Cyan/Red (21) - * 010 = Red/Cyan (42) 110 = Yellow/Blue (14) - * 011 = Magenta/Green (35) 111 = White/Black (7) - * - *******************************************************************/ - -/* Draw a scanline in TS2068/TC2048 hires mode (code modified from COUPE.C) */ -void spectrum_state::ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines) -{ - int x,b,scrx,scry; - unsigned short ink,pap; - unsigned char *attr, *scr; - - scrx=TS2068_LEFT_BORDER; - scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - - scr=m_ram->pointer() + y*32; - attr=scr + 0x2000; - - for (x=0;x<32;x++) - { - /* Get ink and paper colour with bright */ - if (m_flash_invert && (*attr & 0x80)) - { - ink=((*attr)>>3) & 0x0f; - pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - } - else - { - ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - pap=((*attr)>>3) & 0x0f; - } - - for (b=0x80;b!=0;b>>=1) - { - if (*scr&b) - { - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,ink); - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,ink); - } - else - { - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,pap); - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,pap); - } - } - scr++; - attr++; - } -} - -/* Draw a scanline in TS2068/TC2048 64-column mode */ -void spectrum_state::ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor) -{ - int x,b,scrx,scry; - unsigned char *scr1, *scr2; - - scrx=TS2068_LEFT_BORDER; - scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - - scr1=m_ram->pointer() + y*32; - scr2=scr1 + 0x2000; - - for (x=0;x<32;x++) - { - for (b=0x80;b!=0;b>>=1) - { - if (*scr1&b) - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,inkcolor); - else - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,7-inkcolor); - } - scr1++; - - for (b=0x80;b!=0;b>>=1) - { - if (*scr2&b) - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,inkcolor); - else - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,7-inkcolor); - } - scr2++; - } -} - -/* Draw a scanline in TS2068/TC2048 lores (normal Spectrum) mode */ -void spectrum_state::ts2068_lores_scanline(bitmap_ind16 &bitmap, int y, int borderlines, int screen) -{ - int x,b,scrx,scry; - unsigned short ink,pap; - unsigned char *attr, *scr; - - scrx=TS2068_LEFT_BORDER; - scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - - scr = m_ram->pointer() + y*32 + screen*0x2000; - attr = m_ram->pointer() + ((scry>>3)*32) + screen*0x2000 + 0x1800; - - for (x=0;x<32;x++) - { - /* Get ink and paper colour with bright */ - if (m_flash_invert && (*attr & 0x80)) - { - ink=((*attr)>>3) & 0x0f; - pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - } - else - { - ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - pap=((*attr)>>3) & 0x0f; - } - - for (b=0x80;b!=0;b>>=1) - { - if (*scr&b) - { - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,ink); - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,ink); - } - else - { - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,pap); - spectrum_plot_pixel(bitmap,scrx++,scry+borderlines,pap); - } - } - scr++; - attr++; - } -} - -UINT32 spectrum_state::screen_update_ts2068(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* for now TS2068 will do a full-refresh */ - int count; - - if (m_border_bitmap.valid()) - copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect); - - if ((m_port_ff_data & 7) == 6) - { - /* 64 Column mode */ - unsigned short inkcolor = (m_port_ff_data & 0x38) >> 3; - for (count = 0; count < 192; count++) - ts2068_64col_scanline(bitmap, count, TS2068_TOP_BORDER, inkcolor); - } - else if ((m_port_ff_data & 7) == 2) - { - /* Extended Color mode */ - for (count = 0; count < 192; count++) - ts2068_hires_scanline(bitmap, count, TS2068_TOP_BORDER); - } - else if ((m_port_ff_data & 7) == 1) - { - /* Screen 6000-7aff */ - for (count = 0; count < 192; count++) - ts2068_lores_scanline(bitmap, count, TS2068_TOP_BORDER, 1); - } - else - { - /* Screen 4000-5aff */ - for (count = 0; count < 192; count++) - ts2068_lores_scanline(bitmap, count, TS2068_TOP_BORDER, 0); - } - - return 0; -} - -UINT32 spectrum_state::screen_update_tc2048(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* for now TS2068 will do a full-refresh */ - int count; - - if (m_border_bitmap.valid()) - copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect); - - if ((m_port_ff_data & 7) == 6) - { - /* 64 Column mode */ - unsigned short inkcolor = (m_port_ff_data & 0x38) >> 3; - for (count = 0; count < 192; count++) - ts2068_64col_scanline(bitmap, count, SPEC_TOP_BORDER, inkcolor); - } - else if ((m_port_ff_data & 7) == 2) - { - /* Extended Color mode */ - for (count = 0; count < 192; count++) - ts2068_hires_scanline(bitmap, count, SPEC_TOP_BORDER); - } - else if ((m_port_ff_data & 7) == 1) - { - /* Screen 6000-7aff */ - for (count = 0; count < 192; count++) - ts2068_lores_scanline(bitmap, count, SPEC_TOP_BORDER, 1); - } - else - { - /* Screen 4000-5aff */ - for (count = 0; count < 192; count++) - ts2068_lores_scanline(bitmap, count, SPEC_TOP_BORDER, 0); - } - - return 0; -} diff --git a/src/mess/video/tmc1800.c b/src/mess/video/tmc1800.c deleted file mode 100644 index 57aef139bef..00000000000 --- a/src/mess/video/tmc1800.c +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "emu.h" -#include "includes/tmc1800.h" -#include "cpu/cosmac/cosmac.h" -#include "video/cdp1861.h" -#include "sound/cdp1864.h" -#include "machine/rescap.h" - -/* Telmac 2000 */ - -READ_LINE_MEMBER( tmc2000_state::rdata_r ) -{ - return BIT(m_color, 2); -} - -READ_LINE_MEMBER( tmc2000_state::bdata_r ) -{ - return BIT(m_color, 1); -} - -READ_LINE_MEMBER( tmc2000_state::gdata_r ) -{ - return BIT(m_color, 0); -} - -/* OSM-200 */ - -UINT32 osc1000b_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return 0; -} - -/* Machine Drivers */ - -MACHINE_CONFIG_FRAGMENT( tmc1800_video ) - MCFG_DEVICE_ADD(CDP1861_TAG, CDP1861, XTAL_1_75MHz) - MCFG_CDP1861_IRQ_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) - MCFG_CDP1861_DMA_OUT_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT)) - MCFG_CDP1861_EFX_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) - MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_1_75MHz) -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( osc1000b_video ) - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DRIVER(osc1000b_state, screen_update) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_SIZE(320, 200) - MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 199) -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( tmc2000_video ) - MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) - MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(tmc2000_state, rdata_r), READLINE(tmc2000_state, bdata_r), READLINE(tmc2000_state, gdata_r)) - MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_K(2.05), RES_K(2.26), RES_K(3.92)) // RL64, RL63, RL61, RL65 (also RH62 (2K pot) in series, but ignored here) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( nano_video ) - MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) - MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, VCC, VCC, VCC) - MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_INF, RES_INF, 0) // R18 (unconfirmed) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END diff --git a/src/mess/video/tmc600.c b/src/mess/video/tmc600.c deleted file mode 100644 index f36568af698..00000000000 --- a/src/mess/video/tmc600.c +++ /dev/null @@ -1,141 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "emu.h" -#include "sound/cdp1869.h" -#include "includes/tmc600.h" - -WRITE8_MEMBER( tmc600_state::vismac_register_w ) -{ - m_vismac_reg_latch = data; -} - -WRITE8_MEMBER( tmc600_state::vismac_data_w ) -{ - UINT16 ma = m_maincpu->get_memory_address(); - - switch (m_vismac_reg_latch) - { - case 0x20: - // character color latch - m_vismac_color_latch = data; - break; - - case 0x30: - // background color latch - m_vismac_bkg_latch = data & 0x07; - - m_vis->out3_w(space, ma, data); - break; - - case 0x40: - m_vis->out4_w(space, ma, data); - break; - - case 0x50: - m_vis->out5_w(space, ma, data); - break; - - case 0x60: - m_vis->out6_w(space, ma, data); - break; - - case 0x70: - m_vis->out7_w(space, ma, data); - break; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(tmc600_state::blink_tick) -{ - m_blink = !m_blink; -} - -UINT8 tmc600_state::get_color(UINT16 pma) -{ - UINT16 pageaddr = pma & TMC600_PAGE_RAM_MASK; - UINT8 color = m_color_ram[pageaddr]; - - if (BIT(color, 3) && m_blink) - { - color = m_vismac_bkg_latch; - } - - return color; -} - -WRITE8_MEMBER( tmc600_state::page_ram_w ) -{ - m_page_ram[offset] = data; - m_color_ram[offset] = m_vismac_color_latch; -} - -static ADDRESS_MAP_START( cdp1869_page_ram, AS_0, 8, tmc600_state ) - AM_RANGE(0x000, 0x3ff) AM_MIRROR(0x400) AM_RAM AM_SHARE("page_ram") AM_WRITE(page_ram_w) -ADDRESS_MAP_END - -CDP1869_CHAR_RAM_READ_MEMBER( tmc600_state::tmc600_char_ram_r ) -{ - UINT16 pageaddr = pma & TMC600_PAGE_RAM_MASK; - UINT8 color = get_color(pageaddr); - UINT16 charaddr = ((cma & 0x08) << 8) | (pmd << 3) | (cma & 0x07); - UINT8 cdb = m_char_rom[charaddr] & 0x3f; - - int ccb0 = BIT(color, 2); - int ccb1 = BIT(color, 1); - - return (ccb1 << 7) | (ccb0 << 6) | cdb; -} - -CDP1869_PCB_READ_MEMBER( tmc600_state::tmc600_pcb_r ) -{ - UINT16 pageaddr = pma & TMC600_PAGE_RAM_MASK; - UINT8 color = get_color(pageaddr); - - return BIT(color, 0); -} - -void tmc600_state::video_start() -{ - // allocate memory - m_color_ram.allocate(TMC600_PAGE_RAM_SIZE); - - // register for state saving - save_item(NAME(m_vismac_reg_latch)); - save_item(NAME(m_vismac_color_latch)); - save_item(NAME(m_vismac_bkg_latch)); - save_item(NAME(m_blink)); -} - -static const gfx_layout tmc600_charlayout = -{ - 6, 9, // 6 x 9 characters - 256, // 256 characters - 1, // 1 bits per pixel - { 0 }, // no bitplanes - // x offsets - { 2, 3, 4, 5, 6, 7 }, - // y offsets - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 2048*8 }, - 8*8 // every char takes 8 x 8 bytes -}; - -static GFXDECODE_START( tmc600 ) - GFXDECODE_ENTRY( "chargen", 0x0000, tmc600_charlayout, 0, 36 ) -GFXDECODE_END - -MACHINE_CONFIG_FRAGMENT( tmc600_video ) - // video hardware - MCFG_CDP1869_SCREEN_PAL_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL) - MCFG_TIMER_DRIVER_ADD_PERIODIC("blink", tmc600_state, blink_tick, attotime::from_hz(2)) - - MCFG_GFXDECODE_ADD("gfxdecode", CDP1869_TAG":palette", tmc600) - - // sound hardware - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_CDP1869_ADD(CDP1869_TAG, CDP1869_DOT_CLK_PAL, cdp1869_page_ram) - MCFG_CDP1869_COLOR_CLOCK(CDP1869_COLOR_CLK_PAL) - MCFG_CDP1869_CHAR_PCB_READ_OWNER(tmc600_state, tmc600_pcb_r) - MCFG_CDP1869_CHAR_RAM_READ_OWNER(tmc600_state, tmc600_char_ram_r) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_CONFIG_END diff --git a/src/mess/video/trs80.c b/src/mess/video/trs80.c deleted file mode 100644 index beb34edc691..00000000000 --- a/src/mess/video/trs80.c +++ /dev/null @@ -1,588 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert and unknown others -/*************************************************************************** - - trs80.c - - Functions to emulate the video hardware of the TRS80. - -***************************************************************************/ - -#include "includes/trs80.h" - -/* Bit assignment for "state->m_mode" - d7 Page select - d6 LNW80 switch to graphics ram - d5 LNW80 colour or monochrome (1=colour) - d4 LNW80 lores or hires (1=hires) also does 64 or 80 chars per line - d3 LNW80 invert entire screen / Model III/4 Invert characters with bit 7 set (1=invert) - d2 80/40 or 64/32 characters per line (1=80) - d1 7 or 8 bit video (1=requires 7-bit, 0=don't care) - d0 80/64 or 40/32 characters per line (1=32) */ - - -WRITE8_MEMBER( trs80_state::trs80m4_88_w ) -{ -/* This is for the programming of the CRTC registers. - However this CRTC is mask-programmed, and only the - start address register can be used. The cursor and - light-pen facilities are ignored. The character clock - is changed depending on the screen size chosen. - Therefore it is easier to use normal - coding rather than the mc6845 device. */ - - if (!offset) m_crtc_reg = data & 0x1f; - - if (offset) switch (m_crtc_reg) - { - case 12: - m_start_address = (m_start_address & 0x00ff) | (data << 8); - break; - case 13: - m_start_address = (m_start_address & 0xff00) | data; - } -} - - -void trs80_state::video_start() -{ - m_p_chargen = memregion("chargen")->base(); - m_size_store = 0xff; - m_mode &= 2; -} - - -/* 7 or 8-bit video, 32/64 characters per line = trs80, trs80l2, sys80 */ -UINT32 trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,gfxbit; - UINT16 sy=0,ma=0,x; - UINT8 cols = BIT(m_mode, 0) ? 32 : 64; - UINT8 skip = BIT(m_mode, 0) ? 2 : 1; - - if (m_mode != m_size_store) - { - m_size_store = m_mode & 1; - screen.set_visible_area(0, cols*6-1, 0, 16*12-1); - } - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 12; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x+=skip) - { - chr = m_p_videoram[x]; - - if (chr & 0x80) - { - gfxbit = (ra & 0x0c)>>1; - /* Display one line of a lores character (6 pixels) */ - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - gfxbit++; - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - } - else - { - if (BIT(m_mode, 1) & (chr < 32)) chr+=64; - - // if g,j,p,q,y; lower the descender - if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79)) - { - if ((ra < 10) && (ra > 1)) - gfx = m_p_chargen[(chr<<3) | (ra-2) ]; - else - gfx = 0; - } - else - { - if (ra < 8) - gfx = m_p_chargen[(chr<<3) | ra ]; - else - gfx = 0; - } - - /* Display a scanline of a character (6 pixels) */ - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - } - ma+=64; - } - return 0; -} - -/* 8-bit video, 32/64/40/80 characters per line = trs80m3, trs80m4. */ -UINT32 trs80_state::screen_update_trs80m4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,gfxbit; - UINT16 sy=0,ma=0,x; - UINT8 skip=1; - UINT8 cols = BIT(m_mode, 2) ? 80 : 64; - UINT8 rows = BIT(m_mode, 2) ? 24 : 16; - UINT8 lines = BIT(m_mode, 2) ? 10 : 12; - UINT8 s_cols = cols; - UINT8 mask = BIT(m_mode, 5) ? 0xff : 0xbf; /* Select Japanese or extended chars */ - - if (m_mode & 1) - { - s_cols >>= 1; - skip = 2; - } - - if ((m_mode & 0x7f) != m_size_store) - { - m_size_store = m_mode & 5; - screen.set_visible_area(0, s_cols*8-1, 0, rows*lines-1); - } - - for (y = 0; y < rows; y++) - { - for (ra = 0; ra < lines; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + cols; x+=skip) - { - chr = m_p_videoram[x+m_start_address]; - - if (((chr & 0xc0) == 0xc0) && (~m_mode & 8)) - { - if (ra < 8) - gfx = m_p_chargen[((chr&mask)<<3) | ra ]; - else - gfx = 0; - - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - else - if ((chr & 0x80) && (~m_mode & 8)) - { - gfxbit = (ra & 0x0c)>>1; - /* Display one line of a lores character */ - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - gfxbit++; - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - } - else - { - /* get pattern of pixels for that character scanline */ - if (ra < 8) - gfx = m_p_chargen[((chr&0x7f)<<3) | ra ]; - else - gfx = 0; - - /* if inverse mode, and bit 7 set, invert gfx */ - if (BIT(m_mode, 3) & BIT(chr, 7)) - gfx ^= 0xff; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - } - ma+=cols; - } - return 0; -} - -/* 7 or 8-bit video, 64/32 characters per line = ht1080z, ht1080z2, ht108064 */ -UINT32 trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx,gfxbit; - UINT16 sy=0,ma=0,x; - UINT8 cols = BIT(m_mode, 0) ? 32 : 64; - UINT8 skip = BIT(m_mode, 0) ? 2 : 1; - - if (m_mode != m_size_store) - { - m_size_store = m_mode & 1; - screen.set_visible_area(0, cols*6-1, 0, 16*12-1); - } - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 12; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x+=skip) - { - chr = m_p_videoram[x]; - - if (chr & 0x80) - { - gfxbit = (ra & 0x0c)>>1; - /* Display one line of a lores character (6 pixels) */ - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - gfxbit++; - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - *p++ = BIT(chr, gfxbit); - } - else - { - if ((m_mode & 2) && (chr < 32)) chr+=64; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra ]; - - /* Display a scanline of a character (6 pixels) */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = 0; /* fix for ht108064 */ - } - } - } - ma+=64; - } - return 0; -} - -/* 8-bit video, 64/80 characters per line = lnw80 */ -UINT32 trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - static const UINT16 rows[] = { 0, 0x200, 0x100, 0x300, 1, 0x201, 0x101, 0x301 }; - UINT8 chr,gfx,gfxbit,bg=7,fg=0; - UINT16 sy=0,ma=0,x,y,ra; - UINT8 cols = BIT(m_mode, 4) ? 80 : 64; - - /* Although the OS can select 32-character mode, it is not supported by hardware */ - if (m_mode != m_size_store) - { - m_size_store = m_mode & 0x10; - screen.set_visible_area(0, cols*6-1, 0, 16*12-1); - } - - if (m_mode & 8) - { - bg = 0; - fg = 7; - } - - switch (m_mode & 0x30) - { - case 0: // MODE 0 - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 12; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x++) - { - chr = m_p_videoram[x]; - - if (chr & 0x80) - { - gfxbit = (ra & 0x0c)>>1; - /* Display one line of a lores character (6 pixels) */ - *p++ = BIT(chr, gfxbit) ? fg : bg; - *p++ = BIT(chr, gfxbit) ? fg : bg; - *p++ = BIT(chr, gfxbit) ? fg : bg; - gfxbit++; - *p++ = BIT(chr, gfxbit) ? fg : bg; - *p++ = BIT(chr, gfxbit) ? fg : bg; - *p++ = BIT(chr, gfxbit) ? fg : bg; - } - else - { - /* get pattern of pixels for that character scanline */ - if (ra < 8) - gfx = m_p_chargen[(chr<<1) | rows[ra] ]; - else - gfx = 0; - - /* Display a scanline of a character (6 pixels) */ - *p++ = BIT(gfx, 2) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 6) ? fg : bg; - *p++ = BIT(gfx, 7) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - *p++ = BIT(gfx, 3) ? fg : bg; - } - } - } - ma+=64; - } - break; - - case 0x10: // MODE 1 - for (y = 0; y < 0x400; y+=0x40) - { - for (ra = 0; ra < 0x3000; ra+=0x400) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 0x40; x++) - { - gfx = m_p_gfxram[ y | x | ra]; - /* Display 6 pixels in normal region */ - *p++ = BIT(gfx, 0) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - } - - for (x = 0; x < 0x10; x++) - { - gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; - /* Display 6 pixels in extended region */ - *p++ = BIT(gfx, 0) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - } - } - } - break; - - case 0x20: // MODE 2 - /* it seems the text video ram can have an effect in this mode, - not explained clearly, so not emulated */ - for (y = 0; y < 0x400; y+=0x40) - { - for (ra = 0; ra < 0x3000; ra+=0x400) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 0x40; x++) - { - gfx = m_p_gfxram[ y | x | ra]; - /* Display 6 pixels in normal region */ - fg = (gfx & 0x38) >> 3; - *p++ = fg; - *p++ = fg; - *p++ = fg; - fg = gfx & 0x07; - *p++ = fg; - *p++ = fg; - *p++ = fg; - } - } - } - break; - - case 0x30: // MODE 3 - /* the manual does not explain at all how colour is determined - for the extended area. Further, the background colour - is not mentioned anywhere. Black is assumed. */ - for (y = 0; y < 0x400; y+=0x40) - { - for (ra = 0; ra < 0x3000; ra+=0x400) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = 0; x < 0x40; x++) - { - gfx = m_p_gfxram[ y | x | ra]; - fg = (m_p_videoram[ 0x3c00 | x | y ] & 0x38) >> 3; - /* Display 6 pixels in normal region */ - *p++ = BIT(gfx, 0) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - fg = m_p_videoram[ 0x3c00 | x | y ] & 0x07; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - } - - for (x = 0; x < 0x10; x++) - { - gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; - fg = (m_p_gfxram[ 0x3c00 | x | y ] & 0x38) >> 3; - /* Display 6 pixels in extended region */ - *p++ = BIT(gfx, 0) ? fg : bg; - *p++ = BIT(gfx, 1) ? fg : bg; - *p++ = BIT(gfx, 2) ? fg : bg; - fg = m_p_gfxram[ 0x3c00 | x | y ] & 0x07; - *p++ = BIT(gfx, 3) ? fg : bg; - *p++ = BIT(gfx, 4) ? fg : bg; - *p++ = BIT(gfx, 5) ? fg : bg; - } - } - } - break; - } - return 0; -} - -/* lores characters are in the character generator. Each character is 8x16. */ -UINT32 trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - UINT8 cols = BIT(m_mode, 0) ? 32 : 64; - UINT8 skip = BIT(m_mode, 0) ? 2 : 1; - - if (m_mode != m_size_store) - { - m_size_store = m_mode & 1; - screen.set_visible_area(0, cols*8-1, 0, 16*16-1); - } - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 16; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x+=skip) - { - chr = m_p_videoram[x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | (ra & 7) | (ra & 8) << 8]; - - /* Display a scanline of a character (8 pixels) */ - *p++ = BIT(gfx, 0); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 7); - } - } - ma+=64; - } - return 0; -} - -UINT32 trs80_state::screen_update_meritum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -/* lores characters are in the character generator. Each character is 6x11. */ -{ - UINT8 y,ra,chr,gfx; - UINT16 sy=0,ma=0,x; - UINT8 cols = BIT(m_mode, 0) ? 32 : 64; - UINT8 skip = BIT(m_mode, 0) ? 2 : 1; - - if (m_mode != m_size_store) - { - m_size_store = m_mode; - screen.set_visible_area(0, cols*6-1, 0, 16*11-1); - } - - for (y = 0; y < 16; y++) - { - for (ra = 0; ra < 11; ra++) - { - UINT16 *p = &bitmap.pix16(sy++); - - for (x = ma; x < ma + 64; x+=skip) - { - chr = m_p_videoram[x]; - - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra]; - - /* Display a scanline of a character (6 pixels) */ - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } - } - ma+=64; - } - return 0; -} - - - -/*************************************************************************** - Write to video ram -***************************************************************************/ - -READ8_MEMBER( trs80_state::trs80_videoram_r ) -{ - if ((m_mode & 0x80) && (~m_model4 & 1)) offset |= 0x400; - return m_p_videoram[offset]; -} - -WRITE8_MEMBER( trs80_state::trs80_videoram_w ) -{ - if ((m_mode & 0x80) && (~m_model4 & 1)) offset |= 0x400; - m_p_videoram[offset] = data; -} - - -/*************************************************************************** - Write to graphics ram -***************************************************************************/ - -READ8_MEMBER( trs80_state::trs80_gfxram_r ) -{ - return m_p_gfxram[offset]; -} - -WRITE8_MEMBER( trs80_state::trs80_gfxram_w ) -{ - m_p_gfxram[offset] = data; -} - - -/*************************************************************************** - Palettes -***************************************************************************/ - -/* Levels are unknown - guessing */ -static const rgb_t lnw80_palette[] = -{ - rgb_t(220, 220, 220), // white - rgb_t(0, 175, 0), // green - rgb_t(200, 200, 0), // yellow - rgb_t(255, 0, 0), // red - rgb_t(255, 0, 255), // magenta - rgb_t(0, 0, 175), // blue - rgb_t(0, 255, 255), // cyan - rgb_t(0, 0, 0), // black -}; - -PALETTE_INIT_MEMBER(trs80_state,lnw80) -{ - palette.set_pen_colors(0, lnw80_palette, ARRAY_LENGTH(lnw80_palette)); -} diff --git a/src/mess/video/tx0.c b/src/mess/video/tx0.c deleted file mode 100644 index 35e105107e7..00000000000 --- a/src/mess/video/tx0.c +++ /dev/null @@ -1,469 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Raphael Nabet -/* - TX-0 - - Raphael Nabet, 2004 -*/ - -#include "emu.h" - -#include "cpu/pdp1/tx0.h" -#include "includes/tx0.h" -#include "video/crt.h" - - - - -inline void tx0_state::tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix16(y, x) = color; -} - -/* - video init -*/ -void tx0_state::video_start() -{ - m_typewriter_color = color_typewriter_black; - - /* alloc bitmaps for our private fun */ - m_panel_bitmap.allocate(panel_window_width, panel_window_height, BITMAP_FORMAT_IND16); - m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16); - - /* set up out bitmaps */ - tx0_draw_panel_backdrop(m_panel_bitmap); - - const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1); - m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds); -} - - -void tx0_state::screen_eof_tx0(screen_device &screen, bool state) -{ - // rising edge - if (state) - { - m_crt->eof(); - } -} - - -/* - schedule a pixel to be plotted -*/ -void tx0_state::tx0_plot(int x, int y) -{ - /* compute pixel coordinates and plot */ - x = x*crt_window_width/0777; - y = y*crt_window_height/0777; - m_crt->plot(x, y); -} - - -/* - screen_update_tx0: effectively redraw the screen -*/ -UINT32 tx0_state::screen_update_tx0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_crt->update(bitmap); - - tx0_draw_panel(m_panel_bitmap); - copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect); - - copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect); - return 0; -} - - - -/* - Operator control panel code -*/ - -enum -{ - x_panel_col1a_offset = 0, - x_panel_col1b_offset = 24, - x_panel_col2_offset = x_panel_col1a_offset+184+8 -}; - -enum -{ - /* column 1: registers, test accumulator, test buffer, toggle switch storage */ - y_panel_pc_offset = 0, - y_panel_mar_offset = y_panel_pc_offset+2*8, - y_panel_mbr_offset = y_panel_mar_offset+2*8, - y_panel_ac_offset = y_panel_mbr_offset+2*8, - y_panel_lr_offset = y_panel_ac_offset+2*8, - y_panel_xr_offset = y_panel_lr_offset+2*8, - y_panel_tbr_offset = y_panel_xr_offset+2*8, - y_panel_tac_offset = y_panel_tbr_offset+2*8, - y_panel_tss_offset = y_panel_tac_offset+2*8, - - /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ - y_panel_stop_c0_offset = 8, - y_panel_stop_c1_offset = y_panel_stop_c0_offset+8, - y_panel_gbl_cm_sel_offset = y_panel_stop_c1_offset+8, - y_panel_run_offset = y_panel_gbl_cm_sel_offset+8, - y_panel_cycle1_offset = y_panel_run_offset+8, - y_panel_cycle2_offset = y_panel_cycle1_offset+8, - y_panel_rim_offset = y_panel_cycle2_offset+8, - y_panel_ioh_offset = y_panel_rim_offset+8, - y_panel_ios_offset = y_panel_ioh_offset+8, - y_panel_ir_offset = y_panel_ios_offset+8, - y_panel_pf_offset = y_panel_ir_offset+2*8 -}; - -/* draw a small 8*8 LED (or is this a lamp? ) */ -void tx0_state::tx0_draw_led(bitmap_ind16 &bitmap, int x, int y, int state) -{ - int xx, yy; - - for (yy=1; yy<7; yy++) - for (xx=1; xx<7; xx++) - tx0_plot_pixel(bitmap, x+xx, y+yy, state ? pen_lit_lamp : pen_unlit_lamp); -} - -/* draw nb_bits leds which represent nb_bits bits in value */ -void tx0_state::tx0_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) -{ - while (nb_bits) - { - nb_bits--; - - tx0_draw_led(bitmap, x, y, (value >> nb_bits) & 1); - - x += 8; - } -} - - -/* draw a small 8*8 switch */ -void tx0_state::tx0_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state) -{ - int xx, yy; - int i; - - /* erase area */ - for (yy=0; yy<8; yy++) - for (xx=0; xx<8; xx++) - tx0_plot_pixel(bitmap, x+xx, y+yy, pen_panel_bg); - - - /* draw nut (-> circle) */ - for (i=0; i<4;i++) - { - tx0_plot_pixel(bitmap, x+2+i, y+1, pen_switch_nut); - tx0_plot_pixel(bitmap, x+2+i, y+6, pen_switch_nut); - tx0_plot_pixel(bitmap, x+1, y+2+i, pen_switch_nut); - tx0_plot_pixel(bitmap, x+6, y+2+i, pen_switch_nut); - } - tx0_plot_pixel(bitmap, x+2, y+2, pen_switch_nut); - tx0_plot_pixel(bitmap, x+5, y+2, pen_switch_nut); - tx0_plot_pixel(bitmap, x+2, y+5, pen_switch_nut); - tx0_plot_pixel(bitmap, x+5, y+5, pen_switch_nut); - - /* draw button (->disc) */ - if (! state) - y += 4; - for (i=0; i<2;i++) - { - tx0_plot_pixel(bitmap, x+3+i, y, pen_switch_button); - tx0_plot_pixel(bitmap, x+3+i, y+3, pen_switch_button); - } - for (i=0; i<4;i++) - { - tx0_plot_pixel(bitmap, x+2+i, y+1, pen_switch_button); - tx0_plot_pixel(bitmap, x+2+i, y+2, pen_switch_button); - } -} - - -/* draw nb_bits switches which represent nb_bits bits in value */ -void tx0_state::tx0_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) -{ - while (nb_bits) - { - nb_bits--; - - tx0_draw_switch(bitmap, x, y, (value >> nb_bits) & 1); - - x += 8; - } -} - - -/* write a single char on screen */ -void tx0_state::tx0_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color) -{ - m_gfxdecode->gfx(0)->transpen(bitmap,bitmap.cliprect(), character-32, color, 0, 0, - x+1, y, 0); -} - -/* write a string on screen */ -void tx0_state::tx0_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) -{ - while (* buf) - { - tx0_draw_char(bitmap, *buf, x, y, color); - - x += 8; - buf++; - } -} - - -/* draw a vertical line */ -void tx0_state::tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color) -{ - while (height--) - tx0_plot_pixel(bitmap, x, y++, color); -} - -#ifdef UNUSED_FUNCTION -/* draw a horizontal line */ -void tx0_state::tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color) -{ - while (width--) - tx0_plot_pixel(bitmap, x++, y, color); -} -#endif - -/* - draw the operator control panel (fixed backdrop) -*/ -void tx0_state::tx0_draw_panel_backdrop(bitmap_ind16 &bitmap) -{ - int i; - char buf[3]; - - /* fill with black */ - const rectangle panel_bitmap_bounds(0, panel_window_width-1, 0, panel_window_height-1); - m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds); - - /* column 1: registers, test accumulator, test buffer, toggle switch storage */ - tx0_draw_string(bitmap, "program counter", x_panel_col1b_offset, y_panel_pc_offset, color_panel_caption); - tx0_draw_string(bitmap, "memory address reg.", x_panel_col1b_offset, y_panel_mar_offset, color_panel_caption); - tx0_draw_string(bitmap, "memory buffer reg.", x_panel_col1b_offset, y_panel_mbr_offset, color_panel_caption); - tx0_draw_string(bitmap, "accumulator", x_panel_col1b_offset, y_panel_ac_offset, color_panel_caption); - tx0_draw_string(bitmap, "live register", x_panel_col1b_offset, y_panel_lr_offset, color_panel_caption); - tx0_draw_string(bitmap, "index register", x_panel_col1b_offset, y_panel_xr_offset, color_panel_caption); - tx0_draw_string(bitmap, "TBR", x_panel_col1b_offset, y_panel_tbr_offset, color_panel_caption); - tx0_draw_string(bitmap, "TAC", x_panel_col1b_offset, y_panel_tac_offset, color_panel_caption); - tx0_draw_string(bitmap, "cm", x_panel_col1a_offset+8, y_panel_tss_offset, color_panel_caption); - tx0_draw_string(bitmap, "TSS", x_panel_col1a_offset+24, y_panel_tss_offset, color_panel_caption); - tx0_draw_string(bitmap, "lr", x_panel_col1a_offset+168, y_panel_tss_offset, color_panel_caption); - for (i=0; i<16; i++) - { - sprintf(buf, "%2o", i); - tx0_draw_string(bitmap, buf, x_panel_col1a_offset, y_panel_tss_offset+8+i*8, color_panel_caption); - } - - /* column separator */ - tx0_draw_vline(bitmap, x_panel_col2_offset-4, 8, 248, pen_panel_caption); - - /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ - tx0_draw_string(bitmap, "stop c0", x_panel_col2_offset+8, y_panel_stop_c0_offset, color_panel_caption); - tx0_draw_string(bitmap, "stop c1", x_panel_col2_offset+8, y_panel_stop_c1_offset, color_panel_caption); - tx0_draw_string(bitmap, "cm select", x_panel_col2_offset+8, y_panel_gbl_cm_sel_offset, color_panel_caption); - tx0_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); - tx0_draw_string(bitmap, "cycle1", x_panel_col2_offset+8, y_panel_cycle1_offset, color_panel_caption); - tx0_draw_string(bitmap, "cycle2", x_panel_col2_offset+8, y_panel_cycle2_offset, color_panel_caption); - tx0_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); - tx0_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); - tx0_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); - tx0_draw_string(bitmap, "instr", x_panel_col2_offset+8, y_panel_ir_offset, color_panel_caption); - tx0_draw_string(bitmap, "pgm flags", x_panel_col2_offset+8, y_panel_pf_offset, color_panel_caption); -} - - -/* - draw the operator control panel (dynamic elements) -*/ -void tx0_state::tx0_draw_panel(bitmap_ind16 &bitmap) -{ - int cm_sel, lr_sel; - int i; - - /* column 1: registers, test accumulator, test buffer, toggle switch storage */ - tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, m_maincpu->state_int(TX0_PC), 16); - tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, m_maincpu->state_int(TX0_MAR), 16); - tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, m_maincpu->state_int(TX0_MBR), 18); - tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, m_maincpu->state_int(TX0_AC), 18); - tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, m_maincpu->state_int(TX0_LR), 18); - tx0_draw_multipleled(bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, m_maincpu->state_int(TX0_XR), 14); - tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, m_maincpu->state_int(TX0_TBR), 18); - tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, m_maincpu->state_int(TX0_TAC), 18); - cm_sel = m_maincpu->state_int(TX0_CM_SEL); - lr_sel = m_maincpu->state_int(TX0_LR_SEL); - for (i=0; i<16; i++) - { - tx0_draw_switch(bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1); - tx0_draw_multipleswitch(bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, m_maincpu->state_int(TX0_TSS00+i), 18); - tx0_draw_switch(bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); - } - - /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ - tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, m_maincpu->state_int(TX0_STOP_CYC0)); - tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, m_maincpu->state_int(TX0_STOP_CYC1)); - tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, m_maincpu->state_int(TX0_GBL_CM_SEL)); - tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset, m_maincpu->state_int(TX0_RUN)); - tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle1_offset, m_maincpu->state_int(TX0_CYCLE) & 1); - tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle2_offset, m_maincpu->state_int(TX0_CYCLE) & 2); - tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset, m_maincpu->state_int(TX0_RIM)); - tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset, m_maincpu->state_int(TX0_IOH)); - tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset, m_maincpu->state_int(TX0_IOS)); - tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_ir_offset+8, m_maincpu->state_int(TX0_IR), 5); - tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_pf_offset+8, m_maincpu->state_int(TX0_PF), 6); -} - - - -/* - Typewriter code -*/ - - - - - -enum -{ - typewriter_line_height = 8, - typewriter_write_offset_y = typewriter_window_height-typewriter_line_height, - typewriter_scroll_step = typewriter_line_height -}; - -enum -{ - tab_step = 8 -}; - - -void tx0_state::tx0_typewriter_linefeed() -{ - UINT8 buf[typewriter_window_width]; - int y; - - for (y=0; ypens()); - } - - const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1); - m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window); -} - -void tx0_state::tx0_typewriter_drawchar(int character) -{ - static const char ascii_table[2][64] = - { - { /* lower case */ - '\0', '\0', 'e', '8', - '\0', '|', 'a', '3', - ' ', '=', 's', '4', - 'i', '+', 'u', '2', - '\0',/*color shift*/'.', 'd', '5', - 'r', '1', 'j', '7', - 'n', ',', 'f', '6', - 'c', '-', 'k', '\0', - 't', '\0', 'z', '\0',/*back space*/ - 'l', '\0',/*tab*/ 'w', '\0', - 'h', '\0',/*carr. return*/'y', '\0', - 'p', '\0', 'q', '\0', - 'o', '\0',/*stop*/ 'b', '\0', - 'g', '\0', '9', '\0', - 'm', '\0',/*upper case*/ 'x', '\0', - 'v', '\0',/*lower case*/ '0', '\0'/*delete*/ - }, - { /* upper case */ - '\0', '\0', 'E', '\210', - '\0', '_', 'A', '\203', - ' ', ':', 'S', '\204', - 'I', '/', 'U', '\202', - '\0',/*color shift*/')', 'D', '\205', - 'R', '\201', 'J', '\207', - 'N', '(', 'F', '\206', - 'C', '\212',/*macron*/ 'K', '\0', - 'T', '\0', 'Z', '\0',/*back space*/ - 'L', '\0',/*tab*/ 'W', '\0', - 'H', '\0',/*carr. return*/'Y', '\0', - 'P', '\0', 'Q', '\0', - 'O', '\0',/*stop*/ 'B', '\0', - 'G', '\0', '\211', '\0', - 'M', '\0',/*upper case*/ 'X', '\0', - 'V', '\0',/*lower case*/ '\200', '\0'/*delete*/ - } - }; - - - - character &= 0x3f; - - switch (character) - { - case 020: -#if 0 - /* color shift */ - m_typewriter_color = color_typewriter_black; - m_typewriter_color = color_typewriter_red; -#endif - break; - - case 043: - /* Backspace */ - if (m_pos) - m_pos--; - break; - - case 045: - /* Tab */ - m_pos = m_pos + tab_step - (m_pos % tab_step); - break; - - case 051: - /* Carriage Return */ - m_pos = 0; - tx0_typewriter_linefeed(); - break; - - case 061: - /* Stop */ - /* ?????? */ - break; - - case 071: - /* Upper case */ - m_case_shift = 1; - break; - - case 075: - /* Lower case */ - m_case_shift = 0; - break; - - case 077: - /* Delete */ - /* ?????? */ - break; - - default: - /* Any printable character... */ - - if (m_pos >= 80) - { /* if past right border, wrap around. (Right???) */ - tx0_typewriter_linefeed(); /* next line */ - m_pos = 0; /* return to start of line */ - } - - /* print character (lookup ASCII equivalent in table) */ - tx0_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character], - 8*m_pos, typewriter_write_offset_y, - m_typewriter_color); /* print char */ - - m_pos++; /* step carriage forward */ - break; - } -} diff --git a/src/mess/video/ut88.c b/src/mess/video/ut88.c deleted file mode 100644 index e5fcae9e678..00000000000 --- a/src/mess/video/ut88.c +++ /dev/null @@ -1,44 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - UT88 video driver by Miodrag Milanovic - - 06/03/2008 Preliminary driver. - -****************************************************************************/ - - -#include "includes/ut88.h" - - -const gfx_layout ut88_charlayout = -{ - 8, 8, /* 8x8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - {0}, /* no bitplanes; 1 bit per pixel */ - {0, 1, 2, 3, 4, 5, 6, 7}, - {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, - 8*8 /* size of one char */ -}; - -VIDEO_START_MEMBER(ut88_state,ut88) -{ -} - -UINT32 ut88_state::screen_update_ut88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - - for(y = 0; y < 28; y++ ) - { - for(x = 0; x < 64; x++ ) - { - int code = m_p_videoram[ x + y*64 ] & 0x7f; - int attr = m_p_videoram[ x+1 + y*64 ] & 0x80; - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code | attr, 0, 0,0, x*8,y*8); - } - } - return 0; -} diff --git a/src/mess/video/uv201.c b/src/mess/video/uv201.c deleted file mode 100644 index ae18cee5d2d..00000000000 --- a/src/mess/video/uv201.c +++ /dev/null @@ -1,589 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - VideoBrain UV201/UV202 video chip emulation - -**********************************************************************/ - -#include "uv201.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 1 - - -// screen parameters -#define SCREEN_WIDTH 232 -#define SCREEN_HEIGHT 262 -#define VISAREA_WIDTH 193 -#define VBLANK_WIDTH 21 -#define HBLANK_WIDTH 39 -#define HSYNC_WIDTH 18 -#define HFP_WIDTH 16 -#define HBP_WIDTH 5 -#define HBLANK_END HSYNC_WIDTH + HFP_WIDTH -#define HBLANK_START HBLANK_END + VISAREA_WIDTH - - -// write-only registers -#define REGISTER_COMMAND 0xf7 -#define REGISTER_BACKGROUND 0xf5 -#define REGISTER_FINAL_MODIFIER 0xf2 -#define REGISTER_Y_INTERRUPT 0xf0 - - -// read-only registers -#define REGISTER_X_FREEZE 0xf8 -#define REGISTER_Y_FREEZE_LOW 0xf9 -#define REGISTER_Y_FREEZE_HIGH 0xfa -#define REGISTER_CURRENT_Y_LOW 0xfb - - -// read/write registers - RAM memory -#define RAM_RP_LO 0x00 // cartridge pointer low order -#define RAM_RP_HI_COLOR 0x10 // cartridge pointer high order and color -#define RAM_DX_INT_XCOPY 0x20 // dX, intensity, X-copy -#define RAM_DY 0x30 // dY -#define RAM_X 0x40 // X value -#define RAM_Y_LO_A 0x50 // Y value low order list A -#define RAM_Y_LO_B 0x60 // Y value low order list B -#define RAM_XY_HI_A 0x70 // Y value high order and X order list A -#define RAM_XY_HI_B 0x80 // Y value high order and X order list B - - -// command register bits -#define COMMAND_YINT_H_O 0x80 -#define COMMAND_A_B 0x40 -#define COMMAND_Y_ZM 0x20 -#define COMMAND_KBD 0x10 -#define COMMAND_INT 0x08 -#define COMMAND_ENB 0x04 -#define COMMAND_FRZ 0x02 -#define COMMAND_X_ZM 0x01 - - -#define IS_CHANGED(_bit) \ - ((m_cmd & _bit) != (data & _bit)) - -#define RAM(_offset) \ - m_ram[_offset + i] - -#define RAM_XORD(_offset) \ - m_ram[_offset + xord] - -#define IS_VISIBLE(_y) \ - ((_y >= cliprect.min_y) && (_y <= cliprect.max_y)) - -#define DRAW_PIXEL(_scanline, _dot) \ - if (IS_VISIBLE(_scanline)) bitmap.pix32((_scanline), HSYNC_WIDTH + HFP_WIDTH + _dot) = m_palette_val[pixel]; - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -// device type definition -const device_type UV201 = &device_creator; - - -//------------------------------------------------- -// uv201_device - constructor -//------------------------------------------------- - -uv201_device::uv201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, UV201, "UV201", tag, owner, clock, "uv201", __FILE__), - device_video_interface(mconfig, *this), - m_write_ext_int(*this), - m_write_hblank(*this), - m_read_db(*this) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void uv201_device::device_start() -{ - // resolve callbacks - m_write_ext_int.resolve_safe(); - m_write_hblank.resolve_safe(); - m_read_db.resolve_safe(0); - - // allocate timers - m_timer_y_odd = timer_alloc(TIMER_Y_ODD); - m_timer_y_even = timer_alloc(TIMER_Y_EVEN); - m_timer_hblank_on = timer_alloc(TIMER_HBLANK_ON); - m_timer_hblank_off = timer_alloc(TIMER_HBLANK_OFF); - - initialize_palette(); - - memset(m_ram, 0x00, sizeof(m_ram)); - m_y_int = 0; - m_fmod = 0; - m_bg = 0; - m_cmd = 0; - m_freeze_x = 0; - m_freeze_y = 0; - m_field = 0; - - // state saving - save_item(NAME(m_ram)); - save_item(NAME(m_y_int)); - save_item(NAME(m_fmod)); - save_item(NAME(m_bg)); - save_item(NAME(m_cmd)); - save_item(NAME(m_freeze_x)); - save_item(NAME(m_freeze_y)); - save_item(NAME(m_field)); -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void uv201_device::device_reset() -{ - m_write_ext_int(CLEAR_LINE); - - m_write_hblank(1); - m_timer_hblank_off->adjust(attotime::from_ticks( HBLANK_END, m_clock )); -} - - -//------------------------------------------------- -// device_timer - handle timer events -//------------------------------------------------- - -void uv201_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - int scanline = m_screen->vpos(); - - switch (id) - { - case TIMER_Y_ODD: - case TIMER_Y_EVEN: - if ((m_cmd & COMMAND_INT) && !(m_cmd & COMMAND_FRZ)) - { - if (LOG) logerror("Y-Interrupt at scanline %u\n", scanline); - - m_freeze_y = scanline; - - m_write_ext_int(ASSERT_LINE); - m_write_ext_int(CLEAR_LINE); - } - break; - - case TIMER_HBLANK_ON: - m_write_hblank(1); - - m_timer_hblank_off->adjust(attotime::from_ticks( HBLANK_WIDTH, m_clock ) ); - break; - - case TIMER_HBLANK_OFF: - m_write_hblank(0); - - m_timer_hblank_on->adjust(attotime::from_ticks( VISAREA_WIDTH, m_clock ) ); - break; - } -} - - -//------------------------------------------------- -// initialize_palette - -//------------------------------------------------- - -void uv201_device::initialize_palette() -{ - UINT8 offlointensity = 0x00; - UINT8 offhiintensity = 0xc0; - - UINT8 onlointensity = 0xa0; - UINT8 onhiintensity = 0xff; - - for (int i = 0; i < 4; i++) - { - int offset = i * 8; - UINT8 onvalue, offvalue; - - if (offset < 16) - { - offvalue = offlointensity; - onvalue = onlointensity; - } - else - { - offvalue = offhiintensity; - onvalue = onhiintensity; - } - - m_palette_val[offset + 0] = rgb_t(offvalue, offvalue, offvalue); // black - m_palette_val[offset + 1] = rgb_t(onvalue, offvalue, offvalue); // red - m_palette_val[offset + 2] = rgb_t(offvalue, onvalue, offvalue); // green - m_palette_val[offset + 3] = rgb_t(onvalue, onvalue, offvalue); // red-green - m_palette_val[offset + 4] = rgb_t(offvalue, offvalue, onvalue); // blue - m_palette_val[offset + 5] = rgb_t(onvalue, offvalue, onvalue); // red-blue - m_palette_val[offset + 6] = rgb_t(offvalue, onvalue, onvalue); // green-blue - m_palette_val[offset + 7] = rgb_t(onvalue, onvalue, onvalue); // white - } -} - - -//------------------------------------------------- -// get_field_vpos - get scanline within field -//------------------------------------------------- - -int uv201_device::get_field_vpos() -{ - int vpos = m_screen->vpos(); - - if (vpos >= SCREEN_HEIGHT) - { - // even field - vpos -= SCREEN_HEIGHT; - } - - return vpos; -} - - -//------------------------------------------------- -// get_field - get video field -//------------------------------------------------- - -int uv201_device::get_field() -{ - return m_screen->vpos() < SCREEN_HEIGHT; -} - - -//------------------------------------------------- -// set_y_interrupt - set Y interrupt timer -//------------------------------------------------- - -void uv201_device::set_y_interrupt() -{ - int scanline = ((m_cmd & COMMAND_YINT_H_O) << 1) | m_y_int; - - m_timer_y_odd->adjust(m_screen->time_until_pos(scanline), 0, m_screen->frame_period()); - //m_timer_y_even->adjust(m_screen->time_until_pos(scanline + SCREEN_HEIGHT), 0, m_screen->frame_period()); -} - - -//------------------------------------------------- -// do_partial_update - update screen -//------------------------------------------------- - -void uv201_device::do_partial_update() -{ - int vpos = m_screen->vpos(); - - if (LOG) logerror("Partial screen update at scanline %u\n", vpos); - - m_screen->update_partial(vpos); -} - - -//------------------------------------------------- -// read - -//------------------------------------------------- - -READ8_MEMBER( uv201_device::read ) -{ - UINT8 data = 0xff; - - switch (offset) - { - case REGISTER_X_FREEZE: - data = m_freeze_x; - - if (LOG) logerror("X-Freeze %02x\n", data); - break; - - case REGISTER_Y_FREEZE_LOW: - data = m_freeze_y & 0xff; - - if (LOG) logerror("Y-Freeze Low %02x\n", data); - break; - - case REGISTER_Y_FREEZE_HIGH: - /* - - bit signal description - - 0 Y-F8 Y freeze high order (MSB) bit - 1 Y-C8 current Y counter high order (MSB) bit - 2 - 3 - 4 - 5 - 6 - 7 O/_E odd/even field - - */ - - data = (get_field() << 7) | (BIT(get_field_vpos(), 8) << 1) | BIT(m_freeze_y, 8); - - if (LOG) logerror("Y-Freeze High %02x\n", data); - break; - - case REGISTER_CURRENT_Y_LOW: - data = get_field_vpos() & 0xff; - - if (LOG) logerror("Current-Y Low %02x\n", data); - break; - - default: - if (offset < 0x90) - data = m_ram[offset]; - else - if (LOG) logerror("Unknown VLSI read from %02x!\n", offset); - } - - return data; -} - - -//------------------------------------------------- -// write - -//------------------------------------------------- - -WRITE8_MEMBER( uv201_device::write ) -{ - switch (offset) - { - case REGISTER_Y_INTERRUPT: - if (LOG) logerror("Y-Interrupt %02x\n", data); - - if (m_y_int != data) - { - m_y_int = data; - set_y_interrupt(); - } - break; - - case REGISTER_FINAL_MODIFIER: - /* - - bit signal description - - 0 RED red - 1 GREEN green - 2 BLUE blue - 3 INT 0 intensity 0 - 4 INT 1 intensity 1 - 5 not used - 6 not used - 7 not used - - */ - - if (LOG) logerror("Final Modifier %02x\n", data); - - do_partial_update(); - m_fmod = data & 0x1f; - break; - - case REGISTER_BACKGROUND: - /* - - bit signal description - - 0 RED red - 1 GREEN green - 2 BLUE blue - 3 INT 0 intensity 0 - 4 INT 1 intensity 1 - 5 not used - 6 not used - 7 not used - - */ - - if (LOG) logerror("Background %02x\n", data); - - do_partial_update(); - m_bg = data & 0x1f; - break; - - case REGISTER_COMMAND: - /* - - bit signal description - - 0 X-ZM X zoom - 1 FRZ freeze - 2 ENB video enable - 3 INT interrupt enable - 4 KBD general purpose output - 5 Y-ZM Y zoom - 6 A/_B list selection - 7 YINT H.O. Y COMMAND_INT register high order bit - - */ - - if (LOG) logerror("Command %02x\n", data); - - if (IS_CHANGED(COMMAND_YINT_H_O)) - { - set_y_interrupt(); - } - - if (IS_CHANGED(COMMAND_A_B) || IS_CHANGED(COMMAND_Y_ZM) || IS_CHANGED(COMMAND_X_ZM)) - { - do_partial_update(); - } - - m_cmd = data; - break; - - default: - if (offset < 0x90) - m_ram[offset] = data; - else - logerror("Unknown VLSI write %02x to %02x!\n", data, offset); - } -} - - -//------------------------------------------------- -// ext_int_w - external interrupt write -//------------------------------------------------- - -WRITE_LINE_MEMBER( uv201_device::ext_int_w ) -{ - if (!state && (m_cmd & COMMAND_FRZ)) - { - m_freeze_y = get_field_vpos(); - m_freeze_x = m_screen->hpos(); - } -} - - -//------------------------------------------------- -// kbd_r - keyboard select read -//------------------------------------------------- - -READ_LINE_MEMBER( uv201_device::kbd_r ) -{ - return (m_cmd & COMMAND_KBD) ? 1 : 0; -} - - -//------------------------------------------------- -// screen_update - -//------------------------------------------------- - -UINT32 uv201_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(rgb_t(0x00,0x00,0x00), cliprect); - - if (!(m_cmd & COMMAND_ENB)) - { - return 0; - } - - for (int y = 0; y < SCREEN_HEIGHT; y++) - { - for (int x = 0; x < VISAREA_WIDTH; x++) - { - int pixel = m_bg; - DRAW_PIXEL(y, x); - } - } - - for (int i = 0; i < 16; i++) - { - UINT8 xy_hi = (m_cmd & COMMAND_A_B) ? RAM(RAM_XY_HI_A) : RAM(RAM_XY_HI_B); - UINT8 y_lo = (m_cmd & COMMAND_A_B) ? RAM(RAM_Y_LO_A) : RAM(RAM_Y_LO_B); - UINT16 y = (BIT(xy_hi, 7) << 8) | y_lo; - int xord = xy_hi & 0x0f; - - UINT8 rp_hi_color = RAM_XORD(RAM_RP_HI_COLOR); - UINT8 rp_lo = RAM_XORD(RAM_RP_LO); - UINT16 rp = ((rp_hi_color << 8) | rp_lo) & 0x1fff; - - if (rp < 0x800) rp |= 0x2000; - - UINT8 dx_int_xcopy = RAM_XORD(RAM_DX_INT_XCOPY); - int color = ((dx_int_xcopy & 0x60) >> 2) | (BIT(rp_hi_color, 5) << 2) | (BIT(rp_hi_color, 6) << 1) | (BIT(rp_hi_color, 7)); - UINT8 dx = dx_int_xcopy & 0x1f; - UINT8 dy = RAM_XORD(RAM_DY); - int xcopy = BIT(dx_int_xcopy, 7); - UINT8 x = RAM_XORD(RAM_X); - - if (LOG) logerror("Object %u xord %u y %u x %u dy %u dx %u xcopy %u color %u rp %04x\n", i, xord, y, x, dy, dx, xcopy, color, rp); - - if (rp == 0) continue; - if (y > SCREEN_HEIGHT) continue; - - for (int sy = 0; sy < dy; sy++) - { - for (int sx = 0; sx < dx; sx++) - { - UINT8 data = m_read_db(rp); - - for (int bit = 0; bit < 8; bit++) - { - int pixel = ((BIT(data, 7) ? color : m_bg) ^ m_fmod) & 0x1f; - - if (m_cmd & COMMAND_Y_ZM) - { - int scanline = y + (sy * 2); - - if (m_cmd & COMMAND_X_ZM) - { - int dot = (x * 2) + (sx * 16) + (bit * 2); - - DRAW_PIXEL(scanline, dot); - DRAW_PIXEL(scanline, dot + 1); - DRAW_PIXEL(scanline + 1, dot); - DRAW_PIXEL(scanline + 1, dot + 1); - } - else - { - int dot = x + (sx * 8) + bit; - - DRAW_PIXEL(scanline, dot); - DRAW_PIXEL(scanline + 1, dot); - } - } - else - { - int scanline = y + sy; - - if (m_cmd & COMMAND_X_ZM) - { - int dot = (x * 2) + (sx * 16) + (bit * 2); - - DRAW_PIXEL(scanline, dot); - DRAW_PIXEL(scanline, dot + 1); - } - else - { - int dot = x + (sx * 8) + bit; - - DRAW_PIXEL(scanline, dot); - } - } - - data <<= 1; - } - - if (!xcopy) rp++; - } - - if (xcopy) rp++; - } - } - - return 0; -} diff --git a/src/mess/video/uv201.h b/src/mess/video/uv201.h deleted file mode 100644 index 336dd8f4141..00000000000 --- a/src/mess/video/uv201.h +++ /dev/null @@ -1,159 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - VideoBrain UV201/UV202 video chip emulation - -********************************************************************** - _____ _____ - GND 1 |* \_/ | 40 DMAREQ - G 2 | | 39 /CE - I 3 | | 38 RESET - B 4 | | 37 BISTROBE - R 5 | | 36 UMIREQ0 - BA0 6 | | 35 BRCLK - BA1 7 | | 34 HBLANK - BA2 8 | | 33 VBLANK - BA3 9 | | 32 R/W - BA4 10 | UV201 | 31 keypad column 8 - BA5 11 | | 30 EXT INT - BA6 12 | | 29 FIELD - BA7 13 | | 28 BD7 - BA8 14 | | 27 BD6 - BA9 15 | | 26 BD5 - BA10 16 | | 25 BD4 - BA11 17 | | 24 BD3 - BA12 18 | | 23 BD2 - +5V 19 | | 22 BD1 - +12V 20 |_____________| 21 BD0 - - _____ _____ - UMIREQ1 1 |* \_/ | 40 BISTROBE - UMIREQ0 2 | | 39 CPUREQ1 - CPUREQ0 3 | | 38 GND - XIN 4 | | 37 /800-BFF - XOUT 5 | | 36 RST - DMAREQ0 6 | | 35 DMAREQ1 - CPU CLK 7 | | 34 COLCLK - WACK 8 | | 33 BRCLK - D0 9 | | 32 D7 - BD0 10 | UV202 | 31 BD7 - D1 11 | | 30 D6 - BD1 12 | | 29 BD6 - D2 13 | | 28 D5 - BD2 14 | | 27 BD5 - D3 15 | | 26 D4 - BD3 16 | | 25 BD4 - HBLANK 17 | | 24 FIELD - VBLANK 18 | | 23 SCANLINE - BURST 19 | | 22 +12V - CSYNCH 20 |_____________| 21 +5V - -**********************************************************************/ - -#pragma once - -#ifndef __UV201__ -#define __UV201__ - -#include "emu.h" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_UV201_ADD(_tag, _screen_tag, _clock, _config) \ - MCFG_SCREEN_ADD(_screen_tag, RASTER) \ - MCFG_SCREEN_UPDATE_DEVICE(_tag, uv201_device, screen_update) \ - MCFG_SCREEN_RAW_PARAMS(_clock, 232, 18, 232, 262, 21, 262) \ - MCFG_DEVICE_ADD(_tag, UV201, _clock) \ - MCFG_VIDEO_SET_SCREEN(_screen_tag) - - -#define MCFG_UV201_EXT_INT_CALLBACK(_write) \ - devcb = &uv201_device::set_ext_int_wr_callback(*device, DEVCB_##_write); - -#define MCFG_UV201_HBLANK_CALLBACK(_write) \ - devcb = &uv201_device::set_hblank_wr_callback(*device, DEVCB_##_write); - -#define MCFG_UV201_DB_CALLBACK(_read) \ - devcb = &uv201_device::set_db_rd_callback(*device, DEVCB_##_read); - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> uv201_device - -class uv201_device : public device_t, - public device_video_interface -{ -public: - // construction/destruction - uv201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_ext_int_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_ext_int.set_callback(object); } - template static devcb_base &set_hblank_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_hblank.set_callback(object); } - template static devcb_base &set_db_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_db.set_callback(object); } - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE_LINE_MEMBER( ext_int_w ); - DECLARE_READ_LINE_MEMBER( kbd_r ); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - enum - { - TIMER_Y_ODD, - TIMER_Y_EVEN, - TIMER_HBLANK_ON, - TIMER_HBLANK_OFF - }; - - void initialize_palette(); - int get_field_vpos(); - int get_field(); - void set_y_interrupt(); - void do_partial_update(); - - devcb_write_line m_write_ext_int; - devcb_write_line m_write_hblank; - devcb_read8 m_read_db; - - rgb_t m_palette_val[32]; - UINT8 m_ram[0x90]; - UINT8 m_y_int; - UINT8 m_fmod; - UINT8 m_bg; - UINT8 m_cmd; - UINT8 m_freeze_x; - UINT16 m_freeze_y; - int m_field; - - // timers - emu_timer *m_timer_y_odd; - emu_timer *m_timer_y_even; - emu_timer *m_timer_hblank_on; - emu_timer *m_timer_hblank_off; -}; - - -// device type definition -extern const device_type UV201; - - - -#endif diff --git a/src/mess/video/v1050.c b/src/mess/video/v1050.c deleted file mode 100644 index 2154b01fb42..00000000000 --- a/src/mess/video/v1050.c +++ /dev/null @@ -1,124 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#include "includes/v1050.h" - -/* - - TODO: - - - bright in reverse video - -*/ - -#define V1050_ATTR_BRIGHT 0x01 -#define V1050_ATTR_BLINKING 0x02 -#define V1050_ATTR_ATTEN 0x04 -#define V1050_ATTR_REVERSE 0x10 -#define V1050_ATTR_BLANK 0x20 -#define V1050_ATTR_BOLD 0x40 -#define V1050_ATTR_BLINK 0x80 - -/* Video RAM Access */ - -READ8_MEMBER( v1050_state::attr_r ) -{ - return m_attr; -} - -WRITE8_MEMBER( v1050_state::attr_w ) -{ - m_attr = data; -} - -READ8_MEMBER( v1050_state::videoram_r ) -{ - if (offset >= 0x2000) - { - m_attr = (m_attr & 0xfc) | (m_attr_ram[offset] & 0x03); - } - - return m_video_ram[offset]; -} - -WRITE8_MEMBER( v1050_state::videoram_w ) -{ - m_video_ram[offset] = data; - - if (offset >= 0x2000 && BIT(m_attr, 2)) - { - m_attr_ram[offset] = m_attr & 0x03; - } -} - -/* MC6845 Interface */ - -MC6845_UPDATE_ROW( v1050_state::crtc_update_row ) -{ - int column, bit; - - for (column = 0; column < x_count; column++) - { - UINT16 address = (((ra & 0x03) + 1) << 13) | ((ma & 0x1fff) + column); - UINT8 data = m_video_ram[address & V1050_VIDEORAM_MASK]; - UINT8 attr = (m_attr & 0xfc) | (m_attr_ram[address] & 0x03); - - for (bit = 0; bit < 8; bit++) - { - int x = (column * 8) + bit; - int color = BIT(data, 7); - - /* blinking */ - if ((attr & V1050_ATTR_BLINKING) && !(attr & V1050_ATTR_BLINK)) color = 0; - - /* reverse video */ - color ^= BIT(attr, 4); - - /* bright */ - if (color && (!(attr & V1050_ATTR_BOLD) ^ (attr & V1050_ATTR_BRIGHT))) color = 2; - - /* display blank */ - if (attr & V1050_ATTR_BLANK) color = 0; - - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(de ? color : 0); - - data <<= 1; - } - } -} - -WRITE_LINE_MEMBER( v1050_state::crtc_vs_w ) -{ - m_subcpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); - - set_interrupt(INT_VSYNC, state); -} - -/* Video Start */ - -void v1050_state::video_start() -{ - /* allocate memory */ - m_attr_ram.allocate(V1050_VIDEORAM_SIZE); - - /* register for state saving */ - save_item(NAME(m_attr)); -} - -/* Machine Drivers */ - -MACHINE_CONFIG_FRAGMENT( v1050_video ) - MCFG_MC6845_ADD(H46505_TAG, H46505, SCREEN_TAG, XTAL_15_36MHz/8) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_UPDATE_ROW_CB(v1050_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(v1050_state, crtc_vs_w)) - - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) - MCFG_SCREEN_UPDATE_DEVICE(H46505_TAG, h46505_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_SIZE(640, 400) - MCFG_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) - - MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") -MACHINE_CONFIG_END diff --git a/src/mess/video/vc4000.c b/src/mess/video/vc4000.c deleted file mode 100644 index d8ba1ca6f30..00000000000 --- a/src/mess/video/vc4000.c +++ /dev/null @@ -1,650 +0,0 @@ -// license:??? -// copyright-holders:Peter Trauner, Manfred Schneider, Robbbert - -#include "includes/vc4000.h" - - -/* - emulation of signetics 2636 video/audio device - - seams to me like a special microcontroller - mask programmed - - note about mame s2636 emulation: - less encapsuled - missing grid, sound generation, retriggered sprites, paddle reading, score display - not "rasterline" based - */ - -#define STICKCENTRE (105) -#define STICKLOW (20) -#define STICKHIGH (225) - -#define VC4000_END_LINE (269) - - - -void vc4000_state::video_start() -{ - int i; - - for (i=0;i<0x20; i++) - { - m_sprite_collision[i]=0; - if ((i&3)==3) m_sprite_collision[i]|=0x20; - if ((i&5)==5) m_sprite_collision[i]|=0x10; - if ((i&9)==9) m_sprite_collision[i]|=8; - if ((i&6)==6) m_sprite_collision[i]|=4; - if ((i&0xa)==0xa) m_sprite_collision[i]|=2; - if ((i&0xc)==0xc) m_sprite_collision[i]|=1; - m_background_collision[i]=0; - if ((i&0x11)==0x11) m_background_collision[i]|=0x80; - if ((i&0x12)==0x12) m_background_collision[i]|=0x40; - if ((i&0x14)==0x14) m_background_collision[i]|=0x20; - if ((i&0x18)==0x18) m_background_collision[i]|=0x10; - } - - m_joy1_x = STICKCENTRE; - m_joy1_y = STICKCENTRE; - m_joy2_x = STICKCENTRE; - m_joy2_y = STICKCENTRE; - - memset(&m_video, 0, sizeof(m_video)); - for (i=0; i<3; i++) - { - m_video.sprites[i].data = &m_video.reg.d.sprites[i]; - m_video.sprites[i].mask = 1 << i; - } - m_video.sprites[3].data = &m_video.reg.d.sprite4; - m_video.sprites[3].mask = 1 << 3; - - m_bitmap = auto_bitmap_ind16_alloc(machine(), m_screen->width(), m_screen->height()); -} - -inline UINT8 vc4000_state::vc4000_joystick_return_to_centre(UINT8 joy) -{ - UINT8 data; - - if (joy > (STICKCENTRE+5)) - data=joy-5; - else - if (joy < (STICKCENTRE-5)) - data=joy+5; - else - data=105; - - return data; -} - -READ8_MEMBER( vc4000_state::vc4000_video_r ) -{ - UINT8 data=0; - if (offset > 0xcf) offset &= 0xcf; // c0-cf is mirrored at d0-df, e0-ef, f0-ff - switch (offset) - { - case 0xca: // Background-sprite collision (bit 7-4) and sprite finished (bit 3-0) - data |= m_video.background_collision; - m_video.background_collision=0; - if (m_video.sprites[3].finished) - { - data |= 1; - m_video.sprites[3].finished = FALSE; - } - - if (m_video.sprites[2].finished) - { - data |= 2; - m_video.sprites[2].finished = FALSE; - } - if (m_video.sprites[1].finished) - { - data |= 4; - m_video.sprites[1].finished = FALSE; - } - if (m_video.sprites[0].finished) - { - data |= 8; - m_video.sprites[0].finished = FALSE; - } - break; - - case 0xcb: // VRST-Flag (bit 6) and intersprite collision (bit5-0) - data = m_video.sprite_collision | (m_video.reg.d.sprite_collision & 0xc0); - m_video.sprite_collision = 0; - m_video.reg.d.sprite_collision &= 0xbf; - break; - -#ifndef ANALOG_HACK - case 0xcc: - if (!activeS2650_FO)) data = m_io_joy1_x->read(); - else data = m_io_joy1_y->read(); - break; - case 0xcd: - if (!activecpu_get_reg(S2650_FO)) data = m_io_joy2_x->read(); - else data = m_io_joy2_y->read(); - break; -#else - - case 0xcc: /* left joystick */ - if (m_config->read()&1) - { /* paddle */ - if (!m_maincpu->state_int(S2650_FO)) - { - data = m_joys->read() & 0x03; - switch (data) - { - case 0x01: - m_joy1_x-=5; - if (m_joy1_x < STICKLOW) m_joy1_x=STICKLOW; - break; - case 0x02: - m_joy1_x+=5; - if (m_joy1_x > STICKHIGH) m_joy1_x=STICKHIGH; - break; - case 0x00: - m_joy1_x = vc4000_joystick_return_to_centre(m_joy1_x); - } - data = m_joy1_x; - } - else - { - data = m_joys->read() & 0x0c; - switch (data) - { - case 0x08: - m_joy1_y-=5; - if (m_joy1_y < STICKLOW) m_joy1_y=STICKLOW; - break; - case 0x04: - m_joy1_y+=5; - if (m_joy1_y > STICKHIGH) m_joy1_y=STICKHIGH; - break; - // case 0x00: - // m_joy1_y = vc4000_joystick_return_to_centre(m_joy1_y); - } - data = m_joy1_y; - } - } - else - { /* buttons */ - if (!m_maincpu->state_int(S2650_FO)) - { - data = m_joys->read() & 0x03; - switch (data) - { - case 0x01: - m_joy1_x=STICKLOW; - break; - case 0x02: - m_joy1_x=STICKHIGH; - break; - default: /* autocentre */ - m_joy1_x=STICKCENTRE; - } - data = m_joy1_x; - } - else - { - data = m_joys->read() & 0x0c; - switch (data) - { - case 0x08: - m_joy1_y=STICKLOW; - break; - case 0x04: - m_joy1_y=STICKHIGH; - break; - default: - m_joy1_y=STICKCENTRE; - } - data = m_joy1_y; - } - } - break; - - case 0xcd: /* right joystick */ - if (m_config->read()&1) - { - if (!m_maincpu->state_int(S2650_FO)) - { - data = m_joys->read() & 0x30; - switch (data) - { - case 0x10: - m_joy2_x-=5; - if (m_joy2_x < STICKLOW) m_joy2_x=STICKLOW; - break; - case 0x20: - m_joy2_x+=5; - if (m_joy2_x > STICKHIGH) m_joy2_x=STICKHIGH; - case 0x00: - m_joy2_x = vc4000_joystick_return_to_centre(m_joy2_x); - break; - } - data = m_joy2_x; - } - else - { - data = m_joys->read() & 0xc0; - switch (data) - { - case 0x80: - m_joy2_y-=5; - if (m_joy2_y < STICKLOW) m_joy2_y=STICKLOW; - break; - case 0x40: - m_joy2_y+=5; - if (m_joy2_y > STICKHIGH) m_joy2_y=STICKHIGH; - break; - // case 0x00: - // m_joy2_y = vc4000_joystick_return_to_centre(m_joy2_y); - } - data = m_joy2_y; - } - } - else - { - if (!m_maincpu->state_int(S2650_FO)) - { - data = m_joys->read() & 0x30; - switch (data) - { - case 0x10: - m_joy2_x=STICKLOW; - break; - case 0x20: - m_joy2_x=STICKHIGH; - break; - default: /* autocentre */ - m_joy2_x=STICKCENTRE; - } - data = m_joy2_x; - } - else - { - data = m_joys->read() & 0xc0; - switch (data) - { - case 0x80: - m_joy2_y=STICKLOW; - break; - case 0x40: - m_joy2_y=STICKHIGH; - break; - default: - m_joy2_y=STICKCENTRE; - } - data = m_joy2_y; - } - } - break; -#endif - - default: - data = m_video.reg.data[offset]; - break; - } - return data; -} - -WRITE8_MEMBER( vc4000_state::vc4000_video_w ) -{ -// m_video.reg.data[offset]=data; - if (offset > 0xcf) offset &= 0xcf; // c0-cf is mirrored at d0-df, e0-ef, f0-ff - - switch (offset) - { - case 0xc0: // Sprite size - m_video.sprites[0].size=1<<(data&3); - m_video.sprites[1].size=1<<((data>>2)&3); - m_video.sprites[2].size=1<<((data>>4)&3); - m_video.sprites[3].size=1<<((data>>6)&3); - break; - - case 0xc1: // Sprite 1+2 color - m_video.sprites[0].scolor=((~data>>3)&7); - m_video.sprites[1].scolor=(~data&7); - break; - - case 0xc2: // Sprite 2+3 color - m_video.sprites[2].scolor=((~data>>3)&7); - m_video.sprites[3].scolor=(~data&7); - break; - - case 0xc3: // Score control - m_video.reg.d.score_control = data; - break; - - case 0xc6: // Background color - m_video.reg.d.background = data; - break; - - case 0xc7: // Soundregister - m_video.reg.data[offset] = data; - m_custom->soundport_w(0, data); - break; - - case 0xc8: // Digits 1 and 2 - m_video.reg.d.bcd[0] = data; - break; - - case 0xc9: // Digits 3 and 4 - m_video.reg.d.bcd[1] = data; - break; - - case 0xca: // Background-sprite collision (bit 7-4) and sprite finished (bit 3-0) - m_video.reg.data[offset]=data; - m_video.background_collision=data; - break; - - case 0xcb: // VRST-Flag (bit 6) and intersprite collision (bit5-0) - m_video.reg.data[offset]=data; - m_video.sprite_collision=data; - break; - - default: - m_video.reg.data[offset]=data; - } -} - - -READ8_MEMBER( vc4000_state::vc4000_vsync_r ) -{ - return m_video.line >= VC4000_END_LINE ? 0x80 : 0; -} - -static const char led[20][12+1] = -{ - "aaaabbbbcccc", - "aaaabbbbcccc", - "aaaabbbbcccc", - "aaaabbbbcccc", - "llll dddd", - "llll dddd", - "llll dddd", - "llll dddd", - "kkkkmmmmeeee", - "kkkkmmmmeeee", - "kkkkmmmmeeee", - "kkkkmmmmeeee", - "jjjj ffff", - "jjjj ffff", - "jjjj ffff", - "jjjj ffff", - "iiiihhhhgggg", - "iiiihhhhgggg", - "iiiihhhhgggg", - "iiiihhhhgggg" -}; - - -void vc4000_state::vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line) -{ - static const int digit_to_segment[0x10]={ - 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff - }; - - int i=line,j; - - for (j=0; j>4)&7)^7; - } -} - -inline void vc4000_state::vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale) -{ - int i,j,m; - - for (j=0,m=0x80; j<8; j++, m>>=1) - { - if (data&m) - for (i=0; iy=This->data->y1; - This->state=0; - This->delay=0; - This->finished=FALSE; - } - - This->finished_now=FALSE; - - if (m_video.line>VC4000_END_LINE) return; - - switch (This->state) - { - case 0: - if (m_video.line != This->y + 2) break; - This->state++; - - case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:case 9:case 10: - - vc4000_collision_plot(collision+This->data->x1, This->data->bitmap[This->state-1],This->mask,This->size); - - for (j=0,m=0x80; j<8; j++, m>>=1) - { - if (This->data->bitmap[This->state-1]&m) - { - for (i=0; isize; i++) - { - m_objects[This->data->x1 + i + j*This->size] |= This->scolor; - m_objects[This->data->x1 + i + j*This->size] &= 7; - } - } - } - - This->delay++; - - if (This->delay>=This->size) - { - This->delay=0; - This->state++; - } - - if (This->state>10) - { - This->finished=TRUE; - This->finished_now=TRUE; - } - - break; - - case 11: - This->y=This->data->y2; - - if (This->y==255) - This->y=0; - else - This->y++; - - if (This->y>252) break; - - This->delay=0; - This->state++; - - case 12: - if (This->y!=0) - { - This->y--; - break; - } - This->state++; - - case 13: case 14: case 15: case 16: case 17: case 18: case 19:case 20:case 21:case 22: - - vc4000_collision_plot(collision+This->data->x2,This->data->bitmap[This->state-13],This->mask,This->size); - for (j=0,m=0x80; j<8; j++, m>>=1) - { - if (This->data->bitmap[This->state-13]&m) - { - for (i=0; isize; i++) - { - int offset = This->data->x2 + i + j*This->size; - - // clip objects outside the object buffer. - // someone who knows this hardware should look at - // it properly. - if (offset < 256) - { - m_objects[offset] |= This->scolor; - m_objects[offset] &= 7; - } - } - } - } - This->delay++; - if (This->delaysize) break; - This->delay=0; - This->state++; - if (This->state<23) break; - This->finished=TRUE; - This->finished_now=TRUE; - This->state=11; - break; - } -} - -inline void vc4000_state::vc4000_draw_grid(UINT8 *collision) -{ - int width = m_screen->width(); - int height = m_screen->height(); - int i, j, m, x, line=m_video.line-20; - int w, k; - - if (m_video.line>=height) return; - - m_bitmap->plot_box(0, m_video.line, width, 1, (m_video.reg.d.background)&7); - - if (line<0 || line>=200) return; - if (~m_video.reg.d.background & 8) return; - - i=(line/20)*2; - if (line%20>=2) i++; - - k=m_video.reg.d.grid_control[i>>2]; - switch (k>>6) { - default: - case 0:case 2: w=1;break; - case 1: w=2;break; - case 3: w=4;break; - } - switch (i&3) { - case 0: - if (k&1) w=8;break; - case 1: - if ((line%40)<=10) { - if (k&2) w=8; - } else { - if (k&4) w=8; - } - break; - case 2: if (k&8) w=8;break; - case 3: - if ((line%40)<=30) { - if (k&0x10) w=8; - } else { - if (k&0x20) w=8; - } - break; - } - for (x=30, j=0, m=0x80; j<16; j++, x+=8, m>>=1) - { - if (m_video.reg.d.grid[i][j>>3]&m) - { - int l; - for (l=0; lplot_box(x, m_video.line, w, 1, (m_video.reg.d.background>>4)&7); - } - if (j==7) m=0x100; - } -} - -INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) -{ - int x,y,i; - UINT8 collision[400]={0}; // better alloca or gcc feature of non constant long automatic arrays - const rectangle &visarea = m_screen->visible_area(); - assert(ARRAY_LENGTH(collision) >= m_screen->width()); - - m_video.line++; - if (m_irq_pause) m_irq_pause++; - if (m_video.line>311) m_video.line=0; - - if (m_video.line==0) - { - m_video.background_collision=0; - m_video.sprite_collision=0; - m_video.reg.d.sprite_collision=0; -// logerror("begin of frame\n"); - } - - if (m_irq_pause>10) - { - m_maincpu->set_input_line(0, CLEAR_LINE); - m_irq_pause = 0; - } - - if (m_video.line <= VC4000_END_LINE) - { - vc4000_draw_grid(collision); - - /* init object colours */ - for (i=visarea.min_x; ipix16(m_video.line, i) = m_objects[i]; - } - - y = m_video.reg.d.score_control&1?200:20; - - if ((m_video.line>=y)&&(m_video.line>4, m_video.line-y); - vc4000_draw_digit(*m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y); - if (m_video.reg.d.score_control&2) x -= 16; - vc4000_draw_digit(*m_bitmap, x+48, y, m_video.reg.d.bcd[1]>>4, m_video.line-y); - vc4000_draw_digit(*m_bitmap, x+64, y, m_video.reg.d.bcd[1]&0xf, m_video.line-y); - } - } - if (m_video.line==VC4000_END_LINE) m_video.reg.d.sprite_collision |=0x40; - - if (((m_video.line == VC4000_END_LINE) | - (m_video.sprites[3].finished_now) | - (m_video.sprites[2].finished_now) | - (m_video.sprites[1].finished_now) | - (m_video.sprites[0].finished_now)) && (!m_irq_pause)) - { - m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 3); - m_irq_pause=1; - } -} - -UINT32 vc4000_state::screen_update_vc4000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, *m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} diff --git a/src/mess/video/vector06.c b/src/mess/video/vector06.c deleted file mode 100644 index 9ae05a221f9..00000000000 --- a/src/mess/video/vector06.c +++ /dev/null @@ -1,61 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic -/*************************************************************************** - - Vector06c driver by Miodrag Milanovic - - 10/07/2008 Preliminary driver. - -****************************************************************************/ - - -#include "includes/vector06.h" - - -void vector06_state::video_start() -{ -} - -UINT32 vector06_state::screen_update_vector06(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 code1,code2,code3,code4; - UINT8 col; - int y, x, b,draw_y; - UINT8 *ram = m_ram->pointer(); - - int width = (m_video_mode==0x00) ? 256 : 512; - rectangle screen_area(0,width+64-1,0,256+64-1); - // fill border color - bitmap.fill(m_color_index, screen_area); - - // draw image - for (x = 0; x < 32; x++) - { - for (y = 0; y < 256; y++) - { - // port A of 8255 also used as scroll - draw_y = ((255-y-m_keyboard_mask) & 0xff) +32; - code1 = ram[0x8000 + x*256 + y]; - code2 = ram[0xa000 + x*256 + y]; - code3 = ram[0xc000 + x*256 + y]; - code4 = ram[0xe000 + x*256 + y]; - for (b = 0; b < 8; b++) - { - col = ((code1 >> b) & 0x01) * 8 + ((code2 >> b) & 0x01) * 4 + ((code3 >> b) & 0x01)* 2+ ((code4 >> b) & 0x01); - if (m_video_mode==0x00) { - bitmap.pix16(draw_y, x*8+(7-b)+32) = col; - } else { - bitmap.pix16(draw_y, x*16+(7-b)*2+1+32) = ((code2 >> b) & 0x01) * 2; - bitmap.pix16(draw_y, x*16+(7-b)*2+32) = ((code3 >> b) & 0x01) * 2; - } - } - } - } - return 0; -} - -PALETTE_INIT_MEMBER(vector06_state, vector06) -{ - for (UINT8 i=0; i<16; i++) - m_palette->set_pen_color( i, rgb_t::black ); -} diff --git a/src/mess/video/vtech2.c b/src/mess/video/vtech2.c deleted file mode 100644 index dedbf31efc9..00000000000 --- a/src/mess/video/vtech2.c +++ /dev/null @@ -1,312 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller -/*************************************************************************** - vtech2.c - - video hardware - Juergen Buchmueller MESS driver, Jan 2000 - Davide Moretti ROM dump and hardware description - -****************************************************************************/ - -#include "emu.h" - -#include "includes/vtech2.h" - -#define BORDER_H 64 -#define BORDER_V 32 - -/* public */ - -/* - * when in text mode (bit 3 of I/O area = 0) - * bit 3 2 1 0 mode - * 0 x x 0 40 columns x 24 rows display RAM at bank 7 1F800-1FFFF - * 1 x x 0 40 columns x 24 rows display RAM at bank 3 0F800-0FFFF - * 0 x x 1 80 columns x 24 rows display RAM at bank 7 1F800-1FFFF - * 1 x x 1 80 columns x 24 rows display RAM at bank 3 0F800-0FFFF - * - * when in graphics mode (bit 3 of I/O area = 1) - * bit 3 2 1 0 mode - * 0 0 0 x GR5 bank 7 1C000-1FFFF - * 1 0 0 x GR5 bank 3 0C000-0FFFF - * 0 0 1 0 GR4 bank 7 1C000-1FFFF - * 1 0 1 0 GR4 bank 3 0C000-0FFFF - * 0 0 1 1 GR3 bank 7 1C000-1FFFF - * 1 0 1 1 GR3 bank 3 1C000-1FFFF - * 0 1 0 x GR0 bank 7 1E000-1FFFF - * 1 1 0 x GR0 bank 3 0E000-0FFFF - * 0 1 1 0 GR2 bank 7 1E000-1FFFF - * 1 1 1 0 GR2 bank 3 0E000-0FFFF - * 0 1 1 1 GR1 bank 7 1E000-1FFFF - * 1 1 1 1 GR1 bank 3 0E000-0FFFF - */ - -void vtech2_state::video_start() -{ -} - -static const int offs_2[192] = { - 0x0000,0x0800,0x1000,0x1800,0x2000,0x2800,0x3000,0x3800, - 0x0100,0x0900,0x1100,0x1900,0x2100,0x2900,0x3100,0x3900, - 0x0200,0x0a00,0x1200,0x1a00,0x2200,0x2a00,0x3200,0x3a00, - 0x0300,0x0b00,0x1300,0x1b00,0x2300,0x2b00,0x3300,0x3b00, - 0x0400,0x0c00,0x1400,0x1c00,0x2400,0x2c00,0x3400,0x3c00, - 0x0500,0x0d00,0x1500,0x1d00,0x2500,0x2d00,0x3500,0x3d00, - 0x0600,0x0e00,0x1600,0x1e00,0x2600,0x2e00,0x3600,0x3e00, - 0x0700,0x0f00,0x1700,0x1f00,0x2700,0x2f00,0x3700,0x3f00, - 0x0050,0x0850,0x1050,0x1850,0x2050,0x2850,0x3050,0x3850, - 0x0150,0x0950,0x1150,0x1950,0x2150,0x2950,0x3150,0x3950, - 0x0250,0x0a50,0x1250,0x1a50,0x2250,0x2a50,0x3250,0x3a50, - 0x0350,0x0b50,0x1350,0x1b50,0x2350,0x2b50,0x3350,0x3b50, - 0x0450,0x0c50,0x1450,0x1c50,0x2450,0x2c50,0x3450,0x3c50, - 0x0550,0x0d50,0x1550,0x1d50,0x2550,0x2d50,0x3550,0x3d50, - 0x0650,0x0e50,0x1650,0x1e50,0x2650,0x2e50,0x3650,0x3e50, - 0x0750,0x0f50,0x1750,0x1f50,0x2750,0x2f50,0x3750,0x3f50, - 0x00a0,0x08a0,0x10a0,0x18a0,0x20a0,0x28a0,0x30a0,0x38a0, - 0x01a0,0x09a0,0x11a0,0x19a0,0x21a0,0x29a0,0x31a0,0x39a0, - 0x02a0,0x0aa0,0x12a0,0x1aa0,0x22a0,0x2aa0,0x32a0,0x3aa0, - 0x03a0,0x0ba0,0x13a0,0x1ba0,0x23a0,0x2ba0,0x33a0,0x3ba0, - 0x04a0,0x0ca0,0x14a0,0x1ca0,0x24a0,0x2ca0,0x34a0,0x3ca0, - 0x05a0,0x0da0,0x15a0,0x1da0,0x25a0,0x2da0,0x35a0,0x3da0, - 0x06a0,0x0ea0,0x16a0,0x1ea0,0x26a0,0x2ea0,0x36a0,0x3ea0, - 0x07a0,0x0fa0,0x17a0,0x1fa0,0x27a0,0x2fa0,0x37a0,0x3fa0 -}; - -static const int offs_1[192] = { - 0x2000,0x2080,0x2800,0x2880,0x3000,0x3080,0x3800,0x3880, - 0x2100,0x2180,0x2900,0x2980,0x3100,0x3180,0x3900,0x3980, - 0x2200,0x2280,0x2a00,0x2a80,0x3200,0x3280,0x3a00,0x3a80, - 0x2300,0x2380,0x2b00,0x2b80,0x3300,0x3380,0x3b00,0x3b80, - 0x2400,0x2480,0x2c00,0x2c80,0x3400,0x3480,0x3c00,0x3c80, - 0x2500,0x2580,0x2d00,0x2d80,0x3500,0x3580,0x3d00,0x3d80, - 0x2600,0x2680,0x2e00,0x2e80,0x3600,0x3680,0x3e00,0x3e80, - 0x2700,0x2780,0x2f00,0x2f80,0x3700,0x3780,0x3f00,0x3f80, - 0x2028,0x20a8,0x2828,0x28a8,0x3028,0x30a8,0x3828,0x38a8, - 0x2128,0x21a8,0x2928,0x29a8,0x3128,0x31a8,0x3928,0x39a8, - 0x2228,0x22a8,0x2a28,0x2aa8,0x3228,0x32a8,0x3a28,0x3aa8, - 0x2328,0x23a8,0x2b28,0x2ba8,0x3328,0x33a8,0x3b28,0x3ba8, - 0x2428,0x24a8,0x2c28,0x2ca8,0x3428,0x34a8,0x3c28,0x3ca8, - 0x2528,0x25a8,0x2d28,0x2da8,0x3528,0x35a8,0x3d28,0x3da8, - 0x2628,0x26a8,0x2e28,0x2ea8,0x3628,0x36a8,0x3e28,0x3ea8, - 0x2728,0x27a8,0x2f28,0x2fa8,0x3728,0x37a8,0x3f28,0x3fa8, - 0x2050,0x20d0,0x2850,0x28d0,0x3050,0x30d0,0x3850,0x38d0, - 0x2150,0x21d0,0x2950,0x29d0,0x3150,0x31d0,0x3950,0x39d0, - 0x2250,0x22d0,0x2a50,0x2ad0,0x3250,0x32d0,0x3a50,0x3ad0, - 0x2350,0x23d0,0x2b50,0x2bd0,0x3350,0x33d0,0x3b50,0x3bd0, - 0x2450,0x24d0,0x2c50,0x2cd0,0x3450,0x34d0,0x3c50,0x3cd0, - 0x2550,0x25d0,0x2d50,0x2dd0,0x3550,0x35d0,0x3d50,0x3dd0, - 0x2650,0x26d0,0x2e50,0x2ed0,0x3650,0x36d0,0x3e50,0x3ed0, - 0x2750,0x27d0,0x2f50,0x2fd0,0x3750,0x37d0,0x3f50,0x3fd0 -}; - -static const int offs_0[96] = { - 0x2000,0x2800,0x3000,0x3800,0x2100,0x2900,0x3100,0x3900, - 0x2200,0x2a00,0x3200,0x3a00,0x2300,0x2b00,0x3300,0x3b00, - 0x2400,0x2c00,0x3400,0x3c00,0x2500,0x2d00,0x3500,0x3d00, - 0x2600,0x2e00,0x3600,0x3e00,0x2700,0x2f00,0x3700,0x3f00, - 0x2050,0x2850,0x3050,0x3850,0x2150,0x2950,0x3150,0x3950, - 0x2250,0x2a50,0x3250,0x3a50,0x2350,0x2b50,0x3350,0x3b50, - 0x2450,0x2c50,0x3450,0x3c50,0x2550,0x2d50,0x3550,0x3d50, - 0x2650,0x2e50,0x3650,0x3e50,0x2750,0x2f50,0x3750,0x3f50, - 0x20a0,0x28a0,0x30a0,0x38a0,0x21a0,0x29a0,0x31a0,0x39a0, - 0x22a0,0x2aa0,0x32a0,0x3aa0,0x23a0,0x2ba0,0x33a0,0x3ba0, - 0x24a0,0x2ca0,0x34a0,0x3ca0,0x25a0,0x2da0,0x35a0,0x3da0, - 0x26a0,0x2ea0,0x36a0,0x3ea0,0x27a0,0x2fa0,0x37a0,0x3fa0 -}; - -UINT32 vtech2_state::screen_update_laser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT8 *videoram = m_videoram; - int offs, x, y; - int full_refresh = 1; - - if( full_refresh ) - bitmap.fill(((m_laser_bg_mode >> 4) & 15)<<1, cliprect); - - if (m_laser_latch & 0x08) - { - /* graphics modes */ - switch (m_laser_bg_mode & 7) - { - case 0: - case 1: - /* - * GR 5 - * 640x192 1bpp - */ - for( y = 0; y < 192; y++ ) - { - offs = offs_2[y]; - for( x = 0; x < 80; x++, offs++ ) - { - int sx, sy, code, color = m_laser_two_color; - sy = BORDER_V/2 + y; - sx = BORDER_H/2 + x * 8; - code = videoram[offs]; - m_gfxdecode->gfx(2)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); - } - } - break; - - case 2: - /* - * GR 4 - * 320x192 1bpp with two colors per 8 pixels - */ - for( y = 0; y < 192; y++ ) - { - offs = offs_2[y]; - for( x = 0; x < 40; x++, offs += 2 ) - { - int sx, sy, code, color; - sy = BORDER_V/2 + y; - sx = BORDER_H/2 + x * 16; - code = videoram[offs]; - color = videoram[offs+1]; - m_gfxdecode->gfx(3)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); - } - } - break; - - case 3: - /* - * GR 3 - * 160x192 4bpp - */ - for( y = 0; y < 192; y++ ) - { - offs = offs_2[y]; - for( x = 0; x < 80; x++, offs++ ) - { - int sx, sy, code; - sy = BORDER_V/2 + y; - sx = BORDER_H/2 + x * 8; - code = videoram[offs]; - m_gfxdecode->gfx(5)->opaque(bitmap,cliprect,code,0,0,0,sx,sy); - } - } - break; - - case 4: - case 5: - /* - * GR 0 - * 160x96 4bpp - */ - for( y = 0; y < 96; y++ ) - { - offs = offs_0[y]; - for( x = 0; x < 80; x++, offs++ ) - { - int sx, sy, code; - sy = BORDER_V/2 + y * 2; - sx = BORDER_H/2 + x * 8; - code = videoram[offs]; - m_gfxdecode->gfx(6)->opaque(bitmap,cliprect,code,0,0,0,sx,sy); - } - } - break; - - case 6: - /* - * GR 2 - * 320x192 1bpp - */ - for( y = 0; y < 192; y++ ) - { - offs = offs_1[y]; - for( x = 0; x < 40; x++, offs++ ) - { - int sx, sy, code, color = m_laser_two_color; - sy = BORDER_V/2 + y; - sx = BORDER_H/2 + x * 16; - code = videoram[offs]; - m_gfxdecode->gfx(3)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); - } - } - break; - - case 7: - /* - * GR 1 - * 160x192 1bpp with two colors per 8 pixels - */ - for( y = 0; y < 192; y++ ) - { - offs = offs_1[y]; - for( x = 0; x < 20; x++, offs += 2 ) - { - int sx, sy, code, color; - sy = BORDER_V/2 + y; - sx = BORDER_H/2 + x * 32; - code = videoram[offs]; - color = videoram[offs+1]; - m_gfxdecode->gfx(4)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); - } - } - break; - } - } - else - { - /* text modes */ - if (m_laser_bg_mode & 1) - { - /* 80 columns text mode */ - for( y = 0; y < 24; y++ ) - { - offs = ((y & 7) << 8) + ((y >> 3) * 80); - for( x = 0; x < 80; x++, offs++ ) - { - int sx, sy, code, color = m_laser_two_color; - sy = BORDER_V/2 + y * 8; - sx = BORDER_H/2 + x * 8; - code = videoram[0x3800+offs]; - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); - } - } - } - else - { - /* 40 columns text mode */ - for( y = 0; y < 24; y++ ) - { - offs = ((y & 7) << 8) + ((y >> 3) * 80); - for( x = 0; x < 40; x++, offs += 2 ) - { - int sx, sy, code, color = 0; - sy = BORDER_V/2 + y * 8; - sx = BORDER_H/2 + x * 16; - code = videoram[0x3800+offs]; - color = videoram[0x3801+offs]; - m_gfxdecode->gfx(1)->opaque(bitmap,cliprect,code,color,0,0,sx,sy); - } - } - } - } - - if( m_laser_frame_time > 0 ) - { - popmessage("%s", m_laser_frame_message); - } - return 0; -} - -WRITE8_MEMBER(vtech2_state::laser_bg_mode_w) -{ - if (m_laser_bg_mode != data) - { - m_laser_bg_mode = data; - logerror("laser border:$%X mode:$%X\n", data >> 4, data & 15); - } -} - -WRITE8_MEMBER(vtech2_state::laser_two_color_w) -{ - if (m_laser_two_color != data) - { - m_laser_two_color = data; - logerror("laser foreground:$%X background:$%X\n", data >> 4, data & 15); - } -} diff --git a/src/mess/video/vtvideo.c b/src/mess/video/vtvideo.c deleted file mode 100644 index 5170143d749..00000000000 --- a/src/mess/video/vtvideo.c +++ /dev/null @@ -1,956 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Miodrag Milanovic,Karl-Ludwig Deisenhofer -/********************************************************************** -DEC VT Terminal video emulation -[ DC012 and DC011 emulation ] - -01/05/2009 Initial implementation [Miodrag Milanovic] -Enhancements (2013 - 2015) by Karl-Ludwig Deisenhofer. - -DEC VIDEO : STATE AS OF JULY 2014 ---------------------------------- -Code developed with Rainbow-100 hardware in mind (a PC-like machine with a video circuit similar to a VT100 equipped w. AVO) -Details (termination characters, option hardware, MHFU watchdog) differ when compared to VT. - -As of July 2014, the Rainbow video section is more mature than the 'VT100_VIDEO' part (essentially unchanged since 2009). -List of features not yet ported to VT: line doubler; 48 line mode; soft scroll; intensity / palette, AVO (ext.attributes) - -FIXME: work out the differences and identify common code between VT and Rainbow. Unify different code trees. - -- REQUIRED TODOS / TESTS : - * do line and character attributes (plus combinations) match real hardware? - * how does the AVO fit in? - -- SCROLLING REGIONS / SPLIT SCREEN SCROLLING UNTESTED (if you open > 1 file with the VAX editor EDT) - See VT100 Technical Manual: 4.7.4 Address Shuffling to 4.7.9 Split Screen Smooth Scrolling. - More on scrolling regions: Rainbow 100 B technical documentation (QV069-GZ) April 1985 page 22 - -- NEW - INTERLACED MODE (Rainbow only): - Vertical resolution increases from 240 to 480, while the refresh rate halves (flickers on CRTs). - To accomplish this, the display controller repeats even lines in odd scans. - VTVIDEO activates line doubling in 24 line, interlaced mode only. - - Although the DC12 has the ability to display 48 lines, most units are low on screen RAM and - won't even show 80 x 48. -> REASON: (83 x 48 = 3984 Byte) > (screen RAM) minus 'scratch area' - On a VT-180, BIOS scratch requires up to 700 bytes used for SETUP, flags, SILO, keyboard. - -- POSSIBLE IMPROVEMENTS: - -* exact colors for different VR201 monitors (for white, green and amber) - -* ACCURATE VIDEO DELAYS: - Position of the first visible scanline (relative to the vertical reset) depends on - content of fill bytes at the beginning of screen RAM. - - Six invisible, linked lines are initially provided (at location $EE000+ on a Rainbow). - Real-world DC hardware parses the (circular) chain until interrupted by blanking. - BIOS assumes 2 lines are omitted @ 60 and 5 lines are at 50 Hertz (-> longer blank). - - VTVIDEO keeps it simple and skips up to 6 lines considered 'illegal' (offset < $12). - Works even in cases where undocumented delays or lines are poked (SQUINT; VIDEO.PAS). - - Accurate timings for 4 modes (from VT-180 manual 6-30 on): - Vertical frequency = (2 * HF = 31.468 Khz) / DIVIDER - - 50 NI: (2 * HF = 31.468 Khz) / 630 - - 50 interlaced: (2 * HF = 31.468 Khz) / 629 - - 60 NI: (2 * HF = 31.468 Khz) / 524 - - 60 interlaced: (2 * HF = 31.468 Khz) / 525 -**********************************************************************/ - -#include "emu.h" -#include "video/vtvideo.h" - -/*************************************************************************** -PARAMETERS -***************************************************************************/ - -#define VERBOSE 1 - -#define LOG(x) do { if (VERBOSE) logerror x; } while (0) - - -const device_type VT100_VIDEO = &device_creator; -const device_type RAINBOW_VIDEO = &device_creator; - - -vt100_video_device::vt100_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) -: device_t(mconfig, type, name, tag, owner, clock, shortname, source), -device_video_interface(mconfig, *this), -m_read_ram(*this), -m_write_clear_video_interrupt(*this), -m_char_rom_tag(""), -m_palette(*this, "palette") -{ -} - - -vt100_video_device::vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) -: device_t(mconfig, VT100_VIDEO, "VT100 Video", tag, owner, clock, "vt100_video", __FILE__), -device_video_interface(mconfig, *this), -m_read_ram(*this), -m_write_clear_video_interrupt(*this), -m_char_rom_tag(""), -m_palette(*this, "palette") -{ -} - - -rainbow_video_device::rainbow_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) -: vt100_video_device(mconfig, RAINBOW_VIDEO, "Rainbow Video", tag, owner, clock, "rainbow_video", __FILE__) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void vt100_video_device::device_start() -{ - /* resolve callbacks */ - m_read_ram.resolve_safe(0); - m_write_clear_video_interrupt.resolve_safe(); - - m_gfx = machine().root_device().memregion(m_char_rom_tag)->base(); - assert(m_gfx != NULL); - - // LBA7 is scan line frequency update - machine().scheduler().timer_pulse(attotime::from_nsec(31778), timer_expired_delegate(FUNC(vt100_video_device::lba7_change), this)); - - save_item(NAME(m_lba7)); - save_item(NAME(m_scroll_latch)); - save_item(NAME(m_blink_flip_flop)); - save_item(NAME(m_reverse_field)); - save_item(NAME(m_basic_attribute)); - save_item(NAME(m_columns)); - save_item(NAME(m_height)); - save_item(NAME(m_height_MAX)); - save_item(NAME(m_fill_lines)); - save_item(NAME(m_frequency)); - save_item(NAME(m_interlaced)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void vt100_video_device::device_reset() -{ - m_palette->set_pen_color(0, 0x00, 0x00, 0x00); // black - m_palette->set_pen_color(1, 0xff, 0xff, 0xff); // white - - m_height = 25; - m_height_MAX = 25; - - m_lba7 = 0; - - m_scroll_latch = 0; - m_scroll_latch_valid = false; - m_last_scroll = 0; - - m_blink_flip_flop = 0; - m_reverse_field = 0; - m_basic_attribute = 0; - - m_columns = 80; - m_frequency = 60; - - m_interlaced = 1; - m_fill_lines = 2; // for 60Hz - recompute_parameters(); -} - -// ****** RAINBOW ****** -// 4 color (= monochrome intensities) palette, 24 and 48 line modes. -void rainbow_video_device::device_reset() -{ - MHFU_FLAG = false; - MHFU_counter = 0; // **** MHFU: OFF ON COLD BOOT ! **** - - // (rest of the palette is set in the main program) - m_palette->set_pen_color(0, 0x00, 0x00, 0x00); // black - - m_height = 24; // <---- DEC-100 - m_height_MAX = 48; - - m_lba7 = 0; - - m_scroll_latch = 0; - m_scroll_latch_valid = false; - m_last_scroll = 0; - - m_blink_flip_flop = 0; - m_reverse_field = 0; - m_basic_attribute = 0; - - m_columns = 80; - - m_frequency = 60; - - m_interlaced = 1; - m_fill_lines = 2; // for 60Hz (not in use any longer -> detected) - recompute_parameters(); -} - -/*************************************************************************** -IMPLEMENTATION -***************************************************************************/ - -// Also used by Rainbow-100 ************ -void vt100_video_device::recompute_parameters() -{ - rectangle visarea; - int horiz_pix_total = 0; - - // RAINBOW: 240 scan lines in non-interlaced mode (480 interlaced). VT-100 : same (?) - m_linedoubler = false; // 24 "true" lines (240) -OR- 48 lines with NO ghost lines (true 480) - if ((m_interlaced) && (m_height == 24)) - m_linedoubler = true; // 24 lines with 'double scan' (false 480) - - int vert_pix_total = ((m_linedoubler == false) ? m_height : m_height_MAX) * 10; - - if (m_columns == 132) - horiz_pix_total = m_columns * 9; // display 1 less filler pixel in 132 char. mode - else - horiz_pix_total = m_columns * 10; // normal 80 character mode. - - visarea.set(0, horiz_pix_total - 1, 0, vert_pix_total - 1); - machine().first_screen()->configure(horiz_pix_total, vert_pix_total, visarea, HZ_TO_ATTOSECONDS((m_interlaced == 0) ? m_frequency : (m_frequency/2) )); - - if (VERBOSE) - { - printf("\n(RECOMPUTE) HPIX: %d - VPIX: %d", horiz_pix_total, vert_pix_total); - printf("\n(RECOMPUTE) FREQUENCY: %d", (m_interlaced == 0) ? m_frequency : (m_frequency / 2)); - if (m_interlaced) - printf("\n(RECOMPUTE) * INTERLACED *"); - if (m_linedoubler) - printf("\n(RECOMPUTE) * LINEDOUBLER *"); - } -} - - -READ8_MEMBER(vt100_video_device::lba7_r) -{ - return m_lba7; -} - - -// Also used by Rainbow-100 ************ -WRITE8_MEMBER(vt100_video_device::dc012_w) -{ - // Writes to [10C] and [0C] are treated differently - // - see 3.1.3.9.5 DC012 Programming Information (PC-100 spec) - - // MHFU is disabled by writing 00 to port 010C. - - // Code recognition is abysmal - sorry for that. - if (data == 0) - { - UINT8 *rom = machine().root_device().memregion("maincpu")->base(); - if (rom != NULL) - { - UINT32 PC = space.device().safe_pc(); - if ((rom[ PC - 1] == 0xe6) && - (rom[ PC ] == 0x0c) - ) - { - // OUT 0C,al < DO NOTHING > - } - else - { - //UINT8 magic1= rom[PC - 1]; - //printf("\n PC %05x - MHFU MAGIC -1 %02x\n", PC, magic1); - //UINT8 magic2 = rom[PC - 2]; - //printf("\n PC %05x - MHFU MAGIC -2 %02x\n", PC, magic2); - //if (VERBOSE) - - //if(1 ) - if ((rom[PC - 2] == 0x0C) && - (rom[PC - 1] == 0x01) - ) - { - if (MHFU_FLAG == true) - printf("MHFU *** DISABLED *** %05x \n", PC); - - MHFU_FLAG = false; - MHFU_counter = 0; - } - } - - } // DATA == 0 ONLY .... - - } - else - { - //if (VERBOSE) - if (MHFU_FLAG == false) - printf("MHFU ___ENABLED___ %05x \n", space.device().safe_pc()); - - // RESET - MHFU_FLAG = true; - MHFU_counter = 0; - } - - if (!(data & 0x08)) - { - if (!(data & 0x04)) - { - m_scroll_latch_valid = false; // LSB is written first. - // set lower part scroll - m_scroll_latch = data & 0x03; - } - else - { - // set higher part scroll - m_scroll_latch = (m_scroll_latch & 0x03) | ((data & 0x03) << 2); - m_scroll_latch_valid = true; - } - } - else - { - switch (data & 0x0f) - { - case 0x08: - // toggle blink flip flop - m_blink_flip_flop = !(m_blink_flip_flop) ? 1 : 0; - break; - case 0x09: - // clear vertical frequency interrupt; - m_write_clear_video_interrupt(0); - break; - case 0x0a: - // set reverse field on - m_reverse_field = 1; - break; - case 0x0b: - // set reverse field off - m_reverse_field = 0; - break; - - // Writing a 11XX bit combination clears the blink-flip flop (valid for 0x0C - 0x0F): - case 0x0c: - // set basic attribute to underline / blink flip-flop off - m_blink_flip_flop = 0; - m_basic_attribute = 0; // (VT-100 without AVO): reverse video is interpreted as underline (basic_attribute 0) - break; - - case 0x0d: - // (DEC Rainbow 100 DEFAULT) : reverse video with 24 lines / blink flip-flop off - m_blink_flip_flop = 0; - m_basic_attribute = 1; // (VT-100 without AVO): reverse video is interpreted as reverse (basic_attribute 1) - - if (m_height_MAX == 25) break; // Abort on VT-100 for now. - - m_height = 24; // (DEC Rainbow 100) : 24 line display - recompute_parameters(); - break; - - case 0x0e: - m_blink_flip_flop = 0; // 'unsupported' DC012 command. Turns blink flip-flop off (11XX). - break; - - case 0x0f: - // (DEC Rainbow 100): reverse video with 48 lines / blink flip-flop off - m_blink_flip_flop = 0; - m_basic_attribute = 1; - - // 0x0f = 'reserved' on VT 100 - // Abort on VT-100 for now. - if (m_height_MAX == 25) break; - - m_height = 48; // (DEC Rainbow 100) : 48 line display - recompute_parameters(); - break; - } - } -} - -// Writing to DC011 resets internal counters (& disturbs display) on real hardware. -WRITE8_MEMBER(vt100_video_device::dc011_w) -{ - if (!BIT(data, 5)) - { - m_interlaced = 1; - - if (!BIT(data, 4)) - m_columns = 80; - else - m_columns = 132; - } - else - { - m_interlaced = 0; - - if (!BIT(data, 4)) - { - m_frequency = 60; - m_fill_lines = 2; - } - else - { - m_frequency = 50; - m_fill_lines = 5; - } - } - - recompute_parameters(); -} - -WRITE8_MEMBER(vt100_video_device::brightness_w) -{ - //m_palette->set_pen_color(1, data, data, data); -} - - - -void vt100_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type) -{ - UINT8 line = 0; - int bit = 0, prevbit, invert = 0, j; - int double_width = (display_type == 2) ? 1 : 0; - - for (int i = 0; i < 10; i++) - { - switch (display_type) - { - case 0: // bottom half, double height - j = (i >> 1) + 5; break; - case 1: // top half, double height - j = (i >> 1); break; - case 2: // double width - case 3: // normal - j = i; break; - default: j = 0; break; - } - // modify line since that is how it is stored in rom - if (j == 0) j = 15; else j = j - 1; - - line = m_gfx[(code & 0x7f) * 16 + j]; - - if (m_basic_attribute == 1) - { - if ((code & 0x80) == 0x80) - invert = 1; - else - invert = 0; - } - - for (int b = 0; b < 8; b++) - { - prevbit = bit; - bit = BIT((line << b), 7); - if (double_width) - { - bitmap.pix16(y * 10 + i, x * 20 + b * 2) = (bit | prevbit) ^ invert; - bitmap.pix16(y * 10 + i, x * 20 + b * 2 + 1) = bit ^ invert; - } - else - { - bitmap.pix16(y * 10 + i, x * 10 + b) = (bit | prevbit) ^ invert; - } - } - prevbit = bit; - // char interleave is filled with last bit - if (double_width) - { - bitmap.pix16(y * 10 + i, x * 20 + 16) = (bit | prevbit) ^ invert; - bitmap.pix16(y * 10 + i, x * 20 + 17) = bit ^ invert; - bitmap.pix16(y * 10 + i, x * 20 + 18) = bit ^ invert; - bitmap.pix16(y * 10 + i, x * 20 + 19) = bit ^ invert; - } - else - { - bitmap.pix16(y * 10 + i, x * 10 + 8) = (bit | prevbit) ^ invert; - bitmap.pix16(y * 10 + i, x * 10 + 9) = bit ^ invert; - } - } -} - -void vt100_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 addr = 0; - int line = 0; - int xpos = 0; - int ypos = 0; - UINT8 code; - int x = 0; - UINT8 scroll_region = 1; // binary 1 - UINT8 display_type = 3; // binary 11 - UINT16 temp = 0; - - if (m_read_ram(0) != 0x7f) - return; - - while (line < (m_height + m_fill_lines)) - { - code = m_read_ram(addr + xpos); - if (code == 0x7f) - { - // end of line, fill empty till end of line - if (line >= m_fill_lines) - { - for (x = xpos; x < ((display_type == 2) ? (m_columns / 2) : m_columns); x++) - { - display_char(bitmap, code, x, ypos, scroll_region, display_type); - } - } - // move to new data - temp = m_read_ram(addr + xpos + 1) * 256 + m_read_ram(addr + xpos + 2); - addr = (temp)& 0x1fff; - // if A12 is 1 then it is 0x2000 block, if 0 then 0x4000 (AVO) - if (addr & 0x1000) addr &= 0xfff; else addr |= 0x2000; - scroll_region = (temp >> 15) & 1; - display_type = (temp >> 13) & 3; - if (line >= m_fill_lines) - { - ypos++; - } - xpos = 0; - line++; - } - else - { - // display regular char - if (line >= m_fill_lines) - { - display_char(bitmap, code, xpos, ypos, scroll_region, display_type); - } - xpos++; - if (xpos > m_columns) - { - line++; - xpos = 0; - } - } - } - -} - -// ****** RAINBOW ****** -// Display 10 scan lines (or 20 in interlaced mode) for one character @ position X/Y -// NOTE: X or Y indicate a character position! - -// 5 possible CHARACTER STATES (normal, reverse, bold, blink, underline) are encoded into display_type. -// From the VT-180 specs, chapter 6-43 (where multiple attributes are described): -// 1) reverse characters [ XOR of reverse video and reverse screen (A) ] normally have dim backgrounds with black characters (B) -// 2) bold and reverse together give a background of normal intensity - -// 3) blink controls intensity: normal chars vary between A) normal and dim (B) bold chars vary between bright and normal -// 4) blink applied to a -// A) reverse character causes it to alternate between normal and reverse video representation -// B) non-rev. " : alternate between usual intensity and the next lower intensity -// 5) underline causes the 9.th scan to be forced to -// A) white of the same intensity as the characters (for nonreversed characters), -// b) to black (for reverse characters) -// LINE ATTRIBUTE 'double_height' always is interpreted as 'double width + double height' - -// ATTRIBUTES: No attributes = 0x0E -// 1 = display char. in REVERSE (encoded as 8 in display_type) HIGH ACTIVE -// 0 = display char. in BOLD (encoded as 16 in display_type) LOW ACTIVE -// 0 = display char. w. BLINK (encoded as 32 in display_type) LOW ACTIVE -// 0 = display char. w. UNDERLINE (encoded as 64 in display_type) LOW ACTIVE -void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type) -{ - UINT16 x_preset = x << 3; // x_preset = x * 9 (= 132 column mode) - x_preset += x; - - if (m_columns == 80) - x_preset += x; // x_preset = x * 10 (80 column mode) - - UINT16 y_preset; - - UINT16 CHARPOS_y_preset = y << 3; // CHARPOS_y_preset = y * 10; - CHARPOS_y_preset += y; - CHARPOS_y_preset += y; - - UINT16 DOUBLE_x_preset = x_preset << 1; // 18 for 132 column mode, else 20 (x_preset * 2) - - UINT8 line = 0; - int bit = 0, j = 0; - int fg_intensity; - int back_intensity, back_default_intensity; - - int invert = (display_type & 8) ? 1 : 0; // REVERSE - int bold = (display_type & 16) ? 0 : 1; // BIT 4 - int blink = (display_type & 32) ? 0 : 1; // BIT 5 - int underline = (display_type & 64) ? 0 : 1; // BIT 6 - bool blank = (display_type & 128) ? true : false; // BIT 7 - - display_type = display_type & 3; - - // * SCREEN ATTRIBUTES (see VT-180 manual 6-30) * - // 'reverse field' = reverse video over entire screen - - // For reference: a complete truth table can be taken from TABLE 4-6-4 / VT100 technical manual. - // Following IF statements implement it in full. Code segments should not be shuffled. - invert = invert ^ m_reverse_field ^ m_basic_attribute; - - fg_intensity = bold + 2; // FOREGROUND (FG): normal (2) or bright (3) - - back_intensity = 0; // DO NOT SHUFFLE CODE AROUND !! - if ((blink != 0) && (m_blink_flip_flop != 0)) - fg_intensity -= 1; // normal => dim bright => normal (when bold) - - // INVERSION: background gets foreground intensity (reduced by 1). - // _RELIES ON_ on_ previous evaluation of the BLINK signal (fg_intensity). - if (invert != 0) - { - back_intensity = fg_intensity - 1; // BG: normal => dim; dim => OFF; bright => normal - - if (back_intensity != 0) // FG: avoid 'black on black' - fg_intensity = 0; - else - fg_intensity = fg_intensity + 1; // FG: dim => normal; normal => bright - } - - // BG: DEFAULT for entire character (underline overrides this for 1 line) - - back_default_intensity = back_intensity; - - bool double_width = (display_type != 3) ? true : false; // all except normal: double width - bool double_height = (display_type & 1) ? false : true; // 0,2 = double height - - int smooth_offset = 0; - if (scroll_region != 0) - smooth_offset = m_last_scroll; // valid after VBI - - int i = 0; - int extra_scan_line = 0; - for (int scan_line = 0; scan_line < (m_linedoubler ? 20 : 10); scan_line++) - { - y_preset = CHARPOS_y_preset + scan_line; - - // 'i' points to char-rom (plus scroll offset; if active) - - // IF INTERLACED: odd lines = even lines - i = (m_linedoubler ? (scan_line >> 1) : scan_line) + smooth_offset; - - if (i > 9) // handle everything in one loop (in case of smooth scroll): - { - extra_scan_line += 1; - - // Fetch appropriate character bitmap (one scan line) - - // IF INTERLACED: no odd lines - i = smooth_offset - (m_linedoubler ? (extra_scan_line >> 1) : extra_scan_line); - - if (CHARPOS_y_preset >= extra_scan_line) // If result not negative... - y_preset = CHARPOS_y_preset - extra_scan_line; // correct Y pos. - else - { - y_preset = (m_linedoubler ? 480 : 240) - extra_scan_line; - i = 0; // blank line. Might not work with TCS or other charsets (FIXME) - } - } - - switch (display_type) - { - case 0: // bottom half of 'double height, double width' char. - j = (i >> 1) + 5; - break; - - case 2: // top half of 'double height, double width' char. - j = (i >> 1); - break; - - default: // 1: double width - // 3: normal - j = i; - break; - } - - // modify line since that is how it is stored in rom - if (j == 0) j = 15; else j = j - 1; - - line = m_gfx[(code << 4) + j]; // code * 16 - - // UNDERLINED CHARACTERS (CASE 5 - different in 1 line): - back_intensity = back_default_intensity; // 0, 1, 2 - if (underline != 0) - { - if (i == 8) - { - if (invert == 0) - line = 0xff; // CASE 5 A) - else - { - line = 0x00; // CASE 5 B) - back_intensity = 0; // OVERRIDE: BLACK BACKGROUND - } - } - } - - for (int b = 0; b < 8; b++) // 0..7 - { - if (blank) - { - bit = m_reverse_field ^ m_basic_attribute; - } - else - { - bit = BIT((line << b), 7); - - if (bit > 0) - bit = fg_intensity; - else - bit = back_intensity; - } - - // Double, 'double_height + double_width', then normal. - if (double_width) - { - bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1)) = bit; - - if (double_height) - { - bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; - bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1)) = bit; - } - } - else - { - bitmap.pix16(y_preset, x_preset + b) = bit; - } - } // for (8 bit) - - // char interleave (X) is filled with last bit - if (double_width) - { - // double chars: 18 or 20 bits - bitmap.pix16(y_preset, DOUBLE_x_preset + 16) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + 17) = bit; - - if (m_columns == 80) - { - bitmap.pix16(y_preset, DOUBLE_x_preset + 18) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + 19) = bit; - } - } - else - { // normal chars: 9 or 10 bits - bitmap.pix16(y_preset, x_preset + 8) = bit; - - if (m_columns == 80) - bitmap.pix16(y_preset, x_preset + 9) = bit; - } - } // for (scan_line) - -} - -// ****** RAINBOW ****** -void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 addr = 0; - UINT16 attr_addr = 0; - int line = 0; - int xpos = 0; - int ypos = 0; - UINT8 code; - int x = 0; - UINT8 scroll_region = 0; // DEFAULT TO 0 = NOT PART OF scroll_region - UINT8 display_type = 3; // NORMAL DISPLAY - binary 11 - UINT16 temp = 0; - - if (m_read_ram(0) != 0xff) // video uninitialized? - return; - - // Skip fill (0xFF) lines and put result in ADDR. - for (int xp = 1; xp <= 6; xp += 1) // beware of circular references - { - // Fetch LINE ATTRIBUTE before it is gone - attr_addr = 0x1000 | ((addr + 1) & 0x0fff); - - temp = m_read_ram(addr + 2) * 256 + m_read_ram(addr + 1); - addr = (temp)& 0x0fff; - - temp = m_read_ram(attr_addr); - scroll_region = (temp)& 1; - display_type = (temp >> 1) & 3; - - if (addr >= 0x12) - break; - } - - int vert_charlines_MAX = ((m_linedoubler == false) ? m_height : m_height_MAX); - while (line < vert_charlines_MAX ) - { - code = m_read_ram(addr + xpos); - - if (code == 0x00) // TODO: investigate side effect on regular zero character! - display_type |= 0x80; // DEFAULT: filler chars (till end of line) and empty lines (00) will be blanked - else - display_type &= 0x7f; // else activate display. - - if (code == 0xff) // end of line, fill empty till end of line - { - // HINT: display_type is already shifted! All except 3 is DOUBLE WIDTH 40 or 66 chars per line - for (x = xpos; x < ((display_type != 3) ? (m_columns / 2) : m_columns); x++) - { - display_char(bitmap, code, x, ypos, scroll_region, display_type | 0x80); - } - - // LINE ATTRIBUTE - valid for all chars on next line ** DO NOT SHUFFLE ** - attr_addr = 0x1000 | ((addr + xpos + 1) & 0x0fff); - - // MOVE TO NEW DATA - temp = m_read_ram(addr + xpos + 2) * 256 + m_read_ram(addr + xpos + 1); - addr = (temp)& 0x0fff; - - temp = m_read_ram(attr_addr); - scroll_region = (temp)& 1; - display_type = (temp >> 1) & 3; - - ypos++; // Y + 1 in non-interlaced mode - if (m_linedoubler) - ypos++; // Y + 2 in 'double scan' mode (see -> 'display_char') - - if (ypos > vert_charlines_MAX) // prevent invalid Y pos. - break; - - xpos = 0; - line++; - } - else - { - attr_addr = 0x1000 | ((addr + xpos) & 0x0fff); - temp = (m_read_ram(attr_addr) & 15) << 3; // get character attributes - - // see 'display_char' for an explanation of attribute encoding - - display_char(bitmap, code, xpos, ypos, scroll_region, display_type | temp); - - xpos++; - if (xpos > m_columns) - { - xpos = 0; - line++; - } - } // (else) valid char - - } // while - -} - -void rainbow_video_device::notify_vblank(bool v) -{ - static bool v_last; - m_notify_vblank = v; - - if (m_scroll_latch_valid) - { - // Line linking / unlinking is done during VBI (see 4.7.4 and up in VT manual). - if ((v == false) && (v_last == true)) - m_last_scroll = m_scroll_latch; - } - - v_last = v; -} - -void rainbow_video_device::palette_select(int choice) -{ - switch (choice) - { - default: - case 0x01: - m_palette->set_pen_color(1, 0xff - 100, 0xff - 100, 0xff - 100); // WHITE (dim) - m_palette->set_pen_color(2, 0xff - 50, 0xff - 50, 0xff - 50); // WHITE NORMAL - m_palette->set_pen_color(3, 0xff, 0xff, 0xff); // WHITE (brighter) - break; - - case 0x02: - m_palette->set_pen_color(1, 35, 200 - 55, 75); // GREEN (dim) - m_palette->set_pen_color(2, 35 + 55, 200, 75 + 55); // GREEN (NORMAL) - m_palette->set_pen_color(3, 35 + 110, 200 + 55, 75 + 110); // GREEN (brighter) - break; - - case 0x03: - m_palette->set_pen_color(1, 213 - 47, 146 - 47, 82 - 47); // AMBER (dim) - m_palette->set_pen_color(2, 213, 146, 82); // AMBER (NORMAL) - m_palette->set_pen_color(3, 255, 193, 129); // AMBER (brighter) - break; - } -} - -// ****** RAINBOW ****** -void rainbow_video_device::video_blanking(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // 'In reverse screen mode, termination forces the beam to the screen background intensity' - // Background intensity means 'dim' (1) according to one source. - bitmap.fill(((m_reverse_field ^ m_basic_attribute) ? 1 : 0), cliprect); -} - - - -int rainbow_video_device::MHFU(int ASK) -{ - switch (ASK) - { - case 1: // "true": RETURN BOOLEAN (MHFU disabled or enabled?) - return MHFU_FLAG; - - case -1: // -1: increment IF ENABLED, return counter value (=> Rainbow.c) - if (MHFU_FLAG == true) - MHFU_counter++; - return MHFU_counter; - - case -100: // -100 : RESET and ENABLE MHFU counter - MHFU_counter = 0; - if(1) //if (VERBOSE) - printf("-100 MHFU * reset and ENABLE * \n"); - - if(1) // if (VERBOSE) - { - if (MHFU_FLAG == false) - printf("-100 MHFU ___ENABLED___\n"); - } - MHFU_FLAG = true; - - return -100; - - case -200: // -200 : RESET and DISABLE MHFU - MHFU_counter = 0; - - if(1) //if (VERBOSE) - { - if (MHFU_FLAG == true) - printf("MHFU *** DISABLED *** \n"); - } - MHFU_FLAG = false; - - return -200; - - default: - assert(1); - return -255; - } // switch -} - -TIMER_CALLBACK_MEMBER(vt100_video_device::lba7_change) -{ - m_lba7 = (m_lba7) ? 0 : 1; -} - -static MACHINE_CONFIG_FRAGMENT(vt100_video) -MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette") -MACHINE_CONFIG_END - -//------------------------------------------------- -// machine_config_additions - return a pointer to -// the device's machine fragment -//------------------------------------------------- - -machine_config_constructor vt100_video_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME(vt100_video); -} - -static MACHINE_CONFIG_FRAGMENT(rainbow_video) -MCFG_PALETTE_ADD("palette", 4) -MACHINE_CONFIG_END - -//------------------------------------------------- -// machine_config_additions - return a pointer to -// the device's machine fragment -//------------------------------------------------- - -machine_config_constructor rainbow_video_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME(rainbow_video); -} diff --git a/src/mess/video/vtvideo.h b/src/mess/video/vtvideo.h deleted file mode 100644 index 49dbcfef7cd..00000000000 --- a/src/mess/video/vtvideo.h +++ /dev/null @@ -1,113 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Miodrag Milanovic,Karl-Ludwig Deisenhofer -/********************************************************************** - -DEC VT Terminal video emulation -[ DC012 and DC011 emulation ] - -01/05/2009 Initial implementation [Miodrag Milanovic] - -**********************************************************************/ - -#ifndef __VT_VIDEO__ -#define __VT_VIDEO__ - -#include "emu.h" - -class vt100_video_device : public device_t, - public device_video_interface -{ -public: - vt100_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~vt100_video_device() {} - - template static devcb_base &set_ram_rd_callback(device_t &device, _Object object) { return downcast(device).m_read_ram.set_callback(object); } - template static devcb_base &set_clear_video_irq_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_clear_video_interrupt.set_callback(object); } - - static void set_chargen_tag(device_t &device, const char *tag) { downcast(device).m_char_rom_tag = tag; } - - DECLARE_READ8_MEMBER(lba7_r); - DECLARE_WRITE8_MEMBER(dc012_w); - DECLARE_WRITE8_MEMBER(dc011_w); - DECLARE_WRITE8_MEMBER(brightness_w); - - virtual void video_update(bitmap_ind16 &bitmap, const rectangle &cliprect); -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual machine_config_constructor device_mconfig_additions() const; - - // internal state - void recompute_parameters(); - virtual void display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type); - TIMER_CALLBACK_MEMBER(lba7_change); - - devcb_read8 m_read_ram; - devcb_write8 m_write_clear_video_interrupt; - - UINT8 *m_gfx; /* content of char rom */ - - int m_lba7; - - bool MHFU_FLAG; - int MHFU_counter; - - // dc012 attributes - UINT8 m_scroll_latch; - bool m_scroll_latch_valid; - UINT8 m_blink_flip_flop; - UINT8 m_reverse_field; - UINT8 m_basic_attribute; - // dc011 attributes - UINT8 m_columns; - UINT8 m_height; - UINT8 m_height_MAX; - UINT8 m_fill_lines; - UINT8 m_frequency; - UINT8 m_interlaced; - - const char *m_char_rom_tag; /* character rom region */ - required_device m_palette; - - bool m_notify_vblank; - int m_last_scroll; - - bool m_linedoubler; -}; - - -class rainbow_video_device : public vt100_video_device -{ -public: - rainbow_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - virtual void video_update(bitmap_ind16 &bitmap, const rectangle &cliprect); - virtual void video_blanking(bitmap_ind16 &bitmap, const rectangle &cliprect); - - int MHFU(int); - void palette_select(int choice); - void notify_vblank(bool choice); -protected: - virtual void display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type); - virtual void device_reset(); - virtual machine_config_constructor device_mconfig_additions() const; -}; - -extern const device_type VT100_VIDEO; -extern const device_type RAINBOW_VIDEO; - - -#define MCFG_VT_SET_SCREEN MCFG_VIDEO_SET_SCREEN - -#define MCFG_VT_CHARGEN(_tag) \ - vt100_video_device::set_chargen_tag(*device, _tag); - -#define MCFG_VT_VIDEO_RAM_CALLBACK(_read) \ - devcb = &vt100_video_device::set_ram_rd_callback(*device, DEVCB_##_read); - -#define MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(_write) \ - devcb = &vt100_video_device::set_clear_video_irq_wr_callback(*device, DEVCB_##_write); - -#endif diff --git a/src/mess/video/wswan_video.c b/src/mess/video/wswan_video.c deleted file mode 100644 index 8dbb60f0db8..00000000000 --- a/src/mess/video/wswan_video.c +++ /dev/null @@ -1,1216 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Anthony Kruize, Wilbert Pol -/*************************************************************************** - - wswan_video.c - - File to handle video emulation of the Bandai WonderSwan VDP. - - Anthony Kruize - Wilbert Pol - - TODO: - - remove the redundant parts of m_regs - - split the Color VDP from the Mono VDP? - - ***************************************************************************/ - -#include "wswan_video.h" - -const device_type WSWAN_VIDEO = &device_creator; - - -wswan_video_device::wswan_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, WSWAN_VIDEO, "Bandai WonderSwan VDP", tag, owner, clock, "wswan_video", __FILE__), - m_vdp_type(VDP_TYPE_WSWAN) -{ -} - - -void wswan_video_device::common_save() -{ - save_item(NAME(m_bitmap)); - save_item(NAME(m_vram)); - save_item(NAME(m_palette_port)); - save_item(NAME(m_pal)); - save_item(NAME(m_regs)); - - save_item(NAME(m_layer_bg_enable)); - save_item(NAME(m_layer_fg_enable)); - save_item(NAME(m_sprites_enable)); - save_item(NAME(m_window_sprites_enable)); - save_item(NAME(m_window_fg_mode)); - save_item(NAME(m_bg_control)); - save_item(NAME(m_current_line)); - save_item(NAME(m_line_compare)); - save_item(NAME(m_sprite_table_address)); - save_item(NAME(m_sprite_table_buffer)); - save_item(NAME(m_sprite_first)); - save_item(NAME(m_sprite_count)); - save_item(NAME(m_sprite_first_latch)); - save_item(NAME(m_sprite_count_latch)); - save_item(NAME(m_layer_bg_address)); - save_item(NAME(m_layer_fg_address)); - save_item(NAME(m_window_fg_left)); - save_item(NAME(m_window_fg_top)); - save_item(NAME(m_window_fg_right)); - save_item(NAME(m_window_fg_bottom)); - save_item(NAME(m_window_sprites_left)); - save_item(NAME(m_window_sprites_top)); - save_item(NAME(m_window_sprites_right)); - save_item(NAME(m_window_sprites_bottom)); - save_item(NAME(m_layer_bg_scroll_x)); - save_item(NAME(m_layer_bg_scroll_y)); - save_item(NAME(m_layer_fg_scroll_x)); - save_item(NAME(m_layer_fg_scroll_y)); - save_item(NAME(m_lcd_control)); - save_item(NAME(m_icons)); - save_item(NAME(m_color_mode)); - save_item(NAME(m_colors_16)); - save_item(NAME(m_tile_packed)); - save_item(NAME(m_timer_hblank_enable)); - save_item(NAME(m_timer_hblank_mode)); - save_item(NAME(m_timer_hblank_reload)); - save_item(NAME(m_timer_hblank_count)); - save_item(NAME(m_timer_vblank_enable)); - save_item(NAME(m_timer_vblank_mode)); - save_item(NAME(m_timer_vblank_reload)); - save_item(NAME(m_timer_vblank_count)); - save_item(NAME(m_main_palette)); -} - -void wswan_video_device::device_start() -{ - machine().first_screen()->register_screen_bitmap(m_bitmap); - - m_timer = timer_alloc(TIMER_SCANLINE); - m_timer->adjust(attotime::from_ticks(256, 3072000), 0, attotime::from_ticks(256, 3072000)); - - // bind callbacks - m_set_irq_cb.bind_relative_to(*owner()); - m_snd_dma_cb.bind_relative_to(*owner()); - - if (m_vdp_type == VDP_TYPE_WSC) - { - m_vram.resize(0x10000); - memset(&m_vram[0], 0, 0x10000); - m_palette_vram = &m_vram[0xfe00]; - } - else - { - m_vram.resize(0x4000); - memset(&m_vram[0], 0, 0x4000); - m_palette_vram = &m_vram[0]; - } - - common_save(); -} - -// This is a copy of ws_portram_init -// TODO: remove unneeded parts! -static const UINT8 vdp_regs_init[256] = -{ - 0x00, 0x00, 0x00/*?*/, 0xbb, 0x00, 0x00, 0x00, 0x26, 0xfe, 0xde, 0xf9, 0xfb, 0xdb, 0xd7, 0x7f, 0xf5, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x9e, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x99, 0xfd, 0xb7, 0xdf, - 0x30, 0x57, 0x75, 0x76, 0x15, 0x73, 0x70/*77?*/, 0x77, 0x20, 0x75, 0x50, 0x36, 0x70, 0x67, 0x50, 0x77, - 0x57, 0x54, 0x75, 0x77, 0x75, 0x17, 0x37, 0x73, 0x50, 0x57, 0x60, 0x77, 0x70, 0x77, 0x10, 0x73, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, - 0x87, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xdb, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x83, 0x00, - 0x2f, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1 -}; - - -void wswan_video_device::device_reset() -{ - m_layer_bg_enable = 0; - m_layer_fg_enable = 0; - m_sprites_enable = 0; - m_window_sprites_enable = 0; - m_window_fg_mode = 0; - m_bg_control = 0; - m_current_line = 145; // Randomly chosen, beginning of VBlank period to give cart some time to boot up - m_line_compare = 0; - m_sprite_table_address = 0; - m_sprite_first = 0; - m_sprite_count = 0; - m_sprite_first_latch = 0; - m_sprite_count_latch = 0; - m_layer_bg_address = 0; - m_layer_fg_address = 0; - m_window_fg_left = 0; - m_window_fg_top = 0; - m_window_fg_right = 0; - m_window_fg_bottom = 0; - m_window_sprites_left = 0; - m_window_sprites_top = 0; - m_window_sprites_right = 0; - m_window_sprites_bottom = 0; - m_layer_bg_scroll_x = 0; - m_layer_bg_scroll_y = 0; - m_layer_fg_scroll_x = 0; - m_layer_fg_scroll_y = 0; - m_lcd_control = 0x01; - m_icons = 0; - m_color_mode = 0; - m_colors_16 = 0; - m_tile_packed = 0; - m_timer_hblank_enable = 0; - m_timer_hblank_mode = 0; - m_timer_hblank_reload = 0; - m_timer_hblank_count = 0; - m_timer_vblank_enable = 0; - m_timer_vblank_mode = 0; - m_timer_vblank_reload = 0; - m_timer_vblank_count = 0; /* Vertical blank timer counter value */ - - memset(m_sprite_table_buffer, 0, sizeof(m_sprite_table_buffer)); - memset(m_main_palette, 0, sizeof(m_main_palette)); - memcpy(m_regs, vdp_regs_init, 256); - for (int i = 0; i < 0x20; i++) - m_palette_port[i] = m_regs[i + 0x20]; - - setup_palettes(); -} - - -void wswan_video_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_SCANLINE: - scanline_interrupt(); - break; - } -} - - -void wswan_video_device::setup_palettes() -{ - if (m_color_mode) - { - for (int i = 0; i < 16; i++) - for (int j = 0; j < 16; j++) - m_pal[i][j] = ((m_palette_vram[(i << 5) + j * 2 + 1] << 8) | m_palette_vram[(i << 5) + j * 2]) & 0x0fff; - } - else - { - for (int i = 0; i < 16; i++) - { - m_pal[i][0] = (m_palette_port[(i << 1)] >> 0) & 0x07; - m_pal[i][1] = (m_palette_port[(i << 1)] >> 4) & 0x07; - m_pal[i][2] = (m_palette_port[(i << 1) + 1] >> 0) & 0x07; - m_pal[i][3] = (m_palette_port[(i << 1) + 1] >> 4) & 0x07; - } - } -} - -void wswan_video_device::draw_background() -{ - UINT16 map_addr = m_layer_bg_address + (((m_current_line + m_layer_bg_scroll_y) & 0xf8) << 3); - UINT8 start_column = (m_layer_bg_scroll_x >> 3); - - for (int column = 0; column < 29; column++) - { - UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; - int x_offset, tile_line, tile_address; - int tile_data = (m_vram[map_addr + (((start_column + column) & 0x1f) << 1) + 1] << 8) - | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; - int tile_number = tile_data & 0x01ff; - int tile_palette = (tile_data >> 9) & 0x0f; - - tile_line = (m_current_line + m_layer_bg_scroll_y) & 0x07; - if (tile_data & 0x8000) // vflip - tile_line = 7 - tile_line; - - if (m_colors_16) - { - tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = m_vram[tile_address + 2] << 2; - plane3 = m_vram[tile_address + 3] << 3; - } - } - else - { - tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = 0; - plane3 = 0; - } - } - - for (int x = 0; x < 8; x++) - { - int col; - if (m_tile_packed) - { - if (m_colors_16) - { - col = plane0 & 0x0f; - plane0 = plane0 >> 4; - } - else - { - col = plane0 & 0x03; - plane0 = plane0 >> 2; - } - } - else - { - col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); - plane3 = plane3 >> 1; - plane2 = plane2 >> 1; - plane1 = plane1 >> 1; - plane0 = plane0 >> 1; - } - - if (tile_data & 0x4000) - x_offset = x + (column << 3) - (m_layer_bg_scroll_x & 0x07); - else - x_offset = 7 - x + (column << 3) - (m_layer_bg_scroll_x & 0x07); - - if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) - { - if (m_colors_16) - { - if (col) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - { - /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - } - } - } - else - { - if (col || !(tile_palette & 4)) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; - } - } - } - } - } -} - -void wswan_video_device::draw_foreground_0() -{ - UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); - UINT8 start_column = (m_layer_fg_scroll_x >> 3); - - for (int column = 0; column < 29; column++) - { - UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; - int x_offset, tile_line, tile_address; - int tile_data = (m_vram[map_addr + (((start_column + column) & 0x1f) << 1) + 1] << 8) - | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; - int tile_number = tile_data & 0x01ff; - int tile_palette = (tile_data >> 9) & 0x0f; - - tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; - if (tile_data & 0x8000) // vflip - tile_line = 7 - tile_line; - - if (m_colors_16) - { - tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = m_vram[tile_address + 2] << 2; - plane3 = m_vram[tile_address + 3] << 3; - } - } - else - { - tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = 0; - plane3 = 0; - } - } - - for (int x = 0; x < 8; x++ ) - { - int col; - if (m_tile_packed) - { - if (m_colors_16) - { - col = plane0 & 0x0f; - plane0 = plane0 >> 4; - } - else - { - col = plane0 & 0x03; - plane0 = plane0 >> 2; - } - } - else - { - col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); - plane3 = plane3 >> 1; - plane2 = plane2 >> 1; - plane1 = plane1 >> 1; - plane0 = plane0 >> 1; - } - - if (tile_data & 0x4000) - x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); - else - x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); - - if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) - { - if (m_colors_16) - { - if (col) - { -// if (m_color_mode) { - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; -// } else { -// /* Hmmmm, what should we do here... Is this correct?? */ -// m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; -// } - } - } - else - { - if (col || !(tile_palette & 4)) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; - } - } - } - } - } -} - -void wswan_video_device::draw_foreground_2() -{ - UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); - UINT8 start_column = (m_layer_fg_scroll_x >> 3); - - for (int column = 0; column < 29; column++) - { - UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; - int x_offset, tile_line, tile_address; - int tile_data = (m_vram[map_addr + (((start_column + column) & 0x1f) << 1) + 1] << 8) - | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; - int tile_number = tile_data & 0x01ff; - int tile_palette = (tile_data >> 9) & 0x0f; - - tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; - if (tile_data & 0x8000) // vflip - tile_line = 7 - tile_line; - - - if (m_colors_16) - { - tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = m_vram[tile_address + 2] << 2; - plane3 = m_vram[tile_address + 3] << 3; - } - } - else - { - tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = 0; - plane3 = 0; - } - } - - for (int x = 0; x < 8; x++) - { - int col; - if (m_tile_packed) - { - if (m_colors_16) - { - col = plane0 & 0x0f; - plane0 = plane0 >> 4; - } - else - { - col = plane0 & 0x03; - plane0 = plane0 >> 2; - } - } - else - { - col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); - plane3 = plane3 >> 1; - plane2 = plane2 >> 1; - plane1 = plane1 >> 1; - plane0 = plane0 >> 1; - } - - if (tile_data & 0x4000) - x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); - else - x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); - - if (x_offset >= 0 && x_offset >= m_window_fg_left && x_offset < m_window_fg_right && x_offset < WSWAN_X_PIXELS) - { - if (m_colors_16) - { - if (col) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - } - } - else - { - if (col || !(tile_palette & 4)) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; - } - } - } - } - } -} - -void wswan_video_device::draw_foreground_3() -{ - UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); - UINT8 start_column = (m_layer_fg_scroll_x >> 3); - - for (int column = 0; column < 29; column++) - { - UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; - int x_offset, tile_line, tile_address; - int tile_data = (m_vram[map_addr + (((start_column + column) & 0x1f) << 1) + 1] << 8) - | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; - int tile_number = tile_data & 0x01ff; - int tile_palette = (tile_data >> 9) & 0x0f; - - tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; - if (tile_data & 0x8000) // vflip - tile_line = 7 - tile_line; - - if (m_colors_16) - { - tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = m_vram[tile_address + 2] << 2; - plane3 = m_vram[tile_address + 3] << 3; - } - } - else - { - tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = 0; - plane3 = 0; - } - } - - for (int x = 0; x < 8; x++) - { - int col; - if (m_tile_packed) - { - if (m_colors_16) - { - col = plane0 & 0x0f; - plane0 = plane0 >> 4; - } - else - { - col = plane0 & 0x03; - plane0 = plane0 >> 2; - } - } - else - { - col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); - plane3 = plane3 >> 1; - plane2 = plane2 >> 1; - plane1 = plane1 >> 1; - plane0 = plane0 >> 1; - } - - if (tile_data & 0x4000) - x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); - else - x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); - - if ((x_offset >= 0 && x_offset < m_window_fg_left) || (x_offset >= m_window_fg_right && x_offset < WSWAN_X_PIXELS)) - { - if (m_colors_16) - { - if (col) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - } - } - else - { - if (col || !(tile_palette & 4)) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; - } - } - } - } - } -} - -void wswan_video_device::handle_sprites(int mask) -{ - if (m_sprite_count == 0) - return; - - for (int i = m_sprite_first + m_sprite_count - 1; i >= m_sprite_first; i--) - { - UINT16 tile_data = (m_sprite_table_buffer[i * 4 + 1] << 8) | m_sprite_table_buffer[i * 4]; - UINT8 y = m_sprite_table_buffer[ i * 4 + 2 ]; - UINT8 x = m_sprite_table_buffer[ i * 4 + 3 ]; - int tile_line = (m_current_line - y) & 0xff; - - if ((tile_line >= 0) && (tile_line < 8) && ((tile_data & 0x2000) == mask)) - { - UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; - int x_offset, tile_address; - int tile_number = tile_data & 0x01ff; - int tile_palette = 8 + ((tile_data >> 9) & 0x07); - int check_clip = 0; - - if (tile_data & 0x8000) - tile_line = 7 - tile_line; - - if (m_colors_16) - { - tile_address = 0x4000 + (tile_number * 32) + (tile_line << 2); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = m_vram[tile_address + 2] << 2; - plane3 = m_vram[tile_address + 3] << 3; - } - } - else - { - tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); - if (m_tile_packed) - { - plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; - } - else - { - plane0 = m_vram[tile_address + 0]; - plane1 = m_vram[tile_address + 1] << 1; - plane2 = 0; - plane3 = 0; - } - } - - if (m_window_sprites_enable) - { - if (tile_data & 0x1000) - { - if (m_current_line >= m_window_sprites_top && m_current_line <= m_window_sprites_bottom) - check_clip = 1; - } - else - { - if (m_current_line < m_window_sprites_top || m_current_line > m_window_sprites_bottom) - continue; - } - } - - for (int j = 0; j < 8; j++) - { - int col; - if (m_tile_packed) - { - if (m_colors_16) - { - col = plane0 & 0x0f; - plane0 = plane0 >> 4; - } - else - { - col = plane0 & 0x03; - plane0 = plane0 >> 2; - } - } - else - { - col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); - plane3 = plane3 >> 1; - plane2 = plane2 >> 1; - plane1 = plane1 >> 1; - plane0 = plane0 >> 1; - } - - if (tile_data & 0x4000) - x_offset = x + j; - else - x_offset = x + 7 - j; - - x_offset = x_offset & 0xff; - - if (m_window_sprites_enable) - { - if (tile_data & 0x1000 && check_clip) - { - if (x_offset >= m_window_sprites_left && x_offset <= m_window_sprites_right) - continue; - } - else - { - if (x_offset < m_window_sprites_left || x_offset > m_window_sprites_right) - { -// continue; - } - } - } - if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) - { - if (m_colors_16) - { - if (col) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - } - } - else - { - if (col || !(tile_palette & 4)) - { - if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; - else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; - } - } - } - } - } - } -} - - -void wswan_video_device::refresh_scanline() -{ - setup_palettes(); - - rectangle rec(0, WSWAN_X_PIXELS, m_current_line, m_current_line); - if (m_lcd_control) - { - /* Not sure if these background color checks and settings are correct */ - if (m_color_mode && m_colors_16) - m_bitmap.fill(m_pal[m_bg_control >> 4][m_bg_control & 0x0f], rec); - else - m_bitmap.fill(m_main_palette[m_bg_control & 0x07], rec); - } - else - { - m_bitmap.fill(0, rec); - return; - } - - // Draw background layer - if (m_layer_bg_enable) - draw_background(); - - // Draw sprites between background and foreground layers - if (m_sprites_enable) - handle_sprites(0); - - // Draw foreground layer, taking window settings into account - if (m_layer_fg_enable) - { - switch (m_window_fg_mode) - { - case 0: // FG inside & outside window area - draw_foreground_0(); - break; - case 1: // ??? - logerror("Unknown foreground mode 1 set\n"); - break; - case 2: // FG only inside window area - if (m_current_line >= m_window_fg_top && m_current_line <= m_window_fg_bottom) - draw_foreground_2(); - break; - case 3: // FG only outside window area - if (m_current_line < m_window_fg_top || m_current_line > m_window_fg_bottom) - draw_foreground_0(); - else - draw_foreground_3(); - break; - } - } - - // Draw sprites in front of foreground layer - if (m_sprites_enable) - handle_sprites(0x2000); -} - - - -UINT32 wswan_video_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} - - -READ8_MEMBER(wswan_video_device::reg_r) -{ - UINT8 value = m_regs[offset]; - - if (offset >= 0x20 && offset < 0x40) - return m_palette_port[offset & 0x1f]; - - switch (offset) - { - case 0x01: - value = m_bg_control; - break; - case 0x02: - value = m_current_line; - break; - case 0x14: - value = m_lcd_control; - break; - case 0xa8: - value = m_timer_hblank_count & 0xff; - break; - case 0xa9: - value = m_timer_hblank_count >> 8; - break; - case 0xaa: - value = m_timer_vblank_count & 0xff; - break; - case 0xab: - value = m_timer_vblank_count >> 8; - break; - } - - return value; -} - - -WRITE8_MEMBER(wswan_video_device::reg_w) -{ - if (offset >= 0x20 && offset < 0x40) - { - // 0x20-0x3f tile/sprite palette settings - // even offs - // Bit 0-3 - Palette (offs & 0x1f)/2 index 0 - // Bit 4-7 - Palette (offs & 0x1f)/2 index 1 - // odd offs - // Bit 0-3 - Palette (offs & 0x1f)/2 index 2 - // Bit 4-7 - Palette (offs & 0x1f)/2 index 3 - m_palette_port[offset & 0x1f] = data; - return; - } - - switch (offset) - { - case 0x00: // Display control - // Bit 0 - Background layer enable - // Bit 1 - Foreground layer enable - // Bit 2 - Sprites enable - // Bit 3 - Sprite window enable - // Bit 4-5 - Foreground window configuration - // 00 - Foreground layer is displayed inside and outside foreground window area - // 01 - Unknown - // 10 - Foreground layer is displayed only inside foreground window area - // 11 - Foreground layer is displayed outside foreground window area - // Bit 6-7 - Unknown - m_layer_bg_enable = data & 0x1; - m_layer_fg_enable = (data & 0x2) >> 1; - m_sprites_enable = (data & 0x4) >> 2; - m_window_sprites_enable = (data & 0x8) >> 3; - m_window_fg_mode = (data & 0x30) >> 4; - break; - case 0x01: // Background colour - // In 16 colour mode: - // Bit 0-3 - Palette index - // Bit 4-7 - Palette number - // Otherwise: - // Bit 0-2 - Main palette index - // Bit 3-7 - Unknown - m_bg_control = data; - break; - case 0x02: // Current scanline (Most likely read-only) - logerror("Write to current scanline! Current value: %d Data to write: %d\n", m_current_line, data); - // Returning so we don't overwrite the value here, not that it really matters - return; - case 0x03: // Line compare - m_line_compare = data; - logerror("Write to line compare: %d\n", data); - break; - case 0x04: // Sprite table base address - // Bit 0-5 - Determine sprite table base address 0 0xxxxxx0 00000000 - // Bit 6-7 - Unknown - m_sprite_table_address = (data & 0x3f) << 9; - break; - case 0x05: // First sprite number (the one we start drawing with) - m_sprite_first_latch = data; - if (data) logerror("non-zero first sprite %d\n", data); - break; - case 0x06: // Number of sprites to draw - m_sprite_count_latch = data; - break; - case 0x07: // Background/Foreground table base addresses - // Bit 0-2 - Determine background table base address 00xxx000 00000000 - // Bit 3 - Unknown - // Bit 4-6 - Determine foreground table base address 00xxx000 00000000 - // Bit 7 - Unknown - m_layer_bg_address = (data & 0x7) << 11; - m_layer_fg_address = (data & 0x70) << 7; - break; - case 0x08: // Left coordinate of foreground window - m_window_fg_left = data; - break; - case 0x09: // Top coordinate of foreground window - m_window_fg_top = data; - break; - case 0x0a: // Right coordinate of foreground window - m_window_fg_right = data; - break; - case 0x0b: // Bottom coordinate of foreground window - m_window_fg_bottom = data; - break; - case 0x0c: // Left coordinate of sprite window - m_window_sprites_left = data; - break; - case 0x0d: // Top coordinate of sprite window - m_window_sprites_top = data; - break; - case 0x0e: // Right coordinate of sprite window - m_window_sprites_right = data; - break; - case 0x0f: // Bottom coordinate of sprite window - m_window_sprites_bottom = data; - break; - case 0x10: // Background layer X scroll - m_layer_bg_scroll_x = data; - break; - case 0x11: // Background layer Y scroll - m_layer_bg_scroll_y = data; - break; - case 0x12: // Foreground layer X scroll - m_layer_fg_scroll_x = data; - break; - case 0x13: // Foreground layer Y scroll - m_layer_fg_scroll_y = data; - break; - case 0x14: // LCD control - // Bit 0 - LCD enable - // Bit 1-7 - Unknown - m_lcd_control = data; - break; - case 0x15: // LCD icons - // Bit 0 - LCD sleep icon enable - // Bit 1 - Vertical position icon enable - // Bit 2 - Horizontal position icon enable - // Bit 3 - Dot 1 icon enable - // Bit 4 - Dot 2 icon enable - // Bit 5 - Dot 3 icon enable - // Bit 6-7 - Unknown - m_icons = data; /* ummmmm */ - break; - case 0x1c: // Palette colors 0 and 1 - // Bit 0-3 - Gray tone setting for main palette index 0 - // Bit 4-7 - Gray tone setting for main palette index 1 - if (m_vdp_type == VDP_TYPE_WSC) - { - int i = 15 - (data & 0x0f); - int j = 15 - ((data & 0xf0) >> 4); - m_main_palette[0] = (i << 8) | (i << 4) | i; - m_main_palette[1] = (j << 8) | (j << 4) | j; - } - else - { - m_main_palette[0] = data & 0x0f; - m_main_palette[1] = (data & 0xf0) >> 4; - } - break; - case 0x1d: // Palette colors 2 and 3 - // Bit 0-3 - Gray tone setting for main palette index 2 - // Bit 4-7 - Gray tone setting for main palette index 3 - if (m_vdp_type == VDP_TYPE_WSC) - { - int i = 15 - (data & 0x0f); - int j = 15 - ((data & 0xf0) >> 4); - m_main_palette[2] = (i << 8) | (i << 4) | i; - m_main_palette[3] = (j << 8) | (j << 4) | j; - } - else - { - m_main_palette[2] = data & 0x0f; - m_main_palette[3] = (data & 0xf0) >> 4; - } - break; - case 0x1e: // Palette colors 4 and 5 - // Bit 0-3 - Gray tone setting for main palette index 4 - // Bit 4-7 - Gray tone setting for main palette index 5 - if (m_vdp_type == VDP_TYPE_WSC) - { - int i = 15 - (data & 0x0f); - int j = 15 - ((data & 0xf0) >> 4); - m_main_palette[4] = (i << 8) | (i << 4) | i; - m_main_palette[5] = (j << 8) | (j << 4) | j; - } - else - { - m_main_palette[4] = data & 0x0f; - m_main_palette[5] = (data & 0xf0) >> 4; - } - break; - case 0x1f: // Palette colors 6 and 7 - // Bit 0-3 - Gray tone setting for main palette index 6 - // Bit 4-7 - Gray tone setting for main palette index 7 - if (m_vdp_type == VDP_TYPE_WSC) - { - int i = 15 - (data & 0x0f); - int j = 15 - ((data & 0xf0) >> 4); - m_main_palette[6] = (i << 8) | (i << 4) | i; - m_main_palette[7] = (j << 8) | (j << 4) | j; - } - else - { - m_main_palette[6] = data & 0x0f; - m_main_palette[7] = (data & 0xf0) >> 4; - } - break; - case 0x60: // Video mode - // Bit 0-4 - Unknown - // Bit 5 - Packed mode 0 = not packed mode, 1 = packed mode - // Bit 6 - 4/16 colour mode select: 0 = 4 colour mode, 1 = 16 colour mode - // Bit 7 - monochrome/colour mode select: 0 = monochrome mode, 1 = colour mode - /* - * 111 - packed, 16 color, use 4000/8000, color - * 110 - not packed, 16 color, use 4000/8000, color - * 101 - packed, 4 color, use 2000, color - * 100 - not packed, 4 color, use 2000, color - * 011 - packed, 16 color, use 4000/8000, monochrome - * 010 - not packed, 16 color , use 4000/8000, monochrome - * 001 - packed, 4 color, use 2000, monochrome - * 000 - not packed, 4 color, use 2000, monochrome - Regular WS monochrome - */ - if (m_vdp_type == VDP_TYPE_WSC) - { - m_color_mode = data & 0x80; - m_colors_16 = data & 0x40; - m_tile_packed = data & 0x20; - } - break; - case 0xa2: // Timer control - // Bit 0 - HBlank Timer enable - // Bit 1 - HBlank Timer mode: 0 = one shot, 1 = auto reset - // Bit 2 - VBlank Timer(1/75s) enable - // Bit 3 - VBlank Timer mode: 0 = one shot, 1 = auto reset - // Bit 4-7 - Unknown - m_timer_hblank_enable = BIT(data, 0); - m_timer_hblank_mode = BIT(data, 1); - m_timer_vblank_enable = BIT(data, 2); - m_timer_vblank_mode = BIT(data, 3); - break; - case 0xa4: // HBlank timer frequency reload value (bits 0-7) - m_timer_hblank_reload &= 0xff00; - m_timer_hblank_reload += data; - m_timer_hblank_count = m_timer_hblank_reload; - break; - case 0xa5: // HBlank timer frequency reload value (bits 8-15) - m_timer_hblank_reload &= 0xff; - m_timer_hblank_reload += data << 8; - m_timer_hblank_count = m_timer_hblank_reload; - break; - case 0xa6: // VBlank timer frequency reload value (bits 0-7) - m_timer_vblank_reload &= 0xff00; - m_timer_vblank_reload += data; - m_timer_vblank_count = m_timer_vblank_reload; - break; - case 0xa7: // VBlank timer frequency reload value (bits 8-15) - m_timer_vblank_reload &= 0xff; - m_timer_vblank_reload += data << 8; - m_timer_vblank_count = m_timer_vblank_reload; - break; - case 0xa8: // HBlank counter (bits 0-7) - case 0xa9: // HBlank counter (bits 8-15) - case 0xaa: // VBlank counter (bits 0-7) - case 0xab: // VBlank counter (bits 8-15) - break; - } - - m_regs[offset] = data; -} - - -void wswan_video_device::scanline_interrupt() -{ - if (m_current_line < 144) - refresh_scanline(); - - // Decrement 12kHz (HBlank) counter - if (m_timer_hblank_enable && m_timer_hblank_reload != 0) - { - m_timer_hblank_count--; - logerror("timer_hblank_count: %X\n", m_timer_hblank_count); - if (m_timer_hblank_count == 0) - { - if (m_timer_hblank_mode) - m_timer_hblank_count = m_timer_hblank_reload; - else - m_timer_hblank_reload = 0; - - logerror( "triggering hbltmr interrupt\n" ); - m_set_irq_cb(WSWAN_VIDEO_IFLAG_HBLTMR); - } - } - - // Handle Sound DMA - m_snd_dma_cb(); - -// m_current_line = (m_current_line + 1) % 159; - - if (m_current_line == 144) // buffer sprite table - { - memcpy(m_sprite_table_buffer, &m_vram[m_sprite_table_address], 512); - m_sprite_first = m_sprite_first_latch; // always zero? - m_sprite_count = m_sprite_count_latch; - } - - if (m_current_line == 144) - { - m_set_irq_cb(WSWAN_VIDEO_IFLAG_VBL); - /* Decrement 75Hz (VBlank) counter */ - if (m_timer_vblank_enable && m_timer_vblank_reload != 0) - { - m_timer_vblank_count--; - logerror("timer_vblank_count: %X\n", m_timer_vblank_count); - if (m_timer_vblank_count == 0) - { - if (m_timer_vblank_mode) - m_timer_vblank_count = m_timer_vblank_reload; - else - m_timer_vblank_reload = 0; - - logerror("triggering vbltmr interrupt\n"); - m_set_irq_cb(WSWAN_VIDEO_IFLAG_VBLTMR); - } - } - } - -// m_current_line = (m_current_line + 1) % 159; - - if (m_current_line == m_line_compare) - m_set_irq_cb(WSWAN_VIDEO_IFLAG_LCMP); - - m_current_line = (m_current_line + 1) % 159; -} - - -READ8_MEMBER(wswan_video_device::vram_r) -{ - return m_vram[offset]; -} - -WRITE8_MEMBER(wswan_video_device::vram_w) -{ - m_vram[offset] = data; -} diff --git a/src/mess/video/wswan_video.h b/src/mess/video/wswan_video.h deleted file mode 100644 index 2d51c9800c4..00000000000 --- a/src/mess/video/wswan_video.h +++ /dev/null @@ -1,149 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Anthony Kruize, Wilbert Pol -/********************************************************************** - - wswan.h - - File to handle video emulation of the Bandai WonderSwan. - - Anthony Kruize - Wilbert Pol - -**********************************************************************/ - -#ifndef __WSWAN_VIDEO__ -#define __WSWAN_VIDEO__ - -#include "emu.h" - -enum -{ - VDP_TYPE_WSWAN = 0, - VDP_TYPE_WSC -}; - -#define WSWAN_X_PIXELS (28*8) -#define WSWAN_Y_PIXELS (18*8) - - - -typedef device_delegate wswan_video_irq_cb_delegate; -#define WSWAN_VIDEO_IRQ_CB_MEMBER(_name) void _name(int irq) - -typedef device_delegate wswan_video_dmasnd_cb_delegate; -#define WSWAN_VIDEO_DMASND_CB_MEMBER(_name) void _name(void) - -#define MCFG_WSWAN_VIDEO_IRQ_CB(_class, _method) \ - wswan_video_device::set_irq_callback(*device, wswan_video_irq_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - -#define MCFG_WSWAN_VIDEO_DMASND_CB(_class, _method) \ - wswan_video_device::set_dmasnd_callback(*device, wswan_video_dmasnd_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); - -#define MCFG_WSWAN_VIDEO_TYPE( _type) \ - wswan_video_device::set_vdp_type(*device, _type); - - -class wswan_video_device : public device_t -{ -public: - wswan_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~wswan_video_device() {} - - // static configuration - static void set_irq_callback(device_t &device, wswan_video_irq_cb_delegate callback) { downcast(device).m_set_irq_cb = callback; } - static void set_dmasnd_callback(device_t &device, wswan_video_dmasnd_cb_delegate callback) { downcast(device).m_snd_dma_cb = callback; } - static void set_vdp_type(device_t &device, int type) { downcast(device).m_vdp_type = type; } - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - virtual DECLARE_READ8_MEMBER(vram_r); - virtual DECLARE_WRITE8_MEMBER(vram_w); - virtual DECLARE_READ8_MEMBER(reg_r); - virtual DECLARE_WRITE8_MEMBER(reg_w); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - void setup_palettes(); - void draw_background(); - void draw_foreground_0(); - void draw_foreground_2(); - void draw_foreground_3(); - void handle_sprites(int mask); - void refresh_scanline(); - void scanline_interrupt(); - void common_save(); - - bitmap_ind16 m_bitmap; - UINT8 m_layer_bg_enable; /* Background layer on/off */ - UINT8 m_layer_fg_enable; /* Foreground layer on/off */ - UINT8 m_sprites_enable; /* Sprites on/off */ - UINT8 m_window_sprites_enable; /* Sprite window on/off */ - UINT8 m_window_fg_mode; /* 0:inside/outside, 1:??, 2:inside, 3:outside */ - UINT8 m_bg_control; - UINT8 m_current_line; /* Current scanline : 0-158 (159?) */ - UINT8 m_line_compare; /* Line to trigger line interrupt on */ - UINT32 m_sprite_table_address; /* Address of the sprite table */ - UINT8 m_sprite_table_buffer[512]; - UINT8 m_sprite_first; /* First sprite to draw */ - UINT8 m_sprite_count; /* Number of sprites to draw */ - UINT8 m_sprite_first_latch; - UINT8 m_sprite_count_latch; - UINT16 m_layer_bg_address; /* Address of the background screen map */ - UINT16 m_layer_fg_address; /* Address of the foreground screen map */ - UINT8 m_window_fg_left; /* Left coordinate of foreground window */ - UINT8 m_window_fg_top; /* Top coordinate of foreground window */ - UINT8 m_window_fg_right; /* Right coordinate of foreground window */ - UINT8 m_window_fg_bottom; /* Bottom coordinate of foreground window */ - UINT8 m_window_sprites_left; /* Left coordinate of sprites window */ - UINT8 m_window_sprites_top; /* Top coordinate of sprites window */ - UINT8 m_window_sprites_right; /* Right coordinate of sprites window */ - UINT8 m_window_sprites_bottom; /* Bottom coordinate of sprites window */ - UINT8 m_layer_bg_scroll_x; /* Background layer X scroll */ - UINT8 m_layer_bg_scroll_y; /* Background layer Y scroll */ - UINT8 m_layer_fg_scroll_x; /* Foreground layer X scroll */ - UINT8 m_layer_fg_scroll_y; /* Foreground layer Y scroll */ - UINT8 m_lcd_control; /* LCD on/off */ - UINT8 m_icons; /* FIXME: What do we do with these? Maybe artwork? */ - UINT8 m_color_mode; /* monochrome/color mode */ - UINT8 m_colors_16; /* 4/16 colors mode */ - UINT8 m_tile_packed; /* layered/packed tile mode switch */ - UINT8 m_timer_hblank_enable; /* Horizontal blank interrupt on/off */ - UINT8 m_timer_hblank_mode; /* Horizontal blank timer mode */ - UINT16 m_timer_hblank_reload; /* Horizontal blank timer reload value */ - UINT16 m_timer_hblank_count; /* Horizontal blank timer counter value */ - UINT8 m_timer_vblank_enable; /* Vertical blank interrupt on/off */ - UINT8 m_timer_vblank_mode; /* Vertical blank timer mode */ - UINT16 m_timer_vblank_reload; /* Vertical blank timer reload value */ - UINT16 m_timer_vblank_count; /* Vertical blank timer counter value */ - int m_main_palette[8]; - emu_timer *m_timer; - - dynamic_buffer m_vram; - UINT8 *m_palette_vram; - UINT8 m_palette_port[0x20]; - int m_pal[16][16]; - UINT8 m_regs[256]; - - wswan_video_irq_cb_delegate m_set_irq_cb; - wswan_video_dmasnd_cb_delegate m_snd_dma_cb; - int m_vdp_type; - - // timer IDs - static const device_timer_id TIMER_SCANLINE = 0; - - // interrupt flags - // these are the same as the wswan.h ones - static const UINT8 WSWAN_VIDEO_IFLAG_LCMP = 0x10; - static const UINT8 WSWAN_VIDEO_IFLAG_VBLTMR = 0x20; - static const UINT8 WSWAN_VIDEO_IFLAG_VBL = 0x40; - static const UINT8 WSWAN_VIDEO_IFLAG_HBLTMR = 0x80; -}; - -extern const device_type WSWAN_VIDEO; - - -#endif diff --git a/src/mess/video/x68k.c b/src/mess/video/x68k.c deleted file mode 100644 index fce9998286a..00000000000 --- a/src/mess/video/x68k.c +++ /dev/null @@ -1,1267 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Barry Rodewald,Carl -/* - - Sharp X68000 video functions - driver by Barry Rodewald - - X68000 video hardware (there are some minor revisions to these custom chips across various X680x0 models): - Custom sprite controller "Cynthia" - Custom CRT controller "Vinas / Vicon" - Custom video controller "VSOP / VIPS" - Custom video data selector "Cathy" - - In general terms: - 1 "Text" layer - effectively a 4bpp bitmap split into 4 planes at 1bpp each - 512kB "text" VRAM - can write to multiple planes at once - can copy one character line to another character line - is 1024x1024 in size - Up to 4 graphic layers - can be 4 layers with a 16 colour palette, 2 layers with a 256 colour palette, - or 1 layer at 16-bit RGB. - 512k graphic VRAM - all layers are 512x512, but at 16 colours, the 4 layers can be combined into 1 1024x1024 layer - one or more layers can be cleared at once quickly with a simple hardware function - 2 tilemapped layers - can be 8x8 or 16x16, 16 colours per tile, max 256 colours overall - 1 sprite layer - up to 128 16x16 sprites, 16 colours per sprite, maximum 16 sprites per scanline (not yet implemented). - - Questions: What do the other bits in m_video.reg[2] do? - What is "special priority mode"? - How is the intensity applied during blending if at all? - Black appears to be opaque only at priority 2 but not 3, is that right? - Are the gfx layers blended from the bottom up or all at once? - -*/ - -#include "emu.h" - -#include "machine/mc68901.h" -#include "includes/x68k.h" -#include "machine/ram.h" - - -PALETTE_DECODER_MEMBER(x68k_state, GGGGGRRRRRBBBBBI) -{ - UINT8 i = raw & 1; - UINT8 r = pal6bit(((raw >> 5) & 0x3e) | i); - UINT8 g = pal6bit(((raw >> 10) & 0x3e) | i); - UINT8 b = pal6bit(((raw >> 0) & 0x3e) | i); - return rgb_t(r, g, b); -} - -inline void x68k_state::x68k_plot_pixel(bitmap_rgb32 &bitmap, int x, int y, UINT32 color) -{ - bitmap.pix32(y, x) = (UINT16)color; -} -/* -bitmap_rgb32* ::x68k_get_gfx_page(int pri,int type) -{ - if(type == GFX16) - { - switch(pri) - { - case 0: - return x68k_gfx_0_bitmap_16; - case 1: - return x68k_gfx_1_bitmap_16; - case 2: - return x68k_gfx_2_bitmap_16; - case 3: - return x68k_gfx_3_bitmap_16; - default: - return x68k_gfx_0_bitmap_16; // should never reach here. - } - } - if(type == GFX256) - { - switch(pri) - { - case 0: - case 1: - return x68k_gfx_0_bitmap_256; - case 2: - case 3: - return x68k_gfx_1_bitmap_256; - default: - return x68k_gfx_0_bitmap_256; // should never reach here. - } - } - if(type == GFX65536) - return x68k_gfx_0_bitmap_65536; - - return NULL; // should never reach here either. -} -*/ -void x68k_state::x68k_crtc_text_copy(int src, int dest, UINT8 planes) -{ - // copys one raster in T-VRAM to another raster - int src_ram = src * 256; // 128 bytes per scanline - int dest_ram = dest * 256; - - // update RAM in each plane - if(planes & 1) - memcpy(&m_tvram[dest_ram],&m_tvram[src_ram],512); - if(planes & 2) - memcpy(&m_tvram[dest_ram+0x10000],&m_tvram[src_ram+0x10000],512); - if(planes & 4) - memcpy(&m_tvram[dest_ram+0x20000],&m_tvram[src_ram+0x20000],512); - if(planes & 8) - memcpy(&m_tvram[dest_ram+0x30000],&m_tvram[src_ram+0x30000],512); -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_operation_end) -{ - int bit = param; - m_crtc.operation &= ~bit; -} - -void x68k_state::x68k_crtc_refresh_mode() -{ -// rectangle rect; -// double scantime; - rectangle scr,visiblescr; - int length; - - // Calculate data from register values - m_crtc.vmultiple = 1; - if((m_crtc.reg[20] & 0x10) != 0 && (m_crtc.reg[20] & 0x0c) == 0) - m_crtc.vmultiple = 2; // 31.5kHz + 256 lines = doublescan - if(m_crtc.interlace != 0) - m_crtc.vmultiple = 0.5f; // 31.5kHz + 1024 lines or 15kHz + 512 lines = interlaced - m_crtc.htotal = (m_crtc.reg[0] + 1) * 8; - m_crtc.vtotal = (m_crtc.reg[4] + 1) / m_crtc.vmultiple; // default is 567 (568 scanlines) - m_crtc.hbegin = (m_crtc.reg[2] * 8) + 1; - m_crtc.hend = (m_crtc.reg[3] * 8); - m_crtc.vbegin = (m_crtc.reg[6]) / m_crtc.vmultiple; - m_crtc.vend = (m_crtc.reg[7] - 1) / m_crtc.vmultiple; - if((m_crtc.vmultiple == 2) && !(m_crtc.reg[7] & 1)) // otherwise if the raster irq line == vblank line, the raster irq fires too late - m_crtc.vend++; - m_crtc.hsync_end = (m_crtc.reg[1]) * 8; - m_crtc.vsync_end = (m_crtc.reg[5]) / m_crtc.vmultiple; - m_crtc.hsyncadjust = m_crtc.reg[8]; - scr.set(0, m_crtc.htotal - 8, 0, m_crtc.vtotal); - if(scr.max_y <= m_crtc.vend) - scr.max_y = m_crtc.vend + 2; - if(scr.max_x <= m_crtc.hend) - scr.max_x = m_crtc.hend + 2; - visiblescr.set(m_crtc.hbegin, m_crtc.hend, m_crtc.vbegin, m_crtc.vend); - - // expand visible area to the size indicated by CRTC reg 20 - length = m_crtc.hend - m_crtc.hbegin; - if (length < m_crtc.width) - { - visiblescr.min_x = m_crtc.hbegin - ((m_crtc.width - length)/2); - visiblescr.max_x = m_crtc.hend + ((m_crtc.width - length)/2); - } - length = m_crtc.vend - m_crtc.vbegin; - if (length < m_crtc.height) - { - visiblescr.min_y = m_crtc.vbegin - ((m_crtc.height - length)/2); - visiblescr.max_y = m_crtc.vend + ((m_crtc.height - length)/2); - } - // bounds check - if(visiblescr.min_x < 0) - visiblescr.min_x = 0; - if(visiblescr.min_y < 0) - visiblescr.min_y = 0; - if(visiblescr.max_x >= scr.max_x) - visiblescr.max_x = scr.max_x - 2; - if(visiblescr.max_y >= scr.max_y - 1) - visiblescr.max_y = scr.max_y - 2; - -// logerror("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i\n",m_crtc.reg[0],m_crtc.reg[1],m_crtc.reg[2],m_crtc.reg[3], -// m_crtc.reg[4],m_crtc.reg[5],m_crtc.reg[6],m_crtc.reg[7],m_crtc.reg[8],m_crtc.reg[9]); - logerror("video_screen_configure(machine.first_screen(),%i,%i,[%i,%i,%i,%i],55.45)\n",scr.max_x,scr.max_y,visiblescr.min_x,visiblescr.min_y,visiblescr.max_x,visiblescr.max_y); - m_screen->configure(scr.max_x,scr.max_y,visiblescr,HZ_TO_ATTOSECONDS(55.45)); -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_hsync) -{ - int hstate = param; - attotime hsync_time; - - m_crtc.hblank = hstate; - m_mfpdev->i7_w(!m_crtc.hblank); - - if(m_crtc.operation & 8) - x68k_crtc_text_copy((m_crtc.reg[22] & 0xff00) >> 8,(m_crtc.reg[22] & 0x00ff),(m_crtc.reg[21] & 0xf)); - - if(m_crtc.vmultiple == 2) // 256-line (doublescan) - { - if(hstate == 1) - { - if(m_oddscanline == 1) - { - int scan = m_screen->vpos(); - if(scan > m_crtc.vend) - scan = m_crtc.vbegin; - hsync_time = m_screen->time_until_pos(scan,(m_crtc.htotal + m_crtc.hend) / 2); - m_scanline_timer->adjust(hsync_time); - if(scan != 0) - { - if((ioport("options")->read() & 0x04)) - { - m_screen->update_partial(scan); - } - } - } - else - { - int scan = m_screen->vpos(); - if(scan > m_crtc.vend) - scan = m_crtc.vbegin; - hsync_time = m_screen->time_until_pos(scan,m_crtc.hend / 2); - m_scanline_timer->adjust(hsync_time); - if(scan != 0) - { - if((ioport("options")->read() & 0x04)) - { - m_screen->update_partial(scan); - } - } - } - } - if(hstate == 0) - { - if(m_oddscanline == 1) - { - int scan = m_screen->vpos(); - if(scan > m_crtc.vend) - scan = m_crtc.vbegin; - else - scan++; - hsync_time = m_screen->time_until_pos(scan,m_crtc.hbegin / 2); - m_scanline_timer->adjust(hsync_time, 1); - m_oddscanline = 0; - } - else - { - hsync_time = m_screen->time_until_pos(m_screen->vpos(),(m_crtc.htotal + m_crtc.hbegin) / 2); - m_scanline_timer->adjust(hsync_time, 1); - m_oddscanline = 1; - } - } - } - else // 512-line - { - if(hstate == 1) - { - int scan = m_screen->vpos(); - if(scan > m_crtc.vend) - scan = 0; - hsync_time = m_screen->time_until_pos(scan,m_crtc.hend); - m_scanline_timer->adjust(hsync_time); - if(scan != 0) - { - if((ioport("options")->read() & 0x04)) - { - m_screen->update_partial(scan); - } - } - } - if(hstate == 0) - { - hsync_time = m_screen->time_until_pos(m_screen->vpos()+1,m_crtc.hbegin); - m_scanline_timer->adjust(hsync_time, 1); - } - } -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_raster_end) -{ - m_mfpdev->i6_w(1); -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_raster_irq) -{ - int scan = param; - attotime irq_time; - attotime end_time; - - if(scan <= m_crtc.vtotal) - { - m_mfpdev->i6_w(0); - m_screen->update_partial(scan); - irq_time = m_screen->time_until_pos(scan,m_crtc.hbegin); - // end of HBlank period clears GPIP6 also? - end_time = m_screen->time_until_pos(scan,m_crtc.hend); - m_raster_irq->adjust(irq_time, scan); - timer_set(end_time, TIMER_X68K_CRTC_RASTER_END); - logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,m_screen->vpos()); - } -} - -TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_vblank_irq) -{ - int val = param; - attotime irq_time; - int vblank_line; - - if(val == 1) // V-DISP on - { - m_crtc.vblank = 1; - vblank_line = m_crtc.vbegin; - irq_time = m_screen->time_until_pos(vblank_line,2); - m_vblank_irq->adjust(irq_time); - logerror("CRTC: VBlank on\n"); - } - if(val == 0) // V-DISP off - { - m_crtc.vblank = 0; - vblank_line = m_crtc.vend; - if(vblank_line > m_crtc.vtotal) - vblank_line = m_crtc.vtotal; - irq_time = m_screen->time_until_pos(vblank_line,2); - m_vblank_irq->adjust(irq_time, 1); - logerror("CRTC: VBlank off\n"); - } - - m_mfpdev->tai_w(!m_crtc.vblank); - m_mfpdev->i4_w(!m_crtc.vblank); -} - - -// CRTC "VINAS 1+2 / VICON" at 0xe80000 -/* 0xe80000 - Registers (all are 16-bit): - * 0 - Horizontal Total (in characters) - * 1 - Horizontal Sync End - * 2 - Horizontal Display Begin - * 3 - Horizontal Display End - * 4 - Vertical Total (in scanlines) - * 5 - Vertical Sync End - * 6 - Vertical Display Begin - * 7 - Vertical Display End - * 8 - Fine Horizontal Sync Adjustment - * 9 - Raster Line (for Raster IRQ mapped to MFP GPIP6) - * 10/11 - Text Layer X and Y Scroll - * 12/13 - Graphic Layer 0 X and Y Scroll - * 14/15 - Graphic Layer 1 X and Y Scroll - * 16/17 - Graphic Layer 2 X and Y Scroll - * 18/19 - Graphic Layer 3 X and Y Scroll - * 20 - bit 12 - Text VRAM mode : 0 = display, 1 = buffer - * bit 11 - Graphic VRAM mode : 0 = display, 1 = buffer - * bit 10 - "Real" screen size : 0 = 512x512, 1 = 1024x1024 - * bits 8,9 - Colour mode : - * 00 = 16 colour 01 = 256 colour - * 10 = Undefined 11 = 65,536 colour - * bit 4 - Horizontal Frequency : 0 = 15.98kHz, 1 = 31.50kHz - * bits 2,3 - Vertical dots : - * 00 = 256 01 = 512 - * 10 or 11 = 1024 (interlaced) - * bits 0,1 - Horizontal dots : - * 00 = 256 01 = 512 - * 10 = 768 11 = 50MHz clock mode (Compact XVI or later) - * 21 - bit 9 - Text Screen Access Mask Enable - * bit 8 - Text Screen Simultaneous Plane Access Enable - * bits 4-7 - Text Screen Simultaneous Plane Access Select - * bits 0-3 - Text Screen Line Copy Plane Select - * Graphic Screen High-speed Clear Page Select - * 22 - Text Screen Line Copy - * bits 15-8 - Source Line - * bits 7-0 - Destination Line - * 23 - Text Screen Mask Pattern - * - * 0xe80481 - Operation Port (8-bit): - * bit 3 - Text Screen Line Copy Begin - * bit 1 - Graphic Screen High-speed Clear Begin - * bit 0 - Image Taking Begin (?) - * Operation Port bits are cleared automatically when the requested - * operation is completed. - */ -WRITE16_MEMBER(x68k_state::x68k_crtc_w ) -{ - if (offset < 0x24) - COMBINE_DATA(m_crtc.reg+offset); - switch(offset) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - x68k_crtc_refresh_mode(); - break; - case 9: // CRTC raster IRQ (GPIP6) - { - attotime irq_time; - data = m_crtc.reg[9]; - irq_time = m_screen->time_until_pos((data) / m_crtc.vmultiple,2); - - if(irq_time.as_double() > 0) - m_raster_irq->adjust(irq_time, (data) / m_crtc.vmultiple); - } - logerror("CRTC: Write to raster IRQ register - %i\n",data); - break; - case 20: - if(ACCESSING_BITS_0_7) - { - m_crtc.interlace = 0; - switch(data & 0x0c) - { - case 0x00: - m_crtc.height = 256; - break; - case 0x08: - case 0x0c: // TODO: 1024 vertical, if horizontal freq = 31kHz - m_crtc.height = 512; - m_crtc.interlace = 1; // if 31kHz, 1024 lines = interlaced - break; - case 0x04: - m_crtc.height = 512; - if(!(m_crtc.reg[20] & 0x0010)) // if 15kHz, 512 lines = interlaced - m_crtc.interlace = 1; - break; - } - switch(data & 0x03) - { - case 0x00: - m_crtc.width = 256; - break; - case 0x01: - m_crtc.width = 512; - break; - case 0x02: - case 0x03: // 0x03 = 50MHz clock mode (XVI only) - m_crtc.width = 768; - break; - } - } -/* if(ACCESSING_BITS_8_15) - { - m_crtc.interlace = 0; - if(data & 0x0400) - m_crtc.interlace = 1; - }*/ - x68k_crtc_refresh_mode(); - break; - case 576: // operation register - m_crtc.operation = data; - if(data & 0x02) // high-speed graphic screen clear - { - memset(&m_gvram[0],0,0x40000); - timer_set(attotime::from_msec(10), TIMER_X68K_CRTC_OPERATION_END, 0x02); // time taken to do operation is a complete guess. - } - break; - } -// logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",m_maincpu->safe_pc(),data,offset); -} - -READ16_MEMBER(x68k_state::x68k_crtc_r ) -{ - if(offset < 24) - { -// logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",m_maincpu->safe_pc(),m_crtc.reg[offset],offset); - switch(offset) - { - case 9: - return 0; - case 10: // Text X/Y scroll - case 11: - case 12: // Graphic layer 0 scroll - case 13: - return m_crtc.reg[offset] & 0x3ff; - case 14: // Graphic layer 1 scroll - case 15: - case 16: // Graphic layer 2 scroll - case 17: - case 18: // Graphic layer 3 scroll - case 19: - return m_crtc.reg[offset] & 0x1ff; - default: - return m_crtc.reg[offset]; - } - } - if(offset == 576) // operation port, operation bits are set to 0 when operation is complete - return m_crtc.operation; -// logerror("CRTC: [%08x] Read from unknown CRTC register %i\n",activecpu_get_pc(),offset); - return 0xffff; -} - -WRITE16_MEMBER(x68k_state::x68k_gvram_w ) -{ -// int xloc,yloc,pageoffset; - /* - G-VRAM usage is determined by colour depth and "real" screen size. - - For screen size of 1024x1024, all G-VRAM space is used, in one big page. - At 1024x1024 real screen size, colour depth is always 4bpp, and ranges from - 0xc00000-0xdfffff. - - For screen size of 512x512, the colour depth determines the page usage. - 16 colours = 4 pages - 256 colours = 2 pages - 65,536 colours = 1 page - Page 1 - 0xc00000-0xc7ffff Page 2 - 0xc80000-0xcfffff - Page 3 - 0xd00000-0xd7ffff Page 4 - 0xd80000-0xdfffff - */ - - // handle different G-VRAM page setups - if(m_crtc.reg[20] & 0x0800) // G-VRAM set to buffer - { - if(offset < 0x40000) - COMBINE_DATA(&m_gvram[offset]); - } - else - { - switch(m_crtc.reg[20] & 0x0300) - { - case 0x0300: - if(offset < 0x40000) - COMBINE_DATA(&m_gvram[offset]); - break; - case 0x0100: - if(offset < 0x40000) - { - m_gvram[offset] = (m_gvram[offset] & 0xff00) | (data & 0x00ff); - } - if(offset >= 0x40000 && offset < 0x80000) - { - m_gvram[offset-0x40000] = (m_gvram[offset-0x40000] & 0x00ff) | ((data & 0x00ff) << 8); - } - break; - case 0x0000: - if(offset < 0x40000) - { - m_gvram[offset] = (m_gvram[offset] & 0xfff0) | (data & 0x000f); - } - if(offset >= 0x40000 && offset < 0x80000) - { - m_gvram[offset-0x40000] = (m_gvram[offset-0x40000] & 0xff0f) | ((data & 0x000f) << 4); - } - if(offset >= 0x80000 && offset < 0xc0000) - { - m_gvram[offset-0x80000] = (m_gvram[offset-0x80000] & 0xf0ff) | ((data & 0x000f) << 8); - } - if(offset >= 0xc0000 && offset < 0x100000) - { - m_gvram[offset-0xc0000] = (m_gvram[offset-0xc0000] & 0x0fff) | ((data & 0x000f) << 12); - } - break; - default: - logerror("G-VRAM written while layer setup is undefined.\n"); - } - } -} - -WRITE16_MEMBER(x68k_state::x68k_tvram_w ) -{ - UINT16 text_mask; - - text_mask = ~(m_crtc.reg[23]) & mem_mask; - - if(!(m_crtc.reg[21] & 0x0200)) // text access mask enable - text_mask = 0xffff & mem_mask; - - mem_mask = text_mask; - - if(m_crtc.reg[21] & 0x0100) - { // simultaneous T-VRAM plane access (I think ;)) - int plane,wr; - offset = offset & 0x00ffff; - wr = (m_crtc.reg[21] & 0x00f0) >> 4; - for(plane=0;plane<4;plane++) - { - if(wr & (1 << plane)) - { - COMBINE_DATA(&m_tvram[offset+0x10000*plane]); - } - } - } - else - { - COMBINE_DATA(&m_tvram[offset]); - } -} - -READ16_MEMBER(x68k_state::x68k_gvram_r ) -{ - UINT16 ret = 0; - - if(m_crtc.reg[20] & 0x0800) // G-VRAM set to buffer - return m_gvram[offset]; - - switch(m_crtc.reg[20] & 0x0300) // colour setup determines G-VRAM use - { - case 0x0300: // 65,536 colour (RGB) - 16-bits per word - if(offset < 0x40000) - ret = m_gvram[offset]; - else - ret = 0xffff; - break; - case 0x0100: // 256 colour (paletted) - 8 bits per word - if(offset < 0x40000) - ret = m_gvram[offset] & 0x00ff; - if(offset >= 0x40000 && offset < 0x80000) - ret = (m_gvram[offset-0x40000] & 0xff00) >> 8; - if(offset >= 0x80000) - ret = 0xffff; - break; - case 0x0000: // 16 colour (paletted) - 4 bits per word - if(offset < 0x40000) - ret = m_gvram[offset] & 0x000f; - if(offset >= 0x40000 && offset < 0x80000) - ret = (m_gvram[offset-0x40000] & 0x00f0) >> 4; - if(offset >= 0x80000 && offset < 0xc0000) - ret = (m_gvram[offset-0x80000] & 0x0f00) >> 8; - if(offset >= 0xc0000 && offset < 0x100000) - ret = (m_gvram[offset-0xc0000] & 0xf000) >> 12; - break; - default: - logerror("G-VRAM read while layer setup is undefined.\n"); - ret = 0xffff; - } - - return ret; -} - -READ16_MEMBER(x68k_state::x68k_tvram_r ) -{ - return m_tvram[offset]; -} - -WRITE16_MEMBER(x68k_state::x68k_spritereg_w ) -{ - COMBINE_DATA(&m_spritereg[offset]); - switch(offset) - { - case 0x400: - m_bg0_8->set_scrollx(0,(data - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); - m_bg0_16->set_scrollx(0,(data - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); - break; - case 0x401: - m_bg0_8->set_scrolly(0,(data - m_crtc.vbegin) & 0x3ff); - m_bg0_16->set_scrolly(0,(data - m_crtc.vbegin) & 0x3ff); - break; - case 0x402: - m_bg1_8->set_scrollx(0,(data - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); - m_bg1_16->set_scrollx(0,(data - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); - break; - case 0x403: - m_bg1_8->set_scrolly(0,(data - m_crtc.vbegin) & 0x3ff); - m_bg1_16->set_scrolly(0,(data - m_crtc.vbegin) & 0x3ff); - break; - case 0x406: // BG H-DISP (normally equals CRTC reg 2 value + 4) - if(data != 0x00ff) - { - m_crtc.bg_visible_width = (m_crtc.reg[3] - ((data & 0x003f) - 4)) * 8; - m_crtc.bg_hshift = ((data - (m_crtc.reg[2]+4)) * 8); - if(m_crtc.bg_hshift > 0) - m_crtc.bg_hshift = 0; - } - break; - case 0x407: // BG V-DISP (like CRTC reg 6) - m_crtc.bg_vshift = m_crtc.vshift; - break; - case 0x408: // BG H/V-Res - m_crtc.bg_hvres = data & 0x1f; - if(data != 0xff) - { // Handle when the PCG is using 256 and the CRTC is using 512 - if((m_crtc.bg_hvres & 0x0c) == 0x00 && (m_crtc.reg[20] & 0x0c) == 0x04) - m_crtc.bg_double = 2; - else - m_crtc.bg_double = 1; - } - else - m_crtc.bg_double = 1; - break; - } -} - -READ16_MEMBER(x68k_state::x68k_spritereg_r ) -{ - if(offset >= 0x400 && offset < 0x404) - return m_spritereg[offset] & 0x3ff; - return m_spritereg[offset]; -} - -WRITE16_MEMBER(x68k_state::x68k_spriteram_w ) -{ - COMBINE_DATA(m_spriteram+offset); - m_video.tile8_dirty[offset / 16] = 1; - m_video.tile16_dirty[offset / 64] = 1; - if(offset < 0x2000) - { - m_bg1_8->mark_all_dirty(); - m_bg1_16->mark_all_dirty(); - m_bg0_8->mark_all_dirty(); - m_bg0_16->mark_all_dirty(); - } - if(offset >= 0x2000 && offset < 0x3000) - { - m_bg1_8->mark_tile_dirty(offset & 0x0fff); - m_bg1_16->mark_tile_dirty(offset & 0x0fff); - } - if(offset >= 0x3000) - { - m_bg0_8->mark_tile_dirty(offset & 0x0fff); - m_bg0_16->mark_tile_dirty(offset & 0x0fff); - } -} - -READ16_MEMBER(x68k_state::x68k_spriteram_r ) -{ - return m_spriteram[offset]; -} - -void x68k_state::x68k_draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle rect) -{ - unsigned int line,pixel; // location on screen - UINT32 loc; // location in TVRAM - UINT32 colour; - int bit; - - for(line=rect.min_y;line<=rect.max_y;line++) // per scanline - { - // adjust for scroll registers - loc = (((line - m_crtc.vbegin) + yscr) & 0x3ff) * 64; - loc += (xscr / 16) & 0x7f; - loc &= 0xffff; - bit = 15 - (xscr & 0x0f); - for(pixel=rect.min_x;pixel<=rect.max_x;pixel++) // per pixel - { - colour = (((m_tvram[loc] >> bit) & 0x01) ? 1 : 0) - + (((m_tvram[loc+0x10000] >> bit) & 0x01) ? 2 : 0) - + (((m_tvram[loc+0x20000] >> bit) & 0x01) ? 4 : 0) - + (((m_tvram[loc+0x30000] >> bit) & 0x01) ? 8 : 0); - // Colour 0 is displayable if the text layer is at the priority level 2 - if((m_pcgpalette->pen(colour) & 0xffffff) || ((m_video.reg[1] & 0x0c00) == 0x0800)) - bitmap.pix32(line, pixel) = m_pcgpalette->pen(colour); - bit--; - if(bit < 0) - { - bit = 15; - loc++; - loc &= 0xffff; - } - } - } -} - -bool x68k_state::x68k_draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, UINT8 priority) -{ - int pixel; - int page; - UINT32 loc; // location in GVRAM - UINT32 lineoffset; - UINT16 xscr,yscr; - UINT16 colour = 0; - int shift; - int scanline; - bool blend, ret = false; - UINT16 *pal = (UINT16 *)m_gfxpalette->basemem().base(); - - for(scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline - { - if(m_crtc.reg[20] & 0x0400) // 1024x1024 "real" screen size - use 1024x1024 16-colour gfx layer - { - // adjust for scroll registers - if(m_video.reg[2] & 0x0010 && priority == m_video.gfxlayer_pri[0]) - { - xscr = (m_crtc.reg[12] & 0x3ff); - yscr = (m_crtc.reg[13] & 0x3ff); - lineoffset = (((scanline - m_crtc.vbegin) + yscr) & 0x3ff) * 1024; - loc = xscr & 0x3ff; - for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) - { - switch(lineoffset & 0xc0000) - { - case 0x00000: - colour = m_gvram[lineoffset + (loc & 0x3ff)] & 0x000f; - break; - case 0x40000: - colour = (m_gvram[(lineoffset - 0x40000) + (loc & 0x3ff)] & 0x00f0) >> 4; - break; - case 0x80000: - colour = (m_gvram[(lineoffset - 0x80000) + (loc & 0x3ff)] & 0x0f00) >> 8; - break; - case 0xc0000: - colour = (m_gvram[(lineoffset - 0xc0000) + (loc & 0x3ff)] & 0xf000) >> 12; - break; - } - if(colour || (priority == 3)) - bitmap.pix16(scanline, pixel) = colour; - loc++; - loc &= 0x3ff; - } - } - } - else // else 512x512 "real" screen size - { - if(m_video.reg[2] & (1 << priority)) - { - page = m_video.gfxlayer_pri[priority]; - // adjust for scroll registers - switch(m_video.reg[0] & 0x03) - { - case 0x00: // 16 colours - xscr = ((m_crtc.reg[12+(page*2)])) & 0x1ff; - yscr = ((m_crtc.reg[13+(page*2)])) & 0x1ff; - lineoffset = (((scanline - m_crtc.vbegin) + yscr) & 0x1ff) * 512; - loc = xscr & 0x1ff; - shift = 4; - if((m_video.reg[2] & 0x1a00) == 0x1a00) - ret = true; - for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) - { - colour = ((m_gvram[lineoffset + loc] >> page*shift) & 0x000f); - if(ret && (colour & 1)) - { - blend = true; - colour &= 0xfe; - } - else - blend = false; - if(colour || (priority == 3)) - { - if(ret) - { - if(blend && bitmap.pix16(scanline, pixel)) - bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; - else - bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; - } - else - bitmap.pix16(scanline, pixel) = colour; - } - loc++; - loc &= 0x1ff; - } - break; - case 0x01: // 256 colours - if(page == 0 || page == 2) - { - xscr = ((m_crtc.reg[12+(page*2)])) & 0x1ff; - yscr = ((m_crtc.reg[13+(page*2)])) & 0x1ff; - lineoffset = (((scanline - m_crtc.vbegin) + yscr) & 0x1ff) * 512; - loc = xscr & 0x1ff; - shift = 4; - if((m_video.reg[2] & 0x1a00) == 0x1a00) - ret = true; - for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) - { - colour = ((m_gvram[lineoffset + loc] >> page*shift) & 0x00ff); - if(ret && (colour & 1)) - { - blend = true; - colour &= 0xfe; - } - else - blend = false; - if(colour || (priority == 3)) - { - if(ret) - { - if(blend && bitmap.pix16(scanline, pixel)) - bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; - else - bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; - } - else - bitmap.pix16(scanline, pixel) = colour; - } - loc++; - loc &= 0x1ff; - } - } - break; - case 0x03: // 65536 colours - xscr = ((m_crtc.reg[12])) & 0x1ff; - yscr = ((m_crtc.reg[13])) & 0x1ff; - lineoffset = (((scanline - m_crtc.vbegin) + yscr) & 0x1ff) * 512; - loc = xscr & 0x1ff; - for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) - { - colour = m_gvram[lineoffset + loc]; - if(colour || (priority == 3)) - bitmap.pix16(scanline, pixel) = colour; - loc++; - loc &= 0x1ff; - } - break; - } - } - } - } - return ret; -} - -void x68k_state::x68k_draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) -{ - int priority, scanline, pixel; - bool gfxblend=false; - //rectangle rect; - //int xscr,yscr; - //int gpage; - - if(m_crtc.reg[20] & 0x0800) // if graphic layers are set to buffer, then they aren't visible - return; - - m_gfxbitmap->fill(0, cliprect); - - for(priority=3;priority>=0;priority--) - { - gfxblend = x68k_draw_gfx_scanline(*m_gfxbitmap,cliprect,priority); - } - - for(scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) - { - UINT16 colour; - bool blend = false; - for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) - { - if((m_video.reg[0] & 0x03) == 3) - { - colour = m_gfxbitmap->pix16(scanline, pixel); - if(colour || (m_video.gfx_pri == 2)) - bitmap.pix32(scanline, pixel) = GGGGGRRRRRBBBBBI_decoder(colour); - } - else if(gfxblend) - { - colour = m_gfxbitmap->pix16(scanline, pixel); - if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) - blend = true; - else - blend = false; - if(colour || (m_video.gfx_pri == 2)) - { - if(blend) - bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((pal555(colour, 6, 11, 1) >> 1) & 0x7f7f7f); - else - bitmap.pix32(scanline, pixel) = pal555(colour, 6, 11, 1); - } - } - else - { - colour = m_gfxbitmap->pix16(scanline, pixel) & 0xff; - if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) - { - blend = true; - colour &= 0xfe; - } - else - blend = false; - if((colour && (m_gfxpalette->pen(colour) & 0xffffff)) || (m_video.gfx_pri == 2)) - { - if(blend) - bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((m_gfxpalette->pen(colour) >> 1) & 0x7f7f7f); - else - bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour); - } - } - } - } -} - -// Sprite controller "Cynthia" at 0xeb0000 -void x68k_state::x68k_draw_sprites(bitmap_ind16 &bitmap, int priority, rectangle cliprect) -{ - /* - 0xeb0000 - 0xeb07ff - Sprite registers (up to 128) - + 00 : b9-0, Sprite X position - + 02 : b9-0, Sprite Y position - + 04 : b15, Vertical Reversing (flipping?) - b14, Horizontal Reversing - b11-8, Sprite colour - b7-0, Sprite tile code (in PCG) - + 06 : b1-0, Priority - 00 = Sprite not displayed - - 0xeb0800 - BG0 X Scroll (10-bit) - 0xeb0802 - BG0 Y Scroll - 0xeb0804 - BG1 X Scroll - 0xeb0806 - BG1 Y Scroll - 0xeb0808 - BG control - b9, BG/Sprite display (RAM and register access is faster if 1) - b4, PCG area 1 available - b3, BG1 display enable - b1, PCG area 0 available - b0, BG0 display enable - 0xeb080a - Horizontal total (like CRTC reg 0 - is 0xff if in 256x256?) - 0xeb080c - Horizontal display position (like CRTC reg 2 - +4) - 0xeb080e - Vertical display position (like CRTC reg 6) - 0xeb0810 - Resolution setting - b4, "L/H" (apparently 15kHz/31kHz switch for sprites/BG?) - b3-2, V-Res - b1-0, H-Res (0 = 8x8 tilemaps, 1 = 16x16 tilemaps, 2 or 3 = unknown) - */ - int ptr,pri; - - for(ptr=508;ptr>=0;ptr-=4) // stepping through sprites - { - pri = m_spritereg[ptr+3] & 0x03; -#ifdef MAME_DEBUG - if(!(machine().input().code_pressed(KEYCODE_I))) -#endif - if(pri == priority) - { // if at the right priority level, draw the sprite - rectangle rect; - int code = m_spritereg[ptr+2] & 0x00ff; - int colour = (m_spritereg[ptr+2] & 0x0f00) >> 8; - int xflip = m_spritereg[ptr+2] & 0x4000; - int yflip = m_spritereg[ptr+2] & 0x8000; - int sx = (m_spritereg[ptr+0] & 0x3ff) - 16; - int sy = (m_spritereg[ptr+1] & 0x3ff) - 16; - - rect.min_x=m_crtc.hshift; - rect.min_y=m_crtc.vshift; - rect.max_x=rect.min_x + m_crtc.visible_width-1; - rect.max_y=rect.min_y + m_crtc.visible_height-1; - - sx += m_crtc.bg_hshift; - sx += m_sprite_shift; - - m_gfxdecode->gfx(1)->zoom_transpen(bitmap,cliprect,code,colour,xflip,yflip,m_crtc.hbegin+sx,m_crtc.vbegin+(sy*m_crtc.bg_double),0x10000,0x10000*m_crtc.bg_double,0x00); - } - } -} - -static const gfx_layout x68k_pcg_8 = -{ - 8,8, - 256, - 4, - { 0,1,2,3 }, - { 8,12,0,4,24,28,16,20 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 32*8 -}; - -static const gfx_layout x68k_pcg_16 = -{ - 16,16, - 256, - 4, - { 0,1,2,3 }, - { 8,12,0,4,24,28,16,20,8+64*8,12+64*8,64*8,4+64*8,24+64*8,28+64*8,16+64*8,20+64*8 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, - 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 }, - 128*8 -}; - -TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg0_tile) -{ - int code = m_spriteram[0x3000+tile_index] & 0x00ff; - int colour = (m_spriteram[0x3000+tile_index] & 0x0f00) >> 8; - int flags = (m_spriteram[0x3000+tile_index] & 0xc000) >> 14; - SET_TILE_INFO_MEMBER(0,code,colour,flags); -} - -TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg1_tile) -{ - int code = m_spriteram[0x2000+tile_index] & 0x00ff; - int colour = (m_spriteram[0x2000+tile_index] & 0x0f00) >> 8; - int flags = (m_spriteram[0x2000+tile_index] & 0xc000) >> 14; - SET_TILE_INFO_MEMBER(0,code,colour,flags); -} - -TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg0_tile_16) -{ - int code = m_spriteram[0x3000+tile_index] & 0x00ff; - int colour = (m_spriteram[0x3000+tile_index] & 0x0f00) >> 8; - int flags = (m_spriteram[0x3000+tile_index] & 0xc000) >> 14; - SET_TILE_INFO_MEMBER(1,code,colour,flags); -} - -TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg1_tile_16) -{ - int code = m_spriteram[0x2000+tile_index] & 0x00ff; - int colour = (m_spriteram[0x2000+tile_index] & 0x0f00) >> 8; - int flags = (m_spriteram[0x2000+tile_index] & 0xc000) >> 14; - SET_TILE_INFO_MEMBER(1,code,colour,flags); -} - -VIDEO_START_MEMBER(x68k_state,x68000) -{ - int gfx_index; - - for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) - if (m_gfxdecode->gfx(gfx_index) == 0) - break; - - /* create the char set (gfx will then be updated dynamically from RAM) */ - m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_pcgpalette, x68k_pcg_8, memregion("user1")->base(), 0, 32, 0))); - - gfx_index++; - - m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_pcgpalette, x68k_pcg_16, memregion("user1")->base(), 0, 32, 0))); - m_gfxdecode->gfx(gfx_index)->set_colors(32); - - /* Tilemaps */ - m_bg0_8 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(x68k_state::x68k_get_bg0_tile),this),TILEMAP_SCAN_ROWS,8,8,64,64); - m_bg1_8 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(x68k_state::x68k_get_bg1_tile),this),TILEMAP_SCAN_ROWS,8,8,64,64); - m_bg0_16 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(x68k_state::x68k_get_bg0_tile_16),this),TILEMAP_SCAN_ROWS,16,16,64,64); - m_bg1_16 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(x68k_state::x68k_get_bg1_tile_16),this),TILEMAP_SCAN_ROWS,16,16,64,64); - - m_bg0_8->set_transparent_pen(0); - m_bg1_8->set_transparent_pen(0); - m_bg0_16->set_transparent_pen(0); - m_bg1_16->set_transparent_pen(0); - - m_pcgbitmap = auto_bitmap_ind16_alloc(machine(), 1024, 1024); - m_pcgbitmap->fill(0); - - m_gfxbitmap = auto_bitmap_ind16_alloc(machine(), 1024, 1024); - m_gfxbitmap->fill(0); - -// m_scanline_timer->adjust(attotime::zero, 0, attotime::from_hz(55.45)/568); -} - -UINT32 x68k_state::screen_update_x68000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - rectangle rect(0,0,0,0); - int priority; - int xscr,yscr; - int x; - tilemap_t* x68k_bg0; - tilemap_t* x68k_bg1; - int pixel, scanline; - //UINT8 *rom; - - if((m_spritereg[0x408] & 0x03) == 0x00) // Sprite/BG H-Res 0=8x8, 1=16x16, 2 or 3 = undefined. - { - x68k_bg0 = m_bg0_8; - x68k_bg1 = m_bg1_8; - } - else - { - x68k_bg0 = m_bg0_16; - x68k_bg1 = m_bg1_16; - } -// rect.max_x=m_crtc.width; -// rect.max_y=m_crtc.height; - bitmap.fill(0, cliprect); - - if(m_sysport.contrast == 0) // if monitor contrast is 0, then don't bother displaying anything - return 0; - - rect.min_x=m_crtc.hbegin; - rect.min_y=m_crtc.vbegin; -// rect.max_x=rect.min_x + m_crtc.visible_width-1; -// rect.max_y=rect.min_y + m_crtc.visible_height-1; - rect.max_x=m_crtc.hend; - rect.max_y=m_crtc.vend; - - if(rect.min_y < cliprect.min_y) - rect.min_y = cliprect.min_y; - if(rect.max_y > cliprect.max_y) - rect.max_y = cliprect.max_y; - - // update tiles - //rom = memregion("user1")->base(); - for(x=0;x<256;x++) - { - if(m_video.tile16_dirty[x] != 0) - { - m_gfxdecode->gfx(1)->mark_dirty(x); - m_video.tile16_dirty[x] = 0; - } - if(m_video.tile8_dirty[x] != 0) - { - m_gfxdecode->gfx(0)->mark_dirty(x); - m_video.tile8_dirty[x] = 0; - } - } - - - for(priority=2;priority>=0;priority--) - { - // Graphics screen(s) - if(priority == m_video.gfx_pri) - x68k_draw_gfx(bitmap,rect); - - // Sprite / BG Tiles - if(priority == m_video.sprite_pri /*&& (m_spritereg[0x404] & 0x0200)*/ && (m_video.reg[2] & 0x0040)) - { - m_pcgbitmap->fill(0, rect); - x68k_draw_sprites(*m_pcgbitmap,1,rect); - if((m_spritereg[0x404] & 0x0008)) - { - if((m_spritereg[0x404] & 0x0030) == 0x10) // BG1 TXSEL - { - x68k_bg0->set_scrollx(0,(m_spritereg[0x402] - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); - x68k_bg0->set_scrolly(0,(m_spritereg[0x403] - m_crtc.vbegin) & 0x3ff); - x68k_bg0->draw(screen, *m_pcgbitmap,rect,0,0); - } - else - { - x68k_bg1->set_scrollx(0,(m_spritereg[0x402] - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); - x68k_bg1->set_scrolly(0,(m_spritereg[0x403] - m_crtc.vbegin) & 0x3ff); - x68k_bg1->draw(screen, *m_pcgbitmap,rect,0,0); - } - } - x68k_draw_sprites(*m_pcgbitmap,2,rect); - if((m_spritereg[0x404] & 0x0001)) - { - if((m_spritereg[0x404] & 0x0006) == 0x02) // BG0 TXSEL - { - x68k_bg0->set_scrollx(0,(m_spritereg[0x400] - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); - x68k_bg0->set_scrolly(0,(m_spritereg[0x401] - m_crtc.vbegin) & 0x3ff); - x68k_bg0->draw(screen, *m_pcgbitmap,rect,0,0); - } - else - { - x68k_bg1->set_scrollx(0,(m_spritereg[0x400] - m_crtc.hbegin - m_crtc.bg_hshift) & 0x3ff); - x68k_bg1->set_scrolly(0,(m_spritereg[0x401] - m_crtc.vbegin) & 0x3ff); - x68k_bg1->draw(screen, *m_pcgbitmap,rect,0,0); - } - } - x68k_draw_sprites(*m_pcgbitmap,3,rect); - - for(scanline=rect.min_y;scanline<=rect.max_y;scanline++) - { - for(pixel=m_crtc.hbegin;pixel<=m_crtc.hend;pixel++) - { - UINT8 colour = m_pcgbitmap->pix16(scanline, pixel) & 0xff; - if((colour && (m_pcgpalette->pen(colour) & 0xffffff)) || ((m_video.reg[1] & 0x3000) == 0x2000)) - bitmap.pix32(scanline, pixel) = m_pcgpalette->pen(colour); - } - } - } - - // Text screen - if(m_video.reg[2] & 0x0020 && priority == m_video.text_pri) - { - xscr = (m_crtc.reg[10] & 0x3ff); - yscr = (m_crtc.reg[11] & 0x3ff); - if(!(m_crtc.reg[20] & 0x1000)) // if text layer is set to buffer, then it's not visible - x68k_draw_text(bitmap,xscr,yscr,rect); - } - } - -#ifdef MAME_DEBUG - if(machine().input().code_pressed(KEYCODE_9)) - { - m_sprite_shift--; - popmessage("Sprite shift = %i",m_sprite_shift); - } - if(machine().input().code_pressed(KEYCODE_0)) - { - m_sprite_shift++; - popmessage("Sprite shift = %i",m_sprite_shift); - } - -#endif - -#ifdef MAME_DEBUG -// popmessage("Layer priorities [%04x] - Txt: %i Spr: %i Gfx: %i Layer Pri0-3: %i %i %i %i",m_video.reg[1],m_video.text_pri,m_video.sprite_pri, -// m_video.gfx_pri,m_video.gfxlayer_pri[0],m_video.gfxlayer_pri[1],m_video.gfxlayer_pri[2],m_video.gfxlayer_pri[3]); -// popmessage("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i",m_crtc.reg[0],m_crtc.reg[1],m_crtc.reg[2],m_crtc.reg[3], -// m_crtc.reg[4],m_crtc.reg[5],m_crtc.reg[6],m_crtc.reg[7],m_crtc.reg[8],m_crtc.reg[9]); -// popmessage("Visible resolution = %ix%i (%s) Screen size = %ix%i",m_crtc.visible_width,m_crtc.visible_height,m_crtc.interlace ? "Interlaced" : "Non-interlaced",m_crtc.video_width,m_crtc.video_height); -// popmessage("VBlank : scanline = %i",m_scanline); -// popmessage("CRTC/BG compare H-TOTAL %i/%i H-DISP %i/%i V-DISP %i/%i BG Res %02x",m_crtc.reg[0],m_spritereg[0x405],m_crtc.reg[2],m_spritereg[0x406], -// m_crtc.reg[6],m_spritereg[0x407],m_spritereg[0x408]); -// popmessage("BG Scroll - BG0 X %i Y %i BG1 X %i Y %i",m_spriteram[0x400],m_spriteram[0x401],m_spriteram[0x402],m_spriteram[0x403]); -// popmessage("uPD72065 status = %02x",upd765_status_r(machine(), space, 0)); -// popmessage("Layer enable - 0x%02x",m_video.reg[2] & 0xff); -// popmessage("Graphic layer scroll - %i, %i - %i, %i - %i, %i - %i, %i", -// m_crtc.reg[12],m_crtc.reg[13],m_crtc.reg[14],m_crtc.reg[15],m_crtc.reg[16],m_crtc.reg[17],m_crtc.reg[18],m_crtc.reg[19]); -// popmessage("IOC IRQ status - %02x",m_ioc.irqstatus); -// popmessage("RAM: mouse data - %02x %02x %02x %02x",m_ram->pointer()[0x931],m_ram->pointer()[0x930],m_ram->pointer()[0x933],m_ram->pointer()[0x932]); -#endif - return 0; -} diff --git a/src/mess/video/z88.c b/src/mess/video/z88.c deleted file mode 100644 index 4b9a0b07f88..00000000000 --- a/src/mess/video/z88.c +++ /dev/null @@ -1,175 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Kevin Thacker,Sandro Ronco -/*************************************************************************** - - z88.c - - Functions to emulate the video hardware of the Cambridge Z88 - -***************************************************************************/ - -#include "includes/z88.h" - - -inline void z88_state::plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT16 color) -{ - if (xset_pen_color(0, rgb_t(138, 146, 148)); - m_palette->set_pen_color(1, rgb_t(92, 83, 88)); - m_palette->set_pen_color(2, rgb_t(122, 126, 129)); -} - -/* temp - change to gfxelement structure */ - -void z88_state::vh_render_8x8(bitmap_ind16 &bitmap, int x, int y, UINT16 pen0, UINT16 pen1, UINT8 *gfx) -{ - for (int h=0; h<8; h++) - { - UINT8 data = gfx[h]; - - for (int b=0; b<8; b++) - { - plot_pixel(bitmap, x+b, y+h, (data & 0x80) ? pen1 : pen0); - - data = data<<1; - } - } -} - -void z88_state::vh_render_6x8(bitmap_ind16 &bitmap, int x, int y, UINT16 pen0, UINT16 pen1, UINT8 *gfx) -{ - for (int h=0; h<8; h++) - { - UINT8 data = gfx[h]<<2; - - for (int b=0; b<6; b++) - { - plot_pixel(bitmap, x+1+b, y+h, (data & 0x80) ? pen1 : pen0); - data = data<<1; - } - } -} - -void z88_state::vh_render_line(bitmap_ind16 &bitmap, int x, int y, UINT16 pen) -{ - for (int i=0; i<8; i++) - plot_pixel(bitmap, x + i, y + 7, pen); -} - -UPD65031_SCREEN_UPDATE(z88_state::lcd_update) -{ - if (sbf == 0) - { - // LCD disabled - bitmap.fill(0); - } - else - { - UINT8 *vram = convert_address(sbf<<11); - - for (int y=0; y<(Z88_SCREEN_HEIGHT>>3); y++) - { - int x = 0, c = 0; - - while (x < Z88_SCREEN_WIDTH) - { - UINT16 pen0, pen1; - UINT8 *char_gfx; - UINT8 byte0 = vram[(y * 0x100) + c]; - UINT8 byte1 = vram[(y * 0x100) + c + 1]; - - // inverted graphics? - if (byte1 & Z88_SCR_HW_REV) - { - pen0 = (byte1 & Z88_SCR_HW_GRY) ? 2 : 1; - pen1 = 0; - } - else - { - pen0 = 0; - pen1 = (byte1 & Z88_SCR_HW_GRY) ? 2 : 1; - } - - if ((byte1 & Z88_SCR_HW_NULL) == Z88_SCR_HW_NULL) - { - // hidden - } - else if (!(byte1 & Z88_SCR_HW_HRS) || (((byte1 & Z88_SCR_HW_CURS) == Z88_SCR_HW_CURS))) - { - // low-res 6x8 - UINT16 ch = (byte0 | (byte1<<8)) & 0x1ff; - - if ((ch & 0x01c0) == 0x01c0) - { - ch &= 0x3f; - - char_gfx = convert_address(lores0<<9); - } - else - { - char_gfx = convert_address(lores1<<12); - } - - char_gfx += (ch<<3); - - // cursor flash - if (flash && (byte1 & Z88_SCR_HW_CURS) == Z88_SCR_HW_CURS) - vh_render_6x8(bitmap, x,(y<<3), pen1, pen0, char_gfx); - else - vh_render_6x8(bitmap, x,(y<<3), pen0, pen1, char_gfx); - - // underline? - if (byte1 & Z88_SCR_HW_UND) - vh_render_line(bitmap, x, (y<<3), pen1); - - x += 6; - } - else if ((byte1 & Z88_SCR_HW_HRS) && !(byte1 & Z88_SCR_HW_REV)) - { - // high-res 8x8 - UINT16 ch = (byte0 | (byte1<<8)) & 0x3ff; - - if (ch & 0x0100) - { - ch &= 0xff; - char_gfx = convert_address(hires1<<11); - } - else - { - ch &= 0xff; - char_gfx = convert_address(hires0<<13); - } - - char_gfx += (ch<<3); - - // flash - if ((byte1 & Z88_SCR_HW_FLS) && flash) - pen0 = pen1 = 0; - - vh_render_8x8(bitmap, x,(y<<3), pen0, pen1, char_gfx); - - x += 8; - } - - // every char takes 2 bytes - c += 2; - } - } - } -} diff --git a/src/mess/video/zx.c b/src/mess/video/zx.c deleted file mode 100644 index 8948a395246..00000000000 --- a/src/mess/video/zx.c +++ /dev/null @@ -1,223 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Juergen Buchmueller, Krzysztof Strzecha, Robbbert -/*************************************************************************** - zx.c - - video hardware - Juergen Buchmueller , Dec 1999 - - The ZX has a very unorthodox video RAM system. To start a scanline, - the CPU must jump to video RAM at 0xC000, which is a mirror of the - RAM at 0x4000. The video chip (ULA?) pulls a switcharoo and changes - the video bytes as they are fetched by the CPU. - - The video chip draws the scanline until a HALT instruction (0x76) is - reached, which indicates no further video RAM for this scanline. Any - other video byte is used to generate a tile and at the same time, - appears to the CPU as a NOP (0x00) instruction. - -****************************************************************************/ - -#include "includes/zx.h" - - -void zx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_TAPE_PULSE: - zx_tape_pulse(ptr, param); - break; - case TIMER_ULA_NMI: - zx_ula_nmi(ptr, param); - break; - case TIMER_ULA_IRQ: - zx_ula_irq(ptr, param); - break; - default: - assert_always(FALSE, "Unknown id in zx_state::device_timer"); - } -} - - -/* - * Toggle the video output between black and white. - * This happens whenever the ULA scanline IRQs are enabled/disabled. - * Normally this is done during the synchronized zx_ula_r() function, - * which outputs 8 pixels per code, but if the video sync is off - * (during tape IO or sound output) zx_ula_bkgnd() is used to - * simulate the display of a ZX80/ZX81. - */ -void zx_state::zx_ula_bkgnd(UINT8 color) -{ - int width = m_screen->width(); - int height = m_screen->height(); - const rectangle &visarea = m_screen->visible_area(); - - if (m_ula_frame_vsync == 0 && color != m_old_c) - { - int y, new_x, new_y; - rectangle r; - bitmap_ind16 &bitmap = m_bitmap; - - new_y = machine().first_screen()->vpos(); - new_x = machine().first_screen()->hpos(); -/* logerror("zx_ula_bkgnd: %3d,%3d - %3d,%3d\n", state->m_old_x, state->m_old_y, new_x, new_y);*/ - y = m_old_y; - for (;;) - { - if (y == new_y) - { - r.set(m_old_x, new_x, y, y); - bitmap.fill(color, r); - break; - } - else - { - r.set(m_old_x, visarea.max_x, y, y); - bitmap.fill(color, r); - m_old_x = 0; - } - if (++y == height) - y = 0; - } - m_old_x = (new_x + 1) % width; - m_old_y = new_y; - m_old_c = color; - } -} - -/* - * PAL: 310 total lines, - * 0.. 55 vblank - * 56..247 192 visible lines - * 248..303 vblank - * 304... vsync - * NTSC: 262 total lines - * 0.. 31 vblank - * 32..223 192 visible lines - * 224..233 vblank - */ -TIMER_CALLBACK_MEMBER(zx_state::zx_ula_nmi) -{ - /* - * An NMI is issued on the ZX81 every 64us for the blanked - * scanlines at the top and bottom of the display. - */ - int height = m_screen->height(); - const rectangle& r1 = m_screen->visible_area(); - rectangle r; - - bitmap_ind16 &bitmap = m_bitmap; - r.set(r1.min_x, r1.max_x, m_ula_scanline_count, m_ula_scanline_count); - bitmap.fill(1, r); -// logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine().first_screen()->vpos(), ula_scancode_count, (unsigned) m_maincpu->state_int(Z80_R), (unsigned) m_maincpu->state_int(Z80_PC)); - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - if (++m_ula_scanline_count == height) - m_ula_scanline_count = 0; -} - -TIMER_CALLBACK_MEMBER(zx_state::zx_ula_irq) -{ - /* - * An IRQ is issued on the ZX80/81 whenever the R registers - * bit 6 goes low. In MESS this IRQ timed from the first read - * from the copy of the DFILE in the upper 32K in zx_ula_r(). - */ - if (m_ula_irq_active) - { -// logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", machine().first_screen()->vpos(), ula_scancode_count, (unsigned) m_maincpu->state_int(Z80_R), (unsigned) m_maincpu->state_int(Z80_PC)); - - m_ula_irq_active = 0; - m_maincpu->set_input_line(0, HOLD_LINE); - } -} - -void zx_state::zx_ula_r(int offs, memory_region *region, const UINT8 param) -{ - int offs0 = offs & 0x7fff; - UINT8 *rom = m_region_maincpu->base(); - UINT8 chr = rom[offs0]; - - if ((!m_ula_irq_active) && (chr == 0x76)) - { - bitmap_ind16 &bitmap = m_bitmap; - UINT16 y, *scanline; - UINT16 ireg = m_maincpu->state_int(Z80_I) << 8; - UINT8 data, *chrgen, creg; - - if (param) - creg = m_maincpu->state_int(Z80_B); - else - creg = m_maincpu->state_int(Z80_C); - - chrgen = region->base(); - - if ((++m_ula_scanline_count == m_screen->height()) || (creg == 32)) - { - m_ula_scanline_count = 0; - m_offs1 = offs0; - } - - m_ula_frame_vsync = 3; - - m_charline_ptr = 0; - - for (y = m_offs1+1; ((y < offs0) && (m_charline_ptr < ARRAY_LENGTH(m_charline))); y++) - { - m_charline[m_charline_ptr] = rom[y]; - m_charline_ptr++; - } - for (y = m_charline_ptr; y < ARRAY_LENGTH(m_charline); y++) - m_charline[y] = 0; - - timer_set(m_maincpu->cycles_to_attotime(((32 - m_charline_ptr) << 2)), TIMER_ULA_IRQ); - m_ula_irq_active++; - - scanline = &bitmap.pix16(m_ula_scanline_count); - y = 0; - - for (m_charline_ptr = 0; m_charline_ptr < ARRAY_LENGTH(m_charline); m_charline_ptr++) - { - chr = m_charline[m_charline_ptr]; - data = chrgen[ireg | ((chr & 0x3f) << 3) | ((8 - creg)&7) ]; - if (chr & 0x80) data ^= 0xff; - - scanline[y++] = (data >> 7) & 1; - scanline[y++] = (data >> 6) & 1; - scanline[y++] = (data >> 5) & 1; - scanline[y++] = (data >> 4) & 1; - scanline[y++] = (data >> 3) & 1; - scanline[y++] = (data >> 2) & 1; - scanline[y++] = (data >> 1) & 1; - scanline[y++] = (data >> 0) & 1; - m_charline[m_charline_ptr] = 0; - } - - if (creg == 1) m_offs1 = offs0; - } -} - -void zx_state::video_start() -{ - m_ula_nmi = timer_alloc(TIMER_ULA_NMI); - m_ula_irq_active = 0; - m_screen->register_screen_bitmap(m_bitmap); -} - -void zx_state::screen_eof_zx(screen_device &screen, bool state) -{ - // rising edge - if (state) - { - /* decrement video synchronization counter */ - if (m_ula_frame_vsync) - --m_ula_frame_vsync; - } -} - -UINT32 zx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); - return 0; -} diff --git a/src/mess/video/zx8301.c b/src/mess/video/zx8301.c deleted file mode 100644 index a7c115e8237..00000000000 --- a/src/mess/video/zx8301.c +++ /dev/null @@ -1,334 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Sinclair ZX8301 emulation - -**********************************************************************/ - -/* - - TODO: - - - wait state on memory access during video update - - proper video timing - - get rid of flash timer - -*/ - -#include "zx8301.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define LOG 0 - - -// low resolution palette -static const int ZX8301_COLOR_MODE4[] = { 0, 2, 4, 7 }; - - -static const rgb_t PALETTE_ZX8301[] = -{ - rgb_t(0x00, 0x00, 0x00), // black - rgb_t(0x00, 0x00, 0xff), // blue - rgb_t(0xff, 0x00, 0x00), // red - rgb_t(0xff, 0x00, 0xff), // magenta - rgb_t(0x00, 0xff, 0x00), // green - rgb_t(0x00, 0xff, 0xff), // cyan - rgb_t(0xff, 0xff, 0x00), // yellow - rgb_t(0xff, 0xff, 0xff) // white -}; - - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -// devices -const device_type ZX8301 = &device_creator; - - -// default address map -static ADDRESS_MAP_START( zx8301, AS_0, 8, zx8301_device ) - AM_RANGE(0x00000, 0x1ffff) AM_RAM -ADDRESS_MAP_END - - -//------------------------------------------------- -// memory_space_config - return a description of -// any address spaces owned by this device -//------------------------------------------------- - -const address_space_config *zx8301_device::memory_space_config(address_spacenum spacenum) const -{ - return (spacenum == AS_0) ? &m_space_config : NULL; -} - - - -//************************************************************************** -// INLINE HELPERS -//************************************************************************** - -//------------------------------------------------- -// readbyte - read a byte at the given address -//------------------------------------------------- - -inline UINT8 zx8301_device::readbyte(offs_t address) -{ - return space().read_byte(address); -} - - -//------------------------------------------------- -// writebyte - write a byte at the given address -//------------------------------------------------- - -inline void zx8301_device::writebyte(offs_t address, UINT8 data) -{ - space().write_byte(address, data); -} - - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// zx8301_device - constructor -//------------------------------------------------- - -zx8301_device::zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ZX8301, "Sinclair ZX8301", tag, owner, clock, "zx8301", __FILE__), - device_memory_interface(mconfig, *this), - device_video_interface(mconfig, *this), - m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(zx8301)), - m_cpu(*this), - m_write_vsync(*this), - m_dispoff(1), - m_mode8(0), - m_base(0), - m_flash(1), - m_vsync(1), - m_vda(0) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void zx8301_device::device_start() -{ - // resolve callbacks - m_write_vsync.resolve_safe(); - - // allocate timers - m_vsync_timer = timer_alloc(TIMER_VSYNC); - m_flash_timer = timer_alloc(TIMER_FLASH); - - // adjust timer periods - m_vsync_timer->adjust(attotime::zero, 0, attotime::from_hz(50)); - m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); - - // register for state saving - save_item(NAME(m_dispoff)); - save_item(NAME(m_mode8)); - save_item(NAME(m_base)); - save_item(NAME(m_flash)); - save_item(NAME(m_vsync)); - save_item(NAME(m_vda)); -} - - -//------------------------------------------------- -// device_timer - handler timer events -//------------------------------------------------- - -void zx8301_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_VSYNC: - //m_vsync = !m_vsync; - m_write_vsync(m_vsync); - break; - - case TIMER_FLASH: - m_flash = !m_flash; - break; - } -} - - -//------------------------------------------------- -// control_w - display control register -//------------------------------------------------- - -WRITE8_MEMBER( zx8301_device::control_w ) -{ - /* - - bit description - - 0 - 1 display off - 2 - 3 graphics mode - 4 - 5 - 6 - 7 display base address - - */ - - if (LOG) logerror("ZX8301 Control: %02x\n", data); - - // display off - m_dispoff = BIT(data, 1); - - // graphics mode - m_mode8 = BIT(data, 3); - - // display base address - m_base = BIT(data, 7); -} - - -//------------------------------------------------- -// data_r - RAM read -//------------------------------------------------- - -READ8_MEMBER( zx8301_device::data_r ) -{ - if (LOG) logerror("ZX8301 RAM Read: %06x\n", offset); - - if (m_vda) - { - m_cpu->spin_until_time(m_screen->time_until_pos(256, 0)); - } - - return readbyte(offset); -} - - -//------------------------------------------------- -// data_w - RAM write -//------------------------------------------------- - -WRITE8_MEMBER( zx8301_device::data_w ) -{ - if (LOG) logerror("ZX8301 RAM Write: %06x = %02x\n", offset, data); - - if (m_vda) - { - m_cpu->spin_until_time(m_screen->time_until_pos(256, 0)); - } - - writebyte(offset, data); -} - - -//------------------------------------------------- -// draw_line_mode4 - draw mode 4 line -//------------------------------------------------- - -void zx8301_device::draw_line_mode4(bitmap_rgb32 &bitmap, int y, UINT16 da) -{ - int x = 0; - - for (int word = 0; word < 64; word++) - { - UINT8 byte_high = readbyte(da++); - UINT8 byte_low = readbyte(da++); - - for (int pixel = 0; pixel < 8; pixel++) - { - int red = BIT(byte_low, 7); - int green = BIT(byte_high, 7); - int color = (green << 1) | red; - - bitmap.pix32(y, x++) = PALETTE_ZX8301[ZX8301_COLOR_MODE4[color]]; - - byte_high <<= 1; - byte_low <<= 1; - } - } -} - - -//------------------------------------------------- -// draw_line_mode8 - draw mode 8 line -//------------------------------------------------- - -void zx8301_device::draw_line_mode8(bitmap_rgb32 &bitmap, int y, UINT16 da) -{ - int x = 0; - - for (int word = 0; word < 64; word++) - { - UINT8 byte_high = readbyte(da++); - UINT8 byte_low = readbyte(da++); - - for (int pixel = 0; pixel < 4; pixel++) - { - int red = BIT(byte_low, 7); - int green = BIT(byte_high, 7); - int blue = BIT(byte_low, 6); - int flash = BIT(byte_high, 6); - - int color = (green << 2) | (red << 1) | blue; - - if (flash && m_flash) - { - color = 0; - } - - bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; - bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; - - byte_high <<= 2; - byte_low <<= 2; - } - } -} - - -//------------------------------------------------- -// screen_update - -//------------------------------------------------- - -UINT32 zx8301_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - if (!m_dispoff) - { - UINT32 da = m_base << 15; - - for (int y = 0; y < 256; y++) - { - if (m_mode8) - { - draw_line_mode8(bitmap, y, da); - } - else - { - draw_line_mode4(bitmap, y, da); - } - - da += 128; - } - } - else - { - bitmap.fill(rgb_t::black, cliprect); - } - - return 0; -} diff --git a/src/mess/video/zx8301.h b/src/mess/video/zx8301.h deleted file mode 100644 index c91b1c65bca..00000000000 --- a/src/mess/video/zx8301.h +++ /dev/null @@ -1,123 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Sinclair ZX8301 emulation - -********************************************************************** - _____ _____ - DTACKL 1 |* \_/ | 40 WEL - A17 2 | | 39 PCENL - A16 3 | | 38 VDA - RDWL 4 | | 37 ROWL - DSMCL 5 | | 36 TX0EL - VCC 6 | | 35 XTAL2 - CLKCPU 7 | | 34 XTAL1 - RASL 8 | | 33 ROM0EH - CAS0L 9 | | 32 BLUE - CAS1L 10 | ZX8301 | 31 GREEN - VSYNCH 11 | ULA | 30 RED - CSYNCL 12 | | 29 DB7 - DA0 13 | | 28 DA7 - DB0 14 | | 27 DA6 - VDD 15 | | 26 DB6 - DB1 16 | | 25 DB5 - DA1 17 | | 24 DA5 - DA2 18 | | 23 DB4 - DB2 19 | | 22 DA4 - DA3 20 |_____________| 21 DB3 - -**********************************************************************/ - -#pragma once - -#ifndef __ZX8301__ -#define __ZX8301__ - -#include "emu.h" - - - -///************************************************************************* -// INTERFACE CONFIGURATION MACROS -///************************************************************************* - -#define MCFG_ZX8301_CPU(_tag) \ - zx8301_device::static_set_cpu_tag(*device, "^" _tag); - -#define MCFG_ZX8301_VSYNC_CALLBACK(_write) \ - devcb = &zx8301_device::set_vsync_wr_callback(*device, DEVCB_##_write); - - - -///************************************************************************* -// TYPE DEFINITIONS -///************************************************************************* - -// ======================> zx8301_device - -class zx8301_device : public device_t, - public device_memory_interface, - public device_video_interface -{ -public: - // construction/destruction - zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template static devcb_base &set_vsync_wr_callback(device_t &device, _Object object) { return downcast(device).m_write_vsync.set_callback(object); } - static void static_set_cpu_tag(device_t &device, const char *tag) { downcast(device).m_cpu.set_tag(tag); } - - DECLARE_WRITE8_MEMBER( control_w ); - DECLARE_READ8_MEMBER( data_r ); - DECLARE_WRITE8_MEMBER( data_w ); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - - // device_config_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; - - // address space configurations - const address_space_config m_space_config; - - inline UINT8 readbyte(offs_t address); - inline void writebyte(offs_t address, UINT8 data); - - void draw_line_mode4(bitmap_rgb32 &bitmap, int y, UINT16 da); - void draw_line_mode8(bitmap_rgb32 &bitmap, int y, UINT16 da); - -private: - enum - { - TIMER_VSYNC, - TIMER_FLASH - }; - - required_device m_cpu; - - devcb_write_line m_write_vsync; - - //address_space *m_data; - - int m_dispoff; // display off - int m_mode8; // mode8 active - int m_base; // video ram base address - int m_flash; // flash - int m_vsync; // vertical sync - int m_vda; // valid data address - - emu_timer *m_vsync_timer; // vertical sync timer - emu_timer *m_flash_timer; // flash timer -}; - - -// device type definition -extern const device_type ZX8301; - - - -#endif -- cgit v1.2.3